@prisma-next/family-sql 0.12.0-dev.16 → 0.12.0-dev.2

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.
@@ -1,4 +1,4 @@
1
- import { T as SqlPlanTargetDetails, p as SqlMigrationPlanOperation } from "./types-UK6xRk8i.mjs";
1
+ import { T as SqlPlanTargetDetails, p as SqlMigrationPlanOperation } from "./types-CeeCStqw.mjs";
2
2
  import { Migration } from "@prisma-next/migration-tools/migration";
3
3
 
4
4
  //#region src/core/sql-migration.d.ts
@@ -1,6 +1,4 @@
1
1
  import { RuntimeMutationDefaultGenerator } from "@prisma-next/sql-runtime";
2
- import { ResolvedDomainModel, UNBOUND_DOMAIN_NAMESPACE_ID, resolveDomainModel } from "@prisma-next/contract/types";
3
- import { ResolvedStorageTable, resolveStorageTable } from "@prisma-next/sql-contract/resolve-storage-table";
4
2
  import { RuntimeFamilyDescriptor, RuntimeFamilyInstance } from "@prisma-next/framework-components/execution";
5
3
 
6
4
  //#region src/core/runtime-instance.d.ts
@@ -42,5 +40,5 @@ declare const sqlRuntimeFamilyDescriptor: RuntimeFamilyDescriptor<'sql', SqlRunt
42
40
  */
43
41
  declare function timestampNowRuntimeGenerator(): RuntimeMutationDefaultGenerator;
44
42
  //#endregion
45
- export { type ResolvedDomainModel, type ResolvedStorageTable, UNBOUND_DOMAIN_NAMESPACE_ID, sqlRuntimeFamilyDescriptor as default, resolveDomainModel, resolveStorageTable, timestampNowRuntimeGenerator };
43
+ export { sqlRuntimeFamilyDescriptor as default, timestampNowRuntimeGenerator };
46
44
  //# 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;;;UAAiB,wBAAA,SAAiC,qBAAqB;;;;;;;AAAvE;;;;cCCa,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;;;;AAAuE;UAAtD,wBAAA,SAAiC,qBAAqB;;;;;AAAvE;;;;AAAuE;;cCC1D,0BAAA,EAA4B,uBAAuB,QAAQ,wBAAA;;;;;;ADDxE;;;;AAAuE;;;;ACCvE;;;iBCMgB,4BAAA,CAAA,GAAgC,+BAA+B"}
package/dist/runtime.mjs CHANGED
@@ -1,6 +1,4 @@
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";
4
2
  //#region src/core/runtime-instance.ts
5
3
  /**
6
4
  * Creates a SQL execution-plane family instance.
@@ -57,6 +55,6 @@ function timestampNowRuntimeGenerator() {
57
55
  //#region src/exports/runtime.ts
58
56
  var runtime_default = sqlRuntimeFamilyDescriptor;
59
57
  //#endregion
60
- export { UNBOUND_DOMAIN_NAMESPACE_ID, runtime_default as default, resolveDomainModel, resolveStorageTable, timestampNowRuntimeGenerator };
58
+ export { runtime_default as default, timestampNowRuntimeGenerator };
61
59
 
62
60
  //# 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 {\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
+ {"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,14 +1,12 @@
1
- import { t as SqlControlAdapter } from "./control-adapter-BUxGX6zz.mjs";
2
1
  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";
3
2
  import { SqlStorage, StorageColumn, StorageTable, StorageTypeInstance } from "@prisma-next/sql-contract/types";
4
3
  import { PslDocumentAst } from "@prisma-next/framework-components/psl-ast";
5
4
  import { Result } from "@prisma-next/utils/result";
6
5
  import { Contract } from "@prisma-next/contract/types";
7
- import { AnyQueryAst, DdlNode, LoweredStatement, LowererContext } from "@prisma-next/sql-relational-core/ast";
6
+ import { AnyQueryAst, LoweredStatement, LowererContext } from "@prisma-next/sql-relational-core/ast";
8
7
  import { SqlSchemaIR } from "@prisma-next/sql-schema-ir/types";
9
8
  import { TargetBoundComponentDescriptor } from "@prisma-next/framework-components/components";
10
9
  import { TypesImportSpec } from "@prisma-next/framework-components/emission";
11
- import { AggregateMigrationEdgeRef } from "@prisma-next/migration-tools/aggregate";
12
10
  import { SqlOperationDescriptors } from "@prisma-next/sql-operations";
13
11
 
14
12
  //#region src/core/control-instance.d.ts
@@ -68,9 +66,7 @@ interface SqlControlFamilyInstance extends ControlFamilyInstance<'sql', SqlSchem
68
66
  readonly contract?: unknown;
69
67
  }): Promise<SqlSchemaIR>;
70
68
  inferPslContract(schemaIR: SqlSchemaIR): PslDocumentAst;
71
- lowerAst(ast: AnyQueryAst | DdlNode, context: LowererContext<unknown>): LoweredStatement;
72
- bootstrapControlTableQueries(): readonly DdlNode[];
73
- bootstrapSignMarkerQueries(): readonly DdlNode[];
69
+ lowerAst(ast: AnyQueryAst, context: LowererContext<unknown>): LoweredStatement;
74
70
  toOperationPreview(operations: readonly MigrationPlanOperation[]): OperationPreview;
75
71
  }
76
72
  //#endregion
@@ -206,7 +202,7 @@ interface SqlControlExtensionDescriptor<TTargetId extends string> extends Contro
206
202
  */
