@logixjs/core 0.0.1 → 1.0.0

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 (398) hide show
  1. package/LICENSE +201 -0
  2. package/dist/{Action-mqVvtEHt.d.ts → Action-DYl88bwj.d.ts} +1 -1
  3. package/dist/{Action-BkRHy2vg.d.cts → Action-DkxsI_DK.d.cts} +1 -1
  4. package/dist/Action.cjs.map +1 -1
  5. package/dist/Action.d.cts +1 -1
  6. package/dist/Action.d.ts +1 -1
  7. package/dist/Action.js +2 -2
  8. package/dist/{Actions-AsQ07yTP.d.cts → Actions-Dicm7jdc.d.cts} +2 -2
  9. package/dist/{Actions-AsQ07yTP.d.ts → Actions-Dicm7jdc.d.ts} +2 -2
  10. package/dist/Actions.cjs.map +1 -1
  11. package/dist/Actions.d.cts +1 -1
  12. package/dist/Actions.d.ts +1 -1
  13. package/dist/Actions.js +1 -1
  14. package/dist/{Bound-BN1DQ_lM.d.ts → Bound-1OJLzVIS.d.ts} +2 -2
  15. package/dist/{Bound-BPIfH9SS.d.cts → Bound-BMLrtQ1V.d.cts} +2 -2
  16. package/dist/Bound.cjs +1737 -399
  17. package/dist/Bound.cjs.map +1 -1
  18. package/dist/Bound.d.cts +5 -5
  19. package/dist/Bound.d.ts +5 -5
  20. package/dist/Bound.js +19 -17
  21. package/dist/{Debug-B5q5Bkzx.d.ts → Debug-DKrWP5H1.d.ts} +40 -22
  22. package/dist/{Debug-Bq8Sqjcr.d.cts → Debug-hIT44XsY.d.cts} +40 -22
  23. package/dist/Debug.cjs +1348 -318
  24. package/dist/Debug.cjs.map +1 -1
  25. package/dist/Debug.d.cts +12 -11
  26. package/dist/Debug.d.ts +12 -11
  27. package/dist/Debug.js +20 -11
  28. package/dist/EffectOp.cjs +15 -6
  29. package/dist/EffectOp.cjs.map +1 -1
  30. package/dist/EffectOp.js +3 -3
  31. package/dist/Env.cjs +772 -6
  32. package/dist/Env.cjs.map +1 -1
  33. package/dist/Env.js +5 -2
  34. package/dist/ExternalStore-DqJKKRJ4.d.ts +61 -0
  35. package/dist/ExternalStore-JC-gAgEI.d.cts +61 -0
  36. package/dist/ExternalStore.cjs +774 -0
  37. package/dist/ExternalStore.cjs.map +1 -0
  38. package/dist/ExternalStore.d.cts +8 -0
  39. package/dist/ExternalStore.d.ts +8 -0
  40. package/dist/ExternalStore.js +19 -0
  41. package/dist/ExternalStore.js.map +1 -0
  42. package/dist/{Flow-BhpjE22E.d.ts → Flow-CZmXRDqp.d.cts} +13 -4
  43. package/dist/{Flow-1fZT8MpX.d.cts → Flow-DIVDxz7R.d.ts} +13 -4
  44. package/dist/Flow.cjs +765 -148
  45. package/dist/Flow.cjs.map +1 -1
  46. package/dist/Flow.d.cts +6 -6
  47. package/dist/Flow.d.ts +6 -6
  48. package/dist/Flow.js +9 -8
  49. package/dist/{Handle-D_cLW1Z3.d.ts → Handle-Bo6cAFut.d.ts} +1 -1
  50. package/dist/{Handle-D8D1zPb_.d.cts → Handle-CfDvSqN7.d.cts} +1 -1
  51. package/dist/Handle.d.cts +5 -5
  52. package/dist/Handle.d.ts +5 -5
  53. package/dist/{Kernel-8kC-jOda.d.cts → Kernel-CuXBF9S_.d.cts} +16 -7
  54. package/dist/{Kernel-CnGE1Fyk.d.ts → Kernel-D9guNwRL.d.ts} +16 -7
  55. package/dist/Kernel.cjs +814 -26
  56. package/dist/Kernel.cjs.map +1 -1
  57. package/dist/Kernel.d.cts +13 -12
  58. package/dist/Kernel.d.ts +13 -12
  59. package/dist/Kernel.js +7 -4
  60. package/dist/{Link-Db7975nU.d.ts → Link-CUM0yUCH.d.ts} +10 -3
  61. package/dist/{Link-fX8x1eCK.d.cts → Link-NAfR6uGD.d.cts} +10 -3
  62. package/dist/Link.cjs +1294 -121
  63. package/dist/Link.cjs.map +1 -1
  64. package/dist/Link.d.cts +5 -5
  65. package/dist/Link.d.ts +5 -5
  66. package/dist/Link.js +37 -29
  67. package/dist/{Logic-DRh4sDZj.d.cts → Logic-09VQpIj3.d.cts} +7 -4
  68. package/dist/{Logic-BRjEMr-W.d.ts → Logic-DKg7ghGy.d.ts} +7 -4
  69. package/dist/Logic.cjs +2 -1
  70. package/dist/Logic.cjs.map +1 -1
  71. package/dist/Logic.d.cts +5 -5
  72. package/dist/Logic.d.ts +5 -5
  73. package/dist/Logic.js +1 -1
  74. package/dist/{MatchBuilder-CJk5oCkR.d.cts → MatchBuilder-CsW5jgrL.d.ts} +1 -1
  75. package/dist/{MatchBuilder-0QOc-nlU.d.ts → MatchBuilder-Dksk07F4.d.cts} +1 -1
  76. package/dist/MatchBuilder.cjs +2 -2
  77. package/dist/MatchBuilder.cjs.map +1 -1
  78. package/dist/MatchBuilder.d.cts +6 -6
  79. package/dist/MatchBuilder.d.ts +6 -6
  80. package/dist/MatchBuilder.js +2 -2
  81. package/dist/Middleware-D8tUDLv_.d.cts +100 -0
  82. package/dist/Middleware-DS7CbTTN.d.ts +100 -0
  83. package/dist/Middleware.cjs +678 -58
  84. package/dist/Middleware.cjs.map +1 -1
  85. package/dist/Middleware.d.cts +2 -86
  86. package/dist/Middleware.d.ts +2 -86
  87. package/dist/Middleware.js +15 -12
  88. package/dist/{Module-DnzluX2J.d.ts → Module-B_Cntyms.d.ts} +54 -25
  89. package/dist/{Module-B_0xRDMR.d.cts → Module-CmNOVXzf.d.cts} +54 -25
  90. package/dist/Module.cjs +9331 -3317
  91. package/dist/Module.cjs.map +1 -1
  92. package/dist/Module.d.cts +7 -6
  93. package/dist/Module.d.ts +7 -6
  94. package/dist/Module.js +39 -31
  95. package/dist/ModuleTag-CGho_InD.d.ts +113 -0
  96. package/dist/ModuleTag-CITb8L_G.d.cts +113 -0
  97. package/dist/ModuleTag.cjs +7248 -2847
  98. package/dist/ModuleTag.cjs.map +1 -1
  99. package/dist/ModuleTag.d.cts +6 -6
  100. package/dist/ModuleTag.d.ts +6 -6
  101. package/dist/ModuleTag.js +35 -29
  102. package/dist/Observability-Bdhnx2Dv.d.ts +385 -0
  103. package/dist/Observability-DXGAFBIT.d.cts +385 -0
  104. package/dist/Observability.cjs +5093 -1556
  105. package/dist/Observability.cjs.map +1 -1
  106. package/dist/Observability.d.cts +6 -7
  107. package/dist/Observability.d.ts +6 -7
  108. package/dist/Observability.js +28 -23
  109. package/dist/{Platform-CHX8o-U4.d.ts → Platform-B4s8tg6C.d.cts} +4 -5
  110. package/dist/{Platform-C49Pv956.d.cts → Platform-BV_0MW7g.d.cts} +5 -2
  111. package/dist/{Platform-C49Pv956.d.ts → Platform-BV_0MW7g.d.ts} +5 -2
  112. package/dist/{Platform-CVlv0xLQ.d.cts → Platform-W0Mefy_e.d.ts} +4 -5
  113. package/dist/Platform.cjs +2 -1
  114. package/dist/Platform.cjs.map +1 -1
  115. package/dist/Platform.d.cts +2 -3
  116. package/dist/Platform.d.ts +2 -3
  117. package/dist/Platform.js +2 -2
  118. package/dist/{Process-CM9xbMdP.d.ts → Process-CO8G7HO9.d.cts} +30 -5
  119. package/dist/{Process-mL8fHDSB.d.cts → Process-Cyf6VNDR.d.ts} +30 -5
  120. package/dist/Process.cjs +1288 -120
  121. package/dist/Process.cjs.map +1 -1
  122. package/dist/Process.d.cts +6 -6
  123. package/dist/Process.d.ts +6 -6
  124. package/dist/Process.js +34 -26
  125. package/dist/ReadQuery-C_or5nLC.d.ts +128 -0
  126. package/dist/ReadQuery-DXLzCE0E.d.cts +614 -0
  127. package/dist/ReadQuery-DXLzCE0E.d.ts +614 -0
  128. package/dist/ReadQuery-Yve1lmUo.d.cts +128 -0
  129. package/dist/ReadQuery.cjs +290 -5
  130. package/dist/ReadQuery.cjs.map +1 -1
  131. package/dist/ReadQuery.d.cts +3 -2
  132. package/dist/ReadQuery.d.ts +3 -2
  133. package/dist/ReadQuery.js +23 -5
  134. package/dist/{Reflection-CQnKwPXj.d.ts → Reflection-B2Xi1e4Q.d.ts} +89 -7
  135. package/dist/{Reflection-Kabo1mlU.d.cts → Reflection-DNB4V4_e.d.cts} +89 -7
  136. package/dist/Reflection.cjs +3227 -1617
  137. package/dist/Reflection.cjs.map +1 -1
  138. package/dist/Reflection.d.cts +17 -15
  139. package/dist/Reflection.d.ts +17 -15
  140. package/dist/Reflection.js +33 -25
  141. package/dist/{Resource-Dy1xD_DG.d.cts → Resource-pKvQQ4x5.d.cts} +3 -3
  142. package/dist/{Resource-Dy1xD_DG.d.ts → Resource-pKvQQ4x5.d.ts} +3 -3
  143. package/dist/Resource.cjs +781 -15
  144. package/dist/Resource.cjs.map +1 -1
  145. package/dist/Resource.d.cts +1 -1
  146. package/dist/Resource.d.ts +1 -1
  147. package/dist/Resource.js +6 -3
  148. package/dist/{Root-7ADUMk4t.d.cts → Root-CCVuFHB6.d.cts} +3 -3
  149. package/dist/{Root-7ADUMk4t.d.ts → Root-CCVuFHB6.d.ts} +3 -3
  150. package/dist/Root.cjs +786 -20
  151. package/dist/Root.cjs.map +1 -1
  152. package/dist/Root.d.cts +2 -2
  153. package/dist/Root.d.ts +2 -2
  154. package/dist/Root.js +7 -3
  155. package/dist/{Runtime-CtyzZG4i.d.ts → Runtime-CRmvwK4I.d.ts} +70 -14
  156. package/dist/{Runtime-B-aL-f29.d.cts → Runtime-C_wJM9mN.d.cts} +70 -14
  157. package/dist/Runtime.cjs +4942 -1601
  158. package/dist/Runtime.cjs.map +1 -1
  159. package/dist/Runtime.d.cts +17 -15
  160. package/dist/Runtime.d.ts +17 -15
  161. package/dist/Runtime.js +44 -32
  162. package/dist/{ScopeRegistry-D1owDNSm.d.cts → ScopeRegistry-BhYzqWri.d.cts} +6 -6
  163. package/dist/{ScopeRegistry-D1owDNSm.d.ts → ScopeRegistry-BhYzqWri.d.ts} +6 -6
  164. package/dist/ScopeRegistry.cjs +776 -10
  165. package/dist/ScopeRegistry.cjs.map +1 -1
  166. package/dist/ScopeRegistry.d.cts +1 -1
  167. package/dist/ScopeRegistry.d.ts +1 -1
  168. package/dist/ScopeRegistry.js +6 -3
  169. package/dist/{State-CU50R26M.d.cts → State-rNFsFPTl.d.cts} +2 -2
  170. package/dist/{State-CU50R26M.d.ts → State-rNFsFPTl.d.ts} +2 -2
  171. package/dist/State.cjs.map +1 -1
  172. package/dist/State.d.cts +1 -1
  173. package/dist/State.d.ts +1 -1
  174. package/dist/State.js +1 -1
  175. package/dist/{StateTrait-BGsZghTz.d.ts → StateTrait-CijdwNb6.d.ts} +25 -8
  176. package/dist/{StateTrait-OWhbj12c.d.cts → StateTrait-Dltto6PU.d.cts} +25 -8
  177. package/dist/StateTrait.cjs +1890 -528
  178. package/dist/StateTrait.cjs.map +1 -1
  179. package/dist/StateTrait.d.cts +9 -7
  180. package/dist/StateTrait.d.ts +9 -7
  181. package/dist/StateTrait.js +18 -14
  182. package/dist/{TraitLifecycle-CwV5WPFX.d.cts → TraitLifecycle-BKzDqzLu.d.cts} +2 -2
  183. package/dist/{TraitLifecycle-LdIWmKlg.d.ts → TraitLifecycle-Cvo94uDB.d.ts} +2 -2
  184. package/dist/TraitLifecycle.cjs +630 -67
  185. package/dist/TraitLifecycle.cjs.map +1 -1
  186. package/dist/TraitLifecycle.d.cts +6 -6
  187. package/dist/TraitLifecycle.d.ts +6 -6
  188. package/dist/TraitLifecycle.js +8 -7
  189. package/dist/Workflow-C_OWr4dV.d.ts +415 -0
  190. package/dist/Workflow-DmydkHO8.d.cts +415 -0
  191. package/dist/Workflow.cjs +3150 -0
  192. package/dist/Workflow.cjs.map +1 -0
  193. package/dist/Workflow.d.cts +7 -0
  194. package/dist/Workflow.d.ts +7 -0
  195. package/dist/Workflow.js +58 -0
  196. package/dist/Workflow.js.map +1 -0
  197. package/dist/{action-DiMDD_0v.d.cts → action-BQxjPFEw.d.cts} +5 -5
  198. package/dist/{action-DiMDD_0v.d.ts → action-BQxjPFEw.d.ts} +5 -5
  199. package/dist/chunk-2XRLXDWR.js +276 -0
  200. package/dist/chunk-2XRLXDWR.js.map +1 -0
  201. package/dist/chunk-3L6QGFMM.js +701 -0
  202. package/dist/chunk-3L6QGFMM.js.map +1 -0
  203. package/dist/{chunk-GMPEOUP2.js → chunk-4MZ7BT3R.js} +2 -2
  204. package/dist/chunk-4MZ7BT3R.js.map +1 -0
  205. package/dist/{chunk-3IYZ5IGG.js → chunk-5WKUGEBY.js} +2 -2
  206. package/dist/{chunk-3RMKLXHX.js → chunk-63ZQ5RIN.js} +2 -2
  207. package/dist/{chunk-M3WTHJHJ.js → chunk-67DIEA53.js} +385 -148
  208. package/dist/chunk-67DIEA53.js.map +1 -0
  209. package/dist/{chunk-YS3AZQ2G.js → chunk-6HFAW2MH.js} +1 -1
  210. package/dist/chunk-6HFAW2MH.js.map +1 -0
  211. package/dist/{chunk-EY4NZKDR.js → chunk-6Y2TKCNY.js} +2 -2
  212. package/dist/{chunk-76WT3HOR.js → chunk-6YZOXFPQ.js} +25 -24
  213. package/dist/chunk-6YZOXFPQ.js.map +1 -0
  214. package/dist/{chunk-G5ZBFPNU.js → chunk-A2RQOJC7.js} +2 -2
  215. package/dist/{chunk-AUIR5O6W.js → chunk-AFSB6NKM.js} +13 -19
  216. package/dist/chunk-AFSB6NKM.js.map +1 -0
  217. package/dist/{chunk-JCXGZRMU.js → chunk-AO4JEOKD.js} +22 -23
  218. package/dist/chunk-AO4JEOKD.js.map +1 -0
  219. package/dist/{chunk-TAAPQVZN.js → chunk-AYELIQXR.js} +2 -2
  220. package/dist/{chunk-QMM6O4CD.js → chunk-BLHZW7DG.js} +15 -3
  221. package/dist/{chunk-QMM6O4CD.js.map → chunk-BLHZW7DG.js.map} +1 -1
  222. package/dist/{chunk-TQOBJYDP.js → chunk-CD4N74YC.js} +1 -1
  223. package/dist/chunk-CD4N74YC.js.map +1 -0
  224. package/dist/{chunk-ANLBCBDC.js → chunk-CGE2HBTH.js} +11 -11
  225. package/dist/chunk-CGE2HBTH.js.map +1 -0
  226. package/dist/{chunk-OFADUJWJ.js → chunk-CYYSQMLO.js} +5 -5
  227. package/dist/chunk-CYYSQMLO.js.map +1 -0
  228. package/dist/{chunk-66ALHVEX.js → chunk-EB46EYI7.js} +3 -3
  229. package/dist/{chunk-NZJKFF45.js → chunk-EKCDHWRK.js} +4 -4
  230. package/dist/chunk-EKCDHWRK.js.map +1 -0
  231. package/dist/{chunk-BABLDP24.js → chunk-EPQFNJU3.js} +152 -7
  232. package/dist/chunk-EPQFNJU3.js.map +1 -0
  233. package/dist/{chunk-OGWBVHB3.js → chunk-ESR6HGOY.js} +73 -14
  234. package/dist/chunk-ESR6HGOY.js.map +1 -0
  235. package/dist/{chunk-NBD3KUOZ.js → chunk-F6RP62H3.js} +150 -98
  236. package/dist/chunk-F6RP62H3.js.map +1 -0
  237. package/dist/chunk-FBYW3QDI.js +252 -0
  238. package/dist/chunk-FBYW3QDI.js.map +1 -0
  239. package/dist/{chunk-IPF7E66P.js → chunk-FYAODKVP.js} +2 -2
  240. package/dist/chunk-GNEN7NKO.js +908 -0
  241. package/dist/chunk-GNEN7NKO.js.map +1 -0
  242. package/dist/chunk-GWSM4KLB.js +763 -0
  243. package/dist/chunk-GWSM4KLB.js.map +1 -0
  244. package/dist/{chunk-4SO6JMZL.js → chunk-HDMXCUZL.js} +1 -1
  245. package/dist/chunk-HDMXCUZL.js.map +1 -0
  246. package/dist/{chunk-ZFY7U2FR.js → chunk-HJM5Y5NU.js} +43 -3
  247. package/dist/chunk-HJM5Y5NU.js.map +1 -0
  248. package/dist/{chunk-ZGDVUPTM.js → chunk-IOZ3VKPK.js} +129 -68
  249. package/dist/chunk-IOZ3VKPK.js.map +1 -0
  250. package/dist/{chunk-PYOE4VSI.js → chunk-IVXSVHO4.js} +303 -247
  251. package/dist/chunk-IVXSVHO4.js.map +1 -0
  252. package/dist/chunk-J3CWXIPV.js +242 -0
  253. package/dist/chunk-J3CWXIPV.js.map +1 -0
  254. package/dist/chunk-K6JQW266.js +42 -0
  255. package/dist/chunk-K6JQW266.js.map +1 -0
  256. package/dist/chunk-KMZYQF6Q.js +202 -0
  257. package/dist/chunk-KMZYQF6Q.js.map +1 -0
  258. package/dist/{chunk-JWOYLO27.js → chunk-LPPZDFTD.js} +22 -12
  259. package/dist/chunk-LPPZDFTD.js.map +1 -0
  260. package/dist/{chunk-PAYXCY6A.js → chunk-MYB2B5WX.js} +997 -576
  261. package/dist/chunk-MYB2B5WX.js.map +1 -0
  262. package/dist/chunk-MYKNINNN.js +228 -0
  263. package/dist/chunk-MYKNINNN.js.map +1 -0
  264. package/dist/chunk-NSQIRMVF.js +27 -0
  265. package/dist/{chunk-QCHIQWAJ.js.map → chunk-NSQIRMVF.js.map} +1 -1
  266. package/dist/chunk-NUDBM4MM.js +30 -0
  267. package/dist/chunk-NUDBM4MM.js.map +1 -0
  268. package/dist/chunk-NZMWWDAY.js +23 -0
  269. package/dist/chunk-NZMWWDAY.js.map +1 -0
  270. package/dist/{chunk-RNFE3ML2.js → chunk-OCUV2Y25.js} +4 -3
  271. package/dist/chunk-OCUV2Y25.js.map +1 -0
  272. package/dist/chunk-P4ZJOQA7.js +271 -0
  273. package/dist/chunk-P4ZJOQA7.js.map +1 -0
  274. package/dist/chunk-P6C5EZ3D.js +342 -0
  275. package/dist/chunk-P6C5EZ3D.js.map +1 -0
  276. package/dist/{chunk-CW6T36TN.js → chunk-PBD7BJUN.js} +62 -4
  277. package/dist/chunk-PBD7BJUN.js.map +1 -0
  278. package/dist/chunk-PBIUCQY3.js +696 -0
  279. package/dist/chunk-PBIUCQY3.js.map +1 -0
  280. package/dist/chunk-PD6YECQH.js +845 -0
  281. package/dist/chunk-PD6YECQH.js.map +1 -0
  282. package/dist/{chunk-M7IYCTJV.js → chunk-R4LFQGP3.js} +2 -2
  283. package/dist/chunk-RHJIGDUE.js +21 -0
  284. package/dist/chunk-RHJIGDUE.js.map +1 -0
  285. package/dist/{chunk-KP7MUZNX.js → chunk-RLXO27MW.js} +30 -8
  286. package/dist/chunk-RLXO27MW.js.map +1 -0
  287. package/dist/{chunk-DFNM3WX2.js → chunk-S44BEV4B.js} +168 -45
  288. package/dist/chunk-S44BEV4B.js.map +1 -0
  289. package/dist/chunk-S4S5N4BJ.js +1461 -0
  290. package/dist/chunk-S4S5N4BJ.js.map +1 -0
  291. package/dist/{chunk-BZ2SHDN2.js → chunk-SGTRAXXX.js} +3 -3
  292. package/dist/chunk-SGTRAXXX.js.map +1 -0
  293. package/dist/{chunk-M2RGJPXX.js → chunk-SJAE5PB5.js} +3 -3
  294. package/dist/{chunk-JGIWG6SR.js → chunk-SNPNHU3H.js} +3937 -1776
  295. package/dist/chunk-SNPNHU3H.js.map +1 -0
  296. package/dist/{chunk-IHVBV5C2.js → chunk-SOOBFXRR.js} +94 -71
  297. package/dist/chunk-SOOBFXRR.js.map +1 -0
  298. package/dist/{chunk-ZDTRWK5F.js → chunk-TAHFWKS6.js} +2 -2
  299. package/dist/chunk-UEFFTVPY.js +9 -0
  300. package/dist/chunk-UEFFTVPY.js.map +1 -0
  301. package/dist/{chunk-24VULZ7A.js → chunk-UR5BXLBP.js} +3 -3
  302. package/dist/chunk-UR5BXLBP.js.map +1 -0
  303. package/dist/{chunk-DMBALCE2.js → chunk-V2SBGVDO.js} +471 -186
  304. package/dist/chunk-V2SBGVDO.js.map +1 -0
  305. package/dist/chunk-VJLWD47W.js +23 -0
  306. package/dist/chunk-VJLWD47W.js.map +1 -0
  307. package/dist/{chunk-4CQAV7YB.js → chunk-W647DX5Z.js} +2 -2
  308. package/dist/{chunk-THATMZXD.js → chunk-WFIIU3YZ.js} +2 -2
  309. package/dist/{chunk-THATMZXD.js.map → chunk-WFIIU3YZ.js.map} +1 -1
  310. package/dist/chunk-YZDJMAKL.js +82 -0
  311. package/dist/chunk-YZDJMAKL.js.map +1 -0
  312. package/dist/{chunk-3TMODYZV.js → chunk-Z5XH6VHY.js} +5 -5
  313. package/dist/chunk-Z5XH6VHY.js.map +1 -0
  314. package/dist/{chunk-BE3HW4FY.js → chunk-ZBBMZMA6.js} +377 -170
  315. package/dist/chunk-ZBBMZMA6.js.map +1 -0
  316. package/dist/index.cjs +21224 -11714
  317. package/dist/index.cjs.map +1 -1
  318. package/dist/index.d.cts +195 -49
  319. package/dist/index.d.ts +195 -49
  320. package/dist/index.js +150 -74
  321. package/dist/index.js.map +1 -1
  322. package/dist/{ir-BMP7yxJJ.d.cts → ir-BSosEwc8.d.cts} +1 -1
  323. package/dist/{ir-DUOz6H-5.d.ts → ir-D-uqwL_4.d.ts} +1 -1
  324. package/dist/{module-B8CBqIZ_.d.cts → module-Ds4tarcI.d.cts} +230 -140
  325. package/dist/{module-k7m3txak.d.ts → module-Zd1Gn-Nj.d.ts} +230 -140
  326. package/package.json +20 -4
  327. package/dist/ModuleTag-C8FHY_sY.d.ts +0 -93
  328. package/dist/ModuleTag-EGbgBMpZ.d.cts +0 -93
  329. package/dist/Observability-COqEvp2C.d.cts +0 -713
  330. package/dist/Observability-cY4kLn0S.d.ts +0 -713
  331. package/dist/ReadQuery-BlMwhe-F.d.ts +0 -30
  332. package/dist/ReadQuery-CL5XlXts.d.cts +0 -30
  333. package/dist/ReadQuery-SinbStGF.d.cts +0 -38
  334. package/dist/ReadQuery-SinbStGF.d.ts +0 -38
  335. package/dist/chunk-24VULZ7A.js.map +0 -1
  336. package/dist/chunk-3QMIVH35.js +0 -43
  337. package/dist/chunk-3QMIVH35.js.map +0 -1
  338. package/dist/chunk-3TMODYZV.js.map +0 -1
  339. package/dist/chunk-4SO6JMZL.js.map +0 -1
  340. package/dist/chunk-76WT3HOR.js.map +0 -1
  341. package/dist/chunk-ANLBCBDC.js.map +0 -1
  342. package/dist/chunk-AUIR5O6W.js.map +0 -1
  343. package/dist/chunk-BABLDP24.js.map +0 -1
  344. package/dist/chunk-BE3HW4FY.js.map +0 -1
  345. package/dist/chunk-BZ2SHDN2.js.map +0 -1
  346. package/dist/chunk-CW6T36TN.js.map +0 -1
  347. package/dist/chunk-DFNM3WX2.js.map +0 -1
  348. package/dist/chunk-DMBALCE2.js.map +0 -1
  349. package/dist/chunk-EGK3KN7B.js +0 -406
  350. package/dist/chunk-EGK3KN7B.js.map +0 -1
  351. package/dist/chunk-GMPEOUP2.js.map +0 -1
  352. package/dist/chunk-IHVBV5C2.js.map +0 -1
  353. package/dist/chunk-JCXGZRMU.js.map +0 -1
  354. package/dist/chunk-JGIWG6SR.js.map +0 -1
  355. package/dist/chunk-JWOYLO27.js.map +0 -1
  356. package/dist/chunk-KIXAU3GM.js +0 -137
  357. package/dist/chunk-KIXAU3GM.js.map +0 -1
  358. package/dist/chunk-KL5ACTCT.js +0 -8
  359. package/dist/chunk-KL5ACTCT.js.map +0 -1
  360. package/dist/chunk-KP7MUZNX.js.map +0 -1
  361. package/dist/chunk-M3BFQ7HK.js +0 -13
  362. package/dist/chunk-M3BFQ7HK.js.map +0 -1
  363. package/dist/chunk-M3WTHJHJ.js.map +0 -1
  364. package/dist/chunk-NBD3KUOZ.js.map +0 -1
  365. package/dist/chunk-NQZ2OSGR.js +0 -151
  366. package/dist/chunk-NQZ2OSGR.js.map +0 -1
  367. package/dist/chunk-NZJKFF45.js.map +0 -1
  368. package/dist/chunk-OFADUJWJ.js.map +0 -1
  369. package/dist/chunk-OGWBVHB3.js.map +0 -1
  370. package/dist/chunk-PAYXCY6A.js.map +0 -1
  371. package/dist/chunk-PYOE4VSI.js.map +0 -1
  372. package/dist/chunk-QCHIQWAJ.js +0 -21
  373. package/dist/chunk-RNFE3ML2.js.map +0 -1
  374. package/dist/chunk-TKZ7MEIA.js +0 -27
  375. package/dist/chunk-TKZ7MEIA.js.map +0 -1
  376. package/dist/chunk-TQOBJYDP.js.map +0 -1
  377. package/dist/chunk-VZB726PE.js +0 -93
  378. package/dist/chunk-VZB726PE.js.map +0 -1
  379. package/dist/chunk-W3TEWHLO.js +0 -568
  380. package/dist/chunk-W3TEWHLO.js.map +0 -1
  381. package/dist/chunk-YS3AZQ2G.js.map +0 -1
  382. package/dist/chunk-ZFLHVFUC.js +0 -192
  383. package/dist/chunk-ZFLHVFUC.js.map +0 -1
  384. package/dist/chunk-ZFY7U2FR.js.map +0 -1
  385. package/dist/chunk-ZGDVUPTM.js.map +0 -1
  386. package/dist/protocol-g_1897M2.d.cts +0 -127
  387. package/dist/protocol-g_1897M2.d.ts +0 -127
  388. /package/dist/{chunk-3IYZ5IGG.js.map → chunk-5WKUGEBY.js.map} +0 -0
  389. /package/dist/{chunk-3RMKLXHX.js.map → chunk-63ZQ5RIN.js.map} +0 -0
  390. /package/dist/{chunk-EY4NZKDR.js.map → chunk-6Y2TKCNY.js.map} +0 -0
  391. /package/dist/{chunk-G5ZBFPNU.js.map → chunk-A2RQOJC7.js.map} +0 -0
  392. /package/dist/{chunk-TAAPQVZN.js.map → chunk-AYELIQXR.js.map} +0 -0
  393. /package/dist/{chunk-66ALHVEX.js.map → chunk-EB46EYI7.js.map} +0 -0
  394. /package/dist/{chunk-IPF7E66P.js.map → chunk-FYAODKVP.js.map} +0 -0
  395. /package/dist/{chunk-M7IYCTJV.js.map → chunk-R4LFQGP3.js.map} +0 -0
  396. /package/dist/{chunk-M2RGJPXX.js.map → chunk-SJAE5PB5.js.map} +0 -0
  397. /package/dist/{chunk-ZDTRWK5F.js.map → chunk-TAHFWKS6.js.map} +0 -0
  398. /package/dist/{chunk-4CQAV7YB.js.map → chunk-W647DX5Z.js.map} +0 -0
