import { type DomainInput } from './domain-writer.js'; import type { ManifestFanoutPolicy, ManifestModelLifecycle, ManifestRelationshipCardinality, ManifestRelationshipValidationEvidence } from './types.js'; /** PERF-001 instrumentation: physical dbt JSON parses since the last reset. */ export declare function resetDbtArtifactReadCount(): void; /** PERF-001 instrumentation used by the ignored scale evidence harness. */ export declare function dbtArtifactReadCount(): number; export interface DomainPackageAuthoringInput extends DomainInput { id: string; exports?: string[]; } /** * A Model Area is one focused, reviewable source file inside a Domain Package. * It is intentionally not a second semantic model: entities and relationships * still compile into the domain-wide graph. */ export interface ModelAreaAuthoringInput { id: string; domain: string; name: string; description?: string; intentExamples?: string[]; references?: string[]; } export interface EntityBindingAuthoringInput { id: string; domain: string; dbtModel: string; /** Optional focused source area. Omit only for legacy/default model files. */ areaId?: string; businessName?: string; businessContext?: string; conceptRefs?: string[]; analyticalRole?: 'event' | 'dimension' | 'snapshot' | 'bridge' | 'unknown'; status?: ManifestModelLifecycle; owner?: string; grain?: string; keys?: string[]; } export interface RelationshipAuthoringInput { id: string; domain: string; /** Optional focused source area that owns this relationship. */ areaId?: string; from: string; to: string; keys: Array<{ from: string; to: string; }>; cardinality: ManifestRelationshipCardinality; fanout: ManifestFanoutPolicy; status?: ManifestModelLifecycle; crossDomain?: boolean; owner?: string; certifiedAgainst?: { from: { grain: string; keys: string[]; }; to: { grain: string; keys: string[]; }; }; validation?: ManifestRelationshipValidationEvidence; ownerDomain?: string; verb?: string; description?: string; rationale?: string; roles?: { from?: string; to?: string; }; optionality?: { from: 'required' | 'optional' | 'unknown'; to: 'required' | 'optional' | 'unknown'; }; joinTypes?: Array<'left' | 'inner'>; aggregation?: { measuresFrom: string[]; dimensionsFrom: string[]; requiresPreAggregation?: boolean; }; temporal?: { factTime: string; validFrom: string; validTo?: string; openEnded?: boolean; }; attributionBlock?: string; importRefs?: string[]; evidenceExpiresAt?: string; } export interface ContractAuthoringInput { id: string; domain: string; entities: string[]; blocks?: string[]; status?: ManifestModelLifecycle; owner?: string; requiredEvaluation?: boolean; version?: number; grain?: string; metricRefs?: string[]; dimensions?: string[]; allowedFilters?: string[]; requiredFilters?: string[]; purpose?: string; evaluationRefs?: string[]; } export interface DomainExportAuthoringInput { id: string; domain: string; version?: number; entity?: string; metrics?: string[]; blocks?: string[]; allowedKeys?: string[]; allowedDimensions?: string[]; allowedFilters?: string[]; purposes?: string[]; consumerDomains?: string[]; classification?: string; contract?: string; status?: ManifestModelLifecycle; owner?: string; } export interface DomainImportAuthoringInput { id?: string; domain: string; exportRef: string; purpose: string; status?: ManifestModelLifecycle; owner?: string; } export type ModelingAuthoringChange = { operation: 'upsert_domain'; value: DomainPackageAuthoringInput; } | { operation: 'upsert_area'; value: ModelAreaAuthoringInput; } | { operation: 'upsert_entity'; value: EntityBindingAuthoringInput; } | { operation: 'upsert_relationship'; value: RelationshipAuthoringInput; } | { operation: 'upsert_contract'; value: ContractAuthoringInput; } | { operation: 'upsert_export'; value: DomainExportAuthoringInput; } | { operation: 'upsert_import'; value: DomainImportAuthoringInput; } | { operation: 'remove_entity'; value: ModelingObjectRef; } | { operation: 'remove_relationship'; value: ModelingObjectRef; } | { operation: 'remove_area'; value: ModelingObjectRef; } | { operation: 'remove_contract'; value: ModelingObjectRef; } | { operation: 'remove_export'; value: ModelingObjectRef; } | { operation: 'remove_import'; value: ModelingObjectRef; }; /** Identifies an authored modeling object for removal. */ export interface ModelingObjectRef { id: string; domain: string; /** Set when the object is owned by a Model Area rather than the domain root. */ areaId?: string; } export interface ModelingSourcePatch { path: string; before: string; after: string; changed: boolean; } export interface ModelingChangePreview { operation: ModelingAuthoringChange['operation']; patches: ModelingSourcePatch[]; fingerprint: string; } export interface ModelingChangesPreview { operation: 'batch'; changes: ModelingAuthoringChange[]; patches: ModelingSourcePatch[]; fingerprint: string; /** * Source paths each change touched, by its index in `changes`. Attribution is * captured inside the composed shadow because a change that depends on an * earlier one in the batch (an entity in a Domain the batch is still * creating) cannot be previewed standalone against the real project. */ patchPathsByChange: string[][]; } export interface DbtNodeAuthoringDetail { uniqueId: string; name: string; resourceType: 'model' | 'source'; relation?: string; sourcePath?: string; description?: string; columns: Array<{ name: string; type?: string; description?: string; tests: string[]; }>; tests: string[]; dqlMeta?: { grain?: string; keys: string[]; }; } /** A dbt-owned documentation/test edit. DQL only plans and applies a source * YAML patch; it never mutates manifest.json or mirrors these fields into a * Domain Package. */ export interface DbtSourceAuthoringInput { uniqueId: string; description?: string; columns?: Array<{ name: string; description?: string; tests?: string[]; }>; } export interface DbtSourcePatchPreview { uniqueId: string; patch: ModelingSourcePatch; fingerprint: string; } export declare function previewDbtSourcePatch(dbtProjectRoot: string, manifestPath: string, input: DbtSourceAuthoringInput): DbtSourcePatchPreview; export declare function applyDbtSourcePatch(dbtProjectRoot: string, manifestPath: string, input: DbtSourceAuthoringInput, expectedFingerprint: string): DbtSourcePatchPreview; export declare function previewModelingChange(projectRoot: string, change: ModelingAuthoringChange): ModelingChangePreview; /** * Compose an ordered batch against a disposable Domain Package shadow. This is * intentionally write-free for the real project and avoids the lost-update bug * caused by independently previewing two changes that target the same YAML file. */ export declare function previewModelingChanges(projectRoot: string, changes: ModelingAuthoringChange[]): ModelingChangesPreview; /** Apply exactly one reviewed batch, rolling every changed file back on error. */ export declare function applyModelingChanges(projectRoot: string, changes: ModelingAuthoringChange[], expectedFingerprint: string): ModelingChangesPreview; export declare function applyModelingChange(projectRoot: string, change: ModelingAuthoringChange, expectedFingerprint?: string): ModelingChangePreview; export declare function loadDbtNodeAuthoringDetail(manifestPath: string, uniqueId: string): DbtNodeAuthoringDetail | undefined; //# sourceMappingURL=dbt-first-authoring.d.ts.map