207
203
  readonly contractSpace?: ContractSpace<Contract<SqlStorage>>;
208
204
  }
209
- interface SqlControlAdapterDescriptor<TTargetId extends string> extends ControlAdapterDescriptor<'sql', TTargetId, SqlControlAdapter<TTargetId>> {
205
+ interface SqlControlAdapterDescriptor<TTargetId extends string> extends ControlAdapterDescriptor<'sql', TTargetId> {
210
206
  readonly queryOperations?: () => SqlOperationDescriptors;
211
207
  }
212
208
  interface SqlMigrationPlanOperationStep {
@@ -391,11 +387,6 @@ interface SqlMigrationRunnerExecuteOptions<TTargetDetails> {
391
387
  * All components must have matching familyId ('sql') and targetId.
392
388
  */
393
389
  readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;
394
- /**
395
- * Per-edge breakdown from graph-walk planning. When present, the runner
396
- * writes one ledger row per edge instead of one collapsed row per apply.
397
- */
398
- readonly migrationEdges: readonly AggregateMigrationEdgeRef[];
399
390
  }
400
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';
401
392
  interface SqlMigrationRunnerFailure extends MigrationRunnerFailure {
@@ -472,4 +463,4 @@ interface CreateSqlMigrationPlanOptions<TTargetDetails> {
472
463
  }
473
464
  //#endregion
474
465
  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 };
475
- //# sourceMappingURL=types-UK6xRk8i.d.mts.map
466
+ //# sourceMappingURL=types-CeeCStqw.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-CeeCStqw.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,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AA,SAyOb,kBAAA;EAAA,SACA,IAAA,GAAO,SAAA;AAAA"}
package/package.json CHANGED
@@ -1,34 +1,34 @@
1
1
  {
2
2
  "name": "@prisma-next/family-sql",
3
- "version": "0.12.0-dev.16",
3
+ "version": "0.12.0-dev.2",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "description": "SQL family descriptor for Prisma Next",
8
8
  "dependencies": {
9
- "@prisma-next/contract": "0.12.0-dev.16",
10
- "@prisma-next/emitter": "0.12.0-dev.16",
11
- "@prisma-next/framework-components": "0.12.0-dev.16",
12
- "@prisma-next/migration-tools": "0.12.0-dev.16",
13
- "@prisma-next/operations": "0.12.0-dev.16",
14
- "@prisma-next/sql-contract": "0.12.0-dev.16",
15
- "@prisma-next/sql-contract-emitter": "0.12.0-dev.16",
16
- "@prisma-next/sql-contract-ts": "0.12.0-dev.16",
17
- "@prisma-next/sql-operations": "0.12.0-dev.16",
18
- "@prisma-next/sql-relational-core": "0.12.0-dev.16",
19
- "@prisma-next/sql-runtime": "0.12.0-dev.16",
20
- "@prisma-next/sql-schema-ir": "0.12.0-dev.16",
21
- "@prisma-next/utils": "0.12.0-dev.16",
9
+ "@prisma-next/contract": "0.12.0-dev.2",
10
+ "@prisma-next/emitter": "0.12.0-dev.2",
11
+ "@prisma-next/framework-components": "0.12.0-dev.2",
12
+ "@prisma-next/migration-tools": "0.12.0-dev.2",
13
+ "@prisma-next/operations": "0.12.0-dev.2",
14
+ "@prisma-next/sql-contract": "0.12.0-dev.2",
15
+ "@prisma-next/sql-contract-emitter": "0.12.0-dev.2",
16
+ "@prisma-next/sql-contract-ts": "0.12.0-dev.2",
17
+ "@prisma-next/sql-operations": "0.12.0-dev.2",
18
+ "@prisma-next/sql-relational-core": "0.12.0-dev.2",
19
+ "@prisma-next/sql-runtime": "0.12.0-dev.2",
20
+ "@prisma-next/sql-schema-ir": "0.12.0-dev.2",
21
+ "@prisma-next/utils": "0.12.0-dev.2",
22
22
  "arktype": "^2.2.0"
23
23
  },
24
24
  "devDependencies": {
25
- "@prisma-next/driver-postgres": "0.12.0-dev.16",
26
- "@prisma-next/psl-parser": "0.12.0-dev.16",
27
- "@prisma-next/psl-printer": "0.12.0-dev.16",
28
- "@prisma-next/sql-contract-psl": "0.12.0-dev.16",
29
- "@prisma-next/test-utils": "0.12.0-dev.16",
30
- "@prisma-next/tsconfig": "0.12.0-dev.16",
31
- "@prisma-next/tsdown": "0.12.0-dev.16",
25
+ "@prisma-next/driver-postgres": "0.12.0-dev.2",
26
+ "@prisma-next/psl-parser": "0.12.0-dev.2",
27
+ "@prisma-next/psl-printer": "0.12.0-dev.2",
28
+ "@prisma-next/sql-contract-psl": "0.12.0-dev.2",
29
+ "@prisma-next/test-utils": "0.12.0-dev.2",
30
+ "@prisma-next/tsconfig": "0.12.0-dev.2",
31
+ "@prisma-next/tsdown": "0.12.0-dev.2",
32
32
  "tsdown": "0.22.0",
33
33
  "typescript": "5.9.3",
34
34
  "vitest": "4.1.6"
@@ -1,8 +1,4 @@
1
- import type {
2
- Contract,
3
- ContractMarkerRecord,
4
- LedgerEntryRecord,
5
- } from '@prisma-next/contract/types';
1
+ import type { Contract, ContractMarkerRecord } from '@prisma-next/contract/types';
6
2
  import type {
7
3
  ControlAdapterInstance,
8
4
  ControlDriverInstance,
@@ -11,7 +7,6 @@ import type {
11
7
  import type { PostgresEnumStorageEntry, SqlStorage } from '@prisma-next/sql-contract/types';
12
8
  import type {
13
9
  AnyQueryAst,
14
- DdlNode,
15
10
  LoweredStatement,
16
11
  LowererContext,
17
12
  } from '@prisma-next/sql-relational-core/ast';
@@ -57,16 +52,6 @@ export interface SqlControlAdapter<TTarget extends string = string>
57
52
  driver: ControlDriverInstance<'sql', TTarget>,
58
53
  ): Promise<ReadonlyMap<string, ContractMarkerRecord>>;
59
54
 
60
- /**
61
- * Reads the per-migration ledger journal for `space` in apply order.
62
- * Returns an empty array when the ledger store does not yet exist or
63
- * has no rows for that space.
64
- */
65
- readLedger(
66
- driver: ControlDriverInstance<'sql', TTarget>,
67
- space: string,
68
- ): Promise<readonly LedgerEntryRecord[]>;
69
-
70
55
  /**
71
56
  * Introspects a database schema and returns a raw SqlSchemaIR.
72
57
  *
@@ -126,18 +111,6 @@ export interface SqlControlAdapter<TTarget extends string = string>
126
111
  namespaceId: string,
127
112
  ) => readonly string[] | null;
128
113
 
129
- /**
130
- * Ordered DDL queries that bootstrap marker/ledger control tables for migration
131
- * runners. Postgres includes `CREATE SCHEMA`; SQLite does not.
132
- */
133
- bootstrapControlTableQueries(): readonly DdlNode[];
134
-
135
- /**
136
- * Ordered DDL queries that bootstrap the marker table (and Postgres schema) for
137
- * `sign` — excludes the ledger table.
138
- */
139
- bootstrapSignMarkerQueries(): readonly DdlNode[];
140
-
141
114
  /**
142
115
  * Lower a SQL query AST into a target-flavored `{ sql, params }` payload.
143
116
  *
@@ -147,7 +120,7 @@ export interface SqlControlAdapter<TTarget extends string = string>
147
120
  * same AST and contract, ensuring planned SQL matches what the runtime would
148
121
  * emit.
149
122
  */
150
- lower(ast: AnyQueryAst | DdlNode, context: LowererContext<unknown>): LoweredStatement;
123
+ lower(ast: AnyQueryAst, context: LowererContext<unknown>): LoweredStatement;
151
124
  }
152
125
 
153
126
  /**
@@ -1,8 +1,4 @@
1
- import type {
2
- Contract,
3
- ContractMarkerRecord,
4
- LedgerEntryRecord,
5
- } from '@prisma-next/contract/types';
1
+ import type { Contract, ContractMarkerRecord } from '@prisma-next/contract/types';
6
2
  import type {
7
3
  TargetBoundComponentDescriptor,
8
4
  TargetDescriptor,
@@ -35,11 +31,14 @@ import { sqlContractCanonicalizationHooks } from '@prisma-next/sql-contract/cano
35
31
  import type { SqlStorage } from '@prisma-next/sql-contract/types';
36
32
  import type {
37
33
  AnyQueryAst,
38
- DdlNode,
39
34
  LoweredStatement,
40
35
  LowererContext,
41
36
  } from '@prisma-next/sql-relational-core/ast';
42
- import { writeContractMarker } from '@prisma-next/sql-runtime';
37
+ import {
38
+ ensureSchemaStatement,
39
+ ensureTableStatement,
40
+ writeContractMarker,
41
+ } from '@prisma-next/sql-runtime';
43
42
  import { defaultIndexName } from '@prisma-next/sql-schema-ir/naming';
44
43
  import type { SqlSchemaIR, SqlTableIR } from '@prisma-next/sql-schema-ir/types';
45
44
  import { ifDefined } from '@prisma-next/utils/defined';
@@ -242,17 +241,30 @@ export interface SqlControlFamilyInstance
242
241
 
243
242
  inferPslContract(schemaIR: SqlSchemaIR): PslDocumentAst;
244
243
 
245
- lowerAst(ast: AnyQueryAst | DdlNode, context: LowererContext<unknown>): LoweredStatement;
246
-
247
- bootstrapControlTableQueries(): readonly DdlNode[];
248
-
249
- bootstrapSignMarkerQueries(): readonly DdlNode[];
244
+ lowerAst(ast: AnyQueryAst, context: LowererContext<unknown>): LoweredStatement;
250
245
 
251
246
  toOperationPreview(operations: readonly MigrationPlanOperation[]): OperationPreview;
252
247
  }
253
248
 
254
249
  export type SqlFamilyInstance = SqlControlFamilyInstance;
255
250
 
251
+ function isSqlControlAdapter<TTargetId extends string>(
252
+ value: unknown,
253
+ ): value is SqlControlAdapter<TTargetId> {
254
+ return (
255
+ typeof value === 'object' &&
256
+ value !== null &&
257
+ 'introspect' in value &&
258
+ typeof (value as { introspect: unknown }).introspect === 'function' &&
259
+ 'readMarker' in value &&
260
+ typeof (value as { readMarker: unknown }).readMarker === 'function' &&
261
+ 'readAllMarkers' in value &&
262
+ typeof (value as { readAllMarkers: unknown }).readAllMarkers === 'function' &&
263
+ 'lower' in value &&
264
+ typeof (value as { lower: unknown }).lower === 'function'
265
+ );
266
+ }
267
+
256
268
  interface DescriptorWithStorageTypes {
257
269
  readonly targetId?: string | undefined;
258
270
  readonly types?:
@@ -349,11 +361,19 @@ export function createSqlFamilyInstance<TTargetId extends string>(
349
361
  extensionPacks: extensions,
350
362
  });
351
363
 
352
- // Family-instance methods accept `ControlDriverInstance<'sql', string>` — the
353
- // family API isn't generic on the target id. The adapter descriptor's `create`
354
- // returns the concrete `SqlControlAdapter<TTargetId>`; widening the target id to
355
- // `string` here matches the family-level driver type without a per-method probe.
356
- const getControlAdapter = (): SqlControlAdapter<string> => adapter.create(stack);
364
+ // Family-instance methods accept `ControlDriverInstance<'sql', string>` —
365
+ // the family API isn't generic on the target id. Letting `isSqlControlAdapter`
366
+ // default its type parameter narrows the adapter to `SqlControlAdapter<string>`,
367
+ // which matches the family-level driver type without any cast at call sites.
368
+ const getControlAdapter = () => {
369
+ const controlAdapter = adapter.create(stack);
370
+ if (!isSqlControlAdapter(controlAdapter)) {
371
+ throw new Error(
372
+ 'Adapter does not implement SqlControlAdapter (missing introspect, readMarker, or readAllMarkers)',
373
+ );
374
+ }
375
+ return controlAdapter;
376
+ };
357
377
 
358
378
  const targetSerializer = (
359
379
  target as unknown as {
@@ -541,14 +561,10 @@ export function createSqlFamilyInstance<TTargetId extends string>(
541
561
  : contractStorageHash;
542
562
  const contractTarget = contract.target;
543
563
 
544
- const controlAdapter = getControlAdapter();
545
- const lowererContext = { contract };
546
- for (const query of controlAdapter.bootstrapSignMarkerQueries()) {
547
- const lowered = controlAdapter.lower(query, lowererContext);
548
- await driver.query(lowered.sql, lowered.params);
549
- }
564
+ await driver.query(ensureSchemaStatement.sql, ensureSchemaStatement.params);
565
+ await driver.query(ensureTableStatement.sql, ensureTableStatement.params);
550
566
 
551
- const existingMarker = await controlAdapter.readMarker(driver, APP_SPACE_ID);
567
+ const existingMarker = await getControlAdapter().readMarker(driver, APP_SPACE_ID);
552
568
 
553
569
  let markerCreated = false;
554
570
  let markerUpdated = false;
@@ -635,12 +651,6 @@ export function createSqlFamilyInstance<TTargetId extends string>(
635
651
  }): Promise<ReadonlyMap<string, ContractMarkerRecord>> {
636
652
  return getControlAdapter().readAllMarkers(options.driver);
637
653
  },
638
- async readLedger(options: {
639
- readonly driver: ControlDriverInstance<'sql', string>;
640
- readonly space: string;
641
- }): Promise<readonly LedgerEntryRecord[]> {
642
- return getControlAdapter().readLedger(options.driver, options.space);
643
- },
644
654
  async introspect(options: {
645
655
  readonly driver: ControlDriverInstance<'sql', string>;
646
656
  readonly contract?: unknown;
@@ -652,18 +662,10 @@ export function createSqlFamilyInstance<TTargetId extends string>(
652
662
  return sqlSchemaIrToPslAst(schemaIR);
653
663
  },
654
664
 
655
- lowerAst(ast: AnyQueryAst | DdlNode, context: LowererContext<unknown>): LoweredStatement {
665
+ lowerAst(ast: AnyQueryAst, context: LowererContext<unknown>): LoweredStatement {
656
666
  return getControlAdapter().lower(ast, context);
657
667
  },
658
668
 
659
- bootstrapControlTableQueries(): readonly DdlNode[] {
660
- return getControlAdapter().bootstrapControlTableQueries();
661
- },
662
-
663
- bootstrapSignMarkerQueries(): readonly DdlNode[] {
664
- return getControlAdapter().bootstrapSignMarkerQueries();
665
- },
666
-
667
669
  toOperationPreview(operations: readonly MigrationPlanOperation[]): OperationPreview {
668
670
  return sqlOperationsToPreview(operations);
669
671
  },
@@ -22,7 +22,6 @@ import type {
22
22
  SchemaIssue,
23
23
  SchemaVerifier,
24
24
  } from '@prisma-next/framework-components/control';
25
- import type { AggregateMigrationEdgeRef } from '@prisma-next/migration-tools/aggregate';
26
25
  import type {
27
26
  SqlStorage,
28
27
  StorageColumn,
@@ -32,7 +31,6 @@ import type {
32
31
  import type { SqlOperationDescriptors } from '@prisma-next/sql-operations';
33
32
  import type { SqlSchemaIR } from '@prisma-next/sql-schema-ir/types';
34
33
  import type { Result } from '@prisma-next/utils/result';
35
- import type { SqlControlAdapter } from '../control-adapter';
36
34
  import type { SqlControlFamilyInstance } from '../control-instance';
37
35
 
38
36
  export type AnyRecord = Readonly<Record<string, unknown>>;
@@ -176,7 +174,7 @@ export interface SqlControlExtensionDescriptor<TTargetId extends string>
176
174
  }
177
175
 
178
176
  export interface SqlControlAdapterDescriptor<TTargetId extends string>
179
- extends ControlAdapterDescriptor<'sql', TTargetId, SqlControlAdapter<TTargetId>> {
177
+ extends ControlAdapterDescriptor<'sql', TTargetId> {
180
178
  readonly queryOperations?: () => SqlOperationDescriptors;
181
179
  }
182
180
 
@@ -386,11 +384,6 @@ export interface SqlMigrationRunnerExecuteOptions<TTargetDetails> {
386
384
  * All components must have matching familyId ('sql') and targetId.
387
385
  */
388
386
  readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;
389
- /**
390
- * Per-edge breakdown from graph-walk planning. When present, the runner
391
- * writes one ledger row per edge instead of one collapsed row per apply.
392
- */
393
- readonly migrationEdges: readonly AggregateMigrationEdgeRef[];
394
387
  }
395
388
 
396
389
  export type SqlMigrationRunnerErrorCode =
@@ -1,12 +1,5 @@
1
1
  import { sqlRuntimeFamilyDescriptor } from '../core/runtime-descriptor';
2
2
 
3
- export {
4
- type ResolvedDomainModel,
5
- type ResolvedStorageTable,
6
- resolveDomainModel,
7
- resolveStorageTable,
8
- UNBOUND_DOMAIN_NAMESPACE_ID,
9
- } from '../core/default-namespace';
10
3
  export { timestampNowRuntimeGenerator } from '../core/timestamp-now-runtime-generator';
11
4
 
12
5
  export default sqlRuntimeFamilyDescriptor;
@@ -1,125 +0,0 @@
1
- import { n as NativeTypeNormalizer, t as DefaultNormalizer } from "./verify-sql-schema-CN7pPoTC.mjs";
2
- import { ControlAdapterInstance, ControlDriverInstance, ControlStack } from "@prisma-next/framework-components/control";
3
- import { PostgresEnumStorageEntry, SqlStorage } from "@prisma-next/sql-contract/types";
4
- import { Contract, ContractMarkerRecord, LedgerEntryRecord } from "@prisma-next/contract/types";
5
- import { AnyQueryAst, DdlNode, LoweredStatement, LowererContext } from "@prisma-next/sql-relational-core/ast";
6
- import { SqlSchemaIR } from "@prisma-next/sql-schema-ir/types";
7
-
8
- //#region src/core/control-adapter.d.ts
9
- /**
10
- * SQL control adapter interface for control-plane operations.
11
- * Implemented by target-specific adapters (e.g., Postgres, MySQL).
12
- *
13
- * @template TTarget - The target ID (e.g., 'postgres', 'mysql')
14
- */
15
- interface SqlControlAdapter<TTarget extends string = string> extends ControlAdapterInstance<'sql', TTarget> {
16
- /**
17
- * Reads the contract marker for `space` from the database, returning
18
- * `null` if no marker row exists for that space (or if the marker
19
- * table itself is missing). Implementations are responsible for the
20
- * dialect-specific existence probe (e.g. Postgres
21
- * `information_schema.tables` vs SQLite `sqlite_master`) and parameter
22
- * placeholders.
23
- *
24
- * `space` is required so callers cannot accidentally fall through to
25
- * the app's marker row when reading per-extension markers.
26
- *
27
- * @param driver - ControlDriverInstance for executing queries (target-specific)
28
- * @param space - Contract space id whose marker row to read (e.g. `'app'`)
29
- * @returns Resolved marker record, or `null` if not yet stamped.
30
- */
31
- readMarker(driver: ControlDriverInstance<'sql', TTarget>, space: string): Promise<ContractMarkerRecord | null>;
32
- /**
33
- * Reads every marker row from `prisma_contract.marker` (one per
34
- * contract space) and returns them keyed by `space`. Used by the
35
- * per-space verifier to detect marker-vs-on-disk drift and orphan
36
- * marker rows. Returns an empty map when the marker table does not
37
- * yet exist (fresh database / never-signed project).
38
- */
39
- readAllMarkers(driver: ControlDriverInstance<'sql', TTarget>): Promise<ReadonlyMap<string, ContractMarkerRecord>>;
40
- /**
41
- * Reads the per-migration ledger journal for `space` in apply order.
42
- * Returns an empty array when the ledger store does not yet exist or
43
- * has no rows for that space.
44
- */
45
- readLedger(driver: ControlDriverInstance<'sql', TTarget>, space: string): Promise<readonly LedgerEntryRecord[]>;
46
- /**
47
- * Introspects a database schema and returns a raw SqlSchemaIR.
48
- *
49
- * This is a pure schema discovery operation that queries the database catalog
50
- * and returns the schema structure without type mapping or contract enrichment.
51
- * Type mapping and enrichment are handled separately by enrichment helpers.
52
- *
53
- * @param driver - ControlDriverInstance instance for executing queries (target-specific)
54
- * @param contract - Optional contract for contract-guided introspection (filtering, optimization)
55
- * @param schema - Schema name to introspect (defaults to 'public')
56
- * @returns Promise resolving to SqlSchemaIR representing the live database schema
57
- */
58
- introspect(driver: ControlDriverInstance<'sql', TTarget>, contract?: unknown, schema?: string): Promise<SqlSchemaIR>;
59
- /**
60
- * Optional target-specific normalizer for raw database default expressions.
61
- * When provided, schema defaults (raw strings) are normalized before comparison
62
- * with contract defaults (ColumnDefault objects) during schema verification.
63
- */
64
- readonly normalizeDefault?: DefaultNormalizer;
65
- /**
66
- * Optional target-specific normalizer for schema native type names.
67
- * When provided, schema native types (from introspection) are normalized
68
- * before comparison with contract native types during schema verification.
69
- */
70
- readonly normalizeNativeType?: NativeTypeNormalizer;
71
- /**
72
- * Optional bridging adapter for resolving the existing values of a
73
- * native enum type from the introspected schema IR. Targets supply
74
- * this so the family-level schema verifier can walk
75
- * `PostgresEnumStorageEntry` entries natively without needing to
76
- * know the target-specific `schema.annotations` shape
77
- * (e.g. `schema.annotations.pg.storageTypes`).
78
- */
79
- readonly resolveExistingEnumValues?: (schema: SqlSchemaIR, enumType: PostgresEnumStorageEntry, namespaceId: string) => readonly string[] | null;
80
- /**
81
- * Optional contract-scoped factory for {@link resolveExistingEnumValues}.
82
- * Targets that need the contract storage to resolve namespace → DDL schema
83
- * supply this; the family control instance prefers it over the bare adapter
84
- * hook when present.
85
- */
86
- readonly resolveExistingEnumValuesForContract?: (contract: Contract<SqlStorage>) => (schema: SqlSchemaIR, enumType: PostgresEnumStorageEntry, namespaceId: string) => readonly string[] | null;
87
- /**
88
- * Ordered DDL queries that bootstrap marker/ledger control tables for migration
89
- * runners. Postgres includes `CREATE SCHEMA`; SQLite does not.
90
- */
91
- bootstrapControlTableQueries(): readonly DdlNode[];
92
- /**
93
- * Ordered DDL queries that bootstrap the marker table (and Postgres schema) for
94
- * `sign` — excludes the ledger table.
95
- */
96
- bootstrapSignMarkerQueries(): readonly DdlNode[];
97
- /**
98
- * Lower a SQL query AST into a target-flavored `{ sql, params }` payload.
99
- *
100
- * Migration tooling (e.g. the `dataTransform` operation) needs to materialize
101
- * SQL at emit/plan time without instantiating the runtime adapter. The control
102
- * adapter's `lower` is byte-equivalent to the runtime adapter's `lower` for the
103
- * same AST and contract, ensuring planned SQL matches what the runtime would
104
- * emit.
105
- */
106
- lower(ast: AnyQueryAst | DdlNode, context: LowererContext<unknown>): LoweredStatement;
107
- }
108
- /**
109
- * SQL control adapter descriptor interface.
110
- * Provides a factory method to create control adapter instances.
111
- *
112
- * @template TTarget - The target ID (e.g., 'postgres', 'mysql')
113
- */
114
- interface SqlControlAdapterDescriptor<TTarget extends string = string> {
115
- /**
116
- * Creates a SQL control adapter instance for control-plane operations.
117
- *
118
- * Receives the assembled `ControlStack` so adapters can read aggregated
119
- * metadata (codec lookup, extension contributions) when materializing.
120
- */
121
- create(stack: ControlStack<'sql', TTarget>): SqlControlAdapter<TTarget>;
122
- }
123
- //#endregion
124
- export { SqlControlAdapterDescriptor as n, SqlControlAdapter as t };
125
- //# sourceMappingURL=control-adapter-BUxGX6zz.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"control-adapter-BUxGX6zz.d.mts","names":[],"sources":["../src/core/control-adapter.ts"],"mappings":";;;;;;;;;;AA0BA;;;;UAAiB,iBAAA,0CACP,sBAAA,QAA8B,OAAA;EAiB5B;;;;;;;;;;;;;;;EADV,UAAA,CACE,MAAA,EAAQ,qBAAA,QAA6B,OAAA,GACrC,KAAA,WACC,OAAA,CAAQ,oBAAA;EA8CiB;;;;;;;EArC5B,cAAA,CACE,MAAA,EAAQ,qBAAA,QAA6B,OAAA,IACpC,OAAA,CAAQ,WAAA,SAAoB,oBAAA;EA2EU;;;;;EApEzC,UAAA,CACE,MAAA,EAAQ,qBAAA,QAA6B,OAAA,GACrC,KAAA,WACC,OAAA,UAAiB,iBAAA;EAxCZ;;;;;;;;;;;;EAsDR,UAAA,CACE,MAAA,EAAQ,qBAAA,QAA6B,OAAA,GACrC,QAAA,YACA,MAAA,YACC,OAAA,CAAQ,WAAA;EA9BX;;;;;EAAA,SAqCS,gBAAA,GAAmB,iBAAA;EAnCG;;;;;EAAA,SA0CtB,mBAAA,GAAsB,oBAAA;EAhC5B;;;;;;;;EAAA,SA0CM,yBAAA,IACP,MAAA,EAAQ,WAAA,EACR,QAAA,EAAU,wBAAA,EACV,WAAA;EA3BS;;;;;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IAAA,SACG,MAAA,EAAQ,qBAAA;IAAA,SACR,eAAA,EAAiB,aAAA,CAAc,gCAAA,CAAiC,cAAA;EAAA,IACvE,OAAA,CAAQ,qBAAA;EA3NqC;;;;;;;;;;EAuOjD,mBAAA,CACE,OAAA,EAAS,gCAAA,CAAiC,cAAA,IACzC,OAAA,CAAQ,wBAAA;AAAA;AAAA,UAGI,0BAAA,6DAGG,QAAA,CAAS,UAAA,IAAc,QAAA,CAAS,UAAA,WAC1C,0BAAA,QAAkC,SAAA,EAAW,wBAAA;EAAA,SAC5C,eAAA,SAAwB,uBAAA;EAjPgB;;;;;;EAAA,SAwPxC,kBAAA,EAAoB,kBAAA,CAAmB,SAAA;EApPvC;;;AAAgB;AAG3B;;EAHW,SA2PA,cAAA,EAAgB,cAAA,CAAe,SAAA,EAAW,WAAA;EACnD,aAAA,CAAc,MAAA,EAAQ,wBAAA,GAA2B,mBAAA,CAAoB,cAAA;EACrE,YAAA,CAAa,MAAA,EAAQ,wBAAA,GAA2B,kBAAA,CAAmB,cAAA;AAAA;AAAA,UAGpD,6BAAA;EAAA,SACN,QAAA;EArOS;;;EAAA,SAyOT,OAAA;EAAA,SACA,MAAA,GAAS,4BAAA;EAAA,SACT,WAAA,EAAa,4BAAA;EAAA,SACb,UAAA,WAAqB,yBAAA,CAA0B,cAAA;EAhQa;;;;;EAAA,SAsQ5D,kBAAA;EAAA,SACA,IAAA,GAAO,SAAA;AAAA"}
@@ -1,9 +0,0 @@
1
- export {
2
- type ResolvedDomainModel,
3
- resolveDomainModel,
4
- UNBOUND_DOMAIN_NAMESPACE_ID,
5
- } from '@prisma-next/contract/types';
6
- export {
7
- type ResolvedStorageTable,
8
- resolveStorageTable,
9
- } from '@prisma-next/sql-contract/resolve-storage-table';