@logixjs/core 0.0.1 → 0.0.2

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 (300) hide show
  1. package/LICENSE +201 -0
  2. package/dist/{Bound-BN1DQ_lM.d.ts → Bound-CEa1ihvH.d.ts} +2 -2
  3. package/dist/{Bound-BPIfH9SS.d.cts → Bound-CNLNkC7c.d.cts} +2 -2
  4. package/dist/Bound.cjs +620 -163
  5. package/dist/Bound.cjs.map +1 -1
  6. package/dist/Bound.d.cts +3 -3
  7. package/dist/Bound.d.ts +3 -3
  8. package/dist/Bound.js +14 -14
  9. package/dist/{Debug-Bq8Sqjcr.d.cts → Debug-BhMYr-1i.d.cts} +3 -3
  10. package/dist/{Debug-B5q5Bkzx.d.ts → Debug-ByM7m4Ft.d.ts} +3 -3
  11. package/dist/Debug.cjs +553 -32
  12. package/dist/Debug.cjs.map +1 -1
  13. package/dist/Debug.d.cts +10 -8
  14. package/dist/Debug.d.ts +10 -8
  15. package/dist/Debug.js +12 -10
  16. package/dist/EffectOp.cjs.map +1 -1
  17. package/dist/EffectOp.js +2 -3
  18. package/dist/EffectOp.js.map +1 -1
  19. package/dist/Env.cjs +664 -6
  20. package/dist/Env.cjs.map +1 -1
  21. package/dist/Env.js +5 -2
  22. package/dist/ExternalStore-BAz83PVq.d.cts +60 -0
  23. package/dist/ExternalStore-BYWPbYs8.d.ts +60 -0
  24. package/dist/ExternalStore.cjs +746 -0
  25. package/dist/ExternalStore.cjs.map +1 -0
  26. package/dist/ExternalStore.d.cts +4 -0
  27. package/dist/ExternalStore.d.ts +4 -0
  28. package/dist/ExternalStore.js +19 -0
  29. package/dist/ExternalStore.js.map +1 -0
  30. package/dist/{Flow-1fZT8MpX.d.cts → Flow-BlSoMmhV.d.cts} +2 -2
  31. package/dist/{Flow-BhpjE22E.d.ts → Flow-CQSGve5c.d.ts} +2 -2
  32. package/dist/Flow.cjs +2 -2
  33. package/dist/Flow.cjs.map +1 -1
  34. package/dist/Flow.d.cts +4 -4
  35. package/dist/Flow.d.ts +4 -4
  36. package/dist/Flow.js +7 -8
  37. package/dist/{Handle-D_cLW1Z3.d.ts → Handle-B7PSmsrY.d.ts} +1 -1
  38. package/dist/{Handle-D8D1zPb_.d.cts → Handle-ByovhL-c.d.cts} +1 -1
  39. package/dist/Handle.d.cts +3 -3
  40. package/dist/Handle.d.ts +3 -3
  41. package/dist/{Kernel-CnGE1Fyk.d.ts → Kernel-DGSpS4GM.d.ts} +2 -2
  42. package/dist/{Kernel-8kC-jOda.d.cts → Kernel-DZAk-Mrn.d.cts} +2 -2
  43. package/dist/Kernel.cjs +680 -22
  44. package/dist/Kernel.cjs.map +1 -1
  45. package/dist/Kernel.d.cts +10 -8
  46. package/dist/Kernel.d.ts +10 -8
  47. package/dist/Kernel.js +7 -4
  48. package/dist/{Link-Db7975nU.d.ts → Link-Cm4eR9n0.d.ts} +10 -3
  49. package/dist/{Link-fX8x1eCK.d.cts → Link-DF8i8iWR.d.cts} +10 -3
  50. package/dist/Link.cjs +1128 -86
  51. package/dist/Link.cjs.map +1 -1
  52. package/dist/Link.d.cts +3 -3
  53. package/dist/Link.d.ts +3 -3
  54. package/dist/Link.js +30 -25
  55. package/dist/{Logic-DRh4sDZj.d.cts → Logic-BcQA0AvE.d.cts} +1 -1
  56. package/dist/{Logic-BRjEMr-W.d.ts → Logic-OotSE1xw.d.ts} +1 -1
  57. package/dist/Logic.d.cts +3 -3
  58. package/dist/Logic.d.ts +3 -3
  59. package/dist/{MatchBuilder-CJk5oCkR.d.cts → MatchBuilder-BNDJ8waF.d.ts} +1 -1
  60. package/dist/{MatchBuilder-0QOc-nlU.d.ts → MatchBuilder-CvZ5WY1B.d.cts} +1 -1
  61. package/dist/MatchBuilder.d.cts +4 -4
  62. package/dist/MatchBuilder.d.ts +4 -4
  63. package/dist/Middleware-D8tUDLv_.d.cts +100 -0
  64. package/dist/Middleware-DS7CbTTN.d.ts +100 -0
  65. package/dist/Middleware.cjs +461 -13
  66. package/dist/Middleware.cjs.map +1 -1
  67. package/dist/Middleware.d.cts +2 -86
  68. package/dist/Middleware.d.ts +2 -86
  69. package/dist/Middleware.js +13 -11
  70. package/dist/{Module-DnzluX2J.d.ts → Module-CFj0I2yE.d.ts} +45 -18
  71. package/dist/{Module-B_0xRDMR.d.cts → Module-DpXPW9EQ.d.cts} +45 -18
  72. package/dist/Module.cjs +8583 -5741
  73. package/dist/Module.cjs.map +1 -1
  74. package/dist/Module.d.cts +5 -4
  75. package/dist/Module.d.ts +5 -4
  76. package/dist/Module.js +32 -27
  77. package/dist/ModuleTag-BcVF6z7B.d.ts +113 -0
  78. package/dist/ModuleTag-DuZXo_NS.d.cts +113 -0
  79. package/dist/ModuleTag.cjs +2609 -1232
  80. package/dist/ModuleTag.cjs.map +1 -1
  81. package/dist/ModuleTag.d.cts +4 -4
  82. package/dist/ModuleTag.d.ts +4 -4
  83. package/dist/ModuleTag.js +28 -25
  84. package/dist/{Observability-cY4kLn0S.d.ts → Observability-D-ZWeEVb.d.ts} +22 -15
  85. package/dist/{Observability-COqEvp2C.d.cts → Observability-V7sRMYTh.d.cts} +22 -15
  86. package/dist/Observability.cjs +1938 -640
  87. package/dist/Observability.cjs.map +1 -1
  88. package/dist/Observability.d.cts +4 -4
  89. package/dist/Observability.d.ts +4 -4
  90. package/dist/Observability.js +21 -19
  91. package/dist/{Process-mL8fHDSB.d.cts → Process-B55aJMFk.d.cts} +29 -4
  92. package/dist/{Process-CM9xbMdP.d.ts → Process-DvhFEwUS.d.ts} +29 -4
  93. package/dist/Process.cjs +1122 -85
  94. package/dist/Process.cjs.map +1 -1
  95. package/dist/Process.d.cts +4 -3
  96. package/dist/Process.d.ts +4 -3
  97. package/dist/Process.js +27 -22
  98. package/dist/{ReadQuery-BlMwhe-F.d.ts → ReadQuery-C4vZ8Prc.d.ts} +2 -2
  99. package/dist/{ReadQuery-SinbStGF.d.ts → ReadQuery-CafjlJQo.d.cts} +1 -1
  100. package/dist/{ReadQuery-SinbStGF.d.cts → ReadQuery-CafjlJQo.d.ts} +1 -1
  101. package/dist/{ReadQuery-CL5XlXts.d.cts → ReadQuery-mc0NgrFV.d.cts} +2 -2
  102. package/dist/ReadQuery.cjs +3 -3
  103. package/dist/ReadQuery.cjs.map +1 -1
  104. package/dist/ReadQuery.d.cts +2 -2
  105. package/dist/ReadQuery.d.ts +2 -2
  106. package/dist/ReadQuery.js +3 -3
  107. package/dist/{Reflection-CQnKwPXj.d.ts → Reflection-C8xZ267q.d.ts} +88 -7
  108. package/dist/{Reflection-Kabo1mlU.d.cts → Reflection-DP7Vsv3f.d.cts} +88 -7
  109. package/dist/Reflection.cjs +2934 -1553
  110. package/dist/Reflection.cjs.map +1 -1
  111. package/dist/Reflection.d.cts +14 -11
  112. package/dist/Reflection.d.ts +14 -11
  113. package/dist/Reflection.js +26 -21
  114. package/dist/Resource.cjs +670 -12
  115. package/dist/Resource.cjs.map +1 -1
  116. package/dist/Resource.js +6 -3
  117. package/dist/Root.cjs +675 -17
  118. package/dist/Root.cjs.map +1 -1
  119. package/dist/Root.js +7 -3
  120. package/dist/{Runtime-CtyzZG4i.d.ts → Runtime-BWc9YfUB.d.ts} +37 -7
  121. package/dist/{Runtime-B-aL-f29.d.cts → Runtime-PShIC4DW.d.cts} +37 -7
  122. package/dist/Runtime.cjs +1899 -809
  123. package/dist/Runtime.cjs.map +1 -1
  124. package/dist/Runtime.d.cts +14 -11
  125. package/dist/Runtime.d.ts +14 -11
  126. package/dist/Runtime.js +33 -28
  127. package/dist/ScopeRegistry.cjs +668 -10
  128. package/dist/ScopeRegistry.cjs.map +1 -1
  129. package/dist/ScopeRegistry.js +6 -3
  130. package/dist/{StateTrait-OWhbj12c.d.cts → StateTrait-CQsDlXJm.d.cts} +23 -6
  131. package/dist/{StateTrait-BGsZghTz.d.ts → StateTrait-YvJzVDKl.d.ts} +23 -6
  132. package/dist/StateTrait.cjs +1475 -370
  133. package/dist/StateTrait.cjs.map +1 -1
  134. package/dist/StateTrait.d.cts +7 -5
  135. package/dist/StateTrait.d.ts +7 -5
  136. package/dist/StateTrait.js +17 -14
  137. package/dist/{TraitLifecycle-LdIWmKlg.d.ts → TraitLifecycle-CjIBICAA.d.ts} +2 -2
  138. package/dist/{TraitLifecycle-CwV5WPFX.d.cts → TraitLifecycle-NmqGiXPC.d.cts} +2 -2
  139. package/dist/TraitLifecycle.cjs +489 -32
  140. package/dist/TraitLifecycle.cjs.map +1 -1
  141. package/dist/TraitLifecycle.d.cts +4 -4
  142. package/dist/TraitLifecycle.d.ts +4 -4
  143. package/dist/TraitLifecycle.js +7 -7
  144. package/dist/Workflow-BlFG_20_.d.cts +414 -0
  145. package/dist/Workflow-CW9S_aAP.d.ts +414 -0
  146. package/dist/Workflow.cjs +2977 -0
  147. package/dist/Workflow.cjs.map +1 -0
  148. package/dist/Workflow.d.cts +7 -0
  149. package/dist/Workflow.d.ts +7 -0
  150. package/dist/Workflow.js +55 -0
  151. package/dist/Workflow.js.map +1 -0
  152. package/dist/{chunk-G5ZBFPNU.js → chunk-2A4UKO2D.js} +2 -2
  153. package/dist/chunk-2DE6D42I.js +248 -0
  154. package/dist/chunk-2DE6D42I.js.map +1 -0
  155. package/dist/{chunk-ANLBCBDC.js → chunk-2DVLMSOE.js} +6 -6
  156. package/dist/{chunk-BE3HW4FY.js → chunk-34CF6OGE.js} +14 -16
  157. package/dist/chunk-34CF6OGE.js.map +1 -0
  158. package/dist/{chunk-ZFY7U2FR.js → chunk-3LPIXG56.js} +43 -3
  159. package/dist/chunk-3LPIXG56.js.map +1 -0
  160. package/dist/chunk-3VZYDNXZ.js +10 -0
  161. package/dist/chunk-3VZYDNXZ.js.map +1 -0
  162. package/dist/{chunk-3TMODYZV.js → chunk-3XO4HR6V.js} +2 -2
  163. package/dist/chunk-46FGVWRF.js +817 -0
  164. package/dist/chunk-46FGVWRF.js.map +1 -0
  165. package/dist/chunk-4LODUXFI.js +288 -0
  166. package/dist/chunk-4LODUXFI.js.map +1 -0
  167. package/dist/{chunk-GMPEOUP2.js → chunk-4MZ7BT3R.js} +2 -2
  168. package/dist/chunk-4MZ7BT3R.js.map +1 -0
  169. package/dist/{chunk-TKZ7MEIA.js → chunk-53GVPGSM.js} +2 -2
  170. package/dist/{chunk-KP7MUZNX.js → chunk-5W2V2NVJ.js} +2 -2
  171. package/dist/chunk-5W2V2NVJ.js.map +1 -0
  172. package/dist/chunk-6DACKW3D.js +613 -0
  173. package/dist/chunk-6DACKW3D.js.map +1 -0
  174. package/dist/chunk-AQ7L2QZ5.js +1395 -0
  175. package/dist/chunk-AQ7L2QZ5.js.map +1 -0
  176. package/dist/{chunk-NZJKFF45.js → chunk-C2UZZQ76.js} +2 -2
  177. package/dist/chunk-CCKP5Z6F.js +701 -0
  178. package/dist/chunk-CCKP5Z6F.js.map +1 -0
  179. package/dist/chunk-CUKM2XUW.js +27 -0
  180. package/dist/{chunk-QCHIQWAJ.js.map → chunk-CUKM2XUW.js.map} +1 -1
  181. package/dist/{chunk-M2RGJPXX.js → chunk-DBD6Q6JH.js} +3 -3
  182. package/dist/{chunk-ZGDVUPTM.js → chunk-EB4RGQO3.js} +2 -2
  183. package/dist/{chunk-PAYXCY6A.js → chunk-G7ESIQTI.js} +12 -14
  184. package/dist/chunk-G7ESIQTI.js.map +1 -0
  185. package/dist/chunk-GPBAZQ23.js +348 -0
  186. package/dist/chunk-GPBAZQ23.js.map +1 -0
  187. package/dist/{chunk-OFADUJWJ.js → chunk-I4LCE5OY.js} +3 -5
  188. package/dist/{chunk-OFADUJWJ.js.map → chunk-I4LCE5OY.js.map} +1 -1
  189. package/dist/{chunk-DFNM3WX2.js → chunk-IMCC6TBN.js} +158 -39
  190. package/dist/chunk-IMCC6TBN.js.map +1 -0
  191. package/dist/{chunk-76WT3HOR.js → chunk-IROZNQAF.js} +22 -21
  192. package/dist/chunk-IROZNQAF.js.map +1 -0
  193. package/dist/{chunk-TAAPQVZN.js → chunk-ISKNULNH.js} +2 -2
  194. package/dist/chunk-J3CWXIPV.js +242 -0
  195. package/dist/chunk-J3CWXIPV.js.map +1 -0
  196. package/dist/{chunk-PYOE4VSI.js → chunk-JBKYRTCS.js} +224 -161
  197. package/dist/chunk-JBKYRTCS.js.map +1 -0
  198. package/dist/{chunk-66ALHVEX.js → chunk-KKIAYH4X.js} +3 -3
  199. package/dist/{chunk-3RMKLXHX.js → chunk-KLDVG3SY.js} +2 -2
  200. package/dist/{chunk-BABLDP24.js → chunk-KSZQYSEH.js} +3 -3
  201. package/dist/chunk-KSZQYSEH.js.map +1 -0
  202. package/dist/{chunk-CW6T36TN.js → chunk-M3M7JFAH.js} +4 -4
  203. package/dist/chunk-M3M7JFAH.js.map +1 -0
  204. package/dist/{chunk-THATMZXD.js → chunk-MLB253V2.js} +2 -2
  205. package/dist/{chunk-THATMZXD.js.map → chunk-MLB253V2.js.map} +1 -1
  206. package/dist/{chunk-JGIWG6SR.js → chunk-MS77U77X.js} +664 -550
  207. package/dist/chunk-MS77U77X.js.map +1 -0
  208. package/dist/chunk-MW4FA3MW.js +23 -0
  209. package/dist/chunk-MW4FA3MW.js.map +1 -0
  210. package/dist/chunk-MYKNINNN.js +228 -0
  211. package/dist/chunk-MYKNINNN.js.map +1 -0
  212. package/dist/{chunk-4CQAV7YB.js → chunk-O6TTQXTY.js} +2 -2
  213. package/dist/{chunk-NBD3KUOZ.js → chunk-OJDJ4VDQ.js} +35 -24
  214. package/dist/chunk-OJDJ4VDQ.js.map +1 -0
  215. package/dist/{chunk-NQZ2OSGR.js → chunk-PVZEMNJY.js} +9 -9
  216. package/dist/chunk-PVZEMNJY.js.map +1 -0
  217. package/dist/chunk-RN26DV2M.js +271 -0
  218. package/dist/chunk-RN26DV2M.js.map +1 -0
  219. package/dist/{chunk-JCXGZRMU.js → chunk-RQQW3IQC.js} +3 -3
  220. package/dist/chunk-RQQW3IQC.js.map +1 -0
  221. package/dist/{chunk-24VULZ7A.js → chunk-TKOGZDD6.js} +3 -3
  222. package/dist/{chunk-EGK3KN7B.js → chunk-TQYLVXGY.js} +70 -39
  223. package/dist/chunk-TQYLVXGY.js.map +1 -0
  224. package/dist/{chunk-QMM6O4CD.js → chunk-UACD2CL2.js} +15 -3
  225. package/dist/{chunk-QMM6O4CD.js.map → chunk-UACD2CL2.js.map} +1 -1
  226. package/dist/{chunk-M3WTHJHJ.js → chunk-VH575UTV.js} +30 -34
  227. package/dist/chunk-VH575UTV.js.map +1 -0
  228. package/dist/{chunk-AUIR5O6W.js → chunk-WWBMC24F.js} +9 -15
  229. package/dist/chunk-WWBMC24F.js.map +1 -0
  230. package/dist/{chunk-JWOYLO27.js → chunk-WYJUJV4L.js} +80 -7
  231. package/dist/chunk-WYJUJV4L.js.map +1 -0
  232. package/dist/{chunk-EY4NZKDR.js → chunk-XFMMPYNU.js} +2 -2
  233. package/dist/chunk-Y4VRBIS6.js +35 -0
  234. package/dist/chunk-Y4VRBIS6.js.map +1 -0
  235. package/dist/{chunk-DMBALCE2.js → chunk-ZC7MSQ5U.js} +77 -4
  236. package/dist/chunk-ZC7MSQ5U.js.map +1 -0
  237. package/dist/{chunk-OGWBVHB3.js → chunk-ZCK6SCOE.js} +67 -8
  238. package/dist/chunk-ZCK6SCOE.js.map +1 -0
  239. package/dist/{chunk-IHVBV5C2.js → chunk-ZTFTABXV.js} +2 -1
  240. package/dist/chunk-ZTFTABXV.js.map +1 -0
  241. package/dist/index.cjs +9532 -5017
  242. package/dist/index.cjs.map +1 -1
  243. package/dist/index.d.cts +163 -27
  244. package/dist/index.d.ts +163 -27
  245. package/dist/index.js +119 -56
  246. package/dist/index.js.map +1 -1
  247. package/dist/{ir-BMP7yxJJ.d.cts → ir-C-Zm_GlZ.d.cts} +1 -1
  248. package/dist/{ir-DUOz6H-5.d.ts → ir-DGyGiwVe.d.ts} +1 -1
  249. package/dist/{module-k7m3txak.d.ts → module-DqQ1U-Me.d.ts} +129 -100
  250. package/dist/{module-B8CBqIZ_.d.cts → module-doenaCsZ.d.cts} +129 -100
  251. package/package.json +12 -1
  252. package/dist/ModuleTag-C8FHY_sY.d.ts +0 -93
  253. package/dist/ModuleTag-EGbgBMpZ.d.cts +0 -93
  254. package/dist/chunk-3QMIVH35.js +0 -43
  255. package/dist/chunk-3QMIVH35.js.map +0 -1
  256. package/dist/chunk-76WT3HOR.js.map +0 -1
  257. package/dist/chunk-AUIR5O6W.js.map +0 -1
  258. package/dist/chunk-BABLDP24.js.map +0 -1
  259. package/dist/chunk-BE3HW4FY.js.map +0 -1
  260. package/dist/chunk-CW6T36TN.js.map +0 -1
  261. package/dist/chunk-DFNM3WX2.js.map +0 -1
  262. package/dist/chunk-DMBALCE2.js.map +0 -1
  263. package/dist/chunk-EGK3KN7B.js.map +0 -1
  264. package/dist/chunk-GMPEOUP2.js.map +0 -1
  265. package/dist/chunk-IHVBV5C2.js.map +0 -1
  266. package/dist/chunk-JCXGZRMU.js.map +0 -1
  267. package/dist/chunk-JGIWG6SR.js.map +0 -1
  268. package/dist/chunk-JWOYLO27.js.map +0 -1
  269. package/dist/chunk-KIXAU3GM.js +0 -137
  270. package/dist/chunk-KIXAU3GM.js.map +0 -1
  271. package/dist/chunk-KP7MUZNX.js.map +0 -1
  272. package/dist/chunk-M3WTHJHJ.js.map +0 -1
  273. package/dist/chunk-M7IYCTJV.js +0 -79
  274. package/dist/chunk-M7IYCTJV.js.map +0 -1
  275. package/dist/chunk-NBD3KUOZ.js.map +0 -1
  276. package/dist/chunk-NQZ2OSGR.js.map +0 -1
  277. package/dist/chunk-OGWBVHB3.js.map +0 -1
  278. package/dist/chunk-PAYXCY6A.js.map +0 -1
  279. package/dist/chunk-PYOE4VSI.js.map +0 -1
  280. package/dist/chunk-QCHIQWAJ.js +0 -21
  281. package/dist/chunk-VZB726PE.js +0 -93
  282. package/dist/chunk-VZB726PE.js.map +0 -1
  283. package/dist/chunk-W3TEWHLO.js +0 -568
  284. package/dist/chunk-W3TEWHLO.js.map +0 -1
  285. package/dist/chunk-ZFLHVFUC.js +0 -192
  286. package/dist/chunk-ZFLHVFUC.js.map +0 -1
  287. package/dist/chunk-ZFY7U2FR.js.map +0 -1
  288. /package/dist/{chunk-G5ZBFPNU.js.map → chunk-2A4UKO2D.js.map} +0 -0
  289. /package/dist/{chunk-ANLBCBDC.js.map → chunk-2DVLMSOE.js.map} +0 -0
  290. /package/dist/{chunk-3TMODYZV.js.map → chunk-3XO4HR6V.js.map} +0 -0
  291. /package/dist/{chunk-TKZ7MEIA.js.map → chunk-53GVPGSM.js.map} +0 -0
  292. /package/dist/{chunk-NZJKFF45.js.map → chunk-C2UZZQ76.js.map} +0 -0
  293. /package/dist/{chunk-M2RGJPXX.js.map → chunk-DBD6Q6JH.js.map} +0 -0
  294. /package/dist/{chunk-ZGDVUPTM.js.map → chunk-EB4RGQO3.js.map} +0 -0
  295. /package/dist/{chunk-TAAPQVZN.js.map → chunk-ISKNULNH.js.map} +0 -0
  296. /package/dist/{chunk-66ALHVEX.js.map → chunk-KKIAYH4X.js.map} +0 -0
  297. /package/dist/{chunk-3RMKLXHX.js.map → chunk-KLDVG3SY.js.map} +0 -0
  298. /package/dist/{chunk-4CQAV7YB.js.map → chunk-O6TTQXTY.js.map} +0 -0
  299. /package/dist/{chunk-24VULZ7A.js.map → chunk-TKOGZDD6.js.map} +0 -0
  300. /package/dist/{chunk-EY4NZKDR.js.map → chunk-XFMMPYNU.js.map} +0 -0
