@prisma/orm-family-sql 8.0.0-rc.13-dev.11 → 8.0.0-rc.14
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/{ast-Bhj549wG.mjs → ast-CJd4157-.mjs} +262 -2
- package/dist/ast-CJd4157-.mjs.map +1 -0
- package/dist/{ast-B9jF6tRJ.d.mts → ast-DQU1yUQ5.d.mts} +30 -2
- package/dist/ast-DQU1yUQ5.d.mts.map +1 -0
- package/dist/{authored-check-naming-9UFx77db.mjs → authored-check-naming-CJRDf9-V.mjs} +3 -3
- package/dist/{authored-check-naming-9UFx77db.mjs.map → authored-check-naming-CJRDf9-V.mjs.map} +1 -1
- package/dist/{authoring-type-constructors-DQZEX4Sb-DORF5BnN.mjs → authoring-type-constructors-DQZEX4Sb-BYGQWq43.mjs} +2 -2
- package/dist/{authoring-type-constructors-DQZEX4Sb-DORF5BnN.mjs.map → authoring-type-constructors-DQZEX4Sb-BYGQWq43.mjs.map} +1 -1
- package/dist/builder.d.mts +1 -1
- package/dist/builder__runtime.d.mts +2 -2
- package/dist/builder__runtime.mjs +1 -1
- package/dist/builder__types.d.mts +1 -1
- package/dist/{codec-descriptor-registry-ECZ4ohtG.mjs → codec-descriptor-registry-Cj-tqpFL.mjs} +2 -2
- package/dist/{codec-descriptor-registry-ECZ4ohtG.mjs.map → codec-descriptor-registry-Cj-tqpFL.mjs.map} +1 -1
- package/dist/{config-types-DlxXpXqA.mjs → config-types-B86lMw4s.mjs} +2 -2
- package/dist/{config-types-DlxXpXqA.mjs.map → config-types-B86lMw4s.mjs.map} +1 -1
- package/dist/{contract-builder-BKfGg37_.mjs → contract-builder-Fw-SFRvK.mjs} +4 -4
- package/dist/{contract-builder-BKfGg37_.mjs.map → contract-builder-Fw-SFRvK.mjs.map} +1 -1
- package/dist/contract-prisma7__provider.mjs +3 -3
- package/dist/contract-psl.mjs +1 -1
- package/dist/contract-psl__provider.mjs +2 -2
- package/dist/contract-psl__provider.mjs.map +1 -1
- package/dist/contract-ts.mjs +3 -3
- package/dist/contract-ts__config-types.mjs +1 -1
- package/dist/contract-ts__contract-builder.mjs +2 -2
- package/dist/contract.mjs +9 -9
- package/dist/contract__authored-check-naming.mjs +1 -1
- package/dist/contract__entity-kinds.mjs +1 -1
- package/dist/contract__factories.mjs +1 -1
- package/dist/contract__foreign-key-materialization.mjs +1 -1
- package/dist/contract__index-naming.mjs +1 -1
- package/dist/contract__types.mjs +3 -3
- package/dist/contract__validators.mjs +2 -2
- package/dist/{control-8NqI46OK.mjs → control-DOGYQMFH.mjs} +34 -17
- package/dist/control-DOGYQMFH.mjs.map +1 -0
- package/dist/{control-adapter-C99J7aEF-Bu-VCRbv.d.mts → control-adapter-C99J7aEF-B571Jffd.d.mts} +4 -4
- package/dist/{control-adapter-C99J7aEF-Bu-VCRbv.d.mts.map → control-adapter-C99J7aEF-B571Jffd.d.mts.map} +1 -1
- package/dist/control-adapter-jmL_K-jB.d.mts +1 -0
- package/dist/{control-VctoviCf.d.mts → control-kbS8DWF0.d.mts} +26 -9
- package/dist/{control-VctoviCf.d.mts.map → control-kbS8DWF0.d.mts.map} +1 -1
- package/dist/{db-DLjWu9-f-6BG2QArC.d.mts → db-DLjWu9-f-CVAu8jgd.d.mts} +2 -2
- package/dist/{db-DLjWu9-f-6BG2QArC.d.mts.map → db-DLjWu9-f-CVAu8jgd.d.mts.map} +1 -1
- package/dist/{derived-checks-Bsrdb2Wk-D4UfM06W.mjs → derived-checks-C6psACIj-DfqUVmZz.mjs} +12 -12
- package/dist/derived-checks-C6psACIj-DfqUVmZz.mjs.map +1 -0
- package/dist/{diff-B2b34L_E.d.mts → diff-BxwNI8yE.d.mts} +6 -6
- package/dist/{diff-B2b34L_E.d.mts.map → diff-BxwNI8yE.d.mts.map} +1 -1
- package/dist/{entity-kinds-D7vwoN_T-CCBwFJy0.mjs → entity-kinds-D7vwoN_T-NmeI6TpT.mjs} +3 -3
- package/dist/{entity-kinds-D7vwoN_T-CCBwFJy0.mjs.map → entity-kinds-D7vwoN_T-NmeI6TpT.mjs.map} +1 -1
- package/dist/{factories-SVor5xIT.mjs → factories-aJoZYxkD.mjs} +3 -3
- package/dist/{factories-SVor5xIT.mjs.map → factories-aJoZYxkD.mjs.map} +1 -1
- package/dist/family.d.mts +9 -9
- package/dist/family.mjs +7 -7
- package/dist/family__control-adapter.d.mts +2 -2
- package/dist/family__control.d.mts +4 -4
- package/dist/family__control.mjs +4 -4
- package/dist/family__diff.d.mts +2 -2
- package/dist/family__diff.mjs +1 -1
- package/dist/family__ir.mjs +1 -1
- package/dist/family__migration.d.mts +1 -1
- package/dist/family__pack.mjs +1 -1
- package/dist/family__psl-build.mjs +1 -1
- package/dist/family__psl-infer.d.mts +1 -1
- package/dist/family__psl-infer.mjs +1 -1
- package/dist/{foreign-key-materialization-B3HQzQIA.mjs → foreign-key-materialization-DiOhEeAz.mjs} +3 -3
- package/dist/{foreign-key-materialization-B3HQzQIA.mjs.map → foreign-key-materialization-DiOhEeAz.mjs.map} +1 -1
- package/dist/{index-naming-Cj1Anq-T-w1JL7-EM.mjs → index-naming-Cj1Anq-T-C9TevpPR.mjs} +2 -2
- package/dist/{index-naming-Cj1Anq-T-w1JL7-EM.mjs.map → index-naming-Cj1Anq-T-C9TevpPR.mjs.map} +1 -1
- package/dist/{index-B-CraAhf.d.mts → index-yNeNt2GO.d.mts} +3 -3
- package/dist/{index-B-CraAhf.d.mts.map → index-yNeNt2GO.d.mts.map} +1 -1
- package/dist/{interpreter-gs7fSAIb-DuqyTGAB.mjs → interpreter-IKKTyZNv-D12J5Dcx.mjs} +5 -4
- package/dist/interpreter-IKKTyZNv-D12J5Dcx.mjs.map +1 -0
- package/dist/{migration-9GrLWqGg.d.mts → migration-BJCmLNwu.d.mts} +2 -2
- package/dist/{migration-9GrLWqGg.d.mts.map → migration-BJCmLNwu.d.mts.map} +1 -1
- package/dist/{naming-DKr4TJd7-Cszhq9RV.mjs → naming-Cc_t1q6s-CouBOmqZ.mjs} +2 -2
- package/dist/{naming-DKr4TJd7-Cszhq9RV.mjs.map → naming-Cc_t1q6s-CouBOmqZ.mjs.map} +1 -1
- package/dist/orm-client.d.mts +3 -3
- package/dist/orm-client.mjs +2 -2
- package/dist/{prepared-statement-BHSj2pDk-CRzjNpcv.d.mts → prepared-statement-BHSj2pDk-BL0wOCnq.d.mts} +2 -2
- package/dist/{prepared-statement-BHSj2pDk-CRzjNpcv.d.mts.map → prepared-statement-BHSj2pDk-BL0wOCnq.d.mts.map} +1 -1
- package/dist/{psl-build-Cp32ahjI.mjs → psl-build-SOpIFu24.mjs} +7 -4
- package/dist/psl-build-SOpIFu24.mjs.map +1 -0
- package/dist/{psl-infer-DwMyO-IV.mjs → psl-infer-8kKfa-Ts.mjs} +2 -2
- package/dist/{psl-infer-DwMyO-IV.mjs.map → psl-infer-8kKfa-Ts.mjs.map} +1 -1
- package/dist/{psl-infer-BzjA7U3b.d.mts → psl-infer-C8hg8mIS.d.mts} +3 -3
- package/dist/{psl-infer-BzjA7U3b.d.mts.map → psl-infer-C8hg8mIS.d.mts.map} +1 -1
- package/dist/relational-core.d.mts +2 -2
- package/dist/relational-core.mjs +2 -2
- package/dist/relational-core__ast.d.mts +2 -2
- package/dist/relational-core__ast.mjs +2 -2
- package/dist/relational-core__codec-descriptor-registry.mjs +1 -1
- package/dist/runtime.d.mts +3 -3
- package/dist/runtime.mjs +1 -1
- package/dist/runtime__internal__prepared-query.d.mts +1 -1
- package/dist/{schema-differ-DpG_gnur-B_rj2WAH.d.mts → schema-differ-DpG_gnur-3ciAcy28.d.mts} +3 -3
- package/dist/{schema-differ-DpG_gnur-B_rj2WAH.d.mts.map → schema-differ-DpG_gnur-3ciAcy28.d.mts.map} +1 -1
- package/dist/schema-ir.d.mts +2 -2
- package/dist/schema-ir.mjs +2 -2
- package/dist/schema-ir__naming.mjs +1 -1
- package/dist/schema-ir__types.d.mts +3 -3
- package/dist/schema-ir__types.mjs +2 -2
- package/dist/{schema-verify-DI0aJQ9d-D5SmSZg3.mjs → schema-verify-DI0aJQ9d-Bgbmen10.mjs} +2 -2
- package/dist/{schema-verify-DI0aJQ9d-D5SmSZg3.mjs.map → schema-verify-DI0aJQ9d-Bgbmen10.mjs.map} +1 -1
- package/dist/{serialized-index-nBTwanKy-_ddEK4tk.mjs → serialized-index-nBTwanKy-B0C03Q_R.mjs} +3 -3
- package/dist/{serialized-index-nBTwanKy-_ddEK4tk.mjs.map → serialized-index-nBTwanKy-B0C03Q_R.mjs.map} +1 -1
- package/dist/{sql-contract-serializer-C90xg7_q-A3_F0w7f.mjs → sql-contract-serializer-C90xg7_q-DERDzTD5.mjs} +4 -4
- package/dist/{sql-contract-serializer-C90xg7_q-A3_F0w7f.mjs.map → sql-contract-serializer-C90xg7_q-DERDzTD5.mjs.map} +1 -1
- package/dist/{storage-table-ZzbR-xzQ-BRoTQE_2.mjs → storage-table-ZzbR-xzQ-C8gXT45E.mjs} +2 -2
- package/dist/{storage-table-ZzbR-xzQ-BRoTQE_2.mjs.map → storage-table-ZzbR-xzQ-C8gXT45E.mjs.map} +1 -1
- package/dist/types-BBT7jidC.d.mts +1 -0
- package/dist/{types-BFPRCYGW-DWAEoFj7.d.mts → types-BFPRCYGW-BLH0sK1Y.d.mts} +4 -4
- package/dist/{types-BFPRCYGW-DWAEoFj7.d.mts.map → types-BFPRCYGW-BLH0sK1Y.d.mts.map} +1 -1
- package/dist/{types-D0B65hip.mjs → types-D8Se4rnB.mjs} +2 -2
- package/dist/{types-D0B65hip.mjs.map → types-D8Se4rnB.mjs.map} +1 -1
- package/dist/{types-CHOgKgHg-BxgkL3GS.d.mts → types-DinsvYdY-Dv_n3Tac.d.mts} +43 -6
- package/dist/types-DinsvYdY-Dv_n3Tac.d.mts.map +1 -0
- package/dist/{types-DvrIPGUN-wxavfzyJ.mjs → types-yyhkYQNT-Dmoq-giA.mjs} +82 -45
- package/dist/types-yyhkYQNT-Dmoq-giA.mjs.map +1 -0
- package/dist/{validators-DecqO0rE.mjs → validators-BlqrBU7I.mjs} +3 -3
- package/dist/{validators-DecqO0rE.mjs.map → validators-BlqrBU7I.mjs.map} +1 -1
- package/package.json +18 -18
- package/dist/ast-B9jF6tRJ.d.mts.map +0 -1
- package/dist/ast-Bhj549wG.mjs.map +0 -1
- package/dist/control-8NqI46OK.mjs.map +0 -1
- package/dist/control-adapter-D4_Oipv6.d.mts +0 -1
- package/dist/derived-checks-Bsrdb2Wk-D4UfM06W.mjs.map +0 -1
- package/dist/interpreter-gs7fSAIb-DuqyTGAB.mjs.map +0 -1
- package/dist/psl-build-Cp32ahjI.mjs.map +0 -1
- package/dist/types-BijNazlM.d.mts +0 -1
- package/dist/types-CHOgKgHg-BxgkL3GS.d.mts.map +0 -1
- package/dist/types-DvrIPGUN-wxavfzyJ.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"naming-DKr4TJd7-Cszhq9RV.mjs","names":[],"sources":["../../../../2-sql/1-core/schema-ir/dist/naming-DKr4TJd7.mjs"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { ContractValidationError } from \"@internal/contract/contract-validation-error\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/naming.ts\nfunction defaultIndexName(tableName, columns) {\n\treturn `${tableName}_${columns.join(\"_\")}_idx`;\n}\n/** The flat name the union describes. Inverse of {@link namingOf}. */\nfunction nameOf(naming) {\n\treturn naming.kind === \"wire\" ? formatWireName(naming.prefix, naming.hash) : naming.name;\n}\n/**\n* The naming a name-identified node was built with, read back off the flat\n* pair it stores. Inverse of {@link nameOf}, and total for that\n* reason: the constructor derived `name` from the union, so the two agree.\n* Flat data arriving from outside the process goes through\n* {@link parseNaming} instead.\n*/\nfunction namingOf(name, prefix) {\n\tif (prefix === void 0) return {\n\t\tkind: \"exact\",\n\t\tname\n\t};\n\treturn {\n\t\tkind: \"wire\",\n\t\tprefix,\n\t\thash: name.slice(prefix.length + 1)\n\t};\n}\n/**\n* Reads naming out of flat stored data — deserialized contract JSON and the\n* literals a user may hand-edit, the one place a name and a prefix can still\n* disagree. Throws when a declared prefix does not parse back out of the name.\n*/\nfunction parseNaming(name, prefix) {\n\tif (prefix === void 0) return {\n\t\tkind: \"exact\",\n\t\tname\n\t};\n\tconst parsed = parseWireName(name);\n\tif (parsed === void 0 || parsed.prefix !== prefix) throw new ContractValidationError(`\"${name}\": prefix \"${prefix}\" does not match the wire name (expected \"${formatWireName(prefix, \"<8hex>\")}\").`, \"storage\");\n\treturn {\n\t\tkind: \"wire\",\n\t\tprefix: parsed.prefix,\n\t\thash: parsed.hash\n\t};\n}\n/**\n* The naming an object read out of a live catalog has: a wire-shaped name\n* gets the wire arm so the rename pass can pair it by prefix, and every\n* other name is exact.\n*\n* The wire answer is a claim about the name's SHAPE only — the hash is\n* deliberately not recomputed from the object's content here. Nothing\n* downstream reads it as more than that: the differ always asks the\n* contract-derived side to choose the comparison, so a shape-only wire\n* claim on the introspected side never suppresses a body comparison, and\n* `contract infer` recomputes the hash independently before it will emit an\n* index as wire-named.\n*/\nfunction namingOfLiveName(name) {\n\tconst wire = parseWireName(name);\n\treturn wire === void 0 ? {\n\t\tkind: \"exact\",\n\t\tname\n\t} : {\n\t\tkind: \"wire\",\n\t\tprefix: wire.prefix,\n\t\thash: wire.hash\n\t};\n}\nconst WIRE_NAME_PATTERN = /^(.+)_([0-9a-f]{8})$/;\n/**\n* Assembles a wire name from its user-supplied prefix and its 8-hex\n* content-hash suffix. This module owns the `<prefix>_<hash>` format on both\n* sides — construction here and parsing in {@link parseWireName} — so the two\n* never drift.\n*/\nfunction formatWireName(prefix, hash) {\n\treturn `${prefix}_${hash}`;\n}\n/**\n* Splits a wire name (`<prefix>_<8hex>`) into its prefix and content-hash\n* suffix. Returns `undefined` when the name does not follow the wire-name\n* shape (e.g. an object created outside the toolchain) — callers treat such\n* names as all-prefix. Consumed by introspection (prefix extraction) and by\n* rename pairing (same hash, different prefix).\n*/\nfunction parseWireName(name) {\n\tconst match = WIRE_NAME_PATTERN.exec(name);\n\tconst prefix = match?.[1];\n\tconst hash = match?.[2];\n\tif (prefix === void 0 || hash === void 0) return void 0;\n\treturn {\n\t\tprefix,\n\t\thash\n\t};\n}\n/**\n* Stabilizes an authored SQL body (index expression, partial-index predicate,\n* RLS policy predicate) for hashing: trim, and collapse runs of internal\n* whitespace to a single space.\n*\n* This is deliberately minimal. The content hash is the equivalence relation\n* for a wire-named object, and the wire name (prefix + hash) is the only\n* thing ever compared — the hash is never recomputed from an introspected\n* body, so there is no need to match the database's reprinted form. Minimal\n* normalization also protects the no-collision property: aggressive rewriting\n* (lowercasing, paren-stripping, cast-alias folding) risks collapsing two\n* distinct bodies onto one hash.\n*\n* The normalizer is a stability commitment: any change re-suffixes all wire names.\n*/\nfunction normalizeSqlBody(sql) {\n\treturn sql.replace(/\\s+/g, \" \").trim();\n}\n/**\n* Returns the first 8 lowercase hex characters of the SHA-256 digest over the\n* canonical content tuple for a check constraint:\n*\n* [normalizeSqlBody(expression)]\n*\n* The predicate is the whole of a check's content — the constraint name,\n* schema, and table are orthogonal to its equivalence. The one-element tuple\n* keeps the encoding in the same shape as the index and RLS tuples so a member\n* can be added later without re-reading which encoding a kind uses.\n*\n* The tuple order and encoding are a stability commitment: any change\n* re-suffixes every wire name.\n*/\nfunction computeCheckContentHash(expression) {\n\tconst tuple = JSON.stringify([normalizeSqlBody(expression)]);\n\treturn createHash(\"sha256\").update(tuple).digest(\"hex\").slice(0, 8);\n}\n/** The trailing segment a check's wire-name prefix carries, per kind. */\nconst CHECK_KIND_SUFFIX = {\n\tmembership: \"check\",\n\telementNotNull: \"elem_not_null\"\n};\n/**\n* Composes the wire-name prefix of a derived CHECK constraint:\n* `${table}_${column}_${kindSuffix}`, capped at the wire-name byte budget.\n* Shared by contract authoring (naming emitted checks) and `contract infer`\n* (recomputing the name a derived check would carry), so truncated and\n* multibyte prefixes match by construction.\n*/\nfunction composeCheckWirePrefix(tableName, columnName, kind) {\n\treturn truncateToWireNamePrefixBytes(`${tableName}_${columnName}_${CHECK_KIND_SUFFIX[kind]}`);\n}\n/**\n* Every {@link CheckKind} value, read off {@link CHECK_KIND_SUFFIX}'s own keys\n* so the enumeration can never drift out of step with it.\n*/\nconst CHECK_KINDS = Object.keys(CHECK_KIND_SUFFIX).filter((kind) => kind in CHECK_KIND_SUFFIX);\n/**\n* The wire-name prefixes derivation could produce for `tableName`: every\n* {@link composeCheckWirePrefix} result crossing each of `columnNames` with\n* each {@link CheckKind}. A check is derived iff its prefix is a member of\n* this set.\n*\n* This is the prefix SHAPE only, not the full name-with-hash: it does not\n* know which kind a specific column's type would actually derive (that needs\n* the target's `renderCheckExpressions` hook, which callers of this function\n* do not have in hand), so every column is conservatively treated as capable\n* of producing every kind.\n*/\nfunction derivedCheckPrefixes(tableName, columnNames) {\n\tconst prefixes = /* @__PURE__ */ new Set();\n\tfor (const columnName of columnNames) for (const kind of CHECK_KINDS) prefixes.add(composeCheckWirePrefix(tableName, columnName, kind));\n\treturn prefixes;\n}\n/**\n* Returns the first 8 lowercase hex characters of the SHA-256 digest over the\n* canonical content tuple for an index:\n*\n* [normalizeSqlBody(expression), normalizeSqlBody(where), columns, unique, type, sortedOptions]\n*\n* Columns hash in authored order — column order is semantic in an index.\n* Option values are `String()`-coerced (matching the loose option equality\n* used for diffing) so a hash computed from typed contract values agrees with\n* one recomputed from introspected reloptions strings. The prefix, schema,\n* and table are excluded (they are orthogonal to index equivalence).\n*\n* The tuple order and encoding are a stability commitment with the same\n* status as the RLS tuple: any change re-suffixes every wire name.\n*/\n/**\n* Canonicalizes one index option VALUE to the `on`/`off` boolean spelling:\n* JS booleans and the common catalog spellings (`pg_class.reloptions`\n* stores whatever spelling the DDL used, so a live index may carry\n* `'true'`/`'false'` or `'on'`/`'off'`) all map to one form; everything\n* else via `String()` (fully specified for numbers, so no platform\n* variance). Shared by the wire-name hash tuple, the node's option\n* equality, and the DDL renderer, so an authored `{ fastupdate: true }`\n* agrees with a live index created under any boolean spelling.\n*/\nfunction normalizeIndexOptionValue(value) {\n\tif (value === true || value === \"true\" || value === \"on\") return \"on\";\n\tif (value === false || value === \"false\" || value === \"off\") return \"off\";\n\treturn String(value);\n}\nfunction computeIndexContentHash(parts) {\n\tconst sortedOptions = Object.entries(parts.options ?? {}).map(([key, value]) => [key, normalizeIndexOptionValue(value)]).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);\n\tconst tuple = JSON.stringify([\n\t\tnormalizeSqlBody(parts.expression ?? \"\"),\n\t\tnormalizeSqlBody(parts.where ?? \"\"),\n\t\tparts.columns ?? [],\n\t\tparts.unique,\n\t\tparts.type ?? \"\",\n\t\tsortedOptions\n\t]);\n\treturn createHash(\"sha256\").update(tuple).digest(\"hex\").slice(0, 8);\n}\n/**\n* Postgres truncates identifiers at `NAMEDATALEN - 1` = 63 **bytes**, not\n* characters, and the wire name appends a 9-byte `_<8hex>` suffix — so a\n* prefix is bounded at 54 bytes. A prefix of non-ASCII characters can sit well\n* under 54 characters and still overrun: the database would silently truncate\n* the name, leaving the declared object permanently unmatchable against the\n* live one.\n*/\nconst WIRE_NAME_PREFIX_MAX_BYTES = 54;\nconst utf8 = new TextEncoder();\n/** UTF-8 byte length — the unit Postgres measures identifiers in. */\nfunction byteLength(value) {\n\treturn utf8.encode(value).length;\n}\n/**\n* Rejects a wire-name prefix over {@link WIRE_NAME_PREFIX_MAX_BYTES}.\n* `subject` opens the error message (e.g. `defineContract: policy prefix`).\n*/\nfunction assertWireNamePrefixLength(prefix, subject) {\n\tif (byteLength(prefix) > 54) throw structuredError(\"CONTRACT.WIRE_NAME_PREFIX_TOO_LONG\", `${subject} \"${prefix}\" exceeds the 54-byte maximum (Postgres identifiers cap at 63 bytes and the wire name appends a 9-byte hash suffix).`, { meta: {\n\t\tprefix,\n\t\tmaxBytes: 54\n\t} });\n}\n/**\n* Shortens a DERIVED wire-name prefix to {@link WIRE_NAME_PREFIX_MAX_BYTES},\n* cutting on a code-point boundary so a multibyte character is never split.\n* Only derived prefixes truncate — an authored one throws\n* ({@link assertWireNamePrefixLength}), because its author can shorten it.\n*/\nfunction truncateToWireNamePrefixBytes(prefix) {\n\tif (byteLength(prefix) <= 54) return prefix;\n\tlet out = \"\";\n\tlet bytes = 0;\n\tfor (const character of prefix) {\n\t\tconst size = byteLength(character);\n\t\tif (bytes + size > 54) break;\n\t\tout += character;\n\t\tbytes += size;\n\t}\n\treturn out;\n}\n//#endregion\nexport { computeIndexContentHash as a, formatWireName as c, namingOfLiveName as d, normalizeIndexOptionValue as f, truncateToWireNamePrefixBytes as g, parseWireName as h, computeCheckContentHash as i, nameOf as l, parseNaming as m, assertWireNamePrefixLength as n, defaultIndexName as o, normalizeSqlBody as p, composeCheckWirePrefix as r, derivedCheckPrefixes as s, WIRE_NAME_PREFIX_MAX_BYTES as t, namingOf as u };\n\n//# sourceMappingURL=naming-DKr4TJd7.mjs.map"],"mappings":";;;;AAIA,SAAS,iBAAiB,WAAW,SAAS;CAC7C,OAAO,GAAG,UAAU,GAAG,QAAQ,KAAK,GAAG,EAAE;AAC1C;;AAEA,SAAS,OAAO,QAAQ;CACvB,OAAO,OAAO,SAAS,SAAS,eAAe,OAAO,QAAQ,OAAO,IAAI,IAAI,OAAO;AACrF;;;;;;;;AAQA,SAAS,SAAS,MAAM,QAAQ;CAC/B,IAAI,WAAW,KAAK,GAAG,OAAO;EAC7B,MAAM;EACN;CACD;CACA,OAAO;EACN,MAAM;EACN;EACA,MAAM,KAAK,MAAM,OAAO,SAAS,CAAC;CACnC;AACD;;;;;;AAMA,SAAS,YAAY,MAAM,QAAQ;CAClC,IAAI,WAAW,KAAK,GAAG,OAAO;EAC7B,MAAM;EACN;CACD;CACA,MAAM,SAAS,cAAc,IAAI;CACjC,IAAI,WAAW,KAAK,KAAK,OAAO,WAAW,QAAQ,MAAM,IAAI,wBAAwB,IAAI,KAAK,aAAa,OAAO,4CAA4C,eAAe,QAAQ,QAAQ,EAAE,MAAM,SAAS;CAC9M,OAAO;EACN,MAAM;EACN,QAAQ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Q;CACZ,KAAK,MAAM,aAAa,QAAQ;EAC/B,MAAM,OAAO,WAAW,SAAS;EACjC,IAAI,QAAQ,OAAO,IAAI;EACvB,OAAO;EACP,SAAS;CACV;CACA,OAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"naming-Cc_t1q6s-CouBOmqZ.mjs","names":[],"sources":["../../../../2-sql/1-core/schema-ir/dist/naming-Cc_t1q6s.mjs"],"sourcesContent":["import { structuredError } from \"@internal/utils/structured-error\";\nimport { createHash } from \"node:crypto\";\nimport { ContractValidationError } from \"@internal/contract/contract-validation-error\";\n//#region src/naming.ts\nfunction defaultIndexName(tableName, columns) {\n\treturn `${tableName}_${columns.join(\"_\")}_idx`;\n}\n/** The flat name the union describes. Inverse of {@link namingOf}. */\nfunction nameOf(naming) {\n\treturn naming.kind === \"wire\" ? formatWireName(naming.prefix, naming.hash) : naming.name;\n}\n/**\n* The naming a name-identified node was built with, read back off the flat\n* pair it stores. Inverse of {@link nameOf}, and total for that\n* reason: the constructor derived `name` from the union, so the two agree.\n* Flat data arriving from outside the process goes through\n* {@link parseNaming} instead.\n*/\nfunction namingOf(name, prefix) {\n\tif (prefix === void 0) return {\n\t\tkind: \"exact\",\n\t\tname\n\t};\n\treturn {\n\t\tkind: \"wire\",\n\t\tprefix,\n\t\thash: name.slice(prefix.length + 1)\n\t};\n}\n/**\n* Reads naming out of flat stored data — deserialized contract JSON and the\n* literals a user may hand-edit, the one place a name and a prefix can still\n* disagree. Throws when a declared prefix does not parse back out of the name.\n*/\nfunction parseNaming(name, prefix) {\n\tif (prefix === void 0) return {\n\t\tkind: \"exact\",\n\t\tname\n\t};\n\tconst parsed = parseWireName(name);\n\tif (parsed === void 0 || parsed.prefix !== prefix) throw new ContractValidationError(`\"${name}\": prefix \"${prefix}\" does not match the wire name (expected \"${formatWireName(prefix, \"<8hex>\")}\").`, \"storage\");\n\treturn {\n\t\tkind: \"wire\",\n\t\tprefix: parsed.prefix,\n\t\thash: parsed.hash\n\t};\n}\n/**\n* The naming an object read out of a live catalog has: a wire-shaped name\n* gets the wire arm so the rename pass can pair it by prefix, and every\n* other name is exact.\n*\n* The wire answer is a claim about the name's SHAPE only — the hash is\n* deliberately not recomputed from the object's content here. Nothing\n* downstream reads it as more than that: the differ always asks the\n* contract-derived side to choose the comparison, so a shape-only wire\n* claim on the introspected side never suppresses a body comparison, and\n* `contract infer` recomputes the hash independently before it will emit an\n* index as wire-named.\n*/\nfunction namingOfLiveName(name) {\n\tconst wire = parseWireName(name);\n\treturn wire === void 0 ? {\n\t\tkind: \"exact\",\n\t\tname\n\t} : {\n\t\tkind: \"wire\",\n\t\tprefix: wire.prefix,\n\t\thash: wire.hash\n\t};\n}\nconst WIRE_NAME_PATTERN = /^(.+)_([0-9a-f]{8})$/;\n/**\n* Assembles a wire name from its user-supplied prefix and its 8-hex\n* content-hash suffix. This module owns the `<prefix>_<hash>` format on both\n* sides — construction here and parsing in {@link parseWireName} — so the two\n* never drift.\n*/\nfunction formatWireName(prefix, hash) {\n\treturn `${prefix}_${hash}`;\n}\n/**\n* Splits a wire name (`<prefix>_<8hex>`) into its prefix and content-hash\n* suffix. Returns `undefined` when the name does not follow the wire-name\n* shape (e.g. an object created outside the toolchain) — callers treat such\n* names as all-prefix. Consumed by introspection (prefix extraction) and by\n* rename pairing (same hash, different prefix).\n*/\nfunction parseWireName(name) {\n\tconst match = WIRE_NAME_PATTERN.exec(name);\n\tconst prefix = match?.[1];\n\tconst hash = match?.[2];\n\tif (prefix === void 0 || hash === void 0) return void 0;\n\treturn {\n\t\tprefix,\n\t\thash\n\t};\n}\n/**\n* Stabilizes an authored SQL body (index expression, partial-index predicate,\n* RLS policy predicate) for hashing: trim, and collapse runs of internal\n* whitespace to a single space.\n*\n* This is deliberately minimal. The content hash is the equivalence relation\n* for a wire-named object, and the wire name (prefix + hash) is the only\n* thing ever compared — the hash is never recomputed from an introspected\n* body, so there is no need to match the database's reprinted form. Minimal\n* normalization also protects the no-collision property: aggressive rewriting\n* (lowercasing, paren-stripping, cast-alias folding) risks collapsing two\n* distinct bodies onto one hash.\n*\n* The normalizer is a stability commitment: any change re-suffixes all wire names.\n*/\nfunction normalizeSqlBody(sql) {\n\treturn sql.replace(/\\s+/g, \" \").trim();\n}\n/**\n* Returns the first 8 lowercase hex characters of the SHA-256 digest over the\n* canonical content tuple for a check constraint:\n*\n* [normalizeSqlBody(expression)]\n*\n* The predicate is the whole of a check's content — the constraint name,\n* schema, and table are orthogonal to its equivalence. The one-element tuple\n* keeps the encoding in the same shape as the index and RLS tuples so a member\n* can be added later without re-reading which encoding a kind uses.\n*\n* The tuple order and encoding are a stability commitment: any change\n* re-suffixes every wire name.\n*/\nfunction computeCheckContentHash(expression) {\n\tconst tuple = JSON.stringify([normalizeSqlBody(expression)]);\n\treturn createHash(\"sha256\").update(tuple).digest(\"hex\").slice(0, 8);\n}\n/** The trailing segment a check's wire-name prefix carries, per kind. */\nconst CHECK_KIND_SUFFIX = {\n\tmembership: \"check\",\n\telementNotNull: \"elem_not_null\"\n};\n/**\n* Composes the wire-name prefix of a derived CHECK constraint:\n* `${table}_${column}_${kindSuffix}`, capped at the wire-name byte budget.\n* Shared by contract authoring (naming emitted checks) and `contract infer`\n* (recomputing the name a derived check would carry), so truncated and\n* multibyte prefixes match by construction.\n*/\nfunction composeCheckWirePrefix(tableName, columnName, kind) {\n\treturn truncateToWireNamePrefixBytes(`${tableName}_${columnName}_${CHECK_KIND_SUFFIX[kind]}`);\n}\n/**\n* Every {@link CheckKind} value, read off {@link CHECK_KIND_SUFFIX}'s own keys\n* so the enumeration can never drift out of step with it.\n*/\nconst CHECK_KINDS = Object.keys(CHECK_KIND_SUFFIX).filter((kind) => kind in CHECK_KIND_SUFFIX);\n/**\n* The wire-name prefixes derivation could produce for `tableName`: every\n* {@link composeCheckWirePrefix} result crossing each of `columnNames` with\n* each {@link CheckKind}. A check is derived iff its prefix is a member of\n* this set.\n*\n* This is the prefix SHAPE only, not the full name-with-hash: it does not\n* know which kind a specific column's type would actually derive (that needs\n* the target's `renderCheckExpressions` hook, which callers of this function\n* do not have in hand), so every column is conservatively treated as capable\n* of producing every kind.\n*/\nfunction derivedCheckPrefixes(tableName, columnNames) {\n\tconst prefixes = /* @__PURE__ */ new Set();\n\tfor (const columnName of columnNames) for (const kind of CHECK_KINDS) prefixes.add(composeCheckWirePrefix(tableName, columnName, kind));\n\treturn prefixes;\n}\n/**\n* Returns the first 8 lowercase hex characters of the SHA-256 digest over the\n* canonical content tuple for an index:\n*\n* [normalizeSqlBody(expression), normalizeSqlBody(where), columns, unique, type, sortedOptions]\n*\n* Columns hash in authored order — column order is semantic in an index.\n* Option values are `String()`-coerced (matching the loose option equality\n* used for diffing) so a hash computed from typed contract values agrees with\n* one recomputed from introspected reloptions strings. The prefix, schema,\n* and table are excluded (they are orthogonal to index equivalence).\n*\n* The tuple order and encoding are a stability commitment with the same\n* status as the RLS tuple: any change re-suffixes every wire name.\n*/\n/**\n* Canonicalizes one index option VALUE to the `on`/`off` boolean spelling:\n* JS booleans and the common catalog spellings (`pg_class.reloptions`\n* stores whatever spelling the DDL used, so a live index may carry\n* `'true'`/`'false'` or `'on'`/`'off'`) all map to one form; everything\n* else via `String()` (fully specified for numbers, so no platform\n* variance). Shared by the wire-name hash tuple, the node's option\n* equality, and the DDL renderer, so an authored `{ fastupdate: true }`\n* agrees with a live index created under any boolean spelling.\n*/\nfunction normalizeIndexOptionValue(value) {\n\tif (value === true || value === \"true\" || value === \"on\") return \"on\";\n\tif (value === false || value === \"false\" || value === \"off\") return \"off\";\n\treturn String(value);\n}\nfunction computeIndexContentHash(parts) {\n\tconst sortedOptions = Object.entries(parts.options ?? {}).map(([key, value]) => [key, normalizeIndexOptionValue(value)]).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);\n\tconst tuple = JSON.stringify([\n\t\tnormalizeSqlBody(parts.expression ?? \"\"),\n\t\tnormalizeSqlBody(parts.where ?? \"\"),\n\t\tparts.columns ?? [],\n\t\tparts.unique,\n\t\tparts.type ?? \"\",\n\t\tsortedOptions\n\t]);\n\treturn createHash(\"sha256\").update(tuple).digest(\"hex\").slice(0, 8);\n}\n/**\n* Postgres truncates identifiers at `NAMEDATALEN - 1` = 63 **bytes**, not\n* characters, and the wire name appends a 9-byte `_<8hex>` suffix — so a\n* prefix is bounded at 54 bytes. A prefix of non-ASCII characters can sit well\n* under 54 characters and still overrun: the database would silently truncate\n* the name, leaving the declared object permanently unmatchable against the\n* live one.\n*/\nconst WIRE_NAME_PREFIX_MAX_BYTES = 54;\nconst utf8 = new TextEncoder();\n/** UTF-8 byte length — the unit Postgres measures identifiers in. */\nfunction byteLength(value) {\n\treturn utf8.encode(value).length;\n}\n/**\n* Rejects a wire-name prefix over {@link WIRE_NAME_PREFIX_MAX_BYTES}.\n* `subject` opens the error message (e.g. `defineContract: policy prefix`).\n*/\nfunction assertWireNamePrefixLength(prefix, subject) {\n\tif (byteLength(prefix) > 54) throw structuredError(\"CONTRACT.WIRE_NAME_PREFIX_TOO_LONG\", `${subject} \"${prefix}\" exceeds the 54-byte maximum (Postgres identifiers cap at 63 bytes and the wire name appends a 9-byte hash suffix).`, { meta: {\n\t\tprefix,\n\t\tmaxBytes: 54\n\t} });\n}\n/**\n* Shortens a DERIVED wire-name prefix to {@link WIRE_NAME_PREFIX_MAX_BYTES},\n* cutting on a code-point boundary so a multibyte character is never split.\n* Only derived prefixes truncate — an authored one throws\n* ({@link assertWireNamePrefixLength}), because its author can shorten it.\n*/\nfunction truncateToWireNamePrefixBytes(prefix) {\n\tif (byteLength(prefix) <= 54) return prefix;\n\tlet out = \"\";\n\tlet bytes = 0;\n\tfor (const character of prefix) {\n\t\tconst size = byteLength(character);\n\t\tif (bytes + size > 54) break;\n\t\tout += character;\n\t\tbytes += size;\n\t}\n\treturn out;\n}\n//#endregion\nexport { computeIndexContentHash as a, formatWireName as c, namingOfLiveName as d, normalizeIndexOptionValue as f, truncateToWireNamePrefixBytes as g, parseWireName as h, computeCheckContentHash as i, nameOf as l, parseNaming as m, assertWireNamePrefixLength as n, defaultIndexName as o, normalizeSqlBody as p, composeCheckWirePrefix as r, derivedCheckPrefixes as s, WIRE_NAME_PREFIX_MAX_BYTES as t, namingOf as u };\n\n//# sourceMappingURL=naming-Cc_t1q6s.mjs.map"],"mappings":";;;;AAIA,SAAS,iBAAiB,WAAW,SAAS;CAC7C,OAAO,GAAG,UAAU,GAAG,QAAQ,KAAK,GAAG,EAAE;AAC1C;;AAEA,SAAS,OAAO,QAAQ;CACvB,OAAO,OAAO,SAAS,SAAS,eAAe,OAAO,QAAQ,OAAO,IAAI,IAAI,OAAO;AACrF;;;;;;;;AAQA,SAAS,SAAS,MAAM,QAAQ;CAC/B,IAAI,WAAW,KAAK,GAAG,OAAO;EAC7B,MAAM;EACN;CACD;CACA,OAAO;EACN,MAAM;EACN;EACA,MAAM,KAAK,MAAM,OAAO,SAAS,CAAC;CACnC;AACD;;;;;;AAMA,SAAS,YAAY,MAAM,QAAQ;CAClC,IAAI,WAAW,KAAK,GAAG,OAAO;EAC7B,MAAM;EACN;CACD;CACA,MAAM,SAAS,cAAc,IAAI;CACjC,IAAI,WAAW,KAAK,KAAK,OAAO,WAAW,QAAQ,MAAM,IAAI,wBAAwB,IAAI,KAAK,aAAa,OAAO,4CAA4C,eAAe,QAAQ,QAAQ,EAAE,MAAM,SAAS;CAC9M,OAAO;EACN,MAAM;EACN,QAAQ,OAAO;EACf,MAAM,OAAO;CACd;AACD;;;;;;;;;;;;;;AAcA,SAAS,iBAAiB,MAAM;CAC/B,MAAM,OAAO,cAAc,IAAI;CAC/B,OAAO,SAAS,KAAK,IAAI;EACxB,MAAM;EACN;CACD,IAAI;EACH,MAAM;EACN,QAAQ,KAAK;EACb,MAAM,KAAK;CACZ;AACD;AACA,MAAM,oBAAoB;;;;;;;AAO1B,SAAS,eAAe,QAAQ,MAAM;CACrC,OAAO,GAAG,OAAO,GAAG;AACrB;;;;;;;;AAQA,SAAS,cAAc,MAAM;CAC5B,MAAM,QAAQ,kBAAk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,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,0BAA0B,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC;CACtK,MAAM,QAAQ,KAAK,UAAU;EAC5B,iBAAiB,MAAM,cAAc,EAAE;EACvC,iBAAiB,MAAM,SAAS,EAAE;EAClC,MAAM,WAAW,CAAC;EAClB,MAAM;EACN,MAAM,QAAQ;EACd;CACD,CAAC;CACD,OAAO,WAAW,QAAQ,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC;AACnE;;;;;;;;;AASA,MAAM,6BAA6B;AACnC,MAAM,OAAO,IAAI,YAAY;;AAE7B,SAAS,WAAW,OAAO;CAC1B,OAAO,KAAK,OAAO,KAAK,CAAC,CAAC;AAC3B;;;;;AAKA,SAAS,2BAA2B,QAAQ,SAAS;CACpD,IAAI,WAAW,MAAM,IAAI,IAAI,MAAM,gBAAgB,sCAAsC,GAAG,QAAQ,IAAI,OAAO,uHAAuH,EAAE,MAAM;EAC7O;EACA,UAAU;CACX,EAAE,CAAC;AACJ;;;;;;;AAOA,SAAS,8BAA8B,QAAQ;CAC9C,IAAI,WAAW,MAAM,KAAK,IAAI,OAAO;CACrC,IAAI,MAAM;CACV,IAAI,QAAQ;CACZ,KAAK,MAAM,aAAa,QAAQ;EAC/B,MAAM,OAAO,WAAW,SAAS;EACjC,IAAI,QAAQ,OAAO,IAAI;EACvB,OAAO;EACP,SAAS;CACV;CACA,OAAO;AACR"}
|
package/dist/orm-client.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ import { c as SqlStorage } from "./sql-storage-8LqxeLAY-DH4DdUXx.mjs";
|
|
|
3
3
|
import { f as ExtractFieldOutputTypes, l as ExtractAggregateTypes, p as ExtractQueryOperationTypes, u as ExtractCodecTypes } from "./types-BDUG29Df-LE85dIXP.mjs";
|
|
4
4
|
import "./types-C36_3E6_.mjs";
|
|
5
5
|
import { E as CodecRef$1, Rt as WhereArg, _ as BinaryExpr, _t as OrderByItem, a as AndExpr, c as AnyExpression, gt as OrExpr, mt as NullCheckExpr, r as AggregateFn, st as LimitOffsetValue, vt as OrderByNulls } from "./types-Yui2yFf6-TP-oRDTX.mjs";
|
|
6
|
-
import "./ast-
|
|
6
|
+
import "./ast-DQU1yUQ5.mjs";
|
|
7
7
|
import { n as SqlQueryPlan, t as Preparable } from "./plan-B7g2kDfQ-Bw0784x6.mjs";
|
|
8
8
|
import { S as TraitExpression, i as CodecTypesBase, o as Expression } from "./expression-BPoA5eEl.mjs";
|
|
9
9
|
import "./plan-DiT00Rg8.mjs";
|
|
@@ -11,8 +11,8 @@ import { n as ExecutionContext } from "./query-lane-context-D6o9YrEV-bouFPM6u.mj
|
|
|
11
11
|
import "./query-lane-context-BcXiJasG.mjs";
|
|
12
12
|
import { h as RuntimeScope, o as ComputeColumnJsType } from "./types-DFJNPLXY-vp6AGe5e.mjs";
|
|
13
13
|
import "./types-BvTYXSiS.mjs";
|
|
14
|
-
import { C as RuntimeQueryable$1, c as ParamsFromDeclaration, f as PreparedFor, p as PreparedStatement, r as Declaration, t as BindSiteParams, v as Runtime } from "./prepared-statement-BHSj2pDk-
|
|
15
|
-
import "./index-
|
|
14
|
+
import { C as RuntimeQueryable$1, c as ParamsFromDeclaration, f as PreparedFor, p as PreparedStatement, r as Declaration, t as BindSiteParams, v as Runtime } from "./prepared-statement-BHSj2pDk-BL0wOCnq.mjs";
|
|
15
|
+
import "./index-yNeNt2GO.mjs";
|
|
16
16
|
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
17
17
|
import { AnnotationValue, AsyncIterableResult, MetaBuilder, OperationKind, ResultType, RuntimeExecuteOptions } from "@prisma/orm-framework/components/runtime";
|
|
18
18
|
import { SimplifyDeep } from "@prisma/orm-framework/utils/simplify-deep";
|
package/dist/orm-client.mjs
CHANGED
|
@@ -2,9 +2,9 @@ import { t as resolveStorageTable } from "./resolve-storage-table-DZsfnzeW.mjs";
|
|
|
2
2
|
import { i as isUniqueConstraintViolation } from "./dist-x6jvtkKM.mjs";
|
|
3
3
|
import { C as LiteralExpr, D as OrExpr, F as SubqueryExpr, G as isWhereExpr, I as TableSource, L as UpdateAst, O as OrderByItem, P as SelectAst, R as WindowFuncExpr, S as ListExpression, T as NullCheckExpr, U as isOrderByNulls, V as isAggregateFn, _ as InsertAst, b as JsonArrayAggExpr, c as DeleteAst, f as EqColJoinOn, j as ProjectionItem, k as ParamRef, l as DerivedTableSource, n as AndExpr, o as ColumnRef, p as ExistsExpr, r as BinaryExpr, s as DefaultValueExpr, t as AggregateExpr, v as InsertOnConflict, w as NotExpr, x as JsonObjectExpr, y as JoinAst } from "./types-BPi4d3WI-D8PIEqBU.mjs";
|
|
4
4
|
import { t as collectOrderedParamRefs } from "./util-DQQgv2j1-D6INZaRG.mjs";
|
|
5
|
-
import { n as JsonDocumentProjection, r as NativeJsonValueProjection, t as CodecJsonValueProjection } from "./ast-
|
|
5
|
+
import { n as JsonDocumentProjection, r as NativeJsonValueProjection, t as CodecJsonValueProjection } from "./ast-CJd4157-.mjs";
|
|
6
6
|
import { i as isExpression, o as toExpr } from "./expression-vAEOvq7J.mjs";
|
|
7
|
-
import { n as codecRefForStorageColumn } from "./codec-descriptor-registry-
|
|
7
|
+
import { n as codecRefForStorageColumn } from "./codec-descriptor-registry-Cj-tqpFL.mjs";
|
|
8
8
|
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
9
9
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
10
10
|
import { domainModelsAtDefaultNamespace } from "@prisma/orm-framework/contract/types";
|
|
@@ -3,7 +3,7 @@ import "./types-C36_3E6_.mjs";
|
|
|
3
3
|
import { r as SqlOperationDescriptors } from "./index-Cef8iy1o.mjs";
|
|
4
4
|
import { At as SqlCodecCallContext, E as CodecRef$1, S as Codec$1, dt as LoweredStatement, h as AnyQueryAst, k as ContractCodecRegistry, ut as LoweredParam } from "./types-Yui2yFf6-TP-oRDTX.mjs";
|
|
5
5
|
import { c as SqlQueryable, i as SqlDriver, l as SqlStatementStats, r as SqlConnection } from "./driver-types-BQtRkOJ0-Bv2RPSfr.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { l as MarkerReadResult, t as Adapter } from "./ast-DQU1yUQ5.mjs";
|
|
7
7
|
import { n as SqlQueryPlan } from "./plan-B7g2kDfQ-Bw0784x6.mjs";
|
|
8
8
|
import { a as CodecValue, i as CodecTypesBase, l as RawCodecInferer, o as Expression, t as AffectedCount } from "./expression-BPoA5eEl.mjs";
|
|
9
9
|
import { t as SqlExecutionPlan } from "./sql-execution-plan-Db0j752I-CI5WbdLi.mjs";
|
|
@@ -513,4 +513,4 @@ declare class PreparedExecutionImpl<Params> implements PreparedExecution<Params>
|
|
|
513
513
|
}
|
|
514
514
|
//#endregion
|
|
515
515
|
export { SqlRuntimeAdapterDescriptor as A, VerifyMarkerOption as B, RuntimeQueryable as C, SqlExecutionStackWithDriver as D, SqlExecutionStack as E, SqlRuntimeExtensionInstance as F, preparedStatementExecute as G, createSqlExecutionStack as H, SqlRuntimeTargetDescriptor as I, preparedStatementQuery as K, SqlStaticContributions as L, SqlRuntimeBase as M, SqlRuntimeDriverInstance as N, SqlMiddleware as O, SqlRuntimeExtensionDescriptor as P, TelemetryOutcome as R, RuntimeParameterizedCodecDescriptor as S, RuntimeTransaction as T, deriveParamMetadata as U, createExecutionContext as V, encodeParamsWithMetadata as W, PreparedStatementQueryTarget as _, DeclaredNullable as a, RuntimeFamilyAdapter as b, ParamsFromDeclaration as c, PreparedExecutionImpl as d, PreparedFor as f, PreparedStatementInternals as g, PreparedStatementImpl as h, DeclaredCodecId as i, SqlRuntimeAdapterInstance as j, SqlMiddlewareContext as k, PrepareCallback as l, PreparedStatementExecuteTarget as m, ConnectionProvider as n, MarkerReader as o, PreparedStatement as p, withTransaction as q, Declaration as r, ParamSpec as s, BindSiteParams as t, PreparedExecution as u, Runtime as v, RuntimeTelemetryEvent as w, RuntimeOptions as x, RuntimeConnection as y, TransactionContext as z };
|
|
516
|
-
//# sourceMappingURL=prepared-statement-BHSj2pDk-
|
|
516
|
+
//# sourceMappingURL=prepared-statement-BHSj2pDk-BL0wOCnq.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepared-statement-BHSj2pDk-
|
|
1
|
+
{"version":3,"file":"prepared-statement-BHSj2pDk-BL0wOCnq.d.mts","names":[],"sources":["../../../../2-sql/5-runtime/dist/prepared-statement-BHSj2pDk.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;UAaU;WACC,OAAO;WACP;;iBAEM,oBAAoB,KAAK,uBAAuB;iBAChD,yBAAyB,4BAA4B,mBAAmB,iBAAiB,KAAK,qBAAqB,iBAAiB,wBAAwB;;;UAGnK,6BAA6B;WAC5B,UAAU,SAAS;;;;;;UAMpB;WACC,KAAK;WACL,MAAM;;UAEP,cAAc,kBAAkB,0BAA0B,iCAAiC,kBAAkB,kBAAkB,mBAAmB;WACjJ;;;;;;;;;;;;;;;;;;;EAmBT,eAAe,OAAO,WAAW,KAAK,uBAAuB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BrE,aAAa,MAAM,kBAAkB,KAAK,sBAAsB,SAAS,mBAAmB,oBAAoB;EAChH,gBAAgB,MAAM,kBAAkB,KAAK,uBAAuB,QAAQ;EAC5E,OAAO,KAAK,yBAAyB,MAAM,kBAAkB,KAAK,uBAAuB;EACzF,YAAY,MAAM,kBAAkB,QAAQ,kBAAkB,KAAK,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;EA0B1F,eAAe,MAAM,kBAAkB,KAAK,sBAAsB,SAAS,mBAAmB,oBAAoB;EAClH,kBAAkB,MAAM,kBAAkB,KAAK,uBAAuB,QAAQ;EAC9E,cAAc,MAAM,kBAAkB,QAAQ,oBAAoB,KAAK,uBAAuB;;;;KAI3F;EACH;EACA;;KAEG,eAAe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|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { m as defaultInCanonicalForm } from "./types-yyhkYQNT-Dmoq-giA.mjs";
|
|
2
|
+
import { S as escapePslString, T as numeralText } from "./ast-CJd4157-.mjs";
|
|
2
3
|
import { isDataTypeLoweringEntry } from "@prisma/orm-framework/components/authoring";
|
|
3
4
|
import { dataTypeId } from "@prisma/orm-framework/components/codec";
|
|
4
5
|
//#region ../../../2-sql/9-family/dist/psl-build.mjs
|
|
@@ -187,10 +188,12 @@ function writeListCast(value, columnDataType, dataTypes, surface) {
|
|
|
187
188
|
}
|
|
188
189
|
return `[${parts.join(", ")}]`;
|
|
189
190
|
}
|
|
190
|
-
function writeDefaultLiteral(
|
|
191
|
-
if (
|
|
191
|
+
function writeDefaultLiteral(stored, options) {
|
|
192
|
+
if (stored instanceof Date) return void 0;
|
|
192
193
|
const { dataTypeEntries, dataTypes, columnDataType } = options ?? {};
|
|
193
194
|
if (dataTypeEntries === void 0 || dataTypes === void 0 || columnDataType === void 0) return;
|
|
195
|
+
const { value } = defaultInCanonicalForm(stored, dataTypes.get(columnDataType)?.toCanonicalForm, options?.list === true);
|
|
196
|
+
if (value instanceof Date) return void 0;
|
|
194
197
|
const surface = writingSurface(dataTypeEntries);
|
|
195
198
|
if (options?.list === true) {
|
|
196
199
|
if (!Array.isArray(value)) return void 0;
|
|
@@ -221,4 +224,4 @@ function sameForm(left, right) {
|
|
|
221
224
|
//#endregion
|
|
222
225
|
export { mapDefault as t };
|
|
223
226
|
|
|
224
|
-
//# sourceMappingURL=psl-build-
|
|
227
|
+
//# sourceMappingURL=psl-build-SOpIFu24.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"psl-build-SOpIFu24.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/psl-build.mjs"],"sourcesContent":["import { s as toEnumMemberName } from \"./psl-names-C3cwe0rg.mjs\";\nimport { isDataTypeLoweringEntry } from \"@internal/framework-components/authoring\";\nimport { defaultInCanonicalForm } from \"@internal/sql-schema-ir/types\";\nimport { dataTypeId } from \"@internal/framework-components/codec\";\nimport { escapePslString, numeralText } from \"@internal/sql-relational-core/ast\";\n//#region src/core/psl-build/default-mapping.ts\nconst DEFAULT_FUNCTION_ATTRIBUTES = {\n\t\"autoincrement()\": \"@default(autoincrement())\",\n\t\"now()\": \"@default(now())\"\n};\n/**\n* The attribute a stored default prints as: a named function, a literal the column takes, or any\n* other expression as a raw SQL tagged literal. `undefined` when a literal has no written form.\n*/\nfunction mapDefault(columnDefault, options) {\n\tswitch (columnDefault.kind) {\n\t\tcase \"literal\": {\n\t\t\tconst text = writeDefaultLiteral(columnDefault.value, options);\n\t\t\treturn text === void 0 ? void 0 : { attribute: `@default(${text})` };\n\t\t}\n\t\tcase \"function\": return { attribute: options?.functionAttributes?.[columnDefault.expression] ?? DEFAULT_FUNCTION_ATTRIBUTES[columnDefault.expression] ?? `@default(${sqlLiteralText(columnDefault.expression)})` };\n\t}\n}\n/**\n* A raw SQL default as a `sql` tagged literal. The backtick fence resolves only `` \\` `` and `\\\\`,\n* so a body holding a backtick is written inside the double-quote fence with PSL string escaping.\n*/\nfunction sqlLiteralText(expression) {\n\tif (expression.includes(\"`\")) return `sql\"${escapePslString(expression)}\"`;\n\treturn `sql\\`${expression.replace(/\\\\/g, \"\\\\\\\\\")}\\``;\n}\nfunction writingSurface(entries) {\n\tconst entryOf = /* @__PURE__ */ new Map();\n\tlet classify;\n\tlet plainStringType;\n\tlet plainBooleanType;\n\tconst tagTypes = [];\n\tfor (const [key, entry] of Object.entries(entries)) {\n\t\tif (isDataTypeLoweringEntry(entry)) continue;\n\t\tconst written = entry.written;\n\t\tif (written.kind === \"tag\") {\n\t\t\tentryOf.set(key, entry);\n\t\t\ttagTypes.push(dataTypeId(key));\n\t\t\tcontinue;\n\t\t}\n\t\tif (written.syntax === \"number\") {\n\t\t\tclassify = written.classify;\n\t\t\tfor (const type of written.types) entryOf.set(type, entry);\n\t\t\tcontinue;\n\t\t}\n\t\tentryOf.set(key, entry);\n\t\tif (written.syntax === \"string\") plainStringType = dataTypeId(key);\n\t\telse plainBooleanType = dataTypeId(key);\n\t}\n\treturn {\n\t\tentryOf,\n\t\tclassify,\n\t\tplainStringType,\n\t\tplainBooleanType,\n\t\ttagTypes\n\t};\n}\n/**\n* Every type the stored form could be a value of, in the order a written value would be read: a\n* number or numeral text through the classifier first, then the plain syntax that matches the\n* shape, then each tag, whose canonical form is a whole document.\n*/\nfunction classifications(value, surface) {\n\tconst found = [];\n\tif (typeof value === \"number\") {\n\t\tconst classified = surface.classify?.(numeralText(value));\n\t\treturn classified === void 0 ? [] : [classified];\n\t}\n\tif (typeof value === \"boolean\") return surface.plainBooleanType === void 0 ? [] : [{\n\t\ttype: surface.plainBooleanType,\n\t\tvalue\n\t}];\n\tif (typeof value === \"string\") {\n\t\tconst classified = surface.classify?.(value);\n\t\tif (classified !== void 0) found.push(classified);\n\t\tif (surface.plainStringType !== void 0) found.push({\n\t\t\ttype: surface.plainStringType,\n\t\t\tvalue\n\t\t});\n\t}\n\tfor (const type of surface.tagTypes) found.push({\n\t\ttype,\n\t\tvalue\n\t});\n\treturn found;\n}\n/** The stored form the column takes this value as, or `undefined` when its type takes no such value. */\nfunction admitted(candidate, columnDataType, dataTypes) {\n\tif (candidate.type === columnDataType) return candidate.value;\n\tconst cast = dataTypes.get(columnDataType)?.casts[candidate.type];\n\tif (cast === void 0) return void 0;\n\ttry {\n\t\treturn cast(candidate.value);\n\t} catch {\n\t\treturn;\n\t}\n}\n/** The body of the literal: what the entry prints, before the syntax that fences it. */\nfunction printedBody(entry, value) {\n\ttry {\n\t\treturn entry.print(value);\n\t} catch {\n\t\treturn;\n\t}\n}\n/** What the entry reads the printed body back as, which for a number is the classifier's answer. */\nfunction readBack(entry, type, body) {\n\tconst written = entry.written;\n\ttry {\n\t\treturn written.kind === \"plain\" && written.syntax === \"number\" ? written.classify(body) : {\n\t\t\ttype,\n\t\t\tvalue: written.parse(body)\n\t\t};\n\t} catch {\n\t\treturn;\n\t}\n}\n/**\n* The literal as PSL source. A tag body sits inside a backtick fence, which resolves `` \\` `` and\n* `\\\\` and nothing else, so a `\\n` in the body survives as the two characters the entry wrote.\n*/\nfunction literalText(entry, body) {\n\tconst written = entry.written;\n\tif (written.kind === \"tag\") {\n\t\tconst fenced = body.replace(/\\\\/g, \"\\\\\\\\\").replace(/`/g, \"\\\\`\");\n\t\treturn `${written.tag}\\`${fenced}\\``;\n\t}\n\treturn written.syntax === \"string\" ? `\"${escapePslString(body)}\"` : body;\n}\n/**\n* The value written as the literal of one of its types, proven by reading the text straight back:\n* the same entry, the same cast, and the stored form again.\n*/\nfunction writeScalar(value, columnDataType, dataTypes, surface) {\n\tfor (const candidate of classifications(value, surface)) {\n\t\tconst entry = surface.entryOf.get(candidate.type);\n\t\tif (entry === void 0) continue;\n\t\tconst stored = admitted(candidate, columnDataType, dataTypes);\n\t\tif (stored === void 0 || !sameForm(stored, value)) continue;\n\t\tconst body = printedBody(entry, candidate.value);\n\t\tif (body === void 0) continue;\n\t\tconst reread = readBack(entry, candidate.type, body);\n\t\tif (reread === void 0) continue;\n\t\tconst restored = admitted(reread, columnDataType, dataTypes);\n\t\tif (restored === void 0 || !sameForm(restored, value)) continue;\n\t\treturn literalText(entry, body);\n\t}\n}\n/** One written element of a list, printed as a value of any type, with no column type to admit it. */\nfunction writeElement(value, of, surface) {\n\tfor (const candidate of classifications(value, surface)) {\n\t\tif (!of.includes(candidate.type)) continue;\n\t\tconst entry = surface.entryOf.get(candidate.type);\n\t\tif (entry === void 0) continue;\n\t\tconst body = printedBody(entry, candidate.value);\n\t\tif (body === void 0) continue;\n\t\tconst reread = readBack(entry, candidate.type, body);\n\t\tif (reread === void 0 || !of.includes(reread.type)) continue;\n\t\treturn {\n\t\t\ttext: literalText(entry, body),\n\t\t\tvalue: reread.value\n\t\t};\n\t}\n}\n/**\n* A written list on a scalar column, which the column type's list cast turns into its one value.\n* Each element is classified on its own and must be of a type the cast takes.\n*/\nfunction writeListCast(value, columnDataType, dataTypes, surface) {\n\tconst listCast = dataTypes.get(columnDataType)?.listCast;\n\tif (listCast === void 0) return void 0;\n\tconst parts = [];\n\tconst elements = [];\n\tfor (const element of value) {\n\t\tconst written = writeElement(element, listCast.of, surface);\n\t\tif (written === void 0) return void 0;\n\t\tparts.push(written.text);\n\t\telements.push(written.value);\n\t}\n\ttry {\n\t\tif (!sameForm(listCast.cast(elements), value)) return void 0;\n\t} catch {\n\t\treturn;\n\t}\n\treturn `[${parts.join(\", \")}]`;\n}\nfunction writeDefaultLiteral(stored, options) {\n\tif (stored instanceof Date) return void 0;\n\tconst { dataTypeEntries, dataTypes, columnDataType } = options ?? {};\n\tif (dataTypeEntries === void 0 || dataTypes === void 0 || columnDataType === void 0) return;\n\tconst { value } = defaultInCanonicalForm(stored, dataTypes.get(columnDataType)?.toCanonicalForm, options?.list === true);\n\tif (value instanceof Date) return void 0;\n\tconst surface = writingSurface(dataTypeEntries);\n\tif (options?.list === true) {\n\t\tif (!Array.isArray(value)) return void 0;\n\t\tconst parts = [];\n\t\tfor (const element of value) {\n\t\t\tconst written = writeScalar(element, columnDataType, dataTypes, surface);\n\t\t\tif (written === void 0) return void 0;\n\t\t\tparts.push(written);\n\t\t}\n\t\treturn `[${parts.join(\", \")}]`;\n\t}\n\tconst written = writeScalar(value, columnDataType, dataTypes, surface);\n\tif (written !== void 0) return written;\n\treturn Array.isArray(value) ? writeListCast(value, columnDataType, dataTypes, surface) : void 0;\n}\n/** Whether two canonical forms are the same JSON value, member by member and element by element. */\nfunction sameForm(left, right) {\n\tif (left === right) return true;\n\tif (Array.isArray(left) !== Array.isArray(right)) return false;\n\tif (typeof left !== \"object\" || typeof right !== \"object\" || left === null || right === null) return false;\n\tconst members = Object.entries(left);\n\tconst others = new Map(Object.entries(right));\n\treturn members.length === others.size && members.every(([key, member]) => {\n\t\tconst other = others.get(key);\n\t\treturn other !== void 0 && sameForm(member, other);\n\t});\n}\n//#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KAAK,OAAO;EACnB;EACA,OAAO,IAAI,MAAM,KAAK,IAAI,EAAE;CAC7B;CACA,MAAM,UAAU,YAAY,OAAO,gBAAgB,WAAW,OAAO;CACrE,IAAI,YAAY,KAAK,GAAG,OAAO;CAC/B,OAAO,MAAM,QAAQ,KAAK,IAAI,cAAc,OAAO,gBAAgB,WAAW,OAAO,IAAI,KAAK;AAC/F;;AAEA,SAAS,SAAS,MAAM,OAAO;CAC9B,IAAI,SAAS,OAAO,OAAO;CAC3B,IAAI,MAAM,QAAQ,IAAI,MAAM,MAAM,QAAQ,KAAK,GAAG,OAAO;CACzD,IAAI,OAAO,SAAS,YAAY,OAAO,UAAU,YAAY,SAAS,QAAQ,UAAU,MAAM,OAAO;CACrG,MAAM,UAAU,OAAO,QAAQ,IAAI;CACnC,MAAM,SAAS,IAAI,IAAI,OAAO,QAAQ,KAAK,CAAC;CAC5C,OAAO,QAAQ,WAAW,OAAO,QAAQ,QAAQ,OAAO,CAAC,KAAK,YAAY;EACzE,MAAM,QAAQ,OAAO,IAAI,GAAG;EAC5B,OAAO,UAAU,KAAK,KAAK,SAAS,QAAQ,KAAK;CAClD,CAAC;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as isBackedByColumnKeys, t as backingIndexColumnKeys } from "./foreign-key-materialization-
|
|
1
|
+
import { n as isBackedByColumnKeys, t as backingIndexColumnKeys } from "./foreign-key-materialization-DiOhEeAz.mjs";
|
|
2
2
|
import { t as defaultTableName } from "./default-table-name-BfFY8qYR-lHNcVmY5.mjs";
|
|
3
3
|
import { a as snakeToCamelCase, i as needsEscaping, n as escapeName, o as snakeToPascalCase, r as hasSeparators, t as escapeIfNeeded } from "./psl-names-C3cwe0rg-CsuHOV7E.mjs";
|
|
4
4
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
@@ -192,4 +192,4 @@ function addRelationField(map, tableName, field) {
|
|
|
192
192
|
//#endregion
|
|
193
193
|
export { pluralize as a, toModelName as c, inferRelations as i, deriveBackRelationFieldName as n, toEnumName as o, deriveRelationFieldName as r, toFieldName as s, buildChildRelationField as t };
|
|
194
194
|
|
|
195
|
-
//# sourceMappingURL=psl-infer-
|
|
195
|
+
//# sourceMappingURL=psl-infer-8kKfa-Ts.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"psl-infer-DwMyO-IV.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/psl-infer.mjs"],"sourcesContent":["import { a as snakeToCamelCase, i as needsEscaping, n as escapeName, o as snakeToPascalCase, r as hasSeparators, t as escapeIfNeeded } from \"./psl-names-C3cwe0rg.mjs\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { defaultTableName } from \"@internal/sql-contract-psl/default-table-name\";\nimport pluralizeLib from \"pluralize\";\nimport { backingIndexColumnKeys, isBackedByColumnKeys } from \"@internal/sql-contract/foreign-key-materialization\";\n//#region src/core/psl-contract-infer/name-transforms.ts\nfunction toModelName(tableName) {\n\tlet name;\n\tif (hasSeparators(tableName)) name = snakeToPascalCase(tableName);\n\telse name = tableName.charAt(0).toUpperCase() + tableName.slice(1);\n\tif (needsEscaping(name)) return {\n\t\tname: escapeName(name),\n\t\tmap: tableName\n\t};\n\tif (defaultTableName(name) !== tableName) return {\n\t\tname,\n\t\tmap: tableName\n\t};\n\treturn { name };\n}\nfunction toFieldName(columnName) {\n\tlet name;\n\tif (hasSeparators(columnName)) name = snakeToCamelCase(columnName);\n\telse name = columnName.charAt(0).toLowerCase() + columnName.slice(1);\n\tif (needsEscaping(name)) return {\n\t\tname: escapeName(name),\n\t\tmap: columnName\n\t};\n\tif (name !== columnName) return {\n\t\tname,\n\t\tmap: columnName\n\t};\n\treturn { name };\n}\nfunction toEnumName(pgTypeName) {\n\tlet name;\n\tif (hasSeparators(pgTypeName)) name = snakeToPascalCase(pgTypeName);\n\telse name = pgTypeName.charAt(0).toUpperCase() + pgTypeName.slice(1);\n\tif (needsEscaping(name)) return {\n\t\tname: escapeName(name),\n\t\tmap: pgTypeName\n\t};\n\tif (name !== pgTypeName) return {\n\t\tname,\n\t\tmap: pgTypeName\n\t};\n\treturn { name };\n}\nfunction pluralize(word) {\n\treturn pluralizeLib.plural(word);\n}\nfunction deriveRelationFieldName(fkColumns, referencedTableName) {\n\tif (fkColumns.length === 1) {\n\t\tconst [col = referencedTableName] = fkColumns;\n\t\tconst stripped = col.replace(/_id$/i, \"\").replace(/Id$/, \"\");\n\t\tif (stripped.length > 0 && stripped !== col) return escapeIfNeeded(snakeToCamelCase(stripped));\n\t\treturn escapeIfNeeded(snakeToCamelCase(referencedTableName));\n\t}\n\treturn escapeIfNeeded(snakeToCamelCase(referencedTableName));\n}\nfunction deriveBackRelationFieldName(childModelName, isOneToOne) {\n\tconst base = childModelName.charAt(0).toLowerCase() + childModelName.slice(1);\n\treturn isOneToOne ? base : pluralize(base);\n}\n//#endregion\n//#region src/core/psl-contract-infer/relation-inference.ts\nconst DEFAULT_ON_DELETE = \"noAction\";\nconst DEFAULT_ON_UPDATE = \"noAction\";\nconst REFERENTIAL_ACTION_PSL = {\n\tnoAction: \"NoAction\",\n\trestrict: \"Restrict\",\n\tcascade: \"Cascade\",\n\tsetNull: \"SetNull\",\n\tsetDefault: \"SetDefault\"\n};\nfunction inferRelations(tables, modelNameMap) {\n\tconst relationsByTable = /* @__PURE__ */ new Map();\n\tconst fkCountByPair = /* @__PURE__ */ new Map();\n\tfor (const table of Object.values(tables)) for (const fk of table.foreignKeys) {\n\t\tconst pairKey = `${table.name}→${fk.referencedTable}`;\n\t\tfkCountByPair.set(pairKey, (fkCountByPair.get(pairKey) ?? 0) + 1);\n\t}\n\tconst usedFieldNames = /* @__PURE__ */ new Map();\n\tfor (const table of Object.values(tables)) {\n\t\tconst names = /* @__PURE__ */ new Set();\n\t\tfor (const col of Object.values(table.columns)) names.add(col.name);\n\t\tusedFieldNames.set(table.name, names);\n\t}\n\tfor (const table of Object.values(tables)) for (const fk of table.foreignKeys) {\n\t\tconst childTableName = table.name;\n\t\tconst parentTableName = fk.referencedTable;\n\t\tconst childUsed = usedFieldNames.get(childTableName);\n\t\tif (childUsed === void 0) throw new InternalError(`Missing inferred field-name set for table \"${childTableName}\"`);\n\t\tconst childModelName = modelNameMap.get(childTableName) ?? childTableName;\n\t\tconst parentModelName = modelNameMap.get(parentTableName) ?? parentTableName;\n\t\tconst pairKey = `${childTableName}→${parentTableName}`;\n\t\tconst isSelfRelation = childTableName === parentTableName;\n\t\tconst needsRelationName = (fkCountByPair.get(pairKey) ?? 0) > 1 || isSelfRelation;\n\t\tconst isOneToOne = detectOneToOne(fk, table);\n\t\tconst childRelFieldName = resolveUniqueFieldName(deriveRelationFieldName(fk.columns, parentTableName), childUsed, parentModelName);\n\t\tconst relationName = needsRelationName ? deriveRelationName(fk, childRelFieldName, parentModelName, isSelfRelation) : void 0;\n\t\taddRelationField(relationsByTable, childTableName, buildChildRelationField(childRelFieldName, parentModelName, fk, fk.columns.some((columnName) => table.columns[columnName]?.nullable ?? false), relationName, table));\n\t\tchildUsed.add(childRelFieldName);\n\t\tconst parentUsed = usedFieldNames.get(parentTableName) ?? /* @__PURE__ */ new Set();\n\t\tusedFieldNames.set(parentTableName, parentUsed);\n\t\tconst backRelFieldName = resolveUniqueFieldName(deriveBackRelationFieldName(childModelName, isOneToOne), parentUsed, childModelName);\n\t\taddRelationField(relationsByTable, parentTableName, {\n\t\t\tfieldName: backRelFieldName,\n\t\t\ttypeName: childModelName,\n\t\t\toptional: isOneToOne,\n\t\t\tlist: !isOneToOne,\n\t\t\trelationName\n\t\t});\n\t\tparentUsed.add(backRelFieldName);\n\t}\n\treturn { relationsByTable };\n}\nfunction detectOneToOne(fk, table) {\n\tconst fkCols = [...fk.columns].sort();\n\tif (table.primaryKey) {\n\t\tconst pkCols = [...table.primaryKey.columns].sort();\n\t\tif (pkCols.length === fkCols.length && pkCols.every((c, i) => c === fkCols[i])) return true;\n\t}\n\tfor (const unique of table.uniques) {\n\t\tconst uniqueCols = [...unique.columns].sort();\n\t\tif (uniqueCols.length === fkCols.length && uniqueCols.every((c, i) => c === fkCols[i])) return true;\n\t}\n\tfor (const index of table.indexes) {\n\t\tif (!index.unique || index.partial || index.columns === void 0) continue;\n\t\tconst indexCols = [...index.columns].sort();\n\t\tif (indexCols.length === fkCols.length && indexCols.every((c, i) => c === fkCols[i])) return true;\n\t}\n\treturn false;\n}\nfunction deriveRelationName(fk, childRelationFieldName, parentModelName, isSelfRelation) {\n\tif (fk.name) return fk.name;\n\tif (isSelfRelation) return `${childRelationFieldName.charAt(0).toUpperCase() + childRelationFieldName.slice(1)}${pluralize(parentModelName)}`;\n\treturn fk.columns.join(\"_\");\n}\n/**\n* Builds the child-side {@link RelationField} for a single foreign key:\n* `typeName` is the parent model name, `fields`/`references` are the FK's raw\n* columns, and `onDelete`/`onUpdate` are normalized to their PSL spelling.\n* Exported so a caller resolving a foreign key against a model outside\n* `tables` (e.g. a cross-space reference into another contract) can reuse the\n* same normalization instead of duplicating it.\n*\n* `hostTable` is the table the FK is declared on (i.e. `table`, not the\n* referenced parent) — its own indexes/uniques/primary key are what a\n* backing index for this FK would be. When none of them exactly match the\n* FK's source columns (in order), `index: false` is stamped so the emitted\n* `@relation` opts out of the framework's default derived backing-index\n* expectation, matching what `db verify` will find live. Passing the table\n* is optional so existing single-FK callers (e.g. cross-space resolution\n* before a host table reference is threaded through) can omit it and keep\n* the framework default.\n*/\nfunction buildChildRelationField(fieldName, parentModelName, fk, optional, relationName, hostTable) {\n\tconst onDelete = fk.onDelete && fk.onDelete !== DEFAULT_ON_DELETE ? fk.onDelete : void 0;\n\tconst onUpdate = fk.onUpdate && fk.onUpdate !== DEFAULT_ON_UPDATE ? fk.onUpdate : void 0;\n\tconst index = hostTable && !isBackedByColumnKeys(fk.columns, backingIndexColumnKeys({\n\t\tindexes: hostTable.indexes.filter((i) => i.where === void 0),\n\t\tuniques: hostTable.uniques,\n\t\tprimaryKey: hostTable.primaryKey\n\t})) ? false : void 0;\n\treturn {\n\t\tfieldName,\n\t\ttypeName: parentModelName,\n\t\treferencedTableName: fk.referencedTable,\n\t\toptional,\n\t\tlist: false,\n\t\trelationName,\n\t\tfkName: fk.name,\n\t\tfields: fk.columns,\n\t\treferences: fk.referencedColumns,\n\t\tonDelete: onDelete ? REFERENTIAL_ACTION_PSL[onDelete] : void 0,\n\t\tonUpdate: onUpdate ? REFERENTIAL_ACTION_PSL[onUpdate] : void 0,\n\t\tindex\n\t};\n}\nfunction resolveUniqueFieldName(desired, usedNames, fallbackSuffix) {\n\tif (!usedNames.has(desired)) return desired;\n\tconst withSuffix = `${desired}${fallbackSuffix}`;\n\tif (!usedNames.has(withSuffix)) return withSuffix;\n\tlet counter = 2;\n\twhile (usedNames.has(`${desired}${counter}`)) counter++;\n\treturn `${desired}${counter}`;\n}\nfunction addRelationField(map, tableName, field) {\n\tconst existing = map.get(tableName);\n\tif (existing) existing.push(field);\n\telse map.set(tableName, [field]);\n}\n//#endregion\nexport { buildChildRelationField, deriveBackRelationFieldName, deriveRelationFieldName, inferRelations, pluralize, toEnumName, toFieldName, toModelName };\n\n//# sourceMappingURL=psl-infer.mjs.map"],"mappings":";;;;;;AAMA,SAAS,YAAY,WAAW;CAC/B,IAAI;CACJ,IAAI,cAAc,SAAS,GAAG,OAAO,kBAAkB,SAAS;MAC3D,OAAO,UAAU,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,UAAU,MAAM,CAAC;CACjE,IAAI,cAAc,IAAI,GAAG,OAAO;EAC/B,MAAM,WAAW,IAAI;EACrB,KAAK;CACN;CACA,IAAI,iBAAiB,IAAI,MAAM,WAAW,OAAO;EAChD;EACA,KAAK;CACN;CACA,OAAO,EAAE,KAAK;AACf;AACA,SAAS,YAAY,YAAY;CAChC,IAAI;CACJ,IAAI,cAAc,UAAU,GAAG,OAAO,iBAAiB,UAAU;MAC5D,OAAO,WAAW,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,WAAW,MAAM,CAAC;CACnE,IAAI,cAAc,IAAI,GA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er.mjs"],"sourcesContent":["import { a as snakeToCamelCase, i as needsEscaping, n as escapeName, o as snakeToPascalCase, r as hasSeparators, t as escapeIfNeeded } from \"./psl-names-C3cwe0rg.mjs\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { defaultTableName } from \"@internal/sql-contract-psl/default-table-name\";\nimport pluralizeLib from \"pluralize\";\nimport { backingIndexColumnKeys, isBackedByColumnKeys } from \"@internal/sql-contract/foreign-key-materialization\";\n//#region src/core/psl-contract-infer/name-transforms.ts\nfunction toModelName(tableName) {\n\tlet name;\n\tif (hasSeparators(tableName)) name = snakeToPascalCase(tableName);\n\telse name = tableName.charAt(0).toUpperCase() + tableName.slice(1);\n\tif (needsEscaping(name)) return {\n\t\tname: escapeName(name),\n\t\tmap: tableName\n\t};\n\tif (defaultTableName(name) !== tableName) return {\n\t\tname,\n\t\tmap: tableName\n\t};\n\treturn { name };\n}\nfunction toFieldName(columnName) {\n\tlet name;\n\tif (hasSeparators(columnName)) name = snakeToCamelCase(columnName);\n\telse name = columnName.charAt(0).toLowerCase() + columnName.slice(1);\n\tif (needsEscaping(name)) return {\n\t\tname: escapeName(name),\n\t\tmap: columnName\n\t};\n\tif (name !== columnName) return {\n\t\tname,\n\t\tmap: columnName\n\t};\n\treturn { name };\n}\nfunction toEnumName(pgTypeName) {\n\tlet name;\n\tif (hasSeparators(pgTypeName)) name = snakeToPascalCase(pgTypeName);\n\telse name = pgTypeName.charAt(0).toUpperCase() + pgTypeName.slice(1);\n\tif (needsEscaping(name)) return {\n\t\tname: escapeName(name),\n\t\tmap: pgTypeName\n\t};\n\tif (name !== pgTypeName) return {\n\t\tname,\n\t\tmap: pgTypeName\n\t};\n\treturn { name };\n}\nfunction pluralize(word) {\n\treturn pluralizeLib.plural(word);\n}\nfunction deriveRelationFieldName(fkColumns, referencedTableName) {\n\tif (fkColumns.length === 1) {\n\t\tconst [col = referencedTableName] = fkColumns;\n\t\tconst stripped = col.replace(/_id$/i, \"\").replace(/Id$/, \"\");\n\t\tif (stripped.length > 0 && stripped !== col) return escapeIfNeeded(snakeToCamelCase(stripped));\n\t\treturn escapeIfNeeded(snakeToCamelCase(referencedTableName));\n\t}\n\treturn escapeIfNeeded(snakeToCamelCase(referencedTableName));\n}\nfunction deriveBackRelationFieldName(childModelName, isOneToOne) {\n\tconst base = childModelName.charAt(0).toLowerCase() + childModelName.slice(1);\n\treturn isOneToOne ? base : pluralize(base);\n}\n//#endregion\n//#region src/core/psl-contract-infer/relation-inference.ts\nconst DEFAULT_ON_DELETE = \"noAction\";\nconst DEFAULT_ON_UPDATE = \"noAction\";\nconst REFERENTIAL_ACTION_PSL = {\n\tnoAction: \"NoAction\",\n\trestrict: \"Restrict\",\n\tcascade: \"Cascade\",\n\tsetNull: \"SetNull\",\n\tsetDefault: \"SetDefault\"\n};\nfunction inferRelations(tables, modelNameMap) {\n\tconst relationsByTable = /* @__PURE__ */ new Map();\n\tconst fkCountByPair = /* @__PURE__ */ new Map();\n\tfor (const table of Object.values(tables)) for (const fk of table.foreignKeys) {\n\t\tconst pairKey = `${table.name}→${fk.referencedTable}`;\n\t\tfkCountByPair.set(pairKey, (fkCountByPair.get(pairKey) ?? 0) + 1);\n\t}\n\tconst usedFieldNames = /* @__PURE__ */ new Map();\n\tfor (const table of Object.values(tables)) {\n\t\tconst names = /* @__PURE__ */ new Set();\n\t\tfor (const col of Object.values(table.columns)) names.add(col.name);\n\t\tusedFieldNames.set(table.name, names);\n\t}\n\tfor (const table of Object.values(tables)) for (const fk of table.foreignKeys) {\n\t\tconst childTableName = table.name;\n\t\tconst parentTableName = fk.referencedTable;\n\t\tconst childUsed = usedFieldNames.get(childTableName);\n\t\tif (childUsed === void 0) throw new InternalError(`Missing inferred field-name set for table \"${childTableName}\"`);\n\t\tconst childModelName = modelNameMap.get(childTableName) ?? childTableName;\n\t\tconst parentModelName = modelNameMap.get(parentTableName) ?? parentTableName;\n\t\tconst pairKey = `${childTableName}→${parentTableName}`;\n\t\tconst isSelfRelation = childTableName === parentTableName;\n\t\tconst needsRelationName = (fkCountByPair.get(pairKey) ?? 0) > 1 || isSelfRelation;\n\t\tconst isOneToOne = detectOneToOne(fk, table);\n\t\tconst childRelFieldName = resolveUniqueFieldName(deriveRelationFieldName(fk.columns, parentTableName), childUsed, parentModelName);\n\t\tconst relationName = needsRelationName ? deriveRelationName(fk, childRelFieldName, parentModelName, isSelfRelation) : void 0;\n\t\taddRelationField(relationsByTable, childTableName, buildChildRelationField(childRelFieldName, parentModelName, fk, fk.columns.some((columnName) => table.columns[columnName]?.nullable ?? false), relationName, table));\n\t\tchildUsed.add(childRelFieldName);\n\t\tconst parentUsed = usedFieldNames.get(parentTableName) ?? /* @__PURE__ */ new Set();\n\t\tusedFieldNames.set(parentTableName, parentUsed);\n\t\tconst backRelFieldName = resolveUniqueFieldName(deriveBackRelationFieldName(childModelName, isOneToOne), parentUsed, childModelName);\n\t\taddRelationField(relationsByTable, parentTableName, {\n\t\t\tfieldName: backRelFieldName,\n\t\t\ttypeName: childModelName,\n\t\t\toptional: isOneToOne,\n\t\t\tlist: !isOneToOne,\n\t\t\trelationName\n\t\t});\n\t\tparentUsed.add(backRelFieldName);\n\t}\n\treturn { relationsByTable };\n}\nfunction detectOneToOne(fk, table) {\n\tconst fkCols = [...fk.columns].sort();\n\tif (table.primaryKey) {\n\t\tconst pkCols = [...table.primaryKey.columns].sort();\n\t\tif (pkCols.length === fkCols.length && pkCols.every((c, i) => c === fkCols[i])) return true;\n\t}\n\tfor (const unique of table.uniques) {\n\t\tconst uniqueCols = [...unique.columns].sort();\n\t\tif (uniqueCols.length === fkCols.length && uniqueCols.every((c, i) => c === fkCols[i])) return true;\n\t}\n\tfor (const index of table.indexes) {\n\t\tif (!index.unique || index.partial || index.columns === void 0) continue;\n\t\tconst indexCols = [...index.columns].sort();\n\t\tif (indexCols.length === fkCols.length && indexCols.every((c, i) => c === fkCols[i])) return true;\n\t}\n\treturn false;\n}\nfunction deriveRelationName(fk, childRelationFieldName, parentModelName, isSelfRelation) {\n\tif (fk.name) return fk.name;\n\tif (isSelfRelation) return `${childRelationFieldName.charAt(0).toUpperCase() + childRelationFieldName.slice(1)}${pluralize(parentModelName)}`;\n\treturn fk.columns.join(\"_\");\n}\n/**\n* Builds the child-side {@link RelationField} for a single foreign key:\n* `typeName` is the parent model name, `fields`/`references` are the FK's raw\n* columns, and `onDelete`/`onUpdate` are normalized to their PSL spelling.\n* Exported so a caller resolving a foreign key against a model outside\n* `tables` (e.g. a cross-space reference into another contract) can reuse the\n* same normalization instead of duplicating it.\n*\n* `hostTable` is the table the FK is declared on (i.e. `table`, not the\n* referenced parent) — its own indexes/uniques/primary key are what a\n* backing index for this FK would be. When none of them exactly match the\n* FK's source columns (in order), `index: false` is stamped so the emitted\n* `@relation` opts out of the framework's default derived backing-index\n* expectation, matching what `db verify` will find live. Passing the table\n* is optional so existing single-FK callers (e.g. cross-space resolution\n* before a host table reference is threaded through) can omit it and keep\n* the framework default.\n*/\nfunction buildChildRelationField(fieldName, parentModelName, fk, optional, relationName, hostTable) {\n\tconst onDelete = fk.onDelete && fk.onDelete !== DEFAULT_ON_DELETE ? fk.onDelete : void 0;\n\tconst onUpdate = fk.onUpdate && fk.onUpdate !== DEFAULT_ON_UPDATE ? fk.onUpdate : void 0;\n\tconst index = hostTable && !isBackedByColumnKeys(fk.columns, backingIndexColumnKeys({\n\t\tindexes: hostTable.indexes.filter((i) => i.where === void 0),\n\t\tuniques: hostTable.uniques,\n\t\tprimaryKey: hostTable.primaryKey\n\t})) ? false : void 0;\n\treturn {\n\t\tfieldName,\n\t\ttypeName: parentModelName,\n\t\treferencedTableName: fk.referencedTable,\n\t\toptional,\n\t\tlist: false,\n\t\trelationName,\n\t\tfkName: fk.name,\n\t\tfields: fk.columns,\n\t\treferences: fk.referencedColumns,\n\t\tonDelete: onDelete ? REFERENTIAL_ACTION_PSL[onDelete] : void 0,\n\t\tonUpdate: onUpdate ? REFERENTIAL_ACTION_PSL[onUpdate] : void 0,\n\t\tindex\n\t};\n}\nfunction resolveUniqueFieldName(desired, usedNames, fallbackSuffix) {\n\tif (!usedNames.has(desired)) return desired;\n\tconst withSuffix = `${desired}${fallbackSuffix}`;\n\tif (!usedNames.has(withSuffix)) return withSuffix;\n\tlet counter = 2;\n\twhile (usedNames.has(`${desired}${counter}`)) counter++;\n\treturn `${desired}${counter}`;\n}\nfunction addRelationField(map, tableName, field) {\n\tconst existing = map.get(tableName);\n\tif (existing) existing.push(field);\n\telse map.set(tableName, [field]);\n}\n//#endregion\nexport { buildChildRelationField, deriveBackRelationFieldName, deriveRelationFieldName, inferRelations, pluralize, toEnumName, toFieldName, toModelName };\n\n//# sourceMappingURL=psl-infer.mjs.map"],"mappings":";;;;;;AAMA,SAAS,YAAY,WAAW;CAC/B,IAAI;CACJ,IAAI,cAAc,SAAS,GAAG,OAAO,kBAAkB,SAAS;MAC3D,OAAO,UAAU,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,UAAU,MAAM,CAAC;CACjE,IAAI,cAAc,IAAI,GAAG,OAAO;EAC/B,MAAM,WAAW,IAAI;EACrB,KAAK;CACN;CACA,IAAI,iBAAiB,IAAI,MAAM,WAAW,OAAO;EAChD;EACA,KAAK;CACN;CACA,OAAO,EAAE,KAAK;AACf;AACA,SAAS,YAAY,YAAY;CAChC,IAAI;CACJ,IAAI,cAAc,UAAU,GAAG,OAAO,iBAAiB,UAAU;MAC5D,OAAO,WAAW,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,WAAW,MAAM,CAAC;CACnE,IAAI,cAAc,IAAI,GAAG,OAAO;EAC/B,MAAM,WAAW,IAAI;EACrB,KAAK;CACN;CACA,IAAI,SAAS,YAAY,OAAO;EAC/B;EACA,KAAK;CACN;CACA,OAAO,EAAE,KAAK;AACf;AACA,SAAS,WAAW,YAAY;CAC/B,IAAI;CACJ,IAAI,cAAc,UAAU,GAAG,OAAO,kBAAkB,UAAU;MAC7D,OAAO,WAAW,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,WA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AAG,aAAa,oBAAoB,GAAG,WAAW,KAAK;CACvF,MAAM,QAAQ,aAAa,CAAC,qBAAqB,GAAG,SAAS,uBAAuB;EACnF,SAAS,UAAU,QAAQ,QAAQ,MAAM,EAAE,UAAU,KAAK,CAAC;EAC3D,SAAS,UAAU;EACnB,YAAY,UAAU;CACvB,CAAC,CAAC,IAAI,QAAQ,KAAK;CACnB,OAAO;EACN;EACA,UAAU;EACV,qBAAqB,GAAG;EACxB;EACA,MAAM;EACN;EACA,QAAQ,GAAG;EACX,QAAQ,GAAG;EACX,YAAY,GAAG;EACf,UAAU,WAAW,uBAAuB,YAAY,KAAK;EAC7D,UAAU,WAAW,uBAAuB,YAAY,KAAK;EAC7D;CACD;AACD;AACA,SAAS,uBAAuB,SAAS,WAAW,gBAAgB;CACnE,IAAI,CAAC,UAAU,IAAI,OAAO,GAAG,OAAO;CACpC,MAAM,aAAa,GAAG,UAAU;CAChC,IAAI,CAAC,UAAU,IAAI,UAAU,GAAG,OAAO;CACvC,IAAI,UAAU;CACd,OAAO,UAAU,IAAI,GAAG,UAAU,SAAS,GAAG;CAC9C,OAAO,GAAG,UAAU;AACrB;AACA,SAAS,iBAAiB,KAAK,WAAW,OAAO;CAChD,MAAM,WAAW,IAAI,IAAI,SAAS;CAClC,IAAI,UAAU,SAAS,KAAK,KAAK;MAC5B,IAAI,IAAI,WAAW,CAAC,KAAK,CAAC;AAChC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./types-
|
|
1
|
+
import { b as SqlTableIR, f as SqlForeignKeyIR } from "./types-DinsvYdY-Dv_n3Tac.mjs";
|
|
2
|
+
import "./types-BBT7jidC.mjs";
|
|
3
3
|
import { r as PslTypeMap, t as DefaultMappingOptions } from "./type-map-BwBI56i3-DDERtzxf.mjs";
|
|
4
4
|
import { ColumnDefault } from "@prisma/orm-framework/contract/types";
|
|
5
5
|
//#region ../../../2-sql/9-family/dist/psl-infer.d.mts
|
|
@@ -80,4 +80,4 @@ declare function inferRelations(tables: Record<string, SqlTableIR>, modelNameMap
|
|
|
80
80
|
declare function buildChildRelationField(fieldName: string, parentModelName: string, fk: SqlForeignKeyIR, optional: boolean, relationName?: string, hostTable?: SqlTableIR): RelationField;
|
|
81
81
|
//#endregion
|
|
82
82
|
export { buildChildRelationField as a, inferRelations as c, toFieldName as d, toModelName as f, RelationField as i, pluralize as l, InferredRelations as n, deriveBackRelationFieldName as o, PslPrinterOptions as r, deriveRelationFieldName as s, EnumInfo as t, toEnumName as u };
|
|
83
|
-
//# sourceMappingURL=psl-infer-
|
|
83
|
+
//# sourceMappingURL=psl-infer-C8hg8mIS.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"psl-infer-
|
|
1
|
+
{"version":3,"file":"psl-infer-C8hg8mIS.d.mts","names":[],"sources":["../../../../2-sql/9-family/dist/psl-infer.d.mts"],"mappings":";;;;;;KAIK;WACM;WACA;;iBAEM,YAAY,oBAAoB;iBAChC,YAAY,qBAAqB;iBACjC,WAAW,qBAAqB;iBAChC,UAAU;iBACV,wBAAwB,8BAA8B;iBACtD,4BAA4B,wBAAwB;;;UAG3D;WACC,WAAW;WACX,aAAa;;UAEd;WACC,SAAS;WACT,iBAAiB;WACjB,WAAW;WACX,mBAAmB,oBAAoB,wBAAwB;;KAErE;WACM;WACA;;;;;;WAMA;;;;;;WAMA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;;;KAIN;WACM,kBAAkB,6BAA6B;;iBAEzC,eAAe,QAAQ,eAAe,aAAa,cAAc,8BAA8B;;;;;;;;;;;;;;;;;;;iBAmB/F,wBAAwB,mBAAmB,yBAAyB,IAAI,iBAAiB,mBAAmB,uBAAuB,YAAY,aAAa"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { $ as InsertValue, A as DefaultValueExpr, At as SqlCodecCallContext, B as EqColJoinOn, Bt as WindowFuncExpr, C as CodecCallContext$1, Ct as RawExpr, D as CodecTrait$1, Dt as RawSqlLiteral, E as CodecRef$1, Et as RawQueryResult, F as DescriptorCodecJson, Ft as TableSource, G as ExpressionSource, Gt as isOrderByNulls, H as ExprVisitor, Ht as frozenCodecRef, I as DescriptorCodecTraits, It as ToWhereExpr, J as FunctionSource, Jt as queryAstKinds, K as ExtractCodecTypes, Kt as isQueryAst, L as Direction, Lt as UpdateAst, M as DerivedTableSource, Mt as SqlColumnRef, N as DescriptorCodecId, Nt as SubqueryExpr, O as ColumnRef, Ot as SelectAst, P as DescriptorCodecInput, Pt as TableRef, Q as InsertOnConflict, R as DoNothingConflictAction, Rt as WhereArg, S as Codec$1, St as ProjectionItem, T as CodecJsonValueProjection, Tt as RawQueryColumn, U as ExpressionFolder, Ut as isAggregateFn, V as ExistsExpr, Vt as aggregateFnNames, W as ExpressionRewriter, Wt as isOrderByDirection, X as IdentifierRef, Y as FunctionSourceAlias, Yt as whereExprKinds, Z as InsertAst, _ as BinaryExpr, _t as OrderByItem, a as AndExpr, at as JsonObjectExpr, b as CaseExpr, bt as PreparedParamRef, c as AnyExpression, ct as ListExpression, d as AnyInsertValue, dt as LoweredStatement, et as JoinAst, f as AnyJsonValueProjection, ft as NativeJsonValueProjection, g as AstRewriter, gt as OrExpr, h as AnyQueryAst, ht as OperationExpr, i as AggregateOpFn, it as JsonObjectEntry, j as DeleteAst, jt as SqlCodecInstanceContext, k as ContractCodecRegistry, kt as SelectAstOptions, l as AnyFromSource, lt as LiteralExpr, m as AnyParamRef, mt as NullCheckExpr, n as AggregateExpr, nt as JsonArrayAggExpr, o as AnyCodecDescriptor, ot as JsonValueProjectionVisitor, p as AnyOperationArg, pt as NotExpr, q as FunctionCallExpr, qt as isWhereExpr, r as AggregateFn, rt as JsonDocumentProjection, s as AnyCodecDescriptorTemplate, st as LimitOffsetValue, t as AggregateCountFn, tt as JoinOnExpr, u as AnyInsertOnConflictAction, ut as LoweredParam, v as BinaryOp, vt as OrderByNulls, w as CodecDescriptor$1, wt as RawQueryAst, x as CastExpr, xt as ProjectionExpr, y as CaseBranch, yt as ParamRef, z as DoUpdateSetConflictAction, zt as WindowFn } from "./types-Yui2yFf6-TP-oRDTX.mjs";
|
|
2
2
|
import { a as SqlDriverState, c as SqlQueryable, i as SqlDriver, l as SqlStatementStats, n as PreparedStatementHandle, o as SqlExecuteRequest, r as SqlConnection, s as SqlExplainResult, t as PreparedExecuteRequest, u as SqlTransaction } from "./driver-types-BQtRkOJ0-Bv2RPSfr.mjs";
|
|
3
3
|
import { a as DdlColumnDefaultVisitor, c as DdlTableConstraint, d as LiteralColumnDefault, f as PrimaryKeyConstraint, i as DdlColumnDefault, l as ForeignKeyConstraint, m as isDdlNode, n as CheckExpressionConstraint, o as DdlColumnRenderContext, p as UniqueConstraint, r as DdlColumn, s as DdlNode, t as AnyDdlColumnDefault, u as FunctionColumnDefault } from "./ddl-types-DD-i-Uj9-D99heD5Z.mjs";
|
|
4
|
-
import { $ as
|
|
4
|
+
import { $ as sqlIntEncode, A as compact, B as sqlCharDecode, C as SqlTextCodec, D as canonicalDateTime, E as SqlVarcharDescriptor, F as numeralText, G as sqlFloatDecode, H as sqlCharEncode, I as parseJsonBody, J as sqlFloatEncode, K as sqlFloatDecodeJson, L as printJsonBody, M as escapePslString, N as isNonFiniteText, O as canonicalNumeralText, P as isNumeralText, Q as sqlIntDescriptor, R as signedRange, S as SqlIntDescriptor, T as SqlVarcharCodec, U as sqlCharRenderOutputType, V as sqlCharDescriptor, W as sqlFloatColumn, X as sqlIntColumn, Y as sqlFloatEncodeJson, Z as sqlIntDecode, _ as SqlCharCodec, a as DateTimeShape, at as sqlVarcharDecode, b as SqlFloatDescriptor, c as LowererContext, ct as sqlVarcharRenderOutputType, d as NumberClassifierSpec, et as sqlTextColumn, f as SQL_CHAR_CODEC_ID, g as SQL_VARCHAR_CODEC_ID, h as SQL_TEXT_CODEC_ID, i as CanonicalDateTimeOptions, it as sqlVarcharColumn, j as createNumberClassifier, k as collectOrderedParamRefs, l as MarkerReadResult, m as SQL_INT_CODEC_ID, n as AdapterProfile, nt as sqlTextDescriptor, o as IntegerStep, ot as sqlVarcharDescriptor, p as SQL_FLOAT_CODEC_ID, q as sqlFloatDescriptor, r as AdapterTarget, rt as sqlTextEncode, s as Lowerer, st as sqlVarcharEncode, t as Adapter, tt as sqlTextDecode, u as NumberClassification, v as SqlCharDescriptor, w as SqlTextDescriptor, x as SqlIntCodec, y as SqlFloatCodec, z as sqlCharColumn } from "./ast-DQU1yUQ5.mjs";
|
|
5
5
|
import { n as SqlQueryPlan, r as planFromAst, t as Preparable } from "./plan-B7g2kDfQ-Bw0784x6.mjs";
|
|
6
6
|
import { C as buildOperation, D as param, E as isExpression, O as toExpr, S as TraitExpression, T as createRawSql, _ as RawSqlStatementBuilder, a as CodecValue, b as ScalarListExpression, c as RawAffectedCountQuery, d as RawRow, f as RawRowQuery, g as RawSqlInterpolation, h as RawSqlBuilder, i as CodecTypesBase, l as RawCodecInferer, m as RawRowSpecEntry, n as BuildOperationSpec, o as Expression, p as RawRowSpec, r as CodecExpression, s as NoReservedRowColumn, t as AffectedCount, u as RawPlanContext, v as RawSqlStatementTag, w as codecOf, x as ScopeField, y as RawSqlTag } from "./expression-BPoA5eEl.mjs";
|
|
7
7
|
import { t as SqlExecutionPlan } from "./sql-execution-plan-Db0j752I-CI5WbdLi.mjs";
|
|
@@ -10,4 +10,4 @@ import { a as SqlAggregateDescriptorRegistry, c as TypeHelperRegistry, n as Exec
|
|
|
10
10
|
import "./query-lane-context-BcXiJasG.mjs";
|
|
11
11
|
import { S as TablesOf, _ as SqlOrmPlan, a as ColumnsOf, b as TableKey, c as META, d as ModelMetadata, f as OperationTypeSignature, g as SqlBuilderOptions, h as RuntimeScope, i as ColumnResolutionContract, l as Meta, m as OperationsForTypeId, n as BuildParamsMap, o as ComputeColumnJsType, p as OperationTypes, r as CodecTypes, s as Expr, t as BuildOptions, u as ModelDef, v as SqlPlan, x as TableMetadata, y as TableDef } from "./types-DFJNPLXY-vp6AGe5e.mjs";
|
|
12
12
|
import { a as SqlParamRefMutatorInternal, i as SqlParamRefMutator, n as ParamRefEntryUnion, o as createSqlParamRefMutator, r as ParamRefHandle, t as ParamRefEntry } from "./middleware-CuGBptK0-C88HCnh5.mjs";
|
|
13
|
-
export { Adapter, AdapterProfile, AdapterTarget, AffectedCount, AggregateCountFn, AggregateExpr, AggregateFn, AggregateOpFn, AndExpr, AnyCodecDescriptor, AnyCodecDescriptorTemplate, AnyDdlColumnDefault, AnyExpression, AnyFromSource, AnyInsertOnConflictAction, AnyInsertValue, AnyJsonValueProjection, AnyOperationArg, AnyParamRef, AnyQueryAst, AstRewriter, BinaryExpr, BinaryOp, BuildOperationSpec, BuildOptions, BuildParamsMap, CaseBranch, CaseExpr, CastExpr, CheckExpressionConstraint, Codec$1 as Codec, type CodecCallContext$1 as CodecCallContext, type CodecDescriptor$1 as CodecDescriptor, CodecDescriptorRegistry, CodecExpression, CodecJsonValueProjection, type CodecRef$1 as CodecRef, type CodecTrait$1 as CodecTrait, CodecTypes, CodecTypesBase, CodecValue, ColumnRef, ColumnResolutionContract, ColumnsOf, ComputeColumnJsType, ContractCodecRegistry, DdlColumn, DdlColumnDefault, DdlColumnDefaultVisitor, DdlColumnRenderContext, DdlNode, DdlTableConstraint, DefaultValueExpr, DeleteAst, DerivedTableSource, DescriptorCodecId, DescriptorCodecInput, DescriptorCodecJson, DescriptorCodecTraits, Direction, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExecutionContext, ExistsExpr, Expr, ExprVisitor, Expression, ExpressionFolder, ExpressionRewriter, ExpressionSource, ExtractCodecTypes, ForeignKeyConstraint, FunctionCallExpr, FunctionColumnDefault, FunctionSource, FunctionSourceAlias, IdentifierRef, InsertAst, InsertOnConflict, InsertValue, IntegerStep, JoinAst, JoinOnExpr, JsonArrayAggExpr, JsonDocumentProjection, JsonObjectEntry, JsonObjectExpr, JsonValueProjectionVisitor, LimitOffsetValue, ListExpression, LiteralColumnDefault, LiteralExpr, LoweredParam, LoweredStatement, Lowerer, LowererContext, META, MarkerReadResult, Meta, ModelDef, ModelMetadata, NativeJsonValueProjection, NoReservedRowColumn, NotExpr, NullCheckExpr, NumberClassification, NumberClassifierSpec, OperationExpr, OperationTypeSignature, OperationTypes, OperationsForTypeId, OrExpr, OrderByItem, OrderByNulls, ParamRef, type ParamRefEntry, type ParamRefEntryUnion, type ParamRefHandle, Preparable, PreparedExecuteRequest, PreparedParamRef, PreparedStatementHandle, PrimaryKeyConstraint, ProjectionExpr, ProjectionItem, RawAffectedCountQuery, RawCodecInferer, RawExpr, RawPlanContext, RawQueryAst, RawQueryColumn, RawQueryResult, RawRow, RawRowQuery, RawRowSpec, RawRowSpecEntry, RawSqlBuilder, RawSqlInterpolation, RawSqlLiteral, RawSqlStatementBuilder, RawSqlStatementTag, RawSqlTag, ResolvedSqlAggregate, type RuntimeScope, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_VARCHAR_CODEC_ID, ScalarListExpression, ScopeField, SelectAst, SelectAstOptions, SqlAggregateDescriptorRegistry, SqlBuilderOptions, SqlCharCodec, SqlCharDescriptor, SqlCodecCallContext, SqlCodecInstanceContext, SqlColumnRef, SqlConnection, SqlDriver, SqlDriverState, SqlExecuteRequest, type SqlExecutionPlan, SqlExplainResult, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, type SqlOrmPlan, type SqlParamRefMutator, type SqlParamRefMutatorInternal, SqlPlan, SqlQueryPlan, SqlQueryable, SqlStatementStats, SqlTextCodec, SqlTextDescriptor, SqlTransaction, SqlVarcharCodec, SqlVarcharDescriptor, SubqueryExpr, TableDef, TableKey, TableMetadata, TableRef, TableSource, TablesOf, ToWhereExpr, TraitExpression, TypeHelperRegistry, UniqueConstraint, UpdateAst, WhereArg, WindowFn, WindowFuncExpr, aggregateFnNames, buildOperation, canonicalNumeralText, codecOf, collectOrderedParamRefs, compact, createNumberClassifier, createRawSql, createSqlParamRefMutator, escapePslString, frozenCodecRef, isAggregateFn, isDdlNode, isExpression, isNonFiniteText, isNumeralText, isOrderByDirection, isOrderByNulls, isQueryAst, isWhereExpr, numeralText, param, parseJsonBody, planFromAst, printJsonBody, queryAstKinds, signedRange, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDecodeJson, sqlFloatDescriptor, sqlFloatEncode, sqlFloatEncodeJson, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, toExpr, whereExprKinds };
|
|
13
|
+
export { Adapter, AdapterProfile, AdapterTarget, AffectedCount, AggregateCountFn, AggregateExpr, AggregateFn, AggregateOpFn, AndExpr, AnyCodecDescriptor, AnyCodecDescriptorTemplate, AnyDdlColumnDefault, AnyExpression, AnyFromSource, AnyInsertOnConflictAction, AnyInsertValue, AnyJsonValueProjection, AnyOperationArg, AnyParamRef, AnyQueryAst, AstRewriter, BinaryExpr, BinaryOp, BuildOperationSpec, BuildOptions, BuildParamsMap, CanonicalDateTimeOptions, CaseBranch, CaseExpr, CastExpr, CheckExpressionConstraint, Codec$1 as Codec, type CodecCallContext$1 as CodecCallContext, type CodecDescriptor$1 as CodecDescriptor, CodecDescriptorRegistry, CodecExpression, CodecJsonValueProjection, type CodecRef$1 as CodecRef, type CodecTrait$1 as CodecTrait, CodecTypes, CodecTypesBase, CodecValue, ColumnRef, ColumnResolutionContract, ColumnsOf, ComputeColumnJsType, ContractCodecRegistry, DateTimeShape, DdlColumn, DdlColumnDefault, DdlColumnDefaultVisitor, DdlColumnRenderContext, DdlNode, DdlTableConstraint, DefaultValueExpr, DeleteAst, DerivedTableSource, DescriptorCodecId, DescriptorCodecInput, DescriptorCodecJson, DescriptorCodecTraits, Direction, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExecutionContext, ExistsExpr, Expr, ExprVisitor, Expression, ExpressionFolder, ExpressionRewriter, ExpressionSource, ExtractCodecTypes, ForeignKeyConstraint, FunctionCallExpr, FunctionColumnDefault, FunctionSource, FunctionSourceAlias, IdentifierRef, InsertAst, InsertOnConflict, InsertValue, IntegerStep, JoinAst, JoinOnExpr, JsonArrayAggExpr, JsonDocumentProjection, JsonObjectEntry, JsonObjectExpr, JsonValueProjectionVisitor, LimitOffsetValue, ListExpression, LiteralColumnDefault, LiteralExpr, LoweredParam, LoweredStatement, Lowerer, LowererContext, META, MarkerReadResult, Meta, ModelDef, ModelMetadata, NativeJsonValueProjection, NoReservedRowColumn, NotExpr, NullCheckExpr, NumberClassification, NumberClassifierSpec, OperationExpr, OperationTypeSignature, OperationTypes, OperationsForTypeId, OrExpr, OrderByItem, OrderByNulls, ParamRef, type ParamRefEntry, type ParamRefEntryUnion, type ParamRefHandle, Preparable, PreparedExecuteRequest, PreparedParamRef, PreparedStatementHandle, PrimaryKeyConstraint, ProjectionExpr, ProjectionItem, RawAffectedCountQuery, RawCodecInferer, RawExpr, RawPlanContext, RawQueryAst, RawQueryColumn, RawQueryResult, RawRow, RawRowQuery, RawRowSpec, RawRowSpecEntry, RawSqlBuilder, RawSqlInterpolation, RawSqlLiteral, RawSqlStatementBuilder, RawSqlStatementTag, RawSqlTag, ResolvedSqlAggregate, type RuntimeScope, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_VARCHAR_CODEC_ID, ScalarListExpression, ScopeField, SelectAst, SelectAstOptions, SqlAggregateDescriptorRegistry, SqlBuilderOptions, SqlCharCodec, SqlCharDescriptor, SqlCodecCallContext, SqlCodecInstanceContext, SqlColumnRef, SqlConnection, SqlDriver, SqlDriverState, SqlExecuteRequest, type SqlExecutionPlan, SqlExplainResult, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, type SqlOrmPlan, type SqlParamRefMutator, type SqlParamRefMutatorInternal, SqlPlan, SqlQueryPlan, SqlQueryable, SqlStatementStats, SqlTextCodec, SqlTextDescriptor, SqlTransaction, SqlVarcharCodec, SqlVarcharDescriptor, SubqueryExpr, TableDef, TableKey, TableMetadata, TableRef, TableSource, TablesOf, ToWhereExpr, TraitExpression, TypeHelperRegistry, UniqueConstraint, UpdateAst, WhereArg, WindowFn, WindowFuncExpr, aggregateFnNames, buildOperation, canonicalDateTime, canonicalNumeralText, codecOf, collectOrderedParamRefs, compact, createNumberClassifier, createRawSql, createSqlParamRefMutator, escapePslString, frozenCodecRef, isAggregateFn, isDdlNode, isExpression, isNonFiniteText, isNumeralText, isOrderByDirection, isOrderByNulls, isQueryAst, isWhereExpr, numeralText, param, parseJsonBody, planFromAst, printJsonBody, queryAstKinds, signedRange, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDecodeJson, sqlFloatDescriptor, sqlFloatEncode, sqlFloatEncodeJson, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, toExpr, whereExprKinds };
|
package/dist/relational-core.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { A as PreparedParamRef, B as frozenCodecRef, C as LiteralExpr, D as OrExpr, E as OperationExpr, F as SubqueryExpr, G as isWhereExpr, H as isOrderByDirection, I as TableSource, K as queryAstKinds, L as UpdateAst, M as RawExpr, N as RawQueryAst, O as OrderByItem, P as SelectAst, R as WindowFuncExpr, S as ListExpression, T as NullCheckExpr, U as isOrderByNulls, V as isAggregateFn, W as isQueryAst, _ as InsertAst, a as CastExpr, b as JsonArrayAggExpr, c as DeleteAst, d as DoUpdateSetConflictAction, f as EqColJoinOn, g as IdentifierRef, h as FunctionSource, i as CaseExpr, j as ProjectionItem, k as ParamRef, l as DerivedTableSource, m as FunctionCallExpr, n as AndExpr, o as ColumnRef, p as ExistsExpr, q as whereExprKinds, r as BinaryExpr, s as DefaultValueExpr, t as AggregateExpr, u as DoNothingConflictAction, v as InsertOnConflict, w as NotExpr, x as JsonObjectExpr, y as JoinAst, z as aggregateFnNames } from "./types-BPi4d3WI-D8PIEqBU.mjs";
|
|
2
2
|
import { a as ForeignKeyConstraint, c as PrimaryKeyConstraint, i as DdlNode, l as UniqueConstraint, n as DdlColumn, o as FunctionColumnDefault, r as DdlColumnDefault, s as LiteralColumnDefault, t as CheckExpressionConstraint, u as isDdlNode } from "./ddl-types-DOgOmDOh-Cs_MY05h.mjs";
|
|
3
3
|
import { n as compact, t as collectOrderedParamRefs } from "./util-DQQgv2j1-D6INZaRG.mjs";
|
|
4
|
-
import { A as
|
|
4
|
+
import { A as sqlCharDecode, B as sqlIntColumn, C as isNonFiniteText, D as printJsonBody, E as parseJsonBody, F as sqlFloatDecode, G as sqlTextDecode, H as sqlIntDescriptor, I as sqlFloatDecodeJson, J as sqlVarcharColumn, K as sqlTextDescriptor, L as sqlFloatDescriptor, M as sqlCharEncode, N as sqlCharRenderOutputType, O as signedRange, P as sqlFloatColumn, Q as sqlVarcharRenderOutputType, R as sqlFloatEncode, S as escapePslString, T as numeralText, U as sqlIntEncode, V as sqlIntDecode, W as sqlTextColumn, X as sqlVarcharDescriptor, Y as sqlVarcharDecode, Z as sqlVarcharEncode, _ as SqlVarcharCodec, a as SQL_FLOAT_CODEC_ID, b as canonicalNumeralText, c as SQL_VARCHAR_CODEC_ID, d as SqlFloatCodec, f as SqlFloatDescriptor, g as SqlTextDescriptor, h as SqlTextCodec, i as SQL_CHAR_CODEC_ID, j as sqlCharDescriptor, k as sqlCharColumn, l as SqlCharCodec, m as SqlIntDescriptor, n as JsonDocumentProjection, o as SQL_INT_CODEC_ID, p as SqlIntCodec, q as sqlTextEncode, r as NativeJsonValueProjection, s as SQL_TEXT_CODEC_ID, t as CodecJsonValueProjection, u as SqlCharDescriptor, v as SqlVarcharDescriptor, w as isNumeralText, x as createNumberClassifier, y as canonicalDateTime, z as sqlFloatEncodeJson } from "./ast-CJd4157-.mjs";
|
|
5
5
|
import { t as planFromAst } from "./plan-Dh0LbYIv-Crx5-ThG.mjs";
|
|
6
6
|
import { a as param, i as isExpression, n as codecOf, o as toExpr, r as createRawSql, t as buildOperation } from "./expression-vAEOvq7J.mjs";
|
|
7
7
|
import { t as createSqlParamRefMutator } from "./middleware-CMr4CHNz-DHIUdxlm.mjs";
|
|
8
|
-
export { AggregateExpr, AndExpr, BinaryExpr, CaseExpr, CastExpr, CheckExpressionConstraint, CodecJsonValueProjection, ColumnRef, DdlColumn, DdlColumnDefault, DdlNode, DefaultValueExpr, DeleteAst, DerivedTableSource, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, ForeignKeyConstraint, FunctionCallExpr, FunctionColumnDefault, FunctionSource, IdentifierRef, InsertAst, InsertOnConflict, JoinAst, JsonArrayAggExpr, JsonDocumentProjection, JsonObjectExpr, ListExpression, LiteralColumnDefault, LiteralExpr, NativeJsonValueProjection, NotExpr, NullCheckExpr, OperationExpr, OrExpr, OrderByItem, ParamRef, PreparedParamRef, PrimaryKeyConstraint, ProjectionItem, RawExpr, RawQueryAst, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_VARCHAR_CODEC_ID, SelectAst, SqlCharCodec, SqlCharDescriptor, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, SqlTextCodec, SqlTextDescriptor, SqlVarcharCodec, SqlVarcharDescriptor, SubqueryExpr, TableSource, UniqueConstraint, UpdateAst, WindowFuncExpr, aggregateFnNames, buildOperation, canonicalNumeralText, codecOf, collectOrderedParamRefs, compact, createNumberClassifier, createRawSql, createSqlParamRefMutator, escapePslString, frozenCodecRef, isAggregateFn, isDdlNode, isExpression, isNonFiniteText, isNumeralText, isOrderByDirection, isOrderByNulls, isQueryAst, isWhereExpr, numeralText, param, parseJsonBody, planFromAst, printJsonBody, queryAstKinds, signedRange, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDecodeJson, sqlFloatDescriptor, sqlFloatEncode, sqlFloatEncodeJson, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, toExpr, whereExprKinds };
|
|
8
|
+
export { AggregateExpr, AndExpr, BinaryExpr, CaseExpr, CastExpr, CheckExpressionConstraint, CodecJsonValueProjection, ColumnRef, DdlColumn, DdlColumnDefault, DdlNode, DefaultValueExpr, DeleteAst, DerivedTableSource, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, ForeignKeyConstraint, FunctionCallExpr, FunctionColumnDefault, FunctionSource, IdentifierRef, InsertAst, InsertOnConflict, JoinAst, JsonArrayAggExpr, JsonDocumentProjection, JsonObjectExpr, ListExpression, LiteralColumnDefault, LiteralExpr, NativeJsonValueProjection, NotExpr, NullCheckExpr, OperationExpr, OrExpr, OrderByItem, ParamRef, PreparedParamRef, PrimaryKeyConstraint, ProjectionItem, RawExpr, RawQueryAst, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_VARCHAR_CODEC_ID, SelectAst, SqlCharCodec, SqlCharDescriptor, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, SqlTextCodec, SqlTextDescriptor, SqlVarcharCodec, SqlVarcharDescriptor, SubqueryExpr, TableSource, UniqueConstraint, UpdateAst, WindowFuncExpr, aggregateFnNames, buildOperation, canonicalDateTime, canonicalNumeralText, codecOf, collectOrderedParamRefs, compact, createNumberClassifier, createRawSql, createSqlParamRefMutator, escapePslString, frozenCodecRef, isAggregateFn, isDdlNode, isExpression, isNonFiniteText, isNumeralText, isOrderByDirection, isOrderByNulls, isQueryAst, isWhereExpr, numeralText, param, parseJsonBody, planFromAst, printJsonBody, queryAstKinds, signedRange, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDecodeJson, sqlFloatDescriptor, sqlFloatEncode, sqlFloatEncodeJson, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, toExpr, whereExprKinds };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $ as InsertValue, A as DefaultValueExpr, At as SqlCodecCallContext, B as EqColJoinOn, Bt as WindowFuncExpr, C as CodecCallContext$1, Ct as RawExpr, D as CodecTrait$1, Dt as RawSqlLiteral, E as CodecRef$1, Et as RawQueryResult, F as DescriptorCodecJson, Ft as TableSource, G as ExpressionSource, Gt as isOrderByNulls, H as ExprVisitor, Ht as frozenCodecRef, I as DescriptorCodecTraits, It as ToWhereExpr, J as FunctionSource, Jt as queryAstKinds, K as ExtractCodecTypes, Kt as isQueryAst, L as Direction, Lt as UpdateAst, M as DerivedTableSource, Mt as SqlColumnRef, N as DescriptorCodecId, Nt as SubqueryExpr, O as ColumnRef, Ot as SelectAst, P as DescriptorCodecInput, Pt as TableRef, Q as InsertOnConflict, R as DoNothingConflictAction, Rt as WhereArg, S as Codec$1, St as ProjectionItem, T as CodecJsonValueProjection, Tt as RawQueryColumn, U as ExpressionFolder, Ut as isAggregateFn, V as ExistsExpr, Vt as aggregateFnNames, W as ExpressionRewriter, Wt as isOrderByDirection, X as IdentifierRef, Y as FunctionSourceAlias, Yt as whereExprKinds, Z as InsertAst, _ as BinaryExpr, _t as OrderByItem, a as AndExpr, at as JsonObjectExpr, b as CaseExpr, bt as PreparedParamRef, c as AnyExpression, ct as ListExpression, d as AnyInsertValue, dt as LoweredStatement, et as JoinAst, f as AnyJsonValueProjection, ft as NativeJsonValueProjection, g as AstRewriter, gt as OrExpr, h as AnyQueryAst, ht as OperationExpr, i as AggregateOpFn, it as JsonObjectEntry, j as DeleteAst, jt as SqlCodecInstanceContext, k as ContractCodecRegistry, kt as SelectAstOptions, l as AnyFromSource, lt as LiteralExpr, m as AnyParamRef, mt as NullCheckExpr, n as AggregateExpr, nt as JsonArrayAggExpr, o as AnyCodecDescriptor, ot as JsonValueProjectionVisitor, p as AnyOperationArg, pt as NotExpr, q as FunctionCallExpr, qt as isWhereExpr, r as AggregateFn, rt as JsonDocumentProjection, s as AnyCodecDescriptorTemplate, st as LimitOffsetValue, t as AggregateCountFn, tt as JoinOnExpr, u as AnyInsertOnConflictAction, ut as LoweredParam, v as BinaryOp, vt as OrderByNulls, w as CodecDescriptor$1, wt as RawQueryAst, x as CastExpr, xt as ProjectionExpr, y as CaseBranch, yt as ParamRef, z as DoUpdateSetConflictAction, zt as WindowFn } from "./types-Yui2yFf6-TP-oRDTX.mjs";
|
|
2
2
|
import { a as SqlDriverState, c as SqlQueryable, i as SqlDriver, l as SqlStatementStats, n as PreparedStatementHandle, o as SqlExecuteRequest, r as SqlConnection, s as SqlExplainResult, t as PreparedExecuteRequest, u as SqlTransaction } from "./driver-types-BQtRkOJ0-Bv2RPSfr.mjs";
|
|
3
3
|
import { a as DdlColumnDefaultVisitor, c as DdlTableConstraint, d as LiteralColumnDefault, f as PrimaryKeyConstraint, i as DdlColumnDefault, l as ForeignKeyConstraint, m as isDdlNode, n as CheckExpressionConstraint, o as DdlColumnRenderContext, p as UniqueConstraint, r as DdlColumn, s as DdlNode, t as AnyDdlColumnDefault, u as FunctionColumnDefault } from "./ddl-types-DD-i-Uj9-D99heD5Z.mjs";
|
|
4
|
-
import { $ as
|
|
5
|
-
export { Adapter, AdapterProfile, AdapterTarget, AggregateCountFn, AggregateExpr, AggregateFn, AggregateOpFn, AndExpr, AnyCodecDescriptor, AnyCodecDescriptorTemplate, AnyDdlColumnDefault, AnyExpression, AnyFromSource, AnyInsertOnConflictAction, AnyInsertValue, AnyJsonValueProjection, AnyOperationArg, AnyParamRef, AnyQueryAst, AstRewriter, BinaryExpr, BinaryOp, CaseBranch, CaseExpr, CastExpr, CheckExpressionConstraint, Codec$1 as Codec, type CodecCallContext$1 as CodecCallContext, type CodecDescriptor$1 as CodecDescriptor, CodecJsonValueProjection, type CodecRef$1 as CodecRef, type CodecTrait$1 as CodecTrait, ColumnRef, ContractCodecRegistry, DdlColumn, DdlColumnDefault, DdlColumnDefaultVisitor, DdlColumnRenderContext, DdlNode, DdlTableConstraint, DefaultValueExpr, DeleteAst, DerivedTableSource, DescriptorCodecId, DescriptorCodecInput, DescriptorCodecJson, DescriptorCodecTraits, Direction, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, ExprVisitor, ExpressionFolder, ExpressionRewriter, ExpressionSource, ExtractCodecTypes, ForeignKeyConstraint, FunctionCallExpr, FunctionColumnDefault, FunctionSource, FunctionSourceAlias, IdentifierRef, InsertAst, InsertOnConflict, InsertValue, IntegerStep, JoinAst, JoinOnExpr, JsonArrayAggExpr, JsonDocumentProjection, JsonObjectEntry, JsonObjectExpr, JsonValueProjectionVisitor, LimitOffsetValue, ListExpression, LiteralColumnDefault, LiteralExpr, LoweredParam, LoweredStatement, Lowerer, LowererContext, MarkerReadResult, NativeJsonValueProjection, NotExpr, NullCheckExpr, NumberClassification, NumberClassifierSpec, OperationExpr, OrExpr, OrderByItem, OrderByNulls, ParamRef, PreparedExecuteRequest, PreparedParamRef, PreparedStatementHandle, PrimaryKeyConstraint, ProjectionExpr, ProjectionItem, RawExpr, RawQueryAst, RawQueryColumn, RawQueryResult, RawSqlLiteral, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_VARCHAR_CODEC_ID, SelectAst, SelectAstOptions, SqlCharCodec, SqlCharDescriptor, SqlCodecCallContext, SqlCodecInstanceContext, SqlColumnRef, SqlConnection, SqlDriver, SqlDriverState, SqlExecuteRequest, SqlExplainResult, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, SqlQueryable, SqlStatementStats, SqlTextCodec, SqlTextDescriptor, SqlTransaction, SqlVarcharCodec, SqlVarcharDescriptor, SubqueryExpr, TableRef, TableSource, ToWhereExpr, UniqueConstraint, UpdateAst, WhereArg, WindowFn, WindowFuncExpr, aggregateFnNames, canonicalNumeralText, collectOrderedParamRefs, compact, createNumberClassifier, escapePslString, frozenCodecRef, isAggregateFn, isDdlNode, isNonFiniteText, isNumeralText, isOrderByDirection, isOrderByNulls, isQueryAst, isWhereExpr, numeralText, parseJsonBody, printJsonBody, queryAstKinds, signedRange, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDecodeJson, sqlFloatDescriptor, sqlFloatEncode, sqlFloatEncodeJson, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, whereExprKinds };
|
|
4
|
+
import { $ as sqlIntEncode, A as compact, B as sqlCharDecode, C as SqlTextCodec, D as canonicalDateTime, E as SqlVarcharDescriptor, F as numeralText, G as sqlFloatDecode, H as sqlCharEncode, I as parseJsonBody, J as sqlFloatEncode, K as sqlFloatDecodeJson, L as printJsonBody, M as escapePslString, N as isNonFiniteText, O as canonicalNumeralText, P as isNumeralText, Q as sqlIntDescriptor, R as signedRange, S as SqlIntDescriptor, T as SqlVarcharCodec, U as sqlCharRenderOutputType, V as sqlCharDescriptor, W as sqlFloatColumn, X as sqlIntColumn, Y as sqlFloatEncodeJson, Z as sqlIntDecode, _ as SqlCharCodec, a as DateTimeShape, at as sqlVarcharDecode, b as SqlFloatDescriptor, c as LowererContext, ct as sqlVarcharRenderOutputType, d as NumberClassifierSpec, et as sqlTextColumn, f as SQL_CHAR_CODEC_ID, g as SQL_VARCHAR_CODEC_ID, h as SQL_TEXT_CODEC_ID, i as CanonicalDateTimeOptions, it as sqlVarcharColumn, j as createNumberClassifier, k as collectOrderedParamRefs, l as MarkerReadResult, m as SQL_INT_CODEC_ID, n as AdapterProfile, nt as sqlTextDescriptor, o as IntegerStep, ot as sqlVarcharDescriptor, p as SQL_FLOAT_CODEC_ID, q as sqlFloatDescriptor, r as AdapterTarget, rt as sqlTextEncode, s as Lowerer, st as sqlVarcharEncode, t as Adapter, tt as sqlTextDecode, u as NumberClassification, v as SqlCharDescriptor, w as SqlTextDescriptor, x as SqlIntCodec, y as SqlFloatCodec, z as sqlCharColumn } from "./ast-DQU1yUQ5.mjs";
|
|
5
|
+
export { Adapter, AdapterProfile, AdapterTarget, AggregateCountFn, AggregateExpr, AggregateFn, AggregateOpFn, AndExpr, AnyCodecDescriptor, AnyCodecDescriptorTemplate, AnyDdlColumnDefault, AnyExpression, AnyFromSource, AnyInsertOnConflictAction, AnyInsertValue, AnyJsonValueProjection, AnyOperationArg, AnyParamRef, AnyQueryAst, AstRewriter, BinaryExpr, BinaryOp, CanonicalDateTimeOptions, CaseBranch, CaseExpr, CastExpr, CheckExpressionConstraint, Codec$1 as Codec, type CodecCallContext$1 as CodecCallContext, type CodecDescriptor$1 as CodecDescriptor, CodecJsonValueProjection, type CodecRef$1 as CodecRef, type CodecTrait$1 as CodecTrait, ColumnRef, ContractCodecRegistry, DateTimeShape, DdlColumn, DdlColumnDefault, DdlColumnDefaultVisitor, DdlColumnRenderContext, DdlNode, DdlTableConstraint, DefaultValueExpr, DeleteAst, DerivedTableSource, DescriptorCodecId, DescriptorCodecInput, DescriptorCodecJson, DescriptorCodecTraits, Direction, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, ExprVisitor, ExpressionFolder, ExpressionRewriter, ExpressionSource, ExtractCodecTypes, ForeignKeyConstraint, FunctionCallExpr, FunctionColumnDefault, FunctionSource, FunctionSourceAlias, IdentifierRef, InsertAst, InsertOnConflict, InsertValue, IntegerStep, JoinAst, JoinOnExpr, JsonArrayAggExpr, JsonDocumentProjection, JsonObjectEntry, JsonObjectExpr, JsonValueProjectionVisitor, LimitOffsetValue, ListExpression, LiteralColumnDefault, LiteralExpr, LoweredParam, LoweredStatement, Lowerer, LowererContext, MarkerReadResult, NativeJsonValueProjection, NotExpr, NullCheckExpr, NumberClassification, NumberClassifierSpec, OperationExpr, OrExpr, OrderByItem, OrderByNulls, ParamRef, PreparedExecuteRequest, PreparedParamRef, PreparedStatementHandle, PrimaryKeyConstraint, ProjectionExpr, ProjectionItem, RawExpr, RawQueryAst, RawQueryColumn, RawQueryResult, RawSqlLiteral, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_VARCHAR_CODEC_ID, SelectAst, SelectAstOptions, SqlCharCodec, SqlCharDescriptor, SqlCodecCallContext, SqlCodecInstanceContext, SqlColumnRef, SqlConnection, SqlDriver, SqlDriverState, SqlExecuteRequest, SqlExplainResult, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, SqlQueryable, SqlStatementStats, SqlTextCodec, SqlTextDescriptor, SqlTransaction, SqlVarcharCodec, SqlVarcharDescriptor, SubqueryExpr, TableRef, TableSource, ToWhereExpr, UniqueConstraint, UpdateAst, WhereArg, WindowFn, WindowFuncExpr, aggregateFnNames, canonicalDateTime, canonicalNumeralText, collectOrderedParamRefs, compact, createNumberClassifier, escapePslString, frozenCodecRef, isAggregateFn, isDdlNode, isNonFiniteText, isNumeralText, isOrderByDirection, isOrderByNulls, isQueryAst, isWhereExpr, numeralText, parseJsonBody, printJsonBody, queryAstKinds, signedRange, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDecodeJson, sqlFloatDescriptor, sqlFloatEncode, sqlFloatEncodeJson, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, whereExprKinds };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { A as PreparedParamRef, B as frozenCodecRef, C as LiteralExpr, D as OrExpr, E as OperationExpr, F as SubqueryExpr, G as isWhereExpr, H as isOrderByDirection, I as TableSource, K as queryAstKinds, L as UpdateAst, M as RawExpr, N as RawQueryAst, O as OrderByItem, P as SelectAst, R as WindowFuncExpr, S as ListExpression, T as NullCheckExpr, U as isOrderByNulls, V as isAggregateFn, W as isQueryAst, _ as InsertAst, a as CastExpr, b as JsonArrayAggExpr, c as DeleteAst, d as DoUpdateSetConflictAction, f as EqColJoinOn, g as IdentifierRef, h as FunctionSource, i as CaseExpr, j as ProjectionItem, k as ParamRef, l as DerivedTableSource, m as FunctionCallExpr, n as AndExpr, o as ColumnRef, p as ExistsExpr, q as whereExprKinds, r as BinaryExpr, s as DefaultValueExpr, t as AggregateExpr, u as DoNothingConflictAction, v as InsertOnConflict, w as NotExpr, x as JsonObjectExpr, y as JoinAst, z as aggregateFnNames } from "./types-BPi4d3WI-D8PIEqBU.mjs";
|
|
2
2
|
import { a as ForeignKeyConstraint, c as PrimaryKeyConstraint, i as DdlNode, l as UniqueConstraint, n as DdlColumn, o as FunctionColumnDefault, r as DdlColumnDefault, s as LiteralColumnDefault, t as CheckExpressionConstraint, u as isDdlNode } from "./ddl-types-DOgOmDOh-Cs_MY05h.mjs";
|
|
3
3
|
import { n as compact, t as collectOrderedParamRefs } from "./util-DQQgv2j1-D6INZaRG.mjs";
|
|
4
|
-
import { A as
|
|
5
|
-
export { AggregateExpr, AndExpr, BinaryExpr, CaseExpr, CastExpr, CheckExpressionConstraint, CodecJsonValueProjection, ColumnRef, DdlColumn, DdlColumnDefault, DdlNode, DefaultValueExpr, DeleteAst, DerivedTableSource, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, ForeignKeyConstraint, FunctionCallExpr, FunctionColumnDefault, FunctionSource, IdentifierRef, InsertAst, InsertOnConflict, JoinAst, JsonArrayAggExpr, JsonDocumentProjection, JsonObjectExpr, ListExpression, LiteralColumnDefault, LiteralExpr, NativeJsonValueProjection, NotExpr, NullCheckExpr, OperationExpr, OrExpr, OrderByItem, ParamRef, PreparedParamRef, PrimaryKeyConstraint, ProjectionItem, RawExpr, RawQueryAst, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_VARCHAR_CODEC_ID, SelectAst, SqlCharCodec, SqlCharDescriptor, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, SqlTextCodec, SqlTextDescriptor, SqlVarcharCodec, SqlVarcharDescriptor, SubqueryExpr, TableSource, UniqueConstraint, UpdateAst, WindowFuncExpr, aggregateFnNames, canonicalNumeralText, collectOrderedParamRefs, compact, createNumberClassifier, escapePslString, frozenCodecRef, isAggregateFn, isDdlNode, isNonFiniteText, isNumeralText, isOrderByDirection, isOrderByNulls, isQueryAst, isWhereExpr, numeralText, parseJsonBody, printJsonBody, queryAstKinds, signedRange, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDecodeJson, sqlFloatDescriptor, sqlFloatEncode, sqlFloatEncodeJson, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, whereExprKinds };
|
|
4
|
+
import { A as sqlCharDecode, B as sqlIntColumn, C as isNonFiniteText, D as printJsonBody, E as parseJsonBody, F as sqlFloatDecode, G as sqlTextDecode, H as sqlIntDescriptor, I as sqlFloatDecodeJson, J as sqlVarcharColumn, K as sqlTextDescriptor, L as sqlFloatDescriptor, M as sqlCharEncode, N as sqlCharRenderOutputType, O as signedRange, P as sqlFloatColumn, Q as sqlVarcharRenderOutputType, R as sqlFloatEncode, S as escapePslString, T as numeralText, U as sqlIntEncode, V as sqlIntDecode, W as sqlTextColumn, X as sqlVarcharDescriptor, Y as sqlVarcharDecode, Z as sqlVarcharEncode, _ as SqlVarcharCodec, a as SQL_FLOAT_CODEC_ID, b as canonicalNumeralText, c as SQL_VARCHAR_CODEC_ID, d as SqlFloatCodec, f as SqlFloatDescriptor, g as SqlTextDescriptor, h as SqlTextCodec, i as SQL_CHAR_CODEC_ID, j as sqlCharDescriptor, k as sqlCharColumn, l as SqlCharCodec, m as SqlIntDescriptor, n as JsonDocumentProjection, o as SQL_INT_CODEC_ID, p as SqlIntCodec, q as sqlTextEncode, r as NativeJsonValueProjection, s as SQL_TEXT_CODEC_ID, t as CodecJsonValueProjection, u as SqlCharDescriptor, v as SqlVarcharDescriptor, w as isNumeralText, x as createNumberClassifier, y as canonicalDateTime, z as sqlFloatEncodeJson } from "./ast-CJd4157-.mjs";
|
|
5
|
+
export { AggregateExpr, AndExpr, BinaryExpr, CaseExpr, CastExpr, CheckExpressionConstraint, CodecJsonValueProjection, ColumnRef, DdlColumn, DdlColumnDefault, DdlNode, DefaultValueExpr, DeleteAst, DerivedTableSource, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, ForeignKeyConstraint, FunctionCallExpr, FunctionColumnDefault, FunctionSource, IdentifierRef, InsertAst, InsertOnConflict, JoinAst, JsonArrayAggExpr, JsonDocumentProjection, JsonObjectExpr, ListExpression, LiteralColumnDefault, LiteralExpr, NativeJsonValueProjection, NotExpr, NullCheckExpr, OperationExpr, OrExpr, OrderByItem, ParamRef, PreparedParamRef, PrimaryKeyConstraint, ProjectionItem, RawExpr, RawQueryAst, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_VARCHAR_CODEC_ID, SelectAst, SqlCharCodec, SqlCharDescriptor, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, SqlTextCodec, SqlTextDescriptor, SqlVarcharCodec, SqlVarcharDescriptor, SubqueryExpr, TableSource, UniqueConstraint, UpdateAst, WindowFuncExpr, aggregateFnNames, canonicalDateTime, canonicalNumeralText, collectOrderedParamRefs, compact, createNumberClassifier, escapePslString, frozenCodecRef, isAggregateFn, isDdlNode, isNonFiniteText, isNumeralText, isOrderByDirection, isOrderByNulls, isQueryAst, isWhereExpr, numeralText, parseJsonBody, printJsonBody, queryAstKinds, signedRange, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDecodeJson, sqlFloatDescriptor, sqlFloatEncode, sqlFloatEncodeJson, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, whereExprKinds };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as codecRefForStorageColumn, t as buildCodecDescriptorRegistry } from "./codec-descriptor-registry-
|
|
1
|
+
import { n as codecRefForStorageColumn, t as buildCodecDescriptorRegistry } from "./codec-descriptor-registry-Cj-tqpFL.mjs";
|
|
2
2
|
export { buildCodecDescriptorRegistry, codecRefForStorageColumn };
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as MarkerReadResult } from "./ast-DQU1yUQ5.mjs";
|
|
2
2
|
import { c as TypeHelperRegistry, n as ExecutionContext } from "./query-lane-context-D6o9YrEV-bouFPM6u.mjs";
|
|
3
|
-
import { A as SqlRuntimeAdapterDescriptor, B as VerifyMarkerOption, C as RuntimeQueryable, D as SqlExecutionStackWithDriver, E as SqlExecutionStack, F as SqlRuntimeExtensionInstance, H as createSqlExecutionStack, I as SqlRuntimeTargetDescriptor, L as SqlStaticContributions, M as SqlRuntimeBase, N as SqlRuntimeDriverInstance, O as SqlMiddleware, P as SqlRuntimeExtensionDescriptor, R as TelemetryOutcome, S as RuntimeParameterizedCodecDescriptor, T as RuntimeTransaction, U as deriveParamMetadata, V as createExecutionContext, W as encodeParamsWithMetadata, a as DeclaredNullable, b as RuntimeFamilyAdapter, c as ParamsFromDeclaration, d as PreparedExecutionImpl, f as PreparedFor, g as PreparedStatementInternals, h as PreparedStatementImpl, i as DeclaredCodecId, j as SqlRuntimeAdapterInstance, k as SqlMiddlewareContext, l as PrepareCallback, n as ConnectionProvider, o as MarkerReader, p as PreparedStatement, q as withTransaction, r as Declaration, s as ParamSpec, t as BindSiteParams, u as PreparedExecution, v as Runtime, w as RuntimeTelemetryEvent, x as RuntimeOptions, y as RuntimeConnection, z as TransactionContext } from "./prepared-statement-BHSj2pDk-
|
|
4
|
-
import { a as LintsOptions, c as budgets, d as lints, f as lowerSqlPlan, i as ExecuteInterceptResult, l as createAstCodecRegistry, m as validateContractCodecMappings, n as AfterQueryResult, o as Log, p as validateCodecRegistryCompleteness, r as BudgetsOptions, s as QueryInterceptResult, t as AfterExecuteResult, u as extractCodecIds } from "./index-
|
|
3
|
+
import { A as SqlRuntimeAdapterDescriptor, B as VerifyMarkerOption, C as RuntimeQueryable, D as SqlExecutionStackWithDriver, E as SqlExecutionStack, F as SqlRuntimeExtensionInstance, H as createSqlExecutionStack, I as SqlRuntimeTargetDescriptor, L as SqlStaticContributions, M as SqlRuntimeBase, N as SqlRuntimeDriverInstance, O as SqlMiddleware, P as SqlRuntimeExtensionDescriptor, R as TelemetryOutcome, S as RuntimeParameterizedCodecDescriptor, T as RuntimeTransaction, U as deriveParamMetadata, V as createExecutionContext, W as encodeParamsWithMetadata, a as DeclaredNullable, b as RuntimeFamilyAdapter, c as ParamsFromDeclaration, d as PreparedExecutionImpl, f as PreparedFor, g as PreparedStatementInternals, h as PreparedStatementImpl, i as DeclaredCodecId, j as SqlRuntimeAdapterInstance, k as SqlMiddlewareContext, l as PrepareCallback, n as ConnectionProvider, o as MarkerReader, p as PreparedStatement, q as withTransaction, r as Declaration, s as ParamSpec, t as BindSiteParams, u as PreparedExecution, v as Runtime, w as RuntimeTelemetryEvent, x as RuntimeOptions, y as RuntimeConnection, z as TransactionContext } from "./prepared-statement-BHSj2pDk-BL0wOCnq.mjs";
|
|
4
|
+
import { a as LintsOptions, c as budgets, d as lints, f as lowerSqlPlan, i as ExecuteInterceptResult, l as createAstCodecRegistry, m as validateContractCodecMappings, n as AfterQueryResult, o as Log, p as validateCodecRegistryCompleteness, r as BudgetsOptions, s as QueryInterceptResult, t as AfterExecuteResult, u as extractCodecIds } from "./index-yNeNt2GO.mjs";
|
|
5
5
|
export { type AfterExecuteResult, type AfterQueryResult, type BindSiteParams, type BudgetsOptions, type ConnectionProvider, type Declaration, type DeclaredCodecId, type DeclaredNullable, type ExecuteInterceptResult, type ExecutionContext, type LintsOptions, type Log, type MarkerReadResult, type MarkerReader, type ParamSpec, type ParamsFromDeclaration, type PrepareCallback, type PreparedExecution, PreparedExecutionImpl, type PreparedFor, type PreparedStatement, PreparedStatementImpl, type PreparedStatementInternals, type QueryInterceptResult, type Runtime, type RuntimeConnection, type RuntimeFamilyAdapter, type RuntimeOptions, type RuntimeParameterizedCodecDescriptor, type RuntimeQueryable, type RuntimeTelemetryEvent, type RuntimeTransaction, type SqlExecutionStack, type SqlExecutionStackWithDriver, type SqlMiddleware, type SqlMiddlewareContext, type SqlRuntimeAdapterDescriptor, type SqlRuntimeAdapterInstance, SqlRuntimeBase, type SqlRuntimeDriverInstance, type SqlRuntimeExtensionDescriptor, type SqlRuntimeExtensionInstance, type SqlRuntimeTargetDescriptor, type SqlStaticContributions, type TelemetryOutcome, type TransactionContext, type TypeHelperRegistry, type VerifyMarkerOption, budgets, createAstCodecRegistry, createExecutionContext, createSqlExecutionStack, deriveParamMetadata, encodeParamsWithMetadata, extractCodecIds, lints, lowerSqlPlan, validateCodecRegistryCompleteness, validateContractCodecMappings, withTransaction };
|
package/dist/runtime.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { A as PreparedParamRef, W as isQueryAst } from "./types-BPi4d3WI-D8PIEqB
|
|
|
3
3
|
import { t as collectOrderedParamRefs } from "./util-DQQgv2j1-D6INZaRG.mjs";
|
|
4
4
|
import { t as createSqlParamRefMutator } from "./middleware-CMr4CHNz-DHIUdxlm.mjs";
|
|
5
5
|
import { t as buildSqlAggregateDescriptorRegistry } from "./aggregate-descriptor-registry-CJF2KxUb.mjs";
|
|
6
|
-
import { t as buildCodecDescriptorRegistry } from "./codec-descriptor-registry-
|
|
6
|
+
import { t as buildCodecDescriptorRegistry } from "./codec-descriptor-registry-Cj-tqpFL.mjs";
|
|
7
7
|
import { i as runPreparedQuery, n as preparedStatementQuery, r as runPreparedExecute, t as preparedStatementExecute } from "./prepared-query-BJr50wPm-ChoqfJbX.mjs";
|
|
8
8
|
import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
9
9
|
import { createHash } from "node:crypto";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { G as preparedStatementExecute, K as preparedStatementQuery, _ as PreparedStatementQueryTarget, m as PreparedStatementExecuteTarget } from "./prepared-statement-BHSj2pDk-
|
|
1
|
+
import { G as preparedStatementExecute, K as preparedStatementQuery, _ as PreparedStatementQueryTarget, m as PreparedStatementExecuteTarget } from "./prepared-statement-BHSj2pDk-BL0wOCnq.mjs";
|
|
2
2
|
export { type PreparedStatementExecuteTarget, type PreparedStatementQueryTarget, preparedStatementExecute, preparedStatementQuery };
|
package/dist/{schema-differ-DpG_gnur-B_rj2WAH.d.mts → schema-differ-DpG_gnur-3ciAcy28.d.mts}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c as SqlStorage } from "./sql-storage-8LqxeLAY-DH4DdUXx.mjs";
|
|
2
2
|
import "./types-C36_3E6_.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import "./types-
|
|
3
|
+
import { y as SqlSchemaIRNode } from "./types-DinsvYdY-Dv_n3Tac.mjs";
|
|
4
|
+
import "./types-BBT7jidC.mjs";
|
|
5
5
|
import { Contract, ControlPolicy } from "@prisma/orm-framework/contract/types";
|
|
6
6
|
import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
|
|
7
7
|
import { SchemaDiffIssue } from "@prisma/orm-framework/components/control";
|
|
@@ -44,4 +44,4 @@ interface SqlSchemaDiffInput {
|
|
|
44
44
|
type SqlSchemaDiffFn = (input: SqlSchemaDiffInput) => SqlSchemaDiffResult;
|
|
45
45
|
//#endregion
|
|
46
46
|
export { SqlSchemaDiffInput as n, SqlSchemaDiffResult as r, SqlSchemaDiffFn as t };
|
|
47
|
-
//# sourceMappingURL=schema-differ-DpG_gnur-
|
|
47
|
+
//# sourceMappingURL=schema-differ-DpG_gnur-3ciAcy28.d.mts.map
|
package/dist/{schema-differ-DpG_gnur-B_rj2WAH.d.mts.map → schema-differ-DpG_gnur-3ciAcy28.d.mts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-differ-DpG_gnur-
|
|
1
|
+
{"version":3,"file":"schema-differ-DpG_gnur-3ciAcy28.d.mts","names":[],"sources":["../../../../2-sql/9-family/dist/schema-differ-DpG_gnur.d.mts"],"mappings":";;;;;;;;;;;;;;;;;UAcU;;WAEC,iBAAiB;;;;;;;;;WASjB,uBAAuB,OAAO,oBAAoB;;;;;;WAMlD,gBAAgB;aACd,QAAQ;;;UAGX;WACC,UAAU,SAAS;WACnB,QAAQ;WACR,qBAAqB,cAAc;;KAEzC,mBAAmB,OAAO,uBAAuB"}
|
package/dist/schema-ir.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export { PrimaryKey, type PrimaryKeyInput, RelationalSchemaNodeKind, type SqlAnnotations, SqlCheckConstraintIR, type SqlCheckConstraintIRInput, SqlColumnDefaultIR, type SqlColumnDefaultIRInput, SqlColumnIR, type SqlColumnIRInput, SqlForeignKeyIR, type SqlForeignKeyIRInput, SqlIndexIR, type SqlIndexIRInput, type SqlReferentialAction, SqlSchemaIR, type SqlSchemaIRInput, SqlSchemaIRNode, SqlTableIR, type SqlTableIRInput, type SqlTypeMetadata, type SqlTypeMetadataRegistry, SqlUniqueIR, type SqlUniqueIRInput, assertNode, defineNonEnumerable, relationalNodeEntityKind, relationalNodeGranularity };
|
|
1
|
+
import { A as relationalNodeEntityKind, C as SqlTypeMetadataRegistry, D as contractDefaultRefusal, E as assertNode, O as defaultInCanonicalForm, S as SqlTypeMetadata, T as SqlUniqueIRInput, _ as SqlSchemaIR, a as SqlAnnotations, b as SqlTableIR, c as SqlColumnDefaultIR, d as SqlColumnIRInput, f as SqlForeignKeyIR, g as SqlReferentialAction, h as SqlIndexIRInput, i as RelationalSchemaNodeKind, j as relationalNodeGranularity, k as defineNonEnumerable, l as SqlColumnDefaultIRInput, m as SqlIndexIR, n as PrimaryKey, o as SqlCheckConstraintIR, p as SqlForeignKeyIRInput, r as PrimaryKeyInput, s as SqlCheckConstraintIRInput, t as DefaultInCanonicalForm, u as SqlColumnIR, v as SqlSchemaIRInput, w as SqlUniqueIR, x as SqlTableIRInput, y as SqlSchemaIRNode } from "./types-DinsvYdY-Dv_n3Tac.mjs";
|
|
2
|
+
export { type DefaultInCanonicalForm, PrimaryKey, type PrimaryKeyInput, RelationalSchemaNodeKind, type SqlAnnotations, SqlCheckConstraintIR, type SqlCheckConstraintIRInput, SqlColumnDefaultIR, type SqlColumnDefaultIRInput, SqlColumnIR, type SqlColumnIRInput, SqlForeignKeyIR, type SqlForeignKeyIRInput, SqlIndexIR, type SqlIndexIRInput, type SqlReferentialAction, SqlSchemaIR, type SqlSchemaIRInput, SqlSchemaIRNode, SqlTableIR, type SqlTableIRInput, type SqlTypeMetadata, type SqlTypeMetadataRegistry, SqlUniqueIR, type SqlUniqueIRInput, assertNode, contractDefaultRefusal, defaultInCanonicalForm, defineNonEnumerable, relationalNodeEntityKind, relationalNodeGranularity };
|
package/dist/schema-ir.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as SqlColumnIR, c as SqlSchemaIR, d as SqlUniqueIR, f as assertNode, h as
|
|
2
|
-
export { PrimaryKey, RelationalSchemaNodeKind, SqlCheckConstraintIR, SqlColumnDefaultIR, SqlColumnIR, SqlForeignKeyIR, SqlIndexIR, SqlSchemaIR, SqlSchemaIRNode, SqlTableIR, SqlUniqueIR, assertNode, defineNonEnumerable, relationalNodeEntityKind, relationalNodeGranularity };
|
|
1
|
+
import { _ as relationalNodeGranularity, a as SqlColumnIR, c as SqlSchemaIR, d as SqlUniqueIR, f as assertNode, g as relationalNodeEntityKind, h as defineNonEnumerable, i as SqlColumnDefaultIR, l as SqlSchemaIRNode, m as defaultInCanonicalForm, n as RelationalSchemaNodeKind, o as SqlForeignKeyIR, p as contractDefaultRefusal, r as SqlCheckConstraintIR, s as SqlIndexIR, t as PrimaryKey, u as SqlTableIR } from "./types-yyhkYQNT-Dmoq-giA.mjs";
|
|
2
|
+
export { PrimaryKey, RelationalSchemaNodeKind, SqlCheckConstraintIR, SqlColumnDefaultIR, SqlColumnIR, SqlForeignKeyIR, SqlIndexIR, SqlSchemaIR, SqlSchemaIRNode, SqlTableIR, SqlUniqueIR, assertNode, contractDefaultRefusal, defaultInCanonicalForm, defineNonEnumerable, relationalNodeEntityKind, relationalNodeGranularity };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as computeIndexContentHash, c as formatWireName, d as namingOfLiveName, f as normalizeIndexOptionValue, g as truncateToWireNamePrefixBytes, h as parseWireName, i as computeCheckContentHash, l as nameOf, m as parseNaming, n as assertWireNamePrefixLength, o as defaultIndexName, p as normalizeSqlBody, r as composeCheckWirePrefix, s as derivedCheckPrefixes, t as WIRE_NAME_PREFIX_MAX_BYTES, u as namingOf } from "./naming-
|
|
1
|
+
import { a as computeIndexContentHash, c as formatWireName, d as namingOfLiveName, f as normalizeIndexOptionValue, g as truncateToWireNamePrefixBytes, h as parseWireName, i as computeCheckContentHash, l as nameOf, m as parseNaming, n as assertWireNamePrefixLength, o as defaultIndexName, p as normalizeSqlBody, r as composeCheckWirePrefix, s as derivedCheckPrefixes, t as WIRE_NAME_PREFIX_MAX_BYTES, u as namingOf } from "./naming-Cc_t1q6s-CouBOmqZ.mjs";
|
|
2
2
|
export { WIRE_NAME_PREFIX_MAX_BYTES, assertWireNamePrefixLength, composeCheckWirePrefix, computeCheckContentHash, computeIndexContentHash, defaultIndexName, derivedCheckPrefixes, formatWireName, nameOf, namingOf, namingOfLiveName, normalizeIndexOptionValue, normalizeSqlBody, parseNaming, parseWireName, truncateToWireNamePrefixBytes };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import "./types-
|
|
3
|
-
export { PrimaryKey, type PrimaryKeyInput, RelationalSchemaNodeKind, type SqlAnnotations, SqlCheckConstraintIR, type SqlCheckConstraintIRInput, SqlColumnDefaultIR, type SqlColumnDefaultIRInput, SqlColumnIR, type SqlColumnIRInput, SqlForeignKeyIR, type SqlForeignKeyIRInput, SqlIndexIR, type SqlIndexIRInput, type SqlReferentialAction, SqlSchemaIR, type SqlSchemaIRInput, SqlSchemaIRNode, SqlTableIR, type SqlTableIRInput, type SqlTypeMetadata, type SqlTypeMetadataRegistry, SqlUniqueIR, type SqlUniqueIRInput, assertNode, defineNonEnumerable, relationalNodeEntityKind, relationalNodeGranularity };
|
|
1
|
+
import { A as relationalNodeEntityKind, C as SqlTypeMetadataRegistry, D as contractDefaultRefusal, E as assertNode, O as defaultInCanonicalForm, S as SqlTypeMetadata, T as SqlUniqueIRInput, _ as SqlSchemaIR, a as SqlAnnotations, b as SqlTableIR, c as SqlColumnDefaultIR, d as SqlColumnIRInput, f as SqlForeignKeyIR, g as SqlReferentialAction, h as SqlIndexIRInput, i as RelationalSchemaNodeKind, j as relationalNodeGranularity, k as defineNonEnumerable, l as SqlColumnDefaultIRInput, m as SqlIndexIR, n as PrimaryKey, o as SqlCheckConstraintIR, p as SqlForeignKeyIRInput, r as PrimaryKeyInput, s as SqlCheckConstraintIRInput, t as DefaultInCanonicalForm, u as SqlColumnIR, v as SqlSchemaIRInput, w as SqlUniqueIR, x as SqlTableIRInput, y as SqlSchemaIRNode } from "./types-DinsvYdY-Dv_n3Tac.mjs";
|
|
2
|
+
import "./types-BBT7jidC.mjs";
|
|
3
|
+
export { type DefaultInCanonicalForm, PrimaryKey, type PrimaryKeyInput, RelationalSchemaNodeKind, type SqlAnnotations, SqlCheckConstraintIR, type SqlCheckConstraintIRInput, SqlColumnDefaultIR, type SqlColumnDefaultIRInput, SqlColumnIR, type SqlColumnIRInput, SqlForeignKeyIR, type SqlForeignKeyIRInput, SqlIndexIR, type SqlIndexIRInput, type SqlReferentialAction, SqlSchemaIR, type SqlSchemaIRInput, SqlSchemaIRNode, SqlTableIR, type SqlTableIRInput, type SqlTypeMetadata, type SqlTypeMetadataRegistry, SqlUniqueIR, type SqlUniqueIRInput, assertNode, contractDefaultRefusal, defaultInCanonicalForm, defineNonEnumerable, relationalNodeEntityKind, relationalNodeGranularity };
|