@prisma-next/family-sql 0.12.0-dev.4 → 0.12.0-dev.40

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.
Files changed (38) hide show
  1. package/dist/control-adapter-uYnmu04p.d.mts +181 -0
  2. package/dist/control-adapter-uYnmu04p.d.mts.map +1 -0
  3. package/dist/control-adapter.d.mts +2 -109
  4. package/dist/control.d.mts +118 -4
  5. package/dist/control.d.mts.map +1 -1
  6. package/dist/control.mjs +214 -29
  7. package/dist/control.mjs.map +1 -1
  8. package/dist/migration.d.mts +1 -1
  9. package/dist/runtime.d.mts +4 -2
  10. package/dist/runtime.d.mts.map +1 -1
  11. package/dist/runtime.mjs +3 -1
  12. package/dist/runtime.mjs.map +1 -1
  13. package/dist/schema-verify.d.mts +2 -1
  14. package/dist/schema-verify.d.mts.map +1 -1
  15. package/dist/schema-verify.mjs +1 -1
  16. package/dist/{types-CeeCStqw.d.mts → types-DxNgxFkF.d.mts} +61 -7
  17. package/dist/types-DxNgxFkF.d.mts.map +1 -0
  18. package/dist/{verify-sql-schema-CN7pPoTC.d.mts → verify-sql-schema-Cj3c2t5Z.d.mts} +8 -2
  19. package/dist/verify-sql-schema-Cj3c2t5Z.d.mts.map +1 -0
  20. package/dist/{verify-sql-schema-CYLsGCFO.mjs → verify-sql-schema-fljAiO-C.mjs} +403 -310
  21. package/dist/verify-sql-schema-fljAiO-C.mjs.map +1 -0
  22. package/package.json +21 -21
  23. package/src/core/control-adapter.ts +112 -3
  24. package/src/core/control-instance.ts +141 -54
  25. package/src/core/default-namespace.ts +9 -0
  26. package/src/core/migrations/control-policy.ts +322 -0
  27. package/src/core/migrations/plan-helpers.ts +16 -0
  28. package/src/core/migrations/types.ts +12 -2
  29. package/src/core/schema-verify/control-verify-emit.ts +46 -0
  30. package/src/core/schema-verify/verifier-disposition.ts +53 -0
  31. package/src/core/schema-verify/verify-helpers.ts +151 -110
  32. package/src/core/schema-verify/verify-sql-schema.ts +291 -155
  33. package/src/exports/control.ts +6 -0
  34. package/src/exports/runtime.ts +7 -0
  35. package/dist/control-adapter.d.mts.map +0 -1
  36. package/dist/types-CeeCStqw.d.mts.map +0 -1
  37. package/dist/verify-sql-schema-CN7pPoTC.d.mts.map +0 -1
  38. package/dist/verify-sql-schema-CYLsGCFO.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { T as SqlPlanTargetDetails, p as SqlMigrationPlanOperation } from "./types-CeeCStqw.mjs";
1
+ import { T as SqlPlanTargetDetails, p as SqlMigrationPlanOperation } from "./types-DxNgxFkF.mjs";
2
2
  import { Migration } from "@prisma-next/migration-tools/migration";
3
3
 
4
4
  //#region src/core/sql-migration.d.ts
@@ -1,5 +1,7 @@
1
- import { RuntimeMutationDefaultGenerator } from "@prisma-next/sql-runtime";
1
+ import { ResolvedDomainModel, UNBOUND_DOMAIN_NAMESPACE_ID, resolveDomainModel } from "@prisma-next/contract/types";
2
+ import { ResolvedStorageTable, resolveStorageTable } from "@prisma-next/sql-contract/resolve-storage-table";
2
3
  import { RuntimeFamilyDescriptor, RuntimeFamilyInstance } from "@prisma-next/framework-components/execution";
4
+ import { RuntimeMutationDefaultGenerator } from "@prisma-next/sql-runtime";
3
5
 
4
6
  //#region src/core/runtime-instance.d.ts
5
7
  /**
@@ -40,5 +42,5 @@ declare const sqlRuntimeFamilyDescriptor: RuntimeFamilyDescriptor<'sql', SqlRunt
40
42
  */
41
43
  declare function timestampNowRuntimeGenerator(): RuntimeMutationDefaultGenerator;
