@prisma/orm-target-postgres 8.0.0-rc.14-dev.5 → 8.0.0-rc.14-dev.7

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 (192) hide show
  1. package/dist/{adapter-Bz6wSV__-Dp93eiiH.mjs → adapter-Bb_FFDea-O-uPaHCy.mjs} +5 -5
  2. package/dist/{adapter-Bz6wSV__-Dp93eiiH.mjs.map → adapter-Bb_FFDea-O-uPaHCy.mjs.map} +1 -1
  3. package/dist/{adapter-DP_SQYED.d.mts → adapter-WLK_P3mT.d.mts} +3 -3
  4. package/dist/{adapter-DP_SQYED.d.mts.map → adapter-WLK_P3mT.d.mts.map} +1 -1
  5. package/dist/adapter.d.mts +8 -8
  6. package/dist/adapter.mjs +6 -6
  7. package/dist/adapter__adapter.d.mts +1 -1
  8. package/dist/adapter__adapter.mjs +1 -1
  9. package/dist/adapter__control.d.mts +3 -3
  10. package/dist/adapter__control.mjs +8 -369
  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 -5
  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/{authoring-BmQxOggr-CK871YR4.mjs → authoring-DKN1ccEX-DgmJWx1r.mjs} +4 -4
  19. package/dist/{authoring-BmQxOggr-CK871YR4.mjs.map → authoring-DKN1ccEX-DgmJWx1r.mjs.map} +1 -1
  20. package/dist/{codec-descriptor-BfoHQP3R-CMRVT-F6.mjs → codec-descriptor-B61d-k4C-BdWVU6Fu.mjs} +4 -3
  21. package/dist/codec-descriptor-B61d-k4C-BdWVU6Fu.mjs.map +1 -0
  22. package/dist/codec-descriptor-D8_e5hpo.d.mts +1 -0
  23. package/dist/{codec-descriptor-DUUGoeyI-WGLGXEoI.d.mts → codec-descriptor-HYqjI24K-CTO3gTEs.d.mts} +11 -5
  24. package/dist/codec-descriptor-HYqjI24K-CTO3gTEs.d.mts.map +1 -0
  25. package/dist/{data-types-Cl18KnNY-5I34Vd6Z.mjs → codec-helpers-D83-1eDB-nqAEMr7N.mjs} +39 -216
  26. package/dist/codec-helpers-D83-1eDB-nqAEMr7N.mjs.map +1 -0
  27. package/dist/{codec-type-map-Cp91lhQd-D6zQ14YE.d.mts → codec-type-map-DMKy_xZb-DymgX4w7.d.mts} +4 -4
  28. package/dist/{codec-type-map-Cp91lhQd-D6zQ14YE.d.mts.map → codec-type-map-DMKy_xZb-DymgX4w7.d.mts.map} +1 -1
  29. package/dist/{codec-types-BQNq7Y1u-CGfS7PuD.d.mts → codec-types-B4-xhn7m-RQS461us.d.mts} +4 -4
  30. package/dist/{codec-types-BQNq7Y1u-CGfS7PuD.d.mts.map → codec-types-B4-xhn7m-RQS461us.d.mts.map} +1 -1
  31. package/dist/codec-types-Ci1nfCYh.d.mts +2 -0
  32. package/dist/{codecs-DQGmsnk3-H6nVRPCC.mjs → codecs-BHNqtI1J-BSS9sL3H.mjs} +263 -69
  33. package/dist/codecs-BHNqtI1J-BSS9sL3H.mjs.map +1 -0
  34. package/dist/{codecs-BKV97Xsa.d.mts → codecs-Ba3gUr67.d.mts} +11 -5
  35. package/dist/{codecs-BKV97Xsa.d.mts.map → codecs-Ba3gUr67.d.mts.map} +1 -1
  36. package/dist/{codecs-BZ87E3MY-Bub4t0ma.d.mts → codecs-Bkmbmo_r-Ct7hFY0S.d.mts} +31 -10
  37. package/dist/{codecs-BZ87E3MY-Bub4t0ma.d.mts.map → codecs-Bkmbmo_r-Ct7hFY0S.d.mts.map} +1 -1
  38. package/dist/{codecs-C4DVdgQG.mjs → codecs-Cytq8Ymj.mjs} +12 -4
  39. package/dist/codecs-Cytq8Ymj.mjs.map +1 -0
  40. package/dist/control-CUzQZfhu.d.mts +399 -0
  41. package/dist/control-CUzQZfhu.d.mts.map +1 -0
  42. package/dist/{control-w3p4NYNx.mjs → control-CYQReJto.mjs} +441 -72
  43. package/dist/control-CYQReJto.mjs.map +1 -0
  44. package/dist/{control-DxJWBVjs.d.mts → control-DoIm71dz.d.mts} +5 -4
  45. package/dist/control-DoIm71dz.d.mts.map +1 -0
  46. package/dist/{control-adapter-Buuq3v1c-DtBZerak.mjs → control-adapter-C6kz--Q4-3C9-f7Uv.mjs} +78 -95
  47. package/dist/control-adapter-C6kz--Q4-3C9-f7Uv.mjs.map +1 -0
  48. package/dist/{control-policy-BYo5QPof-BLT07t1y.mjs → control-policy-voGArjr--BeHlQRg0.mjs} +19 -17
  49. package/dist/control-policy-voGArjr--BeHlQRg0.mjs.map +1 -0
  50. package/dist/{data-type-entries-CvkBtAG--D-5Wtm9_.mjs → data-type-entries-BDSHvsdE-Bbe1cdbR.mjs} +3 -3
  51. package/dist/{data-type-entries-CvkBtAG--D-5Wtm9_.mjs.map → data-type-entries-BDSHvsdE-Bbe1cdbR.mjs.map} +1 -1
  52. package/dist/data-types-BqeC7aZP-CwvA08pH.mjs +200 -0
  53. package/dist/data-types-BqeC7aZP-CwvA08pH.mjs.map +1 -0
  54. package/dist/{default-normalizer-Bp3IhMR9-D0uYVRLZ.mjs → default-normalizer-Cb7nWBUa-DXchlOUk.mjs} +82 -19
  55. package/dist/default-normalizer-Cb7nWBUa-DXchlOUk.mjs.map +1 -0
  56. package/dist/{descriptor-meta-F1wsOtt2-D014LIGM.mjs → descriptor-meta-BEigA5Gj-By_dcUjB.mjs} +9 -7
  57. package/dist/descriptor-meta-BEigA5Gj-By_dcUjB.mjs.map +1 -0
  58. package/dist/{descriptor-meta-BOx9pvBv-C4TEXck8.mjs → descriptor-meta-DF0hODA0-DnO80XvH.mjs} +4 -4
  59. package/dist/{descriptor-meta-BOx9pvBv-C4TEXck8.mjs.map → descriptor-meta-DF0hODA0-DnO80XvH.mjs.map} +1 -1
  60. package/dist/{diff-database-schema-BP4uAPZZ-8ljuCPav.mjs → diff-database-schema-MYPfxeRf-DdgnOIIl.mjs} +17 -7
  61. package/dist/diff-database-schema-MYPfxeRf-DdgnOIIl.mjs.map +1 -0
  62. package/dist/{full-text-jDpkANi7.d.mts → full-text-Cth_mXe_.d.mts} +2 -2
  63. package/dist/{full-text-jDpkANi7.d.mts.map → full-text-Cth_mXe_.d.mts.map} +1 -1
  64. package/dist/{full-text-index-expression-PZszha7L-CW7i1TUY.mjs → full-text-index-expression-BM_vGygX-BOuja7X4.mjs} +3 -3
  65. package/dist/{full-text-index-expression-PZszha7L-CW7i1TUY.mjs.map → full-text-index-expression-BM_vGygX-BOuja7X4.mjs.map} +1 -1
  66. package/dist/{full-text-parsers-Dp_ANr31-DVxYUNS-.d.mts → full-text-parsers-CLZpb096-BN1xyHeO.d.mts} +3 -3
  67. package/dist/{full-text-parsers-Dp_ANr31-DVxYUNS-.d.mts.map → full-text-parsers-CLZpb096-BN1xyHeO.d.mts.map} +1 -1
  68. package/dist/{infer-psl-contract-MVBnqkl3-Bffp5RpV.mjs → infer-psl-contract-D7XJnfJv-Cd_Mf0UH.mjs} +78 -82
  69. package/dist/infer-psl-contract-D7XJnfJv-Cd_Mf0UH.mjs.map +1 -0
  70. package/dist/{issue-planner-D9rRu2pB.d.mts → issue-planner-C4iR-Ik-.d.mts} +2 -2
  71. package/dist/{issue-planner-D9rRu2pB.d.mts.map → issue-planner-C4iR-Ik-.d.mts.map} +1 -1
  72. package/dist/{migration-Du89zGmx.d.mts → migration-BTiY0PPC.d.mts} +3 -3
  73. package/dist/{migration-Du89zGmx.d.mts.map → migration-BTiY0PPC.d.mts.map} +1 -1
  74. package/dist/migration-PTHAY9Cv.mjs.map +1 -1
  75. package/dist/native-type-normalizer-BFo5tSyh.d.mts +37 -0
  76. package/dist/native-type-normalizer-BFo5tSyh.d.mts.map +1 -0
  77. package/dist/native-type-normalizer-CW6g9Fut-C5lMRRjS.mjs +102 -0
  78. package/dist/native-type-normalizer-CW6g9Fut-C5lMRRjS.mjs.map +1 -0
  79. package/dist/op-factory-call-Bi1XxJEv.d.mts +1 -0
  80. package/dist/{op-factory-call-t4k8mlRJ-BgtGXlIC.d.mts → op-factory-call-VLJFI-b_-Du23HNYc.d.mts} +5 -5
  81. package/dist/op-factory-call-VLJFI-b_-Du23HNYc.d.mts.map +1 -0
  82. package/dist/{op-factory-call-BBkvFvKK-7MkUHWJq.mjs → op-factory-call-y5YADY2E-CnhkIujC.mjs} +39 -26
  83. package/dist/op-factory-call-y5YADY2E-CnhkIujC.mjs.map +1 -0
  84. package/dist/{operation-types-DZyRBrnm.d.mts → operation-types-Cj4S6KNP.d.mts} +2 -2
  85. package/dist/{operation-types-DZyRBrnm.d.mts.map → operation-types-Cj4S6KNP.d.mts.map} +1 -1
  86. package/dist/{pack-B8SM_MTs.d.mts → pack-DO2bXv9P.d.mts} +3 -3
  87. package/dist/{pack-B8SM_MTs.d.mts.map → pack-DO2bXv9P.d.mts.map} +1 -1
  88. package/dist/{planner-Brs7-1mt-BFtbE0Tl.mjs → planner-DMVaXRSK-DCAGfALs.mjs} +6 -6
  89. package/dist/{planner-Brs7-1mt-BFtbE0Tl.mjs.map → planner-DMVaXRSK-DCAGfALs.mjs.map} +1 -1
  90. package/dist/{planner-o0_69Y9q.d.mts → planner-SLaWpf7q.d.mts} +2 -2
  91. package/dist/{planner-o0_69Y9q.d.mts.map → planner-SLaWpf7q.d.mts.map} +1 -1
  92. package/dist/{planner-ddl-builders-BQ_1YXut.d.mts → planner-ddl-builders-DYLyFXrj.d.mts} +2 -5
  93. package/dist/planner-ddl-builders-DYLyFXrj.d.mts.map +1 -0
  94. package/dist/{planner-ddl-builders-GTcVPpwb-ClvrXb26.mjs → planner-ddl-builders-iE35pyxA-g7b_clbn.mjs} +6 -27
  95. package/dist/planner-ddl-builders-iE35pyxA-g7b_clbn.mjs.map +1 -0
  96. package/dist/planner-produced-postgres-migration-Bi_Otmtx.d.mts +1 -0
  97. package/dist/{planner-produced-postgres-migration-DEJQPRjI-C9GuvVOY.mjs → planner-produced-postgres-migration-C8TUIl2Z-DHjubKQ-.mjs} +3 -3
  98. package/dist/{planner-produced-postgres-migration-DEJQPRjI-C9GuvVOY.mjs.map → planner-produced-postgres-migration-C8TUIl2Z-DHjubKQ-.mjs.map} +1 -1
  99. package/dist/{planner-produced-postgres-migration-Xd83anY_-vp2DJ5fk.d.mts → planner-produced-postgres-migration-CoOcn-b9-8kOq82_P.d.mts} +3 -3
  100. package/dist/planner-produced-postgres-migration-CoOcn-b9-8kOq82_P.d.mts.map +1 -0
  101. package/dist/{planner-sql-checks-Bd8nN9P8-Cd98iEee.mjs → planner-sql-checks-ZMXeCK6W-D1VMBywZ.mjs} +55 -15
  102. package/dist/planner-sql-checks-ZMXeCK6W-D1VMBywZ.mjs.map +1 -0
  103. package/dist/{postgres-contract-view-DxcRT-qe-LQBHHgaS.mjs → postgres-contract-view-BBMpf_qi-8V4vTm9U.mjs} +3 -3
  104. package/dist/{postgres-contract-view-DxcRT-qe-LQBHHgaS.mjs.map → postgres-contract-view-BBMpf_qi-8V4vTm9U.mjs.map} +1 -1
  105. package/dist/{postgres-migration-B7ihBnbW-DOmrgtms.d.mts → postgres-migration-B03W06rR-DTB0R3cj.d.mts} +4 -5
  106. package/dist/{postgres-migration-B7ihBnbW-DOmrgtms.d.mts.map → postgres-migration-B03W06rR-DTB0R3cj.d.mts.map} +1 -1
  107. package/dist/{postgres-migration-qwigEUIO-BWxjALsx.mjs → postgres-migration-UzDaU7Or-Dvc0Cdv5.mjs} +22 -5
  108. package/dist/postgres-migration-UzDaU7Or-Dvc0Cdv5.mjs.map +1 -0
  109. package/dist/{prisma7-binding-BRYHcWsx.mjs → prisma7-binding-D_Q6ou4j.mjs} +7 -6
  110. package/dist/prisma7-binding-D_Q6ou4j.mjs.map +1 -0
  111. package/dist/{prisma7-binding-1CMtcbOk.d.mts → prisma7-binding-c5vWJV6k.d.mts} +3 -3
  112. package/dist/{prisma7-binding-1CMtcbOk.d.mts.map → prisma7-binding-c5vWJV6k.d.mts.map} +1 -1
  113. package/dist/{runtime-aN2tMH8u.d.mts → runtime-Bm1hGqOh.d.mts} +2 -2
  114. package/dist/{runtime-aN2tMH8u.d.mts.map → runtime-Bm1hGqOh.d.mts.map} +1 -1
  115. package/dist/{sql-renderer-DmJ5aZwd.d.mts → sql-renderer-CfXWPuXU.d.mts} +4 -4
  116. package/dist/{sql-renderer-DmJ5aZwd.d.mts.map → sql-renderer-CfXWPuXU.d.mts.map} +1 -1
  117. package/dist/{sql-renderer-CgUgFbU4-CRUChEAY.mjs → sql-renderer-CgUgFbU4-DqTf31OD.mjs} +2 -2
  118. package/dist/{sql-renderer-CgUgFbU4-CRUChEAY.mjs.map → sql-renderer-CgUgFbU4-DqTf31OD.mjs.map} +1 -1
  119. package/dist/target.d.mts +23 -23
  120. package/dist/target.mjs +21 -22
  121. package/dist/target__codec-descriptor.d.mts +2 -2
  122. package/dist/target__codec-descriptor.mjs +1 -1
  123. package/dist/target__codec-types.d.mts +3 -3
  124. package/dist/target__codecs.d.mts +3 -3
  125. package/dist/target__codecs.mjs +3 -4
  126. package/dist/target__control.d.mts +2 -2
  127. package/dist/target__control.mjs +3 -3
  128. package/dist/target__data-types.mjs +2 -2
  129. package/dist/target__default-normalizer.mjs +1 -1
  130. package/dist/target__diff-database-schema.mjs +1 -1
  131. package/dist/target__full-text.d.mts +2 -2
  132. package/dist/target__issue-planner.d.mts +1 -1
  133. package/dist/target__issue-planner.mjs +1 -1
  134. package/dist/target__migration.d.mts +2 -2
  135. package/dist/target__migration.mjs +2 -2
  136. package/dist/target__native-type-normalizer.d.mts +2 -2
  137. package/dist/target__native-type-normalizer.mjs +2 -2
  138. package/dist/target__op-factory-call.d.mts +2 -2
  139. package/dist/target__op-factory-call.mjs +1 -1
  140. package/dist/target__operation-types.d.mts +1 -1
  141. package/dist/target__pack.d.mts +1 -1
  142. package/dist/target__pack.mjs +1 -1
  143. package/dist/target__planner-ddl-builders.d.mts +2 -2
  144. package/dist/target__planner-ddl-builders.mjs +2 -2
  145. package/dist/target__planner-produced-postgres-migration.d.mts +2 -2
  146. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  147. package/dist/target__planner-sql-checks.mjs +1 -1
  148. package/dist/target__planner.d.mts +1 -1
  149. package/dist/target__planner.mjs +2 -2
  150. package/dist/target__prisma7-binding.d.mts +1 -1
  151. package/dist/target__prisma7-binding.mjs +1 -1
  152. package/dist/target__runtime.mjs +2 -2
  153. package/dist/target__runtime.mjs.map +1 -1
  154. package/dist/target__sql-utils.mjs +1 -1
  155. package/dist/{types-BPubHbiE-mnhvO20x.d.mts → types-BPubHbiE-SaR3Cngi.d.mts} +3 -3
  156. package/dist/{types-BPubHbiE-mnhvO20x.d.mts.map → types-BPubHbiE-SaR3Cngi.d.mts.map} +1 -1
  157. package/dist/types-DvEixgWS.d.mts +2 -0
  158. package/package.json +9 -9
  159. package/dist/codec-descriptor-BfoHQP3R-CMRVT-F6.mjs.map +0 -1
  160. package/dist/codec-descriptor-Cf1qfOwo.d.mts +0 -1
  161. package/dist/codec-descriptor-DUUGoeyI-WGLGXEoI.d.mts.map +0 -1
  162. package/dist/codec-types-BXbWuRzS.d.mts +0 -2
  163. package/dist/codecs-C4DVdgQG.mjs.map +0 -1
  164. package/dist/codecs-DQGmsnk3-H6nVRPCC.mjs.map +0 -1
  165. package/dist/control-CDRHOvkm.d.mts +0 -12
  166. package/dist/control-CDRHOvkm.d.mts.map +0 -1
  167. package/dist/control-DxJWBVjs.d.mts.map +0 -1
  168. package/dist/control-adapter-Buuq3v1c-DtBZerak.mjs.map +0 -1
  169. package/dist/control-policy-BYo5QPof-BLT07t1y.mjs.map +0 -1
  170. package/dist/control-w3p4NYNx.mjs.map +0 -1
  171. package/dist/data-types-Cl18KnNY-5I34Vd6Z.mjs.map +0 -1
  172. package/dist/default-normalizer-Bp3IhMR9-D0uYVRLZ.mjs.map +0 -1
  173. package/dist/descriptor-meta-F1wsOtt2-D014LIGM.mjs.map +0 -1
  174. package/dist/diff-database-schema-BP4uAPZZ-8ljuCPav.mjs.map +0 -1
  175. package/dist/infer-psl-contract-MVBnqkl3-Bffp5RpV.mjs.map +0 -1
  176. package/dist/native-type-normalizer-DqJlOTeX.d.mts +0 -19
  177. package/dist/native-type-normalizer-DqJlOTeX.d.mts.map +0 -1
  178. package/dist/native-type-normalizer-yvd3tqv-.mjs +0 -38
  179. package/dist/native-type-normalizer-yvd3tqv-.mjs.map +0 -1
  180. package/dist/op-factory-call-7Dtfo3GK.d.mts +0 -1
  181. package/dist/op-factory-call-BBkvFvKK-7MkUHWJq.mjs.map +0 -1
  182. package/dist/op-factory-call-t4k8mlRJ-BgtGXlIC.d.mts.map +0 -1
  183. package/dist/planner-ddl-builders-BQ_1YXut.d.mts.map +0 -1
  184. package/dist/planner-ddl-builders-GTcVPpwb-ClvrXb26.mjs.map +0 -1
  185. package/dist/planner-produced-postgres-migration-B0pwyA94.d.mts +0 -1
  186. package/dist/planner-produced-postgres-migration-Xd83anY_-vp2DJ5fk.d.mts.map +0 -1
  187. package/dist/planner-sql-checks-Bd8nN9P8-Cd98iEee.mjs.map +0 -1
  188. package/dist/postgres-migration-qwigEUIO-BWxjALsx.mjs.map +0 -1
  189. package/dist/prisma7-binding-BRYHcWsx.mjs.map +0 -1
  190. package/dist/registry-ld2ZUt1j-CH85fY3r.mjs +0 -15
  191. package/dist/registry-ld2ZUt1j-CH85fY3r.mjs.map +0 -1
  192. package/dist/types-CS-qi6YZ.d.mts +0 -2
