@prisma/orm-target-postgres 8.0.0-rc.18-dev.15 → 8.0.0-rc.18-dev.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adapter-HQtZIZ2r-kQG81kJ1.mjs → adapter-C2XsLnXe-DLYvtWWr.mjs} +6 -6
- package/dist/{adapter-HQtZIZ2r-kQG81kJ1.mjs.map → adapter-C2XsLnXe-DLYvtWWr.mjs.map} +1 -1
- package/dist/{adapter-BiuJIKUc.d.mts → adapter-N4hlaZy6.d.mts} +5 -5
- package/dist/{adapter-BiuJIKUc.d.mts.map → adapter-N4hlaZy6.d.mts.map} +1 -1
- package/dist/adapter.d.mts +8 -9
- package/dist/adapter.mjs +5 -6
- package/dist/adapter__adapter.d.mts +1 -1
- package/dist/adapter__adapter.mjs +2 -2
- package/dist/adapter__control.d.mts +3 -4
- package/dist/adapter__control.mjs +6 -7
- package/dist/adapter__control.mjs.map +1 -1
- package/dist/adapter__runtime.d.mts +1 -1
- package/dist/adapter__runtime.mjs +4 -4
- package/dist/adapter__runtime.mjs.map +1 -1
- package/dist/adapter__sql-renderer.d.mts +1 -1
- package/dist/adapter__sql-renderer.mjs +1 -1
- package/dist/adapter__types.d.mts +3 -3
- package/dist/{aggregates-BNxcV7HS.d.mts → aggregates-BgI1xxMl.d.mts} +3 -3
- package/dist/{aggregates-BNxcV7HS.d.mts.map → aggregates-BgI1xxMl.d.mts.map} +1 -1
- package/dist/{aggregates-Brwk0sYS.mjs → aggregates-DHIDeR2f.mjs} +3 -3
- package/dist/{aggregates-Brwk0sYS.mjs.map → aggregates-DHIDeR2f.mjs.map} +1 -1
- package/dist/{authoring-BPkERq95-SR5fDsa_.mjs → authoring-DAorKc0L-DpWukVxn.mjs} +8 -8
- package/dist/authoring-DAorKc0L-DpWukVxn.mjs.map +1 -0
- package/dist/{autoincrement-widths-D_WhWVXx-D6BupdY2.mjs → autoincrement-widths-BLCRgB3t-BWl20PCZ.mjs} +3 -3
- package/dist/{autoincrement-widths-D_WhWVXx-D6BupdY2.mjs.map → autoincrement-widths-BLCRgB3t-BWl20PCZ.mjs.map} +1 -1
- package/dist/codec-descriptor-BlMs1rkg.d.mts +1 -0
- package/dist/{codec-descriptor-DkeVTJ3N-XTfZgDGp.d.mts → codec-descriptor-Cbz5bbma-dxeoAwS2.d.mts} +4 -4
- package/dist/codec-descriptor-Cbz5bbma-dxeoAwS2.d.mts.map +1 -0
- package/dist/{codec-descriptor-C5Ec_6Mw-CpacG1CL.mjs → codec-descriptor-DSMjoW72-ZoCcTHLX.mjs} +3 -4
- package/dist/codec-descriptor-DSMjoW72-ZoCcTHLX.mjs.map +1 -0
- package/dist/{codec-registry-DSRFjaLX-Dwg0yBK7.mjs → codec-registry-pg69n-o5-D8K3p40k.mjs} +5 -5
- package/dist/{codec-registry-DSRFjaLX-Dwg0yBK7.mjs.map → codec-registry-pg69n-o5-D8K3p40k.mjs.map} +1 -1
- package/dist/{codec-type-map-BznmYkRz-QD11Yx27.d.mts → codec-type-map-eTeOtvJB-c3tjqXBa.d.mts} +4 -4
- package/dist/{codec-type-map-BznmYkRz-QD11Yx27.d.mts.map → codec-type-map-eTeOtvJB-c3tjqXBa.d.mts.map} +1 -1
- package/dist/{codec-types-BZXuhZ1c-B9YQf_UN.d.mts → codec-types-Cf0IZ0WQ-CMVP-ecb.d.mts} +4 -4
- package/dist/{codec-types-BZXuhZ1c-B9YQf_UN.d.mts.map → codec-types-Cf0IZ0WQ-CMVP-ecb.d.mts.map} +1 -1
- package/dist/codec-types-o-BM2rPP.d.mts +2 -0
- package/dist/{codecs-BChKdFcD.d.mts → codecs-B-8uGsxq.d.mts} +3 -3
- package/dist/{codecs-BChKdFcD.d.mts.map → codecs-B-8uGsxq.d.mts.map} +1 -1
- package/dist/{codecs-CQaKsvhH-X9bscCr9.mjs → codecs-CaWZPjFi-hllqyGdW.mjs} +605 -574
- package/dist/codecs-CaWZPjFi-hllqyGdW.mjs.map +1 -0
- package/dist/{codecs-CCzJelD2-bt89qO8s.d.mts → codecs-DanVXZ_F-D1_8_x3j.d.mts} +150 -169
- package/dist/codecs-DanVXZ_F-D1_8_x3j.d.mts.map +1 -0
- package/dist/{contract-contributions-DC-ACLe5-BtAuL8oB.mjs → contract-contributions-C8XjOBIq-BuK0mnF9.mjs} +55 -40
- package/dist/contract-contributions-C8XjOBIq-BuK0mnF9.mjs.map +1 -0
- package/dist/{control-Bs7Il_Ju.mjs → control--DStfvkM.mjs} +17 -14
- package/dist/control--DStfvkM.mjs.map +1 -0
- package/dist/{control-B0dyj3WB.d.mts → control-Co7_lX4j.d.mts} +2 -11
- package/dist/control-Co7_lX4j.d.mts.map +1 -0
- package/dist/{control-B6nnypMh.d.mts → control-Mc7bM0Ho.d.mts} +4 -14
- package/dist/control-Mc7bM0Ho.d.mts.map +1 -0
- package/dist/{control-policy-CQ8hGDrk-jyie0S2j.mjs → control-policy-DrK_x_Qd-BcT8Z5TM.mjs} +13 -30
- package/dist/control-policy-DrK_x_Qd-BcT8Z5TM.mjs.map +1 -0
- package/dist/{data-type-entries-MxmSzT8p-D8CgbLxS.mjs → data-type-entries-DECnlc43-BYnGiJLy.mjs} +30 -3
- package/dist/data-type-entries-DECnlc43-BYnGiJLy.mjs.map +1 -0
- package/dist/data-types-BIvSDTYw-AK5Is74Z.mjs +961 -0
- package/dist/data-types-BIvSDTYw-AK5Is74Z.mjs.map +1 -0
- package/dist/{data-types-BDkZIUMI.d.mts → data-types-BkFfMhgz.d.mts} +10 -16
- package/dist/{data-types-BDkZIUMI.d.mts.map → data-types-BkFfMhgz.d.mts.map} +1 -1
- package/dist/default-normalizer-BqFHmlox-CP8ywN-r.mjs +313 -0
- package/dist/default-normalizer-BqFHmlox-CP8ywN-r.mjs.map +1 -0
- package/dist/default-normalizer-CTAiFe9Y.d.mts +25 -0
- package/dist/default-normalizer-CTAiFe9Y.d.mts.map +1 -0
- package/dist/{descriptor-meta-CqUL_be_-BkT3aEIm.mjs → descriptor-meta-CNFvhRlG-8_vCDF2W.mjs} +6 -6
- package/dist/{descriptor-meta-CqUL_be_-BkT3aEIm.mjs.map → descriptor-meta-CNFvhRlG-8_vCDF2W.mjs.map} +1 -1
- package/dist/{descriptor-meta-DzC2NwDh-C_D6wtZj.mjs → descriptor-meta-_qLKFkLd-Cb4H-vZf.mjs} +4 -4
- package/dist/{descriptor-meta-DzC2NwDh-C_D6wtZj.mjs.map → descriptor-meta-_qLKFkLd-Cb4H-vZf.mjs.map} +1 -1
- package/dist/{descriptor-meta-runtime-CpGl9XzU-CZHs_TNl.mjs → descriptor-meta-runtime-BKtwKsDm-BirZ12T5.mjs} +3 -3
- package/dist/{descriptor-meta-runtime-CpGl9XzU-CZHs_TNl.mjs.map → descriptor-meta-runtime-BKtwKsDm-BirZ12T5.mjs.map} +1 -1
- package/dist/{diff-database-schema-BKkcK7s--BxbpuwVf.mjs → diff-database-schema-C6fmfclD-Dqn9QqOO.mjs} +4 -4
- package/dist/{diff-database-schema-BKkcK7s--BxbpuwVf.mjs.map → diff-database-schema-C6fmfclD-Dqn9QqOO.mjs.map} +1 -1
- package/dist/{full-text-DzMPXaCj.d.mts → full-text-Ht1M3vH4.d.mts} +3 -3
- package/dist/{full-text-DzMPXaCj.d.mts.map → full-text-Ht1M3vH4.d.mts.map} +1 -1
- package/dist/{full-text-collection-method-B9e_oZFf-dyzLx5i6.d.mts → full-text-collection-method-Dye6N2u5-DGPEZRTD.d.mts} +4 -4
- package/dist/full-text-collection-method-Dye6N2u5-DGPEZRTD.d.mts.map +1 -0
- package/dist/{infer-psl-contract-DgOUfqJq-At4pgf6x.mjs → infer-psl-contract-hJUt-dtW-iwec11iw.mjs} +160 -56
- package/dist/infer-psl-contract-hJUt-dtW-iwec11iw.mjs.map +1 -0
- package/dist/{issue-planner-DDhlcfH2.d.mts → issue-planner-B3E9yChD.d.mts} +2 -2
- package/dist/{issue-planner-DDhlcfH2.d.mts.map → issue-planner-B3E9yChD.d.mts.map} +1 -1
- package/dist/migration-CbOh59ZJ.mjs.map +1 -1
- package/dist/{migration-DdE7N4ne.d.mts → migration-cGzKlTv0.d.mts} +2 -2
- package/dist/{migration-DdE7N4ne.d.mts.map → migration-cGzKlTv0.d.mts.map} +1 -1
- package/dist/{op-factory-call-BCBPUVFr-CW8l_JKw.mjs → op-factory-call-DJz5P0h1-Cs7DC10N.mjs} +4 -4
- package/dist/{op-factory-call-BCBPUVFr-CW8l_JKw.mjs.map → op-factory-call-DJz5P0h1-Cs7DC10N.mjs.map} +1 -1
- package/dist/op-factory-call-uVDKZqw1.d.mts +1 -0
- package/dist/{op-factory-call-COYbR6tp-XukKl6qj.d.mts → op-factory-call-z5TKsamx-DDfPa57U.d.mts} +2 -2
- package/dist/{op-factory-call-COYbR6tp-XukKl6qj.d.mts.map → op-factory-call-z5TKsamx-DDfPa57U.d.mts.map} +1 -1
- package/dist/{operation-types-BAiYtHkM-BN_YTibJ.d.mts → operation-types--RnlMCZS-qXBhNS1Q.d.mts} +3 -3
- package/dist/{operation-types-BAiYtHkM-BN_YTibJ.d.mts.map → operation-types--RnlMCZS-qXBhNS1Q.d.mts.map} +1 -1
- package/dist/operation-types-Dfg-5VmM.d.mts +1 -0
- package/dist/{pack-4sJCj0w-.d.mts → pack-_zBIeh-3.d.mts} +4 -4
- package/dist/{pack-4sJCj0w-.d.mts.map → pack-_zBIeh-3.d.mts.map} +1 -1
- package/dist/{planner-Pcd2R46Y.d.mts → planner-BBGH1cAB.d.mts} +2 -2
- package/dist/{planner-Pcd2R46Y.d.mts.map → planner-BBGH1cAB.d.mts.map} +1 -1
- package/dist/planner-ddl-builders-Byw5BICu.d.mts +16 -0
- package/dist/planner-ddl-builders-Byw5BICu.d.mts.map +1 -0
- package/dist/planner-ddl-builders-D0r6cT4A-D9Wm1myF.mjs +29 -0
- package/dist/planner-ddl-builders-D0r6cT4A-D9Wm1myF.mjs.map +1 -0
- package/dist/{planner-RhYHAxZm-9qT-aXSU.mjs → planner-ewMcuoHd-DwCCA-Kc.mjs} +9 -8
- package/dist/planner-ewMcuoHd-DwCCA-Kc.mjs.map +1 -0
- package/dist/{planner-identity-values-DwvdO5iZ-C9_lmJx6.mjs → planner-identity-values-CWUHmsB9-CBQ00C_3.mjs} +3 -3
- package/dist/{planner-identity-values-DwvdO5iZ-C9_lmJx6.mjs.map → planner-identity-values-CWUHmsB9-CBQ00C_3.mjs.map} +1 -1
- package/dist/planner-produced-postgres-migration-D-ZcNy7h.d.mts +1 -0
- package/dist/{planner-produced-postgres-migration-B3b3MBKL-CxswQFN2.mjs → planner-produced-postgres-migration-Dy5zHiFB-BDpfjZD5.mjs} +4 -4
- package/dist/{planner-produced-postgres-migration-B3b3MBKL-CxswQFN2.mjs.map → planner-produced-postgres-migration-Dy5zHiFB-BDpfjZD5.mjs.map} +1 -1
- package/dist/{planner-produced-postgres-migration-eM7nl_4L-DSW4rLOj.d.mts → planner-produced-postgres-migration-sxhIP3Te-Cn3sD9zE.d.mts} +3 -3
- package/dist/planner-produced-postgres-migration-sxhIP3Te-Cn3sD9zE.d.mts.map +1 -0
- package/dist/{planner-sql-checks-BV2akIx8-l8qCWzYf.mjs → planner-sql-checks-D0w3Kt_G-Bh1Vlz0T.mjs} +5 -5
- package/dist/{planner-sql-checks-BV2akIx8-l8qCWzYf.mjs.map → planner-sql-checks-D0w3Kt_G-Bh1Vlz0T.mjs.map} +1 -1
- package/dist/{postgres-codec-traits-DOTVjmpT-B4f6Rkh7.mjs → postgres-codec-traits-DY-tFVjg-CjMZUKNx.mjs} +3 -3
- package/dist/{postgres-codec-traits-DOTVjmpT-B4f6Rkh7.mjs.map → postgres-codec-traits-DY-tFVjg-CjMZUKNx.mjs.map} +1 -1
- package/dist/{postgres-contract-view-Cei64xbt-BcDzLVah.mjs → postgres-contract-view-o6bwzfH6-D4jvq9PJ.mjs} +6 -6
- package/dist/{postgres-contract-view-Cei64xbt-BcDzLVah.mjs.map → postgres-contract-view-o6bwzfH6-D4jvq9PJ.mjs.map} +1 -1
- package/dist/{postgres-migration-D0TY1HnO-CXuyvNiq.d.mts → postgres-migration-D6_R3__I-rFg_i2gz.d.mts} +2 -2
- package/dist/{postgres-migration-D0TY1HnO-CXuyvNiq.d.mts.map → postgres-migration-D6_R3__I-rFg_i2gz.d.mts.map} +1 -1
- package/dist/{postgres-migration-Bj3MPD7z-Clk_A5s-.mjs → postgres-migration-Dtkb6eDn-CrButm3l.mjs} +14 -22
- package/dist/postgres-migration-Dtkb6eDn-CrButm3l.mjs.map +1 -0
- package/dist/{prisma7-binding-BwBQ58iZ.mjs → prisma7-binding-BsucflfD.mjs} +106 -87
- package/dist/prisma7-binding-BsucflfD.mjs.map +1 -0
- package/dist/{prisma7-binding-LcYpTBjP.d.mts → prisma7-binding-DGp7Ea38.d.mts} +24 -15
- package/dist/prisma7-binding-DGp7Ea38.d.mts.map +1 -0
- package/dist/{render-ops-TAy4wxZ8-FnL41Aq3.mjs → render-ops-Db7MhDM0-DsIQjmcY.mjs} +3 -3
- package/dist/{render-ops-TAy4wxZ8-FnL41Aq3.mjs.map → render-ops-Db7MhDM0-DsIQjmcY.mjs.map} +1 -1
- package/dist/{runtime-CNTEAZIz.d.mts → runtime-CXQ7Xh-G.d.mts} +2 -2
- package/dist/{runtime-CNTEAZIz.d.mts.map → runtime-CXQ7Xh-G.d.mts.map} +1 -1
- package/dist/{runtime-C1HMiDVY.d.mts → runtime-CmUxJgD8.d.mts} +2 -2
- package/dist/{runtime-C1HMiDVY.d.mts.map → runtime-CmUxJgD8.d.mts.map} +1 -1
- package/dist/{sql-renderer-Q8LMpTcq-CliGmy0r.mjs → sql-renderer-CD5aYQos-nO-jTG1T.mjs} +5 -4
- package/dist/sql-renderer-CD5aYQos-nO-jTG1T.mjs.map +1 -0
- package/dist/{sql-renderer-hQ3HTY-B.d.mts → sql-renderer-dk7d0cK0.d.mts} +4 -4
- package/dist/{sql-renderer-hQ3HTY-B.d.mts.map → sql-renderer-dk7d0cK0.d.mts.map} +1 -1
- package/dist/target.d.mts +27 -27
- package/dist/target.mjs +23 -24
- 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-types.d.mts +3 -3
- package/dist/target__codecs.d.mts +2 -2
- package/dist/target__codecs.mjs +2 -3
- package/dist/target__control.d.mts +2 -2
- package/dist/target__control.mjs +4 -5
- package/dist/target__data-types.d.mts +2 -2
- package/dist/target__data-types.mjs +3 -3
- package/dist/target__default-normalizer.d.mts +2 -2
- package/dist/target__default-normalizer.mjs +2 -2
- package/dist/target__diff-database-schema.mjs +1 -1
- package/dist/target__full-text-index-authoring.mjs +1 -1
- package/dist/target__full-text.d.mts +3 -3
- package/dist/target__issue-planner.d.mts +1 -1
- package/dist/target__issue-planner.mjs +1 -1
- package/dist/target__migration.d.mts +2 -2
- package/dist/target__migration.mjs +2 -2
- package/dist/target__op-factory-call.d.mts +2 -2
- package/dist/target__op-factory-call.mjs +1 -1
- package/dist/target__operation-types.d.mts +2 -2
- package/dist/target__pack.d.mts +2 -2
- package/dist/target__pack.mjs +1 -1
- package/dist/target__planner-ddl-builders.d.mts +2 -2
- package/dist/target__planner-ddl-builders.mjs +2 -2
- package/dist/target__planner-identity-values.mjs +1 -1
- package/dist/target__planner-produced-postgres-migration.d.mts +2 -2
- package/dist/target__planner-produced-postgres-migration.mjs +1 -1
- package/dist/target__planner-sql-checks.mjs +1 -1
- package/dist/target__planner.d.mts +1 -1
- package/dist/target__planner.mjs +2 -2
- package/dist/target__prisma7-binding.d.mts +1 -1
- package/dist/target__prisma7-binding.mjs +1 -1
- package/dist/target__render-ops.mjs +1 -1
- package/dist/target__runtime.d.mts +2 -2
- package/dist/target__runtime.mjs +4 -4
- package/dist/target__runtime.mjs.map +1 -1
- package/dist/{types-D6lgKhE5-DYkeCAjr.d.mts → types-D6lgKhE5-CjLf9QtO.d.mts} +5 -5
- package/dist/{types-D6lgKhE5-DYkeCAjr.d.mts.map → types-D6lgKhE5-CjLf9QtO.d.mts.map} +1 -1
- package/dist/types-xDgmVoc4.d.mts +2 -0
- package/package.json +9 -9
- package/dist/authoring-BPkERq95-SR5fDsa_.mjs.map +0 -1
- package/dist/codec-descriptor-C5Ec_6Mw-CpacG1CL.mjs.map +0 -1
- package/dist/codec-descriptor-DAQDOwCJ.d.mts +0 -1
- package/dist/codec-descriptor-DkeVTJ3N-XTfZgDGp.d.mts.map +0 -1
- package/dist/codec-helpers-IfGdyCFt-ihgFCc7D.mjs +0 -571
- package/dist/codec-helpers-IfGdyCFt-ihgFCc7D.mjs.map +0 -1
- package/dist/codec-types-ZfL8TSVm.d.mts +0 -2
- package/dist/codecs-CCzJelD2-bt89qO8s.d.mts.map +0 -1
- package/dist/codecs-CQaKsvhH-X9bscCr9.mjs.map +0 -1
- package/dist/contract-contributions-DC-ACLe5-BtAuL8oB.mjs.map +0 -1
- package/dist/control-B0dyj3WB.d.mts.map +0 -1
- package/dist/control-B6nnypMh.d.mts.map +0 -1
- package/dist/control-Bs7Il_Ju.mjs.map +0 -1
- package/dist/control-policy-CQ8hGDrk-jyie0S2j.mjs.map +0 -1
- package/dist/data-type-entries-MxmSzT8p-D8CgbLxS.mjs.map +0 -1
- package/dist/data-types-DnIWGq_1-DTMjYG8M.mjs +0 -375
- package/dist/data-types-DnIWGq_1-DTMjYG8M.mjs.map +0 -1
- package/dist/default-normalizer-BnxtqsRm-CDjZe4vK.mjs +0 -510
- package/dist/default-normalizer-BnxtqsRm-CDjZe4vK.mjs.map +0 -1
- package/dist/default-normalizer-ZZ7Y5boE.d.mts +0 -31
- package/dist/default-normalizer-ZZ7Y5boE.d.mts.map +0 -1
- package/dist/full-text-collection-method-B9e_oZFf-dyzLx5i6.d.mts.map +0 -1
- package/dist/infer-psl-contract-DgOUfqJq-At4pgf6x.mjs.map +0 -1
- package/dist/list-decoder-DXee1orj-K3y-hxiI.mjs +0 -22
- package/dist/list-decoder-DXee1orj-K3y-hxiI.mjs.map +0 -1
- package/dist/op-factory-call-B58Fw5Rz.d.mts +0 -1
- package/dist/operation-types-CScw-diG.d.mts +0 -1
- package/dist/planner-RhYHAxZm-9qT-aXSU.mjs.map +0 -1
- package/dist/planner-ddl-builders-BBQC5ET6.d.mts +0 -38
- package/dist/planner-ddl-builders-BBQC5ET6.d.mts.map +0 -1
- package/dist/planner-ddl-builders-oCsZMJ3b-BTMfg1YV.mjs +0 -91
- package/dist/planner-ddl-builders-oCsZMJ3b-BTMfg1YV.mjs.map +0 -1
- package/dist/planner-produced-postgres-migration-DiBkh1Tj.d.mts +0 -1
- package/dist/planner-produced-postgres-migration-eM7nl_4L-DSW4rLOj.d.mts.map +0 -1
- package/dist/postgres-migration-Bj3MPD7z-Clk_A5s-.mjs.map +0 -1
- package/dist/prisma7-binding-BwBQ58iZ.mjs.map +0 -1
- package/dist/prisma7-binding-LcYpTBjP.d.mts.map +0 -1
- package/dist/sql-renderer-Q8LMpTcq-CliGmy0r.mjs.map +0 -1
- package/dist/types-DIUPMK41.d.mts +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-types-BIvSDTYw-AK5Is74Z.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/data-types-BIvSDTYw.mjs"],"sourcesContent":["import { s as postgresError } from \"./errors-DYyzTYzE.mjs\";\nimport { i as quoteIdentifier } from \"./sql-utils-Df-nf6eM.mjs\";\nimport { numeralText, sqlDataType } from \"@internal/sql-contract/data-type\";\nimport { dateTimeStoredText, storedNumeralText } from \"@internal/sql-contract/data-type-support\";\nimport { isStructuredError, structuredError } from \"@internal/utils/structured-error\";\nimport { INT32_RANGE, INT64_RANGE, assembleDataTypes, isNonFiniteText, readJsonBoolean, readJsonFloat, readJsonInteger, readJsonIntegerText, readJsonMatching, readJsonString, refuseJsonValue } from \"@internal/framework-components/codec\";\nimport { counted, withoutTrailing } from \"@internal/utils/text\";\nimport { type } from \"arktype\";\n//#region src/core/data-type-values.ts\n/**\n* Whether text fits `length` characters, counted as PostgreSQL counts them: code points. A `character` value is padded with spaces, and spaces past its length are dropped, so they do not count.\n*/\nfunction fitsCharacterLength(text, length, blankPadded) {\n\tconst significant = blankPadded ? withoutTrailing(text, \" \") : text;\n\treturn significant.length <= length || [...significant].length <= length;\n}\n/** The uuid input PostgreSQL reads: 32 hex digits in either case, a hyphen allowed after any group of four but the last, and the whole optionally in braces. */\nconst UUID_INPUT = /^(?:\\{[0-9a-f]{4}(?:-?[0-9a-f]{4}){7}\\}|[0-9a-f]{4}(?:-?[0-9a-f]{4}){7})$/i;\n/**\n* Text in any form PostgreSQL reads as a UUID (either case, a hyphen after any group of four digits, optionally in braces), written the way PostgreSQL writes it; `undefined` for text it does not read as one.\n*/\nfunction storedUuid(text) {\n\tif (!UUID_INPUT.test(text)) return void 0;\n\tconst hex = text.replace(/[{}-]/g, \"\").toLowerCase();\n\treturn `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\n/** The largest finite float4. */\nconst FLOAT4_MAX = 34028234663852886e22;\n/** Whether float4 holds a finite number: it neither overflows to an infinity nor rounds to 0, both of which PostgreSQL refuses. */\nfunction fitsFloat4(value) {\n\tconst single = Math.fround(value);\n\treturn Number.isFinite(single) && (value === 0 || single !== 0);\n}\nconst ISO_DURATION = /^P(?!$)(-?\\d+Y)?(-?\\d+M)?(-?\\d+D)?(?:T(?!$)(-?\\d+H)?(-?\\d+M)?(-?\\d+(?:\\.\\d+)?S)?)?$/;\nconst MICROS_PER_SECOND = 1000000n;\n/**\n* Converts a fractional-seconds digit string to microseconds, rounding rather\n* than truncating past the sixth digit.\n*\n* PostgreSQL rounds: `INTERVAL '1.1234567 seconds'` is `1.123457`, and\n* `'1.9999999 seconds'` carries into `2`. Truncating here made the parsed value\n* disagree with the database for any input past microsecond resolution.\n*\n* Ties round toward positive infinity, matching `Math.round` on the sibling path\n* that reads the driver's component object — so the two agree. PostgreSQL's own\n* tie behaviour is unobservable, because it parses the literal into a double\n* first and an exact half never survives that.\n*/\nconst microsFromFraction = (fraction, negative) => {\n\tif (fraction === \"\") return 0n;\n\tconst kept = BigInt(fraction.slice(0, 6).padEnd(6, \"0\"));\n\tconst rest = fraction.slice(6).replace(/0+$/, \"\");\n\tif (rest === \"\") return kept;\n\tconst half = rest[0] === \"5\" && rest.length === 1;\n\treturn rest > \"5\" || half && !negative ? kept + 1n : kept;\n};\nconst intervalFieldsOf = (text) => {\n\tconst match = ISO_DURATION.exec(text);\n\tif (match === null) throw postgresError(\"RUNTIME.DECODE_FAILED\", `pg/interval@1 value must be an ISO-8601 duration, got ${text}`, { meta: {\n\t\tcodecId: \"pg/interval@1\",\n\t\treceived: text\n\t} });\n\tconst [, years, months, days, hours, minutes, seconds] = match;\n\tconst wholeNumber = (part) => part === void 0 ? 0 : Number(part.slice(0, -1));\n\tconst secondsLiteral = seconds === void 0 ? \"0\" : seconds.slice(0, -1);\n\tconst negative = secondsLiteral.startsWith(\"-\");\n\tconst [whole = \"0\", fraction = \"\"] = secondsLiteral.replace(\"-\", \"\").split(\".\");\n\tconst magnitude = BigInt(whole) * MICROS_PER_SECOND + microsFromFraction(fraction, negative);\n\treturn {\n\t\tmonths: wholeNumber(years) * 12 + wholeNumber(months),\n\t\tdays: wholeNumber(days),\n\t\tmicros: BigInt(wholeNumber(hours)) * 3600n * MICROS_PER_SECOND + BigInt(wholeNumber(minutes)) * 60n * MICROS_PER_SECOND + (negative ? -magnitude : magnitude)\n\t};\n};\nconst secondsText = (micros) => {\n\tconst sign = micros < 0n ? \"-\" : \"\";\n\tconst magnitude = micros < 0n ? -micros : micros;\n\tconst whole = magnitude / MICROS_PER_SECOND % 60n;\n\tconst fraction = magnitude % MICROS_PER_SECOND;\n\treturn `${sign}${whole}${fraction === 0n ? \"\" : `.${fraction.toString().padStart(6, \"0\").replace(/0+$/, \"\")}`}`;\n};\n/**\n* Renders {@link PgInterval} the way PostgreSQL spells an interval under\n* `IntervalStyle = 'iso_8601'`: zero components omitted, `T` present only when a\n* time component is, each component carrying its own sign, and an all-zero\n* interval written `PT0S`.\n*/\nconst formatIsoDuration = ({ months, days, micros }) => {\n\tconst years = Math.trunc(months / 12);\n\tconst restMonths = months % 12;\n\tconst sign = micros < 0n ? \"-\" : \"\";\n\tconst magnitude = micros < 0n ? -micros : micros;\n\tconst hours = magnitude / (3600n * MICROS_PER_SECOND);\n\tconst minutes = magnitude / (60n * MICROS_PER_SECOND) % 60n;\n\tconst hasSeconds = magnitude % (60n * MICROS_PER_SECOND) !== 0n;\n\tconst parts = [\n\t\tyears === 0 ? \"\" : `${years}Y`,\n\t\trestMonths === 0 ? \"\" : `${restMonths}M`,\n\t\tdays === 0 ? \"\" : `${days}D`\n\t];\n\tconst time = [\n\t\thours === 0n ? \"\" : `${sign}${hours}H`,\n\t\tminutes === 0n ? \"\" : `${sign}${minutes}M`,\n\t\thasSeconds ? `${secondsText(micros)}S` : \"\"\n\t].join(\"\");\n\tconst rendered = `P${parts.join(\"\")}${time === \"\" ? \"\" : `T${time}`}`;\n\treturn rendered === \"P\" ? \"PT0S\" : rendered;\n};\n/**\n* An interval as PostgreSQL prints it under `IntervalStyle = 'postgres'`: `1 year 2 mons 3 days\n* 04:05:06.5`, `-1 years -2 mons +3 days -04:00:00`, `00:00:00`.\n*/\nconst POSTGRES_INTERVAL = /^(?:([+-]?\\d+) years? ?)?(?:([+-]?\\d+) mons? ?)?(?:([+-]?\\d+) days? ?)?(?:([+-])?(\\d+):(\\d{2}):(\\d{2})(?:\\.(\\d+))?)?$/;\nfunction postgresIntervalFields(text) {\n\tconst match = POSTGRES_INTERVAL.exec(text);\n\tif (match === null || text === \"\" || text.endsWith(\" \")) return void 0;\n\tconst [, years = \"0\", months = \"0\", days = \"0\", sign, hours = \"0\", minutes = \"0\", seconds = \"0\"] = match;\n\tconst fraction = match[8] ?? \"\";\n\tconst magnitude = (BigInt(hours) * 3600n + BigInt(minutes) * 60n + BigInt(seconds)) * MICROS_PER_SECOND + microsFromFraction(fraction, sign === \"-\");\n\treturn {\n\t\tmonths: Number(years) * 12 + Number(months),\n\t\tdays: Number(days),\n\t\tmicros: sign === \"-\" ? -magnitude : magnitude\n\t};\n}\nfunction intervalRefused(message) {\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", message, {\n\t\twhy: \"pg/interval stores one form for each interval (ADR 254), and reads ISO 8601 durations and the text PostgreSQL prints.\",\n\t\tfix: \"Write an ISO 8601 duration, as the message shows.\"\n\t});\n}\n/**\n* The stored form of `pg/interval` (ADR 254), from an ISO 8601 duration or the text PostgreSQL\n* prints under `IntervalStyle = 'postgres'`.\n*/\nfunction pgIntervalStoredText(text) {\n\tconst fractionDigits = /\\.(\\d+)/.exec(text)?.[1]?.length ?? 0;\n\tif (fractionDigits > 6) intervalRefused(`\"${text}\" has ${fractionDigits} digits after the decimal point, but pg/interval holds microseconds, so at most 6. Round it, as in \"PT1.123456S\".`);\n\tif (ISO_DURATION.test(text)) return formatIsoDuration(intervalFieldsOf(text));\n\tconst fields = postgresIntervalFields(text);\n\tif (fields === void 0) intervalRefused(`pg/interval cannot read \"${text}\". Write an ISO 8601 duration, as in \"P1Y2M3DT4H5M6S\".`);\n\treturn formatIsoDuration(fields);\n}\nconst BASE64_TEXT = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;\n/** Reads base64 with or without padding bits set; {@link spellPgByteaJson} writes the base64 `pg/bytea` stores. */\nconst readPgByteaJson = (owner, json) => readJsonMatching(owner, json, BASE64_TEXT, \"a base64 string\");\n/** The base64 of the same bytes with padding bits zero, as `Buffer` writes it. */\nconst spellPgByteaJson = (json) => typeof json === \"string\" ? Buffer.from(json, \"base64\").toString(\"base64\") : json;\nconst BYTEA_TEXT = /^\\\\x(?:[0-9A-Fa-f]{2})*$/;\n/** The base64 `pg/bytea` stores for the hex text PostgreSQL prints, `\\x68656c6c6f`. The `bytea` tag reads its body with this. */\nfunction pgByteaFromHexText(text) {\n\tif (!BYTEA_TEXT.test(text)) throw structuredError(\"CONTRACT.CAST_REFUSED\", `\"${text}\" is not the hex text PostgreSQL prints for bytea, which is \\\\x followed by two hexadecimal digits for each byte, as in \\\\x68656c6c6f.`, {\n\t\twhy: \"The bytea tag reads bytes as the hex text PostgreSQL prints under bytea_output = hex.\",\n\t\tfix: \"Write the bytes in hex after \\\\x, as in bytea`\\\\x68656c6c6f`.\"\n\t});\n\treturn Buffer.from(text.slice(2), \"hex\").toString(\"base64\");\n}\n/** The hex text PostgreSQL prints for the base64 `pg/bytea` stores. */\nfunction pgByteaHexText(base64) {\n\treturn `\\\\x${Buffer.from(base64, \"base64\").toString(\"hex\")}`;\n}\n//#endregion\n//#region src/core/postgres-year-text.ts\n/**\n* PostgreSQL's year text (ADR 254, \"Date and time types\"). PostgreSQL reads and prints no signed year: a year after 9999 is written without its sign and leading zeros, `10000-01-01`, and a year at or before ISO year 0000 with a ` BC` suffix and PostgreSQL's year number, which has no year 0, so ISO year 0000 is `0001 BC` and -000043 is `0044 BC`. Every Postgres date and time codec and tag converts years through these two functions.\n*/\nconst POSTGRES_YEAR = /^(\\d{4,6})(-.*?)( BC)?$/;\nconst ISO_YEAR = /^([+-]\\d{6}|\\d{4})(-.*)$/;\nconst BC_SUFFIX = \" BC\";\n/** ISO 8601 text, with a four-digit or signed six-digit year, from text PostgreSQL prints. Text with no year, ISO text and `0000 BC`, which does not exist, stay as they are. */\nfunction isoYearText(text) {\n\tconst match = POSTGRES_YEAR.exec(text);\n\tif (match === null) return text;\n\tconst [, digits = \"\", rest = \"\", bc] = match;\n\tconst year = Number(digits);\n\tif (bc !== void 0) {\n\t\tif (year === 0) return text;\n\t\treturn `${isoYear(1 - year)}${rest}`;\n\t}\n\treturn digits.length > 4 ? `${isoYear(year)}${rest}` : text;\n}\n/** The text PostgreSQL reads for ISO 8601 text with a four-digit or signed six-digit year. Text with no year stays as it is. */\nfunction postgresYearText(text) {\n\tconst match = ISO_YEAR.exec(text);\n\tif (match === null) return text;\n\tconst [, yearDigits = \"\", rest = \"\"] = match;\n\tconst year = Number(yearDigits);\n\tif (year > 9999) return `${year}${rest}`;\n\tif (year >= 1) return `${String(year).padStart(4, \"0\")}${rest}`;\n\treturn `${String(1 - year).padStart(4, \"0\")}${rest}${BC_SUFFIX}`;\n}\nfunction isoYear(year) {\n\tif (year >= 0 && year <= 9999) return String(year).padStart(4, \"0\");\n\treturn `${year < 0 ? \"-\" : \"+\"}${String(Math.abs(year)).padStart(6, \"0\")}`;\n}\n//#endregion\n//#region src/core/stored-inet.ts\nconst DIGIT = /^[0-9]$/;\nconst HEX_DIGIT = /^[0-9a-fA-F]$/;\nconst isDigit = (ch) => ch !== void 0 && DIGIT.test(ch);\n/**\n* Text PostgreSQL reads as an `inet` value, written the way PostgreSQL prints it: an IPv4 address in\n* four decimal octets, an IPv6 address in lower-case hex with its longest run of zero groups written\n* `::`, and the prefix length only when it is shorter than the whole address. `undefined` for text\n* PostgreSQL does not read as an `inet` value.\n*/\nfunction storedInet(text) {\n\tif (text.includes(\":\")) {\n\t\tconst value = readIpv6(text);\n\t\treturn value === void 0 ? void 0 : printIpv6(value);\n\t}\n\tconst value = readIpv4(text);\n\treturn value === void 0 ? void 0 : printIpv4(value);\n}\n/**\n* PostgreSQL's `inet_net_pton_ipv4`: one to four decimal octets, each up to 255 and leading zeros\n* allowed, then an optional `/` and prefix length up to 32. Without a prefix length all four octets\n* are required; with one, the octets written must cover it.\n*/\nfunction readIpv4(text) {\n\tconst octets = [];\n\tlet index = 0;\n\tlet ch = text[index++];\n\twhile (isDigit(ch)) {\n\t\tlet octet = 0;\n\t\tdo {\n\t\t\toctet = octet * 10 + Number(ch);\n\t\t\tif (octet > 255) return void 0;\n\t\t\tch = text[index++];\n\t\t} while (isDigit(ch));\n\t\tif (octets.length === 4) return void 0;\n\t\toctets.push(octet);\n\t\tif (ch === void 0 || ch === \"/\") break;\n\t\tif (ch !== \".\") return void 0;\n\t\tch = text[index++];\n\t}\n\tlet bits = -1;\n\tif (ch === \"/\" && isDigit(text[index]) && octets.length > 0) {\n\t\tch = text[index++];\n\t\tbits = 0;\n\t\tdo {\n\t\t\tbits = bits * 10 + Number(ch);\n\t\t\tch = text[index++];\n\t\t} while (isDigit(ch));\n\t\tif (ch !== void 0 || bits > 32) return void 0;\n\t}\n\tif (ch !== void 0) return void 0;\n\tif (bits === -1) {\n\t\tif (octets.length !== 4) return void 0;\n\t\tbits = 32;\n\t}\n\tif (octets.length === 0 || Math.floor(bits / 8) > octets.length) return void 0;\n\treturn {\n\t\tbytes: [\n\t\t\t...octets,\n\t\t\t0,\n\t\t\t0,\n\t\t\t0,\n\t\t\t0\n\t\t].slice(0, 4),\n\t\tbits\n\t};\n}\n/** PostgreSQL's `getbits`: a prefix length up to 128, with no leading zero. */\nfunction readBits(text) {\n\tlet bits = 0;\n\tlet digits = 0;\n\tfor (const ch of text) {\n\t\tif (!isDigit(ch)) return void 0;\n\t\tif (digits++ !== 0 && bits === 0) return void 0;\n\t\tbits = bits * 10 + Number(ch);\n\t\tif (bits > 128) return void 0;\n\t}\n\treturn digits === 0 ? void 0 : bits;\n}\n/**\n* PostgreSQL's `getv4`, for the IPv4 tail of an IPv6 address: up to four decimal octets with no\n* leading zeros, and an optional prefix length. Octets left out are zero.\n*/\nfunction readIpv4Tail(text) {\n\tconst octets = [];\n\tlet octet = 0;\n\tlet digits = 0;\n\tfor (const [index, ch] of [...text].entries()) {\n\t\tif (isDigit(ch)) {\n\t\t\tif (digits++ !== 0 && octet === 0) return void 0;\n\t\t\toctet = octet * 10 + Number(ch);\n\t\t\tif (octet > 255) return void 0;\n\t\t\tcontinue;\n\t\t}\n\t\tif (ch !== \".\" && ch !== \"/\") return void 0;\n\t\tif (octets.length > 3) return void 0;\n\t\toctets.push(octet);\n\t\tif (ch === \"/\") {\n\t\t\tconst bits = readBits(text.slice(index + 1));\n\t\t\treturn bits === void 0 ? void 0 : {\n\t\t\t\toctets,\n\t\t\t\tbits\n\t\t\t};\n\t\t}\n\t\toctet = 0;\n\t\tdigits = 0;\n\t}\n\tif (digits === 0 || octets.length > 3) return void 0;\n\treturn {\n\t\toctets: [...octets, octet],\n\t\tbits: void 0\n\t};\n}\n/**\n* PostgreSQL's `inet_cidr_pton_ipv6`: up to eight groups of one to four hex digits in either case,\n* one `::` standing for a run of zero groups, an optional IPv4 tail, and an optional prefix length.\n*/\nfunction readIpv6(text) {\n\tconst bytes = new Array(16).fill(0);\n\tlet filled = 0;\n\tlet compressedAt;\n\tlet index = 0;\n\tif (text[0] === \":\") {\n\t\tif (text[1] !== \":\") return void 0;\n\t\tindex = 1;\n\t}\n\tlet tokenStart = index;\n\tlet sawHexDigit = false;\n\tlet group = 0;\n\tlet groupDigits = 0;\n\tlet bits = 128;\n\twhile (index < text.length) {\n\t\tconst ch = text[index++] ?? \"\";\n\t\tif (HEX_DIGIT.test(ch)) {\n\t\t\tgroup = group << 4 | Number.parseInt(ch, 16);\n\t\t\tif (++groupDigits > 4) return void 0;\n\t\t\tsawHexDigit = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (ch === \":\") {\n\t\t\ttokenStart = index;\n\t\t\tif (!sawHexDigit) {\n\t\t\t\tif (compressedAt !== void 0) return void 0;\n\t\t\t\tcompressedAt = filled;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (index >= text.length || filled + 2 > 16) return void 0;\n\t\t\tbytes[filled++] = group >> 8;\n\t\t\tbytes[filled++] = group & 255;\n\t\t\tsawHexDigit = false;\n\t\t\tgroup = 0;\n\t\t\tgroupDigits = 0;\n\t\t\tcontinue;\n\t\t}\n\t\tif (ch === \".\" && filled + 4 <= 16) {\n\t\t\tconst tail = readIpv4Tail(text.slice(tokenStart));\n\t\t\tif (tail !== void 0) {\n\t\t\t\ttail.octets.forEach((octet, offset) => {\n\t\t\t\t\tbytes[filled + offset] = octet;\n\t\t\t\t});\n\t\t\t\tfilled += 4;\n\t\t\t\tsawHexDigit = false;\n\t\t\t\tbits = tail.bits ?? bits;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (ch === \"/\") {\n\t\t\tconst prefix = readBits(text.slice(index));\n\t\t\tif (prefix !== void 0) {\n\t\t\t\tbits = prefix;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\tif (sawHexDigit) {\n\t\tif (filled + 2 > 16) return void 0;\n\t\tbytes[filled++] = group >> 8;\n\t\tbytes[filled++] = group & 255;\n\t}\n\tif (compressedAt !== void 0) {\n\t\tif (filled === 16) return void 0;\n\t\tconst shifted = bytes.slice(compressedAt, filled);\n\t\tbytes.fill(0, compressedAt, filled);\n\t\tbytes.splice(16 - shifted.length, shifted.length, ...shifted);\n\t\tfilled = 16;\n\t}\n\treturn filled === 16 ? {\n\t\tbytes,\n\t\tbits\n\t} : void 0;\n}\nfunction printIpv4({ bytes, bits }) {\n\tconst address = bytes.join(\".\");\n\treturn bits === 32 ? address : `${address}/${bits}`;\n}\n/**\n* PostgreSQL's `inet_net_ntop_ipv6`: the first longest run of two or more zero groups is written\n* `::`, and an address whose first five groups are zero followed by `ffff`, or whose first six are\n* zero, ends in dotted IPv4.\n*/\nfunction printIpv6({ bytes, bits }) {\n\tconst groups = Array.from({ length: 8 }, (_, i) => (bytes[2 * i] ?? 0) << 8 | (bytes[2 * i + 1] ?? 0));\n\tconst zeroRun = longestZeroRun(groups);\n\tlet text = \"\";\n\tfor (let i = 0; i < 8; i++) {\n\t\tif (zeroRun !== void 0 && i >= zeroRun.start && i < zeroRun.start + zeroRun.length) {\n\t\t\tif (i === zeroRun.start) text += \":\";\n\t\t\tcontinue;\n\t\t}\n\t\tif (i !== 0) text += \":\";\n\t\tif (i === 6 && zeroRun?.start === 0 && (zeroRun.length === 6 || zeroRun.length === 5 && groups[5] === 65535)) {\n\t\t\ttext += bytes.slice(12).join(\".\");\n\t\t\tbreak;\n\t\t}\n\t\ttext += (groups[i] ?? 0).toString(16);\n\t}\n\tif (zeroRun !== void 0 && zeroRun.start + zeroRun.length === 8) text += \":\";\n\treturn bits === 128 ? text : `${text}/${bits}`;\n}\nfunction longestZeroRun(groups) {\n\tlet best;\n\tlet current;\n\tfor (const [i, group] of groups.entries()) {\n\t\tif (group === 0) {\n\t\t\tcurrent = current === void 0 ? {\n\t\t\t\tstart: i,\n\t\t\t\tlength: 1\n\t\t\t} : {\n\t\t\t\t...current,\n\t\t\t\tlength: current.length + 1\n\t\t\t};\n\t\t\tcontinue;\n\t\t}\n\t\tif (current !== void 0 && (best === void 0 || current.length > best.length)) best = current;\n\t\tcurrent = void 0;\n\t}\n\tif (current !== void 0 && (best === void 0 || current.length > best.length)) best = current;\n\treturn best !== void 0 && best.length >= 2 ? best : void 0;\n}\n//#endregion\n//#region src/core/data-types.ts\n/** A cast between two types that store the same shape: the value is already the form this type stores. */\nconst unchanged = (value) => value;\nfunction wrongShape(value, expected) {\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `Expected ${expected}, got ${JSON.stringify(value)}.`, {\n\t\twhy: \"A cast reads the stored form of the type it takes values of.\",\n\t\tfix: \"Hand the cast a value in the shape its source type stores.\"\n\t});\n}\n/** A whole number as the digit text `int8` and `numeric` store. */\nconst asNumeralText = (value) => typeof value === \"number\" ? numeralText(value) : wrongShape(value, \"a number\");\n/**\n* A number as the floating-point types store it: a JSON number, or one of the three words, which\n* those types keep as text. A magnitude past what a double holds is refused rather than rounded to\n* a word: the database refuses it too, and storing `Infinity` would make a written number\n* indistinguishable from a written `Infinity`.\n*/\nconst asFloat = (value) => {\n\tif (typeof value === \"number\") return value;\n\tif (typeof value !== \"string\") return wrongShape(value, \"a number or numeral text\");\n\tif (isNonFiniteText(value)) return value;\n\tconst converted = Number(value);\n\tif (Number.isFinite(converted)) return converted;\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `${value} is out of range: no double holds a number that large.`, {\n\t\twhy: \"The floating-point types store a double, which holds magnitudes up to about 1.8e308.\",\n\t\tfix: \"Use a number a double holds, or a numeric column.\"\n\t});\n};\nconst written = (text) => ({\n\ttext,\n\twritten: true\n});\nconst catalog = (text) => ({\n\ttext,\n\tcatalog: true\n});\nconst writtenAndCatalog = (text) => ({\n\ttext,\n\twritten: true,\n\tcatalog: true\n});\nconst claimsOnly = (text) => ({ text });\nconst anyJson = (json) => json;\nconst readString = (id) => (json) => readJsonString(id, json);\n/** A parameter a type declares as a whole number, or undefined when the column does not set it. */\nfunction integerParam(params, name) {\n\tconst value = params[name];\n\treturn typeof value === \"number\" ? value : void 0;\n}\n/** A decimal numeral: an optional minus sign, digits, and an optional fraction. */\nconst DECIMAL_NUMERAL_TEXT = /^-?\\d+(?:\\.\\d+)?$/;\n/**\n* Numeric text in the form PostgreSQL *prints*, which is narrower than the form it accepts.\n*\n* `numeric` reads `+123`, `.5`, `1.`, `1e5`, `0x1f`, `1_000`, `007`, `-0` and whitespace-padded input, but prints every one of them in a single normalised form — `123`, `0.5`, `1`, `100000`, `31`, `1000`, `7`, `0`. A value in any other form is one the database never returns: `1e5` reads back as `100000`.\n*\n* `NaN`, `Infinity` and `-Infinity` are genuine `numeric` values, which PostgreSQL emits into JSON as strings.\n*/\nconst STORED_NUMERIC_TEXT = /^(?:(?!-0(?:\\.0+)?$)-?(?:0|[1-9]\\d*)(?:\\.\\d+)?|NaN|-?Infinity)$/;\n/**\n* Whether stored numeric text is a value `numeric(precision, scale)` stores without rounding: a whole number of units of 10^-scale, and at most `precision` digits once counted in those units. A negative scale rounds to tens, hundreds and so on, and a scale above the precision allows only values below 1. NaN fits; an infinity does not.\n*/\nfunction fitsNumeric(text, precision, scale) {\n\tif (text === \"NaN\") return true;\n\tif (text.endsWith(\"Infinity\")) return false;\n\tconst [whole = \"\", fraction = \"\"] = text.replace(/^-/, \"\").split(\".\");\n\tconst significantFraction = withoutTrailing(fraction, \"0\");\n\tconst digits = `${whole}${significantFraction}`.replace(/^0+/, \"\");\n\tif (digits === \"\") return true;\n\tconst shift = scale - significantFraction.length;\n\tif (shift >= 0) return digits.length + shift <= precision;\n\tconst units = withoutTrailing(digits, \"0\");\n\tif (digits.length - units.length < -shift) return false;\n\treturn digits.length + shift <= precision;\n}\nconst readNumeric = (json, params) => {\n\tif (typeof json !== \"string\" || !STORED_NUMERIC_TEXT.test(json)) {\n\t\tconst printed = typeof json === \"string\" && DECIMAL_NUMERAL_TEXT.test(json) ? storedNumeralText(json) : void 0;\n\t\treturn refuseJsonValue(\"pg/numeric\", printed === void 0 ? \"a decimal string\" : `\"${printed}\", as PostgreSQL writes this value`, json);\n\t}\n\tconst precision = integerParam(params, \"precision\");\n\tif (precision === void 0) return json;\n\tconst scale = integerParam(params, \"scale\") ?? 0;\n\tif (!fitsNumeric(json, precision, scale)) return refuseJsonValue(\"pg/numeric\", `a decimal string that numeric(${precision}, ${scale}) stores without rounding`, json);\n\treturn json;\n};\n/** A value of `numeric(precision, scale)` is written as PostgreSQL prints it: with exactly `scale` fraction digits, none for a scale of 0 or below. */\nconst spellNumeric = (json, params) => {\n\tif (integerParam(params, \"precision\") === void 0 || typeof json !== \"string\" || json === \"NaN\") return json;\n\tconst scale = integerParam(params, \"scale\") ?? 0;\n\tconst [whole = \"\", fraction = \"\"] = json.split(\".\");\n\treturn scale <= 0 ? whole : `${whole}.${fraction.slice(0, scale).padEnd(scale, \"0\")}`;\n};\nconst readFloat4 = (json) => {\n\tconst value = readJsonFloat(\"pg/float4\", json);\n\tif (Number.isFinite(value) && !fitsFloat4(value)) return refuseJsonValue(\"pg/float4\", `a number float4 holds, at most ${FLOAT4_MAX} in magnitude and not so small that it becomes 0, or the text NaN, Infinity or -Infinity`, json);\n\treturn json;\n};\n/** A `character` value is spelled without the spaces that pad it to its length, as the application reads it. */\nconst spellCharacter = (json) => typeof json === \"string\" ? withoutTrailing(json, \" \") : json;\n/** A `character` column holds its length in characters, and one with no length is `character(1)`; the spaces that pad a value to its length do not count. */\nconst readCharacter = (json, params) => {\n\tconst length = integerParam(params, \"length\") ?? 1;\n\tif (!fitsCharacterLength(readJsonString(\"pg/char\", json), length, true)) return refuseJsonValue(\"pg/char\", `a string of at most ${counted(length, \"character\")} before any trailing spaces`, json);\n\treturn json;\n};\n/** A `character varying` column with a length holds at most that many characters. */\nconst readCharacterVarying = (json, params) => {\n\tconst length = integerParam(params, \"length\");\n\tconst text = readJsonString(\"pg/varchar\", json);\n\tif (length !== void 0 && !fitsCharacterLength(text, length, false)) return refuseJsonValue(\"pg/varchar\", `a string of at most ${counted(length, \"character\")}`, json);\n\treturn json;\n};\nconst BIT_STRING = /^[01]*$/;\n/** A `bit` column holds exactly its length in bits, and one with no length is `bit(1)`. */\nconst readBit = (json, params) => {\n\tconst length = integerParam(params, \"length\") ?? 1;\n\tif (readJsonMatching(\"pg/bit\", json, BIT_STRING, \"a string of 0 and 1 digits\").length !== length) return refuseJsonValue(\"pg/bit\", `a string of exactly ${counted(length, \"bit\")}`, json);\n\treturn json;\n};\n/** A `bit varying` column with a length holds at most that many bits. */\nconst readBitVarying = (json, params) => {\n\tconst length = integerParam(params, \"length\");\n\tconst bits = readJsonMatching(\"pg/varbit\", json, BIT_STRING, \"a string of 0 and 1 digits\");\n\tif (length !== void 0 && bits.length > length) return refuseJsonValue(\"pg/varbit\", `a string of at most ${counted(length, \"bit\")}`, json);\n\treturn json;\n};\n/** A `text[]` may hold NULL elements, which PostgreSQL writes as JSON `null`. */\nconst readTextArray = (json) => {\n\tconst expected = \"an array of strings and nulls\";\n\tif (!Array.isArray(json)) return refuseJsonValue(\"pg/text-array\", expected, json);\n\tfor (const entry of json) if (entry !== null && typeof entry !== \"string\") return refuseJsonValue(\"pg/text-array\", expected, entry);\n\treturn json;\n};\n/** Reads a UUID in any spelling PostgreSQL reads; `spellUuid` gives it the one it stores. */\nconst readUuid = (json) => typeof json === \"string\" && storedUuid(json) !== void 0 ? json : refuseJsonValue(\"pg/uuid\", \"a UUID in a spelling PostgreSQL reads: 32 hexadecimal digits in either case, with or without a hyphen after any group of four, optionally in braces\", json);\n/** A UUID is stored as PostgreSQL prints it: lower case, hyphenated 8-4-4-4-12. */\nconst spellUuid = (json) => typeof json === \"string\" ? storedUuid(json) ?? json : json;\n/** Reads an address in any spelling PostgreSQL reads; `spellInet` gives it the one it stores. */\nconst readInet = (json) => typeof json === \"string\" && storedInet(json) !== void 0 ? json : refuseJsonValue(\"pg/inet\", \"an IP address or network in a spelling PostgreSQL reads, as in 10.0.0.1 or 2001:db8::/32\", json);\n/** An address is stored as PostgreSQL prints it. */\nconst spellInet = (json) => typeof json === \"string\" ? storedInet(json) ?? json : json;\n/** The fraction digits of a second the date, time and interval types hold when a column sets no precision: microseconds. */\nconst MICROSECOND_DIGITS = 6;\n/**\n* A value with more fraction digits of a second than the column's `precision`, or than microseconds when it sets none, which PostgreSQL would round, is refused rather than rounded. Trailing zeros of a fraction are not digits of the value.\n*/\nfunction refuseFinerThanPrecision(typeId, json, fraction, params) {\n\tconst precision = integerParam(params, \"precision\") ?? MICROSECOND_DIGITS;\n\tif (withoutTrailing(fraction ?? \"\", \"0\").length <= precision) return json;\n\treturn refuseJsonValue(typeId, `a value with at most ${counted(precision, \"fraction digit\")} of a second, which precision ${precision} holds without rounding`, json);\n}\n/** What `storedText` writes for `text`, or why it cannot read it. */\nfunction storedSpelling(storedText, text) {\n\ttry {\n\t\treturn { stored: storedText(text) };\n\t} catch (error) {\n\t\tif (isStructuredError(error) && error.code === \"CONTRACT.CAST_REFUSED\") return { reason: error.message };\n\t\tthrow error;\n\t}\n}\n/**\n* Reads a value of a date or time type (ADR 254, \"Date and time types\") in any spelling its tag reads, and refuses other text. A value with more fraction digits than the column's precision is refused rather than rounded. `spellStoredDateTime` gives the value its one stored spelling.\n*/\nconst readStoredDateTime = (typeId, storedText, description, fraction) => (json, params) => {\n\tif (typeof json !== \"string\") return refuseJsonValue(typeId, description, json);\n\tconst spelling = storedSpelling(storedText, json);\n\tif (\"reason\" in spelling) return refuseJsonValue(typeId, `${description}: ${spelling.reason}`, json);\n\trefuseFinerThanPrecision(typeId, json, fraction.exec(spelling.stored)?.[1], params);\n\treturn json;\n};\n/** The stored spelling of a date or time value: what `storedText` writes. */\nconst spellStoredDateTime = (storedText) => (json) => {\n\tif (typeof json !== \"string\") return json;\n\tconst spelling = storedSpelling(storedText, json);\n\treturn \"stored\" in spelling ? spelling.stored : json;\n};\nconst SECONDS_FRACTION = /:\\d{2}\\.(\\d+)/;\nconst INTERVAL_SECONDS_FRACTION = /\\d\\.(\\d+)S$/;\n/** The precision and scale of `numeric`. PostgreSQL 15 and later take a negative scale and one above the precision. */\nconst pgNumericParams = type({\n\t\"precision?\": \"number.integer >= 1 & number.integer <= 1000\",\n\t\"scale?\": \"number.integer >= -1000 & number.integer <= 1000\"\n}).narrow((params, ctx) => params.scale === void 0 || params.precision !== void 0 || ctx.reject({\n\tpath: [\"scale\"],\n\tmessage: \"scale requires a precision\"\n}));\n/** The length of `char` and `varchar`. */\nconst pgCharacterLengthParams = type({ \"length?\": \"number.integer >= 1 & number.integer <= 10485760\" });\n/** The length of `bit` and `bit varying`. */\nconst pgBitLengthParams = type({ \"length?\": \"number.integer >= 1 & number.integer <= 83886080\" });\n/** The fractional-second precision of the time, timestamp and interval types. */\nconst pgPrecisionParams = type({ \"precision?\": \"number.integer >= 0 & number.integer <= 6\" });\nconst pgEnumParams = type({ typeName: \"string > 0\" });\n/** A type with no parameters that is written and reported by its own name. */\nconst namedOnly = (id, name, read, casts = {}) => sqlDataType(id, {\n\ttexts: [writtenAndCatalog(name)],\n\tread,\n\tcasts\n});\nconst withDefaultLength = (params) => params.length === void 0 ? {\n\t...params,\n\tlength: 1\n} : params;\nconst pgText = namedOnly(\"pg/text\", \"text\", readString(\"pg/text\"));\nconst pgTextArray = sqlDataType(\"pg/text-array\", { read: readTextArray });\n/** The enum's `typeName`: its name in `public` or with no schema, its schema-qualified name elsewhere. */\nfunction qualifiedEnumName(reported) {\n\tconst name = reported.name ?? \"\";\n\treturn reported.schema === void 0 || reported.schema === \"public\" ? name : `${reported.schema}.${name}`;\n}\nconst pgEnum = sqlDataType(\"pg/enum\", {\n\tparams: pgEnumParams,\n\tread: readString(\"pg/enum\"),\n\tclaimsKind: \"enum\",\n\trender: ({ typeName }) => {\n\t\tconst dot = typeName.indexOf(\".\");\n\t\treturn dot === -1 ? quoteIdentifier(typeName) : `${quoteIdentifier(typeName.slice(0, dot))}.${quoteIdentifier(typeName.slice(dot + 1))}`;\n\t},\n\tfromReported: (reported) => ({ typeName: qualifiedEnumName(reported) })\n});\nconst pgInt2 = sqlDataType(\"pg/int2\", {\n\ttexts: [written(\"int2\"), catalog(\"smallint\")],\n\tread: (json) => readJsonInteger(\"pg/int2\", json, {\n\t\tmin: -32768,\n\t\tmax: 32767\n\t})\n});\nconst pgBool = sqlDataType(\"pg/bool\", {\n\ttexts: [written(\"bool\"), catalog(\"boolean\")],\n\tread: (json) => readJsonBoolean(\"pg/bool\", json)\n});\nconst pgJson = namedOnly(\"pg/json\", \"json\", anyJson);\nconst pgTsquery = namedOnly(\"pg/tsquery\", \"tsquery\", readString(\"pg/tsquery\"));\nconst pgInt4 = sqlDataType(\"pg/int4\", {\n\ttexts: [\n\t\twritten(\"int4\"),\n\t\tcatalog(\"integer\"),\n\t\tclaimsOnly(\"int\")\n\t],\n\tread: (json) => readJsonInteger(\"pg/int4\", json, INT32_RANGE),\n\tcasts: { [pgInt2.id]: unchanged }\n});\nconst pgInt8 = sqlDataType(\"pg/int8\", {\n\ttexts: [written(\"int8\"), catalog(\"bigint\")],\n\tread: (json) => {\n\t\treadJsonIntegerText(\"pg/int8\", json, INT64_RANGE);\n\t\treturn json;\n\t},\n\tcasts: {\n\t\t[pgInt2.id]: asNumeralText,\n\t\t[pgInt4.id]: asNumeralText\n\t}\n});\nconst pgNumeric = sqlDataType(\"pg/numeric\", {\n\tparams: pgNumericParams,\n\ttexts: [\n\t\twrittenAndCatalog(\"numeric\"),\n\t\twritten(\"numeric({precision})\"),\n\t\twrittenAndCatalog(\"numeric({precision},{scale})\"),\n\t\tclaimsOnly(\"decimal\"),\n\t\tclaimsOnly(\"decimal({precision})\"),\n\t\tclaimsOnly(\"decimal({precision},{scale})\")\n\t],\n\tread: readNumeric,\n\tspell: spellNumeric,\n\tnormalize: (params) => params.precision !== void 0 && params.scale === void 0 ? {\n\t\t...params,\n\t\tscale: 0\n\t} : params,\n\tcasts: {\n\t\t[pgInt2.id]: asNumeralText,\n\t\t[pgInt4.id]: asNumeralText,\n\t\t[pgInt8.id]: unchanged\n\t}\n});\n/** `float4` stores a single-precision float, so a magnitude past about 3.4e38, or one it would round to 0, does not fit. */\nconst asFloat4 = (value) => {\n\tconst converted = asFloat(value);\n\tif (typeof converted !== \"number\" || fitsFloat4(converted)) return converted;\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `${converted} is out of range: float4 holds a nonzero magnitude from about 1.4e-45 to 3.4e38.`, {\n\t\twhy: \"float4 stores a single-precision float, which overflows past about 3.4e38 and rounds a magnitude below about 1.4e-45 to 0.\",\n\t\tfix: \"Use a number float4 holds, or a float8 or numeric column.\"\n\t});\n};\nconst floatCastsOf = (cast) => ({\n\t[pgInt2.id]: cast,\n\t[pgInt4.id]: cast,\n\t[pgInt8.id]: cast,\n\t[pgNumeric.id]: cast\n});\nconst pgFloat4 = sqlDataType(\"pg/float4\", {\n\ttexts: [written(\"float4\"), catalog(\"real\")],\n\tread: readFloat4,\n\tcasts: floatCastsOf(asFloat4)\n});\nconst pgFloat8 = sqlDataType(\"pg/float8\", {\n\ttexts: [\n\t\twritten(\"float8\"),\n\t\tcatalog(\"double precision\"),\n\t\tclaimsOnly(\"float\")\n\t],\n\tread: (json) => {\n\t\treadJsonFloat(\"pg/float8\", json);\n\t\treturn json;\n\t},\n\tcasts: floatCastsOf(asFloat)\n});\nconst pgJsonb = namedOnly(\"pg/jsonb\", \"jsonb\", anyJson, { [pgJson.id]: unchanged });\nconst fromText = { [pgText.id]: unchanged };\nconst pgChar = sqlDataType(\"pg/char\", {\n\tparams: pgCharacterLengthParams,\n\ttexts: [\n\t\twritten(\"character\"),\n\t\twrittenAndCatalog(\"character({length})\"),\n\t\tclaimsOnly(\"char\"),\n\t\tclaimsOnly(\"char({length})\")\n\t],\n\tread: readCharacter,\n\tspell: spellCharacter,\n\tnormalize: withDefaultLength,\n\tcasts: fromText\n});\nconst pgVarchar = sqlDataType(\"pg/varchar\", {\n\tparams: pgCharacterLengthParams,\n\ttexts: [\n\t\twrittenAndCatalog(\"character varying\"),\n\t\twrittenAndCatalog(\"character varying({length})\"),\n\t\tclaimsOnly(\"varchar\"),\n\t\tclaimsOnly(\"varchar({length})\")\n\t],\n\tread: readCharacterVarying,\n\tcasts: fromText\n});\n/** Text in any form PostgreSQL reads as a UUID, written the way PostgreSQL writes it, so the contract holds the value the database reports. */\nconst asUuid = (value) => {\n\tif (typeof value !== \"string\") return wrongShape(value, \"text\");\n\tconst uuid = storedUuid(value);\n\tif (uuid !== void 0) return uuid;\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `${JSON.stringify(value)} is not a UUID: PostgreSQL reads 32 hexadecimal digits, with a hyphen after any group of four and optionally in braces.`, {\n\t\twhy: \"A uuid column takes only text PostgreSQL reads as a UUID.\",\n\t\tfix: \"Write a UUID such as a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11.\"\n\t});\n};\nconst pgUuid = sqlDataType(\"pg/uuid\", {\n\ttexts: [writtenAndCatalog(\"uuid\")],\n\tread: readUuid,\n\tspell: spellUuid,\n\tcasts: { [pgText.id]: asUuid }\n});\nconst pgBit = sqlDataType(\"pg/bit\", {\n\tparams: pgBitLengthParams,\n\ttexts: [written(\"bit\"), writtenAndCatalog(\"bit({length})\")],\n\tread: readBit,\n\tnormalize: withDefaultLength,\n\tcasts: fromText\n});\nconst pgVarbit = sqlDataType(\"pg/varbit\", {\n\tparams: pgBitLengthParams,\n\ttexts: [\n\t\twrittenAndCatalog(\"bit varying\"),\n\t\twrittenAndCatalog(\"bit varying({length})\"),\n\t\tclaimsOnly(\"varbit\"),\n\t\tclaimsOnly(\"varbit({length})\")\n\t],\n\tread: readBitVarying,\n\tcasts: fromText\n});\nconst INFINITIES = /* @__PURE__ */ new Set([\"infinity\", \"-infinity\"]);\n/**\n* The stored form of a date or time type (ADR 254), from ISO 8601 or the text PostgreSQL prints.\n* `infinity` and `-infinity` are values of the types that hold them.\n*/\nfunction postgresDateTime(options, holdsInfinity) {\n\treturn (text) => holdsInfinity && INFINITIES.has(text) ? text : dateTimeStoredText(isoYearText(text), options, text);\n}\n/**\n* Each range is what PostgreSQL and every codec of the type hold: PostgreSQL starts at 4714-11-24\n* BC, and the `Temporal` and `Date` codecs end at +275760-09-13.\n*/\nconst pgDateStoredText = postgresDateTime({\n\tshape: \"date\",\n\townerId: \"pg/date\",\n\trange: {\n\t\tearliest: \"-004713-11-24\",\n\t\tlatest: \"+275760-09-13\"\n\t}\n}, true);\nconst pgTimeStoredText = postgresDateTime({\n\tshape: \"time\",\n\townerId: \"pg/time\"\n}, false);\nconst pgTimetzStoredText = postgresDateTime({\n\tshape: \"timeWithOffset\",\n\townerId: \"pg/timetz\",\n\tmaxOffsetHours: 15\n}, false);\nconst pgTimestampStoredText = postgresDateTime({\n\tshape: \"dateTime\",\n\townerId: \"pg/timestamp\",\n\trange: {\n\t\tearliest: \"-004713-11-24T00:00:00\",\n\t\tlatest: \"+275760-09-13T23:59:59.999999\"\n\t}\n}, true);\nconst pgTimestamptzStoredText = postgresDateTime({\n\tshape: \"instant\",\n\townerId: \"pg/timestamptz\",\n\trange: {\n\t\tearliest: \"-004713-11-24T00:00:00Z\",\n\t\tlatest: \"+275760-09-13T00:00:00Z\"\n\t}\n}, true);\n/** A cast that takes text and gives the value `read` makes of it. */\nconst castFromText = (read) => (value) => typeof value === \"string\" ? read(value) : wrongShape(value, \"text\");\nconst pgTimetz = sqlDataType(\"pg/timetz\", {\n\tread: readStoredDateTime(\"pg/timetz\", pgTimetzStoredText, \"a time of day with its UTC offset, as in \\\"12:34:56+02:00\\\" or \\\"12:34:56Z\\\"\", SECONDS_FRACTION),\n\tspell: spellStoredDateTime(pgTimetzStoredText),\n\tparams: pgPrecisionParams,\n\ttexts: [\n\t\twritten(\"timetz\"),\n\t\twritten(\"timetz({precision})\"),\n\t\tcatalog(\"time with time zone\"),\n\t\tcatalog(\"time({precision}) with time zone\")\n\t]\n});\nconst pgInterval = sqlDataType(\"pg/interval\", {\n\tread: readStoredDateTime(\"pg/interval\", pgIntervalStoredText, \"an ISO 8601 duration, as in \\\"P1Y2M3DT4H5M6.5S\\\"\", INTERVAL_SECONDS_FRACTION),\n\tspell: spellStoredDateTime(pgIntervalStoredText),\n\tparams: pgPrecisionParams,\n\ttexts: [writtenAndCatalog(\"interval\"), writtenAndCatalog(\"interval({precision})\")]\n});\nconst pgBytea = sqlDataType(\"pg/bytea\", {\n\tread: (json) => readPgByteaJson(\"pg/bytea\", json),\n\tspell: spellPgByteaJson,\n\ttexts: [writtenAndCatalog(\"bytea\")]\n});\n/** Text PostgreSQL reads as an IP address, written the way PostgreSQL writes it, so the contract holds the value the database reports. */\nfunction pgInetStoredText(text) {\n\tconst inet = storedInet(text);\n\tif (inet !== void 0) return inet;\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `${JSON.stringify(text)} is not an IP address: PostgreSQL reads an IPv4 address in decimal octets or an IPv6 address in hexadecimal groups, either optionally followed by / and a prefix length.`, {\n\t\twhy: \"An inet column takes only text PostgreSQL reads as an IP address.\",\n\t\tfix: \"Write an address such as 192.168.0.1 or 2001:db8::1/64.\"\n\t});\n}\nconst pgInet = sqlDataType(\"pg/inet\", {\n\tread: readInet,\n\tspell: spellInet,\n\ttexts: [writtenAndCatalog(\"inet\")],\n\tcasts: { [pgText.id]: castFromText(pgInetStoredText) }\n});\nconst pgDate = sqlDataType(\"pg/date\", {\n\tread: readStoredDateTime(\"pg/date\", pgDateStoredText, \"a date, as in \\\"2024-01-01\\\", or infinity or -infinity\", SECONDS_FRACTION),\n\tspell: spellStoredDateTime(pgDateStoredText),\n\ttexts: [writtenAndCatalog(\"date\")]\n});\nconst pgTime = sqlDataType(\"pg/time\", {\n\tread: readStoredDateTime(\"pg/time\", pgTimeStoredText, \"a time of day, as in \\\"12:34:56\\\"\", SECONDS_FRACTION),\n\tspell: spellStoredDateTime(pgTimeStoredText),\n\tparams: pgPrecisionParams,\n\ttexts: [\n\t\twritten(\"time\"),\n\t\twritten(\"time({precision})\"),\n\t\tcatalog(\"time without time zone\"),\n\t\tcatalog(\"time({precision}) without time zone\")\n\t]\n});\nconst pgTimestamp = sqlDataType(\"pg/timestamp\", {\n\tread: readStoredDateTime(\"pg/timestamp\", pgTimestampStoredText, \"a date and time of day, as in \\\"2024-01-01T12:34:56\\\", or infinity or -infinity\", SECONDS_FRACTION),\n\tspell: spellStoredDateTime(pgTimestampStoredText),\n\tparams: pgPrecisionParams,\n\ttexts: [\n\t\twritten(\"timestamp\"),\n\t\twritten(\"timestamp({precision})\"),\n\t\tcatalog(\"timestamp without time zone\"),\n\t\tcatalog(\"timestamp({precision}) without time zone\")\n\t]\n});\nconst pgTimestamptz = sqlDataType(\"pg/timestamptz\", {\n\tread: readStoredDateTime(\"pg/timestamptz\", pgTimestamptzStoredText, \"an instant in UTC, as in \\\"2024-01-01T00:00:00Z\\\", or infinity or -infinity\", SECONDS_FRACTION),\n\tspell: spellStoredDateTime(pgTimestamptzStoredText),\n\tparams: pgPrecisionParams,\n\ttexts: [\n\t\twritten(\"timestamptz\"),\n\t\twritten(\"timestamptz({precision})\"),\n\t\tcatalog(\"timestamp with time zone\"),\n\t\tcatalog(\"timestamp({precision}) with time zone\")\n\t]\n});\n/** Every data type this target registers. */\nconst postgresDataTypes = [\n\tpgText,\n\tpgTextArray,\n\tpgEnum,\n\tpgInt2,\n\tpgBool,\n\tpgJson,\n\tpgTsquery,\n\tpgInt4,\n\tpgInt8,\n\tpgNumeric,\n\tpgFloat4,\n\tpgFloat8,\n\tpgJsonb,\n\tpgChar,\n\tpgVarchar,\n\tpgUuid,\n\tpgInet,\n\tpgBit,\n\tpgVarbit,\n\tpgTimetz,\n\tpgInterval,\n\tpgBytea,\n\tpgDate,\n\tpgTime,\n\tpgTimestamp,\n\tpgTimestamptz\n];\n/** A lookup of the data types this target registers. */\nfunction createPostgresBuiltinDataTypeLookup() {\n\treturn assembleDataTypes([{\n\t\tid: \"postgres\",\n\t\tdataTypes: postgresDataTypes\n\t}]).lookup;\n}\n//#endregion\nexport { pgTimestamptz as A, postgresYearText as B, pgPrecisionParams as C, pgTimeStoredText as D, pgTime as E, pgUuid as F, intervalFieldsOf as G, ISO_DURATION as H, pgVarbit as I, pgByteaHexText as J, microsFromFraction as K, pgVarchar as L, pgTimetz as M, pgTimetzStoredText as N, pgTimestamp as O, pgTsquery as P, postgresDataTypes as R, pgNumericParams as S, pgTextArray as T, MICROS_PER_SECOND as U, BYTEA_TEXT as V, formatIsoDuration as W, postgresIntervalFields as X, pgIntervalStoredText as Y, pgInt8 as _, pgBytea as a, pgJsonb as b, pgDate as c, pgEnumParams as d, pgFloat4 as f, pgInt4 as g, pgInt2 as h, pgBool as i, pgTimestamptzStoredText as j, pgTimestampStoredText as k, pgDateStoredText as l, pgInet as m, pgBit as n, pgChar as o, pgFloat8 as p, pgByteaFromHexText as q, pgBitLengthParams as r, pgCharacterLengthParams as s, createPostgresBuiltinDataTypeLookup as t, pgEnum as u, pgInterval as v, pgText as w, pgNumeric as x, pgJson as y, isoYearText as z };\n\n//# sourceMappingURL=data-types-BIvSDTYw.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,SAAS,oBAAoB,MAAM,QAAQ,aAAa;CACvD,MAAM,cAAc,cAAc,gBAAgB,MAAM,GAAG,IAAI;CAC/D,OAAO,YAAY,UAAU,UAAU,CAAC,GAAG,WAAW,CAAC,CAAC,UAAU;AACnE;;AAEA,MAAM,aAAa;;;;AAInB,SAAS,WAAW,MAAM;CACzB,IAAI,CAAC,WAAW,KAAK,IAAI,GAAG,OAAO,KAAK;CACxC,MAAM,MAAM,KAAK,QAAQ,UAAU,EAAE,CAAC,CAA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M;EACd,QAAQ,mBAAmB;EAC3B,QAAQ,wBAAwB;EAChC,QAAQ,qCAAqC;CAC9C;AACD,CAAC;AACD,MAAM,cAAc,YAAY,gBAAgB;CAC/C,MAAM,mBAAmB,gBAAgB,uBAAuB,mFAAmF,gBAAgB;CACnK,OAAO,oBAAoB,qBAAqB;CAChD,QAAQ;CACR,OAAO;EACN,QAAQ,WAAW;EACnB,QAAQ,wBAAwB;EAChC,QAAQ,6BAA6B;EACrC,QAAQ,0CAA0C;CACnD;AACD,CAAC;AACD,MAAM,gBAAgB,YAAY,kBAAkB;CACnD,MAAM,mBAAmB,kBAAkB,yBAAyB,+EAA+E,gBAAgB;CACnK,OAAO,oBAAoB,uBAAuB;CAClD,QAAQ;CACR,OAAO;EACN,QAAQ,aAAa;EACrB,QAAQ,0BAA0B;EAClC,QAAQ,0BAA0B;EAClC,QAAQ,uCAAuC;CAChD;AACD,CAAC;;AAED,MAAM,oBAAoB;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;AAEA,SAAS,sCAAsC;CAC9C,OAAO,kBAAkB,CAAC;EACzB,IAAI;EACJ,WAAW;CACZ,CAAC,CAAC,CAAC,CAAC;AACL"}
|
|
@@ -60,26 +60,20 @@ declare const pgVarbit: import("@prisma/orm-family-sql/contract/data-type").SqlD
|
|
|
60
60
|
* Each range is what PostgreSQL and every codec of the type hold: PostgreSQL starts at 4714-11-24
|
|
61
61
|
* BC, and the `Temporal` and `Date` codecs end at +275760-09-13.
|
|
62
62
|
*/
|
|
63
|
-
declare const
|
|
64
|
-
declare const
|
|
65
|
-
declare const
|
|
66
|
-
declare const
|
|
67
|
-
declare const
|
|
63
|
+
declare const pgDateStoredText: (text: string) => string;
|
|
64
|
+
declare const pgTimeStoredText: (text: string) => string;
|
|
65
|
+
declare const pgTimetzStoredText: (text: string) => string;
|
|
66
|
+
declare const pgTimestampStoredText: (text: string) => string;
|
|
67
|
+
declare const pgTimestamptzStoredText: (text: string) => string;
|
|
68
68
|
declare const pgTimetz: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<{
|
|
69
69
|
precision?: number;
|
|
70
70
|
}>;
|
|
71
71
|
declare const pgInterval: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<{
|
|
72
72
|
precision?: number;
|
|
73
73
|
}>;
|
|
74
|
-
declare const pgBytea: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
declare const pgInet: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<{
|
|
78
|
-
precision?: number;
|
|
79
|
-
}>;
|
|
80
|
-
declare const pgDate: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<{
|
|
81
|
-
precision?: number;
|
|
82
|
-
}>;
|
|
74
|
+
declare const pgBytea: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<Readonly<Record<string, unknown>>>;
|
|
75
|
+
declare const pgInet: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<Readonly<Record<string, unknown>>>;
|
|
76
|
+
declare const pgDate: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<Readonly<Record<string, unknown>>>;
|
|
83
77
|
declare const pgTime: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<{
|
|
84
78
|
precision?: number;
|
|
85
79
|
}>;
|
|
@@ -94,5 +88,5 @@ declare const postgresDataTypes: readonly DataType[];
|
|
|
94
88
|
/** A lookup of the data types this target registers. */
|
|
95
89
|
declare function createPostgresBuiltinDataTypeLookup(): DataTypeLookup;
|
|
96
90
|
//#endregion
|
|
97
|
-
export { pgTimestamptz as A, pgPrecisionParams as C,
|
|
98
|
-
//# sourceMappingURL=data-types-
|
|
91
|
+
export { pgTimestamptz as A, pgPrecisionParams as C, pgTimeStoredText as D, pgTime as E, pgUuid as F, pgVarbit as I, pgVarchar as L, pgTimetz as M, pgTimetzStoredText as N, pgTimestamp as O, pgTsquery as P, postgresDataTypeEntries as R, pgNumericParams as S, pgTextArray as T, pgInt8 as _, pgBytea as a, pgJsonb as b, pgDate as c, pgEnumParams as d, pgFloat4 as f, pgInt4 as g, pgInt2 as h, pgBool as i, pgTimestamptzStoredText as j, pgTimestampStoredText as k, pgDateStoredText as l, pgInet as m, pgBit as n, pgChar as o, pgFloat8 as p, pgBitLengthParams as r, pgCharacterLengthParams as s, createPostgresBuiltinDataTypeLookup as t, pgEnum as u, pgInterval as v, pgText as w, pgNumeric as x, pgJson as y, postgresDataTypes as z };
|
|
92
|
+
//# sourceMappingURL=data-types-BkFfMhgz.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-types-
|
|
1
|
+
{"version":3,"file":"data-types-BkFfMhgz.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/data-types.d.mts"],"mappings":";;;;iBAGiB,2BAA2B,SAAS,eAAe;;;;cAItD,+DAA+D;EAC3E;EACA;;;cAGY,uEAAuE;EACnF;;;cAGY,iEAAiE;EAC7E;;;cAGY,iEAAiE;EAC7E;;cAEY,4DAA4D;EACxE;;cAEY,mDAAmD,YAAY,SAAS;cACxE,wDAAwD,YAAY,SAAS;cAC7E,mDAAmD;EAC/D;;cAEY,mDAAmD,YAAY,SAAS;cACxE,mDAAmD,YAAY,SAAS;cACxE,mDAAmD,YAAY,SAAS;cACxE,sDAAsD,YAAY,SAAS;cAC3E,mDAAmD,YAAY,SAAS;cACxE,mDAAmD,YAAY,SAAS;cACxE,sDAAsD;EAClE;EACA;;cAEY,qDAAqD,YAAY,SAAS;cAC1E,qDAAqD,YAAY,SAAS;cAC1E,oDAAoD,YAAY,SAAS;cACzE,mDAAmD;EAC/D;;cAEY,sDAAsD;EAClE;;cAEY,mDAAmD,YAAY,SAAS;cACxE,kDAAkD;EAC9D;;cAEY,qDAAqD;EACjE;;;;;;cAMY,mBAAmB;cACnB,mBAAmB;cACnB,qBAAqB;cACrB,wBAAwB;cACxB,0BAA0B;cAC1B,qDAAqD;EACjE;;cAEY,uDAAuD;EACnE;;cAEY,oDAAoD,YAAY,SAAS;cACzE,mDAAmD,YAAY,SAAS;cACxE,mDAAmD,YAAY,SAAS;cACxE,mDAAmD;EAC/D;;cAEY,wDAAwD;EACpE;;cAEY,0DAA0D;EACtE;;;cAGY,4BAA4B;;iBAEzB,uCAAuC"}
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
//#region ../../../3-targets/3-targets/postgres/dist/default-normalizer-BqFHmlox.mjs
|
|
2
|
+
const NEXTVAL_PATTERN = /^nextval\s*\(/i;
|
|
3
|
+
const NOW_FUNCTION_PATTERN = /^(now\s*\(\s*\)|CURRENT_TIMESTAMP)$/i;
|
|
4
|
+
const CLOCK_TIMESTAMP_PATTERN = /^clock_timestamp\s*\(\s*\)$/i;
|
|
5
|
+
const TIMESTAMP_CAST_SUFFIX = /::timestamp(?:tz|\s+(?:with|without)\s+time\s+zone)?$/i;
|
|
6
|
+
const TEXT_CAST_SUFFIX = /::text$/i;
|
|
7
|
+
const NOW_LITERAL_PATTERN = /^'now'$/i;
|
|
8
|
+
const UUID_PATTERN = /^gen_random_uuid\s*\(\s*\)$/i;
|
|
9
|
+
const UUID_OSSP_PATTERN = /^uuid_generate_v4\s*\(\s*\)$/i;
|
|
10
|
+
const NULL_PATTERN = /^NULL(?:::.+)?$/i;
|
|
11
|
+
const TRUE_PATTERN = /^true$/i;
|
|
12
|
+
const FALSE_PATTERN = /^false$/i;
|
|
13
|
+
/**
|
|
14
|
+
* A decimal numeral with an optional sign and an optional exponent. Postgres prints a `real` or
|
|
15
|
+
* `double precision` default in exponent notation once its magnitude is large or small enough:
|
|
16
|
+
* `'1e+20'::real`, `'1e-320'::double precision`.
|
|
17
|
+
*/
|
|
18
|
+
const NUMERAL = String.raw`[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?`;
|
|
19
|
+
const NUMERIC_PATTERN = new RegExp(`^${NUMERAL}$`);
|
|
20
|
+
/**
|
|
21
|
+
* A type modifier: `(3)`, `(65,30)`, or a numeric type's negative scale, `(5,-2)`, which PostgreSQL
|
|
22
|
+
* 15 and later accept.
|
|
23
|
+
*/
|
|
24
|
+
const TYPE_MODIFIER = String.raw`\(\d+(?:,\s*-?\d+)?\)`;
|
|
25
|
+
/**
|
|
26
|
+
* A cast target type: a builtin of one or more words, where any word may carry a modifier
|
|
27
|
+
* (`timestamp(3) without time zone`, `numeric(65,30)`), or a quoted identifier (`"AuditAction"`);
|
|
28
|
+
* either may be qualified by a possibly quoted schema (`audit."AuditAction"`, `"my schema".t`).
|
|
29
|
+
*/
|
|
30
|
+
const TYPE_NAME = String.raw`(?:(?:"(?:[^"]|"")+"|\w+)\.)?(?:"(?:[^"]|"")+"|\w+(?:${TYPE_MODIFIER})?(?:\s+\w+(?:${TYPE_MODIFIER})?)*)`;
|
|
31
|
+
const QUOTED_LITERAL_PATTERN = new RegExp(`^'((?:[^']|'')*)'(?:::(${TYPE_NAME}))?$`);
|
|
32
|
+
/** A string constant with backslash escapes, `E'...'`, which PostgreSQL prints when `standard_conforming_strings` is off. */
|
|
33
|
+
const ESCAPE_STRING_LITERAL_PATTERN = new RegExp(String.raw`^[Ee]'((?:[^'\\]|\\.|'')*)'(?:::(${TYPE_NAME}))?$`, "s");
|
|
34
|
+
const NUMBER_LITERAL_PATTERN = new RegExp(`^(${NUMERAL})(?:::(${TYPE_NAME}))?$`);
|
|
35
|
+
const PARENTHESISED_CAST_PATTERN = new RegExp(String.raw`^\((.+)\)::(${TYPE_NAME})$`, "s");
|
|
36
|
+
const INTEGER_PATTERN = /^-?\d+$/;
|
|
37
|
+
const INTEGER_TYPE_PATTERN = /^(?:smallint|integer|bigint|int2|int4|int8)$/i;
|
|
38
|
+
const NUMBER_TYPE_PATTERN = new RegExp(`^(?:smallint|integer|bigint|int2|int4|int8|real|double precision|float4|float8|numeric|decimal)(?:${TYPE_MODIFIER})?$`, "i");
|
|
39
|
+
/**
|
|
40
|
+
* Matches a Postgres array literal default of the form `'{...}'::elemtype[]`.
|
|
41
|
+
* The literal body is captured in group 1; the cast (including `[]`) is optional.
|
|
42
|
+
* Examples: `'{}'::text[]`, `'{1,2}'::integer[]`, `'{}'`
|
|
43
|
+
*/
|
|
44
|
+
const ARRAY_LITERAL_PATTERN = /^'(\{.*\})'(?:::.+\[\])?$/;
|
|
45
|
+
/** `box` is the one core type whose array elements are delimited by `;`, not `,`. */
|
|
46
|
+
const SEMICOLON_DELIMITED_ELEMENT_TYPE_PATTERN = /^box$/i;
|
|
47
|
+
/**
|
|
48
|
+
* Matches the constructor spelling Postgres reports for a default written as
|
|
49
|
+
* `ARRAY[...]`: `ARRAY['a'::text, 'b'::text]`, `ARRAY[1, 2]`, `ARRAY[]::text[]`.
|
|
50
|
+
* The element list is captured in group 1; the outer cast is optional.
|
|
51
|
+
*/
|
|
52
|
+
const ARRAY_CONSTRUCTOR_PATTERN = new RegExp(String.raw`^ARRAY\[(.*?)\](?:::${TYPE_NAME}\[\])?$`, "is");
|
|
53
|
+
const OUTER_ARRAY_CAST_PATTERN = new RegExp(String.raw`^\((.+)\)::${TYPE_NAME}\[\]$`, "s");
|
|
54
|
+
/**
|
|
55
|
+
* Returns the canonical expression for a timestamp default function, or undefined
|
|
56
|
+
* if the expression is not a recognized timestamp default.
|
|
57
|
+
*
|
|
58
|
+
* Keeps now()/CURRENT_TIMESTAMP and clock_timestamp() distinct:
|
|
59
|
+
* - now(), CURRENT_TIMESTAMP, ('now'::text)::timestamp... → 'now()'
|
|
60
|
+
* - clock_timestamp(), clock_timestamp()::timestamptz → 'clock_timestamp()'
|
|
61
|
+
*
|
|
62
|
+
* These are semantically different in Postgres: now() returns the transaction
|
|
63
|
+
* start time (constant within a transaction), while clock_timestamp() returns
|
|
64
|
+
* the actual wall-clock time (can differ across rows in a single INSERT).
|
|
65
|
+
*/
|
|
66
|
+
function canonicalizeTimestampDefault(expr) {
|
|
67
|
+
if (NOW_FUNCTION_PATTERN.test(expr)) return "now()";
|
|
68
|
+
if (CLOCK_TIMESTAMP_PATTERN.test(expr)) return "clock_timestamp()";
|
|
69
|
+
if (!TIMESTAMP_CAST_SUFFIX.test(expr)) return void 0;
|
|
70
|
+
let inner = expr.replace(TIMESTAMP_CAST_SUFFIX, "").trim();
|
|
71
|
+
if (inner.startsWith("(") && inner.endsWith(")")) inner = inner.slice(1, -1).trim();
|
|
72
|
+
if (NOW_FUNCTION_PATTERN.test(inner)) return "now()";
|
|
73
|
+
if (CLOCK_TIMESTAMP_PATTERN.test(inner)) return "clock_timestamp()";
|
|
74
|
+
inner = inner.replace(TEXT_CAST_SUFFIX, "").trim();
|
|
75
|
+
if (NOW_LITERAL_PATTERN.test(inner)) return "now()";
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A numeral cast to a number type. A cast to an integer type rounds a fraction, so that numeral is
|
|
79
|
+
* not the value.
|
|
80
|
+
*/
|
|
81
|
+
function castNumber(numeral, castType) {
|
|
82
|
+
if (castType === void 0) return {
|
|
83
|
+
kind: "number",
|
|
84
|
+
numeral
|
|
85
|
+
};
|
|
86
|
+
if (!NUMBER_TYPE_PATTERN.test(castType)) return void 0;
|
|
87
|
+
if (INTEGER_TYPE_PATTERN.test(castType) && !INTEGER_PATTERN.test(numeral)) return void 0;
|
|
88
|
+
return {
|
|
89
|
+
kind: "number",
|
|
90
|
+
numeral
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Reads a literal by its cast type: `'-1'::integer` and `(1)::bigint` are numbers, `'a'::text` is a
|
|
95
|
+
* string. A parenthesised cast is read only from number to number: `('now'::text)::date` is
|
|
96
|
+
* evaluated on insert. Anything else, such as an operator or a function call, is not a literal.
|
|
97
|
+
*/
|
|
98
|
+
function readLiteralToken(expression) {
|
|
99
|
+
const escaped = ESCAPE_STRING_LITERAL_PATTERN.exec(expression);
|
|
100
|
+
const quoted = escaped ?? QUOTED_LITERAL_PATTERN.exec(expression);
|
|
101
|
+
if (quoted?.[1] !== void 0) {
|
|
102
|
+
const text = escaped === null ? quoted[1].replace(/''/g, "'") : unescapeEscapeString(quoted[1]);
|
|
103
|
+
const castType = quoted[2];
|
|
104
|
+
return castType !== void 0 && NUMBER_TYPE_PATTERN.test(castType) && NUMERIC_PATTERN.test(text) ? castNumber(text, castType) : {
|
|
105
|
+
kind: "string",
|
|
106
|
+
text
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
const number = NUMBER_LITERAL_PATTERN.exec(expression);
|
|
110
|
+
if (number?.[1] !== void 0) return castNumber(number[1], number[2]);
|
|
111
|
+
const parenthesised = PARENTHESISED_CAST_PATTERN.exec(expression);
|
|
112
|
+
if (parenthesised?.[1] === void 0 || parenthesised[2] === void 0) return void 0;
|
|
113
|
+
const inner = readLiteralToken(parenthesised[1].trim());
|
|
114
|
+
return inner?.kind === "number" ? castNumber(inner.numeral, parenthesised[2]) : void 0;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Splits a Postgres array literal body (without the enclosing braces) into its
|
|
118
|
+
* element tokens, honouring quoting. A comma only separates elements when it is
|
|
119
|
+
* outside double quotes; inside a quoted element a doubled quote (`""`) or a
|
|
120
|
+
* backslash-escaped quote (`\"`) is a literal quote, and a backslash escapes the
|
|
121
|
+
* next character. Returns undefined if the body is malformed (e.g. an unbalanced
|
|
122
|
+
* quote), nests an array, which puts a brace outside quotes, or escapes a character outside
|
|
123
|
+
* quotes with a backslash, which Postgres never prints.
|
|
124
|
+
*/
|
|
125
|
+
function splitArrayElements(inner) {
|
|
126
|
+
const tokens = [];
|
|
127
|
+
let current = "";
|
|
128
|
+
let inQuotes = false;
|
|
129
|
+
let quoted = false;
|
|
130
|
+
for (let i = 0; i < inner.length; i++) {
|
|
131
|
+
const char = inner[i];
|
|
132
|
+
if (inQuotes) {
|
|
133
|
+
if (char === "\\") {
|
|
134
|
+
const next = inner[i + 1];
|
|
135
|
+
if (next === void 0) return void 0;
|
|
136
|
+
current += next;
|
|
137
|
+
i++;
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
if (char === "\"") {
|
|
141
|
+
if (inner[i + 1] === "\"") {
|
|
142
|
+
current += "\"";
|
|
143
|
+
i++;
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
inQuotes = false;
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
current += char;
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
if (char === "\"") {
|
|
153
|
+
inQuotes = true;
|
|
154
|
+
quoted = true;
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
if (char === "{" || char === "}" || char === "\\") return void 0;
|
|
158
|
+
if (char === ",") {
|
|
159
|
+
tokens.push({
|
|
160
|
+
value: current,
|
|
161
|
+
quoted
|
|
162
|
+
});
|
|
163
|
+
current = "";
|
|
164
|
+
quoted = false;
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
current += char;
|
|
168
|
+
}
|
|
169
|
+
if (inQuotes) return void 0;
|
|
170
|
+
tokens.push({
|
|
171
|
+
value: current,
|
|
172
|
+
quoted
|
|
173
|
+
});
|
|
174
|
+
return tokens;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Splits an `ARRAY[...]` element list on the commas outside quotes and parentheses, so
|
|
178
|
+
* `numeric(65,30)` and `'a,b'` stay inside one element. A doubled quote inside an element is a
|
|
179
|
+
* literal quote, so it never closes one.
|
|
180
|
+
*/
|
|
181
|
+
function splitConstructorElements(body) {
|
|
182
|
+
const elements = [];
|
|
183
|
+
let current = "";
|
|
184
|
+
let quote;
|
|
185
|
+
let depth = 0;
|
|
186
|
+
for (const char of body) {
|
|
187
|
+
if (quote !== void 0) {
|
|
188
|
+
if (char === quote) quote = void 0;
|
|
189
|
+
} else if (char === "'" || char === "\"") quote = char;
|
|
190
|
+
else if (char === "(") depth++;
|
|
191
|
+
else if (char === ")") depth--;
|
|
192
|
+
else if (char === "," && depth === 0) {
|
|
193
|
+
elements.push(current);
|
|
194
|
+
current = "";
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
current += char;
|
|
198
|
+
}
|
|
199
|
+
elements.push(current);
|
|
200
|
+
return elements.map((element) => element.trim());
|
|
201
|
+
}
|
|
202
|
+
function unwrapOuterArrayCasts(expression) {
|
|
203
|
+
const match = OUTER_ARRAY_CAST_PATTERN.exec(expression);
|
|
204
|
+
return match?.[1] === void 0 ? expression : unwrapOuterArrayCasts(match[1].trim());
|
|
205
|
+
}
|
|
206
|
+
const BACKSLASH_ESCAPES = {
|
|
207
|
+
b: "\b",
|
|
208
|
+
f: "\f",
|
|
209
|
+
n: "\n",
|
|
210
|
+
r: "\r",
|
|
211
|
+
t: " "
|
|
212
|
+
};
|
|
213
|
+
/** The text of an `E'...'` string constant: a doubled quote is a quote, and a backslash escapes the next character, an octal byte or a hexadecimal byte. */
|
|
214
|
+
function unescapeEscapeString(body) {
|
|
215
|
+
return body.replace(/''|\\([0-7]{1,3}|x[0-9A-Fa-f]{1,2}|.)/gs, (_match, escaped) => {
|
|
216
|
+
if (escaped === void 0) return "'";
|
|
217
|
+
if (/^[0-7]/.test(escaped)) return String.fromCharCode(Number.parseInt(escaped, 8));
|
|
218
|
+
if (escaped.startsWith("x") && escaped.length > 1) return String.fromCharCode(Number.parseInt(escaped.slice(1), 16));
|
|
219
|
+
return BACKSLASH_ESCAPES[escaped] ?? escaped;
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
function functionDefault(expression) {
|
|
223
|
+
return {
|
|
224
|
+
kind: "function",
|
|
225
|
+
expression
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Reads a column's reported default. `nativeType` ends in `[]` for a list column, whose literal is an array literal (`'{a,b}'::text[]`) or an `ARRAY[...]` constructor of literals. A `nextval(...)` default is `autoincrement()`, and the forms of `now()` and of `gen_random_uuid()` are named as the contract names them. Any other expression is a function default, kept as reported.
|
|
230
|
+
*/
|
|
231
|
+
function readPostgresDefault(rawDefault, nativeType) {
|
|
232
|
+
const trimmed = rawDefault.trim();
|
|
233
|
+
if (NEXTVAL_PATTERN.test(trimmed)) return functionDefault("autoincrement()");
|
|
234
|
+
if (NULL_PATTERN.test(trimmed)) return { kind: "null" };
|
|
235
|
+
if (nativeType?.endsWith("[]")) {
|
|
236
|
+
const elements = listElementBodies(trimmed, nativeType.slice(0, -2));
|
|
237
|
+
return elements === void 0 ? functionDefault(trimmed) : {
|
|
238
|
+
kind: "literal",
|
|
239
|
+
literal: {
|
|
240
|
+
kind: "list",
|
|
241
|
+
elements
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
const timestampFunction = canonicalizeTimestampDefault(trimmed);
|
|
246
|
+
if (timestampFunction !== void 0) return functionDefault(timestampFunction);
|
|
247
|
+
if (UUID_PATTERN.test(trimmed) || UUID_OSSP_PATTERN.test(trimmed)) return functionDefault("gen_random_uuid()");
|
|
248
|
+
const body = literalBody(trimmed);
|
|
249
|
+
return body === void 0 ? functionDefault(trimmed) : {
|
|
250
|
+
kind: "literal",
|
|
251
|
+
literal: {
|
|
252
|
+
kind: "value",
|
|
253
|
+
body
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
/** The body of a scalar literal: `true`, `false`, a numeral, or the text of a quoted string. */
|
|
258
|
+
function literalBody(expression) {
|
|
259
|
+
if (TRUE_PATTERN.test(expression)) return "true";
|
|
260
|
+
if (FALSE_PATTERN.test(expression)) return "false";
|
|
261
|
+
const token = readLiteralToken(expression);
|
|
262
|
+
if (token === void 0) return void 0;
|
|
263
|
+
return token.kind === "number" ? token.numeral : token.text;
|
|
264
|
+
}
|
|
265
|
+
/** The element bodies of a list literal, with `null` for SQL NULL, or `undefined` when the default is not a list of literals. */
|
|
266
|
+
function listElementBodies(expression, elementType) {
|
|
267
|
+
const arrayLiteral = ARRAY_LITERAL_PATTERN.exec(expression)?.[1];
|
|
268
|
+
if (arrayLiteral !== void 0 && !SEMICOLON_DELIMITED_ELEMENT_TYPE_PATTERN.test(elementType)) return arrayLiteralElements(arrayLiteral.replace(/''/g, "'"));
|
|
269
|
+
const constructed = ARRAY_CONSTRUCTOR_PATTERN.exec(unwrapOuterArrayCasts(expression))?.[1];
|
|
270
|
+
if (constructed === void 0) return void 0;
|
|
271
|
+
if (constructed.trim() === "") return [];
|
|
272
|
+
const elements = [];
|
|
273
|
+
for (const element of splitConstructorElements(constructed)) {
|
|
274
|
+
if (NULL_PATTERN.test(element)) {
|
|
275
|
+
elements.push(null);
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
const body = literalBody(element);
|
|
279
|
+
if (body === void 0) return void 0;
|
|
280
|
+
elements.push(body);
|
|
281
|
+
}
|
|
282
|
+
return elements;
|
|
283
|
+
}
|
|
284
|
+
/** The elements of an array literal (`{...}`): a quoted element is its text, and an unquoted `NULL` is SQL NULL. */
|
|
285
|
+
function arrayLiteralElements(literal) {
|
|
286
|
+
const inner = literal.slice(1, -1).trim();
|
|
287
|
+
if (inner === "") return [];
|
|
288
|
+
const tokens = splitArrayElements(inner);
|
|
289
|
+
if (tokens === void 0) return void 0;
|
|
290
|
+
const elements = [];
|
|
291
|
+
for (const token of tokens) {
|
|
292
|
+
if (token.quoted) {
|
|
293
|
+
elements.push(token.value);
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
const element = token.value.trim();
|
|
297
|
+
if (element === "") return void 0;
|
|
298
|
+
elements.push(element.toUpperCase() === "NULL" ? null : element);
|
|
299
|
+
}
|
|
300
|
+
return elements;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Names a contract's expression default the way {@link readPostgresDefault} names the same function in the database, so `` sql`CURRENT_TIMESTAMP` `` and the database's `CURRENT_TIMESTAMP` compare equal, and a `nextval(...)` default is `autoincrement()`. 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.
|
|
304
|
+
*/
|
|
305
|
+
function postgresResolveDefault(def, resolvedNativeType) {
|
|
306
|
+
if (def.kind !== "function") return def;
|
|
307
|
+
const read = readPostgresDefault(def.expression, resolvedNativeType);
|
|
308
|
+
return read.kind === "function" ? read : def;
|
|
309
|
+
}
|
|
310
|
+
//#endregion
|
|
311
|
+
export { readPostgresDefault as n, postgresResolveDefault as t };
|
|
312
|
+
|
|
313
|
+
//# sourceMappingURL=default-normalizer-BqFHmlox-CP8ywN-r.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-normalizer-BqFHmlox-CP8ywN-r.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/default-normalizer-BqFHmlox.mjs"],"sourcesContent":["//#region src/core/default-normalizer.ts\nconst NEXTVAL_PATTERN = /^nextval\\s*\\(/i;\nconst NOW_FUNCTION_PATTERN = /^(now\\s*\\(\\s*\\)|CURRENT_TIMESTAMP)$/i;\nconst CLOCK_TIMESTAMP_PATTERN = /^clock_timestamp\\s*\\(\\s*\\)$/i;\nconst TIMESTAMP_CAST_SUFFIX = /::timestamp(?:tz|\\s+(?:with|without)\\s+time\\s+zone)?$/i;\nconst TEXT_CAST_SUFFIX = /::text$/i;\nconst NOW_LITERAL_PATTERN = /^'now'$/i;\nconst UUID_PATTERN = /^gen_random_uuid\\s*\\(\\s*\\)$/i;\nconst UUID_OSSP_PATTERN = /^uuid_generate_v4\\s*\\(\\s*\\)$/i;\nconst NULL_PATTERN = /^NULL(?:::.+)?$/i;\nconst TRUE_PATTERN = /^true$/i;\nconst FALSE_PATTERN = /^false$/i;\n/**\n* A decimal numeral with an optional sign and an optional exponent. Postgres prints a `real` or\n* `double precision` default in exponent notation once its magnitude is large or small enough:\n* `'1e+20'::real`, `'1e-320'::double precision`.\n*/\nconst NUMERAL = String.raw`[+-]?\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?`;\nconst NUMERIC_PATTERN = new RegExp(`^${NUMERAL}$`);\n/**\n* A type modifier: `(3)`, `(65,30)`, or a numeric type's negative scale, `(5,-2)`, which PostgreSQL\n* 15 and later accept.\n*/\nconst TYPE_MODIFIER = String.raw`\\(\\d+(?:,\\s*-?\\d+)?\\)`;\n/**\n* A cast target type: a builtin of one or more words, where any word may carry a modifier\n* (`timestamp(3) without time zone`, `numeric(65,30)`), or a quoted identifier (`\"AuditAction\"`);\n* either may be qualified by a possibly quoted schema (`audit.\"AuditAction\"`, `\"my schema\".t`).\n*/\nconst TYPE_NAME = String.raw`(?:(?:\"(?:[^\"]|\"\")+\"|\\w+)\\.)?(?:\"(?:[^\"]|\"\")+\"|\\w+(?:${TYPE_MODIFIER})?(?:\\s+\\w+(?:${TYPE_MODIFIER})?)*)`;\nconst QUOTED_LITERAL_PATTERN = new RegExp(`^'((?:[^']|'')*)'(?:::(${TYPE_NAME}))?$`);\n/** A string constant with backslash escapes, `E'...'`, which PostgreSQL prints when `standard_conforming_strings` is off. */\nconst ESCAPE_STRING_LITERAL_PATTERN = new RegExp(String.raw`^[Ee]'((?:[^'\\\\]|\\\\.|'')*)'(?:::(${TYPE_NAME}))?$`, \"s\");\nconst NUMBER_LITERAL_PATTERN = new RegExp(`^(${NUMERAL})(?:::(${TYPE_NAME}))?$`);\nconst PARENTHESISED_CAST_PATTERN = new RegExp(String.raw`^\\((.+)\\)::(${TYPE_NAME})$`, \"s\");\nconst INTEGER_PATTERN = /^-?\\d+$/;\nconst INTEGER_TYPE_PATTERN = /^(?:smallint|integer|bigint|int2|int4|int8)$/i;\nconst NUMBER_TYPE_PATTERN = new RegExp(`^(?:smallint|integer|bigint|int2|int4|int8|real|double precision|float4|float8|numeric|decimal)(?:${TYPE_MODIFIER})?$`, \"i\");\n/**\n* Matches a Postgres array literal default of the form `'{...}'::elemtype[]`.\n* The literal body is captured in group 1; the cast (including `[]`) is optional.\n* Examples: `'{}'::text[]`, `'{1,2}'::integer[]`, `'{}'`\n*/\nconst ARRAY_LITERAL_PATTERN = /^'(\\{.*\\})'(?:::.+\\[\\])?$/;\n/** `box` is the one core type whose array elements are delimited by `;`, not `,`. */\nconst SEMICOLON_DELIMITED_ELEMENT_TYPE_PATTERN = /^box$/i;\n/**\n* Matches the constructor spelling Postgres reports for a default written as\n* `ARRAY[...]`: `ARRAY['a'::text, 'b'::text]`, `ARRAY[1, 2]`, `ARRAY[]::text[]`.\n* The element list is captured in group 1; the outer cast is optional.\n*/\nconst ARRAY_CONSTRUCTOR_PATTERN = new RegExp(String.raw`^ARRAY\\[(.*?)\\](?:::${TYPE_NAME}\\[\\])?$`, \"is\");\nconst OUTER_ARRAY_CAST_PATTERN = new RegExp(String.raw`^\\((.+)\\)::${TYPE_NAME}\\[\\]$`, \"s\");\n/**\n* Returns the canonical expression for a timestamp default function, or undefined\n* if the expression is not a recognized timestamp default.\n*\n* Keeps now()/CURRENT_TIMESTAMP and clock_timestamp() distinct:\n* - now(), CURRENT_TIMESTAMP, ('now'::text)::timestamp... → 'now()'\n* - clock_timestamp(), clock_timestamp()::timestamptz → 'clock_timestamp()'\n*\n* These are semantically different in Postgres: now() returns the transaction\n* start time (constant within a transaction), while clock_timestamp() returns\n* the actual wall-clock time (can differ across rows in a single INSERT).\n*/\nfunction canonicalizeTimestampDefault(expr) {\n\tif (NOW_FUNCTION_PATTERN.test(expr)) return \"now()\";\n\tif (CLOCK_TIMESTAMP_PATTERN.test(expr)) return \"clock_timestamp()\";\n\tif (!TIMESTAMP_CAST_SUFFIX.test(expr)) return void 0;\n\tlet inner = expr.replace(TIMESTAMP_CAST_SUFFIX, \"\").trim();\n\tif (inner.startsWith(\"(\") && inner.endsWith(\")\")) inner = inner.slice(1, -1).trim();\n\tif (NOW_FUNCTION_PATTERN.test(inner)) return \"now()\";\n\tif (CLOCK_TIMESTAMP_PATTERN.test(inner)) return \"clock_timestamp()\";\n\tinner = inner.replace(TEXT_CAST_SUFFIX, \"\").trim();\n\tif (NOW_LITERAL_PATTERN.test(inner)) return \"now()\";\n}\n/**\n* A numeral cast to a number type. A cast to an integer type rounds a fraction, so that numeral is\n* not the value.\n*/\nfunction castNumber(numeral, castType) {\n\tif (castType === void 0) return {\n\t\tkind: \"number\",\n\t\tnumeral\n\t};\n\tif (!NUMBER_TYPE_PATTERN.test(castType)) return void 0;\n\tif (INTEGER_TYPE_PATTERN.test(castType) && !INTEGER_PATTERN.test(numeral)) return void 0;\n\treturn {\n\t\tkind: \"number\",\n\t\tnumeral\n\t};\n}\n/**\n* Reads a literal by its cast type: `'-1'::integer` and `(1)::bigint` are numbers, `'a'::text` is a\n* string. A parenthesised cast is read only from number to number: `('now'::text)::date` is\n* evaluated on insert. Anything else, such as an operator or a function call, is not a literal.\n*/\nfunction readLiteralToken(expression) {\n\tconst escaped = ESCAPE_STRING_LITERAL_PATTERN.exec(expression);\n\tconst quoted = escaped ?? QUOTED_LITERAL_PATTERN.exec(expression);\n\tif (quoted?.[1] !== void 0) {\n\t\tconst text = escaped === null ? quoted[1].replace(/''/g, \"'\") : unescapeEscapeString(quoted[1]);\n\t\tconst castType = quoted[2];\n\t\treturn castType !== void 0 && NUMBER_TYPE_PATTERN.test(castType) && NUMERIC_PATTERN.test(text) ? castNumber(text, castType) : {\n\t\t\tkind: \"string\",\n\t\t\ttext\n\t\t};\n\t}\n\tconst number = NUMBER_LITERAL_PATTERN.exec(expression);\n\tif (number?.[1] !== void 0) return castNumber(number[1], number[2]);\n\tconst parenthesised = PARENTHESISED_CAST_PATTERN.exec(expression);\n\tif (parenthesised?.[1] === void 0 || parenthesised[2] === void 0) return void 0;\n\tconst inner = readLiteralToken(parenthesised[1].trim());\n\treturn inner?.kind === \"number\" ? castNumber(inner.numeral, parenthesised[2]) : void 0;\n}\n/**\n* Splits a Postgres array literal body (without the enclosing braces) into its\n* element tokens, honouring quoting. A comma only separates elements when it is\n* outside double quotes; inside a quoted element a doubled quote (`\"\"`) or a\n* backslash-escaped quote (`\\\"`) is a literal quote, and a backslash escapes the\n* next character. Returns undefined if the body is malformed (e.g. an unbalanced\n* quote), nests an array, which puts a brace outside quotes, or escapes a character outside\n* quotes with a backslash, which Postgres never prints.\n*/\nfunction splitArrayElements(inner) {\n\tconst tokens = [];\n\tlet current = \"\";\n\tlet inQuotes = false;\n\tlet quoted = false;\n\tfor (let i = 0; i < inner.length; i++) {\n\t\tconst char = inner[i];\n\t\tif (inQuotes) {\n\t\t\tif (char === \"\\\\\") {\n\t\t\t\tconst next = inner[i + 1];\n\t\t\t\tif (next === void 0) return void 0;\n\t\t\t\tcurrent += next;\n\t\t\t\ti++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (char === \"\\\"\") {\n\t\t\t\tif (inner[i + 1] === \"\\\"\") {\n\t\t\t\t\tcurrent += \"\\\"\";\n\t\t\t\t\ti++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tinQuotes = false;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tcurrent += char;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === \"\\\"\") {\n\t\t\tinQuotes = true;\n\t\t\tquoted = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === \"{\" || char === \"}\" || char === \"\\\\\") return void 0;\n\t\tif (char === \",\") {\n\t\t\ttokens.push({\n\t\t\t\tvalue: current,\n\t\t\t\tquoted\n\t\t\t});\n\t\t\tcurrent = \"\";\n\t\t\tquoted = false;\n\t\t\tcontinue;\n\t\t}\n\t\tcurrent += char;\n\t}\n\tif (inQuotes) return void 0;\n\ttokens.push({\n\t\tvalue: current,\n\t\tquoted\n\t});\n\treturn tokens;\n}\n/**\n* Splits an `ARRAY[...]` element list on the commas outside quotes and parentheses, so\n* `numeric(65,30)` and `'a,b'` stay inside one element. A doubled quote inside an element is a\n* literal quote, so it never closes one.\n*/\nfunction splitConstructorElements(body) {\n\tconst elements = [];\n\tlet current = \"\";\n\tlet quote;\n\tlet depth = 0;\n\tfor (const char of body) {\n\t\tif (quote !== void 0) {\n\t\t\tif (char === quote) quote = void 0;\n\t\t} else if (char === \"'\" || char === \"\\\"\") quote = char;\n\t\telse if (char === \"(\") depth++;\n\t\telse if (char === \")\") depth--;\n\t\telse if (char === \",\" && depth === 0) {\n\t\t\telements.push(current);\n\t\t\tcurrent = \"\";\n\t\t\tcontinue;\n\t\t}\n\t\tcurrent += char;\n\t}\n\telements.push(current);\n\treturn elements.map((element) => element.trim());\n}\nfunction unwrapOuterArrayCasts(expression) {\n\tconst match = OUTER_ARRAY_CAST_PATTERN.exec(expression);\n\treturn match?.[1] === void 0 ? expression : unwrapOuterArrayCasts(match[1].trim());\n}\nconst BACKSLASH_ESCAPES = {\n\tb: \"\\b\",\n\tf: \"\\f\",\n\tn: \"\\n\",\n\tr: \"\\r\",\n\tt: \"\t\"\n};\n/** The text of an `E'...'` string constant: a doubled quote is a quote, and a backslash escapes the next character, an octal byte or a hexadecimal byte. */\nfunction unescapeEscapeString(body) {\n\treturn body.replace(/''|\\\\([0-7]{1,3}|x[0-9A-Fa-f]{1,2}|.)/gs, (_match, escaped) => {\n\t\tif (escaped === void 0) return \"'\";\n\t\tif (/^[0-7]/.test(escaped)) return String.fromCharCode(Number.parseInt(escaped, 8));\n\t\tif (escaped.startsWith(\"x\") && escaped.length > 1) return String.fromCharCode(Number.parseInt(escaped.slice(1), 16));\n\t\treturn BACKSLASH_ESCAPES[escaped] ?? escaped;\n\t});\n}\nfunction functionDefault(expression) {\n\treturn {\n\t\tkind: \"function\",\n\t\texpression\n\t};\n}\n/**\n* Reads a column's reported default. `nativeType` ends in `[]` for a list column, whose literal is an array literal (`'{a,b}'::text[]`) or an `ARRAY[...]` constructor of literals. A `nextval(...)` default is `autoincrement()`, and the forms of `now()` and of `gen_random_uuid()` are named as the contract names them. Any other expression is a function default, kept as reported.\n*/\nfunction readPostgresDefault(rawDefault, nativeType) {\n\tconst trimmed = rawDefault.trim();\n\tif (NEXTVAL_PATTERN.test(trimmed)) return functionDefault(\"autoincrement()\");\n\tif (NULL_PATTERN.test(trimmed)) return { kind: \"null\" };\n\tif (nativeType?.endsWith(\"[]\")) {\n\t\tconst elements = listElementBodies(trimmed, nativeType.slice(0, -2));\n\t\treturn elements === void 0 ? functionDefault(trimmed) : {\n\t\t\tkind: \"literal\",\n\t\t\tliteral: {\n\t\t\t\tkind: \"list\",\n\t\t\t\telements\n\t\t\t}\n\t\t};\n\t}\n\tconst timestampFunction = canonicalizeTimestampDefault(trimmed);\n\tif (timestampFunction !== void 0) return functionDefault(timestampFunction);\n\tif (UUID_PATTERN.test(trimmed) || UUID_OSSP_PATTERN.test(trimmed)) return functionDefault(\"gen_random_uuid()\");\n\tconst body = literalBody(trimmed);\n\treturn body === void 0 ? functionDefault(trimmed) : {\n\t\tkind: \"literal\",\n\t\tliteral: {\n\t\t\tkind: \"value\",\n\t\t\tbody\n\t\t}\n\t};\n}\n/** The body of a scalar literal: `true`, `false`, a numeral, or the text of a quoted string. */\nfunction literalBody(expression) {\n\tif (TRUE_PATTERN.test(expression)) return \"true\";\n\tif (FALSE_PATTERN.test(expression)) return \"false\";\n\tconst token = readLiteralToken(expression);\n\tif (token === void 0) return void 0;\n\treturn token.kind === \"number\" ? token.numeral : token.text;\n}\n/** The element bodies of a list literal, with `null` for SQL NULL, or `undefined` when the default is not a list of literals. */\nfunction listElementBodies(expression, elementType) {\n\tconst arrayLiteral = ARRAY_LITERAL_PATTERN.exec(expression)?.[1];\n\tif (arrayLiteral !== void 0 && !SEMICOLON_DELIMITED_ELEMENT_TYPE_PATTERN.test(elementType)) return arrayLiteralElements(arrayLiteral.replace(/''/g, \"'\"));\n\tconst constructed = ARRAY_CONSTRUCTOR_PATTERN.exec(unwrapOuterArrayCasts(expression))?.[1];\n\tif (constructed === void 0) return void 0;\n\tif (constructed.trim() === \"\") return [];\n\tconst elements = [];\n\tfor (const element of splitConstructorElements(constructed)) {\n\t\tif (NULL_PATTERN.test(element)) {\n\t\t\telements.push(null);\n\t\t\tcontinue;\n\t\t}\n\t\tconst body = literalBody(element);\n\t\tif (body === void 0) return void 0;\n\t\telements.push(body);\n\t}\n\treturn elements;\n}\n/** The elements of an array literal (`{...}`): a quoted element is its text, and an unquoted `NULL` is SQL NULL. */\nfunction arrayLiteralElements(literal) {\n\tconst inner = literal.slice(1, -1).trim();\n\tif (inner === \"\") return [];\n\tconst tokens = splitArrayElements(inner);\n\tif (tokens === void 0) return void 0;\n\tconst elements = [];\n\tfor (const token of tokens) {\n\t\tif (token.quoted) {\n\t\t\telements.push(token.value);\n\t\t\tcontinue;\n\t\t}\n\t\tconst element = token.value.trim();\n\t\tif (element === \"\") return void 0;\n\t\telements.push(element.toUpperCase() === \"NULL\" ? null : element);\n\t}\n\treturn elements;\n}\n/**\n* Names a contract's expression default the way {@link readPostgresDefault} names the same function in the database, so `` sql`CURRENT_TIMESTAMP` `` and the database's `CURRENT_TIMESTAMP` compare equal, and a `nextval(...)` default is `autoincrement()`. 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 postgresResolveDefault(def, resolvedNativeType) {\n\tif (def.kind !== \"function\") return def;\n\tconst read = readPostgresDefault(def.expression, resolvedNativeType);\n\treturn read.kind === \"function\" ? read : def;\n}\n//#endregion\nexport { readPostgresDefault as n, postgresResolveDefault as t };\n\n//# sourceMappingURL=default-normalizer-BqFHmlox.mjs.map"],"mappings":";AACA,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;AAC7B,MAAM,0BAA0B;AAChC,MAAM,wBAAwB;AAC9B,MAAM,mBAAmB;AACzB,MAAM,sBAAsB;AAC5B,MAAM,eAAe;AACrB,MAAM,oBAAoB;AAC1B,MAAM,eAAe;AACrB,MAAM,eAAe;AACrB,MAAM,gBAAgB;;;;;;AAMtB,MAAM,UAAU,OAAO,GAAG;AAC1B,MAAM,kBAAkB,IAAI,OAAO,IAAI,QAAQ,EAAE;;;;;AAKjD,MAAM,gBAAgB,OAAO,GAAG;;;;;;AAMhC,MAAM,YAAY,OAAO,GAAG,wDAAwD,cAAc,gBAAgB,cAAc;AAChI,MAAM,yBAAyB,IAAI,OAAO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ACpC,MAAM,OAAO,oBAAoB,IAAI,YAAY,kBAAkB;CACnE,OAAO,KAAK,SAAS,aAAa,OAAO;AAC1C"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReportedLiteralDefault } from "@prisma/orm-family-sql/family/control";
|
|
2
|
+
import { ColumnDefault } from "@prisma/orm-framework/contract/types";
|
|
3
|
+
//#region ../../../3-targets/3-targets/postgres/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 PostgresReportedDefault = {
|
|
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. `nativeType` ends in `[]` for a list column, whose literal is an array literal (`'{a,b}'::text[]`) or an `ARRAY[...]` constructor of literals. A `nextval(...)` default is `autoincrement()`, and the forms of `now()` and of `gen_random_uuid()` are named as the contract names them. Any other expression is a function default, kept as reported.
|
|
17
|
+
*/
|
|
18
|
+
declare function readPostgresDefault(rawDefault: string, nativeType?: string): PostgresReportedDefault;
|
|
19
|
+
/**
|
|
20
|
+
* Names a contract's expression default the way {@link readPostgresDefault} names the same function in the database, so `` sql`CURRENT_TIMESTAMP` `` and the database's `CURRENT_TIMESTAMP` compare equal, and a `nextval(...)` default is `autoincrement()`. 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 postgresResolveDefault(def: ColumnDefault, resolvedNativeType: string): ColumnDefault;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { postgresResolveDefault as n, readPostgresDefault as r, PostgresReportedDefault as t };
|
|
25
|
+
//# sourceMappingURL=default-normalizer-CTAiFe9Y.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-normalizer-CTAiFe9Y.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/default-normalizer.d.mts"],"mappings":";;;;;KAIK;WACM;WACA;;WAEA;;WAEA;WACA,SAAS;;;;;iBAKH,oBAAoB,oBAAoB,sBAAsB;;;;iBAI9D,uBAAuB,KAAK,eAAe,6BAA6B"}
|
package/dist/{descriptor-meta-CqUL_be_-BkT3aEIm.mjs → descriptor-meta-CNFvhRlG-8_vCDF2W.mjs}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { t as DEFAULT_NAMESPACE_ID } from "./namespace-ids-xtp_ZY86-Cpp8PTxD.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { M as postgresQualifyColumnType } from "./codecs-CaWZPjFi-hllqyGdW.mjs";
|
|
3
3
|
import { h as postgresCreateNamespace } from "./postgres-schema-Ysxbqkzr-hFRwS-zT.mjs";
|
|
4
|
-
import { c as postgresAuthoringEntityTypes, d as postgresAuthoringPslBlockDescriptors, f as postgresAuthoringTypes, l as postgresAuthoringFieldPresets, p as postgresLowerEntityHandles, u as postgresAuthoringModelAttributes } from "./authoring-
|
|
4
|
+
import { c as postgresAuthoringEntityTypes, d as postgresAuthoringPslBlockDescriptors, f as postgresAuthoringTypes, l as postgresAuthoringFieldPresets, p as postgresLowerEntityHandles, u as postgresAuthoringModelAttributes } from "./authoring-DAorKc0L-DpWukVxn.mjs";
|
|
5
5
|
import { t as postgresRenderCheckExpressions } from "./check-expressions-CVLs1Cgf-DaMRk-Q4.mjs";
|
|
6
|
-
import { t as postgresDataTypeEntries } from "./data-type-entries-
|
|
7
|
-
import { t as postgresTargetDescriptorMetaRuntime } from "./descriptor-meta-runtime-
|
|
6
|
+
import { t as postgresDataTypeEntries } from "./data-type-entries-DECnlc43-BYnGiJLy.mjs";
|
|
7
|
+
import { t as postgresTargetDescriptorMetaRuntime } from "./descriptor-meta-runtime-BKtwKsDm-BirZ12T5.mjs";
|
|
8
8
|
import { n as postgresIndexTypes } from "./index-types-Bdy_UGfY-CqEPukzT.mjs";
|
|
9
|
-
//#region ../../../3-targets/3-targets/postgres/dist/descriptor-meta-
|
|
9
|
+
//#region ../../../3-targets/3-targets/postgres/dist/descriptor-meta-CNFvhRlG.mjs
|
|
10
10
|
const postgresTargetDescriptorMeta = {
|
|
11
11
|
...postgresTargetDescriptorMetaRuntime,
|
|
12
12
|
defaultNamespaceId: DEFAULT_NAMESPACE_ID,
|
|
@@ -33,4 +33,4 @@ const postgresTargetDescriptorMeta = {
|
|
|
33
33
|
//#endregion
|
|
34
34
|
export { postgresTargetDescriptorMeta as t };
|
|
35
35
|
|
|
36
|
-
//# sourceMappingURL=descriptor-meta-
|
|
36
|
+
//# sourceMappingURL=descriptor-meta-CNFvhRlG-8_vCDF2W.mjs.map
|