42
44
  //#endregion
43
- export { sqlRuntimeFamilyDescriptor as default, timestampNowRuntimeGenerator };
45
+ export { type ResolvedDomainModel, type ResolvedStorageTable, UNBOUND_DOMAIN_NAMESPACE_ID, sqlRuntimeFamilyDescriptor as default, resolveDomainModel, resolveStorageTable, timestampNowRuntimeGenerator };
44
46
  //# sourceMappingURL=runtime.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/core/runtime-instance.ts","../src/core/runtime-descriptor.ts","../src/core/timestamp-now-runtime-generator.ts"],"mappings":";;;;;;;AAUA;;;;AAAuE;UAAtD,wBAAA,SAAiC,qBAAqB;;;;;AAAvE;;;;AAAuE;;cCC1D,0BAAA,EAA4B,uBAAuB,QAAQ,wBAAA;;;;;;ADDxE;;;;AAAuE;;;;ACCvE;;;iBCMgB,4BAAA,CAAA,GAAgC,+BAA+B"}
1
+ {"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/core/runtime-instance.ts","../src/core/runtime-descriptor.ts","../src/core/timestamp-now-runtime-generator.ts"],"mappings":";;;;;;;;;;;AAUA;;;UAAiB,wBAAA,SAAiC,qBAAqB;;;;;;;AAAvE;;;;cCCa,0BAAA,EAA4B,uBAAuB,QAAQ,wBAAA;;;;;;;;ADDxE;;;;AAAuE;;;;ACCvE;iBCMgB,4BAAA,CAAA,GAAgC,+BAA+B"}
package/dist/runtime.mjs CHANGED
@@ -1,4 +1,6 @@
1
1
  import { t as TIMESTAMP_NOW_GENERATOR_ID } from "./timestamp-now-generator-BkjCQIde.mjs";
2
+ import { UNBOUND_DOMAIN_NAMESPACE_ID, resolveDomainModel } from "@prisma-next/contract/types";
3
+ import { resolveStorageTable } from "@prisma-next/sql-contract/resolve-storage-table";
2
4
  //#region src/core/runtime-instance.ts