@@ -1,14 +1,17 @@
1
1
  import { A as PG_TIME_TEMPORAL_CODEC_ID, C as PG_TIMESTAMPTZ_DATE_CODEC_ID, D as PG_TIMESTAMP_TEMPORAL_CODEC_ID, E as PG_TIMESTAMP_STRING_CODEC_ID, F as PG_VARCHAR_CODEC_ID, M as PG_UNBOUNDED_INT_CODEC_ID, N as PG_UUID_CODEC_ID, O as PG_TIMETZ_CODEC_ID, P as PG_VARBIT_CODEC_ID, S as PG_TEXT_CODEC_ID, T as PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID, _ as PG_INT_CODEC_ID, a as PG_DATE_STRING_CODEC_ID, b as PG_NUMERIC_CODEC_ID, c as PG_FLOAT4_CODEC_ID, d as PG_INET_CODEC_ID, f as PG_INT2_CODEC_ID, g as PG_INTERVAL_CODEC_ID, h as PG_INT8_NUMBER_CODEC_ID, i as PG_CHAR_CODEC_ID, j as PG_TSQUERY_CODEC_ID, k as PG_TIME_STRING_CODEC_ID, l as PG_FLOAT8_CODEC_ID, m as PG_INT8_CODEC_ID, n as PG_BOOL_CODEC_ID, o as PG_DATE_TEMPORAL_CODEC_ID, p as PG_INT4_CODEC_ID, r as PG_BYTEA_CODEC_ID, s as PG_ENUM_CODEC_ID, t as PG_BIT_CODEC_ID, u as PG_FLOAT_CODEC_ID, v as PG_JSONB_CODEC_ID, w as PG_TIMESTAMPTZ_STRING_CODEC_ID, x as PG_TEXT_ARRAY_CODEC_ID, y as PG_JSON_CODEC_ID } from "./codec-ids-Cb0yO-IS--e0P2rfI.mjs";
