@logixjs/core 0.0.1

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 (345) hide show
  1. package/dist/Action-BkRHy2vg.d.cts +10 -0
  2. package/dist/Action-mqVvtEHt.d.ts +10 -0
  3. package/dist/Action.cjs +57 -0
  4. package/dist/Action.cjs.map +1 -0
  5. package/dist/Action.d.cts +2 -0
  6. package/dist/Action.d.ts +2 -0
  7. package/dist/Action.js +9 -0
  8. package/dist/Action.js.map +1 -0
  9. package/dist/Actions-AsQ07yTP.d.cts +22 -0
  10. package/dist/Actions-AsQ07yTP.d.ts +22 -0
  11. package/dist/Actions.cjs +19 -0
  12. package/dist/Actions.cjs.map +1 -0
  13. package/dist/Actions.d.cts +2 -0
  14. package/dist/Actions.d.ts +2 -0
  15. package/dist/Actions.js +2 -0
  16. package/dist/Actions.js.map +1 -0
  17. package/dist/Bound-BN1DQ_lM.d.ts +23 -0
  18. package/dist/Bound-BPIfH9SS.d.cts +23 -0
  19. package/dist/Bound.cjs +1532 -0
  20. package/dist/Bound.cjs.map +1 -0
  21. package/dist/Bound.d.cts +7 -0
  22. package/dist/Bound.d.ts +7 -0
  23. package/dist/Bound.js +25 -0
  24. package/dist/Bound.js.map +1 -0
  25. package/dist/Debug-B5q5Bkzx.d.ts +320 -0
  26. package/dist/Debug-Bq8Sqjcr.d.cts +320 -0
  27. package/dist/Debug.cjs +1821 -0
  28. package/dist/Debug.cjs.map +1 -0
  29. package/dist/Debug.d.cts +13 -0
  30. package/dist/Debug.d.ts +13 -0
  31. package/dist/Debug.js +76 -0
  32. package/dist/Debug.js.map +1 -0
  33. package/dist/EffectOp.cjs +169 -0
  34. package/dist/EffectOp.cjs.map +1 -0
  35. package/dist/EffectOp.d.cts +118 -0
  36. package/dist/EffectOp.d.ts +118 -0
  37. package/dist/EffectOp.js +28 -0
  38. package/dist/EffectOp.js.map +1 -0
  39. package/dist/Env-DuJ6JrU2.d.cts +10 -0
  40. package/dist/Env-DuJ6JrU2.d.ts +10 -0
  41. package/dist/Env.cjs +60 -0
  42. package/dist/Env.cjs.map +1 -0
  43. package/dist/Env.d.cts +1 -0
  44. package/dist/Env.d.ts +1 -0
  45. package/dist/Env.js +11 -0
  46. package/dist/Env.js.map +1 -0
  47. package/dist/Flow-1fZT8MpX.d.cts +152 -0
  48. package/dist/Flow-BhpjE22E.d.ts +152 -0
  49. package/dist/Flow.cjs +504 -0
  50. package/dist/Flow.cjs.map +1 -0
  51. package/dist/Flow.d.cts +8 -0
  52. package/dist/Flow.d.ts +8 -0
  53. package/dist/Flow.js +15 -0
  54. package/dist/Flow.js.map +1 -0
  55. package/dist/Handle-D8D1zPb_.d.cts +30 -0
  56. package/dist/Handle-D_cLW1Z3.d.ts +30 -0
  57. package/dist/Handle.cjs +42 -0
  58. package/dist/Handle.cjs.map +1 -0
  59. package/dist/Handle.d.cts +7 -0
  60. package/dist/Handle.d.ts +7 -0
  61. package/dist/Handle.js +10 -0
  62. package/dist/Handle.js.map +1 -0
  63. package/dist/Kernel-8kC-jOda.d.cts +171 -0
  64. package/dist/Kernel-CnGE1Fyk.d.ts +171 -0
  65. package/dist/Kernel.cjs +284 -0
  66. package/dist/Kernel.cjs.map +1 -0
  67. package/dist/Kernel.d.cts +14 -0
  68. package/dist/Kernel.d.ts +14 -0
  69. package/dist/Kernel.js +36 -0
  70. package/dist/Kernel.js.map +1 -0
  71. package/dist/Link-Db7975nU.d.ts +45 -0
  72. package/dist/Link-fX8x1eCK.d.cts +45 -0
  73. package/dist/Link.cjs +542 -0
  74. package/dist/Link.cjs.map +1 -0
  75. package/dist/Link.d.cts +7 -0
  76. package/dist/Link.d.ts +7 -0
  77. package/dist/Link.js +35 -0
  78. package/dist/Link.js.map +1 -0
  79. package/dist/Logic-BRjEMr-W.d.ts +38 -0
  80. package/dist/Logic-DRh4sDZj.d.cts +38 -0
  81. package/dist/Logic.cjs +37 -0
  82. package/dist/Logic.cjs.map +1 -0
  83. package/dist/Logic.d.cts +7 -0
  84. package/dist/Logic.d.ts +7 -0
  85. package/dist/Logic.js +10 -0
  86. package/dist/Logic.js.map +1 -0
  87. package/dist/MatchBuilder-0QOc-nlU.d.ts +14 -0
  88. package/dist/MatchBuilder-CJk5oCkR.d.cts +14 -0
  89. package/dist/MatchBuilder.cjs +85 -0
  90. package/dist/MatchBuilder.cjs.map +1 -0
  91. package/dist/MatchBuilder.d.cts +8 -0
  92. package/dist/MatchBuilder.d.ts +8 -0
  93. package/dist/MatchBuilder.js +11 -0
  94. package/dist/MatchBuilder.js.map +1 -0
  95. package/dist/Middleware.cjs +411 -0
  96. package/dist/Middleware.cjs.map +1 -0
  97. package/dist/Middleware.d.cts +88 -0
  98. package/dist/Middleware.d.ts +88 -0
  99. package/dist/Middleware.js +27 -0
  100. package/dist/Middleware.js.map +1 -0
  101. package/dist/Module-B_0xRDMR.d.cts +203 -0
  102. package/dist/Module-DnzluX2J.d.ts +203 -0
  103. package/dist/Module.cjs +13512 -0
  104. package/dist/Module.cjs.map +1 -0
  105. package/dist/Module.d.cts +8 -0
  106. package/dist/Module.d.ts +8 -0
  107. package/dist/Module.js +53 -0
  108. package/dist/Module.js.map +1 -0
  109. package/dist/ModuleTag-C8FHY_sY.d.ts +93 -0
  110. package/dist/ModuleTag-EGbgBMpZ.d.cts +93 -0
  111. package/dist/ModuleTag.cjs +12231 -0
  112. package/dist/ModuleTag.cjs.map +1 -0
  113. package/dist/ModuleTag.d.cts +8 -0
  114. package/dist/ModuleTag.d.ts +8 -0
  115. package/dist/ModuleTag.js +39 -0
  116. package/dist/ModuleTag.js.map +1 -0
  117. package/dist/Observability-COqEvp2C.d.cts +713 -0
  118. package/dist/Observability-cY4kLn0S.d.ts +713 -0
  119. package/dist/Observability.cjs +5865 -0
  120. package/dist/Observability.cjs.map +1 -0
  121. package/dist/Observability.d.cts +9 -0
  122. package/dist/Observability.d.ts +9 -0
  123. package/dist/Observability.js +41 -0
  124. package/dist/Observability.js.map +1 -0
  125. package/dist/Platform-C49Pv956.d.cts +21 -0
  126. package/dist/Platform-C49Pv956.d.ts +21 -0
  127. package/dist/Platform-CHX8o-U4.d.ts +51 -0
  128. package/dist/Platform-CVlv0xLQ.d.cts +51 -0
  129. package/dist/Platform.cjs +58 -0
  130. package/dist/Platform.cjs.map +1 -0
  131. package/dist/Platform.d.cts +4 -0
  132. package/dist/Platform.d.ts +4 -0
  133. package/dist/Platform.js +15 -0
  134. package/dist/Platform.js.map +1 -0
  135. package/dist/Process-CM9xbMdP.d.ts +92 -0
  136. package/dist/Process-mL8fHDSB.d.cts +92 -0
  137. package/dist/Process.cjs +575 -0
  138. package/dist/Process.cjs.map +1 -0
  139. package/dist/Process.d.cts +8 -0
  140. package/dist/Process.d.ts +8 -0
  141. package/dist/Process.js +42 -0
  142. package/dist/Process.js.map +1 -0
  143. package/dist/ReadQuery-BlMwhe-F.d.ts +30 -0
  144. package/dist/ReadQuery-CL5XlXts.d.cts +30 -0
  145. package/dist/ReadQuery-SinbStGF.d.cts +38 -0
  146. package/dist/ReadQuery-SinbStGF.d.ts +38 -0
  147. package/dist/ReadQuery.cjs +377 -0
  148. package/dist/ReadQuery.cjs.map +1 -0
  149. package/dist/ReadQuery.d.cts +2 -0
  150. package/dist/ReadQuery.d.ts +2 -0
  151. package/dist/ReadQuery.js +14 -0
  152. package/dist/ReadQuery.js.map +1 -0
  153. package/dist/Reflection-CQnKwPXj.d.ts +182 -0
  154. package/dist/Reflection-Kabo1mlU.d.cts +182 -0
  155. package/dist/Reflection.cjs +2954 -0
  156. package/dist/Reflection.cjs.map +1 -0
  157. package/dist/Reflection.d.cts +17 -0
  158. package/dist/Reflection.d.ts +17 -0
  159. package/dist/Reflection.js +40 -0
  160. package/dist/Reflection.js.map +1 -0
  161. package/dist/Resource-Dy1xD_DG.d.cts +75 -0
  162. package/dist/Resource-Dy1xD_DG.d.ts +75 -0
  163. package/dist/Resource.cjs +166 -0
  164. package/dist/Resource.cjs.map +1 -0
  165. package/dist/Resource.d.cts +3 -0
  166. package/dist/Resource.d.ts +3 -0
  167. package/dist/Resource.js +21 -0
  168. package/dist/Resource.js.map +1 -0
  169. package/dist/Root-7ADUMk4t.d.cts +29 -0
  170. package/dist/Root-7ADUMk4t.d.ts +29 -0
  171. package/dist/Root.cjs +125 -0
  172. package/dist/Root.cjs.map +1 -0
  173. package/dist/Root.d.cts +4 -0
  174. package/dist/Root.d.ts +4 -0
  175. package/dist/Root.js +12 -0
  176. package/dist/Root.js.map +1 -0
  177. package/dist/Runtime-B-aL-f29.d.cts +274 -0
  178. package/dist/Runtime-CtyzZG4i.d.ts +274 -0
  179. package/dist/Runtime.cjs +5740 -0
  180. package/dist/Runtime.cjs.map +1 -0
  181. package/dist/Runtime.d.cts +19 -0
  182. package/dist/Runtime.d.ts +19 -0
  183. package/dist/Runtime.js +62 -0
  184. package/dist/Runtime.js.map +1 -0
  185. package/dist/ScopeRegistry-D1owDNSm.d.cts +61 -0
  186. package/dist/ScopeRegistry-D1owDNSm.d.ts +61 -0
  187. package/dist/ScopeRegistry.cjs +152 -0
  188. package/dist/ScopeRegistry.cjs.map +1 -0
  189. package/dist/ScopeRegistry.d.cts +2 -0
  190. package/dist/ScopeRegistry.d.ts +2 -0
  191. package/dist/ScopeRegistry.js +16 -0
  192. package/dist/ScopeRegistry.js.map +1 -0
  193. package/dist/State-CU50R26M.d.cts +19 -0
  194. package/dist/State-CU50R26M.d.ts +19 -0
  195. package/dist/State.cjs +19 -0
  196. package/dist/State.cjs.map +1 -0
  197. package/dist/State.d.cts +2 -0
  198. package/dist/State.d.ts +2 -0
  199. package/dist/State.js +2 -0
  200. package/dist/State.js.map +1 -0
  201. package/dist/StateTrait-BGsZghTz.d.ts +122 -0
  202. package/dist/StateTrait-OWhbj12c.d.cts +122 -0
  203. package/dist/StateTrait.cjs +2737 -0
  204. package/dist/StateTrait.cjs.map +1 -0
  205. package/dist/StateTrait.d.cts +9 -0
  206. package/dist/StateTrait.d.ts +9 -0
  207. package/dist/StateTrait.js +39 -0
  208. package/dist/StateTrait.js.map +1 -0
  209. package/dist/TraitLifecycle-CwV5WPFX.d.cts +88 -0
  210. package/dist/TraitLifecycle-LdIWmKlg.d.ts +88 -0
  211. package/dist/TraitLifecycle.cjs +581 -0
  212. package/dist/TraitLifecycle.cjs.map +1 -0
  213. package/dist/TraitLifecycle.d.cts +8 -0
  214. package/dist/TraitLifecycle.d.ts +8 -0
  215. package/dist/TraitLifecycle.js +24 -0
  216. package/dist/TraitLifecycle.js.map +1 -0
  217. package/dist/action-DiMDD_0v.d.cts +35 -0
  218. package/dist/action-DiMDD_0v.d.ts +35 -0
  219. package/dist/chunk-24VULZ7A.js +76 -0
  220. package/dist/chunk-24VULZ7A.js.map +1 -0
  221. package/dist/chunk-3IYZ5IGG.js +17 -0
  222. package/dist/chunk-3IYZ5IGG.js.map +1 -0
  223. package/dist/chunk-3QMIVH35.js +43 -0
  224. package/dist/chunk-3QMIVH35.js.map +1 -0
  225. package/dist/chunk-3RMKLXHX.js +83 -0
  226. package/dist/chunk-3RMKLXHX.js.map +1 -0
  227. package/dist/chunk-3TMODYZV.js +111 -0
  228. package/dist/chunk-3TMODYZV.js.map +1 -0
  229. package/dist/chunk-3VG5TWQR.js +27 -0
  230. package/dist/chunk-3VG5TWQR.js.map +1 -0
  231. package/dist/chunk-4CQAV7YB.js +37 -0
  232. package/dist/chunk-4CQAV7YB.js.map +1 -0
  233. package/dist/chunk-4SO6JMZL.js +7 -0
  234. package/dist/chunk-4SO6JMZL.js.map +1 -0
  235. package/dist/chunk-66ALHVEX.js +40 -0
  236. package/dist/chunk-66ALHVEX.js.map +1 -0
  237. package/dist/chunk-76WT3HOR.js +397 -0
  238. package/dist/chunk-76WT3HOR.js.map +1 -0
  239. package/dist/chunk-ANLBCBDC.js +285 -0
  240. package/dist/chunk-ANLBCBDC.js.map +1 -0
  241. package/dist/chunk-AUIR5O6W.js +75 -0
  242. package/dist/chunk-AUIR5O6W.js.map +1 -0
  243. package/dist/chunk-BABLDP24.js +445 -0
  244. package/dist/chunk-BABLDP24.js.map +1 -0
  245. package/dist/chunk-BE3HW4FY.js +1099 -0
  246. package/dist/chunk-BE3HW4FY.js.map +1 -0
  247. package/dist/chunk-BZ2SHDN2.js +54 -0
  248. package/dist/chunk-BZ2SHDN2.js.map +1 -0
  249. package/dist/chunk-CW6T36TN.js +393 -0
  250. package/dist/chunk-CW6T36TN.js.map +1 -0
  251. package/dist/chunk-DFNM3WX2.js +632 -0
  252. package/dist/chunk-DFNM3WX2.js.map +1 -0
  253. package/dist/chunk-DMBALCE2.js +1034 -0
  254. package/dist/chunk-DMBALCE2.js.map +1 -0
  255. package/dist/chunk-EGK3KN7B.js +406 -0
  256. package/dist/chunk-EGK3KN7B.js.map +1 -0
  257. package/dist/chunk-EY4NZKDR.js +19 -0
  258. package/dist/chunk-EY4NZKDR.js.map +1 -0
  259. package/dist/chunk-G5ZBFPNU.js +23 -0
  260. package/dist/chunk-G5ZBFPNU.js.map +1 -0
  261. package/dist/chunk-GMPEOUP2.js +31 -0
  262. package/dist/chunk-GMPEOUP2.js.map +1 -0
  263. package/dist/chunk-IHVBV5C2.js +279 -0
  264. package/dist/chunk-IHVBV5C2.js.map +1 -0
  265. package/dist/chunk-IPF7E66P.js +23 -0
  266. package/dist/chunk-IPF7E66P.js.map +1 -0
  267. package/dist/chunk-JCXGZRMU.js +204 -0
  268. package/dist/chunk-JCXGZRMU.js.map +1 -0
  269. package/dist/chunk-JGIWG6SR.js +6359 -0
  270. package/dist/chunk-JGIWG6SR.js.map +1 -0
  271. package/dist/chunk-JWOYLO27.js +241 -0
  272. package/dist/chunk-JWOYLO27.js.map +1 -0
  273. package/dist/chunk-KIXAU3GM.js +137 -0
  274. package/dist/chunk-KIXAU3GM.js.map +1 -0
  275. package/dist/chunk-KL5ACTCT.js +8 -0
  276. package/dist/chunk-KL5ACTCT.js.map +1 -0
  277. package/dist/chunk-KP7MUZNX.js +83 -0
  278. package/dist/chunk-KP7MUZNX.js.map +1 -0
  279. package/dist/chunk-LEU6UA5J.js +1 -0
  280. package/dist/chunk-LEU6UA5J.js.map +1 -0
  281. package/dist/chunk-M2RGJPXX.js +35 -0
  282. package/dist/chunk-M2RGJPXX.js.map +1 -0
  283. package/dist/chunk-M3BFQ7HK.js +13 -0
  284. package/dist/chunk-M3BFQ7HK.js.map +1 -0
  285. package/dist/chunk-M3WTHJHJ.js +1051 -0
  286. package/dist/chunk-M3WTHJHJ.js.map +1 -0
  287. package/dist/chunk-M7IYCTJV.js +79 -0
  288. package/dist/chunk-M7IYCTJV.js.map +1 -0
  289. package/dist/chunk-NBD3KUOZ.js +838 -0
  290. package/dist/chunk-NBD3KUOZ.js.map +1 -0
  291. package/dist/chunk-NQZ2OSGR.js +151 -0
  292. package/dist/chunk-NQZ2OSGR.js.map +1 -0
  293. package/dist/chunk-NZJKFF45.js +106 -0
  294. package/dist/chunk-NZJKFF45.js.map +1 -0
  295. package/dist/chunk-OFADUJWJ.js +175 -0
  296. package/dist/chunk-OFADUJWJ.js.map +1 -0
  297. package/dist/chunk-OGWBVHB3.js +461 -0
  298. package/dist/chunk-OGWBVHB3.js.map +1 -0
  299. package/dist/chunk-PAYXCY6A.js +1696 -0
  300. package/dist/chunk-PAYXCY6A.js.map +1 -0
  301. package/dist/chunk-PYOE4VSI.js +1924 -0
  302. package/dist/chunk-PYOE4VSI.js.map +1 -0
  303. package/dist/chunk-PZ5AY32C.js +10 -0
  304. package/dist/chunk-PZ5AY32C.js.map +1 -0
  305. package/dist/chunk-QCHIQWAJ.js +21 -0
  306. package/dist/chunk-QCHIQWAJ.js.map +1 -0
  307. package/dist/chunk-QMM6O4CD.js +71 -0
  308. package/dist/chunk-QMM6O4CD.js.map +1 -0
  309. package/dist/chunk-RNFE3ML2.js +22 -0
  310. package/dist/chunk-RNFE3ML2.js.map +1 -0
  311. package/dist/chunk-TAAPQVZN.js +23 -0
  312. package/dist/chunk-TAAPQVZN.js.map +1 -0
  313. package/dist/chunk-THATMZXD.js +21 -0
  314. package/dist/chunk-THATMZXD.js.map +1 -0
  315. package/dist/chunk-TKZ7MEIA.js +27 -0
  316. package/dist/chunk-TKZ7MEIA.js.map +1 -0
  317. package/dist/chunk-TQOBJYDP.js +7 -0
  318. package/dist/chunk-TQOBJYDP.js.map +1 -0
  319. package/dist/chunk-VZB726PE.js +93 -0
  320. package/dist/chunk-VZB726PE.js.map +1 -0
  321. package/dist/chunk-W3TEWHLO.js +568 -0
  322. package/dist/chunk-W3TEWHLO.js.map +1 -0
  323. package/dist/chunk-YS3AZQ2G.js +52 -0
  324. package/dist/chunk-YS3AZQ2G.js.map +1 -0
  325. package/dist/chunk-ZDTRWK5F.js +40 -0
  326. package/dist/chunk-ZDTRWK5F.js.map +1 -0
  327. package/dist/chunk-ZFLHVFUC.js +192 -0
  328. package/dist/chunk-ZFLHVFUC.js.map +1 -0
  329. package/dist/chunk-ZFY7U2FR.js +133 -0
  330. package/dist/chunk-ZFY7U2FR.js.map +1 -0
  331. package/dist/chunk-ZGDVUPTM.js +270 -0
  332. package/dist/chunk-ZGDVUPTM.js.map +1 -0
  333. package/dist/index.cjs +19700 -0
  334. package/dist/index.cjs.map +1 -0
  335. package/dist/index.d.cts +195 -0
  336. package/dist/index.d.ts +195 -0
  337. package/dist/index.js +286 -0
  338. package/dist/index.js.map +1 -0
  339. package/dist/ir-BMP7yxJJ.d.cts +39 -0
  340. package/dist/ir-DUOz6H-5.d.ts +39 -0
  341. package/dist/module-B8CBqIZ_.d.cts +1191 -0
  342. package/dist/module-k7m3txak.d.ts +1191 -0
  343. package/dist/protocol-g_1897M2.d.cts +127 -0
  344. package/dist/protocol-g_1897M2.d.ts +127 -0
  345. package/package.json +162 -0
