@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
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { c as sqliteDatetimeText, d as sqliteReal, f as sqliteText, l as sqliteInteger, n as sqliteBlobFromHexText, s as sqliteDatetime, t as sqliteBlob, u as sqliteJson } from "./data-types-coQrCWfS-yMCe4F52.mjs";
|
|
2
|
+
import { createNumberClassifier, numeralText, parseJsonText, signedRange } from "@prisma/orm-framework/components/codec";
|
|
3
|
+
import { canonicalizeJson } from "@prisma/orm-framework/components/utils";
|
|
4
|
+
//#region ../../../3-targets/sqlite/1-target/dist/data-type-entries-yQ-qYugg.mjs
|
|
5
|
+
const classifySqliteNumber = createNumberClassifier({
|
|
6
|
+
integers: [{
|
|
7
|
+
type: sqliteInteger.id,
|
|
8
|
+
form: "text",
|
|
9
|
+
...signedRange(64)
|
|
10
|
+
}],
|
|
11
|
+
fraction: {
|
|
12
|
+
type: sqliteReal.id,
|
|
13
|
+
form: "number"
|
|
14
|
+
},
|
|
15
|
+
words: {
|
|
16
|
+
type: sqliteReal.id,
|
|
17
|
+
form: "text"
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
function printNumber(value) {
|
|
21
|
+
return typeof value === "number" ? numeralText(value) : String(value);
|
|
22
|
+
}
|
|
23
|
+
function sqliteDataTypeEntries() {
|
|
24
|
+
return {
|
|
25
|
+
[sqliteText.id]: {
|
|
26
|
+
written: {
|
|
27
|
+
kind: "plain",
|
|
28
|
+
syntax: "string",
|
|
29
|
+
parse: (text) => text
|
|
30
|
+
},
|
|
31
|
+
print: (value) => String(value),
|
|
32
|
+
documentation: "Text."
|
|
33
|
+
},
|
|
34
|
+
[sqliteReal.id]: {
|
|
35
|
+
written: {
|
|
36
|
+
kind: "plain",
|
|
37
|
+
syntax: "number",
|
|
38
|
+
types: [sqliteInteger.id, sqliteReal.id],
|
|
39
|
+
classify: classifySqliteNumber
|
|
40
|
+
},
|
|
41
|
+
print: printNumber,
|
|
42
|
+
documentation: "A number, whose type comes from its own size and precision."
|
|
43
|
+
},
|
|
44
|
+
[sqliteJson.id]: {
|
|
45
|
+
written: {
|
|
46
|
+
kind: "tag",
|
|
47
|
+
tag: "json",
|
|
48
|
+
parse: (text) => canonicalizeJson(parseJsonText(text))
|
|
49
|
+
},
|
|
50
|
+
print: (value) => String(value),
|
|
51
|
+
documentation: "Reads the text as a JSON document and stores its JSON text as the default value."
|
|
52
|
+
},
|
|
53
|
+
[sqliteBlob.id]: {
|
|
54
|
+
written: {
|
|
55
|
+
kind: "tag",
|
|
56
|
+
tag: "blob",
|
|
57
|
+
parse: sqliteBlobFromHexText
|
|
58
|
+
},
|
|
59
|
+
print: (value) => String(value).toLowerCase(),
|
|
60
|
+
documentation: "Bytes, written as hex text, two digits for each byte, as in blob`68656c6c6f`."
|
|
61
|
+
},
|
|
62
|
+
[sqliteDatetime.id]: {
|
|
63
|
+
written: {
|
|
64
|
+
kind: "tag",
|
|
65
|
+
tag: "datetime",
|
|
66
|
+
parse: sqliteDatetimeText
|
|
67
|
+
},
|
|
68
|
+
print: (value) => String(value),
|
|
69
|
+
documentation: "An instant, as in datetime`2024-01-01T00:00:00Z`. Reads ISO 8601 with a UTC offset and stores the instant in UTC with three fraction digits, the text every row holds."
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
export { sqliteDataTypeEntries as t };
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=data-type-entries-yQ-qYugg-C_NnX5WO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-type-entries-yQ-qYugg-C_NnX5WO.mjs","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/data-type-entries-yQ-qYugg.mjs"],"sourcesContent":["import { c as sqliteDatetimeText, d as sqliteReal, f as sqliteText, l as sqliteInteger, n as sqliteBlobFromHexText, s as sqliteDatetime, t as sqliteBlob, u as sqliteJson } from \"./data-types-coQrCWfS.mjs\";\nimport { createNumberClassifier, numeralText, parseJsonText, signedRange } from \"@internal/framework-components/codec\";\nimport { canonicalizeJson } from \"@internal/framework-components/utils\";\n//#region src/core/data-type-entries.ts\nconst classifySqliteNumber = createNumberClassifier({\n\tintegers: [{\n\t\ttype: sqliteInteger.id,\n\t\tform: \"text\",\n\t\t...signedRange(64)\n\t}],\n\tfraction: {\n\t\ttype: sqliteReal.id,\n\t\tform: \"number\"\n\t},\n\twords: {\n\t\ttype: sqliteReal.id,\n\t\tform: \"text\"\n\t}\n});\nfunction printNumber(value) {\n\treturn typeof value === \"number\" ? numeralText(value) : String(value);\n}\nfunction sqliteDataTypeEntries() {\n\treturn {\n\t\t[sqliteText.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"plain\",\n\t\t\t\tsyntax: \"string\",\n\t\t\t\tparse: (text) => text\n\t\t\t},\n\t\t\tprint: (value) => String(value),\n\t\t\tdocumentation: \"Text.\"\n\t\t},\n\t\t[sqliteReal.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"plain\",\n\t\t\t\tsyntax: \"number\",\n\t\t\t\ttypes: [sqliteInteger.id, sqliteReal.id],\n\t\t\t\tclassify: classifySqliteNumber\n\t\t\t},\n\t\t\tprint: printNumber,\n\t\t\tdocumentation: \"A number, whose type comes from its own size and precision.\"\n\t\t},\n\t\t[sqliteJson.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"tag\",\n\t\t\t\ttag: \"json\",\n\t\t\t\tparse: (text) => canonicalizeJson(parseJsonText(text))\n\t\t\t},\n\t\t\tprint: (value) => String(value),\n\t\t\tdocumentation: \"Reads the text as a JSON document and stores its JSON text as the default value.\"\n\t\t},\n\t\t[sqliteBlob.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"tag\",\n\t\t\t\ttag: \"blob\",\n\t\t\t\tparse: sqliteBlobFromHexText\n\t\t\t},\n\t\t\tprint: (value) => String(value).toLowerCase(),\n\t\t\tdocumentation: \"Bytes, written as hex text, two digits for each byte, as in blob`68656c6c6f`.\"\n\t\t},\n\t\t[sqliteDatetime.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"tag\",\n\t\t\t\ttag: \"datetime\",\n\t\t\t\tparse: sqliteDatetimeText\n\t\t\t},\n\t\t\tprint: (value) => String(value),\n\t\t\tdocumentation: \"An instant, as in datetime`2024-01-01T00:00:00Z`. Reads ISO 8601 with a UTC offset and stores the instant in UTC with three fraction digits, the text every row holds.\"\n\t\t}\n\t};\n}\n//#endregion\nexport { sqliteDataTypeEntries as t };\n\n//# sourceMappingURL=data-type-entries-yQ-qYugg.mjs.map"],"mappings":";;;;AAIA,MAAM,uBAAuB,uBAAuB;CACnD,UAAU,CAAC;EACV,MAAM,cAAc;EACpB,MAAM;EACN,GAAG,YAAY,EAAE;CAClB,CAAC;CACD,UAAU;EACT,MAAM,WAAW;EACjB,MAAM;CACP;CACA,OAAO;EACN,MAAM,WAAW;EACjB,MAAM;CACP;AACD,CAAC;AACD,SAAS,YAAY,OAAO;CAC3B,OAAO,OAAO,UAAU,WAAW,YAAY,KAAK,IAAI,OAAO,KAAK;AACrE;AACA,SAAS,wBAAwB;CAChC,OAAO;GACL,WAAW,KAAK;GAChB,SAAS;IACR,MAAM;IACN,QAAQ;IACR,QAAQ,SAAS;GAClB;GACA,QAAQ,UAAU,OAAO,KAAK;GAC9B,eAAe;EAChB;GACC,WAAW,KAAK;GAChB,SAAS;IACR,MAAM;IACN,QAAQ;IACR,OAAO,CAAC,cAAc,IAAI,WAAW,EAAE;IACvC,UAAU;GACX;GACA,OAAO;GACP,eAAe;EAChB;GACC,WAAW,KAAK;GAChB,SAAS;IACR,MAAM;IACN,KAAK;IACL,QAAQ,SAAS,iBAAiB,cAAc,IAAI,CAAC;GACtD;GACA,QAAQ,UAAU,OAAO,KAAK;GAC9B,eAAe;EAChB;GACC,WAAW,KAAK;GAChB,SAAS;IACR,MAAM;IACN,KAAK;IACL,OAAO;GACR;GACA,QAAQ,UAAU,OAAO,KAAK,CAAC,CAAC,YAAY;GAC5C,eAAe;EAChB;GACC,eAAe,KAAK;GACpB,SAAS;IACR,MAAM;IACN,KAAK;IACL,OAAO;GACR;GACA,QAAQ,UAAU,OAAO,KAAK;GAC9B,eAAe;EAChB;CACD;AACD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { DataType, DataTypeId } from "@prisma/orm-framework/components/codec";
|
|
2
|
+
import { DataTypeAuthoringEntry } from "@prisma/orm-framework/components/authoring";
|
|
3
|
+
//#region ../../../3-targets/sqlite/1-target/dist/data-types.d.mts
|
|
4
|
+
//#region src/core/data-type-entries.d.ts
|
|
5
|
+
declare function sqliteDataTypeEntries(): Readonly<Record<string, DataTypeAuthoringEntry>>;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/core/data-types.d.ts
|
|
8
|
+
declare const sqliteText: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<Readonly<Record<string, unknown>>>;
|
|
9
|
+
/** Digit text, which holds every 64-bit integer exactly; SQLite reads an INTEGER default back as a number. */
|
|
10
|
+
declare const sqliteInteger: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<Readonly<Record<string, unknown>>>;
|
|
11
|
+
/** SQLite cannot store NaN, but a codec refuses it, as ADR 254 places that limit, so the type reads it. */
|
|
12
|
+
declare const sqliteReal: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<Readonly<Record<string, unknown>>>;
|
|
13
|
+
declare const sqliteBlob: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<Readonly<Record<string, unknown>>>;
|
|
14
|
+
/** The upper-case hex `sqlite/blob` stores for the hex text a `blob` tag holds, `68656c6c6f`. */
|
|
15
|
+
declare function sqliteBlobFromHexText(text: string): string;
|
|
16
|
+
/** The length of `character` and `character varying`, which SQLite accepts and does not enforce, up to SQLite's largest string length, so a double holds every accepted length exactly. */
|
|
17
|
+
declare const sqliteCharacterLengthParams: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
18
|
+
length?: number;
|
|
19
|
+
}, {}>;
|
|
20
|
+
declare const sqliteCharacter: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<{
|
|
21
|
+
length?: number;
|
|
22
|
+
}>;
|
|
23
|
+
declare const sqliteCharacterVarying: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<{
|
|
24
|
+
length?: number;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* The value of `sqlite/datetime` (ADR 254): the text `toISOString()` writes for every row. The range and the millisecond precision are those of a JavaScript `Date`, the codec's value.
|
|
28
|
+
*/
|
|
29
|
+
declare const sqliteDatetimeText: (text: string) => string;
|
|
30
|
+
/** An instant, stored as text in the form `toISOString()` writes. */
|
|
31
|
+
declare const sqliteDatetime: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<Readonly<Record<string, unknown>>>;
|
|
32
|
+
/** A JSON document, stored as its JSON text with sorted keys and no added whitespace. A column declared `JSON` would have numeric affinity and store the document `"42"` as the integer 42. */
|
|
33
|
+
declare const sqliteJson: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<Readonly<Record<string, unknown>>>;
|
|
34
|
+
/** Every data type this target registers. */
|
|
35
|
+
declare const sqliteDataTypes: readonly DataType[];
|
|
36
|
+
/** SQLite's text data types: `text`, `character(n)` and `character varying(n)`. */
|
|
37
|
+
declare const sqliteTextDataTypes: readonly DataTypeId[];
|
|
38
|
+
//#endregion
|
|
39
|
+
export { sqliteCharacterVarying as a, sqliteDatetime as c, sqliteJson as d, sqliteReal as f, sqliteCharacterLengthParams as i, sqliteDatetimeText as l, sqliteTextDataTypes as m, sqliteBlobFromHexText as n, sqliteDataTypeEntries as o, sqliteText as p, sqliteCharacter as r, sqliteDataTypes as s, sqliteBlob as t, sqliteInteger as u };
|
|
40
|
+
//# sourceMappingURL=data-types-Dx3rHsbF.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-types-Dx3rHsbF.d.mts","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/data-types.d.mts"],"mappings":";;;;iBAGiB,yBAAyB,SAAS,eAAe;;;cAGpD,uDAAuD,YAAY,SAAS;;cAE5E,0DAA0D,YAAY,SAAS;;cAE/E,uDAAuD,YAAY,SAAS;cAC5E,uDAAuD,YAAY,SAAS;;iBAEzE,sBAAsB;;cAEzB,2EAA2E;EACvF;;cAEY,4DAA4D;EACxE;;cAEY,mEAAmE;EAC/E;;;;;cAKY,qBAAqB;;cAErB,2DAA2D,YAAY,SAAS;;cAEhF,uDAAuD,YAAY,SAAS;;cAE5E,0BAA0B;;cAE1B,8BAA8B"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { INT64_RANGE, castUnchanged, isoDateStringText, readJsonFloat, readJsonIntegerText, readJsonMatching, readJsonString, refuseJsonValue, refuseWrongShape } from "@prisma/orm-framework/components/codec";
|
|
2
|
+
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
3
|
+
import { canonicalizeJson } from "@prisma/orm-framework/components/utils";
|
|
4
|
+
import { sqlDataType, sqlRawDataType } from "@prisma/orm-family-sql/contract/data-type";
|
|
5
|
+
import { type } from "arktype";
|
|
6
|
+
//#region ../../../3-targets/sqlite/1-target/dist/data-types-coQrCWfS.mjs
|
|
7
|
+
/** Digit text as `real` stores it: the nearest double, as SQLite converts an integer to a real. */
|
|
8
|
+
const asReal = (value) => typeof value === "string" ? Number(value) : refuseWrongShape(value, "digit text");
|
|
9
|
+
/** A type written and reported by `name` and nothing else. */
|
|
10
|
+
const storedAs = (id, name, read, casts = {}) => sqlDataType(id, {
|
|
11
|
+
texts: [{
|
|
12
|
+
text: name,
|
|
13
|
+
written: true,
|
|
14
|
+
catalog: true
|
|
15
|
+
}],
|
|
16
|
+
read,
|
|
17
|
+
casts
|
|
18
|
+
});
|
|
19
|
+
const readText = (json) => readJsonString("sqlite/text", json);
|
|
20
|
+
const UPPERCASE_HEX = /^(?:[0-9A-F]{2})*$/;
|
|
21
|
+
const sqliteText = storedAs("sqlite/text", "text", readText);
|
|
22
|
+
/** Digit text, which holds every 64-bit integer exactly; SQLite reads an INTEGER default back as a number. */
|
|
23
|
+
const sqliteInteger = sqlDataType("sqlite/integer", {
|
|
24
|
+
texts: [{
|
|
25
|
+
text: "integer",
|
|
26
|
+
written: true,
|
|
27
|
+
catalog: true
|
|
28
|
+
}],
|
|
29
|
+
read: (json) => {
|
|
30
|
+
readJsonIntegerText("sqlite/integer", json, INT64_RANGE);
|
|
31
|
+
return json;
|
|
32
|
+
},
|
|
33
|
+
casts: {}
|
|
34
|
+
});
|
|
35
|
+
/** SQLite cannot store NaN, but a codec refuses it, as ADR 254 places that limit, so the type reads it. */
|
|
36
|
+
const sqliteReal = storedAs("sqlite/real", "real", (json) => {
|
|
37
|
+
readJsonFloat("sqlite/real", json);
|
|
38
|
+
return json;
|
|
39
|
+
}, { [sqliteInteger.id]: asReal });
|
|
40
|
+
const sqliteBlob = storedAs("sqlite/blob", "blob", (json) => readJsonMatching("sqlite/blob", json, UPPERCASE_HEX, "uppercase hexadecimal text"), {});
|
|
41
|
+
const HEX_TEXT = /^(?:[0-9A-Fa-f]{2})*$/;
|
|
42
|
+
/** The upper-case hex `sqlite/blob` stores for the hex text a `blob` tag holds, `68656c6c6f`. */
|
|
43
|
+
function sqliteBlobFromHexText(text) {
|
|
44
|
+
if (!HEX_TEXT.test(text)) throw structuredError("CONTRACT.CAST_REFUSED", `"${text}" is not hex text: write two hexadecimal digits for each byte, as in blob\`68656c6c6f\`.`, {
|
|
45
|
+
why: "The blob tag reads bytes as hex text, two digits for each byte.",
|
|
46
|
+
fix: "Write the bytes in hex, as in blob`68656c6c6f`."
|
|
47
|
+
});
|
|
48
|
+
return text.toUpperCase();
|
|
49
|
+
}
|
|
50
|
+
/** The length of `character` and `character varying`, which SQLite accepts and does not enforce, up to SQLite's largest string length, so a double holds every accepted length exactly. */
|
|
51
|
+
const sqliteCharacterLengthParams = type({ "length?": `number.integer >= 1 & number.integer <= 2147483647` });
|
|
52
|
+
/** A character type is written without its length, so its normal form has none. */
|
|
53
|
+
const withoutLength = ({ length: _length, ...rest }) => rest;
|
|
54
|
+
const sqliteCharacter = sqlDataType("sqlite/character", {
|
|
55
|
+
params: sqliteCharacterLengthParams,
|
|
56
|
+
texts: [{
|
|
57
|
+
text: "character",
|
|
58
|
+
written: true,
|
|
59
|
+
catalog: true
|
|
60
|
+
}],
|
|
61
|
+
read: (json) => readJsonString("sqlite/character", json),
|
|
62
|
+
normalize: withoutLength,
|
|
63
|
+
casts: { [sqliteText.id]: castUnchanged }
|
|
64
|
+
});
|
|
65
|
+
const sqliteCharacterVarying = sqlDataType("sqlite/character-varying", {
|
|
66
|
+
params: sqliteCharacterLengthParams,
|
|
67
|
+
texts: [{
|
|
68
|
+
text: "character varying",
|
|
69
|
+
written: true,
|
|
70
|
+
catalog: true
|
|
71
|
+
}],
|
|
72
|
+
read: (json) => readJsonString("sqlite/character-varying", json),
|
|
73
|
+
normalize: withoutLength,
|
|
74
|
+
casts: { [sqliteText.id]: castUnchanged }
|
|
75
|
+
});
|
|
76
|
+
/**
|
|
77
|
+
* The value of `sqlite/datetime` (ADR 254): the text `toISOString()` writes for every row. The range and the millisecond precision are those of a JavaScript `Date`, the codec's value.
|
|
78
|
+
*/
|
|
79
|
+
const sqliteDatetimeText = (text) => isoDateStringText(text, "sqlite/datetime");
|
|
80
|
+
/** What `sqliteDatetimeText` writes for `text`, or `undefined` when it names no instant the type holds. */
|
|
81
|
+
function storedDatetime(text) {
|
|
82
|
+
try {
|
|
83
|
+
return sqliteDatetimeText(text);
|
|
84
|
+
} catch {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** Reads an instant in any spelling the `datetime` tag reads; `spellDatetime` gives it the one it stores. */
|
|
89
|
+
const readDatetime = (json) => typeof json === "string" && storedDatetime(json) !== void 0 ? json : refuseJsonValue("sqlite/datetime", "ISO 8601 date and time text with a UTC offset and at most three fraction digits, as in \"2024-01-01T00:00:00Z\"", json);
|
|
90
|
+
/** An instant is stored in UTC with three fraction digits. */
|
|
91
|
+
const spellDatetime = (json) => typeof json === "string" ? storedDatetime(json) ?? json : json;
|
|
92
|
+
/** The document JSON text holds, or `undefined` when the text is not JSON. */
|
|
93
|
+
function documentOf(text) {
|
|
94
|
+
try {
|
|
95
|
+
return { value: JSON.parse(text) };
|
|
96
|
+
} catch {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/** Reads the JSON text of a document, in any spelling; `spellJson` gives it the one it stores. */
|
|
101
|
+
const readJson = (json) => typeof json === "string" && documentOf(json) !== void 0 ? json : refuseJsonValue("sqlite/json", "the JSON text of a document", json);
|
|
102
|
+
/** A document is stored as its JSON text with sorted keys and no added whitespace. */
|
|
103
|
+
const spellJson = (json) => {
|
|
104
|
+
const document = typeof json === "string" ? documentOf(json) : void 0;
|
|
105
|
+
return document === void 0 ? json : canonicalizeJson(document.value);
|
|
106
|
+
};
|
|
107
|
+
/** An instant, stored as text in the form `toISOString()` writes. */
|
|
108
|
+
const sqliteDatetime = sqlDataType("sqlite/datetime", {
|
|
109
|
+
storedAs: sqliteText.id,
|
|
110
|
+
read: readDatetime,
|
|
111
|
+
spell: spellDatetime
|
|
112
|
+
});
|
|
113
|
+
/** A JSON document, stored as its JSON text with sorted keys and no added whitespace. A column declared `JSON` would have numeric affinity and store the document `"42"` as the integer 42. */
|
|
114
|
+
const sqliteJson = sqlDataType("sqlite/json", {
|
|
115
|
+
storedAs: sqliteText.id,
|
|
116
|
+
read: readJson,
|
|
117
|
+
spell: spellJson
|
|
118
|
+
});
|
|
119
|
+
/** Every data type this target registers. */
|
|
120
|
+
const sqliteDataTypes = [
|
|
121
|
+
sqliteText,
|
|
122
|
+
sqliteInteger,
|
|
123
|
+
sqliteReal,
|
|
124
|
+
sqliteBlob,
|
|
125
|
+
sqliteCharacter,
|
|
126
|
+
sqliteCharacterVarying,
|
|
127
|
+
sqliteDatetime,
|
|
128
|
+
sqliteJson,
|
|
129
|
+
sqlRawDataType
|
|
130
|
+
];
|
|
131
|
+
/** SQLite's text data types: `text`, `character(n)` and `character varying(n)`. */
|
|
132
|
+
const sqliteTextDataTypes = [
|
|
133
|
+
sqliteText.id,
|
|
134
|
+
sqliteCharacter.id,
|
|
135
|
+
sqliteCharacterVarying.id
|
|
136
|
+
];
|
|
137
|
+
//#endregion
|
|
138
|
+
export { sqliteCharacterVarying as a, sqliteDatetimeText as c, sqliteReal as d, sqliteText as f, sqliteCharacterLengthParams as i, sqliteInteger as l, sqliteBlobFromHexText as n, sqliteDataTypes as o, sqliteTextDataTypes as p, sqliteCharacter as r, sqliteDatetime as s, sqliteBlob as t, sqliteJson as u };
|
|
139
|
+
|
|
140
|
+
//# sourceMappingURL=data-types-coQrCWfS-yMCe4F52.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-types-coQrCWfS-yMCe4F52.mjs","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/data-types-coQrCWfS.mjs"],"sourcesContent":["import { INT64_RANGE, castUnchanged, isoDateStringText, readJsonFloat, readJsonIntegerText, readJsonMatching, readJsonString, refuseJsonValue, refuseWrongShape } from \"@internal/framework-components/codec\";\nimport { canonicalizeJson } from \"@internal/framework-components/utils\";\nimport { sqlDataType, sqlRawDataType } from \"@internal/sql-contract/data-type\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { type } from \"arktype\";\n//#region src/core/data-types.ts\n/** Digit text as `real` stores it: the nearest double, as SQLite converts an integer to a real. */\nconst asReal = (value) => typeof value === \"string\" ? Number(value) : refuseWrongShape(value, \"digit text\");\n/** A type written and reported by `name` and nothing else. */\nconst storedAs = (id, name, read, casts = {}) => sqlDataType(id, {\n\ttexts: [{\n\t\ttext: name,\n\t\twritten: true,\n\t\tcatalog: true\n\t}],\n\tread,\n\tcasts\n});\nconst readText = (json) => readJsonString(\"sqlite/text\", json);\nconst UPPERCASE_HEX = /^(?:[0-9A-F]{2})*$/;\nconst sqliteText = storedAs(\"sqlite/text\", \"text\", readText);\n/** Digit text, which holds every 64-bit integer exactly; SQLite reads an INTEGER default back as a number. */\nconst sqliteInteger = sqlDataType(\"sqlite/integer\", {\n\ttexts: [{\n\t\ttext: \"integer\",\n\t\twritten: true,\n\t\tcatalog: true\n\t}],\n\tread: (json) => {\n\t\treadJsonIntegerText(\"sqlite/integer\", json, INT64_RANGE);\n\t\treturn json;\n\t},\n\tcasts: {}\n});\n/** SQLite cannot store NaN, but a codec refuses it, as ADR 254 places that limit, so the type reads it. */\nconst sqliteReal = storedAs(\"sqlite/real\", \"real\", (json) => {\n\treadJsonFloat(\"sqlite/real\", json);\n\treturn json;\n}, { [sqliteInteger.id]: asReal });\nconst sqliteBlob = storedAs(\"sqlite/blob\", \"blob\", (json) => readJsonMatching(\"sqlite/blob\", json, UPPERCASE_HEX, \"uppercase hexadecimal text\"), {});\nconst HEX_TEXT = /^(?:[0-9A-Fa-f]{2})*$/;\n/** The upper-case hex `sqlite/blob` stores for the hex text a `blob` tag holds, `68656c6c6f`. */\nfunction sqliteBlobFromHexText(text) {\n\tif (!HEX_TEXT.test(text)) throw structuredError(\"CONTRACT.CAST_REFUSED\", `\"${text}\" is not hex text: write two hexadecimal digits for each byte, as in blob\\`68656c6c6f\\`.`, {\n\t\twhy: \"The blob tag reads bytes as hex text, two digits for each byte.\",\n\t\tfix: \"Write the bytes in hex, as in blob`68656c6c6f`.\"\n\t});\n\treturn text.toUpperCase();\n}\n/** The length of `character` and `character varying`, which SQLite accepts and does not enforce, up to SQLite's largest string length, so a double holds every accepted length exactly. */\nconst sqliteCharacterLengthParams = type({ \"length?\": `number.integer >= 1 & number.integer <= 2147483647` });\n/** A character type is written without its length, so its normal form has none. */\nconst withoutLength = ({ length: _length, ...rest }) => rest;\nconst sqliteCharacter = sqlDataType(\"sqlite/character\", {\n\tparams: sqliteCharacterLengthParams,\n\ttexts: [{\n\t\ttext: \"character\",\n\t\twritten: true,\n\t\tcatalog: true\n\t}],\n\tread: (json) => readJsonString(\"sqlite/character\", json),\n\tnormalize: withoutLength,\n\tcasts: { [sqliteText.id]: castUnchanged }\n});\nconst sqliteCharacterVarying = sqlDataType(\"sqlite/character-varying\", {\n\tparams: sqliteCharacterLengthParams,\n\ttexts: [{\n\t\ttext: \"character varying\",\n\t\twritten: true,\n\t\tcatalog: true\n\t}],\n\tread: (json) => readJsonString(\"sqlite/character-varying\", json),\n\tnormalize: withoutLength,\n\tcasts: { [sqliteText.id]: castUnchanged }\n});\n/**\n* The value of `sqlite/datetime` (ADR 254): the text `toISOString()` writes for every row. The range and the millisecond precision are those of a JavaScript `Date`, the codec's value.\n*/\nconst sqliteDatetimeText = (text) => isoDateStringText(text, \"sqlite/datetime\");\n/** What `sqliteDatetimeText` writes for `text`, or `undefined` when it names no instant the type holds. */\nfunction storedDatetime(text) {\n\ttry {\n\t\treturn sqliteDatetimeText(text);\n\t} catch {\n\t\treturn;\n\t}\n}\n/** Reads an instant in any spelling the `datetime` tag reads; `spellDatetime` gives it the one it stores. */\nconst readDatetime = (json) => typeof json === \"string\" && storedDatetime(json) !== void 0 ? json : refuseJsonValue(\"sqlite/datetime\", \"ISO 8601 date and time text with a UTC offset and at most three fraction digits, as in \\\"2024-01-01T00:00:00Z\\\"\", json);\n/** An instant is stored in UTC with three fraction digits. */\nconst spellDatetime = (json) => typeof json === \"string\" ? storedDatetime(json) ?? json : json;\n/** The document JSON text holds, or `undefined` when the text is not JSON. */\nfunction documentOf(text) {\n\ttry {\n\t\treturn { value: JSON.parse(text) };\n\t} catch {\n\t\treturn;\n\t}\n}\n/** Reads the JSON text of a document, in any spelling; `spellJson` gives it the one it stores. */\nconst readJson = (json) => typeof json === \"string\" && documentOf(json) !== void 0 ? json : refuseJsonValue(\"sqlite/json\", \"the JSON text of a document\", json);\n/** A document is stored as its JSON text with sorted keys and no added whitespace. */\nconst spellJson = (json) => {\n\tconst document = typeof json === \"string\" ? documentOf(json) : void 0;\n\treturn document === void 0 ? json : canonicalizeJson(document.value);\n};\n/** An instant, stored as text in the form `toISOString()` writes. */\nconst sqliteDatetime = sqlDataType(\"sqlite/datetime\", {\n\tstoredAs: sqliteText.id,\n\tread: readDatetime,\n\tspell: spellDatetime\n});\n/** A JSON document, stored as its JSON text with sorted keys and no added whitespace. A column declared `JSON` would have numeric affinity and store the document `\"42\"` as the integer 42. */\nconst sqliteJson = sqlDataType(\"sqlite/json\", {\n\tstoredAs: sqliteText.id,\n\tread: readJson,\n\tspell: spellJson\n});\n/** Every data type this target registers. */\nconst sqliteDataTypes = [\n\tsqliteText,\n\tsqliteInteger,\n\tsqliteReal,\n\tsqliteBlob,\n\tsqliteCharacter,\n\tsqliteCharacterVarying,\n\tsqliteDatetime,\n\tsqliteJson,\n\tsqlRawDataType\n];\n/** SQLite's text data types: `text`, `character(n)` and `character varying(n)`. */\nconst sqliteTextDataTypes = [\n\tsqliteText.id,\n\tsqliteCharacter.id,\n\tsqliteCharacterVarying.id\n];\n//#endregion\nexport { sqliteCharacterVarying as a, sqliteDatetimeText as c, sqliteReal as d, sqliteText as f, sqliteCharacterLengthParams as i, sqliteInteger as l, sqliteBlobFromHexText as n, sqliteDataTypes as o, sqliteTextDataTypes as p, sqliteCharacter as r, sqliteDatetime as s, sqliteBlob as t, sqliteJson as u };\n\n//# sourceMappingURL=data-types-coQrCWfS.mjs.map"],"mappings":";;;;;;;AAOA,MAAM,UAAU,UAAU,OAAO,UAAU,WAAW,OAAO,KAAK,IAAI,iBAAiB,OAAO,YAAY;;AAE1G,MAA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v-.mjs
|
|
2
|
+
/** The `strftime` format for the text `encodeSqliteDatetime` writes. */
|
|
3
|
+
const SQLITE_DATETIME_TEXT_FORMAT = "%Y-%m-%dT%H:%M:%fZ";
|
|
4
|
+
/** The SQLite expression for the current instant, as the text `encodeSqliteDatetime` writes. */
|
|
5
|
+
const SQLITE_NOW_EXPRESSION = `strftime('${SQLITE_DATETIME_TEXT_FORMAT}','now')`;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { SQLITE_NOW_EXPRESSION as n, SQLITE_DATETIME_TEXT_FORMAT as t };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=datetime-text-Bniwehv--BSQhnrdE.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datetime-text-Bniwehv--BSQhnrdE.mjs","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/datetime-text-Bniwehv-.mjs"],"sourcesContent":["//#region src/core/datetime-text.ts\n/** The `strftime` format for the text `encodeSqliteDatetime` writes. */\nconst SQLITE_DATETIME_TEXT_FORMAT = \"%Y-%m-%dT%H:%M:%fZ\";\n/** The SQLite expression for the current instant, as the text `encodeSqliteDatetime` writes. */\nconst SQLITE_NOW_EXPRESSION = `strftime('${SQLITE_DATETIME_TEXT_FORMAT}','now')`;\n//#endregion\nexport { SQLITE_NOW_EXPRESSION as n, SQLITE_DATETIME_TEXT_FORMAT as t };\n\n//# sourceMappingURL=datetime-text-Bniwehv-.mjs.map"],"mappings":";;AAEA,MAAM,8BAA8B;;AAEpC,MAAM,wBAAwB,aAAa,4BAA4B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./nodes-D8EC1yCx-BS-fKla6.mjs";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as SQLITE_TEXT_CODEC_ID } from "./codec-ids-
|
|
2
|
-
import { t as SqliteCreateTable } from "./nodes-DUZSdX86-
|
|
1
|
+
import { c as SQLITE_TEXT_CODEC_ID } from "./codec-ids-wgEvkCkg-WltuexMR.mjs";
|
|
2
|
+
import { t as SqliteCreateTable } from "./nodes-DUZSdX86-DWyLY3OW.mjs";
|
|
3
3
|
import { FunctionSource } from "@prisma/orm-family-sql/relational-core/ast";
|
|
4
4
|
import { cfExpr, cfTable, exprSelect } from "@prisma/orm-family-sql/relational-core/contract-free";
|
|
5
|
-
//#region ../../../3-targets/
|
|
5
|
+
//#region ../../../3-targets/sqlite/1-target/dist/ddl-CX4tAZ-y.mjs
|
|
6
6
|
/**
|
|
7
7
|
* Typed builder for the migration planner's column-existence checks. Produces
|
|
8
8
|
* `SELECT COUNT(*) {=|>} 0 AS "result" FROM pragma_table_info(?) WHERE "name" = ?`
|
|
@@ -18,6 +18,25 @@ function columnExistsAst(table, column) {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
+
* Typed builder for the check that no column of the table has a name SQLite takes for `column`.
|
|
22
|
+
* Produces `SELECT COUNT(*) = 0 AS "result" FROM pragma_table_info(?) WHERE "name" COLLATE NOCASE
|
|
23
|
+
* = ?`: SQLite compares column names without regard to the case of ASCII letters, as `NOCASE`
|
|
24
|
+
* does.
|
|
25
|
+
*/
|
|
26
|
+
function columnNameTakenAst(table, column) {
|
|
27
|
+
const source = FunctionSource.of("pragma_table_info", [cfExpr.param(table, SQLITE_TEXT_CODEC_ID).ast]);
|
|
28
|
+
const where = cfExpr.fn({
|
|
29
|
+
method: "collateNocase",
|
|
30
|
+
template: "{{self}} COLLATE NOCASE",
|
|
31
|
+
self: cfExpr.identifierRef("name"),
|
|
32
|
+
returns: {
|
|
33
|
+
codecId: SQLITE_TEXT_CODEC_ID,
|
|
34
|
+
nullable: false
|
|
35
|
+
}
|
|
36
|
+
}).eqParam(column, SQLITE_TEXT_CODEC_ID);
|
|
37
|
+
return { nameFree: () => exprSelect().from(source).project("result", cfExpr.countStar().eqLit(0)).where(where).build() };
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
21
40
|
* Typed builder for table-existence checks over `sqlite_master`.
|
|
22
41
|
* Produces `SELECT COUNT(*) {=|>} 0 AS "result" FROM "sqlite_master" WHERE "type" = ? AND "name" = ?`
|
|
23
42
|
* with the table name and the literal `'table'` bound as text parameters.
|
|
@@ -31,6 +50,24 @@ function tableExistsAst(tableName) {
|
|
|
31
50
|
};
|
|
32
51
|
}
|
|
33
52
|
/**
|
|
53
|
+
* Typed builder for the check that no table, index or view has a name SQLite takes for `name`.
|
|
54
|
+
* Produces `SELECT COUNT(*) = 0 AS "result" FROM "sqlite_master" WHERE "name" COLLATE NOCASE = ?`:
|
|
55
|
+
* tables, indexes and views share one set of names, which SQLite compares without regard to the
|
|
56
|
+
* case of ASCII letters.
|
|
57
|
+
*/
|
|
58
|
+
function tableNameTakenAst(tableName) {
|
|
59
|
+
const where = cfExpr.fn({
|
|
60
|
+
method: "collateNocase",
|
|
61
|
+
template: "{{self}} COLLATE NOCASE",
|
|
62
|
+
self: cfExpr.identifierRef("name"),
|
|
63
|
+
returns: {
|
|
64
|
+
codecId: SQLITE_TEXT_CODEC_ID,
|
|
65
|
+
nullable: false
|
|
66
|
+
}
|
|
67
|
+
}).eqParam(tableName, SQLITE_TEXT_CODEC_ID);
|
|
68
|
+
return { nameFree: () => exprSelect().from(cfTable("sqlite_master")).project("result", cfExpr.countStar().eqLit(0)).where(where).build() };
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
34
71
|
* Typed builder for index-existence checks over `sqlite_master`.
|
|
35
72
|
* Produces `SELECT COUNT(*) {=|>} 0 AS "result" FROM "sqlite_master" WHERE "type" = ? AND "name" = ?`
|
|
36
73
|
* with the index name and the literal `'index'` bound as text parameters.
|
|
@@ -61,6 +98,6 @@ function createTable(options) {
|
|
|
61
98
|
return new SqliteCreateTable(options);
|
|
62
99
|
}
|
|
63
100
|
//#endregion
|
|
64
|
-
export { tableExistsAst as i,
|
|
101
|
+
export { tableExistsAst as a, indexExistsAst as i, columnNameTakenAst as n, tableNameTakenAst as o, createTable as r, columnExistsAst as t };
|
|
65
102
|
|
|
66
|
-
//# sourceMappingURL=ddl-
|
|
103
|
+
//# sourceMappingURL=ddl-CX4tAZ-y-Bng-4PWC.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ddl-CX4tAZ-y-Bng-4PWC.mjs","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/ddl-CX4tAZ-y.mjs"],"sourcesContent":["import { c as SQLITE_TEXT_CODEC_ID } from \"./codec-ids-wgEvkCkg.mjs\";\nimport { t as SqliteCreateTable } from \"./nodes-DUZSdX86.mjs\";\nimport { FunctionSource } from \"@internal/sql-relational-core/ast\";\nimport { cfExpr, cfTable, exprSelect } from \"@internal/sql-relational-core/contract-free\";\n//#region src/contract-free/checks.ts\n/**\n* Typed builder for the migration planner's column-existence checks. Produces\n* `SELECT COUNT(*) {=|>} 0 AS \"result\" FROM pragma_table_info(?) WHERE \"name\" = ?`\n* ASTs with the table and column names bound as text parameters — never\n* inlined into the SQL.\n*/\nfunction columnExistsAst(table, column) {\n\tconst source = FunctionSource.of(\"pragma_table_info\", [cfExpr.param(table, SQLITE_TEXT_CODEC_ID).ast]);\n\tconst where = cfExpr.identifierRef(\"name\").eqParam(column, SQLITE_TEXT_CODEC_ID);\n\treturn {\n\t\tcolumnAbsent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build(),\n\t\tcolumnPresent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().gtLit(0)).where(where).build()\n\t};\n}\n/**\n* Typed builder for the check that no column of the table has a name SQLite takes for `column`.\n* Produces `SELECT COUNT(*) = 0 AS \"result\" FROM pragma_table_info(?) WHERE \"name\" COLLATE NOCASE\n* = ?`: SQLite compares column names without regard to the case of ASCII letters, as `NOCASE`\n* does.\n*/\nfunction columnNameTakenAst(table, column) {\n\tconst source = FunctionSource.of(\"pragma_table_info\", [cfExpr.param(table, SQLITE_TEXT_CODEC_ID).ast]);\n\tconst where = cfExpr.fn({\n\t\tmethod: \"collateNocase\",\n\t\ttemplate: \"{{self}} COLLATE NOCASE\",\n\t\tself: cfExpr.identifierRef(\"name\"),\n\t\treturns: {\n\t\t\tcodecId: SQLITE_TEXT_CODEC_ID,\n\t\t\tnullable: false\n\t\t}\n\t}).eqParam(column, SQLITE_TEXT_CODEC_ID);\n\treturn { nameFree: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build() };\n}\n/**\n* Typed builder for table-existence checks over `sqlite_master`.\n* Produces `SELECT COUNT(*) {=|>} 0 AS \"result\" FROM \"sqlite_master\" WHERE \"type\" = ? AND \"name\" = ?`\n* with the table name and the literal `'table'` bound as text parameters.\n*/\nfunction tableExistsAst(tableName) {\n\tconst source = cfTable(\"sqlite_master\");\n\tconst where = cfExpr.allOf([cfExpr.identifierRef(\"type\").eqParam(\"table\", SQLITE_TEXT_CODEC_ID), cfExpr.identifierRef(\"name\").eqParam(tableName, SQLITE_TEXT_CODEC_ID)]);\n\treturn {\n\t\ttableAbsent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build(),\n\t\ttablePresent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().gtLit(0)).where(where).build()\n\t};\n}\n/**\n* Typed builder for the check that no table, index or view has a name SQLite takes for `name`.\n* Produces `SELECT COUNT(*) = 0 AS \"result\" FROM \"sqlite_master\" WHERE \"name\" COLLATE NOCASE = ?`:\n* tables, indexes and views share one set of names, which SQLite compares without regard to the\n* case of ASCII letters.\n*/\nfunction tableNameTakenAst(tableName) {\n\tconst where = cfExpr.fn({\n\t\tmethod: \"collateNocase\",\n\t\ttemplate: \"{{self}} COLLATE NOCASE\",\n\t\tself: cfExpr.identifierRef(\"name\"),\n\t\treturns: {\n\t\t\tcodecId: SQLITE_TEXT_CODEC_ID,\n\t\t\tnullable: false\n\t\t}\n\t}).eqParam(tableName, SQLITE_TEXT_CODEC_ID);\n\treturn { nameFree: () => exprSelect().from(cfTable(\"sqlite_master\")).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build() };\n}\n/**\n* Typed builder for index-existence checks over `sqlite_master`.\n* Produces `SELECT COUNT(*) {=|>} 0 AS \"result\" FROM \"sqlite_master\" WHERE \"type\" = ? AND \"name\" = ?`\n* with the index name and the literal `'index'` bound as text parameters.\n*/\nfunction indexExistsAst(indexName) {\n\tconst source = cfTable(\"sqlite_master\");\n\tconst where = cfExpr.allOf([cfExpr.identifierRef(\"type\").eqParam(\"index\", SQLITE_TEXT_CODEC_ID), cfExpr.identifierRef(\"name\").eqParam(indexName, SQLITE_TEXT_CODEC_ID)]);\n\treturn {\n\t\tindexAbsent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build(),\n\t\tindexPresent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().gtLit(0)).where(where).build()\n\t};\n}\n//#endregion\n//#region src/contract-free/ddl.ts\n/**\n* Build a SQLite `CREATE TABLE` query node.\n*\n* Pass `constraints` for table-level composite primary keys, foreign keys, and\n* unique constraints — use the {@link PrimaryKeyConstraint}, {@link ForeignKeyConstraint},\n* and {@link UniqueConstraint} classes from `@internal/sql-relational-core/ast`.\n*\n* Precondition: identifiers (`table`, column names/types) are emitted to SQL\n* verbatim — they are not quoted or escaped, so callers must pass pre-trusted\n* values (e.g. fixed control-plane identifiers). String-literal default values,\n* by contrast, are single-quote-escaped (embedded `'` doubled) by the renderer.\n* Identifier quoting for untrusted identifiers is added when the migration\n* planner adopts this lowering path.\n*/\nfunction createTable(options) {\n\treturn new SqliteCreateTable(options);\n}\n//#endregion\nexport { tableExistsAst as a, indexExistsAst as i, columnExistsAst as n, tableNameTakenAst as o, columnNameTakenAst as r, createTable as t };\n\n//# sourceMappingURL=ddl-CX4tAZ-y.mjs.map"],"mappings":";;;;;;;;;;;AAWA,SAAS,gBAAgB,OAAO,QAAQ;CACvC,MAAM,SAAS,eAAe,GAAG,qBAAqB,CAAC,OAAO,MAAM,OAAO,oBAAoB,CAAC,CAAC,GAAG,CA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ACrC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DefaultResolverColumn, ReportedLiteralDefault } from "@prisma/orm-family-sql/family/control";
|
|
2
|
+
import { ColumnDefault } from "@prisma/orm-framework/contract/types";
|
|
3
|
+
//#region ../../../3-targets/sqlite/1-target/dist/default-normalizer.d.mts
|
|
4
|
+
//#region src/core/default-normalizer.d.ts
|
|
5
|
+
/** What a column's reported default is: a function, SQL NULL, or a literal the column's codec reads. */
|
|
6
|
+
type SqliteReportedDefault = {
|
|
7
|
+
readonly kind: 'function';
|
|
8
|
+
readonly expression: string;
|
|
9
|
+
} | {
|
|
10
|
+
readonly kind: 'null';
|
|
11
|
+
} | {
|
|
12
|
+
readonly kind: 'literal';
|
|
13
|
+
readonly literal: ReportedLiteralDefault;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Reads a column's reported default. `CURRENT_TIMESTAMP`, `datetime('now')` and the expression a `now()` default is written as are `now()`. A quoted string, a numeral or a blob literal (`X'6869'`, read as its bytes) is a literal; any other expression is a function default, kept as reported.
|
|
17
|
+
*/
|
|
18
|
+
declare function readSqliteDefault(rawDefault: string, declaredType: string): SqliteReportedDefault;
|
|
19
|
+
/**
|
|
20
|
+
* Names a contract's expression default the way {@link readSqliteDefault} names the same function in the database, so `` sql`CURRENT_TIMESTAMP` `` and the database's `datetime('now')` compare equal. A literal default, and an expression that writes a literal, pass through unchanged; introspection reads the latter's literal with the column's codec, and the diff compares the values.
|
|
21
|
+
*/
|
|
22
|
+
declare function sqliteResolveDefault(def: ColumnDefault, column: DefaultResolverColumn): ColumnDefault;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { readSqliteDefault as n, sqliteResolveDefault as r, SqliteReportedDefault as t };
|
|
25
|
+
//# sourceMappingURL=default-normalizer-CkHy3JYk.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-normalizer-CkHy3JYk.d.mts","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/default-normalizer.d.mts"],"mappings":";;;;;KAIK;WACM;WACA;;WAEA;;WAEA;WACA,SAAS;;;;;iBAKH,kBAAkB,oBAAoB,uBAAuB;;;;iBAI7D,qBAAqB,KAAK,eAAe,QAAQ,wBAAwB"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { t as SQLITE_DATETIME_TEXT_FORMAT } from "./datetime-text-Bniwehv--BSQhnrdE.mjs";
|
|
2
|
+
//#region ../../../3-targets/sqlite/1-target/dist/default-normalizer-DGMXypHg.mjs
|
|
3
|
+
const NULL_PATTERN = /^NULL$/i;
|
|
4
|
+
const INTEGER_PATTERN = /^[+-]?\d+$/;
|
|
5
|
+
const REAL_PATTERN = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;
|
|
6
|
+
const STRING_LITERAL_PATTERN = /^'((?:[^']|'')*)'$/;
|
|
7
|
+
const STRFTIME_NOW_PATTERN = /^strftime\s*\(\s*(['"])([^'"]*)\1\s*,\s*(['"])now\3\s*\)$/i;
|
|
8
|
+
function isCurrentTimestamp(expression) {
|
|
9
|
+
const lower = expression.toLowerCase();
|
|
10
|
+
if (lower === "current_timestamp" || lower === "datetime('now')" || lower === "datetime(\"now\")") return true;
|
|
11
|
+
return expression.match(STRFTIME_NOW_PATTERN)?.[2] === SQLITE_DATETIME_TEXT_FORMAT;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Strips a single matched wrapping pair of outer parens from `s`. Conservative:
|
|
15
|
+
* only strips when the leading `(` is matched by the trailing `)` (so
|
|
16
|
+
* `(a) + (b)` is returned unchanged). Mirrors SQLite's own
|
|
17
|
+
* `pragma_table_info.dflt_value` normalization for expression defaults, and
|
|
18
|
+
* is shared with the recreate-table postcheck builder so both sides agree
|
|
19
|
+
* on the text.
|
|
20
|
+
*/
|
|
21
|
+
function stripOuterParens(s) {
|
|
22
|
+
if (!s.startsWith("(") || !s.endsWith(")")) return s;
|
|
23
|
+
let depth = 0;
|
|
24
|
+
for (let i = 0; i < s.length; i++) if (s[i] === "(") depth += 1;
|
|
25
|
+
else if (s[i] === ")") {
|
|
26
|
+
depth -= 1;
|
|
27
|
+
if (depth === 0 && i < s.length - 1) return s;
|
|
28
|
+
}
|
|
29
|
+
return s.slice(1, -1);
|
|
30
|
+
}
|
|
31
|
+
/** The type affinity SQLite gives a column of `declaredType`, by its rules in order. */
|
|
32
|
+
function affinityOf(declaredType) {
|
|
33
|
+
const upper = declaredType.toUpperCase();
|
|
34
|
+
if (upper.includes("INT")) return "integer";
|
|
35
|
+
if (upper.includes("CHAR") || upper.includes("CLOB") || upper.includes("TEXT")) return "text";
|
|
36
|
+
if (upper.includes("BLOB") || upper.trim() === "") return "blob";
|
|
37
|
+
if (upper.includes("REAL") || upper.includes("FLOA") || upper.includes("DOUB")) return "real";
|
|
38
|
+
return "numeric";
|
|
39
|
+
}
|
|
40
|
+
/** A numeral as the driver returns it: a number, or digit text for an integer no double holds exactly. */
|
|
41
|
+
function numberBody(numeral) {
|
|
42
|
+
if (INTEGER_PATTERN.test(numeral)) {
|
|
43
|
+
const integer = BigInt(numeral);
|
|
44
|
+
return Number.isSafeInteger(Number(integer)) ? Number(integer) : integer.toString();
|
|
45
|
+
}
|
|
46
|
+
return Number(numeral);
|
|
47
|
+
}
|
|
48
|
+
/** What the column stores for a literal written as `text` (quoted) or as a numeral, by its affinity. */
|
|
49
|
+
function bodyFor(literal, quoted, affinity) {
|
|
50
|
+
const numeral = INTEGER_PATTERN.test(literal) || REAL_PATTERN.test(literal);
|
|
51
|
+
if (affinity === "text") return literal;
|
|
52
|
+
if (affinity === "blob") return quoted || !numeral ? literal : numberBody(literal);
|
|
53
|
+
return numeral ? numberBody(literal) : literal;
|
|
54
|
+
}
|
|
55
|
+
/** A blob literal: `X'` or `x'`, an even number of hexadecimal digits, `'`. */
|
|
56
|
+
const BLOB_LITERAL_PATTERN = /^[xX]'((?:[0-9a-fA-F]{2})*)'$/;
|
|
57
|
+
/**
|
|
58
|
+
* Reads a column's reported default. `CURRENT_TIMESTAMP`, `datetime('now')` and the expression a `now()` default is written as are `now()`. A quoted string, a numeral or a blob literal (`X'6869'`, read as its bytes) is a literal; any other expression is a function default, kept as reported.
|
|
59
|
+
*/
|
|
60
|
+
function readSqliteDefault(rawDefault, declaredType) {
|
|
61
|
+
let trimmed = rawDefault.trim();
|
|
62
|
+
while (true) {
|
|
63
|
+
const stripped = stripOuterParens(trimmed).trim();
|
|
64
|
+
if (stripped === trimmed) break;
|
|
65
|
+
trimmed = stripped;
|
|
66
|
+
}
|
|
67
|
+
if (isCurrentTimestamp(trimmed)) return {
|
|
68
|
+
kind: "function",
|
|
69
|
+
expression: "now()"
|
|
70
|
+
};
|
|
71
|
+
if (NULL_PATTERN.test(trimmed)) return { kind: "null" };
|
|
72
|
+
const affinity = affinityOf(declaredType);
|
|
73
|
+
const quoted = STRING_LITERAL_PATTERN.exec(trimmed)?.[1];
|
|
74
|
+
if (quoted !== void 0) return {
|
|
75
|
+
kind: "literal",
|
|
76
|
+
literal: {
|
|
77
|
+
kind: "value",
|
|
78
|
+
body: bodyFor(quoted.replace(/''/g, "'"), true, affinity)
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const blobHex = BLOB_LITERAL_PATTERN.exec(trimmed)?.[1];
|
|
82
|
+
if (blobHex !== void 0) return {
|
|
83
|
+
kind: "literal",
|
|
84
|
+
literal: {
|
|
85
|
+
kind: "value",
|
|
86
|
+
body: new Uint8Array(Buffer.from(blobHex, "hex"))
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
if (INTEGER_PATTERN.test(trimmed) || REAL_PATTERN.test(trimmed)) return {
|
|
90
|
+
kind: "literal",
|
|
91
|
+
literal: {
|
|
92
|
+
kind: "value",
|
|
93
|
+
body: bodyFor(trimmed, false, affinity)
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
return {
|
|
97
|
+
kind: "function",
|
|
98
|
+
expression: trimmed
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Names a contract's expression default the way {@link readSqliteDefault} names the same function in the database, so `` sql`CURRENT_TIMESTAMP` `` and the database's `datetime('now')` compare equal. A literal default, and an expression that writes a literal, pass through unchanged; introspection reads the latter's literal with the column's codec, and the diff compares the values.
|
|
103
|
+
*/
|
|
104
|
+
function sqliteResolveDefault(def, column) {
|
|
105
|
+
if (def.kind !== "function") return def;
|
|
106
|
+
const read = readSqliteDefault(def.expression, column.typeText);
|
|
107
|
+
return read.kind === "function" ? read : def;
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
export { sqliteResolveDefault as n, stripOuterParens as r, readSqliteDefault as t };
|
|
111
|
+
|
|
112
|
+
//# sourceMappingURL=default-normalizer-DGMXypHg-CPf7oyZA.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-normalizer-DGMXypHg-CPf7oyZA.mjs","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/default-normalizer-DGMXypHg.mjs"],"sourcesContent":["import { t as SQLITE_DATETIME_TEXT_FORMAT } from \"./datetime-text-Bniwehv-.mjs\";\n//#region src/core/default-normalizer.ts\nconst NULL_PATTERN = /^NULL$/i;\nconst INTEGER_PATTERN = /^[+-]?\\d+$/;\nconst REAL_PATTERN = /^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?$/;\nconst STRING_LITERAL_PATTERN = /^'((?:[^']|'')*)'$/;\nconst STRFTIME_NOW_PATTERN = /^strftime\\s*\\(\\s*(['\"])([^'\"]*)\\1\\s*,\\s*(['\"])now\\3\\s*\\)$/i;\nfunction isCurrentTimestamp(expression) {\n\tconst lower = expression.toLowerCase();\n\tif (lower === \"current_timestamp\" || lower === \"datetime('now')\" || lower === \"datetime(\\\"now\\\")\") return true;\n\treturn expression.match(STRFTIME_NOW_PATTERN)?.[2] === SQLITE_DATETIME_TEXT_FORMAT;\n}\n/**\n* Strips a single matched wrapping pair of outer parens from `s`. Conservative:\n* only strips when the leading `(` is matched by the trailing `)` (so\n* `(a) + (b)` is returned unchanged). Mirrors SQLite's own\n* `pragma_table_info.dflt_value` normalization for expression defaults, and\n* is shared with the recreate-table postcheck builder so both sides agree\n* on the text.\n*/\nfunction stripOuterParens(s) {\n\tif (!s.startsWith(\"(\") || !s.endsWith(\")\")) return s;\n\tlet depth = 0;\n\tfor (let i = 0; i < s.length; i++) if (s[i] === \"(\") depth += 1;\n\telse if (s[i] === \")\") {\n\t\tdepth -= 1;\n\t\tif (depth === 0 && i < s.length - 1) return s;\n\t}\n\treturn s.slice(1, -1);\n}\n/** The type affinity SQLite gives a column of `declaredType`, by its rules in order. */\nfunction affinityOf(declaredType) {\n\tconst upper = declaredType.toUpperCase();\n\tif (upper.includes(\"INT\")) return \"integer\";\n\tif (upper.includes(\"CHAR\") || upper.includes(\"CLOB\") || upper.includes(\"TEXT\")) return \"text\";\n\tif (upper.includes(\"BLOB\") || upper.trim() === \"\") return \"blob\";\n\tif (upper.includes(\"REAL\") || upper.includes(\"FLOA\") || upper.includes(\"DOUB\")) return \"real\";\n\treturn \"numeric\";\n}\n/** A numeral as the driver returns it: a number, or digit text for an integer no double holds exactly. */\nfunction numberBody(numeral) {\n\tif (INTEGER_PATTERN.test(numeral)) {\n\t\tconst integer = BigInt(numeral);\n\t\treturn Number.isSafeInteger(Number(integer)) ? Number(integer) : integer.toString();\n\t}\n\treturn Number(numeral);\n}\n/** What the column stores for a literal written as `text` (quoted) or as a numeral, by its affinity. */\nfunction bodyFor(literal, quoted, affinity) {\n\tconst numeral = INTEGER_PATTERN.test(literal) || REAL_PATTERN.test(literal);\n\tif (affinity === \"text\") return literal;\n\tif (affinity === \"blob\") return quoted || !numeral ? literal : numberBody(literal);\n\treturn numeral ? numberBody(literal) : literal;\n}\n/** A blob literal: `X'` or `x'`, an even number of hexadecimal digits, `'`. */\nconst BLOB_LITERAL_PATTERN = /^[xX]'((?:[0-9a-fA-F]{2})*)'$/;\n/**\n* Reads a column's reported default. `CURRENT_TIMESTAMP`, `datetime('now')` and the expression a `now()` default is written as are `now()`. A quoted string, a numeral or a blob literal (`X'6869'`, read as its bytes) is a literal; any other expression is a function default, kept as reported.\n*/\nfunction readSqliteDefault(rawDefault, declaredType) {\n\tlet trimmed = rawDefault.trim();\n\twhile (true) {\n\t\tconst stripped = stripOuterParens(trimmed).trim();\n\t\tif (stripped === trimmed) break;\n\t\ttrimmed = stripped;\n\t}\n\tif (isCurrentTimestamp(trimmed)) return {\n\t\tkind: \"function\",\n\t\texpression: \"now()\"\n\t};\n\tif (NULL_PATTERN.test(trimmed)) return { kind: \"null\" };\n\tconst affinity = affinityOf(declaredType);\n\tconst quoted = STRING_LITERAL_PATTERN.exec(trimmed)?.[1];\n\tif (quoted !== void 0) return {\n\t\tkind: \"literal\",\n\t\tliteral: {\n\t\t\tkind: \"value\",\n\t\t\tbody: bodyFor(quoted.replace(/''/g, \"'\"), true, affinity)\n\t\t}\n\t};\n\tconst blobHex = BLOB_LITERAL_PATTERN.exec(trimmed)?.[1];\n\tif (blobHex !== void 0) return {\n\t\tkind: \"literal\",\n\t\tliteral: {\n\t\t\tkind: \"value\",\n\t\t\tbody: new Uint8Array(Buffer.from(blobHex, \"hex\"))\n\t\t}\n\t};\n\tif (INTEGER_PATTERN.test(trimmed) || REAL_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tliteral: {\n\t\t\tkind: \"value\",\n\t\t\tbody: bodyFor(trimmed, false, affinity)\n\t\t}\n\t};\n\treturn {\n\t\tkind: \"function\",\n\t\texpression: trimmed\n\t};\n}\n/**\n* Names a contract's expression default the way {@link readSqliteDefault} names the same function in the database, so `` sql`CURRENT_TIMESTAMP` `` and the database's `datetime('now')` compare equal. A literal default, and an expression that writes a literal, pass through unchanged; introspection reads the latter's literal with the column's codec, and the diff compares the values.\n*/\nfunction sqliteResolveDefault(def, column) {\n\tif (def.kind !== \"function\") return def;\n\tconst read = readSqliteDefault(def.expression, column.typeText);\n\treturn read.kind === \"function\" ? read : def;\n}\n//#endregion\nexport { sqliteResolveDefault as n, stripOuterParens as r, readSqliteDefault as t };\n\n//# sourceMappingURL=default-normalizer-DGMXypHg.mjs.map"],"mappings":";;AAEA,MAAM,eAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,eAAe;AACrB,MAAM,yBAAyB;AAC/B,MAAM,uBAAuB;AAC7B,SAAS,mBAAmB,YAAY;CACvC,MAAM,QAAQ,WAAW,YAAY;CACrC,IAAI,UAAU,uBAAuB,UAAU,qBAAqB,UAAU,qBAAqB,OAAO;CAC1G,OAAO,WAAW,MAAM,oBAAoB,CAAC,GAAG,OAAO;AACxD;;;;;;;;;AASA,SAAS,iBAAiB,GAAG;CAC5B,IAAI,CAAC,EAAE,WAAW,GAAG,KAAK,CAAC,EAAE,SAAS,GAAG,GAAG,OAAO;CACnD,IAAI,QAAQ;CACZ,KAAK,IAAI,IAAI,GAAG,IAAI,EAAE,QAAQ,KAAK,IAAI,EAAE,OAAO,KAAK,SAAS;MACzD,IAAI,EAAE,OAAO,KAAK;EACtB,SAAS;EACT,IAAI,UAAU,KAAK,IAAI,EAAE,SAAS,GAAG,OAAO;CAC7C;CACA,OAAO,EAAE,MAAM,GAAG,EAAE;AACrB;;AAEA,SAAS,WAAW,cAAc;CACjC,MAAM,QAAQ,aAAa,YAAY;CACvC,IAAI,MAAM,SAAS,KAAK,GAAG,OAAO;CAClC,IAAI,MAAM,SAAS,MAAM,KAAK,MAAM,SAAS,MAAM,KAAK,MAAM,SAAS,MAAM,GAAG,OAAO;CACvF,IAAI,MAAM,SAAS,MAAM,KAAK,MAAM,KAAK,MAAM,IAAI,OAAO;CAC1D,IAAI,MAAM,SAAS,MAAM,KAAK,MAAM,SAAS,MAAM,KAAK,MAAM,SAAS,MAAM,GAAG,OAAO;CACvF,OAAO;AACR;;AAEA,SAAS,WAAW,SAAS;CAC5B,IAAI,gBAAgB,KAAK,OAAO,GAAG;EAClC,M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