@prisma-next/family-sql 0.13.0-dev.15 → 0.13.0-dev.16
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/dist/{control-adapter-CgIL9Vtx.d.mts → control-adapter-B_s-UMXg.d.mts} +13 -14
- package/dist/control-adapter-B_s-UMXg.d.mts.map +1 -0
- package/dist/control-adapter.d.mts +2 -2
- package/dist/control.d.mts +1 -1
- package/dist/control.mjs +2 -2
- package/dist/control.mjs.map +1 -1
- package/dist/migration.d.mts +1 -1
- package/dist/migration.d.mts.map +1 -1
- package/dist/migration.mjs +2 -1
- package/dist/migration.mjs.map +1 -1
- package/dist/{types-CbwQCzXY.d.mts → types-BR5vHjvX.d.mts} +5 -5
- package/dist/types-BR5vHjvX.d.mts.map +1 -0
- package/package.json +21 -21
- package/src/core/control-adapter.ts +16 -12
- package/src/core/control-instance.ts +11 -5
- package/src/core/migrations/types.ts +4 -1
- package/src/core/sql-migration.ts +5 -1
- package/src/exports/control-adapter.ts +1 -0
- package/dist/control-adapter-CgIL9Vtx.d.mts.map +0 -1
- package/dist/types-CbwQCzXY.d.mts.map +0 -1
|
@@ -2,7 +2,7 @@ import { n as NativeTypeNormalizer, t as DefaultNormalizer } from "./verify-sql-
|
|
|
2
2
|
import { ControlAdapterInstance, ControlStack } from "@prisma-next/framework-components/control";
|
|
3
3
|
import { PostgresEnumStorageEntry, SqlControlDriverInstance, SqlStorage } from "@prisma-next/sql-contract/types";
|
|
4
4
|
import { Contract, ContractMarkerRecord, LedgerEntryRecord } from "@prisma-next/contract/types";
|
|
5
|
-
import { AnyQueryAst, DdlNode, LoweredStatement, LowererContext } from "@prisma-next/sql-relational-core/ast";
|
|
5
|
+
import { AnyQueryAst, DdlNode, LoweredStatement, LowererContext, SqlExecuteRequest } from "@prisma-next/sql-relational-core/ast";
|
|
6
6
|
import { SqlSchemaIR } from "@prisma-next/sql-schema-ir/types";
|
|
7
7
|
|
|
8
8
|
//#region src/core/control-adapter.d.ts
|
|
@@ -16,13 +16,22 @@ import { SqlSchemaIR } from "@prisma-next/sql-schema-ir/types";
|
|
|
16
16
|
interface Lowerer {
|
|
17
17
|
lower(ast: AnyQueryAst | DdlNode, context: LowererContext<unknown>): LoweredStatement;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Extends {@link Lowerer} with async codec-routed DDL lowering. Control
|
|
21
|
+
* adapters implement this; the planner's `CreateTableCall.toOp` and
|
|
22
|
+
* `CreateSchemaCall.toOp` accept it to produce executable DDL statements
|
|
23
|
+
* with literal defaults encoded through their codec.
|
|
24
|
+
*/
|
|
25
|
+
interface ExecuteRequestLowerer extends Lowerer {
|
|
26
|
+
lowerToExecuteRequest(ast: AnyQueryAst | DdlNode, context?: LowererContext<unknown>): Promise<SqlExecuteRequest>;
|
|
27
|
+
}
|
|
19
28
|
/**
|
|
20
29
|
* SQL control adapter interface for control-plane operations.
|
|
21
30
|
* Implemented by target-specific adapters (e.g., Postgres, MySQL).
|
|
22
31
|
*
|
|
23
32
|
* @template TTarget - The target ID (e.g., 'postgres', 'mysql')
|
|
24
33
|
*/
|
|
25
|
-
interface SqlControlAdapter<TTarget extends string = string> extends ControlAdapterInstance<'sql', TTarget
|
|
34
|
+
interface SqlControlAdapter<TTarget extends string = string> extends ControlAdapterInstance<'sql', TTarget>, ExecuteRequestLowerer {
|
|
26
35
|
/**
|
|
27
36
|
* Reads the contract marker for `space` from the database, returning
|
|
28
37
|
* `null` if no marker row exists for that space (or if the marker
|
|
@@ -151,16 +160,6 @@ interface SqlControlAdapter<TTarget extends string = string> extends ControlAdap
|
|
|
151
160
|
* `sign` — excludes the ledger table.
|
|
152
161
|
*/
|
|
153
162
|
bootstrapSignMarkerQueries(): readonly DdlNode[];
|
|
154
|
-
/**
|
|
155
|
-
* Lower a SQL query AST into a target-flavored `{ sql, params }` payload.
|
|
156
|
-
*
|
|
157
|
-
* Migration tooling (e.g. the `dataTransform` operation) needs to materialize
|
|
158
|
-
* SQL at emit/plan time without instantiating the runtime adapter. The control
|
|
159
|
-
* adapter's `lower` is byte-equivalent to the runtime adapter's `lower` for the
|
|
160
|
-
* same AST and contract, ensuring planned SQL matches what the runtime would
|
|
161
|
-
* emit.
|
|
162
|
-
*/
|
|
163
|
-
lower(ast: AnyQueryAst | DdlNode, context: LowererContext<unknown>): LoweredStatement;
|
|
164
163
|
}
|
|
165
164
|
/**
|
|
166
165
|
* SQL control adapter descriptor interface.
|
|
@@ -178,5 +177,5 @@ interface SqlControlAdapterDescriptor<TTarget extends string = string> {
|
|
|
178
177
|
create(stack: ControlStack<'sql', TTarget>): SqlControlAdapter<TTarget>;
|
|
179
178
|
}
|
|
180
179
|
//#endregion
|
|
181
|
-
export {
|
|
182
|
-
//# sourceMappingURL=control-adapter-
|
|
180
|
+
export { SqlControlAdapterDescriptor as i, Lowerer as n, SqlControlAdapter as r, ExecuteRequestLowerer as t };
|
|
181
|
+
//# sourceMappingURL=control-adapter-B_s-UMXg.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-adapter-B_s-UMXg.d.mts","names":[],"sources":["../src/core/control-adapter.ts"],"mappings":";;;;;;;;;;AA+BA;;;;;UAAiB,OAAA;EACf,KAAA,CAAM,GAAA,EAAK,WAAA,GAAc,OAAA,EAAS,OAAA,EAAS,cAAA,YAA0B,gBAAA;AAAA;;;;;;;UAStD,qBAAA,SAA8B,OAAA;EAC7C,qBAAA,CACE,GAAA,EAAK,WAAA,GAAc,OAAA,EACnB,OAAA,GAAU,cAAA,YACT,OAAA,CAAQ,iBAAA;AAAA;AAb0E;AASvF;;;;;AATuF,UAsBtE,iBAAA,0CACP,sBAAA,QAA8B,OAAA,GACpC,qBAAA;EAXS;;;;;;;;;;;;;;;EA2BX,UAAA,CACE,MAAA,EAAQ,wBAAA,CAAyB,OAAA,GACjC,KAAA,WACC,OAAA,CAAQ,oBAAA;EArBI;;;;;;;EA8Bf,cAAA,CACE,MAAA,EAAQ,wB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B,MAAA,EAAQ,WAAA,EACR,QAAA,EAAU,wBAAA,EACV,WAAA;EA7EC;;;;EAoFH,4BAAA,aAAyC,OAAA;EA1EvC;;;;EAgFF,0BAAA,aAAuC,OAAA;AAAA;;;;;;;UASxB,2BAAA;EAhEb;;;;;;EAuEF,MAAA,CAAO,KAAA,EAAO,YAAA,QAAoB,OAAA,IAAW,iBAAA,CAAkB,OAAA;AAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
export type { Lowerer, SqlControlAdapter, SqlControlAdapterDescriptor };
|
|
1
|
+
import { i as SqlControlAdapterDescriptor, n as Lowerer, r as SqlControlAdapter, t as ExecuteRequestLowerer } from "./control-adapter-B_s-UMXg.mjs";
|
|
2
|
+
export type { ExecuteRequestLowerer, Lowerer, SqlControlAdapter, SqlControlAdapterDescriptor };
|
package/dist/control.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as SqlPlannerResult, C as SqlMigrationRunnerResult, D as SqlPlannerConflictKind, E as SqlPlannerConflict, M as StorageTypePlanResult, N as SqlControlFamilyInstance, O as SqlPlannerConflictLocation, S as SqlMigrationRunnerFailure, T as SqlPlanTargetDetails, _ as SqlMigrationPlannerPlanOptions, a as FieldEvent, b as SqlMigrationRunnerExecuteCallbacks, c as SqlControlAdapterDescriptor, d as SqlMigrationPlan, f as SqlMigrationPlanContractInfo, g as SqlMigrationPlanner, h as SqlMigrationPlanOperationTarget, i as ExpandNativeTypeInput, j as SqlPlannerSuccessResult, k as SqlPlannerFailureResult, l as SqlControlExtensionDescriptor, m as SqlMigrationPlanOperationStep, n as CodecControlHooks, o as FieldEventContext, p as SqlMigrationPlanOperation, r as CreateSqlMigrationPlanOptions, s as ResolveIdentityValueInput, t as AnyRecord, u as SqlControlTargetDescriptor, v as SqlMigrationRunner, w as SqlMigrationRunnerSuccessValue, x as SqlMigrationRunnerExecuteOptions, y as SqlMigrationRunnerErrorCode } from "./types-
|
|
1
|
+
import { A as SqlPlannerResult, C as SqlMigrationRunnerResult, D as SqlPlannerConflictKind, E as SqlPlannerConflict, M as StorageTypePlanResult, N as SqlControlFamilyInstance, O as SqlPlannerConflictLocation, S as SqlMigrationRunnerFailure, T as SqlPlanTargetDetails, _ as SqlMigrationPlannerPlanOptions, a as FieldEvent, b as SqlMigrationRunnerExecuteCallbacks, c as SqlControlAdapterDescriptor, d as SqlMigrationPlan, f as SqlMigrationPlanContractInfo, g as SqlMigrationPlanner, h as SqlMigrationPlanOperationTarget, i as ExpandNativeTypeInput, j as SqlPlannerSuccessResult, k as SqlPlannerFailureResult, l as SqlControlExtensionDescriptor, m as SqlMigrationPlanOperationStep, n as CodecControlHooks, o as FieldEventContext, p as SqlMigrationPlanOperation, r as CreateSqlMigrationPlanOptions, s as ResolveIdentityValueInput, t as AnyRecord, u as SqlControlTargetDescriptor, v as SqlMigrationRunner, w as SqlMigrationRunnerSuccessValue, x as SqlMigrationRunnerExecuteOptions, y as SqlMigrationRunnerErrorCode } from "./types-BR5vHjvX.mjs";
|
|
2
2
|
import { ControlFamilyDescriptor, ControlStack, MigrationOperationClass, MigrationOperationPolicy, MigrationOperationPolicy as MigrationOperationPolicy$1, MigrationPlan, MigrationPlanOperation, MigrationPlanner, MigrationPlannerConflict, MigrationPlannerConflict as MigrationPlannerConflict$1, MigrationPlannerResult, MutationDefaultGeneratorDescriptor, OpFactoryCall, TargetMigrationsCapability, assembleAuthoringContributions } from "@prisma-next/framework-components/control";
|
|
3
3
|
import { SqlStorage, StorageColumn } from "@prisma-next/sql-contract/types";
|
|
4
4
|
import { ColumnDefault, Contract, ControlPolicy } from "@prisma-next/contract/types";
|
package/dist/control.mjs
CHANGED
|
@@ -1304,7 +1304,7 @@ function createSqlFamilyInstance(stack) {
|
|
|
1304
1304
|
const controlAdapter = getControlAdapter();
|
|
1305
1305
|
const lowererContext = { contract };
|
|
1306
1306
|
for (const query of controlAdapter.bootstrapSignMarkerQueries()) {
|
|
1307
|
-
const lowered = controlAdapter.
|
|
1307
|
+
const lowered = await controlAdapter.lowerToExecuteRequest(query, lowererContext);
|
|
1308
1308
|
await driver.query(lowered.sql, lowered.params);
|
|
1309
1309
|
}
|
|
1310
1310
|
const existingMarker = await controlAdapter.readMarker(driver, APP_SPACE_ID);
|
|
@@ -1385,7 +1385,7 @@ function createSqlFamilyInstance(stack) {
|
|
|
1385
1385
|
return sqlSchemaIrToPslAst(schemaIR);
|
|
1386
1386
|
},
|
|
1387
1387
|
lowerAst(ast, context) {
|
|
1388
|
-
return getControlAdapter().
|
|
1388
|
+
return getControlAdapter().lowerToExecuteRequest(ast, context);
|
|
1389
1389
|
},
|
|
1390
1390
|
bootstrapControlTableQueries() {
|
|
1391
1391
|
return getControlAdapter().bootstrapControlTableQueries();
|