@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
@@ -0,0 +1,899 @@
1
+ import { W as PlanMeta } from "./domain-envelope-CN721GnP-4huRt7Wc.mjs";
2
+ import { n as ContractExecutionSection } from "./contract-types-DEIEpzU_-DvAVuBr5.mjs";
3
+ import { a as CodecCallContext } from "./codec-types-CPgEZoIq-BL9hisr8.mjs";
4
+ import { t as RuntimeErrorEnvelope } from "./runtime-error-CO4MA3Px-YW5SCUcH.mjs";
5
+ //#region ../../../1-framework/1-core/framework-components/dist/runtime.d.mts
6
+ //#region src/annotations.d.ts
7
+ /**
8
+ * The kinds of operations an annotation may apply to.
9
+ *
10
+ * - `'read'` — `SELECT` / `find` / `first` / `all` / `count` / aggregates.
11
+ * - `'write'` — `INSERT` / `UPDATE` / `DELETE` / `create` / `update` / `delete` / `upsert`.
12
+ *
13
+ * Annotations declare which kinds they apply to via `defineAnnotation`'s
14
+ * `applicableTo` option; lane terminals enforce the constraint at both the
15
+ * type level (via `ValidAnnotations`) and at runtime (via
16
+ * `assertAnnotationsApplicable`).
17
+ *
18
+ * Finer-grained kinds (`'select' | 'insert' | 'update' | 'delete' | 'upsert'`)
19
+ * are deliberately deferred. The binary covers the common case (the cache
20
+ * middleware applies to reads; an audit annotation would apply to writes;
21
+ * tracing/OTel applies to both). When a real annotation surfaces that needs
22
+ * a finer split, the union widens and existing handles remain typecheckable.
23
+ */
24
+ type OperationKind = 'read' | 'write';
25
+ /**
26
+ * An applied annotation. Carries the namespace, the typed payload, and the
27
+ * `applicableTo` set the underlying handle declared. The `__annotation`
28
+ * brand lets `read` distinguish branded user annotations from arbitrary
29
+ * data that may happen to live under the same namespace key in
30
+ * `plan.meta.annotations` (e.g. framework-internal metadata such as
31
+ * `meta.annotations.codecs`).
32
+ *
33
+ * Constructed by calling an `AnnotationHandle` directly (e.g.
34
+ * `cacheAnnotation({ ttl: 60 })`); never instantiated by hand.
35
+ */
36
+ interface AnnotationValue<Payload, Kinds extends OperationKind> {
37
+ readonly __annotation: true;
38
+ readonly namespace: string;
39
+ readonly value: Payload;
40
+ readonly applicableTo: ReadonlySet<Kinds>;
41
+ }
42
+ /**
43
+ * Handle returned by `defineAnnotation`. The handle is **callable**: the
44
+ * call signature wraps a `Payload` into an `AnnotationValue` ready to
45
+ * pass to a lane terminal's variadic `annotations` argument. The handle
46
+ * also carries static metadata as own properties:
47
+ *
48
+ * - `namespace` — the namespace string the handle was declared with.
49
+ * - `applicableTo` — the frozen `ReadonlySet<Kinds>` consumed by both
50
+ * the type-level `ValidAnnotations` gate and the runtime
51
+ * `assertAnnotationsApplicable` gate.
52
+ * - `read(source)` — extract the `Payload` from a plan's `meta.annotations`
53
+ * or an activity's `annotations` if a value was previously written under
54
+ * this handle's namespace. Returns `undefined` when the annotation is
55
+ * absent or when the stored value is not a branded `AnnotationValue`
56
+ * (e.g. framework-internal metadata under the same namespace key).
57
+ *
58
+ * Handles are the only supported public entry point for reading and
59
+ * writing annotations. Direct mutation of `plan.meta.annotations` is not
60
+ * part of the public API.
61
+ *
62
+ * ```typescript
63
+ * const cacheAnnotation = defineAnnotation<{ ttl: number }>()({
64
+ * namespace: 'cache',
65
+ * applicableTo: ['read'],
66
+ * });
67
+ *
68
+ * // Call the handle to construct a value:
69
+ * const applied = cacheAnnotation({ ttl: 60 });
70
+ *
71
+ * // Read a stored value off a plan:
72
+ * const payload = cacheAnnotation.read(plan);
73
+ * ```
74
+ *
75
+ * Note on the inherited `Function.prototype.apply`: because the handle is
76
+ * a function, the property name `apply` resolves to JavaScript's built-in
77
+ * `Function.prototype.apply` (which lets you invoke a function with an
78
+ * array of arguments). This is **not** the construction entry point — to
79
+ * build an `AnnotationValue`, call the handle directly. The
80
+ * `AnnotationHandle` interface deliberately does not declare an `apply`
81
+ * member of its own.
82
+ */
83
+ interface AnnotationHandle<Payload, Kinds extends OperationKind> {
84
+ (value: Payload): AnnotationValue<Payload, Kinds>;
85
+ readonly namespace: string;
86
+ readonly applicableTo: ReadonlySet<Kinds>;
87
+ read(source: AnnotationSource): Payload | undefined;
88
+ }
89
+ /** A plan, or an activity, whose annotations a handle reads. */
90
+ type AnnotationSource = {
91
+ readonly meta: {
92
+ readonly annotations?: Record<string, unknown>;
93
+ };
94
+ } | {
95
+ readonly annotations: ReadonlyMap<string, unknown>;
96
+ };
97
+ /**
98
+ * Options accepted by `defineAnnotation`.
99
+ *
100
+ * `namespace` is the string key under which the annotation is stored in
101
+ * `plan.meta.annotations`. **Reserved namespaces** include framework-
102
+ * internal metadata keys; user handles must not use them:
103
+ *
104
+ * - `codecs` — used by the SQL emitter to record per-alias codec ids
105
+ * (`meta.annotations.codecs[alias] = 'pg/text@1'`); the SQL runtime's
106
+ * `decodeRow` reads from this key. A user `defineAnnotation('codecs')`
107
+ * handle is not structurally prevented, but its behavior with the
108
+ * emitter and the runtime is undefined and we make no compatibility
109
+ * guarantees about it.
110
+ * - Target-specific keys such as `pg` (and equivalents on other
111
+ * targets) are similarly reserved for adapter / target use.
112
+ *
113
+ * `applicableTo` declares which operation kinds the annotation may attach
114
+ * to. The lane terminals' type-level `ValidAnnotations<K, As>` gate rejects
115
+ * annotations whose `Kinds` does not include the terminal's `K`; the
116
+ * runtime helper `assertAnnotationsApplicable` does the equivalent at
117
+ * runtime so casts and `any` cannot bypass the gate.
118
+ */
119
+ interface DefineAnnotationOptions<Kinds extends OperationKind> {
120
+ readonly namespace: string;
121
+ readonly applicableTo: readonly Kinds[];
122
+ }
123
+ /**
124
+ * Defines a typed annotation handle.
125
+ *
126
+ * Two-step call form. The first step takes the `Payload` type argument
127
+ * (TypeScript cannot infer `Payload` from anything in the options, so it
128
+ * must be supplied explicitly); the second step takes the runtime options
129
+ * and infers `Kinds` from the `applicableTo` array via a `const` type
130
+ * parameter, so the operation kinds appear exactly once at the call site.
131
+ *
132
+ * @example
133
+ * ```typescript
134
+ * // Read-only annotation. Lane terminals like `db.User.first(...)` accept
135
+ * // it; `db.User.create(...)` rejects it at the type level.
136
+ * const cacheAnnotation = defineAnnotation<{ ttl?: number; skip?: boolean }>()({
137
+ * namespace: 'cache',
138
+ * applicableTo: ['read'],
139
+ * }); // Kinds inferred as 'read'
140
+ *
141
+ * // Write-only annotation. Mirror image.
142
+ * const auditAnnotation = defineAnnotation<{ actor: string }>()({
143
+ * namespace: 'audit',
144
+ * applicableTo: ['write'],
145
+ * }); // Kinds inferred as 'write'
146
+ *
147
+ * // Annotation applicable to both kinds (e.g. tracing).
148
+ * const otelAnnotation = defineAnnotation<{ traceId: string }>()({
149
+ * namespace: 'otel',
150
+ * applicableTo: ['read', 'write'],
151
+ * }); // Kinds inferred as 'read' | 'write'
152
+ * ```
153
+ *
154
+ * **Reserved namespaces.** See `DefineAnnotationOptions.namespace` for the
155
+ * list of framework-internal namespaces (`codecs`, target-specific keys).
156
+ * `defineAnnotation` does not structurally prevent a user from naming a
157
+ * reserved namespace, but the framework makes no compatibility guarantee
158
+ * about handles that do.
159
+ */
160
+ declare function defineAnnotation<Payload>(): <const Kinds extends OperationKind>(options: DefineAnnotationOptions<Kinds>) => AnnotationHandle<Payload, Kinds>;
161
+ /**
162
+ * Type-level applicability gate consumed by lane terminals.
163
+ *
164
+ * Maps a tuple of `AnnotationValue`s to a tuple where each element either
165
+ * keeps its annotation type (when the annotation's declared `Kinds`
166
+ * includes the terminal's operation kind `K`) or resolves to `never`
167
+ * (when the kinds are incompatible). A `never` element makes the entire
168
+ * tuple unassignable, surfacing the mismatch as a type error at the call
169
+ * site of the terminal.
170
+ *
171
+ * The SQL DSL builders constrain their variadic `...annotations`
172
+ * parameter via `As & ValidAnnotations<K, As>`. **The intersection is
173
+ * load-bearing** — see the note below. The ORM terminals deliberately
174
+ * sidestep this trick by taking one annotation per `meta.annotate(...)`
175
+ * call (no variadic-tuple inference involved), so `ValidAnnotations` is
176
+ * consumed only by the SQL DSL today.
177
+ *
178
+ * @example
179
+ * ```typescript
180
+ * class SelectQuery<Row> {
181
+ * annotate<As extends readonly AnnotationValue<unknown, OperationKind>[]>(
182
+ * ...annotations: As & ValidAnnotations<'read', As>
183
+ * ): SelectQuery<Row>;
184
+ * }
185
+ *
186
+ * class InsertQuery<Row> {
187
+ * annotate<As extends readonly AnnotationValue<unknown, OperationKind>[]>(
188
+ * ...annotations: As & ValidAnnotations<'write', As>
189
+ * ): InsertQuery<Row>;
190
+ * }
191
+ *
192
+ * db.users.select('id').annotate(cacheAnnotation({ ttl: 60 }));
193
+ * // ✓ cacheAnnotation declares 'read'; SelectQuery.annotate requires 'read'.
194
+ *
195
+ * db.users
196
+ * .insert([{ id: 1, name: 'Alice', email: 'alice@example.com' }])
197
+ * .annotate(cacheAnnotation({ ttl: 60 }));
198
+ * // ✗ cacheAnnotation declares 'read'; InsertQuery.annotate requires 'write'.
199
+ * // Element resolves to `never` → tuple unassignable → type error.
200
+ * ```
201
+ *
202
+ * **Why `As & ValidAnnotations<K, As>` and not `ValidAnnotations<K, As>`
203
+ * alone.** TypeScript's variadic-tuple inference is too forgiving when
204
+ * the parameter type refers to `As` only through `ValidAnnotations`: it
205
+ * will pick an `As` that makes the call valid even when the gated tuple
206
+ * would contain `never` for an inapplicable element. The intersection
207
+ * pins `As` to the actual call-site tuple AND requires it to be
208
+ * assignable to the gated form. A `never` element in the gated tuple
209
+ * then collapses the corresponding intersection position to `never`,
210
+ * and the inapplicable argument fails to assign — surfacing the mismatch
211
+ * as a type error at the call site.
212
+ *
213
+ * The runtime helper `assertAnnotationsApplicable` covers the equivalent
214
+ * check at runtime so casts and `any` cannot bypass this gate.
215
+ */
216
+ type ValidAnnotations<K extends OperationKind, As extends readonly AnnotationValue<unknown, OperationKind>[]> = { readonly [I in keyof As]: As[I] extends AnnotationValue<infer P, infer Kinds> ? K extends Kinds ? AnnotationValue<P, Kinds> : never : never; };
217
+ /**
218
+ * Runtime applicability gate. Throws `RUNTIME.ANNOTATION_INAPPLICABLE` if
219
+ * any annotation in `annotations` declares an `applicableTo` set that does
220
+ * not include `kind`. Used by lane terminals (SQL DSL builders' `.build()`,
221
+ * ORM `Collection` terminals) to fail closed when the type-level
222
+ * `ValidAnnotations` gate is bypassed via cast / `any` / dynamic
223
+ * invocation.
224
+ *
225
+ * Passes silently on:
226
+ * - empty arrays
227
+ * - annotations whose `applicableTo` includes `kind`
228
+ *
229
+ * Throws on:
230
+ * - any annotation whose `applicableTo` does not include `kind`. The
231
+ * error names the offending annotation's `namespace` and the
232
+ * `terminalName` so users can locate the misuse.
233
+ *
234
+ * @example
235
+ * ```typescript
236
+ * // Inside an ORM read terminal:
237
+ * assertAnnotationsApplicable(annotations, 'read', 'first');
238
+ * ```
239
+ */
240
+ declare function assertAnnotationsApplicable(annotations: readonly AnnotationValue<unknown, OperationKind>[], kind: OperationKind, terminalName: string): void;
241
+ //#endregion
242
+ //#region src/execution/runtime-error.d.ts
243
+ /**
244
+ * Stable code emitted by the runtime when an in-flight `execute()`
245
+ * is cancelled via the per-query `AbortSignal`. The envelope's
246
+ * `details.phase` distinguishes where the abort was observed:
247
+ *
248
+ * - `'encode'` — abort fired during `encodeParams` (SQL) or
249
+ * `resolveValue` (Mongo).
250
+ * - `'decode'` — abort fired during `decodeRow` / `decodeField`.
251
+ * - `'stream'` — abort fired between rows or before any codec call
252
+ * (already-aborted at entry).
253
+ * - `'beforeEncode'` / `'onRow'` — abort fired on entry to or during
254
+ * the corresponding middleware phase
255
+ * (cooperative cancellation per the param-transform seam).
256
+ */
257
+ declare const RUNTIME_ABORTED: "RUNTIME.ABORTED";
258
+ /** Discriminator placed in `details.phase` of a `RUNTIME.ABORTED` envelope. */
259
+ type RuntimeAbortedPhase = 'encode' | 'decode' | 'stream' | 'beforeEncode' | 'onRow';
260
+ /**
261
+ * Construct a `RUNTIME.ABORTED` envelope. Phase distinguishes where the
262
+ * abort was observed — codec call sites (`encode` / `decode` / `stream`)
263
+ * or operation-specific middleware seams, as
264
+ * enumerated on {@link RuntimeAbortedPhase}. Cause carries
265
+ * `signal.reason` verbatim from the platform — native abort produces a
266
+ * `DOMException`, explicit `controller.abort(reason)` produces whatever
267
+ * the caller passed. No synthesis happens here.
268
+ */
269
+ declare function runtimeAborted(phase: RuntimeAbortedPhase, cause?: unknown): RuntimeErrorEnvelope;
270
+ //#endregion
271
+ //#region src/execution/async-iterable-result.d.ts
272
+ declare class AsyncIterableResult<Row> implements AsyncIterable<Row>, PromiseLike<Row[]> {
273
+ private readonly generator;
274
+ private consumed;
275
+ private consumedBy;
276
+ private bufferedArrayPromise;
277
+ constructor(generator: AsyncGenerator<Row, void, unknown>);
278
+ [Symbol.asyncIterator](): AsyncIterator<Row>;
279
+ toArray(): Promise<Row[]>;
280
+ first(): Promise<Row | null>;
281
+ firstOrThrow(): Promise<Row>;
282
+ then<TResult1 = Row[], TResult2 = never>(onfulfilled?: ((value: Row[]) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
283
+ }
284
+ //#endregion
285
+ //#region src/execution/query-plan.d.ts
286
+ /**
287
+ * Family-agnostic plan marker.
288
+ *
289
+ * Carries only `meta` (the family-agnostic plan metadata) and the optional
290
+ * phantom `_row` parameter that lets type-level utilities recover the row
291
+ * type from a plan value. SQL and Mongo extend this marker with their own
292
+ * concrete shapes (`SqlQueryPlan`, `MongoQueryPlan`).
293
+ *
294
+ * `QueryPlan` is the *pre-lowering* marker — i.e. the surface a builder
295
+ * produces before family-specific lowering turns it into an executable
296
+ * plan (`ExecutionPlan`).
297
+ */
298
+ interface QueryPlan<Row = unknown> {
299
+ readonly meta: PlanMeta;
300
+ /**
301
+ * Phantom property to carry the Row generic for type-level utilities.
302
+ * Not set at runtime; used only for `ResultType` extraction.
303
+ */
304
+ readonly _row?: Row;
305
+ }
306
+ /**
307
+ * Family-agnostic execution-plan marker.
308
+ *
309
+ * Extends `QueryPlan` with no additional structural fields — the marker
310
+ * exists to nominally distinguish executable plans from pre-lowering plans
311
+ * in the type system. Family-specific execution plans (`SqlExecutionPlan`,
312
+ * `MongoExecutionPlan`) extend this marker with their concrete shapes
313
+ * (e.g. `sql + params` for SQL, `wireCommand` for Mongo).
314
+ */
315
+ interface ExecutionPlan<Row = unknown> extends QueryPlan<Row> {}
316
+ /**
317
+ * Extracts the `Row` type from a plan via the phantom `_row` property.
318
+ *
319
+ * Works with any plan that extends `QueryPlan<Row>` — including
320
+ * `ExecutionPlan<Row>`, `SqlQueryPlan<Row>`, `SqlExecutionPlan<Row>`,
321
+ * `MongoQueryPlan<Row>`, and `MongoExecutionPlan<Row>`.
322
+ *
323
+ * The `_row` property must be present in the plan's static type for the
324
+ * conditional to bind `R`; objects whose type lacks `_row` resolve to
325
+ * `never`. Without the `keyof` guard, `extends { _row?: infer R }` would
326
+ * silently match any object and infer `unknown`.
327
+ *
328
+ * Example: `type Row = ResultType<typeof plan>`.
329
+ */
330
+ type ResultType<P> = '_row' extends keyof P ? P extends {
331
+ readonly _row?: infer R;
332
+ } ? R : never : never;
333
+ //#endregion
334
+ //#region src/execution/runtime-middleware.d.ts
335
+ interface RuntimeLog {
336
+ info(event: unknown): void;
337
+ warn(event: unknown): void;
338
+ error(event: unknown): void;
339
+ debug?(event: unknown): void;
340
+ }
341
+ /** What every activity has: an identity, a kind and the annotations the user put on it. */
342
+ interface ActivityBase {
343
+ /** A fresh `crypto.randomUUID()` per activity. */
344
+ readonly id: string;
345
+ readonly kind: string;
346
+ /** Empty when the activity carries no annotation. */
347
+ readonly annotations: ReadonlyMap<string, AnnotationValue<unknown, OperationKind>>;
348
+ }
349
+ /** One statement sent to the database: `query()` sends it for its rows, `execute()` for its statistics. */
350
+ interface StatementActivity<TPlan extends QueryPlan = QueryPlan> extends ActivityBase {
351
+ readonly kind: 'statement';
352
+ readonly returns: 'rows' | 'stats';
353
+ /** The plan the caller sent. */
354
+ readonly plan: TPlan;
355
+ }
356
+ /** Started by `transaction()`, ended by `commit()` or `rollback()`. */
357
+ interface TransactionActivity extends ActivityBase {
358
+ readonly kind: 'transaction';
359
+ }
360
+ /** The kind of an activity a client starts. A client kind contains a hyphen, such as `orm-call`, so it is never `statement` or `transaction`. */
361
+ type ClientActivityKind = `${string}-${string}`;
362
+ /**
363
+ * The result types of the client kinds packages register. It types the handle side only, `intercepted.result` and `end({ result })`; in middleware hooks a client activity's result is `unknown`, even after narrowing on its kind, because the hook types accept every kind. An extension registers a kind by augmenting the published entry:
364
+ *
365
+ * ```ts
366
+ * declare module '@prisma/orm-framework/components/runtime' {
367
+ * interface ClientActivityRegistry { 'orm-call': { result: unknown } }
368
+ * }
369
+ * ```
370
+ */
371
+ interface ClientActivityRegistry extends Record<never, never> {}
372
+ /** The result a client activity of kind `K` ends with: the registered type, or `unknown` for an unregistered kind. */
373
+ type ClientActivityResult<K extends ClientActivityKind> = K extends keyof ClientActivityRegistry ? ClientActivityRegistry[K] extends {
374
+ readonly result: infer R;
375
+ } ? R : unknown : unknown;
376
+ /** An act a client started through the runtime, such as an ORM call. */
377
+ interface ClientActivity<K extends ClientActivityKind = ClientActivityKind> extends ActivityBase {
378
+ readonly kind: K;
379
+ /** An opaque digest of what the activity does, from the function the client supplied. It is computed on the first call and the same promise is returned to every later caller, so nothing is computed when no middleware asks. The client decides how fine the digest is, so equal digests do not mean equal work unless the client says so. */
380
+ contentHash(): Promise<string>;
381
+ }
382
+ type Activity = StatementActivity | TransactionActivity | ClientActivity;
383
+ /** What a client gives to start an activity. */
384
+ interface StartActivity<K extends ClientActivityKind = ClientActivityKind> {
385
+ readonly kind: K;
386
+ /** Computes an opaque digest of what the activity does, as fine as the client chooses; say in the client's docs what equal digests mean. The runtime calls it at most once per activity, and only when a middleware asks for `activity.contentHash()`. */
387
+ readonly contentHash: () => Promise<string>;
388
+ readonly annotations?: ReadonlyMap<string, AnnotationValue<unknown, OperationKind>>;
389
+ }
390
+ /**
391
+ * The context of one activity. Every hook of the activity receives the same object.
392
+ */
393
+ interface ActivityContext {
394
+ readonly contract: unknown;
395
+ readonly mode: 'strict' | 'permissive';
396
+ readonly now: () => number;
397
+ readonly log: RuntimeLog;
398
+ /**
399
+ * A stable digest of an execution's storage hash, statement and parameters, usable directly as a `Map` key. Two equivalent executions return the same string.
400
+ */
401
+ contentHash(exec: ExecutionPlan): Promise<string>;
402
+ /** The caller's cancellation signal, when it passed one. */
403
+ readonly signal?: AbortSignal;
404
+ /** The scope of the queryable the activity was started on. */
405
+ readonly scope: 'runtime' | 'connection' | 'transaction';
406
+ /** The parent activity's context, or `undefined` at the root. */
407
+ readonly parent: ActivityContext | undefined;
408
+ /** The state object stored under `key` for this activity, created empty on first use and dropped when the activity is finalized. Middleware that use the same key share the object. */
409
+ state(key: string | symbol): Record<string | symbol, unknown>;
410
+ /** Whether any ancestor of this activity is a transaction. */
411
+ inTransaction(): boolean;
412
+ }
413
+ /** The fields a runtime supplies to build an activity's context; the runtime adds `parent`, `state` and `inTransaction`. */
414
+ type ActivityContextFields<TContext extends ActivityContext = ActivityContext> = Omit<TContext, 'parent' | 'state' | 'inTransaction'>;
415
+ interface TransactionEnded {
416
+ readonly kind: 'transaction';
417
+ readonly outcome: 'succeeded' | 'failed';
418
+ }
419
+ type StatementEnded = {
420
+ readonly kind: 'statement';
421
+ /** `stopped` when the caller stopped reading the rows. */
422
+ readonly outcome: 'succeeded' | 'failed' | 'stopped';
423
+ readonly latencyMs: number;
424
+ /** `middleware` when an `intercept` handler supplied the result, or threw. */
425
+ readonly source: 'driver' | 'middleware';
426
+ } & ({
427
+ readonly returns: 'rows';
428
+ readonly rowCount: number;
429
+ } | {
430
+ readonly returns: 'stats';
431
+ readonly stats?: RuntimeStatementStats;
432
+ });
433
+ interface ClientActivityEnded<K extends ClientActivityKind = ClientActivityKind> {
434
+ readonly kind: K;
435
+ readonly outcome: 'succeeded' | 'failed' | 'stopped';
436
+ /** `middleware` when an `intercept.onActivity` handler supplied the result and the client passed none, or when the handler threw. */
437
+ readonly source: 'client' | 'middleware';
438
+ /** The value the client returns to its caller. The runtime does not read it. */
439
+ readonly result?: ClientActivityResult<K>;
440
+ }
441
+ type ActivityEndedResult = TransactionEnded | StatementEnded | ClientActivityEnded;
442
+ interface ActivityFinalizedResult {
443
+ /** `unknown` when the runtime cannot tell whether the writes landed; treat it like `committed` when a committed write must not be missed. */
444
+ readonly outcome: 'committed' | 'rolled-back' | 'unknown';
445
+ }
446
+ interface QueryInterceptResult {
447
+ readonly rows: AsyncIterable<Record<string, unknown>> | Iterable<Record<string, unknown>>;
448
+ }
449
+ interface ActivityInterceptResult {
450
+ readonly result: unknown;
451
+ }
452
+ interface ExecuteInterceptResult {
453
+ readonly stats: RuntimeStatementStats;
454
+ }
455
+ /**
456
+ * Marker for the family-specific parameter mutator passed to `beforeEncode`. SQL extends it as `SqlParamRefMutator`, Mongo as `MongoParamRefMutator`.
457
+ */
458
+ declare const PARAM_REF_MUTATOR_BRAND: unique symbol;
459
+ type ParamRefMutator = {
460
+ readonly [PARAM_REF_MUTATOR_BRAND]?: never;
461
+ };
462
+ /** The lifecycle events every activity has. They observe; they cannot change the activity. */
463
+ interface ActivityObserver {
464
+ readonly name: string;
465
+ /** The act begins. */
466
+ activityStarted?(activity: Activity, ctx: ActivityContext): Promise<void>;
467
+ /** The act ends, with its outcome as the actor saw it. An error thrown when the activity succeeded fails it and reaches the caller; after a failure it is swallowed. */
468
+ activityEnded?(activity: Activity, result: ActivityEndedResult, ctx: ActivityContext): Promise<void>;
469
+ /** The act's effects are final. A thrown error is passed to `ctx.log.error` and swallowed; later middleware still run. */
470
+ activityFinalized?(activity: Activity, result: ActivityFinalizedResult, ctx: ActivityContext): Promise<void>;
471
+ }
472
+ /**
473
+ * Family-agnostic middleware. `TPlan` is the encoded execution plan the statement interceptors receive; `TMutator` is the family's parameter mutator.
474
+ */
475
+ interface RuntimeMiddleware<TPlan extends QueryPlan = QueryPlan, TMutator extends ParamRefMutator = ParamRefMutator> extends ActivityObserver {
476
+ readonly familyId?: string;
477
+ readonly targetId?: string;
478
+ /** Runs after lowering, before codecs encode the parameter values. Throw to block the statement; change values through `params`. */
479
+ beforeEncode?(draft: TPlan, ctx: ActivityContext, params?: TMutator): void | Promise<void>;
480
+ /** Supplies a statement's result instead of running it. Middleware run in registration order and the first handler that returns a result wins. */
481
+ intercept?: {
482
+ onQuery?(plan: TPlan, ctx: ActivityContext): Promise<QueryInterceptResult | undefined>;
483
+ onExecute?(plan: TPlan, ctx: ActivityContext): Promise<ExecuteInterceptResult | undefined>;
484
+ /** Supplies the result of an activity a client started, after its `activityStarted` hooks. The client checks what it receives. */
485
+ onActivity?(activity: ClientActivity, ctx: ActivityContext): Promise<ActivityInterceptResult | undefined>;
486
+ };
487
+ /** Runs for each row the driver returns; not for intercepted rows. Throw to stop the stream. */
488
+ onRow?(row: Record<string, unknown>, plan: TPlan, ctx: ActivityContext): Promise<void>;
489
+ }
490
+ /**
491
+ * Middleware that names no family or target, so it fits any family runtime's middleware array.
492
+ */
493
+ type CrossFamilyMiddleware<TPlan extends QueryPlan = QueryPlan> = RuntimeMiddleware<TPlan> & {
494
+ readonly familyId?: undefined;
495
+ readonly targetId?: undefined;
496
+ };
497
+ /** Per-operation options accepted by every family runtime. */
498
+ interface RuntimeExecuteOptions {
499
+ readonly signal?: AbortSignal;
500
+ readonly scope?: 'runtime' | 'connection' | 'transaction';
501
+ }
502
+ interface RuntimeStatementStats {
503
+ readonly affectedRows: number;
504
+ }
505
+ /** Any runtime that can query or execute plans and be shut down. */
506
+ interface RuntimeExecutor<TPlan extends QueryPlan> {
507
+ query<Row>(plan: TPlan & {
508
+ readonly _row?: Row;
509
+ }, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
510
+ execute(plan: TPlan, options?: RuntimeExecuteOptions): Promise<RuntimeStatementStats>;
511
+ close(): Promise<void>;
512
+ }
513
+ declare function checkMiddlewareCompatibility(middleware: RuntimeMiddleware, runtimeFamilyId: string, runtimeTargetId: string): void;
514
+ //#endregion
515
+ //#region src/execution/activity-lifecycle.d.ts
516
+ /** An open activity that new activities can start beneath. */
517
+ interface ActivityParent {
518
+ readonly activity: ActivityBase;
519
+ readonly ctx: ActivityContext;
520
+ /** Whether statements and activities may still start beneath this parent. A transaction stops accepting children when its `commit()` or `rollback()` is called; a client activity, when it ends or its transaction stops accepting children. */
521
+ acceptsChildren(): boolean;
522
+ /** Records `child` in start order and returns how the child reports to this parent. Throws `RUNTIME.ACTIVITY_NOT_ACCEPTING_CHILDREN` when the parent no longer accepts children. */
523
+ adopt(child: ActivityChild): ActivityChildSlot;
524
+ }
525
+ /** What a parent holds of a child activity until it is finalized. */
526
+ interface ActivityChild {
527
+ /** Runs the `activityFinalized` hooks of the children it holds, in the order they started and depth first, then its own. A second call does nothing. */
528
+ finalize(result: ActivityFinalizedResult): Promise<void>;
529
+ }
530
+ /** How a child reports to its parent. */
531
+ interface ActivityChildSlot {
532
+ /** A statement at or beneath the child failed. The report travels up to the nearest transaction. */
533
+ statementFailed(): void;
534
+ /** The child has ended. `own` is its finalized result when no transaction finalizes it. Resolves once the child is finalized, or held for its transaction. */
535
+ ended(own: ActivityFinalizedResult): Promise<void>;
536
+ /** Whether the nearest transaction at or above the parent still accepts children; `true` outside any transaction. */
537
+ transactionAcceptsChildren(): boolean;
538
+ }
539
+ /** The per-activity state behind `ctx.state(key)`: one object per key, created empty on first use. */
540
+ interface ActivityStateStore {
541
+ state(key: string | symbol): Record<string | symbol, unknown>;
542
+ clear(): void;
543
+ }
544
+ declare function createStateStore(): ActivityStateStore;
545
+ /**
546
+ * The context of work that belongs to no activity but runs beneath `parent`, such as compiling a plan outside any statement: `parent` and `inTransaction()` as a child of `parent` would have them, and state of its own.
547
+ */
548
+ declare function createContextBeneath<TContext extends ActivityContext>(fields: ActivityContextFields<TContext>, parent: ActivityParent | undefined): TContext;
549
+ //#endregion
550
+ //#region src/execution/client-activity.d.ts
551
+ /** What a client passes to end its activity. */
552
+ interface ClientActivityEnd<K extends ClientActivityKind> {
553
+ readonly outcome: 'succeeded' | 'failed' | 'stopped';
554
+ /** The value the client returns to its caller. When omitted after an interception, the intercepted result. */
555
+ readonly result?: ClientActivityResult<K>;
556
+ }
557
+ /** An open client activity. Pass it as the `parent` of every statement, transaction and client activity started beneath it. */
558
+ interface ClientActivityRun<K extends ClientActivityKind, TContext extends ActivityContext = ActivityContext> extends ActivityParent {
559
+ readonly activity: ClientActivity<K>;
560
+ readonly ctx: TContext;
561
+ /** Set when an `intercept.onActivity` handler supplied the result. */
562
+ readonly intercepted: {
563
+ readonly result: ClientActivityResult<K>;
564
+ } | undefined;
565
+ /** Throws `RUNTIME.ACTIVITY_NOT_ACCEPTING_CHILDREN` when the activity no longer accepts children. */
566
+ assertAcceptsChildren(): void;
567
+ /**
568
+ * Ends the activity: its `activityEnded` hooks, then its finalization. Outside a transaction it is finalized at once: `committed` when it succeeded and everything beneath it was finalized `committed`, otherwise `unknown`. Inside one, its transaction finalizes it. When a child has not ended, the activity ends `failed`, is finalized, and `end` rejects with `RUNTIME.ACTIVITY_CHILDREN_OPEN`. A second call rejects with `RUNTIME.ACTIVITY_ALREADY_ENDED`.
569
+ */
570
+ end(end: ClientActivityEnd<K>): Promise<void>;
571
+ }
572
+ /** How a runtime runs a client activity. */
573
+ interface ClientActivityOptions<TContext extends ActivityContext> {
574
+ readonly middleware: ReadonlyArray<ActivityObserver & Pick<RuntimeMiddleware, 'intercept'>>;
575
+ readonly context: ActivityContextFields<TContext>;
576
+ /** The open activity the client activity starts beneath. */
577
+ readonly parent: ActivityParent | undefined;
578
+ /** As for a transaction: whether finished children inside a transaction are kept for it to finalize. */
579
+ readonly holdFinishedChildren: boolean;
580
+ }
581
+ /**
582
+ * Starts a client activity: its `activityStarted` hooks, then each `intercept.onActivity` handler in registration order until one returns a result. When a hook or a handler throws, the activity ends `failed`, is finalized, and the error is rethrown. Rejects at once, running no hook, when `kind` has no hyphen (such as `statement` or `transaction`) or when `parent` no longer accepts children.
583
+ */
584
+ declare function startClientActivity<K extends ClientActivityKind, TContext extends ActivityContext = ActivityContext>(activity: StartActivity<K>, options: ClientActivityOptions<TContext>): Promise<ClientActivityRun<K, TContext>>;
585
+ //#endregion
586
+ //#region src/execution/mutation-defaults.d.ts
587
+ /**
588
+ * Scope across which a generator's value is constant.
589
+ *
590
+ * - `'field'` — one value per defaulting site (one field of one record). Cache strategy: no cache; call per defaulting site. Right for per-record identifiers (UUIDs, CUIDs, ULIDs, nanoid, ksuid).
591
+ * - `'row'` — one value across all defaulting sites of one record of one operation. Cache strategy: per-call cache keyed by generator id and params. Right for correlation ids stamped into several fields of one record.
592
+ * - `'query'` — one value across all records and fields of one ORM operation. Cache strategy: caller-provided cache keyed by generator id and params. Right for `timestampNow` (a single timestamp per bulk create or update).
593
+ */
594
+ type GeneratorStability = 'field' | 'row' | 'query';
595
+ interface RuntimeMutationDefaultGenerator {
596
+ readonly id: string;
597
+ readonly generate: (params?: Record<string, unknown>) => unknown;
598
+ /**
599
+ * Scope across which the generator's value is constant. The framework derives the cache strategy from this declaration; generator authors never need to know about cache keys. See `GeneratorStability` for the per-value semantics.
600
+ */
601
+ readonly stability: GeneratorStability;
602
+ }
603
+ /** A runtime component (target, adapter, or extension) that may contribute generators. */
604
+ interface MutationDefaultGeneratorContributor {
605
+ readonly id: string;
606
+ readonly mutationDefaultGenerators?: () => ReadonlyArray<RuntimeMutationDefaultGenerator>;
607
+ }
608
+ type MutationDefaultsOp = 'create' | 'update';
609
+ interface MutationDefaultsOptions {
610
+ readonly op: MutationDefaultsOp;
611
+ /** Required: refs are namespace-scoped, so only defaults of `(namespace, entry)` apply, which tells same-named entries in different namespaces apart. */
612
+ readonly namespace: string;
613
+ readonly entry: string;
614
+ /** The values the caller writes. A key present here is explicit, whatever its value, and gets no default. */
615
+ readonly values: Readonly<Record<string, unknown>>;
616
+ /** Cache shared by the calls of one ORM operation, for `'query'`-stable generators. */
617
+ readonly defaultValueCache?: Map<string, unknown>;
618
+ }
619
+ interface AppliedMutationDefault {
620
+ readonly field: string;
621
+ readonly value: unknown;
622
+ }
623
+ interface MutationDefaults {
624
+ applyMutationDefaults(options: MutationDefaultsOptions): ReadonlyArray<AppliedMutationDefault>;
625
+ }
626
+ /** Registers every generator the contributors provide, by id. Two contributors providing one id is an error naming both. */
627
+ declare function collectMutationDefaultGenerators(contributors: ReadonlyArray<MutationDefaultGeneratorContributor>): ReadonlyMap<string, RuntimeMutationDefaultGenerator>;
628
+ /** Fails when the contract's mutation defaults name a generator the registry does not hold, listing every missing id and the fields that need it. */
629
+ declare function assertMutationDefaultGeneratorsAvailable(execution: ContractExecutionSection | undefined, generatorRegistry: ReadonlyMap<string, RuntimeMutationDefaultGenerator>): void;
630
+ /**
631
+ * The defaults to write for one record: for each mutation default of the entry and namespace whose phase matches `op`, the generated value of every field the values do not carry. An update with no keys gets none.
632
+ */
633
+ declare function applyMutationDefaults(execution: ContractExecutionSection | undefined, generatorRegistry: ReadonlyMap<string, RuntimeMutationDefaultGenerator>, options: MutationDefaultsOptions): ReadonlyArray<AppliedMutationDefault>;
634
+ //#endregion
635
+ //#region src/execution/race-against-abort.d.ts
636
+ /**
637
+ * Throw a phase-tagged `RUNTIME.ABORTED` envelope if the supplied
638
+ * context is already aborted at the precheck site. Centralises the
639
+ * `if (ctx.signal?.aborted) throw runtimeAborted(...)` pattern that
640
+ * every codec dispatch site (and the `beforeEncode` middleware phase)
641
+ * repeats. Accepts both the framework `CodecCallContext` and the
642
+ * `ActivityContext`; both expose `signal?: AbortSignal`.
643
+ */
644
+ declare function checkAborted(ctx: {
645
+ readonly signal?: AbortSignal;
646
+ }, phase: RuntimeAbortedPhase): void;
647
+ /**
648
+ * Race a per-cell `Promise.all` (or any other in-flight work promise) against
649
+ * the supplied abort signal so the runtime returns `RUNTIME.ABORTED` promptly
650
+ * even when codec bodies ignore the signal. In-flight bodies that ignore the
651
+ * signal are abandoned and run to completion in the background — the
652
+ * cooperative-cancellation contract documented in ADR 204.
653
+ *
654
+ * Call sites still SHOULD pre-check `signal.aborted` and short-circuit with
655
+ * a phase-tagged `RUNTIME.ABORTED` envelope before invoking this helper —
656
+ * that path is the canonical "aborted at entry" surface and avoids
657
+ * scheduling the work promise. As a defensive belt-and-braces, this helper
658
+ * also handles the already-aborted case internally: `AbortSignal` does not
659
+ * replay past abort events to listeners registered after the abort, so we
660
+ * inspect `signal.aborted` synchronously and reject with the sentinel
661
+ * before installing the listener. The rejection is still attributed to the
662
+ * abort path via the sentinel-identity check.
663
+ *
664
+ * Distinguishing the rejection source is load-bearing for AC-ERR4
665
+ * (`RUNTIME.ENCODE_FAILED` / `RUNTIME.DECODE_FAILED` pass through unchanged).
666
+ * The semantically equivalent `abortable(signal)` helper in
667
+ * `@internal/utils` rejects with `signal.reason ?? new DOMException(...)`,
668
+ * which is not stably distinguishable from a codec-thrown error by identity
669
+ * alone (a fresh fallback DOMException is allocated per call). We instead
670
+ * track abort attribution with a unique sentinel: only the `onAbort` listener
671
+ * installed here ever rejects with the sentinel, so an `error === sentinel`
672
+ * identity check after the race is unambiguous.
673
+ *
674
+ * Lives in `framework-components` (rather than the SQL family, where it
675
+ * originated in m2) so every family runtime that needs cooperative
676
+ * cancellation around a codec-dispatch `Promise.all` (SQL encode + decode
677
+ * today, Mongo encode in m3) shares the same attribution logic.
678
+ */
679
+ declare function raceAgainstAbort<T>(work: Promise<T>, signal: AbortSignal | undefined, phase: RuntimeAbortedPhase): Promise<T>;
680
+ //#endregion
681
+ //#region src/execution/run-with-middleware.d.ts
682
+ /** How a family runtime starts one statement activity. */
683
+ interface StatementOptions<TExec extends ExecutionPlan, TMutator extends ParamRefMutator, TContext extends ActivityContext> {
684
+ readonly middleware: ReadonlyArray<RuntimeMiddleware<TExec, TMutator>>;
685
+ /** The plan the caller sent. */
686
+ readonly plan: QueryPlan;
687
+ readonly context: ActivityContextFields<TContext>;
688
+ /** The open activity the statement runs beneath, such as the transaction it was sent on. */
689
+ readonly parent: ActivityParent | undefined;
690
+ }
691
+ /** One running statement activity, handed to the family's statement body. */
692
+ interface StatementActivityRun<TExec extends ExecutionPlan, TMutator extends ParamRefMutator, TContext extends ActivityContext> {
693
+ readonly activity: StatementActivity;
694
+ readonly ctx: TContext;
695
+ /** Runs every `beforeEncode` hook in registration order, raced against `ctx.signal`. */
696
+ beforeEncode(draft: TExec, params?: TMutator): Promise<void>;
697
+ /** Runs `intercept.onQuery`, then the intercepted rows or `runDriver()` with `onRow` for each driver row. `runDriver` is called only when no handler supplied rows. */
698
+ runQuery<Row>(exec: TExec, runDriver: () => AsyncIterable<Row>): AsyncIterable<Row>;
699
+ /** Runs `intercept.onExecute`, then `runDriver()` when no handler supplied statistics. */
700
+ runExecute(exec: TExec, runDriver: () => Promise<RuntimeStatementStats>): Promise<RuntimeStatementStats>;
701
+ }
702
+ /**
703
+ * Runs one `query()` statement as an activity. The activity starts on the first `next()`: `activityStarted`, then `body`'s rows, then `activityEnded` and, unless a transaction holds it, `activityFinalized`. Each fires exactly once, whether the body succeeds, throws (`failed`) or the caller stops reading (`stopped`). When the parent no longer accepts work, the first `next()` rejects and no hook runs.
704
+ */
705
+ declare function streamStatement<TExec extends ExecutionPlan, TMutator extends ParamRefMutator, TContext extends ActivityContext, Row>(options: StatementOptions<TExec, TMutator, TContext>, body: (statement: StatementActivityRun<TExec, TMutator, TContext>) => AsyncIterable<Row>): AsyncIterable<Row>;
706
+ /**
707
+ * Runs one `execute()` statement as an activity: `activityStarted`, then `body`, then `activityEnded` and, unless a transaction holds it, `activityFinalized`, each exactly once. When the parent no longer accepts work, it rejects and no hook runs.
708
+ */
709
+ declare function executeStatement<TExec extends ExecutionPlan, TMutator extends ParamRefMutator, TContext extends ActivityContext>(options: StatementOptions<TExec, TMutator, TContext>, body: (statement: StatementActivityRun<TExec, TMutator, TContext>) => Promise<RuntimeStatementStats>): Promise<RuntimeStatementStats>;
710
+ //#endregion
711
+ //#region src/execution/runtime-core.d.ts
712
+ /**
713
+ * Constructor options shared by every concrete `RuntimeCore` subclass. `ctx` holds the context fields every statement's activity context starts from.
714
+ */
715
+ interface RuntimeCoreOptions<TMiddleware extends RuntimeMiddleware<ExecutionPlan>> {
716
+ readonly middleware: ReadonlyArray<TMiddleware>;
717
+ readonly ctx: ActivityContextFields;
718
+ }
719
+ /**
720
+ * Family-agnostic abstract runtime base. Each `query()` and `execute()` call is one statement activity, run in this order: `activityStarted`, `runBeforeCompile`, `lower`, `beforeEncode`, `intercept`, the driver with `onRow`, `activityEnded`, then `activityFinalized`. It has no parent, so it is finalized right after it ends.
721
+ *
722
+ * Concrete subclasses implement `lower`, `runDriver`, `runExecute` and `close`.
723
+ */
724
+ declare abstract class RuntimeCore<TPlan extends QueryPlan, TExec extends ExecutionPlan, TMiddleware extends RuntimeMiddleware<TExec>> implements RuntimeExecutor<TPlan> {
725
+ protected readonly middleware: ReadonlyArray<TMiddleware>;
726
+ protected readonly ctx: ActivityContextFields;
727
+ constructor(options: RuntimeCoreOptions<TMiddleware>);
728
+ /** Pre-lowering hook for plan rewriting. Defaults to identity. */
729
+ protected runBeforeCompile(plan: TPlan): TPlan | Promise<TPlan>;
730
+ /** Lowers a `TPlan` into the family's executable `TExec`, forwarding `ctx` to the encode-side codecs. */
731
+ protected abstract lower(plan: TPlan, ctx: CodecCallContext): TExec | Promise<TExec>;
732
+ /** Drives the transport for a lowered `TExec`, yielding raw rows. */
733
+ protected abstract runDriver(exec: TExec): AsyncIterable<Record<string, unknown>>;
734
+ protected abstract runExecute(exec: TExec): Promise<RuntimeStatementStats>;
735
+ abstract close(): Promise<void>;
736
+ query<Row>(plan: TPlan & {
737
+ readonly _row?: Row;
738
+ }, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
739
+ execute(plan: TPlan, options?: RuntimeExecuteOptions): Promise<RuntimeStatementStats>;
740
+ private contextFieldsFor;
741
+ }
742
+ //#endregion
743
+ //#region src/execution/shape.d.ts
744
+ /**
745
+ * Phantom key an emitted model type carries to name its relation properties.
746
+ * Never present at runtime; `Scalars` and `Shape` read it to tell relations from fields.
747
+ */
748
+ declare const RelationKeys: unique symbol;
749
+ /**
750
+ * The relation names an emitted model type declares.
751
+ */
752
+ type RelationNamesOf<M> = Rel<M>;
753
+ /**
754
+ * Without `exactOptionalPropertyTypes` the optional phantom infers `R | undefined`, so the
755
+ * inferred type is filtered rather than constrained: `infer R extends string` would fall back to
756
+ * `string` there.
757
+ */
758
+ type Rel<M> = M extends {
759
+ readonly [RelationKeys]?: infer R;
760
+ } ? Extract<R, string> : never;
761
+ /**
762
+ * The scalar row of a model: every field, no relations, no phantom.
763
+ * Distributes over a union, so the row of a polymorphic `Any<Base>` is the union of its variants' rows.
764
+ */
765
+ type Scalars<M> = M extends {
766
+ readonly [RelationKeys]?: unknown;
767
+ } ? Omit<M, Rel<M> | typeof RelationKeys> : M;
768
+ /**
769
+ * An application data structure derived from a model.
770
+ *
771
+ * At every level of `Spec`: `'+'` names scalars and relations to keep, and narrows the scalars only
772
+ * when it names one; `'-'` names scalars to drop; any other key is a relation whose value is a spec
773
+ * that narrows the related model. A relation named in `'+'` comes with all of its scalars and none of
774
+ * its relations. Relations are absent unless asked for; cardinality and nullability come from the
775
+ * model. Distributes over a union, so each variant of `Any<Base>` keeps only its own relations.
776
+ */
777
+ type Shape<M, Spec extends ShapeSpec<M, Spec> = Record<never, never>> = ShapeOf<M, Spec>;
778
+ /**
779
+ * The constraint a `Shape` spec satisfies. A generic that forwards a spec needs it:
780
+ * `type Response<S extends ShapeSpec<User, S>> = Shape<User, S>`.
781
+ */
782
+ type ShapeSpec<M, Spec> = { readonly [K in keyof Spec]: K extends '+' ? Exclude<PlusNames<M, Spec>, keyof Spec> : K extends '-' ? ScalarNamesOf<M> : K extends RelationNamesOf<M> ? ShapeSpec<RelatedModel<M, K>, Spec[K]> : UnknownSpecKey<M, K>; };
783
+ type PlusNames<M, Spec> = '-' extends keyof Spec ? RelationNamesOf<M> : ScalarNamesOf<M> | RelationNamesOf<M>;
784
+ type UnknownSpecKey<M, K> = [RelationNamesOf<M>] extends [never] ? `'${K & string}' is not a relation of the model, which has none; try '+' or '-'` : `'${K & string}' is not a relation of the model; try '+', '-', or '${RelationNamesOf<M>}'`;
785
+ type ScalarNamesOf<M> = M extends unknown ? keyof Scalars<M> & string : never;
786
+ type RelatedModel<M, K> = M extends unknown ? K extends keyof M ? UnwrapRelation<M[K]> : never : never;
787
+ type UnwrapRelation<V> = V extends (infer Item)[] ? Item : NonNullable<V>;
788
+ type ShapeOf<M, Spec> = ShapeOfEach<M, Spec, PlusNamesAScalar<M, Spec>>;
789
+ type PlusNamesAScalar<M, Spec> = Spec extends {
790
+ readonly '+': infer Keep;
791
+ } ? [Extract<Keep, ScalarNamesOf<M>>] extends [never] ? false : true : false;
792
+ type ShapeOfEach<M, Spec, Narrow extends boolean> = M extends unknown ? Flatten<KeptScalars<M, Spec, Narrow> & { [K in IncludedRelations<M, Spec>]: WrapLike<M[K], ShapeOf<RelatedModel<M, K>, NestedSpec<Spec, K>>>; }> : never;
793
+ type KeptScalars<M, Spec, Narrow extends boolean> = Narrow extends true ? Spec extends {
794
+ readonly '+': infer Keep;
795
+ } ? Pick<Scalars<M>, Extract<Keep, keyof Scalars<M>>> : never : Spec extends {
796
+ readonly '-': infer Drop extends PropertyKey;
797
+ } ? Omit<Scalars<M>, Drop> : Scalars<M>;
798
+ type IncludedRelations<M, Spec> = Extract<keyof Spec | (Spec extends {
799
+ readonly '+': infer Keep;
800
+ } ? Keep : never), RelationNamesOf<M> & keyof M>;
801
+ type NestedSpec<Spec, K> = K extends keyof Spec ? Spec[K] : Record<never, never>;
802
+ type WrapLike<V, R> = V extends unknown[] ? R[] : null extends V ? R | null : R;
803
+ type Flatten<T> = { [K in keyof T]: T[K]; };
804
+ //#endregion
805
+ //#region src/execution/transaction-activity.d.ts
806
+ /** How a transaction's `commit()` or `rollback()` settled. */
807
+ type TransactionSettlement = {
808
+ readonly by: 'commit';
809
+ readonly outcome: 'succeeded' | 'failed';
810
+ } | {
811
+ readonly by: 'rollback';
812
+ readonly outcome: 'succeeded' | 'failed';
813
+ /** Whether `commit()` was called before this rollback. */
814
+ readonly commitAttempted: boolean;
815
+ };
816
+ /** An open transaction activity. Pass it as the `parent` of every statement sent while the transaction is open. */
817
+ interface TransactionActivityRun<TContext extends ActivityContext = ActivityContext> extends ActivityParent {
818
+ readonly activity: TransactionActivity;
819
+ readonly ctx: TContext;
820
+ /** Stops accepting children: new work beneath the transaction, and beneath the client activities inside it, is refused from now on. `end` does this too. */
821
+ stopAcceptingChildren(): void;
822
+ /**
823
+ * Ends the transaction: its `activityEnded` hooks, then the `activityFinalized` hooks of the activities beneath it that have ended, in post-order (each activity's children in the order they started, depth first, then the activity), then its own. Resolves after those hooks have run. An activity still open is finalized when it ends, with this transaction's outcome; `end` does not wait for it. A second call does nothing. An `activityEnded` error after a successful settlement is rethrown once finalization has run.
824
+ */
825
+ end(settlement: TransactionSettlement): Promise<void>;
826
+ }
827
+ interface TransactionActivityOptions<TContext extends ActivityContext> {
828
+ readonly middleware: ReadonlyArray<ActivityObserver>;
829
+ readonly context: ActivityContextFields<TContext>;
830
+ /** The open activity the transaction starts beneath, such as a client activity. */
831
+ readonly parent: ActivityParent | undefined;
832
+ /** Whether the transaction keeps its finished children to finalize them when it ends. A runtime decides this once, when it is created: only when a middleware implements `activityFinalized`. Without it, the transaction keeps nothing but whether a statement beneath it failed. */
833
+ readonly holdFinishedChildren: boolean;
834
+ }
835
+ /**
836
+ * Starts a transaction activity and runs its `activityStarted` hooks. When one of them throws, the transaction ends `failed`, is finalized `rolled-back`, and the error is rethrown. Rejects at once, running no hook, when `parent` no longer accepts children.
837
+ */
838
+ declare function startTransactionActivity<TContext extends ActivityContext>(options: TransactionActivityOptions<TContext>): Promise<TransactionActivityRun<TContext>>;
839
+ //#endregion
840
+ //#region src/meta-builder.d.ts
841
+ /**
842
+ * Per-terminal meta configurator handed to user callbacks. The terminal's
843
+ * operation kind `K` is fixed by the terminal that constructed the builder;
844
+ * `annotate(...)` accepts only annotations whose declared `Kinds` include
845
+ * `K`.
846
+ *
847
+ * The conditional parameter type
848
+ * `K extends Kinds ? AnnotationValue<P, Kinds> : never` collapses to `never`
849
+ * for inapplicable annotations, surfacing the mismatch as a type error at
850
+ * the call site of `meta.annotate(...)`. No variadic-tuple inference is
851
+ * involved — TypeScript infers `Kinds` from the annotation argument and
852
+ * checks the conditional directly.
853
+ *
854
+ * The runtime gate inside `annotate` (via
855
+ * `assertAnnotationsApplicable`) catches cast / `any` / dynamic bypasses
856
+ * and throws `RUNTIME.ANNOTATION_INAPPLICABLE`.
857
+ *
858
+ * `annotate` returns the builder for chaining; the return value of the
859
+ * configurator callback is unused, so both block-body and expression-body
860
+ * callbacks compile.
861
+ *
862
+ * @example
863
+ * ```typescript
864
+ * await db.User.find({ id }, (meta) => meta.annotate(cacheAnnotation({ ttl: 60 })));
865
+ * await db.User.create(input, (meta) => {
866
+ * meta.annotate(auditAnnotation({ actor: 'system' }));
867
+ * meta.annotate(otelAnnotation({ traceId }));
868
+ * });
869
+ * ```
870
+ */
871
+ interface MetaBuilder<K extends OperationKind> {
872
+ annotate<P, Kinds extends OperationKind>(annotation: K extends Kinds ? AnnotationValue<P, Kinds> : never): this;
873
+ }
874
+ /**
875
+ * Lane-side view of a meta builder. Extends the public `MetaBuilder<K>`
876
+ * surface with `annotations` so lane terminals can read the recorded map
877
+ * after invoking the user configurator.
878
+ *
879
+ * Lane terminals construct one of these via `createMetaBuilder(kind, terminalName)`,
880
+ * pass it to the user callback as `MetaBuilder<K>` (the narrower public
881
+ * view), then read `meta.annotations` to thread the recorded values into
882
+ * `plan.meta.annotations`.
883
+ */
884
+ interface LaneMetaBuilder<K extends OperationKind> extends MetaBuilder<K> {
885
+ readonly annotations: ReadonlyMap<string, AnnotationValue<unknown, OperationKind>>;
886
+ }
887
+ /**
888
+ * Construct a lane-side meta builder for a terminal of operation kind `K`.
889
+ *
890
+ * Lane terminals call this with their `kind` (`'read'` or `'write'`) and a
891
+ * `terminalName` for error messages, hand the resulting builder to the
892
+ * user-supplied configurator callback (typed as `MetaBuilder<K>`, the
893
+ * narrower public view), and read `meta.annotations` afterwards to thread
894
+ * the recorded values into `plan.meta.annotations`.
895
+ */
896
+ declare function createMetaBuilder<K extends OperationKind>(kind: K, terminalName: string): LaneMetaBuilder<K>;
897
+ //#endregion
898
+ export { RuntimeStatementStats as $, GeneratorStability as A, QueryPlan as B, ClientActivityRegistry as C, defineAnnotation as Ct, DefineAnnotationOptions as D, startClientActivity as Dt, CrossFamilyMiddleware as E, runtimeAborted as Et, MutationDefaultsOp as F, RuntimeAbortedPhase as G, RelationKeys as H, MutationDefaultsOptions as I, RuntimeExecuteOptions as J, RuntimeCore as K, OperationKind as L, MetaBuilder as M, MutationDefaultGeneratorContributor as N, ExecuteInterceptResult as O, startTransactionActivity as Ot, MutationDefaults as P, RuntimeMutationDefaultGenerator as Q, ParamRefMutator as R, ClientActivityOptions as S, createStateStore as St, ClientActivityRun as T, raceAgainstAbort as Tt, RelationNamesOf as U, RUNTIME_ABORTED as V, ResultType as W, RuntimeLog as X, RuntimeExecutor as Y, RuntimeMiddleware as Z, AsyncIterableResult as _, checkAborted as _t, ActivityContext as a, StatementActivityRun as at, ClientActivityEnded as b, createContextBeneath as bt, ActivityFinalizedResult as c, TransactionActivity as ct, ActivityParent as d, TransactionEnded as dt, Scalars as et, ActivityStateStore as f, TransactionSettlement as ft, AppliedMutationDefault as g, assertMutationDefaultGeneratorsAvailable as gt, AnnotationValue as h, assertAnnotationsApplicable as ht, ActivityChildSlot as i, StatementActivity as it, LaneMetaBuilder as j, ExecutionPlan as k, streamStatement as kt, ActivityInterceptResult as l, TransactionActivityOptions as lt, AnnotationSource as m, applyMutationDefaults as mt, ActivityBase as n, ShapeSpec as nt, ActivityContextFields as o, StatementEnded as ot, AnnotationHandle as p, ValidAnnotations as pt, RuntimeCoreOptions as q, ActivityChild as r, StartActivity as rt, ActivityEndedResult as s, StatementOptions as st, Activity as t, Shape as tt, ActivityObserver as u, TransactionActivityRun as ut, ClientActivity as v, checkMiddlewareCompatibility as vt, ClientActivityResult as w, executeStatement as wt, ClientActivityKind as x, createMetaBuilder as xt, ClientActivityEnd as y, collectMutationDefaultGenerators as yt, QueryInterceptResult as z };
899
+ //# sourceMappingURL=runtime-B-YYuWy2.d.mts.map