@prisma/orm-framework 8.0.0-rc.2-dev.2 → 8.0.0-rc.20

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 (354) hide show
  1. package/README.md +1 -5
  2. package/dist/{apply-specifier-default-control-policy-CAxiXxKg.d.mts → apply-specifier-default-control-policy-Dlz0iwnK.d.mts} +2 -2
  3. package/dist/apply-specifier-default-control-policy-Dlz0iwnK.d.mts.map +1 -0
  4. package/dist/{assertions-Cz-GWH8P.mjs → assertions-Dw1lZz_Q.mjs} +2 -2
  5. package/dist/{assertions-Cz-GWH8P.mjs.map → assertions-Dw1lZz_Q.mjs.map} +1 -1
  6. package/dist/authoring-CNUti739.mjs +764 -0
  7. package/dist/authoring-CNUti739.mjs.map +1 -0
  8. package/dist/authoring-CjwinhU5.d.mts +206 -0
  9. package/dist/authoring-CjwinhU5.d.mts.map +1 -0
  10. package/dist/binder-D_4RBHbt-BJ6VKwEZ.d.mts +515 -0
  11. package/dist/binder-D_4RBHbt-BJ6VKwEZ.d.mts.map +1 -0
  12. package/dist/{canonicalization-DFpB09nP-4OdB2nsy.d.mts → canonicalization-CyrrXGmj-CeKUkht1.d.mts} +3 -3
  13. package/dist/{canonicalization-DFpB09nP-4OdB2nsy.d.mts.map → canonicalization-CyrrXGmj-CeKUkht1.d.mts.map} +1 -1
  14. package/dist/{hashing-utils-DQgS3nOe.mjs → canonicalization-path-match-D88xLEq6-BFQC39ZG.mjs} +23 -3
  15. package/dist/canonicalization-path-match-D88xLEq6-BFQC39ZG.mjs.map +1 -0
  16. package/dist/{utils-DMAM0unR.mjs → canonicalize-json-ZPawceQR-Dua1VNEB.mjs} +2 -2
  17. package/dist/canonicalize-json-ZPawceQR-Dua1VNEB.mjs.map +1 -0
  18. package/dist/codec-B4ypaota.d.mts +289 -0
  19. package/dist/codec-B4ypaota.d.mts.map +1 -0
  20. package/dist/codec-Do8tfXqk.mjs +457 -0
  21. package/dist/codec-Do8tfXqk.mjs.map +1 -0
  22. package/dist/codec-descriptor-D0oY-hgs-C5e11ola.mjs +93 -0
  23. package/dist/codec-descriptor-D0oY-hgs-C5e11ola.mjs.map +1 -0
  24. package/dist/codec-types-BXLUbk-Y-DpGfKGK0.mjs +22 -0
  25. package/dist/codec-types-BXLUbk-Y-DpGfKGK0.mjs.map +1 -0
  26. package/dist/codec-types-CPgEZoIq-BL9hisr8.d.mts +384 -0
  27. package/dist/codec-types-CPgEZoIq-BL9hisr8.d.mts.map +1 -0
  28. package/dist/{components-dZRz3T5y.mjs → components-BaV9iCkq.mjs} +34 -3
  29. package/dist/components-BaV9iCkq.mjs.map +1 -0
  30. package/dist/components-CRBcIta_.d.mts +86 -0
  31. package/dist/components-CRBcIta_.d.mts.map +1 -0
  32. package/dist/components.d.mts +19 -17
  33. package/dist/components.mjs +16 -12
  34. package/dist/components__authoring.d.mts +4 -3
  35. package/dist/components__authoring.mjs +3 -2
  36. package/dist/components__codec.d.mts +3 -3
  37. package/dist/components__codec.mjs +6 -4
  38. package/dist/components__components.d.mts +6 -4
  39. package/dist/components__components.mjs +4 -3
  40. package/dist/components__control.d.mts +5 -4
  41. package/dist/components__control.mjs +3 -2
  42. package/dist/components__emission.d.mts +4 -4
  43. package/dist/components__execution.d.mts +1 -1
  44. package/dist/components__ir.d.mts +1 -1
  45. package/dist/components__ir.mjs +2 -1
  46. package/dist/components__psl-ast.d.mts +4 -4
  47. package/dist/components__psl-ast.mjs +2 -2
  48. package/dist/components__runtime.d.mts +3 -2
  49. package/dist/components__runtime.mjs +2 -2
  50. package/dist/components__utils.mjs +1 -1
  51. package/dist/{config-types-CW4PDwMC.d.mts → config-types-BTFT7QfJ.d.mts} +73 -41
  52. package/dist/config-types-BTFT7QfJ.d.mts.map +1 -0
  53. package/dist/config-types-D0mYyP62.mjs +61 -0
  54. package/dist/config-types-D0mYyP62.mjs.map +1 -0
  55. package/dist/config.d.mts +2 -3
  56. package/dist/config.mjs +2 -3
  57. package/dist/config__config-types.d.mts +2 -2
  58. package/dist/config__config-types.mjs +2 -2
  59. package/dist/contract-authoring.d.mts +152 -17
  60. package/dist/contract-authoring.d.mts.map +1 -1
  61. package/dist/contract-authoring.mjs +190 -9
  62. package/dist/contract-authoring.mjs.map +1 -1
  63. package/dist/{contract-types-CkdMH7F7-9EHXSwbH.d.mts → contract-types-DEIEpzU_-DvAVuBr5.d.mts} +14 -8
  64. package/dist/contract-types-DEIEpzU_-DvAVuBr5.d.mts.map +1 -0
  65. package/dist/{contract-validation-error-DEiWp_EI-CRwtUgRw.mjs → contract-validation-error-CAnTGhkt-DSnujRaK.mjs} +6 -3
  66. package/dist/contract-validation-error-CAnTGhkt-DSnujRaK.mjs.map +1 -0
  67. package/dist/{contract-validation-error-R7cMoK04.d.mts → contract-validation-error-D1QAeOh5.d.mts} +4 -2
  68. package/dist/contract-validation-error-D1QAeOh5.d.mts.map +1 -0
  69. package/dist/contract.d.mts +13 -12
  70. package/dist/contract.mjs +9 -9
  71. package/dist/contract__apply-specifier-default-control-policy.d.mts +1 -1
  72. package/dist/contract__contract-validation-error.d.mts +1 -1
  73. package/dist/contract__contract-validation-error.mjs +1 -1
  74. package/dist/contract__default-namespace.mjs +1 -1
  75. package/dist/contract__enum-accessor.d.mts +2 -2
  76. package/dist/contract__enum-accessor.mjs +1 -1
  77. package/dist/contract__hashing-utils.d.mts +2 -2
  78. package/dist/contract__hashing-utils.mjs +2 -3
  79. package/dist/contract__hashing.d.mts +3 -3
  80. package/dist/contract__hashing.mjs +2 -2
  81. package/dist/contract__resolve-domain-model.d.mts +1 -1
  82. package/dist/contract__types.d.mts +5 -5
  83. package/dist/contract__types.mjs +3 -3
  84. package/dist/contract__validate-domain.d.mts +1 -1
  85. package/dist/contract__validate-domain.mjs +1 -1
  86. package/dist/contract__validate-once.d.mts +2 -0
  87. package/dist/contract__validate-once.mjs +2 -0
  88. package/dist/{control-ql9N9u4f-r3Vv41kZ.d.mts → control-B5ezUWD2-BIAYxeSk.d.mts} +34 -6
  89. package/dist/control-B5ezUWD2-BIAYxeSk.d.mts.map +1 -0
  90. package/dist/{control-DLEm6u5m.mjs → control-DMJqhnwU.mjs} +309 -36
  91. package/dist/control-DMJqhnwU.mjs.map +1 -0
  92. package/dist/control-DrDTlxCS.d.mts +1 -0
  93. package/dist/{control-BD96JZi8-NUhO5Kkw.mjs → control-KsXr4fYD-D2Ows0NI.mjs} +70 -24
  94. package/dist/control-KsXr4fYD-D2Ows0NI.mjs.map +1 -0
  95. package/dist/{control-BF8qzdnM.d.mts → control-s5ECUABR.d.mts} +635 -156
  96. package/dist/control-s5ECUABR.d.mts.map +1 -0
  97. package/dist/data-type-V6mcDhcG-DVQAPOQT.mjs +275 -0
  98. package/dist/data-type-V6mcDhcG-DVQAPOQT.mjs.map +1 -0
  99. package/dist/declarations-BgUAq1RG-Dz_-EI1Q.mjs +459 -0
  100. package/dist/declarations-BgUAq1RG-Dz_-EI1Q.mjs.map +1 -0
  101. package/dist/{default-namespace-D4vCwkXg-lzVN7gSc.mjs → default-namespace-D4vCwkXg-BEZbN38y.mjs} +2 -2
  102. package/dist/{default-namespace-D4vCwkXg-lzVN7gSc.mjs.map → default-namespace-D4vCwkXg-BEZbN38y.mjs.map} +1 -1
  103. package/dist/{dist-Dqbo77p7.mjs → dist-D1f6xr7F.mjs} +51 -24
  104. package/dist/dist-D1f6xr7F.mjs.map +1 -0
  105. package/dist/{domain-envelope-D6Wn9AmZ-BqZKTT9U.d.mts → domain-envelope-CN721GnP-4huRt7Wc.d.mts} +27 -13
  106. package/dist/domain-envelope-CN721GnP-4huRt7Wc.d.mts.map +1 -0
  107. package/dist/emission-BtJvV97M.d.mts +2 -0
  108. package/dist/{emission-types-DLXP34Ki-CFms3VrX.d.mts → emission-types-B-jKEbjI-D7BW8Gk1.d.mts} +17 -16
  109. package/dist/emission-types-B-jKEbjI-D7BW8Gk1.d.mts.map +1 -0
  110. package/dist/enum-accessor-2OZgavDX.d.mts +104 -0
  111. package/dist/enum-accessor-2OZgavDX.d.mts.map +1 -0
  112. package/dist/enum-accessor-B-A2wNok.mjs +122 -0
  113. package/dist/enum-accessor-B-A2wNok.mjs.map +1 -0
  114. package/dist/errors.d.mts +5 -4
  115. package/dist/errors.mjs +4 -4
  116. package/dist/errors__control.d.mts +3 -2
  117. package/dist/errors__control.mjs +2 -2
  118. package/dist/errors__execution.d.mts +2 -2
  119. package/dist/errors__execution.mjs +2 -2
  120. package/dist/errors__migration.d.mts +2 -2
  121. package/dist/errors__migration.mjs +2 -2
  122. package/dist/execution-CjX5CCTb.d.mts +76 -0
  123. package/dist/execution-CjX5CCTb.d.mts.map +1 -0
  124. package/dist/{execution-CSnQT8EX.d.mts → execution-lMPVFj5o.d.mts} +2 -2
  125. package/dist/{execution-CSnQT8EX.d.mts.map → execution-lMPVFj5o.d.mts.map} +1 -1
  126. package/dist/execution-vfY4d-SZ.mjs +138 -0
  127. package/dist/execution-vfY4d-SZ.mjs.map +1 -0
  128. package/dist/{declarations-DR6To8_k-BFwkCGeP.mjs → expressions-CMQzbnHk-BL2zN0Iv.mjs} +199 -350
  129. package/dist/expressions-CMQzbnHk-BL2zN0Iv.mjs.map +1 -0
  130. package/dist/framework-authoring-DDxddXZm-uZYdhoE0.d.mts +1096 -0
  131. package/dist/framework-authoring-DDxddXZm-uZYdhoE0.d.mts.map +1 -0
  132. package/dist/{framework-components-hZ2tO-KH-CdRXBOYd.d.mts → framework-components-DKoQnPdB-lax1COaf.d.mts} +28 -91
  133. package/dist/framework-components-DKoQnPdB-lax1COaf.d.mts.map +1 -0
  134. package/dist/generator-functions-CXbQfvYu-BIFU1Ryx.mjs +271 -0
  135. package/dist/generator-functions-CXbQfvYu-BIFU1Ryx.mjs.map +1 -0
  136. package/dist/{hash-content-DwEUh-Rx.d.mts → hash-content-Bde14N2-.d.mts} +2 -2
  137. package/dist/{hash-content-DwEUh-Rx.d.mts.map → hash-content-Bde14N2-.d.mts.map} +1 -1
  138. package/dist/{hash-content-Bugg_nZn.mjs → hash-content-Bdl-HSfq.mjs} +2 -2
  139. package/dist/hash-content-Bdl-HSfq.mjs.map +1 -0
  140. package/dist/{hashing-BtIZVNYX.mjs → hashing-CLRfNAxh.mjs} +28 -9
  141. package/dist/hashing-CLRfNAxh.mjs.map +1 -0
  142. package/dist/hashing-D-DHz0zl.d.mts +36 -0
  143. package/dist/hashing-D-DHz0zl.d.mts.map +1 -0
  144. package/dist/{hashing-utils-qKu59RSC.d.mts → hashing-utils-DiGHKd3b.d.mts} +4 -3
  145. package/dist/{hashing-utils-qKu59RSC.d.mts.map → hashing-utils-DiGHKd3b.d.mts.map} +1 -1
  146. package/dist/ids.d.mts +90 -13
  147. package/dist/ids.d.mts.map +1 -1
  148. package/dist/ids.mjs +45 -59
  149. package/dist/ids.mjs.map +1 -1
  150. package/dist/ids__runtime.d.mts +1 -1
  151. package/dist/ids__runtime.mjs +1 -1
  152. package/dist/{index-CDk9yEbw.d.mts → index-MU-ksXsh.d.mts} +23 -6
  153. package/dist/index-MU-ksXsh.d.mts.map +1 -0
  154. package/dist/{internal-error-kK8QvlDE.d.mts → internal-error-2fJ9fcZX.d.mts} +2 -2
  155. package/dist/{internal-error-kK8QvlDE.d.mts.map → internal-error-2fJ9fcZX.d.mts.map} +1 -1
  156. package/dist/{internal-error-BIc-ehme-ouBQPoEL.mjs → internal-error-ChGYPVpq-DhUD05u0.mjs} +3 -3
  157. package/dist/internal-error-ChGYPVpq-DhUD05u0.mjs.map +1 -0
  158. package/dist/{ir-BvE7L9FK.d.mts → ir-LV4tXsw3.d.mts} +6 -5
  159. package/dist/{ir-BvE7L9FK.d.mts.map → ir-LV4tXsw3.d.mts.map} +1 -1
  160. package/dist/{ir-ChmSSAhX.mjs → ir-uDGU9vaj.mjs} +7 -53
  161. package/dist/ir-uDGU9vaj.mjs.map +1 -0
  162. package/dist/{migration-BvrgDZXw.d.mts → migration-Dluwnqe9.d.mts} +20 -3
  163. package/dist/migration-Dluwnqe9.d.mts.map +1 -0
  164. package/dist/{migration-C57VKLUY.mjs → migration-uC-bSKA4.mjs} +30 -4
  165. package/dist/migration-uC-bSKA4.mjs.map +1 -0
  166. package/dist/namespace-VUH2dgnS-By5y75h9.mjs +53 -0
  167. package/dist/namespace-VUH2dgnS-By5y75h9.mjs.map +1 -0
  168. package/dist/operations.mjs +1 -1
  169. package/dist/{parse-GbZGfMUj-BFSrD2AN.mjs → parse-bZgfjovA-BNgYhylT.mjs} +311 -55
  170. package/dist/parse-bZgfjovA-BNgYhylT.mjs.map +1 -0
  171. package/dist/{parse-0ZJjj_2N-DhQpSVmQ.d.mts → parse-djL5wker-B610mXG4.d.mts} +181 -52
  172. package/dist/parse-djL5wker-B610mXG4.d.mts.map +1 -0
  173. package/dist/psl-ast-COcYtLlz.d.mts +2 -0
  174. package/dist/psl-ast-CyvE6CR-.mjs +116 -0
  175. package/dist/psl-ast-CyvE6CR-.mjs.map +1 -0
  176. package/dist/{psl-ast-CWJQF8LA-Vr5JNPdn.d.mts → psl-ast-rY25o3Ze-ClLY3CYt.d.mts} +10 -40
  177. package/dist/psl-ast-rY25o3Ze-ClLY3CYt.d.mts.map +1 -0
  178. package/dist/psl-parser.d.mts +415 -101
  179. package/dist/psl-parser.d.mts.map +1 -1
  180. package/dist/psl-parser.mjs +2451 -537
  181. package/dist/psl-parser.mjs.map +1 -1
  182. package/dist/psl-parser__format.d.mts +8 -2
  183. package/dist/psl-parser__format.d.mts.map +1 -1
  184. package/dist/psl-parser__format.mjs +65 -34
  185. package/dist/psl-parser__format.mjs.map +1 -1
  186. package/dist/psl-parser__interpret.d.mts +98 -10
  187. package/dist/psl-parser__interpret.d.mts.map +1 -1
  188. package/dist/psl-parser__interpret.mjs +393 -2
  189. package/dist/psl-parser__interpret.mjs.map +1 -1
  190. package/dist/psl-parser__syntax.d.mts +3 -3
  191. package/dist/psl-parser__syntax.mjs +4 -43
  192. package/dist/psl-parser__tokenizer.d.mts +1 -1
  193. package/dist/psl-parser__tokenizer.mjs +1 -1
  194. package/dist/psl-printer.d.mts +7 -17
  195. package/dist/psl-printer.d.mts.map +1 -1
  196. package/dist/psl-printer.mjs +35 -104
  197. package/dist/psl-printer.mjs.map +1 -1
  198. package/dist/resolve-codec-qqMjZrmn-Cok8elAo.mjs +74 -0
  199. package/dist/resolve-codec-qqMjZrmn-Cok8elAo.mjs.map +1 -0
  200. package/dist/{resolve-domain-model-BVSb5wS5-C6Yq0dsD.d.mts → resolve-domain-model-BNr1glea-BLuR-phK.d.mts} +3 -3
  201. package/dist/resolve-domain-model-BNr1glea-BLuR-phK.d.mts.map +1 -0
  202. package/dist/{result-CBZ8X9mU.mjs → result-8OXF26MN.mjs} +14 -3
  203. package/dist/{result-CBZ8X9mU.mjs.map → result-8OXF26MN.mjs.map} +1 -1
  204. package/dist/{result-Bpupv5vO.d.mts → result-BYCOANWy.d.mts} +4 -2
  205. package/dist/result-BYCOANWy.d.mts.map +1 -0
  206. package/dist/runtime-B-YYuWy2.d.mts +899 -0
  207. package/dist/runtime-B-YYuWy2.d.mts.map +1 -0
  208. package/dist/runtime-DSYSc98Y.mjs +1059 -0
  209. package/dist/runtime-DSYSc98Y.mjs.map +1 -0
  210. package/dist/runtime-error-CO4MA3Px-YW5SCUcH.d.mts +19 -0
  211. package/dist/runtime-error-CO4MA3Px-YW5SCUcH.d.mts.map +1 -0
  212. package/dist/{structured-error-CgiSMpdU.mjs → structured-error-BXbihKQ-.mjs} +3 -3
  213. package/dist/{structured-error-CgiSMpdU.mjs.map → structured-error-BXbihKQ-.mjs.map} +1 -1
  214. package/dist/{structured-error-BsNT4Hun.d.mts → structured-error-Cc7AIRsp.d.mts} +19 -5
  215. package/dist/structured-error-Cc7AIRsp.d.mts.map +1 -0
  216. package/dist/suppress-idle-connection-errors-CKrTbp5P.d.mts +18 -0
  217. package/dist/suppress-idle-connection-errors-CKrTbp5P.d.mts.map +1 -0
  218. package/dist/suppress-idle-connection-errors-DzApeUb3.mjs +22 -0
  219. package/dist/suppress-idle-connection-errors-DzApeUb3.mjs.map +1 -0
  220. package/dist/temporal-presets-5TK1pTYJ-DmhrnMP1.mjs +1276 -0
  221. package/dist/temporal-presets-5TK1pTYJ-DmhrnMP1.mjs.map +1 -0
  222. package/dist/temporal-presets-BuMqk7h8-DZSuu4Z_.d.mts +258 -0
  223. package/dist/temporal-presets-BuMqk7h8-DZSuu4Z_.d.mts.map +1 -0
  224. package/dist/text-C3TTEtgd.mjs +35 -0
  225. package/dist/text-C3TTEtgd.mjs.map +1 -0
  226. package/dist/text-C8_-rheN.d.mts +15 -0
  227. package/dist/text-C8_-rheN.d.mts.map +1 -0
  228. package/dist/{tokenizer-1hAHZzmp-QGPORvmA.mjs → tokenizer-C-GTKKjR-B1vOzJy0.mjs} +54 -10
  229. package/dist/tokenizer-C-GTKKjR-B1vOzJy0.mjs.map +1 -0
  230. package/dist/{tokenizer-DcYI0Xrq-C-nNE9mE.d.mts → tokenizer-i8RaVWVa-7fRwlCPP.d.mts} +9 -4
  231. package/dist/tokenizer-i8RaVWVa-7fRwlCPP.d.mts.map +1 -0
  232. package/dist/ts-render.d.mts +2 -2
  233. package/dist/ts-render.mjs +2 -2
  234. package/dist/type-constructor-calls-BLf-HsFy-D_jbIqj8.mjs +261 -0
  235. package/dist/type-constructor-calls-BLf-HsFy-D_jbIqj8.mjs.map +1 -0
  236. package/dist/{types-BnH4zYvN.mjs → types-B8ULzMAX.mjs} +36 -3
  237. package/dist/types-B8ULzMAX.mjs.map +1 -0
  238. package/dist/types-GNXJ7xW2.d.mts +131 -0
  239. package/dist/types-GNXJ7xW2.d.mts.map +1 -0
  240. package/dist/{types-import-spec-3mjbVBhI-DQI6BvKU.d.mts → types-import-spec-DQjfX-gM-zVncuzs0.d.mts} +6 -6
  241. package/dist/types-import-spec-DQjfX-gM-zVncuzs0.d.mts.map +1 -0
  242. package/dist/utils.d.mts +7 -5
  243. package/dist/utils.mjs +9 -7
  244. package/dist/utils__assertions.mjs +1 -1
  245. package/dist/utils__hash-content.d.mts +1 -1
  246. package/dist/utils__hash-content.mjs +1 -1
  247. package/dist/utils__internal-error.d.mts +1 -1
  248. package/dist/utils__internal-error.mjs +1 -1
  249. package/dist/utils__result.d.mts +2 -2
  250. package/dist/utils__result.mjs +2 -2
  251. package/dist/utils__structured-error.d.mts +2 -2
  252. package/dist/utils__structured-error.mjs +1 -1
  253. package/dist/utils__suppress-idle-connection-errors.d.mts +2 -0
  254. package/dist/utils__suppress-idle-connection-errors.mjs +2 -0
  255. package/dist/utils__text.d.mts +2 -0
  256. package/dist/utils__text.mjs +2 -0
  257. package/dist/{validate-domain-BNBs-TVv.d.mts → validate-domain-B5kmlBFB.d.mts} +10 -6
  258. package/dist/validate-domain-B5kmlBFB.d.mts.map +1 -0
  259. package/dist/{validate-domain-BkvFlY3B.mjs → validate-domain-CbXHDYpF.mjs} +43 -22
  260. package/dist/validate-domain-CbXHDYpF.mjs.map +1 -0
  261. package/dist/validate-once-D-IwXHYP.mjs +42 -0
  262. package/dist/validate-once-D-IwXHYP.mjs.map +1 -0
  263. package/dist/validate-once-gfCOHsDh.d.mts +16 -0
  264. package/dist/validate-once-gfCOHsDh.d.mts.map +1 -0
  265. package/package.json +24 -20
  266. package/dist/apply-specifier-default-control-policy-CAxiXxKg.d.mts.map +0 -1
  267. package/dist/authoring-B2H-9qCv.d.mts +0 -1
  268. package/dist/canonicalization-path-match-CNgHuwM_-CCPBeUuk.mjs +0 -25
  269. package/dist/canonicalization-path-match-CNgHuwM_-CCPBeUuk.mjs.map +0 -1
  270. package/dist/capabilities-BCEONw9w-C-lo3rF8.mjs +0 -120
  271. package/dist/capabilities-BCEONw9w-C-lo3rF8.mjs.map +0 -1
  272. package/dist/codec-Cd0QcxAx.mjs +0 -63
  273. package/dist/codec-Cd0QcxAx.mjs.map +0 -1
  274. package/dist/codec-Ce07W3Mz.d.mts +0 -112
  275. package/dist/codec-Ce07W3Mz.d.mts.map +0 -1
  276. package/dist/codec-types-D6VRj2RE-BLElXc-O.d.mts +0 -223
  277. package/dist/codec-types-D6VRj2RE-BLElXc-O.d.mts.map +0 -1
  278. package/dist/codec-types-DcNvNeY1-BO6kUiH0.mjs +0 -30
  279. package/dist/codec-types-DcNvNeY1-BO6kUiH0.mjs.map +0 -1
  280. package/dist/components-CGA_WwEG.d.mts +0 -50
  281. package/dist/components-CGA_WwEG.d.mts.map +0 -1
  282. package/dist/components-dZRz3T5y.mjs.map +0 -1
  283. package/dist/config-types-BqhNxw0z.mjs +0 -67
  284. package/dist/config-types-BqhNxw0z.mjs.map +0 -1
  285. package/dist/config-types-CW4PDwMC.d.mts.map +0 -1
  286. package/dist/config-validation-DPt5hwQx.mjs +0 -168
  287. package/dist/config-validation-DPt5hwQx.mjs.map +0 -1
  288. package/dist/config-validation-Wiqew2J9.d.mts +0 -21
  289. package/dist/config-validation-Wiqew2J9.d.mts.map +0 -1
  290. package/dist/config__config-validation.d.mts +0 -2
  291. package/dist/config__config-validation.mjs +0 -2
  292. package/dist/contract-types-CkdMH7F7-9EHXSwbH.d.mts.map +0 -1
  293. package/dist/contract-validation-error-DEiWp_EI-CRwtUgRw.mjs.map +0 -1
  294. package/dist/contract-validation-error-R7cMoK04.d.mts.map +0 -1
  295. package/dist/control-BD96JZi8-NUhO5Kkw.mjs.map +0 -1
  296. package/dist/control-BF8qzdnM.d.mts.map +0 -1
  297. package/dist/control-DLEm6u5m.mjs.map +0 -1
  298. package/dist/control-ql9N9u4f-r3Vv41kZ.d.mts.map +0 -1
  299. package/dist/declarations-DR6To8_k-BFwkCGeP.mjs.map +0 -1
  300. package/dist/dist-Dqbo77p7.mjs.map +0 -1
  301. package/dist/domain-envelope-D6Wn9AmZ-BqZKTT9U.d.mts.map +0 -1
  302. package/dist/emission-CmUO03gQ.d.mts +0 -2
  303. package/dist/emission-types-DLXP34Ki-CFms3VrX.d.mts.map +0 -1
  304. package/dist/enum-accessor-Db5DaTNX.mjs +0 -35
  305. package/dist/enum-accessor-Db5DaTNX.mjs.map +0 -1
  306. package/dist/enum-accessor-PH5vjghI.d.mts +0 -85
  307. package/dist/enum-accessor-PH5vjghI.d.mts.map +0 -1
  308. package/dist/execution-Crk6IfTs.mjs +0 -218
  309. package/dist/execution-Crk6IfTs.mjs.map +0 -1
  310. package/dist/execution-Cyl2dXxX.d.mts +0 -115
  311. package/dist/execution-Cyl2dXxX.d.mts.map +0 -1
  312. package/dist/framework-authoring-BhctBwih-DQ_6noDM.d.mts +0 -777
  313. package/dist/framework-authoring-BhctBwih-DQ_6noDM.d.mts.map +0 -1
  314. package/dist/framework-authoring-CDEvlouU-DKklu-fL.mjs +0 -698
  315. package/dist/framework-authoring-CDEvlouU-DKklu-fL.mjs.map +0 -1
  316. package/dist/framework-components-hZ2tO-KH-CdRXBOYd.d.mts.map +0 -1
  317. package/dist/hash-content-Bugg_nZn.mjs.map +0 -1
  318. package/dist/hashing-BtIZVNYX.mjs.map +0 -1
  319. package/dist/hashing-CccSPELN.d.mts +0 -25
  320. package/dist/hashing-CccSPELN.d.mts.map +0 -1
  321. package/dist/hashing-utils-DQgS3nOe.mjs.map +0 -1
  322. package/dist/index-CDk9yEbw.d.mts.map +0 -1
  323. package/dist/internal-error-BIc-ehme-ouBQPoEL.mjs.map +0 -1
  324. package/dist/ir-ChmSSAhX.mjs.map +0 -1
  325. package/dist/migration-BvrgDZXw.d.mts.map +0 -1
  326. package/dist/migration-C57VKLUY.mjs.map +0 -1
  327. package/dist/parse-0ZJjj_2N-DhQpSVmQ.d.mts.map +0 -1
  328. package/dist/parse-GbZGfMUj-BFSrD2AN.mjs.map +0 -1
  329. package/dist/psl-ast-BXZoFQBk.d.mts +0 -37
  330. package/dist/psl-ast-BXZoFQBk.d.mts.map +0 -1
  331. package/dist/psl-ast-CWJQF8LA-Vr5JNPdn.d.mts.map +0 -1
  332. package/dist/psl-ast-DUCvVXbB.mjs +0 -239
  333. package/dist/psl-ast-DUCvVXbB.mjs.map +0 -1
  334. package/dist/psl-parser__syntax.mjs.map +0 -1
  335. package/dist/resolve-codec-BZF8TZh_-D-xORT9Q.mjs +0 -59
  336. package/dist/resolve-codec-BZF8TZh_-D-xORT9Q.mjs.map +0 -1
  337. package/dist/resolve-domain-model-BVSb5wS5-C6Yq0dsD.d.mts.map +0 -1
  338. package/dist/result-Bpupv5vO.d.mts.map +0 -1
  339. package/dist/runtime-BqzioOmU.mjs +0 -670
  340. package/dist/runtime-BqzioOmU.mjs.map +0 -1
  341. package/dist/runtime-Cuxw8obj.d.mts +0 -1038
  342. package/dist/runtime-Cuxw8obj.d.mts.map +0 -1
  343. package/dist/structured-error-BsNT4Hun.d.mts.map +0 -1
  344. package/dist/symbol-table-CZ7EVCTL-CR-ncCpD.d.mts +0 -125
  345. package/dist/symbol-table-CZ7EVCTL-CR-ncCpD.d.mts.map +0 -1
  346. package/dist/tokenizer-1hAHZzmp-QGPORvmA.mjs.map +0 -1
  347. package/dist/tokenizer-DcYI0Xrq-C-nNE9mE.d.mts.map +0 -1
  348. package/dist/types-BnH4zYvN.mjs.map +0 -1
  349. package/dist/types-ByeQhU9p.d.mts +0 -17
  350. package/dist/types-ByeQhU9p.d.mts.map +0 -1
  351. package/dist/types-import-spec-3mjbVBhI-DQI6BvKU.d.mts.map +0 -1
  352. package/dist/utils-DMAM0unR.mjs.map +0 -1
  353. package/dist/validate-domain-BNBs-TVv.d.mts.map +0 -1
  354. package/dist/validate-domain-BkvFlY3B.mjs.map +0 -1
