@prisma/orm-target-postgres 8.0.0-rc.14-dev.29 → 8.0.0-rc.14-dev.31

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 (247) hide show
  1. package/dist/{adapter-DzNbNJ24.d.mts → adapter-BOi8Qpb_.d.mts} +6 -4
  2. package/dist/adapter-BOi8Qpb_.d.mts.map +1 -0
  3. package/dist/{adapter-BNrSLsxC-CXrTrSvP.mjs → adapter-DwUKamWE-9wPlFOdx.mjs} +23 -12
  4. package/dist/adapter-DwUKamWE-9wPlFOdx.mjs.map +1 -0
  5. package/dist/adapter.d.mts +7 -7
  6. package/dist/adapter.mjs +7 -7
  7. package/dist/adapter__adapter.d.mts +1 -1
  8. package/dist/adapter__adapter.mjs +1 -1
  9. package/dist/adapter__control.d.mts +2 -2
  10. package/dist/adapter__control.mjs +10 -16
  11. package/dist/adapter__control.mjs.map +1 -1
  12. package/dist/adapter__runtime.d.mts +1 -1
  13. package/dist/adapter__runtime.mjs +9 -6
  14. package/dist/adapter__runtime.mjs.map +1 -1
  15. package/dist/adapter__sql-renderer.d.mts +1 -1
  16. package/dist/adapter__sql-renderer.mjs +1 -1
  17. package/dist/adapter__types.d.mts +3 -3
  18. package/dist/{authoring-C5Ch8RNG-Qgq9GiOY.mjs → authoring-BarDKx1G-BKhOsXKo.mjs} +20 -65
  19. package/dist/authoring-BarDKx1G-BKhOsXKo.mjs.map +1 -0
  20. package/dist/{check-expressions-DJNIFTHB-C86_fR5c.mjs → check-expressions-BRuSxJ5d-CC5OFfR1.mjs} +3 -3
  21. package/dist/{check-expressions-DJNIFTHB-C86_fR5c.mjs.map → check-expressions-BRuSxJ5d-CC5OFfR1.mjs.map} +1 -1
  22. package/dist/{codec-descriptor-B61d-k4C-BdWVU6Fu.mjs → codec-descriptor-CZAGhM_O-DK9auM7J.mjs} +5 -18
  23. package/dist/codec-descriptor-CZAGhM_O-DK9auM7J.mjs.map +1 -0
  24. package/dist/codec-descriptor-DAQDOwCJ.d.mts +1 -0
  25. package/dist/{codec-descriptor-HYqjI24K-CTO3gTEs.d.mts → codec-descriptor-DkeVTJ3N-XTfZgDGp.d.mts} +9 -10
  26. package/dist/codec-descriptor-DkeVTJ3N-XTfZgDGp.d.mts.map +1 -0
  27. package/dist/{codec-helpers-BmUrP6U9-DuO9gpqZ.mjs → codec-helpers-BKrVHgYc-DFnb5u9l.mjs} +4 -6
  28. package/dist/codec-helpers-BKrVHgYc-DFnb5u9l.mjs.map +1 -0
  29. package/dist/{codecs-CWXNVl1P.mjs → codec-registry-CCCOytGc-BFC0dvlt.mjs} +28 -12
  30. package/dist/codec-registry-CCCOytGc-BFC0dvlt.mjs.map +1 -0
  31. package/dist/{codec-type-map-Br7wS7DK-DmphGfZE.d.mts → codec-type-map-B9MLL97E-RMa5Y4R4.d.mts} +4 -4
  32. package/dist/{codec-type-map-Br7wS7DK-DmphGfZE.d.mts.map → codec-type-map-B9MLL97E-RMa5Y4R4.d.mts.map} +1 -1
  33. package/dist/{codec-types-DBeKvpNs-D9JlxBzY.d.mts → codec-types-Du6N0o5U-DMAI6jag.d.mts} +4 -4
  34. package/dist/{codec-types-DBeKvpNs-D9JlxBzY.d.mts.map → codec-types-Du6N0o5U-DMAI6jag.d.mts.map} +1 -1
  35. package/dist/codec-types-uq3Il6e3.d.mts +2 -0
  36. package/dist/{codecs-CnbVrlil--FxLKWM5.mjs → codecs-BzCRfsit-BbLlbudt.mjs} +35 -228
  37. package/dist/codecs-BzCRfsit-BbLlbudt.mjs.map +1 -0
  38. package/dist/{codecs-DxqbAhl0.d.mts → codecs-C0zx-UlM.d.mts} +10 -14
  39. package/dist/codecs-C0zx-UlM.d.mts.map +1 -0
  40. package/dist/{codecs-BU-eLMQi-BB2afWsO.d.mts → codecs-Ckpsj4IT-C7kgMiKv.d.mts} +16 -90
  41. package/dist/codecs-Ckpsj4IT-C7kgMiKv.d.mts.map +1 -0
  42. package/dist/{contract-free-DeK6m1dy.mjs → contract-free-DAGgx1J-.mjs} +8 -5
  43. package/dist/contract-free-DAGgx1J-.mjs.map +1 -0
  44. package/dist/{control-CyiVFspE.mjs → control-C0mAPRzk.mjs} +75 -117
  45. package/dist/control-C0mAPRzk.mjs.map +1 -0
  46. package/dist/{control-xWtRBAPw.d.mts → control-aDBKB9hQ.d.mts} +5 -10
  47. package/dist/control-aDBKB9hQ.d.mts.map +1 -0
  48. package/dist/{control-adapter-Du0EcG5G-CT4qBFrG.mjs → control-adapter-cjnLE0mN-BmNP2taw.mjs} +14 -18
  49. package/dist/control-adapter-cjnLE0mN-BmNP2taw.mjs.map +1 -0
  50. package/dist/control-fp7Azf3F.d.mts +733 -0
  51. package/dist/control-fp7Azf3F.d.mts.map +1 -0
  52. package/dist/{control-policy-BW5Cgq3Z-Dn2ZVBCP.mjs → control-policy-CuJvncMq-C5yshGZP.mjs} +52 -52
  53. package/dist/control-policy-CuJvncMq-C5yshGZP.mjs.map +1 -0
  54. package/dist/{data-type-entries-cjspFU7A-BBOIqLij.mjs → data-type-entries-DYgNhsVx-BWJJHCQR.mjs} +5 -4
  55. package/dist/data-type-entries-DYgNhsVx-BWJJHCQR.mjs.map +1 -0
  56. package/dist/data-types-DzUVlWeo-CBMHoFoH.mjs +366 -0
  57. package/dist/data-types-DzUVlWeo-CBMHoFoH.mjs.map +1 -0
  58. package/dist/data-types-E1wms1_i.d.mts +96 -0
  59. package/dist/data-types-E1wms1_i.d.mts.map +1 -0
  60. package/dist/{ddl-BQFDVert-CcDdETee.mjs → ddl-BzsT_-qY-Cdzm0YIK.mjs} +3 -3
  61. package/dist/{ddl-BQFDVert-CcDdETee.mjs.map → ddl-BzsT_-qY-Cdzm0YIK.mjs.map} +1 -1
  62. package/dist/{default-normalizer-ByDD_gRm-CKeWEb0x.mjs → default-normalizer-C68YhUBS-BjOeKRhS.mjs} +3 -3
  63. package/dist/{default-normalizer-ByDD_gRm-CKeWEb0x.mjs.map → default-normalizer-C68YhUBS-BjOeKRhS.mjs.map} +1 -1
  64. package/dist/{descriptor-meta-Bvq6_NJ8-Cn_M79Lf.mjs → descriptor-meta-CUmf1G9P-GAdC3zfT.mjs} +9 -7
  65. package/dist/descriptor-meta-CUmf1G9P-GAdC3zfT.mjs.map +1 -0
  66. package/dist/{descriptor-meta-BEigA5Gj-eY7nV4N_.mjs → descriptor-meta-gq4MiUXl-DqqHHHSj.mjs} +4 -90
  67. package/dist/descriptor-meta-gq4MiUXl-DqqHHHSj.mjs.map +1 -0
  68. package/dist/{descriptor-meta-runtime-UwYdV8fD-B_m_Ha8r.mjs → descriptor-meta-runtime-D-ZCTI0a-DVgDk2XT.mjs} +5 -3
  69. package/dist/descriptor-meta-runtime-D-ZCTI0a-DVgDk2XT.mjs.map +1 -0
  70. package/dist/{diff-database-schema-D-eMVqv1.d.mts → diff-database-schema-BGcRo8FM.d.mts} +2 -2
  71. package/dist/{diff-database-schema-D-eMVqv1.d.mts.map → diff-database-schema-BGcRo8FM.d.mts.map} +1 -1
  72. package/dist/{diff-database-schema-_bbfF4oI-D_VmL4Ma.mjs → diff-database-schema-BYHT4ZZp-DHQM3yoO.mjs} +18 -26
  73. package/dist/diff-database-schema-BYHT4ZZp-DHQM3yoO.mjs.map +1 -0
  74. package/dist/{errors-1AjGQf6h.d.mts → errors-DZ3zQdpT.d.mts} +2 -2
  75. package/dist/{errors-1AjGQf6h.d.mts.map → errors-DZ3zQdpT.d.mts.map} +1 -1
  76. package/dist/{full-text-DZ_SB64Q.d.mts → full-text-DjD0tAqd.d.mts} +2 -2
  77. package/dist/{full-text-DZ_SB64Q.d.mts.map → full-text-DjD0tAqd.d.mts.map} +1 -1
  78. package/dist/{full-text-index-expression-525ZZWf0-HIGVQbjL.mjs → full-text-index-expression-DKwm2Z9W-CboCsz4N.mjs} +4 -4
  79. package/dist/{full-text-index-expression-525ZZWf0-HIGVQbjL.mjs.map → full-text-index-expression-DKwm2Z9W-CboCsz4N.mjs.map} +1 -1
  80. package/dist/{full-text-parsers-Cg9SDrnx-DA1eBg1b.d.mts → full-text-parsers-DinPC_86-B2P_FyTG.d.mts} +3 -3
  81. package/dist/{full-text-parsers-Cg9SDrnx-DA1eBg1b.d.mts.map → full-text-parsers-DinPC_86-B2P_FyTG.d.mts.map} +1 -1
  82. package/dist/{infer-psl-contract-Burb6YAz-DbKU4cXm.mjs → infer-psl-contract-DBWXA-jx-CmKQgKZJ.mjs} +11 -11
  83. package/dist/infer-psl-contract-DBWXA-jx-CmKQgKZJ.mjs.map +1 -0
  84. package/dist/{issue-planner-BdnqkLvV.d.mts → issue-planner-pmBrIrEN.d.mts} +7 -2
  85. package/dist/issue-planner-pmBrIrEN.d.mts.map +1 -0
  86. package/dist/{migration-D7F66l-1.d.mts → migration-D189kh3f.d.mts} +3 -3
  87. package/dist/{migration-D7F66l-1.d.mts.map → migration-D189kh3f.d.mts.map} +1 -1
  88. package/dist/migration-PTHAY9Cv.mjs.map +1 -1
  89. package/dist/{native-type-normalizer-CW6g9Fut-C5lMRRjS.mjs → native-type-normalizer-CwyVR7xB.mjs} +3 -9
  90. package/dist/native-type-normalizer-CwyVR7xB.mjs.map +1 -0
  91. package/dist/{op-factory-call-DkzlLBzN-Bc6l0sYN.mjs → op-factory-call-4IafSIKD-D2wO2iyZ.mjs} +11 -11
  92. package/dist/op-factory-call-4IafSIKD-D2wO2iyZ.mjs.map +1 -0
  93. package/dist/{op-factory-call-CaEALaar-Nh0fSxQY.d.mts → op-factory-call-CqKUB1XP-CsEGx4Jd.d.mts} +6 -5
  94. package/dist/op-factory-call-CqKUB1XP-CsEGx4Jd.d.mts.map +1 -0
  95. package/dist/op-factory-call-D5UJ7cDi.d.mts +1 -0
  96. package/dist/{operation-types-sVW52HpK.d.mts → operation-types-DfPl4yzR.d.mts} +2 -2
  97. package/dist/{operation-types-sVW52HpK.d.mts.map → operation-types-DfPl4yzR.d.mts.map} +1 -1
  98. package/dist/{pack-AqcQpXNv.d.mts → pack-Cx7B1N8w.d.mts} +6 -33
  99. package/dist/pack-Cx7B1N8w.d.mts.map +1 -0
  100. package/dist/{planner-D7lEhXHR-8Wz1p_6j.mjs → planner-BWKFZaOu--28k5rC4.mjs} +12 -10
  101. package/dist/planner-BWKFZaOu--28k5rC4.mjs.map +1 -0
  102. package/dist/{planner-DECxo-qa.d.mts → planner-CvUO8Zpn.d.mts} +2 -2
  103. package/dist/{planner-DECxo-qa.d.mts.map → planner-CvUO8Zpn.d.mts.map} +1 -1
  104. package/dist/{planner-ddl-builders-DYLyFXrj.d.mts → planner-ddl-builders-Ckcr8Ov1.d.mts} +10 -8
  105. package/dist/planner-ddl-builders-Ckcr8Ov1.d.mts.map +1 -0
  106. package/dist/planner-ddl-builders-O0JqJIBZ-x7JEHEpU.mjs +93 -0
  107. package/dist/planner-ddl-builders-O0JqJIBZ-x7JEHEpU.mjs.map +1 -0
  108. package/dist/planner-identity-values-BTYw1D7D-CzpXx1yD.mjs +72 -0
  109. package/dist/planner-identity-values-BTYw1D7D-CzpXx1yD.mjs.map +1 -0
  110. package/dist/{planner-identity-values-TfEhnoWa.d.mts → planner-identity-values-DvlFit8A.d.mts} +7 -6
  111. package/dist/planner-identity-values-DvlFit8A.d.mts.map +1 -0
  112. package/dist/{planner-produced-postgres-migration-GZTusMRD-DPb6XqDu.mjs → planner-produced-postgres-migration-B-gWwByI-Cy8tx4pu.mjs} +3 -3
  113. package/dist/{planner-produced-postgres-migration-GZTusMRD-DPb6XqDu.mjs.map → planner-produced-postgres-migration-B-gWwByI-Cy8tx4pu.mjs.map} +1 -1
  114. package/dist/planner-produced-postgres-migration-BI_aepPp.d.mts +1 -0
  115. package/dist/{planner-produced-postgres-migration-DE2Ia9Ba-hYITaAdW.d.mts → planner-produced-postgres-migration-DT3i_p3G-CyQUv3ac.d.mts} +3 -3
  116. package/dist/planner-produced-postgres-migration-DT3i_p3G-CyQUv3ac.d.mts.map +1 -0
  117. package/dist/planner-sql-checks-Cr06nK1--B3gPnC1a.mjs +47 -0
  118. package/dist/planner-sql-checks-Cr06nK1--B3gPnC1a.mjs.map +1 -0
  119. package/dist/{planner-sql-checks-CFgbRTJw.d.mts → planner-sql-checks-iNLJS1dW.d.mts} +8 -3
  120. package/dist/{planner-sql-checks-CFgbRTJw.d.mts.map → planner-sql-checks-iNLJS1dW.d.mts.map} +1 -1
  121. package/dist/{postgres-contract-view-Da0ymIZE-CBV3OE-k.mjs → postgres-contract-view-D60F8OWK-Bi5oJkOx.mjs} +12 -10
  122. package/dist/postgres-contract-view-D60F8OWK-Bi5oJkOx.mjs.map +1 -0
  123. package/dist/{postgres-migration-Dq60Mixq-DYNJokZW.mjs → postgres-migration-PLXsv15e-BruyXuKH.mjs} +21 -20
  124. package/dist/postgres-migration-PLXsv15e-BruyXuKH.mjs.map +1 -0
  125. package/dist/{postgres-migration-BCzAcFmN-Bz_I02Gc.d.mts → postgres-migration-e8UybR1y-C_m4i1jp.d.mts} +3 -3
  126. package/dist/{postgres-migration-BCzAcFmN-Bz_I02Gc.d.mts.map → postgres-migration-e8UybR1y-C_m4i1jp.d.mts.map} +1 -1
  127. package/dist/{postgres-schema-C8slJGZo-CFGUyJPt.mjs → postgres-schema-DXd0mebY-CExd_GcQ.mjs} +3 -3
  128. package/dist/{postgres-schema-C8slJGZo-CFGUyJPt.mjs.map → postgres-schema-DXd0mebY-CExd_GcQ.mjs.map} +1 -1
  129. package/dist/{prisma7-binding-Dm24YoM6.mjs → prisma7-binding-BgMvnMgz.mjs} +30 -30
  130. package/dist/prisma7-binding-BgMvnMgz.mjs.map +1 -0
  131. package/dist/{prisma7-binding-C0GpQxEQ.d.mts → prisma7-binding-D2guML1e.d.mts} +8 -35
  132. package/dist/prisma7-binding-D2guML1e.d.mts.map +1 -0
  133. package/dist/{resolve-ddl-schema-Bq4m2dD9-DrlUipYU.mjs → resolve-ddl-schema-CadTChyu-C7F31wpN.mjs} +3 -3
  134. package/dist/{resolve-ddl-schema-Bq4m2dD9-DrlUipYU.mjs.map → resolve-ddl-schema-CadTChyu-C7F31wpN.mjs.map} +1 -1
  135. package/dist/{runtime-4QFzvcCp.d.mts → runtime-aejvKbMy.d.mts} +2 -2
  136. package/dist/{runtime-4QFzvcCp.d.mts.map → runtime-aejvKbMy.d.mts.map} +1 -1
  137. package/dist/{sql-renderer-CgUgFbU4-BY3PCrmG.mjs → sql-renderer-BjJ3MLnI-DQvfiMO6.mjs} +45 -43
  138. package/dist/sql-renderer-BjJ3MLnI-DQvfiMO6.mjs.map +1 -0
  139. package/dist/{sql-renderer-Bd07vbru.d.mts → sql-renderer-D6UgvbqG.d.mts} +6 -5
  140. package/dist/sql-renderer-D6UgvbqG.d.mts.map +1 -0
  141. package/dist/{sql-utils-Bh-mnsSY-D6hnFPrP.mjs → sql-utils-BMXJi06b-CAQOplfq.mjs} +178 -3
  142. package/dist/sql-utils-BMXJi06b-CAQOplfq.mjs.map +1 -0
  143. package/dist/target.d.mts +27 -27
  144. package/dist/target.mjs +28 -28
  145. package/dist/target__codec-descriptor.d.mts +2 -2
  146. package/dist/target__codec-descriptor.mjs +1 -1
  147. package/dist/target__codec-types.d.mts +3 -3
  148. package/dist/target__codecs.d.mts +3 -3
  149. package/dist/target__codecs.mjs +3 -3
  150. package/dist/target__contract-free.mjs +3 -3
  151. package/dist/target__control.d.mts +2 -2
  152. package/dist/target__control.mjs +4 -4
  153. package/dist/target__data-types.d.mts +2 -2
  154. package/dist/target__data-types.mjs +3 -3
  155. package/dist/target__default-normalizer.mjs +1 -1
  156. package/dist/target__diff-database-schema.d.mts +1 -1
  157. package/dist/target__diff-database-schema.mjs +1 -1
  158. package/dist/target__errors.d.mts +1 -1
  159. package/dist/target__full-text.d.mts +2 -2
  160. package/dist/target__issue-planner.d.mts +1 -1
  161. package/dist/target__issue-planner.mjs +1 -1
  162. package/dist/target__migration.d.mts +2 -2
  163. package/dist/target__migration.mjs +2 -2
  164. package/dist/target__native-type-normalizer.mjs +1 -1
  165. package/dist/target__op-factory-call.d.mts +2 -2
  166. package/dist/target__op-factory-call.mjs +1 -1
  167. package/dist/target__operation-types.d.mts +1 -1
  168. package/dist/target__pack.d.mts +1 -1
  169. package/dist/target__pack.mjs +1 -1
  170. package/dist/target__planner-ddl-builders.d.mts +2 -2
  171. package/dist/target__planner-ddl-builders.mjs +1 -1
  172. package/dist/target__planner-identity-values.d.mts +1 -1
  173. package/dist/target__planner-identity-values.mjs +1 -1
  174. package/dist/target__planner-produced-postgres-migration.d.mts +2 -2
  175. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  176. package/dist/target__planner-sql-checks.d.mts +1 -1
  177. package/dist/target__planner-sql-checks.mjs +1 -1
  178. package/dist/target__planner.d.mts +1 -1
  179. package/dist/target__planner.mjs +2 -2
  180. package/dist/target__prisma7-binding.d.mts +1 -1
  181. package/dist/target__prisma7-binding.mjs +1 -1
  182. package/dist/target__runtime.mjs +3 -3
  183. package/dist/target__runtime.mjs.map +1 -1
  184. package/dist/target__schema-ir-annotations.mjs +1 -1
  185. package/dist/target__sql-utils.mjs +2 -2
  186. package/dist/target__types.mjs +2 -2
  187. package/dist/{types-BPubHbiE-BzhJ05fG.d.mts → types-D6lgKhE5-Cu48rrw9.d.mts} +7 -4
  188. package/dist/types-D6lgKhE5-Cu48rrw9.d.mts.map +1 -0
  189. package/dist/types-LTOC-zv8.d.mts +2 -0
  190. package/package.json +9 -9
  191. package/dist/adapter-BNrSLsxC-CXrTrSvP.mjs.map +0 -1
  192. package/dist/adapter-DzNbNJ24.d.mts.map +0 -1
  193. package/dist/authoring-C5Ch8RNG-Qgq9GiOY.mjs.map +0 -1
  194. package/dist/codec-descriptor-B61d-k4C-BdWVU6Fu.mjs.map +0 -1
  195. package/dist/codec-descriptor-D8_e5hpo.d.mts +0 -1
  196. package/dist/codec-descriptor-HYqjI24K-CTO3gTEs.d.mts.map +0 -1
  197. package/dist/codec-helpers-BmUrP6U9-DuO9gpqZ.mjs.map +0 -1
  198. package/dist/codec-types-Diyz6muR.d.mts +0 -2
  199. package/dist/codecs-BU-eLMQi-BB2afWsO.d.mts.map +0 -1
  200. package/dist/codecs-CWXNVl1P.mjs.map +0 -1
  201. package/dist/codecs-CnbVrlil--FxLKWM5.mjs.map +0 -1
  202. package/dist/codecs-DxqbAhl0.d.mts.map +0 -1
  203. package/dist/contract-free-DeK6m1dy.mjs.map +0 -1
  204. package/dist/control-CyiVFspE.mjs.map +0 -1
  205. package/dist/control-D7_yfEfH.d.mts +0 -402
  206. package/dist/control-D7_yfEfH.d.mts.map +0 -1
  207. package/dist/control-adapter-Du0EcG5G-CT4qBFrG.mjs.map +0 -1
  208. package/dist/control-policy-BW5Cgq3Z-Dn2ZVBCP.mjs.map +0 -1
  209. package/dist/control-xWtRBAPw.d.mts.map +0 -1
  210. package/dist/data-type-entries-cjspFU7A-BBOIqLij.mjs.map +0 -1
  211. package/dist/data-types-BGsYeBpf-B_5bvuEe.mjs +0 -200
  212. package/dist/data-types-BGsYeBpf-B_5bvuEe.mjs.map +0 -1
  213. package/dist/data-types-DZGKP-qZ.d.mts +0 -47
  214. package/dist/data-types-DZGKP-qZ.d.mts.map +0 -1
  215. package/dist/descriptor-meta-BEigA5Gj-eY7nV4N_.mjs.map +0 -1
  216. package/dist/descriptor-meta-Bvq6_NJ8-Cn_M79Lf.mjs.map +0 -1
  217. package/dist/descriptor-meta-runtime-UwYdV8fD-B_m_Ha8r.mjs.map +0 -1
  218. package/dist/diff-database-schema-_bbfF4oI-D_VmL4Ma.mjs.map +0 -1
  219. package/dist/infer-psl-contract-Burb6YAz-DbKU4cXm.mjs.map +0 -1
  220. package/dist/issue-planner-BdnqkLvV.d.mts.map +0 -1
  221. package/dist/native-type-normalizer-CW6g9Fut-C5lMRRjS.mjs.map +0 -1
  222. package/dist/op-factory-call-CaEALaar-Nh0fSxQY.d.mts.map +0 -1
  223. package/dist/op-factory-call-DVz_g8zS.d.mts +0 -1
  224. package/dist/op-factory-call-DkzlLBzN-Bc6l0sYN.mjs.map +0 -1
  225. package/dist/pack-AqcQpXNv.d.mts.map +0 -1
  226. package/dist/planner-D7lEhXHR-8Wz1p_6j.mjs.map +0 -1
  227. package/dist/planner-ddl-builders-BZLzBmuq-BrpA53eH.mjs +0 -128
  228. package/dist/planner-ddl-builders-BZLzBmuq-BrpA53eH.mjs.map +0 -1
  229. package/dist/planner-ddl-builders-DYLyFXrj.d.mts.map +0 -1
  230. package/dist/planner-identity-values-BmHn5C6U-BYBbUAyR.mjs +0 -90
  231. package/dist/planner-identity-values-BmHn5C6U-BYBbUAyR.mjs.map +0 -1
  232. package/dist/planner-identity-values-TfEhnoWa.d.mts.map +0 -1
  233. package/dist/planner-produced-postgres-migration-BMfo2BlI.d.mts +0 -1
  234. package/dist/planner-produced-postgres-migration-DE2Ia9Ba-hYITaAdW.d.mts.map +0 -1
  235. package/dist/planner-sql-checks-Bxz8yvg8-Bj6jGClB.mjs +0 -192
  236. package/dist/planner-sql-checks-Bxz8yvg8-Bj6jGClB.mjs.map +0 -1
  237. package/dist/planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs +0 -15
  238. package/dist/planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs.map +0 -1
  239. package/dist/postgres-contract-view-Da0ymIZE-CBV3OE-k.mjs.map +0 -1
  240. package/dist/postgres-migration-Dq60Mixq-DYNJokZW.mjs.map +0 -1
  241. package/dist/prisma7-binding-C0GpQxEQ.d.mts.map +0 -1
  242. package/dist/prisma7-binding-Dm24YoM6.mjs.map +0 -1
  243. package/dist/sql-renderer-Bd07vbru.d.mts.map +0 -1
  244. package/dist/sql-renderer-CgUgFbU4-BY3PCrmG.mjs.map +0 -1
  245. package/dist/sql-utils-Bh-mnsSY-D6hnFPrP.mjs.map +0 -1
  246. package/dist/types-BPubHbiE-BzhJ05fG.d.mts.map +0 -1
  247. package/dist/types-DQ5Lh5JL.d.mts +0 -2