2
- import { a as postgresCodec, r as definePostgresCodecs, t as PostgresCodecDescriptor } from "./codec-descriptor-BfoHQP3R-CMRVT-F6.mjs";
2
+ import { a as postgresCodec, r as definePostgresCodecs, t as PostgresCodecDescriptor } from "./codec-descriptor-B61d-k4C-BdWVU6Fu.mjs";
3
3
  import { a as errorTemporalUnrepresentable, i as errorTemporalUnavailableForDefault, n as errorTemporalNonIsoCalendar, o as errorTemporalWrongType, r as errorTemporalUnavailable, s as postgresError } from "./errors-DYyzTYzE-39CV_aMo.mjs";
4
- import { $ as pgTsquery, A as pgIntervalDecode, B as pgNumeric, C as pgInt8, D as pgInt8NumberEncode, E as pgInt8NumberDecodeJson, F as pgJsonDecode, G as pgTime, H as pgNumericRenderOutputType, I as pgJsonEncode, J as pgTimestampCanonical, K as pgTimeCanonical, L as pgJsonb, M as pgIntervalEncodeJson, N as pgIntervalToIso, O as pgInt8NumberEncodeJson, P as pgJson, Q as pgTimetzCanonical, R as pgJsonbDecode, S as pgInt4, T as pgInt8NumberDecode, U as pgText, V as pgNumericDecode, W as pgTextArray, X as pgTimestamptzCanonical, Y as pgTimestamptz, Z as pgTimetz, _ as pgFloatDecodeJson, a as pgBit, at as precisionParamsSchema, b as pgInet, c as pgByteaDecodeJson, d as pgChar, et as pgUnboundedIntDecode, f as pgDate, g as pgFloat8, h as pgFloat4, i as pgBigintEncodeJson, j as pgIntervalDecodeJson, k as pgInterval, l as pgByteaDecodeWire, m as pgEnum, n as decimalTextNumberLiteral, nt as pgVarbit, o as pgBool, ot as renderLength, p as pgDateCanonical, q as pgTimestamp, r as pgBigintEncode, rt as pgVarchar, s as pgBytea, st as renderPrecision, t as decimalTextBigintLiteral, tt as pgUuid, u as pgByteaEncodeJson, v as pgFloatEncode, w as pgInt8Decode, x as pgInt2, y as pgFloatEncodeJson, z as pgJsonbEncode } from "./data-types-Cl18KnNY-5I34Vd6Z.mjs";
4
+ import { A as pgUnboundedIntDecode, C as pgIntervalToIso, D as pgJsonbEncode, E as pgJsonbDecode, M as renderLength, N as renderPrecision, O as pgNumericDecode, S as pgIntervalEncodeJson, T as pgJsonEncode, _ as pgInt8NumberEncode, a as decimalTextNumberLiteral, b as pgIntervalDecode, c as pgBigintEncode, d as pgByteaDecodeWire, f as pgByteaEncodeJson, g as pgInt8NumberDecodeJson, h as pgInt8NumberDecode, i as decimalTextBigintLiteral, j as precisionParamsSchema, k as pgNumericRenderOutputType, l as pgBigintEncodeJson, m as pgInt8Decode, n as FLOAT4_MAX, o as fitsCharacterLength, p as pgFloatEncode, r as canonicalUuid, s as fitsFloat4, t as CANONICAL_UUID, u as pgByteaDecodeJson, v as pgInt8NumberEncodeJson, w as pgJsonDecode, x as pgIntervalDecodeJson } from "./codec-helpers-D83-1eDB-nqAEMr7N.mjs";
5
+ import { A as pgVarbit, C as pgTimestampCanonical, D as pgTimetzCanonical, E as pgTimetz, O as pgTsquery, S as pgTimestamp, T as pgTimestamptzCanonical, _ as pgNumeric, a as pgDate, b as pgTime, c as pgFloat4, d as pgInt2, f as pgInt4, g as pgJsonb, h as pgJson, i as pgChar, j as pgVarchar, k as pgUuid, l as pgFloat8, m as pgInterval, n as pgBool, o as pgDateCanonical, p as pgInt8, r as pgBytea, s as pgEnum, t as pgBit, u as pgInet, v as pgText, w as pgTimestamptz, x as pgTimeCanonical, y as pgTextArray } from "./data-types-BqeC7aZP-CwvA08pH.mjs";
5
6
  import { t as PostgresNativeEnum } from "./postgres-native-enum-CdP3b_-R-Cgz9KEKx.mjs";
