@prisma-next/family-sql 0.4.0-dev.2 → 0.4.0-dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -20,8 +20,7 @@ Provides the SQL family descriptor (`ControlFamilyDescriptor`) that includes:
20
20
  - **Destructive Change Detection**: Compares two `SqlStorage` values and identifies destructive changes (dropped tables/columns) for migration policy enforcement
21
21
  - **Storage Type Control Hooks**: Extracts codec-owned control hooks for planning/verification/introspection of `storage.types` without adding enum-specific fields to shared IR
22
22
  - **Codec Ownership**: Enforces a single owner per `codecId` for parameterized renderers and control-plane hooks to prevent ambiguous conflicts during assembly
23
- - **Mutation Default Registry Assembly**: Assembles control-plane default-function entries and generator descriptors from composed components with hard-error collisions
24
- - **PSL Interpretation Input Assembly**: Assembles target-bound scalar type descriptors plus mutation-default contributions for PSL provider/interpreter inputs
23
+ - **Authoring Contribution Assembly**: Assembles authoring contributions (type constructors, field presets) from composed components for PSL interpretation
25
24
  - **Parameterized Type Verification**: Expands contract `typeParams` into expected native type strings during schema verification and flags missing parameters as type mismatches
26
25
  - **Schema Defaults Policy**: Ignores execution mutation defaults during schema verification since they are applied before DB writes
27
26
  - **Foreign Key Config Awareness**: Schema verification respects the contract's `foreignKeys` configuration — when `foreignKeys.constraints` is `false`, FK constraint checks are skipped during verification (see [ADR 161](../../../docs/architecture%20docs/adrs/ADR%20161%20-%20Explicit%20foreign%20key%20constraint%20and%20index%20configuration.md))
@@ -30,35 +29,34 @@ Provides the SQL family descriptor (`ControlFamilyDescriptor`) that includes:
30
29
  ## Usage
31
30
 