3
5
  /**
4
6
  * Creates a SQL execution-plane family instance.
@@ -55,6 +57,6 @@ function timestampNowRuntimeGenerator() {
55
57
  //#region src/exports/runtime.ts
56
58
  var runtime_default = sqlRuntimeFamilyDescriptor;
57
59
  //#endregion
58
- export { runtime_default as default, timestampNowRuntimeGenerator };
60
+ export { UNBOUND_DOMAIN_NAMESPACE_ID, runtime_default as default, resolveDomainModel, resolveStorageTable, timestampNowRuntimeGenerator };
59
61
 
60
62
  //# sourceMappingURL=runtime.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.mjs","names":[],"sources":["../src/core/runtime-instance.ts","../src/core/runtime-descriptor.ts","../src/core/timestamp-now-runtime-generator.ts","../src/exports/runtime.ts"],"sourcesContent":["import type { RuntimeFamilyInstance } from '@prisma-next/framework-components/execution';\n\n/**\n * SQL execution-plane family instance interface.\n *\n * Note: this is currently named `SqlRuntimeFamilyInstance` because the execution plane\n * framework types are still using the `Runtime*` naming (`RuntimeFamilyInstance`, etc.).\n *\n * This will be renamed to `SqlExecutionFamilyInstance` as part of `TML-1842`.\n */\nexport interface SqlRuntimeFamilyInstance extends RuntimeFamilyInstance<'sql'> {}\n\n/**\n * Creates a SQL execution-plane family instance.\n *\n * This will be renamed to `createSqlExecutionFamilyInstance()` as part of `TML-1842`.\n */\nexport function createSqlRuntimeFamilyInstance(): SqlRuntimeFamilyInstance {\n return {\n familyId: 'sql' as const,\n };\n}\n","import type { RuntimeFamilyDescriptor } from '@prisma-next/framework-components/execution';\nimport { createSqlRuntimeFamilyInstance, type SqlRuntimeFamilyInstance } from './runtime-instance';\n\n/**\n * SQL execution-plane family descriptor.\n *\n * Note: this is currently named `sqlRuntimeFamilyDescriptor` because the execution plane\n * framework types are still using the `Runtime*` naming (`RuntimeFamilyDescriptor`, etc.).\n *\n * This will be renamed to `sqlExecutionFamilyDescriptor` as part of `TML-1842`.\n */\nexport const sqlRuntimeFamilyDescriptor: RuntimeFamilyDescriptor<'sql', SqlRuntimeFamilyInstance> =\n {\n kind: 'family',\n id: 'sql',\n familyId: 'sql',\n version: '0.0.1',\n create() {\n return createSqlRuntimeFamilyInstance();\n },\n };\n\nObject.freeze(sqlRuntimeFamilyDescriptor);\n","import type { RuntimeMutationDefaultGenerator } from '@prisma-next/sql-runtime';\nimport { TIMESTAMP_NOW_GENERATOR_ID } from './timestamp-now-generator';\n\n/**\n * Builds the canonical runtime-plane generator for the wall-clock-now\n * mutation default. Returns `new Date()`; semantics are target-agnostic\n * so all SQL targets share this single implementation.\n *\n * Declares `stability: 'query'` so a single ORM bulk operation\n * (e.g. `createAll([...])`) shares one timestamp across every row and\n * every timestamp-defaulted column. Matches Prisma 6's `@updatedAt`\n * semantics: one `new Date()` per lowered mutation, not per row.\n *\n * Lives in a runtime-plane-only module so the control-plane\n * `timestamp-now-generator.ts` (descriptor + authoring presets) stays\n * free of `@prisma-next/sql-runtime` imports.\n */\nexport function timestampNowRuntimeGenerator(): RuntimeMutationDefaultGenerator {\n return {\n id: TIMESTAMP_NOW_GENERATOR_ID,\n generate: () => new Date(),\n stability: 'query',\n };\n}\n","import { sqlRuntimeFamilyDescriptor } from '../core/runtime-descriptor';\n\nexport { timestampNowRuntimeGenerator } from '../core/timestamp-now-runtime-generator';\n\nexport default sqlRuntimeFamilyDescriptor;\n"],"mappings":";;;;;;;AAiBA,SAAgB,iCAA2D;CACzE,OAAO,EACL,UAAU,MACZ;AACF;;;;;;;;;;;ACVA,MAAa,6BACX;CACE,MAAM;CACN,IAAI;CACJ,UAAU;CACV,SAAS;CACT,SAAS;EACP,OAAO,+BAA+B;CACxC;AACF;AAEF,OAAO,OAAO,0BAA0B;;;;;;;;;;;;;;;;;ACLxC,SAAgB,+BAAgE;CAC9E,OAAO;EACL,IAAI;EACJ,gCAAgB,IAAI,KAAK;EACzB,WAAW;CACb;AACF;;;ACnBA,IAAA,kBAAe"}
