@prisma/orm-target-sqlite 8.0.0-rc.2-dev.2 → 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 +1 -5
- package/dist/{adapter-CUTKlFpX-CW0J0Qs4.mjs → adapter-7m8HU4rt-DN15_Cn8.mjs} +178 -107
- package/dist/adapter-7m8HU4rt-DN15_Cn8.mjs.map +1 -0
- package/dist/adapter-C3hrAasJ.d.mts +197 -0
- package/dist/adapter-C3hrAasJ.d.mts.map +1 -0
- package/dist/{adapter-DEYUC-KO-DO_abhIq.d.mts → adapter-xFPDhkod-BsdLsy9N.d.mts} +12 -9
- package/dist/adapter-xFPDhkod-BsdLsy9N.d.mts.map +1 -0
- package/dist/adapter.d.mts +14 -15
- package/dist/adapter.mjs +7 -6
- package/dist/adapter__adapter.d.mts +4 -4
- package/dist/adapter__adapter.mjs +3 -2
- package/dist/adapter__codec-types.d.mts +3 -3
- package/dist/adapter__column-types.d.mts +2 -2
- package/dist/adapter__column-types.mjs +2 -2
- package/dist/adapter__control.d.mts +5 -5
- package/dist/adapter__control.mjs +12 -247
- package/dist/adapter__control.mjs.map +1 -1
- package/dist/adapter__runtime.d.mts +1 -1
- package/dist/adapter__runtime.mjs +11 -6
- package/dist/adapter__runtime.mjs.map +1 -1
- package/dist/adapter__sql-renderer.d.mts +2 -2
- package/dist/adapter__sql-renderer.mjs +1 -1
- package/dist/adapter__types.d.mts +3 -2
- package/dist/{aggregates-DWyPO7t6.mjs → aggregates-D5fuFVMC.mjs} +33 -20
- package/dist/aggregates-D5fuFVMC.mjs.map +1 -0
- package/dist/aggregates-UBmpuURb.d.mts +164 -0
- package/dist/aggregates-UBmpuURb.d.mts.map +1 -0
- package/dist/codec-descriptor-3oN7rtrW-Cc_u7U5-.d.mts +1 -0
- package/dist/codec-descriptor-C16gQAdS.d.mts +2 -0
- package/dist/{codec-descriptor-B9ru99aI-DTkdKFU5.mjs → codec-descriptor-DRmF-crq-BALI5Jtz.mjs} +11 -15
- package/dist/codec-descriptor-DRmF-crq-BALI5Jtz.mjs.map +1 -0
- package/dist/codec-descriptor-DuW-d9ef-BBRBN0Ri.d.mts +45 -0
- package/dist/codec-descriptor-DuW-d9ef-BBRBN0Ri.d.mts.map +1 -0
- package/dist/codec-ids-CMbhYIsa.d.mts +1 -0
- package/dist/{codec-ids-CzeDyMWW-BZAcI50I.d.mts → codec-ids-DuJYssXV-BPKbFNRL.d.mts} +4 -4
- package/dist/codec-ids-DuJYssXV-BPKbFNRL.d.mts.map +1 -0
- package/dist/{codec-ids-KMliSCRp-BhTbmbGr.mjs → codec-ids-wgEvkCkg-WltuexMR.mjs} +4 -4
- package/dist/codec-ids-wgEvkCkg-WltuexMR.mjs.map +1 -0
- package/dist/{codec-types-D7uWRvQ1-DPnvquS8.d.mts → codec-types-COh75Bop-CUehAexc.d.mts} +6 -5
- package/dist/codec-types-COh75Bop-CUehAexc.d.mts.map +1 -0
- package/dist/codec-types-ELHfd82J.d.mts +2 -0
- package/dist/codec-types-PONhVn74.d.mts +1 -0
- package/dist/{codecs-BQWqLgCl-CdB8t7HI.d.mts → codecs-BJYruC-a-BKDGae3k.d.mts} +86 -62
- package/dist/codecs-BJYruC-a-BKDGae3k.d.mts.map +1 -0
- package/dist/codecs-Dn0xoCuf.d.mts +1 -0
- package/dist/codecs-g-YI3BtK.mjs +49 -0
- package/dist/codecs-g-YI3BtK.mjs.map +1 -0
- package/dist/codecs-yZoH21Yj-lQXtGlEq.mjs +618 -0
- package/dist/codecs-yZoH21Yj-lQXtGlEq.mjs.map +1 -0
- package/dist/column-types-DcbNOYVb.mjs +22 -0
- package/dist/column-types-DcbNOYVb.mjs.map +1 -0
- package/dist/column-types-Dxm0BpPv.d.mts +36 -0
- package/dist/column-types-Dxm0BpPv.d.mts.map +1 -0
- package/dist/contract-contributions-wweWdXMK-CN-d35Rj.mjs +24 -0
- package/dist/contract-contributions-wweWdXMK-CN-d35Rj.mjs.map +1 -0
- package/dist/{contract-free-CCLAXZV2.d.mts → contract-free-BJwIJN6x.d.mts} +3 -3
- package/dist/contract-free-BJwIJN6x.d.mts.map +1 -0
- package/dist/{contract-free-D5cZrgNl.mjs → contract-free-DetowcoS.mjs} +8 -7
- package/dist/contract-free-DetowcoS.mjs.map +1 -0
- package/dist/{control-CLirKz11.d.mts → control-BbJiKI2r.d.mts} +24 -29
- package/dist/control-BbJiKI2r.d.mts.map +1 -0
- package/dist/{control-B16T9OoX.mjs → control-BxbKU2xs.mjs} +15 -6
- package/dist/control-BxbKU2xs.mjs.map +1 -0
- package/dist/{control-D9vMRRgU.d.mts → control-C2TjacST.d.mts} +3 -3
- package/dist/control-C2TjacST.d.mts.map +1 -0
- package/dist/{control--wMueaTg.d.mts → control-CmDsxEqb.d.mts} +75 -6
- package/dist/control-CmDsxEqb.d.mts.map +1 -0
- package/dist/{control-tables-Dua-YcJL.d.mts → control-tables-DKXLHvMU.d.mts} +2 -2
- package/dist/control-tables-DKXLHvMU.d.mts.map +1 -0
- package/dist/{control-tables-D_o8dKRB-BXi43noL.mjs → control-tables-D_o8dKRB-n_QqsXcm.mjs} +2 -2
- package/dist/control-tables-D_o8dKRB-n_QqsXcm.mjs.map +1 -0
- package/dist/data-type-entries-yQ-qYugg-C_NnX5WO.mjs +76 -0
- package/dist/data-type-entries-yQ-qYugg-C_NnX5WO.mjs.map +1 -0
- package/dist/data-types-Dx3rHsbF.d.mts +40 -0
- package/dist/data-types-Dx3rHsbF.d.mts.map +1 -0
- package/dist/data-types-coQrCWfS-yMCe4F52.mjs +140 -0
- package/dist/data-types-coQrCWfS-yMCe4F52.mjs.map +1 -0
- package/dist/datetime-text-Bniwehv--BSQhnrdE.mjs +9 -0
- package/dist/datetime-text-Bniwehv--BSQhnrdE.mjs.map +1 -0
- package/dist/ddl-31OBcTco.d.mts +1 -0
- package/dist/{ddl-CXduXyOT-nlDP6DGx.mjs → ddl-CX4tAZ-y-Bng-4PWC.mjs} +42 -5
- package/dist/ddl-CX4tAZ-y-Bng-4PWC.mjs.map +1 -0
- package/dist/default-normalizer-CkHy3JYk.d.mts +25 -0
- package/dist/default-normalizer-CkHy3JYk.d.mts.map +1 -0
- package/dist/default-normalizer-DGMXypHg-CPf7oyZA.mjs +112 -0
- package/dist/default-normalizer-DGMXypHg-CPf7oyZA.mjs.map +1 -0
- package/dist/descriptor-meta-COSGM3xb-Ct_5RPcm.mjs +110 -0
- package/dist/descriptor-meta-COSGM3xb-Ct_5RPcm.mjs.map +1 -0
- package/dist/descriptor-meta-DrNwC4vO-D7vuA6QK.mjs +26 -0
- package/dist/descriptor-meta-DrNwC4vO-D7vuA6QK.mjs.map +1 -0
- package/dist/{descriptor-meta-vjJkUDsn-Hz3rnAnk.mjs → descriptor-meta-cwy5CXTT-CLOhiryX.mjs} +17 -3
- package/dist/descriptor-meta-cwy5CXTT-CLOhiryX.mjs.map +1 -0
- package/dist/descriptor-meta-runtime-DX2JfHWF-Dbsh5NP8.mjs +15 -0
- package/dist/descriptor-meta-runtime-DX2JfHWF-Dbsh5NP8.mjs.map +1 -0
- package/dist/driver.d.mts +2 -2
- package/dist/driver.mjs +1 -1
- package/dist/driver__control.d.mts +1 -1
- package/dist/driver__control.mjs +1 -1
- package/dist/driver__runtime.d.mts +1 -1
- package/dist/driver__runtime.mjs +5 -8
- package/dist/driver__runtime.mjs.map +1 -1
- package/dist/{errors-DnR-sMHS-KkMLIP2U.mjs → errors-DnR-sMHS-D_gh214a.mjs} +2 -2
- package/dist/errors-DnR-sMHS-D_gh214a.mjs.map +1 -0
- package/dist/{migration-uylRe5MP.d.mts → migration-WJlUQmsn.d.mts} +6 -5
- package/dist/migration-WJlUQmsn.d.mts.map +1 -0
- package/dist/{migration-DOKPHtxn.mjs → migration-nqIDkjRz.mjs} +6 -5
- package/dist/migration-nqIDkjRz.mjs.map +1 -0
- package/dist/{nodes-D8EC1yCx-rpfpuJ4T.d.mts → nodes-D8EC1yCx-BS-fKla6.d.mts} +2 -2
- package/dist/nodes-D8EC1yCx-BS-fKla6.d.mts.map +1 -0
- package/dist/{nodes-DUZSdX86-BBEEaxXY.mjs → nodes-DUZSdX86-DWyLY3OW.mjs} +2 -2
- package/dist/nodes-DUZSdX86-DWyLY3OW.mjs.map +1 -0
- package/dist/{op-factory-call-DoHN7Q7L.d.mts → op-factory-call-De6MX7Yp.d.mts} +83 -19
- package/dist/op-factory-call-De6MX7Yp.d.mts.map +1 -0
- package/dist/op-factory-call-emj9Xp05-BFLkxrAK.mjs +1414 -0
- package/dist/op-factory-call-emj9Xp05-BFLkxrAK.mjs.map +1 -0
- package/dist/pack-DR0n9vHJ.d.mts +1179 -0
- package/dist/pack-DR0n9vHJ.d.mts.map +1 -0
- package/dist/planner-BvwYScnt-9H9LIJFn.mjs +362 -0
- package/dist/planner-BvwYScnt-9H9LIJFn.mjs.map +1 -0
- package/dist/{planner-Bxdi7jZF.d.mts → planner-CjMq9oEt.d.mts} +21 -10
- package/dist/planner-CjMq9oEt.d.mts.map +1 -0
- package/dist/{planner-produced-sqlite-migration-C9uVDKrJ-CWbxSANn.mjs → planner-produced-sqlite-migration-D2jtaItv-ZFZhPfGE.mjs} +4 -4
- package/dist/planner-produced-sqlite-migration-D2jtaItv-ZFZhPfGE.mjs.map +1 -0
- package/dist/{planner-produced-sqlite-migration-BuJysRxx-CaDUbNVx.d.mts → planner-produced-sqlite-migration-DuM9c3YI-Dacb6zQZ.d.mts} +4 -4
- package/dist/planner-produced-sqlite-migration-DuM9c3YI-Dacb6zQZ.d.mts.map +1 -0
- package/dist/planner-produced-sqlite-migration-GDP1M36D.d.mts +1 -0
- package/dist/{planner-target-details-CIQ789Gc-C5U4yVY9.mjs → planner-target-details-CIQ789Gc-Cug2V5g5.mjs} +2 -2
- package/dist/planner-target-details-CIQ789Gc-Cug2V5g5.mjs.map +1 -0
- package/dist/{planner-target-details-xR6UfIcz-CMahymzq.d.mts → planner-target-details-xR6UfIcz-BrBPQGOS.d.mts} +2 -2
- package/dist/planner-target-details-xR6UfIcz-BrBPQGOS.d.mts.map +1 -0
- package/dist/render-ops-BPLkHR-y-CPoXG5Ap.mjs +34 -0
- package/dist/render-ops-BPLkHR-y-CPoXG5Ap.mjs.map +1 -0
- package/dist/{render-ops-B10yqmdG.d.mts → render-ops-Ntl2jBJe.d.mts} +3 -3
- package/dist/render-ops-Ntl2jBJe.d.mts.map +1 -0
- package/dist/{runtime-B1coahKC.d.mts → runtime-BvMPuBrJ.d.mts} +3 -3
- package/dist/runtime-BvMPuBrJ.d.mts.map +1 -0
- package/dist/{runtime-B99c4n56.d.mts → runtime-CjIoI3sa.d.mts} +4 -4
- package/dist/runtime-CjIoI3sa.d.mts.map +1 -0
- package/dist/{runtime-C5J9fusd.d.mts → runtime-YfPIbtO6.d.mts} +4 -4
- package/dist/runtime-YfPIbtO6.d.mts.map +1 -0
- package/dist/sql-renderer-brQ96quu.d.mts +1 -0
- package/dist/{sql-utils-0SJZOd7Q.d.mts → sql-utils-BqHka8P6.d.mts} +2 -2
- package/dist/sql-utils-BqHka8P6.d.mts.map +1 -0
- package/dist/{sql-utils-C2O4zVkP-Dz3Hb85I.mjs → sql-utils-XGT5Esi2-Zr2mqJf8.mjs} +31 -4
- package/dist/sql-utils-XGT5Esi2-Zr2mqJf8.mjs.map +1 -0
- package/dist/{sqlite-contract-view-BpNMaU2m-COMDaGaq.d.mts → sqlite-contract-view-BDw8T5Cp-BfFajhe4.d.mts} +5 -4
- package/dist/sqlite-contract-view-BDw8T5Cp-BfFajhe4.d.mts.map +1 -0
- package/dist/{sqlite-contract-view-BYR10usg-BteDAUZr.mjs → sqlite-contract-view-CGfiGvKH-CT-JjNHd.mjs} +9 -6
- package/dist/sqlite-contract-view-CGfiGvKH-CT-JjNHd.mjs.map +1 -0
- package/dist/sqlite-migration-BAdSmooi-iWFVQgGV.mjs +1295 -0
- package/dist/sqlite-migration-BAdSmooi-iWFVQgGV.mjs.map +1 -0
- package/dist/{sqlite-migration-o23JHwzY-CwNJcqwl.d.mts → sqlite-migration-CLIMaHLy-5ZjJDdDP.d.mts} +61 -13
- package/dist/sqlite-migration-CLIMaHLy-5ZjJDdDP.d.mts.map +1 -0
- package/dist/{shared-BYAX0FaQ--VvRXVRC.d.mts → tables-C6oejIsc-CzK00Kwl.d.mts} +38 -10
- package/dist/tables-C6oejIsc-CzK00Kwl.d.mts.map +1 -0
- package/dist/target.d.mts +29 -29
- package/dist/target.mjs +24 -20
- package/dist/target__aggregates.d.mts +1 -1
- package/dist/target__aggregates.mjs +1 -1
- package/dist/target__codec-descriptor.d.mts +2 -2
- package/dist/target__codec-descriptor.mjs +1 -1
- package/dist/target__codec-ids.d.mts +3 -3
- package/dist/target__codec-ids.mjs +2 -2
- package/dist/target__codec-types.d.mts +3 -3
- package/dist/target__codecs.d.mts +3 -3
- package/dist/target__codecs.mjs +4 -2
- package/dist/target__contract-free.d.mts +1 -1
- package/dist/target__contract-free.mjs +2 -2
- package/dist/target__control-tables.d.mts +1 -1
- package/dist/target__control-tables.mjs +1 -1
- package/dist/target__control.d.mts +3 -3
- package/dist/target__control.mjs +168 -72
- package/dist/target__control.mjs.map +1 -1
- package/dist/target__data-types.d.mts +2 -0
- package/dist/target__data-types.mjs +3 -0
- package/dist/target__ddl.d.mts +2 -2
- package/dist/target__ddl.mjs +1 -1
- package/dist/target__default-normalizer.d.mts +2 -2
- package/dist/target__default-normalizer.mjs +2 -2
- package/dist/target__migration.d.mts +3 -3
- package/dist/target__migration.mjs +3 -3
- package/dist/target__op-factory-call.d.mts +2 -2
- package/dist/target__op-factory-call.mjs +2 -2
- package/dist/target__pack.d.mts +1 -1
- package/dist/target__pack.mjs +1 -1
- package/dist/target__planner-produced-sqlite-migration.d.mts +2 -2
- package/dist/target__planner-produced-sqlite-migration.mjs +1 -1
- package/dist/target__planner-target-details.d.mts +1 -1
- package/dist/target__planner-target-details.mjs +1 -1
- package/dist/target__planner.d.mts +1 -1
- package/dist/target__planner.mjs +1 -1
- package/dist/target__render-ops.d.mts +1 -1
- package/dist/target__render-ops.mjs +1 -1
- package/dist/target__runtime.d.mts +2 -2
- package/dist/target__runtime.mjs +3 -3
- package/dist/target__runtime.mjs.map +1 -1
- package/dist/target__sql-utils.d.mts +1 -1
- package/dist/target__sql-utils.mjs +1 -1
- package/dist/{types-C5FSREvo-CwUlKK34.d.mts → types-RJMd2PlL-BTGAJrBQ.d.mts} +5 -7
- package/dist/types-RJMd2PlL-BTGAJrBQ.d.mts.map +1 -0
- package/dist/types-y5JlAv97.d.mts +2 -0
- package/package.json +12 -12
- package/dist/adapter-CUTKlFpX-CW0J0Qs4.mjs.map +0 -1
- package/dist/adapter-D7zw14p5.d.mts +0 -2
- package/dist/adapter-DEYUC-KO-DO_abhIq.d.mts.map +0 -1
- package/dist/aggregates-BGuKJwfI.d.mts +0 -10
- package/dist/aggregates-BGuKJwfI.d.mts.map +0 -1
- package/dist/aggregates-DWyPO7t6.mjs.map +0 -1
- package/dist/codec-descriptor-B9ru99aI-DTkdKFU5.mjs.map +0 -1
- package/dist/codec-descriptor-BcgD9f3L-yDi5nh_k.d.mts +0 -31
- package/dist/codec-descriptor-BcgD9f3L-yDi5nh_k.d.mts.map +0 -1
- package/dist/codec-descriptor-rFuZ9DzY-CKRIRxah.d.mts +0 -1
- package/dist/codec-descriptor-vwfD3BMy.d.mts +0 -2
- package/dist/codec-ids-7WqtUuda.d.mts +0 -1
- package/dist/codec-ids-CzeDyMWW-BZAcI50I.d.mts.map +0 -1
- package/dist/codec-ids-KMliSCRp-BhTbmbGr.mjs.map +0 -1
- package/dist/codec-types-B-TDcvQc.d.mts +0 -1
- package/dist/codec-types-CS0bD1kX.d.mts +0 -2
- package/dist/codec-types-D7uWRvQ1-DPnvquS8.d.mts.map +0 -1
- package/dist/codecs-BDdR6FbY.mjs +0 -504
- package/dist/codecs-BDdR6FbY.mjs.map +0 -1
- package/dist/codecs-BQWqLgCl-CdB8t7HI.d.mts.map +0 -1
- package/dist/codecs-BTv6fRXv.d.mts +0 -1
- package/dist/column-types-NVxgsjFA.mjs +0 -34
- package/dist/column-types-NVxgsjFA.mjs.map +0 -1
- package/dist/column-types-iWGuW-0W.d.mts +0 -33
- package/dist/column-types-iWGuW-0W.d.mts.map +0 -1
- package/dist/contract-free-CCLAXZV2.d.mts.map +0 -1
- package/dist/contract-free-D5cZrgNl.mjs.map +0 -1
- package/dist/control--wMueaTg.d.mts.map +0 -1
- package/dist/control-B16T9OoX.mjs.map +0 -1
- package/dist/control-CLirKz11.d.mts.map +0 -1
- package/dist/control-D9vMRRgU.d.mts.map +0 -1
- package/dist/control-tables-D_o8dKRB-BXi43noL.mjs.map +0 -1
- package/dist/control-tables-Dua-YcJL.d.mts.map +0 -1
- package/dist/ddl-CXduXyOT-nlDP6DGx.mjs.map +0 -1
- package/dist/ddl-CfSqNT0M.d.mts +0 -1
- package/dist/default-normalizer-B9V7TY5u.d.mts +0 -7
- package/dist/default-normalizer-B9V7TY5u.d.mts.map +0 -1
- package/dist/default-normalizer-DuoHj9-O-DsK7lJZn.mjs +0 -69
- package/dist/default-normalizer-DuoHj9-O-DsK7lJZn.mjs.map +0 -1
- package/dist/descriptor-meta-DjKgG4z5-D_0obUB8.mjs +0 -34
- package/dist/descriptor-meta-DjKgG4z5-D_0obUB8.mjs.map +0 -1
- package/dist/descriptor-meta-nORSZfmr-Cw-pzAJr.mjs +0 -33
- package/dist/descriptor-meta-nORSZfmr-Cw-pzAJr.mjs.map +0 -1
- package/dist/descriptor-meta-runtime-BkXK3OjD-CxZdKHCw.mjs +0 -13
- package/dist/descriptor-meta-runtime-BkXK3OjD-CxZdKHCw.mjs.map +0 -1
- package/dist/descriptor-meta-vjJkUDsn-Hz3rnAnk.mjs.map +0 -1
- package/dist/errors-DnR-sMHS-KkMLIP2U.mjs.map +0 -1
- package/dist/migration-DOKPHtxn.mjs.map +0 -1
- package/dist/migration-uylRe5MP.d.mts.map +0 -1
- package/dist/native-type-normalizer-CO2wKGL6.d.mts +0 -12
- package/dist/native-type-normalizer-CO2wKGL6.d.mts.map +0 -1
- package/dist/native-type-normalizer-GpQMEyN5.mjs +0 -14
- package/dist/native-type-normalizer-GpQMEyN5.mjs.map +0 -1
- package/dist/nodes-D8EC1yCx-rpfpuJ4T.d.mts.map +0 -1
- package/dist/nodes-DUZSdX86-BBEEaxXY.mjs.map +0 -1
- package/dist/op-factory-call-DoHN7Q7L.d.mts.map +0 -1
- package/dist/op-factory-call-gc26GqyA-Db5Fasef.mjs +0 -829
- package/dist/op-factory-call-gc26GqyA-Db5Fasef.mjs.map +0 -1
- package/dist/pack-DIbefoZF.d.mts +0 -102
- package/dist/pack-DIbefoZF.d.mts.map +0 -1
- package/dist/planner-Bxdi7jZF.d.mts.map +0 -1
- package/dist/planner-Cqjr2usR-4wg3FB78.mjs +0 -824
- package/dist/planner-Cqjr2usR-4wg3FB78.mjs.map +0 -1
- package/dist/planner-produced-sqlite-migration-BuJysRxx-CaDUbNVx.d.mts.map +0 -1
- package/dist/planner-produced-sqlite-migration-C9uVDKrJ-CWbxSANn.mjs.map +0 -1
- package/dist/planner-produced-sqlite-migration-uySoqJO-.d.mts +0 -1
- package/dist/planner-target-details-CIQ789Gc-C5U4yVY9.mjs.map +0 -1
- package/dist/planner-target-details-xR6UfIcz-CMahymzq.d.mts.map +0 -1
- package/dist/render-ops-B10yqmdG.d.mts.map +0 -1
- package/dist/render-ops-KxAmAz6d-W2xyvA5y.mjs +0 -27
- package/dist/render-ops-KxAmAz6d-W2xyvA5y.mjs.map +0 -1
- package/dist/runtime-B1coahKC.d.mts.map +0 -1
- package/dist/runtime-B99c4n56.d.mts.map +0 -1
- package/dist/runtime-C5J9fusd.d.mts.map +0 -1
- package/dist/shared-BYAX0FaQ--VvRXVRC.d.mts.map +0 -1
- package/dist/sql-renderer-KX6hn_tg.d.mts +0 -1
- package/dist/sql-utils-0SJZOd7Q.d.mts.map +0 -1
- package/dist/sql-utils-C2O4zVkP-Dz3Hb85I.mjs.map +0 -1
- package/dist/sqlite-contract-view-BYR10usg-BteDAUZr.mjs.map +0 -1
- package/dist/sqlite-contract-view-BpNMaU2m-COMDaGaq.d.mts.map +0 -1
- package/dist/sqlite-migration-CjMkH4Id-c6dM9w61.mjs +0 -94
- package/dist/sqlite-migration-CjMkH4Id-c6dM9w61.mjs.map +0 -1
- package/dist/sqlite-migration-o23JHwzY-CwNJcqwl.d.mts.map +0 -1
- package/dist/target__native-type-normalizer.d.mts +0 -2
- package/dist/target__native-type-normalizer.mjs +0 -2
- package/dist/types-B7e2QVEx.d.mts +0 -1
- package/dist/types-C5FSREvo-CwUlKK34.d.mts.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @prisma/orm-target-sqlite
|
|
2
2
|
|
|
3
|
-
The concrete SQLite target of Prisma
|
|
3
|
+
The concrete SQLite target of Prisma 8: the target descriptor (DDL planning, codecs, migration rendering), the SQLite adapter, and the driver.
|
|
4
4
|
|
|
5
5
|
Applications receive it as an exact-pinned dependency of `@prisma/orm-sqlite`; app developers install that facade. Extension authors targeting SQLite and decomposed installs (for example, replacing the adapter while keeping the target and driver) import this package directly.
|
|
6
6
|
|
|
@@ -17,7 +17,3 @@ A bare namespace import (e.g. `@prisma/orm-target-sqlite/adapter`) aggregates th
|
|
|
17
17
|
## Responsibilities
|
|
18
18
|
|
|
19
19
|
Everything SQLite-specific: native type normalization, DDL generation, control tables, and the database connection. Shared SQL semantics live in `@prisma/orm-family-sql`.
|
|
20
|
-
|
|
21
|
-
## Dependencies
|
|
22
|
-
|
|
23
|
-
`@prisma/orm-framework`, `@prisma/orm-family-sql`, and `@prisma/orm-toolchain` (exact lockstep pins), plus small third-party runtime libraries.
|
|
@@ -1,55 +1,26 @@
|
|
|
1
|
-
import { i as SQLITE_DATETIME_CODEC_ID } from "./codec-ids-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { i as SQLITE_DATETIME_CODEC_ID } from "./codec-ids-wgEvkCkg-WltuexMR.mjs";
|
|
2
|
+
import { o as sqliteDataTypes } from "./data-types-coQrCWfS-yMCe4F52.mjs";
|
|
3
|
+
import { r as jsonDocumentRetag } from "./codecs-yZoH21Yj-lQXtGlEq.mjs";
|
|
4
|
+
import { n as SQLITE_NOW_EXPRESSION } from "./datetime-text-Bniwehv--BSQhnrdE.mjs";
|
|
5
|
+
import { a as sqliteCodecRegistry, r as createSqliteCodecRegistryWithBuiltins } from "./codecs-g-YI3BtK.mjs";
|
|
6
|
+
import { a as jsonText, i as integer, n as buildSignMarkerBootstrapQueries, o as sqliteTable, r as datetime, s as text, t as buildControlTableBootstrapQueries } from "./contract-free-DetowcoS.mjs";
|
|
7
|
+
import { n as escapeLiteral, r as quoteIdentifier } from "./sql-utils-XGT5Esi2-Zr2mqJf8.mjs";
|
|
8
|
+
import { t as readSqliteDefault } from "./default-normalizer-DGMXypHg-CPf7oyZA.mjs";
|
|
9
|
+
import { RawExpr, encodeLiteralDefault, isDdlNode, renderOpaqueSql } from "@prisma/orm-family-sql/relational-core/ast";
|
|
9
10
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
10
|
-
import {
|
|
11
|
+
import { codecForRef } from "@prisma/orm-framework/components/codec";
|
|
11
12
|
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
12
|
-
import {
|
|
13
|
+
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
14
|
+
import { InternalError, assertNever } from "@prisma/orm-framework/utils/internal-error";
|
|
15
|
+
import { APP_SPACE_ID } from "@prisma/orm-framework/components/control";
|
|
16
|
+
import { checkSqlDefaultText, contractColumns, readColumnDefault } from "@prisma/orm-family-sql/family/control";
|
|
13
17
|
import { RelationalSchemaNodeKind, SqlSchemaIR, SqlTableIR } from "@prisma/orm-family-sql/schema-ir/types";
|
|
14
18
|
import { REFERENTIAL_ACTION_SQL } from "@prisma/orm-family-sql/contract/referential-action-sql";
|
|
15
|
-
import { InternalError, assertNever } from "@prisma/orm-framework/utils/internal-error";
|
|
16
19
|
import { parseMarkerRowSafely, withMarkerReadErrorHandling } from "@prisma/orm-framework/errors/execution";
|
|
20
|
+
import { resolveIntrospectedColumnType } from "@prisma/orm-family-sql/family/control-adapter";
|
|
17
21
|
import { parseContractMarkerRow } from "@prisma/orm-family-sql/family/verify";
|
|
18
22
|
import { createAstCodecRegistry, deriveParamMetadata, encodeParamsWithMetadata } from "@prisma/orm-family-sql/runtime";
|
|
19
|
-
//#region ../../../3-targets/
|
|
20
|
-
function descriptorsFrom(contributors) {
|
|
21
|
-
return contributors.flatMap((contributor) => contributor.types?.codecTypes?.codecDescriptors ?? []);
|
|
22
|
-
}
|
|
23
|
-
function buildSqliteCodecRegistry(descriptors) {
|
|
24
|
-
const descriptorRegistry = buildSqliteCodecDescriptorRegistry(descriptors);
|
|
25
|
-
const registry = {
|
|
26
|
-
...extractCodecLookup([{
|
|
27
|
-
id: "sqlite-codecs",
|
|
28
|
-
types: { codecTypes: { codecDescriptors: Array.from(descriptorRegistry.values()) } }
|
|
29
|
-
}]),
|
|
30
|
-
descriptorFor: (codecId) => descriptorRegistry.descriptorFor(codecId),
|
|
31
|
-
values: () => descriptorRegistry.values()
|
|
32
|
-
};
|
|
33
|
-
return Object.freeze(registry);
|
|
34
|
-
}
|
|
35
|
-
function assembleSqliteCodecRegistry(target, extensions) {
|
|
36
|
-
return buildSqliteCodecRegistry([
|
|
37
|
-
...descriptorsFrom([target]),
|
|
38
|
-
...sqliteCodecDescriptorRegistry.values(),
|
|
39
|
-
...descriptorsFrom(extensions)
|
|
40
|
-
]);
|
|
41
|
-
}
|
|
42
|
-
function createSqliteCodecRegistryWithBuiltins(codecDescriptors = []) {
|
|
43
|
-
return buildSqliteCodecRegistry([...sqliteCodecDescriptorRegistry.values(), ...codecDescriptors]);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Build a coherent SQLite codec registry populated with built-in descriptors only.
|
|
47
|
-
*
|
|
48
|
-
* The returned registry supports both ordinary codec materialization and SQLite target behavior. Stack-composed paths build the same combined registry from target, full adapter, and ordered extension contributions.
|
|
49
|
-
*/
|
|
50
|
-
function createSqliteBuiltinCodecLookup() {
|
|
51
|
-
return createSqliteCodecRegistryWithBuiltins();
|
|
52
|
-
}
|
|
23
|
+
//#region ../../../3-targets/sqlite/2-adapter/dist/adapter-7m8HU4rt.mjs
|
|
53
24
|
function ledgerOriginFromStored(originCoreHash) {
|
|
54
25
|
if (originCoreHash === null || originCoreHash === "" || originCoreHash === "empty") return null;
|
|
55
26
|
return originCoreHash;
|
|
@@ -120,7 +91,7 @@ const sqliteCatalog = sqliteTable("sqlite_master", {
|
|
|
120
91
|
name: text()
|
|
121
92
|
});
|
|
122
93
|
const NOW = new RawExpr({
|
|
123
|
-
parts: [
|
|
94
|
+
parts: [SQLITE_NOW_EXPRESSION],
|
|
124
95
|
returns: {
|
|
125
96
|
codecId: SQLITE_DATETIME_CODEC_ID,
|
|
126
97
|
nullable: false
|
|
@@ -159,11 +130,12 @@ var SqliteControlAdapter = class {
|
|
|
159
130
|
familyId = "sql";
|
|
160
131
|
targetId = "sqlite";
|
|
161
132
|
codecRegistry;
|
|
162
|
-
|
|
133
|
+
declaredDataTypes;
|
|
134
|
+
/** `declaredDataTypes` are the stack's data types in assembly order, which introspection resolves each column's reported type over. */
|
|
135
|
+
constructor(codecRegistry, declaredDataTypes) {
|
|
163
136
|
this.codecRegistry = codecRegistry;
|
|
137
|
+
this.declaredDataTypes = declaredDataTypes;
|
|
164
138
|
}
|
|
165
|
-
normalizeDefault = parseSqliteDefault;
|
|
166
|
-
normalizeNativeType = normalizeSqliteNativeType;
|
|
167
139
|
bootstrapControlTableQueries() {
|
|
168
140
|
return buildControlTableBootstrapQueries();
|
|
169
141
|
}
|
|
@@ -182,6 +154,13 @@ var SqliteControlAdapter = class {
|
|
|
182
154
|
if (isDdlNode(ast)) throw structuredError("RUNTIME.DDL_UNSUPPORTED", "lower() cannot lower DDL: DDL default literals require inline codec encoding, which is async. Use lowerToExecuteRequest().", { meta: { surface: "control-adapter" } });
|
|
183
155
|
return renderLoweredSql(ast, blindCast(context.contract), this.codecRegistry);
|
|
184
156
|
}
|
|
157
|
+
async renderColumnDefault(column, table) {
|
|
158
|
+
if (column.default === void 0) return "";
|
|
159
|
+
return sqliteRenderDdlColumnDefault(column.default, this.codecRegistry, column.codecRef, {
|
|
160
|
+
table,
|
|
161
|
+
column: column.name
|
|
162
|
+
});
|
|
163
|
+
}
|
|
185
164
|
/**
|
|
186
165
|
* Lower an AST all the way to a driver-ready statement. For DDL nodes,
|
|
187
166
|
* literal column defaults are formatted as inline SQL with SQLite-specific
|
|
@@ -314,9 +293,25 @@ var SqliteControlAdapter = class {
|
|
|
314
293
|
...mergedInvariants !== void 0 ? { invariants: mergedInvariants } : {}
|
|
315
294
|
}).where(marker.space.eq(space).and(marker.core_hash.eq(expectedFrom))).returning(marker.space).build())).length > 0;
|
|
316
295
|
}
|
|
296
|
+
async withTransaction(driver, fn) {
|
|
297
|
+
await driver.query("BEGIN IMMEDIATE");
|
|
298
|
+
let result;
|
|
299
|
+
try {
|
|
300
|
+
result = await fn();
|
|
301
|
+
} catch (error) {
|
|
302
|
+
try {
|
|
303
|
+
await driver.query("ROLLBACK");
|
|
304
|
+
} catch (rollbackError) {
|
|
305
|
+
if (error instanceof Error && error.cause === void 0) error.cause = rollbackError;
|
|
306
|
+
}
|
|
307
|
+
throw error;
|
|
308
|
+
}
|
|
309
|
+
await driver.query("COMMIT");
|
|
310
|
+
return result;
|
|
311
|
+
}
|
|
312
|
+
async lockMarker(_driver) {}
|
|
317
313
|
/**
|
|
318
|
-
* Appends a ledger entry for `space`. See the
|
|
319
|
-
* `SqlControlAdapter.writeLedgerEntry` contract.
|
|
314
|
+
* Appends a ledger entry for `space`. See the `SqlControlAdapter.writeLedgerEntry` contract.
|
|
320
315
|
*/
|
|
321
316
|
async writeLedgerEntry(driver, space, entry) {
|
|
322
317
|
await execute((query) => this.lower(query, { contract: void 0 }), driver, ledger.insert({
|
|
@@ -338,8 +333,31 @@ var SqliteControlAdapter = class {
|
|
|
338
333
|
record: parseContractMarkerRow(decodeSqliteMarkerRow(row))
|
|
339
334
|
};
|
|
340
335
|
}
|
|
341
|
-
|
|
342
|
-
|
|
336
|
+
/**
|
|
337
|
+
* Reads a column's reported default: a function or SQL NULL as itself, and a literal with the column's codec, when the contract declares the column. A literal of a column the contract does not declare keeps only its raw text. When the contract's default is an expression that writes a literal, the codec reads that literal too, for the diff to compare the two values.
|
|
338
|
+
*/
|
|
339
|
+
async readReportedDefault(rawDefault, declaredType, column) {
|
|
340
|
+
const reported = readSqliteDefault(rawDefault, declaredType);
|
|
341
|
+
if (reported.kind === "function") return { resolvedDefault: reported };
|
|
342
|
+
if (reported.kind === "null") return { resolvedDefault: {
|
|
343
|
+
kind: "literal",
|
|
344
|
+
value: null
|
|
345
|
+
} };
|
|
346
|
+
const codec = column === void 0 ? void 0 : codecForRef(this.codecRegistry, column.codecRef);
|
|
347
|
+
if (codec === void 0) return {};
|
|
348
|
+
const expression = column?.defaultExpression;
|
|
349
|
+
const written = expression === void 0 ? void 0 : readSqliteDefault(expression, declaredType);
|
|
350
|
+
return readColumnDefault(codec, {
|
|
351
|
+
literal: reported.literal,
|
|
352
|
+
raw: rawDefault
|
|
353
|
+
}, expression !== void 0 && written?.kind === "literal" ? {
|
|
354
|
+
literal: written.literal,
|
|
355
|
+
expression
|
|
356
|
+
} : void 0);
|
|
357
|
+
}
|
|
358
|
+
async introspect(driver, contract) {
|
|
359
|
+
const contractColumnsOf = contractColumns(contract);
|
|
360
|
+
const tablesResult = await driver.query(`SELECT name, sql FROM sqlite_master
|
|
343
361
|
WHERE type = 'table'
|
|
344
362
|
AND name NOT LIKE 'sqlite_%'
|
|
345
363
|
AND name NOT IN ('_prisma_marker', '_prisma_ledger')
|
|
@@ -347,21 +365,29 @@ var SqliteControlAdapter = class {
|
|
|
347
365
|
const tables = {};
|
|
348
366
|
for (const tableRow of tablesResult.rows) {
|
|
349
367
|
const tableName = tableRow.name;
|
|
350
|
-
const columnsResult = await driver.query(`PRAGMA table_info(
|
|
351
|
-
const fkResult = await driver.query(`PRAGMA foreign_key_list(
|
|
352
|
-
const indexListResult = await driver.query(`PRAGMA index_list(
|
|
368
|
+
const columnsResult = await driver.query(`PRAGMA table_info(${quoteIdentifier(tableName)})`);
|
|
369
|
+
const fkResult = await driver.query(`PRAGMA foreign_key_list(${quoteIdentifier(tableName)})`);
|
|
370
|
+
const indexListResult = await driver.query(`PRAGMA index_list(${quoteIdentifier(tableName)})`);
|
|
353
371
|
const columns = {};
|
|
354
372
|
const pkColumns = [];
|
|
373
|
+
const autoincrementColumn = autoincrementColumnOf(tableRow.sql, columnsResult.rows);
|
|
355
374
|
for (const col of columnsResult.rows) {
|
|
356
|
-
const resolvedNativeType = normalizeSqliteNativeType(col.type);
|
|
357
375
|
const rawDefault = col.dflt_value ?? void 0;
|
|
376
|
+
const readDefault = col.name === autoincrementColumn ? { resolvedDefault: AUTOINCREMENT_DEFAULT } : rawDefault === void 0 ? {} : await this.readReportedDefault(rawDefault, col.type, contractColumnsOf.columnOf(void 0, tableName, col.name));
|
|
377
|
+
const reportedType = {
|
|
378
|
+
text: col.type,
|
|
379
|
+
kind: void 0,
|
|
380
|
+
schema: void 0,
|
|
381
|
+
name: void 0
|
|
382
|
+
};
|
|
358
383
|
columns[col.name] = {
|
|
359
384
|
name: col.name,
|
|
360
|
-
|
|
385
|
+
typeText: col.type.toLowerCase(),
|
|
361
386
|
nullable: col.notnull === 0 && col.pk === 0,
|
|
362
387
|
...ifDefined("default", rawDefault),
|
|
363
|
-
|
|
364
|
-
|
|
388
|
+
...readDefault,
|
|
389
|
+
reportedType,
|
|
390
|
+
...resolveIntrospectedColumnType(reportedType, this.declaredDataTypes)
|
|
365
391
|
};
|
|
366
392
|
if (col.pk > 0) pkColumns.push({
|
|
367
393
|
name: col.name,
|
|
@@ -398,7 +424,7 @@ var SqliteControlAdapter = class {
|
|
|
398
424
|
const uniques = [];
|
|
399
425
|
const indexes = [];
|
|
400
426
|
for (const idx of indexListResult.rows) {
|
|
401
|
-
const idxColumns = (await driver.query(`PRAGMA index_info(
|
|
427
|
+
const idxColumns = (await driver.query(`PRAGMA index_info(${quoteIdentifier(idx.name)})`)).rows.sort((a, b) => a.seqno - b.seqno).map((r) => r.name);
|
|
402
428
|
if (idx.origin === "u") uniques.push({
|
|
403
429
|
columns: Object.freeze([...idxColumns]),
|
|
404
430
|
name: idx.name,
|
|
@@ -431,9 +457,6 @@ var SqliteControlAdapter = class {
|
|
|
431
457
|
return new SqlSchemaIR({ tables });
|
|
432
458
|
}
|
|
433
459
|
};
|
|
434
|
-
function escapePragmaArg(name) {
|
|
435
|
-
return name.replace(/"/g, "\"\"");
|
|
436
|
-
}
|
|
437
460
|
const SQLITE_REFERENTIAL_ACTION_MAP = {
|
|
438
461
|
"NO ACTION": "noAction",
|
|
439
462
|
RESTRICT: "restrict",
|
|
@@ -475,16 +498,26 @@ function flatColumnDependsOn(tableName, columns) {
|
|
|
475
498
|
id: `column:${column}`
|
|
476
499
|
}]);
|
|
477
500
|
}
|
|
478
|
-
function sqliteInlineLiteral(wire) {
|
|
501
|
+
function sqliteInlineLiteral(wire, where) {
|
|
479
502
|
if (wire === null) return "NULL";
|
|
480
503
|
if (typeof wire === "boolean") return wire ? "1" : "0";
|
|
481
504
|
if (typeof wire === "number") {
|
|
482
|
-
if (
|
|
505
|
+
if (Number.isNaN(wire)) throw structuredError("CONTRACT.DEFAULT_INVALID", `Column "${where.table}"."${where.column}" has a NaN default, which SQLite stores as NULL`, { meta: {
|
|
506
|
+
table: where.table,
|
|
507
|
+
column: where.column,
|
|
508
|
+
value: "NaN",
|
|
509
|
+
reason: "nan-default"
|
|
510
|
+
} });
|
|
511
|
+
if (!Number.isFinite(wire)) return wire > 0 ? "9e999" : "-9e999";
|
|
483
512
|
return String(wire);
|
|
484
513
|
}
|
|
485
514
|
if (typeof wire === "bigint") return String(wire);
|
|
486
515
|
if (wire instanceof Date) {
|
|
487
|
-
if (Number.isNaN(wire.getTime())) throw structuredError("CONTRACT.DEFAULT_INVALID", "
|
|
516
|
+
if (Number.isNaN(wire.getTime())) throw structuredError("CONTRACT.DEFAULT_INVALID", `Column "${where.table}"."${where.column}" has an invalid Date default`, { meta: {
|
|
517
|
+
table: where.table,
|
|
518
|
+
column: where.column,
|
|
519
|
+
reason: "invalid-date-default"
|
|
520
|
+
} });
|
|
488
521
|
return `'${escapeLiteral(wire.toISOString())}'`;
|
|
489
522
|
}
|
|
490
523
|
if (typeof wire === "string") return `'${escapeLiteral(wire)}'`;
|
|
@@ -492,28 +525,47 @@ function sqliteInlineLiteral(wire) {
|
|
|
492
525
|
if (typeof wire === "object") return `'${escapeLiteral(JSON.stringify(wire))}'`;
|
|
493
526
|
throw structuredError("CONTRACT.PACK_CONTRIBUTION_INVALID", `sqliteRenderDdlExecuteRequest: unexpected wire type "${typeof wire}"`, { meta: { wireType: typeof wire } });
|
|
494
527
|
}
|
|
495
|
-
|
|
528
|
+
const AUTOINCREMENT_DEFAULT = {
|
|
529
|
+
kind: "function",
|
|
530
|
+
expression: "autoincrement()"
|
|
531
|
+
};
|
|
532
|
+
/** `CREATE TABLE` text with its string literals, quoted identifiers and comments removed. */
|
|
533
|
+
function createTableKeywords(createSql) {
|
|
534
|
+
return createSql.replace(/'(?:[^']|'')*'|"(?:[^"]|"")*"|`(?:[^`]|``)*`|\[[^\]]*\]|--[^\n]*|\/\*[\s\S]*?(?:\*\/|$)/g, " ");
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* The column SQLite numbers with `AUTOINCREMENT`, which it keeps only in the table's `CREATE TABLE`
|
|
538
|
+
* text. SQLite accepts the keyword only on a table's sole `INTEGER PRIMARY KEY` column.
|
|
539
|
+
* See https://www.sqlite.org/autoinc.html.
|
|
540
|
+
*/
|
|
541
|
+
function autoincrementColumnOf(createSql, columns) {
|
|
542
|
+
if (!createSql || !/\bAUTOINCREMENT\b/i.test(createTableKeywords(createSql))) return;
|
|
543
|
+
const primaryKey = columns.filter((column) => column.pk > 0);
|
|
544
|
+
const [column] = primaryKey;
|
|
545
|
+
return primaryKey.length === 1 && column?.type.toUpperCase() === "INTEGER" ? column.name : void 0;
|
|
546
|
+
}
|
|
547
|
+
async function sqliteRenderDdlColumnDefault(def, codecLookup, codecRef, where) {
|
|
496
548
|
if (def.kind === "function") {
|
|
497
|
-
if (def.expression === "autoincrement()") return "";
|
|
498
|
-
if (def.expression === "now()") return
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
if (codecRef !== void 0) {
|
|
502
|
-
const codec = codecLookup.get(codecRef.codecId);
|
|
503
|
-
if (codec !== void 0) {
|
|
504
|
-
const value = def.value instanceof Date ? def.value : codec.decodeJson(def.value);
|
|
505
|
-
return `DEFAULT ${sqliteInlineLiteral(await codec.encode(value, {}))}`;
|
|
506
|
-
}
|
|
549
|
+
if (def.expression.text === "autoincrement()") return "";
|
|
550
|
+
if (def.expression.text === "now()") return `DEFAULT (${SQLITE_NOW_EXPRESSION})`;
|
|
551
|
+
if (checkSqlDefaultText(def.expression.text) !== void 0) throw structuredError("CONTRACT.DEFAULT_INVALID", `Unsafe default expression in contract: "${def.expression.text}". Default expressions must not contain semicolons, SQL comment tokens, dollar-quoting, or subqueries.`, { meta: { expression: def.expression.text } });
|
|
552
|
+
return `DEFAULT (${renderOpaqueSql(def.expression)})`;
|
|
507
553
|
}
|
|
508
|
-
|
|
554
|
+
const encoded = codecRef === void 0 ? void 0 : await encodeLiteralDefault(codecLookup, codecRef, def.value, where);
|
|
555
|
+
if (encoded?.kind === "sql-null") return "DEFAULT NULL";
|
|
556
|
+
if (encoded !== void 0) return `DEFAULT ${sqliteInlineLiteral(encoded.wire, where)}`;
|
|
557
|
+
return `DEFAULT ${sqliteInlineLiteral(def.value, where)}`;
|
|
509
558
|
}
|
|
510
|
-
async function sqliteRenderDdlColumn(column, codecLookup) {
|
|
559
|
+
async function sqliteRenderDdlColumn(column, codecLookup, table) {
|
|
511
560
|
if (column.type.includes("AUTOINCREMENT")) return `${quoteIdentifier(column.name)} ${column.type}`;
|
|
512
561
|
const parts = [quoteIdentifier(column.name), column.type];
|
|
513
562
|
if (column.notNull) parts.push("NOT NULL");
|
|
514
563
|
if (column.primaryKey) parts.push("PRIMARY KEY");
|
|
515
564
|
if (column.default) {
|
|
516
|
-
const clause = await sqliteRenderDdlColumnDefault(column.default, codecLookup, column.codecRef
|
|
565
|
+
const clause = await sqliteRenderDdlColumnDefault(column.default, codecLookup, column.codecRef, {
|
|
566
|
+
table,
|
|
567
|
+
column: column.name
|
|
568
|
+
});
|
|
517
569
|
if (clause.length > 0) parts.push(clause);
|
|
518
570
|
}
|
|
519
571
|
return parts.join(" ");
|
|
@@ -540,7 +592,7 @@ async function sqliteRenderDdlExecuteRequest(ast, codecLookup) {
|
|
|
540
592
|
const node = blindCast(ast);
|
|
541
593
|
const ifNotExists = node.ifNotExists ? "IF NOT EXISTS " : "";
|
|
542
594
|
const tableRef = quoteIdentifier(node.table);
|
|
543
|
-
const columnDefs = await Promise.all(node.columns.map((col) => sqliteRenderDdlColumn(col, codecLookup)));
|
|
595
|
+
const columnDefs = await Promise.all(node.columns.map((col) => sqliteRenderDdlColumn(col, codecLookup, node.table)));
|
|
544
596
|
const constraintDefs = node.constraints !== void 0 ? node.constraints.map(sqliteRenderDdlConstraint) : [];
|
|
545
597
|
return {
|
|
546
598
|
sql: `CREATE TABLE ${ifNotExists}${tableRef} (\n ${[...columnDefs, ...constraintDefs].join(",\n ")}\n)`,
|
|
@@ -560,16 +612,18 @@ const defaultCapabilities = Object.freeze({ sql: {
|
|
|
560
612
|
lateral: false,
|
|
561
613
|
jsonAgg: true,
|
|
562
614
|
returning: true,
|
|
563
|
-
enums: false
|
|
615
|
+
enums: false,
|
|
616
|
+
insertOnConflictSkip: true,
|
|
617
|
+
insertOnConflictWithoutTarget: true
|
|
564
618
|
} });
|
|
565
619
|
var SqliteAdapterImpl = class {
|
|
566
620
|
familyId = "sql";
|
|
567
621
|
targetId = "sqlite";
|
|
568
622
|
profile;
|
|
569
623
|
#codecs;
|
|
570
|
-
constructor(codecRegistry, profileId) {
|
|
624
|
+
constructor(codecRegistry, declaredDataTypes, profileId) {
|
|
571
625
|
this.#codecs = codecRegistry;
|
|
572
|
-
const controlAdapter = new SqliteControlAdapter(codecRegistry);
|
|
626
|
+
const controlAdapter = new SqliteControlAdapter(codecRegistry, declaredDataTypes);
|
|
573
627
|
this.profile = Object.freeze({
|
|
574
628
|
id: profileId ?? "sqlite/default@1",
|
|
575
629
|
target: "sqlite",
|
|
@@ -655,6 +709,10 @@ function renderLimitOffset(keyword, value, ctx) {
|
|
|
655
709
|
return `${keyword} ${renderExpr(value, ctx)}`;
|
|
656
710
|
}
|
|
657
711
|
function renderSelect(ast, ctx) {
|
|
712
|
+
if (ast.locking !== void 0 && ast.locking.length > 0) throw structuredError("RUNTIME.AST_UNSUPPORTED", "SQLite has no row locks, so a select cannot carry a locking clause such as FOR UPDATE", { meta: {
|
|
713
|
+
target: "sqlite",
|
|
714
|
+
feature: "locking-clause"
|
|
715
|
+
} });
|
|
658
716
|
return [
|
|
659
717
|
`SELECT ${ast.distinct ? "DISTINCT " : ""}${renderProjection(ast.projection, ctx)}`,
|
|
660
718
|
ast.from !== void 0 ? `FROM ${renderSource(ast.from, ctx)}` : "",
|
|
@@ -662,8 +720,8 @@ function renderSelect(ast, ctx) {
|
|
|
662
720
|
ast.where ? `WHERE ${renderExpr(ast.where, ctx)}` : "",
|
|
663
721
|
ast.groupBy?.length ? `GROUP BY ${ast.groupBy.map((expr) => renderExpr(expr, ctx)).join(", ")}` : "",
|
|
664
722
|
ast.having ? `HAVING ${renderExpr(ast.having, ctx)}` : "",
|
|
665
|
-
ast.orderBy?.length ? `ORDER BY ${ast.orderBy
|
|
666
|
-
renderLimitOffset("LIMIT", ast.limit, ctx),
|
|
723
|
+
ast.orderBy?.length ? `ORDER BY ${renderOrderByItems(ast.orderBy, ctx)}` : "",
|
|
724
|
+
ast.limit === void 0 && ast.offset !== void 0 ? "LIMIT -1" : renderLimitOffset("LIMIT", ast.limit, ctx),
|
|
667
725
|
renderLimitOffset("OFFSET", ast.offset, ctx)
|
|
668
726
|
].filter((part) => part.length > 0).join(" ").trim();
|
|
669
727
|
}
|
|
@@ -763,6 +821,7 @@ function renderColumn(ref) {
|
|
|
763
821
|
}
|
|
764
822
|
function renderLiteral(expr) {
|
|
765
823
|
if (typeof expr.value === "string") return `'${escapeLiteral(expr.value)}'`;
|
|
824
|
+
if (typeof expr.value === "number" && !Number.isNaN(expr.value) && !Number.isFinite(expr.value)) return expr.value > 0 ? "9e999" : "-9e999";
|
|
766
825
|
if (typeof expr.value === "number" || typeof expr.value === "boolean") return String(expr.value);
|
|
767
826
|
if (typeof expr.value === "bigint") return String(expr.value);
|
|
768
827
|
if (expr.value === null || expr.value === void 0) return "NULL";
|
|
@@ -846,6 +905,8 @@ function renderBinary(expr, ctx) {
|
|
|
846
905
|
return `${leftRendered} ${{
|
|
847
906
|
eq: "=",
|
|
848
907
|
neq: "!=",
|
|
908
|
+
isNotDistinctFrom: "IS",
|
|
909
|
+
isDistinctFrom: "IS NOT",
|
|
849
910
|
gt: ">",
|
|
850
911
|
lt: "<",
|
|
851
912
|
gte: ">=",
|
|
@@ -899,7 +960,18 @@ function renderJsonObjectExpr(expr, ctx) {
|
|
|
899
960
|
}).join(", ")})`;
|
|
900
961
|
}
|
|
901
962
|
function renderOrderByItems(items, ctx) {
|
|
902
|
-
return items.map((item) => `${renderExpr(item.expr, ctx)}
|
|
963
|
+
return items.map((item) => `${renderExpr(item.expr, ctx)}${ORDER_DIRECTION_SQL[item.dir]}${renderNullsPlacement(item)}`).join(", ");
|
|
964
|
+
}
|
|
965
|
+
const ORDER_DIRECTION_SQL = {
|
|
966
|
+
asc: " ASC",
|
|
967
|
+
desc: " DESC"
|
|
968
|
+
};
|
|
969
|
+
const ORDER_NULLS_SQL = {
|
|
970
|
+
first: " NULLS FIRST",
|
|
971
|
+
last: " NULLS LAST"
|
|
972
|
+
};
|
|
973
|
+
function renderNullsPlacement(item) {
|
|
974
|
+
return item.nulls === void 0 ? "" : ORDER_NULLS_SQL[item.nulls];
|
|
903
975
|
}
|
|
904
976
|
function renderJsonArrayAggExpr(expr, ctx) {
|
|
905
977
|
const aggregateOrderBy = expr.orderBy && expr.orderBy.length > 0 ? ` ORDER BY ${renderOrderByItems(expr.orderBy, ctx)}` : "";
|
|
@@ -926,7 +998,7 @@ function renderInsertValue(value, ctx) {
|
|
|
926
998
|
}
|
|
927
999
|
}
|
|
928
1000
|
function renderInsert(ast, ctx) {
|
|
929
|
-
const table =
|
|
1001
|
+
const table = renderTableSource(ast.table, ctx);
|
|
930
1002
|
const rows = ast.rows;
|
|
931
1003
|
const firstRow = rows[0];
|
|
932
1004
|
if (firstRow === void 0) throw structuredError("RUNTIME.AST_INVALID", "INSERT requires at least one row", { meta: {
|
|
@@ -954,22 +1026,21 @@ function renderInsert(ast, ctx) {
|
|
|
954
1026
|
let onConflictClause = "";
|
|
955
1027
|
if (ast.onConflict) {
|
|
956
1028
|
const conflictColumns = ast.onConflict.columns.map((col) => quoteIdentifier(col.column));
|
|
957
|
-
|
|
958
|
-
node: "insert",
|
|
959
|
-
table: ast.table.name
|
|
960
|
-
} });
|
|
1029
|
+
const target = conflictColumns.length === 0 ? "" : ` (${conflictColumns.join(", ")})`;
|
|
961
1030
|
const action = ast.onConflict.action;
|
|
962
1031
|
switch (action.kind) {
|
|
963
1032
|
case "do-nothing":
|
|
964
|
-
onConflictClause = ` ON CONFLICT
|
|
1033
|
+
onConflictClause = ` ON CONFLICT${target} DO NOTHING`;
|
|
965
1034
|
break;
|
|
966
|
-
case "do-update-set":
|
|
967
|
-
|
|
1035
|
+
case "do-update-set":
|
|
1036
|
+
if (conflictColumns.length === 0) throw structuredError("RUNTIME.AST_INVALID", "INSERT onConflict requires at least one conflict column", { meta: {
|
|
1037
|
+
node: "insert",
|
|
1038
|
+
table: ast.table.name
|
|
1039
|
+
} });
|
|
1040
|
+
onConflictClause = ` ON CONFLICT${target} DO UPDATE SET ${Object.entries(action.set).map(([colName, value]) => {
|
|
968
1041
|
return `${quoteIdentifier(colName)} = ${renderExpr(value, ctx)}`;
|
|
969
|
-
})
|
|
970
|
-
onConflictClause = ` ON CONFLICT (${conflictColumns.join(", ")}) DO UPDATE SET ${updates.join(", ")}`;
|
|
1042
|
+
}).join(", ")}`;
|
|
971
1043
|
break;
|
|
972
|
-
}
|
|
973
1044
|
default: assertNever(action, `Unsupported onConflict action: ${unreachableKind(action)}`);
|
|
974
1045
|
}
|
|
975
1046
|
}
|
|
@@ -977,7 +1048,7 @@ function renderInsert(ast, ctx) {
|
|
|
977
1048
|
return `${insertClause}${onConflictClause}${returningClause}`;
|
|
978
1049
|
}
|
|
979
1050
|
function renderUpdate(ast, ctx) {
|
|
980
|
-
const table =
|
|
1051
|
+
const table = renderTableSource(ast.table, ctx);
|
|
981
1052
|
const setClauses = Object.entries(ast.set).map(([col, val]) => {
|
|
982
1053
|
return `${quoteIdentifier(col)} = ${renderExpr(val, ctx)}`;
|
|
983
1054
|
});
|
|
@@ -986,13 +1057,13 @@ function renderUpdate(ast, ctx) {
|
|
|
986
1057
|
return `UPDATE ${table} SET ${setClauses.join(", ")}${whereClause}${returningClause}`;
|
|
987
1058
|
}
|
|
988
1059
|
function renderDelete(ast, ctx) {
|
|
989
|
-
return `DELETE FROM ${
|
|
1060
|
+
return `DELETE FROM ${renderTableSource(ast.table, ctx)}${ast.where ? ` WHERE ${renderExpr(ast.where, ctx)}` : ""}${renderReturning(ast.returning, ctx)}`;
|
|
990
1061
|
}
|
|
991
1062
|
function renderReturning(returning, ctx) {
|
|
992
1063
|
if (!returning?.length) return "";
|
|
993
1064
|
return ` RETURNING ${returning.map((item) => {
|
|
994
1065
|
if (item.expr.kind === "column-ref") {
|
|
995
|
-
const rendered =
|
|
1066
|
+
const rendered = quoteIdentifier(item.expr.column);
|
|
996
1067
|
return item.expr.column === item.alias ? rendered : `${rendered} AS ${quoteIdentifier(item.alias)}`;
|
|
997
1068
|
}
|
|
998
1069
|
return `${renderExpr(item.expr, ctx)} AS ${quoteIdentifier(item.alias)}`;
|
|
@@ -1000,12 +1071,12 @@ function renderReturning(returning, ctx) {
|
|
|
1000
1071
|
}
|
|
1001
1072
|
function createSqliteAdapter(options) {
|
|
1002
1073
|
const codecRegistry = createSqliteCodecRegistryWithBuiltins(options?.codecDescriptors);
|
|
1003
|
-
return Object.freeze(new SqliteAdapterImpl(codecRegistry, options?.profileId));
|
|
1074
|
+
return Object.freeze(new SqliteAdapterImpl(codecRegistry, sqliteDataTypes, options?.profileId));
|
|
1004
1075
|
}
|
|
1005
|
-
function createSqliteAdapterWithCodecRegistry(codecRegistry) {
|
|
1006
|
-
return Object.freeze(new SqliteAdapterImpl(codecRegistry));
|
|
1076
|
+
function createSqliteAdapterWithCodecRegistry(codecRegistry, declaredDataTypes) {
|
|
1077
|
+
return Object.freeze(new SqliteAdapterImpl(codecRegistry, declaredDataTypes));
|
|
1007
1078
|
}
|
|
1008
1079
|
//#endregion
|
|
1009
|
-
export {
|
|
1080
|
+
export { sqliteRawCodecInferer as a, renderLoweredSql as i, createSqliteAdapter as n, createSqliteAdapterWithCodecRegistry as r, SqliteControlAdapter as t };
|
|
1010
1081
|
|
|
1011
|
-
//# sourceMappingURL=adapter-
|
|
1082
|
+
//# sourceMappingURL=adapter-7m8HU4rt-DN15_Cn8.mjs.map
|