@prisma/orm-target-postgres 0.16.0-dev.36

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 (279) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +23 -0
  3. package/dist/adapter-CWvVo0PV.d.mts +22 -0
  4. package/dist/adapter-CWvVo0PV.d.mts.map +1 -0
  5. package/dist/adapter-DhqcO3YO-jzwDVcCv.mjs +70 -0
  6. package/dist/adapter-DhqcO3YO-jzwDVcCv.mjs.map +1 -0
  7. package/dist/adapter.d.mts +12 -0
  8. package/dist/adapter.mjs +7 -0
  9. package/dist/adapter__adapter.d.mts +2 -0
  10. package/dist/adapter__adapter.mjs +2 -0
  11. package/dist/adapter__column-types.d.mts +2 -0
  12. package/dist/adapter__column-types.mjs +2 -0
  13. package/dist/adapter__control.d.mts +5 -0
  14. package/dist/adapter__control.mjs +441 -0
  15. package/dist/adapter__control.mjs.map +1 -0
  16. package/dist/adapter__operation-types.d.mts +2 -0
  17. package/dist/adapter__operation-types.mjs +1 -0
  18. package/dist/adapter__runtime.d.mts +2 -0
  19. package/dist/adapter__runtime.mjs +38 -0
  20. package/dist/adapter__runtime.mjs.map +1 -0
  21. package/dist/adapter__types.d.mts +4 -0
  22. package/dist/adapter__types.mjs +1 -0
  23. package/dist/authoring-03FwIL2k-kPjZAp3s.mjs +757 -0
  24. package/dist/authoring-03FwIL2k-kPjZAp3s.mjs.map +1 -0
  25. package/dist/canonicalize-CQlxSR4D-MnrT5gtW.d.mts +34 -0
  26. package/dist/canonicalize-CQlxSR4D-MnrT5gtW.d.mts.map +1 -0
  27. package/dist/canonicalize-CrN3u_xM-D4MrOqcB.mjs +59 -0
  28. package/dist/canonicalize-CrN3u_xM-D4MrOqcB.mjs.map +1 -0
  29. package/dist/codec-descriptor-Bec_zukr-BfvtUqhm.d.mts +37 -0
  30. package/dist/codec-descriptor-Bec_zukr-BfvtUqhm.d.mts.map +1 -0
  31. package/dist/codec-descriptor-Bg-_412t.d.mts +1 -0
  32. package/dist/codec-descriptor-CB6x0xEu-C-Zn2IEz.mjs +135 -0
  33. package/dist/codec-descriptor-CB6x0xEu-C-Zn2IEz.mjs.map +1 -0
  34. package/dist/codec-ids-CsOU3xDv-mPI0INiF.d.mts +33 -0
  35. package/dist/codec-ids-CsOU3xDv-mPI0INiF.d.mts.map +1 -0
  36. package/dist/codec-ids-fgafMLR7.d.mts +1 -0
  37. package/dist/codec-ids-tX7Svtz--BuOfRaVU.mjs +33 -0
  38. package/dist/codec-ids-tX7Svtz--BuOfRaVU.mjs.map +1 -0
  39. package/dist/codec-types-BHwY9Ff-.d.mts +2 -0
  40. package/dist/codec-types-mWhnDEAf-CAQzGFnF.d.mts +82 -0
  41. package/dist/codec-types-mWhnDEAf-CAQzGFnF.d.mts.map +1 -0
  42. package/dist/codecs-CBl0nD44-CaWPc1bd.mjs +1486 -0
  43. package/dist/codecs-CBl0nD44-CaWPc1bd.mjs.map +1 -0
  44. package/dist/codecs-CHIVTNZs.mjs +15 -0
  45. package/dist/codecs-CHIVTNZs.mjs.map +1 -0
  46. package/dist/codecs-Cvqvb9pV-Cdc51FKY.d.mts +589 -0
  47. package/dist/codecs-Cvqvb9pV-Cdc51FKY.d.mts.map +1 -0
  48. package/dist/codecs-DBn-uIv-.d.mts +15 -0
  49. package/dist/codecs-DBn-uIv-.d.mts.map +1 -0
  50. package/dist/column-types-BH-MU6uU.d.mts +108 -0
  51. package/dist/column-types-BH-MU6uU.d.mts.map +1 -0
  52. package/dist/column-types-CwAyCgp2.mjs +126 -0
  53. package/dist/column-types-CwAyCgp2.mjs.map +1 -0
  54. package/dist/contract-free-BZUS18FU.mjs +118 -0
  55. package/dist/contract-free-BZUS18FU.mjs.map +1 -0
  56. package/dist/contract-free-DzpGxLfb.d.mts +258 -0
  57. package/dist/contract-free-DzpGxLfb.d.mts.map +1 -0
  58. package/dist/control-2F195jJk.d.mts +11 -0
  59. package/dist/control-2F195jJk.d.mts.map +1 -0
  60. package/dist/control-6WFTtLAM.mjs +60 -0
  61. package/dist/control-6WFTtLAM.mjs.map +1 -0
  62. package/dist/control-B-FTbEnE.d.mts +22 -0
  63. package/dist/control-B-FTbEnE.d.mts.map +1 -0
  64. package/dist/control-D85zv_aY.d.mts +199 -0
  65. package/dist/control-D85zv_aY.d.mts.map +1 -0
  66. package/dist/control-DRMWptiJ.mjs +1355 -0
  67. package/dist/control-DRMWptiJ.mjs.map +1 -0
  68. package/dist/control-adapter-B9t0g7Pf-HrCxlM65.mjs +1901 -0
  69. package/dist/control-adapter-B9t0g7Pf-HrCxlM65.mjs.map +1 -0
  70. package/dist/control-policy-Cl3RRSPg-CT3QGpR3.mjs +1257 -0
  71. package/dist/control-policy-Cl3RRSPg-CT3QGpR3.mjs.map +1 -0
  72. package/dist/data-transform-BSM7TQpE.d.mts +1 -0
  73. package/dist/data-transform-ChZzy2dP-CxVCat_8.mjs +53 -0
  74. package/dist/data-transform-ChZzy2dP-CxVCat_8.mjs.map +1 -0
  75. package/dist/data-transform-Ck5FbyNO-BNE7QlAo.d.mts +38 -0
  76. package/dist/data-transform-Ck5FbyNO-BNE7QlAo.d.mts.map +1 -0
  77. package/dist/ddl-B4Rh8ntj.d.mts +1 -0
  78. package/dist/ddl-BdP4q3KY-Duef4uHw.mjs +395 -0
  79. package/dist/ddl-BdP4q3KY-Duef4uHw.mjs.map +1 -0
  80. package/dist/default-normalizer-B36TOul4.d.mts +31 -0
  81. package/dist/default-normalizer-B36TOul4.d.mts.map +1 -0
  82. package/dist/default-normalizer-Ba5ZebHM-isV86rjy.mjs +253 -0
  83. package/dist/default-normalizer-Ba5ZebHM-isV86rjy.mjs.map +1 -0
  84. package/dist/descriptor-meta-2IlVC6_d-DnV00Qd_.mjs +351 -0
  85. package/dist/descriptor-meta-2IlVC6_d-DnV00Qd_.mjs.map +1 -0
  86. package/dist/descriptor-meta-DnHabAS3-C53XXPQw.mjs +28 -0
  87. package/dist/descriptor-meta-DnHabAS3-C53XXPQw.mjs.map +1 -0
  88. package/dist/descriptor-meta-runtime-UwYdV8fD-B_m_Ha8r.mjs +13 -0
  89. package/dist/descriptor-meta-runtime-UwYdV8fD-B_m_Ha8r.mjs.map +1 -0
  90. package/dist/diff-database-schema-BfRs2vrG-D2o4KII0.mjs +390 -0
  91. package/dist/diff-database-schema-BfRs2vrG-D2o4KII0.mjs.map +1 -0
  92. package/dist/diff-database-schema-DsoNznGC.d.mts +38 -0
  93. package/dist/diff-database-schema-DsoNznGC.d.mts.map +1 -0
  94. package/dist/driver.d.mts +3 -0
  95. package/dist/driver.mjs +2 -0
  96. package/dist/driver__control.d.mts +2 -0
  97. package/dist/driver__control.mjs +2 -0
  98. package/dist/driver__runtime.d.mts +2 -0
  99. package/dist/driver__runtime.mjs +597 -0
  100. package/dist/driver__runtime.mjs.map +1 -0
  101. package/dist/errors-DCcVX4j1.d.mts +32 -0
  102. package/dist/errors-DCcVX4j1.d.mts.map +1 -0
  103. package/dist/errors-kYxOQjdD-D4T3rbVp.mjs +39 -0
  104. package/dist/errors-kYxOQjdD-D4T3rbVp.mjs.map +1 -0
  105. package/dist/issue-planner-jkY6p-Ca.d.mts +105 -0
  106. package/dist/issue-planner-jkY6p-Ca.d.mts.map +1 -0
  107. package/dist/migration-CBSAPE8S.d.mts +25 -0
  108. package/dist/migration-CBSAPE8S.d.mts.map +1 -0
  109. package/dist/migration-PTHAY9Cv.mjs +21 -0
  110. package/dist/migration-PTHAY9Cv.mjs.map +1 -0
  111. package/dist/namespace-ids-xtp_ZY86-Cpp8PTxD.mjs +7 -0
  112. package/dist/namespace-ids-xtp_ZY86-Cpp8PTxD.mjs.map +1 -0
  113. package/dist/native-type-normalizer-DqJlOTeX.d.mts +19 -0
  114. package/dist/native-type-normalizer-DqJlOTeX.d.mts.map +1 -0
  115. package/dist/native-type-normalizer-yvd3tqv-.mjs +38 -0
  116. package/dist/native-type-normalizer-yvd3tqv-.mjs.map +1 -0
  117. package/dist/nodes-BU-V-aZA-RqwPH68u.d.mts +235 -0
  118. package/dist/nodes-BU-V-aZA-RqwPH68u.d.mts.map +1 -0
  119. package/dist/nodes-DAvDJLvJ-BBdvFXNa.mjs +255 -0
  120. package/dist/nodes-DAvDJLvJ-BBdvFXNa.mjs.map +1 -0
  121. package/dist/normalize-error-CNjgVO71-CLlZ3CuJ.mjs +121 -0
  122. package/dist/normalize-error-CNjgVO71-CLlZ3CuJ.mjs.map +1 -0
  123. package/dist/op-factory-call-DifL68KT-Bo6pxs-R.mjs +2009 -0
  124. package/dist/op-factory-call-DifL68KT-Bo6pxs-R.mjs.map +1 -0
  125. package/dist/op-factory-call-FEA5mnWH.d.mts +1 -0
  126. package/dist/op-factory-call-jd4cgfjA-CyNT4YVn.d.mts +521 -0
  127. package/dist/op-factory-call-jd4cgfjA-CyNT4YVn.d.mts.map +1 -0
  128. package/dist/operation-types-BfRocNI8.d.mts +22 -0
  129. package/dist/operation-types-BfRocNI8.d.mts.map +1 -0
  130. package/dist/pack-DFM4tmob.d.mts +610 -0
  131. package/dist/pack-DFM4tmob.d.mts.map +1 -0
  132. package/dist/planner-Bmje9ii8-B99fEsNM.mjs +588 -0
  133. package/dist/planner-Bmje9ii8-B99fEsNM.mjs.map +1 -0
  134. package/dist/planner-DL4Bh5Nk.d.mts +163 -0
  135. package/dist/planner-DL4Bh5Nk.d.mts.map +1 -0
  136. package/dist/planner-ddl-builders-CbfICQfm-CxYiLrhX.mjs +102 -0
  137. package/dist/planner-ddl-builders-CbfICQfm-CxYiLrhX.mjs.map +1 -0
  138. package/dist/planner-ddl-builders-ijp60-JO.d.mts +19 -0
  139. package/dist/planner-ddl-builders-ijp60-JO.d.mts.map +1 -0
  140. package/dist/planner-identity-values-BmHn5C6U-BYBbUAyR.mjs +90 -0
  141. package/dist/planner-identity-values-BmHn5C6U-BYBbUAyR.mjs.map +1 -0
  142. package/dist/planner-identity-values-TfEhnoWa.d.mts +25 -0
  143. package/dist/planner-identity-values-TfEhnoWa.d.mts.map +1 -0
  144. package/dist/planner-produced-postgres-migration-B0PQLLUb-qsS6cQqX.d.mts +25 -0
  145. package/dist/planner-produced-postgres-migration-B0PQLLUb-qsS6cQqX.d.mts.map +1 -0
  146. package/dist/planner-produced-postgres-migration-C3GPZWeC.d.mts +1 -0
  147. package/dist/planner-produced-postgres-migration-Cicg2sXg-Ck9iDxGI.mjs +47 -0
  148. package/dist/planner-produced-postgres-migration-Cicg2sXg-Ck9iDxGI.mjs.map +1 -0
  149. package/dist/planner-schema-lookup-C4DHAddq.d.mts +21 -0
  150. package/dist/planner-schema-lookup-C4DHAddq.d.mts.map +1 -0
  151. package/dist/planner-schema-lookup-kMIVP2y--CdO4VlnF.mjs +57 -0
  152. package/dist/planner-schema-lookup-kMIVP2y--CdO4VlnF.mjs.map +1 -0
  153. package/dist/planner-sql-checks-CFgbRTJw.d.mts +20 -0
  154. package/dist/planner-sql-checks-CFgbRTJw.d.mts.map +1 -0
  155. package/dist/planner-sql-checks-DRc_78n8-C9nHOrvU.mjs +152 -0
  156. package/dist/planner-sql-checks-DRc_78n8-C9nHOrvU.mjs.map +1 -0
  157. package/dist/planner-target-details-HkP4RrRO-_xPQVPF0.d.mts +12 -0
  158. package/dist/planner-target-details-HkP4RrRO-_xPQVPF0.d.mts.map +1 -0
  159. package/dist/planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs +15 -0
  160. package/dist/planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs.map +1 -0
  161. package/dist/postgres-contract-view-2OP5JnXl-D2fpy4-8.d.mts +36 -0
  162. package/dist/postgres-contract-view-2OP5JnXl-D2fpy4-8.d.mts.map +1 -0
  163. package/dist/postgres-contract-view-FdLX7dV9-Cat1VKV9.mjs +144 -0
  164. package/dist/postgres-contract-view-FdLX7dV9-Cat1VKV9.mjs.map +1 -0
  165. package/dist/postgres-database-schema-node-CyfpHXDr-BqyozkQE.d.mts +285 -0
  166. package/dist/postgres-database-schema-node-CyfpHXDr-BqyozkQE.d.mts.map +1 -0
  167. package/dist/postgres-migration-CDJj7CvD-Bsqs_fVo.d.mts +260 -0
  168. package/dist/postgres-migration-CDJj7CvD-Bsqs_fVo.d.mts.map +1 -0
  169. package/dist/postgres-migration-CJshdIZn-DYYjgdD0.mjs +201 -0
  170. package/dist/postgres-migration-CJshdIZn-DYYjgdD0.mjs.map +1 -0
  171. package/dist/postgres-native-enum-CdP3b_-R-Cgz9KEKx.mjs +45 -0
  172. package/dist/postgres-native-enum-CdP3b_-R-Cgz9KEKx.mjs.map +1 -0
  173. package/dist/postgres-rls-policy-CnDxf3z9-C3LIHAIG.d.mts +61 -0
  174. package/dist/postgres-rls-policy-CnDxf3z9-C3LIHAIG.d.mts.map +1 -0
  175. package/dist/postgres-role-schema-node-B8Z5i5D--PObwlU2Z.mjs +204 -0
  176. package/dist/postgres-role-schema-node-B8Z5i5D--PObwlU2Z.mjs.map +1 -0
  177. package/dist/postgres-schema-KSzLDONj-CsXGoY8b.mjs +421 -0
  178. package/dist/postgres-schema-KSzLDONj-CsXGoY8b.mjs.map +1 -0
  179. package/dist/postgres-schema-Xsjt3RKO-Buv2X8ai.d.mts +269 -0
  180. package/dist/postgres-schema-Xsjt3RKO-Buv2X8ai.d.mts.map +1 -0
  181. package/dist/postgres-table-schema-node-BBkitBQh-DT1T5VWU.mjs +212 -0
  182. package/dist/postgres-table-schema-node-BBkitBQh-DT1T5VWU.mjs.map +1 -0
  183. package/dist/render-ops-DPwhZt2W.d.mts +11 -0
  184. package/dist/render-ops-DPwhZt2W.d.mts.map +1 -0
  185. package/dist/render-ops-DxzTxSsv-Bz85uUHk.mjs +34 -0
  186. package/dist/render-ops-DxzTxSsv-Bz85uUHk.mjs.map +1 -0
  187. package/dist/render-typescript-6sCFvMBh.d.mts +21 -0
  188. package/dist/render-typescript-6sCFvMBh.d.mts.map +1 -0
  189. package/dist/render-typescript-Cw3lFO28-Cx0lXWmv.mjs +117 -0
  190. package/dist/render-typescript-Cw3lFO28-Cx0lXWmv.mjs.map +1 -0
  191. package/dist/resolve-ddl-schema-CxqlLW47-0GiHRziS.mjs +22 -0
  192. package/dist/resolve-ddl-schema-CxqlLW47-0GiHRziS.mjs.map +1 -0
  193. package/dist/runtime-BbSRVwdd.d.mts +12 -0
  194. package/dist/runtime-BbSRVwdd.d.mts.map +1 -0
  195. package/dist/runtime-CDewySU9.d.mts +55 -0
  196. package/dist/runtime-CDewySU9.d.mts.map +1 -0
  197. package/dist/runtime-_TfO66h5.d.mts +32 -0
  198. package/dist/runtime-_TfO66h5.d.mts.map +1 -0
  199. package/dist/schema-ir-annotations-DuuYh0gl.d.mts +15 -0
  200. package/dist/schema-ir-annotations-DuuYh0gl.d.mts.map +1 -0
  201. package/dist/schema-node-kinds-qlnURWJy-Bo30pwTM.d.mts +30 -0
  202. package/dist/schema-node-kinds-qlnURWJy-Bo30pwTM.d.mts.map +1 -0
  203. package/dist/sql-utils-BnBlQxyh-DaX9Nb7Z.mjs +90 -0
  204. package/dist/sql-utils-BnBlQxyh-DaX9Nb7Z.mjs.map +1 -0
  205. package/dist/sql-utils-DW6fkczF.d.mts +62 -0
  206. package/dist/sql-utils-DW6fkczF.d.mts.map +1 -0
  207. package/dist/table-source-ikHOZmhD-DriY1Lcr.d.mts +15 -0
  208. package/dist/table-source-ikHOZmhD-DriY1Lcr.d.mts.map +1 -0
  209. package/dist/target.d.mts +47 -0
  210. package/dist/target.mjs +34 -0
  211. package/dist/target__codec-descriptor.d.mts +3 -0
  212. package/dist/target__codec-descriptor.mjs +2 -0
  213. package/dist/target__codec-ids.d.mts +3 -0
  214. package/dist/target__codec-ids.mjs +2 -0
  215. package/dist/target__codec-types.d.mts +4 -0
  216. package/dist/target__codec-types.mjs +1 -0
  217. package/dist/target__codecs.d.mts +3 -0
  218. package/dist/target__codecs.mjs +3 -0
  219. package/dist/target__contract-free.d.mts +3 -0
  220. package/dist/target__contract-free.mjs +4 -0
  221. package/dist/target__control.d.mts +2 -0
  222. package/dist/target__control.mjs +2 -0
  223. package/dist/target__data-transform.d.mts +3 -0
  224. package/dist/target__data-transform.mjs +2 -0
  225. package/dist/target__ddl.d.mts +4 -0
  226. package/dist/target__ddl.mjs +2 -0
  227. package/dist/target__default-normalizer.d.mts +2 -0
  228. package/dist/target__default-normalizer.mjs +2 -0
  229. package/dist/target__diff-database-schema.d.mts +2 -0
  230. package/dist/target__diff-database-schema.mjs +2 -0
  231. package/dist/target__errors.d.mts +2 -0
  232. package/dist/target__errors.mjs +2 -0
  233. package/dist/target__issue-planner.d.mts +2 -0
  234. package/dist/target__issue-planner.mjs +2 -0
  235. package/dist/target__migration.d.mts +4 -0
  236. package/dist/target__migration.mjs +5 -0
  237. package/dist/target__native-type-normalizer.d.mts +2 -0
  238. package/dist/target__native-type-normalizer.mjs +2 -0
  239. package/dist/target__op-factory-call.d.mts +3 -0
  240. package/dist/target__op-factory-call.mjs +2 -0
  241. package/dist/target__pack.d.mts +2 -0
  242. package/dist/target__pack.mjs +2 -0
  243. package/dist/target__planner-ddl-builders.d.mts +2 -0
  244. package/dist/target__planner-ddl-builders.mjs +2 -0
  245. package/dist/target__planner-identity-values.d.mts +2 -0
  246. package/dist/target__planner-identity-values.mjs +2 -0
  247. package/dist/target__planner-produced-postgres-migration.d.mts +3 -0
  248. package/dist/target__planner-produced-postgres-migration.mjs +2 -0
  249. package/dist/target__planner-schema-lookup.d.mts +2 -0
  250. package/dist/target__planner-schema-lookup.mjs +2 -0
  251. package/dist/target__planner-sql-checks.d.mts +2 -0
  252. package/dist/target__planner-sql-checks.mjs +2 -0
  253. package/dist/target__planner-target-details.d.mts +2 -0
  254. package/dist/target__planner-target-details.mjs +1 -0
  255. package/dist/target__planner.d.mts +2 -0
  256. package/dist/target__planner.mjs +3 -0
  257. package/dist/target__render-ops.d.mts +2 -0
  258. package/dist/target__render-ops.mjs +2 -0
  259. package/dist/target__render-typescript.d.mts +2 -0
  260. package/dist/target__render-typescript.mjs +2 -0
  261. package/dist/target__rls-canonicalize.d.mts +2 -0
  262. package/dist/target__rls-canonicalize.mjs +2 -0
  263. package/dist/target__runtime.d.mts +3 -0
  264. package/dist/target__runtime.mjs +23 -0
  265. package/dist/target__runtime.mjs.map +1 -0
  266. package/dist/target__schema-ir-annotations.d.mts +2 -0
  267. package/dist/target__schema-ir-annotations.mjs +2 -0
  268. package/dist/target__sql-utils.d.mts +2 -0
  269. package/dist/target__sql-utils.mjs +2 -0
  270. package/dist/target__types.d.mts +7 -0
  271. package/dist/target__types.mjs +5 -0
  272. package/dist/types-CkryN1AS-6MNZLjLY.d.mts +27 -0
  273. package/dist/types-CkryN1AS-6MNZLjLY.d.mts.map +1 -0
  274. package/dist/types-Cp_Jf2tk.d.mts +1 -0
  275. package/dist/types-ue6jkJyF-BQJzjx1P.d.mts +10 -0
  276. package/dist/types-ue6jkJyF-BQJzjx1P.d.mts.map +1 -0
  277. package/dist/types-xa86TkcV.d.mts +32 -0
  278. package/dist/types-xa86TkcV.d.mts.map +1 -0
  279. package/package.json +95 -0
