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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/dist/{adapter-BIWKN0d7-HfXFH4vy.mjs → adapter-B84yJpi7-8wwdWq5R.mjs} +6 -6
  2. package/dist/{adapter-BIWKN0d7-HfXFH4vy.mjs.map → adapter-B84yJpi7-8wwdWq5R.mjs.map} +1 -1
  3. package/dist/{adapter-BNZo-LwN.d.mts → adapter-CGBZvb_8.d.mts} +3 -3
  4. package/dist/{adapter-BNZo-LwN.d.mts.map → adapter-CGBZvb_8.d.mts.map} +1 -1
  5. package/dist/adapter.d.mts +8 -8
  6. package/dist/adapter.mjs +5 -5
  7. package/dist/adapter__adapter.d.mts +1 -1
  8. package/dist/adapter__adapter.mjs +2 -2
  9. package/dist/adapter__control.d.mts +3 -3
  10. package/dist/adapter__control.mjs +4 -4
  11. package/dist/adapter__control.mjs.map +1 -1
  12. package/dist/adapter__runtime.d.mts +1 -1
  13. package/dist/adapter__runtime.mjs +4 -4
  14. package/dist/adapter__runtime.mjs.map +1 -1
  15. package/dist/adapter__sql-renderer.d.mts +1 -1
  16. package/dist/adapter__sql-renderer.mjs +1 -1
  17. package/dist/adapter__types.d.mts +3 -3
  18. package/dist/{authoring-BYl9graG-BTI-XfEW.mjs → authoring-Bm8PD9ls-clXbYDiN.mjs} +209 -48
  19. package/dist/authoring-Bm8PD9ls-clXbYDiN.mjs.map +1 -0
  20. package/dist/{autoincrement-widths-D7Uub-uA-DccZpX6Q.mjs → autoincrement-widths-DkD24r-C-D4O96GJZ.mjs} +3 -3
  21. package/dist/{autoincrement-widths-D7Uub-uA-DccZpX6Q.mjs.map → autoincrement-widths-DkD24r-C-D4O96GJZ.mjs.map} +1 -1
  22. package/dist/check-expressions-BLd3bGf1-CwtBWbN3.d.mts +21 -0
  23. package/dist/check-expressions-BLd3bGf1-CwtBWbN3.d.mts.map +1 -0
  24. package/dist/check-expressions-C_lM7sSK-Dtv6p3hg.mjs +118 -0
  25. package/dist/check-expressions-C_lM7sSK-Dtv6p3hg.mjs.map +1 -0
  26. package/dist/{codec-descriptor-DoR-cTFZ-BlG5Gj-X.mjs → codec-descriptor-DBeD0UlS-BfvrE-KZ.mjs} +6 -3
  27. package/dist/codec-descriptor-DBeD0UlS-BfvrE-KZ.mjs.map +1 -0
  28. package/dist/codec-descriptor-Dp3lP7Rc.d.mts +1 -0
  29. package/dist/{codec-descriptor-d1ByNBEk-DhrtS_5y.d.mts → codec-descriptor-nXA2rkO1-DyArG-p2.d.mts} +12 -4
  30. package/dist/codec-descriptor-nXA2rkO1-DyArG-p2.d.mts.map +1 -0
  31. package/dist/{codec-registry-D8Nsfksc-B5zXDblI.mjs → codec-registry-DVjibYBY-BeOUp5fk.mjs} +5 -5
  32. package/dist/{codec-registry-D8Nsfksc-B5zXDblI.mjs.map → codec-registry-DVjibYBY-BeOUp5fk.mjs.map} +1 -1
  33. package/dist/{codec-type-map-CIZ7LbPA-CeMPxEAm.d.mts → codec-type-map-DSuWVp-n-Cp4c9JWN.d.mts} +4 -4
  34. package/dist/{codec-type-map-CIZ7LbPA-CeMPxEAm.d.mts.map → codec-type-map-DSuWVp-n-Cp4c9JWN.d.mts.map} +1 -1
  35. package/dist/codec-types-BioRVnRb.d.mts +2 -0
  36. package/dist/{codec-types-C7E42vTO-CGX0m6Mb.d.mts → codec-types-xBRj9sIm-atN8rfl1.d.mts} +4 -4
  37. package/dist/{codec-types-C7E42vTO-CGX0m6Mb.d.mts.map → codec-types-xBRj9sIm-atN8rfl1.d.mts.map} +1 -1
  38. package/dist/{codecs-BVyoUeNy-DZw_7n3P.mjs → codecs-BqCmavY8-CC-ZbbTA.mjs} +51 -6
  39. package/dist/codecs-BqCmavY8-CC-ZbbTA.mjs.map +1 -0
  40. package/dist/{codecs-DulR4oG1.d.mts → codecs-DCtBjmAW.d.mts} +3 -3
  41. package/dist/{codecs-DulR4oG1.d.mts.map → codecs-DCtBjmAW.d.mts.map} +1 -1
  42. package/dist/{codecs-BJBFipkV-CVMp939Z.d.mts → codecs-qCAX5T6T-sg3NIKfN.d.mts} +40 -3
  43. package/dist/codecs-qCAX5T6T-sg3NIKfN.d.mts.map +1 -0
  44. package/dist/{contract-contributions-DTGGTwRZ-DUokY6NT.mjs → contract-contributions-rxCSM_1W-d9oohAzB.mjs} +16 -41
  45. package/dist/contract-contributions-rxCSM_1W-d9oohAzB.mjs.map +1 -0
  46. package/dist/{contract-free-Bjx-Ktot.mjs → contract-free-BrY8qnvY.mjs} +3 -3
  47. package/dist/{contract-free-Bjx-Ktot.mjs.map → contract-free-BrY8qnvY.mjs.map} +1 -1
  48. package/dist/{control-nSGzcTXc.d.mts → control-CCetIiFG.d.mts} +3 -3
  49. package/dist/{control-nSGzcTXc.d.mts.map → control-CCetIiFG.d.mts.map} +1 -1
  50. package/dist/{control-policy-D9yEV-XI-CCDB2v5g.mjs → control-policy-BncmQ6LO-B8SXRfP_.mjs} +9 -9
  51. package/dist/{control-policy-D9yEV-XI-CCDB2v5g.mjs.map → control-policy-BncmQ6LO-B8SXRfP_.mjs.map} +1 -1
  52. package/dist/{control-m9LWRUnY.d.mts → control-s1_5W_8t.d.mts} +179 -74
  53. package/dist/control-s1_5W_8t.d.mts.map +1 -0
  54. package/dist/{data-type-entries-DhUYJbVb-4NUH6vR_.mjs → data-type-entries-ZHPz2h_f-CNUmPGgf.mjs} +3 -3
  55. package/dist/{data-type-entries-DhUYJbVb-4NUH6vR_.mjs.map → data-type-entries-ZHPz2h_f-CNUmPGgf.mjs.map} +1 -1
  56. package/dist/{data-types-B7S_CHZd-C9JA40Ir.mjs → data-types-DklKHVmp-Bl-nwUa-.mjs} +21 -4
  57. package/dist/data-types-DklKHVmp-Bl-nwUa-.mjs.map +1 -0
  58. package/dist/{date-time-now-generators-C2aktlrc-uf9LqU6E.d.mts → date-time-now-generators-BZj5G1E3-BylrCrgW.d.mts} +4 -4
  59. package/dist/date-time-now-generators-BZj5G1E3-BylrCrgW.d.mts.map +1 -0
  60. package/dist/{date-time-now-generators-DsGxTwjo-DTb5oTHX.mjs → date-time-now-generators-Cc4PvFeB-XQWJz_4f.mjs} +21 -11
  61. package/dist/date-time-now-generators-Cc4PvFeB-XQWJz_4f.mjs.map +1 -0
  62. package/dist/{ddl-DiUFjVZe-DETlNlJh.mjs → ddl-LpR9foVX-YBmyKx74.mjs} +3 -3
  63. package/dist/{ddl-DiUFjVZe-DETlNlJh.mjs.map → ddl-LpR9foVX-YBmyKx74.mjs.map} +1 -1
  64. package/dist/{descriptor-meta-RxUflZY0-BNMenVO8.mjs → descriptor-meta-C2F_xt0P-D7gfqNS0.mjs} +17 -12
  65. package/dist/descriptor-meta-C2F_xt0P-D7gfqNS0.mjs.map +1 -0
  66. package/dist/{descriptor-meta-I7Ih-0hE-BzEpKpQF.mjs → descriptor-meta-C2YuDfV8-B_u19j25.mjs} +4 -4
  67. package/dist/{descriptor-meta-I7Ih-0hE-BzEpKpQF.mjs.map → descriptor-meta-C2YuDfV8-B_u19j25.mjs.map} +1 -1
  68. package/dist/{diff-database-schema-j18Gm75j-CNAELOTU.mjs → diff-database-schema-CcR7BN-A-BuftnIR2.mjs} +9 -9
  69. package/dist/{diff-database-schema-j18Gm75j-CNAELOTU.mjs.map → diff-database-schema-CcR7BN-A-BuftnIR2.mjs.map} +1 -1
  70. package/dist/{errors-Di_apgWJ-BLXRTfFj.mjs → errors-DG6xgXgr-Cb1XcPcb.mjs} +6 -5
  71. package/dist/errors-DG6xgXgr-Cb1XcPcb.mjs.map +1 -0
  72. package/dist/{full-text-CcHf5wkL.mjs → full-text-7szWl7EC.mjs} +3 -3
  73. package/dist/{full-text-CcHf5wkL.mjs.map → full-text-7szWl7EC.mjs.map} +1 -1
  74. package/dist/{full-text-collection-method-DHuJr46z-Bndk11cK.d.mts → full-text-collection-method-DvmPrdZL-B1FlBM0E.d.mts} +4 -4
  75. package/dist/full-text-collection-method-DvmPrdZL-B1FlBM0E.d.mts.map +1 -0
  76. package/dist/{full-text-index-definition-B0kQDs_M-8N6Slj3l.mjs → full-text-index-definition-BRNRSgZK-l_2TBarg.mjs} +3 -3
  77. package/dist/{full-text-index-definition-B0kQDs_M-8N6Slj3l.mjs.map → full-text-index-definition-BRNRSgZK-l_2TBarg.mjs.map} +1 -1
  78. package/dist/{full-text-xZIrFi7x.d.mts → full-text-k_9J-JPd.d.mts} +3 -3
  79. package/dist/{full-text-xZIrFi7x.d.mts.map → full-text-k_9J-JPd.d.mts.map} +1 -1
  80. package/dist/{full-text-parsers-hI_qtk-Q-DqTMF4n2.mjs → full-text-parsers-Dd5DOdBA-BTeOSzUj.mjs} +4 -4
  81. package/dist/{full-text-parsers-hI_qtk-Q-DqTMF4n2.mjs.map → full-text-parsers-Dd5DOdBA-BTeOSzUj.mjs.map} +1 -1
  82. package/dist/{full-text-search-document-7AKd6oOw-S-rsh3SZ.mjs → full-text-search-document-DWzECXD--BqrLGXsX.mjs} +5 -5
  83. package/dist/{full-text-search-document-7AKd6oOw-S-rsh3SZ.mjs.map → full-text-search-document-DWzECXD--BqrLGXsX.mjs.map} +1 -1
  84. package/dist/{index-types-DfnDGeQU-BWcrd_SP.mjs → index-types-5g7gXoWK-CBvkTIbr.mjs} +3 -3
  85. package/dist/{index-types-DfnDGeQU-BWcrd_SP.mjs.map → index-types-5g7gXoWK-CBvkTIbr.mjs.map} +1 -1
  86. package/dist/{infer-psl-contract-DnTNOWZT-BwBxvl_y.mjs → infer-psl-contract-CT9H9Xnw-l2pNPAyO.mjs} +76 -21
  87. package/dist/infer-psl-contract-CT9H9Xnw-l2pNPAyO.mjs.map +1 -0
  88. package/dist/migration-Be_iuIpn.mjs.map +1 -1
  89. package/dist/{native-type-normalizer-BpTZ6sm1.mjs → native-type-normalizer-DgHcQkwl.mjs} +2 -2
  90. package/dist/{native-type-normalizer-BpTZ6sm1.mjs.map → native-type-normalizer-DgHcQkwl.mjs.map} +1 -1
  91. package/dist/{op-factory-call-DI5rMe0F-Cvj8LzGR.mjs → op-factory-call-BRaCqnFh-avSVdAgI.mjs} +13 -10
  92. package/dist/op-factory-call-BRaCqnFh-avSVdAgI.mjs.map +1 -0
  93. package/dist/operation-types-ByVoHU_s.d.mts +1 -0
  94. package/dist/{operation-types-BlaAPrew-BkZiJwPy.d.mts → operation-types-DfWYI0Cn-fXs3p9mN.d.mts} +3 -3
  95. package/dist/{operation-types-BlaAPrew-BkZiJwPy.d.mts.map → operation-types-DfWYI0Cn-fXs3p9mN.d.mts.map} +1 -1
  96. package/dist/{pack-BSTwDeu2.d.mts → pack-BPopDUvg.d.mts} +187 -103
  97. package/dist/pack-BPopDUvg.d.mts.map +1 -0
  98. package/dist/{planner-Bhde2uHk-CSZF9ODS.mjs → planner-BsLpyYHC-IEpACcdS.mjs} +10 -10
  99. package/dist/{planner-Bhde2uHk-CSZF9ODS.mjs.map → planner-BsLpyYHC-IEpACcdS.mjs.map} +1 -1
  100. package/dist/{planner-ddl-builders-BHvruDX3-Sw7yWuWE.mjs → planner-ddl-builders-Dmr6ph8i-5FWxE6Wu.mjs} +3 -3
  101. package/dist/{planner-ddl-builders-BHvruDX3-Sw7yWuWE.mjs.map → planner-ddl-builders-Dmr6ph8i-5FWxE6Wu.mjs.map} +1 -1
  102. package/dist/{planner-identity-values-Cp0Cvrg7-BxMk9Qaf.mjs → planner-identity-values-BwYhwYeo-CaSwyXgC.mjs} +3 -3
  103. package/dist/{planner-identity-values-Cp0Cvrg7-BxMk9Qaf.mjs.map → planner-identity-values-BwYhwYeo-CaSwyXgC.mjs.map} +1 -1
  104. package/dist/{planner-produced-postgres-migration-CT7o4vF9-DHyGaSfZ.mjs → planner-produced-postgres-migration-CU7D_5IE-Cv-o4-Hh.mjs} +4 -4
  105. package/dist/{planner-produced-postgres-migration-CT7o4vF9-DHyGaSfZ.mjs.map → planner-produced-postgres-migration-CU7D_5IE-Cv-o4-Hh.mjs.map} +1 -1
  106. package/dist/{planner-sql-checks-Dhx-R5GJ-GyHfROia.mjs → planner-sql-checks-DOGD6v7y-BWkRMsXt.mjs} +19 -10
  107. package/dist/{planner-sql-checks-Dhx-R5GJ-GyHfROia.mjs.map → planner-sql-checks-DOGD6v7y-BWkRMsXt.mjs.map} +1 -1
  108. package/dist/{postgres-codec-traits-BfhOLlQK-BqSX5cGp.mjs → postgres-codec-traits-BhLP9ipO-D5kVsAxr.mjs} +3 -3
  109. package/dist/{postgres-codec-traits-BfhOLlQK-BqSX5cGp.mjs.map → postgres-codec-traits-BhLP9ipO-D5kVsAxr.mjs.map} +1 -1
  110. package/dist/{postgres-contract-view-d_EYkS83-Busf8EFd.mjs → postgres-contract-view-DBmVHV5m-DDZR3cBh.mjs} +8 -8
  111. package/dist/{postgres-contract-view-d_EYkS83-Busf8EFd.mjs.map → postgres-contract-view-DBmVHV5m-DDZR3cBh.mjs.map} +1 -1
  112. package/dist/{postgres-migration-CRKs0heQ-BE95T3ql.mjs → postgres-migration-DrLpuKus-DOU9Rbkb.mjs} +11 -11
  113. package/dist/{postgres-migration-CRKs0heQ-BE95T3ql.mjs.map → postgres-migration-DrLpuKus-DOU9Rbkb.mjs.map} +1 -1
  114. package/dist/{postgres-schema-CNNW8eA3-CwosQz5e.mjs → postgres-schema-CEGf780E-cyGo2Sii.mjs} +4 -4
  115. package/dist/{postgres-schema-CNNW8eA3-CwosQz5e.mjs.map → postgres-schema-CEGf780E-cyGo2Sii.mjs.map} +1 -1
  116. package/dist/{prisma7-binding-CQXZgPCd.d.mts → prisma7-binding-BNc7RE11.d.mts} +194 -103
  117. package/dist/prisma7-binding-BNc7RE11.d.mts.map +1 -0
  118. package/dist/{prisma7-binding-BwJtshLc.mjs → prisma7-binding-BvvPWMwt.mjs} +27 -9
  119. package/dist/prisma7-binding-BvvPWMwt.mjs.map +1 -0
  120. package/dist/{render-ops-CSWpAFQI-CqyjJlzM.mjs → render-ops-CbRkpwwx-C6wSWcTl.mjs} +4 -4
  121. package/dist/{render-ops-CSWpAFQI-CqyjJlzM.mjs.map → render-ops-CbRkpwwx-C6wSWcTl.mjs.map} +1 -1
  122. package/dist/{resolve-ddl-schema-p68Q5F1u-DZAQNXpi.mjs → resolve-ddl-schema-BhOYD95_-DhUQYNLi.mjs} +3 -3
  123. package/dist/{resolve-ddl-schema-p68Q5F1u-DZAQNXpi.mjs.map → resolve-ddl-schema-BhOYD95_-DhUQYNLi.mjs.map} +1 -1
  124. package/dist/{runtime-BjS3N8LM.d.mts → runtime-BbPgK4gH.d.mts} +3 -3
  125. package/dist/{runtime-BjS3N8LM.d.mts.map → runtime-BbPgK4gH.d.mts.map} +1 -1
  126. package/dist/{runtime-DtjW0GP_.d.mts → runtime-R_BCXCp_.d.mts} +2 -2
  127. package/dist/{runtime-DtjW0GP_.d.mts.map → runtime-R_BCXCp_.d.mts.map} +1 -1
  128. package/dist/{sql-renderer-BdWJPa5F-DUvahuXZ.mjs → sql-renderer-BdWJPa5F-B8cdiqmK.mjs} +3 -3
  129. package/dist/{sql-renderer-BdWJPa5F-DUvahuXZ.mjs.map → sql-renderer-BdWJPa5F-B8cdiqmK.mjs.map} +1 -1
  130. package/dist/{sql-renderer-BiBhge7D.d.mts → sql-renderer-BnO2fkSf.d.mts} +4 -4
  131. package/dist/{sql-renderer-BiBhge7D.d.mts.map → sql-renderer-BnO2fkSf.d.mts.map} +1 -1
  132. package/dist/{sql-utils-CnnGiZBc.d.mts → sql-utils-Bq4nuPvy.d.mts} +6 -2
  133. package/dist/{sql-utils-CnnGiZBc.d.mts.map → sql-utils-Bq4nuPvy.d.mts.map} +1 -1
  134. package/dist/{sql-utils-0j_6QstU-DAfnt5Mu.mjs → sql-utils-ylvfJ1RJ-03xGdSLI.mjs} +34 -4
  135. package/dist/sql-utils-ylvfJ1RJ-03xGdSLI.mjs.map +1 -0
  136. package/dist/target.d.mts +19 -19
  137. package/dist/target.mjs +33 -33
  138. package/dist/target__codec-descriptor.d.mts +2 -2
  139. package/dist/target__codec-descriptor.mjs +1 -1
  140. package/dist/target__codec-types.d.mts +3 -3
  141. package/dist/target__codecs.d.mts +2 -2
  142. package/dist/target__codecs.mjs +2 -2
  143. package/dist/target__contract-free.mjs +3 -3
  144. package/dist/target__control.d.mts +2 -2
  145. package/dist/target__control.mjs +168 -48
  146. package/dist/target__control.mjs.map +1 -1
  147. package/dist/target__data-types.mjs +2 -2
  148. package/dist/target__diff-database-schema.mjs +1 -1
  149. package/dist/target__errors.mjs +1 -1
  150. package/dist/target__full-text-index-authoring.mjs +2 -2
  151. package/dist/target__full-text.d.mts +3 -3
  152. package/dist/target__full-text.mjs +2 -2
  153. package/dist/target__issue-planner.mjs +1 -1
  154. package/dist/target__migration.mjs +2 -2
  155. package/dist/target__native-type-normalizer.mjs +1 -1
  156. package/dist/target__op-factory-call.mjs +1 -1
  157. package/dist/target__operation-types.d.mts +2 -2
  158. package/dist/target__pack.d.mts +2 -2
  159. package/dist/target__pack.mjs +1 -1
  160. package/dist/target__planner-ddl-builders.mjs +1 -1
  161. package/dist/target__planner-identity-values.mjs +1 -1
  162. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  163. package/dist/target__planner-sql-checks.mjs +1 -1
  164. package/dist/target__planner.mjs +2 -2
  165. package/dist/target__prisma7-binding.d.mts +1 -1
  166. package/dist/target__prisma7-binding.mjs +1 -1
  167. package/dist/target__render-ops.mjs +1 -1
  168. package/dist/target__runtime.d.mts +3 -3
  169. package/dist/target__runtime.mjs +7 -7
  170. package/dist/target__runtime.mjs.map +1 -1
  171. package/dist/target__schema-ir-annotations.mjs +1 -1
  172. package/dist/target__sql-utils.d.mts +2 -2
  173. package/dist/target__sql-utils.mjs +4 -4
  174. package/dist/target__types.d.mts +3 -3
  175. package/dist/target__types.mjs +2 -2
  176. package/dist/types-CuFeRfUn.d.mts +2 -0
  177. package/dist/{types-DOmgp_12.d.mts → types-D-U10Lyo.d.mts} +2 -2
  178. package/dist/{types-DOmgp_12.d.mts.map → types-D-U10Lyo.d.mts.map} +1 -1
  179. package/dist/{types-D6lgKhE5-D1J9YJnd.d.mts → types-D6lgKhE5-BrgAgVCq.d.mts} +4 -4
  180. package/dist/{types-D6lgKhE5-D1J9YJnd.d.mts.map → types-D6lgKhE5-BrgAgVCq.d.mts.map} +1 -1
  181. package/package.json +9 -9
  182. package/dist/authoring-BYl9graG-BTI-XfEW.mjs.map +0 -1
  183. package/dist/check-expressions-BPrbjEKM-CEIP4jTS.mjs +0 -48
  184. package/dist/check-expressions-BPrbjEKM-CEIP4jTS.mjs.map +0 -1
  185. package/dist/check-expressions-CtTzM58x-LloO-5Vf.d.mts +0 -55
  186. package/dist/check-expressions-CtTzM58x-LloO-5Vf.d.mts.map +0 -1
  187. package/dist/codec-descriptor-DoR-cTFZ-BlG5Gj-X.mjs.map +0 -1
  188. package/dist/codec-descriptor-Fb3UoQGb.d.mts +0 -1
  189. package/dist/codec-descriptor-d1ByNBEk-DhrtS_5y.d.mts.map +0 -1
  190. package/dist/codec-types-CiEHACsD.d.mts +0 -2
  191. package/dist/codecs-BJBFipkV-CVMp939Z.d.mts.map +0 -1
  192. package/dist/codecs-BVyoUeNy-DZw_7n3P.mjs.map +0 -1
  193. package/dist/contract-contributions-DTGGTwRZ-DUokY6NT.mjs.map +0 -1
  194. package/dist/control-m9LWRUnY.d.mts.map +0 -1
  195. package/dist/data-types-B7S_CHZd-C9JA40Ir.mjs.map +0 -1
  196. package/dist/date-time-now-generators-C2aktlrc-uf9LqU6E.d.mts.map +0 -1
  197. package/dist/date-time-now-generators-DsGxTwjo-DTb5oTHX.mjs.map +0 -1
  198. package/dist/descriptor-meta-RxUflZY0-BNMenVO8.mjs.map +0 -1
  199. package/dist/errors-Di_apgWJ-BLXRTfFj.mjs.map +0 -1
  200. package/dist/full-text-collection-method-DHuJr46z-Bndk11cK.d.mts.map +0 -1
  201. package/dist/infer-psl-contract-DnTNOWZT-BwBxvl_y.mjs.map +0 -1
  202. package/dist/op-factory-call-DI5rMe0F-Cvj8LzGR.mjs.map +0 -1
  203. package/dist/operation-types-Bz8xX2oY.d.mts +0 -1
  204. package/dist/pack-BSTwDeu2.d.mts.map +0 -1
  205. package/dist/prisma7-binding-BwJtshLc.mjs.map +0 -1
  206. package/dist/prisma7-binding-CQXZgPCd.d.mts.map +0 -1
  207. package/dist/sql-utils-0j_6QstU-DAfnt5Mu.mjs.map +0 -1
  208. package/dist/types-BZ2l9Q5i.d.mts +0 -2