@@ -1,54 +1,53 @@
1
- import { o as isPgEnumParams } from "./codecs-CnbVrlil--FxLKWM5.mjs";
2
- import { i as quoteQualifiedName, r as quoteIdentifier, t as escapeLiteral } from "./sql-utils-Bh-mnsSY-D6hnFPrP.mjs";
1
+ import { r as quoteIdentifier, t as escapeLiteral } from "./sql-utils-BMXJi06b-CAQOplfq.mjs";
2
+ import { A as pgTimestamptz, E as pgTime, I as pgVarbit, L as pgVarchar, M as pgTimetz, O as pgTimestamp, _ as pgInt8, f as pgFloat4, g as pgInt4, h as pgInt2, i as pgBool, n as pgBit, o as pgChar, p as pgFloat8, v as pgInterval, w as pgText, x as pgNumeric } from "./data-types-DzUVlWeo-CBMHoFoH.mjs";
3
3
  import { LiteralExpr, collectOrderedParamRefs } from "@prisma/orm-family-sql/relational-core/ast";
4
4
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
5
+ import { dataTypeParams, sqlBaseName, sqlDataTypeOfCodec } from "@prisma/orm-family-sql/contract/data-type";
5
6
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
6
7
  import { InternalError, assertNever } from "@prisma/orm-framework/utils/internal-error";
