@prisma/orm-target-sqlite 8.0.0-rc.18-dev.6 → 8.0.0-rc.18-dev.8
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-Bp_4Bjff-CjV5K6YY.d.mts → adapter-Bp_4Bjff-Cuo0_i6q.d.mts} +6 -6
- package/dist/{adapter-Bp_4Bjff-CjV5K6YY.d.mts.map → adapter-Bp_4Bjff-Cuo0_i6q.d.mts.map} +1 -1
- package/dist/{adapter-DyfN7eok-DUjF95_9.mjs → adapter-DEhaeqzN-C0ZrfwQ-.mjs} +11 -5
- package/dist/adapter-DEhaeqzN-C0ZrfwQ-.mjs.map +1 -0
- package/dist/adapter-g66WhBm8.d.mts +197 -0
- package/dist/adapter-g66WhBm8.d.mts.map +1 -0
- package/dist/adapter.d.mts +11 -11
- package/dist/adapter.mjs +4 -3
- package/dist/adapter__adapter.d.mts +4 -4
- package/dist/adapter__adapter.mjs +3 -2
- package/dist/adapter__codec-types.d.mts +3 -3
- package/dist/adapter__control.d.mts +2 -2
- package/dist/adapter__control.mjs +4 -4
- 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 +2 -2
- package/dist/adapter__sql-renderer.mjs +1 -1
- package/dist/adapter__types.d.mts +3 -3
- package/dist/aggregates-CR6j7ac7.d.mts +164 -0
- package/dist/aggregates-CR6j7ac7.d.mts.map +1 -0
- package/dist/{aggregates-CATLYJxc.mjs → aggregates-PwypcEux.mjs} +29 -16
- package/dist/aggregates-PwypcEux.mjs.map +1 -0
- package/dist/codec-descriptor-BRAsa6-C-BgEz9r06.d.mts +1 -0
- package/dist/codec-descriptor-C_1o9b8y.d.mts +2 -0
- package/dist/{codec-descriptor-Bux_tjPl-DBQU4lFR.d.mts → codec-descriptor-DRF3mQZS-BfVwEGvo.d.mts} +2 -8
- package/dist/{codec-descriptor-Bux_tjPl-DBQU4lFR.d.mts.map → codec-descriptor-DRF3mQZS-BfVwEGvo.d.mts.map} +1 -1
- package/dist/{codec-descriptor-Bf6MlyeJ-C1PfQ9LO.mjs → codec-descriptor-gH7UB_pk-B_gmTZ17.mjs} +4 -4
- package/dist/codec-descriptor-gH7UB_pk-B_gmTZ17.mjs.map +1 -0
- package/dist/codec-types-Bq0ZnV7f.d.mts +2 -0
- package/dist/codec-types-Cm5wtfyY.d.mts +1 -0
- package/dist/{codec-types-nBSWEx87-B8Jiv6Mm.d.mts → codec-types-RGpo5mg_-DwdllfRp.d.mts} +5 -5
- package/dist/{codec-types-nBSWEx87-B8Jiv6Mm.d.mts.map → codec-types-RGpo5mg_-DwdllfRp.d.mts.map} +1 -1
- package/dist/{codecs-DeFZ_0jC-CgA8KUIS.d.mts → codecs-Bpnc9OO2-3poDEyWO.d.mts} +3 -3
- package/dist/{codecs-DeFZ_0jC-CgA8KUIS.d.mts.map → codecs-Bpnc9OO2-3poDEyWO.d.mts.map} +1 -1
- package/dist/{codecs-ZVRcQFS8.mjs → codecs-C2B4QuOX.mjs} +3 -3
- package/dist/{codecs-ZVRcQFS8.mjs.map → codecs-C2B4QuOX.mjs.map} +1 -1
- package/dist/codecs-DkmHzY5t.d.mts +1 -0
- package/dist/{codecs-BctEWIFt-DgMd3dUl.mjs → codecs-Ea350Hl_-Bgfsxc8G.mjs} +5 -11
- package/dist/codecs-Ea350Hl_-Bgfsxc8G.mjs.map +1 -0
- package/dist/contract-contributions-wweWdXMK-D6CBejlZ.mjs +24 -0
- package/dist/contract-contributions-wweWdXMK-D6CBejlZ.mjs.map +1 -0
- package/dist/{control-CVmnzYUI.mjs → control-CPwTTMNh.mjs} +4 -4
- package/dist/{control-CVmnzYUI.mjs.map → control-CPwTTMNh.mjs.map} +1 -1
- package/dist/{control-CzVFdxZ-.d.mts → control-FYHqV1AN.d.mts} +3 -3
- package/dist/{control-CzVFdxZ-.d.mts.map → control-FYHqV1AN.d.mts.map} +1 -1
- package/dist/descriptor-meta-DrNwC4vO-BHbHnBqu.mjs +26 -0
- package/dist/descriptor-meta-DrNwC4vO-BHbHnBqu.mjs.map +1 -0
- package/dist/{migration-DOkUBr8w.mjs → migration-9FS12QGo.mjs} +2 -2
- package/dist/{migration-DOkUBr8w.mjs.map → migration-9FS12QGo.mjs.map} +1 -1
- package/dist/{op-factory-call-hxIbAMSY-CinxsQHg.mjs → op-factory-call-BP8q3moB-BhWwqgfW.mjs} +3 -3
- package/dist/{op-factory-call-hxIbAMSY-CinxsQHg.mjs.map → op-factory-call-BP8q3moB-BhWwqgfW.mjs.map} +1 -1
- package/dist/{pack-D3pJo5Xh.d.mts → pack-DChRrSsM.d.mts} +2 -2
- package/dist/{pack-D3pJo5Xh.d.mts.map → pack-DChRrSsM.d.mts.map} +1 -1
- package/dist/{planner-BENMBCnG-CW6-1do-.mjs → planner-CHVsFdYX-BXkj8Yt8.mjs} +5 -5
- package/dist/{planner-BENMBCnG-CW6-1do-.mjs.map → planner-CHVsFdYX-BXkj8Yt8.mjs.map} +1 -1
- package/dist/{planner-produced-sqlite-migration-DjEZTiif-DpC6rk_q.mjs → planner-produced-sqlite-migration-DxKNqhIl-DrkwVEyy.mjs} +4 -4
- package/dist/{planner-produced-sqlite-migration-DjEZTiif-DpC6rk_q.mjs.map → planner-produced-sqlite-migration-DxKNqhIl-DrkwVEyy.mjs.map} +1 -1
- package/dist/{render-ops-B889CY71-JvEeW9B4.mjs → render-ops-BxptR4vb-CO94GBBd.mjs} +3 -3
- package/dist/{render-ops-B889CY71-JvEeW9B4.mjs.map → render-ops-BxptR4vb-CO94GBBd.mjs.map} +1 -1
- package/dist/{runtime-612DH-du.d.mts → runtime-zwgkZ8R0.d.mts} +2 -2
- package/dist/{runtime-612DH-du.d.mts.map → runtime-zwgkZ8R0.d.mts.map} +1 -1
- package/dist/sql-renderer-C9GzprOC.d.mts +1 -0
- package/dist/{sqlite-migration-CTNkjYJ1-eRdmsbpK.mjs → sqlite-migration-Dn0aIhV7-B1eALxxb.mjs} +4 -4
- package/dist/{sqlite-migration-CTNkjYJ1-eRdmsbpK.mjs.map → sqlite-migration-Dn0aIhV7-B1eALxxb.mjs.map} +1 -1
- package/dist/target.d.mts +8 -8
- package/dist/target.mjs +11 -11
- package/dist/target__aggregates.d.mts +1 -1
- package/dist/target__aggregates.mjs +1 -1
- package/dist/target__codec-descriptor.d.mts +2 -2
- package/dist/target__codec-descriptor.mjs +1 -1
- package/dist/target__codec-types.d.mts +3 -3
- package/dist/target__codecs.d.mts +2 -2
- package/dist/target__codecs.mjs +2 -2
- package/dist/target__control.mjs +1 -1
- package/dist/target__migration.mjs +2 -2
- package/dist/target__op-factory-call.mjs +1 -1
- package/dist/target__pack.d.mts +1 -1
- package/dist/target__planner-produced-sqlite-migration.mjs +1 -1
- package/dist/target__planner.mjs +1 -1
- package/dist/target__render-ops.mjs +1 -1
- package/dist/types-DMDJ_d9M.d.mts +2 -0
- package/dist/{types-RJMd2PlL-CD7b6qkb.d.mts → types-RJMd2PlL-BpF9DGSQ.d.mts} +3 -3
- package/dist/{types-RJMd2PlL-CD7b6qkb.d.mts.map → types-RJMd2PlL-BpF9DGSQ.d.mts.map} +1 -1
- package/package.json +9 -9
- package/dist/adapter-C1WN74k-.d.mts +0 -2
- package/dist/adapter-DyfN7eok-DUjF95_9.mjs.map +0 -1
- package/dist/aggregates-BGuKJwfI.d.mts +0 -10
- package/dist/aggregates-BGuKJwfI.d.mts.map +0 -1
- package/dist/aggregates-CATLYJxc.mjs.map +0 -1
- package/dist/codec-descriptor-Bf6MlyeJ-C1PfQ9LO.mjs.map +0 -1
- package/dist/codec-descriptor-C-BCHOOC-BGr23_XM.d.mts +0 -1
- package/dist/codec-descriptor-OJw51BEj.d.mts +0 -2
- package/dist/codec-types-6UMpZZ70.d.mts +0 -1
- package/dist/codec-types-FAF08DkX.d.mts +0 -2
- package/dist/codecs-BctEWIFt-DgMd3dUl.mjs.map +0 -1
- package/dist/codecs-xDq4DNf8.d.mts +0 -1
- package/dist/descriptor-meta-CFPBLIHW-CUgnXvu7.mjs +0 -36
- package/dist/descriptor-meta-CFPBLIHW-CUgnXvu7.mjs.map +0 -1
- package/dist/sql-renderer-fyjZG1VX.d.mts +0 -1
- package/dist/types-BwhTlH8P.d.mts +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codecs-Ea350Hl_-Bgfsxc8G.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/codecs-Ea350Hl_.mjs"],"sourcesContent":["import { a as SQLITE_INTEGER_CODEC_ID, c as SQLITE_TEXT_CODEC_ID, i as SQLITE_DATETIME_CODEC_ID, n as SQLITE_BIGINT_NUMBER_CODEC_ID, o as SQLITE_JSON_CODEC_ID, r as SQLITE_BLOB_CODEC_ID, s as SQLITE_REAL_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID } from \"./codec-ids-KMliSCRp.mjs\";\nimport { c as sqliteText, i as sqliteCharacterVarying, n as sqliteCharacter, o as sqliteInteger, s as sqliteReal, t as sqliteBlob } from \"./data-types-pFQMl37_.mjs\";\nimport { a as sqliteCodec, r as defineSqliteCodecs, t as SqliteCodecDescriptor } from \"./codec-descriptor-gH7UB_pk.mjs\";\nimport { n as sqliteError } from \"./errors-DnR-sMHS.mjs\";\nimport { BinaryExpr, CaseExpr, CastExpr, FunctionCallExpr, LiteralExpr, NullCheckExpr, SqlFloatCodec, SqlIntCodec, SqlIntDescriptor, sqlCharDescriptor, sqlFloatDescriptor, sqlVarcharDescriptor } from \"@internal/sql-relational-core/ast\";\nimport { canonicalizeJson } from \"@internal/framework-components/utils\";\nimport { canonicalDateTime } from \"@internal/sql-contract/data-type-support\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { CodecImpl, INT64_RANGE, SAFE_INTEGER_BIGINT_RANGE, column, decodeJsonFloat, decodeJsonIntegerText, decodeJsonMatching, decodeJsonString, encodeJsonFloat, refuseJsonValue } from \"@internal/framework-components/codec\";\nimport { blindCast } from \"@internal/utils/casts\";\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]));\n/**\n* Projects a REAL as SQLite writes it in JSON, except an infinity, which SQLite writes as `9.0e+999` and which becomes the text `Infinity` or `-Infinity` that `encodeJson` writes. The test is equality with an infinity, so text or a blob that a REAL column holds outside a STRICT table passes through unchanged.\n*/\nconst floatJsonProjection = (expression) => CaseExpr.of([{\n\tcondition: BinaryExpr.eq(expression, LiteralExpr.of(Number.POSITIVE_INFINITY)),\n\tvalue: LiteralExpr.of(\"Infinity\")\n}, {\n\tcondition: BinaryExpr.eq(expression, LiteralExpr.of(Number.NEGATIVE_INFINITY)),\n\tvalue: LiteralExpr.of(\"-Infinity\")\n}], 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/** Renders the decimal text `sqlite/bigintnumber@1` carries, whose application type is `number`, as a number literal. */\nconst decimalTextNumberLiteral = (value) => typeof value === \"string\" && DECIMAL_INTEGER.test(value) ? value : void 0;\n/**\n* SQLite stores an infinity but not NaN, which it turns into NULL, so a float codec on SQLite refuses NaN wherever it writes a value: to a parameter, and to the contract.\n*/\nfunction refuseNaN(codecId, value) {\n\tif (Number.isNaN(value)) throw sqliteError(\"RUNTIME.ENCODE_FAILED\", `${codecId} value must be a number other than NaN, which SQLite cannot store`, { meta: {\n\t\tcodecId,\n\t\treceived: \"NaN\"\n\t} });\n\treturn value;\n}\n/** Reads a float's JSON form, which on SQLite has no NaN. */\nfunction decodeJsonFloatWithoutNaN(codecId, json) {\n\tconst value = decodeJsonFloat(codecId, json);\n\tif (Number.isNaN(value)) return refuseJsonValue(codecId, \"a finite number or the text Infinity or -Infinity; SQLite cannot store NaN\", json);\n\treturn value;\n}\n/** `sql/float@1` as SQLite stores it: without NaN. */\nvar SqliteFloatCodec = class extends SqlFloatCodec {\n\tasync encode(value, ctx) {\n\t\treturn super.encode(refuseNaN(this.id, value), ctx);\n\t}\n\tencodeJson(value) {\n\t\treturn super.encodeJson(refuseNaN(this.id, value));\n\t}\n\tdecodeJson(json) {\n\t\treturn decodeJsonFloatWithoutNaN(this.id, json);\n\t}\n};\n/**\n* Requires an application value to be of the JS type the codec reads.\n*\n* A range check reads a value of the wrong type as a value out of range, and\n* reports a number plainly inside the range as outside it — so the type is\n* established first and answered for on its own terms, naming what a caller\n* has to change.\n*/\nconst requireJsType = (codecId, expected, value) => {\n\tif (typeof value === expected) return;\n\tthrow sqliteError(\"RUNTIME.ENCODE_FAILED\", `${codecId} value must be a ${expected}, got ${typeof value} ${String(value)}`, { meta: {\n\t\tcodecId,\n\t\treceived: typeof value\n\t} });\n};\n/**\n* Writes an application value as the decimal text `sqlite/bigint@1` carries as\n* its canonical JSON.\n*\n* A schema-written literal default (`BigInt @default(0)`) arrives here as a\n* `number`, since a number literal is the only integer a schema language\n* writes, and one that is a safe integer names its value exactly. Past that\n* range the literal was rounded before any of this ran, so the value written is\n* not the value meant — which this refuses rather than minting an exact-looking\n* value from it. A non-integral number is refused on the same terms.\n*/\nconst bigintEncodeJson = (codecId, value) => {\n\tif (typeof value !== \"number\") {\n\t\trequireJsType(codecId, \"bigint\", value);\n\t\treturn value.toString();\n\t}\n\tif (!Number.isSafeInteger(value)) throw sqliteError(\"RUNTIME.ENCODE_FAILED\", `${codecId} number literal must be an integer within the safe integer range, got ${String(value)}`, { meta: {\n\t\tcodecId,\n\t\treceived: String(value)\n\t} });\n\treturn BigInt(value).toString();\n};\n/**\n* Requires an integer within ±(2^53 − 1), the range a JS `number` holds\n* exactly. The guard throws rather than rounding: past the boundary a `number`\n* silently loses digits, which is the failure mode these codecs exist to refuse.\n*/\nconst safeIntegerNumber = (codecId, value, code) => {\n\tif (!Number.isSafeInteger(value)) throw sqliteError(code, `${codecId} value must be an integer within the safe integer range, got ${String(value)}`, { meta: {\n\t\tcodecId,\n\t\treceived: String(value)\n\t} });\n\tif (Object.is(value, -0)) return 0;\n\treturn value;\n};\n/** The application value a number-flavoured integer codec writes: the JS type it reads, within the range that type holds exactly. */\nconst encodableSafeInteger = (codecId, value) => {\n\trequireJsType(codecId, \"number\", value);\n\treturn safeIntegerNumber(codecId, value, \"RUNTIME.ENCODE_FAILED\");\n};\n/**\n* Converts an exact `bigint` into a safe-range `number`, comparing before any\n* conversion so an out-of-range value throws rather than rounds.\n*/\nconst safeIntegerFromBigint = (codecId, value) => {\n\tif (value < SAFE_INTEGER_BIGINT_RANGE.min || value > SAFE_INTEGER_BIGINT_RANGE.max) throw sqliteError(\"RUNTIME.DECODE_FAILED\", `${codecId} value must be an integer within the safe integer range, got ${value}`, { meta: {\n\t\tcodecId,\n\t\treceived: value.toString()\n\t} });\n\treturn Number(value);\n};\n/** `sqlite/integer`'s canonical form, read into a `number`: digit text within the safe integer range. */\nconst safeIntegerFromDigitText = (codecId, json) => Number(decodeJsonIntegerText(codecId, json, SAFE_INTEGER_BIGINT_RANGE));\n/** A `number` written as `sqlite/integer`'s canonical form. */\nconst digitTextOfSafeInteger = (codecId, value) => String(encodableSafeInteger(codecId, value));\n/**\n* Projects a `sql/char@1` value without trailing spaces, as its `decode` reads it on a flat read, so an include reads the same value. SQLite does not pad the value; the rule is the family codec's.\n*/\nconst unpaddedCharJsonProjection = (expression) => FunctionCallExpr.of(\"rtrim\", [expression, LiteralExpr.of(\" \")]);\nconst sqliteSqlCharDescriptor = sqliteCodec(sqlCharDescriptor, {\n\tdataType: sqliteCharacter,\n\tjsonProjection: unpaddedCharJsonProjection\n});\nconst sqliteSqlVarcharDescriptor = sqliteCodec(sqlVarcharDescriptor, {\n\tdataType: sqliteCharacterVarying,\n\tjsonProjection: identityJsonProjection\n});\n/** `sql/int@1` as SQLite stores it: its canonical form is `sqlite/integer`'s digit text. */\nvar SqliteSqlIntCodec = class extends SqlIntCodec {\n\tencodeJson(value) {\n\t\treturn digitTextOfSafeInteger(this.id, value);\n\t}\n\tdecodeJson(json) {\n\t\treturn safeIntegerFromDigitText(this.id, json);\n\t}\n};\nvar SqliteSqlIntTemplate = class extends SqlIntDescriptor {\n\tfactory() {\n\t\treturn () => new SqliteSqlIntCodec(this);\n\t}\n};\nconst sqliteSqlIntDescriptor = sqliteCodec(new SqliteSqlIntTemplate(), {\n\tdataType: sqliteInteger,\n\tjsonProjection: decimalTextJsonProjection\n});\nconst sqliteSqlFloatDescriptor = sqliteCodec(sqlFloatDescriptor, {\n\tdataType: sqliteReal,\n\tjsonProjection: floatJsonProjection,\n\tfactory: (descriptor) => () => new SqliteFloatCodec(descriptor)\n});\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 decodeJsonString(SQLITE_TEXT_CODEC_ID, json);\n\t}\n};\nvar SqliteTextDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn expression;\n\t}\n\tdataType = sqliteText.id;\n\tcodecId = SQLITE_TEXT_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"textual\"\n\t];\n\tparamsSchema = void 0;\n\tfactory() {\n\t\treturn () => new SqliteTextCodec(this);\n\t}\n};\nconst sqliteTextDescriptor = new SqliteTextDescriptor();\nconst sqliteTextColumn = () => column(sqliteTextDescriptor.factory(), sqliteTextDescriptor.codecId, void 0);\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 digitTextOfSafeInteger(SQLITE_INTEGER_CODEC_ID, value);\n\t}\n\tdecodeJson(json) {\n\t\treturn safeIntegerFromDigitText(SQLITE_INTEGER_CODEC_ID, json);\n\t}\n};\nvar SqliteIntegerDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn decimalTextJsonProjection(expression);\n\t}\n\tdataType = sqliteInteger.id;\n\tcodecId = SQLITE_INTEGER_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"numeric\"\n\t];\n\tparamsSchema = void 0;\n\tfactory() {\n\t\treturn () => new SqliteIntegerCodec(this);\n\t}\n};\nconst sqliteIntegerDescriptor = new SqliteIntegerDescriptor();\nconst sqliteIntegerColumn = () => column(sqliteIntegerDescriptor.factory(), sqliteIntegerDescriptor.codecId, void 0);\nvar SqliteRealCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn refuseNaN(SQLITE_REAL_CODEC_ID, value);\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn wire;\n\t}\n\tencodeJson(value) {\n\t\treturn encodeJsonFloat(refuseNaN(SQLITE_REAL_CODEC_ID, value));\n\t}\n\tdecodeJson(json) {\n\t\treturn decodeJsonFloatWithoutNaN(SQLITE_REAL_CODEC_ID, json);\n\t}\n};\nvar SqliteRealDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn floatJsonProjection(expression);\n\t}\n\tdataType = sqliteReal.id;\n\tcodecId = SQLITE_REAL_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"numeric\"\n\t];\n\tparamsSchema = void 0;\n\tfactory() {\n\t\treturn () => new SqliteRealCodec(this);\n\t}\n};\nconst sqliteRealDescriptor = new SqliteRealDescriptor();\nconst sqliteRealColumn = () => column(sqliteRealDescriptor.factory(), sqliteRealDescriptor.codecId, void 0);\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\tconst hex = decodeJsonMatching(SQLITE_BLOB_CODEC_ID, json, UPPERCASE_HEX, \"uppercase hexadecimal text\");\n\t\treturn new Uint8Array(Buffer.from(hex, \"hex\"));\n\t}\n};\nvar SqliteBlobDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn hexJsonProjection(expression);\n\t}\n\tdataType = sqliteBlob.id;\n\tcodecId = SQLITE_BLOB_CODEC_ID;\n\ttraits = [\"equality\"];\n\tparamsSchema = void 0;\n\tfactory() {\n\t\treturn () => new SqliteBlobCodec(this);\n\t}\n};\nconst sqliteBlobDescriptor = new SqliteBlobDescriptor();\nconst sqliteBlobColumn = () => column(sqliteBlobDescriptor.factory(), sqliteBlobDescriptor.codecId, void 0);\n/**\n* The canonical form of a `sqlite/datetime@1` value (ADR 254): the instant in UTC, from ISO 8601\n* text with a UTC offset. The range and the millisecond precision are those of a JavaScript `Date`,\n* the codec's value.\n*/\nconst sqliteDatetimeCanonical = (text) => canonicalDateTime(text, {\n\tshape: \"instant\",\n\townerId: SQLITE_DATETIME_CODEC_ID,\n\tmaxFractionDigits: 3,\n\trange: {\n\t\tearliest: \"-271821-04-20T00:00:00Z\",\n\t\tlatest: \"+275760-09-13T00:00:00Z\"\n\t}\n});\n/**\n* Reads the text SQLite holds for an instant. Rejects `Invalid Date` (NaN-time) at every decode\n* ingress so consumers never receive a Date whose downstream operations silently produce NaN.\n*/\nfunction decodeSqliteDatetime(value) {\n\tconst date = new Date(value);\n\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\tcodecId: SQLITE_DATETIME_CODEC_ID,\n\t\treceived: value\n\t} });\n\treturn date;\n}\n/** The text SQLite holds for an instant: what the codec writes for every row, and for a default. */\nfunction encodeSqliteDatetime(value) {\n\treturn value.toISOString();\n}\nvar SqliteDatetimeCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn encodeSqliteDatetime(value);\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn decodeSqliteDatetime(wire);\n\t}\n\tencodeJson(value) {\n\t\treturn sqliteDatetimeCanonical(value.toISOString());\n\t}\n\tdecodeJson(json) {\n\t\tconst date = new Date(decodeJsonString(SQLITE_DATETIME_CODEC_ID, json));\n\t\tif (Number.isNaN(date.getTime())) return refuseJsonValue(SQLITE_DATETIME_CODEC_ID, \"a date and time string\", json);\n\t\treturn date;\n\t}\n};\n/**\n* `sqlite/text` stores this codec's values as text and declares no canonical form for them, so the\n* codec declares it: written text with a UTC offset becomes the instant in UTC.\n*/\nconst datetimeCanonicalForm = (value) => {\n\tif (typeof value === \"string\") return sqliteDatetimeCanonical(value);\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `Expected text, got ${JSON.stringify(value)}.`, {\n\t\twhy: \"A SQLite datetime is stored as text.\",\n\t\tfix: \"Write the date and time as text with a UTC offset, as in \\\"2024-01-01T12:34:56Z\\\".\"\n\t});\n};\nvar SqliteDatetimeDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn expression;\n\t}\n\ttoCanonicalForm = datetimeCanonicalForm;\n\tdataType = sqliteText.id;\n\tcodecId = SQLITE_DATETIME_CODEC_ID;\n\ttraits = [\"equality\", \"order\"];\n\tparamsSchema = void 0;\n\tfactory() {\n\t\treturn () => new SqliteDatetimeCodec(this);\n\t}\n};\nconst sqliteDatetimeDescriptor = new SqliteDatetimeDescriptor();\nconst sqliteDatetimeColumn = () => column(sqliteDatetimeDescriptor.factory(), sqliteDatetimeDescriptor.codecId, void 0);\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\" ? blindCast(JSON.parse(wire)) : wire;\n\t}\n\tencodeJson(value) {\n\t\treturn canonicalizeJson(value);\n\t}\n\tdecodeJson(json) {\n\t\tconst document = typeof json === \"string\" ? parseJsonText$1(json) : void 0;\n\t\tif (document === void 0) throw sqliteError(\"RUNTIME.DECODE_FAILED\", \"sqlite/json@1 contract value must be the JSON text of a document\", { meta: {\n\t\t\tcodecId: SQLITE_JSON_CODEC_ID,\n\t\t\treceived: typeof json\n\t\t} });\n\t\treturn document.value;\n\t}\n};\nfunction parseJsonText$1(text) {\n\ttry {\n\t\treturn { value: JSON.parse(text) };\n\t} catch {\n\t\treturn;\n\t}\n}\n/**\n* `sqlite/text` declares no canonical form, so the codec declares the one of its values: the JSON\n* text of the document, with sorted keys and no added whitespace.\n*/\nconst jsonTextCanonicalForm = (value) => {\n\tconst document = typeof value === \"string\" ? parseJsonText$1(value) : void 0;\n\tif (document === void 0) throw structuredError(\"CONTRACT.CAST_REFUSED\", `Expected the JSON text of a document, got ${JSON.stringify(value)}.`, {\n\t\twhy: \"A SQLite JSON column stores the JSON text of its document.\",\n\t\tfix: \"Write the document as JSON text, as in {\\\"plan\\\": \\\"free\\\"}.\"\n\t});\n\treturn canonicalizeJson(document.value);\n};\n/**\n* The column stores the document's JSON text and the canonical form is that text, so the stored\n* value is projected as it is: a string the enclosing JSON constructor embeds as a string.\n*/\nvar SqliteJsonDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn expression;\n\t}\n\ttoCanonicalForm = jsonTextCanonicalForm;\n\tdataType = sqliteText.id;\n\tcodecId = SQLITE_JSON_CODEC_ID;\n\ttraits = [\"equality\"];\n\tparamsSchema = void 0;\n\tfactory() {\n\t\treturn () => new SqliteJsonCodec(this);\n\t}\n};\nconst sqliteJsonDescriptor = new SqliteJsonDescriptor();\nconst sqliteJsonColumn = () => column(sqliteJsonDescriptor.factory(), sqliteJsonDescriptor.codecId, void 0);\nvar SqliteBigintCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\trequireJsType(SQLITE_BIGINT_CODEC_ID, \"bigint\", value);\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. A number-typed wire value must therefore be a safe\n\t* integer — past ±(2^53 − 1) it has already rounded, and converting it would\n\t* mint a spuriously-exact `bigint` that need not equal the stored value.\n\t*/\n\tasync decode(wire, _ctx) {\n\t\tif (typeof wire === \"number\" && !Number.isSafeInteger(wire)) throw sqliteError(\"RUNTIME.DECODE_FAILED\", `sqlite/bigint@1 wire number must be an integer within the safe integer range, got ${String(wire)}`, { meta: {\n\t\t\tcodecId: SQLITE_BIGINT_CODEC_ID,\n\t\t\treceived: String(wire)\n\t\t} });\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 bigintEncodeJson(SQLITE_BIGINT_CODEC_ID, value);\n\t}\n\tdecodeJson(json) {\n\t\treturn decodeJsonIntegerText(SQLITE_BIGINT_CODEC_ID, json, INT64_RANGE);\n\t}\n};\nvar SqliteBigintDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn decimalTextJsonProjection(expression);\n\t}\n\tdataType = sqliteInteger.id;\n\tcodecId = SQLITE_BIGINT_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"numeric\"\n\t];\n\tparamsSchema = void 0;\n\tfactory() {\n\t\treturn () => new SqliteBigintCodec(this);\n\t}\n};\nconst sqliteBigintDescriptor = new SqliteBigintDescriptor();\nconst sqliteBigintColumn = () => column(sqliteBigintDescriptor.factory(), sqliteBigintDescriptor.codecId, void 0);\n/**\n* A SQLite INTEGER decoded as a JS `number`, for columns whose values stay\n* within the safe integer range ±(2^53 − 1). Both directions guard rather than\n* round: decode (wire and JSON) and encode throw a structured error on\n* out-of-range or non-integral input. The canonical JSON is the decimal text\n* `sqlite/integer` carries, which every codec of that data type shares.\n*/\nvar SqliteBigintNumberCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn encodableSafeInteger(SQLITE_BIGINT_NUMBER_CODEC_ID, value);\n\t}\n\t/**\n\t* The driver hands an INTEGER over as a `number` or, in safe-integer mode, a\n\t* `bigint`; a bigint (or decimal text) is range-checked exactly before any\n\t* conversion to `number`, so an out-of-range value throws rather than rounds.\n\t*/\n\tasync decode(wire, _ctx) {\n\t\tif (typeof wire === \"number\") return safeIntegerNumber(SQLITE_BIGINT_NUMBER_CODEC_ID, wire, \"RUNTIME.DECODE_FAILED\");\n\t\tif (typeof wire === \"string\" && !DECIMAL_INTEGER.test(wire)) throw sqliteError(\"RUNTIME.DECODE_FAILED\", \"sqlite/bigintnumber@1 wire value must be a decimal string\", { meta: {\n\t\t\tcodecId: SQLITE_BIGINT_NUMBER_CODEC_ID,\n\t\t\treceived: wire\n\t\t} });\n\t\treturn safeIntegerFromBigint(SQLITE_BIGINT_NUMBER_CODEC_ID, BigInt(wire));\n\t}\n\tencodeJson(value) {\n\t\treturn digitTextOfSafeInteger(SQLITE_BIGINT_NUMBER_CODEC_ID, value);\n\t}\n\tdecodeJson(json) {\n\t\treturn safeIntegerFromDigitText(SQLITE_BIGINT_NUMBER_CODEC_ID, json);\n\t}\n};\nvar SqliteBigintNumberDescriptor = class extends SqliteCodecDescriptor {\n\tjsonProjection(expression) {\n\t\treturn decimalTextJsonProjection(expression);\n\t}\n\tdataType = sqliteInteger.id;\n\tcodecId = SQLITE_BIGINT_NUMBER_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"numeric\"\n\t];\n\tparamsSchema = void 0;\n\trenderValueLiteral(value) {\n\t\treturn decimalTextNumberLiteral(value);\n\t}\n\tfactory() {\n\t\treturn () => new SqliteBigintNumberCodec(this);\n\t}\n};\nconst sqliteBigintNumberDescriptor = new SqliteBigintNumberDescriptor();\nconst sqliteBigintNumberColumn = () => column(sqliteBigintNumberDescriptor.factory(), sqliteBigintNumberDescriptor.codecId, void 0);\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\tsqliteBigintNumberDescriptor\n]);\n//#endregion\nexport { sqliteBigintColumn as a, sqliteDatetimeColumn as c, sqliteRealColumn as d, sqliteTextColumn as f, jsonDocumentRetag as i, sqliteIntegerColumn as l, decodeSqliteDatetime as n, sqliteBigintNumberColumn as o, encodeSqliteDatetime as r, sqliteBlobColumn as s, codecDescriptors as t, sqliteJsonColumn as u };\n\n//# sourceMappingURL=codecs-Ea350Hl_.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,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;;;;AAI5C,MAAM,uBAAuB,eAAe,SAAS,GAAG,CAAC;CACxD,WAAW,WAAW,GAAG,YAAY,YAAY,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M,iCAAiC,OAAO,6BAA6B,QAAQ,GAAG,6BAA6B,SAAS,KAAK,CAAC;AAClI,MAAM,mBAAmB,mBAAmB;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { t as sqliteAggregateDescriptors } from "./aggregates-PwypcEux.mjs";
|
|
2
|
+
//#region ../../../3-targets/6-adapters/sqlite/dist/contract-contributions-wweWdXMK.mjs
|
|
3
|
+
const sqliteAdapterCapabilities = Object.freeze({ sql: {
|
|
4
|
+
orderBy: true,
|
|
5
|
+
limit: true,
|
|
6
|
+
lateral: false,
|
|
7
|
+
jsonAgg: true,
|
|
8
|
+
returning: true,
|
|
9
|
+
foreignKeys: true,
|
|
10
|
+
enums: false,
|
|
11
|
+
insertOnConflictSkip: true,
|
|
12
|
+
insertOnConflictWithoutTarget: true
|
|
13
|
+
} });
|
|
14
|
+
/**
|
|
15
|
+
* What this adapter adds to every contract it runs: its capabilities and the aggregate overloads it lists. `prisma contract emit` reads them through the adapter's descriptor, and the TypeScript `defineContract` passes them to the contract build.
|
|
16
|
+
*/
|
|
17
|
+
const sqliteAdapterContractContributions = {
|
|
18
|
+
capabilities: sqliteAdapterCapabilities,
|
|
19
|
+
types: { aggregateDescriptors: sqliteAggregateDescriptors }
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { sqliteAdapterContractContributions as n, sqliteAdapterCapabilities as t };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=contract-contributions-wweWdXMK-D6CBejlZ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-contributions-wweWdXMK-D6CBejlZ.mjs","names":[],"sources":["../../../../3-targets/6-adapters/sqlite/dist/contract-contributions-wweWdXMK.mjs"],"sourcesContent":["import { sqliteAggregateDescriptors } from \"@internal/target-sqlite/aggregates\";\n//#region src/core/capabilities.ts\nconst sqliteAdapterCapabilities = Object.freeze({ sql: {\n\torderBy: true,\n\tlimit: true,\n\tlateral: false,\n\tjsonAgg: true,\n\treturning: true,\n\tforeignKeys: true,\n\tenums: false,\n\tinsertOnConflictSkip: true,\n\tinsertOnConflictWithoutTarget: true\n} });\n//#endregion\n//#region src/core/contract-contributions.ts\n/**\n* What this adapter adds to every contract it runs: its capabilities and the aggregate overloads it lists. `prisma contract emit` reads them through the adapter's descriptor, and the TypeScript `defineContract` passes them to the contract build.\n*/\nconst sqliteAdapterContractContributions = {\n\tcapabilities: sqliteAdapterCapabilities,\n\ttypes: { aggregateDescriptors: sqliteAggregateDescriptors }\n};\n//#endregion\nexport { sqliteAdapterCapabilities as n, sqliteAdapterContractContributions as t };\n\n//# sourceMappingURL=contract-contributions-wweWdXMK.mjs.map"],"mappings":";;AAEA,MAAM,4BAA4B,OAAO,OAAO,EAAE,KAAK;CACtD,SAAS;CACT,OAAO;CACP,SAAS;CACT,SAAS;CACT,WAAW;CACX,aAAa;CACb,OAAO;CACP,sBAAsB;CACtB,+BAA+B;AAChC,EAAE,CAAC;;;;AAMH,MAAM,qCAAqC;CAC1C,cAAc;CACd,OAAO,EAAE,sBAAsB,2BAA2B;AAC3D"}
|
|
@@ -2,11 +2,11 @@ import { a as SQLITE_INTEGER_CODEC_ID, c as SQLITE_TEXT_CODEC_ID, i as SQLITE_DA
|
|
|
2
2
|
import { n as sqliteError } from "./errors-DnR-sMHS-KkMLIP2U.mjs";
|
|
3
3
|
import { t as sqliteTargetDescriptorMeta } from "./descriptor-meta-CthMyZ9m-BJfUmecN.mjs";
|
|
4
4
|
import { r as quoteIdentifier } from "./sql-utils-XGT5Esi2-5k9pvJeF.mjs";
|
|
5
|
-
import { f as affinityStorageClasses, g as conversionCopyOf, y as rebuiltTableName } from "./op-factory-call-
|
|
5
|
+
import { f as affinityStorageClasses, g as conversionCopyOf, y as rebuiltTableName } from "./op-factory-call-BP8q3moB-BhWwqgfW.mjs";
|
|
6
6
|
import { r as MARKER_TABLE_NAME } from "./control-tables-D_o8dKRB-BXi43noL.mjs";
|
|
7
7
|
import { t as SqliteContractSerializer } from "./sqlite-contract-view-TELBWEt4-CVsdZnpX.mjs";
|
|
8
|
-
import { b as verifySqliteDatabaseSchema, h as sqliteContractToSchema, o as diffSqliteSchema } from "./sqlite-migration-
|
|
9
|
-
import { n as createSqliteMigrationPlanner } from "./planner-
|
|
8
|
+
import { b as verifySqliteDatabaseSchema, h as sqliteContractToSchema, o as diffSqliteSchema } from "./sqlite-migration-Dn0aIhV7-B1eALxxb.mjs";
|
|
9
|
+
import { n as createSqliteMigrationPlanner } from "./planner-CHVsFdYX-BXkj8Yt8.mjs";
|
|
10
10
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
11
11
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
12
12
|
import { APP_SPACE_ID } from "@prisma/orm-framework/components/control";
|
|
@@ -584,4 +584,4 @@ const sqlitePslTypeConstructors = {
|
|
|
584
584
|
//#endregion
|
|
585
585
|
export { sqlitePslTypeConstructors as n, sqliteControlTargetDescriptor as t };
|
|
586
586
|
|
|
587
|
-
//# sourceMappingURL=control-
|
|
587
|
+
//# sourceMappingURL=control-CPwTTMNh.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-CVmnzYUI.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/control.mjs"],"sourcesContent":["import { a as SQLITE_INTEGER_CODEC_ID, c as SQLITE_TEXT_CODEC_ID, i as SQLITE_DATETIME_CODEC_ID, o as SQLITE_JSON_CODEC_ID, r as SQLITE_BLOB_CODEC_ID, s as SQLITE_REAL_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID } from \"./codec-ids-KMliSCRp.mjs\";\nimport { n as sqliteError } from \"./errors-DnR-sMHS.mjs\";\nimport { t as sqliteTargetDescriptorMeta } from \"./descriptor-meta-CthMyZ9m.mjs\";\nimport { r as quoteIdentifier } from \"./sql-utils-XGT5Esi2.mjs\";\nimport { _ as conversionCopyOf, m as affinityStorageClasses, v as rebuiltTableName } from \"./op-factory-call-hxIbAMSY.mjs\";\nimport { _ as diffSqliteSchema, b as verifySqliteDatabaseSchema, y as sqliteContractToSchema } from \"./sqlite-migration-CTNkjYJ1.mjs\";\nimport { r as MARKER_TABLE_NAME } from \"./control-tables-D_o8dKRB.mjs\";\nimport { n as createSqliteMigrationPlanner } from \"./planner-BENMBCnG.mjs\";\nimport { i as sqliteCreateNamespace, n as SqliteContractSerializer, r as SqliteUnboundDatabase } from \"./sqlite-contract-view-TELBWEt4.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { APP_SPACE_ID } from \"@internal/framework-components/control\";\nimport { convertedColumnOf, fieldOfColumn, requiredColumnsOfMigration, rowsWithoutValueFailure, runnerFailure, runnerSuccess, sqlTypeLookupsOf, unconvertedFieldOf } from \"@internal/family-sql/control\";\nimport { SqlStorage } from \"@internal/sql-contract/types\";\nimport { relationalNodeEntityKind, relationalNodeGranularity } from \"@internal/sql-schema-ir/types\";\nimport { notOk, ok, okVoid } from \"@internal/utils/result\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { SqlSchemaVerifierBase } from \"@internal/family-sql/ir\";\n//#region src/core/migrations/runner.ts\nfunction createSqliteMigrationRunner(family) {\n\treturn new SqliteMigrationRunner(family);\n}\nvar SqliteMigrationRunner = class {\n\tfamily;\n\tconstructor(family) {\n\t\tthis.family = family;\n\t}\n\t/**\n\t* Apply the plan against an already-open connection without managing\n\t* the transaction lifecycle. The caller ({@link SqliteMigrationRunner.execute})\n\t* owns BEGIN/COMMIT/ROLLBACK and any connection-level setup (FK pragma\n\t* toggle, FK integrity check).\n\t*/\n\tasync executeOnConnection(options) {\n\t\tconst driver = options.driver;\n\t\tif (options.space !== void 0 && options.space !== options.plan.spaceId) throw sqliteError(\"MIGRATION.CONTRACT_SPACE_VIOLATION\", `SqlMigrationRunner: options.space (${options.space}) does not match plan.spaceId (${options.plan.spaceId})`, { meta: {\n\t\t\tspace: options.space,\n\t\t\tplanSpaceId: options.plan.spaceId\n\t\t} });\n\t\tconst space = options.plan.spaceId;\n\t\tconst planOps = blindCast(await Promise.all(options.plan.operations));\n\t\tconst destinationCheck = this.ensurePlanMatchesDestinationContract(options.plan.destination, options.destinationContract);\n\t\tif (!destinationCheck.ok) return destinationCheck;\n\t\tconst policyCheck = this.enforcePolicyCompatibility(options.policy, planOps);\n\t\tif (!policyCheck.ok) return policyCheck;\n\t\tconst ensureResult = await this.ensureControlTables(driver, options.destinationContract);\n\t\tif (!ensureResult.ok) return ensureResult;\n\t\tconst existingMarker = await this.family.readMarker({\n\t\t\tdriver,\n\t\t\tspace\n\t\t});\n\t\tconst markerCheck = this.ensureMarkerCompatibility(existingMarker, options.plan);\n\t\tif (!markerCheck.ok) return markerCheck;\n\t\tconst markerAtDestination = this.markerMatchesDestination(existingMarker, options.plan);\n\t\tconst isSelfEdge = options.plan.origin?.storageHash === options.plan.destination.storageHash;\n\t\tconst skipOperations = markerAtDestination && options.plan.origin != null && !isSelfEdge;\n\t\tlet operationsExecuted;\n\t\tlet executedOperations;\n\t\tif (skipOperations) {\n\t\t\toperationsExecuted = 0;\n\t\t\texecutedOperations = [];\n\t\t} else {\n\t\t\tconst applyResult = await this.applyPlan(driver, options, planOps);\n\t\t\tif (!applyResult.ok) return applyResult;\n\t\t\toperationsExecuted = applyResult.value.operationsExecuted;\n\t\t\texecutedOperations = applyResult.value.executedOperations;\n\t\t}\n\t\tif (space === APP_SPACE_ID) {\n\t\t\tconst schemaNode = await this.family.introspect({\n\t\t\t\tdriver,\n\t\t\t\tcontract: options.destinationContract\n\t\t\t});\n\t\t\tconst schemaVerifyResult = verifySqliteDatabaseSchema({\n\t\t\t\tcontract: options.destinationContract,\n\t\t\t\tactualSchema: schemaNode,\n\t\t\t\tstrict: options.strictVerification ?? true,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t\tif (!schemaVerifyResult.ok) return runnerFailure(\"MIGRATION.SCHEMA_VERIFY_FAILED\", schemaVerifyResult.summary, {\n\t\t\t\twhy: \"The resulting database schema does not satisfy the destination contract.\",\n\t\t\t\tmeta: { issues: schemaVerifyResult.schema.issues }\n\t\t\t});\n\t\t}\n\t\tconst incomingInvariants = options.plan.providedInvariants;\n\t\tconst existingInvariants = new Set(existingMarker?.invariants ?? []);\n\t\tconst incomingIsSubsetOfExisting = incomingInvariants.every((id) => existingInvariants.has(id));\n\t\tif (!(isSelfEdge && operationsExecuted === 0 && incomingIsSubsetOfExisting)) {\n\t\t\tconst markerResult = await this.upsertMarker(driver, options, existingMarker, space);\n\t\t\tif (!markerResult.ok) return markerResult;\n\t\t\tawait this.recordLedgerEntries(driver, options, executedOperations);\n\t\t}\n\t\treturn runnerSuccess({\n\t\t\toperationsPlanned: planOps.length,\n\t\t\toperationsExecuted\n\t\t});\n\t}\n\tasync execute(options) {\n\t\tconst driver = options.driver;\n\t\tconst perSpaceOptions = options.perSpaceOptions;\n\t\tif (perSpaceOptions.length === 0) return ok({ perSpaceResults: [] });\n\t\tconst fkWasEnabled = await this.readForeignKeysEnabled(driver);\n\t\tif (fkWasEnabled) await driver.query(\"PRAGMA foreign_keys = OFF\");\n\t\ttry {\n\t\t\tawait this.beginExclusiveTransaction(driver);\n\t\t\tlet committed = false;\n\t\t\ttry {\n\t\t\t\tconst perSpaceResults = [];\n\t\t\t\tlet lastProcessedSpace;\n\t\t\t\tfor (const spaceOptions of perSpaceOptions) {\n\t\t\t\t\tconst space = spaceOptions.space ?? spaceOptions.plan.spaceId;\n\t\t\t\t\tconst result = await this.executeOnConnection({\n\t\t\t\t\t\t...spaceOptions,\n\t\t\t\t\t\tdriver,\n\t\t\t\t\t\tspace\n\t\t\t\t\t});\n\t\t\t\t\tif (!result.ok) return notOk({\n\t\t\t\t\t\t...result.failure,\n\t\t\t\t\t\tfailingSpace: space\n\t\t\t\t\t});\n\t\t\t\t\tperSpaceResults.push({\n\t\t\t\t\t\tspace,\n\t\t\t\t\t\tvalue: result.value\n\t\t\t\t\t});\n\t\t\t\t\tlastProcessedSpace = space;\n\t\t\t\t}\n\t\t\t\tif (fkWasEnabled) {\n\t\t\t\t\tconst fkIntegrityCheck = await this.verifyForeignKeyIntegrity(driver);\n\t\t\t\t\tif (!fkIntegrityCheck.ok) return notOk({\n\t\t\t\t\t\t...fkIntegrityCheck.failure,\n\t\t\t\t\t\tfailingSpace: lastProcessedSpace ?? APP_SPACE_ID\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tawait this.commitTransaction(driver);\n\t\t\t\tcommitted = true;\n\t\t\t\treturn ok({ perSpaceResults });\n\t\t\t} finally {\n\t\t\t\tif (!committed) await this.rollbackTransaction(driver);\n\t\t\t}\n\t\t} finally {\n\t\t\tif (fkWasEnabled) await driver.query(\"PRAGMA foreign_keys = ON\");\n\t\t}\n\t}\n\tasync readForeignKeysEnabled(driver) {\n\t\treturn (await driver.query(\"PRAGMA foreign_keys\")).rows[0]?.foreign_keys === 1;\n\t}\n\tasync verifyForeignKeyIntegrity(driver) {\n\t\tconst result = await driver.query(\"PRAGMA foreign_key_check\");\n\t\tif (result.rows.length === 0) return okVoid();\n\t\treturn runnerFailure(\"MIGRATION.FOREIGN_KEY_VIOLATION\", `Foreign key integrity check failed after migration: ${result.rows.length} violation(s).`, {\n\t\t\twhy: \"PRAGMA foreign_key_check reported violations after applying recreate-table operations.\",\n\t\t\tmeta: { violations: result.rows }\n\t\t});\n\t}\n\tasync applyPlan(driver, options, ops) {\n\t\tconst checks = options.executionChecks;\n\t\tconst runPrechecks = checks?.prechecks !== false;\n\t\tconst runPostchecks = checks?.postchecks !== false;\n\t\tconst runIdempotency = checks?.idempotencyChecks !== false;\n\t\tlet operationsExecuted = 0;\n\t\tconst executedOperations = [];\n\t\tfor (const operation of ops) {\n\t\t\toptions.callbacks?.onOperationStart?.(operation);\n\t\t\ttry {\n\t\t\t\tif (runPostchecks && runIdempotency) {\n\t\t\t\t\tif (await this.expectationsAreSatisfied(driver, operation.postcheck)) {\n\t\t\t\t\t\texecutedOperations.push(this.createSkipRecord(operation));\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (runPrechecks) {\n\t\t\t\t\tconst precheckResult = await this.runExpectationSteps(driver, operation.precheck, operation, \"precheck\");\n\t\t\t\t\tif (!precheckResult.ok) return precheckResult;\n\t\t\t\t}\n\t\t\t\tconst executeResult = await this.runExecuteSteps(driver, operation.execute, operation, {\n\t\t\t\t\tcontract: options.destinationContract,\n\t\t\t\t\toperationIndex: ops.indexOf(operation),\n\t\t\t\t\toperations: ops,\n\t\t\t\t\tedges: options.migrationEdges\n\t\t\t\t});\n\t\t\t\tif (!executeResult.ok) return executeResult;\n\t\t\t\tif (runPostchecks) {\n\t\t\t\t\tconst postcheckResult = await this.runExpectationSteps(driver, operation.postcheck, operation, \"postcheck\", {\n\t\t\t\t\t\tcontract: options.destinationContract,\n\t\t\t\t\t\toperationIndex: ops.indexOf(operation)\n\t\t\t\t\t});\n\t\t\t\t\tif (!postcheckResult.ok) return postcheckResult;\n\t\t\t\t}\n\t\t\t\texecutedOperations.push(operation);\n\t\t\t\toperationsExecuted += 1;\n\t\t\t} finally {\n\t\t\t\toptions.callbacks?.onOperationComplete?.(operation);\n\t\t\t}\n\t\t}\n\t\treturn ok({\n\t\t\toperationsExecuted,\n\t\t\texecutedOperations\n\t\t});\n\t}\n\tasync ensureControlTables(driver, contract) {\n\t\tconst legacyDetection = await this.detectLegacyMarkerShape(driver);\n\t\tif (!legacyDetection.ok) return legacyDetection;\n\t\tconst lowererContext = { contract };\n\t\tfor (const query of this.family.bootstrapControlTableQueries()) await this.executeStatement(driver, await this.family.lowerAst(query, lowererContext));\n\t\treturn okVoid();\n\t}\n\tasync detectLegacyMarkerShape(driver) {\n\t\tconst tableInfo = await driver.query(`PRAGMA table_info(${quoteIdentifier(MARKER_TABLE_NAME)})`);\n\t\tif (tableInfo.rows.length === 0) return okVoid();\n\t\tconst columns = new Set(tableInfo.rows.map((row) => row.name));\n\t\tif (columns.has(\"space\")) return okVoid();\n\t\treturn runnerFailure(\"MIGRATION.LEGACY_MARKER_SHAPE\", `Legacy marker-table shape detected on ${MARKER_TABLE_NAME} (no \\`space\\` column). Prisma 8 is in pre-1.0; the previous transitional auto-migration to the per-space-row schema has been removed. Drop \\`${MARKER_TABLE_NAME}\\` and re-run \\`dbInit\\` to reinitialise from a clean baseline.`, { meta: {\n\t\t\ttable: MARKER_TABLE_NAME,\n\t\t\tcolumns: [...columns].sort()\n\t\t} });\n\t}\n\tasync runExpectationSteps(driver, steps, operation, phase, plan) {\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) {\n\t\t\t\tconst code = phase === \"precheck\" ? \"MIGRATION.PRECHECK_FAILED\" : \"MIGRATION.POSTCHECK_FAILED\";\n\t\t\t\tconst field = plan === void 0 ? void 0 : unconvertedFieldOf(step, plan.contract);\n\t\t\t\tconst converted = convertedColumnOf(step);\n\t\t\t\treturn runnerFailure(code, `Operation ${operation.id} failed during ${phase}: ${step.description}`, {\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\t\tphase,\n\t\t\t\t\t\tstepDescription: step.description\n\t\t\t\t\t},\n\t\t\t\t\t...ifDefined(\"why\", converted === void 0 ? void 0 : await this.unconvertedValueText(driver, converted)),\n\t\t\t\t\t...ifDefined(\"failedTypeChange\", field === void 0 || plan === void 0 || converted === void 0 ? void 0 : converted.by === \"conversion\" ? {\n\t\t\t\t\t\tfield,\n\t\t\t\t\t\tby: \"conversion\",\n\t\t\t\t\t\treason: \"invalidResult\",\n\t\t\t\t\t\toperationIndex: plan.operationIndex\n\t\t\t\t\t} : {\n\t\t\t\t\t\tfield,\n\t\t\t\t\t\tby: \"cast\",\n\t\t\t\t\t\treason: \"value\",\n\t\t\t\t\t\toperationIndex: plan.operationIndex\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn okVoid();\n\t}\n\t/** Names the first value of a retyped column that kept a storage class its new type does not hold. */\n\tasync unconvertedValueText(driver, cast) {\n\t\tconst typeSql = (await driver.query(\"SELECT type FROM pragma_table_info(?) WHERE name = ?\", [cast.table, cast.column])).rows[0]?.type;\n\t\tif (typeSql === void 0) return void 0;\n\t\tconst column = quoteIdentifier(cast.column);\n\t\tconst classes = [\"null\", ...affinityStorageClasses(typeSql)];\n\t\tconst row = (await driver.query(`SELECT quote(${column}) AS value, typeof(${column}) AS storageClass FROM ${quoteIdentifier(cast.table)} WHERE typeof(${column}) NOT IN (${classes.map(() => \"?\").join(\", \")}) LIMIT 1`, classes)).rows[0];\n\t\tif (row === void 0) return void 0;\n\t\treturn `The value ${row.value.length > 40 ? `${row.value.slice(0, 40)}…` : row.value} of column \"${cast.column}\" on \"${cast.table}\" is still stored as ${row.storageClass}, which ${typeSql} cannot hold.`;\n\t}\n\tasync runExecuteSteps(driver, steps, operation, plan) {\n\t\tfor (const step of steps) try {\n\t\t\tawait driver.query(step.sql, step.params ?? []);\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\tconst failed = `Operation ${operation.id} failed during execution: ${step.description}`;\n\t\t\tconst rowsWithoutValue = await this.rowsWithoutValue(driver, message, plan);\n\t\t\tconst failedConversion = rowsWithoutValue === void 0 ? await this.failedConversion(driver, step, message, plan) : void 0;\n\t\t\treturn runnerFailure(\"MIGRATION.EXECUTION_FAILED\", rowsWithoutValue?.summary ?? failed, {\n\t\t\t\twhy: rowsWithoutValue === void 0 ? message : `${failed}: ${message}`,\n\t\t\t\tmeta: {\n\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\tstepDescription: step.description,\n\t\t\t\t\tsql: step.sql\n\t\t\t\t},\n\t\t\t\trowsWithoutValue: rowsWithoutValue?.reports,\n\t\t\t\tfailedTypeChange: failedConversion\n\t\t\t});\n\t\t}\n\t\treturn okVoid();\n\t}\n\t/**\n\t* The conversion that failed, when the failed step is the copy of a rebuild that converts columns\n\t* and there is evidence for it: a copy expression that fails on its own has an error in its\n\t* expression, and a constraint of the new table that names a converted column was broken by a\n\t* value the conversion produced. Any other failure of the copy is not the conversion's.\n\t*/\n\tasync failedConversion(driver, step, message, plan) {\n\t\tconst copy = conversionCopyOf(step);\n\t\tif (copy === void 0) return void 0;\n\t\tconst columns = Object.keys(copy.expressions);\n\t\tconst failed = async (column) => {\n\t\t\ttry {\n\t\t\t\tawait driver.query(`SELECT ${copy.expressions[column]} FROM ${quoteIdentifier(copy.table)}`);\n\t\t\t\treturn false;\n\t\t\t} catch {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t};\n\t\tfor (const column of columns) if (await failed(column)) return this.conversionOf(plan, copy.table, column, \"expressionError\");\n\t\tconst [, constrainedList] = message.split(\"constraint failed: \");\n\t\tif (constrainedList === void 0) return void 0;\n\t\tconst constrained = new Set(constrainedList.split(\", \"));\n\t\tconst column = columns.find((name) => constrained.has(`${rebuiltTableName(copy.table)}.${name}`));\n\t\treturn column === void 0 ? void 0 : this.conversionOf(plan, copy.table, column, \"invalidResult\");\n\t}\n\tconversionOf(plan, table, column, reason) {\n\t\tconst field = fieldOfColumn(plan.contract, table, column);\n\t\treturn field === void 0 ? void 0 : {\n\t\t\tfield,\n\t\t\tby: \"conversion\",\n\t\t\treason,\n\t\t\toperationIndex: plan.operationIndex\n\t\t};\n\t}\n\t/**\n\t* The rows a table rebuild found no value for, when its copy failed on a NOT NULL column of the\n\t* new table: the columns the rebuild's postchecks mark as becoming required are counted, the\n\t* rebuild's own first, then those of every other operation of its migration.\n\t*/\n\trowsWithoutValue(driver, message, plan) {\n\t\tif (!message.includes(\"NOT NULL constraint failed\")) return Promise.resolve(void 0);\n\t\tconst marks = requiredColumnsOfMigration(plan.operations, plan.edges, plan.operationIndex);\n\t\treturn rowsWithoutValueFailure({\n\t\t\tfailed: marks.filter((mark) => mark.operationIndex === plan.operationIndex),\n\t\t\tothers: marks,\n\t\t\tcount: async ({ required }) => {\n\t\t\t\tconst where = required.reason !== \"newField\" ? ` WHERE ${quoteIdentifier(required.column)} IS NULL` : \"\";\n\t\t\t\treturn (await driver.query(`SELECT COUNT(*) AS rows FROM ${quoteIdentifier(required.table)}${where}`)).rows[0]?.rows ?? 0;\n\t\t\t},\n\t\t\tcontract: plan.contract\n\t\t});\n\t}\n\tstepResultIsTrue(rows) {\n\t\tif (!rows || rows.length === 0) return false;\n\t\tconst firstRow = rows[0];\n\t\tconst firstValue = firstRow ? Object.values(firstRow)[0] : void 0;\n\t\tif (typeof firstValue === \"number\") return firstValue !== 0;\n\t\tif (typeof firstValue === \"boolean\") return firstValue;\n\t\tif (typeof firstValue === \"string\") {\n\t\t\tconst lower = firstValue.toLowerCase();\n\t\t\tif (lower === \"true\" || lower === \"1\") return true;\n\t\t\tif (lower === \"false\" || lower === \"0\") return false;\n\t\t\treturn firstValue.length > 0;\n\t\t}\n\t\treturn Boolean(firstValue);\n\t}\n\tasync expectationsAreSatisfied(driver, steps) {\n\t\tif (steps.length === 0) return false;\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tcreateSkipRecord(operation) {\n\t\treturn Object.freeze({\n\t\t\tid: operation.id,\n\t\t\tlabel: operation.label,\n\t\t\t...ifDefined(\"summary\", operation.summary),\n\t\t\toperationClass: operation.operationClass,\n\t\t\ttarget: operation.target,\n\t\t\tprecheck: Object.freeze([]),\n\t\t\texecute: Object.freeze([]),\n\t\t\tpostcheck: Object.freeze([...operation.postcheck]),\n\t\t\tmeta: Object.freeze({\n\t\t\t\t...operation.meta ?? {},\n\t\t\t\trunner: Object.freeze({\n\t\t\t\t\tskipped: true,\n\t\t\t\t\treason: \"postcheck_pre_satisfied\"\n\t\t\t\t})\n\t\t\t})\n\t\t});\n\t}\n\tmarkerMatchesDestination(marker, plan) {\n\t\tif (!marker) return false;\n\t\tif (marker.storageHash !== plan.destination.storageHash) return false;\n\t\tif (plan.destination.profileHash && marker.profileHash !== plan.destination.profileHash) return false;\n\t\treturn true;\n\t}\n\tenforcePolicyCompatibility(policy, operations) {\n\t\tconst allowedClasses = new Set(policy.allowedOperationClasses);\n\t\tfor (const operation of operations) if (!allowedClasses.has(operation.operationClass)) return runnerFailure(\"MIGRATION.POLICY_VIOLATION\", `Operation ${operation.id} has class \"${operation.operationClass}\" which is not allowed by policy.`, {\n\t\t\twhy: `Policy only allows: ${policy.allowedOperationClasses.join(\", \")}.`,\n\t\t\tmeta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\toperationClass: operation.operationClass,\n\t\t\t\tallowedClasses: policy.allowedOperationClasses\n\t\t\t}\n\t\t});\n\t\treturn okVoid();\n\t}\n\tensureMarkerCompatibility(marker, plan) {\n\t\tconst origin = plan.origin ?? null;\n\t\tif (!origin) return okVoid();\n\t\tif (!marker) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Missing contract marker: expected origin storage hash ${origin.storageHash}.`, { meta: { expectedOriginStorageHash: origin.storageHash } });\n\t\tif (marker.storageHash !== origin.storageHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`, { meta: {\n\t\t\tmarkerStorageHash: marker.storageHash,\n\t\t\texpectedOriginStorageHash: origin.storageHash\n\t\t} });\n\t\tif (origin.profileHash && marker.profileHash !== origin.profileHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker profile hash (${marker.profileHash}) does not match plan origin profile hash (${origin.profileHash}).`, { meta: {\n\t\t\tmarkerProfileHash: marker.profileHash,\n\t\t\texpectedOriginProfileHash: origin.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tensurePlanMatchesDestinationContract(destination, contract) {\n\t\tif (destination.storageHash !== contract.storage.storageHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination storage hash (${destination.storageHash}) does not match provided contract storage hash (${contract.storage.storageHash}).`, { meta: {\n\t\t\tplanStorageHash: destination.storageHash,\n\t\t\tcontractStorageHash: contract.storage.storageHash\n\t\t} });\n\t\tif (destination.profileHash && contract.profileHash && destination.profileHash !== contract.profileHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination profile hash (${destination.profileHash}) does not match provided contract profile hash (${contract.profileHash}).`, { meta: {\n\t\t\tplanProfileHash: destination.profileHash,\n\t\t\tcontractProfileHash: contract.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tasync upsertMarker(driver, options, existingMarker, space) {\n\t\tconst destination = {\n\t\t\tstorageHash: options.plan.destination.storageHash,\n\t\t\tprofileHash: options.plan.destination.profileHash ?? options.destinationContract.profileHash ?? options.plan.destination.storageHash,\n\t\t\tinvariants: options.plan.providedInvariants ?? []\n\t\t};\n\t\tif (!existingMarker) {\n\t\t\tawait this.family.initMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tdestination\n\t\t\t});\n\t\t\treturn okVoid();\n\t\t}\n\t\tif (!await this.family.updateMarker({\n\t\t\tdriver,\n\t\t\tspace,\n\t\t\texpectedFrom: existingMarker.storageHash,\n\t\t\tdestination\n\t\t})) {\n\t\t\tconst found = await this.family.readMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace\n\t\t\t});\n\t\t\treturn runnerFailure(\"MIGRATION.MARKER_CAS_FAILURE\", \"Marker was modified by another process during migration execution.\", { meta: {\n\t\t\t\tspace,\n\t\t\t\texpectedStorageHash: existingMarker.storageHash,\n\t\t\t\tfoundStorageHash: found?.storageHash ?? null,\n\t\t\t\tdestinationStorageHash: options.plan.destination.storageHash\n\t\t\t} });\n\t\t}\n\t\treturn okVoid();\n\t}\n\tasync recordLedgerEntries(driver, options, executedOperations) {\n\t\tconst plan = options.plan;\n\t\tconst space = plan.spaceId;\n\t\tconst edges = options.migrationEdges;\n\t\tconst totalEdgeOps = edges.reduce((sum, edge) => sum + edge.operationCount, 0);\n\t\tif (totalEdgeOps !== plan.operations.length) throw new InternalError(`Ledger write: plan.operations length (${plan.operations.length}) does not match sum of migrationEdges operationCount (${totalEdgeOps})`);\n\t\tlet offset = 0;\n\t\tfor (const edge of edges) {\n\t\t\tconst edgeOps = executedOperations.slice(offset, offset + edge.operationCount);\n\t\t\toffset += edge.operationCount;\n\t\t\tawait this.family.writeLedgerEntry({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tentry: {\n\t\t\t\t\tedgeId: `${edge.from}->${edge.to}`,\n\t\t\t\t\tfrom: edge.from,\n\t\t\t\t\tto: edge.to,\n\t\t\t\t\tmigrationName: edge.dirName,\n\t\t\t\t\tmigrationHash: edge.migrationHash,\n\t\t\t\t\toperations: edgeOps\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\tasync beginExclusiveTransaction(driver) {\n\t\tawait driver.query(\"BEGIN EXCLUSIVE\");\n\t}\n\tasync commitTransaction(driver) {\n\t\tawait driver.query(\"COMMIT\");\n\t}\n\tasync rollbackTransaction(driver) {\n\t\tawait driver.query(\"ROLLBACK\");\n\t}\n\tasync executeStatement(driver, statement) {\n\t\tawait driver.query(statement.sql, statement.params);\n\t}\n};\n//#endregion\n//#region src/core/sqlite-schema-verifier.ts\n/**\n* SQLite target `SchemaVerifier` concretion. Mirrors the Postgres\n* shape: hooks return the empty list pending the call-site migration\n* that routes the existing verifier behaviour through the SPI.\n*/\nvar SqliteSchemaVerifier = class extends SqlSchemaVerifierBase {\n\tverifyCommonSqlSchema(_options) {\n\t\treturn [];\n\t}\n\tverifyTargetExtensions(_options) {\n\t\treturn [];\n\t}\n};\n//#endregion\n//#region src/core/control-target.ts\nfunction isSqlContract(contract) {\n\treturn contract === null || contract.storage instanceof SqlStorage;\n}\nconst sqliteControlTargetDescriptor = {\n\t...sqliteTargetDescriptorMeta,\n\tcontractSerializer: new SqliteContractSerializer(),\n\tschemaVerifier: new SqliteSchemaVerifier(),\n\tdiffSchema(input) {\n\t\treturn diffSqliteSchema(input);\n\t},\n\tclassifySubjectGranularity: relationalNodeGranularity,\n\tclassifyEntityKind: relationalNodeEntityKind,\n\tmigrations: {\n\t\tcreatePlanner(adapter) {\n\t\t\treturn createSqliteMigrationPlanner(adapter);\n\t\t},\n\t\tcreateRunner(family) {\n\t\t\treturn createSqliteMigrationRunner(family);\n\t\t},\n\t\tcontractToSchema(contract, frameworkComponents) {\n\t\t\tif (!isSqlContract(contract)) throw sqliteError(\"CONTRACT.TARGET_MISMATCH\", \"sqliteControlTargetDescriptor.contractToSchema received a non-SQL contract; expected Contract<SqlStorage>\");\n\t\t\treturn sqliteContractToSchema(contract, sqlTypeLookupsOf(frameworkComponents));\n\t\t}\n\t},\n\tcreate() {\n\t\treturn {\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: \"sqlite\"\n\t\t};\n\t},\n\tcreatePlanner(adapter) {\n\t\treturn createSqliteMigrationPlanner(adapter);\n\t},\n\tcreateRunner(family) {\n\t\treturn createSqliteMigrationRunner(family);\n\t}\n};\n//#endregion\n//#region src/core/type-constructors.ts\n/**\n* The base PSL scalars as zero-arg type constructors in the unified authoring\n* channel. Each names a codec; the column's database type is its data type's.\n*\n* The type position is the only storage decider: a mutation-default generator\n* (`@default(uuid())`) never re-picks a column's storage.\n*\n* These are the constructors only PSL offers. They are defined here, next to the codecs they name, but the adapter contributes them: the TypeScript contract builder builds its `type.*` helpers from the target, so a target contribution would add `type.String()` and the like there. The constructors that should also be `type.*` helpers are the target's own (`sqliteAuthoringTypes`).\n*/\nconst sqlitePslTypeConstructors = {\n\tString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Variable-length text stored as SQLite text.\",\n\t\toutput: { codecId: SQLITE_TEXT_CODEC_ID }\n\t},\n\tInt: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An integer stored as SQLite integer and represented as a JavaScript number.\",\n\t\toutput: { codecId: SQLITE_INTEGER_CODEC_ID }\n\t},\n\tBigInt: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An integer stored as SQLite integer and represented as a JavaScript bigint.\",\n\t\toutput: { codecId: SQLITE_BIGINT_CODEC_ID }\n\t},\n\tFloat: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A floating-point number stored as SQLite real.\",\n\t\toutput: { codecId: SQLITE_REAL_CODEC_ID }\n\t},\n\tDecimal: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A decimal value stored and represented as text to preserve precision.\",\n\t\toutput: { codecId: SQLITE_TEXT_CODEC_ID }\n\t},\n\tDateTime: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A date and time stored as SQLite text.\",\n\t\toutput: { codecId: SQLITE_DATETIME_CODEC_ID }\n\t},\n\tJson: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A JSON value serialized to SQLite text.\",\n\t\toutput: { codecId: SQLITE_JSON_CODEC_ID }\n\t},\n\tBytes: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Binary data stored as a SQLite blob.\",\n\t\toutput: { codecId: SQLITE_BLOB_CODEC_ID }\n\t}\n};\n//#endregion\nexport { SqliteUnboundDatabase, sqliteControlTargetDescriptor as default, sqliteCreateNamespace, sqlitePslTypeConstructors };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,SAAS,4BAA4B,QAAQ;CAC5C,OAAO,IAAI,sBAAsB,MAAM;AACxC;AACA,IAAI,wBAAwB,MAAM;CACjC;CACA,YAAY,QAAQ;EACnB,KAAK,SAAS;CACf;;;;;;;CAOA,MAAM,oBAAoB,SAAS;EAClC,MAAM,SAAS,QAAQ;EACvB,IAAI,QAAQ,UAAU,KAAK,KAAK,QAAQ,UAAU,QAAQ,KAAK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WAAW,OAAO;EACjB,OAAO,iBAAiB,KAAK;CAC9B;CACA,4BAA4B;CAC5B,oBAAoB;CACpB,YAAY;EACX,cAAc,SAAS;GACtB,OAAO,6BAA6B,OAAO;EAC5C;EACA,aAAa,QAAQ;GACpB,OAAO,4BAA4B,MAAM;EAC1C;EACA,iBAAiB,UAAU,qBAAqB;GAC/C,IAAI,CAAC,cAAc,QAAQ,GAAG,MAAM,YAAY,4BAA4B,2GAA2G;GACvL,OAAO,uBAAuB,UAAU,iBAAiB,mBAAmB,CAAC;EAC9E;CACD;CACA,SAAS;EACR,OAAO;GACN,UAAU;GACV,UAAU;EACX;CACD;CACA,cAAc,SAAS;EACtB,OAAO,6BAA6B,OAAO;CAC5C;CACA,aAAa,QAAQ;EACpB,OAAO,4BAA4B,MAAM;CAC1C;AACD;;;;;;;;;;AAYA,MAAM,4BAA4B;CACjC,QAAQ;EACP,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,qBAAqB;CACzC;CACA,KAAK;EACJ,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,wBAAwB;CAC5C;CACA,QAAQ;EACP,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,uBAAuB;CAC3C;CACA,OAAO;EACN,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,qBAAqB;CACzC;CACA,SAAS;EACR,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,qBAAqB;CACzC;CACA,UAAU;EACT,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,yBAAyB;CAC7C;CACA,MAAM;EACL,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,qBAAqB;CACzC;CACA,OAAO;EACN,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,qBAAqB;CACzC;AACD"}
|
|
1
|
+
{"version":3,"file":"control-CPwTTMNh.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/control.mjs"],"sourcesContent":["import { a as SQLITE_INTEGER_CODEC_ID, c as SQLITE_TEXT_CODEC_ID, i as SQLITE_DATETIME_CODEC_ID, o as SQLITE_JSON_CODEC_ID, r as SQLITE_BLOB_CODEC_ID, s as SQLITE_REAL_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID } from \"./codec-ids-KMliSCRp.mjs\";\nimport { n as sqliteError } from \"./errors-DnR-sMHS.mjs\";\nimport { t as sqliteTargetDescriptorMeta } from \"./descriptor-meta-CthMyZ9m.mjs\";\nimport { r as quoteIdentifier } from \"./sql-utils-XGT5Esi2.mjs\";\nimport { _ as conversionCopyOf, m as affinityStorageClasses, v as rebuiltTableName } from \"./op-factory-call-BP8q3moB.mjs\";\nimport { _ as diffSqliteSchema, b as verifySqliteDatabaseSchema, y as sqliteContractToSchema } from \"./sqlite-migration-Dn0aIhV7.mjs\";\nimport { r as MARKER_TABLE_NAME } from \"./control-tables-D_o8dKRB.mjs\";\nimport { n as createSqliteMigrationPlanner } from \"./planner-CHVsFdYX.mjs\";\nimport { i as sqliteCreateNamespace, n as SqliteContractSerializer, r as SqliteUnboundDatabase } from \"./sqlite-contract-view-TELBWEt4.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { APP_SPACE_ID } from \"@internal/framework-components/control\";\nimport { convertedColumnOf, fieldOfColumn, requiredColumnsOfMigration, rowsWithoutValueFailure, runnerFailure, runnerSuccess, sqlTypeLookupsOf, unconvertedFieldOf } from \"@internal/family-sql/control\";\nimport { SqlStorage } from \"@internal/sql-contract/types\";\nimport { relationalNodeEntityKind, relationalNodeGranularity } from \"@internal/sql-schema-ir/types\";\nimport { notOk, ok, okVoid } from \"@internal/utils/result\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { SqlSchemaVerifierBase } from \"@internal/family-sql/ir\";\n//#region src/core/migrations/runner.ts\nfunction createSqliteMigrationRunner(family) {\n\treturn new SqliteMigrationRunner(family);\n}\nvar SqliteMigrationRunner = class {\n\tfamily;\n\tconstructor(family) {\n\t\tthis.family = family;\n\t}\n\t/**\n\t* Apply the plan against an already-open connection without managing\n\t* the transaction lifecycle. The caller ({@link SqliteMigrationRunner.execute})\n\t* owns BEGIN/COMMIT/ROLLBACK and any connection-level setup (FK pragma\n\t* toggle, FK integrity check).\n\t*/\n\tasync executeOnConnection(options) {\n\t\tconst driver = options.driver;\n\t\tif (options.space !== void 0 && options.space !== options.plan.spaceId) throw sqliteError(\"MIGRATION.CONTRACT_SPACE_VIOLATION\", `SqlMigrationRunner: options.space (${options.space}) does not match plan.spaceId (${options.plan.spaceId})`, { meta: {\n\t\t\tspace: options.space,\n\t\t\tplanSpaceId: options.plan.spaceId\n\t\t} });\n\t\tconst space = options.plan.spaceId;\n\t\tconst planOps = blindCast(await Promise.all(options.plan.operations));\n\t\tconst destinationCheck = this.ensurePlanMatchesDestinationContract(options.plan.destination, options.destinationContract);\n\t\tif (!destinationCheck.ok) return destinationCheck;\n\t\tconst policyCheck = this.enforcePolicyCompatibility(options.policy, planOps);\n\t\tif (!policyCheck.ok) return policyCheck;\n\t\tconst ensureResult = await this.ensureControlTables(driver, options.destinationContract);\n\t\tif (!ensureResult.ok) return ensureResult;\n\t\tconst existingMarker = await this.family.readMarker({\n\t\t\tdriver,\n\t\t\tspace\n\t\t});\n\t\tconst markerCheck = this.ensureMarkerCompatibility(existingMarker, options.plan);\n\t\tif (!markerCheck.ok) return markerCheck;\n\t\tconst markerAtDestination = this.markerMatchesDestination(existingMarker, options.plan);\n\t\tconst isSelfEdge = options.plan.origin?.storageHash === options.plan.destination.storageHash;\n\t\tconst skipOperations = markerAtDestination && options.plan.origin != null && !isSelfEdge;\n\t\tlet operationsExecuted;\n\t\tlet executedOperations;\n\t\tif (skipOperations) {\n\t\t\toperationsExecuted = 0;\n\t\t\texecutedOperations = [];\n\t\t} else {\n\t\t\tconst applyResult = await this.applyPlan(driver, options, planOps);\n\t\t\tif (!applyResult.ok) return applyResult;\n\t\t\toperationsExecuted = applyResult.value.operationsExecuted;\n\t\t\texecutedOperations = applyResult.value.executedOperations;\n\t\t}\n\t\tif (space === APP_SPACE_ID) {\n\t\t\tconst schemaNode = await this.family.introspect({\n\t\t\t\tdriver,\n\t\t\t\tcontract: options.destinationContract\n\t\t\t});\n\t\t\tconst schemaVerifyResult = verifySqliteDatabaseSchema({\n\t\t\t\tcontract: options.destinationContract,\n\t\t\t\tactualSchema: schemaNode,\n\t\t\t\tstrict: options.strictVerification ?? true,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t\tif (!schemaVerifyResult.ok) return runnerFailure(\"MIGRATION.SCHEMA_VERIFY_FAILED\", schemaVerifyResult.summary, {\n\t\t\t\twhy: \"The resulting database schema does not satisfy the destination contract.\",\n\t\t\t\tmeta: { issues: schemaVerifyResult.schema.issues }\n\t\t\t});\n\t\t}\n\t\tconst incomingInvariants = options.plan.providedInvariants;\n\t\tconst existingInvariants = new Set(existingMarker?.invariants ?? []);\n\t\tconst incomingIsSubsetOfExisting = incomingInvariants.every((id) => existingInvariants.has(id));\n\t\tif (!(isSelfEdge && operationsExecuted === 0 && incomingIsSubsetOfExisting)) {\n\t\t\tconst markerResult = await this.upsertMarker(driver, options, existingMarker, space);\n\t\t\tif (!markerResult.ok) return markerResult;\n\t\t\tawait this.recordLedgerEntries(driver, options, executedOperations);\n\t\t}\n\t\treturn runnerSuccess({\n\t\t\toperationsPlanned: planOps.length,\n\t\t\toperationsExecuted\n\t\t});\n\t}\n\tasync execute(options) {\n\t\tconst driver = options.driver;\n\t\tconst perSpaceOptions = options.perSpaceOptions;\n\t\tif (perSpaceOptions.length === 0) return ok({ perSpaceResults: [] });\n\t\tconst fkWasEnabled = await this.readForeignKeysEnabled(driver);\n\t\tif (fkWasEnabled) await driver.query(\"PRAGMA foreign_keys = OFF\");\n\t\ttry {\n\t\t\tawait this.beginExclusiveTransaction(driver);\n\t\t\tlet committed = false;\n\t\t\ttry {\n\t\t\t\tconst perSpaceResults = [];\n\t\t\t\tlet lastProcessedSpace;\n\t\t\t\tfor (const spaceOptions of perSpaceOptions) {\n\t\t\t\t\tconst space = spaceOptions.space ?? spaceOptions.plan.spaceId;\n\t\t\t\t\tconst result = await this.executeOnConnection({\n\t\t\t\t\t\t...spaceOptions,\n\t\t\t\t\t\tdriver,\n\t\t\t\t\t\tspace\n\t\t\t\t\t});\n\t\t\t\t\tif (!result.ok) return notOk({\n\t\t\t\t\t\t...result.failure,\n\t\t\t\t\t\tfailingSpace: space\n\t\t\t\t\t});\n\t\t\t\t\tperSpaceResults.push({\n\t\t\t\t\t\tspace,\n\t\t\t\t\t\tvalue: result.value\n\t\t\t\t\t});\n\t\t\t\t\tlastProcessedSpace = space;\n\t\t\t\t}\n\t\t\t\tif (fkWasEnabled) {\n\t\t\t\t\tconst fkIntegrityCheck = await this.verifyForeignKeyIntegrity(driver);\n\t\t\t\t\tif (!fkIntegrityCheck.ok) return notOk({\n\t\t\t\t\t\t...fkIntegrityCheck.failure,\n\t\t\t\t\t\tfailingSpace: lastProcessedSpace ?? APP_SPACE_ID\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tawait this.commitTransaction(driver);\n\t\t\t\tcommitted = true;\n\t\t\t\treturn ok({ perSpaceResults });\n\t\t\t} finally {\n\t\t\t\tif (!committed) await this.rollbackTransaction(driver);\n\t\t\t}\n\t\t} finally {\n\t\t\tif (fkWasEnabled) await driver.query(\"PRAGMA foreign_keys = ON\");\n\t\t}\n\t}\n\tasync readForeignKeysEnabled(driver) {\n\t\treturn (await driver.query(\"PRAGMA foreign_keys\")).rows[0]?.foreign_keys === 1;\n\t}\n\tasync verifyForeignKeyIntegrity(driver) {\n\t\tconst result = await driver.query(\"PRAGMA foreign_key_check\");\n\t\tif (result.rows.length === 0) return okVoid();\n\t\treturn runnerFailure(\"MIGRATION.FOREIGN_KEY_VIOLATION\", `Foreign key integrity check failed after migration: ${result.rows.length} violation(s).`, {\n\t\t\twhy: \"PRAGMA foreign_key_check reported violations after applying recreate-table operations.\",\n\t\t\tmeta: { violations: result.rows }\n\t\t});\n\t}\n\tasync applyPlan(driver, options, ops) {\n\t\tconst checks = options.executionChecks;\n\t\tconst runPrechecks = checks?.prechecks !== false;\n\t\tconst runPostchecks = checks?.postchecks !== false;\n\t\tconst runIdempotency = checks?.idempotencyChecks !== false;\n\t\tlet operationsExecuted = 0;\n\t\tconst executedOperations = [];\n\t\tfor (const operation of ops) {\n\t\t\toptions.callbacks?.onOperationStart?.(operation);\n\t\t\ttry {\n\t\t\t\tif (runPostchecks && runIdempotency) {\n\t\t\t\t\tif (await this.expectationsAreSatisfied(driver, operation.postcheck)) {\n\t\t\t\t\t\texecutedOperations.push(this.createSkipRecord(operation));\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (runPrechecks) {\n\t\t\t\t\tconst precheckResult = await this.runExpectationSteps(driver, operation.precheck, operation, \"precheck\");\n\t\t\t\t\tif (!precheckResult.ok) return precheckResult;\n\t\t\t\t}\n\t\t\t\tconst executeResult = await this.runExecuteSteps(driver, operation.execute, operation, {\n\t\t\t\t\tcontract: options.destinationContract,\n\t\t\t\t\toperationIndex: ops.indexOf(operation),\n\t\t\t\t\toperations: ops,\n\t\t\t\t\tedges: options.migrationEdges\n\t\t\t\t});\n\t\t\t\tif (!executeResult.ok) return executeResult;\n\t\t\t\tif (runPostchecks) {\n\t\t\t\t\tconst postcheckResult = await this.runExpectationSteps(driver, operation.postcheck, operation, \"postcheck\", {\n\t\t\t\t\t\tcontract: options.destinationContract,\n\t\t\t\t\t\toperationIndex: ops.indexOf(operation)\n\t\t\t\t\t});\n\t\t\t\t\tif (!postcheckResult.ok) return postcheckResult;\n\t\t\t\t}\n\t\t\t\texecutedOperations.push(operation);\n\t\t\t\toperationsExecuted += 1;\n\t\t\t} finally {\n\t\t\t\toptions.callbacks?.onOperationComplete?.(operation);\n\t\t\t}\n\t\t}\n\t\treturn ok({\n\t\t\toperationsExecuted,\n\t\t\texecutedOperations\n\t\t});\n\t}\n\tasync ensureControlTables(driver, contract) {\n\t\tconst legacyDetection = await this.detectLegacyMarkerShape(driver);\n\t\tif (!legacyDetection.ok) return legacyDetection;\n\t\tconst lowererContext = { contract };\n\t\tfor (const query of this.family.bootstrapControlTableQueries()) await this.executeStatement(driver, await this.family.lowerAst(query, lowererContext));\n\t\treturn okVoid();\n\t}\n\tasync detectLegacyMarkerShape(driver) {\n\t\tconst tableInfo = await driver.query(`PRAGMA table_info(${quoteIdentifier(MARKER_TABLE_NAME)})`);\n\t\tif (tableInfo.rows.length === 0) return okVoid();\n\t\tconst columns = new Set(tableInfo.rows.map((row) => row.name));\n\t\tif (columns.has(\"space\")) return okVoid();\n\t\treturn runnerFailure(\"MIGRATION.LEGACY_MARKER_SHAPE\", `Legacy marker-table shape detected on ${MARKER_TABLE_NAME} (no \\`space\\` column). Prisma 8 is in pre-1.0; the previous transitional auto-migration to the per-space-row schema has been removed. Drop \\`${MARKER_TABLE_NAME}\\` and re-run \\`dbInit\\` to reinitialise from a clean baseline.`, { meta: {\n\t\t\ttable: MARKER_TABLE_NAME,\n\t\t\tcolumns: [...columns].sort()\n\t\t} });\n\t}\n\tasync runExpectationSteps(driver, steps, operation, phase, plan) {\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) {\n\t\t\t\tconst code = phase === \"precheck\" ? \"MIGRATION.PRECHECK_FAILED\" : \"MIGRATION.POSTCHECK_FAILED\";\n\t\t\t\tconst field = plan === void 0 ? void 0 : unconvertedFieldOf(step, plan.contract);\n\t\t\t\tconst converted = convertedColumnOf(step);\n\t\t\t\treturn runnerFailure(code, `Operation ${operation.id} failed during ${phase}: ${step.description}`, {\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\t\tphase,\n\t\t\t\t\t\tstepDescription: step.description\n\t\t\t\t\t},\n\t\t\t\t\t...ifDefined(\"why\", converted === void 0 ? void 0 : await this.unconvertedValueText(driver, converted)),\n\t\t\t\t\t...ifDefined(\"failedTypeChange\", field === void 0 || plan === void 0 || converted === void 0 ? void 0 : converted.by === \"conversion\" ? {\n\t\t\t\t\t\tfield,\n\t\t\t\t\t\tby: \"conversion\",\n\t\t\t\t\t\treason: \"invalidResult\",\n\t\t\t\t\t\toperationIndex: plan.operationIndex\n\t\t\t\t\t} : {\n\t\t\t\t\t\tfield,\n\t\t\t\t\t\tby: \"cast\",\n\t\t\t\t\t\treason: \"value\",\n\t\t\t\t\t\toperationIndex: plan.operationIndex\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn okVoid();\n\t}\n\t/** Names the first value of a retyped column that kept a storage class its new type does not hold. */\n\tasync unconvertedValueText(driver, cast) {\n\t\tconst typeSql = (await driver.query(\"SELECT type FROM pragma_table_info(?) WHERE name = ?\", [cast.table, cast.column])).rows[0]?.type;\n\t\tif (typeSql === void 0) return void 0;\n\t\tconst column = quoteIdentifier(cast.column);\n\t\tconst classes = [\"null\", ...affinityStorageClasses(typeSql)];\n\t\tconst row = (await driver.query(`SELECT quote(${column}) AS value, typeof(${column}) AS storageClass FROM ${quoteIdentifier(cast.table)} WHERE typeof(${column}) NOT IN (${classes.map(() => \"?\").join(\", \")}) LIMIT 1`, classes)).rows[0];\n\t\tif (row === void 0) return void 0;\n\t\treturn `The value ${row.value.length > 40 ? `${row.value.slice(0, 40)}…` : row.value} of column \"${cast.column}\" on \"${cast.table}\" is still stored as ${row.storageClass}, which ${typeSql} cannot hold.`;\n\t}\n\tasync runExecuteSteps(driver, steps, operation, plan) {\n\t\tfor (const step of steps) try {\n\t\t\tawait driver.query(step.sql, step.params ?? []);\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\tconst failed = `Operation ${operation.id} failed during execution: ${step.description}`;\n\t\t\tconst rowsWithoutValue = await this.rowsWithoutValue(driver, message, plan);\n\t\t\tconst failedConversion = rowsWithoutValue === void 0 ? await this.failedConversion(driver, step, message, plan) : void 0;\n\t\t\treturn runnerFailure(\"MIGRATION.EXECUTION_FAILED\", rowsWithoutValue?.summary ?? failed, {\n\t\t\t\twhy: rowsWithoutValue === void 0 ? message : `${failed}: ${message}`,\n\t\t\t\tmeta: {\n\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\tstepDescription: step.description,\n\t\t\t\t\tsql: step.sql\n\t\t\t\t},\n\t\t\t\trowsWithoutValue: rowsWithoutValue?.reports,\n\t\t\t\tfailedTypeChange: failedConversion\n\t\t\t});\n\t\t}\n\t\treturn okVoid();\n\t}\n\t/**\n\t* The conversion that failed, when the failed step is the copy of a rebuild that converts columns\n\t* and there is evidence for it: a copy expression that fails on its own has an error in its\n\t* expression, and a constraint of the new table that names a converted column was broken by a\n\t* value the conversion produced. Any other failure of the copy is not the conversion's.\n\t*/\n\tasync failedConversion(driver, step, message, plan) {\n\t\tconst copy = conversionCopyOf(step);\n\t\tif (copy === void 0) return void 0;\n\t\tconst columns = Object.keys(copy.expressions);\n\t\tconst failed = async (column) => {\n\t\t\ttry {\n\t\t\t\tawait driver.query(`SELECT ${copy.expressions[column]} FROM ${quoteIdentifier(copy.table)}`);\n\t\t\t\treturn false;\n\t\t\t} catch {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t};\n\t\tfor (const column of columns) if (await failed(column)) return this.conversionOf(plan, copy.table, column, \"expressionError\");\n\t\tconst [, constrainedList] = message.split(\"constraint failed: \");\n\t\tif (constrainedList === void 0) return void 0;\n\t\tconst constrained = new Set(constrainedList.split(\", \"));\n\t\tconst column = columns.find((name) => constrained.has(`${rebuiltTableName(copy.table)}.${name}`));\n\t\treturn column === void 0 ? void 0 : this.conversionOf(plan, copy.table, column, \"invalidResult\");\n\t}\n\tconversionOf(plan, table, column, reason) {\n\t\tconst field = fieldOfColumn(plan.contract, table, column);\n\t\treturn field === void 0 ? void 0 : {\n\t\t\tfield,\n\t\t\tby: \"conversion\",\n\t\t\treason,\n\t\t\toperationIndex: plan.operationIndex\n\t\t};\n\t}\n\t/**\n\t* The rows a table rebuild found no value for, when its copy failed on a NOT NULL column of the\n\t* new table: the columns the rebuild's postchecks mark as becoming required are counted, the\n\t* rebuild's own first, then those of every other operation of its migration.\n\t*/\n\trowsWithoutValue(driver, message, plan) {\n\t\tif (!message.includes(\"NOT NULL constraint failed\")) return Promise.resolve(void 0);\n\t\tconst marks = requiredColumnsOfMigration(plan.operations, plan.edges, plan.operationIndex);\n\t\treturn rowsWithoutValueFailure({\n\t\t\tfailed: marks.filter((mark) => mark.operationIndex === plan.operationIndex),\n\t\t\tothers: marks,\n\t\t\tcount: async ({ required }) => {\n\t\t\t\tconst where = required.reason !== \"newField\" ? ` WHERE ${quoteIdentifier(required.column)} IS NULL` : \"\";\n\t\t\t\treturn (await driver.query(`SELECT COUNT(*) AS rows FROM ${quoteIdentifier(required.table)}${where}`)).rows[0]?.rows ?? 0;\n\t\t\t},\n\t\t\tcontract: plan.contract\n\t\t});\n\t}\n\tstepResultIsTrue(rows) {\n\t\tif (!rows || rows.length === 0) return false;\n\t\tconst firstRow = rows[0];\n\t\tconst firstValue = firstRow ? Object.values(firstRow)[0] : void 0;\n\t\tif (typeof firstValue === \"number\") return firstValue !== 0;\n\t\tif (typeof firstValue === \"boolean\") return firstValue;\n\t\tif (typeof firstValue === \"string\") {\n\t\t\tconst lower = firstValue.toLowerCase();\n\t\t\tif (lower === \"true\" || lower === \"1\") return true;\n\t\t\tif (lower === \"false\" || lower === \"0\") return false;\n\t\t\treturn firstValue.length > 0;\n\t\t}\n\t\treturn Boolean(firstValue);\n\t}\n\tasync expectationsAreSatisfied(driver, steps) {\n\t\tif (steps.length === 0) return false;\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tcreateSkipRecord(operation) {\n\t\treturn Object.freeze({\n\t\t\tid: operation.id,\n\t\t\tlabel: operation.label,\n\t\t\t...ifDefined(\"summary\", operation.summary),\n\t\t\toperationClass: operation.operationClass,\n\t\t\ttarget: operation.target,\n\t\t\tprecheck: Object.freeze([]),\n\t\t\texecute: Object.freeze([]),\n\t\t\tpostcheck: Object.freeze([...operation.postcheck]),\n\t\t\tmeta: Object.freeze({\n\t\t\t\t...operation.meta ?? {},\n\t\t\t\trunner: Object.freeze({\n\t\t\t\t\tskipped: true,\n\t\t\t\t\treason: \"postcheck_pre_satisfied\"\n\t\t\t\t})\n\t\t\t})\n\t\t});\n\t}\n\tmarkerMatchesDestination(marker, plan) {\n\t\tif (!marker) return false;\n\t\tif (marker.storageHash !== plan.destination.storageHash) return false;\n\t\tif (plan.destination.profileHash && marker.profileHash !== plan.destination.profileHash) return false;\n\t\treturn true;\n\t}\n\tenforcePolicyCompatibility(policy, operations) {\n\t\tconst allowedClasses = new Set(policy.allowedOperationClasses);\n\t\tfor (const operation of operations) if (!allowedClasses.has(operation.operationClass)) return runnerFailure(\"MIGRATION.POLICY_VIOLATION\", `Operation ${operation.id} has class \"${operation.operationClass}\" which is not allowed by policy.`, {\n\t\t\twhy: `Policy only allows: ${policy.allowedOperationClasses.join(\", \")}.`,\n\t\t\tmeta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\toperationClass: operation.operationClass,\n\t\t\t\tallowedClasses: policy.allowedOperationClasses\n\t\t\t}\n\t\t});\n\t\treturn okVoid();\n\t}\n\tensureMarkerCompatibility(marker, plan) {\n\t\tconst origin = plan.origin ?? null;\n\t\tif (!origin) return okVoid();\n\t\tif (!marker) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Missing contract marker: expected origin storage hash ${origin.storageHash}.`, { meta: { expectedOriginStorageHash: origin.storageHash } });\n\t\tif (marker.storageHash !== origin.storageHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`, { meta: {\n\t\t\tmarkerStorageHash: marker.storageHash,\n\t\t\texpectedOriginStorageHash: origin.storageHash\n\t\t} });\n\t\tif (origin.profileHash && marker.profileHash !== origin.profileHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker profile hash (${marker.profileHash}) does not match plan origin profile hash (${origin.profileHash}).`, { meta: {\n\t\t\tmarkerProfileHash: marker.profileHash,\n\t\t\texpectedOriginProfileHash: origin.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tensurePlanMatchesDestinationContract(destination, contract) {\n\t\tif (destination.storageHash !== contract.storage.storageHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination storage hash (${destination.storageHash}) does not match provided contract storage hash (${contract.storage.storageHash}).`, { meta: {\n\t\t\tplanStorageHash: destination.storageHash,\n\t\t\tcontractStorageHash: contract.storage.storageHash\n\t\t} });\n\t\tif (destination.profileHash && contract.profileHash && destination.profileHash !== contract.profileHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination profile hash (${destination.profileHash}) does not match provided contract profile hash (${contract.profileHash}).`, { meta: {\n\t\t\tplanProfileHash: destination.profileHash,\n\t\t\tcontractProfileHash: contract.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tasync upsertMarker(driver, options, existingMarker, space) {\n\t\tconst destination = {\n\t\t\tstorageHash: options.plan.destination.storageHash,\n\t\t\tprofileHash: options.plan.destination.profileHash ?? options.destinationContract.profileHash ?? options.plan.destination.storageHash,\n\t\t\tinvariants: options.plan.providedInvariants ?? []\n\t\t};\n\t\tif (!existingMarker) {\n\t\t\tawait this.family.initMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tdestination\n\t\t\t});\n\t\t\treturn okVoid();\n\t\t}\n\t\tif (!await this.family.updateMarker({\n\t\t\tdriver,\n\t\t\tspace,\n\t\t\texpectedFrom: existingMarker.storageHash,\n\t\t\tdestination\n\t\t})) {\n\t\t\tconst found = await this.family.readMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace\n\t\t\t});\n\t\t\treturn runnerFailure(\"MIGRATION.MARKER_CAS_FAILURE\", \"Marker was modified by another process during migration execution.\", { meta: {\n\t\t\t\tspace,\n\t\t\t\texpectedStorageHash: existingMarker.storageHash,\n\t\t\t\tfoundStorageHash: found?.storageHash ?? null,\n\t\t\t\tdestinationStorageHash: options.plan.destination.storageHash\n\t\t\t} });\n\t\t}\n\t\treturn okVoid();\n\t}\n\tasync recordLedgerEntries(driver, options, executedOperations) {\n\t\tconst plan = options.plan;\n\t\tconst space = plan.spaceId;\n\t\tconst edges = options.migrationEdges;\n\t\tconst totalEdgeOps = edges.reduce((sum, edge) => sum + edge.operationCount, 0);\n\t\tif (totalEdgeOps !== plan.operations.length) throw new InternalError(`Ledger write: plan.operations length (${plan.operations.length}) does not match sum of migrationEdges operationCount (${totalEdgeOps})`);\n\t\tlet offset = 0;\n\t\tfor (const edge of edges) {\n\t\t\tconst edgeOps = executedOperations.slice(offset, offset + edge.operationCount);\n\t\t\toffset += edge.operationCount;\n\t\t\tawait this.family.writeLedgerEntry({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tentry: {\n\t\t\t\t\tedgeId: `${edge.from}->${edge.to}`,\n\t\t\t\t\tfrom: edge.from,\n\t\t\t\t\tto: edge.to,\n\t\t\t\t\tmigrationName: edge.dirName,\n\t\t\t\t\tmigrationHash: edge.migrationHash,\n\t\t\t\t\toperations: edgeOps\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\tasync beginExclusiveTransaction(driver) {\n\t\tawait driver.query(\"BEGIN EXCLUSIVE\");\n\t}\n\tasync commitTransaction(driver) {\n\t\tawait driver.query(\"COMMIT\");\n\t}\n\tasync rollbackTransaction(driver) {\n\t\tawait driver.query(\"ROLLBACK\");\n\t}\n\tasync executeStatement(driver, statement) {\n\t\tawait driver.query(statement.sql, statement.params);\n\t}\n};\n//#endregion\n//#region src/core/sqlite-schema-verifier.ts\n/**\n* SQLite target `SchemaVerifier` concretion. Mirrors the Postgres\n* shape: hooks return the empty list pending the call-site migration\n* that routes the existing verifier behaviour through the SPI.\n*/\nvar SqliteSchemaVerifier = class extends SqlSchemaVerifierBase {\n\tverifyCommonSqlSchema(_options) {\n\t\treturn [];\n\t}\n\tverifyTargetExtensions(_options) {\n\t\treturn [];\n\t}\n};\n//#endregion\n//#region src/core/control-target.ts\nfunction isSqlContract(contract) {\n\treturn contract === null || contract.storage instanceof SqlStorage;\n}\nconst sqliteControlTargetDescriptor = {\n\t...sqliteTargetDescriptorMeta,\n\tcontractSerializer: new SqliteContractSerializer(),\n\tschemaVerifier: new SqliteSchemaVerifier(),\n\tdiffSchema(input) {\n\t\treturn diffSqliteSchema(input);\n\t},\n\tclassifySubjectGranularity: relationalNodeGranularity,\n\tclassifyEntityKind: relationalNodeEntityKind,\n\tmigrations: {\n\t\tcreatePlanner(adapter) {\n\t\t\treturn createSqliteMigrationPlanner(adapter);\n\t\t},\n\t\tcreateRunner(family) {\n\t\t\treturn createSqliteMigrationRunner(family);\n\t\t},\n\t\tcontractToSchema(contract, frameworkComponents) {\n\t\t\tif (!isSqlContract(contract)) throw sqliteError(\"CONTRACT.TARGET_MISMATCH\", \"sqliteControlTargetDescriptor.contractToSchema received a non-SQL contract; expected Contract<SqlStorage>\");\n\t\t\treturn sqliteContractToSchema(contract, sqlTypeLookupsOf(frameworkComponents));\n\t\t}\n\t},\n\tcreate() {\n\t\treturn {\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: \"sqlite\"\n\t\t};\n\t},\n\tcreatePlanner(adapter) {\n\t\treturn createSqliteMigrationPlanner(adapter);\n\t},\n\tcreateRunner(family) {\n\t\treturn createSqliteMigrationRunner(family);\n\t}\n};\n//#endregion\n//#region src/core/type-constructors.ts\n/**\n* The base PSL scalars as zero-arg type constructors in the unified authoring\n* channel. Each names a codec; the column's database type is its data type's.\n*\n* The type position is the only storage decider: a mutation-default generator\n* (`@default(uuid())`) never re-picks a column's storage.\n*\n* These are the constructors only PSL offers. They are defined here, next to the codecs they name, but the adapter contributes them: the TypeScript contract builder builds its `type.*` helpers from the target, so a target contribution would add `type.String()` and the like there. The constructors that should also be `type.*` helpers are the target's own (`sqliteAuthoringTypes`).\n*/\nconst sqlitePslTypeConstructors = {\n\tString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Variable-length text stored as SQLite text.\",\n\t\toutput: { codecId: SQLITE_TEXT_CODEC_ID }\n\t},\n\tInt: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An integer stored as SQLite integer and represented as a JavaScript number.\",\n\t\toutput: { codecId: SQLITE_INTEGER_CODEC_ID }\n\t},\n\tBigInt: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An integer stored as SQLite integer and represented as a JavaScript bigint.\",\n\t\toutput: { codecId: SQLITE_BIGINT_CODEC_ID }\n\t},\n\tFloat: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A floating-point number stored as SQLite real.\",\n\t\toutput: { codecId: SQLITE_REAL_CODEC_ID }\n\t},\n\tDecimal: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A decimal value stored and represented as text to preserve precision.\",\n\t\toutput: { codecId: SQLITE_TEXT_CODEC_ID }\n\t},\n\tDateTime: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A date and time stored as SQLite text.\",\n\t\toutput: { codecId: SQLITE_DATETIME_CODEC_ID }\n\t},\n\tJson: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A JSON value serialized to SQLite text.\",\n\t\toutput: { codecId: SQLITE_JSON_CODEC_ID }\n\t},\n\tBytes: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Binary data stored as a SQLite blob.\",\n\t\toutput: { codecId: SQLITE_BLOB_CODEC_ID }\n\t}\n};\n//#endregion\nexport { SqliteUnboundDatabase, sqliteControlTargetDescriptor as default, sqliteCreateNamespace, s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C;CACA,UAAU;EACT,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,yBAAyB;CAC7C;CACA,MAAM;EACL,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,qBAAqB;CACzC;CACA,OAAO;EACN,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,qBAAqB;CACzC;AACD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as SqliteCodecRegistry } from "./codecs-
|
|
2
|
-
import "./codecs-
|
|
1
|
+
import { o as SqliteCodecRegistry } from "./codecs-Bpnc9OO2-3poDEyWO.mjs";
|
|
2
|
+
import "./codecs-DkmHzY5t.mjs";
|
|
3
3
|
import { r as SqliteDdlNode } from "./nodes-D8EC1yCx-rpfpuJ4T.mjs";
|
|
4
4
|
import "./ddl-CfSqNT0M.mjs";
|
|
5
5
|
import { t as parseSqliteDefault } from "./default-normalizer-B9V7TY5u.mjs";
|
|
@@ -103,4 +103,4 @@ declare class SqliteControlAdapter implements SqlControlAdapter<'sqlite'> {
|
|
|
103
103
|
declare const sqliteAdapterDescriptor: SqlControlAdapterDescriptor<'sqlite'>;
|
|
104
104
|
//#endregion
|
|
105
105
|
export { sqliteAdapterDescriptor as n, SqliteControlAdapter as t };
|
|
106
|
-
//# sourceMappingURL=control-
|
|
106
|
+
//# sourceMappingURL=control-FYHqV1AN.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-
|
|
1
|
+
{"version":3,"file":"control-FYHqV1AN.d.mts","names":[],"sources":["../../../../3-targets/6-adapters/sqlite/dist/control.d.mts"],"mappings":";;;;;;;;;;;;;cAYc,gCAAgC;WACnC;WACA;mBACQ;EACjB,YAAY,eAAe;WAClB,yBAAyB;EAClC,yCAAyC;EACzC,uCAAuC;;;;;;;;;EASvC,MAAM,KAAK,cAAc,eAAe,SAAS,0BAA0B;EAC3E,oBAAoB,QAAQ,WAAW,gBAAgB;;;;;;;;EAQvD,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;EACJ,gBAAgB,GAAG,QAAQ,oCAAoC,UAAU,QAAQ,KAAK,QAAQ;EAC9F,WAAW,SAAS,qCAAqC;;;;EAIzD,iBAAiB,QAAQ,oCAAoC,eAAe;aACjE;aACA;aACA;aACA;aACA;aACA;MACP;UACI;EACR,WAAW,QAAQ,oCAAoC,sBAAsB,QAAQ;;;;cAIzE,yBAAyB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { a as sqliteCodecRegistry } from "./codecs-C2B4QuOX.mjs";
|
|
2
|
+
import { n as sqliteAdapterContractContributions } from "./contract-contributions-wweWdXMK-D6CBejlZ.mjs";
|
|
3
|
+
//#region ../../../3-targets/6-adapters/sqlite/dist/descriptor-meta-DrNwC4vO.mjs
|
|
4
|
+
const sqliteAdapterDescriptorMeta = {
|
|
5
|
+
kind: "adapter",
|
|
6
|
+
familyId: "sql",
|
|
7
|
+
targetId: "sqlite",
|
|
8
|
+
id: "sqlite",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
capabilities: sqliteAdapterContractContributions.capabilities,
|
|
11
|
+
types: {
|
|
12
|
+
aggregateDescriptors: sqliteAdapterContractContributions.types.aggregateDescriptors,
|
|
13
|
+
codecTypes: {
|
|
14
|
+
codecDescriptors: Array.from(sqliteCodecRegistry.values()),
|
|
15
|
+
import: {
|
|
16
|
+
package: "@internal/adapter-sqlite/codec-types",
|
|
17
|
+
named: "CodecTypes",
|
|
18
|
+
alias: "SqliteTypes"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { sqliteAdapterDescriptorMeta as t };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=descriptor-meta-DrNwC4vO-BHbHnBqu.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptor-meta-DrNwC4vO-BHbHnBqu.mjs","names":[],"sources":["../../../../3-targets/6-adapters/sqlite/dist/descriptor-meta-DrNwC4vO.mjs"],"sourcesContent":["import { t as sqliteAdapterContractContributions } from \"./contract-contributions-wweWdXMK.mjs\";\nimport { sqliteCodecRegistry } from \"@internal/target-sqlite/codecs\";\n//#region src/core/descriptor-meta.ts\nconst sqliteAdapterDescriptorMeta = {\n\tkind: \"adapter\",\n\tfamilyId: \"sql\",\n\ttargetId: \"sqlite\",\n\tid: \"sqlite\",\n\tversion: \"0.0.1\",\n\tcapabilities: sqliteAdapterContractContributions.capabilities,\n\ttypes: {\n\t\taggregateDescriptors: sqliteAdapterContractContributions.types.aggregateDescriptors,\n\t\tcodecTypes: {\n\t\t\tcodecDescriptors: Array.from(sqliteCodecRegistry.values()),\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-DrNwC4vO.mjs.map"],"mappings":";;;AAGA,MAAM,8BAA8B;CACnC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,mCAAmC;CACjD,OAAO;EACN,sBAAsB,mCAAmC,MAAM;EAC/D,YAAY;GACX,kBAAkB,MAAM,KAAK,oBAAoB,OAAO,CAAC;GACzD,QAAQ;IACP,SAAS;IACT,OAAO;IACP,OAAO;GACR;EACD;CACD;AACD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as buildTargetDetails } from "./planner-target-details-CIQ789Gc-C5U4yVY9.mjs";
|
|
2
|
-
import { w as step } from "./op-factory-call-
|
|
2
|
+
import { w as step } from "./op-factory-call-BP8q3moB-BhWwqgfW.mjs";
|
|
3
3
|
import { col as col$1, fn as fn$1, foreignKey, lit as lit$1, primaryKey, unique } from "@prisma/orm-family-sql/relational-core/contract-free";
|
|
4
4
|
import { placeholder } from "@prisma/orm-framework/errors/migration";
|
|
5
5
|
import { MigrationCLI } from "@prisma/orm-toolchain/cli/migration-cli";
|
|
@@ -45,4 +45,4 @@ function rawSql(op) {
|
|
|
45
45
|
//#endregion
|
|
46
46
|
export { foreignKey as a, primaryKey as c, unique as d, fn$1 as i, rawSql as l, col$1 as n, lit$1 as o, dataTransform as r, placeholder as s, MigrationCLI as t, sql as u };
|
|
47
47
|
|
|
48
|
-
//# sourceMappingURL=migration-
|
|
48
|
+
//# sourceMappingURL=migration-9FS12QGo.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-
|
|
1
|
+
{"version":3,"file":"migration-9FS12QGo.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/migration.mjs"],"sourcesContent":["import { x as step } from \"./op-factory-call-BP8q3moB.mjs\";\nimport { t as SqliteMigration } from \"./sqlite-migration-Dn0aIhV7.mjs\";\nimport { t as buildTargetDetails } from \"./planner-target-details-CIQ789Gc.mjs\";\nimport { placeholder } from \"@internal/errors/migration\";\nimport { col, fn, foreignKey, lit, primaryKey, unique } from \"@internal/sql-relational-core/contract-free\";\nimport { MigrationCLI } from \"@internal/cli/migration-cli\";\nimport { sql } from \"@internal/sql-contract/sql-expression\";\n//#region src/core/migrations/operations/data-transform.ts\n/**\n* User-facing `dataTransform` factory for the SQLite migration authoring\n* surface. Invoked directly inside a `migration.ts` file to supply a\n* user-authored SQL statement that runs with operation class `'data'`.\n*\n* Typical use: the planner emits a `DataTransformCall` stub when a NOT NULL\n* tightening requires a backfill. The rendered `migration.ts` exposes the\n* backfill as a `placeholder(\"…\")` slot the user fills in with an\n* `UPDATE … WHERE col IS NULL` statement. The filled-in `dataTransform(...)`\n* invocation returns a runnable operation the runner executes before the\n* subsequent recreate-table op copies data into the tightened schema.\n*/\nfunction dataTransform(opts) {\n\treturn {\n\t\tid: opts.id,\n\t\tlabel: opts.label,\n\t\tsummary: opts.description,\n\t\toperationClass: \"data\",\n\t\ttarget: {\n\t\t\tid: \"sqlite\",\n\t\t\tdetails: buildTargetDetails(\"table\", opts.table)\n\t\t},\n\t\tprecheck: [],\n\t\texecute: [step(opts.description, opts.run())],\n\t\tpostcheck: []\n\t};\n}\n//#endregion\n//#region src/core/migrations/operations/raw.ts\n/**\n* Identity factory for an already-materialized\n* `SqlMigrationPlanOperation<SqlitePlanTargetDetails>`. Mirrors the Postgres\n* `rawSql` factory: the planner uses this to carry ops produced by SQL-family\n* paths (codec lifecycle hooks, raw-SQL escape hatches) alongside structured\n* call IR without reverse-engineering their shape.\n*/\nfunction rawSql(op) {\n\treturn op;\n}\n//#endregion\nexport { SqliteMigration as Migration, MigrationCLI, col, dataTransform, fn, foreignKey, lit, placeholder, primaryKey, rawSql, sql, unique };\n\n//# sourceMappingURL=migration.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,SAAS,cAAc,MAAM;CAC5B,OAAO;EACN,IAAI,KAAK;EACT,OAAO,KAAK;EACZ,SAAS,KAAK;EACd,gBAAgB;EAChB,QAAQ;GACP,IAAI;GACJ,SAAS,mBAAmB,SAAS,KAAK,KAAK;EAChD;EACA,UAAU,CAAC;EACX,SAAS,CAAC,KAAK,KAAK,aAAa,KAAK,IAAI,CAAC,CAAC;EAC5C,WAAW,CAAC;CACb;AACD;;;;;;;;AAUA,SAAS,OAAO,IAAI;CACnB,OAAO;AACR"}
|
package/dist/{op-factory-call-hxIbAMSY-CinxsQHg.mjs → op-factory-call-BP8q3moB-BhWwqgfW.mjs}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { o as sqliteInteger } from "./data-types-pFQMl37_-B-3aK_wd.mjs";
|
|
2
2
|
import { n as sqliteError } from "./errors-DnR-sMHS-KkMLIP2U.mjs";
|
|
3
|
-
import { n as decodeSqliteDatetime, r as encodeSqliteDatetime } from "./codecs-
|
|
3
|
+
import { n as decodeSqliteDatetime, r as encodeSqliteDatetime } from "./codecs-Ea350Hl_-Bgfsxc8G.mjs";
|
|
4
4
|
import { a as tableExistsAst, i as indexExistsAst, n as columnNameTakenAst, o as tableNameTakenAst, r as createTable, t as columnExistsAst } from "./ddl-CDoa1Ehx-BOT670XL.mjs";
|
|
5
5
|
import { n as escapeLiteral, r as quoteIdentifier, t as SQLITE_QUOTING } from "./sql-utils-XGT5Esi2-5k9pvJeF.mjs";
|
|
6
6
|
import { r as stripOuterParens } from "./default-normalizer-Ch3VFnEH-C-h1XtlJ.mjs";
|
|
@@ -17,7 +17,7 @@ import { assertNever } from "@prisma/orm-framework/utils/internal-error";
|
|
|
17
17
|
import { errorMigrationOperationOptionRemoved, unfilledPlaceholderOperation } from "@prisma/orm-framework/errors/migration";
|
|
18
18
|
import { REFERENTIAL_ACTION_SQL } from "@prisma/orm-family-sql/contract/referential-action-sql";
|
|
19
19
|
import { TsExpression, jsonToTsSource, tsArraySource, tsObjectSource, tsQuotedTextSource } from "@prisma/orm-framework/ts-render";
|
|
20
|
-
//#region ../../../3-targets/3-targets/sqlite/dist/op-factory-call-
|
|
20
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/op-factory-call-BP8q3moB.mjs
|
|
21
21
|
/**
|
|
22
22
|
* Low-level DDL fragment builders for SQLite migrations.
|
|
23
23
|
*
|
|
@@ -1365,4 +1365,4 @@ function renderPostcheck(postcheck) {
|
|
|
1365
1365
|
//#endregion
|
|
1366
1366
|
export { sqliteIdentifiersCollide as C, sqliteDefaultToDdlColumnDefault as S, indexReplacementCalls as _, DropColumnCall as a, renameTableSteps as b, RawSqlCall as c, RenameTableCall as d, affinityStorageClasses as f, conversionCopyOf as g, buildRecreateSummary as h, DataTransformCall as i, RecreateTableCall as l, buildRecreatePostchecks as m, CreateIndexCall as n, DropIndexCall as o, buildColumnTypeSql as p, CreateTableCall as r, DropTableCall as s, AddColumnCall as t, RenameColumnCall as u, isSqliteOpFactoryCall as v, step as w, renderDefaultLiteral as x, rebuiltTableName as y };
|
|
1367
1367
|
|
|
1368
|
-
//# sourceMappingURL=op-factory-call-
|
|
1368
|
+
//# sourceMappingURL=op-factory-call-BP8q3moB-BhWwqgfW.mjs.map
|