@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
@@ -4,186 +4,51 @@ import {
4
4
  parseListItemFieldPath,
5
5
  setAtPathMutating,
6
6
  toListItemValuePath
7
- } from "./chunk-BABLDP24.js";
7
+ } from "./chunk-KSZQYSEH.js";
8
8
  import {
9
9
  Snapshot,
10
10
  internal,
11
11
  keyHash
12
- } from "./chunk-NZJKFF45.js";
12
+ } from "./chunk-C2UZZQ76.js";
13
13
  import {
14
- forceSourceRefresh,
15
- inSyncTransactionFiber
16
- } from "./chunk-ZFLHVFUC.js";
14
+ mergeCanonical,
15
+ sanitize
16
+ } from "./chunk-J3CWXIPV.js";
17
17
  import {
18
18
  compareFieldPath,
19
19
  getFieldPathId,
20
20
  makeFieldPathIdRegistry,
21
21
  normalizeFieldPath
22
- } from "./chunk-IHVBV5C2.js";
22
+ } from "./chunk-ZTFTABXV.js";
23
23
  import {
24
24
  getBoundInternals
25
- } from "./chunk-3RMKLXHX.js";
25
+ } from "./chunk-KLDVG3SY.js";
26
26
  import {
27
27
  ReplayModeConfigTag,
28
+ forceSourceRefresh,
29
+ inSyncTransactionFiber,
28
30
  isDevEnv
29
- } from "./chunk-3QMIVH35.js";
30
- import {
31
- record
32
- } from "./chunk-DMBALCE2.js";
33
- import {
34
- fnv1a32,
35
- stableStringify
36
- } from "./chunk-GMPEOUP2.js";
31
+ } from "./chunk-AQ7L2QZ5.js";
37
32
  import {
38
33
  RunSessionTag,
39
34
  make,
40
35
  run
41
- } from "./chunk-OFADUJWJ.js";
36
+ } from "./chunk-I4LCE5OY.js";
37
+ import {
38
+ currentDiagnosticsLevel,
39
+ record
40
+ } from "./chunk-ZC7MSQ5U.js";
42
41
  import {
43
42
  EffectOpMiddlewareTag
44
- } from "./chunk-JWOYLO27.js";
43
+ } from "./chunk-WYJUJV4L.js";
44
+ import {
45
+ fnv1a32,
46
+ stableStringify
47
+ } from "./chunk-4MZ7BT3R.js";
45
48
 
46
49
  // src/internal/state-trait/build.ts
47
50
  import * as SchemaAST from "effect/SchemaAST";
48
51
 