8
+ import { isPlainRecord } from "@prisma/orm-framework/contract/is-plain-record";
7
9
  import { runtimeError } from "@prisma/orm-framework/components/runtime";
8
- //#region ../../../3-targets/6-adapters/postgres/dist/sql-renderer-CgUgFbU4.mjs
10
+ //#region ../../../3-targets/6-adapters/postgres/dist/sql-renderer-BjJ3MLnI.mjs
9
11
  function adapterError(code, message, options) {
10
12
  return structuredError(code, message, options);
11
13
  }
12
14
  /**
13
- * Postgres native types whose unknown-OID parameter inference is reliable in arbitrary expression positions. Parameters bound to a descriptor whose `nativeTypeFor` result falls in this set are emitted as plain `$N`; everything else (including `json`, `jsonb`, extension types like `vector`, and unknown user types) is emitted as `$N::<nativeType>` so the planner picks an unambiguous overload.
15
+ * Data types whose unknown-OID parameter inference is reliable in arbitrary expression positions. A parameter whose codec represents one of these is emitted as plain `$N`; everything else (including `pg/json`, `pg/jsonb`, extension types like `pgvector/vector`, and enums) is emitted as `$N::<base name>` so the planner picks an unambiguous overload.
14
16
  *
15
- * `json` / `jsonb` are intentionally excluded despite being Postgres builtins: their operator overloads make context inference unreliable in expression positions (e.g. `$1 -> 'key'` is ambiguous between the two).
16
- *
17
- * Spellings match the target descriptors' `nativeTypeFor` results, not the `udt_name` abbreviations that ADR 205 used as illustrative shorthand. The registry-based cast policy compares against these strings directly.
17
+ * `pg/json` / `pg/jsonb` are intentionally excluded: their operator overloads make context inference unreliable in expression positions (e.g. `$1 -> 'key'` is ambiguous between the two).
18
18
  */