@@ -1,17 +1,17 @@
1
1
  import { A as PG_TIMESTAMP_TEMPORAL_CODEC_ID, C as PG_TEXT_CODEC_ID, D as PG_TIMESTAMP_DATE_CODEC_ID, E as PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID, I as PG_UUID_CODEC_ID, M as PG_TIME_STRING_CODEC_ID, N as PG_TIME_TEMPORAL_CODEC_ID, O as PG_TIMESTAMP_INSTANT_CODEC_ID, R as PG_VARCHAR_CODEC_ID, T as PG_TIMESTAMPTZ_STRING_CODEC_ID, a as PG_DATE_STRING_CODEC_ID, i as PG_CHAR_CODEC_ID, j as PG_TIMETZ_CODEC_ID, k as PG_TIMESTAMP_STRING_CODEC_ID, o as PG_DATE_TEMPORAL_CODEC_ID, w as PG_TIMESTAMPTZ_DATE_CODEC_ID } from "./codec-ids-D0wjQdEW-EypD_iZj.mjs";
2
- import { T as pgInt4, Z as postgresTextDataTypes } from "./data-types-B7S_CHZd-C9JA40Ir.mjs";
2
+ import { T as pgInt4, Z as postgresTextDataTypes } from "./data-types-DklKHVmp-Bl-nwUa-.mjs";
3
3
  import { t as DEFAULT_NAMESPACE_ID } from "./namespace-ids-xtp_ZY86-Cxc0dBbO.mjs";
4
- import { B as postgresQualifyColumnType } from "./codecs-BVyoUeNy-DZw_7n3P.mjs";
5
- import { h as postgresCreateNamespace } from "./postgres-schema-CNNW8eA3-CwosQz5e.mjs";
6
- import { a as postgresAuthoringTypes, c as postgresScalarAndNativeTypeConstructors, i as postgresAuthoringPslBlockDescriptors, n as postgresAuthoringEntityTypes, o as postgresLowerEntityHandles, r as postgresAuthoringModelAttributes } from "./authoring-BYl9graG-BTI-XfEW.mjs";
7
- import { t as postgresRenderCheckExpressions } from "./check-expressions-BPrbjEKM-CEIP4jTS.mjs";
8
- import { a as PLAIN_TIME_NOW_GENERATOR_ID, c as TIMETZ_NOW_GENERATOR_ID, f as postgresTargetDescriptorMetaRuntime, i as PLAIN_DATE_TIME_NOW_GENERATOR_ID, l as TIME_STRING_NOW_GENERATOR_ID, n as INSTANT_NOW_GENERATOR_ID, o as TIMESTAMPTZ_STRING_NOW_GENERATOR_ID, r as PLAIN_DATE_NOW_GENERATOR_ID, s as TIMESTAMP_STRING_NOW_GENERATOR_ID, t as DATE_STRING_NOW_GENERATOR_ID, u as postgresNowGeneratorControlDescriptors } from "./date-time-now-generators-DsGxTwjo-DTb5oTHX.mjs";
9
- import { t as postgresDataTypeEntries } from "./data-type-entries-DhUYJbVb-4NUH6vR_.mjs";
10
- import { n as postgresIndexTypes } from "./index-types-DfnDGeQU-BWcrd_SP.mjs";
4
+ import { B as postgresQualifyColumnType } from "./codecs-BqCmavY8-CC-ZbbTA.mjs";
5
+ import { h as postgresCreateNamespace } from "./postgres-schema-CEGf780E-cyGo2Sii.mjs";
6
+ import { a as postgresAuthoringTypes, c as postgresScalarAndNativeTypeConstructors, i as postgresAuthoringPslBlockDescriptors, n as postgresAuthoringEntityTypes, o as postgresLowerEntityHandles, r as postgresAuthoringModelAttributes } from "./authoring-Bm8PD9ls-clXbYDiN.mjs";
7
+ import { t as postgresRenderCheckExpressions } from "./check-expressions-C_lM7sSK-Dtv6p3hg.mjs";
8
+ import { a as PLAIN_TIME_NOW_GENERATOR_ID, c as TIMETZ_NOW_GENERATOR_ID, f as postgresTargetDescriptorMetaRuntime, i as PLAIN_DATE_TIME_NOW_GENERATOR_ID, l as TIME_STRING_NOW_GENERATOR_ID, n as INSTANT_NOW_GENERATOR_ID, o as TIMESTAMPTZ_STRING_NOW_GENERATOR_ID, r as PLAIN_DATE_NOW_GENERATOR_ID, s as TIMESTAMP_STRING_NOW_GENERATOR_ID, t as DATE_STRING_NOW_GENERATOR_ID, u as postgresNowGeneratorControlDescriptors } from "./date-time-now-generators-Cc4PvFeB-XQWJz_4f.mjs";
9
+ import { t as postgresDataTypeEntries } from "./data-type-entries-ZHPz2h_f-CNUmPGgf.mjs";
10
+ import { n as postgresIndexTypes } from "./index-types-5g7gXoWK-CBvkTIbr.mjs";
11
11
  import { idGeneratorFunctionBindings, sqlIntegerArgumentGeneratorFunctions } from "@prisma/orm-family-sql/family/pack";
12
12
  import { TIMESTAMP_NOW_GENERATOR_ID } from "@prisma/orm-framework/components/authoring";
13
13
  import { singleGeneratorBinding } from "@prisma/orm-framework/components/components";
14
- //#region ../../../3-targets/postgres/1-target/dist/descriptor-meta-RxUflZY0.mjs
14
+ //#region ../../../3-targets/postgres/1-target/dist/descriptor-meta-C2F_xt0P.mjs
15
15
  /** The "now" generator for each codec that has one. The `now` generator function binds it. */
