@prisma/orm-family-sql 0.16.0-dev.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (325) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +28 -0
  3. package/dist/ast-BstHjAoG.mjs +325 -0
  4. package/dist/ast-BstHjAoG.mjs.map +1 -0
  5. package/dist/ast-DSuzmsWn.d.mts +287 -0
  6. package/dist/ast-DSuzmsWn.d.mts.map +1 -0
  7. package/dist/authoring-type-constructors-Blqoa2Ua-DyCmD6mp.mjs +316 -0
  8. package/dist/authoring-type-constructors-Blqoa2Ua-DyCmD6mp.mjs.map +1 -0
  9. package/dist/build-contract-DBCz_YSs-DO0wMHai.mjs +778 -0
  10. package/dist/build-contract-DBCz_YSs-DO0wMHai.mjs.map +1 -0
  11. package/dist/builder.d.mts +3 -0
  12. package/dist/builder.mjs +1 -0
  13. package/dist/builder__runtime.d.mts +42 -0
  14. package/dist/builder__runtime.d.mts.map +1 -0
  15. package/dist/builder__runtime.mjs +955 -0
  16. package/dist/builder__runtime.mjs.map +1 -0
  17. package/dist/builder__types.d.mts +3 -0
  18. package/dist/builder__types.mjs +1 -0
  19. package/dist/canonicalization-hooks-CYnW_sGn.d.mts +10 -0
  20. package/dist/canonicalization-hooks-CYnW_sGn.d.mts.map +1 -0
  21. package/dist/canonicalization-hooks-DfIc_lOO.mjs +87 -0
  22. package/dist/canonicalization-hooks-DfIc_lOO.mjs.map +1 -0
  23. package/dist/codec-descriptor-registry-BJVJRftS.mjs +96 -0
  24. package/dist/codec-descriptor-registry-BJVJRftS.mjs.map +1 -0
  25. package/dist/codec-types-MOaceoPi-C5eL2sao.d.mts +116 -0
  26. package/dist/codec-types-MOaceoPi-C5eL2sao.d.mts.map +1 -0
  27. package/dist/config-types-47qB33rW.d.mts +21 -0
  28. package/dist/config-types-47qB33rW.d.mts.map +1 -0
  29. package/dist/config-types-N7PJc6VN.mjs +65 -0
  30. package/dist/config-types-N7PJc6VN.mjs.map +1 -0
  31. package/dist/contract-builder-MvJJrQ-5.d.mts +1306 -0
  32. package/dist/contract-builder-MvJJrQ-5.d.mts.map +1 -0
  33. package/dist/contract-builder-YjMQcvZ1.mjs +1615 -0
  34. package/dist/contract-builder-YjMQcvZ1.mjs.map +1 -0
  35. package/dist/contract-emitter.d.mts +25 -0
  36. package/dist/contract-emitter.d.mts.map +1 -0
  37. package/dist/contract-emitter.mjs +2 -0
  38. package/dist/contract-errors-BCN6RVI5-5IHBF_lg.mjs +9 -0
  39. package/dist/contract-errors-BCN6RVI5-5IHBF_lg.mjs.map +1 -0
  40. package/dist/contract-psl.d.mts +65 -0
  41. package/dist/contract-psl.d.mts.map +1 -0
  42. package/dist/contract-psl.mjs +2 -0
  43. package/dist/contract-psl__provider.d.mts +23 -0
  44. package/dist/contract-psl__provider.d.mts.map +1 -0
  45. package/dist/contract-psl__provider.mjs +105 -0
  46. package/dist/contract-psl__provider.mjs.map +1 -0
  47. package/dist/contract-ts.d.mts +3 -0
  48. package/dist/contract-ts.mjs +4 -0
  49. package/dist/contract-ts__config-types.d.mts +2 -0
  50. package/dist/contract-ts__config-types.mjs +2 -0
  51. package/dist/contract-ts__contract-builder.d.mts +2 -0
  52. package/dist/contract-ts__contract-builder.mjs +3 -0
  53. package/dist/contract-view-BMR5IWk4.mjs +39 -0
  54. package/dist/contract-view-BMR5IWk4.mjs.map +1 -0
  55. package/dist/contract-view-BbWQp6r4.d.mts +61 -0
  56. package/dist/contract-view-BbWQp6r4.d.mts.map +1 -0
  57. package/dist/contract.d.mts +26 -0
  58. package/dist/contract.mjs +17 -0
  59. package/dist/contract__canonicalization-hooks.d.mts +2 -0
  60. package/dist/contract__canonicalization-hooks.mjs +2 -0
  61. package/dist/contract__contract-view.d.mts +2 -0
  62. package/dist/contract__contract-view.mjs +2 -0
  63. package/dist/contract__entity-handle-lowering-hook.d.mts +2 -0
  64. package/dist/contract__entity-handle-lowering-hook.mjs +2 -0
  65. package/dist/contract__entity-kinds.d.mts +2 -0
  66. package/dist/contract__entity-kinds.mjs +2 -0
  67. package/dist/contract__factories.d.mts +2 -0
  68. package/dist/contract__factories.mjs +2 -0
  69. package/dist/contract__foreign-key-materialization.d.mts +2 -0
  70. package/dist/contract__foreign-key-materialization.mjs +2 -0
  71. package/dist/contract__index-naming.d.mts +2 -0
  72. package/dist/contract__index-naming.mjs +2 -0
  73. package/dist/contract__index-type-validation.d.mts +2 -0
  74. package/dist/contract__index-type-validation.mjs +2 -0
  75. package/dist/contract__index-types.d.mts +3 -0
  76. package/dist/contract__index-types.mjs +2 -0
  77. package/dist/contract__pack-types.d.mts +2 -0
  78. package/dist/contract__pack-types.mjs +1 -0
  79. package/dist/contract__referential-action-sql.d.mts +2 -0
  80. package/dist/contract__referential-action-sql.mjs +2 -0
  81. package/dist/contract__resolve-storage-table.d.mts +2 -0
  82. package/dist/contract__resolve-storage-table.mjs +2 -0
  83. package/dist/contract__types.d.mts +11 -0
  84. package/dist/contract__types.mjs +4 -0
  85. package/dist/contract__validators.d.mts +2 -0
  86. package/dist/contract__validators.mjs +3 -0
  87. package/dist/contract__value-set-derivation-hook.d.mts +2 -0
  88. package/dist/contract__value-set-derivation-hook.mjs +2 -0
  89. package/dist/control-B7iS4jv4.mjs +1326 -0
  90. package/dist/control-B7iS4jv4.mjs.map +1 -0
  91. package/dist/control-BHmsZudH.d.mts +948 -0
  92. package/dist/control-BHmsZudH.d.mts.map +1 -0
  93. package/dist/control-adapter-4y1O8Ps3.d.mts +1 -0
  94. package/dist/control-adapter-C99J7aEF-C-17lFY8.d.mts +191 -0
  95. package/dist/control-adapter-C99J7aEF-C-17lFY8.d.mts.map +1 -0
  96. package/dist/db-DhMsmBS--DKENDi3l.d.mts +365 -0
  97. package/dist/db-DhMsmBS--DKENDi3l.d.mts.map +1 -0
  98. package/dist/ddl-types-BMp2bWVS-D1waZJ4n.mjs +153 -0
  99. package/dist/ddl-types-BMp2bWVS-D1waZJ4n.mjs.map +1 -0
  100. package/dist/ddl-types-rrMsf77U-DGctYf-T.d.mts +149 -0
  101. package/dist/ddl-types-rrMsf77U-DGctYf-T.d.mts.map +1 -0
  102. package/dist/diff-B16bL_IR.mjs +13 -0
  103. package/dist/diff-B16bL_IR.mjs.map +1 -0
  104. package/dist/diff-DhlzHOMD.d.mts +104 -0
  105. package/dist/diff-DhlzHOMD.d.mts.map +1 -0
  106. package/dist/dist-C_q1_QR9.mjs +9 -0
  107. package/dist/dist-C_q1_QR9.mjs.map +1 -0
  108. package/dist/dist-DrScXbhq.mjs +414 -0
  109. package/dist/dist-DrScXbhq.mjs.map +1 -0
  110. package/dist/dist-x6jvtkKM.mjs +68 -0
  111. package/dist/dist-x6jvtkKM.mjs.map +1 -0
  112. package/dist/entity-handle-lowering-hook-CIvRKBfa.d.mts +92 -0
  113. package/dist/entity-handle-lowering-hook-CIvRKBfa.d.mts.map +1 -0
  114. package/dist/entity-handle-lowering-hook-DwLIKNiS.mjs +11 -0
  115. package/dist/entity-handle-lowering-hook-DwLIKNiS.mjs.map +1 -0
  116. package/dist/entity-kinds-DKxwKolf-CcsY-iYV.mjs +136 -0
  117. package/dist/entity-kinds-DKxwKolf-CcsY-iYV.mjs.map +1 -0
  118. package/dist/entity-kinds-Dh6VH4uK.d.mts +29 -0
  119. package/dist/entity-kinds-Dh6VH4uK.d.mts.map +1 -0
  120. package/dist/errors-B5g0xWro-mWH2C07F.mjs +9 -0
  121. package/dist/errors-B5g0xWro-mWH2C07F.mjs.map +1 -0
  122. package/dist/errors.d.mts +63 -0
  123. package/dist/errors.d.mts.map +1 -0
  124. package/dist/errors.mjs +2 -0
  125. package/dist/expression-DIf8F4Mc.d.mts +167 -0
  126. package/dist/expression-DIf8F4Mc.d.mts.map +1 -0
  127. package/dist/expression-RUO52bJB.mjs +109 -0
  128. package/dist/expression-RUO52bJB.mjs.map +1 -0
  129. package/dist/factories-B7tA4y9D.d.mts +39 -0
  130. package/dist/factories-B7tA4y9D.d.mts.map +1 -0
  131. package/dist/factories-CDG9zBxC.mjs +77 -0
  132. package/dist/factories-CDG9zBxC.mjs.map +1 -0
  133. package/dist/family.d.mts +13 -0
  134. package/dist/family.mjs +12 -0
  135. package/dist/family__control-adapter.d.mts +3 -0
  136. package/dist/family__control-adapter.mjs +1 -0
  137. package/dist/family__control.d.mts +4 -0
  138. package/dist/family__control.mjs +4 -0
  139. package/dist/family__diff.d.mts +3 -0
  140. package/dist/family__diff.mjs +3 -0
  141. package/dist/family__ir.d.mts +2 -0
  142. package/dist/family__ir.mjs +3 -0
  143. package/dist/family__migration.d.mts +2 -0
  144. package/dist/family__migration.mjs +2 -0
  145. package/dist/family__pack.d.mts +249 -0
  146. package/dist/family__pack.d.mts.map +1 -0
  147. package/dist/family__pack.mjs +18 -0
  148. package/dist/family__pack.mjs.map +1 -0
  149. package/dist/family__psl-infer.d.mts +2 -0
  150. package/dist/family__psl-infer.mjs +2 -0
  151. package/dist/family__runtime.d.mts +3 -0
  152. package/dist/family__runtime.mjs +3 -0
  153. package/dist/family__verify.d.mts +2 -0
  154. package/dist/family__verify.mjs +2 -0
  155. package/dist/foreign-key-BSy9u4O4-BnsOe5Nf.d.mts +85 -0
  156. package/dist/foreign-key-BSy9u4O4-BnsOe5Nf.d.mts.map +1 -0
  157. package/dist/foreign-key-materialization-Ca-wRbmj.d.mts +65 -0
  158. package/dist/foreign-key-materialization-Ca-wRbmj.d.mts.map +1 -0
  159. package/dist/foreign-key-materialization-HI7BIQrG.mjs +72 -0
  160. package/dist/foreign-key-materialization-HI7BIQrG.mjs.map +1 -0
  161. package/dist/index-Bb9U36N4.d.mts +511 -0
  162. package/dist/index-Bb9U36N4.d.mts.map +1 -0
  163. package/dist/index-BgaTJRxj.d.mts +25 -0
  164. package/dist/index-BgaTJRxj.d.mts.map +1 -0
  165. package/dist/index-naming-BZWoh45T.d.mts +62 -0
  166. package/dist/index-naming-BZWoh45T.d.mts.map +1 -0
  167. package/dist/index-naming-BoGBcMmI-DiJAr66H.mjs +108 -0
  168. package/dist/index-naming-BoGBcMmI-DiJAr66H.mjs.map +1 -0
  169. package/dist/index-type-validation-COH4d78M.mjs +17 -0
  170. package/dist/index-type-validation-COH4d78M.mjs.map +1 -0
  171. package/dist/index-type-validation-DN0L2mqm.d.mts +10 -0
  172. package/dist/index-type-validation-DN0L2mqm.d.mts.map +1 -0
  173. package/dist/index-types-CNhHgKHi.d.mts +1 -0
  174. package/dist/index-types-DJQ_xwaE.mjs +40 -0
  175. package/dist/index-types-DJQ_xwaE.mjs.map +1 -0
  176. package/dist/index-types-DPVhsW0v-D-BikM4h.d.mts +31 -0
  177. package/dist/index-types-DPVhsW0v-D-BikM4h.d.mts.map +1 -0
  178. package/dist/interpreter-5WgpL-ax-_nqHLUTr.mjs +3526 -0
  179. package/dist/interpreter-5WgpL-ax-_nqHLUTr.mjs.map +1 -0
  180. package/dist/ir-B3bKMnGQ.d.mts +123 -0
  181. package/dist/ir-B3bKMnGQ.d.mts.map +1 -0
  182. package/dist/ir-I-xciGUH.mjs +36 -0
  183. package/dist/ir-I-xciGUH.mjs.map +1 -0
  184. package/dist/lane-query-builder.d.mts +236 -0
  185. package/dist/lane-query-builder.d.mts.map +1 -0
  186. package/dist/lane-query-builder.mjs +67 -0
  187. package/dist/lane-query-builder.mjs.map +1 -0
  188. package/dist/middleware-B4XbF4d4-tfwBl6mX.d.mts +119 -0
  189. package/dist/middleware-B4XbF4d4-tfwBl6mX.d.mts.map +1 -0
  190. package/dist/middleware-ByRsXxxq.d.mts +1 -0
  191. package/dist/middleware-CMr4CHNz-DHIUdxlm.mjs +80 -0
  192. package/dist/middleware-CMr4CHNz-DHIUdxlm.mjs.map +1 -0
  193. package/dist/migration-CK4oePIo.mjs +44 -0
  194. package/dist/migration-CK4oePIo.mjs.map +1 -0
  195. package/dist/migration-CW0ZJLxP.d.mts +44 -0
  196. package/dist/migration-CW0ZJLxP.d.mts.map +1 -0
  197. package/dist/naming-BwqqVcZy-BgTObIQw.mjs +177 -0
  198. package/dist/naming-BwqqVcZy-BgTObIQw.mjs.map +1 -0
  199. package/dist/naming-jLgdauLi-C84G_UHi.d.mts +133 -0
  200. package/dist/naming-jLgdauLi-C84G_UHi.d.mts.map +1 -0
  201. package/dist/operations.d.mts +2 -0
  202. package/dist/operations.mjs +2 -0
  203. package/dist/orm-client.d.mts +1316 -0
  204. package/dist/orm-client.d.mts.map +1 -0
  205. package/dist/orm-client.mjs +4544 -0
  206. package/dist/orm-client.mjs.map +1 -0
  207. package/dist/pack-types-BcLTpwbv.d.mts +14 -0
  208. package/dist/pack-types-BcLTpwbv.d.mts.map +1 -0
  209. package/dist/plan-BTD8xFfa-Dd_K-A1R.d.mts +45 -0
  210. package/dist/plan-BTD8xFfa-Dd_K-A1R.d.mts.map +1 -0
  211. package/dist/plan-CkpcgUaM.mjs +34 -0
  212. package/dist/plan-CkpcgUaM.mjs.map +1 -0
  213. package/dist/plan-Cm4jaoNM.d.mts +2 -0
  214. package/dist/psl-infer-6je61Z6J.d.mts +119 -0
  215. package/dist/psl-infer-6je61Z6J.d.mts.map +1 -0
  216. package/dist/psl-infer-DGftl-HW.mjs +362 -0
  217. package/dist/psl-infer-DGftl-HW.mjs.map +1 -0
  218. package/dist/query-lane-context-Bz8XJZ45.d.mts +1 -0
  219. package/dist/query-lane-context-DtdVMqoz-C2Tj5QHA.d.mts +94 -0
  220. package/dist/query-lane-context-DtdVMqoz-C2Tj5QHA.d.mts.map +1 -0
  221. package/dist/referential-action-sql-Csd6dA8G.d.mts +12 -0
  222. package/dist/referential-action-sql-Csd6dA8G.d.mts.map +1 -0
  223. package/dist/referential-action-sql-DSqkrySN.mjs +17 -0
  224. package/dist/referential-action-sql-DSqkrySN.mjs.map +1 -0
  225. package/dist/relational-core.d.mts +13 -0
  226. package/dist/relational-core.mjs +8 -0
  227. package/dist/relational-core__ast.d.mts +5 -0
  228. package/dist/relational-core__ast.mjs +5 -0
  229. package/dist/relational-core__codec-descriptor-registry.d.mts +39 -0
  230. package/dist/relational-core__codec-descriptor-registry.d.mts.map +1 -0
  231. package/dist/relational-core__codec-descriptor-registry.mjs +2 -0
  232. package/dist/relational-core__contract-free.d.mts +220 -0
  233. package/dist/relational-core__contract-free.d.mts.map +1 -0
  234. package/dist/relational-core__contract-free.mjs +393 -0
  235. package/dist/relational-core__contract-free.mjs.map +1 -0
  236. package/dist/relational-core__expression.d.mts +2 -0
  237. package/dist/relational-core__expression.mjs +2 -0
  238. package/dist/relational-core__middleware.d.mts +3 -0
  239. package/dist/relational-core__middleware.mjs +2 -0
  240. package/dist/relational-core__plan.d.mts +4 -0
  241. package/dist/relational-core__plan.mjs +2 -0
  242. package/dist/relational-core__query-lane-context.d.mts +3 -0
  243. package/dist/relational-core__query-lane-context.mjs +1 -0
  244. package/dist/relational-core__types.d.mts +3 -0
  245. package/dist/relational-core__types.mjs +1 -0
  246. package/dist/resolve-storage-table-DUwyRJmP.d.mts +21 -0
  247. package/dist/resolve-storage-table-DUwyRJmP.d.mts.map +1 -0
  248. package/dist/resolve-storage-table-DZsfnzeW.mjs +46 -0
  249. package/dist/resolve-storage-table-DZsfnzeW.mjs.map +1 -0
  250. package/dist/runtime-DNewRuec.d.mts +46 -0
  251. package/dist/runtime-DNewRuec.d.mts.map +1 -0
  252. package/dist/runtime-tIHpGCcG.mjs +55 -0
  253. package/dist/runtime-tIHpGCcG.mjs.map +1 -0
  254. package/dist/runtime.d.mts +4 -0
  255. package/dist/runtime.mjs +1606 -0
  256. package/dist/runtime.mjs.map +1 -0
  257. package/dist/schema-differ-DpG_gnur-g5_iks8G.d.mts +47 -0
  258. package/dist/schema-differ-DpG_gnur-g5_iks8G.d.mts.map +1 -0
  259. package/dist/schema-ir.d.mts +2 -0
  260. package/dist/schema-ir.mjs +2 -0
  261. package/dist/schema-ir__naming.d.mts +2 -0
  262. package/dist/schema-ir__naming.mjs +2 -0
  263. package/dist/schema-ir__types.d.mts +3 -0
  264. package/dist/schema-ir__types.mjs +2 -0
  265. package/dist/schema-verify-vtFZbmGq-BNfTr6fU.mjs +222 -0
  266. package/dist/schema-verify-vtFZbmGq-BNfTr6fU.mjs.map +1 -0
  267. package/dist/serialized-index-B96AwqtU-DcqcB4q_.d.mts +26 -0
  268. package/dist/serialized-index-B96AwqtU-DcqcB4q_.d.mts.map +1 -0
  269. package/dist/serialized-index-Dp5_EjXD-DMsw8jf3.mjs +64 -0
  270. package/dist/serialized-index-Dp5_EjXD-DMsw8jf3.mjs.map +1 -0
  271. package/dist/sql-contract-serializer-2oBWuxTe-B9hzBBv1.mjs +171 -0
  272. package/dist/sql-contract-serializer-2oBWuxTe-B9hzBBv1.mjs.map +1 -0
  273. package/dist/sql-execution-plan-CJmsCP7n-DoEpNn7r.d.mts +32 -0
  274. package/dist/sql-execution-plan-CJmsCP7n-DoEpNn7r.d.mts.map +1 -0
  275. package/dist/sql-index-DsI8HAeK-BJsn-jvD.d.mts +72 -0
  276. package/dist/sql-index-DsI8HAeK-BJsn-jvD.d.mts.map +1 -0
  277. package/dist/sql-node-kEz6YFZo-v2F7delx.d.mts +42 -0
  278. package/dist/sql-node-kEz6YFZo-v2F7delx.d.mts.map +1 -0
  279. package/dist/sql-storage-B0QwiTg6-B8DVctJm.d.mts +171 -0
  280. package/dist/sql-storage-B0QwiTg6-B8DVctJm.d.mts.map +1 -0
  281. package/dist/storage-table-BBaAmanc-BwR37LMA.d.mts +130 -0
  282. package/dist/storage-table-BBaAmanc-BwR37LMA.d.mts.map +1 -0
  283. package/dist/storage-table-_LWDmPfv-DFhU2dML.mjs +277 -0
  284. package/dist/storage-table-_LWDmPfv-DFhU2dML.mjs.map +1 -0
  285. package/dist/storage-value-set-BGlj5Uus-CvZD--GG.d.mts +41 -0
  286. package/dist/storage-value-set-BGlj5Uus-CvZD--GG.d.mts.map +1 -0
  287. package/dist/timestamp-now-generator-DRXygu32-DN9Qb1uI.mjs +173 -0
  288. package/dist/timestamp-now-generator-DRXygu32-DN9Qb1uI.mjs.map +1 -0
  289. package/dist/types-BchwQpmO.d.mts +16 -0
  290. package/dist/types-BchwQpmO.d.mts.map +1 -0
  291. package/dist/types-BgkZru_1-H7yfikSQ.mjs +1444 -0
  292. package/dist/types-BgkZru_1-H7yfikSQ.mjs.map +1 -0
  293. package/dist/types-CMMQS6aG.mjs +111 -0
  294. package/dist/types-CMMQS6aG.mjs.map +1 -0
  295. package/dist/types-CuDrWc5v-ISVXBmBs.d.mts +134 -0
  296. package/dist/types-CuDrWc5v-ISVXBmBs.d.mts.map +1 -0
  297. package/dist/types-CvbBw1Jo-3KQdErJY.d.mts +688 -0
  298. package/dist/types-CvbBw1Jo-3KQdErJY.d.mts.map +1 -0
  299. package/dist/types-DIBA80mc-wf5wLmON.d.mts +723 -0
  300. package/dist/types-DIBA80mc-wf5wLmON.d.mts.map +1 -0
  301. package/dist/types-DMxc5KZa.d.mts +1 -0
  302. package/dist/types-Dl20lxky-DC_jdA0T.d.mts +247 -0
  303. package/dist/types-Dl20lxky-DC_jdA0T.d.mts.map +1 -0
  304. package/dist/types-DmhUVq4u-BpqqjPJx.mjs +719 -0
  305. package/dist/types-DmhUVq4u-BpqqjPJx.mjs.map +1 -0
  306. package/dist/types-IqZMLrFC-DtdJNICr.d.mts +426 -0
  307. package/dist/types-IqZMLrFC-DtdJNICr.d.mts.map +1 -0
  308. package/dist/types-TvBZ2Ne9.d.mts +1 -0
  309. package/dist/unique-constraint-jQWfH7dg-zLWtFp99.d.mts +32 -0
  310. package/dist/unique-constraint-jQWfH7dg-zLWtFp99.d.mts.map +1 -0
  311. package/dist/util-DQQgv2j1-D6INZaRG.mjs +34 -0
  312. package/dist/util-DQQgv2j1-D6INZaRG.mjs.map +1 -0
  313. package/dist/validators-C4PItWnf.mjs +0 -0
  314. package/dist/validators-C4PItWnf.mjs.map +1 -0
  315. package/dist/validators-CxeHhHrf.d.mts +206 -0
  316. package/dist/validators-CxeHhHrf.d.mts.map +1 -0
  317. package/dist/value-set-derivation-hook-BhgGVtw0.d.mts +35 -0
  318. package/dist/value-set-derivation-hook-BhgGVtw0.d.mts.map +1 -0
  319. package/dist/value-set-derivation-hook-Di9JZ0X7.mjs +22 -0
  320. package/dist/value-set-derivation-hook-Di9JZ0X7.mjs.map +1 -0
  321. package/dist/verify-E6Dd2vYp-gYwnlhLm.mjs +86 -0
  322. package/dist/verify-E6Dd2vYp-gYwnlhLm.mjs.map +1 -0
  323. package/dist/verify-zDRnw0Rn.d.mts +26 -0
  324. package/dist/verify-zDRnw0Rn.d.mts.map +1 -0
  325. package/package.json +112 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-DmhUVq4u-BpqqjPJx.mjs","names":[],"sources":["../../../../2-sql/1-core/schema-ir/dist/types-DmhUVq4u.mjs"],"sourcesContent":["import { l as normalizeIndexOptionValue, o as nameOf } from \"./naming-BwqqVcZy.mjs\";\nimport { IRNodeBase, freezeNode } from \"@internal/framework-components/ir\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { canonicalStringify } from \"@internal/utils/canonical-stringify\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { isArrayEqual } from \"@internal/utils/array-equal\";\n//#region src/ir/schema-node-kinds.ts\n/**\n* The `nodeKind` discriminant for each relational schema-diff leaf node.\n* Each node carries a unique value; the differ pairs siblings by `id`, and\n* these kinds distinguish the node types that appear as `PostgresTableSchemaNode`\n* children (columns, primary key, foreign keys, uniques, indexes, checks) from\n* each other and from the RLS policy/role kinds a target defines separately.\n*/\nconst RelationalSchemaNodeKind = {\n\tschema: \"sql-schema\",\n\ttable: \"sql-table\",\n\tcolumn: \"sql-column\",\n\tcolumnDefault: \"sql-column-default\",\n\tprimaryKey: \"sql-primary-key\",\n\tforeignKey: \"sql-foreign-key\",\n\tunique: \"sql-unique\",\n\tindex: \"sql-index\",\n\tcheck: \"sql-check-constraint\"\n};\n/**\n* The one real map from a relational `nodeKind` to the framework-neutral\n* {@link DiffSubjectGranularity} its diff issues carry — the SQL family's\n* post-diff filters (issue category, strict-mode gating) and the framework\n* aggregate's unclaimed-elements sweep key on the granularity, never on the\n* `nodeKind` spelling and never on anything stamped on the node. Resolution\n* is by `nodeKind` equality against this map, not a suffix string match.\n* Target-specific node kinds (Postgres namespace/table/policy/role) are\n* outside this family layer's vocabulary and map their own kinds directly.\n*/\nconst RELATIONAL_NODE_GRANULARITY = {\n\t[RelationalSchemaNodeKind.schema]: \"structural\",\n\t[RelationalSchemaNodeKind.table]: \"entity\",\n\t[RelationalSchemaNodeKind.column]: \"field\",\n\t[RelationalSchemaNodeKind.columnDefault]: \"auxiliary\",\n\t[RelationalSchemaNodeKind.primaryKey]: \"auxiliary\",\n\t[RelationalSchemaNodeKind.foreignKey]: \"auxiliary\",\n\t[RelationalSchemaNodeKind.unique]: \"auxiliary\",\n\t[RelationalSchemaNodeKind.index]: \"auxiliary\",\n\t[RelationalSchemaNodeKind.check]: \"auxiliary\"\n};\nfunction isRelationalSchemaNodeKind(nodeKind) {\n\treturn Object.hasOwn(RELATIONAL_NODE_GRANULARITY, nodeKind);\n}\n/**\n* Looks up the subject granularity for a relational `nodeKind`. Throws for a\n* `nodeKind` outside this map (a target-specific kind, e.g. Postgres's\n* namespace/table/policy/role) — those map their own kinds directly rather\n* than through this family-level map.\n*/\nfunction relationalNodeGranularity(nodeKind) {\n\tif (!isRelationalSchemaNodeKind(nodeKind)) throw new InternalError(`relationalNodeGranularity: unrecognized relational node kind \"${nodeKind}\"`);\n\treturn RELATIONAL_NODE_GRANULARITY[nodeKind];\n}\n/**\n* The one real map from a relational `nodeKind` to its storage `entityKind`\n* — the same vocabulary the contract storage's `entries` dictionary keys use\n* (`elementCoordinates` walks it). Only the whole-table kind has an entity of\n* its own; every other relational node (a column, an index, …) is nested\n* under one and maps to nothing here.\n*/\nconst RELATIONAL_NODE_ENTITY_KIND = { [RelationalSchemaNodeKind.table]: \"table\" };\n/**\n* Looks up the storage `entityKind` for a relational `nodeKind` — sibling of\n* {@link relationalNodeGranularity}, resolved by `nodeKind` equality against\n* {@link RELATIONAL_NODE_ENTITY_KIND}. `undefined` for a target-specific kind\n* (targets map their own kinds directly) or a relational kind with no entity\n* of its own.\n*/\nfunction relationalNodeEntityKind(nodeKind) {\n\treturn isRelationalSchemaNodeKind(nodeKind) ? RELATIONAL_NODE_ENTITY_KIND[nodeKind] : void 0;\n}\n//#endregion\n//#region src/ir/sql-schema-ir-node.ts\n/**\n* SQL Schema IR node base. Carries the family-level\n* `kind = 'sql-schema-ir'` discriminator and inherits the framework's\n* `freezeNode` affordance.\n*\n* SQL Schema IR represents the actual database state as discovered by\n* introspection (the parallel to SQL Contract IR, which represents the\n* desired state).\n*\n* The discriminator is installed as a non-enumerable own property,\n* matching the SqlNode pattern. This keeps `JSON.stringify(node)`\n* canonical (no `kind` field), keeps `toEqual({...})` test assertions\n* against pre-lift flat shapes passing, and keeps `node.kind` readable\n* for dispatch.\n*\n* Both `kind` and `nodeKind` are required: every concrete leaf is a node\n* the generic differ can pair and compare, so every leaf must declare which\n* node it is. `nodeKind` has no default here — every direct subclass sets its\n* own literal value (the relational leaves via `RelationalSchemaNodeKind`,\n* target concretions via their own vocabulary, e.g. `PostgresSchemaNodeKind`).\n*/\nvar SqlSchemaIRNode = class extends IRNodeBase {\n\tconstructor() {\n\t\tsuper();\n\t\tObject.defineProperty(this, \"kind\", {\n\t\t\tvalue: \"sql-schema-ir\",\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: false\n\t\t});\n\t}\n};\n/**\n* Asserts `node` matches `predicate`, narrowing its type to `T`. The one\n* shared implementation every node class's `static assert` and `isEqualTo`\n* reach for, instead of each hand-writing its own throw: the message names\n* the class the caller expected.\n*/\nfunction assertNode(node, className, predicate) {\n\tif (node === void 0 || !predicate(node)) throw new InternalError(`Expected a ${className} but got nodeKind=${node?.nodeKind ?? \"undefined\"}`);\n}\n/**\n* Defines a non-enumerable own property, the same treatment `kind` gets\n* above: a derivation-time render-support field stays out of\n* `JSON.stringify`, `toEqual({...})` structural assertions, and spreads,\n* while remaining directly readable (`node.field`) for the one consumer\n* that resolves it at plan time. A no-op when `value` is `undefined` — the\n* property is simply absent, matching every other optional field on these\n* nodes.\n*/\nfunction defineNonEnumerable(target, key, value) {\n\tif (value === void 0) return;\n\tObject.defineProperty(target, key, {\n\t\tvalue,\n\t\tenumerable: false,\n\t\twritable: false,\n\t\tconfigurable: false\n\t});\n}\n//#endregion\n//#region src/ir/primary-key.ts\n/**\n* Primary-key Schema IR node. Mirrors the Contract IR `PrimaryKey`\n* shape (same `columns` + optional `name`) so verification can compare\n* intent and actual structurally. Defined here independently to avoid\n* a sql-schema-ir -> sql-contract dependency.\n*\n* Implements `DiffableNode` so a primary key is directly a table's diff-tree\n* child. `id` is a fixed sentinel — a table has at most one primary key, so\n* there is never a sibling to disambiguate against. `isEqualTo` compares the\n* column tuple; the PK's own `name` is a database-assigned label with no\n* semantic weight, so it is not compared (mirrors the policy node's\n* name-insensitivity to non-identifying detail).\n*/\nvar PrimaryKey = class PrimaryKey extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.primaryKey;\n\tcolumns;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.columns = input.columns;\n\t\tif (input.name !== void 0) this.name = input.name;\n\t\tdefineNonEnumerable(this, \"dependsOn\", input.dependsOn);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn \"primary-key\";\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.primaryKey;\n\t}\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"PrimaryKey\", PrimaryKey.is);\n\t\treturn this.columns.length === node.columns.length && this.columns.every((c, i) => c === node.columns[i]);\n\t}\n};\n//#endregion\n//#region src/ir/sql-check-constraint-ir.ts\n/**\n* Schema IR node for a table-level check constraint that restricts a\n* column to a set of permitted values (an enum-style `IN (...)` check).\n*\n* Carries the **resolved values** rather than a raw SQL predicate so\n* callers can compare value-sets without parsing SQL.\n*\n* Implements `DiffableNode` so a check constraint is directly a table's\n* diff-tree child: `id` is the constraint name. `isEqualTo` compares\n* `column` and the permitted-value set (order-insensitive — the database\n* does not guarantee `IN (...)` ordering).\n*/\nvar SqlCheckConstraintIR = class SqlCheckConstraintIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.check;\n\tname;\n\tcolumn;\n\tpermittedValues;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.name = input.name;\n\t\tthis.column = input.column;\n\t\tthis.permittedValues = Object.freeze([...input.permittedValues]);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn `check:${this.name}`;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.check;\n\t}\n\t/**\n\t* Compares the permitted-value sets only (unordered), matching the\n\t* relational walk's `verifyCheckConstraints`: two checks pairing by name\n\t* compare their value sets — the `column` field is descriptive, not part\n\t* of the comparison, so a name-paired check with equal values verifies\n\t* regardless of which column carries it.\n\t*/\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlCheckConstraintIR\", SqlCheckConstraintIR.is);\n\t\tconst thisValues = new Set(this.permittedValues);\n\t\tconst otherValues = new Set(node.permittedValues);\n\t\tif (thisValues.size !== otherValues.size) return false;\n\t\treturn [...thisValues].every((v) => otherValues.has(v));\n\t}\n};\n//#endregion\n//#region src/ir/resolved-default-equality.ts\n/**\n* Structural equality for two resolved column defaults, ported from the\n* relational walk's `columnDefaultsEqual` normalized branch: kinds must\n* match; literal values are normalized (Date and temporal-typed strings to\n* ISO instants) then compared canonically (JSON objects match their\n* canonical string form); function expressions compare case- and\n* whitespace-insensitively.\n*\n* `nativeType` provides the temporal-normalization context (the actual\n* side's resolved native type in a diff comparison).\n*/\nfunction resolvedDefaultsEqual(expected, actual, nativeType) {\n\tif (expected.kind !== actual.kind) return false;\n\tif (expected.kind === \"literal\" && actual.kind === \"literal\") return literalValuesEqual(normalizeLiteralValue(expected.value, nativeType), normalizeLiteralValue(actual.value, nativeType));\n\tif (expected.kind === \"function\" && actual.kind === \"function\") return normalizeFunctionExpression(expected.expression) === normalizeFunctionExpression(actual.expression);\n\treturn false;\n}\nfunction normalizeFunctionExpression(expression) {\n\treturn expression.toLowerCase().replace(/\\s+/g, \"\");\n}\nfunction isTemporalNativeType(nativeType) {\n\tif (!nativeType) return false;\n\tconst normalized = nativeType.toLowerCase();\n\treturn normalized.includes(\"timestamp\") || normalized === \"date\";\n}\nfunction normalizeLiteralValue(value, nativeType) {\n\tif (value instanceof Date) return value.toISOString();\n\tif (typeof value === \"string\" && isTemporalNativeType(nativeType)) {\n\t\tconst parsed = new Date(value);\n\t\tif (!Number.isNaN(parsed.getTime())) return parsed.toISOString();\n\t}\n\treturn value;\n}\nfunction literalValuesEqual(a, b) {\n\tif (a === b) return true;\n\tif (typeof a === \"object\" && a !== null && typeof b === \"object\" && b !== null) return canonicalStringify(a) === canonicalStringify(b);\n\tif (typeof a === \"object\" && a !== null && typeof b === \"string\") try {\n\t\treturn canonicalStringify(a) === canonicalStringify(JSON.parse(b));\n\t} catch {\n\t\treturn false;\n\t}\n\tif (typeof a === \"string\" && typeof b === \"object\" && b !== null) try {\n\t\treturn canonicalStringify(JSON.parse(a)) === canonicalStringify(b);\n\t} catch {\n\t\treturn false;\n\t}\n\treturn false;\n}\n//#endregion\n//#region src/ir/sql-column-default-ir.ts\n/**\n* Schema-diff node for a column's default value. The default is the one\n* column attribute with an extra/missing/drift lifecycle of its own, so it\n* is a child node of the column rather than a compared attribute: an\n* undeclared live default surfaces as `not-expected`, a declared default the\n* database lacks as `not-found`, and a divergent value as `not-equal` — the\n* three reasons cover the legacy `extra_default` / `default_missing` /\n* `default_mismatch` vocabulary with no attribute inspection.\n*\n* `id` is a fixed sentinel — a column has at most one default. Built\n* transiently by `SqlColumnIR.children()` from the column's own fields;\n* never constructed by derivation or introspection directly.\n*/\nvar SqlColumnDefaultIR = class SqlColumnDefaultIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.columnDefault;\n\tconstructor(input) {\n\t\tsuper();\n\t\tif (input.resolved !== void 0) this.resolved = input.resolved;\n\t\tif (input.raw !== void 0) this.raw = input.raw;\n\t\tif (input.nativeTypeContext !== void 0) this.nativeTypeContext = input.nativeTypeContext;\n\t\tdefineNonEnumerable(this, \"many\", input.many);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn \"default\";\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.columnDefault;\n\t}\n\t/**\n\t* Structured comparison with `this` as the expected side: both sides\n\t* resolved compare per the relational walk's `columnDefaultsEqual`\n\t* semantics; a declared expected default against an unparseable actual\n\t* (raw present, no resolved parse) is a mismatch; two raw-only nodes fall\n\t* back to raw string equality.\n\t*/\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlColumnDefaultIR\", SqlColumnDefaultIR.is);\n\t\tif (this.resolved !== void 0 && node.resolved !== void 0) return resolvedDefaultsEqual(this.resolved, node.resolved, node.nativeTypeContext ?? this.nativeTypeContext);\n\t\tif (this.resolved !== void 0 || node.resolved !== void 0) return false;\n\t\treturn this.raw === node.raw;\n\t}\n};\n//#endregion\n//#region src/ir/sql-column-ir.ts\n/**\n* Schema IR node for a single column on a table, as observed by\n* introspection. Unlike the Contract IR `StorageColumn`, this carries\n* the column's `name` (Schema IR columns are returned as arrays from\n* introspection queries; the parent table re-keys them into a record\n* for downstream consumers).\n*\n* Implements `DiffableNode` so a column is directly a table's diff-tree\n* child: `id` is the column name (unique among a table's columns); `isEqualTo`\n* compares this column's own attributes only — never children, since a\n* column is a leaf. When both sides carry `resolvedNativeType` (stamped at\n* derivation/introspection), the comparison uses the resolved values —\n* resolved native type, nullability, and structured default equality per\n* the relational walk's `columnDefaultsEqual` semantics, with `this` as the\n* expected side. Otherwise it falls back to comparing raw fields.\n*/\nvar SqlColumnIR = class SqlColumnIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.column;\n\tname;\n\tnativeType;\n\tnullable;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.name = input.name;\n\t\tthis.nativeType = input.nativeType;\n\t\tthis.nullable = input.nullable;\n\t\tif (input.default !== void 0) this.default = input.default;\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tif (input.many !== void 0) this.many = input.many;\n\t\tif (input.resolvedNativeType !== void 0) this.resolvedNativeType = input.resolvedNativeType;\n\t\tif (input.resolvedDefault !== void 0) this.resolvedDefault = input.resolvedDefault;\n\t\tdefineNonEnumerable(this, \"codecRef\", input.codecRef);\n\t\tdefineNonEnumerable(this, \"codecBaseNativeType\", input.codecBaseNativeType);\n\t\tdefineNonEnumerable(this, \"codecNamedType\", input.codecNamedType);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn `column:${this.name}`;\n\t}\n\t/**\n\t* The column's default, when declared/present, is the column's one child\n\t* node — it has an extra/missing/drift lifecycle of its own, so the differ\n\t* recurses to it rather than `isEqualTo` comparing it. Built transiently\n\t* from this column's own fields.\n\t*/\n\tchildren() {\n\t\tif (this.resolvedDefault === void 0 && this.default === void 0) return [];\n\t\treturn [new SqlColumnDefaultIR({\n\t\t\t...ifDefined(\"resolved\", this.resolvedDefault),\n\t\t\t...ifDefined(\"raw\", this.default),\n\t\t\t...ifDefined(\"nativeTypeContext\", this.resolvedNativeType),\n\t\t\t...ifDefined(\"many\", this.many ?? this.codecRef?.many)\n\t\t})];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.column;\n\t}\n\t/**\n\t* Compares the column's own attributes only — the default lives on the\n\t* child node. When both sides carry `resolvedNativeType`, the resolved\n\t* value governs (array-ness rides on its `[]` suffix); otherwise raw\n\t* fields compare.\n\t*/\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlColumnIR\", SqlColumnIR.is);\n\t\tif (this.resolvedNativeType !== void 0 && node.resolvedNativeType !== void 0) return this.resolvedNativeType === node.resolvedNativeType && this.nullable === node.nullable;\n\t\treturn this.nativeType === node.nativeType && this.nullable === node.nullable && Boolean(this.many) === Boolean(node.many);\n\t}\n};\n//#endregion\n//#region src/ir/sql-foreign-key-ir.ts\n/**\n* Schema IR node for a foreign-key constraint as observed by\n* introspection. The `referencedTable` / `referencedColumns` field\n* names match the introspection vocabulary (`pg_constraint.confkey`,\n* etc.) and intentionally differ from the Contract IR's nested\n* `references: { table, columns }` shape so that the verifier's\n* structural comparison stays explicit about which side it's reading.\n*\n* Implements `DiffableNode` so a foreign key is directly a table's diff-tree\n* child. Foreign keys are frequently unnamed (introspection may not carry a\n* constraint name, and the contract side never invents one), so `id` is\n* derived from the referencing/referenced coordinates rather than `name` —\n* the same tuple that makes two FK constraints the same constraint. This\n* also serves as the comparison key: two FKs with the same coordinates are\n* paired by the differ, and `isEqualTo` then compares the remaining\n* attribute — the referential actions.\n*/\nvar SqlForeignKeyIR = class SqlForeignKeyIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.foreignKey;\n\tcolumns;\n\treferencedTable;\n\treferencedColumns;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.columns = input.columns;\n\t\tthis.referencedTable = input.referencedTable;\n\t\tthis.referencedColumns = input.referencedColumns;\n\t\tif (input.referencedSchema !== void 0) this.referencedSchema = input.referencedSchema;\n\t\tif (input.name !== void 0) this.name = input.name;\n\t\tif (input.onDelete !== void 0) this.onDelete = input.onDelete;\n\t\tif (input.onUpdate !== void 0) this.onUpdate = input.onUpdate;\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tconst resolvedReferencedNamespace = input.resolvedReferencedNamespace ?? input.referencedSchema;\n\t\tif (resolvedReferencedNamespace !== void 0) this.resolvedReferencedNamespace = resolvedReferencedNamespace;\n\t\tdefineNonEnumerable(this, \"dependsOn\", input.dependsOn);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\tconst referencedNamespace = this.resolvedReferencedNamespace ?? \"\";\n\t\treturn `foreign-key:${this.columns.join(\",\")}->${referencedNamespace}.${this.referencedTable}(${this.referencedColumns.join(\",\")})`;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.foreignKey;\n\t}\n\t/**\n\t* Referential-action comparison with `this` as the expected side, matching\n\t* the relational walk's `getReferentialActionMismatches`: `noAction` is the\n\t* database default and equivalent to an undeclared action, and drift is\n\t* flagged only when the expected side declares a (normalized) action.\n\t*/\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlForeignKeyIR\", SqlForeignKeyIR.is);\n\t\treturn referentialActionMatches(this.onDelete, node.onDelete) && referentialActionMatches(this.onUpdate, node.onUpdate);\n\t}\n};\nfunction referentialActionMatches(expected, actual) {\n\tconst normalizedExpected = expected === \"noAction\" ? void 0 : expected;\n\tif (normalizedExpected === void 0) return true;\n\treturn normalizedExpected === (actual === \"noAction\" ? void 0 : actual);\n}\n//#endregion\n//#region src/ir/sql-index-ir.ts\n/**\n* Schema IR node for a secondary index as observed by introspection.\n* Unlike the Contract IR `Index`, the Schema IR carries an explicit\n* `unique` field — introspection sees the underlying index regardless\n* of whether the user expressed it as `@@index` or `@@unique`, and the\n* verifier needs to distinguish them when comparing to the Contract.\n*\n* Implements `DiffableNode` so an index is directly a table's diff-tree\n* child. Indexes are name-identified: every index — contract-derived or\n* introspected — carries its full physical name, and `id` is that name.\n* Names are catalog-unique per schema, so two indexes legitimately sharing\n* one column tuple (a unique index beside a redundant plain index) are two\n* distinct siblings, and expression indexes need no column tuple at all.\n*\n* `isEqualTo` is selected by the receiver (the differ always calls\n* `expected.isEqualTo(actual)`) and delegates to {@link contentEquals} —\n* the single node-owned content relation: both modes compare `unique`\n* strict, `type` and option values through the named normalization seams,\n* and `columns` ordered-strict when both sides carry them; an exact-named\n* receiver (`prefix === undefined`) additionally byte-compares\n* `expression`/`where` (both sides are reprints in the supported flow —\n* normalizing would only mask real drift); a wire-named receiver never\n* compares bodies (the wire-name hash already commits to them).\n*\n* `expression`, `where`, and `unique` are genuine SQL-family attributes —\n* functional and partial indexes are standard SQL that any SQL target may\n* introspect, so the family node must represent them; a target declining\n* to author them is a capability decision, not target-specificity.\n*/\nvar SqlIndexIR = class SqlIndexIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.index;\n\tname;\n\tunique;\n\tconstructor(input) {\n\t\tsuper();\n\t\tconst name = nameOf(input.naming);\n\t\tif (input.columns === void 0 === (input.expression === void 0)) throw new InternalError(`SqlIndexIR \"${name}\": exactly one of columns or expression must be set.`);\n\t\tthis.name = name;\n\t\tthis.unique = input.unique;\n\t\tif (input.naming.kind === \"wire\") this.prefix = input.naming.prefix;\n\t\tif (input.columns !== void 0) this.columns = input.columns;\n\t\tif (input.expression !== void 0) this.expression = input.expression;\n\t\tif (input.where !== void 0) this.where = input.where;\n\t\tconst normalizedType = normalizeIndexType(input.type);\n\t\tif (normalizedType !== void 0) this.type = normalizedType;\n\t\tif (input.options !== void 0) this.options = input.options;\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tdefineNonEnumerable(this, \"dependsOn\", input.dependsOn);\n\t\tdefineNonEnumerable(this, \"partial\", input.partial);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn `index:${this.name}`;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.index;\n\t}\n\t/**\n\t* Mode-selected structural equality — see the class doc. Delegates to the\n\t* single node-owned relation: `columns` compare ordered-strict when both\n\t* sides carry them; an exact receiver (`prefix === undefined`)\n\t* byte-compares `expression ?? ''` and `where ?? ''`; a wire-named receiver\n\t* never compares bodies (the wire-name hash already commits to them).\n\t*/\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlIndexIR\", SqlIndexIR.is);\n\t\treturn this.contentEquals(node, {\n\t\t\tcolumnPresence: \"when-both-defined\",\n\t\t\tbodies: this.prefix !== void 0 ? \"ignored\" : \"verbatim\"\n\t\t});\n\t}\n\t/**\n\t* The single index content-equality relation — every comparer (the differ\n\t* via {@link isEqualTo}, the planner's rename content-pairing) calls this\n\t* with its mode-appropriate strictness rather than growing a parallel\n\t* relation:\n\t*\n\t* - `columnPresence: 'when-both-defined'` (the differ's rule) compares\n\t* the tuples ordered-strict only when both sides carry them — a paired\n\t* node's identity already agreed, so a column node meeting an\n\t* expression node skips the tuple.\n\t* - `columnPresence: 'matching'` (the rename-pairing rule) additionally\n\t* requires presence to agree: a column index never pairs an expression\n\t* index.\n\t* - `bodies: 'verbatim'` byte-compares `expression ?? ''` / `where ?? ''`\n\t* (absent ≡ empty, no normalization — both sides are reprints in the\n\t* supported flow); `bodies: 'ignored'` skips them (wire identity —\n\t* the wire-name hash commits to the content).\n\t*\n\t* `unique` compares strictly; `type` and option VALUES compare through\n\t* the named normalization seams below.\n\t*/\n\tcontentEquals(other, strictness) {\n\t\tconst columnsEqual = strictness.columnPresence === \"matching\" ? this.columns === void 0 === (other.columns === void 0) && (this.columns === void 0 || isArrayEqual(this.columns, other.columns ?? [])) : this.columns === void 0 || other.columns === void 0 || isArrayEqual(this.columns, other.columns);\n\t\tif (!(this.unique === other.unique && normalizeIndexType(this.type) === normalizeIndexType(other.type) && indexOptionsEqual(this.options, other.options) && columnsEqual)) return false;\n\t\tif (strictness.bodies === \"ignored\") return true;\n\t\treturn (this.expression ?? \"\") === (other.expression ?? \"\") && (this.where ?? \"\") === (other.where ?? \"\");\n\t}\n};\n/**\n* The btree-default normalization seam: the default access method (`btree`\n* in every supported SQL target) normalizes to absent. Applied at\n* construction — every derivation path (contract tree, introspection, flat\n* family tree) builds through the class, so both compare sides are\n* symmetric by definition — and again inside\n* {@link SqlIndexIR.contentEquals} so the relation holds for any input.\n* The contract JSON and the wire-name content hash keep the authored\n* spelling: `@@index([a], type: \"btree\")` and `@@index([a])` are distinct\n* wire names — but content-equal after normalization, so a spelling change\n* between them converges as a rename via the planner's content\n* pairing (the hashes differ, so hash pairing never pairs them).\n*/\nfunction normalizeIndexType(type) {\n\treturn type === \"btree\" ? void 0 : type;\n}\n/**\n* Option-bag equality: same key set, values compared through\n* {@link normalizeIndexOptionValue} — Postgres introspection returns\n* reloptions values as catalog-reprint strings (`'70'`, `'on'`) while\n* contract option leaves are typed (number, boolean, string).\n*/\nfunction indexOptionsEqual(a, b) {\n\tconst aKeys = a ? Object.keys(a).sort() : [];\n\tconst bKeys = b ? Object.keys(b).sort() : [];\n\tif (aKeys.length !== bKeys.length) return false;\n\tfor (let i = 0; i < aKeys.length; i += 1) if (aKeys[i] !== bKeys[i]) return false;\n\tif (aKeys.length === 0) return true;\n\tfor (const key of aKeys) if (normalizeIndexOptionValue(a?.[key]) !== normalizeIndexOptionValue(b?.[key])) return false;\n\treturn true;\n}\n//#endregion\n//#region src/ir/sql-unique-ir.ts\n/**\n* Schema IR node for a table-level unique constraint as observed by\n* introspection.\n*\n* Implements `DiffableNode` so a unique constraint is directly a table's\n* diff-tree child. Unique constraints are frequently unnamed, so `id` is\n* derived from the column tuple rather than `name` — the column tuple is\n* also what makes two unique constraints the same constraint, so it doubles\n* as the pairing key. There are no further attributes to compare once\n* columns are equal (the differ pairs on `id`), so `isEqualTo` is identity.\n*/\nvar SqlUniqueIR = class SqlUniqueIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.unique;\n\tcolumns;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.columns = [...input.columns];\n\t\tif (input.name !== void 0) this.name = input.name;\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tdefineNonEnumerable(this, \"dependsOn\", input.dependsOn);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn `unique:${this.columns.join(\",\")}`;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.unique;\n\t}\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlUniqueIR\", SqlUniqueIR.is);\n\t\treturn this.id === node.id;\n\t}\n};\n//#endregion\n//#region src/ir/sql-table-ir.ts\n/**\n* Schema IR node for a single table as observed by introspection.\n*\n* Unlike the Contract IR `StorageTable`, this carries the table's\n* `name` — introspection queries return tables as arrays and the\n* verifier keys them into `SqlSchemaIR.tables` afterwards, so the name\n* stays on the table object for downstream call sites that walk\n* `Object.values(schema.tables)`.\n*\n* The constructor normalises nested IR-class fields so downstream\n* walks see a uniform AST regardless of whether the input was a\n* plain-data literal (from introspection) or already-constructed\n* class instances.\n*\n* Implements `DiffableNode` so a flat (single-schema) tree is directly\n* diffable: `id` is the table name; `isEqualTo` is identity (the table's\n* structural drift is entirely expressed by its children); `children()`\n* yields every column, the primary key (when present), every foreign key,\n* unique, index, and check constraint — the same composition and order as\n* the Postgres table node, minus policies.\n*/\nvar SqlTableIR = class extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.table;\n\tname;\n\tcolumns;\n\tforeignKeys;\n\tuniques;\n\tindexes;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.name = input.name;\n\t\tthis.columns = Object.freeze(Object.fromEntries(Object.entries(input.columns).map(([key, col]) => [key, col instanceof SqlColumnIR ? col : new SqlColumnIR(col)])));\n\t\tthis.foreignKeys = Object.freeze(input.foreignKeys.map((fk) => fk instanceof SqlForeignKeyIR ? fk : new SqlForeignKeyIR(fk)));\n\t\tthis.uniques = Object.freeze(input.uniques.map((u) => u instanceof SqlUniqueIR ? u : new SqlUniqueIR(u)));\n\t\tthis.indexes = Object.freeze(input.indexes.map((i) => i instanceof SqlIndexIR ? i : new SqlIndexIR(i)));\n\t\tif (input.primaryKey !== void 0) this.primaryKey = input.primaryKey instanceof PrimaryKey ? input.primaryKey : new PrimaryKey(input.primaryKey);\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tif (input.checks !== void 0 && input.checks.length > 0) this.checks = Object.freeze(input.checks.map((c) => c instanceof SqlCheckConstraintIR ? c : new SqlCheckConstraintIR(c)));\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn this.name;\n\t}\n\tisEqualTo(other) {\n\t\treturn this.id === other.id;\n\t}\n\tchildren() {\n\t\treturn [\n\t\t\t...Object.values(this.columns),\n\t\t\t...this.primaryKey ? [this.primaryKey] : [],\n\t\t\t...this.foreignKeys,\n\t\t\t...this.uniques,\n\t\t\t...this.indexes,\n\t\t\t...this.checks ?? []\n\t\t];\n\t}\n};\n//#endregion\n//#region src/ir/sql-schema-ir.ts\n/**\n* Root Schema IR node representing the complete database schema as\n* observed by introspection. Target-agnostic; used by both verifiers\n* (compare against intended Contract storage) and migration planners\n* (derive operations needed to reconcile).\n*\n* The constructor normalises nested `SqlTableIR` instances so\n* downstream walks see a uniform AST regardless of whether the input\n* was a plain-data literal or already-constructed class instances.\n*\n* Implements `DiffableNode` as the root of a flat (single-schema) diff\n* tree: `id` is the fixed sentinel `'database'` (roots have no siblings),\n* `isEqualTo` is identity (a container has no own attributes), and\n* `children()` yields the table nodes.\n*/\nvar SqlSchemaIR = class extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.schema;\n\ttables;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.tables = Object.freeze(Object.fromEntries(Object.entries(input.tables).map(([key, t]) => [key, t instanceof SqlTableIR ? t : new SqlTableIR(t)])));\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn \"database\";\n\t}\n\tisEqualTo(other) {\n\t\treturn this.id === other.id;\n\t}\n\tchildren() {\n\t\treturn Object.values(this.tables);\n\t}\n};\n//#endregion\nexport { SqlForeignKeyIR as a, SqlCheckConstraintIR as c, assertNode as d, defineNonEnumerable as f, relationalNodeGranularity as h, SqlIndexIR as i, PrimaryKey as l, relationalNodeEntityKind as m, SqlTableIR as n, SqlColumnIR as o, RelationalSchemaNodeKind as p, SqlUniqueIR as r, SqlColumnDefaultIR as s, SqlSchemaIR as t, SqlSchemaIRNode as u };\n\n//# sourceMappingURL=types-DmhUVq4u.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,2BAA2B;CAChC,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,eAAe;CACf,YAAY;CACZ,YAAY;CACZ,QAAQ;CACR,OAAO;CACP,OAAO;AACR;;;;;;;;;;;AAWA,MAAM,8BAA8B;EAClC,yBAAyB,SAAS;EAClC,yBAAyB,QAAQ;EACjC,yBAAyB,SAAS;EAClC,yBAAyB,gBAAgB;EACzC,yBAAyB,aAAa;EACtC,yBAAyB,aAAa;EACtC,yBAAyB,SAAS;EAClC,yBAAyB,QAAQ;EACjC,yBAAyB,QAAQ;AACnC;AACA,SAAS,2BAA2B,UAAU;CAC7C,OAAO,OAAO,OAAO,6BAA6B,QAAQ;AAC3D;;;;;;;AAOA,SAAS,0BAA0B,UAAU;CAC5C,IAAI,CAAC,2BAA2B,QAAQ,GAAG,MAAM,IAAI,cAAc,iEAAiE,SAAS,EAAE;CAC/I,OAAO,4BAA4B;AACpC;;;;;;;;AAQA,MAAM,8BAA8B,GAAG,yBAAyB,QAAQ,QAAQ;;;;;;;;AAQhF,SAAS,yBAAyB,UAAU;CAC3C,OAAO,2BAA2B,QAAQ,IAAI,4BAA4B,YAAY,KAAK;AAC5F;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAI,kBAAkB,cAAc,WAAW;CAC9C,cAAc;EACb,MAAM;EACN,OAAO,eAAe,MAAM,QAAQ;GACnC,OAAO;GACP,UAAU;GACV,YAAY;GACZ,cAAc;EACf,CAAC;CACF;AACD;;;;;;;AAOA,SAAS,WAAW,MAAM,WAAW,WAAW;CAC/C,IAAI,SAAS,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C;AACD"}