@@ -0,0 +1,253 @@
1
+ //#region ../../../3-targets/3-targets/postgres/dist/default-normalizer-Ba5ZebHM.mjs
2
+ /**
3
+ * Pre-compiled regex patterns for performance.
4
+ * These are compiled once at module load time rather than on each function call.
5
+ */
6
+ const NEXTVAL_PATTERN = /^nextval\s*\(/i;
7
+ const NOW_FUNCTION_PATTERN = /^(now\s*\(\s*\)|CURRENT_TIMESTAMP)$/i;
8
+ const CLOCK_TIMESTAMP_PATTERN = /^clock_timestamp\s*\(\s*\)$/i;
9
+ const TIMESTAMP_CAST_SUFFIX = /::timestamp(?:tz|\s+(?:with|without)\s+time\s+zone)?$/i;
10
+ const TEXT_CAST_SUFFIX = /::text$/i;
11
+ const NOW_LITERAL_PATTERN = /^'now'$/i;
12
+ const UUID_PATTERN = /^gen_random_uuid\s*\(\s*\)$/i;
13
+ const UUID_OSSP_PATTERN = /^uuid_generate_v4\s*\(\s*\)$/i;
14
+ const NULL_PATTERN = /^NULL(?:::.+)?$/i;
15
+ const TRUE_PATTERN = /^true$/i;
16
+ const FALSE_PATTERN = /^false$/i;
17
+ const NUMERIC_PATTERN = /^-?\d+(\.\d+)?$/;
18
+ const STRING_LITERAL_PATTERN = /^'((?:[^']|'')*)'(?:::(?:"[^"]+"|[\w\s]+)(?:\(\d+\))?)?$/;
19
+ /**
20
+ * Matches a Postgres array literal default of the form `'{...}'::elemtype[]`.
21
+ * The literal body is captured in group 1; the cast (including `[]`) is optional.
22
+ * Examples: `'{}'::text[]`, `'{1,2}'::integer[]`, `'{}'`
23
+ */
24
+ const ARRAY_LITERAL_PATTERN = /^'(\{.*\})'(?:::.+\[\])?$/;
25
+ /**
26
+ * Returns the canonical expression for a timestamp default function, or undefined
27
+ * if the expression is not a recognized timestamp default.
28
+ *
29
+ * Keeps now()/CURRENT_TIMESTAMP and clock_timestamp() distinct:
30
+ * - now(), CURRENT_TIMESTAMP, ('now'::text)::timestamp... → 'now()'
31
+ * - clock_timestamp(), clock_timestamp()::timestamptz → 'clock_timestamp()'
32
+ *
33
+ * These are semantically different in Postgres: now() returns the transaction
34
+ * start time (constant within a transaction), while clock_timestamp() returns
35
+ * the actual wall-clock time (can differ across rows in a single INSERT).
36
+ */
37
+ function canonicalizeTimestampDefault(expr) {
38
+ if (NOW_FUNCTION_PATTERN.test(expr)) return "now()";
39
+ if (CLOCK_TIMESTAMP_PATTERN.test(expr)) return "clock_timestamp()";
40
+ if (!TIMESTAMP_CAST_SUFFIX.test(expr)) return void 0;
41
+ let inner = expr.replace(TIMESTAMP_CAST_SUFFIX, "").trim();
42
+ if (inner.startsWith("(") && inner.endsWith(")")) inner = inner.slice(1, -1).trim();
43
+ if (NOW_FUNCTION_PATTERN.test(inner)) return "now()";
44
+ if (CLOCK_TIMESTAMP_PATTERN.test(inner)) return "clock_timestamp()";
45
+ inner = inner.replace(TEXT_CAST_SUFFIX, "").trim();
46
+ if (NOW_LITERAL_PATTERN.test(inner)) return "now()";
47
+ }
48
+ /**
49
+ * Splits a Postgres array literal body (without the enclosing braces) into its
50
+ * element tokens, honouring quoting. A comma only separates elements when it is
51
+ * outside double quotes; inside a quoted element a doubled quote (`""`) or a
52
+ * backslash-escaped quote (`\"`) is a literal quote, and a backslash escapes the
53
+ * next character. Returns undefined if the body is malformed (e.g. an unbalanced
54
+ * quote).
55
+ */
56
+ function splitArrayElements(inner) {
57
+ const tokens = [];
58
+ let current = "";
59
+ let inQuotes = false;
60
+ let quoted = false;
61
+ for (let i = 0; i < inner.length; i++) {
62
+ const char = inner[i];
63
+ if (inQuotes) {
64
+ if (char === "\\") {
65
+ const next = inner[i + 1];
66
+ if (next === void 0) return void 0;
67
+ current += next;
68
+ i++;
69
+ continue;
70
+ }
71
+ if (char === "\"") {
72
+ if (inner[i + 1] === "\"") {
73
+ current += "\"";
74
+ i++;
75
+ continue;
76
+ }
77
+ inQuotes = false;
78
+ continue;
79
+ }
80
+ current += char;
81
+ continue;
82
+ }
83
+ if (char === "\"") {
84
+ inQuotes = true;
85
+ quoted = true;
86
+ continue;
87
+ }
88
+ if (char === ",") {
89
+ tokens.push({
90
+ value: current,
91
+ quoted
92
+ });
93
+ current = "";
94
+ quoted = false;
95
+ continue;
96
+ }
97
+ current += char;
98
+ }
99
+ if (inQuotes) return void 0;
100
+ tokens.push({
101
+ value: current,
102
+ quoted
103
+ });
104
+ return tokens;
105
+ }
106
+ /**
107
+ * Parses a Postgres array literal body (`{...}`) into a JS array of primitives.
108
+ * Returns undefined if the body cannot be reliably parsed.
109
+ *
110
+ * Handles:
111
+ * - `{}` → `[]`
112
+ * - `{elem1,elem2,...}` → `[elem1, elem2, ...]` with numeric and string element coercion
113
+ * - quoted elements that contain commas, doubled/escaped quotes, and the literal
114
+ * strings `NULL`/`true`/`false` (a quoted token is always a string)
115
+ */
116
+ function parseArrayLiteralBody(body) {
117
+ const inner = body.slice(1, -1).trim();
118
+ if (inner === "") return [];
119
+ const tokens = splitArrayElements(inner);
120
+ if (tokens === void 0) return void 0;
121
+ const result = [];
122
+ for (const token of tokens) {
123
+ if (token.quoted) {
124
+ result.push(token.value);
125
+ continue;
126
+ }
127
+ const el = token.value.trim();
128
+ if (el.toUpperCase() === "NULL") {
129
+ result.push(null);
130
+ continue;
131
+ }
132
+ if (el === "true") {
133
+ result.push(true);
134
+ continue;
135
+ }
136
+ if (el === "false") {
137
+ result.push(false);
138
+ continue;
139
+ }
140
+ if (NUMERIC_PATTERN.test(el)) {
141
+ result.push(Number(el));
142
+ continue;
143
+ }
144
+ return;
145
+ }
146
+ return result;
147
+ }
148
+ /**
149
+ * Parses a raw Postgres column default expression into a normalized ColumnDefault.
150
+ * This enables semantic comparison between contract defaults and introspected schema defaults.
151
+ *
152
+ * Used by the migration diff layer to normalize raw database defaults during comparison,
153
+ * keeping the introspection layer focused on faithful data capture.
154
+ *
155
+ * @param rawDefault - Raw default expression from information_schema.columns.column_default
156
+ * @param nativeType - Native column type, used for type-aware parsing (array, bigint, JSON)
157
+ * @returns Normalized ColumnDefault or undefined if the expression cannot be parsed
158
+ */
159
+ function parsePostgresDefault(rawDefault, nativeType) {
160
+ const trimmed = rawDefault.trim();
161
+ const normalizedType = nativeType?.toLowerCase();
162
+ const isBigInt = normalizedType === "bigint" || normalizedType === "int8";
163
+ const isArrayType = normalizedType?.endsWith("[]") ?? false;
164
+ if (NEXTVAL_PATTERN.test(trimmed)) return {
165
+ kind: "function",
166
+ expression: "autoincrement()"
167
+ };
168
+ if (isArrayType) {
169
+ const arrayMatch = trimmed.match(ARRAY_LITERAL_PATTERN);
170
+ if (arrayMatch?.[1] !== void 0) {
171
+ const parsed = parseArrayLiteralBody(arrayMatch[1]);
172
+ if (parsed !== void 0) return {
173
+ kind: "literal",
174
+ value: parsed
175
+ };
176
+ }
177
+ }
178
+ const canonicalTimestamp = canonicalizeTimestampDefault(trimmed);
179
+ if (canonicalTimestamp) return {
180
+ kind: "function",
181
+ expression: canonicalTimestamp
182
+ };
183
+ if (UUID_PATTERN.test(trimmed)) return {
184
+ kind: "function",
185
+ expression: "gen_random_uuid()"
186
+ };
187
+ if (UUID_OSSP_PATTERN.test(trimmed)) return {
188
+ kind: "function",
189
+ expression: "gen_random_uuid()"
190
+ };
191
+ if (NULL_PATTERN.test(trimmed)) return {
192
+ kind: "literal",
193
+ value: null
194
+ };
195
+ if (TRUE_PATTERN.test(trimmed)) return {
196
+ kind: "literal",
197
+ value: true
198
+ };
199
+ if (FALSE_PATTERN.test(trimmed)) return {
200
+ kind: "literal",
201
+ value: false
202
+ };
203
+ if (NUMERIC_PATTERN.test(trimmed)) {
204
+ const num = Number(trimmed);
205
+ if (!Number.isFinite(num)) return void 0;
206
+ if (isBigInt) return {
207
+ kind: "literal",
208
+ value: trimmed
209
+ };
210
+ return {
211
+ kind: "literal",
212
+ value: num
213
+ };
214
+ }
215
+ const stringMatch = trimmed.match(STRING_LITERAL_PATTERN);
216
+ if (stringMatch?.[1] !== void 0) {
217
+ const unescaped = stringMatch[1].replace(/''/g, "'");
218
+ if (normalizedType === "json" || normalizedType === "jsonb") try {
219
+ return {
220
+ kind: "literal",
221
+ value: JSON.parse(unescaped)
222
+ };
223
+ } catch {}
224
+ return {
225
+ kind: "literal",
226
+ value: unescaped
227
+ };
228
+ }
229
+ return {
230
+ kind: "function",
231
+ expression: trimmed
232
+ };
233
+ }
234
+ /**
235
+ * Normalizes a contract-declared default through {@link parsePostgresDefault}
236
+ * — the same parser introspection uses — so a function-shaped default the
237
+ * parser recognizes as a literal (e.g. `dbgenerated("'{}'::jsonb")`)
238
+ * resolves to the same `resolvedDefault` shape a live introspected column
239
+ * would produce. Compensates once, at `SchemaIR` construction of the
240
+ * expected (contract-derived) side (`contractToSchemaIR`'s `resolveDefault`
241
+ * hook), instead of at every site that later compares the two sides. A
242
+ * literal default, or a function form the parser doesn't recognize, passes
243
+ * through unchanged; `nextval(...)` normalizes to `autoincrement()` on both
244
+ * sides, matching a `serial`/identity column's introspected counterpart.
245
+ */
246
+ function postgresResolveDefault(def, resolvedNativeType) {
247
+ if (def.kind !== "function") return def;
248
+ return parsePostgresDefault(def.expression, resolvedNativeType) ?? def;
249
+ }
250
+ //#endregion
251
+ export { postgresResolveDefault as n, parsePostgresDefault as t };
252
+
253
+ //# sourceMappingURL=default-normalizer-Ba5ZebHM-isV86rjy.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-normalizer-Ba5ZebHM-isV86rjy.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/default-normalizer-Ba5ZebHM.mjs"],"sourcesContent":["//#region src/core/default-normalizer.ts\n/**\n* Pre-compiled regex patterns for performance.\n* These are compiled once at module load time rather than on each function call.\n*/\nconst NEXTVAL_PATTERN = /^nextval\\s*\\(/i;\nconst NOW_FUNCTION_PATTERN = /^(now\\s*\\(\\s*\\)|CURRENT_TIMESTAMP)$/i;\nconst CLOCK_TIMESTAMP_PATTERN = /^clock_timestamp\\s*\\(\\s*\\)$/i;\nconst TIMESTAMP_CAST_SUFFIX = /::timestamp(?:tz|\\s+(?:with|without)\\s+time\\s+zone)?$/i;\nconst TEXT_CAST_SUFFIX = /::text$/i;\nconst NOW_LITERAL_PATTERN = /^'now'$/i;\nconst UUID_PATTERN = /^gen_random_uuid\\s*\\(\\s*\\)$/i;\nconst UUID_OSSP_PATTERN = /^uuid_generate_v4\\s*\\(\\s*\\)$/i;\nconst NULL_PATTERN = /^NULL(?:::.+)?$/i;\nconst TRUE_PATTERN = /^true$/i;\nconst FALSE_PATTERN = /^false$/i;\nconst NUMERIC_PATTERN = /^-?\\d+(\\.\\d+)?$/;\nconst STRING_LITERAL_PATTERN = /^'((?:[^']|'')*)'(?:::(?:\"[^\"]+\"|[\\w\\s]+)(?:\\(\\d+\\))?)?$/;\n/**\n* Matches a Postgres array literal default of the form `'{...}'::elemtype[]`.\n* The literal body is captured in group 1; the cast (including `[]`) is optional.\n* Examples: `'{}'::text[]`, `'{1,2}'::integer[]`, `'{}'`\n*/\nconst ARRAY_LITERAL_PATTERN = /^'(\\{.*\\})'(?:::.+\\[\\])?$/;\n/**\n* Returns the canonical expression for a timestamp default function, or undefined\n* if the expression is not a recognized timestamp default.\n*\n* Keeps now()/CURRENT_TIMESTAMP and clock_timestamp() distinct:\n* - now(), CURRENT_TIMESTAMP, ('now'::text)::timestamp... → 'now()'\n* - clock_timestamp(), clock_timestamp()::timestamptz → 'clock_timestamp()'\n*\n* These are semantically different in Postgres: now() returns the transaction\n* start time (constant within a transaction), while clock_timestamp() returns\n* the actual wall-clock time (can differ across rows in a single INSERT).\n*/\nfunction canonicalizeTimestampDefault(expr) {\n\tif (NOW_FUNCTION_PATTERN.test(expr)) return \"now()\";\n\tif (CLOCK_TIMESTAMP_PATTERN.test(expr)) return \"clock_timestamp()\";\n\tif (!TIMESTAMP_CAST_SUFFIX.test(expr)) return void 0;\n\tlet inner = expr.replace(TIMESTAMP_CAST_SUFFIX, \"\").trim();\n\tif (inner.startsWith(\"(\") && inner.endsWith(\")\")) inner = inner.slice(1, -1).trim();\n\tif (NOW_FUNCTION_PATTERN.test(inner)) return \"now()\";\n\tif (CLOCK_TIMESTAMP_PATTERN.test(inner)) return \"clock_timestamp()\";\n\tinner = inner.replace(TEXT_CAST_SUFFIX, \"\").trim();\n\tif (NOW_LITERAL_PATTERN.test(inner)) return \"now()\";\n}\n/**\n* Splits a Postgres array literal body (without the enclosing braces) into its\n* element tokens, honouring quoting. A comma only separates elements when it is\n* outside double quotes; inside a quoted element a doubled quote (`\"\"`) or a\n* backslash-escaped quote (`\\\"`) is a literal quote, and a backslash escapes the\n* next character. Returns undefined if the body is malformed (e.g. an unbalanced\n* quote).\n*/\nfunction splitArrayElements(inner) {\n\tconst tokens = [];\n\tlet current = \"\";\n\tlet inQuotes = false;\n\tlet quoted = false;\n\tfor (let i = 0; i < inner.length; i++) {\n\t\tconst char = inner[i];\n\t\tif (inQuotes) {\n\t\t\tif (char === \"\\\\\") {\n\t\t\t\tconst next = inner[i + 1];\n\t\t\t\tif (next === void 0) return void 0;\n\t\t\t\tcurrent += next;\n\t\t\t\ti++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (char === \"\\\"\") {\n\t\t\t\tif (inner[i + 1] === \"\\\"\") {\n\t\t\t\t\tcurrent += \"\\\"\";\n\t\t\t\t\ti++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tinQuotes = false;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tcurrent += char;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === \"\\\"\") {\n\t\t\tinQuotes = true;\n\t\t\tquoted = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === \",\") {\n\t\t\ttokens.push({\n\t\t\t\tvalue: current,\n\t\t\t\tquoted\n\t\t\t});\n\t\t\tcurrent = \"\";\n\t\t\tquoted = false;\n\t\t\tcontinue;\n\t\t}\n\t\tcurrent += char;\n\t}\n\tif (inQuotes) return void 0;\n\ttokens.push({\n\t\tvalue: current,\n\t\tquoted\n\t});\n\treturn tokens;\n}\n/**\n* Parses a Postgres array literal body (`{...}`) into a JS array of primitives.\n* Returns undefined if the body cannot be reliably parsed.\n*\n* Handles:\n* - `{}` → `[]`\n* - `{elem1,elem2,...}` → `[elem1, elem2, ...]` with numeric and string element coercion\n* - quoted elements that contain commas, doubled/escaped quotes, and the literal\n* strings `NULL`/`true`/`false` (a quoted token is always a string)\n*/\nfunction parseArrayLiteralBody(body) {\n\tconst inner = body.slice(1, -1).trim();\n\tif (inner === \"\") return [];\n\tconst tokens = splitArrayElements(inner);\n\tif (tokens === void 0) return void 0;\n\tconst result = [];\n\tfor (const token of tokens) {\n\t\tif (token.quoted) {\n\t\t\tresult.push(token.value);\n\t\t\tcontinue;\n\t\t}\n\t\tconst el = token.value.trim();\n\t\tif (el.toUpperCase() === \"NULL\") {\n\t\t\tresult.push(null);\n\t\t\tcontinue;\n\t\t}\n\t\tif (el === \"true\") {\n\t\t\tresult.push(true);\n\t\t\tcontinue;\n\t\t}\n\t\tif (el === \"false\") {\n\t\t\tresult.push(false);\n\t\t\tcontinue;\n\t\t}\n\t\tif (NUMERIC_PATTERN.test(el)) {\n\t\t\tresult.push(Number(el));\n\t\t\tcontinue;\n\t\t}\n\t\treturn;\n\t}\n\treturn result;\n}\n/**\n* Parses a raw Postgres column default expression into a normalized ColumnDefault.\n* This enables semantic comparison between contract defaults and introspected schema defaults.\n*\n* Used by the migration diff layer to normalize raw database defaults during comparison,\n* keeping the introspection layer focused on faithful data capture.\n*\n* @param rawDefault - Raw default expression from information_schema.columns.column_default\n* @param nativeType - Native column type, used for type-aware parsing (array, bigint, JSON)\n* @returns Normalized ColumnDefault or undefined if the expression cannot be parsed\n*/\nfunction parsePostgresDefault(rawDefault, nativeType) {\n\tconst trimmed = rawDefault.trim();\n\tconst normalizedType = nativeType?.toLowerCase();\n\tconst isBigInt = normalizedType === \"bigint\" || normalizedType === \"int8\";\n\tconst isArrayType = normalizedType?.endsWith(\"[]\") ?? false;\n\tif (NEXTVAL_PATTERN.test(trimmed)) return {\n\t\tkind: \"function\",\n\t\texpression: \"autoincrement()\"\n\t};\n\tif (isArrayType) {\n\t\tconst arrayMatch = trimmed.match(ARRAY_LITERAL_PATTERN);\n\t\tif (arrayMatch?.[1] !== void 0) {\n\t\t\tconst parsed = parseArrayLiteralBody(arrayMatch[1]);\n\t\t\tif (parsed !== void 0) return {\n\t\t\t\tkind: \"literal\",\n\t\t\t\tvalue: parsed\n\t\t\t};\n\t\t}\n\t}\n\tconst canonicalTimestamp = canonicalizeTimestampDefault(trimmed);\n\tif (canonicalTimestamp) return {\n\t\tkind: \"function\",\n\t\texpression: canonicalTimestamp\n\t};\n\tif (UUID_PATTERN.test(trimmed)) return {\n\t\tkind: \"function\",\n\t\texpression: \"gen_random_uuid()\"\n\t};\n\tif (UUID_OSSP_PATTERN.test(trimmed)) return {\n\t\tkind: \"function\",\n\t\texpression: \"gen_random_uuid()\"\n\t};\n\tif (NULL_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tvalue: null\n\t};\n\tif (TRUE_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tvalue: true\n\t};\n\tif (FALSE_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tvalue: false\n\t};\n\tif (NUMERIC_PATTERN.test(trimmed)) {\n\t\tconst num = Number(trimmed);\n\t\tif (!Number.isFinite(num)) return void 0;\n\t\tif (isBigInt) return {\n\t\t\tkind: \"literal\",\n\t\t\tvalue: trimmed\n\t\t};\n\t\treturn {\n\t\t\tkind: \"literal\",\n\t\t\tvalue: num\n\t\t};\n\t}\n\tconst stringMatch = trimmed.match(STRING_LITERAL_PATTERN);\n\tif (stringMatch?.[1] !== void 0) {\n\t\tconst unescaped = stringMatch[1].replace(/''/g, \"'\");\n\t\tif (normalizedType === \"json\" || normalizedType === \"jsonb\") try {\n\t\t\treturn {\n\t\t\t\tkind: \"literal\",\n\t\t\t\tvalue: JSON.parse(unescaped)\n\t\t\t};\n\t\t} catch {}\n\t\treturn {\n\t\t\tkind: \"literal\",\n\t\t\tvalue: unescaped\n\t\t};\n\t}\n\treturn {\n\t\tkind: \"function\",\n\t\texpression: trimmed\n\t};\n}\n/**\n* Normalizes a contract-declared default through {@link parsePostgresDefault}\n* — the same parser introspection uses — so a function-shaped default the\n* parser recognizes as a literal (e.g. `dbgenerated(\"'{}'::jsonb\")`)\n* resolves to the same `resolvedDefault` shape a live introspected column\n* would produce. Compensates once, at `SchemaIR` construction of the\n* expected (contract-derived) side (`contractToSchemaIR`'s `resolveDefault`\n* hook), instead of at every site that later compares the two sides. A\n* literal default, or a function form the parser doesn't recognize, passes\n* through unchanged; `nextval(...)` normalizes to `autoincrement()` on both\n* sides, matching a `serial`/identity column's introspected counterpart.\n*/\nfunction postgresResolveDefault(def, resolvedNativeType) {\n\tif (def.kind !== \"function\") return def;\n\treturn parsePostgresDefault(def.expression, resolvedNativeType) ?? def;\n}\n//#endregion\nexport { postgresResolveDefault as n, parsePostgresDefault as t };\n\n//# sourceMappingURL=default-normalizer-Ba5ZebHM.mjs.map"],"mappings":";;;;;AAKA,MAAM,kBAAkB;AACxB,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;;AAaA,SAAS,uBAAuB,KAAK,oBAAoB;CACxD,IAAI,IAAI,SAAS,YAAY,OAAO;CACpC,OAAO,qBAAqB,IAAI,YAAY,kBAAkB,KAAK;AACpE"}
@@ -0,0 +1,351 @@
1
+ import { A as SQL_INT_CODEC_ID, C as PG_TIMETZ_CODEC_ID, D as PG_VARCHAR_CODEC_ID, E as PG_VARBIT_CODEC_ID, M as SQL_TIMESTAMP_CODEC_ID, N as SQL_VARCHAR_CODEC_ID, O as SQL_CHAR_CODEC_ID, S as PG_TIMESTAMP_CODEC_ID, T as PG_UUID_CODEC_ID, _ as PG_JSON_CODEC_ID, b as PG_TEXT_CODEC_ID, c as PG_FLOAT8_CODEC_ID, d as PG_INT2_CODEC_ID, f as PG_INT4_CODEC_ID, g as PG_JSONB_CODEC_ID, h as PG_INT_CODEC_ID, i as PG_CHAR_CODEC_ID, j as SQL_TEXT_CODEC_ID, k as SQL_FLOAT_CODEC_ID, l as PG_FLOAT_CODEC_ID, m as PG_INTERVAL_CODEC_ID, n as PG_BOOL_CODEC_ID, p as PG_INT8_CODEC_ID, r as PG_BYTEA_CODEC_ID, s as PG_FLOAT4_CODEC_ID, t as PG_BIT_CODEC_ID, u as PG_INET_CODEC_ID, v as PG_NUMERIC_CODEC_ID, w as PG_TIME_CODEC_ID, x as PG_TIMESTAMPTZ_CODEC_ID } from "./codec-ids-tX7Svtz--BuOfRaVU.mjs";
2
+ import { n as postgresCodecRegistry } from "./codecs-CHIVTNZs.mjs";
3
+ import { n as adapterError } from "./control-adapter-B9t0g7Pf-HrCxlM65.mjs";
4
+ import { buildOperation, toExpr } from "@prisma/orm-family-sql/relational-core/expression";
5
+ //#region ../../../3-targets/6-adapters/postgres/dist/descriptor-meta-2IlVC6_d.mjs
6
+ /** Creates a type import spec for codec types */
7
+ const codecTypeImport = (named) => ({
8
+ package: "@internal/target-postgres/codec-types",
9
+ named,
10
+ alias: named
11
+ });
12
+ function isPositiveInteger(value) {
13
+ return typeof value === "number" && Number.isFinite(value) && Number.isInteger(value) && value > 0;
14
+ }
15
+ function isNonNegativeInteger(value) {
16
+ return typeof value === "number" && Number.isFinite(value) && Number.isInteger(value) && value >= 0;
17
+ }
18
+ function expandLength({ nativeType, typeParams }) {
19
+ if (!typeParams || !("length" in typeParams)) return nativeType;
20
+ const length = typeParams["length"];
21
+ if (!isPositiveInteger(length)) throw adapterError("RUNTIME.TYPE_PARAMS_INVALID", `Invalid "length" type parameter for "${nativeType}": expected a positive integer, got ${JSON.stringify(length)}`, { meta: {
22
+ nativeType,
23
+ param: "length",
24
+ received: length
25
+ } });
26
+ return `${nativeType}(${length})`;
27
+ }
28
+ function expandPrecision({ nativeType, typeParams }) {
29
+ if (!typeParams || !("precision" in typeParams)) return nativeType;
30
+ const precision = typeParams["precision"];
31
+ if (!isPositiveInteger(precision)) throw adapterError("RUNTIME.TYPE_PARAMS_INVALID", `Invalid "precision" type parameter for "${nativeType}": expected a positive integer, got ${JSON.stringify(precision)}`, { meta: {
32
+ nativeType,
33
+ param: "precision",
34
+ received: precision
35
+ } });
36
+ return `${nativeType}(${precision})`;
37
+ }
38
+ function expandNumeric({ nativeType, typeParams }) {
39
+ const hasPrecision = typeParams && "precision" in typeParams;
40
+ const hasScale = typeParams && "scale" in typeParams;
41
+ if (!hasPrecision && !hasScale) return nativeType;
42
+ if (!hasPrecision && hasScale) throw adapterError("RUNTIME.TYPE_PARAMS_INVALID", `Invalid type parameters for "${nativeType}": "scale" requires "precision" to be specified`, { meta: {
43
+ nativeType,
44
+ param: "scale"
45
+ } });
46
+ if (hasPrecision) {
47
+ const precision = typeParams["precision"];
48
+ if (!isPositiveInteger(precision)) throw adapterError("RUNTIME.TYPE_PARAMS_INVALID", `Invalid "precision" type parameter for "${nativeType}": expected a positive integer, got ${JSON.stringify(precision)}`, { meta: {
49
+ nativeType,
50
+ param: "precision",
51
+ received: precision
52
+ } });
53
+ if (hasScale) {
54
+ const scale = typeParams["scale"];
55
+ if (!isNonNegativeInteger(scale)) throw adapterError("RUNTIME.TYPE_PARAMS_INVALID", `Invalid "scale" type parameter for "${nativeType}": expected a non-negative integer, got ${JSON.stringify(scale)}`, { meta: {
56
+ nativeType,
57
+ param: "scale",
58
+ received: scale
59
+ } });
60
+ return `${nativeType}(${precision},${scale})`;
61
+ }
62
+ return `${nativeType}(${precision})`;
63
+ }
64
+ return nativeType;
65
+ }
66
+ const lengthHooks = { expandNativeType: expandLength };
67
+ const precisionHooks = { expandNativeType: expandPrecision };
68
+ const numericHooks = { expandNativeType: expandNumeric };
69
+ const identityHooks = { expandNativeType: ({ nativeType }) => nativeType };
70
+ function postgresQueryOperations() {
71
+ return { ilike: {
72
+ self: { traits: ["textual"] },
73
+ impl: (self, pattern) => {
74
+ return buildOperation({
75
+ method: "ilike",
76
+ args: [toExpr(self), toExpr(pattern, { codecId: PG_TEXT_CODEC_ID })],
77
+ returns: {
78
+ codecId: PG_BOOL_CODEC_ID,
79
+ nullable: false
80
+ },
81
+ lowering: {
82
+ targetFamily: "sql",
83
+ strategy: "infix",
84
+ template: "{{self}} ILIKE {{arg0}}"
85
+ }
86
+ });
87
+ }
88
+ } };
89
+ }
90
+ const postgresAdapterDescriptorMeta = {
91
+ kind: "adapter",
92
+ familyId: "sql",
93
+ targetId: "postgres",
94
+ id: "postgres",
95
+ version: "0.0.1",
96
+ capabilities: {
97
+ postgres: {
98
+ orderBy: true,
99
+ limit: true,
100
+ lateral: true,
101
+ jsonAgg: true,
102
+ returning: true,
103
+ distinctOn: true
104
+ },
105
+ sql: {
106
+ enums: true,
107
+ returning: true,
108
+ defaultInInsert: true,
109
+ lateral: true,
110
+ scalarList: true
111
+ }
112
+ },
113
+ types: {
114
+ codecTypes: {
115
+ codecDescriptors: Array.from(postgresCodecRegistry.values()),
116
+ import: {
117
+ package: "@internal/target-postgres/codec-types",
118
+ named: "CodecTypes",
119
+ alias: "PgTypes"
120
+ },
121
+ typeImports: [
122
+ {
123
+ package: "@internal/target-postgres/codec-types",
124
+ named: "JsonValue",
125
+ alias: "JsonValue"
126
+ },
127
+ codecTypeImport("Char"),
128
+ codecTypeImport("Varchar"),
129
+ codecTypeImport("Numeric"),
130
+ codecTypeImport("Bit"),
131
+ codecTypeImport("VarBit"),
132
+ codecTypeImport("Timestamp"),
133
+ codecTypeImport("Timestamptz"),
134
+ codecTypeImport("Time"),
135
+ codecTypeImport("Timetz"),
136
+ codecTypeImport("Interval")
137
+ ],
138
+ controlPlaneHooks: {
139
+ [SQL_CHAR_CODEC_ID]: lengthHooks,
140
+ [SQL_VARCHAR_CODEC_ID]: lengthHooks,
141
+ [SQL_TIMESTAMP_CODEC_ID]: precisionHooks,
142
+ [PG_CHAR_CODEC_ID]: lengthHooks,
143
+ [PG_VARCHAR_CODEC_ID]: lengthHooks,
144
+ [PG_NUMERIC_CODEC_ID]: numericHooks,
145
+ [PG_BIT_CODEC_ID]: lengthHooks,
146
+ [PG_VARBIT_CODEC_ID]: lengthHooks,
147
+ [PG_TIMESTAMP_CODEC_ID]: precisionHooks,
148
+ [PG_TIMESTAMPTZ_CODEC_ID]: precisionHooks,
149
+ [PG_TIME_CODEC_ID]: precisionHooks,
150
+ [PG_TIMETZ_CODEC_ID]: precisionHooks,
151
+ [PG_INTERVAL_CODEC_ID]: precisionHooks,
152
+ [PG_JSON_CODEC_ID]: identityHooks,
153
+ [PG_JSONB_CODEC_ID]: identityHooks,
154
+ [PG_BYTEA_CODEC_ID]: identityHooks,
155
+ [PG_UUID_CODEC_ID]: identityHooks,
156
+ [PG_INET_CODEC_ID]: identityHooks
157
+ }
158
+ },
159
+ storage: [
160
+ {
161
+ typeId: PG_TEXT_CODEC_ID,
162
+ familyId: "sql",
163
+ targetId: "postgres",
164
+ nativeType: "text"
165
+ },
166
+ {
167
+ typeId: SQL_TEXT_CODEC_ID,
168
+ familyId: "sql",
169
+ targetId: "postgres",
170
+ nativeType: "text"
171
+ },
172
+ {
173
+ typeId: SQL_CHAR_CODEC_ID,
174
+ familyId: "sql",
175
+ targetId: "postgres",
176
+ nativeType: "character"
177
+ },
178
+ {
179
+ typeId: SQL_VARCHAR_CODEC_ID,
180
+ familyId: "sql",
181
+ targetId: "postgres",
182
+ nativeType: "character varying"
183
+ },
184
+ {
185
+ typeId: SQL_INT_CODEC_ID,
186
+ familyId: "sql",
187
+ targetId: "postgres",
188
+ nativeType: "int4"
189
+ },
190
+ {
191
+ typeId: SQL_FLOAT_CODEC_ID,
192
+ familyId: "sql",
193
+ targetId: "postgres",
194
+ nativeType: "float8"
195
+ },
196
+ {
197
+ typeId: SQL_TIMESTAMP_CODEC_ID,
198
+ familyId: "sql",
199
+ targetId: "postgres",
200
+ nativeType: "timestamp"
201
+ },
202
+ {
203
+ typeId: PG_CHAR_CODEC_ID,
204
+ familyId: "sql",
205
+ targetId: "postgres",
206
+ nativeType: "character"
207
+ },
208
+ {
209
+ typeId: PG_VARCHAR_CODEC_ID,
210
+ familyId: "sql",
211
+ targetId: "postgres",
212
+ nativeType: "character varying"
213
+ },
214
+ {
215
+ typeId: PG_INT_CODEC_ID,
216
+ familyId: "sql",
217
+ targetId: "postgres",
218
+ nativeType: "int4"
219
+ },
220
+ {
221
+ typeId: PG_FLOAT_CODEC_ID,
222
+ familyId: "sql",
223
+ targetId: "postgres",
224
+ nativeType: "float8"
225
+ },
226
+ {
227
+ typeId: PG_INT4_CODEC_ID,
228
+ familyId: "sql",
229
+ targetId: "postgres",
230
+ nativeType: "int4"
231
+ },
232
+ {
233
+ typeId: PG_INT2_CODEC_ID,
234
+ familyId: "sql",
235
+ targetId: "postgres",
236
+ nativeType: "int2"
237
+ },
238
+ {
239
+ typeId: PG_INT8_CODEC_ID,
240
+ familyId: "sql",
241
+ targetId: "postgres",
242
+ nativeType: "int8"
243
+ },
244
+ {
245
+ typeId: PG_FLOAT4_CODEC_ID,
246
+ familyId: "sql",
247
+ targetId: "postgres",
248
+ nativeType: "float4"
249
+ },
250
+ {
251
+ typeId: PG_FLOAT8_CODEC_ID,
252
+ familyId: "sql",
253
+ targetId: "postgres",
254
+ nativeType: "float8"
255
+ },
256
+ {
257
+ typeId: PG_NUMERIC_CODEC_ID,
258
+ familyId: "sql",
259
+ targetId: "postgres",
260
+ nativeType: "numeric"
261
+ },
262
+ {
263
+ typeId: PG_TIMESTAMP_CODEC_ID,
264
+ familyId: "sql",
265
+ targetId: "postgres",
266
+ nativeType: "timestamp"
267
+ },
268
+ {
269
+ typeId: PG_TIMESTAMPTZ_CODEC_ID,
270
+ familyId: "sql",
271
+ targetId: "postgres",
272
+ nativeType: "timestamptz"
273
+ },
274
+ {
275
+ typeId: PG_TIME_CODEC_ID,
276
+ familyId: "sql",
277
+ targetId: "postgres",
278
+ nativeType: "time"
279
+ },
280
+ {
281
+ typeId: PG_TIMETZ_CODEC_ID,
282
+ familyId: "sql",
283
+ targetId: "postgres",
284
+ nativeType: "timetz"
285
+ },
286
+ {
287
+ typeId: PG_BOOL_CODEC_ID,
288
+ familyId: "sql",
289
+ targetId: "postgres",
290
+ nativeType: "bool"
291
+ },
292
+ {
293
+ typeId: PG_BIT_CODEC_ID,
294
+ familyId: "sql",
295
+ targetId: "postgres",
296
+ nativeType: "bit"
297
+ },
298
+ {
299
+ typeId: PG_VARBIT_CODEC_ID,
300
+ familyId: "sql",
301
+ targetId: "postgres",
302
+ nativeType: "bit varying"
303
+ },
304
+ {
305
+ typeId: PG_INTERVAL_CODEC_ID,
306
+ familyId: "sql",
307
+ targetId: "postgres",
308
+ nativeType: "interval"
309
+ },
310
+ {
311
+ typeId: PG_JSON_CODEC_ID,
312
+ familyId: "sql",
313
+ targetId: "postgres",
314
+ nativeType: "json"
315
+ },
316
+ {
317
+ typeId: PG_JSONB_CODEC_ID,
318
+ familyId: "sql",
319
+ targetId: "postgres",
320
+ nativeType: "jsonb"
321
+ },
322
+ {
323
+ typeId: PG_BYTEA_CODEC_ID,
324
+ familyId: "sql",
325
+ targetId: "postgres",
326
+ nativeType: "bytea"
327
+ },
328
+ {
329
+ typeId: PG_UUID_CODEC_ID,
330
+ familyId: "sql",
331
+ targetId: "postgres",
332
+ nativeType: "uuid"
333
+ },
334
+ {
335
+ typeId: PG_INET_CODEC_ID,
336
+ familyId: "sql",
337
+ targetId: "postgres",
338
+ nativeType: "inet"
339
+ }
340
+ ],
341
+ queryOperationTypes: { import: {
342
+ package: "@internal/adapter-postgres/operation-types",
343
+ named: "QueryOperationTypes",
344
+ alias: "PgAdapterQueryOps"
345
+ } }
346
+ }
347
+ };
348
+ //#endregion
349
+ export { postgresQueryOperations as n, postgresAdapterDescriptorMeta as t };
350
+
351
+ //# sourceMappingURL=descriptor-meta-2IlVC6_d-DnV00Qd_.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor-meta-2IlVC6_d-DnV00Qd_.mjs","names":[],"sources":["../../../../3-targets/6-adapters/postgres/dist/descriptor-meta-2IlVC6_d.mjs"],"sourcesContent":["import { o as adapterError } from \"./control-adapter-B9t0g7Pf.mjs\";\nimport { postgresCodecRegistry } from \"@internal/target-postgres/codecs\";\nimport { PG_BIT_CODEC_ID, PG_BOOL_CODEC_ID, PG_BYTEA_CODEC_ID, PG_CHAR_CODEC_ID, PG_FLOAT4_CODEC_ID, PG_FLOAT8_CODEC_ID, PG_FLOAT_CODEC_ID, PG_INET_CODEC_ID, PG_INT2_CODEC_ID, PG_INT4_CODEC_ID, PG_INT8_CODEC_ID, PG_INTERVAL_CODEC_ID, PG_INT_CODEC_ID, PG_JSONB_CODEC_ID, PG_JSON_CODEC_ID, PG_NUMERIC_CODEC_ID, PG_TEXT_CODEC_ID, PG_TIMESTAMPTZ_CODEC_ID, PG_TIMESTAMP_CODEC_ID, PG_TIMETZ_CODEC_ID, PG_TIME_CODEC_ID, PG_UUID_CODEC_ID, PG_VARBIT_CODEC_ID, PG_VARCHAR_CODEC_ID, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID } from \"@internal/target-postgres/codec-ids\";\nimport { buildOperation, toExpr } from \"@internal/sql-relational-core/expression\";\n//#region src/core/descriptor-meta.ts\n/** Creates a type import spec for codec types */\nconst codecTypeImport = (named) => ({\n\tpackage: \"@internal/target-postgres/codec-types\",\n\tnamed,\n\talias: named\n});\nfunction isPositiveInteger(value) {\n\treturn typeof value === \"number\" && Number.isFinite(value) && Number.isInteger(value) && value > 0;\n}\nfunction isNonNegativeInteger(value) {\n\treturn typeof value === \"number\" && Number.isFinite(value) && Number.isInteger(value) && value >= 0;\n}\nfunction expandLength({ nativeType, typeParams }) {\n\tif (!typeParams || !(\"length\" in typeParams)) return nativeType;\n\tconst length = typeParams[\"length\"];\n\tif (!isPositiveInteger(length)) throw adapterError(\"RUNTIME.TYPE_PARAMS_INVALID\", `Invalid \"length\" type parameter for \"${nativeType}\": expected a positive integer, got ${JSON.stringify(length)}`, { meta: {\n\t\tnativeType,\n\t\tparam: \"length\",\n\t\treceived: length\n\t} });\n\treturn `${nativeType}(${length})`;\n}\nfunction expandPrecision({ nativeType, typeParams }) {\n\tif (!typeParams || !(\"precision\" in typeParams)) return nativeType;\n\tconst precision = typeParams[\"precision\"];\n\tif (!isPositiveInteger(precision)) throw adapterError(\"RUNTIME.TYPE_PARAMS_INVALID\", `Invalid \"precision\" type parameter for \"${nativeType}\": expected a positive integer, got ${JSON.stringify(precision)}`, { meta: {\n\t\tnativeType,\n\t\tparam: \"precision\",\n\t\treceived: precision\n\t} });\n\treturn `${nativeType}(${precision})`;\n}\nfunction expandNumeric({ nativeType, typeParams }) {\n\tconst hasPrecision = typeParams && \"precision\" in typeParams;\n\tconst hasScale = typeParams && \"scale\" in typeParams;\n\tif (!hasPrecision && !hasScale) return nativeType;\n\tif (!hasPrecision && hasScale) throw adapterError(\"RUNTIME.TYPE_PARAMS_INVALID\", `Invalid type parameters for \"${nativeType}\": \"scale\" requires \"precision\" to be specified`, { meta: {\n\t\tnativeType,\n\t\tparam: \"scale\"\n\t} });\n\tif (hasPrecision) {\n\t\tconst precision = typeParams[\"precision\"];\n\t\tif (!isPositiveInteger(precision)) throw adapterError(\"RUNTIME.TYPE_PARAMS_INVALID\", `Invalid \"precision\" type parameter for \"${nativeType}\": expected a positive integer, got ${JSON.stringify(precision)}`, { meta: {\n\t\t\tnativeType,\n\t\t\tparam: \"precision\",\n\t\t\treceived: precision\n\t\t} });\n\t\tif (hasScale) {\n\t\t\tconst scale = typeParams[\"scale\"];\n\t\t\tif (!isNonNegativeInteger(scale)) throw adapterError(\"RUNTIME.TYPE_PARAMS_INVALID\", `Invalid \"scale\" type parameter for \"${nativeType}\": expected a non-negative integer, got ${JSON.stringify(scale)}`, { meta: {\n\t\t\t\tnativeType,\n\t\t\t\tparam: \"scale\",\n\t\t\t\treceived: scale\n\t\t\t} });\n\t\t\treturn `${nativeType}(${precision},${scale})`;\n\t\t}\n\t\treturn `${nativeType}(${precision})`;\n\t}\n\treturn nativeType;\n}\nconst lengthHooks = { expandNativeType: expandLength };\nconst precisionHooks = { expandNativeType: expandPrecision };\nconst numericHooks = { expandNativeType: expandNumeric };\nconst identityHooks = { expandNativeType: ({ nativeType }) => nativeType };\nfunction postgresQueryOperations() {\n\treturn { ilike: {\n\t\tself: { traits: [\"textual\"] },\n\t\timpl: (self, pattern) => {\n\t\t\treturn buildOperation({\n\t\t\t\tmethod: \"ilike\",\n\t\t\t\targs: [toExpr(self), toExpr(pattern, { codecId: PG_TEXT_CODEC_ID })],\n\t\t\t\treturns: {\n\t\t\t\t\tcodecId: PG_BOOL_CODEC_ID,\n\t\t\t\t\tnullable: false\n\t\t\t\t},\n\t\t\t\tlowering: {\n\t\t\t\t\ttargetFamily: \"sql\",\n\t\t\t\t\tstrategy: \"infix\",\n\t\t\t\t\ttemplate: \"{{self}} ILIKE {{arg0}}\"\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t} };\n}\nconst postgresAdapterDescriptorMeta = {\n\tkind: \"adapter\",\n\tfamilyId: \"sql\",\n\ttargetId: \"postgres\",\n\tid: \"postgres\",\n\tversion: \"0.0.1\",\n\tcapabilities: {\n\t\tpostgres: {\n\t\t\torderBy: true,\n\t\t\tlimit: true,\n\t\t\tlateral: true,\n\t\t\tjsonAgg: true,\n\t\t\treturning: true,\n\t\t\tdistinctOn: true\n\t\t},\n\t\tsql: {\n\t\t\tenums: true,\n\t\t\treturning: true,\n\t\t\tdefaultInInsert: true,\n\t\t\tlateral: true,\n\t\t\tscalarList: true\n\t\t}\n\t},\n\ttypes: {\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\t{\n\t\t\t\t\tpackage: \"@internal/target-postgres/codec-types\",\n\t\t\t\t\tnamed: \"JsonValue\",\n\t\t\t\t\talias: \"JsonValue\"\n\t\t\t\t},\n\t\t\t\tcodecTypeImport(\"Char\"),\n\t\t\t\tcodecTypeImport(\"Varchar\"),\n\t\t\t\tcodecTypeImport(\"Numeric\"),\n\t\t\t\tcodecTypeImport(\"Bit\"),\n\t\t\t\tcodecTypeImport(\"VarBit\"),\n\t\t\t\tcodecTypeImport(\"Timestamp\"),\n\t\t\t\tcodecTypeImport(\"Timestamptz\"),\n\t\t\t\tcodecTypeImport(\"Time\"),\n\t\t\t\tcodecTypeImport(\"Timetz\"),\n\t\t\t\tcodecTypeImport(\"Interval\")\n\t\t\t],\n\t\t\tcontrolPlaneHooks: {\n\t\t\t\t[SQL_CHAR_CODEC_ID]: lengthHooks,\n\t\t\t\t[SQL_VARCHAR_CODEC_ID]: lengthHooks,\n\t\t\t\t[SQL_TIMESTAMP_CODEC_ID]: precisionHooks,\n\t\t\t\t[PG_CHAR_CODEC_ID]: lengthHooks,\n\t\t\t\t[PG_VARCHAR_CODEC_ID]: lengthHooks,\n\t\t\t\t[PG_NUMERIC_CODEC_ID]: numericHooks,\n\t\t\t\t[PG_BIT_CODEC_ID]: lengthHooks,\n\t\t\t\t[PG_VARBIT_CODEC_ID]: lengthHooks,\n\t\t\t\t[PG_TIMESTAMP_CODEC_ID]: precisionHooks,\n\t\t\t\t[PG_TIMESTAMPTZ_CODEC_ID]: precisionHooks,\n\t\t\t\t[PG_TIME_CODEC_ID]: precisionHooks,\n\t\t\t\t[PG_TIMETZ_CODEC_ID]: precisionHooks,\n\t\t\t\t[PG_INTERVAL_CODEC_ID]: precisionHooks,\n\t\t\t\t[PG_JSON_CODEC_ID]: identityHooks,\n\t\t\t\t[PG_JSONB_CODEC_ID]: identityHooks,\n\t\t\t\t[PG_BYTEA_CODEC_ID]: identityHooks,\n\t\t\t\t[PG_UUID_CODEC_ID]: identityHooks,\n\t\t\t\t[PG_INET_CODEC_ID]: identityHooks\n\t\t\t}\n\t\t},\n\t\tstorage: [\n\t\t\t{\n\t\t\t\ttypeId: PG_TEXT_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"text\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: SQL_TEXT_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"text\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: SQL_CHAR_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"character\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: SQL_VARCHAR_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"character varying\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: SQL_INT_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"int4\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: SQL_FLOAT_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"float8\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: SQL_TIMESTAMP_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"timestamp\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_CHAR_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"character\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_VARCHAR_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"character varying\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_INT_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"int4\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_FLOAT_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"float8\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_INT4_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"int4\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_INT2_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"int2\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_INT8_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"int8\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_FLOAT4_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"float4\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_FLOAT8_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"float8\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_NUMERIC_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"numeric\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_TIMESTAMP_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"timestamp\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_TIMESTAMPTZ_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"timestamptz\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_TIME_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"time\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_TIMETZ_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"timetz\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_BOOL_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"bool\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_BIT_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"bit\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_VARBIT_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"bit varying\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_INTERVAL_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"interval\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_JSON_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"json\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_JSONB_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"jsonb\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_BYTEA_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"bytea\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_UUID_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"uuid\"\n\t\t\t},\n\t\t\t{\n\t\t\t\ttypeId: PG_INET_CODEC_ID,\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tnativeType: \"inet\"\n\t\t\t}\n\t\t],\n\t\tqueryOperationTypes: { import: {\n\t\t\tpackage: \"@internal/adapter-postgres/operation-types\",\n\t\t\tnamed: \"QueryOperationTypes\",\n\t\t\talias: \"PgAdapterQueryOps\"\n\t\t} }\n\t}\n};\n//#endregion\nexport { postgresQueryOperations as n, postgresAdapterDescriptorMeta as t };\n\n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C,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACb;GACA;IACC,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACb;GACA;IACC,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACb;GACA;IACC,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACb;GACA;IACC,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACb;GACA;IACC,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACb;GACA;IACC,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACb;GACA;IACC,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACb;GACA;IACC,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACb;GACA;IACC,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACb;GACA;IACC,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACb;GACA;IACC,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACb;GACA;IACC,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACb;GACA;IACC,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACb;GACA;IACC,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACb;GACA;IACC,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACb;GACA;IACC,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACb;GACA;IACC,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACb;GACA;IACC,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACb;GACA;IACC,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACb;GACA;IACC,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACb;EACD;EACA,qBAAqB,EAAE,QAAQ;GAC9B,SAAS;GACT,OAAO;GACP,OAAO;EACR,EAAE;CACH;AACD"}