@@ -1,63 +1,87 @@
1
- import {
2
- forceSourceRefresh,
3
- inSyncTransactionFiber,
4
- makeTaskRunner
5
- } from "./chunk-ZFLHVFUC.js";
6
1
  import {
7
2
  Tag
8
- } from "./chunk-KL5ACTCT.js";
3
+ } from "./chunk-UEFFTVPY.js";
9
4
  import {
10
5
  resolve
11
- } from "./chunk-AUIR5O6W.js";
6
+ } from "./chunk-AFSB6NKM.js";
12
7
  import {
13
8
  makeMatch,
14
9
  makeMatchTag
15
- } from "./chunk-BZ2SHDN2.js";
10
+ } from "./chunk-SGTRAXXX.js";
16
11
  import {
17
12
  isActionToken
18
- } from "./chunk-YS3AZQ2G.js";
13
+ } from "./chunk-6HFAW2MH.js";
19
14
  import {
20
- isFieldPathSegment
21
- } from "./chunk-IHVBV5C2.js";
15
+ isFieldPathSegment,
16
+ toKey
17
+ } from "./chunk-SOOBFXRR.js";
22
18
  import {
23
19
  getRuntimeInternals,
24
20
  setBoundInternals
25
- } from "./chunk-3RMKLXHX.js";
21
+ } from "./chunk-63ZQ5RIN.js";
26
22
  import {
27
- isDevEnv
28
- } from "./chunk-3QMIVH35.js";
23
+ forceSourceRefresh,
24
+ inSyncTransactionFiber,
25
+ isDevEnv,
26
+ makeTaskRunner
27
+ } from "./chunk-S4S5N4BJ.js";
29
28
  import {
30
29
  make
31
- } from "./chunk-NQZ2OSGR.js";
30
+ } from "./chunk-FBYW3QDI.js";
31
+ import {
32
+ RunSessionTag
33
+ } from "./chunk-CYYSQMLO.js";
32
34
  import {
33
35
  currentDiagnosticsLevel,
34
36
  record,
35
37
  toSerializableErrorSummary
36
- } from "./chunk-DMBALCE2.js";
37
- import {
38
- RunSessionTag
39
- } from "./chunk-OFADUJWJ.js";
38
+ } from "./chunk-V2SBGVDO.js";
40
39
 
