@prisma/orm-family-sql 8.0.0-rc.1-dev.46 → 8.0.0-rc.10
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/README.md +2 -6
- package/dist/{ast-Lbl4VwqP.mjs → ast-5tg0fGPQ.mjs} +2 -58
- package/dist/ast-5tg0fGPQ.mjs.map +1 -0
- package/dist/{ast-HFcfQZr-.d.mts → ast-DuLukI6f.d.mts} +4 -36
- package/dist/ast-DuLukI6f.d.mts.map +1 -0
- package/dist/{authored-check-naming-Hf9990DV.mjs → authored-check-naming-BEvfamnI.mjs} +2 -2
- package/dist/{authored-check-naming-Hf9990DV.mjs.map → authored-check-naming-BEvfamnI.mjs.map} +1 -1
- package/dist/{authoring-type-constructors-Blqoa2Ua-DqvNCOb2.mjs → authoring-type-constructors-BD-XuavC-CJV-TxFh.mjs} +10 -4
- package/dist/authoring-type-constructors-BD-XuavC-CJV-TxFh.mjs.map +1 -0
- package/dist/builder.d.mts +3 -3
- package/dist/builder__runtime.d.mts +26 -9
- package/dist/builder__runtime.d.mts.map +1 -1
- package/dist/builder__runtime.mjs +18 -9
- package/dist/builder__runtime.mjs.map +1 -1
- package/dist/builder__types.d.mts +3 -3
- package/dist/{codec-descriptor-registry-N0dhtKaH.mjs → codec-descriptor-registry-ECZ4ohtG.mjs} +2 -2
- package/dist/{codec-descriptor-registry-N0dhtKaH.mjs.map → codec-descriptor-registry-ECZ4ohtG.mjs.map} +1 -1
- package/dist/{config-types-gAm54C_v.mjs → config-types-BNJgLUUQ.mjs} +2 -2
- package/dist/{config-types-gAm54C_v.mjs.map → config-types-BNJgLUUQ.mjs.map} +1 -1
- package/dist/{config-types-D9fdKG3g.d.mts → config-types-Bd3ud-mX.d.mts} +3 -3
- package/dist/{config-types-D9fdKG3g.d.mts.map → config-types-Bd3ud-mX.d.mts.map} +1 -1
- package/dist/{contract-builder-D4a5dT7j.mjs → contract-builder-BOmEsrRi.mjs} +24 -5
- package/dist/contract-builder-BOmEsrRi.mjs.map +1 -0
- package/dist/{contract-builder-CG_tGDbB.d.mts → contract-builder-De_sioHE.d.mts} +15 -3
- package/dist/contract-builder-De_sioHE.d.mts.map +1 -0
- package/dist/contract-emitter.mjs +1 -1
- package/dist/contract-psl.d.mts +1 -1
- package/dist/contract-psl.mjs +1 -1
- package/dist/contract-psl__attribute-specs.d.mts +77 -0
- package/dist/contract-psl__attribute-specs.d.mts.map +1 -0
- package/dist/contract-psl__attribute-specs.mjs +2 -0
- package/dist/contract-psl__provider.d.mts +1 -1
- package/dist/contract-psl__provider.mjs +3 -3
- package/dist/contract-psl__provider.mjs.map +1 -1
- package/dist/contract-ts.d.mts +3 -3
- package/dist/contract-ts.mjs +3 -3
- package/dist/contract-ts__config-types.d.mts +1 -1
- package/dist/contract-ts__config-types.mjs +1 -1
- package/dist/contract-ts__contract-builder.d.mts +2 -2
- package/dist/contract-ts__contract-builder.mjs +2 -2
- package/dist/contract.d.mts +3 -3
- package/dist/contract.mjs +6 -6
- package/dist/contract__authored-check-naming.mjs +1 -1
- package/dist/contract__foreign-key-materialization.mjs +1 -1
- package/dist/contract__index-naming.mjs +1 -1
- package/dist/contract__types.d.mts +2 -2
- package/dist/contract__types.mjs +2 -2
- package/dist/contract__validators.d.mts +2 -2
- package/dist/contract__validators.mjs +2 -2
- package/dist/{control-D3cB5YQp.mjs → control-BIIMOKMy.mjs} +11 -9
- package/dist/control-BIIMOKMy.mjs.map +1 -0
- package/dist/{control-adapter-C99J7aEF-B7eQd7vD.d.mts → control-adapter-C99J7aEF-GODO43Ai.d.mts} +5 -5
- package/dist/{control-adapter-C99J7aEF-B7eQd7vD.d.mts.map → control-adapter-C99J7aEF-GODO43Ai.d.mts.map} +1 -1
- package/dist/control-adapter-DzTFiMaG.d.mts +1 -0
- package/dist/{control-DTLJ1WtZ.d.mts → control-b-6t8eI_.d.mts} +138 -19
- package/dist/control-b-6t8eI_.d.mts.map +1 -0
- package/dist/{db-D18PrXKW-DvTv4JFn.d.mts → db-BhQdL6Za-DubRGJvv.d.mts} +86 -62
- package/dist/{db-D18PrXKW-DvTv4JFn.d.mts.map → db-BhQdL6Za-DubRGJvv.d.mts.map} +1 -1
- package/dist/{ddl-types-CXx4vPz6-BsgrnSUY.d.mts → ddl-types-CXx4vPz6-Dko-GTTj.d.mts} +3 -3
- package/dist/{ddl-types-CXx4vPz6-BsgrnSUY.d.mts.map → ddl-types-CXx4vPz6-Dko-GTTj.d.mts.map} +1 -1
- package/dist/{derived-checks-DFMRmiAu-DGfB8aS4.mjs → derived-checks-DGjY5t7S-B3txNm7X.mjs} +48 -15
- package/dist/derived-checks-DGjY5t7S-B3txNm7X.mjs.map +1 -0
- package/dist/{derived-checks-DPdD01O0-DGqOFjs6.d.mts → derived-checks-DPdD01O0-DNBs1ZDA.d.mts} +2 -2
- package/dist/{derived-checks-DPdD01O0-DGqOFjs6.d.mts.map → derived-checks-DPdD01O0-DNBs1ZDA.d.mts.map} +1 -1
- package/dist/{diff-DbTNVm2f.d.mts → diff-CN1ou7vM.d.mts} +5 -5
- package/dist/{diff-DbTNVm2f.d.mts.map → diff-CN1ou7vM.d.mts.map} +1 -1
- package/dist/{dist-ZK6oeI5e.mjs → dist-D5__KJs-.mjs} +2 -1
- package/dist/dist-D5__KJs-.mjs.map +1 -0
- package/dist/{expression-CX5mTA-z.mjs → expression-B2Ox7zKM.mjs} +6 -2
- package/dist/expression-B2Ox7zKM.mjs.map +1 -0
- package/dist/{expression-FJK6Ar-d.d.mts → expression-mku9I7Ue.d.mts} +16 -7
- package/dist/{expression-FJK6Ar-d.d.mts.map → expression-mku9I7Ue.d.mts.map} +1 -1
- package/dist/family.d.mts +10 -10
- package/dist/family.mjs +8 -8
- 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.d.mts +1 -1
- package/dist/family__ir.mjs +1 -1
- package/dist/family__migration.d.mts +1 -1
- package/dist/family__pack.d.mts +72 -0
- package/dist/family__pack.d.mts.map +1 -1
- package/dist/family__pack.mjs +4 -2
- package/dist/family__pack.mjs.map +1 -1
- package/dist/family__psl-infer.mjs +1 -1
- package/dist/family__runtime.d.mts +1 -1
- package/dist/family__runtime.mjs +1 -1
- package/dist/family__verify.mjs +1 -1
- package/dist/{foreign-key-materialization-Cu7-7LHl.mjs → foreign-key-materialization-0TrwfShD.mjs} +2 -2
- package/dist/{foreign-key-materialization-Cu7-7LHl.mjs.map → foreign-key-materialization-0TrwfShD.mjs.map} +1 -1
- package/dist/{index-C5I8D-MB.d.mts → index-CLAshwKN.d.mts} +2 -2
- package/dist/{index-C5I8D-MB.d.mts.map → index-CLAshwKN.d.mts.map} +1 -1
- package/dist/{index-C-vQOMY_.d.mts → index-DzBzeTAy.d.mts} +10 -10
- package/dist/{index-C-vQOMY_.d.mts.map → index-DzBzeTAy.d.mts.map} +1 -1
- package/dist/{index-naming-DREt6js7-CRH27yUv.mjs → index-naming-fQMLqyC4-4FzPVtCR.mjs} +4 -4
- package/dist/index-naming-fQMLqyC4-4FzPVtCR.mjs.map +1 -0
- package/dist/{interpreter-DyiUUAWh-DYdjIpiE.mjs → interpreter-CZ_iVQV4-CJ6COgSE.mjs} +123 -302
- package/dist/interpreter-CZ_iVQV4-CJ6COgSE.mjs.map +1 -0
- package/dist/ir-I-xciGUH.mjs.map +1 -1
- package/dist/{ir-Bghjt-FG.d.mts → ir-R9GE8gsm.d.mts} +2 -2
- package/dist/{ir-Bghjt-FG.d.mts.map → ir-R9GE8gsm.d.mts.map} +1 -1
- package/dist/{middleware-AhTz1BOW-th-Suxuf.d.mts → middleware-AhTz1BOW-CtQWS4mb.d.mts} +2 -2
- package/dist/{middleware-AhTz1BOW-th-Suxuf.d.mts.map → middleware-AhTz1BOW-CtQWS4mb.d.mts.map} +1 -1
- package/dist/middleware-Cev-ZFyS.d.mts +1 -0
- package/dist/{migration-CjDRZNep.d.mts → migration-Bhce5i_m.d.mts} +3 -3
- package/dist/{migration-CjDRZNep.d.mts.map → migration-Bhce5i_m.d.mts.map} +1 -1
- package/dist/operations.d.mts +1 -1
- package/dist/orm-client.d.mts +131 -95
- package/dist/orm-client.d.mts.map +1 -1
- package/dist/orm-client.mjs +1021 -942
- package/dist/orm-client.mjs.map +1 -1
- package/dist/plan-C7VP7jOh.d.mts +2 -0
- package/dist/{plan-CDxduYaN-pLIyyJaB.d.mts → plan-CDxduYaN-B2kMLIQQ.d.mts} +3 -3
- package/dist/{plan-CDxduYaN-pLIyyJaB.d.mts.map → plan-CDxduYaN-B2kMLIQQ.d.mts.map} +1 -1
- package/dist/{prepared-statement-9QpkE6JG-C430V3MO.d.mts → prepared-statement-9QpkE6JG-B9xqBu5T.d.mts} +16 -16
- package/dist/{prepared-statement-9QpkE6JG-C430V3MO.d.mts.map → prepared-statement-9QpkE6JG-B9xqBu5T.d.mts.map} +1 -1
- package/dist/{psl-infer-Dk5kgKre.mjs → psl-infer-TBwKfKgU.mjs} +2 -2
- package/dist/{psl-infer-Dk5kgKre.mjs.map → psl-infer-TBwKfKgU.mjs.map} +1 -1
- package/dist/query-lane-context-CGdMIEuv.d.mts +1 -0
- package/dist/{query-lane-context-Qa-eddrE-kuZ8Z86-.d.mts → query-lane-context-Qa-eddrE-BQV6J9nV.d.mts} +4 -4
- package/dist/{query-lane-context-Qa-eddrE-kuZ8Z86-.d.mts.map → query-lane-context-Qa-eddrE-BQV6J9nV.d.mts.map} +1 -1
- package/dist/relational-core.d.mts +12 -12
- package/dist/relational-core.mjs +3 -3
- package/dist/relational-core__aggregate-descriptor-registry.d.mts +1 -1
- package/dist/relational-core__ast.d.mts +4 -4
- package/dist/relational-core__ast.mjs +2 -2
- package/dist/relational-core__codec-descriptor-registry.d.mts +3 -3
- package/dist/relational-core__codec-descriptor-registry.mjs +1 -1
- package/dist/relational-core__contract-free.d.mts +3 -3
- package/dist/relational-core__expression.d.mts +1 -1
- package/dist/relational-core__expression.mjs +1 -1
- package/dist/relational-core__middleware.d.mts +2 -2
- package/dist/relational-core__plan.d.mts +3 -3
- package/dist/relational-core__query-lane-context.d.mts +2 -2
- package/dist/relational-core__types.d.mts +2 -2
- package/dist/{runtime-DpKF2Yu2.d.mts → runtime-CzCx0TKe.d.mts} +3 -3
- package/dist/{runtime-DpKF2Yu2.d.mts.map → runtime-CzCx0TKe.d.mts.map} +1 -1
- package/dist/{runtime-tIHpGCcG.mjs → runtime-PknWErjr.mjs} +2 -2
- package/dist/{runtime-tIHpGCcG.mjs.map → runtime-PknWErjr.mjs.map} +1 -1
- package/dist/runtime.d.mts +4 -4
- package/dist/runtime.mjs +2 -2
- package/dist/runtime__internal__prepared-query.d.mts +1 -1
- package/dist/{schema-differ-DpG_gnur-DFAtGezx.d.mts → schema-differ-DpG_gnur-BICVtTHY.d.mts} +2 -2
- package/dist/{schema-differ-DpG_gnur-DFAtGezx.d.mts.map → schema-differ-DpG_gnur-BICVtTHY.d.mts.map} +1 -1
- package/dist/schema-ir.mjs +1 -1
- package/dist/schema-ir__types.mjs +1 -1
- package/dist/{schema-verify-C_PEdlAr-Dxxjm6EM.mjs → schema-verify-C_PEdlAr-CmXrFuW1.mjs} +2 -2
- package/dist/{schema-verify-C_PEdlAr-Dxxjm6EM.mjs.map → schema-verify-C_PEdlAr-CmXrFuW1.mjs.map} +1 -1
- package/dist/sql-attribute-specs-CG0yitvD-CG-0eW98.mjs +275 -0
- package/dist/sql-attribute-specs-CG0yitvD-CG-0eW98.mjs.map +1 -0
- package/dist/{sql-contract-serializer-2oBWuxTe-DKZTf2n8.mjs → sql-contract-serializer-Bxu4a5oQ-D0lKpb4a.mjs} +24 -5
- package/dist/sql-contract-serializer-Bxu4a5oQ-D0lKpb4a.mjs.map +1 -0
- package/dist/{sql-execution-plan--jKyLpe5-CMGhgO0M.d.mts → sql-execution-plan--jKyLpe5-Bcz9QM2s.d.mts} +2 -2
- package/dist/{sql-execution-plan--jKyLpe5-CMGhgO0M.d.mts.map → sql-execution-plan--jKyLpe5-Bcz9QM2s.d.mts.map} +1 -1
- package/dist/{timestamp-now-generator-DRXygu32-DN9Qb1uI.mjs → timestamp-now-generator-BZnBo7IC-DbN5Apqe.mjs} +27 -19
- package/dist/timestamp-now-generator-BZnBo7IC-DbN5Apqe.mjs.map +1 -0
- package/dist/{types-4YenawkP-CwaaZSid.mjs → types-BvupgHcG-c8QDupnu.mjs} +13 -6
- package/dist/types-BvupgHcG-c8QDupnu.mjs.map +1 -0
- package/dist/{types-UcHa2cTe.d.mts → types-C36_3E6_.d.mts} +3 -2
- package/dist/types-C36_3E6_.d.mts.map +1 -0
- package/dist/{types-CyxGtOOh-BggSa6Fe.d.mts → types-CyxGtOOh-BJnoWm0f.d.mts} +8 -8
- package/dist/{types-CyxGtOOh-BggSa6Fe.d.mts.map → types-CyxGtOOh-BJnoWm0f.d.mts.map} +1 -1
- package/dist/{types-CUsJrvEl.mjs → types-D0B65hip.mjs} +3 -2
- package/dist/types-D0B65hip.mjs.map +1 -0
- package/dist/types-DvsoMNLs.d.mts +1 -0
- package/dist/{types-IqZMLrFC-DcH8v_u3.d.mts → types-IqZMLrFC-BIRftuU7.d.mts} +4 -4
- package/dist/{types-IqZMLrFC-DcH8v_u3.d.mts.map → types-IqZMLrFC-BIRftuU7.d.mts.map} +1 -1
- package/dist/{types-v3qxLLxo-DCeKv7yY.d.mts → types-v3qxLLxo-Clw_yBAh.d.mts} +2 -2
- package/dist/{types-v3qxLLxo-DCeKv7yY.d.mts.map → types-v3qxLLxo-Clw_yBAh.d.mts.map} +1 -1
- package/dist/{validators-Belo8QqM.d.mts → validators-CbqMxQfW.d.mts} +23 -4
- package/dist/validators-CbqMxQfW.d.mts.map +1 -0
- package/dist/{validators-CrWD6bSP.mjs → validators-DD98VrpC.mjs} +0 -0
- package/dist/validators-DD98VrpC.mjs.map +1 -0
- package/dist/{verify-u0UTdZgD-DSAaz9rW.mjs → verify-ChiDeTk8-HEewdjrM.mjs} +3 -3
- package/dist/verify-ChiDeTk8-HEewdjrM.mjs.map +1 -0
- package/package.json +20 -21
- package/dist/ast-HFcfQZr-.d.mts.map +0 -1
- package/dist/ast-Lbl4VwqP.mjs.map +0 -1
- package/dist/authoring-type-constructors-Blqoa2Ua-DqvNCOb2.mjs.map +0 -1
- package/dist/contract-builder-CG_tGDbB.d.mts.map +0 -1
- package/dist/contract-builder-D4a5dT7j.mjs.map +0 -1
- package/dist/control-D3cB5YQp.mjs.map +0 -1
- package/dist/control-DTLJ1WtZ.d.mts.map +0 -1
- package/dist/control-adapter-MZJQiwcE.d.mts +0 -1
- package/dist/derived-checks-DFMRmiAu-DGfB8aS4.mjs.map +0 -1
- package/dist/dist-ZK6oeI5e.mjs.map +0 -1
- package/dist/expression-CX5mTA-z.mjs.map +0 -1
- package/dist/index-naming-DREt6js7-CRH27yUv.mjs.map +0 -1
- package/dist/interpreter-DyiUUAWh-DYdjIpiE.mjs.map +0 -1
- package/dist/lane-query-builder.d.mts +0 -236
- package/dist/lane-query-builder.d.mts.map +0 -1
- package/dist/lane-query-builder.mjs +0 -67
- package/dist/lane-query-builder.mjs.map +0 -1
- package/dist/middleware--TtoxUiW.d.mts +0 -1
- package/dist/plan-BHLdb0Z7.d.mts +0 -2
- package/dist/query-lane-context-XMvk7fmY.d.mts +0 -1
- package/dist/sql-contract-serializer-2oBWuxTe-DKZTf2n8.mjs.map +0 -1
- package/dist/timestamp-now-generator-DRXygu32-DN9Qb1uI.mjs.map +0 -1
- package/dist/types-4YenawkP-CwaaZSid.mjs.map +0 -1
- package/dist/types-B0msOnBM.d.mts +0 -1
- package/dist/types-CUsJrvEl.mjs.map +0 -1
- package/dist/types-UcHa2cTe.d.mts.map +0 -1
- package/dist/validators-Belo8QqM.d.mts.map +0 -1
- package/dist/validators-CrWD6bSP.mjs.map +0 -1
- package/dist/verify-u0UTdZgD-DSAaz9rW.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @prisma/orm-family-sql
|
|
2
2
|
|
|
3
|
-
The SQL family domain of Prisma
|
|
3
|
+
The SQL family domain of Prisma 8: the SQL contract surface, schema IR, query lanes, SQL builder, and the SQL runtime shared by every SQL target (Postgres, SQLite).
|
|
4
4
|
|
|
5
5
|
Applications receive it as an exact-pinned dependency of a SQL facade (`@prisma/orm-postgres`, `@prisma/orm-sqlite`); app developers install the facade. Extension authors and decomposed installs building against the SQL family import it directly.
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ Applications receive it as an exact-pinned dependency of a SQL facade (`@prisma/
|
|
|
12
12
|
| `/schema-ir` | SQL schema intermediate representation |
|
|
13
13
|
| `/contract-psl`, `/contract-ts` | PSL and TypeScript contract authoring for SQL |
|
|
14
14
|
| `/contract-emitter` | SQL contract emission |
|
|
15
|
-
| `/relational-core`, `/
|
|
15
|
+
| `/relational-core`, `/builder` | query lanes, relational AST, SQL builder |
|
|
16
16
|
| `/runtime` | SQL runtime |
|
|
17
17
|
| `/orm-client` | the fluent, type-safe ORM client over SQL model collections |
|
|
18
18
|
| `/family` | the family pack: control, migration, diff, IR, verification |
|
|
@@ -22,7 +22,3 @@ Applications receive it as an exact-pinned dependency of a SQL facade (`@prisma/
|
|
|
22
22
|
Everything SQL databases share and nothing any one of them owns: contract semantics, relational query building, the ORM client, and the family-level control/migration surface. Target-specific behavior (Postgres or SQLite DDL, drivers) lives in the `@prisma/orm-target-*` packages.
|
|
23
23
|
|
|
24
24
|
The ORM client sits here rather than in a facade because both SQL facades use it and a module may be published from only one package. Its source still lives in `packages/3-extensions/sql-orm-client/` for historical reasons; the directory does not make it a user-installed extension.
|
|
25
|
-
|
|
26
|
-
## Dependencies
|
|
27
|
-
|
|
28
|
-
`@prisma/orm-framework` and `@prisma/orm-toolchain` (exact lockstep pins) plus small third-party runtime libraries. No database drivers.
|
|
@@ -67,7 +67,6 @@ const SQL_VARCHAR_CODEC_ID = "sql/varchar@1";
|
|
|
67
67
|
const SQL_INT_CODEC_ID = "sql/int@1";
|
|
68
68
|
const SQL_FLOAT_CODEC_ID = "sql/float@1";
|
|
69
69
|
const SQL_TEXT_CODEC_ID = "sql/text@1";
|
|
70
|
-
const SQL_TIMESTAMP_CODEC_ID = "sql/timestamp@1";
|
|
71
70
|
const sqlCharEncode = (value) => value;
|
|
72
71
|
const sqlCharDecode = (wire) => wire.trimEnd();
|
|
73
72
|
const sqlCharRenderOutputType = (typeParams) => {
|
|
@@ -112,34 +111,7 @@ const sqlFloatDecodeJson = (json) => {
|
|
|
112
111
|
};
|
|
113
112
|
const sqlTextEncode = (value) => value;
|
|
114
113
|
const sqlTextDecode = (wire) => wire;
|
|
115
|
-
const ZONELESS_ISO_TIMESTAMP = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?$/;
|
|
116
|
-
const sqlTimestampEncode = (value) => value;
|
|
117
|
-
const sqlTimestampDecode = (wire) => wire;
|
|
118
|
-
/**
|
|
119
|
-
* A `timestamp` carries no zone, so its JSON form is the ISO rendering without a
|
|
120
|
-
* trailing `Z` — `2026-01-02T03:04:05.678` — and {@link sqlTimestampDecodeJson}
|
|
121
|
-
* reads that form back as UTC.
|
|
122
|
-
*/
|
|
123
|
-
const sqlTimestampEncodeJson = (value) => value.toISOString().slice(0, -1);
|
|
124
|
-
const sqlTimestampDecodeJson = (json) => {
|
|
125
|
-
if (typeof json !== "string") throw structuredError("RUNTIME.DECODE_FAILED", `Expected ISO date string for sql/timestamp@1, got ${typeof json}`, { meta: { codec: SQL_TIMESTAMP_CODEC_ID } });
|
|
126
|
-
if (!ZONELESS_ISO_TIMESTAMP.test(json)) throw structuredError("RUNTIME.DECODE_FAILED", `Expected a zone-less ISO date-time (YYYY-MM-DDTHH:MM:SS[.sss]) for sql/timestamp@1, got ${json}`, { meta: { codec: SQL_TIMESTAMP_CODEC_ID } });
|
|
127
|
-
const date = /* @__PURE__ */ new Date(`${json}Z`);
|
|
128
|
-
if (Number.isNaN(date.getTime())) throw structuredError("RUNTIME.DECODE_FAILED", `Invalid ISO date string for sql/timestamp@1: ${json}`, { meta: { codec: SQL_TIMESTAMP_CODEC_ID } });
|
|
129
|
-
return date;
|
|
130
|
-
};
|
|
131
|
-
const sqlTimestampRenderOutputType = (typeParams) => {
|
|
132
|
-
const precision = typeParams.precision;
|
|
133
|
-
if (precision === void 0) return "Timestamp";
|
|
134
|
-
if (typeof precision !== "number" || !Number.isFinite(precision) || !Number.isInteger(precision)) throw structuredError("RUNTIME.TYPE_PARAMS_INVALID", `renderOutputType: expected integer "precision" in typeParams for Timestamp, got ${String(precision)}`, { meta: {
|
|
135
|
-
codec: SQL_TIMESTAMP_CODEC_ID,
|
|
136
|
-
param: "precision",
|
|
137
|
-
received: String(precision)
|
|
138
|
-
} });
|
|
139
|
-
return `Timestamp<${precision}>`;
|
|
140
|
-
};
|
|
141
114
|
const lengthParamsSchema = type({ "length?": "number.integer > 0" });
|
|
142
|
-
const precisionParamsSchema = type({ "precision?": "number.integer >= 0 & number.integer <= 6" });
|
|
143
115
|
var SqlTextCodec = class extends CodecImpl {
|
|
144
116
|
async encode(value, _ctx) {
|
|
145
117
|
return sqlTextEncode(value);
|
|
@@ -291,35 +263,7 @@ var SqlVarcharDescriptor = class extends CodecDescriptorImpl {
|
|
|
291
263
|
};
|
|
292
264
|
const sqlVarcharDescriptor = new SqlVarcharDescriptor();
|
|
293
265
|
const sqlVarcharColumn = (params = {}) => column(sqlVarcharDescriptor.factory(params), sqlVarcharDescriptor.codecId, params, "varchar");
|
|
294
|
-
var SqlTimestampCodec = class extends CodecImpl {
|
|
295
|
-
async encode(value, _ctx) {
|
|
296
|
-
return sqlTimestampEncode(value);
|
|
297
|
-
}
|
|
298
|
-
async decode(wire, _ctx) {
|
|
299
|
-
return sqlTimestampDecode(wire);
|
|
300
|
-
}
|
|
301
|
-
encodeJson(value) {
|
|
302
|
-
return sqlTimestampEncodeJson(value);
|
|
303
|
-
}
|
|
304
|
-
decodeJson(json) {
|
|
305
|
-
return sqlTimestampDecodeJson(json);
|
|
306
|
-
}
|
|
307
|
-
};
|
|
308
|
-
var SqlTimestampDescriptor = class extends CodecDescriptorImpl {
|
|
309
|
-
codecId = SQL_TIMESTAMP_CODEC_ID;
|
|
310
|
-
traits = ["equality", "order"];
|
|
311
|
-
targetTypes = ["timestamp"];
|
|
312
|
-
paramsSchema = precisionParamsSchema;
|
|
313
|
-
renderOutputType(params) {
|
|
314
|
-
return sqlTimestampRenderOutputType(params);
|
|
315
|
-
}
|
|
316
|
-
factory(_params) {
|
|
317
|
-
return () => new SqlTimestampCodec(this);
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
const sqlTimestampDescriptor = new SqlTimestampDescriptor();
|
|
321
|
-
const sqlTimestampColumn = (params = {}) => column(sqlTimestampDescriptor.factory(params), sqlTimestampDescriptor.codecId, params, "timestamp");
|
|
322
266
|
//#endregion
|
|
323
|
-
export {
|
|
267
|
+
export { sqlIntColumn as A, sqlVarcharDescriptor as B, sqlCharRenderOutputType as C, sqlFloatDescriptor as D, sqlFloatDecodeJson as E, sqlTextDecode as F, sqlVarcharRenderOutputType as H, sqlTextDescriptor as I, sqlTextEncode as L, sqlIntDescriptor as M, sqlIntEncode as N, sqlFloatEncode as O, sqlTextColumn as P, sqlVarcharColumn as R, sqlCharEncode as S, sqlFloatDecode as T, sqlVarcharEncode as V, SqlVarcharCodec as _, SQL_FLOAT_CODEC_ID as a, sqlCharDecode as b, SQL_VARCHAR_CODEC_ID as c, SqlFloatCodec as d, SqlFloatDescriptor as f, SqlTextDescriptor as g, SqlTextCodec as h, SQL_CHAR_CODEC_ID as i, sqlIntDecode as j, sqlFloatEncodeJson as k, SqlCharCodec as l, SqlIntDescriptor as m, JsonDocumentProjection as n, SQL_INT_CODEC_ID as o, SqlIntCodec as p, NativeJsonValueProjection as r, SQL_TEXT_CODEC_ID as s, CodecJsonValueProjection as t, SqlCharDescriptor as u, SqlVarcharDescriptor as v, sqlFloatColumn as w, sqlCharDescriptor as x, sqlCharColumn as y, sqlVarcharDecode as z };
|
|
324
268
|
|
|
325
|
-
//# sourceMappingURL=ast-
|
|
269
|
+
//# sourceMappingURL=ast-5tg0fGPQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast-5tg0fGPQ.mjs","names":[],"sources":["../../../../2-sql/4-lanes/relational-core/dist/exports/ast.mjs"],"sourcesContent":["import { A as PreparedParamRef, B as isAggregateFn, C as LiteralExpr, D as OrExpr, E as OperationExpr, F as SubqueryExpr, G as frozenCodecRef, H as isWhereExpr, I as TableSource, 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 queryAstKinds, V as isQueryAst, W as whereExprKinds, _ 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, 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-Dt4e_jC-.mjs\";\nimport { 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-BGdnAbXo.mjs\";\nimport { n as compact, t as collectOrderedParamRefs } from \"../util-DQQgv2j1.mjs\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { CodecDescriptorImpl, CodecImpl, column, voidParamsSchema } from \"@internal/framework-components/codec\";\nimport { type } from \"arktype\";\n//#region src/ast/json-value-projection.ts\nvar JsonValueProjection = class {\n\tvalue;\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n\tfold(folder) {\n\t\treturn this.value.fold(folder);\n\t}\n\tcollectColumnRefs() {\n\t\treturn this.value.collectColumnRefs();\n\t}\n\tcollectParamRefs() {\n\t\treturn this.value.collectParamRefs();\n\t}\n\tfreeze() {\n\t\tObject.freeze(this);\n\t}\n};\nvar CodecJsonValueProjection = class CodecJsonValueProjection extends JsonValueProjection {\n\tkind = \"codec\";\n\tcodec;\n\tconstructor(value, codec) {\n\t\tsuper(value);\n\t\tthis.codec = frozenCodecRef(codec);\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.codec(this);\n\t}\n\trewrite(rewriter) {\n\t\treturn new CodecJsonValueProjection(this.value.rewrite(rewriter), this.codec);\n\t}\n};\nvar NativeJsonValueProjection = class NativeJsonValueProjection extends JsonValueProjection {\n\tkind = \"native\";\n\tconstructor(value) {\n\t\tsuper(value);\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.native(this);\n\t}\n\trewrite(rewriter) {\n\t\treturn new NativeJsonValueProjection(this.value.rewrite(rewriter));\n\t}\n};\nvar JsonDocumentProjection = class JsonDocumentProjection extends JsonValueProjection {\n\tkind = \"document\";\n\tconstructor(value) {\n\t\tsuper(value);\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.document(this);\n\t}\n\trewrite(rewriter) {\n\t\treturn new JsonDocumentProjection(this.value.rewrite(rewriter));\n\t}\n};\n//#endregion\n//#region src/ast/sql-codec-helpers.ts\nconst SQL_CHAR_CODEC_ID = \"sql/char@1\";\nconst SQL_VARCHAR_CODEC_ID = \"sql/varchar@1\";\nconst SQL_INT_CODEC_ID = \"sql/int@1\";\nconst SQL_FLOAT_CODEC_ID = \"sql/float@1\";\nconst SQL_TEXT_CODEC_ID = \"sql/text@1\";\nconst sqlCharEncode = (value) => value;\nconst sqlCharDecode = (wire) => wire.trimEnd();\nconst sqlCharRenderOutputType = (typeParams) => {\n\tconst length = typeParams.length;\n\tif (length === void 0) return void 0;\n\tif (typeof length !== \"number\" || !Number.isFinite(length) || !Number.isInteger(length)) throw structuredError(\"RUNTIME.TYPE_PARAMS_INVALID\", `renderOutputType: expected integer \"length\" in typeParams for Char, got ${String(length)}`, { meta: {\n\t\tcodec: SQL_CHAR_CODEC_ID,\n\t\tparam: \"length\",\n\t\treceived: String(length)\n\t} });\n\treturn `Char<${length}>`;\n};\nconst sqlVarcharEncode = (value) => value;\nconst sqlVarcharDecode = (wire) => wire;\nconst sqlVarcharRenderOutputType = (typeParams) => {\n\tconst length = typeParams.length;\n\tif (length === void 0) return void 0;\n\tif (typeof length !== \"number\" || !Number.isFinite(length) || !Number.isInteger(length)) throw structuredError(\"RUNTIME.TYPE_PARAMS_INVALID\", `renderOutputType: expected integer \"length\" in typeParams for Varchar, got ${String(length)}`, { meta: {\n\t\tcodec: SQL_VARCHAR_CODEC_ID,\n\t\tparam: \"length\",\n\t\treceived: String(length)\n\t} });\n\treturn `Varchar<${length}>`;\n};\nconst sqlIntEncode = (value) => value;\nconst sqlIntDecode = (wire) => wire;\nconst sqlFloatEncode = (value) => value;\nconst sqlFloatDecode = (wire) => wire;\n/**\n* JSON has no spelling for a non-finite number, and a database that holds one\n* emits it as a string — PostgreSQL writes `\"NaN\"` and `\"Infinity\"`. This\n* codec's application type is `number`, so both directions reject rather than\n* carry a value that type cannot hold.\n*/\nconst sqlFloatEncodeJson = (value) => {\n\tif (!Number.isFinite(value)) throw structuredError(\"RUNTIME.ENCODE_FAILED\", `${SQL_FLOAT_CODEC_ID} application value must be a finite number, got ${value}`, { meta: { codec: SQL_FLOAT_CODEC_ID } });\n\treturn value;\n};\nconst sqlFloatDecodeJson = (json) => {\n\tif (typeof json !== \"number\" || !Number.isFinite(json)) throw structuredError(\"RUNTIME.DECODE_FAILED\", `Expected a finite number for ${SQL_FLOAT_CODEC_ID}, got ${JSON.stringify(json)}`, { meta: { codec: SQL_FLOAT_CODEC_ID } });\n\treturn json;\n};\nconst sqlTextEncode = (value) => value;\nconst sqlTextDecode = (wire) => wire;\n//#endregion\n//#region src/ast/sql-codecs.ts\nconst lengthParamsSchema = type({ \"length?\": \"number.integer > 0\" });\nvar SqlTextCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn sqlTextEncode(value);\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn sqlTextDecode(wire);\n\t}\n\tencodeJson(value) {\n\t\treturn value;\n\t}\n\tdecodeJson(json) {\n\t\treturn json;\n\t}\n};\nvar SqlTextDescriptor = class extends CodecDescriptorImpl {\n\tcodecId = SQL_TEXT_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"textual\"\n\t];\n\ttargetTypes = [\"text\"];\n\tparamsSchema = voidParamsSchema;\n\tfactory() {\n\t\treturn () => new SqlTextCodec(this);\n\t}\n};\nconst sqlTextDescriptor = new SqlTextDescriptor();\nconst sqlTextColumn = () => column(sqlTextDescriptor.factory(), sqlTextDescriptor.codecId, void 0, \"text\");\nvar SqlIntCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn sqlIntEncode(value);\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn sqlIntDecode(wire);\n\t}\n\tencodeJson(value) {\n\t\treturn value;\n\t}\n\tdecodeJson(json) {\n\t\treturn json;\n\t}\n};\nvar SqlIntDescriptor = class extends CodecDescriptorImpl {\n\tcodecId = SQL_INT_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"numeric\"\n\t];\n\ttargetTypes = [\"int\"];\n\tparamsSchema = voidParamsSchema;\n\tfactory() {\n\t\treturn () => new SqlIntCodec(this);\n\t}\n};\nconst sqlIntDescriptor = new SqlIntDescriptor();\nconst sqlIntColumn = () => column(sqlIntDescriptor.factory(), sqlIntDescriptor.codecId, void 0, \"int\");\nvar SqlFloatCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn sqlFloatEncode(value);\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn sqlFloatDecode(wire);\n\t}\n\tencodeJson(value) {\n\t\treturn sqlFloatEncodeJson(value);\n\t}\n\tdecodeJson(json) {\n\t\treturn sqlFloatDecodeJson(json);\n\t}\n};\nvar SqlFloatDescriptor = class extends CodecDescriptorImpl {\n\tcodecId = SQL_FLOAT_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"numeric\"\n\t];\n\ttargetTypes = [\"float\"];\n\tparamsSchema = voidParamsSchema;\n\tfactory() {\n\t\treturn () => new SqlFloatCodec(this);\n\t}\n};\nconst sqlFloatDescriptor = new SqlFloatDescriptor();\nconst sqlFloatColumn = () => column(sqlFloatDescriptor.factory(), sqlFloatDescriptor.codecId, void 0, \"float\");\nvar SqlCharCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn sqlCharEncode(value);\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn sqlCharDecode(wire);\n\t}\n\tencodeJson(value) {\n\t\treturn value;\n\t}\n\tdecodeJson(json) {\n\t\treturn json;\n\t}\n};\nvar SqlCharDescriptor = class extends CodecDescriptorImpl {\n\tcodecId = SQL_CHAR_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"textual\"\n\t];\n\ttargetTypes = [\"char\"];\n\tparamsSchema = lengthParamsSchema;\n\trenderOutputType(params) {\n\t\treturn sqlCharRenderOutputType(params);\n\t}\n\tfactory(_params) {\n\t\treturn () => new SqlCharCodec(this);\n\t}\n};\nconst sqlCharDescriptor = new SqlCharDescriptor();\nconst sqlCharColumn = (params = {}) => column(sqlCharDescriptor.factory(params), sqlCharDescriptor.codecId, params, \"char\");\nvar SqlVarcharCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn sqlVarcharEncode(value);\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn sqlVarcharDecode(wire);\n\t}\n\tencodeJson(value) {\n\t\treturn value;\n\t}\n\tdecodeJson(json) {\n\t\treturn json;\n\t}\n};\nvar SqlVarcharDescriptor = class extends CodecDescriptorImpl {\n\tcodecId = SQL_VARCHAR_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"textual\"\n\t];\n\ttargetTypes = [\"varchar\"];\n\tparamsSchema = lengthParamsSchema;\n\trenderOutputType(params) {\n\t\treturn sqlVarcharRenderOutputType(params);\n\t}\n\tfactory(_params) {\n\t\treturn () => new SqlVarcharCodec(this);\n\t}\n};\nconst sqlVarcharDescriptor = new SqlVarcharDescriptor();\nconst sqlVarcharColumn = (params = {}) => column(sqlVarcharDescriptor.factory(params), sqlVarcharDescriptor.codecId, params, \"varchar\");\n//#endregion\nexport { 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, collectOrderedParamRefs, compact, frozenCodecRef, isAggregateFn, isDdlNode, isQueryAst, isWhereExpr, queryAstKinds, 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 };\n\n//# sourceMappingURL=ast.mjs.map"],"mappings":";;;;;AAOA,IAAI,sBAAsB,MAAM;CAC/B;CACA,YAAY,OAAO;EAClB,KAAK,QAAQ;CACd;CACA,KAAK,QAAQ;EACZ,OAAO,KAAK,MAAM,KAAK,MAAM;CAC9B;CACA,oBAAoB;EACnB,OAAO,KAAK,MAAM,kBAAkB;CACrC;CACA,mBAAmB;EAClB,OAAO,KAAK,MAAM,iBAAiB;CACpC;CACA,SAAS;EACR,OAAO,OAAO,IAAI;CACnB;AACD;AACA,IAAI,2BAA2B,MAAM,iCAAiC,oBAAoB;CACzF,OAAO;CACP;CACA,YAAY,OAAO,OAAO;EACzB,MAAM,KAAK;EACX,KAAK,QAAQ,eAAe,KAAK;EACjC,KAAK,OAAO;CACb;CACA,OAAO,SAAS;EACf,OAAO,QAAQ,MAAM,IAAI;CAC1B;CACA,QAAQ,UAAU;EACjB,OAAO,IAAI,yBAAyB,KAAK,MAAM,QAAQ,QAAQ,GAAG,KAAK,KAAK;CAC7E;AACD;AACA,IAAI,4BAA4B,MAAM,kCAAkC,oBAAoB;CAC3F,OAAO;CACP,YAAY,OAAO;EAClB,MAAM,KAAK;EACX,KAAK,OAAO;CACb;CACA,OAAO,SAAS;EACf,OAAO,QAAQ,OAAO,IAAI;CAC3B;CACA,QAAQ,UAAU;EACjB,OAAO,IAAI,0BAA0B,KAAK,MAAM,QAAQ,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;EACxB,OAAO,wBAAwB,MAAM;CACtC;CACA,QAAQ,SAAS;EAChB,aAAa,IAAI,aAAa,IAAI;CACnC;AACD;AACA,MAAM,oBAAoB,IAAI,kBAAkB;AAChD,MAAM,iBAAiB,SAAS,CAAC,MAAM,OAAO,kBAAkB,QAAQ,MAAM,GAAG,kBAAkB,SAAS,QAAQ,MAAM;AAC1H,IAAI,kBAAkB,cAAc,UAAU;CAC7C,MAAM,OAAO,OAAO,MAAM;EACzB,OAAO,iBAAiB,KAAK;CAC9B;CACA,MAAM,OAAO,MAAM,MAAM;EACxB,OAAO,iBAAiB,IAAI;CAC7B;CACA,WAAW,OAAO;EACjB,OAAO;CACR;CACA,WAAW,MAAM;EAChB,OAAO;CACR;AACD;AACA,IAAI,uBAAuB,cAAc,oBAAoB;CAC5D,UAAU;CACV,SAAS;EACR;EACA;EACA;CACD;CACA,cAAc,CAAC,SAAS;CACxB,eAAe;CACf,iBAAiB,QAAQ;EACxB,OAAO,2BAA2B,MAAM;CACzC;CACA,QAAQ,SAAS;EAChB,aAAa,IAAI,gBAAgB,IAAI;CACtC;AACD;AACA,MAAM,uBAAuB,IAAI,qBAAqB;AACtD,MAAM,oBAAoB,SAAS,CAAC,MAAM,OAAO,qBAAqB,QAAQ,MAAM,GAAG,qBAAqB,SAAS,QAAQ,SAAS"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { m as AnyQueryAst, p as AnyParamRef, ut as LoweredStatement } from "./types-v3qxLLxo-
|
|
1
|
+
import { m as AnyQueryAst, p as AnyParamRef, ut as LoweredStatement } from "./types-v3qxLLxo-Clw_yBAh.mjs";
|
|
2
2
|
import { c as SqlQueryable } from "./driver-types-BQtRkOJ0-Bv2RPSfr.mjs";
|
|
3
|
-
import "./ddl-types-CXx4vPz6-
|
|
3
|
+
import "./ddl-types-CXx4vPz6-Dko-GTTj.mjs";
|
|
4
4
|
import { ContractMarkerRecord, JsonValue } from "@prisma/orm-framework/contract/types";
|
|
5
5
|
import { CodecCallContext, CodecDescriptorImpl, CodecImpl, CodecInstanceContext } from "@prisma/orm-framework/components/codec";
|
|
6
6
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
@@ -49,7 +49,6 @@ declare const SQL_VARCHAR_CODEC_ID: "sql/varchar@1";
|
|
|
49
49
|
declare const SQL_INT_CODEC_ID: "sql/int@1";
|
|
50
50
|
declare const SQL_FLOAT_CODEC_ID: "sql/float@1";
|
|
51
51
|
declare const SQL_TEXT_CODEC_ID: "sql/text@1";
|
|
52
|
-
declare const SQL_TIMESTAMP_CODEC_ID: "sql/timestamp@1";
|
|
53
52
|
declare const sqlCharEncode: (value: string) => string;
|
|
54
53
|
declare const sqlCharDecode: (wire: string) => string;
|
|
55
54
|
declare const sqlCharRenderOutputType: (typeParams: {
|
|
@@ -74,26 +73,11 @@ declare const sqlFloatEncodeJson: (value: number) => JsonValue;
|
|
|
74
73
|
declare const sqlFloatDecodeJson: (json: JsonValue) => number;
|
|
75
74
|
declare const sqlTextEncode: (value: string) => string;
|
|
76
75
|
declare const sqlTextDecode: (wire: string) => string;
|
|
77
|
-
declare const sqlTimestampEncode: (value: Date) => Date;
|
|
78
|
-
declare const sqlTimestampDecode: (wire: Date) => Date;
|
|
79
|
-
/**
|
|
80
|
-
* A `timestamp` carries no zone, so its JSON form is the ISO rendering without a
|
|
81
|
-
* trailing `Z` — `2026-01-02T03:04:05.678` — and {@link sqlTimestampDecodeJson}
|
|
82
|
-
* reads that form back as UTC.
|
|
83
|
-
*/
|
|
84
|
-
declare const sqlTimestampEncodeJson: (value: Date) => JsonValue;
|
|
85
|
-
declare const sqlTimestampDecodeJson: (json: JsonValue) => Date;
|
|
86
|
-
declare const sqlTimestampRenderOutputType: (typeParams: {
|
|
87
|
-
readonly precision?: number;
|
|
88
|
-
}) => string;
|
|
89
76
|
//#endregion
|
|
90
77
|
//#region src/ast/sql-codecs.d.ts
|
|
91
78
|
type LengthParams = {
|
|
92
79
|
readonly length?: number;
|
|
93
80
|
};
|
|
94
|
-
type PrecisionParams = {
|
|
95
|
-
readonly precision?: number;
|
|
96
|
-
};
|
|
97
81
|
declare class SqlTextCodec extends CodecImpl<typeof SQL_TEXT_CODEC_ID, readonly ['equality', 'order', 'textual'], string, string> {
|
|
98
82
|
encode(value: string, _ctx: CodecCallContext): Promise<string>;
|
|
99
83
|
decode(wire: string, _ctx: CodecCallContext): Promise<string>;
|
|
@@ -171,22 +155,6 @@ declare class SqlVarcharDescriptor extends CodecDescriptorImpl<LengthParams> {
|
|
|
171
155
|
}
|
|
172
156
|
declare const sqlVarcharDescriptor: SqlVarcharDescriptor;
|
|
173
157
|
declare const sqlVarcharColumn: (params?: LengthParams) => import("@prisma/orm-framework/components/codec").ColumnSpec<SqlVarcharCodec, LengthParams>;
|
|
174
|
-
declare class SqlTimestampCodec extends CodecImpl<typeof SQL_TIMESTAMP_CODEC_ID, readonly ['equality', 'order'], Date, Date> {
|
|
175
|
-
encode(value: Date, _ctx: CodecCallContext): Promise<Date>;
|
|
176
|
-
decode(wire: Date, _ctx: CodecCallContext): Promise<Date>;
|
|
177
|
-
encodeJson(value: Date): JsonValue;
|
|
178
|
-
decodeJson(json: JsonValue): Date;
|
|
179
|
-
}
|
|
180
|
-
declare class SqlTimestampDescriptor extends CodecDescriptorImpl<PrecisionParams> {
|
|
181
|
-
readonly codecId: "sql/timestamp@1";
|
|
182
|
-
readonly traits: readonly ["equality", "order"];
|
|
183
|
-
readonly targetTypes: readonly ["timestamp"];
|
|
184
|
-
readonly paramsSchema: StandardSchemaV1<PrecisionParams>;
|
|
185
|
-
renderOutputType(params: PrecisionParams): string | undefined;
|
|
186
|
-
factory(_params: PrecisionParams): (ctx: CodecInstanceContext) => SqlTimestampCodec;
|
|
187
|
-
}
|
|
188
|
-
declare const sqlTimestampDescriptor: SqlTimestampDescriptor;
|
|
189
|
-
declare const sqlTimestampColumn: (params?: PrecisionParams) => import("@prisma/orm-framework/components/codec").ColumnSpec<SqlTimestampCodec, PrecisionParams>;
|
|
190
158
|
//#endregion
|
|
191
159
|
//#region src/ast/util.d.ts
|
|
192
160
|
declare function compact<T extends Record<string, unknown>>(o: T): T;
|
|
@@ -202,5 +170,5 @@ declare function compact<T extends Record<string, unknown>>(o: T): T;
|
|
|
202
170
|
*/
|
|
203
171
|
declare function collectOrderedParamRefs(ast: AnyQueryAst): ReadonlyArray<AnyParamRef>;
|
|
204
172
|
//#endregion
|
|
205
|
-
export {
|
|
206
|
-
//# sourceMappingURL=ast-
|
|
173
|
+
export { sqlFloatDecode as A, sqlTextDecode as B, compact as C, sqlCharEncode as D, sqlCharDescriptor as E, sqlIntColumn as F, sqlVarcharDescriptor as G, sqlTextEncode as H, sqlIntDecode as I, sqlVarcharEncode as K, sqlIntDescriptor as L, sqlFloatDescriptor as M, sqlFloatEncode as N, sqlCharRenderOutputType as O, sqlFloatEncodeJson as P, sqlIntEncode as R, collectOrderedParamRefs as S, sqlCharDecode as T, sqlVarcharColumn as U, sqlTextDescriptor as V, sqlVarcharDecode as W, SqlIntDescriptor as _, LowererContext as a, SqlVarcharCodec as b, SQL_FLOAT_CODEC_ID as c, SQL_VARCHAR_CODEC_ID as d, SqlCharCodec as f, SqlIntCodec as g, SqlFloatDescriptor as h, Lowerer as i, sqlFloatDecodeJson as j, sqlFloatColumn as k, SQL_INT_CODEC_ID as l, SqlFloatCodec as m, AdapterProfile as n, MarkerReadResult as o, SqlCharDescriptor as p, sqlVarcharRenderOutputType as q, AdapterTarget as r, SQL_CHAR_CODEC_ID as s, Adapter as t, SQL_TEXT_CODEC_ID as u, SqlTextCodec as v, sqlCharColumn as w, SqlVarcharDescriptor as x, SqlTextDescriptor as y, sqlTextColumn as z };
|
|
174
|
+
//# sourceMappingURL=ast-DuLukI6f.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast-DuLukI6f.d.mts","names":[],"sources":["../../../../2-sql/4-lanes/relational-core/dist/exports/ast.d.mts"],"mappings":";;;;;;;;KAOK;;;;;;;KAOA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A;WACA,cAAc;EACvB,YAAY,KAAK,yBAAyB;;cAE9B,oBAAoB;cACpB,qEAAqE,WAAW;cAChF,qBAAqB,iBAAiB;EAClD,OAAO,eAAe,MAAM,mBAAqB;EACjD,OAAO,cAAc,MAAM,mBAAqB;EAChD,WAAW,gBAAgB;EAC3B,WAAW,MAAM;;cAEL,0BAA0B,oBAAoB;WACjD;WACA;WACA;WACA,cAAc,iBAAiB;EACxC,iBAAiB,QAAQ;EACzB,QAAQ,SAAS,gBAAgB,KAAK,yBAAyB;;cAEnD,mBAAmB;cACnB,gBAAgB,SAAS,gEAAgE,WAAW,cAAc;cAClH,wBAAwB,iBAAiB;EACrD,OAAO,eAAe,MAAM,mBAAqB;EACjD,OAAO,cAAc,MAAM,mBAAqB;EAChD,WAAW,gBAAgB;EAC3B,WAAW,MAAM;;cAEL,6BAA6B,oBAAoB;WACpD;WACA;WACA;WACA,cAAc,iBAAiB;EACxC,iBAAiB,QAAQ;EACzB,QAAQ,SAAS,gBAAgB,KAAK,yBAAyB;;cAEnD,sBAAsB;cACtB,mBAAmB,SAAS,gEAAgE,WAAW,iBAAiB;;;iBAGrH,QAAQ,UAAU,yBAAyB,GAAG,IAAI;;;;;;;;;;;iBAWlD,wBAAwB,KAAK,cAAc,cAAc"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as contractError } from "./contract-errors-BCN6RVI5-5IHBF_lg.mjs";
|
|
2
2
|
import { i as computeCheckContentHash, n as assertWireNamePrefixLength } from "./naming-DKr4TJd7-Cszhq9RV.mjs";
|
|
3
|
-
import { t as exactNameBodyWarning } from "./index-naming-
|
|
3
|
+
import { t as exactNameBodyWarning } from "./index-naming-fQMLqyC4-4FzPVtCR.mjs";
|
|
4
4
|
import { flushAuthoringWarnings } from "@prisma/orm-framework/components/authoring";
|
|
5
5
|
//#region ../../../2-sql/1-core/contract/dist/authored-check-naming.mjs
|
|
6
6
|
/**
|
|
@@ -44,4 +44,4 @@ function lowerAuthoredCheck(tableName, authored, warnings) {
|
|
|
44
44
|
//#endregion
|
|
45
45
|
export { lowerAuthoredCheck as t };
|
|
46
46
|
|
|
47
|
-
//# sourceMappingURL=authored-check-naming-
|
|
47
|
+
//# sourceMappingURL=authored-check-naming-BEvfamnI.mjs.map
|
package/dist/{authored-check-naming-Hf9990DV.mjs.map → authored-check-naming-BEvfamnI.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authored-check-naming-
|
|
1
|
+
{"version":3,"file":"authored-check-naming-BEvfamnI.mjs","names":[],"sources":["../../../../2-sql/1-core/contract/dist/authored-check-naming.mjs"],"sourcesContent":["import { t as contractError } from \"./contract-errors-BCN6RVI5.mjs\";\nimport { t as exactNameBodyWarning } from \"./index-naming-fQMLqyC4.mjs\";\nimport { flushAuthoringWarnings } from \"@internal/framework-components/authoring\";\nimport { assertWireNamePrefixLength, computeCheckContentHash } from \"@internal/sql-schema-ir/naming\";\n//#region src/authored-check-naming.ts\n/**\n* Lowers an authored check constraint into the name-identified entity\n* `contract.json` persists: exact mode adopts `map` verbatim (no prefix, no\n* hash) and warns, because a hand-authored body compared verbatim against\n* Postgres's reprint would false-drift; wire mode appends the content-hash\n* suffix to the authored prefix. There is no default prefix to fall back on\n* — a check has no column tuple to derive one from, unlike an index — so an\n* absent `name` is only valid alongside a present `map`. The cross-field\n* guards are the shared enforcement backstop for both authoring surfaces\n* (PSL pre-empts them with span-anchored diagnostics).\n*/\nfunction lowerAuthoredCheck(tableName, authored, warnings) {\n\tif (authored.map !== void 0 && authored.name !== void 0) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", `Check \"${authored.map}\" on table \"${tableName}\": map and name are mutually exclusive — map adopts an exact physical name, name is a wire prefix.`);\n\tif (authored.expression.trim().length === 0) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", `Check on table \"${tableName}\": expression must not be empty — an empty predicate is not a constraint.`);\n\tif (authored.map !== void 0) {\n\t\tconst warning = exactNameBodyWarning(\"check\", authored.map);\n\t\tif (warnings !== void 0) warnings.push(warning);\n\t\telse flushAuthoringWarnings([warning]);\n\t\treturn {\n\t\t\tnaming: {\n\t\t\t\tkind: \"exact\",\n\t\t\t\tname: authored.map\n\t\t\t},\n\t\t\texpression: authored.expression\n\t\t};\n\t}\n\tif (authored.name === void 0) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", `Check on table \"${tableName}\": a check constraint requires an explicit name (name:) or exact physical name (map:) — unlike an index there is no column tuple to derive a default name from.`);\n\tconst prefix = authored.name;\n\tassertWireNamePrefixLength(prefix, \"check prefix\");\n\treturn {\n\t\tnaming: {\n\t\t\tkind: \"wire\",\n\t\t\tprefix,\n\t\t\thash: computeCheckContentHash(authored.expression)\n\t\t},\n\t\texpression: authored.expression\n\t};\n}\n//#endregion\nexport { lowerAuthoredCheck };\n\n//# sourceMappingURL=authored-check-naming.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAS,mBAAmB,WAAW,UAAU,UAAU;CAC1D,IAAI,SAAS,QAAQ,KAAK,KAAK,SAAS,SAAS,KAAK,GAAG,MAAM,cAAc,6BAA6B,UAAU,SAAS,IAAI,cAAc,UAAU,mGAAmG;CAC5P,IAAI,SAAS,WAAW,KAAK,CAAC,CAAC,WAAW,GAAG,MAAM,cAAc,6BAA6B,mBAAmB,UAAU,0EAA0E;CACrM,IAAI,SAAS,QAAQ,KAAK,GAAG;EAC5B,MAAM,UAAU,qBAAqB,SAAS,SAAS,GAAG;EAC1D,IAAI,aAAa,KAAK,GAAG,SAAS,KAAK,OAAO;OACzC,uBAAuB,CAAC,OAAO,CAAC;EACrC,OAAO;GACN,QAAQ;IACP,MAAM;IACN,MAAM,SAAS;GAChB;GACA,YAAY,SAAS;EACtB;CACD;CACA,IAAI,SAAS,SAAS,KAAK,GAAG,MAAM,cAAc,6BAA6B,mBAAmB,UAAU,gKAAgK;CAC5Q,MAAM,SAAS,SAAS;CACxB,2BAA2B,QAAQ,cAAc;CACjD,OAAO;EACN,QAAQ;GACP,MAAM;GACN;GACA,MAAM,wBAAwB,SAAS,UAAU;EAClD;EACA,YAAY,SAAS;CACtB;AACD"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { o as enumType } from "./contract-builder-
|
|
1
|
+
import { o as enumType } from "./contract-builder-BOmEsrRi.mjs";
|
|
2
2
|
import { resolveEnumCodecId } from "@prisma/orm-framework/components/authoring";
|
|
3
3
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
4
|
-
|
|
4
|
+
import { blockAttribute, str } from "@prisma/orm-framework/psl-parser";
|
|
5
|
+
//#region ../../../2-sql/9-family/dist/authoring-type-constructors-BD-XuavC.mjs
|
|
5
6
|
const sqlFamilyEntityTypes = { enum: {
|
|
6
7
|
kind: "entity",
|
|
7
8
|
discriminator: "enum",
|
|
@@ -112,13 +113,18 @@ const sqlFamilyEntityTypes = { enum: {
|
|
|
112
113
|
})));
|
|
113
114
|
} }
|
|
114
115
|
} };
|
|
116
|
+
const enumTypeBlockAttribute = blockAttribute("type", { positional: [{
|
|
117
|
+
key: "codecId",
|
|
118
|
+
type: str()
|
|
119
|
+
}] });
|
|
115
120
|
const sqlFamilyPslBlockDescriptors = { enum: {
|
|
116
121
|
kind: "pslBlock",
|
|
117
122
|
keyword: "enum",
|
|
118
123
|
discriminator: "enum",
|
|
119
124
|
name: { required: true },
|
|
120
125
|
parameters: {},
|
|
121
|
-
variadicParameters: true
|
|
126
|
+
variadicParameters: true,
|
|
127
|
+
attributes: { type: () => enumTypeBlockAttribute }
|
|
122
128
|
} };
|
|
123
129
|
/**
|
|
124
130
|
* Family-level SQL authoring field presets.
|
|
@@ -313,4 +319,4 @@ const sqlFamilyAuthoringTypes = { sql: { String: {
|
|
|
313
319
|
//#endregion
|
|
314
320
|
export { sqlFamilyPslBlockDescriptors as i, sqlFamilyAuthoringTypes as n, sqlFamilyEntityTypes as r, sqlFamilyAuthoringFieldPresets as t };
|
|
315
321
|
|
|
316
|
-
//# sourceMappingURL=authoring-type-constructors-
|
|
322
|
+
//# sourceMappingURL=authoring-type-constructors-BD-XuavC-CJV-TxFh.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authoring-type-constructors-BD-XuavC-CJV-TxFh.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/authoring-type-constructors-BD-XuavC.mjs"],"sourcesContent":["import { resolveEnumCodecId } from \"@internal/framework-components/authoring\";\nimport { blockAttribute, str } from \"@internal/psl-parser\";\nimport { enumType } from \"@internal/sql-contract-ts/contract-builder\";\nimport { blindCast } from \"@internal/utils/casts\";\nconst sqlFamilyEntityTypes = { enum: {\n\tkind: \"entity\",\n\tdiscriminator: \"enum\",\n\toutput: { factory: (block, ctx) => {\n\t\tconst sourceId = ctx.sourceId ?? \"unknown\";\n\t\tconst diagnostics = ctx.diagnostics;\n\t\tconst resolved = resolveEnumCodecId(block, ctx);\n\t\tif (resolved === void 0) return;\n\t\tconst { codecId, codecSpan } = resolved;\n\t\tconst nativeType = ctx.codecLookup?.targetTypesFor(codecId)?.[0];\n\t\tif (nativeType === void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type references unknown codec \"${codecId}\"`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst codec = ctx.codecLookup?.get(codecId);\n\t\tif (codec === void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type codec \"${codecId}\" resolves in targetTypesFor but is absent from codecLookup.get`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst seenValues = /* @__PURE__ */ new Set();\n\t\tconst members = [];\n\t\tlet memberError = false;\n\t\tfor (const [memberName, paramValue] of Object.entries(block.parameters)) {\n\t\t\tlet value;\n\t\t\tif (paramValue.kind === \"bare\") try {\n\t\t\t\tvalue = codec.decodeJson(memberName);\n\t\t\t} catch {\n\t\t\t\tdiagnostics?.push({\n\t\t\t\t\tcode: \"PSL_ENUM_BARE_MEMBER_NON_STRING_CODEC\",\n\t\t\t\t\tmessage: `enum \"${block.name}\" member \"${memberName}\" has no value and codec \"${codecId}\" does not accept a bare name as input`,\n\t\t\t\t\tsourceId,\n\t\t\t\t\tspan: paramValue.span\n\t\t\t\t});\n\t\t\t\tmemberError = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse if (paramValue.kind === \"value\") {\n\t\t\t\tlet jsonValue;\n\t\t\t\ttry {\n\t\t\t\t\tjsonValue = JSON.parse(paramValue.raw);\n\t\t\t\t} catch {\n\t\t\t\t\tdiagnostics?.push({\n\t\t\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\t\t\tmessage: `enum \"${block.name}\" member \"${memberName}\" value \"${paramValue.raw}\" is not valid JSON`,\n\t\t\t\t\t\tsourceId,\n\t\t\t\t\t\tspan: paramValue.span\n\t\t\t\t\t});\n\t\t\t\t\tmemberError = true;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tvalue = codec.decodeJson(blindCast(jsonValue));\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconst reason = err instanceof Error ? err.message : String(err);\n\t\t\t\t\tdiagnostics?.push({\n\t\t\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\t\t\tmessage: `enum \"${block.name}\" member \"${memberName}\" was rejected by codec \"${codecId}\": ${reason}`,\n\t\t\t\t\t\tsourceId,\n\t\t\t\t\t\tspan: paramValue.span\n\t\t\t\t\t});\n\t\t\t\t\tmemberError = true;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t} else continue;\n\t\t\tconst valueKey = String(value);\n\t\t\tif (seenValues.has(valueKey)) {\n\t\t\t\tdiagnostics?.push({\n\t\t\t\t\tcode: \"PSL_ENUM_DUPLICATE_MEMBER_VALUE\",\n\t\t\t\t\tmessage: `enum \"${block.name}\": duplicate member value \"${valueKey}\"`,\n\t\t\t\t\tsourceId,\n\t\t\t\t\tspan: paramValue.span\n\t\t\t\t});\n\t\t\t\tmemberError = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseenValues.add(valueKey);\n\t\t\tmembers.push({\n\t\t\t\tname: memberName,\n\t\t\t\tvalue\n\t\t\t});\n\t\t}\n\t\tif (memberError) return void 0;\n\t\tif (members.length === 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_ENUM_MISSING_TYPE\",\n\t\t\t\tmessage: `enum \"${block.name}\" must have at least one member`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: block.span\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\treturn enumType(block.name, {\n\t\t\tcodecId,\n\t\t\tnativeType\n\t\t}, ...members.map((m) => ({\n\t\t\tname: m.name,\n\t\t\tvalue: m.value\n\t\t})));\n\t} }\n} };\nconst enumTypeBlockAttribute = blockAttribute(\"type\", { positional: [{\n\tkey: \"codecId\",\n\ttype: str()\n}] });\nconst sqlFamilyPslBlockDescriptors = { enum: {\n\tkind: \"pslBlock\",\n\tkeyword: \"enum\",\n\tdiscriminator: \"enum\",\n\tname: { required: true },\n\tparameters: {},\n\tvariadicParameters: true,\n\tattributes: { type: () => enumTypeBlockAttribute }\n} };\n//#endregion\n//#region src/core/authoring-field-presets.ts\n/**\n* Family-level SQL authoring field presets.\n*\n* Only presets whose codec IDs align with the ID generator metadata live here\n* (see `@internal/ids`). These presets are target-agnostic because the\n* generator metadata fixes their codec/native-type to `sql/char@1`\n* (`character`) regardless of target, and the PSL interpreter lets the\n* generator override the scalar descriptor.\n*\n* The `uuidString` / `id.uuidv4String` / `id.uuidv7String` presets store UUID\n* values as `character(36)` — portable across all SQL targets. For a native\n* Postgres `uuid` column use `uuidNative` / `id.uuidv4Native` /\n* `id.uuidv7Native` from `@internal/target-postgres`.\n*\n* Scalar presets that map to target-specific codecs (e.g. `text`, `int`,\n* `boolean`, `dateTime`) are contributed by the target pack (see\n* `postgresAuthoringFieldPresets` in `@internal/target-postgres`) so the\n* TS callback surface and the PSL scalar surface lower to byte-identical\n* contracts for the active target.\n*/\nconst CHARACTER_CODEC_ID = \"sql/char@1\";\nconst CHARACTER_NATIVE_TYPE = \"character\";\nconst nanoidOptionsArgument = {\n\tkind: \"object\",\n\toptional: true,\n\tproperties: { size: {\n\t\tkind: \"number\",\n\t\toptional: true,\n\t\tinteger: true,\n\t\tminimum: 2,\n\t\tmaximum: 255\n\t} }\n};\nconst sqlFamilyAuthoringFieldPresets = {\n\tuuidString: {\n\t\tkind: \"fieldPreset\",\n\t\toutput: {\n\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\ttypeParams: { length: 36 }\n\t\t}\n\t},\n\tulid: {\n\t\tkind: \"fieldPreset\",\n\t\toutput: {\n\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\ttypeParams: { length: 26 }\n\t\t}\n\t},\n\tnanoid: {\n\t\tkind: \"fieldPreset\",\n\t\targs: [nanoidOptionsArgument],\n\t\toutput: {\n\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\ttypeParams: { length: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0,\n\t\t\t\tpath: [\"size\"],\n\t\t\t\tdefault: 21\n\t\t\t} }\n\t\t}\n\t},\n\tcuid2: {\n\t\tkind: \"fieldPreset\",\n\t\toutput: {\n\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\ttypeParams: { length: 24 }\n\t\t}\n\t},\n\tksuid: {\n\t\tkind: \"fieldPreset\",\n\t\toutput: {\n\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\ttypeParams: { length: 27 }\n\t\t}\n\t},\n\tid: {\n\t\tuuidv4String: {\n\t\t\tkind: \"fieldPreset\",\n\t\t\toutput: {\n\t\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\t\ttypeParams: { length: 36 },\n\t\t\t\texecutionDefaults: { onCreate: {\n\t\t\t\t\tkind: \"generator\",\n\t\t\t\t\tid: \"uuidv4\"\n\t\t\t\t} },\n\t\t\t\tid: true\n\t\t\t}\n\t\t},\n\t\tuuidv7String: {\n\t\t\tkind: \"fieldPreset\",\n\t\t\toutput: {\n\t\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\t\ttypeParams: { length: 36 },\n\t\t\t\texecutionDefaults: { onCreate: {\n\t\t\t\t\tkind: \"generator\",\n\t\t\t\t\tid: \"uuidv7\"\n\t\t\t\t} },\n\t\t\t\tid: true\n\t\t\t}\n\t\t},\n\t\tulid: {\n\t\t\tkind: \"fieldPreset\",\n\t\t\toutput: {\n\t\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\t\ttypeParams: { length: 26 },\n\t\t\t\texecutionDefaults: { onCreate: {\n\t\t\t\t\tkind: \"generator\",\n\t\t\t\t\tid: \"ulid\"\n\t\t\t\t} },\n\t\t\t\tid: true\n\t\t\t}\n\t\t},\n\t\tnanoid: {\n\t\t\tkind: \"fieldPreset\",\n\t\t\targs: [nanoidOptionsArgument],\n\t\t\toutput: {\n\t\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\t\ttypeParams: { length: {\n\t\t\t\t\tkind: \"arg\",\n\t\t\t\t\tindex: 0,\n\t\t\t\t\tpath: [\"size\"],\n\t\t\t\t\tdefault: 21\n\t\t\t\t} },\n\t\t\t\texecutionDefaults: { onCreate: {\n\t\t\t\t\tkind: \"generator\",\n\t\t\t\t\tid: \"nanoid\",\n\t\t\t\t\tparams: { size: {\n\t\t\t\t\t\tkind: \"arg\",\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tpath: [\"size\"]\n\t\t\t\t\t} }\n\t\t\t\t} },\n\t\t\t\tid: true\n\t\t\t}\n\t\t},\n\t\tcuid2: {\n\t\t\tkind: \"fieldPreset\",\n\t\t\toutput: {\n\t\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\t\ttypeParams: { length: 24 },\n\t\t\t\texecutionDefaults: { onCreate: {\n\t\t\t\t\tkind: \"generator\",\n\t\t\t\t\tid: \"cuid2\"\n\t\t\t\t} },\n\t\t\t\tid: true\n\t\t\t}\n\t\t},\n\t\tksuid: {\n\t\t\tkind: \"fieldPreset\",\n\t\t\toutput: {\n\t\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\t\ttypeParams: { length: 27 },\n\t\t\t\texecutionDefaults: { onCreate: {\n\t\t\t\t\tkind: \"generator\",\n\t\t\t\t\tid: \"ksuid\"\n\t\t\t\t} },\n\t\t\t\tid: true\n\t\t\t}\n\t\t}\n\t}\n};\n//#endregion\n//#region src/core/authoring-type-constructors.ts\nconst sqlFamilyAuthoringTypes = { sql: { String: {\n\tkind: \"typeConstructor\",\n\targs: [{\n\t\tkind: \"number\",\n\t\tname: \"length\",\n\t\tinteger: true,\n\t\tminimum: 1,\n\t\tmaximum: 10485760\n\t}],\n\toutput: {\n\t\tcodecId: \"sql/varchar@1\",\n\t\tnativeType: \"character varying\",\n\t\ttypeParams: { length: {\n\t\t\tkind: \"arg\",\n\t\t\tindex: 0\n\t\t} }\n\t}\n} } };\n//#endregion\nexport { sqlFamilyPslBlockDescriptors as i, sqlFamilyAuthoringFieldPresets as n, sqlFamilyEntityTypes as r, sqlFamilyAuthoringTypes as t };\n\n//# sourceMappingURL=authoring-type-constructors-BD-XuavC.mjs.map"],"mappings":";;;;;AAIA,MAAM,uBAAuB,EAAE,MAAM;CACpC,MAAM;CACN,eAAe;CACf,QAAQ,EAAE,UAAU,OAAO,QAAQ;EAClC,MAAM,WAAW,IAAI,YAAY;EACjC,MAAM,cAAc,IAAI;EACxB,MAAM,WAAW,mBAAmB,OAAO,GAAG;EAC9C,IAAI,aAAa,KAAK,GAAG;EACzB,MAAM,EAAE,SAAS,cAAc;EAC/B,MAAM,aAAa,IAAI,aAAa,eAAe,OAAO,CAAC,GAAG;EAC9D,IAAI,eAAe,KAAK,GAAG;GAC1B,aAAa,KAAK;IACjB,MAAM;IACN,SAAS,SAAS,MAAM,KAAK,qCAAqC,QAAQ;IAC1E;IACA,MAAM;GACP,CAAC;GACD;EACD;EACA,MAAM,QAAQ,IAAI,aAAa,IAAI,OAAO;EAC1C,IAAI,UAAU,KAAK,GAAG;GACrB,aAAa,KAAK;IACjB,MAAM;IACN,SAAS,SAAS,MAAM,KAAK,kBAAkB,QAAQ;IACvD;IACA,MAAM;GACP,CAAC;GACD;EACD;EACA,MAAM,6BAA6B,IAAI,IAAI;EAC3C,MAAM,UAAU,CAAC;EACjB,IAAI,cAAc;EAClB,KAAK,MAAM,CAAC,YAAY,eAAe,OAAO,QAAQ,MAAM,UAAU,GAAG;GACxE,IAAI;GACJ,IAAI,WAAW,SAAS,QAAQ,IAAI;IACnC,QAAQ,MAAM,WAAW,UAAU;GACpC,QAAQ;IACP,aAAa,KAAK;KACjB,MAAM;KACN,SAAS,SAAS,MAAM,KAAK,YAAY,WAAW,4BAA4B,QAAQ;KACxF;KACA,MAAM,WAAW;IAClB,CAAC;IACD,cAAc;IACd;GACD;QACK,IAAI,WAAW,SAAS,SAAS;IACrC,IAAI;IACJ,IAAI;KACH,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IACL,EAAE;IACF,IAAI;GACL;EACD;EACA,MAAM;GACL,MAAM;GACN,QAAQ;IACP,SAAS;IACT,YAAY;IACZ,YAAY,EAAE,QAAQ,GAAG;IACzB,mBAAmB,EAAE,UAAU;KAC9B,MAAM;KACN,IAAI;IACL,EAAE;IACF,IAAI;GACL;EACD;EACA,QAAQ;GACP,MAAM;GACN,MAAM,CAAC,qBAAqB;GAC5B,QAAQ;IACP,SAAS;IACT,YAAY;IACZ,YAAY,EAAE,QAAQ;KACrB,MAAM;KACN,OAAO;KACP,MAAM,CAAC,MAAM;KACb,SAAS;IACV,EAAE;IACF,mBAAmB,EAAE,UAAU;KAC9B,MAAM;KACN,IAAI;KACJ,QAAQ,EAAE,MAAM;MACf,MAAM;MACN,OAAO;MACP,MAAM,CAAC,MAAM;KACd,EAAE;IACH,EAAE;IACF,IAAI;GACL;EACD;EACA,OAAO;GACN,MAAM;GACN,QAAQ;IACP,SAAS;IACT,YAAY;IACZ,YAAY,EAAE,QAAQ,GAAG;IACzB,mBAAmB,EAAE,UAAU;KAC9B,MAAM;KACN,IAAI;IACL,EAAE;IACF,IAAI;GACL;EACD;EACA,OAAO;GACN,MAAM;GACN,QAAQ;IACP,SAAS;IACT,YAAY;IACZ,YAAY,EAAE,QAAQ,GAAG;IACzB,mBAAmB,EAAE,UAAU;KAC9B,MAAM;KACN,IAAI;IACL,EAAE;IACF,IAAI;GACL;EACD;CACD;AACD;AAGA,MAAM,0BAA0B,EAAE,KAAK,EAAE,QAAQ;CAChD,MAAM;CACN,MAAM,CAAC;EACN,MAAM;EACN,MAAM;EACN,SAAS;EACT,SAAS;EACT,SAAS;CACV,CAAC;CACD,QAAQ;EACP,SAAS;EACT,YAAY;EACZ,YAAY,EAAE,QAAQ;GACrB,MAAM;GACN,OAAO;EACR,EAAE;CACH;AACD,EAAE,EAAE"}
|
package/dist/builder.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { o as Expression, x as ScopeField } from "./expression-
|
|
2
|
-
import {
|
|
3
|
-
export type { AggregateFunctions, Db, DeleteQuery, Expression, Functions, GatedMethod, GroupedQuery, InsertQuery, QueryContext, ResolveRow, Scope, ScopeField, SelectQuery, Subquery, TableProxy, UpdateQuery };
|
|
1
|
+
import { o as Expression, x as ScopeField } from "./expression-mku9I7Ue.mjs";
|
|
2
|
+
import { T as WhereFilter, _ as SelectQuery, a as DeleteQuery, c as GatedMethod, f as QueryContext, g as Scope, h as ResolveRow, i as Db, l as GroupedQuery, s as Functions, t as AggregateFunctions, u as InsertQuery, v as Subquery, w as UpdateQuery, x as TableProxy } from "./db-BhQdL6Za-DubRGJvv.mjs";
|
|
3
|
+
export type { AggregateFunctions, Db, DeleteQuery, Expression, Functions, GatedMethod, GroupedQuery, InsertQuery, QueryContext, ResolveRow, Scope, ScopeField, SelectQuery, Subquery, TableProxy, UpdateQuery, WhereFilter };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { c as SqlStorage } from "./sql-storage-8LqxeLAY-DH4DdUXx.mjs";
|
|
2
|
-
import "./types-
|
|
3
|
-
import { i as SqlOperationEntry } from "./index-
|
|
4
|
-
import { s as AnyExpression } from "./types-v3qxLLxo-
|
|
5
|
-
import "./ast-
|
|
6
|
-
import { l as RawCodecInferer, o as Expression, x as ScopeField } from "./expression-
|
|
7
|
-
import {
|
|
8
|
-
import { c as SqlAggregateDescriptorRegistry, r as ExecutionContext } from "./query-lane-context-Qa-eddrE-
|
|
9
|
-
import "./query-lane-context-
|
|
2
|
+
import "./types-C36_3E6_.mjs";
|
|
3
|
+
import { i as SqlOperationEntry } from "./index-CLAshwKN.mjs";
|
|
4
|
+
import { s as AnyExpression } from "./types-v3qxLLxo-Clw_yBAh.mjs";
|
|
5
|
+
import "./ast-DuLukI6f.mjs";
|
|
6
|
+
import { l as RawCodecInferer, o as Expression, x as ScopeField } from "./expression-mku9I7Ue.mjs";
|
|
7
|
+
import { S as TableProxyContract, f as QueryContext, g as Scope, i as Db, o as FieldProxy, p as RawLane, s as Functions, t as AggregateFunctions } from "./db-BhQdL6Za-DubRGJvv.mjs";
|
|
8
|
+
import { c as SqlAggregateDescriptorRegistry, r as ExecutionContext } from "./query-lane-context-Qa-eddrE-BQV6J9nV.mjs";
|
|
9
|
+
import "./query-lane-context-CGdMIEuv.mjs";
|
|
10
10
|
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
11
11
|
import { CodecRef } from "@prisma/orm-framework/components/codec";
|
|
12
12
|
//#region ../../../2-sql/4-lanes/sql-builder/dist/runtime/index.d.mts
|
|
@@ -35,6 +35,23 @@ declare function createFieldProxy<S extends Scope>(scope: S): FieldProxy<S>;
|
|
|
35
35
|
declare function createFunctions<QC extends QueryContext>(operations: Readonly<Record<string, SqlOperationEntry>>, rawCodecInferer: RawCodecInferer): Functions<QC>;
|
|
36
36
|
declare function createAggregateFunctions<QC extends QueryContext>(operations: Readonly<Record<string, SqlOperationEntry>>, rawCodecInferer: RawCodecInferer, aggregateRegistry: SqlAggregateDescriptorRegistry): AggregateFunctions<QC>;
|
|
37
37
|
//#endregion
|
|
38
|
+
//#region src/runtime/raw-lane.d.ts
|
|
39
|
+
interface RawLaneOptions<C extends Contract<SqlStorage> & TableProxyContract> {
|
|
40
|
+
readonly context: ExecutionContext<C>;
|
|
41
|
+
readonly rawCodecInferer: RawCodecInferer;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Builds the raw lane a client exposes as `db.raw`.
|
|
45
|
+
*
|
|
46
|
+
* The tag binds the adapter's codec inferer and the contract here, once. An
|
|
47
|
+
* authoring site then carries only its template, its row spec, and a
|
|
48
|
+
* terminator.
|
|
49
|
+
*
|
|
50
|
+
* The row type is phantom: no value holds it. The target-agnostic tag types it
|
|
51
|
+
* as `unknown`, and the contract says what each declared column decodes to.
|
|
52
|
+
*/
|
|
53
|
+
declare function createRawLane<C extends Contract<SqlStorage> & TableProxyContract>(options: RawLaneOptions<C>): RawLane<C>;
|
|
54
|
+
//#endregion
|
|
38
55
|
//#region src/runtime/sql.d.ts
|
|
39
56
|
interface SqlOptions<C extends Contract<SqlStorage> & TableProxyContract> {
|
|
40
57
|
readonly context: ExecutionContext<C>;
|
|
@@ -42,5 +59,5 @@ interface SqlOptions<C extends Contract<SqlStorage> & TableProxyContract> {
|
|
|
42
59
|
}
|
|
43
60
|
declare function sql<C extends Contract<SqlStorage> & TableProxyContract>(options: SqlOptions<C>): Db<C>;
|
|
44
61
|
//#endregion
|
|
45
|
-
export { type Db, ExpressionImpl, type SqlOptions, createAggregateFunctions, createFieldProxy, createFunctions, sql };
|
|
62
|
+
export { type Db, ExpressionImpl, type RawLaneOptions, type SqlOptions, createAggregateFunctions, createFieldProxy, createFunctions, createRawLane, sql };
|
|
46
63
|
//# sourceMappingURL=builder__runtime.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder__runtime.d.mts","names":[],"sources":["../../../../2-sql/4-lanes/sql-builder/dist/runtime/index.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;cAgBc,eAAe,UAAU,aAAa,uBAAuB,WAAW;mBACnE;mBACA;WACR,YAAY;WACZ,OAAO;EAChB,YAAY,KAAK,eAAe,YAAY,GAAG,QAAQ,UAAU,gBAAgB;EACjF,YAAY;EACZ,sBAAsB;;;;iBAIP,iBAAiB,UAAU,OAAO,OAAO,IAAI,WAAW;;;iBAGxD,gBAAgB,WAAW,cAAc,YAAY,SAAS,eAAe,qBAAqB,iBAAiB,kBAAkB,UAAU;iBAC/I,yBAAyB,WAAW,cAAc,YAAY,SAAS,eAAe,qBAAqB,iBAAiB,iBAAiB,mBAAmB,iCAAiC,mBAAmB;;;UAG3N,WAAW,UAAU,SAAS,cAAc;WAC3C,SAAS,iBAAiB;WAC1B,iBAAiB;;iBAEX,IAAI,UAAU,SAAS,cAAc,oBAAoB,SAAS,WAAW,KAAK,GAAG"}
|
|
1
|
+
{"version":3,"file":"builder__runtime.d.mts","names":[],"sources":["../../../../2-sql/4-lanes/sql-builder/dist/runtime/index.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;cAgBc,eAAe,UAAU,aAAa,uBAAuB,WAAW;mBACnE;mBACA;WACR,YAAY;WACZ,OAAO;EAChB,YAAY,KAAK,eAAe,YAAY,GAAG,QAAQ,UAAU,gBAAgB;EACjF,YAAY;EACZ,sBAAsB;;;;iBAIP,iBAAiB,UAAU,OAAO,OAAO,IAAI,WAAW;;;iBAGxD,gBAAgB,WAAW,cAAc,YAAY,SAAS,eAAe,qBAAqB,iBAAiB,kBAAkB,UAAU;iBAC/I,yBAAyB,WAAW,cAAc,YAAY,SAAS,eAAe,qBAAqB,iBAAiB,iBAAiB,mBAAmB,iCAAiC,mBAAmB;;;UAG3N,eAAe,UAAU,SAAS,cAAc;WAC/C,SAAS,iBAAiB;WAC1B,iBAAiB;;;;;;;;;;;;iBAYX,cAAc,UAAU,SAAS,cAAc,oBAAoB,SAAS,eAAe,KAAK,QAAQ;;;UAG/G,WAAW,UAAU,SAAS,cAAc;WAC3C,SAAS,iBAAiB;WAC1B,iBAAiB;;iBAEX,IAAI,UAAU,SAAS,cAAc,oBAAoB,SAAS,WAAW,KAAK,GAAG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { C as LiteralExpr, D as OrExpr, F as SubqueryExpr, I as TableSource, L as UpdateAst, O as OrderByItem, P as SelectAst, S as ListExpression, T as NullCheckExpr, V as isAggregateFn, _ as InsertAst, c as DeleteAst, g as IdentifierRef, j as ProjectionItem, k as ParamRef, l as DerivedTableSource, n as AndExpr, o as ColumnRef, p as ExistsExpr, r as BinaryExpr, t as AggregateExpr, y as JoinAst } from "./types-Dt4e_jC--COeP8xzN.mjs";
|
|
2
2
|
import { t as collectOrderedParamRefs } from "./util-DQQgv2j1-D6INZaRG.mjs";
|
|
3
|
-
import { a as toExpr, n as codecOf, r as createRawSql } from "./expression-
|
|
4
|
-
import { n as codecRefForStorageColumn } from "./codec-descriptor-registry-
|
|
3
|
+
import { a as toExpr, n as codecOf, r as createRawSql } from "./expression-B2Ox7zKM.mjs";
|
|
4
|
+
import { n as codecRefForStorageColumn } from "./codec-descriptor-registry-ECZ4ohtG.mjs";
|
|
5
5
|
import { assertAnnotationsApplicable } from "@prisma/orm-framework/components/runtime";
|
|
6
6
|
//#region ../../../2-sql/4-lanes/sql-builder/dist/runtime/index.mjs
|
|
7
7
|
/**
|
|
@@ -155,7 +155,7 @@ function createNamespaceProxy(namespaceName, fields) {
|
|
|
155
155
|
} });
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
|
-
* A bug in Prisma
|
|
158
|
+
* A bug in Prisma 8, not a user error. Never catch this except at the
|
|
159
159
|
* outermost boundary for crash reporting — an InternalError means an invariant
|
|
160
160
|
* broke and the process cannot reliably continue. User-facing failures use
|
|
161
161
|
* `structuredError` with a dotted code instead.
|
|
@@ -348,6 +348,20 @@ function createAggregateFunctions(operations, rawCodecInferer, aggregateRegistry
|
|
|
348
348
|
return baseFns[prop];
|
|
349
349
|
} });
|
|
350
350
|
}
|
|
351
|
+
/**
|
|
352
|
+
* Builds the raw lane a client exposes as `db.raw`.
|
|
353
|
+
*
|
|
354
|
+
* The tag binds the adapter's codec inferer and the contract here, once. An
|
|
355
|
+
* authoring site then carries only its template, its row spec, and a
|
|
356
|
+
* terminator.
|
|
357
|
+
*
|
|
358
|
+
* The row type is phantom: no value holds it. The target-agnostic tag types it
|
|
359
|
+
* as `unknown`, and the contract says what each declared column decodes to.
|
|
360
|
+
*/
|
|
361
|
+
function createRawLane(options) {
|
|
362
|
+
const tag = blindCast(createRawSql(options.rawCodecInferer, { contract: options.context.contract }));
|
|
363
|
+
return Object.freeze({ sql: tag });
|
|
364
|
+
}
|
|
351
365
|
function resolveTableInNamespace(storage, namespaceId, tableName) {
|
|
352
366
|
const namespace = storage.namespaces[namespaceId];
|
|
353
367
|
if (namespace === void 0) return void 0;
|
|
@@ -1054,8 +1068,6 @@ var TableProxyImpl = class TableProxyImpl extends BuilderBase {
|
|
|
1054
1068
|
return new JoinedTablesImpl(emptyState(this.#fromSource, this.#scope), this.ctx);
|
|
1055
1069
|
}
|
|
1056
1070
|
};
|
|
1057
|
-
/** The key `raw`, which the SQL surface answers with the raw statement tag; no storage namespace may claim it. */
|
|
1058
|
-
const RAW_TAG_KEY = "raw";
|
|
1059
1071
|
function sql(options) {
|
|
1060
1072
|
const { context, rawCodecInferer } = options;
|
|
1061
1073
|
const ctx = {
|
|
@@ -1069,11 +1081,8 @@ function sql(options) {
|
|
|
1069
1081
|
aggregates: context.aggregateDescriptors
|
|
1070
1082
|
};
|
|
1071
1083
|
const { storage } = context.contract;
|
|
1072
|
-
if (Object.hasOwn(storage.namespaces, RAW_TAG_KEY)) throw structuredError("ORM.NAMESPACE_RESERVED", `The SQL surface exposes the raw statement tag as "db.${RAW_TAG_KEY}", so a storage namespace named "${RAW_TAG_KEY}" cannot be reached through it. Rename the namespace in the schema.`, { meta: { namespaceId: RAW_TAG_KEY } });
|
|
1073
|
-
const raw = blindCast(createRawSql(rawCodecInferer, { contract: context.contract }));
|
|
1074
1084
|
return new Proxy(blindCast({}), { get(_target, prop) {
|
|
1075
1085
|
if (typeof prop !== "string") return;
|
|
1076
|
-
if (prop === RAW_TAG_KEY) return raw;
|
|
1077
1086
|
if (!Object.hasOwn(storage.namespaces, prop)) return;
|
|
1078
1087
|
const namespaceId = prop;
|
|
1079
1088
|
return new Proxy({}, { get(_facetTarget, tableName) {
|
|
@@ -1084,6 +1093,6 @@ function sql(options) {
|
|
|
1084
1093
|
} });
|
|
1085
1094
|
}
|
|
1086
1095
|
//#endregion
|
|
1087
|
-
export { ExpressionImpl, createAggregateFunctions, createFieldProxy, createFunctions, sql };
|
|
1096
|
+
export { ExpressionImpl, createAggregateFunctions, createFieldProxy, createFunctions, createRawLane, sql };
|
|
1088
1097
|
|
|
1089
1098
|
//# sourceMappingURL=builder__runtime.mjs.map
|