@prisma/orm-target-postgres 8.0.0-rc.2-dev.3 → 8.0.0-rc.20

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 (501) hide show
  1. package/README.md +4 -6
  2. package/dist/adapter-5qylEP__.d.mts +403 -0
  3. package/dist/adapter-5qylEP__.d.mts.map +1 -0
  4. package/dist/{adapter-B0xsc80z-sYcF0RVF.mjs → adapter-svGTIjA2-1p-Iw8D2.mjs} +24 -30
  5. package/dist/adapter-svGTIjA2-1p-Iw8D2.mjs.map +1 -0
  6. package/dist/adapter.d.mts +11 -13
  7. package/dist/adapter.mjs +7 -8
  8. package/dist/adapter__adapter.d.mts +2 -2
  9. package/dist/adapter__adapter.mjs +3 -2
  10. package/dist/adapter__column-types.d.mts +2 -2
  11. package/dist/adapter__column-types.mjs +2 -2
  12. package/dist/adapter__control.d.mts +4 -5
  13. package/dist/adapter__control.mjs +11 -423
  14. package/dist/adapter__control.mjs.map +1 -1
  15. package/dist/adapter__runtime.d.mts +1 -1
  16. package/dist/adapter__runtime.mjs +29 -19
  17. package/dist/adapter__runtime.mjs.map +1 -1
  18. package/dist/adapter__sql-renderer.d.mts +1 -1
  19. package/dist/adapter__sql-renderer.mjs +1 -1
  20. package/dist/adapter__types.d.mts +4 -3
  21. package/dist/aggregates-CEqqEg8k.d.mts +318 -0
  22. package/dist/aggregates-CEqqEg8k.d.mts.map +1 -0
  23. package/dist/{aggregates-Dh6HPdvC.mjs → aggregates-Dw-lAutX.mjs} +105 -40
  24. package/dist/aggregates-Dw-lAutX.mjs.map +1 -0
  25. package/dist/authoring-DWd5pnnV-BBX7P1wT.d.mts +52 -0
  26. package/dist/authoring-DWd5pnnV-BBX7P1wT.d.mts.map +1 -0
  27. package/dist/authoring-SbdvmVJh-nQ7YliD_.mjs +1342 -0
  28. package/dist/authoring-SbdvmVJh-nQ7YliD_.mjs.map +1 -0
  29. package/dist/autoincrement-widths-DonNJgfS-CCvZ4u1W.mjs +58 -0
  30. package/dist/autoincrement-widths-DonNJgfS-CCvZ4u1W.mjs.map +1 -0
  31. package/dist/{canonicalize-CQlxSR4D-MnrT5gtW.d.mts → canonicalize-B-xvDOdd-G3yUeKj4.d.mts} +7 -3
  32. package/dist/canonicalize-B-xvDOdd-G3yUeKj4.d.mts.map +1 -0
  33. package/dist/{canonicalize-CrN3u_xM-D4MrOqcB.mjs → canonicalize-RdxoUHao-FTTkizfe.mjs} +15 -3
  34. package/dist/canonicalize-RdxoUHao-FTTkizfe.mjs.map +1 -0
  35. package/dist/check-expressions-7uCCP01t-DtX2Vak9.mjs +48 -0
  36. package/dist/check-expressions-7uCCP01t-DtX2Vak9.mjs.map +1 -0
  37. package/dist/{check-expressions-DRgG8RN5-DiA-22aC.d.mts → check-expressions-CtTzM58x-LloO-5Vf.d.mts} +14 -13
  38. package/dist/check-expressions-CtTzM58x-LloO-5Vf.d.mts.map +1 -0
  39. package/dist/{codec-descriptor-LT7BpQta-BaDM8UQQ.mjs → codec-descriptor-DoR-cTFZ-BlG5Gj-X.mjs} +12 -21
  40. package/dist/codec-descriptor-DoR-cTFZ-BlG5Gj-X.mjs.map +1 -0
  41. package/dist/codec-descriptor-Fb3UoQGb.d.mts +1 -0
  42. package/dist/codec-descriptor-d1ByNBEk-DhrtS_5y.d.mts +47 -0
  43. package/dist/codec-descriptor-d1ByNBEk-DhrtS_5y.d.mts.map +1 -0
  44. package/dist/codec-ids-BMhEpFwv-B8Zh0s_Q.mjs +41 -0
  45. package/dist/codec-ids-BMhEpFwv-B8Zh0s_Q.mjs.map +1 -0
  46. package/dist/codec-ids-C6II64Wy-CPYTqDTT.d.mts +41 -0
  47. package/dist/codec-ids-C6II64Wy-CPYTqDTT.d.mts.map +1 -0
  48. package/dist/codec-ids-CcB5uBNf.d.mts +1 -0
  49. package/dist/codec-registry-D7XslgPe-DTZnVB8W.mjs +61 -0
  50. package/dist/codec-registry-D7XslgPe-DTZnVB8W.mjs.map +1 -0
  51. package/dist/codec-type-map-Fj5xCgwT-BeCXgfuR.d.mts +53 -0
  52. package/dist/codec-type-map-Fj5xCgwT-BeCXgfuR.d.mts.map +1 -0
  53. package/dist/codec-types-BBACckHa.d.mts +2 -0
  54. package/dist/codec-types-Ct_4iTVc-3tFJcIBo.d.mts +84 -0
  55. package/dist/codec-types-Ct_4iTVc-3tFJcIBo.d.mts.map +1 -0
  56. package/dist/codecs-CADK7dCR-C8WToYQb.d.mts +724 -0
  57. package/dist/codecs-CADK7dCR-C8WToYQb.d.mts.map +1 -0
  58. package/dist/codecs-CRl9-i_r-Co-bgYl3.mjs +1743 -0
  59. package/dist/codecs-CRl9-i_r-Co-bgYl3.mjs.map +1 -0
  60. package/dist/codecs-CoEpEqjM.d.mts +31 -0
  61. package/dist/codecs-CoEpEqjM.d.mts.map +1 -0
  62. package/dist/column-types-B4zsV-u3.mjs +106 -0
  63. package/dist/column-types-B4zsV-u3.mjs.map +1 -0
  64. package/dist/column-types-Bs2V0j8T.d.mts +164 -0
  65. package/dist/column-types-Bs2V0j8T.d.mts.map +1 -0
  66. package/dist/{control-adapter-DFr4gS-r-DM3KcZdQ.mjs → contract-contributions-Xz2FpyfI-CeQZqHKf.mjs} +489 -292
  67. package/dist/contract-contributions-Xz2FpyfI-CeQZqHKf.mjs.map +1 -0
  68. package/dist/{contract-free-DzpGxLfb.d.mts → contract-free-B6-wuc6M.d.mts} +36 -6
  69. package/dist/contract-free-B6-wuc6M.d.mts.map +1 -0
  70. package/dist/{contract-free-aQ4nT-_R.mjs → contract-free-o7olebm9.mjs} +13 -9
  71. package/dist/contract-free-o7olebm9.mjs.map +1 -0
  72. package/dist/control--HupSPoV.d.mts +847 -0
  73. package/dist/control--HupSPoV.d.mts.map +1 -0
  74. package/dist/{control-BaUpALVp.d.mts → control-CQEjh4P7.d.mts} +2 -2
  75. package/dist/control-CQEjh4P7.d.mts.map +1 -0
  76. package/dist/{control-DLTOAEHj.d.mts → control-D4cTcpcJ.d.mts} +22 -48
  77. package/dist/control-D4cTcpcJ.d.mts.map +1 -0
  78. package/dist/{control-Y6FxMu3o.mjs → control-DZQwENIP.mjs} +21 -9
  79. package/dist/control-DZQwENIP.mjs.map +1 -0
  80. package/dist/{control-policy-B53lnBCT-B9K9Cj1x.mjs → control-policy-DtU5u9Dm-44r_OF94.mjs} +444 -218
  81. package/dist/control-policy-DtU5u9Dm-44r_OF94.mjs.map +1 -0
  82. package/dist/{data-transform-ChZzy2dP-CxVCat_8.mjs → data-transform-h9agBu_c-RlC5A7aY.mjs} +12 -5
  83. package/dist/data-transform-h9agBu_c-RlC5A7aY.mjs.map +1 -0
  84. package/dist/{data-transform-Ck5FbyNO-BNE7QlAo.d.mts → data-transform-nGy9rz87-CE3DGlgn.d.mts} +15 -4
  85. package/dist/data-transform-nGy9rz87-CE3DGlgn.d.mts.map +1 -0
  86. package/dist/data-transform-nqkqNIb8.d.mts +1 -0
  87. package/dist/data-type-entries-gQW3-KSb-BIl8vgus.mjs +128 -0
  88. package/dist/data-type-entries-gQW3-KSb-BIl8vgus.mjs.map +1 -0
  89. package/dist/data-types--7V9yY1G.d.mts +99 -0
  90. package/dist/data-types--7V9yY1G.d.mts.map +1 -0
  91. package/dist/data-types-Chx0mjTP-DczU4S9b.mjs +950 -0
  92. package/dist/data-types-Chx0mjTP-DczU4S9b.mjs.map +1 -0
  93. package/dist/date-time-now-generators-CMkXVbMG-C-GjhReE.d.mts +45 -0
  94. package/dist/date-time-now-generators-CMkXVbMG-C-GjhReE.d.mts.map +1 -0
  95. package/dist/ddl-B7Rqlz6D-B7dRDgYb.mjs +647 -0
  96. package/dist/ddl-B7Rqlz6D-B7dRDgYb.mjs.map +1 -0
  97. package/dist/ddl-B8nQZTWN.d.mts +1 -0
  98. package/dist/default-constraint-names-Cz9Yoeim-sUzOGvIm.mjs +18 -0
  99. package/dist/default-constraint-names-Cz9Yoeim-sUzOGvIm.mjs.map +1 -0
  100. package/dist/default-normalizer-BqK6XxdC-2OUb2ybG.mjs +311 -0
  101. package/dist/default-normalizer-BqK6XxdC-2OUb2ybG.mjs.map +1 -0
  102. package/dist/default-normalizer-DO-cH75Q.d.mts +25 -0
  103. package/dist/default-normalizer-DO-cH75Q.d.mts.map +1 -0
  104. package/dist/descriptor-meta-BkD3nXF_-CZaNqC6r.mjs +36 -0
  105. package/dist/descriptor-meta-BkD3nXF_-CZaNqC6r.mjs.map +1 -0
  106. package/dist/descriptor-meta-DaFDNnHQ-QjiiAEtC.mjs +64 -0
  107. package/dist/descriptor-meta-DaFDNnHQ-QjiiAEtC.mjs.map +1 -0
  108. package/dist/descriptor-meta-runtime-Dft1L7eE-D8vpOz_Z.mjs +15 -0
  109. package/dist/descriptor-meta-runtime-Dft1L7eE-D8vpOz_Z.mjs.map +1 -0
  110. package/dist/{diff-database-schema-DsoNznGC.d.mts → diff-database-schema-BxzhZaVN.d.mts} +12 -7
  111. package/dist/diff-database-schema-BxzhZaVN.d.mts.map +1 -0
  112. package/dist/{diff-database-schema-DKq76rCk-uehceHYz.mjs → diff-database-schema-DAEzWtzU-DoyVgKqh.mjs} +38 -18
  113. package/dist/diff-database-schema-DAEzWtzU-DoyVgKqh.mjs.map +1 -0
  114. package/dist/driver.d.mts +3 -3
  115. package/dist/driver.mjs +3 -2
  116. package/dist/driver__control.d.mts +1 -1
  117. package/dist/driver__control.mjs +1 -1
  118. package/dist/driver__runtime.d.mts +2 -2
  119. package/dist/driver__runtime.mjs +2 -639
  120. package/dist/errors-BrhQYgdL-IvZHPjwL.mjs +103 -0
  121. package/dist/errors-BrhQYgdL-IvZHPjwL.mjs.map +1 -0
  122. package/dist/{errors-CU4xIwwk.d.mts → errors-D3Mj-x0o.d.mts} +3 -3
  123. package/dist/errors-D3Mj-x0o.d.mts.map +1 -0
  124. package/dist/full-text-BYg7EVX2.mjs +39 -0
  125. package/dist/full-text-BYg7EVX2.mjs.map +1 -0
  126. package/dist/full-text-SDbfxrE_.d.mts +26 -0
  127. package/dist/full-text-SDbfxrE_.d.mts.map +1 -0
  128. package/dist/full-text-collection-method-BFd2u2cs-Ba3OiWM3.d.mts +27 -0
  129. package/dist/full-text-collection-method-BFd2u2cs-Ba3OiWM3.d.mts.map +1 -0
  130. package/dist/full-text-index-authoring-CN1L9C1k.d.mts +7 -0
  131. package/dist/full-text-index-authoring-CN1L9C1k.d.mts.map +1 -0
  132. package/dist/full-text-index-definition-BPxQQBuC-VLyQ1kEL.mjs +195 -0
  133. package/dist/full-text-index-definition-BPxQQBuC-VLyQ1kEL.mjs.map +1 -0
  134. package/dist/full-text-index-definition-D5iBWLss-BEpqiucV.d.mts +71 -0
  135. package/dist/full-text-index-definition-D5iBWLss-BEpqiucV.d.mts.map +1 -0
  136. package/dist/full-text-parsers-CFFxiOrp-CrZ7VI1m.mjs +139 -0
  137. package/dist/full-text-parsers-CFFxiOrp-CrZ7VI1m.mjs.map +1 -0
  138. package/dist/full-text-search-document-Doy5TF7c-aMWM_1KB.mjs +54 -0
  139. package/dist/full-text-search-document-Doy5TF7c-aMWM_1KB.mjs.map +1 -0
  140. package/dist/index-types-BihjrAAq-C2VnfAyF.mjs +14 -0
  141. package/dist/index-types-BihjrAAq-C2VnfAyF.mjs.map +1 -0
  142. package/dist/indexes-BYf6nXVv-BXwLw7fO.d.mts +60 -0
  143. package/dist/indexes-BYf6nXVv-BXwLw7fO.d.mts.map +1 -0
  144. package/dist/infer-psl-contract-BSSHcuRi-ChdFSviw.mjs +1143 -0
  145. package/dist/infer-psl-contract-BSSHcuRi-ChdFSviw.mjs.map +1 -0
  146. package/dist/{issue-planner-Biq9Ls7e.d.mts → issue-planner-D-On52xP.d.mts} +39 -9
  147. package/dist/issue-planner-D-On52xP.d.mts.map +1 -0
  148. package/dist/list-decoder-BcrLExnx-DlCwavhu.d.mts +7 -0
  149. package/dist/list-decoder-BcrLExnx-DlCwavhu.d.mts.map +1 -0
  150. package/dist/marker-lock-BviIbusV.d.mts +11 -0
  151. package/dist/marker-lock-BviIbusV.d.mts.map +1 -0
  152. package/dist/marker-lock-DFc1Tfv5-BkBKBRE3.mjs +11 -0
  153. package/dist/marker-lock-DFc1Tfv5-BkBKBRE3.mjs.map +1 -0
  154. package/dist/{migration-PTHAY9Cv.mjs → migration-Be_iuIpn.mjs} +5 -4
  155. package/dist/migration-Be_iuIpn.mjs.map +1 -0
  156. package/dist/migration-D4lMmLVj.d.mts +26 -0
  157. package/dist/migration-D4lMmLVj.d.mts.map +1 -0
  158. package/dist/{namespace-ids-xtp_ZY86-Cpp8PTxD.mjs → namespace-ids-xtp_ZY86-Cxc0dBbO.mjs} +2 -2
  159. package/dist/namespace-ids-xtp_ZY86-Cxc0dBbO.mjs.map +1 -0
  160. package/dist/native-type-normalizer-BaGa9eeb.d.mts +30 -0
  161. package/dist/native-type-normalizer-BaGa9eeb.d.mts.map +1 -0
  162. package/dist/native-type-normalizer-Cn-RGt_E.mjs +24 -0
  163. package/dist/native-type-normalizer-Cn-RGt_E.mjs.map +1 -0
  164. package/dist/{nodes-DAvDJLvJ-BBdvFXNa.mjs → nodes-G8VTh4PM-DNvIhHag.mjs} +78 -7
  165. package/dist/nodes-G8VTh4PM-DNvIhHag.mjs.map +1 -0
  166. package/dist/{nodes-BU-V-aZA-RqwPH68u.d.mts → nodes-s0Oe37jT-Cw3BU2gL.d.mts} +82 -29
  167. package/dist/nodes-s0Oe37jT-Cw3BU2gL.d.mts.map +1 -0
  168. package/dist/op-factory-call-CRaVUOb_.d.mts +1 -0
  169. package/dist/{op-factory-call-H6zeDGLe-_1pAftJk.mjs → op-factory-call-gGX-mZu--0QUG5xH4.mjs} +1014 -258
  170. package/dist/op-factory-call-gGX-mZu--0QUG5xH4.mjs.map +1 -0
  171. package/dist/{op-factory-call-BAeyLFYf-BAgG1h1C.d.mts → op-factory-call-nLHvNx0O-BTBhGbOF.d.mts} +169 -111
  172. package/dist/op-factory-call-nLHvNx0O-BTBhGbOF.d.mts.map +1 -0
  173. package/dist/operation-types--Wa_cv45-RoRnL1Dn.d.mts +192 -0
  174. package/dist/operation-types--Wa_cv45-RoRnL1Dn.d.mts.map +1 -0
  175. package/dist/operation-types-OXILTAOX.d.mts +1 -0
  176. package/dist/pack-2CYw2w-b.d.mts +1573 -0
  177. package/dist/pack-2CYw2w-b.d.mts.map +1 -0
  178. package/dist/{planner-CT-7zSfk.d.mts → planner-AD3Dt57t.d.mts} +23 -51
  179. package/dist/planner-AD3Dt57t.d.mts.map +1 -0
  180. package/dist/planner-VuR6URu3-CCUT2Osx.mjs +954 -0
  181. package/dist/planner-VuR6URu3-CCUT2Osx.mjs.map +1 -0
  182. package/dist/planner-ddl-builders-CPM3y7cQ.d.mts +16 -0
  183. package/dist/planner-ddl-builders-CPM3y7cQ.d.mts.map +1 -0
  184. package/dist/planner-ddl-builders-cYnH52gC-BWifb_M6.mjs +28 -0
  185. package/dist/planner-ddl-builders-cYnH52gC-BWifb_M6.mjs.map +1 -0
  186. package/dist/planner-identity-values-Dsq989Lh.d.mts +26 -0
  187. package/dist/planner-identity-values-Dsq989Lh.d.mts.map +1 -0
  188. package/dist/planner-identity-values-QstrMJ2U-CcpaRVPY.mjs +70 -0
  189. package/dist/planner-identity-values-QstrMJ2U-CcpaRVPY.mjs.map +1 -0
  190. package/dist/planner-produced-postgres-migration-BBUwtjA_.d.mts +1 -0
  191. package/dist/{planner-produced-postgres-migration-D5m8nK6s-CbZ4hlbv.mjs → planner-produced-postgres-migration-BZclL_xO-uflxtYuP.mjs} +5 -5
  192. package/dist/planner-produced-postgres-migration-BZclL_xO-uflxtYuP.mjs.map +1 -0
  193. package/dist/{planner-produced-postgres-migration-BaviT8KK-Yo9kw6rs.d.mts → planner-produced-postgres-migration-DyIXJ3MR-DHO5wn_X.d.mts} +4 -4
  194. package/dist/planner-produced-postgres-migration-DyIXJ3MR-DHO5wn_X.d.mts.map +1 -0
  195. package/dist/{planner-schema-lookup-kMIVP2y--CdO4VlnF.mjs → planner-schema-lookup-BbUY9oVy.mjs} +2 -2
  196. package/dist/planner-schema-lookup-BbUY9oVy.mjs.map +1 -0
  197. package/dist/{planner-schema-lookup-C4DHAddq.d.mts → planner-schema-lookup-ceCNOGFf.d.mts} +2 -2
  198. package/dist/planner-schema-lookup-ceCNOGFf.d.mts.map +1 -0
  199. package/dist/planner-sql-checks-D-K44J19-CzvrqzNB.mjs +151 -0
  200. package/dist/planner-sql-checks-D-K44J19-CzvrqzNB.mjs.map +1 -0
  201. package/dist/planner-sql-checks-Ed-WGtge-D9ByMrW4.d.mts +37 -0
  202. package/dist/planner-sql-checks-Ed-WGtge-D9ByMrW4.d.mts.map +1 -0
  203. package/dist/planner-sql-checks-rEjFx_Jv.d.mts +1 -0
  204. package/dist/planner-target-details-CUEF0s90-6g-mOgTI.mjs +14 -0
  205. package/dist/planner-target-details-CUEF0s90-6g-mOgTI.mjs.map +1 -0
  206. package/dist/{planner-target-details-HkP4RrRO-_xPQVPF0.d.mts → planner-target-details-HkP4RrRO-D6VtK0jY.d.mts} +2 -2
  207. package/dist/planner-target-details-HkP4RrRO-D6VtK0jY.d.mts.map +1 -0
  208. package/dist/postgres-codec-traits-CnP5Bjxp-Dxdgv0TI.mjs +11 -0
  209. package/dist/postgres-codec-traits-CnP5Bjxp-Dxdgv0TI.mjs.map +1 -0
  210. package/dist/{postgres-contract-view-2OP5JnXl-D2fpy4-8.d.mts → postgres-contract-view-BFzIDwwN-hL3QLe_b.d.mts} +2 -2
  211. package/dist/postgres-contract-view-BFzIDwwN-hL3QLe_b.d.mts.map +1 -0
  212. package/dist/{postgres-contract-view-B8ykf2cO-T2LvWVFZ.mjs → postgres-contract-view-BO2elRMz-BqMBzJoJ.mjs} +27 -14
  213. package/dist/postgres-contract-view-BO2elRMz-BqMBzJoJ.mjs.map +1 -0
  214. package/dist/{postgres-database-schema-node-CyfpHXDr-BqyozkQE.d.mts → postgres-database-schema-node-Cv8usVNX-BmvGozi4.d.mts} +4 -4
  215. package/dist/postgres-database-schema-node-Cv8usVNX-BmvGozi4.d.mts.map +1 -0
  216. package/dist/postgres-migration-BSWmeRLo-CUfVTUf0.mjs +1312 -0
  217. package/dist/postgres-migration-BSWmeRLo-CUfVTUf0.mjs.map +1 -0
  218. package/dist/{postgres-migration-BNsrwlxh-CwI5BqAu.d.mts → postgres-migration-C5deJ3Ne-C4Jxu-e6.d.mts} +135 -15
  219. package/dist/postgres-migration-C5deJ3Ne-C4Jxu-e6.d.mts.map +1 -0
  220. package/dist/{postgres-native-enum-CdP3b_-R-Cgz9KEKx.mjs → postgres-native-enum-CdP3b_-R-DgG3pi5p.mjs} +2 -2
  221. package/dist/postgres-native-enum-CdP3b_-R-DgG3pi5p.mjs.map +1 -0
  222. package/dist/postgres-object-name-FPikIvOw-B8FfJI7z.mjs +23 -0
  223. package/dist/postgres-object-name-FPikIvOw-B8FfJI7z.mjs.map +1 -0
  224. package/dist/{postgres-rls-policy-CnDxf3z9-C3LIHAIG.d.mts → postgres-rls-policy-CnDxf3z9-BjpVyUnK.d.mts} +2 -2
  225. package/dist/postgres-rls-policy-CnDxf3z9-BjpVyUnK.d.mts.map +1 -0
  226. package/dist/{postgres-role-schema-node-B8Z5i5D--PObwlU2Z.mjs → postgres-role-schema-node-B8Z5i5D--BzOKm4N1.mjs} +3 -3
  227. package/dist/postgres-role-schema-node-B8Z5i5D--BzOKm4N1.mjs.map +1 -0
  228. package/dist/{postgres-schema-CF0yHESb-D7n2X21R.mjs → postgres-schema-C6w1rzOF-D1fdwqRx.mjs} +14 -12
  229. package/dist/postgres-schema-C6w1rzOF-D1fdwqRx.mjs.map +1 -0
  230. package/dist/{postgres-schema-Xsjt3RKO-Buv2X8ai.d.mts → postgres-schema-Xsjt3RKO-bis-SVSB.d.mts} +4 -4
  231. package/dist/postgres-schema-Xsjt3RKO-bis-SVSB.d.mts.map +1 -0
  232. package/dist/{postgres-table-schema-node-BBkitBQh-DT1T5VWU.mjs → postgres-table-schema-node-BBkitBQh-Dll8iaZT.mjs} +2 -2
  233. package/dist/postgres-table-schema-node-BBkitBQh-Dll8iaZT.mjs.map +1 -0
  234. package/dist/prisma7-binding-BjiLA9F7.mjs +307 -0
  235. package/dist/prisma7-binding-BjiLA9F7.mjs.map +1 -0
  236. package/dist/prisma7-binding-a56klfkc.d.mts +1651 -0
  237. package/dist/prisma7-binding-a56klfkc.d.mts.map +1 -0
  238. package/dist/{render-ops-DOsRP0Po-BKn_c_Ia.mjs → render-ops-BgqtCw9Z-T8BPTX85.mjs} +17 -10
  239. package/dist/render-ops-BgqtCw9Z-T8BPTX85.mjs.map +1 -0
  240. package/dist/{render-ops-DPwhZt2W.d.mts → render-ops-Bl84i7ut.d.mts} +3 -3
  241. package/dist/render-ops-Bl84i7ut.d.mts.map +1 -0
  242. package/dist/{render-typescript-6sCFvMBh.d.mts → render-typescript-BysdXYpH.d.mts} +2 -2
  243. package/dist/render-typescript-BysdXYpH.d.mts.map +1 -0
  244. package/dist/{render-typescript-Dqp1Spgn-B128r1qw.mjs → render-typescript-Dqp1Spgn-B4mJhuVr.mjs} +2 -2
  245. package/dist/render-typescript-Dqp1Spgn-B4mJhuVr.mjs.map +1 -0
  246. package/dist/resolve-ddl-schema-D3VNPMSm-BuB6NyOI.mjs +34 -0
  247. package/dist/resolve-ddl-schema-D3VNPMSm-BuB6NyOI.mjs.map +1 -0
  248. package/dist/{runtime-lHBKgjB9.d.mts → runtime-C0VXuM0b.d.mts} +4 -3
  249. package/dist/runtime-C0VXuM0b.d.mts.map +1 -0
  250. package/dist/runtime-CXfxy5ED.mjs +660 -0
  251. package/dist/runtime-CXfxy5ED.mjs.map +1 -0
  252. package/dist/{runtime-_TfO66h5.d.mts → runtime-Ci_toEDZ.d.mts} +12 -4
  253. package/dist/runtime-Ci_toEDZ.d.mts.map +1 -0
  254. package/dist/{runtime-DOXznQe0.d.mts → runtime-DtjW0GP_.d.mts} +4 -4
  255. package/dist/runtime-DtjW0GP_.d.mts.map +1 -0
  256. package/dist/{schema-ir-annotations-DuuYh0gl.d.mts → schema-ir-annotations-BygaWBiC.d.mts} +2 -2
  257. package/dist/schema-ir-annotations-BygaWBiC.d.mts.map +1 -0
  258. package/dist/{schema-node-kinds-qlnURWJy-Bo30pwTM.d.mts → schema-node-kinds-C52Bb1ve-DmxQRPPS.d.mts} +2 -2
  259. package/dist/schema-node-kinds-C52Bb1ve-DmxQRPPS.d.mts.map +1 -0
  260. package/dist/{normalize-error-CNjgVO71-CLlZ3CuJ.mjs → server-text-types-DeNPQpv5-DqX0h8WF.mjs} +45 -3
  261. package/dist/server-text-types-DeNPQpv5-DqX0h8WF.mjs.map +1 -0
  262. package/dist/{sql-renderer-ComgusFq-BBlqM1fw.mjs → sql-renderer-BdWJPa5F-Ct0CPlXc.mjs} +113 -123
  263. package/dist/sql-renderer-BdWJPa5F-Ct0CPlXc.mjs.map +1 -0
  264. package/dist/{sql-renderer-BgC0ZgLS.d.mts → sql-renderer-BiBhge7D.d.mts} +9 -7
  265. package/dist/sql-renderer-BiBhge7D.d.mts.map +1 -0
  266. package/dist/{sql-utils-DuzN3JZg-DiXy4Vah.mjs → sql-utils-Bnw3JbWf-BN0gcjZB.mjs} +31 -8
  267. package/dist/sql-utils-Bnw3JbWf-BN0gcjZB.mjs.map +1 -0
  268. package/dist/{sql-utils-DW6fkczF.d.mts → sql-utils-CnnGiZBc.d.mts} +12 -4
  269. package/dist/sql-utils-CnnGiZBc.d.mts.map +1 -0
  270. package/dist/{table-source-ikHOZmhD-DriY1Lcr.d.mts → table-source-ikHOZmhD-vYcblBYv.d.mts} +2 -2
  271. package/dist/table-source-ikHOZmhD-vYcblBYv.d.mts.map +1 -0
  272. package/dist/target.d.mts +61 -49
  273. package/dist/target.mjs +45 -36
  274. package/dist/target__aggregates.d.mts +1 -1
  275. package/dist/target__aggregates.mjs +1 -1
  276. package/dist/target__codec-descriptor.d.mts +2 -2
  277. package/dist/target__codec-descriptor.mjs +1 -1
  278. package/dist/target__codec-ids.d.mts +3 -3
  279. package/dist/target__codec-ids.mjs +2 -2
  280. package/dist/target__codec-types.d.mts +4 -4
  281. package/dist/target__codecs.d.mts +4 -3
  282. package/dist/target__codecs.mjs +3 -3
  283. package/dist/target__contract-free.d.mts +3 -3
  284. package/dist/target__contract-free.mjs +4 -4
  285. package/dist/target__control.d.mts +4 -2
  286. package/dist/target__control.mjs +2501 -2
  287. package/dist/target__control.mjs.map +1 -0
  288. package/dist/target__data-transform.d.mts +2 -2
  289. package/dist/target__data-transform.mjs +1 -1
  290. package/dist/target__data-types.d.mts +2 -0
  291. package/dist/target__data-types.mjs +3 -0
  292. package/dist/target__ddl.d.mts +4 -4
  293. package/dist/target__ddl.mjs +2 -2
  294. package/dist/target__default-normalizer.d.mts +2 -2
  295. package/dist/target__default-normalizer.mjs +2 -2
  296. package/dist/target__diff-database-schema.d.mts +1 -1
  297. package/dist/target__diff-database-schema.mjs +1 -1
  298. package/dist/target__errors.d.mts +1 -1
  299. package/dist/target__errors.mjs +1 -1
  300. package/dist/target__full-text-index-authoring.d.mts +3 -0
  301. package/dist/target__full-text-index-authoring.mjs +3 -0
  302. package/dist/target__full-text.d.mts +4 -0
  303. package/dist/target__full-text.mjs +3 -0
  304. package/dist/target__issue-planner.d.mts +1 -1
  305. package/dist/target__issue-planner.mjs +1 -1
  306. package/dist/target__marker-lock.d.mts +2 -0
  307. package/dist/target__marker-lock.mjs +2 -0
  308. package/dist/target__migration.d.mts +4 -4
  309. package/dist/target__migration.mjs +5 -5
  310. package/dist/target__native-type-normalizer.d.mts +2 -2
  311. package/dist/target__native-type-normalizer.mjs +2 -2
  312. package/dist/target__op-factory-call.d.mts +3 -3
  313. package/dist/target__op-factory-call.mjs +2 -2
  314. package/dist/target__operation-types.d.mts +4 -0
  315. package/dist/target__pack.d.mts +3 -2
  316. package/dist/target__pack.mjs +1 -1
  317. package/dist/target__planner-ddl-builders.d.mts +2 -2
  318. package/dist/target__planner-ddl-builders.mjs +2 -2
  319. package/dist/target__planner-identity-values.d.mts +1 -1
  320. package/dist/target__planner-identity-values.mjs +1 -1
  321. package/dist/target__planner-produced-postgres-migration.d.mts +2 -2
  322. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  323. package/dist/target__planner-schema-lookup.d.mts +1 -1
  324. package/dist/target__planner-schema-lookup.mjs +1 -1
  325. package/dist/target__planner-sql-checks.d.mts +3 -2
  326. package/dist/target__planner-sql-checks.mjs +2 -2
  327. package/dist/target__planner-target-details.d.mts +1 -1
  328. package/dist/target__planner.d.mts +1 -1
  329. package/dist/target__planner.mjs +2 -2
  330. package/dist/target__prisma7-binding.d.mts +2 -0
  331. package/dist/target__prisma7-binding.mjs +2 -0
  332. package/dist/target__render-ops.d.mts +1 -1
  333. package/dist/target__render-ops.mjs +1 -1
  334. package/dist/target__render-typescript.d.mts +1 -1
  335. package/dist/target__render-typescript.mjs +1 -1
  336. package/dist/target__rls-canonicalize.d.mts +2 -2
  337. package/dist/target__rls-canonicalize.mjs +2 -2
  338. package/dist/target__runtime.d.mts +6 -3
  339. package/dist/target__runtime.mjs +193 -4
  340. package/dist/target__runtime.mjs.map +1 -1
  341. package/dist/target__schema-ir-annotations.d.mts +1 -1
  342. package/dist/target__schema-ir-annotations.mjs +1 -1
  343. package/dist/target__sql-utils.d.mts +3 -2
  344. package/dist/target__sql-utils.mjs +4 -2
  345. package/dist/target__types.d.mts +7 -7
  346. package/dist/target__types.mjs +5 -5
  347. package/dist/types-AvjnIUna.d.mts +2 -0
  348. package/dist/types-D6lgKhE5-D1J9YJnd.d.mts +28 -0
  349. package/dist/types-D6lgKhE5-D1J9YJnd.d.mts.map +1 -0
  350. package/dist/{types-CjGjPLr5.d.mts → types-DOmgp_12.d.mts} +8 -8
  351. package/dist/types-DOmgp_12.d.mts.map +1 -0
  352. package/dist/{types-ue6jkJyF-BQJzjx1P.d.mts → types-ue6jkJyF-D79DmBTl.d.mts} +2 -2
  353. package/dist/types-ue6jkJyF-D79DmBTl.d.mts.map +1 -0
  354. package/package.json +22 -14
  355. package/dist/adapter-B0xsc80z-sYcF0RVF.mjs.map +0 -1
  356. package/dist/adapter-CPesdzv0.d.mts +0 -26
  357. package/dist/adapter-CPesdzv0.d.mts.map +0 -1
  358. package/dist/adapter__operation-types.d.mts +0 -2
  359. package/dist/aggregates-CgqNfj2O.d.mts +0 -10
  360. package/dist/aggregates-CgqNfj2O.d.mts.map +0 -1
  361. package/dist/aggregates-Dh6HPdvC.mjs.map +0 -1
  362. package/dist/authoring-BOpdZa2N-ClrLFiXw.mjs +0 -773
  363. package/dist/authoring-BOpdZa2N-ClrLFiXw.mjs.map +0 -1
  364. package/dist/canonicalize-CQlxSR4D-MnrT5gtW.d.mts.map +0 -1
  365. package/dist/canonicalize-CrN3u_xM-D4MrOqcB.mjs.map +0 -1
  366. package/dist/check-expressions-5vhxWaFy-CBcjFeur.mjs +0 -41
  367. package/dist/check-expressions-5vhxWaFy-CBcjFeur.mjs.map +0 -1
  368. package/dist/check-expressions-DRgG8RN5-DiA-22aC.d.mts.map +0 -1
  369. package/dist/codec-descriptor-Bec_zukr-BfvtUqhm.d.mts +0 -37
  370. package/dist/codec-descriptor-Bec_zukr-BfvtUqhm.d.mts.map +0 -1
  371. package/dist/codec-descriptor-Bg-_412t.d.mts +0 -1
  372. package/dist/codec-descriptor-LT7BpQta-BaDM8UQQ.mjs.map +0 -1
  373. package/dist/codec-ids-Bqu_IwO0-DKOdPizQ.d.mts +0 -35
  374. package/dist/codec-ids-Bqu_IwO0-DKOdPizQ.d.mts.map +0 -1
  375. package/dist/codec-ids-C5Rkltkw-DMf87l9s.mjs +0 -35
  376. package/dist/codec-ids-C5Rkltkw-DMf87l9s.mjs.map +0 -1
  377. package/dist/codec-ids-DJ6j6pZc.d.mts +0 -1
  378. package/dist/codec-types-BRU4F-7t-BaJbKF_i.d.mts +0 -84
  379. package/dist/codec-types-BRU4F-7t-BaJbKF_i.d.mts.map +0 -1
  380. package/dist/codec-types-bX63JRLf.d.mts +0 -2
  381. package/dist/codecs-B1HgsJZ2.mjs +0 -15
  382. package/dist/codecs-B1HgsJZ2.mjs.map +0 -1
  383. package/dist/codecs-BmPCJWqb-DveZGJvm.mjs +0 -1680
  384. package/dist/codecs-BmPCJWqb-DveZGJvm.mjs.map +0 -1
  385. package/dist/codecs-D8tLswBi-_nbo-Z8x.d.mts +0 -638
  386. package/dist/codecs-D8tLswBi-_nbo-Z8x.d.mts.map +0 -1
  387. package/dist/codecs-DmCKO7dg.d.mts +0 -15
  388. package/dist/codecs-DmCKO7dg.d.mts.map +0 -1
  389. package/dist/column-types-BH-MU6uU.d.mts +0 -108
  390. package/dist/column-types-BH-MU6uU.d.mts.map +0 -1
  391. package/dist/column-types-Bh92dNjD.mjs +0 -126
  392. package/dist/column-types-Bh92dNjD.mjs.map +0 -1
  393. package/dist/contract-free-DzpGxLfb.d.mts.map +0 -1
  394. package/dist/contract-free-aQ4nT-_R.mjs.map +0 -1
  395. package/dist/control-2F195jJk.d.mts +0 -11
  396. package/dist/control-2F195jJk.d.mts.map +0 -1
  397. package/dist/control-BaUpALVp.d.mts.map +0 -1
  398. package/dist/control-DLTOAEHj.d.mts.map +0 -1
  399. package/dist/control-V7OkAC55.mjs +0 -1459
  400. package/dist/control-V7OkAC55.mjs.map +0 -1
  401. package/dist/control-Y6FxMu3o.mjs.map +0 -1
  402. package/dist/control-adapter-DFr4gS-r-DM3KcZdQ.mjs.map +0 -1
  403. package/dist/control-policy-B53lnBCT-B9K9Cj1x.mjs.map +0 -1
  404. package/dist/data-transform-BSM7TQpE.d.mts +0 -1
  405. package/dist/data-transform-ChZzy2dP-CxVCat_8.mjs.map +0 -1
  406. package/dist/data-transform-Ck5FbyNO-BNE7QlAo.d.mts.map +0 -1
  407. package/dist/ddl-B4Rh8ntj.d.mts +0 -1
  408. package/dist/ddl-CNQJds-C-WfZ3y4y8.mjs +0 -395
  409. package/dist/ddl-CNQJds-C-WfZ3y4y8.mjs.map +0 -1
  410. package/dist/default-normalizer-B36TOul4.d.mts +0 -31
  411. package/dist/default-normalizer-B36TOul4.d.mts.map +0 -1
  412. package/dist/default-normalizer-Ba5ZebHM-isV86rjy.mjs +0 -253
  413. package/dist/default-normalizer-Ba5ZebHM-isV86rjy.mjs.map +0 -1
  414. package/dist/descriptor-meta-KVX21fsl-DBDoB4eg.mjs +0 -354
  415. package/dist/descriptor-meta-KVX21fsl-DBDoB4eg.mjs.map +0 -1
  416. package/dist/descriptor-meta-rilAH3ep-dAmiVLpe.mjs +0 -30
  417. package/dist/descriptor-meta-rilAH3ep-dAmiVLpe.mjs.map +0 -1
  418. package/dist/descriptor-meta-runtime-UwYdV8fD-B_m_Ha8r.mjs +0 -13
  419. package/dist/descriptor-meta-runtime-UwYdV8fD-B_m_Ha8r.mjs.map +0 -1
  420. package/dist/diff-database-schema-DKq76rCk-uehceHYz.mjs.map +0 -1
  421. package/dist/diff-database-schema-DsoNznGC.d.mts.map +0 -1
  422. package/dist/driver__runtime.mjs.map +0 -1
  423. package/dist/errors-CU4xIwwk.d.mts.map +0 -1
  424. package/dist/errors-DKjQzNaN-DFcF1thx.mjs +0 -39
  425. package/dist/errors-DKjQzNaN-DFcF1thx.mjs.map +0 -1
  426. package/dist/issue-planner-Biq9Ls7e.d.mts.map +0 -1
  427. package/dist/migration-PTHAY9Cv.mjs.map +0 -1
  428. package/dist/migration-aFeTWTOJ.d.mts +0 -25
  429. package/dist/migration-aFeTWTOJ.d.mts.map +0 -1
  430. package/dist/namespace-ids-xtp_ZY86-Cpp8PTxD.mjs.map +0 -1
  431. package/dist/native-type-normalizer-DqJlOTeX.d.mts +0 -19
  432. package/dist/native-type-normalizer-DqJlOTeX.d.mts.map +0 -1
  433. package/dist/native-type-normalizer-yvd3tqv-.mjs +0 -38
  434. package/dist/native-type-normalizer-yvd3tqv-.mjs.map +0 -1
  435. package/dist/nodes-BU-V-aZA-RqwPH68u.d.mts.map +0 -1
  436. package/dist/nodes-DAvDJLvJ-BBdvFXNa.mjs.map +0 -1
  437. package/dist/normalize-error-CNjgVO71-CLlZ3CuJ.mjs.map +0 -1
  438. package/dist/op-factory-call-BAeyLFYf-BAgG1h1C.d.mts.map +0 -1
  439. package/dist/op-factory-call-BTU8I_x0.d.mts +0 -1
  440. package/dist/op-factory-call-H6zeDGLe-_1pAftJk.mjs.map +0 -1
  441. package/dist/operation-types-BfRocNI8.d.mts +0 -22
  442. package/dist/operation-types-BfRocNI8.d.mts.map +0 -1
  443. package/dist/pack-CySS3DQU.d.mts +0 -626
  444. package/dist/pack-CySS3DQU.d.mts.map +0 -1
  445. package/dist/planner-CT-7zSfk.d.mts.map +0 -1
  446. package/dist/planner-D0uogzvT-1WyGIC5p.mjs +0 -671
  447. package/dist/planner-D0uogzvT-1WyGIC5p.mjs.map +0 -1
  448. package/dist/planner-ddl-builders-Chxh-LEQ-DXvwOeeA.mjs +0 -102
  449. package/dist/planner-ddl-builders-Chxh-LEQ-DXvwOeeA.mjs.map +0 -1
  450. package/dist/planner-ddl-builders-ijp60-JO.d.mts +0 -19
  451. package/dist/planner-ddl-builders-ijp60-JO.d.mts.map +0 -1
  452. package/dist/planner-identity-values-BmHn5C6U-BYBbUAyR.mjs +0 -90
  453. package/dist/planner-identity-values-BmHn5C6U-BYBbUAyR.mjs.map +0 -1
  454. package/dist/planner-identity-values-TfEhnoWa.d.mts +0 -25
  455. package/dist/planner-identity-values-TfEhnoWa.d.mts.map +0 -1
  456. package/dist/planner-produced-postgres-migration-BaviT8KK-Yo9kw6rs.d.mts.map +0 -1
  457. package/dist/planner-produced-postgres-migration-D5m8nK6s-CbZ4hlbv.mjs.map +0 -1
  458. package/dist/planner-produced-postgres-migration-D6C0T2xV.d.mts +0 -1
  459. package/dist/planner-schema-lookup-C4DHAddq.d.mts.map +0 -1
  460. package/dist/planner-schema-lookup-kMIVP2y--CdO4VlnF.mjs.map +0 -1
  461. package/dist/planner-sql-checks-CFgbRTJw.d.mts +0 -20
  462. package/dist/planner-sql-checks-CFgbRTJw.d.mts.map +0 -1
  463. package/dist/planner-sql-checks-ftgzvIO9-BTtBg2Vz.mjs +0 -152
  464. package/dist/planner-sql-checks-ftgzvIO9-BTtBg2Vz.mjs.map +0 -1
  465. package/dist/planner-target-details-HkP4RrRO-_xPQVPF0.d.mts.map +0 -1
  466. package/dist/planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs +0 -15
  467. package/dist/planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs.map +0 -1
  468. package/dist/postgres-contract-view-2OP5JnXl-D2fpy4-8.d.mts.map +0 -1
  469. package/dist/postgres-contract-view-B8ykf2cO-T2LvWVFZ.mjs.map +0 -1
  470. package/dist/postgres-database-schema-node-CyfpHXDr-BqyozkQE.d.mts.map +0 -1
  471. package/dist/postgres-migration-BNsrwlxh-CwI5BqAu.d.mts.map +0 -1
  472. package/dist/postgres-migration-Dbq3RGfZ-aMnwfEAb.mjs +0 -205
  473. package/dist/postgres-migration-Dbq3RGfZ-aMnwfEAb.mjs.map +0 -1
  474. package/dist/postgres-native-enum-CdP3b_-R-Cgz9KEKx.mjs.map +0 -1
  475. package/dist/postgres-rls-policy-CnDxf3z9-C3LIHAIG.d.mts.map +0 -1
  476. package/dist/postgres-role-schema-node-B8Z5i5D--PObwlU2Z.mjs.map +0 -1
  477. package/dist/postgres-schema-CF0yHESb-D7n2X21R.mjs.map +0 -1
  478. package/dist/postgres-schema-Xsjt3RKO-Buv2X8ai.d.mts.map +0 -1
  479. package/dist/postgres-table-schema-node-BBkitBQh-DT1T5VWU.mjs.map +0 -1
  480. package/dist/render-ops-DOsRP0Po-BKn_c_Ia.mjs.map +0 -1
  481. package/dist/render-ops-DPwhZt2W.d.mts.map +0 -1
  482. package/dist/render-typescript-6sCFvMBh.d.mts.map +0 -1
  483. package/dist/render-typescript-Dqp1Spgn-B128r1qw.mjs.map +0 -1
  484. package/dist/resolve-ddl-schema-CoaeNP35-C-UZldpj.mjs +0 -22
  485. package/dist/resolve-ddl-schema-CoaeNP35-C-UZldpj.mjs.map +0 -1
  486. package/dist/runtime-DOXznQe0.d.mts.map +0 -1
  487. package/dist/runtime-_TfO66h5.d.mts.map +0 -1
  488. package/dist/runtime-lHBKgjB9.d.mts.map +0 -1
  489. package/dist/schema-ir-annotations-DuuYh0gl.d.mts.map +0 -1
  490. package/dist/schema-node-kinds-qlnURWJy-Bo30pwTM.d.mts.map +0 -1
  491. package/dist/sql-renderer-BgC0ZgLS.d.mts.map +0 -1
  492. package/dist/sql-renderer-ComgusFq-BBlqM1fw.mjs.map +0 -1
  493. package/dist/sql-utils-DW6fkczF.d.mts.map +0 -1
  494. package/dist/sql-utils-DuzN3JZg-DiXy4Vah.mjs.map +0 -1
  495. package/dist/table-source-ikHOZmhD-DriY1Lcr.d.mts.map +0 -1
  496. package/dist/types-B-4d5_4a.d.mts +0 -1
  497. package/dist/types-CjGjPLr5.d.mts.map +0 -1
  498. package/dist/types-CkryN1AS-BcQRGsDn.d.mts +0 -27
  499. package/dist/types-CkryN1AS-BcQRGsDn.d.mts.map +0 -1
  500. package/dist/types-ue6jkJyF-BQJzjx1P.d.mts.map +0 -1
  501. /package/dist/{adapter__operation-types.mjs → target__operation-types.mjs} +0 -0
