@prisma/orm-family-sql 8.0.0-rc.14-dev.14 → 8.0.0-rc.14-dev.15
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-qnGR-fmK.d.mts → ast-S4eEzFmO.d.mts} +3 -3
- package/dist/{ast-qnGR-fmK.d.mts.map → ast-S4eEzFmO.d.mts.map} +1 -1
- package/dist/{authoring-entity-types-CZ-vdwYS-BCsVtN8A.d.mts → authoring-entity-types-CZ-vdwYS-CvNNLogv.d.mts} +2 -2
- package/dist/{authoring-entity-types-CZ-vdwYS-BCsVtN8A.d.mts.map → authoring-entity-types-CZ-vdwYS-CvNNLogv.d.mts.map} +1 -1
- package/dist/{authoring-type-constructors-DIyheCzv-BgR6EC_E.mjs → authoring-type-constructors-DIyheCzv-BuirUCc_.mjs} +2 -2
- package/dist/{authoring-type-constructors-DIyheCzv-BgR6EC_E.mjs.map → authoring-type-constructors-DIyheCzv-BuirUCc_.mjs.map} +1 -1
- package/dist/builder.d.mts +2 -2
- package/dist/builder__runtime.d.mts +9 -9
- package/dist/builder__runtime.mjs +1 -1
- package/dist/builder__types.d.mts +2 -2
- package/dist/{codec-descriptor-registry-B1v3GEdK.mjs → codec-descriptor-registry-BSoMKDUv.mjs} +2 -2
- package/dist/{codec-descriptor-registry-B1v3GEdK.mjs.map → codec-descriptor-registry-BSoMKDUv.mjs.map} +1 -1
- package/dist/{config-types-BzCtgjh6.mjs → config-types-CYRUgWbg.mjs} +2 -2
- package/dist/{config-types-BzCtgjh6.mjs.map → config-types-CYRUgWbg.mjs.map} +1 -1
- package/dist/{config-types-VJ5O9Ert.d.mts → config-types-Dpg3tzCJ.d.mts} +4 -4
- package/dist/{config-types-VJ5O9Ert.d.mts.map → config-types-Dpg3tzCJ.d.mts.map} +1 -1
- package/dist/{contract-builder-CyJOBIFB.mjs → contract-builder-CUfUvDc1.mjs} +16 -10
- package/dist/contract-builder-CUfUvDc1.mjs.map +1 -0
- package/dist/{contract-builder-ezejmfrY.d.mts → contract-builder-_39f3LuO.d.mts} +73 -26
- package/dist/contract-builder-_39f3LuO.d.mts.map +1 -0
- package/dist/contract-emitter.mjs +1 -1
- package/dist/contract-prisma7__provider.d.mts +2 -2
- package/dist/contract-prisma7__provider.mjs +9 -6
- package/dist/contract-prisma7__provider.mjs.map +1 -1
- package/dist/contract-psl.d.mts +3 -3
- package/dist/contract-psl.mjs +1 -1
- package/dist/contract-psl__attribute-specs.d.mts +2 -2
- package/dist/contract-psl__attribute-specs.d.mts.map +1 -1
- package/dist/contract-psl__attribute-specs.mjs +1 -1
- package/dist/contract-psl__provider.d.mts +2 -2
- package/dist/contract-psl__provider.mjs +2 -2
- package/dist/contract-psl__provider.mjs.map +1 -1
- package/dist/contract-ts.d.mts +4 -4
- 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 +3 -3
- package/dist/contract-ts__contract-builder.mjs +2 -2
- package/dist/{contract-view-BTFdP8wh.d.mts → contract-view-D8enRe9A.d.mts} +2 -2
- package/dist/{contract-view-BTFdP8wh.d.mts.map → contract-view-D8enRe9A.d.mts.map} +1 -1
- package/dist/contract.d.mts +10 -10
- package/dist/contract.mjs +6 -6
- package/dist/contract__contract-view.d.mts +1 -1
- package/dist/contract__entity-kinds.d.mts +1 -1
- package/dist/contract__entity-kinds.mjs +1 -1
- package/dist/contract__factories.d.mts +1 -1
- package/dist/contract__factories.mjs +1 -1
- package/dist/contract__index-type-validation.d.mts +1 -1
- package/dist/contract__resolve-storage-table.d.mts +1 -1
- package/dist/contract__types.d.mts +4 -4
- package/dist/contract__types.mjs +3 -3
- package/dist/contract__validators.d.mts +1 -1
- package/dist/contract__validators.mjs +2 -2
- package/dist/{control-BFgBjkQh.d.mts → control--13SHD7X.d.mts} +15 -15
- package/dist/{control-BFgBjkQh.d.mts.map → control--13SHD7X.d.mts.map} +1 -1
- package/dist/{control-D7yb7l7O.mjs → control-B8LE0HRq.mjs} +13 -12
- package/dist/control-B8LE0HRq.mjs.map +1 -0
- package/dist/{control-adapter-C4_cgvzB-BhRxZg-n.d.mts → control-adapter-C4_cgvzB-C9dQipiW.d.mts} +6 -6
- package/dist/{control-adapter-C4_cgvzB-BhRxZg-n.d.mts.map → control-adapter-C4_cgvzB-C9dQipiW.d.mts.map} +1 -1
- package/dist/control-adapter-D2k9sW7u.d.mts +1 -0
- package/dist/{db-DLjWu9-f-B79_8TyU.d.mts → db-DLjWu9-f-NJprwMBN.d.mts} +9 -9
- package/dist/{db-DLjWu9-f-B79_8TyU.d.mts.map → db-DLjWu9-f-NJprwMBN.d.mts.map} +1 -1
- package/dist/{ddl-types-B23QEzDx-ridB7leA.d.mts → ddl-types-B23QEzDx-DnMvLEgB.d.mts} +3 -3
- package/dist/{ddl-types-B23QEzDx-ridB7leA.d.mts.map → ddl-types-B23QEzDx-DnMvLEgB.d.mts.map} +1 -1
- package/dist/{derived-checks-a_OpD3OE-BLAb_lZ9.mjs → derived-checks-C_y1rk6O-DdqjzGNy.mjs} +23 -16
- package/dist/derived-checks-C_y1rk6O-DdqjzGNy.mjs.map +1 -0
- package/dist/{derived-checks-DPdD01O0-zXZEuy5P.d.mts → derived-checks-DPdD01O0-CwIwhhTu.d.mts} +3 -3
- package/dist/{derived-checks-DPdD01O0-zXZEuy5P.d.mts.map → derived-checks-DPdD01O0-CwIwhhTu.d.mts.map} +1 -1
- package/dist/{diff-CPnJUpHZ.d.mts → diff-D3Ocd7-r.d.mts} +6 -6
- package/dist/{diff-CPnJUpHZ.d.mts.map → diff-D3Ocd7-r.d.mts.map} +1 -1
- package/dist/{dist-DeiKZwAD.mjs → dist-BW8u_IDQ.mjs} +5 -4
- package/dist/dist-BW8u_IDQ.mjs.map +1 -0
- package/dist/{entity-kinds-B5cUFU22.d.mts → entity-kinds-BG4YTvrr.d.mts} +2 -2
- package/dist/{entity-kinds-B5cUFU22.d.mts.map → entity-kinds-BG4YTvrr.d.mts.map} +1 -1
- package/dist/{entity-kinds-D7vwoN_T-NmeI6TpT.mjs → entity-kinds-ChX-owgJ-BgpQHnfy.mjs} +16 -12
- package/dist/entity-kinds-ChX-owgJ-BgpQHnfy.mjs.map +1 -0
- package/dist/{expression-C6yUAU4j.d.mts → expression-DLgBXKdO.d.mts} +7 -7
- package/dist/{expression-C6yUAU4j.d.mts.map → expression-DLgBXKdO.d.mts.map} +1 -1
- package/dist/{factories-aJoZYxkD.mjs → factories-16A63DkK.mjs} +21 -15
- package/dist/factories-16A63DkK.mjs.map +1 -0
- package/dist/{factories-TIM9dI6S.d.mts → factories-CLPZYUUw.d.mts} +12 -6
- package/dist/factories-CLPZYUUw.d.mts.map +1 -0
- package/dist/family.d.mts +12 -12
- package/dist/family.mjs +5 -5
- package/dist/family__control-adapter.d.mts +2 -2
- package/dist/family__control.d.mts +4 -4
- package/dist/family__control.mjs +3 -3
- 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 +1 -1
- package/dist/family__pack.mjs +2 -2
- package/dist/family__psl-build.mjs +1 -1
- package/dist/family__runtime.d.mts +2 -2
- package/dist/{index-DrUd8HwS.d.mts → index-BlVbNiHO.d.mts} +3 -3
- package/dist/{index-DrUd8HwS.d.mts.map → index-BlVbNiHO.d.mts.map} +1 -1
- package/dist/{index-CQ74jdOW.d.mts → index-VjA5whAC.d.mts} +11 -11
- package/dist/{index-CQ74jdOW.d.mts.map → index-VjA5whAC.d.mts.map} +1 -1
- package/dist/{index-type-validation-BAQWs-c_.d.mts → index-type-validation-DLPW4oTq.d.mts} +3 -3
- package/dist/{index-type-validation-BAQWs-c_.d.mts.map → index-type-validation-DLPW4oTq.d.mts.map} +1 -1
- package/dist/{interpreter-j1ewAXPb-BbCjJ0ta.mjs → interpreter-CkCfPqup-DF7bZvNM.mjs} +82 -16
- package/dist/interpreter-CkCfPqup-DF7bZvNM.mjs.map +1 -0
- package/dist/{ir-DI4cwMsy.d.mts → ir-DbwRAIkx.d.mts} +3 -3
- package/dist/{ir-DI4cwMsy.d.mts.map → ir-DbwRAIkx.d.mts.map} +1 -1
- package/dist/middleware-BwwcaXlc.d.mts +1 -0
- package/dist/{middleware-CuGBptK0-CGDI6sQU.d.mts → middleware-CuGBptK0-BEYuhhG2.d.mts} +2 -2
- package/dist/{middleware-CuGBptK0-CGDI6sQU.d.mts.map → middleware-CuGBptK0-BEYuhhG2.d.mts.map} +1 -1
- package/dist/{migration-Ixy5Tqxd.d.mts → migration-BqUra50L.d.mts} +4 -4
- package/dist/{migration-Ixy5Tqxd.d.mts.map → migration-BqUra50L.d.mts.map} +1 -1
- package/dist/operations.d.mts +1 -1
- package/dist/orm-client.d.mts +15 -15
- package/dist/orm-client.mjs +2 -2
- package/dist/orm-client.mjs.map +1 -1
- package/dist/{pack-DcSVDz7M.d.mts → pack-fBtj2dsq.d.mts} +3 -3
- package/dist/{pack-DcSVDz7M.d.mts.map → pack-fBtj2dsq.d.mts.map} +1 -1
- package/dist/{plan-B7g2kDfQ-Do1iWC4q.d.mts → plan-B7g2kDfQ-BVlzwDKL.d.mts} +4 -4
- package/dist/{plan-B7g2kDfQ-Do1iWC4q.d.mts.map → plan-B7g2kDfQ-BVlzwDKL.d.mts.map} +1 -1
- package/dist/plan-hQv6wCbk.d.mts +2 -0
- package/dist/{prepared-statement-Cv54gpY_-CbIaPDc1.d.mts → prepared-statement-Cv54gpY_-BObeNp2I.d.mts} +16 -16
- package/dist/{prepared-statement-Cv54gpY_-CbIaPDc1.d.mts.map → prepared-statement-Cv54gpY_-BObeNp2I.d.mts.map} +1 -1
- package/dist/{psl-build-139T3MMA.mjs → psl-build-CqhSpaQE.mjs} +2 -2
- package/dist/{psl-build-139T3MMA.mjs.map → psl-build-CqhSpaQE.mjs.map} +1 -1
- package/dist/{query-lane-context-BSmWfohZ-QAWw_dXQ.d.mts → query-lane-context-BSmWfohZ-yCQ9qzQZ.d.mts} +5 -5
- package/dist/{query-lane-context-BSmWfohZ-QAWw_dXQ.d.mts.map → query-lane-context-BSmWfohZ-yCQ9qzQZ.d.mts.map} +1 -1
- package/dist/query-lane-context-DbJO1bmQ.d.mts +1 -0
- package/dist/relational-core.d.mts +11 -11
- package/dist/relational-core__aggregate-descriptor-registry.d.mts +1 -1
- package/dist/relational-core__ast.d.mts +3 -3
- package/dist/relational-core__codec-descriptor-registry.d.mts +4 -4
- 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__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/{resolve-storage-table-DhgzQjow.d.mts → resolve-storage-table-5G0L5k6M.d.mts} +3 -3
- package/dist/{resolve-storage-table-DhgzQjow.d.mts.map → resolve-storage-table-5G0L5k6M.d.mts.map} +1 -1
- package/dist/{runtime-I-W0bhvd.d.mts → runtime-CajhgB9z.d.mts} +2 -2
- package/dist/{runtime-I-W0bhvd.d.mts.map → runtime-CajhgB9z.d.mts.map} +1 -1
- package/dist/runtime.d.mts +4 -4
- package/dist/runtime.mjs +1 -1
- package/dist/runtime__internal__prepared-query.d.mts +1 -1
- package/dist/{schema-differ-DpG_gnur-gLIPLPVI.d.mts → schema-differ-DpG_gnur-CYpc6zuh.d.mts} +3 -3
- package/dist/{schema-differ-DpG_gnur-gLIPLPVI.d.mts.map → schema-differ-DpG_gnur-CYpc6zuh.d.mts.map} +1 -1
- package/dist/schema-ir.mjs +1 -1
- package/dist/schema-ir__types.mjs +1 -1
- package/dist/{schema-verify-DI0aJQ9d-DL-C6on7.mjs → schema-verify-DI0aJQ9d-TpdeERRD.mjs} +2 -2
- package/dist/{schema-verify-DI0aJQ9d-DL-C6on7.mjs.map → schema-verify-DI0aJQ9d-TpdeERRD.mjs.map} +1 -1
- package/dist/{serialized-index-nBTwanKy-B0C03Q_R.mjs → serialized-index-B5X7s-oX-TKQhXsZz.mjs} +3 -3
- package/dist/{serialized-index-nBTwanKy-B0C03Q_R.mjs.map → serialized-index-B5X7s-oX-TKQhXsZz.mjs.map} +1 -1
- package/dist/{sql-attribute-specs-Bs9QDuS7-DmIRJUz9.mjs → sql-attribute-specs-DxpHr9Fk-CeWmMP7y.mjs} +20 -7
- package/dist/sql-attribute-specs-DxpHr9Fk-CeWmMP7y.mjs.map +1 -0
- package/dist/{sql-contract-serializer-C90xg7_q-DBJSt3MT.mjs → sql-contract-serializer-C90xg7_q-CxzBoB0F.mjs} +4 -4
- package/dist/{sql-contract-serializer-C90xg7_q-DBJSt3MT.mjs.map → sql-contract-serializer-C90xg7_q-CxzBoB0F.mjs.map} +1 -1
- package/dist/{sql-execution-plan-Db0j752I-uGUWy8sD.d.mts → sql-execution-plan-Db0j752I-B3yGocR6.d.mts} +2 -2
- package/dist/{sql-execution-plan-Db0j752I-uGUWy8sD.d.mts.map → sql-execution-plan-Db0j752I-B3yGocR6.d.mts.map} +1 -1
- package/dist/{sql-storage-BSxD7_vv-C4ugLH39.d.mts → sql-storage-jJySr7bL-1Eh2i2r1.d.mts} +3 -3
- package/dist/{sql-storage-BSxD7_vv-C4ugLH39.d.mts.map → sql-storage-jJySr7bL-1Eh2i2r1.d.mts.map} +1 -1
- package/dist/{storage-table-ZzbR-xzQ-C8gXT45E.mjs → storage-table-ADhJ4Imk-0FbJXvSZ.mjs} +6 -3
- package/dist/storage-table-ADhJ4Imk-0FbJXvSZ.mjs.map +1 -0
- package/dist/{storage-table-DSeWszOL-CI-cItEK.d.mts → storage-table-DLFvP77v-BfO2iOT4.d.mts} +9 -6
- package/dist/storage-table-DLFvP77v-BfO2iOT4.d.mts.map +1 -0
- package/dist/{types-C5QzgUrH-B7IJM6qN.mjs → types-B9rf_EdI-CEYrMMeO.mjs} +6 -2
- package/dist/types-B9rf_EdI-CEYrMMeO.mjs.map +1 -0
- package/dist/{types-BGHABElw-C5MKkR3c.d.mts → types-BGHABElw-CZyfbuWe.d.mts} +10 -10
- package/dist/{types-BGHABElw-C5MKkR3c.d.mts.map → types-BGHABElw-CZyfbuWe.d.mts.map} +1 -1
- package/dist/{types-BHKZ4M-a-DYsrOHhh.d.mts → types-BHKZ4M-a-CPFh-lCl.d.mts} +7 -7
- package/dist/{types-BHKZ4M-a-DYsrOHhh.d.mts.map → types-BHKZ4M-a-CPFh-lCl.d.mts.map} +1 -1
- package/dist/{types-DTUyRqZv-DLh98w8w.d.mts → types-Bl6ohp1g-ROH3Mwm9.d.mts} +4 -4
- package/dist/{types-DTUyRqZv-DLh98w8w.d.mts.map → types-Bl6ohp1g-ROH3Mwm9.d.mts.map} +1 -1
- package/dist/types-CHcsPFTv.d.mts +1 -0
- package/dist/{types-BoMDdzjD.d.mts → types-E46h1SEX.d.mts} +4 -4
- package/dist/{types-BoMDdzjD.d.mts.map → types-E46h1SEX.d.mts.map} +1 -1
- package/dist/{types-Yui2yFf6-DQkiEr9B.d.mts → types-Yui2yFf6-Ceyf2gJ2.d.mts} +2 -2
- package/dist/{types-Yui2yFf6-DQkiEr9B.d.mts.map → types-Yui2yFf6-Ceyf2gJ2.d.mts.map} +1 -1
- package/dist/{types-BmXzMDQL.mjs → types-jFnALKoT.mjs} +2 -2
- package/dist/{types-BmXzMDQL.mjs.map → types-jFnALKoT.mjs.map} +1 -1
- package/dist/{validators-CZNulH-_.d.mts → validators-CQ_fniE7.d.mts} +6 -4
- package/dist/validators-CQ_fniE7.d.mts.map +1 -0
- package/dist/{validators-BlqrBU7I.mjs → validators-DvzOZLel.mjs} +34 -32
- package/dist/validators-DvzOZLel.mjs.map +1 -0
- package/package.json +18 -18
- package/dist/contract-builder-CyJOBIFB.mjs.map +0 -1
- package/dist/contract-builder-ezejmfrY.d.mts.map +0 -1
- package/dist/control-D7yb7l7O.mjs.map +0 -1
- package/dist/control-adapter-Cj6XQ7Yo.d.mts +0 -1
- package/dist/derived-checks-a_OpD3OE-BLAb_lZ9.mjs.map +0 -1
- package/dist/dist-DeiKZwAD.mjs.map +0 -1
- package/dist/entity-kinds-D7vwoN_T-NmeI6TpT.mjs.map +0 -1
- package/dist/factories-TIM9dI6S.d.mts.map +0 -1
- package/dist/factories-aJoZYxkD.mjs.map +0 -1
- package/dist/interpreter-j1ewAXPb-BbCjJ0ta.mjs.map +0 -1
- package/dist/middleware-C6T9FExV.d.mts +0 -1
- package/dist/plan-BBBYfvlz.d.mts +0 -2
- package/dist/query-lane-context-B0R8L6W-.d.mts +0 -1
- package/dist/sql-attribute-specs-Bs9QDuS7-DmIRJUz9.mjs.map +0 -1
- package/dist/storage-table-DSeWszOL-CI-cItEK.d.mts.map +0 -1
- package/dist/storage-table-ZzbR-xzQ-C8gXT45E.mjs.map +0 -1
- package/dist/types-C5QzgUrH-B7IJM6qN.mjs.map +0 -1
- package/dist/types-CXe4fCcu.d.mts +0 -1
- package/dist/validators-BlqrBU7I.mjs.map +0 -1
- package/dist/validators-CZNulH-_.d.mts.map +0 -1
package/dist/{schema-verify-DI0aJQ9d-DL-C6on7.mjs.map → schema-verify-DI0aJQ9d-TpdeERRD.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-verify-DI0aJQ9d-DL-C6on7.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/schema-verify-DI0aJQ9d.mjs"],"sourcesContent":["import { assertUniqueCodecOwner, dispositionForCategory, issueOutcome } from \"@internal/framework-components/control\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { effectiveControlPolicy } from \"@internal/contract/types\";\nimport { isStorageTypeInstance } from \"@internal/sql-contract/types\";\n//#region src/core/assembly.ts\nfunction hasCodecControlHooks(descriptor) {\n\tif (typeof descriptor !== \"object\" || descriptor === null) return false;\n\tconst hooks = blindCast(descriptor).types?.codecTypes?.controlPlaneHooks;\n\treturn hooks !== null && hooks !== void 0 && typeof hooks === \"object\";\n}\nfunction extractCodecControlHooks(descriptors) {\n\tconst hooks = /* @__PURE__ */ new Map();\n\tconst owners = /* @__PURE__ */ new Map();\n\tfor (const descriptor of descriptors) {\n\t\tif (typeof descriptor !== \"object\" || descriptor === null) continue;\n\t\tif (!hasCodecControlHooks(descriptor)) continue;\n\t\tconst controlPlaneHooks = descriptor.types.codecTypes.controlPlaneHooks;\n\t\tfor (const [codecId, hook] of Object.entries(controlPlaneHooks)) {\n\t\t\tassertUniqueCodecOwner({\n\t\t\t\tcodecId,\n\t\t\t\towners,\n\t\t\t\tdescriptorId: descriptor.id,\n\t\t\t\tentityLabel: \"control hooks\",\n\t\t\t\tentityOwnershipLabel: \"owner\"\n\t\t\t});\n\t\t\thooks.set(codecId, hook);\n\t\t\towners.set(codecId, descriptor.id);\n\t\t}\n\t}\n\treturn hooks;\n}\n//#endregion\n//#region src/core/diff/verifier-disposition.ts\n/**\n* Classifies a codec `verifyType` hook finding into the target-neutral\n* categories the framework grades. A storage type is a named type instance\n* (e.g. a native enum); the only shape divergence it can carry is a change\n* to its value set, so a paired mismatch always classifies as `valueDrift`.\n*/\nfunction classifyStorageTypeDiffIssue(issue) {\n\tif (issueOutcome(issue) === \"not-found\") return \"declaredMissing\";\n\tif (issueOutcome(issue) === \"not-expected\") return \"extraAuxiliary\";\n\treturn \"valueDrift\";\n}\nfunction verifierDisposition(controlPolicy, issue) {\n\treturn dispositionForCategory(controlPolicy, classifyStorageTypeDiffIssue(issue));\n}\n//#endregion\n//#region src/core/diff/schema-verify.ts\nfunction issueNode(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\treturn blindCast(node);\n}\n/**\n* Resolves an issue's framework-neutral {@link DiffSubjectGranularity} on\n* demand, from the issue's node's `nodeKind` via the target-provided\n* `granularityOf` map. The node carries only its `nodeKind` identity, never a\n* classification, and nothing is stamped onto the issue — every consumer\n* (the family verdict below, the framework aggregate's unclaimed-elements\n* sweep via {@link import('@internal/framework-components/control').SchemaSubjectClassifierCapable})\n* calls this the same way, resolved by the family/target that owns the node\n* vocabulary. `undefined` for an issue with no node.\n*/\nfunction classifyDiffSubjectGranularity(issue, granularityOf) {\n\tconst node = issueNode(issue);\n\treturn node === void 0 ? void 0 : granularityOf(node.nodeKind);\n}\n/**\n* Resolves an issue's storage `entityKind` on demand, from the issue's\n* node's `nodeKind` via the target-provided `entityKindOf` map — the sibling\n* of {@link classifyDiffSubjectGranularity}, called the same way by the same\n* consumers (via\n* {@link import('@internal/framework-components/control').SchemaSubjectClassifierCapable}).\n* `undefined` for an issue with no node, or for a node kind with no storage\n* entity of its own.\n*/\nfunction classifyDiffEntityKind(issue, entityKindOf) {\n\tconst node = issueNode(issue);\n\treturn node === void 0 ? void 0 : entityKindOf(node.nodeKind);\n}\n/**\n* Re-keys the legacy `classifySqlVerifierIssueKind` category mapping on the\n* issue's {@link DiffSubjectGranularity} (resolved via `granularityOf`) + the\n* issue reason. The vocabulary maps one-to-one: an undeclared live entity or\n* namespace is `extraTopLevelObject`, an undeclared live field\n* `extraNestedElement`, undeclared auxiliaries (constraints, indexes,\n* defaults) and structural leaves (policies) `extraAuxiliary`; every paired\n* divergence is `declaredIncompatible`; anything the database lacks is\n* `declaredMissing`.\n* `granularityOf` is the target's classifier, so target and extension node\n* kinds classify without the family importing them.\n*/\nfunction classifySqlDiffIssue(issue, granularityOf) {\n\tif (issueOutcome(issue) === \"not-found\") return \"declaredMissing\";\n\tif (issueOutcome(issue) === \"not-expected\") {\n\t\tconst granularity = classifyDiffSubjectGranularity(issue, granularityOf);\n\t\tif (granularity === \"entity\" || granularity === \"namespace\") return \"extraTopLevelObject\";\n\t\tif (granularity === \"field\") return \"extraNestedElement\";\n\t\treturn \"extraAuxiliary\";\n\t}\n\treturn \"declaredIncompatible\";\n}\n/**\n* Whether a `not-expected` issue is a strict-mode-only finding. The legacy\n* walk detected every relational extra (namespaces, entities, fields, and\n* their auxiliaries) only under `--strict`; the structural diff (roots, RLS\n* policies, roles) was never strict-gated — its extras fail in both modes.\n* Keyed on the issue's granularity, resolved via `granularityOf`.\n*/\nfunction isStrictOnlyExtra(issue, granularityOf) {\n\tconst granularity = classifyDiffSubjectGranularity(issue, granularityOf);\n\treturn granularity === \"namespace\" || granularity === \"entity\" || granularity === \"field\" || granularity === \"auxiliary\";\n}\n/**\n* Applies the two consumer filters to a diff issue list: strict gating\n* (relational `not-expected` findings drop in lenient mode) and\n* control-policy disposition (each surviving issue grades against its\n* subject table's effective policy; suppressed issues drop, `observed`\n* subjects warn). The verify verdict is `failures.length === 0`.\n*/\nfunction computeSqlDiffVerdict(input) {\n\tconst failures = [];\n\tconst warnings = [];\n\tfor (const issue of input.issues) {\n\t\tif (!input.strict && issueOutcome(issue) === \"not-expected\" && isStrictOnlyExtra(issue, input.granularityOf)) continue;\n\t\tconst disposition = dispositionForCategory(effectiveControlPolicy(input.resolveControlPolicy(issue), input.defaultControlPolicy), classifySqlDiffIssue(issue, input.granularityOf));\n\t\tif (disposition === \"suppress\") continue;\n\t\tif (disposition === \"warn\") {\n\t\t\twarnings.push(issue);\n\t\t\tcontinue;\n\t\t}\n\t\tfailures.push(issue);\n\t}\n\treturn {\n\t\tfailures,\n\t\twarnings\n\t};\n}\nfunction computeStorageTypeVerdict(input) {\n\tconst failures = [];\n\tconst warnings = [];\n\tconst policy = effectiveControlPolicy(void 0, input.contract.defaultControlPolicy);\n\tfor (const pair of input.namespacePairs) {\n\t\tif (pair.actual === void 0) continue;\n\t\tfor (const [typeName, typeInstance] of Object.entries(input.contract.storage.types ?? {})) {\n\t\t\tif (!isStorageTypeInstance(typeInstance)) continue;\n\t\t\tconst hook = input.codecHooks.get(typeInstance.codecId);\n\t\t\tif (!hook?.verifyType) continue;\n\t\t\tconst typeIssues = hook.verifyType({\n\t\t\t\ttypeName,\n\t\t\t\ttypeInstance,\n\t\t\t\tschema: pair.actual\n\t\t\t});\n\t\t\tfor (const issue of typeIssues) {\n\t\t\t\tconst disposition = verifierDisposition(policy, issue);\n\t\t\t\tif (disposition === \"suppress\") continue;\n\t\t\t\tif (disposition === \"warn\") {\n\t\t\t\t\twarnings.push(issue);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tfailures.push(issue);\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\tfailures,\n\t\twarnings\n\t};\n}\n/**\n* THE SQL schema verify: runs the target's full-tree node diff, grades it\n* through the family's post-diff filters (strict gating + control-policy\n* disposition) plus the codec `verifyType` hook findings, and wraps the\n* verdict in the issue-based result envelope. `ok` holds exactly when both\n* issue lists are empty — the lists carry the verdict's failures.\n*/\nfunction verifySqlSchemaByDiff(input) {\n\tconst startTime = Date.now();\n\tconst verdictDiff = input.diffSchema({\n\t\tcontract: input.contract,\n\t\tschema: input.schema,\n\t\tframeworkComponents: input.frameworkComponents\n\t});\n\tconst diffVerdict = computeSqlDiffVerdict({\n\t\tissues: verdictDiff.issues,\n\t\tresolveControlPolicy: verdictDiff.resolveControlPolicy,\n\t\tstrict: input.strict,\n\t\tdefaultControlPolicy: input.contract.defaultControlPolicy,\n\t\tgranularityOf: input.granularityOf\n\t});\n\tconst storageTypeVerdict = computeStorageTypeVerdict({\n\t\tcontract: input.contract,\n\t\tnamespacePairs: verdictDiff.namespacePairs,\n\t\tcodecHooks: extractCodecControlHooks(input.frameworkComponents)\n\t});\n\tconst failCount = diffVerdict.failures.length + storageTypeVerdict.failures.length;\n\tconst ok = failCount === 0;\n\tconst profileHash = \"profileHash\" in input.contract && typeof input.contract.profileHash === \"string\" ? input.contract.profileHash : void 0;\n\treturn {\n\t\tok,\n\t\t...ok ? {} : { code: \"CONTRACT.SCHEMA_VERIFICATION_FAILED\" },\n\t\tsummary: ok ? \"Database schema satisfies contract\" : `Database schema does not satisfy contract (${failCount} failure${failCount === 1 ? \"\" : \"s\"})`,\n\t\tcontract: {\n\t\t\tstorageHash: input.contract.storage.storageHash,\n\t\t\t...ifDefined(\"profileHash\", profileHash)\n\t\t},\n\t\ttarget: {\n\t\t\texpected: input.contract.target,\n\t\t\tactual: input.contract.target\n\t\t},\n\t\tschema: {\n\t\t\tissues: [...diffVerdict.failures, ...storageTypeVerdict.failures],\n\t\t\twarnings: { issues: [...diffVerdict.warnings, ...storageTypeVerdict.warnings] }\n\t\t},\n\t\tmeta: { strict: input.strict },\n\t\ttimings: { total: Date.now() - startTime }\n\t};\n}\n//#endregion\nexport { computeStorageTypeVerdict as a, computeSqlDiffVerdict as i, classifyDiffSubjectGranularity as n, verifySqlSchemaByDiff as o, classifySqlDiffIssue as r, extractCodecControlHooks as s, classifyDiffEntityKind as t };\n\n//# sourceMappingURL=schema-verify-DI0aJQ9d.mjs.map"],"mappings":";;;;;;AAMA,SAAS,qBAAqB,YAAY;CACzC,IAAI,OAAO,eAAe,YAAY,eAAe,MAAM,OAAO;CAClE,MAAM,QAAQ,UAAU,UAAU,CAAC,CAAC,OAAO,YAAY;CACvD,OAAO,UAAU,QAAQ,UAAU,KAAK,KAAK,OAAO,UAAU;AAC/D;AACA,SAAS,yBAAyB,aAAa;CAC9C,MAAM,wBAAwB,IAAI,IAAI;CACtC,MAAM,yBAAyB,IAAI,IAAI;CACvC,KAAK,MAAM,cAAc,aAAa;EACrC,IAAI,OAAO,eAAe,YAAY,eAAe,MAAM;EAC3D,IAAI,CAAC,qBAAqB,UAAU,GAAG;EACvC,MAAM,oBAAoB,WAAW,MAAM,WAAW;EACtD,KAAK,MAAM,CAAC,SAAS,SAAS,OAAO,QAAQ,iBAAiB,GAAG;GAChE,uBAAuB;IACtB;IACA;IACA,cAAc,WAAW;IACzB,aAAa;IACb,sBAAsB;GACvB,CAAC;GACD,MAAM,IAAI,SAAS,IAAI;GACvB,OAAO,IAAI,SAAS,WAAW,EAAE;EAClC;CACD;CACA,OAAO;AACR;;;;;;;AASA,SAAS,6BAA6B,OAAO;CAC5C,IAAI,aAAa,KAAK,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,sBAAsB,MAAM,SAAS;EACrC,eAAe,MAAM;CACtB,CAAC;CACD,MAAM,qBAAqB,0BAA0B;EACpD,UAAU,MAAM;EAChB,gBAAgB,YAAY;EAC5B,YAAY,yBAAyB,MAAM,mBAAmB;CAC/D,CAAC;CACD,MAAM,YAAY,YAAY,SAAS,SAAS,mBAAmB,SAAS;CAC5E,MAAM,KAAK,cAAc;CACzB,MAAM,cAAc,iBAAiB,MAAM,YAAY,OAAO,MAAM,SAAS,gBAAgB,WAAW,MAAM,SAAS,cAAc,KAAK;CAC1I,OAAO;EACN;EACA,GAAG,KAAK,CAAC,IAAI,EAAE,MAAM,sCAAsC;EAC3D,SAAS,KAAK,uCAAuC,8CAA8C,UAAU,UAAU,cAAc,IAAI,KAAK,IAAI;EAClJ,UAAU;GACT,aAAa,MAAM,SAAS,QAAQ;GACpC,GAAG,UAAU,eAAe,WAAW;EACxC;EACA,QAAQ;GACP,UAAU,MAAM,SAAS;GACzB,QAAQ,MAAM,SAAS;EACxB;EACA,QAAQ;GACP,QAAQ,CAAC,GAAG,YAAY,UAAU,GAAG,mBAAmB,QAAQ;GAChE,UAAU,EAAE,QAAQ,CAAC,GAAG,YAAY,UAAU,GAAG,mBAAmB,QAAQ,EAAE;EAC/E;EACA,MAAM,EAAE,QAAQ,MAAM,OAAO;EAC7B,SAAS,EAAE,OAAO,KAAK,IAAI,IAAI,UAAU;CAC1C;AACD"}
|
|
1
|
+
{"version":3,"file":"schema-verify-DI0aJQ9d-TpdeERRD.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/schema-verify-DI0aJQ9d.mjs"],"sourcesContent":["import { assertUniqueCodecOwner, dispositionForCategory, issueOutcome } from \"@internal/framework-components/control\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { effectiveControlPolicy } from \"@internal/contract/types\";\nimport { isStorageTypeInstance } from \"@internal/sql-contract/types\";\n//#region src/core/assembly.ts\nfunction hasCodecControlHooks(descriptor) {\n\tif (typeof descriptor !== \"object\" || descriptor === null) return false;\n\tconst hooks = blindCast(descriptor).types?.codecTypes?.controlPlaneHooks;\n\treturn hooks !== null && hooks !== void 0 && typeof hooks === \"object\";\n}\nfunction extractCodecControlHooks(descriptors) {\n\tconst hooks = /* @__PURE__ */ new Map();\n\tconst owners = /* @__PURE__ */ new Map();\n\tfor (const descriptor of descriptors) {\n\t\tif (typeof descriptor !== \"object\" || descriptor === null) continue;\n\t\tif (!hasCodecControlHooks(descriptor)) continue;\n\t\tconst controlPlaneHooks = descriptor.types.codecTypes.controlPlaneHooks;\n\t\tfor (const [codecId, hook] of Object.entries(controlPlaneHooks)) {\n\t\t\tassertUniqueCodecOwner({\n\t\t\t\tcodecId,\n\t\t\t\towners,\n\t\t\t\tdescriptorId: descriptor.id,\n\t\t\t\tentityLabel: \"control hooks\",\n\t\t\t\tentityOwnershipLabel: \"owner\"\n\t\t\t});\n\t\t\thooks.set(codecId, hook);\n\t\t\towners.set(codecId, descriptor.id);\n\t\t}\n\t}\n\treturn hooks;\n}\n//#endregion\n//#region src/core/diff/verifier-disposition.ts\n/**\n* Classifies a codec `verifyType` hook finding into the target-neutral\n* categories the framework grades. A storage type is a named type instance\n* (e.g. a native enum); the only shape divergence it can carry is a change\n* to its value set, so a paired mismatch always classifies as `valueDrift`.\n*/\nfunction classifyStorageTypeDiffIssue(issue) {\n\tif (issueOutcome(issue) === \"not-found\") return \"declaredMissing\";\n\tif (issueOutcome(issue) === \"not-expected\") return \"extraAuxiliary\";\n\treturn \"valueDrift\";\n}\nfunction verifierDisposition(controlPolicy, issue) {\n\treturn dispositionForCategory(controlPolicy, classifyStorageTypeDiffIssue(issue));\n}\n//#endregion\n//#region src/core/diff/schema-verify.ts\nfunction issueNode(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\treturn blindCast(node);\n}\n/**\n* Resolves an issue's framework-neutral {@link DiffSubjectGranularity} on\n* demand, from the issue's node's `nodeKind` via the target-provided\n* `granularityOf` map. The node carries only its `nodeKind` identity, never a\n* classification, and nothing is stamped onto the issue — every consumer\n* (the family verdict below, the framework aggregate's unclaimed-elements\n* sweep via {@link import('@internal/framework-components/control').SchemaSubjectClassifierCapable})\n* calls this the same way, resolved by the family/target that owns the node\n* vocabulary. `undefined` for an issue with no node.\n*/\nfunction classifyDiffSubjectGranularity(issue, granularityOf) {\n\tconst node = issueNode(issue);\n\treturn node === void 0 ? void 0 : granularityOf(node.nodeKind);\n}\n/**\n* Resolves an issue's storage `entityKind` on demand, from the issue's\n* node's `nodeKind` via the target-provided `entityKindOf` map — the sibling\n* of {@link classifyDiffSubjectGranularity}, called the same way by the same\n* consumers (via\n* {@link import('@internal/framework-components/control').SchemaSubjectClassifierCapable}).\n* `undefined` for an issue with no node, or for a node kind with no storage\n* entity of its own.\n*/\nfunction classifyDiffEntityKind(issue, entityKindOf) {\n\tconst node = issueNode(issue);\n\treturn node === void 0 ? void 0 : entityKindOf(node.nodeKind);\n}\n/**\n* Re-keys the legacy `classifySqlVerifierIssueKind` category mapping on the\n* issue's {@link DiffSubjectGranularity} (resolved via `granularityOf`) + the\n* issue reason. The vocabulary maps one-to-one: an undeclared live entity or\n* namespace is `extraTopLevelObject`, an undeclared live field\n* `extraNestedElement`, undeclared auxiliaries (constraints, indexes,\n* defaults) and structural leaves (policies) `extraAuxiliary`; every paired\n* divergence is `declaredIncompatible`; anything the database lacks is\n* `declaredMissing`.\n* `granularityOf` is the target's classifier, so target and extension node\n* kinds classify without the family importing them.\n*/\nfunction classifySqlDiffIssue(issue, granularityOf) {\n\tif (issueOutcome(issue) === \"not-found\") return \"declaredMissing\";\n\tif (issueOutcome(issue) === \"not-expected\") {\n\t\tconst granularity = classifyDiffSubjectGranularity(issue, granularityOf);\n\t\tif (granularity === \"entity\" || granularity === \"namespace\") return \"extraTopLevelObject\";\n\t\tif (granularity === \"field\") return \"extraNestedElement\";\n\t\treturn \"extraAuxiliary\";\n\t}\n\treturn \"declaredIncompatible\";\n}\n/**\n* Whether a `not-expected` issue is a strict-mode-only finding. The legacy\n* walk detected every relational extra (namespaces, entities, fields, and\n* their auxiliaries) only under `--strict`; the structural diff (roots, RLS\n* policies, roles) was never strict-gated — its extras fail in both modes.\n* Keyed on the issue's granularity, resolved via `granularityOf`.\n*/\nfunction isStrictOnlyExtra(issue, granularityOf) {\n\tconst granularity = classifyDiffSubjectGranularity(issue, granularityOf);\n\treturn granularity === \"namespace\" || granularity === \"entity\" || granularity === \"field\" || granularity === \"auxiliary\";\n}\n/**\n* Applies the two consumer filters to a diff issue list: strict gating\n* (relational `not-expected` findings drop in lenient mode) and\n* control-policy disposition (each surviving issue grades against its\n* subject table's effective policy; suppressed issues drop, `observed`\n* subjects warn). The verify verdict is `failures.length === 0`.\n*/\nfunction computeSqlDiffVerdict(input) {\n\tconst failures = [];\n\tconst warnings = [];\n\tfor (const issue of input.issues) {\n\t\tif (!input.strict && issueOutcome(issue) === \"not-expected\" && isStrictOnlyExtra(issue, input.granularityOf)) continue;\n\t\tconst disposition = dispositionForCategory(effectiveControlPolicy(input.resolveControlPolicy(issue), input.defaultControlPolicy), classifySqlDiffIssue(issue, input.granularityOf));\n\t\tif (disposition === \"suppress\") continue;\n\t\tif (disposition === \"warn\") {\n\t\t\twarnings.push(issue);\n\t\t\tcontinue;\n\t\t}\n\t\tfailures.push(issue);\n\t}\n\treturn {\n\t\tfailures,\n\t\twarnings\n\t};\n}\nfunction computeStorageTypeVerdict(input) {\n\tconst failures = [];\n\tconst warnings = [];\n\tconst policy = effectiveControlPolicy(void 0, input.contract.defaultControlPolicy);\n\tfor (const pair of input.namespacePairs) {\n\t\tif (pair.actual === void 0) continue;\n\t\tfor (const [typeName, typeInstance] of Object.entries(input.contract.storage.types ?? {})) {\n\t\t\tif (!isStorageTypeInstance(typeInstance)) continue;\n\t\t\tconst hook = input.codecHooks.get(typeInstance.codecId);\n\t\t\tif (!hook?.verifyType) continue;\n\t\t\tconst typeIssues = hook.verifyType({\n\t\t\t\ttypeName,\n\t\t\t\ttypeInstance,\n\t\t\t\tschema: pair.actual\n\t\t\t});\n\t\t\tfor (const issue of typeIssues) {\n\t\t\t\tconst disposition = verifierDisposition(policy, issue);\n\t\t\t\tif (disposition === \"suppress\") continue;\n\t\t\t\tif (disposition === \"warn\") {\n\t\t\t\t\twarnings.push(issue);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tfailures.push(issue);\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\tfailures,\n\t\twarnings\n\t};\n}\n/**\n* THE SQL schema verify: runs the target's full-tree node diff, grades it\n* through the family's post-diff filters (strict gating + control-policy\n* disposition) plus the codec `verifyType` hook findings, and wraps the\n* verdict in the issue-based result envelope. `ok` holds exactly when both\n* issue lists are empty — the lists carry the verdict's failures.\n*/\nfunction verifySqlSchemaByDiff(input) {\n\tconst startTime = Date.now();\n\tconst verdictDiff = input.diffSchema({\n\t\tcontract: input.contract,\n\t\tschema: input.schema,\n\t\tframeworkComponents: input.frameworkComponents\n\t});\n\tconst diffVerdict = computeSqlDiffVerdict({\n\t\tissues: verdictDiff.issues,\n\t\tresolveControlPolicy: verdictDiff.resolveControlPolicy,\n\t\tstrict: input.strict,\n\t\tdefaultControlPolicy: input.contract.defaultControlPolicy,\n\t\tgranularityOf: input.granularityOf\n\t});\n\tconst storageTypeVerdict = computeStorageTypeVerdict({\n\t\tcontract: input.contract,\n\t\tnamespacePairs: verdictDiff.namespacePairs,\n\t\tcodecHooks: extractCodecControlHooks(input.frameworkComponents)\n\t});\n\tconst failCount = diffVerdict.failures.length + storageTypeVerdict.failures.length;\n\tconst ok = failCount === 0;\n\tconst profileHash = \"profileHash\" in input.contract && typeof input.contract.profileHash === \"string\" ? input.contract.profileHash : void 0;\n\treturn {\n\t\tok,\n\t\t...ok ? {} : { code: \"CONTRACT.SCHEMA_VERIFICATION_FAILED\" },\n\t\tsummary: ok ? \"Database schema satisfies contract\" : `Database schema does not satisfy contract (${failCount} failure${failCount === 1 ? \"\" : \"s\"})`,\n\t\tcontract: {\n\t\t\tstorageHash: input.contract.storage.storageHash,\n\t\t\t...ifDefined(\"profileHash\", profileHash)\n\t\t},\n\t\ttarget: {\n\t\t\texpected: input.contract.target,\n\t\t\tactual: input.contract.target\n\t\t},\n\t\tschema: {\n\t\t\tissues: [...diffVerdict.failures, ...storageTypeVerdict.failures],\n\t\t\twarnings: { issues: [...diffVerdict.warnings, ...storageTypeVerdict.warnings] }\n\t\t},\n\t\tmeta: { strict: input.strict },\n\t\ttimings: { total: Date.now() - startTime }\n\t};\n}\n//#endregion\nexport { computeStorageTypeVerdict as a, computeSqlDiffVerdict as i, classifyDiffSubjectGranularity as n, verifySqlSchemaByDiff as o, classifySqlDiffIssue as r, extractCodecControlHooks as s, classifyDiffEntityKind as t };\n\n//# sourceMappingURL=schema-verify-DI0aJQ9d.mjs.map"],"mappings":";;;;;;AAMA,SAAS,qBAAqB,YAAY;CACzC,IAAI,OAAO,eAAe,YAAY,eAAe,MAAM,OAAO;CAClE,MAAM,QAAQ,UAAU,UAAU,CAAC,CAAC,OAAO,YAAY;CACvD,OAAO,UAAU,QAAQ,UAAU,KAAK,KAAK,OAAO,UAAU;AAC/D;AACA,SAAS,yBAAyB,aAAa;CAC9C,MAAM,wBAAwB,IAAI,IAAI;CACtC,MAAM,yBAAyB,IAAI,IAAI;CACvC,KAAK,MAAM,cAAc,aAAa;EACrC,IAAI,OAAO,eAAe,YAAY,eAAe,MAAM;EAC3D,IAAI,CAAC,qBAAqB,UAAU,GAAG;EACvC,MAAM,oBAAoB,WAAW,MAAM,WAAW;EACtD,KAAK,MAAM,CAAC,SAAS,SAAS,OAAO,QAAQ,iBAAiB,GAAG;GAChE,uBAAuB;IACtB;IACA;IACA,cAAc,WAAW;IACzB,aAAa;IACb,sBAAsB;GACvB,CAAC;GACD,MAAM,IAAI,SAAS,IAAI;GACvB,OAAO,IAAI,SAAS,WAAW,EAAE;EAClC;CACD;CACA,OAAO;AACR;;;;;;;AASA,SAA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ACpB,sBAAsB,YAAY;EAClC,QAAQ,MAAM;EACd,sBAAsB,MAAM,SAAS;EACrC,eAAe,MAAM;CACtB,CAAC;CACD,MAAM,qBAAqB,0BAA0B;EACpD,UAAU,MAAM;EAChB,gBAAgB,YAAY;EAC5B,YAAY,yBAAyB,MAAM,mBAAmB;CAC/D,CAAC;CACD,MAAM,YAAY,YAAY,SAAS,SAAS,mBAAmB,SAAS;CAC5E,MAAM,KAAK,cAAc;CACzB,MAAM,cAAc,iBAAiB,MAAM,YAAY,OAAO,MAAM,SAAS,gBAAgB,WAAW,MAAM,SAAS,cAAc,KAAK;CAC1I,OAAO;EACN;EACA,GAAG,KAAK,CAAC,IAAI,EAAE,MAAM,sCAAsC;EAC3D,SAAS,KAAK,uCAAuC,8CAA8C,UAAU,UAAU,cAAc,IAAI,KAAK,IAAI;EAClJ,UAAU;GACT,aAAa,MAAM,SAAS,QAAQ;GACpC,GAAG,UAAU,eAAe,WAAW;EACxC;EACA,QAAQ;GACP,UAAU,MAAM,SAAS;GACzB,QAAQ,MAAM,SAAS;EACxB;EACA,QAAQ;GACP,QAAQ,CAAC,GAAG,YAAY,UAAU,GAAG,mBAAmB,QAAQ;GAChE,UAAU,EAAE,QAAQ,CAAC,GAAG,YAAY,UAAU,GAAG,mBAAmB,QAAQ,EAAE;EAC/E;EACA,MAAM,EAAE,QAAQ,MAAM,OAAO;EAC7B,SAAS,EAAE,OAAO,KAAK,IAAI,IAAI,UAAU;CAC1C;AACD"}
|
package/dist/{serialized-index-nBTwanKy-B0C03Q_R.mjs → serialized-index-B5X7s-oX-TKQhXsZz.mjs}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { m as parseNaming } from "./naming-Cc_t1q6s-CouBOmqZ.mjs";
|
|
2
|
-
import { o as SqlNode } from "./storage-table-
|
|
2
|
+
import { o as SqlNode } from "./storage-table-ADhJ4Imk-0FbJXvSZ.mjs";
|
|
3
3
|
import { ContractValidationError } from "@prisma/orm-framework/contract/contract-validation-error";
|
|
4
4
|
import { freezeNode } from "@prisma/orm-framework/components/ir";
|
|
5
|
-
//#region ../../../2-sql/1-core/contract/dist/serialized-index-
|
|
5
|
+
//#region ../../../2-sql/1-core/contract/dist/serialized-index-B5X7s-oX.mjs
|
|
6
6
|
/**
|
|
7
7
|
* SQL Contract IR node for a value-set entry in a namespace's `valueSet`
|
|
8
8
|
* map (`SqlNamespace.entries.valueSet`).
|
|
@@ -71,4 +71,4 @@ function indexInputFromSerialized(flat) {
|
|
|
71
71
|
//#endregion
|
|
72
72
|
export { isStorageValueSet as i, checkConstraintInputFromSerialized as n, indexInputFromSerialized as r, StorageValueSet as t };
|
|
73
73
|
|
|
74
|
-
//# sourceMappingURL=serialized-index-
|
|
74
|
+
//# sourceMappingURL=serialized-index-B5X7s-oX-TKQhXsZz.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialized-index-
|
|
1
|
+
{"version":3,"file":"serialized-index-B5X7s-oX-TKQhXsZz.mjs","names":[],"sources":["../../../../2-sql/1-core/contract/dist/serialized-index-B5X7s-oX.mjs"],"sourcesContent":["import { l as SqlNode } from \"./storage-table-ADhJ4Imk.mjs\";\nimport { parseNaming } from \"@internal/sql-schema-ir/naming\";\nimport { freezeNode } from \"@internal/framework-components/ir\";\nimport { ContractValidationError } from \"@internal/contract/contract-validation-error\";\n//#region src/ir/storage-value-set.ts\n/**\n* SQL Contract IR node for a value-set entry in a namespace's `valueSet`\n* map (`SqlNamespace.entries.valueSet`).\n*\n* A value-set records the ordered set of permitted codec-encoded values for\n* an enum-like column restriction. It does not carry a `codecId` — the\n* column that references it already holds the codec; the value-set holds\n* only the permitted values.\n*\n* The node's `kind` is enumerable (`'valueSet'`) so the JSON envelope\n* carries the discriminator and the serializer hydration walker can\n* dispatch on it. This follows the per-leaf enumerable-kind convention\n* established in the SQL-node comment (future polymorphic dispatch on\n* namespace entries needs the discriminator in JSON).\n*\n* The entry's name is not on the class — value-sets are keyed by name in\n* the parent namespace's `valueSet: Record<string, StorageValueSet>` map.\n*/\nvar StorageValueSet = class extends SqlNode {\n\tkind = \"valueSet\";\n\tvalues;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.values = Object.freeze([...input.values]);\n\t\tfreezeNode(this);\n\t}\n};\nfunction isStorageValueSet(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\treturn \"kind\" in value && value.kind === \"valueSet\" && \"values\" in value;\n}\n//#endregion\n//#region src/serialized-check-constraint.ts\n/**\n* Hydrates one stored check constraint into constructor input. `parseNaming`\n* is what rejects a hand-edited file whose `prefix` and `name` disagree.\n*/\nfunction checkConstraintInputFromSerialized(flat) {\n\treturn {\n\t\tnaming: parseNaming(flat.name, flat.prefix),\n\t\texpression: flat.expression\n\t};\n}\n//#endregion\n//#region src/serialized-index.ts\n/**\n* Hydrates one stored index into constructor input. The parameter is typed\n* but the values are whatever the file held, so each field the union depends\n* on is checked here rather than downstream — by the time `Index` sees the\n* data it is already a valid union.\n*/\nfunction indexInputFromSerialized(flat) {\n\tif (flat.name === void 0 || flat.name.length === 0) throw new ContractValidationError(\"Index: every index carries a full physical name; an expression index must be explicitly named (a default name cannot be derived from an expression).\", \"storage\");\n\tif (flat.columns === void 0 === (flat.expression === void 0)) throw new ContractValidationError(`Index \"${flat.name}\": exactly one of columns or expression must be set.`, \"storage\");\n\tconst carried = {\n\t\tnaming: parseNaming(flat.name, flat.prefix),\n\t\twhere: flat.where,\n\t\tunique: flat.unique,\n\t\ttype: flat.type,\n\t\toptions: flat.options\n\t};\n\treturn flat.expression !== void 0 ? {\n\t\t...carried,\n\t\texpression: flat.expression\n\t} : {\n\t\t...carried,\n\t\tcolumns: flat.columns ?? []\n\t};\n}\n//#endregion\nexport { isStorageValueSet as i, checkConstraintInputFromSerialized as n, StorageValueSet as r, indexInputFromSerialized as t };\n\n//# sourceMappingURL=serialized-index-B5X7s-oX.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAI,kBAAkB,cAAc,QAAQ;CAC3C,OAAO;CACP;CACA,YAAY,OAAO;EAClB,MAAM;EACN,KAAK,SAAS,OAAO,OAAO,CAAC,GAAG,MAAM,MAAM,CAAC;EAC7C,WAAW,IAAI;CAChB;AACD;AACA,SAAS,kBAAkB,OAAO;CACjC,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CACxD,OAAO,UAAU,SAAS,MAAM,SAAS,cAAc,YAAY;AACpE;;;;;AAOA,SAAS,mCAAmC,MAAM;CACjD,OAAO;EACN,QAAQ,YAAY,KAAK,MAAM,KAAK,MAAM;EAC1C,YAAY,KAAK;CAClB;AACD;;;;;;;AASA,SAAS,yBAAyB,MAAM;CACvC,IAAI,KAAK,SAAS,KAAK,KAAK,KAAK,KAAK,WAAW,GAAG,MAAM,IAAI,wBAAwB,wJAAwJ,SAAS;CACvP,IAAI,KAAK,YAAY,KAAK,OAAO,KAAK,eAAe,KAAK,IAAI,MAAM,IAAI,wBAAwB,UAAU,KAAK,KAAK,uDAAuD,SAAS;CACpL,MAAM,UAAU;EACf,QAAQ,YAAY,KAAK,MAAM,KAAK,MAAM;EAC1C,OAAO,KAAK;EACZ,QAAQ,KAAK;EACb,MAAM,KAAK;EACX,SAAS,KAAK;CACf;CACA,OAAO,KAAK,eAAe,KAAK,IAAI;EACnC,GAAG;EACH,YAAY,KAAK;CAClB,IAAI;EACH,GAAG;EACH,SAAS,KAAK,WAAW,CAAC;CAC3B;AACD"}
|
package/dist/{sql-attribute-specs-Bs9QDuS7-DmIRJUz9.mjs → sql-attribute-specs-DxpHr9Fk-CeWmMP7y.mjs}
RENAMED
|
@@ -2,9 +2,9 @@ import { isAuthoringFieldPresetDescriptor } from "@prisma/orm-framework/componen
|
|
|
2
2
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
3
3
|
import { FunctionCallAst } from "@prisma/orm-framework/psl-parser/syntax";
|
|
4
4
|
import { assertDefined } from "@prisma/orm-framework/utils/assertions";
|
|
5
|
-
import { notOk } from "@prisma/orm-framework/utils/result";
|
|
5
|
+
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
6
6
|
import { bool, createBinder, diagnosticSource, entityRef, fieldAttribute, fieldRef, funcCall, identifier, interpretAttribute, leafDiagnostic, list, modelAttribute, nodePslSpan, numLiteral, oneOf, optional, record, referencedFieldRef, str, taggedLiteral } from "@prisma/orm-framework/psl-parser";
|
|
7
|
-
//#region ../../../2-sql/2-authoring/contract-psl/dist/sql-attribute-specs-
|
|
7
|
+
//#region ../../../2-sql/2-authoring/contract-psl/dist/sql-attribute-specs-DxpHr9Fk.mjs
|
|
8
8
|
function formatSupportedFunctionList(registry) {
|
|
9
9
|
const signatures = Array.from(registry.entries()).sort(([a], [b]) => a.localeCompare(b)).flatMap(([functionName, entry]) => {
|
|
10
10
|
const usageSignatures = entry.usageSignatures?.filter((signature) => signature.length > 0);
|
|
@@ -179,6 +179,17 @@ const mapFieldSpec = fieldAttribute("map", {
|
|
|
179
179
|
}],
|
|
180
180
|
refine: validateMappedName
|
|
181
181
|
});
|
|
182
|
+
function nullLiteral() {
|
|
183
|
+
const nullIdentifier = identifier("null", { documentation: "A null list element or nullable scalar default." });
|
|
184
|
+
return {
|
|
185
|
+
kind: "null",
|
|
186
|
+
label: "null",
|
|
187
|
+
parse: (arg, ctx) => {
|
|
188
|
+
const result = nullIdentifier.parse(arg, ctx);
|
|
189
|
+
return result.ok ? ok(null) : result;
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
}
|
|
182
193
|
function scalarDefaultArms(isList, registries) {
|
|
183
194
|
const tagsByDocumentation = /* @__PURE__ */ new Map();
|
|
184
195
|
for (const entry of Object.values(registries.dataTypeEntries)) {
|
|
@@ -188,7 +199,7 @@ function scalarDefaultArms(isList, registries) {
|
|
|
188
199
|
else tags.push(entry.written.tag);
|
|
189
200
|
}
|
|
190
201
|
const tagArms = () => [...tagsByDocumentation].map(([documentation, tags]) => taggedLiteral(tags, { documentation }));
|
|
191
|
-
const literal = () => oneOf(str(), numLiteral(), bool(), ...tagArms());
|
|
202
|
+
const literal = () => oneOf(str(), numLiteral(), bool(), nullLiteral(), ...tagArms());
|
|
192
203
|
const listArm = () => list(literal(), { label: `list of (${literal().label})` });
|
|
193
204
|
const funcArms = [...registries.defaultFunctionRegistry.entries()].map(([name, entry]) => funcCall(name, blindCast(entry.signature)));
|
|
194
205
|
return isList ? [
|
|
@@ -199,6 +210,7 @@ function scalarDefaultArms(isList, registries) {
|
|
|
199
210
|
str(),
|
|
200
211
|
numLiteral(),
|
|
201
212
|
bool(),
|
|
213
|
+
nullLiteral(),
|
|
202
214
|
...funcArms,
|
|
203
215
|
...tagArms(),
|
|
204
216
|
listArm()
|
|
@@ -209,7 +221,7 @@ function scalarDefaultArms(isList, registries) {
|
|
|
209
221
|
* are tried, so the author is told what replaced it instead of being shown the list of arms.
|
|
210
222
|
*/
|
|
211
223
|
function defaultValueArm(arms, registry) {
|
|
212
|
-
const value = oneOf(...arms);
|
|
224
|
+
const value = arms.length === 1 && arms[0].kind === "list" ? arms[0] : oneOf(...arms);
|
|
213
225
|
return {
|
|
214
226
|
...value,
|
|
215
227
|
parse: (arg, ctx) => FunctionCallAst.cast(arg.syntax)?.path().join(".") === "dbgenerated" ? notOk([leafDiagnostic(ctx, arg, removedDbgeneratedMessage(registry), "PSL_UNKNOWN_DEFAULT_FUNCTION")]) : value.parse(arg, ctx)
|
|
@@ -236,10 +248,11 @@ function enumMemberNames(ctx) {
|
|
|
236
248
|
}
|
|
237
249
|
return names;
|
|
238
250
|
}
|
|
239
|
-
function enumDefaultArms(members, enumName) {
|
|
251
|
+
function enumDefaultArms(members, enumName, isList) {
|
|
240
252
|
const [first, ...rest] = members;
|
|
241
253
|
if (first === void 0) return [noEnumMember()];
|
|
242
254
|
const member = (name) => identifier(name, { documentation: `The \`${name}\` member of enum \`${enumName}\`.` });
|
|
255
|
+
if (isList) return [list(oneOf(member(first), ...rest.map(member), nullLiteral()))];
|
|
243
256
|
return [member(first), ...rest.map(member)];
|
|
244
257
|
}
|
|
245
258
|
function defaultFieldSpec(ctx) {
|
|
@@ -248,7 +261,7 @@ function defaultFieldSpec(ctx) {
|
|
|
248
261
|
documentation: "Supplies a default value when this field is omitted from a mutation.",
|
|
249
262
|
positional: [{
|
|
250
263
|
key: "value",
|
|
251
|
-
type: defaultValueArm(members === void 0 ? scalarDefaultArms(ctx.field.list, ctx.controlMutationDefaults) : enumDefaultArms(members, ctx.field.typeName), ctx.controlMutationDefaults.defaultFunctionRegistry),
|
|
264
|
+
type: defaultValueArm(members === void 0 ? scalarDefaultArms(ctx.field.list, ctx.controlMutationDefaults) : enumDefaultArms(members, ctx.field.typeName, ctx.field.list), ctx.controlMutationDefaults.defaultFunctionRegistry),
|
|
252
265
|
documentation: "A literal, enum member, or registered default function compatible with this field."
|
|
253
266
|
}]
|
|
254
267
|
});
|
|
@@ -527,4 +540,4 @@ const sqlAttributeSpecs = {
|
|
|
527
540
|
//#endregion
|
|
528
541
|
export { getAttribute as a, interpretModelAttribute as c, modelAttributeSpecsFrom as d, sqlAttributeSpecs as f, formatDbAttributeMigrationMessage as i, lowerDefaultFunctionWithRegistry as l, createSqlBinder as n, getNamedArgument as o, storageName as p, fieldSpecContext as r, interpretFieldAttribute as s, PSL_CHECK_ON_STI_VARIANT as t, mapFieldNamesToColumns as u };
|
|
529
542
|
|
|
530
|
-
//# sourceMappingURL=sql-attribute-specs-
|
|
543
|
+
//# sourceMappingURL=sql-attribute-specs-DxpHr9Fk-CeWmMP7y.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-attribute-specs-DxpHr9Fk-CeWmMP7y.mjs","names":[],"sources":["../../../../2-sql/2-authoring/contract-psl/dist/sql-attribute-specs-DxpHr9Fk.mjs"],"sourcesContent":["import { isAuthoringFieldPresetDescriptor } from \"@internal/framework-components/authoring\";\nimport { bool, createBinder, diagnosticSource, entityRef, fieldAttribute, fieldRef, funcCall, identifier, interpretAttribute, leafDiagnostic, list, modelAttribute, nodePslSpan, numLiteral, oneOf, optional, record, referencedFieldRef, str, taggedLiteral } from \"@internal/psl-parser\";\nimport { FunctionCallAst } from \"@internal/psl-parser/syntax\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { assertDefined } from \"@internal/utils/assertions\";\n//#region src/default-function-registry.ts\nfunction formatSupportedFunctionList(registry) {\n\tconst signatures = Array.from(registry.entries()).sort(([a], [b]) => a.localeCompare(b)).flatMap(([functionName, entry]) => {\n\t\tconst usageSignatures = entry.usageSignatures?.filter((signature) => signature.length > 0);\n\t\treturn usageSignatures && usageSignatures.length > 0 ? usageSignatures : [`${functionName}()`];\n\t});\n\treturn signatures.length > 0 ? signatures.join(\", \") : \"none\";\n}\n/** The diagnostic message for a `dbgenerated(...)` call, which raw SQL tagged literals replaced. */\nfunction removedDbgeneratedMessage(registry) {\n\treturn `Default function \"dbgenerated\" was removed. Write the SQL as a tagged literal: @default(sql\\`<expression>\\`). Supported functions: ${formatSupportedFunctionList(registry)}.`;\n}\nfunction lowerDefaultFunctionWithRegistry(input) {\n\tconst entry = input.registry.get(input.call.fn);\n\tif (entry) {\n\t\tconst result = entry.lower({\n\t\t\tcall: input.call,\n\t\t\tcontext: input.context\n\t\t});\n\t\treturn result.ok ? result : {\n\t\t\t...result,\n\t\t\tkind: \"external\"\n\t\t};\n\t}\n\tconst supportedFunctionList = formatSupportedFunctionList(input.registry);\n\treturn {\n\t\tok: false,\n\t\tkind: \"owned\",\n\t\tdiagnostic: {\n\t\t\tcode: \"PSL_UNKNOWN_DEFAULT_FUNCTION\",\n\t\t\tmessage: `Default function \"${input.call.fn}\" is not supported in SQL PSL provider v1. Supported functions: ${supportedFunctionList}.`,\n\t\t\t...input.source.at(input.call.span)\n\t\t}\n\t};\n}\n//#endregion\n//#region src/psl-attribute-parsing.ts\nfunction storageName(symbol, physicalNames) {\n\tconst name = physicalNames.get(symbol);\n\tassertDefined(name, \"Physical names are populated for every model and field before lowering\");\n\treturn name;\n}\nfunction getAttribute(attributes, name) {\n\treturn attributes?.find((attribute) => attribute.name === name);\n}\nfunction formatDbAttributeMigrationMessage(attribute) {\n\tconst renderedArguments = attribute.args.map((argument) => argument.kind === \"named\" && argument.name !== void 0 ? `${argument.name}: ${argument.value}` : argument.value).join(\", \");\n\tconst argumentList = attribute.args.length === 0 ? \"\" : `(${renderedArguments})`;\n\tconst constructorName = attribute.name.slice(3);\n\treturn `@${attribute.name}${argumentList} is no longer supported; use ${constructorName}${argumentList} in type position`;\n}\nfunction getNamedArgument(attribute, name) {\n\tconst entry = attribute.args.find((arg) => arg.kind === \"named\" && arg.name === name);\n\tif (entry?.kind !== \"named\") return;\n\treturn entry.value;\n}\nfunction mapFieldNamesToColumns(input) {\n\tconst columns = [];\n\tfor (const fieldName of input.fieldNames) {\n\t\tconst field = input.model.fields[fieldName];\n\t\tif (field === void 0) {\n\t\t\tinput.diagnostics.push({\n\t\t\t\tcode: \"PSL_INVALID_ATTRIBUTE_ARGUMENT\",\n\t\t\t\tmessage: `${input.entityLabel} references unknown field \"${input.model.name}.${fieldName}\"`,\n\t\t\t\t...input.source.at(input.span)\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tcolumns.push(storageName(field, input.physicalNames));\n\t}\n\treturn columns;\n}\n//#endregion\n//#region src/sql-attribute-specs.ts\nfunction buildModelAttributeCtx(input) {\n\treturn {\n\t\tsources: input.sources,\n\t\tselfModel: input.selfModel,\n\t\tbinder: input.binder,\n\t\tsymbols: input.symbols\n\t};\n}\nfunction buildFieldAttributeCtx(input) {\n\treturn {\n\t\tsources: input.sources,\n\t\tselfModel: input.selfModel,\n\t\tfield: input.field,\n\t\tbinder: input.binder,\n\t\tsymbols: input.symbols\n\t};\n}\nfunction fieldPresetsAsTypeNames(namespace) {\n\tif (namespace === void 0) return {};\n\tconst result = {};\n\tfor (const [name, value] of Object.entries(namespace)) result[name] = isAuthoringFieldPresetDescriptor(value) ? {\n\t\tkind: \"typeConstructor\",\n\t\toutput: { codecId: value.output.codecId }\n\t} : fieldPresetsAsTypeNames(value);\n\treturn result;\n}\nfunction modelAttributeSpecsFrom(modelAttributesByName) {\n\tconst result = Object.create(null);\n\tfor (const [name, descriptor] of modelAttributesByName) result[name] = blindCast(descriptor.spec);\n\treturn result;\n}\nfunction createSqlBinder(input) {\n\tconst scalars = {};\n\tfor (const [name, descriptor] of input.scalarColumnDescriptors ?? []) scalars[name] = {\n\t\tkind: \"typeConstructor\",\n\t\toutput: { codecId: descriptor.codecId }\n\t};\n\treturn createBinder({\n\t\tsources: input.sources,\n\t\tsymbolTable: input.symbolTable,\n\t\t...input.pslBlockDescriptors === void 0 ? {} : { pslBlockDescriptors: input.pslBlockDescriptors },\n\t\ttypeConstructors: {\n\t\t\t...scalars,\n\t\t\t...fieldPresetsAsTypeNames(input.authoringContributions?.field),\n\t\t\t...input.authoringContributions?.type ?? {}\n\t\t},\n\t\tattributeSpecs: {\n\t\t\tmodel: Object.assign(Object.create(null), sqlAttributeSpecs.model, input.contributedModelAttributeSpecs),\n\t\t\tfield: sqlAttributeSpecs.field\n\t\t},\n\t\tcontrolMutationDefaults: input.controlMutationDefaults ?? {\n\t\t\tdefaultFunctionRegistry: /* @__PURE__ */ new Map(),\n\t\t\tdataTypeEntries: {}\n\t\t},\n\t\tdescribeUnsupportedAttribute: input.describeUnsupportedAttribute\n\t});\n}\nfunction interpretModelAttribute(input) {\n\tconst result = interpretAttribute(input.node, input.spec, buildModelAttributeCtx({\n\t\tsymbols: input.symbols,\n\t\tselfModel: input.model,\n\t\tsources: input.sources,\n\t\tbinder: input.binder\n\t}));\n\tif (!result.ok) {\n\t\tinput.diagnostics.push(...result.failure);\n\t\treturn;\n\t}\n\treturn result.value;\n}\nfunction interpretFieldAttribute(input) {\n\tconst result = interpretAttribute(input.node, input.spec, buildFieldAttributeCtx({\n\t\tsymbols: input.symbols,\n\t\tselfModel: input.model,\n\t\tfield: input.field,\n\t\tsources: input.sources,\n\t\tbinder: input.binder\n\t}));\n\tif (!result.ok) {\n\t\tinput.diagnostics.push(...result.failure);\n\t\treturn;\n\t}\n\treturn result.value;\n}\nfunction validateMappedName(value, ctx, attributeNode) {\n\treturn value.name === \"\" ? [leafDiagnostic(ctx, attributeNode, \"Mapped name must not be empty\")] : [];\n}\nconst mapModelSpec = modelAttribute(\"map\", {\n\tdocumentation: \"Maps this model to a database table name.\",\n\tpositional: [{\n\t\tkey: \"name\",\n\t\ttype: str(),\n\t\tdocumentation: \"The nonempty database table name.\"\n\t}],\n\trefine: validateMappedName\n});\nconst mapFieldSpec = fieldAttribute(\"map\", {\n\tdocumentation: \"Maps this field to a database column name.\",\n\tpositional: [{\n\t\tkey: \"name\",\n\t\ttype: str(),\n\t\tdocumentation: \"The nonempty database column name.\"\n\t}],\n\trefine: validateMappedName\n});\nfunction nullLiteral() {\n\tconst nullIdentifier = identifier(\"null\", { documentation: \"A null list element or nullable scalar default.\" });\n\treturn {\n\t\tkind: \"null\",\n\t\tlabel: \"null\",\n\t\tparse: (arg, ctx) => {\n\t\t\tconst result = nullIdentifier.parse(arg, ctx);\n\t\t\treturn result.ok ? ok(null) : result;\n\t\t}\n\t};\n}\nfunction scalarDefaultArms(isList, registries) {\n\tconst tagsByDocumentation = /* @__PURE__ */ new Map();\n\tfor (const entry of Object.values(registries.dataTypeEntries)) {\n\t\tif (entry.written.kind !== \"tag\") continue;\n\t\tconst tags = tagsByDocumentation.get(entry.documentation);\n\t\tif (tags === void 0) tagsByDocumentation.set(entry.documentation, [entry.written.tag]);\n\t\telse tags.push(entry.written.tag);\n\t}\n\tconst tagArms = () => [...tagsByDocumentation].map(([documentation, tags]) => taggedLiteral(tags, { documentation }));\n\tconst literal = () => oneOf(str(), numLiteral(), bool(), nullLiteral(), ...tagArms());\n\tconst listArm = () => list(literal(), { label: `list of (${literal().label})` });\n\tconst funcArms = [...registries.defaultFunctionRegistry.entries()].map(([name, entry]) => funcCall(name, blindCast(entry.signature)));\n\treturn isList ? [\n\t\tlistArm(),\n\t\t...funcArms,\n\t\t...tagArms()\n\t] : [\n\t\tstr(),\n\t\tnumLiteral(),\n\t\tbool(),\n\t\tnullLiteral(),\n\t\t...funcArms,\n\t\t...tagArms(),\n\t\tlistArm()\n\t];\n}\n/**\n* The `@default` value arms, with a `dbgenerated(...)` call reported as removed before the arms\n* are tried, so the author is told what replaced it instead of being shown the list of arms.\n*/\nfunction defaultValueArm(arms, registry) {\n\tconst value = arms.length === 1 && arms[0].kind === \"list\" ? arms[0] : oneOf(...arms);\n\treturn {\n\t\t...value,\n\t\tparse: (arg, ctx) => FunctionCallAst.cast(arg.syntax)?.path().join(\".\") === \"dbgenerated\" ? notOk([leafDiagnostic(ctx, arg, removedDbgeneratedMessage(registry), \"PSL_UNKNOWN_DEFAULT_FUNCTION\")]) : value.parse(arg, ctx)\n\t};\n}\nfunction noEnumMember() {\n\treturn {\n\t\tkind: \"rejecting\",\n\t\tlabel: \"enum member\",\n\t\tmessage: \"Enum declares no members\",\n\t\tparse: (arg, ctx) => notOk([leafDiagnostic(ctx, arg, \"Enum declares no members\")])\n\t};\n}\nfunction enumMemberNames(ctx) {\n\tconst block = (ctx.field.typeNamespaceId === void 0 ? ctx.symbols.topLevel : ctx.symbols.topLevel.namespaces[ctx.field.typeNamespaceId])?.blocks[ctx.field.typeName];\n\tif (block === void 0 || block.keyword !== \"enum\") return void 0;\n\tconst names = [];\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const entry of block.node.entries()) {\n\t\tconst key = entry.key()?.name();\n\t\tif (key === void 0 || seen.has(key)) continue;\n\t\tseen.add(key);\n\t\tnames.push(key);\n\t}\n\treturn names;\n}\nfunction enumDefaultArms(members, enumName, isList) {\n\tconst [first, ...rest] = members;\n\tif (first === void 0) return [noEnumMember()];\n\tconst member = (name) => identifier(name, { documentation: `The \\`${name}\\` member of enum \\`${enumName}\\`.` });\n\tif (isList) return [list(oneOf(member(first), ...rest.map(member), nullLiteral()))];\n\treturn [member(first), ...rest.map(member)];\n}\nfunction defaultFieldSpec(ctx) {\n\tconst members = enumMemberNames(ctx);\n\treturn fieldAttribute(\"default\", {\n\t\tdocumentation: \"Supplies a default value when this field is omitted from a mutation.\",\n\t\tpositional: [{\n\t\t\tkey: \"value\",\n\t\t\ttype: defaultValueArm(members === void 0 ? scalarDefaultArms(ctx.field.list, ctx.controlMutationDefaults) : enumDefaultArms(members, ctx.field.typeName, ctx.field.list), ctx.controlMutationDefaults.defaultFunctionRegistry),\n\t\t\tdocumentation: \"A literal, enum member, or registered default function compatible with this field.\"\n\t\t}]\n\t});\n}\nconst idFieldSpec = fieldAttribute(\"id\", {\n\tdocumentation: \"Makes this field the primary key of the table.\",\n\tnamed: { map: {\n\t\ttype: optional(str()),\n\t\tdocumentation: \"The database primary-key constraint name.\"\n\t} }\n});\nconst uniqueFieldSpec = fieldAttribute(\"unique\", {\n\tdocumentation: \"Requires values in this field to be unique.\",\n\tnamed: { map: {\n\t\ttype: optional(str()),\n\t\tdocumentation: \"The database unique-constraint name.\"\n\t} }\n});\nconst noCheckKindArgument = () => oneOf(identifier(\"membership\", { documentation: \"Waives the generated check that values belong to the declared domain enum.\" }), identifier(\"elementNotNull\", { documentation: \"Waives the generated check that scalar-list elements are non-null.\" }));\n/**\n* `@noCheck` waives generated CHECK constraints on one column: bare for every\n* kind the column's shape derives, or naming concrete kinds. Two optional\n* positional slots cover the whole kind vocabulary; a third argument is\n* necessarily a duplicate and fails as excess arity.\n*/\nconst noCheckFieldSpec = fieldAttribute(\"noCheck\", {\n\tdocumentation: \"Waives generated CHECK constraints for this column. With no arguments, waives every generated kind.\",\n\tpositional: [{\n\t\tkey: \"first\",\n\t\ttype: optional(noCheckKindArgument()),\n\t\tdocumentation: \"The first generated check kind to waive: `membership` or `elementNotNull`.\"\n\t}, {\n\t\tkey: \"second\",\n\t\ttype: optional(noCheckKindArgument()),\n\t\tdocumentation: \"A second, distinct generated check kind to waive.\"\n\t}],\n\trefine: (value, ctx, attributeNode) => {\n\t\tif (value.first !== void 0 && value.first === value.second) return [leafDiagnostic(ctx, attributeNode, \"`@noCheck` names the same kind twice\")];\n\t\treturn [];\n\t}\n});\nconst idModelSpec = modelAttribute(\"id\", {\n\tdocumentation: \"Declares a compound primary key for this table.\",\n\tpositional: [{\n\t\tkey: \"fields\",\n\t\ttype: list(fieldRef(), {\n\t\t\tallowEmpty: false,\n\t\t\tunique: true\n\t\t}),\n\t\tdocumentation: \"The ordered, nonempty list of distinct primary-key fields.\"\n\t}],\n\tnamed: { map: {\n\t\ttype: optional(str()),\n\t\tdocumentation: \"The database primary-key constraint name.\"\n\t} }\n});\nconst uniqueModelSpec = modelAttribute(\"unique\", {\n\tdocumentation: \"Requires the combination of these fields to be unique.\",\n\tpositional: [{\n\t\tkey: \"fields\",\n\t\ttype: list(fieldRef(), {\n\t\t\tallowEmpty: false,\n\t\t\tunique: true\n\t\t}),\n\t\tdocumentation: \"The ordered, nonempty list of distinct fields in the unique constraint.\"\n\t}],\n\tnamed: { map: {\n\t\ttype: optional(str()),\n\t\tdocumentation: \"The database unique-constraint name.\"\n\t} }\n});\nconst PSL_INDEX_FIELDS_XOR_EXPRESSION = \"PSL_INDEX_FIELDS_XOR_EXPRESSION\";\nconst PSL_INDEX_EXPRESSION_REQUIRES_NAME = \"PSL_INDEX_EXPRESSION_REQUIRES_NAME\";\nconst PSL_INDEX_NAME_XOR_MAP = \"PSL_INDEX_NAME_XOR_MAP\";\nconst indexModelSpec = modelAttribute(\"index\", {\n\tdocumentation: \"Declares a database index over fields or a SQL expression, optionally restricted by a predicate.\",\n\tpositional: [{\n\t\tkey: \"fields\",\n\t\ttype: optional(list(fieldRef(), {\n\t\t\tallowEmpty: false,\n\t\t\tunique: true\n\t\t})),\n\t\tdocumentation: \"The ordered list of distinct indexed fields. Mutually exclusive with `expression`.\"\n\t}],\n\tnamed: {\n\t\texpression: {\n\t\t\ttype: optional(str()),\n\t\t\tdocumentation: \"The SQL index expression. Requires `name` or `map` and cannot be combined with a fields list.\"\n\t\t},\n\t\twhere: {\n\t\t\ttype: optional(str()),\n\t\t\tdocumentation: \"The SQL predicate restricting rows included in a partial index.\"\n\t\t},\n\t\tunique: {\n\t\t\ttype: optional(bool()),\n\t\t\tdocumentation: \"Whether the index enforces uniqueness.\"\n\t\t},\n\t\tname: {\n\t\t\ttype: optional(str()),\n\t\t\tdocumentation: \"The index name. Mutually exclusive with `map`.\"\n\t\t},\n\t\tmap: {\n\t\t\ttype: optional(str()),\n\t\t\tdocumentation: \"The database index name. Mutually exclusive with `name`.\"\n\t\t},\n\t\ttype: {\n\t\t\ttype: optional(str()),\n\t\t\tdocumentation: \"The target-specific index access method.\"\n\t\t},\n\t\toptions: {\n\t\t\ttype: optional(record(str())),\n\t\t\tdocumentation: \"Target-specific index options. Requires an explicit `type`.\"\n\t\t}\n\t},\n\trefine: (value, ctx, attributeNode) => {\n\t\tconst diagnostics = [];\n\t\tif (value.fields === void 0 === (value.expression === void 0)) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@index` requires exactly one of a fields list or an `expression` argument\", PSL_INDEX_FIELDS_XOR_EXPRESSION));\n\t\tif (value.expression !== void 0 && value.name === void 0 && value.map === void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@index` with an `expression` argument requires a `name` or `map` argument (a default name cannot be derived from an expression)\", PSL_INDEX_EXPRESSION_REQUIRES_NAME));\n\t\tif (value.name !== void 0 && value.map !== void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@index` takes at most one of `name` and `map`\", PSL_INDEX_NAME_XOR_MAP));\n\t\tif (value.options !== void 0 && value.type === void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@index` options argument requires a type argument\"));\n\t\treturn diagnostics;\n\t}\n});\nconst PSL_CHECK_REQUIRES_NAME_OR_MAP = \"PSL_CHECK_REQUIRES_NAME_OR_MAP\";\nconst PSL_CHECK_NAME_XOR_MAP = \"PSL_CHECK_NAME_XOR_MAP\";\nconst PSL_CHECK_EXPRESSION_EMPTY = \"PSL_CHECK_EXPRESSION_EMPTY\";\n/**\n* A single-table-inheritance variant (`@@base` with no own `@@map`) shares\n* its base model's storage table and has no table of its own to declare a\n* check on — raised from {@link interpretPslDocumentToSqlContract}, not from\n* this spec's own `refine`, because the rule needs the model's `@@base`\n* declaration, which a single attribute's `refine` cannot see.\n*/\nconst PSL_CHECK_ON_STI_VARIANT = \"PSL_CHECK_ON_STI_VARIANT\";\nconst checkModelSpec = modelAttribute(\"check\", {\n\tdocumentation: \"Declares a named database CHECK constraint on this table.\",\n\tnamed: {\n\t\texpression: {\n\t\t\ttype: str(),\n\t\t\tdocumentation: \"The nonempty SQL predicate checked for each row.\"\n\t\t},\n\t\tname: {\n\t\t\ttype: optional(str()),\n\t\t\tdocumentation: \"The constraint name. Exactly one of `name` and `map` is required.\"\n\t\t},\n\t\tmap: {\n\t\t\ttype: optional(str()),\n\t\t\tdocumentation: \"The database constraint name. Exactly one of `name` and `map` is required.\"\n\t\t}\n\t},\n\trefine: (value, ctx, attributeNode) => {\n\t\tconst diagnostics = [];\n\t\tif (value.expression.trim().length === 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@check` expression must not be empty — an empty predicate is not a constraint\", PSL_CHECK_EXPRESSION_EMPTY));\n\t\tif (value.name === void 0 && value.map === void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@check` requires a `name` or `map` argument (a default name cannot be derived — a check has no column tuple to name itself after)\", PSL_CHECK_REQUIRES_NAME_OR_MAP));\n\t\tif (value.name !== void 0 && value.map !== void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@check` takes at most one of `name` and `map`\", PSL_CHECK_NAME_XOR_MAP));\n\t\treturn diagnostics;\n\t}\n});\nconst controlModelSpec = modelAttribute(\"control\", {\n\tdocumentation: \"Sets how schema management treats this model’s storage.\",\n\tpositional: [{\n\t\tkey: \"policy\",\n\t\tdocumentation: \"The storage control policy: `managed`, `tolerated`, `external`, or `observed`.\",\n\t\ttype: oneOf(identifier(\"managed\", { documentation: \"Verifies the declared shape strictly and allows migrations to create, alter, or drop the storage object.\" }), identifier(\"tolerated\", { documentation: \"Verifies declared columns while allowing extra columns. Migrations may create missing storage, but never alter or drop existing storage.\" }), identifier(\"external\", { documentation: \"Verifies declared storage without creating, altering, or dropping it.\" }), identifier(\"observed\", { documentation: \"Reports storage differences as warnings rather than verification failures and never emits migration operations.\" }))\n\t}]\n});\nconst discriminatorModelSpec = modelAttribute(\"discriminator\", {\n\tdocumentation: \"Selects the field that identifies inheritance variants of this model.\",\n\tpositional: [{\n\t\tkey: \"field\",\n\t\ttype: fieldRef(),\n\t\tdocumentation: \"The discriminator field on this model.\"\n\t}]\n});\nfunction baseModelSpec() {\n\treturn modelAttribute(\"base\", {\n\t\tdocumentation: \"Declares this model as a variant of a base model.\",\n\t\tpositional: [{\n\t\t\tkey: \"base\",\n\t\t\ttype: entityRef({ kind: \"model\" }),\n\t\t\tdocumentation: \"The base model to inherit from.\"\n\t\t}, {\n\t\t\tkey: \"value\",\n\t\t\ttype: str(),\n\t\t\tdocumentation: \"The discriminator value identifying this variant.\"\n\t\t}]\n\t});\n}\nfunction relationAttributeSpan(ctx) {\n\tconst node = getAttribute(ctx.field.attributes, \"relation\")?.node;\n\tif (node !== void 0) return nodePslSpan(node.syntax, ctx.sources);\n\treturn ctx.field.span;\n}\nfunction relationInvariants(parsed, ctx) {\n\tif (parsed.fields !== void 0 !== (parsed.references !== void 0)) return [{\n\t\tcode: \"PSL_INVALID_ATTRIBUTE_SYNTAX\",\n\t\tmessage: `Relation field \"${ctx.selfModel.name}.${ctx.field.name}\" requires fields and references arguments`,\n\t\t...diagnosticSource(ctx.sources, ctx.field.node.syntax).at(relationAttributeSpan(ctx))\n\t}];\n\treturn [];\n}\nconst referentialActionArgument = () => oneOf(identifier(\"NoAction\", { documentation: \"Rejects a change that would violate the foreign key when the constraint is checked; checking may be deferred when supported and configured.\" }), identifier(\"Restrict\", { documentation: \"Rejects deleting or updating a referenced row while referencing rows remain, without deferring the check.\" }), identifier(\"Cascade\", { documentation: \"Propagates deletion or key updates of a referenced row to its referencing rows.\" }), identifier(\"SetNull\", { documentation: \"Sets referencing foreign-key fields to null when the referenced row is deleted or its key changes. The fields must allow null.\" }), identifier(\"SetDefault\", { documentation: \"Sets referencing foreign-key fields to their defaults when the referenced row is deleted or its key changes. The resulting values must satisfy the foreign key.\" }));\nconst relationFieldSpec = fieldAttribute(\"relation\", {\n\tdocumentation: \"Defines the relation name, foreign-key fields, and referential actions for this relation.\",\n\tpositional: [{\n\t\tkey: \"name\",\n\t\ttype: optional(str()),\n\t\tdocumentation: \"The relation name used to pair both sides. May also be supplied by name.\"\n\t}],\n\tnamed: {\n\t\tname: {\n\t\t\ttype: optional(str()),\n\t\t\tdocumentation: \"The relation name used to pair both sides. Cannot also be supplied positionally.\"\n\t\t},\n\t\tfields: {\n\t\t\ttype: optional(list(fieldRef(), {\n\t\t\t\tallowEmpty: false,\n\t\t\t\tunique: true\n\t\t\t})),\n\t\t\tdocumentation: \"The ordered local foreign-key fields. Must be supplied together with `references`.\"\n\t\t},\n\t\treferences: {\n\t\t\ttype: optional(list(referencedFieldRef(), {\n\t\t\t\tallowEmpty: false,\n\t\t\t\tunique: true\n\t\t\t})),\n\t\t\tdocumentation: \"The corresponding fields on the referenced model. Must be supplied together with `fields`.\"\n\t\t},\n\t\tmap: {\n\t\t\ttype: optional(str()),\n\t\t\tdocumentation: \"The database foreign-key constraint name.\"\n\t\t},\n\t\tonDelete: {\n\t\t\ttype: optional(referentialActionArgument()),\n\t\t\tdocumentation: \"The referential action when a referenced row is deleted.\"\n\t\t},\n\t\tonUpdate: {\n\t\t\ttype: optional(referentialActionArgument()),\n\t\t\tdocumentation: \"The referential action when a referenced key is updated.\"\n\t\t},\n\t\tindex: {\n\t\t\ttype: optional(bool()),\n\t\t\tdocumentation: \"Whether to create an index for the relation’s foreign-key fields.\"\n\t\t}\n\t},\n\trefine: relationInvariants\n});\nfunction fieldSpecContext(input) {\n\treturn {\n\t\tsymbols: input.symbols,\n\t\tmodel: input.model,\n\t\tfield: input.field,\n\t\tcontrolMutationDefaults: input.controlMutationDefaults\n\t};\n}\nconst sqlAttributeSpecs = {\n\tmodel: {\n\t\tmap: () => mapModelSpec,\n\t\tid: () => idModelSpec,\n\t\tunique: () => uniqueModelSpec,\n\t\tindex: () => indexModelSpec,\n\t\tcheck: () => checkModelSpec,\n\t\tcontrol: () => controlModelSpec,\n\t\tdiscriminator: () => discriminatorModelSpec,\n\t\tbase: baseModelSpec\n\t},\n\tfield: {\n\t\tmap: () => mapFieldSpec,\n\t\tid: () => idFieldSpec,\n\t\tunique: () => uniqueFieldSpec,\n\t\tnoCheck: () => noCheckFieldSpec,\n\t\trelation: () => relationFieldSpec,\n\t\tdefault: defaultFieldSpec\n\t}\n};\n//#endregion\nexport { interpretModelAttribute as a, formatDbAttributeMigrationMessage as c, mapFieldNamesToColumns as d, storageName as f, interpretFieldAttribute as i, getAttribute as l, createSqlBinder as n, modelAttributeSpecsFrom as o, lowerDefaultFunctionWithRegistry as p, fieldSpecContext as r, sqlAttributeSpecs as s, PSL_CHECK_ON_STI_VARIANT as t, getNamedArgument as u };\n\n//# sourceMappingURL=sql-attribute-specs-DxpHr9Fk.mjs.map"],"mappings":";;;;;;;AAOA,SAAS,4BAA4B,UAAU;CAC9C,MAAM,aAAa,MAAM,KAAK,SAAS,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,cAAc,WAAW;EAC3H,MAAM,kBAAkB,MAAM,iBAAiB,QAAQ,cAAc,UAAU,SAAS,CAAC;EACzF,OAAO,mBAAmB,gBAAgB,SAAS,IAAI,kBAAkB,CAAC,GAAG,aAAa,GAAG;CAC9F,CAAC;CACD,OAAO,WAAW,SAAS,IAAI,WAAW,KAAK,IAAI,IAAI;AACxD;;AAEA,SAAS,0BAA0B,UAAU;CAC5C,OAAO,sI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Ac;EACd,aAAa;EACb,aAAa;EACb,eAAe;EACf,qBAAqB;EACrB,MAAM;CACP;CACA,OAAO;EACN,WAAW;EACX,UAAU;EACV,cAAc;EACd,eAAe;EACf,gBAAgB;EAChB,SAAS;CACV;AACD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as sqlContractCanonicalizationHooks } from "./canonicalization-hooks-dmXkOR4a.mjs";
|
|
2
|
-
import { f as composeSqlEntityKinds } from "./entity-kinds-
|
|
3
|
-
import { c as isMaterializedSqlNamespace, o as SqlStorage } from "./types-
|
|
4
|
-
import { i as createSqlContractSchema, s as resolveSqlToOneRelationStorage, u as validateSqlContractFully } from "./validators-
|
|
2
|
+
import { f as composeSqlEntityKinds } from "./entity-kinds-ChX-owgJ-BgpQHnfy.mjs";
|
|
3
|
+
import { c as isMaterializedSqlNamespace, o as SqlStorage } from "./types-jFnALKoT.mjs";
|
|
4
|
+
import { i as createSqlContractSchema, s as resolveSqlToOneRelationStorage, u as validateSqlContractFully } from "./validators-DvzOZLel.mjs";
|
|
5
5
|
import { t as sqlFamilyError } from "./errors-B5g0xWro-mWH2C07F.mjs";
|
|
6
6
|
import { ContractValidationError } from "@prisma/orm-framework/contract/contract-validation-error";
|
|
7
7
|
import { hydrateNamespaceEntities } from "@prisma/orm-framework/components/ir";
|
|
@@ -188,4 +188,4 @@ var SqlContractSerializer = class extends SqlContractSerializerBase {
|
|
|
188
188
|
//#endregion
|
|
189
189
|
export { SqlContractSerializerBase as n, SqlContractSerializer as t };
|
|
190
190
|
|
|
191
|
-
//# sourceMappingURL=sql-contract-serializer-C90xg7_q-
|
|
191
|
+
//# sourceMappingURL=sql-contract-serializer-C90xg7_q-CxzBoB0F.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sql-contract-serializer-C90xg7_q-DBJSt3MT.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/sql-contract-serializer-C90xg7_q.mjs"],"sourcesContent":["import { t as sqlFamilyError } from \"./errors-B5g0xWro.mjs\";\nimport { hydrateNamespaceEntities } from \"@internal/framework-components/ir\";\nimport { sqlContractCanonicalizationHooks } from \"@internal/sql-contract/canonicalization-hooks\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { SqlStorage, isMaterializedSqlNamespace } from \"@internal/sql-contract/types\";\nimport { ContractValidationError } from \"@internal/contract/contract-validation-error\";\nimport { isPlainRecord as isPlainRecord$1 } from \"@internal/contract/is-plain-record\";\nimport { withDerivedToOneRelationNullability } from \"@internal/contract-authoring\";\nimport { composeSqlEntityKinds } from \"@internal/sql-contract/entity-kinds\";\nimport { createSqlContractSchema, resolveSqlToOneRelationStorage, validateSqlContractFully } from \"@internal/sql-contract/validators\";\nimport { type } from \"arktype\";\n//#region src/core/ir/sql-contract-serializer-base.ts\nconst NamespaceRawSchema = type({\n\tid: \"string\",\n\t\"kind?\": \"string\",\n\tentries: type({ \"+\": \"ignore\" })\n});\n/**\n* A `contract.json` written before to-one relations recorded `nullable` (rc.9 and earlier)\n* loads with the flag derived from storage: nullable when any local FK column is nullable or\n* cannot be resolved.\n*/\nfunction withSqlToOneRelationNullability(contract) {\n\tconst domain = withDerivedToOneRelationNullability(contract.domain, ({ model, relation }) => {\n\t\tconst { ownsForeignKey, columns } = resolveSqlToOneRelationStorage(contract, blindCast(model.storage), relation);\n\t\treturn {\n\t\t\townsReference: ownsForeignKey,\n\t\t\tlocalFieldNullability: columns.map((column) => column.nullable)\n\t\t};\n\t});\n\treturn {\n\t\t...contract,\n\t\tdomain\n\t};\n}\n/**\n* SQL family `ContractSerializer` abstract base. Carries the SQL-shared\n* deserialization pipeline:\n*\n* 1. `parseSqlContractStructure` validates the on-disk JSON envelope\n* against the SQL contract arktype schema (`validateSqlContractFully`)\n* and returns the validated flat-data shape.\n* 2. `hydrateSqlStorage` walks the validated `storage` subtree and\n* constructs the family-shared SQL Contract IR class hierarchy\n* (`SqlStorage` -> `StorageTable` -> `StorageColumn` / `PrimaryKey`\n* / …). The rest of the contract envelope is JSON-clean primitive\n* data and passes through unchanged.\n* 3. `constructTargetContract` is the target-specific extension hook;\n* defaults to identity. Targets that need to attach target-only\n* fields (e.g. target-specific derived storage fields) override it.\n*\n* Default `serializeContract` is identity over the contract — concrete\n* SQL targets ship JSON-clean class instances, so the contract value\n* can be stringified directly. The non-enumerable family-level `kind`\n* discriminator on `SqlNode` instances stays out of the persisted\n* envelope automatically. Targets that need to canonicalize on the way\n* out (key ordering, dropping computed-only fields) override\n* `serializeContract` directly.\n*/\nvar SqlContractSerializerBase = class {\n\tentityHydrationRegistry;\n\tcontractSchema;\n\tentryKinds;\n\tconstructor(entityHydrationRegistry = /* @__PURE__ */ new Map(), packEntityKinds = []) {\n\t\tthis.entityHydrationRegistry = entityHydrationRegistry;\n\t\tthis.entryKinds = composeSqlEntityKinds(packEntityKinds);\n\t\tthis.contractSchema = packEntityKinds.length > 0 ? createSqlContractSchema(this.entryKinds) : void 0;\n\t}\n\tdeserializeContract(json) {\n\t\tconst validated = withSqlToOneRelationNullability(this.parseSqlContractStructure(json));\n\t\tconst hydrated = this.hydrateSqlStorage(validated);\n\t\treturn blindCast(this.constructTargetContract(hydrated));\n\t}\n\tserializeContract(contract) {\n\t\treturn blindCast(contract);\n\t}\n\tshouldPreserveEmpty = sqlContractCanonicalizationHooks.shouldPreserveEmpty;\n\tsortStorage = sqlContractCanonicalizationHooks.sortStorage;\n\thashCanonicalizationHooks = sqlContractCanonicalizationHooks;\n\tparseSqlContractStructure(json) {\n\t\treturn validateSqlContractFully(json, this.contractSchema !== void 0 ? { contractSchema: this.contractSchema } : void 0);\n\t}\n\thydrateSqlStorage(validated) {\n\t\tconst types = validated.storage.types;\n\t\tconst hydratedTypes = types !== void 0 ? Object.fromEntries(Object.entries(types).map(([name, entry]) => [name, this.hydrateStorageTypeEntry(entry)])) : void 0;\n\t\tconst rawNamespaces = validated.storage.namespaces;\n\t\tif (rawNamespaces === void 0) throw new ContractValidationError(\"Contract storage.namespaces is required after structural validation\", \"structural\");\n\t\tconst hydratedNamespaces = this.hydrateSqlNamespaceMap(blindCast(rawNamespaces));\n\t\treturn {\n\t\t\t...validated,\n\t\t\tstorage: new SqlStorage({\n\t\t\t\tstorageHash: validated.storage.storageHash,\n\t\t\t\t...ifDefined(\"types\", hydratedTypes),\n\t\t\t\tnamespaces: blindCast(hydratedNamespaces)\n\t\t\t})\n\t\t};\n\t}\n\thydrateSqlNamespaceMap(namespaces) {\n\t\treturn Object.fromEntries(Object.entries(namespaces).map(([nsId, namespaceEntryRaw]) => {\n\t\t\tconst namespaceHydrated = this.hydrateSqlNamespaceEntry(nsId, namespaceEntryRaw);\n\t\t\tif (!isMaterializedSqlNamespace(namespaceHydrated)) throw sqlFamilyError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Target serializer bug: hydrateSqlNamespaceEntry for namespace \"${nsId}\" returned a non-NamespaceBase value. Override hydrateSqlNamespaceEntry to produce a target namespace concretion.`, {\n\t\t\t\twhy: \"The target contract serializer hydrated a namespace into a value that is not a materialized namespace concretion.\",\n\t\t\t\tfix: \"Fix the target package: its hydrateSqlNamespaceEntry override must return a target namespace concretion.\",\n\t\t\t\tmeta: { namespaceId: nsId }\n\t\t\t});\n\t\t\treturn [nsId, namespaceHydrated];\n\t\t}));\n\t}\n\thydrateSqlNamespaceEntry(nsId, raw) {\n\t\tconst id = typeof raw[\"id\"] === \"string\" ? raw[\"id\"] : nsId;\n\t\tconst parsed = NamespaceRawSchema({\n\t\t\t...raw,\n\t\t\tid\n\t\t});\n\t\tif (parsed instanceof type.errors) throw new ContractValidationError(`Namespace hydration failed: ${parsed.map((p) => p.message).join(\"; \")}`, \"structural\");\n\t\tconst entriesRaw = parsed.entries;\n\t\tconst rawEntriesMap = isPlainRecord$1(entriesRaw) ? entriesRaw : {};\n\t\tconst entriesInput = {};\n\t\tfor (const [key, innerMap] of Object.entries(rawEntriesMap)) entriesInput[key] = isPlainRecord$1(innerMap) ? innerMap : Object.freeze({});\n\t\tconst entriesOutput = hydrateNamespaceEntities(entriesInput, this.entryKinds, \"fail\", id);\n\t\tif (!Object.hasOwn(entriesOutput, \"table\")) entriesOutput[\"table\"] = {};\n\t\treturn blindCast({\n\t\t\tid,\n\t\t\tentries: entriesOutput\n\t\t});\n\t}\n\thydrateStorageTypeEntry(entry) {\n\t\tif (typeof entry !== \"object\" || entry === null) return entry;\n\t\tconst kind = isPlainRecord$1(entry) ? entry[\"kind\"] : void 0;\n\t\tif (typeof kind !== \"string\") return entry;\n\t\tconst factory = this.entityHydrationRegistry.get(kind);\n\t\tif (factory === void 0) return entry;\n\t\treturn blindCast(factory(entry));\n\t}\n\tconstructTargetContract(hydrated) {\n\t\treturn blindCast(hydrated);\n\t}\n\t/**\n\t* Serializes a namespace's `entries` dict by walking every enumerable\n\t* kind — no kind is named here, mirroring the generic hydrate walk in\n\t* `hydrateSqlNamespaceEntry` above. `table` is the SQL family's one\n\t* universal base kind (every namespace carries it), so it is always\n\t* emitted, even when empty; every other kind — target- or\n\t* pack-contributed — is emitted only when it holds at least one entry.\n\t* A kind carried non-enumerable on `entries` is excluded here for free,\n\t* since `Object.entries` honors enumerability.\n\t*/\n\tserializeNamespaceEntries(entries) {\n\t\tconst out = { table: this.serializeEntries(entries[\"table\"] ?? {}) };\n\t\tfor (const [kind, record] of Object.entries(entries)) {\n\t\t\tif (kind === \"table\" || record == null || Object.keys(record).length === 0) continue;\n\t\t\tout[kind] = this.serializeEntries(record);\n\t\t}\n\t\treturn out;\n\t}\n\tserializeEntries(entries) {\n\t\tconst out = {};\n\t\tfor (const [name, entry] of Object.entries(entries)) out[name] = this.serializeJsonObject(entry);\n\t\treturn out;\n\t}\n\tserializeJsonObject(value) {\n\t\treturn blindCast(this.serializeJsonValue(value));\n\t}\n\tserializeJsonValue(value) {\n\t\treturn blindCast(JSON.parse(JSON.stringify(value)));\n\t}\n};\n//#endregion\n//#region src/core/ir/sql-contract-serializer.ts\n/**\n* Default SQL family `ContractSerializer` concretion. Inherits the\n* full SQL-shared deserialization pipeline (structural validation +\n* IR-class hydration) without pack-registered `storage.types`\n* hydration factories — targets that emit polymorphic JSON outside the\n* codec-typed envelope wire a target-specific subclass with a populated\n* registry (see Postgres). Family-level call sites instantiate this\n* default directly when no target serializer is supplied.\n*\n* Because this serializer has no target concretion, deserialization of\n* contracts that include namespace entries from JSON will throw unless\n* the caller provides pre-hydrated `NamespaceBase` instances. Production\n* paths always supply a target-specific serializer.\n*/\nvar SqlContractSerializer = class extends SqlContractSerializerBase {\n\tconstructor() {\n\t\tsuper(/* @__PURE__ */ new Map());\n\t}\n};\n//#endregion\nexport { SqlContractSerializerBase as n, SqlContractSerializer as t };\n\n//# sourceMappingURL=sql-contract-serializer-C90xg7_q.mjs.map"],"mappings":";;;;;;;;;;;;;AAaA,MAAM,qBAAqB,KAAK;CAC/B,IAAI;CACJ,SAAS;CACT,SAAS,KAAK,EAAE,KAAK,SAAS,CAAC;AAChC,CAAC;;;;;;AAMD,SAAS,gCAAgC,UAAU;CAClD,MAAM,SAAS,oCAAoC,SAAS,SAAS,EAAE,OAAO,eAAe;EAC5F,MAAM,EAAE,gBAAgB,YAAY,+BAA+B,UAAU,UAAU,MAAM,OAAO,GAAG,QAAQ;EAC/G,OAAO;GACN,eAAe;GACf,uBAAuB,QAAQ,KAAK,WAAW,OAAO,QAAQ;EAC/D;CACD,CAAC;CACD,OAAO;EACN,GAAG;EACH;CACD;AACD;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAI,4BAA4B,MAAM;CACrC;CACA;CACA;CACA,YAAY,0CAA0C,IAAI,IAAI,GAAG,kBAAkB,CAAC,GAAG;EACtF,KAAK,0BAA0B;EAC/B,KAAK,aAAa,sBAAsB,eAAe;EACvD,KAAK,iBAAiB,gBAAgB,SAAS,IAAI,wBAAwB,KAAK,UAAU,IAAI,KAAK;CACpG;CACA,oBAAoB,MAAM;EACzB,MAAM,YAAY,gCAAgC,KAAK,0BAA0B,IAAI,CAAC;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AG;GAC5E,IAAI,QAAQ,KAAK,iBAAiB,MAAM;EACzC;EACA,OAAO;CACR;CACA,iBAAiB,SAAS;EACzB,MAAM,MAAM,CAAC;EACb,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,OAAO,GAAG,IAAI,QAAQ,KAAK,oBAAoB,KAAK;EAC/F,OAAO;CACR;CACA,oBAAoB,OAAO;EAC1B,OAAO,UAAU,KAAK,mBAAmB,KAAK,CAAC;CAChD;CACA,mBAAmB,OAAO;EACzB,OAAO,UAAU,KAAK,MAAM,KAAK,UAAU,KAAK,CAAC,CAAC;CACnD;AACD;;;;;;;;;;;;;;;AAiBA,IAAI,wBAAwB,cAAc,0BAA0B;CACnE,cAAc;EACb,sBAAsB,IAAI,IAAI,CAAC;CAChC;AACD"}
|
|
1
|
+
{"version":3,"file":"sql-contract-serializer-C90xg7_q-CxzBoB0F.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/sql-contract-serializer-C90xg7_q.mjs"],"sourcesContent":["import { t as sqlFamilyError } from \"./errors-B5g0xWro.mjs\";\nimport { hydrateNamespaceEntities } from \"@internal/framework-components/ir\";\nimport { sqlContractCanonicalizationHooks } from \"@internal/sql-contract/canonicalization-hooks\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { SqlStorage, isMaterializedSqlNamespace } from \"@internal/sql-contract/types\";\nimport { ContractValidationError } from \"@internal/contract/contract-validation-error\";\nimport { isPlainRecord as isPlainRecord$1 } from \"@internal/contract/is-plain-record\";\nimport { withDerivedToOneRelationNullability } from \"@internal/contract-authoring\";\nimport { composeSqlEntityKinds } from \"@internal/sql-contract/entity-kinds\";\nimport { createSqlContractSchema, resolveSqlToOneRelationStorage, validateSqlContractFully } from \"@internal/sql-contract/validators\";\nimport { type } from \"arktype\";\n//#region src/core/ir/sql-contract-serializer-base.ts\nconst NamespaceRawSchema = type({\n\tid: \"string\",\n\t\"kind?\": \"string\",\n\tentries: type({ \"+\": \"ignore\" })\n});\n/**\n* A `contract.json` written before to-one relations recorded `nullable` (rc.9 and earlier)\n* loads with the flag derived from storage: nullable when any local FK column is nullable or\n* cannot be resolved.\n*/\nfunction withSqlToOneRelationNullability(contract) {\n\tconst domain = withDerivedToOneRelationNullability(contract.domain, ({ model, relation }) => {\n\t\tconst { ownsForeignKey, columns } = resolveSqlToOneRelationStorage(contract, blindCast(model.storage), relation);\n\t\treturn {\n\t\t\townsReference: ownsForeignKey,\n\t\t\tlocalFieldNullability: columns.map((column) => column.nullable)\n\t\t};\n\t});\n\treturn {\n\t\t...contract,\n\t\tdomain\n\t};\n}\n/**\n* SQL family `ContractSerializer` abstract base. Carries the SQL-shared\n* deserialization pipeline:\n*\n* 1. `parseSqlContractStructure` validates the on-disk JSON envelope\n* against the SQL contract arktype schema (`validateSqlContractFully`)\n* and returns the validated flat-data shape.\n* 2. `hydrateSqlStorage` walks the validated `storage` subtree and\n* constructs the family-shared SQL Contract IR class hierarchy\n* (`SqlStorage` -> `StorageTable` -> `StorageColumn` / `PrimaryKey`\n* / …). The rest of the contract envelope is JSON-clean primitive\n* data and passes through unchanged.\n* 3. `constructTargetContract` is the target-specific extension hook;\n* defaults to identity. Targets that need to attach target-only\n* fields (e.g. target-specific derived storage fields) override it.\n*\n* Default `serializeContract` is identity over the contract — concrete\n* SQL targets ship JSON-clean class instances, so the contract value\n* can be stringified directly. The non-enumerable family-level `kind`\n* discriminator on `SqlNode` instances stays out of the persisted\n* envelope automatically. Targets that need to canonicalize on the way\n* out (key ordering, dropping computed-only fields) override\n* `serializeContract` directly.\n*/\nvar SqlContractSerializerBase = class {\n\tentityHydrationRegistry;\n\tcontractSchema;\n\tentryKinds;\n\tconstructor(entityHydrationRegistry = /* @__PURE__ */ new Map(), packEntityKinds = []) {\n\t\tthis.entityHydrationRegistry = entityHydrationRegistry;\n\t\tthis.entryKinds = composeSqlEntityKinds(packEntityKinds);\n\t\tthis.contractSchema = packEntityKinds.length > 0 ? createSqlContractSchema(this.entryKinds) : void 0;\n\t}\n\tdeserializeContract(json) {\n\t\tconst validated = withSqlToOneRelationNullability(this.parseSqlContractStructure(json));\n\t\tconst hydrated = this.hydrateSqlStorage(validated);\n\t\treturn blindCast(this.constructTargetContract(hydrated));\n\t}\n\tserializeContract(contract) {\n\t\treturn blindCast(contract);\n\t}\n\tshouldPreserveEmpty = sqlContractCanonicalizationHooks.shouldPreserveEmpty;\n\tsortStorage = sqlContractCanonicalizationHooks.sortStorage;\n\thashCanonicalizationHooks = sqlContractCanonicalizationHooks;\n\tparseSqlContractStructure(json) {\n\t\treturn validateSqlContractFully(json, this.contractSchema !== void 0 ? { contractSchema: this.contractSchema } : void 0);\n\t}\n\thydrateSqlStorage(validated) {\n\t\tconst types = validated.storage.types;\n\t\tconst hydratedTypes = types !== void 0 ? Object.fromEntries(Object.entries(types).map(([name, entry]) => [name, this.hydrateStorageTypeEntry(entry)])) : void 0;\n\t\tconst rawNamespaces = validated.storage.namespaces;\n\t\tif (rawNamespaces === void 0) throw new ContractValidationError(\"Contract storage.namespaces is required after structural validation\", \"structural\");\n\t\tconst hydratedNamespaces = this.hydrateSqlNamespaceMap(blindCast(rawNamespaces));\n\t\treturn {\n\t\t\t...validated,\n\t\t\tstorage: new SqlStorage({\n\t\t\t\tstorageHash: validated.storage.storageHash,\n\t\t\t\t...ifDefined(\"types\", hydratedTypes),\n\t\t\t\tnamespaces: blindCast(hydratedNamespaces)\n\t\t\t})\n\t\t};\n\t}\n\thydrateSqlNamespaceMap(namespaces) {\n\t\treturn Object.fromEntries(Object.entries(namespaces).map(([nsId, namespaceEntryRaw]) => {\n\t\t\tconst namespaceHydrated = this.hydrateSqlNamespaceEntry(nsId, namespaceEntryRaw);\n\t\t\tif (!isMaterializedSqlNamespace(namespaceHydrated)) throw sqlFamilyError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Target serializer bug: hydrateSqlNamespaceEntry for namespace \"${nsId}\" returned a non-NamespaceBase value. Override hydrateSqlNamespaceEntry to produce a target namespace concretion.`, {\n\t\t\t\twhy: \"The target contract serializer hydrated a namespace into a value that is not a materialized namespace concretion.\",\n\t\t\t\tfix: \"Fix the target package: its hydrateSqlNamespaceEntry override must return a target namespace concretion.\",\n\t\t\t\tmeta: { namespaceId: nsId }\n\t\t\t});\n\t\t\treturn [nsId, namespaceHydrated];\n\t\t}));\n\t}\n\thydrateSqlNamespaceEntry(nsId, raw) {\n\t\tconst id = typeof raw[\"id\"] === \"string\" ? raw[\"id\"] : nsId;\n\t\tconst parsed = NamespaceRawSchema({\n\t\t\t...raw,\n\t\t\tid\n\t\t});\n\t\tif (parsed instanceof type.errors) throw new ContractValidationError(`Namespace hydration failed: ${parsed.map((p) => p.message).join(\"; \")}`, \"structural\");\n\t\tconst entriesRaw = parsed.entries;\n\t\tconst rawEntriesMap = isPlainRecord$1(entriesRaw) ? entriesRaw : {};\n\t\tconst entriesInput = {};\n\t\tfor (const [key, innerMap] of Object.entries(rawEntriesMap)) entriesInput[key] = isPlainRecord$1(innerMap) ? innerMap : Object.freeze({});\n\t\tconst entriesOutput = hydrateNamespaceEntities(entriesInput, this.entryKinds, \"fail\", id);\n\t\tif (!Object.hasOwn(entriesOutput, \"table\")) entriesOutput[\"table\"] = {};\n\t\treturn blindCast({\n\t\t\tid,\n\t\t\tentries: entriesOutput\n\t\t});\n\t}\n\thydrateStorageTypeEntry(entry) {\n\t\tif (typeof entry !== \"object\" || entry === null) return entry;\n\t\tconst kind = isPlainRecord$1(entry) ? entry[\"kind\"] : void 0;\n\t\tif (typeof kind !== \"string\") return entry;\n\t\tconst factory = this.entityHydrationRegistry.get(kind);\n\t\tif (factory === void 0) return entry;\n\t\treturn blindCast(factory(entry));\n\t}\n\tconstructTargetContract(hydrated) {\n\t\treturn blindCast(hydrated);\n\t}\n\t/**\n\t* Serializes a namespace's `entries` dict by walking every enumerable\n\t* kind — no kind is named here, mirroring the generic hydrate walk in\n\t* `hydrateSqlNamespaceEntry` above. `table` is the SQL family's one\n\t* universal base kind (every namespace carries it), so it is always\n\t* emitted, even when empty; every other kind — target- or\n\t* pack-contributed — is emitted only when it holds at least one entry.\n\t* A kind carried non-enumerable on `entries` is excluded here for free,\n\t* since `Object.entries` honors enumerability.\n\t*/\n\tserializeNamespaceEntries(entries) {\n\t\tconst out = { table: this.serializeEntries(entries[\"table\"] ?? {}) };\n\t\tfor (const [kind, record] of Object.entries(entries)) {\n\t\t\tif (kind === \"table\" || record == null || Object.keys(record).length === 0) continue;\n\t\t\tout[kind] = this.serializeEntries(record);\n\t\t}\n\t\treturn out;\n\t}\n\tserializeEntries(entries) {\n\t\tconst out = {};\n\t\tfor (const [name, entry] of Object.entries(entries)) out[name] = this.serializeJsonObject(entry);\n\t\treturn out;\n\t}\n\tserializeJsonObject(value) {\n\t\treturn blindCast(this.serializeJsonValue(value));\n\t}\n\tserializeJsonValue(value) {\n\t\treturn blindCast(JSON.parse(JSON.stringify(value)));\n\t}\n};\n//#endregion\n//#region src/core/ir/sql-contract-serializer.ts\n/**\n* Default SQL family `ContractSerializer` concretion. Inherits the\n* full SQL-shared deserialization pipeline (structural validation +\n* IR-class hydration) without pack-registered `storage.types`\n* hydration factories — targets that emit polymorphic JSON outside the\n* codec-typed envelope wire a target-specific subclass with a populated\n* registry (see Postgres). Family-level call sites instantiate this\n* default directly when no target serializer is supplied.\n*\n* Because this serializer has no target concretion, deserialization of\n* contracts that include namespace entries from JSON will throw unless\n* the caller provides pre-hydrated `NamespaceBase` instances. Production\n* paths always supply a target-specific serializer.\n*/\nvar SqlContractSerializer = class extends SqlContractSerializerBase {\n\tconstructor() {\n\t\tsuper(/* @__PURE__ */ new Map());\n\t}\n};\n//#endregion\nexport { SqlContractSerializerBase as n, SqlContractSerializer as t };\n\n//# sourceMappingURL=sql-contract-serializer-C90xg7_q.mjs.map"],"mappings":";;;;;;;;;;;;;AAaA,MAAM,qBAAqB,KAAK;CAC/B,IAAI;CACJ,SAAS;CACT,SAAS,KAAK,EAAE,KAAK,SAAS,CAAC;AA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./types-Yui2yFf6-Ceyf2gJ2.mjs";
|
|
2
2
|
import { ExecutionPlan } from "@prisma/orm-framework/components/runtime";
|
|
3
3
|
//#region ../../../2-sql/4-lanes/relational-core/dist/sql-execution-plan-Db0j752I.d.mts
|
|
4
4
|
//#region src/sql-execution-plan.d.ts
|
|
@@ -28,4 +28,4 @@ interface SqlExecutionPlan<Row = unknown> extends ExecutionPlan<Row> {
|
|
|
28
28
|
}
|
|
29
29
|
//#endregion
|
|
30
30
|
export { SqlExecutionPlan as t };
|
|
31
|
-
//# sourceMappingURL=sql-execution-plan-Db0j752I-
|
|
31
|
+
//# sourceMappingURL=sql-execution-plan-Db0j752I-B3yGocR6.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sql-execution-plan-Db0j752I-
|
|
1
|
+
{"version":3,"file":"sql-execution-plan-Db0j752I-B3yGocR6.d.mts","names":[],"sources":["../../../../2-sql/4-lanes/relational-core/dist/sql-execution-plan-Db0j752I.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;UAsBU,iBAAiB,uBAAuB,cAAc;WACrD;WACA;WACA,KAAK"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as SqlNode } from "./sql-node-kEz6YFZo-v2F7delx.mjs";
|
|
2
|
-
import { r as StorageTable } from "./storage-table-
|
|
2
|
+
import { r as StorageTable } from "./storage-table-DLFvP77v-BfO2iOT4.mjs";
|
|
3
3
|
import { t as StorageValueSet } from "./storage-value-set-BGlj5Uus-CvZD--GG.mjs";
|
|
4
4
|
import { AuthoringContributions } from "@prisma/orm-framework/components/authoring";
|
|
5
5
|
import { Namespace, NamespaceBase, Storage, StorageType } from "@prisma/orm-framework/components/ir";
|
|
6
6
|
import { StorageHashBase } from "@prisma/orm-framework/contract/types";
|
|
7
|
-
//#region ../../../2-sql/1-core/contract/dist/sql-storage-
|
|
7
|
+
//#region ../../../2-sql/1-core/contract/dist/sql-storage-jJySr7bL.d.mts
|
|
8
8
|
//#region src/ir/storage-type-instance.d.ts
|
|
9
9
|
/**
|
|
10
10
|
* Sentinel kind for the legacy codec-triple shape persisted under
|
|
@@ -175,4 +175,4 @@ declare class SqlStorage<THash extends string = string> extends SqlNode implemen
|
|
|
175
175
|
}
|
|
176
176
|
//#endregion
|
|
177
177
|
export { toStorageTypeInstance as _, SqlNamespaceEntries as a, SqlStorage as c, StorageTypeInstance as d, StorageTypeInstanceInput as f, resolvedTypeParams as g, isStorageTypeInstance as h, SqlNamespaceBase as i, SqlStorageInput as l, isSqlAuthoringContributions as m, SqlAuthoringContributions as n, SqlNamespaceFactory as o, isMaterializedSqlNamespace as p, SqlNamespace as r, SqlNamespaceInput as s, CODEC_INSTANCE_KIND as t, SqlStorageTypeEntry as u };
|
|
178
|
-
//# sourceMappingURL=sql-storage-
|
|
178
|
+
//# sourceMappingURL=sql-storage-jJySr7bL-1Eh2i2r1.d.mts.map
|
package/dist/{sql-storage-BSxD7_vv-C4ugLH39.d.mts.map → sql-storage-jJySr7bL-1Eh2i2r1.d.mts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sql-storage-
|
|
1
|
+
{"version":3,"file":"sql-storage-jJySr7bL-1Eh2i2r1.d.mts","names":[],"sources":["../../../../2-sql/1-core/contract/dist/sql-storage-jJySr7bL.d.mts"],"mappings":";;;;;;;;;;;;;;;cAcc;;;;;;;;;UASJ,4BAA4B;WAC3B,aAAa;WACb;WACA;WACA,YAAY;;;;;;;;;UASb;WACC;WACA;WACA,aAAa;;;;;;;iBAOP,sBAAsB,OAAO,2BAA2B;;;;iBAIxD,mBAAmB;WACzB,aAAa;WACb;GACR,YAAY,SAAS,eAAe,KAAK,wDAAwD;;;;;;iBAMnF,sBAAsB,iBAAiB,SAAS;;;;;;;;;;KAU5D,sBAAsB,sBAAsB;UACvC;WACC;WACA,SAAS,SAAS,eAAe,SAAS;;;;;;KAMhD,uBAAuB,OAAO,sBAAsB;;;;;;;;UAQ/C,kCAAkC;WACjC,kBAAkB;;;;;;iBAMZ,4BAA4B,WAAW,qCAAqC,aAAa;UAChG,gBAAgB;WACf,aAAa,gBAAgB;WAC7B,QAAQ,eAAe;WACvB,YAAY,SAAS,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6B1C,sBAAsB,SAAS,eAAe,SAAS;WACjD,QAAQ,SAAS,eAAe;WAChC,WAAW,SAAS,eAAe;;;;;;;;;;;UAWpC;WACC;WACA;WACA,SAAS;WACT;EACT,cAAc;;;;;;;;uBAQO,yBAAyB,yBAAyB;oBACrD;oBACA,SAAS;WAClB,aAAa;;;;;;;;;;;;iBAYP,2BAA2B,aAAa,KAAK;cAChD,WAAW,uCAAuC,mBAAmB;WACxE,aAAa,gBAAgB;WAC7B,YAAY,SAAS,eAAe;WACpC,QAAQ,SAAS,eAAe;EACzC,YAAY,OAAO,gBAAgB"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { t as contractError } from "./contract-errors-BCN6RVI5-5IHBF_lg.mjs";
|
|
1
2
|
import { l as nameOf } from "./naming-Cc_t1q6s-CouBOmqZ.mjs";
|
|
2
3
|
import { ContractValidationError } from "@prisma/orm-framework/contract/contract-validation-error";
|
|
3
4
|
import { IRNodeBase, freezeNode } from "@prisma/orm-framework/components/ir";
|
|
4
5
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
5
6
|
import { asNamespaceId } from "@prisma/orm-framework/contract/types";
|
|
6
|
-
//#region ../../../2-sql/1-core/contract/dist/storage-table-
|
|
7
|
+
//#region ../../../2-sql/1-core/contract/dist/storage-table-ADhJ4Imk.mjs
|
|
7
8
|
/**
|
|
8
9
|
* SQL family IR node base. Carries the family-level `kind` discriminator
|
|
9
10
|
* `'sql'` and inherits the framework's `freezeNode` affordance.
|
|
@@ -223,12 +224,14 @@ var StorageColumn = class StorageColumn extends SqlNode {
|
|
|
223
224
|
nativeType;
|
|
224
225
|
codecId;
|
|
225
226
|
nullable;
|
|
227
|
+
many;
|
|
226
228
|
constructor(input) {
|
|
227
229
|
super();
|
|
230
|
+
if (Object.hasOwn(input, "elementNullable")) throw contractError("CONTRACT.ARGUMENT_INVALID", "StorageColumn elementNullable must be nested under many.", { meta: { reason: "sibling-elementNullable" } });
|
|
228
231
|
this.nativeType = input.nativeType;
|
|
229
232
|
this.codecId = input.codecId;
|
|
230
233
|
this.nullable = input.nullable;
|
|
231
|
-
|
|
234
|
+
this.many = input.many ?? false;
|
|
232
235
|
if (input.noCheck !== void 0) this.noCheck = input.noCheck;
|
|
233
236
|
if (input.typeParams !== void 0) this.typeParams = input.typeParams;
|
|
234
237
|
if (input.typeRef !== void 0) this.typeRef = input.typeRef;
|
|
@@ -302,4 +305,4 @@ var StorageTable = class StorageTable extends SqlNode {
|
|
|
302
305
|
//#endregion
|
|
303
306
|
export { PrimaryKey as a, StorageTable as c, Index as i, UniqueConstraint as l, ForeignKey as n, SqlNode as o, ForeignKeyReference as r, StorageColumn as s, CheckConstraint as t };
|
|
304
307
|
|
|
305
|
-
//# sourceMappingURL=storage-table-
|
|
308
|
+
//# sourceMappingURL=storage-table-ADhJ4Imk-0FbJXvSZ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-table-ADhJ4Imk-0FbJXvSZ.mjs","names":[],"sources":["../../../../2-sql/1-core/contract/dist/storage-table-ADhJ4Imk.mjs"],"sourcesContent":["import { t as contractError } from \"./contract-errors-BCN6RVI5.mjs\";\nimport { nameOf } from \"@internal/sql-schema-ir/naming\";\nimport { IRNodeBase, freezeNode } from \"@internal/framework-components/ir\";\nimport { ContractValidationError } from \"@internal/contract/contract-validation-error\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { asNamespaceId } from \"@internal/contract/types\";\n//#region src/ir/sql-node.ts\n/**\n* SQL family IR node base. Carries the family-level `kind` discriminator\n* `'sql'` and inherits the framework's `freezeNode` affordance.\n*\n* Single family-level discriminator (not per-leaf) reflects the fact that\n* SQL IR has no polymorphic dispatch today — verifiers and serializers\n* walk by structural position (`storage.tables[name].columns[name]`),\n* not by inspecting `kind`. The abstract bar for per-leaf discriminators\n* isn't earned until a future polymorphic consumer arrives.\n*\n* `kind` is installed as a non-enumerable own property on every instance,\n* which keeps three things clean simultaneously:\n*\n* - `JSON.stringify(node)` produces the canonical pre-lift JSON envelope\n* shape (no `kind` field), so emitted contract.json files and the\n* `validateSqlContractFully` arktype schemas stay unchanged.\n* - Test assertions that use `toEqual({...})` against the pre-lift flat\n* shape continue to pass — only enumerable own properties are\n* compared.\n* - Direct access (`node.kind`) and runtime narrowing\n* (`if (node.kind === 'sql')`) still work, so future polymorphic\n* dispatch can begin reading `kind` without a runtime change.\n*\n* Future per-leaf overrides land cleanly: a class that gains a\n* polymorphic-dispatch consumer (e.g. an enum type instance walked\n* alongside other types) overrides `kind` with its narrower literal\n* at that leaf level. Per-leaf overrides will use enumerable kind\n* (matching the Mongo per-class-discriminator precedent) because they\n* encode dispatch-relevant information that callers need to see in\n* JSON envelopes; the family-level `'sql'` is uniform across all SQL\n* IR and carries no dispatch-relevant information.\n*/\nvar SqlNode = class extends IRNodeBase {\n\tkind;\n\tconstructor() {\n\t\tsuper();\n\t\tObject.defineProperty(this, \"kind\", {\n\t\t\tvalue: \"sql\",\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true\n\t\t});\n\t}\n};\n//#endregion\n//#region src/ir/check-constraint.ts\n/**\n* SQL Contract IR node for a table-level check constraint, name-identified:\n* `name` is the full physical name; a present `prefix` marks the constraint as\n* wire-named (`name` is `formatWireName(prefix, <8hex>)` over the expression's\n* content hash), an absent `prefix` marks it exact (the name is adopted\n* verbatim). This is the convention indexes and RLS policies already use — see\n* ADR 234, \"Content-addressed wire names for Postgres-normalized objects\".\n*\n* The predicate is opaque: one SQL string, never parsed and never rendered\n* from structured parts. A database reprints predicates in its own normalized\n* form, so a wire-named check is compared by name — the hash already commits\n* to the expression the contract declared.\n*/\nvar CheckConstraint = class CheckConstraint extends SqlNode {\n\tname;\n\texpression;\n\tconstructor(input) {\n\t\tsuper();\n\t\tconst name = nameOf(input.naming);\n\t\tif (name.length === 0) throw new ContractValidationError(\"CheckConstraint: every check constraint carries a full physical name.\", \"storage\");\n\t\tthis.name = name;\n\t\tif (input.naming.kind === \"wire\") this.prefix = input.naming.prefix;\n\t\tthis.expression = input.expression;\n\t\tfreezeNode(this);\n\t}\n\t/**\n\t* Normalizes either shape into an instance: an existing `CheckConstraint`\n\t* passes through, canonical input is constructed. Callers that accept\n\t* \"instance or input\" go through this, so the constructor keeps one\n\t* canonical shape instead of widening to a union.\n\t*/\n\tstatic from(value) {\n\t\treturn value instanceof CheckConstraint ? value : new CheckConstraint(value);\n\t}\n};\n//#endregion\n//#region src/ir/sql-index.ts\n/**\n* SQL Contract IR node for a table-level secondary index, name-identified:\n* `name` is the full physical name; a present `prefix` marks the index as\n* wire-named (`name` is `formatWireName(prefix, <8hex>)`), an absent `prefix`\n* marks it exact (the name is adopted verbatim).\n*\n* `expression`, `where`, and `unique` are genuine SQL-family attributes —\n* functional and partial indexes are standard SQL supported natively by\n* Postgres and SQLite alike, and the family IR must be able to represent\n* anything any SQL target can introspect. A target declining to AUTHOR them\n* (SQLite's rejection at namespace construction) is a capability decision,\n* not evidence of target-specificity.\n*\n* Note that this class shadows the global TypeScript `Index` lib type\n* at the family-shared name; consumer files that need both should\n* alias one (e.g.\n* `import { Index as SqlIndexNode } from '@internal/sql-contract/types'`).\n*/\nvar Index = class Index extends SqlNode {\n\tname;\n\tunique;\n\tconstructor(input) {\n\t\tsuper();\n\t\tconst name = nameOf(input.naming);\n\t\tif (name.length === 0) throw new ContractValidationError(\"Index: every index carries a full physical name; an expression index must be explicitly named (a default name cannot be derived from an expression).\", \"storage\");\n\t\tif (input.columns === void 0 === (input.expression === void 0)) throw new ContractValidationError(`Index \"${name}\": exactly one of columns or expression must be set.`, \"storage\");\n\t\tthis.name = name;\n\t\tthis.unique = input.unique;\n\t\tif (input.naming.kind === \"wire\") this.prefix = input.naming.prefix;\n\t\tif (input.columns !== void 0) this.columns = input.columns;\n\t\tif (input.expression !== void 0) this.expression = input.expression;\n\t\tif (input.where !== void 0) this.where = input.where;\n\t\tif (input.type !== void 0) this.type = input.type;\n\t\tif (input.options !== void 0) this.options = input.options;\n\t\tfreezeNode(this);\n\t}\n\tstatic from(value) {\n\t\treturn value instanceof Index ? value : new Index(value);\n\t}\n};\n//#endregion\n//#region src/ir/foreign-key-reference.ts\n/**\n* SQL Contract IR node for one side (source or target) of a foreign-key\n* declaration. Carries the full coordinate: namespace, table, and columns.\n*\n* Cross-space discrimination is based on `spaceId` presence: absent means\n* local (same contract-space); present means cross-space (the referenced\n* table lives in the contract-space identified by `spaceId`).\n*\n* For local references `spaceId` is absent from JSON, keeping the serialized\n* shape byte-identical to contracts authored before cross-space support was\n* added. For cross-space references `spaceId` appears in JSON so round-trips\n* are lossless.\n*\n* Use `UNBOUND_NAMESPACE_ID` from `@internal/framework-components/ir`\n* as the sentinel `namespaceId` for single-namespace (unbound) references.\n*/\nvar ForeignKeyReference = class ForeignKeyReference extends SqlNode {\n\tnamespaceId;\n\ttableName;\n\tcolumns;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.namespaceId = asNamespaceId(input.namespaceId);\n\t\tthis.tableName = input.tableName;\n\t\tthis.columns = input.columns;\n\t\tif (input.spaceId !== void 0) this.spaceId = input.spaceId;\n\t\tfreezeNode(this);\n\t}\n\tstatic from(value) {\n\t\treturn value instanceof ForeignKeyReference ? value : new ForeignKeyReference(value);\n\t}\n};\n//#endregion\n//#region src/ir/foreign-key.ts\n/**\n* SQL Contract IR node for a table-level foreign-key declaration — the\n* referential constraint only (source, target, `onDelete`/`onUpdate`).\n*\n* A persisted `foreignKeys[]` entry always denotes a real constraint: whether\n* to emit the constraint at all, and whether to back it with an index, are\n* authoring-time decisions (PSL `@relation(index:)`, TS `fk({ constraint,\n* index })`) resolved once at `contract emit` — a `constraint: false` FK\n* simply has no entry here, and a backing index (if any) is its own discrete,\n* named entry in the table's `indexes[]`.\n*\n* Each FK carries explicit `source` and `target` {@link ForeignKeyReference}\n* coordinates (namespace, table, columns). For single-namespace contracts the\n* sentinel `UNBOUND_NAMESPACE_ID` appears on both sides.\n*\n* The nested references are normalised to {@link ForeignKeyReference}\n* instances inside the constructor so downstream walks see a uniform AST\n* regardless of whether the input was a JSON literal or an already-constructed\n* class instance.\n*/\nvar ForeignKey = class ForeignKey extends SqlNode {\n\tsource;\n\ttarget;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.source = ForeignKeyReference.from(input.source);\n\t\tthis.target = ForeignKeyReference.from(input.target);\n\t\tif (input.name !== void 0) this.name = input.name;\n\t\tif (input.onDelete !== void 0) this.onDelete = input.onDelete;\n\t\tif (input.onUpdate !== void 0) this.onUpdate = input.onUpdate;\n\t\tfreezeNode(this);\n\t}\n\tstatic from(value) {\n\t\treturn value instanceof ForeignKey ? value : new ForeignKey(value);\n\t}\n};\n//#endregion\n//#region src/ir/primary-key.ts\n/**\n* SQL Contract IR node for a table's primary-key constraint.\n*/\nvar PrimaryKey = class PrimaryKey extends SqlNode {\n\tcolumns;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.columns = input.columns;\n\t\tif (input.name !== void 0) this.name = input.name;\n\t\tfreezeNode(this);\n\t}\n\tstatic from(value) {\n\t\treturn value instanceof PrimaryKey ? value : new PrimaryKey(value);\n\t}\n};\n//#endregion\n//#region src/ir/storage-column.ts\n/**\n* SQL Contract IR node for a single column entry in `StorageTable.columns`.\n*\n* Single concrete family-shared class — every SQL target reads the\n* same column shape today, so there is no per-target subclass. The\n* class type accepts any caller that constructs via\n* `new StorageColumn(input)`; literal construction sites must pass\n* through the constructor or the family-base hydration walker.\n*\n* The column's `name` is not on the class — columns are keyed by name\n* in the parent `StorageTable.columns: Record<string, StorageColumn>`\n* map, so a `name` field would be redundant with the key.\n*/\nvar StorageColumn = class StorageColumn extends SqlNode {\n\tnativeType;\n\tcodecId;\n\tnullable;\n\tmany;\n\tconstructor(input) {\n\t\tsuper();\n\t\tif (Object.hasOwn(input, \"elementNullable\")) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", \"StorageColumn elementNullable must be nested under many.\", { meta: { reason: \"sibling-elementNullable\" } });\n\t\tthis.nativeType = input.nativeType;\n\t\tthis.codecId = input.codecId;\n\t\tthis.nullable = input.nullable;\n\t\tthis.many = input.many ?? false;\n\t\tif (input.noCheck !== void 0) this.noCheck = input.noCheck;\n\t\tif (input.typeParams !== void 0) this.typeParams = input.typeParams;\n\t\tif (input.typeRef !== void 0) this.typeRef = input.typeRef;\n\t\tif (input.default !== void 0) this.default = input.default;\n\t\tif (input.control !== void 0) this.control = input.control;\n\t\tif (input.valueSet !== void 0) this.valueSet = input.valueSet;\n\t\tfreezeNode(this);\n\t}\n\tstatic from(value) {\n\t\treturn value instanceof StorageColumn ? value : new StorageColumn(value);\n\t}\n};\n//#endregion\n//#region src/ir/unique-constraint.ts\n/**\n* SQL Contract IR node for a table-level unique constraint.\n*/\nvar UniqueConstraint = class UniqueConstraint extends SqlNode {\n\tcolumns;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.columns = input.columns;\n\t\tif (input.name !== void 0) this.name = input.name;\n\t\tfreezeNode(this);\n\t}\n\tstatic from(value) {\n\t\treturn value instanceof UniqueConstraint ? value : new UniqueConstraint(value);\n\t}\n};\n//#endregion\n//#region src/ir/storage-table.ts\n/**\n* SQL Contract IR node for a single table entry in a namespace's\n* `tables` map.\n*\n* The constructor normalises nested IR-class fields (columns, primary\n* key, uniques, indexes, foreign keys) into the appropriate class\n* instances so downstream walks see a uniform AST regardless of whether\n* the input was a JSON literal or an already-constructed class.\n*\n* The table's `name` is not on the class — tables are keyed by name in\n* the parent namespace's `tables: Record<string, StorageTable>` map.\n*/\nvar StorageTable = class StorageTable extends SqlNode {\n\tcolumns;\n\tuniques;\n\tindexes;\n\tforeignKeys;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.columns = Object.freeze(Object.fromEntries(Object.entries(input.columns).map(([name, col]) => [name, StorageColumn.from(col)])));\n\t\tif (input.primaryKey !== void 0) this.primaryKey = PrimaryKey.from(input.primaryKey);\n\t\tthis.uniques = Object.freeze(input.uniques.map(UniqueConstraint.from));\n\t\tthis.indexes = Object.freeze(input.indexes.map(Index.from));\n\t\tthis.foreignKeys = Object.freeze(input.foreignKeys.map(ForeignKey.from));\n\t\tif (input.control !== void 0) this.control = input.control;\n\t\tif (input.checks !== void 0 && input.checks.length > 0) this.checks = Object.freeze(input.checks.map(CheckConstraint.from));\n\t\tfreezeNode(this);\n\t}\n\t/**\n\t* Runtime guard that a namespace `table` entry is really a `StorageTable`.\n\t* The compiler already types the entry as `StorageTable`, but a\n\t* freshly-deserialized contract may carry plain JSON at that slot until\n\t* hydration; this duck-types the structural shape. Accepts `undefined` so\n\t* optional-chained entry lookups pass straight through.\n\t*/\n\tstatic is(value) {\n\t\tif (typeof value !== \"object\" || value === null) return false;\n\t\treturn \"columns\" in value && \"uniques\" in value && \"indexes\" in value && \"foreignKeys\" in value;\n\t}\n\tstatic assert(value, coordinate) {\n\t\tif (!StorageTable.is(value)) throw new InternalError(`Expected a StorageTable at ${coordinate}`);\n\t}\n};\n//#endregion\nexport { ForeignKey as a, CheckConstraint as c, PrimaryKey as i, SqlNode as l, UniqueConstraint as n, ForeignKeyReference as o, StorageColumn as r, Index as s, StorageTable as t };\n\n//# sourceMappingURL=storage-table-ADhJ4Imk.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,IAAI,UAAU,cAAc,WAAW;CACtC;CACA,cAAc;EACb,MAAM;EACN,OAAO,eAAe,MAAM,QAAQ;GACnC,OAAO;GACP,UAAU;GACV,YAAY;GACZ,cAAc;EACf,CAAC;CACF;AACD;;;;;;;;;;;;;;AAgBA,IAAI,kBAAkB,MAAM,wBAAwB,QAAQ;CAC3D;CACA;CACA,YAAY,OAAO;EAClB,MAAM;EACN,MAAM,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,IAAI,MAAM,IAAI,CAAC;EAC1D,KAAK,cAAc,OAAO,OAAO,MAAM,YAAY,IAAI,WAAW,IAAI,CAAC;EACvE,IAAI,MAAM,YAAY,KAAK,GAAG,KAAK,UAAU,MAAM;EACnD,IAAI,MAAM,WAAW,KAAK,KAAK,MAAM,OAAO,SAAS,GAAG,KAAK,SAAS,OAAO,OAAO,MAAM,OAAO,IAAI,gBAAgB,IAAI,CAAC;EAC1H,WAAW,IAAI;CAChB;;;;;;;;CAQA,OAAO,GAAG,OAAO;EAChB,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;EACxD,OAAO,aAAa,SAAS,aAAa,SAAS,aAAa,SAAS,iBAAiB;CAC3F;CACA,OAAO,OAAO,OAAO,YAAY;EAChC,IAAI,CAAC,aAAa,GAAG,KAAK,GAAG,MAAM,IAAI,cAAc,8BAA8B,YAAY;CAChG;AACD"}
|
package/dist/{storage-table-DSeWszOL-CI-cItEK.d.mts → storage-table-DLFvP77v-BfO2iOT4.d.mts}
RENAMED
|
@@ -5,7 +5,7 @@ import { n as ForeignKeyInput, t as ForeignKey } from "./foreign-key-C-iTPuRT-C9
|
|
|
5
5
|
import { i as UniqueConstraintInput, n as PrimaryKeyInput, r as UniqueConstraint, t as PrimaryKey } from "./unique-constraint-M5TlQnJQ-BiIHJ85k.mjs";
|
|
6
6
|
import { r as IndexInput, t as Index } from "./sql-index-ByAAE7K8-DKj2V86p.mjs";
|
|
7
7
|
import { ColumnDefault, ControlPolicy, ValueSetRef } from "@prisma/orm-framework/contract/types";
|
|
8
|
-
//#region ../../../2-sql/1-core/contract/dist/storage-table-
|
|
8
|
+
//#region ../../../2-sql/1-core/contract/dist/storage-table-DLFvP77v.d.mts
|
|
9
9
|
//#region src/ir/storage-column.d.ts
|
|
10
10
|
/**
|
|
11
11
|
* Hydration / construction input shape for {@link StorageColumn}. Mirrors
|
|
@@ -17,11 +17,13 @@ import { ColumnDefault, ControlPolicy, ValueSetRef } from "@prisma/orm-framework
|
|
|
17
17
|
* other, not both); the constructor preserves whichever caller-side
|
|
18
18
|
* choice the input encodes.
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
type StorageColumnMultiplicity = false | {
|
|
21
|
+
readonly elementNullable: boolean;
|
|
22
|
+
};
|
|
23
|
+
type StorageColumnInput = {
|
|
21
24
|
readonly nativeType: string;
|
|
22
25
|
readonly codecId: string;
|
|
23
26
|
readonly nullable: boolean;
|
|
24
|
-
readonly many?: boolean;
|
|
25
27
|
readonly typeParams?: Record<string, unknown>;
|
|
26
28
|
readonly typeRef?: string;
|
|
27
29
|
readonly default?: ColumnDefault;
|
|
@@ -29,7 +31,8 @@ interface StorageColumnInput {
|
|
|
29
31
|
readonly valueSet?: ValueSetRef;
|
|
30
32
|
/** Generated-check kinds the author declined for this column. Presence means opted out; never an empty array. */
|
|
31
33
|
readonly noCheck?: readonly CheckKind[];
|
|
32
|
-
|
|
34
|
+
readonly many?: StorageColumnMultiplicity;
|
|
35
|
+
};
|
|
33
36
|
/**
|
|
34
37
|
* SQL Contract IR node for a single column entry in `StorageTable.columns`.
|
|
35
38
|
*
|
|
@@ -47,7 +50,7 @@ declare class StorageColumn extends SqlNode {
|
|
|
47
50
|
readonly nativeType: string;
|
|
48
51
|
readonly codecId: string;
|
|
49
52
|
readonly nullable: boolean;
|
|
50
|
-
readonly many
|
|
53
|
+
readonly many: StorageColumnMultiplicity;
|
|
51
54
|
readonly typeParams?: Record<string, unknown>;
|
|
52
55
|
readonly typeRef?: string;
|
|
53
56
|
readonly default?: ColumnDefault;
|
|
@@ -102,4 +105,4 @@ declare class StorageTable extends SqlNode {
|
|
|
102
105
|
}
|
|
103
106
|
//#endregion
|
|
104
107
|
export { StorageTableInput as i, StorageColumnInput as n, StorageTable as r, StorageColumn as t };
|
|
105
|
-
//# sourceMappingURL=storage-table-
|
|
108
|
+
//# sourceMappingURL=storage-table-DLFvP77v-BfO2iOT4.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-table-DLFvP77v-BfO2iOT4.d.mts","names":[],"sources":["../../../../2-sql/1-core/contract/dist/storage-table-DLFvP77v.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;KAkBK;WACM;;KAEN;WACM;WACA;WACA;WACA,aAAa;WACb;WACA,UAAU;WACV,UAAU;WACV,WAAW;;WAEX,mBAAmB;WACnB,OAAO;;;;;;;;;;;;;;;cAeJ,sBAAsB;WACzB;WACA;WACA;WACA,MAAM;WACN,aAAa;WACb;WACA,UAAU;WACV,UAAU;WACV,WAAW;;WAEX,mBAAmB;EAC5B,YAAY,OAAO;SACZ,KAAK,OAAO,gBAAgB,qBAAqB;;;;UAIhD;WACC,SAAS,eAAe,gBAAgB;WACxC,aAAa,aAAa;WAC1B,SAAS,cAAc,mBAAmB;WAC1C,SAAS,cAAc,QAAQ;WAC/B,aAAa,cAAc,aAAa;WACxC,UAAU;WACV,SAAS,cAAc,kBAAkB;;;;;;;;;;;;;;cActC,qBAAqB;WACxB,SAAS,SAAS,eAAe;WACjC,SAAS,cAAc;WACvB,SAAS,cAAc;WACvB,aAAa,cAAc;WAC3B,aAAa;WACb,UAAU;WACV,SAAS,cAAc;EAChC,YAAY,OAAO;;;;;;;;SAQZ,GAAG,OAAO,2BAA2B,SAAS;SAC9C,OAAO,OAAO,0BAA0B,6BAA6B,SAAS"}
|
|
@@ -6,7 +6,7 @@ import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
|
6
6
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
7
7
|
import { canonicalStringify } from "@prisma/orm-framework/utils/canonical-stringify";
|
|
8
8
|
import { isArrayEqual } from "@prisma/orm-framework/utils/array-equal";
|
|
9
|
-
//#region ../../../2-sql/1-core/schema-ir/dist/types-
|
|
9
|
+
//#region ../../../2-sql/1-core/schema-ir/dist/types-B9rf_EdI.mjs
|
|
10
10
|
/**
|
|
11
11
|
* A literal default in the canonical form of the column's data type (ADR 254), element by element
|
|
12
12
|
* for a list column. A `Date` is read as its ISO text first. A value the type refuses is kept as it
|
|
@@ -31,6 +31,10 @@ function defaultInCanonicalForm(value, toCanonicalForm, list) {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
function inCanonicalForm(value, toCanonicalForm) {
|
|
34
|
+
if (value === null) return {
|
|
35
|
+
value,
|
|
36
|
+
refusal: void 0
|
|
37
|
+
};
|
|
34
38
|
try {
|
|
35
39
|
return {
|
|
36
40
|
value: toCanonicalForm(value),
|
|
@@ -818,4 +822,4 @@ var SqlSchemaIR = class extends SqlSchemaIRNode {
|
|
|
818
822
|
//#endregion
|
|
819
823
|
export { relationalNodeGranularity as _, SqlColumnIR as a, SqlSchemaIR as c, SqlUniqueIR as d, assertNode as f, relationalNodeEntityKind as g, defineNonEnumerable as h, SqlColumnDefaultIR as i, SqlSchemaIRNode as l, defaultInCanonicalForm as m, RelationalSchemaNodeKind as n, SqlForeignKeyIR as o, contractDefaultRefusal as p, SqlCheckConstraintIR as r, SqlIndexIR as s, PrimaryKey as t, SqlTableIR as u };
|
|
820
824
|
|
|
821
|
-
//# sourceMappingURL=types-
|
|
825
|
+
//# sourceMappingURL=types-B9rf_EdI-CEYrMMeO.mjs.map
|