1
+ {"version":3,"file":"runtime.mjs","names":[],"sources":["../src/core/runtime-instance.ts","../src/core/runtime-descriptor.ts","../src/core/timestamp-now-runtime-generator.ts","../src/exports/runtime.ts"],"sourcesContent":["import type { RuntimeFamilyInstance } from '@prisma-next/framework-components/execution';\n\n/**\n * SQL execution-plane family instance interface.\n *\n * Note: this is currently named `SqlRuntimeFamilyInstance` because the execution plane\n * framework types are still using the `Runtime*` naming (`RuntimeFamilyInstance`, etc.).\n *\n * This will be renamed to `SqlExecutionFamilyInstance` as part of `TML-1842`.\n */\nexport interface SqlRuntimeFamilyInstance extends RuntimeFamilyInstance<'sql'> {}\n\n/**\n * Creates a SQL execution-plane family instance.\n *\n * This will be renamed to `createSqlExecutionFamilyInstance()` as part of `TML-1842`.\n */\nexport function createSqlRuntimeFamilyInstance(): SqlRuntimeFamilyInstance {\n return {\n familyId: 'sql' as const,\n };\n}\n","import type { RuntimeFamilyDescriptor } from '@prisma-next/framework-components/execution';\nimport { createSqlRuntimeFamilyInstance, type SqlRuntimeFamilyInstance } from './runtime-instance';\n\n/**\n * SQL execution-plane family descriptor.\n *\n * Note: this is currently named `sqlRuntimeFamilyDescriptor` because the execution plane\n * framework types are still using the `Runtime*` naming (`RuntimeFamilyDescriptor`, etc.).\n *\n * This will be renamed to `sqlExecutionFamilyDescriptor` as part of `TML-1842`.\n */\nexport const sqlRuntimeFamilyDescriptor: RuntimeFamilyDescriptor<'sql', SqlRuntimeFamilyInstance> =\n {\n kind: 'family',\n id: 'sql',\n familyId: 'sql',\n version: '0.0.1',\n create() {\n return createSqlRuntimeFamilyInstance();\n },\n };\n\nObject.freeze(sqlRuntimeFamilyDescriptor);\n","import type { RuntimeMutationDefaultGenerator } from '@prisma-next/sql-runtime';\nimport { TIMESTAMP_NOW_GENERATOR_ID } from './timestamp-now-generator';\n\n/**\n * Builds the canonical runtime-plane generator for the wall-clock-now\n * mutation default. Returns `new Date()`; semantics are target-agnostic\n * so all SQL targets share this single implementation.\n *\n * Declares `stability: 'query'` so a single ORM bulk operation\n * (e.g. `createAll([...])`) shares one timestamp across every row and\n * every timestamp-defaulted column. Matches Prisma 6's `@updatedAt`\n * semantics: one `new Date()` per lowered mutation, not per row.\n *\n * Lives in a runtime-plane-only module so the control-plane\n * `timestamp-now-generator.ts` (descriptor + authoring presets) stays\n * free of `@prisma-next/sql-runtime` imports.\n */\nexport function timestampNowRuntimeGenerator(): RuntimeMutationDefaultGenerator {\n return {\n id: TIMESTAMP_NOW_GENERATOR_ID,\n generate: () => new Date(),\n stability: 'query',\n };\n}\n","import { sqlRuntimeFamilyDescriptor } from '../core/runtime-descriptor';\n\nexport {\n type ResolvedDomainModel,\n type ResolvedStorageTable,\n resolveDomainModel,\n resolveStorageTable,\n UNBOUND_DOMAIN_NAMESPACE_ID,\n} from '../core/default-namespace';\nexport { timestampNowRuntimeGenerator } from '../core/timestamp-now-runtime-generator';\n\nexport default sqlRuntimeFamilyDescriptor;\n"],"mappings":";;;;;;;;;AAiBA,SAAgB,iCAA2D;CACzE,OAAO,EACL,UAAU,MACZ;AACF;;;;;;;;;;;ACVA,MAAa,6BACX;CACE,MAAM;CACN,IAAI;CACJ,UAAU;CACV,SAAS;CACT,SAAS;EACP,OAAO,+BAA+B;CACxC;AACF;AAEF,OAAO,OAAO,0BAA0B;;;;;;;;;;;;;;;;;ACLxC,SAAgB,+BAAgE;CAC9E,OAAO;EACL,IAAI;EACJ,gCAAgB,IAAI,KAAK;EACzB,WAAW;CACb;AACF;;;ACZA,IAAA,kBAAe"}
@@ -1,5 +1,6 @@
1
- import { i as verifySqlSchema, n as NativeTypeNormalizer, r as VerifySqlSchemaOptions } from "./verify-sql-schema-CN7pPoTC.mjs";
1
+ import { a as verifySqlSchema, i as VerifySqlSchemaOptions, r as NativeTypeNormalizer } from "./verify-sql-schema-Cj3c2t5Z.mjs";
2
2
  import { SchemaIssue } from "@prisma-next/framework-components/control";
3
+ import { ControlPolicy } from "@prisma-next/contract/types";
3
4
  import { SqlIndexIR, SqlUniqueIR } from "@prisma-next/sql-schema-ir/types";
4
5
 
5
6
  //#region src/core/schema-verify/verify-helpers.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"schema-verify.d.mts","names":[],"sources":["../src/core/schema-verify/verify-helpers.ts"],"mappings":";;;;;;;;iBAsDgB,WAAA,CAAY,CAAA,qBAAsB,CAAoB;AA+BtE;;;;;;;;;;AAG4B;AAuB5B;AA1BA,iBAAgB,2BAAA,CACd,OAAA,WAAkB,WAAA,IAClB,OAAA,WAAkB,UAAU,IAC5B,OAAA;;;;;;;;;AA0B0B;;;;iBAHZ,gBAAA,CACd,OAAA,WAAkB,UAAA,IAClB,OAAA,WAAkB,WAAW,IAC7B,OAAA"}