41
40
  // src/internal/runtime/core/mutativePatches.ts
42
41
  import { create } from "mutative";
43
42
  var mutateWithoutPatches = (base, mutator) => {
44
43
  return create(base, mutator);
45
44
  };
45
+ var isNonNegativeIntString = (text) => {
46
+ if (!text) return false;
47
+ for (let i = 0; i < text.length; i++) {
48
+ const c = text.charCodeAt(i);
49
+ if (c < 48 || c > 57) return false;
50
+ }
51
+ return true;
52
+ };
46
53
  var toPatchFieldPath = (path) => {
47
54
  if (typeof path === "string") {
48
55
  const trimmed = path.trim();
49
56
  return trimmed.length > 0 ? "*" : void 0;
50
57
  }
51
58
  if (!Array.isArray(path)) return void 0;
59
+ let allValidString = true;
60
+ for (let i = 0; i < path.length; i++) {
61
+ const seg = path[i];
62
+ if (typeof seg !== "string" || !(isFieldPathSegment(seg) || isNonNegativeIntString(seg))) {
63
+ allValidString = false;
64
+ break;
65
+ }
66
+ }
67
+ if (allValidString) return path;
52
68
  const parts = [];
53
- for (const seg of path) {
69
+ for (let i = 0; i < path.length; i++) {
70
+ const seg = path[i];
54
71
  if (typeof seg === "string") {
55
- if (isFieldPathSegment(seg)) parts.push(seg);
72
+ if (isFieldPathSegment(seg) || isNonNegativeIntString(seg)) {
73
+ parts.push(seg);
74
+ }
56
75
  continue;
57
76
  }
77
+ if (typeof seg === "number" && Number.isFinite(seg)) {
78
+ const n = Math.floor(seg);
79
+ if (n >= 0 && n <= 2147483647) {
80
+ parts.push(String(n));
81
+ }
82
+ }
58
83
  }
59
- if (parts.length === 0) return "*";
60
- return parts;
84
+ return parts.length === 0 ? "*" : parts;
61
85
  };
62
86
  var mutateWithPatchPaths = (base, mutator) => {
63
87
  const out = create(base, mutator, {
@@ -71,25 +95,63 @@ var mutateWithPatchPaths = (base, mutator) => {
71
95
  }
72
96
  const nextState = out[0];
73
97
  const patches = out[1] ?? [];
74
- const dedup = /* @__PURE__ */ new Map();
75
- for (const patch of patches) {
98
+ if (patches.length > 256) {
99
+ let sawStar2 = false;
100
+ const patchPaths2 = [];
101
+ for (let i = 0; i < patches.length; i++) {
102
+ const patch = patches[i];
103
+ const p = toPatchFieldPath(patch?.path);
104
+ if (!p) continue;
105
+ if (p === "*") {
106
+ if (sawStar2) continue;
107
+ sawStar2 = true;
108
+ }
109
+ patchPaths2.push(p);
110
+ }
111
+ return {
112
+ nextState,
113
+ patchPaths: patchPaths2
114
+ };
115
+ }
116
+ let sawStar = false;
117
+ const singleSeg = /* @__PURE__ */ new Set();
118
+ const multiSeg = /* @__PURE__ */ new Set();
119
+ const patchPaths = [];
120
+ for (let i = 0; i < patches.length; i++) {
121
+ const patch = patches[i];
76
122
  const p = toPatchFieldPath(patch?.path);
77
123
  if (!p) continue;
78
- const key = p === "*" ? "*" : JSON.stringify(p);
79
- if (!dedup.has(key)) dedup.set(key, p);
124
+ if (p === "*") {
125
+ if (sawStar) continue;
126
+ sawStar = true;
127
+ patchPaths.push(p);
128
+ continue;
129
+ }
130
+ if (p.length === 1) {
131
+ const seg = p[0];
132
+ if (singleSeg.has(seg)) continue;
133
+ singleSeg.add(seg);
134
+ patchPaths.push(p);
135
+ continue;
136
+ }
137
+ const key = toKey(p);
138
+ if (multiSeg.has(key)) continue;
139
+ multiSeg.add(key);
140
+ patchPaths.push(p);
80
141
  }
81
142
  return {
82
143
  nextState,
83
- patchPaths: Array.from(dedup.values())
144
+ patchPaths
84
145
  };
85
146
  };
86
147
 
87
148
  // src/internal/runtime/core/BoundApiRuntime.ts
88
- import { Context as Context3, Effect as Effect3, FiberRef, Option, Schema, Stream } from "effect";
149
+ import { Deferred, Effect as Effect3, Option, Schema, ServiceMap as ServiceMap3, Stream } from "effect";
89
150
 
90
151
  // src/internal/runtime/core/Lifecycle.ts
91
- import { Cause, Context, Effect, Ref } from "effect";
92
- var LifecycleContext = Context.GenericTag("@logixjs/LifecycleManager");
152
+ import { Cause, Effect, Ref, ServiceMap } from "effect";
153
+ var LifecycleContext = class extends ServiceMap.Service()("@logixjs/LifecycleManager") {
154
+ };
93
155
  var safeRun = (label, eff) => eff.pipe(
94
156
  Effect.matchCauseEffect({
95
157
  onSuccess: () => Effect.void,
@@ -197,7 +259,7 @@ var makeLifecycleManager = (identity) => Effect.gen(function* () {
197
259
  });
198
260
  };
199
261
  const notifyError = (cause, context) => {
200
- if (Cause.isInterrupted(cause)) {
262
+ if (Cause.hasInterruptsOnly(cause)) {
201
263
  return Effect.void;
202
264
  }
203
265
  return record({
@@ -212,11 +274,11 @@ var makeLifecycleManager = (identity) => Effect.gen(function* () {
212
274
  opSeq: context.opSeq,
213
275
  origin: context.origin
214
276
  }).pipe(
215
- Effect.zipRight(
216
- Effect.forEach(
277
+ Effect.flatMap(
278
+ () => Effect.forEach(
217
279
  onErrorHandlers,
218
280
  (handler) => handler(cause, context).pipe(
219
- Effect.catchAllCause((inner) => Effect.logError(`[lifecycle.onError] failed: ${Cause.pretty(inner)}`))
281
+ Effect.catchCause((inner) => Effect.logError(`[lifecycle.onError] failed: ${Cause.pretty(inner)}`))
220
282
  ),
221
283
  { discard: true }
222
284
  )
@@ -275,21 +337,19 @@ var makeLifecycleManager = (identity) => Effect.gen(function* () {
275
337
  const runStart = recordPhase("run", "start:schedule", {
276
338
  total: start.length
277
339
  }).pipe(
278
- Effect.zipRight(
279
- Effect.forEach(
340
+ Effect.flatMap(
341
+ () => Effect.forEach(
280
342
  start,
281
343
  (task) => Effect.forkScoped(
282
344
  task.effect.pipe(
283
- Effect.catchAllCause(
284
- (cause) => notifyError(cause, {
285
- phase: "run",
286
- hook: "start",
287
- moduleId: identity.moduleId,
288
- instanceId: identity.instanceId,
289
- taskId: task.taskId,
290
- origin: "start"
291
- })
292
- )
345
+ Effect.catchCause((cause) => notifyError(cause, {
346
+ phase: "run",
347
+ hook: "start",
348
+ moduleId: identity.moduleId,
349
+ instanceId: identity.instanceId,
350
+ taskId: task.taskId,
351
+ origin: "start"
352
+ }))
293
353
  )
294
354
  ).pipe(Effect.asVoid),
295
355
  { discard: true, concurrency: "unbounded" }
@@ -304,16 +364,14 @@ var makeLifecycleManager = (identity) => Effect.gen(function* () {
304
364
  yield* safeRun(
305
365
  "lifecycle.onDestroy",
306
366
  task.effect.pipe(
307
- Effect.catchAllCause(
308
- (cause) => notifyError(cause, {
309
- phase: "destroy",
310
- hook: "destroy",
311
- moduleId: identity.moduleId,
312
- instanceId: identity.instanceId,
313
- taskId: task.taskId,
314
- origin: "destroy"
315
- })
316
- )
367
+ Effect.catchCause((cause) => notifyError(cause, {
368
+ phase: "destroy",
369
+ hook: "destroy",
370
+ moduleId: identity.moduleId,
371
+ instanceId: identity.instanceId,
372
+ taskId: task.taskId,
373
+ origin: "destroy"
374
+ }))
317
375
  )
318
376
  );
319
377
  }
@@ -327,16 +385,14 @@ var makeLifecycleManager = (identity) => Effect.gen(function* () {
327
385
  yield* safeRun(
328
386
  "lifecycle.onSuspend",
329
387
  task.effect.pipe(
330
- Effect.catchAllCause(
331
- (cause) => notifyError(cause, {
332
- phase: "platform",
333
- hook: "suspend",
334
- moduleId: identity.moduleId,
335
- instanceId: identity.instanceId,
336
- taskId: task.taskId,
337
- origin: "platform.suspend"
338
- })
339
- )
388
+ Effect.catchCause((cause) => notifyError(cause, {
389
+ phase: "platform",
390
+ hook: "suspend",
391
+ moduleId: identity.moduleId,
392
+ instanceId: identity.instanceId,
393
+ taskId: task.taskId,
394
+ origin: "platform.suspend"
395
+ }))
340
396
  )
341
397
  );
342
398
  }
@@ -348,16 +404,14 @@ var makeLifecycleManager = (identity) => Effect.gen(function* () {
348
404
  yield* safeRun(
349
405
  "lifecycle.onResume",
350
406
  task.effect.pipe(
351
- Effect.catchAllCause(
352
- (cause) => notifyError(cause, {
353
- phase: "platform",
354
- hook: "resume",
355
- moduleId: identity.moduleId,
356
- instanceId: identity.instanceId,
357
- taskId: task.taskId,
358
- origin: "platform.resume"
359
- })
360
- )
407
+ Effect.catchCause((cause) => notifyError(cause, {
408
+ phase: "platform",
409
+ hook: "resume",
410
+ moduleId: identity.moduleId,
411
+ instanceId: identity.instanceId,
412
+ taskId: task.taskId,
413
+ origin: "platform.resume"
414
+ }))
361
415
  )
362
416
  );
363
417
  }
@@ -369,16 +423,14 @@ var makeLifecycleManager = (identity) => Effect.gen(function* () {
369
423
  yield* safeRun(
370
424
  "lifecycle.onReset",
371
425
  task.effect.pipe(
372
- Effect.catchAllCause(
373
- (cause) => notifyError(cause, {
374
- phase: "platform",
375
- hook: "reset",
376
- moduleId: identity.moduleId,
377
- instanceId: identity.instanceId,
378
- taskId: task.taskId,
379
- origin: "platform.reset"
380
- })
381
- )
426
+ Effect.catchCause((cause) => notifyError(cause, {
427
+ phase: "platform",
428
+ hook: "reset",
429
+ moduleId: identity.moduleId,
430
+ instanceId: identity.instanceId,
431
+ taskId: task.taskId,
432
+ origin: "platform.reset"
433
+ }))
382
434
  )
383
435
  );
384
436
  }
@@ -417,13 +469,13 @@ var makeLifecycleManager = (identity) => Effect.gen(function* () {
417
469
  });
418
470
 
419
471
  // src/internal/runtime/core/LogicDiagnostics.ts
420
- import { Cause as Cause2, Context as Context2, Effect as Effect2 } from "effect";
472
+ import { Cause as Cause2, Effect as Effect2, ServiceMap as ServiceMap2 } from "effect";
421
473
  var phaseDiagnosticsEnabled = () => isDevEnv();
422
474
  var SERVICE_NOT_FOUND_PREFIX = "Service not found:";
423
475
  var emitEnvServiceNotFoundDiagnosticIfNeeded = (cause, moduleId) => Effect2.gen(function* () {
424
476
  let pretty;
425
477
  try {
426
- pretty = Cause2.pretty(cause, { renderErrorCause: true });
478
+ pretty = Cause2.pretty(cause);
427
479
  } catch {
428
480
  return;
429
481
  }
@@ -448,8 +500,9 @@ var emitEnvServiceNotFoundDiagnosticIfNeeded = (cause, moduleId) => Effect2.gen(
448
500
  kind: "env_service_not_ready"
449
501
  });
450
502
  });
451
- var LogicPhaseServiceTag = Context2.GenericTag("@logixjs/LogicPhaseService");
452
- var LogicUnitServiceTag = class extends Context2.Tag("@logixjs/LogicUnitService")() {
503
+ var LogicPhaseServiceTag = class extends ServiceMap2.Service()("@logixjs/LogicPhaseService") {
504
+ };
505
+ var LogicUnitServiceTag = class extends ServiceMap2.Service()("@logixjs/LogicUnitService") {
453
506
  };
454
507
  var makeLogicPhaseError = (kind, api, phase, moduleId) => Object.assign(new Error(`[LogicPhaseError] ${api} is not allowed in ${phase} phase (kind=${kind}).`), {
455
508
  _tag: "LogicPhaseError",
@@ -462,7 +515,7 @@ var emitInvalidPhaseDiagnosticIfNeeded = (cause, moduleId) => Effect2.gen(functi
462
515
  if (!phaseDiagnosticsEnabled()) {
463
516
  return;
464
517
  }
465
- const allErrors = [...Cause2.failures(cause), ...Cause2.defects(cause)];
518
+ const allErrors = cause.reasons.filter((reason) => Cause2.isFailReason(reason) || Cause2.isDieReason(reason)).map((reason) => Cause2.isFailReason(reason) ? reason.error : reason.defect);
466
519
  for (const err of allErrors) {
467
520
  const logicErr = err;
468
521
  if (logicErr && logicErr._tag === "LogicPhaseError") {
@@ -483,6 +536,16 @@ var emitInvalidPhaseDiagnosticIfNeeded = (cause, moduleId) => Effect2.gen(functi
483
536
  });
484
537
 
485
538
  // src/internal/runtime/core/BoundApiRuntime.ts
539
+ var DIRECT_STATE_WRITE_EFFECT = /* @__PURE__ */ Symbol.for("logix.directStateWriteEffect");
540
+ var markDirectStateWriteEffect = (effect, metadata) => {
541
+ ;
542
+ effect[DIRECT_STATE_WRITE_EFFECT] = metadata;
543
+ return effect;
544
+ };
545
+ var getDirectStateWriteMetadata = (value) => {
546
+ if (!value || typeof value !== "object" && typeof value !== "function") return void 0;
547
+ return value[DIRECT_STATE_WRITE_EFFECT];
548
+ };
486
549
  var LogicBuilderFactory = (runtime, runtimeInternals) => {
487
550
  const flowApi = make(runtime, runtimeInternals);
488
551
  return (stream, triggerName) => {
@@ -510,8 +573,30 @@ var LogicBuilderFactory = (runtime, runtimeInternals) => {
510
573
  runParallel(eff, options) {
511
574
  return flowApi.runParallel(eff, options)(stream);
512
575
  },
513
- runFork: (eff) => Effect3.forkScoped(flowApi.run(eff)(stream)).pipe(Effect3.asVoid),
514
- runParallelFork: (eff) => Effect3.forkScoped(flowApi.runParallel(eff)(stream)).pipe(Effect3.asVoid),
576
+ runFork: (eff) => {
577
+ if (runtimeInternals && triggerName && typeof eff !== "function" && getDirectStateWriteMetadata(eff) != null) {
578
+ return Effect3.sync(() => {
579
+ const metadata = getDirectStateWriteMetadata(eff);
580
+ runtimeInternals.txn.registerActionStateWriteback(
581
+ triggerName,
582
+ metadata.kind === "update" ? { kind: "update", run: metadata.run } : { kind: "mutate", run: metadata.run }
583
+ );
584
+ });
585
+ }
586
+ return Effect3.forkScoped(flowApi.run(eff)(stream)).pipe(Effect3.asVoid);
587
+ },
588
+ runParallelFork: (eff) => {
589
+ if (runtimeInternals && triggerName && typeof eff !== "function" && getDirectStateWriteMetadata(eff) != null) {
590
+ return Effect3.sync(() => {
591
+ const metadata = getDirectStateWriteMetadata(eff);
592
+ runtimeInternals.txn.registerActionStateWriteback(
593
+ triggerName,
594
+ metadata.kind === "update" ? { kind: "update", run: metadata.run } : { kind: "mutate", run: metadata.run }
595
+ );
596
+ });
597
+ }
598
+ return Effect3.forkScoped(flowApi.runParallel(eff)(stream)).pipe(Effect3.asVoid);
599
+ },
515
600
  runTask: (config) => makeTaskRunner(stream, "task", taskRunnerRuntime, {
516
601
  ...config,
517
602
  triggerName: config.triggerName ?? triggerName
@@ -551,7 +636,7 @@ var LogicBuilderFactory = (runtime, runtimeInternals) => {
551
636
  yield* runtime.setState(next);
552
637
  })
553
638
  )
554
- ).pipe(Effect3.catchAllCause((cause) => Effect3.logError("Flow error", cause))),
639
+ ).pipe(Effect3.catchCause((cause) => Effect3.logError("Flow error", cause))),
555
640
  mutate: (reducer) => Stream.runForEach(
556
641
  stream,
557
642
  (payload) => taskRunnerRuntime.runWithStateTransaction(
@@ -572,7 +657,7 @@ var LogicBuilderFactory = (runtime, runtimeInternals) => {
572
657
  updateDraft(nextState);
573
658
  })
574
659
  )
575
- ).pipe(Effect3.catchAllCause((cause) => Effect3.logError("Flow error", cause)))
660
+ ).pipe(Effect3.catchCause((cause) => Effect3.logError("Flow error", cause)))
576
661
  };
577
662
  const pipe = function() {
578
663
  const fns = arguments;
@@ -603,12 +688,10 @@ function make2(shape, runtime, options) {
603
688
  const flowApi = make(runtime, runtimeInternals);
604
689
  const makeIntentBuilder = (runtime_) => LogicBuilderFactory(runtime_, runtimeInternals);
605
690
  const withLifecycle = (available, missing) => Effect3.serviceOption(LifecycleContext).pipe(
606
- Effect3.flatMap(
607
- (maybe) => Option.match(maybe, {
608
- onSome: available,
609
- onNone: missing
610
- })
611
- )
691
+ Effect3.flatMap((maybe) => Option.match(maybe, {
692
+ onSome: available,
693
+ onNone: missing
694
+ }))
612
695
  );
613
696
  const withPlatform = (invoke) => Effect3.serviceOption(Tag).pipe(
614
697
  Effect3.flatMap(
@@ -627,14 +710,29 @@ function make2(shape, runtime, options) {
627
710
  message: `${api2} is setup-only and is not allowed in run phase.`,
628
711
  hint: "Move $.lifecycle.* calls to the synchronous part of Module.logic builder (before return) for registration; for dynamic resource cleanup in the run phase, use Effect.acquireRelease / Scope finalizer instead of registering onDestroy late.",
629
712
  kind: "lifecycle_in_run"
630
- });
713
+ }).pipe(Effect3.orDie);
631
714
  const createIntentBuilder = (stream, triggerName) => makeIntentBuilder(runtime)(stream, triggerName);
715
+ const actionMatchesTag = (action, tag) => {
716
+ const actionTag = action?._tag;
717
+ if (actionTag === tag) {
718
+ return true;
719
+ }
720
+ const actionType = action?.type;
721
+ return actionType === tag;
722
+ };
723
+ const actionStreamByTag = (tag) => {
724
+ const topicSelector = runtime.actionsByTag$;
725
+ if (typeof topicSelector === "function") {
726
+ return topicSelector(tag);
727
+ }
728
+ return runtime.actions$.pipe(Stream.filter((action) => actionMatchesTag(action, tag)));
729
+ };
632
730
  const onceInRunSession = (key) => Effect3.serviceOption(RunSessionTag).pipe(
633
731
  Effect3.map((maybe) => Option.isSome(maybe) ? maybe.value.local.once(key) : true)
634
732
  );
635
733
  let cachedDiagnosticsLevel;
636
734
  const isModuleLike = (value) => Boolean(
637
- value && typeof value === "object" && (value._kind === "ModuleDef" || value._kind === "Module") && "tag" in value && Context3.isTag(value.tag)
735
+ value && typeof value === "object" && (value._kind === "ModuleDef" || value._kind === "Module") && "tag" in value && ServiceMap3.isKey(value.tag)
638
736
  );
639
737
  const buildModuleHandle = (tag, rt) => {
640
738
  const actionsProxy = new Proxy(
@@ -746,44 +844,161 @@ function make2(shape, runtime, options) {
746
844
  err.name = "MissingModuleRuntimeError";
747
845
  return yield* Effect3.die(err);
748
846
  });
749
- const stateApi = {
750
- read: runtime.getState,
751
- update: (f) => Effect3.gen(function* () {
752
- const inTxn = yield* FiberRef.get(inSyncTransactionFiber);
753
- if (inTxn) {
754
- const prev = yield* runtime.getState;
755
- return yield* runtime.setState(f(prev));
756
- }
757
- const body = () => Effect3.flatMap(runtime.getState, (prev) => runtime.setState(f(prev)));
758
- return yield* runtimeInternals ? runtimeInternals.txn.runWithStateTransaction({ kind: "state", name: "update" }, body) : body();
759
- }),
760
- mutate: (f) => Effect3.gen(function* () {
761
- const recordPatch = runtimeInternals?.txn.recordStatePatch;
762
- const updateDraft = runtimeInternals?.txn.updateDraft;
763
- const inTxn = yield* FiberRef.get(inSyncTransactionFiber);
764
- if (inTxn) {
765
- const prev = yield* runtime.getState;
766
- const { nextState, patchPaths } = mutateWithPatchPaths(prev, (draft) => {
767
- f(draft);
847
+ let batchedStateWritebackCoordinator;
848
+ const getOrCreateBatchedStateWritebackCoordinator = () => {
849
+ if (batchedStateWritebackCoordinator) return batchedStateWritebackCoordinator;
850
+ if (!runtimeInternals) {
851
+ throw new Error("[BatchedStateWritebackCoordinator] Missing runtimeInternals (expected in ModuleRuntime-backed $).");
852
+ }
853
+ let inFlight = false;
854
+ const pending = [];
855
+ const drain = () => {
856
+ if (pending.length === 0) return [];
857
+ return pending.splice(0, pending.length);
858
+ };
859
+ const ok = { _tag: "ok" };
860
+ const fail = (cause) => ({ _tag: "failure", cause });
861
+ const applyBatch = (batch) => Effect3.gen(function* () {
862
+ if (batch.length === 0) return;
863
+ let current = yield* runtime.getState;
864
+ for (let i = 0; i < batch.length; i++) {
865
+ const req = batch[i];
866
+ if (req.kind === "update") {
867
+ const next = req.update(current);
868
+ current = next;
869
+ yield* runtime.setState(next);
870
+ continue;
871
+ }
872
+ const { nextState, patchPaths } = mutateWithPatchPaths(current, (draft) => {
873
+ req.mutate(draft);
768
874
  });
769
875
  for (const path of patchPaths) {
770
- recordPatch?.(path, "unknown");
876
+ runtimeInternals.txn.recordStatePatch(path, "unknown");
771
877
  }
772
- updateDraft?.(nextState);
773
- return;
878
+ runtimeInternals.txn.updateDraft(nextState);
879
+ current = nextState;
880
+ }
881
+ });
882
+ const flushInFlight = () => Effect3.uninterruptible(
883
+ Effect3.gen(function* () {
884
+ if (inFlight) return;
885
+ inFlight = true;
886
+ try {
887
+ while (true) {
888
+ const batch = drain();
889
+ if (batch.length === 0) {
890
+ inFlight = false;
891
+ if (pending.length === 0) return;
892
+ inFlight = true;
893
+ continue;
894
+ }
895
+ const originName = batch.length === 1 ? batch[0].kind === "update" ? "update" : "mutate" : "writeback:batched";
896
+ const exit = yield* Effect3.exit(
897
+ runtimeInternals.txn.runWithStateTransaction(
898
+ {
899
+ kind: "state",
900
+ name: originName,
901
+ details: { batched: true, count: batch.length }
902
+ },
903
+ () => applyBatch(batch).pipe(Effect3.asVoid)
904
+ )
905
+ );
906
+ const outcome = exit._tag === "Success" ? ok : fail(exit.cause);
907
+ for (let i = 0; i < batch.length; i++) {
908
+ yield* Deferred.succeed(batch[i].done, outcome);
909
+ }
910
+ if (outcome._tag === "failure") {
911
+ return;
912
+ }
913
+ }
914
+ } finally {
915
+ inFlight = false;
916
+ }
917
+ })
918
+ );
919
+ const waitForMicrotask = () => Effect3.promise(
920
+ () => new Promise((resolve2) => {
921
+ if (typeof queueMicrotask === "function") {
922
+ queueMicrotask(resolve2);
923
+ return;
924
+ }
925
+ Promise.resolve().then(resolve2);
926
+ })
927
+ );
928
+ const enqueueAndAwait = (req) => Effect3.gen(function* () {
929
+ pending.push(req);
930
+ if (!inFlight) {
931
+ yield* waitForMicrotask();
774
932
  }
775
- const body = () => Effect3.gen(function* () {
776
- const prev = yield* runtime.getState;
777
- const { nextState, patchPaths } = mutateWithPatchPaths(prev, (draft) => {
778
- f(draft);
933
+ yield* flushInFlight();
934
+ const outcome = yield* Deferred.await(req.done);
935
+ if (outcome._tag === "failure") {
936
+ return yield* Effect3.die(outcome.cause);
937
+ }
938
+ });
939
+ const coordinator = {
940
+ enqueueUpdate: (update) => Effect3.gen(function* () {
941
+ const done = yield* Deferred.make();
942
+ yield* enqueueAndAwait({ kind: "update", update, done });
943
+ }),
944
+ enqueueMutate: (mutate) => Effect3.gen(function* () {
945
+ const done = yield* Deferred.make();
946
+ yield* enqueueAndAwait({ kind: "mutate", mutate, done });
947
+ })
948
+ };
949
+ batchedStateWritebackCoordinator = coordinator;
950
+ return coordinator;
951
+ };
952
+ const stateApi = {
953
+ read: runtime.getState,
954
+ update: (f) => markDirectStateWriteEffect(
955
+ Effect3.gen(function* () {
956
+ const inTxn = yield* Effect3.service(inSyncTransactionFiber).pipe(Effect3.orDie);
957
+ if (inTxn) {
958
+ const prev = yield* runtime.getState;
959
+ return yield* runtime.setState(f(prev));
960
+ }
961
+ const body = () => Effect3.flatMap(runtime.getState, (prev) => runtime.setState(f(prev)));
962
+ if (runtimeInternals && !isDevEnv()) {
963
+ return yield* getOrCreateBatchedStateWritebackCoordinator().enqueueUpdate(f);
964
+ }
965
+ return yield* runtimeInternals ? runtimeInternals.txn.runWithStateTransaction({ kind: "state", name: "update" }, body) : body();
966
+ }),
967
+ { kind: "update", run: f }
968
+ ),
969
+ mutate: (f) => markDirectStateWriteEffect(
970
+ Effect3.gen(function* () {
971
+ const recordPatch = runtimeInternals?.txn.recordStatePatch;
972
+ const updateDraft = runtimeInternals?.txn.updateDraft;
973
+ const inTxn = yield* Effect3.service(inSyncTransactionFiber).pipe(Effect3.orDie);
974
+ if (inTxn) {
975
+ const prev = yield* runtime.getState;
976
+ const { nextState, patchPaths } = mutateWithPatchPaths(prev, (draft) => {
977
+ f(draft);
978
+ });
979
+ for (const path of patchPaths) {
980
+ recordPatch?.(path, "unknown");
981
+ }
982
+ updateDraft?.(nextState);
983
+ return;
984
+ }
985
+ const body = () => Effect3.gen(function* () {
986
+ const prev = yield* runtime.getState;
987
+ const { nextState, patchPaths } = mutateWithPatchPaths(prev, (draft) => {
988
+ f(draft);
989
+ });
990
+ for (const path of patchPaths) {
991
+ recordPatch?.(path, "unknown");
992
+ }
993
+ updateDraft?.(nextState);
779
994
  });
780
- for (const path of patchPaths) {
781
- recordPatch?.(path, "unknown");
995
+ if (runtimeInternals && !isDevEnv()) {
996
+ return yield* getOrCreateBatchedStateWritebackCoordinator().enqueueMutate(f);
782
997
  }
783
- updateDraft?.(nextState);
784
- });
785
- return yield* runtimeInternals ? runtimeInternals.txn.runWithStateTransaction({ kind: "state", name: "mutate" }, body) : body();
786
- }),
998
+ return yield* runtimeInternals ? runtimeInternals.txn.runWithStateTransaction({ kind: "state", name: "mutate" }, body) : body();
999
+ }),
1000
+ { kind: "mutate", run: f }
1001
+ ),
787
1002
  ref: runtime.ref
788
1003
  };
789
1004
  const actions = shape.actionMap;
@@ -827,7 +1042,7 @@ function make2(shape, runtime, options) {
827
1042
  };
828
1043
  const effect = (token, handler) => Effect3.gen(function* () {
829
1044
  if (!isActionToken(token)) {
830
- return yield* Effect3.dieMessage("[BoundApi.effect] token must be an ActionToken");
1045
+ return yield* Effect3.die(new Error("[BoundApi.effect] token must be an ActionToken"));
831
1046
  }
832
1047
  const phase = getCurrentPhase();
833
1048
  const logicUnit = options?.logicUnit;
@@ -956,8 +1171,8 @@ function make2(shape, runtime, options) {
956
1171
  return yield* Effect3.void;
957
1172
  }
958
1173
  const force = options2?.force === true;
959
- const runHandler = (state) => force ? Effect3.locally(forceSourceRefresh, true)(handler(state)) : handler(state);
960
- const inTxn = yield* FiberRef.get(inSyncTransactionFiber);
1174
+ const runHandler = (state) => force ? Effect3.provideService(handler(state), forceSourceRefresh, true) : handler(state);
1175
+ const inTxn = yield* Effect3.service(inSyncTransactionFiber).pipe(Effect3.orDie);
961
1176
  if (inTxn) {
962
1177
  const state = yield* runtime.getState;
963
1178
  return yield* runHandler(state);
@@ -989,9 +1204,10 @@ function make2(shape, runtime, options) {
989
1204
  Effect3.tap((rt) => emitModuleDescriptorOnce(domain, rt)),
990
1205
  Effect3.map((rt) => buildModuleHandle(tag, rt))
991
1206
  );
992
- const detectAndSelect = FiberRef.get(currentDiagnosticsLevel).pipe(
993
- Effect3.tap((level) => {
1207
+ const detectAndSelect = Effect3.service(currentDiagnosticsLevel).pipe(
1208
+ Effect3.map((level) => {
994
1209
  cachedDiagnosticsLevel = level;
1210
+ return level;
995
1211
  }),
996
1212
  Effect3.flatMap((level) => level === "off" ? resolveAndBuild : resolveWithDescriptor)
997
1213
  );
@@ -1005,14 +1221,14 @@ function make2(shape, runtime, options) {
1005
1221
  return detectAndSelect;
1006
1222
  });
1007
1223
  }
1008
- if (Context3.isTag(arg)) {
1224
+ if (ServiceMap3.isKey(arg)) {
1009
1225
  const candidate = arg;
1010
1226
  if (candidate._kind === "ModuleTag") {
1011
1227
  return resolveModuleRuntime(arg).pipe(
1012
1228
  Effect3.map((rt) => buildModuleHandle(arg, rt))
1013
1229
  );
1014
1230
  }
1015
- return arg;
1231
+ return Effect3.service(arg).pipe(Effect3.orDie);
1016
1232
  }
1017
1233
  return Effect3.die("BoundApi.use: unsupported argument");
1018
1234
  }
@@ -1024,39 +1240,33 @@ function make2(shape, runtime, options) {
1024
1240
  const arg = args[0];
1025
1241
  if (isActionToken(arg)) {
1026
1242
  const tag = arg.tag;
1243
+ return createIntentBuilder(actionStreamByTag(tag).pipe(Stream.map((action) => action.payload)), tag);
1244
+ }
1245
+ if (Schema.isSchema(arg)) {
1246
+ const decode = Schema.decodeUnknownSync(arg);
1027
1247
  return createIntentBuilder(
1028
1248
  runtime.actions$.pipe(
1029
- Stream.filter((a) => a._tag === tag || a.type === tag),
1030
- Stream.map((a) => a.payload)
1031
- ),
1032
- tag
1249
+ Stream.filter((a) => {
1250
+ try {
1251
+ decode(a);
1252
+ return true;
1253
+ } catch {
1254
+ return false;
1255
+ }
1256
+ })
1257
+ )
1033
1258
  );
1034
1259
  }
1035
1260
  if (typeof arg === "function") {
1036
1261
  return createIntentBuilder(runtime.actions$.pipe(Stream.filter(arg)));
1037
1262
  }
1038
1263
  if (typeof arg === "string") {
1039
- return createIntentBuilder(
1040
- runtime.actions$.pipe(Stream.filter((a) => a._tag === arg || a.type === arg)),
1041
- arg
1042
- );
1264
+ return createIntentBuilder(actionStreamByTag(arg), arg);
1043
1265
  }
1044
1266
  if (typeof arg === "object" && arg !== null) {
1045
1267
  if ("_tag" in arg) {
1046
- return createIntentBuilder(
1047
- runtime.actions$.pipe(Stream.filter((a) => a._tag === arg._tag)),
1048
- String(arg._tag)
1049
- );
1050
- }
1051
- if (Schema.isSchema(arg)) {
1052
- return createIntentBuilder(
1053
- runtime.actions$.pipe(
1054
- Stream.filter((a) => {
1055
- const result = Schema.decodeUnknownSync(arg)(a);
1056
- return !!result;
1057
- })
1058
- )
1059
- );
1268
+ const tag = String(arg._tag);
1269
+ return createIntentBuilder(actionStreamByTag(tag), tag);
1060
1270
  }
1061
1271
  }
1062
1272
  return createIntentBuilder(runtime.actions$);
@@ -1064,10 +1274,7 @@ function make2(shape, runtime, options) {
1064
1274
  get: (_target, prop) => {
1065
1275
  guardRunOnly("use_in_setup", "$.onAction");
1066
1276
  if (typeof prop === "string") {
1067
- return createIntentBuilder(
1068
- runtime.actions$.pipe(Stream.filter((a) => a._tag === prop || a.type === prop)),
1069
- prop
1070
- );
1277
+ return createIntentBuilder(actionStreamByTag(prop), prop);
1071
1278
  }
1072
1279
  return void 0;
1073
1280
  }
@@ -1096,4 +1303,4 @@ export {
1096
1303
  emitInvalidPhaseDiagnosticIfNeeded,
1097
1304
  make2 as make
1098
1305
  };
1099
- //# sourceMappingURL=chunk-BE3HW4FY.js.map
1306
+ //# sourceMappingURL=chunk-ZBBMZMA6.js.map