@prisma/orm-target-postgres 8.0.0-rc.18-dev.16 → 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.
Files changed (215) hide show
  1. package/dist/{adapter-HQtZIZ2r-kQG81kJ1.mjs → adapter-C2XsLnXe-DLYvtWWr.mjs} +6 -6
  2. package/dist/{adapter-HQtZIZ2r-kQG81kJ1.mjs.map → adapter-C2XsLnXe-DLYvtWWr.mjs.map} +1 -1
  3. package/dist/{adapter-BiuJIKUc.d.mts → adapter-N4hlaZy6.d.mts} +5 -5
  4. package/dist/{adapter-BiuJIKUc.d.mts.map → adapter-N4hlaZy6.d.mts.map} +1 -1
  5. package/dist/adapter.d.mts +8 -9
  6. package/dist/adapter.mjs +5 -6
  7. package/dist/adapter__adapter.d.mts +1 -1
  8. package/dist/adapter__adapter.mjs +2 -2
  9. package/dist/adapter__control.d.mts +3 -4
  10. package/dist/adapter__control.mjs +6 -7
  11. package/dist/adapter__control.mjs.map +1 -1
  12. package/dist/adapter__runtime.d.mts +1 -1
  13. package/dist/adapter__runtime.mjs +4 -4
  14. package/dist/adapter__runtime.mjs.map +1 -1
  15. package/dist/adapter__sql-renderer.d.mts +1 -1
  16. package/dist/adapter__sql-renderer.mjs +1 -1
  17. package/dist/adapter__types.d.mts +3 -3
  18. package/dist/{aggregates-BNxcV7HS.d.mts → aggregates-BgI1xxMl.d.mts} +3 -3
  19. package/dist/{aggregates-BNxcV7HS.d.mts.map → aggregates-BgI1xxMl.d.mts.map} +1 -1
  20. package/dist/{aggregates-Brwk0sYS.mjs → aggregates-DHIDeR2f.mjs} +3 -3
  21. package/dist/{aggregates-Brwk0sYS.mjs.map → aggregates-DHIDeR2f.mjs.map} +1 -1
  22. package/dist/{authoring-BPkERq95-SR5fDsa_.mjs → authoring-DAorKc0L-DpWukVxn.mjs} +8 -8
  23. package/dist/authoring-DAorKc0L-DpWukVxn.mjs.map +1 -0
  24. package/dist/{autoincrement-widths-D_WhWVXx-D6BupdY2.mjs → autoincrement-widths-BLCRgB3t-BWl20PCZ.mjs} +3 -3
  25. package/dist/{autoincrement-widths-D_WhWVXx-D6BupdY2.mjs.map → autoincrement-widths-BLCRgB3t-BWl20PCZ.mjs.map} +1 -1
  26. package/dist/codec-descriptor-BlMs1rkg.d.mts +1 -0
  27. package/dist/{codec-descriptor-DkeVTJ3N-XTfZgDGp.d.mts → codec-descriptor-Cbz5bbma-dxeoAwS2.d.mts} +4 -4
  28. package/dist/codec-descriptor-Cbz5bbma-dxeoAwS2.d.mts.map +1 -0
  29. package/dist/{codec-descriptor-C5Ec_6Mw-CpacG1CL.mjs → codec-descriptor-DSMjoW72-ZoCcTHLX.mjs} +3 -4
  30. package/dist/codec-descriptor-DSMjoW72-ZoCcTHLX.mjs.map +1 -0
  31. package/dist/{codec-registry-DSRFjaLX-Dwg0yBK7.mjs → codec-registry-pg69n-o5-D8K3p40k.mjs} +5 -5
  32. package/dist/{codec-registry-DSRFjaLX-Dwg0yBK7.mjs.map → codec-registry-pg69n-o5-D8K3p40k.mjs.map} +1 -1
  33. package/dist/{codec-type-map-BznmYkRz-QD11Yx27.d.mts → codec-type-map-eTeOtvJB-c3tjqXBa.d.mts} +4 -4
  34. package/dist/{codec-type-map-BznmYkRz-QD11Yx27.d.mts.map → codec-type-map-eTeOtvJB-c3tjqXBa.d.mts.map} +1 -1
  35. package/dist/{codec-types-BZXuhZ1c-B9YQf_UN.d.mts → codec-types-Cf0IZ0WQ-CMVP-ecb.d.mts} +4 -4
  36. package/dist/{codec-types-BZXuhZ1c-B9YQf_UN.d.mts.map → codec-types-Cf0IZ0WQ-CMVP-ecb.d.mts.map} +1 -1
  37. package/dist/codec-types-o-BM2rPP.d.mts +2 -0
  38. package/dist/{codecs-BChKdFcD.d.mts → codecs-B-8uGsxq.d.mts} +3 -3
  39. package/dist/{codecs-BChKdFcD.d.mts.map → codecs-B-8uGsxq.d.mts.map} +1 -1
  40. package/dist/{codecs-CQaKsvhH-X9bscCr9.mjs → codecs-CaWZPjFi-hllqyGdW.mjs} +605 -574
  41. package/dist/codecs-CaWZPjFi-hllqyGdW.mjs.map +1 -0
  42. package/dist/{codecs-CCzJelD2-bt89qO8s.d.mts → codecs-DanVXZ_F-D1_8_x3j.d.mts} +150 -169
  43. package/dist/codecs-DanVXZ_F-D1_8_x3j.d.mts.map +1 -0
  44. package/dist/{contract-contributions-DC-ACLe5-BtAuL8oB.mjs → contract-contributions-C8XjOBIq-BuK0mnF9.mjs} +55 -40
  45. package/dist/contract-contributions-C8XjOBIq-BuK0mnF9.mjs.map +1 -0
  46. package/dist/{control-Bs7Il_Ju.mjs → control--DStfvkM.mjs} +17 -14
  47. package/dist/control--DStfvkM.mjs.map +1 -0
  48. package/dist/{control-B0dyj3WB.d.mts → control-Co7_lX4j.d.mts} +2 -11
  49. package/dist/control-Co7_lX4j.d.mts.map +1 -0
  50. package/dist/{control-B6nnypMh.d.mts → control-Mc7bM0Ho.d.mts} +4 -14
  51. package/dist/control-Mc7bM0Ho.d.mts.map +1 -0
  52. package/dist/{control-policy-CQ8hGDrk-jyie0S2j.mjs → control-policy-DrK_x_Qd-BcT8Z5TM.mjs} +13 -30
  53. package/dist/control-policy-DrK_x_Qd-BcT8Z5TM.mjs.map +1 -0
  54. package/dist/{data-type-entries-MxmSzT8p-D8CgbLxS.mjs → data-type-entries-DECnlc43-BYnGiJLy.mjs} +30 -3
  55. package/dist/data-type-entries-DECnlc43-BYnGiJLy.mjs.map +1 -0
  56. package/dist/data-types-BIvSDTYw-AK5Is74Z.mjs +961 -0
  57. package/dist/data-types-BIvSDTYw-AK5Is74Z.mjs.map +1 -0
  58. package/dist/{data-types-BDkZIUMI.d.mts → data-types-BkFfMhgz.d.mts} +10 -16
  59. package/dist/{data-types-BDkZIUMI.d.mts.map → data-types-BkFfMhgz.d.mts.map} +1 -1
  60. package/dist/default-normalizer-BqFHmlox-CP8ywN-r.mjs +313 -0
  61. package/dist/default-normalizer-BqFHmlox-CP8ywN-r.mjs.map +1 -0
  62. package/dist/default-normalizer-CTAiFe9Y.d.mts +25 -0
  63. package/dist/default-normalizer-CTAiFe9Y.d.mts.map +1 -0
  64. package/dist/{descriptor-meta-CqUL_be_-BkT3aEIm.mjs → descriptor-meta-CNFvhRlG-8_vCDF2W.mjs} +6 -6
  65. package/dist/{descriptor-meta-CqUL_be_-BkT3aEIm.mjs.map → descriptor-meta-CNFvhRlG-8_vCDF2W.mjs.map} +1 -1
  66. package/dist/{descriptor-meta-DzC2NwDh-C_D6wtZj.mjs → descriptor-meta-_qLKFkLd-Cb4H-vZf.mjs} +4 -4
  67. package/dist/{descriptor-meta-DzC2NwDh-C_D6wtZj.mjs.map → descriptor-meta-_qLKFkLd-Cb4H-vZf.mjs.map} +1 -1
  68. package/dist/{descriptor-meta-runtime-CpGl9XzU-CZHs_TNl.mjs → descriptor-meta-runtime-BKtwKsDm-BirZ12T5.mjs} +3 -3
  69. package/dist/{descriptor-meta-runtime-CpGl9XzU-CZHs_TNl.mjs.map → descriptor-meta-runtime-BKtwKsDm-BirZ12T5.mjs.map} +1 -1
  70. package/dist/{diff-database-schema-BKkcK7s--BxbpuwVf.mjs → diff-database-schema-C6fmfclD-Dqn9QqOO.mjs} +4 -4
  71. package/dist/{diff-database-schema-BKkcK7s--BxbpuwVf.mjs.map → diff-database-schema-C6fmfclD-Dqn9QqOO.mjs.map} +1 -1
  72. package/dist/{full-text-DzMPXaCj.d.mts → full-text-Ht1M3vH4.d.mts} +3 -3
  73. package/dist/{full-text-DzMPXaCj.d.mts.map → full-text-Ht1M3vH4.d.mts.map} +1 -1
  74. package/dist/{full-text-collection-method-B9e_oZFf-dyzLx5i6.d.mts → full-text-collection-method-Dye6N2u5-DGPEZRTD.d.mts} +4 -4
  75. package/dist/full-text-collection-method-Dye6N2u5-DGPEZRTD.d.mts.map +1 -0
  76. package/dist/{infer-psl-contract-DgOUfqJq-At4pgf6x.mjs → infer-psl-contract-hJUt-dtW-iwec11iw.mjs} +160 -56
  77. package/dist/infer-psl-contract-hJUt-dtW-iwec11iw.mjs.map +1 -0
  78. package/dist/{issue-planner-DDhlcfH2.d.mts → issue-planner-B3E9yChD.d.mts} +2 -2
  79. package/dist/{issue-planner-DDhlcfH2.d.mts.map → issue-planner-B3E9yChD.d.mts.map} +1 -1
  80. package/dist/migration-CbOh59ZJ.mjs.map +1 -1
  81. package/dist/{migration-DdE7N4ne.d.mts → migration-cGzKlTv0.d.mts} +2 -2
  82. package/dist/{migration-DdE7N4ne.d.mts.map → migration-cGzKlTv0.d.mts.map} +1 -1
  83. package/dist/{op-factory-call-BCBPUVFr-CW8l_JKw.mjs → op-factory-call-DJz5P0h1-Cs7DC10N.mjs} +4 -4
  84. package/dist/{op-factory-call-BCBPUVFr-CW8l_JKw.mjs.map → op-factory-call-DJz5P0h1-Cs7DC10N.mjs.map} +1 -1
  85. package/dist/op-factory-call-uVDKZqw1.d.mts +1 -0
  86. package/dist/{op-factory-call-COYbR6tp-XukKl6qj.d.mts → op-factory-call-z5TKsamx-DDfPa57U.d.mts} +2 -2
  87. package/dist/{op-factory-call-COYbR6tp-XukKl6qj.d.mts.map → op-factory-call-z5TKsamx-DDfPa57U.d.mts.map} +1 -1
  88. package/dist/{operation-types-BAiYtHkM-BN_YTibJ.d.mts → operation-types--RnlMCZS-qXBhNS1Q.d.mts} +3 -3
  89. package/dist/{operation-types-BAiYtHkM-BN_YTibJ.d.mts.map → operation-types--RnlMCZS-qXBhNS1Q.d.mts.map} +1 -1
  90. package/dist/operation-types-Dfg-5VmM.d.mts +1 -0
  91. package/dist/{pack-4sJCj0w-.d.mts → pack-_zBIeh-3.d.mts} +4 -4
  92. package/dist/{pack-4sJCj0w-.d.mts.map → pack-_zBIeh-3.d.mts.map} +1 -1
  93. package/dist/{planner-Pcd2R46Y.d.mts → planner-BBGH1cAB.d.mts} +2 -2
  94. package/dist/{planner-Pcd2R46Y.d.mts.map → planner-BBGH1cAB.d.mts.map} +1 -1
  95. package/dist/planner-ddl-builders-Byw5BICu.d.mts +16 -0
  96. package/dist/planner-ddl-builders-Byw5BICu.d.mts.map +1 -0
  97. package/dist/planner-ddl-builders-D0r6cT4A-D9Wm1myF.mjs +29 -0
  98. package/dist/planner-ddl-builders-D0r6cT4A-D9Wm1myF.mjs.map +1 -0
  99. package/dist/{planner-RhYHAxZm-9qT-aXSU.mjs → planner-ewMcuoHd-DwCCA-Kc.mjs} +9 -8
  100. package/dist/planner-ewMcuoHd-DwCCA-Kc.mjs.map +1 -0
  101. package/dist/{planner-identity-values-DwvdO5iZ-C9_lmJx6.mjs → planner-identity-values-CWUHmsB9-CBQ00C_3.mjs} +3 -3
  102. package/dist/{planner-identity-values-DwvdO5iZ-C9_lmJx6.mjs.map → planner-identity-values-CWUHmsB9-CBQ00C_3.mjs.map} +1 -1
  103. package/dist/planner-produced-postgres-migration-D-ZcNy7h.d.mts +1 -0
  104. package/dist/{planner-produced-postgres-migration-B3b3MBKL-CxswQFN2.mjs → planner-produced-postgres-migration-Dy5zHiFB-BDpfjZD5.mjs} +4 -4
  105. package/dist/{planner-produced-postgres-migration-B3b3MBKL-CxswQFN2.mjs.map → planner-produced-postgres-migration-Dy5zHiFB-BDpfjZD5.mjs.map} +1 -1
  106. package/dist/{planner-produced-postgres-migration-eM7nl_4L-DSW4rLOj.d.mts → planner-produced-postgres-migration-sxhIP3Te-Cn3sD9zE.d.mts} +3 -3
  107. package/dist/planner-produced-postgres-migration-sxhIP3Te-Cn3sD9zE.d.mts.map +1 -0
  108. package/dist/{planner-sql-checks-BV2akIx8-l8qCWzYf.mjs → planner-sql-checks-D0w3Kt_G-Bh1Vlz0T.mjs} +5 -5
  109. package/dist/{planner-sql-checks-BV2akIx8-l8qCWzYf.mjs.map → planner-sql-checks-D0w3Kt_G-Bh1Vlz0T.mjs.map} +1 -1
  110. package/dist/{postgres-codec-traits-DOTVjmpT-B4f6Rkh7.mjs → postgres-codec-traits-DY-tFVjg-CjMZUKNx.mjs} +3 -3
  111. package/dist/{postgres-codec-traits-DOTVjmpT-B4f6Rkh7.mjs.map → postgres-codec-traits-DY-tFVjg-CjMZUKNx.mjs.map} +1 -1
  112. package/dist/{postgres-contract-view-Cei64xbt-BcDzLVah.mjs → postgres-contract-view-o6bwzfH6-D4jvq9PJ.mjs} +6 -6
  113. package/dist/{postgres-contract-view-Cei64xbt-BcDzLVah.mjs.map → postgres-contract-view-o6bwzfH6-D4jvq9PJ.mjs.map} +1 -1
  114. package/dist/{postgres-migration-D0TY1HnO-CXuyvNiq.d.mts → postgres-migration-D6_R3__I-rFg_i2gz.d.mts} +2 -2
  115. package/dist/{postgres-migration-D0TY1HnO-CXuyvNiq.d.mts.map → postgres-migration-D6_R3__I-rFg_i2gz.d.mts.map} +1 -1
  116. package/dist/{postgres-migration-Bj3MPD7z-Clk_A5s-.mjs → postgres-migration-Dtkb6eDn-CrButm3l.mjs} +14 -22
  117. package/dist/postgres-migration-Dtkb6eDn-CrButm3l.mjs.map +1 -0
  118. package/dist/{prisma7-binding-BwBQ58iZ.mjs → prisma7-binding-BsucflfD.mjs} +106 -87
  119. package/dist/prisma7-binding-BsucflfD.mjs.map +1 -0
  120. package/dist/{prisma7-binding-LcYpTBjP.d.mts → prisma7-binding-DGp7Ea38.d.mts} +24 -15
  121. package/dist/prisma7-binding-DGp7Ea38.d.mts.map +1 -0
  122. package/dist/{render-ops-TAy4wxZ8-FnL41Aq3.mjs → render-ops-Db7MhDM0-DsIQjmcY.mjs} +3 -3
  123. package/dist/{render-ops-TAy4wxZ8-FnL41Aq3.mjs.map → render-ops-Db7MhDM0-DsIQjmcY.mjs.map} +1 -1
  124. package/dist/{runtime-CNTEAZIz.d.mts → runtime-CXQ7Xh-G.d.mts} +2 -2
  125. package/dist/{runtime-CNTEAZIz.d.mts.map → runtime-CXQ7Xh-G.d.mts.map} +1 -1
  126. package/dist/{runtime-C1HMiDVY.d.mts → runtime-CmUxJgD8.d.mts} +2 -2
  127. package/dist/{runtime-C1HMiDVY.d.mts.map → runtime-CmUxJgD8.d.mts.map} +1 -1
  128. package/dist/{sql-renderer-Q8LMpTcq-CliGmy0r.mjs → sql-renderer-CD5aYQos-nO-jTG1T.mjs} +5 -4
  129. package/dist/sql-renderer-CD5aYQos-nO-jTG1T.mjs.map +1 -0
  130. package/dist/{sql-renderer-hQ3HTY-B.d.mts → sql-renderer-dk7d0cK0.d.mts} +4 -4
  131. package/dist/{sql-renderer-hQ3HTY-B.d.mts.map → sql-renderer-dk7d0cK0.d.mts.map} +1 -1
  132. package/dist/target.d.mts +27 -27
  133. package/dist/target.mjs +23 -24
  134. package/dist/target__aggregates.d.mts +1 -1
  135. package/dist/target__aggregates.mjs +1 -1
  136. package/dist/target__codec-descriptor.d.mts +2 -2
  137. package/dist/target__codec-descriptor.mjs +1 -1
  138. package/dist/target__codec-types.d.mts +3 -3
  139. package/dist/target__codecs.d.mts +2 -2
  140. package/dist/target__codecs.mjs +2 -3
  141. package/dist/target__control.d.mts +2 -2
  142. package/dist/target__control.mjs +4 -5
  143. package/dist/target__data-types.d.mts +2 -2
  144. package/dist/target__data-types.mjs +3 -3
  145. package/dist/target__default-normalizer.d.mts +2 -2
  146. package/dist/target__default-normalizer.mjs +2 -2
  147. package/dist/target__diff-database-schema.mjs +1 -1
  148. package/dist/target__full-text-index-authoring.mjs +1 -1
  149. package/dist/target__full-text.d.mts +3 -3
  150. package/dist/target__issue-planner.d.mts +1 -1
  151. package/dist/target__issue-planner.mjs +1 -1
  152. package/dist/target__migration.d.mts +2 -2
  153. package/dist/target__migration.mjs +2 -2
  154. package/dist/target__op-factory-call.d.mts +2 -2
  155. package/dist/target__op-factory-call.mjs +1 -1
  156. package/dist/target__operation-types.d.mts +2 -2
  157. package/dist/target__pack.d.mts +2 -2
  158. package/dist/target__pack.mjs +1 -1
  159. package/dist/target__planner-ddl-builders.d.mts +2 -2
  160. package/dist/target__planner-ddl-builders.mjs +2 -2
  161. package/dist/target__planner-identity-values.mjs +1 -1
  162. package/dist/target__planner-produced-postgres-migration.d.mts +2 -2
  163. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  164. package/dist/target__planner-sql-checks.mjs +1 -1
  165. package/dist/target__planner.d.mts +1 -1
  166. package/dist/target__planner.mjs +2 -2
  167. package/dist/target__prisma7-binding.d.mts +1 -1
  168. package/dist/target__prisma7-binding.mjs +1 -1
  169. package/dist/target__render-ops.mjs +1 -1
  170. package/dist/target__runtime.d.mts +2 -2
  171. package/dist/target__runtime.mjs +4 -4
  172. package/dist/target__runtime.mjs.map +1 -1
  173. package/dist/{types-D6lgKhE5-DYkeCAjr.d.mts → types-D6lgKhE5-CjLf9QtO.d.mts} +5 -5
  174. package/dist/{types-D6lgKhE5-DYkeCAjr.d.mts.map → types-D6lgKhE5-CjLf9QtO.d.mts.map} +1 -1
  175. package/dist/types-xDgmVoc4.d.mts +2 -0
  176. package/package.json +9 -9
  177. package/dist/authoring-BPkERq95-SR5fDsa_.mjs.map +0 -1
  178. package/dist/codec-descriptor-C5Ec_6Mw-CpacG1CL.mjs.map +0 -1
  179. package/dist/codec-descriptor-DAQDOwCJ.d.mts +0 -1
  180. package/dist/codec-descriptor-DkeVTJ3N-XTfZgDGp.d.mts.map +0 -1
  181. package/dist/codec-helpers-IfGdyCFt-ihgFCc7D.mjs +0 -571
  182. package/dist/codec-helpers-IfGdyCFt-ihgFCc7D.mjs.map +0 -1
  183. package/dist/codec-types-ZfL8TSVm.d.mts +0 -2
  184. package/dist/codecs-CCzJelD2-bt89qO8s.d.mts.map +0 -1
  185. package/dist/codecs-CQaKsvhH-X9bscCr9.mjs.map +0 -1
  186. package/dist/contract-contributions-DC-ACLe5-BtAuL8oB.mjs.map +0 -1
  187. package/dist/control-B0dyj3WB.d.mts.map +0 -1
  188. package/dist/control-B6nnypMh.d.mts.map +0 -1
  189. package/dist/control-Bs7Il_Ju.mjs.map +0 -1
  190. package/dist/control-policy-CQ8hGDrk-jyie0S2j.mjs.map +0 -1
  191. package/dist/data-type-entries-MxmSzT8p-D8CgbLxS.mjs.map +0 -1
  192. package/dist/data-types-DnIWGq_1-DTMjYG8M.mjs +0 -375
  193. package/dist/data-types-DnIWGq_1-DTMjYG8M.mjs.map +0 -1
  194. package/dist/default-normalizer-BnxtqsRm-CDjZe4vK.mjs +0 -510
  195. package/dist/default-normalizer-BnxtqsRm-CDjZe4vK.mjs.map +0 -1
  196. package/dist/default-normalizer-ZZ7Y5boE.d.mts +0 -31
  197. package/dist/default-normalizer-ZZ7Y5boE.d.mts.map +0 -1
  198. package/dist/full-text-collection-method-B9e_oZFf-dyzLx5i6.d.mts.map +0 -1
  199. package/dist/infer-psl-contract-DgOUfqJq-At4pgf6x.mjs.map +0 -1
  200. package/dist/list-decoder-DXee1orj-K3y-hxiI.mjs +0 -22
  201. package/dist/list-decoder-DXee1orj-K3y-hxiI.mjs.map +0 -1
  202. package/dist/op-factory-call-B58Fw5Rz.d.mts +0 -1
  203. package/dist/operation-types-CScw-diG.d.mts +0 -1
  204. package/dist/planner-RhYHAxZm-9qT-aXSU.mjs.map +0 -1
  205. package/dist/planner-ddl-builders-BBQC5ET6.d.mts +0 -38
  206. package/dist/planner-ddl-builders-BBQC5ET6.d.mts.map +0 -1
  207. package/dist/planner-ddl-builders-oCsZMJ3b-BTMfg1YV.mjs +0 -91
  208. package/dist/planner-ddl-builders-oCsZMJ3b-BTMfg1YV.mjs.map +0 -1
  209. package/dist/planner-produced-postgres-migration-DiBkh1Tj.d.mts +0 -1
  210. package/dist/planner-produced-postgres-migration-eM7nl_4L-DSW4rLOj.d.mts.map +0 -1
  211. package/dist/postgres-migration-Bj3MPD7z-Clk_A5s-.mjs.map +0 -1
  212. package/dist/prisma7-binding-BwBQ58iZ.mjs.map +0 -1
  213. package/dist/prisma7-binding-LcYpTBjP.d.mts.map +0 -1
  214. package/dist/sql-renderer-Q8LMpTcq-CliGmy0r.mjs.map +0 -1
  215. package/dist/types-DIUPMK41.d.mts +0 -2