1
+ {"version":3,"file":"schema-verify.d.mts","names":[],"sources":["../src/core/schema-verify/verify-helpers.ts"],"mappings":";;;;;;;;;iBA2DgB,WAAA,CAAY,CAAA,qBAAsB,CAAoB;AA+BtE;;;;;;;;;;AAG4B;AAuB5B;AA1BA,iBAAgB,2BAAA,CACd,OAAA,WAAkB,WAAA,IAClB,OAAA,WAAkB,UAAU,IAC5B,OAAA;;;;;;;;;AA0B0B;;;;iBAHZ,gBAAA,CACd,OAAA,WAAkB,UAAA,IAClB,OAAA,WAAkB,WAAW,IAC7B,OAAA"}
@@ -1,2 +1,2 @@
1
- import { i as isUniqueConstraintSatisfied, n as arraysEqual, r as isIndexSatisfied, t as verifySqlSchema } from "./verify-sql-schema-CYLsGCFO.mjs";
1
+ import { i as isUniqueConstraintSatisfied, n as arraysEqual, r as isIndexSatisfied, t as verifySqlSchema } from "./verify-sql-schema-fljAiO-C.mjs";
2
2
  export { arraysEqual, isIndexSatisfied, isUniqueConstraintSatisfied, verifySqlSchema };
@@ -1,12 +1,14 @@
1
+ import { t as SqlControlAdapter } from "./control-adapter-uYnmu04p.mjs";
1
2
  import { ContractSerializer, ContractSpace, ControlAdapterDescriptor, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyInstance, ControlStack, MigratableTargetDescriptor, MigrationOperationPolicy, MigrationPlan, MigrationPlanOperation, MigrationPlannerConflict, MigrationPlannerFailureResult, MigrationPlannerSuccessResult, MigrationRunnerExecutionChecks, MigrationRunnerFailure, MigrationRunnerPerSpaceSuccessValue, MigrationRunnerResult, OpFactoryCall, OperationContext, OperationPreview, OperationPreviewCapable, PslContractInferCapable, SchemaIssue, SchemaVerifier, SchemaViewCapable, SignDatabaseResult, VerifyDatabaseResult, VerifyDatabaseSchemaResult } from "@prisma-next/framework-components/control";
2
3
  import { SqlStorage, StorageColumn, StorageTable, StorageTypeInstance } from "@prisma-next/sql-contract/types";
3
4
  import { PslDocumentAst } from "@prisma-next/framework-components/psl-ast";
4
- import { Result } from "@prisma-next/utils/result";
5
5
  import { Contract } from "@prisma-next/contract/types";
6
- import { AnyQueryAst, LoweredStatement, LowererContext } from "@prisma-next/sql-relational-core/ast";
6
+ import { Result } from "@prisma-next/utils/result";
7
+ import { AnyQueryAst, DdlNode, LoweredStatement, LowererContext } from "@prisma-next/sql-relational-core/ast";
7
8
  import { SqlSchemaIR } from "@prisma-next/sql-schema-ir/types";
8
9
  import { TargetBoundComponentDescriptor } from "@prisma-next/framework-components/components";
9
10
  import { TypesImportSpec } from "@prisma-next/framework-components/emission";
11
+ import { AggregateMigrationEdgeRef } from "@prisma-next/migration-tools/aggregate";
10
12
  import { SqlOperationDescriptors } from "@prisma-next/sql-operations";
11
13
 
12
14
  //#region src/core/control-instance.d.ts
@@ -66,7 +68,53 @@ interface SqlControlFamilyInstance extends ControlFamilyInstance<'sql', SqlSchem
66
68
  readonly contract?: unknown;
67
69
  }): Promise<SqlSchemaIR>;
68
70
  inferPslContract(schemaIR: SqlSchemaIR): PslDocumentAst;