6
- import { BinaryExpr, CaseExpr, CastExpr, FunctionCallExpr, LiteralExpr, NullCheckExpr, OrExpr, SqlCharCodec, SqlFloatCodec, SqlIntCodec, SqlVarcharCodec, sqlCharDescriptor, sqlFloatDescriptor, sqlIntDescriptor, sqlTextDescriptor, sqlVarcharDescriptor } from "@prisma/orm-family-sql/relational-core/ast";
7
- import { CodecImpl, column, renderTsLiteral } from "@prisma/orm-framework/components/codec";
7
+ import { BinaryExpr, CaseExpr, CastExpr, FunctionCallExpr, LiteralExpr, NullCheckExpr, OrExpr, SqlCharCodec, SqlFloatCodec, SqlIntCodec, SqlVarcharCodec, canonicalDateTime, sqlCharDescriptor, sqlFloatDescriptor, sqlIntDescriptor, sqlTextDescriptor, sqlVarcharDescriptor } from "@prisma/orm-family-sql/relational-core/ast";
8
+ import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
9
+ import { CodecImpl, INT32_RANGE, INT64_RANGE, column, decodeJsonBoolean, decodeJsonFloat, decodeJsonInteger, decodeJsonIntegerText, decodeJsonMatching, decodeJsonString, encodeJsonFloat, refuseJsonValue, renderTsLiteral } from "@prisma/orm-framework/components/codec";
8
10
  import { blindCast } from "@prisma/orm-framework/utils/casts";
11
+ import { counted, withoutTrailing } from "@prisma/orm-framework/utils/text";
9
12
  import { type } from "arktype";
10
13
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
11
- //#region ../../../3-targets/3-targets/postgres/dist/codecs-DQGmsnk3.mjs
14
+ //#region ../../../3-targets/3-targets/postgres/dist/codecs-BHNqtI1J.mjs
12
15
  let fallback;
