@prisma/orm-target-sqlite 0.17.0-dev.1 → 0.17.0-dev.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter-D7zw14p5.d.mts +2 -0
- package/dist/{adapter-DizMsGCb-n4h4w8ms.d.mts → adapter-DEYUC-KO-DO_abhIq.d.mts} +12 -4
- package/dist/adapter-DEYUC-KO-DO_abhIq.d.mts.map +1 -0
- package/dist/{adapter-wc9p_v2Z-y8pzqMfG.mjs → adapter-Dq0Gn7Uz-ChiMxJBJ.mjs} +12 -7
- package/dist/adapter-Dq0Gn7Uz-ChiMxJBJ.mjs.map +1 -0
- package/dist/adapter.d.mts +11 -10
- package/dist/adapter.mjs +2 -2
- package/dist/adapter__adapter.d.mts +3 -3
- package/dist/adapter__adapter.mjs +1 -1
- package/dist/adapter__codec-types.d.mts +3 -3
- package/dist/adapter__control.d.mts +1 -1
- package/dist/adapter__control.mjs +2 -2
- package/dist/adapter__control.mjs.map +1 -1
- package/dist/adapter__runtime.d.mts +1 -1
- package/dist/adapter__runtime.mjs +3 -3
- package/dist/adapter__runtime.mjs.map +1 -1
- package/dist/adapter__sql-renderer.d.mts +3 -0
- package/dist/adapter__sql-renderer.mjs +2 -0
- package/dist/adapter__types.d.mts +2 -2
- package/dist/aggregates-BGuKJwfI.d.mts +10 -0
- package/dist/aggregates-BGuKJwfI.d.mts.map +1 -0
- package/dist/aggregates-CTDRDyvD.mjs +95 -0
- package/dist/aggregates-CTDRDyvD.mjs.map +1 -0
- package/dist/{codec-descriptor-BcgD9f3L-BjEkn9Ob.d.mts → codec-descriptor-BcgD9f3L-yDi5nh_k.d.mts} +2 -2
- package/dist/{codec-descriptor-BcgD9f3L-BjEkn9Ob.d.mts.map → codec-descriptor-BcgD9f3L-yDi5nh_k.d.mts.map} +1 -1
- package/dist/codec-descriptor-rFuZ9DzY-CKRIRxah.d.mts +1 -0
- package/dist/codec-descriptor-vwfD3BMy.d.mts +2 -0
- package/dist/codec-types-BV3IjK44.d.mts +2 -0
- package/dist/codec-types-C29741cn.d.mts +1 -0
- package/dist/{codec-types-DKB--ltR-CIuvX0zx.d.mts → codec-types-DOyikA9Q-DVHiIZxI.d.mts} +5 -5
- package/dist/{codec-types-DKB--ltR-CIuvX0zx.d.mts.map → codec-types-DOyikA9Q-DVHiIZxI.d.mts.map} +1 -1
- package/dist/codecs-BVBvwzGc.d.mts +1 -0
- package/dist/{codecs-CM_2W3uA.mjs → codecs-BaoqGdxT.mjs} +13 -3
- package/dist/{codecs-CM_2W3uA.mjs.map → codecs-BaoqGdxT.mjs.map} +1 -1
- package/dist/{codecs-1-oOsTPG-Bv518Lbm.d.mts → codecs-CEh66QoN-oCsdncEe.d.mts} +12 -6
- package/dist/{codecs-1-oOsTPG-Bv518Lbm.d.mts.map → codecs-CEh66QoN-oCsdncEe.d.mts.map} +1 -1
- package/dist/{control-cahq7u71.d.mts → control-CLirKz11.d.mts} +4 -4
- package/dist/{control-cahq7u71.d.mts.map → control-CLirKz11.d.mts.map} +1 -1
- package/dist/descriptor-meta-DjKgG4z5-CDdHwPoG.mjs +34 -0
- package/dist/descriptor-meta-DjKgG4z5-CDdHwPoG.mjs.map +1 -0
- package/dist/driver__runtime.mjs +32 -70
- package/dist/driver__runtime.mjs.map +1 -1
- package/dist/{pack-BfwyQ0b3.d.mts → pack-Cnu6UOJx.d.mts} +2 -2
- package/dist/{pack-BfwyQ0b3.d.mts.map → pack-Cnu6UOJx.d.mts.map} +1 -1
- package/dist/{planner-DiGcIjl1-QnNAhVmX.mjs → planner-DiGcIjl1-oFtDTY7-.mjs} +2 -2
- package/dist/{planner-DiGcIjl1-QnNAhVmX.mjs.map → planner-DiGcIjl1-oFtDTY7-.mjs.map} +1 -1
- package/dist/{runtime-tbBYTw7Z.d.mts → runtime-C5J9fusd.d.mts} +2 -2
- package/dist/{runtime-tbBYTw7Z.d.mts.map → runtime-C5J9fusd.d.mts.map} +1 -1
- package/dist/sql-renderer-KX6hn_tg.d.mts +1 -0
- package/dist/target.d.mts +9 -8
- package/dist/target.mjs +5 -4
- package/dist/target__aggregates.d.mts +2 -0
- package/dist/target__aggregates.mjs +2 -0
- package/dist/target__codec-descriptor.d.mts +2 -2
- package/dist/target__codec-types.d.mts +3 -3
- package/dist/target__codecs.d.mts +2 -2
- package/dist/target__codecs.mjs +1 -1
- package/dist/target__control.mjs +1 -1
- package/dist/target__pack.d.mts +1 -1
- package/dist/target__planner.mjs +1 -1
- package/dist/types-B7e2QVEx.d.mts +1 -0
- package/dist/{types-C5FSREvo-Bm6N5Kog.d.mts → types-C5FSREvo-CwUlKK34.d.mts} +4 -4
- package/dist/{types-C5FSREvo-Bm6N5Kog.d.mts.map → types-C5FSREvo-CwUlKK34.d.mts.map} +1 -1
- package/package.json +11 -9
- package/dist/adapter-DizMsGCb-n4h4w8ms.d.mts.map +0 -1
- package/dist/adapter-m_BtnNSn.d.mts +0 -2
- package/dist/adapter-wc9p_v2Z-y8pzqMfG.mjs.map +0 -1
- package/dist/codec-descriptor-CyCQXvSl.d.mts +0 -2
- package/dist/codec-descriptor-rFuZ9DzY-DO0k8l6N.d.mts +0 -1
- package/dist/codec-types-Tw3EFTjf.d.mts +0 -1
- package/dist/codec-types-wPDlPoD7.d.mts +0 -2
- package/dist/codecs-j-8RDkOt.d.mts +0 -1
- package/dist/descriptor-meta-CbYkqTkO-DEJNrICG.mjs +0 -30
- package/dist/descriptor-meta-CbYkqTkO-DEJNrICG.mjs.map +0 -1
- package/dist/types-DiH2oWUJ.d.mts +0 -1
package/dist/{codec-descriptor-BcgD9f3L-BjEkn9Ob.d.mts → codec-descriptor-BcgD9f3L-yDi5nh_k.d.mts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AnyCodecDescriptor, CodecDescriptor, CodecDescriptorImpl, CodecRef } from "@prisma/orm-framework/components/codec";
|
|
2
1
|
import { ProjectionExpr } from "@prisma/orm-family-sql/relational-core/ast";
|
|
2
|
+
import { AnyCodecDescriptor, CodecDescriptor, CodecDescriptorImpl, CodecRef } from "@prisma/orm-framework/components/codec";
|
|
3
3
|
//#region ../../../3-targets/3-targets/sqlite/dist/codec-descriptor-BcgD9f3L.d.mts
|
|
4
4
|
//#region src/core/codec-descriptor.d.ts
|
|
5
5
|
declare const SQLITE_CODEC_DESCRIPTOR_KIND: "sqlite-codec";
|
|
@@ -28,4 +28,4 @@ interface SqliteCodecDescriptorRegistry {
|
|
|
28
28
|
declare function buildSqliteCodecDescriptorRegistry(descriptors: ReadonlyArray<unknown>): SqliteCodecDescriptorRegistry;
|
|
29
29
|
//#endregion
|
|
30
30
|
export { SqliteCodecOptions as a, isSqliteCodecDescriptor as c, SqliteCodecDescriptorRegistry as i, sqliteCodec as l, AnySqliteCodecDescriptor as n, buildSqliteCodecDescriptorRegistry as o, SqliteCodecDescriptor as r, defineSqliteCodecs as s, AdaptedSqliteCodecDescriptor as t };
|
|
31
|
-
//# sourceMappingURL=codec-descriptor-BcgD9f3L-
|
|
31
|
+
//# sourceMappingURL=codec-descriptor-BcgD9f3L-yDi5nh_k.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec-descriptor-BcgD9f3L-
|
|
1
|
+
{"version":3,"file":"codec-descriptor-BcgD9f3L-yDi5nh_k.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/codec-descriptor-BcgD9f3L.d.mts"],"mappings":";;;;cAGc;UACJ,iCAAiC;WAChC,uBAAuB;EAChC,YAAY,YAAY,gBAAgB,KAAK,WAAW;;uBAEnC,sBAAsB,kBAAkB,oBAAoB,cAAc;WACtF;qBACU,eAAe,YAAY,gBAAgB,QAAQ,IAAI;EAC1E,YAAY,YAAY,gBAAgB,KAAK,WAAW;UAChD;;KAEL,iBAAiB,UAAU,sBAAsB,UAAU,sBAAsB,KAAK;UACjF,mBAAmB;WAClB,iBAAiB,YAAY,gBAAgB,QAAQ,MAAM;;KAEjE,6BAA6B,UAAU,sBAAsB,KAAK,SAAS,gBAAgB,iBAAiB,OAAO,KAAK;iBAC5G,YAAY,UAAU,oBAAoB,YAAY,GAAG,SAAS,mBAAmB,iBAAiB,MAAM,6BAA6B;iBACzI,yBAAyB,6BAA6B,4BAA4B,aAAa,cAAc;iBAC7G,wBAAwB,iBAAiB,SAAS;UACzD;EACR,cAAc,kBAAkB;EAChC,UAAU,iBAAiB;;iBAEZ,mCAAmC,aAAa,yBAAyB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./codec-descriptor-BcgD9f3L-yDi5nh_k.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./codec-types-BV3IjK44.mjs";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as AdaptedSqliteCodecDescriptor } from "./codec-descriptor-BcgD9f3L-
|
|
2
|
-
import "./codec-descriptor-rFuZ9DzY-
|
|
3
|
-
import { a as SqliteIntegerDescriptor, c as SqliteTextDescriptor, i as SqliteDatetimeDescriptor, n as SqliteBigintDescriptor, o as SqliteJsonDescriptor, r as SqliteBlobDescriptor, s as SqliteRealDescriptor } from "./codecs-
|
|
1
|
+
import { t as AdaptedSqliteCodecDescriptor } from "./codec-descriptor-BcgD9f3L-yDi5nh_k.mjs";
|
|
2
|
+
import "./codec-descriptor-rFuZ9DzY-CKRIRxah.mjs";
|
|
3
|
+
import { a as SqliteIntegerDescriptor, c as SqliteTextDescriptor, i as SqliteDatetimeDescriptor, n as SqliteBigintDescriptor, o as SqliteJsonDescriptor, r as SqliteBlobDescriptor, s as SqliteRealDescriptor } from "./codecs-CEh66QoN-oCsdncEe.mjs";
|
|
4
4
|
import { ExtractCodecTypes } from "@prisma/orm-family-sql/relational-core/ast";
|
|
5
|
-
//#region ../../../3-targets/3-targets/sqlite/dist/codec-types-
|
|
5
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/codec-types-DOyikA9Q.d.mts
|
|
6
6
|
//#region src/exports/codec-types.d.ts
|
|
7
7
|
declare const codecDescriptorMap: {
|
|
8
8
|
readonly char: AdaptedSqliteCodecDescriptor<import("@prisma/orm-family-sql/relational-core/ast").SqlCharDescriptor>;
|
|
@@ -21,4 +21,4 @@ type Resolve<T> = { readonly [K in keyof T]: { readonly [P in keyof T[K]]: T[K][
|
|
|
21
21
|
type CodecTypes = Resolve<ExtractCodecTypes<typeof codecDescriptorMap>>;
|
|
22
22
|
//#endregion
|
|
23
23
|
export { CodecTypes as t };
|
|
24
|
-
//# sourceMappingURL=codec-types-
|
|
24
|
+
//# sourceMappingURL=codec-types-DOyikA9Q-DVHiIZxI.d.mts.map
|
package/dist/{codec-types-DKB--ltR-CIuvX0zx.d.mts.map → codec-types-DOyikA9Q-DVHiIZxI.d.mts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec-types-
|
|
1
|
+
{"version":3,"file":"codec-types-DOyikA9Q-DVHiIZxI.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/codec-types-DOyikA9Q.d.mts"],"mappings":";;;;;;cAKc;WACH,MAAM,yEAAyE;WAC/E,SAAS,yEAAyE;WAClF,KAAK,yEAAyE;WAC9E,OAAO,yEAAyE;WAChF,MAAM;WACN,SAAS;WACT,MAAM;WACN,MAAM;WACN,UAAU;WACV,MAAM;WACN,QAAQ;;KAEd,QAAQ,iBAAiB,WAAW,gBAAgB,WAAW,EAAE,KAAK,EAAE,GAAG;KAC3E,aAAa,QAAQ,yBAAyB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./codecs-CEh66QoN-oCsdncEe.mjs";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as sqliteCodec, n as buildSqliteCodecDescriptorRegistry, r as defineSqliteCodecs, t as SqliteCodecDescriptor } from "./codec-descriptor-kVCSW1OR-CPatZUPM.mjs";
|
|
2
1
|
import { a as SQLITE_JSON_CODEC_ID, i as SQLITE_INTEGER_CODEC_ID, n as SQLITE_BLOB_CODEC_ID, o as SQLITE_REAL_CODEC_ID, r as SQLITE_DATETIME_CODEC_ID, s as SQLITE_TEXT_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID } from "./codec-ids-xicqpuAa-DHnKqnIs.mjs";
|
|
2
|
+
import { a as sqliteCodec, n as buildSqliteCodecDescriptorRegistry, r as defineSqliteCodecs, t as SqliteCodecDescriptor } from "./codec-descriptor-kVCSW1OR-CPatZUPM.mjs";
|
|
3
3
|
import { n as sqliteError } from "./errors-CKsaaSnD-BeB4JS8h.mjs";
|
|
4
|
-
import { CodecImpl, column, voidParamsSchema } from "@prisma/orm-framework/components/codec";
|
|
5
4
|
import { CaseExpr, CastExpr, FunctionCallExpr, LiteralExpr, NullCheckExpr, sqlCharDescriptor, sqlFloatDescriptor, sqlIntDescriptor, sqlVarcharDescriptor } from "@prisma/orm-family-sql/relational-core/ast";
|
|
5
|
+
import { CodecImpl, column, voidParamsSchema } from "@prisma/orm-framework/components/codec";
|
|
6
6
|
import { buildCodecDescriptorRegistry } from "@prisma/orm-family-sql/relational-core/codec-descriptor-registry";
|
|
7
7
|
//#region ../../../3-targets/3-targets/sqlite/dist/codecs.mjs
|
|
8
8
|
/**
|
|
@@ -287,7 +287,17 @@ var SqliteBigintCodec = class extends CodecImpl {
|
|
|
287
287
|
async encode(value, _ctx) {
|
|
288
288
|
return value;
|
|
289
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* The wire value is text wherever the value could outrun a JS number: an
|
|
292
|
+
* aggregate SQLite computes leaves the database through the descriptor's cast
|
|
293
|
+
* to text, because the driver reads an integer no number can hold as an error
|
|
294
|
+
* rather than a value.
|
|
295
|
+
*/
|
|
290
296
|
async decode(wire, _ctx) {
|
|
297
|
+
if (typeof wire === "string" && !DECIMAL_INTEGER.test(wire)) throw sqliteError("RUNTIME.DECODE_FAILED", "sqlite/bigint@1 wire value must be a decimal string", { meta: {
|
|
298
|
+
codecId: SQLITE_BIGINT_CODEC_ID,
|
|
299
|
+
received: wire
|
|
300
|
+
} });
|
|
291
301
|
return BigInt(wire);
|
|
292
302
|
}
|
|
293
303
|
encodeJson(value) {
|
|
@@ -342,4 +352,4 @@ const sqliteCodecDescriptorRegistry = buildSqliteCodecDescriptorRegistry(codecDe
|
|
|
342
352
|
//#endregion
|
|
343
353
|
export { sqliteCodecRegistry as a, sqliteJsonColumn as c, sqliteCodecDescriptorRegistry as i, sqliteRealColumn as l, sqliteBigintColumn as n, sqliteDatetimeColumn as o, sqliteBlobColumn as r, sqliteIntegerColumn as s, jsonDocumentRetag as t, sqliteTextColumn as u };
|
|
344
354
|
|
|
345
|
-
//# sourceMappingURL=codecs-
|
|
355
|
+
//# sourceMappingURL=codecs-BaoqGdxT.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codecs-CM_2W3uA.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/codecs.mjs"],"sourcesContent":["import { a as SQLITE_JSON_CODEC_ID, i as SQLITE_INTEGER_CODEC_ID, n as SQLITE_BLOB_CODEC_ID, o as SQLITE_REAL_CODEC_ID, r as SQLITE_DATETIME_CODEC_ID, s as SQLITE_TEXT_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID } from \"./codec-ids-xicqpuAa.mjs\";\nimport { a as sqliteCodec, n as buildSqliteCodecDescriptorRegistry, r as defineSqliteCodecs, t as SqliteCodecDescriptor } from \"./codec-descriptor-kVCSW1OR.mjs\";\nimport { n as sqliteError } from \"./errors-CKsaaSnD.mjs\";\nimport { CaseExpr, CastExpr, FunctionCallExpr, LiteralExpr, NullCheckExpr, sqlCharDescriptor, sqlFloatDescriptor, sqlIntDescriptor, sqlVarcharDescriptor } from \"@internal/sql-relational-core/ast\";\nimport { CodecImpl, column, voidParamsSchema } from \"@internal/framework-components/codec\";\nimport { buildCodecDescriptorRegistry } from \"@internal/sql-relational-core/codec-descriptor-registry\";\n//#region src/core/codecs.ts\n/**\n* Projects the expression unchanged, for codecs whose canonical JSON is what\n* SQLite's own JSON conversion already produces.\n*\n* Identity here is a claim about the target's behaviour, not an absence of one:\n* the codec's conformance cases are what test it, including at the boundaries\n* of the representation where a native conversion would be most likely to\n* diverge.\n*/\nconst identityJsonProjection = (expression) => expression;\n/**\n* Projects an integer-valued expression as decimal text.\n*\n* The cast is part of the projected expression, so it applies before the JSON\n* constructor sees the value: handed an INTEGER directly, the constructor emits\n* a JSON number, and SQLite's 64-bit range does not survive being read back as\n* a double. Casting the constructor's result would be too late.\n*/\nconst decimalTextJsonProjection = (expression) => CastExpr.as(expression, \"TEXT\");\n/**\n* Projects a BLOB as hexadecimal text.\n*\n* SQLite's JSON functions reject a BLOB argument outright, so the encoding has\n* to replace the native conversion rather than post-process it. `hex()` emits\n* uppercase and never wraps at any length, which is the spelling `encodeJson`\n* pins.\n*\n* `hex(NULL)` is `''` rather than NULL, and `''` is the hex of an empty blob —\n* so without the NULL check an absent blob and an empty one would both project\n* as `''`, and `decodeJson` accepts `''` because zero hex pairs is a valid\n* empty blob. The check keeps the two distinguishable.\n*/\nconst hexJsonProjection = (expression) => CaseExpr.of([{\n\tcondition: NullCheckExpr.isNull(expression),\n\tvalue: LiteralExpr.of(null)\n}], FunctionCallExpr.of(\"hex\", [expression]));\nconst JSON_RETAG_FN = \"json\";\n/**\n* Re-applies SQLite's JSON subtype to a document-valued expression.\n*\n* SQLite carries \"this text is JSON\" as a subtype on the value rather than in\n* its type, and the subtype does not survive a derived table: a document that\n* `json_object` produced arrives one level out as plain text, so the enclosing\n* constructor embeds it as a *string containing JSON* rather than as a\n* document. `json()` re-applies the subtype, which is what makes the value nest\n* as a document again.\n*\n* The loss happens at the first derived-table boundary and does not compound, so\n* a retag is needed where the document is consumed rather than at every level it\n* passes through.\n*\n* Applying this twice is a no-op — SQLite's `json()` is idempotent, and the\n* wrapper collapses rather than nesting so the rendered SQL says so too. It is\n* safe on any valid JSON text, including scalars, and on NULL; it raises\n* `malformed JSON` on text that is not JSON, which is the correct failure for a\n* value that was never a document.\n*/\nconst jsonDocumentRetag = (expression) => isJsonRetag(expression) ? expression : FunctionCallExpr.of(JSON_RETAG_FN, [expression]);\n/** Whether an expression is already a retag, so applying one again would only nest. */\nconst isJsonRetag = (expression) => expression instanceof FunctionCallExpr && expression.fn === JSON_RETAG_FN && expression.args.length === 1;\nconst DECIMAL_INTEGER = /^-?\\d+$/;\nconst UPPERCASE_HEX = /^(?:[0-9A-F]{2})*$/;\n/**\n* JSON has no spelling for an infinity or a NaN, and SQLite renders one as\n* `9.0e+999`, which reads back as `Infinity` rather than failing. A real is\n* therefore carried only where it is finite.\n*/\nconst finiteReal = (value, code) => {\n\tif (!Number.isFinite(value)) throw sqliteError(code, \"sqlite/real@1 value must be a finite number\", { meta: {\n\t\tcodecId: SQLITE_REAL_CODEC_ID,\n\t\treceived: String(value)\n\t} });\n\treturn value;\n};\nconst sqliteSqlCharDescriptor = sqliteCodec(sqlCharDescriptor, { jsonProjection: identityJsonProjection });\nconst sqliteSqlVarcharDescriptor = sqliteCodec(sqlVarcharDescriptor, { jsonProjection: identityJsonProjection });\nconst sqliteSqlIntDescriptor = sqliteCodec(sqlIntDescriptor, { jsonProjection: identityJsonProjection });\nconst sqliteSqlFloatDescriptor = sqliteCodec(sqlFloatDescriptor, { jsonProjection: identityJsonProjection });\nvar SqliteTextCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn value;\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn wire;\n\t}\n\tencodeJson(value) {\n\t\treturn value;\n\t}\n\tdecodeJson(json) {\n\t\treturn json;\n\t}\n};\nvar SqliteTextDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn expression;\n\t}\n\tcodecId = SQLITE_TEXT_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"textual\"\n\t];\n\ttargetTypes = [\"text\"];\n\tparamsSchema = voidParamsSchema;\n\tfactory() {\n\t\treturn () => new SqliteTextCodec(this);\n\t}\n};\nconst sqliteTextDescriptor = new SqliteTextDescriptor();\nconst sqliteTextColumn = () => column(sqliteTextDescriptor.factory(), sqliteTextDescriptor.codecId, void 0, \"text\");\nvar SqliteIntegerCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn value;\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn wire;\n\t}\n\tencodeJson(value) {\n\t\treturn value;\n\t}\n\tdecodeJson(json) {\n\t\treturn json;\n\t}\n};\nvar SqliteIntegerDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn expression;\n\t}\n\tcodecId = SQLITE_INTEGER_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"numeric\"\n\t];\n\ttargetTypes = [\"integer\"];\n\tparamsSchema = voidParamsSchema;\n\tfactory() {\n\t\treturn () => new SqliteIntegerCodec(this);\n\t}\n};\nconst sqliteIntegerDescriptor = new SqliteIntegerDescriptor();\nconst sqliteIntegerColumn = () => column(sqliteIntegerDescriptor.factory(), sqliteIntegerDescriptor.codecId, void 0, \"integer\");\nvar SqliteRealCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn value;\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn wire;\n\t}\n\tencodeJson(value) {\n\t\treturn finiteReal(value, \"RUNTIME.ENCODE_FAILED\");\n\t}\n\tdecodeJson(json) {\n\t\tif (typeof json !== \"number\") throw sqliteError(\"RUNTIME.DECODE_FAILED\", \"sqlite/real@1 database JSON value must be a number\", { meta: {\n\t\t\tcodecId: SQLITE_REAL_CODEC_ID,\n\t\t\treceived: typeof json\n\t\t} });\n\t\treturn finiteReal(json, \"RUNTIME.DECODE_FAILED\");\n\t}\n};\nvar SqliteRealDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn expression;\n\t}\n\tcodecId = SQLITE_REAL_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"numeric\"\n\t];\n\ttargetTypes = [\"real\"];\n\tparamsSchema = voidParamsSchema;\n\tfactory() {\n\t\treturn () => new SqliteRealCodec(this);\n\t}\n};\nconst sqliteRealDescriptor = new SqliteRealDescriptor();\nconst sqliteRealColumn = () => column(sqliteRealDescriptor.factory(), sqliteRealDescriptor.codecId, void 0, \"real\");\nvar SqliteBlobCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn value;\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn wire;\n\t}\n\tencodeJson(value) {\n\t\treturn Buffer.from(value).toString(\"hex\").toUpperCase();\n\t}\n\tdecodeJson(json) {\n\t\tif (typeof json !== \"string\" || !UPPERCASE_HEX.test(json)) throw sqliteError(\"RUNTIME.DECODE_FAILED\", \"sqlite/blob@1 database JSON value must be uppercase hexadecimal text\", { meta: {\n\t\t\tcodecId: SQLITE_BLOB_CODEC_ID,\n\t\t\treceived: typeof json\n\t\t} });\n\t\treturn new Uint8Array(Buffer.from(json, \"hex\"));\n\t}\n};\nvar SqliteBlobDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn hexJsonProjection(expression);\n\t}\n\tcodecId = SQLITE_BLOB_CODEC_ID;\n\ttraits = [\"equality\"];\n\ttargetTypes = [\"blob\"];\n\tparamsSchema = voidParamsSchema;\n\tfactory() {\n\t\treturn () => new SqliteBlobCodec(this);\n\t}\n};\nconst sqliteBlobDescriptor = new SqliteBlobDescriptor();\nconst sqliteBlobColumn = () => column(sqliteBlobDescriptor.factory(), sqliteBlobDescriptor.codecId, void 0, \"blob\");\nvar SqliteDatetimeCodec = class extends CodecImpl {\n\tparseDate(value) {\n\t\tconst date = new Date(value);\n\t\tif (Number.isNaN(date.getTime())) throw sqliteError(\"RUNTIME.DECODE_FAILED\", `sqlite/datetime@1 value must be a valid ISO-8601 string: ${value}`, { meta: {\n\t\t\tcodecId: SQLITE_DATETIME_CODEC_ID,\n\t\t\treceived: value\n\t\t} });\n\t\treturn date;\n\t}\n\tasync encode(value, _ctx) {\n\t\treturn value.toISOString();\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn this.parseDate(wire);\n\t}\n\tencodeJson(value) {\n\t\treturn value.toISOString();\n\t}\n\tdecodeJson(json) {\n\t\tif (typeof json !== \"string\") throw sqliteError(\"RUNTIME.DECODE_FAILED\", \"sqlite/datetime@1 contract value must be an ISO-8601 string\", { meta: {\n\t\t\tcodecId: SQLITE_DATETIME_CODEC_ID,\n\t\t\treceived: typeof json\n\t\t} });\n\t\treturn this.parseDate(json);\n\t}\n};\nvar SqliteDatetimeDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn expression;\n\t}\n\tcodecId = SQLITE_DATETIME_CODEC_ID;\n\ttraits = [\"equality\", \"order\"];\n\ttargetTypes = [\"text\"];\n\tparamsSchema = voidParamsSchema;\n\tfactory() {\n\t\treturn () => new SqliteDatetimeCodec(this);\n\t}\n};\nconst sqliteDatetimeDescriptor = new SqliteDatetimeDescriptor();\nconst sqliteDatetimeColumn = () => column(sqliteDatetimeDescriptor.factory(), sqliteDatetimeDescriptor.codecId, void 0, \"text\");\nvar SqliteJsonCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn JSON.stringify(value);\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn typeof wire === \"string\" ? JSON.parse(wire) : wire;\n\t}\n\tencodeJson(value) {\n\t\treturn value;\n\t}\n\tdecodeJson(json) {\n\t\treturn json;\n\t}\n};\nvar SqliteJsonDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn jsonDocumentRetag(expression);\n\t}\n\tcodecId = SQLITE_JSON_CODEC_ID;\n\ttraits = [\"equality\"];\n\ttargetTypes = [\"text\"];\n\tparamsSchema = voidParamsSchema;\n\tfactory() {\n\t\treturn () => new SqliteJsonCodec(this);\n\t}\n};\nconst sqliteJsonDescriptor = new SqliteJsonDescriptor();\nconst sqliteJsonColumn = () => column(sqliteJsonDescriptor.factory(), sqliteJsonDescriptor.codecId, void 0, \"text\");\nvar SqliteBigintCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn value;\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn BigInt(wire);\n\t}\n\tencodeJson(value) {\n\t\treturn value.toString();\n\t}\n\tdecodeJson(json) {\n\t\tif (typeof json !== \"string\" || !DECIMAL_INTEGER.test(json)) throw sqliteError(\"RUNTIME.DECODE_FAILED\", \"sqlite/bigint@1 database JSON value must be a decimal string\", { meta: {\n\t\t\tcodecId: SQLITE_BIGINT_CODEC_ID,\n\t\t\treceived: typeof json\n\t\t} });\n\t\treturn BigInt(json);\n\t}\n};\nvar SqliteBigintDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn decimalTextJsonProjection(expression);\n\t}\n\tcodecId = SQLITE_BIGINT_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"numeric\"\n\t];\n\ttargetTypes = [\"integer\"];\n\tparamsSchema = voidParamsSchema;\n\tfactory() {\n\t\treturn () => new SqliteBigintCodec(this);\n\t}\n};\nconst sqliteBigintDescriptor = new SqliteBigintDescriptor();\nconst sqliteBigintColumn = () => column(sqliteBigintDescriptor.factory(), sqliteBigintDescriptor.codecId, void 0, \"integer\");\nconst codecDescriptors = defineSqliteCodecs([\n\tsqliteSqlCharDescriptor,\n\tsqliteSqlVarcharDescriptor,\n\tsqliteSqlIntDescriptor,\n\tsqliteSqlFloatDescriptor,\n\tsqliteTextDescriptor,\n\tsqliteIntegerDescriptor,\n\tsqliteRealDescriptor,\n\tsqliteBlobDescriptor,\n\tsqliteDatetimeDescriptor,\n\tsqliteJsonDescriptor,\n\tsqliteBigintDescriptor\n]);\n//#endregion\n//#region src/core/registry.ts\n/**\n* Registry of every codec descriptor shipped by `@internal/target-sqlite`.\n*\n* Public consumer surface for the sqlite codec set: the sqlite adapter and any other consumer that needs to enumerate or look up a sqlite codec by id consumes this rather than the raw descriptor array. See ADR 208.\n*/\nconst sqliteCodecRegistry = buildCodecDescriptorRegistry(codecDescriptors);\nconst sqliteCodecDescriptorRegistry = buildSqliteCodecDescriptorRegistry(codecDescriptors);\n//#endregion\nexport { jsonDocumentRetag, sqliteBigintColumn, sqliteBlobColumn, sqliteCodecDescriptorRegistry, sqliteCodecRegistry, sqliteDatetimeColumn, sqliteIntegerColumn, sqliteJsonColumn, sqliteRealColumn, sqliteTextColumn };\n\n//# sourceMappingURL=codecs.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAM,0BAA0B,eAAe;;;;;;;;;AAS/C,MAAM,6BAA6B,eAAe,SAAS,GAAG,YAAY,MAAM;;;;;;;;;;;;;;AAchF,MAAM,qBAAqB,eAAe,SAAS,GAAG,CAAC;CACtD,WAAW,cAAc,OAAO,UAAU;CAC1C,OAAO,YAAY,GAAG,IAAI;AAC3B,CAAC,GAAG,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAC5C,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;AAqBtB,MAAM,qBAAqB,eAAe,YAAY,UAAU,IAAI,aAAa,iBAAiB,GAAG,eAAe,CAAC,UAAU,CAAC;;AAEhI,MAAM,eAAe,eAAe,sBAAsB,oBAAoB,WAAW,OAAO,iBAAiB,WAAW,KAAK,WAAW;AAC5I,MAAM,kBAAkB;AACxB,MAAM,gBAAgB;;;;;;AAMtB,MAAM,cAAc,OAAO,SAAS;CACnC,IAAI,CAAC,OAAO,SAAS,KAAK,GAAG,MAAM,YAAY,MAAM,+CAA+C,EAAE,MAAM;EAC3G,SAAS;EACT,UAAU,OAAO,KAAK;CACvB,EAAE,CAAC;CACH,OAAO;AACR;AACA,MAAM,0BAA0B,YAAY,mBAAmB,EAAE,gBAAgB,uBAAuB,CAAC;AACzG,MAAM,6BAA6B,YAAY,sBAAsB,EAAE,gBAAgB,uBAAuB,CAAC;AAC/G,MAAM,yBAAyB,YAAY,kBAAkB,EAAE,gBAAgB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mCAAmC,gBAAgB"}
|
|
1
|
+
{"version":3,"file":"codecs-BaoqGdxT.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/codecs.mjs"],"sourcesContent":["import { a as SQLITE_JSON_CODEC_ID, i as SQLITE_INTEGER_CODEC_ID, n as SQLITE_BLOB_CODEC_ID, o as SQLITE_REAL_CODEC_ID, r as SQLITE_DATETIME_CODEC_ID, s as SQLITE_TEXT_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID } from \"./codec-ids-xicqpuAa.mjs\";\nimport { a as sqliteCodec, n as buildSqliteCodecDescriptorRegistry, r as defineSqliteCodecs, t as SqliteCodecDescriptor } from \"./codec-descriptor-kVCSW1OR.mjs\";\nimport { n as sqliteError } from \"./errors-CKsaaSnD.mjs\";\nimport { CaseExpr, CastExpr, FunctionCallExpr, LiteralExpr, NullCheckExpr, sqlCharDescriptor, sqlFloatDescriptor, sqlIntDescriptor, sqlVarcharDescriptor } from \"@internal/sql-relational-core/ast\";\nimport { CodecImpl, column, voidParamsSchema } from \"@internal/framework-components/codec\";\nimport { buildCodecDescriptorRegistry } from \"@internal/sql-relational-core/codec-descriptor-registry\";\n//#region src/core/codecs.ts\n/**\n* Projects the expression unchanged, for codecs whose canonical JSON is what\n* SQLite's own JSON conversion already produces.\n*\n* Identity here is a claim about the target's behaviour, not an absence of one:\n* the codec's conformance cases are what test it, including at the boundaries\n* of the representation where a native conversion would be most likely to\n* diverge.\n*/\nconst identityJsonProjection = (expression) => expression;\n/**\n* Projects an integer-valued expression as decimal text.\n*\n* The cast is part of the projected expression, so it applies before the JSON\n* constructor sees the value: handed an INTEGER directly, the constructor emits\n* a JSON number, and SQLite's 64-bit range does not survive being read back as\n* a double. Casting the constructor's result would be too late.\n*/\nconst decimalTextJsonProjection = (expression) => CastExpr.as(expression, \"TEXT\");\n/**\n* Projects a BLOB as hexadecimal text.\n*\n* SQLite's JSON functions reject a BLOB argument outright, so the encoding has\n* to replace the native conversion rather than post-process it. `hex()` emits\n* uppercase and never wraps at any length, which is the spelling `encodeJson`\n* pins.\n*\n* `hex(NULL)` is `''` rather than NULL, and `''` is the hex of an empty blob —\n* so without the NULL check an absent blob and an empty one would both project\n* as `''`, and `decodeJson` accepts `''` because zero hex pairs is a valid\n* empty blob. The check keeps the two distinguishable.\n*/\nconst hexJsonProjection = (expression) => CaseExpr.of([{\n\tcondition: NullCheckExpr.isNull(expression),\n\tvalue: LiteralExpr.of(null)\n}], FunctionCallExpr.of(\"hex\", [expression]));\nconst JSON_RETAG_FN = \"json\";\n/**\n* Re-applies SQLite's JSON subtype to a document-valued expression.\n*\n* SQLite carries \"this text is JSON\" as a subtype on the value rather than in\n* its type, and the subtype does not survive a derived table: a document that\n* `json_object` produced arrives one level out as plain text, so the enclosing\n* constructor embeds it as a *string containing JSON* rather than as a\n* document. `json()` re-applies the subtype, which is what makes the value nest\n* as a document again.\n*\n* The loss happens at the first derived-table boundary and does not compound, so\n* a retag is needed where the document is consumed rather than at every level it\n* passes through.\n*\n* Applying this twice is a no-op — SQLite's `json()` is idempotent, and the\n* wrapper collapses rather than nesting so the rendered SQL says so too. It is\n* safe on any valid JSON text, including scalars, and on NULL; it raises\n* `malformed JSON` on text that is not JSON, which is the correct failure for a\n* value that was never a document.\n*/\nconst jsonDocumentRetag = (expression) => isJsonRetag(expression) ? expression : FunctionCallExpr.of(JSON_RETAG_FN, [expression]);\n/** Whether an expression is already a retag, so applying one again would only nest. */\nconst isJsonRetag = (expression) => expression instanceof FunctionCallExpr && expression.fn === JSON_RETAG_FN && expression.args.length === 1;\nconst DECIMAL_INTEGER = /^-?\\d+$/;\nconst UPPERCASE_HEX = /^(?:[0-9A-F]{2})*$/;\n/**\n* JSON has no spelling for an infinity or a NaN, and SQLite renders one as\n* `9.0e+999`, which reads back as `Infinity` rather than failing. A real is\n* therefore carried only where it is finite.\n*/\nconst finiteReal = (value, code) => {\n\tif (!Number.isFinite(value)) throw sqliteError(code, \"sqlite/real@1 value must be a finite number\", { meta: {\n\t\tcodecId: SQLITE_REAL_CODEC_ID,\n\t\treceived: String(value)\n\t} });\n\treturn value;\n};\nconst sqliteSqlCharDescriptor = sqliteCodec(sqlCharDescriptor, { jsonProjection: identityJsonProjection });\nconst sqliteSqlVarcharDescriptor = sqliteCodec(sqlVarcharDescriptor, { jsonProjection: identityJsonProjection });\nconst sqliteSqlIntDescriptor = sqliteCodec(sqlIntDescriptor, { jsonProjection: identityJsonProjection });\nconst sqliteSqlFloatDescriptor = sqliteCodec(sqlFloatDescriptor, { jsonProjection: identityJsonProjection });\nvar SqliteTextCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn value;\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn wire;\n\t}\n\tencodeJson(value) {\n\t\treturn value;\n\t}\n\tdecodeJson(json) {\n\t\treturn json;\n\t}\n};\nvar SqliteTextDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn expression;\n\t}\n\tcodecId = SQLITE_TEXT_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"textual\"\n\t];\n\ttargetTypes = [\"text\"];\n\tparamsSchema = voidParamsSchema;\n\tfactory() {\n\t\treturn () => new SqliteTextCodec(this);\n\t}\n};\nconst sqliteTextDescriptor = new SqliteTextDescriptor();\nconst sqliteTextColumn = () => column(sqliteTextDescriptor.factory(), sqliteTextDescriptor.codecId, void 0, \"text\");\nvar SqliteIntegerCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn value;\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn wire;\n\t}\n\tencodeJson(value) {\n\t\treturn value;\n\t}\n\tdecodeJson(json) {\n\t\treturn json;\n\t}\n};\nvar SqliteIntegerDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn expression;\n\t}\n\tcodecId = SQLITE_INTEGER_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"numeric\"\n\t];\n\ttargetTypes = [\"integer\"];\n\tparamsSchema = voidParamsSchema;\n\tfactory() {\n\t\treturn () => new SqliteIntegerCodec(this);\n\t}\n};\nconst sqliteIntegerDescriptor = new SqliteIntegerDescriptor();\nconst sqliteIntegerColumn = () => column(sqliteIntegerDescriptor.factory(), sqliteIntegerDescriptor.codecId, void 0, \"integer\");\nvar SqliteRealCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn value;\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn wire;\n\t}\n\tencodeJson(value) {\n\t\treturn finiteReal(value, \"RUNTIME.ENCODE_FAILED\");\n\t}\n\tdecodeJson(json) {\n\t\tif (typeof json !== \"number\") throw sqliteError(\"RUNTIME.DECODE_FAILED\", \"sqlite/real@1 database JSON value must be a number\", { meta: {\n\t\t\tcodecId: SQLITE_REAL_CODEC_ID,\n\t\t\treceived: typeof json\n\t\t} });\n\t\treturn finiteReal(json, \"RUNTIME.DECODE_FAILED\");\n\t}\n};\nvar SqliteRealDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn expression;\n\t}\n\tcodecId = SQLITE_REAL_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"numeric\"\n\t];\n\ttargetTypes = [\"real\"];\n\tparamsSchema = voidParamsSchema;\n\tfactory() {\n\t\treturn () => new SqliteRealCodec(this);\n\t}\n};\nconst sqliteRealDescriptor = new SqliteRealDescriptor();\nconst sqliteRealColumn = () => column(sqliteRealDescriptor.factory(), sqliteRealDescriptor.codecId, void 0, \"real\");\nvar SqliteBlobCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn value;\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn wire;\n\t}\n\tencodeJson(value) {\n\t\treturn Buffer.from(value).toString(\"hex\").toUpperCase();\n\t}\n\tdecodeJson(json) {\n\t\tif (typeof json !== \"string\" || !UPPERCASE_HEX.test(json)) throw sqliteError(\"RUNTIME.DECODE_FAILED\", \"sqlite/blob@1 database JSON value must be uppercase hexadecimal text\", { meta: {\n\t\t\tcodecId: SQLITE_BLOB_CODEC_ID,\n\t\t\treceived: typeof json\n\t\t} });\n\t\treturn new Uint8Array(Buffer.from(json, \"hex\"));\n\t}\n};\nvar SqliteBlobDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn hexJsonProjection(expression);\n\t}\n\tcodecId = SQLITE_BLOB_CODEC_ID;\n\ttraits = [\"equality\"];\n\ttargetTypes = [\"blob\"];\n\tparamsSchema = voidParamsSchema;\n\tfactory() {\n\t\treturn () => new SqliteBlobCodec(this);\n\t}\n};\nconst sqliteBlobDescriptor = new SqliteBlobDescriptor();\nconst sqliteBlobColumn = () => column(sqliteBlobDescriptor.factory(), sqliteBlobDescriptor.codecId, void 0, \"blob\");\nvar SqliteDatetimeCodec = class extends CodecImpl {\n\tparseDate(value) {\n\t\tconst date = new Date(value);\n\t\tif (Number.isNaN(date.getTime())) throw sqliteError(\"RUNTIME.DECODE_FAILED\", `sqlite/datetime@1 value must be a valid ISO-8601 string: ${value}`, { meta: {\n\t\t\tcodecId: SQLITE_DATETIME_CODEC_ID,\n\t\t\treceived: value\n\t\t} });\n\t\treturn date;\n\t}\n\tasync encode(value, _ctx) {\n\t\treturn value.toISOString();\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn this.parseDate(wire);\n\t}\n\tencodeJson(value) {\n\t\treturn value.toISOString();\n\t}\n\tdecodeJson(json) {\n\t\tif (typeof json !== \"string\") throw sqliteError(\"RUNTIME.DECODE_FAILED\", \"sqlite/datetime@1 contract value must be an ISO-8601 string\", { meta: {\n\t\t\tcodecId: SQLITE_DATETIME_CODEC_ID,\n\t\t\treceived: typeof json\n\t\t} });\n\t\treturn this.parseDate(json);\n\t}\n};\nvar SqliteDatetimeDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn expression;\n\t}\n\tcodecId = SQLITE_DATETIME_CODEC_ID;\n\ttraits = [\"equality\", \"order\"];\n\ttargetTypes = [\"text\"];\n\tparamsSchema = voidParamsSchema;\n\tfactory() {\n\t\treturn () => new SqliteDatetimeCodec(this);\n\t}\n};\nconst sqliteDatetimeDescriptor = new SqliteDatetimeDescriptor();\nconst sqliteDatetimeColumn = () => column(sqliteDatetimeDescriptor.factory(), sqliteDatetimeDescriptor.codecId, void 0, \"text\");\nvar SqliteJsonCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn JSON.stringify(value);\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn typeof wire === \"string\" ? JSON.parse(wire) : wire;\n\t}\n\tencodeJson(value) {\n\t\treturn value;\n\t}\n\tdecodeJson(json) {\n\t\treturn json;\n\t}\n};\nvar SqliteJsonDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn jsonDocumentRetag(expression);\n\t}\n\tcodecId = SQLITE_JSON_CODEC_ID;\n\ttraits = [\"equality\"];\n\ttargetTypes = [\"text\"];\n\tparamsSchema = voidParamsSchema;\n\tfactory() {\n\t\treturn () => new SqliteJsonCodec(this);\n\t}\n};\nconst sqliteJsonDescriptor = new SqliteJsonDescriptor();\nconst sqliteJsonColumn = () => column(sqliteJsonDescriptor.factory(), sqliteJsonDescriptor.codecId, void 0, \"text\");\nvar SqliteBigintCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn value;\n\t}\n\t/**\n\t* The wire value is text wherever the value could outrun a JS number: an\n\t* aggregate SQLite computes leaves the database through the descriptor's cast\n\t* to text, because the driver reads an integer no number can hold as an error\n\t* rather than a value.\n\t*/\n\tasync decode(wire, _ctx) {\n\t\tif (typeof wire === \"string\" && !DECIMAL_INTEGER.test(wire)) throw sqliteError(\"RUNTIME.DECODE_FAILED\", \"sqlite/bigint@1 wire value must be a decimal string\", { meta: {\n\t\t\tcodecId: SQLITE_BIGINT_CODEC_ID,\n\t\t\treceived: wire\n\t\t} });\n\t\treturn BigInt(wire);\n\t}\n\tencodeJson(value) {\n\t\treturn value.toString();\n\t}\n\tdecodeJson(json) {\n\t\tif (typeof json !== \"string\" || !DECIMAL_INTEGER.test(json)) throw sqliteError(\"RUNTIME.DECODE_FAILED\", \"sqlite/bigint@1 database JSON value must be a decimal string\", { meta: {\n\t\t\tcodecId: SQLITE_BIGINT_CODEC_ID,\n\t\t\treceived: typeof json\n\t\t} });\n\t\treturn BigInt(json);\n\t}\n};\nvar SqliteBigintDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn decimalTextJsonProjection(expression);\n\t}\n\tcodecId = SQLITE_BIGINT_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"numeric\"\n\t];\n\ttargetTypes = [\"integer\"];\n\tparamsSchema = voidParamsSchema;\n\tfactory() {\n\t\treturn () => new SqliteBigintCodec(this);\n\t}\n};\nconst sqliteBigintDescriptor = new SqliteBigintDescriptor();\nconst sqliteBigintColumn = () => column(sqliteBigintDescriptor.factory(), sqliteBigintDescriptor.codecId, void 0, \"integer\");\nconst codecDescriptors = defineSqliteCodecs([\n\tsqliteSqlCharDescriptor,\n\tsqliteSqlVarcharDescriptor,\n\tsqliteSqlIntDescriptor,\n\tsqliteSqlFloatDescriptor,\n\tsqliteTextDescriptor,\n\tsqliteIntegerDescriptor,\n\tsqliteRealDescriptor,\n\tsqliteBlobDescriptor,\n\tsqliteDatetimeDescriptor,\n\tsqliteJsonDescriptor,\n\tsqliteBigintDescriptor\n]);\n//#endregion\n//#region src/core/registry.ts\n/**\n* Registry of every codec descriptor shipped by `@internal/target-sqlite`.\n*\n* Public consumer surface for the sqlite codec set: the sqlite adapter and any other consumer that needs to enumerate or look up a sqlite codec by id consumes this rather than the raw descriptor array. See ADR 208.\n*/\nconst sqliteCodecRegistry = buildCodecDescriptorRegistry(codecDescriptors);\nconst sqliteCodecDescriptorRegistry = buildSqliteCodecDescriptorRegistry(codecDescriptors);\n//#endregion\nexport { jsonDocumentRetag, sqliteBigintColumn, sqliteBlobColumn, sqliteCodecDescriptorRegistry, sqliteCodecRegistry, sqliteDatetimeColumn, sqliteIntegerColumn, sqliteJsonColumn, sqliteRealColumn, sqliteTextColumn };\n\n//# sourceMappingURL=codecs.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAM,0BAA0B,eAAe;;;;;;;;;AAS/C,MAAM,6BAA6B,eAAe,SAAS,GAAG,YAAY,MAAM;;;;;;;;;;;;;;AAchF,MAAM,qBAAqB,eAAe,SAAS,GAAG,CAAC;CACtD,WAAW,cAAc,OAAO,UAAU;CAC1C,OAAO,YAAY,GAAG,IAAI;AAC3B,CAAC,GAAG,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAC5C,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;AAqBtB,MAAM,qBAAqB,eAAe,YAAY,UAAU,IAAI,aAAa,iBAAiB,GAAG,eAAe,CAAC,UAAU,CAAC;;AAEhI,MAAM,eAAe,eAAe,sBAAsB,oBAAoB,WAAW,OAAO,iBAAiB,WAAW,KAAK,WAAW;AAC5I,MAAM,kBAAkB;AACxB,MAAM,gBAAgB;;;;;;AAMtB,MAAM,cAAc,OAAO,SAAS;CACnC,IAAI,CAAC,OAAO,SAAS,KAAK,GAAG,MAAM,YAAY,MAAM,+CAA+C,EAAE,MAAM;EAC3G,SAAS;EACT,UAAU,OAAO,KAAK;CACvB,EAAE,CAAC;CACH,OAAO;AACR;AACA,MAAM,0BAA0B,YAAY,mBAAmB,EAAE,gBAAgB,uBAAuB,CAAC;AACzG,MAAM,6BAA6B,YAAY,sBAAsB,EAAE,gBAAgB,uBAAuB,CAAC;AAC/G,MAAM,yBAAyB,YAAY,kBAAkB,EAAE,gBAAgB,uBAAuB,CAAC;AACvG,MAAM,2BAA2B,YAAY,oBAAoB,EAAE,gBAAgB,uBAAuB,CAAC;AAC3G,IAAI,kBAAkB,cAAc,UAAU;CAC7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6B,gBAAgB;AACzE,MAAM,gCAAgC,mCAAmC,gBAAgB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { i as SqliteCodecDescriptorRegistry, r as SqliteCodecDescriptor } from "./codec-descriptor-BcgD9f3L-
|
|
1
|
+
import { i as SqliteCodecDescriptorRegistry, r as SqliteCodecDescriptor } from "./codec-descriptor-BcgD9f3L-yDi5nh_k.mjs";
|
|
2
2
|
import { a as SQLITE_JSON_CODEC_ID, i as SQLITE_INTEGER_CODEC_ID, n as SQLITE_BLOB_CODEC_ID, o as SQLITE_REAL_CODEC_ID, r as SQLITE_DATETIME_CODEC_ID, s as SQLITE_TEXT_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID } from "./codec-ids-DocGjhs--CHhP1jNZ.mjs";
|
|
3
|
-
import { CodecCallContext, CodecImpl, CodecInstanceContext } from "@prisma/orm-framework/components/codec";
|
|
4
3
|
import { ProjectionExpr } from "@prisma/orm-family-sql/relational-core/ast";
|
|
4
|
+
import { CodecCallContext, CodecImpl, CodecInstanceContext } from "@prisma/orm-framework/components/codec";
|
|
5
5
|
import { JsonValue } from "@prisma/orm-framework/contract/types";
|
|
6
6
|
import { CodecDescriptorRegistry } from "@prisma/orm-family-sql/relational-core/query-lane-context";
|
|
7
|
-
//#region ../../../3-targets/3-targets/sqlite/dist/codecs-
|
|
7
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/codecs-CEh66QoN.d.mts
|
|
8
8
|
//#region src/core/codec-helpers.d.ts
|
|
9
9
|
/**
|
|
10
10
|
* Local `JsonValue` alias for the SQLite target. Codec implementations live in `codecs.ts` (TML-2357); this module retains only the JSON-shape alias the surrounding adapter and tests still import.
|
|
@@ -126,9 +126,15 @@ declare class SqliteJsonDescriptor extends SqliteCodecDescriptor<void> {
|
|
|
126
126
|
factory(): (ctx: CodecInstanceContext) => SqliteJsonCodec;
|
|
127
127
|
}
|
|
128
128
|
declare const sqliteJsonColumn: () => import("@prisma/orm-framework/components/codec").ColumnSpec<SqliteJsonCodec, undefined>;
|
|
129
|
-
declare class SqliteBigintCodec extends CodecImpl<typeof SQLITE_BIGINT_CODEC_ID, readonly ['equality', 'order', 'numeric'], number | bigint, bigint> {
|
|
129
|
+
declare class SqliteBigintCodec extends CodecImpl<typeof SQLITE_BIGINT_CODEC_ID, readonly ['equality', 'order', 'numeric'], number | bigint | string, bigint> {
|
|
130
130
|
encode(value: bigint, _ctx: CodecCallContext): Promise<number | bigint>;
|
|
131
|
-
|
|
131
|
+
/**
|
|
132
|
+
* The wire value is text wherever the value could outrun a JS number: an
|
|
133
|
+
* aggregate SQLite computes leaves the database through the descriptor's cast
|
|
134
|
+
* to text, because the driver reads an integer no number can hold as an error
|
|
135
|
+
* rather than a value.
|
|
136
|
+
*/
|
|
137
|
+
decode(wire: number | bigint | string, _ctx: CodecCallContext): Promise<bigint>;
|
|
132
138
|
encodeJson(value: bigint): JsonValue;
|
|
133
139
|
decodeJson(json: JsonValue): bigint;
|
|
134
140
|
}
|
|
@@ -152,4 +158,4 @@ declare const sqliteCodecRegistry: CodecDescriptorRegistry;
|
|
|
152
158
|
declare const sqliteCodecDescriptorRegistry: SqliteCodecDescriptorRegistry;
|
|
153
159
|
//#endregion
|
|
154
160
|
export { sqliteRealColumn as _, SqliteIntegerDescriptor as a, SqliteTextDescriptor as c, sqliteBlobColumn as d, sqliteCodecDescriptorRegistry as f, sqliteJsonColumn as g, sqliteIntegerColumn as h, SqliteDatetimeDescriptor as i, jsonDocumentRetag as l, sqliteDatetimeColumn as m, SqliteBigintDescriptor as n, SqliteJsonDescriptor as o, sqliteCodecRegistry as p, SqliteBlobDescriptor as r, SqliteRealDescriptor as s, JsonValue$1 as t, sqliteBigintColumn as u, sqliteTextColumn as v };
|
|
155
|
-
//# sourceMappingURL=codecs-
|
|
161
|
+
//# sourceMappingURL=codecs-CEh66QoN-oCsdncEe.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codecs-
|
|
1
|
+
{"version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B;;cAE9B,uEAAuE,WAAW;cAClF,4BAA4B,iBAAiB,kEAAkE;UACnH;EACR,OAAO,OAAO,MAAM,MAAM,mBAAmB;EAC7C,OAAO,cAAc,MAAM,mBAAmB,QAAQ;EACtD,WAAW,OAAO,OAAO;EACzB,WAAW,MAAM,YAAY;;cAEjB,iCAAiC;YACnC,eAAe,YAAY,iBAAiB;WAC7C;WACA;WACA;WACA,8CAA8C;EACvD,YAAY,KAAK,yBAAyB;;cAE9B,2EAA2E,WAAW;cACtF,wBAAwB,iBAAiB,sDAAsD,WAAW;EACtH,OAAO,OAAO,WAAW,MAAM,mBAAmB;EAClD,OAAO,eAAe,WAAW,MAAM,mBAAmB,QAAQ;EAClE,WAAW,OAAO,YAAY;EAC9B,WAAW,MAAM,YAAY;;cAEjB,6BAA6B;YAC/B,eAAe,YAAY,iBAAiB;WAC7C;WACA;WACA;WACA,8CAA8C;EACvD,YAAY,KAAK,yBAAyB;;cAE9B,uEAAuE,WAAW;cAClF,0BAA0B,iBAAiB;EACvD,OAAO,eAAe,MAAM,mBAAmB;;;;;;;EAO/C,OAAO,gCAAgC,MAAM,mBAAmB;EAChE,WAAW,gBAAgB;EAC3B,WAAW,MAAM;;cAEL,+BAA+B;YACjC,eAAe,YAAY,iBAAiB;WAC7C;WACA;WACA;WACA,8CAA8C;EACvD,YAAY,KAAK,yBAAyB;;cAE9B,yEAAyE,WAAW;;;;;;;;cAQpF,qBAAqB;cACrB,+BAA+B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as AnySqliteCodecDescriptor } from "./codec-descriptor-BcgD9f3L-
|
|
2
|
-
import "./codec-descriptor-
|
|
3
|
-
import { n as SqliteCodecRegistry } from "./types-C5FSREvo-
|
|
1
|
+
import { n as AnySqliteCodecDescriptor } from "./codec-descriptor-BcgD9f3L-yDi5nh_k.mjs";
|
|
2
|
+
import "./codec-descriptor-vwfD3BMy.mjs";
|
|
3
|
+
import { n as SqliteCodecRegistry } from "./types-C5FSREvo-CwUlKK34.mjs";
|
|
4
4
|
import { r as SqliteDdlNode } from "./nodes-D8EC1yCx-rpfpuJ4T.mjs";
|
|
5
5
|
import "./ddl-CfSqNT0M.mjs";
|
|
6
6
|
import { t as parseSqliteDefault } from "./default-normalizer-B9V7TY5u.mjs";
|
|
@@ -114,4 +114,4 @@ declare class SqliteControlAdapter implements SqlControlAdapter<'sqlite'> {
|
|
|
114
114
|
declare const sqliteAdapterDescriptor: SqlControlAdapterDescriptor<'sqlite'>;
|
|
115
115
|
//#endregion
|
|
116
116
|
export { sqliteAdapterDescriptor as i, createSqliteBuiltinCodecLookup as n, createSqliteCodecRegistryWithBuiltins as r, SqliteControlAdapter as t };
|
|
117
|
-
//# sourceMappingURL=control-
|
|
117
|
+
//# sourceMappingURL=control-CLirKz11.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-
|
|
1
|
+
{"version":3,"file":"control-CLirKz11.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,34 @@
|
|
|
1
|
+
import { t as sqliteAggregateDescriptors } from "./aggregates-CTDRDyvD.mjs";
|
|
2
|
+
import { a as sqliteCodecRegistry } from "./codecs-BaoqGdxT.mjs";
|
|
3
|
+
//#region ../../../3-targets/6-adapters/sqlite/dist/descriptor-meta-DjKgG4z5.mjs
|
|
4
|
+
const sqliteAdapterDescriptorMeta = {
|
|
5
|
+
kind: "adapter",
|
|
6
|
+
familyId: "sql",
|
|
7
|
+
targetId: "sqlite",
|
|
8
|
+
id: "sqlite",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
capabilities: { sql: {
|
|
11
|
+
orderBy: true,
|
|
12
|
+
limit: true,
|
|
13
|
+
lateral: false,
|
|
14
|
+
jsonAgg: true,
|
|
15
|
+
returning: true,
|
|
16
|
+
foreignKeys: true,
|
|
17
|
+
enums: false
|
|
18
|
+
} },
|
|
19
|
+
types: {
|
|
20
|
+
aggregateDescriptors: sqliteAggregateDescriptors,
|
|
21
|
+
codecTypes: {
|
|
22
|
+
codecDescriptors: Array.from(sqliteCodecRegistry.values()).filter((d) => d.renderOutputType === void 0),
|
|
23
|
+
import: {
|
|
24
|
+
package: "@internal/adapter-sqlite/codec-types",
|
|
25
|
+
named: "CodecTypes",
|
|
26
|
+
alias: "SqliteTypes"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { sqliteAdapterDescriptorMeta as t };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=descriptor-meta-DjKgG4z5-CDdHwPoG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptor-meta-DjKgG4z5-CDdHwPoG.mjs","names":[],"sources":["../../../../3-targets/6-adapters/sqlite/dist/descriptor-meta-DjKgG4z5.mjs"],"sourcesContent":["import { sqliteCodecRegistry } from \"@internal/target-sqlite/codecs\";\nimport { sqliteAggregateDescriptors } from \"@internal/target-sqlite/aggregates\";\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: {\n\t\taggregateDescriptors: sqliteAggregateDescriptors,\n\t\tcodecTypes: {\n\t\t\tcodecDescriptors: Array.from(sqliteCodecRegistry.values()).filter((d) => d.renderOutputType === void 0),\n\t\t\timport: {\n\t\t\t\tpackage: \"@internal/adapter-sqlite/codec-types\",\n\t\t\t\tnamed: \"CodecTypes\",\n\t\t\t\talias: \"SqliteTypes\"\n\t\t\t}\n\t\t}\n\t}\n};\n//#endregion\nexport { sqliteAdapterDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-DjKgG4z5.mjs.map"],"mappings":";;;AAEA,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;EACN,sBAAsB;EACtB,YAAY;GACX,kBAAkB,MAAM,KAAK,oBAAoB,OAAO,CAAC,CAAC,CAAC,QAAQ,MAAM,EAAE,qBAAqB,KAAK,CAAC;GACtG,QAAQ;IACP,SAAS;IACT,OAAO;IACP,OAAO;GACR;EACD;CACD;AACD"}
|
package/dist/driver__runtime.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { n as sqliteDriverDescriptorMeta, t as normalizeSqliteError } from "./descriptor-meta-vjJkUDsn-Hz3rnAnk.mjs";
|
|
2
|
+
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
2
3
|
import { DatabaseSync } from "node:sqlite";
|
|
3
4
|
//#region ../../../3-targets/7-drivers/sqlite/dist/runtime.mjs
|
|
4
5
|
function driverError(code, message, details) {
|
|
@@ -30,43 +31,41 @@ function openConnection(path) {
|
|
|
30
31
|
throw normalizeSqliteError(error);
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
|
-
var
|
|
34
|
-
|
|
34
|
+
var SqliteQueryable = class {
|
|
35
|
+
db;
|
|
35
36
|
constructor(db) {
|
|
36
|
-
this
|
|
37
|
+
this.db = db;
|
|
37
38
|
}
|
|
38
|
-
async *
|
|
39
|
+
async *query(request) {
|
|
39
40
|
try {
|
|
40
|
-
const stmt = this
|
|
41
|
+
const stmt = this.db.prepare(request.sql);
|
|
41
42
|
for (const row of stmt.iterate(...toSqliteParams(request.params))) yield row;
|
|
42
43
|
} catch (error) {
|
|
43
44
|
throw normalizeSqliteError(error);
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
-
return this.execute({
|
|
48
|
-
sql: request.sql,
|
|
49
|
-
params: request.params
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
async explain(request) {
|
|
47
|
+
async execute(request) {
|
|
53
48
|
try {
|
|
54
|
-
|
|
49
|
+
const stmt = this.db.prepare(request.sql);
|
|
50
|
+
if (stmt.columns().length !== 0) throw new InternalError("SQLite cannot execute statements that return rows.");
|
|
51
|
+
return { affectedRows: Number(stmt.run(...toSqliteParams(request.params)).changes) };
|
|
55
52
|
} catch (error) {
|
|
56
53
|
throw normalizeSqliteError(error);
|
|
57
54
|
}
|
|
58
55
|
}
|
|
59
|
-
async
|
|
56
|
+
async explain(request) {
|
|
60
57
|
try {
|
|
61
|
-
return { rows: this
|
|
58
|
+
return { rows: this.db.prepare(`EXPLAIN QUERY PLAN ${request.sql}`).all(...toSqliteParams(request.params)) };
|
|
62
59
|
} catch (error) {
|
|
63
60
|
throw normalizeSqliteError(error);
|
|
64
61
|
}
|
|
65
62
|
}
|
|
63
|
+
};
|
|
64
|
+
var SqliteConnectionImpl = class extends SqliteQueryable {
|
|
66
65
|
async beginTransaction() {
|
|
67
66
|
try {
|
|
68
|
-
this
|
|
69
|
-
return new SqliteTransactionImpl(this
|
|
67
|
+
this.db.exec("BEGIN");
|
|
68
|
+
return new SqliteTransactionImpl(this.db);
|
|
70
69
|
} catch (error) {
|
|
71
70
|
throw normalizeSqliteError(error);
|
|
72
71
|
}
|
|
@@ -76,60 +75,35 @@ var SqliteConnectionImpl = class {
|
|
|
76
75
|
}
|
|
77
76
|
async destroy(_reason) {
|
|
78
77
|
try {
|
|
79
|
-
this
|
|
78
|
+
this.db.close();
|
|
80
79
|
} catch (error) {
|
|
81
80
|
throw normalizeSqliteError(error);
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
83
|
};
|
|
85
|
-
var SqliteTransactionImpl = class {
|
|
86
|
-
#db;
|
|
87
|
-
constructor(db) {
|
|
88
|
-
this.#db = db;
|
|
89
|
-
}
|
|
90
|
-
async *execute(request) {
|
|
91
|
-
try {
|
|
92
|
-
const stmt = this.#db.prepare(request.sql);
|
|
93
|
-
for (const row of stmt.iterate(...toSqliteParams(request.params))) yield row;
|
|
94
|
-
} catch (error) {
|
|
95
|
-
throw normalizeSqliteError(error);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
executePrepared(request) {
|
|
99
|
-
return this.execute({
|
|
100
|
-
sql: request.sql,
|
|
101
|
-
params: request.params
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
async explain(request) {
|
|
105
|
-
try {
|
|
106
|
-
return { rows: this.#db.prepare(`EXPLAIN QUERY PLAN ${request.sql}`).all(...toSqliteParams(request.params)) };
|
|
107
|
-
} catch (error) {
|
|
108
|
-
throw normalizeSqliteError(error);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
async query(sql, params) {
|
|
112
|
-
try {
|
|
113
|
-
return { rows: this.#db.prepare(sql).all(...toSqliteParams(params)) };
|
|
114
|
-
} catch (error) {
|
|
115
|
-
throw normalizeSqliteError(error);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
84
|
+
var SqliteTransactionImpl = class extends SqliteQueryable {
|
|
118
85
|
async commit() {
|
|
119
86
|
try {
|
|
120
|
-
this
|
|
87
|
+
this.db.exec("COMMIT");
|
|
121
88
|
} catch (error) {
|
|
122
89
|
throw normalizeSqliteError(error);
|
|
123
90
|
}
|
|
124
91
|
}
|
|
125
92
|
async rollback() {
|
|
126
93
|
try {
|
|
127
|
-
this
|
|
94
|
+
this.db.exec("ROLLBACK");
|
|
128
95
|
} catch (error) {
|
|
129
96
|
throw normalizeSqliteError(error);
|
|
130
97
|
}
|
|
131
98
|
}
|
|
132
99
|
};
|
|
100
|
+
function unboundQuery() {
|
|
101
|
+
return { [Symbol.asyncIterator]() {
|
|
102
|
+
return { async next() {
|
|
103
|
+
throw driverError("DRIVER.NOT_CONNECTED", NOT_CONNECTED_MESSAGE);
|
|
104
|
+
} };
|
|
105
|
+
} };
|
|
106
|
+
}
|
|
133
107
|
var SqliteDriver = class {
|
|
134
108
|
familyId = "sql";
|
|
135
109
|
targetId = "sqlite";
|
|
@@ -162,28 +136,16 @@ var SqliteDriver = class {
|
|
|
162
136
|
this.#state = { kind: "closed" };
|
|
163
137
|
await conn.release();
|
|
164
138
|
}
|
|
165
|
-
|
|
166
|
-
if (this.#state.kind !== "connected") return
|
|
167
|
-
|
|
168
|
-
throw driverError("DRIVER.NOT_CONNECTED", NOT_CONNECTED_MESSAGE);
|
|
169
|
-
} };
|
|
170
|
-
} };
|
|
171
|
-
return this.#state.conn.execute(request);
|
|
139
|
+
query(request) {
|
|
140
|
+
if (this.#state.kind !== "connected") return unboundQuery();
|
|
141
|
+
return this.#state.conn.query(request);
|
|
172
142
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
return { async next() {
|
|
176
|
-
throw driverError("DRIVER.NOT_CONNECTED", NOT_CONNECTED_MESSAGE);
|
|
177
|
-
} };
|
|
178
|
-
} };
|
|
179
|
-
return this.#state.conn.executePrepared(request);
|
|
143
|
+
async execute(request) {
|
|
144
|
+
return this.#requireConnected().conn.execute(request);
|
|
180
145
|
}
|
|
181
146
|
async explain(request) {
|
|
182
147
|
return this.#requireConnected().conn.explain(request);
|
|
183
148
|
}
|
|
184
|
-
async query(sql, params) {
|
|
185
|
-
return this.#requireConnected().conn.query(sql, params);
|
|
186
|
-
}
|
|
187
149
|
};
|
|
188
150
|
const sqliteRuntimeDriverDescriptor = {
|
|
189
151
|
...sqliteDriverDescriptorMeta,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver__runtime.mjs","names":["#
|
|
1
|
+
{"version":3,"file":"driver__runtime.mjs","names":["#state","#requireConnected"],"sources":["../../../../3-targets/7-drivers/sqlite/dist/runtime.mjs"],"sourcesContent":["import { n as normalizeSqliteError, t as sqliteDriverDescriptorMeta } from \"./descriptor-meta-vjJkUDsn.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 toSqliteParams(params) {\n\treturn params ?? [];\n}\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(...toSqliteParams(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(...toSqliteParams(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(...toSqliteParams(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-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,QAAQ;CAC/B,OAAO,UAAU,CAAC;AACnB;AACA,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,eAAe,QAAQ,MAAM,CAAC,GAAG,MAAM;EAC1E,SAAS,OAAO;GACf,MAAM,qBAAqB,KAAK;EACjC;CACD;CACA,MAAM,QAAQ,SAAS;EACtB,IAAI;GACH,MAAM,OAAO,KAAK,GAAG,QAAQ,QAAQ,GAAG;GACxC,IAAI,KAAK,QAAQ,CAAC,CAAC,WAAW,GAAG,MAAM,IAAI,cAAc,oDAAoD;GAC7G,OAAO,EAAE,cAAc,OAAO,KAAK,IAAI,GAAG,eAAe,QAAQ,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aAAa,MAAM,YAAY,wBAAwB,qBAAqB;EACrG,OAAO,KAAKA;CACb;CACA,IAAI,QAAQ;EACX,OAAO,KAAKA,OAAO;CACpB;CACA,MAAM,QAAQ,SAAS;EACtB,IAAI,KAAKA,OAAO,SAAS,aAAa,MAAM,YAAY,4BAA4B,2BAA2B,EAAE,aAAa,QAAQ,KAAK,CAAC;EAC5I,KAAKA,SAAS;GACb,MAAM;GACN,MAAM,QAAQ;GACd,MAAM,IAAI,qBAAqB,eAAe,QAAQ,IAAI,CAAC;EAC5D;CACD;CACA,MAAM,oBAAoB;EACzB,MAAM,EAAE,SAAS,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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as CodecTypes } from "./codec-types-
|
|
1
|
+
import { t as CodecTypes } from "./codec-types-DOyikA9Q-DVHiIZxI.mjs";
|
|
2
2
|
//#region ../../../3-targets/3-targets/sqlite/dist/pack.d.mts
|
|
3
3
|
//#region src/core/descriptor-meta.d.ts
|
|
4
4
|
declare const sqliteTargetDescriptorMetaBase: {
|
|
@@ -90,4 +90,4 @@ declare const sqliteTargetDescriptorMeta: typeof sqliteTargetDescriptorMetaBase
|
|
|
90
90
|
};
|
|
91
91
|
//#endregion
|
|
92
92
|
export { sqliteTargetDescriptorMeta as t };
|
|
93
|
-
//# sourceMappingURL=pack-
|
|
93
|
+
//# sourceMappingURL=pack-Cnu6UOJx.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack-
|
|
1
|
+
{"version":3,"file":"pack-Cnu6UOJx.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/pack.d.mts"],"mappings":";;;cAEc;WACH;WACA;aACE;eACE;iBACE;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;uBAIN;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;;;;iBAOZ;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;uBACA;;;;iBAIN;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;uBAEF;yBACE;yBACA;;;;;;;;WAQd;WACA;WACA;WACA;WACA;WACA;WACA,eAAe;;cAEZ,mCAAmC;WACtC,eAAe"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as DropColumnCall, d as buildColumnTypeSql, f as buildRecreatePostchecks, i as DataTransformCall, l as RecreateTableCall, m as renderDefaultLiteral, n as CreateIndexCall, o as DropIndexCall, p as buildRecreateSummary, r as CreateTableCall, s as DropTableCall, t as AddColumnCall, u as buildColumnDefaultSql } from "./op-factory-call-C_or6163-B_LDzC37.mjs";
|
|
2
2
|
import { t as CONTROL_TABLE_NAMES } from "./control-tables-D_o8dKRB-BXi43noL.mjs";
|
|
3
3
|
import { t as TypeScriptRenderableSqliteMigration } from "./planner-produced-sqlite-migration-C8nxPT0P-DdBqfmAD.mjs";
|
|
4
|
-
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
5
4
|
import { DdlColumn, ForeignKeyConstraint, FunctionColumnDefault, LiteralColumnDefault, PrimaryKeyConstraint, UniqueConstraint } from "@prisma/orm-family-sql/relational-core/ast";
|
|
5
|
+
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
6
6
|
import { diffSchemas, issueOutcome, orderIssuesByDependencies } from "@prisma/orm-framework/components/control";
|
|
7
7
|
import { UNBOUND_NAMESPACE_ID, entityAt } from "@prisma/orm-framework/components/ir";
|
|
8
8
|
import { buildNativeTypeExpander, contractToSchemaIR, extractCodecControlHooks, planFieldEventOperations, plannerFailure } from "@prisma/orm-family-sql/family/control";
|
|
@@ -808,4 +808,4 @@ function retainUnownedExtras(issues, ownership) {
|
|
|
808
808
|
//#endregion
|
|
809
809
|
export { verifySqliteDatabaseSchema as a, sqliteContractToSchema as i, createSqliteMigrationPlanner as n, diffSqliteSchema as r, SqliteMigrationPlanner as t };
|
|
810
810
|
|
|
811
|
-
//# sourceMappingURL=planner-DiGcIjl1-
|
|
811
|
+
//# sourceMappingURL=planner-DiGcIjl1-oFtDTY7-.mjs.map
|