69
- lowerAst(ast: AnyQueryAst, context: LowererContext<unknown>): LoweredStatement;
71
+ lowerAst(ast: AnyQueryAst | DdlNode, context: LowererContext<unknown>): LoweredStatement;
72
+ /**
73
+ * Inserts the initial marker row for `space` (upsert on `space`).
74
+ * Delegates to the target control adapter's write SPI; see
75
+ * `SqlControlAdapter.initMarker`.
76
+ */
77
+ initMarker(options: {
78
+ readonly driver: ControlDriverInstance<'sql', string>;
79
+ readonly space: string;
80
+ readonly destination: {
81
+ readonly storageHash: string;
82
+ readonly profileHash: string;
83
+ readonly invariants?: readonly string[];
84
+ };
85
+ }): Promise<void>;
86
+ /**
87
+ * Compare-and-swap advance of the marker row for `space`. Returns `true`
88
+ * when the swap matched a row; see `SqlControlAdapter.updateMarker`.
89
+ */
90
+ updateMarker(options: {
91
+ readonly driver: ControlDriverInstance<'sql', string>;
92
+ readonly space: string;
93
+ readonly expectedFrom: string;
94
+ readonly destination: {
95
+ readonly storageHash: string;
96
+ readonly profileHash: string;
97
+ readonly invariants?: readonly string[];
98
+ };
99
+ }): Promise<boolean>;
100
+ /**
101
+ * Appends a ledger entry for `space`; see
102
+ * `SqlControlAdapter.writeLedgerEntry`.
103
+ */
104
+ writeLedgerEntry(options: {
105
+ readonly driver: ControlDriverInstance<'sql', string>;
106
+ readonly space: string;
107
+ readonly entry: {
108
+ readonly edgeId: string;
109
+ readonly from: string;
110
+ readonly to: string;
111
+ readonly migrationName: string;
112
+ readonly migrationHash: string;
113
+ readonly operations: readonly unknown[];
114
+ };
115
+ }): Promise<void>;
116
+ bootstrapControlTableQueries(): readonly DdlNode[];
117
+ bootstrapSignMarkerQueries(): readonly DdlNode[];
70
118
  toOperationPreview(operations: readonly MigrationPlanOperation[]): OperationPreview;
71
119
  }
72
120
  //#endregion
@@ -202,7 +250,7 @@ interface SqlControlExtensionDescriptor<TTargetId extends string> extends Contro
202
250
  */
203
251
  readonly contractSpace?: ContractSpace<Contract<SqlStorage>>;
204
252
  }