13
16
  /**
14
17
  * Sets the implementation `requireTemporal` returns when the runtime has no global `Temporal`.
@@ -115,13 +118,22 @@ const MIN_TIMESTAMPTZ_MILLISECONDS = (/* @__PURE__ */ new Date("-004713-11-24T00
115
118
  function invalidDate() {
116
119
  return /* @__PURE__ */ new RangeError(`${PG_TIMESTAMPTZ_DATE_CODEC_ID} requires a valid Date or a representable ISO PostgreSQL timestamp with time zone; use TimestamptzString for unsupported values`);
117
120
  }
121
+ function isRepresentable(value) {
122
+ return value instanceof Date && Number.isFinite(value.getTime()) && value.getTime() >= MIN_TIMESTAMPTZ_MILLISECONDS;
123
+ }
118
124
  function validateDate(value) {
119
- if (!(value instanceof Date) || !Number.isFinite(value.getTime()) || value.getTime() < MIN_TIMESTAMPTZ_MILLISECONDS) throw invalidDate();
125
+ if (!isRepresentable(value)) throw invalidDate();
120
126
  return value;
121
127
  }
122
128
  function decodeDate(wire) {
123
- const match = typeof wire === "string" ? TIMESTAMPTZ_TEXT.exec(wire) : null;
124
- if (!match) throw invalidDate();
129
+ const date = typeof wire === "string" ? parseDate(wire) : void 0;
130
+ if (date === void 0) throw invalidDate();
131
+ return date;
132
+ }
133
+ /** The instant a timestamp with time zone as PostgreSQL writes it names, or `undefined` when the text is not one. */
134
+ function parseDate(text) {
135
+ const match = TIMESTAMPTZ_TEXT.exec(text);
136
+ if (!match) return void 0;
125
137
  const [, yearText = "", monthText, dayText, hourText, minuteText, secondText, fraction = "", sign, offsetHour = "0", offsetMinute = "0", offsetSecond = "0", era] = match;
126
138
  const year = era ? 1 - Number(yearText) : Number(yearText);
127
139
  const month = Number(monthText) - 1;
@@ -135,9 +147,10 @@ function decodeDate(wire) {
135
147
  const local = /* @__PURE__ */ new Date(0);
136
148
  local.setUTCFullYear(safeYear, month, day);
137
149
  local.setUTCHours(hour, minute, second, milliseconds);
138
- if (era !== void 0 && (Number(yearText) === 0 || /^[+-]/.test(yearText)) || local.getUTCFullYear() !== safeYear || local.getUTCMonth() !== month || local.getUTCDate() !== day || local.getUTCHours() !== hour || local.getUTCMinutes() !== minute || local.getUTCSeconds() !== second || Number(offsetHour) > 15 || Number(offsetMinute) > 59 || Number(offsetSecond) > 59) throw invalidDate();
150
+ if (era !== void 0 && (Number(yearText) === 0 || /^[+-]/.test(yearText)) || local.getUTCFullYear() !== safeYear || local.getUTCMonth() !== month || local.getUTCDate() !== day || local.getUTCHours() !== hour || local.getUTCMinutes() !== minute || local.getUTCSeconds() !== second || Number(offsetHour) > 15 || Number(offsetMinute) > 59 || Number(offsetSecond) > 59) return void 0;
139
151
  const offset = (Number(offsetHour) * 3600 + Number(offsetMinute) * 60 + Number(offsetSecond)) * (sign === "-" ? -1 : 1);
140
- return validateDate(/* @__PURE__ */ new Date(local.getTime() - offset * 1e3 + cycles * 146097 * 864e5));
152
+ const value = /* @__PURE__ */ new Date(local.getTime() - offset * 1e3 + cycles * 146097 * 864e5);
153
+ return isRepresentable(value) ? value : void 0;
141
154
  }
142
155
  function encodeDate(value) {
143
156
  validateDate(value);
@@ -158,7 +171,7 @@ var PgTimestamptzDateCodec = class extends CodecImpl {
158
171
  return pgTimestamptzCanonical(validateDate(value).toISOString());
159
172
  }
160
173
  decodeJson(json) {
161
- return decodeDate(json);
174
+ return parseDate(decodeJsonString("pg/timestamptz-date@1", json)) ?? refuseJsonValue("pg/timestamptz-date@1", "a timestamp with time zone as PostgreSQL writes it", json);
162
175
  }
163
176
  };
164
177
  var PgTimestamptzDateDescriptor = class extends PostgresCodecDescriptor {
@@ -182,6 +195,108 @@ var PgTimestamptzDateDescriptor = class extends PostgresCodecDescriptor {
182
195
  };
183
196
  const pgTimestamptzDateDescriptor = new PgTimestamptzDateDescriptor();
184
197
  const pgTimestamptzDateColumn = (params = {}) => column(pgTimestamptzDateDescriptor.factory(params), pgTimestamptzDateDescriptor.codecId, params, "timestamptz");
198
+ const YEAR = String.raw`(?:[+-]\d{6}|\d{4,7})`;
199
+ const DATE = String.raw`${YEAR}-\d{2}-\d{2}`;
200
+ const TIME = String.raw`\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?`;
201
+ const OFFSET = String.raw`(?:Z|[+-]\d{2}(?::\d{2}(?::\d{2})?)?)`;
202
+ const INFINITY = "infinity|-infinity|";
203
+ const BC = "(?: BC)?";
204
+ const FORMS = {
205
+ date: `${DATE}${BC}`,
206
+ time: TIME,
207
+ timeWithOffset: `${TIME}${OFFSET}`,
208
+ dateTime: `${DATE}[ T]${TIME}${BC}`,
209
+ instant: `${DATE}[ T]${TIME}${OFFSET}${BC}`
210
+ };
211
+ const DATED = /^([+-]?)(\d{4,7})(-.*?)( BC)?$/;
212
+ const END_OF_DAY = /^24:00:00(?:\.0+)?(?![.\d])/;
213
+ /** PostgreSQL's largest UTC offset, which it writes for no type past 15:59:59. */
214
+ const MAX_OFFSET_HOURS = 15;
215
+ function storedText(options) {
216
+ return {
217
+ dataTypeId: options.dataTypeId,
218
+ shape: options.shape,
219
+ pattern: new RegExp(`^(?:${options.infinity ? INFINITY : ""}${FORMS[options.shape]})$`),
220
+ description: `${options.description} in ISO 8601 or as PostgreSQL writes it`,
221
+ endOfDay: options.endOfDay
222
+ };
223
+ }
224
+ const pgDateStoredText = storedText({
225
+ dataTypeId: pgDate.id,
226
+ shape: "date",
227
+ description: "a date",
228
+ infinity: true,
229
+ endOfDay: false
230
+ });
231
+ const pgTimeStoredText = storedText({
232
+ dataTypeId: pgTime.id,
233
+ shape: "time",
234
+ description: "a time of day",
235
+ infinity: false,
236
+ endOfDay: true
237
+ });
238
+ const pgTimetzStoredText = storedText({
239
+ dataTypeId: pgTimetz.id,
240
+ shape: "timeWithOffset",
241
+ description: "a time of day with a UTC offset",
242
+ infinity: false,
243
+ endOfDay: true
244
+ });
245
+ const pgTimestampStoredText = storedText({
246
+ dataTypeId: pgTimestamp.id,
247
+ shape: "dateTime",
248
+ description: "a date and time of day",
249
+ infinity: true,
250
+ endOfDay: false
251
+ });
252
+ const pgTimestamptzStoredText = storedText({
253
+ dataTypeId: pgTimestamptz.id,
254
+ shape: "instant",
255
+ description: "a date and time of day with a UTC offset",
256
+ infinity: true,
257
+ endOfDay: false
258
+ });
259
+ /** The text with its year moved into the 400-year cycle from 2000, or `undefined` for a year no calendar has. */
260
+ function inGregorianCycle(text) {
261
+ const match = DATED.exec(text);
262
+ if (match === null) return text;
263
+ const [, sign = "", digits = "", rest = "", bc] = match;
264
+ const year = Number(digits);
265
+ if (bc !== void 0 && (sign !== "" || year === 0) || sign === "-" && year === 0) return;
266
+ return `${2e3 + ((bc !== void 0 ? 1 - year : sign === "-" ? -year : year) % 400 + 400) % 400}${rest}`;
267
+ }
268
+ function holdsValue(stored, text) {
269
+ if (text === "infinity" || text === "-infinity") return true;
270
+ const cycled = inGregorianCycle(text);
271
+ if (cycled === void 0) return false;
272
+ const read = stored.endOfDay ? cycled.replace(END_OF_DAY, "00:00:00") : cycled;
273
+ try {
274
+ canonicalDateTime(read, {
275
+ shape: stored.shape,
276
+ dataTypeId: stored.dataTypeId,
277
+ maxOffsetHours: MAX_OFFSET_HOURS
278
+ });
279
+ return true;
280
+ } catch (error) {
281
+ if (isStructuredError(error) && error.code === "CONTRACT.CAST_REFUSED") return false;
282
+ throw error;
283
+ }
284
+ }
285
+ /** Reads a stored date or time text, refusing text in another form or naming no real date and time. */
286
+ function decodeJsonDateTimeText(codecId, json, stored) {
287
+ const text = decodeJsonMatching(codecId, json, stored.pattern, stored.description);
288
+ return holdsValue(stored, text) ? text : refuseJsonValue(codecId, stored.description, json);
289
+ }
290
+ /** The precision a `numeric` column takes. */
291
+ const NUMERIC_PRECISION_RANGE = {
292
+ min: 1,
293
+ max: 1e3
294
+ };
295
+ /** The scale a `numeric` column takes in PostgreSQL 15 and later, including a negative one and one above the precision. */
296
+ const NUMERIC_SCALE_RANGE = {
297
+ min: -1e3,
298
+ max: 1e3
299
+ };
185
300
  var PgDateTemporalCodec = class extends CodecImpl {
186
301
  async encode(value, _ctx) {
187
302
  return pgDateTemporalEncode(value);
@@ -193,7 +308,7 @@ var PgDateTemporalCodec = class extends CodecImpl {
193
308
  return pgDateCanonical(pgDateTemporalEncode(value));
194
309
  }
195
310
  decodeJson(json) {
196
- return pgDateTemporalDecode(blindCast(json));
311
+ return pgDateTemporalDecode(decodeJsonString(PG_DATE_TEMPORAL_CODEC_ID, json));
197
312
  }
198
313
  };
199
314
  var PgDateTemporalDescriptor = class extends PostgresCodecDescriptor {
@@ -224,7 +339,7 @@ var PgTimestampTemporalCodec = class extends CodecImpl {
224
339
  return pgTimestampCanonical(pgTimestampTemporalEncode(value));
225
340
  }
226
341
  decodeJson(json) {
227
- return pgTimestampTemporalDecode(blindCast(json));
342
+ return pgTimestampTemporalDecode(decodeJsonString(PG_TIMESTAMP_TEMPORAL_CODEC_ID, json));
228
343
  }
229
344
  };
230
345
  var PgTimestampTemporalDescriptor = class extends PostgresCodecDescriptor {
@@ -255,7 +370,7 @@ var PgTimestamptzTemporalCodec = class extends CodecImpl {
255
370
  return pgTimestamptzCanonical(pgTimestamptzTemporalEncode(value));
256
371
  }
257
372
  decodeJson(json) {
258
- return pgTimestamptzTemporalDecode(blindCast(json));
373
+ return pgTimestamptzTemporalDecode(decodeJsonString(PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID, json));
259
374
  }
260
375
  };
261
376
  var PgTimestamptzTemporalDescriptor = class extends PostgresCodecDescriptor {
@@ -286,7 +401,7 @@ var PgTimeTemporalCodec = class extends CodecImpl {
286
401
  return pgTimeCanonical(pgTimeTemporalEncode(value));
287
402
  }
288
403
  decodeJson(json) {
289
- return pgTimeTemporalDecode(blindCast(json));
404
+ return pgTimeTemporalDecode(decodeJsonString(PG_TIME_TEMPORAL_CODEC_ID, json));
290
405
  }
291
406
  };
292
407
  var PgTimeTemporalDescriptor = class extends PostgresCodecDescriptor {
@@ -317,7 +432,7 @@ var PgDateStringCodec = class extends CodecImpl {
317
432
  return pgDateCanonical(value);
318
433
  }
319
434
  decodeJson(json) {
320
- return blindCast(json);
435
+ return decodeJsonDateTimeText(PG_DATE_STRING_CODEC_ID, json, pgDateStoredText);
321
436
  }
322
437
  };
323
438
  var PgDateStringDescriptor = class extends PostgresCodecDescriptor {
@@ -348,7 +463,7 @@ var PgTimestampStringCodec = class extends CodecImpl {
348
463
  return pgTimestampCanonical(value);
349
464
  }
350
465
  decodeJson(json) {
351
- return blindCast(json);
466
+ return decodeJsonDateTimeText(PG_TIMESTAMP_STRING_CODEC_ID, json, pgTimestampStoredText);
352
467
  }
353
468
  };
354
469
  var PgTimestampStringDescriptor = class extends PostgresCodecDescriptor {
@@ -382,7 +497,7 @@ var PgTimestamptzStringCodec = class extends CodecImpl {
382
497
  return pgTimestamptzCanonical(value);
383
498
  }
384
499
  decodeJson(json) {
385
- return blindCast(json);
500
+ return decodeJsonDateTimeText(PG_TIMESTAMPTZ_STRING_CODEC_ID, json, pgTimestamptzStoredText);
386
501
  }
387
502
  };
388
503
  var PgTimestamptzStringDescriptor = class extends PostgresCodecDescriptor {
@@ -416,7 +531,7 @@ var PgTimeStringCodec = class extends CodecImpl {
416
531
  return pgTimeCanonical(value);
417
532
  }
418
533
  decodeJson(json) {
419
- return blindCast(json);
534
+ return decodeJsonDateTimeText(PG_TIME_STRING_CODEC_ID, json, pgTimeStoredText);
420
535
  }
421
536
  };
422
537
  var PgTimeStringDescriptor = class extends PostgresCodecDescriptor {
@@ -441,8 +556,8 @@ var PgTimeStringDescriptor = class extends PostgresCodecDescriptor {
441
556
  const pgTimeStringDescriptor = new PgTimeStringDescriptor();
442
557
  const lengthParamsSchema = type({ "length?": "number.integer > 0" });
443
558
  const numericParamsSchema = type({
444
- "precision?": "number.integer > 0 & number.integer <= 1000",
445
- "scale?": "number.integer >= 0"
559
+ "precision?": type("number.integer").atLeast(NUMERIC_PRECISION_RANGE.min).atMost(NUMERIC_PRECISION_RANGE.max),
560
+ "scale?": type("number.integer").atLeast(NUMERIC_SCALE_RANGE.min).atMost(NUMERIC_SCALE_RANGE.max)
446
561
  });
447
562
  const PG_TEXT_NATIVE_TYPE = "text";
448
563
  const PG_TEXT_ARRAY_NATIVE_TYPE = "text[]";
@@ -486,7 +601,28 @@ const PG_JSONB_NATIVE_TYPE = "jsonb";
486
601
  */
487
602
  const CANONICAL_NUMERIC_TEXT = /^(?:-?\d+(?:\.\d+)?|NaN|-?Infinity)$/;
488
603
  const isCanonicalNumericText = (value) => CANONICAL_NUMERIC_TEXT.test(value);
604
+ /**
605
+ * Whether canonical 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.
606
+ */
607
+ function fitsNumeric(text, precision, scale) {
608
+ if (text === "NaN") return true;
609
+ if (text.endsWith("Infinity")) return false;
610
+ const [whole = "", fraction = ""] = text.replace(/^-/, "").split(".");
611
+ const significantFraction = withoutTrailing(fraction, "0");
612
+ const digits = `${whole}${significantFraction}`.replace(/^0+/, "");
613
+ if (digits === "") return true;
614
+ const shift = scale - significantFraction.length;
615
+ if (shift >= 0) return digits.length + shift <= precision;
616
+ const units = withoutTrailing(digits, "0");
617
+ if (digits.length - units.length < -shift) return false;
618
+ return digits.length + shift <= precision;
619
+ }
489
620
  const identityJsonProjection = (expression) => expression;
621
+ /**
622
+ * Projects a `character` value as text, which drops the trailing spaces that pad it to its length and nothing else, so an include reads the value a flat read's `decode` returns.
623
+ */
624
+ const unpaddedCharJsonProjection = (expression) => CastExpr.as(expression, "text");
625
+ const BIT_STRING = /^[01]*$/;
490
626
  const decodePostgresNumberWire = (wire) => typeof wire === "string" ? Number(wire) : wire;
491
627
  const decodePostgresBooleanWire = (wire) => {
492
628
  if (typeof wire === "boolean") return wire;
@@ -579,17 +715,20 @@ const isoDurationJsonProjection = (expression) => {
579
715
  const postgresSqlCharDescriptor = postgresCodec(sqlCharDescriptor, {
580
716
  dataType: pgChar.id,
581
717
  nativeType: () => "character",
582
- jsonProjection: identityJsonProjection
718
+ jsonProjection: unpaddedCharJsonProjection,
719
+ factory: (descriptor, params) => () => new PgCharCodec(descriptor, params.length)
583
720
  });
584
721
  const postgresSqlVarcharDescriptor = postgresCodec(sqlVarcharDescriptor, {
585
722
  dataType: pgVarchar.id,
586
723
  nativeType: () => "character varying",
587
- jsonProjection: identityJsonProjection
724
+ jsonProjection: identityJsonProjection,
725
+ factory: (descriptor, params) => () => new PgVarcharCodec(descriptor, params.length)
588
726
  });
589
727
  const postgresSqlIntDescriptor = postgresCodec(sqlIntDescriptor, {
590
728
  dataType: pgInt4.id,
591
729
  nativeType: () => "int4",
592
- jsonProjection: identityJsonProjection
730
+ jsonProjection: identityJsonProjection,
731
+ factory: (descriptor) => () => new PgIntCodec(descriptor)
593
732
  });
594
733
  const postgresSqlFloatDescriptor = postgresCodec(sqlFloatDescriptor, {
595
734
  dataType: pgFloat8.id,
@@ -612,7 +751,7 @@ var PgTextCodec = class extends CodecImpl {
612
751
  return value;
613
752
  }
614
753
  decodeJson(json) {
615
- return blindCast(json);
754
+ return decodeJsonString(PG_TEXT_CODEC_ID, json);
616
755
  }
617
756
  };
618
757
  var PgTextDescriptor = class extends PostgresCodecDescriptor {
@@ -670,7 +809,7 @@ var PgEnumCodec = class extends CodecImpl {
670
809
  return value;
671
810
  }
672
811
  decodeJson(json) {
673
- return blindCast(json);
812
+ return decodeJsonString(PG_ENUM_CODEC_ID, json);
674
813
  }
675
814
  };
676
815
  /**
@@ -779,8 +918,16 @@ var PgTextArrayCodec = class extends CodecImpl {
779
918
  encodeJson(value) {
780
919
  return [...value];
781
920
  }
921
+ /** A `text[]` may hold NULL elements, which PostgreSQL writes as JSON `null`. */
782
922
  decodeJson(json) {
783
- return Array.isArray(json) ? json.map((entry) => String(entry)) : [];
923
+ const expected = "an array of strings and nulls";
924
+ if (!Array.isArray(json)) return refuseJsonValue(PG_TEXT_ARRAY_CODEC_ID, expected, json);
925
+ const elements = [];
926
+ for (const entry of json) {
927
+ if (entry !== null && typeof entry !== "string") return refuseJsonValue(PG_TEXT_ARRAY_CODEC_ID, expected, entry);
928
+ elements.push(entry);
929
+ }
930
+ return elements;
784
931
  }
785
932
  };
786
933
  var PgTextArrayDescriptor = class extends PostgresCodecDescriptor {
@@ -811,7 +958,7 @@ var PgInt4Codec = class extends CodecImpl {
811
958
  return value;
812
959
  }
813
960
  decodeJson(json) {
814
- return blindCast(json);
961
+ return decodeJsonInteger(PG_INT4_CODEC_ID, json, INT32_RANGE);
815
962
  }
816
963
  };
817
964
  var PgInt4Descriptor = class extends PostgresCodecDescriptor {
@@ -850,7 +997,10 @@ var PgInt2Codec = class extends CodecImpl {
850
997
  return value;
851
998
  }
852
999
  decodeJson(json) {
853
- return blindCast(json);
1000
+ return decodeJsonInteger(PG_INT2_CODEC_ID, json, {
1001
+ min: -32768,
1002
+ max: 32767
1003
+ });
854
1004
  }
855
1005
  };
856
1006
  var PgInt2Descriptor = class extends PostgresCodecDescriptor {
@@ -895,11 +1045,7 @@ var PgInt8Codec = class extends CodecImpl {
895
1045
  return pgBigintEncodeJson(PG_INT8_CODEC_ID, value);
896
1046
  }
897
1047
  decodeJson(json) {
898
- if (typeof json !== "string") throw postgresError("RUNTIME.DECODE_FAILED", "pg/int8@1 database JSON value must be a decimal string", { meta: {
899
- codecId: PG_INT8_CODEC_ID,
900
- received: typeof json
901
- } });
902
- return pgInt8Decode(json);
1048
+ return decodeJsonIntegerText(PG_INT8_CODEC_ID, json, INT64_RANGE);
903
1049
  }
904
1050
  };
905
1051
  var PgInt8Descriptor = class extends PostgresCodecDescriptor {
@@ -982,10 +1128,12 @@ var PgFloat4Codec = class extends CodecImpl {
982
1128
  return decodePostgresNumberWire(wire);
983
1129
  }
984
1130
  encodeJson(value) {
985
- return pgFloatEncodeJson(value);
1131
+ return encodeJsonFloat(value);
986
1132
  }
987
1133
  decodeJson(json) {
988
- return pgFloatDecodeJson(PG_FLOAT4_CODEC_ID, json);
1134
+ const value = decodeJsonFloat(PG_FLOAT4_CODEC_ID, json);
1135
+ if (Number.isFinite(value) && !fitsFloat4(value)) return refuseJsonValue(PG_FLOAT4_CODEC_ID, `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);
1136
+ return value;
989
1137
  }
990
1138
  };
991
1139
  var PgFloat4Descriptor = class extends PostgresCodecDescriptor {
@@ -1021,10 +1169,10 @@ var PgFloat8Codec = class extends CodecImpl {
1021
1169
  return decodePostgresNumberWire(wire);
1022
1170
  }
1023
1171
  encodeJson(value) {
1024
- return pgFloatEncodeJson(value);
1172
+ return encodeJsonFloat(value);
1025
1173
  }
1026
1174
  decodeJson(json) {
1027
- return pgFloatDecodeJson(PG_FLOAT8_CODEC_ID, json);
1175
+ return decodeJsonFloat(PG_FLOAT8_CODEC_ID, json);
1028
1176
  }
1029
1177
  };
1030
1178
  var PgFloat8Descriptor = class extends PostgresCodecDescriptor {
@@ -1063,7 +1211,7 @@ var PgBoolCodec = class extends CodecImpl {
1063
1211
  return value;
1064
1212
  }
1065
1213
  decodeJson(json) {
1066
- return blindCast(json);
1214
+ return decodeJsonBoolean(PG_BOOL_CODEC_ID, json);
1067
1215
  }
1068
1216
  };
1069
1217
  var PgBoolDescriptor = class extends PostgresCodecDescriptor {
@@ -1088,6 +1236,7 @@ var PgBoolDescriptor = class extends PostgresCodecDescriptor {
1088
1236
  const pgBoolDescriptor = new PgBoolDescriptor();
1089
1237
  const pgBoolColumn = () => column(pgBoolDescriptor.factory(), pgBoolDescriptor.codecId, void 0, "bool");
1090
1238
  var PgNumericCodec = class extends CodecImpl {
1239
+ params;
1091
1240
  async encode(value, _ctx) {
1092
1241
  return value;
1093
1242
  }
@@ -1101,12 +1250,17 @@ var PgNumericCodec = class extends CodecImpl {
1101
1250
  } });
1102
1251
  return value;
1103
1252
  }
1253
+ constructor(descriptor, params) {
1254
+ super(descriptor);
1255
+ this.params = params;
1256
+ }
1104
1257
  decodeJson(json) {
1105
- if (typeof json !== "string") throw postgresError("RUNTIME.DECODE_FAILED", "pg/numeric@1 database JSON value must be a decimal string", { meta: {
1106
- codecId: PG_NUMERIC_CODEC_ID,
1107
- received: typeof json
1108
- } });
1109
- return json;
1258
+ const text = decodeJsonMatching(PG_NUMERIC_CODEC_ID, json, CANONICAL_NUMERIC_TEXT, "a decimal string");
1259
+ const { precision } = this.params;
1260
+ if (precision === void 0) return text;
1261
+ const scale = this.params.scale ?? 0;
1262
+ if (!fitsNumeric(text, precision, scale)) return refuseJsonValue(PG_NUMERIC_CODEC_ID, `a decimal string that numeric(${precision}, ${scale}) stores without rounding`, json);
1263
+ return text;
1110
1264
  }
1111
1265
  };
1112
1266
  var PgNumericDescriptor = class extends PostgresCodecDescriptor {
@@ -1128,8 +1282,8 @@ var PgNumericDescriptor = class extends PostgresCodecDescriptor {
1128
1282
  renderOutputType(params) {
1129
1283
  return pgNumericRenderOutputType(params);
1130
1284
  }
1131
- factory(_params) {
1132
- return () => new PgNumericCodec(this);
1285
+ factory(params) {
1286
+ return () => new PgNumericCodec(this, params ?? {});
1133
1287
  }
1134
1288
  };
1135
1289
  const pgNumericDescriptor = new PgNumericDescriptor();
@@ -1151,11 +1305,7 @@ var PgUnboundedIntCodec = class extends CodecImpl {
1151
1305
  return pgBigintEncodeJson(PG_UNBOUNDED_INT_CODEC_ID, value);
1152
1306
  }
1153
1307
  decodeJson(json) {
1154
- if (typeof json !== "string") throw postgresError("RUNTIME.DECODE_FAILED", "pg/unboundedint@1 database JSON value must be a decimal string", { meta: {
1155
- codecId: PG_UNBOUNDED_INT_CODEC_ID,
1156
- received: typeof json
1157
- } });
1158
- return pgUnboundedIntDecode(json);
1308
+ return decodeJsonIntegerText(PG_UNBOUNDED_INT_CODEC_ID, json);
1159
1309
  }
1160
1310
  };
1161
1311
  var PgUnboundedIntDescriptor = class extends PostgresCodecDescriptor {
@@ -1194,7 +1344,7 @@ var PgTimetzCodec = class extends CodecImpl {
1194
1344
  return pgTimetzCanonical(value);
1195
1345
  }
1196
1346
  decodeJson(json) {
1197
- return blindCast(json);
1347
+ return decodeJsonDateTimeText(PG_TIMETZ_CODEC_ID, json, pgTimetzStoredText);
1198
1348
  }
1199
1349
  };
1200
1350
  var PgTimetzDescriptor = class extends PostgresCodecDescriptor {
@@ -1219,6 +1369,7 @@ var PgTimetzDescriptor = class extends PostgresCodecDescriptor {
1219
1369
  const pgTimetzDescriptor = new PgTimetzDescriptor();
1220
1370
  const pgTimetzColumn = (params = {}) => column(pgTimetzDescriptor.factory(params), pgTimetzDescriptor.codecId, params, "timetz");
1221
1371
  var PgBitCodec = class extends CodecImpl {
1372
+ length;
1222
1373
  async encode(value, _ctx) {
1223
1374
  return value;
1224
1375
  }
@@ -1228,8 +1379,14 @@ var PgBitCodec = class extends CodecImpl {
1228
1379
  encodeJson(value) {
1229
1380
  return value;
1230
1381
  }
1382
+ constructor(descriptor, length) {
1383
+ super(descriptor);
1384
+ this.length = length;
1385
+ }
1231
1386
  decodeJson(json) {
1232
- return blindCast(json);
1387
+ const bits = decodeJsonMatching(PG_BIT_CODEC_ID, json, BIT_STRING, "a string of 0 and 1 digits");
1388
+ if (bits.length !== this.length) return refuseJsonValue(PG_BIT_CODEC_ID, `a string of exactly ${counted(this.length, "bit")}`, json);
1389
+ return bits;
1233
1390
  }
1234
1391
  };
1235
1392
  var PgBitDescriptor = class extends PostgresCodecDescriptor {
@@ -1247,13 +1404,14 @@ var PgBitDescriptor = class extends PostgresCodecDescriptor {
1247
1404
  renderOutputType(params) {
1248
1405
  return renderLength("Bit", params);
1249
1406
  }
1250
- factory(_params) {
1251
- return () => new PgBitCodec(this);
1407
+ factory(params) {
1408
+ return () => new PgBitCodec(this, params?.length ?? 1);
1252
1409
  }
1253
1410
  };
1254
1411
  const pgBitDescriptor = new PgBitDescriptor();
1255
1412
  const pgBitColumn = (params = {}) => column(pgBitDescriptor.factory(params), pgBitDescriptor.codecId, params, "bit");
1256
1413
  var PgVarbitCodec = class extends CodecImpl {
1414
+ length;
1257
1415
  async encode(value, _ctx) {
1258
1416
  return value;
1259
1417
  }
@@ -1263,8 +1421,14 @@ var PgVarbitCodec = class extends CodecImpl {
1263
1421
  encodeJson(value) {
1264
1422
  return value;
1265
1423
  }
1424
+ constructor(descriptor, length) {
1425
+ super(descriptor);
1426
+ this.length = length;
1427
+ }
1266
1428
  decodeJson(json) {
1267
- return blindCast(json);
1429
+ const bits = decodeJsonMatching(PG_VARBIT_CODEC_ID, json, BIT_STRING, "a string of 0 and 1 digits");
1430
+ if (this.length !== void 0 && bits.length > this.length) return refuseJsonValue(PG_VARBIT_CODEC_ID, `a string of at most ${counted(this.length, "bit")}`, json);
1431
+ return bits;
1268
1432
  }
1269
1433
  };
1270
1434
  var PgVarbitDescriptor = class extends PostgresCodecDescriptor {
@@ -1282,8 +1446,8 @@ var PgVarbitDescriptor = class extends PostgresCodecDescriptor {
1282
1446
  renderOutputType(params) {
1283
1447
  return renderLength("VarBit", params);
1284
1448
  }
1285
- factory(_params) {
1286
- return () => new PgVarbitCodec(this);
1449
+ factory(params) {
1450
+ return () => new PgVarbitCodec(this, params?.length);
1287
1451
  }
1288
1452
  };
1289
1453
  const pgVarbitDescriptor = new PgVarbitDescriptor();
@@ -1328,10 +1492,10 @@ var PgUuidCodec = class extends CodecImpl {
1328
1492
  return wire;
1329
1493
  }
1330
1494
  encodeJson(value) {
1331
- return value;
1495
+ return canonicalUuid(value) ?? value;
1332
1496
  }
1333
1497
  decodeJson(json) {
1334
- return blindCast(json);
1498
+ return decodeJsonMatching(PG_UUID_CODEC_ID, json, CANONICAL_UUID, "a UUID as PostgreSQL writes it, in lower case and hyphenated 8-4-4-4-12");
1335
1499
  }
1336
1500
  };
1337
1501
  var PgUuidDescriptor = class extends PostgresCodecDescriptor {
@@ -1364,7 +1528,7 @@ var PgInetCodec = class extends CodecImpl {
1364
1528
  return value;
1365
1529
  }
1366
1530
  decodeJson(json) {
1367
- return blindCast(json);
1531
+ return decodeJsonString(PG_INET_CODEC_ID, json);
1368
1532
  }
1369
1533
  };
1370
1534
  var PgInetDescriptor = class extends PostgresCodecDescriptor {
@@ -1397,7 +1561,7 @@ var PgTsqueryCodec = class extends CodecImpl {
1397
1561
  return value;
1398
1562
  }
1399
1563
  decodeJson(json) {
1400
- return blindCast(json);
1564
+ return blindCast(decodeJsonString(PG_TSQUERY_CODEC_ID, json));
1401
1565
  }
1402
1566
  };
1403
1567
  /**
@@ -1547,6 +1711,36 @@ var PgIntCodec = class extends SqlIntCodec {
1547
1711
  async decode(wire, _ctx) {
1548
1712
  return decodePostgresNumberWire(wire);
1549
1713
  }
1714
+ decodeJson(json) {
1715
+ return decodeJsonInteger(this.id, json, INT32_RANGE);
1716
+ }
1717
+ };
1718
+ /**
1719
+ * `sql/char@1` as PostgreSQL stores it: a `character` column holds its length in characters, and one with no length is `character(1)`.
1720
+ */
1721
+ var PgCharCodec = class extends SqlCharCodec {
1722
+ length;
1723
+ constructor(descriptor, length) {
1724
+ super(descriptor);
1725
+ this.length = length ?? 1;
1726
+ }
1727
+ decodeJson(json) {
1728
+ if (!fitsCharacterLength(decodeJsonString(this.id, json), this.length, true)) return refuseJsonValue(this.id, `a string of at most ${counted(this.length, "character")} before any trailing spaces`, json);
1729
+ return super.decodeJson(json);
1730
+ }
1731
+ };
1732
+ /** `sql/varchar@1` as PostgreSQL stores it: a `character varying` column with a length holds at most that many characters. */
1733
+ var PgVarcharCodec = class extends SqlVarcharCodec {
1734
+ length;
1735
+ constructor(descriptor, length) {
1736
+ super(descriptor);
1737
+ this.length = length;
1738
+ }
1739
+ decodeJson(json) {
1740
+ const text = super.decodeJson(json);
1741
+ if (this.length !== void 0 && !fitsCharacterLength(text, this.length, false)) return refuseJsonValue(this.id, `a string of at most ${counted(this.length, "character")}`, json);
1742
+ return text;
1743
+ }
1550
1744
  };
1551
1745
  var PgFloatCodec = class extends SqlFloatCodec {
1552
1746
  async decode(wire, _ctx) {
@@ -1558,7 +1752,7 @@ var PgCharDescriptor = class extends PostgresCodecDescriptor {
1558
1752
  return PG_CHAR_NATIVE_TYPE;
1559
1753
  }
1560
1754
  jsonProjection(expression) {
1561
- return expression;
1755
+ return unpaddedCharJsonProjection(expression);
1562
1756
  }
1563
1757
  dataType = pgChar.id;
1564
1758
  codecId = PG_CHAR_CODEC_ID;
@@ -1571,8 +1765,8 @@ var PgCharDescriptor = class extends PostgresCodecDescriptor {
1571
1765
  renderValueLiteral(value) {
1572
1766
  return renderTsLiteral(value);
1573
1767
  }
1574
- factory(_params) {
1575
- return () => new SqlCharCodec(this);
1768
+ factory(params) {
1769
+ return () => new PgCharCodec(this, params?.length);
1576
1770
  }
1577
1771
  };
1578
1772
  const pgCharDescriptor = new PgCharDescriptor();
@@ -1595,8 +1789,8 @@ var PgVarcharDescriptor = class extends PostgresCodecDescriptor {
1595
1789
  renderValueLiteral(value) {
1596
1790
  return renderTsLiteral(value);
1597
1791
  }
1598
- factory(_params) {
1599
- return () => new SqlVarcharCodec(this);
1792
+ factory(params) {
1793
+ return () => new PgVarcharCodec(this, params?.length);
1600
1794
  }
1601
1795
  };
1602
1796
  const pgVarcharDescriptor = new PgVarcharDescriptor();
@@ -1686,6 +1880,6 @@ const codecDescriptors = definePostgresCodecs([
1686
1880
  pgTsqueryDescriptor
1687
1881
  ]);
1688
1882
  //#endregion
1689
- export { postgresQualifyColumnType as A, pgTimestamptzDateColumn as C, pgUuidColumn as D, pgUnboundedIntColumn as E, setFallbackTemporal as M, pgVarbitColumn as O, pgTextColumn as S, pgTimetzColumn as T, pgIntColumn as _, pgBitColumn as a, pgJsonbColumn as b, pgEnumDescriptor as c, pgFloatColumn as d, pgInetColumn as f, pgInt8NumberColumn as g, pgInt8Column as h, isPgEnumParams as i, requireTemporal as j, pgVarcharColumn as k, pgFloat4Column as l, pgInt4Column as m, PgTimestamptzDateDescriptor as n, pgBoolColumn as o, pgInt2Column as p, codecDescriptors as r, pgCharColumn as s, PgTimestamptzDateCodec as t, pgFloat8Column as u, pgIntervalColumn as v, pgTimestamptzDateDescriptor as w, pgNumericColumn as x, pgJsonColumn as y };
1883
+ export { pgVarbitColumn as A, pgNumericColumn as C, pgTimetzColumn as D, pgTimestamptzDateDescriptor as E, postgresQualifyColumnType as M, requireTemporal as N, pgUnboundedIntColumn as O, setFallbackTemporal as P, pgJsonbColumn as S, pgTimestamptzDateColumn as T, pgInt8Column as _, codecDescriptors as a, pgIntervalColumn as b, pgBoolColumn as c, pgFloat4Column as d, pgFloat8Column as f, pgInt4Column as g, pgInt2Column as h, PgTimestamptzDateDescriptor as i, pgVarcharColumn as j, pgUuidColumn as k, pgCharColumn as l, pgInetColumn as m, NUMERIC_SCALE_RANGE as n, isPgEnumParams as o, pgFloatColumn as p, PgTimestamptzDateCodec as r, pgBitColumn as s, NUMERIC_PRECISION_RANGE as t, pgEnumDescriptor as u, pgInt8NumberColumn as v, pgTextColumn as w, pgJsonColumn as x, pgIntColumn as y };
1690
1884
 
1691
- //# sourceMappingURL=codecs-DQGmsnk3-H6nVRPCC.mjs.map
1885
+ //# sourceMappingURL=codecs-BHNqtI1J-BSS9sL3H.mjs.map