@@ -3,7 +3,7 @@ import { Schema, Cause, Effect, Stream, Context, SubscriptionRef, Layer } from '
3
3
  import { Draft as Draft$1 } from 'mutative';
4
4
  import { S as Service } from './Platform-C49Pv956.cjs';
5
5
  import { c as AnyActionToken, a as ActionToken } from './action-DiMDD_0v.cjs';
6
- import { d as ReadQuery, f as ReadQueryInput } from './ReadQuery-SinbStGF.cjs';
6
+ import { g as ReadQuery, a as ReadQueryInput } from './ReadQuery-CafjlJQo.cjs';
7
7
 
8
8
  interface SerializableErrorSummary {
9
9
  readonly message: string;
@@ -58,7 +58,7 @@ interface LifecycleStatus {
58
58
  type FieldPath = ReadonlyArray<string>;
59
59
  type FieldPathId = number;
60
60
  type DirtyAllReason = 'unknownWrite' | 'customMutation' | 'nonTrackablePatch' | 'fallbackPolicy';
61
- type PatchReason = 'reducer' | 'trait-computed' | 'trait-link' | 'source-refresh' | 'devtools' | 'perf' | 'unknown';
61
+ type PatchReason = 'reducer' | 'trait-computed' | 'trait-link' | 'trait-external-store' | 'source-refresh' | 'devtools' | 'perf' | 'unknown';
62
62
  interface DirtySet {
63
63
  readonly dirtyAll: boolean;
64
64
  /**
@@ -125,6 +125,16 @@ type StateFieldPath<S> = FieldPathInner<S, 4>;
125
125
  */
126
126
  type StateAtPath<S, P> = S extends object ? P extends `${infer K}.${infer Rest}` ? K extends keyof S ? StateAtPath<S[K], Rest> : never : P extends keyof S ? S[P] : never : never;
127
127
 
128
+ type JsonValue = null | boolean | number | string | ReadonlyArray<JsonValue> | {
129
+ readonly [key: string]: JsonValue;
130
+ };
131
+ type DowngradeReason = 'non_serializable' | 'oversized' | 'unknown';
132
+ interface JsonValueProjectionStats {
133
+ readonly dropped: number;
134
+ readonly oversized: number;
135
+ readonly nonSerializable: number;
136
+ }
137
+
128
138
  type TraitMeta = Readonly<{
129
139
  readonly label?: string;
130
140
  readonly description?: string;
@@ -150,10 +160,6 @@ type TraitMetaConflict = Readonly<{
150
160
  readonly origin: string;
151
161
  readonly meta: TraitMeta;
152
162
  }>;
153
- type JsonPrimitive = string | number | boolean | null;
154
- type JsonValue = JsonPrimitive | ReadonlyArray<JsonValue> | {
155
- readonly [key: string]: JsonValue;
156
- };
157
163
 
158
164
  type ConvergeStepId = number;
159
165
  /**
@@ -262,7 +268,8 @@ interface ConvergeExecIr {
262
268
  type StateTraitSpec<S> = S extends object ? {
263
269
  [Path in StateFieldPath<S> | '$root']?: StateTraitSpecValue<S, Path>;
264
270
  } : never;
265
- type StateTraitKind = 'computed' | 'source' | 'link' | 'check';
271
+ type StateTraitKind = 'computed' | 'source' | 'link' | 'externalStore' | 'check';
272
+ type TraitLane = 'urgent' | 'nonUrgent';
266
273
  /**
267
274
  * TraitConvergeScheduling:
268
275
  * - Scheduling semantics for converge/dirty-check (043): decides whether a step must converge within each transaction window.
@@ -333,6 +340,20 @@ interface LinkMeta<S> {
333
340
  */
334
341
  readonly scheduling?: TraitConvergeScheduling;
335
342
  }
343
+ interface ExternalStoreLike<T> {
344
+ readonly getSnapshot: () => T;
345
+ readonly getServerSnapshot?: () => T;
346
+ readonly subscribe: (listener: () => void) => () => void;
347
+ }
348
+ interface ExternalStoreMeta<S, P, T = unknown> {
349
+ readonly store: ExternalStoreLike<T>;
350
+ readonly select?: (snapshot: T) => StateAtPath<S, P>;
351
+ readonly equals?: (prev: StateAtPath<S, P>, next: StateAtPath<S, P>) => boolean;
352
+ readonly coalesceWindowMs?: number;
353
+ readonly priority?: TraitLane;
354
+ readonly meta?: TraitMeta;
355
+ readonly _fieldPath?: P;
356
+ }
336
357
  type CheckRule<Input = unknown, Ctx = unknown> = {
337
358
  readonly deps: ReadonlyArray<string>;
338
359
  /**
@@ -374,6 +395,10 @@ type StateTraitEntry<S = unknown, P extends string = StateFieldPath<S>> = {
374
395
  readonly fieldPath: P;
375
396
  readonly kind: 'link';
376
397
  readonly meta: LinkMeta<S>;
398
+ } | {
399
+ readonly fieldPath: P;
400
+ readonly kind: 'externalStore';
401
+ readonly meta: ExternalStoreMeta<S, P>;
377
402
  } | {
378
403
  readonly fieldPath: P;
379
404
  readonly kind: 'check';
@@ -384,6 +409,7 @@ interface StateTraitNode<Input = unknown, Ctx = unknown> {
384
409
  readonly computed?: StateTraitEntry<Input, any> | Readonly<Record<string, StateTraitEntry<Input, any>>>;
385
410
  readonly source?: StateTraitEntry<Input, any> | Readonly<Record<string, StateTraitEntry<Input, any>>>;
386
411
  readonly link?: StateTraitEntry<Input, any> | Readonly<Record<string, StateTraitEntry<Input, any>>>;
412
+ readonly externalStore?: StateTraitEntry<Input, any> | Readonly<Record<string, StateTraitEntry<Input, any>>>;
387
413
  readonly check?: Readonly<Record<string, CheckRule<Input, Ctx>>>;
388
414
  readonly meta?: TraitMeta;
389
415
  }
@@ -416,7 +442,7 @@ interface StateTraitField {
416
442
  interface StateTraitFieldTrait {
417
443
  readonly fieldId: string;
418
444
  readonly kind: StateTraitKind;
419
- readonly meta: ComputedMeta<unknown, string> | SourceMeta<unknown, string> | LinkMeta<unknown> | CheckMeta<unknown, unknown>;
445
+ readonly meta: ComputedMeta<unknown, string> | SourceMeta<unknown, string> | LinkMeta<unknown> | ExternalStoreMeta<unknown, string> | CheckMeta<unknown, unknown>;
420
446
  readonly deps: ReadonlyArray<string>;
421
447
  }
422
448
  /**
@@ -472,7 +498,7 @@ interface StateTraitGraph {
472
498
  */
473
499
  interface StateTraitPlanStep {
474
500
  readonly id: string;
475
- readonly kind: 'computed-update' | 'link-propagate' | 'source-refresh' | 'check-validate';
501
+ readonly kind: 'computed-update' | 'link-propagate' | 'source-refresh' | 'external-store-sync' | 'check-validate';
476
502
  readonly targetFieldPath?: string;
477
503
  readonly sourceFieldPaths?: ReadonlyArray<string>;
478
504
  readonly resourceId?: string;
@@ -676,8 +702,8 @@ interface TaskRunnerOrigins {
676
702
  readonly success?: StateTxnOrigin;
677
703
  readonly failure?: StateTxnOrigin;
678
704
  }
679
- type TaskHandler<Payload, Sh extends AnyModuleShape, R> = Of<Sh, R, void, never> | ((payload: Payload) => Of<Sh, R, void, never>);
680
- type TaskEffect<Payload, Sh extends AnyModuleShape, R, A, E> = Of<Sh, R, A, E> | ((payload: Payload) => Of<Sh, R, A, E>);
705
+ type TaskHandler<Payload, Sh extends AnyModuleShape, R> = LogicEffect<Sh, R, void, never> | ((payload: Payload) => LogicEffect<Sh, R, void, never>);
706
+ type TaskEffect<Payload, Sh extends AnyModuleShape, R, A, E> = LogicEffect<Sh, R, A, E> | ((payload: Payload) => LogicEffect<Sh, R, A, E>);
681
707
  interface TaskRunnerConfig<Payload, Sh extends AnyModuleShape, R, A = void, E = never> {
682
708
  /**
683
709
  * Optional: trigger source name (e.g. actionTag / fieldPath), used as the default pending origin.name.
@@ -697,13 +723,13 @@ interface TaskRunnerConfig<Payload, Sh extends AnyModuleShape, R, A = void, E =
697
723
  /**
698
724
  * success: success writeback (separate transaction entry).
699
725
  */
700
- readonly success?: (result: A, payload: Payload) => Of<Sh, R, void, never>;
726
+ readonly success?: (result: A, payload: Payload) => LogicEffect<Sh, R, void, never>;
701
727
  /**
702
728
  * failure: failure writeback (separate transaction entry).
703
729
  *
704
730
  * Note: takes a Cause to preserve defect/interrupt semantics; interrupts do not trigger failure writeback by default.
705
731
  */
706
- readonly failure?: (cause: Cause.Cause<E>, payload: Payload) => Of<Sh, R, void, never>;
732
+ readonly failure?: (cause: Cause.Cause<E>, payload: Payload) => LogicEffect<Sh, R, void, never>;
707
733
  /**
708
734
  * origin: optional override for the three transaction origins.
709
735
  * - Default: pending.kind="task:pending"; success/failure.kind="service-callback".
@@ -797,10 +823,10 @@ interface Api<Sh extends ModuleShape<any, any>, R = never> {
797
823
  readonly debounce: <V>(ms: number) => (stream: Stream.Stream<V>) => Stream.Stream<V>;
798
824
  readonly throttle: <V>(ms: number) => (stream: Stream.Stream<V>) => Stream.Stream<V>;
799
825
  readonly filter: <V>(predicate: (value: V) => boolean) => (stream: Stream.Stream<V>) => Stream.Stream<V>;
800
- readonly run: <V, A = void, E = never, R2 = unknown>(eff: Of<Sh, R & R2, A, E> | ((payload: V) => Of<Sh, R & R2, A, E>), options?: OperationOptions) => (stream: Stream.Stream<V>) => Effect.Effect<void, E, Env<Sh, R & R2>>;
801
- readonly runParallel: <V, A = void, E = never, R2 = unknown>(eff: Of<Sh, R & R2, A, E> | ((payload: V) => Of<Sh, R & R2, A, E>), options?: OperationOptions) => (stream: Stream.Stream<V>) => Effect.Effect<void, E, Env<Sh, R & R2>>;
802
- readonly runLatest: <V, A = void, E = never, R2 = unknown>(eff: Of<Sh, R & R2, A, E> | ((payload: V) => Of<Sh, R & R2, A, E>), options?: OperationOptions) => (stream: Stream.Stream<V>) => Effect.Effect<void, E, Env<Sh, R & R2>>;
803
- readonly runExhaust: <V, A = void, E = never, R2 = unknown>(eff: Of<Sh, R & R2, A, E> | ((payload: V) => Of<Sh, R & R2, A, E>), options?: OperationOptions) => (stream: Stream.Stream<V>) => Effect.Effect<void, E, Env<Sh, R & R2>>;
826
+ readonly run: <V, A = void, E = never, R2 = unknown>(eff: LogicEffect<Sh, R & R2, A, E> | ((payload: V) => LogicEffect<Sh, R & R2, A, E>), options?: OperationOptions) => (stream: Stream.Stream<V>) => LogicEffect<Sh, R & R2, void, E>;
827
+ readonly runParallel: <V, A = void, E = never, R2 = unknown>(eff: LogicEffect<Sh, R & R2, A, E> | ((payload: V) => LogicEffect<Sh, R & R2, A, E>), options?: OperationOptions) => (stream: Stream.Stream<V>) => LogicEffect<Sh, R & R2, void, E>;
828
+ readonly runLatest: <V, A = void, E = never, R2 = unknown>(eff: LogicEffect<Sh, R & R2, A, E> | ((payload: V) => LogicEffect<Sh, R & R2, A, E>), options?: OperationOptions) => (stream: Stream.Stream<V>) => LogicEffect<Sh, R & R2, void, E>;
829
+ readonly runExhaust: <V, A = void, E = never, R2 = unknown>(eff: LogicEffect<Sh, R & R2, A, E> | ((payload: V) => LogicEffect<Sh, R & R2, A, E>), options?: OperationOptions) => (stream: Stream.Stream<V>) => LogicEffect<Sh, R & R2, void, E>;
804
830
  }
805
831
 
806
832
  /**
@@ -809,14 +835,19 @@ interface Api<Sh extends ModuleShape<any, any>, R = never> {
809
835
  * ModuleShape<SpecificSchema> can extend AnyModuleShape.
810
836
  */
811
837
  type AnySchema = any;
838
+ type NormalizeSchema<S> = S extends Schema.Schema<infer A, any, any> ? Schema.Schema<A, any, any> : S;
839
+ type NormalizeActionToken<T> = T extends ActionToken<infer Tag, infer Payload, any> ? ActionToken<Tag, Payload, Schema.Schema<any, any, any>> : T;
840
+ type NormalizeActionMap<AMap extends Record<string, AnyActionToken>> = {
841
+ readonly [K in keyof AMap]: NormalizeActionToken<AMap[K]>;
842
+ };
812
843
  /**
813
844
  * The "schema shape" of a Module: only cares about stateSchema / actionSchema,
814
845
  * not runtime configuration details (initialState / services / logic, etc.).
815
846
  */
816
847
  interface ModuleShape<SSchema extends AnySchema, ASchema extends AnySchema, AMap extends Record<string, AnyActionToken> = Record<string, never>> {
817
- readonly stateSchema: SSchema;
818
- readonly actionSchema: ASchema;
819
- readonly actionMap: AMap;
848
+ readonly stateSchema: NormalizeSchema<SSchema>;
849
+ readonly actionSchema: NormalizeSchema<ASchema>;
850
+ readonly actionMap: NormalizeActionMap<AMap>;
820
851
  }
821
852
  /**
822
853
  * Convenience constraint: any ModuleShape.
@@ -824,9 +855,14 @@ interface ModuleShape<SSchema extends AnySchema, ASchema extends AnySchema, AMap
824
855
  type AnyModuleShape = ModuleShape<any, any, any>;
825
856
  type StateOf<Sh extends AnyModuleShape> = Schema.Schema.Type<Sh['stateSchema']>;
826
857
  type ActionOf<Sh extends AnyModuleShape> = Schema.Schema.Type<Sh['actionSchema']>;
858
+ type ModuleRuntimeOfShape<Sh extends AnyModuleShape> = ModuleRuntime<StateOf<Sh>, ActionOf<Sh>>;
827
859
  type ActionArgs<P> = [P] extends [void] ? [] | [P] : [P];
828
- type ActionFn<P, Out> = (...args: ActionArgs<P>) => Out;
829
- type ActionPayload<T> = T extends ActionToken<any, infer P, any> ? P : never;
860
+ type ActionPayloadOfToken<T> = T extends ActionToken<any, infer P, any> ? P : never;
861
+ type ActionCallable<P, Out> = {
862
+ (payload: P): Out;
863
+ } & ([P] extends [void] ? {
864
+ (): Out;
865
+ } : {});
830
866
  interface ModuleImplementStateTransactionOptions {
831
867
  readonly instrumentation?: StateTransactionInstrumentation;
832
868
  /** 060: Txn Lanes (instance-level opt-in / tuning). */
@@ -908,7 +944,7 @@ interface ModuleRuntime<S, A> {
908
944
  * - The Id type is not important for this PoC, so we use `any`.
909
945
  * - The Service type is fixed to the Runtime for the current Shape.
910
946
  */
911
- type ModuleRuntimeTag<Sh extends AnyModuleShape> = Context.Tag<any, ModuleRuntime<StateOf<Sh>, ActionOf<Sh>>>;
947
+ type ModuleRuntimeTag<Sh extends AnyModuleShape> = Context.Tag<any, ModuleRuntimeOfShape<Sh>>;
912
948
  /**
913
949
  * Module handle union:
914
950
  * - Used by the React adapter / higher-level integrations to accept either a tag or a runtime instance.
@@ -917,7 +953,7 @@ type ModuleRuntimeTag<Sh extends AnyModuleShape> = Context.Tag<any, ModuleRuntim
917
953
  *
918
954
  * Higher-level APIs may accept ModuleHandle<Sh> and branch internally on tag vs instance.
919
955
  */
920
- type ModuleHandleUnion<Sh extends AnyModuleShape> = ModuleRuntime<StateOf<Sh>, ActionOf<Sh>> | ModuleRuntimeTag<Sh>;
956
+ type ModuleHandleUnion<Sh extends AnyModuleShape> = ModuleRuntimeOfShape<Sh> | ModuleRuntimeTag<Sh>;
921
957
  /**
922
958
  * v3: a read-only handle view exposed to Logic for cross-module access.
923
959
  *
@@ -932,7 +968,7 @@ interface ModuleHandle<Sh extends AnyModuleShape> {
932
968
  readonly changes: <V>(selector: (s: StateOf<Sh>) => V) => Stream.Stream<V, never, never>;
933
969
  readonly dispatch: (action: ActionOf<Sh>) => Effect.Effect<void, never, never>;
934
970
  readonly actions: {
935
- [K in keyof Sh['actionMap']]: ActionFn<ActionPayload<Sh['actionMap'][K]>, Effect.Effect<void, never, never>>;
971
+ [K in keyof Sh['actionMap']]: ActionCallable<ActionPayloadOfToken<Sh['actionMap'][K]>, Effect.Effect<void, never, never>>;
936
972
  };
937
973
  readonly actions$: Stream.Stream<ActionOf<Sh>, never, never>;
938
974
  }
@@ -977,9 +1013,59 @@ type ModuleExtOf<M> = M extends ModuleLike<any, any, infer Ext> ? Ext : never;
977
1013
  * - After the runtime-logix L4 drafts converge, we will gradually adopt a real two-phase execution model.
978
1014
  */
979
1015
  interface LogicPlan<Sh extends AnyModuleShape, R = unknown, E = unknown> {
980
- readonly setup: Of<Sh, R, void, never>;
981
- readonly run: Of<Sh, R, unknown, E>;
1016
+ readonly setup: DispatchEffect<Sh, R>;
1017
+ readonly run: LogicEffect<Sh, R, unknown, E>;
982
1018
  }
1019
+ type LogicEffect<Sh extends AnyModuleShape, R = never, A = void, E = never> = Of<Sh, R, A, E>;
1020
+ type DispatchEffect<Sh extends AnyModuleShape, R = never> = LogicEffect<Sh, R, void, never>;
1021
+ type ActionForTag<Sh extends AnyModuleShape, K extends keyof Sh['actionMap']> = Extract<ActionOf<Sh>, {
1022
+ _tag: K;
1023
+ } | {
1024
+ type: K;
1025
+ }>;
1026
+ type BoundApiRootApi<Sh extends AnyModuleShape, R = never> = {
1027
+ readonly resolve: <Svc, Id = unknown>(tag: Context.Tag<Id, Svc>) => LogicEffect<Sh, R, Svc, never>;
1028
+ };
1029
+ type BoundApiStateApi<Sh extends AnyModuleShape, R = never> = {
1030
+ readonly read: LogicEffect<Sh, R, StateOf<Sh>, never>;
1031
+ readonly update: (f: (prev: StateOf<Sh>) => StateOf<Sh>) => DispatchEffect<Sh, R>;
1032
+ readonly mutate: (f: (draft: Draft<StateOf<Sh>>) => void) => DispatchEffect<Sh, R>;
1033
+ readonly ref: {
1034
+ <V = StateOf<Sh>>(selector?: (s: StateOf<Sh>) => V): SubscriptionRef.SubscriptionRef<V>;
1035
+ };
1036
+ };
1037
+ type BoundApiDispatchersApi<Sh extends AnyModuleShape, R = never> = {
1038
+ readonly [K in keyof Sh['actionMap']]: ActionCallable<ActionPayloadOfToken<Sh['actionMap'][K]>, DispatchEffect<Sh, R>>;
1039
+ };
1040
+ type BoundApiDispatchApi<Sh extends AnyModuleShape, R = never> = {
1041
+ (action: ActionOf<Sh>): DispatchEffect<Sh, R>;
1042
+ <K extends keyof Sh['actionMap']>(token: Sh['actionMap'][K], ...args: ActionArgs<ActionPayloadOfToken<Sh['actionMap'][K]>>): DispatchEffect<Sh, R>;
1043
+ <K extends keyof Sh['actionMap']>(tag: K, ...args: ActionArgs<ActionPayloadOfToken<Sh['actionMap'][K]>>): DispatchEffect<Sh, R>;
1044
+ };
1045
+ type BoundApiLifecycleApi<Sh extends AnyModuleShape, R = never> = {
1046
+ readonly onInitRequired: (eff: DispatchEffect<Sh, R>) => DispatchEffect<Sh, R>;
1047
+ readonly onStart: (eff: DispatchEffect<Sh, R>) => DispatchEffect<Sh, R>;
1048
+ readonly onInit: (eff: DispatchEffect<Sh, R>) => DispatchEffect<Sh, R>;
1049
+ readonly onDestroy: (eff: DispatchEffect<Sh, R>) => DispatchEffect<Sh, R>;
1050
+ readonly onError: (handler: (cause: effect.Cause.Cause<unknown>, context: ErrorContext) => Effect.Effect<void, never, R>) => DispatchEffect<Sh, R>;
1051
+ readonly onSuspend: (eff: DispatchEffect<Sh, R>) => DispatchEffect<Sh, R>;
1052
+ readonly onResume: (eff: DispatchEffect<Sh, R>) => DispatchEffect<Sh, R>;
1053
+ readonly onReset: (eff: DispatchEffect<Sh, R>) => DispatchEffect<Sh, R>;
1054
+ };
1055
+ type BoundApiUseApi<Sh extends AnyModuleShape, R = never> = {
1056
+ <M extends ModuleLike<string, AnyModuleShape, any>>(module: M): LogicEffect<Sh, R, ModuleHandle<ModuleShapeOf<M>> & ModuleExtOf<M>, never>;
1057
+ <Sh2 extends AnyModuleShape>(module: ModuleTag<string, Sh2>): LogicEffect<Sh, R, ModuleHandle<Sh2>, never>;
1058
+ <Svc, Id = unknown>(tag: Context.Tag<Id, Svc>): LogicEffect<Sh, R, Svc, never>;
1059
+ };
1060
+ type BoundApiTraitsApi<Sh extends AnyModuleShape, R = never> = {
1061
+ readonly declare: (traits: TraitSpec) => void;
1062
+ readonly source: {
1063
+ readonly refresh: (fieldPath: string, options?: {
1064
+ readonly force?: boolean;
1065
+ }) => DispatchEffect<Sh, R>;
1066
+ };
1067
+ };
1068
+ type BoundApiReducerApi<Sh extends AnyModuleShape, R = never> = <K extends keyof Sh['actionMap']>(tag: K, reducer: (state: StateOf<Sh>, action: ActionForTag<Sh, K>) => StateOf<Sh>) => DispatchEffect<Sh, R>;
983
1069
  /**
984
1070
  * Bound API: creates pre-bound accessors for a given Store shape + Env.
985
1071
  *
@@ -987,26 +1073,11 @@ interface LogicPlan<Sh extends AnyModuleShape, R = unknown, E = unknown> {
987
1073
  * - The public Bound.ts exports a same-named type alias to keep the public API consistent.
988
1074
  */
989
1075
  interface BoundApi<Sh extends AnyModuleShape, R = never> {
990
- readonly root: {
991
- readonly resolve: <Svc, Id = unknown>(tag: Context.Tag<Id, Svc>) => Of<Sh, R, Svc, never>;
992
- };
993
- readonly state: {
994
- readonly read: Of<Sh, R, StateOf<Sh>, never>;
995
- readonly update: (f: (prev: StateOf<Sh>) => StateOf<Sh>) => Of<Sh, R, void, never>;
996
- readonly mutate: (f: (draft: Draft<StateOf<Sh>>) => void) => Of<Sh, R, void, never>;
997
- readonly ref: {
998
- <V = StateOf<Sh>>(selector?: (s: StateOf<Sh>) => V): SubscriptionRef.SubscriptionRef<V>;
999
- };
1000
- };
1076
+ readonly root: BoundApiRootApi<Sh, R>;
1077
+ readonly state: BoundApiStateApi<Sh, R>;
1001
1078
  readonly actions: Sh['actionMap'];
1002
- readonly dispatchers: {
1003
- readonly [K in keyof Sh['actionMap']]: ActionFn<ActionPayload<Sh['actionMap'][K]>, Of<Sh, R, void, never>>;
1004
- };
1005
- readonly dispatch: {
1006
- (action: ActionOf<Sh>): Of<Sh, R, void, never>;
1007
- <K extends keyof Sh['actionMap']>(token: Sh['actionMap'][K], ...args: ActionArgs<ActionPayload<Sh['actionMap'][K]>>): Of<Sh, R, void, never>;
1008
- <K extends keyof Sh['actionMap']>(tag: K, ...args: ActionArgs<ActionPayload<Sh['actionMap'][K]>>): Of<Sh, R, void, never>;
1009
- };
1079
+ readonly dispatchers: BoundApiDispatchersApi<Sh, R>;
1080
+ readonly dispatch: BoundApiDispatchApi<Sh, R>;
1010
1081
  /**
1011
1082
  * effect:
1012
1083
  * - Register a side-effect handler for a specific Action token.
@@ -1016,47 +1087,26 @@ interface BoundApi<Sh extends AnyModuleShape, R = never> {
1016
1087
  * - Handlers must run outside the transaction window (FR-012); never perform IO inside reducers/transactions.
1017
1088
  * - The runtime de-duplicates by `(actionTag, sourceKey)` (sourceKey is derived automatically).
1018
1089
  */
1019
- readonly effect: <K extends keyof Sh['actionMap']>(token: Sh['actionMap'][K], handler: (payload: ActionPayload<Sh['actionMap'][K]>) => Of<Sh, R, void, any>) => Of<Sh, R, void, never>;
1090
+ readonly effect: <K extends keyof Sh['actionMap']>(token: Sh['actionMap'][K], handler: (payload: ActionPayloadOfToken<Sh['actionMap'][K]>) => LogicEffect<Sh, R, void, any>) => DispatchEffect<Sh, R>;
1020
1091
  readonly flow: Api<Sh, R>;
1021
1092
  readonly match: <V>(value: V) => FluentMatch<V>;
1022
1093
  readonly matchTag: <V extends {
1023
1094
  _tag: string;
1024
1095
  }>(value: V) => FluentMatchTag<V>;
1025
- readonly lifecycle: {
1026
- readonly onInitRequired: (eff: Of<Sh, R, void, never>) => Of<Sh, R, void, never>;
1027
- readonly onStart: (eff: Of<Sh, R, void, never>) => Of<Sh, R, void, never>;
1028
- readonly onInit: (eff: Of<Sh, R, void, never>) => Of<Sh, R, void, never>;
1029
- readonly onDestroy: (eff: Of<Sh, R, void, never>) => Of<Sh, R, void, never>;
1030
- readonly onError: (handler: (cause: effect.Cause.Cause<unknown>, context: ErrorContext) => Effect.Effect<void, never, R>) => Of<Sh, R, void, never>;
1031
- readonly onSuspend: (eff: Of<Sh, R, void, never>) => Of<Sh, R, void, never>;
1032
- readonly onResume: (eff: Of<Sh, R, void, never>) => Of<Sh, R, void, never>;
1033
- readonly onReset: (eff: Of<Sh, R, void, never>) => Of<Sh, R, void, never>;
1034
- };
1035
- readonly use: {
1036
- <M extends ModuleLike<string, AnyModuleShape, any>>(module: M): Of<Sh, R, ModuleHandle<ModuleShapeOf<M>> & ModuleExtOf<M>, never>;
1037
- <Sh2 extends AnyModuleShape>(module: ModuleTag<string, Sh2>): Of<Sh, R, ModuleHandle<Sh2>, never>;
1038
- <Svc, Id = unknown>(tag: Context.Tag<Id, Svc>): Of<Sh, R, Svc, never>;
1039
- };
1096
+ readonly lifecycle: BoundApiLifecycleApi<Sh, R>;
1097
+ readonly use: BoundApiUseApi<Sh, R>;
1040
1098
  readonly onAction: {
1041
1099
  <T extends ActionOf<Sh>>(predicate: (a: ActionOf<Sh>) => a is T): IntentBuilder<T, Sh, R>;
1042
- <K extends keyof Sh['actionMap']>(tag: K): IntentBuilder<Extract<ActionOf<Sh>, {
1043
- _tag: K;
1044
- } | {
1045
- type: K;
1046
- }>, Sh, R>;
1100
+ <K extends keyof Sh['actionMap']>(tag: K): IntentBuilder<ActionForTag<Sh, K>, Sh, R>;
1047
1101
  <A extends ActionOf<Sh> & ({
1048
1102
  _tag: string;
1049
1103
  } | {
1050
1104
  type: string;
1051
1105
  })>(value: A): IntentBuilder<A, Sh, R>;
1052
1106
  <Sc extends AnySchema>(schema: Sc): IntentBuilder<Extract<ActionOf<Sh>, Schema.Schema.Type<Sc>>, Sh, R>;
1053
- <K extends keyof Sh['actionMap']>(token: Sh['actionMap'][K]): IntentBuilder<ActionPayload<Sh['actionMap'][K]>, Sh, R>;
1107
+ <K extends keyof Sh['actionMap']>(token: Sh['actionMap'][K]): IntentBuilder<ActionPayloadOfToken<Sh['actionMap'][K]>, Sh, R>;
1054
1108
  } & {
1055
- [K in keyof Sh['actionMap']]: IntentBuilder<Extract<ActionOf<Sh>, {
1056
- _tag: K;
1057
- } | {
1058
- type: K;
1059
- }>, Sh, R>;
1109
+ [K in keyof Sh['actionMap']]: IntentBuilder<ActionForTag<Sh, K>, Sh, R>;
1060
1110
  };
1061
1111
  readonly onState: <V>(selector: (s: StateOf<Sh>) => V) => IntentBuilder<V, Sh, R>;
1062
1112
  readonly on: <V>(source: Stream.Stream<V>) => IntentBuilder<V, Sh, R>;
@@ -1066,24 +1116,7 @@ interface BoundApi<Sh extends AnyModuleShape, R = never> {
1066
1116
  * - source.refresh(fieldPath): trigger an explicit refresh of a source field.
1067
1117
  * - Concrete behavior is mounted at runtime by StateTrait.install.
1068
1118
  */
1069
- readonly traits: {
1070
- /**
1071
- * declare:
1072
- * - setup-only: contributes trait declarations during the Logic setup phase (pure data/declarative).
1073
- * - Final merge / conflict detection / freezing is done during Runtime initialization (023).
1074
- */
1075
- readonly declare: (traits: TraitSpec) => void;
1076
- readonly source: {
1077
- readonly refresh: (fieldPath: string, options?: {
1078
- /**
1079
- * Forced refresh: re-fetch even if keyHash is unchanged and a non-idle snapshot already exists.
1080
- * - Used for explicit refresh / invalidate where "same key still re-fetch" is desired.
1081
- * - Auto-trigger chains SHOULD keep the default (false/undefined) to avoid duplicate IO and meaningless writebacks.
1082
- */
1083
- readonly force?: boolean;
1084
- }) => Of<Sh, R, void, never>;
1085
- };
1086
- };
1119
+ readonly traits: BoundApiTraitsApi<Sh, R>;
1087
1120
  /**
1088
1121
  * Primary reducer definition entrypoint:
1089
1122
  * - Semantics: register a synchronous, pure state transform reducer for an Action tag.
@@ -1093,11 +1126,7 @@ interface BoundApi<Sh extends AnyModuleShape, R = never> {
1093
1126
  * - At most one primary reducer per Action tag; duplicate registration is an error.
1094
1127
  * - The reducer must be pure: no Env, no Effect.
1095
1128
  */
1096
- readonly reducer: <K extends keyof Sh['actionMap'], A extends Extract<ActionOf<Sh>, {
1097
- _tag: K;
1098
- } | {
1099
- type: K;
1100
- }>>(tag: K, reducer: (state: StateOf<Sh>, action: A) => StateOf<Sh>) => Of<Sh, R, void, never>;
1129
+ readonly reducer: BoundApiReducerApi<Sh, R>;
1101
1130
  }
1102
1131
  /**
1103
1132
  * ModuleTag: identity anchor (Context.Tag).
@@ -1105,7 +1134,7 @@ interface BoundApi<Sh extends AnyModuleShape, R = never> {
1105
1134
  * - Also acts as a Context.Tag; usable as an argument to `$.use(Module)`.
1106
1135
  * - Exposes `logic` and `live` factories for mounting logic programs and building the live Layer.
1107
1136
  */
1108
- interface ModuleTag<Id extends string, Sh extends AnyModuleShape> extends Context.Tag<any, ModuleRuntime<StateOf<Sh>, ActionOf<Sh>>> {
1137
+ interface ModuleTag<Id extends string, Sh extends AnyModuleShape> extends Context.Tag<any, ModuleRuntimeOfShape<Sh>> {
1109
1138
  readonly _kind: 'ModuleTag';
1110
1139
  readonly id: Id;
1111
1140
  readonly shape: Sh;
@@ -1122,7 +1151,7 @@ interface ModuleTag<Id extends string, Sh extends AnyModuleShape> extends Contex
1122
1151
  */
1123
1152
  readonly reducers?: ReducersFromMap<Sh['stateSchema'], Sh['actionMap']>;
1124
1153
  readonly logic: <R = never, E = unknown>(build: (api: BoundApi<Sh, R>) => ModuleLogic<Sh, R, E>) => ModuleLogic<Sh, R, E>;
1125
- readonly live: <R = never, E = never>(initial: StateOf<Sh>, ...logics: Array<ModuleLogic<Sh, R, E>>) => Layer.Layer<ModuleRuntime<StateOf<Sh>, ActionOf<Sh>>, E, R>;
1154
+ readonly live: <R = never, E = never>(initial: StateOf<Sh>, ...logics: Array<ModuleLogic<Sh, R, E>>) => Layer.Layer<ModuleRuntimeOfShape<Sh>, E, R>;
1126
1155
  /**
1127
1156
  * implement: build a ModuleImpl blueprint from Module definition + initial state + a set of logics.
1128
1157
  *
@@ -1147,7 +1176,7 @@ interface ModuleTag<Id extends string, Sh extends AnyModuleShape> extends Contex
1147
1176
  interface ModuleImpl<Id extends string, Sh extends AnyModuleShape, REnv = any> {
1148
1177
  readonly _tag: 'ModuleImpl';
1149
1178
  readonly module: ModuleTag<Id, Sh>;
1150
- readonly layer: Layer.Layer<ModuleRuntime<StateOf<Sh>, ActionOf<Sh>>, never, REnv>;
1179
+ readonly layer: Layer.Layer<ModuleRuntimeOfShape<Sh>, never, REnv>;
1151
1180
  readonly processes?: ReadonlyArray<Effect.Effect<void, any, any>>;
1152
1181
  readonly stateTransaction?: ModuleImplementStateTransactionOptions;
1153
1182
  readonly withLayer: (layer: Layer.Layer<any, never, any>) => ModuleImpl<Id, Sh, REnv>;
@@ -1188,4 +1217,4 @@ type ReducersFromMap<SSchema extends AnySchema, AMap extends Record<string, AnyS
1188
1217
  }, sink?: (path: string | FieldPath) => void) => Schema.Schema.Type<SSchema>;
1189
1218
  };
1190
1219
 
1191
- export { type OperationOptions as $, type AnySchema as A, type BoundApi as B, type ConcurrencyLimit as C, type DirtyAllReason as D, type ErrorContext as E, type FieldPath as F, type ModuleHandleUnion as G, type TraitConvergeTimeSlicingPatch as H, type TxnLanesPatch as I, type StateTransactionTraitConvergeOverrides as J, type StateTransactionOverrides as K, type ConvergeStaticIrExport as L, type ModuleTag as M, type TraitProvenance as N, type ModuleImplementStateTransactionOptions as O, type PatchReason as P, type Env as Q, type ReducersFromMap as R, type StateTransactionInstrumentation as S, type TraitContribution as T, type Of as U, type Draft as V, type IntentBuilder as W, type FluentMatch as X, type FluentMatchTag as Y, type LogicMeta as Z, type Middleware as _, type StatePatchPath as a, type SerializableErrorSummary as a0, type StateTraitProgram as a1, type StateTraitGraph as a2, type StateTraitPlan as a3, type StateTraitSpec as a4, type StateTraitEntry as a5, type StateTraitNode as a6, type StateTraitList as a7, type CheckRule as a8, type StateFieldPath as a9, type StateAtPath as aa, type TraitConvergeScheduling as ab, type DirtySet as b, type FieldPathId as c, type ModuleRuntimeTag as d, type ConcurrencyPolicy as e, type ConcurrencyPolicyOverrides as f, type ConcurrencyPolicyPatch as g, type AnyModuleShape as h, type ModuleShape as i, type ModuleLogic as j, type ModuleImpl as k, type ModuleRuntime as l, type ModuleHandle as m, normalizeFieldPath as n, type StateOf as o, type ActionOf as p, type ActionsFromMap as q, type MutatorsFromMap as r, type StateCommitMode as s, type StateCommitPriority as t, type StateCommitMeta as u, type StateChangeWithMeta as v, type StateTxnOrigin as w, type ModuleTraitsSnapshot as x, type Api as y, type ModuleLike as z };
1220
+ export { type StateTransactionTraitConvergeOverrides as $, type AnySchema as A, type BoundApi as B, type ConcurrencyLimit as C, type DirtyAllReason as D, type BoundApiDispatchApi as E, type FieldPath as F, type BoundApiLifecycleApi as G, type BoundApiUseApi as H, type BoundApiTraitsApi as I, type BoundApiReducerApi as J, type StateCommitMode as K, type LogicEffect as L, type ModuleTag as M, type StateChangeWithMeta as N, type ErrorContext as O, type PatchReason as P, type StateTxnOrigin as Q, type ReducersFromMap as R, type StateCommitPriority as S, type TraitContribution as T, type ModuleTraitsSnapshot as U, type Api as V, type ModuleLike as W, type ModuleHandleUnion as X, type JsonValue as Y, type TraitConvergeTimeSlicingPatch as Z, type TxnLanesPatch as _, type StateCommitMeta as a, type StateTransactionOverrides as a0, type ConvergeStaticIrExport as a1, type JsonValueProjectionStats as a2, type DowngradeReason as a3, type TraitProvenance as a4, type ModuleImplementStateTransactionOptions as a5, type Env as a6, type Of as a7, type Draft as a8, type IntentBuilder as a9, type FluentMatch as aa, type FluentMatchTag as ab, type LogicMeta as ac, type Middleware as ad, type OperationOptions as ae, type SerializableErrorSummary as af, type StateTraitProgram as ag, type StateTraitGraph as ah, type StateTraitPlan as ai, type StateTraitSpec as aj, type StateTraitEntry as ak, type StateTraitNode as al, type StateTraitList as am, type CheckRule as an, type TraitMeta as ao, type StateFieldPath as ap, type StateAtPath as aq, type TraitConvergeScheduling as ar, type TraitLane as as, type StateTransactionInstrumentation as b, type StatePatchPath as c, type DirtySet as d, type FieldPathId as e, type ModuleRuntimeTag as f, type ConcurrencyPolicy as g, type ConcurrencyPolicyOverrides as h, type ConcurrencyPolicyPatch as i, type AnyModuleShape as j, type ModuleShape as k, type ModuleLogic as l, type ModuleImpl as m, normalizeFieldPath as n, type ModuleRuntime as o, type ModuleRuntimeOfShape as p, type ModuleHandle as q, type StateOf as r, type ActionOf as s, type ActionsFromMap as t, type MutatorsFromMap as u, type DispatchEffect as v, type ActionForTag as w, type BoundApiRootApi as x, type BoundApiStateApi as y, type BoundApiDispatchersApi as z };
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@logixjs/core",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
+ "license": "Apache-2.0",
4
5
  "description": "The pure logic engine for Logix",
5
6
  "files": [
6
7
  "dist/**"
@@ -36,6 +37,11 @@
36
37
  "import": "./dist/EffectOp.js",
37
38
  "require": "./dist/EffectOp.cjs"
38
39
  },
40
+ "./ExternalStore": {
41
+ "types": "./dist/ExternalStore.d.ts",
42
+ "import": "./dist/ExternalStore.js",
43
+ "require": "./dist/ExternalStore.cjs"
44
+ },
39
45
  "./Env": {
40
46
  "types": "./dist/Env.d.ts",
41
47
  "import": "./dist/Env.js",
@@ -46,6 +52,11 @@
46
52
  "import": "./dist/Flow.js",
47
53
  "require": "./dist/Flow.cjs"
48
54
  },
55
+ "./Workflow": {
56
+ "types": "./dist/Workflow.d.ts",
57
+ "import": "./dist/Workflow.js",
58
+ "require": "./dist/Workflow.cjs"
59
+ },
49
60
  "./Kernel": {
50
61
  "types": "./dist/Kernel.d.ts",
51
62
  "import": "./dist/Kernel.js",
@@ -1,93 +0,0 @@
1
- import { Schema } from 'effect';
2
- import { D as Draft } from './Logic-BRjEMr-W.js';
3
- import { N as NormalizedActionTokens, b as ActionDefs } from './action-DiMDD_0v.js';
4
- import { F as FieldPath, A as AnySchema, i as ModuleShape, q as ActionsFromMap, R as ReducersFromMap, M as ModuleTag$1, p as ActionOf, h as AnyModuleShape, B as BoundApi, m as ModuleHandle, G as ModuleHandleUnion, k as ModuleImpl, j as ModuleLogic, l as ModuleRuntime, v as StateChangeWithMeta, u as StateCommitMeta, s as StateCommitMode, t as StateCommitPriority, o as StateOf } from './module-k7m3txak.js';
5
-
6
- type NoInfer_<T> = [T][T extends any ? 0 : never];
7
-
8
- /**
9
- * Reducer helper:
10
- * - `Reducer.mutate` provides the same mutative style as `$.state.mutate`.
11
- * - Internally uses mutative-based immutable updates to map "in-place draft mutation" into a pure `(state, action) => state`.
12
- *
13
- * @example
14
- *
15
- * const Counter = Logix.ModuleTag.make("Counter", {
16
- * state: CounterState,
17
- * actions: CounterActions,
18
- * reducers: {
19
- * inc: Logix.ModuleTag.Reducer.mutate((draft, _payload) => {
20
- * draft.count += 1
21
- * }),
22
- * },
23
- * })
24
- *
25
- * yield* $.reducer(
26
- * "setValue",
27
- * Logix.ModuleTag.Reducer.mutate((draft, payload) => {
28
- * draft.value = payload
29
- * }),
30
- * )
31
- */
32
- declare const Reducer: {
33
- mutate: <S, A extends {
34
- readonly payload?: any;
35
- }>(mutator: (draft: Draft<S>, payload: A["payload"]) => void) => ((state: S, action: A, sink?: (path: string | FieldPath) => void) => S);
36
- mutateMap: <R extends Readonly<Record<string, ((state: any, action: any, sink?: (path: string | FieldPath) => void) => any) | undefined>>>(mutators: { readonly [K in keyof NoInfer_<R>]?: (draft: Draft<Parameters<NonNullable<NoInfer_<R>[K]>>[0]>, payload: Parameters<NonNullable<NoInfer_<R>[K]>>[1] extends {
37
- readonly payload: infer P;
38
- } ? P : Parameters<NonNullable<NoInfer_<R>[K]>>[1] extends {
39
- readonly payload?: infer P;
40
- } ? P | undefined : never) => void; }) => R;
41
- };
42
- /**
43
- * A simplified Shape definition helper, designed for Action Maps.
44
- * @example type MyShape = Shape<typeof MyState, typeof MyActionMap>
45
- */
46
- type Shape<S extends AnySchema, M extends Record<string, AnySchema>> = ModuleShape<S, Schema.Schema<ActionsFromMap<NormalizedActionTokens<M & ActionDefs>>>, NormalizedActionTokens<M & ActionDefs>>;
47
- /**
48
- * ModuleTag.make:
49
- * - Defines a domain module Tag using the given id and state/actions/reducers.
50
- * - The returned ModuleTag is both a Context.Tag and a factory carrying its Shape.
51
- *
52
- * Note: since 022, the old `Module` (Tag identity) was renamed to `ModuleTag`; use `Logix.Module` for module definition objects.
53
- */
54
- declare const make: <Id extends string, SSchema extends AnySchema, ADefs extends ActionDefs>(id: Id, def: {
55
- readonly state: SSchema;
56
- readonly actions: ADefs;
57
- readonly reducers?: ReducersFromMap<SSchema, ADefs>;
58
- /**
59
- * traits:
60
- * - Used to attach a StateTraitSpec (see specs/000-module-traits-runtime).
61
- * - The current implementation builds a Program during ModuleTag.make, and injects a setup-only Logic in `ModuleTag.implement`
62
- * to call `StateTrait.install`.
63
- * (Note: if you use `ModuleTag.live` to export a Layer and want trait behavior, call `StateTrait.install` explicitly in logics,
64
- * or use `ModuleTag.implement` instead.)
65
- */
66
- readonly traits?: unknown;
67
- }) => ModuleTag$1<Id, ModuleShape<SSchema, Schema.Schema<ActionsFromMap<NormalizedActionTokens<ADefs>>>, NormalizedActionTokens<ADefs>>>;
68
-
69
- declare const ModuleTag_ActionOf: typeof ActionOf;
70
- declare const ModuleTag_ActionsFromMap: typeof ActionsFromMap;
71
- declare const ModuleTag_AnyModuleShape: typeof AnyModuleShape;
72
- declare const ModuleTag_AnySchema: typeof AnySchema;
73
- declare const ModuleTag_BoundApi: typeof BoundApi;
74
- declare const ModuleTag_ModuleHandle: typeof ModuleHandle;
75
- declare const ModuleTag_ModuleHandleUnion: typeof ModuleHandleUnion;
76
- declare const ModuleTag_ModuleImpl: typeof ModuleImpl;
77
- declare const ModuleTag_ModuleLogic: typeof ModuleLogic;
78
- declare const ModuleTag_ModuleRuntime: typeof ModuleRuntime;
79
- declare const ModuleTag_ModuleShape: typeof ModuleShape;
80
- declare const ModuleTag_Reducer: typeof Reducer;
81
- declare const ModuleTag_ReducersFromMap: typeof ReducersFromMap;
82
- type ModuleTag_Shape<S extends AnySchema, M extends Record<string, AnySchema>> = Shape<S, M>;
83
- declare const ModuleTag_StateChangeWithMeta: typeof StateChangeWithMeta;
84
- declare const ModuleTag_StateCommitMeta: typeof StateCommitMeta;
85
- declare const ModuleTag_StateCommitMode: typeof StateCommitMode;
86
- declare const ModuleTag_StateCommitPriority: typeof StateCommitPriority;
87
- declare const ModuleTag_StateOf: typeof StateOf;
88
- declare const ModuleTag_make: typeof make;
89
- declare namespace ModuleTag {
90
- export { ModuleTag_ActionOf as ActionOf, ModuleTag_ActionsFromMap as ActionsFromMap, ModuleTag_AnyModuleShape as AnyModuleShape, ModuleTag_AnySchema as AnySchema, ModuleTag_BoundApi as BoundApi, ModuleTag_ModuleHandle as ModuleHandle, ModuleTag_ModuleHandleUnion as ModuleHandleUnion, ModuleTag_ModuleImpl as ModuleImpl, ModuleTag_ModuleLogic as ModuleLogic, ModuleTag_ModuleRuntime as ModuleRuntime, ModuleTag_ModuleShape as ModuleShape, ModuleTag$1 as ModuleTag, ModuleTag_Reducer as Reducer, ModuleTag_ReducersFromMap as ReducersFromMap, type ModuleTag_Shape as Shape, ModuleTag_StateChangeWithMeta as StateChangeWithMeta, ModuleTag_StateCommitMeta as StateCommitMeta, ModuleTag_StateCommitMode as StateCommitMode, ModuleTag_StateCommitPriority as StateCommitPriority, ModuleTag_StateOf as StateOf, ModuleTag_make as make };
91
- }
92
-
93
- export { ModuleTag as M, Reducer as R, type Shape as S, make as m };