@@ -1,670 +0,0 @@
1
- import { t as blindCast } from "./casts-DpaahrlC-Bd5n2coI.mjs";
2
- import { n as runtimeError } from "./runtime-error-BA9d7XjZ-BlT8t6LB.mjs";
3
- //#region ../../../1-framework/1-core/framework-components/dist/runtime.mjs
4
- /**
5
- * Stable code emitted by the runtime when an in-flight `execute()`
6
- * is cancelled via the per-query `AbortSignal`. The envelope's
7
- * `details.phase` distinguishes where the abort was observed:
8
- *
9
- * - `'encode'` — abort fired during `encodeParams` (SQL) or
10
- * `resolveValue` (Mongo).
11
- * - `'decode'` — abort fired during `decodeRow` / `decodeField`.
12
- * - `'stream'` — abort fired between rows or before any codec call
13
- * (already-aborted at entry).
14
- * - `'beforeQuery'` / `'beforeExecute'` / `'afterQuery'` /
15
- * `'afterExecute'` / `'onRow'` — abort fired on entry to or during
16
- * the corresponding middleware phase
17
- * (cooperative cancellation per the param-transform seam).
18
- */
19
- const RUNTIME_ABORTED = "RUNTIME.ABORTED";
20
- /**
21
- * Construct a `RUNTIME.ABORTED` envelope. Phase distinguishes where the
22
- * abort was observed — codec call sites (`encode` / `decode` / `stream`)
23
- * or operation-specific middleware seams, as
24
- * enumerated on {@link RuntimeAbortedPhase}. Cause carries
25
- * `signal.reason` verbatim from the platform — native abort produces a
26
- * `DOMException`, explicit `controller.abort(reason)` produces whatever
27
- * the caller passed. No synthesis happens here.
28
- */
29
- function runtimeAborted(phase, cause) {
30
- const envelope = runtimeError(RUNTIME_ABORTED, `Operation aborted during ${phase}`, { phase });
31
- return Object.assign(envelope, { cause });
32
- }
33
- /**
34
- * Defines a typed annotation handle.
35
- *
36
- * Two-step call form. The first step takes the `Payload` type argument
37
- * (TypeScript cannot infer `Payload` from anything in the options, so it
38
- * must be supplied explicitly); the second step takes the runtime options
39
- * and infers `Kinds` from the `applicableTo` array via a `const` type
40
- * parameter, so the operation kinds appear exactly once at the call site.
41
- *
42
- * @example
43
- * ```typescript
44
- * // Read-only annotation. Lane terminals like `db.User.first(...)` accept
45
- * // it; `db.User.create(...)` rejects it at the type level.
46
- * const cacheAnnotation = defineAnnotation<{ ttl?: number; skip?: boolean }>()({
47
- * namespace: 'cache',
48
- * applicableTo: ['read'],
49
- * }); // Kinds inferred as 'read'
50
- *
51
- * // Write-only annotation. Mirror image.
52
- * const auditAnnotation = defineAnnotation<{ actor: string }>()({
53
- * namespace: 'audit',
54
- * applicableTo: ['write'],
55
- * }); // Kinds inferred as 'write'
56
- *
57
- * // Annotation applicable to both kinds (e.g. tracing).
58
- * const otelAnnotation = defineAnnotation<{ traceId: string }>()({
59
- * namespace: 'otel',
60
- * applicableTo: ['read', 'write'],
61
- * }); // Kinds inferred as 'read' | 'write'
62
- * ```
63
- *
64
- * **Reserved namespaces.** See `DefineAnnotationOptions.namespace` for the
65
- * list of framework-internal namespaces (`codecs`, target-specific keys).
66
- * `defineAnnotation` does not structurally prevent a user from naming a
67
- * reserved namespace, but the framework makes no compatibility guarantee
68
- * about handles that do.
69
- */
70
- function defineAnnotation() {
71
- return (options) => {
72
- const namespace = options.namespace;
73
- const applicableTo = Object.freeze(new Set(options.applicableTo));
74
- function handle(value) {
75
- return Object.freeze({
76
- __annotation: true,
77
- namespace,
78
- value,
79
- applicableTo
80
- });
81
- }
82
- function read(plan) {
83
- const stored = plan.meta.annotations?.[namespace];
84
- if (!isAnnotationValue(stored)) return;
85
- if (stored.namespace !== namespace) return;
86
- return stored.value;
87
- }
88
- return Object.freeze(Object.assign(handle, {
89
- namespace,
90
- applicableTo,
91
- read
92
- }));
93
- };
94
- }
95
- /**
96
- * Runtime applicability gate. Throws `RUNTIME.ANNOTATION_INAPPLICABLE` if
97
- * any annotation in `annotations` declares an `applicableTo` set that does
98
- * not include `kind`. Used by lane terminals (SQL DSL builders' `.build()`,
99
- * ORM `Collection` terminals) to fail closed when the type-level
100
- * `ValidAnnotations` gate is bypassed via cast / `any` / dynamic
101
- * invocation.
102
- *
103
- * Passes silently on:
104
- * - empty arrays
105
- * - annotations whose `applicableTo` includes `kind`
106
- *
107
- * Throws on:
108
- * - any annotation whose `applicableTo` does not include `kind`. The
109
- * error names the offending annotation's `namespace` and the
110
- * `terminalName` so users can locate the misuse.
111
- *
112
- * @example
113
- * ```typescript
114
- * // Inside an ORM read terminal:
115
- * assertAnnotationsApplicable(annotations, 'read', 'first');
116
- * ```
117
- */
118
- function assertAnnotationsApplicable(annotations, kind, terminalName) {
119
- for (const annotation of annotations) if (!annotation.applicableTo.has(kind)) throw runtimeError("RUNTIME.ANNOTATION_INAPPLICABLE", `Annotation '${annotation.namespace}' is not applicable to '${kind}' operations (terminal: '${terminalName}'). The annotation declares applicableTo = [${Array.from(annotation.applicableTo).map((k) => `'${k}'`).join(", ")}].`, {
120
- namespace: annotation.namespace,
121
- terminalName,
122
- kind,
123
- applicableTo: Array.from(annotation.applicableTo)
124
- });
125
- }
126
- /**
127
- * Type guard for branded annotation values stored in `plan.meta.annotations`.
128
- *
129
- * Internal — used by `AnnotationHandle.read` to distinguish user
130
- * annotations (created by calling a handle returned from
131
- * `defineAnnotation(...)`) from framework-internal metadata that may
132
- * happen to live under the same namespace key.
133
- */
134
- function isAnnotationValue(value) {
135
- if (value === null || typeof value !== "object") return false;
136
- return value.__annotation === true;
137
- }
138
- var AsyncIterableResult = class {
139
- generator;
140
- consumed = false;
141
- consumedBy;
142
- bufferedArrayPromise;
143
- constructor(generator) {
144
- this.generator = generator;
145
- }
146
- [Symbol.asyncIterator]() {
147
- if (this.consumed) throw runtimeError("RUNTIME.ITERATOR_CONSUMED", `AsyncIterableResult iterator has already been consumed via ${this.consumedBy === "bufferedArray" ? "toArray()/then()" : "for-await loop"}. Each AsyncIterableResult can only be iterated once.`, {
148
- consumedBy: this.consumedBy,
149
- suggestion: this.consumedBy === "bufferedArray" ? "If you need to iterate multiple times, store the results from toArray() in a variable and reuse that." : "If you need to iterate multiple times, use toArray() to collect all results first."
150
- });
151
- this.consumed = true;
152
- this.consumedBy = "iterator";
153
- return this.generator;
154
- }
155
- toArray() {
156
- if (this.consumedBy === "iterator") return Promise.reject(runtimeError("RUNTIME.ITERATOR_CONSUMED", "AsyncIterableResult iterator has already been consumed via for-await loop. Each AsyncIterableResult can only be iterated once.", {
157
- consumedBy: this.consumedBy,
158
- suggestion: "The iterator was already consumed by a for-await loop. Use toArray() or await the result before iterating."
159
- }));
160
- if (this.bufferedArrayPromise) return this.bufferedArrayPromise;
161
- this.consumed = true;
162
- this.consumedBy = "bufferedArray";
163
- this.bufferedArrayPromise = (async () => {
164
- const out = [];
165
- for await (const item of this.generator) out.push(item);
166
- return out;
167
- })();
168
- return this.bufferedArrayPromise;
169
- }
170
- async first() {
171
- return (await this.toArray())[0] ?? null;
172
- }
173
- async firstOrThrow() {
174
- const row = await this.first();
175
- if (row === null) throw runtimeError("RUNTIME.NO_ROWS", "Expected at least one row, but none were returned", {});
176
- return row;
177
- }
178
- then(onfulfilled, onrejected) {
179
- return this.toArray().then(onfulfilled, onrejected);
180
- }
181
- };
182
- /**
183
- * Throw a phase-tagged `RUNTIME.ABORTED` envelope if the supplied
184
- * context is already aborted at the precheck site. Centralises the
185
- * `if (ctx.signal?.aborted) throw runtimeAborted(...)` pattern that
186
- * every codec dispatch site (and the `beforeExecute` middleware phase)
187
- * repeats. Accepts both the framework `CodecCallContext` and the
188
- * `RuntimeMiddlewareContext`; both expose `signal?: AbortSignal`.
189
- */
190
- function checkAborted(ctx, phase) {
191
- if (ctx.signal?.aborted) throw runtimeAborted(phase, ctx.signal.reason);
192
- }
193
- /**
194
- * Race a per-cell `Promise.all` (or any other in-flight work promise) against
195
- * the supplied abort signal so the runtime returns `RUNTIME.ABORTED` promptly
196
- * even when codec bodies ignore the signal. In-flight bodies that ignore the
197
- * signal are abandoned and run to completion in the background — the
198
- * cooperative-cancellation contract documented in ADR 204.
199
- *
200
- * Call sites still SHOULD pre-check `signal.aborted` and short-circuit with
201
- * a phase-tagged `RUNTIME.ABORTED` envelope before invoking this helper —
202
- * that path is the canonical "aborted at entry" surface and avoids
203
- * scheduling the work promise. As a defensive belt-and-braces, this helper
204
- * also handles the already-aborted case internally: `AbortSignal` does not
205
- * replay past abort events to listeners registered after the abort, so we
206
- * inspect `signal.aborted` synchronously and reject with the sentinel
207
- * before installing the listener. The rejection is still attributed to the
208
- * abort path via the sentinel-identity check.
209
- *
210
- * Distinguishing the rejection source is load-bearing for AC-ERR4
211
- * (`RUNTIME.ENCODE_FAILED` / `RUNTIME.DECODE_FAILED` pass through unchanged).
212
- * The semantically equivalent `abortable(signal)` helper in
213
- * `@internal/utils` rejects with `signal.reason ?? new DOMException(...)`,
214
- * which is not stably distinguishable from a codec-thrown error by identity
215
- * alone (a fresh fallback DOMException is allocated per call). We instead
216
- * track abort attribution with a unique sentinel: only the `onAbort` listener
217
- * installed here ever rejects with the sentinel, so an `error === sentinel`
218
- * identity check after the race is unambiguous.
219
- *
220
- * Lives in `framework-components` (rather than the SQL family, where it
221
- * originated in m2) so every family runtime that needs cooperative
222
- * cancellation around a codec-dispatch `Promise.all` (SQL encode + decode
223
- * today, Mongo encode in m3) shares the same attribution logic.
224
- */
225
- async function raceAgainstAbort(work, signal, phase) {
226
- if (signal === void 0) return await work;
227
- const sentinel = { reason: void 0 };
228
- let onAbort;
229
- const abortPromise = new Promise((_, reject) => {
230
- if (signal.aborted) {
231
- sentinel.reason = signal.reason;
232
- reject(sentinel);
233
- return;
234
- }
235
- onAbort = () => {
236
- sentinel.reason = signal.reason;
237
- reject(sentinel);
238
- };
239
- signal.addEventListener("abort", onAbort, { once: true });
240
- });
241
- try {
242
- return await Promise.race([work, abortPromise]);
243
- } catch (error) {
244
- if (error === sentinel) throw runtimeAborted(phase, sentinel.reason);
245
- throw error;
246
- } finally {
247
- if (onAbort) signal.removeEventListener("abort", onAbort);
248
- }
249
- }
250
- /**
251
- * Runs every middleware's `beforeQuery` hook in registration order,
252
- * threading through the (optional) family-specific `paramsMutator`.
253
- *
254
- * Why this lives outside {@link runQueryWithMiddleware}: middleware that
255
- * mutates parameter values (e.g. cipherstash's bulk-encrypt SDK
256
- * round-trip) must run *before* the family runtime encodes those
257
- * parameters to driver wire format. Family runtimes call
258
- * `runBeforeQueryChain` between the AST → plan lowering step and
259
- * the parameter encode step; the encode then observes the mutator's
260
- * `currentParams()` view. `runQueryWithMiddleware` retains the rest of
261
- * the query lifecycle (`interceptQuery`, driver/row source loop, `onRow`,
262
- * `afterQuery`) but no longer fires `beforeQuery` itself.
263
- *
264
- * Lifecycle within this helper:
265
- *
266
- * 1. For each middleware in registration order, if `beforeQuery`
267
- * is implemented:
268
- * - `checkAborted(ctx, 'beforeQuery')` short-circuits if the
269
- * caller already aborted at entry.
270
- * - The hook is invoked with `(plan, ctx, paramsMutator)`. A
271
- * middleware body that ignores the mutator stays compatible —
272
- * JavaScript allows extra positional arguments.
273
- * - If the hook returns a Promise, it is raced against
274
- * `ctx.signal` via {@link raceAgainstAbort} so cooperative
275
- * cancellation surfaces a `RUNTIME.ABORTED { phase:
276
- * 'beforeQuery' }` envelope even when the body itself
277
- * ignores the signal.
278
- *
279
- * Error propagation: any error thrown by a `beforeQuery` body
280
- * (or surfaced by the abort race) propagates out of this helper
281
- * unchanged. Family runtime entry points await this helper before invoking
282
- * `runQueryWithMiddleware`, so a rejection prevents the runner and its
283
- * `afterQuery` hook from running.
284
- *
285
- * Relationship to {@link runQueryWithMiddleware}: the framework's
286
- * `RuntimeCore.query` template calls this helper between
287
- * `lower(plan)` and `runQueryWithMiddleware(...)`. Family runtimes that
288
- * override query preparation (e.g. SQL, which inlines lower + encode for
289
- * direct mutator threading) call this helper themselves at the
290
- * equivalent point — between the family's AST → draft-plan
291
- * lowering and the parameter-encode step.
292
- *
293
- * Intercept ordering: this helper fires unconditionally before
294
- * `runQueryWithMiddleware`. `interceptQuery` (inside
295
- * `runQueryWithMiddleware`) therefore observes the post-`beforeQuery`
296
- * plan — mutator mutations are visible in the params interceptors see.
297
- * The trade-off is documented on `RuntimeMiddleware.interceptQuery`.
298
- */
299
- function runBeforeQueryChain(plan, middleware, ctx, paramsMutator) {
300
- return runBeforeChain(plan, middleware, ctx, paramsMutator, "beforeQuery", (mw) => mw.beforeQuery);
301
- }
302
- /**
303
- * Runs every middleware's `beforeExecute` hook in registration order,
304
- * threading through the (optional) family-specific `paramsMutator`.
305
- *
306
- * Why this lives outside {@link runExecuteWithMiddleware}: middleware that
307
- * mutates parameter values (e.g. cipherstash's bulk-encrypt SDK
308
- * round-trip) must run *before* the family runtime encodes those
309
- * parameters to driver wire format. Family runtimes call
310
- * `runBeforeExecuteChain` between the AST → plan lowering step and
311
- * the parameter encode step; the encode then observes the mutator's
312
- * `currentParams()` view. `runExecuteWithMiddleware` retains the rest of
313
- * the execute lifecycle (`interceptExecute`, driver statistics execution,
314
- * `afterExecute`) but no longer fires `beforeExecute` itself.
315
- *
316
- * Lifecycle within this helper:
317
- *
318
- * 1. For each middleware in registration order, if `beforeExecute`
319
- * is implemented:
320
- * - `checkAborted(ctx, 'beforeExecute')` short-circuits if the
321
- * caller already aborted at entry.
322
- * - The hook is invoked with `(plan, ctx, paramsMutator)`. A
323
- * middleware body that ignores the mutator stays compatible —
324
- * JavaScript allows extra positional arguments.
325
- * - If the hook returns a Promise, it is raced against
326
- * `ctx.signal` via {@link raceAgainstAbort} so cooperative
327
- * cancellation surfaces a `RUNTIME.ABORTED { phase:
328
- * 'beforeExecute' }` envelope even when the body itself
329
- * ignores the signal.
330
- *
331
- * Error propagation: any error thrown by a `beforeExecute` body
332
- * (or surfaced by the abort race) propagates out of this helper
333
- * unchanged. Family runtime entry points await this helper before invoking
334
- * `runExecuteWithMiddleware`, so a rejection prevents the runner and its
335
- * `afterExecute` hook from running.
336
- *
337
- * Relationship to {@link runExecuteWithMiddleware}: the framework's
338
- * `RuntimeCore.execute` template calls this helper between
339
- * `lower(plan)` and `runExecuteWithMiddleware(...)`. Family runtimes that
340
- * override execute (e.g. SQL, which inlines lower + encode for
341
- * direct mutator threading) call this helper themselves at the
342
- * equivalent point — between the family's AST → draft-plan
343
- * lowering and the parameter-encode step.
344
- *
345
- * Intercept ordering: this helper fires unconditionally before
346
- * `runExecuteWithMiddleware`. `interceptExecute` (inside
347
- * `runExecuteWithMiddleware`) therefore observes the post-`beforeExecute`
348
- * plan — mutator mutations are visible in the params interceptors see.
349
- * The trade-off is documented on `RuntimeMiddleware.interceptExecute`.
350
- */
351
- function runBeforeExecuteChain(plan, middleware, ctx, paramsMutator) {
352
- return runBeforeChain(plan, middleware, ctx, paramsMutator, "beforeExecute", (mw) => mw.beforeExecute);
353
- }
354
- async function runBeforeChain(plan, middleware, ctx, paramsMutator, phase, selectHook) {
355
- for (const mw of middleware) {
356
- const hook = selectHook(mw);
357
- if (hook === void 0) continue;
358
- checkAborted(ctx, phase);
359
- const work = hook(plan, ctx, paramsMutator);
360
- if (work !== void 0) await raceAgainstAbort(Promise.resolve(work), ctx.signal, phase);
361
- }
362
- }
363
- /**
364
- * Drives a single query execution of `runDriver()` through the middleware
365
- * lifecycle's `interceptQuery` + row-source + termination phases.
366
- *
367
- * Lifecycle, in order:
368
- * 1. For each middleware in registration order: `interceptQuery(exec, ctx)`.
369
- * The first non-`undefined` result wins; subsequent middleware's
370
- * `interceptQuery` does not fire. On a hit, the runtime emits a
371
- * `middleware.interceptQuery` debug event naming the winning middleware,
372
- * switches the row source to the intercepted rows, and proceeds with
373
- * `source: 'middleware'`. On all-passthrough (every `interceptQuery`
374
- * returns `undefined` or is omitted), `source: 'driver'` is used and the
375
- * row source is `runDriver()`.
376
- * 2. Iterate the row source. On the driver path, for each row, for each
377
- * middleware in registration order: `onRow(row, exec, ctx)`; then yield
378
- * the row. On the intercepted hit path, `onRow` is skipped — intercepted
379
- * rows did not originate from a driver row stream — but rows are still
380
- * yielded to the consumer in order.
381
- * 3. On successful completion: for each middleware in registration order:
382
- * `afterQuery(exec, { rowCount, latencyMs, completed: true, source },
383
- * ctx)`.
384
- * 4. On any error thrown during steps 1–2: for each middleware in
385
- * registration order: `afterQuery(exec, { rowCount, latencyMs,
386
- * completed: false, source }, ctx)`. Errors thrown by `afterQuery`
387
- * during the error path are swallowed so they do not mask the original
388
- * error. The original error is then rethrown.
389
- *
390
- * `beforeQuery` is **not** fired here — see
391
- * {@link runBeforeQueryChain} in `before-execute-chain.ts`. Family runtimes
392
- * call that helper between the AST → plan lowering step and the parameter
393
- * encode step so middleware that mutates ParamRef values can have its
394
- * mutations visible to encode. `runQueryWithMiddleware` operates on the
395
- * fully-encoded plan; interceptors therefore observe a fully-mutated,
396
- * encoded plan.
397
- *
398
- * The `source` field on `AfterQueryResult` lets observers (telemetry, lints,
399
- * budgets) distinguish driver-served from middleware-served executions
400
- * without needing their own out-of-band signal.
401
- *
402
- * This helper is the single canonical implementation of the
403
- * intercept-and-row-source loop; family runtimes should not reimplement it.
404
- */
405
- function runQueryWithMiddleware(exec, middleware, ctx, runDriver) {
406
- const iterator = async function* () {
407
- const startedAt = Date.now();
408
- let rowCount = 0;
409
- let completed = false;
410
- let source = "driver";
411
- let rowSource;
412
- try {
413
- for (const mw of middleware) {
414
- if (!mw.interceptQuery) continue;
415
- source = "middleware";
416
- const result = await mw.interceptQuery(exec, ctx);
417
- if (result === void 0) {
418
- source = "driver";
419
- continue;
420
- }
421
- ctx.log.debug?.({
422
- event: "middleware.interceptQuery",
423
- middleware: mw.name
424
- });
425
- rowSource = blindCast(result.rows);
426
- break;
427
- }
428
- if (source === "driver") rowSource = runDriver();
429
- for await (const row of rowSource) {
430
- if (source === "driver") {
431
- for (const mw of middleware) if (mw.onRow) await mw.onRow(row, exec, ctx);
432
- }
433
- rowCount++;
434
- yield row;
435
- }
436
- completed = true;
437
- } catch (error) {
438
- await notifyQueryCompletion(middleware, exec, ctx, {
439
- rowCount,
440
- latencyMs: Date.now() - startedAt,
441
- completed,
442
- source
443
- }, true);
444
- throw error;
445
- }
446
- await notifyQueryCompletion(middleware, exec, ctx, {
447
- rowCount,
448
- latencyMs: Date.now() - startedAt,
449
- completed,
450
- source
451
- }, false);
452
- };
453
- return new AsyncIterableResult(iterator());
454
- }
455
- /**
456
- * Drives a single execute operation through the middleware
457
- * `interceptExecute` + statistics + termination phases.
458
- *
459
- * Lifecycle, in order:
460
- * 1. For each middleware in registration order: `interceptExecute(exec, ctx)`.
461
- * The first non-`undefined` result wins; subsequent middleware's
462
- * `interceptExecute` does not fire. On a hit, the runtime emits a
463
- * `middleware.interceptExecute` debug event naming the winning middleware,
464
- * uses the returned `stats`, and proceeds with `source: 'middleware'`.
465
- * On all-passthrough (every `interceptExecute` returns `undefined` or is
466
- * omitted), `source: 'driver'` is used and `runDriver()` supplies the
467
- * statistics.
468
- * 2. Execute operations return eager statistics. There is no row stream and
469
- * `onRow` does not fire.
470
- * 3. On successful completion: for each middleware in registration order:
471
- * `afterExecute(exec, { stats, latencyMs, completed: true, source }, ctx)`.
472
- * 4. On any error thrown during steps 1–2: for each middleware in
473
- * registration order: `afterExecute(exec, { latencyMs, completed: false,
474
- * source }, ctx)`. Errors thrown by `afterExecute` during the error path
475
- * are swallowed so they do not mask the original error. The original
476
- * error is then rethrown.
477
- *
478
- * `beforeExecute` is **not** fired here — see
479
- * {@link runBeforeExecuteChain} in `before-execute-chain.ts`. Family runtimes
480
- * call that helper between the AST → plan lowering step and the parameter
481
- * encode step so middleware that mutates ParamRef values can have its
482
- * mutations visible to encode. `runExecuteWithMiddleware` operates on the
483
- * fully-encoded plan; interceptors therefore observe a fully-mutated,
484
- * encoded plan.
485
- *
486
- * The `source` field on `AfterExecuteResult` lets observers (telemetry, lints,
487
- * budgets) distinguish driver-served from middleware-served executions
488
- * without needing their own out-of-band signal.
489
- */
490
- async function runExecuteWithMiddleware(exec, middleware, ctx, runDriver) {
491
- const startedAt = Date.now();
492
- let source = "driver";
493
- let stats;
494
- try {
495
- for (const mw of middleware) {
496
- if (!mw.interceptExecute) continue;
497
- source = "middleware";
498
- const result = await mw.interceptExecute(exec, ctx);
499
- if (result === void 0) {
500
- source = "driver";
501
- continue;
502
- }
503
- ctx.log.debug?.({
504
- event: "middleware.interceptExecute",
505
- middleware: mw.name
506
- });
507
- stats = result.stats;
508
- break;
509
- }
510
- if (stats === void 0) stats = await runDriver();
511
- } catch (error) {
512
- const latencyMs = Date.now() - startedAt;
513
- for (const mw of middleware) {
514
- if (!mw.afterExecute) continue;
515
- try {
516
- await mw.afterExecute(exec, {
517
- latencyMs,
518
- completed: false,
519
- source
520
- }, ctx);
521
- } catch {}
522
- }
523
- throw error;
524
- }
525
- const latencyMs = Date.now() - startedAt;
526
- for (const mw of middleware) if (mw.afterExecute) await mw.afterExecute(exec, {
527
- stats,
528
- latencyMs,
529
- completed: true,
530
- source
531
- }, ctx);
532
- return stats;
533
- }
534
- async function notifyQueryCompletion(middleware, exec, ctx, result, swallowErrors) {
535
- for (const mw of middleware) {
536
- if (!mw.afterQuery) continue;
537
- if (swallowErrors) try {
538
- await mw.afterQuery(exec, result, ctx);
539
- } catch {}
540
- else await mw.afterQuery(exec, result, ctx);
541
- }
542
- }
543
- /**
544
- * Family-agnostic abstract runtime base.
545
- *
546
- * Defines the shared operation-specific middleware lifecycles:
547
- *
548
- * 1. `runBeforeCompile(plan)` — concrete; defaults to identity. SQL overrides
549
- * this to run its shared `beforeCompile` middleware-hook chain.
550
- * 2. `lower(plan)` — abstract. Each family produces its `*ExecutionPlan`
551
- * (SQL via `lowerSqlPlan`, Mongo via `adapter.lower`).
552
- * 3. Queries run `beforeQuery`; statements run `beforeExecute`. Both chains
553
- * run after lowering and before their matching driver terminal. Family
554
- * runtimes that expose a params mutator to downstream encoding override
555
- * the operation and call the matching helper at the pre-encode point.
556
- * 4. The matching runner processes `interceptQuery` or `interceptExecute`
557
- * before invoking the driver. Queries then fire `onRow` and `afterQuery`;
558
- * statements fire `afterExecute`.
559
- *
560
- * Concrete subclasses must implement `lower`, `runDriver`, `runExecute`, and
561
- * `close`.
562
- *
563
- * The class is generic over:
564
- * - `TPlan` — the family's pre-lowering plan type.
565
- * - `TExec` — the family's post-lowering (executable) plan type.
566
- * - `TMiddleware` — the family's middleware type. Constrained to
567
- * `RuntimeMiddleware<TExec>` because the operation-specific runners invoke
568
- * hooks with the lowered `TExec`. Middleware therefore sees the
569
- * post-lowering plan.
570
- */
571
- var RuntimeCore = class {
572
- middleware;
573
- ctx;
574
- constructor(options) {
575
- this.middleware = options.middleware;
576
- this.ctx = options.ctx;
577
- }
578
- /**
579
- * Pre-lowering hook for plan rewriting. Defaults to identity. Subclasses
580
- * may override to run a `beforeCompile` middleware chain (SQL does this
581
- * to support typed AST rewrites — see `before-compile-chain.ts`).
582
- */
583
- runBeforeCompile(plan) {
584
- return plan;
585
- }
586
- query(plan, options) {
587
- const self = this;
588
- const signal = options?.signal;
589
- const codecCtx = signal === void 0 ? {} : { signal };
590
- const execCtx = {
591
- ...self.ctx,
592
- ...codecCtx,
593
- scope: options?.scope ?? self.ctx.scope,
594
- planExecutionId: crypto.randomUUID()
595
- };
596
- async function* generator() {
597
- checkAborted(codecCtx, "stream");
598
- const compiled = await self.runBeforeCompile(plan);
599
- const exec = await self.lower(compiled, codecCtx);
600
- await runBeforeQueryChain(exec, self.middleware, execCtx);
601
- yield* runQueryWithMiddleware(exec, self.middleware, execCtx, () => self.runDriver(exec));
602
- }
603
- return new AsyncIterableResult(generator());
604
- }
605
- async execute(plan, options) {
606
- const signal = options?.signal;
607
- const codecCtx = signal === void 0 ? {} : { signal };
608
- const execCtx = {
609
- ...this.ctx,
610
- ...codecCtx,
611
- scope: options?.scope ?? this.ctx.scope,
612
- planExecutionId: crypto.randomUUID()
613
- };
614
- checkAborted(codecCtx, "stream");
615
- const compiled = await this.runBeforeCompile(plan);
616
- const exec = await this.lower(compiled, codecCtx);
617
- await runBeforeExecuteChain(exec, this.middleware, execCtx);
618
- return runExecuteWithMiddleware(exec, this.middleware, execCtx, () => this.runExecute(exec));
619
- }
620
- };
621
- function checkMiddlewareCompatibility(middleware, runtimeFamilyId, runtimeTargetId) {
622
- if (middleware.targetId !== void 0 && middleware.familyId === void 0) throw runtimeError("RUNTIME.MIDDLEWARE_INCOMPATIBLE", `Middleware '${middleware.name}' specifies targetId '${middleware.targetId}' without familyId`, {
623
- middleware: middleware.name,
624
- targetId: middleware.targetId
625
- });
626
- if (middleware.familyId !== void 0 && middleware.familyId !== runtimeFamilyId) throw runtimeError("RUNTIME.MIDDLEWARE_FAMILY_MISMATCH", `Middleware '${middleware.name}' requires family '${middleware.familyId}' but the runtime is configured for family '${runtimeFamilyId}'`, {
627
- middleware: middleware.name,
628
- middlewareFamilyId: middleware.familyId,
629
- runtimeFamilyId
630
- });
631
- if (middleware.targetId !== void 0 && middleware.targetId !== runtimeTargetId) throw runtimeError("RUNTIME.MIDDLEWARE_TARGET_MISMATCH", `Middleware '${middleware.name}' requires target '${middleware.targetId}' but the runtime is configured for target '${runtimeTargetId}'`, {
632
- middleware: middleware.name,
633
- middlewareTargetId: middleware.targetId,
634
- runtimeTargetId
635
- });
636
- }
637
- var MetaBuilderImpl = class {
638
- #kind;
639
- #terminalName;
640
- #annotations = /* @__PURE__ */ new Map();
641
- constructor(kind, terminalName) {
642
- this.#kind = kind;
643
- this.#terminalName = terminalName;
644
- }
645
- get annotations() {
646
- return this.#annotations;
647
- }
648
- annotate(annotation) {
649
- const value = annotation;
650
- assertAnnotationsApplicable([value], this.#kind, this.#terminalName);
651
- this.#annotations.set(value.namespace, value);
652
- return this;
653
- }
654
- };
655
- /**
656
- * Construct a lane-side meta builder for a terminal of operation kind `K`.
657
- *
658
- * Lane terminals call this with their `kind` (`'read'` or `'write'`) and a
659
- * `terminalName` for error messages, hand the resulting builder to the
660
- * user-supplied configurator callback (typed as `MetaBuilder<K>`, the
661
- * narrower public view), and read `meta.annotations` afterwards to thread
662
- * the recorded values into `plan.meta.annotations`.
663
- */
664
- function createMetaBuilder(kind, terminalName) {
665
- return new MetaBuilderImpl(kind, terminalName);
666
- }
667
- //#endregion
668
- export { checkAborted as a, defineAnnotation as c, runBeforeQueryChain as d, runExecuteWithMiddleware as f, assertAnnotationsApplicable as i, raceAgainstAbort as l, runtimeAborted as m, RUNTIME_ABORTED as n, checkMiddlewareCompatibility as o, runQueryWithMiddleware as p, RuntimeCore as r, createMetaBuilder as s, AsyncIterableResult as t, runBeforeExecuteChain as u };
669
-
670
- //# sourceMappingURL=runtime-BqzioOmU.mjs.map