package/dist/Flow.cjs ADDED
@@ -0,0 +1,504 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/Flow.ts
21
+ var Flow_exports = {};
22
+ __export(Flow_exports, {
23
+ make: () => make3
24
+ });
25
+ module.exports = __toCommonJS(Flow_exports);
26
+
27
+ // src/internal/runtime/core/FlowRuntime.ts
28
+ var import_effect6 = require("effect");
29
+
30
+ // src/internal/effect-op.ts
31
+ var import_effect3 = require("effect");
32
+
33
+ // src/internal/runtime/core/EffectOpCore.ts
34
+ var import_effect = require("effect");
35
+ var currentLinkId = import_effect.FiberRef.unsafeMake(void 0);
36
+ var EffectOpMiddlewareTag = class extends import_effect.Context.Tag("Logix/EffectOpMiddleware")() {
37
+ };
38
+ var composeMiddleware = (stack) => {
39
+ return (op) => stack.reduceRight(
40
+ (eff, mw) => mw({ ...op, effect: eff }),
41
+ op.effect
42
+ );
43
+ };
44
+ var runWithMiddleware = (op, stack) => {
45
+ return import_effect.Effect.gen(function* () {
46
+ const existing = yield* import_effect.FiberRef.get(currentLinkId);
47
+ const metaLinkId = op.meta?.linkId;
48
+ const linkId = typeof metaLinkId === "string" && metaLinkId.length > 0 ? metaLinkId : existing ?? op.id;
49
+ const nextOp = {
50
+ ...op,
51
+ meta: {
52
+ ...op.meta ?? {},
53
+ linkId
54
+ }
55
+ };
56
+ const program = stack.length ? composeMiddleware(stack)(nextOp) : nextOp.effect;
57
+ return yield* import_effect.Effect.locally(currentLinkId, linkId)(program);
58
+ });
59
+ };
60
+
61
+ // src/internal/observability/runSession.ts
62
+ var import_effect2 = require("effect");
63
+
64
+ // src/internal/observability/jsonValue.ts
65
+ var defaultOptions = {
66
+ maxDepth: 6,
67
+ maxObjectKeys: 32,
68
+ maxArrayLength: 32,
69
+ maxStringLength: 256,
70
+ maxJsonBytes: 4 * 1024,
71
+ oversizedPreviewBytes: 256
72
+ };
73
+
74
+ // src/internal/observability/runSession.ts
75
+ var RunSessionTagImpl = class extends import_effect2.Context.Tag("@logixjs/core/RunSession")() {
76
+ };
77
+ var RunSessionTag = RunSessionTagImpl;
78
+
79
+ // src/internal/effect-op.ts
80
+ var nextGlobalOpSeq = 0;
81
+ var nextOpSeq = () => {
82
+ nextGlobalOpSeq += 1;
83
+ return nextGlobalOpSeq;
84
+ };
85
+ var makeId = (instanceId, opSeq) => instanceId ? `${instanceId}::o${opSeq}` : `o${opSeq}`;
86
+ var make = (params) => ({
87
+ ...params.id ? { id: params.id, meta: params.meta } : (() => {
88
+ const meta = params.meta ?? {};
89
+ const instanceId = meta.instanceId;
90
+ const opSeq = typeof meta.opSeq === "number" && Number.isFinite(meta.opSeq) ? Math.floor(meta.opSeq) : nextOpSeq();
91
+ return {
92
+ id: makeId(instanceId, opSeq),
93
+ meta: meta.opSeq === opSeq ? meta : { ...meta, opSeq }
94
+ };
95
+ })(),
96
+ kind: params.kind,
97
+ name: params.name,
98
+ payload: params.payload,
99
+ effect: params.effect
100
+ });
101
+ var run = (op, stack) => runWithMiddleware(op, stack);
102
+
103
+ // src/internal/runtime/core/DebugSink.ts
104
+ var import_effect5 = require("effect");
105
+
106
+ // src/internal/runtime/core/errorSummary.ts
107
+ var import_effect4 = require("effect");
108
+
109
+ // src/internal/runtime/core/DebugSink.ts
110
+ var currentDebugSinks = import_effect5.FiberRef.unsafeMake([]);
111
+ var currentRuntimeLabel = import_effect5.FiberRef.unsafeMake(void 0);
112
+ var currentTxnId = import_effect5.FiberRef.unsafeMake(void 0);
113
+ var currentOpSeq = import_effect5.FiberRef.unsafeMake(void 0);
114
+ var currentDiagnosticsLevel = import_effect5.FiberRef.unsafeMake("off");
115
+ var currentTraitConvergeDiagnosticsSampling = import_effect5.FiberRef.unsafeMake({
116
+ sampleEveryN: 32,
117
+ topK: 3
118
+ });
119
+ var browserLifecycleSeen = /* @__PURE__ */ new Set();
120
+ var browserDiagnosticSeen = /* @__PURE__ */ new Set();
121
+ var lifecycleErrorLog = (event) => {
122
+ const moduleId = event.moduleId ?? "unknown";
123
+ const causePretty = (() => {
124
+ try {
125
+ return import_effect5.Cause.pretty(event.cause, {
126
+ renderErrorCause: true
127
+ });
128
+ } catch {
129
+ try {
130
+ return JSON.stringify(event.cause, null, 2);
131
+ } catch {
132
+ return String(event.cause);
133
+ }
134
+ }
135
+ })();
136
+ const message = `[Logix][module=${moduleId}] lifecycle:error
137
+ ${causePretty}`;
138
+ return import_effect5.Effect.logError(message).pipe(
139
+ import_effect5.Effect.annotateLogs({
140
+ "logix.moduleId": moduleId,
141
+ "logix.event": "lifecycle:error",
142
+ "logix.cause": causePretty
143
+ })
144
+ );
145
+ };
146
+ var diagnosticLog = (event) => {
147
+ const moduleId = event.moduleId ?? "unknown";
148
+ const header = `[Logix][module=${moduleId}] diagnostic(${event.severity})`;
149
+ const detail = `code=${event.code} message=${event.message}${event.actionTag ? ` action=${event.actionTag}` : ""}${event.hint ? `
150
+ hint: ${event.hint}` : ""}`;
151
+ const msg = `${header}
152
+ ${detail}`;
153
+ const base = event.severity === "warning" ? import_effect5.Effect.logWarning(msg) : event.severity === "info" ? import_effect5.Effect.logInfo(msg) : import_effect5.Effect.logError(msg);
154
+ const annotations = {
155
+ "logix.moduleId": moduleId,
156
+ "logix.event": `diagnostic(${event.severity})`,
157
+ "logix.diagnostic.code": event.code,
158
+ "logix.diagnostic.message": event.message
159
+ };
160
+ if (event.hint) {
161
+ annotations["logix.diagnostic.hint"] = event.hint;
162
+ }
163
+ if (event.actionTag) {
164
+ annotations["logix.diagnostic.actionTag"] = event.actionTag;
165
+ }
166
+ return base.pipe(import_effect5.Effect.annotateLogs(annotations));
167
+ };
168
+ var noopLayer = import_effect5.Layer.locallyScoped(currentDebugSinks, []);
169
+ var errorOnlySink = {
170
+ record: (event) => event.type === "lifecycle:error" ? lifecycleErrorLog(event) : event.type === "diagnostic" && event.severity !== "info" ? diagnosticLog(event) : import_effect5.Effect.void
171
+ };
172
+ var errorOnlyLayer = import_effect5.Layer.locallyScoped(currentDebugSinks, [errorOnlySink]);
173
+ var isErrorOnlyOnlySinks = (sinks) => sinks.length === 1 && sinks[0] === errorOnlySink;
174
+ var consoleSink = {
175
+ record: (event) => event.type === "lifecycle:error" ? lifecycleErrorLog(event) : event.type === "diagnostic" ? diagnosticLog(event) : import_effect5.Effect.logDebug({ debugEvent: event })
176
+ };
177
+ var consoleLayer = import_effect5.Layer.locallyScoped(currentDebugSinks, [consoleSink]);
178
+ var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
179
+ var renderBrowserConsoleEvent = (event) => {
180
+ if (typeof event.type === "string" && event.type.startsWith("trace:")) {
181
+ const moduleId = event.moduleId ?? "unknown";
182
+ const type = event.type;
183
+ return import_effect5.Effect.sync(() => {
184
+ console.groupCollapsed(
185
+ "%c[Logix]%c trace %c" + moduleId + "%c " + String(type),
186
+ "color:#6b7280;font-weight:bold",
187
+ // tag
188
+ "color:#3b82f6",
189
+ // label
190
+ "color:#9ca3af",
191
+ // module id
192
+ "color:#6b7280"
193
+ // type
194
+ );
195
+ console.log(event);
196
+ console.groupEnd();
197
+ });
198
+ }
199
+ if (event.type === "lifecycle:error") {
200
+ const moduleId = event.moduleId ?? "unknown";
201
+ const causePretty = (() => {
202
+ try {
203
+ return import_effect5.Cause.pretty(event.cause, { renderErrorCause: true });
204
+ } catch {
205
+ try {
206
+ return JSON.stringify(event.cause, null, 2);
207
+ } catch {
208
+ return String(event.cause);
209
+ }
210
+ }
211
+ })();
212
+ const key = `${moduleId}|${causePretty}`;
213
+ if (browserLifecycleSeen.has(key)) {
214
+ return import_effect5.Effect.void;
215
+ }
216
+ browserLifecycleSeen.add(key);
217
+ return import_effect5.Effect.sync(() => {
218
+ console.groupCollapsed(
219
+ "%c[Logix]%c lifecycle:error %c" + moduleId,
220
+ "color:#ef4444;font-weight:bold",
221
+ // tag
222
+ "color:#ef4444",
223
+ // label
224
+ "color:#9ca3af"
225
+ // module id
226
+ );
227
+ console.error(causePretty);
228
+ console.groupEnd();
229
+ });
230
+ }
231
+ if (event.type === "diagnostic") {
232
+ const moduleId = event.moduleId ?? "unknown";
233
+ const detail = `code=${event.code} message=${event.message}${event.actionTag ? ` action=${event.actionTag}` : ""}${event.hint ? `
234
+ hint: ${event.hint}` : ""}`;
235
+ const color = event.severity === "warning" ? "color:#d97706" : event.severity === "info" ? "color:#3b82f6" : "color:#ef4444";
236
+ const label = event.severity === "warning" ? "diagnostic(warning)" : event.severity === "info" ? "diagnostic(info)" : "diagnostic(error)";
237
+ const key = `${moduleId}|${event.code}|${event.message}`;
238
+ if (browserDiagnosticSeen.has(key)) {
239
+ return import_effect5.Effect.void;
240
+ }
241
+ browserDiagnosticSeen.add(key);
242
+ return import_effect5.Effect.sync(() => {
243
+ console.groupCollapsed(
244
+ "%c[Logix]%c " + label + "%c module=" + moduleId,
245
+ "color:#6b7280;font-weight:bold",
246
+ color,
247
+ "color:#9ca3af"
248
+ );
249
+ if (event.severity === "warning") {
250
+ console.warn(detail);
251
+ } else if (event.severity === "info") {
252
+ console.info(detail);
253
+ } else {
254
+ console.error(detail);
255
+ }
256
+ console.groupEnd();
257
+ });
258
+ }
259
+ return import_effect5.Effect.void;
260
+ };
261
+ var browserConsoleSink = {
262
+ record: (event) => {
263
+ if (!isBrowser) {
264
+ return event.type === "lifecycle:error" ? lifecycleErrorLog(event) : event.type === "diagnostic" ? diagnosticLog(event) : import_effect5.Effect.logDebug({ debugEvent: event });
265
+ }
266
+ return renderBrowserConsoleEvent(event);
267
+ }
268
+ };
269
+ var browserConsoleLayer = import_effect5.Layer.locallyScoped(currentDebugSinks, [browserConsoleSink]);
270
+ var browserDiagnosticConsoleSink = {
271
+ record: (event) => {
272
+ if (!isBrowser) {
273
+ return event.type === "lifecycle:error" ? lifecycleErrorLog(event) : event.type === "diagnostic" && event.severity !== "info" ? diagnosticLog(event) : import_effect5.Effect.void;
274
+ }
275
+ return event.type === "lifecycle:error" || event.type === "diagnostic" && event.severity !== "info" ? renderBrowserConsoleEvent(event) : import_effect5.Effect.void;
276
+ }
277
+ };
278
+ var browserDiagnosticConsoleLayer = import_effect5.Layer.locallyScoped(currentDebugSinks, [browserDiagnosticConsoleSink]);
279
+ var browserPrettyLoggerLayer = import_effect5.Logger.replace(
280
+ import_effect5.Logger.defaultLogger,
281
+ import_effect5.Logger.prettyLogger({ mode: "browser", colors: true })
282
+ );
283
+ var record = (event) => import_effect5.Effect.gen(function* () {
284
+ const sinks = yield* import_effect5.FiberRef.get(currentDebugSinks);
285
+ if (isErrorOnlyOnlySinks(sinks)) {
286
+ if (event.type === "lifecycle:error") {
287
+ yield* lifecycleErrorLog(event);
288
+ return;
289
+ }
290
+ if (event.type === "diagnostic") {
291
+ if (event.severity !== "info") {
292
+ yield* diagnosticLog(event);
293
+ } else {
294
+ yield* import_effect5.Effect.void;
295
+ }
296
+ return;
297
+ }
298
+ yield* import_effect5.Effect.void;
299
+ return;
300
+ }
301
+ if (sinks.length === 0) {
302
+ if (isBrowser) {
303
+ if (event.type === "lifecycle:error" || event.type === "diagnostic") {
304
+ yield* renderBrowserConsoleEvent(event);
305
+ return;
306
+ }
307
+ yield* import_effect5.Effect.void;
308
+ return;
309
+ }
310
+ if (event.type === "lifecycle:error") {
311
+ yield* lifecycleErrorLog(event);
312
+ return;
313
+ }
314
+ if (event.type === "diagnostic") {
315
+ yield* diagnosticLog(event);
316
+ return;
317
+ }
318
+ yield* import_effect5.Effect.void;
319
+ return;
320
+ }
321
+ const enriched = event;
322
+ const diagnosticsLevel = yield* import_effect5.FiberRef.get(currentDiagnosticsLevel);
323
+ let now;
324
+ const getNow = () => {
325
+ if (now === void 0) now = Date.now();
326
+ return now;
327
+ };
328
+ if (enriched.timestamp === void 0 && (diagnosticsLevel !== "off" || enriched.type === "lifecycle:error" || enriched.type === "diagnostic")) {
329
+ ;
330
+ enriched.timestamp = getNow();
331
+ }
332
+ if (diagnosticsLevel !== "off" && enriched.runtimeLabel === void 0) {
333
+ const runtimeLabel = yield* import_effect5.FiberRef.get(currentRuntimeLabel);
334
+ if (runtimeLabel) {
335
+ ;
336
+ enriched.runtimeLabel = runtimeLabel;
337
+ }
338
+ }
339
+ if (enriched.type === "diagnostic" && enriched.txnId === void 0) {
340
+ const txnId = yield* import_effect5.FiberRef.get(currentTxnId);
341
+ if (txnId) {
342
+ ;
343
+ enriched.txnId = txnId;
344
+ }
345
+ }
346
+ if (diagnosticsLevel !== "off" && enriched.type === "trace:effectop" && enriched.linkId === void 0) {
347
+ const linkId = yield* import_effect5.FiberRef.get(currentLinkId);
348
+ if (linkId) {
349
+ ;
350
+ enriched.linkId = linkId;
351
+ }
352
+ }
353
+ if (sinks.length === 1) {
354
+ yield* sinks[0].record(enriched);
355
+ return;
356
+ }
357
+ yield* import_effect5.Effect.forEach(sinks, (sink) => sink.record(enriched), { discard: true });
358
+ });
359
+
360
+ // src/internal/runtime/core/ReadQuery.ts
361
+ function isReadQuery(input) {
362
+ if (!input || typeof input !== "object" && typeof input !== "function") return false;
363
+ const maybe = input;
364
+ return typeof maybe.selectorId === "string" && typeof maybe.select === "function" && Array.isArray(maybe.reads);
365
+ }
366
+
367
+ // src/internal/runtime/core/FlowRuntime.ts
368
+ var getMiddlewareStack = () => import_effect6.Effect.serviceOption(EffectOpMiddlewareTag).pipe(
369
+ import_effect6.Effect.map((maybe) => import_effect6.Option.isSome(maybe) ? maybe.value.stack : [])
370
+ );
371
+ var getRuntimeScope = (runtime) => {
372
+ if (!runtime) return {};
373
+ if (typeof runtime !== "object" && typeof runtime !== "function") return {};
374
+ const scope = runtime;
375
+ return {
376
+ moduleId: typeof scope.moduleId === "string" ? scope.moduleId : void 0,
377
+ instanceId: typeof scope.instanceId === "string" ? scope.instanceId : void 0
378
+ };
379
+ };
380
+ var resolveEffect = (eff, payload) => typeof eff === "function" ? eff(payload) : eff;
381
+ var make2 = (runtime, runtimeInternals) => {
382
+ const scope = getRuntimeScope(runtime);
383
+ const resolveConcurrencyLimit = () => runtimeInternals ? runtimeInternals.concurrency.resolveConcurrencyPolicy().pipe(import_effect6.Effect.map((p) => p.concurrencyLimit)) : import_effect6.Effect.succeed(16);
384
+ const runAsFlowOp = (name, payload, eff, options) => import_effect6.Effect.gen(function* () {
385
+ const stack = yield* getMiddlewareStack();
386
+ const meta = {
387
+ ...options?.meta ?? {},
388
+ policy: options?.policy,
389
+ tags: options?.tags,
390
+ trace: options?.trace,
391
+ moduleId: scope.moduleId,
392
+ instanceId: scope.instanceId
393
+ };
394
+ if (!(typeof meta.opSeq === "number" && Number.isFinite(meta.opSeq))) {
395
+ const sessionOpt = yield* import_effect6.Effect.serviceOption(RunSessionTag);
396
+ if (import_effect6.Option.isSome(sessionOpt)) {
397
+ const key = meta.instanceId ?? "global";
398
+ meta.opSeq = sessionOpt.value.local.nextSeq("opSeq", key);
399
+ }
400
+ }
401
+ const op = make({
402
+ kind: "flow",
403
+ name,
404
+ payload,
405
+ effect: eff,
406
+ meta
407
+ });
408
+ return yield* run(op, stack);
409
+ });
410
+ const runEffect = (eff) => (payload) => resolveEffect(eff, payload);
411
+ const runStreamSequential = (eff, options) => (stream) => import_effect6.Stream.runForEach(
412
+ stream,
413
+ (payload) => runAsFlowOp("flow.run", payload, runEffect(eff)(payload), options)
414
+ );
415
+ const runStreamParallel = (eff, options) => (stream) => import_effect6.Effect.gen(function* () {
416
+ const concurrency = yield* resolveConcurrencyLimit();
417
+ return yield* import_effect6.Stream.runDrain(
418
+ stream.pipe(
419
+ import_effect6.Stream.mapEffect(
420
+ (payload) => runAsFlowOp("flow.runParallel", payload, runEffect(eff)(payload), options),
421
+ { concurrency }
422
+ )
423
+ )
424
+ ).pipe(
425
+ import_effect6.Effect.catchAllCause(
426
+ (cause) => record({
427
+ type: "diagnostic",
428
+ moduleId: scope.moduleId,
429
+ instanceId: scope.instanceId,
430
+ code: "flow::unhandled_failure",
431
+ severity: "error",
432
+ message: "Flow watcher (runParallel) failed with an unhandled error.",
433
+ hint: "Handle errors explicitly inside the watcher (catch/catchAll) or write back via TaskRunner failure; avoid silent failures.",
434
+ kind: "flow_unhandled_failure",
435
+ trigger: {
436
+ kind: "flow",
437
+ name: "runParallel"
438
+ }
439
+ }).pipe(import_effect6.Effect.zipRight(import_effect6.Effect.failCause(cause)))
440
+ )
441
+ );
442
+ });
443
+ return {
444
+ fromAction: (predicate) => runtime.actions$.pipe(import_effect6.Stream.filter(predicate)),
445
+ fromState: (selectorOrQuery) => runtime.changes(isReadQuery(selectorOrQuery) ? selectorOrQuery.select : selectorOrQuery),
446
+ debounce: (ms) => (stream) => import_effect6.Stream.debounce(stream, ms),
447
+ throttle: (ms) => (stream) => import_effect6.Stream.throttle(stream, {
448
+ cost: () => 1,
449
+ units: 1,
450
+ duration: ms,
451
+ strategy: "enforce"
452
+ }),
453
+ filter: (predicate) => (stream) => import_effect6.Stream.filter(stream, predicate),
454
+ run: (eff, options) => (stream) => runStreamSequential(eff, options)(stream),
455
+ runParallel: (eff, options) => (stream) => runStreamParallel(eff, options)(stream),
456
+ runLatest: (eff, options) => (stream) => import_effect6.Stream.runDrain(
457
+ import_effect6.Stream.map(
458
+ stream,
459
+ (payload) => runAsFlowOp(
460
+ "flow.runLatest",
461
+ payload,
462
+ runEffect(eff)(payload),
463
+ options
464
+ )
465
+ ).pipe(
466
+ import_effect6.Stream.flatMap((effect) => import_effect6.Stream.fromEffect(effect), {
467
+ switch: true
468
+ })
469
+ )
470
+ ),
471
+ runExhaust: (eff, options) => (stream) => import_effect6.Effect.gen(function* () {
472
+ const concurrency = yield* resolveConcurrencyLimit();
473
+ const busyRef = yield* import_effect6.Ref.make(false);
474
+ const mapper = (payload) => import_effect6.Effect.gen(function* () {
475
+ const acquired = yield* import_effect6.Ref.modify(
476
+ busyRef,
477
+ (busy) => busy ? [false, busy] : [true, true]
478
+ );
479
+ if (!acquired) {
480
+ return;
481
+ }
482
+ try {
483
+ yield* runAsFlowOp(
484
+ "flow.runExhaust",
485
+ payload,
486
+ runEffect(eff)(payload),
487
+ options
488
+ );
489
+ } finally {
490
+ yield* import_effect6.Ref.set(busyRef, false);
491
+ }
492
+ });
493
+ return yield* import_effect6.Stream.runDrain(stream.pipe(import_effect6.Stream.mapEffect(mapper, { concurrency })));
494
+ })
495
+ };
496
+ };
497
+
498
+ // src/Flow.ts
499
+ var make3 = make2;
500
+ // Annotate the CommonJS export names for ESM import in node:
501
+ 0 && (module.exports = {
502
+ make
503
+ });
504
+ //# sourceMappingURL=Flow.cjs.map