@prisma/orm-family-sql 8.0.0-rc.2-dev.3 → 8.0.0-rc.20-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -6
- package/dist/{aggregate-descriptor-registry-C7hel5O7.mjs → aggregate-descriptor-registry-ZrKjxwQe.mjs} +5 -5
- package/dist/aggregate-descriptor-registry-ZrKjxwQe.mjs.map +1 -0
- package/dist/ast-D0miQ1B6.mjs +372 -0
- package/dist/ast-D0miQ1B6.mjs.map +1 -0
- package/dist/ast-YEMe_B8z.d.mts +292 -0
- package/dist/ast-YEMe_B8z.d.mts.map +1 -0
- package/dist/attribute-specs-DA_RwQFB.d.mts +114 -0
- package/dist/attribute-specs-DA_RwQFB.d.mts.map +1 -0
- package/dist/{authored-check-naming-Hf9990DV.mjs → authored-check-naming-BHGJhjqn.mjs} +5 -5
- package/dist/authored-check-naming-BHGJhjqn.mjs.map +1 -0
- package/dist/{authored-check-naming-BWBe-PVE.d.mts → authored-check-naming-D-o196ry.d.mts} +3 -3
- package/dist/authored-check-naming-D-o196ry.d.mts.map +1 -0
- package/dist/authoring-entity-types-CgKIgWq5-pEdfjam5.d.mts +9 -0
- package/dist/authoring-entity-types-CgKIgWq5-pEdfjam5.d.mts.map +1 -0
- package/dist/builder.d.mts +4 -3
- package/dist/builder__runtime.d.mts +29 -31
- package/dist/builder__runtime.d.mts.map +1 -1
- package/dist/builder__runtime.mjs +261 -191
- package/dist/builder__runtime.mjs.map +1 -1
- package/dist/builder__types.d.mts +6 -3
- package/dist/{canonicalization-hooks-dmXkOR4a.mjs → canonicalization-hooks-Ce1v_TDl.mjs} +2 -2
- package/dist/canonicalization-hooks-Ce1v_TDl.mjs.map +1 -0
- package/dist/{canonicalization-hooks-CYnW_sGn.d.mts → canonicalization-hooks-DyapQ0my.d.mts} +2 -2
- package/dist/canonicalization-hooks-DyapQ0my.d.mts.map +1 -0
- package/dist/{check-constraint-B7qGu6rc-HvQjjX82.d.mts → check-constraint-B7qGu6rc-Bk2ezWXu.d.mts} +4 -4
- package/dist/check-constraint-B7qGu6rc-Bk2ezWXu.d.mts.map +1 -0
- package/dist/{codec-descriptor-registry-N0dhtKaH.mjs → codec-descriptor-registry-CiiFzMtb.mjs} +13 -40
- package/dist/codec-descriptor-registry-CiiFzMtb.mjs.map +1 -0
- package/dist/collection-methods-BB8YH69u.d.mts +1 -0
- package/dist/collection-methods-D2UnCS0S-DOy2qHYS.d.mts +77 -0
- package/dist/collection-methods-D2UnCS0S-DOy2qHYS.d.mts.map +1 -0
- package/dist/{config-types-D9fdKG3g.d.mts → config-types-C-1mIiJO.d.mts} +5 -5
- package/dist/config-types-C-1mIiJO.d.mts.map +1 -0
- package/dist/{config-types-gAm54C_v.mjs → config-types-DkEeq_qq.mjs} +10 -6
- package/dist/config-types-DkEeq_qq.mjs.map +1 -0
- package/dist/{contract-builder-D4a5dT7j.mjs → contract-builder-50lF0kz1.mjs} +431 -226
- package/dist/contract-builder-50lF0kz1.mjs.map +1 -0
- package/dist/contract-builder-C_Zi57iD.d.mts +1967 -0
- package/dist/contract-builder-C_Zi57iD.d.mts.map +1 -0
- package/dist/contract-emitter.d.mts +4 -7
- package/dist/contract-emitter.d.mts.map +1 -1
- package/dist/contract-emitter.mjs +1 -1
- package/dist/{contract-errors-BCN6RVI5-5IHBF_lg.mjs → contract-errors-BCN6RVI5-DoH6b_KZ.mjs} +2 -2
- package/dist/contract-errors-BCN6RVI5-DoH6b_KZ.mjs.map +1 -0
- package/dist/contract-prisma7__provider.d.mts +97 -0
- package/dist/contract-prisma7__provider.d.mts.map +1 -0
- package/dist/contract-prisma7__provider.mjs +2011 -0
- package/dist/contract-prisma7__provider.mjs.map +1 -0
- package/dist/contract-psl.d.mts +18 -29
- package/dist/contract-psl.d.mts.map +1 -1
- package/dist/contract-psl.mjs +1 -1
- package/dist/contract-psl__attribute-specs.d.mts +2 -0
- package/dist/contract-psl__attribute-specs.mjs +2 -0
- package/dist/contract-psl__default-table-name.d.mts +7 -0
- package/dist/contract-psl__default-table-name.d.mts.map +1 -0
- package/dist/contract-psl__default-table-name.mjs +2 -0
- package/dist/contract-psl__diagnostics.d.mts +12 -0
- package/dist/contract-psl__diagnostics.d.mts.map +1 -0
- package/dist/contract-psl__diagnostics.mjs +2 -0
- package/dist/contract-psl__map-names.d.mts +16 -0
- package/dist/contract-psl__map-names.d.mts.map +1 -0
- package/dist/contract-psl__map-names.mjs +21 -0
- package/dist/contract-psl__map-names.mjs.map +1 -0
- package/dist/contract-psl__provider.d.mts +3 -3
- package/dist/contract-psl__provider.d.mts.map +1 -1
- package/dist/contract-psl__provider.mjs +95 -46
- package/dist/contract-psl__provider.mjs.map +1 -1
- package/dist/contract-ts.d.mts +5 -5
- package/dist/contract-ts.mjs +5 -4
- 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 +4 -4
- package/dist/contract-ts__contract-builder.mjs +4 -3
- package/dist/{contract-view-BMR5IWk4.mjs → contract-view-DqpzeYeE.mjs} +2 -2
- package/dist/contract-view-DqpzeYeE.mjs.map +1 -0
- package/dist/{contract-view-CPHxoAEX.d.mts → contract-view-DuB35or0.d.mts} +3 -3
- package/dist/contract-view-DuB35or0.d.mts.map +1 -0
- package/dist/contract.d.mts +30 -28
- package/dist/contract.mjs +23 -18
- package/dist/contract__authored-check-naming.d.mts +1 -1
- package/dist/contract__authored-check-naming.mjs +1 -1
- package/dist/contract__canonicalization-hooks.d.mts +1 -1
- package/dist/contract__canonicalization-hooks.mjs +1 -1
- package/dist/contract__contract-view.d.mts +1 -1
- package/dist/contract__contract-view.mjs +1 -1
- package/dist/contract__data-type-support.d.mts +2 -0
- package/dist/contract__data-type-support.mjs +2 -0
- package/dist/contract__data-type.d.mts +2 -0
- package/dist/contract__data-type.mjs +3 -0
- package/dist/contract__entity-handle-lowering-hook.d.mts +2 -2
- package/dist/contract__entity-handle-lowering-hook.mjs +2 -2
- 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__foreign-key-materialization.d.mts +2 -2
- package/dist/contract__foreign-key-materialization.mjs +3 -2
- package/dist/contract__index-naming.d.mts +2 -2
- package/dist/contract__index-naming.mjs +2 -2
- package/dist/contract__index-type-validation.d.mts +2 -2
- package/dist/contract__index-type-validation.mjs +1 -1
- package/dist/contract__index-types.d.mts +3 -3
- package/dist/contract__index-types.mjs +2 -2
- package/dist/contract__referential-action-sql.d.mts +1 -1
- package/dist/contract__referential-action-sql.mjs +1 -1
- package/dist/contract__resolve-storage-table.d.mts +1 -1
- package/dist/contract__resolve-storage-table.mjs +1 -1
- package/dist/contract__sql-expression.d.mts +2 -0
- package/dist/contract__sql-expression.mjs +2 -0
- package/dist/contract__types.d.mts +12 -12
- package/dist/contract__types.mjs +4 -4
- package/dist/contract__validators.d.mts +2 -2
- package/dist/contract__validators.mjs +3 -3
- package/dist/contract__value-set-derivation-hook.d.mts +1 -1
- package/dist/contract__value-set-derivation-hook.mjs +1 -1
- package/dist/control-BK50zF6c.mjs +2721 -0
- package/dist/control-BK50zF6c.mjs.map +1 -0
- package/dist/control-ChAUdOOu.d.mts +1416 -0
- package/dist/control-ChAUdOOu.d.mts.map +1 -0
- package/dist/{control-adapter-C99J7aEF-B7eQd7vD.d.mts → control-adapter-Bn0uhplA-BzP2uPqJ.d.mts} +27 -44
- package/dist/control-adapter-Bn0uhplA-BzP2uPqJ.d.mts.map +1 -0
- package/dist/control-adapter-NZ2kKc4x.d.mts +13 -0
- package/dist/control-adapter-NZ2kKc4x.d.mts.map +1 -0
- package/dist/control-adapter-SlQkTEwT.mjs +16 -0
- package/dist/control-adapter-SlQkTEwT.mjs.map +1 -0
- package/dist/data-type-BFSpaotu.mjs +52 -0
- package/dist/data-type-BFSpaotu.mjs.map +1 -0
- package/dist/data-type-DJIvKQHf.d.mts +158 -0
- package/dist/data-type-DJIvKQHf.d.mts.map +1 -0
- package/dist/data-type-support-BhSoPUFj.mjs +9 -0
- package/dist/data-type-support-BhSoPUFj.mjs.map +1 -0
- package/dist/data-type-support-CXpA0ex-.d.mts +7 -0
- package/dist/data-type-support-CXpA0ex-.d.mts.map +1 -0
- package/dist/{db-D18PrXKW-DvTv4JFn.d.mts → db-D1d75IvM-D4mRDC6w.d.mts} +123 -128
- package/dist/db-D1d75IvM-D4mRDC6w.d.mts.map +1 -0
- package/dist/{ddl-types-CXx4vPz6-BsgrnSUY.d.mts → ddl-types-By5mT2_S-CdaaFvsX.d.mts} +24 -29
- package/dist/ddl-types-By5mT2_S-CdaaFvsX.d.mts.map +1 -0
- package/dist/default-mapping-CAOONlKQ-4m07nb-O.d.mts +39 -0
- package/dist/default-mapping-CAOONlKQ-4m07nb-O.d.mts.map +1 -0
- package/dist/default-table-name-BfFY8qYR-CWZFDX6v.mjs +9 -0
- package/dist/default-table-name-BfFY8qYR-CWZFDX6v.mjs.map +1 -0
- package/dist/derived-checks-D5HVRvqN-BJx1gwPA.mjs +1508 -0
- package/dist/derived-checks-D5HVRvqN-BJx1gwPA.mjs.map +1 -0
- package/dist/{derived-checks-DPdD01O0-DGqOFjs6.d.mts → derived-checks-DpPkO6Dt-9U9UJZOo.d.mts} +4 -4
- package/dist/derived-checks-DpPkO6Dt-9U9UJZOo.d.mts.map +1 -0
- package/dist/diagnostics-RHJxoiIk.mjs +23 -0
- package/dist/diagnostics-RHJxoiIk.mjs.map +1 -0
- package/dist/{diff-DbTNVm2f.d.mts → diff-1qHOLoUB.d.mts} +23 -10
- package/dist/diff-1qHOLoUB.d.mts.map +1 -0
- package/dist/diff-C1rFOhek.mjs +21 -0
- package/dist/diff-C1rFOhek.mjs.map +1 -0
- package/dist/{dist-ZK6oeI5e.mjs → dist-C8Y-PPuE.mjs} +36 -212
- package/dist/dist-C8Y-PPuE.mjs.map +1 -0
- package/dist/{dist-C_q1_QR9.mjs → dist-CHz1hF8M.mjs} +2 -2
- package/dist/dist-CHz1hF8M.mjs.map +1 -0
- package/dist/{dist-x6jvtkKM.mjs → dist-CMDXybwm.mjs} +2 -2
- package/dist/dist-CMDXybwm.mjs.map +1 -0
- package/dist/{driver-types-BQtRkOJ0-Bv2RPSfr.d.mts → driver-types-DRsYeq3j-BimeCnUk.d.mts} +11 -2
- package/dist/driver-types-DRsYeq3j-BimeCnUk.d.mts.map +1 -0
- package/dist/entity-handle-lowering-hook-BJZSlVVF.mjs +16 -0
- package/dist/entity-handle-lowering-hook-BJZSlVVF.mjs.map +1 -0
- package/dist/{entity-handle-lowering-hook-CIvRKBfa.d.mts → entity-handle-lowering-hook-BuvLtgFi.d.mts} +8 -11
- package/dist/entity-handle-lowering-hook-BuvLtgFi.d.mts.map +1 -0
- package/dist/{entity-kinds-B5cUFU22.d.mts → entity-kinds-BPG2xCZV.d.mts} +7 -7
- package/dist/entity-kinds-BPG2xCZV.d.mts.map +1 -0
- package/dist/{entity-kinds-D7vwoN_T-CCBwFJy0.mjs → entity-kinds-JR5SAm5h-DOH6VUtL.mjs} +31 -28
- package/dist/entity-kinds-JR5SAm5h-DOH6VUtL.mjs.map +1 -0
- package/dist/{errors-B5g0xWro-mWH2C07F.mjs → errors-B5g0xWro-C8plbqga.mjs} +2 -2
- package/dist/errors-B5g0xWro-C8plbqga.mjs.map +1 -0
- package/dist/errors.d.mts +1 -1
- package/dist/errors.d.mts.map +1 -1
- package/dist/errors.mjs +1 -1
- package/dist/exports-C3wGYtID-D65DEUTC.mjs +2389 -0
- package/dist/exports-C3wGYtID-D65DEUTC.mjs.map +1 -0
- package/dist/{expression-FJK6Ar-d.d.mts → expression-6ld_ZQL6-fOuazzzm.d.mts} +37 -16
- package/dist/expression-6ld_ZQL6-fOuazzzm.d.mts.map +1 -0
- package/dist/expression-CieaNuRM-B1uVqxwd.d.mts +22 -0
- package/dist/expression-CieaNuRM-B1uVqxwd.d.mts.map +1 -0
- package/dist/expression-D8HstQiB.d.mts +2 -0
- package/dist/{expression-CX5mTA-z.mjs → expression-impl-B-XNINxr-BhN2sysZ.mjs} +41 -18
- package/dist/expression-impl-B-XNINxr-BhN2sysZ.mjs.map +1 -0
- package/dist/{factories-SVor5xIT.mjs → factories-Crobuxwn.mjs} +27 -20
- package/dist/factories-Crobuxwn.mjs.map +1 -0
- package/dist/{factories-P3qBQhO-.d.mts → factories-DbNP9qfs.d.mts} +16 -10
- package/dist/factories-DbNP9qfs.d.mts.map +1 -0
- package/dist/family.d.mts +17 -13
- package/dist/family.mjs +17 -12
- package/dist/family__control-adapter.d.mts +3 -3
- package/dist/family__control-adapter.mjs +2 -1
- package/dist/family__control.d.mts +5 -4
- package/dist/family__control.mjs +4 -4
- package/dist/family__diff.d.mts +2 -3
- package/dist/family__diff.mjs +2 -2
- package/dist/family__ir.d.mts +1 -1
- package/dist/family__ir.mjs +2 -2
- package/dist/family__migration.d.mts +1 -1
- package/dist/family__migration.mjs +1 -1
- package/dist/family__pack.d.mts +2 -249
- package/dist/family__pack.mjs +3 -18
- package/dist/family__psl-build.d.mts +3 -0
- package/dist/family__psl-build.mjs +3 -0
- package/dist/family__psl-infer.d.mts +2 -2
- package/dist/family__psl-infer.mjs +2 -2
- package/dist/family__runtime.d.mts +2 -2
- package/dist/family__runtime.mjs +2 -2
- package/dist/family__verify.d.mts +1 -1
- package/dist/family__verify.mjs +1 -1
- package/dist/foreign-key-materialization-48P2V8on.d.mts +98 -0
- package/dist/foreign-key-materialization-48P2V8on.d.mts.map +1 -0
- package/dist/foreign-key-materialization-BM59w_Xg.mjs +287 -0
- package/dist/foreign-key-materialization-BM59w_Xg.mjs.map +1 -0
- package/dist/{foreign-key-C-iTPuRT-C9ip8zFx.d.mts → foreign-key-qkDFfG8t-TaK_GYWR.d.mts} +21 -5
- package/dist/foreign-key-qkDFfG8t-TaK_GYWR.d.mts.map +1 -0
- package/dist/functions-CsOoN7I3.mjs +88 -0
- package/dist/functions-CsOoN7I3.mjs.map +1 -0
- package/dist/functions-EW-RrRn3.d.mts +73 -0
- package/dist/functions-EW-RrRn3.d.mts.map +1 -0
- package/dist/generator-functions-D_qdqBV--Bq296cED.mjs +544 -0
- package/dist/generator-functions-D_qdqBV--Bq296cED.mjs.map +1 -0
- package/dist/index-7nHHQsAj.d.mts +606 -0
- package/dist/index-7nHHQsAj.d.mts.map +1 -0
- package/dist/{index-C5I8D-MB.d.mts → index-Nqc3OHR_.d.mts} +4 -5
- package/dist/index-Nqc3OHR_.d.mts.map +1 -0
- package/dist/index-equivalence-DswCiq5l-CGsyPP9B.mjs +109 -0
- package/dist/index-equivalence-DswCiq5l-CGsyPP9B.mjs.map +1 -0
- package/dist/{index-naming-DREt6js7-CRH27yUv.mjs → index-naming-BOcJT1B3-mG8Fd6KN.mjs} +35 -9
- package/dist/index-naming-BOcJT1B3-mG8Fd6KN.mjs.map +1 -0
- package/dist/{index-naming-Ct65z5Xk.d.mts → index-naming-Cs6wwia3.d.mts} +15 -5
- package/dist/index-naming-Cs6wwia3.d.mts.map +1 -0
- package/dist/index-reference-4wsdeB7v-DCwswK-q.d.mts +67 -0
- package/dist/index-reference-4wsdeB7v-DCwswK-q.d.mts.map +1 -0
- package/dist/index-reference-BQSrkRfT.mjs +55 -0
- package/dist/index-reference-BQSrkRfT.mjs.map +1 -0
- package/dist/index-reference-D8ewQRJr.d.mts +1 -0
- package/dist/index-type-validation-DJEMmmw0.mjs +42 -0
- package/dist/index-type-validation-DJEMmmw0.mjs.map +1 -0
- package/dist/index-type-validation-fGGwAHWc.d.mts +16 -0
- package/dist/index-type-validation-fGGwAHWc.d.mts.map +1 -0
- package/dist/index-types-H1O43iYT-BD0VwPqV.d.mts +66 -0
- package/dist/index-types-H1O43iYT-BD0VwPqV.d.mts.map +1 -0
- package/dist/index-types-pC_5vADQ-BOOBi14R.mjs +95 -0
- package/dist/index-types-pC_5vADQ-BOOBi14R.mjs.map +1 -0
- package/dist/index-types-snhtt_Fo.d.mts +1 -0
- package/dist/interpreter-D5qk4B---CG0C7kdx.mjs +2280 -0
- package/dist/interpreter-D5qk4B---CG0C7kdx.mjs.map +1 -0
- package/dist/{ir-Bghjt-FG.d.mts → ir-BvptQsFW.d.mts} +11 -5
- package/dist/ir-BvptQsFW.d.mts.map +1 -0
- package/dist/{ir-I-xciGUH.mjs → ir-DzsUDO8e.mjs} +2 -2
- package/dist/ir-DzsUDO8e.mjs.map +1 -0
- package/dist/{middleware-AhTz1BOW-th-Suxuf.d.mts → middleware-DHkW6pRr-DM6hd9iZ.d.mts} +5 -5
- package/dist/middleware-DHkW6pRr-DM6hd9iZ.d.mts.map +1 -0
- package/dist/middleware-gqy3l13N.d.mts +1 -0
- package/dist/{middleware-CMr4CHNz-DHIUdxlm.mjs → middleware-yBAfiVWn-DZO0vCRQ.mjs} +3 -3
- package/dist/middleware-yBAfiVWn-DZO0vCRQ.mjs.map +1 -0
- package/dist/{migration-CK4oePIo.mjs → migration-BJQjkqFz.mjs} +4 -4
- package/dist/migration-BJQjkqFz.mjs.map +1 -0
- package/dist/{migration-CjDRZNep.d.mts → migration-Cxmpzaz0.d.mts} +6 -6
- package/dist/migration-Cxmpzaz0.d.mts.map +1 -0
- package/dist/{naming-CV9j2pXl-KARaDReS.d.mts → naming-BcD36g9T-Mfe_xGGL.d.mts} +9 -14
- package/dist/naming-BcD36g9T-Mfe_xGGL.d.mts.map +1 -0
- package/dist/{naming-DKr4TJd7-Cszhq9RV.mjs → naming-bM5qm5PY-jOg3JFMb.mjs} +20 -31
- package/dist/naming-bM5qm5PY-jOg3JFMb.mjs.map +1 -0
- package/dist/{ddl-types-BGdnAbXo-DKPHPUGx.mjs → opaque-sql-Dset3kln-CtsPDTXn.mjs} +24 -11
- package/dist/opaque-sql-Dset3kln-CtsPDTXn.mjs.map +1 -0
- package/dist/operations.d.mts +1 -1
- package/dist/operations.mjs +1 -1
- package/dist/orm-client.d.mts +817 -267
- package/dist/orm-client.d.mts.map +1 -1
- package/dist/orm-client.mjs +4719 -2942
- package/dist/orm-client.mjs.map +1 -1
- package/dist/pack-DA8HZ2mo.d.mts +535 -0
- package/dist/pack-DA8HZ2mo.d.mts.map +1 -0
- package/dist/pack-gSvGQWqs.mjs +80 -0
- package/dist/pack-gSvGQWqs.mjs.map +1 -0
- package/dist/{plan-CDxduYaN-pLIyyJaB.d.mts → plan-Cr4azjnG-CuL8FqXC.d.mts} +12 -8
- package/dist/plan-Cr4azjnG-CuL8FqXC.d.mts.map +1 -0
- package/dist/{plan-Dh0LbYIv-Crx5-ThG.mjs → plan-Dh0LbYIv-ubBSdUgl.mjs} +2 -2
- package/dist/plan-Dh0LbYIv-ubBSdUgl.mjs.map +1 -0
- package/dist/plan-Di6Gs2JD.d.mts +2 -0
- package/dist/psl-attribute-parsing-BCsFWsSp-BJ-wGlY6.mjs +42 -0
- package/dist/psl-attribute-parsing-BCsFWsSp-BJ-wGlY6.mjs.map +1 -0
- package/dist/psl-build-DFBG6vhz.mjs +426 -0
- package/dist/psl-build-DFBG6vhz.mjs.map +1 -0
- package/dist/psl-build-RelubU2E.d.mts +112 -0
- package/dist/psl-build-RelubU2E.d.mts.map +1 -0
- package/dist/psl-column-resolution-ChZqioOc-BREg4J7d.d.mts +24 -0
- package/dist/psl-column-resolution-ChZqioOc-BREg4J7d.d.mts.map +1 -0
- package/dist/psl-field-resolution-C5KQ7kzP-B0NwuRWV.mjs +1960 -0
- package/dist/psl-field-resolution-C5KQ7kzP-B0NwuRWV.mjs.map +1 -0
- package/dist/psl-infer--g4i84Go.mjs +201 -0
- package/dist/psl-infer--g4i84Go.mjs.map +1 -0
- package/dist/psl-infer-DzoxPZGd.d.mts +80 -0
- package/dist/psl-infer-DzoxPZGd.d.mts.map +1 -0
- package/dist/psl-names-C3cwe0rg-D1CTmC3a.mjs +66 -0
- package/dist/psl-names-C3cwe0rg-D1CTmC3a.mjs.map +1 -0
- package/dist/{query-lane-context-Qa-eddrE-kuZ8Z86-.d.mts → query-lane-context-BCEoKy0_-CzmyavC9.d.mts} +20 -49
- package/dist/query-lane-context-BCEoKy0_-CzmyavC9.d.mts.map +1 -0
- package/dist/query-lane-context-VqH0mS9B.d.mts +1 -0
- package/dist/{referential-action-sql-DJ9ps6-S.d.mts → referential-action-sql-B2vKoUK6.d.mts} +3 -3
- package/dist/referential-action-sql-B2vKoUK6.d.mts.map +1 -0
- package/dist/{referential-action-sql-DSqkrySN.mjs → referential-action-sql-BLzCtTi8.mjs} +2 -2
- package/dist/referential-action-sql-BLzCtTi8.mjs.map +1 -0
- package/dist/relational-core.d.mts +14 -13
- package/dist/relational-core.mjs +8 -8
- package/dist/relational-core__aggregate-descriptor-registry.d.mts +2 -2
- package/dist/relational-core__aggregate-descriptor-registry.d.mts.map +1 -1
- package/dist/relational-core__aggregate-descriptor-registry.mjs +1 -1
- package/dist/relational-core__ast.d.mts +5 -5
- package/dist/relational-core__ast.mjs +5 -5
- package/dist/relational-core__codec-descriptor-registry.d.mts +7 -8
- package/dist/relational-core__codec-descriptor-registry.d.mts.map +1 -1
- package/dist/relational-core__codec-descriptor-registry.mjs +1 -1
- package/dist/relational-core__collection-methods.d.mts +3 -0
- package/dist/relational-core__contract-free.d.mts +18 -8
- package/dist/relational-core__contract-free.d.mts.map +1 -1
- package/dist/relational-core__contract-free.mjs +26 -10
- package/dist/relational-core__contract-free.mjs.map +1 -1
- package/dist/relational-core__expression.d.mts +4 -2
- package/dist/relational-core__expression.mjs +2 -2
- package/dist/relational-core__functions.d.mts +2 -0
- package/dist/relational-core__functions.mjs +2 -0
- package/dist/relational-core__index-reference.d.mts +3 -0
- package/dist/relational-core__index-reference.mjs +2 -0
- package/dist/relational-core__middleware.d.mts +2 -2
- package/dist/relational-core__middleware.mjs +1 -1
- package/dist/relational-core__plan.d.mts +4 -4
- package/dist/relational-core__plan.mjs +1 -1
- package/dist/relational-core__query-lane-context.d.mts +3 -3
- package/dist/relational-core__types.d.mts +2 -2
- package/dist/{resolve-storage-table-DZsfnzeW.mjs → resolve-storage-table-BHLQsOza.mjs} +3 -3
- package/dist/resolve-storage-table-BHLQsOza.mjs.map +1 -0
- package/dist/{resolve-storage-table-Nyrgk4h8.d.mts → resolve-storage-table-DCqtmnSU.d.mts} +4 -4
- package/dist/resolve-storage-table-DCqtmnSU.d.mts.map +1 -0
- package/dist/{runtime-tIHpGCcG.mjs → runtime-6tH1yOxK.mjs} +6 -6
- package/dist/runtime-6tH1yOxK.mjs.map +1 -0
- package/dist/{runtime-DpKF2Yu2.d.mts → runtime-CF6rAlE5.d.mts} +7 -8
- package/dist/runtime-CF6rAlE5.d.mts.map +1 -0
- package/dist/runtime.d.mts +5 -5
- package/dist/runtime.mjs +2 -1799
- package/dist/runtime__internal__prepared-query.d.mts +2 -2
- package/dist/runtime__internal__prepared-query.mjs +2 -2
- package/dist/{schema-differ-DpG_gnur-DFAtGezx.d.mts → schema-differ-DmP74bB8-tqHKiJ88.d.mts} +6 -6
- package/dist/schema-differ-DmP74bB8-tqHKiJ88.d.mts.map +1 -0
- package/dist/schema-ir.d.mts +2 -2
- package/dist/schema-ir.mjs +2 -2
- package/dist/schema-ir__naming.d.mts +1 -1
- package/dist/schema-ir__naming.mjs +1 -1
- package/dist/schema-ir__types.d.mts +3 -3
- package/dist/schema-ir__types.mjs +2 -2
- package/dist/{schema-verify-C_PEdlAr-Dxxjm6EM.mjs → schema-verify-C3wbdviw-DMjIubOr.mjs} +50 -8
- package/dist/schema-verify-C3wbdviw-DMjIubOr.mjs.map +1 -0
- package/dist/{serialized-index-CrgG8ct1-DG3JpHc7.d.mts → serialized-index-CrgG8ct1-DKVJ7TDX.d.mts} +4 -4
- package/dist/serialized-index-CrgG8ct1-DKVJ7TDX.d.mts.map +1 -0
- package/dist/{serialized-index-nBTwanKy-_ddEK4tk.mjs → serialized-index-DjCCnXB1-DMA7BtO2.mjs} +4 -4
- package/dist/serialized-index-DjCCnXB1-DMA7BtO2.mjs.map +1 -0
- package/dist/{sql-contract-serializer-2oBWuxTe-DKZTf2n8.mjs → sql-contract-serializer-sMY3prTx-D2BfrNxs.mjs} +41 -16
- package/dist/sql-contract-serializer-sMY3prTx-D2BfrNxs.mjs.map +1 -0
- package/dist/sql-data-type-D7M-YTTY-D2vRqDxn.mjs +400 -0
- package/dist/sql-data-type-D7M-YTTY-D2vRqDxn.mjs.map +1 -0
- package/dist/{sql-execution-plan--jKyLpe5-CMGhgO0M.d.mts → sql-execution-plan-3uxYjHyu-DLknM-Pj.d.mts} +3 -3
- package/dist/sql-execution-plan-3uxYjHyu-DLknM-Pj.d.mts.map +1 -0
- package/dist/sql-expression-B4BrhGPi.d.mts +62 -0
- package/dist/sql-expression-B4BrhGPi.d.mts.map +1 -0
- package/dist/sql-expression-CKgKznXS.mjs +137 -0
- package/dist/sql-expression-CKgKznXS.mjs.map +1 -0
- package/dist/{sql-index-ByAAE7K8-DKj2V86p.d.mts → sql-index-ByAAE7K8-Dqtn_vUL.d.mts} +4 -4
- package/dist/sql-index-ByAAE7K8-Dqtn_vUL.d.mts.map +1 -0
- package/dist/{sql-node-kEz6YFZo-v2F7delx.d.mts → sql-node-kEz6YFZo-1ogT6Cxt.d.mts} +2 -2
- package/dist/sql-node-kEz6YFZo-1ogT6Cxt.d.mts.map +1 -0
- package/dist/{sql-storage-8LqxeLAY-DH4DdUXx.d.mts → sql-storage-DeCAh5Hi-CEM-m8cs.d.mts} +19 -22
- package/dist/sql-storage-DeCAh5Hi-CEM-m8cs.d.mts.map +1 -0
- package/dist/{storage-table-DSeWszOL-CI-cItEK.d.mts → storage-table-Bf1ZjnxO-pUj6pyP0.d.mts} +17 -24
- package/dist/storage-table-Bf1ZjnxO-pUj6pyP0.d.mts.map +1 -0
- package/dist/{storage-table-ZzbR-xzQ-BRoTQE_2.mjs → storage-table-DDvN83mw-DkbBFmK9.mjs} +12 -9
- package/dist/storage-table-DDvN83mw-DkbBFmK9.mjs.map +1 -0
- package/dist/{storage-value-set-BGlj5Uus-CvZD--GG.d.mts → storage-value-set-BGlj5Uus-ny2k-0PA.d.mts} +3 -3
- package/dist/storage-value-set-BGlj5Uus-ny2k-0PA.d.mts.map +1 -0
- package/dist/transaction-state-BfXhs7D7-DhmbySW9.mjs +45 -0
- package/dist/transaction-state-BfXhs7D7-DhmbySW9.mjs.map +1 -0
- package/dist/transaction-state-DR3nKTmH-D29jmVE-.d.mts +115 -0
- package/dist/transaction-state-DR3nKTmH-D29jmVE-.d.mts.map +1 -0
- package/dist/types-B9wSEUsV.d.mts +1 -0
- package/dist/{types-CUsJrvEl.mjs → types-CTdSkl0s.mjs} +13 -6
- package/dist/types-CTdSkl0s.mjs.map +1 -0
- package/dist/types-CkAd8SWm.d.mts +57 -0
- package/dist/types-CkAd8SWm.d.mts.map +1 -0
- package/dist/{types-IqZMLrFC-DcH8v_u3.d.mts → types-Cq6ImLAB-RlU4jJAX.d.mts} +27 -41
- package/dist/types-Cq6ImLAB-RlU4jJAX.d.mts.map +1 -0
- package/dist/{types-YStFFkKs-D9UAmnON.d.mts → types-CuCxAQat-Dz8P4xyt.d.mts} +141 -86
- package/dist/types-CuCxAQat-Dz8P4xyt.d.mts.map +1 -0
- package/dist/types-DfKvtJwS-CrpWTGBJ.d.mts +273 -0
- package/dist/types-DfKvtJwS-CrpWTGBJ.d.mts.map +1 -0
- package/dist/{types-4YenawkP-CwaaZSid.mjs → types-DoyiTsjg-2YMhMJDA.mjs} +181 -80
- package/dist/types-DoyiTsjg-2YMhMJDA.mjs.map +1 -0
- package/dist/{types-v3qxLLxo-DCeKv7yY.d.mts → types-DriMIMNQ-BkbsW7w3.d.mts} +68 -34
- package/dist/types-DriMIMNQ-BkbsW7w3.d.mts.map +1 -0
- package/dist/{types-Dt4e_jC--COeP8xzN.mjs → types-NTQsD2MS-xcLtvKO9.mjs} +83 -17
- package/dist/types-NTQsD2MS-xcLtvKO9.mjs.map +1 -0
- package/dist/{types-CyxGtOOh-BggSa6Fe.d.mts → types-TXO7x1BA-CYYIY8NI.d.mts} +14 -14
- package/dist/types-TXO7x1BA-CYYIY8NI.d.mts.map +1 -0
- package/dist/types-ljUNyiWe.d.mts +1 -0
- package/dist/{unique-constraint-M5TlQnJQ-BiIHJ85k.d.mts → unique-constraint-M5TlQnJQ-qX-maNUV.d.mts} +3 -3
- package/dist/unique-constraint-M5TlQnJQ-qX-maNUV.d.mts.map +1 -0
- package/dist/{util-DQQgv2j1-D6INZaRG.mjs → util-BBgcP3gI-CpL-0VuC.mjs} +12 -3
- package/dist/util-BBgcP3gI-CpL-0VuC.mjs.map +1 -0
- package/dist/{validators-CrWD6bSP.mjs → validators-BwA7ttZM.mjs} +0 -0
- package/dist/validators-BwA7ttZM.mjs.map +1 -0
- package/dist/{validators-Belo8QqM.d.mts → validators-FJs8HvFr.d.mts} +54 -16
- package/dist/validators-FJs8HvFr.d.mts.map +1 -0
- package/dist/{value-set-derivation-hook-BhgGVtw0.d.mts → value-set-derivation-hook-3E437jPU.d.mts} +3 -3
- package/dist/value-set-derivation-hook-3E437jPU.d.mts.map +1 -0
- package/dist/{value-set-derivation-hook-Di9JZ0X7.mjs → value-set-derivation-hook-HVaxhALD.mjs} +2 -2
- package/dist/value-set-derivation-hook-HVaxhALD.mjs.map +1 -0
- package/dist/{verify-u0UTdZgD-DSAaz9rW.mjs → verify-BVk5bjdH-DhKm6hB3.mjs} +8 -7
- package/dist/verify-BVk5bjdH-DhKm6hB3.mjs.map +1 -0
- package/dist/{verify-zDRnw0Rn.d.mts → verify-DHXbuZPB.d.mts} +2 -2
- package/dist/verify-DHXbuZPB.d.mts.map +1 -0
- package/package.json +33 -22
- package/dist/aggregate-descriptor-registry-C7hel5O7.mjs.map +0 -1
- package/dist/ast-HFcfQZr-.d.mts +0 -206
- package/dist/ast-HFcfQZr-.d.mts.map +0 -1
- package/dist/ast-Lbl4VwqP.mjs +0 -325
- package/dist/ast-Lbl4VwqP.mjs.map +0 -1
- package/dist/authored-check-naming-BWBe-PVE.d.mts.map +0 -1
- package/dist/authored-check-naming-Hf9990DV.mjs.map +0 -1
- package/dist/authoring-type-constructors-Blqoa2Ua-DqvNCOb2.mjs +0 -316
- package/dist/authoring-type-constructors-Blqoa2Ua-DqvNCOb2.mjs.map +0 -1
- package/dist/canonicalization-hooks-CYnW_sGn.d.mts.map +0 -1
- package/dist/canonicalization-hooks-dmXkOR4a.mjs.map +0 -1
- package/dist/check-constraint-B7qGu6rc-HvQjjX82.d.mts.map +0 -1
- package/dist/codec-descriptor-registry-N0dhtKaH.mjs.map +0 -1
- package/dist/config-types-D9fdKG3g.d.mts.map +0 -1
- package/dist/config-types-gAm54C_v.mjs.map +0 -1
- package/dist/contract-builder-CG_tGDbB.d.mts +0 -1360
- package/dist/contract-builder-CG_tGDbB.d.mts.map +0 -1
- package/dist/contract-builder-D4a5dT7j.mjs.map +0 -1
- package/dist/contract-errors-BCN6RVI5-5IHBF_lg.mjs.map +0 -1
- package/dist/contract-view-BMR5IWk4.mjs.map +0 -1
- package/dist/contract-view-CPHxoAEX.d.mts.map +0 -1
- package/dist/contract__pack-types.d.mts +0 -2
- package/dist/control-D3cB5YQp.mjs +0 -1267
- package/dist/control-D3cB5YQp.mjs.map +0 -1
- package/dist/control-DTLJ1WtZ.d.mts +0 -945
- package/dist/control-DTLJ1WtZ.d.mts.map +0 -1
- package/dist/control-adapter-C99J7aEF-B7eQd7vD.d.mts.map +0 -1
- package/dist/control-adapter-MZJQiwcE.d.mts +0 -1
- package/dist/db-D18PrXKW-DvTv4JFn.d.mts.map +0 -1
- package/dist/ddl-types-BGdnAbXo-DKPHPUGx.mjs.map +0 -1
- package/dist/ddl-types-CXx4vPz6-BsgrnSUY.d.mts.map +0 -1
- package/dist/derived-checks-DFMRmiAu-DGfB8aS4.mjs +0 -1057
- package/dist/derived-checks-DFMRmiAu-DGfB8aS4.mjs.map +0 -1
- package/dist/derived-checks-DPdD01O0-DGqOFjs6.d.mts.map +0 -1
- package/dist/diff-B16bL_IR.mjs +0 -13
- package/dist/diff-B16bL_IR.mjs.map +0 -1
- package/dist/diff-DbTNVm2f.d.mts.map +0 -1
- package/dist/dist-C_q1_QR9.mjs.map +0 -1
- package/dist/dist-ZK6oeI5e.mjs.map +0 -1
- package/dist/dist-x6jvtkKM.mjs.map +0 -1
- package/dist/driver-types-BQtRkOJ0-Bv2RPSfr.d.mts.map +0 -1
- package/dist/entity-handle-lowering-hook-CIvRKBfa.d.mts.map +0 -1
- package/dist/entity-handle-lowering-hook-DwLIKNiS.mjs +0 -11
- package/dist/entity-handle-lowering-hook-DwLIKNiS.mjs.map +0 -1
- package/dist/entity-kinds-B5cUFU22.d.mts.map +0 -1
- package/dist/entity-kinds-D7vwoN_T-CCBwFJy0.mjs.map +0 -1
- package/dist/errors-B5g0xWro-mWH2C07F.mjs.map +0 -1
- package/dist/expression-CX5mTA-z.mjs.map +0 -1
- package/dist/expression-FJK6Ar-d.d.mts.map +0 -1
- package/dist/factories-P3qBQhO-.d.mts.map +0 -1
- package/dist/factories-SVor5xIT.mjs.map +0 -1
- package/dist/family__pack.d.mts.map +0 -1
- package/dist/family__pack.mjs.map +0 -1
- package/dist/foreign-key-C-iTPuRT-C9ip8zFx.d.mts.map +0 -1
- package/dist/foreign-key-materialization-CkvOzJWy.d.mts +0 -65
- package/dist/foreign-key-materialization-CkvOzJWy.d.mts.map +0 -1
- package/dist/foreign-key-materialization-Cu7-7LHl.mjs +0 -73
- package/dist/foreign-key-materialization-Cu7-7LHl.mjs.map +0 -1
- package/dist/index-C-vQOMY_.d.mts +0 -84
- package/dist/index-C-vQOMY_.d.mts.map +0 -1
- package/dist/index-C5I8D-MB.d.mts.map +0 -1
- package/dist/index-naming-Ct65z5Xk.d.mts.map +0 -1
- package/dist/index-naming-DREt6js7-CRH27yUv.mjs.map +0 -1
- package/dist/index-type-validation-COH4d78M.mjs +0 -17
- package/dist/index-type-validation-COH4d78M.mjs.map +0 -1
- package/dist/index-type-validation-CZ5L2lli.d.mts +0 -10
- package/dist/index-type-validation-CZ5L2lli.d.mts.map +0 -1
- package/dist/index-types-CNhHgKHi.d.mts +0 -1
- package/dist/index-types-DJQ_xwaE.mjs +0 -40
- package/dist/index-types-DJQ_xwaE.mjs.map +0 -1
- package/dist/index-types-DPVhsW0v-D-BikM4h.d.mts +0 -31
- package/dist/index-types-DPVhsW0v-D-BikM4h.d.mts.map +0 -1
- package/dist/interpreter-DyiUUAWh-DYdjIpiE.mjs +0 -3680
- package/dist/interpreter-DyiUUAWh-DYdjIpiE.mjs.map +0 -1
- package/dist/ir-Bghjt-FG.d.mts.map +0 -1
- package/dist/ir-I-xciGUH.mjs.map +0 -1
- package/dist/lane-query-builder.d.mts +0 -236
- package/dist/lane-query-builder.d.mts.map +0 -1
- package/dist/lane-query-builder.mjs +0 -67
- package/dist/lane-query-builder.mjs.map +0 -1
- package/dist/middleware--TtoxUiW.d.mts +0 -1
- package/dist/middleware-AhTz1BOW-th-Suxuf.d.mts.map +0 -1
- package/dist/middleware-CMr4CHNz-DHIUdxlm.mjs.map +0 -1
- package/dist/migration-CK4oePIo.mjs.map +0 -1
- package/dist/migration-CjDRZNep.d.mts.map +0 -1
- package/dist/naming-CV9j2pXl-KARaDReS.d.mts.map +0 -1
- package/dist/naming-DKr4TJd7-Cszhq9RV.mjs.map +0 -1
- package/dist/pack-types-BcLTpwbv.d.mts +0 -14
- package/dist/pack-types-BcLTpwbv.d.mts.map +0 -1
- package/dist/plan-BHLdb0Z7.d.mts +0 -2
- package/dist/plan-CDxduYaN-pLIyyJaB.d.mts.map +0 -1
- package/dist/plan-Dh0LbYIv-Crx5-ThG.mjs.map +0 -1
- package/dist/prepared-query-BJr50wPm-ChoqfJbX.mjs +0 -22
- package/dist/prepared-query-BJr50wPm-ChoqfJbX.mjs.map +0 -1
- package/dist/prepared-statement-9QpkE6JG-C430V3MO.d.mts +0 -529
- package/dist/prepared-statement-9QpkE6JG-C430V3MO.d.mts.map +0 -1
- package/dist/psl-infer-CCAD6FWA.d.mts +0 -119
- package/dist/psl-infer-CCAD6FWA.d.mts.map +0 -1
- package/dist/psl-infer-Dk5kgKre.mjs +0 -362
- package/dist/psl-infer-Dk5kgKre.mjs.map +0 -1
- package/dist/query-lane-context-Qa-eddrE-kuZ8Z86-.d.mts.map +0 -1
- package/dist/query-lane-context-XMvk7fmY.d.mts +0 -1
- package/dist/referential-action-sql-DJ9ps6-S.d.mts.map +0 -1
- package/dist/referential-action-sql-DSqkrySN.mjs.map +0 -1
- package/dist/resolve-storage-table-DZsfnzeW.mjs.map +0 -1
- package/dist/resolve-storage-table-Nyrgk4h8.d.mts.map +0 -1
- package/dist/runtime-DpKF2Yu2.d.mts.map +0 -1
- package/dist/runtime-tIHpGCcG.mjs.map +0 -1
- package/dist/runtime.mjs.map +0 -1
- package/dist/schema-differ-DpG_gnur-DFAtGezx.d.mts.map +0 -1
- package/dist/schema-verify-C_PEdlAr-Dxxjm6EM.mjs.map +0 -1
- package/dist/serialized-index-CrgG8ct1-DG3JpHc7.d.mts.map +0 -1
- package/dist/serialized-index-nBTwanKy-_ddEK4tk.mjs.map +0 -1
- package/dist/sql-contract-serializer-2oBWuxTe-DKZTf2n8.mjs.map +0 -1
- package/dist/sql-execution-plan--jKyLpe5-CMGhgO0M.d.mts.map +0 -1
- package/dist/sql-index-ByAAE7K8-DKj2V86p.d.mts.map +0 -1
- package/dist/sql-node-kEz6YFZo-v2F7delx.d.mts.map +0 -1
- package/dist/sql-storage-8LqxeLAY-DH4DdUXx.d.mts.map +0 -1
- package/dist/storage-table-DSeWszOL-CI-cItEK.d.mts.map +0 -1
- package/dist/storage-table-ZzbR-xzQ-BRoTQE_2.mjs.map +0 -1
- package/dist/storage-value-set-BGlj5Uus-CvZD--GG.d.mts.map +0 -1
- package/dist/timestamp-now-generator-DRXygu32-DN9Qb1uI.mjs +0 -173
- package/dist/timestamp-now-generator-DRXygu32-DN9Qb1uI.mjs.map +0 -1
- package/dist/types-4YenawkP-CwaaZSid.mjs.map +0 -1
- package/dist/types-B0msOnBM.d.mts +0 -1
- package/dist/types-BDUG29Df-LE85dIXP.d.mts +0 -161
- package/dist/types-BDUG29Df-LE85dIXP.d.mts.map +0 -1
- package/dist/types-CUsJrvEl.mjs.map +0 -1
- package/dist/types-CyxGtOOh-BggSa6Fe.d.mts.map +0 -1
- package/dist/types-Dt4e_jC--COeP8xzN.mjs.map +0 -1
- package/dist/types-Dwcw0F8X.d.mts +0 -1
- package/dist/types-IqZMLrFC-DcH8v_u3.d.mts.map +0 -1
- package/dist/types-UcHa2cTe.d.mts +0 -17
- package/dist/types-UcHa2cTe.d.mts.map +0 -1
- package/dist/types-YStFFkKs-D9UAmnON.d.mts.map +0 -1
- package/dist/types-v3qxLLxo-DCeKv7yY.d.mts.map +0 -1
- package/dist/unique-constraint-M5TlQnJQ-BiIHJ85k.d.mts.map +0 -1
- package/dist/util-DQQgv2j1-D6INZaRG.mjs.map +0 -1
- package/dist/validators-Belo8QqM.d.mts.map +0 -1
- package/dist/validators-CrWD6bSP.mjs.map +0 -1
- package/dist/value-set-derivation-hook-BhgGVtw0.d.mts.map +0 -1
- package/dist/value-set-derivation-hook-Di9JZ0X7.mjs.map +0 -1
- package/dist/verify-u0UTdZgD-DSAaz9rW.mjs.map +0 -1
- package/dist/verify-zDRnw0Rn.d.mts.map +0 -1
- /package/dist/{contract__pack-types.mjs → relational-core__collection-methods.mjs} +0 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { t as contractError } from "./contract-errors-BCN6RVI5-DoH6b_KZ.mjs";
|
|
2
|
+
import { a as rendersIndexBody, t as accessMethodOf } from "./index-types-pC_5vADQ-BOOBi14R.mjs";
|
|
3
|
+
import { g as truncateToWireNamePrefixBytes, l as nameOf, o as defaultIndexName } from "./naming-bM5qm5PY-jOg3JFMb.mjs";
|
|
4
|
+
import { r as lowerAuthoredIndex } from "./index-naming-BOcJT1B3-mG8Fd6KN.mjs";
|
|
5
|
+
import { i as leadingBackingObjectName, n as identicalIndexes, o as servingKey, r as indexNodeOf, s as startsWithColumns, t as derivedBackingIndexIsRedundant } from "./index-equivalence-DswCiq5l-CGsyPP9B.mjs";
|
|
6
|
+
import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
|
|
7
|
+
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
8
|
+
import { asNamespaceId } from "@prisma/orm-framework/contract/types";
|
|
9
|
+
//#region ../../../2-sql-family/1-core/contract/dist/foreign-key-materialization.mjs
|
|
10
|
+
const IDENTICAL_DESCRIPTION = "the planner sees them as the same index. The contract keeps both because each is named.";
|
|
11
|
+
const REDUNDANT_DESCRIPTION = "which already serves the same lookups.";
|
|
12
|
+
/**
|
|
13
|
+
* Removes the indexes of one table that duplicate another. Two indexes are identical when the planner sees them as the same index apart from their names (see {@link identicalIndexes}); of an identical group the pass keeps the indexes named by the user, or the first one when none is. A plain non-unique index whose columns are those of the primary key, a unique constraint or a unique index without a predicate is redundant (see {@link servingKey}), and the pass removes it unless it is named by the user. Every index named by the user survives; the pass warns about each one that duplicates another, and refuses two identical indexes both named with `name:`, whose wire names the planner could not tell apart.
|
|
14
|
+
*/
|
|
15
|
+
function deduplicateIndexes(input) {
|
|
16
|
+
const { tableName, warnings } = input;
|
|
17
|
+
const replacements = /* @__PURE__ */ new Map();
|
|
18
|
+
const nodes = new Map(input.indexes.map((candidate) => [candidate, indexNodeOf(candidate.index)]));
|
|
19
|
+
const nodeOf = (candidate) => {
|
|
20
|
+
const node = nodes.get(candidate);
|
|
21
|
+
if (node === void 0) throw new InternalError("every candidate has a node");
|
|
22
|
+
return node;
|
|
23
|
+
};
|
|
24
|
+
const groups = [];
|
|
25
|
+
for (const candidate of input.indexes) {
|
|
26
|
+
const position = groups.findIndex(([first]) => identicalIndexes(nodeOf(first), nodeOf(candidate)));
|
|
27
|
+
const group = groups[position];
|
|
28
|
+
if (group === void 0) groups.push([candidate]);
|
|
29
|
+
else groups[position] = [...group, candidate];
|
|
30
|
+
}
|
|
31
|
+
for (const group of groups) {
|
|
32
|
+
const named = group.filter((candidate) => candidate.namedByUser);
|
|
33
|
+
const wireNamed = named.filter((candidate) => candidate.index.naming.kind === "wire");
|
|
34
|
+
if (wireNamed.length > 1) throw identicalWireNamedIndexesError(tableName, wireNamed);
|
|
35
|
+
const kept = named[0] ?? group[0];
|
|
36
|
+
for (const candidate of group) if (candidate !== kept && !candidate.namedByUser) replacements.set(candidate, {
|
|
37
|
+
kind: "index",
|
|
38
|
+
index: kept
|
|
39
|
+
});
|
|
40
|
+
if (named.length > 1) warnings.push(identicalIndexesWarning(tableName, named));
|
|
41
|
+
}
|
|
42
|
+
const survivors = input.indexes.filter((candidate) => !replacements.has(candidate));
|
|
43
|
+
for (const candidate of survivors) {
|
|
44
|
+
const servedBy = servingKey(nodeOf(candidate), {
|
|
45
|
+
indexes: survivors,
|
|
46
|
+
nodeOf,
|
|
47
|
+
uniques: input.uniques,
|
|
48
|
+
primaryKey: input.primaryKey
|
|
49
|
+
});
|
|
50
|
+
if (servedBy === void 0) continue;
|
|
51
|
+
if (candidate.namedByUser) warnings.push(redundantIndexWarning(tableName, candidate, servedBy));
|
|
52
|
+
else replacements.set(candidate, servedBy);
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
indexes: input.indexes.filter((candidate) => !replacements.has(candidate)),
|
|
56
|
+
replacements
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function identicalWireNamedIndexesError(tableName, wireNamed) {
|
|
60
|
+
return contractError("CONTRACT.ARGUMENT_INVALID", `Indexes ${quotedList(wireNamed.map((candidate) => writtenName(candidate.index)))} on table "${tableName}" are identical and both named with name:; the planner pairs wire-named indexes by their content, so it could not tell them apart.`, {
|
|
61
|
+
fix: "Remove one of them, or name one with map: to keep both under exact names.",
|
|
62
|
+
meta: {
|
|
63
|
+
tableName,
|
|
64
|
+
indexes: wireNamed.map((candidate) => writtenName(candidate.index))
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/** The name the source wrote: the prefix of a wire-named index, the whole name of an exact one. */
|
|
69
|
+
function writtenName(index) {
|
|
70
|
+
return index.naming.kind === "wire" ? index.naming.prefix : index.naming.name;
|
|
71
|
+
}
|
|
72
|
+
function quotedList(names) {
|
|
73
|
+
const quoted = names.map((name) => `"${name}"`);
|
|
74
|
+
return quoted.length <= 2 ? quoted.join(" and ") : `${quoted.slice(0, -1).join(", ")} and ${quoted.at(-1)}`;
|
|
75
|
+
}
|
|
76
|
+
function identicalIndexesWarning(tableName, named) {
|
|
77
|
+
const names = quotedList(named.map((candidate) => writtenName(candidate.index)));
|
|
78
|
+
return {
|
|
79
|
+
code: "PN_INDEX_DUPLICATE",
|
|
80
|
+
message: `Indexes ${names} on table "${tableName}" are identical: ${IDENTICAL_DESCRIPTION} Remove one of them.`,
|
|
81
|
+
item: `table "${tableName}": indexes ${names}`,
|
|
82
|
+
summary: `tables have named indexes that are identical: ${IDENTICAL_DESCRIPTION} Remove one of each.`
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function describeReplacement(replacement) {
|
|
86
|
+
switch (replacement.kind) {
|
|
87
|
+
case "primaryKey": return "the primary key";
|
|
88
|
+
case "uniqueConstraint": return replacement.unique.name === void 0 ? `the unique constraint on (${replacement.unique.columns.join(", ")})` : `the unique constraint "${replacement.unique.name}"`;
|
|
89
|
+
case "index": return `the unique index "${writtenName(replacement.index.index)}"`;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function redundantIndexWarning(tableName, candidate, servedBy) {
|
|
93
|
+
const name = writtenName(candidate.index);
|
|
94
|
+
return {
|
|
95
|
+
code: "PN_INDEX_REDUNDANT",
|
|
96
|
+
message: `Index "${name}" on table "${tableName}" has the same columns as ${describeReplacement(servedBy)}, ${REDUNDANT_DESCRIPTION} The contract keeps the index because it is named. Remove it.`,
|
|
97
|
+
item: `table "${tableName}": index "${name}"`,
|
|
98
|
+
summary: `tables have a named index with the same columns as a unique constraint, unique index or primary key, ${REDUNDANT_DESCRIPTION} The contract keeps each index because it is named. Remove them.`
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/** The `meta.reason` of the refusal of a relation's `index: "<name>"`, which a source can report at the relation. */
|
|
102
|
+
const FOREIGN_KEY_INDEX_UNRESOLVED = "foreign-key-index-unresolved";
|
|
103
|
+
/**
|
|
104
|
+
* Lowers a table's authored foreign keys and indexes into the entities `contract.json` persists. A `constraint: false` foreign key contributes no `foreignKeys[]` entry. A foreign key with `index: true` gets a derived backing index; one with `index: "<name>"` uses what the table declares under that name. The table's indexes then pass through {@link deduplicateIndexes}, and each foreign key states what backs it in the result: an index by name, or the primary key or a unique constraint by kind.
|
|
105
|
+
*/
|
|
106
|
+
function materializeForeignKeysAndIndexes(input) {
|
|
107
|
+
const { tableName, declaredIndexes, uniques, primaryKey, indexTypes } = input;
|
|
108
|
+
const derivedIndexes = [];
|
|
109
|
+
const intents = input.foreignKeys.map((foreignKey) => {
|
|
110
|
+
const { constraint, index, ...reference } = foreignKey;
|
|
111
|
+
if (index !== true) return {
|
|
112
|
+
constraint,
|
|
113
|
+
reference,
|
|
114
|
+
index
|
|
115
|
+
};
|
|
116
|
+
const derived = derivedBackingIndex(tableName, reference.source.columns);
|
|
117
|
+
derivedIndexes.push(derived);
|
|
118
|
+
return {
|
|
119
|
+
constraint,
|
|
120
|
+
reference,
|
|
121
|
+
index: derived
|
|
122
|
+
};
|
|
123
|
+
});
|
|
124
|
+
const deduplicated = deduplicateIndexes({
|
|
125
|
+
tableName,
|
|
126
|
+
indexes: [...declaredIndexes, ...derivedIndexes],
|
|
127
|
+
uniques,
|
|
128
|
+
primaryKey,
|
|
129
|
+
warnings: input.warnings
|
|
130
|
+
});
|
|
131
|
+
const resolve = (backing) => foreignKeyIndexOf(resolveReplacement(backing, deduplicated.replacements));
|
|
132
|
+
return {
|
|
133
|
+
foreignKeys: intents.flatMap(({ constraint, reference, index }) => {
|
|
134
|
+
const backing = index === false ? void 0 : typeof index === "string" ? namedBackingObject(reference.source, index, {
|
|
135
|
+
declaredIndexes,
|
|
136
|
+
uniques,
|
|
137
|
+
primaryKey,
|
|
138
|
+
indexTypes,
|
|
139
|
+
resolve
|
|
140
|
+
}) : resolve({
|
|
141
|
+
kind: "index",
|
|
142
|
+
index
|
|
143
|
+
});
|
|
144
|
+
if (!constraint) return [];
|
|
145
|
+
return [backing === void 0 ? reference : {
|
|
146
|
+
...reference,
|
|
147
|
+
index: backing
|
|
148
|
+
}];
|
|
149
|
+
}),
|
|
150
|
+
indexes: deduplicated.indexes.map((candidate) => candidate.index)
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Whether a table's declared indexes, unique constraints or primary key already serve a foreign key on `columns`, so the build would drop a derived backing index again. A source that writes no backing index of its own, such as a Prisma 7 schema, leaves the foreign key's `index` to the build where this holds, so the stored foreign key states what backs it.
|
|
155
|
+
*/
|
|
156
|
+
function declaredIndexesServeForeignKey(columns, table) {
|
|
157
|
+
return derivedBackingIndexIsRedundant(columns, {
|
|
158
|
+
indexes: table.indexes,
|
|
159
|
+
nodeOf: indexNodeOf,
|
|
160
|
+
uniques: table.uniques,
|
|
161
|
+
primaryKey: table.primaryKey
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The name to give a relation's `index` argument when the table's declared indexes and keys serve a foreign key on `columns` although the build would keep a derived backing index beside them (see {@link leadingBackingObjectName}).
|
|
166
|
+
*/
|
|
167
|
+
function declaredBackingObjectName(columns, table) {
|
|
168
|
+
return leadingBackingObjectName(columns, {
|
|
169
|
+
indexes: table.indexes,
|
|
170
|
+
nodeOf: indexNodeOf,
|
|
171
|
+
nameOf: (index) => nameOf(index.naming),
|
|
172
|
+
uniques: table.uniques,
|
|
173
|
+
primaryKey: table.primaryKey
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* What a foreign key on `columns` states it is backed by when its relation says nothing, beside a table whose indexes all carry the `name` or `map` the source gave them, as a printed contract's do. A printer writes a relation's `index` argument only where the stored foreign key differs from this.
|
|
178
|
+
*/
|
|
179
|
+
function defaultForeignKeyIndex(tableName, columns, table) {
|
|
180
|
+
const reference = {
|
|
181
|
+
namespaceId: asNamespaceId(UNBOUND_NAMESPACE_ID),
|
|
182
|
+
tableName,
|
|
183
|
+
columns
|
|
184
|
+
};
|
|
185
|
+
const [foreignKey] = materializeForeignKeysAndIndexes({
|
|
186
|
+
tableName,
|
|
187
|
+
foreignKeys: [{
|
|
188
|
+
source: reference,
|
|
189
|
+
target: reference,
|
|
190
|
+
constraint: true,
|
|
191
|
+
index: true
|
|
192
|
+
}],
|
|
193
|
+
declaredIndexes: table.indexes.map((index) => ({
|
|
194
|
+
index,
|
|
195
|
+
namedByUser: true
|
|
196
|
+
})),
|
|
197
|
+
uniques: table.uniques,
|
|
198
|
+
primaryKey: table.primaryKey,
|
|
199
|
+
warnings: [],
|
|
200
|
+
indexTypes: void 0
|
|
201
|
+
}).foreignKeys;
|
|
202
|
+
return typeof foreignKey?.index === "object" ? foreignKey.index : void 0;
|
|
203
|
+
}
|
|
204
|
+
function derivedBackingIndex(tableName, columns) {
|
|
205
|
+
return {
|
|
206
|
+
index: lowerAuthoredIndex(tableName, {
|
|
207
|
+
columns,
|
|
208
|
+
where: void 0,
|
|
209
|
+
unique: void 0,
|
|
210
|
+
map: void 0,
|
|
211
|
+
name: truncateToWireNamePrefixBytes(defaultIndexName(tableName, columns)),
|
|
212
|
+
type: void 0,
|
|
213
|
+
options: void 0
|
|
214
|
+
}),
|
|
215
|
+
namedByUser: false
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* What a relation's `index: "<name>"` points at. The name is the `name` or `map` the source gave an index, unique constraint or primary key, or an index's stored name; an unnamed index's default name does not count. Identical indexes count as one, so the name is resolved after they merge. The object must start with the foreign key's columns, in order, or it would not serve the foreign key's lookups. An index of a type whose body is rendered from its options (see {@link rendersIndexBody}) is refused too: its columns are not its key.
|
|
220
|
+
*/
|
|
221
|
+
function namedBackingObject(source, name, table) {
|
|
222
|
+
const { namespaceId, tableName, columns } = source;
|
|
223
|
+
const subject = `The foreign key on table "${tableName}" columns (${columns.join(", ")}) names "${name}" as its index`;
|
|
224
|
+
const meta = {
|
|
225
|
+
reason: FOREIGN_KEY_INDEX_UNRESOLVED,
|
|
226
|
+
namespaceId,
|
|
227
|
+
tableName,
|
|
228
|
+
columns,
|
|
229
|
+
index: name
|
|
230
|
+
};
|
|
231
|
+
const indexes = table.declaredIndexes.filter((candidate) => candidate.namedByUser && writtenName(candidate.index) === name || nameOf(candidate.index.naming) === name);
|
|
232
|
+
const keys = [...table.uniques.filter((unique) => unique.name === name), ...table.primaryKey?.name === name ? [table.primaryKey] : []];
|
|
233
|
+
const resolvedIndexes = [...new Map(indexes.map((index) => {
|
|
234
|
+
const resolved = table.resolve({
|
|
235
|
+
kind: "index",
|
|
236
|
+
index
|
|
237
|
+
});
|
|
238
|
+
return [JSON.stringify(resolved), {
|
|
239
|
+
index,
|
|
240
|
+
resolved
|
|
241
|
+
}];
|
|
242
|
+
})).values()];
|
|
243
|
+
const matches = resolvedIndexes.length + keys.length;
|
|
244
|
+
if (matches === 0) throw contractError("CONTRACT.ARGUMENT_INVALID", `${subject}, but table "${tableName}" has no index, unique constraint or primary key with that name.`, {
|
|
245
|
+
fix: `Declare an index, unique constraint or primary key named "${name}" on table "${tableName}", or drop the index argument so the foreign key gets its own backing index.`,
|
|
246
|
+
meta
|
|
247
|
+
});
|
|
248
|
+
if (matches > 1) throw contractError("CONTRACT.ARGUMENT_INVALID", `${subject}, but table "${tableName}" has more than one index, unique constraint or primary key with that name.`, {
|
|
249
|
+
fix: `Give the object the foreign key should use a name no other index, unique constraint or primary key of table "${tableName}" has, and name that on the relation.`,
|
|
250
|
+
meta
|
|
251
|
+
});
|
|
252
|
+
const [match] = resolvedIndexes;
|
|
253
|
+
const key = keys[0];
|
|
254
|
+
const matchType = match?.index.index.type;
|
|
255
|
+
const typeEntry = matchType === void 0 ? void 0 : table.indexTypes?.get(matchType);
|
|
256
|
+
if (typeEntry !== void 0 && rendersIndexBody(typeEntry)) throw contractError("CONTRACT.ARGUMENT_INVALID", `${subject}, but it is a "${typeEntry.type}" index, a "${accessMethodOf(typeEntry)}" index whose key is rendered from its options rather than its columns, so it does not serve the foreign key's lookups.`, {
|
|
257
|
+
fix: `Name an index, unique constraint or primary key whose first columns are (${columns.join(", ")}), or drop the index argument so the foreign key gets its own backing index beside the "${typeEntry.type}" index.`,
|
|
258
|
+
meta
|
|
259
|
+
});
|
|
260
|
+
const objectColumns = match !== void 0 ? match.index.index.columns : key?.columns;
|
|
261
|
+
if (objectColumns === void 0 || !startsWithColumns(objectColumns, columns)) throw contractError("CONTRACT.ARGUMENT_INVALID", `${subject}, but ${objectColumns === void 0 ? "it indexes an expression, not the foreign key's columns" : `its columns (${objectColumns.join(", ")}) do not start with the foreign key's columns`}, so it does not serve the foreign key's lookups.`, {
|
|
262
|
+
fix: `Name an index, unique constraint or primary key whose first columns are (${columns.join(", ")}), or drop the index argument so the foreign key gets its own backing index.`,
|
|
263
|
+
meta
|
|
264
|
+
});
|
|
265
|
+
if (match !== void 0) return match.resolved;
|
|
266
|
+
return key === table.primaryKey ? { primaryKey: true } : { unique: objectColumns };
|
|
267
|
+
}
|
|
268
|
+
function resolveReplacement(backing, replacements) {
|
|
269
|
+
let current = backing;
|
|
270
|
+
while (current.kind === "index") {
|
|
271
|
+
const replacement = replacements.get(current.index);
|
|
272
|
+
if (replacement === void 0) break;
|
|
273
|
+
current = replacement;
|
|
274
|
+
}
|
|
275
|
+
return current;
|
|
276
|
+
}
|
|
277
|
+
function foreignKeyIndexOf(backing) {
|
|
278
|
+
switch (backing.kind) {
|
|
279
|
+
case "index": return { name: nameOf(backing.index.index.naming) };
|
|
280
|
+
case "uniqueConstraint": return { unique: backing.unique.columns };
|
|
281
|
+
case "primaryKey": return { primaryKey: true };
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
//#endregion
|
|
285
|
+
export { materializeForeignKeysAndIndexes as a, defaultForeignKeyIndex as i, declaredBackingObjectName as n, declaredIndexesServeForeignKey as r, FOREIGN_KEY_INDEX_UNRESOLVED as t };
|
|
286
|
+
|
|
287
|
+
//# sourceMappingURL=foreign-key-materialization-BM59w_Xg.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foreign-key-materialization-BM59w_Xg.mjs","names":[],"sources":["../../../../2-sql-family/1-core/contract/dist/foreign-key-materialization.mjs"],"sourcesContent":["import { t as contractError } from \"./contract-errors-BCN6RVI5.mjs\";\nimport { a as rendersIndexBody, t as accessMethodOf } from \"./index-types-pC_5vADQ.mjs\";\nimport { r as lowerAuthoredIndex } from \"./index-naming-BOcJT1B3.mjs\";\nimport { i as leadingBackingObjectName, n as identicalIndexes, o as servingKey, r as indexNodeOf, s as startsWithColumns, t as derivedBackingIndexIsRedundant } from \"./index-equivalence-DswCiq5l.mjs\";\nimport { defaultIndexName, nameOf, truncateToWireNamePrefixBytes } from \"@internal/sql-schema-ir/naming\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { asNamespaceId } from \"@internal/contract/types\";\n//#region src/index-deduplication.ts\nconst IDENTICAL_DESCRIPTION = \"the planner sees them as the same index. The contract keeps both because each is named.\";\nconst REDUNDANT_DESCRIPTION = \"which already serves the same lookups.\";\n/**\n* Removes the indexes of one table that duplicate another. Two indexes are identical when the planner sees them as the same index apart from their names (see {@link identicalIndexes}); of an identical group the pass keeps the indexes named by the user, or the first one when none is. A plain non-unique index whose columns are those of the primary key, a unique constraint or a unique index without a predicate is redundant (see {@link servingKey}), and the pass removes it unless it is named by the user. Every index named by the user survives; the pass warns about each one that duplicates another, and refuses two identical indexes both named with `name:`, whose wire names the planner could not tell apart.\n*/\nfunction deduplicateIndexes(input) {\n\tconst { tableName, warnings } = input;\n\tconst replacements = /* @__PURE__ */ new Map();\n\tconst nodes = new Map(input.indexes.map((candidate) => [candidate, indexNodeOf(candidate.index)]));\n\tconst nodeOf = (candidate) => {\n\t\tconst node = nodes.get(candidate);\n\t\tif (node === void 0) throw new InternalError(\"every candidate has a node\");\n\t\treturn node;\n\t};\n\tconst groups = [];\n\tfor (const candidate of input.indexes) {\n\t\tconst position = groups.findIndex(([first]) => identicalIndexes(nodeOf(first), nodeOf(candidate)));\n\t\tconst group = groups[position];\n\t\tif (group === void 0) groups.push([candidate]);\n\t\telse groups[position] = [...group, candidate];\n\t}\n\tfor (const group of groups) {\n\t\tconst named = group.filter((candidate) => candidate.namedByUser);\n\t\tconst wireNamed = named.filter((candidate) => candidate.index.naming.kind === \"wire\");\n\t\tif (wireNamed.length > 1) throw identicalWireNamedIndexesError(tableName, wireNamed);\n\t\tconst kept = named[0] ?? group[0];\n\t\tfor (const candidate of group) if (candidate !== kept && !candidate.namedByUser) replacements.set(candidate, {\n\t\t\tkind: \"index\",\n\t\t\tindex: kept\n\t\t});\n\t\tif (named.length > 1) warnings.push(identicalIndexesWarning(tableName, named));\n\t}\n\tconst survivors = input.indexes.filter((candidate) => !replacements.has(candidate));\n\tfor (const candidate of survivors) {\n\t\tconst servedBy = servingKey(nodeOf(candidate), {\n\t\t\tindexes: survivors,\n\t\t\tnodeOf,\n\t\t\tuniques: input.uniques,\n\t\t\tprimaryKey: input.primaryKey\n\t\t});\n\t\tif (servedBy === void 0) continue;\n\t\tif (candidate.namedByUser) warnings.push(redundantIndexWarning(tableName, candidate, servedBy));\n\t\telse replacements.set(candidate, servedBy);\n\t}\n\treturn {\n\t\tindexes: input.indexes.filter((candidate) => !replacements.has(candidate)),\n\t\treplacements\n\t};\n}\nfunction identicalWireNamedIndexesError(tableName, wireNamed) {\n\treturn contractError(\"CONTRACT.ARGUMENT_INVALID\", `Indexes ${quotedList(wireNamed.map((candidate) => writtenName(candidate.index)))} on table \"${tableName}\" are identical and both named with name:; the planner pairs wire-named indexes by their content, so it could not tell them apart.`, {\n\t\tfix: \"Remove one of them, or name one with map: to keep both under exact names.\",\n\t\tmeta: {\n\t\t\ttableName,\n\t\t\tindexes: wireNamed.map((candidate) => writtenName(candidate.index))\n\t\t}\n\t});\n}\n/** The name the source wrote: the prefix of a wire-named index, the whole name of an exact one. */\nfunction writtenName(index) {\n\treturn index.naming.kind === \"wire\" ? index.naming.prefix : index.naming.name;\n}\nfunction quotedList(names) {\n\tconst quoted = names.map((name) => `\"${name}\"`);\n\treturn quoted.length <= 2 ? quoted.join(\" and \") : `${quoted.slice(0, -1).join(\", \")} and ${quoted.at(-1)}`;\n}\nfunction identicalIndexesWarning(tableName, named) {\n\tconst names = quotedList(named.map((candidate) => writtenName(candidate.index)));\n\treturn {\n\t\tcode: \"PN_INDEX_DUPLICATE\",\n\t\tmessage: `Indexes ${names} on table \"${tableName}\" are identical: ${IDENTICAL_DESCRIPTION} Remove one of them.`,\n\t\titem: `table \"${tableName}\": indexes ${names}`,\n\t\tsummary: `tables have named indexes that are identical: ${IDENTICAL_DESCRIPTION} Remove one of each.`\n\t};\n}\nfunction describeReplacement(replacement) {\n\tswitch (replacement.kind) {\n\t\tcase \"primaryKey\": return \"the primary key\";\n\t\tcase \"uniqueConstraint\": return replacement.unique.name === void 0 ? `the unique constraint on (${replacement.unique.columns.join(\", \")})` : `the unique constraint \"${replacement.unique.name}\"`;\n\t\tcase \"index\": return `the unique index \"${writtenName(replacement.index.index)}\"`;\n\t}\n}\nfunction redundantIndexWarning(tableName, candidate, servedBy) {\n\tconst name = writtenName(candidate.index);\n\treturn {\n\t\tcode: \"PN_INDEX_REDUNDANT\",\n\t\tmessage: `Index \"${name}\" on table \"${tableName}\" has the same columns as ${describeReplacement(servedBy)}, ${REDUNDANT_DESCRIPTION} The contract keeps the index because it is named. Remove it.`,\n\t\titem: `table \"${tableName}\": index \"${name}\"`,\n\t\tsummary: `tables have a named index with the same columns as a unique constraint, unique index or primary key, ${REDUNDANT_DESCRIPTION} The contract keeps each index because it is named. Remove them.`\n\t};\n}\n//#endregion\n//#region src/foreign-key-materialization.ts\n/** The `meta.reason` of the refusal of a relation's `index: \"<name>\"`, which a source can report at the relation. */\nconst FOREIGN_KEY_INDEX_UNRESOLVED = \"foreign-key-index-unresolved\";\n/**\n* Lowers a table's authored foreign keys and indexes into the entities `contract.json` persists. A `constraint: false` foreign key contributes no `foreignKeys[]` entry. A foreign key with `index: true` gets a derived backing index; one with `index: \"<name>\"` uses what the table declares under that name. The table's indexes then pass through {@link deduplicateIndexes}, and each foreign key states what backs it in the result: an index by name, or the primary key or a unique constraint by kind.\n*/\nfunction materializeForeignKeysAndIndexes(input) {\n\tconst { tableName, declaredIndexes, uniques, primaryKey, indexTypes } = input;\n\tconst derivedIndexes = [];\n\tconst intents = input.foreignKeys.map((foreignKey) => {\n\t\tconst { constraint, index, ...reference } = foreignKey;\n\t\tif (index !== true) return {\n\t\t\tconstraint,\n\t\t\treference,\n\t\t\tindex\n\t\t};\n\t\tconst derived = derivedBackingIndex(tableName, reference.source.columns);\n\t\tderivedIndexes.push(derived);\n\t\treturn {\n\t\t\tconstraint,\n\t\t\treference,\n\t\t\tindex: derived\n\t\t};\n\t});\n\tconst deduplicated = deduplicateIndexes({\n\t\ttableName,\n\t\tindexes: [...declaredIndexes, ...derivedIndexes],\n\t\tuniques,\n\t\tprimaryKey,\n\t\twarnings: input.warnings\n\t});\n\tconst resolve = (backing) => foreignKeyIndexOf(resolveReplacement(backing, deduplicated.replacements));\n\treturn {\n\t\tforeignKeys: intents.flatMap(({ constraint, reference, index }) => {\n\t\t\tconst backing = index === false ? void 0 : typeof index === \"string\" ? namedBackingObject(reference.source, index, {\n\t\t\t\tdeclaredIndexes,\n\t\t\t\tuniques,\n\t\t\t\tprimaryKey,\n\t\t\t\tindexTypes,\n\t\t\t\tresolve\n\t\t\t}) : resolve({\n\t\t\t\tkind: \"index\",\n\t\t\t\tindex\n\t\t\t});\n\t\t\tif (!constraint) return [];\n\t\t\treturn [backing === void 0 ? reference : {\n\t\t\t\t...reference,\n\t\t\t\tindex: backing\n\t\t\t}];\n\t\t}),\n\t\tindexes: deduplicated.indexes.map((candidate) => candidate.index)\n\t};\n}\n/**\n* Whether a table's declared indexes, unique constraints or primary key already serve a foreign key on `columns`, so the build would drop a derived backing index again. A source that writes no backing index of its own, such as a Prisma 7 schema, leaves the foreign key's `index` to the build where this holds, so the stored foreign key states what backs it.\n*/\nfunction declaredIndexesServeForeignKey(columns, table) {\n\treturn derivedBackingIndexIsRedundant(columns, {\n\t\tindexes: table.indexes,\n\t\tnodeOf: indexNodeOf,\n\t\tuniques: table.uniques,\n\t\tprimaryKey: table.primaryKey\n\t});\n}\n/**\n* The name to give a relation's `index` argument when the table's declared indexes and keys serve a foreign key on `columns` although the build would keep a derived backing index beside them (see {@link leadingBackingObjectName}).\n*/\nfunction declaredBackingObjectName(columns, table) {\n\treturn leadingBackingObjectName(columns, {\n\t\tindexes: table.indexes,\n\t\tnodeOf: indexNodeOf,\n\t\tnameOf: (index) => nameOf(index.naming),\n\t\tuniques: table.uniques,\n\t\tprimaryKey: table.primaryKey\n\t});\n}\n/**\n* What a foreign key on `columns` states it is backed by when its relation says nothing, beside a table whose indexes all carry the `name` or `map` the source gave them, as a printed contract's do. A printer writes a relation's `index` argument only where the stored foreign key differs from this.\n*/\nfunction defaultForeignKeyIndex(tableName, columns, table) {\n\tconst reference = {\n\t\tnamespaceId: asNamespaceId(UNBOUND_NAMESPACE_ID),\n\t\ttableName,\n\t\tcolumns\n\t};\n\tconst [foreignKey] = materializeForeignKeysAndIndexes({\n\t\ttableName,\n\t\tforeignKeys: [{\n\t\t\tsource: reference,\n\t\t\ttarget: reference,\n\t\t\tconstraint: true,\n\t\t\tindex: true\n\t\t}],\n\t\tdeclaredIndexes: table.indexes.map((index) => ({\n\t\t\tindex,\n\t\t\tnamedByUser: true\n\t\t})),\n\t\tuniques: table.uniques,\n\t\tprimaryKey: table.primaryKey,\n\t\twarnings: [],\n\t\tindexTypes: void 0\n\t}).foreignKeys;\n\treturn typeof foreignKey?.index === \"object\" ? foreignKey.index : void 0;\n}\nfunction derivedBackingIndex(tableName, columns) {\n\treturn {\n\t\tindex: lowerAuthoredIndex(tableName, {\n\t\t\tcolumns,\n\t\t\twhere: void 0,\n\t\t\tunique: void 0,\n\t\t\tmap: void 0,\n\t\t\tname: truncateToWireNamePrefixBytes(defaultIndexName(tableName, columns)),\n\t\t\ttype: void 0,\n\t\t\toptions: void 0\n\t\t}),\n\t\tnamedByUser: false\n\t};\n}\n/**\n* What a relation's `index: \"<name>\"` points at. The name is the `name` or `map` the source gave an index, unique constraint or primary key, or an index's stored name; an unnamed index's default name does not count. Identical indexes count as one, so the name is resolved after they merge. The object must start with the foreign key's columns, in order, or it would not serve the foreign key's lookups. An index of a type whose body is rendered from its options (see {@link rendersIndexBody}) is refused too: its columns are not its key.\n*/\nfunction namedBackingObject(source, name, table) {\n\tconst { namespaceId, tableName, columns } = source;\n\tconst subject = `The foreign key on table \"${tableName}\" columns (${columns.join(\", \")}) names \"${name}\" as its index`;\n\tconst meta = {\n\t\treason: FOREIGN_KEY_INDEX_UNRESOLVED,\n\t\tnamespaceId,\n\t\ttableName,\n\t\tcolumns,\n\t\tindex: name\n\t};\n\tconst indexes = table.declaredIndexes.filter((candidate) => candidate.namedByUser && writtenName(candidate.index) === name || nameOf(candidate.index.naming) === name);\n\tconst keys = [...table.uniques.filter((unique) => unique.name === name), ...table.primaryKey?.name === name ? [table.primaryKey] : []];\n\tconst resolvedIndexes = [...new Map(indexes.map((index) => {\n\t\tconst resolved = table.resolve({\n\t\t\tkind: \"index\",\n\t\t\tindex\n\t\t});\n\t\treturn [JSON.stringify(resolved), {\n\t\t\tindex,\n\t\t\tresolved\n\t\t}];\n\t})).values()];\n\tconst matches = resolvedIndexes.length + keys.length;\n\tif (matches === 0) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", `${subject}, but table \"${tableName}\" has no index, unique constraint or primary key with that name.`, {\n\t\tfix: `Declare an index, unique constraint or primary key named \"${name}\" on table \"${tableName}\", or drop the index argument so the foreign key gets its own backing index.`,\n\t\tmeta\n\t});\n\tif (matches > 1) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", `${subject}, but table \"${tableName}\" has more than one index, unique constraint or primary key with that name.`, {\n\t\tfix: `Give the object the foreign key should use a name no other index, unique constraint or primary key of table \"${tableName}\" has, and name that on the relation.`,\n\t\tmeta\n\t});\n\tconst [match] = resolvedIndexes;\n\tconst key = keys[0];\n\tconst matchType = match?.index.index.type;\n\tconst typeEntry = matchType === void 0 ? void 0 : table.indexTypes?.get(matchType);\n\tif (typeEntry !== void 0 && rendersIndexBody(typeEntry)) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", `${subject}, but it is a \"${typeEntry.type}\" index, a \"${accessMethodOf(typeEntry)}\" index whose key is rendered from its options rather than its columns, so it does not serve the foreign key's lookups.`, {\n\t\tfix: `Name an index, unique constraint or primary key whose first columns are (${columns.join(\", \")}), or drop the index argument so the foreign key gets its own backing index beside the \"${typeEntry.type}\" index.`,\n\t\tmeta\n\t});\n\tconst objectColumns = match !== void 0 ? match.index.index.columns : key?.columns;\n\tif (objectColumns === void 0 || !startsWithColumns(objectColumns, columns)) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", `${subject}, but ${objectColumns === void 0 ? \"it indexes an expression, not the foreign key's columns\" : `its columns (${objectColumns.join(\", \")}) do not start with the foreign key's columns`}, so it does not serve the foreign key's lookups.`, {\n\t\tfix: `Name an index, unique constraint or primary key whose first columns are (${columns.join(\", \")}), or drop the index argument so the foreign key gets its own backing index.`,\n\t\tmeta\n\t});\n\tif (match !== void 0) return match.resolved;\n\treturn key === table.primaryKey ? { primaryKey: true } : { unique: objectColumns };\n}\nfunction resolveReplacement(backing, replacements) {\n\tlet current = backing;\n\twhile (current.kind === \"index\") {\n\t\tconst replacement = replacements.get(current.index);\n\t\tif (replacement === void 0) break;\n\t\tcurrent = replacement;\n\t}\n\treturn current;\n}\nfunction foreignKeyIndexOf(backing) {\n\tswitch (backing.kind) {\n\t\tcase \"index\": return { name: nameOf(backing.index.index.naming) };\n\t\tcase \"uniqueConstraint\": return { unique: backing.unique.columns };\n\t\tcase \"primaryKey\": return { primaryKey: true };\n\t}\n}\n//#endregion\nexport { FOREIGN_KEY_INDEX_UNRESOLVED, declaredBackingObjectName, declaredIndexesServeForeignKey, defaultForeignKeyIndex, derivedBackingIndexIsRedundant, leadingBackingObjectName, materializeForeignKeysAndIndexes };\n\n//# sourceMappingURL=foreign-key-materialization.mjs.map"],"mappings":";;;;;;;;;AASA,MAAM,wBAAwB;AAC9B,MAAM,wBAAwB;;;;AAI9B,SAAS,mBAAmB,OAAO;CAClC,MAAM,EAAE,WAAW,aAAa;CAChC,MAAM,+BAA+B,IAAI,IAAI;CAC7C,MAAM,QAAQ,IAAI,IAAI,MAAM,QAAQ,KAAK,cAAc,CAAC,WAAW,YAAY,UAAU,KAAK,CAAC,CAAC,CAAC;CACjG,MAAM,UAAU,cAAc;EAC7B,MAAM,OAAO,MAAM,IAAI,SAAS;EAChC,IAAI,SAAS,KAAK,GAAG,MAAM,IAAI,cAAc,4BAA4B;EACzE,OAAO;CACR;CACA,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,aAAa,MAAM,SAAS;EACtC,MAAM,WAAW,OAAO,WAAW,CAAC,WAAW,iBAAiB,OAAO,KAAK,GAAG,OAAO,SAAS,CAAC,CAAC;EACjG,MAAM,QAAQ,OAAO;EACrB,IAAI,UAAU,KAAK,GAAG,OAAO,KAAK,CAAC,SAAS,CAAC;OACxC,OAAO,YAAY,CAAC,GAAG,OAAO,SAAS;CAC7C;CACA,KAAK,MAAM,SAAS,QAAQ;EAC3B,MAAM,QAAQ,MAAM,QAAQ,cAAc,UAAU,WAAW;EAC/D,MAAM,YAAY,MAAM,QAAQ,cAAc,UAAU,MAAM,OAAO,SAAS,MAAM;EACpF,IAAI,UAAU,SAAS,GAAG,MAAM,+BAA+B,WAAW,SAAS;EACnF,MAAM,OAAO,MAAM,MAAM,MAAM;EAC/B,KAAK,MAAM,aAAa,OAAO,IAAI,cAAc,QAAQ,CAAC,UAAU,aAAa,aAAa,IAAI,WA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1,6 +1,6 @@
|
|
|
1
|
-
import { t as SqlNode } from "./sql-node-kEz6YFZo-
|
|
1
|
+
import { t as SqlNode } from "./sql-node-kEz6YFZo-1ogT6Cxt.mjs";
|
|
2
2
|
import { NamespaceId } from "@prisma/orm-framework/contract/types";
|
|
3
|
-
//#region ../../../2-sql/1-core/contract/dist/foreign-key-
|
|
3
|
+
//#region ../../../2-sql-family/1-core/contract/dist/foreign-key-qkDFfG8t.d.mts
|
|
4
4
|
//#region src/ir/foreign-key-reference.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Input for a foreign-key reference (one side of a foreign-key declaration).
|
|
@@ -46,12 +46,26 @@ declare class ForeignKeyReference extends SqlNode {
|
|
|
46
46
|
//#endregion
|
|
47
47
|
//#region src/ir/foreign-key.d.ts
|
|
48
48
|
type ReferentialAction = 'noAction' | 'restrict' | 'cascade' | 'setNull' | 'setDefault';
|
|
49
|
+
/**
|
|
50
|
+
* What serves a foreign key's lookups on its own table, each in the way the contract identifies it: an index by its stored name, the primary key by kind, a unique constraint by its columns. The first columns of each are the foreign key's columns.
|
|
51
|
+
*/
|
|
52
|
+
type ForeignKeyIndex = {
|
|
53
|
+
readonly name: string;
|
|
54
|
+
} | {
|
|
55
|
+
readonly primaryKey: true;
|
|
56
|
+
} | {
|
|
57
|
+
readonly unique: readonly string[];
|
|
58
|
+
};
|
|
49
59
|
interface ForeignKeyInput {
|
|
50
60
|
readonly source: ForeignKeyReference | ForeignKeyReferenceInput;
|
|
51
61
|
readonly target: ForeignKeyReference | ForeignKeyReferenceInput;
|
|
52
62
|
readonly name?: string;
|
|
53
63
|
readonly onDelete?: ReferentialAction;
|
|
54
64
|
readonly onUpdate?: ReferentialAction;
|
|
65
|
+
/**
|
|
66
|
+
* A `contract.json` emitted before 0.16 stores `true` or `false` here, the superseded per-foreign-key flag; it says nothing about the table's indexes and reads as absent.
|
|
67
|
+
*/
|
|
68
|
+
readonly index?: ForeignKeyIndex | boolean;
|
|
55
69
|
}
|
|
56
70
|
/**
|
|
57
71
|
* SQL Contract IR node for a table-level foreign-key declaration — the
|
|
@@ -62,7 +76,8 @@ interface ForeignKeyInput {
|
|
|
62
76
|
* authoring-time decisions (PSL `@relation(index:)`, TS `fk({ constraint,
|
|
63
77
|
* index })`) resolved once at `contract emit` — a `constraint: false` FK
|
|
64
78
|
* simply has no entry here, and a backing index (if any) is its own discrete,
|
|
65
|
-
* named entry in the table's `indexes[]`.
|
|
79
|
+
* named entry in the table's `indexes[]`. `index` says what serves the
|
|
80
|
+
* foreign key's lookups; it is absent when nothing backs the foreign key.
|
|
66
81
|
*
|
|
67
82
|
* Each FK carries explicit `source` and `target` {@link ForeignKeyReference}
|
|
68
83
|
* coordinates (namespace, table, columns). For single-namespace contracts the
|
|
@@ -79,9 +94,10 @@ declare class ForeignKey extends SqlNode {
|
|
|
79
94
|
readonly name?: string;
|
|
80
95
|
readonly onDelete?: ReferentialAction;
|
|
81
96
|
readonly onUpdate?: ReferentialAction;
|
|
97
|
+
readonly index?: ForeignKeyIndex;
|
|
82
98
|
constructor(input: ForeignKeyInput);
|
|
83
99
|
static from(value: ForeignKey | ForeignKeyInput): ForeignKey;
|
|
84
100
|
}
|
|
85
101
|
//#endregion
|
|
86
|
-
export {
|
|
87
|
-
//# sourceMappingURL=foreign-key-
|
|
102
|
+
export { ForeignKeyReferenceInput as a, ForeignKeyReference as i, ForeignKeyIndex as n, ReferentialAction as o, ForeignKeyInput as r, ForeignKey as t };
|
|
103
|
+
//# sourceMappingURL=foreign-key-qkDFfG8t-TaK_GYWR.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foreign-key-qkDFfG8t-TaK_GYWR.d.mts","names":[],"sources":["../../../../2-sql-family/1-core/contract/dist/foreign-key-qkDFfG8t.d.mts"],"mappings":";;;;;;;;;;;;;;;UAcU;WACC;WACA;WACA;WACA;;;;;;;;;;;;;;;;;;cAkBG,4BAA4B;WAC/B,aAAa;WACb;WACA;WACA;EACT,YAAY,OAAO;SACZ,KAAK,OAAO,sBAAsB,2BAA2B;;;;KAIjE;;;;KAIA;WACM;;WAEA;;WAEA;;UAED;WACC,QAAQ,sBAAsB;WAC9B,QAAQ,sBAAsB;WAC9B;WACA,WAAW;WACX,WAAW;;;;WAIX,QAAQ;;;;;;;;;;;;;;;;;;;;;;;cAuBL,mBAAmB;WACtB,QAAQ;WACR,QAAQ;WACR;WACA,WAAW;WACX,WAAW;WACX,QAAQ;EACjB,YAAY,OAAO;SACZ,KAAK,OAAO,aAAa,kBAAkB"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { C as LiteralExpr, E as NullCheckExpr, I as SubqueryExpr, O as OrExpr, S as ListExpression, n as AndExpr, p as ExistsExpr, r as BinaryExpr } from "./types-NTQsD2MS-xcLtvKO9.mjs";
|
|
2
|
+
import { a as isExpression, i as createRawSql, r as codecOf, s as toExpr, t as ExpressionImpl } from "./expression-impl-B-XNINxr-BhN2sysZ.mjs";
|
|
3
|
+
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
4
|
+
//#region ../../../2-sql-family/4-lanes/relational-core/dist/exports/functions.mjs
|
|
5
|
+
const BOOL_FIELD = {
|
|
6
|
+
codecId: "pg/bool@1",
|
|
7
|
+
nullable: false
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Resolve a binary-comparison operand into an AST expression, threading the column-bound side's {@link CodecRef} to the raw-value side.
|
|
11
|
+
*
|
|
12
|
+
* For `fns.eq(f.email, 'alice@example.com')`, `f.email` is the column-bound expression carrying a `ColumnRef` AST and a `CodecRef` derived from contract storage; the raw string operand has no codec context. By deriving the codec context from the column-bound side and forwarding it via `toExpr(value, codec)`, the resulting `ParamRef` carries the `CodecRef` that encode-side dispatch needs to materialise the per-instance codec for parameterized codec ids (`vector(1024)` vs. `vector(1536)`).
|
|
13
|
+
*/
|
|
14
|
+
function resolveOperand(operand, otherCodec) {
|
|
15
|
+
if (isExpression(operand)) return operand.buildAst();
|
|
16
|
+
return toExpr(operand, otherCodec);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Resolves an Expression via `buildAst()`, or wraps a raw value as a `LiteralExpr` — an SQL literal inlined into the query text, not a bound parameter.
|
|
20
|
+
*
|
|
21
|
+
* Used for `and` / `or` operands. The usual operand is an `Expression<bool>` (e.g. the result of `fns.eq`), which this function passes through by calling `buildAst()`. The only time the raw-value branch fires is when the caller writes `fns.and(true, x)` or similar — inlining `TRUE`/`FALSE` literals lets the SQL planner statically simplify `TRUE AND x` to `x`, which it cannot do for an opaque `ParamRef`.
|
|
22
|
+
*/
|
|
23
|
+
function toLiteralExpr(value) {
|
|
24
|
+
if (isExpression(value)) return value.buildAst();
|
|
25
|
+
return new LiteralExpr(value);
|
|
26
|
+
}
|
|
27
|
+
function boolExpr(astNode) {
|
|
28
|
+
return new ExpressionImpl(astNode, BOOL_FIELD);
|
|
29
|
+
}
|
|
30
|
+
function binaryWithSharedCodec(a, b, build) {
|
|
31
|
+
const aCodec = codecOf(a);
|
|
32
|
+
return build(resolveOperand(a, codecOf(b)), resolveOperand(b, aCodec));
|
|
33
|
+
}
|
|
34
|
+
function eq(a, b) {
|
|
35
|
+
if (b === null) return boolExpr(NullCheckExpr.isNull(toExpr(a)));
|
|
36
|
+
if (a === null) return boolExpr(NullCheckExpr.isNull(toExpr(b)));
|
|
37
|
+
return boolExpr(binaryWithSharedCodec(a, b, (l, r) => new BinaryExpr("eq", l, r)));
|
|
38
|
+
}
|
|
39
|
+
function ne(a, b) {
|
|
40
|
+
if (b === null) return boolExpr(NullCheckExpr.isNotNull(toExpr(a)));
|
|
41
|
+
if (a === null) return boolExpr(NullCheckExpr.isNotNull(toExpr(b)));
|
|
42
|
+
return boolExpr(binaryWithSharedCodec(a, b, (l, r) => new BinaryExpr("neq", l, r)));
|
|
43
|
+
}
|
|
44
|
+
function comparison(a, b, op) {
|
|
45
|
+
return boolExpr(binaryWithSharedCodec(a, b, (l, r) => new BinaryExpr(op, l, r)));
|
|
46
|
+
}
|
|
47
|
+
function inOrNotIn(expr, valuesOrSubquery, op) {
|
|
48
|
+
const left = expr.buildAst();
|
|
49
|
+
const leftCodec = codecOf(expr);
|
|
50
|
+
const binaryFn = op === "in" ? BinaryExpr.in : BinaryExpr.notIn;
|
|
51
|
+
if (Array.isArray(valuesOrSubquery)) {
|
|
52
|
+
const refs = valuesOrSubquery.map((v) => resolveOperand(v, leftCodec));
|
|
53
|
+
return boolExpr(binaryFn(left, ListExpression.of(refs)));
|
|
54
|
+
}
|
|
55
|
+
return boolExpr(binaryFn(left, SubqueryExpr.of(valuesOrSubquery.buildAst())));
|
|
56
|
+
}
|
|
57
|
+
function createBuiltinFunctions(rawCodecInferer) {
|
|
58
|
+
return {
|
|
59
|
+
eq: (a, b) => eq(a, b),
|
|
60
|
+
ne: (a, b) => ne(a, b),
|
|
61
|
+
gt: (a, b) => comparison(a, b, "gt"),
|
|
62
|
+
gte: (a, b) => comparison(a, b, "gte"),
|
|
63
|
+
lt: (a, b) => comparison(a, b, "lt"),
|
|
64
|
+
lte: (a, b) => comparison(a, b, "lte"),
|
|
65
|
+
and: (...exprs) => boolExpr(AndExpr.of(exprs.map(toLiteralExpr))),
|
|
66
|
+
or: (...exprs) => boolExpr(OrExpr.of(exprs.map(toLiteralExpr))),
|
|
67
|
+
exists: (subquery) => boolExpr(ExistsExpr.exists(subquery.buildAst())),
|
|
68
|
+
notExists: (subquery) => boolExpr(ExistsExpr.notExists(subquery.buildAst())),
|
|
69
|
+
in: (expr, valuesOrSubquery) => inOrNotIn(expr, valuesOrSubquery, "in"),
|
|
70
|
+
notIn: (expr, valuesOrSubquery) => inOrNotIn(expr, valuesOrSubquery, "notIn"),
|
|
71
|
+
raw: createRawSql(rawCodecInferer)
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The function surface for a contract: the built-in functions, and each registered query operation's implementation under its name.
|
|
76
|
+
*/
|
|
77
|
+
function createFunctions(operations, rawCodecInferer) {
|
|
78
|
+
const builtins = createBuiltinFunctions(rawCodecInferer);
|
|
79
|
+
return new Proxy(blindCast({}), { get(_target, prop) {
|
|
80
|
+
if (Object.hasOwn(builtins, prop)) return blindCast(builtins)[prop];
|
|
81
|
+
const op = operations[prop];
|
|
82
|
+
if (op) return op.impl;
|
|
83
|
+
} });
|
|
84
|
+
}
|
|
85
|
+
//#endregion
|
|
86
|
+
export { createFunctions as t };
|
|
87
|
+
|
|
88
|
+
//# sourceMappingURL=functions-CsOoN7I3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions-CsOoN7I3.mjs","names":[],"sources":["../../../../2-sql-family/4-lanes/relational-core/dist/exports/functions.mjs"],"sourcesContent":["import { C as LiteralExpr, E as NullCheckExpr, I as SubqueryExpr, O as OrExpr, S as ListExpression, n as AndExpr, p as ExistsExpr, r as BinaryExpr } from \"../types-NTQsD2MS.mjs\";\nimport { a as isExpression, i as createRawSql, r as codecOf, s as toExpr, t as ExpressionImpl } from \"../expression-impl-B-XNINxr.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/functions.ts\nconst BOOL_FIELD = {\n\tcodecId: \"pg/bool@1\",\n\tnullable: false\n};\n/**\n* Resolve a binary-comparison operand into an AST expression, threading the column-bound side's {@link CodecRef} to the raw-value side.\n*\n* For `fns.eq(f.email, 'alice@example.com')`, `f.email` is the column-bound expression carrying a `ColumnRef` AST and a `CodecRef` derived from contract storage; the raw string operand has no codec context. By deriving the codec context from the column-bound side and forwarding it via `toExpr(value, codec)`, the resulting `ParamRef` carries the `CodecRef` that encode-side dispatch needs to materialise the per-instance codec for parameterized codec ids (`vector(1024)` vs. `vector(1536)`).\n*/\nfunction resolveOperand(operand, otherCodec) {\n\tif (isExpression(operand)) return operand.buildAst();\n\treturn toExpr(operand, otherCodec);\n}\n/**\n* Resolves an Expression via `buildAst()`, or wraps a raw value as a `LiteralExpr` — an SQL literal inlined into the query text, not a bound parameter.\n*\n* Used for `and` / `or` operands. The usual operand is an `Expression<bool>` (e.g. the result of `fns.eq`), which this function passes through by calling `buildAst()`. The only time the raw-value branch fires is when the caller writes `fns.and(true, x)` or similar — inlining `TRUE`/`FALSE` literals lets the SQL planner statically simplify `TRUE AND x` to `x`, which it cannot do for an opaque `ParamRef`.\n*/\nfunction toLiteralExpr(value) {\n\tif (isExpression(value)) return value.buildAst();\n\treturn new LiteralExpr(value);\n}\nfunction boolExpr(astNode) {\n\treturn new ExpressionImpl(astNode, BOOL_FIELD);\n}\nfunction binaryWithSharedCodec(a, b, build) {\n\tconst aCodec = codecOf(a);\n\treturn build(resolveOperand(a, codecOf(b)), resolveOperand(b, aCodec));\n}\nfunction eq(a, b) {\n\tif (b === null) return boolExpr(NullCheckExpr.isNull(toExpr(a)));\n\tif (a === null) return boolExpr(NullCheckExpr.isNull(toExpr(b)));\n\treturn boolExpr(binaryWithSharedCodec(a, b, (l, r) => new BinaryExpr(\"eq\", l, r)));\n}\nfunction ne(a, b) {\n\tif (b === null) return boolExpr(NullCheckExpr.isNotNull(toExpr(a)));\n\tif (a === null) return boolExpr(NullCheckExpr.isNotNull(toExpr(b)));\n\treturn boolExpr(binaryWithSharedCodec(a, b, (l, r) => new BinaryExpr(\"neq\", l, r)));\n}\nfunction comparison(a, b, op) {\n\treturn boolExpr(binaryWithSharedCodec(a, b, (l, r) => new BinaryExpr(op, l, r)));\n}\nfunction inOrNotIn(expr, valuesOrSubquery, op) {\n\tconst left = expr.buildAst();\n\tconst leftCodec = codecOf(expr);\n\tconst binaryFn = op === \"in\" ? BinaryExpr.in : BinaryExpr.notIn;\n\tif (Array.isArray(valuesOrSubquery)) {\n\t\tconst refs = valuesOrSubquery.map((v) => resolveOperand(v, leftCodec));\n\t\treturn boolExpr(binaryFn(left, ListExpression.of(refs)));\n\t}\n\treturn boolExpr(binaryFn(left, SubqueryExpr.of(valuesOrSubquery.buildAst())));\n}\nfunction createBuiltinFunctions(rawCodecInferer) {\n\treturn {\n\t\teq: (a, b) => eq(a, b),\n\t\tne: (a, b) => ne(a, b),\n\t\tgt: (a, b) => comparison(a, b, \"gt\"),\n\t\tgte: (a, b) => comparison(a, b, \"gte\"),\n\t\tlt: (a, b) => comparison(a, b, \"lt\"),\n\t\tlte: (a, b) => comparison(a, b, \"lte\"),\n\t\tand: (...exprs) => boolExpr(AndExpr.of(exprs.map(toLiteralExpr))),\n\t\tor: (...exprs) => boolExpr(OrExpr.of(exprs.map(toLiteralExpr))),\n\t\texists: (subquery) => boolExpr(ExistsExpr.exists(subquery.buildAst())),\n\t\tnotExists: (subquery) => boolExpr(ExistsExpr.notExists(subquery.buildAst())),\n\t\tin: (expr, valuesOrSubquery) => inOrNotIn(expr, valuesOrSubquery, \"in\"),\n\t\tnotIn: (expr, valuesOrSubquery) => inOrNotIn(expr, valuesOrSubquery, \"notIn\"),\n\t\traw: createRawSql(rawCodecInferer)\n\t};\n}\n/**\n* The function surface for a contract: the built-in functions, and each registered query operation's implementation under its name.\n*/\nfunction createFunctions(operations, rawCodecInferer) {\n\tconst builtins = createBuiltinFunctions(rawCodecInferer);\n\treturn new Proxy(blindCast({}), { get(_target, prop) {\n\t\tif (Object.hasOwn(builtins, prop)) return blindCast(builtins)[prop];\n\t\tconst op = operations[prop];\n\t\tif (op) return op.impl;\n\t} });\n}\n//#endregion\nexport { createFunctions };\n\n//# sourceMappingURL=functions.mjs.map"],"mappings":";;;;AAIA,MAAM,aAAa;CAClB,SAAS;CACT,UAAU;AACX;;;;;;AAMA,SAAS,eAAe,SAAS,YAAY;CAC5C,IAAI,aAAa,OAAO,GAAG,OAAO,QAAQ,SAAS;CACnD,OAAO,OAAO,SAAS,UAAU;AAClC;;;;;;AAMA,SAAS,cAAc,OAAO;CAC7B,IAAI,aAAa,KAAK,GAAG,OAAO,MAAM,SAAS;CAC/C,OAAO,IAAI,YAAY,KAAK;AAC7B;AACA,SAAS,SAAS,SAAS;CAC1B,OAAO,IAAI,eAAe,SAAS,UAAU;AAC9C;AACA,SAAS,sBAA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uBAAuB,iBAAiB;CAChD,OAAO;EACN,KAAK,GAAG,MAAM,GAAG,GAAG,CAAC;EACrB,KAAK,GAAG,MAAM,GAAG,GAAG,CAAC;EACrB,KAAK,GAAG,MAAM,WAAW,GAAG,GAAG,IAAI;EACnC,MAAM,GAAG,MAAM,WAAW,GAAG,GAAG,KAAK;EACrC,KAAK,GAAG,MAAM,WAAW,GAAG,GAAG,IAAI;EACnC,MAAM,GAAG,MAAM,WAAW,GAAG,GAAG,KAAK;EACrC,MAAM,GAAG,UAAU,SAAS,QAAQ,GAAG,MAAM,IAAI,aAAa,CAAC,CAAC;EAChE,KAAK,GAAG,UAAU,SAAS,OAAO,GAAG,MAAM,IAAI,aAAa,CAAC,CAAC;EAC9D,SAAS,aAAa,SAAS,WAAW,OAAO,SAAS,SAAS,CAAC,CAAC;EACrE,YAAY,aAAa,SAAS,WAAW,UAAU,SAAS,SAAS,CAAC,CAAC;EAC3E,KAAK,MAAM,qBAAqB,UAAU,MAAM,kBAAkB,IAAI;EACtE,QAAQ,MAAM,qBAAqB,UAAU,MAAM,kBAAkB,OAAO;EAC5E,KAAK,aAAa,eAAe;CAClC;AACD;;;;AAIA,SAAS,gBAAgB,YAAY,iBAAiB;CACrD,MAAM,WAAW,uBAAuB,eAAe;CACvD,OAAO,IAAI,MAAM,UAAU,CAAC,CAAC,GAAG,EAAE,IAAI,SAAS,MAAM;EACpD,IAAI,OAAO,OAAO,UAAU,IAAI,GAAG,OAAO,UAAU,QAAQ,CAAC,CAAC;EAC9D,MAAM,KAAK,WAAW;EACtB,IAAI,IAAI,OAAO,GAAG;CACnB,EAAE,CAAC;AACJ"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { D as QueryOperationTypesBase } from "./types-DfKvtJwS-CrpWTGBJ.mjs";
|
|
2
|
+
import "./types-CkAd8SWm.mjs";
|
|
3
|
+
import { i as SqlOperationEntry } from "./index-Nqc3OHR_.mjs";
|
|
4
|
+
import { Nt as SelectAst } from "./types-DriMIMNQ-BkbsW7w3.mjs";
|
|
5
|
+
import { i as CodecTypesBase, l as RawCodecInferer, o as Expression, r as CodecExpression, x as ScopeField, y as RawSqlTag } from "./expression-6ld_ZQL6-fOuazzzm.mjs";
|
|
6
|
+
//#region ../../../2-sql-family/4-lanes/relational-core/dist/exports/functions.d.mts
|
|
7
|
+
//#region src/functions.d.ts
|
|
8
|
+
type BooleanCodecType = {
|
|
9
|
+
codecId: 'pg/bool@1';
|
|
10
|
+
nullable: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare const SubqueryMarker: unique symbol;
|
|
13
|
+
type Subquery<RowType extends Record<string, ScopeField>> = {
|
|
14
|
+
[SubqueryMarker]: RowType;
|
|
15
|
+
buildAst(): SelectAst;
|
|
16
|
+
getRowFields(): Record<string, ScopeField>;
|
|
17
|
+
};
|
|
18
|
+
/** What the function surface reads from a query context: the codec types and the registered query operations. */
|
|
19
|
+
type FunctionsContext = {
|
|
20
|
+
readonly codecTypes: CodecTypesBase;
|
|
21
|
+
readonly queryOperationTypes: QueryOperationTypesBase;
|
|
22
|
+
};
|
|
23
|
+
type DeriveExtFunctions<OT extends QueryOperationTypesBase> = { [K in keyof OT]: OT[K]['impl']; };
|
|
24
|
+
type BuiltinFunctions<CT extends Record<string, {
|
|
25
|
+
readonly input: unknown;
|
|
26
|
+
}>> = {
|
|
27
|
+
eq: <CodecId extends string>(a: CodecExpression<CodecId, boolean, CT> | null, b: CodecExpression<CodecId, boolean, CT> | null) => Expression<BooleanCodecType>;
|
|
28
|
+
ne: <CodecId extends string, N extends boolean>(a: CodecExpression<CodecId, N, CT> | null, b: CodecExpression<CodecId, N, CT> | null) => Expression<BooleanCodecType>;
|
|
29
|
+
gt: <CodecId extends string, N extends boolean>(a: CodecExpression<CodecId, N, CT>, b: CodecExpression<CodecId, N, CT>) => Expression<BooleanCodecType>;
|
|
30
|
+
gte: <CodecId extends string, N extends boolean>(a: CodecExpression<CodecId, N, CT>, b: CodecExpression<CodecId, N, CT>) => Expression<BooleanCodecType>;
|
|
31
|
+
lt: <CodecId extends string, N extends boolean>(a: CodecExpression<CodecId, N, CT>, b: CodecExpression<CodecId, N, CT>) => Expression<BooleanCodecType>;
|
|
32
|
+
lte: <CodecId extends string, N extends boolean>(a: CodecExpression<CodecId, N, CT>, b: CodecExpression<CodecId, N, CT>) => Expression<BooleanCodecType>;
|
|
33
|
+
and: (...ands: CodecExpression<'pg/bool@1', boolean, CT>[]) => Expression<BooleanCodecType>;
|
|
34
|
+
or: (...ors: CodecExpression<'pg/bool@1', boolean, CT>[]) => Expression<BooleanCodecType>;
|
|
35
|
+
exists: (subquery: Subquery<Record<string, ScopeField>>) => Expression<BooleanCodecType>;
|
|
36
|
+
notExists: (subquery: Subquery<Record<string, ScopeField>>) => Expression<BooleanCodecType>;
|
|
37
|
+
in: {
|
|
38
|
+
<CodecId extends string>(expr: Expression<{
|
|
39
|
+
codecId: CodecId;
|
|
40
|
+
nullable: boolean;
|
|
41
|
+
}>, subquery: Subquery<Record<string, {
|
|
42
|
+
codecId: CodecId;
|
|
43
|
+
nullable: boolean;
|
|
44
|
+
}>>): Expression<BooleanCodecType>;
|
|
45
|
+
<CodecId extends string>(expr: Expression<{
|
|
46
|
+
codecId: CodecId;
|
|
47
|
+
nullable: boolean;
|
|
48
|
+
}>, values: Array<CodecExpression<CodecId, boolean, CT>>): Expression<BooleanCodecType>;
|
|
49
|
+
};
|
|
50
|
+
notIn: {
|
|
51
|
+
<CodecId extends string>(expr: Expression<{
|
|
52
|
+
codecId: CodecId;
|
|
53
|
+
nullable: boolean;
|
|
54
|
+
}>, subquery: Subquery<Record<string, {
|
|
55
|
+
codecId: CodecId;
|
|
56
|
+
nullable: boolean;
|
|
57
|
+
}>>): Expression<BooleanCodecType>;
|
|
58
|
+
<CodecId extends string>(expr: Expression<{
|
|
59
|
+
codecId: CodecId;
|
|
60
|
+
nullable: boolean;
|
|
61
|
+
}>, values: Array<CodecExpression<CodecId, boolean, CT>>): Expression<BooleanCodecType>;
|
|
62
|
+
};
|
|
63
|
+
readonly raw: RawSqlTag;
|
|
64
|
+
};
|
|
65
|
+
/** The functions a query's callbacks receive: the built-in ones and every query operation the contract's target and extensions register. */
|
|
66
|
+
type Functions<QC extends FunctionsContext> = BuiltinFunctions<QC['codecTypes']> & DeriveExtFunctions<QC['queryOperationTypes']>;
|
|
67
|
+
/**
|
|
68
|
+
* The function surface for a contract: the built-in functions, and each registered query operation's implementation under its name.
|
|
69
|
+
*/
|
|
70
|
+
declare function createFunctions<QC extends FunctionsContext>(operations: Readonly<Record<string, SqlOperationEntry>>, rawCodecInferer: RawCodecInferer): Functions<QC>;
|
|
71
|
+
//#endregion
|
|
72
|
+
export { Subquery as a, FunctionsContext as i, BuiltinFunctions as n, SubqueryMarker as o, Functions as r, createFunctions as s, BooleanCodecType as t };
|
|
73
|
+
//# sourceMappingURL=functions-EW-RrRn3.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions-EW-RrRn3.d.mts","names":[],"sources":["../../../../2-sql-family/4-lanes/relational-core/dist/exports/functions.d.mts"],"mappings":";;;;;;;KAKK;EACH;EACA;;cAEY;KACT,SAAS,gBAAgB,eAAe;GAC1C,iBAAiB;EAClB,YAAY;EACZ,gBAAgB,eAAe;;;KAG5B;WACM,YAAY;WACZ,qBAAqB;;KAE3B,mBAAmB,WAAW,8BAA8B,WAAW,KAAK,GAAG;KAC/E,iBAAiB,WAAW;WACtB;;EAET,KAAK,wBAAwB,GAAG,gBAAgB,kBAAkB,YAAY,GAAG,gBAAgB,kBAAkB,eAAe,WAAW;EAC7I,KAAK,wBAAwB,mBAAmB,GAAG,gBAAgB,SAAS,GAAG,YAAY,GAAG,gBAAgB,SAAS,GAAG,eAAe,WAAW;EACpJ,KAAK,wBAAwB,mBAAmB,GAAG,gBAAgB,SAAS,GAAG,KAAK,GAAG,gBAAgB,SAAS,GAAG,QAAQ,WAAW;EACtI,MAAM,wBAAwB,mBAAmB,GAAG,gBAAgB,SAA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