@@ -0,0 +1,426 @@
1
+ import { a as StorageTable, r as StorageColumn } from "./storage-table-BBaAmanc-BwR37LMA.mjs";
2
+ import { c as SqlStorage, d as StorageTypeInstance } from "./sql-storage-B0QwiTg6-B8DVctJm.mjs";
3
+ import { C as SqlControlDriverInstance } from "./types-CuDrWc5v-ISVXBmBs.mjs";
4
+ import "./types-BchwQpmO.mjs";
5
+ import { r as SqlOperationDescriptors } from "./index-BgaTJRxj.mjs";
6
+ import { v as SqlSchemaIRNode } from "./types-CvbBw1Jo-3KQdErJY.mjs";
7
+ import "./types-TvBZ2Ne9.mjs";
8
+ import { i as SqlControlAdapter } from "./control-adapter-C99J7aEF-C-17lFY8.mjs";
9
+ import { Contract } from "@prisma/orm-framework/contract/types";
10
+ import { Result } from "@prisma/orm-framework/utils/result";
11
+ import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
12
+ import { ContractSpace, ControlAdapterDescriptor, ControlExtensionDescriptor, MigrationOperationPolicy, MigrationPlan, MigrationPlanOperation, MigrationPlannerConflict, MigrationPlannerFailureResult, MigrationPlannerSuccessResult, MigrationRunnerExecutionChecks, MigrationRunnerFailure, MigrationRunnerPerSpaceSuccessValue, MigrationRunnerResult, OpFactoryCall, OperationContext, SchemaDiffIssue, SchemaOwnership } from "@prisma/orm-framework/components/control";
13
+ import { AggregateMigrationEdgeRef } from "@prisma/orm-toolchain/migration-tools/aggregate";
14
+ //#region ../../../2-sql/9-family/dist/types-IqZMLrFC.d.mts
15
+ //#region src/core/migrations/types.d.ts
16
+ type AnyRecord = Readonly<Record<string, unknown>>;
17
+ interface StorageTypePlanResult<TTargetDetails> {
18
+ readonly operations: readonly SqlMigrationPlanOperation<TTargetDetails>[];
19
+ }
20
+ /**
21
+ * Input for expanding parameterized native types.
22
+ */
23
+ interface ExpandNativeTypeInput {
24
+ readonly nativeType: string;
25
+ readonly codecId?: string;
26
+ readonly typeParams?: Record<string, unknown>;
27
+ }
28
+ /**
29
+ * Input for resolving an identity-value SQL literal used to backfill existing rows when
30
+ * adding a NOT NULL column without an explicit default.
31
+ *
32
+ * "Identity value" in the algebraic (monoid) sense: the neutral element for the type
33
+ * (0 for numbers, '' for strings, false for booleans, etc.).
34
+ */
35
+ interface ResolveIdentityValueInput {
36
+ readonly nativeType: string;
37
+ readonly codecId?: string;
38
+ readonly typeParams?: Record<string, unknown>;
39
+ }
40
+ /**
41
+ * Per-field lifecycle event a codec hook can react to.
42
+ *
43
+ * Fired during app-space migration emission as the SQL family diffs the
44
+ * prior contract against the new contract. See
45
+ * `docs/architecture docs/adrs/ADR 213 - Codec lifecycle hooks.md`
46
+ * for the wiring contract.
47
+ *
48
+ * - `'added'` — the field is present in the new contract but not the prior.
49
+ * - `'dropped'` — the field is present in the prior contract but not the new.
50
+ * - `'altered'` — the field is present in both and any property other than
51
+ * `codecId` differs. Codec-id changes are a v1 non-goal:
52
+ * when only `codecId` differs, no `'altered'` event fires.
53
+ */
54
+ type FieldEvent = 'added' | 'dropped' | 'altered';
55
+ /**
56
+ * Context passed to {@link CodecControlHooks.onFieldEvent}.
57
+ *
58
+ * `namespaceId`, `tableName`, and `fieldName` are always populated; `priorTable` /
59
+ * `priorField` carry the prior contract's view of the table and column
60
+ * (present for `'dropped'` and `'altered'`); `newTable` / `newField`
61
+ * carry the new contract's view (present for `'added'` and `'altered'`).
62
+ *
63
+ * The hook only ever receives app-space contract IR — extension-space
64
+ * fields are scoped out by the API: the hook is wired at the
65
+ * application emitter only.
66
+ */
67
+ interface FieldEventContext {
68
+ readonly namespaceId: string;
69
+ readonly tableName: string;
70
+ readonly fieldName: string;
71
+ readonly priorTable?: StorageTable;
72
+ readonly newTable?: StorageTable;
73
+ readonly priorField?: StorageColumn;
74
+ readonly newField?: StorageColumn;
75
+ }
76
+ interface CodecControlHooks<TTargetDetails = unknown> {
77
+ /**
78
+ * `schema` is typed as the family-level `SqlSchemaIRNode` (not the concrete
79
+ * `SqlSchemaIR` class) because the actual value handed in is whatever
80
+ * per-namespace node the calling target's tree shape produces — a flat
81
+ * `SqlSchemaIR` for SQLite, a `PostgresNamespaceSchemaNode` for Postgres —
82
+ * read structurally for its `tables`/`nativeEnums` fields. Hooks that need
83
+ * the concrete Postgres shape narrow via `PostgresNamespaceSchemaNode.is(schema)`.
84
+ */
85
+ planTypeOperations?: (options: {
86
+ readonly typeName: string;
87
+ readonly typeInstance: StorageTypeInstance;
88
+ readonly contract: Contract<SqlStorage>;
89
+ readonly schema: SqlSchemaIRNode;
90
+ readonly schemaName?: string;
91
+ readonly policy: MigrationOperationPolicy;
92
+ }) => StorageTypePlanResult<TTargetDetails>;
93
+ verifyType?: (options: {
94
+ readonly typeName: string;
95
+ readonly typeInstance: StorageTypeInstance;
96
+ readonly schema: SqlSchemaIRNode;
97
+ readonly schemaName?: string;
98
+ }) => readonly SchemaDiffIssue[];
99
+ introspectTypes?: (options: {
100
+ readonly driver: SqlControlDriverInstance<string>;
101
+ readonly schemaName?: string;
102
+ }) => Promise<Record<string, StorageTypeInstance>>;
103
+ /**
104
+ * Expands a parameterized native type to its full SQL representation.
105
+ * Used by schema verification to compare contract types against database types.
106
+ *
107
+ * For example, expands:
108
+ * - { nativeType: 'character varying', typeParams: { length: 255 } } -> 'character varying(255)'
109
+ * - { nativeType: 'numeric', typeParams: { precision: 10, scale: 2 } } -> 'numeric(10,2)'
110
+ *
111
+ * Returns the expanded type string, or the original nativeType if no expansion is needed.
112
+ */
113
+ expandNativeType?: (input: ExpandNativeTypeInput) => string;
114
+ /**
115
+ * Resolves the identity value (monoid neutral element) as a SQL literal for safely adding
116
+ * a NOT NULL column without an explicit default to a non-empty table.
117
+ *
118
+ * Return semantics:
119
+ * - string: use this literal
120
+ * - null: explicitly no safe identity value is known; fall back to another strategy
121
+ * - undefined: no opinion; planner may use built-in fallbacks
122
+ */
123
+ resolveIdentityValue?: (input: ResolveIdentityValueInput) => string | null | undefined;
124
+ /**
125
+ * Reacts to per-field added / dropped / altered events as the app-space
126
+ * emitter diffs the prior contract against the new contract. Returned
127
+ * ops are inlined into the app-space migration's `ops.json` alongside
128
+ * the user's structural ops.
129
+ *
130
+ * Synchronous. Each returned op must carry its own `invariantId`. Hooks
131
+ * are dispatched per `(table, field)` based on the field's `codecId`
132
+ * (the new field's codec for `'added'` / `'altered'`; the prior field's
133
+ * codec for `'dropped'`).
134
+ *
135
+ * See `docs/architecture docs/adrs/ADR 213 - Codec lifecycle hooks.md`
136
+ * for the wiring contract and the deterministic ordering rule.
137
+ */
138
+ onFieldEvent?: (event: FieldEvent, ctx: FieldEventContext) => readonly OpFactoryCall[];
139
+ }
140
+ interface SqlControlExtensionDescriptor<TTargetId extends string> extends ControlExtensionDescriptor<'sql', TTargetId> {
141
+ readonly queryOperations?: () => SqlOperationDescriptors;
142
+ /**
143
+ * Schema-contributing extensions opt into the per-space planner / runner /
144
+ * verifier by setting this field. Extensions without it are codec-only or
145
+ * query-ops-only — today's behaviour preserved.
146
+ *
147
+ * The shape comes from `@internal/framework-components/control`
148
+ * (`ContractSpace`) — contract-space identity is a framework concept,
149
+ * not a SQL-specific one. The SQL family specialises the generic to
150
+ * `Contract<SqlStorage>` so descriptor authors continue to see a
151
+ * typed contract value.
152
+ */
153
+ readonly contractSpace?: ContractSpace<Contract<SqlStorage>>;
154
+ }
155
+ interface SqlControlAdapterDescriptor<TTargetId extends string> extends ControlAdapterDescriptor<'sql', TTargetId, SqlControlAdapter<TTargetId>> {
156
+ readonly queryOperations?: () => SqlOperationDescriptors;
157
+ }
158
+ interface SqlMigrationPlanOperationStep {
159
+ readonly description: string;
160
+ readonly sql: string;
161
+ /**
162
+ * Optional parameter values bound at execution time. The runner forwards
163
+ * these to `driver.query(sql, params ?? [])`, so step authors can use
164
+ * placeholder syntax (`$1`, `$2`, …) instead of inlining literals into
165
+ * the SQL string. Reuses the driver's parameter binder rather than
166
+ * rolling per-target literal serialization for every type the planner
167
+ * may emit.
168
+ */
169
+ readonly params?: readonly unknown[];
170
+ readonly meta?: AnyRecord;
171
+ }
172
+ /**
173
+ * Minimal shape every SQL-family target must conform to for its per-operation
174
+ * `target.details` payload. Each SQL operation addresses a named database
175
+ * object in some schema; targets (Postgres, MySQL, SQLite, …) extend this
176
+ * shape with their own fields (e.g. Postgres adds `objectType` and optional
177
+ * `table`).
178
+ */
179
+ interface SqlPlanTargetDetails {
180
+ readonly schema: string;
181
+ readonly name: string;
182
+ }
183
+ interface SqlMigrationPlanOperationTarget<TTargetDetails> {
184
+ readonly id: string;
185
+ readonly details?: TTargetDetails;
186
+ }
187
+ interface SqlMigrationPlanOperation<TTargetDetails> extends MigrationPlanOperation {
188
+ readonly summary?: string;
189
+ readonly target: SqlMigrationPlanOperationTarget<TTargetDetails>;
190
+ readonly precheck: readonly SqlMigrationPlanOperationStep[];
191
+ readonly execute: readonly SqlMigrationPlanOperationStep[];
192
+ readonly postcheck: readonly SqlMigrationPlanOperationStep[];
193
+ readonly meta?: AnyRecord;
194
+ }
195
+ interface SqlMigrationPlanContractInfo {
196
+ readonly storageHash: string;
197
+ readonly profileHash?: string;
198
+ }
199
+ interface SqlMigrationPlan<TTargetDetails> extends MigrationPlan {
200
+ /**
201
+ * Contract space this plan applies to. The runner uses this to key the
202
+ * `prisma_contract.marker` row it writes/reads (`space = <spaceId>`),
203
+ * so per-extension plans hit per-extension marker rows instead of all
204
+ * collapsing onto the app's row.
205
+ *
206
+ * App-plan callers pass `APP_SPACE_ID` (`'app'`); per-extension plans
207
+ * pass the extension's space id. Required at every call site so the
208
+ * type system surfaces every place that needs to thread the value
209
+ * (rather than letting an `?? APP_SPACE_ID` fall-through silently
210
+ * collapse per-space markers onto the `'app'` row).
211
+ *
212
+ * @see specs/framework-mechanism.spec.md § 2.
213
+ */
214
+ readonly spaceId: string;
215
+ /**
216
+ * Origin contract identity that the plan expects the database to currently be at.
217
+ * If omitted or null, the runner skips origin validation entirely.
218
+ */
219
+ readonly origin?: SqlMigrationPlanContractInfo | null;
220
+ /**
221
+ * Destination contract identity that the plan intends to reach.
222
+ */
223
+ readonly destination: SqlMigrationPlanContractInfo;
224
+ readonly operations: readonly (SqlMigrationPlanOperation<TTargetDetails> | Promise<SqlMigrationPlanOperation<TTargetDetails>>)[];
225
+ /**
226
+ * Sorted, deduplicated invariant ids declared by this plan's data-transform
227
+ * ops. Required at the SQL-family layer (the SQL runners consume this as
228
+ * the source of truth for marker writes and self-edge no-op checks); the
229
+ * framework-level {@link MigrationPlan.providedInvariants} stays optional
230
+ * because `db init` / `db update` plans don't have a corresponding
231
+ * migration manifest.
232
+ */
233
+ readonly providedInvariants: readonly string[];
234
+ readonly meta?: AnyRecord;
235
+ }
236
+ type SqlPlannerConflictKind = 'typeMismatch' | 'nullabilityConflict' | 'indexIncompatible' | 'rlsPolicyIncompatible' | 'foreignKeyConflict' | 'missingButNonAdditive' | 'unsupportedOperation' | 'controlPolicySuppressedCall';
237
+ interface SqlPlannerConflictLocation {
238
+ readonly namespaceId?: string;
239
+ readonly entityKind?: string;
240
+ readonly entityName?: string;
241
+ readonly column?: string;
242
+ readonly index?: string;
243
+ readonly constraint?: string;
244
+ readonly rlsPolicy?: string;
245
+ }
246
+ interface SqlPlannerConflict extends MigrationPlannerConflict {
247
+ readonly kind: SqlPlannerConflictKind;
248
+ readonly location?: SqlPlannerConflictLocation;
249
+ readonly meta?: AnyRecord;
250
+ }
251
+ interface SqlPlannerSuccessResult<TTargetDetails> extends Omit<MigrationPlannerSuccessResult, 'plan'> {
252
+ readonly kind: 'success';
253
+ readonly plan: SqlMigrationPlan<TTargetDetails>;
254
+ }
255
+ interface SqlPlannerFailureResult extends Omit<MigrationPlannerFailureResult, 'conflicts'> {
256
+ readonly kind: 'failure';
257
+ readonly conflicts: readonly SqlPlannerConflict[];
258
+ }
259
+ type SqlPlannerResult<TTargetDetails> = SqlPlannerSuccessResult<TTargetDetails> | SqlPlannerFailureResult;
260
+ interface SqlMigrationPlannerPlanOptions {
261
+ readonly contract: Contract<SqlStorage>;
262
+ /**
263
+ * The "from"/live schema as the target's introspected node (SQLite a flat
264
+ * `SqlSchemaIR`, Postgres a `PostgresDatabaseSchemaNode` root). Structure-aware
265
+ * consumers narrow the concrete shape before walking it.
266
+ */
267
+ readonly schema: SqlSchemaIRNode;
268
+ readonly policy: MigrationOperationPolicy;
269
+ readonly schemaName?: string;
270
+ /**
271
+ * Contract space the plan applies to. The planner stamps this onto
272
+ * the produced {@link SqlMigrationPlan.spaceId} so the runner keys
273
+ * the marker row by the right space. App-plan callers pass
274
+ * `APP_SPACE_ID`; per-extension callers pass the extension's space
275
+ * id.
276
+ */
277
+ readonly spaceId: string;
278
+ /**
279
+ * The "from" contract (state the planner assumes the database starts at),
280
+ * or `null` for reconciliation flows that have no prior contract.
281
+ *
282
+ * Required at every call site so the structural fact "I have a prior
283
+ * contract / I don't" is visible in the type. `migration plan` reads the
284
+ * predecessor's contract from the snapshot store by its storage hash and
285
+ * passes the parsed value; `db update` / `db init` reconcile against the
286
+ * live schema and pass `null`. Strategies that
287
+ * need from/to column-shape comparisons (unsafe type change, nullability
288
+ * tightening) use this to decide whether to emit `dataTransform`
289
+ * placeholders; they short-circuit when it is `null`.
290
+ *
291
+ * Planners also derive the "from" identity they stamp onto the produced
292
+ * plan's `describe()` as `fromContract?.storage.storageHash ?? null`.
293
+ */
294
+ readonly fromContract: Contract<SqlStorage> | null;
295
+ /**
296
+ * POSIX-relative path from the migration package dir to
297
+ * `migrations/snapshots`, e.g. `'../../snapshots'`. Threaded straight
298
+ * into the produced plan's `renderTypeScript()` metadata so the
299
+ * scaffold's contract-snapshot imports point at the deduplicated store.
300
+ */
301
+ readonly snapshotsImportPath: string;
302
+ /**
303
+ * Active framework components participating in this composition.
304
+ * Each component is target-bound so SQL targets can dispatch
305
+ * component-owned planning behaviour from the same descriptor list.
306
+ * All components must have matching familyId ('sql') and targetId.
307
+ */
308
+ readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;
309
+ /**
310
+ * Ownership oracle over the whole contract-space composition (the passive
311
+ * aggregate). The planner asks it, per live extra node, whether any space
312
+ * declares that entity: a sibling-owned node is left untouched, an unowned
313
+ * node is a genuine extra it may drop under a destructive policy. The
314
+ * planner holds no list of other spaces' names — ownership lives in the
315
+ * aggregate; it only asks. Absent for a single-space plan handed no
316
+ * aggregate. See {@link SchemaOwnership}.
317
+ */
318
+ readonly ownership?: SchemaOwnership;
319
+ }
320
+ interface SqlMigrationPlanner<TTargetDetails> {
321
+ plan(options: SqlMigrationPlannerPlanOptions): SqlPlannerResult<TTargetDetails>;
322
+ }
323
+ interface SqlMigrationRunnerExecuteCallbacks<TTargetDetails> {
324
+ onOperationStart?(operation: SqlMigrationPlanOperation<TTargetDetails>): void;
325
+ onOperationComplete?(operation: SqlMigrationPlanOperation<TTargetDetails>): void;
326
+ }
327
+ interface SqlMigrationRunnerExecuteOptions<TTargetDetails> {
328
+ readonly plan: SqlMigrationPlan<TTargetDetails>;
329
+ readonly driver: SqlControlDriverInstance<string>;
330
+ /**
331
+ * Logical contract space this plan applies to. When omitted the
332
+ * runner derives the space from {@link SqlMigrationPlan.spaceId};
333
+ * when supplied, the runner asserts it matches `plan.spaceId` so a
334
+ * caller cannot accidentally write the marker row for a different
335
+ * space than the plan was produced for.
336
+ */
337
+ readonly space?: string;
338
+ /**
339
+ * Destination contract IR.
340
+ * Must correspond to `plan.destination` and is used for schema verification and marker/ledger writes.
341
+ */
342
+ readonly destinationContract: Contract<SqlStorage>;
343
+ /**
344
+ * Execution-time policy that defines which operation classes are allowed.
345
+ * The runner validates each operation against this policy before execution.
346
+ */
347
+ readonly policy: MigrationOperationPolicy;
348
+ readonly schemaName?: string;
349
+ readonly strictVerification?: boolean;
350
+ readonly callbacks?: SqlMigrationRunnerExecuteCallbacks<TTargetDetails>;
351
+ readonly context?: OperationContext;
352
+ /**
353
+ * Execution-time checks configuration.
354
+ * All checks default to `true` (enabled) when omitted.
355
+ */
356
+ readonly executionChecks?: MigrationRunnerExecutionChecks;
357
+ /**
358
+ * Active framework components participating in this composition.
359
+ * Each component is target-bound so SQL targets can dispatch
360
+ * component-owned execution behaviour from the same descriptor list.
361
+ * All components must have matching familyId ('sql') and targetId.
362
+ */
363
+ readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;
364
+ /**
365
+ * Per-edge breakdown from graph-walk planning. When present, the runner
366
+ * writes one ledger row per edge instead of one collapsed row per apply.
367
+ */
368
+ readonly migrationEdges: readonly AggregateMigrationEdgeRef[];
369
+ }
370
+ type SqlMigrationRunnerErrorCode = 'MIGRATION.DESTINATION_CONTRACT_MISMATCH' | 'MIGRATION.LEGACY_MARKER_SHAPE' | 'MIGRATION.MARKER_ORIGIN_MISMATCH' | 'MIGRATION.MARKER_CAS_FAILURE' | 'MIGRATION.POLICY_VIOLATION' | 'MIGRATION.PRECHECK_FAILED' | 'MIGRATION.POSTCHECK_FAILED' | 'MIGRATION.SCHEMA_VERIFY_FAILED' | 'MIGRATION.FOREIGN_KEY_VIOLATION' | 'MIGRATION.EXECUTION_FAILED';
371
+ interface SqlMigrationRunnerFailure extends MigrationRunnerFailure {
372
+ readonly code: SqlMigrationRunnerErrorCode;
373
+ readonly meta?: AnyRecord;
374
+ }
375
+ interface SqlMigrationRunnerSuccessValue extends MigrationRunnerPerSpaceSuccessValue {}
376
+ type SqlMigrationRunnerResult = Result<SqlMigrationRunnerSuccessValue, SqlMigrationRunnerFailure>;
377
+ interface SqlMigrationRunner<TTargetDetails> {
378
+ /**
379
+ * Apply one or more per-space migration plans, opening and managing the
380
+ * outer transaction (and any target-specific connection-level setup, e.g.
381
+ * SQLite's `PRAGMA foreign_keys` toggle). An apply that targets one space
382
+ * passes a one-element `perSpaceOptions` list.
383
+ *
384
+ * The caller orders the input list (typically via the aggregate planner's
385
+ * `applyOrder`: extensions alphabetical, then app). A failure on any space
386
+ * rolls back every space's writes.
387
+ *
388
+ * Each entry must reference the same `driver` as the top-level `driver`
389
+ * (the connection the outer transaction is open on).
390
+ */
391
+ execute(options: {
392
+ readonly driver: SqlControlDriverInstance<string>;
393
+ readonly perSpaceOptions: ReadonlyArray<SqlMigrationRunnerExecuteOptions<TTargetDetails>>;
394
+ }): Promise<MigrationRunnerResult>;
395
+ /**
396
+ * Apply a single migration plan against an already-open connection
397
+ * **without** opening a transaction. The caller is responsible for
398
+ * wrapping the call (and any siblings) in `BEGIN` / `COMMIT` /
399
+ * `ROLLBACK`. Used by {@link SqlMigrationRunner.execute} to fan out
400
+ * across contract spaces inside one outer transaction.
401
+ *
402
+ * Idempotent control-table setup (`prisma_contract.*`) and marker
403
+ * writes use `options.space` to address the per-space marker row.
404
+ */
405
+ executeOnConnection(options: SqlMigrationRunnerExecuteOptions<TTargetDetails>): Promise<SqlMigrationRunnerResult>;
406
+ }
407
+ interface CreateSqlMigrationPlanOptions<TTargetDetails> {
408
+ readonly targetId: string;
409
+ /**
410
+ * Contract space this plan applies to. Mirrors {@link SqlMigrationPlan.spaceId}.
411
+ */
412
+ readonly spaceId: string;
413
+ readonly origin?: SqlMigrationPlanContractInfo | null;
414
+ readonly destination: SqlMigrationPlanContractInfo;
415
+ readonly operations: readonly SqlMigrationPlanOperation<TTargetDetails>[];
416
+ /**
417
+ * Sorted, deduplicated invariant ids for this plan; mirrors the required
418
+ * field on {@link SqlMigrationPlan}. Callers without a migration manifest
419
+ * (`db init`, `db update`, planner-built plans) pass `[]`.
420
+ */
421
+ readonly providedInvariants: readonly string[];
422
+ readonly meta?: AnyRecord;
423
+ }
424
+ //#endregion
425
+ export { SqlPlannerSuccessResult as A, SqlMigrationRunnerSuccessValue as C, SqlPlannerConflictLocation as D, SqlPlannerConflictKind as E, SqlPlannerFailureResult as O, SqlMigrationRunnerResult as S, SqlPlannerConflict as T, SqlMigrationRunner as _, FieldEvent as a, SqlMigrationRunnerExecuteOptions as b, SqlControlAdapterDescriptor as c, SqlMigrationPlanContractInfo as d, SqlMigrationPlanOperation as f, SqlMigrationPlannerPlanOptions as g, SqlMigrationPlanner as h, ExpandNativeTypeInput as i, StorageTypePlanResult as j, SqlPlannerResult as k, SqlControlExtensionDescriptor as l, SqlMigrationPlanOperationTarget as m, CodecControlHooks as n, FieldEventContext as o, SqlMigrationPlanOperationStep as p, CreateSqlMigrationPlanOptions as r, ResolveIdentityValueInput as s, AnyRecord as t, SqlMigrationPlan as u, SqlMigrationRunnerErrorCode as v, SqlPlanTargetDetails as w, SqlMigrationRunnerFailure as x, SqlMigrationRunnerExecuteCallbacks as y };
426
+ //# sourceMappingURL=types-IqZMLrFC-DtdJNICr.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-IqZMLrFC-DtdJNICr.d.mts","names":[],"sources":["../../../../2-sql/9-family/dist/types-IqZMLrFC.d.mts"],"mappings":";;;;;;;;;;;;;;;KAUK,YAAY,SAAS;UAChB,sBAAsB;WACrB,qBAAqB,0BAA0B;;;;;UAKhD;WACC;WACA;WACA,aAAa;;;;;;;;;UASd;WACC;WACA;WACA,aAAa;;;;;;;;;;;;;;;;KAgBnB;;;;;;;;;;;;;UAaK;WACC;WACA;WACA;WACA,aAAa;WACb,WAAW;WACX,aAAa;WACb,WAAW;;UAEZ,kBAAkB;;;;;;;;;EAS1B,sBAAsB;aACX;aACA,cAAc;aACd,UAAU,SAAS;aACnB,QAAQ;aACR;aACA,QAAQ;QACb,sBAAsB;EAC5B,cAAc;aACH;aACA,cAAc;aACd,QAAQ;aACR;iBACI;EACf,mBAAmB;aACR,QAAQ;aACR;QACL,QAAQ,eAAe;;;;;;;;;;;EAW7B,oBAAoB,OAAO;;;;;;;;;;EAU3B,wBAAwB,OAAO;;;;;;;;;;;;;;;EAe/B,gBAAgB,OAAO,YAAY,KAAK,+BAA+B;;UAE/D,8BAA8B,kCAAkC,kCAAkC;WACjG,wBAAwB;;;;;;;;;;;;WAYxB,gBAAgB,cAAc,SAAS;;UAExC,4BAA4B,kCAAkC,gCAAgC,WAAW,kBAAkB;WAC1H,wBAAwB;;UAEzB;WACC;WACA;;;;;;;;;WASA;WACA,OAAO;;;;;;;;;UASR;WACC;WACA;;UAED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ACvE,QAAQ;;;;;;;;;;;EAWZ,oBAAoB,SAAS,iCAAiC,kBAAkB,QAAQ;;UAEhF,8BAA8B;WAC7B;;;;WAIA;WACA,SAAS;WACT,aAAa;WACb,qBAAqB,0BAA0B;;;;;;WAM/C;WACA,OAAO"}
@@ -0,0 +1 @@
1
+ import "./types-CvbBw1Jo-3KQdErJY.mjs";
@@ -0,0 +1,32 @@
1
+ import { t as SqlNode } from "./sql-node-kEz6YFZo-v2F7delx.mjs";
2
+ //#region ../../../2-sql/1-core/contract/dist/unique-constraint-jQWfH7dg.d.mts
3
+ //#region src/ir/primary-key.d.ts
4
+ interface PrimaryKeyInput {
5
+ readonly columns: readonly string[];
6
+ readonly name?: string;
7
+ }
8
+ /**
9
+ * SQL Contract IR node for a table's primary-key constraint.
10
+ */
11
+ declare class PrimaryKey extends SqlNode {
12
+ readonly columns: readonly string[];
13
+ readonly name?: string;
14
+ constructor(input: PrimaryKeyInput);
15
+ }
16
+ //#endregion
17
+ //#region src/ir/unique-constraint.d.ts
18
+ interface UniqueConstraintInput {
19
+ readonly columns: readonly string[];
20
+ readonly name?: string;
21
+ }
22
+ /**
23
+ * SQL Contract IR node for a table-level unique constraint.
24
+ */
25
+ declare class UniqueConstraint extends SqlNode {
26
+ readonly columns: readonly string[];
27
+ readonly name?: string;
28
+ constructor(input: UniqueConstraintInput);
29
+ }
30
+ //#endregion
31
+ export { UniqueConstraintInput as i, PrimaryKeyInput as n, UniqueConstraint as r, PrimaryKey as t };
32
+ //# sourceMappingURL=unique-constraint-jQWfH7dg-zLWtFp99.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unique-constraint-jQWfH7dg-zLWtFp99.d.mts","names":[],"sources":["../../../../2-sql/1-core/contract/dist/unique-constraint-jQWfH7dg.d.mts"],"mappings":";;;UAEU;WACC;WACA;;;;;cAKG,mBAAmB;WACtB;WACA;EACT,YAAY,OAAO;;;;UAIX;WACC;WACA;;;;;cAKG,yBAAyB;WAC5B;WACA;EACT,YAAY,OAAO"}
@@ -0,0 +1,34 @@
1
+ //#region ../../../2-sql/4-lanes/relational-core/dist/util-DQQgv2j1.mjs
2
+ function compact(o) {
3
+ const out = {};
4
+ for (const [k, v] of Object.entries(o)) {
5
+ if (v === void 0 || v === null) continue;
6
+ if (Array.isArray(v) && v.length === 0) continue;
7
+ out[k] = v;
8
+ }
9
+ return out;
10
+ }
11
+ /**
12
+ * Walks an AST's parameter references in first-encounter order and dedupes
13
+ * by ParamRef identity. The single canonical helper used by every consumer
14
+ * that aligns `plan.params` with metadata-by-index — the SQL builder lane,
15
+ * the SQL ORM client, the SQL runtime encoder, and the Postgres renderer's
16
+ * `$N` index map — so the four walks cannot drift in dedupe semantics.
17
+ *
18
+ * SQLite's `?`-placeholder renderer intentionally does NOT use this helper
19
+ * because it needs one params entry per occurrence in the SQL.
20
+ */
21
+ function collectOrderedParamRefs(ast) {
22
+ const seen = /* @__PURE__ */ new Set();
23
+ const ordered = [];
24
+ for (const ref of ast.collectParamRefs()) {
25
+ if (seen.has(ref)) continue;
26
+ seen.add(ref);
27
+ ordered.push(ref);
28
+ }
29
+ return Object.freeze(ordered);
30
+ }
31
+ //#endregion
32
+ export { compact as n, collectOrderedParamRefs as t };
33
+
34
+ //# sourceMappingURL=util-DQQgv2j1-D6INZaRG.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util-DQQgv2j1-D6INZaRG.mjs","names":[],"sources":["../../../../2-sql/4-lanes/relational-core/dist/util-DQQgv2j1.mjs"],"sourcesContent":["//#region src/ast/util.ts\nfunction compact(o) {\n\tconst out = {};\n\tfor (const [k, v] of Object.entries(o)) {\n\t\tif (v === void 0 || v === null) continue;\n\t\tif (Array.isArray(v) && v.length === 0) continue;\n\t\tout[k] = v;\n\t}\n\treturn out;\n}\n/**\n* Walks an AST's parameter references in first-encounter order and dedupes\n* by ParamRef identity. The single canonical helper used by every consumer\n* that aligns `plan.params` with metadata-by-index — the SQL builder lane,\n* the SQL ORM client, the SQL runtime encoder, and the Postgres renderer's\n* `$N` index map — so the four walks cannot drift in dedupe semantics.\n*\n* SQLite's `?`-placeholder renderer intentionally does NOT use this helper\n* because it needs one params entry per occurrence in the SQL.\n*/\nfunction collectOrderedParamRefs(ast) {\n\tconst seen = /* @__PURE__ */ new Set();\n\tconst ordered = [];\n\tfor (const ref of ast.collectParamRefs()) {\n\t\tif (seen.has(ref)) continue;\n\t\tseen.add(ref);\n\t\tordered.push(ref);\n\t}\n\treturn Object.freeze(ordered);\n}\n//#endregion\nexport { compact as n, collectOrderedParamRefs as t };\n\n//# sourceMappingURL=util-DQQgv2j1.mjs.map"],"mappings":";AACA,SAAS,QAAQ,GAAG;CACnB,MAAM,MAAM,CAAC;CACb,KAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,CAAC,GAAG;EACvC,IAAI,MAAM,KAAK,KAAK,MAAM,MAAM;EAChC,IAAI,MAAM,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG;EACxC,IAAI,KAAK;CACV;CACA,OAAO;AACR;;;;;;;;;;;AAWA,SAAS,wBAAwB,KAAK;CACrC,MAAM,uBAAuB,IAAI,IAAI;CACrC,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,OAAO,IAAI,iBAAiB,GAAG;EACzC,IAAI,KAAK,IAAI,GAAG,GAAG;EACnB,KAAK,IAAI,GAAG;EACZ,QAAQ,KAAK,GAAG;CACjB;CACA,OAAO,OAAO,OAAO,OAAO;AAC7B"}
Binary file