@@ -0,0 +1,1743 @@
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-BMhEpFwv-B8Zh0s_Q.mjs";
2
+ import { a as postgresCodec, r as definePostgresCodecs, t as PostgresCodecDescriptor } from "./codec-descriptor-DoR-cTFZ-BlG5Gj-X.mjs";
3
+ import { a as errorTemporalUnrepresentable, c as postgresError, i as errorTemporalUnavailableForDefault, n as errorTemporalNonIsoCalendar, o as errorTemporalWrongType, r as errorTemporalUnavailable, s as errorTimestampTextWrongType } from "./errors-BrhQYgdL-IvZHPjwL.mjs";
4
+ import { A as pgJsonb, C as pgInet, D as pgInterval, E as pgInt8, F as pgText, G as pgTsquery, H as pgTimestamptzStoredText, I as pgTextArray, J as pgVarchar, K as pgUuid, L as pgTime, M as pgNumeric, N as pgNumericParams, P as pgPrecisionParams, Q as postgresYearText, S as pgFloat8, T as pgInt4, U as pgTimetz, V as pgTimestamptz, X as postgresIntervalFields, _ as pgDate, a as formatIsoDuration, b as pgEnumParams, c as microsFromFraction, d as pgBool, f as pgBytea, g as pgCharacterLengthParams, h as pgChar, j as pgJsonbEnumRefusal, k as pgJson, l as pgBit, n as ISO_DURATION, o as intervalFieldsOf, q as pgVarbit, r as MICROS_PER_SECOND, s as isoYearText, t as BYTEA_TEXT, u as pgBitLengthParams, w as pgInt2, x as pgFloat4, y as pgEnum, z as pgTimestamp } from "./data-types-Chx0mjTP-DczU4S9b.mjs";
5
+ import { t as PostgresNativeEnum } from "./postgres-native-enum-CdP3b_-R-DgG3pi5p.mjs";
6
+ import { CaseExpr, CastExpr, FunctionCallExpr, LiteralExpr, NullCheckExpr, SqlCharCodec, SqlFloatCodec, SqlIntCodec, SqlRawCodec, SqlTextCodec, SqlVarcharCodec, sqlCharDescriptor, sqlFloatDescriptor, sqlIntDescriptor, sqlRawDescriptor, sqlTextDescriptor, sqlVarcharDescriptor } from "@prisma/orm-family-sql/relational-core/ast";
7
+ import { CodecImpl, SAFE_INTEGER_BIGINT_RANGE, column, decimalTextBigintLiteral, decimalTextNumberLiteral, floatNumberLiteral, floatToJson, isNonFiniteText, numeralText, readJsonFloat, readJsonIntegerText, refuseJsonValue, renderTsLiteral, storedNumeralText } from "@prisma/orm-framework/components/codec";
8
+ import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
9
+ import { blindCast } from "@prisma/orm-framework/utils/casts";
10
+ import { sqlRawDataType } from "@prisma/orm-family-sql/contract/data-type";
11
+ import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
12
+ import { parse } from "postgres-array";
13
+ //#region ../../../3-targets/postgres/1-target/dist/codecs-CRl9-i_r.mjs
14
+ /**
15
+ * A `numeric` value as its canonical decimal text. A number is written out without an exponent,
16
+ * because `numeric` text has no exponent syntax and `toDataTypeValue` refuses one.
17
+ */
18
+ const pgNumericDecode = (wire) => {
19
+ if (typeof wire === "number") return numeralText(wire);
20
+ return wire;
21
+ };
22
+ const DECIMAL_INTEGER = /^-?\d+$/;
23
+ /**
24
+ * Requires an application value to be of the JS type the codec reads.
25
+ *
26
+ * A range check reads a value of the wrong type as a value out of range, and
27
+ * reports a number plainly inside the range as outside it — so the type is
28
+ * established first and answered for on its own terms, naming what a caller
29
+ * has to change.
30
+ */
31
+ const requireJsType = (codecId, expected, value) => {
32
+ if (typeof value === expected) return;
33
+ throw postgresError("RUNTIME.ENCODE_FAILED", `${codecId} value must be a ${expected}, got ${typeof value} ${String(value)}`, { meta: {
34
+ codecId,
35
+ received: typeof value
36
+ } });
37
+ };
38
+ /** Writes a `bigint` application value as the decimal text the wire form of the exact integer codecs carries. */
39
+ const pgBigintEncode = (codecId, value) => {
40
+ requireJsType(codecId, "bigint", value);
41
+ return value.toString();
42
+ };
43
+ /**
44
+ * Writes an application value as the decimal text these codecs carry as their
45
+ * canonical JSON.
46
+ *
47
+ * A schema-written literal default (`BigInt @default(0)`) arrives here as a
48
+ * `number`, since a number literal is the only integer a schema language
49
+ * writes, and one that is a safe integer names its value exactly. Past that
50
+ * range the literal was rounded before any of this ran, so the value written is
51
+ * not the value meant — which this refuses rather than minting an exact-looking
52
+ * total from it. A non-integral number is refused on the same terms.
53
+ */
54
+ const pgBigintDigits = (codecId, value) => {
55
+ if (typeof value !== "number") return pgBigintEncode(codecId, value);
56
+ if (!Number.isSafeInteger(value)) throw postgresError("RUNTIME.ENCODE_FAILED", `${codecId} number literal must be an integer within the safe integer range, got ${String(value)}`, { meta: {
57
+ codecId,
58
+ received: String(value)
59
+ } });
60
+ return BigInt(value).toString();
61
+ };
62
+ /**
63
+ * Reads a wire or JSON value as a `bigint`, rejecting anything `BigInt()` would
64
+ * misread. A number-typed wire value must also be a safe integer: past
65
+ * ±(2^53 − 1) the driver's `number` has already rounded, so stringifying it
66
+ * would mint a spuriously-exact `bigint` that need not equal the stored value.
67
+ */
68
+ const decimalIntegerDecode = (codecId, wire) => {
69
+ if (typeof wire === "bigint") return wire;
70
+ const text = String(wire);
71
+ if (!DECIMAL_INTEGER.test(text)) throw postgresError("RUNTIME.DECODE_FAILED", `${codecId} value must be a decimal integer`, { meta: {
72
+ codecId,
73
+ received: text
74
+ } });
75
+ if (typeof wire === "number" && !Number.isSafeInteger(wire)) throw postgresError("RUNTIME.DECODE_FAILED", `${codecId} wire number must be an integer within the safe integer range, got ${text}`, { meta: {
76
+ codecId,
77
+ received: text
78
+ } });
79
+ return BigInt(text);
80
+ };
81
+ /** Reads an `int8` wire or JSON value as a `bigint`, rejecting anything `BigInt()` would misread. */
82
+ const pgInt8Decode = (wire) => decimalIntegerDecode("pg/int8@1", wire);
83
+ /**
84
+ * Reads an unconstrained-`numeric` wire or JSON value as a `bigint`, rejecting
85
+ * non-integral values — including `NaN` and the infinities, which are `numeric`
86
+ * values but not integers.
87
+ */
88
+ const pgUnboundedIntDecode = (wire) => decimalIntegerDecode("pg/unboundedint@1", wire);
89
+ /**
90
+ * A SQL number literal has no form for `NaN` or the infinities; PostgreSQL reads and writes them as
91
+ * the text `NaN`, `Infinity`, `-Infinity`, so the float codecs carry them as that text on the wire,
92
+ * as `floatToJson` does in JSON.
93
+ */
94
+ const pgFloatEncode = (value) => Number.isFinite(value) ? value : String(value);
95
+ /**
96
+ * Requires an integer within ±(2^53 − 1), the range a JS `number` holds
97
+ * exactly. The guard throws rather than rounding: past the boundary a `number`
98
+ * silently loses digits, which is the failure mode this codec exists to refuse.
99
+ */
100
+ const pgInt8NumberGuard = (code, value) => {
101
+ if (!Number.isSafeInteger(value)) throw postgresError(code, `pg/int8number@1 value must be an integer within the safe integer range, got ${String(value)}`, { meta: {
102
+ codecId: "pg/int8number@1",
103
+ received: String(value)
104
+ } });
105
+ return value;
106
+ };
107
+ const pgInt8NumberEncode = (value) => {
108
+ requireJsType("pg/int8number@1", "number", value);
109
+ return String(pgInt8NumberGuard("RUNTIME.ENCODE_FAILED", value));
110
+ };
111
+ /**
112
+ * Reads an `int8` wire value as a `number`, throwing outside ±(2^53 − 1) and on
113
+ * non-integral input. Decimal text goes through `BigInt` before the range check
114
+ * so an out-of-range value is compared exactly rather than after rounding.
115
+ */
116
+ const pgInt8NumberDecode = (wire) => {
117
+ if (typeof wire === "number") return pgInt8NumberGuard("RUNTIME.DECODE_FAILED", wire);
118
+ const value = decimalIntegerDecode("pg/int8number@1", wire);
119
+ if (value < SAFE_INTEGER_BIGINT_RANGE.min || value > SAFE_INTEGER_BIGINT_RANGE.max) throw postgresError("RUNTIME.DECODE_FAILED", `pg/int8number@1 value must be an integer within the safe integer range, got ${value}`, { meta: {
120
+ codecId: "pg/int8number@1",
121
+ received: value.toString()
122
+ } });
123
+ return Number(value);
124
+ };
125
+ /** A `number` holds an integer exactly only within the safe integer range, so digit text past it is refused. */
126
+ const pgInt8NumberFromDigits = (digits) => Number(readJsonIntegerText("pg/int8number@1", digits, SAFE_INTEGER_BIGINT_RANGE));
127
+ /** Parses an ISO-8601 duration into the application value. */
128
+ const pgIntervalFromIso = (text) => intervalFieldsOf(text);
129
+ /** Renders the application value as its canonical ISO-8601 duration. */
130
+ const pgIntervalToIso = (value) => formatIsoDuration(value);
131
+ const ZERO_INTERVAL = {
132
+ months: 0,
133
+ days: 0,
134
+ micros: 0n
135
+ };
136
+ /** `count` with the sign `negative` gives it, never `-0`. */
137
+ const signed = (negative, count) => negative && count !== 0 ? -count : count;
138
+ const negated = ({ months, days, micros }) => ({
139
+ months: signed(true, months),
140
+ days: signed(true, days),
141
+ micros: -micros
142
+ });
143
+ /** Hours, minutes, seconds and a fraction of a second, with one sign for all of them. */
144
+ function timeMicros(negative, hours, minutes, seconds, fraction) {
145
+ const magnitude = (BigInt(hours) * 3600n + BigInt(minutes) * 60n + BigInt(seconds)) * MICROS_PER_SECOND + microsFromFraction(fraction, negative);
146
+ return negative ? -magnitude : magnitude;
147
+ }
148
+ const VERBOSE_FIELD = /^(-?)(\d+)(?:\.(\d+))? (year|mon|day|hour|min|sec)s?$/;
149
+ /**
150
+ * An interval as PostgreSQL prints it under `IntervalStyle = 'postgres_verbose'`: `@ 1 year 2 mons
151
+ * -3 days 4 hours 5 mins 6.5 secs`, each field with its own sign, and ` ago` negating the whole; `@ 0`
152
+ * for zero.
153
+ */
154
+ function verboseIntervalFields(text) {
155
+ if (!text.startsWith("@ ")) return void 0;
156
+ const ago = text.endsWith(" ago");
157
+ const body = text.slice(2, ago ? -4 : void 0);
158
+ if (body === "0") return ZERO_INTERVAL;
159
+ const words = body.split(" ");
160
+ if (words.length === 0 || words.length % 2 !== 0) return void 0;
161
+ let months = 0;
162
+ let days = 0;
163
+ let micros = 0n;
164
+ for (let index = 0; index < words.length; index += 2) {
165
+ const match = VERBOSE_FIELD.exec(`${words[index]} ${words[index + 1]}`);
166
+ if (match === null) return void 0;
167
+ const [, sign = "", whole = "0", fraction, unit] = match;
168
+ if (fraction !== void 0 && unit !== "sec") return void 0;
169
+ const negative = sign === "-";
170
+ const count = signed(negative, Number(whole));
171
+ if (unit === "year") months += count * 12;
172
+ else if (unit === "mon") months += count;
173
+ else if (unit === "day") days += count;
174
+ else if (unit === "hour") micros += BigInt(count) * 3600n * MICROS_PER_SECOND;
175
+ else if (unit === "min") micros += BigInt(count) * 60n * MICROS_PER_SECOND;
176
+ else micros += timeMicros(negative, "0", "0", whole, fraction ?? "");
177
+ }
178
+ const fields = {
179
+ months,
180
+ days,
181
+ micros
182
+ };
183
+ return ago ? negated(fields) : fields;
184
+ }
185
+ const SQL_MIXED = /^([+-])(\d+)-(\d+) ([+-])(\d+) ([+-])(\d+):(\d{2}):(\d{2})(?:\.(\d+))?$/;
186
+ const SQL_YEAR_MONTH = /^(-?)(\d+)-(\d+)$/;
187
+ const SQL_DAY_TIME = /^(-?)(?:(\d+) )?(\d+):(\d{2}):(\d{2})(?:\.(\d+))?$/;
188
+ /**
189
+ * An interval as PostgreSQL prints it under `IntervalStyle = 'sql_standard'`. A value with fields of
190
+ * one sign and of one kind, year-month or day-time, has a single leading sign for all of them:
191
+ * `-1-2`, `-1 2:03:04`, `-0:00:01.5`. Any other value signs each part: `+1-2 -3 +4:05:06.5`. Zero is
192
+ * `0`.
193
+ */
194
+ function sqlStandardIntervalFields(text) {
195
+ if (text === "0") return ZERO_INTERVAL;
196
+ const mixed = SQL_MIXED.exec(text);
197
+ if (mixed !== null) {
198
+ const [, yearSign, years = "0", months = "0", daySign, days = "0", timeSign] = mixed;
199
+ const monthCount = Number(years) * 12 + Number(months);
200
+ return {
201
+ months: signed(yearSign === "-", monthCount),
202
+ days: signed(daySign === "-", Number(days)),
203
+ micros: timeMicros(timeSign === "-", mixed[7] ?? "0", mixed[8] ?? "0", mixed[9] ?? "0", mixed[10] ?? "")
204
+ };
205
+ }
206
+ const yearMonth = SQL_YEAR_MONTH.exec(text);
207
+ if (yearMonth !== null) {
208
+ const [, sign, years = "0", months = "0"] = yearMonth;
209
+ const monthCount = Number(years) * 12 + Number(months);
210
+ return {
211
+ months: signed(sign === "-", monthCount),
212
+ days: 0,
213
+ micros: 0n
214
+ };
215
+ }
216
+ const dayTime = SQL_DAY_TIME.exec(text);
217
+ if (dayTime === null) return void 0;
218
+ const [, sign, days = "0", hours = "0", minutes = "0", seconds = "0", fraction = ""] = dayTime;
219
+ const negative = sign === "-";
220
+ return {
221
+ months: 0,
222
+ days: signed(negative, Number(days)),
223
+ micros: timeMicros(negative, hours, minutes, seconds, fraction)
224
+ };
225
+ }
226
+ /** Reads the interval text PostgreSQL prints under any `IntervalStyle`. */
227
+ const intervalTextFields = (text) => {
228
+ const fields = ISO_DURATION.test(text) ? intervalFieldsOf(text) : postgresIntervalFields(text) ?? verboseIntervalFields(text) ?? sqlStandardIntervalFields(text);
229
+ if (fields === void 0) throw postgresError("RUNTIME.DECODE_FAILED", `pg/interval@1 value must be interval text PostgreSQL prints under an IntervalStyle, got ${text}`, { meta: {
230
+ codecId: "pg/interval@1",
231
+ received: text
232
+ } });
233
+ return fields;
234
+ };
235
+ const pgIntervalDecode = (wire) => {
236
+ if (typeof wire === "string") return intervalTextFields(wire);
237
+ const part = (name) => {
238
+ const raw = wire[name];
239
+ return typeof raw === "number" ? raw : 0;
240
+ };
241
+ const seconds = part("seconds") + part("milliseconds") / 1e3;
242
+ return {
243
+ months: part("years") * 12 + part("months"),
244
+ days: part("days"),
245
+ micros: BigInt(part("hours")) * 3600n * MICROS_PER_SECOND + BigInt(part("minutes")) * 60n * MICROS_PER_SECOND + BigInt(Math.round(seconds * 1e6))
246
+ };
247
+ };
248
+ const pgByteaToBase64 = (value) => Buffer.from(value).toString("base64");
249
+ const pgByteaFromBase64 = (base64) => new Uint8Array(Buffer.from(base64, "base64"));
250
+ /** The text PostgreSQL prints for `bytea` under `bytea_output = 'escape'`: `\\` for a backslash, `\nnn` in octal for a byte outside printable ASCII, and every other byte as itself. */
251
+ const BYTEA_ESCAPE_TEXT = /^(?:[ -[\]-~]|\\\\|\\[0-3][0-7]{2})*$/;
252
+ const BYTEA_ESCAPE = /\\\\|\\([0-3][0-7]{2})|[ -[\]-~]/g;
253
+ function byteaOfEscapeText(text) {
254
+ const bytes = [];
255
+ for (const [token, octal] of text.matchAll(BYTEA_ESCAPE)) bytes.push(octal !== void 0 ? Number.parseInt(octal, 8) : token === "\\\\" ? 92 : token.charCodeAt(0));
256
+ return Uint8Array.from(bytes);
257
+ }
258
+ const pgByteaDecodeWire = (wire) => {
259
+ if (wire instanceof Uint8Array) return wire.constructor === Uint8Array ? wire : new Uint8Array(wire.buffer, wire.byteOffset, wire.byteLength);
260
+ if (BYTEA_TEXT.test(wire)) return new Uint8Array(Buffer.from(wire.slice(2), "hex"));
261
+ if (!wire.startsWith("\\x") && BYTEA_ESCAPE_TEXT.test(wire)) return byteaOfEscapeText(wire);
262
+ throw postgresError("RUNTIME.DECODE_FAILED", "pg/bytea@1 wire value must be a Uint8Array or bytea text, as PostgreSQL prints it under bytea_output 'hex' or 'escape'", { meta: {
263
+ codecId: "pg/bytea@1",
264
+ received: wire
265
+ } });
266
+ };
267
+ const parseJsonWire = JSON.parse;
268
+ const pgJsonEncode = (value) => JSON.stringify(value);
269
+ const pgJsonDecode = (wire) => typeof wire === "string" ? parseJsonWire(wire) : wire;
270
+ const pgJsonbEncode = (value) => JSON.stringify(value);
271
+ const pgJsonbDecode = (wire) => typeof wire === "string" ? parseJsonWire(wire) : wire;
272
+ let fallback;
273
+ /**
274
+ * Sets the implementation `requireTemporal` returns when the runtime has no global `Temporal`.
275
+ * The value is held once per process. Only the control entry calls this.
276
+ */
277
+ function setFallbackTemporal(implementation) {
278
+ fallback = implementation;
279
+ }
280
+ /**
281
+ * The `Temporal` to use: the runtime's own when it has one, else the fallback. Throws
282
+ * `RUNTIME.TEMPORAL_UNAVAILABLE` when there is neither.
283
+ */
284
+ function requireTemporal(meta) {
285
+ if (typeof Temporal !== "undefined") return Temporal;
286
+ if (fallback !== void 0) return fallback;
287
+ throw "generatorId" in meta ? errorTemporalUnavailableForDefault(meta.generatorId) : errorTemporalUnavailable(meta.codecId, meta.operation);
288
+ }
289
+ const POSTGRES_TEMPORAL_SENTINELS = /* @__PURE__ */ new Set(["infinity", "-infinity"]);
290
+ function decodeTemporalText(identity, wire, parse) {
291
+ const temporal = requireTemporal({
292
+ codecId: identity.codecId,
293
+ operation: "decode"
294
+ });
295
+ if (POSTGRES_TEMPORAL_SENTINELS.has(wire)) throw errorTemporalUnrepresentable({
296
+ ...identity,
297
+ operation: "decode",
298
+ value: wire,
299
+ detail: `PostgreSQL's ${wire} is a sentinel with no position on the timeline, so no Temporal value denotes it`
300
+ });
301
+ try {
302
+ return parse(temporal, isoYearText(wire));
303
+ } catch (cause) {
304
+ throw errorTemporalUnrepresentable({
305
+ ...identity,
306
+ operation: "decode",
307
+ value: wire,
308
+ detail: cause instanceof Error ? cause.message : String(cause),
309
+ cause
310
+ });
311
+ }
312
+ }
313
+ function encodeTemporalValue(identity, value) {
314
+ const tag = typeof value === "object" && value !== null ? Reflect.get(value, Symbol.toStringTag) : void 0;
315
+ if (tag !== identity.temporalTag) throw errorTemporalWrongType(identity.codecId, identity.temporalTag, identity.stringType, describeEncodeInput(value, tag));
316
+ if (value.calendarId !== void 0 && value.calendarId !== "iso8601") throw errorTemporalNonIsoCalendar(identity.codecId, value.calendarId);
317
+ return postgresYearText(value.toString());
318
+ }
319
+ function describeEncodeInput(value, tag) {
320
+ if (typeof tag === "string") return `a ${tag}`;
321
+ if (value instanceof Date) return "a Date";
322
+ if (value === null) return "null";
323
+ return `a ${typeof value}`;
324
+ }
325
+ /** Refuses `infinity` and `-infinity` in a stored value, which no Temporal value or `Date` holds, naming the text codec of the type that does. */
326
+ function refuseInfinity(codecId, holds, textCodecId, text) {
327
+ if (!POSTGRES_TEMPORAL_SENTINELS.has(text)) return;
328
+ refuseJsonValue(codecId, `${holds}, not infinity or -infinity, which ${textCodecId} holds`, text);
329
+ }
330
+ const DATE_TEMPORAL = {
331
+ codecId: PG_DATE_TEMPORAL_CODEC_ID,
332
+ stringType: "DateString",
333
+ temporalTag: "Temporal.PlainDate"
334
+ };
335
+ const TIMESTAMP_TEMPORAL = {
336
+ codecId: PG_TIMESTAMP_TEMPORAL_CODEC_ID,
337
+ stringType: "TimestampString(p)",
338
+ temporalTag: "Temporal.PlainDateTime"
339
+ };
340
+ const TIMESTAMPTZ_TEMPORAL = {
341
+ codecId: PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID,
342
+ stringType: "TimestamptzString(p)",
343
+ temporalTag: "Temporal.Instant"
344
+ };
345
+ const TIME_TEMPORAL = {
346
+ codecId: PG_TIME_TEMPORAL_CODEC_ID,
347
+ stringType: "TimeString(p)",
348
+ temporalTag: "Temporal.PlainTime"
349
+ };
350
+ const pgDateTemporalDecode = (wire) => decodeTemporalText(DATE_TEMPORAL, wire, (temporal, text) => temporal.PlainDate.from(text));
351
+ const pgDateTemporalEncode = (value) => encodeTemporalValue(DATE_TEMPORAL, value);
352
+ const pgTimestampTemporalDecode = (wire) => decodeTemporalText(TIMESTAMP_TEMPORAL, wire, (temporal, text) => temporal.PlainDateTime.from(text));
353
+ const pgTimestampTemporalEncode = (value) => encodeTemporalValue(TIMESTAMP_TEMPORAL, value);
354
+ const pgTimestamptzTemporalDecode = (wire) => decodeTemporalText(TIMESTAMPTZ_TEMPORAL, wire, (temporal, text) => temporal.Instant.from(text));
355
+ const pgTimestamptzTemporalEncode = (value) => encodeTemporalValue(TIMESTAMPTZ_TEMPORAL, value);
356
+ const pgTimeTemporalDecode = (wire) => decodeTemporalText(TIME_TEMPORAL, wire, (temporal, text) => temporal.PlainTime.from(text));
357
+ const pgTimeTemporalEncode = (value) => encodeTemporalValue(TIME_TEMPORAL, value);
358
+ const EARLIEST_POSTGRES_TIMESTAMP_MILLISECONDS = (/* @__PURE__ */ new Date("-004713-11-24T00:00:00Z")).getTime();
359
+ function utcTimestamptzText(value, codecId) {
360
+ const milliseconds = value.getTime();
361
+ if (!Number.isFinite(milliseconds) || milliseconds < EARLIEST_POSTGRES_TIMESTAMP_MILLISECONDS) throw new RangeError(`${codecId} writes a Date as UTC text and needs a valid Date on or after 4714-11-24 BC, the earliest timestamp PostgreSQL holds; got ${String(value)}`);
362
+ return postgresYearText(value.toISOString());
363
+ }
364
+ function invalidDate() {
365
+ 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`);
366
+ }
367
+ function isRepresentable(value) {
368
+ return value instanceof Date && Number.isFinite(value.getTime()) && value.getTime() >= EARLIEST_POSTGRES_TIMESTAMP_MILLISECONDS;
369
+ }
370
+ function validateDate(value) {
371
+ if (!isRepresentable(value)) throw invalidDate();
372
+ return value;
373
+ }
374
+ function decodeDate(wire) {
375
+ const instant = typeof wire === "string" ? storedInstant(wire) : void 0;
376
+ const date = instant === void 0 ? void 0 : new Date(instant);
377
+ if (date === void 0 || !isRepresentable(date)) throw invalidDate();
378
+ return date;
379
+ }
380
+ /** The instant, in its stored spelling, a stored timestamp with time zone names, or `undefined` for `infinity` and an instant outside the range a `Date` holds. */
381
+ function storedInstant(text) {
382
+ if (text === "infinity" || text === "-infinity") return void 0;
383
+ try {
384
+ return pgTimestamptzStoredText(text);
385
+ } catch (error) {
386
+ if (isStructuredError(error) && error.code === "CONTRACT.CAST_REFUSED") return void 0;
387
+ throw error;
388
+ }
389
+ }
390
+ /** The `Date` a stored timestamp with time zone names. A `Date` holds neither `infinity` nor an instant before 4714-11-24 BC or after +275760-09-13, so those are refused. */
391
+ function dateOfStoredText(codecId, text) {
392
+ const instant = storedInstant(text);
393
+ const date = instant === void 0 ? void 0 : new Date(instant);
394
+ if (date === void 0 || !isRepresentable(date)) return refuseJsonValue(codecId, `an instant a Date holds, from 4714-11-24 BC to +275760-09-13 and not infinity or -infinity, which ${PG_TIMESTAMPTZ_STRING_CODEC_ID} holds`, text);
395
+ return date;
396
+ }
397
+ function encodeDate(value) {
398
+ return utcTimestamptzText(validateDate(value), PG_TIMESTAMPTZ_DATE_CODEC_ID);
399
+ }
400
+ var PgTimestamptzDateCodec = class extends CodecImpl {
401
+ async toWire(value, _ctx) {
402
+ return encodeDate(value);
403
+ }
404
+ async fromWire(wire, _ctx) {
405
+ return decodeDate(wire);
406
+ }
407
+ fromDataTypeValue(value) {
408
+ return dateOfStoredText(this.id, value.value);
409
+ }
410
+ toDataTypeValue(input) {
411
+ return this.dataTypeValueOf(validateDate(input).toISOString());
412
+ }
413
+ };
414
+ var PgTimestamptzDateDescriptor = class extends PostgresCodecDescriptor {
415
+ jsonProjection(expression) {
416
+ return CastExpr.as(expression, "text");
417
+ }
418
+ dataType = pgTimestamptz.id;
419
+ codecId = PG_TIMESTAMPTZ_DATE_CODEC_ID;
420
+ traits = ["equality", "order"];
421
+ paramsSchema = pgPrecisionParams;
422
+ factory(params) {
423
+ return () => new PgTimestamptzDateCodec(this, pgTimestamptz, params ?? {});
424
+ }
425
+ };
426
+ const pgTimestamptzDateDescriptor = new PgTimestamptzDateDescriptor();
427
+ const pgTimestamptzDateColumn = (params = {}) => column(pgTimestamptzDateDescriptor.factory(params), pgTimestamptzDateDescriptor.codecId, params);
428
+ function parsePostgresListText(wireValue) {
429
+ if (typeof wireValue !== "string") throw new TypeError(`expected raw text for a Postgres array, got ${typeof wireValue}`);
430
+ return blindCast(parse(wireValue));
431
+ }
432
+ async function decodePostgresListText(wireValue, decodeElement) {
433
+ const decoded = [];
434
+ for (const element of parsePostgresListText(wireValue)) {
435
+ if (element === null) {
436
+ decoded.push(null);
437
+ continue;
438
+ }
439
+ decoded.push(await decodeElement(element));
440
+ }
441
+ return decoded;
442
+ }
443
+ var PgDateTemporalCodec = class extends CodecImpl {
444
+ async toWire(value, _ctx) {
445
+ return pgDateTemporalEncode(value);
446
+ }
447
+ async fromWire(wire, _ctx) {
448
+ return pgDateTemporalDecode(wire);
449
+ }
450
+ fromDataTypeValue(value) {
451
+ refuseInfinity(this.id, "a date a Temporal.PlainDate holds", PG_DATE_STRING_CODEC_ID, value.value);
452
+ return pgDateTemporalDecode(value.value);
453
+ }
454
+ toDataTypeValue(input) {
455
+ return this.dataTypeValueOf(pgDateTemporalEncode(input));
456
+ }
457
+ };
458
+ var PgDateTemporalDescriptor = class extends PostgresCodecDescriptor {
459
+ jsonProjection(expression) {
460
+ return CastExpr.as(expression, "text");
461
+ }
462
+ dataType = pgDate.id;
463
+ codecId = PG_DATE_TEMPORAL_CODEC_ID;
464
+ traits = ["equality", "order"];
465
+ paramsSchema = void 0;
466
+ factory() {
467
+ return () => new PgDateTemporalCodec(this, pgDate);
468
+ }
469
+ };
470
+ const pgDateTemporalDescriptor = new PgDateTemporalDescriptor();
471
+ var PgTimestampTemporalCodec = class extends CodecImpl {
472
+ async toWire(value, _ctx) {
473
+ return pgTimestampTemporalEncode(value);
474
+ }
475
+ async fromWire(wire, _ctx) {
476
+ return pgTimestampTemporalDecode(wire);
477
+ }
478
+ fromDataTypeValue(value) {
479
+ refuseInfinity(this.id, "a date and time a Temporal.PlainDateTime holds", PG_TIMESTAMP_STRING_CODEC_ID, value.value);
480
+ return pgTimestampTemporalDecode(value.value);
481
+ }
482
+ toDataTypeValue(input) {
483
+ return this.dataTypeValueOf(pgTimestampTemporalEncode(input));
484
+ }
485
+ };
486
+ var PgTimestampTemporalDescriptor = class extends PostgresCodecDescriptor {
487
+ jsonProjection(expression) {
488
+ return CastExpr.as(expression, "text");
489
+ }
490
+ dataType = pgTimestamp.id;
491
+ codecId = PG_TIMESTAMP_TEMPORAL_CODEC_ID;
492
+ traits = ["equality", "order"];
493
+ paramsSchema = pgPrecisionParams;
494
+ factory(params) {
495
+ return () => new PgTimestampTemporalCodec(this, pgTimestamp, params ?? {});
496
+ }
497
+ };
498
+ const pgTimestampTemporalDescriptor = new PgTimestampTemporalDescriptor();
499
+ var PgTimestamptzTemporalCodec = class extends CodecImpl {
500
+ async toWire(value, _ctx) {
501
+ return pgTimestamptzTemporalEncode(value);
502
+ }
503
+ async fromWire(wire, _ctx) {
504
+ return pgTimestamptzTemporalDecode(wire);
505
+ }
506
+ fromDataTypeValue(value) {
507
+ refuseInfinity(this.id, "an instant a Temporal.Instant holds", PG_TIMESTAMPTZ_STRING_CODEC_ID, value.value);
508
+ return pgTimestamptzTemporalDecode(value.value);
509
+ }
510
+ toDataTypeValue(input) {
511
+ return this.dataTypeValueOf(pgTimestamptzTemporalEncode(input));
512
+ }
513
+ };
514
+ var PgTimestamptzTemporalDescriptor = class extends PostgresCodecDescriptor {
515
+ jsonProjection(expression) {
516
+ return CastExpr.as(expression, "text");
517
+ }
518
+ dataType = pgTimestamptz.id;
519
+ codecId = PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID;
520
+ traits = ["equality", "order"];
521
+ paramsSchema = pgPrecisionParams;
522
+ factory(params) {
523
+ return () => new PgTimestamptzTemporalCodec(this, pgTimestamptz, params ?? {});
524
+ }
525
+ };
526
+ const pgTimestamptzTemporalDescriptor = new PgTimestamptzTemporalDescriptor();
527
+ var PgTimeTemporalCodec = class extends CodecImpl {
528
+ async toWire(value, _ctx) {
529
+ return pgTimeTemporalEncode(value);
530
+ }
531
+ async fromWire(wire, _ctx) {
532
+ return pgTimeTemporalDecode(wire);
533
+ }
534
+ fromDataTypeValue(value) {
535
+ return pgTimeTemporalDecode(value.value);
536
+ }
537
+ toDataTypeValue(input) {
538
+ return this.dataTypeValueOf(pgTimeTemporalEncode(input));
539
+ }
540
+ };
541
+ var PgTimeTemporalDescriptor = class extends PostgresCodecDescriptor {
542
+ jsonProjection(expression) {
543
+ return CastExpr.as(expression, "text");
544
+ }
545
+ dataType = pgTime.id;
546
+ codecId = PG_TIME_TEMPORAL_CODEC_ID;
547
+ traits = ["equality", "order"];
548
+ paramsSchema = pgPrecisionParams;
549
+ factory(params) {
550
+ return () => new PgTimeTemporalCodec(this, pgTime, params ?? {});
551
+ }
552
+ };
553
+ const pgTimeTemporalDescriptor = new PgTimeTemporalDescriptor();
554
+ var PgDateStringCodec = class extends CodecImpl {
555
+ async toWire(value, _ctx) {
556
+ return postgresYearText(value);
557
+ }
558
+ async fromWire(wire, _ctx) {
559
+ return wire;
560
+ }
561
+ fromDataTypeValue(value) {
562
+ return value.value;
563
+ }
564
+ toDataTypeValue(input) {
565
+ return this.dataTypeValueOf(input);
566
+ }
567
+ };
568
+ var PgDateStringDescriptor = class extends PostgresCodecDescriptor {
569
+ jsonProjection(expression) {
570
+ return CastExpr.as(expression, "text");
571
+ }
572
+ dataType = pgDate.id;
573
+ codecId = PG_DATE_STRING_CODEC_ID;
574
+ traits = ["equality", "order"];
575
+ paramsSchema = void 0;
576
+ renderValueLiteral(value) {
577
+ return renderTsLiteral(value);
578
+ }
579
+ factory() {
580
+ return () => new PgDateStringCodec(this, pgDate);
581
+ }
582
+ };
583
+ const pgDateStringDescriptor = new PgDateStringDescriptor();
584
+ function requireText(codecId, value) {
585
+ if (typeof value === "string") return value;
586
+ throw errorTimestampTextWrongType(codecId, describeValue(value));
587
+ }
588
+ function describeValue(value) {
589
+ if (value === null) return "null";
590
+ if (value instanceof Date) return "a Date";
591
+ return `a ${typeof value}`;
592
+ }
593
+ var PgTimestampStringCodec = class extends CodecImpl {
594
+ async toWire(value, _ctx) {
595
+ return postgresYearText(requireText(this.id, value));
596
+ }
597
+ async fromWire(wire, _ctx) {
598
+ return wire;
599
+ }
600
+ fromDataTypeValue(value) {
601
+ return value.value;
602
+ }
603
+ toDataTypeValue(input) {
604
+ return this.dataTypeValueOf(input);
605
+ }
606
+ };
607
+ /** Why an enum cannot use a string timestamp codec, given how PostgreSQL prints a value and how the contract stores it. */
608
+ const stringTimestampEnumRefusal = (printed, stored, printing, instead) => `A query reads each value as the text PostgreSQL prints${printing}, such as "${printed}", while the contract stores it in ISO 8601, such as "${stored}", so no value read back equals a member. Use ${instead}, whose members are Temporal values.`;
609
+ var PgTimestampStringDescriptor = class extends PostgresCodecDescriptor {
610
+ jsonProjection(expression) {
611
+ return CastExpr.as(expression, "text");
612
+ }
613
+ dataType = pgTimestamp.id;
614
+ codecId = PG_TIMESTAMP_STRING_CODEC_ID;
615
+ traits = ["equality", "order"];
616
+ enumRefusal = stringTimestampEnumRefusal("2024-01-02 03:04:05", "2024-01-02T03:04:05", "", "pg/timestamp-temporal@1");
617
+ paramsSchema = pgPrecisionParams;
618
+ factory(params) {
619
+ return () => new PgTimestampStringCodec(this, pgTimestamp, params ?? {});
620
+ }
621
+ };
622
+ const pgTimestampStringDescriptor = new PgTimestampStringDescriptor();
623
+ var PgTimestamptzStringCodec = class extends CodecImpl {
624
+ async toWire(value, _ctx) {
625
+ return postgresYearText(requireText(this.id, value));
626
+ }
627
+ async fromWire(wire, _ctx) {
628
+ return wire;
629
+ }
630
+ fromDataTypeValue(value) {
631
+ return value.value;
632
+ }
633
+ toDataTypeValue(input) {
634
+ return this.dataTypeValueOf(input);
635
+ }
636
+ };
637
+ var PgTimestamptzStringDescriptor = class extends PostgresCodecDescriptor {
638
+ jsonProjection(expression) {
639
+ return CastExpr.as(expression, "text");
640
+ }
641
+ dataType = pgTimestamptz.id;
642
+ codecId = PG_TIMESTAMPTZ_STRING_CODEC_ID;
643
+ traits = ["equality", "order"];
644
+ enumRefusal = stringTimestampEnumRefusal("2024-01-02 03:04:05+00", "2024-01-02T03:04:05Z", " in the session's time zone", "pg/timestamptz-temporal@1");
645
+ paramsSchema = pgPrecisionParams;
646
+ factory(params) {
647
+ return () => new PgTimestamptzStringCodec(this, pgTimestamptz, params ?? {});
648
+ }
649
+ };
650
+ const pgTimestamptzStringDescriptor = new PgTimestamptzStringDescriptor();
651
+ var PgTimeStringCodec = class extends CodecImpl {
652
+ async toWire(value, _ctx) {
653
+ return value;
654
+ }
655
+ async fromWire(wire, _ctx) {
656
+ return wire;
657
+ }
658
+ fromDataTypeValue(value) {
659
+ return value.value;
660
+ }
661
+ toDataTypeValue(input) {
662
+ return this.dataTypeValueOf(input);
663
+ }
664
+ };
665
+ var PgTimeStringDescriptor = class extends PostgresCodecDescriptor {
666
+ jsonProjection(expression) {
667
+ return CastExpr.as(expression, "text");
668
+ }
669
+ dataType = pgTime.id;
670
+ codecId = PG_TIME_STRING_CODEC_ID;
671
+ traits = ["equality", "order"];
672
+ paramsSchema = pgPrecisionParams;
673
+ renderValueLiteral(value) {
674
+ return renderTsLiteral(value);
675
+ }
676
+ factory(params) {
677
+ return () => new PgTimeStringCodec(this, pgTime, params ?? {});
678
+ }
679
+ };
680
+ const pgTimeStringDescriptor = new PgTimeStringDescriptor();
681
+ /** A decimal numeral: an optional minus sign, digits, and an optional fraction. */
682
+ const DECIMAL_NUMERAL_TEXT = /^-?\d+(?:\.\d+)?$/;
683
+ /** A decimal numeral is written as PostgreSQL prints it, without leading zeros or a minus sign on zero; other spellings PostgreSQL reads, such as `1e5`, are refused. */
684
+ function numericJson(value) {
685
+ if (typeof value !== "string" || isNonFiniteText(value)) return value;
686
+ if (DECIMAL_NUMERAL_TEXT.test(value)) return storedNumeralText(value);
687
+ throw postgresError("RUNTIME.ENCODE_FAILED", "pg/numeric@1 application value must be numeric text: an optionally negated decimal numeral, or NaN, Infinity or -Infinity", { meta: {
688
+ codecId: PG_NUMERIC_CODEC_ID,
689
+ received: value
690
+ } });
691
+ }
692
+ /**
693
+ * Projects the expression unchanged, for codecs whose canonical JSON is what
694
+ * PostgreSQL's own JSON conversion already produces.
695
+ *
696
+ * Identity here is a claim about the target's behaviour, not an absence of one:
697
+ * the codec's conformance cases are what test it, including at the boundaries
698
+ * of the representation — escaping, sign, and range — where a native conversion
699
+ * would be most likely to diverge.
700
+ */
701
+ const identityJsonProjection = (expression) => expression;
702
+ /**
703
+ * 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.
704
+ */
705
+ const unpaddedCharJsonProjection = (expression) => CastExpr.as(expression, "text");
706
+ const decodePostgresNumberWire = (wire) => typeof wire === "string" ? Number(wire) : wire;
707
+ const decodePostgresBooleanWire = (wire) => {
708
+ if (typeof wire === "boolean") return wire;
709
+ if (wire === "t" || wire === "true") return true;
710
+ if (wire === "f" || wire === "false") return false;
711
+ throw postgresError("RUNTIME.DECODE_FAILED", "pg/bool@1 wire value must be boolean text", { meta: {
712
+ codecId: PG_BOOL_CODEC_ID,
713
+ received: wire
714
+ } });
715
+ };
716
+ /**
717
+ * Projects a numeric-valued expression as decimal text.
718
+ *
719
+ * The cast is part of the projected expression, which is what makes it correct:
720
+ * whatever `jsonProjection` returns is the argument the JSON constructor
721
+ * receives, so casting here happens *before* PostgreSQL builds the JSON value.
722
+ * Handed a `numeric` or `int8` directly, the constructor emits a JSON **number**,
723
+ * and every digit past IEEE-754's 53 bits of significand is gone by the time the
724
+ * driver has parsed it — before any codec can intervene. A cast applied to the
725
+ * constructor's result instead of its argument would be too late to matter.
726
+ */
727
+ const decimalTextJsonProjection = (expression) => CastExpr.as(expression, "text");
728
+ /**
729
+ * Projects the text PostgreSQL prints for the value, which is the value the runtime driver returns
730
+ * for an ordinary row, so `fromWire` reads an included value as it reads a row (ADR 254, "Rows the
731
+ * database returns as JSON"). PostgreSQL's own JSON conversion would write another value: a `bytea`
732
+ * as its hex text but a `jsonb` document as the document itself, which `fromWire` cannot tell from
733
+ * the document's JSON text when the document is a string.
734
+ */
735
+ const printedTextJsonProjection = (expression) => CastExpr.as(expression, "text");
736
+ const postgresSqlCharDescriptor = postgresCodec(sqlCharDescriptor, {
737
+ dataType: pgChar,
738
+ renderValueLiteral: renderTsLiteral,
739
+ jsonProjection: unpaddedCharJsonProjection,
740
+ factory: (descriptor, dataType, params) => () => new SqlCharCodec(descriptor, dataType, params)
741
+ });
742
+ const postgresSqlVarcharDescriptor = postgresCodec(sqlVarcharDescriptor, {
743
+ dataType: pgVarchar,
744
+ renderValueLiteral: renderTsLiteral,
745
+ jsonProjection: identityJsonProjection,
746
+ factory: (descriptor, dataType, params) => () => new SqlVarcharCodec(descriptor, dataType, params)
747
+ });
748
+ const postgresSqlIntDescriptor = postgresCodec(sqlIntDescriptor, {
749
+ dataType: pgInt4,
750
+ renderValueLiteral: renderTsLiteral,
751
+ jsonProjection: identityJsonProjection,
752
+ factory: (descriptor, dataType) => () => new PgIntCodec(descriptor, dataType)
753
+ });
754
+ const postgresSqlFloatDescriptor = postgresCodec(sqlFloatDescriptor, {
755
+ dataType: pgFloat8,
756
+ renderValueLiteral: floatNumberLiteral,
757
+ jsonProjection: identityJsonProjection,
758
+ factory: (descriptor, dataType) => () => new PgFloatCodec(descriptor, dataType)
759
+ });
760
+ const postgresSqlTextDescriptor = postgresCodec(sqlTextDescriptor, {
761
+ dataType: pgText,
762
+ renderValueLiteral: renderTsLiteral,
763
+ jsonProjection: identityJsonProjection,
764
+ factory: (descriptor, dataType) => () => new SqlTextCodec(descriptor, dataType)
765
+ });
766
+ /**
767
+ * Projects a raw value as the text its type's output function prints, which a flat read returns
768
+ * too, so an include reads the same value. Postgres' JSON form of `integer` or `boolean` would be a
769
+ * number or a boolean, and a cast to `text` does not always print the output form: `true::text` is
770
+ * `true` where the output is `t`. `format('%s', …)` prints through the output function, and turns
771
+ * NULL into an empty string, so NULL is kept apart.
772
+ */
773
+ const outputFunctionJsonProjection = (expression) => CaseExpr.of([{
774
+ condition: NullCheckExpr.isNull(expression),
775
+ value: LiteralExpr.of(null)
776
+ }], FunctionCallExpr.of("format", [LiteralExpr.of("%s"), expression]));
777
+ const postgresSqlRawDescriptor = postgresCodec(sqlRawDescriptor, {
778
+ dataType: sqlRawDataType,
779
+ jsonProjection: outputFunctionJsonProjection,
780
+ factory: (descriptor, dataType, params) => () => new SqlRawCodec(descriptor, dataType, params)
781
+ });
782
+ var PgTextCodec = class extends CodecImpl {
783
+ async toWire(value, _ctx) {
784
+ return value;
785
+ }
786
+ async fromWire(wire, _ctx) {
787
+ return wire;
788
+ }
789
+ fromDataTypeValue(value) {
790
+ return value.value;
791
+ }
792
+ toDataTypeValue(input) {
793
+ return this.dataTypeValueOf(input);
794
+ }
795
+ };
796
+ var PgTextDescriptor = class extends PostgresCodecDescriptor {
797
+ jsonProjection(expression) {
798
+ return expression;
799
+ }
800
+ dataType = pgText.id;
801
+ codecId = PG_TEXT_CODEC_ID;
802
+ traits = [
803
+ "equality",
804
+ "order",
805
+ "textual"
806
+ ];
807
+ paramsSchema = void 0;
808
+ renderValueLiteral(value) {
809
+ return renderTsLiteral(value);
810
+ }
811
+ factory() {
812
+ return () => new PgTextCodec(this, pgText);
813
+ }
814
+ };
815
+ const pgTextDescriptor = new PgTextDescriptor();
816
+ const pgTextColumn = () => column(pgTextDescriptor.factory(), pgTextDescriptor.codecId, void 0);
817
+ /**
818
+ * Codec for a `pg.enum(Ref)` column bound to a native Postgres enum type.
819
+ * Text passthrough, identical to `pg/text@1` — encode/decode do not carry the
820
+ * enum's member values; membership is enforced by the native type itself, not
821
+ * by this codec. `renderValueLiteral` renders a member value as its TS
822
+ * literal, which is what drives the column's typed value-union (via
823
+ * `renderValueSetType` reading the column's `valueSet` ref) — the codec
824
+ * itself carries no params of its own; typing comes entirely from the
825
+ * column's value-set, not from `pg/enum@1`.
826
+ *
827
+ * A distinct codec id (rather than reusing `pg/text@1` on a plain text
828
+ * column) keeps native-enum columns independently identifiable — from a
829
+ * column's `codecId` alone, without also inspecting its data type — which
830
+ * the managed (DDL) phase needs to target `CREATE TYPE`/`ALTER TYPE`
831
+ * operations at exactly the columns that use one.
832
+ *
833
+ * Not `textual`, although its values are strings: Postgres has no `LIKE`,
834
+ * `ILIKE` or `to_tsvector` over an enum type.
835
+ */
836
+ var PgEnumCodec = class extends CodecImpl {
837
+ async toWire(value, _ctx) {
838
+ return value;
839
+ }
840
+ async fromWire(wire, _ctx) {
841
+ return wire;
842
+ }
843
+ fromDataTypeValue(value) {
844
+ return value.value;
845
+ }
846
+ toDataTypeValue(input) {
847
+ return this.dataTypeValueOf(input);
848
+ }
849
+ };
850
+ /**
851
+ * Narrows codec `typeParams` to {@link PgEnumParams} — the shape that binds a
852
+ * column to a named database type (a native enum's `CREATE TYPE` name).
853
+ */
854
+ function isPgEnumParams(value) {
855
+ return typeof value === "object" && value !== null && !Array.isArray(value) && "typeName" in value && typeof value.typeName === "string";
856
+ }
857
+ var PgEnumDescriptor = class extends PostgresCodecDescriptor {
858
+ jsonProjection(expression) {
859
+ return expression;
860
+ }
861
+ dataType = pgEnum.id;
862
+ codecId = PG_ENUM_CODEC_ID;
863
+ traits = ["equality", "order"];
864
+ enumRefusal = "A pg/enum codec types the column of a native enum, whose values the database enforces with an enum type of its own. Declare a native enum instead: native_enum in PSL, or nativeEnum in TypeScript.";
865
+ paramsSchema = pgEnumParams;
866
+ renderValueLiteral(value) {
867
+ return renderTsLiteral(value);
868
+ }
869
+ factory(params) {
870
+ return () => new PgEnumCodec(this, pgEnum, params);
871
+ }
872
+ /**
873
+ * Authoring-time hook a `pg.enum(<ref>)` type constructor calls once it has
874
+ * resolved its ref argument to the referenced `native_enum` entity:
875
+ * produces this codec's per-column `typeParams` from the entity's bare type
876
+ * name. Schema-qualification (`auth.aal_level` for a
877
+ * named non-default schema) is not this hook's concern — the field's
878
+ * namespace isn't known at this call site for every authoring path (the TS
879
+ * builder resolves a column before it knows its model's namespace), so it is
880
+ * applied later, at contract construction, by {@link qualifyNativeType} via
881
+ * the target's `authoring.qualifyColumnType` hook. Returns `undefined` if `entity` is not a `PostgresNativeEnum` (a
882
+ * contributor bug, not a user-schema error — the caller decides how to
883
+ * report it).
884
+ */
885
+ columnFromEntity(entity) {
886
+ if (!PostgresNativeEnum.is(entity)) return void 0;
887
+ return { typeParams: { typeName: entity.typeName } };
888
+ }
889
+ /**
890
+ * Schema-qualifies this native enum type's name for the namespace the
891
+ * consuming column lives in: `${namespaceId}.${typeName}` for a named
892
+ * non-default schema, bare for the target's default schema (`public`) or
893
+ * the late-bound unbound sentinel (whose schema `search_path` resolves at
894
+ * runtime). Postgres's `format_type()` reports the bare name for a
895
+ * public-schema type, so a public column's declared native type must stay
896
+ * bare to match. Owned here because the codec owns its native type.
897
+ */
898
+ qualifyNativeType(typeName, namespaceId) {
899
+ return namespaceId === "public" || namespaceId === UNBOUND_NAMESPACE_ID ? typeName : `${namespaceId}.${typeName}`;
900
+ }
901
+ };
902
+ const pgEnumDescriptor = new PgEnumDescriptor();
903
+ /**
904
+ * Contract-construction-time column-type qualifier the Postgres target
905
+ * contributes through `authoring.qualifyColumnType`.
906
+ * `buildSqlContractFromDefinition` calls this for every column as it is
907
+ * constructed, passing the column's bare type info and its owning
908
+ * `namespaceId`; a native-enum column (`pg/enum@1`) gets its type name
909
+ * schema-qualified for that namespace (via
910
+ * {@link PgEnumDescriptor.qualifyNativeType}), which rewrites only
911
+ * `typeParams.typeName`. Every other codec passes through unchanged.
912
+ * Both the PSL `pg.enum(Ref)` path and the TS `pg.enum(handle)` path route
913
+ * through here — the dispatch keys off the codec id, not authoring surface.
914
+ */
915
+ function postgresQualifyColumnType(input, namespaceId) {
916
+ if (input.codecId !== "pg/enum@1") return input;
917
+ const bareTypeName = input.typeParams?.["typeName"];
918
+ if (typeof bareTypeName !== "string") return input;
919
+ const qualified = pgEnumDescriptor.qualifyNativeType(bareTypeName, namespaceId);
920
+ return { typeParams: {
921
+ ...input.typeParams,
922
+ typeName: qualified
923
+ } };
924
+ }
925
+ /** The elements of the `text[]` text PostgreSQL prints, each a string or NULL. */
926
+ function readTextArrayWire(wire) {
927
+ return parsePostgresListText(wire).map((element) => {
928
+ if (element === null || typeof element === "string") return element;
929
+ throw postgresError("RUNTIME.DECODE_FAILED", `pg/text-array@1 reads a one-dimensional text[], and ${wire} has more dimensions`, { meta: {
930
+ codecId: PG_TEXT_ARRAY_CODEC_ID,
931
+ received: wire
932
+ } });
933
+ });
934
+ }
935
+ /**
936
+ * Postgres `text[]` control codec. Encode is an identity pass-through: the pg
937
+ * wire driver serialises a JS `string[]` to a Postgres array literal under the
938
+ * `$N::text[]` cast emitted from this codec's native type. Decode reads the
939
+ * array text the driver returns, or an array a driver has already parsed. Not a
940
+ * user-facing scalar — it is not part of the authorable `CodecTypes` surface,
941
+ * only the runtime codec registry.
942
+ */
943
+ var PgTextArrayCodec = class extends CodecImpl {
944
+ async toWire(value, _ctx) {
945
+ return value;
946
+ }
947
+ async fromWire(wire, _ctx) {
948
+ return typeof wire === "string" ? readTextArrayWire(wire) : wire;
949
+ }
950
+ fromDataTypeValue(value) {
951
+ return value.value;
952
+ }
953
+ toDataTypeValue(input) {
954
+ return this.dataTypeValueOf([...input]);
955
+ }
956
+ };
957
+ var PgTextArrayDescriptor = class extends PostgresCodecDescriptor {
958
+ jsonProjection(expression) {
959
+ return printedTextJsonProjection(expression);
960
+ }
961
+ dataType = pgTextArray.id;
962
+ codecId = PG_TEXT_ARRAY_CODEC_ID;
963
+ traits = ["equality"];
964
+ paramsSchema = void 0;
965
+ factory() {
966
+ return () => new PgTextArrayCodec(this, pgTextArray);
967
+ }
968
+ };
969
+ const pgTextArrayDescriptor = new PgTextArrayDescriptor();
970
+ var PgInt4Codec = class extends CodecImpl {
971
+ async toWire(value, _ctx) {
972
+ return value;
973
+ }
974
+ async fromWire(wire, _ctx) {
975
+ return decodePostgresNumberWire(wire);
976
+ }
977
+ fromDataTypeValue(value) {
978
+ return value.value;
979
+ }
980
+ toDataTypeValue(input) {
981
+ return this.dataTypeValueOf(input);
982
+ }
983
+ };
984
+ var PgInt4Descriptor = class extends PostgresCodecDescriptor {
985
+ jsonProjection(expression) {
986
+ return expression;
987
+ }
988
+ dataType = pgInt4.id;
989
+ codecId = PG_INT4_CODEC_ID;
990
+ traits = [
991
+ "equality",
992
+ "order",
993
+ "numeric"
994
+ ];
995
+ paramsSchema = void 0;
996
+ renderValueLiteral(value) {
997
+ return renderTsLiteral(value);
998
+ }
999
+ factory() {
1000
+ return () => new PgInt4Codec(this, pgInt4);
1001
+ }
1002
+ };
1003
+ const pgInt4Descriptor = new PgInt4Descriptor();
1004
+ const pgInt4Column = () => column(pgInt4Descriptor.factory(), pgInt4Descriptor.codecId, void 0);
1005
+ var PgInt2Codec = class extends CodecImpl {
1006
+ async toWire(value, _ctx) {
1007
+ return value;
1008
+ }
1009
+ async fromWire(wire, _ctx) {
1010
+ return decodePostgresNumberWire(wire);
1011
+ }
1012
+ fromDataTypeValue(value) {
1013
+ return value.value;
1014
+ }
1015
+ toDataTypeValue(input) {
1016
+ return this.dataTypeValueOf(input);
1017
+ }
1018
+ };
1019
+ var PgInt2Descriptor = class extends PostgresCodecDescriptor {
1020
+ jsonProjection(expression) {
1021
+ return expression;
1022
+ }
1023
+ dataType = pgInt2.id;
1024
+ codecId = PG_INT2_CODEC_ID;
1025
+ traits = [
1026
+ "equality",
1027
+ "order",
1028
+ "numeric"
1029
+ ];
1030
+ paramsSchema = void 0;
1031
+ renderValueLiteral(value) {
1032
+ return renderTsLiteral(value);
1033
+ }
1034
+ factory() {
1035
+ return () => new PgInt2Codec(this, pgInt2);
1036
+ }
1037
+ };
1038
+ const pgInt2Descriptor = new PgInt2Descriptor();
1039
+ const pgInt2Column = () => column(pgInt2Descriptor.factory(), pgInt2Descriptor.codecId, void 0);
1040
+ /**
1041
+ * A Postgres `int8` spans the full signed 64-bit range, which a JS `number`
1042
+ * cannot hold past 2^53. Application values are `bigint` and the canonical JSON
1043
+ * is decimal text; the wire form is the decimal string `pg` reads and writes for
1044
+ * this type.
1045
+ */
1046
+ var PgInt8Codec = class extends CodecImpl {
1047
+ async toWire(value, _ctx) {
1048
+ return pgBigintEncode(PG_INT8_CODEC_ID, value);
1049
+ }
1050
+ async fromWire(wire, _ctx) {
1051
+ return pgInt8Decode(wire);
1052
+ }
1053
+ fromDataTypeValue(value) {
1054
+ return BigInt(value.value);
1055
+ }
1056
+ toDataTypeValue(input) {
1057
+ return this.dataTypeValueOf(pgBigintDigits(PG_INT8_CODEC_ID, input));
1058
+ }
1059
+ };
1060
+ var PgInt8Descriptor = class extends PostgresCodecDescriptor {
1061
+ jsonProjection(expression) {
1062
+ return decimalTextJsonProjection(expression);
1063
+ }
1064
+ dataType = pgInt8.id;
1065
+ codecId = PG_INT8_CODEC_ID;
1066
+ traits = [
1067
+ "equality",
1068
+ "order",
1069
+ "numeric"
1070
+ ];
1071
+ paramsSchema = void 0;
1072
+ renderValueLiteral(value) {
1073
+ return decimalTextBigintLiteral(value);
1074
+ }
1075
+ factory() {
1076
+ return () => new PgInt8Codec(this, pgInt8);
1077
+ }
1078
+ };
1079
+ const pgInt8Descriptor = new PgInt8Descriptor();
1080
+ const pgInt8Column = () => column(pgInt8Descriptor.factory(), pgInt8Descriptor.codecId, void 0);
1081
+ /**
1082
+ * A Postgres `int8` decoded as a JS `number`, for columns whose values stay
1083
+ * within the safe integer range ±(2^53 − 1). Both directions guard rather than
1084
+ * round: decode (wire and JSON) and encode throw a structured error on
1085
+ * out-of-range or non-integral input. The canonical JSON is the decimal text
1086
+ * `pg/int8` carries, which every codec of that data type shares. The descriptor
1087
+ * claims no target type, so `int8` in type position stays `pg/int8@1`.
1088
+ */
1089
+ var PgInt8NumberCodec = class extends CodecImpl {
1090
+ async toWire(value, _ctx) {
1091
+ return pgInt8NumberEncode(value);
1092
+ }
1093
+ async fromWire(wire, _ctx) {
1094
+ return pgInt8NumberDecode(wire);
1095
+ }
1096
+ fromDataTypeValue(value) {
1097
+ return pgInt8NumberFromDigits(value.value);
1098
+ }
1099
+ toDataTypeValue(input) {
1100
+ return this.dataTypeValueOf(pgInt8NumberEncode(input));
1101
+ }
1102
+ };
1103
+ var PgInt8NumberDescriptor = class extends PostgresCodecDescriptor {
1104
+ jsonProjection(expression) {
1105
+ return decimalTextJsonProjection(expression);
1106
+ }
1107
+ dataType = pgInt8.id;
1108
+ codecId = PG_INT8_NUMBER_CODEC_ID;
1109
+ traits = [
1110
+ "equality",
1111
+ "order",
1112
+ "numeric"
1113
+ ];
1114
+ paramsSchema = void 0;
1115
+ renderValueLiteral(value) {
1116
+ return decimalTextNumberLiteral(value);
1117
+ }
1118
+ factory() {
1119
+ return () => new PgInt8NumberCodec(this, pgInt8);
1120
+ }
1121
+ };
1122
+ const pgInt8NumberDescriptor = new PgInt8NumberDescriptor();
1123
+ const pgInt8NumberColumn = () => column(pgInt8NumberDescriptor.factory(), pgInt8NumberDescriptor.codecId, void 0);
1124
+ var PgFloat4Codec = class extends CodecImpl {
1125
+ async toWire(value, _ctx) {
1126
+ return pgFloatEncode(value);
1127
+ }
1128
+ async fromWire(wire, _ctx) {
1129
+ return decodePostgresNumberWire(wire);
1130
+ }
1131
+ fromDataTypeValue(value) {
1132
+ return readJsonFloat(this.id, value.value);
1133
+ }
1134
+ toDataTypeValue(input) {
1135
+ return this.dataTypeValueOf(floatToJson(input));
1136
+ }
1137
+ };
1138
+ var PgFloat4Descriptor = class extends PostgresCodecDescriptor {
1139
+ jsonProjection(expression) {
1140
+ return expression;
1141
+ }
1142
+ dataType = pgFloat4.id;
1143
+ codecId = PG_FLOAT4_CODEC_ID;
1144
+ traits = [
1145
+ "equality",
1146
+ "order",
1147
+ "numeric"
1148
+ ];
1149
+ paramsSchema = void 0;
1150
+ renderValueLiteral(value) {
1151
+ return floatNumberLiteral(value);
1152
+ }
1153
+ factory() {
1154
+ return () => new PgFloat4Codec(this, pgFloat4);
1155
+ }
1156
+ };
1157
+ const pgFloat4Descriptor = new PgFloat4Descriptor();
1158
+ const pgFloat4Column = () => column(pgFloat4Descriptor.factory(), pgFloat4Descriptor.codecId, void 0);
1159
+ var PgFloat8Codec = class extends CodecImpl {
1160
+ async toWire(value, _ctx) {
1161
+ return pgFloatEncode(value);
1162
+ }
1163
+ async fromWire(wire, _ctx) {
1164
+ return decodePostgresNumberWire(wire);
1165
+ }
1166
+ fromDataTypeValue(value) {
1167
+ return readJsonFloat(this.id, value.value);
1168
+ }
1169
+ toDataTypeValue(input) {
1170
+ return this.dataTypeValueOf(floatToJson(input));
1171
+ }
1172
+ };
1173
+ var PgFloat8Descriptor = class extends PostgresCodecDescriptor {
1174
+ jsonProjection(expression) {
1175
+ return expression;
1176
+ }
1177
+ dataType = pgFloat8.id;
1178
+ codecId = PG_FLOAT8_CODEC_ID;
1179
+ traits = [
1180
+ "equality",
1181
+ "order",
1182
+ "numeric"
1183
+ ];
1184
+ paramsSchema = void 0;
1185
+ renderValueLiteral(value) {
1186
+ return floatNumberLiteral(value);
1187
+ }
1188
+ factory() {
1189
+ return () => new PgFloat8Codec(this, pgFloat8);
1190
+ }
1191
+ };
1192
+ const pgFloat8Descriptor = new PgFloat8Descriptor();
1193
+ const pgFloat8Column = () => column(pgFloat8Descriptor.factory(), pgFloat8Descriptor.codecId, void 0);
1194
+ var PgBoolCodec = class extends CodecImpl {
1195
+ async toWire(value, _ctx) {
1196
+ return value;
1197
+ }
1198
+ async fromWire(wire, _ctx) {
1199
+ return decodePostgresBooleanWire(wire);
1200
+ }
1201
+ fromDataTypeValue(value) {
1202
+ return value.value;
1203
+ }
1204
+ toDataTypeValue(input) {
1205
+ return this.dataTypeValueOf(input);
1206
+ }
1207
+ };
1208
+ var PgBoolDescriptor = class extends PostgresCodecDescriptor {
1209
+ jsonProjection(expression) {
1210
+ return expression;
1211
+ }
1212
+ dataType = pgBool.id;
1213
+ codecId = PG_BOOL_CODEC_ID;
1214
+ traits = ["equality", "boolean"];
1215
+ paramsSchema = void 0;
1216
+ renderValueLiteral(value) {
1217
+ return renderTsLiteral(value);
1218
+ }
1219
+ factory() {
1220
+ return () => new PgBoolCodec(this, pgBool);
1221
+ }
1222
+ };
1223
+ const pgBoolDescriptor = new PgBoolDescriptor();
1224
+ const pgBoolColumn = () => column(pgBoolDescriptor.factory(), pgBoolDescriptor.codecId, void 0);
1225
+ var PgNumericCodec = class extends CodecImpl {
1226
+ async toWire(value, _ctx) {
1227
+ return value;
1228
+ }
1229
+ async fromWire(wire, _ctx) {
1230
+ return pgNumericDecode(wire);
1231
+ }
1232
+ fromDataTypeValue(value) {
1233
+ return value.value;
1234
+ }
1235
+ toDataTypeValue(input) {
1236
+ return this.dataTypeValueOf(numericJson(input));
1237
+ }
1238
+ };
1239
+ var PgNumericDescriptor = class extends PostgresCodecDescriptor {
1240
+ jsonProjection(expression) {
1241
+ return decimalTextJsonProjection(expression);
1242
+ }
1243
+ dataType = pgNumeric.id;
1244
+ codecId = PG_NUMERIC_CODEC_ID;
1245
+ traits = [
1246
+ "equality",
1247
+ "order",
1248
+ "numeric"
1249
+ ];
1250
+ keepsWrittenForm = true;
1251
+ paramsSchema = pgNumericParams;
1252
+ factory(params) {
1253
+ return () => new PgNumericCodec(this, pgNumeric, params ?? {});
1254
+ }
1255
+ };
1256
+ const pgNumericDescriptor = new PgNumericDescriptor();
1257
+ const pgNumericColumn = (params = {}) => column(pgNumericDescriptor.factory(params), pgNumericDescriptor.codecId, params);
1258
+ /**
1259
+ * A genuinely unbounded integer over unconstrained Postgres `numeric` storage.
1260
+ * Application values are `bigint` and the canonical JSON is decimal text, like
1261
+ * `pg/int8@1`; decode rejects non-integral values. The descriptor claims no
1262
+ * target type, so `numeric` and `decimal` in type position stay `pg/numeric@1`.
1263
+ */
1264
+ var PgUnboundedIntCodec = class extends CodecImpl {
1265
+ async toWire(value, _ctx) {
1266
+ return pgBigintEncode(PG_UNBOUNDED_INT_CODEC_ID, value);
1267
+ }
1268
+ async fromWire(wire, _ctx) {
1269
+ return pgUnboundedIntDecode(wire);
1270
+ }
1271
+ /** A `bigint` holds only a whole number, so a value with a fraction, or `NaN` or an infinity, is refused. */
1272
+ fromDataTypeValue(value) {
1273
+ return readJsonIntegerText(this.id, value.value);
1274
+ }
1275
+ toDataTypeValue(input) {
1276
+ return this.dataTypeValueOf(pgBigintDigits(PG_UNBOUNDED_INT_CODEC_ID, input));
1277
+ }
1278
+ };
1279
+ var PgUnboundedIntDescriptor = class extends PostgresCodecDescriptor {
1280
+ jsonProjection(expression) {
1281
+ return decimalTextJsonProjection(expression);
1282
+ }
1283
+ dataType = pgNumeric.id;
1284
+ codecId = PG_UNBOUNDED_INT_CODEC_ID;
1285
+ traits = [
1286
+ "equality",
1287
+ "order",
1288
+ "numeric"
1289
+ ];
1290
+ paramsSchema = pgNumericParams;
1291
+ renderValueLiteral(value) {
1292
+ return decimalTextBigintLiteral(value);
1293
+ }
1294
+ factory(params) {
1295
+ return () => new PgUnboundedIntCodec(this, pgNumeric, params ?? {});
1296
+ }
1297
+ };
1298
+ const pgUnboundedIntDescriptor = new PgUnboundedIntDescriptor();
1299
+ const pgUnboundedIntColumn = () => column(pgUnboundedIntDescriptor.factory(), pgUnboundedIntDescriptor.codecId, void 0);
1300
+ var PgTimetzCodec = class extends CodecImpl {
1301
+ async toWire(value, _ctx) {
1302
+ return value;
1303
+ }
1304
+ async fromWire(wire, _ctx) {
1305
+ return wire;
1306
+ }
1307
+ fromDataTypeValue(value) {
1308
+ return value.value;
1309
+ }
1310
+ toDataTypeValue(input) {
1311
+ return this.dataTypeValueOf(input);
1312
+ }
1313
+ };
1314
+ var PgTimetzDescriptor = class extends PostgresCodecDescriptor {
1315
+ jsonProjection(expression) {
1316
+ return expression;
1317
+ }
1318
+ dataType = pgTimetz.id;
1319
+ codecId = PG_TIMETZ_CODEC_ID;
1320
+ traits = ["equality", "order"];
1321
+ enumRefusal = "A query reads each value as the text PostgreSQL prints, such as \"12:34:56+02\", while the contract stores it in ISO 8601, such as \"12:34:56+02:00\", so a value read back need not equal the member written. No enum can use a timetz codec; use a text enum instead.";
1322
+ paramsSchema = pgPrecisionParams;
1323
+ factory(params) {
1324
+ return () => new PgTimetzCodec(this, pgTimetz, params ?? {});
1325
+ }
1326
+ };
1327
+ const pgTimetzDescriptor = new PgTimetzDescriptor();
1328
+ const pgTimetzColumn = (params = {}) => column(pgTimetzDescriptor.factory(params), pgTimetzDescriptor.codecId, params);
1329
+ var PgBitCodec = class extends CodecImpl {
1330
+ async toWire(value, _ctx) {
1331
+ return value;
1332
+ }
1333
+ async fromWire(wire, _ctx) {
1334
+ return wire;
1335
+ }
1336
+ fromDataTypeValue(value) {
1337
+ return value.value;
1338
+ }
1339
+ toDataTypeValue(input) {
1340
+ return this.dataTypeValueOf(input);
1341
+ }
1342
+ };
1343
+ var PgBitDescriptor = class extends PostgresCodecDescriptor {
1344
+ jsonProjection(expression) {
1345
+ return expression;
1346
+ }
1347
+ dataType = pgBit.id;
1348
+ codecId = PG_BIT_CODEC_ID;
1349
+ traits = ["equality", "order"];
1350
+ paramsSchema = pgBitLengthParams;
1351
+ renderValueLiteral(value) {
1352
+ return renderTsLiteral(value);
1353
+ }
1354
+ factory(params) {
1355
+ return () => new PgBitCodec(this, pgBit, params ?? {});
1356
+ }
1357
+ };
1358
+ const pgBitDescriptor = new PgBitDescriptor();
1359
+ const pgBitColumn = (params = {}) => column(pgBitDescriptor.factory(params), pgBitDescriptor.codecId, params);
1360
+ var PgVarbitCodec = class extends CodecImpl {
1361
+ async toWire(value, _ctx) {
1362
+ return value;
1363
+ }
1364
+ async fromWire(wire, _ctx) {
1365
+ return wire;
1366
+ }
1367
+ fromDataTypeValue(value) {
1368
+ return value.value;
1369
+ }
1370
+ toDataTypeValue(input) {
1371
+ return this.dataTypeValueOf(input);
1372
+ }
1373
+ };
1374
+ var PgVarbitDescriptor = class extends PostgresCodecDescriptor {
1375
+ jsonProjection(expression) {
1376
+ return expression;
1377
+ }
1378
+ dataType = pgVarbit.id;
1379
+ codecId = PG_VARBIT_CODEC_ID;
1380
+ traits = ["equality", "order"];
1381
+ paramsSchema = pgBitLengthParams;
1382
+ renderValueLiteral(value) {
1383
+ return renderTsLiteral(value);
1384
+ }
1385
+ factory(params) {
1386
+ return () => new PgVarbitCodec(this, pgVarbit, params ?? {});
1387
+ }
1388
+ };
1389
+ const pgVarbitDescriptor = new PgVarbitDescriptor();
1390
+ const pgVarbitColumn = (params = {}) => column(pgVarbitDescriptor.factory(params), pgVarbitDescriptor.codecId, params);
1391
+ var PgByteaCodec = class extends CodecImpl {
1392
+ async toWire(value, _ctx) {
1393
+ return value;
1394
+ }
1395
+ async fromWire(wire, _ctx) {
1396
+ return pgByteaDecodeWire(wire);
1397
+ }
1398
+ fromDataTypeValue(value) {
1399
+ return pgByteaFromBase64(value.value);
1400
+ }
1401
+ toDataTypeValue(input) {
1402
+ return this.dataTypeValueOf(pgByteaToBase64(input));
1403
+ }
1404
+ };
1405
+ var PgByteaDescriptor = class extends PostgresCodecDescriptor {
1406
+ jsonProjection(expression) {
1407
+ return printedTextJsonProjection(expression);
1408
+ }
1409
+ dataType = pgBytea.id;
1410
+ codecId = PG_BYTEA_CODEC_ID;
1411
+ traits = ["equality"];
1412
+ enumRefusal = "The contract stores a bytea value as base64 text, which PostgreSQL reads as the bytes of that text, so no CHECK can compare a value with the members. No enum can use a bytea codec; use a text enum instead.";
1413
+ paramsSchema = void 0;
1414
+ factory() {
1415
+ return () => new PgByteaCodec(this, pgBytea);
1416
+ }
1417
+ };
1418
+ const pgByteaDescriptor = new PgByteaDescriptor();
1419
+ var PgUuidCodec = class extends CodecImpl {
1420
+ async toWire(value, _ctx) {
1421
+ return value;
1422
+ }
1423
+ async fromWire(wire, _ctx) {
1424
+ return wire;
1425
+ }
1426
+ fromDataTypeValue(value) {
1427
+ return value.value;
1428
+ }
1429
+ toDataTypeValue(input) {
1430
+ return this.dataTypeValueOf(input);
1431
+ }
1432
+ };
1433
+ var PgUuidDescriptor = class extends PostgresCodecDescriptor {
1434
+ jsonProjection(expression) {
1435
+ return expression;
1436
+ }
1437
+ dataType = pgUuid.id;
1438
+ codecId = PG_UUID_CODEC_ID;
1439
+ traits = ["equality", "order"];
1440
+ paramsSchema = void 0;
1441
+ renderValueLiteral(value) {
1442
+ return renderTsLiteral(value);
1443
+ }
1444
+ factory() {
1445
+ return () => new PgUuidCodec(this, pgUuid);
1446
+ }
1447
+ };
1448
+ const pgUuidDescriptor = new PgUuidDescriptor();
1449
+ const pgUuidColumn = () => column(pgUuidDescriptor.factory(), pgUuidDescriptor.codecId, void 0);
1450
+ var PgInetCodec = class extends CodecImpl {
1451
+ async toWire(value, _ctx) {
1452
+ return value;
1453
+ }
1454
+ async fromWire(wire, _ctx) {
1455
+ return wire;
1456
+ }
1457
+ fromDataTypeValue(value) {
1458
+ return value.value;
1459
+ }
1460
+ toDataTypeValue(input) {
1461
+ return this.dataTypeValueOf(input);
1462
+ }
1463
+ };
1464
+ var PgInetDescriptor = class extends PostgresCodecDescriptor {
1465
+ jsonProjection(expression) {
1466
+ return expression;
1467
+ }
1468
+ dataType = pgInet.id;
1469
+ codecId = PG_INET_CODEC_ID;
1470
+ traits = ["equality", "order"];
1471
+ paramsSchema = void 0;
1472
+ renderValueLiteral(value) {
1473
+ return renderTsLiteral(value);
1474
+ }
1475
+ factory() {
1476
+ return () => new PgInetCodec(this, pgInet);
1477
+ }
1478
+ };
1479
+ const pgInetDescriptor = new PgInetDescriptor();
1480
+ const pgInetColumn = () => column(pgInetDescriptor.factory(), pgInetDescriptor.codecId, void 0);
1481
+ var PgTsqueryCodec = class extends CodecImpl {
1482
+ async toWire(value, _ctx) {
1483
+ return value;
1484
+ }
1485
+ async fromWire(wire, _ctx) {
1486
+ return blindCast(wire);
1487
+ }
1488
+ fromDataTypeValue(value) {
1489
+ return blindCast(value.value);
1490
+ }
1491
+ toDataTypeValue(input) {
1492
+ return this.dataTypeValueOf(input);
1493
+ }
1494
+ };
1495
+ /**
1496
+ * The type of a full-text query: what the parsers and the tag in `full-text` return, and what a
1497
+ * `tsquery` value read back from a query binds as when passed to `fullTextMatches`, `fullTextRank`
1498
+ * or `fullTextHeadline`. It has no column helper, because a contract cannot author a `tsquery`
1499
+ * column, and no traits, because comparing or ordering queries means nothing to an application.
1500
+ */
1501
+ var PgTsqueryDescriptor = class extends PostgresCodecDescriptor {
1502
+ jsonProjection(expression) {
1503
+ return expression;
1504
+ }
1505
+ dataType = pgTsquery.id;
1506
+ codecId = PG_TSQUERY_CODEC_ID;
1507
+ traits = [];
1508
+ enumRefusal = "PostgreSQL normalises the query text, so a member as written is not the value a query reads back: it prints a & b as 'a' & 'b'. No enum can use a tsquery codec; use a text enum instead.";
1509
+ paramsSchema = void 0;
1510
+ factory() {
1511
+ return () => new PgTsqueryCodec(this, pgTsquery);
1512
+ }
1513
+ };
1514
+ const pgTsqueryDescriptor = new PgTsqueryDescriptor();
1515
+ /**
1516
+ * An application value is a {@link PgInterval} — the three fields PostgreSQL
1517
+ * actually stores, `{ months, days, micros }` — and its canonical JSON is the
1518
+ * ISO-8601 duration string PostgreSQL spells under
1519
+ * `IntervalStyle = 'iso_8601'`: `P1M`, `P30D`, `P1Y2M3DT4H5M6S`, `PT0S` for
1520
+ * zero, each component carrying its own sign.
1521
+ *
1522
+ * Value and representation are independent here, as they are for `pg/bytea@1`
1523
+ * (`Uint8Array` carried as base64) and `pg/int8@1` (`bigint` carried as decimal
1524
+ * text). Reading an interval hands back numbers to compute with rather than a
1525
+ * string to parse; writing one takes the same numbers.
1526
+ *
1527
+ * The fields stay independent because a month has no fixed length: `{months: 1}`
1528
+ * and `{days: 30}` are different values and neither converts to the other. The
1529
+ * ISO rendering normalises only in its own spelling — twelve months render as a
1530
+ * year — so `{months: 13}` renders `P1Y1M` and reads back as `{months: 13}`.
1531
+ */
1532
+ var PgIntervalCodec = class extends CodecImpl {
1533
+ async toWire(value, _ctx) {
1534
+ return pgIntervalToIso(value);
1535
+ }
1536
+ async fromWire(wire, _ctx) {
1537
+ return pgIntervalDecode(wire);
1538
+ }
1539
+ fromDataTypeValue(value) {
1540
+ return pgIntervalFromIso(value.value);
1541
+ }
1542
+ toDataTypeValue(input) {
1543
+ return this.dataTypeValueOf(pgIntervalToIso(input));
1544
+ }
1545
+ };
1546
+ var PgIntervalDescriptor = class extends PostgresCodecDescriptor {
1547
+ jsonProjection(expression) {
1548
+ return printedTextJsonProjection(expression);
1549
+ }
1550
+ dataType = pgInterval.id;
1551
+ codecId = PG_INTERVAL_CODEC_ID;
1552
+ traits = ["equality", "order"];
1553
+ keepsWrittenForm = true;
1554
+ paramsSchema = pgPrecisionParams;
1555
+ factory(params) {
1556
+ return () => new PgIntervalCodec(this, pgInterval, params ?? {});
1557
+ }
1558
+ };
1559
+ const pgIntervalDescriptor = new PgIntervalDescriptor();
1560
+ const pgIntervalColumn = (params = {}) => column(pgIntervalDescriptor.factory(params), pgIntervalDescriptor.codecId, params);
1561
+ var PgJsonCodec = class extends CodecImpl {
1562
+ async toWire(value, _ctx) {
1563
+ return pgJsonEncode(value);
1564
+ }
1565
+ async fromWire(wire, _ctx) {
1566
+ return pgJsonDecode(wire);
1567
+ }
1568
+ fromDataTypeValue(value) {
1569
+ return value.value;
1570
+ }
1571
+ toDataTypeValue(input) {
1572
+ return this.dataTypeValueOf(input);
1573
+ }
1574
+ };
1575
+ var PgJsonDescriptor = class extends PostgresCodecDescriptor {
1576
+ jsonProjection(expression) {
1577
+ return printedTextJsonProjection(expression);
1578
+ }
1579
+ dataType = pgJson.id;
1580
+ codecId = PG_JSON_CODEC_ID;
1581
+ traits = [];
1582
+ enumRefusal = "The json type has no equality operator, so no CHECK can compare a value with the members. No enum can use a json codec; use a text enum instead.";
1583
+ paramsSchema = void 0;
1584
+ factory() {
1585
+ return () => new PgJsonCodec(this, pgJson);
1586
+ }
1587
+ };
1588
+ const pgJsonDescriptor = new PgJsonDescriptor();
1589
+ const pgJsonColumn = () => column(pgJsonDescriptor.factory(), pgJsonDescriptor.codecId, void 0);
1590
+ var PgJsonbCodec = class extends CodecImpl {
1591
+ async toWire(value, _ctx) {
1592
+ return pgJsonbEncode(value);
1593
+ }
1594
+ async fromWire(wire, _ctx) {
1595
+ return pgJsonbDecode(wire);
1596
+ }
1597
+ fromDataTypeValue(value) {
1598
+ return value.value;
1599
+ }
1600
+ toDataTypeValue(input) {
1601
+ return this.dataTypeValueOf(input);
1602
+ }
1603
+ };
1604
+ var PgJsonbDescriptor = class extends PostgresCodecDescriptor {
1605
+ jsonProjection(expression) {
1606
+ return printedTextJsonProjection(expression);
1607
+ }
1608
+ dataType = pgJsonb.id;
1609
+ codecId = PG_JSONB_CODEC_ID;
1610
+ traits = ["equality"];
1611
+ enumRefusal = pgJsonbEnumRefusal;
1612
+ paramsSchema = void 0;
1613
+ factory() {
1614
+ return () => new PgJsonbCodec(this, pgJsonb);
1615
+ }
1616
+ };
1617
+ const pgJsonbDescriptor = new PgJsonbDescriptor();
1618
+ const pgJsonbColumn = () => column(pgJsonbDescriptor.factory(), pgJsonbDescriptor.codecId, void 0);
1619
+ var PgIntCodec = class extends SqlIntCodec {
1620
+ async fromWire(wire, _ctx) {
1621
+ return decodePostgresNumberWire(wire);
1622
+ }
1623
+ };
1624
+ var PgFloatCodec = class extends SqlFloatCodec {
1625
+ async fromWire(wire, _ctx) {
1626
+ return decodePostgresNumberWire(wire);
1627
+ }
1628
+ };
1629
+ var PgCharDescriptor = class extends PostgresCodecDescriptor {
1630
+ jsonProjection(expression) {
1631
+ return unpaddedCharJsonProjection(expression);
1632
+ }
1633
+ dataType = pgChar.id;
1634
+ codecId = PG_CHAR_CODEC_ID;
1635
+ traits = sqlCharDescriptor.traits;
1636
+ paramsSchema = pgCharacterLengthParams;
1637
+ renderValueLiteral(value) {
1638
+ return renderTsLiteral(value);
1639
+ }
1640
+ factory(params) {
1641
+ return () => new SqlCharCodec(this, pgChar, params ?? {});
1642
+ }
1643
+ };
1644
+ const pgCharDescriptor = new PgCharDescriptor();
1645
+ const pgCharColumn = (params = {}) => column(pgCharDescriptor.factory(params), pgCharDescriptor.codecId, params);
1646
+ var PgVarcharDescriptor = class extends PostgresCodecDescriptor {
1647
+ jsonProjection(expression) {
1648
+ return expression;
1649
+ }
1650
+ dataType = pgVarchar.id;
1651
+ codecId = PG_VARCHAR_CODEC_ID;
1652
+ traits = sqlVarcharDescriptor.traits;
1653
+ paramsSchema = pgCharacterLengthParams;
1654
+ renderValueLiteral(value) {
1655
+ return renderTsLiteral(value);
1656
+ }
1657
+ factory(params) {
1658
+ return () => new SqlVarcharCodec(this, pgVarchar, params ?? {});
1659
+ }
1660
+ };
1661
+ const pgVarcharDescriptor = new PgVarcharDescriptor();
1662
+ const pgVarcharColumn = (params = {}) => column(pgVarcharDescriptor.factory(params), pgVarcharDescriptor.codecId, params);
1663
+ var PgIntDescriptor = class extends PostgresCodecDescriptor {
1664
+ jsonProjection(expression) {
1665
+ return expression;
1666
+ }
1667
+ dataType = pgInt4.id;
1668
+ codecId = PG_INT_CODEC_ID;
1669
+ traits = sqlIntDescriptor.traits;
1670
+ paramsSchema = sqlIntDescriptor.paramsSchema;
1671
+ renderValueLiteral(value) {
1672
+ return renderTsLiteral(value);
1673
+ }
1674
+ factory() {
1675
+ return () => new PgIntCodec(this, pgInt4);
1676
+ }
1677
+ };
1678
+ const pgIntDescriptor = new PgIntDescriptor();
1679
+ const pgIntColumn = () => column(pgIntDescriptor.factory(), pgIntDescriptor.codecId, void 0);
1680
+ var PgFloatDescriptor = class extends PostgresCodecDescriptor {
1681
+ jsonProjection(expression) {
1682
+ return expression;
1683
+ }
1684
+ dataType = pgFloat8.id;
1685
+ codecId = PG_FLOAT_CODEC_ID;
1686
+ traits = sqlFloatDescriptor.traits;
1687
+ paramsSchema = sqlFloatDescriptor.paramsSchema;
1688
+ renderValueLiteral(value) {
1689
+ return floatNumberLiteral(value);
1690
+ }
1691
+ factory() {
1692
+ return () => new PgFloatCodec(this, pgFloat8);
1693
+ }
1694
+ };
1695
+ const pgFloatDescriptor = new PgFloatDescriptor();
1696
+ const pgFloatColumn = () => column(pgFloatDescriptor.factory(), pgFloatDescriptor.codecId, void 0);
1697
+ const codecDescriptors = definePostgresCodecs([
1698
+ postgresSqlCharDescriptor,
1699
+ postgresSqlVarcharDescriptor,
1700
+ postgresSqlIntDescriptor,
1701
+ postgresSqlFloatDescriptor,
1702
+ postgresSqlTextDescriptor,
1703
+ postgresSqlRawDescriptor,
1704
+ pgTextDescriptor,
1705
+ pgEnumDescriptor,
1706
+ pgCharDescriptor,
1707
+ pgVarcharDescriptor,
1708
+ pgIntDescriptor,
1709
+ pgFloatDescriptor,
1710
+ pgInt4Descriptor,
1711
+ pgInt2Descriptor,
1712
+ pgInt8Descriptor,
1713
+ pgInt8NumberDescriptor,
1714
+ pgFloat4Descriptor,
1715
+ pgFloat8Descriptor,
1716
+ pgNumericDescriptor,
1717
+ pgUnboundedIntDescriptor,
1718
+ pgDateTemporalDescriptor,
1719
+ pgTimestampTemporalDescriptor,
1720
+ pgTimestamptzTemporalDescriptor,
1721
+ pgTimeTemporalDescriptor,
1722
+ pgDateStringDescriptor,
1723
+ pgTimestampStringDescriptor,
1724
+ pgTimestamptzStringDescriptor,
1725
+ pgTimestamptzDateDescriptor,
1726
+ pgTimeStringDescriptor,
1727
+ pgTimetzDescriptor,
1728
+ pgBoolDescriptor,
1729
+ pgBitDescriptor,
1730
+ pgVarbitDescriptor,
1731
+ pgByteaDescriptor,
1732
+ pgUuidDescriptor,
1733
+ pgInetDescriptor,
1734
+ pgIntervalDescriptor,
1735
+ pgJsonDescriptor,
1736
+ pgJsonbDescriptor,
1737
+ pgTextArrayDescriptor,
1738
+ pgTsqueryDescriptor
1739
+ ]);
1740
+ //#endregion
1741
+ 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 _, isPgEnumParams as a, pgIntervalColumn as b, pgBoolColumn as c, pgFloat4Column as d, pgFloat8Column as f, pgInt4Column as g, pgInt2Column as h, decodePostgresListText as i, pgVarcharColumn as j, pgUuidColumn as k, pgCharColumn as l, pgInetColumn as m, PgTimestamptzDateDescriptor as n, parsePostgresListText as o, pgFloatColumn as p, codecDescriptors as r, pgBitColumn as s, PgTimestamptzDateCodec as t, pgEnumDescriptor as u, pgInt8NumberColumn as v, pgTextColumn as w, pgJsonColumn as x, pgIntColumn as y };
1742
+
1743
+ //# sourceMappingURL=codecs-CRl9-i_r-Co-bgYl3.mjs.map