49
- // src/internal/state-trait/meta.ts
50
- var uniqSortedStrings = (input) => {
51
- const set = /* @__PURE__ */ new Set();
52
- for (const item of input) {
53
- const v = item.trim();
54
- if (!v) continue;
55
- set.add(v);
56
- }
57
- return Array.from(set).sort((a, b) => a.localeCompare(b));
58
- };
59
- var isPlainRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
60
- var sanitizeJsonValue = (input, depth) => {
61
- if (input === null) return null;
62
- if (typeof input === "string") return input;
63
- if (typeof input === "boolean") return input;
64
- if (typeof input === "number") {
65
- return Number.isFinite(input) ? input : void 0;
66
- }
67
- if (depth >= 6) return void 0;
68
- if (Array.isArray(input)) {
69
- const out = [];
70
- for (const item of input) {
71
- const v = sanitizeJsonValue(item, depth + 1);
72
- if (v !== void 0) out.push(v);
73
- }
74
- return out;
75
- }
76
- if (isPlainRecord(input)) {
77
- const keys = Object.keys(input).sort();
78
- const out = {};
79
- for (const key of keys) {
80
- const v = sanitizeJsonValue(input[key], depth + 1);
81
- if (v !== void 0) out[key] = v;
82
- }
83
- return out;
84
- }
85
- return void 0;
86
- };
87
- var sanitize = (input) => {
88
- if (input === null || input === void 0) return void 0;
89
- if (typeof input !== "object" || Array.isArray(input)) return void 0;
90
- const record2 = input;
91
- const out = {};
92
- const pickString = (key) => {
93
- const value = record2[key];
94
- if (typeof value !== "string") return;
95
- const trimmed = value.trim();
96
- if (!trimmed) return;
97
- out[key] = trimmed;
98
- };
99
- pickString("label");
100
- pickString("description");
101
- pickString("group");
102
- pickString("docsUrl");
103
- pickString("cacheGroup");
104
- const canonical = record2.canonical;
105
- if (typeof canonical === "boolean") {
106
- out.canonical = canonical;
107
- }
108
- const tagsRaw = record2.tags;
109
- if (typeof tagsRaw === "string") {
110
- const tags = uniqSortedStrings([tagsRaw]);
111
- if (tags.length > 0) out.tags = tags;
112
- } else if (Array.isArray(tagsRaw)) {
113
- const tags = uniqSortedStrings(tagsRaw.filter((x) => typeof x === "string"));
114
- if (tags.length > 0) out.tags = tags;
115
- }
116
- const annotations = {};
117
- const annotationKeys = Object.keys(record2).filter((k) => k.startsWith("x-")).sort((a, b) => a.localeCompare(b));
118
- for (const key of annotationKeys) {
119
- const v = sanitizeJsonValue(record2[key], 0);
120
- if (v !== void 0) annotations[key] = v;
121
- }
122
- const annotationsRaw = record2.annotations;
123
- if (isPlainRecord(annotationsRaw)) {
124
- const keys = Object.keys(annotationsRaw).filter((k) => k.startsWith("x-")).sort((a, b) => a.localeCompare(b));
125
- for (const key of keys) {
126
- const v = sanitizeJsonValue(annotationsRaw[key], 0);
127
- if (v !== void 0) annotations[key] = v;
128
- }
129
- }
130
- if (Object.keys(annotations).length > 0) out.annotations = annotations;
131
- return Object.keys(out).length > 0 ? out : void 0;
132
- };
133
- var stableStringify2 = (meta) => {
134
- const out = {};
135
- const keys = Object.keys(meta).sort();
136
- for (const k of keys) {
137
- out[k] = meta[k];
138
- }
139
- return JSON.stringify(out);
140
- };
141
- var equals = (a, b) => {
142
- if (a === b) return true;
143
- if (!a || !b) return false;
144
- return stableStringify2(a) === stableStringify2(b);
145
- };
146
- var mergeCanonical = (current, incoming) => {
147
- const existing = current.meta;
148
- if (!existing) {
149
- return {
150
- meta: incoming.meta,
151
- origin: incoming.origin,
152
- conflicts: current.conflicts
153
- };
154
- }
155
- if (equals(existing, incoming.meta)) {
156
- return current;
157
- }
158
- const conflicts = [...current.conflicts ?? []];
159
- const push = (conflict) => {
160
- const exists = conflicts.some((c) => c.origin === conflict.origin && equals(c.meta, conflict.meta));
161
- if (!exists) conflicts.push(conflict);
162
- };
163
- const existingCanonical = existing.canonical === true;
164
- const incomingCanonical = incoming.meta.canonical === true;
165
- if (!existingCanonical && incomingCanonical) {
166
- push({
167
- origin: current.origin ?? "unknown",
168
- meta: existing
169
- });
170
- return {
171
- meta: incoming.meta,
172
- origin: incoming.origin,
173
- conflicts
174
- };
175
- }
176
- push({
177
- origin: incoming.origin,
178
- meta: incoming.meta
179
- });
180
- return {
181
- meta: existing,
182
- origin: current.origin ?? incoming.origin,
183
- conflicts
184
- };
185
- };
186
-
187
52
  // src/internal/state-trait/model.ts
188
53
  var normalizeSpec = (spec) => {
189
54
  const entries = [];
@@ -219,6 +84,14 @@ var normalizeSpec = (spec) => {
219
84
  meta: { ...meta, deps, _fieldPath: fieldPath }
220
85
  };
221
86
  }