205
- interface SqlControlAdapterDescriptor<TTargetId extends string> extends ControlAdapterDescriptor<'sql', TTargetId> {
253
+ interface SqlControlAdapterDescriptor<TTargetId extends string> extends ControlAdapterDescriptor<'sql', TTargetId, SqlControlAdapter<TTargetId>> {
206
254
  readonly queryOperations?: () => SqlOperationDescriptors;
207
255
  }
208
256
  interface SqlMigrationPlanOperationStep {
@@ -283,8 +331,9 @@ interface SqlMigrationPlan<TTargetDetails> extends MigrationPlan {
283
331
  readonly providedInvariants: readonly string[];
284
332
  readonly meta?: AnyRecord;
285
333
  }
286
- type SqlPlannerConflictKind = 'typeMismatch' | 'nullabilityConflict' | 'indexIncompatible' | 'foreignKeyConflict' | 'missingButNonAdditive' | 'unsupportedOperation';
334
+ type SqlPlannerConflictKind = 'typeMismatch' | 'nullabilityConflict' | 'indexIncompatible' | 'foreignKeyConflict' | 'missingButNonAdditive' | 'unsupportedOperation' | 'controlPolicySuppressedCall';
287
335
  interface SqlPlannerConflictLocation {
336
+ readonly namespace?: string;
288
337
  readonly table?: string;
289
338
  readonly column?: string;
290
339
  readonly index?: string;
@@ -387,8 +436,13 @@ interface SqlMigrationRunnerExecuteOptions<TTargetDetails> {
387
436
  * All components must have matching familyId ('sql') and targetId.
388
437
  */
389
438
  readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;
439
+ /**
440
+ * Per-edge breakdown from graph-walk planning. When present, the runner
441
+ * writes one ledger row per edge instead of one collapsed row per apply.
442
+ */
443
+ readonly migrationEdges: readonly AggregateMigrationEdgeRef[];
390
444
  }
391
- type SqlMigrationRunnerErrorCode = 'DESTINATION_CONTRACT_MISMATCH' | 'LEGACY_MARKER_SHAPE' | 'MARKER_ORIGIN_MISMATCH' | 'POLICY_VIOLATION' | 'PRECHECK_FAILED' | 'POSTCHECK_FAILED' | 'SCHEMA_VERIFY_FAILED' | 'FOREIGN_KEY_VIOLATION' | 'EXECUTION_FAILED';
445
+ type SqlMigrationRunnerErrorCode = 'DESTINATION_CONTRACT_MISMATCH' | 'LEGACY_MARKER_SHAPE' | 'MARKER_ORIGIN_MISMATCH' | 'MARKER_CAS_FAILURE' | 'POLICY_VIOLATION' | 'PRECHECK_FAILED' | 'POSTCHECK_FAILED' | 'SCHEMA_VERIFY_FAILED' | 'FOREIGN_KEY_VIOLATION' | 'EXECUTION_FAILED';
392
446
  interface SqlMigrationRunnerFailure extends MigrationRunnerFailure {
393
447
  readonly code: SqlMigrationRunnerErrorCode;
394
448
  readonly meta?: AnyRecord;
@@ -463,4 +517,4 @@ interface CreateSqlMigrationPlanOptions<TTargetDetails> {
463
517
  }
464
518
  //#endregion
465
519
  export { SqlPlannerResult as A, SqlMigrationRunnerResult as C, SqlPlannerConflictKind as D, SqlPlannerConflict as E, StorageTypePlanResult as M, SqlControlFamilyInstance as N, SqlPlannerConflictLocation as O, SqlMigrationRunnerFailure as S, SqlPlanTargetDetails as T, SqlMigrationPlannerPlanOptions as _, FieldEvent as a, SqlMigrationRunnerExecuteCallbacks as b, SqlControlAdapterDescriptor as c, SqlMigrationPlan as d, SqlMigrationPlanContractInfo as f, SqlMigrationPlanner as g, SqlMigrationPlanOperationTarget as h, ExpandNativeTypeInput as i, SqlPlannerSuccessResult as j, SqlPlannerFailureResult as k, SqlControlExtensionDescriptor as l, SqlMigrationPlanOperationStep as m, CodecControlHooks as n, FieldEventContext as o, SqlMigrationPlanOperation as p, CreateSqlMigrationPlanOptions as r, ResolveIdentityValueInput as s, AnyRecord as t, SqlControlTargetDescriptor as u, SqlMigrationRunner as v, SqlMigrationRunnerSuccessValue as w, SqlMigrationRunnerExecuteOptions as x, SqlMigrationRunnerErrorCode as y };
466
- //# sourceMappingURL=types-CeeCStqw.d.mts.map
520
+ //# sourceMappingURL=types-DxNgxFkF.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-DxNgxFkF.d.mts","names":[],"sources":["../src/core/control-instance.ts","../src/core/migrations/types.ts"],"mappings":";;;;;;;;;;;;;;UA6KU,eAAA;EAAA,SACC,MAAA;EAAA,SACA,QAAA;EAAA,SACA,QAAA;EAAA,SACA,UAAA;AAAA;AAAA,KAGN,uBAAA,GAA0B,GAAG,SAAS,eAAA;AAAA,UAEjC,sBAAA;EAAA,SACC,gBAAA,EAAkB,aAAA,CAAc,eAAA;EAAA,SAChC,YAAA,EAAc,aAAA;EAAA,SACd,oBAAA,EAAsB,uBAAA;AAAA;AAAA,UAGhB,wBAAA,SACP,qBAAA,QAA6B,WAAA,GACnC,iBAAA,CAAkB,WAAA,GAClB,uBAAA,CAAwB,WAAA,GACxB,uBAAA,EACA,sBAAA;EAjBO;;;AACU;AAAA;;;;EAyBnB,mBAAA,CAAoB,YAAA,YAAwB,QAAA;EAE5C,MAAA,CAAO,OAAA;IAAA,SACI,MAAA,EAAQ,qBAAA;IAAA,SACR,QAAA;IAAA,SACA,gBAAA;IAAA,SACA,YAAA;IAAA,SACA,UAAA;EAAA,IACP,OAAA,CAAQ,oBAAA;EAzB0C;;;;;;;;;;EAqCtD,YAAA,CAAa,OAAA;IAAA,SACF,QAAA;IAAA,SACA,MAAA,EAAQ,WAAA;IAAA,SACR,MAAA;IAAA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c;EAAd,SAiRV,OAAA;EAAA,SACA,MAAA,GAAS,4BAAA;EAAA,SACT,WAAA,EAAa,4BAAA;EAAA,SACb,UAAA,WAAqB,yBAAA,CAA0B,cAAA;EA/QvC;;;;;EAAA,SAqRR,kBAAA;EAAA,SACA,IAAA,GAAO,SAAA;AAAA"}
@@ -5,6 +5,7 @@ import { SqlSchemaIR } from "@prisma-next/sql-schema-ir/types";
5
5
  import { TargetBoundComponentDescriptor } from "@prisma-next/framework-components/components";
6
6
 
7
7
  //#region src/core/schema-verify/verify-sql-schema.d.ts
8
+ type ColumnsCompatible = (declared: string, live: string) => boolean;
8
9
  /**
9
10
  * Function type for normalizing raw database default expressions into ColumnDefault.
10
11
  * Target-specific implementations handle database dialect differences.
@@ -61,6 +62,11 @@ interface VerifySqlSchemaOptions {
61
62
  * value-set comparison against the contract's `PostgresEnumStorageEntry.values`.
62
63
  */
63
64
  readonly resolveExistingEnumValues?: (schema: SqlSchemaIR, enumType: PostgresEnumStorageEntry, namespaceId: string) => readonly string[] | null;
65
+ /**
66
+ * Target-supplied compatible-shape relation for `external` column type checks.
67
+ * Defaults to exact string equality when omitted.
68
+ */
69
+ readonly columnsCompatible?: ColumnsCompatible;
64
70
  }
65
71
  /**
66
72
  * Verifies that a SqlSchemaIR matches a Contract.
@@ -74,5 +80,5 @@ interface VerifySqlSchemaOptions {
74
80
  */
75
81
  declare function verifySqlSchema(options: VerifySqlSchemaOptions): VerifyDatabaseSchemaResult;
76
82
  //#endregion
77
- export { verifySqlSchema as i, NativeTypeNormalizer as n, VerifySqlSchemaOptions as r, DefaultNormalizer as t };
78
- //# sourceMappingURL=verify-sql-schema-CN7pPoTC.d.mts.map
83
+ export { verifySqlSchema as a, VerifySqlSchemaOptions as i, DefaultNormalizer as n, NativeTypeNormalizer as r, ColumnsCompatible as t };
84
+ //# sourceMappingURL=verify-sql-schema-Cj3c2t5Z.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify-sql-schema-Cj3c2t5Z.d.mts","names":[],"sources":["../src/core/schema-verify/verify-sql-schema.ts"],"mappings":";;;;;;;KA4CY,iBAAA,IAAqB,QAAA,UAAkB,IAAY;;;;;KAMnD,iBAAA,IACV,UAAA,UACA,UAAA,aACG,aAAa;;;AAAA;AAOlB;;KAAY,oBAAA,IAAwB,UAAkB;;AAAA;AAKtD;UAAiB,sBAAA;;WAEN,QAAA,EAAU,QAAA,CAAS,UAAA;EAAT;EAAA,SAEV,MAAA,EAAQ,WAAA;EAIE;EAAA,SAFV,MAAA;EASmC;EAAA,SAPnC,OAAA,GAAU,gBAAA;EAaS;EAAA,SAXnB,oBAAA,EAAsB,WAAA;IAAsB,UAAA;EAAA;EAsCxB;;;;EAAA,SAjCpB,mBAAA,EAAqB,aAAA,CAAc,8BAAA;EAbhB;;;;;EAAA,SAmBnB,gBAAA,GAAmB,iBAAA;EAXnB;;;;;EAAA,SAiBA,mBAAA,GAAsB,oBAAA;EANtB;;;;;;;;;;;EAAA,SAkBA,yBAAA,IACP,MAAA,EAAQ,WAAA,EACR,QAAA,EAAU,wBAAA,EACV,WAAA;EAM4C;AAAA;AAahD;;EAbgD,SAArC,iBAAA,GAAoB,iBAAA;AAAA;;;;;AAa6D;;;;;;iBAA5E,eAAA,CAAgB,OAAA,EAAS,sBAAA,GAAyB,0BAA0B"}