32
31
  ```typescript
33
- import sql, {
34
- assembleAuthoringContributions,
35
- assemblePslInterpretationContributions,
36
- } from '@prisma-next/family-sql/control';
32
+ import sql from '@prisma-next/family-sql/control';
33
+ import { createControlStack } from '@prisma-next/framework-components/control';
37
34
 
38
35
  // sql is a ControlFamilyDescriptor with:
39
36
  // - kind: 'family'
40
37
  // - id: 'sql'
41
38
  // - familyId: 'sql'
42
39
  // - hook: TargetFamilyHook
43
- // - create: (options) => SqlFamilyInstance
40
+ // - create: (stack) => SqlFamilyInstance
44
41
 
45
- // Create a family instance for control-plane operations
46
- const familyInstance = sql.create({
42
+ // Build a control stack (assembles all contributions from components)
43
+ const stack = createControlStack({
44
+ family: sql,
47
45
  target: postgresTargetDescriptor,
48
46
  adapter: postgresAdapterDescriptor,
49
- driver: postgresDriverDescriptor, // Required
50
- extensions: [pgVectorExtensionDescriptor],
47
+ driver: postgresDriverDescriptor,
48
+ extensionPacks: [pgVectorExtensionDescriptor],
51
49
  });
52
50
 
51
+ // Create a family instance for control-plane operations
52
+ const familyInstance = sql.create(stack);
53
+
53
54
  // Use instance methods for domain actions
54
55
  const contract = familyInstance.validateContract(contractJson);
55
56
  const verifyResult = await familyInstance.verify({ driver, contract, ... });
56
- const emitResult = await familyInstance.emitContract({ contract: rawContract }); // Handles stripping mappings and validation internally
57
57
 
58
58
  // Targets that implement SqlControlTargetDescriptor can build planners
59
59
  const planner = postgresTargetDescriptor.migrations.createPlanner(familyInstance);
60
- // frameworkComponents should include the active target, adapter, and any extension descriptors so
61
- // planner/runner can resolve database dependencies declared by those components.
62
60
  const planResult = planner.plan({
63
61
  contract: sqlContract,
64
62
  schema,
@@ -75,29 +73,10 @@ const executeResult = await runner.execute({
75
73
  frameworkComponents: [postgresTargetDescriptor, postgresAdapterDescriptor, pgVectorExtensionDescriptor],
76
74
  });
77
75
 
78
- // Assemble PSL interpretation inputs for sql-contract-psl/provider
79
- const authoringContributions = assembleAuthoringContributions([
80
- sql,
81
- postgresTargetDescriptor,
82
- postgresAdapterDescriptor,
83
- pgVectorExtensionDescriptor,
84
- ]);
85
- const pslInputs = assemblePslInterpretationContributions([
86
- sql,
87
- postgresTargetDescriptor,
88
- postgresAdapterDescriptor,
89
- pgVectorExtensionDescriptor,
90
- ]);
91
- const providerOptions = {
92
- target: postgresTargetDescriptor,
93
- authoringContributions,
94
- scalarTypeDescriptors: pslInputs.scalarTypeDescriptors,
95
- controlMutationDefaults: {
96
- defaultFunctionRegistry: pslInputs.defaultFunctionRegistry,
97
- generatorDescriptors: pslInputs.generatorDescriptors,
98
- },
99
- composedExtensionPacks: [pgVectorExtensionDescriptor.id],
100
- };
76
+ // PSL contribution assembly (scalar type descriptors, mutation defaults, authoring
77
+ // contributions, codec lookup) is handled at the framework level by createControlStack.
78
+ // The CLI passes assembled contributions via ContractSourceContext when calling
79
+ // contract source providers — no manual assembly needed in user configs.
101
80
 
102
81
  // executeResult is a Result<MigrationRunnerSuccessValue, MigrationRunnerFailure>
103
82
  if (executeResult.ok) {
@@ -1,5 +1,4 @@
1
- import { A as SqlPlannerConflict, B as SqlControlFamilyInstance, C as SqlMigrationRunner, D as SqlMigrationRunnerFailure, E as SqlMigrationRunnerExecuteOptions, F as SqlPlannerSuccessResult, I as StorageTypePlanResult, L as collectInitDependencies, M as SqlPlannerConflictLocation, N as SqlPlannerFailureResult, O as SqlMigrationRunnerResult, P as SqlPlannerResult, R as isDatabaseDependencyProvider, S as SqlMigrationPlannerPlanOptions, T as SqlMigrationRunnerExecuteCallbacks, _ as SqlMigrationPlanContractInfo, a as ControlMutationDefaultFunctionEntry, b as SqlMigrationPlanOperationTarget, c as CreateSqlMigrationPlanOptions, d as ResolveIdentityValueInput, f as SqlControlAdapterDescriptor, g as SqlMigrationPlan, h as SqlControlTargetDescriptor, i as ComponentDatabaseDependency, j as SqlPlannerConflictKind, k as SqlMigrationRunnerSuccessValue, l as ExpandNativeTypeInput, m as SqlControlStaticContributions, n as CodecControlHooks, o as ControlMutationDefaultFunctionHandler, p as SqlControlExtensionDescriptor, r as ComponentDatabaseDependencies, s as ControlMutationDefaultGeneratorDescriptor, t as AnyRecord, u as PslScalarTypeDescriptor, v as SqlMigrationPlanOperation, w as SqlMigrationRunnerErrorCode, x as SqlMigrationPlanner, y as SqlMigrationPlanOperationStep, z as SchemaVerifyOptions } from "./types-BaUzKt6Q.mjs";
2
- import { Codec } from "@prisma-next/framework-components/codec";
1
+ import { A as SqlPlannerSuccessResult, C as SqlMigrationRunnerResult, D as SqlPlannerConflictLocation, E as SqlPlannerConflictKind, F as SqlControlFamilyInstance, M as collectInitDependencies, N as isDatabaseDependencyProvider, O as SqlPlannerFailureResult, P as SchemaVerifyOptions, S as SqlMigrationRunnerFailure, T as SqlPlannerConflict, _ as SqlMigrationPlannerPlanOptions, a as CreateSqlMigrationPlanOptions, b as SqlMigrationRunnerExecuteCallbacks, c as SqlControlAdapterDescriptor, d as SqlMigrationPlan, f as SqlMigrationPlanContractInfo, g as SqlMigrationPlanner, h as SqlMigrationPlanOperationTarget, i as ComponentDatabaseDependency, j as StorageTypePlanResult, k as SqlPlannerResult, l as SqlControlExtensionDescriptor, m as SqlMigrationPlanOperationStep, n as CodecControlHooks, o as ExpandNativeTypeInput, p as SqlMigrationPlanOperation, r as ComponentDatabaseDependencies, s as ResolveIdentityValueInput, t as AnyRecord, u as SqlControlTargetDescriptor, v as SqlMigrationRunner, w as SqlMigrationRunnerSuccessValue, x as SqlMigrationRunnerExecuteOptions, y as SqlMigrationRunnerErrorCode } from "./types-CH9zsNrU.mjs";
3
2
  import { ControlFamilyDescriptor, ControlStack, MigrationOperationClass, MigrationOperationPolicy, MigrationOperationPolicy as MigrationOperationPolicy$1, MigrationPlan, MigrationPlanOperation, MigrationPlanner, MigrationPlannerConflict, MigrationPlannerConflict as MigrationPlannerConflict$1, MigrationPlannerResult, TargetMigrationsCapability, assembleAuthoringContributions } from "@prisma-next/framework-components/control";
4
3
  import { NotOk, Ok } from "@prisma-next/utils/result";
5
4
  import { SqlSchemaIR } from "@prisma-next/sql-schema-ir/types";
@@ -8,8 +7,6 @@ import { ColumnDefault, Contract } from "@prisma-next/contract/types";
8
7
  import { TargetBoundComponentDescriptor } from "@prisma-next/framework-components/components";
9
8
  import { SqlStorage, StorageColumn } from "@prisma-next/sql-contract/types";
10
9
  import * as _prisma_next_framework_components_emission0 from "@prisma-next/framework-components/emission";
11
- import { TypesImportSpec } from "@prisma-next/framework-components/emission";
12
- import { AuthoringContributions } from "@prisma-next/framework-components/authoring";
13
10
 
14
11
  //#region src/core/control-descriptor.d.ts
15
12
  declare class SqlFamilyDescriptor implements ControlFamilyDescriptor<'sql', SqlControlFamilyInstance> {
@@ -270,30 +267,7 @@ declare class SqlFamilyDescriptor implements ControlFamilyDescriptor<'sql', SqlC
270
267
  }
271
268
  //#endregion
272
269
  //#region src/core/assembly.d.ts
273
- interface SqlControlDescriptorWithContributions extends SqlControlStaticContributions {
274
- readonly id: string;
275
- readonly authoring?: AuthoringContributions;
276
- readonly types?: {
277
- readonly codecTypes?: {
278
- readonly import?: TypesImportSpec;
279
- readonly codecInstances?: ReadonlyArray<Codec>;
280
- readonly typeImports?: ReadonlyArray<TypesImportSpec>;
281
- };
282
- readonly operationTypes?: {
283
- readonly import: TypesImportSpec;
284
- };
285
- };
286
- }
287
- interface AssembledControlMutationDefaultContributions {
288
- readonly defaultFunctionRegistry: ReadonlyMap<string, ControlMutationDefaultFunctionEntry>;
289
- readonly generatorDescriptors: readonly ControlMutationDefaultGeneratorDescriptor[];
290
- }
291
- interface AssembledPslInterpretationContributions extends AssembledControlMutationDefaultContributions {
292
- readonly scalarTypeDescriptors: ReadonlyMap<string, PslScalarTypeDescriptor>;
293
- }
294
270
  declare function extractCodecControlHooks(descriptors: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>): Map<string, CodecControlHooks>;
295
- declare function assembleControlMutationDefaultContributions(descriptors: ReadonlyArray<SqlControlDescriptorWithContributions>): AssembledControlMutationDefaultContributions;
296
- declare function assemblePslInterpretationContributions(descriptors: ReadonlyArray<SqlControlDescriptorWithContributions>): AssembledPslInterpretationContributions;
297
271
  //#endregion
298
272
  //#region src/core/migrations/contract-to-schema-ir.d.ts
299
273
  /**
@@ -382,5 +356,5 @@ declare const INIT_ADDITIVE_POLICY: MigrationOperationPolicy$1;
382
356
  //#region src/exports/control.d.ts
383
357
  declare const _default: SqlFamilyDescriptor;
384
358
  //#endregion
385
- export { type CodecControlHooks, type ComponentDatabaseDependencies, type ComponentDatabaseDependency, type ContractToSchemaIROptions, type ControlMutationDefaultFunctionEntry, type ControlMutationDefaultFunctionHandler, type ControlMutationDefaultGeneratorDescriptor, type CreateSqlMigrationPlanOptions, type DefaultRenderer, type ExpandNativeTypeInput, INIT_ADDITIVE_POLICY, type MigrationOperationClass, type MigrationOperationPolicy, type MigrationPlan, type MigrationPlanOperation, type MigrationPlanner, type MigrationPlannerConflict, type MigrationPlannerResult, type NativeTypeExpander, type PslScalarTypeDescriptor, type ResolveIdentityValueInput, type SchemaVerifyOptions, type SqlControlAdapterDescriptor, type SqlControlDescriptorWithContributions, type SqlControlExtensionDescriptor, type SqlControlFamilyInstance, type SqlControlStaticContributions, type SqlControlTargetDescriptor, type SqlMigrationPlan, type SqlMigrationPlanContractInfo, type SqlMigrationPlanOperation, type SqlMigrationPlanOperationStep, type SqlMigrationPlanOperationTarget, type SqlMigrationPlanner, type SqlMigrationPlannerPlanOptions, type SqlMigrationRunner, type SqlMigrationRunnerErrorCode, type SqlMigrationRunnerExecuteCallbacks, type SqlMigrationRunnerExecuteOptions, type SqlMigrationRunnerFailure, type SqlMigrationRunnerResult, type SqlMigrationRunnerSuccessValue, type SqlPlannerConflict, type SqlPlannerConflictKind, type SqlPlannerConflictLocation, type SqlPlannerFailureResult, type SqlPlannerResult, type SqlPlannerSuccessResult, type StorageTypePlanResult, type TargetMigrationsCapability, assembleAuthoringContributions, assembleControlMutationDefaultContributions, assemblePslInterpretationContributions, collectInitDependencies, contractToSchemaIR, createMigrationPlan, _default as default, detectDestructiveChanges, extractCodecControlHooks, isDatabaseDependencyProvider, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess };
359
+ export { type CodecControlHooks, type ComponentDatabaseDependencies, type ComponentDatabaseDependency, type ContractToSchemaIROptions, type CreateSqlMigrationPlanOptions, type DefaultRenderer, type ExpandNativeTypeInput, INIT_ADDITIVE_POLICY, type MigrationOperationClass, type MigrationOperationPolicy, type MigrationPlan, type MigrationPlanOperation, type MigrationPlanner, type MigrationPlannerConflict, type MigrationPlannerResult, type NativeTypeExpander, type ResolveIdentityValueInput, type SchemaVerifyOptions, type SqlControlAdapterDescriptor, type SqlControlExtensionDescriptor, type SqlControlFamilyInstance, type SqlControlTargetDescriptor, type SqlMigrationPlan, type SqlMigrationPlanContractInfo, type SqlMigrationPlanOperation, type SqlMigrationPlanOperationStep, type SqlMigrationPlanOperationTarget, type SqlMigrationPlanner, type SqlMigrationPlannerPlanOptions, type SqlMigrationRunner, type SqlMigrationRunnerErrorCode, type SqlMigrationRunnerExecuteCallbacks, type SqlMigrationRunnerExecuteOptions, type SqlMigrationRunnerFailure, type SqlMigrationRunnerResult, type SqlMigrationRunnerSuccessValue, type SqlPlannerConflict, type SqlPlannerConflictKind, type SqlPlannerConflictLocation, type SqlPlannerFailureResult, type SqlPlannerResult, type SqlPlannerSuccessResult, type StorageTypePlanResult, type TargetMigrationsCapability, assembleAuthoringContributions, collectInitDependencies, contractToSchemaIR, createMigrationPlan, _default as default, detectDestructiveChanges, extractCodecControlHooks, isDatabaseDependencyProvider, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess };
386
360
  //# sourceMappingURL=control.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"control.d.mts","names":[],"sources":["../src/core/control-descriptor.ts","../src/core/assembly.ts","../src/core/migrations/contract-to-schema-ir.ts","../src/core/migrations/plan-helpers.ts","../src/core/migrations/policies.ts","../src/exports/control.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;cASa,mBAAA,YACA,+BAA+B;;;;;;;uCAAwB,4BAAA,CAAA;;;;;IADvD,SAAA,oBACX,EAAA,CAAA,OAAA,CAAA,8CAMkB,4BANlB,EAAA,GAAA,MAAA;IAA0C,SAAA,qBAAA,EAAA,GAAA,GAAA,MAAA;IAAwB,SAAA,kBAAA,EAAA,CAAA,gBAAA,EAAA,MAAA,EAAA,YAAA,EAAA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pC,2BH9IoC,EAAA,OAAA,EAAA,MAAA,EAAA,QAAA,EAAA;EAAwB,GAAA,CAAA,EAAA,MAAA;SGgJjC;IAChC,MAAM;;;;;;cCtJI,sBAAsB;;;cCuE8D,UAAA"}
1
+ {"version":3,"file":"control.d.mts","names":[],"sources":["../src/core/control-descriptor.ts","../src/core/assembly.ts","../src/core/migrations/contract-to-schema-ir.ts","../src/core/migrations/plan-helpers.ts","../src/core/migrations/policies.ts","../src/exports/control.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;cASa,mBAAA,YACA,+BAA+B;;;;;;;uCAAwB,4BAAA,CAAA;;IADvD,SAAA,mBACX,EAAA,CAAA,QAAA,uCAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,GAAA,MAAA;IAA0C,SAAA,wBAAA,EAAA,CAAA,UAAA,EAAA,MAAA,EAAA,KAAA,4CAAA,EAAA,GAAA,MAAA;IAAwB,SAAA,gBAAA,EAAA,GAAA,GAAA,MAAA,EAAA;0FAMhD;;;;;IAOW,SAAA,KAAA,EAAA;MAApB,SAAA,IAAA,EAAA;QACN,SAAA,IAAA,EAAA,aAAA;QAdQ,SAAA,MAAA,EAAA;UAAuB,SAAA,OAAA,EAAA,YAAA;;;;MCYpB,SAAA,SAAA,EAAwB;QACX,SAAA,IAAA,EAAA,aAAA;QAAd,SAAA,MAAA,EAAA;UACA,SAAA,OAAA,EAAA,iBAAA;UAAZ,SAAA,UAAA,EAAA,WAAA;QAAG,CAAA;;;;QCWM,SAAkB,MAAA,EAAA;UAelB,SAAe,OAAS,EAAA,iBAAuB;UAkG3C,SAAA,UAAwB,EAAA,WAAA;UAChC,SAAA,OAAA,EAAA;YACF,SAAA,IAAA,EAAA,UAAA;YACM,SAAA,UAAA,EAAA,mBAAA;UAAwB,CAAA;QAiCnB,CAAA;MAEa,CAAA;MACH,SAAA,IAAA,EAAA;QACoB,SAAA,IAAA,EAAA,aAAA;QAAd,SAAA,MAAA,EAAA;UAAa,SAAA,OAAA,EAAA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,iBADQ,wBAAA,CACR,IAAA,EAAA,UAAA,GAAA,IAAA,EAAA,EAAA,EACF,UADE,CAAA,EAAA,SAEI,0BAFJ,EAAA;AACF,UAkCW,yBAAA,CAlCX;EACM,SAAA,mBAAA,EAAA,MAAA;EAAwB,SAAA,gBAAA,CAAA,EAmCN,kBAnCM;EAiCnB,SAAA,aAAA,CAAA,EAGU,eAHe;EAEZ,SAAA,mBAAA,CAAA,EAEG,aAFH,CAEiB,8BAFjB,CAAA,KAAA,EAAA,MAAA,CAAA,CAAA;;;;;AAoB9B;;;;;;;;;ACjHA;;;AAEoB,iBD+GJ,kBAAA,CC/GI,QAAA,EDgHR,QChHQ,CDgHC,UChHD,CAAA,GAAA,IAAA,EAAA,OAAA,EDiHT,yBCjHS,CAAA,EDkHjB,WClHiB;;;iBAFJ,6CACL,8BAA8B,kBACtC,iBAAiB;iBAYJ,qCACR,iBAAiB,kBACtB,wBAAwB;iBAOX,cAAA,qBAAmC,uBAAuB;;;;iBAoB1D,aAAA;;;AH/HhB,CAAA,CAAA,EGkII,EHlIS,CGkIN,8BHjIL,CAAA;;;;iBG6Ic,aAAA,OACR;;SAE2B;IAChC,MAAM;;;;;;cCtJI,sBAAsB;;;AJInC,cKyDiG,QLzDpF,EKyDoF,mBLxD/F"}
package/dist/control.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as sqlFamilyAuthoringFieldPresets, t as sqlFamilyAuthoringTypes } from "./authoring-type-constructors-DgU-RFaP.mjs";
2
- import { c as assembleControlMutationDefaultContributions, l as assemblePslInterpretationContributions, o as collectInitDependencies, s as isDatabaseDependencyProvider, t as verifySqlSchema, u as extractCodecControlHooks } from "./verify-sql-schema-lR-tlboL.mjs";
2
+ import { c as extractCodecControlHooks, o as collectInitDependencies, s as isDatabaseDependencyProvider, t as verifySqlSchema } from "./verify-sql-schema-Ovz7RXR5.mjs";
3
3
  import { r as readMarker, t as collectSupportedCodecTypeIds } from "./verify-DZHtfcmj.mjs";
4
4
  import { sqlEmission } from "@prisma-next/sql-contract-emitter";
5
5
  import { emptyCodecLookup } from "@prisma-next/framework-components/codec";
@@ -639,5 +639,5 @@ const INIT_ADDITIVE_POLICY = Object.freeze({ allowedOperationClasses: Object.fre
639
639
  var control_default = new SqlFamilyDescriptor();
640
640
 
641
641
  //#endregion
642
- export { INIT_ADDITIVE_POLICY, assembleAuthoringContributions, assembleControlMutationDefaultContributions, assemblePslInterpretationContributions, collectInitDependencies, contractToSchemaIR, createMigrationPlan, control_default as default, detectDestructiveChanges, extractCodecControlHooks, isDatabaseDependencyProvider, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess };
642
+ export { INIT_ADDITIVE_POLICY, assembleAuthoringContributions, collectInitDependencies, contractToSchemaIR, createMigrationPlan, control_default as default, detectDestructiveChanges, extractCodecControlHooks, isDatabaseDependencyProvider, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess };
643
643
  //# sourceMappingURL=control.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"control.mjs","names":["contract: { storageHash: string; profileHash?: string }","target: { expected: string; actual?: string }","meta: { contractPath: string; configPath?: string }","result: VerifyDatabaseResult","sqlValidateContract","missingCodecs: readonly string[] | undefined","previousHashes: { storageHash?: string; profileHash?: string } | undefined","summary: string","tableNodes: readonly SchemaTreeNode[]","children: SchemaTreeNode[]","columnNodes: SchemaTreeNode[]","tableMeta: Record<string, unknown>","dependencyNodes: readonly SchemaTreeNode[]","columns: Record<string, SqlColumnIR>","fkBackingIndexes: SqlIndexIR[]","conflicts: MigrationPlannerConflict[]","tables: Record<string, SqlTableIR>","result: DependencyIR[]","byNativeType: Record<string, (typeof storage.types)[string]>","readOnlyEmptyObject: Record<string, never>","INIT_ADDITIVE_POLICY: MigrationOperationPolicy"],"sources":["../src/core/control-instance.ts","../src/core/control-descriptor.ts","../src/core/migrations/contract-to-schema-ir.ts","../src/core/migrations/plan-helpers.ts","../src/core/migrations/policies.ts","../src/exports/control.ts"],"sourcesContent":["import type { Contract, ContractMarkerRecord } from '@prisma-next/contract/types';\nimport { emptyCodecLookup } from '@prisma-next/framework-components/codec';\nimport type {\n TargetBoundComponentDescriptor,\n TargetDescriptor,\n} from '@prisma-next/framework-components/components';\nimport type {\n ControlDriverInstance,\n ControlFamilyInstance,\n ControlStack,\n CoreSchemaView,\n OperationContext,\n SchemaViewCapable,\n SignDatabaseResult,\n VerifyDatabaseResult,\n VerifyDatabaseSchemaResult,\n} from '@prisma-next/framework-components/control';\nimport {\n SchemaTreeNode,\n VERIFY_CODE_HASH_MISMATCH,\n VERIFY_CODE_MARKER_MISSING,\n VERIFY_CODE_TARGET_MISMATCH,\n} from '@prisma-next/framework-components/control';\nimport type { TypesImportSpec } from '@prisma-next/framework-components/emission';\nimport type { SqlStorage } from '@prisma-next/sql-contract/types';\nimport { validateContract as sqlValidateContract } from '@prisma-next/sql-contract/validate';\nimport {\n ensureSchemaStatement,\n ensureTableStatement,\n writeContractMarker,\n} from '@prisma-next/sql-runtime';\nimport { defaultIndexName } from '@prisma-next/sql-schema-ir/naming';\nimport type { SqlSchemaIR, SqlTableIR } from '@prisma-next/sql-schema-ir/types';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport type { SqlControlDescriptorWithContributions } from './assembly';\nimport type { SqlControlAdapter } from './control-adapter';\nimport type {\n SqlControlAdapterDescriptor,\n SqlControlExtensionDescriptor,\n} from './migrations/types';\nimport { verifySqlSchema } from './schema-verify/verify-sql-schema';\nimport { collectSupportedCodecTypeIds, readMarker } from './verify';\n\nfunction extractCodecTypeIdsFromContract(contract: unknown): readonly string[] {\n const typeIds = new Set<string>();\n\n // Type guard for SQL contract structure\n if (\n typeof contract === 'object' &&\n contract !== null &&\n 'storage' in contract &&\n typeof contract.storage === 'object' &&\n contract.storage !== null &&\n 'tables' in contract.storage\n ) {\n const storage = contract.storage as { tables?: Record<string, unknown> };\n if (storage.tables && typeof storage.tables === 'object') {\n for (const table of Object.values(storage.tables)) {\n if (\n typeof table === 'object' &&\n table !== null &&\n 'columns' in table &&\n typeof table.columns === 'object' &&\n table.columns !== null\n ) {\n const columns = table.columns as Record<string, { codecId: string } | undefined>;\n for (const column of Object.values(columns)) {\n if (\n column &&\n typeof column === 'object' &&\n 'codecId' in column &&\n typeof column.codecId === 'string'\n ) {\n typeIds.add(column.codecId);\n }\n }\n }\n }\n }\n }\n\n return Array.from(typeIds).sort();\n}\n\nfunction createVerifyResult(options: {\n ok: boolean;\n code?: string;\n summary: string;\n contractStorageHash: string;\n contractProfileHash?: string;\n marker?: ContractMarkerRecord;\n expectedTargetId: string;\n actualTargetId?: string;\n missingCodecs?: readonly string[];\n codecCoverageSkipped?: boolean;\n configPath?: string;\n contractPath: string;\n totalTime: number;\n}): VerifyDatabaseResult {\n const contract: { storageHash: string; profileHash?: string } = {\n storageHash: options.contractStorageHash,\n };\n if (options.contractProfileHash) {\n contract.profileHash = options.contractProfileHash;\n }\n\n const target: { expected: string; actual?: string } = {\n expected: options.expectedTargetId,\n };\n if (options.actualTargetId) {\n target.actual = options.actualTargetId;\n }\n\n const meta: { contractPath: string; configPath?: string } = {\n contractPath: options.contractPath,\n };\n if (options.configPath) {\n meta.configPath = options.configPath;\n }\n\n const result: VerifyDatabaseResult = {\n ok: options.ok,\n summary: options.summary,\n contract,\n target,\n meta,\n timings: {\n total: options.totalTime,\n },\n };\n\n if (options.code) {\n (result as { code?: string }).code = options.code;\n }\n\n if (options.marker) {\n (result as { marker?: { storageHash: string; profileHash: string } }).marker = {\n storageHash: options.marker.storageHash,\n profileHash: options.marker.profileHash,\n };\n }\n\n if (options.missingCodecs) {\n (result as { missingCodecs?: readonly string[] }).missingCodecs = options.missingCodecs;\n }\n\n if (options.codecCoverageSkipped) {\n (result as { codecCoverageSkipped?: boolean }).codecCoverageSkipped =\n options.codecCoverageSkipped;\n }\n\n return result;\n}\n\ninterface SqlTypeMetadata {\n readonly typeId: string;\n readonly familyId: 'sql';\n readonly targetId: string;\n readonly nativeType?: string;\n}\n\ntype SqlTypeMetadataRegistry = Map<string, SqlTypeMetadata>;\n\ninterface SqlFamilyInstanceState {\n readonly codecTypeImports: ReadonlyArray<TypesImportSpec>;\n readonly operationTypeImports: ReadonlyArray<TypesImportSpec>;\n readonly extensionIds: ReadonlyArray<string>;\n readonly typeMetadataRegistry: SqlTypeMetadataRegistry;\n}\n\nexport interface SchemaVerifyOptions {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract: unknown;\n readonly strict: boolean;\n readonly context?: OperationContext;\n /**\n * Active framework components participating in this composition.\n * All components must have matching familyId ('sql') and targetId.\n */\n readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;\n}\n\nexport interface SqlControlFamilyInstance\n extends ControlFamilyInstance<'sql', SqlSchemaIR>,\n SchemaViewCapable<SqlSchemaIR>,\n SqlFamilyInstanceState {\n validateContract(contractJson: unknown): Contract;\n\n verify(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract: unknown;\n readonly expectedTargetId: string;\n readonly contractPath: string;\n readonly configPath?: string;\n }): Promise<VerifyDatabaseResult>;\n\n schemaVerify(options: SchemaVerifyOptions): Promise<VerifyDatabaseSchemaResult>;\n\n sign(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract: unknown;\n readonly contractPath: string;\n readonly configPath?: string;\n }): Promise<SignDatabaseResult>;\n\n introspect(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract?: unknown;\n }): Promise<SqlSchemaIR>;\n}\n\nexport type SqlFamilyInstance = SqlControlFamilyInstance;\n\nfunction isSqlControlAdapter<TTargetId extends string>(\n value: unknown,\n): value is SqlControlAdapter<TTargetId> {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'introspect' in value &&\n typeof (value as { introspect: unknown }).introspect === 'function'\n );\n}\n\ninterface DescriptorWithStorageTypes {\n readonly targetId?: string | undefined;\n readonly types?:\n | {\n readonly storage?:\n | ReadonlyArray<{\n readonly typeId: string;\n readonly familyId: string;\n readonly targetId: string;\n readonly nativeType?: string | undefined;\n }>\n | undefined;\n }\n | undefined;\n}\n\nfunction buildSqlTypeMetadataRegistry(options: {\n readonly target: DescriptorWithStorageTypes;\n readonly adapter: DescriptorWithStorageTypes & { readonly targetId: string };\n readonly extensionPacks: readonly DescriptorWithStorageTypes[];\n}): SqlTypeMetadataRegistry {\n const { target, adapter, extensionPacks: extensions } = options;\n const registry = new Map<string, SqlTypeMetadata>();\n const targetId = adapter.targetId;\n const descriptors = [target, adapter, ...extensions];\n\n for (const descriptor of descriptors) {\n const types = descriptor.types;\n const storageTypes = types?.storage;\n\n if (!storageTypes) {\n continue;\n }\n\n for (const storageType of storageTypes) {\n if (storageType.familyId === 'sql' && storageType.targetId === targetId) {\n registry.set(storageType.typeId, {\n typeId: storageType.typeId,\n familyId: 'sql',\n targetId: storageType.targetId,\n ...(storageType.nativeType !== undefined ? { nativeType: storageType.nativeType } : {}),\n });\n }\n }\n }\n\n return registry;\n}\n\nexport function createSqlFamilyInstance<TTargetId extends string>(\n stack: ControlStack<'sql', TTargetId>,\n): SqlFamilyInstance {\n if (!stack.adapter) {\n throw new Error('SQL family requires an adapter descriptor in ControlStack');\n }\n\n const target = stack.target as unknown as TargetDescriptor<'sql', TTargetId> &\n SqlControlDescriptorWithContributions &\n DescriptorWithStorageTypes;\n const adapter = stack.adapter as unknown as SqlControlAdapterDescriptor<TTargetId> &\n DescriptorWithStorageTypes;\n const extensions =\n stack.extensionPacks as unknown as readonly (SqlControlExtensionDescriptor<TTargetId> &\n DescriptorWithStorageTypes)[];\n\n const { codecTypeImports, operationTypeImports, extensionIds } = stack;\n\n const typeMetadataRegistry = buildSqlTypeMetadataRegistry({\n target,\n adapter,\n extensionPacks: extensions,\n });\n\n return {\n familyId: 'sql',\n codecTypeImports,\n operationTypeImports,\n extensionIds,\n typeMetadataRegistry,\n\n validateContract(contractJson: unknown): Contract {\n return sqlValidateContract<Contract<SqlStorage>>(contractJson, emptyCodecLookup);\n },\n\n async verify(verifyOptions: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract: unknown;\n readonly expectedTargetId: string;\n readonly contractPath: string;\n readonly configPath?: string;\n }): Promise<VerifyDatabaseResult> {\n const {\n driver,\n contract: rawContract,\n expectedTargetId,\n contractPath,\n configPath,\n } = verifyOptions;\n const startTime = Date.now();\n\n const contract = sqlValidateContract<Contract<SqlStorage>>(rawContract, emptyCodecLookup);\n\n const contractStorageHash = contract.storage.storageHash;\n const contractProfileHash = contract.profileHash;\n const contractTarget = contract.target;\n\n const marker = await readMarker(driver);\n\n let missingCodecs: readonly string[] | undefined;\n let codecCoverageSkipped = false;\n const supportedTypeIds = collectSupportedCodecTypeIds([adapter, target, ...extensions]);\n if (supportedTypeIds.length === 0) {\n codecCoverageSkipped = true;\n } else {\n const supportedSet = new Set(supportedTypeIds);\n const usedTypeIds = extractCodecTypeIdsFromContract(contract);\n const missing = usedTypeIds.filter((id) => !supportedSet.has(id));\n if (missing.length > 0) {\n missingCodecs = missing;\n }\n }\n\n if (!marker) {\n const totalTime = Date.now() - startTime;\n return createVerifyResult({\n ok: false,\n code: VERIFY_CODE_MARKER_MISSING,\n summary: 'Marker missing',\n contractStorageHash,\n expectedTargetId,\n contractPath,\n totalTime,\n ...(contractProfileHash ? { contractProfileHash } : {}),\n ...(missingCodecs ? { missingCodecs } : {}),\n ...(codecCoverageSkipped ? { codecCoverageSkipped } : {}),\n ...(configPath ? { configPath } : {}),\n });\n }\n\n if (contractTarget !== expectedTargetId) {\n const totalTime = Date.now() - startTime;\n return createVerifyResult({\n ok: false,\n code: VERIFY_CODE_TARGET_MISMATCH,\n summary: 'Target mismatch',\n contractStorageHash,\n marker,\n expectedTargetId,\n actualTargetId: contractTarget,\n contractPath,\n totalTime,\n ...(contractProfileHash ? { contractProfileHash } : {}),\n ...(missingCodecs ? { missingCodecs } : {}),\n ...(codecCoverageSkipped ? { codecCoverageSkipped } : {}),\n ...(configPath ? { configPath } : {}),\n });\n }\n\n if (marker.storageHash !== contractStorageHash) {\n const totalTime = Date.now() - startTime;\n return createVerifyResult({\n ok: false,\n code: VERIFY_CODE_HASH_MISMATCH,\n summary: 'Hash mismatch',\n contractStorageHash,\n marker,\n expectedTargetId,\n contractPath,\n totalTime,\n ...(contractProfileHash ? { contractProfileHash } : {}),\n ...(missingCodecs ? { missingCodecs } : {}),\n ...(codecCoverageSkipped ? { codecCoverageSkipped } : {}),\n ...(configPath ? { configPath } : {}),\n });\n }\n\n if (contractProfileHash && marker.profileHash !== contractProfileHash) {\n const totalTime = Date.now() - startTime;\n return createVerifyResult({\n ok: false,\n code: VERIFY_CODE_HASH_MISMATCH,\n summary: 'Hash mismatch',\n contractStorageHash,\n contractProfileHash,\n marker,\n expectedTargetId,\n contractPath,\n totalTime,\n ...(missingCodecs ? { missingCodecs } : {}),\n ...(codecCoverageSkipped ? { codecCoverageSkipped } : {}),\n ...(configPath ? { configPath } : {}),\n });\n }\n\n const totalTime = Date.now() - startTime;\n return createVerifyResult({\n ok: true,\n summary: 'Database matches contract',\n contractStorageHash,\n marker,\n expectedTargetId,\n contractPath,\n totalTime,\n ...(contractProfileHash ? { contractProfileHash } : {}),\n ...(missingCodecs ? { missingCodecs } : {}),\n ...(codecCoverageSkipped ? { codecCoverageSkipped } : {}),\n ...(configPath ? { configPath } : {}),\n });\n },\n\n async schemaVerify(options: SchemaVerifyOptions): Promise<VerifyDatabaseSchemaResult> {\n const { driver, contract: contractInput, strict, context, frameworkComponents } = options;\n\n const contract = sqlValidateContract<Contract<SqlStorage>>(contractInput, emptyCodecLookup);\n\n const controlAdapter = adapter.create();\n if (!isSqlControlAdapter(controlAdapter)) {\n throw new Error('Adapter does not implement SqlControlAdapter.introspect()');\n }\n const schemaIR = await controlAdapter.introspect(driver, contractInput);\n\n return verifySqlSchema({\n contract,\n schema: schemaIR,\n strict,\n ...ifDefined('context', context),\n typeMetadataRegistry,\n frameworkComponents,\n // Wire up target-specific normalizers if available\n ...ifDefined('normalizeDefault', controlAdapter.normalizeDefault),\n ...ifDefined('normalizeNativeType', controlAdapter.normalizeNativeType),\n });\n },\n async sign(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract: unknown;\n readonly contractPath: string;\n readonly configPath?: string;\n }): Promise<SignDatabaseResult> {\n const { driver, contract: contractInput, contractPath, configPath } = options;\n const startTime = Date.now();\n\n const contract = sqlValidateContract<Contract<SqlStorage>>(contractInput, emptyCodecLookup);\n\n const contractStorageHash = contract.storage.storageHash;\n const contractProfileHash =\n 'profileHash' in contract && typeof contract.profileHash === 'string'\n ? contract.profileHash\n : contractStorageHash;\n const contractTarget = contract.target;\n\n await driver.query(ensureSchemaStatement.sql, ensureSchemaStatement.params);\n await driver.query(ensureTableStatement.sql, ensureTableStatement.params);\n\n const existingMarker = await readMarker(driver);\n\n let markerCreated = false;\n let markerUpdated = false;\n let previousHashes: { storageHash?: string; profileHash?: string } | undefined;\n\n if (!existingMarker) {\n const write = writeContractMarker({\n storageHash: contractStorageHash,\n profileHash: contractProfileHash,\n contractJson: contractInput,\n canonicalVersion: 1,\n });\n await driver.query(write.insert.sql, write.insert.params);\n markerCreated = true;\n } else {\n const existingStorageHash = existingMarker.storageHash;\n const existingProfileHash = existingMarker.profileHash;\n\n const storageHashMatches = existingStorageHash === contractStorageHash;\n const profileHashMatches = existingProfileHash === contractProfileHash;\n\n if (!storageHashMatches || !profileHashMatches) {\n previousHashes = {\n storageHash: existingStorageHash,\n profileHash: existingProfileHash,\n };\n const write = writeContractMarker({\n storageHash: contractStorageHash,\n profileHash: contractProfileHash,\n contractJson: contractInput,\n canonicalVersion: existingMarker.canonicalVersion ?? 1,\n });\n await driver.query(write.update.sql, write.update.params);\n markerUpdated = true;\n }\n }\n\n let summary: string;\n if (markerCreated) {\n summary = 'Database signed (marker created)';\n } else if (markerUpdated) {\n summary = `Database signed (marker updated from ${previousHashes?.storageHash ?? 'unknown'})`;\n } else {\n summary = 'Database already signed with this contract';\n }\n\n const totalTime = Date.now() - startTime;\n\n return {\n ok: true,\n summary,\n contract: {\n storageHash: contractStorageHash,\n profileHash: contractProfileHash,\n },\n target: {\n expected: contractTarget,\n actual: contractTarget,\n },\n marker: {\n created: markerCreated,\n updated: markerUpdated,\n ...(previousHashes ? { previous: previousHashes } : {}),\n },\n meta: {\n contractPath,\n ...(configPath ? { configPath } : {}),\n },\n timings: {\n total: totalTime,\n },\n };\n },\n async readMarker(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n }): Promise<ContractMarkerRecord | null> {\n return readMarker(options.driver);\n },\n async introspect(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract?: unknown;\n }): Promise<SqlSchemaIR> {\n const { driver, contract } = options;\n\n const controlAdapter = adapter.create();\n if (!isSqlControlAdapter(controlAdapter)) {\n throw new Error('Adapter does not implement SqlControlAdapter.introspect()');\n }\n return controlAdapter.introspect(driver, contract);\n },\n\n toSchemaView(schema: SqlSchemaIR): CoreSchemaView {\n const tableNodes: readonly SchemaTreeNode[] = Object.entries(schema.tables).map(\n ([tableName, table]: [string, SqlTableIR]) => {\n const children: SchemaTreeNode[] = [];\n\n const columnNodes: SchemaTreeNode[] = [];\n for (const [columnName, column] of Object.entries(table.columns)) {\n const typeDisplay = column.nativeType;\n const nullability = column.nullable ? 'nullable' : 'not nullable';\n const label = `${columnName}: ${typeDisplay} (${nullability})`;\n columnNodes.push(\n new SchemaTreeNode({\n kind: 'field',\n id: `column-${tableName}-${columnName}`,\n label,\n meta: {\n nativeType: column.nativeType,\n nullable: column.nullable,\n ...ifDefined('default', column.default),\n },\n }),\n );\n }\n\n if (columnNodes.length > 0) {\n children.push(\n new SchemaTreeNode({\n kind: 'collection',\n id: `columns-${tableName}`,\n label: 'columns',\n children: columnNodes,\n }),\n );\n }\n\n if (table.primaryKey) {\n const pkColumns = table.primaryKey.columns.join(', ');\n children.push(\n new SchemaTreeNode({\n kind: 'index',\n id: `primary-key-${tableName}`,\n label: `primary key: ${pkColumns}`,\n meta: {\n columns: table.primaryKey.columns,\n ...(table.primaryKey.name ? { name: table.primaryKey.name } : {}),\n },\n }),\n );\n }\n\n for (const unique of table.uniques) {\n const name = unique.name ?? `${tableName}_${unique.columns.join('_')}_unique`;\n const label = `unique ${name}`;\n children.push(\n new SchemaTreeNode({\n kind: 'index',\n id: `unique-${tableName}-${name}`,\n label,\n meta: {\n columns: unique.columns,\n unique: true,\n },\n }),\n );\n }\n\n for (const index of table.indexes) {\n const name = index.name ?? defaultIndexName(tableName, index.columns);\n const label = index.unique ? `unique index ${name}` : `index ${name}`;\n children.push(\n new SchemaTreeNode({\n kind: 'index',\n id: `index-${tableName}-${name}`,\n label,\n meta: {\n columns: index.columns,\n unique: index.unique,\n },\n }),\n );\n }\n\n const tableMeta: Record<string, unknown> = {};\n if (table.primaryKey) {\n tableMeta['primaryKey'] = table.primaryKey.columns;\n if (table.primaryKey.name) {\n tableMeta['primaryKeyName'] = table.primaryKey.name;\n }\n }\n if (table.foreignKeys.length > 0) {\n tableMeta['foreignKeys'] = table.foreignKeys.map((fk) => ({\n columns: fk.columns,\n referencedTable: fk.referencedTable,\n referencedColumns: fk.referencedColumns,\n ...(fk.name ? { name: fk.name } : {}),\n }));\n }\n\n return new SchemaTreeNode({\n kind: 'entity',\n id: `table-${tableName}`,\n label: `table ${tableName}`,\n ...(Object.keys(tableMeta).length > 0 ? { meta: tableMeta } : {}),\n ...(children.length > 0 ? { children } : {}),\n });\n },\n );\n\n const dependencyNodes: readonly SchemaTreeNode[] = schema.dependencies.map((dep) => {\n const shortName = dep.id.split('.').pop() ?? dep.id;\n return new SchemaTreeNode({\n kind: 'dependency',\n id: `dependency-${dep.id}`,\n label: `${shortName} dependency is installed`,\n });\n });\n\n const rootChildren = [...tableNodes, ...dependencyNodes];\n\n return {\n root: new SchemaTreeNode({\n kind: 'root',\n id: 'sql-schema',\n label: 'database',\n ...(rootChildren.length > 0 ? { children: rootChildren } : {}),\n }),\n };\n },\n };\n}\n","import type {\n ControlFamilyDescriptor,\n ControlStack,\n} from '@prisma-next/framework-components/control';\nimport { sqlEmission } from '@prisma-next/sql-contract-emitter';\nimport { sqlFamilyAuthoringFieldPresets } from './authoring-field-presets';\nimport { sqlFamilyAuthoringTypes } from './authoring-type-constructors';\nimport { createSqlFamilyInstance, type SqlControlFamilyInstance } from './control-instance';\n\nexport class SqlFamilyDescriptor\n implements ControlFamilyDescriptor<'sql', SqlControlFamilyInstance>\n{\n readonly kind = 'family' as const;\n readonly id = 'sql';\n readonly familyId = 'sql' as const;\n readonly version = '0.0.1';\n readonly emission = sqlEmission;\n readonly authoring = {\n field: sqlFamilyAuthoringFieldPresets,\n type: sqlFamilyAuthoringTypes,\n } as const;\n\n create<TTargetId extends string>(\n stack: ControlStack<'sql', TTargetId>,\n ): SqlControlFamilyInstance {\n return createSqlFamilyInstance(stack);\n }\n}\n","import type { ColumnDefault, Contract } from '@prisma-next/contract/types';\nimport type { TargetBoundComponentDescriptor } from '@prisma-next/framework-components/components';\nimport type { MigrationPlannerConflict } from '@prisma-next/framework-components/control';\nimport type {\n ForeignKey,\n Index,\n SqlStorage,\n StorageColumn,\n StorageTable,\n UniqueConstraint,\n} from '@prisma-next/sql-contract/types';\nimport { defaultIndexName } from '@prisma-next/sql-schema-ir/naming';\nimport type {\n DependencyIR,\n SqlAnnotations,\n SqlColumnIR,\n SqlForeignKeyIR,\n SqlIndexIR,\n SqlSchemaIR,\n SqlTableIR,\n SqlUniqueIR,\n} from '@prisma-next/sql-schema-ir/types';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { collectInitDependencies } from './types';\n\n/**\n * Target-specific callback that expands a column's base `nativeType` and optional\n * `typeParams` into the fully-qualified type string used by the database\n * (e.g. `character` + `{ length: 36 }` → `character(36)`).\n *\n * This lives in the family layer as a callback rather than importing a concrete\n * implementation because each target (Postgres, MySQL, SQLite, …) has its own\n * parameterization syntax. The target wires its expander when calling\n * `contractToSchemaIR`, keeping the family layer target-agnostic.\n */\nexport type NativeTypeExpander = (input: {\n readonly nativeType: string;\n readonly codecId?: string;\n readonly typeParams?: Record<string, unknown>;\n}) => string;\n\n/**\n * Target-specific callback that renders a `ColumnDefault` into the raw SQL literal\n * string stored in `SqlColumnIR.default`.\n *\n * Default value serialization is target-specific (quoting, casting, type syntax vary\n * between Postgres, MySQL, SQLite, …). This callback follows the same IoC pattern as\n * `NativeTypeExpander`: the target provides its renderer when calling\n * `contractToSchemaIR`, keeping the family layer target-agnostic.\n */\nexport type DefaultRenderer = (def: ColumnDefault, column: StorageColumn) => string;\n\nfunction convertColumn(\n name: string,\n column: StorageColumn,\n expandNativeType: NativeTypeExpander | undefined,\n renderDefault: DefaultRenderer | undefined,\n): SqlColumnIR {\n const nativeType = expandNativeType\n ? expandNativeType({\n nativeType: column.nativeType,\n codecId: column.codecId,\n ...ifDefined('typeParams', column.typeParams),\n })\n : column.nativeType;\n return {\n name,\n nativeType,\n nullable: column.nullable,\n ...ifDefined(\n 'default',\n column.default != null && renderDefault ? renderDefault(column.default, column) : undefined,\n ),\n };\n}\n\nfunction convertUnique(unique: UniqueConstraint): SqlUniqueIR {\n return {\n columns: unique.columns,\n ...ifDefined('name', unique.name),\n };\n}\n\nfunction convertIndex(index: Index): SqlIndexIR {\n return {\n columns: index.columns,\n unique: false,\n ...ifDefined('name', index.name),\n };\n}\n\nfunction convertForeignKey(fk: ForeignKey): SqlForeignKeyIR {\n return {\n columns: fk.columns,\n referencedTable: fk.references.table,\n referencedColumns: fk.references.columns,\n ...ifDefined('name', fk.name),\n };\n}\n\nfunction convertTable(\n name: string,\n table: StorageTable,\n expandNativeType: NativeTypeExpander | undefined,\n renderDefault: DefaultRenderer | undefined,\n): SqlTableIR {\n const columns: Record<string, SqlColumnIR> = {};\n for (const [colName, colDef] of Object.entries(table.columns)) {\n columns[colName] = convertColumn(colName, colDef, expandNativeType, renderDefault);\n }\n\n const satisfiedIndexColumns = new Set([\n ...table.indexes.map((idx) => idx.columns.join(',')),\n ...table.uniques.map((unique) => unique.columns.join(',')),\n ...(table.primaryKey ? [table.primaryKey.columns.join(',')] : []),\n ]);\n const fkBackingIndexes: SqlIndexIR[] = [];\n for (const fk of table.foreignKeys) {\n if (fk.index === false) continue;\n const key = fk.columns.join(',');\n if (satisfiedIndexColumns.has(key)) continue;\n fkBackingIndexes.push({\n columns: fk.columns,\n unique: false,\n name: defaultIndexName(name, fk.columns),\n });\n satisfiedIndexColumns.add(key);\n }\n\n return {\n name,\n columns,\n ...ifDefined('primaryKey', table.primaryKey),\n foreignKeys: table.foreignKeys.map(convertForeignKey),\n uniques: table.uniques.map(convertUnique),\n indexes: [...table.indexes.map(convertIndex), ...fkBackingIndexes],\n };\n}\n\n/**\n * Detects destructive changes between two contract storages.\n *\n * The additive-only planner silently ignores removals (tables, columns).\n * This function detects those removals so callers can report them as conflicts\n * rather than silently producing an empty plan.\n *\n * Returns an empty array if no destructive changes are found.\n */\nexport function detectDestructiveChanges(\n from: SqlStorage | null,\n to: SqlStorage,\n): readonly MigrationPlannerConflict[] {\n if (!from) return [];\n\n const hasOwn = (value: object, key: string): boolean => Object.hasOwn(value, key);\n\n const conflicts: MigrationPlannerConflict[] = [];\n\n for (const tableName of Object.keys(from.tables)) {\n if (!hasOwn(to.tables, tableName)) {\n conflicts.push({\n kind: 'tableRemoved',\n summary: `Table \"${tableName}\" was removed`,\n });\n continue;\n }\n\n const toTable = to.tables[tableName] as StorageTable;\n const fromTable = from.tables[tableName];\n if (!fromTable) continue;\n\n for (const columnName of Object.keys(fromTable.columns)) {\n if (!hasOwn(toTable.columns, columnName)) {\n conflicts.push({\n kind: 'columnRemoved',\n summary: `Column \"${tableName}\".\"${columnName}\" was removed`,\n });\n }\n }\n }\n\n return conflicts;\n}\n\nexport interface ContractToSchemaIROptions {\n readonly annotationNamespace: string;\n readonly expandNativeType?: NativeTypeExpander;\n readonly renderDefault?: DefaultRenderer;\n readonly frameworkComponents?: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;\n}\n\n/**\n * Converts a `Contract` to `SqlSchemaIR`.\n *\n * Reads `contract.storage` for tables, `contract.storage.types` for type\n * annotations, and derives database dependencies from `frameworkComponents`\n * (each component's `databaseDependencies.init[].id`).\n * Storage-type annotations are written under `options.annotationNamespace`.\n *\n * Drops codec metadata (`codecId`, `typeRef`) since the schema IR only represents\n * structural information. When `expandNativeType` is provided, parameterized types\n * are expanded (e.g. `character` + `{ length: 36 }` → `character(36)`) so the\n * resulting IR compares correctly against the \"to\" contract during planning.\n *\n * Returns an empty schema IR when `contract` is `null` (new project).\n */\nexport function contractToSchemaIR(\n contract: Contract<SqlStorage> | null,\n options: ContractToSchemaIROptions,\n): SqlSchemaIR {\n if (options.annotationNamespace.length === 0) {\n throw new Error('annotationNamespace must be a non-empty string');\n }\n\n if (!contract) {\n return { tables: {}, dependencies: [] };\n }\n\n const storage = contract.storage;\n const tables: Record<string, SqlTableIR> = {};\n for (const [tableName, tableDef] of Object.entries(storage.tables)) {\n tables[tableName] = convertTable(\n tableName,\n tableDef,\n options.expandNativeType,\n options.renderDefault,\n );\n }\n\n const dependencies = deduplicateDependencyIRs(\n collectInitDependencies(options.frameworkComponents ?? []),\n );\n const annotations = deriveAnnotations(storage, options.annotationNamespace);\n\n return {\n tables,\n dependencies,\n ...ifDefined('annotations', annotations),\n };\n}\n\nfunction deduplicateDependencyIRs(\n deps: readonly { readonly id: string }[],\n): readonly DependencyIR[] {\n const seen = new Set<string>();\n const result: DependencyIR[] = [];\n for (const dep of deps) {\n if (dep.id.trim().length === 0) {\n throw new Error('Dependency id must be a non-empty string');\n }\n if (seen.has(dep.id)) continue;\n seen.add(dep.id);\n result.push({ id: dep.id });\n }\n return result;\n}\n\nfunction deriveAnnotations(\n storage: SqlStorage,\n annotationNamespace: string,\n): SqlAnnotations | undefined {\n if (!storage.types || Object.keys(storage.types).length === 0) return undefined;\n // Re-key by nativeType to match the structure produced by introspection\n const byNativeType: Record<string, (typeof storage.types)[string]> = {};\n for (const typeInstance of Object.values(storage.types)) {\n byNativeType[typeInstance.nativeType] = typeInstance;\n }\n return { [annotationNamespace]: { storageTypes: byNativeType } };\n}\n","import type { NotOk, Ok } from '@prisma-next/utils/result';\nimport { notOk, ok } from '@prisma-next/utils/result';\nimport type {\n AnyRecord,\n CreateSqlMigrationPlanOptions,\n SqlMigrationPlan,\n SqlMigrationPlanOperation,\n SqlMigrationPlanOperationStep,\n SqlMigrationPlanOperationTarget,\n SqlMigrationRunnerErrorCode,\n SqlMigrationRunnerFailure,\n SqlMigrationRunnerSuccessValue,\n SqlPlannerConflict,\n SqlPlannerFailureResult,\n SqlPlannerSuccessResult,\n} from './types';\n\nconst readOnlyEmptyObject: Record<string, never> = Object.freeze({});\n\nfunction cloneRecord<T extends AnyRecord>(value: T): T {\n if (value === readOnlyEmptyObject) {\n return value;\n }\n return Object.freeze({ ...value }) as T;\n}\n\nfunction freezeSteps(\n steps: readonly SqlMigrationPlanOperationStep[],\n): readonly SqlMigrationPlanOperationStep[] {\n if (steps.length === 0) {\n return Object.freeze([]);\n }\n return Object.freeze(\n steps.map((step) =>\n Object.freeze({\n description: step.description,\n sql: step.sql,\n ...(step.meta ? { meta: cloneRecord(step.meta) } : {}),\n }),\n ),\n );\n}\n\nfunction freezeDetailsValue<T>(value: T): T {\n // Primitives and null/undefined are already immutable, return as-is\n if (value === null || value === undefined) {\n return value;\n }\n if (typeof value !== 'object') {\n return value;\n }\n // Arrays: shallow clone and freeze\n if (Array.isArray(value)) {\n return Object.freeze([...value]) as T;\n }\n // Objects: shallow clone and freeze (matching cloneRecord pattern)\n return Object.freeze({ ...value }) as T;\n}\n\nfunction freezeTargetDetails<TTargetDetails>(\n target: SqlMigrationPlanOperationTarget<TTargetDetails>,\n): SqlMigrationPlanOperationTarget<TTargetDetails> {\n return Object.freeze({\n id: target.id,\n ...(target.details !== undefined ? { details: freezeDetailsValue(target.details) } : {}),\n });\n}\n\nfunction freezeOperation<TTargetDetails>(\n operation: SqlMigrationPlanOperation<TTargetDetails>,\n): SqlMigrationPlanOperation<TTargetDetails> {\n return Object.freeze({\n id: operation.id,\n label: operation.label,\n ...(operation.summary ? { summary: operation.summary } : {}),\n operationClass: operation.operationClass,\n target: freezeTargetDetails(operation.target),\n precheck: freezeSteps(operation.precheck),\n execute: freezeSteps(operation.execute),\n postcheck: freezeSteps(operation.postcheck),\n ...(operation.meta ? { meta: cloneRecord(operation.meta) } : {}),\n });\n}\n\nfunction freezeOperations<TTargetDetails>(\n operations: readonly SqlMigrationPlanOperation<TTargetDetails>[],\n): readonly SqlMigrationPlanOperation<TTargetDetails>[] {\n if (operations.length === 0) {\n return Object.freeze([]);\n }\n return Object.freeze(operations.map((operation) => freezeOperation(operation)));\n}\n\nexport function createMigrationPlan<TTargetDetails>(\n options: CreateSqlMigrationPlanOptions<TTargetDetails>,\n): SqlMigrationPlan<TTargetDetails> {\n return Object.freeze({\n targetId: options.targetId,\n ...(options.origin !== undefined\n ? { origin: options.origin ? Object.freeze({ ...options.origin }) : null }\n : {}),\n destination: Object.freeze({ ...options.destination }),\n operations: freezeOperations(options.operations),\n ...(options.meta ? { meta: cloneRecord(options.meta) } : {}),\n });\n}\n\nexport function plannerSuccess<TTargetDetails>(\n plan: SqlMigrationPlan<TTargetDetails>,\n): SqlPlannerSuccessResult<TTargetDetails> {\n return Object.freeze({\n kind: 'success',\n plan,\n });\n}\n\nexport function plannerFailure(conflicts: readonly SqlPlannerConflict[]): SqlPlannerFailureResult {\n return Object.freeze({\n kind: 'failure' as const,\n conflicts: Object.freeze(\n conflicts.map((conflict) =>\n Object.freeze({\n kind: conflict.kind,\n summary: conflict.summary,\n ...(conflict.why ? { why: conflict.why } : {}),\n ...(conflict.location ? { location: Object.freeze({ ...conflict.location }) } : {}),\n ...(conflict.meta ? { meta: cloneRecord(conflict.meta) } : {}),\n }),\n ),\n ),\n });\n}\n\n/**\n * Creates a successful migration runner result.\n */\nexport function runnerSuccess(value: {\n operationsPlanned: number;\n operationsExecuted: number;\n}): Ok<SqlMigrationRunnerSuccessValue> {\n return ok(\n Object.freeze({\n operationsPlanned: value.operationsPlanned,\n operationsExecuted: value.operationsExecuted,\n }),\n );\n}\n\n/**\n * Creates a failed migration runner result.\n */\nexport function runnerFailure(\n code: SqlMigrationRunnerErrorCode,\n summary: string,\n options?: { why?: string; meta?: AnyRecord },\n): NotOk<SqlMigrationRunnerFailure> {\n const failure: SqlMigrationRunnerFailure = Object.freeze({\n code,\n summary,\n ...(options?.why ? { why: options.why } : {}),\n ...(options?.meta ? { meta: cloneRecord(options.meta) } : {}),\n });\n return notOk(failure);\n}\n","import type { MigrationOperationPolicy } from '@prisma-next/framework-components/control';\n\n/**\n * Policy used by `db init`: additive-only operations, no widening/destructive steps.\n */\nexport const INIT_ADDITIVE_POLICY: MigrationOperationPolicy = Object.freeze({\n allowedOperationClasses: Object.freeze(['additive'] as const),\n});\n","import { SqlFamilyDescriptor } from '../core/control-descriptor';\n\n// Re-export core types from canonical source\nexport type {\n MigrationOperationClass,\n MigrationOperationPolicy,\n MigrationPlan,\n MigrationPlanner,\n MigrationPlannerConflict,\n MigrationPlannerResult,\n MigrationPlanOperation,\n TargetMigrationsCapability,\n} from '@prisma-next/framework-components/control';\nexport { assembleAuthoringContributions } from '@prisma-next/framework-components/control';\nexport type { SqlControlDescriptorWithContributions } from '../core/assembly';\nexport {\n assembleControlMutationDefaultContributions,\n assemblePslInterpretationContributions,\n extractCodecControlHooks,\n} from '../core/assembly';\nexport type { SchemaVerifyOptions, SqlControlFamilyInstance } from '../core/control-instance';\nexport type {\n ContractToSchemaIROptions,\n DefaultRenderer,\n NativeTypeExpander,\n} from '../core/migrations/contract-to-schema-ir';\n// Contract → SchemaIR conversion for offline migration planning\nexport {\n contractToSchemaIR,\n detectDestructiveChanges,\n} from '../core/migrations/contract-to-schema-ir';\nexport {\n createMigrationPlan,\n plannerFailure,\n plannerSuccess,\n runnerFailure,\n runnerSuccess,\n} from '../core/migrations/plan-helpers';\nexport { INIT_ADDITIVE_POLICY } from '../core/migrations/policies';\nexport type {\n CodecControlHooks,\n ComponentDatabaseDependencies,\n ComponentDatabaseDependency,\n ControlMutationDefaultFunctionEntry,\n ControlMutationDefaultFunctionHandler,\n ControlMutationDefaultGeneratorDescriptor,\n CreateSqlMigrationPlanOptions,\n ExpandNativeTypeInput,\n PslScalarTypeDescriptor,\n ResolveIdentityValueInput,\n SqlControlAdapterDescriptor,\n SqlControlExtensionDescriptor,\n SqlControlStaticContributions,\n SqlControlTargetDescriptor,\n SqlMigrationPlan,\n SqlMigrationPlanContractInfo,\n SqlMigrationPlanner,\n SqlMigrationPlannerPlanOptions,\n SqlMigrationPlanOperation,\n SqlMigrationPlanOperationStep,\n SqlMigrationPlanOperationTarget,\n SqlMigrationRunner,\n SqlMigrationRunnerErrorCode,\n SqlMigrationRunnerExecuteCallbacks,\n SqlMigrationRunnerExecuteOptions,\n SqlMigrationRunnerFailure,\n SqlMigrationRunnerResult,\n SqlMigrationRunnerSuccessValue,\n SqlPlannerConflict,\n SqlPlannerConflictKind,\n SqlPlannerConflictLocation,\n SqlPlannerFailureResult,\n SqlPlannerResult,\n SqlPlannerSuccessResult,\n StorageTypePlanResult,\n} from '../core/migrations/types';\nexport { collectInitDependencies, isDatabaseDependencyProvider } from '../core/migrations/types';\n\nexport default new SqlFamilyDescriptor();\n"],"mappings":";;;;;;;;;;;;;AA2CA,SAAS,gCAAgC,UAAsC;CAC7E,MAAM,0BAAU,IAAI,KAAa;AAGjC,KACE,OAAO,aAAa,YACpB,aAAa,QACb,aAAa,YACb,OAAO,SAAS,YAAY,YAC5B,SAAS,YAAY,QACrB,YAAY,SAAS,SACrB;EACA,MAAM,UAAU,SAAS;AACzB,MAAI,QAAQ,UAAU,OAAO,QAAQ,WAAW,UAC9C;QAAK,MAAM,SAAS,OAAO,OAAO,QAAQ,OAAO,CAC/C,KACE,OAAO,UAAU,YACjB,UAAU,QACV,aAAa,SACb,OAAO,MAAM,YAAY,YACzB,MAAM,YAAY,MAClB;IACA,MAAM,UAAU,MAAM;AACtB,SAAK,MAAM,UAAU,OAAO,OAAO,QAAQ,CACzC,KACE,UACA,OAAO,WAA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I,qBAAqB"}
