@prisma/orm-target-sqlite 0.16.0-dev.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +23 -0
- package/dist/adapter-DizMsGCb-n4h4w8ms.d.mts +22 -0
- package/dist/adapter-DizMsGCb-n4h4w8ms.d.mts.map +1 -0
- package/dist/adapter-m_BtnNSn.d.mts +2 -0
- package/dist/adapter-wc9p_v2Z-y8pzqMfG.mjs +997 -0
- package/dist/adapter-wc9p_v2Z-y8pzqMfG.mjs.map +1 -0
- package/dist/adapter.d.mts +14 -0
- package/dist/adapter.mjs +6 -0
- package/dist/adapter__adapter.d.mts +4 -0
- package/dist/adapter__adapter.mjs +2 -0
- package/dist/adapter__codec-types.d.mts +4 -0
- package/dist/adapter__codec-types.mjs +1 -0
- package/dist/adapter__column-types.d.mts +2 -0
- package/dist/adapter__column-types.mjs +2 -0
- package/dist/adapter__control.d.mts +5 -0
- package/dist/adapter__control.mjs +261 -0
- package/dist/adapter__control.mjs.map +1 -0
- package/dist/adapter__runtime.d.mts +2 -0
- package/dist/adapter__runtime.mjs +32 -0
- package/dist/adapter__runtime.mjs.map +1 -0
- package/dist/adapter__types.d.mts +3 -0
- package/dist/adapter__types.mjs +1 -0
- package/dist/codec-descriptor-BcgD9f3L-BjEkn9Ob.d.mts +31 -0
- package/dist/codec-descriptor-BcgD9f3L-BjEkn9Ob.d.mts.map +1 -0
- package/dist/codec-descriptor-CyCQXvSl.d.mts +2 -0
- package/dist/codec-descriptor-kVCSW1OR-CPatZUPM.mjs +104 -0
- package/dist/codec-descriptor-kVCSW1OR-CPatZUPM.mjs.map +1 -0
- package/dist/codec-descriptor-rFuZ9DzY-DO0k8l6N.d.mts +1 -0
- package/dist/codec-ids-ChRBs2aB.d.mts +1 -0
- package/dist/codec-ids-DocGjhs--CHhP1jNZ.d.mts +13 -0
- package/dist/codec-ids-DocGjhs--CHhP1jNZ.d.mts.map +1 -0
- package/dist/codec-ids-xicqpuAa-DHnKqnIs.mjs +13 -0
- package/dist/codec-ids-xicqpuAa-DHnKqnIs.mjs.map +1 -0
- package/dist/codec-types-DKB--ltR-CIuvX0zx.d.mts +24 -0
- package/dist/codec-types-DKB--ltR-CIuvX0zx.d.mts.map +1 -0
- package/dist/codec-types-Tw3EFTjf.d.mts +1 -0
- package/dist/codec-types-wPDlPoD7.d.mts +2 -0
- package/dist/codecs-1-oOsTPG-Bv518Lbm.d.mts +155 -0
- package/dist/codecs-1-oOsTPG-Bv518Lbm.d.mts.map +1 -0
- package/dist/codecs-CM_2W3uA.mjs +345 -0
- package/dist/codecs-CM_2W3uA.mjs.map +1 -0
- package/dist/codecs-j-8RDkOt.d.mts +1 -0
- package/dist/column-types-StKUDF6A.mjs +34 -0
- package/dist/column-types-StKUDF6A.mjs.map +1 -0
- package/dist/column-types-iWGuW-0W.d.mts +33 -0
- package/dist/column-types-iWGuW-0W.d.mts.map +1 -0
- package/dist/contract-free-CCLAXZV2.d.mts +88 -0
- package/dist/contract-free-CCLAXZV2.d.mts.map +1 -0
- package/dist/contract-free-DElSXD0q.mjs +90 -0
- package/dist/contract-free-DElSXD0q.mjs.map +1 -0
- package/dist/control--wMueaTg.d.mts +61 -0
- package/dist/control--wMueaTg.d.mts.map +1 -0
- package/dist/control-8G9x72lw.mjs +42 -0
- package/dist/control-8G9x72lw.mjs.map +1 -0
- package/dist/control-DLO163u8.d.mts +19 -0
- package/dist/control-DLO163u8.d.mts.map +1 -0
- package/dist/control-cahq7u71.d.mts +117 -0
- package/dist/control-cahq7u71.d.mts.map +1 -0
- package/dist/control-tables-D_o8dKRB-BXi43noL.mjs +12 -0
- package/dist/control-tables-D_o8dKRB-BXi43noL.mjs.map +1 -0
- package/dist/control-tables-Dua-YcJL.d.mts +12 -0
- package/dist/control-tables-Dua-YcJL.d.mts.map +1 -0
- package/dist/ddl-CW34JvfE-rd1ZIxOn.mjs +66 -0
- package/dist/ddl-CW34JvfE-rd1ZIxOn.mjs.map +1 -0
- package/dist/ddl-CfSqNT0M.d.mts +1 -0
- package/dist/default-normalizer-B9V7TY5u.d.mts +7 -0
- package/dist/default-normalizer-B9V7TY5u.d.mts.map +1 -0
- package/dist/default-normalizer-DuoHj9-O-DsK7lJZn.mjs +69 -0
- package/dist/default-normalizer-DuoHj9-O-DsK7lJZn.mjs.map +1 -0
- package/dist/descriptor-meta-CbYkqTkO-DEJNrICG.mjs +30 -0
- package/dist/descriptor-meta-CbYkqTkO-DEJNrICG.mjs.map +1 -0
- package/dist/descriptor-meta-DnwDwnGg-D3f936hn.mjs +23 -0
- package/dist/descriptor-meta-DnwDwnGg-D3f936hn.mjs.map +1 -0
- package/dist/descriptor-meta-runtime-BkXK3OjD-CxZdKHCw.mjs +13 -0
- package/dist/descriptor-meta-runtime-BkXK3OjD-CxZdKHCw.mjs.map +1 -0
- package/dist/descriptor-meta-vjJkUDsn-Hz3rnAnk.mjs +70 -0
- package/dist/descriptor-meta-vjJkUDsn-Hz3rnAnk.mjs.map +1 -0
- package/dist/driver.d.mts +3 -0
- package/dist/driver.mjs +2 -0
- package/dist/driver__control.d.mts +2 -0
- package/dist/driver__control.mjs +2 -0
- package/dist/driver__runtime.d.mts +2 -0
- package/dist/driver__runtime.mjs +197 -0
- package/dist/driver__runtime.mjs.map +1 -0
- package/dist/errors-CKsaaSnD-BeB4JS8h.mjs +38 -0
- package/dist/errors-CKsaaSnD-BeB4JS8h.mjs.map +1 -0
- package/dist/migration-jsmNRI_8.mjs +47 -0
- package/dist/migration-jsmNRI_8.mjs.map +1 -0
- package/dist/migration-uylRe5MP.d.mts +43 -0
- package/dist/migration-uylRe5MP.d.mts.map +1 -0
- package/dist/native-type-normalizer-CO2wKGL6.d.mts +12 -0
- package/dist/native-type-normalizer-CO2wKGL6.d.mts.map +1 -0
- package/dist/native-type-normalizer-GpQMEyN5.mjs +14 -0
- package/dist/native-type-normalizer-GpQMEyN5.mjs.map +1 -0
- package/dist/nodes-D8EC1yCx-rpfpuJ4T.d.mts +29 -0
- package/dist/nodes-D8EC1yCx-rpfpuJ4T.d.mts.map +1 -0
- package/dist/nodes-DUZSdX86-BBEEaxXY.mjs +33 -0
- package/dist/nodes-DUZSdX86-BBEEaxXY.mjs.map +1 -0
- package/dist/op-factory-call-C_or6163-B_LDzC37.mjs +829 -0
- package/dist/op-factory-call-C_or6163-B_LDzC37.mjs.map +1 -0
- package/dist/op-factory-call-DoHN7Q7L.d.mts +161 -0
- package/dist/op-factory-call-DoHN7Q7L.d.mts.map +1 -0
- package/dist/pack-BfwyQ0b3.d.mts +93 -0
- package/dist/pack-BfwyQ0b3.d.mts.map +1 -0
- package/dist/planner-Bxdi7jZF.d.mts +104 -0
- package/dist/planner-Bxdi7jZF.d.mts.map +1 -0
- package/dist/planner-DiGcIjl1-QnNAhVmX.mjs +811 -0
- package/dist/planner-DiGcIjl1-QnNAhVmX.mjs.map +1 -0
- package/dist/planner-produced-sqlite-migration-BuJysRxx-CaDUbNVx.d.mts +31 -0
- package/dist/planner-produced-sqlite-migration-BuJysRxx-CaDUbNVx.d.mts.map +1 -0
- package/dist/planner-produced-sqlite-migration-C8nxPT0P-DdBqfmAD.mjs +150 -0
- package/dist/planner-produced-sqlite-migration-C8nxPT0P-DdBqfmAD.mjs.map +1 -0
- package/dist/planner-produced-sqlite-migration-uySoqJO-.d.mts +1 -0
- package/dist/planner-target-details-CIQ789Gc-C5U4yVY9.mjs +15 -0
- package/dist/planner-target-details-CIQ789Gc-C5U4yVY9.mjs.map +1 -0
- package/dist/planner-target-details-xR6UfIcz-CMahymzq.d.mts +13 -0
- package/dist/planner-target-details-xR6UfIcz-CMahymzq.d.mts.map +1 -0
- package/dist/render-ops-B10yqmdG.d.mts +11 -0
- package/dist/render-ops-B10yqmdG.d.mts.map +1 -0
- package/dist/render-ops-DIOn_wOx-D33LOy3b.mjs +27 -0
- package/dist/render-ops-DIOn_wOx-D33LOy3b.mjs.map +1 -0
- package/dist/runtime-B1coahKC.d.mts +15 -0
- package/dist/runtime-B1coahKC.d.mts.map +1 -0
- package/dist/runtime-B99c4n56.d.mts +28 -0
- package/dist/runtime-B99c4n56.d.mts.map +1 -0
- package/dist/runtime-tbBYTw7Z.d.mts +10 -0
- package/dist/runtime-tbBYTw7Z.d.mts.map +1 -0
- package/dist/shared-BYAX0FaQ--VvRXVRC.d.mts +68 -0
- package/dist/shared-BYAX0FaQ--VvRXVRC.d.mts.map +1 -0
- package/dist/sql-utils-0SJZOd7Q.d.mts +18 -0
- package/dist/sql-utils-0SJZOd7Q.d.mts.map +1 -0
- package/dist/sql-utils-DqPXZBMA-Mm27NNjs.mjs +35 -0
- package/dist/sql-utils-DqPXZBMA-Mm27NNjs.mjs.map +1 -0
- package/dist/sqlite-contract-view-BpNMaU2m-COMDaGaq.d.mts +31 -0
- package/dist/sqlite-contract-view-BpNMaU2m-COMDaGaq.d.mts.map +1 -0
- package/dist/sqlite-contract-view-CnDITHEE-BvjSbmzL.mjs +151 -0
- package/dist/sqlite-contract-view-CnDITHEE-BvjSbmzL.mjs.map +1 -0
- package/dist/sqlite-migration-CV6LIqhx-D5eMTAbH.mjs +94 -0
- package/dist/sqlite-migration-CV6LIqhx-D5eMTAbH.mjs.map +1 -0
- package/dist/sqlite-migration-o23JHwzY-CwNJcqwl.d.mts +105 -0
- package/dist/sqlite-migration-o23JHwzY-CwNJcqwl.d.mts.map +1 -0
- package/dist/target.d.mts +28 -0
- package/dist/target.mjs +19 -0
- package/dist/target__codec-descriptor.d.mts +3 -0
- package/dist/target__codec-descriptor.mjs +2 -0
- package/dist/target__codec-ids.d.mts +3 -0
- package/dist/target__codec-ids.mjs +2 -0
- package/dist/target__codec-types.d.mts +4 -0
- package/dist/target__codec-types.mjs +1 -0
- package/dist/target__codecs.d.mts +3 -0
- package/dist/target__codecs.mjs +2 -0
- package/dist/target__contract-free.d.mts +2 -0
- package/dist/target__contract-free.mjs +3 -0
- package/dist/target__control-tables.d.mts +2 -0
- package/dist/target__control-tables.mjs +2 -0
- package/dist/target__control.d.mts +3 -0
- package/dist/target__control.mjs +432 -0
- package/dist/target__control.mjs.map +1 -0
- package/dist/target__ddl.d.mts +3 -0
- package/dist/target__ddl.mjs +2 -0
- package/dist/target__default-normalizer.d.mts +2 -0
- package/dist/target__default-normalizer.mjs +2 -0
- package/dist/target__migration.d.mts +3 -0
- package/dist/target__migration.mjs +3 -0
- package/dist/target__native-type-normalizer.d.mts +2 -0
- package/dist/target__native-type-normalizer.mjs +2 -0
- package/dist/target__op-factory-call.d.mts +2 -0
- package/dist/target__op-factory-call.mjs +2 -0
- package/dist/target__pack.d.mts +2 -0
- package/dist/target__pack.mjs +2 -0
- package/dist/target__planner-produced-sqlite-migration.d.mts +3 -0
- package/dist/target__planner-produced-sqlite-migration.mjs +2 -0
- package/dist/target__planner-target-details.d.mts +2 -0
- package/dist/target__planner-target-details.mjs +2 -0
- package/dist/target__planner.d.mts +2 -0
- package/dist/target__planner.mjs +2 -0
- package/dist/target__render-ops.d.mts +2 -0
- package/dist/target__render-ops.mjs +2 -0
- package/dist/target__runtime.d.mts +3 -0
- package/dist/target__runtime.mjs +17 -0
- package/dist/target__runtime.mjs.map +1 -0
- package/dist/target__sql-utils.d.mts +2 -0
- package/dist/target__sql-utils.mjs +2 -0
- package/dist/types-C5FSREvo-Bm6N5Kog.d.mts +25 -0
- package/dist/types-C5FSREvo-Bm6N5Kog.d.mts.map +1 -0
- package/dist/types-DiH2oWUJ.d.mts +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { t as SqlitePlanTargetDetails } from "./planner-target-details-xR6UfIcz-CMahymzq.mjs";
|
|
2
|
+
import { SqlControlTargetDescriptor } from "@prisma/orm-family-sql/family/control";
|
|
3
|
+
import { SqlNamespaceBase, SqlNamespaceEntries, SqlNamespaceInput, StorageTable } from "@prisma/orm-family-sql/contract/types";
|
|
4
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/control.d.mts
|
|
5
|
+
//#region src/core/control-target.d.ts
|
|
6
|
+
declare const sqliteControlTargetDescriptor: SqlControlTargetDescriptor<'sqlite', SqlitePlanTargetDetails>;
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/core/sqlite-unbound-database.d.ts
|
|
9
|
+
type SqliteDatabaseInput = {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly entries: SqlNamespaceEntries;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* SQLite namespace concretion carrying table metadata under
|
|
15
|
+
* `entries.table` and unqualified `qualifyTable()` emission for runtime
|
|
16
|
+
* SQL rendering.
|
|
17
|
+
*/
|
|
18
|
+
declare class SqliteDatabase extends SqlNamespaceBase {
|
|
19
|
+
readonly kind: string;
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly entries: SqlNamespaceEntries;
|
|
22
|
+
constructor(input: SqliteDatabaseInput);
|
|
23
|
+
get table(): Readonly<Record<string, StorageTable>>;
|
|
24
|
+
qualifier(): string;
|
|
25
|
+
qualifyTable(tableName: string): string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* SQLite target `Namespace` concretion. SQLite has no schema or
|
|
29
|
+
* database-namespacing concept at the SQL level — there is exactly one
|
|
30
|
+
* effective namespace per connection, so the target ships a single
|
|
31
|
+
* singleton bound to the framework's `UNBOUND_NAMESPACE_ID` slot.
|
|
32
|
+
*
|
|
33
|
+
* Qualifier emission elides the prefix entirely: rendered DDL and
|
|
34
|
+
* queries look unqualified (`CREATE TABLE "users" (...)`), matching
|
|
35
|
+
* SQLite's native dialect. Call sites stay polymorphic — they ask the
|
|
36
|
+
* namespace for its qualifier and consume the empty/unqualified result
|
|
37
|
+
* the same way Postgres consumes a `"schema"` prefix.
|
|
38
|
+
*
|
|
39
|
+
* The SQLite PSL interpreter rejects every explicit `namespace { … }`
|
|
40
|
+
* block with a diagnostic naming SQLite; only the implicit
|
|
41
|
+
* `__unspecified__` AST bucket reaches the SQLite interpreter, which
|
|
42
|
+
* lowers it to this singleton.
|
|
43
|
+
*/
|
|
44
|
+
declare class SqliteUnboundDatabase extends SqliteDatabase {
|
|
45
|
+
static readonly instance: SqliteUnboundDatabase;
|
|
46
|
+
private constructor();
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Target-supplied `Namespace` factory the SQLite target plumbs through
|
|
50
|
+
* `defineContract({ createNamespace })`. SQLite has only one
|
|
51
|
+
* effective namespace slot — the framework `UNBOUND_NAMESPACE_ID`
|
|
52
|
+
* sentinel — so the factory always returns the singleton or a fresh
|
|
53
|
+
* `SqliteDatabase` for the unbound slot with tables. The SQL family's
|
|
54
|
+
* defensive validation in `defineContract` already rejects
|
|
55
|
+
* user-declared SQLite namespaces, so this throw is a structural
|
|
56
|
+
* safety net rather than a user-facing surface.
|
|
57
|
+
*/
|
|
58
|
+
declare function sqliteCreateNamespace(input: SqlNamespaceInput): SqliteDatabase | SqliteUnboundDatabase;
|
|
59
|
+
//#endregion
|
|
60
|
+
export { sqliteControlTargetDescriptor as n, sqliteCreateNamespace as r, SqliteUnboundDatabase as t };
|
|
61
|
+
//# sourceMappingURL=control--wMueaTg.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control--wMueaTg.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/control.d.mts"],"mappings":";;;;;cAIc,+BAA+B,qCAAqC;;;KAG7E;WACM;WACA,SAAS;;;;;;;cAON,uBAAuB;WAC1B;WACA;WACA,SAAS;EAClB,YAAY,OAAO;MACf,SAAS,SAAS,eAAe;EACrC;EACA,aAAa;;;;;;;;;;;;;;;;;;;cAmBD,8BAA8B;kBAC1B,UAAU;UAClB;;;;;;;;;;;;iBAYO,sBAAsB,OAAO,oBAAoB,iBAAiB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { n as sqliteDriverDescriptorMeta, t as normalizeSqliteError } from "./descriptor-meta-vjJkUDsn-Hz3rnAnk.mjs";
|
|
2
|
+
import { errorRuntime } from "@prisma/orm-framework/errors/execution";
|
|
3
|
+
import { DatabaseSync } from "node:sqlite";
|
|
4
|
+
//#region ../../../3-targets/7-drivers/sqlite/dist/control.mjs
|
|
5
|
+
var SqliteControlDriver = class {
|
|
6
|
+
db;
|
|
7
|
+
familyId = "sql";
|
|
8
|
+
targetId = "sqlite";
|
|
9
|
+
constructor(db) {
|
|
10
|
+
this.db = db;
|
|
11
|
+
}
|
|
12
|
+
async query(sql, params) {
|
|
13
|
+
try {
|
|
14
|
+
return { rows: this.db.prepare(sql).all(...params ?? []) };
|
|
15
|
+
} catch (error) {
|
|
16
|
+
throw normalizeSqliteError(error);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
async close() {
|
|
20
|
+
this.db.close();
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const sqliteDriverDescriptor = {
|
|
24
|
+
...sqliteDriverDescriptorMeta,
|
|
25
|
+
async create(pathOrMemory) {
|
|
26
|
+
try {
|
|
27
|
+
const db = new DatabaseSync(pathOrMemory);
|
|
28
|
+
db.exec("PRAGMA foreign_keys = ON");
|
|
29
|
+
return new SqliteControlDriver(db);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
throw errorRuntime("Database connection failed", {
|
|
32
|
+
why: error instanceof Error ? error.message : String(error),
|
|
33
|
+
fix: "Verify the database file path exists and is accessible",
|
|
34
|
+
meta: { path: pathOrMemory }
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
40
|
+
export { sqliteDriverDescriptor as n, SqliteControlDriver as t };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=control-8G9x72lw.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-8G9x72lw.mjs","names":[],"sources":["../../../../3-targets/7-drivers/sqlite/dist/control.mjs"],"sourcesContent":["import { n as normalizeSqliteError, t as sqliteDriverDescriptorMeta } from \"./descriptor-meta-vjJkUDsn.mjs\";\nimport { DatabaseSync } from \"node:sqlite\";\nimport { errorRuntime } from \"@internal/errors/execution\";\n//#region src/core/control-driver.ts\nvar SqliteControlDriver = class {\n\tdb;\n\tfamilyId = \"sql\";\n\ttargetId = \"sqlite\";\n\tconstructor(db) {\n\t\tthis.db = db;\n\t}\n\tasync query(sql, params) {\n\t\ttry {\n\t\t\treturn { rows: this.db.prepare(sql).all(...params ?? []) };\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error);\n\t\t}\n\t}\n\tasync close() {\n\t\tthis.db.close();\n\t}\n};\nconst sqliteDriverDescriptor = {\n\t...sqliteDriverDescriptorMeta,\n\tasync create(pathOrMemory) {\n\t\ttry {\n\t\t\tconst db = new DatabaseSync(pathOrMemory);\n\t\t\tdb.exec(\"PRAGMA foreign_keys = ON\");\n\t\t\treturn new SqliteControlDriver(db);\n\t\t} catch (error) {\n\t\t\tthrow errorRuntime(\"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});\n\t\t}\n\t}\n};\n//#endregion\nexport { SqliteControlDriver, sqliteDriverDescriptor as default };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;AAIA,IAAI,sBAAsB,MAAM;CAC/B;CACA,WAAW;CACX,WAAW;CACX,YAAY,IAAI;EACf,KAAK,KAAK;CACX;CACA,MAAM,MAAM,KAAK,QAAQ;EACxB,IAAI;GACH,OAAO,EAAE,MAAM,KAAK,GAAG,QAAQ,GAAG,CAAC,CAAC,IAAI,GAAG,UAAU,CAAC,CAAC,EAAE;EAC1D,SAAS,OAAO;GACf,MAAM,qBAAqB,KAAK;EACjC;CACD;CACA,MAAM,QAAQ;EACb,KAAK,GAAG,MAAM;CACf;AACD;AACA,MAAM,yBAAyB;CAC9B,GAAG;CACH,MAAM,OAAO,cAAc;EAC1B,IAAI;GACH,MAAM,KAAK,IAAI,aAAa,YAAY;GACxC,GAAG,KAAK,0BAA0B;GAClC,OAAO,IAAI,oBAAoB,EAAE;EAClC,SAAS,OAAO;GACf,MAAM,aAAa,8BAA8B;IAChD,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;IAC1D,KAAK;IACL,MAAM,EAAE,MAAM,aAAa;GAC5B,CAAC;EACF;CACD;AACD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ControlDriverDescriptor } from "@prisma/orm-framework/components/control";
|
|
2
|
+
import { SqlControlDriverInstance } from "@prisma/orm-family-sql/contract/types";
|
|
3
|
+
import { DatabaseSync } from "node:sqlite";
|
|
4
|
+
//#region ../../../3-targets/7-drivers/sqlite/dist/control.d.mts
|
|
5
|
+
//#region src/core/control-driver.d.ts
|
|
6
|
+
declare class SqliteControlDriver implements SqlControlDriverInstance<'sqlite'> {
|
|
7
|
+
private readonly db;
|
|
8
|
+
readonly familyId: "sql";
|
|
9
|
+
readonly targetId: "sqlite";
|
|
10
|
+
constructor(db: DatabaseSync);
|
|
11
|
+
query<Row = Record<string, unknown>>(sql: string, params?: readonly unknown[]): Promise<{
|
|
12
|
+
readonly rows: Row[];
|
|
13
|
+
}>;
|
|
14
|
+
close(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
declare const sqliteDriverDescriptor: ControlDriverDescriptor<'sql', 'sqlite', SqliteControlDriver>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { sqliteDriverDescriptor as n, SqliteControlDriver as t };
|
|
19
|
+
//# sourceMappingURL=control-DLO163u8.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-DLO163u8.d.mts","names":[],"sources":["../../../../3-targets/7-drivers/sqlite/dist/control.d.mts"],"mappings":";;;;;cAIc,+BAA+B;mBAC1B;WACR;WACA;EACT,YAAY,IAAI;EAChB,MAAM,MAAM,yBAAyB,aAAa,8BAA8B;aACrE,MAAM;;EAEjB,SAAS;;cAEG,wBAAwB,yCAAyC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { n as AnySqliteCodecDescriptor } from "./codec-descriptor-BcgD9f3L-BjEkn9Ob.mjs";
|
|
2
|
+
import "./codec-descriptor-CyCQXvSl.mjs";
|
|
3
|
+
import { n as SqliteCodecRegistry } from "./types-C5FSREvo-Bm6N5Kog.mjs";
|
|
4
|
+
import { r as SqliteDdlNode } from "./nodes-D8EC1yCx-rpfpuJ4T.mjs";
|
|
5
|
+
import "./ddl-CfSqNT0M.mjs";
|
|
6
|
+
import { t as parseSqliteDefault } from "./default-normalizer-B9V7TY5u.mjs";
|
|
7
|
+
import { t as normalizeSqliteNativeType } from "./native-type-normalizer-CO2wKGL6.mjs";
|
|
8
|
+
import { AnyQueryAst, DdlNode, LoweredStatement, LowererContext, MarkerReadResult, SqlExecuteRequest } from "@prisma/orm-family-sql/relational-core/ast";
|
|
9
|
+
import { SqlControlAdapterDescriptor } from "@prisma/orm-family-sql/family/control";
|
|
10
|
+
import { SqlSchemaIR } from "@prisma/orm-family-sql/schema-ir/types";
|
|
11
|
+
import { SqlControlDriverInstance } from "@prisma/orm-family-sql/contract/types";
|
|
12
|
+
import { ContractMarkerRecord, LedgerEntryRecord } from "@prisma/orm-framework/contract/types";
|
|
13
|
+
import "@prisma/orm-framework/components/components";
|
|
14
|
+
import { SqlControlAdapter } from "@prisma/orm-family-sql/family/control-adapter";
|
|
15
|
+
//#region ../../../3-targets/6-adapters/sqlite/dist/control.d.mts
|
|
16
|
+
//#region src/core/codec-lookup.d.ts
|
|
17
|
+
declare function createSqliteCodecRegistryWithBuiltins(codecDescriptors?: readonly AnySqliteCodecDescriptor[]): SqliteCodecRegistry;
|
|
18
|
+
/**
|
|
19
|
+
* Build a coherent SQLite codec registry populated with built-in descriptors only.
|
|
20
|
+
*
|
|
21
|
+
* The returned registry supports both ordinary codec materialization and SQLite target behavior. Stack-composed paths build the same combined registry from target, full adapter, and ordered extension contributions.
|
|
22
|
+
*/
|
|
23
|
+
declare function createSqliteBuiltinCodecLookup(): SqliteCodecRegistry;
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/core/control-adapter.d.ts
|
|
26
|
+
declare class SqliteControlAdapter implements SqlControlAdapter<'sqlite'> {
|
|
27
|
+
readonly familyId: "sql";
|
|
28
|
+
readonly targetId: "sqlite";
|
|
29
|
+
private readonly codecRegistry;
|
|
30
|
+
constructor(codecRegistry: SqliteCodecRegistry);
|
|
31
|
+
readonly normalizeDefault: typeof parseSqliteDefault;
|
|
32
|
+
readonly normalizeNativeType: typeof normalizeSqliteNativeType;
|
|
33
|
+
bootstrapControlTableQueries(): readonly DdlNode[];
|
|
34
|
+
bootstrapSignMarkerQueries(): readonly DdlNode[];
|
|
35
|
+
/**
|
|
36
|
+
* Lower a SQL query AST into a SQLite-flavored `{ sql, params }` payload.
|
|
37
|
+
*
|
|
38
|
+
* Delegates to the shared `renderLoweredSql` renderer so the control adapter
|
|
39
|
+
* emits byte-identical SQL to `SqliteAdapterImpl.lower()` for the same AST
|
|
40
|
+
* and contract. Used at migration plan/emit time (e.g. by `dataTransform`)
|
|
41
|
+
* without instantiating the runtime adapter.
|
|
42
|
+
*/
|
|
43
|
+
lower(ast: AnyQueryAst | SqliteDdlNode, context: LowererContext<unknown>): LoweredStatement;
|
|
44
|
+
/**
|
|
45
|
+
* Lower an AST all the way to a driver-ready statement. For DDL nodes,
|
|
46
|
+
* literal column defaults are formatted as inline SQL with SQLite-specific
|
|
47
|
+
* literal syntax (no cast suffix, boolean as 0/1, blob via X'hex'). For
|
|
48
|
+
* query ASTs, params are kept as `?` placeholders; wire values go in
|
|
49
|
+
* `params`. Does NOT call `this.lower()` — independent implementation.
|
|
50
|
+
*/
|
|
51
|
+
lowerToExecuteRequest(ast: AnyQueryAst | SqliteDdlNode, context?: LowererContext<unknown>): Promise<SqlExecuteRequest>;
|
|
52
|
+
/**
|
|
53
|
+
* Reads the contract marker from `_prisma_marker`. Probes `sqlite_master`
|
|
54
|
+
* first so a fresh database (no marker table) returns `null` instead of a
|
|
55
|
+
* "no such table" error.
|
|
56
|
+
*/
|
|
57
|
+
readMarker(driver: SqlControlDriverInstance<'sqlite'>, space: string): Promise<ContractMarkerRecord | null>;
|
|
58
|
+
readMarkerDiscriminated(driver: SqlControlDriverInstance<'sqlite'>, space: string): Promise<MarkerReadResult>;
|
|
59
|
+
/**
|
|
60
|
+
* Reads every row from `_prisma_marker` and returns them keyed by
|
|
61
|
+
* `space`. Mirrors the existence probe in {@link readMarker}: a
|
|
62
|
+
* fresh database without the marker table returns an empty map.
|
|
63
|
+
*/
|
|
64
|
+
readAllMarkers(driver: SqlControlDriverInstance<'sqlite'>): Promise<ReadonlyMap<string, ContractMarkerRecord>>;
|
|
65
|
+
private readAllMarkersResult;
|
|
66
|
+
/**
|
|
67
|
+
* Reads per-migration ledger rows from `_prisma_ledger` in apply order.
|
|
68
|
+
* Probes `sqlite_master` first so a fresh database without the ledger
|
|
69
|
+
* table returns `[]` instead of raising "no such table".
|
|
70
|
+
*/
|
|
71
|
+
readLedger(driver: SqlControlDriverInstance<'sqlite'>, space?: string): Promise<readonly LedgerEntryRecord[]>;
|
|
72
|
+
private readLedgerResult;
|
|
73
|
+
/**
|
|
74
|
+
* Stamps the initial marker row for `space` via the shared contract-free DML
|
|
75
|
+
* builder, lowered through {@link lower} and executed on the driver. See the
|
|
76
|
+
* `SqlControlAdapter.initMarker` contract.
|
|
77
|
+
*/
|
|
78
|
+
insertMarker(driver: SqlControlDriverInstance<'sqlite'>, space: string, destination: {
|
|
79
|
+
readonly storageHash: string;
|
|
80
|
+
readonly profileHash: string;
|
|
81
|
+
readonly invariants?: readonly string[];
|
|
82
|
+
}): Promise<void>;
|
|
83
|
+
initMarker(driver: SqlControlDriverInstance<'sqlite'>, space: string, destination: {
|
|
84
|
+
readonly storageHash: string;
|
|
85
|
+
readonly profileHash: string;
|
|
86
|
+
readonly invariants?: readonly string[];
|
|
87
|
+
}): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Compare-and-swap advance of the marker row for `space`. See the
|
|
90
|
+
* `SqlControlAdapter.updateMarker` contract.
|
|
91
|
+
*/
|
|
92
|
+
updateMarker(driver: SqlControlDriverInstance<'sqlite'>, space: string, expectedFrom: string, destination: {
|
|
93
|
+
readonly storageHash: string;
|
|
94
|
+
readonly profileHash: string;
|
|
95
|
+
readonly invariants?: readonly string[];
|
|
96
|
+
}): Promise<boolean>;
|
|
97
|
+
/**
|
|
98
|
+
* Appends a ledger entry for `space`. See the
|
|
99
|
+
* `SqlControlAdapter.writeLedgerEntry` contract.
|
|
100
|
+
*/
|
|
101
|
+
writeLedgerEntry(driver: SqlControlDriverInstance<'sqlite'>, space: string, entry: {
|
|
102
|
+
readonly edgeId: string;
|
|
103
|
+
readonly from: string;
|
|
104
|
+
readonly to: string;
|
|
105
|
+
readonly migrationName: string;
|
|
106
|
+
readonly migrationHash: string;
|
|
107
|
+
readonly operations: readonly unknown[];
|
|
108
|
+
}): Promise<void>;
|
|
109
|
+
private readMarkerResult;
|
|
110
|
+
introspect(driver: SqlControlDriverInstance<'sqlite'>, _contract?: unknown): Promise<SqlSchemaIR>;
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/exports/control.d.ts
|
|
114
|
+
declare const sqliteAdapterDescriptor: SqlControlAdapterDescriptor<'sqlite'>;
|
|
115
|
+
//#endregion
|
|
116
|
+
export { sqliteAdapterDescriptor as i, createSqliteBuiltinCodecLookup as n, createSqliteCodecRegistryWithBuiltins as r, SqliteControlAdapter as t };
|
|
117
|
+
//# sourceMappingURL=control-cahq7u71.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-cahq7u71.d.mts","names":[],"sources":["../../../../3-targets/6-adapters/sqlite/dist/control.d.mts"],"mappings":";;;;;;;;;;;;;;;;iBAciB,sCAAsC,4BAA4B,6BAA6B;;;;;;iBAM/F,kCAAkC;;;cAGrC,gCAAgC;WACnC;WACA;mBACQ;EACjB,YAAY,eAAe;WAClB,yBAAyB;WACzB,4BAA4B;EACrC,yCAAyC;EACzC,uCAAuC;;;;;;;;;EASvC,MAAM,KAAK,cAAc,eAAe,SAAS,0BAA0B;;;;;;;;EAQ3E,sBAAsB,KAAK,cAAc,eAAe,UAAU,0BAA0B,QAAQ;;;;;;EAMpG,WAAW,QAAQ,oCAAoC,gBAAgB,QAAQ;EAC/E,wBAAwB,QAAQ,oCAAoC,gBAAgB,QAAQ;;;;;;EAM5F,eAAe,QAAQ,qCAAqC,QAAQ,oBAAoB;UAChF;;;;;;EAMR,WAAW,QAAQ,oCAAoC,iBAAiB,iBAAiB;UACjF;;;;;;EAMR,aAAa,QAAQ,oCAAoC,eAAe;aAC7D;aACA;aACA;MACP;EACJ,WAAW,QAAQ,oCAAoC,eAAe;aAC3D;aACA;aACA;MACP;;;;;EAKJ,aAAa,QAAQ,oCAAoC,eAAe,sBAAsB;aACnF;aACA;aACA;MACP;;;;;EAKJ,iBAAiB,QAAQ,oCAAoC,eAAe;aACjE;aACA;aACA;aACA;aACA;aACA;MACP;UACI;EACR,WAAW,QAAQ,oCAAoC,sBAAsB,QAAQ;;;;cAIzE,yBAAyB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/control-tables-D_o8dKRB.mjs
|
|
2
|
+
const MARKER_TABLE_NAME = "_prisma_marker";
|
|
3
|
+
const LEDGER_TABLE_NAME = "_prisma_ledger";
|
|
4
|
+
/**
|
|
5
|
+
* Control tables the runner creates/manages. The planner must not drop these
|
|
6
|
+
* when reconciling "extra" tables against the contract.
|
|
7
|
+
*/
|
|
8
|
+
const CONTROL_TABLE_NAMES = /* @__PURE__ */ new Set([MARKER_TABLE_NAME, LEDGER_TABLE_NAME]);
|
|
9
|
+
//#endregion
|
|
10
|
+
export { LEDGER_TABLE_NAME as n, MARKER_TABLE_NAME as r, CONTROL_TABLE_NAMES as t };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=control-tables-D_o8dKRB-BXi43noL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-tables-D_o8dKRB-BXi43noL.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/control-tables-D_o8dKRB.mjs"],"sourcesContent":["//#region src/core/control-tables.ts\nconst MARKER_TABLE_NAME = \"_prisma_marker\";\nconst LEDGER_TABLE_NAME = \"_prisma_ledger\";\n/**\n* Control tables the runner creates/manages. The planner must not drop these\n* when reconciling \"extra\" tables against the contract.\n*/\nconst CONTROL_TABLE_NAMES = /* @__PURE__ */ new Set([MARKER_TABLE_NAME, LEDGER_TABLE_NAME]);\n//#endregion\nexport { LEDGER_TABLE_NAME as n, MARKER_TABLE_NAME as r, CONTROL_TABLE_NAMES as t };\n\n//# sourceMappingURL=control-tables-D_o8dKRB.mjs.map"],"mappings":";AACA,MAAM,oBAAoB;AAC1B,MAAM,oBAAoB;;;;;AAK1B,MAAM,sCAAsC,IAAI,IAAI,CAAC,mBAAmB,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/control-tables.d.mts
|
|
2
|
+
//#region src/core/control-tables.d.ts
|
|
3
|
+
declare const MARKER_TABLE_NAME = "_prisma_marker";
|
|
4
|
+
declare const LEDGER_TABLE_NAME = "_prisma_ledger";
|
|
5
|
+
/**
|
|
6
|
+
* Control tables the runner creates/manages. The planner must not drop these
|
|
7
|
+
* when reconciling "extra" tables against the contract.
|
|
8
|
+
*/
|
|
9
|
+
declare const CONTROL_TABLE_NAMES: ReadonlySet<string>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { LEDGER_TABLE_NAME as n, MARKER_TABLE_NAME as r, CONTROL_TABLE_NAMES as t };
|
|
12
|
+
//# sourceMappingURL=control-tables-Dua-YcJL.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-tables-Dua-YcJL.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/control-tables.d.mts"],"mappings":";;cACc;cACA;;;;;cAKA,qBAAqB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { s as SQLITE_TEXT_CODEC_ID } from "./codec-ids-xicqpuAa-DHnKqnIs.mjs";
|
|
2
|
+
import { t as SqliteCreateTable } from "./nodes-DUZSdX86-BBEEaxXY.mjs";
|
|
3
|
+
import { FunctionSource } from "@prisma/orm-family-sql/relational-core/ast";
|
|
4
|
+
import { cfExpr, cfTable, exprSelect } from "@prisma/orm-family-sql/relational-core/contract-free";
|
|
5
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/ddl-CW34JvfE.mjs
|
|
6
|
+
/**
|
|
7
|
+
* Typed builder for the migration planner's column-existence checks. Produces
|
|
8
|
+
* `SELECT COUNT(*) {=|>} 0 AS "result" FROM pragma_table_info(?) WHERE "name" = ?`
|
|
9
|
+
* ASTs with the table and column names bound as text parameters — never
|
|
10
|
+
* inlined into the SQL.
|
|
11
|
+
*/
|
|
12
|
+
function columnExistsAst(table, column) {
|
|
13
|
+
const source = FunctionSource.of("pragma_table_info", [cfExpr.param(table, SQLITE_TEXT_CODEC_ID).ast]);
|
|
14
|
+
const where = cfExpr.identifierRef("name").eqParam(column, SQLITE_TEXT_CODEC_ID);
|
|
15
|
+
return {
|
|
16
|
+
columnAbsent: () => exprSelect().from(source).project("result", cfExpr.countStar().eqLit(0)).where(where).build(),
|
|
17
|
+
columnPresent: () => exprSelect().from(source).project("result", cfExpr.countStar().gtLit(0)).where(where).build()
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Typed builder for table-existence checks over `sqlite_master`.
|
|
22
|
+
* Produces `SELECT COUNT(*) {=|>} 0 AS "result" FROM "sqlite_master" WHERE "type" = ? AND "name" = ?`
|
|
23
|
+
* with the table name and the literal `'table'` bound as text parameters.
|
|
24
|
+
*/
|
|
25
|
+
function tableExistsAst(tableName) {
|
|
26
|
+
const source = cfTable("sqlite_master");
|
|
27
|
+
const where = cfExpr.allOf([cfExpr.identifierRef("type").eqParam("table", SQLITE_TEXT_CODEC_ID), cfExpr.identifierRef("name").eqParam(tableName, SQLITE_TEXT_CODEC_ID)]);
|
|
28
|
+
return {
|
|
29
|
+
tableAbsent: () => exprSelect().from(source).project("result", cfExpr.countStar().eqLit(0)).where(where).build(),
|
|
30
|
+
tablePresent: () => exprSelect().from(source).project("result", cfExpr.countStar().gtLit(0)).where(where).build()
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Typed builder for index-existence checks over `sqlite_master`.
|
|
35
|
+
* Produces `SELECT COUNT(*) {=|>} 0 AS "result" FROM "sqlite_master" WHERE "type" = ? AND "name" = ?`
|
|
36
|
+
* with the index name and the literal `'index'` bound as text parameters.
|
|
37
|
+
*/
|
|
38
|
+
function indexExistsAst(indexName) {
|
|
39
|
+
const source = cfTable("sqlite_master");
|
|
40
|
+
const where = cfExpr.allOf([cfExpr.identifierRef("type").eqParam("index", SQLITE_TEXT_CODEC_ID), cfExpr.identifierRef("name").eqParam(indexName, SQLITE_TEXT_CODEC_ID)]);
|
|
41
|
+
return {
|
|
42
|
+
indexAbsent: () => exprSelect().from(source).project("result", cfExpr.countStar().eqLit(0)).where(where).build(),
|
|
43
|
+
indexPresent: () => exprSelect().from(source).project("result", cfExpr.countStar().gtLit(0)).where(where).build()
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Build a SQLite `CREATE TABLE` query node.
|
|
48
|
+
*
|
|
49
|
+
* Pass `constraints` for table-level composite primary keys, foreign keys, and
|
|
50
|
+
* unique constraints — use the {@link PrimaryKeyConstraint}, {@link ForeignKeyConstraint},
|
|
51
|
+
* and {@link UniqueConstraint} classes from `@internal/sql-relational-core/ast`.
|
|
52
|
+
*
|
|
53
|
+
* Precondition: identifiers (`table`, column names/types) are emitted to SQL
|
|
54
|
+
* verbatim — they are not quoted or escaped, so callers must pass pre-trusted
|
|
55
|
+
* values (e.g. fixed control-plane identifiers). String-literal default values,
|
|
56
|
+
* by contrast, are single-quote-escaped (embedded `'` doubled) by the renderer.
|
|
57
|
+
* Identifier quoting for untrusted identifiers is added when the migration
|
|
58
|
+
* planner adopts this lowering path.
|
|
59
|
+
*/
|
|
60
|
+
function createTable(options) {
|
|
61
|
+
return new SqliteCreateTable(options);
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
export { tableExistsAst as i, createTable as n, indexExistsAst as r, columnExistsAst as t };
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=ddl-CW34JvfE-rd1ZIxOn.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ddl-CW34JvfE-rd1ZIxOn.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/ddl-CW34JvfE.mjs"],"sourcesContent":["import { s as SQLITE_TEXT_CODEC_ID } from \"./codec-ids-xicqpuAa.mjs\";\nimport { t as SqliteCreateTable } from \"./nodes-DUZSdX86.mjs\";\nimport { FunctionSource } from \"@internal/sql-relational-core/ast\";\nimport { cfExpr, cfTable, exprSelect } from \"@internal/sql-relational-core/contract-free\";\n//#region src/contract-free/checks.ts\n/**\n* Typed builder for the migration planner's column-existence checks. Produces\n* `SELECT COUNT(*) {=|>} 0 AS \"result\" FROM pragma_table_info(?) WHERE \"name\" = ?`\n* ASTs with the table and column names bound as text parameters — never\n* inlined into the SQL.\n*/\nfunction columnExistsAst(table, column) {\n\tconst source = FunctionSource.of(\"pragma_table_info\", [cfExpr.param(table, SQLITE_TEXT_CODEC_ID).ast]);\n\tconst where = cfExpr.identifierRef(\"name\").eqParam(column, SQLITE_TEXT_CODEC_ID);\n\treturn {\n\t\tcolumnAbsent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build(),\n\t\tcolumnPresent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().gtLit(0)).where(where).build()\n\t};\n}\n/**\n* Typed builder for table-existence checks over `sqlite_master`.\n* Produces `SELECT COUNT(*) {=|>} 0 AS \"result\" FROM \"sqlite_master\" WHERE \"type\" = ? AND \"name\" = ?`\n* with the table name and the literal `'table'` bound as text parameters.\n*/\nfunction tableExistsAst(tableName) {\n\tconst source = cfTable(\"sqlite_master\");\n\tconst where = cfExpr.allOf([cfExpr.identifierRef(\"type\").eqParam(\"table\", SQLITE_TEXT_CODEC_ID), cfExpr.identifierRef(\"name\").eqParam(tableName, SQLITE_TEXT_CODEC_ID)]);\n\treturn {\n\t\ttableAbsent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build(),\n\t\ttablePresent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().gtLit(0)).where(where).build()\n\t};\n}\n/**\n* Typed builder for index-existence checks over `sqlite_master`.\n* Produces `SELECT COUNT(*) {=|>} 0 AS \"result\" FROM \"sqlite_master\" WHERE \"type\" = ? AND \"name\" = ?`\n* with the index name and the literal `'index'` bound as text parameters.\n*/\nfunction indexExistsAst(indexName) {\n\tconst source = cfTable(\"sqlite_master\");\n\tconst where = cfExpr.allOf([cfExpr.identifierRef(\"type\").eqParam(\"index\", SQLITE_TEXT_CODEC_ID), cfExpr.identifierRef(\"name\").eqParam(indexName, SQLITE_TEXT_CODEC_ID)]);\n\treturn {\n\t\tindexAbsent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build(),\n\t\tindexPresent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().gtLit(0)).where(where).build()\n\t};\n}\n//#endregion\n//#region src/contract-free/ddl.ts\n/**\n* Build a SQLite `CREATE TABLE` query node.\n*\n* Pass `constraints` for table-level composite primary keys, foreign keys, and\n* unique constraints — use the {@link PrimaryKeyConstraint}, {@link ForeignKeyConstraint},\n* and {@link UniqueConstraint} classes from `@internal/sql-relational-core/ast`.\n*\n* Precondition: identifiers (`table`, column names/types) are emitted to SQL\n* verbatim — they are not quoted or escaped, so callers must pass pre-trusted\n* values (e.g. fixed control-plane identifiers). String-literal default values,\n* by contrast, are single-quote-escaped (embedded `'` doubled) by the renderer.\n* Identifier quoting for untrusted identifiers is added when the migration\n* planner adopts this lowering path.\n*/\nfunction createTable(options) {\n\treturn new SqliteCreateTable(options);\n}\n//#endregion\nexport { tableExistsAst as i, columnExistsAst as n, indexExistsAst as r, createTable as t };\n\n//# sourceMappingURL=ddl-CW34JvfE.mjs.map"],"mappings":";;;;;;;;;;;AAWA,SAAS,gBAAgB,OAAO,QAAQ;CACvC,MAAM,SAAS,eAAe,GAAG,qBAAqB,CAAC,OAAO,MAAM,OAAO,oBAAoB,CAAC,CAAC,GAAG,CAAC;CACrG,MAAM,QAAQ,OAAO,cAAc,MAAM,CAAC,CAAC,QAAQ,QAAQ,oBAAoB;CAC/E,OAAO;EACN,oBAAoB,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;EAChH,qBAAqB,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;CAClH;AACD;;;;;;AAMA,SAAS,eAAe,WAAW;CAClC,MAAM,SAAS,QAAQ,eAAe;CACtC,MAAM,QAAQ,OAAO,MAAM,CAAC,OAAO,cAAc,MAAM,CAAC,CAAC,QAAQ,SAAS,oBAAoB,GAAG,OAAO,cAAc,MAAM,CAAC,CAAC,QAAQ,WAAW,oBAAoB,CAAC,CAAC;CACvK,OAAO;EACN,mBAAmB,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;EAC/G,oBAAoB,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;CACjH;AACD;;;;;;AAMA,SAAS,eAAe,WAAW;CAClC,MAAM,SAAS,QAAQ,eAAe;CACtC,MAAM,QAAQ,OAAO,MAAM,CAAC,OAAO,cAAc,MAAM,CAAC,CAAC,QAAQ,SAAS,oBAAoB,GAAG,OAAO,cAAc,MAAM,CAAC,CAAC,QAAQ,WAAW,oBAAoB,CAAC,CAAC;CACvK,OAAO;EACN,mBAAmB,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;EAC/G,oBAAoB,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;CACjH;AACD;;;;;;;;;;;;;;;AAiBA,SAAS,YAAY,SAAS;CAC7B,OAAO,IAAI,kBAAkB,OAAO;AACrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./nodes-D8EC1yCx-rpfpuJ4T.mjs";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ColumnDefault } from "@prisma/orm-framework/contract/types";
|
|
2
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/default-normalizer.d.mts
|
|
3
|
+
//#region src/core/default-normalizer.d.ts
|
|
4
|
+
declare function parseSqliteDefault(rawDefault: string, nativeType?: string): ColumnDefault | undefined;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { parseSqliteDefault as t };
|
|
7
|
+
//# sourceMappingURL=default-normalizer-B9V7TY5u.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-normalizer-B9V7TY5u.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/default-normalizer.d.mts"],"mappings":";;;iBAEiB,mBAAmB,oBAAoB,sBAAsB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/default-normalizer-DuoHj9-O.mjs
|
|
2
|
+
const NULL_PATTERN = /^NULL$/i;
|
|
3
|
+
const INTEGER_PATTERN = /^-?\d+$/;
|
|
4
|
+
const REAL_PATTERN = /^-?\d+\.\d+(?:[eE][+-]?\d+)?$/;
|
|
5
|
+
const HEX_PATTERN = /^0[xX][\dA-Fa-f]+$/;
|
|
6
|
+
const STRING_LITERAL_PATTERN = /^'((?:[^']|'')*)'$/;
|
|
7
|
+
function isNumericLiteral(value) {
|
|
8
|
+
return INTEGER_PATTERN.test(value) || REAL_PATTERN.test(value) || HEX_PATTERN.test(value);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Strips a single matched wrapping pair of outer parens from `s`. Conservative:
|
|
12
|
+
* only strips when the leading `(` is matched by the trailing `)` (so
|
|
13
|
+
* `(a) + (b)` is returned unchanged). Mirrors SQLite's own
|
|
14
|
+
* `pragma_table_info.dflt_value` normalization for expression defaults, and
|
|
15
|
+
* is shared with the recreate-table postcheck builder so both sides agree
|
|
16
|
+
* on the canonical form.
|
|
17
|
+
*/
|
|
18
|
+
function stripOuterParens(s) {
|
|
19
|
+
if (!s.startsWith("(") || !s.endsWith(")")) return s;
|
|
20
|
+
let depth = 0;
|
|
21
|
+
for (let i = 0; i < s.length; i++) if (s[i] === "(") depth += 1;
|
|
22
|
+
else if (s[i] === ")") {
|
|
23
|
+
depth -= 1;
|
|
24
|
+
if (depth === 0 && i < s.length - 1) return s;
|
|
25
|
+
}
|
|
26
|
+
return s.slice(1, -1);
|
|
27
|
+
}
|
|
28
|
+
function parseSqliteDefault(rawDefault, nativeType) {
|
|
29
|
+
let trimmed = rawDefault.trim();
|
|
30
|
+
while (true) {
|
|
31
|
+
const stripped = stripOuterParens(trimmed).trim();
|
|
32
|
+
if (stripped === trimmed) break;
|
|
33
|
+
trimmed = stripped;
|
|
34
|
+
}
|
|
35
|
+
const lower = trimmed.toLowerCase();
|
|
36
|
+
if (lower === "current_timestamp" || lower === "datetime('now')" || lower === "datetime(\"now\")") return {
|
|
37
|
+
kind: "function",
|
|
38
|
+
expression: "now()"
|
|
39
|
+
};
|
|
40
|
+
if (NULL_PATTERN.test(trimmed)) return {
|
|
41
|
+
kind: "literal",
|
|
42
|
+
value: null
|
|
43
|
+
};
|
|
44
|
+
if (isNumericLiteral(trimmed)) {
|
|
45
|
+
const num = Number(trimmed);
|
|
46
|
+
if (!Number.isFinite(num)) return void 0;
|
|
47
|
+
if (nativeType?.toLowerCase() === "integer" && !Number.isSafeInteger(num)) return {
|
|
48
|
+
kind: "literal",
|
|
49
|
+
value: trimmed
|
|
50
|
+
};
|
|
51
|
+
return {
|
|
52
|
+
kind: "literal",
|
|
53
|
+
value: num
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const stringMatch = trimmed.match(STRING_LITERAL_PATTERN);
|
|
57
|
+
if (stringMatch?.[1] !== void 0) return {
|
|
58
|
+
kind: "literal",
|
|
59
|
+
value: stringMatch[1].replace(/''/g, "'")
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
kind: "function",
|
|
63
|
+
expression: trimmed
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { stripOuterParens as n, parseSqliteDefault as t };
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=default-normalizer-DuoHj9-O-DsK7lJZn.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-normalizer-DuoHj9-O-DsK7lJZn.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/default-normalizer-DuoHj9-O.mjs"],"sourcesContent":["//#region src/core/default-normalizer.ts\nconst NULL_PATTERN = /^NULL$/i;\nconst INTEGER_PATTERN = /^-?\\d+$/;\nconst REAL_PATTERN = /^-?\\d+\\.\\d+(?:[eE][+-]?\\d+)?$/;\nconst HEX_PATTERN = /^0[xX][\\dA-Fa-f]+$/;\nconst STRING_LITERAL_PATTERN = /^'((?:[^']|'')*)'$/;\nfunction isNumericLiteral(value) {\n\treturn INTEGER_PATTERN.test(value) || REAL_PATTERN.test(value) || HEX_PATTERN.test(value);\n}\n/**\n* Strips a single matched wrapping pair of outer parens from `s`. Conservative:\n* only strips when the leading `(` is matched by the trailing `)` (so\n* `(a) + (b)` is returned unchanged). Mirrors SQLite's own\n* `pragma_table_info.dflt_value` normalization for expression defaults, and\n* is shared with the recreate-table postcheck builder so both sides agree\n* on the canonical form.\n*/\nfunction stripOuterParens(s) {\n\tif (!s.startsWith(\"(\") || !s.endsWith(\")\")) return s;\n\tlet depth = 0;\n\tfor (let i = 0; i < s.length; i++) if (s[i] === \"(\") depth += 1;\n\telse if (s[i] === \")\") {\n\t\tdepth -= 1;\n\t\tif (depth === 0 && i < s.length - 1) return s;\n\t}\n\treturn s.slice(1, -1);\n}\nfunction parseSqliteDefault(rawDefault, nativeType) {\n\tlet trimmed = rawDefault.trim();\n\twhile (true) {\n\t\tconst stripped = stripOuterParens(trimmed).trim();\n\t\tif (stripped === trimmed) break;\n\t\ttrimmed = stripped;\n\t}\n\tconst lower = trimmed.toLowerCase();\n\tif (lower === \"current_timestamp\" || lower === \"datetime('now')\" || lower === \"datetime(\\\"now\\\")\") return {\n\t\tkind: \"function\",\n\t\texpression: \"now()\"\n\t};\n\tif (NULL_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tvalue: null\n\t};\n\tif (isNumericLiteral(trimmed)) {\n\t\tconst num = Number(trimmed);\n\t\tif (!Number.isFinite(num)) return void 0;\n\t\tif (nativeType?.toLowerCase() === \"integer\" && !Number.isSafeInteger(num)) return {\n\t\t\tkind: \"literal\",\n\t\t\tvalue: trimmed\n\t\t};\n\t\treturn {\n\t\t\tkind: \"literal\",\n\t\t\tvalue: num\n\t\t};\n\t}\n\tconst stringMatch = trimmed.match(STRING_LITERAL_PATTERN);\n\tif (stringMatch?.[1] !== void 0) return {\n\t\tkind: \"literal\",\n\t\tvalue: stringMatch[1].replace(/''/g, \"'\")\n\t};\n\treturn {\n\t\tkind: \"function\",\n\t\texpression: trimmed\n\t};\n}\n//#endregion\nexport { stripOuterParens as n, parseSqliteDefault as t };\n\n//# sourceMappingURL=default-normalizer-DuoHj9-O.mjs.map"],"mappings":";AACA,MAAM,eAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,eAAe;AACrB,MAAM,cAAc;AACpB,MAAM,yBAAyB;AAC/B,SAAS,iBAAiB,OAAO;CAChC,OAAO,gBAAgB,KAAK,KAAK,KAAK,aAAa,KAAK,KAAK,KAAK,YAAY,KAAK,KAAK;AACzF;;;;;;;;;AASA,SAAS,iBAAiB,GAAG;CAC5B,IAAI,CAAC,EAAE,WAAW,GAAG,KAAK,CAAC,EAAE,SAAS,GAAG,GAAG,OAAO;CACnD,IAAI,QAAQ;CACZ,KAAK,IAAI,IAAI,GAAG,IAAI,EAAE,QAAQ,KAAK,IAAI,EAAE,OAAO,KAAK,SAAS;MACzD,IAAI,EAAE,OAAO,KAAK;EACtB,SAAS;EACT,IAAI,UAAU,KAAK,IAAI,EAAE,SAAS,GAAG,OAAO;CAC7C;CACA,OAAO,EAAE,MAAM,GAAG,EAAE;AACrB;AACA,SAAS,mBAAmB,YAAY,YAAY;CACnD,IAAI,UAAU,WAAW,KAAK;CAC9B,OAAO,MAAM;EACZ,MAAM,WAAW,iBAAiB,OAAO,CAAC,CAAC,KAAK;EAChD,IAAI,aAAa,SAAS;EAC1B,UAAU;CACX;CACA,MAAM,QAAQ,QAAQ,YAAY;CAClC,IAAI,UAAU,uBAAuB,UAAU,qBAAqB,UAAU,qBAAqB,OAAO;EACzG,MAAM;EACN,YAAY;CACb;CACA,IAAI,aAAa,KAAK,OAAO,GAAG,OAAO;EACtC,MAAM;EACN,OAAO;CACR;CACA,IAAI,iBAAiB,OAAO,GAAG;EAC9B,MAAM,MAAM,OAAO,OAAO;EAC1B,IAAI,CAAC,OAAO,SAAS,GAAG,GAAG,OAAO,KAAK;EACvC,IAAI,YAAY,YAAY,MAAM,aAAa,CAAC,OAAO,cAAc,GAAG,GAAG,OAAO;GACjF,MAAM;GACN,OAAO;EACR;EACA,OAAO;GACN,MAAM;GACN,OAAO;EACR;CACD;CACA,MAAM,cAAc,QAAQ,MAAM,sBAAsB;CACxD,IAAI,cAAc,OAAO,KAAK,GAAG,OAAO;EACvC,MAAM;EACN,OAAO,YAAY,EAAE,CAAC,QAAQ,OAAO,GAAG;CACzC;CACA,OAAO;EACN,MAAM;EACN,YAAY;CACb;AACD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { a as sqliteCodecRegistry } from "./codecs-CM_2W3uA.mjs";
|
|
2
|
+
//#region ../../../3-targets/6-adapters/sqlite/dist/descriptor-meta-CbYkqTkO.mjs
|
|
3
|
+
const sqliteAdapterDescriptorMeta = {
|
|
4
|
+
kind: "adapter",
|
|
5
|
+
familyId: "sql",
|
|
6
|
+
targetId: "sqlite",
|
|
7
|
+
id: "sqlite",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
capabilities: { sql: {
|
|
10
|
+
orderBy: true,
|
|
11
|
+
limit: true,
|
|
12
|
+
lateral: false,
|
|
13
|
+
jsonAgg: true,
|
|
14
|
+
returning: true,
|
|
15
|
+
foreignKeys: true,
|
|
16
|
+
enums: false
|
|
17
|
+
} },
|
|
18
|
+
types: { codecTypes: {
|
|
19
|
+
codecDescriptors: Array.from(sqliteCodecRegistry.values()).filter((d) => d.renderOutputType === void 0),
|
|
20
|
+
import: {
|
|
21
|
+
package: "@internal/adapter-sqlite/codec-types",
|
|
22
|
+
named: "CodecTypes",
|
|
23
|
+
alias: "SqliteTypes"
|
|
24
|
+
}
|
|
25
|
+
} }
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
export { sqliteAdapterDescriptorMeta as t };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=descriptor-meta-CbYkqTkO-DEJNrICG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptor-meta-CbYkqTkO-DEJNrICG.mjs","names":[],"sources":["../../../../3-targets/6-adapters/sqlite/dist/descriptor-meta-CbYkqTkO.mjs"],"sourcesContent":["import { sqliteCodecRegistry } from \"@internal/target-sqlite/codecs\";\nconst sqliteAdapterDescriptorMeta = {\n\tkind: \"adapter\",\n\tfamilyId: \"sql\",\n\ttargetId: \"sqlite\",\n\tid: \"sqlite\",\n\tversion: \"0.0.1\",\n\tcapabilities: { sql: {\n\t\torderBy: true,\n\t\tlimit: true,\n\t\tlateral: false,\n\t\tjsonAgg: true,\n\t\treturning: true,\n\t\tforeignKeys: true,\n\t\tenums: false\n\t} },\n\ttypes: { codecTypes: {\n\t\tcodecDescriptors: Array.from(sqliteCodecRegistry.values()).filter((d) => d.renderOutputType === void 0),\n\t\timport: {\n\t\t\tpackage: \"@internal/adapter-sqlite/codec-types\",\n\t\t\tnamed: \"CodecTypes\",\n\t\t\talias: \"SqliteTypes\"\n\t\t}\n\t} }\n};\n//#endregion\nexport { sqliteAdapterDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-CbYkqTkO.mjs.map"],"mappings":";;AACA,MAAM,8BAA8B;CACnC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,EAAE,KAAK;EACpB,SAAS;EACT,OAAO;EACP,SAAS;EACT,SAAS;EACT,WAAW;EACX,aAAa;EACb,OAAO;CACR,EAAE;CACF,OAAO,EAAE,YAAY;EACpB,kBAAkB,MAAM,KAAK,oBAAoB,OAAO,CAAC,CAAC,CAAC,QAAQ,MAAM,EAAE,qBAAqB,KAAK,CAAC;EACtG,QAAQ;GACP,SAAS;GACT,OAAO;GACP,OAAO;EACR;CACD,EAAE;AACH"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { t as sqliteTargetDescriptorMetaRuntime } from "./descriptor-meta-runtime-BkXK3OjD-CxZdKHCw.mjs";
|
|
2
|
+
import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
|
|
3
|
+
import { temporalAuthoringPresets, temporalCodecPreset } from "@prisma/orm-family-sql/family/control";
|
|
4
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/descriptor-meta-DnwDwnGg.mjs
|
|
5
|
+
const sqliteAuthoringFieldPresets = { temporal: {
|
|
6
|
+
.../* @__PURE__ */ temporalAuthoringPresets({
|
|
7
|
+
codecId: "sqlite/datetime@1",
|
|
8
|
+
nativeType: "text"
|
|
9
|
+
}),
|
|
10
|
+
datetime: /* @__PURE__ */ temporalCodecPreset({
|
|
11
|
+
codecId: "sqlite/datetime@1",
|
|
12
|
+
nativeType: "text"
|
|
13
|
+
})
|
|
14
|
+
} };
|
|
15
|
+
const sqliteTargetDescriptorMeta = {
|
|
16
|
+
...sqliteTargetDescriptorMetaRuntime,
|
|
17
|
+
defaultNamespaceId: UNBOUND_NAMESPACE_ID,
|
|
18
|
+
authoring: { field: sqliteAuthoringFieldPresets }
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { sqliteTargetDescriptorMeta as t };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=descriptor-meta-DnwDwnGg-D3f936hn.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptor-meta-DnwDwnGg-D3f936hn.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/descriptor-meta-DnwDwnGg.mjs"],"sourcesContent":["import { t as sqliteTargetDescriptorMetaRuntime } from \"./descriptor-meta-runtime-BkXK3OjD.mjs\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { temporalAuthoringPresets, temporalCodecPreset } from \"@internal/family-sql/control\";\n//#region src/core/authoring.ts\nconst sqliteAuthoringFieldPresets = { temporal: {\n\t.../* @__PURE__ */ temporalAuthoringPresets({\n\t\tcodecId: \"sqlite/datetime@1\",\n\t\tnativeType: \"text\"\n\t}),\n\tdatetime: /* @__PURE__ */ temporalCodecPreset({\n\t\tcodecId: \"sqlite/datetime@1\",\n\t\tnativeType: \"text\"\n\t})\n} };\nconst sqliteTargetDescriptorMeta = {\n\t...sqliteTargetDescriptorMetaRuntime,\n\tdefaultNamespaceId: UNBOUND_NAMESPACE_ID,\n\tauthoring: { field: sqliteAuthoringFieldPresets }\n};\n//#endregion\nexport { sqliteTargetDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-DnwDwnGg.mjs.map"],"mappings":";;;;AAIA,MAAM,8BAA8B,EAAE,UAAU;CAC/C,GAAmB,yCAAyB;EAC3C,SAAS;EACT,YAAY;CACb,CAAC;CACD,UAA0B,oCAAoB;EAC7C,SAAS;EACT,YAAY;CACb,CAAC;AACF,EAAE;AACF,MAAM,6BAA6B;CAClC,GAAG;CACH,oBAAoB;CACpB,WAAW,EAAE,OAAO,4BAA4B;AACjD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/descriptor-meta-runtime-BkXK3OjD.mjs
|
|
2
|
+
const sqliteTargetDescriptorMetaRuntime = {
|
|
3
|
+
kind: "target",
|
|
4
|
+
familyId: "sql",
|
|
5
|
+
targetId: "sqlite",
|
|
6
|
+
id: "sqlite",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
capabilities: {}
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { sqliteTargetDescriptorMetaRuntime as t };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=descriptor-meta-runtime-BkXK3OjD-CxZdKHCw.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptor-meta-runtime-BkXK3OjD-CxZdKHCw.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/descriptor-meta-runtime-BkXK3OjD.mjs"],"sourcesContent":["const sqliteTargetDescriptorMetaRuntime = {\n\tkind: \"target\",\n\tfamilyId: \"sql\",\n\ttargetId: \"sqlite\",\n\tid: \"sqlite\",\n\tversion: \"0.0.1\",\n\tcapabilities: {}\n};\n//#endregion\nexport { sqliteTargetDescriptorMetaRuntime as t };\n\n//# sourceMappingURL=descriptor-meta-runtime-BkXK3OjD.mjs.map"],"mappings":";AAAA,MAAM,oCAAoC;CACzC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,CAAC;AAChB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { SqlConnectionError, SqlQueryError } from "@prisma/orm-family-sql/errors";
|
|
2
|
+
//#region ../../../3-targets/7-drivers/sqlite/dist/descriptor-meta-vjJkUDsn.mjs
|
|
3
|
+
const SQLITE_CONSTRAINT_BASE = 19;
|
|
4
|
+
const SQLITE_CONSTRAINT_UNIQUE = 2067;
|
|
5
|
+
const SQLITE_CONSTRAINT_PRIMARYKEY = 1555;
|
|
6
|
+
const SQLITE_CONSTRAINT_FOREIGNKEY = 787;
|
|
7
|
+
const SQLITE_CONSTRAINT_NOTNULL = 1299;
|
|
8
|
+
const SQLITE_CONSTRAINT_CHECK = 275;
|
|
9
|
+
const SQLITE_BUSY = 5;
|
|
10
|
+
const SQLITE_LOCKED = 6;
|
|
11
|
+
function isConstraintError(errcode) {
|
|
12
|
+
return (errcode & 255) === SQLITE_CONSTRAINT_BASE;
|
|
13
|
+
}
|
|
14
|
+
function isBusyOrLocked(errcode) {
|
|
15
|
+
const base = errcode & 255;
|
|
16
|
+
return base === SQLITE_BUSY || base === SQLITE_LOCKED;
|
|
17
|
+
}
|
|
18
|
+
function isSqliteError(error) {
|
|
19
|
+
if (!(error instanceof Error)) return false;
|
|
20
|
+
return error.code === "ERR_SQLITE_ERROR";
|
|
21
|
+
}
|
|
22
|
+
function constraintNameFromMessage(message) {
|
|
23
|
+
return /constraint failed: (.+)/.exec(message)?.[1];
|
|
24
|
+
}
|
|
25
|
+
function mapErrCodeToSqlState(errcode) {
|
|
26
|
+
switch (errcode) {
|
|
27
|
+
case SQLITE_CONSTRAINT_UNIQUE:
|
|
28
|
+
case SQLITE_CONSTRAINT_PRIMARYKEY: return "23505";
|
|
29
|
+
case SQLITE_CONSTRAINT_FOREIGNKEY: return "23503";
|
|
30
|
+
case SQLITE_CONSTRAINT_NOTNULL: return "23502";
|
|
31
|
+
case SQLITE_CONSTRAINT_CHECK: return "23514";
|
|
32
|
+
default:
|
|
33
|
+
if (isConstraintError(errcode)) return "23000";
|
|
34
|
+
return "HY000";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function normalizeSqliteError(error) {
|
|
38
|
+
if (!(error instanceof Error)) return new Error(String(error));
|
|
39
|
+
if (isSqliteError(error)) {
|
|
40
|
+
const errcode = error.errcode ?? 0;
|
|
41
|
+
if (isBusyOrLocked(errcode)) return new SqlConnectionError(error.message, {
|
|
42
|
+
cause: error,
|
|
43
|
+
transient: true
|
|
44
|
+
});
|
|
45
|
+
const sqlState = mapErrCodeToSqlState(errcode);
|
|
46
|
+
const constraint = constraintNameFromMessage(error.message);
|
|
47
|
+
return new SqlQueryError(error.message, {
|
|
48
|
+
cause: error,
|
|
49
|
+
sqlState,
|
|
50
|
+
...constraint !== void 0 ? { constraint } : {}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (error.message.includes("database is locked") || error.message.includes("unable to open database")) return new SqlConnectionError(error.message, {
|
|
54
|
+
cause: error,
|
|
55
|
+
transient: false
|
|
56
|
+
});
|
|
57
|
+
return error;
|
|
58
|
+
}
|
|
59
|
+
const sqliteDriverDescriptorMeta = {
|
|
60
|
+
kind: "driver",
|
|
61
|
+
familyId: "sql",
|
|
62
|
+
targetId: "sqlite",
|
|
63
|
+
id: "sqlite",
|
|
64
|
+
version: "0.0.1",
|
|
65
|
+
capabilities: {}
|
|
66
|
+
};
|
|
67
|
+
//#endregion
|
|
68
|
+
export { sqliteDriverDescriptorMeta as n, normalizeSqliteError as t };
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=descriptor-meta-vjJkUDsn-Hz3rnAnk.mjs.map
|