87
+ if (entry.kind === "externalStore") {
88
+ const meta = entry.meta;
89
+ return {
90
+ ...entry,
91
+ fieldPath,
92
+ meta: { ...meta, _fieldPath: fieldPath }
93
+ };
94
+ }
222
95
  if (entry.kind === "link") {
223
96
  const meta = entry.meta;
224
97
  const from = prefixDeps([meta.from], depPrefix)[0] ?? meta.from;
@@ -256,6 +129,7 @@ var normalizeSpec = (spec) => {
256
129
  expandMaybeRecord(node.computed);
257
130
  expandMaybeRecord(node.source);
258
131
  expandMaybeRecord(node.link);
132
+ expandMaybeRecord(node.externalStore);
259
133
  if (node.check) {
260
134
  const rules = {};
261
135
  const checkDepsPrefix = options?.checkDepsPrefix ?? (joinPrefix.endsWith("[]") ? joinPrefix : "");
@@ -348,6 +222,32 @@ var collectNodeMeta = (spec) => {
348
222
 
349
223
  // src/internal/state-trait/build.ts
350
224
  var nowPerf = () => typeof globalThis.performance !== "undefined" && typeof globalThis.performance.now === "function" ? globalThis.performance.now() : Date.now();
225
+ var collectMultipleWritersError = (entries) => {
226
+ const kindsByFieldPath = /* @__PURE__ */ new Map();
227
+ for (const entry of entries) {
228
+ if (entry.kind !== "computed" && entry.kind !== "link" && entry.kind !== "source" && entry.kind !== "externalStore") {
229
+ continue;
230
+ }
231
+ const set = kindsByFieldPath.get(entry.fieldPath) ?? /* @__PURE__ */ new Set();
232
+ set.add(entry.kind);
233
+ kindsByFieldPath.set(entry.fieldPath, set);
234
+ }
235
+ const conflicts = [];
236
+ for (const [fieldPath, kinds] of kindsByFieldPath.entries()) {
237
+ if (kinds.size <= 1) continue;
238
+ conflicts.push({ fieldPath, kinds: Array.from(kinds).sort() });
239
+ }
240
+ if (conflicts.length === 0) return void 0;
241
+ conflicts.sort((a, b) => a.fieldPath < b.fieldPath ? -1 : a.fieldPath > b.fieldPath ? 1 : 0);
242
+ const fields = conflicts.map((c) => c.fieldPath);
243
+ const primary = conflicts[0];
244
+ const kindSummary = primary.kinds.join(" + ");
245
+ return {
246
+ code: "MULTIPLE_WRITERS",
247
+ message: `[StateTrait.build] Multiple writers for field "${primary.fieldPath}" (${kindSummary}). Only one of computed/link/source/externalStore can write a fieldPath.`,
248
+ fields
249
+ };
250
+ };
351
251
  var getConvergeWriterDeps = (entry) => {
352
252
  if (entry.kind === "computed") {
353
253
  return entry.meta?.deps ?? [];
@@ -476,6 +376,7 @@ var collectSchemaFieldPaths = (schema) => {
476
376
  var buildConvergeIr = (stateSchema, entries) => {
477
377
  const startedAt = nowPerf();
478
378
  const generation = 0;
379
+ const multipleWritersError = collectMultipleWritersError(entries);
479
380
  const writers = entries.filter((e) => e.kind === "computed" || e.kind === "link");
480
381
  const writersKey = writers.map((entry) => `${entry.kind}:${entry.fieldPath}`).sort().join("|");
481
382
  const depsKey = writers.map((entry) => {
@@ -487,7 +388,7 @@ var buildConvergeIr = (stateSchema, entries) => {
487
388
  for (const entry of writers) {
488
389
  writerByPath.set(entry.fieldPath, entry);
489
390
  }
490
- const topo = writers.length > 0 ? computeConvergeTopoOrder(writers) : { order: [] };
391
+ const topo = multipleWritersError ? { order: [] } : writers.length > 0 ? computeConvergeTopoOrder(writers) : { order: [] };
491
392
  const stepsById = topo.configError ? [] : topo.order.map((path) => writerByPath.get(path));
492
393
  const fieldPathTable = /* @__PURE__ */ new Map();
493
394
  const addPath = (path) => {
@@ -540,7 +441,7 @@ var buildConvergeIr = (stateSchema, entries) => {
540
441
  fieldPathsKey,
541
442
  fieldPaths,
542
443
  fieldPathIdRegistry,
543
- ...topo.configError ? { configError: topo.configError } : null,
444
+ ...multipleWritersError ? { configError: multipleWritersError } : topo.configError ? { configError: topo.configError } : null,
544
445
  stepsById,
545
446
  stepOutFieldPathIdByStepId,
546
447
  stepDepsFieldPathIdsByStepId,
@@ -696,6 +597,12 @@ var buildGraph = (entries, nodeMetaByFieldPath) => {
696
597
  });
697
598
  }
698
599
  }
600
+ } else if (entry.kind === "externalStore") {
601
+ planSteps.push({
602
+ id: `external-store:${fieldPath}`,
603
+ kind: "external-store-sync",
604
+ targetFieldPath: fieldPath
605
+ });
699
606
  } else if (entry.kind === "check") {
700
607
  planSteps.push({
701
608
  id: `check:${fieldPath}`,
@@ -836,7 +743,7 @@ var collectSchemaPaths = (entries) => {
836
743
  }
837
744
  }
838
745
  }
839
- return Array.from(byKey.entries()).sort((a, b) => a[0].localeCompare(b[0])).map(([, v]) => v);
746
+ return Array.from(byKey.entries()).sort((a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0).map(([, v]) => v);
840
747
  };
841
748
  var build = (stateSchema, spec) => {
842
749
  const entries = normalizeSpec(spec);
@@ -888,7 +795,7 @@ var build = (stateSchema, spec) => {
888
795
  };
889
796
  };
890
797
 
891
- // src/internal/state-trait/source.ts
798
+ // src/internal/state-trait/source.impl.ts
892
799
  import { Effect, Fiber, FiberRef, Option } from "effect";
893
800
  import { create } from "mutative";
894
801
 
@@ -1037,7 +944,7 @@ var trace = (fn, state) => {
1037
944
  };
1038
945
  };
1039
946
 
1040
- // src/internal/state-trait/source.ts
947
+ // src/internal/state-trait/source.impl.ts
1041
948
  var onceInRunSession = (key) => Effect.serviceOption(RunSessionTag).pipe(
1042
949
  Effect.map((maybe) => Option.isSome(maybe) ? maybe.value.local.once(key) : true)
1043
950
  );
@@ -1914,11 +1821,167 @@ var installSourceRefresh = (bound, step, entry) => {
1914
1821
  return Effect.void;
1915
1822
  };
1916
1823
 
1824
+ // src/internal/state-trait/converge-diagnostics.ts
1825
+ import { Effect as Effect2, FiberRef as FiberRef2, Option as Option2 } from "effect";
1826
+ import * as SchemaAST2 from "effect/SchemaAST";
1827
+ var onceKeysFallback = /* @__PURE__ */ new Set();
1828
+ var onceInRunSession2 = (key) => Effect2.serviceOption(RunSessionTag).pipe(
1829
+ Effect2.map((maybe) => {
1830
+ if (Option2.isSome(maybe)) {
1831
+ return maybe.value.local.once(key);
1832
+ }
1833
+ if (onceKeysFallback.has(key)) return false;
1834
+ onceKeysFallback.add(key);
1835
+ return true;
1836
+ })
1837
+ );
1838
+ var formatList2 = (items, limit = 10) => {
1839
+ if (items.length === 0) return "";
1840
+ if (items.length <= limit) return items.join(", ");
1841
+ return `${items.slice(0, limit).join(", ")}, \u2026(+${items.length - limit})`;
1842
+ };
1843
+ var emitDepsMismatch2 = (params) => {
1844
+ return Effect2.gen(function* () {
1845
+ const key = `${params.moduleId ?? "unknown"}::${params.instanceId ?? "unknown"}::${params.kind}::${params.fieldPath}`;
1846
+ const shouldEmit = yield* onceInRunSession2(`deps_mismatch:${key}`);
1847
+ if (!shouldEmit) return;
1848
+ yield* record({
1849
+ type: "diagnostic",
1850
+ moduleId: params.moduleId,
1851
+ instanceId: params.instanceId,
1852
+ code: "state_trait::deps_mismatch",
1853
+ severity: "warning",
1854
+ message: `[deps] ${params.kind} "${params.fieldPath}" declared=[${formatList2(params.diff.declared)}] reads=[${formatList2(params.diff.reads)}] missing=[${formatList2(params.diff.missing)}] unused=[${formatList2(params.diff.unused)}]`,
1855
+ hint: 'deps is the single source of truth for dependencies: incremental scheduling / reverse closures / performance optimizations rely on deps only. Keep deps consistent with actual reads; if you really depend on the whole object, declare a coarser-grained dep (e.g. "profile") to cover sub-field reads.',
1856
+ kind: `deps_mismatch:${params.kind}`
1857
+ });
1858
+ });
1859
+ };
1860
+ var schemaHasPath = (ast, segments, seen = /* @__PURE__ */ new Set()) => {
1861
+ if (segments.length === 0) return true;
1862
+ let current = ast;
1863
+ while (true) {
1864
+ if (SchemaAST2.isSuspend(current)) {
1865
+ if (seen.has(current)) {
1866
+ return true;
1867
+ }
1868
+ seen.add(current);
1869
+ current = current.f();
1870
+ continue;
1871
+ }
1872
+ if (SchemaAST2.isRefinement(current)) {
1873
+ current = current.from;
1874
+ continue;
1875
+ }
1876
+ break;
1877
+ }
1878
+ if (SchemaAST2.isTransformation(current)) {
1879
+ return schemaHasPath(current.to, segments, seen) || schemaHasPath(current.from, segments, seen);
1880
+ }
1881
+ if (SchemaAST2.isUnion(current)) {
1882
+ return current.types.some((t) => schemaHasPath(t, segments, seen));
1883
+ }
1884
+ if (SchemaAST2.isTupleType(current)) {
1885
+ const candidates = [];
1886
+ for (const e of current.elements) candidates.push(e.type);
1887
+ for (const r of current.rest) candidates.push(r.type);
1888
+ if (candidates.length === 0) return true;
1889
+ return candidates.some((t) => schemaHasPath(t, segments, seen));
1890
+ }
1891
+ if (SchemaAST2.isTypeLiteral(current)) {
1892
+ const [head, ...tail] = segments;
1893
+ for (const ps of current.propertySignatures) {
1894
+ if (String(ps.name) !== head) continue;
1895
+ return schemaHasPath(ps.type, tail, seen);
1896
+ }
1897
+ for (const sig of current.indexSignatures) {
1898
+ let param = sig.parameter;
1899
+ while (SchemaAST2.isRefinement(param)) {
1900
+ param = param.from;
1901
+ }
1902
+ const tag2 = param?._tag;
1903
+ if (tag2 === "StringKeyword" || tag2 === "TemplateLiteral") {
1904
+ return schemaHasPath(sig.type, tail, seen);
1905
+ }
1906
+ }
1907
+ return false;
1908
+ }
1909
+ const tag = current?._tag;
1910
+ if (tag === "AnyKeyword" || tag === "UnknownKeyword" || tag === "ObjectKeyword" || tag === "Declaration") {
1911
+ return true;
1912
+ }
1913
+ return false;
1914
+ };
1915
+ var schemaHasFieldPath = (stateSchemaAst, path) => {
1916
+ if (!path) return true;
1917
+ if (path === "$root") return true;
1918
+ const normalized = normalizeFieldPath(path);
1919
+ if (!normalized) return false;
1920
+ const segs = normalized[0] === "$root" ? normalized.slice(1) : normalized;
1921
+ return schemaHasPath(stateSchemaAst, segs);
1922
+ };
1923
+ var formatSchemaMismatchLine = (ref) => {
1924
+ if (ref.kind === "fieldPath") {
1925
+ return `- ${ref.entryKind} "${ref.entryFieldPath}" fieldPath="${ref.path}"`;
1926
+ }
1927
+ if (ref.kind === "dep") {
1928
+ const rule = ref.ruleName ? ` rule="${ref.ruleName}"` : "";
1929
+ return `- ${ref.entryKind} "${ref.entryFieldPath}" deps="${ref.path}"${rule}`;
1930
+ }
1931
+ if (ref.kind === "link_from") {
1932
+ return `- link "${ref.entryFieldPath}" from="${ref.path}"`;
1933
+ }
1934
+ if (ref.kind === "check_writeback") {
1935
+ return `- check "${ref.entryFieldPath}" writeback="${ref.path}"`;
1936
+ }
1937
+ return `- ${ref.entryKind} "${ref.entryFieldPath}" path="${ref.path}"`;
1938
+ };
1939
+ var emitSchemaMismatch = (program, ctx) => Effect2.gen(function* () {
1940
+ if (!isDevEnv()) return;
1941
+ const level = yield* FiberRef2.get(currentDiagnosticsLevel);
1942
+ if (level === "off") return;
1943
+ const key = `${ctx.moduleId ?? "unknown"}::${ctx.instanceId}`;
1944
+ const shouldEmit = yield* onceInRunSession2(`schema_mismatch:${key}`);
1945
+ if (!shouldEmit) return;
1946
+ const refs = program.schemaPaths ?? [];
1947
+ if (refs.length === 0) return;
1948
+ const stateSchemaAst = program.stateSchema.ast;
1949
+ const mismatches = [];
1950
+ const seen = /* @__PURE__ */ new Set();
1951
+ for (const ref of refs) {
1952
+ if (schemaHasFieldPath(stateSchemaAst, ref.path)) continue;
1953
+ const k = `${ref.kind}|${ref.entryKind}|${ref.entryFieldPath}|${ref.ruleName ?? ""}|${ref.path}`;
1954
+ if (seen.has(k)) continue;
1955
+ seen.add(k);
1956
+ mismatches.push(ref);
1957
+ }
1958
+ if (mismatches.length === 0) return;
1959
+ const limit = level === "light" ? 8 : 24;
1960
+ const lines = mismatches.slice(0, limit).map(formatSchemaMismatchLine);
1961
+ if (mismatches.length > limit) {
1962
+ lines.push(`- \u2026(+${mismatches.length - limit})`);
1963
+ }
1964
+ yield* record({
1965
+ type: "diagnostic",
1966
+ moduleId: ctx.moduleId,
1967
+ instanceId: ctx.instanceId,
1968
+ code: "state_trait::schema_mismatch",
1969
+ severity: "warning",
1970
+ message: `[schema] The following paths are not declared in stateSchema (total ${mismatches.length}):
1971
+ ${lines.join("\n")}`,
1972
+ hint: "StateTrait writeback will create missing objects/fields. Declare all fieldPath/deps/link.from and errors.* writeback paths in stateSchema, or fix typos in trait paths.",
1973
+ kind: "schema_mismatch"
1974
+ });
1975
+ });
1976
+
1917
1977
  export {
1978
+ onceInRunSession2 as onceInRunSession,
1979
+ emitDepsMismatch2 as emitDepsMismatch,
1980
+ emitSchemaMismatch,
1918
1981
  diffDeps,
1919
1982
  trace,
1920
1983
  syncIdleInTransaction,
1921
1984
  installSourceRefresh,
1922
1985
  build
1923
1986
  };
1924
- //# sourceMappingURL=chunk-PYOE4VSI.js.map
1987
+ //# sourceMappingURL=chunk-JBKYRTCS.js.map