@@ -0,0 +1,961 @@
1
+ import { s as postgresError } from "./errors-DYyzTYzE-39CV_aMo.mjs";
2
+ import { i as quoteIdentifier } from "./sql-utils-Df-nf6eM-Ov1KgjWm.mjs";
3
+ import { isStructuredError, structuredError } from "@prisma/orm-framework/utils/structured-error";
4
+ import { INT32_RANGE, INT64_RANGE, assembleDataTypes, isNonFiniteText, readJsonBoolean, readJsonFloat, readJsonInteger, readJsonIntegerText, readJsonMatching, readJsonString, refuseJsonValue } from "@prisma/orm-framework/components/codec";
5
+ import { counted, withoutTrailing } from "@prisma/orm-framework/utils/text";
6
+ import { numeralText, sqlDataType } from "@prisma/orm-family-sql/contract/data-type";
7
+ import { dateTimeStoredText, storedNumeralText } from "@prisma/orm-family-sql/contract/data-type-support";
8
+ import { type } from "arktype";
9
+ //#region ../../../3-targets/3-targets/postgres/dist/data-types-BIvSDTYw.mjs
10
+ /**
11
+ * 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.
12
+ */
13
+ function fitsCharacterLength(text, length, blankPadded) {
14
+ const significant = blankPadded ? withoutTrailing(text, " ") : text;
15
+ return significant.length <= length || [...significant].length <= length;
16
+ }
17
+ /** 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. */
18
+ const UUID_INPUT = /^(?:\{[0-9a-f]{4}(?:-?[0-9a-f]{4}){7}\}|[0-9a-f]{4}(?:-?[0-9a-f]{4}){7})$/i;
19
+ /**
20
+ * 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.
21
+ */
22
+ function storedUuid(text) {
23
+ if (!UUID_INPUT.test(text)) return void 0;
24
+ const hex = text.replace(/[{}-]/g, "").toLowerCase();
25
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
26
+ }
27
+ /** The largest finite float4. */
28
+ const FLOAT4_MAX = 34028234663852886e22;
29
+ /** Whether float4 holds a finite number: it neither overflows to an infinity nor rounds to 0, both of which PostgreSQL refuses. */
30
+ function fitsFloat4(value) {
31
+ const single = Math.fround(value);
32
+ return Number.isFinite(single) && (value === 0 || single !== 0);
33
+ }
34
+ const ISO_DURATION = /^P(?!$)(-?\d+Y)?(-?\d+M)?(-?\d+D)?(?:T(?!$)(-?\d+H)?(-?\d+M)?(-?\d+(?:\.\d+)?S)?)?$/;
35
+ const MICROS_PER_SECOND = 1000000n;
36
+ /**
37
+ * Converts a fractional-seconds digit string to microseconds, rounding rather
38
+ * than truncating past the sixth digit.
39
+ *
40
+ * PostgreSQL rounds: `INTERVAL '1.1234567 seconds'` is `1.123457`, and
41
+ * `'1.9999999 seconds'` carries into `2`. Truncating here made the parsed value
42
+ * disagree with the database for any input past microsecond resolution.
43
+ *
44
+ * Ties round toward positive infinity, matching `Math.round` on the sibling path
45
+ * that reads the driver's component object — so the two agree. PostgreSQL's own
46
+ * tie behaviour is unobservable, because it parses the literal into a double
47
+ * first and an exact half never survives that.
48
+ */
49
+ const microsFromFraction = (fraction, negative) => {
50
+ if (fraction === "") return 0n;
51
+ const kept = BigInt(fraction.slice(0, 6).padEnd(6, "0"));
52
+ const rest = fraction.slice(6).replace(/0+$/, "");
53
+ if (rest === "") return kept;
54
+ const half = rest[0] === "5" && rest.length === 1;
55
+ return rest > "5" || half && !negative ? kept + 1n : kept;
56
+ };
57
+ const intervalFieldsOf = (text) => {
58
+ const match = ISO_DURATION.exec(text);
59
+ if (match === null) throw postgresError("RUNTIME.DECODE_FAILED", `pg/interval@1 value must be an ISO-8601 duration, got ${text}`, { meta: {
60
+ codecId: "pg/interval@1",
61
+ received: text
62
+ } });
63
+ const [, years, months, days, hours, minutes, seconds] = match;
64
+ const wholeNumber = (part) => part === void 0 ? 0 : Number(part.slice(0, -1));
65
+ const secondsLiteral = seconds === void 0 ? "0" : seconds.slice(0, -1);
66
+ const negative = secondsLiteral.startsWith("-");
67
+ const [whole = "0", fraction = ""] = secondsLiteral.replace("-", "").split(".");
68
+ const magnitude = BigInt(whole) * MICROS_PER_SECOND + microsFromFraction(fraction, negative);
69
+ return {
70
+ months: wholeNumber(years) * 12 + wholeNumber(months),
71
+ days: wholeNumber(days),
72
+ micros: BigInt(wholeNumber(hours)) * 3600n * MICROS_PER_SECOND + BigInt(wholeNumber(minutes)) * 60n * MICROS_PER_SECOND + (negative ? -magnitude : magnitude)
73
+ };
74
+ };
75
+ const secondsText = (micros) => {
76
+ const sign = micros < 0n ? "-" : "";
77
+ const magnitude = micros < 0n ? -micros : micros;
78
+ const whole = magnitude / MICROS_PER_SECOND % 60n;
79
+ const fraction = magnitude % MICROS_PER_SECOND;
80
+ return `${sign}${whole}${fraction === 0n ? "" : `.${fraction.toString().padStart(6, "0").replace(/0+$/, "")}`}`;
81
+ };
82
+ /**
83
+ * Renders {@link PgInterval} the way PostgreSQL spells an interval under
84
+ * `IntervalStyle = 'iso_8601'`: zero components omitted, `T` present only when a
85
+ * time component is, each component carrying its own sign, and an all-zero
86
+ * interval written `PT0S`.
87
+ */
88
+ const formatIsoDuration = ({ months, days, micros }) => {
89
+ const years = Math.trunc(months / 12);
90
+ const restMonths = months % 12;
91
+ const sign = micros < 0n ? "-" : "";
92
+ const magnitude = micros < 0n ? -micros : micros;
93
+ const hours = magnitude / (3600n * MICROS_PER_SECOND);
94
+ const minutes = magnitude / (60n * MICROS_PER_SECOND) % 60n;
95
+ const hasSeconds = magnitude % (60n * MICROS_PER_SECOND) !== 0n;
96
+ const parts = [
97
+ years === 0 ? "" : `${years}Y`,
98
+ restMonths === 0 ? "" : `${restMonths}M`,
99
+ days === 0 ? "" : `${days}D`
100
+ ];
101
+ const time = [
102
+ hours === 0n ? "" : `${sign}${hours}H`,
103
+ minutes === 0n ? "" : `${sign}${minutes}M`,
104
+ hasSeconds ? `${secondsText(micros)}S` : ""
105
+ ].join("");
106
+ const rendered = `P${parts.join("")}${time === "" ? "" : `T${time}`}`;
107
+ return rendered === "P" ? "PT0S" : rendered;
108
+ };
109
+ /**
110
+ * An interval as PostgreSQL prints it under `IntervalStyle = 'postgres'`: `1 year 2 mons 3 days
111
+ * 04:05:06.5`, `-1 years -2 mons +3 days -04:00:00`, `00:00:00`.
112
+ */
113
+ const POSTGRES_INTERVAL = /^(?:([+-]?\d+) years? ?)?(?:([+-]?\d+) mons? ?)?(?:([+-]?\d+) days? ?)?(?:([+-])?(\d+):(\d{2}):(\d{2})(?:\.(\d+))?)?$/;
114
+ function postgresIntervalFields(text) {
115
+ const match = POSTGRES_INTERVAL.exec(text);
116
+ if (match === null || text === "" || text.endsWith(" ")) return void 0;
117
+ const [, years = "0", months = "0", days = "0", sign, hours = "0", minutes = "0", seconds = "0"] = match;
118
+ const fraction = match[8] ?? "";
119
+ const magnitude = (BigInt(hours) * 3600n + BigInt(minutes) * 60n + BigInt(seconds)) * MICROS_PER_SECOND + microsFromFraction(fraction, sign === "-");
120
+ return {
121
+ months: Number(years) * 12 + Number(months),
122
+ days: Number(days),
123
+ micros: sign === "-" ? -magnitude : magnitude
124
+ };
125
+ }
126
+ function intervalRefused(message) {
127
+ throw structuredError("CONTRACT.CAST_REFUSED", message, {
128
+ why: "pg/interval stores one form for each interval (ADR 254), and reads ISO 8601 durations and the text PostgreSQL prints.",
129
+ fix: "Write an ISO 8601 duration, as the message shows."
130
+ });
131
+ }
132
+ /**
133
+ * The stored form of `pg/interval` (ADR 254), from an ISO 8601 duration or the text PostgreSQL
134
+ * prints under `IntervalStyle = 'postgres'`.
135
+ */
136
+ function pgIntervalStoredText(text) {
137
+ const fractionDigits = /\.(\d+)/.exec(text)?.[1]?.length ?? 0;
138
+ if (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".`);
139
+ if (ISO_DURATION.test(text)) return formatIsoDuration(intervalFieldsOf(text));
140
+ const fields = postgresIntervalFields(text);
141
+ if (fields === void 0) intervalRefused(`pg/interval cannot read "${text}". Write an ISO 8601 duration, as in "P1Y2M3DT4H5M6S".`);
142
+ return formatIsoDuration(fields);
143
+ }
144
+ const BASE64_TEXT = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
145
+ /** Reads base64 with or without padding bits set; {@link spellPgByteaJson} writes the base64 `pg/bytea` stores. */
146
+ const readPgByteaJson = (owner, json) => readJsonMatching(owner, json, BASE64_TEXT, "a base64 string");
147
+ /** The base64 of the same bytes with padding bits zero, as `Buffer` writes it. */
148
+ const spellPgByteaJson = (json) => typeof json === "string" ? Buffer.from(json, "base64").toString("base64") : json;
149
+ const BYTEA_TEXT = /^\\x(?:[0-9A-Fa-f]{2})*$/;
150
+ /** The base64 `pg/bytea` stores for the hex text PostgreSQL prints, `\x68656c6c6f`. The `bytea` tag reads its body with this. */
151
+ function pgByteaFromHexText(text) {
152
+ if (!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.`, {
153
+ why: "The bytea tag reads bytes as the hex text PostgreSQL prints under bytea_output = hex.",
154
+ fix: "Write the bytes in hex after \\x, as in bytea`\\x68656c6c6f`."
155
+ });
156
+ return Buffer.from(text.slice(2), "hex").toString("base64");
157
+ }
158
+ /** The hex text PostgreSQL prints for the base64 `pg/bytea` stores. */
159
+ function pgByteaHexText(base64) {
160
+ return `\\x${Buffer.from(base64, "base64").toString("hex")}`;
161
+ }
162
+ /**
163
+ * 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.
164
+ */
165
+ const POSTGRES_YEAR = /^(\d{4,6})(-.*?)( BC)?$/;
166
+ const ISO_YEAR = /^([+-]\d{6}|\d{4})(-.*)$/;
167
+ const BC_SUFFIX = " BC";
168
+ /** 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. */
169
+ function isoYearText(text) {
170
+ const match = POSTGRES_YEAR.exec(text);
171
+ if (match === null) return text;
172
+ const [, digits = "", rest = "", bc] = match;
173
+ const year = Number(digits);
174
+ if (bc !== void 0) {
175
+ if (year === 0) return text;
176
+ return `${isoYear(1 - year)}${rest}`;
177
+ }
178
+ return digits.length > 4 ? `${isoYear(year)}${rest}` : text;
179
+ }
180
+ /** 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. */
181
+ function postgresYearText(text) {
182
+ const match = ISO_YEAR.exec(text);
183
+ if (match === null) return text;
184
+ const [, yearDigits = "", rest = ""] = match;
185
+ const year = Number(yearDigits);
186
+ if (year > 9999) return `${year}${rest}`;
187
+ if (year >= 1) return `${String(year).padStart(4, "0")}${rest}`;
188
+ return `${String(1 - year).padStart(4, "0")}${rest}${BC_SUFFIX}`;
189
+ }
190
+ function isoYear(year) {
191
+ if (year >= 0 && year <= 9999) return String(year).padStart(4, "0");
192
+ return `${year < 0 ? "-" : "+"}${String(Math.abs(year)).padStart(6, "0")}`;
193
+ }
194
+ const DIGIT = /^[0-9]$/;
195
+ const HEX_DIGIT = /^[0-9a-fA-F]$/;
196
+ const isDigit = (ch) => ch !== void 0 && DIGIT.test(ch);
197
+ /**
198
+ * Text PostgreSQL reads as an `inet` value, written the way PostgreSQL prints it: an IPv4 address in
199
+ * four decimal octets, an IPv6 address in lower-case hex with its longest run of zero groups written
200
+ * `::`, and the prefix length only when it is shorter than the whole address. `undefined` for text
201
+ * PostgreSQL does not read as an `inet` value.
202
+ */
203
+ function storedInet(text) {
204
+ if (text.includes(":")) {
205
+ const value = readIpv6(text);
206
+ return value === void 0 ? void 0 : printIpv6(value);
207
+ }
208
+ const value = readIpv4(text);
209
+ return value === void 0 ? void 0 : printIpv4(value);
210
+ }
211
+ /**
212
+ * PostgreSQL's `inet_net_pton_ipv4`: one to four decimal octets, each up to 255 and leading zeros
213
+ * allowed, then an optional `/` and prefix length up to 32. Without a prefix length all four octets
214
+ * are required; with one, the octets written must cover it.
215
+ */
216
+ function readIpv4(text) {
217
+ const octets = [];
218
+ let index = 0;
219
+ let ch = text[index++];
220
+ while (isDigit(ch)) {
221
+ let octet = 0;
222
+ do {
223
+ octet = octet * 10 + Number(ch);
224
+ if (octet > 255) return void 0;
225
+ ch = text[index++];
226
+ } while (isDigit(ch));
227
+ if (octets.length === 4) return void 0;
228
+ octets.push(octet);
229
+ if (ch === void 0 || ch === "/") break;
230
+ if (ch !== ".") return void 0;
231
+ ch = text[index++];
232
+ }
233
+ let bits = -1;
234
+ if (ch === "/" && isDigit(text[index]) && octets.length > 0) {
235
+ ch = text[index++];
236
+ bits = 0;
237
+ do {
238
+ bits = bits * 10 + Number(ch);
239
+ ch = text[index++];
240
+ } while (isDigit(ch));
241
+ if (ch !== void 0 || bits > 32) return void 0;
242
+ }
243
+ if (ch !== void 0) return void 0;
244
+ if (bits === -1) {
245
+ if (octets.length !== 4) return void 0;
246
+ bits = 32;
247
+ }
248
+ if (octets.length === 0 || Math.floor(bits / 8) > octets.length) return void 0;
249
+ return {
250
+ bytes: [
251
+ ...octets,
252
+ 0,
253
+ 0,
254
+ 0,
255
+ 0
256
+ ].slice(0, 4),
257
+ bits
258
+ };
259
+ }
260
+ /** PostgreSQL's `getbits`: a prefix length up to 128, with no leading zero. */
261
+ function readBits(text) {
262
+ let bits = 0;
263
+ let digits = 0;
264
+ for (const ch of text) {
265
+ if (!isDigit(ch)) return void 0;
266
+ if (digits++ !== 0 && bits === 0) return void 0;
267
+ bits = bits * 10 + Number(ch);
268
+ if (bits > 128) return void 0;
269
+ }
270
+ return digits === 0 ? void 0 : bits;
271
+ }
272
+ /**
273
+ * PostgreSQL's `getv4`, for the IPv4 tail of an IPv6 address: up to four decimal octets with no
274
+ * leading zeros, and an optional prefix length. Octets left out are zero.
275
+ */
276
+ function readIpv4Tail(text) {
277
+ const octets = [];
278
+ let octet = 0;
279
+ let digits = 0;
280
+ for (const [index, ch] of [...text].entries()) {
281
+ if (isDigit(ch)) {
282
+ if (digits++ !== 0 && octet === 0) return void 0;
283
+ octet = octet * 10 + Number(ch);
284
+ if (octet > 255) return void 0;
285
+ continue;
286
+ }
287
+ if (ch !== "." && ch !== "/") return void 0;
288
+ if (octets.length > 3) return void 0;
289
+ octets.push(octet);
290
+ if (ch === "/") {
291
+ const bits = readBits(text.slice(index + 1));
292
+ return bits === void 0 ? void 0 : {
293
+ octets,
294
+ bits
295
+ };
296
+ }
297
+ octet = 0;
298
+ digits = 0;
299
+ }
300
+ if (digits === 0 || octets.length > 3) return void 0;
301
+ return {
302
+ octets: [...octets, octet],
303
+ bits: void 0
304
+ };
305
+ }
306
+ /**
307
+ * PostgreSQL's `inet_cidr_pton_ipv6`: up to eight groups of one to four hex digits in either case,
308
+ * one `::` standing for a run of zero groups, an optional IPv4 tail, and an optional prefix length.
309
+ */
310
+ function readIpv6(text) {
311
+ const bytes = new Array(16).fill(0);
312
+ let filled = 0;
313
+ let compressedAt;
314
+ let index = 0;
315
+ if (text[0] === ":") {
316
+ if (text[1] !== ":") return void 0;
317
+ index = 1;
318
+ }
319
+ let tokenStart = index;
320
+ let sawHexDigit = false;
321
+ let group = 0;
322
+ let groupDigits = 0;
323
+ let bits = 128;
324
+ while (index < text.length) {
325
+ const ch = text[index++] ?? "";
326
+ if (HEX_DIGIT.test(ch)) {
327
+ group = group << 4 | Number.parseInt(ch, 16);
328
+ if (++groupDigits > 4) return void 0;
329
+ sawHexDigit = true;
330
+ continue;
331
+ }
332
+ if (ch === ":") {
333
+ tokenStart = index;
334
+ if (!sawHexDigit) {
335
+ if (compressedAt !== void 0) return void 0;
336
+ compressedAt = filled;
337
+ continue;
338
+ }
339
+ if (index >= text.length || filled + 2 > 16) return void 0;
340
+ bytes[filled++] = group >> 8;
341
+ bytes[filled++] = group & 255;
342
+ sawHexDigit = false;
343
+ group = 0;
344
+ groupDigits = 0;
345
+ continue;
346
+ }
347
+ if (ch === "." && filled + 4 <= 16) {
348
+ const tail = readIpv4Tail(text.slice(tokenStart));
349
+ if (tail !== void 0) {
350
+ tail.octets.forEach((octet, offset) => {
351
+ bytes[filled + offset] = octet;
352
+ });
353
+ filled += 4;
354
+ sawHexDigit = false;
355
+ bits = tail.bits ?? bits;
356
+ break;
357
+ }
358
+ }
359
+ if (ch === "/") {
360
+ const prefix = readBits(text.slice(index));
361
+ if (prefix !== void 0) {
362
+ bits = prefix;
363
+ break;
364
+ }
365
+ }
366
+ return;
367
+ }
368
+ if (sawHexDigit) {
369
+ if (filled + 2 > 16) return void 0;
370
+ bytes[filled++] = group >> 8;
371
+ bytes[filled++] = group & 255;
372
+ }
373
+ if (compressedAt !== void 0) {
374
+ if (filled === 16) return void 0;
375
+ const shifted = bytes.slice(compressedAt, filled);
376
+ bytes.fill(0, compressedAt, filled);
377
+ bytes.splice(16 - shifted.length, shifted.length, ...shifted);
378
+ filled = 16;
379
+ }
380
+ return filled === 16 ? {
381
+ bytes,
382
+ bits
383
+ } : void 0;
384
+ }
385
+ function printIpv4({ bytes, bits }) {
386
+ const address = bytes.join(".");
387
+ return bits === 32 ? address : `${address}/${bits}`;
388
+ }
389
+ /**
390
+ * PostgreSQL's `inet_net_ntop_ipv6`: the first longest run of two or more zero groups is written
391
+ * `::`, and an address whose first five groups are zero followed by `ffff`, or whose first six are
392
+ * zero, ends in dotted IPv4.
393
+ */
394
+ function printIpv6({ bytes, bits }) {
395
+ const groups = Array.from({ length: 8 }, (_, i) => (bytes[2 * i] ?? 0) << 8 | (bytes[2 * i + 1] ?? 0));
396
+ const zeroRun = longestZeroRun(groups);
397
+ let text = "";
398
+ for (let i = 0; i < 8; i++) {
399
+ if (zeroRun !== void 0 && i >= zeroRun.start && i < zeroRun.start + zeroRun.length) {
400
+ if (i === zeroRun.start) text += ":";
401
+ continue;
402
+ }
403
+ if (i !== 0) text += ":";
404
+ if (i === 6 && zeroRun?.start === 0 && (zeroRun.length === 6 || zeroRun.length === 5 && groups[5] === 65535)) {
405
+ text += bytes.slice(12).join(".");
406
+ break;
407
+ }
408
+ text += (groups[i] ?? 0).toString(16);
409
+ }
410
+ if (zeroRun !== void 0 && zeroRun.start + zeroRun.length === 8) text += ":";
411
+ return bits === 128 ? text : `${text}/${bits}`;
412
+ }
413
+ function longestZeroRun(groups) {
414
+ let best;
415
+ let current;
416
+ for (const [i, group] of groups.entries()) {
417
+ if (group === 0) {
418
+ current = current === void 0 ? {
419
+ start: i,
420
+ length: 1
421
+ } : {
422
+ ...current,
423
+ length: current.length + 1
424
+ };
425
+ continue;
426
+ }
427
+ if (current !== void 0 && (best === void 0 || current.length > best.length)) best = current;
428
+ current = void 0;
429
+ }
430
+ if (current !== void 0 && (best === void 0 || current.length > best.length)) best = current;
431
+ return best !== void 0 && best.length >= 2 ? best : void 0;
432
+ }
433
+ /** A cast between two types that store the same shape: the value is already the form this type stores. */
434
+ const unchanged = (value) => value;
435
+ function wrongShape(value, expected) {
436
+ throw structuredError("CONTRACT.CAST_REFUSED", `Expected ${expected}, got ${JSON.stringify(value)}.`, {
437
+ why: "A cast reads the stored form of the type it takes values of.",
438
+ fix: "Hand the cast a value in the shape its source type stores."
439
+ });
440
+ }
441
+ /** A whole number as the digit text `int8` and `numeric` store. */
442
+ const asNumeralText = (value) => typeof value === "number" ? numeralText(value) : wrongShape(value, "a number");
443
+ /**
444
+ * A number as the floating-point types store it: a JSON number, or one of the three words, which
445
+ * those types keep as text. A magnitude past what a double holds is refused rather than rounded to
446
+ * a word: the database refuses it too, and storing `Infinity` would make a written number
447
+ * indistinguishable from a written `Infinity`.
448
+ */
449
+ const asFloat = (value) => {
450
+ if (typeof value === "number") return value;
451
+ if (typeof value !== "string") return wrongShape(value, "a number or numeral text");
452
+ if (isNonFiniteText(value)) return value;
453
+ const converted = Number(value);
454
+ if (Number.isFinite(converted)) return converted;
455
+ throw structuredError("CONTRACT.CAST_REFUSED", `${value} is out of range: no double holds a number that large.`, {
456
+ why: "The floating-point types store a double, which holds magnitudes up to about 1.8e308.",
457
+ fix: "Use a number a double holds, or a numeric column."
458
+ });
459
+ };
460
+ const written = (text) => ({
461
+ text,
462
+ written: true
463
+ });
464
+ const catalog = (text) => ({
465
+ text,
466
+ catalog: true
467
+ });
468
+ const writtenAndCatalog = (text) => ({
469
+ text,
470
+ written: true,
471
+ catalog: true
472
+ });
473
+ const claimsOnly = (text) => ({ text });
474
+ const anyJson = (json) => json;
475
+ const readString = (id) => (json) => readJsonString(id, json);
476
+ /** A parameter a type declares as a whole number, or undefined when the column does not set it. */
477
+ function integerParam(params, name) {
478
+ const value = params[name];
479
+ return typeof value === "number" ? value : void 0;
480
+ }
481
+ /** A decimal numeral: an optional minus sign, digits, and an optional fraction. */
482
+ const DECIMAL_NUMERAL_TEXT = /^-?\d+(?:\.\d+)?$/;
483
+ /**
484
+ * Numeric text in the form PostgreSQL *prints*, which is narrower than the form it accepts.
485
+ *
486
+ * `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`.
487
+ *
488
+ * `NaN`, `Infinity` and `-Infinity` are genuine `numeric` values, which PostgreSQL emits into JSON as strings.
489
+ */
490
+ const STORED_NUMERIC_TEXT = /^(?:(?!-0(?:\.0+)?$)-?(?:0|[1-9]\d*)(?:\.\d+)?|NaN|-?Infinity)$/;
491
+ /**
492
+ * 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.
493
+ */
494
+ function fitsNumeric(text, precision, scale) {
495
+ if (text === "NaN") return true;
496
+ if (text.endsWith("Infinity")) return false;
497
+ const [whole = "", fraction = ""] = text.replace(/^-/, "").split(".");
498
+ const significantFraction = withoutTrailing(fraction, "0");
499
+ const digits = `${whole}${significantFraction}`.replace(/^0+/, "");
500
+ if (digits === "") return true;
501
+ const shift = scale - significantFraction.length;
502
+ if (shift >= 0) return digits.length + shift <= precision;
503
+ const units = withoutTrailing(digits, "0");
504
+ if (digits.length - units.length < -shift) return false;
505
+ return digits.length + shift <= precision;
506
+ }
507
+ const readNumeric = (json, params) => {
508
+ if (typeof json !== "string" || !STORED_NUMERIC_TEXT.test(json)) {
509
+ const printed = typeof json === "string" && DECIMAL_NUMERAL_TEXT.test(json) ? storedNumeralText(json) : void 0;
510
+ return refuseJsonValue("pg/numeric", printed === void 0 ? "a decimal string" : `"${printed}", as PostgreSQL writes this value`, json);
511
+ }
512
+ const precision = integerParam(params, "precision");
513
+ if (precision === void 0) return json;
514
+ const scale = integerParam(params, "scale") ?? 0;
515
+ if (!fitsNumeric(json, precision, scale)) return refuseJsonValue("pg/numeric", `a decimal string that numeric(${precision}, ${scale}) stores without rounding`, json);
516
+ return json;
517
+ };
518
+ /** 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. */
519
+ const spellNumeric = (json, params) => {
520
+ if (integerParam(params, "precision") === void 0 || typeof json !== "string" || json === "NaN") return json;
521
+ const scale = integerParam(params, "scale") ?? 0;
522
+ const [whole = "", fraction = ""] = json.split(".");
523
+ return scale <= 0 ? whole : `${whole}.${fraction.slice(0, scale).padEnd(scale, "0")}`;
524
+ };
525
+ const readFloat4 = (json) => {
526
+ const value = readJsonFloat("pg/float4", json);
527
+ if (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);
528
+ return json;
529
+ };
530
+ /** A `character` value is spelled without the spaces that pad it to its length, as the application reads it. */
531
+ const spellCharacter = (json) => typeof json === "string" ? withoutTrailing(json, " ") : json;
532
+ /** 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. */
533
+ const readCharacter = (json, params) => {
534
+ const length = integerParam(params, "length") ?? 1;
535
+ if (!fitsCharacterLength(readJsonString("pg/char", json), length, true)) return refuseJsonValue("pg/char", `a string of at most ${counted(length, "character")} before any trailing spaces`, json);
536
+ return json;
537
+ };
538
+ /** A `character varying` column with a length holds at most that many characters. */
539
+ const readCharacterVarying = (json, params) => {
540
+ const length = integerParam(params, "length");
541
+ const text = readJsonString("pg/varchar", json);
542
+ if (length !== void 0 && !fitsCharacterLength(text, length, false)) return refuseJsonValue("pg/varchar", `a string of at most ${counted(length, "character")}`, json);
543
+ return json;
544
+ };
545
+ const BIT_STRING = /^[01]*$/;
546
+ /** A `bit` column holds exactly its length in bits, and one with no length is `bit(1)`. */
547
+ const readBit = (json, params) => {
548
+ const length = integerParam(params, "length") ?? 1;
549
+ if (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);
550
+ return json;
551
+ };
552
+ /** A `bit varying` column with a length holds at most that many bits. */
553
+ const readBitVarying = (json, params) => {
554
+ const length = integerParam(params, "length");
555
+ const bits = readJsonMatching("pg/varbit", json, BIT_STRING, "a string of 0 and 1 digits");
556
+ if (length !== void 0 && bits.length > length) return refuseJsonValue("pg/varbit", `a string of at most ${counted(length, "bit")}`, json);
557
+ return json;
558
+ };
559
+ /** A `text[]` may hold NULL elements, which PostgreSQL writes as JSON `null`. */
560
+ const readTextArray = (json) => {
561
+ const expected = "an array of strings and nulls";
562
+ if (!Array.isArray(json)) return refuseJsonValue("pg/text-array", expected, json);
563
+ for (const entry of json) if (entry !== null && typeof entry !== "string") return refuseJsonValue("pg/text-array", expected, entry);
564
+ return json;
565
+ };
566
+ /** Reads a UUID in any spelling PostgreSQL reads; `spellUuid` gives it the one it stores. */
567
+ const 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);
568
+ /** A UUID is stored as PostgreSQL prints it: lower case, hyphenated 8-4-4-4-12. */
569
+ const spellUuid = (json) => typeof json === "string" ? storedUuid(json) ?? json : json;
570
+ /** Reads an address in any spelling PostgreSQL reads; `spellInet` gives it the one it stores. */
571
+ const 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);
572
+ /** An address is stored as PostgreSQL prints it. */
573
+ const spellInet = (json) => typeof json === "string" ? storedInet(json) ?? json : json;
574
+ /** The fraction digits of a second the date, time and interval types hold when a column sets no precision: microseconds. */
575
+ const MICROSECOND_DIGITS = 6;
576
+ /**
577
+ * 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.
578
+ */
579
+ function refuseFinerThanPrecision(typeId, json, fraction, params) {
580
+ const precision = integerParam(params, "precision") ?? MICROSECOND_DIGITS;
581
+ if (withoutTrailing(fraction ?? "", "0").length <= precision) return json;
582
+ return refuseJsonValue(typeId, `a value with at most ${counted(precision, "fraction digit")} of a second, which precision ${precision} holds without rounding`, json);
583
+ }
584
+ /** What `storedText` writes for `text`, or why it cannot read it. */
585
+ function storedSpelling(storedText, text) {
586
+ try {
587
+ return { stored: storedText(text) };
588
+ } catch (error) {
589
+ if (isStructuredError(error) && error.code === "CONTRACT.CAST_REFUSED") return { reason: error.message };
590
+ throw error;
591
+ }
592
+ }
593
+ /**
594
+ * 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.
595
+ */
596
+ const readStoredDateTime = (typeId, storedText, description, fraction) => (json, params) => {
597
+ if (typeof json !== "string") return refuseJsonValue(typeId, description, json);
598
+ const spelling = storedSpelling(storedText, json);
599
+ if ("reason" in spelling) return refuseJsonValue(typeId, `${description}: ${spelling.reason}`, json);
600
+ refuseFinerThanPrecision(typeId, json, fraction.exec(spelling.stored)?.[1], params);
601
+ return json;
602
+ };
603
+ /** The stored spelling of a date or time value: what `storedText` writes. */
604
+ const spellStoredDateTime = (storedText) => (json) => {
605
+ if (typeof json !== "string") return json;
606
+ const spelling = storedSpelling(storedText, json);
607
+ return "stored" in spelling ? spelling.stored : json;
608
+ };
609
+ const SECONDS_FRACTION = /:\d{2}\.(\d+)/;
610
+ const INTERVAL_SECONDS_FRACTION = /\d\.(\d+)S$/;
611
+ /** The precision and scale of `numeric`. PostgreSQL 15 and later take a negative scale and one above the precision. */
612
+ const pgNumericParams = type({
613
+ "precision?": "number.integer >= 1 & number.integer <= 1000",
614
+ "scale?": "number.integer >= -1000 & number.integer <= 1000"
615
+ }).narrow((params, ctx) => params.scale === void 0 || params.precision !== void 0 || ctx.reject({
616
+ path: ["scale"],
617
+ message: "scale requires a precision"
618
+ }));
619
+ /** The length of `char` and `varchar`. */
620
+ const pgCharacterLengthParams = type({ "length?": "number.integer >= 1 & number.integer <= 10485760" });
621
+ /** The length of `bit` and `bit varying`. */
622
+ const pgBitLengthParams = type({ "length?": "number.integer >= 1 & number.integer <= 83886080" });
623
+ /** The fractional-second precision of the time, timestamp and interval types. */
624
+ const pgPrecisionParams = type({ "precision?": "number.integer >= 0 & number.integer <= 6" });
625
+ const pgEnumParams = type({ typeName: "string > 0" });
626
+ /** A type with no parameters that is written and reported by its own name. */
627
+ const namedOnly = (id, name, read, casts = {}) => sqlDataType(id, {
628
+ texts: [writtenAndCatalog(name)],
629
+ read,
630
+ casts
631
+ });
632
+ const withDefaultLength = (params) => params.length === void 0 ? {
633
+ ...params,
634
+ length: 1
635
+ } : params;
636
+ const pgText = namedOnly("pg/text", "text", readString("pg/text"));
637
+ const pgTextArray = sqlDataType("pg/text-array", { read: readTextArray });
638
+ /** The enum's `typeName`: its name in `public` or with no schema, its schema-qualified name elsewhere. */
639
+ function qualifiedEnumName(reported) {
640
+ const name = reported.name ?? "";
641
+ return reported.schema === void 0 || reported.schema === "public" ? name : `${reported.schema}.${name}`;
642
+ }
643
+ const pgEnum = sqlDataType("pg/enum", {
644
+ params: pgEnumParams,
645
+ read: readString("pg/enum"),
646
+ claimsKind: "enum",
647
+ render: ({ typeName }) => {
648
+ const dot = typeName.indexOf(".");
649
+ return dot === -1 ? quoteIdentifier(typeName) : `${quoteIdentifier(typeName.slice(0, dot))}.${quoteIdentifier(typeName.slice(dot + 1))}`;
650
+ },
651
+ fromReported: (reported) => ({ typeName: qualifiedEnumName(reported) })
652
+ });
653
+ const pgInt2 = sqlDataType("pg/int2", {
654
+ texts: [written("int2"), catalog("smallint")],
655
+ read: (json) => readJsonInteger("pg/int2", json, {
656
+ min: -32768,
657
+ max: 32767
658
+ })
659
+ });
660
+ const pgBool = sqlDataType("pg/bool", {
661
+ texts: [written("bool"), catalog("boolean")],
662
+ read: (json) => readJsonBoolean("pg/bool", json)
663
+ });
664
+ const pgJson = namedOnly("pg/json", "json", anyJson);
665
+ const pgTsquery = namedOnly("pg/tsquery", "tsquery", readString("pg/tsquery"));
666
+ const pgInt4 = sqlDataType("pg/int4", {
667
+ texts: [
668
+ written("int4"),
669
+ catalog("integer"),
670
+ claimsOnly("int")
671
+ ],
672
+ read: (json) => readJsonInteger("pg/int4", json, INT32_RANGE),
673
+ casts: { [pgInt2.id]: unchanged }
674
+ });
675
+ const pgInt8 = sqlDataType("pg/int8", {
676
+ texts: [written("int8"), catalog("bigint")],
677
+ read: (json) => {
678
+ readJsonIntegerText("pg/int8", json, INT64_RANGE);
679
+ return json;
680
+ },
681
+ casts: {
682
+ [pgInt2.id]: asNumeralText,
683
+ [pgInt4.id]: asNumeralText
684
+ }
685
+ });
686
+ const pgNumeric = sqlDataType("pg/numeric", {
687
+ params: pgNumericParams,
688
+ texts: [
689
+ writtenAndCatalog("numeric"),
690
+ written("numeric({precision})"),
691
+ writtenAndCatalog("numeric({precision},{scale})"),
692
+ claimsOnly("decimal"),
693
+ claimsOnly("decimal({precision})"),
694
+ claimsOnly("decimal({precision},{scale})")
695
+ ],
696
+ read: readNumeric,
697
+ spell: spellNumeric,
698
+ normalize: (params) => params.precision !== void 0 && params.scale === void 0 ? {
699
+ ...params,
700
+ scale: 0
701
+ } : params,
702
+ casts: {
703
+ [pgInt2.id]: asNumeralText,
704
+ [pgInt4.id]: asNumeralText,
705
+ [pgInt8.id]: unchanged
706
+ }
707
+ });
708
+ /** `float4` stores a single-precision float, so a magnitude past about 3.4e38, or one it would round to 0, does not fit. */
709
+ const asFloat4 = (value) => {
710
+ const converted = asFloat(value);
711
+ if (typeof converted !== "number" || fitsFloat4(converted)) return converted;
712
+ throw structuredError("CONTRACT.CAST_REFUSED", `${converted} is out of range: float4 holds a nonzero magnitude from about 1.4e-45 to 3.4e38.`, {
713
+ why: "float4 stores a single-precision float, which overflows past about 3.4e38 and rounds a magnitude below about 1.4e-45 to 0.",
714
+ fix: "Use a number float4 holds, or a float8 or numeric column."
715
+ });
716
+ };
717
+ const floatCastsOf = (cast) => ({
718
+ [pgInt2.id]: cast,
719
+ [pgInt4.id]: cast,
720
+ [pgInt8.id]: cast,
721
+ [pgNumeric.id]: cast
722
+ });
723
+ const pgFloat4 = sqlDataType("pg/float4", {
724
+ texts: [written("float4"), catalog("real")],
725
+ read: readFloat4,
726
+ casts: floatCastsOf(asFloat4)
727
+ });
728
+ const pgFloat8 = sqlDataType("pg/float8", {
729
+ texts: [
730
+ written("float8"),
731
+ catalog("double precision"),
732
+ claimsOnly("float")
733
+ ],
734
+ read: (json) => {
735
+ readJsonFloat("pg/float8", json);
736
+ return json;
737
+ },
738
+ casts: floatCastsOf(asFloat)
739
+ });
740
+ const pgJsonb = namedOnly("pg/jsonb", "jsonb", anyJson, { [pgJson.id]: unchanged });
741
+ const fromText = { [pgText.id]: unchanged };
742
+ const pgChar = sqlDataType("pg/char", {
743
+ params: pgCharacterLengthParams,
744
+ texts: [
745
+ written("character"),
746
+ writtenAndCatalog("character({length})"),
747
+ claimsOnly("char"),
748
+ claimsOnly("char({length})")
749
+ ],
750
+ read: readCharacter,
751
+ spell: spellCharacter,
752
+ normalize: withDefaultLength,
753
+ casts: fromText
754
+ });
755
+ const pgVarchar = sqlDataType("pg/varchar", {
756
+ params: pgCharacterLengthParams,
757
+ texts: [
758
+ writtenAndCatalog("character varying"),
759
+ writtenAndCatalog("character varying({length})"),
760
+ claimsOnly("varchar"),
761
+ claimsOnly("varchar({length})")
762
+ ],
763
+ read: readCharacterVarying,
764
+ casts: fromText
765
+ });
766
+ /** Text in any form PostgreSQL reads as a UUID, written the way PostgreSQL writes it, so the contract holds the value the database reports. */
767
+ const asUuid = (value) => {
768
+ if (typeof value !== "string") return wrongShape(value, "text");
769
+ const uuid = storedUuid(value);
770
+ if (uuid !== void 0) return uuid;
771
+ throw 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.`, {
772
+ why: "A uuid column takes only text PostgreSQL reads as a UUID.",
773
+ fix: "Write a UUID such as a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11."
774
+ });
775
+ };
776
+ const pgUuid = sqlDataType("pg/uuid", {
777
+ texts: [writtenAndCatalog("uuid")],
778
+ read: readUuid,
779
+ spell: spellUuid,
780
+ casts: { [pgText.id]: asUuid }
781
+ });
782
+ const pgBit = sqlDataType("pg/bit", {
783
+ params: pgBitLengthParams,
784
+ texts: [written("bit"), writtenAndCatalog("bit({length})")],
785
+ read: readBit,
786
+ normalize: withDefaultLength,
787
+ casts: fromText
788
+ });
789
+ const pgVarbit = sqlDataType("pg/varbit", {
790
+ params: pgBitLengthParams,
791
+ texts: [
792
+ writtenAndCatalog("bit varying"),
793
+ writtenAndCatalog("bit varying({length})"),
794
+ claimsOnly("varbit"),
795
+ claimsOnly("varbit({length})")
796
+ ],
797
+ read: readBitVarying,
798
+ casts: fromText
799
+ });
800
+ const INFINITIES = /* @__PURE__ */ new Set(["infinity", "-infinity"]);
801
+ /**
802
+ * The stored form of a date or time type (ADR 254), from ISO 8601 or the text PostgreSQL prints.
803
+ * `infinity` and `-infinity` are values of the types that hold them.
804
+ */
805
+ function postgresDateTime(options, holdsInfinity) {
806
+ return (text) => holdsInfinity && INFINITIES.has(text) ? text : dateTimeStoredText(isoYearText(text), options, text);
807
+ }
808
+ /**
809
+ * Each range is what PostgreSQL and every codec of the type hold: PostgreSQL starts at 4714-11-24
810
+ * BC, and the `Temporal` and `Date` codecs end at +275760-09-13.
811
+ */
812
+ const pgDateStoredText = postgresDateTime({
813
+ shape: "date",
814
+ ownerId: "pg/date",
815
+ range: {
816
+ earliest: "-004713-11-24",
817
+ latest: "+275760-09-13"
818
+ }
819
+ }, true);
820
+ const pgTimeStoredText = postgresDateTime({
821
+ shape: "time",
822
+ ownerId: "pg/time"
823
+ }, false);
824
+ const pgTimetzStoredText = postgresDateTime({
825
+ shape: "timeWithOffset",
826
+ ownerId: "pg/timetz",
827
+ maxOffsetHours: 15
828
+ }, false);
829
+ const pgTimestampStoredText = postgresDateTime({
830
+ shape: "dateTime",
831
+ ownerId: "pg/timestamp",
832
+ range: {
833
+ earliest: "-004713-11-24T00:00:00",
834
+ latest: "+275760-09-13T23:59:59.999999"
835
+ }
836
+ }, true);
837
+ const pgTimestamptzStoredText = postgresDateTime({
838
+ shape: "instant",
839
+ ownerId: "pg/timestamptz",
840
+ range: {
841
+ earliest: "-004713-11-24T00:00:00Z",
842
+ latest: "+275760-09-13T00:00:00Z"
843
+ }
844
+ }, true);
845
+ /** A cast that takes text and gives the value `read` makes of it. */
846
+ const castFromText = (read) => (value) => typeof value === "string" ? read(value) : wrongShape(value, "text");
847
+ const pgTimetz = sqlDataType("pg/timetz", {
848
+ read: 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),
849
+ spell: spellStoredDateTime(pgTimetzStoredText),
850
+ params: pgPrecisionParams,
851
+ texts: [
852
+ written("timetz"),
853
+ written("timetz({precision})"),
854
+ catalog("time with time zone"),
855
+ catalog("time({precision}) with time zone")
856
+ ]
857
+ });
858
+ const pgInterval = sqlDataType("pg/interval", {
859
+ read: readStoredDateTime("pg/interval", pgIntervalStoredText, "an ISO 8601 duration, as in \"P1Y2M3DT4H5M6.5S\"", INTERVAL_SECONDS_FRACTION),
860
+ spell: spellStoredDateTime(pgIntervalStoredText),
861
+ params: pgPrecisionParams,
862
+ texts: [writtenAndCatalog("interval"), writtenAndCatalog("interval({precision})")]
863
+ });
864
+ const pgBytea = sqlDataType("pg/bytea", {
865
+ read: (json) => readPgByteaJson("pg/bytea", json),
866
+ spell: spellPgByteaJson,
867
+ texts: [writtenAndCatalog("bytea")]
868
+ });
869
+ /** Text PostgreSQL reads as an IP address, written the way PostgreSQL writes it, so the contract holds the value the database reports. */
870
+ function pgInetStoredText(text) {
871
+ const inet = storedInet(text);
872
+ if (inet !== void 0) return inet;
873
+ throw 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.`, {
874
+ why: "An inet column takes only text PostgreSQL reads as an IP address.",
875
+ fix: "Write an address such as 192.168.0.1 or 2001:db8::1/64."
876
+ });
877
+ }
878
+ const pgInet = sqlDataType("pg/inet", {
879
+ read: readInet,
880
+ spell: spellInet,
881
+ texts: [writtenAndCatalog("inet")],
882
+ casts: { [pgText.id]: castFromText(pgInetStoredText) }
883
+ });
884
+ const pgDate = sqlDataType("pg/date", {
885
+ read: readStoredDateTime("pg/date", pgDateStoredText, "a date, as in \"2024-01-01\", or infinity or -infinity", SECONDS_FRACTION),
886
+ spell: spellStoredDateTime(pgDateStoredText),
887
+ texts: [writtenAndCatalog("date")]
888
+ });
889
+ const pgTime = sqlDataType("pg/time", {
890
+ read: readStoredDateTime("pg/time", pgTimeStoredText, "a time of day, as in \"12:34:56\"", SECONDS_FRACTION),
891
+ spell: spellStoredDateTime(pgTimeStoredText),
892
+ params: pgPrecisionParams,
893
+ texts: [
894
+ written("time"),
895
+ written("time({precision})"),
896
+ catalog("time without time zone"),
897
+ catalog("time({precision}) without time zone")
898
+ ]
899
+ });
900
+ const pgTimestamp = sqlDataType("pg/timestamp", {
901
+ read: readStoredDateTime("pg/timestamp", pgTimestampStoredText, "a date and time of day, as in \"2024-01-01T12:34:56\", or infinity or -infinity", SECONDS_FRACTION),
902
+ spell: spellStoredDateTime(pgTimestampStoredText),
903
+ params: pgPrecisionParams,
904
+ texts: [
905
+ written("timestamp"),
906
+ written("timestamp({precision})"),
907
+ catalog("timestamp without time zone"),
908
+ catalog("timestamp({precision}) without time zone")
909
+ ]
910
+ });
911
+ const pgTimestamptz = sqlDataType("pg/timestamptz", {
912
+ read: readStoredDateTime("pg/timestamptz", pgTimestamptzStoredText, "an instant in UTC, as in \"2024-01-01T00:00:00Z\", or infinity or -infinity", SECONDS_FRACTION),
913
+ spell: spellStoredDateTime(pgTimestamptzStoredText),
914
+ params: pgPrecisionParams,
915
+ texts: [
916
+ written("timestamptz"),
917
+ written("timestamptz({precision})"),
918
+ catalog("timestamp with time zone"),
919
+ catalog("timestamp({precision}) with time zone")
920
+ ]
921
+ });
922
+ /** Every data type this target registers. */
923
+ const postgresDataTypes = [
924
+ pgText,
925
+ pgTextArray,
926
+ pgEnum,
927
+ pgInt2,
928
+ pgBool,
929
+ pgJson,
930
+ pgTsquery,
931
+ pgInt4,
932
+ pgInt8,
933
+ pgNumeric,
934
+ pgFloat4,
935
+ pgFloat8,
936
+ pgJsonb,
937
+ pgChar,
938
+ pgVarchar,
939
+ pgUuid,
940
+ pgInet,
941
+ pgBit,
942
+ pgVarbit,
943
+ pgTimetz,
944
+ pgInterval,
945
+ pgBytea,
946
+ pgDate,
947
+ pgTime,
948
+ pgTimestamp,
949
+ pgTimestamptz
950
+ ];
951
+ /** A lookup of the data types this target registers. */
952
+ function createPostgresBuiltinDataTypeLookup() {
953
+ return assembleDataTypes([{
954
+ id: "postgres",
955
+ dataTypes: postgresDataTypes
956
+ }]).lookup;
957
+ }
958
+ //#endregion
959
+ export { pgJsonb as A, pgTimestamptz as B, pgInet as C, pgInterval as D, pgInt8 as E, pgTextArray as F, pgUuid as G, pgTimetz as H, pgTime as I, postgresDataTypes as J, pgVarbit as K, pgTimeStoredText as L, pgNumericParams as M, pgPrecisionParams as N, pgIntervalStoredText as O, pgText as P, pgTimestamp as R, pgFloat8 as S, pgInt4 as T, pgTimetzStoredText as U, pgTimestamptzStoredText as V, pgTsquery as W, postgresYearText as X, postgresIntervalFields as Y, pgDate as _, formatIsoDuration as a, pgEnumParams as b, microsFromFraction as c, pgBool as d, pgBytea as f, pgCharacterLengthParams as g, pgChar as h, createPostgresBuiltinDataTypeLookup as i, pgNumeric as j, pgJson as k, pgBit as l, pgByteaHexText as m, ISO_DURATION as n, intervalFieldsOf as o, pgByteaFromHexText as p, pgVarchar as q, MICROS_PER_SECOND as r, isoYearText as s, BYTEA_TEXT as t, pgBitLengthParams as u, pgDateStoredText as v, pgInt2 as w, pgFloat4 as x, pgEnum as y, pgTimestampStoredText as z };
960
+
961
+ //# sourceMappingURL=data-types-BIvSDTYw-AK5Is74Z.mjs.map