@prisma/orm-target-sqlite 8.0.0-rc.20-dev.2 → 8.0.0-rc.20-dev.4

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.
@@ -64,7 +64,7 @@ declare const sqliteAdapterContractContributions: {
64
64
  readonly operation: "sum";
65
65
  readonly input: {
66
66
  readonly kind: "codec";
67
- readonly codecId: "sql/int@1" | "sqlite/bigintnumber@1" | "sqlite/bigint@1" | "sqlite/integer@1";
67
+ readonly codecId: "sql/int@1" | "sqlite/integer@1" | "sqlite/bigint@1" | "sqlite/bigintnumber@1";
68
68
  };
69
69
  readonly output: {
70
70
  readonly kind: "codec";
@@ -75,7 +75,7 @@ declare const sqliteAdapterContractContributions: {
75
75
  readonly operation: "sumBigInt";
76
76
  readonly input: {
77
77
  readonly kind: "codec";
78
- readonly codecId: "sql/int@1" | "sqlite/bigintnumber@1" | "sqlite/bigint@1" | "sqlite/integer@1";
78
+ readonly codecId: "sql/int@1" | "sqlite/integer@1" | "sqlite/bigint@1" | "sqlite/bigintnumber@1";
79
79
  };
80
80
  readonly output: {
81
81
  readonly kind: "codec";
@@ -100,7 +100,7 @@ declare const sqliteAdapterContractContributions: {
100
100
  readonly operation: "avg";
101
101
  readonly input: {
102
102
  readonly kind: "codec";
103
- readonly codecId: "sql/int@1" | "sql/float@1" | "sqlite/bigintnumber@1" | "sqlite/bigint@1" | "sqlite/integer@1" | "sqlite/real@1";
103
+ readonly codecId: "sql/int@1" | "sql/float@1" | "sqlite/integer@1" | "sqlite/real@1" | "sqlite/bigint@1" | "sqlite/bigintnumber@1";
104
104
  };
105
105
  readonly output: {
106
106
  readonly kind: "codec";
@@ -131,7 +131,7 @@ declare const sqliteAdapterContractContributions: {
131
131
  readonly operation: "min";
132
132
  readonly input: {
133
133
  readonly kind: "codec";
134
- readonly codecId: "sqlite/datetime@1" | "sqlite/json@1" | "sqlite/blob@1";
134
+ readonly codecId: "sqlite/blob@1" | "sqlite/datetime@1" | "sqlite/json@1";
135
135
  };
136
136
  readonly output: {
137
137
  readonly kind: "self";
@@ -172,7 +172,7 @@ declare const sqliteAdapterContractContributions: {
172
172
  readonly operation: "max";
173
173
  readonly input: {
174
174
  readonly kind: "codec";
175
- readonly codecId: "sqlite/datetime@1" | "sqlite/json@1" | "sqlite/blob@1";
175
+ readonly codecId: "sqlite/blob@1" | "sqlite/datetime@1" | "sqlite/json@1";
176
176
  };
177
177
  readonly output: {
178
178
  readonly kind: "self";
@@ -194,4 +194,4 @@ declare const sqliteAdapterContractContributions: {
194
194
  };
195
195
  //#endregion
196
196
  export { sqliteAdapterContractContributions as n, sqliteAdapterCapabilities as t };
197
- //# sourceMappingURL=adapter-C3hrAasJ.d.mts.map
197
+ //# sourceMappingURL=adapter-BHJEOmT6.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"adapter-C3hrAasJ.d.mts","names":[],"sources":["../../../../3-targets/sqlite/2-adapter/dist/adapter.d.mts"],"mappings":";;;;cAGc,2BAA2B;WAC9B;aACE;aACA;aACA;aACA;aACA;aACA;aACA;aACA;aACA;;;;;;;;cAQC;WACH,cAAc;aACZ;eACE;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA;;;WAGJ;aACE;eACE;eACA;iBACE;;eAEF;iBACE;iBACA;;eAEF;eACA;eACA,6EAA6E;;eAE7E;eACA;iBACE;;eAEF;iBACE;iBACA;;eAEF;eACA;eACA,6EAA6E;;eAE7E,8EAA8E;eAC9E;eACA;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;;eAEA;eACA;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;eACA,6EAA6E;;eAE7E,8EAA8E;eAC9E;eACA;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;;eAEA,8EAA8E;eAC9E;eACA;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;;eAEA;eACA;iBACE;iBACA;;eAEF;iBACE;;eAEF;;eAEA;eACA;iBACE;iBACA;;eAEF;iBACE;;eAEF;;eAEA;eACA;iBACE;iBACA;;eAEF;iBACE;;eAEF;;eAEA;eACA;iBACE;iBACA;;eAEF;iBACE;;eAEF;eACA,6EAA6E;;eAE7E;eACA;iBACE;iBACA;;eAEF;iBACE;;eAEF;;eAEA;eACA;iBACE;iBACA;;eAEF;iBACE;;eAEF;;eAEA;eACA;iBACE;iBACA;;eAEF;iBACE;;eAEF;;eAEA;eACA;iBACE;iBACA;;eAEF;iBACE;;eAEF;eACA,6EAA6E"}
1
+ {"version":3,"file":"adapter-BHJEOmT6.d.mts","names":[],"sources":["../../../../3-targets/sqlite/2-adapter/dist/adapter.d.mts"],"mappings":";;;;cAGc,2BAA2B;WAC9B;aACE;aACA;aACA;aACA;aACA;aACA;aACA;aACA;aACA;;;;;;;;cAQC;WACH,cAAc;aACZ;eACE;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA;;;WAGJ;aACE;eACE;eACA;iBACE;;eAEF;iBACE;iBACA;;eAEF;eACA;eACA,6EAA6E;;eAE7E;eACA;iBACE;;eAEF;iBACE;iBACA;;eAEF;eACA;eACA,6EAA6E;;eAE7E,8EAA8E;eAC9E;eACA;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;;eAEA;eACA;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;eACA,6EAA6E;;eAE7E,8EAA8E;eAC9E;eACA;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;;eAEA,8EAA8E;eAC9E;eACA;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;;eAEA;eACA;iBACE;iBACA;;eAEF;iBACE;;eAEF;;eAEA;eACA;iBACE;iBACA;;eAEF;iBACE;;eAEF;;eAEA;eACA;iBACE;iBACA;;eAEF;iBACE;;eAEF;;eAEA;eACA;iBACE;iBACA;;eAEF;iBACE;;eAEF;eACA,6EAA6E;;eAE7E;eACA;iBACE;iBACA;;eAEF;iBACE;;eAEF;;eAEA;eACA;iBACE;iBACA;;eAEF;iBACE;;eAEF;;eAEA;eACA;iBACE;iBACA;;eAEF;iBACE;;eAEF;;eAEA;eACA;iBACE;iBACA;;eAEF;iBACE;;eAEF;eACA,6EAA6E"}
@@ -1,7 +1,7 @@
1
1
  import { n as SqliteContract, r as SqliteLoweredStatement, t as SqliteAdapterOptions } from "./types-RJMd2PlL-BTGAJrBQ.mjs";
2
2
  import { m as createSqliteCodecRegistryWithBuiltins, o as SqliteCodecRegistry, p as createSqliteBuiltinCodecLookup, t as JsonValue$1 } from "./codecs-BJYruC-a-BKDGae3k.mjs";
3
3
  import { i as sqliteRawCodecInferer, r as renderLoweredSql, t as createSqliteAdapter } from "./adapter-xFPDhkod-BsdLsy9N.mjs";
4
- import { n as sqliteAdapterContractContributions, t as sqliteAdapterCapabilities } from "./adapter-C3hrAasJ.mjs";
4
+ import { n as sqliteAdapterContractContributions, t as sqliteAdapterCapabilities } from "./adapter-BHJEOmT6.mjs";
5
5
  import { t as CodecTypes } from "./codec-types-COh75Bop-CUehAexc.mjs";
6
6
  import "./codec-types-PONhVn74.mjs";
7
7
  import { a as jsonColumn, c as textColumn, i as integerColumn, n as blobColumn, o as rawColumn, r as datetimeColumn, s as realColumn, t as bigintColumn } from "./column-types-Dxm0BpPv.mjs";
@@ -1,4 +1,4 @@
1
1
  import { t as SqliteAdapterOptions } from "./types-RJMd2PlL-BTGAJrBQ.mjs";
2
2
  import { i as sqliteRawCodecInferer, t as createSqliteAdapter } from "./adapter-xFPDhkod-BsdLsy9N.mjs";
3
- import { n as sqliteAdapterContractContributions, t as sqliteAdapterCapabilities } from "./adapter-C3hrAasJ.mjs";
3
+ import { n as sqliteAdapterContractContributions, t as sqliteAdapterCapabilities } from "./adapter-BHJEOmT6.mjs";
4
4
  export { type SqliteAdapterOptions, createSqliteAdapter, sqliteAdapterCapabilities, sqliteAdapterContractContributions, sqliteRawCodecInferer };
@@ -33,7 +33,7 @@ declare const sqliteAggregateDescriptors: readonly [{
33
33
  readonly operation: "sum";
34
34
  readonly input: {
35
35
  readonly kind: "codec";
36
- readonly codecId: "sql/int@1" | "sqlite/bigintnumber@1" | "sqlite/bigint@1" | "sqlite/integer@1";
36
+ readonly codecId: "sql/int@1" | "sqlite/integer@1" | "sqlite/bigint@1" | "sqlite/bigintnumber@1";
37
37
  };
38
38
  readonly output: {
39
39
  readonly kind: "codec";
@@ -44,7 +44,7 @@ declare const sqliteAggregateDescriptors: readonly [{
44
44
  readonly operation: "sumBigInt";
45
45
  readonly input: {
46
46
  readonly kind: "codec";
47
- readonly codecId: "sql/int@1" | "sqlite/bigintnumber@1" | "sqlite/bigint@1" | "sqlite/integer@1";
47
+ readonly codecId: "sql/int@1" | "sqlite/integer@1" | "sqlite/bigint@1" | "sqlite/bigintnumber@1";
48
48
  };
49
49
  readonly output: {
50
50
  readonly kind: "codec";
@@ -69,7 +69,7 @@ declare const sqliteAggregateDescriptors: readonly [{
69
69
  readonly operation: "avg";
70
70
  readonly input: {
71
71
  readonly kind: "codec";
72
- readonly codecId: "sql/int@1" | "sql/float@1" | "sqlite/bigintnumber@1" | "sqlite/bigint@1" | "sqlite/integer@1" | "sqlite/real@1";
72
+ readonly codecId: "sql/int@1" | "sql/float@1" | "sqlite/integer@1" | "sqlite/real@1" | "sqlite/bigint@1" | "sqlite/bigintnumber@1";
73
73
  };
74
74
  readonly output: {
75
75
  readonly kind: "codec";
@@ -100,7 +100,7 @@ declare const sqliteAggregateDescriptors: readonly [{
100
100
  readonly operation: "min";
101
101
  readonly input: {
102
102
  readonly kind: "codec";
103
- readonly codecId: "sqlite/datetime@1" | "sqlite/json@1" | "sqlite/blob@1";
103
+ readonly codecId: "sqlite/blob@1" | "sqlite/datetime@1" | "sqlite/json@1";
104
104
  };
105
105
  readonly output: {
106
106
  readonly kind: "self";
@@ -141,7 +141,7 @@ declare const sqliteAggregateDescriptors: readonly [{
141
141
  readonly operation: "max";
142
142
  readonly input: {
143
143
  readonly kind: "codec";
144
- readonly codecId: "sqlite/datetime@1" | "sqlite/json@1" | "sqlite/blob@1";
144
+ readonly codecId: "sqlite/blob@1" | "sqlite/datetime@1" | "sqlite/json@1";
145
145
  };
146
146
  readonly output: {
147
147
  readonly kind: "self";
@@ -161,4 +161,4 @@ declare const sqliteAggregateDescriptors: readonly [{
161
161
  }];
162
162
  //#endregion
163
163
  export { sqliteAggregateDescriptors as t };
164
- //# sourceMappingURL=aggregates-UBmpuURb.d.mts.map
164
+ //# sourceMappingURL=aggregates-CDMoiy_Z.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"aggregates-UBmpuURb.d.mts","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/aggregates.d.mts"],"mappings":";;;;;;cAKc;WACH;WACA;aACE;;WAEF;aACE;aACA;;WAEF;WACA;WACA,OAAO;;WAEP;WACA;aACE;;WAEF;aACE;aACA;;WAEF;WACA;WACA,OAAO;;WAEP,QAAQ;WACR;WACA;aACE;aACA;;WAEF;aACE;aACA;;WAEF;;WAEA;WACA;aACE;aACA;;WAEF;aACE;aACA;;WAEF;WACA,OAAO;;WAEP,QAAQ;WACR;WACA;aACE;aACA;;WAEF;aACE;aACA;;WAEF;;WAEA,QAAQ;WACR;WACA;aACE;aACA;;WAEF;aACE;aACA;;WAEF;;WAEA;WACA;aACE;aACA;;WAEF;aACE;;WAEF;;WAEA;WACA;aACE;aACA;;WAEF;aACE;;WAEF;;WAEA;WACA;aACE;aACA;;WAEF;aACE;;WAEF;;WAEA;WACA;aACE;aACA;;WAEF;aACE;;WAEF;WACA,OAAO;;WAEP;WACA;aACE;aACA;;WAEF;aACE;;WAEF;;WAEA;WACA;aACE;aACA;;WAEF;aACE;;WAEF;;WAEA;WACA;aACE;aACA;;WAEF;aACE;;WAEF;;WAEA;WACA;aACE;aACA;;WAEF;aACE;;WAEF;WACA,OAAO"}
1
+ {"version":3,"file":"aggregates-CDMoiy_Z.d.mts","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/aggregates.d.mts"],"mappings":";;;;;;cAKc;WACH;WACA;aACE;;WAEF;aACE;aACA;;WAEF;WACA;WACA,OAAO;;WAEP;WACA;aACE;;WAEF;aACE;aACA;;WAEF;WACA;WACA,OAAO;;WAEP,QAAQ;WACR;WACA;aACE;aACA;;WAEF;aACE;aACA;;WAEF;;WAEA;WACA;aACE;aACA;;WAEF;aACE;aACA;;WAEF;WACA,OAAO;;WAEP,QAAQ;WACR;WACA;aACE;aACA;;WAEF;aACE;aACA;;WAEF;;WAEA,QAAQ;WACR;WACA;aACE;aACA;;WAEF;aACE;aACA;;WAEF;;WAEA;WACA;aACE;aACA;;WAEF;aACE;;WAEF;;WAEA;WACA;aACE;aACA;;WAEF;aACE;;WAEF;;WAEA;WACA;aACE;aACA;;WAEF;aACE;;WAEF;;WAEA;WACA;aACE;aACA;;WAEF;aACE;;WAEF;WACA,OAAO;;WAEP;WACA;aACE;aACA;;WAEF;aACE;;WAEF;;WAEA;WACA;aACE;aACA;;WAEF;aACE;;WAEF;;WAEA;WACA;aACE;aACA;;WAEF;aACE;;WAEF;;WAEA;WACA;aACE;aACA;;WAEF;aACE;;WAEF;WACA,OAAO"}
@@ -1,4 +1,4 @@
1
- import { n as sqliteDriverDescriptorMeta, r as sqliteParams, t as normalizeSqliteError } from "./descriptor-meta-cwy5CXTT-CLOhiryX.mjs";
1
+ import { a as wasClosedByDriver, i as sqliteParams, n as normalizeSqliteError, r as sqliteDriverDescriptorMeta, t as closeDatabase } from "./descriptor-meta-Drr6Abaf-P67SenMd.mjs";
2
2
  import { errorRuntime } from "@prisma/orm-framework/errors/execution";
3
3
  import { DatabaseSync } from "node:sqlite";
4
4
  import { pathToFileURL } from "node:url";
@@ -17,7 +17,7 @@ var SqliteControlDriver = class {
17
17
  try {
18
18
  return { rows: this.db.prepare(sql).all(...sqliteParams(params)) };
19
19
  } catch (error) {
20
- throw normalizeSqliteError(error);
20
+ throw normalizeSqliteError(error, wasClosedByDriver(this.db));
21
21
  }
22
22
  }
23
23
  async databaseName() {
@@ -26,7 +26,7 @@ var SqliteControlDriver = class {
26
26
  return name.length > 0 ? name : void 0;
27
27
  }
28
28
  async close() {
29
- this.db.close();
29
+ closeDatabase(this.db);
30
30
  }
31
31
  };
32
32
  /** The file as a URI that SQLite opens for reading and writing, failing rather than creating it. */
@@ -57,4 +57,4 @@ const sqliteDriverDescriptor = {
57
57
  //#endregion
58
58
  export { sqliteDriverDescriptor as n, SqliteControlDriver as t };
59
59
 
60
- //# sourceMappingURL=control-BxbKU2xs.mjs.map
60
+ //# sourceMappingURL=control-BvT30n3D.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-BvT30n3D.mjs","names":[],"sources":["../../../../3-targets/sqlite/3-driver/dist/control.mjs"],"sourcesContent":["import { a as wasClosedByDriver, i as closeDatabase, n as sqliteParams, r as normalizeSqliteError, t as sqliteDriverDescriptorMeta } from \"./descriptor-meta-Drr6Abaf.mjs\";\nimport { DatabaseSync } from \"node:sqlite\";\nimport { pathToFileURL } from \"node:url\";\nimport { errorRuntime } from \"@internal/errors/execution\";\nimport { basename } from \"pathe\";\n//#region src/core/migrations/control-driver.ts\nvar SqliteControlDriver = class {\n\tdb;\n\tlocation;\n\tfamilyId = \"sql\";\n\ttargetId = \"sqlite\";\n\tconstructor(db, location) {\n\t\tthis.db = db;\n\t\tthis.location = location;\n\t}\n\tasync query(sql, params) {\n\t\ttry {\n\t\t\treturn { rows: this.db.prepare(sql).all(...sqliteParams(params)) };\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t}\n\t}\n\tasync databaseName() {\n\t\tif (this.location === \":memory:\" || this.location.length === 0) return;\n\t\tconst name = basename(this.location);\n\t\treturn name.length > 0 ? name : void 0;\n\t}\n\tasync close() {\n\t\tcloseDatabase(this.db);\n\t}\n};\n/** The file as a URI that SQLite opens for reading and writing, failing rather than creating it. */\nfunction existingFileOnly(pathOrMemory) {\n\tif (pathOrMemory === \":memory:\") return pathOrMemory;\n\tconst uri = pathToFileURL(pathOrMemory);\n\turi.searchParams.set(\"mode\", \"rw\");\n\treturn uri;\n}\nconst sqliteDriverDescriptor = {\n\t...sqliteDriverDescriptorMeta,\n\tasync create(pathOrMemory, options) {\n\t\ttry {\n\t\t\tconst db = new DatabaseSync(options?.existingDatabaseOnly === true ? existingFileOnly(pathOrMemory) : pathOrMemory);\n\t\t\tdb.exec(\"PRAGMA foreign_keys = ON\");\n\t\t\tdb.exec(\"PRAGMA busy_timeout = 5000\");\n\t\t\treturn new SqliteControlDriver(db, pathOrMemory);\n\t\t} catch (error) {\n\t\t\tthrow errorRuntime(\"DRIVER.CONNECTION_FAILED\", \"Database connection failed\", {\n\t\t\t\twhy: error instanceof Error ? error.message : String(error),\n\t\t\t\tfix: \"Verify the database file path exists and is accessible\",\n\t\t\t\tmeta: { path: pathOrMemory },\n\t\t\t\tcause: error\n\t\t\t});\n\t\t}\n\t}\n};\n//#endregion\nexport { SqliteControlDriver, sqliteDriverDescriptor as default };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;AAMA,IAAI,sBAAsB,MAAM;CAC/B;CACA;CACA,WAAW;CACX,WAAW;CACX,YAAY,IAAI,UAAU;EACzB,KAAK,KAAK;EACV,KAAK,WAAW;CACjB;CACA,MAAM,MAAM,KAAK,QAAQ;EACxB,IAAI;GACH,OAAO,EAAE,MAAM,KAAK,GAAG,QAAQ,GAAG,CAAC,CAAC,IAAI,GAAG,aAAa,MAAM,CAAC,EAAE;EAClE,SAAS,OAAO;GACf,MAAM,qBAAqB,OAAO,kBAAkB,KAAK,EAAE,CAAC;EAC7D;CACD;CACA,MAAM,eAAe;EACpB,IAAI,KAAK,aAAa,cAAc,KAAK,SAAS,WAAW,GAAG;EAChE,MAAM,OAAO,SAAS,KAAK,QAAQ;EACnC,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK;CACtC;CACA,MAAM,QAAQ;EACb,cAAc,KAAK,EAAE;CACtB;AACD;;AAEA,SAAS,iBAAiB,cAAc;CACvC,IAAI,iBAAiB,YAAY,OAAO;CACxC,MAAM,MAAM,cAAc,YAAY;CACtC,IAAI,aAAa,IAAI,QAAQ,IAAI;CACjC,OAAO;AACR;AACA,MAAM,yBAAyB;CAC9B,GAAG;CACH,MAAM,OAAO,cAAc,SAAS;EACnC,IAAI;GACH,MAAM,KAAK,IAAI,aAAa,SAAS,yBAAyB,OAAO,iBAAiB,YAAY,IAAI,YAAY;GAClH,GAAG,KAAK,0BAA0B;GAClC,GAAG,KAAK,4BAA4B;GACpC,OAAO,IAAI,oBAAoB,IAAI,YAAY;EAChD,SAAS,OAAO;GACf,MAAM,aAAa,4BAA4B,8BAA8B;IAC5E,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;IAC1D,KAAK;IACL,MAAM,EAAE,MAAM,aAAa;IAC3B,OAAO;GACR,CAAC;EACF;CACD;AACD"}
@@ -1,7 +1,17 @@
1
1
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
2
2
  import { blindCast } from "@prisma/orm-framework/utils/casts";
3
3
  import { SqlConnectionError, SqlQueryError } from "@prisma/orm-family-sql/errors";
4
- //#region ../../../3-targets/sqlite/3-driver/dist/descriptor-meta-cwy5CXTT.mjs
4
+ //#region ../../../3-targets/sqlite/3-driver/dist/descriptor-meta-Drr6Abaf.mjs
5
+ const closedByDriver = /* @__PURE__ */ new WeakSet();
6
+ /** Closes a database the driver opened and records that the driver closed it. */
7
+ function closeDatabase(db) {
8
+ db.close();
9
+ closedByDriver.add(db);
10
+ }
11
+ /** Whether the driver itself closed this database. */
12
+ function wasClosedByDriver(db) {
13
+ return closedByDriver.has(db);
14
+ }
5
15
  const SQLITE_CONSTRAINT_BASE = 19;
6
16
  const SQLITE_CONSTRAINT_UNIQUE = 2067;
7
17
  const SQLITE_CONSTRAINT_PRIMARYKEY = 1555;
@@ -10,6 +20,10 @@ const SQLITE_CONSTRAINT_NOTNULL = 1299;
10
20
  const SQLITE_CONSTRAINT_CHECK = 275;
11
21
  const SQLITE_BUSY = 5;
12
22
  const SQLITE_LOCKED = 6;
23
+ const SQLITE_CANTOPEN = 14;
24
+ const SQLITE_NOTADB = 26;
25
+ const INVALID_STATE_CODE = "ERR_INVALID_STATE";
26
+ const GENERAL_ERROR_SQLSTATE = "HY000";
13
27
  function isConstraintError(errcode) {
14
28
  return (errcode & 255) === SQLITE_CONSTRAINT_BASE;
15
29
  }
@@ -17,10 +31,18 @@ function isBusyOrLocked(errcode) {
17
31
  const base = errcode & 255;
18
32
  return base === SQLITE_BUSY || base === SQLITE_LOCKED;
19
33
  }
34
+ function isOpenFailure(errcode) {
35
+ const base = errcode & 255;
36
+ return base === SQLITE_CANTOPEN || base === SQLITE_NOTADB;
37
+ }
20
38
  function isSqliteError(error) {
21
39
  if (!(error instanceof Error)) return false;
22
40
  return error.code === "ERR_SQLITE_ERROR";
23
41
  }
42
+ /**
43
+ * The one place the driver reads SQLite's message: SQLite reports which constraint failed only
44
+ * in the text, as in "UNIQUE constraint failed: table.column".
45
+ */
24
46
  function constraintNameFromMessage(message) {
25
47
  return /constraint failed: (.+)/.exec(message)?.[1];
26
48
  }
@@ -33,10 +55,14 @@ function mapErrCodeToSqlState(errcode) {
33
55
  case SQLITE_CONSTRAINT_CHECK: return "23514";
34
56
  default:
35
57
  if (isConstraintError(errcode)) return "23000";
36
- return "HY000";
58
+ return GENERAL_ERROR_SQLSTATE;
37
59
  }
38
60
  }
39
- function normalizeSqliteError(error) {
61
+ /**
62
+ * Normalizes a node:sqlite error. `databaseClosedByDriver` says whether the driver closed the
63
+ * database the failing call used; only then is a wrong-state error a closed-database connection error.
64
+ */
65
+ function normalizeSqliteError(error, databaseClosedByDriver) {
40
66
  if (!(error instanceof Error)) return new Error(String(error));
41
67
  if (isSqliteError(error)) {
42
68
  const errcode = error.errcode ?? 0;
@@ -44,6 +70,10 @@ function normalizeSqliteError(error) {
44
70
  cause: error,
45
71
  transient: true
46
72
  });
73
+ if (isOpenFailure(errcode)) return new SqlConnectionError(error.message, {
74
+ cause: error,
75
+ transient: false
76
+ });
47
77
  const sqlState = mapErrCodeToSqlState(errcode);
48
78
  const constraint = constraintNameFromMessage(error.message);
49
79
  return new SqlQueryError(error.message, {
@@ -52,9 +82,12 @@ function normalizeSqliteError(error) {
52
82
  ...constraint !== void 0 ? { constraint } : {}
53
83
  });
54
84
  }
55
- if (error.message.includes("database is locked") || error.message.includes("unable to open database")) return new SqlConnectionError(error.message, {
85
+ if ("code" in error && error.code === INVALID_STATE_CODE) return databaseClosedByDriver ? new SqlConnectionError(error.message, {
56
86
  cause: error,
57
87
  transient: false
88
+ }) : new SqlQueryError(error.message, {
89
+ cause: error,
90
+ sqlState: GENERAL_ERROR_SQLSTATE
58
91
  });
59
92
  return error;
60
93
  }
@@ -79,6 +112,6 @@ const sqliteDriverDescriptorMeta = {
79
112
  capabilities: {}
80
113
  };
81
114
  //#endregion
82
- export { sqliteDriverDescriptorMeta as n, sqliteParams as r, normalizeSqliteError as t };
115
+ export { wasClosedByDriver as a, sqliteParams as i, normalizeSqliteError as n, sqliteDriverDescriptorMeta as r, closeDatabase as t };
83
116
 
84
- //# sourceMappingURL=descriptor-meta-cwy5CXTT-CLOhiryX.mjs.map
117
+ //# sourceMappingURL=descriptor-meta-Drr6Abaf-P67SenMd.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor-meta-Drr6Abaf-P67SenMd.mjs","names":[],"sources":["../../../../3-targets/sqlite/3-driver/dist/descriptor-meta-Drr6Abaf.mjs"],"sourcesContent":["import { SqlConnectionError, SqlQueryError } from \"@internal/sql-errors\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/database-state.ts\nconst closedByDriver = /* @__PURE__ */ new WeakSet();\n/** Closes a database the driver opened and records that the driver closed it. */\nfunction closeDatabase(db) {\n\tdb.close();\n\tclosedByDriver.add(db);\n}\n/** Whether the driver itself closed this database. */\nfunction wasClosedByDriver(db) {\n\treturn closedByDriver.has(db);\n}\n//#endregion\n//#region src/normalize-error.ts\nconst SQLITE_CONSTRAINT_BASE = 19;\nconst SQLITE_CONSTRAINT_UNIQUE = 2067;\nconst SQLITE_CONSTRAINT_PRIMARYKEY = 1555;\nconst SQLITE_CONSTRAINT_FOREIGNKEY = 787;\nconst SQLITE_CONSTRAINT_NOTNULL = 1299;\nconst SQLITE_CONSTRAINT_CHECK = 275;\nconst SQLITE_BUSY = 5;\nconst SQLITE_LOCKED = 6;\nconst SQLITE_CANTOPEN = 14;\nconst SQLITE_NOTADB = 26;\nconst INVALID_STATE_CODE = \"ERR_INVALID_STATE\";\nconst GENERAL_ERROR_SQLSTATE = \"HY000\";\nfunction isConstraintError(errcode) {\n\treturn (errcode & 255) === SQLITE_CONSTRAINT_BASE;\n}\nfunction isBusyOrLocked(errcode) {\n\tconst base = errcode & 255;\n\treturn base === SQLITE_BUSY || base === SQLITE_LOCKED;\n}\nfunction isOpenFailure(errcode) {\n\tconst base = errcode & 255;\n\treturn base === SQLITE_CANTOPEN || base === SQLITE_NOTADB;\n}\nfunction isSqliteError(error) {\n\tif (!(error instanceof Error)) return false;\n\treturn error.code === \"ERR_SQLITE_ERROR\";\n}\n/**\n* The one place the driver reads SQLite's message: SQLite reports which constraint failed only\n* in the text, as in \"UNIQUE constraint failed: table.column\".\n*/\nfunction constraintNameFromMessage(message) {\n\treturn /constraint failed: (.+)/.exec(message)?.[1];\n}\nfunction mapErrCodeToSqlState(errcode) {\n\tswitch (errcode) {\n\t\tcase SQLITE_CONSTRAINT_UNIQUE:\n\t\tcase SQLITE_CONSTRAINT_PRIMARYKEY: return \"23505\";\n\t\tcase SQLITE_CONSTRAINT_FOREIGNKEY: return \"23503\";\n\t\tcase SQLITE_CONSTRAINT_NOTNULL: return \"23502\";\n\t\tcase SQLITE_CONSTRAINT_CHECK: return \"23514\";\n\t\tdefault:\n\t\t\tif (isConstraintError(errcode)) return \"23000\";\n\t\t\treturn GENERAL_ERROR_SQLSTATE;\n\t}\n}\n/**\n* Normalizes a node:sqlite error. `databaseClosedByDriver` says whether the driver closed the\n* database the failing call used; only then is a wrong-state error a closed-database connection error.\n*/\nfunction normalizeSqliteError(error, databaseClosedByDriver) {\n\tif (!(error instanceof Error)) return new Error(String(error));\n\tif (isSqliteError(error)) {\n\t\tconst errcode = error.errcode ?? 0;\n\t\tif (isBusyOrLocked(errcode)) return new SqlConnectionError(error.message, {\n\t\t\tcause: error,\n\t\t\ttransient: true\n\t\t});\n\t\tif (isOpenFailure(errcode)) return new SqlConnectionError(error.message, {\n\t\t\tcause: error,\n\t\t\ttransient: false\n\t\t});\n\t\tconst sqlState = mapErrCodeToSqlState(errcode);\n\t\tconst constraint = constraintNameFromMessage(error.message);\n\t\treturn new SqlQueryError(error.message, {\n\t\t\tcause: error,\n\t\t\tsqlState,\n\t\t\t...constraint !== void 0 ? { constraint } : {}\n\t\t});\n\t}\n\tif (\"code\" in error && error.code === INVALID_STATE_CODE) return databaseClosedByDriver ? new SqlConnectionError(error.message, {\n\t\tcause: error,\n\t\ttransient: false\n\t}) : new SqlQueryError(error.message, {\n\t\tcause: error,\n\t\tsqlState: GENERAL_ERROR_SQLSTATE\n\t});\n\treturn error;\n}\n//#endregion\n//#region src/sqlite-params.ts\n/**\n* The parameters to bind to a SQLite statement. SQLite cannot store NaN and binds it as NULL. The float codecs refuse NaN when they encode, naming the codec; this refuses a NaN no codec encoded, such as a raw SQL parameter, with the same code and `meta.received`, and `meta.paramIndex` in place of `meta.codecId`.\n*/\nfunction sqliteParams(params) {\n\tconst values = params ?? [];\n\tconst nanIndex = values.findIndex((value) => Number.isNaN(value));\n\tif (nanIndex !== -1) throw structuredError(\"RUNTIME.ENCODE_FAILED\", `Parameter ${nanIndex + 1} is NaN, which SQLite cannot store: it would bind it as NULL. Pass null to store no value.`, { meta: {\n\t\tparamIndex: nanIndex,\n\t\treceived: \"NaN\"\n\t} });\n\treturn blindCast(values);\n}\n//#endregion\n//#region src/core/descriptor-meta.ts\nconst sqliteDriverDescriptorMeta = {\n\tkind: \"driver\",\n\tfamilyId: \"sql\",\n\ttargetId: \"sqlite\",\n\tid: \"sqlite\",\n\tversion: \"0.0.1\",\n\tcapabilities: {}\n};\n//#endregion\nexport { wasClosedByDriver as a, closeDatabase as i, sqliteParams as n, normalizeSqliteError as r, sqliteDriverDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-Drr6Abaf.mjs.map"],"mappings":";;;;AAIA,MAAM,iCAAiC,IAAI,QAAQ;;AAEnD,SAAS,cAAc,IAAI;CAC1B,GAAG,MAAM;CACT,eAAe,IAAI,EAAE;AACtB;;AAEA,SAAS,kBAAkB,IAAI;CAC9B,OAAO,eAAe,IAAI,EAAE;AAC7B;AAGA,MAAM,yBAAyB;AAC/B,MAAM,2BAA2B;AACjC,MAAM,+BAA+B;AACrC,MAAM,+BAA+B;AACrC,MAAM,4BAA4B;AAClC,MAAM,0BAA0B;AAChC,MAAM,cAAc;AACpB,MAAM,gBAAgB;AACtB,MAAM,kBAAkB;AACxB,MAAM,gBAAgB;AACtB,MAAM,qBAAqB;AAC3B,MAAM,yBAAyB;AAC/B,SAAS,kBAAkB,SAAS;CACnC,QAAQ,UAAU,SAAS;AAC5B;AACA,SAAS,eAAe,SAAS;CAChC,MAAM,OAAO,UAAU;CACvB,OAAO,SAAS,eAAe,SAAS;AACzC;AACA,SAAS,cAAc,SAAS;CAC/B,MAAM,OAAO,UAAU;CACvB,OAAO,SAAS,mBAAmB,SAAS;AAC7C;AACA,SAAS,cAAc,OAAO;CAC7B,IAAI,EAAE,iBAAiB,QAAQ,OAAO;CACtC,OAAO,MAAM,SAAS;AACvB;;;;;AAKA,SAAS,0BAA0B,SAAS;CAC3C,OAAO,0BAA0B,KAAK,OAAO,CAAC,GAAG;AAClD;AACA,SAAS,qBAAqB,SAAS;CACtC,QAAQ,SAAR;EACC,KAAK;EACL,KAAK,8BAA8B,OAAO;EAC1C,KAAK,8BAA8B,OAAO;EAC1C,KAAK,2BAA2B,OAAO;EACvC,KAAK,yBAAyB,OAAO;EACrC;GACC,IAAI,kBAAkB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liteControlDriver } from "./control-BxbKU2xs.mjs";
1
+ import { t as SqliteControlDriver } from "./control-BvT30n3D.mjs";
2
2
  export { SqliteControlDriver };
@@ -1,2 +1,2 @@
1
- import { n as sqliteDriverDescriptor, t as SqliteControlDriver } from "./control-BxbKU2xs.mjs";
1
+ import { n as sqliteDriverDescriptor, t as SqliteControlDriver } from "./control-BvT30n3D.mjs";
2
2
  export { SqliteControlDriver, sqliteDriverDescriptor as default };
@@ -1,4 +1,4 @@
1
- import { n as sqliteDriverDescriptorMeta, r as sqliteParams, t as normalizeSqliteError } from "./descriptor-meta-cwy5CXTT-CLOhiryX.mjs";
1
+ import { a as wasClosedByDriver, i as sqliteParams, n as normalizeSqliteError, r as sqliteDriverDescriptorMeta, t as closeDatabase } from "./descriptor-meta-Drr6Abaf-P67SenMd.mjs";
2
2
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
3
3
  import { DatabaseSync } from "node:sqlite";
4
4
  //#region ../../../3-targets/sqlite/3-driver/dist/runtime.mjs
@@ -25,7 +25,7 @@ function openConnection(path) {
25
25
  db.exec("PRAGMA busy_timeout = 5000");
26
26
  return db;
27
27
  } catch (error) {
28
- throw normalizeSqliteError(error);
28
+ throw normalizeSqliteError(error, false);
29
29
  }
30
30
  }
31
31
  var SqliteQueryable = class {
@@ -38,7 +38,7 @@ var SqliteQueryable = class {
38
38
  const stmt = this.db.prepare(request.sql);
39
39
  for (const row of stmt.iterate(...sqliteParams(request.params))) yield row;
40
40
  } catch (error) {
41
- throw normalizeSqliteError(error);
41
+ throw normalizeSqliteError(error, wasClosedByDriver(this.db));
42
42
  }
43
43
  }
44
44
  async execute(request) {
@@ -47,14 +47,14 @@ var SqliteQueryable = class {
47
47
  if (stmt.columns().length !== 0) throw new InternalError("SQLite cannot execute statements that return rows.");
48
48
  return { affectedRows: Number(stmt.run(...sqliteParams(request.params)).changes) };
49
49
  } catch (error) {
50
- throw normalizeSqliteError(error);
50
+ throw normalizeSqliteError(error, wasClosedByDriver(this.db));
51
51
  }
52
52
  }
53
53
  async explain(request) {
54
54
  try {
55
55
  return { rows: this.db.prepare(`EXPLAIN QUERY PLAN ${request.sql}`).all(...sqliteParams(request.params)) };
56
56
  } catch (error) {
57
- throw normalizeSqliteError(error);
57
+ throw normalizeSqliteError(error, wasClosedByDriver(this.db));
58
58
  }
59
59
  }
60
60
  };
@@ -64,7 +64,7 @@ var SqliteConnectionImpl = class extends SqliteQueryable {
64
64
  this.db.exec("BEGIN");
65
65
  return new SqliteTransactionImpl(this.db);
66
66
  } catch (error) {
67
- throw normalizeSqliteError(error);
67
+ throw normalizeSqliteError(error, wasClosedByDriver(this.db));
68
68
  }
69
69
  }
70
70
  async release() {
@@ -72,9 +72,9 @@ var SqliteConnectionImpl = class extends SqliteQueryable {
72
72
  }
73
73
  async destroy(_reason) {
74
74
  try {
75
- this.db.close();
75
+ closeDatabase(this.db);
76
76
  } catch (error) {
77
- throw normalizeSqliteError(error);
77
+ throw normalizeSqliteError(error, wasClosedByDriver(this.db));
78
78
  }
79
79
  }
80
80
  };
@@ -83,14 +83,14 @@ var SqliteTransactionImpl = class extends SqliteQueryable {
83
83
  try {
84
84
  this.db.exec("COMMIT");
85
85
  } catch (error) {
86
- throw normalizeSqliteError(error);
86
+ throw normalizeSqliteError(error, wasClosedByDriver(this.db));
87
87
  }
88
88
  }
89
89
  async rollback() {
90
90
  try {
91
91
  this.db.exec("ROLLBACK");
92
92
  } catch (error) {
93
- throw normalizeSqliteError(error);
93
+ throw normalizeSqliteError(error, wasClosedByDriver(this.db));
94
94
  }
95
95
  }
96
96
  };
@@ -1 +1 @@
1
- {"version":3,"file":"driver__runtime.mjs","names":["#state","#requireConnected"],"sources":["../../../../3-targets/sqlite/3-driver/dist/runtime.mjs"],"sourcesContent":["import { n as sqliteParams, r as normalizeSqliteError, t as sqliteDriverDescriptorMeta } from \"./descriptor-meta-cwy5CXTT.mjs\";\nimport { DatabaseSync } from \"node:sqlite\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/sqlite-driver.ts\nfunction driverError(code, message, details) {\n\tconst error = new Error(message);\n\tObject.defineProperty(error, \"name\", {\n\t\tvalue: \"RuntimeError\",\n\t\tconfigurable: true\n\t});\n\treturn Object.assign(error, {\n\t\tcode,\n\t\tcategory: \"DRIVER\",\n\t\tseverity: \"error\",\n\t\tmessage,\n\t\tdetails\n\t});\n}\nconst NOT_CONNECTED_MESSAGE = \"SQLite driver not connected. Call connect(binding) before acquireConnection or execute.\";\nconst ALREADY_CONNECTED_MESSAGE = \"SQLite driver already connected. Call close() before reconnecting with a new binding.\";\nfunction openConnection(path) {\n\ttry {\n\t\tconst db = new DatabaseSync(path);\n\t\tdb.exec(\"PRAGMA foreign_keys = ON\");\n\t\tdb.exec(\"PRAGMA busy_timeout = 5000\");\n\t\treturn db;\n\t} catch (error) {\n\t\tthrow normalizeSqliteError(error);\n\t}\n}\nvar SqliteQueryable = class {\n\tdb;\n\tconstructor(db) {\n\t\tthis.db = db;\n\t}\n\tasync *query(request) {\n\t\ttry {\n\t\t\tconst stmt = this.db.prepare(request.sql);\n\t\t\tfor (const row of stmt.iterate(...sqliteParams(request.params))) yield row;\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error);\n\t\t}\n\t}\n\tasync execute(request) {\n\t\ttry {\n\t\t\tconst stmt = this.db.prepare(request.sql);\n\t\t\tif (stmt.columns().length !== 0) throw new InternalError(\"SQLite cannot execute statements that return rows.\");\n\t\t\treturn { affectedRows: Number(stmt.run(...sqliteParams(request.params)).changes) };\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error);\n\t\t}\n\t}\n\tasync explain(request) {\n\t\ttry {\n\t\t\treturn { rows: this.db.prepare(`EXPLAIN QUERY PLAN ${request.sql}`).all(...sqliteParams(request.params)) };\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error);\n\t\t}\n\t}\n};\nvar SqliteConnectionImpl = class extends SqliteQueryable {\n\tasync beginTransaction() {\n\t\ttry {\n\t\t\tthis.db.exec(\"BEGIN\");\n\t\t\treturn new SqliteTransactionImpl(this.db);\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error);\n\t\t}\n\t}\n\tasync release() {\n\t\treturn this.destroy();\n\t}\n\tasync destroy(_reason) {\n\t\ttry {\n\t\t\tthis.db.close();\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error);\n\t\t}\n\t}\n};\nvar SqliteTransactionImpl = class extends SqliteQueryable {\n\tasync commit() {\n\t\ttry {\n\t\t\tthis.db.exec(\"COMMIT\");\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error);\n\t\t}\n\t}\n\tasync rollback() {\n\t\ttry {\n\t\t\tthis.db.exec(\"ROLLBACK\");\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error);\n\t\t}\n\t}\n};\nfunction unboundQuery() {\n\treturn { [Symbol.asyncIterator]() {\n\t\treturn { async next() {\n\t\t\tthrow driverError(\"DRIVER.NOT_CONNECTED\", NOT_CONNECTED_MESSAGE);\n\t\t} };\n\t} };\n}\nvar SqliteDriver = class {\n\tfamilyId = \"sql\";\n\ttargetId = \"sqlite\";\n\t#state;\n\tconstructor(initialState) {\n\t\tthis.#state = initialState ?? { kind: \"unbound\" };\n\t}\n\t#requireConnected() {\n\t\tif (this.#state.kind !== \"connected\") throw driverError(\"DRIVER.NOT_CONNECTED\", NOT_CONNECTED_MESSAGE);\n\t\treturn this.#state;\n\t}\n\tget state() {\n\t\treturn this.#state.kind;\n\t}\n\tasync connect(binding) {\n\t\tif (this.#state.kind === \"connected\") throw driverError(\"DRIVER.ALREADY_CONNECTED\", ALREADY_CONNECTED_MESSAGE, { bindingKind: binding.kind });\n\t\tthis.#state = {\n\t\t\tkind: \"connected\",\n\t\t\tpath: binding.path,\n\t\t\tconn: new SqliteConnectionImpl(openConnection(binding.path))\n\t\t};\n\t}\n\tasync acquireConnection() {\n\t\tconst { path } = this.#requireConnected();\n\t\treturn new SqliteConnectionImpl(openConnection(path));\n\t}\n\tasync close() {\n\t\tif (this.#state.kind !== \"connected\") return;\n\t\tconst { conn } = this.#state;\n\t\tthis.#state = { kind: \"closed\" };\n\t\tawait conn.release();\n\t}\n\tquery(request) {\n\t\tif (this.#state.kind !== \"connected\") return unboundQuery();\n\t\treturn this.#state.conn.query(request);\n\t}\n\tasync execute(request) {\n\t\treturn this.#requireConnected().conn.execute(request);\n\t}\n\tasync explain(request) {\n\t\treturn this.#requireConnected().conn.explain(request);\n\t}\n};\n//#endregion\n//#region src/core/runtime/runtime-driver.ts\nconst sqliteRuntimeDriverDescriptor = {\n\t...sqliteDriverDescriptorMeta,\n\tcreate() {\n\t\treturn new SqliteDriver();\n\t}\n};\n//#endregion\nexport { sqliteRuntimeDriverDescriptor as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;AAIA,SAAS,YAAY,MAAM,SAAS,SAAS;CAC5C,MAAM,QAAQ,IAAI,MAAM,OAAO;CAC/B,OAAO,eAAe,OAAO,QAAQ;EACpC,OAAO;EACP,cAAc;CACf,CAAC;CACD,OAAO,OAAO,OAAO,OAAO;EAC3B;EACA,UAAU;EACV,UAAU;EACV;EACA;CACD,CAAC;AACF;AACA,MAAM,wBAAwB;AAC9B,MAAM,4BAA4B;AAClC,SAAS,eAAe,MAAM;CAC7B,IAAI;EACH,MAAM,KAAK,IAAI,aAAa,IAAI;EAChC,GAAG,KAAK,0BAA0B;EAClC,GAAG,KAAK,4BAA4B;EACpC,OAAO;CACR,SAAS,OAAO;EACf,MAAM,qBAAqB,KAAK;CACjC;AACD;AACA,IAAI,kBAAkB,MAAM;CAC3B;CACA,YAAY,IAAI;EACf,KAAK,KAAK;CACX;CACA,OAAO,MAAM,SAAS;EACrB,IAAI;GACH,MAAM,OAAO,KAAK,GAAG,QAAQ,QAAQ,GAAG;GACxC,KAAK,MAAM,OAAO,KAAK,QAAQ,GAAG,aAAa,QAAQ,MAAM,CAAC,GAAG,MAAM;EACxE,SAAS,OAAO;GACf,MAA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}
1
+ {"version":3,"file":"driver__runtime.mjs","names":["#state","#requireConnected"],"sources":["../../../../3-targets/sqlite/3-driver/dist/runtime.mjs"],"sourcesContent":["import { a as wasClosedByDriver, i as closeDatabase, n as sqliteParams, r as normalizeSqliteError, t as sqliteDriverDescriptorMeta } from \"./descriptor-meta-Drr6Abaf.mjs\";\nimport { DatabaseSync } from \"node:sqlite\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/sqlite-driver.ts\nfunction driverError(code, message, details) {\n\tconst error = new Error(message);\n\tObject.defineProperty(error, \"name\", {\n\t\tvalue: \"RuntimeError\",\n\t\tconfigurable: true\n\t});\n\treturn Object.assign(error, {\n\t\tcode,\n\t\tcategory: \"DRIVER\",\n\t\tseverity: \"error\",\n\t\tmessage,\n\t\tdetails\n\t});\n}\nconst NOT_CONNECTED_MESSAGE = \"SQLite driver not connected. Call connect(binding) before acquireConnection or execute.\";\nconst ALREADY_CONNECTED_MESSAGE = \"SQLite driver already connected. Call close() before reconnecting with a new binding.\";\nfunction openConnection(path) {\n\ttry {\n\t\tconst db = new DatabaseSync(path);\n\t\tdb.exec(\"PRAGMA foreign_keys = ON\");\n\t\tdb.exec(\"PRAGMA busy_timeout = 5000\");\n\t\treturn db;\n\t} catch (error) {\n\t\tthrow normalizeSqliteError(error, false);\n\t}\n}\nvar SqliteQueryable = class {\n\tdb;\n\tconstructor(db) {\n\t\tthis.db = db;\n\t}\n\tasync *query(request) {\n\t\ttry {\n\t\t\tconst stmt = this.db.prepare(request.sql);\n\t\t\tfor (const row of stmt.iterate(...sqliteParams(request.params))) yield row;\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t}\n\t}\n\tasync execute(request) {\n\t\ttry {\n\t\t\tconst stmt = this.db.prepare(request.sql);\n\t\t\tif (stmt.columns().length !== 0) throw new InternalError(\"SQLite cannot execute statements that return rows.\");\n\t\t\treturn { affectedRows: Number(stmt.run(...sqliteParams(request.params)).changes) };\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t}\n\t}\n\tasync explain(request) {\n\t\ttry {\n\t\t\treturn { rows: this.db.prepare(`EXPLAIN QUERY PLAN ${request.sql}`).all(...sqliteParams(request.params)) };\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t}\n\t}\n};\nvar SqliteConnectionImpl = class extends SqliteQueryable {\n\tasync beginTransaction() {\n\t\ttry {\n\t\t\tthis.db.exec(\"BEGIN\");\n\t\t\treturn new SqliteTransactionImpl(this.db);\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t}\n\t}\n\tasync release() {\n\t\treturn this.destroy();\n\t}\n\tasync destroy(_reason) {\n\t\ttry {\n\t\t\tcloseDatabase(this.db);\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t}\n\t}\n};\nvar SqliteTransactionImpl = class extends SqliteQueryable {\n\tasync commit() {\n\t\ttry {\n\t\t\tthis.db.exec(\"COMMIT\");\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t}\n\t}\n\tasync rollback() {\n\t\ttry {\n\t\t\tthis.db.exec(\"ROLLBACK\");\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t}\n\t}\n};\nfunction unboundQuery() {\n\treturn { [Symbol.asyncIterator]() {\n\t\treturn { async next() {\n\t\t\tthrow driverError(\"DRIVER.NOT_CONNECTED\", NOT_CONNECTED_MESSAGE);\n\t\t} };\n\t} };\n}\nvar SqliteDriver = class {\n\tfamilyId = \"sql\";\n\ttargetId = \"sqlite\";\n\t#state;\n\tconstructor(initialState) {\n\t\tthis.#state = initialState ?? { kind: \"unbound\" };\n\t}\n\t#requireConnected() {\n\t\tif (this.#state.kind !== \"connected\") throw driverError(\"DRIVER.NOT_CONNECTED\", NOT_CONNECTED_MESSAGE);\n\t\treturn this.#state;\n\t}\n\tget state() {\n\t\treturn this.#state.kind;\n\t}\n\tasync connect(binding) {\n\t\tif (this.#state.kind === \"connected\") throw driverError(\"DRIVER.ALREADY_CONNECTED\", ALREADY_CONNECTED_MESSAGE, { bindingKind: binding.kind });\n\t\tthis.#state = {\n\t\t\tkind: \"connected\",\n\t\t\tpath: binding.path,\n\t\t\tconn: new SqliteConnectionImpl(openConnection(binding.path))\n\t\t};\n\t}\n\tasync acquireConnection() {\n\t\tconst { path } = this.#requireConnected();\n\t\treturn new SqliteConnectionImpl(openConnection(path));\n\t}\n\tasync close() {\n\t\tif (this.#state.kind !== \"connected\") return;\n\t\tconst { conn } = this.#state;\n\t\tthis.#state = { kind: \"closed\" };\n\t\tawait conn.release();\n\t}\n\tquery(request) {\n\t\tif (this.#state.kind !== \"connected\") return unboundQuery();\n\t\treturn this.#state.conn.query(request);\n\t}\n\tasync execute(request) {\n\t\treturn this.#requireConnected().conn.execute(request);\n\t}\n\tasync explain(request) {\n\t\treturn this.#requireConnected().conn.explain(request);\n\t}\n};\n//#endregion\n//#region src/core/runtime/runtime-driver.ts\nconst sqliteRuntimeDriverDescriptor = {\n\t...sqliteDriverDescriptorMeta,\n\tcreate() {\n\t\treturn new SqliteDriver();\n\t}\n};\n//#endregion\nexport { sqliteRuntimeDriverDescriptor as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;AAIA,SAAS,YAAY,MAAM,SAAS,SAAS;CAC5C,MAAM,QAAQ,IAAI,MAAM,OAAO;CAC/B,OAAO,eAAe,OAAO,QAAQ;EACpC,OAAO;EACP,cAAc;CACf,CAAC;CACD,OAAO,OAAO,OAAO,OAAO;EAC3B;EACA,UAAU;EACV,UAAU;EACV;EACA;CACD,CAAC;AACF;AACA,MAAM,wBAAwB;AAC9B,MAAM,4BAA4B;AAClC,SAAS,eAAe,MAAM;CAC7B,IAAI;EACH,MAAM,KAAK,IA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KAAKC,kBAAkB;EACxC,OAAO,IAAI,qBAAqB,eAAe,IAAI,CAAC;CACrD;CACA,MAAM,QAAQ;EACb,IAAI,KAAKD,OAAO,SAAS,aAAa;EACtC,MAAM,EAAE,SAAS,KAAKA;EACtB,KAAKA,SAAS,EAAE,MAAM,SAAS;EAC/B,MAAM,KAAK,QAAQ;CACpB;CACA,MAAM,SAAS;EACd,IAAI,KAAKA,OAAO,SAAS,aAAa,OAAO,aAAa;EAC1D,OAAO,KAAKA,OAAO,KAAK,MAAM,OAAO;CACtC;CACA,MAAM,QAAQ,SAAS;EACtB,OAAO,KAAKC,kBAAkB,CAAC,CAAC,KAAK,QAAQ,OAAO;CACrD;CACA,MAAM,QAAQ,SAAS;EACtB,OAAO,KAAKA,kBAAkB,CAAC,CAAC,KAAK,QAAQ,OAAO;CACrD;AACD;AAGA,MAAM,gCAAgC;CACrC,GAAG;CACH,SAAS;EACR,OAAO,IAAI,aAAa;CACzB;AACD"}
@@ -501,7 +501,7 @@ declare class NamedTypeDeclarationAst implements AstNode, HasDocComment {
501
501
  static cast(node: SyntaxNode): NamedTypeDeclarationAst | undefined;
502
502
  }
503
503
  //#endregion
504
- //#region ../../../1-framework/2-authoring/psl-parser/dist/binder-D_4RBHbt.d.mts
504
+ //#region ../../../1-framework/2-authoring/psl-parser/dist/binder-DJRPMfsD.d.mts
505
505
  //#region src/resolve.d.ts
506
506
  interface ResolvedAttributeArg {
507
507
  readonly kind: 'positional' | 'named';
@@ -727,6 +727,8 @@ interface NumLiteralArgType<Ctx extends AttributeCtx = AttributeCtx> extends Arg
727
727
  }
728
728
  interface OneOfMetadata {
729
729
  readonly kind: 'oneOf';
730
+ /** Whether the label reads as a union: several labels joined by ` | `. False for a union that names itself, as `JSON value` does. */
731
+ readonly labelIsUnion: boolean;
730
732
  readonly alternatives: readonly [AnyArgType, ...AnyArgType[]];
731
733
  }
732
734
  interface RecordArgType<T = unknown, Ctx extends AttributeCtx = AttributeCtx> extends ArgTypeOutput<Record<string, T>, Ctx> {
@@ -773,6 +775,8 @@ interface DataTypeValueArgType<Ctx extends AttributeCtx = AttributeCtx> extends
773
775
  readonly documentation: string;
774
776
  /** Written values offered for completion besides the tags, such as the versions a function takes. */
775
777
  readonly suggestions: readonly string[];
778
+ /** Whether the label reads as a union: several suggestions joined by ` | `. */
779
+ readonly labelIsUnion: boolean;
776
780
  }
777
781
  type ArgTypeMetadata<Type> = Type extends object ? Omit<Type, keyof ArgTypeOutput<unknown, never>> : never;
778
782
  type ArgType<T, Ctx extends AttributeCtx> = ArgTypeOutput<T, Ctx> & ArgTypeMetadata<ArgTypeVariant<Ctx>>;
@@ -1154,7 +1158,7 @@ declare const sqliteTargetDescriptorMetaBase: {
1154
1158
  }, ...import("@prisma/orm-framework/components/components").GeneratorFunctionContribution[]];
1155
1159
  readonly controlMutationDefaults: {
1156
1160
  readonly defaultFunctionRegistry: Map<any, any>;
1157
- readonly generatorDescriptors: readonly import("@prisma/orm-framework/components/control").MutationDefaultGeneratorDescriptor[];
1161
+ readonly generatorDescriptors: readonly import("@prisma/orm-framework/components/components").MutationDefaultGeneratorDescriptor[];
1158
1162
  };
1159
1163
  readonly kind: "target";
1160
1164
  readonly familyId: "sql";
@@ -1176,4 +1180,4 @@ declare const sqliteTargetDescriptorMeta: typeof sqliteTargetDescriptorMetaBase
1176
1180
  };
1177
1181
  //#endregion
1178
1182
  export { sqliteTargetDescriptorMeta as t };
1179
- //# sourceMappingURL=pack-DR0n9vHJ.d.mts.map
1183
+ //# sourceMappingURL=pack-B3YrlPJI.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pack-DR0n9vHJ.d.mts","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/pack.d.mts"],"mappings":";;;;;;;;;;;KAWK;UACK;WACC,MAAM;WACN;;;;;KAKN;;;UAGK;WACC;WACA,MAAM;WACN;;UAED;WACC;WACA,MAAM;WACN,UAAU,cAAc;WACxB;;KAEN,eAAe,YAAY;;;;;;;;;;cAUlB,uB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mBACA;mBACA;qBACE;uBACE;;qBAEF;uBACE;uBACA;;;;iBAIN;mBACE;mBACA;mBACA;qBACE;uBACE;;qBAEF;uBACE;uBACA;;qBAEF;uBACE;uBACA;;;;;eAKR;iBACE;mBACE;mBACA;mBACA;qBACE;qBACA;qBACA;;mBAEF;qBACE;qBACA;uBACE;yBACE;yBACA;;;;;;eAMV;iBACE;iBACA;iBACA;mBACE;;;eAGJ;iBACE;iBACA;iBACA;mBACE;;;eAGJ;iBACE;iBACA;iBACA;mBACE;;;eAGJ;iBACE;iBACA;iBACA;mBACE;;;eAGJ;iBACE;iBACA;iBACA;mBACE;;;eAGJ;iBACE;iBACA;iBACA;mBACE;;;eAGJ;iBACE;iBACA;iBACA;mBACE;;;eAGJ;iBACE;iBACA;iBACA;mBACE;;;;aAIN;eACE;iBACE;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF,QAAQ;qBACN;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;uBAIN;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;;;;iBAOZ;mBACE;mBACA,QAAQ;qBACN;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;;;;iBAKR;mBACE;mBACA,QAAQ;qBACN;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;uBAEF;yBACE;yBACA;;;;;;;aAOZ,WAAW,SAAS,kEAAkE;aACtF,uEAAuE;;WAEzE;aACE;aACA,YAAY,8DAA8D;eACxE;eACA;iBACE;iBACA,MAAM,uBAAuB,cAAc,eAAe;iBAC1D;;;aAGJ;;aAEA;aACA,YAAY,8DAA8D;eACxE;eACA;iBACE;iBACA,MAAM,WAAW;iBACjB;;;aAGJ;;aAEA;aACA,YAAY,8DAA8D;eACxE;eACA;iBACE;iBACA,MAAM,wBAAwB,cAAc,gBAAgB;iBAC5D;;;aAGJ;;aAEA;aACA,wEAAwE;4DACzB;WACjD;aACE,yBAAyB;aACzB,gFAAgF;;WAElF;WACA;WACA;WACA;WACA;WACA;WACA,mEAAmE;WACnE,eAAe;;cAEZ,mCAAmC;WACtC,eAAe;WACf;aACE;eACE;eACA"}
1
+ {"version":3,"file":"pack-B3YrlPJI.d.mts","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/pack.d.mts"],"mappings":";;;;;;;;;;;KAWK;UACK;WACC,MAAM;WACN;;;;;KAKN;;;UAGK;WACC;WACA,MAAM;WACN;;UAED;WACC;WACA,MAAM;WACN,UAAU,cAAc;WACxB;;KAEN,eAAe,YAAY;;;;;;;;;;cAUlB,uBAAuB;WAC1B,OAAO;WACP,MAAM;WACN;WACA;WACA,QAAQ;;WAER;EACT,YAAY,OAAO,YAAY,gBAAgB,QAAQ,YAAY;MAC/D;MACA;;EAEJ,SAAS;EACT,UAAU;;MAEN,sBAAsB;;MAEtB,sBAAsB;;MAEtB,aAAa;;MAEb,aAAa;;KAEd,gBAAgB,aAAa;cACpB;;UAEJ;SACD,QAAQ;SACR,OAAO,OAAO,cAAc;SAC5B,QAAQ,MAAM,aAAa,OAAO,cAAc;MACnD;MACA;EACJ,cAAc;EACd,eAAe;;cAEH;;WAEH,OAAO;WACP;WACA,QAAQ;;WAER;EACT,YAAY,OAAO,WAAW,gBAAgB,QAAQ,wBAAwB;EAC9E,QAAQ,gBAAgB;MACpB,QAAQ;MACR;MACA;;EAEJ,SAAS;EACT,UAAU;MACN,cAAc;MACd,aAAa;MACb,eAAe;MACf,eAAe;;MAEf,sBAAsB;;MAEtB,sBAAsB;;MAEtB,cAAc;;MAEd,aAAa;EACjB,YAAY,SAAS;EACrB,cAAc,SAAS;EACvB,QAAQ;EACR,aAAa,SAAS;;EAEtB,aAAa,GAAG,OAAO,MAAM,eAAe,gBAAgB;EAC5D,eAAe,SAAS;EACxB,UAAU,SAAS;;;;;EAKnB,cAAc,iBAAiB;;;;;;EAM/B,gBAAgB,eAAe,cAAc;;;;UAIrC;WACC;WACA;;UAED;WACC,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ACA,OAAO;;UAER;WACC;WACA;WACA,WAAW;;UAEZ;WACC;WACA;WACA;;KAEN,YAAY,cAAc,sBAAsB,kBAAkB,cAAc,kBAAkB,cAAc;KAChH,aAAa;WACP;WACA,QAAQ;;WAER;WACA,QAAQ;;WAER;WACA,QAAQ;;WAER;WACA,QAAQ;;WAER;WACA,QAAQ;;WAER;;WAEA;WACA;;UAED;EACR,eAAe,MAAM,aAAa;EAClC,cAAc,MAAM,aAAa;EACjC,QAAQ,MAAM,aAAa;;;;cAIf;WACH;WACA;WACA;WACA;aACE;eACE;iBACE;iBACA;iBACA;mBACE;;;eAGJ;iBACE;mBACE;mBACA;mBACA;qBACE;uBACE;;qBAEF;uBACE;uBACA;;;;iBAIN;mBACE;mBACA;mBACA;qBACE;uBACE;;qBAEF;uBACE;uBACA;;qBAEF;uBACE;uBACA;;;;;eAKR;iBACE;mBACE;mBACA;mBACA;qBACE;qBACA;qBACA;;mBAEF;qBACE;qBACA;uBACE;yBACE;yBACA;;;;;;eAMV;iBACE;iBACA;iBACA;mBACE;;;eAGJ;iBACE;iBACA;iBACA;mBACE;;;eAGJ;iBACE;iBACA;iBACA;mBACE;;;eAGJ;iBACE;iBACA;iBACA;mBACE;;;eAGJ;iBACE;iBACA;iBACA;mBACE;;;eAGJ;iBACE;iBACA;iBACA;mBACE;;;eAGJ;iBACE;iBACA;iBACA;mBACE;;;eAGJ;iBACE;iBACA;iBACA;mBACE;;;;aAIN;eACE;iBACE;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF,QAAQ;qBACN;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;uBAIN;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;;;;iBAOZ;mBACE;mBACA,QAAQ;qBACN;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;;;;iBAKR;mBACE;mBACA,QAAQ;qBACN;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;uBAEF;yBACE;yBACA;;;;;;;aAOZ,WAAW,SAAS,kEAAkE;aACtF,uEAAuE;;WAEzE;aACE;aACA,YAAY,8DAA8D;eACxE;eACA;iBACE;iBACA,MAAM,uBAAuB,cAAc,eAAe;iBAC1D;;;aAGJ;;aAEA;aACA,YAAY,8DAA8D;eACxE;eACA;iBACE;iBACA,MAAM,WAAW;iBACjB;;;aAGJ;;aAEA;aACA,YAAY,8DAA8D;eACxE;eACA;iBACE;iBACA,MAAM,wBAAwB,cAAc,gBAAgB;iBAC5D;;;aAGJ;;aAEA;aACA,wEAAwE;4DACzB;WACjD;aACE,yBAAyB;aACzB,mFAAmF;;WAErF;WACA;WACA;WACA;WACA;WACA;WACA,mEAAmE;WACnE,eAAe;;cAEZ,mCAAmC;WACtC,eAAe;WACf;aACE;eACE;eACA"}
package/dist/target.d.mts CHANGED
@@ -10,7 +10,7 @@ import "./codec-types-ELHfd82J.mjs";
10
10
  import "./codec-ids-CMbhYIsa.mjs";
11
11
  import { n as quoteIdentifier, t as escapeLiteral } from "./sql-utils-BqHka8P6.mjs";
12
12
  import { n as readSqliteDefault, r as sqliteResolveDefault, t as SqliteReportedDefault } from "./default-normalizer-CkHy3JYk.mjs";
13
- import { t as sqliteAggregateDescriptors } from "./aggregates-UBmpuURb.mjs";
13
+ import { t as sqliteAggregateDescriptors } from "./aggregates-CDMoiy_Z.mjs";
14
14
  import { a as buildSignMarkerBootstrapQueries, c as datetime, d as jsonText, f as sqliteTable, i as buildControlTableBootstrapQueries, l as indexExistsAst, m as text, n as IndexExistsCheckBuilder, o as columnExistsAst, p as tableExistsAst, r as TableExistsCheckBuilder, s as createTable, t as ColumnExistsCheckBuilder, u as integer } from "./contract-free-BJwIJN6x.mjs";
15
15
  import { n as buildTargetDetails, t as SqlitePlanTargetDetails } from "./planner-target-details-xR6UfIcz-BrBPQGOS.mjs";
16
16
  import { i as sqliteScalarTypeConstructors, r as sqliteCreateNamespace, t as SqliteUnboundDatabase } from "./control-CmDsxEqb.mjs";
@@ -20,7 +20,7 @@ import { t as SqliteContractView } from "./sqlite-contract-view-BDw8T5Cp-BfFajhe
20
20
  import { t as SqliteMigration } from "./sqlite-migration-CLIMaHLy-5ZjJDdDP.mjs";
21
21
  import { a as fn, c as placeholder, d as sql, f as unique, i as dataTransform, l as primaryKey, n as MigrationCLI, o as foreignKey, r as col, s as lit, t as DataTransformOptions, u as rawSql } from "./migration-WJlUQmsn.mjs";
22
22
  import { a as DropColumnCall, c as RawSqlCall, d as RenameTableCall, f as SqliteOpFactoryCall, i as DataTransformCall, l as RecreateTableCall, n as CreateIndexCall, o as DropIndexCall, r as CreateTableCall, s as DropTableCall, t as AddColumnCall, u as RenameColumnCall } from "./op-factory-call-De6MX7Yp.mjs";
23
- import "./pack-DR0n9vHJ.mjs";
23
+ import "./pack-B3YrlPJI.mjs";
24
24
  import { n as TypeScriptRenderableSqliteMigration, t as SqliteMigrationDestinationInfo } from "./planner-produced-sqlite-migration-DuM9c3YI-Dacb6zQZ.mjs";
25
25
  import { n as SqlitePlanResult, r as createSqliteMigrationPlanner, t as SqliteMigrationPlanner } from "./planner-CjMq9oEt.mjs";
26
26
  import "./planner-produced-sqlite-migration-GDP1M36D.mjs";
@@ -1,2 +1,2 @@
1
- import { t as sqliteAggregateDescriptors } from "./aggregates-UBmpuURb.mjs";
1
+ import { t as sqliteAggregateDescriptors } from "./aggregates-CDMoiy_Z.mjs";
2
2
  export { sqliteAggregateDescriptors };
@@ -14,7 +14,7 @@ import { SqlSchemaVerifierBase } from "@prisma/orm-family-sql/family/ir";
14
14
  import { convertedColumnOf, fieldOfColumn, requiredColumnsOfMigration, rowsWithoutValueFailure, runnerFailure, runnerSuccess, sqlTypeLookupsOf, unconvertedFieldOf } from "@prisma/orm-family-sql/family/control";
15
15
  import { relationalNodeEntityKind, relationalNodeGranularity } from "@prisma/orm-family-sql/schema-ir/types";
16
16
  import { notOk, ok, okVoid } from "@prisma/orm-framework/utils/result";
17
- import { SqlQueryError } from "@prisma/orm-family-sql/errors";
17
+ import { SqlConnectionError, SqlQueryError } from "@prisma/orm-family-sql/errors";
18
18
  //#region ../../../3-targets/sqlite/1-target/dist/control.mjs
19
19
  const NOT_NULL_VIOLATION_SQLSTATE = "23502";
20
20
  function createSqliteMigrationRunner(family) {
@@ -100,21 +100,42 @@ var SqliteMigrationRunner = class {
100
100
  if (perSpaceOptions.length === 0) return ok({ perSpaceResults: [] });
101
101
  const fkWasEnabled = await this.readForeignKeysEnabled(driver);
102
102
  if (fkWasEnabled) await driver.query("PRAGMA foreign_keys = OFF");
103
+ let result;
103
104
  try {
104
- await this.beginExclusiveTransaction(driver);
105
- let committed = false;
106
- try {
107
- const result = await this.executeSpaces(driver, perSpaceOptions, fkWasEnabled);
108
- if (!result.ok) return notOk(withDatabaseUnchanged(result.failure, true));
109
- await this.commitTransaction(driver);
110
- committed = true;
111
- return result;
112
- } finally {
113
- if (!committed) await this.rollbackTransaction(driver);
114
- }
115
- } finally {
116
- if (fkWasEnabled) await driver.query("PRAGMA foreign_keys = ON");
105
+ result = await this.executeInTransaction(driver, perSpaceOptions, fkWasEnabled);
106
+ } catch (error) {
107
+ if (fkWasEnabled) await this.afterFailure(driver.query("PRAGMA foreign_keys = ON"));
108
+ throw error;
109
+ }
110
+ if (fkWasEnabled) {
111
+ const restore = driver.query("PRAGMA foreign_keys = ON");
112
+ await (result.ok ? restore : this.afterFailure(restore));
117
113
  }
114
+ return result;
115
+ }
116
+ async executeInTransaction(driver, perSpaceOptions, fkWasEnabled) {
117
+ await this.beginExclusiveTransaction(driver);
118
+ let result;
119
+ try {
120
+ result = await this.executeSpaces(driver, perSpaceOptions, fkWasEnabled);
121
+ } catch (error) {
122
+ await this.afterFailure(this.rollbackTransaction(driver));
123
+ throw error;
124
+ }
125
+ if (!result.ok) {
126
+ await this.afterFailure(this.rollbackTransaction(driver));
127
+ return notOk(withDatabaseUnchanged(result.failure, true));
128
+ }
129
+ try {
130
+ await this.commitTransaction(driver);
131
+ } catch (error) {
132
+ await this.afterFailure(this.rollbackTransaction(driver));
133
+ throw error;
134
+ }
135
+ return result;
136
+ }
137
+ async afterFailure(cleanup) {
138
+ await cleanup.catch(() => void 0);
118
139
  }
119
140
  async executeSpaces(driver, perSpaceOptions, fkWasEnabled) {
120
141
  const perSpaceResults = [];
@@ -251,6 +272,16 @@ var SqliteMigrationRunner = class {
251
272
  } catch (error) {
252
273
  const message = error instanceof Error ? error.message : String(error);
253
274
  const failed = `Operation ${operation.id} failed during execution: ${step.description}`;
275
+ if (SqlConnectionError.is(error)) return runnerFailure("MIGRATION.EXECUTION_FAILED", failed, {
276
+ why: message,
277
+ meta: {
278
+ operationId: operation.id,
279
+ stepDescription: step.description,
280
+ sql: step.sql,
281
+ connectionLost: error.transient === false,
282
+ transient: error.transient
283
+ }
284
+ });
254
285
  const rowsWithoutValue = await this.rowsWithoutValue(driver, error, plan);
255
286
  const failedConversion = rowsWithoutValue === void 0 ? await this.failedConversion(driver, step, error, plan) : void 0;
256
287
  return runnerFailure("MIGRATION.EXECUTION_FAILED", rowsWithoutValue?.summary ?? failed, {
@@ -1 +1 @@
1
- {"version":3,"file":"target__control.mjs","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/control.mjs"],"sourcesContent":["import { n as sqliteError } from \"./errors-DnR-sMHS.mjs\";\nimport { n as sqliteScalarTypeConstructors, t as sqliteTargetDescriptorMeta } from \"./descriptor-meta-COSGM3xb.mjs\";\nimport { r as quoteIdentifier } from \"./sql-utils-XGT5Esi2.mjs\";\nimport { i as sqliteCreateNamespace, n as SqliteContractSerializer, r as SqliteUnboundDatabase } from \"./sqlite-contract-view-CGfiGvKH.mjs\";\nimport { _ as diffSqliteSchema, b as verifySqliteDatabaseSchema, y as sqliteContractToSchema } from \"./sqlite-migration-BAdSmooi.mjs\";\nimport { _ as conversionCopyOf, m as affinityStorageClasses, v as rebuiltTableName } from \"./op-factory-call-emj9Xp05.mjs\";\nimport { n as createSqliteMigrationPlanner } from \"./planner-BvwYScnt.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { APP_SPACE_ID, failedPostcheckWhy, failedPrecheckWhy, schemaCheckWhy, withDatabaseUnchanged, withFailingSpace } from \"@internal/framework-components/control\";\nimport { convertedColumnOf, fieldOfColumn, requiredColumnsOfMigration, rowsWithoutValueFailure, runnerFailure, runnerSuccess, sqlTypeLookupsOf, unconvertedFieldOf } from \"@internal/family-sql/control\";\nimport { SqlStorage } from \"@internal/sql-contract/types\";\nimport { relationalNodeEntityKind, relationalNodeGranularity } from \"@internal/sql-schema-ir/types\";\nimport { SqlSchemaVerifierBase } from \"@internal/family-sql/ir\";\nimport { notOk, ok, okVoid } from \"@internal/utils/result\";\nimport { SqlQueryError } from \"@internal/sql-errors\";\n//#region src/core/migrations/runner.ts\nconst NOT_NULL_VIOLATION_SQLSTATE = \"23502\";\nfunction createSqliteMigrationRunner(family) {\n\treturn new SqliteMigrationRunner(family);\n}\nvar SqliteMigrationRunner = class {\n\tfamily;\n\tconstructor(family) {\n\t\tthis.family = family;\n\t}\n\t/**\n\t* Apply the plan against an already-open connection without managing\n\t* the transaction lifecycle. The caller ({@link SqliteMigrationRunner.execute})\n\t* owns BEGIN/COMMIT/ROLLBACK and any connection-level setup (FK pragma\n\t* toggle, FK integrity check).\n\t*/\n\tasync executeOnConnection(options) {\n\t\tconst driver = options.driver;\n\t\tif (options.space !== void 0 && options.space !== options.plan.spaceId) throw sqliteError(\"MIGRATION.CONTRACT_SPACE_VIOLATION\", `SqlMigrationRunner: options.space (${options.space}) does not match plan.spaceId (${options.plan.spaceId})`, { meta: {\n\t\t\tspace: options.space,\n\t\t\tplanSpaceId: options.plan.spaceId\n\t\t} });\n\t\tconst space = options.plan.spaceId;\n\t\tconst planOps = blindCast(await Promise.all(options.plan.operations));\n\t\tconst destinationCheck = this.ensurePlanMatchesDestinationContract(options.plan.destination, options.destinationContract);\n\t\tif (!destinationCheck.ok) return destinationCheck;\n\t\tconst policyCheck = this.enforcePolicyCompatibility(options.policy, planOps);\n\t\tif (!policyCheck.ok) return policyCheck;\n\t\tconst ensureResult = await this.ensureControlTables(driver, options.destinationContract);\n\t\tif (!ensureResult.ok) return ensureResult;\n\t\tconst existingMarker = await this.family.readMarker({\n\t\t\tdriver,\n\t\t\tspace\n\t\t});\n\t\tconst markerCheck = this.ensureMarkerCompatibility(existingMarker, options.plan);\n\t\tif (!markerCheck.ok) return markerCheck;\n\t\tconst markerAtDestination = this.markerMatchesDestination(existingMarker, options.plan);\n\t\tconst isSelfEdge = options.plan.origin?.storageHash === options.plan.destination.storageHash;\n\t\tconst skipOperations = markerAtDestination && options.plan.origin != null && !isSelfEdge;\n\t\tlet operationsExecuted;\n\t\tlet executedOperations;\n\t\tif (skipOperations) {\n\t\t\toperationsExecuted = 0;\n\t\t\texecutedOperations = [];\n\t\t} else {\n\t\t\tconst applyResult = await this.applyPlan(driver, options, planOps);\n\t\t\tif (!applyResult.ok) return applyResult;\n\t\t\toperationsExecuted = applyResult.value.operationsExecuted;\n\t\t\texecutedOperations = applyResult.value.executedOperations;\n\t\t}\n\t\tif (space === APP_SPACE_ID) {\n\t\t\tconst schemaNode = await this.family.introspect({\n\t\t\t\tdriver,\n\t\t\t\tcontract: options.destinationContract\n\t\t\t});\n\t\t\tconst schemaVerifyResult = verifySqliteDatabaseSchema({\n\t\t\t\tcontract: options.destinationContract,\n\t\t\t\tactualSchema: schemaNode,\n\t\t\t\tstrict: options.strictVerification ?? true,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t\tif (!schemaVerifyResult.ok) return runnerFailure(\"MIGRATION.SCHEMA_VERIFY_FAILED\", schemaVerifyResult.summary, {\n\t\t\t\twhy: schemaCheckWhy(schemaVerifyResult.schema.issues),\n\t\t\t\tmeta: { schemaIssues: schemaVerifyResult.schema.issues }\n\t\t\t});\n\t\t}\n\t\tconst incomingInvariants = options.plan.providedInvariants;\n\t\tconst existingInvariants = new Set(existingMarker?.invariants ?? []);\n\t\tconst incomingIsSubsetOfExisting = incomingInvariants.every((id) => existingInvariants.has(id));\n\t\tif (!(isSelfEdge && operationsExecuted === 0 && incomingIsSubsetOfExisting)) {\n\t\t\tconst markerResult = await this.upsertMarker(driver, options, existingMarker, space);\n\t\t\tif (!markerResult.ok) return markerResult;\n\t\t\tawait this.recordLedgerEntries(driver, options, executedOperations);\n\t\t}\n\t\treturn runnerSuccess({\n\t\t\toperationsPlanned: planOps.length,\n\t\t\toperationsExecuted\n\t\t});\n\t}\n\tasync execute(options) {\n\t\tconst driver = options.driver;\n\t\tconst perSpaceOptions = options.perSpaceOptions;\n\t\tif (perSpaceOptions.length === 0) return ok({ perSpaceResults: [] });\n\t\tconst fkWasEnabled = await this.readForeignKeysEnabled(driver);\n\t\tif (fkWasEnabled) await driver.query(\"PRAGMA foreign_keys = OFF\");\n\t\ttry {\n\t\t\tawait this.beginExclusiveTransaction(driver);\n\t\t\tlet committed = false;\n\t\t\ttry {\n\t\t\t\tconst result = await this.executeSpaces(driver, perSpaceOptions, fkWasEnabled);\n\t\t\t\tif (!result.ok) return notOk(withDatabaseUnchanged(result.failure, true));\n\t\t\t\tawait this.commitTransaction(driver);\n\t\t\t\tcommitted = true;\n\t\t\t\treturn result;\n\t\t\t} finally {\n\t\t\t\tif (!committed) await this.rollbackTransaction(driver);\n\t\t\t}\n\t\t} finally {\n\t\t\tif (fkWasEnabled) await driver.query(\"PRAGMA foreign_keys = ON\");\n\t\t}\n\t}\n\tasync executeSpaces(driver, perSpaceOptions, fkWasEnabled) {\n\t\tconst perSpaceResults = [];\n\t\tlet lastProcessedSpace;\n\t\tfor (const spaceOptions of perSpaceOptions) {\n\t\t\tconst space = spaceOptions.space ?? spaceOptions.plan.spaceId;\n\t\t\tconst result = await this.executeOnConnection({\n\t\t\t\t...spaceOptions,\n\t\t\t\tdriver,\n\t\t\t\tspace\n\t\t\t});\n\t\t\tif (!result.ok) return notOk(withFailingSpace(result.failure, space));\n\t\t\tperSpaceResults.push({\n\t\t\t\tspace,\n\t\t\t\tvalue: result.value\n\t\t\t});\n\t\t\tlastProcessedSpace = space;\n\t\t}\n\t\tif (fkWasEnabled) {\n\t\t\tconst fkIntegrityCheck = await this.verifyForeignKeyIntegrity(driver);\n\t\t\tif (!fkIntegrityCheck.ok) return notOk(withFailingSpace(fkIntegrityCheck.failure, lastProcessedSpace ?? APP_SPACE_ID));\n\t\t}\n\t\treturn ok({ perSpaceResults });\n\t}\n\tasync readForeignKeysEnabled(driver) {\n\t\treturn (await driver.query(\"PRAGMA foreign_keys\")).rows[0]?.foreign_keys === 1;\n\t}\n\tasync verifyForeignKeyIntegrity(driver) {\n\t\tconst result = await driver.query(\"PRAGMA foreign_key_check\");\n\t\tif (result.rows.length === 0) return okVoid();\n\t\treturn runnerFailure(\"MIGRATION.FOREIGN_KEY_VIOLATION\", `Foreign key integrity check failed after migration: ${result.rows.length} violation(s).`, {\n\t\t\twhy: \"PRAGMA foreign_key_check reported violations after applying recreate-table operations.\",\n\t\t\tmeta: { violations: result.rows }\n\t\t});\n\t}\n\tasync applyPlan(driver, options, ops) {\n\t\tconst checks = options.executionChecks;\n\t\tconst runPrechecks = checks?.prechecks !== false;\n\t\tconst runPostchecks = checks?.postchecks !== false;\n\t\tconst runIdempotency = checks?.idempotencyChecks !== false;\n\t\tlet operationsExecuted = 0;\n\t\tconst executedOperations = [];\n\t\tfor (const operation of ops) {\n\t\t\toptions.callbacks?.onOperationStart?.(operation);\n\t\t\ttry {\n\t\t\t\tif (runPostchecks && runIdempotency) {\n\t\t\t\t\tif (await this.expectationsAreSatisfied(driver, operation.postcheck)) {\n\t\t\t\t\t\texecutedOperations.push(this.createSkipRecord(operation));\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (runPrechecks) {\n\t\t\t\t\tconst precheckResult = await this.runExpectationSteps(driver, operation.precheck, operation, \"precheck\");\n\t\t\t\t\tif (!precheckResult.ok) return precheckResult;\n\t\t\t\t}\n\t\t\t\tconst executeResult = await this.runExecuteSteps(driver, operation.execute, operation, {\n\t\t\t\t\tcontract: options.destinationContract,\n\t\t\t\t\toperationIndex: ops.indexOf(operation),\n\t\t\t\t\toperations: ops,\n\t\t\t\t\tedges: options.migrationEdges\n\t\t\t\t});\n\t\t\t\tif (!executeResult.ok) return executeResult;\n\t\t\t\tif (runPostchecks) {\n\t\t\t\t\tconst postcheckResult = await this.runExpectationSteps(driver, operation.postcheck, operation, \"postcheck\", {\n\t\t\t\t\t\tcontract: options.destinationContract,\n\t\t\t\t\t\toperationIndex: ops.indexOf(operation)\n\t\t\t\t\t});\n\t\t\t\t\tif (!postcheckResult.ok) return postcheckResult;\n\t\t\t\t}\n\t\t\t\texecutedOperations.push(operation);\n\t\t\t\toperationsExecuted += 1;\n\t\t\t} finally {\n\t\t\t\toptions.callbacks?.onOperationComplete?.(operation);\n\t\t\t}\n\t\t}\n\t\treturn ok({\n\t\t\toperationsExecuted,\n\t\t\texecutedOperations\n\t\t});\n\t}\n\tasync ensureControlTables(driver, contract) {\n\t\tconst lowererContext = { contract };\n\t\tfor (const query of this.family.bootstrapControlTableQueries()) await this.executeStatement(driver, await this.family.lowerAst(query, lowererContext));\n\t\treturn okVoid();\n\t}\n\tasync runExpectationSteps(driver, steps, operation, phase, plan) {\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) {\n\t\t\t\tconst code = phase === \"precheck\" ? \"MIGRATION.PRECHECK_FAILED\" : \"MIGRATION.POSTCHECK_FAILED\";\n\t\t\t\tconst field = plan === void 0 ? void 0 : unconvertedFieldOf(step, plan.contract);\n\t\t\t\tconst converted = convertedColumnOf(step);\n\t\t\t\tconst failedCheck = {\n\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\tphase,\n\t\t\t\t\tdescription: step.description,\n\t\t\t\t\t...ifDefined(\"expectation\", step.expectation)\n\t\t\t\t};\n\t\t\t\tconst unconverted = converted === void 0 ? void 0 : await this.unconvertedValueText(driver, converted);\n\t\t\t\treturn runnerFailure(code, `Operation ${operation.id} failed during ${phase}: ${step.description}`, {\n\t\t\t\t\t...ifDefined(\"why\", unconverted ?? (phase === \"precheck\" ? failedPrecheckWhy(failedCheck) : failedPostcheckWhy(failedCheck))),\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\tfailedCheck,\n\t\t\t\t\t\t...ifDefined(\"failedTypeChange\", field === void 0 || plan === void 0 || converted === void 0 ? void 0 : converted.by === \"conversion\" ? {\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tby: \"conversion\",\n\t\t\t\t\t\t\treason: \"invalidResult\",\n\t\t\t\t\t\t\toperationIndex: plan.operationIndex\n\t\t\t\t\t\t} : {\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tby: \"cast\",\n\t\t\t\t\t\t\treason: \"value\",\n\t\t\t\t\t\t\toperationIndex: plan.operationIndex\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn okVoid();\n\t}\n\t/** Names the first value of a retyped column that kept a storage class its new type does not hold. */\n\tasync unconvertedValueText(driver, cast) {\n\t\tconst typeSql = (await driver.query(\"SELECT type FROM pragma_table_info(?) WHERE name = ?\", [cast.table, cast.column])).rows[0]?.type;\n\t\tif (typeSql === void 0) return void 0;\n\t\tconst column = quoteIdentifier(cast.column);\n\t\tconst classes = [\"null\", ...affinityStorageClasses(typeSql)];\n\t\tconst row = (await driver.query(`SELECT quote(${column}) AS value, typeof(${column}) AS storageClass FROM ${quoteIdentifier(cast.table)} WHERE typeof(${column}) NOT IN (${classes.map(() => \"?\").join(\", \")}) LIMIT 1`, classes)).rows[0];\n\t\tif (row === void 0) return void 0;\n\t\treturn `The value ${row.value.length > 40 ? `${row.value.slice(0, 40)}…` : row.value} of column \"${cast.column}\" on \"${cast.table}\" is still stored as ${row.storageClass}, which ${typeSql} cannot hold.`;\n\t}\n\tasync runExecuteSteps(driver, steps, operation, plan) {\n\t\tfor (const step of steps) try {\n\t\t\tawait driver.query(step.sql, step.params ?? []);\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\tconst failed = `Operation ${operation.id} failed during execution: ${step.description}`;\n\t\t\tconst rowsWithoutValue = await this.rowsWithoutValue(driver, error, plan);\n\t\t\tconst failedConversion = rowsWithoutValue === void 0 ? await this.failedConversion(driver, step, error, plan) : void 0;\n\t\t\treturn runnerFailure(\"MIGRATION.EXECUTION_FAILED\", rowsWithoutValue?.summary ?? failed, {\n\t\t\t\twhy: rowsWithoutValue === void 0 ? message : `${failed}: ${message}`,\n\t\t\t\tmeta: {\n\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\tstepDescription: step.description,\n\t\t\t\t\tsql: step.sql,\n\t\t\t\t\t...ifDefined(\"rowsWithoutValue\", rowsWithoutValue?.reports),\n\t\t\t\t\t...ifDefined(\"failedTypeChange\", failedConversion)\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn okVoid();\n\t}\n\t/**\n\t* The conversion that failed, when the failed step is the copy of a rebuild that converts columns\n\t* and there is evidence for it: a copy expression that fails on its own has an error in its\n\t* expression, and a constraint of the new table that names a converted column was broken by a\n\t* value the conversion produced. Any other failure of the copy is not the conversion's.\n\t*/\n\tasync failedConversion(driver, step, error, plan) {\n\t\tconst copy = conversionCopyOf(step);\n\t\tif (copy === void 0) return void 0;\n\t\tconst columns = Object.keys(copy.expressions);\n\t\tconst failed = async (column) => {\n\t\t\ttry {\n\t\t\t\tawait driver.query(`SELECT ${copy.expressions[column]} FROM ${quoteIdentifier(copy.table)}`);\n\t\t\t\treturn false;\n\t\t\t} catch {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t};\n\t\tfor (const column of columns) if (await failed(column)) return this.conversionOf(plan, copy.table, column, \"expressionError\");\n\t\tconst constrainedList = SqlQueryError.is(error) ? error.constraint : void 0;\n\t\tif (constrainedList === void 0) return void 0;\n\t\tconst constrained = new Set(constrainedList.split(\", \"));\n\t\tconst column = columns.find((name) => constrained.has(`${rebuiltTableName(copy.table)}.${name}`));\n\t\treturn column === void 0 ? void 0 : this.conversionOf(plan, copy.table, column, \"invalidResult\");\n\t}\n\tconversionOf(plan, table, column, reason) {\n\t\tconst field = fieldOfColumn(plan.contract, table, column);\n\t\treturn field === void 0 ? void 0 : {\n\t\t\tfield,\n\t\t\tby: \"conversion\",\n\t\t\treason,\n\t\t\toperationIndex: plan.operationIndex\n\t\t};\n\t}\n\t/**\n\t* The rows a table rebuild found no value for, when its copy failed on a NOT NULL column of the\n\t* new table: the columns the rebuild's postchecks mark as becoming required are counted, the\n\t* rebuild's own first, then those of every other operation of its migration.\n\t*/\n\trowsWithoutValue(driver, error, plan) {\n\t\tif (!(SqlQueryError.is(error) && error.sqlState === NOT_NULL_VIOLATION_SQLSTATE)) return Promise.resolve(void 0);\n\t\tconst marks = requiredColumnsOfMigration(plan.operations, plan.edges, plan.operationIndex);\n\t\treturn rowsWithoutValueFailure({\n\t\t\tfailed: marks.filter((mark) => mark.operationIndex === plan.operationIndex),\n\t\t\tothers: marks,\n\t\t\tcount: async ({ required }) => {\n\t\t\t\tconst where = required.reason !== \"newField\" ? ` WHERE ${quoteIdentifier(required.column)} IS NULL` : \"\";\n\t\t\t\treturn (await driver.query(`SELECT COUNT(*) AS rows FROM ${quoteIdentifier(required.table)}${where}`)).rows[0]?.rows ?? 0;\n\t\t\t},\n\t\t\tcontract: plan.contract\n\t\t});\n\t}\n\tstepResultIsTrue(rows) {\n\t\tif (!rows || rows.length === 0) return false;\n\t\tconst firstRow = rows[0];\n\t\tconst firstValue = firstRow ? Object.values(firstRow)[0] : void 0;\n\t\tif (typeof firstValue === \"number\") return firstValue !== 0;\n\t\tif (typeof firstValue === \"boolean\") return firstValue;\n\t\tif (typeof firstValue === \"string\") {\n\t\t\tconst lower = firstValue.toLowerCase();\n\t\t\tif (lower === \"true\" || lower === \"1\") return true;\n\t\t\tif (lower === \"false\" || lower === \"0\") return false;\n\t\t\treturn firstValue.length > 0;\n\t\t}\n\t\treturn Boolean(firstValue);\n\t}\n\tasync expectationsAreSatisfied(driver, steps) {\n\t\tif (steps.length === 0) return false;\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tcreateSkipRecord(operation) {\n\t\treturn Object.freeze({\n\t\t\tid: operation.id,\n\t\t\tlabel: operation.label,\n\t\t\t...ifDefined(\"summary\", operation.summary),\n\t\t\toperationClass: operation.operationClass,\n\t\t\ttarget: operation.target,\n\t\t\tprecheck: Object.freeze([]),\n\t\t\texecute: Object.freeze([]),\n\t\t\tpostcheck: Object.freeze([...operation.postcheck]),\n\t\t\tmeta: Object.freeze({\n\t\t\t\t...operation.meta ?? {},\n\t\t\t\trunner: Object.freeze({\n\t\t\t\t\tskipped: true,\n\t\t\t\t\treason: \"postcheck_pre_satisfied\"\n\t\t\t\t})\n\t\t\t})\n\t\t});\n\t}\n\tmarkerMatchesDestination(marker, plan) {\n\t\tif (!marker) return false;\n\t\tif (marker.storageHash !== plan.destination.storageHash) return false;\n\t\tif (plan.destination.profileHash && marker.profileHash !== plan.destination.profileHash) return false;\n\t\treturn true;\n\t}\n\tenforcePolicyCompatibility(policy, operations) {\n\t\tconst allowedClasses = new Set(policy.allowedOperationClasses);\n\t\tfor (const operation of operations) if (!allowedClasses.has(operation.operationClass)) return runnerFailure(\"MIGRATION.POLICY_VIOLATION\", `Operation ${operation.id} has class \"${operation.operationClass}\" which is not allowed by policy.`, {\n\t\t\twhy: `Policy only allows: ${policy.allowedOperationClasses.join(\", \")}.`,\n\t\t\tmeta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\toperationClass: operation.operationClass,\n\t\t\t\tallowedClasses: policy.allowedOperationClasses\n\t\t\t}\n\t\t});\n\t\treturn okVoid();\n\t}\n\tensureMarkerCompatibility(marker, plan) {\n\t\tconst origin = plan.origin ?? null;\n\t\tif (!origin) return okVoid();\n\t\tif (!marker) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Missing contract marker: expected origin storage hash ${origin.storageHash}.`, { meta: { expectedOriginStorageHash: origin.storageHash } });\n\t\tif (marker.storageHash !== origin.storageHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`, { meta: {\n\t\t\tmarkerStorageHash: marker.storageHash,\n\t\t\texpectedOriginStorageHash: origin.storageHash\n\t\t} });\n\t\tif (origin.profileHash && marker.profileHash !== origin.profileHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker profile hash (${marker.profileHash}) does not match plan origin profile hash (${origin.profileHash}).`, { meta: {\n\t\t\tmarkerProfileHash: marker.profileHash,\n\t\t\texpectedOriginProfileHash: origin.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tensurePlanMatchesDestinationContract(destination, contract) {\n\t\tif (destination.storageHash !== contract.storage.storageHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination storage hash (${destination.storageHash}) does not match provided contract storage hash (${contract.storage.storageHash}).`, { meta: {\n\t\t\tplanStorageHash: destination.storageHash,\n\t\t\tcontractStorageHash: contract.storage.storageHash\n\t\t} });\n\t\tif (destination.profileHash && contract.profileHash && destination.profileHash !== contract.profileHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination profile hash (${destination.profileHash}) does not match provided contract profile hash (${contract.profileHash}).`, { meta: {\n\t\t\tplanProfileHash: destination.profileHash,\n\t\t\tcontractProfileHash: contract.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tasync upsertMarker(driver, options, existingMarker, space) {\n\t\tconst destination = {\n\t\t\tstorageHash: options.plan.destination.storageHash,\n\t\t\tprofileHash: options.plan.destination.profileHash ?? options.destinationContract.profileHash ?? options.plan.destination.storageHash,\n\t\t\tinvariants: options.plan.providedInvariants ?? []\n\t\t};\n\t\tif (!existingMarker) {\n\t\t\tawait this.family.initMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tdestination\n\t\t\t});\n\t\t\treturn okVoid();\n\t\t}\n\t\tif (!await this.family.updateMarker({\n\t\t\tdriver,\n\t\t\tspace,\n\t\t\texpectedFrom: existingMarker.storageHash,\n\t\t\tdestination\n\t\t})) {\n\t\t\tconst found = await this.family.readMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace\n\t\t\t});\n\t\t\treturn runnerFailure(\"MIGRATION.MARKER_CAS_FAILURE\", \"Marker was modified by another process during migration execution.\", { meta: {\n\t\t\t\tspace,\n\t\t\t\texpectedStorageHash: existingMarker.storageHash,\n\t\t\t\tfoundStorageHash: found?.storageHash ?? null,\n\t\t\t\tdestinationStorageHash: options.plan.destination.storageHash\n\t\t\t} });\n\t\t}\n\t\treturn okVoid();\n\t}\n\tasync recordLedgerEntries(driver, options, executedOperations) {\n\t\tconst plan = options.plan;\n\t\tconst space = plan.spaceId;\n\t\tconst edges = options.migrationEdges;\n\t\tconst totalEdgeOps = edges.reduce((sum, edge) => sum + edge.operationCount, 0);\n\t\tif (totalEdgeOps !== plan.operations.length) throw new InternalError(`Ledger write: plan.operations length (${plan.operations.length}) does not match sum of migrationEdges operationCount (${totalEdgeOps})`);\n\t\tlet offset = 0;\n\t\tfor (const edge of edges) {\n\t\t\tconst edgeOps = executedOperations.slice(offset, offset + edge.operationCount);\n\t\t\toffset += edge.operationCount;\n\t\t\tawait this.family.writeLedgerEntry({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tentry: {\n\t\t\t\t\tedgeId: `${edge.from}->${edge.to}`,\n\t\t\t\t\tfrom: edge.from,\n\t\t\t\t\tto: edge.to,\n\t\t\t\t\tmigrationName: edge.dirName,\n\t\t\t\t\tmigrationHash: edge.migrationHash,\n\t\t\t\t\toperations: edgeOps\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\tasync beginExclusiveTransaction(driver) {\n\t\tawait driver.query(\"BEGIN EXCLUSIVE\");\n\t}\n\tasync commitTransaction(driver) {\n\t\tawait driver.query(\"COMMIT\");\n\t}\n\tasync rollbackTransaction(driver) {\n\t\tawait driver.query(\"ROLLBACK\");\n\t}\n\tasync executeStatement(driver, statement) {\n\t\tawait driver.query(statement.sql, statement.params);\n\t}\n};\n//#endregion\n//#region src/core/migrations/sqlite-schema-verifier.ts\n/**\n* SQLite target `SchemaVerifier` concretion. Mirrors the Postgres\n* shape: hooks return the empty list pending the call-site migration\n* that routes the existing verifier behaviour through the SPI.\n*/\nvar SqliteSchemaVerifier = class extends SqlSchemaVerifierBase {\n\tverifyCommonSqlSchema(_options) {\n\t\treturn [];\n\t}\n\tverifyTargetExtensions(_options) {\n\t\treturn [];\n\t}\n};\n//#endregion\n//#region src/core/migrations/control-target.ts\nfunction isSqlContract(contract) {\n\treturn contract === null || contract.storage instanceof SqlStorage;\n}\nconst sqliteControlTargetDescriptor = {\n\t...sqliteTargetDescriptorMeta,\n\tcontractSerializer: new SqliteContractSerializer(),\n\tschemaVerifier: new SqliteSchemaVerifier(),\n\tdiffSchema(input) {\n\t\treturn diffSqliteSchema(input);\n\t},\n\tclassifySubjectGranularity: relationalNodeGranularity,\n\tclassifyEntityKind: relationalNodeEntityKind,\n\tmigrations: {\n\t\tcreatePlanner(adapter) {\n\t\t\treturn createSqliteMigrationPlanner(adapter);\n\t\t},\n\t\tcreateRunner(family) {\n\t\t\treturn createSqliteMigrationRunner(family);\n\t\t},\n\t\tcontractToSchema(contract, frameworkComponents) {\n\t\t\tif (!isSqlContract(contract)) throw sqliteError(\"CONTRACT.TARGET_MISMATCH\", \"sqliteControlTargetDescriptor.contractToSchema received a non-SQL contract; expected Contract<SqlStorage>\");\n\t\t\treturn sqliteContractToSchema(contract, sqlTypeLookupsOf(frameworkComponents));\n\t\t}\n\t},\n\tcreate() {\n\t\treturn {\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: \"sqlite\"\n\t\t};\n\t},\n\tcreatePlanner(adapter) {\n\t\treturn createSqliteMigrationPlanner(adapter);\n\t},\n\tcreateRunner(family) {\n\t\treturn createSqliteMigrationRunner(family);\n\t}\n};\n//#endregion\nexport { SqliteUnboundDatabase, sqliteControlTargetDescriptor as default, sqliteCreateNamespace, sqliteScalarTypeConstructors };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAM,8BAA8B;AACpC,SAAS,4BAA4B,QAAQ;CAC5C,OAAO,IAAI,sBAAsB,MAAM;AACxC;AACA,IAAI,wBAAwB,MAAM;CACjC;CACA,YAAY,QAAQ;EACnB,KAAK,SAAS;CACf;;;;;;;CAOA,MAAM,oBAAoB,SAAS;EAClC,MAAM,SAAS,QAAQ;EACvB,IAAI,QAAQ,UAAU,KAAK,KAAK,QAAQ,UAAU,QAAQ,KAAK,SAAS,MAAM,YAAY,sCAAsC,sCAAsC,QAAQ,MAAM,iCAAiC,QAAQ,KAAK,QAAQ,IAAI,EAAE,MAAM;GACrP,OAAO,QAAQ;GACf,aAAa,QAAQ,KAAK;EAC3B,EAAE,CAAC;EACH,MAAM,QAAQ,QAAQ,KAAK;EAC3B,MAAM,UAAU,UAAU,MAAM,QAAQ,IAAI,QAAQ,KAAK,UAAU,CAAC;EACpE,MAAM,mBAAmB,KAAK,qCAAqC,QAAQ,KAAK,aAAa,QAAQ,mBAAmB;EACxH,IAAI,CAAC,iBAAiB,IAAI,OAAO;EACjC,MAAM,cAAc,KAAK,2BAA2B,QAAQ,QAAQ,OAAO;EAC3E,IAAI,CAAC,YAAY,IAAI,OAAO;EAC5B,MAAM,eAAe,MAAM,KAAK,oBAAoB,QAAQ,QAAQ,mBAAmB;EACvF,IAAI,CAAC,aAAa,IAAI,OAAO;EAC7B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MAAM,OAAO,MAAM,iBAAiB;CACrC;CACA,MAAM,kBAAkB,QAAQ;EAC/B,MAAM,OAAO,MAAM,QAAQ;CAC5B;CACA,MAAM,oBAAoB,QAAQ;EACjC,MAAM,OAAO,MAAM,UAAU;CAC9B;CACA,MAAM,iBAAiB,QAAQ,WAAW;EACzC,MAAM,OAAO,MAAM,UAAU,KAAK,UAAU,MAAM;CACnD;AACD;;;;;;AAQA,IAAI,uBAAuB,cAAc,sBAAsB;CAC9D,sBAAsB,UAAU;EAC/B,OAAO,CAAC;CACT;CACA,uBAAuB,UAAU;EAChC,OAAO,CAAC;CACT;AACD;AAGA,SAAS,cAAc,UAAU;CAChC,OAAO,aAAa,QAAQ,SAAS,mBAAmB;AACzD;AACA,MAAM,gCAAgC;CACrC,GAAG;CACH,oBAAoB,IAAI,yBAAyB;CACjD,gBAAgB,IAAI,qBAAqB;CACzC,WAAW,OAAO;EACjB,OAAO,iBAAiB,KAAK;CAC9B;CACA,4BAA4B;CAC5B,oBAAoB;CACpB,YAAY;EACX,cAAc,SAAS;GACtB,OAAO,6BAA6B,OAAO;EAC5C;EACA,aAAa,QAAQ;GACpB,OAAO,4BAA4B,MAAM;EAC1C;EACA,iBAAiB,UAAU,qBAAqB;GAC/C,IAAI,CAAC,cAAc,QAAQ,GAAG,MAAM,YAAY,4BAA4B,2GAA2G;GACvL,OAAO,uBAAuB,UAAU,iBAAiB,mBAAmB,CAAC;EAC9E;CACD;CACA,SAAS;EACR,OAAO;GACN,UAAU;GACV,UAAU;EACX;CACD;CACA,cAAc,SAAS;EACtB,OAAO,6BAA6B,OAAO;CAC5C;CACA,aAAa,QAAQ;EACpB,OAAO,4BAA4B,MAAM;CAC1C;AACD"}
1
+ {"version":3,"file":"target__control.mjs","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/control.mjs"],"sourcesContent":["import { n as sqliteError } from \"./errors-DnR-sMHS.mjs\";\nimport { n as sqliteScalarTypeConstructors, t as sqliteTargetDescriptorMeta } from \"./descriptor-meta-COSGM3xb.mjs\";\nimport { r as quoteIdentifier } from \"./sql-utils-XGT5Esi2.mjs\";\nimport { i as sqliteCreateNamespace, n as SqliteContractSerializer, r as SqliteUnboundDatabase } from \"./sqlite-contract-view-CGfiGvKH.mjs\";\nimport { _ as diffSqliteSchema, b as verifySqliteDatabaseSchema, y as sqliteContractToSchema } from \"./sqlite-migration-BAdSmooi.mjs\";\nimport { _ as conversionCopyOf, m as affinityStorageClasses, v as rebuiltTableName } from \"./op-factory-call-emj9Xp05.mjs\";\nimport { n as createSqliteMigrationPlanner } from \"./planner-BvwYScnt.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { APP_SPACE_ID, failedPostcheckWhy, failedPrecheckWhy, schemaCheckWhy, withDatabaseUnchanged, withFailingSpace } from \"@internal/framework-components/control\";\nimport { convertedColumnOf, fieldOfColumn, requiredColumnsOfMigration, rowsWithoutValueFailure, runnerFailure, runnerSuccess, sqlTypeLookupsOf, unconvertedFieldOf } from \"@internal/family-sql/control\";\nimport { SqlStorage } from \"@internal/sql-contract/types\";\nimport { relationalNodeEntityKind, relationalNodeGranularity } from \"@internal/sql-schema-ir/types\";\nimport { SqlSchemaVerifierBase } from \"@internal/family-sql/ir\";\nimport { notOk, ok, okVoid } from \"@internal/utils/result\";\nimport { SqlConnectionError, SqlQueryError } from \"@internal/sql-errors\";\n//#region src/core/migrations/runner.ts\nconst NOT_NULL_VIOLATION_SQLSTATE = \"23502\";\nfunction createSqliteMigrationRunner(family) {\n\treturn new SqliteMigrationRunner(family);\n}\nvar SqliteMigrationRunner = class {\n\tfamily;\n\tconstructor(family) {\n\t\tthis.family = family;\n\t}\n\t/**\n\t* Apply the plan against an already-open connection without managing\n\t* the transaction lifecycle. The caller ({@link SqliteMigrationRunner.execute})\n\t* owns BEGIN/COMMIT/ROLLBACK and any connection-level setup (FK pragma\n\t* toggle, FK integrity check).\n\t*/\n\tasync executeOnConnection(options) {\n\t\tconst driver = options.driver;\n\t\tif (options.space !== void 0 && options.space !== options.plan.spaceId) throw sqliteError(\"MIGRATION.CONTRACT_SPACE_VIOLATION\", `SqlMigrationRunner: options.space (${options.space}) does not match plan.spaceId (${options.plan.spaceId})`, { meta: {\n\t\t\tspace: options.space,\n\t\t\tplanSpaceId: options.plan.spaceId\n\t\t} });\n\t\tconst space = options.plan.spaceId;\n\t\tconst planOps = blindCast(await Promise.all(options.plan.operations));\n\t\tconst destinationCheck = this.ensurePlanMatchesDestinationContract(options.plan.destination, options.destinationContract);\n\t\tif (!destinationCheck.ok) return destinationCheck;\n\t\tconst policyCheck = this.enforcePolicyCompatibility(options.policy, planOps);\n\t\tif (!policyCheck.ok) return policyCheck;\n\t\tconst ensureResult = await this.ensureControlTables(driver, options.destinationContract);\n\t\tif (!ensureResult.ok) return ensureResult;\n\t\tconst existingMarker = await this.family.readMarker({\n\t\t\tdriver,\n\t\t\tspace\n\t\t});\n\t\tconst markerCheck = this.ensureMarkerCompatibility(existingMarker, options.plan);\n\t\tif (!markerCheck.ok) return markerCheck;\n\t\tconst markerAtDestination = this.markerMatchesDestination(existingMarker, options.plan);\n\t\tconst isSelfEdge = options.plan.origin?.storageHash === options.plan.destination.storageHash;\n\t\tconst skipOperations = markerAtDestination && options.plan.origin != null && !isSelfEdge;\n\t\tlet operationsExecuted;\n\t\tlet executedOperations;\n\t\tif (skipOperations) {\n\t\t\toperationsExecuted = 0;\n\t\t\texecutedOperations = [];\n\t\t} else {\n\t\t\tconst applyResult = await this.applyPlan(driver, options, planOps);\n\t\t\tif (!applyResult.ok) return applyResult;\n\t\t\toperationsExecuted = applyResult.value.operationsExecuted;\n\t\t\texecutedOperations = applyResult.value.executedOperations;\n\t\t}\n\t\tif (space === APP_SPACE_ID) {\n\t\t\tconst schemaNode = await this.family.introspect({\n\t\t\t\tdriver,\n\t\t\t\tcontract: options.destinationContract\n\t\t\t});\n\t\t\tconst schemaVerifyResult = verifySqliteDatabaseSchema({\n\t\t\t\tcontract: options.destinationContract,\n\t\t\t\tactualSchema: schemaNode,\n\t\t\t\tstrict: options.strictVerification ?? true,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t\tif (!schemaVerifyResult.ok) return runnerFailure(\"MIGRATION.SCHEMA_VERIFY_FAILED\", schemaVerifyResult.summary, {\n\t\t\t\twhy: schemaCheckWhy(schemaVerifyResult.schema.issues),\n\t\t\t\tmeta: { schemaIssues: schemaVerifyResult.schema.issues }\n\t\t\t});\n\t\t}\n\t\tconst incomingInvariants = options.plan.providedInvariants;\n\t\tconst existingInvariants = new Set(existingMarker?.invariants ?? []);\n\t\tconst incomingIsSubsetOfExisting = incomingInvariants.every((id) => existingInvariants.has(id));\n\t\tif (!(isSelfEdge && operationsExecuted === 0 && incomingIsSubsetOfExisting)) {\n\t\t\tconst markerResult = await this.upsertMarker(driver, options, existingMarker, space);\n\t\t\tif (!markerResult.ok) return markerResult;\n\t\t\tawait this.recordLedgerEntries(driver, options, executedOperations);\n\t\t}\n\t\treturn runnerSuccess({\n\t\t\toperationsPlanned: planOps.length,\n\t\t\toperationsExecuted\n\t\t});\n\t}\n\tasync execute(options) {\n\t\tconst driver = options.driver;\n\t\tconst perSpaceOptions = options.perSpaceOptions;\n\t\tif (perSpaceOptions.length === 0) return ok({ perSpaceResults: [] });\n\t\tconst fkWasEnabled = await this.readForeignKeysEnabled(driver);\n\t\tif (fkWasEnabled) await driver.query(\"PRAGMA foreign_keys = OFF\");\n\t\tlet result;\n\t\ttry {\n\t\t\tresult = await this.executeInTransaction(driver, perSpaceOptions, fkWasEnabled);\n\t\t} catch (error) {\n\t\t\tif (fkWasEnabled) await this.afterFailure(driver.query(\"PRAGMA foreign_keys = ON\"));\n\t\t\tthrow error;\n\t\t}\n\t\tif (fkWasEnabled) {\n\t\t\tconst restore = driver.query(\"PRAGMA foreign_keys = ON\");\n\t\t\tawait (result.ok ? restore : this.afterFailure(restore));\n\t\t}\n\t\treturn result;\n\t}\n\tasync executeInTransaction(driver, perSpaceOptions, fkWasEnabled) {\n\t\tawait this.beginExclusiveTransaction(driver);\n\t\tlet result;\n\t\ttry {\n\t\t\tresult = await this.executeSpaces(driver, perSpaceOptions, fkWasEnabled);\n\t\t} catch (error) {\n\t\t\tawait this.afterFailure(this.rollbackTransaction(driver));\n\t\t\tthrow error;\n\t\t}\n\t\tif (!result.ok) {\n\t\t\tawait this.afterFailure(this.rollbackTransaction(driver));\n\t\t\treturn notOk(withDatabaseUnchanged(result.failure, true));\n\t\t}\n\t\ttry {\n\t\t\tawait this.commitTransaction(driver);\n\t\t} catch (error) {\n\t\t\tawait this.afterFailure(this.rollbackTransaction(driver));\n\t\t\tthrow error;\n\t\t}\n\t\treturn result;\n\t}\n\tasync afterFailure(cleanup) {\n\t\tawait cleanup.catch(() => void 0);\n\t}\n\tasync executeSpaces(driver, perSpaceOptions, fkWasEnabled) {\n\t\tconst perSpaceResults = [];\n\t\tlet lastProcessedSpace;\n\t\tfor (const spaceOptions of perSpaceOptions) {\n\t\t\tconst space = spaceOptions.space ?? spaceOptions.plan.spaceId;\n\t\t\tconst result = await this.executeOnConnection({\n\t\t\t\t...spaceOptions,\n\t\t\t\tdriver,\n\t\t\t\tspace\n\t\t\t});\n\t\t\tif (!result.ok) return notOk(withFailingSpace(result.failure, space));\n\t\t\tperSpaceResults.push({\n\t\t\t\tspace,\n\t\t\t\tvalue: result.value\n\t\t\t});\n\t\t\tlastProcessedSpace = space;\n\t\t}\n\t\tif (fkWasEnabled) {\n\t\t\tconst fkIntegrityCheck = await this.verifyForeignKeyIntegrity(driver);\n\t\t\tif (!fkIntegrityCheck.ok) return notOk(withFailingSpace(fkIntegrityCheck.failure, lastProcessedSpace ?? APP_SPACE_ID));\n\t\t}\n\t\treturn ok({ perSpaceResults });\n\t}\n\tasync readForeignKeysEnabled(driver) {\n\t\treturn (await driver.query(\"PRAGMA foreign_keys\")).rows[0]?.foreign_keys === 1;\n\t}\n\tasync verifyForeignKeyIntegrity(driver) {\n\t\tconst result = await driver.query(\"PRAGMA foreign_key_check\");\n\t\tif (result.rows.length === 0) return okVoid();\n\t\treturn runnerFailure(\"MIGRATION.FOREIGN_KEY_VIOLATION\", `Foreign key integrity check failed after migration: ${result.rows.length} violation(s).`, {\n\t\t\twhy: \"PRAGMA foreign_key_check reported violations after applying recreate-table operations.\",\n\t\t\tmeta: { violations: result.rows }\n\t\t});\n\t}\n\tasync applyPlan(driver, options, ops) {\n\t\tconst checks = options.executionChecks;\n\t\tconst runPrechecks = checks?.prechecks !== false;\n\t\tconst runPostchecks = checks?.postchecks !== false;\n\t\tconst runIdempotency = checks?.idempotencyChecks !== false;\n\t\tlet operationsExecuted = 0;\n\t\tconst executedOperations = [];\n\t\tfor (const operation of ops) {\n\t\t\toptions.callbacks?.onOperationStart?.(operation);\n\t\t\ttry {\n\t\t\t\tif (runPostchecks && runIdempotency) {\n\t\t\t\t\tif (await this.expectationsAreSatisfied(driver, operation.postcheck)) {\n\t\t\t\t\t\texecutedOperations.push(this.createSkipRecord(operation));\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (runPrechecks) {\n\t\t\t\t\tconst precheckResult = await this.runExpectationSteps(driver, operation.precheck, operation, \"precheck\");\n\t\t\t\t\tif (!precheckResult.ok) return precheckResult;\n\t\t\t\t}\n\t\t\t\tconst executeResult = await this.runExecuteSteps(driver, operation.execute, operation, {\n\t\t\t\t\tcontract: options.destinationContract,\n\t\t\t\t\toperationIndex: ops.indexOf(operation),\n\t\t\t\t\toperations: ops,\n\t\t\t\t\tedges: options.migrationEdges\n\t\t\t\t});\n\t\t\t\tif (!executeResult.ok) return executeResult;\n\t\t\t\tif (runPostchecks) {\n\t\t\t\t\tconst postcheckResult = await this.runExpectationSteps(driver, operation.postcheck, operation, \"postcheck\", {\n\t\t\t\t\t\tcontract: options.destinationContract,\n\t\t\t\t\t\toperationIndex: ops.indexOf(operation)\n\t\t\t\t\t});\n\t\t\t\t\tif (!postcheckResult.ok) return postcheckResult;\n\t\t\t\t}\n\t\t\t\texecutedOperations.push(operation);\n\t\t\t\toperationsExecuted += 1;\n\t\t\t} finally {\n\t\t\t\toptions.callbacks?.onOperationComplete?.(operation);\n\t\t\t}\n\t\t}\n\t\treturn ok({\n\t\t\toperationsExecuted,\n\t\t\texecutedOperations\n\t\t});\n\t}\n\tasync ensureControlTables(driver, contract) {\n\t\tconst lowererContext = { contract };\n\t\tfor (const query of this.family.bootstrapControlTableQueries()) await this.executeStatement(driver, await this.family.lowerAst(query, lowererContext));\n\t\treturn okVoid();\n\t}\n\tasync runExpectationSteps(driver, steps, operation, phase, plan) {\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) {\n\t\t\t\tconst code = phase === \"precheck\" ? \"MIGRATION.PRECHECK_FAILED\" : \"MIGRATION.POSTCHECK_FAILED\";\n\t\t\t\tconst field = plan === void 0 ? void 0 : unconvertedFieldOf(step, plan.contract);\n\t\t\t\tconst converted = convertedColumnOf(step);\n\t\t\t\tconst failedCheck = {\n\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\tphase,\n\t\t\t\t\tdescription: step.description,\n\t\t\t\t\t...ifDefined(\"expectation\", step.expectation)\n\t\t\t\t};\n\t\t\t\tconst unconverted = converted === void 0 ? void 0 : await this.unconvertedValueText(driver, converted);\n\t\t\t\treturn runnerFailure(code, `Operation ${operation.id} failed during ${phase}: ${step.description}`, {\n\t\t\t\t\t...ifDefined(\"why\", unconverted ?? (phase === \"precheck\" ? failedPrecheckWhy(failedCheck) : failedPostcheckWhy(failedCheck))),\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\tfailedCheck,\n\t\t\t\t\t\t...ifDefined(\"failedTypeChange\", field === void 0 || plan === void 0 || converted === void 0 ? void 0 : converted.by === \"conversion\" ? {\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tby: \"conversion\",\n\t\t\t\t\t\t\treason: \"invalidResult\",\n\t\t\t\t\t\t\toperationIndex: plan.operationIndex\n\t\t\t\t\t\t} : {\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tby: \"cast\",\n\t\t\t\t\t\t\treason: \"value\",\n\t\t\t\t\t\t\toperationIndex: plan.operationIndex\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn okVoid();\n\t}\n\t/** Names the first value of a retyped column that kept a storage class its new type does not hold. */\n\tasync unconvertedValueText(driver, cast) {\n\t\tconst typeSql = (await driver.query(\"SELECT type FROM pragma_table_info(?) WHERE name = ?\", [cast.table, cast.column])).rows[0]?.type;\n\t\tif (typeSql === void 0) return void 0;\n\t\tconst column = quoteIdentifier(cast.column);\n\t\tconst classes = [\"null\", ...affinityStorageClasses(typeSql)];\n\t\tconst row = (await driver.query(`SELECT quote(${column}) AS value, typeof(${column}) AS storageClass FROM ${quoteIdentifier(cast.table)} WHERE typeof(${column}) NOT IN (${classes.map(() => \"?\").join(\", \")}) LIMIT 1`, classes)).rows[0];\n\t\tif (row === void 0) return void 0;\n\t\treturn `The value ${row.value.length > 40 ? `${row.value.slice(0, 40)}…` : row.value} of column \"${cast.column}\" on \"${cast.table}\" is still stored as ${row.storageClass}, which ${typeSql} cannot hold.`;\n\t}\n\tasync runExecuteSteps(driver, steps, operation, plan) {\n\t\tfor (const step of steps) try {\n\t\t\tawait driver.query(step.sql, step.params ?? []);\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\tconst failed = `Operation ${operation.id} failed during execution: ${step.description}`;\n\t\t\tif (SqlConnectionError.is(error)) return runnerFailure(\"MIGRATION.EXECUTION_FAILED\", failed, {\n\t\t\t\twhy: message,\n\t\t\t\tmeta: {\n\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\tstepDescription: step.description,\n\t\t\t\t\tsql: step.sql,\n\t\t\t\t\tconnectionLost: error.transient === false,\n\t\t\t\t\ttransient: error.transient\n\t\t\t\t}\n\t\t\t});\n\t\t\tconst rowsWithoutValue = await this.rowsWithoutValue(driver, error, plan);\n\t\t\tconst failedConversion = rowsWithoutValue === void 0 ? await this.failedConversion(driver, step, error, plan) : void 0;\n\t\t\treturn runnerFailure(\"MIGRATION.EXECUTION_FAILED\", rowsWithoutValue?.summary ?? failed, {\n\t\t\t\twhy: rowsWithoutValue === void 0 ? message : `${failed}: ${message}`,\n\t\t\t\tmeta: {\n\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\tstepDescription: step.description,\n\t\t\t\t\tsql: step.sql,\n\t\t\t\t\t...ifDefined(\"rowsWithoutValue\", rowsWithoutValue?.reports),\n\t\t\t\t\t...ifDefined(\"failedTypeChange\", failedConversion)\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn okVoid();\n\t}\n\t/**\n\t* The conversion that failed, when the failed step is the copy of a rebuild that converts columns\n\t* and there is evidence for it: a copy expression that fails on its own has an error in its\n\t* expression, and a constraint of the new table that names a converted column was broken by a\n\t* value the conversion produced. Any other failure of the copy is not the conversion's.\n\t*/\n\tasync failedConversion(driver, step, error, plan) {\n\t\tconst copy = conversionCopyOf(step);\n\t\tif (copy === void 0) return void 0;\n\t\tconst columns = Object.keys(copy.expressions);\n\t\tconst failed = async (column) => {\n\t\t\ttry {\n\t\t\t\tawait driver.query(`SELECT ${copy.expressions[column]} FROM ${quoteIdentifier(copy.table)}`);\n\t\t\t\treturn false;\n\t\t\t} catch {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t};\n\t\tfor (const column of columns) if (await failed(column)) return this.conversionOf(plan, copy.table, column, \"expressionError\");\n\t\tconst constrainedList = SqlQueryError.is(error) ? error.constraint : void 0;\n\t\tif (constrainedList === void 0) return void 0;\n\t\tconst constrained = new Set(constrainedList.split(\", \"));\n\t\tconst column = columns.find((name) => constrained.has(`${rebuiltTableName(copy.table)}.${name}`));\n\t\treturn column === void 0 ? void 0 : this.conversionOf(plan, copy.table, column, \"invalidResult\");\n\t}\n\tconversionOf(plan, table, column, reason) {\n\t\tconst field = fieldOfColumn(plan.contract, table, column);\n\t\treturn field === void 0 ? void 0 : {\n\t\t\tfield,\n\t\t\tby: \"conversion\",\n\t\t\treason,\n\t\t\toperationIndex: plan.operationIndex\n\t\t};\n\t}\n\t/**\n\t* The rows a table rebuild found no value for, when its copy failed on a NOT NULL column of the\n\t* new table: the columns the rebuild's postchecks mark as becoming required are counted, the\n\t* rebuild's own first, then those of every other operation of its migration.\n\t*/\n\trowsWithoutValue(driver, error, plan) {\n\t\tif (!(SqlQueryError.is(error) && error.sqlState === NOT_NULL_VIOLATION_SQLSTATE)) return Promise.resolve(void 0);\n\t\tconst marks = requiredColumnsOfMigration(plan.operations, plan.edges, plan.operationIndex);\n\t\treturn rowsWithoutValueFailure({\n\t\t\tfailed: marks.filter((mark) => mark.operationIndex === plan.operationIndex),\n\t\t\tothers: marks,\n\t\t\tcount: async ({ required }) => {\n\t\t\t\tconst where = required.reason !== \"newField\" ? ` WHERE ${quoteIdentifier(required.column)} IS NULL` : \"\";\n\t\t\t\treturn (await driver.query(`SELECT COUNT(*) AS rows FROM ${quoteIdentifier(required.table)}${where}`)).rows[0]?.rows ?? 0;\n\t\t\t},\n\t\t\tcontract: plan.contract\n\t\t});\n\t}\n\tstepResultIsTrue(rows) {\n\t\tif (!rows || rows.length === 0) return false;\n\t\tconst firstRow = rows[0];\n\t\tconst firstValue = firstRow ? Object.values(firstRow)[0] : void 0;\n\t\tif (typeof firstValue === \"number\") return firstValue !== 0;\n\t\tif (typeof firstValue === \"boolean\") return firstValue;\n\t\tif (typeof firstValue === \"string\") {\n\t\t\tconst lower = firstValue.toLowerCase();\n\t\t\tif (lower === \"true\" || lower === \"1\") return true;\n\t\t\tif (lower === \"false\" || lower === \"0\") return false;\n\t\t\treturn firstValue.length > 0;\n\t\t}\n\t\treturn Boolean(firstValue);\n\t}\n\tasync expectationsAreSatisfied(driver, steps) {\n\t\tif (steps.length === 0) return false;\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tcreateSkipRecord(operation) {\n\t\treturn Object.freeze({\n\t\t\tid: operation.id,\n\t\t\tlabel: operation.label,\n\t\t\t...ifDefined(\"summary\", operation.summary),\n\t\t\toperationClass: operation.operationClass,\n\t\t\ttarget: operation.target,\n\t\t\tprecheck: Object.freeze([]),\n\t\t\texecute: Object.freeze([]),\n\t\t\tpostcheck: Object.freeze([...operation.postcheck]),\n\t\t\tmeta: Object.freeze({\n\t\t\t\t...operation.meta ?? {},\n\t\t\t\trunner: Object.freeze({\n\t\t\t\t\tskipped: true,\n\t\t\t\t\treason: \"postcheck_pre_satisfied\"\n\t\t\t\t})\n\t\t\t})\n\t\t});\n\t}\n\tmarkerMatchesDestination(marker, plan) {\n\t\tif (!marker) return false;\n\t\tif (marker.storageHash !== plan.destination.storageHash) return false;\n\t\tif (plan.destination.profileHash && marker.profileHash !== plan.destination.profileHash) return false;\n\t\treturn true;\n\t}\n\tenforcePolicyCompatibility(policy, operations) {\n\t\tconst allowedClasses = new Set(policy.allowedOperationClasses);\n\t\tfor (const operation of operations) if (!allowedClasses.has(operation.operationClass)) return runnerFailure(\"MIGRATION.POLICY_VIOLATION\", `Operation ${operation.id} has class \"${operation.operationClass}\" which is not allowed by policy.`, {\n\t\t\twhy: `Policy only allows: ${policy.allowedOperationClasses.join(\", \")}.`,\n\t\t\tmeta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\toperationClass: operation.operationClass,\n\t\t\t\tallowedClasses: policy.allowedOperationClasses\n\t\t\t}\n\t\t});\n\t\treturn okVoid();\n\t}\n\tensureMarkerCompatibility(marker, plan) {\n\t\tconst origin = plan.origin ?? null;\n\t\tif (!origin) return okVoid();\n\t\tif (!marker) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Missing contract marker: expected origin storage hash ${origin.storageHash}.`, { meta: { expectedOriginStorageHash: origin.storageHash } });\n\t\tif (marker.storageHash !== origin.storageHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`, { meta: {\n\t\t\tmarkerStorageHash: marker.storageHash,\n\t\t\texpectedOriginStorageHash: origin.storageHash\n\t\t} });\n\t\tif (origin.profileHash && marker.profileHash !== origin.profileHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker profile hash (${marker.profileHash}) does not match plan origin profile hash (${origin.profileHash}).`, { meta: {\n\t\t\tmarkerProfileHash: marker.profileHash,\n\t\t\texpectedOriginProfileHash: origin.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tensurePlanMatchesDestinationContract(destination, contract) {\n\t\tif (destination.storageHash !== contract.storage.storageHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination storage hash (${destination.storageHash}) does not match provided contract storage hash (${contract.storage.storageHash}).`, { meta: {\n\t\t\tplanStorageHash: destination.storageHash,\n\t\t\tcontractStorageHash: contract.storage.storageHash\n\t\t} });\n\t\tif (destination.profileHash && contract.profileHash && destination.profileHash !== contract.profileHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination profile hash (${destination.profileHash}) does not match provided contract profile hash (${contract.profileHash}).`, { meta: {\n\t\t\tplanProfileHash: destination.profileHash,\n\t\t\tcontractProfileHash: contract.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tasync upsertMarker(driver, options, existingMarker, space) {\n\t\tconst destination = {\n\t\t\tstorageHash: options.plan.destination.storageHash,\n\t\t\tprofileHash: options.plan.destination.profileHash ?? options.destinationContract.profileHash ?? options.plan.destination.storageHash,\n\t\t\tinvariants: options.plan.providedInvariants ?? []\n\t\t};\n\t\tif (!existingMarker) {\n\t\t\tawait this.family.initMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tdestination\n\t\t\t});\n\t\t\treturn okVoid();\n\t\t}\n\t\tif (!await this.family.updateMarker({\n\t\t\tdriver,\n\t\t\tspace,\n\t\t\texpectedFrom: existingMarker.storageHash,\n\t\t\tdestination\n\t\t})) {\n\t\t\tconst found = await this.family.readMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace\n\t\t\t});\n\t\t\treturn runnerFailure(\"MIGRATION.MARKER_CAS_FAILURE\", \"Marker was modified by another process during migration execution.\", { meta: {\n\t\t\t\tspace,\n\t\t\t\texpectedStorageHash: existingMarker.storageHash,\n\t\t\t\tfoundStorageHash: found?.storageHash ?? null,\n\t\t\t\tdestinationStorageHash: options.plan.destination.storageHash\n\t\t\t} });\n\t\t}\n\t\treturn okVoid();\n\t}\n\tasync recordLedgerEntries(driver, options, executedOperations) {\n\t\tconst plan = options.plan;\n\t\tconst space = plan.spaceId;\n\t\tconst edges = options.migrationEdges;\n\t\tconst totalEdgeOps = edges.reduce((sum, edge) => sum + edge.operationCount, 0);\n\t\tif (totalEdgeOps !== plan.operations.length) throw new InternalError(`Ledger write: plan.operations length (${plan.operations.length}) does not match sum of migrationEdges operationCount (${totalEdgeOps})`);\n\t\tlet offset = 0;\n\t\tfor (const edge of edges) {\n\t\t\tconst edgeOps = executedOperations.slice(offset, offset + edge.operationCount);\n\t\t\toffset += edge.operationCount;\n\t\t\tawait this.family.writeLedgerEntry({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tentry: {\n\t\t\t\t\tedgeId: `${edge.from}->${edge.to}`,\n\t\t\t\t\tfrom: edge.from,\n\t\t\t\t\tto: edge.to,\n\t\t\t\t\tmigrationName: edge.dirName,\n\t\t\t\t\tmigrationHash: edge.migrationHash,\n\t\t\t\t\toperations: edgeOps\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\tasync beginExclusiveTransaction(driver) {\n\t\tawait driver.query(\"BEGIN EXCLUSIVE\");\n\t}\n\tasync commitTransaction(driver) {\n\t\tawait driver.query(\"COMMIT\");\n\t}\n\tasync rollbackTransaction(driver) {\n\t\tawait driver.query(\"ROLLBACK\");\n\t}\n\tasync executeStatement(driver, statement) {\n\t\tawait driver.query(statement.sql, statement.params);\n\t}\n};\n//#endregion\n//#region src/core/migrations/sqlite-schema-verifier.ts\n/**\n* SQLite target `SchemaVerifier` concretion. Mirrors the Postgres\n* shape: hooks return the empty list pending the call-site migration\n* that routes the existing verifier behaviour through the SPI.\n*/\nvar SqliteSchemaVerifier = class extends SqlSchemaVerifierBase {\n\tverifyCommonSqlSchema(_options) {\n\t\treturn [];\n\t}\n\tverifyTargetExtensions(_options) {\n\t\treturn [];\n\t}\n};\n//#endregion\n//#region src/core/migrations/control-target.ts\nfunction isSqlContract(contract) {\n\treturn contract === null || contract.storage instanceof SqlStorage;\n}\nconst sqliteControlTargetDescriptor = {\n\t...sqliteTargetDescriptorMeta,\n\tcontractSerializer: new SqliteContractSerializer(),\n\tschemaVerifier: new SqliteSchemaVerifier(),\n\tdiffSchema(input) {\n\t\treturn diffSqliteSchema(input);\n\t},\n\tclassifySubjectGranularity: relationalNodeGranularity,\n\tclassifyEntityKind: relationalNodeEntityKind,\n\tmigrations: {\n\t\tcreatePlanner(adapter) {\n\t\t\treturn createSqliteMigrationPlanner(adapter);\n\t\t},\n\t\tcreateRunner(family) {\n\t\t\treturn createSqliteMigrationRunner(family);\n\t\t},\n\t\tcontractToSchema(contract, frameworkComponents) {\n\t\t\tif (!isSqlContract(contract)) throw sqliteError(\"CONTRACT.TARGET_MISMATCH\", \"sqliteControlTargetDescriptor.contractToSchema received a non-SQL contract; expected Contract<SqlStorage>\");\n\t\t\treturn sqliteContractToSchema(contract, sqlTypeLookupsOf(frameworkComponents));\n\t\t}\n\t},\n\tcreate() {\n\t\treturn {\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: \"sqlite\"\n\t\t};\n\t},\n\tcreatePlanner(adapter) {\n\t\treturn createSqliteMigrationPlanner(adapter);\n\t},\n\tcreateRunner(family) {\n\t\treturn createSqliteMigrationRunner(family);\n\t}\n};\n//#endregion\nexport { SqliteUnboundDatabase, sqliteControlTargetDescriptor as default, sqliteCreateNamespace, sqliteScalarTypeConstructors };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAM,8BAA8B;AACpC,SAAS,4BAA4B,QAAQ;CAC5C,OAAO,IAAI,sBAAsB,MAAM;AACxC;AACA,IAAI,wBAAwB,MAAM;CACjC;CACA,YAAY,QAAQ;EACnB,KAAK,SAAS;CACf;;;;;;;CAOA,MAAM,oBAAoB,SAAS;EAClC,MAAM,SAAS,QAAQ;EACvB,IAAI,QAAQ,UAAU,KAAK,KAAK,QAAQ,UAAU,QAAQ,KAAK,SAAS,MAAM,YAAY,sCAAsC,sCAAsC,QAAQ,MAAM,iCAAiC,QAAQ,KAAK,QAAQ,IAAI,EAAE,MAAM;GACrP,OAAO,QAAQ;GACf,aAAa,QAAQ,KAAK;EAC3B,EAAE,CAAC;EACH,MAAM,QAAQ,QAAQ,KAAK;EAC3B,MAAM,UAAU,UAAU,MAAM,QAAQ,IAAI,QAAQ,KAAK,UAAU,CAAC;EACpE,MAAM,mBAAmB,KAAK,qCAAqC,QAAQ,KAAK,aAAa,QAAQ,mBAAmB;EACxH,IAAI,CAAC,iBAAiB,IAAI,OAAO;EACjC,MAAM,cAAc,KAAK,2BAA2B,QAAQ,QAAQ,OAAO;EAC3E,IAAI,CAAC,YAAY,IAAI,OAAO;EAC5B,MAAM,eAAe,MAAM,KAAK,oBAAoB,QAAQ,QAAQ,mBAAmB;EACvF,IAAI,CAAC,aAAa,IAAI,OAAO;EAC7B,MAAM,iBAAiB,MAAM,KAAK,OAAO,WAAW;GACnD;GACA;EACD,CAAC;EACD,MAAM,cAAc,KAAK,0BAA0B,gBAAgB,QAAQ,IAAI;EAC/E,IAAI,CAAC,YAAY,IAAI,OAAO;EAC5B,MAA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ACpB,OAAO,4BAA4B,MAAM;EAC1C;EACA,iBAAiB,UAAU,qBAAqB;GAC/C,IAAI,CAAC,cAAc,QAAQ,GAAG,MAAM,YAAY,4BAA4B,2GAA2G;GACvL,OAAO,uBAAuB,UAAU,iBAAiB,mBAAmB,CAAC;EAC9E;CACD;CACA,SAAS;EACR,OAAO;GACN,UAAU;GACV,UAAU;EACX;CACD;CACA,cAAc,SAAS;EACtB,OAAO,6BAA6B,OAAO;CAC5C;CACA,aAAa,QAAQ;EACpB,OAAO,4BAA4B,MAAM;CAC1C;AACD"}
@@ -1,2 +1,2 @@
1
- import { t as sqliteTargetDescriptorMeta } from "./pack-DR0n9vHJ.mjs";
1
+ import { t as sqliteTargetDescriptorMeta } from "./pack-B3YrlPJI.mjs";
2
2
  export { sqliteTargetDescriptorMeta as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-target-sqlite",
3
- "version": "8.0.0-rc.20-dev.2",
3
+ "version": "8.0.0-rc.20-dev.4",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -9,19 +9,19 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@prisma/orm-family-sql": "8.0.0-rc.20-dev.2",
13
- "@prisma/orm-framework": "8.0.0-rc.20-dev.2",
14
- "@prisma/orm-toolchain": "8.0.0-rc.20-dev.2",
12
+ "@prisma/orm-family-sql": "8.0.0-rc.20-dev.4",
13
+ "@prisma/orm-framework": "8.0.0-rc.20-dev.4",
14
+ "@prisma/orm-toolchain": "8.0.0-rc.20-dev.4",
15
15
  "@standard-schema/spec": "1.1.0",
16
16
  "arktype": "^2.2.2",
17
17
  "pathe": "^2.0.3"
18
18
  },
19
19
  "devDependencies": {
20
- "@internal/adapter-sqlite": "8.0.0-rc.20-dev.2",
21
- "@internal/driver-sqlite": "8.0.0-rc.20-dev.2",
22
- "@internal/target-sqlite": "8.0.0-rc.20-dev.2",
23
- "@repo/tsconfig": "8.0.0-rc.20-dev.2",
24
- "@repo/tsdown": "8.0.0-rc.20-dev.2",
20
+ "@internal/adapter-sqlite": "8.0.0-rc.20-dev.4",
21
+ "@internal/driver-sqlite": "8.0.0-rc.20-dev.4",
22
+ "@internal/target-sqlite": "8.0.0-rc.20-dev.4",
23
+ "@repo/tsconfig": "8.0.0-rc.20-dev.4",
24
+ "@repo/tsdown": "8.0.0-rc.20-dev.4",
25
25
  "tsdown": "0.22.14",
26
26
  "typescript": "5.9.3"
27
27
  },
@@ -1 +0,0 @@
1
- {"version":3,"file":"control-BxbKU2xs.mjs","names":[],"sources":["../../../../3-targets/sqlite/3-driver/dist/control.mjs"],"sourcesContent":["import { n as sqliteParams, r as normalizeSqliteError, t as sqliteDriverDescriptorMeta } from \"./descriptor-meta-cwy5CXTT.mjs\";\nimport { DatabaseSync } from \"node:sqlite\";\nimport { pathToFileURL } from \"node:url\";\nimport { errorRuntime } from \"@internal/errors/execution\";\nimport { basename } from \"pathe\";\n//#region src/core/migrations/control-driver.ts\nvar SqliteControlDriver = class {\n\tdb;\n\tlocation;\n\tfamilyId = \"sql\";\n\ttargetId = \"sqlite\";\n\tconstructor(db, location) {\n\t\tthis.db = db;\n\t\tthis.location = location;\n\t}\n\tasync query(sql, params) {\n\t\ttry {\n\t\t\treturn { rows: this.db.prepare(sql).all(...sqliteParams(params)) };\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error);\n\t\t}\n\t}\n\tasync databaseName() {\n\t\tif (this.location === \":memory:\" || this.location.length === 0) return;\n\t\tconst name = basename(this.location);\n\t\treturn name.length > 0 ? name : void 0;\n\t}\n\tasync close() {\n\t\tthis.db.close();\n\t}\n};\n/** The file as a URI that SQLite opens for reading and writing, failing rather than creating it. */\nfunction existingFileOnly(pathOrMemory) {\n\tif (pathOrMemory === \":memory:\") return pathOrMemory;\n\tconst uri = pathToFileURL(pathOrMemory);\n\turi.searchParams.set(\"mode\", \"rw\");\n\treturn uri;\n}\nconst sqliteDriverDescriptor = {\n\t...sqliteDriverDescriptorMeta,\n\tasync create(pathOrMemory, options) {\n\t\ttry {\n\t\t\tconst db = new DatabaseSync(options?.existingDatabaseOnly === true ? existingFileOnly(pathOrMemory) : pathOrMemory);\n\t\t\tdb.exec(\"PRAGMA foreign_keys = ON\");\n\t\t\tdb.exec(\"PRAGMA busy_timeout = 5000\");\n\t\t\treturn new SqliteControlDriver(db, pathOrMemory);\n\t\t} catch (error) {\n\t\t\tthrow errorRuntime(\"DRIVER.CONNECTION_FAILED\", \"Database connection failed\", {\n\t\t\t\twhy: error instanceof Error ? error.message : String(error),\n\t\t\t\tfix: \"Verify the database file path exists and is accessible\",\n\t\t\t\tmeta: { path: pathOrMemory },\n\t\t\t\tcause: error\n\t\t\t});\n\t\t}\n\t}\n};\n//#endregion\nexport { SqliteControlDriver, sqliteDriverDescriptor as default };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;AAMA,IAAI,sBAAsB,MAAM;CAC/B;CACA;CACA,WAAW;CACX,WAAW;CACX,YAAY,IAAI,UAAU;EACzB,KAAK,KAAK;EACV,KAAK,WAAW;CACjB;CACA,MAAM,MAAM,KAAK,QAAQ;EACxB,IAAI;GACH,OAAO,EAAE,MAAM,KAAK,GAAG,QAAQ,GAAG,CAAC,CAAC,IAAI,GAAG,aAAa,MAAM,CAAC,EAAE;EAClE,SAAS,OAAO;GACf,MAAM,qBAAqB,KAAK;EACjC;CACD;CACA,MAAM,eAAe;EACpB,IAAI,KAAK,aAAa,cAAc,KAAK,SAAS,WAAW,GAAG;EAChE,MAAM,OAAO,SAAS,KAAK,QAAQ;EACnC,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK;CACtC;CACA,MAAM,QAAQ;EACb,KAAK,GAAG,MAAM;CACf;AACD;;AAEA,SAAS,iBAAiB,cAAc;CACvC,IAAI,iBAAiB,YAAY,OAAO;CACxC,MAAM,MAAM,cAAc,YAAY;CACtC,IAAI,aAAa,IAAI,QAAQ,IAAI;CACjC,OAAO;AACR;AACA,MAAM,yBAAyB;CAC9B,GAAG;CACH,MAAM,OAAO,cAAc,SAAS;EACnC,IAAI;GACH,MAAM,KAAK,IAAI,aAAa,SAAS,yBAAyB,OAAO,iBAAiB,YAAY,IAAI,YAAY;GAClH,GAAG,KAAK,0BAA0B;GAClC,GAAG,KAAK,4BAA4B;GACpC,OAAO,IAAI,oBAAoB,IAAI,YAAY;EAChD,SAAS,OAAO;GACf,MAAM,aAAa,4BAA4B,8BAA8B;IAC5E,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;IAC1D,KAAK;IACL,MAAM,EAAE,MAAM,aAAa;IAC3B,OAAO;GACR,CAAC;EACF;CACD;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"descriptor-meta-cwy5CXTT-CLOhiryX.mjs","names":[],"sources":["../../../../3-targets/sqlite/3-driver/dist/descriptor-meta-cwy5CXTT.mjs"],"sourcesContent":["import { SqlConnectionError, SqlQueryError } from \"@internal/sql-errors\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/normalize-error.ts\nconst SQLITE_CONSTRAINT_BASE = 19;\nconst SQLITE_CONSTRAINT_UNIQUE = 2067;\nconst SQLITE_CONSTRAINT_PRIMARYKEY = 1555;\nconst SQLITE_CONSTRAINT_FOREIGNKEY = 787;\nconst SQLITE_CONSTRAINT_NOTNULL = 1299;\nconst SQLITE_CONSTRAINT_CHECK = 275;\nconst SQLITE_BUSY = 5;\nconst SQLITE_LOCKED = 6;\nfunction isConstraintError(errcode) {\n\treturn (errcode & 255) === SQLITE_CONSTRAINT_BASE;\n}\nfunction isBusyOrLocked(errcode) {\n\tconst base = errcode & 255;\n\treturn base === SQLITE_BUSY || base === SQLITE_LOCKED;\n}\nfunction isSqliteError(error) {\n\tif (!(error instanceof Error)) return false;\n\treturn error.code === \"ERR_SQLITE_ERROR\";\n}\nfunction constraintNameFromMessage(message) {\n\treturn /constraint failed: (.+)/.exec(message)?.[1];\n}\nfunction mapErrCodeToSqlState(errcode) {\n\tswitch (errcode) {\n\t\tcase SQLITE_CONSTRAINT_UNIQUE:\n\t\tcase SQLITE_CONSTRAINT_PRIMARYKEY: return \"23505\";\n\t\tcase SQLITE_CONSTRAINT_FOREIGNKEY: return \"23503\";\n\t\tcase SQLITE_CONSTRAINT_NOTNULL: return \"23502\";\n\t\tcase SQLITE_CONSTRAINT_CHECK: return \"23514\";\n\t\tdefault:\n\t\t\tif (isConstraintError(errcode)) return \"23000\";\n\t\t\treturn \"HY000\";\n\t}\n}\nfunction normalizeSqliteError(error) {\n\tif (!(error instanceof Error)) return new Error(String(error));\n\tif (isSqliteError(error)) {\n\t\tconst errcode = error.errcode ?? 0;\n\t\tif (isBusyOrLocked(errcode)) return new SqlConnectionError(error.message, {\n\t\t\tcause: error,\n\t\t\ttransient: true\n\t\t});\n\t\tconst sqlState = mapErrCodeToSqlState(errcode);\n\t\tconst constraint = constraintNameFromMessage(error.message);\n\t\treturn new SqlQueryError(error.message, {\n\t\t\tcause: error,\n\t\t\tsqlState,\n\t\t\t...constraint !== void 0 ? { constraint } : {}\n\t\t});\n\t}\n\tif (error.message.includes(\"database is locked\") || error.message.includes(\"unable to open database\")) return new SqlConnectionError(error.message, {\n\t\tcause: error,\n\t\ttransient: false\n\t});\n\treturn error;\n}\n//#endregion\n//#region src/sqlite-params.ts\n/**\n* The parameters to bind to a SQLite statement. SQLite cannot store NaN and binds it as NULL. The float codecs refuse NaN when they encode, naming the codec; this refuses a NaN no codec encoded, such as a raw SQL parameter, with the same code and `meta.received`, and `meta.paramIndex` in place of `meta.codecId`.\n*/\nfunction sqliteParams(params) {\n\tconst values = params ?? [];\n\tconst nanIndex = values.findIndex((value) => Number.isNaN(value));\n\tif (nanIndex !== -1) throw structuredError(\"RUNTIME.ENCODE_FAILED\", `Parameter ${nanIndex + 1} is NaN, which SQLite cannot store: it would bind it as NULL. Pass null to store no value.`, { meta: {\n\t\tparamIndex: nanIndex,\n\t\treceived: \"NaN\"\n\t} });\n\treturn blindCast(values);\n}\n//#endregion\n//#region src/core/descriptor-meta.ts\nconst sqliteDriverDescriptorMeta = {\n\tkind: \"driver\",\n\tfamilyId: \"sql\",\n\ttargetId: \"sqlite\",\n\tid: \"sqlite\",\n\tversion: \"0.0.1\",\n\tcapabilities: {}\n};\n//#endregion\nexport { sqliteParams as n, normalizeSqliteError as r, sqliteDriverDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-cwy5CXTT.mjs.map"],"mappings":";;;;AAIA,MAAM,yBAAyB;AAC/B,MAAM,2BAA2B;AACjC,MAAM,+BAA+B;AACrC,MAAM,+BAA+B;AACrC,MAAM,4BAA4B;AAClC,MAAM,0BAA0B;AAChC,MAAM,cAAc;AACpB,MAAM,gBAAgB;AACtB,SAAS,kBAAkB,SAAS;CACnC,QAAQ,UAAU,SAAS;AAC5B;AACA,SAAS,eAAe,SAAS;CAChC,MAAM,OAAO,UAAU;CACvB,OAAO,SAAS,eAAe,SAAS;AACzC;AACA,SAAS,cAAc,OAAO;CAC7B,IAAI,EAAE,iBAAiB,QAAQ,OAAO;CACtC,OAAO,MAAM,SAAS;AACvB;AACA,SAAS,0BAA0B,SAAS;CAC3C,OAAO,0BAA0B,KAAK,OAAO,CAAC,GAAG;AAClD;AACA,SAAS,qBAAqB,SAAS;CACtC,QAAQ,SAAR;EACC,KAAK;EACL,KAAK,8BAA8B,OAAO;EAC1C,KAAK,8BAA8B,OAAO;EAC1C,KAAK,2BAA2B,OAAO;EACvC,KAAK,yBAAyB,OAAO;EACrC;GACC,IAAI,kBAAkB,OAAO,GAAG,OAAO;GACvC,OAAO;CACT;AACD;AACA,SAAS,qBAAqB,OAAO;CACpC,IAAI,EAAE,iBAAiB,QAAQ,OAAO,IAAI,MAAM,OAAO,KAAK,CAAC;CAC7D,IAAI,cAAc,KAAK,GAAG;EACzB,MAAM,UAAU,MAAM,WAAW;EACjC,IAAI,eAAe,OAAO,GAAG,OAAO,IAA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