19
- const POSTGRES_INFERRABLE_NATIVE_TYPES = /* @__PURE__ */ new Set([
20
- "integer",
21
- "smallint",
22
- "bigint",
23
- "real",
24
- "double precision",
25
- "numeric",
26
- "boolean",
27
- "text",
28
- "character",
29
- "character varying",
30
- "timestamp",
31
- "timestamp without time zone",
32
- "timestamp with time zone",
33
- "time",
34
- "timetz",
35
- "interval",
36
- "bit",
37
- "bit varying"
19
+ const POSTGRES_INFERRABLE_DATA_TYPES = /* @__PURE__ */ new Set([
20
+ pgInt2.id,
21
+ pgInt4.id,
22
+ pgInt8.id,
23
+ pgFloat4.id,
24
+ pgFloat8.id,
25
+ pgNumeric.id,
26
+ pgBool.id,
27
+ pgText.id,
28
+ pgChar.id,
29
+ pgVarchar.id,
30
+ pgTimestamp.id,
31
+ pgTimestamptz.id,
32
+ pgTime.id,
33
+ pgTimetz.id,
34
+ pgInterval.id,
35
+ pgBit.id,
36
+ pgVarbit.id
38
37
  ]);
39
- function renderTypedParam(index, codecId, codecDescriptorRegistry, many, typeParams, forceCast = false) {
38
+ /**
39
+ * A parameter's cast names its data type's base name, never its parameters: an explicit cast to
40
+ * `varchar(n)` truncates and to `numeric(p,s)` rounds.
41
+ */
42
+ function renderTypedParam(index, codecId, types, many, typeParams, forceCast = false) {
40
43
  if (codecId === void 0) return `$${index}`;
41
- const descriptor = codecDescriptorRegistry.descriptorFor(codecId);
42
- if (descriptor === void 0) throw adapterError("RUNTIME.PARAM_REF_MISSING_CODEC", `Postgres lowering: ParamRef carries codecId "${codecId}" but the validated PostgreSQL codec registry has no entry for it. This usually indicates a missing extension pack in the runtime stack — register the pack that contributes this codec (e.g. \`extensions: [pgvectorRuntime]\`), or use the codec directly from \`@internal/target-postgres/codecs\` if it's a builtin.`, { meta: { codecId } });
43
- const ref = {
44
- codecId,
45
- ...ifDefined("many", many),
46
- ...ifDefined("typeParams", typeParams)
47
- };
48
- const nativeType = descriptor.nativeTypeFor(ref);
44
+ if (types.codecDescriptorRegistry.descriptorFor(codecId) === void 0) throw adapterError("RUNTIME.PARAM_REF_MISSING_CODEC", `Postgres lowering: ParamRef carries codecId "${codecId}" but the validated PostgreSQL codec registry has no entry for it. This usually indicates a missing extension pack in the runtime stack — register the pack that contributes this codec (e.g. \`extensions: [pgvectorRuntime]\`), or use the codec directly from \`@internal/target-postgres/codecs\` if it's a builtin.`, { meta: { codecId } });
45
+ const dataType = sqlDataTypeOfCodec(codecId, {
46
+ codecLookup: types.codecDescriptorRegistry,
47
+ dataTypeLookup: types.dataTypeLookup
48
+ });
49
49
  const arraySuffix = many ? "[]" : "";
50
- if (isPgEnumParams(typeParams)) return `$${index}::${quoteQualifiedName(nativeType)}${arraySuffix}`;
51
- if (forceCast || !POSTGRES_INFERRABLE_NATIVE_TYPES.has(nativeType) || many) return `$${index}::${nativeType}${arraySuffix}`;
50
+ if (forceCast || !POSTGRES_INFERRABLE_DATA_TYPES.has(dataType.id) || many) return `$${index}::${sqlBaseName(dataType, dataTypeParams(dataType, isPlainRecord(typeParams) ? typeParams : void 0))}${arraySuffix}`;
52
51
  return `$${index}`;
53
52
  }
54
53
  function unreachableKind(value) {
@@ -61,7 +60,7 @@ function unreachableKind(value) {
61
60
  *
62
61
  * Shared between the runtime (`PostgresAdapterImpl.lower`) and control (`PostgresControlAdapter.lower`) entrypoints so emit-time and run-time paths produce byte-identical output for the same AST.
63
62
  */
64
- function renderLoweredSql(ast, contract, codecDescriptorRegistry) {
63
+ function renderLoweredSql(ast, contract, codecDescriptorRegistry, dataTypeLookup) {
65
64
  const orderedRefs = collectOrderedParamRefs(ast);
66
65
  const indexMap = /* @__PURE__ */ new Map();
67
66
  const params = orderedRefs.map((ref, i) => {
@@ -76,7 +75,10 @@ function renderLoweredSql(ast, contract, codecDescriptorRegistry) {
76
75
  });
77
76
  const pim = {
78
77
  indexMap,
79
- codecDescriptorRegistry
78
+ types: {
79
+ codecDescriptorRegistry,
80
+ dataTypeLookup
81
+ }
80
82
  };
81
83
  const node = ast;
82
84
  let sql;
@@ -309,7 +311,7 @@ function renderJsonValueProjection(projection, contract, pim) {
309
311
  });
310
312
  }
311
313
  function projectJsonThroughCodec(value, codec, pim) {
312
- const descriptor = pim.codecDescriptorRegistry.descriptorFor(codec.codecId);
314
+ const descriptor = pim.types.codecDescriptorRegistry.descriptorFor(codec.codecId);
313
315
  if (descriptor === void 0) throw adapterError("RUNTIME.PARAM_REF_MISSING_CODEC", `Postgres lowering: a JSON projection carries codecId "${codec.codecId}" but the validated PostgreSQL codec registry has no entry for it. This usually indicates a missing extension pack in the runtime stack — register the pack that contributes this codec (e.g. \`extensions: [pgvectorRuntime]\`), or use the codec directly from \`@internal/target-postgres/codecs\` if it's a builtin.`, { meta: { codecId: codec.codecId } });
314
316
  return descriptor.projectJson(value, codec);
315
317
  }
@@ -374,12 +376,12 @@ function renderExpr(expr, contract, pim) {
374
376
  function renderParamRef(ref, pim, forceCast = false) {
375
377
  const index = pim.indexMap.get(ref);
376
378
  if (index === void 0) throw new InternalError("ParamRef not found in index map");
377
- if (ref.kind === "prepared-param-ref") return renderTypedParam(index, ref.codec.codecId, pim.codecDescriptorRegistry, ref.codec.many, ref.codec.typeParams, forceCast);
379
+ if (ref.kind === "prepared-param-ref") return renderTypedParam(index, ref.codec.codecId, pim.types, ref.codec.many, ref.codec.typeParams, forceCast);
378
380
  if (ref.codec === void 0) throw runtimeError("RUNTIME.PARAM_REF_MISSING_CODEC", "Postgres renderer: ParamRef reached lowering without a bound CodecRef. Every column-bound ParamRef must carry a codec under the AST-bound codec contract. This usually indicates a builder path that constructed a ParamRef without threading the column codec.", {
379
381
  paramIndex: index,
380
382
  ...ifDefined("name", ref.name)
381
383
  });
382
- return renderTypedParam(index, ref.codec.codecId, pim.codecDescriptorRegistry, ref.codec.many, ref.codec.typeParams);
384
+ return renderTypedParam(index, ref.codec.codecId, pim.types, ref.codec.many, ref.codec.typeParams);
383
385
  }
384
386
  function renderLiteral(expr) {
385
387
  if (typeof expr.value === "string") return `'${escapeLiteral(expr.value)}'`;
@@ -513,4 +515,4 @@ function renderRawExpr(node, contract, pim) {
513
515
  //#endregion
514
516
  export { renderLoweredSql as n, adapterError as t };
515
517
 
516
- //# sourceMappingURL=sql-renderer-CgUgFbU4-BY3PCrmG.mjs.map
518
+ //# sourceMappingURL=sql-renderer-BjJ3MLnI-DQvfiMO6.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sql-renderer-BjJ3MLnI-DQvfiMO6.mjs","names":[],"sources":["../../../../3-targets/6-adapters/postgres/dist/sql-renderer-BjJ3MLnI.mjs"],"sourcesContent":["import { LiteralExpr, collectOrderedParamRefs } from \"@internal/sql-relational-core/ast\";\nimport { pgBit, pgBool, pgChar, pgFloat4, pgFloat8, pgInt2, pgInt4, pgInt8, pgInterval, pgNumeric, pgText, pgTime, pgTimestamp, pgTimestamptz, pgTimetz, pgVarbit, pgVarchar } from \"@internal/target-postgres/data-types\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { escapeLiteral, quoteIdentifier } from \"@internal/target-postgres/sql-utils\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError, assertNever } from \"@internal/utils/internal-error\";\nimport { isPlainRecord } from \"@internal/contract/is-plain-record\";\nimport { runtimeError } from \"@internal/framework-components/runtime\";\nimport { dataTypeParams, sqlBaseName, sqlDataTypeOfCodec } from \"@internal/sql-contract/data-type\";\n//#region src/core/adapter-errors.ts\nfunction adapterError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/core/sql-renderer.ts\n/**\n* Data types whose unknown-OID parameter inference is reliable in arbitrary expression positions. A parameter whose codec represents one of these is emitted as plain `$N`; everything else (including `pg/json`, `pg/jsonb`, extension types like `pgvector/vector`, and enums) is emitted as `$N::<base name>` so the planner picks an unambiguous overload.\n*\n* `pg/json` / `pg/jsonb` are intentionally excluded: their operator overloads make context inference unreliable in expression positions (e.g. `$1 -> 'key'` is ambiguous between the two).\n*/\nconst POSTGRES_INFERRABLE_DATA_TYPES = /* @__PURE__ */ new Set([\n\tpgInt2.id,\n\tpgInt4.id,\n\tpgInt8.id,\n\tpgFloat4.id,\n\tpgFloat8.id,\n\tpgNumeric.id,\n\tpgBool.id,\n\tpgText.id,\n\tpgChar.id,\n\tpgVarchar.id,\n\tpgTimestamp.id,\n\tpgTimestamptz.id,\n\tpgTime.id,\n\tpgTimetz.id,\n\tpgInterval.id,\n\tpgBit.id,\n\tpgVarbit.id\n]);\n/**\n* A parameter's cast names its data type's base name, never its parameters: an explicit cast to\n* `varchar(n)` truncates and to `numeric(p,s)` rounds.\n*/\nfunction renderTypedParam(index, codecId, types, many, typeParams, forceCast = false) {\n\tif (codecId === void 0) return `$${index}`;\n\tif (types.codecDescriptorRegistry.descriptorFor(codecId) === void 0) throw adapterError(\"RUNTIME.PARAM_REF_MISSING_CODEC\", `Postgres lowering: ParamRef carries codecId \"${codecId}\" but the validated PostgreSQL codec registry has no entry for it. This usually indicates a missing extension pack in the runtime stack — register the pack that contributes this codec (e.g. \\`extensions: [pgvectorRuntime]\\`), or use the codec directly from \\`@internal/target-postgres/codecs\\` if it's a builtin.`, { meta: { codecId } });\n\tconst dataType = sqlDataTypeOfCodec(codecId, {\n\t\tcodecLookup: types.codecDescriptorRegistry,\n\t\tdataTypeLookup: types.dataTypeLookup\n\t});\n\tconst arraySuffix = many ? \"[]\" : \"\";\n\tif (forceCast || !POSTGRES_INFERRABLE_DATA_TYPES.has(dataType.id) || many) return `$${index}::${sqlBaseName(dataType, dataTypeParams(dataType, isPlainRecord(typeParams) ? typeParams : void 0))}${arraySuffix}`;\n\treturn `$${index}`;\n}\nfunction unreachableKind(value) {\n\tconst candidate = value;\n\tif (typeof candidate === \"object\" && candidate !== null && \"kind\" in candidate && typeof candidate.kind === \"string\") return candidate.kind;\n\treturn \"unknown\";\n}\n/**\n* Render a SQL query AST to a Postgres-flavored `{ sql, params }` payload.\n*\n* Shared between the runtime (`PostgresAdapterImpl.lower`) and control (`PostgresControlAdapter.lower`) entrypoints so emit-time and run-time paths produce byte-identical output for the same AST.\n*/\nfunction renderLoweredSql(ast, contract, codecDescriptorRegistry, dataTypeLookup) {\n\tconst orderedRefs = collectOrderedParamRefs(ast);\n\tconst indexMap = /* @__PURE__ */ new Map();\n\tconst params = orderedRefs.map((ref, i) => {\n\t\tindexMap.set(ref, i + 1);\n\t\treturn ref.kind === \"prepared-param-ref\" ? {\n\t\t\tkind: \"bind\",\n\t\t\tname: ref.name\n\t\t} : {\n\t\t\tkind: \"literal\",\n\t\t\tvalue: ref.value\n\t\t};\n\t});\n\tconst pim = {\n\t\tindexMap,\n\t\ttypes: {\n\t\t\tcodecDescriptorRegistry,\n\t\t\tdataTypeLookup\n\t\t}\n\t};\n\tconst node = ast;\n\tlet sql;\n\tswitch (node.kind) {\n\t\tcase \"select\":\n\t\t\tsql = renderSelect(node, contract, pim);\n\t\t\tbreak;\n\t\tcase \"insert\":\n\t\t\tsql = renderInsert(node, contract, pim);\n\t\t\tbreak;\n\t\tcase \"update\":\n\t\t\tsql = renderUpdate(node, contract, pim);\n\t\t\tbreak;\n\t\tcase \"delete\":\n\t\t\tsql = renderDelete(node, contract, pim);\n\t\t\tbreak;\n\t\tcase \"raw-query\":\n\t\t\tsql = renderParts(node.parts, contract, pim);\n\t\t\tbreak;\n\t\t// v8 ignore next 4\n\t\tdefault: assertNever(node, `Unsupported AST node kind: ${unreachableKind(node)}`);\n\t}\n\treturn Object.freeze({\n\t\tsql,\n\t\tparams: Object.freeze(params)\n\t});\n}\nfunction renderLimitOffset(keyword, value, contract, pim) {\n\tif (value === void 0) return \"\";\n\tif (typeof value === \"number\") return `${keyword} ${value}`;\n\treturn `${keyword} ${renderExpr(value, contract, pim)}`;\n}\nfunction renderSelect(ast, contract, pim) {\n\treturn [\n\t\t`SELECT ${renderDistinctPrefix(ast.distinct, ast.distinctOn, contract, pim)}${renderProjection(ast.projection, contract, pim)}`,\n\t\tast.from !== void 0 ? `FROM ${renderSource(ast.from, contract, pim)}` : \"\",\n\t\tast.joins?.length ? ast.joins.map((join) => renderJoin(join, contract, pim)).join(\" \") : \"\",\n\t\tast.where ? `WHERE ${renderWhere(ast.where, contract, pim)}` : \"\",\n\t\tast.groupBy?.length ? `GROUP BY ${ast.groupBy.map((expr) => renderExpr(expr, contract, pim)).join(\", \")}` : \"\",\n\t\tast.having ? `HAVING ${renderWhere(ast.having, contract, pim)}` : \"\",\n\t\tast.orderBy?.length ? `ORDER BY ${renderOrderByItems(ast.orderBy, contract, pim)}` : \"\",\n\t\trenderLimitOffset(\"LIMIT\", ast.limit, contract, pim),\n\t\trenderLimitOffset(\"OFFSET\", ast.offset, contract, pim)\n\t].filter((part) => part.length > 0).join(\" \").trim();\n}\nfunction renderProjection(projection, contract, pim) {\n\treturn projection.map((item) => {\n\t\tconst alias = quoteIdentifier(item.alias);\n\t\tif (item.expr.kind === \"literal\") return `${renderLiteral(item.expr)} AS ${alias}`;\n\t\tif (item.expr.kind === \"prepared-param-ref\") return `${renderParamRef(item.expr, pim, true)} AS ${alias}`;\n\t\treturn `${renderExpr(item.expr, contract, pim)} AS ${alias}`;\n\t}).join(\", \");\n}\nfunction renderReturning(items, contract, pim) {\n\treturn items.map((item) => {\n\t\tif (item.expr.kind === \"column-ref\") {\n\t\t\tconst rendered = renderColumn(item.expr);\n\t\t\treturn item.expr.column === item.alias ? rendered : `${rendered} AS ${quoteIdentifier(item.alias)}`;\n\t\t}\n\t\tif (item.expr.kind === \"literal\") return `${renderLiteral(item.expr)} AS ${quoteIdentifier(item.alias)}`;\n\t\treturn `${renderExpr(item.expr, contract, pim)} AS ${quoteIdentifier(item.alias)}`;\n\t}).join(\", \");\n}\nfunction renderDistinctPrefix(distinct, distinctOn, contract, pim) {\n\tif (distinctOn && distinctOn.length > 0) return `DISTINCT ON (${distinctOn.map((expr) => renderExpr(expr, contract, pim)).join(\", \")}) `;\n\tif (distinct) return \"DISTINCT \";\n\treturn \"\";\n}\nfunction hasExplicitSchema(table) {\n\treturn \"schema\" in table && typeof table.schema === \"string\";\n}\nfunction qualifyTableFromNamespaceCoordinate(table, contract) {\n\tif (hasExplicitSchema(table)) return `${quoteIdentifier(table.schema)}.${quoteIdentifier(table.name)}`;\n\tif (table.namespaceId === void 0) return quoteIdentifier(table.name);\n\tconst namespace = contract.storage.namespaces[table.namespaceId];\n\tif (namespace === void 0) throw adapterError(\"RUNTIME.NAMESPACE_UNKNOWN\", `Table \"${table.name}\" references namespace \"${table.namespaceId}\" which is not present as a Postgres schema on the contract`, { meta: {\n\t\ttable: table.name,\n\t\tnamespaceId: table.namespaceId,\n\t\treason: \"not-present\"\n\t} });\n\tconst qualifyTable = namespace.qualifyTable;\n\tif (qualifyTable === void 0) throw adapterError(\"RUNTIME.NAMESPACE_UNKNOWN\", `Table \"${table.name}\" references namespace \"${table.namespaceId}\" which is not materialised as a Postgres schema on the contract`, { meta: {\n\t\ttable: table.name,\n\t\tnamespaceId: table.namespaceId,\n\t\treason: \"not-materialised\"\n\t} });\n\treturn qualifyTable.call(namespace, table.name);\n}\nfunction renderTableSource(source, contract) {\n\tconst qualified = qualifyTableFromNamespaceCoordinate(source, contract);\n\tif (!source.alias) return qualified;\n\treturn `${qualified} AS ${quoteIdentifier(source.alias)}`;\n}\nfunction renderSource(source, contract, pim) {\n\tconst node = source;\n\tswitch (node.kind) {\n\t\tcase \"table-source\": return renderTableSource(node, contract);\n\t\tcase \"derived-table-source\": return `(${renderSelect(node.query, contract, pim)}) AS ${quoteIdentifier(node.alias)}`;\n\t\tcase \"function-source\": {\n\t\t\tconst args = node.args.map((arg) => renderExpr(arg, contract, pim)).join(\", \");\n\t\t\treturn `${`${node.fn}(${args})`}${node.ordinality ? \" WITH ORDINALITY\" : \"\"}${node.alias === void 0 ? \"\" : ` AS ${quoteIdentifier(node.alias)}`}${node.columnAliases === void 0 ? \"\" : `(${node.columnAliases.map((column) => quoteIdentifier(column)).join(\", \")})`}`;\n\t\t}\n\t\t// v8 ignore next 4\n\t\tdefault: assertNever(node, `Unsupported source node kind: ${unreachableKind(node)}`);\n\t}\n}\nfunction assertScalarSubquery(query) {\n\tif (query.projection.length !== 1) throw adapterError(\"RUNTIME.AST_INVALID\", \"Subquery expressions must project exactly one column\", { meta: { node: \"subquery-expr\" } });\n}\nfunction renderSubqueryExpr(expr, contract, pim) {\n\tassertScalarSubquery(expr.query);\n\treturn `(${renderSelect(expr.query, contract, pim)})`;\n}\nfunction renderWhere(expr, contract, pim) {\n\treturn renderExpr(expr, contract, pim);\n}\nfunction renderNullCheck(expr, contract, pim) {\n\tconst rendered = renderExpr(expr.expr, contract, pim);\n\tconst renderedExpr = isAtomicExpressionKind(expr.expr.kind) ? rendered : `(${rendered})`;\n\treturn expr.isNull ? `${renderedExpr} IS NULL` : `${renderedExpr} IS NOT NULL`;\n}\n/**\n* Atomic expression kinds whose rendered SQL is already self-delimited (a column reference, parameter, literal, function call, aggregate, etc.) and therefore does not need surrounding parentheses when used as the left operand of a postfix predicate like `IS NULL` or `IS NOT NULL`, or as either operand of a binary infix operator.\n*\n* Anything not in this set is treated as composite (binary, AND/OR/NOT, EXISTS, nested IS NULL, subqueries, operation templates) and gets wrapped to preserve grouping.\n*/\nfunction isAtomicExpressionKind(kind) {\n\tswitch (kind) {\n\t\tcase \"column-ref\":\n\t\tcase \"identifier-ref\":\n\t\tcase \"param-ref\":\n\t\tcase \"prepared-param-ref\":\n\t\tcase \"literal\":\n\t\tcase \"aggregate\":\n\t\tcase \"window-func\":\n\t\tcase \"function-call\":\n\t\tcase \"cast\":\n\t\tcase \"case\":\n\t\tcase \"json-object\":\n\t\tcase \"json-array-agg\":\n\t\tcase \"list\": return true;\n\t\tcase \"subquery\":\n\t\tcase \"operation\":\n\t\tcase \"binary\":\n\t\tcase \"and\":\n\t\tcase \"or\":\n\t\tcase \"exists\":\n\t\tcase \"null-check\":\n\t\tcase \"not\":\n\t\tcase \"raw-expr\": return false;\n\t}\n}\nfunction renderBinary(expr, contract, pim) {\n\tif (expr.right.kind === \"list\" && expr.right.values.length === 0) {\n\t\tif (expr.op === \"in\") return \"FALSE\";\n\t\tif (expr.op === \"notIn\") return \"TRUE\";\n\t}\n\tconst leftExpr = expr.left;\n\tconst left = renderExpr(leftExpr, contract, pim);\n\tconst leftRendered = leftExpr.kind === \"operation\" || leftExpr.kind === \"subquery\" ? `(${left})` : left;\n\tconst rightNode = expr.right;\n\tlet right;\n\tswitch (rightNode.kind) {\n\t\tcase \"list\":\n\t\t\tright = renderListLiteral(rightNode, contract, pim);\n\t\t\tbreak;\n\t\tcase \"literal\":\n\t\t\tright = renderLiteral(rightNode);\n\t\t\tbreak;\n\t\tcase \"column-ref\":\n\t\t\tright = renderColumn(rightNode);\n\t\t\tbreak;\n\t\tcase \"param-ref\":\n\t\tcase \"prepared-param-ref\":\n\t\t\tright = renderParamRef(rightNode, pim);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tright = renderExpr(rightNode, contract, pim);\n\t\t\tbreak;\n\t}\n\treturn `${leftRendered} ${{\n\t\teq: \"=\",\n\t\tneq: \"!=\",\n\t\tisNotDistinctFrom: \"IS NOT DISTINCT FROM\",\n\t\tisDistinctFrom: \"IS DISTINCT FROM\",\n\t\tgt: \">\",\n\t\tlt: \"<\",\n\t\tgte: \">=\",\n\t\tlte: \"<=\",\n\t\tlike: \"LIKE\",\n\t\tin: \"IN\",\n\t\tnotIn: \"NOT IN\"\n\t}[expr.op]} ${right}`;\n}\nfunction renderListLiteral(expr, contract, pim) {\n\tif (expr.values.length === 0) return \"(NULL)\";\n\treturn `(${expr.values.map((v) => {\n\t\tif (v.kind === \"param-ref\" || v.kind === \"prepared-param-ref\") return renderParamRef(v, pim);\n\t\tif (v.kind === \"literal\") return renderLiteral(v);\n\t\treturn renderExpr(v, contract, pim);\n\t}).join(\", \")})`;\n}\nfunction renderColumn(ref) {\n\tif (ref.table === \"excluded\") return `excluded.${quoteIdentifier(ref.column)}`;\n\treturn `${quoteIdentifier(ref.table)}.${quoteIdentifier(ref.column)}`;\n}\nfunction renderAggregateExpr(expr, contract, pim) {\n\tconst fn = expr.fn.toUpperCase();\n\tif (!expr.expr) return `${fn}(*)`;\n\treturn `${fn}(${renderExpr(expr.expr, contract, pim)})`;\n}\nfunction renderWindowFuncExpr(expr, contract, pim) {\n\treturn `${expr.fn.toUpperCase()}(${expr.args.map((arg) => renderExpr(arg, contract, pim)).join(\", \")}) OVER (${[expr.partitionBy && expr.partitionBy.length > 0 ? `PARTITION BY ${expr.partitionBy.map((e) => renderExpr(e, contract, pim)).join(\", \")}` : \"\", expr.orderBy && expr.orderBy.length > 0 ? `ORDER BY ${renderOrderByItems(expr.orderBy, contract, pim)}` : \"\"].filter((part) => part.length > 0).join(\" \")})`;\n}\nfunction renderFunctionCallExpr(expr, contract, pim) {\n\tconst args = expr.args.map((arg) => renderExpr(arg, contract, pim)).join(\", \");\n\treturn `${expr.fn}(${args})`;\n}\nfunction renderCastExpr(expr, contract, pim) {\n\treturn `CAST(${renderExpr(expr.expr, contract, pim)} AS ${expr.targetType})`;\n}\nfunction renderCaseExpr(expr, contract, pim) {\n\treturn `CASE ${expr.branches.map((branch) => `WHEN ${renderExpr(branch.condition, contract, pim)} THEN ${renderExpr(branch.value, contract, pim)}`).join(\" \")}${expr.elseExpr === void 0 ? \"\" : ` ELSE ${renderExpr(expr.elseExpr, contract, pim)}`} END`;\n}\nfunction renderJsonValueProjection(projection, contract, pim) {\n\treturn projection.accept({\n\t\tcodec: ({ value, codec }) => renderExpr(projectJsonThroughCodec(value, codec, pim), contract, pim),\n\t\tnative: ({ value }) => renderExpr(value, contract, pim),\n\t\tdocument: ({ value }) => renderExpr(value, contract, pim)\n\t});\n}\nfunction projectJsonThroughCodec(value, codec, pim) {\n\tconst descriptor = pim.types.codecDescriptorRegistry.descriptorFor(codec.codecId);\n\tif (descriptor === void 0) throw adapterError(\"RUNTIME.PARAM_REF_MISSING_CODEC\", `Postgres lowering: a JSON projection carries codecId \"${codec.codecId}\" but the validated PostgreSQL codec registry has no entry for it. This usually indicates a missing extension pack in the runtime stack — register the pack that contributes this codec (e.g. \\`extensions: [pgvectorRuntime]\\`), or use the codec directly from \\`@internal/target-postgres/codecs\\` if it's a builtin.`, { meta: { codecId: codec.codecId } });\n\treturn descriptor.projectJson(value, codec);\n}\nfunction renderJsonObjectExpr(expr, contract, pim) {\n\treturn `json_build_object(${expr.entries.flatMap((entry) => {\n\t\treturn [`'${escapeLiteral(entry.key)}'`, renderJsonValueProjection(entry.value, contract, pim)];\n\t}).join(\", \")})`;\n}\nfunction renderOrderByItems(items, contract, pim) {\n\treturn items.map((item) => `${renderExpr(item.expr, contract, pim)}${ORDER_DIRECTION_SQL[item.dir]}${renderNullsPlacement(item)}`).join(\", \");\n}\nconst ORDER_DIRECTION_SQL = {\n\tasc: \" ASC\",\n\tdesc: \" DESC\"\n};\nconst ORDER_NULLS_SQL = {\n\tfirst: \" NULLS FIRST\",\n\tlast: \" NULLS LAST\"\n};\nfunction renderNullsPlacement(item) {\n\treturn item.nulls === void 0 ? \"\" : ORDER_NULLS_SQL[item.nulls];\n}\nfunction renderJsonArrayAggExpr(expr, contract, pim) {\n\tconst aggregateOrderBy = expr.orderBy && expr.orderBy.length > 0 ? ` ORDER BY ${renderOrderByItems(expr.orderBy, contract, pim)}` : \"\";\n\tconst aggregated = `json_agg(${renderJsonValueProjection(expr.expr, contract, pim)}${aggregateOrderBy})`;\n\tif (expr.onEmpty === \"emptyArray\") return `coalesce(${aggregated}, json_build_array())`;\n\treturn aggregated;\n}\nfunction renderExpr(expr, contract, pim) {\n\tconst node = expr;\n\tswitch (node.kind) {\n\t\tcase \"column-ref\": return renderColumn(node);\n\t\tcase \"identifier-ref\": return quoteIdentifier(node.name);\n\t\tcase \"operation\": return renderOperation(node, contract, pim);\n\t\tcase \"subquery\": return renderSubqueryExpr(node, contract, pim);\n\t\tcase \"aggregate\": return renderAggregateExpr(node, contract, pim);\n\t\tcase \"window-func\": return renderWindowFuncExpr(node, contract, pim);\n\t\tcase \"function-call\": return renderFunctionCallExpr(node, contract, pim);\n\t\tcase \"cast\": return renderCastExpr(node, contract, pim);\n\t\tcase \"case\": return renderCaseExpr(node, contract, pim);\n\t\tcase \"json-object\": return renderJsonObjectExpr(node, contract, pim);\n\t\tcase \"json-array-agg\": return renderJsonArrayAggExpr(node, contract, pim);\n\t\tcase \"binary\": return renderBinary(node, contract, pim);\n\t\tcase \"and\":\n\t\t\tif (node.exprs.length === 0) return \"TRUE\";\n\t\t\treturn `(${node.exprs.map((part) => renderExpr(part, contract, pim)).join(\" AND \")})`;\n\t\tcase \"or\":\n\t\t\tif (node.exprs.length === 0) return \"FALSE\";\n\t\t\treturn `(${node.exprs.map((part) => renderExpr(part, contract, pim)).join(\" OR \")})`;\n\t\tcase \"exists\": return `${node.notExists ? \"NOT \" : \"\"}EXISTS (${renderSelect(node.subquery, contract, pim)})`;\n\t\tcase \"null-check\": return renderNullCheck(node, contract, pim);\n\t\tcase \"not\": return `NOT (${renderExpr(node.expr, contract, pim)})`;\n\t\tcase \"param-ref\":\n\t\tcase \"prepared-param-ref\": return renderParamRef(node, pim);\n\t\tcase \"literal\": return renderLiteral(node);\n\t\tcase \"list\": return renderListLiteral(node, contract, pim);\n\t\tcase \"raw-expr\": return renderRawExpr(node, contract, pim);\n\t\t// v8 ignore next 4\n\t\tdefault: assertNever(node, `Unsupported expression node kind: ${unreachableKind(node)}`);\n\t}\n}\nfunction renderParamRef(ref, pim, forceCast = false) {\n\tconst index = pim.indexMap.get(ref);\n\tif (index === void 0) throw new InternalError(\"ParamRef not found in index map\");\n\tif (ref.kind === \"prepared-param-ref\") return renderTypedParam(index, ref.codec.codecId, pim.types, ref.codec.many, ref.codec.typeParams, forceCast);\n\tif (ref.codec === void 0) throw runtimeError(\"RUNTIME.PARAM_REF_MISSING_CODEC\", \"Postgres renderer: ParamRef reached lowering without a bound CodecRef. Every column-bound ParamRef must carry a codec under the AST-bound codec contract. This usually indicates a builder path that constructed a ParamRef without threading the column codec.\", {\n\t\tparamIndex: index,\n\t\t...ifDefined(\"name\", ref.name)\n\t});\n\treturn renderTypedParam(index, ref.codec.codecId, pim.types, ref.codec.many, ref.codec.typeParams);\n}\nfunction renderLiteral(expr) {\n\tif (typeof expr.value === \"string\") return `'${escapeLiteral(expr.value)}'`;\n\tif (typeof expr.value === \"number\" || typeof expr.value === \"boolean\") return String(expr.value);\n\tif (typeof expr.value === \"bigint\") return String(expr.value);\n\tif (expr.value === null) return \"NULL\";\n\tif (expr.value === void 0) return \"NULL\";\n\tif (expr.value instanceof Date) return `'${escapeLiteral(expr.value.toISOString())}'`;\n\tif (Array.isArray(expr.value)) return `ARRAY[${expr.value.map((v) => renderLiteral(new LiteralExpr(v))).join(\", \")}]`;\n\tconst json = JSON.stringify(expr.value);\n\tif (json === void 0) return \"NULL\";\n\treturn `'${escapeLiteral(json)}'`;\n}\nfunction renderOperation(expr, contract, pim) {\n\tconst self = renderExpr(expr.self, contract, pim);\n\tconst args = expr.args.map((arg) => {\n\t\treturn renderExpr(arg, contract, pim);\n\t});\n\treturn expr.lowering.template.replace(/\\{\\{self\\}\\}|\\{\\{arg(\\d+)\\}\\}/g, (token, argIndex) => {\n\t\tif (token === \"{{self}}\") return self;\n\t\tconst arg = args[Number(argIndex)];\n\t\tif (arg === void 0) throw adapterError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Operation lowering template for \"${expr.method}\" referenced missing argument {{arg${argIndex}}}; template has ${args.length} arg(s)`, { meta: { method: expr.method } });\n\t\treturn arg;\n\t});\n}\nfunction renderJoin(join, contract, pim) {\n\treturn `${join.joinType.toUpperCase()} JOIN ${join.lateral ? \"LATERAL \" : \"\"}${renderSource(join.source, contract, pim)} ON ${renderJoinOn(join.on, contract, pim)}`;\n}\nfunction renderJoinOn(on, contract, pim) {\n\tif (on.kind === \"eq-col-join-on\") return `${renderColumn(on.left)} = ${renderColumn(on.right)}`;\n\treturn renderWhere(on, contract, pim);\n}\nfunction getInsertColumnOrder(rows, contract, tableRef) {\n\tconst tableName = tableRef.name;\n\tconst orderedColumns = [];\n\tconst seenColumns = /* @__PURE__ */ new Set();\n\tfor (const row of rows) for (const column of Object.keys(row)) {\n\t\tif (seenColumns.has(column)) continue;\n\t\tseenColumns.add(column);\n\t\torderedColumns.push(column);\n\t}\n\tif (orderedColumns.length > 0) return orderedColumns;\n\tlet table;\n\tif (tableRef.namespaceId !== void 0) {\n\t\tconst ns = contract.storage.namespaces[tableRef.namespaceId];\n\t\ttable = ns !== void 0 ? ns.entries.table?.[tableName] : void 0;\n\t}\n\tif (table === void 0) for (const ns of Object.values(contract.storage.namespaces)) {\n\t\tconst found = ns.entries.table?.[tableName];\n\t\tif (found !== void 0) {\n\t\t\ttable = found;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (!table) throw adapterError(\"RUNTIME.AST_INVALID\", `INSERT target table not found in contract storage: ${tableName}`, { meta: {\n\t\tnode: \"insert\",\n\t\ttable: tableName\n\t} });\n\treturn Object.keys(table.columns);\n}\nfunction renderInsertValue(value, contract, pim) {\n\tif (!value || value.kind === \"default-value\") return \"DEFAULT\";\n\tswitch (value.kind) {\n\t\tcase \"param-ref\":\n\t\tcase \"prepared-param-ref\": return renderParamRef(value, pim);\n\t\tcase \"column-ref\": return renderColumn(value);\n\t\tcase \"raw-expr\": return renderExpr(value, contract, pim);\n\t\t// v8 ignore next 4\n\t\tdefault: assertNever(value, `Unsupported value node in INSERT: ${unreachableKind(value)}`);\n\t}\n}\nfunction renderInsert(ast, contract, pim) {\n\tconst table = qualifyTableFromNamespaceCoordinate(ast.table, contract);\n\tconst rows = ast.rows;\n\tif (rows.length === 0) throw adapterError(\"RUNTIME.AST_INVALID\", \"INSERT requires at least one row\", { meta: { node: \"insert\" } });\n\tconst hasExplicitValues = rows.some((row) => Object.keys(row).length > 0);\n\treturn `${(() => {\n\t\tif (!hasExplicitValues) {\n\t\t\tif (rows.length === 1) return `INSERT INTO ${table} DEFAULT VALUES`;\n\t\t\tconst defaultColumns = getInsertColumnOrder(rows, contract, ast.table);\n\t\t\tif (defaultColumns.length === 0) return `INSERT INTO ${table} VALUES ${rows.map(() => \"()\").join(\", \")}`;\n\t\t\tconst quotedColumns = defaultColumns.map((column) => quoteIdentifier(column));\n\t\t\tconst defaultRow = `(${defaultColumns.map(() => \"DEFAULT\").join(\", \")})`;\n\t\t\treturn `INSERT INTO ${table} (${quotedColumns.join(\", \")}) VALUES ${rows.map(() => defaultRow).join(\", \")}`;\n\t\t}\n\t\tconst columnOrder = getInsertColumnOrder(rows, contract, ast.table);\n\t\tconst columns = columnOrder.map((column) => quoteIdentifier(column));\n\t\tconst values = rows.map((row) => {\n\t\t\treturn `(${columnOrder.map((column) => renderInsertValue(row[column], contract, pim)).join(\", \")})`;\n\t\t}).join(\", \");\n\t\treturn `INSERT INTO ${table} (${columns.join(\", \")}) VALUES ${values}`;\n\t})()}${ast.onConflict ? (() => {\n\t\tconst conflictColumns = ast.onConflict.columns.map((col) => quoteIdentifier(col.column));\n\t\tconst target = conflictColumns.length === 0 ? \"\" : ` (${conflictColumns.join(\", \")})`;\n\t\tconst action = ast.onConflict.action;\n\t\tswitch (action.kind) {\n\t\t\tcase \"do-nothing\": return ` ON CONFLICT${target} DO NOTHING`;\n\t\t\tcase \"do-update-set\": {\n\t\t\t\tif (conflictColumns.length === 0) throw adapterError(\"RUNTIME.AST_INVALID\", \"INSERT onConflict requires at least one conflict column\", { meta: { node: \"insert-on-conflict\" } });\n\t\t\t\tconst updateEntries = Object.entries(action.set);\n\t\t\t\tif (updateEntries.length === 0) throw adapterError(\"RUNTIME.AST_INVALID\", \"INSERT onConflict do-update-set requires at least one assignment\", { meta: { node: \"insert-on-conflict\" } });\n\t\t\t\treturn ` ON CONFLICT${target} DO UPDATE SET ${updateEntries.map(([colName, value]) => {\n\t\t\t\t\treturn `${quoteIdentifier(colName)} = ${renderExpr(value, contract, pim)}`;\n\t\t\t\t}).join(\", \")}`;\n\t\t\t}\n\t\t\t// v8 ignore next 4\n\t\t\tdefault: assertNever(action, `Unsupported onConflict action: ${unreachableKind(action)}`);\n\t\t}\n\t})() : \"\"}${ast.returning?.length ? ` RETURNING ${renderReturning(ast.returning, contract, pim)}` : \"\"}`;\n}\nfunction renderUpdate(ast, contract, pim) {\n\tconst table = qualifyTableFromNamespaceCoordinate(ast.table, contract);\n\tconst setEntries = Object.entries(ast.set);\n\tif (setEntries.length === 0) throw adapterError(\"RUNTIME.AST_INVALID\", \"UPDATE requires at least one SET assignment\", { meta: { node: \"update\" } });\n\tconst setClauses = setEntries.map(([col, val]) => {\n\t\treturn `${quoteIdentifier(col)} = ${renderExpr(val, contract, pim)}`;\n\t});\n\tconst whereClause = ast.where ? ` WHERE ${renderWhere(ast.where, contract, pim)}` : \"\";\n\tconst returningClause = ast.returning?.length ? ` RETURNING ${renderReturning(ast.returning, contract, pim)}` : \"\";\n\treturn `UPDATE ${table} SET ${setClauses.join(\", \")}${whereClause}${returningClause}`;\n}\nfunction renderDelete(ast, contract, pim) {\n\treturn `DELETE FROM ${qualifyTableFromNamespaceCoordinate(ast.table, contract)}${ast.where ? ` WHERE ${renderWhere(ast.where, contract, pim)}` : \"\"}${ast.returning?.length ? ` RETURNING ${renderReturning(ast.returning, contract, pim)}` : \"\"}`;\n}\nfunction renderParts(parts, contract, pim) {\n\treturn parts.map((part) => typeof part === \"string\" ? part : renderExpr(part, contract, pim)).join(\"\");\n}\nfunction renderRawExpr(node, contract, pim) {\n\treturn renderParts(node.parts, contract, pim);\n}\n//#endregion\nexport { adapterError as n, renderLoweredSql as t };\n\n//# sourceMappingURL=sql-renderer-BjJ3MLnI.mjs.map"],"mappings":";;;;;;;;;;AAUA,SAAS,aAAa,MAAM,SAAS,SAAS;CAC7C,OAAO,g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WAAW,KAAK,UAAU,GAAG;CAClE,CAAC;CACD,MAAM,cAAc,IAAI,QAAQ,UAAU,YAAY,IAAI,OAAO,UAAU,GAAG,MAAM;CACpF,MAAM,kBAAkB,IAAI,WAAW,SAAS,cAAc,gBAAgB,IAAI,WAAW,UAAU,GAAG,MAAM;CAChH,OAAO,UAAU,MAAM,OAAO,WAAW,KAAK,IAAI,IAAI,cAAc;AACrE;AACA,SAAS,aAAa,KAAK,UAAU,KAAK;CACzC,OAAO,eAAe,oCAAoC,IAAI,OAAO,QAAQ,IAAI,IAAI,QAAQ,UAAU,YAAY,IAAI,OAAO,UAAU,GAAG,MAAM,KAAK,IAAI,WAAW,SAAS,cAAc,gBAAgB,IAAI,WAAW,UAAU,GAAG,MAAM;AAC/O;AACA,SAAS,YAAY,OAAO,UAAU,KAAK;CAC1C,OAAO,MAAM,KAAK,SAAS,OAAO,SAAS,WAAW,OAAO,WAAW,MAAM,UAAU,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE;AACtG;AACA,SAAS,cAAc,MAAM,UAAU,KAAK;CAC3C,OAAO,YAAY,KAAK,OAAO,UAAU,GAAG;AAC7C"}
@@ -1,8 +1,9 @@
1
1
  import { t as PostgresContract } from "./postgres-schema-Xsjt3RKO-Buv2X8ai.mjs";
2
- import { i as PostgresCodecDescriptorRegistry } from "./codec-descriptor-HYqjI24K-CTO3gTEs.mjs";
3
- import "./codec-descriptor-D8_e5hpo.mjs";
4
- import "./types-BPubHbiE-BzhJ05fG.mjs";
2
+ import { i as PostgresCodecDescriptorRegistry } from "./codec-descriptor-DkeVTJ3N-XTfZgDGp.mjs";
3
+ import "./codec-descriptor-DAQDOwCJ.mjs";
4
+ import "./types-D6lgKhE5-Cu48rrw9.mjs";
5
5
  import { AnyQueryAst, LoweredParam } from "@prisma/orm-family-sql/relational-core/ast";
6
+ import { DataTypeLookup } from "@prisma/orm-framework/components/codec";
6
7
  //#region ../../../3-targets/6-adapters/postgres/dist/sql-renderer.d.mts
7
8
  //#region src/core/sql-renderer.d.ts
8
9
  /**
@@ -10,10 +11,10 @@ import { AnyQueryAst, LoweredParam } from "@prisma/orm-family-sql/relational-cor
10
11
  *
11
12
  * Shared between the runtime (`PostgresAdapterImpl.lower`) and control (`PostgresControlAdapter.lower`) entrypoints so emit-time and run-time paths produce byte-identical output for the same AST.
12
13
  */
13
- declare function renderLoweredSql(ast: AnyQueryAst, contract: PostgresContract, codecDescriptorRegistry: PostgresCodecDescriptorRegistry): {
14
+ declare function renderLoweredSql(ast: AnyQueryAst, contract: PostgresContract, codecDescriptorRegistry: PostgresCodecDescriptorRegistry, dataTypeLookup: DataTypeLookup): {
14
15
  readonly sql: string;
15
16
  readonly params: readonly LoweredParam[];
16
17
  };
17
18
  //#endregion
18
19
  export { renderLoweredSql as t };
19
- //# sourceMappingURL=sql-renderer-Bd07vbru.d.mts.map
20
+ //# sourceMappingURL=sql-renderer-D6UgvbqG.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sql-renderer-D6UgvbqG.d.mts","names":[],"sources":["../../../../3-targets/6-adapters/postgres/dist/sql-renderer.d.mts"],"mappings":";;;;;;;;;;;;;iBAUiB,iBAAiB,KAAK,aAAa,UAAU,kBAAkB,yBAAyB,iCAAiC,gBAAgB;WAC/I;WACA,iBAAiB"}
@@ -1,5 +1,172 @@
1
1
  import { s as postgresError } from "./errors-DYyzTYzE-39CV_aMo.mjs";
2
- //#region ../../../3-targets/3-targets/postgres/dist/sql-utils-Bh-mnsSY.mjs
2
+ //#region ../../../3-targets/3-targets/postgres/dist/sql-utils-BMXJi06b.mjs
3
+ /** Every Postgres keyword that `quote_ident` quotes: those `pg_get_keywords()` does not list as unreserved. */
4
+ const POSTGRES_QUOTED_KEYWORDS = /* @__PURE__ */ new Set([
5
+ "all",
6
+ "analyse",
7
+ "analyze",
8
+ "and",
9
+ "any",
10
+ "array",
11
+ "as",
12
+ "asc",
13
+ "asymmetric",
14
+ "authorization",
15
+ "between",
16
+ "bigint",
17
+ "binary",
18
+ "bit",
19
+ "boolean",
20
+ "both",
21
+ "case",
22
+ "cast",
23
+ "char",
24
+ "character",
25
+ "check",
26
+ "coalesce",
27
+ "collate",
28
+ "collation",
29
+ "column",
30
+ "concurrently",
31
+ "constraint",
32
+ "create",
33
+ "cross",
34
+ "current_catalog",
35
+ "current_date",
36
+ "current_role",
37
+ "current_schema",
38
+ "current_time",
39
+ "current_timestamp",
40
+ "current_user",
41
+ "dec",
42
+ "decimal",
43
+ "default",
44
+ "deferrable",
45
+ "desc",
46
+ "distinct",
47
+ "do",
48
+ "else",
49
+ "end",
50
+ "except",
51
+ "exists",
52
+ "extract",
53
+ "false",
54
+ "fetch",
55
+ "float",
56
+ "for",
57
+ "foreign",
58
+ "freeze",
59
+ "from",
60
+ "full",
61
+ "grant",
62
+ "greatest",
63
+ "group",
64
+ "grouping",
65
+ "having",
66
+ "ilike",
67
+ "in",
68
+ "initially",
69
+ "inner",
70
+ "inout",
71
+ "int",
72
+ "integer",
73
+ "intersect",
74
+ "interval",
75
+ "into",
76
+ "is",
77
+ "isnull",
78
+ "join",
79
+ "json",
80
+ "json_array",
81
+ "json_arrayagg",
82
+ "json_exists",
83
+ "json_object",
84
+ "json_objectagg",
85
+ "json_query",
86
+ "json_scalar",
87
+ "json_serialize",
88
+ "json_table",
89
+ "json_value",
90
+ "lateral",
91
+ "leading",
92
+ "least",
93
+ "left",
94
+ "like",
95
+ "limit",
96
+ "localtime",
97
+ "localtimestamp",
98
+ "merge_action",
99
+ "national",
100
+ "natural",
101
+ "nchar",
102
+ "none",
103
+ "normalize",
104
+ "not",
105
+ "notnull",
106
+ "null",
107
+ "nullif",
108
+ "numeric",
109
+ "offset",
110
+ "on",
111
+ "only",
112
+ "or",
113
+ "order",
114
+ "out",
115
+ "outer",
116
+ "overlaps",
117
+ "overlay",
118
+ "placing",
119
+ "position",
120
+ "precision",
121
+ "primary",
122
+ "real",
123
+ "references",
124
+ "returning",
125
+ "right",
126
+ "row",
127
+ "select",
128
+ "session_user",
129
+ "setof",
130
+ "similar",
131
+ "smallint",
132
+ "some",
133
+ "substring",
134
+ "symmetric",
135
+ "system_user",
136
+ "table",
137
+ "tablesample",
138
+ "then",
139
+ "time",
140
+ "timestamp",
141
+ "to",
142
+ "trailing",
143
+ "treat",
144
+ "trim",
145
+ "true",
146
+ "union",
147
+ "unique",
148
+ "user",
149
+ "using",
150
+ "values",
151
+ "varchar",
152
+ "variadic",
153
+ "verbose",
154
+ "when",
155
+ "where",
156
+ "window",
157
+ "with",
158
+ "xmlattributes",
159
+ "xmlconcat",
160
+ "xmlelement",
161
+ "xmlexists",
162
+ "xmlforest",
163
+ "xmlnamespaces",
164
+ "xmlparse",
165
+ "xmlpi",
166
+ "xmlroot",
167
+ "xmlserialize",
168
+ "xmltable"
169
+ ]);
3
170
  /**
4
171
  * Shared SQL utility functions for the Postgres target.
5
172
  *
@@ -41,6 +208,14 @@ function quoteIdentifier(identifier) {
41
208
  return `"${identifier.replace(/"/g, "\"\"")}"`;
42
209
  }
43
210
  /**
211
+ * Quotes `identifier` only where Postgres's `quote_ident` would: when it is not all lower-case
212
+ * letters, digits and underscores, starts with a digit, or is a keyword that is not unreserved. This is how
213
+ * `format_type` prints a type name.
214
+ */
215
+ function quoteIdentifierWhereNeeded(identifier) {
216
+ return /^[a-z_][a-z0-9_]*$/.test(identifier) && !POSTGRES_QUOTED_KEYWORDS.has(identifier) ? identifier : quoteIdentifier(identifier);
217
+ }
218
+ /**
44
219
  * Escapes a string literal for safe use in SQL statements.
45
220
  *
46
221
  * Security validations:
@@ -91,6 +266,6 @@ function validateEnumValueLength(value, enumTypeName) {
91
266
  } });
92
267
  }
93
268
  //#endregion
94
- export { validateEnumValueLength as a, quoteQualifiedName as i, qualifyName as n, quoteIdentifier as r, escapeLiteral as t };
269
+ export { quoteQualifiedName as a, quoteIdentifierWhereNeeded as i, qualifyName as n, validateEnumValueLength as o, quoteIdentifier as r, escapeLiteral as t };
95
270
 
96
- //# sourceMappingURL=sql-utils-Bh-mnsSY-D6hnFPrP.mjs.map
271
+ //# sourceMappingURL=sql-utils-BMXJi06b-CAQOplfq.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sql-utils-BMXJi06b-CAQOplfq.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/sql-utils-BMXJi06b.mjs"],"sourcesContent":["import { s as postgresError } from \"./errors-DYyzTYzE.mjs\";\n//#region src/core/postgres-keywords.ts\n/** Every Postgres keyword that `quote_ident` quotes: those `pg_get_keywords()` does not list as unreserved. */\nconst POSTGRES_QUOTED_KEYWORDS = /* @__PURE__ */ new Set([\n\t\"all\",\n\t\"analyse\",\n\t\"analyze\",\n\t\"and\",\n\t\"any\",\n\t\"array\",\n\t\"as\",\n\t\"asc\",\n\t\"asymmetric\",\n\t\"authorization\",\n\t\"between\",\n\t\"bigint\",\n\t\"binary\",\n\t\"bit\",\n\t\"boolean\",\n\t\"both\",\n\t\"case\",\n\t\"cast\",\n\t\"char\",\n\t\"character\",\n\t\"check\",\n\t\"coalesce\",\n\t\"collate\",\n\t\"collation\",\n\t\"column\",\n\t\"concurrently\",\n\t\"constraint\",\n\t\"create\",\n\t\"cross\",\n\t\"current_catalog\",\n\t\"current_date\",\n\t\"current_role\",\n\t\"current_schema\",\n\t\"current_time\",\n\t\"current_timestamp\",\n\t\"current_user\",\n\t\"dec\",\n\t\"decimal\",\n\t\"default\",\n\t\"deferrable\",\n\t\"desc\",\n\t\"distinct\",\n\t\"do\",\n\t\"else\",\n\t\"end\",\n\t\"except\",\n\t\"exists\",\n\t\"extract\",\n\t\"false\",\n\t\"fetch\",\n\t\"float\",\n\t\"for\",\n\t\"foreign\",\n\t\"freeze\",\n\t\"from\",\n\t\"full\",\n\t\"grant\",\n\t\"greatest\",\n\t\"group\",\n\t\"grouping\",\n\t\"having\",\n\t\"ilike\",\n\t\"in\",\n\t\"initially\",\n\t\"inner\",\n\t\"inout\",\n\t\"int\",\n\t\"integer\",\n\t\"intersect\",\n\t\"interval\",\n\t\"into\",\n\t\"is\",\n\t\"isnull\",\n\t\"join\",\n\t\"json\",\n\t\"json_array\",\n\t\"json_arrayagg\",\n\t\"json_exists\",\n\t\"json_object\",\n\t\"json_objectagg\",\n\t\"json_query\",\n\t\"json_scalar\",\n\t\"json_serialize\",\n\t\"json_table\",\n\t\"json_value\",\n\t\"lateral\",\n\t\"leading\",\n\t\"least\",\n\t\"left\",\n\t\"like\",\n\t\"limit\",\n\t\"localtime\",\n\t\"localtimestamp\",\n\t\"merge_action\",\n\t\"national\",\n\t\"natural\",\n\t\"nchar\",\n\t\"none\",\n\t\"normalize\",\n\t\"not\",\n\t\"notnull\",\n\t\"null\",\n\t\"nullif\",\n\t\"numeric\",\n\t\"offset\",\n\t\"on\",\n\t\"only\",\n\t\"or\",\n\t\"order\",\n\t\"out\",\n\t\"outer\",\n\t\"overlaps\",\n\t\"overlay\",\n\t\"placing\",\n\t\"position\",\n\t\"precision\",\n\t\"primary\",\n\t\"real\",\n\t\"references\",\n\t\"returning\",\n\t\"right\",\n\t\"row\",\n\t\"select\",\n\t\"session_user\",\n\t\"setof\",\n\t\"similar\",\n\t\"smallint\",\n\t\"some\",\n\t\"substring\",\n\t\"symmetric\",\n\t\"system_user\",\n\t\"table\",\n\t\"tablesample\",\n\t\"then\",\n\t\"time\",\n\t\"timestamp\",\n\t\"to\",\n\t\"trailing\",\n\t\"treat\",\n\t\"trim\",\n\t\"true\",\n\t\"union\",\n\t\"unique\",\n\t\"user\",\n\t\"using\",\n\t\"values\",\n\t\"varchar\",\n\t\"variadic\",\n\t\"verbose\",\n\t\"when\",\n\t\"where\",\n\t\"window\",\n\t\"with\",\n\t\"xmlattributes\",\n\t\"xmlconcat\",\n\t\"xmlelement\",\n\t\"xmlexists\",\n\t\"xmlforest\",\n\t\"xmlnamespaces\",\n\t\"xmlparse\",\n\t\"xmlpi\",\n\t\"xmlroot\",\n\t\"xmlserialize\",\n\t\"xmltable\"\n]);\n//#endregion\n//#region src/core/sql-utils.ts\n/**\n* Shared SQL utility functions for the Postgres target.\n*\n* These functions handle safe SQL identifier and literal escaping\n* with security validations to prevent injection and encoding issues.\n*\n* They live in `target-postgres` because both the control adapter (used at\n* emit time) and the runtime adapter (used at execute time) need the same\n* escaping/validation behavior, and the target package is the natural shared\n* home that both adapters can depend on without crossing planes.\n*/\nconst MAX_IDENTIFIER_BYTES = 63;\nconst MAX_UTF8_BYTES_PER_UTF16_UNIT = 3;\nconst utf8 = new TextEncoder();\n/** UTF-8 byte length — the unit PostgreSQL measures identifiers and enum labels in. */\nfunction byteLength(value) {\n\treturn utf8.encode(value).length;\n}\n/**\n* Validates and quotes a PostgreSQL identifier (table, column, type, schema names).\n*\n* Security validations:\n* - Rejects null bytes which could cause truncation or unexpected behavior\n* - Rejects empty identifiers\n* - Warns on identifiers exceeding PostgreSQL's 63-byte limit\n*\n* @throws `CONTRACT.IDENTIFIER_INVALID` structured error If the identifier contains null bytes or is empty\n*/\nfunction quoteIdentifier(identifier) {\n\tif (identifier.length === 0) throw postgresError(\"CONTRACT.IDENTIFIER_INVALID\", \"Identifier cannot be empty\", { meta: {\n\t\tvalue: identifier,\n\t\tcontext: \"identifier\"\n\t} });\n\tif (identifier.includes(\"\\0\")) throw postgresError(\"CONTRACT.IDENTIFIER_INVALID\", \"Identifier cannot contain null bytes\", { meta: {\n\t\tvalue: identifier.replace(/\\0/g, \"\\\\0\"),\n\t\tcontext: \"identifier\"\n\t} });\n\tif (identifier.length * MAX_UTF8_BYTES_PER_UTF16_UNIT > MAX_IDENTIFIER_BYTES && byteLength(identifier) > MAX_IDENTIFIER_BYTES) console.warn(`Identifier \"${identifier.slice(0, 20)}...\" exceeds PostgreSQL's ${MAX_IDENTIFIER_BYTES}-byte limit and will be truncated`);\n\treturn `\"${identifier.replace(/\"/g, \"\\\"\\\"\")}\"`;\n}\n/**\n* Quotes `identifier` only where Postgres's `quote_ident` would: when it is not all lower-case\n* letters, digits and underscores, starts with a digit, or is a keyword that is not unreserved. This is how\n* `format_type` prints a type name.\n*/\nfunction quoteIdentifierWhereNeeded(identifier) {\n\treturn /^[a-z_][a-z0-9_]*$/.test(identifier) && !POSTGRES_QUOTED_KEYWORDS.has(identifier) ? identifier : quoteIdentifier(identifier);\n}\n/**\n* Escapes a string literal for safe use in SQL statements.\n*\n* Security validations:\n* - Rejects null bytes which could cause truncation or unexpected behavior\n*\n* Note: This assumes PostgreSQL's `standard_conforming_strings` is ON (default since PG 9.1).\n* Backslashes are treated as literal characters, not escape sequences.\n*\n* @throws `CONTRACT.IDENTIFIER_INVALID` structured error If the value contains null bytes\n*/\nfunction escapeLiteral(value) {\n\tif (value.includes(\"\\0\")) throw postgresError(\"CONTRACT.IDENTIFIER_INVALID\", \"Literal value cannot contain null bytes\", { meta: {\n\t\tvalue: value.replace(/\\0/g, \"\\\\0\"),\n\t\tcontext: \"literal\"\n\t} });\n\treturn value.replace(/'/g, \"''\");\n}\n/**\n* Builds a qualified name (schema.object) with proper quoting.\n*/\nfunction qualifyName(schemaName, objectName) {\n\treturn `${quoteIdentifier(schemaName)}.${quoteIdentifier(objectName)}`;\n}\n/**\n* Quotes a possibly dot-qualified name segment-by-segment:\n* `order_status` -> `\"order_status\"`, `auth.aal_level` -> `\"auth\".\"aal_level\"`.\n* A single-segment name round-trips to exactly {@link quoteIdentifier}; whole-\n* string quoting (`\"auth.aal_level\"`) would be one wrong identifier.\n*/\nfunction quoteQualifiedName(name) {\n\treturn name.split(\".\").map((segment) => quoteIdentifier(segment)).join(\".\");\n}\n/**\n* Validates that an enum value doesn't exceed PostgreSQL's label length limit.\n*\n* PostgreSQL enum labels have a maximum length of NAMEDATALEN-1 (63 bytes by default).\n* Unlike identifiers, enum labels that exceed this limit cause an error rather than\n* silent truncation.\n*\n* @param value - The enum value to validate\n* @param enumTypeName - Name of the enum type (for error messages)\n* @throws `CONTRACT.IDENTIFIER_INVALID` structured error If the value exceeds the maximum length\n*/\nfunction validateEnumValueLength(value, enumTypeName) {\n\tif (byteLength(value) > MAX_IDENTIFIER_BYTES) throw postgresError(\"CONTRACT.IDENTIFIER_INVALID\", `Enum value \"${value.slice(0, 20)}...\" for type \"${enumTypeName}\" exceeds PostgreSQL's ${MAX_IDENTIFIER_BYTES}-byte label limit`, { meta: {\n\t\tvalue,\n\t\tcontext: \"enum-label\"\n\t} });\n}\n//#endregion\nexport { quoteQualifiedName as a, quoteIdentifierWhereNeeded as i, qualifyName as n, validateEnumValueLength as o, quoteIdentifier as r, escapeLiteral as t };\n\n//# sourceMappingURL=sql-utils-BMXJi06b.mjs.map"],"mappings":";;;AAGA,MAAM,2CAA2C,IAAI,IAAI;CACxD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;;;;;;;;;;;;AAcD,MAAM,uBAAuB;AAC7B,MAAM,gCA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