@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":"builder__runtime.mjs","names":["#state","#buildLateral","#addLateralJoin","#addJoin","#tableSource","#tableName","#namespaceId","#table","#scope","#rows","#returningColumns","#rowFields","#annotations","#setExpressions","#whereExprs","#whereCallbacks","#fromSource","#toJoined"],"sources":["../../../../2-sql/4-lanes/sql-builder/dist/runtime/index.mjs"],"sourcesContent":["import { AggregateExpr, AndExpr, BinaryExpr, ColumnRef, DeleteAst, DerivedTableSource, ExistsExpr, IdentifierRef, InsertAst, JoinAst, ListExpression, LiteralExpr, NullCheckExpr, OrExpr, OrderByItem, ParamRef, ProjectionItem, SelectAst, SubqueryExpr, TableSource, UpdateAst, collectOrderedParamRefs } from \"@internal/sql-relational-core/ast\";\nimport { codecOf, createRawSql, toExpr } from \"@internal/sql-relational-core/expression\";\nimport { codecRefForStorageColumn } from \"@internal/sql-relational-core/codec-descriptor-registry\";\nimport { assertAnnotationsApplicable } from \"@internal/framework-components/runtime\";\n//#region src/runtime/expression-impl.ts\n/**\n* Runtime wrapper around a relational-core AST expression node. Carries ScopeField metadata (codecId, nullable) so aggregate-like combinators can propagate the input codec onto their result.\n*\n* `codec` records the column-bound {@link CodecRef} when the field-proxy knows the binding — both the namespaced form (`f.user.email` → `ColumnRef`) and the top-level shortcut (`f.email` → `IdentifierRef`) stamp the ref derived from contract storage. `codecOf(expression)` exposes it for operation implementations forwarding the ref to `toExpr`.\n*/\nvar ExpressionImpl = class {\n\tast;\n\treturnType;\n\tcodec;\n\tconstructor(ast, returnType, codec) {\n\t\tthis.ast = ast;\n\t\tthis.returnType = returnType;\n\t\tthis.codec = codec;\n\t}\n\tbuildAst() {\n\t\treturn this.ast;\n\t}\n};\n//#endregion\n//#region src/runtime/field-proxy.ts\nfunction createFieldProxy(scope) {\n\treturn new Proxy({}, { get(_target, prop) {\n\t\tif (Object.hasOwn(scope.topLevel, prop)) {\n\t\t\tconst topField = scope.topLevel[prop];\n\t\t\tif (topField) return new ExpressionImpl(IdentifierRef.of(prop), topField, topField.codec);\n\t\t}\n\t\tif (Object.hasOwn(scope.namespaces, prop)) {\n\t\t\tconst nsFields = scope.namespaces[prop];\n\t\t\tif (nsFields) return createNamespaceProxy(prop, nsFields);\n\t\t}\n\t} });\n}\nfunction createNamespaceProxy(namespaceName, fields) {\n\treturn new Proxy({}, { get(_target, prop) {\n\t\tif (Object.hasOwn(fields, prop)) {\n\t\t\tconst field = fields[prop];\n\t\t\tif (field) return new ExpressionImpl(ColumnRef.of(namespaceName, prop), field, field.codec);\n\t\t}\n\t} });\n}\n//#endregion\n//#region src/runtime/functions.ts\nconst BOOL_FIELD = {\n\tcodecId: \"pg/bool@1\",\n\tnullable: false\n};\nconst resolve = toExpr;\n/**\n* Resolve a binary-comparison operand into an AST expression, threading the column-bound side's {@link CodecRef} to the raw-value side.\n*\n* For `fns.eq(f.email, 'alice@example.com')`, `f.email` is the column-bound expression carrying a `ColumnRef` AST and a `CodecRef` derived from contract storage; the raw string operand has no codec context. By deriving the codec context from the column-bound side and forwarding it via `toExpr(value, codec)`, the resulting `ParamRef` carries the `CodecRef` that encode-side dispatch needs to materialise the per-instance codec for parameterized codec ids (`vector(1024)` vs. `vector(1536)`).\n*/\nfunction resolveOperand(operand, otherCodec) {\n\tif (isExpressionLike(operand)) return operand.buildAst();\n\treturn toExpr(operand, otherCodec);\n}\nfunction isExpressionLike(value) {\n\treturn typeof value === \"object\" && value !== null && \"buildAst\" in value && typeof value.buildAst === \"function\";\n}\n/**\n* Resolves an Expression via `buildAst()`, or wraps a raw value as a `LiteralExpr` — an SQL literal inlined into the query text, not a bound parameter.\n*\n* Used for `and` / `or` operands. The usual operand is an `Expression<bool>` (e.g. the result of `fns.eq`), which this function passes through by calling `buildAst()`. The only time the raw-value branch fires is when the caller writes `fns.and(true, x)` or similar — inlining `TRUE`/`FALSE` literals lets the SQL planner statically simplify `TRUE AND x` to `x`, which it cannot do for an opaque `ParamRef`.\n*/\nfunction toLiteralExpr(value) {\n\tif (typeof value === \"object\" && value !== null && \"buildAst\" in value && typeof value.buildAst === \"function\") return value.buildAst();\n\treturn new LiteralExpr(value);\n}\nfunction boolExpr(astNode) {\n\treturn new ExpressionImpl(astNode, BOOL_FIELD);\n}\nfunction binaryWithSharedCodec(a, b, build) {\n\tconst aCodec = codecOf(a);\n\treturn build(resolveOperand(a, codecOf(b)), resolveOperand(b, aCodec));\n}\nfunction eq(a, b) {\n\tif (b === null) return boolExpr(NullCheckExpr.isNull(resolve(a)));\n\tif (a === null) return boolExpr(NullCheckExpr.isNull(resolve(b)));\n\treturn boolExpr(binaryWithSharedCodec(a, b, (l, r) => new BinaryExpr(\"eq\", l, r)));\n}\nfunction ne(a, b) {\n\tif (b === null) return boolExpr(NullCheckExpr.isNotNull(resolve(a)));\n\tif (a === null) return boolExpr(NullCheckExpr.isNotNull(resolve(b)));\n\treturn boolExpr(binaryWithSharedCodec(a, b, (l, r) => new BinaryExpr(\"neq\", l, r)));\n}\nfunction comparison(a, b, op) {\n\treturn boolExpr(binaryWithSharedCodec(a, b, (l, r) => new BinaryExpr(op, l, r)));\n}\nfunction inOrNotIn(expr, valuesOrSubquery, op) {\n\tconst left = expr.buildAst();\n\tconst leftCodec = codecOf(expr);\n\tconst binaryFn = op === \"in\" ? BinaryExpr.in : BinaryExpr.notIn;\n\tif (Array.isArray(valuesOrSubquery)) {\n\t\tconst refs = valuesOrSubquery.map((v) => resolveOperand(v, leftCodec));\n\t\treturn boolExpr(binaryFn(left, ListExpression.of(refs)));\n\t}\n\treturn boolExpr(binaryFn(left, SubqueryExpr.of(valuesOrSubquery.buildAst())));\n}\nfunction numericAgg(fn, expr) {\n\treturn new ExpressionImpl(AggregateExpr[fn](expr.buildAst()), {\n\t\tcodecId: expr.returnType.codecId,\n\t\tnullable: true\n\t});\n}\nfunction createBuiltinFunctions(rawCodecInferer) {\n\treturn {\n\t\teq: (a, b) => eq(a, b),\n\t\tne: (a, b) => ne(a, b),\n\t\tgt: (a, b) => comparison(a, b, \"gt\"),\n\t\tgte: (a, b) => comparison(a, b, \"gte\"),\n\t\tlt: (a, b) => comparison(a, b, \"lt\"),\n\t\tlte: (a, b) => comparison(a, b, \"lte\"),\n\t\tand: (...exprs) => boolExpr(AndExpr.of(exprs.map(toLiteralExpr))),\n\t\tor: (...exprs) => boolExpr(OrExpr.of(exprs.map(toLiteralExpr))),\n\t\texists: (subquery) => boolExpr(ExistsExpr.exists(subquery.buildAst())),\n\t\tnotExists: (subquery) => boolExpr(ExistsExpr.notExists(subquery.buildAst())),\n\t\tin: (expr, valuesOrSubquery) => inOrNotIn(expr, valuesOrSubquery, \"in\"),\n\t\tnotIn: (expr, valuesOrSubquery) => inOrNotIn(expr, valuesOrSubquery, \"notIn\"),\n\t\traw: createRawSql(rawCodecInferer)\n\t};\n}\nfunction createAggregateOnlyFunctions() {\n\treturn {\n\t\tcount: (expr) => {\n\t\t\tconst astExpr = expr ? expr.buildAst() : void 0;\n\t\t\treturn new ExpressionImpl(AggregateExpr.count(astExpr), {\n\t\t\t\tcodecId: \"pg/int8@1\",\n\t\t\t\tnullable: false\n\t\t\t});\n\t\t},\n\t\tsum: (expr) => numericAgg(\"sum\", expr),\n\t\tavg: (expr) => numericAgg(\"avg\", expr),\n\t\tmin: (expr) => numericAgg(\"min\", expr),\n\t\tmax: (expr) => numericAgg(\"max\", expr)\n\t};\n}\nfunction createFunctions(operations, rawCodecInferer) {\n\tconst builtins = createBuiltinFunctions(rawCodecInferer);\n\treturn new Proxy({}, { get(_target, prop) {\n\t\tif (Object.hasOwn(builtins, prop)) return builtins[prop];\n\t\tconst op = operations[prop];\n\t\tif (op) return op.impl;\n\t} });\n}\nfunction createAggregateFunctions(operations, rawCodecInferer) {\n\tconst baseFns = createFunctions(operations, rawCodecInferer);\n\tconst aggregates = createAggregateOnlyFunctions();\n\treturn new Proxy({}, { get(_target, prop) {\n\t\tconst agg = aggregates[prop];\n\t\tif (agg) return agg;\n\t\treturn baseFns[prop];\n\t} });\n}\n//#endregion\n//#region src/runtime/resolve-table.ts\nfunction resolveTableInNamespace(storage, namespaceId, tableName) {\n\tconst namespace = storage.namespaces[namespaceId];\n\tif (namespace === void 0) return void 0;\n\tconst tables = namespace.entries.table;\n\tif (tables === void 0 || !Object.hasOwn(tables, tableName)) return void 0;\n\treturn tables[tableName];\n}\n//#endregion\n//#region ../../../1-framework/0-foundation/utils/dist/casts-DpaahrlC.mjs\n/**\n* **Last-resort escape hatch for unsafe type assertions. Not a sanctioned tool to reach for.**\n*\n* Before reaching for `blindCast`, **rewrite the surrounding code so the cast becomes\n* unnecessary**: tighten an input type, add a runtime check that narrows via a type\n* predicate, restructure a generic so the compiler can see the relationship you're\n* asserting, or use {@link castAs} when the value already satisfies the target type.\n* Only when no rewrite is feasible does `blindCast` become the right answer — and at\n* that point, the `Reason` literal you supply must articulate the compromise in\n* language a reviewer can evaluate.\n*\n* The reviewer **will** validate the `Reason`. If it doesn't hold up under scrutiny,\n* that is not a signal to soften the reason; it is a signal to go back and solve the\n* underlying type-system problem properly. An unconvincing justification is rework,\n* not a free pass.\n*\n* `blindCast` is the auditable form of `as Foo` / `as unknown as Foo`: it bypasses\n* the compiler's checks (the input type is `unknown`, the output type is whatever the\n* caller asks for), but it forces the unsafety to be named at the call site instead of\n* smuggled in via a bare `as`. The `Reason` type parameter exists only at compile\n* time — it is not present in the emitted JavaScript — but it is grep-able and\n* visible to future readers.\n*\n* @example\n* ```typescript\n* const stringValue = blindCast<\n* string,\n* \"JSON.parse returns `unknown`; this field is documented to be a string in the API contract\"\n* >(parsed[key]);\n* ```\n*\n* @typeParam TargetType - The type the caller is asserting the input has.\n* @typeParam _Reason - A string literal describing why bypassing the type system is necessary here.\n* Only meaningful at compile time. The reviewer evaluates whether it justifies the unsafety.\n*/\nfunction blindCast(input) {\n\treturn input;\n}\n//#endregion\n//#region ../../../1-framework/0-foundation/utils/dist/defined-BQWA85QH.mjs\n/**\n* Returns an object with the key/value if value is defined, otherwise an empty object.\n*\n* Use with spread to conditionally include optional properties while satisfying\n* exactOptionalPropertyTypes. This is explicit about which properties are optional\n* and won't inadvertently strip other undefined values.\n*\n* @example\n* ```typescript\n* // Instead of:\n* const obj = {\n* required: 'value',\n* ...(optional ? { optional } : {}),\n* };\n*\n* // Use:\n* const obj = {\n* required: 'value',\n* ...ifDefined('optional', optional),\n* };\n* ```\n*/\nfunction ifDefined(key, value) {\n\treturn value !== void 0 ? blindCast({ [key]: value }) : {};\n}\n//#endregion\n//#region ../../../1-framework/0-foundation/utils/dist/structured-error.mjs\nfunction structuredError(code, message, options) {\n\tconst error = options?.cause !== void 0 ? new Error(message, { cause: options.cause }) : new Error(message);\n\tObject.defineProperty(error, \"name\", {\n\t\tvalue: \"StructuredError\",\n\t\tconfigurable: true\n\t});\n\treturn Object.assign(error, {\n\t\tcode,\n\t\t...ifDefined(\"why\", options?.why),\n\t\t...ifDefined(\"fix\", options?.fix),\n\t\t...ifDefined(\"where\", options?.where),\n\t\t...ifDefined(\"severity\", options?.severity),\n\t\t...ifDefined(\"meta\", options?.meta),\n\t\t...ifDefined(\"docsUrl\", options?.docsUrl)\n\t});\n}\n//#endregion\n//#region src/runtime/builder-base.ts\nvar BuilderBase = class {\n\tctx;\n\tconstructor(ctx) {\n\t\tthis.ctx = ctx;\n\t}\n\t_gate(required, methodName, method) {\n\t\treturn ((...args) => {\n\t\t\tassertCapability(this.ctx, required, methodName);\n\t\t\treturn method(...args);\n\t\t});\n\t}\n};\n/**\n* Derive the canonical {@link CodecRef} for a `(table, column)` from the builder context's storage. Returns `undefined` when the builder context has no storage attached or when the column is unknown to the contract.\n*/\nfunction codecRefFor(ctx, namespaceId, tableName, columnName) {\n\tif (!ctx.storage) return void 0;\n\treturn codecRefForStorageColumn(ctx.storage, namespaceId, tableName, columnName);\n}\nfunction emptyState(from, scope) {\n\treturn {\n\t\tfrom,\n\t\tjoins: [],\n\t\tprojections: [],\n\t\twhere: [],\n\t\torderBy: [],\n\t\tgroupBy: [],\n\t\thaving: void 0,\n\t\tlimit: void 0,\n\t\toffset: void 0,\n\t\tdistinct: void 0,\n\t\tdistinctOn: void 0,\n\t\tscope,\n\t\trowFields: {},\n\t\tannotations: /* @__PURE__ */ new Map()\n\t};\n}\nfunction cloneState(state, overrides) {\n\treturn {\n\t\t...state,\n\t\t...overrides\n\t};\n}\nfunction combineWhereExprs(exprs) {\n\tif (exprs.length === 0) return void 0;\n\tif (exprs.length === 1) return exprs[0];\n\treturn AndExpr.of(exprs);\n}\nfunction buildSelectAst(state) {\n\tconst where = combineWhereExprs(state.where);\n\treturn new SelectAst({\n\t\tfrom: state.from,\n\t\tjoins: state.joins.length > 0 ? state.joins : void 0,\n\t\tprojection: state.projections,\n\t\twhere,\n\t\torderBy: state.orderBy.length > 0 ? state.orderBy : void 0,\n\t\tdistinct: state.distinct,\n\t\tdistinctOn: state.distinctOn && state.distinctOn.length > 0 ? state.distinctOn : void 0,\n\t\tgroupBy: state.groupBy.length > 0 ? state.groupBy : void 0,\n\t\thaving: state.having,\n\t\tlimit: state.limit,\n\t\toffset: state.offset,\n\t\tselectAllIntent: void 0\n\t});\n}\nfunction buildQueryPlan(ast, ctx, annotations) {\n\tconst paramValues = collectOrderedParamRefs(ast).map((r) => r.kind === \"param-ref\" ? r.value : void 0);\n\tconst annotationsRecord = annotations !== void 0 && annotations.size > 0 ? Object.freeze(Object.fromEntries(annotations)) : void 0;\n\tconst meta = Object.freeze({\n\t\ttarget: ctx.target,\n\t\tstorageHash: ctx.storageHash,\n\t\tlane: \"dsl\",\n\t\t...ifDefined(\"annotations\", annotationsRecord)\n\t});\n\treturn Object.freeze({\n\t\tast,\n\t\tparams: paramValues,\n\t\tmeta\n\t});\n}\nfunction buildPlan(state, ctx) {\n\treturn buildQueryPlan(buildSelectAst(state), ctx, state.annotations);\n}\nfunction tableToScope(alias, table, options) {\n\tconst storage = options?.storage;\n\tconst lookupName = options?.tableName;\n\tconst namespaceId = options?.namespaceId;\n\tconst fields = {};\n\tfor (const [colName, col] of Object.entries(table.columns)) {\n\t\tconst codec = storage && lookupName && namespaceId !== void 0 ? codecRefForStorageColumn(storage, namespaceId, lookupName, colName) : void 0;\n\t\tfields[colName] = {\n\t\t\tcodecId: col.codecId,\n\t\t\tnullable: col.nullable,\n\t\t\t...col.many ? { many: true } : {},\n\t\t\t...codec !== void 0 ? { codec } : {}\n\t\t};\n\t}\n\treturn {\n\t\ttopLevel: { ...fields },\n\t\tnamespaces: { [alias]: fields }\n\t};\n}\nfunction mergeScopes(a, b) {\n\tconst topLevel = {};\n\tfor (const [k, v] of Object.entries(a.topLevel)) if (!(k in b.topLevel)) topLevel[k] = v;\n\tfor (const [k, v] of Object.entries(b.topLevel)) if (!(k in a.topLevel)) topLevel[k] = v;\n\treturn {\n\t\ttopLevel,\n\t\tnamespaces: {\n\t\t\t...a.namespaces,\n\t\t\t...b.namespaces\n\t\t}\n\t};\n}\nfunction nullableScope(scope) {\n\tconst mkNullable = (tbl) => {\n\t\tconst result = {};\n\t\tfor (const [k, v] of Object.entries(tbl)) result[k] = {\n\t\t\tcodecId: v.codecId,\n\t\t\tnullable: true,\n\t\t\t...v.codec !== void 0 ? { codec: v.codec } : {}\n\t\t};\n\t\treturn result;\n\t};\n\tconst namespaces = {};\n\tfor (const [k, v] of Object.entries(scope.namespaces)) namespaces[k] = mkNullable(v);\n\treturn {\n\t\ttopLevel: mkNullable(scope.topLevel),\n\t\tnamespaces\n\t};\n}\nfunction orderByScopeOf(scope, rowFields) {\n\treturn {\n\t\ttopLevel: {\n\t\t\t...scope.topLevel,\n\t\t\t...rowFields\n\t\t},\n\t\tnamespaces: scope.namespaces\n\t};\n}\nfunction assertCapability(ctx, required, methodName) {\n\tfor (const [ns, keys] of Object.entries(required)) for (const key of Object.keys(keys)) if (!ctx.capabilities[ns]?.[key]) throw structuredError(\"ORM.CAPABILITY_MISSING\", `${methodName}() requires capability ${ns}.${key}`, { meta: {\n\t\tmethod: methodName,\n\t\tcapability: `${ns}.${key}`\n\t} });\n}\nfunction resolveSelectArgs(args, scope, ctx) {\n\tconst projections = [];\n\tconst newRowFields = {};\n\tif (args.length === 0) return {\n\t\tprojections,\n\t\tnewRowFields\n\t};\n\tif (typeof args[0] === \"string\" && (args.length === 1 || typeof args[1] !== \"function\")) {\n\t\tfor (const colName of args) {\n\t\t\tconst field = scope.topLevel[colName];\n\t\t\tif (!field) throw structuredError(\"ORM.COLUMN_UNKNOWN\", `Column \"${colName}\" not found in scope`, { meta: { column: colName } });\n\t\t\tprojections.push(ProjectionItem.of(colName, IdentifierRef.of(colName), field.codec));\n\t\t\tnewRowFields[colName] = field;\n\t\t}\n\t\treturn {\n\t\t\tprojections,\n\t\t\tnewRowFields\n\t\t};\n\t}\n\tif (typeof args[0] === \"string\" && typeof args[1] === \"function\") {\n\t\tconst alias = args[0];\n\t\tconst exprFn = args[1];\n\t\tconst fns = createAggregateFunctions(ctx.queryOperationTypes, ctx.rawCodecInferer);\n\t\tconst result = exprFn(createFieldProxy(scope), fns);\n\t\tconst field = result.returnType;\n\t\tprojections.push(ProjectionItem.of(alias, result.buildAst(), field.codec));\n\t\tnewRowFields[alias] = field;\n\t\treturn {\n\t\t\tprojections,\n\t\t\tnewRowFields\n\t\t};\n\t}\n\tif (typeof args[0] === \"function\") {\n\t\tconst callbackFn = args[0];\n\t\tconst fns = createAggregateFunctions(ctx.queryOperationTypes, ctx.rawCodecInferer);\n\t\tconst record = callbackFn(createFieldProxy(scope), fns);\n\t\tfor (const [key, expr] of Object.entries(record)) {\n\t\t\tconst field = expr.returnType;\n\t\t\tprojections.push(ProjectionItem.of(key, expr.buildAst(), field.codec));\n\t\t\tnewRowFields[key] = field;\n\t\t}\n\t\treturn {\n\t\t\tprojections,\n\t\t\tnewRowFields\n\t\t};\n\t}\n\tthrow structuredError(\"ORM.ARGUMENT_INVALID\", \"Invalid .select() arguments\");\n}\nfunction resolveOrderBy(arg, options, scope, rowFields, ctx, useAggregateFns) {\n\tconst dir = options?.direction ?? \"asc\";\n\tif (typeof arg === \"string\") {\n\t\tif (!(arg in orderByScopeOf(scope, rowFields).topLevel)) throw structuredError(\"ORM.COLUMN_UNKNOWN\", `Column \"${arg}\" not found in scope for orderBy`, { meta: { column: arg } });\n\t\tconst expr = IdentifierRef.of(arg);\n\t\treturn dir === \"asc\" ? OrderByItem.asc(expr) : OrderByItem.desc(expr);\n\t}\n\tif (typeof arg === \"function\") {\n\t\tconst combined = orderByScopeOf(scope, rowFields);\n\t\tconst fns = useAggregateFns ? createAggregateFunctions(ctx.queryOperationTypes, ctx.rawCodecInferer) : createFunctions(ctx.queryOperationTypes, ctx.rawCodecInferer);\n\t\tconst result = arg(createFieldProxy(combined), fns);\n\t\treturn dir === \"asc\" ? OrderByItem.asc(result.buildAst()) : OrderByItem.desc(result.buildAst());\n\t}\n\tthrow structuredError(\"ORM.ARGUMENT_INVALID\", \"Invalid orderBy argument\");\n}\nfunction resolveGroupBy(args, scope, rowFields, ctx) {\n\tif (typeof args[0] === \"string\") {\n\t\tconst combined = orderByScopeOf(scope, rowFields);\n\t\treturn args.map((colName) => {\n\t\t\tif (!(colName in combined.topLevel)) throw structuredError(\"ORM.COLUMN_UNKNOWN\", `Column \"${colName}\" not found in scope for groupBy`, { meta: { column: colName } });\n\t\t\treturn IdentifierRef.of(colName);\n\t\t});\n\t}\n\tif (typeof args[0] === \"function\") {\n\t\tconst combined = orderByScopeOf(scope, rowFields);\n\t\tconst fns = createFunctions(ctx.queryOperationTypes, ctx.rawCodecInferer);\n\t\treturn [args[0](createFieldProxy(combined), fns).buildAst()];\n\t}\n\tthrow structuredError(\"ORM.ARGUMENT_INVALID\", \"Invalid groupBy arguments\");\n}\nfunction resolveDistinctOn(args, scope, rowFields, ctx) {\n\tif (args.length === 1 && typeof args[0] === \"function\") {\n\t\tconst combined = orderByScopeOf(scope, rowFields);\n\t\tconst fns = createFunctions(ctx.queryOperationTypes, ctx.rawCodecInferer);\n\t\treturn [args[0](createFieldProxy(combined), fns).buildAst()];\n\t}\n\tconst combined = orderByScopeOf(scope, rowFields);\n\treturn args.map((colName) => {\n\t\tif (!(colName in combined.topLevel)) throw structuredError(\"ORM.COLUMN_UNKNOWN\", `Column \"${colName}\" not found in scope for distinctOn`, { meta: { column: colName } });\n\t\treturn IdentifierRef.of(colName);\n\t});\n}\n//#endregion\n//#region src/runtime/query-impl.ts\nvar QueryBase = class extends BuilderBase {\n\tstate;\n\tconstructor(state, ctx) {\n\t\tsuper(ctx);\n\t\tthis.state = state;\n\t}\n\tdistinctOn = this._gate({ postgres: { distinctOn: true } }, \"distinctOn\", (...args) => {\n\t\tconst exprs = resolveDistinctOn(args, this.state.scope, this.state.rowFields, this.ctx);\n\t\treturn this.clone(cloneState(this.state, { distinctOn: [...this.state.distinctOn ?? [], ...exprs] }));\n\t});\n\tlimit(count) {\n\t\tconst limit = typeof count === \"number\" ? count : toExpr(count);\n\t\treturn this.clone(cloneState(this.state, { limit }));\n\t}\n\toffset(count) {\n\t\tconst offset = typeof count === \"number\" ? count : toExpr(count);\n\t\treturn this.clone(cloneState(this.state, { offset }));\n\t}\n\tdistinct() {\n\t\treturn this.clone(cloneState(this.state, { distinct: true }));\n\t}\n\t/**\n\t* Attach one or more annotations to this query plan.\n\t*\n\t* Read builders (`SelectQueryImpl`, `GroupedQueryImpl`) accept\n\t* annotations whose declared `applicableTo` includes `'read'`.\n\t* The type-level `As & ValidAnnotations<'read', As>` gate rejects\n\t* write-only annotations at the call site; the runtime check below\n\t* fails closed for callers that bypass the type gate (cast / `any`).\n\t*\n\t* Multiple `.annotate(...)` calls compose; duplicate namespaces use\n\t* last-write-wins. The accumulated annotations are merged into\n\t* `plan.meta.annotations` at `.build()` time, alongside any framework-\n\t* internal metadata under reserved namespaces (e.g. `codecs`).\n\t*\n\t* Chainable in any position (before / after `.where`, `.select`,\n\t* `.limit`, etc.); the returned builder has the same row type.\n\t*/\n\tannotate(...annotations) {\n\t\tassertAnnotationsApplicable(annotations, \"read\", \"sql-dsl.annotate\");\n\t\tconst next = new Map(this.state.annotations);\n\t\tfor (const annotation of annotations) next.set(annotation.namespace, annotation);\n\t\treturn this.clone(cloneState(this.state, { annotations: next }));\n\t}\n\tgroupBy(...args) {\n\t\tconst exprs = resolveGroupBy(args, this.state.scope, this.state.rowFields, this.ctx);\n\t\treturn new GroupedQueryImpl(cloneState(this.state, { groupBy: [...this.state.groupBy, ...exprs] }), this.ctx);\n\t}\n\tas(alias) {\n\t\tconst ast = buildSelectAst(this.state);\n\t\tconst derivedSource = DerivedTableSource.as(alias, ast);\n\t\tconst scope = {\n\t\t\ttopLevel: this.state.rowFields,\n\t\t\tnamespaces: { [alias]: this.state.rowFields }\n\t\t};\n\t\treturn {\n\t\t\tgetJoinOuterScope: () => scope,\n\t\t\tbuildAst: () => derivedSource\n\t\t};\n\t}\n\tgetRowFields() {\n\t\treturn this.state.rowFields;\n\t}\n\tbuildAst() {\n\t\treturn buildSelectAst(this.state);\n\t}\n\tbuild() {\n\t\treturn buildPlan(this.state, this.ctx);\n\t}\n};\nvar SelectQueryImpl = class SelectQueryImpl extends QueryBase {\n\tclone(state) {\n\t\treturn new SelectQueryImpl(state, this.ctx);\n\t}\n\tselect(...args) {\n\t\tconst { projections, newRowFields } = resolveSelectArgs(args, this.state.scope, this.ctx);\n\t\treturn new SelectQueryImpl(cloneState(this.state, {\n\t\t\tprojections: [...this.state.projections, ...projections],\n\t\t\trowFields: {\n\t\t\t\t...this.state.rowFields,\n\t\t\t\t...newRowFields\n\t\t\t}\n\t\t}), this.ctx);\n\t}\n\twhere(expr) {\n\t\tconst result = expr(createFieldProxy(this.state.scope), createFunctions(this.ctx.queryOperationTypes, this.ctx.rawCodecInferer));\n\t\treturn new SelectQueryImpl(cloneState(this.state, { where: [...this.state.where, result.buildAst()] }), this.ctx);\n\t}\n\torderBy(arg, options) {\n\t\tconst item = resolveOrderBy(arg, options, this.state.scope, this.state.rowFields, this.ctx, false);\n\t\treturn this.clone(cloneState(this.state, { orderBy: [...this.state.orderBy, item] }));\n\t}\n};\nvar GroupedQueryImpl = class GroupedQueryImpl extends QueryBase {\n\tclone(state) {\n\t\treturn new GroupedQueryImpl(state, this.ctx);\n\t}\n\thaving(expr) {\n\t\tconst combined = orderByScopeOf(this.state.scope, this.state.rowFields);\n\t\tconst fns = createAggregateFunctions(this.ctx.queryOperationTypes, this.ctx.rawCodecInferer);\n\t\tconst result = expr(createFieldProxy(combined), fns);\n\t\treturn new GroupedQueryImpl(cloneState(this.state, { having: result.buildAst() }), this.ctx);\n\t}\n\torderBy(arg, options) {\n\t\tconst item = resolveOrderBy(arg, options, this.state.scope, this.state.rowFields, this.ctx, true);\n\t\treturn this.clone(cloneState(this.state, { orderBy: [...this.state.orderBy, item] }));\n\t}\n};\n//#endregion\n//#region src/runtime/joined-tables-impl.ts\nvar JoinedTablesImpl = class JoinedTablesImpl extends BuilderBase {\n\t#state;\n\tconstructor(state, ctx) {\n\t\tsuper(ctx);\n\t\tthis.#state = state;\n\t}\n\tlateralJoin = this._gate({ sql: { lateral: true } }, \"lateralJoin\", (alias, builder) => {\n\t\tconst { derivedSource, lateralScope } = this.#buildLateral(alias, builder);\n\t\tconst resultScope = mergeScopes(this.#state.scope, lateralScope);\n\t\treturn this.#addLateralJoin(\"inner\", resultScope, derivedSource);\n\t});\n\touterLateralJoin = this._gate({ sql: { lateral: true } }, \"outerLateralJoin\", (alias, builder) => {\n\t\tconst { derivedSource, lateralScope } = this.#buildLateral(alias, builder);\n\t\tconst resultScope = mergeScopes(this.#state.scope, nullableScope(lateralScope));\n\t\treturn this.#addLateralJoin(\"left\", resultScope, derivedSource);\n\t});\n\tselect(...args) {\n\t\tconst { projections, newRowFields } = resolveSelectArgs(args, this.#state.scope, this.ctx);\n\t\treturn new SelectQueryImpl(cloneState(this.#state, {\n\t\t\tprojections: [...this.#state.projections, ...projections],\n\t\t\trowFields: {\n\t\t\t\t...this.#state.rowFields,\n\t\t\t\t...newRowFields\n\t\t\t}\n\t\t}), this.ctx);\n\t}\n\tinnerJoin(other, on) {\n\t\tconst targetScope = mergeScopes(this.#state.scope, other.getJoinOuterScope());\n\t\treturn this.#addJoin(other, \"inner\", targetScope, on);\n\t}\n\touterLeftJoin(other, on) {\n\t\tconst targetScope = mergeScopes(this.#state.scope, nullableScope(other.getJoinOuterScope()));\n\t\treturn this.#addJoin(other, \"left\", targetScope, on);\n\t}\n\touterRightJoin(other, on) {\n\t\tconst targetScope = mergeScopes(nullableScope(this.#state.scope), other.getJoinOuterScope());\n\t\treturn this.#addJoin(other, \"right\", targetScope, on);\n\t}\n\touterFullJoin(other, on) {\n\t\tconst targetScope = mergeScopes(nullableScope(this.#state.scope), nullableScope(other.getJoinOuterScope()));\n\t\treturn this.#addJoin(other, \"full\", targetScope, on);\n\t}\n\t#addJoin(other, joinType, resultScope, onExpr) {\n\t\tconst onResult = onExpr(createFieldProxy(mergeScopes(this.#state.scope, other.getJoinOuterScope())), createFunctions(this.ctx.queryOperationTypes, this.ctx.rawCodecInferer));\n\t\tconst joinAst = new JoinAst(joinType, other.buildAst(), onResult.buildAst());\n\t\treturn new JoinedTablesImpl(cloneState(this.#state, {\n\t\t\tjoins: [...this.#state.joins, joinAst],\n\t\t\tscope: resultScope\n\t\t}), this.ctx);\n\t}\n\t#buildLateral(alias, builderFn) {\n\t\tconst subquery = builderFn({ from: (other) => {\n\t\t\tconst otherScope = other.getJoinOuterScope();\n\t\t\tconst parentMerged = mergeScopes(this.#state.scope, otherScope);\n\t\t\treturn new SelectQueryImpl(emptyState(other.buildAst(), parentMerged), this.ctx);\n\t\t} });\n\t\tconst subqueryAst = subquery.buildAst();\n\t\tconst derivedSource = DerivedTableSource.as(alias, subqueryAst);\n\t\tconst subqueryRowFields = subquery.getRowFields();\n\t\treturn {\n\t\t\tderivedSource,\n\t\t\tlateralScope: {\n\t\t\t\ttopLevel: subqueryRowFields,\n\t\t\t\tnamespaces: { [alias]: subqueryRowFields }\n\t\t\t}\n\t\t};\n\t}\n\t#addLateralJoin(joinType, resultScope, derivedSource) {\n\t\tconst joinAst = new JoinAst(joinType, derivedSource, AndExpr.of([]), true);\n\t\treturn new JoinedTablesImpl(cloneState(this.#state, {\n\t\t\tjoins: [...this.#state.joins, joinAst],\n\t\t\tscope: resultScope\n\t\t}), this.ctx);\n\t}\n};\n//#endregion\n//#region src/runtime/mutation-impl.ts\n/**\n* Validates and merges a variadic annotations call into a builder's\n* accumulated user-annotations map. Used by `.annotate(...)` on each of\n* the three mutation builders (`InsertQueryImpl`, `UpdateQueryImpl`,\n* `DeleteQueryImpl`); the read builders share the same logic via\n* `QueryBase.annotate()` in `./query-impl.ts`.\n*\n* Runs `assertAnnotationsApplicable` at call time (not at `.build()`) so\n* inapplicable annotations forced through casts surface immediately\n* rather than at plan-construction time.\n*/\nfunction mergeWriteAnnotations(current, annotations) {\n\tassertAnnotationsApplicable(annotations, \"write\", \"sql-dsl.annotate\");\n\tconst next = new Map(current);\n\tfor (const annotation of annotations) next.set(annotation.namespace, annotation);\n\treturn next;\n}\nfunction buildParamValues(values, namespaceId, table, tableName, op, ctx) {\n\tconst params = {};\n\tfor (const [col, value] of Object.entries(values)) {\n\t\tconst codec = table.columns[col] ? codecRefFor(ctx, namespaceId, tableName, col) : void 0;\n\t\tparams[col] = ParamRef.of(value, codec ? { codec } : void 0);\n\t}\n\tfor (const def of ctx.applyMutationDefaults({\n\t\top,\n\t\tnamespace: namespaceId,\n\t\ttable: tableName,\n\t\tvalues\n\t})) {\n\t\tconst codec = table.columns[def.column] ? codecRefFor(ctx, namespaceId, tableName, def.column) : void 0;\n\t\tparams[def.column] = ParamRef.of(def.value, codec ? { codec } : void 0);\n\t}\n\treturn params;\n}\nfunction buildReturningProjections(tableName, columns, rowFields) {\n\treturn columns.map((col) => ProjectionItem.of(col, ColumnRef.of(tableName, col), rowFields[col]?.codec));\n}\nfunction evaluateWhere(whereCallback, scope, queryOperationTypes, rawCodecInferer) {\n\treturn whereCallback(createFieldProxy(scope), createFunctions(queryOperationTypes, rawCodecInferer)).buildAst();\n}\nfunction evaluateUpdateCallback(callback, scope, queryOperationTypes, rawCodecInferer) {\n\tconst result = callback(createFieldProxy(scope), createFunctions(queryOperationTypes, rawCodecInferer));\n\tconst set = {};\n\tfor (const [col, expr] of Object.entries(result)) if (expr !== void 0) set[col] = expr.buildAst();\n\treturn set;\n}\nfunction buildSetExpressions(exprs, namespaceId, table, tableName, op, ctx) {\n\tconst set = { ...exprs };\n\tfor (const def of ctx.applyMutationDefaults({\n\t\top,\n\t\tnamespace: namespaceId,\n\t\ttable: tableName,\n\t\tvalues: exprs\n\t})) if (!(def.column in set)) {\n\t\tconst codec = table.columns[def.column] ? codecRefFor(ctx, namespaceId, tableName, def.column) : void 0;\n\t\tset[def.column] = ParamRef.of(def.value, ifDefined(\"codec\", codec));\n\t}\n\treturn set;\n}\nvar InsertQueryImpl = class InsertQueryImpl extends BuilderBase {\n\t#tableSource;\n\t#tableName;\n\t#namespaceId;\n\t#table;\n\t#scope;\n\t#rows;\n\t#returningColumns;\n\t#rowFields;\n\t#annotations;\n\tconstructor(tableSource, namespaceId, table, scope, rows, ctx, returningColumns = [], rowFields = {}, annotations = /* @__PURE__ */ new Map()) {\n\t\tsuper(ctx);\n\t\tthis.#tableSource = tableSource;\n\t\tthis.#tableName = tableSource.name;\n\t\tthis.#namespaceId = namespaceId;\n\t\tthis.#table = table;\n\t\tthis.#scope = scope;\n\t\tthis.#rows = rows;\n\t\tthis.#returningColumns = returningColumns;\n\t\tthis.#rowFields = rowFields;\n\t\tthis.#annotations = annotations;\n\t}\n\treturning = this._gate({ sql: { returning: true } }, \"returning\", (...columns) => {\n\t\tconst newRowFields = {};\n\t\tfor (const col of columns) {\n\t\t\tconst field = this.#scope.topLevel[col];\n\t\t\tif (!field) throw structuredError(\"ORM.COLUMN_UNKNOWN\", `Column \"${col}\" not found in scope`, { meta: { column: col } });\n\t\t\tnewRowFields[col] = field;\n\t\t}\n\t\treturn new InsertQueryImpl(this.#tableSource, this.#namespaceId, this.#table, this.#scope, this.#rows, this.ctx, columns, newRowFields, this.#annotations);\n\t});\n\t/**\n\t* Attach one or more write-typed annotations to this query plan.\n\t* The type-level `As & ValidAnnotations<'write', As>` gate rejects\n\t* read-only annotations at the call site; the runtime check fails\n\t* closed for callers that bypass the type gate. See `QueryBase.annotate`\n\t* in `./query-impl.ts` for the read-builder counterpart.\n\t*/\n\tannotate(...annotations) {\n\t\treturn new InsertQueryImpl(this.#tableSource, this.#namespaceId, this.#table, this.#scope, this.#rows, this.ctx, this.#returningColumns, this.#rowFields, mergeWriteAnnotations(this.#annotations, annotations));\n\t}\n\tbuild() {\n\t\tif (this.#rows.length === 0) throw structuredError(\"ORM.MUTATION_DATA_MISSING\", \"insert() called with an empty row array — at least one row is required\");\n\t\tconst paramRows = this.#rows.map((rowValues) => buildParamValues(rowValues, this.#namespaceId, this.#table, this.#tableName, \"create\", this.ctx));\n\t\tlet ast = InsertAst.into(this.#tableSource).withRows(paramRows);\n\t\tif (this.#returningColumns.length > 0) ast = ast.withReturning(buildReturningProjections(this.#tableName, this.#returningColumns, this.#rowFields));\n\t\treturn buildQueryPlan(ast, this.ctx, this.#annotations);\n\t}\n};\nvar UpdateQueryImpl = class UpdateQueryImpl extends BuilderBase {\n\t#tableSource;\n\t#tableName;\n\t#scope;\n\t#setExpressions;\n\t#whereExprs;\n\t#returningColumns;\n\t#rowFields;\n\t#annotations;\n\tconstructor(tableSource, scope, setExpressions, ctx, whereExprs = [], returningColumns = [], rowFields = {}, annotations = /* @__PURE__ */ new Map()) {\n\t\tsuper(ctx);\n\t\tthis.#tableSource = tableSource;\n\t\tthis.#tableName = tableSource.name;\n\t\tthis.#scope = scope;\n\t\tthis.#setExpressions = setExpressions;\n\t\tthis.#whereExprs = whereExprs;\n\t\tthis.#returningColumns = returningColumns;\n\t\tthis.#rowFields = rowFields;\n\t\tthis.#annotations = annotations;\n\t}\n\twhere(expr) {\n\t\tconst result = expr(createFieldProxy(this.#scope), createFunctions(this.ctx.queryOperationTypes, this.ctx.rawCodecInferer));\n\t\treturn new UpdateQueryImpl(this.#tableSource, this.#scope, this.#setExpressions, this.ctx, [...this.#whereExprs, result.buildAst()], this.#returningColumns, this.#rowFields, this.#annotations);\n\t}\n\treturning = this._gate({ sql: { returning: true } }, \"returning\", (...columns) => {\n\t\tconst newRowFields = {};\n\t\tfor (const col of columns) {\n\t\t\tconst field = this.#scope.topLevel[col];\n\t\t\tif (!field) throw structuredError(\"ORM.COLUMN_UNKNOWN\", `Column \"${col}\" not found in scope`, { meta: { column: col } });\n\t\t\tnewRowFields[col] = field;\n\t\t}\n\t\treturn new UpdateQueryImpl(this.#tableSource, this.#scope, this.#setExpressions, this.ctx, this.#whereExprs, columns, newRowFields, this.#annotations);\n\t});\n\t/**\n\t* Attach one or more write-typed annotations to this query plan.\n\t* See `InsertQueryImpl.annotate` for semantics; the runtime check\n\t* fails closed for callers that bypass the type-level gate.\n\t*/\n\tannotate(...annotations) {\n\t\treturn new UpdateQueryImpl(this.#tableSource, this.#scope, this.#setExpressions, this.ctx, this.#whereExprs, this.#returningColumns, this.#rowFields, mergeWriteAnnotations(this.#annotations, annotations));\n\t}\n\tbuild() {\n\t\tlet ast = UpdateAst.table(this.#tableSource).withSet(this.#setExpressions).withWhere(combineWhereExprs(this.#whereExprs));\n\t\tif (this.#returningColumns.length > 0) ast = ast.withReturning(buildReturningProjections(this.#tableName, this.#returningColumns, this.#rowFields));\n\t\treturn buildQueryPlan(ast, this.ctx, this.#annotations);\n\t}\n};\nvar DeleteQueryImpl = class DeleteQueryImpl extends BuilderBase {\n\t#tableSource;\n\t#tableName;\n\t#scope;\n\t#whereCallbacks;\n\t#returningColumns;\n\t#rowFields;\n\t#annotations;\n\tconstructor(tableSource, scope, ctx, whereCallbacks = [], returningColumns = [], rowFields = {}, annotations = /* @__PURE__ */ new Map()) {\n\t\tsuper(ctx);\n\t\tthis.#tableSource = tableSource;\n\t\tthis.#tableName = tableSource.name;\n\t\tthis.#scope = scope;\n\t\tthis.#whereCallbacks = whereCallbacks;\n\t\tthis.#returningColumns = returningColumns;\n\t\tthis.#rowFields = rowFields;\n\t\tthis.#annotations = annotations;\n\t}\n\twhere(expr) {\n\t\treturn new DeleteQueryImpl(this.#tableSource, this.#scope, this.ctx, [...this.#whereCallbacks, expr], this.#returningColumns, this.#rowFields, this.#annotations);\n\t}\n\treturning = this._gate({ sql: { returning: true } }, \"returning\", (...columns) => {\n\t\tconst newRowFields = {};\n\t\tfor (const col of columns) {\n\t\t\tconst field = this.#scope.topLevel[col];\n\t\t\tif (!field) throw structuredError(\"ORM.COLUMN_UNKNOWN\", `Column \"${col}\" not found in scope`, { meta: { column: col } });\n\t\t\tnewRowFields[col] = field;\n\t\t}\n\t\treturn new DeleteQueryImpl(this.#tableSource, this.#scope, this.ctx, this.#whereCallbacks, columns, newRowFields, this.#annotations);\n\t});\n\t/**\n\t* Attach one or more write-typed annotations to this query plan.\n\t* See `InsertQueryImpl.annotate` for semantics.\n\t*/\n\tannotate(...annotations) {\n\t\treturn new DeleteQueryImpl(this.#tableSource, this.#scope, this.ctx, this.#whereCallbacks, this.#returningColumns, this.#rowFields, mergeWriteAnnotations(this.#annotations, annotations));\n\t}\n\tbuild() {\n\t\tconst whereExpr = combineWhereExprs(this.#whereCallbacks.map((cb) => evaluateWhere(cb, this.#scope, this.ctx.queryOperationTypes, this.ctx.rawCodecInferer)));\n\t\tlet ast = DeleteAst.from(this.#tableSource).withWhere(whereExpr);\n\t\tif (this.#returningColumns.length > 0) ast = ast.withReturning(buildReturningProjections(this.#tableName, this.#returningColumns, this.#rowFields));\n\t\treturn buildQueryPlan(ast, this.ctx, this.#annotations);\n\t}\n};\n//#endregion\n//#region src/runtime/table-source-for-proxy.ts\nfunction tableSourceForProxy(tableName, alias, namespaceId) {\n\treturn TableSource.named(tableName, alias !== tableName ? alias : void 0, namespaceId);\n}\n//#endregion\n//#region src/runtime/table-proxy-impl.ts\nvar TableProxyImpl = class TableProxyImpl extends BuilderBase {\n\t#tableName;\n\t#table;\n\t#namespaceId;\n\t#fromSource;\n\t#scope;\n\tconstructor(tableName, table, alias, ctx, namespaceId) {\n\t\tsuper(ctx);\n\t\tthis.#tableName = tableName;\n\t\tthis.#table = table;\n\t\tthis.#namespaceId = namespaceId;\n\t\tthis.#scope = tableToScope(alias, table, {\n\t\t\tstorage: ctx.storage,\n\t\t\ttableName,\n\t\t\tnamespaceId\n\t\t});\n\t\tthis.#fromSource = tableSourceForProxy(tableName, alias, namespaceId);\n\t}\n\tlateralJoin = this._gate({ sql: { lateral: true } }, \"lateralJoin\", (alias, builder) => {\n\t\treturn this.#toJoined().lateralJoin(alias, builder);\n\t});\n\touterLateralJoin = this._gate({ sql: { lateral: true } }, \"outerLateralJoin\", (alias, builder) => {\n\t\treturn this.#toJoined().outerLateralJoin(alias, builder);\n\t});\n\tgetJoinOuterScope() {\n\t\treturn this.#scope;\n\t}\n\tbuildAst() {\n\t\treturn this.#fromSource;\n\t}\n\tas(newAlias) {\n\t\treturn new TableProxyImpl(this.#tableName, this.#table, newAlias, this.ctx, this.#namespaceId);\n\t}\n\tselect(...args) {\n\t\treturn new SelectQueryImpl(emptyState(this.#fromSource, this.#scope), this.ctx).select(...args);\n\t}\n\tinnerJoin(other, on) {\n\t\treturn this.#toJoined().innerJoin(other, on);\n\t}\n\touterLeftJoin(other, on) {\n\t\treturn this.#toJoined().outerLeftJoin(other, on);\n\t}\n\touterRightJoin(other, on) {\n\t\treturn this.#toJoined().outerRightJoin(other, on);\n\t}\n\touterFullJoin(other, on) {\n\t\treturn this.#toJoined().outerFullJoin(other, on);\n\t}\n\tinsert(rows) {\n\t\treturn new InsertQueryImpl(this.#fromSource, this.#namespaceId, this.#table, this.#scope, rows, this.ctx);\n\t}\n\tupdate(setOrCallback) {\n\t\tif (typeof setOrCallback === \"function\") {\n\t\t\tconst setExpressions = buildSetExpressions(evaluateUpdateCallback(setOrCallback, this.#scope, this.ctx.queryOperationTypes, this.ctx.rawCodecInferer), this.#namespaceId, this.#table, this.#tableName, \"update\", this.ctx);\n\t\t\treturn new UpdateQueryImpl(this.#fromSource, this.#scope, setExpressions, this.ctx);\n\t\t}\n\t\tconst setExpressions = buildParamValues(setOrCallback, this.#namespaceId, this.#table, this.#tableName, \"update\", this.ctx);\n\t\treturn new UpdateQueryImpl(this.#fromSource, this.#scope, setExpressions, this.ctx);\n\t}\n\tdelete() {\n\t\treturn new DeleteQueryImpl(this.#fromSource, this.#scope, this.ctx);\n\t}\n\t#toJoined() {\n\t\treturn new JoinedTablesImpl(emptyState(this.#fromSource, this.#scope), this.ctx);\n\t}\n};\n//#endregion\n//#region src/runtime/sql.ts\nfunction sql(options) {\n\tconst { context, rawCodecInferer } = options;\n\tconst ctx = {\n\t\tcapabilities: context.contract.capabilities,\n\t\tqueryOperationTypes: context.queryOperations.entries(),\n\t\ttarget: context.contract.target ?? \"unknown\",\n\t\tstorageHash: context.contract.storage.storageHash ?? \"unknown\",\n\t\tstorage: context.contract.storage,\n\t\tapplyMutationDefaults: (options) => context.applyMutationDefaults(options),\n\t\trawCodecInferer\n\t};\n\tconst { storage } = context.contract;\n\treturn new Proxy({}, { get(_target, prop) {\n\t\tif (typeof prop !== \"string\") return;\n\t\tif (!Object.hasOwn(storage.namespaces, prop)) return;\n\t\tconst namespaceId = prop;\n\t\treturn new Proxy({}, { get(_facetTarget, tableName) {\n\t\t\tif (typeof tableName !== \"string\") return;\n\t\t\tconst table = resolveTableInNamespace(storage, namespaceId, tableName);\n\t\t\tif (table) return new TableProxyImpl(tableName, table, tableName, ctx, namespaceId);\n\t\t} });\n\t} });\n}\n//#endregion\nexport { ExpressionImpl, createAggregateFunctions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,OAAO,IAAI,MAAM,CAAC,GAAG,EAAE,IAAI,cAAc,WAAW;GACnD,IAAI,OAAO,cAAc,UAAU;GACnC,MAAM,QAAQ,wBAAwB,SAAS,aAAa,SAAS;GACrE,IAAI,OAAO,OAAO,IAAI,eAAe,WAAW,OAAO,WAAW,KAAK,WAAW;EACnF,EAAE,CAAC;CACJ,EAAE,CAAC;AACJ"}
@@ -0,0 +1,3 @@
1
+ import { a as Expression, u as ScopeField } from "./expression-DIf8F4Mc.mjs";
2
+ import { _ as TableNamesAcrossNamespaces, b as UnboundTables, c as GroupedQuery, d as QueryContext, f as ResolveRow, g as TableInAnyNamespace, h as Subquery, i as DeleteQuery, l as InsertQuery, m as SelectQuery, n as BooleanCodecType, o as Functions, p as Scope, r as Db, s as GatedMethod, t as AggregateFunctions, u as Namespace, v as TableProxy, x as UpdateQuery, y as TableProxyContract } from "./db-DhMsmBS--DKENDi3l.mjs";
3
+ export type { AggregateFunctions, BooleanCodecType, Db, DeleteQuery, Expression, Functions, GatedMethod, GroupedQuery, InsertQuery, Namespace, QueryContext, ResolveRow, Scope, ScopeField, SelectQuery, Subquery, TableInAnyNamespace, TableNamesAcrossNamespaces, TableProxy, TableProxyContract, UnboundTables, UpdateQuery };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { PreserveEmptyPredicate, StorageSort } from "@prisma/orm-framework/contract/hashing";
2
+ //#region ../../../2-sql/1-core/contract/dist/canonicalization-hooks.d.mts
3
+ //#region src/canonicalization-hooks.d.ts
4
+ declare const sqlContractCanonicalizationHooks: {
5
+ readonly shouldPreserveEmpty: PreserveEmptyPredicate;
6
+ readonly sortStorage: StorageSort;
7
+ };
8
+ //#endregion
9
+ export { sqlContractCanonicalizationHooks as t };
10
+ //# sourceMappingURL=canonicalization-hooks-CYnW_sGn.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonicalization-hooks-CYnW_sGn.d.mts","names":[],"sources":["../../../../2-sql/1-core/contract/dist/canonicalization-hooks.d.mts"],"mappings":";;;cAEc;WACH,qBAAqB;WACrB,aAAa"}
@@ -0,0 +1,87 @@
1
+ import { createPreserveEmptyPredicate, createStorageSort, matchesPathPattern } from "@prisma/orm-framework/contract/hashing-utils";
2
+ //#region ../../../2-sql/1-core/contract/dist/canonicalization-hooks.mjs
3
+ const preserveEmptyPatterns = [
4
+ [
5
+ "storage",
6
+ "namespaces",
7
+ "*",
8
+ "entries",
9
+ "table"
10
+ ],
11
+ [
12
+ "storage",
13
+ "namespaces",
14
+ "*",
15
+ "entries",
16
+ "table",
17
+ "*"
18
+ ],
19
+ [
20
+ "storage",
21
+ "namespaces",
22
+ "*",
23
+ "entries",
24
+ "table",
25
+ "*",
26
+ [
27
+ "uniques",
28
+ "indexes",
29
+ "foreignKeys"
30
+ ]
31
+ ],
32
+ [
33
+ "storage",
34
+ "namespaces",
35
+ "*",
36
+ "entries",
37
+ "table",
38
+ "*",
39
+ "indexes",
40
+ "unique"
41
+ ],
42
+ [
43
+ "storage",
44
+ "namespaces",
45
+ "*",
46
+ "entries",
47
+ "table",
48
+ "*",
49
+ "columns",
50
+ "*",
51
+ "default",
52
+ "value"
53
+ ]
54
+ ];
55
+ const columnDefaultValuePrefix = [
56
+ "storage",
57
+ "namespaces",
58
+ "*",
59
+ "entries",
60
+ "table",
61
+ "*",
62
+ "columns",
63
+ "*",
64
+ "default",
65
+ "value"
66
+ ];
67
+ const isColumnDefaultValuePath = (path) => path.length >= columnDefaultValuePrefix.length && matchesPathPattern(path.slice(0, columnDefaultValuePrefix.length), columnDefaultValuePrefix);
68
+ const sortTargets = [{
69
+ path: [
70
+ "namespaces",
71
+ "*",
72
+ "entries",
73
+ "table",
74
+ "*"
75
+ ],
76
+ arrayKeys: ["indexes", "uniques"]
77
+ }];
78
+ const matchesPreserveEmptyPattern = createPreserveEmptyPredicate(preserveEmptyPatterns);
79
+ const shouldPreserveEmpty = (path) => isColumnDefaultValuePath(path) || matchesPreserveEmptyPattern(path);
80
+ const sqlContractCanonicalizationHooks = {
81
+ shouldPreserveEmpty,
82
+ sortStorage: createStorageSort(sortTargets)
83
+ };
84
+ //#endregion
85
+ export { sqlContractCanonicalizationHooks as t };
86
+
87
+ //# sourceMappingURL=canonicalization-hooks-DfIc_lOO.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonicalization-hooks-DfIc_lOO.mjs","names":[],"sources":["../../../../2-sql/1-core/contract/dist/canonicalization-hooks.mjs"],"sourcesContent":["import { createPreserveEmptyPredicate, createStorageSort, matchesPathPattern } from \"@internal/contract/hashing-utils\";\n//#region src/canonicalization-hooks.ts\nconst preserveEmptyPatterns = [\n\t[\n\t\t\"storage\",\n\t\t\"namespaces\",\n\t\t\"*\",\n\t\t\"entries\",\n\t\t\"table\"\n\t],\n\t[\n\t\t\"storage\",\n\t\t\"namespaces\",\n\t\t\"*\",\n\t\t\"entries\",\n\t\t\"table\",\n\t\t\"*\"\n\t],\n\t[\n\t\t\"storage\",\n\t\t\"namespaces\",\n\t\t\"*\",\n\t\t\"entries\",\n\t\t\"table\",\n\t\t\"*\",\n\t\t[\n\t\t\t\"uniques\",\n\t\t\t\"indexes\",\n\t\t\t\"foreignKeys\"\n\t\t]\n\t],\n\t[\n\t\t\"storage\",\n\t\t\"namespaces\",\n\t\t\"*\",\n\t\t\"entries\",\n\t\t\"table\",\n\t\t\"*\",\n\t\t\"indexes\",\n\t\t\"unique\"\n\t],\n\t[\n\t\t\"storage\",\n\t\t\"namespaces\",\n\t\t\"*\",\n\t\t\"entries\",\n\t\t\"table\",\n\t\t\"*\",\n\t\t\"columns\",\n\t\t\"*\",\n\t\t\"default\",\n\t\t\"value\"\n\t]\n];\nconst columnDefaultValuePrefix = [\n\t\"storage\",\n\t\"namespaces\",\n\t\"*\",\n\t\"entries\",\n\t\"table\",\n\t\"*\",\n\t\"columns\",\n\t\"*\",\n\t\"default\",\n\t\"value\"\n];\nconst isColumnDefaultValuePath = (path) => path.length >= columnDefaultValuePrefix.length && matchesPathPattern(path.slice(0, columnDefaultValuePrefix.length), columnDefaultValuePrefix);\nconst sortTargets = [{\n\tpath: [\n\t\t\"namespaces\",\n\t\t\"*\",\n\t\t\"entries\",\n\t\t\"table\",\n\t\t\"*\"\n\t],\n\tarrayKeys: [\"indexes\", \"uniques\"]\n}];\nconst matchesPreserveEmptyPattern = createPreserveEmptyPredicate(preserveEmptyPatterns);\nconst shouldPreserveEmpty = (path) => isColumnDefaultValuePath(path) || matchesPreserveEmptyPattern(path);\nconst sqlContractCanonicalizationHooks = {\n\tshouldPreserveEmpty,\n\tsortStorage: createStorageSort(sortTargets)\n};\n//#endregion\nexport { sqlContractCanonicalizationHooks };\n\n//# sourceMappingURL=canonicalization-hooks.mjs.map"],"mappings":";;AAEA,MAAM,wBAAwB;CAC7B;EACC;EACA;EACA;EACA;EACA;CACD;CACA;EACC;EACA;EACA;EACA;EACA;EACA;CACD;CACA;EACC;EACA;EACA;EACA;EACA;EACA;EACA;GACC;GACA;GACA;EACD;CACD;CACA;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD;CACA;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD;AACD;AACA,MAAM,2BAA2B;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;AACA,MAAM,4BAA4B,SAAS,KAAK,UAAU,yBAAyB,UAAU,mBAAmB,KAAK,MAAM,GAAG,yBAAyB,MAAM,GAAG,wBAAwB;AACxL,MAAM,cAAc,CAAC;CACpB,MAAM;EACL;EACA;EACA;EACA;EACA;CACD;CACA,WAAW,CAAC,WAAW,SAAS;AACjC,CAAC;AACD,MAAM,8BAA8B,6BAA6B,qBAAqB;AACtF,MAAM,uBAAuB,SAAS,yBAAyB,IAAI,KAAK,4BAA4B,IAAI;AACxG,MAAM,mCAAmC;CACxC;CACA,aAAa,kBAAkB,WAAW;AAC3C"}
@@ -0,0 +1,96 @@
1
+ import { t as resolveStorageTable } from "./resolve-storage-table-DZsfnzeW.mjs";
2
+ import { l as isStorageTypeInstance } from "./types-CMMQS6aG.mjs";
3
+ import { structuredError } from "@prisma/orm-framework/utils/structured-error";
4
+ import { blindCast } from "@prisma/orm-framework/utils/casts";
5
+ //#region ../../../2-sql/4-lanes/relational-core/dist/exports/codec-descriptor-registry.mjs
6
+ /**
7
+ * Derive the canonical {@link CodecRef} for a `(table, column)` pair against a {@link SqlStorage}. This is the build-time path every column-bound `ParamRef` / `ProjectionItem` uses to stamp its `codec` slot before the AST is handed to the runtime — the runtime resolver then materialises a memoised {@link import('@internal/sql-relational-core/ast').Codec} for the same `CodecRef` via `forCodecRef`.
8
+ *
9
+ * Resolution rules over namespace `entries.table[table].columns[column]`:
10
+ *
11
+ * - `typeRef` column → `{codecId, typeParams}` from `storage.types[typeRef]` (multiple columns sharing the typeRef share one ref → one memoised codec).
12
+ * - inline `typeParams` column → `{codecId, typeParams}` from the column itself.
13
+ * - non-parameterized column → `{codecId}` with `typeParams` undefined.
14
+ *
15
+ * Returns `undefined` when the table or column is unknown, or when a `typeRef` column references a `storage.types` entry that does not exist.
16
+ *
17
+ * `namespaceId` leads the coordinate args and is always supplied: every
18
+ * model/table sits in an explicit namespace, so the table is resolved strictly
19
+ * within that namespace (see {@link resolveStorageTable}).
20
+ */
21
+ function codecRefForStorageColumn(storage, namespaceId, tableName, columnName) {
22
+ const resolved = resolveStorageTable(storage, tableName, namespaceId);
23
+ if (resolved === void 0) return void 0;
24
+ const columnDef = resolved.table.columns[columnName];
25
+ if (!columnDef) return void 0;
26
+ if (columnDef.typeRef !== void 0) {
27
+ const instance = storage.types?.[columnDef.typeRef];
28
+ if (!instance) return void 0;
29
+ if (isStorageTypeInstance(instance)) {
30
+ const instanceParams = instance.typeParams;
31
+ return instanceParams !== void 0 && Object.keys(instanceParams).length > 0 ? {
32
+ codecId: instance.codecId,
33
+ typeParams: instanceParams
34
+ } : { codecId: instance.codecId };
35
+ }
36
+ return;
37
+ }
38
+ if (columnDef.typeParams !== void 0 && Object.keys(columnDef.typeParams).length > 0) {
39
+ const typeParams = blindCast(columnDef.typeParams);
40
+ return columnDef.many ? {
41
+ codecId: columnDef.codecId,
42
+ typeParams,
43
+ many: true
44
+ } : {
45
+ codecId: columnDef.codecId,
46
+ typeParams
47
+ };
48
+ }
49
+ return columnDef.many ? {
50
+ codecId: columnDef.codecId,
51
+ many: true
52
+ } : { codecId: columnDef.codecId };
53
+ }
54
+ /**
55
+ * Build a {@link CodecDescriptorRegistry} from a flat descriptor list.
56
+ *
57
+ * Used by:
58
+ * - Each codec-shipping package's `core/registry.ts` to expose a package-scoped registry as the public consumer surface (replacing raw descriptor-array exports). See ADR 208.
59
+ * - The runtime's `buildExecutionContext` to construct the contract-bound combined registry from every contributor's `codecs:` slot.
60
+ *
61
+ * The descriptor map is heterogeneous in `P` — each codec id has its own params shape. The public {@link CodecDescriptorRegistry} interface widens to `CodecDescriptor<unknown>` and consumers narrow per codec id at the call site (the descriptor's `paramsSchema` validates JSON-sourced params before the factory ever sees them, so the runtime narrow is safe). The cast at registration goes through `unknown` because
62
+ * `CodecDescriptor<P>` is invariant in `P` (the `factory` and `renderOutputType` slots use `P` contravariantly).
63
+ */
64
+ function buildCodecDescriptorRegistry(allDescriptors, storage) {
65
+ const byId = /* @__PURE__ */ new Map();
66
+ const byTargetType = /* @__PURE__ */ new Map();
67
+ for (const descriptor of allDescriptors) {
68
+ if (byId.has(descriptor.codecId)) throw structuredError("RUNTIME.DUPLICATE_CODEC", `Duplicate codec descriptor id: '${descriptor.codecId}' — registered twice during registry construction. Each codecId must be contributed by exactly one component (target / adapter / extension pack).`, { meta: { codecId: descriptor.codecId } });
69
+ const widened = descriptor;
70
+ byId.set(descriptor.codecId, widened);
71
+ for (const targetType of descriptor.targetTypes) {
72
+ const list = byTargetType.get(targetType);
73
+ if (list) list.push(widened);
74
+ else byTargetType.set(targetType, [widened]);
75
+ }
76
+ }
77
+ return {
78
+ descriptorFor(codecId) {
79
+ return byId.get(codecId);
80
+ },
81
+ codecRefForColumn(namespaceId, table, column) {
82
+ if (!storage) return void 0;
83
+ return codecRefForStorageColumn(storage, namespaceId, table, column);
84
+ },
85
+ *values() {
86
+ yield* byId.values();
87
+ },
88
+ byTargetType(targetType) {
89
+ return byTargetType.get(targetType) ?? Object.freeze([]);
90
+ }
91
+ };
92
+ }
93
+ //#endregion
94
+ export { codecRefForStorageColumn as n, buildCodecDescriptorRegistry as t };
95
+
96
+ //# sourceMappingURL=codec-descriptor-registry-BJVJRftS.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec-descriptor-registry-BJVJRftS.mjs","names":[],"sources":["../../../../2-sql/4-lanes/relational-core/dist/exports/codec-descriptor-registry.mjs"],"sourcesContent":["import { structuredError } from \"@internal/utils/structured-error\";\nimport { resolveStorageTable } from \"@internal/sql-contract/resolve-storage-table\";\nimport { isStorageTypeInstance } from \"@internal/sql-contract/types\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/codec-ref-for-column.ts\n/**\n* Derive the canonical {@link CodecRef} for a `(table, column)` pair against a {@link SqlStorage}. This is the build-time path every column-bound `ParamRef` / `ProjectionItem` uses to stamp its `codec` slot before the AST is handed to the runtime — the runtime resolver then materialises a memoised {@link import('@internal/sql-relational-core/ast').Codec} for the same `CodecRef` via `forCodecRef`.\n*\n* Resolution rules over namespace `entries.table[table].columns[column]`:\n*\n* - `typeRef` column → `{codecId, typeParams}` from `storage.types[typeRef]` (multiple columns sharing the typeRef share one ref → one memoised codec).\n* - inline `typeParams` column → `{codecId, typeParams}` from the column itself.\n* - non-parameterized column → `{codecId}` with `typeParams` undefined.\n*\n* Returns `undefined` when the table or column is unknown, or when a `typeRef` column references a `storage.types` entry that does not exist.\n*\n* `namespaceId` leads the coordinate args and is always supplied: every\n* model/table sits in an explicit namespace, so the table is resolved strictly\n* within that namespace (see {@link resolveStorageTable}).\n*/\nfunction codecRefForStorageColumn(storage, namespaceId, tableName, columnName) {\n\tconst resolved = resolveStorageTable(storage, tableName, namespaceId);\n\tif (resolved === void 0) return void 0;\n\tconst columnDef = resolved.table.columns[columnName];\n\tif (!columnDef) return void 0;\n\tif (columnDef.typeRef !== void 0) {\n\t\tconst instance = storage.types?.[columnDef.typeRef];\n\t\tif (!instance) return void 0;\n\t\tif (isStorageTypeInstance(instance)) {\n\t\t\tconst instanceParams = instance.typeParams;\n\t\t\treturn instanceParams !== void 0 && Object.keys(instanceParams).length > 0 ? {\n\t\t\t\tcodecId: instance.codecId,\n\t\t\t\ttypeParams: instanceParams\n\t\t\t} : { codecId: instance.codecId };\n\t\t}\n\t\treturn;\n\t}\n\tif (columnDef.typeParams !== void 0 && Object.keys(columnDef.typeParams).length > 0) {\n\t\tconst typeParams = blindCast(columnDef.typeParams);\n\t\treturn columnDef.many ? {\n\t\t\tcodecId: columnDef.codecId,\n\t\t\ttypeParams,\n\t\t\tmany: true\n\t\t} : {\n\t\t\tcodecId: columnDef.codecId,\n\t\t\ttypeParams\n\t\t};\n\t}\n\treturn columnDef.many ? {\n\t\tcodecId: columnDef.codecId,\n\t\tmany: true\n\t} : { codecId: columnDef.codecId };\n}\n//#endregion\n//#region src/codec-descriptor-registry.ts\n/**\n* Build a {@link CodecDescriptorRegistry} from a flat descriptor list.\n*\n* Used by:\n* - Each codec-shipping package's `core/registry.ts` to expose a package-scoped registry as the public consumer surface (replacing raw descriptor-array exports). See ADR 208.\n* - The runtime's `buildExecutionContext` to construct the contract-bound combined registry from every contributor's `codecs:` slot.\n*\n* The descriptor map is heterogeneous in `P` — each codec id has its own params shape. The public {@link CodecDescriptorRegistry} interface widens to `CodecDescriptor<unknown>` and consumers narrow per codec id at the call site (the descriptor's `paramsSchema` validates JSON-sourced params before the factory ever sees them, so the runtime narrow is safe). The cast at registration goes through `unknown` because\n* `CodecDescriptor<P>` is invariant in `P` (the `factory` and `renderOutputType` slots use `P` contravariantly).\n*/\nfunction buildCodecDescriptorRegistry(allDescriptors, storage) {\n\tconst byId = /* @__PURE__ */ new Map();\n\tconst byTargetType = /* @__PURE__ */ new Map();\n\tfor (const descriptor of allDescriptors) {\n\t\tif (byId.has(descriptor.codecId)) throw structuredError(\"RUNTIME.DUPLICATE_CODEC\", `Duplicate codec descriptor id: '${descriptor.codecId}' — registered twice during registry construction. Each codecId must be contributed by exactly one component (target / adapter / extension pack).`, { meta: { codecId: descriptor.codecId } });\n\t\tconst widened = descriptor;\n\t\tbyId.set(descriptor.codecId, widened);\n\t\tfor (const targetType of descriptor.targetTypes) {\n\t\t\tconst list = byTargetType.get(targetType);\n\t\t\tif (list) list.push(widened);\n\t\t\telse byTargetType.set(targetType, [widened]);\n\t\t}\n\t}\n\treturn {\n\t\tdescriptorFor(codecId) {\n\t\t\treturn byId.get(codecId);\n\t\t},\n\t\tcodecRefForColumn(namespaceId, table, column) {\n\t\t\tif (!storage) return void 0;\n\t\t\treturn codecRefForStorageColumn(storage, namespaceId, table, column);\n\t\t},\n\t\t*values() {\n\t\t\tyield* byId.values();\n\t\t},\n\t\tbyTargetType(targetType) {\n\t\t\treturn byTargetType.get(targetType) ?? Object.freeze([]);\n\t\t}\n\t};\n}\n//#endregion\nexport { buildCodecDescriptorRegistry, codecRefForStorageColumn };\n\n//# sourceMappingURL=codec-descriptor-registry.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,SAAS,yBAAyB,SAAS,aAAa,WAAW,YAAY;CAC9E,MAAM,WAAW,oBAAoB,SAAS,WAAW,WAAW;CACpE,IAAI,aAAa,KAAK,GAAG,OAAO,KAAK;CACrC,MAAM,YAAY,SAAS,MAAM,QAAQ;CACzC,IAAI,CAAC,WAAW,OAAO,KAAK;CAC5B,IAAI,UAAU,YAAY,KAAK,GAAG;EACjC,MAAM,WAAW,QAAQ,QAAQ,UAAU;EAC3C,IAAI,CAAC,UAAU,OAAO,KAAK;EAC3B,IAAI,sBAAsB,QAAQ,GAAG;GACpC,MAAM,iBAAiB,SAAS;GAChC,OAAO,mBAAmB,KAAK,KAAK,OAAO,KAAK,cAAc,CAAC,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C;EACxD;CACD;AACD"}
@@ -0,0 +1,116 @@
1
+ import { Codec, CodecCallContext, CodecCallContext as CodecCallContext$1, CodecDescriptor, CodecDescriptor as CodecDescriptor$1, CodecInstanceContext, CodecRef, CodecRef as CodecRef$1, CodecTrait, CodecTrait as CodecTrait$1 } from "@prisma/orm-framework/components/codec";
2
+ //#region ../../../2-sql/4-lanes/relational-core/dist/codec-types-MOaceoPi.d.mts
3
+ //#region src/ast/codec-types.d.ts
4
+ declare function frozenCodecRef(codec: CodecRef): CodecRef;
5
+ /**
6
+ * SQL-family addressing of a single column. The decode site populates a `SqlColumnRef` whenever it can resolve the cell to a single underlying `(table, column)` (the typical case for projected columns from a single-table source); cells the runtime cannot resolve (aggregate aliases, include aggregate fields, computed projections without a simple ref) get `column = undefined`.
7
+ *
8
+ * The shape is a structural projection of the runtime's `ColumnRef` so the SQL decode site can reuse the resolution it already performs for `RUNTIME.DECODE_FAILED` envelope construction without allocating twice per cell.
9
+ */
10
+ interface SqlColumnRef {
11
+ readonly table: string;
12
+ readonly name: string;
13
+ }
14
+ /**
15
+ * SQL-family per-call context. Extends the framework {@link CodecCallContext} (which carries `signal` only) with `column?: SqlColumnRef`, populated on **decode** call sites that can resolve a single underlying column ref. Encode call sites currently leave `column` undefined (encode-time column context is the middleware's domain).
16
+ *
17
+ * SQL codec authors writing codec methods observe this type via {@link SqlCodec}. The framework codec dispatch surface (and Mongo) sees only the base `CodecCallContext`.
18
+ */
19
+ interface SqlCodecCallContext extends CodecCallContext {
20
+ readonly column?: SqlColumnRef;
21
+ }
22
+ /**
23
+ * SQL-family per-instance context. Extends the framework {@link CodecInstanceContext} (`name` only) with `usedAt`, the set of `(table, column)` pairs the resolved codec serves.
24
+ *
25
+ * - For `typeRef` columns sharing one named `storage.types` instance, the array lists every referencing column — a column-scoped stateful codec (e.g. encryption) can derive aggregated per-instance state across all the columns sharing the named instance.
26
+ * - For inline-`typeParams` columns, the array has exactly one entry — the column that owns the inline params.
27
+ * - For shared non-parameterized codecs, the array carries one representative entry (the column that triggered materialization); the codec is shared across every column with that codec id, so the `usedAt` is informational only.
28
+ *
29
+ * SQL extensions consuming `usedAt` (e.g. column-scoped state derivation) type their factory parameter as `SqlCodecInstanceContext`. Extensions that don't read `usedAt` type their factory parameter as the family-agnostic {@link CodecInstanceContext} — a `SqlCodecInstanceContext` is structurally assignable to the base.
30
+ */
31
+ interface SqlCodecInstanceContext extends CodecInstanceContext {
32
+ readonly usedAt: ReadonlyArray<{
33
+ readonly table: string;
34
+ readonly column: string;
35
+ }>;
36
+ }
37
+ /**
38
+ * SQL codec — extends the framework codec base by narrowing the per-call context to the SQL-family {@link SqlCodecCallContext} (adds `column?: SqlColumnRef`). TypeScript treats method-syntax declarations bivariantly, so the SQL narrowing is structurally compatible with the framework {@link BaseCodec} super-interface.
39
+ *
40
+ * Codec-id-keyed static metadata (`traits`, `targetTypes`, `paramsSchema`, `renderOutputType`) lives on the unified {@link import('@prisma/orm-framework/components/codec').CodecDescriptor} — the codec instance itself only carries `id` plus the four conversion methods.
41
+ *
42
+ * See `Codec` in `@internal/framework-components/codec` for the codec contract that this interface extends.
43
+ */
44
+ interface Codec$1<Id extends string = string, TTraits extends readonly CodecTrait[] = readonly CodecTrait[], TWire = unknown, TInput = unknown> extends Codec<Id, TTraits, TWire, TInput> {
45
+ encode(value: TInput, ctx: SqlCodecCallContext): Promise<TWire>;
46
+ decode(wire: TWire, ctx: SqlCodecCallContext): Promise<TInput>;
47
+ }
48
+ /**
49
+ * Contract-bound codec registry.
50
+ *
51
+ * Built once at `ExecutionContext` construction time by walking the contract's `storage.tables[].columns[]` and resolving each column through its descriptor's factory. Runtime encode/decode dispatch resolves codecs via `forCodecRef(ref)` — the single dispatch shape for AST-bound codec resolution.
52
+ *
53
+ * `forColumn(namespace, table, column)` is retained for build-time helpers that need column-keyed lookup (e.g. projection stamping); runtime dispatch routes through `forCodecRef`.
54
+ */
55
+ interface ContractCodecRegistry {
56
+ /**
57
+ * Resolve the codec for `(namespace, table, column)`. Returns the per-instance parameterized codec for parameterized columns, the shared codec for non-parameterized columns, or `undefined` if the column is unknown or the codec isn't registered.
58
+ *
59
+ * The `namespaceId` coordinate leads and is always supplied — the column is resolved strictly within that namespace, so two same-bare-named tables across namespaces resolve to their own per-namespace codecs.
60
+ */
61
+ forColumn(namespaceId: string, table: string, column: string): Codec$1 | undefined;
62
+ /**
63
+ * Resolve a codec by {@link CodecRef}. The single dispatch shape for AST-bound codec resolution — every codec-bearing AST node carries a `CodecRef` that resolves through this method via the per-`ExecutionContext` `AstCodecResolver`. Two refs with the same `codecId` and structurally equal `typeParams` (regardless of object key order) return the same memoised codec instance. Throws `RUNTIME.CODEC_DESCRIPTOR_MISSING` for unknown `codecId`s and `RUNTIME.TYPE_PARAMS_INVALID` on `paramsSchema` rejection.
64
+ *
65
+ * Pre-populated from the contract walk at registry construction time (so contract-declared codecs hit on first call); grows lazily for AST-supplied refs not seen at contract-load time (deserialised migration ops, refs-less raw SQL with an explicit codec).
66
+ */
67
+ forCodecRef(ref: CodecRef): Codec$1;
68
+ }
69
+ /**
70
+ * Variance-erased descriptor type used for heterogeneous storage in collection containers and on the unified contributor `codecs:` slot. The descriptor's `factory` and `renderOutputType` are contravariant in `P`, so descriptors with different params shapes are not in a subtype relationship; collecting them into one container needs an explicit variance erasure rather than `CodecDescriptor<unknown>` (which is the
71
+ * narrowest, not the widest, of the family).
72
+ */
73
+ type AnyCodecDescriptor$1 = CodecDescriptor<any>;
74
+ type DescriptorResolvedCodec<D> = D extends CodecDescriptor<infer _P> ? ReturnType<ReturnType<D['factory']>> : never;
75
+ type DescriptorCodecId<D> = D extends AnyCodecDescriptor$1 ? D['codecId'] : never;
76
+ type DescriptorCodecInput<D> = DescriptorResolvedCodec<D> extends Codec<string, readonly CodecTrait[], unknown, infer In> ? In : never;
77
+ /**
78
+ * Resolve the JSON type for a descriptor `D` — what the codec's `encodeJson`
79
+ * produces, and therefore what a `contract.json` holds for a value of this
80
+ * codec.
81
+ *
82
+ * This is a distinct channel from {@link DescriptorCodecInput} because the two
83
+ * diverge wherever a codec's canonical JSON is not the value it hands the
84
+ * application — a wide integer carried as a decimal string, say. Reading the
85
+ * application type where the JSON type is meant produces a contract type that
86
+ * describes a value the file cannot contain.
87
+ *
88
+ * The type is read off the codec's declared `encodeJson` return, so a codec that
89
+ * narrows that return (`encodeJson(value: bigint): string`) publishes its JSON
90
+ * type without a new type parameter, and one that does not stays at the
91
+ * `JsonValue` the base signature promises.
92
+ */
93
+ type DescriptorCodecJson<D> = DescriptorResolvedCodec<D> extends Codec<string, readonly CodecTrait[], unknown, unknown> ? ReturnType<DescriptorResolvedCodec<D>['encodeJson']> : never;
94
+ /**
95
+ * Resolve the trait union for a descriptor `D`.
96
+ *
97
+ * Reads `traits` directly off the descriptor — concrete descriptor classes declare `override readonly traits = [...] as const`, which preserves the literal trait tuple at the descriptor type. Reading from the resolved codec instance (`CodecImpl<…, TTraits, …>`) would lose the literal because `Codec` carries `TTraits` only on its optional phantom slot (`readonly __codecTraits?: TTraits`); codecs extending `CodecImpl`
98
+ * have no required structural site that pins `TTraits`, so a descriptor-keyed extractor reading from the codec instance would widen to the broad `CodecTrait` union.
99
+ */
100
+ type DescriptorCodecTraits<D> = D extends {
101
+ readonly traits: infer TTraits extends readonly CodecTrait[];
102
+ } ? TTraits[number] & CodecTrait : never;
103
+ /**
104
+ * Project a record of {@link AnyCodecDescriptor}s keyed by scalar name onto the codec-id-keyed `CodecTypes` shape consumed by emit and no-emit type pipelines (`{ readonly [codecId]: { input; output; traits } }`).
105
+ *
106
+ * Canonical extractor for the descriptor-keyed type pipeline; the legacy instance-keyed extractor and its `mkCodec`-bound builder retired alongside the carrier deletion.
107
+ */
108
+ type ExtractCodecTypes<ScalarNames extends { readonly [K in keyof ScalarNames]: AnyCodecDescriptor$1; } = Record<never, never>> = { readonly [K in keyof ScalarNames as DescriptorCodecId<ScalarNames[K]>]: {
109
+ readonly input: DescriptorCodecInput<ScalarNames[K]>;
110
+ readonly output: DescriptorCodecInput<ScalarNames[K]>;
111
+ readonly json: DescriptorCodecJson<ScalarNames[K]>;
112
+ readonly traits: DescriptorCodecTraits<ScalarNames[K]>;
113
+ }; };
114
+ //#endregion
115
+ export { CodecRef$1 as a, DescriptorCodecId as c, DescriptorCodecTraits as d, ExtractCodecTypes as f, frozenCodecRef as g, SqlColumnRef as h, CodecDescriptor$1 as i, DescriptorCodecInput as l, SqlCodecInstanceContext as m, Codec$1 as n, CodecTrait$1 as o, SqlCodecCallContext as p, CodecCallContext$1 as r, ContractCodecRegistry as s, AnyCodecDescriptor$1 as t, DescriptorCodecJson as u };
116
+ //# sourceMappingURL=codec-types-MOaceoPi-C5eL2sao.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec-types-MOaceoPi-C5eL2sao.d.mts","names":[],"sources":["../../../../2-sql/4-lanes/relational-core/dist/codec-types-MOaceoPi.d.mts"],"mappings":";;;iBAEiB,eAAe,OAAO,WAAW;;;;;;UAMxC;WACC;WACA;;;;;;;UAOD,4BAA4B;WAC3B,SAAS;;;;;;;;;;;UAWV,gCAAgC;WAC/B,QAAQ;aACN;aACA;;;;;;;;;;UAUH,QAAQ,4BAA4B,yBAAyB,wBAAwB,cAAc,iBAAiB,0BAA0B,MAAM,IAAI,SAAS,OAAO;EAChL,OAAO,OAAO,QAAQ,KAAK,sBAAsB,QAAQ;EACzD,OAAO,MAAM,OAAO,KAAK,sBAAsB,QAAQ;;;;;;;;;UAS/C;;;;;;EAMR,UAAU,qBAAqB,eAAe,iBAAiB;;;;;;EAM/D,YAAY,KAAK,WAAW;;;;;;KAMzB,uBAAqB;KACrB,wBAAwB,KAAK,UAAU,sBAAsB,MAAM,WAAW,WAAW;KACzF,kBAAkB,KAAK,UAAU,uBAAqB;KACtD,qBAAqB,KAAK,wBAAwB,WAAW,uBAAuB,6BAA6B,MAAM;;;;;;;;;;;;;;;;;KAiBvH,oBAAoB,KAAK,wBAAwB,WAAW,uBAAuB,kCAAkC,WAAW,wBAAwB;;;;;;;KAOxJ,sBAAsB,KAAK;WACrB,cAAc,yBAAyB;IAC9C,kBAAkB;;;;;;KAMjB,kBAAkB,gCAAgC,WAAW,cAAc,0BAAwB,oCAAoC,WAAW,eAAe,kBAAkB,YAAY;WACzL,OAAO,qBAAqB,YAAY;WACxC,QAAQ,qBAAqB,YAAY;WACzC,MAAM,oBAAoB,YAAY;WACtC,QAAQ,sBAAsB,YAAY"}
@@ -0,0 +1,21 @@
1
+ import { i as SqlNamespaceBase, s as SqlNamespaceInput } from "./sql-storage-B0QwiTg6-B8DVctJm.mjs";
2
+ import "./types-BchwQpmO.mjs";
3
+ import { Contract, ControlPolicy } from "@prisma/orm-framework/contract/types";
4
+ import { TargetPackRef } from "@prisma/orm-framework/components/components";
5
+ import { ContractConfig, ContractConfig as ContractConfig$1 } from "@prisma/orm-framework/config/config-types";
6
+ //#region ../../../2-sql/2-authoring/contract-ts/dist/config-types.d.mts
7
+ //#region src/config-types.d.ts
8
+ interface TypeScriptContractSpecifierOptions {
9
+ readonly defaultControlPolicy?: ControlPolicy;
10
+ }
11
+ declare function emptyContract(options: {
12
+ readonly output?: string;
13
+ readonly target: TargetPackRef<'sql', string>;
14
+ readonly createNamespace: (input: SqlNamespaceInput) => SqlNamespaceBase;
15
+ readonly defaultControlPolicy?: ControlPolicy;
16
+ }): ContractConfig;
17
+ declare function typescriptContract(contract: Contract, output?: string, options?: TypeScriptContractSpecifierOptions): ContractConfig;
18
+ declare function typescriptContractFromPath(contractPath: string, output?: string, options?: TypeScriptContractSpecifierOptions): ContractConfig;
19
+ //#endregion
20
+ export { typescriptContractFromPath as i, emptyContract as n, typescriptContract as r, ContractConfig$1 as t };
21
+ //# sourceMappingURL=config-types-47qB33rW.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-types-47qB33rW.d.mts","names":[],"sources":["../../../../2-sql/2-authoring/contract-ts/dist/config-types.d.mts"],"mappings":";;;;;;;UAKU;WACC,uBAAuB;;iBAEjB,cAAc;WACpB;WACA,QAAQ;WACR,kBAAkB,OAAO,sBAAsB;WAC/C,uBAAuB;IAC9B;iBACa,mBAAmB,UAAU,UAAU,iBAAiB,UAAU,qCAAqC;iBACvG,2BAA2B,sBAAsB,iBAAiB,UAAU,qCAAqC"}
@@ -0,0 +1,65 @@
1
+ import { n as contractError, t as buildSqlContractFromDefinition } from "./build-contract-DBCz_YSs-DO0wMHai.mjs";
2
+ import { InternalError } from "@prisma/orm-framework/utils/internal-error";
3
+ import { ifDefined } from "@prisma/orm-framework/utils/defined";
4
+ import { ok } from "@prisma/orm-framework/utils/result";
5
+ import { applySpecifierDefaultControlPolicy } from "@prisma/orm-framework/contract/apply-specifier-default-control-policy";
6
+ import { extname } from "pathe";
7
+ import { pathToFileURL } from "node:url";
8
+ //#region ../../../2-sql/2-authoring/contract-ts/dist/config-types.mjs
9
+ /**
10
+ * Derives the emit output path from the TS contract input so artefacts land
11
+ * colocated with the source (e.g. `prisma/contract.ts` →
12
+ * `prisma/contract.json`). Mirrors the same default-derivation logic in
13
+ * `@internal/sql-contract-psl/provider`.
14
+ */
15
+ function defaultOutputFromContractPath(contractPath) {
16
+ const ext = extname(contractPath);
17
+ if (ext.length === 0) return `${contractPath}.json`;
18
+ return `${contractPath.slice(0, -ext.length)}.json`;
19
+ }
20
+ function emptyContract(options) {
21
+ return {
22
+ source: {
23
+ format: "typescript",
24
+ load: async () => {
25
+ return ok(applySpecifierDefaultControlPolicy(buildSqlContractFromDefinition({
26
+ warnings: void 0,
27
+ target: options.target,
28
+ createNamespace: options.createNamespace,
29
+ models: []
30
+ }), options.defaultControlPolicy));
31
+ }
32
+ },
33
+ ...ifDefined("output", options.output)
34
+ };
35
+ }
36
+ function typescriptContract(contract, output, options) {
37
+ return {
38
+ source: {
39
+ format: "typescript",
40
+ load: async () => ok(applySpecifierDefaultControlPolicy(contract, options?.defaultControlPolicy))
41
+ },
42
+ ...ifDefined("output", output)
43
+ };
44
+ }
45
+ function typescriptContractFromPath(contractPath, output, options) {
46
+ return {
47
+ source: {
48
+ format: "typescript",
49
+ inputs: [contractPath],
50
+ load: async (context) => {
51
+ const [absolutePath] = context.resolvedInputs;
52
+ if (absolutePath === void 0) throw new InternalError("typescriptContractFromPath: context.resolvedInputs is empty. The CLI config loader should populate it positional-matched with source.inputs.");
53
+ const mod = await import(pathToFileURL(absolutePath).href);
54
+ const contract = mod.default ?? mod.contract;
55
+ if (contract === void 0) throw contractError("CONTRACT.MODULE_EXPORT_MISSING", `typescriptContractFromPath: module at "${absolutePath}" has no "default" or "contract" export.`, { meta: { path: absolutePath } });
56
+ return ok(applySpecifierDefaultControlPolicy(contract, options?.defaultControlPolicy));
57
+ }
58
+ },
59
+ output: output ?? defaultOutputFromContractPath(contractPath)
60
+ };
61
+ }
62
+ //#endregion
63
+ export { typescriptContract as n, typescriptContractFromPath as r, emptyContract as t };
64
+
65
+ //# sourceMappingURL=config-types-N7PJc6VN.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-types-N7PJc6VN.mjs","names":[],"sources":["../../../../2-sql/2-authoring/contract-ts/dist/config-types.mjs"],"sourcesContent":["import { n as contractError, t as buildSqlContractFromDefinition } from \"./build-contract-DBCz_YSs.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { pathToFileURL } from \"node:url\";\nimport { applySpecifierDefaultControlPolicy } from \"@internal/contract/apply-specifier-default-control-policy\";\nimport { ok } from \"@internal/utils/result\";\nimport { extname } from \"pathe\";\n//#region src/config-types.ts\n/**\n* Derives the emit output path from the TS contract input so artefacts land\n* colocated with the source (e.g. `prisma/contract.ts` →\n* `prisma/contract.json`). Mirrors the same default-derivation logic in\n* `@internal/sql-contract-psl/provider`.\n*/\nfunction defaultOutputFromContractPath(contractPath) {\n\tconst ext = extname(contractPath);\n\tif (ext.length === 0) return `${contractPath}.json`;\n\treturn `${contractPath.slice(0, -ext.length)}.json`;\n}\nfunction emptyContract(options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"typescript\",\n\t\t\tload: async () => {\n\t\t\t\treturn ok(applySpecifierDefaultControlPolicy(buildSqlContractFromDefinition({\n\t\t\t\t\twarnings: void 0,\n\t\t\t\t\ttarget: options.target,\n\t\t\t\t\tcreateNamespace: options.createNamespace,\n\t\t\t\t\tmodels: []\n\t\t\t\t}), options.defaultControlPolicy));\n\t\t\t}\n\t\t},\n\t\t...ifDefined(\"output\", options.output)\n\t};\n}\nfunction typescriptContract(contract, output, options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"typescript\",\n\t\t\tload: async () => ok(applySpecifierDefaultControlPolicy(contract, options?.defaultControlPolicy))\n\t\t},\n\t\t...ifDefined(\"output\", output)\n\t};\n}\nfunction typescriptContractFromPath(contractPath, output, options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"typescript\",\n\t\t\tinputs: [contractPath],\n\t\t\tload: async (context) => {\n\t\t\t\tconst [absolutePath] = context.resolvedInputs;\n\t\t\t\tif (absolutePath === void 0) throw new InternalError(\"typescriptContractFromPath: context.resolvedInputs is empty. The CLI config loader should populate it positional-matched with source.inputs.\");\n\t\t\t\tconst mod = await import(pathToFileURL(absolutePath).href);\n\t\t\t\tconst contract = mod.default ?? mod.contract;\n\t\t\t\tif (contract === void 0) throw contractError(\"CONTRACT.MODULE_EXPORT_MISSING\", `typescriptContractFromPath: module at \"${absolutePath}\" has no \"default\" or \"contract\" export.`, { meta: { path: absolutePath } });\n\t\t\t\treturn ok(applySpecifierDefaultControlPolicy(contract, options?.defaultControlPolicy));\n\t\t\t}\n\t\t},\n\t\toutput: output ?? defaultOutputFromContractPath(contractPath)\n\t};\n}\n//#endregion\nexport { emptyContract, typescriptContract, typescriptContractFromPath };\n\n//# sourceMappingURL=config-types.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,8BAA8B,cAAc;CACpD,MAAM,MAAM,QAAQ,YAAY;CAChC,IAAI,IAAI,WAAW,GAAG,OAAO,GAAG,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