1
+ {"version":3,"file":"control.mjs","names":["contract: { storageHash: string; profileHash?: string }","target: { expected: string; actual?: string }","meta: { contractPath: string; configPath?: string }","result: VerifyDatabaseResult","sqlValidateContract","missingCodecs: readonly string[] | undefined","previousHashes: { storageHash?: string; profileHash?: string } | undefined","summary: string","tableNodes: readonly SchemaTreeNode[]","children: SchemaTreeNode[]","columnNodes: SchemaTreeNode[]","tableMeta: Record<string, unknown>","dependencyNodes: readonly SchemaTreeNode[]","columns: Record<string, SqlColumnIR>","fkBackingIndexes: SqlIndexIR[]","conflicts: MigrationPlannerConflict[]","tables: Record<string, SqlTableIR>","result: DependencyIR[]","byNativeType: Record<string, (typeof storage.types)[string]>","readOnlyEmptyObject: Record<string, never>","INIT_ADDITIVE_POLICY: MigrationOperationPolicy"],"sources":["../src/core/control-instance.ts","../src/core/control-descriptor.ts","../src/core/migrations/contract-to-schema-ir.ts","../src/core/migrations/plan-helpers.ts","../src/core/migrations/policies.ts","../src/exports/control.ts"],"sourcesContent":["import type { Contract, ContractMarkerRecord } from '@prisma-next/contract/types';\nimport { emptyCodecLookup } from '@prisma-next/framework-components/codec';\nimport type {\n TargetBoundComponentDescriptor,\n TargetDescriptor,\n} from '@prisma-next/framework-components/components';\nimport type {\n ControlDriverInstance,\n ControlFamilyInstance,\n ControlStack,\n CoreSchemaView,\n OperationContext,\n SchemaViewCapable,\n SignDatabaseResult,\n VerifyDatabaseResult,\n VerifyDatabaseSchemaResult,\n} from '@prisma-next/framework-components/control';\nimport {\n SchemaTreeNode,\n VERIFY_CODE_HASH_MISMATCH,\n VERIFY_CODE_MARKER_MISSING,\n VERIFY_CODE_TARGET_MISMATCH,\n} from '@prisma-next/framework-components/control';\nimport type { TypesImportSpec } from '@prisma-next/framework-components/emission';\nimport type { SqlStorage } from '@prisma-next/sql-contract/types';\nimport { validateContract as sqlValidateContract } from '@prisma-next/sql-contract/validate';\nimport {\n ensureSchemaStatement,\n ensureTableStatement,\n writeContractMarker,\n} from '@prisma-next/sql-runtime';\nimport { defaultIndexName } from '@prisma-next/sql-schema-ir/naming';\nimport type { SqlSchemaIR, SqlTableIR } from '@prisma-next/sql-schema-ir/types';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport type { SqlControlAdapter } from './control-adapter';\nimport type {\n SqlControlAdapterDescriptor,\n SqlControlExtensionDescriptor,\n} from './migrations/types';\nimport { verifySqlSchema } from './schema-verify/verify-sql-schema';\nimport { collectSupportedCodecTypeIds, readMarker } from './verify';\n\nfunction extractCodecTypeIdsFromContract(contract: unknown): readonly string[] {\n const typeIds = new Set<string>();\n\n // Type guard for SQL contract structure\n if (\n typeof contract === 'object' &&\n contract !== null &&\n 'storage' in contract &&\n typeof contract.storage === 'object' &&\n contract.storage !== null &&\n 'tables' in contract.storage\n ) {\n const storage = contract.storage as { tables?: Record<string, unknown> };\n if (storage.tables && typeof storage.tables === 'object') {\n for (const table of Object.values(storage.tables)) {\n if (\n typeof table === 'object' &&\n table !== null &&\n 'columns' in table &&\n typeof table.columns === 'object' &&\n table.columns !== null\n ) {\n const columns = table.columns as Record<string, { codecId: string } | undefined>;\n for (const column of Object.values(columns)) {\n if (\n column &&\n typeof column === 'object' &&\n 'codecId' in column &&\n typeof column.codecId === 'string'\n ) {\n typeIds.add(column.codecId);\n }\n }\n }\n }\n }\n }\n\n return Array.from(typeIds).sort();\n}\n\nfunction createVerifyResult(options: {\n ok: boolean;\n code?: string;\n summary: string;\n contractStorageHash: string;\n contractProfileHash?: string;\n marker?: ContractMarkerRecord;\n expectedTargetId: string;\n actualTargetId?: string;\n missingCodecs?: readonly string[];\n codecCoverageSkipped?: boolean;\n configPath?: string;\n contractPath: string;\n totalTime: number;\n}): VerifyDatabaseResult {\n const contract: { storageHash: string; profileHash?: string } = {\n storageHash: options.contractStorageHash,\n };\n if (options.contractProfileHash) {\n contract.profileHash = options.contractProfileHash;\n }\n\n const target: { expected: string; actual?: string } = {\n expected: options.expectedTargetId,\n };\n if (options.actualTargetId) {\n target.actual = options.actualTargetId;\n }\n\n const meta: { contractPath: string; configPath?: string } = {\n contractPath: options.contractPath,\n };\n if (options.configPath) {\n meta.configPath = options.configPath;\n }\n\n const result: VerifyDatabaseResult = {\n ok: options.ok,\n summary: options.summary,\n contract,\n target,\n meta,\n timings: {\n total: options.totalTime,\n },\n };\n\n if (options.code) {\n (result as { code?: string }).code = options.code;\n }\n\n if (options.marker) {\n (result as { marker?: { storageHash: string; profileHash: string } }).marker = {\n storageHash: options.marker.storageHash,\n profileHash: options.marker.profileHash,\n };\n }\n\n if (options.missingCodecs) {\n (result as { missingCodecs?: readonly string[] }).missingCodecs = options.missingCodecs;\n }\n\n if (options.codecCoverageSkipped) {\n (result as { codecCoverageSkipped?: boolean }).codecCoverageSkipped =\n options.codecCoverageSkipped;\n }\n\n return result;\n}\n\ninterface SqlTypeMetadata {\n readonly typeId: string;\n readonly familyId: 'sql';\n readonly targetId: string;\n readonly nativeType?: string;\n}\n\ntype SqlTypeMetadataRegistry = Map<string, SqlTypeMetadata>;\n\ninterface SqlFamilyInstanceState {\n readonly codecTypeImports: ReadonlyArray<TypesImportSpec>;\n readonly operationTypeImports: ReadonlyArray<TypesImportSpec>;\n readonly extensionIds: ReadonlyArray<string>;\n readonly typeMetadataRegistry: SqlTypeMetadataRegistry;\n}\n\nexport interface SchemaVerifyOptions {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract: unknown;\n readonly strict: boolean;\n readonly context?: OperationContext;\n /**\n * Active framework components participating in this composition.\n * All components must have matching familyId ('sql') and targetId.\n */\n readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;\n}\n\nexport interface SqlControlFamilyInstance\n extends ControlFamilyInstance<'sql', SqlSchemaIR>,\n SchemaViewCapable<SqlSchemaIR>,\n SqlFamilyInstanceState {\n validateContract(contractJson: unknown): Contract;\n\n verify(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract: unknown;\n readonly expectedTargetId: string;\n readonly contractPath: string;\n readonly configPath?: string;\n }): Promise<VerifyDatabaseResult>;\n\n schemaVerify(options: SchemaVerifyOptions): Promise<VerifyDatabaseSchemaResult>;\n\n sign(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract: unknown;\n readonly contractPath: string;\n readonly configPath?: string;\n }): Promise<SignDatabaseResult>;\n\n introspect(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract?: unknown;\n }): Promise<SqlSchemaIR>;\n}\n\nexport type SqlFamilyInstance = SqlControlFamilyInstance;\n\nfunction isSqlControlAdapter<TTargetId extends string>(\n value: unknown,\n): value is SqlControlAdapter<TTargetId> {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'introspect' in value &&\n typeof (value as { introspect: unknown }).introspect === 'function'\n );\n}\n\ninterface DescriptorWithStorageTypes {\n readonly targetId?: string | undefined;\n readonly types?:\n | {\n readonly storage?:\n | ReadonlyArray<{\n readonly typeId: string;\n readonly familyId: string;\n readonly targetId: string;\n readonly nativeType?: string | undefined;\n }>\n | undefined;\n }\n | undefined;\n}\n\nfunction buildSqlTypeMetadataRegistry(options: {\n readonly target: DescriptorWithStorageTypes;\n readonly adapter: DescriptorWithStorageTypes & { readonly targetId: string };\n readonly extensionPacks: readonly DescriptorWithStorageTypes[];\n}): SqlTypeMetadataRegistry {\n const { target, adapter, extensionPacks: extensions } = options;\n const registry = new Map<string, SqlTypeMetadata>();\n const targetId = adapter.targetId;\n const descriptors = [target, adapter, ...extensions];\n\n for (const descriptor of descriptors) {\n const types = descriptor.types;\n const storageTypes = types?.storage;\n\n if (!storageTypes) {\n continue;\n }\n\n for (const storageType of storageTypes) {\n if (storageType.familyId === 'sql' && storageType.targetId === targetId) {\n registry.set(storageType.typeId, {\n typeId: storageType.typeId,\n familyId: 'sql',\n targetId: storageType.targetId,\n ...(storageType.nativeType !== undefined ? { nativeType: storageType.nativeType } : {}),\n });\n }\n }\n }\n\n return registry;\n}\n\nexport function createSqlFamilyInstance<TTargetId extends string>(\n stack: ControlStack<'sql', TTargetId>,\n): SqlFamilyInstance {\n if (!stack.adapter) {\n throw new Error('SQL family requires an adapter descriptor in ControlStack');\n }\n\n const target = stack.target as unknown as TargetDescriptor<'sql', TTargetId> &\n DescriptorWithStorageTypes;\n const adapter = stack.adapter as unknown as SqlControlAdapterDescriptor<TTargetId> &\n DescriptorWithStorageTypes;\n const extensions =\n stack.extensionPacks as unknown as readonly (SqlControlExtensionDescriptor<TTargetId> &\n DescriptorWithStorageTypes)[];\n\n const { codecTypeImports, operationTypeImports, extensionIds } = stack;\n\n const typeMetadataRegistry = buildSqlTypeMetadataRegistry({\n target,\n adapter,\n extensionPacks: extensions,\n });\n\n return {\n familyId: 'sql',\n codecTypeImports,\n operationTypeImports,\n extensionIds,\n typeMetadataRegistry,\n\n validateContract(contractJson: unknown): Contract {\n return sqlValidateContract<Contract<SqlStorage>>(contractJson, emptyCodecLookup);\n },\n\n async verify(verifyOptions: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract: unknown;\n readonly expectedTargetId: string;\n readonly contractPath: string;\n readonly configPath?: string;\n }): Promise<VerifyDatabaseResult> {\n const {\n driver,\n contract: rawContract,\n expectedTargetId,\n contractPath,\n configPath,\n } = verifyOptions;\n const startTime = Date.now();\n\n const contract = sqlValidateContract<Contract<SqlStorage>>(rawContract, emptyCodecLookup);\n\n const contractStorageHash = contract.storage.storageHash;\n const contractProfileHash = contract.profileHash;\n const contractTarget = contract.target;\n\n const marker = await readMarker(driver);\n\n let missingCodecs: readonly string[] | undefined;\n let codecCoverageSkipped = false;\n const supportedTypeIds = collectSupportedCodecTypeIds([adapter, target, ...extensions]);\n if (supportedTypeIds.length === 0) {\n codecCoverageSkipped = true;\n } else {\n const supportedSet = new Set(supportedTypeIds);\n const usedTypeIds = extractCodecTypeIdsFromContract(contract);\n const missing = usedTypeIds.filter((id) => !supportedSet.has(id));\n if (missing.length > 0) {\n missingCodecs = missing;\n }\n }\n\n if (!marker) {\n const totalTime = Date.now() - startTime;\n return createVerifyResult({\n ok: false,\n code: VERIFY_CODE_MARKER_MISSING,\n summary: 'Marker missing',\n contractStorageHash,\n expectedTargetId,\n contractPath,\n totalTime,\n ...(contractProfileHash ? { contractProfileHash } : {}),\n ...(missingCodecs ? { missingCodecs } : {}),\n ...(codecCoverageSkipped ? { codecCoverageSkipped } : {}),\n ...(configPath ? { configPath } : {}),\n });\n }\n\n if (contractTarget !== expectedTargetId) {\n const totalTime = Date.now() - startTime;\n return createVerifyResult({\n ok: false,\n code: VERIFY_CODE_TARGET_MISMATCH,\n summary: 'Target mismatch',\n contractStorageHash,\n marker,\n expectedTargetId,\n actualTargetId: contractTarget,\n contractPath,\n totalTime,\n ...(contractProfileHash ? { contractProfileHash } : {}),\n ...(missingCodecs ? { missingCodecs } : {}),\n ...(codecCoverageSkipped ? { codecCoverageSkipped } : {}),\n ...(configPath ? { configPath } : {}),\n });\n }\n\n if (marker.storageHash !== contractStorageHash) {\n const totalTime = Date.now() - startTime;\n return createVerifyResult({\n ok: false,\n code: VERIFY_CODE_HASH_MISMATCH,\n summary: 'Hash mismatch',\n contractStorageHash,\n marker,\n expectedTargetId,\n contractPath,\n totalTime,\n ...(contractProfileHash ? { contractProfileHash } : {}),\n ...(missingCodecs ? { missingCodecs } : {}),\n ...(codecCoverageSkipped ? { codecCoverageSkipped } : {}),\n ...(configPath ? { configPath } : {}),\n });\n }\n\n if (contractProfileHash && marker.profileHash !== contractProfileHash) {\n const totalTime = Date.now() - startTime;\n return createVerifyResult({\n ok: false,\n code: VERIFY_CODE_HASH_MISMATCH,\n summary: 'Hash mismatch',\n contractStorageHash,\n contractProfileHash,\n marker,\n expectedTargetId,\n contractPath,\n totalTime,\n ...(missingCodecs ? { missingCodecs } : {}),\n ...(codecCoverageSkipped ? { codecCoverageSkipped } : {}),\n ...(configPath ? { configPath } : {}),\n });\n }\n\n const totalTime = Date.now() - startTime;\n return createVerifyResult({\n ok: true,\n summary: 'Database matches contract',\n contractStorageHash,\n marker,\n expectedTargetId,\n contractPath,\n totalTime,\n ...(contractProfileHash ? { contractProfileHash } : {}),\n ...(missingCodecs ? { missingCodecs } : {}),\n ...(codecCoverageSkipped ? { codecCoverageSkipped } : {}),\n ...(configPath ? { configPath } : {}),\n });\n },\n\n async schemaVerify(options: SchemaVerifyOptions): Promise<VerifyDatabaseSchemaResult> {\n const { driver, contract: contractInput, strict, context, frameworkComponents } = options;\n\n const contract = sqlValidateContract<Contract<SqlStorage>>(contractInput, emptyCodecLookup);\n\n const controlAdapter = adapter.create();\n if (!isSqlControlAdapter(controlAdapter)) {\n throw new Error('Adapter does not implement SqlControlAdapter.introspect()');\n }\n const schemaIR = await controlAdapter.introspect(driver, contractInput);\n\n return verifySqlSchema({\n contract,\n schema: schemaIR,\n strict,\n ...ifDefined('context', context),\n typeMetadataRegistry,\n frameworkComponents,\n // Wire up target-specific normalizers if available\n ...ifDefined('normalizeDefault', controlAdapter.normalizeDefault),\n ...ifDefined('normalizeNativeType', controlAdapter.normalizeNativeType),\n });\n },\n async sign(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract: unknown;\n readonly contractPath: string;\n readonly configPath?: string;\n }): Promise<SignDatabaseResult> {\n const { driver, contract: contractInput, contractPath, configPath } = options;\n const startTime = Date.now();\n\n const contract = sqlValidateContract<Contract<SqlStorage>>(contractInput, emptyCodecLookup);\n\n const contractStorageHash = contract.storage.storageHash;\n const contractProfileHash =\n 'profileHash' in contract && typeof contract.profileHash === 'string'\n ? contract.profileHash\n : contractStorageHash;\n const contractTarget = contract.target;\n\n await driver.query(ensureSchemaStatement.sql, ensureSchemaStatement.params);\n await driver.query(ensureTableStatement.sql, ensureTableStatement.params);\n\n const existingMarker = await readMarker(driver);\n\n let markerCreated = false;\n let markerUpdated = false;\n let previousHashes: { storageHash?: string; profileHash?: string } | undefined;\n\n if (!existingMarker) {\n const write = writeContractMarker({\n storageHash: contractStorageHash,\n profileHash: contractProfileHash,\n contractJson: contractInput,\n canonicalVersion: 1,\n });\n await driver.query(write.insert.sql, write.insert.params);\n markerCreated = true;\n } else {\n const existingStorageHash = existingMarker.storageHash;\n const existingProfileHash = existingMarker.profileHash;\n\n const storageHashMatches = existingStorageHash === contractStorageHash;\n const profileHashMatches = existingProfileHash === contractProfileHash;\n\n if (!storageHashMatches || !profileHashMatches) {\n previousHashes = {\n storageHash: existingStorageHash,\n profileHash: existingProfileHash,\n };\n const write = writeContractMarker({\n storageHash: contractStorageHash,\n profileHash: contractProfileHash,\n contractJson: contractInput,\n canonicalVersion: existingMarker.canonicalVersion ?? 1,\n });\n await driver.query(write.update.sql, write.update.params);\n markerUpdated = true;\n }\n }\n\n let summary: string;\n if (markerCreated) {\n summary = 'Database signed (marker created)';\n } else if (markerUpdated) {\n summary = `Database signed (marker updated from ${previousHashes?.storageHash ?? 'unknown'})`;\n } else {\n summary = 'Database already signed with this contract';\n }\n\n const totalTime = Date.now() - startTime;\n\n return {\n ok: true,\n summary,\n contract: {\n storageHash: contractStorageHash,\n profileHash: contractProfileHash,\n },\n target: {\n expected: contractTarget,\n actual: contractTarget,\n },\n marker: {\n created: markerCreated,\n updated: markerUpdated,\n ...(previousHashes ? { previous: previousHashes } : {}),\n },\n meta: {\n contractPath,\n ...(configPath ? { configPath } : {}),\n },\n timings: {\n total: totalTime,\n },\n };\n },\n async readMarker(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n }): Promise<ContractMarkerRecord | null> {\n return readMarker(options.driver);\n },\n async introspect(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract?: unknown;\n }): Promise<SqlSchemaIR> {\n const { driver, contract } = options;\n\n const controlAdapter = adapter.create();\n if (!isSqlControlAdapter(controlAdapter)) {\n throw new Error('Adapter does not implement SqlControlAdapter.introspect()');\n }\n return controlAdapter.introspect(driver, contract);\n },\n\n toSchemaView(schema: SqlSchemaIR): CoreSchemaView {\n const tableNodes: readonly SchemaTreeNode[] = Object.entries(schema.tables).map(\n ([tableName, table]: [string, SqlTableIR]) => {\n const children: SchemaTreeNode[] = [];\n\n const columnNodes: SchemaTreeNode[] = [];\n for (const [columnName, column] of Object.entries(table.columns)) {\n const typeDisplay = column.nativeType;\n const nullability = column.nullable ? 'nullable' : 'not nullable';\n const label = `${columnName}: ${typeDisplay} (${nullability})`;\n columnNodes.push(\n new SchemaTreeNode({\n kind: 'field',\n id: `column-${tableName}-${columnName}`,\n label,\n meta: {\n nativeType: column.nativeType,\n nullable: column.nullable,\n ...ifDefined('default', column.default),\n },\n }),\n );\n }\n\n if (columnNodes.length > 0) {\n children.push(\n new SchemaTreeNode({\n kind: 'collection',\n id: `columns-${tableName}`,\n label: 'columns',\n children: columnNodes,\n }),\n );\n }\n\n if (table.primaryKey) {\n const pkColumns = table.primaryKey.columns.join(', ');\n children.push(\n new SchemaTreeNode({\n kind: 'index',\n id: `primary-key-${tableName}`,\n label: `primary key: ${pkColumns}`,\n meta: {\n columns: table.primaryKey.columns,\n ...(table.primaryKey.name ? { name: table.primaryKey.name } : {}),\n },\n }),\n );\n }\n\n for (const unique of table.uniques) {\n const name = unique.name ?? `${tableName}_${unique.columns.join('_')}_unique`;\n const label = `unique ${name}`;\n children.push(\n new SchemaTreeNode({\n kind: 'index',\n id: `unique-${tableName}-${name}`,\n label,\n meta: {\n columns: unique.columns,\n unique: true,\n },\n }),\n );\n }\n\n for (const index of table.indexes) {\n const name = index.name ?? defaultIndexName(tableName, index.columns);\n const label = index.unique ? `unique index ${name}` : `index ${name}`;\n children.push(\n new SchemaTreeNode({\n kind: 'index',\n id: `index-${tableName}-${name}`,\n label,\n meta: {\n columns: index.columns,\n unique: index.unique,\n },\n }),\n );\n }\n\n const tableMeta: Record<string, unknown> = {};\n if (table.primaryKey) {\n tableMeta['primaryKey'] = table.primaryKey.columns;\n if (table.primaryKey.name) {\n tableMeta['primaryKeyName'] = table.primaryKey.name;\n }\n }\n if (table.foreignKeys.length > 0) {\n tableMeta['foreignKeys'] = table.foreignKeys.map((fk) => ({\n columns: fk.columns,\n referencedTable: fk.referencedTable,\n referencedColumns: fk.referencedColumns,\n ...(fk.name ? { name: fk.name } : {}),\n }));\n }\n\n return new SchemaTreeNode({\n kind: 'entity',\n id: `table-${tableName}`,\n label: `table ${tableName}`,\n ...(Object.keys(tableMeta).length > 0 ? { meta: tableMeta } : {}),\n ...(children.length > 0 ? { children } : {}),\n });\n },\n );\n\n const dependencyNodes: readonly SchemaTreeNode[] = schema.dependencies.map((dep) => {\n const shortName = dep.id.split('.').pop() ?? dep.id;\n return new SchemaTreeNode({\n kind: 'dependency',\n id: `dependency-${dep.id}`,\n label: `${shortName} dependency is installed`,\n });\n });\n\n const rootChildren = [...tableNodes, ...dependencyNodes];\n\n return {\n root: new SchemaTreeNode({\n kind: 'root',\n id: 'sql-schema',\n label: 'database',\n ...(rootChildren.length > 0 ? { children: rootChildren } : {}),\n }),\n };\n },\n };\n}\n","import type {\n ControlFamilyDescriptor,\n ControlStack,\n} from '@prisma-next/framework-components/control';\nimport { sqlEmission } from '@prisma-next/sql-contract-emitter';\nimport { sqlFamilyAuthoringFieldPresets } from './authoring-field-presets';\nimport { sqlFamilyAuthoringTypes } from './authoring-type-constructors';\nimport { createSqlFamilyInstance, type SqlControlFamilyInstance } from './control-instance';\n\nexport class SqlFamilyDescriptor\n implements ControlFamilyDescriptor<'sql', SqlControlFamilyInstance>\n{\n readonly kind = 'family' as const;\n readonly id = 'sql';\n readonly familyId = 'sql' as const;\n readonly version = '0.0.1';\n readonly emission = sqlEmission;\n readonly authoring = {\n field: sqlFamilyAuthoringFieldPresets,\n type: sqlFamilyAuthoringTypes,\n } as const;\n\n create<TTargetId extends string>(\n stack: ControlStack<'sql', TTargetId>,\n ): SqlControlFamilyInstance {\n return createSqlFamilyInstance(stack);\n }\n}\n","import type { ColumnDefault, Contract } from '@prisma-next/contract/types';\nimport type { TargetBoundComponentDescriptor } from '@prisma-next/framework-components/components';\nimport type { MigrationPlannerConflict } from '@prisma-next/framework-components/control';\nimport type {\n ForeignKey,\n Index,\n SqlStorage,\n StorageColumn,\n StorageTable,\n UniqueConstraint,\n} from '@prisma-next/sql-contract/types';\nimport { defaultIndexName } from '@prisma-next/sql-schema-ir/naming';\nimport type {\n DependencyIR,\n SqlAnnotations,\n SqlColumnIR,\n SqlForeignKeyIR,\n SqlIndexIR,\n SqlSchemaIR,\n SqlTableIR,\n SqlUniqueIR,\n} from '@prisma-next/sql-schema-ir/types';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { collectInitDependencies } from './types';\n\n/**\n * Target-specific callback that expands a column's base `nativeType` and optional\n * `typeParams` into the fully-qualified type string used by the database\n * (e.g. `character` + `{ length: 36 }` → `character(36)`).\n *\n * This lives in the family layer as a callback rather than importing a concrete\n * implementation because each target (Postgres, MySQL, SQLite, …) has its own\n * parameterization syntax. The target wires its expander when calling\n * `contractToSchemaIR`, keeping the family layer target-agnostic.\n */\nexport type NativeTypeExpander = (input: {\n readonly nativeType: string;\n readonly codecId?: string;\n readonly typeParams?: Record<string, unknown>;\n}) => string;\n\n/**\n * Target-specific callback that renders a `ColumnDefault` into the raw SQL literal\n * string stored in `SqlColumnIR.default`.\n *\n * Default value serialization is target-specific (quoting, casting, type syntax vary\n * between Postgres, MySQL, SQLite, …). This callback follows the same IoC pattern as\n * `NativeTypeExpander`: the target provides its renderer when calling\n * `contractToSchemaIR`, keeping the family layer target-agnostic.\n */\nexport type DefaultRenderer = (def: ColumnDefault, column: StorageColumn) => string;\n\nfunction convertColumn(\n name: string,\n column: StorageColumn,\n expandNativeType: NativeTypeExpander | undefined,\n renderDefault: DefaultRenderer | undefined,\n): SqlColumnIR {\n const nativeType = expandNativeType\n ? expandNativeType({\n nativeType: column.nativeType,\n codecId: column.codecId,\n ...ifDefined('typeParams', column.typeParams),\n })\n : column.nativeType;\n return {\n name,\n nativeType,\n nullable: column.nullable,\n ...ifDefined(\n 'default',\n column.default != null && renderDefault ? renderDefault(column.default, column) : undefined,\n ),\n };\n}\n\nfunction convertUnique(unique: UniqueConstraint): SqlUniqueIR {\n return {\n columns: unique.columns,\n ...ifDefined('name', unique.name),\n };\n}\n\nfunction convertIndex(index: Index): SqlIndexIR {\n return {\n columns: index.columns,\n unique: false,\n ...ifDefined('name', index.name),\n };\n}\n\nfunction convertForeignKey(fk: ForeignKey): SqlForeignKeyIR {\n return {\n columns: fk.columns,\n referencedTable: fk.references.table,\n referencedColumns: fk.references.columns,\n ...ifDefined('name', fk.name),\n };\n}\n\nfunction convertTable(\n name: string,\n table: StorageTable,\n expandNativeType: NativeTypeExpander | undefined,\n renderDefault: DefaultRenderer | undefined,\n): SqlTableIR {\n const columns: Record<string, SqlColumnIR> = {};\n for (const [colName, colDef] of Object.entries(table.columns)) {\n columns[colName] = convertColumn(colName, colDef, expandNativeType, renderDefault);\n }\n\n const satisfiedIndexColumns = new Set([\n ...table.indexes.map((idx) => idx.columns.join(',')),\n ...table.uniques.map((unique) => unique.columns.join(',')),\n ...(table.primaryKey ? [table.primaryKey.columns.join(',')] : []),\n ]);\n const fkBackingIndexes: SqlIndexIR[] = [];\n for (const fk of table.foreignKeys) {\n if (fk.index === false) continue;\n const key = fk.columns.join(',');\n if (satisfiedIndexColumns.has(key)) continue;\n fkBackingIndexes.push({\n columns: fk.columns,\n unique: false,\n name: defaultIndexName(name, fk.columns),\n });\n satisfiedIndexColumns.add(key);\n }\n\n return {\n name,\n columns,\n ...ifDefined('primaryKey', table.primaryKey),\n foreignKeys: table.foreignKeys.map(convertForeignKey),\n uniques: table.uniques.map(convertUnique),\n indexes: [...table.indexes.map(convertIndex), ...fkBackingIndexes],\n };\n}\n\n/**\n * Detects destructive changes between two contract storages.\n *\n * The additive-only planner silently ignores removals (tables, columns).\n * This function detects those removals so callers can report them as conflicts\n * rather than silently producing an empty plan.\n *\n * Returns an empty array if no destructive changes are found.\n */\nexport function detectDestructiveChanges(\n from: SqlStorage | null,\n to: SqlStorage,\n): readonly MigrationPlannerConflict[] {\n if (!from) return [];\n\n const hasOwn = (value: object, key: string): boolean => Object.hasOwn(value, key);\n\n const conflicts: MigrationPlannerConflict[] = [];\n\n for (const tableName of Object.keys(from.tables)) {\n if (!hasOwn(to.tables, tableName)) {\n conflicts.push({\n kind: 'tableRemoved',\n summary: `Table \"${tableName}\" was removed`,\n });\n continue;\n }\n\n const toTable = to.tables[tableName] as StorageTable;\n const fromTable = from.tables[tableName];\n if (!fromTable) continue;\n\n for (const columnName of Object.keys(fromTable.columns)) {\n if (!hasOwn(toTable.columns, columnName)) {\n conflicts.push({\n kind: 'columnRemoved',\n summary: `Column \"${tableName}\".\"${columnName}\" was removed`,\n });\n }\n }\n }\n\n return conflicts;\n}\n\nexport interface ContractToSchemaIROptions {\n readonly annotationNamespace: string;\n readonly expandNativeType?: NativeTypeExpander;\n readonly renderDefault?: DefaultRenderer;\n readonly frameworkComponents?: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;\n}\n\n/**\n * Converts a `Contract` to `SqlSchemaIR`.\n *\n * Reads `contract.storage` for tables, `contract.storage.types` for type\n * annotations, and derives database dependencies from `frameworkComponents`\n * (each component's `databaseDependencies.init[].id`).\n * Storage-type annotations are written under `options.annotationNamespace`.\n *\n * Drops codec metadata (`codecId`, `typeRef`) since the schema IR only represents\n * structural information. When `expandNativeType` is provided, parameterized types\n * are expanded (e.g. `character` + `{ length: 36 }` → `character(36)`) so the\n * resulting IR compares correctly against the \"to\" contract during planning.\n *\n * Returns an empty schema IR when `contract` is `null` (new project).\n */\nexport function contractToSchemaIR(\n contract: Contract<SqlStorage> | null,\n options: ContractToSchemaIROptions,\n): SqlSchemaIR {\n if (options.annotationNamespace.length === 0) {\n throw new Error('annotationNamespace must be a non-empty string');\n }\n\n if (!contract) {\n return { tables: {}, dependencies: [] };\n }\n\n const storage = contract.storage;\n const tables: Record<string, SqlTableIR> = {};\n for (const [tableName, tableDef] of Object.entries(storage.tables)) {\n tables[tableName] = convertTable(\n tableName,\n tableDef,\n options.expandNativeType,\n options.renderDefault,\n );\n }\n\n const dependencies = deduplicateDependencyIRs(\n collectInitDependencies(options.frameworkComponents ?? []),\n );\n const annotations = deriveAnnotations(storage, options.annotationNamespace);\n\n return {\n tables,\n dependencies,\n ...ifDefined('annotations', annotations),\n };\n}\n\nfunction deduplicateDependencyIRs(\n deps: readonly { readonly id: string }[],\n): readonly DependencyIR[] {\n const seen = new Set<string>();\n const result: DependencyIR[] = [];\n for (const dep of deps) {\n if (dep.id.trim().length === 0) {\n throw new Error('Dependency id must be a non-empty string');\n }\n if (seen.has(dep.id)) continue;\n seen.add(dep.id);\n result.push({ id: dep.id });\n }\n return result;\n}\n\nfunction deriveAnnotations(\n storage: SqlStorage,\n annotationNamespace: string,\n): SqlAnnotations | undefined {\n if (!storage.types || Object.keys(storage.types).length === 0) return undefined;\n // Re-key by nativeType to match the structure produced by introspection\n const byNativeType: Record<string, (typeof storage.types)[string]> = {};\n for (const typeInstance of Object.values(storage.types)) {\n byNativeType[typeInstance.nativeType] = typeInstance;\n }\n return { [annotationNamespace]: { storageTypes: byNativeType } };\n}\n","import type { NotOk, Ok } from '@prisma-next/utils/result';\nimport { notOk, ok } from '@prisma-next/utils/result';\nimport type {\n AnyRecord,\n CreateSqlMigrationPlanOptions,\n SqlMigrationPlan,\n SqlMigrationPlanOperation,\n SqlMigrationPlanOperationStep,\n SqlMigrationPlanOperationTarget,\n SqlMigrationRunnerErrorCode,\n SqlMigrationRunnerFailure,\n SqlMigrationRunnerSuccessValue,\n SqlPlannerConflict,\n SqlPlannerFailureResult,\n SqlPlannerSuccessResult,\n} from './types';\n\nconst readOnlyEmptyObject: Record<string, never> = Object.freeze({});\n\nfunction cloneRecord<T extends AnyRecord>(value: T): T {\n if (value === readOnlyEmptyObject) {\n return value;\n }\n return Object.freeze({ ...value }) as T;\n}\n\nfunction freezeSteps(\n steps: readonly SqlMigrationPlanOperationStep[],\n): readonly SqlMigrationPlanOperationStep[] {\n if (steps.length === 0) {\n return Object.freeze([]);\n }\n return Object.freeze(\n steps.map((step) =>\n Object.freeze({\n description: step.description,\n sql: step.sql,\n ...(step.meta ? { meta: cloneRecord(step.meta) } : {}),\n }),\n ),\n );\n}\n\nfunction freezeDetailsValue<T>(value: T): T {\n // Primitives and null/undefined are already immutable, return as-is\n if (value === null || value === undefined) {\n return value;\n }\n if (typeof value !== 'object') {\n return value;\n }\n // Arrays: shallow clone and freeze\n if (Array.isArray(value)) {\n return Object.freeze([...value]) as T;\n }\n // Objects: shallow clone and freeze (matching cloneRecord pattern)\n return Object.freeze({ ...value }) as T;\n}\n\nfunction freezeTargetDetails<TTargetDetails>(\n target: SqlMigrationPlanOperationTarget<TTargetDetails>,\n): SqlMigrationPlanOperationTarget<TTargetDetails> {\n return Object.freeze({\n id: target.id,\n ...(target.details !== undefined ? { details: freezeDetailsValue(target.details) } : {}),\n });\n}\n\nfunction freezeOperation<TTargetDetails>(\n operation: SqlMigrationPlanOperation<TTargetDetails>,\n): SqlMigrationPlanOperation<TTargetDetails> {\n return Object.freeze({\n id: operation.id,\n label: operation.label,\n ...(operation.summary ? { summary: operation.summary } : {}),\n operationClass: operation.operationClass,\n target: freezeTargetDetails(operation.target),\n precheck: freezeSteps(operation.precheck),\n execute: freezeSteps(operation.execute),\n postcheck: freezeSteps(operation.postcheck),\n ...(operation.meta ? { meta: cloneRecord(operation.meta) } : {}),\n });\n}\n\nfunction freezeOperations<TTargetDetails>(\n operations: readonly SqlMigrationPlanOperation<TTargetDetails>[],\n): readonly SqlMigrationPlanOperation<TTargetDetails>[] {\n if (operations.length === 0) {\n return Object.freeze([]);\n }\n return Object.freeze(operations.map((operation) => freezeOperation(operation)));\n}\n\nexport function createMigrationPlan<TTargetDetails>(\n options: CreateSqlMigrationPlanOptions<TTargetDetails>,\n): SqlMigrationPlan<TTargetDetails> {\n return Object.freeze({\n targetId: options.targetId,\n ...(options.origin !== undefined\n ? { origin: options.origin ? Object.freeze({ ...options.origin }) : null }\n : {}),\n destination: Object.freeze({ ...options.destination }),\n operations: freezeOperations(options.operations),\n ...(options.meta ? { meta: cloneRecord(options.meta) } : {}),\n });\n}\n\nexport function plannerSuccess<TTargetDetails>(\n plan: SqlMigrationPlan<TTargetDetails>,\n): SqlPlannerSuccessResult<TTargetDetails> {\n return Object.freeze({\n kind: 'success',\n plan,\n });\n}\n\nexport function plannerFailure(conflicts: readonly SqlPlannerConflict[]): SqlPlannerFailureResult {\n return Object.freeze({\n kind: 'failure' as const,\n conflicts: Object.freeze(\n conflicts.map((conflict) =>\n Object.freeze({\n kind: conflict.kind,\n summary: conflict.summary,\n ...(conflict.why ? { why: conflict.why } : {}),\n ...(conflict.location ? { location: Object.freeze({ ...conflict.location }) } : {}),\n ...(conflict.meta ? { meta: cloneRecord(conflict.meta) } : {}),\n }),\n ),\n ),\n });\n}\n\n/**\n * Creates a successful migration runner result.\n */\nexport function runnerSuccess(value: {\n operationsPlanned: number;\n operationsExecuted: number;\n}): Ok<SqlMigrationRunnerSuccessValue> {\n return ok(\n Object.freeze({\n operationsPlanned: value.operationsPlanned,\n operationsExecuted: value.operationsExecuted,\n }),\n );\n}\n\n/**\n * Creates a failed migration runner result.\n */\nexport function runnerFailure(\n code: SqlMigrationRunnerErrorCode,\n summary: string,\n options?: { why?: string; meta?: AnyRecord },\n): NotOk<SqlMigrationRunnerFailure> {\n const failure: SqlMigrationRunnerFailure = Object.freeze({\n code,\n summary,\n ...(options?.why ? { why: options.why } : {}),\n ...(options?.meta ? { meta: cloneRecord(options.meta) } : {}),\n });\n return notOk(failure);\n}\n","import type { MigrationOperationPolicy } from '@prisma-next/framework-components/control';\n\n/**\n * Policy used by `db init`: additive-only operations, no widening/destructive steps.\n */\nexport const INIT_ADDITIVE_POLICY: MigrationOperationPolicy = Object.freeze({\n allowedOperationClasses: Object.freeze(['additive'] as const),\n});\n","import { SqlFamilyDescriptor } from '../core/control-descriptor';\n\n// Re-export core types from canonical source\nexport type {\n MigrationOperationClass,\n MigrationOperationPolicy,\n MigrationPlan,\n MigrationPlanner,\n MigrationPlannerConflict,\n MigrationPlannerResult,\n MigrationPlanOperation,\n TargetMigrationsCapability,\n} from '@prisma-next/framework-components/control';\nexport { assembleAuthoringContributions } from '@prisma-next/framework-components/control';\nexport { extractCodecControlHooks } from '../core/assembly';\nexport type { SchemaVerifyOptions, SqlControlFamilyInstance } from '../core/control-instance';\nexport type {\n ContractToSchemaIROptions,\n DefaultRenderer,\n NativeTypeExpander,\n} from '../core/migrations/contract-to-schema-ir';\n// Contract → SchemaIR conversion for offline migration planning\nexport {\n contractToSchemaIR,\n detectDestructiveChanges,\n} from '../core/migrations/contract-to-schema-ir';\nexport {\n createMigrationPlan,\n plannerFailure,\n plannerSuccess,\n runnerFailure,\n runnerSuccess,\n} from '../core/migrations/plan-helpers';\nexport { INIT_ADDITIVE_POLICY } from '../core/migrations/policies';\nexport type {\n CodecControlHooks,\n ComponentDatabaseDependencies,\n ComponentDatabaseDependency,\n CreateSqlMigrationPlanOptions,\n ExpandNativeTypeInput,\n ResolveIdentityValueInput,\n SqlControlAdapterDescriptor,\n SqlControlExtensionDescriptor,\n SqlControlTargetDescriptor,\n SqlMigrationPlan,\n SqlMigrationPlanContractInfo,\n SqlMigrationPlanner,\n SqlMigrationPlannerPlanOptions,\n SqlMigrationPlanOperation,\n SqlMigrationPlanOperationStep,\n SqlMigrationPlanOperationTarget,\n SqlMigrationRunner,\n SqlMigrationRunnerErrorCode,\n SqlMigrationRunnerExecuteCallbacks,\n SqlMigrationRunnerExecuteOptions,\n SqlMigrationRunnerFailure,\n SqlMigrationRunnerResult,\n SqlMigrationRunnerSuccessValue,\n SqlPlannerConflict,\n SqlPlannerConflictKind,\n SqlPlannerConflictLocation,\n SqlPlannerFailureResult,\n SqlPlannerResult,\n SqlPlannerSuccessResult,\n StorageTypePlanResult,\n} from '../core/migrations/types';\nexport { collectInitDependencies, isDatabaseDependencyProvider } from '../core/migrations/types';\n\nexport default new SqlFamilyDescriptor();\n"],"mappings":";;;;;;;;;;;;;AA0CA,SAAS,gCAAgC,UAAsC;CAC7E,MAAM,0BAAU,IAAI,KAAa;AAGjC,KACE,OAAO,aAA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,oBAAoB,MAAM;EAC3B,CAAC,CACH;;;;;AAMH,SAAgB,cACd,MACA,SACA,SACkC;AAOlC,QAAO,MANoC,OAAO,OAAO;EACvD;EACA;EACA,GAAI,SAAS,MAAM,EAAE,KAAK,QAAQ,KAAK,GAAG,EAAE;EAC5C,GAAI,SAAS,OAAO,EAAE,MAAM,YAAY,QAAQ,KAAK,EAAE,GAAG,EAAE;EAC7D,CAAC,CACmB;;;;;;;;AC7JvB,MAAaC,uBAAiD,OAAO,OAAO,EAC1E,yBAAyB,OAAO,OAAO,CAAC,WAAW,CAAU,EAC9D,CAAC;;;;AC6DF,sBAAe,IAAI,qBAAqB"}
@@ -1,5 +1,5 @@
1
1
  import { i as verifySqlSchema, n as NativeTypeNormalizer, r as VerifySqlSchemaOptions } from "./verify-sql-schema-BBhkqEDo.mjs";
2
- import { i as ComponentDatabaseDependency } from "./types-BaUzKt6Q.mjs";
2
+ import { i as ComponentDatabaseDependency } from "./types-CH9zsNrU.mjs";
3
3
  import { SchemaIssue, SchemaVerificationNode } from "@prisma-next/framework-components/control";
4
4
  import { SqlIndexIR, SqlSchemaIR, SqlUniqueIR } from "@prisma-next/sql-schema-ir/types";
5
5
 
@@ -1,3 +1,3 @@
1
- import { a as verifyDatabaseDependencies, i as isUniqueConstraintSatisfied, n as arraysEqual, r as isIndexSatisfied, t as verifySqlSchema } from "./verify-sql-schema-lR-tlboL.mjs";
1
+ import { a as verifyDatabaseDependencies, i as isUniqueConstraintSatisfied, n as arraysEqual, r as isIndexSatisfied, t as verifySqlSchema } from "./verify-sql-schema-Ovz7RXR5.mjs";
2
2
 
3
3
  export { arraysEqual, isIndexSatisfied, isUniqueConstraintSatisfied, verifyDatabaseDependencies, verifySqlSchema };