@prisma/orm-target-postgres 8.0.0-rc.1-dev.46 → 8.0.0-rc.10

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 (188) hide show
  1. package/README.md +1 -5
  2. package/dist/{adapter-B0xsc80z-sYcF0RVF.mjs → adapter-BO4-D_sb-Dv6OpO1E.mjs} +4 -4
  3. package/dist/{adapter-B0xsc80z-sYcF0RVF.mjs.map → adapter-BO4-D_sb-Dv6OpO1E.mjs.map} +1 -1
  4. package/dist/{adapter-CPesdzv0.d.mts → adapter-BQrsKoUs.d.mts} +2 -2
  5. package/dist/{adapter-CPesdzv0.d.mts.map → adapter-BQrsKoUs.d.mts.map} +1 -1
  6. package/dist/adapter.d.mts +8 -8
  7. package/dist/adapter.mjs +6 -6
  8. package/dist/adapter__adapter.d.mts +1 -1
  9. package/dist/adapter__adapter.mjs +1 -1
  10. package/dist/adapter__column-types.d.mts +2 -2
  11. package/dist/adapter__column-types.mjs +2 -2
  12. package/dist/adapter__control.d.mts +1 -1
  13. package/dist/adapter__control.mjs +78 -12
  14. package/dist/adapter__control.mjs.map +1 -1
  15. package/dist/adapter__runtime.d.mts +1 -1
  16. package/dist/adapter__runtime.mjs +23 -14
  17. package/dist/adapter__runtime.mjs.map +1 -1
  18. package/dist/adapter__sql-renderer.d.mts +1 -1
  19. package/dist/adapter__sql-renderer.mjs +1 -1
  20. package/dist/adapter__types.d.mts +2 -2
  21. package/dist/{aggregates-Dh6HPdvC.mjs → aggregates-Ckjhz1o7.mjs} +15 -10
  22. package/dist/aggregates-Ckjhz1o7.mjs.map +1 -0
  23. package/dist/{authoring-BOpdZa2N-ClrLFiXw.mjs → authoring-Dm1jBKhq-i8FD48I-.mjs} +84 -48
  24. package/dist/authoring-Dm1jBKhq-i8FD48I-.mjs.map +1 -0
  25. package/dist/{check-expressions-DRgG8RN5-DiA-22aC.d.mts → check-expressions-D4R7JhiZ-q-dFPGT2.d.mts} +7 -9
  26. package/dist/check-expressions-D4R7JhiZ-q-dFPGT2.d.mts.map +1 -0
  27. package/dist/{check-expressions-5vhxWaFy-CBcjFeur.mjs → check-expressions-DFTeR0rd-CSxSpyMV.mjs} +14 -11
  28. package/dist/check-expressions-DFTeR0rd-CSxSpyMV.mjs.map +1 -0
  29. package/dist/codec-ids-CmcC76hX-C0JIyoua.d.mts +39 -0
  30. package/dist/codec-ids-CmcC76hX-C0JIyoua.d.mts.map +1 -0
  31. package/dist/codec-ids-D3ZEAmt2-DjoKUAas.mjs +39 -0
  32. package/dist/codec-ids-D3ZEAmt2-DjoKUAas.mjs.map +1 -0
  33. package/dist/codec-ids-cWPqrkcF.d.mts +1 -0
  34. package/dist/{codec-types-BRU4F-7t-BaJbKF_i.d.mts → codec-types-X0ENu4sQ-C6GS_WDR.d.mts} +21 -9
  35. package/dist/codec-types-X0ENu4sQ-C6GS_WDR.d.mts.map +1 -0
  36. package/dist/codec-types-Zel4Dk7S.d.mts +2 -0
  37. package/dist/{codecs-BmPCJWqb-DveZGJvm.mjs → codecs-CxWg7WrX-DtVAuuXA.mjs} +351 -255
  38. package/dist/codecs-CxWg7WrX-DtVAuuXA.mjs.map +1 -0
  39. package/dist/{codecs-B1HgsJZ2.mjs → codecs-DZMfLjGe.mjs} +2 -2
  40. package/dist/codecs-DZMfLjGe.mjs.map +1 -0
  41. package/dist/{codecs-D8tLswBi-_nbo-Z8x.d.mts → codecs-bwX5JaME-ByuPNLC5.d.mts} +146 -86
  42. package/dist/codecs-bwX5JaME-ByuPNLC5.d.mts.map +1 -0
  43. package/dist/{codecs-DmCKO7dg.d.mts → codecs-ePpDWH7z.d.mts} +2 -2
  44. package/dist/codecs-ePpDWH7z.d.mts.map +1 -0
  45. package/dist/{column-types-BH-MU6uU.d.mts → column-types-CwjYfNCi.d.mts} +33 -7
  46. package/dist/column-types-CwjYfNCi.d.mts.map +1 -0
  47. package/dist/{column-types-Bh92dNjD.mjs → column-types-DU7C_gwa.mjs} +37 -9
  48. package/dist/column-types-DU7C_gwa.mjs.map +1 -0
  49. package/dist/{contract-free-aQ4nT-_R.mjs → contract-free-CzTZEwpt.mjs} +5 -5
  50. package/dist/contract-free-CzTZEwpt.mjs.map +1 -0
  51. package/dist/{control-Drq2rquV.mjs → control-BF220oqr.mjs} +82 -24
  52. package/dist/control-BF220oqr.mjs.map +1 -0
  53. package/dist/{control-2F195jJk.d.mts → control-ByalKcpe.d.mts} +2 -1
  54. package/dist/control-ByalKcpe.d.mts.map +1 -0
  55. package/dist/{control-Y6FxMu3o.mjs → control-DzK5mSLo.mjs} +3 -3
  56. package/dist/control-DzK5mSLo.mjs.map +1 -0
  57. package/dist/{control-adapter-DFr4gS-r-DM3KcZdQ.mjs → control-adapter-BM70RkWS-kIC873DD.mjs} +21 -10
  58. package/dist/control-adapter-BM70RkWS-kIC873DD.mjs.map +1 -0
  59. package/dist/{control-policy-B53lnBCT-B9K9Cj1x.mjs → control-policy-BN8Ouun3-BtGYeb4f.mjs} +7 -7
  60. package/dist/control-policy-BN8Ouun3-BtGYeb4f.mjs.map +1 -0
  61. package/dist/{control-DLTOAEHj.d.mts → control-xdW1bgaP.d.mts} +3 -3
  62. package/dist/{control-DLTOAEHj.d.mts.map → control-xdW1bgaP.d.mts.map} +1 -1
  63. package/dist/{ddl-CNQJds-C-WfZ3y4y8.mjs → ddl-GXbCrKp_-CBKFkq1r.mjs} +4 -4
  64. package/dist/{ddl-CNQJds-C-WfZ3y4y8.mjs.map → ddl-GXbCrKp_-CBKFkq1r.mjs.map} +1 -1
  65. package/dist/{descriptor-meta-rilAH3ep-dAmiVLpe.mjs → descriptor-meta-D41CePyY-B0L9RIgT.mjs} +7 -6
  66. package/dist/descriptor-meta-D41CePyY-B0L9RIgT.mjs.map +1 -0
  67. package/dist/{descriptor-meta-KVX21fsl-DBDoB4eg.mjs → descriptor-meta-zQNj82MZ-CDwEiYdj.mjs} +50 -21
  68. package/dist/descriptor-meta-zQNj82MZ-CDwEiYdj.mjs.map +1 -0
  69. package/dist/{diff-database-schema-DKq76rCk-uehceHYz.mjs → diff-database-schema-C9UxdmYu-BzQjQb1e.mjs} +6 -6
  70. package/dist/{diff-database-schema-DKq76rCk-uehceHYz.mjs.map → diff-database-schema-C9UxdmYu-BzQjQb1e.mjs.map} +1 -1
  71. package/dist/driver.d.mts +2 -2
  72. package/dist/driver.mjs +3 -2
  73. package/dist/driver__control.mjs +1 -1
  74. package/dist/driver__runtime.d.mts +2 -2
  75. package/dist/driver__runtime.mjs +2 -639
  76. package/dist/{errors-CU4xIwwk.d.mts → errors-5fMq0U66.d.mts} +2 -2
  77. package/dist/{errors-CU4xIwwk.d.mts.map → errors-5fMq0U66.d.mts.map} +1 -1
  78. package/dist/errors-DYyzTYzE-39CV_aMo.mjs +92 -0
  79. package/dist/errors-DYyzTYzE-39CV_aMo.mjs.map +1 -0
  80. package/dist/instant-now-generator-lJQqn_8K-JOzseqXI.d.mts +9 -0
  81. package/dist/instant-now-generator-lJQqn_8K-JOzseqXI.d.mts.map +1 -0
  82. package/dist/migration-PTHAY9Cv.mjs.map +1 -1
  83. package/dist/{op-factory-call-H6zeDGLe-_1pAftJk.mjs → op-factory-call-CSkQdszU-C43tr0rP.mjs} +7 -7
  84. package/dist/{op-factory-call-H6zeDGLe-_1pAftJk.mjs.map → op-factory-call-CSkQdszU-C43tr0rP.mjs.map} +1 -1
  85. package/dist/{pack-CySS3DQU.d.mts → pack-BByvVlUw.d.mts} +177 -13
  86. package/dist/pack-BByvVlUw.d.mts.map +1 -0
  87. package/dist/{planner-D0uogzvT-1WyGIC5p.mjs → planner-DtwSy6w3--x0IvtI9.mjs} +8 -8
  88. package/dist/{planner-D0uogzvT-1WyGIC5p.mjs.map → planner-DtwSy6w3--x0IvtI9.mjs.map} +1 -1
  89. package/dist/{planner-ddl-builders-Chxh-LEQ-DXvwOeeA.mjs → planner-ddl-builders-CsfmnnKR-CNn0fLyx.mjs} +5 -5
  90. package/dist/{planner-ddl-builders-Chxh-LEQ-DXvwOeeA.mjs.map → planner-ddl-builders-CsfmnnKR-CNn0fLyx.mjs.map} +1 -1
  91. package/dist/{planner-produced-postgres-migration-D5m8nK6s-CbZ4hlbv.mjs → planner-produced-postgres-migration-BResV739-meZQaWcU.mjs} +4 -4
  92. package/dist/{planner-produced-postgres-migration-D5m8nK6s-CbZ4hlbv.mjs.map → planner-produced-postgres-migration-BResV739-meZQaWcU.mjs.map} +1 -1
  93. package/dist/{planner-sql-checks-ftgzvIO9-BTtBg2Vz.mjs → planner-sql-checks-Bcngv5YZ-Dnp05hSM.mjs} +4 -4
  94. package/dist/{planner-sql-checks-ftgzvIO9-BTtBg2Vz.mjs.map → planner-sql-checks-Bcngv5YZ-Dnp05hSM.mjs.map} +1 -1
  95. package/dist/{postgres-contract-view-B8ykf2cO-T2LvWVFZ.mjs → postgres-contract-view-dWcpuV6T-CJPsHGox.mjs} +5 -5
  96. package/dist/{postgres-contract-view-B8ykf2cO-T2LvWVFZ.mjs.map → postgres-contract-view-dWcpuV6T-CJPsHGox.mjs.map} +1 -1
  97. package/dist/{postgres-migration-Dbq3RGfZ-aMnwfEAb.mjs → postgres-migration-DRKw86P7-C1eWF86n.mjs} +6 -6
  98. package/dist/{postgres-migration-Dbq3RGfZ-aMnwfEAb.mjs.map → postgres-migration-DRKw86P7-C1eWF86n.mjs.map} +1 -1
  99. package/dist/{postgres-schema-CF0yHESb-D7n2X21R.mjs → postgres-schema-B3t7Zr52-CMlY9aGw.mjs} +4 -4
  100. package/dist/{postgres-schema-CF0yHESb-D7n2X21R.mjs.map → postgres-schema-B3t7Zr52-CMlY9aGw.mjs.map} +1 -1
  101. package/dist/{render-ops-DOsRP0Po-BKn_c_Ia.mjs → render-ops-D2vJApKB-B281fzmn.mjs} +3 -3
  102. package/dist/{render-ops-DOsRP0Po-BKn_c_Ia.mjs.map → render-ops-D2vJApKB-B281fzmn.mjs.map} +1 -1
  103. package/dist/{resolve-ddl-schema-CoaeNP35-C-UZldpj.mjs → resolve-ddl-schema-Cab6g5MC-SRco-A7L.mjs} +3 -3
  104. package/dist/{resolve-ddl-schema-CoaeNP35-C-UZldpj.mjs.map → resolve-ddl-schema-Cab6g5MC-SRco-A7L.mjs.map} +1 -1
  105. package/dist/{runtime-DOXznQe0.d.mts → runtime-BdRKoWQu.d.mts} +2 -2
  106. package/dist/{runtime-DOXznQe0.d.mts.map → runtime-BdRKoWQu.d.mts.map} +1 -1
  107. package/dist/runtime-Di_BFzUC.mjs +685 -0
  108. package/dist/runtime-Di_BFzUC.mjs.map +1 -0
  109. package/dist/{runtime-lHBKgjB9.d.mts → runtime-DtoNQntj.d.mts} +3 -2
  110. package/dist/runtime-DtoNQntj.d.mts.map +1 -0
  111. package/dist/{runtime-_TfO66h5.d.mts → runtime-bbCw9Omq.d.mts} +2 -1
  112. package/dist/runtime-bbCw9Omq.d.mts.map +1 -0
  113. package/dist/{sql-renderer-BgC0ZgLS.d.mts → sql-renderer-Cshx9dNa.d.mts} +2 -2
  114. package/dist/{sql-renderer-BgC0ZgLS.d.mts.map → sql-renderer-Cshx9dNa.d.mts.map} +1 -1
  115. package/dist/{sql-renderer-ComgusFq-BBlqM1fw.mjs → sql-renderer-DMMtw8lD-K9zLsg-g.mjs} +8 -75
  116. package/dist/sql-renderer-DMMtw8lD-K9zLsg-g.mjs.map +1 -0
  117. package/dist/{sql-utils-DuzN3JZg-DiXy4Vah.mjs → sql-utils-6j9YTLpr-BCyCBPBg.mjs} +3 -3
  118. package/dist/{sql-utils-DuzN3JZg-DiXy4Vah.mjs.map → sql-utils-6j9YTLpr-BCyCBPBg.mjs.map} +1 -1
  119. package/dist/target.d.mts +14 -13
  120. package/dist/target.mjs +24 -23
  121. package/dist/target__aggregates.mjs +1 -1
  122. package/dist/target__codec-ids.d.mts +3 -3
  123. package/dist/target__codec-ids.mjs +2 -2
  124. package/dist/target__codec-types.d.mts +4 -4
  125. package/dist/target__codecs.d.mts +3 -3
  126. package/dist/target__codecs.mjs +3 -3
  127. package/dist/target__contract-free.mjs +3 -3
  128. package/dist/target__control.d.mts +3 -2
  129. package/dist/target__control.mjs +3 -2
  130. package/dist/target__diff-database-schema.mjs +1 -1
  131. package/dist/target__errors.d.mts +1 -1
  132. package/dist/target__errors.mjs +1 -1
  133. package/dist/target__issue-planner.mjs +1 -1
  134. package/dist/target__migration.mjs +2 -2
  135. package/dist/target__op-factory-call.mjs +1 -1
  136. package/dist/target__pack.d.mts +1 -1
  137. package/dist/target__pack.mjs +1 -1
  138. package/dist/target__planner-ddl-builders.mjs +1 -1
  139. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  140. package/dist/target__planner-sql-checks.mjs +1 -1
  141. package/dist/target__planner.mjs +2 -2
  142. package/dist/target__render-ops.mjs +1 -1
  143. package/dist/target__runtime.d.mts +3 -2
  144. package/dist/target__runtime.mjs +3 -2
  145. package/dist/target__runtime.mjs.map +1 -1
  146. package/dist/target__schema-ir-annotations.mjs +1 -1
  147. package/dist/target__sql-utils.mjs +1 -1
  148. package/dist/target__types.d.mts +2 -2
  149. package/dist/target__types.mjs +2 -2
  150. package/dist/{types-CjGjPLr5.d.mts → types-B4IkFolc.d.mts} +2 -2
  151. package/dist/{types-CjGjPLr5.d.mts.map → types-B4IkFolc.d.mts.map} +1 -1
  152. package/dist/types-C7BEZmFD.d.mts +1 -0
  153. package/dist/{types-CkryN1AS-BcQRGsDn.d.mts → types-CkryN1AS-CZtzRJFZ.d.mts} +2 -2
  154. package/dist/{types-CkryN1AS-BcQRGsDn.d.mts.map → types-CkryN1AS-CZtzRJFZ.d.mts.map} +1 -1
  155. package/package.json +13 -12
  156. package/dist/aggregates-Dh6HPdvC.mjs.map +0 -1
  157. package/dist/authoring-BOpdZa2N-ClrLFiXw.mjs.map +0 -1
  158. package/dist/check-expressions-5vhxWaFy-CBcjFeur.mjs.map +0 -1
  159. package/dist/check-expressions-DRgG8RN5-DiA-22aC.d.mts.map +0 -1
  160. package/dist/codec-ids-Bqu_IwO0-DKOdPizQ.d.mts +0 -35
  161. package/dist/codec-ids-Bqu_IwO0-DKOdPizQ.d.mts.map +0 -1
  162. package/dist/codec-ids-C5Rkltkw-DMf87l9s.mjs +0 -35
  163. package/dist/codec-ids-C5Rkltkw-DMf87l9s.mjs.map +0 -1
  164. package/dist/codec-ids-DJ6j6pZc.d.mts +0 -1
  165. package/dist/codec-types-BRU4F-7t-BaJbKF_i.d.mts.map +0 -1
  166. package/dist/codec-types-bX63JRLf.d.mts +0 -2
  167. package/dist/codecs-B1HgsJZ2.mjs.map +0 -1
  168. package/dist/codecs-BmPCJWqb-DveZGJvm.mjs.map +0 -1
  169. package/dist/codecs-D8tLswBi-_nbo-Z8x.d.mts.map +0 -1
  170. package/dist/codecs-DmCKO7dg.d.mts.map +0 -1
  171. package/dist/column-types-BH-MU6uU.d.mts.map +0 -1
  172. package/dist/column-types-Bh92dNjD.mjs.map +0 -1
  173. package/dist/contract-free-aQ4nT-_R.mjs.map +0 -1
  174. package/dist/control-2F195jJk.d.mts.map +0 -1
  175. package/dist/control-Drq2rquV.mjs.map +0 -1
  176. package/dist/control-Y6FxMu3o.mjs.map +0 -1
  177. package/dist/control-adapter-DFr4gS-r-DM3KcZdQ.mjs.map +0 -1
  178. package/dist/control-policy-B53lnBCT-B9K9Cj1x.mjs.map +0 -1
  179. package/dist/descriptor-meta-KVX21fsl-DBDoB4eg.mjs.map +0 -1
  180. package/dist/descriptor-meta-rilAH3ep-dAmiVLpe.mjs.map +0 -1
  181. package/dist/driver__runtime.mjs.map +0 -1
  182. package/dist/errors-DKjQzNaN-DFcF1thx.mjs +0 -39
  183. package/dist/errors-DKjQzNaN-DFcF1thx.mjs.map +0 -1
  184. package/dist/pack-CySS3DQU.d.mts.map +0 -1
  185. package/dist/runtime-_TfO66h5.d.mts.map +0 -1
  186. package/dist/runtime-lHBKgjB9.d.mts.map +0 -1
  187. package/dist/sql-renderer-ComgusFq-BBlqM1fw.mjs.map +0 -1
  188. package/dist/types-B-4d5_4a.d.mts +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"control-policy-B53lnBCT-B9K9Cj1x.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/control-policy-B53lnBCT.mjs"],"sourcesContent":["import { r as isPostgresSchema } from \"./postgres-schema-CF0yHESb.mjs\";\nimport { n as PostgresNativeEnumSchemaNode, o as postgresNodeEntityKind, r as PostgresSchemaNodeKind, t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-BBkitBQh.mjs\";\nimport { C as DropNativeEnumTypeCall, D as EnableRowLevelSecurityCall, E as DropTableCall, F as buildTargetDetails, M as SetDefaultCall, N as SetNotNullCall, O as RawSqlCall, P as postgresDefaultToDdlColumnDefault, S as DropIndexCall, _ as DisableRowLevelSecurityCall, a as AddNotNullColumnDirectCall, b as DropConstraintCall, c as AddUniqueCall, d as CreateIndexCall, f as CreateNativeEnumTypeCall, g as DataTransformCall, h as CreateTableCall, i as AddNativeEnumValueCall, l as AlterColumnTypeCall, m as CreateSchemaCall, n as AddColumnCall, o as AddNotNullColumnWithTempDefaultCall, r as AddForeignKeyCall, s as AddPrimaryKeyCall, t as AddCheckConstraintCall, v as DropCheckConstraintCall, w as DropNotNullCall, x as DropDefaultCall, y as DropColumnCall } from \"./op-factory-call-H6zeDGLe.mjs\";\nimport { t as buildExpectedFormatType } from \"./planner-sql-checks-ftgzvIO9.mjs\";\nimport { n as buildColumnTypeSql, t as buildColumnDefaultSql } from \"./planner-ddl-builders-Chxh-LEQ.mjs\";\nimport { n as resolveIdentityValue } from \"./planner-identity-values-BmHn5C6U.mjs\";\nimport { i as hasUniqueConstraint, n as hasForeignKey, t as buildSchemaLookupMap } from \"./planner-schema-lookup-kMIVP2y-.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { UNBOUND_NAMESPACE_ID, entityAt } from \"@internal/framework-components/ir\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport * as contractFree from \"@internal/sql-relational-core/contract-free\";\nimport { RelationalSchemaNodeKind, SqlSchemaIR } from \"@internal/sql-schema-ir/types\";\nimport { issueOutcome, orderIssuesByDependencies } from \"@internal/framework-components/control\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/core/schema-ir/node-storage-coordinate.ts\n/**\n* The storage-`entries` coordinate `(entityKind, entityName)` a Postgres diff\n* node addresses — a table by its name, a native enum by its physical type\n* name. `undefined` for a node that is not a whole storage entity (a namespace,\n* a column, a policy). Lets ownership/subject resolution treat every entity kind\n* uniformly, the node self-describing its storage identity.\n*/\nfunction postgresNodeStorageCoordinate(node) {\n\tif (PostgresTableSchemaNode.is(node)) {\n\t\tconst entityKind = postgresNodeEntityKind(node.nodeKind);\n\t\treturn entityKind === void 0 ? void 0 : {\n\t\t\tentityKind,\n\t\t\tentityName: node.name\n\t\t};\n\t}\n\tif (PostgresNativeEnumSchemaNode.is(node)) {\n\t\tconst entityKind = postgresNodeEntityKind(node.nodeKind);\n\t\treturn entityKind === void 0 ? void 0 : {\n\t\t\tentityKind,\n\t\t\tentityName: node.typeName\n\t\t};\n\t}\n}\n//#endregion\n//#region src/core/migrations/column-ddl-rendering.ts\n/**\n* Reconstructs the `StorageColumn`-shaped fields the DDL builder functions\n* (`buildColumnTypeSql`, `buildExpectedFormatType`, `resolveIdentityValue`)\n* expect, from a column node's own stamped codec identity (`codecRef` /\n* `codecBaseNativeType` / `codecNamedType`, Decision 5) — never the\n* contract. The builders were written against `StorageColumn` and are\n* unchanged here; only the shape feeding them moves from the contract to\n* the node. An empty `storageTypes` catalog is passed alongside: the\n* node's fields are already resolved past any `typeRef` indirection, so no\n* live lookup is needed, and passing a non-empty catalog would risk a\n* false `typeRef` hit against an unrelated storage type.\n*/\nfunction columnLike(column) {\n\tif (column.codecRef === void 0 || column.codecBaseNativeType === void 0) throw new InternalError(`columnLike: expected column \"${column.name}\" carries no codec identity — the expected tree must be derived via contractToSchemaIR for planning`);\n\treturn {\n\t\tnativeType: column.codecBaseNativeType,\n\t\tcodecId: column.codecRef.codecId,\n\t\tnullable: column.nullable,\n\t\t...ifDefined(\"many\", column.many ?? column.codecRef.many),\n\t\t...ifDefined(\"typeParams\", column.codecRef.typeParams !== void 0 ? blindCast(column.codecRef.typeParams) : void 0),\n\t\t...column.codecNamedType ? { typeRef: \"<resolved>\" } : {},\n\t\t...ifDefined(\"default\", column.resolvedDefault)\n\t};\n}\n/**\n* Builds the `CREATE TABLE` / `ADD COLUMN` DDL column for an expected column\n* node, resolving type rendering from the node's codec identity against the\n* codec hooks the caller holds — the same builder the pre-`plan(start, end)`\n* op-path called, so the output is byte-identical.\n*/\nfunction renderColumnDdl(name, column, codecHooks) {\n\tconst like = columnLike(column);\n\tconst typeSql = buildColumnTypeSql(like, codecHooks, {});\n\tconst ddlDefault = postgresDefaultToDdlColumnDefault(like.default);\n\treturn contractFree.col(name, typeSql, {\n\t\t...!column.nullable ? { notNull: true } : {},\n\t\t...ifDefined(\"default\", ddlDefault),\n\t\t...ifDefined(\"codecRef\", column.codecRef)\n\t});\n}\n/**\n* Builds the `ALTER COLUMN … TYPE` operands for an expected column node.\n*/\nfunction renderColumnAlterType(column, codecHooks) {\n\tconst like = columnLike(column);\n\treturn {\n\t\tqualifiedTargetType: buildColumnTypeSql(like, codecHooks, {}, false),\n\t\tformatTypeExpected: buildExpectedFormatType(like, codecHooks, {})\n\t};\n}\n/**\n* Resolves the identity value (monoid neutral element) SQL literal used as\n* the temporary default when adding a NOT-NULL column with no contract\n* default (`notNullAddColumnCallStrategy`'s shared-temp-default backfill).\n* `null` when the column's type has no built-in/codec-provided identity\n* value.\n*/\nfunction resolveColumnTemporaryDefault(column, codecHooks) {\n\treturn resolveIdentityValue(columnLike(column), codecHooks, {});\n}\n/**\n* The column's `SET DEFAULT` clause SQL, resolved from a column-default\n* diff node. `''` when the node carries no resolved default.\n*/\nfunction renderColumnDefaultSql(defaultNode) {\n\tif (defaultNode.resolved === void 0) return \"\";\n\treturn buildColumnDefaultSql(defaultNode.resolved, {\n\t\tnativeType: defaultNode.nativeTypeContext ?? \"\",\n\t\t...ifDefined(\"many\", defaultNode.many)\n\t});\n}\n//#endregion\n//#region src/core/migrations/planner-strategies.ts\n/**\n* Look up a storage table by its explicit namespace coordinate. Returns\n* `undefined` when the namespace has no table by that name (or no such\n* namespace exists). Callers that get `undefined` MUST treat it as an\n* explicit conflict — never silently fall back to a global default\n* schema or a name-only walk, because that footgun would resolve a\n* stale or duplicate table name to whichever namespace the iteration\n* order surfaced first (a real data-loss hazard in multi-namespace\n* contracts where two namespaces can carry the same table name).\n*/\nfunction tableAt(storage, namespaceId, tableName) {\n\tconst ns = storage.namespaces[namespaceId];\n\tif (ns === void 0) return void 0;\n\treturn ns.entries.table?.[tableName];\n}\n/**\n* Recovers the contract namespace id for a DDL schema name embedded in a\n* diff-issue path (`path[1]`). The strategies need the CONTRACT column/table\n* (for codec-hook reads and eligibility probes the retained subsystems still\n* run) even though the issue itself only carries the resolved DDL schema —\n* this is the reverse of `resolveDdlSchemaForNamespace`.\n*/\nfunction namespaceIdForDdlSchema(ctx, ddlSchemaName) {\n\treturn resolveNamespaceIdForDdlSchema(ctx.toContract, ddlSchemaName);\n}\n/** A `not-equal` column issue whose node pair is narrowed to `SqlColumnIR`. */\nfunction columnNodePair(issue) {\n\tconst node = issueNode(issue);\n\tif (node === void 0 || node.nodeKind !== RelationalSchemaNodeKind.column) return void 0;\n\tif (issue.expected === void 0 || issue.actual === void 0) return void 0;\n\treturn {\n\t\texpected: blindCast(issue.expected),\n\t\tactual: blindCast(issue.actual)\n\t};\n}\nconst notNullBackfillCallStrategy = (issues, ctx) => {\n\tif (!ctx.policy.allowedOperationClasses.includes(\"data\")) return { kind: \"no_match\" };\n\tconst matched = [];\n\tconst calls = [];\n\tfor (const issue of issues) {\n\t\tif (issueOutcome(issue) !== \"not-found\") continue;\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0 || node.nodeKind !== RelationalSchemaNodeKind.column) continue;\n\t\tconst expected = blindCast(issue.expected);\n\t\tif (expected.nullable !== false || expected.resolvedDefault !== void 0) continue;\n\t\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tconst tableName = issueTableName(issue);\n\t\tif (ddlSchemaName === void 0 || tableName === void 0) continue;\n\t\tconst schemaName = emissionSchemaName(ctx, ddlSchemaName);\n\t\tmatched.push(issue);\n\t\tconst ddl = renderColumnDdl(expected.name, expected, ctx.codecHooks);\n\t\tconst nullableSpec = contractFree.col(ddl.name, ddl.type, { ...ddl.codecRef !== void 0 ? { codecRef: ddl.codecRef } : {} });\n\t\tcalls.push(new AddColumnCall(schemaName, tableName, nullableSpec), new DataTransformCall(`backfill-${tableName}-${expected.name}`, `backfill-${tableName}-${expected.name}:check`, `backfill-${tableName}-${expected.name}:run`), new SetNotNullCall(schemaName, tableName, expected.name));\n\t}\n\tif (matched.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues: issues.filter((i) => !matched.includes(i)),\n\t\tcalls,\n\t\trecipe: true\n\t};\n};\nconst SAFE_WIDENINGS = /* @__PURE__ */ new Set([\n\t\"int2→int4\",\n\t\"int2→int8\",\n\t\"int4→int8\",\n\t\"float4→float8\"\n]);\n/**\n* Handles `not-equal` column issues whose TYPE differs. `fromContract` is\n* only supplied by `migration plan` — for reconciliation (`db update` /\n* `db init`, `fromContract === null`) this strategy never fires, mirroring\n* the legacy `typeChangeCallStrategy`'s requirement of a prior contract:\n* `mapNodeIssueToCall`'s in-place ALTER covers reconciliation directly.\n*\n* A single node issue can carry BOTH type and nullability drift (Postgres\n* alters in place, so the differ emits one `not-equal` column issue where\n* the legacy coordinate walk emitted two: `type_mismatch` +\n* `nullability_mismatch`). When this strategy consumes the issue for its\n* type portion, it also emits whatever nullability delta the same node pair\n* carries — using the same construction `nullableTighteningCallStrategy` /\n* the mapper's direct dispatch would have used — so the issue is never\n* partially handled.\n*/\nconst typeChangeCallStrategy = (issues, ctx) => {\n\tif (ctx.fromContract === null) return { kind: \"no_match\" };\n\tconst dataAllowed = ctx.policy.allowedOperationClasses.includes(\"data\");\n\tconst matched = [];\n\tconst calls = [];\n\tfor (const issue of issues) {\n\t\tif (issueOutcome(issue) !== \"not-equal\") continue;\n\t\tconst pair = columnNodePair(issue);\n\t\tif (pair === void 0) continue;\n\t\tconst { expected, actual } = pair;\n\t\tif (!columnTypeChangedNativeOnly(expected, actual)) continue;\n\t\tconst fromType = actual.nativeType;\n\t\tconst toType = expected.nativeType;\n\t\tconst isSafeWidening = SAFE_WIDENINGS.has(`${fromType}→${toType}`);\n\t\tif (!isSafeWidening && !dataAllowed) continue;\n\t\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tconst tableName = issueTableName(issue);\n\t\tif (ddlSchemaName === void 0 || tableName === void 0) continue;\n\t\tconst schemaName = emissionSchemaName(ctx, ddlSchemaName);\n\t\tmatched.push(issue);\n\t\tconst { qualifiedTargetType, formatTypeExpected } = renderColumnAlterType(expected, ctx.codecHooks);\n\t\tconst alterOpts = {\n\t\t\tqualifiedTargetType,\n\t\t\tformatTypeExpected,\n\t\t\trawTargetTypeForLabel: qualifiedTargetType\n\t\t};\n\t\tif (isSafeWidening) calls.push(new AlterColumnTypeCall(schemaName, tableName, expected.name, alterOpts));\n\t\telse calls.push(new DataTransformCall(`typechange-${tableName}-${expected.name}`, `typechange-${tableName}-${expected.name}:check`, `typechange-${tableName}-${expected.name}:run`), new AlterColumnTypeCall(schemaName, tableName, expected.name, alterOpts));\n\t\tif (expected.nullable !== actual.nullable) if (expected.nullable) calls.push(new DropNotNullCall(schemaName, tableName, expected.name));\n\t\telse if (dataAllowed) calls.push(new DataTransformCall(`handle-nulls-${tableName}-${expected.name}`, `handle-nulls-${tableName}-${expected.name}:check`, `handle-nulls-${tableName}-${expected.name}:run`), new SetNotNullCall(schemaName, tableName, expected.name));\n\t\telse calls.push(new SetNotNullCall(schemaName, tableName, expected.name));\n\t}\n\tif (matched.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues: issues.filter((i) => !matched.includes(i)),\n\t\tcalls,\n\t\trecipe: true\n\t};\n};\n/**\n* Whether the raw (unresolved) native type differs — the SAME comparison\n* `typeChangeCallStrategy` always used (`fromColumn.nativeType !==\n* toColumn.nativeType`), which for the widenable numeric/float types\n* `SAFE_WIDENINGS` lists is identical to the resolved comparison\n* `columnTypeChanged` (in `issue-planner.ts`) performs.\n*/\nfunction columnTypeChangedNativeOnly(expected, actual) {\n\treturn expected.nativeType !== actual.nativeType;\n}\n/**\n* Handles `not-equal` column issues whose type did NOT change but\n* nullability tightened (contract requires NOT NULL, live column is\n* nullable). A type-changed issue's nullability delta (if any) is already\n* handled by `typeChangeCallStrategy`, which runs first — this strategy\n* only ever sees issues that strategy left behind.\n*/\nconst nullableTighteningCallStrategy = (issues, ctx) => {\n\tif (!ctx.policy.allowedOperationClasses.includes(\"data\")) return { kind: \"no_match\" };\n\tconst matched = [];\n\tconst calls = [];\n\tfor (const issue of issues) {\n\t\tif (issueOutcome(issue) !== \"not-equal\") continue;\n\t\tconst pair = columnNodePair(issue);\n\t\tif (pair === void 0) continue;\n\t\tconst { expected, actual } = pair;\n\t\tif (columnTypeChangedNativeOnly(expected, actual)) continue;\n\t\tif (expected.nullable !== false || actual.nullable !== true) continue;\n\t\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tconst tableName = issueTableName(issue);\n\t\tif (ddlSchemaName === void 0 || tableName === void 0) continue;\n\t\tconst schemaName = emissionSchemaName(ctx, ddlSchemaName);\n\t\tmatched.push(issue);\n\t\tcalls.push(new DataTransformCall(`handle-nulls-${tableName}-${expected.name}`, `handle-nulls-${tableName}-${expected.name}:check`, `handle-nulls-${tableName}-${expected.name}:run`), new SetNotNullCall(schemaName, tableName, expected.name));\n\t}\n\tif (matched.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues: issues.filter((i) => !matched.includes(i)),\n\t\tcalls,\n\t\trecipe: true\n\t};\n};\n/**\n* Dispatches codec-typed storage types through their codec's\n* `planTypeOperations` hook (the authoritative source for codec-driven DDL\n* such as custom type creation). Codec extension/type ops are not modeled as\n* diff nodes — this strategy drives entirely off `ctx.toContract.storage.types`\n* + codec hooks, consuming nothing from the node issue list (there is no\n* node-vocabulary equivalent of `type_missing` / `enum_values_changed`).\n*/\nconst storageTypePlanCallStrategy = (issues, ctx) => {\n\tconst storageTypes = ctx.toContract.storage.types ?? {};\n\tif (Object.keys(storageTypes).length === 0) return { kind: \"no_match\" };\n\tconst calls = [];\n\tfor (const [typeName, typeInstance] of Object.entries(storageTypes).sort(([a], [b]) => a.localeCompare(b))) {\n\t\tconst codecInstance = typeInstance;\n\t\tconst hook = ctx.codecHooks.get(codecInstance.codecId);\n\t\tif (!hook?.planTypeOperations) continue;\n\t\tconst planResult = hook.planTypeOperations({\n\t\t\ttypeName,\n\t\t\ttypeInstance: codecInstance,\n\t\t\tcontract: ctx.toContract,\n\t\t\tschema: ctx.schema,\n\t\t\tschemaName: ctx.schemaName,\n\t\t\tpolicy: ctx.policy\n\t\t});\n\t\tif (!planResult) continue;\n\t\tfor (const op of planResult.operations) calls.push(new RawSqlCall({\n\t\t\t...op,\n\t\t\ttarget: {\n\t\t\t\tid: op.target.id,\n\t\t\t\tdetails: buildTargetDetails(\"type\", typeName, ctx.schemaName)\n\t\t\t}\n\t\t}));\n\t}\n\tif (calls.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues,\n\t\tcalls\n\t};\n};\n/**\n* Handles `not-found` column issues for NOT NULL columns without a contract\n* default. Replaces the legacy `buildAddColumnItem` non-default branches.\n*\n* Two shapes:\n* - Shared-temp-default safe: emit a single atomic composite op (add\n* nullable → backfill identity value → `SET NOT NULL` → `DROP DEFAULT`).\n* The temp-default value is resolved from the column node's `codecRef`\n* (`resolveColumnTemporaryDefault`, wrapping `resolveIdentityValue`).\n* - Empty-table guarded: emit a hand-built op with a `tableIsEmptyCheck`\n* precheck so the failure message is \"table is not empty\" rather than the\n* raw PG NOT NULL violation.\n*\n* \"Normal\" not-found column cases (nullable or has a contract default) are\n* left for `mapNodeIssueToCall`'s default `AddColumnCall` emission.\n*/\nconst notNullAddColumnCallStrategy = (issues, ctx) => {\n\tconst matched = [];\n\tconst calls = [];\n\tconst schemaLookups = buildSchemaLookupMap(ctx.schema);\n\tconst mutableCodecHooks = ctx.codecHooks;\n\tconst mutableStorageTypes = ctx.storageTypes;\n\tfor (const issue of issues) {\n\t\tif (issueOutcome(issue) !== \"not-found\") continue;\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0 || node.nodeKind !== RelationalSchemaNodeKind.column) continue;\n\t\tconst expected = blindCast(issue.expected);\n\t\tif (expected.nullable !== false || expected.resolvedDefault !== void 0) continue;\n\t\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tconst tableName = issueTableName(issue);\n\t\tif (ddlSchemaName === void 0 || tableName === void 0) continue;\n\t\tconst namespaceId = namespaceIdForDdlSchema(ctx, ddlSchemaName);\n\t\tconst schemaName = namespaceId === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchemaName;\n\t\tconst contractTable = tableAt(ctx.toContract.storage, namespaceId, tableName);\n\t\tconst column = contractTable?.columns[expected.name];\n\t\tif (!contractTable || !column) continue;\n\t\tconst schemaTable = ctx.schema.tables[tableName];\n\t\tif (!schemaTable) continue;\n\t\tconst temporaryDefault = resolveColumnTemporaryDefault(expected, ctx.codecHooks);\n\t\tconst schemaLookup = schemaLookups.get(tableName);\n\t\tconst canUseSharedTempDefault = temporaryDefault !== null && canUseSharedTemporaryDefaultStrategy({\n\t\t\ttable: contractTable,\n\t\t\tschemaTable,\n\t\t\tschemaLookup,\n\t\t\tcolumnName: expected.name\n\t\t});\n\t\tmatched.push(issue);\n\t\tif (canUseSharedTempDefault && temporaryDefault !== null) {\n\t\t\tcalls.push(new AddNotNullColumnWithTempDefaultCall({\n\t\t\t\tschemaName,\n\t\t\t\ttableName,\n\t\t\t\tcolumnName: expected.name,\n\t\t\t\tcolumn,\n\t\t\t\tcodecHooks: mutableCodecHooks,\n\t\t\t\tstorageTypes: mutableStorageTypes,\n\t\t\t\ttemporaryDefault\n\t\t\t}));\n\t\t\tcontinue;\n\t\t}\n\t\tcalls.push(new AddNotNullColumnDirectCall(schemaName, tableName, expected.name, renderColumnDdl(expected.name, expected, ctx.codecHooks)));\n\t}\n\tif (matched.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues: issues.filter((i) => !matched.includes(i)),\n\t\tcalls\n\t};\n};\nfunction canUseSharedTemporaryDefaultStrategy(options) {\n\tconst { table, schemaTable, schemaLookup, columnName } = options;\n\tif (table.primaryKey?.columns.includes(columnName) && !schemaTable.primaryKey) return false;\n\tfor (const unique of table.uniques) {\n\t\tif (!unique.columns.includes(columnName)) continue;\n\t\tif (!schemaLookup || !hasUniqueConstraint(schemaLookup, unique.columns)) return false;\n\t}\n\tfor (const foreignKey of table.foreignKeys) {\n\t\tif (!foreignKey.source.columns.includes(columnName)) continue;\n\t\tif (!schemaLookup || !hasForeignKey(schemaLookup, foreignKey)) return false;\n\t}\n\treturn true;\n}\n/**\n* Ordered list of Postgres planner strategies, shared by `migration plan`\n* and `db update` / `db init`. The issue planner runs each strategy in\n* order, letting it consume any issues it handles, and routes whatever's\n* left through `mapNodeIssueToCall`. Behavior diverges purely on\n* `policy.allowedOperationClasses`:\n*\n* - When `'data'` is allowed (`migration plan`), the data-safe strategies\n* (`notNullBackfillCallStrategy`, `typeChangeCallStrategy`,\n* `nullableTighteningCallStrategy`) consume their matching issues and emit\n* `DataTransformCall` placeholders or recipe ops.\n*\n* - When `'data'` is not allowed (`db update` / `db init`), the\n* placeholder-emitting strategies short-circuit to `no_match`, leaving\n* the issue for the downstream strategies (`storageTypePlanCallStrategy`,\n* `notNullAddColumnCallStrategy`) or the `mapNodeIssueToCall` default to\n* handle with direct DDL.\n*\n* Codec-typed storage type entries are dispatched through\n* `storageTypePlanCallStrategy`.\n*/\nconst postgresPlannerStrategies = [\n\tnotNullBackfillCallStrategy,\n\ttypeChangeCallStrategy,\n\tnullableTighteningCallStrategy,\n\tstorageTypePlanCallStrategy,\n\tnotNullAddColumnCallStrategy\n];\n//#endregion\n//#region src/core/migrations/issue-planner.ts\nfunction issueConflict(kind, summary, location) {\n\treturn {\n\t\tkind,\n\t\tsummary,\n\t\twhy: \"Use `migration new` to author a custom migration for this change.\",\n\t\t...location ? { location } : {}\n\t};\n}\n/**\n* Classifies calls into DDL sequencing buckets. The order matches the\n* legacy walk-schema planner's emission order so `db init` and `db update`\n* produce byte-identical plans for the shared shape (deps → drops → tables\n* → columns → alters → PKs → uniques → indexes → FKs).\n*\n* `dropType` (DROP TYPE for a managed native enum) is its own bucket, ordered\n* after the general drop bucket: a type can only be dropped once every table\n* whose column uses it is gone. A column→enum edge would make this precise,\n* but `coalesceSubtreeIssues` removes the column issue under a whole-table\n* drop, so the edge never reaches the graph; the coarse bucket stands in until\n* that edge lands (the coordinate work is a later slice).\n*/\nfunction classifyCall(call) {\n\tswitch (call.factoryName) {\n\t\tcase \"createExtension\":\n\t\tcase \"createSchema\":\n\t\tcase \"createNativeEnumType\":\n\t\tcase \"addNativeEnumValue\": return \"dep\";\n\t\tcase \"dropNativeEnumType\": return \"dropType\";\n\t\tcase \"dropTable\":\n\t\tcase \"dropColumn\":\n\t\tcase \"dropConstraint\":\n\t\tcase \"dropCheckConstraint\":\n\t\tcase \"dropIndex\":\n\t\tcase \"dropDefault\": return \"drop\";\n\t\tcase \"addCheckConstraint\":\n\t\tcase \"renameCheckConstraint\": return \"unique\";\n\t\tcase \"createTable\": return \"table\";\n\t\tcase \"enableRowLevelSecurity\":\n\t\tcase \"disableRowLevelSecurity\": return \"rlsEnable\";\n\t\tcase \"createRlsPolicy\": return \"rlsPolicy\";\n\t\tcase \"dropRlsPolicy\": return \"drop\";\n\t\tcase \"addColumn\": return \"column\";\n\t\tcase \"alterColumnType\":\n\t\tcase \"setNotNull\":\n\t\tcase \"dropNotNull\":\n\t\tcase \"setDefault\": return \"alter\";\n\t\tcase \"addPrimaryKey\": return \"primaryKey\";\n\t\tcase \"addUnique\": return \"unique\";\n\t\tcase \"createIndex\":\n\t\tcase \"renameIndex\": return \"index\";\n\t\tcase \"addForeignKey\": return \"foreignKey\";\n\t\tcase \"rawSql\":\n\t\t\tif (call.op?.target?.details?.objectType === \"type\") return \"dep\";\n\t\t\treturn \"alter\";\n\t\tdefault: return \"alter\";\n\t}\n}\nconst DEFAULT_POLICY = { allowedOperationClasses: [\n\t\"additive\",\n\t\"widening\",\n\t\"destructive\",\n\t\"data\"\n] };\nfunction emptySchemaIR() {\n\treturn new SqlSchemaIR({ tables: {} });\n}\nfunction conflictKindForCall(call) {\n\tswitch (call.factoryName) {\n\t\tcase \"alterColumnType\": return \"typeMismatch\";\n\t\tcase \"setNotNull\":\n\t\tcase \"dropNotNull\": return \"nullabilityConflict\";\n\t\tcase \"addForeignKey\":\n\t\tcase \"dropConstraint\": return \"foreignKeyConflict\";\n\t\tcase \"createIndex\":\n\t\tcase \"renameIndex\":\n\t\tcase \"dropIndex\": return \"indexIncompatible\";\n\t\tcase \"createRlsPolicy\":\n\t\tcase \"dropRlsPolicy\":\n\t\tcase \"renameRlsPolicy\": return \"rlsPolicyIncompatible\";\n\t\tdefault: return \"missingButNonAdditive\";\n\t}\n}\nfunction locationForCall(call) {\n\tconst anyCall = call;\n\tconst location = {};\n\tif (anyCall.tableName) {\n\t\tlocation.entityKind = \"table\";\n\t\tlocation.entityName = anyCall.tableName;\n\t} else if (anyCall.typeName) {\n\t\tlocation.entityKind = \"native_enum\";\n\t\tlocation.entityName = anyCall.typeName;\n\t}\n\tif (anyCall.columnName) location.column = anyCall.columnName;\n\tif (anyCall.indexName) location.index = anyCall.indexName;\n\telse if (anyCall.newIndexName) location.index = anyCall.newIndexName;\n\tif (anyCall.constraintName) location.constraint = anyCall.constraintName;\n\telse if (anyCall.newConstraintName) location.constraint = anyCall.newConstraintName;\n\tif (anyCall.policyName) location.rlsPolicy = anyCall.policyName;\n\telse if (anyCall.policy?.name) location.rlsPolicy = anyCall.policy.name;\n\telse if (anyCall.newPolicyName) location.rlsPolicy = anyCall.newPolicyName;\n\treturn Object.keys(location).length > 0 ? location : void 0;\n}\nfunction conflictForDisallowedCall(call, allowed) {\n\tconst summary = `Operation \"${call.label}\" requires class \"${call.operationClass}\", but policy allows only: ${allowed.join(\", \")}`;\n\tconst location = locationForCall(call);\n\treturn {\n\t\tkind: conflictKindForCall(call),\n\t\tsummary,\n\t\twhy: \"Use `migration new` to author a custom migration for this change.\",\n\t\t...location ? { location } : {}\n\t};\n}\n/** The diff node an issue concerns — expected when present, else the actual (extra) node. */\nfunction issueNode(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\treturn blindCast(node);\n}\n/** DDL schema segment of a table-or-descendant issue path: `[database, ddlSchema, table, …]`. */\nfunction issueSchemaName(issue) {\n\treturn issue.path[1];\n}\n/** Table segment of a table-or-descendant issue path: `[database, ddlSchema, table, …]`. */\nfunction issueTableName(issue) {\n\treturn issue.path[2];\n}\n/** Column name embedded in a column/default issue path segment (`column:<name>`). */\nfunction issueColumnName(issue) {\n\tconst segment = issue.path[3];\n\tif (segment === void 0 || !segment.startsWith(\"column:\")) return void 0;\n\treturn segment.slice(7);\n}\n/**\n* The DDL schema name to use when EMITTING an op against `ddlSchemaName` (the\n* diff tree's resolved physical schema, `issueSchemaName(issue)`). The\n* unbound namespace's diff-tree identity resolves to `public` (a concrete\n* physical default the differ needs in order to compare its tree against\n* introspection — `resolveDdlSchemaForNamespaceStorage`), but DDL EMISSION\n* must stay unqualified so the live connection's `search_path` resolves it\n* at runtime (`boundSchema`). Recovers the logical namespace id via the\n* contract and substitutes the unbound sentinel back in when it resolves\n* there; every other namespace's `ddlSchemaName` already agrees between the\n* two resolution paths, so it passes through unchanged.\n*/\nfunction emissionSchemaName(ctx, ddlSchemaName) {\n\treturn resolveNamespaceIdForDdlSchema(ctx.toContract, ddlSchemaName) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchemaName;\n}\n/** Whether the expected/actual native type (resolved, or raw+many fallback) differs — mirrors `SqlColumnIR.isEqualTo`'s type comparison. */\nfunction columnTypeChanged(expected, actual) {\n\tif (expected.resolvedNativeType !== void 0 && actual.resolvedNativeType !== void 0) return expected.resolvedNativeType !== actual.resolvedNativeType;\n\treturn expected.nativeType !== actual.nativeType || Boolean(expected.many) !== Boolean(actual.many);\n}\n/**\n* The generic differ is total: a missing/extra table (or column) emits an\n* issue for itself AND for every node in its subtree. `CreateTable`/`DropTable`\n* and `AddColumn`/`DropColumn` already account for the whole subtree, so the\n* nested issues are redundant — coalescing drops any issue whose path is a\n* strict descendant of a `not-found`/`not-expected` issue's path. Run over the\n* relational subset ONLY (policy issues and synthesized namespace issues are\n* handled on their own paths, never coalesced against tables).\n*/\nfunction coalesceSubtreeIssues(issues) {\n\tconst collapsingPaths = issues.filter((issue) => issueOutcome(issue) !== \"not-equal\").map((issue) => issue.path);\n\tif (collapsingPaths.length === 0) return issues;\n\treturn issues.filter((issue) => !collapsingPaths.some((ancestor) => isStrictDescendantPath(issue.path, ancestor)));\n}\nfunction isStrictDescendantPath(path, ancestor) {\n\tif (path.length <= ancestor.length) return false;\n\tfor (let i = 0; i < ancestor.length; i += 1) if (path[i] !== ancestor[i]) return false;\n\treturn true;\n}\nfunction fkSpecFromNode(fk, tableName) {\n\treturn {\n\t\tname: fk.name ?? `${tableName}_${fk.columns.join(\"_\")}_fkey`,\n\t\tcolumns: [...fk.columns],\n\t\treferences: {\n\t\t\tschema: fk.referencedSchema ?? \"\",\n\t\t\ttable: fk.referencedTable,\n\t\t\tcolumns: [...fk.referencedColumns]\n\t\t},\n\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t...ifDefined(\"onUpdate\", fk.onUpdate)\n\t};\n}\n/**\n* Builds the `CreateTable` + child `CreateIndex` / `AddForeignKey` / `AddUnique`\n* calls for a newly-expected table, reading only the table node's children. The\n* PK and every declared CHECK go inline as table constraints; indexes\n* (declared + FK-backing, already merged and ordered at derivation) and the\n* FK / unique constraints are separate calls (re-bucketed downstream). Every\n* column's DDL is resolved from its `codecRef` via `renderColumnDdl`.\n*/\nfunction buildCreateTableCallsFromNode(schemaName, ddlSchemaName, table, codecHooks) {\n\tconst ddlColumns = Object.values(table.columns).map((c) => renderColumnDdl(c.name, c, codecHooks));\n\tconst primaryKeyConstraints = table.primaryKey ? [contractFree.primaryKey([...table.primaryKey.columns], { ...ifDefined(\"name\", table.primaryKey.name) })] : [];\n\tconst declaredChecks = (table.checks ?? []).map((c) => contractFree.checkExpression(c.name, c.expression));\n\tconst allTableConstraints = [...primaryKeyConstraints, ...declaredChecks];\n\tconst calls = [new CreateTableCall(schemaName, table.name, ddlColumns, allTableConstraints.length > 0 ? allTableConstraints : void 0)];\n\tfor (const index of table.indexes) calls.push(createIndexCallFromNode(index, schemaName, table.name));\n\tfor (const fk of table.foreignKeys) calls.push(new AddForeignKeyCall(schemaName, table.name, fkSpecFromNode(fk, table.name)));\n\tfor (const unique of table.uniques) {\n\t\tconst constraintName = unique.name ?? `${table.name}_${unique.columns.join(\"_\")}_key`;\n\t\tcalls.push(new AddUniqueCall(schemaName, table.name, constraintName, [...unique.columns]));\n\t}\n\tif (table.rlsEnabled) calls.push(new EnableRowLevelSecurityCall(ddlSchemaName, table.name));\n\treturn calls;\n}\nfunction nodeConflict(kind, message) {\n\treturn issueConflict(kind, message);\n}\n/**\n* True when `actualMembers` (the live database's ordered members) is a\n* strict, order-preserving prefix of `expectedMembers` (the contract's) —\n* the database already carries every contract member, in declaration\n* order, and the contract declares at least one member the database still\n* lacks. Any other relationship — a renamed value, a removed value, a\n* reordering, or the database holding members the contract lacks — is not\n* a suffix append.\n*/\nfunction isNativeEnumSuffixAppend(actualMembers, expectedMembers) {\n\tif (actualMembers.length >= expectedMembers.length) return false;\n\treturn actualMembers.every((member, index) => member === expectedMembers[index]);\n}\n/** Operator-worded refusal for a native-enum member change beyond a suffix append (design ruling — tests match this verbatim). */\nfunction nativeEnumMemberChangeRefusal(options) {\n\treturn `Native enum type \"${options.ddlSchemaName}\".\"${options.typeName}\" changed beyond appending new values (contract declares [${options.expectedMembers.join(\", \")}], database has [${options.actualMembers.join(\", \")}]). Prisma Next does not modify a native enum's existing values (rename, removal, reorder) — see https://pris.ly/d/postgres-native-enums. Author the change manually with \\`migration new\\`.`;\n}\n/**\n* Managed native-enum issue -> op lowering. A missing declared type creates\n* it; an unclaimed live type drops it (ownership-scoped upstream by\n* `retainUnownedExtras`, destructiveness gated by the operation-class\n* policy); a paired member-value mismatch lowers to one `ALTER TYPE ... ADD\n* VALUE` per appended member when the database's members are a strict,\n* order-preserving prefix of the contract's — any other change (rename,\n* removal, reorder, or the database holding members the contract lacks) is\n* refused with a NAMED diagnostic, never a silent no-op and never a\n* drop-and-recreate.\n*/\nfunction mapNativeEnumNodeIssue(issue, ctx) {\n\tconst ddlSchemaName = issueSchemaName(issue);\n\tif (ddlSchemaName === void 0) return notOk(nodeConflict(\"unsupportedOperation\", `Enum issue has no schema in its path: ${issue.path.join(\"/\")}`));\n\tconst schemaName = emissionSchemaName(ctx, ddlSchemaName);\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst expected = blindCast(issue.expected);\n\t\treturn ok([new CreateNativeEnumTypeCall(schemaName, expected.typeName, expected.members)]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropNativeEnumTypeCall(schemaName, blindCast(issue.actual).typeName)]);\n\tconst expected = blindCast(issue.expected);\n\tconst actual = blindCast(issue.actual);\n\tif (isNativeEnumSuffixAppend(actual.members, expected.members)) return ok(expected.members.slice(actual.members.length).map((value) => new AddNativeEnumValueCall(schemaName, expected.typeName, value)));\n\treturn notOk(nodeConflict(\"unsupportedOperation\", nativeEnumMemberChangeRefusal({\n\t\tddlSchemaName,\n\t\ttypeName: expected.typeName,\n\t\texpectedMembers: expected.members,\n\t\tactualMembers: actual.members\n\t})));\n}\nfunction mapTableNodeIssue(issue, schemaName, ddlSchemaName, codecHooks) {\n\tif (issueOutcome(issue) === \"not-found\") return ok(buildCreateTableCallsFromNode(schemaName, ddlSchemaName, blindCast(issue.expected), codecHooks));\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropTableCall(schemaName, blindCast(issue.actual).name)]);\n\tconst expected = blindCast(issue.expected);\n\tconst actual = blindCast(issue.actual);\n\tif (expected.rlsEnabled && !actual.rlsEnabled) return ok([new EnableRowLevelSecurityCall(ddlSchemaName, expected.name)]);\n\tif (!expected.rlsEnabled && actual.rlsEnabled) return ok([new DisableRowLevelSecurityCall(ddlSchemaName, expected.name)]);\n\treturn notOk(nodeConflict(\"unsupportedOperation\", `unhandled table-attribute drift on \"${expected.name}\": table not-equal with no rlsEnabled delta (a second table attribute drifted)`));\n}\nfunction mapColumnNodeIssue(issue, schemaName, tableName, codecHooks) {\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst column = blindCast(issue.expected);\n\t\treturn ok([new AddColumnCall(schemaName, tableName, renderColumnDdl(column.name, column, codecHooks))]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropColumnCall(schemaName, tableName, blindCast(issue.actual).name)]);\n\tconst expected = blindCast(issue.expected);\n\tconst actual = blindCast(issue.actual);\n\tconst calls = [];\n\tif (columnTypeChanged(expected, actual)) {\n\t\tconst { qualifiedTargetType, formatTypeExpected } = renderColumnAlterType(expected, codecHooks);\n\t\tcalls.push(new AlterColumnTypeCall(schemaName, tableName, expected.name, {\n\t\t\tqualifiedTargetType,\n\t\t\tformatTypeExpected,\n\t\t\trawTargetTypeForLabel: qualifiedTargetType\n\t\t}));\n\t}\n\tif (expected.nullable !== actual.nullable) calls.push(expected.nullable ? new DropNotNullCall(schemaName, tableName, expected.name) : new SetNotNullCall(schemaName, tableName, expected.name));\n\treturn ok(calls);\n}\nfunction mapColumnDefaultNodeIssue(issue, schemaName, tableName, columnName) {\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropDefaultCall(schemaName, tableName, columnName)]);\n\tif (issue.expected === void 0) return ok([]);\n\tconst defaultSql = renderColumnDefaultSql(blindCast(issue.expected));\n\tif (!defaultSql) return ok([]);\n\treturn ok([new SetDefaultCall(schemaName, tableName, columnName, defaultSql, issueOutcome(issue) === \"not-equal\" ? \"widening\" : \"additive\")]);\n}\nfunction mapPrimaryKeyNodeIssue(issue, schemaName, tableName) {\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst pk = blindCast(issue.expected);\n\t\treturn ok([new AddPrimaryKeyCall(schemaName, tableName, pk.name ?? `${tableName}_pkey`, [...pk.columns])]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropConstraintCall(schemaName, tableName, blindCast(issue.actual).name ?? `${tableName}_pkey`, \"primaryKey\")]);\n\treturn notOk(nodeConflict(\"indexIncompatible\", issue.path.join(\"/\")));\n}\nfunction mapForeignKeyNodeIssue(issue, schemaName, tableName) {\n\tif (issueOutcome(issue) === \"not-found\") return ok([new AddForeignKeyCall(schemaName, tableName, fkSpecFromNode(blindCast(issue.expected), tableName))]);\n\tif (issueOutcome(issue) === \"not-expected\") {\n\t\tconst fk = blindCast(issue.actual);\n\t\treturn ok([new DropConstraintCall(schemaName, tableName, fk.name ?? `${tableName}_${fk.columns.join(\"_\")}_fkey`, \"foreignKey\")]);\n\t}\n\treturn notOk(nodeConflict(\"foreignKeyConflict\", issue.path.join(\"/\")));\n}\nfunction mapUniqueNodeIssue(issue, schemaName, tableName) {\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst unique = blindCast(issue.expected);\n\t\treturn ok([new AddUniqueCall(schemaName, tableName, unique.name ?? `${tableName}_${unique.columns.join(\"_\")}_key`, [...unique.columns])]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") {\n\t\tconst unique = blindCast(issue.actual);\n\t\treturn ok([new DropConstraintCall(schemaName, tableName, unique.name ?? `${tableName}_${unique.columns.join(\"_\")}_key`, \"unique\")]);\n\t}\n\treturn notOk(nodeConflict(\"indexIncompatible\", issue.path.join(\"/\")));\n}\n/**\n* The CreateIndexCall for a name-identified index node: the node's own name\n* verbatim, its element list (column tuple or opaque expression), and the\n* unique/type/options/where attributes carried through.\n*/\nfunction createIndexCallFromNode(index, schemaName, tableName) {\n\tconst extras = {};\n\tif (index.type !== void 0) extras.type = index.type;\n\tif (index.options !== void 0) extras.options = index.options;\n\tif (index.where !== void 0) extras.where = index.where;\n\tif (index.unique) extras.unique = true;\n\treturn new CreateIndexCall(schemaName, tableName, index.name, index.columns !== void 0 ? { columns: [...index.columns] } : { expression: index.expression ?? \"\" }, extras);\n}\nfunction mapIndexNodeIssue(issue, schemaName, tableName) {\n\tif (issueOutcome(issue) === \"not-found\") return ok([createIndexCallFromNode(blindCast(issue.expected), schemaName, tableName)]);\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropIndexCall(schemaName, tableName, blindCast(issue.actual).name)]);\n\treturn notOk(nodeConflict(\"indexIncompatible\", issue.path.join(\"/\")));\n}\n/**\n* The index treatment: a missing check is added, an undeclared live check is\n* dropped, and a paired divergence is a conflict. `not-equal` is reachable only\n* for an exact-named expected check — a wire-named one compares by name, so a\n* changed predicate re-suffixes the name and arrives as missing + extra\n* instead.\n*/\nfunction mapCheckNodeIssue(issue, schemaName, tableName) {\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst check = blindCast(issue.expected);\n\t\treturn ok([new AddCheckConstraintCall(schemaName, tableName, check.name, check.expression)]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropCheckConstraintCall(schemaName, tableName, blindCast(issue.actual).name)]);\n\treturn notOk(nodeConflict(\"unsupportedOperation\", issue.path.join(\"/\")));\n}\n/**\n* Maps one node-typed diff issue to its migration call(s), dispatching on the\n* node's `nodeKind` and the issue's presence-derived `issueOutcome`, reading\n* nodes and resolving column DDL from `codecRef` via `column-ddl-rendering.ts`.\n*/\nfunction mapNodeIssueToCall(issue, ctx) {\n\tconst node = issueNode(issue);\n\tif (node === void 0) return notOk(nodeConflict(\"unsupportedOperation\", `Issue carries neither an expected nor an actual node: ${issue.path.join(\"/\")}`));\n\tif (node.nodeKind === PostgresSchemaNodeKind.namespace) {\n\t\tif (issueOutcome(issue) !== \"not-found\") return notOk(nodeConflict(\"unsupportedOperation\", `Unexpected namespace drift: ${issue.path.join(\"/\")}`));\n\t\treturn ok([new CreateSchemaCall(blindCast(issue.expected).schemaName)]);\n\t}\n\tif (node.nodeKind === PostgresSchemaNodeKind.nativeEnum) return mapNativeEnumNodeIssue(issue, ctx);\n\tconst ddlSchemaName = issueSchemaName(issue);\n\tconst tableName = issueTableName(issue);\n\tif (ddlSchemaName === void 0 || tableName === void 0) return notOk(nodeConflict(\"unsupportedOperation\", `Issue has no schema/table in its path: ${issue.path.join(\"/\")}`));\n\tconst schemaName = emissionSchemaName(ctx, ddlSchemaName);\n\tswitch (node.nodeKind) {\n\t\tcase PostgresSchemaNodeKind.table: return mapTableNodeIssue(issue, schemaName, ddlSchemaName, ctx.codecHooks);\n\t\tcase RelationalSchemaNodeKind.column: return mapColumnNodeIssue(issue, schemaName, tableName, ctx.codecHooks);\n\t\tcase RelationalSchemaNodeKind.columnDefault: {\n\t\t\tconst columnName = issueColumnName(issue);\n\t\t\tif (columnName === void 0) return notOk(nodeConflict(\"unsupportedOperation\", `Default issue has no column in its path: ${issue.path.join(\"/\")}`));\n\t\t\treturn mapColumnDefaultNodeIssue(issue, schemaName, tableName, columnName);\n\t\t}\n\t\tcase RelationalSchemaNodeKind.primaryKey: return mapPrimaryKeyNodeIssue(issue, schemaName, tableName);\n\t\tcase RelationalSchemaNodeKind.foreignKey: return mapForeignKeyNodeIssue(issue, schemaName, tableName);\n\t\tcase RelationalSchemaNodeKind.unique: return mapUniqueNodeIssue(issue, schemaName, tableName);\n\t\tcase RelationalSchemaNodeKind.index: return mapIndexNodeIssue(issue, schemaName, tableName);\n\t\tcase RelationalSchemaNodeKind.check: return mapCheckNodeIssue(issue, schemaName, tableName);\n\t\tdefault: return notOk(nodeConflict(\"unsupportedOperation\", `Unhandled node kind: ${node.nodeKind}`));\n\t}\n}\n/**\n* Runs the ordered strategy list over the node-typed diff issues, maps\n* leftover issues via {@link mapNodeIssueToCall}, applies operation-class\n* policy gating, and buckets calls into the fixed DDL emission order (dep →\n* drop → table → column → recipe → alter → primaryKey → unique → index →\n* foreignKey).\n*/\nfunction planIssues(options) {\n\tconst policyProvided = options.policy !== void 0;\n\tconst policy = options.policy ?? DEFAULT_POLICY;\n\tconst schema = options.schema ?? emptySchemaIR();\n\tconst frameworkComponents = options.frameworkComponents ?? [];\n\tconst context = {\n\t\ttoContract: options.toContract,\n\t\tfromContract: options.fromContract,\n\t\tschemaName: options.schemaName,\n\t\tcodecHooks: options.codecHooks,\n\t\tstorageTypes: options.storageTypes,\n\t\tschema,\n\t\tpolicy,\n\t\tframeworkComponents\n\t};\n\tconst strategies = options.strategies ?? postgresPlannerStrategies;\n\tlet remaining = options.issues;\n\tconst recipeCalls = [];\n\tconst bucketablePatternCalls = [];\n\tfor (const strategy of strategies) {\n\t\tconst result = strategy(remaining, context);\n\t\tif (result.kind === \"match\") {\n\t\t\tremaining = result.issues;\n\t\t\tif (result.recipe) recipeCalls.push(...result.calls);\n\t\t\telse bucketablePatternCalls.push(...result.calls);\n\t\t}\n\t}\n\tconst sorted = orderIssuesByDependencies(remaining);\n\tconst defaultCalls = [];\n\tconst conflicts = [];\n\tfor (const issue of sorted) {\n\t\tconst result = mapNodeIssueToCall(issue, context);\n\t\tif (result.ok) defaultCalls.push(...result.value);\n\t\telse conflicts.push(result.failure);\n\t}\n\tconst allowed = policy.allowedOperationClasses;\n\tlet gatedDefault = defaultCalls;\n\tlet gatedRecipe = recipeCalls;\n\tlet gatedBucketable = bucketablePatternCalls;\n\tif (policyProvided) {\n\t\tconst keepIfAllowed = (bucket) => (call) => {\n\t\t\tif (allowed.includes(call.operationClass)) {\n\t\t\t\tbucket.push(call);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconflicts.push(conflictForDisallowedCall(call, allowed));\n\t\t};\n\t\tconst gatedDefaultBucket = [];\n\t\tconst gatedRecipeBucket = [];\n\t\tconst gatedBucketableBucket = [];\n\t\tdefaultCalls.forEach(keepIfAllowed(gatedDefaultBucket));\n\t\trecipeCalls.forEach(keepIfAllowed(gatedRecipeBucket));\n\t\tbucketablePatternCalls.forEach(keepIfAllowed(gatedBucketableBucket));\n\t\tgatedDefault = gatedDefaultBucket;\n\t\tgatedRecipe = gatedRecipeBucket;\n\t\tgatedBucketable = gatedBucketableBucket;\n\t}\n\tif (conflicts.length > 0) return notOk(conflicts);\n\tconst combinedBucketable = [...gatedDefault, ...gatedBucketable];\n\tconst byCategory = (cat) => combinedBucketable.filter((c) => classifyCall(c) === cat);\n\treturn ok({ calls: [\n\t\t...byCategory(\"dep\"),\n\t\t...byCategory(\"drop\"),\n\t\t...byCategory(\"dropType\"),\n\t\t...byCategory(\"table\"),\n\t\t...byCategory(\"column\"),\n\t\t...gatedRecipe,\n\t\t...byCategory(\"alter\"),\n\t\t...byCategory(\"primaryKey\"),\n\t\t...byCategory(\"unique\"),\n\t\t...byCategory(\"index\"),\n\t\t...byCategory(\"foreignKey\"),\n\t\t...byCategory(\"rlsEnable\")\n\t] });\n}\n//#endregion\n//#region src/core/migrations/control-policy.ts\n/**\n* Factory calls that create a whole, previously-absent top-level storage\n* object. Used to decide whether `tolerated` permits a call (it only allows\n* creating absent objects, never modifying existing ones).\n*\n* Deliberately an explicit, closed set rather than a `factoryName`\n* create/alter/drop classification: it answers exactly one yes/no question\n* and is fail-closed. Any call not listed here — including future or\n* extension-contributed factories — is treated as NOT object-creation, so it\n* is suppressed under `tolerated` rather than permissively emitted.\n*\n* Lists the creation factories that actually reach the call-side resolver\n* (`resolvePostgresCallControlPolicySubject`) — today only RLS policy\n* creation, from `planPostgresSchemaDiff`. Every other whole-object create\n* (table, schema, native enum, and RLS enablement) is constructed inside\n* `planIssues` and graded on the node side by\n* `resolvePostgresNodeIssueCreationFactoryName`, so none of them are listed\n* here.\n*/\nconst OBJECT_CREATION_FACTORIES = /* @__PURE__ */ new Set([\"createRlsPolicy\"]);\nfunction createsNewTopLevelObject(call) {\n\treturn OBJECT_CREATION_FACTORIES.has(call.factoryName);\n}\nfunction ddlSchemaNameForNamespace(contract, namespaceId) {\n\tconst namespace = contract.storage.namespaces[namespaceId];\n\treturn isPostgresSchema(namespace) ? namespace.ddlSchemaName(contract.storage) : namespaceId;\n}\n/**\n* Resolve the namespace a declared storage entity lives in by walking every\n* namespace for one whose `entries` map actually contains the coordinate —\n* a table by its name, a native enum by its physical type name (see\n* {@link postgresNodeStorageCoordinate}). When `ddlSchemaName` is given, the\n* match must also land in that DDL schema (disambiguates same-named entities\n* declared under different namespaces); when omitted, the first namespace\n* that declares the entity wins. Falls back to {@link UNBOUND_NAMESPACE_ID}\n* when no namespace declares it — e.g. an extra/dropped entity the contract\n* doesn't claim at all.\n*/\nfunction resolveNamespaceIdForEntity(contract, coordinate, ddlSchemaName) {\n\tfor (const namespaceId of Object.keys(contract.storage.namespaces)) {\n\t\tif (!entityAt(contract.storage, {\n\t\t\tnamespaceId,\n\t\t\t...coordinate\n\t\t})) continue;\n\t\tif (ddlSchemaName === void 0 || ddlSchemaNameForNamespace(contract, namespaceId) === ddlSchemaName) return namespaceId;\n\t}\n\treturn UNBOUND_NAMESPACE_ID;\n}\nfunction resolveNamespaceIdForTable(contract, tableName, ddlSchemaName) {\n\treturn resolveNamespaceIdForEntity(contract, {\n\t\tentityKind: \"table\",\n\t\tentityName: tableName\n\t}, ddlSchemaName);\n}\nfunction resolveNamespaceIdForDdlSchema(contract, ddlSchemaName) {\n\tfor (const namespaceId of Object.keys(contract.storage.namespaces)) {\n\t\tconst ns = contract.storage.namespaces[namespaceId];\n\t\tif (isPostgresSchema(ns) && ns.ddlSchemaName(contract.storage) === ddlSchemaName) return namespaceId;\n\t\tif (namespaceId === ddlSchemaName) return namespaceId;\n\t}\n\treturn UNBOUND_NAMESPACE_ID;\n}\nfunction postgresCallFields(call) {\n\treturn {\n\t\t...ifDefined(\"schemaName\", \"schemaName\" in call ? call.schemaName : void 0),\n\t\t...ifDefined(\"tableName\", \"tableName\" in call ? call.tableName : void 0),\n\t\t...ifDefined(\"columnName\", \"columnName\" in call ? call.columnName : void 0)\n\t};\n}\nfunction formatSuppressionSubjectLabel(subject, contract) {\n\tif (subject === void 0) return \"unknown\";\n\tconst ddlSchema = ddlSchemaNameForNamespace(contract, subject.namespaceId);\n\tif (subject.entityKind !== void 0 && subject.entityName !== void 0) {\n\t\tconst entityLabel = `${subject.entityKind} \"${ddlSchema}.${subject.entityName}\"`;\n\t\treturn subject.rlsPolicy !== void 0 ? `RLS policy \"${subject.rlsPolicy}\" on ${entityLabel}` : entityLabel;\n\t}\n\treturn `namespace \"${ddlSchema}\"`;\n}\nfunction postgresSuppressionSummary(subjectLabel, subject, policy) {\n\tconst namespace = subject?.namespaceId ?? \"unknown\";\n\tconst declared = subject?.explicitNodeControlPolicy;\n\tif (policy === \"external\" && declared === \"managed\") return `control policy suppressed: ${subjectLabel} — namespace '${namespace}' has effective control 'external' but declared 'managed'`;\n\treturn `control policy suppressed: ${subjectLabel} — namespace '${namespace}' has effective control '${policy}'${declared ? ` but declared '${declared}'` : \"\"}`;\n}\n/**\n* Render one family {@link SuppressionRecord} into a target `SqlPlannerConflict`.\n* The family decides *that* a subject is suppressed and hands over the raw\n* coordinate + policy; the label, message, and location are rendered here,\n* driven entirely by the subject's own `(entityKind, entityName)` coordinate\n* — no target-owned table-vs-enum vocabulary.\n*/\nfunction renderPostgresSuppression(record, contract) {\n\tconst subject = record.subject;\n\treturn {\n\t\tkind: \"controlPolicySuppressedCall\",\n\t\tsummary: postgresSuppressionSummary(formatSuppressionSubjectLabel(subject, contract), subject, record.policy),\n\t\tlocation: {\n\t\t\t...ifDefined(\"namespaceId\", subject?.namespaceId),\n\t\t\t...ifDefined(\"entityKind\", subject?.entityKind),\n\t\t\t...ifDefined(\"entityName\", subject?.entityName),\n\t\t\t...ifDefined(\"column\", subject?.column),\n\t\t\t...ifDefined(\"rlsPolicy\", subject?.rlsPolicy)\n\t\t},\n\t\tmeta: {\n\t\t\tcontrolPolicy: record.policy,\n\t\t\t...ifDefined(\"factoryName\", record.factoryName),\n\t\t\t...ifDefined(\"rlsPolicy\", subject?.rlsPolicy),\n\t\t\t...ifDefined(\"declaredControlPolicy\", subject?.explicitNodeControlPolicy)\n\t\t}\n\t};\n}\nfunction resolvePostgresCallControlPolicySubject(call, contract) {\n\tconst callFields = postgresCallFields(call);\n\tconst createsNewObject = createsNewTopLevelObject(call);\n\tif (call.factoryName === \"createSchema\" && callFields.schemaName) return {\n\t\tnamespaceId: resolveNamespaceIdForDdlSchema(contract, callFields.schemaName),\n\t\tcreatesNewObject\n\t};\n\tif (callFields.tableName) {\n\t\tconst namespaceId = resolveNamespaceIdForTable(contract, callFields.tableName, callFields.schemaName);\n\t\tconst tableControlPolicy = entityAt(contract.storage, {\n\t\t\tnamespaceId,\n\t\t\tentityKind: \"table\",\n\t\t\tentityName: callFields.tableName\n\t\t})?.control;\n\t\treturn {\n\t\t\tnamespaceId,\n\t\t\tentityKind: \"table\",\n\t\t\tentityName: callFields.tableName,\n\t\t\t...ifDefined(\"column\", callFields.columnName),\n\t\t\t...ifDefined(\"explicitNodeControlPolicy\", tableControlPolicy),\n\t\t\tcreatesNewObject\n\t\t};\n\t}\n\tif (callFields.schemaName) return {\n\t\tnamespaceId: resolveNamespaceIdForDdlSchema(contract, callFields.schemaName),\n\t\tcreatesNewObject\n\t};\n}\n/**\n* Node kinds whose *absence* is the creation of a whole, top-level Postgres\n* object: a namespace, a table, or a native enum. Used by\n* {@link resolvePostgresNodeIssueCreationFactoryName} to decide whether a\n* `tolerated` subject permits the issue to flow into the planner\n* (create-if-absent) and to seed the suppressed-subject warning's\n* `factoryName` when the planner is skipped. RLS policy creation is not\n* listed here — policy issues never reach this issue-based partition (they\n* are routed to `planPostgresSchemaDiff` and gated via the call-based\n* {@link resolvePostgresCallControlPolicySubject} instead).\n*/\nconst POSTGRES_NODE_CREATION_FACTORY = Object.freeze({\n\t[PostgresSchemaNodeKind.namespace]: \"createSchema\",\n\t[PostgresSchemaNodeKind.table]: \"createTable\",\n\t[PostgresSchemaNodeKind.nativeEnum]: \"createNativeEnumType\"\n});\n/**\n* A table `not-equal` issue whose `rlsEnabled` flips OFF→ON (expected on,\n* actual off) is enablement toward `ENABLE ROW LEVEL SECURITY`. It is\n* creation-class on the node side because `isEnablementCreationIssue` and\n* {@link resolvePostgresNodeIssueCreationFactoryName} treat this OFF→ON delta\n* as a creation: enabling RLS establishes the fail-closed guard the declared\n* policy set attaches to, the same grant `tolerated` extends to creating the\n* policies themselves. The opposite direction (`DISABLE`) is a modification\n* and stays managed-only. Keying on the actual delta (not just the expected\n* bit) keeps this correct if a second table attribute ever joins\n* `isEqualTo`: a not-equal with no `rlsEnabled` delta is not enablement, so\n* it is not admitted as creation-class here.\n*/\nfunction isEnablementCreationIssue(issue) {\n\tif (issueOutcome(issue) !== \"not-equal\") return false;\n\tconst { expected, actual } = issue;\n\treturn expected !== void 0 && actual !== void 0 && PostgresTableSchemaNode.is(expected) && PostgresTableSchemaNode.is(actual) && expected.rlsEnabled === true && actual.rlsEnabled === false;\n}\nfunction resolvePostgresNodeIssueCreationFactoryName(issue) {\n\tif (isEnablementCreationIssue(issue)) return \"enableRowLevelSecurity\";\n\tif (issueOutcome(issue) !== \"not-found\") return void 0;\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\treturn POSTGRES_NODE_CREATION_FACTORY[node.nodeKind];\n}\n/**\n* Resolves the control-policy subject for a node-typed {@link SchemaDiffIssue}\n* (the issue-side mirror of `resolvePostgresCallControlPolicySubject`).\n* Storage entities resolve off their node coordinate; a sub-entity issue\n* resolves off the enclosing table read from the issue path; an unclaimed\n* extra falls back to the unbound coordinate. A role always resolves\n* `'external'` — roles are referenced, never owned.\n*/\nfunction resolvePostgresNodeIssueControlPolicySubject(issue, contract) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\tif (node.nodeKind === PostgresSchemaNodeKind.namespace) return {\n\t\tnamespaceId: resolveNamespaceIdForDdlSchema(contract, blindCast(node).schemaName),\n\t\tcreatesNewObject: issueOutcome(issue) === \"not-found\"\n\t};\n\tif (node.nodeKind === PostgresSchemaNodeKind.role) {\n\t\tconst roleName = issue.path[1];\n\t\treturn {\n\t\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\t\texplicitNodeControlPolicy: (roleName === void 0 ? void 0 : entityAt(contract.storage, {\n\t\t\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\t\t\tentityKind: \"role\",\n\t\t\t\tentityName: roleName\n\t\t\t}))?.control ?? \"external\",\n\t\t\tcreatesNewObject: false\n\t\t};\n\t}\n\tconst coordinate = postgresNodeStorageCoordinate(node);\n\tif (coordinate !== void 0) {\n\t\tconst namespaceId = resolveNamespaceIdForEntity(contract, coordinate, issue.path[1]);\n\t\tconst entityControl = entityAt(contract.storage, {\n\t\t\tnamespaceId,\n\t\t\t...coordinate\n\t\t})?.control;\n\t\treturn {\n\t\t\tnamespaceId,\n\t\t\t...coordinate,\n\t\t\t...ifDefined(\"column\", issueColumnName(issue)),\n\t\t\t...ifDefined(\"explicitNodeControlPolicy\", entityControl),\n\t\t\tcreatesNewObject: resolvePostgresNodeIssueCreationFactoryName(issue) !== void 0\n\t\t};\n\t}\n\tconst tableName = issue.path[2];\n\tif (tableName === void 0) return void 0;\n\tconst ddlSchemaName = issue.path[1];\n\tconst namespaceId = resolveNamespaceIdForTable(contract, tableName, ddlSchemaName);\n\tconst table = entityAt(contract.storage, {\n\t\tnamespaceId,\n\t\tentityKind: \"table\",\n\t\tentityName: tableName\n\t});\n\treturn {\n\t\tnamespaceId,\n\t\tentityKind: \"table\",\n\t\tentityName: tableName,\n\t\t...ifDefined(\"column\", issueColumnName(issue)),\n\t\t...ifDefined(\"explicitNodeControlPolicy\", table?.control),\n\t\tcreatesNewObject: resolvePostgresNodeIssueCreationFactoryName(issue) !== void 0\n\t};\n}\n//#endregion\nexport { resolvePostgresNodeIssueCreationFactoryName as a, issueNode as c, postgresPlannerStrategies as d, postgresNodeStorageCoordinate as f, resolvePostgresNodeIssueControlPolicySubject as i, issueSchemaName as l, resolveNamespaceIdForDdlSchema as n, coalesceSubtreeIssues as o, resolvePostgresCallControlPolicySubject as r, conflictForDisallowedCall as s, renderPostgresSuppression as t, planIssues as u };\n\n//# sourceMappingURL=control-policy-B53lnBCT.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,8BAA8B,MAAM;CAC5C,IAAI,wBAAwB,GAAG,IAAI,GAAG;EACrC,MAAM,aAAa,uBAAuB,KAAK,QAAQ;EACvD,OAAO,eAAe,KAAK,IAAI,KAAK,IAAI;GACvC;GACA,YAAY,KAAK;EAClB;CACD;CACA,IAAI,6BAA6B,GAAG,IAAI,GAAG;EAC1C,MAAM,aAAa,uBAAuB,KAAK,QAAQ;EACvD,OAAO,eAAe,KAAK,IAAI,KAAK,IAAI;GACvC;GACA,YAAY,KAAK;EAClB;CACD;AACD;;;;;;;;;;;;;AAeA,SAAS,WAAW,QAAQ;CAC3B,IAAI,OAAO,aAAa,KAAK,KAAK,OAAO,wBAAwB,KAAK,GAAG,MAAM,IAAI,cAAc,gCAAgC,OAAO,KAAK,oGAAoG;CACjP,OAAO;EACN,YAAY,OAAO;EACnB,SAAS,OAAO,SAAS;EACzB,UAAU,OAAO;EACjB,GAAG,UAAU,QAAQ,OAAO,QAAQ,OAAO,SAAS,IAAI;EACxD,GAAG,UAAU,cAAc,OAAO,SAAS,eAAe,KAAK,IAAI,UAAU,OAAO,SAAS,UAAU,IAAI,KAAK,CAAC;EACjH,GAAG,OAAO,iBAAiB,EAAE,SAAS,aAAa,IAAI,CAAC;EACxD,GAAG,UAAU,WAAW,OAAO,eAAe;CAC/C;AACD;;;;;;;AAOA,SAAS,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"version":3,"file":"descriptor-meta-KVX21fsl-DBDoB4eg.mjs","names":[],"sources":["../../../../3-targets/6-adapters/postgres/dist/descriptor-meta-KVX21fsl.mjs"],"sourcesContent":["import { n as adapterError } from \"./sql-renderer-ComgusFq.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\";\nimport { postgresAggregateDescriptors } from \"@internal/target-postgres/aggregates\";\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\tcheckConstraint: true\n\t\t}\n\t},\n\ttypes: {\n\t\taggregateDescriptors: postgresAggregateDescriptors,\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//# sourceMappingURL=descriptor-meta-KVX21fsl.mjs.map"],"mappings":";;;;;;;AAOA,MAAM,mBAAmB,WAAW;CACnC,SAAS;CACT;CACA,OAAO;AACR;AACA,SAAS,kBAAkB,OAAO;CACjC,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,OAAO,UAAU,KAAK,KAAK,QAAQ;AAClG;AACA,SAAS,qBAAqB,OAAO;CACpC,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK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;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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"descriptor-meta-rilAH3ep-dAmiVLpe.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/descriptor-meta-rilAH3ep.mjs"],"sourcesContent":["import { A as postgresQualifyColumnType } from \"./codecs-BmPCJWqb.mjs\";\nimport { t as DEFAULT_NAMESPACE_ID } from \"./namespace-ids-xtp_ZY86.mjs\";\nimport { i as postgresCreateNamespace } from \"./postgres-schema-CF0yHESb.mjs\";\nimport { a as postgresAuthoringTypes, i as postgresAuthoringPslBlockDescriptors, n as postgresAuthoringFieldPresets, o as postgresLowerEntityHandles, r as postgresAuthoringModelAttributes, t as postgresAuthoringEntityTypes } from \"./authoring-BOpdZa2N.mjs\";\nimport { t as postgresRenderCheckExpressions } from \"./check-expressions-5vhxWaFy.mjs\";\nimport { t as postgresTargetDescriptorMetaRuntime } from \"./descriptor-meta-runtime-UwYdV8fD.mjs\";\nimport { type } from \"arktype\";\nimport { defineIndexTypes } from \"@internal/sql-contract/index-types\";\n//#region src/core/index-types.ts\nconst postgresIndexTypes = defineIndexTypes().add(\"btree\", { options: type(\"object\") }).add(\"hash\", { options: type(\"object\") }).add(\"gin\", { options: type(\"object\") }).add(\"gist\", { options: type(\"object\") }).add(\"spgist\", { options: type(\"object\") }).add(\"brin\", { options: type(\"object\") });\nconst postgresTargetDescriptorMeta = {\n\t...postgresTargetDescriptorMetaRuntime,\n\tdefaultNamespaceId: DEFAULT_NAMESPACE_ID,\n\tindexTypes: postgresIndexTypes,\n\tauthoring: {\n\t\ttype: postgresAuthoringTypes,\n\t\tfield: postgresAuthoringFieldPresets,\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};\n//#endregion\nexport { postgresTargetDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-rilAH3ep.mjs.map"],"mappings":";;;;;;;;;AASA,MAAM,qBAAqB,iBAAiB,CAAC,CAAC,IAAI,SAAS,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,UAAU,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC;AACpS,MAAM,+BAA+B;CACpC,GAAG;CACH,oBAAoB;CACpB,YAAY;CACZ,WAAW;EACV,MAAM;EACN,OAAO;EACP,aAAa;EACb,qBAAqB;EACrB,iBAAiB;EACjB,iBAAiB;EACjB,mBAAmB;EACnB,wBAAwB;EACxB,oBAAoB;CACrB;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"driver__runtime.mjs","names":["#queue","#connection","#onRelease","#onDestroy","#txState","#onSettled","#settle","#closed","#connectionMutex","#closeWhileHoldingLease","#connected","#connectPromise","#cursorOpts","#preparedStatements","#delegate","#requireDelegate","#wrapConnection"],"sources":["../../../../3-targets/7-drivers/postgres/dist/runtime.mjs"],"sourcesContent":["import { i as postgresDriverDescriptorMeta, n as isPostgresError, r as normalizePgError, t as isAlreadyConnectedError } from \"./normalize-error-CNjgVO71.mjs\";\nimport { Pool } from \"pg\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport Cursor from \"pg-cursor\";\n//#region src/driver-error.ts\nfunction driverError(code, message, details) {\n\tconst error = new Error(message);\n\tObject.defineProperty(error, \"name\", {\n\t\tvalue: \"RuntimeError\",\n\t\tconfigurable: true\n\t});\n\treturn details === void 0 ? Object.assign(error, {\n\t\tcode,\n\t\tcategory: \"DRIVER\",\n\t\tseverity: \"error\"\n\t}) : Object.assign(error, {\n\t\tcode,\n\t\tcategory: \"DRIVER\",\n\t\tseverity: \"error\",\n\t\tdetails\n\t});\n}\n//#endregion\n//#region src/callback-to-promise.ts\nfunction callbackToPromise(fn) {\n\treturn new Promise((resolve, reject) => {\n\t\tfn((err, result) => {\n\t\t\tif (err) {\n\t\t\t\treject(err);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolve(result);\n\t\t});\n\t});\n}\n//#endregion\n//#region src/named-cursor.ts\nlet nextNamedPortalId = 1;\n/** Streaming cursor for a server-side named prepared statement. */\nvar NamedCursor = class extends Cursor {\n\tname;\n\tconstructor(opts) {\n\t\tsuper(opts.text, [...opts.values], opts.config);\n\t\tthis.name = opts.name;\n\t\tthis.submit = this.submitNamed;\n\t}\n\tsubmitNamed(connection) {\n\t\tconst self = this;\n\t\tconst conn = connection;\n\t\tself.state = \"submitted\";\n\t\tself.connection = conn;\n\t\tself._portal = `np_${nextNamedPortalId++}`;\n\t\tif (!conn.parsedStatements[this.name]) {\n\t\t\tconst parseMessage = {\n\t\t\t\ttext: self.text,\n\t\t\t\tname: this.name,\n\t\t\t\ttypes: []\n\t\t\t};\n\t\t\tconn.parse(parseMessage, true);\n\t\t}\n\t\tconst bindMessage = {\n\t\t\tportal: self._portal,\n\t\t\tstatement: this.name,\n\t\t\tvalues: self.values ?? []\n\t\t};\n\t\tconn.bind(bindMessage, true);\n\t\tconn.describe({\n\t\t\ttype: \"P\",\n\t\t\tname: self._portal\n\t\t}, true);\n\t\tconn.flush();\n\t\tif (self._conf.types) self._result._getTypeParser = self._conf.types.getTypeParser;\n\t\tconn.once(\"noData\", self._ifNoData);\n\t\tconn.once(\"rowDescription\", self._rowDescription);\n\t}\n};\n//#endregion\n//#region src/postgres-driver.ts\nconst DEFAULT_BATCH_SIZE = 100;\nconst DEFAULT_PREPARED_STATEMENTS = true;\nfunction createHandleAllocator() {\n\tlet next = 1;\n\treturn { mint: () => `pn_${next++}` };\n}\nfunction buildConnectionOptions(options) {\n\treturn {\n\t\t...options.cursor?.disabled ? { cursorDisabled: true } : {\n\t\t\tcursorBatchSize: options.cursor?.batchSize ?? DEFAULT_BATCH_SIZE,\n\t\t\tcursorDisabled: false\n\t\t},\n\t\tpreparedStatementsEnabled: options.preparedStatements ?? DEFAULT_PREPARED_STATEMENTS,\n\t\thandleAllocator: createHandleAllocator()\n\t};\n}\nfunction isStalePreparedStatementError(error) {\n\tif (!(error instanceof Error) || !(\"code\" in error) || typeof error.code !== \"string\") return false;\n\tconst code = error.code;\n\treturn code === \"26000\" || code === \"0A000\";\n}\nvar AsyncMutex = class {\n\t#queue = Promise.resolve();\n\tasync lock() {\n\t\tconst previous = this.#queue;\n\t\tlet releaseLock;\n\t\tthis.#queue = new Promise((resolve) => {\n\t\t\treleaseLock = resolve;\n\t\t});\n\t\tawait previous;\n\t\treturn () => {\n\t\t\treleaseLock?.();\n\t\t\treleaseLock = void 0;\n\t\t};\n\t}\n};\nconst clientQueryLocks = /* @__PURE__ */ new WeakMap();\nfunction acquireClientQueryLock(client) {\n\tlet mutex = clientQueryLocks.get(client);\n\tif (mutex === void 0) {\n\t\tmutex = new AsyncMutex();\n\t\tclientQueryLocks.set(client, mutex);\n\t}\n\treturn mutex.lock();\n}\nvar PostgresQueryable = class {\n\toptions;\n\tconstructor(options) {\n\t\tthis.options = options;\n\t}\n\tasync *query(request) {\n\t\ttry {\n\t\t\tconst preparedStatementHandle = request.preparedStatementHandle;\n\t\t\tif (preparedStatementHandle === void 0 || !this.options.preparedStatementsEnabled) {\n\t\t\t\tyield* this.runQuery(request);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst name = this.preparedStatementName(preparedStatementHandle);\n\t\t\tyield* this.withStaleHandleStreamRetry(preparedStatementHandle, name, (name) => this.runQuery(request, name));\n\t\t} catch (error) {\n\t\t\tthrow normalizePgError(error);\n\t\t}\n\t}\n\tasync execute(request) {\n\t\ttry {\n\t\t\tconst preparedStatementHandle = request.preparedStatementHandle;\n\t\t\tif (preparedStatementHandle === void 0 || !this.options.preparedStatementsEnabled) return await this.runExecute(request);\n\t\t\tconst name = this.preparedStatementName(preparedStatementHandle);\n\t\t\treturn await this.withStaleHandleRetry(preparedStatementHandle, name, (name) => this.runExecute(request, name));\n\t\t} catch (error) {\n\t\t\tthrow normalizePgError(error);\n\t\t}\n\t}\n\tpreparedStatementName(handle) {\n\t\tconst existingName = handle.get();\n\t\tif (typeof existingName === \"string\") return existingName;\n\t\tconst mintedName = this.options.handleAllocator.mint();\n\t\thandle.set(mintedName);\n\t\treturn mintedName;\n\t}\n\tasync withStaleHandleRetry(preparedStatementHandle, name, attempt) {\n\t\ttry {\n\t\t\treturn await attempt(name);\n\t\t} catch (error) {\n\t\t\tif (!isStalePreparedStatementError(error)) throw error;\n\t\t\tconst retryName = this.options.handleAllocator.mint();\n\t\t\tpreparedStatementHandle.set(retryName);\n\t\t\ttry {\n\t\t\t\treturn await attempt(retryName);\n\t\t\t} catch (retryError) {\n\t\t\t\tthrow prepareFailedError(retryError, retryName);\n\t\t\t}\n\t\t}\n\t}\n\tasync *withStaleHandleStreamRetry(preparedStatementHandle, name, attempt) {\n\t\tconst stream = await this.withStaleHandleRetry(preparedStatementHandle, name, async (name) => {\n\t\t\tconst iterator = attempt(name)[Symbol.asyncIterator]();\n\t\t\treturn {\n\t\t\t\titerator,\n\t\t\t\tfirst: await iterator.next()\n\t\t\t};\n\t\t});\n\t\tif (stream.first.done) return;\n\t\tlet streamCompleted = false;\n\t\ttry {\n\t\t\tyield stream.first.value;\n\t\t\twhile (true) {\n\t\t\t\tconst next = await stream.iterator.next();\n\t\t\t\tif (next.done) {\n\t\t\t\t\tstreamCompleted = true;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tyield next.value;\n\t\t\t}\n\t\t} finally {\n\t\t\tif (!streamCompleted) await stream.iterator.return?.();\n\t\t}\n\t}\n\tasync runExecute(request, name) {\n\t\tconst client = await this.acquireClient();\n\t\ttry {\n\t\t\tconst releaseLock = await acquireClientQueryLock(client);\n\t\t\ttry {\n\t\t\t\treturn { affectedRows: (await client.query({\n\t\t\t\t\tname,\n\t\t\t\t\ttext: request.sql,\n\t\t\t\t\tvalues: blindCast(request.params ?? [])\n\t\t\t\t})).rowCount ?? 0 };\n\t\t\t} finally {\n\t\t\t\treleaseLock();\n\t\t\t}\n\t\t} finally {\n\t\t\tawait this.releaseClient(client);\n\t\t}\n\t}\n\tinExplicitTransaction() {\n\t\treturn false;\n\t}\n\tasync *runQuery(request, name) {\n\t\tconst client = await this.acquireClient();\n\t\ttry {\n\t\t\tif (!this.options.cursorDisabled) {\n\t\t\t\tconst releaseLock = await acquireClientQueryLock(client);\n\t\t\t\ttry {\n\t\t\t\t\tfor await (const row of this.streamWithPortalProtection(client, request, this.options.cursorBatchSize, name)) yield blindCast(row);\n\t\t\t\t\treturn;\n\t\t\t\t} catch (cursorError) {\n\t\t\t\t\tif (!(cursorError instanceof Error) || isPostgresError(cursorError)) throw cursorError;\n\t\t\t\t} finally {\n\t\t\t\t\treleaseLock();\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor await (const row of this.executeBuffered(client, request.sql, request.params, name)) yield blindCast(row);\n\t\t} finally {\n\t\t\tawait this.releaseClient(client);\n\t\t}\n\t}\n\tasync explain(request) {\n\t\tconst text = `EXPLAIN (FORMAT JSON) ${request.sql}`;\n\t\tconst client = await this.acquireClient();\n\t\ttry {\n\t\t\tconst releaseLock = await acquireClientQueryLock(client);\n\t\t\ttry {\n\t\t\t\treturn { rows: blindCast((await client.query(text, request.params === void 0 ? void 0 : [...request.params]).catch(rethrowNormalizedError)).rows) };\n\t\t\t} finally {\n\t\t\t\treleaseLock();\n\t\t\t}\n\t\t} finally {\n\t\t\tawait this.releaseClient(client);\n\t\t}\n\t}\n\tasync *streamWithPortalProtection(client, request, cursorBatchSize, name) {\n\t\tif (this.inExplicitTransaction()) {\n\t\t\tyield* this.executeWithCursor(client, request.sql, request.params, cursorBatchSize, name);\n\t\t\treturn;\n\t\t}\n\t\tawait client.query(\"BEGIN\");\n\t\tlet streamFailed = false;\n\t\ttry {\n\t\t\tyield* this.executeWithCursor(client, request.sql, request.params, cursorBatchSize, name);\n\t\t} catch (error) {\n\t\t\tstreamFailed = true;\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tawait this.commitStreamSpan(client, streamFailed);\n\t\t}\n\t}\n\tasync commitStreamSpan(client, streamFailed) {\n\t\ttry {\n\t\t\tawait client.query(\"COMMIT\");\n\t\t} catch (commitError) {\n\t\t\tif (!streamFailed) throw commitError;\n\t\t}\n\t}\n\tasync *executeWithCursor(client, sql, params, cursorBatchSize, name) {\n\t\tconst values = blindCast(params ?? []);\n\t\tconst cursor = client.query(name === void 0 ? new Cursor(sql, values) : new NamedCursor({\n\t\t\tname,\n\t\t\ttext: sql,\n\t\t\tvalues\n\t\t}));\n\t\ttry {\n\t\t\twhile (true) {\n\t\t\t\tconst rows = await readCursor(cursor, cursorBatchSize);\n\t\t\t\tif (rows.length === 0) break;\n\t\t\t\tfor (const row of rows) yield row;\n\t\t\t}\n\t\t} finally {\n\t\t\tawait closeCursor(cursor);\n\t\t}\n\t}\n\tasync *executeBuffered(client, sql, params, name) {\n\t\tconst config = {\n\t\t\tname,\n\t\t\ttext: sql,\n\t\t\tvalues: blindCast(params ?? [])\n\t\t};\n\t\tconst releaseLock = await acquireClientQueryLock(client);\n\t\tlet result;\n\t\ttry {\n\t\t\tresult = await client.query(config);\n\t\t} finally {\n\t\t\treleaseLock();\n\t\t}\n\t\tfor (const row of blindCast(result.rows)) yield row;\n\t}\n};\nvar PostgresConnectionImpl = class extends PostgresQueryable {\n\t#connection;\n\t#onRelease;\n\t#onDestroy;\n\t#txState;\n\tconstructor(connection, options, onRelease, onDestroy, txState) {\n\t\tsuper(options);\n\t\tthis.#connection = connection;\n\t\tthis.#onRelease = onRelease;\n\t\tthis.#onDestroy = onDestroy;\n\t\tthis.#txState = txState ?? { open: false };\n\t}\n\tacquireClient() {\n\t\treturn Promise.resolve(this.#connection);\n\t}\n\treleaseClient(_client) {\n\t\treturn Promise.resolve();\n\t}\n\tinExplicitTransaction() {\n\t\treturn this.#txState.open;\n\t}\n\tasync beginTransaction() {\n\t\tconst releaseLock = await acquireClientQueryLock(this.#connection);\n\t\ttry {\n\t\t\tawait this.#connection.query(\"BEGIN\").catch(rethrowNormalizedError);\n\t\t} finally {\n\t\t\treleaseLock();\n\t\t}\n\t\tthis.#txState.open = true;\n\t\treturn new PostgresTransactionImpl(this.#connection, this.options, () => {\n\t\t\tthis.#txState.open = false;\n\t\t});\n\t}\n\tasync release() {\n\t\tconst conn = this.#connection;\n\t\tif (\"release\" in conn) conn.release();\n\t\tconst onRelease = this.#onRelease;\n\t\tthis.#onRelease = void 0;\n\t\tthis.#onDestroy = void 0;\n\t\tonRelease?.();\n\t}\n\tasync destroy(reason) {\n\t\tconst onDestroy = this.#onDestroy;\n\t\tconst onRelease = this.#onRelease;\n\t\tthis.#onDestroy = void 0;\n\t\tthis.#onRelease = void 0;\n\t\tconst conn = this.#connection;\n\t\tif (\"release\" in conn) {\n\t\t\tconst releaseArg = reason instanceof Error ? reason : /* @__PURE__ */ new Error(\"Connection destroyed\");\n\t\t\tconn.release(releaseArg);\n\t\t}\n\t\tif (onDestroy) await onDestroy(reason);\n\t\telse onRelease?.();\n\t}\n};\nvar PostgresTransactionImpl = class extends PostgresQueryable {\n\t#connection;\n\t#onSettled;\n\tconstructor(connection, options, onSettled) {\n\t\tsuper(options);\n\t\tthis.#connection = connection;\n\t\tthis.#onSettled = onSettled;\n\t}\n\tacquireClient() {\n\t\treturn Promise.resolve(this.#connection);\n\t}\n\treleaseClient(_client) {\n\t\treturn Promise.resolve();\n\t}\n\tinExplicitTransaction() {\n\t\treturn true;\n\t}\n\t#settle() {\n\t\tconst onSettled = this.#onSettled;\n\t\tthis.#onSettled = void 0;\n\t\tonSettled?.();\n\t}\n\tasync commit() {\n\t\tconst releaseLock = await acquireClientQueryLock(this.#connection);\n\t\ttry {\n\t\t\tawait this.#connection.query(\"COMMIT\").catch(rethrowNormalizedError);\n\t\t} finally {\n\t\t\treleaseLock();\n\t\t\tthis.#settle();\n\t\t}\n\t}\n\tasync rollback() {\n\t\tconst releaseLock = await acquireClientQueryLock(this.#connection);\n\t\ttry {\n\t\t\tawait this.#connection.query(\"ROLLBACK\").catch(rethrowNormalizedError);\n\t\t} finally {\n\t\t\treleaseLock();\n\t\t\tthis.#settle();\n\t\t}\n\t}\n};\nvar PostgresPoolDriverImpl = class extends PostgresQueryable {\n\tpool;\n\t#closed = false;\n\tconstructor(options) {\n\t\tsuper(buildConnectionOptions(options));\n\t\tthis.pool = options.connect.pool;\n\t}\n\tget state() {\n\t\treturn this.#closed ? \"closed\" : \"connected\";\n\t}\n\tasync connect(_binding) {}\n\tasync acquireConnection() {\n\t\treturn new PostgresConnectionImpl(await this.acquireClient(), this.options);\n\t}\n\tasync close() {\n\t\tif (this.#closed) return;\n\t\tthis.#closed = true;\n\t\tawait this.pool.end();\n\t}\n\tasync acquireClient() {\n\t\treturn this.pool.connect();\n\t}\n\tasync releaseClient(client) {\n\t\tclient.release();\n\t}\n};\nvar PostgresDirectDriverImpl = class extends PostgresQueryable {\n\tdirectClient;\n\t#connectionMutex = new AsyncMutex();\n\t#closed = false;\n\t#connected = false;\n\t#connectPromise;\n\t#txState = { open: false };\n\tconstructor(options) {\n\t\tsuper(buildConnectionOptions(options));\n\t\tthis.directClient = options.connect.client;\n\t}\n\tinExplicitTransaction() {\n\t\treturn this.#txState.open;\n\t}\n\tget state() {\n\t\treturn this.#closed ? \"closed\" : \"connected\";\n\t}\n\tasync connect(_binding) {}\n\tasync acquireConnection() {\n\t\tconst releaseLease = await this.#connectionMutex.lock();\n\t\ttry {\n\t\t\treturn new PostgresConnectionImpl(await this.acquireClient(), this.options, releaseLease, async () => {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.#closeWhileHoldingLease();\n\t\t\t\t} finally {\n\t\t\t\t\treleaseLease();\n\t\t\t\t}\n\t\t\t}, this.#txState);\n\t\t} catch (error) {\n\t\t\treleaseLease();\n\t\t\tthrow error;\n\t\t}\n\t}\n\tasync close() {\n\t\tconst releaseLease = await this.#connectionMutex.lock();\n\t\ttry {\n\t\t\tawait this.#closeWhileHoldingLease();\n\t\t} finally {\n\t\t\treleaseLease();\n\t\t}\n\t}\n\tasync #closeWhileHoldingLease() {\n\t\tif (this.#closed) return;\n\t\tthis.#closed = true;\n\t\tawait this.directClient.end();\n\t\tthis.#connected = false;\n\t}\n\tasync acquireClient() {\n\t\tif (this.#connected) return this.directClient;\n\t\tif (this.#connectPromise !== void 0) {\n\t\t\tawait this.#connectPromise;\n\t\t\treturn this.directClient;\n\t\t}\n\t\tthis.#connectPromise = (async () => {\n\t\t\ttry {\n\t\t\t\tawait this.directClient.connect();\n\t\t\t} catch (error) {\n\t\t\t\tif (!isAlreadyConnectedError(error)) throw error;\n\t\t\t} finally {\n\t\t\t\tthis.#connectPromise = void 0;\n\t\t\t}\n\t\t\tthis.#connected = true;\n\t\t})();\n\t\tawait this.#connectPromise;\n\t\treturn this.directClient;\n\t}\n\tasync releaseClient(_client) {}\n};\nfunction createBoundDriverFromBinding(binding, cursorOpts, extraOpts) {\n\tconst preparedStatements = extraOpts?.preparedStatements;\n\tswitch (binding.kind) {\n\t\tcase \"url\": return new PostgresPoolDriverImpl({\n\t\t\tconnect: { pool: new Pool({\n\t\t\t\tconnectionString: binding.url,\n\t\t\t\tconnectionTimeoutMillis: 2e4,\n\t\t\t\tidleTimeoutMillis: 3e4\n\t\t\t}) },\n\t\t\tcursor: cursorOpts,\n\t\t\tpreparedStatements\n\t\t});\n\t\tcase \"pgPool\": return new PostgresPoolDriverImpl({\n\t\t\tconnect: { pool: binding.pool },\n\t\t\tcursor: cursorOpts,\n\t\t\tpreparedStatements\n\t\t});\n\t\tcase \"pgClient\": return new PostgresDirectDriverImpl({\n\t\t\tconnect: { client: binding.client },\n\t\t\tcursor: cursorOpts,\n\t\t\tpreparedStatements\n\t\t});\n\t}\n}\nfunction readCursor(cursor, size) {\n\treturn callbackToPromise((cb) => {\n\t\tcursor.read(size, (err, rows) => cb(err, rows));\n\t});\n}\nfunction closeCursor(cursor) {\n\treturn callbackToPromise((cb) => cursor.close(cb));\n}\nfunction rethrowNormalizedError(error) {\n\tthrow normalizePgError(error);\n}\nfunction prepareFailedError(retryError, handle) {\n\tconst cause = normalizePgError(retryError);\n\treturn Object.assign(driverError(\"DRIVER.PREPARE_FAILED\", `Prepared statement failed again after re-preparing with a fresh handle: ${cause.message}`, { handle }), { cause });\n}\n//#endregion\n//#region src/exports/runtime.ts\nconst USE_BEFORE_CONNECT_MESSAGE = \"Postgres driver not connected. Call connect(binding) before acquireConnection or execute.\";\nconst ALREADY_CONNECTED_MESSAGE = \"Postgres driver already connected. Call close() before reconnecting with a new binding.\";\nfunction unboundQuery() {\n\treturn { [Symbol.asyncIterator]() {\n\t\treturn { async next() {\n\t\t\tthrow driverError(\"DRIVER.NOT_CONNECTED\", USE_BEFORE_CONNECT_MESSAGE);\n\t\t} };\n\t} };\n}\nvar PostgresUnboundDriverImpl = class {\n\tfamilyId = \"sql\";\n\ttargetId = \"postgres\";\n\t#delegate = null;\n\t#closed = false;\n\t#cursorOpts;\n\t#preparedStatements;\n\tconstructor(options) {\n\t\tthis.#cursorOpts = options?.cursor;\n\t\tthis.#preparedStatements = options?.preparedStatements;\n\t}\n\tget state() {\n\t\tif (this.#delegate !== null) return \"connected\";\n\t\tif (this.#closed) return \"closed\";\n\t\treturn \"unbound\";\n\t}\n\t#requireDelegate() {\n\t\tconst delegate = this.#delegate;\n\t\tif (delegate === null) throw driverError(\"DRIVER.NOT_CONNECTED\", USE_BEFORE_CONNECT_MESSAGE);\n\t\treturn delegate;\n\t}\n\tasync connect(binding) {\n\t\tif (this.#delegate !== null) throw driverError(\"DRIVER.ALREADY_CONNECTED\", ALREADY_CONNECTED_MESSAGE, { bindingKind: binding.kind });\n\t\tthis.#delegate = createBoundDriverFromBinding(binding, this.#cursorOpts, { preparedStatements: this.#preparedStatements });\n\t\tthis.#closed = false;\n\t}\n\tasync acquireConnection() {\n\t\tconst delegate = this.#requireDelegate();\n\t\tconst connection = await delegate.acquireConnection();\n\t\treturn this.#wrapConnection(connection, delegate);\n\t}\n\t/**\n\t* Wraps an acquired connection so that teardown paths which close the\n\t* underlying delegate (notably `destroy()` on a pgClient binding, where\n\t* the single socket means a destroyed connection invalidates the driver)\n\t* also reset our own `#delegate` reference. Without this, a failed\n\t* transaction rollback would leave the outer unbound wrapper reporting\n\t* `connected` while routing subsequent work to an already-ended delegate.\n\t*/\n\t#wrapConnection(connection, delegate) {\n\t\tconst syncDelegateState = () => {\n\t\t\tif (this.#delegate === delegate && delegate.state === \"closed\") {\n\t\t\t\tthis.#delegate = null;\n\t\t\t\tthis.#closed = true;\n\t\t\t}\n\t\t};\n\t\tconst wrapped = {\n\t\t\tbeginTransaction: connection.beginTransaction.bind(connection),\n\t\t\tquery: connection.query.bind(connection),\n\t\t\texecute: connection.execute.bind(connection),\n\t\t\trelease: async () => {\n\t\t\t\ttry {\n\t\t\t\t\tawait connection.release();\n\t\t\t\t} finally {\n\t\t\t\t\tsyncDelegateState();\n\t\t\t\t}\n\t\t\t},\n\t\t\tdestroy: async (reason) => {\n\t\t\t\ttry {\n\t\t\t\t\tawait connection.destroy(reason);\n\t\t\t\t} finally {\n\t\t\t\t\tsyncDelegateState();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tif (connection.explain) wrapped.explain = connection.explain.bind(connection);\n\t\treturn wrapped;\n\t}\n\tasync close() {\n\t\tconst delegate = this.#delegate;\n\t\tif (delegate !== null) {\n\t\t\tthis.#delegate = null;\n\t\t\tawait delegate.close();\n\t\t}\n\t\tthis.#closed = true;\n\t}\n\tquery(request) {\n\t\tconst delegate = this.#delegate;\n\t\treturn delegate === null ? unboundQuery() : delegate.query(request);\n\t}\n\tasync execute(request) {\n\t\tconst delegate = this.#delegate;\n\t\tif (delegate === null) throw driverError(\"DRIVER.NOT_CONNECTED\", USE_BEFORE_CONNECT_MESSAGE);\n\t\treturn delegate.execute(request);\n\t}\n\tasync explain(request) {\n\t\tconst delegate = this.#requireDelegate();\n\t\tconst explain = delegate.explain;\n\t\tif (explain === void 0) throw driverError(\"DRIVER.NOT_CONNECTED\", USE_BEFORE_CONNECT_MESSAGE);\n\t\treturn explain.call(delegate, request);\n\t}\n};\nconst postgresRuntimeDriverDescriptor = {\n\t...postgresDriverDescriptorMeta,\n\tcreate(options) {\n\t\treturn new PostgresUnboundDriverImpl(options);\n\t}\n};\n//#endregion\nexport { postgresRuntimeDriverDescriptor as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;AAKA,SAAS,YAAY,MAAM,SAAS,SAAS;CAC5C,MAAM,QAAQ,IAAI,MAAM,OAAO;CAC/B,OAAO,eAAe,OAAO,QAAQ;EACpC,OAAO;EACP,cAAc;CACf,CAAC;CACD,OAAO,YAAY,KAAK,IAAI,OAAO,OAAO,OAAO;EAChD;EACA,UAAU;EACV,UAAU;CACX,CAAC,IAAI,OAAO,OAAO,OAAO;EACzB;EACA,UAAU;EACV,UAAU;EACV;CACD,CAAC;AACF;AAGA,SAAS,kBAAkB,IAAI;CAC9B,OAAO,IAAI,SAAS,SAAS,WAAW;EACvC,IAAI,KAAK,WAAW;GACnB,IAAI,KAAK;IACR,OAAO,GAAG;IACV;GACD;GACA,QAAQ,MAAM;EACf,CAAC;CACF,CAAC;AACF;AAGA,IAAI,oBAAoB;;AAExB,IAAI,cAAc,cAAc,OAAO;CACtC;CACA,YAAY,MAAM;EACjB,MAAM,KAAK,MAAM,CAAC,GAAG,KAAK,MAAM,GAAG,KAAK,MAAM;EAC9C,KAAK,OAAO,KAAK;EACjB,KAAK,SAAS,KAAK;CACpB;CACA,YAAY,YAAY;EACvB,MAAM,OAAO;EACb,MAAM,OAAO;EACb,KAAK,QAAQ;EACb,KAAK,aAAa;EAClB,KAAK,UAAU,MAAM;EACrB,IAAI,CAAC,KAAK,iBAAiB,KAAK,OAAO;GACtC,MAAM,eAAe;IACpB,MAAM,KAAK;IACX,MAAM,KAAK;IACX,OAAO,CAAC;GACT;GACA,KAAK,MAAM,cAAc,IAAI;EAC9B;EACA,MAAM,cAAc;GACnB,QAAQ,KAAK;GACb,WAAW,KAAK;GAChB,QAAQ,KAAK,UAAU,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AACD;AACA,MAAM,kCAAkC;CACvC,GAAG;CACH,OAAO,SAAS;EACf,OAAO,IAAI,0BAA0B,OAAO;CAC7C;AACD"}
@@ -1,39 +0,0 @@
1
- import { structuredError } from "@prisma/orm-framework/utils/structured-error";
2
- import { CliStructuredError } from "@prisma/orm-framework/errors/control";
3
- //#region ../../../3-targets/3-targets/postgres/dist/errors-DKjQzNaN.mjs
4
- function postgresError(code, message, options) {
5
- return structuredError(code, message, options);
6
- }
7
- /**
8
- * A `PostgresMigration` operation that needs the materialized control adapter
9
- * — named by `operation` (e.g. `createTable`, `dropColumn`, `dataTransform`) —
10
- * was invoked, but the migration was constructed without a `ControlStack`.
11
- * Concrete authoring usage always goes through the migration CLI entrypoint,
12
- * which assembles a stack from the loaded `prisma.config.ts`; reaching this
13
- * error means a test fixture or ad-hoc consumer instantiated `PostgresMigration`
14
- * with the no-arg form (legal for `operations` / `describe` introspection only).
15
- *
16
- * The `operation` argument is required so every throw site names the operation
17
- * that actually failed; a new operation cannot inherit a misattributed message.
18
- *
19
- * Distinct from `MIGRATION.UNFILLED_PLACEHOLDER` (placeholder not filled)
20
- * and `MIGRATION.DATA_TRANSFORM_CONTRACT_MISMATCH` (data-transform query
21
- * plan against wrong contract) because the missing input is the stack
22
- * itself, not the per-operation contract.
23
- *
24
- * Lives in `@internal/target-postgres/errors` rather than the shared
25
- * framework migration errors module because the failure is target-specific:
26
- * the contract it talks about (`PostgresMigration`, the Postgres control
27
- * adapter, the Postgres-target stack) only exists in this package.
28
- */
29
- function errorPostgresMigrationStackMissing(operation) {
30
- return new CliStructuredError("MIGRATION.POSTGRES_CONTROL_STACK_MISSING", `PostgresMigration.${operation} requires a control adapter`, {
31
- why: `PostgresMigration.${operation} was invoked on an instance constructed without a ControlStack, so the stored controlAdapter is undefined and the operation cannot lower its plan.`,
32
- fix: "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.",
33
- meta: { operation }
34
- });
35
- }
36
- //#endregion
37
- export { postgresError as n, errorPostgresMigrationStackMissing as t };
38
-
39
- //# sourceMappingURL=errors-DKjQzNaN-DFcF1thx.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors-DKjQzNaN-DFcF1thx.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/errors-DKjQzNaN.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}\n//#endregion\nexport { postgresError as n, errorPostgresMigrationStackMissing as t };\n\n//# sourceMappingURL=errors-DKjQzNaN.mjs.map"],"mappings":";;;AAGA,SAAS,cAAc,MAAM,SAAS,SAAS;CAC9C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,mCAAmC,WAAW;CACtD,OAAO,IAAI,mBAAmB,4CAA4C,qBAAqB,UAAU,8BAA8B;EACtI,KAAK,qBAAqB,UAAU;EACpC,KAAK;EACL,MAAM,EAAE,UAAU;CACnB,CAAC;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"pack-CySS3DQU.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/pack.d.mts"],"mappings":";;;;;;;;;UAQU,gCAAgC;WAC/B;;;;;;;WAOA,oBAAoB;;;UAGrB,2BAA2B;WAC1B;;;;;;;;;;;;;iBAaM,2BAA2B,OAAO,qCAAqC;;;cAG1E;WACH;WACA,yDAAyD,iBAAiB,uBAAuB;aAC/F;OACN;aACM;OACN;aACM;OACN;aACM;OACN;aACM;OACN;aACM;;WAEF;aACE;eACE;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;mBACE;mBACA;qBACE;qBACA;;mBAEF;qBACE;;;;;aAKR;eACE;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;uBAIN;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;;;;iBAOZ;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;uBAIN;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;;;;iBAOZ;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;uBACA;;;;iBAIN;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;uBAEF;yBACE;yBACA;;;;;;eAMV;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;;;iBAGJ;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;;;;;aAKR;eACE;iBACE;iBACA;iBACA,+DAA+D;UACtE;UACA;UACA;UACA;;iBAEO;mBACE,UAAU,OAAO,oBAAoB,wDAAwD,2BAA2B;;;eAG5H;iBACE;iBACA;iBACA,+DAA+D;UACtE;UACA;UACA;;iBAEO;mBACE,UAAU,OAAO,+BAA+B;;;eAGpD;iBACE;iBACA;iBACA,+DAA+D;UACtE;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;iBAEO;mBACE,UAAU,OAAO,yBAAyB,wDAAwD,2BAA2B;;;eAGjI;iBACE;iBACA;iBACA,+DAA+D;UACtE;UACA;UACA;UACA;;iBAEO;UACP,UAAU,sCAAsC,mBAAmB,wDAAwD,2BAA2B;UACtJ,iBAAiB,QAAQ;YACvB;YACA;;;;;aAKC;eACE;iBACE;iBACA;iBACA;iBACA;mBACE;;iBAEF;mBACE;qBACE;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;uBACE;uBACA;uBACA;;;mBAGJ;qBACE;qBACA;qBACA;;mBAEF;qBACE;qBACA;;;iBAGJ;mBACE;mBACA;;;eAGJ;iBACE;iBACA;iBACA;iBACA;mBACE;;iBAEF;mBACE;qBACE;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;uBACE;uBACA;uBACA;;;mBAGJ;qBACE;qBACA;qBACA;;mBAEF;qBACE;qBACA;;;iBAGJ;mBACE;mBACA;;;eAGJ;iBACE;iBACA;iBACA;iBACA;mBACE;;iBAEF;mBACE;qBACE;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;uBACE;uBACA;uBACA;;;mBAGJ;qBACE;qBACA;qBACA;;mBAEF;qBACE;qBACA;;;iBAGJ;mBACE;mBACA;;;eAGJ;iBACE;iBACA;iBACA;iBACA;mBACE;;iBAEF;mBACE;qBACE;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;uBACE;uBACA;uBACA;;;mBAGJ;qBACE;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;;mBAEF;qBACE;qBACA;;;iBAGJ;mBACE;mBACA;;;eAGJ;iBACE;iBACA;iBACA;iBACA;mBACE;;iBAEF;mBACE;qBACE;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;uBACE;uBACA;uBACA;;;mBAGJ;qBACE;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;;mBAEF;qBACE;qBACA;;;iBAGJ;mBACE;mBACA;;;eAGJ;iBACE;iBACA;iBACA;iBACA;mBACE;;iBAEF;iBACA;;eAEF;iBACE;iBACA;iBACA;iBACA;mBACE;;iBAEF;;;aAGJ;eACE;iBACE;iBACA;iBACA,qCAAqC;iBACrC,QAAQ,SAAS,sBAAsB,wDAAwD;UACtG;UACA,QAAQ;;;;aAIL,wBAAwB;aACxB,0BAA0B;aAC1B,+BAA+B;aAC/B,2BAA2B;;WAE7B;WACA;WACA;WACA;WACA;WACA;WACA,eAAe;;cAEZ,qCAAqC;WACxC,eAAe"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-_TfO66h5.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/runtime.d.mts"],"mappings":";;;;;;;;;;;cAUc,mCAAmC,0BAA0B,SAAS;EAClF,qBAAqB;EACrB,YAAY,gCAAgC;YAClC,yBAAyB,cAAc,KAAK,0BAA0B,YAAY;EAC5F,kBAAkB,UAAU,SAAS,cAAc;;;;UAI3C,sCAAsC;;;;;;;cAOlC,iCAAiC,2CAA2C;WAC/E,uBAAuB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-lHBKgjB9.d.mts","names":[],"sources":["../../../../3-targets/7-drivers/postgres/dist/runtime.d.mts"],"mappings":";;;;;KAIK,cAAY,UAAU,iBAAiB,kBAAkB,YAAc;;;;;;;;;;;;;KAavE;WACM;WACA;;WAEA;WACA,MAAM;;WAEN;WACA,QAAQ;;UAET;WACC;WACA;;UAED;WACC;IACP,QAAQ;;IAER,MAAM;;WAEC,SAAS;;;;;;;;WAQT;;KAEN,8BAA8B,KAAK;;;KAGnC,wBAAwB,2CAA2C,UAAU;cACpE,iCAAiC,2CAA2C,6BAA6B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sql-renderer-ComgusFq-BBlqM1fw.mjs","names":[],"sources":["../../../../3-targets/6-adapters/postgres/dist/sql-renderer-ComgusFq.mjs"],"sourcesContent":["import { LiteralExpr, collectOrderedParamRefs } from \"@internal/sql-relational-core/ast\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { isPgEnumParams } from \"@internal/target-postgres/codecs\";\nimport { escapeLiteral, quoteIdentifier, quoteQualifiedName } from \"@internal/target-postgres/sql-utils\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError, assertNever } from \"@internal/utils/internal-error\";\nimport { runtimeError } from \"@internal/framework-components/runtime\";\n//#region src/core/adapter-errors.ts\nfunction adapterError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/core/sql-renderer.ts\n/**\n* Postgres native types whose unknown-OID parameter inference is reliable in arbitrary expression positions. Parameters bound to a descriptor whose `nativeTypeFor` result falls in this set are emitted as plain `$N`; everything else (including `json`, `jsonb`, extension types like `vector`, and unknown user types) is emitted as `$N::<nativeType>` so the planner picks an unambiguous overload.\n*\n* `json` / `jsonb` are intentionally excluded despite being Postgres builtins: their operator overloads make context inference unreliable in expression positions (e.g. `$1 -> 'key'` is ambiguous between the two).\n*\n* Spellings match the target descriptors' `nativeTypeFor` results, not the `udt_name` abbreviations that ADR 205 used as illustrative shorthand. The registry-based cast policy compares against these strings directly.\n*/\nconst POSTGRES_INFERRABLE_NATIVE_TYPES = /* @__PURE__ */ new Set([\n\t\"integer\",\n\t\"smallint\",\n\t\"bigint\",\n\t\"real\",\n\t\"double precision\",\n\t\"numeric\",\n\t\"boolean\",\n\t\"text\",\n\t\"character\",\n\t\"character varying\",\n\t\"timestamp\",\n\t\"timestamp without time zone\",\n\t\"timestamp with time zone\",\n\t\"time\",\n\t\"timetz\",\n\t\"interval\",\n\t\"bit\",\n\t\"bit varying\"\n]);\nfunction renderTypedParam(index, codecId, codecDescriptorRegistry, many, typeParams) {\n\tif (codecId === void 0) return `$${index}`;\n\tconst descriptor = codecDescriptorRegistry.descriptorFor(codecId);\n\tif (descriptor === void 0) throw adapterError(\"RUNTIME.PARAM_REF_MISSING_CODEC\", `Postgres lowering: ParamRef carries codecId \"${codecId}\" but the validated PostgreSQL codec registry has no entry for it. This usually indicates a missing extension pack in the runtime stack — register the pack that contributes this codec (e.g. \\`extensions: [pgvectorRuntime]\\`), or use the codec directly from \\`@internal/target-postgres/codecs\\` if it's a builtin.`, { meta: { codecId } });\n\tconst ref = {\n\t\tcodecId,\n\t\t...ifDefined(\"many\", many),\n\t\t...ifDefined(\"typeParams\", typeParams)\n\t};\n\tconst nativeType = descriptor.nativeTypeFor(ref);\n\tconst arraySuffix = many ? \"[]\" : \"\";\n\tif (isPgEnumParams(typeParams)) return `$${index}::${quoteQualifiedName(nativeType)}${arraySuffix}`;\n\tif (!POSTGRES_INFERRABLE_NATIVE_TYPES.has(nativeType) || many) return `$${index}::${nativeType}${arraySuffix}`;\n\treturn `$${index}`;\n}\nfunction unreachableKind(value) {\n\tconst candidate = value;\n\tif (typeof candidate === \"object\" && candidate !== null && \"kind\" in candidate && typeof candidate.kind === \"string\") return candidate.kind;\n\treturn \"unknown\";\n}\n/**\n* Render a SQL query AST to a Postgres-flavored `{ sql, params }` payload.\n*\n* Shared between the runtime (`PostgresAdapterImpl.lower`) and control (`PostgresControlAdapter.lower`) entrypoints so emit-time and run-time paths produce byte-identical output for the same AST.\n*/\nfunction renderLoweredSql(ast, contract, codecDescriptorRegistry) {\n\tconst orderedRefs = collectOrderedParamRefs(ast);\n\tconst indexMap = /* @__PURE__ */ new Map();\n\tconst params = orderedRefs.map((ref, i) => {\n\t\tindexMap.set(ref, i + 1);\n\t\treturn ref.kind === \"prepared-param-ref\" ? {\n\t\t\tkind: \"bind\",\n\t\t\tname: ref.name\n\t\t} : {\n\t\t\tkind: \"literal\",\n\t\t\tvalue: ref.value\n\t\t};\n\t});\n\tconst pim = {\n\t\tindexMap,\n\t\tcodecDescriptorRegistry\n\t};\n\tconst node = ast;\n\tlet sql;\n\tswitch (node.kind) {\n\t\tcase \"select\":\n\t\t\tsql = renderSelect(node, contract, pim);\n\t\t\tbreak;\n\t\tcase \"insert\":\n\t\t\tsql = renderInsert(node, contract, pim);\n\t\t\tbreak;\n\t\tcase \"update\":\n\t\t\tsql = renderUpdate(node, contract, pim);\n\t\t\tbreak;\n\t\tcase \"delete\":\n\t\t\tsql = renderDelete(node, contract, pim);\n\t\t\tbreak;\n\t\tcase \"raw-query\":\n\t\t\tsql = renderParts(node.parts, contract, pim);\n\t\t\tbreak;\n\t\t// v8 ignore next 4\n\t\tdefault: assertNever(node, `Unsupported AST node kind: ${unreachableKind(node)}`);\n\t}\n\treturn Object.freeze({\n\t\tsql,\n\t\tparams: Object.freeze(params)\n\t});\n}\nfunction renderLimitOffset(keyword, value, contract, pim) {\n\tif (value === void 0) return \"\";\n\tif (typeof value === \"number\") return `${keyword} ${value}`;\n\treturn `${keyword} ${renderExpr(value, contract, pim)}`;\n}\nfunction renderSelect(ast, contract, pim) {\n\tconst sourcesByRef = collectTableSources(ast);\n\treturn [\n\t\t`SELECT ${renderDistinctPrefix(ast.distinct, ast.distinctOn, sourcesByRef, contract, pim)}${renderProjection(ast.projection, contract, pim)}`,\n\t\tast.from !== void 0 ? `FROM ${renderSource(ast.from, contract, pim)}` : \"\",\n\t\tast.joins?.length ? ast.joins.map((join) => renderJoin(join, contract, pim)).join(\" \") : \"\",\n\t\tast.where ? `WHERE ${renderWhere(ast.where, contract, pim)}` : \"\",\n\t\tast.groupBy?.length ? `GROUP BY ${ast.groupBy.map((expr) => renderExpr(expr, contract, pim)).join(\", \")}` : \"\",\n\t\tast.having ? `HAVING ${renderWhere(ast.having, contract, pim)}` : \"\",\n\t\tast.orderBy?.length ? `ORDER BY ${ast.orderBy.map((order) => {\n\t\t\treturn `${renderOrderByExpr(order.expr, sourcesByRef, contract, pim)} ${order.dir.toUpperCase()}`;\n\t\t}).join(\", \")}` : \"\",\n\t\trenderLimitOffset(\"LIMIT\", ast.limit, contract, pim),\n\t\trenderLimitOffset(\"OFFSET\", ast.offset, contract, pim)\n\t].filter((part) => part.length > 0).join(\" \").trim();\n}\n/**\n* Map a SELECT's table references (the FROM source and any JOIN sources) to their storage coordinate, keyed by the name a `ColumnRef.table` would carry (the alias when present, otherwise the table name). Derived-table sources are skipped — their columns are projected through a sub-select, not a base storage column, so the enum hook does not apply.\n*/\nfunction collectTableSources(ast) {\n\tconst sources = /* @__PURE__ */ new Map();\n\tconst add = (source) => {\n\t\tif (source.kind !== \"table-source\") return;\n\t\tconst ref = source.alias ?? source.name;\n\t\tsources.set(ref, {\n\t\t\tname: source.name,\n\t\t\tnamespaceId: source.namespaceId\n\t\t});\n\t};\n\tif (ast.from !== void 0) add(ast.from);\n\tfor (const join of ast.joins ?? []) add(join.source);\n\treturn sources;\n}\n/**\n* Ordered, codec-encoded values of the value-set a storage column restricts to, or `undefined` when the referenced column carries no value-set (the common, non-enum case). Resolves the column's storage coordinate from the SELECT's table sources, then the column's `valueSet` ref to the value-set's `values`.\n*/\nfunction allStrings(values) {\n\treturn values.every((value) => typeof value === \"string\");\n}\nfunction resolveEnumOrderValues(ref, sourcesByRef, contract) {\n\tconst source = sourcesByRef.get(ref.table);\n\tif (source === void 0 || source.namespaceId === void 0) return;\n\tconst sourceNs = contract.storage.namespaces[source.namespaceId];\n\tconst valueSet = (sourceNs !== void 0 ? sourceNs.entries.table?.[source.name]?.columns[ref.column] : void 0)?.valueSet;\n\tif (valueSet === void 0) return;\n\tconst valueSetNs = contract.storage.namespaces[valueSet.namespaceId];\n\treturn valueSetNs !== void 0 ? valueSetNs.entries.valueSet?.[valueSet.entityName]?.values : void 0;\n}\n/**\n* Ordered values for an unqualified ORDER BY column (an `identifier-ref`, the shape the sql-builder emits for `.orderBy('col')`). Scans every FROM/JOIN source for a column of that name. Resolves only when exactly one source has a column of that name and it carries a value-set; if more than one source has such a column the bare identifier is ambiguous (regardless of which are enum-backed), so it falls through to the plain column rendering.\n*/\nfunction resolveEnumOrderValuesForIdentifier(name, sourcesByRef, contract) {\n\tlet matchedColumns = 0;\n\tlet resolved;\n\tfor (const source of sourcesByRef.values()) {\n\t\tif (source.namespaceId === void 0) continue;\n\t\tconst identNs = contract.storage.namespaces[source.namespaceId];\n\t\tconst column = identNs !== void 0 ? identNs.entries.table?.[source.name]?.columns[name] : void 0;\n\t\tif (column === void 0) continue;\n\t\tmatchedColumns += 1;\n\t\tif (matchedColumns > 1) return;\n\t\tconst valueSet = column.valueSet;\n\t\tif (valueSet === void 0) return;\n\t\tconst valueSetNs = contract.storage.namespaces[valueSet.namespaceId];\n\t\tresolved = valueSetNs !== void 0 ? valueSetNs.entries.valueSet?.[valueSet.entityName]?.values : void 0;\n\t}\n\treturn resolved;\n}\n/**\n* Render an ORDER BY expression. A column reference onto an enum-restricted column sorts by declaration order via `array_position(ARRAY[…]::text[], <col>)` over the value-set's ordered values (NULLs return `NULL` from `array_position`, sorting per the clause's default NULL handling). Both qualified `column-ref`s and the unqualified `identifier-ref`s the sql-builder emits for `.orderBy('col')` are intercepted. Every other expression renders unchanged.\n*/\nfunction renderOrderByExpr(expr, sourcesByRef, contract, pim) {\n\tif (expr.kind === \"column-ref\") {\n\t\tconst orderValues = resolveEnumOrderValues(expr, sourcesByRef, contract);\n\t\tif (orderValues !== void 0 && allStrings(orderValues)) return `array_position(ARRAY[${orderValues.map((value) => `'${escapeLiteral(value)}'`).join(\", \")}]::text[], ${renderColumn(expr)})`;\n\t}\n\tif (expr.kind === \"identifier-ref\") {\n\t\tconst orderValues = resolveEnumOrderValuesForIdentifier(expr.name, sourcesByRef, contract);\n\t\tif (orderValues !== void 0 && allStrings(orderValues)) return `array_position(ARRAY[${orderValues.map((value) => `'${escapeLiteral(value)}'`).join(\", \")}]::text[], ${quoteIdentifier(expr.name)})`;\n\t}\n\treturn renderExpr(expr, contract, pim);\n}\nfunction renderProjection(projection, contract, pim) {\n\treturn projection.map((item) => {\n\t\tconst alias = quoteIdentifier(item.alias);\n\t\tif (item.expr.kind === \"literal\") return `${renderLiteral(item.expr)} AS ${alias}`;\n\t\treturn `${renderExpr(item.expr, contract, pim)} AS ${alias}`;\n\t}).join(\", \");\n}\nfunction renderReturning(items, contract, pim) {\n\treturn items.map((item) => {\n\t\tif (item.expr.kind === \"column-ref\") {\n\t\t\tconst rendered = renderColumn(item.expr);\n\t\t\treturn item.expr.column === item.alias ? rendered : `${rendered} AS ${quoteIdentifier(item.alias)}`;\n\t\t}\n\t\tif (item.expr.kind === \"literal\") return `${renderLiteral(item.expr)} AS ${quoteIdentifier(item.alias)}`;\n\t\treturn `${renderExpr(item.expr, contract, pim)} AS ${quoteIdentifier(item.alias)}`;\n\t}).join(\", \");\n}\nfunction renderDistinctPrefix(distinct, distinctOn, sourcesByRef, contract, pim) {\n\tif (distinctOn && distinctOn.length > 0) return `DISTINCT ON (${distinctOn.map((expr) => renderOrderByExpr(expr, sourcesByRef, contract, pim)).join(\", \")}) `;\n\tif (distinct) return \"DISTINCT \";\n\treturn \"\";\n}\nfunction hasExplicitSchema(table) {\n\treturn \"schema\" in table && typeof table.schema === \"string\";\n}\nfunction qualifyTableFromNamespaceCoordinate(table, contract) {\n\tif (hasExplicitSchema(table)) return `${quoteIdentifier(table.schema)}.${quoteIdentifier(table.name)}`;\n\tif (table.namespaceId === void 0) return quoteIdentifier(table.name);\n\tconst namespace = contract.storage.namespaces[table.namespaceId];\n\tif (namespace === void 0) throw adapterError(\"RUNTIME.NAMESPACE_UNKNOWN\", `Table \"${table.name}\" references namespace \"${table.namespaceId}\" which is not present as a Postgres schema on the contract`, { meta: {\n\t\ttable: table.name,\n\t\tnamespaceId: table.namespaceId,\n\t\treason: \"not-present\"\n\t} });\n\tconst qualifyTable = namespace.qualifyTable;\n\tif (qualifyTable === void 0) throw adapterError(\"RUNTIME.NAMESPACE_UNKNOWN\", `Table \"${table.name}\" references namespace \"${table.namespaceId}\" which is not materialised as a Postgres schema on the contract`, { meta: {\n\t\ttable: table.name,\n\t\tnamespaceId: table.namespaceId,\n\t\treason: \"not-materialised\"\n\t} });\n\treturn qualifyTable.call(namespace, table.name);\n}\nfunction renderTableSource(source, contract) {\n\tconst qualified = qualifyTableFromNamespaceCoordinate(source, contract);\n\tif (!source.alias) return qualified;\n\treturn `${qualified} AS ${quoteIdentifier(source.alias)}`;\n}\nfunction renderSource(source, contract, pim) {\n\tconst node = source;\n\tswitch (node.kind) {\n\t\tcase \"table-source\": return renderTableSource(node, contract);\n\t\tcase \"derived-table-source\": return `(${renderSelect(node.query, contract, pim)}) AS ${quoteIdentifier(node.alias)}`;\n\t\tcase \"function-source\": {\n\t\t\tconst args = node.args.map((arg) => renderExpr(arg, contract, pim)).join(\", \");\n\t\t\treturn `${`${node.fn}(${args})`}${node.ordinality ? \" WITH ORDINALITY\" : \"\"}${node.alias === void 0 ? \"\" : ` AS ${quoteIdentifier(node.alias)}`}${node.columnAliases === void 0 ? \"\" : `(${node.columnAliases.map((column) => quoteIdentifier(column)).join(\", \")})`}`;\n\t\t}\n\t\t// v8 ignore next 4\n\t\tdefault: assertNever(node, `Unsupported source node kind: ${unreachableKind(node)}`);\n\t}\n}\nfunction assertScalarSubquery(query) {\n\tif (query.projection.length !== 1) throw adapterError(\"RUNTIME.AST_INVALID\", \"Subquery expressions must project exactly one column\", { meta: { node: \"subquery-expr\" } });\n}\nfunction renderSubqueryExpr(expr, contract, pim) {\n\tassertScalarSubquery(expr.query);\n\treturn `(${renderSelect(expr.query, contract, pim)})`;\n}\nfunction renderWhere(expr, contract, pim) {\n\treturn renderExpr(expr, contract, pim);\n}\nfunction renderNullCheck(expr, contract, pim) {\n\tconst rendered = renderExpr(expr.expr, contract, pim);\n\tconst renderedExpr = isAtomicExpressionKind(expr.expr.kind) ? rendered : `(${rendered})`;\n\treturn expr.isNull ? `${renderedExpr} IS NULL` : `${renderedExpr} IS NOT NULL`;\n}\n/**\n* Atomic expression kinds whose rendered SQL is already self-delimited (a column reference, parameter, literal, function call, aggregate, etc.) and therefore does not need surrounding parentheses when used as the left operand of a postfix predicate like `IS NULL` or `IS NOT NULL`, or as either operand of a binary infix operator.\n*\n* Anything not in this set is treated as composite (binary, AND/OR/NOT, EXISTS, nested IS NULL, subqueries, operation templates) and gets wrapped to preserve grouping.\n*/\nfunction isAtomicExpressionKind(kind) {\n\tswitch (kind) {\n\t\tcase \"column-ref\":\n\t\tcase \"identifier-ref\":\n\t\tcase \"param-ref\":\n\t\tcase \"prepared-param-ref\":\n\t\tcase \"literal\":\n\t\tcase \"aggregate\":\n\t\tcase \"window-func\":\n\t\tcase \"function-call\":\n\t\tcase \"cast\":\n\t\tcase \"case\":\n\t\tcase \"json-object\":\n\t\tcase \"json-array-agg\":\n\t\tcase \"list\": return true;\n\t\tcase \"subquery\":\n\t\tcase \"operation\":\n\t\tcase \"binary\":\n\t\tcase \"and\":\n\t\tcase \"or\":\n\t\tcase \"exists\":\n\t\tcase \"null-check\":\n\t\tcase \"not\":\n\t\tcase \"raw-expr\": return false;\n\t}\n}\nfunction renderBinary(expr, contract, pim) {\n\tif (expr.right.kind === \"list\" && expr.right.values.length === 0) {\n\t\tif (expr.op === \"in\") return \"FALSE\";\n\t\tif (expr.op === \"notIn\") return \"TRUE\";\n\t}\n\tconst leftExpr = expr.left;\n\tconst left = renderExpr(leftExpr, contract, pim);\n\tconst leftRendered = leftExpr.kind === \"operation\" || leftExpr.kind === \"subquery\" ? `(${left})` : left;\n\tconst rightNode = expr.right;\n\tlet right;\n\tswitch (rightNode.kind) {\n\t\tcase \"list\":\n\t\t\tright = renderListLiteral(rightNode, contract, pim);\n\t\t\tbreak;\n\t\tcase \"literal\":\n\t\t\tright = renderLiteral(rightNode);\n\t\t\tbreak;\n\t\tcase \"column-ref\":\n\t\t\tright = renderColumn(rightNode);\n\t\t\tbreak;\n\t\tcase \"param-ref\":\n\t\tcase \"prepared-param-ref\":\n\t\t\tright = renderParamRef(rightNode, pim);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tright = renderExpr(rightNode, contract, pim);\n\t\t\tbreak;\n\t}\n\treturn `${leftRendered} ${{\n\t\teq: \"=\",\n\t\tneq: \"!=\",\n\t\tgt: \">\",\n\t\tlt: \"<\",\n\t\tgte: \">=\",\n\t\tlte: \"<=\",\n\t\tlike: \"LIKE\",\n\t\tin: \"IN\",\n\t\tnotIn: \"NOT IN\"\n\t}[expr.op]} ${right}`;\n}\nfunction renderListLiteral(expr, contract, pim) {\n\tif (expr.values.length === 0) return \"(NULL)\";\n\treturn `(${expr.values.map((v) => {\n\t\tif (v.kind === \"param-ref\" || v.kind === \"prepared-param-ref\") return renderParamRef(v, pim);\n\t\tif (v.kind === \"literal\") return renderLiteral(v);\n\t\treturn renderExpr(v, contract, pim);\n\t}).join(\", \")})`;\n}\nfunction renderColumn(ref) {\n\tif (ref.table === \"excluded\") return `excluded.${quoteIdentifier(ref.column)}`;\n\treturn `${quoteIdentifier(ref.table)}.${quoteIdentifier(ref.column)}`;\n}\nfunction renderAggregateExpr(expr, contract, pim) {\n\tconst fn = expr.fn.toUpperCase();\n\tif (!expr.expr) return `${fn}(*)`;\n\treturn `${fn}(${renderExpr(expr.expr, contract, pim)})`;\n}\nfunction renderWindowFuncExpr(expr, contract, pim) {\n\treturn `${expr.fn.toUpperCase()}(${expr.args.map((arg) => renderExpr(arg, contract, pim)).join(\", \")}) OVER (${[expr.partitionBy && expr.partitionBy.length > 0 ? `PARTITION BY ${expr.partitionBy.map((e) => renderExpr(e, contract, pim)).join(\", \")}` : \"\", expr.orderBy && expr.orderBy.length > 0 ? `ORDER BY ${renderOrderByItems(expr.orderBy, contract, pim)}` : \"\"].filter((part) => part.length > 0).join(\" \")})`;\n}\nfunction renderFunctionCallExpr(expr, contract, pim) {\n\tconst args = expr.args.map((arg) => renderExpr(arg, contract, pim)).join(\", \");\n\treturn `${expr.fn}(${args})`;\n}\nfunction renderCastExpr(expr, contract, pim) {\n\treturn `CAST(${renderExpr(expr.expr, contract, pim)} AS ${expr.targetType})`;\n}\nfunction renderCaseExpr(expr, contract, pim) {\n\treturn `CASE ${expr.branches.map((branch) => `WHEN ${renderExpr(branch.condition, contract, pim)} THEN ${renderExpr(branch.value, contract, pim)}`).join(\" \")}${expr.elseExpr === void 0 ? \"\" : ` ELSE ${renderExpr(expr.elseExpr, contract, pim)}`} END`;\n}\nfunction renderJsonValueProjection(projection, contract, pim) {\n\treturn projection.accept({\n\t\tcodec: ({ value, codec }) => renderExpr(projectJsonThroughCodec(value, codec, pim), contract, pim),\n\t\tnative: ({ value }) => renderExpr(value, contract, pim),\n\t\tdocument: ({ value }) => renderExpr(value, contract, pim)\n\t});\n}\nfunction projectJsonThroughCodec(value, codec, pim) {\n\tconst descriptor = pim.codecDescriptorRegistry.descriptorFor(codec.codecId);\n\tif (descriptor === void 0) throw adapterError(\"RUNTIME.PARAM_REF_MISSING_CODEC\", `Postgres lowering: a JSON projection carries codecId \"${codec.codecId}\" but the validated PostgreSQL codec registry has no entry for it. This usually indicates a missing extension pack in the runtime stack — register the pack that contributes this codec (e.g. \\`extensions: [pgvectorRuntime]\\`), or use the codec directly from \\`@internal/target-postgres/codecs\\` if it's a builtin.`, { meta: { codecId: codec.codecId } });\n\treturn descriptor.projectJson(value, codec);\n}\nfunction renderJsonObjectExpr(expr, contract, pim) {\n\treturn `json_build_object(${expr.entries.flatMap((entry) => {\n\t\treturn [`'${escapeLiteral(entry.key)}'`, renderJsonValueProjection(entry.value, contract, pim)];\n\t}).join(\", \")})`;\n}\nfunction renderOrderByItems(items, contract, pim) {\n\treturn items.map((item) => `${renderExpr(item.expr, contract, pim)} ${item.dir.toUpperCase()}`).join(\", \");\n}\nfunction renderJsonArrayAggExpr(expr, contract, pim) {\n\tconst aggregateOrderBy = expr.orderBy && expr.orderBy.length > 0 ? ` ORDER BY ${renderOrderByItems(expr.orderBy, contract, pim)}` : \"\";\n\tconst aggregated = `json_agg(${renderJsonValueProjection(expr.expr, contract, pim)}${aggregateOrderBy})`;\n\tif (expr.onEmpty === \"emptyArray\") return `coalesce(${aggregated}, json_build_array())`;\n\treturn aggregated;\n}\nfunction renderExpr(expr, contract, pim) {\n\tconst node = expr;\n\tswitch (node.kind) {\n\t\tcase \"column-ref\": return renderColumn(node);\n\t\tcase \"identifier-ref\": return quoteIdentifier(node.name);\n\t\tcase \"operation\": return renderOperation(node, contract, pim);\n\t\tcase \"subquery\": return renderSubqueryExpr(node, contract, pim);\n\t\tcase \"aggregate\": return renderAggregateExpr(node, contract, pim);\n\t\tcase \"window-func\": return renderWindowFuncExpr(node, contract, pim);\n\t\tcase \"function-call\": return renderFunctionCallExpr(node, contract, pim);\n\t\tcase \"cast\": return renderCastExpr(node, contract, pim);\n\t\tcase \"case\": return renderCaseExpr(node, contract, pim);\n\t\tcase \"json-object\": return renderJsonObjectExpr(node, contract, pim);\n\t\tcase \"json-array-agg\": return renderJsonArrayAggExpr(node, contract, pim);\n\t\tcase \"binary\": return renderBinary(node, contract, pim);\n\t\tcase \"and\":\n\t\t\tif (node.exprs.length === 0) return \"TRUE\";\n\t\t\treturn `(${node.exprs.map((part) => renderExpr(part, contract, pim)).join(\" AND \")})`;\n\t\tcase \"or\":\n\t\t\tif (node.exprs.length === 0) return \"FALSE\";\n\t\t\treturn `(${node.exprs.map((part) => renderExpr(part, contract, pim)).join(\" OR \")})`;\n\t\tcase \"exists\": return `${node.notExists ? \"NOT \" : \"\"}EXISTS (${renderSelect(node.subquery, contract, pim)})`;\n\t\tcase \"null-check\": return renderNullCheck(node, contract, pim);\n\t\tcase \"not\": return `NOT (${renderExpr(node.expr, contract, pim)})`;\n\t\tcase \"param-ref\":\n\t\tcase \"prepared-param-ref\": return renderParamRef(node, pim);\n\t\tcase \"literal\": return renderLiteral(node);\n\t\tcase \"list\": return renderListLiteral(node, contract, pim);\n\t\tcase \"raw-expr\": return renderRawExpr(node, contract, pim);\n\t\t// v8 ignore next 4\n\t\tdefault: assertNever(node, `Unsupported expression node kind: ${unreachableKind(node)}`);\n\t}\n}\nfunction renderParamRef(ref, pim) {\n\tconst index = pim.indexMap.get(ref);\n\tif (index === void 0) throw new InternalError(\"ParamRef not found in index map\");\n\tif (ref.kind === \"prepared-param-ref\") return renderTypedParam(index, ref.codec.codecId, pim.codecDescriptorRegistry, ref.codec.many, ref.codec.typeParams);\n\tif (ref.codec === void 0) throw runtimeError(\"RUNTIME.PARAM_REF_MISSING_CODEC\", \"Postgres renderer: ParamRef reached lowering without a bound CodecRef. Every column-bound ParamRef must carry a codec under the AST-bound codec contract. This usually indicates a builder path that constructed a ParamRef without threading the column codec.\", {\n\t\tparamIndex: index,\n\t\t...ifDefined(\"name\", ref.name)\n\t});\n\treturn renderTypedParam(index, ref.codec.codecId, pim.codecDescriptorRegistry, ref.codec.many, ref.codec.typeParams);\n}\nfunction renderLiteral(expr) {\n\tif (typeof expr.value === \"string\") return `'${escapeLiteral(expr.value)}'`;\n\tif (typeof expr.value === \"number\" || typeof expr.value === \"boolean\") return String(expr.value);\n\tif (typeof expr.value === \"bigint\") return String(expr.value);\n\tif (expr.value === null) return \"NULL\";\n\tif (expr.value === void 0) return \"NULL\";\n\tif (expr.value instanceof Date) return `'${escapeLiteral(expr.value.toISOString())}'`;\n\tif (Array.isArray(expr.value)) return `ARRAY[${expr.value.map((v) => renderLiteral(new LiteralExpr(v))).join(\", \")}]`;\n\tconst json = JSON.stringify(expr.value);\n\tif (json === void 0) return \"NULL\";\n\treturn `'${escapeLiteral(json)}'`;\n}\nfunction renderOperation(expr, contract, pim) {\n\tconst self = renderExpr(expr.self, contract, pim);\n\tconst args = expr.args.map((arg) => {\n\t\treturn renderExpr(arg, contract, pim);\n\t});\n\treturn expr.lowering.template.replace(/\\{\\{self\\}\\}|\\{\\{arg(\\d+)\\}\\}/g, (token, argIndex) => {\n\t\tif (token === \"{{self}}\") return self;\n\t\tconst arg = args[Number(argIndex)];\n\t\tif (arg === void 0) throw adapterError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Operation lowering template for \"${expr.method}\" referenced missing argument {{arg${argIndex}}}; template has ${args.length} arg(s)`, { meta: { method: expr.method } });\n\t\treturn arg;\n\t});\n}\nfunction renderJoin(join, contract, pim) {\n\treturn `${join.joinType.toUpperCase()} JOIN ${join.lateral ? \"LATERAL \" : \"\"}${renderSource(join.source, contract, pim)} ON ${renderJoinOn(join.on, contract, pim)}`;\n}\nfunction renderJoinOn(on, contract, pim) {\n\tif (on.kind === \"eq-col-join-on\") return `${renderColumn(on.left)} = ${renderColumn(on.right)}`;\n\treturn renderWhere(on, contract, pim);\n}\nfunction getInsertColumnOrder(rows, contract, tableRef) {\n\tconst tableName = tableRef.name;\n\tconst orderedColumns = [];\n\tconst seenColumns = /* @__PURE__ */ new Set();\n\tfor (const row of rows) for (const column of Object.keys(row)) {\n\t\tif (seenColumns.has(column)) continue;\n\t\tseenColumns.add(column);\n\t\torderedColumns.push(column);\n\t}\n\tif (orderedColumns.length > 0) return orderedColumns;\n\tlet table;\n\tif (tableRef.namespaceId !== void 0) {\n\t\tconst ns = contract.storage.namespaces[tableRef.namespaceId];\n\t\ttable = ns !== void 0 ? ns.entries.table?.[tableName] : void 0;\n\t}\n\tif (table === void 0) for (const ns of Object.values(contract.storage.namespaces)) {\n\t\tconst found = ns.entries.table?.[tableName];\n\t\tif (found !== void 0) {\n\t\t\ttable = found;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (!table) throw adapterError(\"RUNTIME.AST_INVALID\", `INSERT target table not found in contract storage: ${tableName}`, { meta: {\n\t\tnode: \"insert\",\n\t\ttable: tableName\n\t} });\n\treturn Object.keys(table.columns);\n}\nfunction renderInsertValue(value, contract, pim) {\n\tif (!value || value.kind === \"default-value\") return \"DEFAULT\";\n\tswitch (value.kind) {\n\t\tcase \"param-ref\":\n\t\tcase \"prepared-param-ref\": return renderParamRef(value, pim);\n\t\tcase \"column-ref\": return renderColumn(value);\n\t\tcase \"raw-expr\": return renderExpr(value, contract, pim);\n\t\t// v8 ignore next 4\n\t\tdefault: assertNever(value, `Unsupported value node in INSERT: ${unreachableKind(value)}`);\n\t}\n}\nfunction renderInsert(ast, contract, pim) {\n\tconst table = qualifyTableFromNamespaceCoordinate(ast.table, contract);\n\tconst rows = ast.rows;\n\tif (rows.length === 0) throw adapterError(\"RUNTIME.AST_INVALID\", \"INSERT requires at least one row\", { meta: { node: \"insert\" } });\n\tconst hasExplicitValues = rows.some((row) => Object.keys(row).length > 0);\n\treturn `${(() => {\n\t\tif (!hasExplicitValues) {\n\t\t\tif (rows.length === 1) return `INSERT INTO ${table} DEFAULT VALUES`;\n\t\t\tconst defaultColumns = getInsertColumnOrder(rows, contract, ast.table);\n\t\t\tif (defaultColumns.length === 0) return `INSERT INTO ${table} VALUES ${rows.map(() => \"()\").join(\", \")}`;\n\t\t\tconst quotedColumns = defaultColumns.map((column) => quoteIdentifier(column));\n\t\t\tconst defaultRow = `(${defaultColumns.map(() => \"DEFAULT\").join(\", \")})`;\n\t\t\treturn `INSERT INTO ${table} (${quotedColumns.join(\", \")}) VALUES ${rows.map(() => defaultRow).join(\", \")}`;\n\t\t}\n\t\tconst columnOrder = getInsertColumnOrder(rows, contract, ast.table);\n\t\tconst columns = columnOrder.map((column) => quoteIdentifier(column));\n\t\tconst values = rows.map((row) => {\n\t\t\treturn `(${columnOrder.map((column) => renderInsertValue(row[column], contract, pim)).join(\", \")})`;\n\t\t}).join(\", \");\n\t\treturn `INSERT INTO ${table} (${columns.join(\", \")}) VALUES ${values}`;\n\t})()}${ast.onConflict ? (() => {\n\t\tconst conflictColumns = ast.onConflict.columns.map((col) => quoteIdentifier(col.column));\n\t\tif (conflictColumns.length === 0) throw adapterError(\"RUNTIME.AST_INVALID\", \"INSERT onConflict requires at least one conflict column\", { meta: { node: \"insert-on-conflict\" } });\n\t\tconst action = ast.onConflict.action;\n\t\tswitch (action.kind) {\n\t\t\tcase \"do-nothing\": return ` ON CONFLICT (${conflictColumns.join(\", \")}) DO NOTHING`;\n\t\t\tcase \"do-update-set\": {\n\t\t\t\tconst updateEntries = Object.entries(action.set);\n\t\t\t\tif (updateEntries.length === 0) throw adapterError(\"RUNTIME.AST_INVALID\", \"INSERT onConflict do-update-set requires at least one assignment\", { meta: { node: \"insert-on-conflict\" } });\n\t\t\t\tconst updates = updateEntries.map(([colName, value]) => {\n\t\t\t\t\treturn `${quoteIdentifier(colName)} = ${renderExpr(value, contract, pim)}`;\n\t\t\t\t});\n\t\t\t\treturn ` ON CONFLICT (${conflictColumns.join(\", \")}) DO UPDATE SET ${updates.join(\", \")}`;\n\t\t\t}\n\t\t\t// v8 ignore next 4\n\t\t\tdefault: assertNever(action, `Unsupported onConflict action: ${unreachableKind(action)}`);\n\t\t}\n\t})() : \"\"}${ast.returning?.length ? ` RETURNING ${renderReturning(ast.returning, contract, pim)}` : \"\"}`;\n}\nfunction renderUpdate(ast, contract, pim) {\n\tconst table = qualifyTableFromNamespaceCoordinate(ast.table, contract);\n\tconst setEntries = Object.entries(ast.set);\n\tif (setEntries.length === 0) throw adapterError(\"RUNTIME.AST_INVALID\", \"UPDATE requires at least one SET assignment\", { meta: { node: \"update\" } });\n\tconst setClauses = setEntries.map(([col, val]) => {\n\t\treturn `${quoteIdentifier(col)} = ${renderExpr(val, contract, pim)}`;\n\t});\n\tconst whereClause = ast.where ? ` WHERE ${renderWhere(ast.where, contract, pim)}` : \"\";\n\tconst returningClause = ast.returning?.length ? ` RETURNING ${renderReturning(ast.returning, contract, pim)}` : \"\";\n\treturn `UPDATE ${table} SET ${setClauses.join(\", \")}${whereClause}${returningClause}`;\n}\nfunction renderDelete(ast, contract, pim) {\n\treturn `DELETE FROM ${qualifyTableFromNamespaceCoordinate(ast.table, contract)}${ast.where ? ` WHERE ${renderWhere(ast.where, contract, pim)}` : \"\"}${ast.returning?.length ? ` RETURNING ${renderReturning(ast.returning, contract, pim)}` : \"\"}`;\n}\nfunction renderParts(parts, contract, pim) {\n\treturn parts.map((part) => typeof part === \"string\" ? part : renderExpr(part, contract, pim)).join(\"\");\n}\nfunction renderRawExpr(node, contract, pim) {\n\treturn renderParts(node.parts, contract, pim);\n}\n//#endregion\nexport { adapterError as n, renderLoweredSql as t };\n\n//# sourceMappingURL=sql-renderer-ComgusFq.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,aAAa,MAAM,SAAS,SAAS;CAC7C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;;;;;;;;AAUA,MAAM,mDAAmD,IAAI,IAAI;CAChE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AACD,SAAS,iBAAi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