@prisma-next/target-sqlite 0.12.0-dev.5 → 0.12.0-dev.50
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/{codec-ids-C4UfWqAE.d.mts → codec-ids-yG2RRHnw.d.mts} +1 -1
- package/dist/{codec-ids-C4UfWqAE.d.mts.map → codec-ids-yG2RRHnw.d.mts.map} +1 -1
- package/dist/codec-ids.d.mts +1 -1
- package/dist/{codec-types-B2ci-b_W.d.mts → codec-types-CM7OkQLM.d.mts} +2 -2
- package/dist/{codec-types-B2ci-b_W.d.mts.map → codec-types-CM7OkQLM.d.mts.map} +1 -1
- package/dist/codec-types.d.mts +2 -2
- package/dist/{codecs-DqDWNIKq.d.mts → codecs-t6YnHZkK.d.mts} +2 -2
- package/dist/{codecs-DqDWNIKq.d.mts.map → codecs-t6YnHZkK.d.mts.map} +1 -1
- package/dist/codecs.d.mts +1 -1
- package/dist/contract-free.d.mts +50 -0
- package/dist/contract-free.d.mts.map +1 -0
- package/dist/contract-free.mjs +107 -0
- package/dist/contract-free.mjs.map +1 -0
- package/dist/control-tables-C0Nkzhv9.mjs +12 -0
- package/dist/control-tables-C0Nkzhv9.mjs.map +1 -0
- package/dist/control-tables.d.mts +11 -0
- package/dist/control-tables.d.mts.map +1 -0
- package/dist/control-tables.mjs +2 -0
- package/dist/control.d.mts +31 -15
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +62 -120
- package/dist/control.mjs.map +1 -1
- package/dist/ddl.d.mts +2 -0
- package/dist/ddl.mjs +2 -0
- package/dist/{descriptor-meta-DIbCXU65.mjs → descriptor-meta-rKforwQA.mjs} +3 -1
- package/dist/descriptor-meta-rKforwQA.mjs.map +1 -0
- package/dist/migration.d.mts +2 -2
- package/dist/migration.mjs +2 -2
- package/dist/nodes-09ul6DNV.mjs +28 -0
- package/dist/nodes-09ul6DNV.mjs.map +1 -0
- package/dist/nodes-D8LGV4Yk.d.mts +27 -0
- package/dist/nodes-D8LGV4Yk.d.mts.map +1 -0
- package/dist/{op-factory-call-VBm-wu5R.mjs → op-factory-call-DulOHPZX.mjs} +2 -2
- package/dist/{op-factory-call-VBm-wu5R.mjs.map → op-factory-call-DulOHPZX.mjs.map} +1 -1
- package/dist/op-factory-call.d.mts +2 -2
- package/dist/op-factory-call.mjs +1 -1
- package/dist/pack.d.mts +2 -1
- package/dist/pack.d.mts.map +1 -1
- package/dist/pack.mjs +1 -1
- package/dist/{planner-BBvwGy0f.mjs → planner-D7RauQHI.mjs} +6 -6
- package/dist/planner-D7RauQHI.mjs.map +1 -0
- package/dist/{planner-produced-sqlite-migration-D4FSvPE4.d.mts → planner-produced-sqlite-migration-BwFkd0br.d.mts} +3 -3
- package/dist/{planner-produced-sqlite-migration-D4FSvPE4.d.mts.map → planner-produced-sqlite-migration-BwFkd0br.d.mts.map} +1 -1
- package/dist/planner-produced-sqlite-migration.d.mts +1 -1
- package/dist/{planner-target-details-BRS591Zt.mjs → planner-target-details-B-H_bvo0.mjs} +1 -1
- package/dist/{planner-target-details-BRS591Zt.mjs.map → planner-target-details-B-H_bvo0.mjs.map} +1 -1
- package/dist/{planner-target-details-B-VJkUsu.d.mts → planner-target-details-RVPqF2ug.d.mts} +1 -1
- package/dist/{planner-target-details-B-VJkUsu.d.mts.map → planner-target-details-RVPqF2ug.d.mts.map} +1 -1
- package/dist/planner-target-details.d.mts +1 -1
- package/dist/planner-target-details.mjs +1 -1
- package/dist/planner.d.mts +2 -2
- package/dist/planner.mjs +1 -1
- package/dist/render-ops.d.mts +1 -1
- package/dist/runtime.d.mts +17 -1
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +2 -1
- package/dist/runtime.mjs.map +1 -1
- package/dist/{shared-DDOJntxk.d.mts → shared-Bw5G0I-c.d.mts} +2 -2
- package/dist/{shared-DDOJntxk.d.mts.map → shared-Bw5G0I-c.d.mts.map} +1 -1
- package/dist/{sql-utils-D0gQAMLB.mjs → sql-utils-DcrE1Hm4.mjs} +1 -1
- package/dist/{sql-utils-D0gQAMLB.mjs.map → sql-utils-DcrE1Hm4.mjs.map} +1 -1
- package/dist/sql-utils.mjs +1 -1
- package/dist/sqlite-contract-serializer-WdLA-K49.mjs +101 -0
- package/dist/sqlite-contract-serializer-WdLA-K49.mjs.map +1 -0
- package/dist/{sqlite-migration-Feio34n3.d.mts → sqlite-migration-D-O3Glz1.d.mts} +2 -2
- package/dist/{sqlite-migration-Feio34n3.d.mts.map → sqlite-migration-D-O3Glz1.d.mts.map} +1 -1
- package/dist/{tables-gB0XiFu8.mjs → tables-zrEJsCi9.mjs} +3 -3
- package/dist/{tables-gB0XiFu8.mjs.map → tables-zrEJsCi9.mjs.map} +1 -1
- package/package.json +21 -19
- package/src/contract-free/columns.ts +44 -0
- package/src/contract-free/control-bootstrap.ts +54 -0
- package/src/contract-free/ddl.ts +21 -0
- package/src/core/control-tables.ts +11 -0
- package/src/core/ddl/nodes.ts +41 -0
- package/src/core/descriptor-meta.ts +2 -0
- package/src/core/migrations/issue-planner.ts +1 -1
- package/src/core/migrations/planner-strategies.ts +1 -1
- package/src/core/migrations/runner.ts +78 -83
- package/src/core/sqlite-contract-serializer.ts +21 -9
- package/src/core/sqlite-unbound-database.ts +113 -26
- package/src/exports/contract-free.ts +6 -0
- package/src/exports/control-tables.ts +5 -0
- package/src/exports/ddl.ts +6 -0
- package/src/exports/runtime.ts +1 -0
- package/dist/descriptor-meta-DIbCXU65.mjs.map +0 -1
- package/dist/planner-BBvwGy0f.mjs.map +0 -1
- package/dist/statement-builders-BiRmeyJM.mjs +0 -158
- package/dist/statement-builders-BiRmeyJM.mjs.map +0 -1
- package/dist/statement-builders.d.mts +0 -68
- package/dist/statement-builders.d.mts.map +0 -1
- package/dist/statement-builders.mjs +0 -2
- package/src/core/migrations/statement-builders.ts +0 -212
- package/src/exports/statement-builders.ts +0 -12
|
@@ -10,4 +10,4 @@ declare const SQLITE_JSON_CODEC_ID: "sqlite/json@1";
|
|
|
10
10
|
declare const SQLITE_BIGINT_CODEC_ID: "sqlite/bigint@1";
|
|
11
11
|
//#endregion
|
|
12
12
|
export { SQLITE_JSON_CODEC_ID as a, SQL_CHAR_CODEC_ID as c, SQL_VARCHAR_CODEC_ID as d, SQLITE_INTEGER_CODEC_ID as i, SQL_FLOAT_CODEC_ID as l, SQLITE_BLOB_CODEC_ID as n, SQLITE_REAL_CODEC_ID as o, SQLITE_DATETIME_CODEC_ID as r, SQLITE_TEXT_CODEC_ID as s, SQLITE_BIGINT_CODEC_ID as t, SQL_INT_CODEC_ID as u };
|
|
13
|
-
//# sourceMappingURL=codec-ids-
|
|
13
|
+
//# sourceMappingURL=codec-ids-yG2RRHnw.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec-ids-
|
|
1
|
+
{"version":3,"file":"codec-ids-yG2RRHnw.d.mts","names":[],"sources":["../src/core/codec-ids.ts"],"mappings":";;;cAMa,oBAAA;AAAA,cACA,uBAAA;AAAA,cACA,oBAAA;AAAA,cACA,oBAAA;AAAA,cACA,wBAAA;AAAA,cACA,oBAAA;AAAA,cACA,sBAAA"}
|
package/dist/codec-ids.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as SQLITE_JSON_CODEC_ID, c as SQL_CHAR_CODEC_ID, d as SQL_VARCHAR_CODEC_ID, i as SQLITE_INTEGER_CODEC_ID, l as SQL_FLOAT_CODEC_ID, n as SQLITE_BLOB_CODEC_ID, o as SQLITE_REAL_CODEC_ID, r as SQLITE_DATETIME_CODEC_ID, s as SQLITE_TEXT_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID, u as SQL_INT_CODEC_ID } from "./codec-ids-
|
|
1
|
+
import { a as SQLITE_JSON_CODEC_ID, c as SQL_CHAR_CODEC_ID, d as SQL_VARCHAR_CODEC_ID, i as SQLITE_INTEGER_CODEC_ID, l as SQL_FLOAT_CODEC_ID, n as SQLITE_BLOB_CODEC_ID, o as SQLITE_REAL_CODEC_ID, r as SQLITE_DATETIME_CODEC_ID, s as SQLITE_TEXT_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID, u as SQL_INT_CODEC_ID } from "./codec-ids-yG2RRHnw.mjs";
|
|
2
2
|
export { SQLITE_BIGINT_CODEC_ID, SQLITE_BLOB_CODEC_ID, SQLITE_DATETIME_CODEC_ID, SQLITE_INTEGER_CODEC_ID, SQLITE_JSON_CODEC_ID, SQLITE_REAL_CODEC_ID, SQLITE_TEXT_CODEC_ID, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_VARCHAR_CODEC_ID };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as SqliteIntegerDescriptor, c as SqliteTextDescriptor, i as SqliteDatetimeDescriptor, n as SqliteBigintDescriptor, o as SqliteJsonDescriptor, r as SqliteBlobDescriptor, s as SqliteRealDescriptor } from "./codecs-
|
|
1
|
+
import { a as SqliteIntegerDescriptor, c as SqliteTextDescriptor, i as SqliteDatetimeDescriptor, n as SqliteBigintDescriptor, o as SqliteJsonDescriptor, r as SqliteBlobDescriptor, s as SqliteRealDescriptor } from "./codecs-t6YnHZkK.mjs";
|
|
2
2
|
import * as _$_prisma_next_sql_relational_core_ast0 from "@prisma-next/sql-relational-core/ast";
|
|
3
3
|
import { ExtractCodecTypes } from "@prisma-next/sql-relational-core/ast";
|
|
4
4
|
|
|
@@ -20,4 +20,4 @@ type Resolve<T> = { readonly [K in keyof T]: { readonly [P in keyof T[K]]: T[K][
|
|
|
20
20
|
type CodecTypes = Resolve<ExtractCodecTypes<typeof codecDescriptorMap>>;
|
|
21
21
|
//#endregion
|
|
22
22
|
export { CodecTypes as t };
|
|
23
|
-
//# sourceMappingURL=codec-types-
|
|
23
|
+
//# sourceMappingURL=codec-types-CM7OkQLM.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec-types-
|
|
1
|
+
{"version":3,"file":"codec-types-CM7OkQLM.d.mts","names":[],"sources":["../src/exports/codec-types.ts"],"mappings":";;;;;cAwBM,kBAAA;EAAA,eAYI,uCAAA,CAAA,iBAAA;EAAA;;;;;;;;;;;KAEL,OAAA,6BAAoC,CAAA,0BAA2B,CAAA,CAAE,CAAA,IAAK,CAAA,CAAE,CAAA,EAAG,CAAA;AAAA,KAEpE,UAAA,GAAa,OAAA,CAAQ,iBAAA,QAAyB,kBAAA"}
|
package/dist/codec-types.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { g as JsonValue } from "./codecs-
|
|
2
|
-
import { t as CodecTypes } from "./codec-types-
|
|
1
|
+
import { g as JsonValue } from "./codecs-t6YnHZkK.mjs";
|
|
2
|
+
import { t as CodecTypes } from "./codec-types-CM7OkQLM.mjs";
|
|
3
3
|
export { CodecTypes, JsonValue };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as SQLITE_JSON_CODEC_ID, i as SQLITE_INTEGER_CODEC_ID, n as SQLITE_BLOB_CODEC_ID, o as SQLITE_REAL_CODEC_ID, r as SQLITE_DATETIME_CODEC_ID, s as SQLITE_TEXT_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID } from "./codec-ids-
|
|
1
|
+
import { a as SQLITE_JSON_CODEC_ID, i as SQLITE_INTEGER_CODEC_ID, n as SQLITE_BLOB_CODEC_ID, o as SQLITE_REAL_CODEC_ID, r as SQLITE_DATETIME_CODEC_ID, s as SQLITE_TEXT_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID } from "./codec-ids-yG2RRHnw.mjs";
|
|
2
2
|
import * as _$_prisma_next_framework_components_codec0 from "@prisma-next/framework-components/codec";
|
|
3
3
|
import { CodecCallContext, CodecDescriptorImpl, CodecImpl, CodecInstanceContext } from "@prisma-next/framework-components/codec";
|
|
4
4
|
import * as _$_standard_schema_spec0 from "@standard-schema/spec";
|
|
@@ -123,4 +123,4 @@ declare const sqliteBigintColumn: () => _$_prisma_next_framework_components_code
|
|
|
123
123
|
declare const sqliteCodecRegistry: CodecDescriptorRegistry;
|
|
124
124
|
//#endregion
|
|
125
125
|
export { SqliteIntegerDescriptor as a, SqliteTextDescriptor as c, sqliteDatetimeColumn as d, sqliteIntegerColumn as f, JsonValue$1 as g, sqliteTextColumn as h, SqliteDatetimeDescriptor as i, sqliteBigintColumn as l, sqliteRealColumn as m, SqliteBigintDescriptor as n, SqliteJsonDescriptor as o, sqliteJsonColumn as p, SqliteBlobDescriptor as r, SqliteRealDescriptor as s, sqliteCodecRegistry as t, sqliteBlobColumn as u };
|
|
126
|
-
//# sourceMappingURL=codecs-
|
|
126
|
+
//# sourceMappingURL=codecs-t6YnHZkK.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codecs-
|
|
1
|
+
{"version":3,"file":"codecs-t6YnHZkK.d.mts","names":[],"sources":["../src/core/codec-helpers.ts","../src/core/codecs.ts","../src/core/registry.ts"],"mappings":"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"}
|
package/dist/codecs.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as SqliteIntegerDescriptor, c as SqliteTextDescriptor, d as sqliteDatetimeColumn, f as sqliteIntegerColumn, g as JsonValue, h as sqliteTextColumn, i as SqliteDatetimeDescriptor, l as sqliteBigintColumn, m as sqliteRealColumn, n as SqliteBigintDescriptor, o as SqliteJsonDescriptor, p as sqliteJsonColumn, r as SqliteBlobDescriptor, s as SqliteRealDescriptor, t as sqliteCodecRegistry, u as sqliteBlobColumn } from "./codecs-
|
|
1
|
+
import { a as SqliteIntegerDescriptor, c as SqliteTextDescriptor, d as sqliteDatetimeColumn, f as sqliteIntegerColumn, g as JsonValue, h as sqliteTextColumn, i as SqliteDatetimeDescriptor, l as sqliteBigintColumn, m as sqliteRealColumn, n as SqliteBigintDescriptor, o as SqliteJsonDescriptor, p as sqliteJsonColumn, r as SqliteBlobDescriptor, s as SqliteRealDescriptor, t as sqliteCodecRegistry, u as sqliteBlobColumn } from "./codecs-t6YnHZkK.mjs";
|
|
2
2
|
export { JsonValue, SqliteBigintDescriptor, SqliteBlobDescriptor, SqliteDatetimeDescriptor, SqliteIntegerDescriptor, SqliteJsonDescriptor, SqliteRealDescriptor, SqliteTextDescriptor, sqliteBigintColumn, sqliteBlobColumn, sqliteCodecRegistry, sqliteDatetimeColumn, sqliteIntegerColumn, sqliteJsonColumn, sqliteRealColumn, sqliteTextColumn };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { n as SqliteCreateTable } from "./nodes-D8LGV4Yk.mjs";
|
|
2
|
+
import { DdlColumn, DdlNode } from "@prisma-next/sql-relational-core/ast";
|
|
3
|
+
import { ColumnDescriptor, ColumnSchema, TableHandle } from "@prisma-next/sql-relational-core/contract-free";
|
|
4
|
+
|
|
5
|
+
//#region src/contract-free/columns.d.ts
|
|
6
|
+
type ColOpts = {
|
|
7
|
+
readonly nullable?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const text: (opts?: ColOpts) => ColumnDescriptor;
|
|
10
|
+
declare const integer: (opts?: ColOpts) => ColumnDescriptor;
|
|
11
|
+
declare const jsonText: (opts?: ColOpts) => ColumnDescriptor;
|
|
12
|
+
declare const datetime: (opts?: ColOpts) => ColumnDescriptor;
|
|
13
|
+
/**
|
|
14
|
+
* Declare a SQLite control-plane table with a typed column schema. SQLite tables
|
|
15
|
+
* are addressed by a flat name (no schema prefix).
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* const marker = sqliteTable('_prisma_marker', {
|
|
19
|
+
* space: text(),
|
|
20
|
+
* core_hash: text(),
|
|
21
|
+
* updated_at: datetime(),
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare function sqliteTable<Schema extends ColumnSchema>(name: string, columns: Schema): TableHandle<Schema>;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/contract-free/control-bootstrap.d.ts
|
|
28
|
+
declare function buildSignMarkerBootstrapQueries(): readonly DdlNode[];
|
|
29
|
+
declare function buildControlTableBootstrapQueries(): readonly DdlNode[];
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/contract-free/ddl.d.ts
|
|
32
|
+
/**
|
|
33
|
+
* Build a SQLite `CREATE TABLE` query node.
|
|
34
|
+
*
|
|
35
|
+
* Precondition: identifiers (`table`, column names/types) are emitted to SQL
|
|
36
|
+
* verbatim — they are not quoted or escaped, so callers must pass pre-trusted
|
|
37
|
+
* values (e.g. fixed control-plane identifiers). String-literal default values,
|
|
38
|
+
* by contrast, are single-quote-escaped (embedded `'` doubled) by the renderer.
|
|
39
|
+
* Identifier quoting for untrusted identifiers is added when the migration
|
|
40
|
+
* planner adopts this lowering path.
|
|
41
|
+
*/
|
|
42
|
+
declare function createTable(options: {
|
|
43
|
+
readonly table: string;
|
|
44
|
+
readonly schema?: string;
|
|
45
|
+
readonly ifNotExists?: boolean;
|
|
46
|
+
readonly columns: readonly DdlColumn[];
|
|
47
|
+
}): SqliteCreateTable;
|
|
48
|
+
//#endregion
|
|
49
|
+
export { buildControlTableBootstrapQueries, buildSignMarkerBootstrapQueries, createTable, datetime, integer, jsonText, sqliteTable, text };
|
|
50
|
+
//# sourceMappingURL=contract-free.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-free.d.mts","names":[],"sources":["../src/contract-free/columns.ts","../src/contract-free/control-bootstrap.ts","../src/contract-free/ddl.ts"],"mappings":";;;;;KAcK,OAAA;EAAA,SAAqB,QAAQ;AAAA;AAAA,cAOrB,IAAA,GAAQ,IAAA,GAAO,OAAA,KAAU,gBAAoD;AAAA,cAC7E,OAAA,GAAW,IAAA,GAAO,OAAA,KAAU,gBAAuD;AAAA,cACnF,QAAA,GAAY,IAAA,GAAO,OAAA,KAAU,gBAAoD;AAAA,cACjF,QAAA,GAAY,IAAA,GAAO,OAAA,KAAU,gBAAwD;;AAVhE;AAOlC;;;;;;;;AAA0F;AAC1F;iBAgBgB,WAAA,gBAA2B,YAAA,CAAA,CACzC,IAAA,UACA,OAAA,EAAS,MAAA,GACR,WAAA,CAAY,MAAA;;;iBCMC,+BAAA,CAAA,YAA4C,OAAO;AAAA,iBAInD,iCAAA,CAAA,YAA8C,OAAO;;;;;;AD7Cb;;;;AAQtB;AAOlC;;iBERgB,WAAA,CAAY,OAAA;EAAA,SACjB,KAAA;EAAA,SACA,MAAA;EAAA,SACA,WAAA;EAAA,SACA,OAAA,WAAkB,SAAA;AAAA,IACzB,iBAAiB"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { a as SQLITE_JSON_CODEC_ID, i as SQLITE_INTEGER_CODEC_ID, r as SQLITE_DATETIME_CODEC_ID, s as SQLITE_TEXT_CODEC_ID } from "./codec-ids-CuUxYcd0.mjs";
|
|
2
|
+
import { t as SqliteCreateTable } from "./nodes-09ul6DNV.mjs";
|
|
3
|
+
import { TableSource } from "@prisma-next/sql-relational-core/ast";
|
|
4
|
+
import { APP_SPACE_ID } from "@prisma-next/framework-components/control";
|
|
5
|
+
import { col, fn, lit, table } from "@prisma-next/sql-relational-core/contract-free";
|
|
6
|
+
//#region src/contract-free/columns.ts
|
|
7
|
+
const desc = (codecId, opts) => ({
|
|
8
|
+
codecId,
|
|
9
|
+
nullable: opts?.nullable ?? false
|
|
10
|
+
});
|
|
11
|
+
const text = (opts) => desc(SQLITE_TEXT_CODEC_ID, opts);
|
|
12
|
+
const integer = (opts) => desc(SQLITE_INTEGER_CODEC_ID, opts);
|
|
13
|
+
const jsonText = (opts) => desc(SQLITE_JSON_CODEC_ID, opts);
|
|
14
|
+
const datetime = (opts) => desc(SQLITE_DATETIME_CODEC_ID, opts);
|
|
15
|
+
/**
|
|
16
|
+
* Declare a SQLite control-plane table with a typed column schema. SQLite tables
|
|
17
|
+
* are addressed by a flat name (no schema prefix).
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* const marker = sqliteTable('_prisma_marker', {
|
|
21
|
+
* space: text(),
|
|
22
|
+
* core_hash: text(),
|
|
23
|
+
* updated_at: datetime(),
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
function sqliteTable(name, columns) {
|
|
28
|
+
return table(TableSource.named(name), columns);
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/contract-free/ddl.ts
|
|
32
|
+
/**
|
|
33
|
+
* Build a SQLite `CREATE TABLE` query node.
|
|
34
|
+
*
|
|
35
|
+
* Precondition: identifiers (`table`, column names/types) are emitted to SQL
|
|
36
|
+
* verbatim — they are not quoted or escaped, so callers must pass pre-trusted
|
|
37
|
+
* values (e.g. fixed control-plane identifiers). String-literal default values,
|
|
38
|
+
* by contrast, are single-quote-escaped (embedded `'` doubled) by the renderer.
|
|
39
|
+
* Identifier quoting for untrusted identifiers is added when the migration
|
|
40
|
+
* planner adopts this lowering path.
|
|
41
|
+
*/
|
|
42
|
+
function createTable(options) {
|
|
43
|
+
return new SqliteCreateTable(options);
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/contract-free/control-bootstrap.ts
|
|
47
|
+
const markerColumns = [
|
|
48
|
+
col("space", "TEXT", {
|
|
49
|
+
notNull: true,
|
|
50
|
+
primaryKey: true,
|
|
51
|
+
default: lit(APP_SPACE_ID)
|
|
52
|
+
}),
|
|
53
|
+
col("core_hash", "TEXT", { notNull: true }),
|
|
54
|
+
col("profile_hash", "TEXT", { notNull: true }),
|
|
55
|
+
col("contract_json", "TEXT"),
|
|
56
|
+
col("canonical_version", "INTEGER"),
|
|
57
|
+
col("updated_at", "TEXT", {
|
|
58
|
+
notNull: true,
|
|
59
|
+
default: fn("datetime('now')")
|
|
60
|
+
}),
|
|
61
|
+
col("app_tag", "TEXT"),
|
|
62
|
+
col("meta", "TEXT", {
|
|
63
|
+
notNull: true,
|
|
64
|
+
default: lit("{}")
|
|
65
|
+
}),
|
|
66
|
+
col("invariants", "TEXT", {
|
|
67
|
+
notNull: true,
|
|
68
|
+
default: lit("[]")
|
|
69
|
+
})
|
|
70
|
+
];
|
|
71
|
+
const ledgerColumns = [
|
|
72
|
+
col("id", "INTEGER PRIMARY KEY AUTOINCREMENT"),
|
|
73
|
+
col("created_at", "TEXT", {
|
|
74
|
+
notNull: true,
|
|
75
|
+
default: fn("strftime('%Y-%m-%dT%H:%M:%fZ','now')")
|
|
76
|
+
}),
|
|
77
|
+
col("space", "TEXT", { notNull: true }),
|
|
78
|
+
col("migration_name", "TEXT", { notNull: true }),
|
|
79
|
+
col("migration_hash", "TEXT", { notNull: true }),
|
|
80
|
+
col("origin_core_hash", "TEXT"),
|
|
81
|
+
col("origin_profile_hash", "TEXT"),
|
|
82
|
+
col("destination_core_hash", "TEXT", { notNull: true }),
|
|
83
|
+
col("destination_profile_hash", "TEXT"),
|
|
84
|
+
col("contract_json_before", "TEXT"),
|
|
85
|
+
col("contract_json_after", "TEXT"),
|
|
86
|
+
col("operations", "TEXT", { notNull: true })
|
|
87
|
+
];
|
|
88
|
+
const markerTable = createTable({
|
|
89
|
+
table: "_prisma_marker",
|
|
90
|
+
ifNotExists: true,
|
|
91
|
+
columns: markerColumns
|
|
92
|
+
});
|
|
93
|
+
const ledgerTable = createTable({
|
|
94
|
+
table: "_prisma_ledger",
|
|
95
|
+
ifNotExists: true,
|
|
96
|
+
columns: ledgerColumns
|
|
97
|
+
});
|
|
98
|
+
function buildSignMarkerBootstrapQueries() {
|
|
99
|
+
return [markerTable];
|
|
100
|
+
}
|
|
101
|
+
function buildControlTableBootstrapQueries() {
|
|
102
|
+
return [markerTable, ledgerTable];
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
export { buildControlTableBootstrapQueries, buildSignMarkerBootstrapQueries, createTable, datetime, integer, jsonText, sqliteTable, text };
|
|
106
|
+
|
|
107
|
+
//# sourceMappingURL=contract-free.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-free.mjs","names":[],"sources":["../src/contract-free/columns.ts","../src/contract-free/ddl.ts","../src/contract-free/control-bootstrap.ts"],"sourcesContent":["import { TableSource } from '@prisma-next/sql-relational-core/ast';\nimport {\n type ColumnDescriptor,\n type ColumnSchema,\n type TableHandle,\n table,\n} from '@prisma-next/sql-relational-core/contract-free';\nimport {\n SQLITE_DATETIME_CODEC_ID,\n SQLITE_INTEGER_CODEC_ID,\n SQLITE_JSON_CODEC_ID,\n SQLITE_TEXT_CODEC_ID,\n} from '../core/codec-ids';\n\ntype ColOpts = { readonly nullable?: boolean };\n\nconst desc = (codecId: string, opts?: ColOpts): ColumnDescriptor => ({\n codecId,\n nullable: opts?.nullable ?? false,\n});\n\nexport const text = (opts?: ColOpts): ColumnDescriptor => desc(SQLITE_TEXT_CODEC_ID, opts);\nexport const integer = (opts?: ColOpts): ColumnDescriptor => desc(SQLITE_INTEGER_CODEC_ID, opts);\nexport const jsonText = (opts?: ColOpts): ColumnDescriptor => desc(SQLITE_JSON_CODEC_ID, opts);\nexport const datetime = (opts?: ColOpts): ColumnDescriptor => desc(SQLITE_DATETIME_CODEC_ID, opts);\n\n/**\n * Declare a SQLite control-plane table with a typed column schema. SQLite tables\n * are addressed by a flat name (no schema prefix).\n *\n * ```ts\n * const marker = sqliteTable('_prisma_marker', {\n * space: text(),\n * core_hash: text(),\n * updated_at: datetime(),\n * });\n * ```\n */\nexport function sqliteTable<Schema extends ColumnSchema>(\n name: string,\n columns: Schema,\n): TableHandle<Schema> {\n return table(TableSource.named(name), columns);\n}\n","import type { DdlColumn } from '@prisma-next/sql-relational-core/ast';\nimport { SqliteCreateTable } from '../core/ddl/nodes';\n\n/**\n * Build a SQLite `CREATE TABLE` query node.\n *\n * Precondition: identifiers (`table`, column names/types) are emitted to SQL\n * verbatim — they are not quoted or escaped, so callers must pass pre-trusted\n * values (e.g. fixed control-plane identifiers). String-literal default values,\n * by contrast, are single-quote-escaped (embedded `'` doubled) by the renderer.\n * Identifier quoting for untrusted identifiers is added when the migration\n * planner adopts this lowering path.\n */\nexport function createTable(options: {\n readonly table: string;\n readonly schema?: string;\n readonly ifNotExists?: boolean;\n readonly columns: readonly DdlColumn[];\n}): SqliteCreateTable {\n return new SqliteCreateTable(options);\n}\n","import { APP_SPACE_ID } from '@prisma-next/framework-components/control';\nimport type { DdlNode } from '@prisma-next/sql-relational-core/ast';\nimport { col, fn, lit } from '@prisma-next/sql-relational-core/contract-free';\nimport { createTable } from './ddl';\n\nconst markerColumns = [\n col('space', 'TEXT', { notNull: true, primaryKey: true, default: lit(APP_SPACE_ID) }),\n col('core_hash', 'TEXT', { notNull: true }),\n col('profile_hash', 'TEXT', { notNull: true }),\n col('contract_json', 'TEXT'),\n col('canonical_version', 'INTEGER'),\n col('updated_at', 'TEXT', { notNull: true, default: fn(\"datetime('now')\") }),\n col('app_tag', 'TEXT'),\n col('meta', 'TEXT', { notNull: true, default: lit('{}') }),\n col('invariants', 'TEXT', { notNull: true, default: lit('[]') }),\n] as const;\n\nconst ledgerColumns = [\n col('id', 'INTEGER PRIMARY KEY AUTOINCREMENT'),\n col('created_at', 'TEXT', {\n notNull: true,\n default: fn(\"strftime('%Y-%m-%dT%H:%M:%fZ','now')\"),\n }),\n col('space', 'TEXT', { notNull: true }),\n col('migration_name', 'TEXT', { notNull: true }),\n col('migration_hash', 'TEXT', { notNull: true }),\n col('origin_core_hash', 'TEXT'),\n col('origin_profile_hash', 'TEXT'),\n col('destination_core_hash', 'TEXT', { notNull: true }),\n col('destination_profile_hash', 'TEXT'),\n col('contract_json_before', 'TEXT'),\n col('contract_json_after', 'TEXT'),\n col('operations', 'TEXT', { notNull: true }),\n] as const;\n\nconst markerTable = createTable({\n table: '_prisma_marker',\n ifNotExists: true,\n columns: markerColumns,\n});\n\nconst ledgerTable = createTable({\n table: '_prisma_ledger',\n ifNotExists: true,\n columns: ledgerColumns,\n});\n\nexport function buildSignMarkerBootstrapQueries(): readonly DdlNode[] {\n return [markerTable];\n}\n\nexport function buildControlTableBootstrapQueries(): readonly DdlNode[] {\n return [markerTable, ledgerTable];\n}\n"],"mappings":";;;;;;AAgBA,MAAM,QAAQ,SAAiB,UAAsC;CACnE;CACA,UAAU,MAAM,YAAY;AAC9B;AAEA,MAAa,QAAQ,SAAqC,KAAK,sBAAsB,IAAI;AACzF,MAAa,WAAW,SAAqC,KAAK,yBAAyB,IAAI;AAC/F,MAAa,YAAY,SAAqC,KAAK,sBAAsB,IAAI;AAC7F,MAAa,YAAY,SAAqC,KAAK,0BAA0B,IAAI;;;;;;;;;;;;;AAcjG,SAAgB,YACd,MACA,SACqB;CACrB,OAAO,MAAM,YAAY,MAAM,IAAI,GAAG,OAAO;AAC/C;;;;;;;;;;;;;AC9BA,SAAgB,YAAY,SAKN;CACpB,OAAO,IAAI,kBAAkB,OAAO;AACtC;;;ACfA,MAAM,gBAAgB;CACpB,IAAI,SAAS,QAAQ;EAAE,SAAS;EAAM,YAAY;EAAM,SAAS,IAAI,YAAY;CAAE,CAAC;CACpF,IAAI,aAAa,QAAQ,EAAE,SAAS,KAAK,CAAC;CAC1C,IAAI,gBAAgB,QAAQ,EAAE,SAAS,KAAK,CAAC;CAC7C,IAAI,iBAAiB,MAAM;CAC3B,IAAI,qBAAqB,SAAS;CAClC,IAAI,cAAc,QAAQ;EAAE,SAAS;EAAM,SAAS,GAAG,iBAAiB;CAAE,CAAC;CAC3E,IAAI,WAAW,MAAM;CACrB,IAAI,QAAQ,QAAQ;EAAE,SAAS;EAAM,SAAS,IAAI,IAAI;CAAE,CAAC;CACzD,IAAI,cAAc,QAAQ;EAAE,SAAS;EAAM,SAAS,IAAI,IAAI;CAAE,CAAC;AACjE;AAEA,MAAM,gBAAgB;CACpB,IAAI,MAAM,mCAAmC;CAC7C,IAAI,cAAc,QAAQ;EACxB,SAAS;EACT,SAAS,GAAG,sCAAsC;CACpD,CAAC;CACD,IAAI,SAAS,QAAQ,EAAE,SAAS,KAAK,CAAC;CACtC,IAAI,kBAAkB,QAAQ,EAAE,SAAS,KAAK,CAAC;CAC/C,IAAI,kBAAkB,QAAQ,EAAE,SAAS,KAAK,CAAC;CAC/C,IAAI,oBAAoB,MAAM;CAC9B,IAAI,uBAAuB,MAAM;CACjC,IAAI,yBAAyB,QAAQ,EAAE,SAAS,KAAK,CAAC;CACtD,IAAI,4BAA4B,MAAM;CACtC,IAAI,wBAAwB,MAAM;CAClC,IAAI,uBAAuB,MAAM;CACjC,IAAI,cAAc,QAAQ,EAAE,SAAS,KAAK,CAAC;AAC7C;AAEA,MAAM,cAAc,YAAY;CAC9B,OAAO;CACP,aAAa;CACb,SAAS;AACX,CAAC;AAED,MAAM,cAAc,YAAY;CAC9B,OAAO;CACP,aAAa;CACb,SAAS;AACX,CAAC;AAED,SAAgB,kCAAsD;CACpE,OAAO,CAAC,WAAW;AACrB;AAEA,SAAgB,oCAAwD;CACtE,OAAO,CAAC,aAAa,WAAW;AAClC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/core/control-tables.ts
|
|
2
|
+
const MARKER_TABLE_NAME = "_prisma_marker";
|
|
3
|
+
const LEDGER_TABLE_NAME = "_prisma_ledger";
|
|
4
|
+
/**
|
|
5
|
+
* Control tables the runner creates/manages. The planner must not drop these
|
|
6
|
+
* when reconciling "extra" tables against the contract.
|
|
7
|
+
*/
|
|
8
|
+
const CONTROL_TABLE_NAMES = new Set([MARKER_TABLE_NAME, LEDGER_TABLE_NAME]);
|
|
9
|
+
//#endregion
|
|
10
|
+
export { LEDGER_TABLE_NAME as n, MARKER_TABLE_NAME as r, CONTROL_TABLE_NAMES as t };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=control-tables-C0Nkzhv9.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-tables-C0Nkzhv9.mjs","names":[],"sources":["../src/core/control-tables.ts"],"sourcesContent":["export const MARKER_TABLE_NAME = '_prisma_marker';\nexport const LEDGER_TABLE_NAME = '_prisma_ledger';\n\n/**\n * Control tables the runner creates/manages. The planner must not drop these\n * when reconciling \"extra\" tables against the contract.\n */\nexport const CONTROL_TABLE_NAMES: ReadonlySet<string> = new Set([\n MARKER_TABLE_NAME,\n LEDGER_TABLE_NAME,\n]);\n"],"mappings":";AAAA,MAAa,oBAAoB;AACjC,MAAa,oBAAoB;;;;;AAMjC,MAAa,sBAA2C,IAAI,IAAI,CAC9D,mBACA,iBACF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/core/control-tables.d.ts
|
|
2
|
+
declare const MARKER_TABLE_NAME = "_prisma_marker";
|
|
3
|
+
declare const LEDGER_TABLE_NAME = "_prisma_ledger";
|
|
4
|
+
/**
|
|
5
|
+
* Control tables the runner creates/manages. The planner must not drop these
|
|
6
|
+
* when reconciling "extra" tables against the contract.
|
|
7
|
+
*/
|
|
8
|
+
declare const CONTROL_TABLE_NAMES: ReadonlySet<string>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { CONTROL_TABLE_NAMES, LEDGER_TABLE_NAME, MARKER_TABLE_NAME };
|
|
11
|
+
//# sourceMappingURL=control-tables.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-tables.d.mts","names":[],"sources":["../src/core/control-tables.ts"],"mappings":";cAAa,iBAAA;AAAA,cACA,iBAAA;;;;AADiB;cAOjB,mBAAA,EAAqB,WAAW"}
|
package/dist/control.d.mts
CHANGED
|
@@ -1,12 +1,33 @@
|
|
|
1
|
-
import { t as SqlitePlanTargetDetails } from "./planner-target-details-
|
|
1
|
+
import { t as SqlitePlanTargetDetails } from "./planner-target-details-RVPqF2ug.mjs";
|
|
2
2
|
import { SqlControlTargetDescriptor } from "@prisma-next/family-sql/control";
|
|
3
|
-
import { StorageTable } from "@prisma-next/sql-contract/types";
|
|
4
|
-
import { NamespaceBase } from "@prisma-next/framework-components/ir";
|
|
3
|
+
import { SqlNamespaceTablesInput, StorageTable, StorageTableInput } from "@prisma-next/sql-contract/types";
|
|
4
|
+
import { Namespace, NamespaceBase } from "@prisma-next/framework-components/ir";
|
|
5
5
|
|
|
6
6
|
//#region src/core/control-target.d.ts
|
|
7
7
|
declare const sqliteControlTargetDescriptor: SqlControlTargetDescriptor<'sqlite', SqlitePlanTargetDetails>;
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/core/sqlite-unbound-database.d.ts
|
|
10
|
+
type SqliteDatabaseInput = {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly entries: {
|
|
13
|
+
readonly table: Readonly<Record<string, StorageTable | StorageTableInput>>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* SQLite namespace concretion carrying table metadata under
|
|
18
|
+
* `entries.table` and unqualified `qualifyTable()` emission for runtime
|
|
19
|
+
* SQL rendering.
|
|
20
|
+
*/
|
|
21
|
+
declare class SqliteDatabase extends NamespaceBase {
|
|
22
|
+
readonly kind: string;
|
|
23
|
+
readonly id: string;
|
|
24
|
+
readonly entries: Readonly<{
|
|
25
|
+
readonly table: Readonly<Record<string, StorageTable>>;
|
|
26
|
+
}>;
|
|
27
|
+
constructor(input: SqliteDatabaseInput);
|
|
28
|
+
qualifier(): string;
|
|
29
|
+
qualifyTable(tableName: string): string;
|
|
30
|
+
}
|
|
10
31
|
/**
|
|
11
32
|
* SQLite target `Namespace` concretion. SQLite has no schema or
|
|
12
33
|
* database-namespacing concept at the SQL level — there is exactly one
|
|
@@ -24,26 +45,21 @@ declare const sqliteControlTargetDescriptor: SqlControlTargetDescriptor<'sqlite'
|
|
|
24
45
|
* `__unspecified__` AST bucket reaches the SQLite interpreter, which
|
|
25
46
|
* lowers it to this singleton.
|
|
26
47
|
*/
|
|
27
|
-
declare class SqliteUnboundDatabase extends
|
|
48
|
+
declare class SqliteUnboundDatabase extends SqliteDatabase {
|
|
28
49
|
static readonly instance: SqliteUnboundDatabase;
|
|
29
|
-
readonly kind: "database";
|
|
30
|
-
readonly id: "__unbound__";
|
|
31
|
-
readonly tables: Readonly<Record<string, StorageTable>>;
|
|
32
50
|
private constructor();
|
|
33
|
-
qualifier(): string;
|
|
34
|
-
qualifyTable(tableName: string): string;
|
|
35
51
|
}
|
|
36
52
|
/**
|
|
37
53
|
* Target-supplied `Namespace` factory the SQLite target plumbs through
|
|
38
54
|
* `defineContract({ createNamespace })`. SQLite has only one
|
|
39
55
|
* effective namespace slot — the framework `UNBOUND_NAMESPACE_ID`
|
|
40
|
-
* sentinel — so the factory always returns the singleton
|
|
41
|
-
*
|
|
42
|
-
* `defineContract` already rejects
|
|
43
|
-
* this throw is a structural
|
|
44
|
-
* surface.
|
|
56
|
+
* sentinel — so the factory always returns the singleton or a fresh
|
|
57
|
+
* `SqliteDatabase` for the unbound slot with tables. The SQL family's
|
|
58
|
+
* defensive validation in `defineContract` already rejects
|
|
59
|
+
* user-declared SQLite namespaces, so this throw is a structural
|
|
60
|
+
* safety net rather than a user-facing surface.
|
|
45
61
|
*/
|
|
46
|
-
declare function sqliteCreateNamespace(
|
|
62
|
+
declare function sqliteCreateNamespace(input: SqlNamespaceTablesInput): SqliteDatabase | SqliteUnboundDatabase;
|
|
47
63
|
//#endregion
|
|
48
64
|
export { type SqlitePlanTargetDetails, SqliteUnboundDatabase, sqliteControlTargetDescriptor as default, sqliteCreateNamespace };
|
|
49
65
|
//# sourceMappingURL=control.d.mts.map
|
package/dist/control.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.mts","names":[],"sources":["../src/core/control-target.ts","../src/core/sqlite-unbound-database.ts"],"mappings":";;;;;;cAkCM,6BAAA,EAA+B,0BAA0B,WAAW,uBAAA
|
|
1
|
+
{"version":3,"file":"control.d.mts","names":[],"sources":["../src/core/control-target.ts","../src/core/sqlite-unbound-database.ts"],"mappings":";;;;;;cAkCM,6BAAA,EAA+B,0BAA0B,WAAW,uBAAA;;;KCrB9D,mBAAA;EAAA,SACD,EAAA;EAAA,SACA,OAAA;IAAA,SACE,KAAA,EAAO,QAAA,CAAS,MAAA,SAAe,YAAA,GAAe,iBAAA;EAAA;AAAA;;;ADkBsC;;;cCMpF,cAAA,SAAuB,aAAA;EAAA,SACjB,IAAA;EAAA,SAER,EAAA;EAAA,SACA,OAAA,EAAS,QAAA;IAAA,SACP,KAAA,EAAO,QAAA,CAAS,MAAA,SAAe,YAAA;EAAA;cAG9B,KAAA,EAAO,mBAAA;EAsBnB,SAAA,CAAA;EAIA,YAAA,CAAa,SAAA;AAAA;;;;;;;;;AA1D6D;AAwB5E;;;;;;;;cAwDa,qBAAA,SAA8B,cAAc;EAAA,gBACvC,QAAA,EAAU,qBAAA;EAAA,QAEnB,WAAA,CAAA;AAAA;;;;;;;;;;;iBA+CO,qBAAA,CACd,KAAA,EAAO,uBAAA,GACN,cAAA,GAAiB,qBAAA"}
|
package/dist/control.mjs
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { t as sqliteTargetDescriptorMeta } from "./descriptor-meta-
|
|
1
|
+
import { t as sqliteTargetDescriptorMeta } from "./descriptor-meta-rKforwQA.mjs";
|
|
2
2
|
import { t as parseSqliteDefault } from "./default-normalizer-CWKVYSxS.mjs";
|
|
3
3
|
import { t as normalizeSqliteNativeType } from "./native-type-normalizer-HvkimyB8.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { r as MARKER_TABLE_NAME } from "./control-tables-C0Nkzhv9.mjs";
|
|
5
|
+
import { d as renderDefaultLiteral } from "./tables-zrEJsCi9.mjs";
|
|
6
|
+
import { n as createSqliteMigrationPlanner } from "./planner-D7RauQHI.mjs";
|
|
7
|
+
import { n as SqliteUnboundDatabase, r as sqliteCreateNamespace, t as SqliteContractSerializer } from "./sqlite-contract-serializer-WdLA-K49.mjs";
|
|
7
8
|
import { contractToSchemaIR, runnerFailure, runnerSuccess } from "@prisma-next/family-sql/control";
|
|
8
9
|
import { SqlStorage } from "@prisma-next/sql-contract/types";
|
|
9
10
|
import { verifySqlSchema } from "@prisma-next/family-sql/schema-verify";
|
|
10
11
|
import { notOk, ok, okVoid } from "@prisma-next/utils/result";
|
|
11
12
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
12
|
-
import { NamespaceBase, UNBOUND_NAMESPACE_ID, freezeNode } from "@prisma-next/framework-components/ir";
|
|
13
13
|
import { APP_SPACE_ID } from "@prisma-next/framework-components/control";
|
|
14
|
-
import {
|
|
15
|
-
import { SqlContractSerializerBase, SqlSchemaVerifierBase } from "@prisma-next/family-sql/ir";
|
|
14
|
+
import { SqlSchemaVerifierBase } from "@prisma-next/family-sql/ir";
|
|
16
15
|
//#region src/core/migrations/runner.ts
|
|
17
16
|
function createSqliteMigrationRunner(family) {
|
|
18
17
|
return new SqliteMigrationRunner(family);
|
|
@@ -36,9 +35,12 @@ var SqliteMigrationRunner = class {
|
|
|
36
35
|
if (!destinationCheck.ok) return destinationCheck;
|
|
37
36
|
const policyCheck = this.enforcePolicyCompatibility(options.policy, options.plan.operations);
|
|
38
37
|
if (!policyCheck.ok) return policyCheck;
|
|
39
|
-
const ensureResult = await this.ensureControlTables(driver);
|
|
38
|
+
const ensureResult = await this.ensureControlTables(driver, options.destinationContract);
|
|
40
39
|
if (!ensureResult.ok) return ensureResult;
|
|
41
|
-
const existingMarker = await this.readMarker(
|
|
40
|
+
const existingMarker = await this.family.readMarker({
|
|
41
|
+
driver,
|
|
42
|
+
space
|
|
43
|
+
});
|
|
42
44
|
const markerCheck = this.ensureMarkerCompatibility(existingMarker, options.plan);
|
|
43
45
|
if (!markerCheck.ok) return markerCheck;
|
|
44
46
|
const markerAtDestination = this.markerMatchesDestination(existingMarker, options.plan);
|
|
@@ -79,8 +81,9 @@ var SqliteMigrationRunner = class {
|
|
|
79
81
|
const existingInvariants = new Set(existingMarker?.invariants ?? []);
|
|
80
82
|
const incomingIsSubsetOfExisting = incomingInvariants.every((id) => existingInvariants.has(id));
|
|
81
83
|
if (!(isSelfEdge && operationsExecuted === 0 && incomingIsSubsetOfExisting)) {
|
|
82
|
-
await this.upsertMarker(driver, options, existingMarker, space);
|
|
83
|
-
|
|
84
|
+
const markerResult = await this.upsertMarker(driver, options, existingMarker, space);
|
|
85
|
+
if (!markerResult.ok) return markerResult;
|
|
86
|
+
await this.recordLedgerEntries(driver, options, executedOperations);
|
|
84
87
|
}
|
|
85
88
|
return runnerSuccess({
|
|
86
89
|
operationsPlanned: options.plan.operations.length,
|
|
@@ -181,11 +184,11 @@ var SqliteMigrationRunner = class {
|
|
|
181
184
|
executedOperations
|
|
182
185
|
});
|
|
183
186
|
}
|
|
184
|
-
async ensureControlTables(driver) {
|
|
187
|
+
async ensureControlTables(driver, contract) {
|
|
185
188
|
const legacyDetection = await this.detectLegacyMarkerShape(driver);
|
|
186
189
|
if (!legacyDetection.ok) return legacyDetection;
|
|
187
|
-
|
|
188
|
-
await this.executeStatement(driver,
|
|
190
|
+
const lowererContext = { contract };
|
|
191
|
+
for (const query of this.family.bootstrapControlTableQueries()) await this.executeStatement(driver, this.family.lowerAst(query, lowererContext));
|
|
189
192
|
return okVoid();
|
|
190
193
|
}
|
|
191
194
|
async detectLegacyMarkerShape(driver) {
|
|
@@ -198,21 +201,6 @@ var SqliteMigrationRunner = class {
|
|
|
198
201
|
columns: [...columns].sort()
|
|
199
202
|
} });
|
|
200
203
|
}
|
|
201
|
-
async readMarker(driver, space) {
|
|
202
|
-
const stmt = readMarkerStatement(space);
|
|
203
|
-
try {
|
|
204
|
-
const row = (await driver.query(stmt.sql, stmt.params)).rows[0];
|
|
205
|
-
if (!row) return null;
|
|
206
|
-
const invariants = typeof row.invariants === "string" ? JSON.parse(row.invariants) : row.invariants;
|
|
207
|
-
return parseContractMarkerRow({
|
|
208
|
-
...row,
|
|
209
|
-
invariants
|
|
210
|
-
});
|
|
211
|
-
} catch (error) {
|
|
212
|
-
if (error instanceof Error && error.message.includes("no such table")) return null;
|
|
213
|
-
throw error;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
204
|
async runExpectationSteps(driver, steps, operation, phase) {
|
|
217
205
|
for (const step of steps) {
|
|
218
206
|
const result = await driver.query(step.sql, step.params ?? []);
|
|
@@ -325,32 +313,54 @@ var SqliteMigrationRunner = class {
|
|
|
325
313
|
return okVoid();
|
|
326
314
|
}
|
|
327
315
|
async upsertMarker(driver, options, existingMarker, space) {
|
|
328
|
-
const
|
|
329
|
-
for (const inv of options.plan.providedInvariants) merged.add(inv);
|
|
330
|
-
const invariants = Array.from(merged).sort();
|
|
331
|
-
const writeStatements = buildWriteMarkerStatements({
|
|
332
|
-
space,
|
|
316
|
+
const destination = {
|
|
333
317
|
storageHash: options.plan.destination.storageHash,
|
|
334
318
|
profileHash: options.plan.destination.profileHash ?? options.destinationContract.profileHash ?? options.plan.destination.storageHash,
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
319
|
+
invariants: options.plan.providedInvariants ?? []
|
|
320
|
+
};
|
|
321
|
+
if (!existingMarker) {
|
|
322
|
+
await this.family.initMarker({
|
|
323
|
+
driver,
|
|
324
|
+
space,
|
|
325
|
+
destination
|
|
326
|
+
});
|
|
327
|
+
return okVoid();
|
|
328
|
+
}
|
|
329
|
+
if (!await this.family.updateMarker({
|
|
330
|
+
driver,
|
|
331
|
+
space,
|
|
332
|
+
expectedFrom: existingMarker.storageHash,
|
|
333
|
+
destination
|
|
334
|
+
})) return runnerFailure("MARKER_CAS_FAILURE", "Marker was modified by another process during migration execution.", { meta: {
|
|
335
|
+
space,
|
|
336
|
+
expectedStorageHash: existingMarker.storageHash,
|
|
337
|
+
destinationStorageHash: options.plan.destination.storageHash
|
|
338
|
+
} });
|
|
339
|
+
return okVoid();
|
|
342
340
|
}
|
|
343
|
-
async
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
341
|
+
async recordLedgerEntries(driver, options, executedOperations) {
|
|
342
|
+
const plan = options.plan;
|
|
343
|
+
const space = plan.spaceId;
|
|
344
|
+
const edges = options.migrationEdges;
|
|
345
|
+
const totalEdgeOps = edges.reduce((sum, edge) => sum + edge.operationCount, 0);
|
|
346
|
+
if (totalEdgeOps !== plan.operations.length) throw new Error(`Ledger write: plan.operations length (${plan.operations.length}) does not match sum of migrationEdges operationCount (${totalEdgeOps})`);
|
|
347
|
+
let offset = 0;
|
|
348
|
+
for (const edge of edges) {
|
|
349
|
+
const edgeOps = executedOperations.slice(offset, offset + edge.operationCount);
|
|
350
|
+
offset += edge.operationCount;
|
|
351
|
+
await this.family.writeLedgerEntry({
|
|
352
|
+
driver,
|
|
353
|
+
space,
|
|
354
|
+
entry: {
|
|
355
|
+
edgeId: `${edge.from}->${edge.to}`,
|
|
356
|
+
from: edge.from,
|
|
357
|
+
to: edge.to,
|
|
358
|
+
migrationName: edge.dirName,
|
|
359
|
+
migrationHash: edge.migrationHash,
|
|
360
|
+
operations: edgeOps
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
}
|
|
354
364
|
}
|
|
355
365
|
async beginExclusiveTransaction(driver) {
|
|
356
366
|
await driver.query("BEGIN EXCLUSIVE");
|
|
@@ -370,24 +380,6 @@ var SqliteMigrationRunner = class {
|
|
|
370
380
|
}
|
|
371
381
|
};
|
|
372
382
|
//#endregion
|
|
373
|
-
//#region src/core/sqlite-contract-serializer.ts
|
|
374
|
-
/**
|
|
375
|
-
* SQLite target `ContractSerializer` concretion. Mirrors the Postgres
|
|
376
|
-
* shape: inherits the full SQL-family deserialization pipeline. Today's
|
|
377
|
-
* SQLite contract shape is the family-shared shape; no target-specific
|
|
378
|
-
* polymorphic `storage.types` factories are registered yet.
|
|
379
|
-
*
|
|
380
|
-
* `serializeContract` falls through to the family-base default —
|
|
381
|
-
* SQLite's contract is JSON-clean today. Once target-only fields land
|
|
382
|
-
* (e.g. per-target derived storage fields) this is the home for
|
|
383
|
-
* stripping them from the persisted envelope.
|
|
384
|
-
*/
|
|
385
|
-
var SqliteContractSerializer = class extends SqlContractSerializerBase {
|
|
386
|
-
constructor() {
|
|
387
|
-
super(/* @__PURE__ */ new Map());
|
|
388
|
-
}
|
|
389
|
-
};
|
|
390
|
-
//#endregion
|
|
391
383
|
//#region src/core/sqlite-schema-verifier.ts
|
|
392
384
|
/**
|
|
393
385
|
* SQLite target `SchemaVerifier` concretion. Mirrors the Postgres
|
|
@@ -447,56 +439,6 @@ const sqliteControlTargetDescriptor = {
|
|
|
447
439
|
}
|
|
448
440
|
};
|
|
449
441
|
//#endregion
|
|
450
|
-
//#region src/core/sqlite-unbound-database.ts
|
|
451
|
-
/**
|
|
452
|
-
* SQLite target `Namespace` concretion. SQLite has no schema or
|
|
453
|
-
* database-namespacing concept at the SQL level — there is exactly one
|
|
454
|
-
* effective namespace per connection, so the target ships a single
|
|
455
|
-
* singleton bound to the framework's `UNBOUND_NAMESPACE_ID` slot.
|
|
456
|
-
*
|
|
457
|
-
* Qualifier emission elides the prefix entirely: rendered DDL and
|
|
458
|
-
* queries look unqualified (`CREATE TABLE "users" (...)`), matching
|
|
459
|
-
* SQLite's native dialect. Call sites stay polymorphic — they ask the
|
|
460
|
-
* namespace for its qualifier and consume the empty/unqualified result
|
|
461
|
-
* the same way Postgres consumes a `"schema"` prefix.
|
|
462
|
-
*
|
|
463
|
-
* The SQLite PSL interpreter rejects every explicit `namespace { … }`
|
|
464
|
-
* block with a diagnostic naming SQLite; only the implicit
|
|
465
|
-
* `__unspecified__` AST bucket reaches the SQLite interpreter, which
|
|
466
|
-
* lowers it to this singleton.
|
|
467
|
-
*/
|
|
468
|
-
var SqliteUnboundDatabase = class SqliteUnboundDatabase extends NamespaceBase {
|
|
469
|
-
static instance = new SqliteUnboundDatabase();
|
|
470
|
-
kind = "database";
|
|
471
|
-
id = UNBOUND_NAMESPACE_ID;
|
|
472
|
-
tables;
|
|
473
|
-
constructor() {
|
|
474
|
-
super();
|
|
475
|
-
this.tables = Object.freeze({});
|
|
476
|
-
freezeNode(this);
|
|
477
|
-
}
|
|
478
|
-
qualifier() {
|
|
479
|
-
return "";
|
|
480
|
-
}
|
|
481
|
-
qualifyTable(tableName) {
|
|
482
|
-
return `"${tableName}"`;
|
|
483
|
-
}
|
|
484
|
-
};
|
|
485
|
-
/**
|
|
486
|
-
* Target-supplied `Namespace` factory the SQLite target plumbs through
|
|
487
|
-
* `defineContract({ createNamespace })`. SQLite has only one
|
|
488
|
-
* effective namespace slot — the framework `UNBOUND_NAMESPACE_ID`
|
|
489
|
-
* sentinel — so the factory always returns the singleton and rejects
|
|
490
|
-
* any other coordinate. The SQL family's defensive validation in
|
|
491
|
-
* `defineContract` already rejects user-declared SQLite namespaces, so
|
|
492
|
-
* this throw is a structural safety net rather than a user-facing
|
|
493
|
-
* surface.
|
|
494
|
-
*/
|
|
495
|
-
function sqliteCreateNamespace(id) {
|
|
496
|
-
if (id === UNBOUND_NAMESPACE_ID) return SqliteUnboundDatabase.instance;
|
|
497
|
-
throw new Error(`sqliteCreateNamespace: SQLite has no schema concept; the only valid namespace id is "${UNBOUND_NAMESPACE_ID}" (received "${id}").`);
|
|
498
|
-
}
|
|
499
|
-
//#endregion
|
|
500
442
|
export { SqliteUnboundDatabase, sqliteControlTargetDescriptor as default, sqliteCreateNamespace };
|
|
501
443
|
|
|
502
444
|
//# sourceMappingURL=control.mjs.map
|