16
16
  const postgresNowGeneratorIds = {
17
17
  [PG_DATE_TEMPORAL_CODEC_ID]: PLAIN_DATE_NOW_GENERATOR_ID,
@@ -28,13 +28,18 @@ const postgresNowGeneratorIds = {
28
28
  [PG_TIMESTAMP_INSTANT_CODEC_ID]: INSTANT_NOW_GENERATOR_ID
29
29
  };
30
30
  new Map(Object.entries(postgresNowGeneratorIds));
31
- /** The codecs whose "now" generator takes the column's precision and rounds down to it, so PostgreSQL stores the value as generated rather than rounding it up, which for a time can reach `24:00:00`. */
31
+ /** The codecs whose "now" generator takes the column's precision and rounds down to it, so PostgreSQL stores the value the client holds rather than rounding it up, which for a time can reach `24:00:00`. */
32
32
  const postgresNowGeneratorTakesPrecision = {
33
33
  [PG_TIME_TEMPORAL_CODEC_ID]: true,
34
34
  [PG_TIME_STRING_CODEC_ID]: true,
35
35
  [PG_TIMETZ_CODEC_ID]: true,
36
36
  [PG_TIMESTAMP_STRING_CODEC_ID]: true,
37
- [PG_TIMESTAMPTZ_STRING_CODEC_ID]: true
37
+ [PG_TIMESTAMPTZ_STRING_CODEC_ID]: true,
38
+ [PG_TIMESTAMPTZ_DATE_CODEC_ID]: true,
39
+ [PG_TIMESTAMP_DATE_CODEC_ID]: true,
40
+ [PG_TIMESTAMP_TEMPORAL_CODEC_ID]: true,
41
+ [PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID]: true,
42
+ [PG_TIMESTAMP_INSTANT_CODEC_ID]: true
38
43
  };
39
44
  /** The `now` generator function bound to each Postgres date and time codec, with the column's precision on the codecs that take it. */
40
45
  const postgresNowGeneratorFunction = {
@@ -97,4 +102,4 @@ const postgresTargetDescriptorMeta = {
97
102
  //#endregion
98
103
  export { postgresTargetDescriptorMeta as t };
99
104
 
100
- //# sourceMappingURL=descriptor-meta-RxUflZY0-BNMenVO8.mjs.map
105
+ //# sourceMappingURL=descriptor-meta-C2F_xt0P-D7gfqNS0.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor-meta-C2F_xt0P-D7gfqNS0.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/descriptor-meta-C2F_xt0P.mjs"],"sourcesContent":["import { A as PG_TIMESTAMP_TEMPORAL_CODEC_ID, C as PG_TEXT_CODEC_ID, D as PG_TIMESTAMP_DATE_CODEC_ID, E as PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID, I as PG_UUID_CODEC_ID, M as PG_TIME_STRING_CODEC_ID, N as PG_TIME_TEMPORAL_CODEC_ID, O as PG_TIMESTAMP_INSTANT_CODEC_ID, R as PG_VARCHAR_CODEC_ID, T as PG_TIMESTAMPTZ_STRING_CODEC_ID, a as PG_DATE_STRING_CODEC_ID, i as PG_CHAR_CODEC_ID, j as PG_TIMETZ_CODEC_ID, k as PG_TIMESTAMP_STRING_CODEC_ID, o as PG_DATE_TEMPORAL_CODEC_ID, w as PG_TIMESTAMPTZ_DATE_CODEC_ID } from \"./codec-ids-D0wjQdEW.mjs\";\nimport { B as postgresTextDataTypes, g as pgInt4 } from \"./data-types-DklKHVmp.mjs\";\nimport { t as postgresDataTypeEntries } from \"./data-type-entries-ZHPz2h_f.mjs\";\nimport { E as postgresQualifyColumnType } from \"./codecs-BqCmavY8.mjs\";\nimport { t as DEFAULT_NAMESPACE_ID } from \"./namespace-ids-xtp_ZY86.mjs\";\nimport { i as postgresCreateNamespace } from \"./postgres-schema-CEGf780E.mjs\";\nimport { a as postgresAuthoringTypes, c as postgresScalarAndNativeTypeConstructors, i as postgresAuthoringPslBlockDescriptors, n as postgresAuthoringEntityTypes, o as postgresLowerEntityHandles, r as postgresAuthoringModelAttributes } from \"./authoring-Bm8PD9ls.mjs\";\nimport { t as postgresRenderCheckExpressions } from \"./check-expressions-C_lM7sSK.mjs\";\nimport { a as PLAIN_TIME_NOW_GENERATOR_ID, c as TIMETZ_NOW_GENERATOR_ID, f as postgresTargetDescriptorMetaRuntime, i as PLAIN_DATE_TIME_NOW_GENERATOR_ID, l as TIME_STRING_NOW_GENERATOR_ID, n as INSTANT_NOW_GENERATOR_ID, o as TIMESTAMPTZ_STRING_NOW_GENERATOR_ID, r as PLAIN_DATE_NOW_GENERATOR_ID, s as TIMESTAMP_STRING_NOW_GENERATOR_ID, t as DATE_STRING_NOW_GENERATOR_ID, u as postgresNowGeneratorControlDescriptors } from \"./date-time-now-generators-Cc4PvFeB.mjs\";\nimport { n as postgresIndexTypes } from \"./index-types-5g7gXoWK.mjs\";\nimport { idGeneratorFunctionBindings, sqlIntegerArgumentGeneratorFunctions } from \"@internal/family-sql/pack\";\nimport { TIMESTAMP_NOW_GENERATOR_ID } from \"@internal/framework-components/authoring\";\nimport { singleGeneratorBinding } from \"@internal/framework-components/components\";\n//#region src/core/now-generators.ts\n/** The \"now\" generator for each codec that has one. The `now` generator function binds it. */\nconst postgresNowGeneratorIds = {\n\t[PG_DATE_TEMPORAL_CODEC_ID]: PLAIN_DATE_NOW_GENERATOR_ID,\n\t[PG_DATE_STRING_CODEC_ID]: DATE_STRING_NOW_GENERATOR_ID,\n\t[PG_TIME_TEMPORAL_CODEC_ID]: PLAIN_TIME_NOW_GENERATOR_ID,\n\t[PG_TIME_STRING_CODEC_ID]: TIME_STRING_NOW_GENERATOR_ID,\n\t[PG_TIMETZ_CODEC_ID]: TIMETZ_NOW_GENERATOR_ID,\n\t[PG_TIMESTAMP_TEMPORAL_CODEC_ID]: PLAIN_DATE_TIME_NOW_GENERATOR_ID,\n\t[PG_TIMESTAMP_STRING_CODEC_ID]: TIMESTAMP_STRING_NOW_GENERATOR_ID,\n\t[PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID]: INSTANT_NOW_GENERATOR_ID,\n\t[PG_TIMESTAMPTZ_STRING_CODEC_ID]: TIMESTAMPTZ_STRING_NOW_GENERATOR_ID,\n\t[PG_TIMESTAMPTZ_DATE_CODEC_ID]: TIMESTAMP_NOW_GENERATOR_ID,\n\t[PG_TIMESTAMP_DATE_CODEC_ID]: TIMESTAMP_NOW_GENERATOR_ID,\n\t[PG_TIMESTAMP_INSTANT_CODEC_ID]: INSTANT_NOW_GENERATOR_ID\n};\nnew Map(Object.entries(postgresNowGeneratorIds));\n/** The codecs whose \"now\" generator takes the column's precision and rounds down to it, so PostgreSQL stores the value the client holds rather than rounding it up, which for a time can reach `24:00:00`. */\nconst postgresNowGeneratorTakesPrecision = {\n\t[PG_TIME_TEMPORAL_CODEC_ID]: true,\n\t[PG_TIME_STRING_CODEC_ID]: true,\n\t[PG_TIMETZ_CODEC_ID]: true,\n\t[PG_TIMESTAMP_STRING_CODEC_ID]: true,\n\t[PG_TIMESTAMPTZ_STRING_CODEC_ID]: true,\n\t[PG_TIMESTAMPTZ_DATE_CODEC_ID]: true,\n\t[PG_TIMESTAMP_DATE_CODEC_ID]: true,\n\t[PG_TIMESTAMP_TEMPORAL_CODEC_ID]: true,\n\t[PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID]: true,\n\t[PG_TIMESTAMP_INSTANT_CODEC_ID]: true\n};\n/** The `now` generator function bound to each Postgres date and time codec, with the column's precision on the codecs that take it. */\nconst postgresNowGeneratorFunction = {\n\tname: \"now\",\n\tbindings: Object.entries(postgresNowGeneratorIds).map(([codecId, generatorId]) => singleGeneratorBinding({\n\t\tcodecIds: [codecId],\n\t\tgeneratorId,\n\t\tparamsFromField: (column) => {\n\t\t\tconst precision = column.typeParams?.[\"precision\"];\n\t\t\treturn Object.hasOwn(postgresNowGeneratorTakesPrecision, codecId) && typeof precision === \"number\" ? { precision } : void 0;\n\t\t}\n\t}))\n};\n//#endregion\n//#region src/core/generator-functions.ts\nconst postgresGeneratorFunctions = [\n\t...sqlIntegerArgumentGeneratorFunctions({ integer: pgInt4.id }),\n\tpostgresNowGeneratorFunction,\n\t...idGeneratorFunctionBindings({\n\t\ttext: [\n\t\t\tPG_CHAR_CODEC_ID,\n\t\t\tPG_VARCHAR_CODEC_ID,\n\t\t\tPG_TEXT_CODEC_ID\n\t\t],\n\t\tuuid: [PG_UUID_CODEC_ID]\n\t})\n];\n/** The `now` generators Postgres binds. The SQL family registers the identifier generators. */\nconst postgresGeneratorDescriptors = [{ id: TIMESTAMP_NOW_GENERATOR_ID }, ...postgresNowGeneratorControlDescriptors()];\nconst postgresTargetDescriptorMeta = {\n\t...postgresTargetDescriptorMetaRuntime,\n\tdefaultNamespaceId: DEFAULT_NAMESPACE_ID,\n\tsupportsNamespaces: true,\n\tdisplayName: \"Postgres\",\n\tindexTypes: postgresIndexTypes,\n\tauthoring: {\n\t\ttype: {\n\t\t\t...postgresScalarAndNativeTypeConstructors,\n\t\t\t...postgresAuthoringTypes\n\t\t},\n\t\tdataTypes: postgresDataTypeEntries(),\n\t\ttextDataTypes: postgresTextDataTypes,\n\t\tentityTypes: postgresAuthoringEntityTypes,\n\t\tpslBlockDescriptors: postgresAuthoringPslBlockDescriptors,\n\t\tmodelAttributes: postgresAuthoringModelAttributes,\n\t\tcreateNamespace: postgresCreateNamespace,\n\t\tqualifyColumnType: postgresQualifyColumnType,\n\t\trenderCheckExpressions: postgresRenderCheckExpressions,\n\t\tlowerEntityHandles: postgresLowerEntityHandles\n\t},\n\tgeneratorFunctions: postgresGeneratorFunctions,\n\tcontrolMutationDefaults: {\n\t\tdefaultFunctionRegistry: /* @__PURE__ */ new Map(),\n\t\tgeneratorDescriptors: postgresGeneratorDescriptors\n\t},\n\ttypes: { queryOperationTypes: { import: {\n\t\tpackage: \"@internal/target-postgres/operation-types\",\n\t\tnamed: \"QueryOperationTypes\",\n\t\talias: \"PgTargetQueryOps\"\n\t} } }\n};\n//#endregion\nexport { postgresTargetDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-C2F_xt0P.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,0BAA0B;EAC9B,4BAA4B;EAC5B,0BAA0B;EAC1B,4BAA4B;EAC5B,0BAA0B;EAC1B,qBAAqB;EACrB,iCAAiC;EACjC,+BAA+B;EAC/B,mCAAmC;EACnC,iCAAiC;EACjC,+BAA+B;EAC/B,6BAA6B;EAC7B,gCAAgC;AAClC;AACA,IAAI,IAAI,OAAO,QAAQ,uBAAuB,CAAC;;AAE/C,MAAM,qCAAqC;EACzC,4BAA4B;EAC5B,0BAA0B;EAC1B,qBAAqB;EACrB,+BAA+B;EAC/B,iCAAiC;EACjC,+BAA+B;EAC/B,6BAA6B;EAC7B,iCAAiC;EACjC,mCAAmC;EACnC,gCAAgC;AAClC;;AAEA,MAAM,+BAA+B;CACpC,MAAM;CACN,UAAU,OAAO,QAAQ,uBAAuB,CAAC,CAAC,KAAK,CAAC,SAAS,iBAAiB,uBAAuB;EACxG,UAAU,CAAC,OAAO;EAClB;EACA,kBAAkB,WAAW;GAC5B,MAAM,YAAY,OAAO,aAAa;GACtC,OAAO,OAAO,OAAO,oCAAoC,OAAO,KAAK,OAAO,cAAc,WAAW,EAAE,UAAU,IAAI,KAAK;EAC3H;CACD,CAAC,CAAC;AACH;AAGA,MAAM,6BAA6B;CAClC,GAAG,qCAAqC,EAAE,SAAS,OAAO,GAAG,CAAC;CAC9D;CACA,GAAG,4BAA4B;EAC9B,MAAM;GACL;GACA;GACA;EACD;EACA,MAAM,CAAC,gBAAgB;CACxB,CAAC;AACF;;AAEA,MAAM,+BAA+B,CAAC,EAAE,IAAI,2BAA2B,GAAG,GAAG,uCAAuC,CAAC;AACrH,MAAM,+BAA+B;CACpC,GAAG;CACH,oBAAoB;CACpB,oBAAoB;CACpB,aAAa;CACb,YAAY;CACZ,WAAW;EACV,MAAM;GACL,GAAG;GACH,GAAG;EACJ;EACA,WAAW,wBAAwB;EACnC,eAAe;EACf,aAAa;EACb,qBAAqB;EACrB,iBAAiB;EACjB,iBAAiB;EACjB,mBAAmB;EACnB,wBAAwB;EACxB,oBAAoB;CACrB;CACA,oBAAoB;CACpB,yBAAyB;EACxB,yCAAyC,IAAI,IAAI;EACjD,sBAAsB;CACvB;CACA,OAAO,EAAE,qBAAqB,EAAE,QAAQ;EACvC,SAAS;EACT,OAAO;EACP,OAAO;CACR,EAAE,EAAE;AACL"}
@@ -1,6 +1,6 @@
1
- import { o as postgresCodecRegistry } from "./codec-registry-D8Nsfksc-B5zXDblI.mjs";
2
- import { r as postgresAdapterContractContributions } from "./contract-contributions-DTGGTwRZ-DUokY6NT.mjs";
3
- //#region ../../../3-targets/postgres/2-adapter/dist/descriptor-meta-I7Ih-0hE.mjs
1
+ import { o as postgresCodecRegistry } from "./codec-registry-DVjibYBY-BeOUp5fk.mjs";
2
+ import { r as postgresAdapterContractContributions } from "./contract-contributions-rxCSM_1W-d9oohAzB.mjs";
3
+ //#region ../../../3-targets/postgres/2-adapter/dist/descriptor-meta-C2YuDfV8.mjs
4
4
  const postgresAdapterDescriptorMeta = {
5
5
  kind: "adapter",
6
6
  familyId: "sql",
@@ -33,4 +33,4 @@ const postgresAdapterDescriptorMeta = {
33
33
  //#endregion
34
34
  export { postgresAdapterDescriptorMeta as t };
35
35
 
36
- //# sourceMappingURL=descriptor-meta-I7Ih-0hE-BzEpKpQF.mjs.map
36
+ //# sourceMappingURL=descriptor-meta-C2YuDfV8-B_u19j25.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"descriptor-meta-I7Ih-0hE-BzEpKpQF.mjs","names":[],"sources":["../../../../3-targets/postgres/2-adapter/dist/descriptor-meta-I7Ih-0hE.mjs"],"sourcesContent":["import { t as postgresAdapterContractContributions } from \"./contract-contributions-DTGGTwRZ.mjs\";\nimport { postgresCodecRegistry } from \"@internal/target-postgres/codecs\";\n//#region src/core/descriptor-meta.ts\nconst postgresAdapterDescriptorMeta = {\n\tkind: \"adapter\",\n\tfamilyId: \"sql\",\n\ttargetId: \"postgres\",\n\tid: \"postgres\",\n\tversion: \"0.0.1\",\n\tcapabilities: postgresAdapterContractContributions.capabilities,\n\ttypes: {\n\t\taggregateDescriptors: postgresAdapterContractContributions.types.aggregateDescriptors,\n\t\tcodecTypes: {\n\t\t\tcodecDescriptors: Array.from(postgresCodecRegistry.values()),\n\t\t\timport: {\n\t\t\t\tpackage: \"@internal/target-postgres/codec-types\",\n\t\t\t\tnamed: \"CodecTypes\",\n\t\t\t\talias: \"PgTypes\"\n\t\t\t},\n\t\t\ttypeImports: [{\n\t\t\t\tpackage: \"@internal/target-postgres/codec-types\",\n\t\t\t\tnamed: \"JsonValue\",\n\t\t\t\talias: \"JsonValue\"\n\t\t\t}],\n\t\t\tparameterizedOutputTypes: {\n\t\t\t\tpackage: \"@internal/target-postgres/codec-types\",\n\t\t\t\tnamed: \"ParameterizedOutputTypesForTypeParams\",\n\t\t\t\talias: \"PgParameterizedOutputTypes\"\n\t\t\t}\n\t\t}\n\t}\n};\n//#endregion\nexport { postgresAdapterDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-I7Ih-0hE.mjs.map"],"mappings":";;;AAGA,MAAM,gCAAgC;CACrC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,qCAAqC;CACnD,OAAO;EACN,sBAAsB,qCAAqC,MAAM;EACjE,YAAY;GACX,kBAAkB,MAAM,KAAK,sBAAsB,OAAO,CAAC;GAC3D,QAAQ;IACP,SAAS;IACT,OAAO;IACP,OAAO;GACR;GACA,aAAa,CAAC;IACb,SAAS;IACT,OAAO;IACP,OAAO;GACR,CAAC;GACD,0BAA0B;IACzB,SAAS;IACT,OAAO;IACP,OAAO;GACR;EACD;CACD;AACD"}
1
+ {"version":3,"file":"descriptor-meta-C2YuDfV8-B_u19j25.mjs","names":[],"sources":["../../../../3-targets/postgres/2-adapter/dist/descriptor-meta-C2YuDfV8.mjs"],"sourcesContent":["import { t as postgresAdapterContractContributions } from \"./contract-contributions-rxCSM_1W.mjs\";\nimport { postgresCodecRegistry } from \"@internal/target-postgres/codecs\";\n//#region src/core/descriptor-meta.ts\nconst postgresAdapterDescriptorMeta = {\n\tkind: \"adapter\",\n\tfamilyId: \"sql\",\n\ttargetId: \"postgres\",\n\tid: \"postgres\",\n\tversion: \"0.0.1\",\n\tcapabilities: postgresAdapterContractContributions.capabilities,\n\ttypes: {\n\t\taggregateDescriptors: postgresAdapterContractContributions.types.aggregateDescriptors,\n\t\tcodecTypes: {\n\t\t\tcodecDescriptors: Array.from(postgresCodecRegistry.values()),\n\t\t\timport: {\n\t\t\t\tpackage: \"@internal/target-postgres/codec-types\",\n\t\t\t\tnamed: \"CodecTypes\",\n\t\t\t\talias: \"PgTypes\"\n\t\t\t},\n\t\t\ttypeImports: [{\n\t\t\t\tpackage: \"@internal/target-postgres/codec-types\",\n\t\t\t\tnamed: \"JsonValue\",\n\t\t\t\talias: \"JsonValue\"\n\t\t\t}],\n\t\t\tparameterizedOutputTypes: {\n\t\t\t\tpackage: \"@internal/target-postgres/codec-types\",\n\t\t\t\tnamed: \"ParameterizedOutputTypesForTypeParams\",\n\t\t\t\talias: \"PgParameterizedOutputTypes\"\n\t\t\t}\n\t\t}\n\t}\n};\n//#endregion\nexport { postgresAdapterDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-C2YuDfV8.mjs.map"],"mappings":";;;AAGA,MAAM,gCAAgC;CACrC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,qCAAqC;CACnD,OAAO;EACN,sBAAsB,qCAAqC,MAAM;EACjE,YAAY;GACX,kBAAkB,MAAM,KAAK,sBAAsB,OAAO,CAAC;GAC3D,QAAQ;IACP,SAAS;IACT,OAAO;IACP,OAAO;GACR;GACA,aAAa,CAAC;IACb,SAAS;IACT,OAAO;IACP,OAAO;GACR,CAAC;GACD,0BAA0B;IACzB,SAAS;IACT,OAAO;IACP,OAAO;GACR;EACD;CACD;AACD"}
@@ -1,13 +1,13 @@
1
- import { l as postgresError } from "./errors-Di_apgWJ-BLXRTfFj.mjs";
2
- import { n as FULL_TEXT_INDEX_TYPE, s as fullTextIndexDefinitionOf } from "./full-text-index-definition-B0kQDs_M-8N6Slj3l.mjs";
3
- import { d as isPostgresSchema } from "./postgres-schema-CNNW8eA3-CwosQz5e.mjs";
4
- import { t as postgresAccessMethodOf } from "./index-types-DfnDGeQU-BWcrd_SP.mjs";
1
+ import { l as postgresError } from "./errors-DG6xgXgr-Cb1XcPcb.mjs";
2
+ import { n as FULL_TEXT_INDEX_TYPE, s as fullTextIndexDefinitionOf } from "./full-text-index-definition-BRNRSgZK-l_2TBarg.mjs";
3
+ import { d as isPostgresSchema } from "./postgres-schema-CEGf780E-cyGo2Sii.mjs";
4
+ import { t as postgresAccessMethodOf } from "./index-types-5g7gXoWK-CBvkTIbr.mjs";
5
5
  import { a as postgresDiffSubjectGranularity, n as PostgresSchemaNodeKind, r as PostgresTableSchemaNode, t as PostgresNativeEnumSchemaNode } from "./postgres-table-schema-node-BBkitBQh-Dll8iaZT.mjs";
6
6
  import { i as PostgresRoleSchemaNode, n as PostgresNamespaceSchemaNode, r as PostgresPolicySchemaNode, t as PostgresDatabaseSchemaNode } from "./postgres-role-schema-node-B8Z5i5D--BzOKm4N1.mjs";
7
7
  import { t as postgresResolveDefault } from "./default-normalizer-BqK6XxdC-2OUb2ybG.mjs";
8
- import { n as renderFullTextIndexDocument } from "./full-text-search-document-7AKd6oOw-S-rsh3SZ.mjs";
9
- import { r as resolveDdlSchemaForNamespaceStorage } from "./resolve-ddl-schema-p68Q5F1u-DZAQNXpi.mjs";
10
- import { d as resolvePostgresNodeIssueControlPolicySubject } from "./control-policy-D9yEV-XI-CCDB2v5g.mjs";
8
+ import { n as renderFullTextIndexDocument } from "./full-text-search-document-DWzECXD--BqrLGXsX.mjs";
9
+ import { r as resolveDdlSchemaForNamespaceStorage } from "./resolve-ddl-schema-BhOYD95_-DhUQYNLi.mjs";
10
+ import { d as resolvePostgresNodeIssueControlPolicySubject } from "./control-policy-BncmQ6LO-B8SXRfP_.mjs";
11
11
  import { blindCast } from "@prisma/orm-framework/utils/casts";
12
12
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
13
13
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
@@ -16,7 +16,7 @@ import { namingOf } from "@prisma/orm-family-sql/schema-ir/naming";
16
16
  import { PrimaryKey, RelationalSchemaNodeKind, SqlForeignKeyIR, SqlIndexIR, SqlUniqueIR } from "@prisma/orm-family-sql/schema-ir/types";
17
17
  import { contractNamespaceToSchemaIR, sqlTypeLookupsOf } from "@prisma/orm-family-sql/family/control";
18
18
  import { classifyDiffSubjectGranularity } from "@prisma/orm-family-sql/family/diff";
19
- //#region ../../../3-targets/postgres/1-target/dist/diff-database-schema-j18Gm75j.mjs
19
+ //#region ../../../3-targets/postgres/1-target/dist/diff-database-schema-CcR7BN-A.mjs
20
20
  /** The database root's fixed sentinel id (`PostgresDatabaseSchemaNode#id`). */
21
21
  function databaseStep() {
22
22
  return {
@@ -407,4 +407,4 @@ function buildPostgresPlanDiff(input) {
407
407
  //#endregion
408
408
  export { contractToPostgresDatabaseSchemaNode as n, diffPostgresSchema as r, buildPostgresPlanDiff as t };
409
409
 
410
- //# sourceMappingURL=diff-database-schema-j18Gm75j-CNAELOTU.mjs.map
410
+ //# sourceMappingURL=diff-database-schema-CcR7BN-A-BuftnIR2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"diff-database-schema-j18Gm75j-CNAELOTU.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/diff-database-schema-j18Gm75j.mjs"],"sourcesContent":["import { l as postgresError } from \"./errors-Di_apgWJ.mjs\";\nimport { i as fullTextIndexDefinitionOf, t as FULL_TEXT_INDEX_TYPE } from \"./full-text-index-definition-B0kQDs_M.mjs\";\nimport { r as isPostgresSchema } from \"./postgres-schema-CNNW8eA3.mjs\";\nimport { t as postgresAccessMethodOf } from \"./index-types-DfnDGeQU.mjs\";\nimport { t as postgresResolveDefault } from \"./default-normalizer-BqK6XxdC.mjs\";\nimport { a as postgresDiffSubjectGranularity, n as PostgresNativeEnumSchemaNode, r as PostgresSchemaNodeKind, t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-BBkitBQh.mjs\";\nimport { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode, t as PostgresRoleSchemaNode } from \"./postgres-role-schema-node-B8Z5i5D-.mjs\";\nimport { n as renderFullTextIndexDocument } from \"./full-text-search-document-7AKd6oOw.mjs\";\nimport { r as resolveDdlSchemaForNamespaceStorage } from \"./resolve-ddl-schema-p68Q5F1u.mjs\";\nimport { i as resolvePostgresNodeIssueControlPolicySubject } from \"./control-policy-D9yEV-XI.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { diffSchemas, issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { namingOf } from \"@internal/sql-schema-ir/naming\";\nimport { contractNamespaceToSchemaIR, sqlTypeLookupsOf } from \"@internal/family-sql/control\";\nimport { classifyDiffSubjectGranularity } from \"@internal/family-sql/diff\";\nimport { PrimaryKey, RelationalSchemaNodeKind, SqlForeignKeyIR, SqlIndexIR, SqlUniqueIR } from \"@internal/sql-schema-ir/types\";\n//#region src/core/migrations/contract-to-postgres-database-schema-node.ts\n/** The database root's fixed sentinel id (`PostgresDatabaseSchemaNode#id`). */\nfunction databaseStep() {\n\treturn {\n\t\tnodeKind: PostgresSchemaNodeKind.database,\n\t\tid: \"database\"\n\t};\n}\nfunction tableDependsOn(namespaceId, tableName) {\n\treturn [\n\t\tdatabaseStep(),\n\t\t{\n\t\t\tnodeKind: PostgresSchemaNodeKind.namespace,\n\t\t\tid: namespaceId\n\t\t},\n\t\t{\n\t\t\tnodeKind: PostgresSchemaNodeKind.table,\n\t\t\tid: tableName\n\t\t}\n\t];\n}\nfunction roleDependsOn(role) {\n\treturn [databaseStep(), {\n\t\tnodeKind: PostgresSchemaNodeKind.role,\n\t\tid: role\n\t}];\n}\n/**\n* The chains from a table-child object (foreign key, index, unique, primary\n* key) to each of the own columns it is built on, in the Postgres tree.\n* Dropping a covered column auto-drops the object, so the object's drop must\n* precede the column's; the graph derives that direction from these edges.\n*/\nfunction columnDependsOn(namespaceId, tableName, columns) {\n\treturn columns.map((column) => [...tableDependsOn(namespaceId, tableName), {\n\t\tnodeKind: RelationalSchemaNodeKind.column,\n\t\tid: `column:${column}`\n\t}]);\n}\nfunction toPolicyNode(policy, namespaceId) {\n\treturn new PostgresPolicySchemaNode({\n\t\tnaming: namingOf(policy.name, policy.prefix),\n\t\ttableName: policy.tableName,\n\t\tnamespaceId,\n\t\toperation: policy.operation,\n\t\troles: [...policy.roles],\n\t\tusing: policy.using,\n\t\twithCheck: policy.withCheck,\n\t\tpermissive: policy.permissive,\n\t\tdependsOn: [tableDependsOn(namespaceId, policy.tableName), ...policy.roles.map(roleDependsOn)]\n\t});\n}\n/**\n* Projects a Postgres contract into the expected schema-diff tree: a\n* `PostgresDatabaseSchemaNode` root holding one `PostgresNamespaceSchemaNode`\n* per Postgres namespace, each holding its `PostgresTableSchemaNode`s with\n* their `PostgresPolicySchemaNode`s, plus the database roles on the root.\n*\n* Not a duplicate of the family's `contractToSchemaIR`: that builds a flat,\n* single `{ tables }` map (and throws on cross-namespace name collisions, with\n* no RLS/role concept) for SQLite's single-schema world. This is the\n* Postgres-specific *tree* shape — multi-schema, RLS-policy-aware, role-aware.\n* It reuses the family's per-namespace table conversion (`contractNamespaceToSchemaIR`)\n* for column/FK/index building and only adds the Postgres tree/policy/role shape.\n*\n* Tables are grouped by their owning namespace (resolved DDL schema name) so\n* the tree mirrors Postgres's object hierarchy. The DDL schema name is\n* resolved once per namespace.\n*\n* A policy that references a table absent from its namespace is a malformed\n* contract — the loop throws rather than fabricating a stub table.\n*/\nfunction contractToPostgresDatabaseSchemaNode(contract, options) {\n\tif (contract === null) return new PostgresDatabaseSchemaNode({\n\t\tnamespaces: {},\n\t\troles: [],\n\t\texistingSchemas: [],\n\t\tpgVersion: \"\"\n\t});\n\tconst namespaces = {};\n\tconst roles = [];\n\tconst ownedSchemas = [];\n\tfor (const ns of Object.values(contract.storage.namespaces)) {\n\t\tif (!isPostgresSchema(ns)) continue;\n\t\tfor (const role of Object.values(ns.role)) roles.push(new PostgresRoleSchemaNode({\n\t\t\tname: role.name,\n\t\t\tnamespaceId: role.namespaceId\n\t\t}));\n\t\tif (ns.id === UNBOUND_NAMESPACE_ID) {\n\t\t\tif (!Object.entries(ns.entries).some(([entriesKey, slot]) => entriesKey !== \"role\" && Object.keys(slot).length > 0)) continue;\n\t\t}\n\t\tconst ddlSchema = resolveDdlSchemaForNamespaceStorage(contract.storage, ns.id);\n\t\townedSchemas.push(ddlSchema);\n\t\tconst sqlTables = contractNamespaceToSchemaIR(contract.storage, ns.id, options).tables;\n\t\tconst policiesByTable = /* @__PURE__ */ new Map();\n\t\tfor (const policy of Object.values(ns.policy)) {\n\t\t\tconst list = policiesByTable.get(policy.tableName) ?? [];\n\t\t\tlist.push(toPolicyNode(policy, ddlSchema));\n\t\t\tpoliciesByTable.set(policy.tableName, list);\n\t\t}\n\t\tconst tables = {};\n\t\tfor (const tableName of Object.keys(ns.table)) {\n\t\t\tconst sqlTable = sqlTables[tableName];\n\t\t\tif (sqlTable === void 0) continue;\n\t\t\tconst foreignKeys = sqlTable.foreignKeys.map((fk) => {\n\t\t\t\tconst resolvedReferencedNamespace = resolveDdlSchemaForNamespaceStorage(contract.storage, fk.referencedSchema ?? UNBOUND_NAMESPACE_ID);\n\t\t\t\treturn new SqlForeignKeyIR({\n\t\t\t\t\tcolumns: fk.columns,\n\t\t\t\t\treferencedTable: fk.referencedTable,\n\t\t\t\t\treferencedColumns: fk.referencedColumns,\n\t\t\t\t\treferencedSchema: fk.referencedSchema ?? UNBOUND_NAMESPACE_ID,\n\t\t\t\t\t...ifDefined(\"name\", fk.name),\n\t\t\t\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t\t\t\t...ifDefined(\"onUpdate\", fk.onUpdate),\n\t\t\t\t\t...ifDefined(\"annotations\", fk.annotations),\n\t\t\t\t\tresolvedReferencedNamespace,\n\t\t\t\t\tdependsOn: [tableDependsOn(resolvedReferencedNamespace, fk.referencedTable), ...columnDependsOn(ddlSchema, tableName, fk.columns)]\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst uniques = sqlTable.uniques.map((u) => new SqlUniqueIR({\n\t\t\t\tcolumns: u.columns,\n\t\t\t\t...ifDefined(\"name\", u.name),\n\t\t\t\t...ifDefined(\"annotations\", u.annotations),\n\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, u.columns)\n\t\t\t}));\n\t\t\tconst indexes = sqlTable.indexes.map((i) => {\n\t\t\t\tconst fullText = fullTextIndexDefinitionOf(i);\n\t\t\t\tif (fullText !== void 0) return new SqlIndexIR({\n\t\t\t\t\tnaming: namingOf(i.name, i.prefix),\n\t\t\t\t\twhere: i.where,\n\t\t\t\t\tunique: i.unique,\n\t\t\t\t\tpartial: i.partial,\n\t\t\t\t\ttype: postgresAccessMethodOf(FULL_TEXT_INDEX_TYPE),\n\t\t\t\t\toptions: void 0,\n\t\t\t\t\tannotations: i.annotations,\n\t\t\t\t\texpression: renderFullTextIndexDocument(fullText),\n\t\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, fullText.weightGroups.flat())\n\t\t\t\t});\n\t\t\t\tconst base = {\n\t\t\t\t\tnaming: namingOf(i.name, i.prefix),\n\t\t\t\t\twhere: i.where,\n\t\t\t\t\tunique: i.unique,\n\t\t\t\t\tpartial: i.partial,\n\t\t\t\t\ttype: i.type,\n\t\t\t\t\toptions: i.options,\n\t\t\t\t\tannotations: i.annotations,\n\t\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, i.columns ?? Object.keys(sqlTable.columns))\n\t\t\t\t};\n\t\t\t\treturn new SqlIndexIR(i.expression !== void 0 ? {\n\t\t\t\t\t...base,\n\t\t\t\t\texpression: i.expression\n\t\t\t\t} : {\n\t\t\t\t\t...base,\n\t\t\t\t\tcolumns: i.columns ?? []\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst primaryKey = sqlTable.primaryKey !== void 0 ? new PrimaryKey({\n\t\t\t\tcolumns: sqlTable.primaryKey.columns,\n\t\t\t\t...ifDefined(\"name\", sqlTable.primaryKey.name),\n\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, sqlTable.primaryKey.columns)\n\t\t\t}) : void 0;\n\t\t\ttables[tableName] = new PostgresTableSchemaNode({\n\t\t\t\tname: sqlTable.name,\n\t\t\t\tcolumns: sqlTable.columns,\n\t\t\t\tforeignKeys,\n\t\t\t\tuniques,\n\t\t\t\tindexes,\n\t\t\t\t...ifDefined(\"primaryKey\", primaryKey),\n\t\t\t\t...ifDefined(\"annotations\", sqlTable.annotations),\n\t\t\t\t...ifDefined(\"checks\", sqlTable.checks),\n\t\t\t\tpolicies: policiesByTable.get(tableName) ?? [],\n\t\t\t\trlsEnabled: Object.hasOwn(ns.rls, tableName)\n\t\t\t});\n\t\t}\n\t\tfor (const [tableName, tablePolicies] of policiesByTable) {\n\t\t\tif (!(tableName in tables)) {\n\t\t\t\tconst policyName = tablePolicies[0]?.name ?? \"(unknown)\";\n\t\t\t\tthrow postgresError(\"CONTRACT.POLICY_INVALID\", `contract-to-postgres-database-schema-node: policy \"${policyName}\" references table \"${tableName}\" not present in namespace \"${ddlSchema}\"`, { meta: {\n\t\t\t\t\tpolicyName,\n\t\t\t\t\ttableName,\n\t\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\t\treason: \"table-missing\"\n\t\t\t\t} });\n\t\t\t}\n\t\t\tif (!Object.hasOwn(ns.rls, tableName)) {\n\t\t\t\tconst policyLabel = tablePolicies[0]?.prefix ?? tablePolicies[0]?.name ?? \"(unknown)\";\n\t\t\t\tthrow postgresError(\"CONTRACT.POLICY_INVALID\", `contract-to-postgres-database-schema-node: policy \"${policyLabel}\" targets table \"${tableName}\" in namespace \"${ddlSchema}\", which is not RLS-controlled. Mark the model with @@rls (entries.rls[\"${tableName}\"]) or remove the policy.`, { meta: {\n\t\t\t\t\tpolicyName: policyLabel,\n\t\t\t\t\ttableName,\n\t\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\t\treason: \"table-not-rls-controlled\"\n\t\t\t\t} });\n\t\t\t}\n\t\t}\n\t\tnamespaces[ddlSchema] = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: ddlSchema,\n\t\t\ttables,\n\t\t\tnativeEnums: Object.values(ns.entries.native_enum ?? {}).map((entity) => new PostgresNativeEnumSchemaNode({\n\t\t\t\ttypeName: entity.typeName,\n\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\tmembers: entity.members,\n\t\t\t\t...ifDefined(\"control\", entity.control)\n\t\t\t}))\n\t\t});\n\t}\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles,\n\t\texistingSchemas: ownedSchemas,\n\t\tpgVersion: \"\"\n\t});\n}\n//#endregion\n//#region src/core/migrations/diff-database-schema.ts\n/**\n* Whether a diff issue's subject node is cluster-scoped — it carries its own\n* `namespaceId` field (only role and policy diff nodes do) and that\n* coordinate is the unbound sentinel, meaning the node is not owned by any\n* schema/namespace. A role node is always cluster-scoped (roles are\n* cluster-level objects); a policy node's `namespaceId` is always its\n* table's resolved DDL schema, never the sentinel. Namespace-ownership\n* scoping (which compares `issue.path[1]` against the set of DDL schemas\n* the contract owns) makes no sense for a cluster-scoped subject — its path\n* segment at that index is the object's own name, not a schema name — so\n* such an issue bypasses that scoping entirely.\n*/\nfunction isClusterScopedIssue(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\treturn node !== void 0 && nodeNamespaceId(node) === UNBOUND_NAMESPACE_ID;\n}\nfunction nodeNamespaceId(node) {\n\tif (!Object.hasOwn(node, \"namespaceId\")) return void 0;\n\treturn blindCast(node).namespaceId;\n}\nfunction ownedSchemaNames(expected) {\n\tconst policyNamespaces = Object.values(expected.namespaces).flatMap((ns) => Object.values(ns.tables).flatMap((t) => t.policies.map((p) => p.namespaceId)));\n\treturn /* @__PURE__ */ new Set([...policyNamespaces, ...expected.existingSchemas]);\n}\n/**\n* Drops contract namespaces that declare no tables from the verdict-diff\n* expected tree and the relational owned-schema set. The legacy relational\n* walk skipped a table-less namespace (e.g. an enums-only schema) before\n* pairing, so neither its DDL schema's absence nor that schema's live\n* relational contents ever reached the verdict — the pruned tree\n* reproduces that. The prune loses no expected policies: policies attach\n* to tables, so a table-less namespace carries none (the projection\n* throws on a policy referencing an absent table). Live policies in a\n* pruned schema remain governed via the full owned set (see\n* {@link diffPostgresSchema}).\n*/\nfunction pruneTableLessNamespaces(expected) {\n\tconst namespaces = Object.fromEntries(Object.entries(expected.namespaces).filter(([, ns]) => Object.keys(ns.tables).length > 0));\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles: [...expected.roles],\n\t\texistingSchemas: expected.existingSchemas.filter((s) => namespaces[s] !== void 0),\n\t\tpgVersion: expected.pgVersion\n\t});\n}\n/**\n* Resolves a verdict-diff issue's subject's declared control policy directly\n* from the contract, by delegating to the same node-typed resolver\n* ({@link resolvePostgresNodeIssueControlPolicySubject}) the planner uses to\n* gate DDL calls. `undefined` when the issue resolves to no contract subject.\n*\n* A role issue resolves through that same resolver to `external`\n* unconditionally (see its role branch), regardless of the contract's own\n* default policy: a role is referenced by the contract but not owned, and\n* `external`'s existing semantics — a missing declared subject still fails,\n* every extra is suppressed — are exactly the wanted asymmetric grading for\n* a cluster object the framework does not own.\n*/\nfunction resolveControlPolicy(issue, contract) {\n\treturn resolvePostgresNodeIssueControlPolicySubject(blindCast(issue), contract)?.explicitNodeControlPolicy;\n}\n/**\n* The Postgres full-tree node diff for the family verify verdict: derive\n* the expected tree (resolved leaf values, FK schemas\n* resolved, table-less namespaces pruned), run the generic\n* differ over the trees as derived, and scope out `not-expected` findings under namespaces the\n* contract does not own. Ownership scoping bypasses cluster-scoped subjects\n* (roles today), mirroring the legacy decomposition: relational extras check\n* the PRUNED owned set (the legacy\n* per-namespace walk never visited a table-less namespace, so its live\n* relational contents are invisible), while `structural` extras (RLS\n* policies) check the FULL owned set (the legacy policy diff governed\n* every contract schema regardless of tables — RLS governance does not\n* shrink because a namespace declares no tables). The codec `verifyType`\n* hooks run once per contract namespace with tables against that\n* namespace's paired actual node (the hooks read namespace-scoped state\n* such as `nativeEnums`).\n*/\nfunction diffPostgresSchema(input) {\n\tconst postgresContract = blindCast(input.contract);\n\tPostgresDatabaseSchemaNode.assert(input.schema);\n\tconst actual = input.schema;\n\tconst types = sqlTypeLookupsOf(input.frameworkComponents);\n\tconst fullExpected = contractToPostgresDatabaseSchemaNode(postgresContract, {\n\t\tannotationNamespace: \"pg\",\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup,\n\t\tresolveDefault: postgresResolveDefault\n\t});\n\tconst expected = pruneTableLessNamespaces(fullExpected);\n\tconst relationalOwned = ownedSchemaNames(expected);\n\tconst structuralOwned = ownedSchemaNames(fullExpected);\n\treturn {\n\t\tissues: diffSchemas(expected, actual).filter((issue) => {\n\t\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\t\tif (isClusterScopedIssue(issue)) return true;\n\t\t\tconst granularity = classifyDiffSubjectGranularity(issue, postgresDiffSubjectGranularity);\n\t\t\tconst namespaceSegment = issue.path[1];\n\t\t\tif (namespaceSegment === void 0) return true;\n\t\t\treturn (granularity === \"structural\" ? structuralOwned : relationalOwned).has(namespaceSegment);\n\t\t}),\n\t\tresolveControlPolicy: (issue) => resolveControlPolicy(issue, postgresContract),\n\t\tnamespacePairs: Object.values(expected.namespaces).map((ns) => ({ actual: actual.namespaces[ns.schemaName] }))\n\t};\n}\n/**\n* Adds an empty namespace node to the actual tree for every expected namespace\n* absent from it. The relational plan diff pairs on namespace: a contract\n* namespace whose live schema does not exist yet must surface each of its\n* tables as `not-found` (→ `CREATE TABLE`), NOT as a single namespace\n* `not-found` that subtree-coalescing would collapse (leaving `CREATE SCHEMA`\n* with no tables). Padding makes the namespaces pair, so only table/column/\n* policy drift surfaces; `CREATE SCHEMA` comes separately from the synthesized\n* namespace-presence stitch (`verifyPostgresNamespacePresence`), never from the\n* tree diff — matching the retired per-namespace-paired relational walk, which\n* paired a missing schema against an empty namespace node.\n*/\nfunction padActualNamespaces(expected, actual) {\n\tconst namespaces = { ...actual.namespaces };\n\tlet padded = false;\n\tfor (const schemaName of Object.keys(expected.namespaces)) if (namespaces[schemaName] === void 0) {\n\t\tnamespaces[schemaName] = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName,\n\t\t\ttables: {}\n\t\t});\n\t\tpadded = true;\n\t}\n\tif (!padded) return actual;\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles: [...actual.roles],\n\t\texistingSchemas: [...actual.existingSchemas],\n\t\tpgVersion: actual.pgVersion\n\t});\n}\n/**\n* The Postgres planner's diff input: the SAME tree-building\n* `diffPostgresSchema` uses (FK schemas resolved,\n* table-less namespaces pruned, cluster-scope-aware ownership filter) plus\n* actual namespace padding (so a missing\n* schema's tables surface as `not-found` instead of a swallowed namespace\n* `not-found`). One differ drives both verify and plan; this is the\n* plan-side derivation. The single issue list covers tables / columns /\n* constraints / indexes / defaults AND policies — the caller splits it\n* (relational → `mapNodeIssueToCall`; policy → RLS ops) and stitches in\n* `CREATE SCHEMA` separately.\n*/\nfunction buildPostgresPlanDiff(input) {\n\tconst postgresContract = blindCast(input.contract);\n\tPostgresDatabaseSchemaNode.assert(input.actualSchema);\n\tconst actual = input.actualSchema;\n\tconst types = sqlTypeLookupsOf(input.frameworkComponents);\n\tconst fullExpected = contractToPostgresDatabaseSchemaNode(postgresContract, {\n\t\tannotationNamespace: \"pg\",\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup,\n\t\tresolveDefault: postgresResolveDefault\n\t});\n\tconst expected = pruneTableLessNamespaces(fullExpected);\n\tconst paddedActual = padActualNamespaces(expected, actual);\n\tconst originSchemas = input.originSchemas ?? [];\n\tconst relationalOwned = /* @__PURE__ */ new Set([...ownedSchemaNames(expected), ...originSchemas]);\n\tconst structuralOwned = /* @__PURE__ */ new Set([...ownedSchemaNames(fullExpected), ...originSchemas]);\n\treturn {\n\t\texpected,\n\t\tactual: paddedActual,\n\t\tissues: blindCast(diffSchemas(expected, paddedActual)).filter((issue) => {\n\t\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\t\tif (isClusterScopedIssue(issue)) return true;\n\t\t\tconst granularity = classifyDiffSubjectGranularity(issue, postgresDiffSubjectGranularity);\n\t\t\tconst namespaceSegment = issue.path[1];\n\t\t\tif (namespaceSegment === void 0) return true;\n\t\t\treturn (granularity === \"structural\" ? structuralOwned : relationalOwned).has(namespaceSegment);\n\t\t})\n\t};\n}\n//#endregion\nexport { diffPostgresSchema as n, contractToPostgresDatabaseSchemaNode as r, buildPostgresPlanDiff as t };\n\n//# sourceMappingURL=diff-database-schema-j18Gm75j.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,SAAS,eAAe;CACvB,OAAO;EACN,UAAU,uBAAuB;EACjC,IAAI;CACL;AACD;AACA,SAAS,eAAe,aAAa,WAAW;CAC/C,OAAO;EACN,aAAa;EACb;GACC,UAAU,uBAAuB;GACjC,IAA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ACtD,MAAM,eAAe,oBAAoB,UAAU,MAAM;CACzD,MAAM,gBAAgB,MAAM,iBAAiB,CAAC;CAC9C,MAAM,kCAAkC,IAAI,IAAI,CAAC,GAAG,iBAAiB,QAAQ,GAAG,GAAG,aAAa,CAAC;CACjG,MAAM,kCAAkC,IAAI,IAAI,CAAC,GAAG,iBAAiB,YAAY,GAAG,GAAG,aAAa,CAAC;CACrG,OAAO;EACN;EACA,QAAQ;EACR,QAAQ,UAAU,YAAY,UAAU,YAAY,CAAC,CAAC,CAAC,QAAQ,UAAU;GACxE,IAAI,aAAa,KAAK,MAAM,gBAAgB,OAAO;GACnD,IAAI,qBAAqB,KAAK,GAAG,OAAO;GACxC,MAAM,cAAc,+BAA+B,OAAO,8BAA8B;GACxF,MAAM,mBAAmB,MAAM,KAAK;GACpC,IAAI,qBAAqB,KAAK,GAAG,OAAO;GACxC,QAAQ,gBAAgB,eAAe,kBAAkB,gBAAA,CAAiB,IAAI,gBAAgB;EAC/F,CAAC;CACF;AACD"}
1
+ {"version":3,"file":"diff-database-schema-CcR7BN-A-BuftnIR2.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/diff-database-schema-CcR7BN-A.mjs"],"sourcesContent":["import { l as postgresError } from \"./errors-DG6xgXgr.mjs\";\nimport { i as fullTextIndexDefinitionOf, t as FULL_TEXT_INDEX_TYPE } from \"./full-text-index-definition-BRNRSgZK.mjs\";\nimport { r as isPostgresSchema } from \"./postgres-schema-CEGf780E.mjs\";\nimport { t as postgresAccessMethodOf } from \"./index-types-5g7gXoWK.mjs\";\nimport { t as postgresResolveDefault } from \"./default-normalizer-BqK6XxdC.mjs\";\nimport { a as postgresDiffSubjectGranularity, n as PostgresNativeEnumSchemaNode, r as PostgresSchemaNodeKind, t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-BBkitBQh.mjs\";\nimport { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode, t as PostgresRoleSchemaNode } from \"./postgres-role-schema-node-B8Z5i5D-.mjs\";\nimport { n as renderFullTextIndexDocument } from \"./full-text-search-document-DWzECXD-.mjs\";\nimport { r as resolveDdlSchemaForNamespaceStorage } from \"./resolve-ddl-schema-BhOYD95_.mjs\";\nimport { i as resolvePostgresNodeIssueControlPolicySubject } from \"./control-policy-BncmQ6LO.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { diffSchemas, issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { namingOf } from \"@internal/sql-schema-ir/naming\";\nimport { contractNamespaceToSchemaIR, sqlTypeLookupsOf } from \"@internal/family-sql/control\";\nimport { classifyDiffSubjectGranularity } from \"@internal/family-sql/diff\";\nimport { PrimaryKey, RelationalSchemaNodeKind, SqlForeignKeyIR, SqlIndexIR, SqlUniqueIR } from \"@internal/sql-schema-ir/types\";\n//#region src/core/migrations/contract-to-postgres-database-schema-node.ts\n/** The database root's fixed sentinel id (`PostgresDatabaseSchemaNode#id`). */\nfunction databaseStep() {\n\treturn {\n\t\tnodeKind: PostgresSchemaNodeKind.database,\n\t\tid: \"database\"\n\t};\n}\nfunction tableDependsOn(namespaceId, tableName) {\n\treturn [\n\t\tdatabaseStep(),\n\t\t{\n\t\t\tnodeKind: PostgresSchemaNodeKind.namespace,\n\t\t\tid: namespaceId\n\t\t},\n\t\t{\n\t\t\tnodeKind: PostgresSchemaNodeKind.table,\n\t\t\tid: tableName\n\t\t}\n\t];\n}\nfunction roleDependsOn(role) {\n\treturn [databaseStep(), {\n\t\tnodeKind: PostgresSchemaNodeKind.role,\n\t\tid: role\n\t}];\n}\n/**\n* The chains from a table-child object (foreign key, index, unique, primary\n* key) to each of the own columns it is built on, in the Postgres tree.\n* Dropping a covered column auto-drops the object, so the object's drop must\n* precede the column's; the graph derives that direction from these edges.\n*/\nfunction columnDependsOn(namespaceId, tableName, columns) {\n\treturn columns.map((column) => [...tableDependsOn(namespaceId, tableName), {\n\t\tnodeKind: RelationalSchemaNodeKind.column,\n\t\tid: `column:${column}`\n\t}]);\n}\nfunction toPolicyNode(policy, namespaceId) {\n\treturn new PostgresPolicySchemaNode({\n\t\tnaming: namingOf(policy.name, policy.prefix),\n\t\ttableName: policy.tableName,\n\t\tnamespaceId,\n\t\toperation: policy.operation,\n\t\troles: [...policy.roles],\n\t\tusing: policy.using,\n\t\twithCheck: policy.withCheck,\n\t\tpermissive: policy.permissive,\n\t\tdependsOn: [tableDependsOn(namespaceId, policy.tableName), ...policy.roles.map(roleDependsOn)]\n\t});\n}\n/**\n* Projects a Postgres contract into the expected schema-diff tree: a\n* `PostgresDatabaseSchemaNode` root holding one `PostgresNamespaceSchemaNode`\n* per Postgres namespace, each holding its `PostgresTableSchemaNode`s with\n* their `PostgresPolicySchemaNode`s, plus the database roles on the root.\n*\n* Not a duplicate of the family's `contractToSchemaIR`: that builds a flat,\n* single `{ tables }` map (and throws on cross-namespace name collisions, with\n* no RLS/role concept) for SQLite's single-schema world. This is the\n* Postgres-specific *tree* shape — multi-schema, RLS-policy-aware, role-aware.\n* It reuses the family's per-namespace table conversion (`contractNamespaceToSchemaIR`)\n* for column/FK/index building and only adds the Postgres tree/policy/role shape.\n*\n* Tables are grouped by their owning namespace (resolved DDL schema name) so\n* the tree mirrors Postgres's object hierarchy. The DDL schema name is\n* resolved once per namespace.\n*\n* A policy that references a table absent from its namespace is a malformed\n* contract — the loop throws rather than fabricating a stub table.\n*/\nfunction contractToPostgresDatabaseSchemaNode(contract, options) {\n\tif (contract === null) return new PostgresDatabaseSchemaNode({\n\t\tnamespaces: {},\n\t\troles: [],\n\t\texistingSchemas: [],\n\t\tpgVersion: \"\"\n\t});\n\tconst namespaces = {};\n\tconst roles = [];\n\tconst ownedSchemas = [];\n\tfor (const ns of Object.values(contract.storage.namespaces)) {\n\t\tif (!isPostgresSchema(ns)) continue;\n\t\tfor (const role of Object.values(ns.role)) roles.push(new PostgresRoleSchemaNode({\n\t\t\tname: role.name,\n\t\t\tnamespaceId: role.namespaceId\n\t\t}));\n\t\tif (ns.id === UNBOUND_NAMESPACE_ID) {\n\t\t\tif (!Object.entries(ns.entries).some(([entriesKey, slot]) => entriesKey !== \"role\" && Object.keys(slot).length > 0)) continue;\n\t\t}\n\t\tconst ddlSchema = resolveDdlSchemaForNamespaceStorage(contract.storage, ns.id);\n\t\townedSchemas.push(ddlSchema);\n\t\tconst sqlTables = contractNamespaceToSchemaIR(contract.storage, ns.id, options).tables;\n\t\tconst policiesByTable = /* @__PURE__ */ new Map();\n\t\tfor (const policy of Object.values(ns.policy)) {\n\t\t\tconst list = policiesByTable.get(policy.tableName) ?? [];\n\t\t\tlist.push(toPolicyNode(policy, ddlSchema));\n\t\t\tpoliciesByTable.set(policy.tableName, list);\n\t\t}\n\t\tconst tables = {};\n\t\tfor (const tableName of Object.keys(ns.table)) {\n\t\t\tconst sqlTable = sqlTables[tableName];\n\t\t\tif (sqlTable === void 0) continue;\n\t\t\tconst foreignKeys = sqlTable.foreignKeys.map((fk) => {\n\t\t\t\tconst resolvedReferencedNamespace = resolveDdlSchemaForNamespaceStorage(contract.storage, fk.referencedSchema ?? UNBOUND_NAMESPACE_ID);\n\t\t\t\treturn new SqlForeignKeyIR({\n\t\t\t\t\tcolumns: fk.columns,\n\t\t\t\t\treferencedTable: fk.referencedTable,\n\t\t\t\t\treferencedColumns: fk.referencedColumns,\n\t\t\t\t\treferencedSchema: fk.referencedSchema ?? UNBOUND_NAMESPACE_ID,\n\t\t\t\t\t...ifDefined(\"name\", fk.name),\n\t\t\t\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t\t\t\t...ifDefined(\"onUpdate\", fk.onUpdate),\n\t\t\t\t\t...ifDefined(\"annotations\", fk.annotations),\n\t\t\t\t\tresolvedReferencedNamespace,\n\t\t\t\t\tdependsOn: [tableDependsOn(resolvedReferencedNamespace, fk.referencedTable), ...columnDependsOn(ddlSchema, tableName, fk.columns)]\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst uniques = sqlTable.uniques.map((u) => new SqlUniqueIR({\n\t\t\t\tcolumns: u.columns,\n\t\t\t\t...ifDefined(\"name\", u.name),\n\t\t\t\t...ifDefined(\"annotations\", u.annotations),\n\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, u.columns)\n\t\t\t}));\n\t\t\tconst indexes = sqlTable.indexes.map((i) => {\n\t\t\t\tconst fullText = fullTextIndexDefinitionOf(i);\n\t\t\t\tif (fullText !== void 0) return new SqlIndexIR({\n\t\t\t\t\tnaming: namingOf(i.name, i.prefix),\n\t\t\t\t\twhere: i.where,\n\t\t\t\t\tunique: i.unique,\n\t\t\t\t\tpartial: i.partial,\n\t\t\t\t\ttype: postgresAccessMethodOf(FULL_TEXT_INDEX_TYPE),\n\t\t\t\t\toptions: void 0,\n\t\t\t\t\tannotations: i.annotations,\n\t\t\t\t\texpression: renderFullTextIndexDocument(fullText),\n\t\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, fullText.weightGroups.flat())\n\t\t\t\t});\n\t\t\t\tconst base = {\n\t\t\t\t\tnaming: namingOf(i.name, i.prefix),\n\t\t\t\t\twhere: i.where,\n\t\t\t\t\tunique: i.unique,\n\t\t\t\t\tpartial: i.partial,\n\t\t\t\t\ttype: i.type,\n\t\t\t\t\toptions: i.options,\n\t\t\t\t\tannotations: i.annotations,\n\t\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, i.columns ?? Object.keys(sqlTable.columns))\n\t\t\t\t};\n\t\t\t\treturn new SqlIndexIR(i.expression !== void 0 ? {\n\t\t\t\t\t...base,\n\t\t\t\t\texpression: i.expression\n\t\t\t\t} : {\n\t\t\t\t\t...base,\n\t\t\t\t\tcolumns: i.columns ?? []\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst primaryKey = sqlTable.primaryKey !== void 0 ? new PrimaryKey({\n\t\t\t\tcolumns: sqlTable.primaryKey.columns,\n\t\t\t\t...ifDefined(\"name\", sqlTable.primaryKey.name),\n\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, sqlTable.primaryKey.columns)\n\t\t\t}) : void 0;\n\t\t\ttables[tableName] = new PostgresTableSchemaNode({\n\t\t\t\tname: sqlTable.name,\n\t\t\t\tcolumns: sqlTable.columns,\n\t\t\t\tforeignKeys,\n\t\t\t\tuniques,\n\t\t\t\tindexes,\n\t\t\t\t...ifDefined(\"primaryKey\", primaryKey),\n\t\t\t\t...ifDefined(\"annotations\", sqlTable.annotations),\n\t\t\t\t...ifDefined(\"checks\", sqlTable.checks),\n\t\t\t\tpolicies: policiesByTable.get(tableName) ?? [],\n\t\t\t\trlsEnabled: Object.hasOwn(ns.rls, tableName)\n\t\t\t});\n\t\t}\n\t\tfor (const [tableName, tablePolicies] of policiesByTable) {\n\t\t\tif (!(tableName in tables)) {\n\t\t\t\tconst policyName = tablePolicies[0]?.name ?? \"(unknown)\";\n\t\t\t\tthrow postgresError(\"CONTRACT.POLICY_INVALID\", `contract-to-postgres-database-schema-node: policy \"${policyName}\" references table \"${tableName}\" not present in namespace \"${ddlSchema}\"`, { meta: {\n\t\t\t\t\tpolicyName,\n\t\t\t\t\ttableName,\n\t\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\t\treason: \"table-missing\"\n\t\t\t\t} });\n\t\t\t}\n\t\t\tif (!Object.hasOwn(ns.rls, tableName)) {\n\t\t\t\tconst policyLabel = tablePolicies[0]?.prefix ?? tablePolicies[0]?.name ?? \"(unknown)\";\n\t\t\t\tthrow postgresError(\"CONTRACT.POLICY_INVALID\", `contract-to-postgres-database-schema-node: policy \"${policyLabel}\" targets table \"${tableName}\" in namespace \"${ddlSchema}\", which is not RLS-controlled. Mark the model with @@rls (entries.rls[\"${tableName}\"]) or remove the policy.`, { meta: {\n\t\t\t\t\tpolicyName: policyLabel,\n\t\t\t\t\ttableName,\n\t\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\t\treason: \"table-not-rls-controlled\"\n\t\t\t\t} });\n\t\t\t}\n\t\t}\n\t\tnamespaces[ddlSchema] = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: ddlSchema,\n\t\t\ttables,\n\t\t\tnativeEnums: Object.values(ns.entries.native_enum ?? {}).map((entity) => new PostgresNativeEnumSchemaNode({\n\t\t\t\ttypeName: entity.typeName,\n\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\tmembers: entity.members,\n\t\t\t\t...ifDefined(\"control\", entity.control)\n\t\t\t}))\n\t\t});\n\t}\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles,\n\t\texistingSchemas: ownedSchemas,\n\t\tpgVersion: \"\"\n\t});\n}\n//#endregion\n//#region src/core/migrations/diff-database-schema.ts\n/**\n* Whether a diff issue's subject node is cluster-scoped — it carries its own\n* `namespaceId` field (only role and policy diff nodes do) and that\n* coordinate is the unbound sentinel, meaning the node is not owned by any\n* schema/namespace. A role node is always cluster-scoped (roles are\n* cluster-level objects); a policy node's `namespaceId` is always its\n* table's resolved DDL schema, never the sentinel. Namespace-ownership\n* scoping (which compares `issue.path[1]` against the set of DDL schemas\n* the contract owns) makes no sense for a cluster-scoped subject — its path\n* segment at that index is the object's own name, not a schema name — so\n* such an issue bypasses that scoping entirely.\n*/\nfunction isClusterScopedIssue(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\treturn node !== void 0 && nodeNamespaceId(node) === UNBOUND_NAMESPACE_ID;\n}\nfunction nodeNamespaceId(node) {\n\tif (!Object.hasOwn(node, \"namespaceId\")) return void 0;\n\treturn blindCast(node).namespaceId;\n}\nfunction ownedSchemaNames(expected) {\n\tconst policyNamespaces = Object.values(expected.namespaces).flatMap((ns) => Object.values(ns.tables).flatMap((t) => t.policies.map((p) => p.namespaceId)));\n\treturn /* @__PURE__ */ new Set([...policyNamespaces, ...expected.existingSchemas]);\n}\n/**\n* Drops contract namespaces that declare no tables from the verdict-diff\n* expected tree and the relational owned-schema set. The legacy relational\n* walk skipped a table-less namespace (e.g. an enums-only schema) before\n* pairing, so neither its DDL schema's absence nor that schema's live\n* relational contents ever reached the verdict — the pruned tree\n* reproduces that. The prune loses no expected policies: policies attach\n* to tables, so a table-less namespace carries none (the projection\n* throws on a policy referencing an absent table). Live policies in a\n* pruned schema remain governed via the full owned set (see\n* {@link diffPostgresSchema}).\n*/\nfunction pruneTableLessNamespaces(expected) {\n\tconst namespaces = Object.fromEntries(Object.entries(expected.namespaces).filter(([, ns]) => Object.keys(ns.tables).length > 0));\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles: [...expected.roles],\n\t\texistingSchemas: expected.existingSchemas.filter((s) => namespaces[s] !== void 0),\n\t\tpgVersion: expected.pgVersion\n\t});\n}\n/**\n* Resolves a verdict-diff issue's subject's declared control policy directly\n* from the contract, by delegating to the same node-typed resolver\n* ({@link resolvePostgresNodeIssueControlPolicySubject}) the planner uses to\n* gate DDL calls. `undefined` when the issue resolves to no contract subject.\n*\n* A role issue resolves through that same resolver to `external`\n* unconditionally (see its role branch), regardless of the contract's own\n* default policy: a role is referenced by the contract but not owned, and\n* `external`'s existing semantics — a missing declared subject still fails,\n* every extra is suppressed — are exactly the wanted asymmetric grading for\n* a cluster object the framework does not own.\n*/\nfunction resolveControlPolicy(issue, contract) {\n\treturn resolvePostgresNodeIssueControlPolicySubject(blindCast(issue), contract)?.explicitNodeControlPolicy;\n}\n/**\n* The Postgres full-tree node diff for the family verify verdict: derive\n* the expected tree (resolved leaf values, FK schemas\n* resolved, table-less namespaces pruned), run the generic\n* differ over the trees as derived, and scope out `not-expected` findings under namespaces the\n* contract does not own. Ownership scoping bypasses cluster-scoped subjects\n* (roles today), mirroring the legacy decomposition: relational extras check\n* the PRUNED owned set (the legacy\n* per-namespace walk never visited a table-less namespace, so its live\n* relational contents are invisible), while `structural` extras (RLS\n* policies) check the FULL owned set (the legacy policy diff governed\n* every contract schema regardless of tables — RLS governance does not\n* shrink because a namespace declares no tables). The codec `verifyType`\n* hooks run once per contract namespace with tables against that\n* namespace's paired actual node (the hooks read namespace-scoped state\n* such as `nativeEnums`).\n*/\nfunction diffPostgresSchema(input) {\n\tconst postgresContract = blindCast(input.contract);\n\tPostgresDatabaseSchemaNode.assert(input.schema);\n\tconst actual = input.schema;\n\tconst types = sqlTypeLookupsOf(input.frameworkComponents);\n\tconst fullExpected = contractToPostgresDatabaseSchemaNode(postgresContract, {\n\t\tannotationNamespace: \"pg\",\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup,\n\t\tresolveDefault: postgresResolveDefault\n\t});\n\tconst expected = pruneTableLessNamespaces(fullExpected);\n\tconst relationalOwned = ownedSchemaNames(expected);\n\tconst structuralOwned = ownedSchemaNames(fullExpected);\n\treturn {\n\t\tissues: diffSchemas(expected, actual).filter((issue) => {\n\t\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\t\tif (isClusterScopedIssue(issue)) return true;\n\t\t\tconst granularity = classifyDiffSubjectGranularity(issue, postgresDiffSubjectGranularity);\n\t\t\tconst namespaceSegment = issue.path[1];\n\t\t\tif (namespaceSegment === void 0) return true;\n\t\t\treturn (granularity === \"structural\" ? structuralOwned : relationalOwned).has(namespaceSegment);\n\t\t}),\n\t\tresolveControlPolicy: (issue) => resolveControlPolicy(issue, postgresContract),\n\t\tnamespacePairs: Object.values(expected.namespaces).map((ns) => ({ actual: actual.namespaces[ns.schemaName] }))\n\t};\n}\n/**\n* Adds an empty namespace node to the actual tree for every expected namespace\n* absent from it. The relational plan diff pairs on namespace: a contract\n* namespace whose live schema does not exist yet must surface each of its\n* tables as `not-found` (→ `CREATE TABLE`), NOT as a single namespace\n* `not-found` that subtree-coalescing would collapse (leaving `CREATE SCHEMA`\n* with no tables). Padding makes the namespaces pair, so only table/column/\n* policy drift surfaces; `CREATE SCHEMA` comes separately from the synthesized\n* namespace-presence stitch (`verifyPostgresNamespacePresence`), never from the\n* tree diff — matching the retired per-namespace-paired relational walk, which\n* paired a missing schema against an empty namespace node.\n*/\nfunction padActualNamespaces(expected, actual) {\n\tconst namespaces = { ...actual.namespaces };\n\tlet padded = false;\n\tfor (const schemaName of Object.keys(expected.namespaces)) if (namespaces[schemaName] === void 0) {\n\t\tnamespaces[schemaName] = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName,\n\t\t\ttables: {}\n\t\t});\n\t\tpadded = true;\n\t}\n\tif (!padded) return actual;\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles: [...actual.roles],\n\t\texistingSchemas: [...actual.existingSchemas],\n\t\tpgVersion: actual.pgVersion\n\t});\n}\n/**\n* The Postgres planner's diff input: the SAME tree-building\n* `diffPostgresSchema` uses (FK schemas resolved,\n* table-less namespaces pruned, cluster-scope-aware ownership filter) plus\n* actual namespace padding (so a missing\n* schema's tables surface as `not-found` instead of a swallowed namespace\n* `not-found`). One differ drives both verify and plan; this is the\n* plan-side derivation. The single issue list covers tables / columns /\n* constraints / indexes / defaults AND policies — the caller splits it\n* (relational → `mapNodeIssueToCall`; policy → RLS ops) and stitches in\n* `CREATE SCHEMA` separately.\n*/\nfunction buildPostgresPlanDiff(input) {\n\tconst postgresContract = blindCast(input.contract);\n\tPostgresDatabaseSchemaNode.assert(input.actualSchema);\n\tconst actual = input.actualSchema;\n\tconst types = sqlTypeLookupsOf(input.frameworkComponents);\n\tconst fullExpected = contractToPostgresDatabaseSchemaNode(postgresContract, {\n\t\tannotationNamespace: \"pg\",\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup,\n\t\tresolveDefault: postgresResolveDefault\n\t});\n\tconst expected = pruneTableLessNamespaces(fullExpected);\n\tconst paddedActual = padActualNamespaces(expected, actual);\n\tconst originSchemas = input.originSchemas ?? [];\n\tconst relationalOwned = /* @__PURE__ */ new Set([...ownedSchemaNames(expected), ...originSchemas]);\n\tconst structuralOwned = /* @__PURE__ */ new Set([...ownedSchemaNames(fullExpected), ...originSchemas]);\n\treturn {\n\t\texpected,\n\t\tactual: paddedActual,\n\t\tissues: blindCast(diffSchemas(expected, paddedActual)).filter((issue) => {\n\t\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\t\tif (isClusterScopedIssue(issue)) return true;\n\t\t\tconst granularity = classifyDiffSubjectGranularity(issue, postgresDiffSubjectGranularity);\n\t\t\tconst namespaceSegment = issue.path[1];\n\t\t\tif (namespaceSegment === void 0) return true;\n\t\t\treturn (granularity === \"structural\" ? structuralOwned : relationalOwned).has(namespaceSegment);\n\t\t})\n\t};\n}\n//#endregion\nexport { diffPostgresSchema as n, contractToPostgresDatabaseSchemaNode as r, buildPostgresPlanDiff as t };\n\n//# sourceMappingURL=diff-database-schema-CcR7BN-A.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,SAAS,eAAe;CACvB,OAAO;EACN,UAAU,uBAAuB;EACjC,IAAI;CACL;AACD;AACA,SAAS,eAAe,aAAa,WAAW;CAC/C,OAAO;EACN,aAAa;EACb;GACC,UAAU,uBAAuB;GACjC,IAAI;EACL;EACA;GACC,UAAU,uBAAuB;GACjC,IAAI;EACL;CACD;AACD;AACA,SAAS,cAAc,MAAM;CAC5B,OAAO,CAAC,aAAa,GAAG;EACvB,UAAU,uBAAuB;EACjC,IAAI;CACL,CAAC;AACF;;;;;;;AAOA,SAAS,gBAAgB,aAAa,WAAW,SAAS;CACzD,OAAO,QAAQ,KAAK,WAAW,CAAC,GAAG,eAAe,aAAa,SAAS,GAAG;EAC1E,UAAU,yBAAyB;EACnC,IAAI,UAAU;CACf,CAAC,CAAC;AACH;AACA,SAAS,aAAa,QAAQ,aAAa;CAC1C,OAAO,IAAI,yBAAyB;EACnC,QAAQ,SAAS,OAAO,MAAM,OAAO,MAAM;EAC3C,WAAW,OAAO;EAClB;EACA,WAAW,OAAO;EAClB,OAAO,CAAC,GAAG,OAAO,KAAK;EACvB,OAAO,OAAO;EACd,WAAW,OAAO;EAClB,YAAY,OAAO;EACnB,WAAW,CAAC,eAAe,aAAa,OAAO,SAAS,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,CAAC;CACF;AACD"}
@@ -1,6 +1,6 @@
1
1
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
2
2
  import { CliStructuredError } from "@prisma/orm-framework/errors/control";
3
- //#region ../../../3-targets/postgres/1-target/dist/errors-Di_apgWJ.mjs
3
+ //#region ../../../3-targets/postgres/1-target/dist/errors-DG6xgXgr.mjs
4
4
  function postgresError(code, message, options) {
5
5
  return structuredError(code, message, options);
6
6
  }
@@ -33,10 +33,11 @@ function errorPostgresMigrationStackMissing(operation) {
33
33
  meta: { operation }
34
34
  });
35
35
  }
36
+ const TEMPORAL_UNAVAILABLE_FIX = "Run on a runtime with Temporal available, install a Temporal polyfill before creating the client, or write the column as a convenience type at its default, which needs no Temporal: `DateTime` reads a JavaScript `Date`, and `Date`, `Time` and `Duration` read ISO 8601 strings.";
36
37
  function errorTemporalUnavailable(codecId, operation) {
37
38
  return postgresError("RUNTIME.TEMPORAL_UNAVAILABLE", `Codec '${codecId}' cannot ${operation} a value because this runtime has no global Temporal implementation.`, {
38
39
  why: "Temporal-backed codecs read and write their values through the global Temporal API, which this runtime does not provide.",
39
- fix: "Run on a runtime with Temporal available, install a Temporal polyfill before creating the client, or author the column with its *String type to read and write ISO 8601 text instead.",
40
+ fix: TEMPORAL_UNAVAILABLE_FIX,
40
41
  meta: {
41
42
  codecId,
42
43
  operation
@@ -45,8 +46,8 @@ function errorTemporalUnavailable(codecId, operation) {
45
46
  }
46
47
  function errorTemporalUnavailableForDefault(generatorId) {
47
48
  return postgresError("RUNTIME.TEMPORAL_UNAVAILABLE", `Mutation default generator '${generatorId}' cannot produce a value because this runtime has no global Temporal implementation.`, {
48
- why: "The generator answers a Temporal-backed column, so the value it produces is a Temporal.Instant, which this runtime cannot construct.",
49
- fix: "Run on a runtime with Temporal available, install a Temporal polyfill before creating the client, or author the column with `temporal.CreatedAtString` / `temporal.UpdatedAtString` to store ISO 8601 text instead.",
49
+ why: "The generator answers a Temporal-backed column, so the value it produces is a Temporal value, which this runtime cannot construct.",
50
+ fix: TEMPORAL_UNAVAILABLE_FIX,
50
51
  meta: { generatorId }
51
52
  });
52
53
  }
@@ -111,4 +112,4 @@ function errorTemporalNonIsoCalendar(codecId, calendarId) {
111
112
  //#endregion
112
113
  export { errorTemporalUnavailableForDefault as a, errorTimestampTextWrongType as c, errorTemporalUnavailable as i, postgresError as l, errorPostgresMigrationStackMissing as n, errorTemporalUnrepresentable as o, errorTemporalNonIsoCalendar as r, errorTemporalWrongType as s, errorDateStyleNotIso as t };
113
114
 
114
- //# sourceMappingURL=errors-Di_apgWJ-BLXRTfFj.mjs.map
115
+ //# sourceMappingURL=errors-DG6xgXgr-Cb1XcPcb.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-DG6xgXgr-Cb1XcPcb.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/errors-DG6xgXgr.mjs"],"sourcesContent":["import { structuredError } from \"@internal/utils/structured-error\";\nimport { CliStructuredError } from \"@internal/errors/control\";\n//#region src/core/errors.ts\nfunction postgresError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n/**\n* A `PostgresMigration` operation that needs the materialized control adapter\n* — named by `operation` (e.g. `createTable`, `dropColumn`, `dataTransform`) —\n* was invoked, but the migration was constructed without a `ControlStack`.\n* Concrete authoring usage always goes through the migration CLI entrypoint,\n* which assembles a stack from the loaded `prisma.config.ts`; reaching this\n* error means a test fixture or ad-hoc consumer instantiated `PostgresMigration`\n* with the no-arg form (legal for `operations` / `describe` introspection only).\n*\n* The `operation` argument is required so every throw site names the operation\n* that actually failed; a new operation cannot inherit a misattributed message.\n*\n* Distinct from `MIGRATION.UNFILLED_PLACEHOLDER` (placeholder not filled)\n* and `MIGRATION.DATA_TRANSFORM_CONTRACT_MISMATCH` (data-transform query\n* plan against wrong contract) because the missing input is the stack\n* itself, not the per-operation contract.\n*\n* Lives in `@internal/target-postgres/errors` rather than the shared\n* framework migration errors module because the failure is target-specific:\n* the contract it talks about (`PostgresMigration`, the Postgres control\n* adapter, the Postgres-target stack) only exists in this package.\n*/\nfunction errorPostgresMigrationStackMissing(operation) {\n\treturn new CliStructuredError(\"MIGRATION.POSTGRES_CONTROL_STACK_MISSING\", `PostgresMigration.${operation} requires a control adapter`, {\n\t\twhy: `PostgresMigration.${operation} was invoked on an instance constructed without a ControlStack, so the stored controlAdapter is undefined and the operation cannot lower its plan.`,\n\t\tfix: \"Construct the migration via the migration CLI entrypoint (which assembles a ControlStack from the loaded prisma.config.ts), or pass a ControlStack containing a Postgres adapter to the migration constructor in test fixtures.\",\n\t\tmeta: { operation }\n\t});\n}\nconst TEMPORAL_UNAVAILABLE_FIX = \"Run on a runtime with Temporal available, install a Temporal polyfill before creating the client, or write the column as a convenience type at its default, which needs no Temporal: `DateTime` reads a JavaScript `Date`, and `Date`, `Time` and `Duration` read ISO 8601 strings.\";\nfunction errorTemporalUnavailable(codecId, operation) {\n\treturn postgresError(\"RUNTIME.TEMPORAL_UNAVAILABLE\", `Codec '${codecId}' cannot ${operation} a value because this runtime has no global Temporal implementation.`, {\n\t\twhy: \"Temporal-backed codecs read and write their values through the global Temporal API, which this runtime does not provide.\",\n\t\tfix: TEMPORAL_UNAVAILABLE_FIX,\n\t\tmeta: {\n\t\t\tcodecId,\n\t\t\toperation\n\t\t}\n\t});\n}\nfunction errorTemporalUnavailableForDefault(generatorId) {\n\treturn postgresError(\"RUNTIME.TEMPORAL_UNAVAILABLE\", `Mutation default generator '${generatorId}' cannot produce a value because this runtime has no global Temporal implementation.`, {\n\t\twhy: \"The generator answers a Temporal-backed column, so the value it produces is a Temporal value, which this runtime cannot construct.\",\n\t\tfix: TEMPORAL_UNAVAILABLE_FIX,\n\t\tmeta: { generatorId }\n\t});\n}\nfunction errorTemporalUnrepresentable(options) {\n\tconst { codecId, operation, stringType, value, detail } = options;\n\treturn postgresError(operation === \"decode\" ? \"RUNTIME.DECODE_FAILED\" : \"RUNTIME.ENCODE_FAILED\", `Codec '${codecId}' cannot represent the value ${operation === \"decode\" ? \"PostgreSQL returned\" : \"the application supplied\"}: ${JSON.stringify(value)} — ${detail}. Use ${stringType} to carry this column as ISO 8601 text.`, {\n\t\twhy: `${detail}. Temporal is the authoritative parser and range check for this codec, so a value it cannot express has no representation on this column.`,\n\t\tfix: `Author the column as ${stringType} to read and write it as ISO 8601 text, which holds every value the database accepts.`,\n\t\tmeta: {\n\t\t\tcodecId,\n\t\t\toperation,\n\t\t\tvalue,\n\t\t\tstringType\n\t\t},\n\t\t...options.cause === void 0 ? {} : { cause: options.cause }\n\t});\n}\nfunction errorTemporalWrongType(codecId, temporalTag, stringType, received) {\n\treturn postgresError(\"RUNTIME.ENCODE_FAILED\", `Codec '${codecId}' encodes a ${temporalTag}, but received ${received}.`, {\n\t\twhy: \"The codec serializes through the Temporal value's own toString(). A different type reaches PostgreSQL in a spelling it does not accept, and the resulting error names the column rather than the codec.\",\n\t\tfix: `Pass a ${temporalTag}, or author the column with its ${stringType} type to write ISO 8601 text.`,\n\t\tmeta: {\n\t\t\tcodecId,\n\t\t\ttemporalTag,\n\t\t\tstringType,\n\t\t\treceived\n\t\t}\n\t});\n}\n/** A date or time codec read text PostgreSQL printed under a DateStyle other than ISO, which no codec reads. */\nfunction errorDateStyleNotIso(codecId, received) {\n\treturn postgresError(\"RUNTIME.DATE_STYLE_NOT_ISO\", `Codec '${codecId}' read ${JSON.stringify(received)}, which PostgreSQL prints only when the connection's DateStyle is not ISO: the driver could not ensure the DateStyle=ISO the PostgreSQL target requires. Prisma reads dates and times only in DateStyle ISO.`, {\n\t\twhy: \"PostgreSQL prints a date or timestamp in the DateStyle of the connection. The PostgreSQL driver ensures DateStyle=ISO on every connection it uses: it starts each connection it opens with it, and sets it on a connection the application supplies before first use. A statement that sets DateStyle on a connection undoes that, and so does a connection pooler between Prisma and PostgreSQL that drops the startup option or runs each statement on another server connection.\",\n\t\tfix: \"Do not change DateStyle on a connection Prisma uses. Behind a connection pooler, set DateStyle on the role or database (ALTER ROLE <role> SET DateStyle = 'ISO'), so every server connection holds it.\",\n\t\tmeta: {\n\t\t\tcodecId,\n\t\t\treceived: received.slice(0, 100)\n\t\t}\n\t});\n}\n/** A string timestamp codec received something other than text, such as a `Date` from a contract emitted before its generator wrote text. */\nfunction errorTimestampTextWrongType(codecId, received) {\n\treturn postgresError(\"RUNTIME.ENCODE_FAILED\", `Codec '${codecId}' writes ISO 8601 text, but received ${received}.`, {\n\t\twhy: \"The codec sends its value to PostgreSQL unchanged. A Date would be sent in the process's local time zone, and a timestamp column without a time zone would store the wrong wall-clock time.\",\n\t\tfix: \"Pass the timestamp as ISO 8601 text, such as \\\"2024-01-02T03:04:05.678\\\". If the value came from a generated default, emit the contract again: a contract emitted by an earlier version pairs this column with timestampNow, which generates a Date.\",\n\t\tmeta: {\n\t\t\tcodecId,\n\t\t\treceived\n\t\t}\n\t});\n}\nfunction errorTemporalNonIsoCalendar(codecId, calendarId) {\n\treturn postgresError(\"RUNTIME.ENCODE_FAILED\", `Codec '${codecId}' accepts only the iso8601 calendar, but the value carries '${calendarId}'.`, {\n\t\twhy: \"PostgreSQL stores no calendar alongside a date, so a non-ISO calendar would be discarded on write and the value would read back as a different date than the one authored.\",\n\t\tfix: \"Convert the value with .withCalendar(\\\"iso8601\\\") before writing if the ISO projection is what you mean to store.\",\n\t\tmeta: {\n\t\t\tcodecId,\n\t\t\tcalendarId\n\t\t}\n\t});\n}\n//#endregion\nexport { errorTemporalUnavailableForDefault as a, errorTimestampTextWrongType as c, errorTemporalUnavailable as i, postgresError as l, errorPostgresMigrationStackMissing as n, errorTemporalUnrepresentable as o, errorTemporalNonIsoCalendar as r, errorTemporalWrongType as s, errorDateStyleNotIso as t };\n\n//# sourceMappingURL=errors-DG6xgXgr.mjs.map"],"mappings":";;;AAGA,SAAS,cAAc,MAAM,SAAS,SAAS;CAC9C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,mCAAmC,WAAW;CACtD,OAAO,IAAI,mBA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,GAAG,GAAG;EAChC;CACD,CAAC;AACF;;AAEA,SAAS,4BAA4B,SAAS,UAAU;CACvD,OAAO,cAAc,yBAAyB,UAAU,QAAQ,uCAAuC,SAAS,IAAI;EACnH,KAAK;EACL,KAAK;EACL,MAAM;GACL;GACA;EACD;CACD,CAAC;AACF;AACA,SAAS,4BAA4B,SAAS,YAAY;CACzD,OAAO,cAAc,yBAAyB,UAAU,QAAQ,8DAA8D,WAAW,KAAK;EAC7I,KAAK;EACL,KAAK;EACL,MAAM;GACL;GACA;EACD;CACD,CAAC;AACF"}
@@ -1,5 +1,5 @@
1
- import { l as postgresError } from "./errors-Di_apgWJ-BLXRTfFj.mjs";
2
- import { c as toTsquery, i as languageLiteral } from "./full-text-parsers-hI_qtk-Q-DqTMF4n2.mjs";
1
+ import { l as postgresError } from "./errors-DG6xgXgr-Cb1XcPcb.mjs";
2
+ import { c as toTsquery, i as languageLiteral } from "./full-text-parsers-Dd5DOdBA-BTeOSzUj.mjs";
3
3
  //#region ../../../3-targets/postgres/1-target/dist/full-text.mjs
4
4
  /**
5
5
  * An empty term, `''`, is a `tsquery` syntax error; a single space parses as a term with no words,
@@ -36,4 +36,4 @@ function tsquery(first, ...values) {
36
36
  //#endregion
37
37
  export { tsquery as t };
38
38
 
39
- //# sourceMappingURL=full-text-CcHf5wkL.mjs.map
39
+ //# sourceMappingURL=full-text-7szWl7EC.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"full-text-CcHf5wkL.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/full-text.mjs"],"sourcesContent":["import { l as postgresError } from \"./errors-Di_apgWJ.mjs\";\nimport \"./full-text-index-definition-B0kQDs_M.mjs\";\nimport { c as FullTextDocument, i as websearchToTsquery, l as fullTextDocument, n as plaintoTsquery, o as languageLiteral, r as toTsquery, t as phrasetoTsquery } from \"./full-text-parsers-hI_qtk-Q.mjs\";\n//#region src/core/tsquery-tag.ts\n/**\n* An empty term, `''`, is a `tsquery` syntax error; a single space parses as a term with no words,\n* as a stop word does.\n*/\nfunction quotedTerm(value) {\n\treturn value === \"\" ? \"' '\" : `'${value.replaceAll(\"\\\\\", \"\\\\\\\\\").replaceAll(\"'\", \"''\")}'`;\n}\nfunction literalPart(strings, index) {\n\tconst part = strings[index];\n\tif (part === void 0) throw postgresError(\"RUNTIME.ARGUMENT_INVALID\", `tsquery: literal part ${index} of the template has an invalid escape sequence.`, {\n\t\twhy: \"JavaScript gives a template tag no text for a literal part with an invalid escape such as \\\\u or \\\\x, so the tsquery syntax written there would be lost.\",\n\t\tfix: \"Write a literal backslash as \\\\\\\\, or remove the escape.\",\n\t\tmeta: {\n\t\t\thelper: \"tsquery\",\n\t\t\targument: `literal part ${index}`,\n\t\t\treceived: strings.raw[index]\n\t\t}\n\t});\n\treturn part;\n}\nfunction assemble(strings, values) {\n\treturn values.reduce((text, value, i) => `${text}${quotedTerm(value)}${literalPart(strings, i + 1)}`, literalPart(strings, 0));\n}\nfunction isTemplate(value) {\n\treturn Array.isArray(value);\n}\nfunction tsquery(first, ...values) {\n\tif (isTemplate(first)) return toTsquery(assemble(first, values));\n\tconst language = first.language ?? \"english\";\n\tlanguageLiteral(\"tsquery\", language);\n\treturn (strings, ...templateValues) => toTsquery(assemble(strings, templateValues), { language });\n}\n//#endregion\nexport { FullTextDocument, fullTextDocument, phrasetoTsquery, plaintoTsquery, toTsquery, tsquery, websearchToTsquery };\n\n//# sourceMappingURL=full-text.mjs.map"],"mappings":";;;;;;;AAQA,SAAS,WAAW,OAAO;CAC1B,OAAO,UAAU,KAAK,QAAQ,IAAI,MAAM,WAAW,MAAM,MAAM,CAAC,CAAC,WAAW,KAAK,IAAI,EAAE;AACxF;AACA,SAAS,YAAY,SAAS,OAAO;CACpC,MAAM,OAAO,QAAQ;CACrB,IAAI,SAAS,KAAK,GAAG,MAAM,cAAc,4BAA4B,yBAAyB,MAAM,mDAAmD;EACtJ,KAAK;EACL,KAAK;EACL,MAAM;GACL,QAAQ;GACR,UAAU,gBAAgB;GAC1B,UAAU,QAAQ,IAAI;EACvB;CACD,CAAC;CACD,OAAO;AACR;AACA,SAAS,SAAS,SAAS,QAAQ;CAClC,OAAO,OAAO,QAAQ,MAAM,OAAO,MAAM,GAAG,OAAO,WAAW,KAAK,IAAI,YAAY,SAAS,IAAI,CAAC,KAAK,YAAY,SAAS,CAAC,CAAC;AAC9H;AACA,SAAS,WAAW,OAAO;CAC1B,OAAO,MAAM,QAAQ,KAAK;AAC3B;AACA,SAAS,QAAQ,OAAO,GAAG,QAAQ;CAClC,IAAI,WAAW,KAAK,GAAG,OAAO,UAAU,SAAS,OAAO,MAAM,CAAC;CAC/D,MAAM,WAAW,MAAM,YAAY;CACnC,gBAAgB,WAAW,QAAQ;CACnC,QAAQ,SAAS,GAAG,mBAAmB,UAAU,SAAS,SAAS,cAAc,GAAG,EAAE,SAAS,CAAC;AACjG"}
1
+ {"version":3,"file":"full-text-7szWl7EC.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/full-text.mjs"],"sourcesContent":["import { l as postgresError } from \"./errors-DG6xgXgr.mjs\";\nimport \"./full-text-index-definition-BRNRSgZK.mjs\";\nimport { c as FullTextDocument, i as websearchToTsquery, l as fullTextDocument, n as plaintoTsquery, o as languageLiteral, r as toTsquery, t as phrasetoTsquery } from \"./full-text-parsers-Dd5DOdBA.mjs\";\n//#region src/core/tsquery-tag.ts\n/**\n* An empty term, `''`, is a `tsquery` syntax error; a single space parses as a term with no words,\n* as a stop word does.\n*/\nfunction quotedTerm(value) {\n\treturn value === \"\" ? \"' '\" : `'${value.replaceAll(\"\\\\\", \"\\\\\\\\\").replaceAll(\"'\", \"''\")}'`;\n}\nfunction literalPart(strings, index) {\n\tconst part = strings[index];\n\tif (part === void 0) throw postgresError(\"RUNTIME.ARGUMENT_INVALID\", `tsquery: literal part ${index} of the template has an invalid escape sequence.`, {\n\t\twhy: \"JavaScript gives a template tag no text for a literal part with an invalid escape such as \\\\u or \\\\x, so the tsquery syntax written there would be lost.\",\n\t\tfix: \"Write a literal backslash as \\\\\\\\, or remove the escape.\",\n\t\tmeta: {\n\t\t\thelper: \"tsquery\",\n\t\t\targument: `literal part ${index}`,\n\t\t\treceived: strings.raw[index]\n\t\t}\n\t});\n\treturn part;\n}\nfunction assemble(strings, values) {\n\treturn values.reduce((text, value, i) => `${text}${quotedTerm(value)}${literalPart(strings, i + 1)}`, literalPart(strings, 0));\n}\nfunction isTemplate(value) {\n\treturn Array.isArray(value);\n}\nfunction tsquery(first, ...values) {\n\tif (isTemplate(first)) return toTsquery(assemble(first, values));\n\tconst language = first.language ?? \"english\";\n\tlanguageLiteral(\"tsquery\", language);\n\treturn (strings, ...templateValues) => toTsquery(assemble(strings, templateValues), { language });\n}\n//#endregion\nexport { FullTextDocument, fullTextDocument, phrasetoTsquery, plaintoTsquery, toTsquery, tsquery, websearchToTsquery };\n\n//# sourceMappingURL=full-text.mjs.map"],"mappings":";;;;;;;AAQA,SAAS,WAAW,OAAO;CAC1B,OAAO,UAAU,KAAK,QAAQ,IAAI,MAAM,WAAW,MAAM,MAAM,CAAC,CAAC,WAAW,KAAK,IAAI,EAAE;AACxF;AACA,SAAS,YAAY,SAAS,OAAO;CACpC,MAAM,OAAO,QAAQ;CACrB,IAAI,SAAS,KAAK,GAAG,MAAM,cAAc,4BAA4B,yBAAyB,MAAM,mDAAmD;EACtJ,KAAK;EACL,KAAK;EACL,MAAM;GACL,QAAQ;GACR,UAAU,gBAAgB;GAC1B,UAAU,QAAQ,IAAI;EACvB;CACD,CAAC;CACD,OAAO;AACR;AACA,SAAS,SAAS,SAAS,QAAQ;CAClC,OAAO,OAAO,QAAQ,MAAM,OAAO,MAAM,GAAG,OAAO,WAAW,KAAK,IAAI,YAAY,SAAS,IAAI,CAAC,KAAK,YAAY,SAAS,CAAC,CAAC;AAC9H;AACA,SAAS,WAAW,OAAO;CAC1B,OAAO,MAAM,QAAQ,KAAK;AAC3B;AACA,SAAS,QAAQ,OAAO,GAAG,QAAQ;CAClC,IAAI,WAAW,KAAK,GAAG,OAAO,UAAU,SAAS,OAAO,MAAM,CAAC;CAC/D,MAAM,WAAW,MAAM,YAAY;CACnC,gBAAgB,WAAW,QAAQ;CACnC,QAAQ,SAAS,GAAG,mBAAmB,UAAU,SAAS,SAAS,cAAc,GAAG,EAAE,SAAS,CAAC;AACjG"}
@@ -1,9 +1,9 @@
1
1
  import { n as FULL_TEXT_INDEX_TYPE } from "./full-text-index-definition-D5iBWLss-BEpqiucV.mjs";
2
- import { n as Resolve, t as ExtractedCodecTypes } from "./codec-type-map-CIZ7LbPA-CeMPxEAm.mjs";
3
- import { d as TsqueryArgument } from "./operation-types-BlaAPrew-BkZiJwPy.mjs";
2
+ import { n as Resolve, t as ExtractedCodecTypes } from "./codec-type-map-DSuWVp-n-Cp4c9JWN.mjs";
3
+ import { d as TsqueryArgument } from "./operation-types-DfWYI0Cn-fXs3p9mN.mjs";
4
4
  import { UniqueIndexNamesOfType } from "@prisma/orm-family-sql/relational-core/index-reference";
5
5
  import { CollectionMethodContributionType, CollectionMethodModelType } from "@prisma/orm-family-sql/relational-core/collection-methods";
6
- //#region ../../../3-targets/postgres/1-target/dist/full-text-collection-method-DHuJr46z.d.mts
6
+ //#region ../../../3-targets/postgres/1-target/dist/full-text-collection-method-DvmPrdZL.d.mts
7
7
  //#region src/core/full-text-collection-method.d.ts
8
8
  /** A `tsquery` expression from a parser or the `tsquery` tag, or a `tsquery` value read back from a query. */
9
9
  type PostgresTsqueryArgument = TsqueryArgument<Resolve<ExtractedCodecTypes>>;
@@ -24,4 +24,4 @@ declare module '@prisma/orm-family-sql/relational-core/collection-methods' {
24
24
  }
25
25
  //#endregion
26
26
  export { PostgresTsqueryArgument as n, PostgresFullTextMethods as t };
27
- //# sourceMappingURL=full-text-collection-method-DHuJr46z-Bndk11cK.d.mts.map
27
+ //# sourceMappingURL=full-text-collection-method-DvmPrdZL-B1FlBM0E.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"full-text-collection-method-DvmPrdZL-B1FlBM0E.d.mts","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/full-text-collection-method-DvmPrdZL.d.mts"],"mappings":";;;;;;;;KAOK,0BAA0B,gBAAgB,QAAQ;UAC7C;WACC,sBAAsB,OAAO;WAC7B;WACA;;KAEN,oBAAoB,cAAc,6BAA6B,iDAAiD,QAAQ,uBAAuB,0CAA0C,wBAAwB,6BAA6B;;UAEzO,gCAAgC;WAC/B,SAAS;;;YAGR;aACC,qBAAqB"}
@@ -1,7 +1,7 @@
1
- import { l as postgresError } from "./errors-Di_apgWJ-BLXRTfFj.mjs";
1
+ import { l as postgresError } from "./errors-DG6xgXgr-Cb1XcPcb.mjs";
2
2
  import { type } from "arktype";
3
3
  import { invariant } from "@prisma/orm-framework/utils/assertions";
4
- //#region ../../../3-targets/postgres/1-target/dist/full-text-index-definition-B0kQDs_M.mjs
4
+ //#region ../../../3-targets/postgres/1-target/dist/full-text-index-definition-BRNRSgZK.mjs
5
5
  /** The weights Postgres's `setweight` takes, strongest first. Each weight group takes the next one. */
6
6
  const FULL_TEXT_WEIGHTS = [
7
7
  "A",
@@ -192,4 +192,4 @@ function invalidFullTextIndex(index, message, why) {
192
192
  //#endregion
193
193
  export { assertFullTextIndexes as a, fullTextIndexOptions as c, isFullTextSearchLanguage as d, weightGroupsOf as f, POSTGRES_TEXT_SEARCH_LANGUAGES as i, fullTextIndexProblems as l, FULL_TEXT_INDEX_TYPE as n, describeFullTextIndexProblem as o, FULL_TEXT_WEIGHTS as r, fullTextIndexDefinitionOf as s, DEFAULT_FULL_TEXT_SEARCH_LANGUAGE as t, fullTextIndexType as u };
194
194
 
195
- //# sourceMappingURL=full-text-index-definition-B0kQDs_M-8N6Slj3l.mjs.map
195
+ //# sourceMappingURL=full-text-index-definition-BRNRSgZK-l_2TBarg.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"full-text-index-definition-B0kQDs_M-8N6Slj3l.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/full-text-index-definition-B0kQDs_M.mjs"],"sourcesContent":["import { l as postgresError } from \"./errors-Di_apgWJ.mjs\";\nimport { type } from \"arktype\";\nimport { invariant } from \"@internal/utils/assertions\";\n//#region src/core/full-text-weight-groups.ts\n/** The weights Postgres's `setweight` takes, strongest first. Each weight group takes the next one. */\nconst FULL_TEXT_WEIGHTS = [\n\t\"A\",\n\t\"B\",\n\t\"C\",\n\t\"D\"\n];\nfunction weightGroupsOf(fields, isField) {\n\tif (isField(fields)) return [[fields]];\n\treturn fields.map((item) => isField(item) ? [item] : item);\n}\n//#endregion\n//#region src/core/text-search-languages.ts\n/**\n* The text-search configurations a stock PostgreSQL server ships with. The language reaches SQL as\n* an inline literal rather than a bound parameter, so only names on this list may be used.\n*/\nconst POSTGRES_TEXT_SEARCH_LANGUAGES = [\n\t\"simple\",\n\t\"arabic\",\n\t\"armenian\",\n\t\"basque\",\n\t\"catalan\",\n\t\"danish\",\n\t\"dutch\",\n\t\"english\",\n\t\"finnish\",\n\t\"french\",\n\t\"german\",\n\t\"greek\",\n\t\"hindi\",\n\t\"hungarian\",\n\t\"indonesian\",\n\t\"irish\",\n\t\"italian\",\n\t\"lithuanian\",\n\t\"nepali\",\n\t\"norwegian\",\n\t\"portuguese\",\n\t\"romanian\",\n\t\"russian\",\n\t\"serbian\",\n\t\"spanish\",\n\t\"swedish\",\n\t\"tamil\",\n\t\"turkish\",\n\t\"yiddish\"\n];\nconst DEFAULT_FULL_TEXT_SEARCH_LANGUAGE = \"english\";\nconst KNOWN_LANGUAGES = new Set(POSTGRES_TEXT_SEARCH_LANGUAGES);\nfunction isFullTextSearchLanguage(language) {\n\treturn KNOWN_LANGUAGES.has(language);\n}\n//#endregion\n//#region src/core/full-text-index-definition.ts\n/** The index type a full-text index is registered under. */\nconst FULL_TEXT_INDEX_TYPE = \"fullText\";\n/** The traits the codec of every column a full-text index covers must carry. */\nconst FULL_TEXT_COLUMN_TRAITS = [\"textual\"];\n/**\n* The rules of a full-text index, stated once: one to four weight groups, none empty, each field\n* once, text columns only, and not unique. Every site that checks a full-text index calls this.\n*/\nfunction fullTextIndexProblems(candidate) {\n\tconst { weightGroups } = candidate;\n\tconst problems = [];\n\tif (weightGroups.length === 0) problems.push({ kind: \"no-fields\" });\n\tif (weightGroups.length > FULL_TEXT_WEIGHTS.length) problems.push({\n\t\tkind: \"too-many-groups\",\n\t\tgroupCount: weightGroups.length\n\t});\n\tweightGroups.forEach((group, position) => {\n\t\tif (group.length === 0) problems.push({\n\t\t\tkind: \"empty-group\",\n\t\t\tposition\n\t\t});\n\t});\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const field of weightGroups.flat()) {\n\t\tif (seen.has(field)) problems.push({\n\t\t\tkind: \"duplicate-field\",\n\t\t\tfield\n\t\t});\n\t\tseen.add(field);\n\t}\n\tconst { codecs } = candidate;\n\tif (codecs !== void 0) for (const field of new Set(weightGroups.flat())) {\n\t\tconst codecId = codecs.codecIdOf(field);\n\t\tif (codecId === void 0 || !carriesFullTextTraits(codecs.traitsOf(codecId))) problems.push({\n\t\t\tkind: \"not-text\",\n\t\t\tfield,\n\t\t\tcodecId\n\t\t});\n\t}\n\tif (candidate.unique === true) problems.push({ kind: \"unique\" });\n\treturn problems;\n}\nfunction carriesFullTextTraits(traits) {\n\treturn traits !== void 0 && FULL_TEXT_COLUMN_TRAITS.every((trait) => traits.includes(trait));\n}\nfunction describeFullTextIndexProblem(subject, problem, fieldLabel = (field) => field) {\n\tswitch (problem.kind) {\n\t\tcase \"no-fields\": return `${subject} needs at least one field.`;\n\t\tcase \"too-many-groups\": return `${subject} takes at most ${FULL_TEXT_WEIGHTS.length} weight groups, one for each of the weights ${FULL_TEXT_WEIGHTS.join(\", \")}, but was given ${problem.groupCount}.`;\n\t\tcase \"empty-group\": return `${subject} has an empty weight group at position ${problem.position + 1}.`;\n\t\tcase \"duplicate-field\": return `${subject} names the field \"${fieldLabel(problem.field)}\" more than once.`;\n\t\tcase \"not-text\": return `${subject} indexes text columns, but \"${fieldLabel(problem.field)}\" is ${problem.codecId === void 0 ? \"not a stored scalar field\" : `stored as \\`${problem.codecId}\\``}.`;\n\t\tcase \"unique\": return `${subject} is unique, but Postgres builds no unique gin index.`;\n\t}\n}\n/** The options of a full-text index: its weight groups, as storage column names, and its language. */\nconst fullTextIndexOptions = type({\n\t\"+\": \"reject\",\n\tweightGroups: type(\"string > 0\").array().array().narrow((weightGroups, ctx) => {\n\t\tconst [problem] = fullTextIndexProblems({ weightGroups });\n\t\treturn problem === void 0 || ctx.reject({ message: describeFullTextIndexProblem(\"a full-text index\", problem) });\n\t}),\n\tlanguage: type.enumerated(...POSTGRES_TEXT_SEARCH_LANGUAGES)\n});\n/**\n* The registration of the full-text index type. Its options are the index's definition, not\n* storage parameters, and the target turns them into a `gin` index over the rendered search\n* document.\n*/\nconst fullTextIndexType = {\n\toptions: fullTextIndexOptions,\n\taccessMethod: \"gin\",\n\tcolumnTraits: FULL_TEXT_COLUMN_TRAITS\n};\n/**\n* The definition a full-text index carries, or `undefined` for an index of any other type. It\n* reads an index {@link assertFullTextIndexes} has accepted, as every loaded contract's has been.\n*/\nfunction fullTextIndexDefinitionOf(index) {\n\tif (index.type !== \"fullText\") return void 0;\n\tconst definition = fullTextIndexOptions(index.options ?? {});\n\tinvariant(!(definition instanceof type.errors), \"a full-text index is read only after its contract was checked\");\n\treturn definition;\n}\n/**\n* Refuses a table's full-text index the contract cannot carry: invalid options, a broken rule of\n* {@link fullTextIndexProblems}, `columns` that are not the fields of its weight groups, in order,\n* or a foreign key that names it as its backing index. The text-columns rule is checked only when\n* `traitsOf` is given.\n*/\nfunction assertFullTextIndexes(table, traitsOf) {\n\tconst codecs = traitsOf === void 0 ? void 0 : {\n\t\tcodecIdOf: (column) => table.columns[column]?.codecId,\n\t\ttraitsOf\n\t};\n\tfor (const index of table.indexes) assertFullTextIndex(index, codecs);\n\tfor (const foreignKey of table.foreignKeys) {\n\t\tconst backing = foreignKey.index;\n\t\tif (backing === void 0 || !(\"name\" in backing)) continue;\n\t\tconst index = table.indexes.find((candidate) => candidate.name === backing.name);\n\t\tif (index?.type !== \"fullText\") continue;\n\t\tthrow postgresError(\"CONTRACT.INDEX_INVALID\", `The foreign key on columns (${foreignKey.source.columns.join(\", \")}) is backed by full-text index \"${index.name}\".`, {\n\t\t\twhy: \"A full-text index is a gin index over a search document rendered from its weight groups, not over its columns, so it does not serve the foreign key's lookups.\",\n\t\t\tfix: \"Re-emit the contract from its source, where a relation cannot name a full-text index as its index.\",\n\t\t\tmeta: {\n\t\t\t\tindex: index.name,\n\t\t\t\tcolumns: foreignKey.source.columns\n\t\t\t}\n\t\t});\n\t}\n}\nfunction assertFullTextIndex(index, codecs) {\n\tif (index.type !== \"fullText\") return;\n\tconst definition = fullTextIndexOptions(index.options ?? {});\n\tif (definition instanceof type.errors) throw invalidFullTextIndex(index, `Full-text index \"${index.name}\" has invalid options: ${definition.summary}`, \"The options of a full-text index are its definition: its weight groups and its language.\");\n\tconst [problem] = fullTextIndexProblems({\n\t\tweightGroups: definition.weightGroups,\n\t\tunique: index.unique,\n\t\tcodecs\n\t});\n\tif (problem !== void 0) throw invalidFullTextIndex(index, describeFullTextIndexProblem(`Full-text index \"${index.name}\"`, problem), \"A full-text index is a gin index over text columns, in one to four weight groups that name each column once.\");\n\tconst fields = definition.weightGroups.flat();\n\tconst columns = index.columns ?? [];\n\tif (columns.length !== fields.length || columns.some((column, i) => column !== fields[i])) throw invalidFullTextIndex(index, `Full-text index \"${index.name}\" covers the columns [${columns.join(\", \")}], but its weight groups name [${fields.join(\", \")}].`, \"The columns of a full-text index are the fields of its weight groups, in order. Foreign-key backing and the printer read the columns; the search document is rendered from the groups, so the two must agree.\");\n}\nfunction invalidFullTextIndex(index, message, why) {\n\treturn postgresError(\"CONTRACT.INDEX_INVALID\", message, {\n\t\twhy,\n\t\tfix: \"Re-emit the contract from its `@@fullTextIndex` or `fullTextIndex` source rather than editing the index by hand.\",\n\t\tmeta: {\n\t\t\tindex: index.name,\n\t\t\tcolumns: index.columns,\n\t\t\toptions: index.options\n\t\t}\n\t});\n}\n//#endregion\nexport { fullTextIndexOptions as a, DEFAULT_FULL_TEXT_SEARCH_LANGUAGE as c, FULL_TEXT_WEIGHTS as d, weightGroupsOf as f, fullTextIndexDefinitionOf as i, POSTGRES_TEXT_SEARCH_LANGUAGES as l, assertFullTextIndexes as n, fullTextIndexProblems as o, describeFullTextIndexProblem as r, fullTextIndexType as s, FULL_TEXT_INDEX_TYPE as t, isFullTextSearchLanguage as u };\n\n//# sourceMappingURL=full-text-index-definition-B0kQDs_M.mjs.map"],"mappings":";;;;;AAKA,MAAM,oBAAoB;CACzB;CACA;CACA;CACA;AACD;AACA,SAAS,eAAe,QAAQ,SAAS;CACxC,IAAI,QAAQ,MAAM,GAAG,OAAO,CAAC,CAAC,MAAM,CAAC;CACrC,OAAO,OAAO,KAAK,SAAS,QAAQ,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI;AAC1D;;;;;AAOA,MAAM,iCAAiC;CACtC;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;AACA,MAAM,oCAAoC;AAC1C,MAAM,kBAAkB,IAAI,IAAI,8BAA8B;AAC9D,SAAS,yBAAyB,UAAU;CAC3C,OAAO,gBAAgB,IAAI,QAAQ;AACpC;;AAIA,MAAM,uBAAuB;;AAE7B,MAAM,0BAA0B,CAAC,SAAS;;;;;AAK1C,SAAS,sBAAsB,WAAW;CACzC,MAAM,EAAE,iBAAiB;CACzB,MAAM,WAAW,CAAC;CAClB,IAAI,aAAa,WAAW,GAAG,SAAS,KAAK,EAAE,MAAM,YAAY,CAAC;CAClE,IAAI,aAAa,SAAS,kBAAkB,QAAQ,SAAS,KAAK;EACjE,MAAM;EACN,YAAY,aAAa;CAC1B,CAAC;CACD,aAAa,SAAS,OAAO,aAAa;EACzC,IAAI,M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A,SAAS,oBAAoB,OAAO,QAAQ;CAC3C,IAAI,MAAM,SAAS,YAAY;CAC/B,MAAM,aAAa,qBAAqB,MAAM,WAAW,CAAC,CAAC;CAC3D,IAAI,sBAAsB,KAAK,QAAQ,MAAM,qBAAqB,OAAO,oBAAoB,MAAM,KAAK,yBAAyB,WAAW,WAAW,0FAA0F;CACjP,MAAM,CAAC,WAAW,sBAAsB;EACvC,cAAc,WAAW;EACzB,QAAQ,MAAM;EACd;CACD,CAAC;CACD,IAAI,YAAY,KAAK,GAAG,MAAM,qBAAqB,OAAO,6BAA6B,oBAAoB,MAAM,KAAK,IAAI,OAAO,GAAG,8GAA8G;CAClP,MAAM,SAAS,WAAW,aAAa,KAAK;CAC5C,MAAM,UAAU,MAAM,WAAW,CAAC;CAClC,IAAI,QAAQ,WAAW,OAAO,UAAU,QAAQ,MAAM,QAAQ,MAAM,WAAW,OAAO,EAAE,GAAG,MAAM,qBAAqB,OAAO,oBAAoB,MAAM,KAAK,wBAAwB,QAAQ,KAAK,IAAI,EAAE,iCAAiC,OAAO,KAAK,IAAI,EAAE,KAAK,+MAA+M;AAC/c;AACA,SAAS,qBAAqB,OAAO,SAAS,KAAK;CAClD,OAAO,cAAc,0BAA0B,SAAS;EACvD;EACA,KAAK;EACL,MAAM;GACL,OAAO,MAAM;GACb,SAAS,MAAM;GACf,SAAS,MAAM;EAChB;CACD,CAAC;AACF"}
1
+ {"version":3,"file":"full-text-index-definition-BRNRSgZK-l_2TBarg.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/full-text-index-definition-BRNRSgZK.mjs"],"sourcesContent":["import { l as postgresError } from \"./errors-DG6xgXgr.mjs\";\nimport { type } from \"arktype\";\nimport { invariant } from \"@internal/utils/assertions\";\n//#region src/core/full-text-weight-groups.ts\n/** The weights Postgres's `setweight` takes, strongest first. Each weight group takes the next one. */\nconst FULL_TEXT_WEIGHTS = [\n\t\"A\",\n\t\"B\",\n\t\"C\",\n\t\"D\"\n];\nfunction weightGroupsOf(fields, isField) {\n\tif (isField(fields)) return [[fields]];\n\treturn fields.map((item) => isField(item) ? [item] : item);\n}\n//#endregion\n//#region src/core/text-search-languages.ts\n/**\n* The text-search configurations a stock PostgreSQL server ships with. The language reaches SQL as\n* an inline literal rather than a bound parameter, so only names on this list may be used.\n*/\nconst POSTGRES_TEXT_SEARCH_LANGUAGES = [\n\t\"simple\",\n\t\"arabic\",\n\t\"armenian\",\n\t\"basque\",\n\t\"catalan\",\n\t\"danish\",\n\t\"dutch\",\n\t\"english\",\n\t\"finnish\",\n\t\"french\",\n\t\"german\",\n\t\"greek\",\n\t\"hindi\",\n\t\"hungarian\",\n\t\"indonesian\",\n\t\"irish\",\n\t\"italian\",\n\t\"lithuanian\",\n\t\"nepali\",\n\t\"norwegian\",\n\t\"portuguese\",\n\t\"romanian\",\n\t\"russian\",\n\t\"serbian\",\n\t\"spanish\",\n\t\"swedish\",\n\t\"tamil\",\n\t\"turkish\",\n\t\"yiddish\"\n];\nconst DEFAULT_FULL_TEXT_SEARCH_LANGUAGE = \"english\";\nconst KNOWN_LANGUAGES = new Set(POSTGRES_TEXT_SEARCH_LANGUAGES);\nfunction isFullTextSearchLanguage(language) {\n\treturn KNOWN_LANGUAGES.has(language);\n}\n//#endregion\n//#region src/core/full-text-index-definition.ts\n/** The index type a full-text index is registered under. */\nconst FULL_TEXT_INDEX_TYPE = \"fullText\";\n/** The traits the codec of every column a full-text index covers must carry. */\nconst FULL_TEXT_COLUMN_TRAITS = [\"textual\"];\n/**\n* The rules of a full-text index, stated once: one to four weight groups, none empty, each field\n* once, text columns only, and not unique. Every site that checks a full-text index calls this.\n*/\nfunction fullTextIndexProblems(candidate) {\n\tconst { weightGroups } = candidate;\n\tconst problems = [];\n\tif (weightGroups.length === 0) problems.push({ kind: \"no-fields\" });\n\tif (weightGroups.length > FULL_TEXT_WEIGHTS.length) problems.push({\n\t\tkind: \"too-many-groups\",\n\t\tgroupCount: weightGroups.length\n\t});\n\tweightGroups.forEach((group, position) => {\n\t\tif (group.length === 0) problems.push({\n\t\t\tkind: \"empty-group\",\n\t\t\tposition\n\t\t});\n\t});\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const field of weightGroups.flat()) {\n\t\tif (seen.has(field)) problems.push({\n\t\t\tkind: \"duplicate-field\",\n\t\t\tfield\n\t\t});\n\t\tseen.add(field);\n\t}\n\tconst { codecs } = candidate;\n\tif (codecs !== void 0) for (const field of new Set(weightGroups.flat())) {\n\t\tconst codecId = codecs.codecIdOf(field);\n\t\tif (codecId === void 0 || !carriesFullTextTraits(codecs.traitsOf(codecId))) problems.push({\n\t\t\tkind: \"not-text\",\n\t\t\tfield,\n\t\t\tcodecId\n\t\t});\n\t}\n\tif (candidate.unique === true) problems.push({ kind: \"unique\" });\n\treturn problems;\n}\nfunction carriesFullTextTraits(traits) {\n\treturn traits !== void 0 && FULL_TEXT_COLUMN_TRAITS.every((trait) => traits.includes(trait));\n}\nfunction describeFullTextIndexProblem(subject, problem, fieldLabel = (field) => field) {\n\tswitch (problem.kind) {\n\t\tcase \"no-fields\": return `${subject} needs at least one field.`;\n\t\tcase \"too-many-groups\": return `${subject} takes at most ${FULL_TEXT_WEIGHTS.length} weight groups, one for each of the weights ${FULL_TEXT_WEIGHTS.join(\", \")}, but was given ${problem.groupCount}.`;\n\t\tcase \"empty-group\": return `${subject} has an empty weight group at position ${problem.position + 1}.`;\n\t\tcase \"duplicate-field\": return `${subject} names the field \"${fieldLabel(problem.field)}\" more than once.`;\n\t\tcase \"not-text\": return `${subject} indexes text columns, but \"${fieldLabel(problem.field)}\" is ${problem.codecId === void 0 ? \"not a stored scalar field\" : `stored as \\`${problem.codecId}\\``}.`;\n\t\tcase \"unique\": return `${subject} is unique, but Postgres builds no unique gin index.`;\n\t}\n}\n/** The options of a full-text index: its weight groups, as storage column names, and its language. */\nconst fullTextIndexOptions = type({\n\t\"+\": \"reject\",\n\tweightGroups: type(\"string > 0\").array().array().narrow((weightGroups, ctx) => {\n\t\tconst [problem] = fullTextIndexProblems({ weightGroups });\n\t\treturn problem === void 0 || ctx.reject({ message: describeFullTextIndexProblem(\"a full-text index\", problem) });\n\t}),\n\tlanguage: type.enumerated(...POSTGRES_TEXT_SEARCH_LANGUAGES)\n});\n/**\n* The registration of the full-text index type. Its options are the index's definition, not\n* storage parameters, and the target turns them into a `gin` index over the rendered search\n* document.\n*/\nconst fullTextIndexType = {\n\toptions: fullTextIndexOptions,\n\taccessMethod: \"gin\",\n\tcolumnTraits: FULL_TEXT_COLUMN_TRAITS\n};\n/**\n* The definition a full-text index carries, or `undefined` for an index of any other type. It\n* reads an index {@link assertFullTextIndexes} has accepted, as every loaded contract's has been.\n*/\nfunction fullTextIndexDefinitionOf(index) {\n\tif (index.type !== \"fullText\") return void 0;\n\tconst definition = fullTextIndexOptions(index.options ?? {});\n\tinvariant(!(definition instanceof type.errors), \"a full-text index is read only after its contract was checked\");\n\treturn definition;\n}\n/**\n* Refuses a table's full-text index the contract cannot carry: invalid options, a broken rule of\n* {@link fullTextIndexProblems}, `columns` that are not the fields of its weight groups, in order,\n* or a foreign key that names it as its backing index. The text-columns rule is checked only when\n* `traitsOf` is given.\n*/\nfunction assertFullTextIndexes(table, traitsOf) {\n\tconst codecs = traitsOf === void 0 ? void 0 : {\n\t\tcodecIdOf: (column) => table.columns[column]?.codecId,\n\t\ttraitsOf\n\t};\n\tfor (const index of table.indexes) assertFullTextIndex(index, codecs);\n\tfor (const foreignKey of table.foreignKeys) {\n\t\tconst backing = foreignKey.index;\n\t\tif (backing === void 0 || !(\"name\" in backing)) continue;\n\t\tconst index = table.indexes.find((candidate) => candidate.name === backing.name);\n\t\tif (index?.type !== \"fullText\") continue;\n\t\tthrow postgresError(\"CONTRACT.INDEX_INVALID\", `The foreign key on columns (${foreignKey.source.columns.join(\", \")}) is backed by full-text index \"${index.name}\".`, {\n\t\t\twhy: \"A full-text index is a gin index over a search document rendered from its weight groups, not over its columns, so it does not serve the foreign key's lookups.\",\n\t\t\tfix: \"Re-emit the contract from its source, where a relation cannot name a full-text index as its index.\",\n\t\t\tmeta: {\n\t\t\t\tindex: index.name,\n\t\t\t\tcolumns: foreignKey.source.columns\n\t\t\t}\n\t\t});\n\t}\n}\nfunction assertFullTextIndex(index, codecs) {\n\tif (index.type !== \"fullText\") return;\n\tconst definition = fullTextIndexOptions(index.options ?? {});\n\tif (definition instanceof type.errors) throw invalidFullTextIndex(index, `Full-text index \"${index.name}\" has invalid options: ${definition.summary}`, \"The options of a full-text index are its definition: its weight groups and its language.\");\n\tconst [problem] = fullTextIndexProblems({\n\t\tweightGroups: definition.weightGroups,\n\t\tunique: index.unique,\n\t\tcodecs\n\t});\n\tif (problem !== void 0) throw invalidFullTextIndex(index, describeFullTextIndexProblem(`Full-text index \"${index.name}\"`, problem), \"A full-text index is a gin index over text columns, in one to four weight groups that name each column once.\");\n\tconst fields = definition.weightGroups.flat();\n\tconst columns = index.columns ?? [];\n\tif (columns.length !== fields.length || columns.some((column, i) => column !== fields[i])) throw invalidFullTextIndex(index, `Full-text index \"${index.name}\" covers the columns [${columns.join(\", \")}], but its weight groups name [${fields.join(\", \")}].`, \"The columns of a full-text index are the fields of its weight groups, in order. Foreign-key backing and the printer read the columns; the search document is rendered from the groups, so the two must agree.\");\n}\nfunction invalidFullTextIndex(index, message, why) {\n\treturn postgresError(\"CONTRACT.INDEX_INVALID\", message, {\n\t\twhy,\n\t\tfix: \"Re-emit the contract from its `@@fullTextIndex` or `fullTextIndex` source rather than editing the index by hand.\",\n\t\tmeta: {\n\t\t\tindex: index.name,\n\t\t\tcolumns: index.columns,\n\t\t\toptions: index.options\n\t\t}\n\t});\n}\n//#endregion\nexport { fullTextIndexOptions as a, DEFAULT_FULL_TEXT_SEARCH_LANGUAGE as c, FULL_TEXT_WEIGHTS as d, weightGroupsOf as f, fullTextIndexDefinitionOf as i, POSTGRES_TEXT_SEARCH_LANGUAGES as l, assertFullTextIndexes as n, fullTextIndexProblems as o, describeFullTextIndexProblem as r, fullTextIndexType as s, FULL_TEXT_INDEX_TYPE as t, isFullTextSearchLanguage as u };\n\n//# sourceMappingURL=full-text-index-definition-BRNRSgZK.mjs.map"],"mappings":";;;;;AAKA,MAAM,oBAAoB;CACzB;CACA;CACA;CACA;AACD;AACA,SAAS,eAAe,QAAQ,SAAS;CACxC,IAAI,QAAQ,MAAM,GAAG,OAAO,CAAC,CAAC,MAAM,CAAC;CACrC,OAAO,OAAO,KAAK,SAAS,QAAQ,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI;AAC1D;;;;;AAOA,MAAM,iCAAiC;CACtC;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;AACA,MAAM,oCAAoC;AAC1C,MAAM,kBAAkB,IAAI,IAAI,8BAA8B;AAC9D,SAAS,yBAAyB,UAAU;CAC3C,OAAO,gBAAgB,IAAI,QAAQ;AACpC;;AAIA,MAAM,uBAAuB;;AAE7B,MAAM,0BAA0B,CAAC,SAAS;;;;;AAK1C,SAAS,sBAAsB,WAAW;CACzC,MAAM,EAAE,iBAAiB;CACzB,MAAM,WAAW,CAAC;CAClB,IAAI,aAAa,WAAW,GAAG,SAAS,KAAK,EAAE,MAAM,YAAY,CAAC;CAClE,IAAI,aAAa,SAAS,kBAAkB,QAAQ,SAAS,KAAK;EACjE,MAAM;EACN,YAAY,aAAa;CAC1B,CAAC;CACD,aAAa,SAAS,OAAO,aAAa;EACzC,IAAI,MAAM,WAAW,GAAG,SAAS,KAAK;GACrC,MAAM;GACN;EACD,CAAC;CACF,CAAC;CACD,MAAM,uBAAuB,IAAI,IAAI;CACrC,KAAK,MAAM,SAAS,aAAa,KAAK,GAAG;EACxC,IAAI,KAAK,IAAI,KAAK,GAAG,SAAS,KAAK;GAClC,MAAM;GACN;EACD,CAAC;EACD,KAAK,IAAI,KAAK;CACf;CACA,MAAM,EAAE,WAAW;CACn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zB,QAAQ,MAAM;EACd;CACD,CAAC;CACD,IAAI,YAAY,KAAK,GAAG,MAAM,qBAAqB,OAAO,6BAA6B,oBAAoB,MAAM,KAAK,IAAI,OAAO,GAAG,8GAA8G;CAClP,MAAM,SAAS,WAAW,aAAa,KAAK;CAC5C,MAAM,UAAU,MAAM,WAAW,CAAC;CAClC,IAAI,QAAQ,WAAW,OAAO,UAAU,QAAQ,MAAM,QAAQ,MAAM,WAAW,OAAO,EAAE,GAAG,MAAM,qBAAqB,OAAO,oBAAoB,MAAM,KAAK,wBAAwB,QAAQ,KAAK,IAAI,EAAE,iCAAiC,OAAO,KAAK,IAAI,EAAE,KAAK,+MAA+M;AAC/c;AACA,SAAS,qBAAqB,OAAO,SAAS,KAAK;CAClD,OAAO,cAAc,0BAA0B,SAAS;EACvD;EACA,KAAK;EACL,MAAM;GACL,OAAO,MAAM;GACb,SAAS,MAAM;GACf,SAAS,MAAM;EAChB;CACD,CAAC;AACF"}
@@ -1,5 +1,5 @@
1
- import { f as TsqueryExpression, m as TsqueryParserOptions } from "./operation-types-BlaAPrew-BkZiJwPy.mjs";
2
- import "./full-text-collection-method-DHuJr46z-Bndk11cK.mjs";
1
+ import { f as TsqueryExpression, m as TsqueryParserOptions } from "./operation-types-DfWYI0Cn-fXs3p9mN.mjs";
2
+ import "./full-text-collection-method-DvmPrdZL-B1FlBM0E.mjs";
3
3
  //#region ../../../3-targets/postgres/1-target/dist/full-text.d.mts
4
4
  //#region src/core/tsquery-tag.d.ts
5
5
  type TsqueryTag = (strings: TemplateStringsArray, ...values: string[]) => TsqueryExpression;
@@ -23,4 +23,4 @@ declare function tsquery(options: TsqueryParserOptions): TsqueryTag;
23
23
  declare function tsquery(strings: TemplateStringsArray, ...values: string[]): TsqueryExpression;
24
24
  //#endregion
25
25
  export { tsquery as n, TsqueryTag as t };
26
- //# sourceMappingURL=full-text-xZIrFi7x.d.mts.map
26
+ //# sourceMappingURL=full-text-k_9J-JPd.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"full-text-xZIrFi7x.d.mts","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/full-text.d.mts"],"mappings":";;;;KAGK,cAAc,SAAS,yBAAyB,qBAAqB;;;;;;;;;;;;;;;;;iBAiBzD,QAAQ,SAAS,uBAAuB;iBACxC,QAAQ,SAAS,yBAAyB,mBAAmB"}
1
+ {"version":3,"file":"full-text-k_9J-JPd.d.mts","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/full-text.d.mts"],"mappings":";;;;KAGK,cAAc,SAAS,yBAAyB,qBAAqB;;;;;;;;;;;;;;;;;iBAiBzD,QAAQ,SAAS,uBAAuB;iBACxC,QAAQ,SAAS,yBAAyB,mBAAmB"}
@@ -1,9 +1,9 @@
1
1
  import { C as PG_TEXT_CODEC_ID, P as PG_TSQUERY_CODEC_ID } from "./codec-ids-D0wjQdEW-EypD_iZj.mjs";
2
- import { l as postgresError } from "./errors-Di_apgWJ-BLXRTfFj.mjs";
3
- import { d as isFullTextSearchLanguage, f as weightGroupsOf, i as POSTGRES_TEXT_SEARCH_LANGUAGES, l as fullTextIndexProblems, o as describeFullTextIndexProblem, r as FULL_TEXT_WEIGHTS } from "./full-text-index-definition-B0kQDs_M-8N6Slj3l.mjs";
2
+ import { l as postgresError } from "./errors-DG6xgXgr-Cb1XcPcb.mjs";
3
+ import { d as isFullTextSearchLanguage, f as weightGroupsOf, i as POSTGRES_TEXT_SEARCH_LANGUAGES, l as fullTextIndexProblems, o as describeFullTextIndexProblem, r as FULL_TEXT_WEIGHTS } from "./full-text-index-definition-BRNRSgZK-l_2TBarg.mjs";
4
4
  import { LiteralExpr } from "@prisma/orm-family-sql/relational-core/ast";
5
5
  import { buildOperation, toExpr } from "@prisma/orm-family-sql/relational-core/expression";
6
- //#region ../../../3-targets/postgres/1-target/dist/full-text-parsers-hI_qtk-Q.mjs
6
+ //#region ../../../3-targets/postgres/1-target/dist/full-text-parsers-Dd5DOdBA.mjs
7
7
  /**
8
8
  * A search document built from columns in weight groups, for `fullTextMatches` and `fullTextRank`
9
9
  * to search without a full-text index. Postgres uses an index only for a query over the same
@@ -136,4 +136,4 @@ const phrasetoTsquery = parser("phrasetoTsquery", "phraseto_tsquery");
136
136
  //#endregion
137
137
  export { normalizationLiteral as a, toTsquery as c, languageLiteral as i, websearchToTsquery as l, fullTextDocument as n, phrasetoTsquery as o, headlineOptionsLiteral as r, plaintoTsquery as s, FullTextDocument as t };
138
138
 
139
- //# sourceMappingURL=full-text-parsers-hI_qtk-Q-DqTMF4n2.mjs.map
139
+ //# sourceMappingURL=full-text-parsers-Dd5DOdBA-BTeOSzUj.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"full-text-parsers-hI_qtk-Q-DqTMF4n2.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/full-text-parsers-hI_qtk-Q.mjs"],"sourcesContent":["import { C as PG_TEXT_CODEC_ID, P as PG_TSQUERY_CODEC_ID } from \"./codec-ids-D0wjQdEW.mjs\";\nimport { l as postgresError } from \"./errors-Di_apgWJ.mjs\";\nimport { d as FULL_TEXT_WEIGHTS, f as weightGroupsOf, l as POSTGRES_TEXT_SEARCH_LANGUAGES, o as fullTextIndexProblems, r as describeFullTextIndexProblem, u as isFullTextSearchLanguage } from \"./full-text-index-definition-B0kQDs_M.mjs\";\nimport { LiteralExpr } from \"@internal/sql-relational-core/ast\";\nimport { buildOperation, toExpr } from \"@internal/sql-relational-core/expression\";\n//#region src/core/full-text-document.ts\n/**\n* A search document built from columns in weight groups, for `fullTextMatches` and `fullTextRank`\n* to search without a full-text index. Postgres uses an index only for a query over the same\n* document, so to search an index, pass the index from the table's `indexes` instead.\n*/\nvar FullTextDocument = class FullTextDocument {\n\tweightGroups;\n\tconstructor(weightGroups) {\n\t\tthis.weightGroups = weightGroups;\n\t\tObject.freeze(this);\n\t}\n\tstatic of(groups) {\n\t\tconst weightGroups = weightGroupsOf(groups, (item) => !Array.isArray(item));\n\t\tlet position = 0;\n\t\tconst [problem] = fullTextIndexProblems({ weightGroups: weightGroups.map((group) => group.map(() => String(position++))) });\n\t\tif (problem !== void 0) throw postgresError(\"RUNTIME.ARGUMENT_INVALID\", describeFullTextIndexProblem(\"fullTextDocument: the document\", problem), {\n\t\t\twhy: `Each weight group takes one of the weights Postgres has, ${FULL_TEXT_WEIGHTS.join(\", \")}.`,\n\t\t\tfix: \"Pass one to four weight groups, none of them empty.\",\n\t\t\tmeta: {\n\t\t\t\thelper: \"fullTextDocument\",\n\t\t\t\targument: \"groups\",\n\t\t\t\treceived: weightGroups.length\n\t\t\t}\n\t\t});\n\t\treturn new FullTextDocument(weightGroups);\n\t}\n};\n/**\n* The search document of columns in weight groups, strongest first: `fullTextDocument([[f.title,\n* f.subtitle], [f.body]])`. Each group takes the next weight, `A` to `D`; a column named twice is\n* not refused, because column expressions have no name to compare.\n*/\nfunction fullTextDocument(groups) {\n\treturn FullTextDocument.of(groups);\n}\n//#endregion\n//#region src/core/full-text-options.ts\n/**\n* Options for the Postgres full-text operations, and the checks each one goes through.\n*\n* Every option here reaches the SQL as an inline literal rather than a bound parameter, because\n* Postgres accepts no parameter in these positions. Each is therefore validated before a statement\n* exists; anything unrecognized throws `RUNTIME.ARGUMENT_INVALID`.\n*\n* The headline markers are the only free text among them, and `checkMarker` restricts their\n* characters precisely so that the literal path never carries a quote or a backslash for\n* `escapeLiteral` to have to reason about.\n*/\nfunction invalid(method, argument, received, why, fix) {\n\treturn postgresError(\"RUNTIME.ARGUMENT_INVALID\", `${method}: ${why}`, {\n\t\twhy: \"The option is written into the SQL as an inline literal, not a bound parameter, so it is checked before the statement is built.\",\n\t\tfix,\n\t\tmeta: {\n\t\t\thelper: method,\n\t\t\targument,\n\t\t\treceived\n\t\t}\n\t});\n}\nfunction languageLiteral(method, language) {\n\tif (!isFullTextSearchLanguage(language)) throw invalid(method, \"language\", language, `'${language}' is not a PostgreSQL text-search configuration Prisma recognizes.`, `Pass one of: ${POSTGRES_TEXT_SEARCH_LANGUAGES.join(\", \")}.`);\n\treturn LiteralExpr.of(language);\n}\nfunction normalizationLiteral(method, normalization) {\n\tif (!Number.isInteger(normalization) || normalization < 0 || normalization > 63) throw invalid(method, \"normalization\", normalization, `normalization must be an integer between 0 and 63, received ${normalization}.`, \"Combine the flags documented for ts_rank, e.g. 32 to divide the rank by itself plus one.\");\n\treturn LiteralExpr.of(normalization);\n}\nfunction checkWordCount(method, argument, value) {\n\tif (!Number.isInteger(value) || value < 1) throw invalid(method, argument, value, `${argument} must be a positive integer, received ${value}.`, \"Pass a whole number of words, one or more.\");\n}\n/** Non-empty, and none of `\"` `,` `=` `\\` or whitespace. */\nconst MARKER = /^[^\"=,\\\\\\s]+$/;\nfunction checkMarker(method, argument, value) {\n\tif (!MARKER.test(value)) throw invalid(method, argument, value, `${argument} must be non-empty and free of \" , = \\\\ and whitespace, received ${JSON.stringify(value)}.`, \"ts_headline parses its options as a quoted, comma-separated list of Key=Value pairs, and the whole list reaches SQL as one literal, so a marker carrying those characters cannot survive either step. Use markup such as <mark> or <b>.\");\n}\n/**\n* The fourth `ts_headline` argument: one text literal of `Key=Value` pairs. Returns `undefined` when\n* nothing but the language was given, so the common call keeps rendering the three-argument form.\n*/\nfunction headlineOptionsLiteral(method, options) {\n\tconst pairs = [];\n\tif (options.startSel !== void 0) {\n\t\tcheckMarker(method, \"startSel\", options.startSel);\n\t\tpairs.push(`StartSel=${options.startSel}`);\n\t}\n\tif (options.stopSel !== void 0) {\n\t\tcheckMarker(method, \"stopSel\", options.stopSel);\n\t\tpairs.push(`StopSel=${options.stopSel}`);\n\t}\n\tif (options.maxWords !== void 0) {\n\t\tcheckWordCount(method, \"maxWords\", options.maxWords);\n\t\tpairs.push(`MaxWords=${options.maxWords}`);\n\t}\n\tif (options.minWords !== void 0) {\n\t\tcheckWordCount(method, \"minWords\", options.minWords);\n\t\tif (options.maxWords !== void 0 && options.minWords >= options.maxWords) throw invalid(method, \"minWords\", options.minWords, `minWords (${options.minWords}) must be below maxWords (${options.maxWords}).`, \"Postgres requires MinWords strictly below MaxWords. Lower minWords, or raise maxWords.\");\n\t\tpairs.push(`MinWords=${options.minWords}`);\n\t}\n\tif (options.highlightAll !== void 0) {\n\t\tif (typeof options.highlightAll !== \"boolean\") throw invalid(method, \"highlightAll\", options.highlightAll, `highlightAll must be a boolean, received ${JSON.stringify(options.highlightAll)}.`, \"Pass true to mark up the whole document, or false to extract fragments.\");\n\t\tpairs.push(`HighlightAll=${options.highlightAll}`);\n\t}\n\treturn pairs.length === 0 ? void 0 : LiteralExpr.of(pairs.join(\", \"));\n}\n//#endregion\n//#region src/core/full-text-parsers.ts\nconst TEXT_REF = { codecId: PG_TEXT_CODEC_ID };\nfunction parser(method, fn) {\n\treturn (text, options = {}) => buildOperation({\n\t\tmethod,\n\t\targs: [toExpr(text, TEXT_REF), languageLiteral(method, options.language ?? \"english\")],\n\t\treturns: {\n\t\t\tcodecId: PG_TSQUERY_CODEC_ID,\n\t\t\tnullable: false\n\t\t},\n\t\tlowering: {\n\t\t\ttargetFamily: \"sql\",\n\t\t\ttemplate: `${fn}({{arg0}}, {{self}})`\n\t\t}\n\t});\n}\n/** Postgres `websearch_to_tsquery`: search-box syntax with quotes, `or` and `-`. Never errors. */\nconst websearchToTsquery = parser(\"websearchToTsquery\", \"websearch_to_tsquery\");\n/**\n* Postgres `to_tsquery`: operator syntax (`'zebra' & !'graze'`, `zeb:*`), each word normalized.\n* Malformed input fails at execution, so pass only text the application wrote, never user input;\n* `tsquery` interpolates user input safely.\n*/\nconst toTsquery = parser(\"toTsquery\", \"to_tsquery\");\n/** Postgres `plainto_tsquery`: every word must match. */\nconst plaintoTsquery = parser(\"plaintoTsquery\", \"plainto_tsquery\");\n/** Postgres `phraseto_tsquery`: the words must match in order. */\nconst phrasetoTsquery = parser(\"phrasetoTsquery\", \"phraseto_tsquery\");\n//#endregion\nexport { headlineOptionsLiteral as a, FullTextDocument as c, websearchToTsquery as i, fullTextDocument as l, plaintoTsquery as n, languageLiteral as o, toTsquery as r, normaliz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,QAAQ,iBAAiB,WAAW,MAAM,QAAQ,QAAQ,gBAAgB,QAAQ,cAAc,4CAA4C,KAAK,UAAU,QAAQ,YAAY,EAAE,IAAI,yEAAyE;EACzQ,MAAM,KAAK,gBAAgB,QAAQ,cAAc;CAClD;CACA,OAAO,MAAM,WAAW,IAAI,KAAK,IAAI,YAAY,GAAG,MAAM,KAAK,IAAI,CAAC;AACrE;AAGA,MAAM,WAAW,EAAE,SAAS,iBAAiB;AAC7C,SAAS,OAAO,QAAQ,IAAI;CAC3B,QAAQ,MAAM,UAAU,CAAC,MAAM,eAAe;EAC7C;EACA,MAAM,CAAC,OAAO,MAAM,QAAQ,GAAG,gBAAgB,QAAQ,QAAQ,YAAY,SAAS,CAAC;EACrF,SAAS;GACR,SAAS;GACT,UAAU;EACX;EACA,UAAU;GACT,cAAc;GACd,UAAU,GAAG,GAAG;EACjB;CACD,CAAC;AACF;;AAEA,MAAM,qBAAqB,OAAO,sBAAsB,sBAAsB;;;;;;AAM9E,MAAM,YAAY,OAAO,aAAa,YAAY;;AAElD,MAAM,iBAAiB,OAAO,kBAAkB,iBAAiB;;AAEjE,MAAM,kBAAkB,OAAO,mBAAmB,kBAAkB"}
1
+ {"version":3,"file":"full-text-parsers-Dd5DOdBA-BTeOSzUj.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/full-text-parsers-Dd5DOdBA.mjs"],"sourcesContent":["import { C as PG_TEXT_CODEC_ID, P as PG_TSQUERY_CODEC_ID } from \"./codec-ids-D0wjQdEW.mjs\";\nimport { l as postgresError } from \"./errors-DG6xgXgr.mjs\";\nimport { d as FULL_TEXT_WEIGHTS, f as weightGroupsOf, l as POSTGRES_TEXT_SEARCH_LANGUAGES, o as fullTextIndexProblems, r as describeFullTextIndexProblem, u as isFullTextSearchLanguage } from \"./full-text-index-definition-BRNRSgZK.mjs\";\nimport { LiteralExpr } from \"@internal/sql-relational-core/ast\";\nimport { buildOperation, toExpr } from \"@internal/sql-relational-core/expression\";\n//#region src/core/full-text-document.ts\n/**\n* A search document built from columns in weight groups, for `fullTextMatches` and `fullTextRank`\n* to search without a full-text index. Postgres uses an index only for a query over the same\n* document, so to search an index, pass the index from the table's `indexes` instead.\n*/\nvar FullTextDocument = class FullTextDocument {\n\tweightGroups;\n\tconstructor(weightGroups) {\n\t\tthis.weightGroups = weightGroups;\n\t\tObject.freeze(this);\n\t}\n\tstatic of(groups) {\n\t\tconst weightGroups = weightGroupsOf(groups, (item) => !Array.isArray(item));\n\t\tlet position = 0;\n\t\tconst [problem] = fullTextIndexProblems({ weightGroups: weightGroups.map((group) => group.map(() => String(position++))) });\n\t\tif (problem !== void 0) throw postgresError(\"RUNTIME.ARGUMENT_INVALID\", describeFullTextIndexProblem(\"fullTextDocument: the document\", problem), {\n\t\t\twhy: `Each weight group takes one of the weights Postgres has, ${FULL_TEXT_WEIGHTS.join(\", \")}.`,\n\t\t\tfix: \"Pass one to four weight groups, none of them empty.\",\n\t\t\tmeta: {\n\t\t\t\thelper: \"fullTextDocument\",\n\t\t\t\targument: \"groups\",\n\t\t\t\treceived: weightGroups.length\n\t\t\t}\n\t\t});\n\t\treturn new FullTextDocument(weightGroups);\n\t}\n};\n/**\n* The search document of columns in weight groups, strongest first: `fullTextDocument([[f.title,\n* f.subtitle], [f.body]])`. Each group takes the next weight, `A` to `D`; a column named twice is\n* not refused, because column expressions have no name to compare.\n*/\nfunction fullTextDocument(groups) {\n\treturn FullTextDocument.of(groups);\n}\n//#endregion\n//#region src/core/full-text-options.ts\n/**\n* Options for the Postgres full-text operations, and the checks each one goes through.\n*\n* Every option here reaches the SQL as an inline literal rather than a bound parameter, because\n* Postgres accepts no parameter in these positions. Each is therefore validated before a statement\n* exists; anything unrecognized throws `RUNTIME.ARGUMENT_INVALID`.\n*\n* The headline markers are the only free text among them, and `checkMarker` restricts their\n* characters precisely so that the literal path never carries a quote or a backslash for\n* `escapeLiteral` to have to reason about.\n*/\nfunction invalid(method, argument, received, why, fix) {\n\treturn postgresError(\"RUNTIME.ARGUMENT_INVALID\", `${method}: ${why}`, {\n\t\twhy: \"The option is written into the SQL as an inline literal, not a bound parameter, so it is checked before the statement is built.\",\n\t\tfix,\n\t\tmeta: {\n\t\t\thelper: method,\n\t\t\targument,\n\t\t\treceived\n\t\t}\n\t});\n}\nfunction languageLiteral(method, language) {\n\tif (!isFullTextSearchLanguage(language)) throw invalid(method, \"language\", language, `'${language}' is not a PostgreSQL text-search configuration Prisma recognizes.`, `Pass one of: ${POSTGRES_TEXT_SEARCH_LANGUAGES.join(\", \")}.`);\n\treturn LiteralExpr.of(language);\n}\nfunction normalizationLiteral(method, normalization) {\n\tif (!Number.isInteger(normalization) || normalization < 0 || normalization > 63) throw invalid(method, \"normalization\", normalization, `normalization must be an integer between 0 and 63, received ${normalization}.`, \"Combine the flags documented for ts_rank, e.g. 32 to divide the rank by itself plus one.\");\n\treturn LiteralExpr.of(normalization);\n}\nfunction checkWordCount(method, argument, value) {\n\tif (!Number.isInteger(value) || value < 1) throw invalid(method, argument, value, `${argument} must be a positive integer, received ${value}.`, \"Pass a whole number of words, one or more.\");\n}\n/** Non-empty, and none of `\"` `,` `=` `\\` or whitespace. */\nconst MARKER = /^[^\"=,\\\\\\s]+$/;\nfunction checkMarker(method, argument, value) {\n\tif (!MARKER.test(value)) throw invalid(method, argument, value, `${argument} must be non-empty and free of \" , = \\\\ and whitespace, received ${JSON.stringify(value)}.`, \"ts_headline parses its options as a quoted, comma-separated list of Key=Value pairs, and the whole list reaches SQL as one literal, so a marker carrying those characters cannot survive either step. Use markup such as <mark> or <b>.\");\n}\n/**\n* The fourth `ts_headline` argument: one text literal of `Key=Value` pairs. Returns `undefined` when\n* nothing but the language was given, so the common call keeps rendering the three-argument form.\n*/\nfunction headlineOptionsLiteral(method, options) {\n\tconst pairs = [];\n\tif (options.startSel !== void 0) {\n\t\tcheckMarker(method, \"startSel\", options.startSel);\n\t\tpairs.push(`StartSel=${options.startSel}`);\n\t}\n\tif (options.stopSel !== void 0) {\n\t\tcheckMarker(method, \"stopSel\", options.stopSel);\n\t\tpairs.push(`StopSel=${options.stopSel}`);\n\t}\n\tif (options.maxWords !== void 0) {\n\t\tcheckWordCount(method, \"maxWords\", options.maxWords);\n\t\tpairs.push(`MaxWords=${options.maxWords}`);\n\t}\n\tif (options.minWords !== void 0) {\n\t\tcheckWordCount(method, \"minWords\", options.minWords);\n\t\tif (options.maxWords !== void 0 && options.minWords >= options.maxWords) throw invalid(method, \"minWords\", options.minWords, `minWords (${options.minWords}) must be below maxWords (${options.maxWords}).`, \"Postgres requires MinWords strictly below MaxWords. Lower minWords, or raise maxWords.\");\n\t\tpairs.push(`MinWords=${options.minWords}`);\n\t}\n\tif (options.highlightAll !== void 0) {\n\t\tif (typeof options.highlightAll !== \"boolean\") throw invalid(method, \"highlightAll\", options.highlightAll, `highlightAll must be a boolean, received ${JSON.stringify(options.highlightAll)}.`, \"Pass true to mark up the whole document, or false to extract fragments.\");\n\t\tpairs.push(`HighlightAll=${options.highlightAll}`);\n\t}\n\treturn pairs.length === 0 ? void 0 : LiteralExpr.of(pairs.join(\", \"));\n}\n//#endregion\n//#region src/core/full-text-parsers.ts\nconst TEXT_REF = { codecId: PG_TEXT_CODEC_ID };\nfunction parser(method, fn) {\n\treturn (text, options = {}) => buildOperation({\n\t\tmethod,\n\t\targs: [toExpr(text, TEXT_REF), languageLiteral(method, options.language ?? \"english\")],\n\t\treturns: {\n\t\t\tcodecId: PG_TSQUERY_CODEC_ID,\n\t\t\tnullable: false\n\t\t},\n\t\tlowering: {\n\t\t\ttargetFamily: \"sql\",\n\t\t\ttemplate: `${fn}({{arg0}}, {{self}})`\n\t\t}\n\t});\n}\n/** Postgres `websearch_to_tsquery`: search-box syntax with quotes, `or` and `-`. Never errors. */\nconst websearchToTsquery = parser(\"websearchToTsquery\", \"websearch_to_tsquery\");\n/**\n* Postgres `to_tsquery`: operator syntax (`'zebra' & !'graze'`, `zeb:*`), each word normalized.\n* Malformed input fails at execution, so pass only text the application wrote, never user input;\n* `tsquery` interpolates user input safely.\n*/\nconst toTsquery = parser(\"toTsquery\", \"to_tsquery\");\n/** Postgres `plainto_tsquery`: every word must match. */\nconst plaintoTsquery = parser(\"plaintoTsquery\", \"plainto_tsquery\");\n/** Postgres `phraseto_tsquery`: the words must match in order. */\nconst phrasetoTsquery = parser(\"phrasetoTsquery\", \"phraseto_tsquery\");\n//#endregion\nexport { headlineOptionsLiteral as a, FullTextDocument as c, websearchToTsquery as i, fullTextDocument as l, plaintoTsquery as n, languageLiteral as o, toTsquery as r, normalizationLiteral as s, phrasetoTsquery as t };\n\n//# sourceMappingURL=full-text-parsers-Dd5DOdBA.mjs.map"],"mappings":";;;;;;;;;;;AAWA,IAAI,mBAAmB,MAAM,iBAAiB;CAC7C;CACA,YAAY,cAAc;EACzB,KAAK,eAAe;EACpB,OAAO,OAAO,IAAI;CACnB;CACA,OAAO,GAAG,QAAQ;EACjB,MAAM,eAAe,eAAe,SAAS,SAAS,CAAC,MAAM,QAAQ,IAAI,CAAC;EAC1E,IAAI,WAAW;EACf,MAAM,CAAC,WAAW,sBAAsB,EAAE,cAAc,aAAa,KAAK,UAAU,MAAM,UAAU,OAAO,UAAU,CAAC,CAAC,EAAE,CAAC;EAC1H,IAAI,YAAY,KAAK,GAAG,MAAM,cAAc,4BAA4B,6BAA6B,kCAAkC,OAAO,GAAG;GAChJ,KAAK,4DAA4D,kBAAkB,KAAK,IAAI,EAAE;GAC9F,KAAK;GACL,MAAM;IACL,QAAQ;IACR,UAAU;IACV,UAAU,aAAa;GACxB;EACD,CAAC;EACD,OAAO,IAAI,iBAAiB,YAAY;CACzC;AACD;;;;;;AAMA,SAAS,iBAAiB,QAAQ;CACjC,OAAO,iBAAiB,GAAG,MAAM;AAClC;;;;;;;;;;;;AAcA,SAAS,QAAQ,QAAQ,UAAU,UAAU,KAAK,KAAK;CACtD,OAAO,cAAc,4BAA4B,GAAG,OAAO,IAAI,OAAO;EACrE,KAAK;EACL;EACA,MAAM;GACL,QAAQ;GAC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