@graphrefly/graphrefly 0.26.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (396) hide show
  1. package/dist/backoff-HPZMEZNF.js +1 -0
  2. package/dist/cascading-B-5zmAUv.d.cts +180 -0
  3. package/dist/cascading-D9WG1-9L.d.ts +180 -0
  4. package/dist/chunk-2FOAM3OR.js +1 -0
  5. package/dist/chunk-2PMCKKRK.js +1 -0
  6. package/dist/chunk-3JXNEPCD.js +2 -0
  7. package/dist/chunk-3R5HFPX7.js +78 -0
  8. package/dist/chunk-4GKB4OUJ.js +1 -0
  9. package/dist/chunk-4VVTGLXJ.js +1 -0
  10. package/dist/chunk-5QDBSZBV.js +1 -0
  11. package/dist/chunk-6QZNQS5B.js +1 -0
  12. package/dist/chunk-6V3SEX2I.js +1 -0
  13. package/dist/chunk-76A3HVQE.js +9 -0
  14. package/dist/chunk-7H6LGFUG.js +64 -0
  15. package/dist/chunk-CK2E7BTU.js +1 -0
  16. package/dist/chunk-CKCSDI7T.js +6 -0
  17. package/dist/chunk-CRXTH3SH.js +1 -0
  18. package/dist/chunk-CWLN3X3N.js +1 -0
  19. package/dist/chunk-D7A7DBE4.js +1 -0
  20. package/dist/chunk-DBGGMN3D.js +1 -0
  21. package/dist/chunk-DQA3UIQ2.js +1 -0
  22. package/dist/chunk-ERLIRFPA.js +1 -0
  23. package/dist/chunk-ESMPEKEV.js +1 -0
  24. package/dist/chunk-ETWTCCJI.js +1 -0
  25. package/dist/chunk-FNYWM6JC.js +1 -0
  26. package/dist/chunk-GHJJR5P4.js +1 -0
  27. package/dist/chunk-GPW2V3RE.js +1 -0
  28. package/dist/chunk-I6VIH3VA.js +1 -0
  29. package/dist/chunk-K2GNMCQT.js +1 -0
  30. package/dist/chunk-LBTDSCCO.js +3 -0
  31. package/dist/chunk-LQ3Y5NJS.js +1 -0
  32. package/dist/chunk-MIQTDPY4.js +5 -0
  33. package/dist/chunk-MTTAAPCK.js +1 -0
  34. package/dist/chunk-OAWLCNJJ.js +1 -0
  35. package/dist/chunk-OBKQQA5I.js +1 -0
  36. package/dist/chunk-OYHGKYQM.js +1 -0
  37. package/dist/chunk-PIOGHC63.js +1 -0
  38. package/dist/chunk-QWAPKG3O.js +2 -0
  39. package/dist/chunk-QYADASLV.js +1 -0
  40. package/dist/chunk-RHESUC3V.js +43 -0
  41. package/dist/chunk-S35VARIR.js +1 -0
  42. package/dist/chunk-SC3U7ETD.js +1 -0
  43. package/dist/chunk-U3AICJKU.js +1 -0
  44. package/dist/chunk-UMBIDLJ4.js +1 -0
  45. package/dist/chunk-UPHHLMHE.js +1 -0
  46. package/dist/chunk-UPXUCFMX.js +1 -0
  47. package/dist/chunk-UWJE5FQA.js +18 -0
  48. package/dist/chunk-V6YQICXZ.js +1 -0
  49. package/dist/chunk-VIMF6LGM.js +1 -0
  50. package/dist/chunk-VJLMUKOI.js +1 -0
  51. package/dist/chunk-VPYBOXVT.js +1 -0
  52. package/dist/chunk-VTPVOGHH.js +1 -0
  53. package/dist/chunk-WQ2BN6X6.js +1 -0
  54. package/dist/chunk-XAUNPIMX.js +1 -0
  55. package/dist/chunk-Y2EMPB3I.js +1 -0
  56. package/dist/chunk-Z4HDAS2Q.js +1 -0
  57. package/dist/chunk-ZB5EHBIO.js +1 -0
  58. package/dist/chunk-ZV2DXV5A.js +23 -0
  59. package/dist/compat/index.cjs +14 -7656
  60. package/dist/compat/index.d.cts +15 -14
  61. package/dist/compat/index.d.ts +15 -14
  62. package/dist/compat/index.js +1 -49
  63. package/dist/compat/jotai/index.cjs +1 -2048
  64. package/dist/compat/jotai/index.d.cts +2 -2
  65. package/dist/compat/jotai/index.d.ts +2 -2
  66. package/dist/compat/jotai/index.js +1 -9
  67. package/dist/compat/nanostores/index.cjs +1 -2175
  68. package/dist/compat/nanostores/index.d.cts +2 -2
  69. package/dist/compat/nanostores/index.d.ts +2 -2
  70. package/dist/compat/nanostores/index.js +1 -23
  71. package/dist/compat/nestjs/index.cjs +14 -6782
  72. package/dist/compat/nestjs/index.d.cts +7 -6
  73. package/dist/compat/nestjs/index.d.ts +7 -6
  74. package/dist/compat/nestjs/index.js +1 -82
  75. package/dist/compat/react/index.cjs +1 -141
  76. package/dist/compat/react/index.d.cts +2 -2
  77. package/dist/compat/react/index.d.ts +2 -2
  78. package/dist/compat/react/index.js +1 -12
  79. package/dist/compat/solid/index.cjs +1 -128
  80. package/dist/compat/solid/index.d.cts +2 -2
  81. package/dist/compat/solid/index.d.ts +2 -2
  82. package/dist/compat/solid/index.js +1 -12
  83. package/dist/compat/svelte/index.cjs +1 -131
  84. package/dist/compat/svelte/index.d.cts +2 -2
  85. package/dist/compat/svelte/index.d.ts +2 -2
  86. package/dist/compat/svelte/index.js +1 -12
  87. package/dist/compat/vue/index.cjs +1 -146
  88. package/dist/compat/vue/index.d.cts +2 -2
  89. package/dist/compat/vue/index.d.ts +2 -2
  90. package/dist/compat/vue/index.js +1 -12
  91. package/dist/compat/zustand/index.cjs +6 -4931
  92. package/dist/compat/zustand/index.d.cts +5 -5
  93. package/dist/compat/zustand/index.d.ts +5 -5
  94. package/dist/compat/zustand/index.js +1 -12
  95. package/dist/composite-B-xqw4Kk.d.cts +69 -0
  96. package/dist/composite-BhbKHbOS.d.ts +69 -0
  97. package/dist/core/index.cjs +1 -2271
  98. package/dist/core/index.d.cts +4 -3
  99. package/dist/core/index.d.ts +4 -3
  100. package/dist/core/index.js +1 -110
  101. package/dist/extra/browser.cjs +1 -0
  102. package/dist/extra/browser.d.cts +3 -0
  103. package/dist/extra/browser.d.ts +3 -0
  104. package/dist/extra/browser.js +1 -0
  105. package/dist/extra/index.cjs +23 -9971
  106. package/dist/extra/index.d.cts +13 -5
  107. package/dist/extra/index.d.ts +13 -5
  108. package/dist/extra/index.js +1 -375
  109. package/dist/extra/node.cjs +3 -0
  110. package/dist/extra/node.d.cts +81 -0
  111. package/dist/extra/node.d.ts +81 -0
  112. package/dist/extra/node.js +2 -0
  113. package/dist/extra/operators.cjs +1 -0
  114. package/dist/extra/operators.d.cts +910 -0
  115. package/dist/extra/operators.d.ts +910 -0
  116. package/dist/extra/operators.js +1 -0
  117. package/dist/extra/reactive.cjs +1 -0
  118. package/dist/extra/reactive.d.cts +352 -0
  119. package/dist/extra/reactive.d.ts +352 -0
  120. package/dist/extra/reactive.js +1 -0
  121. package/dist/extra/sources.cjs +1 -2486
  122. package/dist/extra/sources.d.cts +6 -2
  123. package/dist/extra/sources.d.ts +6 -2
  124. package/dist/extra/sources.js +1 -57
  125. package/dist/extra/storage-browser.cjs +1 -0
  126. package/dist/extra/storage-browser.d.cts +71 -0
  127. package/dist/extra/storage-browser.d.ts +71 -0
  128. package/dist/extra/storage-browser.js +1 -0
  129. package/dist/extra/storage-core.cjs +1 -0
  130. package/dist/extra/storage-core.d.cts +98 -0
  131. package/dist/extra/storage-core.d.ts +98 -0
  132. package/dist/extra/storage-core.js +1 -0
  133. package/dist/extra/storage-node.cjs +2 -0
  134. package/dist/extra/storage-node.d.cts +60 -0
  135. package/dist/extra/storage-node.d.ts +60 -0
  136. package/dist/extra/storage-node.js +1 -0
  137. package/dist/fallback-BaTS7vVY.d.cts +258 -0
  138. package/dist/fallback-eOm3LNxP.d.ts +258 -0
  139. package/dist/graph/index.cjs +6 -5030
  140. package/dist/graph/index.d.cts +6 -5
  141. package/dist/graph/index.d.ts +6 -5
  142. package/dist/graph/index.js +1 -50
  143. package/dist/{graph-6tZ5jEzr.d.cts → graph-BZGRXwOm.d.ts} +134 -31
  144. package/dist/{graph-DQ69XU0g.d.ts → graph-D48Qw9Cg.d.cts} +134 -31
  145. package/dist/index-8FSVk4Uf.d.ts +135 -0
  146. package/dist/index-9oDeHH2u.d.cts +291 -0
  147. package/dist/index-B0c4cmIO.d.ts +207 -0
  148. package/dist/{index-CDAjUFIv.d.ts → index-B1AmmSlb.d.ts} +1 -1
  149. package/dist/{index-Bd_fwmLf.d.cts → index-B2pwesl9.d.cts} +1 -1
  150. package/dist/index-BHvIquRZ.d.ts +1957 -0
  151. package/dist/{index-CPgZ5wRl.d.ts → index-BVHOrDwO.d.ts} +1 -1
  152. package/dist/{index-DrISNAOm.d.ts → index-BWJV63ti.d.ts} +1 -1
  153. package/dist/{index-B_IP40nB.d.cts → index-B_agccPe.d.cts} +1 -1
  154. package/dist/index-BgyGlizc.d.ts +163 -0
  155. package/dist/index-BpA5c4G9.d.ts +357 -0
  156. package/dist/index-BpIFjILY.d.cts +357 -0
  157. package/dist/{index-qldRdbQw.d.ts → index-Bqachn9_.d.ts} +1 -1
  158. package/dist/index-Btib9rsU.d.ts +607 -0
  159. package/dist/{index-BYOHF0zP.d.ts → index-BwM9BEkt.d.ts} +1 -1
  160. package/dist/index-BxJ86YZZ.d.cts +105 -0
  161. package/dist/index-C73n7lo-.d.cts +251 -0
  162. package/dist/index-CEXXwWVH.d.cts +192 -0
  163. package/dist/index-CHEswufn.d.cts +163 -0
  164. package/dist/{index-xdGjv0nO.d.ts → index-CMn8S8Hw.d.ts} +1 -1
  165. package/dist/{index-QBpffFW-.d.cts → index-CRO83MmV.d.cts} +1 -1
  166. package/dist/{index-BjI6ty9z.d.ts → index-CloUk1kY.d.ts} +9 -9
  167. package/dist/index-CpgYhnrG.d.ts +291 -0
  168. package/dist/{index-CUyrtuOf.d.cts → index-Cyojz0AE.d.cts} +1 -1
  169. package/dist/{demo-shell-DEp-nMTl.d.ts → index-CzobVSMr.d.ts} +14 -14
  170. package/dist/index-Czq6ynh8.d.ts +143 -0
  171. package/dist/index-D-YB-Vl3.d.ts +195 -0
  172. package/dist/index-DAlweici.d.ts +231 -0
  173. package/dist/index-DEwTb_fm.d.cts +1957 -0
  174. package/dist/{index-DFhjO4Gg.d.cts → index-DL-rYJrx.d.cts} +1 -1
  175. package/dist/index-DP4ZTkdw.d.ts +139 -0
  176. package/dist/{index-BeIdBfcb.d.cts → index-DUqMOlKZ.d.cts} +200 -2366
  177. package/dist/{index-Bxb5ZYc9.d.cts → index-D_NwnRYS.d.cts} +1 -1
  178. package/dist/index-DaLJvH8Z.d.ts +105 -0
  179. package/dist/index-DcXZBF5a.d.cts +135 -0
  180. package/dist/index-DfyOkTvs.d.ts +321 -0
  181. package/dist/{index-CmnuOibw.d.ts → index-DiOXyAwt.d.ts} +1 -1
  182. package/dist/index-DpHe5e0Q.d.ts +186 -0
  183. package/dist/index-DraikLjn.d.ts +86 -0
  184. package/dist/{index-BEfE8H_G.d.cts → index-DxsnAMWD.d.cts} +9 -9
  185. package/dist/index-DyxjtScX.d.cts +207 -0
  186. package/dist/index-HDpJe9hX.d.ts +251 -0
  187. package/dist/index-O6TgGUBV.d.cts +195 -0
  188. package/dist/{index-B4MP_8V_.d.cts → index-Oi8d8w4R.d.cts} +1 -1
  189. package/dist/{index-BW1z3BN9.d.ts → index-ROpQmGjE.d.ts} +30 -6
  190. package/dist/index-RukJ4DLS.d.cts +607 -0
  191. package/dist/{index-DdD5MVDL.d.ts → index-ZftwfxJM.d.ts} +200 -2366
  192. package/dist/{index-CuYwdKO-.d.ts → index-cByzxQIC.d.cts} +10 -195
  193. package/dist/index-dtN7YA2x.d.cts +143 -0
  194. package/dist/{index-C8mdwMXc.d.cts → index-fM6y00vT.d.cts} +30 -6
  195. package/dist/{index-_oMEWlDq.d.cts → index-m-yHof5p.d.ts} +10 -195
  196. package/dist/index-pXrDMpRO.d.cts +231 -0
  197. package/dist/index-rHJSKsU8.d.cts +186 -0
  198. package/dist/index-rX8HBM5h.d.cts +321 -0
  199. package/dist/{index-CUwyr1Kk.d.cts → index-rnwQly8X.d.cts} +147 -20
  200. package/dist/index-sm373fsH.d.ts +192 -0
  201. package/dist/index-tbf2gKHd.d.cts +139 -0
  202. package/dist/{demo-shell-26p5fVxn.d.cts → index-u15meRxL.d.cts} +14 -14
  203. package/dist/{index-eJ6T_qGM.d.ts → index-umtoWT8K.d.ts} +147 -20
  204. package/dist/index-vscRDkjW.d.cts +86 -0
  205. package/dist/index.cjs +150 -24142
  206. package/dist/index.d.cts +69 -3756
  207. package/dist/index.d.ts +69 -3756
  208. package/dist/index.js +1 -7292
  209. package/dist/{meta-C0-8XW6Q.d.cts → meta-Cgj6zeji.d.cts} +5 -5
  210. package/dist/{meta-BGqSZ7mt.d.ts → meta-CwesDrMD.d.ts} +5 -5
  211. package/dist/{node-C_IBuvX2.d.cts → node-Cc1TniY8.d.cts} +36 -9
  212. package/dist/{node-C_IBuvX2.d.ts → node-Cc1TniY8.d.ts} +36 -9
  213. package/dist/{observable-DCk45RH5.d.ts → observable-Ct-gJ9jI.d.ts} +1 -1
  214. package/dist/{observable-Crr1jgzx.d.cts → observable-glXQoGj2.d.cts} +1 -1
  215. package/dist/patterns/ai/browser.cjs +25 -0
  216. package/dist/patterns/ai/browser.d.cts +127 -0
  217. package/dist/patterns/ai/browser.d.ts +127 -0
  218. package/dist/patterns/ai/browser.js +3 -0
  219. package/dist/patterns/ai/index.cjs +91 -0
  220. package/dist/patterns/ai/index.d.cts +17 -0
  221. package/dist/patterns/ai/index.d.ts +17 -0
  222. package/dist/patterns/ai/index.js +1 -0
  223. package/dist/patterns/ai/node.cjs +2 -0
  224. package/dist/patterns/ai/node.d.cts +58 -0
  225. package/dist/patterns/ai/node.d.ts +58 -0
  226. package/dist/patterns/ai/node.js +1 -0
  227. package/dist/patterns/audit/index.cjs +6 -0
  228. package/dist/patterns/audit/index.d.cts +6 -0
  229. package/dist/patterns/audit/index.d.ts +6 -0
  230. package/dist/patterns/audit/index.js +1 -0
  231. package/dist/patterns/cqrs/index.cjs +6 -0
  232. package/dist/patterns/cqrs/index.d.cts +5 -0
  233. package/dist/patterns/cqrs/index.d.ts +5 -0
  234. package/dist/patterns/cqrs/index.js +1 -0
  235. package/dist/patterns/demo-shell/index.cjs +7 -0
  236. package/dist/patterns/demo-shell/index.d.cts +6 -0
  237. package/dist/patterns/demo-shell/index.d.ts +6 -0
  238. package/dist/patterns/demo-shell/index.js +1 -0
  239. package/dist/patterns/domain-templates/index.cjs +6 -0
  240. package/dist/patterns/domain-templates/index.d.cts +5 -0
  241. package/dist/patterns/domain-templates/index.d.ts +5 -0
  242. package/dist/patterns/domain-templates/index.js +1 -0
  243. package/dist/patterns/graphspec/index.cjs +83 -0
  244. package/dist/patterns/graphspec/index.d.cts +7 -0
  245. package/dist/patterns/graphspec/index.d.ts +7 -0
  246. package/dist/patterns/graphspec/index.js +1 -0
  247. package/dist/patterns/guarded-execution/index.cjs +6 -0
  248. package/dist/patterns/guarded-execution/index.d.cts +7 -0
  249. package/dist/patterns/guarded-execution/index.d.ts +7 -0
  250. package/dist/patterns/guarded-execution/index.js +1 -0
  251. package/dist/patterns/harness/index.cjs +48 -0
  252. package/dist/patterns/harness/index.d.cts +8 -0
  253. package/dist/patterns/harness/index.d.ts +8 -0
  254. package/dist/patterns/harness/index.js +1 -0
  255. package/dist/patterns/job-queue/index.cjs +6 -0
  256. package/dist/patterns/job-queue/index.d.cts +5 -0
  257. package/dist/patterns/job-queue/index.d.ts +5 -0
  258. package/dist/patterns/job-queue/index.js +1 -0
  259. package/dist/patterns/lens/index.cjs +6 -0
  260. package/dist/patterns/lens/index.d.cts +7 -0
  261. package/dist/patterns/lens/index.d.ts +7 -0
  262. package/dist/patterns/lens/index.js +1 -0
  263. package/dist/patterns/memory/index.cjs +6 -0
  264. package/dist/patterns/memory/index.d.cts +5 -0
  265. package/dist/patterns/memory/index.d.ts +5 -0
  266. package/dist/patterns/memory/index.js +1 -0
  267. package/dist/patterns/messaging/index.cjs +6 -0
  268. package/dist/patterns/messaging/index.d.cts +5 -0
  269. package/dist/patterns/messaging/index.d.ts +5 -0
  270. package/dist/patterns/messaging/index.js +1 -0
  271. package/dist/patterns/orchestration/index.cjs +6 -0
  272. package/dist/patterns/orchestration/index.d.cts +6 -0
  273. package/dist/patterns/orchestration/index.d.ts +6 -0
  274. package/dist/patterns/orchestration/index.js +1 -0
  275. package/dist/patterns/reactive-layout/index.cjs +7 -6444
  276. package/dist/patterns/reactive-layout/index.d.cts +6 -6
  277. package/dist/patterns/reactive-layout/index.d.ts +6 -6
  278. package/dist/patterns/reactive-layout/index.js +1 -56
  279. package/dist/patterns/reduction/index.cjs +6 -0
  280. package/dist/patterns/reduction/index.d.cts +5 -0
  281. package/dist/patterns/reduction/index.d.ts +5 -0
  282. package/dist/patterns/reduction/index.js +1 -0
  283. package/dist/patterns/refine-loop/index.cjs +8 -0
  284. package/dist/patterns/refine-loop/index.d.cts +7 -0
  285. package/dist/patterns/refine-loop/index.d.ts +7 -0
  286. package/dist/patterns/refine-loop/index.js +1 -0
  287. package/dist/patterns/resilient-pipeline/index.cjs +1 -0
  288. package/dist/patterns/resilient-pipeline/index.d.cts +7 -0
  289. package/dist/patterns/resilient-pipeline/index.d.ts +7 -0
  290. package/dist/patterns/resilient-pipeline/index.js +1 -0
  291. package/dist/patterns/surface/index.cjs +14 -0
  292. package/dist/patterns/surface/index.d.cts +8 -0
  293. package/dist/patterns/surface/index.d.ts +8 -0
  294. package/dist/patterns/surface/index.js +1 -0
  295. package/dist/{reactive-layout-BaOQefHu.d.cts → reactive-layout-CpYb5qLP.d.cts} +2 -2
  296. package/dist/{reactive-layout-D9gejYXE.d.ts → reactive-layout-D8u4wuUR.d.ts} +2 -2
  297. package/dist/reactive-log-DPzuUDj5.d.cts +190 -0
  298. package/dist/reactive-log-YuH9VYN8.d.ts +190 -0
  299. package/dist/reactive-map-CdbNoSgP.d.ts +238 -0
  300. package/dist/reactive-map-DUeRmb9d.d.cts +238 -0
  301. package/dist/resilience-Ba5-b4WD.d.cts +493 -0
  302. package/dist/resilience-CGRzhnD3.d.ts +493 -0
  303. package/dist/resilience-QAHKANT5.js +1 -0
  304. package/dist/sugar-BV0htudb.d.cts +205 -0
  305. package/dist/sugar-Dtyrq2_q.d.ts +205 -0
  306. package/dist/topology-tree-CYHOwQZ_.d.ts +25 -0
  307. package/dist/topology-tree-DROUdq5B.d.cts +25 -0
  308. package/dist/types-O3GzJY2U.d.cts +401 -0
  309. package/dist/types-u64Ose53.d.ts +401 -0
  310. package/package.json +267 -7
  311. package/dist/chunk-3ZWCKRHX.js +0 -117
  312. package/dist/chunk-3ZWCKRHX.js.map +0 -1
  313. package/dist/chunk-6LDQFTYS.js +0 -102
  314. package/dist/chunk-6LDQFTYS.js.map +0 -1
  315. package/dist/chunk-7TAQJHQV.js +0 -103
  316. package/dist/chunk-7TAQJHQV.js.map +0 -1
  317. package/dist/chunk-AMCG74RZ.js +0 -7000
  318. package/dist/chunk-AMCG74RZ.js.map +0 -1
  319. package/dist/chunk-BVZYTZ5H.js +0 -599
  320. package/dist/chunk-BVZYTZ5H.js.map +0 -1
  321. package/dist/chunk-FQMKGR6L.js +0 -330
  322. package/dist/chunk-FQMKGR6L.js.map +0 -1
  323. package/dist/chunk-HXZEYDUR.js +0 -94
  324. package/dist/chunk-HXZEYDUR.js.map +0 -1
  325. package/dist/chunk-IZYUSJC7.js +0 -1369
  326. package/dist/chunk-IZYUSJC7.js.map +0 -1
  327. package/dist/chunk-J22W6HV3.js +0 -107
  328. package/dist/chunk-J22W6HV3.js.map +0 -1
  329. package/dist/chunk-JSCT3CR4.js +0 -38
  330. package/dist/chunk-JSCT3CR4.js.map +0 -1
  331. package/dist/chunk-JYXEWPH4.js +0 -62
  332. package/dist/chunk-JYXEWPH4.js.map +0 -1
  333. package/dist/chunk-LCE3GF5P.js +0 -866
  334. package/dist/chunk-LCE3GF5P.js.map +0 -1
  335. package/dist/chunk-MJ2NKQQL.js +0 -119
  336. package/dist/chunk-MJ2NKQQL.js.map +0 -1
  337. package/dist/chunk-N6UR7YVY.js +0 -198
  338. package/dist/chunk-N6UR7YVY.js.map +0 -1
  339. package/dist/chunk-OHISZPOJ.js +0 -97
  340. package/dist/chunk-OHISZPOJ.js.map +0 -1
  341. package/dist/chunk-PHOUUNK7.js +0 -2291
  342. package/dist/chunk-PHOUUNK7.js.map +0 -1
  343. package/dist/chunk-RB6QPHJ7.js +0 -393
  344. package/dist/chunk-RB6QPHJ7.js.map +0 -1
  345. package/dist/chunk-SN4YWWYO.js +0 -171
  346. package/dist/chunk-SN4YWWYO.js.map +0 -1
  347. package/dist/chunk-SX52TAR4.js +0 -110
  348. package/dist/chunk-SX52TAR4.js.map +0 -1
  349. package/dist/chunk-THTWHNU4.js +0 -2712
  350. package/dist/chunk-THTWHNU4.js.map +0 -1
  351. package/dist/chunk-VYPWMZ6H.js +0 -98
  352. package/dist/chunk-VYPWMZ6H.js.map +0 -1
  353. package/dist/chunk-XGPU467M.js +0 -136
  354. package/dist/chunk-XGPU467M.js.map +0 -1
  355. package/dist/chunk-ZQMEI34O.js +0 -713
  356. package/dist/chunk-ZQMEI34O.js.map +0 -1
  357. package/dist/compat/index.cjs.map +0 -1
  358. package/dist/compat/index.js.map +0 -1
  359. package/dist/compat/jotai/index.cjs.map +0 -1
  360. package/dist/compat/jotai/index.js.map +0 -1
  361. package/dist/compat/nanostores/index.cjs.map +0 -1
  362. package/dist/compat/nanostores/index.js.map +0 -1
  363. package/dist/compat/nestjs/index.cjs.map +0 -1
  364. package/dist/compat/nestjs/index.js.map +0 -1
  365. package/dist/compat/react/index.cjs.map +0 -1
  366. package/dist/compat/react/index.js.map +0 -1
  367. package/dist/compat/solid/index.cjs.map +0 -1
  368. package/dist/compat/solid/index.js.map +0 -1
  369. package/dist/compat/svelte/index.cjs.map +0 -1
  370. package/dist/compat/svelte/index.js.map +0 -1
  371. package/dist/compat/vue/index.cjs.map +0 -1
  372. package/dist/compat/vue/index.js.map +0 -1
  373. package/dist/compat/zustand/index.cjs.map +0 -1
  374. package/dist/compat/zustand/index.js.map +0 -1
  375. package/dist/core/index.cjs.map +0 -1
  376. package/dist/core/index.js.map +0 -1
  377. package/dist/extra/index.cjs.map +0 -1
  378. package/dist/extra/index.js.map +0 -1
  379. package/dist/extra/sources.cjs.map +0 -1
  380. package/dist/extra/sources.js.map +0 -1
  381. package/dist/graph/index.cjs.map +0 -1
  382. package/dist/graph/index.js.map +0 -1
  383. package/dist/index-C0ZXMaXO.d.cts +0 -392
  384. package/dist/index-CY2TljO4.d.ts +0 -392
  385. package/dist/index.cjs.map +0 -1
  386. package/dist/index.js.map +0 -1
  387. package/dist/patterns/demo-shell.cjs +0 -5604
  388. package/dist/patterns/demo-shell.cjs.map +0 -1
  389. package/dist/patterns/demo-shell.d.cts +0 -6
  390. package/dist/patterns/demo-shell.d.ts +0 -6
  391. package/dist/patterns/demo-shell.js +0 -15
  392. package/dist/patterns/demo-shell.js.map +0 -1
  393. package/dist/patterns/reactive-layout/index.cjs.map +0 -1
  394. package/dist/patterns/reactive-layout/index.js.map +0 -1
  395. package/dist/storage-BMycWEh2.d.ts +0 -190
  396. package/dist/storage-DiqWHzVI.d.cts +0 -190
@@ -1,1369 +0,0 @@
1
- import {
2
- createWatermarkController,
3
- reactiveLog,
4
- toObservable
5
- } from "./chunk-RB6QPHJ7.js";
6
- import {
7
- domainMeta
8
- } from "./chunk-JSCT3CR4.js";
9
- import {
10
- fromCron,
11
- fromTimer,
12
- keepalive
13
- } from "./chunk-BVZYTZ5H.js";
14
- import {
15
- Graph
16
- } from "./chunk-THTWHNU4.js";
17
- import {
18
- DEFAULT_ACTOR,
19
- batch,
20
- derived,
21
- node,
22
- normalizeActor,
23
- policy,
24
- state,
25
- wallClockNs
26
- } from "./chunk-PHOUUNK7.js";
27
- import {
28
- COMPLETE,
29
- DATA,
30
- ERROR,
31
- TEARDOWN,
32
- __decorateElement,
33
- __decoratorStart,
34
- __export,
35
- __runInitializers
36
- } from "./chunk-SX52TAR4.js";
37
-
38
- // src/compat/nestjs/index.ts
39
- var nestjs_exports = {};
40
- __export(nestjs_exports, {
41
- ACTOR_KEY: () => ACTOR_KEY,
42
- COMMAND_HANDLERS: () => COMMAND_HANDLERS,
43
- CQRS_EVENT_HANDLERS: () => CQRS_EVENT_HANDLERS,
44
- CRON_HANDLERS: () => CRON_HANDLERS,
45
- CommandHandler: () => CommandHandler,
46
- EVENT_HANDLERS: () => EVENT_HANDLERS,
47
- EventHandler: () => EventHandler,
48
- GRAPHREFLY_REQUEST_GRAPH: () => GRAPHREFLY_REQUEST_GRAPH,
49
- GRAPHREFLY_ROOT_GRAPH: () => GRAPHREFLY_ROOT_GRAPH,
50
- GraphCron: () => GraphCron,
51
- GraphInterval: () => GraphInterval,
52
- GraphReflyEventExplorer: () => GraphReflyEventExplorer,
53
- GraphReflyGuard: () => GraphReflyGuard,
54
- GraphReflyGuardImpl: () => GraphReflyGuardImpl,
55
- GraphReflyModule: () => GraphReflyModule,
56
- INTERVAL_HANDLERS: () => INTERVAL_HANDLERS,
57
- InjectCqrsGraph: () => InjectCqrsGraph,
58
- InjectGraph: () => InjectGraph,
59
- InjectNode: () => InjectNode,
60
- ObserveGateway: () => ObserveGateway,
61
- OnGraphEvent: () => OnGraphEvent,
62
- QUERY_HANDLERS: () => QUERY_HANDLERS,
63
- QueryHandler: () => QueryHandler,
64
- SAGA_HANDLERS: () => SAGA_HANDLERS,
65
- SagaHandler: () => SagaHandler,
66
- fromHeader: () => fromHeader,
67
- fromJwtPayload: () => fromJwtPayload,
68
- getActor: () => getActor,
69
- getGraphToken: () => getGraphToken,
70
- getNodeToken: () => getNodeToken,
71
- observeSSE: () => observeSSE,
72
- observeSubscription: () => observeSubscription,
73
- toObservable: () => toObservable
74
- });
75
-
76
- // src/compat/nestjs/decorators.ts
77
- import { Inject } from "@nestjs/common";
78
-
79
- // src/compat/nestjs/tokens.ts
80
- var GRAPHREFLY_ROOT_GRAPH = /* @__PURE__ */ Symbol.for("graphrefly:root-graph");
81
- var GRAPHREFLY_REQUEST_GRAPH = /* @__PURE__ */ Symbol.for("graphrefly:request-graph");
82
- function getGraphToken(name) {
83
- return /* @__PURE__ */ Symbol.for(`graphrefly:graph:${name}`);
84
- }
85
- function getNodeToken(path) {
86
- return /* @__PURE__ */ Symbol.for(`graphrefly:node:${path}`);
87
- }
88
-
89
- // src/compat/nestjs/decorators.ts
90
- var EVENT_HANDLERS = /* @__PURE__ */ new Map();
91
- var INTERVAL_HANDLERS = /* @__PURE__ */ new Map();
92
- var CRON_HANDLERS = /* @__PURE__ */ new Map();
93
- var COMMAND_HANDLERS = /* @__PURE__ */ new Map();
94
- var CQRS_EVENT_HANDLERS = /* @__PURE__ */ new Map();
95
- var QUERY_HANDLERS = /* @__PURE__ */ new Map();
96
- var SAGA_HANDLERS = /* @__PURE__ */ new Map();
97
- function InjectGraph(name) {
98
- if (name === "request") return Inject(GRAPHREFLY_REQUEST_GRAPH);
99
- return Inject(name ? getGraphToken(name) : GRAPHREFLY_ROOT_GRAPH);
100
- }
101
- function InjectCqrsGraph(name) {
102
- return Inject(getGraphToken(name));
103
- }
104
- function InjectNode(path) {
105
- return Inject(getNodeToken(path));
106
- }
107
- function OnGraphEvent(nodeName) {
108
- return (_value, context) => {
109
- const methodKey = context.name;
110
- context.addInitializer(function() {
111
- const ctor = this.constructor;
112
- const existing = EVENT_HANDLERS.get(ctor) ?? [];
113
- existing.push({ nodeName, methodKey });
114
- EVENT_HANDLERS.set(ctor, existing);
115
- });
116
- };
117
- }
118
- function GraphInterval(ms) {
119
- return (_value, context) => {
120
- const methodKey = context.name;
121
- context.addInitializer(function() {
122
- const ctor = this.constructor;
123
- const existing = INTERVAL_HANDLERS.get(ctor) ?? [];
124
- existing.push({ ms, methodKey });
125
- INTERVAL_HANDLERS.set(ctor, existing);
126
- });
127
- };
128
- }
129
- function GraphCron(expr) {
130
- return (_value, context) => {
131
- const methodKey = context.name;
132
- context.addInitializer(function() {
133
- const ctor = this.constructor;
134
- const existing = CRON_HANDLERS.get(ctor) ?? [];
135
- existing.push({ expr, methodKey });
136
- CRON_HANDLERS.set(ctor, existing);
137
- });
138
- };
139
- }
140
- function CommandHandler(cqrsName, commandName) {
141
- return (_value, context) => {
142
- const methodKey = context.name;
143
- context.addInitializer(function() {
144
- const ctor = this.constructor;
145
- const existing = COMMAND_HANDLERS.get(ctor) ?? [];
146
- existing.push({ cqrsName, commandName, methodKey });
147
- COMMAND_HANDLERS.set(ctor, existing);
148
- });
149
- };
150
- }
151
- function EventHandler(cqrsName, eventName) {
152
- return (_value, context) => {
153
- const methodKey = context.name;
154
- context.addInitializer(function() {
155
- const ctor = this.constructor;
156
- const existing = CQRS_EVENT_HANDLERS.get(ctor) ?? [];
157
- existing.push({ cqrsName, eventName, methodKey });
158
- CQRS_EVENT_HANDLERS.set(ctor, existing);
159
- });
160
- };
161
- }
162
- function QueryHandler(cqrsName, projectionName) {
163
- return (_value, context) => {
164
- const methodKey = context.name;
165
- context.addInitializer(function() {
166
- const ctor = this.constructor;
167
- const existing = QUERY_HANDLERS.get(ctor) ?? [];
168
- existing.push({ cqrsName, projectionName, methodKey });
169
- QUERY_HANDLERS.set(ctor, existing);
170
- });
171
- };
172
- }
173
- function SagaHandler(cqrsName, sagaName, eventNames) {
174
- return (_value, context) => {
175
- const methodKey = context.name;
176
- context.addInitializer(function() {
177
- const ctor = this.constructor;
178
- const existing = SAGA_HANDLERS.get(ctor) ?? [];
179
- existing.push({ cqrsName, eventNames, sagaName, methodKey });
180
- SAGA_HANDLERS.set(ctor, existing);
181
- });
182
- };
183
- }
184
-
185
- // src/compat/nestjs/explorer.ts
186
- var scheduleSeq = 0;
187
- var GraphReflyEventExplorer = class {
188
- constructor(graph, moduleRef) {
189
- this.graph = graph;
190
- this.moduleRef = moduleRef;
191
- }
192
- disposers = [];
193
- scheduleNodeNames = [];
194
- onModuleInit() {
195
- this.wireEvents();
196
- this.wireIntervals();
197
- this.wireCrons();
198
- this.wireCqrsCommands();
199
- this.wireCqrsEvents();
200
- this.wireCqrsQueries();
201
- this.wireCqrsSagas();
202
- }
203
- onModuleDestroy() {
204
- for (const dispose of this.disposers) dispose();
205
- this.disposers.length = 0;
206
- for (const name of this.scheduleNodeNames) {
207
- try {
208
- this.graph.remove(name);
209
- } catch {
210
- }
211
- }
212
- this.scheduleNodeNames.length = 0;
213
- }
214
- // -----------------------------------------------------------------------
215
- // @OnGraphEvent — reactive subscription via graph.observe()
216
- // -----------------------------------------------------------------------
217
- wireEvents() {
218
- for (const [ctor, metas] of EVENT_HANDLERS) {
219
- const instance = this.resolveInstance(ctor);
220
- if (!instance) continue;
221
- for (const meta of metas) {
222
- this.wireEventHandler(instance, meta);
223
- }
224
- }
225
- }
226
- wireEventHandler(instance, meta) {
227
- const method = instance[meta.methodKey];
228
- if (typeof method !== "function") return;
229
- const bound = method.bind(instance);
230
- const handle = this.observeNode(meta.nodeName);
231
- const unsub = handle.subscribe((msgs) => {
232
- for (const m of msgs) {
233
- if (m[0] === DATA) {
234
- bound(m[1]);
235
- }
236
- }
237
- });
238
- this.disposers.push(unsub);
239
- }
240
- // -----------------------------------------------------------------------
241
- // @GraphInterval — reactive via fromTimer central timer primitive
242
- // -----------------------------------------------------------------------
243
- wireIntervals() {
244
- for (const [ctor, metas] of INTERVAL_HANDLERS) {
245
- const instance = this.resolveInstance(ctor);
246
- if (!instance) continue;
247
- for (const meta of metas) {
248
- this.wireIntervalHandler(instance, ctor, meta);
249
- }
250
- }
251
- }
252
- wireIntervalHandler(instance, ctor, meta) {
253
- const method = instance[meta.methodKey];
254
- if (typeof method !== "function") return;
255
- const bound = method.bind(instance);
256
- const className = ctor.name ?? "anonymous";
257
- const nodeName = `__schedule__.${className}.${String(meta.methodKey)}.${scheduleSeq++}`;
258
- const timerNode = fromTimer(meta.ms, { period: meta.ms, name: nodeName });
259
- this.graph.add(nodeName, timerNode);
260
- this.scheduleNodeNames.push(nodeName);
261
- const handle = this.observeNode(nodeName);
262
- const unsub = handle.subscribe((msgs) => {
263
- for (const m of msgs) {
264
- if (m[0] === DATA) bound(m[1]);
265
- }
266
- });
267
- this.disposers.push(unsub);
268
- }
269
- // -----------------------------------------------------------------------
270
- // @GraphCron — reactive via fromCron central timer primitive
271
- // -----------------------------------------------------------------------
272
- wireCrons() {
273
- for (const [ctor, metas] of CRON_HANDLERS) {
274
- const instance = this.resolveInstance(ctor);
275
- if (!instance) continue;
276
- for (const meta of metas) {
277
- this.wireCronHandler(instance, ctor, meta);
278
- }
279
- }
280
- }
281
- wireCronHandler(instance, ctor, meta) {
282
- const method = instance[meta.methodKey];
283
- if (typeof method !== "function") return;
284
- const bound = method.bind(instance);
285
- const className = ctor.name ?? "anonymous";
286
- const nodeName = `__schedule__.${className}.${String(meta.methodKey)}.${scheduleSeq++}`;
287
- const cronNode = fromCron(meta.expr, { name: nodeName });
288
- this.graph.add(nodeName, cronNode);
289
- this.scheduleNodeNames.push(nodeName);
290
- const handle = this.observeNode(nodeName);
291
- const unsub = handle.subscribe((msgs) => {
292
- for (const m of msgs) {
293
- if (m[0] === DATA) bound(m[1]);
294
- }
295
- });
296
- this.disposers.push(unsub);
297
- }
298
- // -----------------------------------------------------------------------
299
- // @CommandHandler — register method as CqrsGraph command handler
300
- // -----------------------------------------------------------------------
301
- wireCqrsCommands() {
302
- for (const [ctor, metas] of COMMAND_HANDLERS) {
303
- const instance = this.resolveInstance(ctor);
304
- if (!instance) continue;
305
- for (const meta of metas) {
306
- this.wireCqrsCommand(instance, meta);
307
- }
308
- }
309
- }
310
- wireCqrsCommand(instance, meta) {
311
- const method = instance[meta.methodKey];
312
- if (typeof method !== "function") return;
313
- const bound = method.bind(instance);
314
- const cqrsGraph = this.resolveCqrsGraph(meta.cqrsName);
315
- if (!cqrsGraph) return;
316
- cqrsGraph.command(meta.commandName, bound);
317
- }
318
- // -----------------------------------------------------------------------
319
- // @EventHandler — subscribe method to CQRS event stream
320
- // -----------------------------------------------------------------------
321
- wireCqrsEvents() {
322
- for (const [ctor, metas] of CQRS_EVENT_HANDLERS) {
323
- const instance = this.resolveInstance(ctor);
324
- if (!instance) continue;
325
- for (const meta of metas) {
326
- this.wireCqrsEventHandler(instance, meta);
327
- }
328
- }
329
- }
330
- wireCqrsEventHandler(instance, meta) {
331
- const method = instance[meta.methodKey];
332
- if (typeof method !== "function") return;
333
- const bound = method.bind(instance);
334
- const cqrsGraph = this.resolveCqrsGraph(meta.cqrsName);
335
- if (!cqrsGraph) return;
336
- cqrsGraph.event(meta.eventName);
337
- const eventNode = cqrsGraph.resolve(meta.eventName);
338
- const existingEntries = eventNode.cache;
339
- let lastSeq = existingEntries && existingEntries.length > 0 ? existingEntries[existingEntries.length - 1].seq : 0;
340
- const handle = this.observeNodeOn(cqrsGraph, meta.eventName);
341
- const unsub = handle.subscribe((msgs) => {
342
- for (const m of msgs) {
343
- if (m[0] === DATA) {
344
- const entries = m[1];
345
- for (const entry of entries) {
346
- if (entry.seq > lastSeq) {
347
- bound(entry);
348
- lastSeq = entry.seq;
349
- }
350
- }
351
- }
352
- }
353
- });
354
- this.disposers.push(unsub);
355
- }
356
- // -----------------------------------------------------------------------
357
- // @QueryHandler — subscribe method to CQRS projection changes
358
- // -----------------------------------------------------------------------
359
- wireCqrsQueries() {
360
- for (const [ctor, metas] of QUERY_HANDLERS) {
361
- const instance = this.resolveInstance(ctor);
362
- if (!instance) continue;
363
- for (const meta of metas) {
364
- this.wireCqrsQuery(instance, meta);
365
- }
366
- }
367
- }
368
- wireCqrsQuery(instance, meta) {
369
- const method = instance[meta.methodKey];
370
- if (typeof method !== "function") return;
371
- const bound = method.bind(instance);
372
- const cqrsGraph = this.resolveCqrsGraph(meta.cqrsName);
373
- if (!cqrsGraph) return;
374
- const handle = this.observeNodeOn(cqrsGraph, meta.projectionName);
375
- const unsub = handle.subscribe((msgs) => {
376
- for (const m of msgs) {
377
- if (m[0] === DATA) {
378
- bound(m[1]);
379
- }
380
- }
381
- });
382
- this.disposers.push(unsub);
383
- }
384
- // -----------------------------------------------------------------------
385
- // @SagaHandler — register method as CqrsGraph saga (subgraph side effect)
386
- // -----------------------------------------------------------------------
387
- wireCqrsSagas() {
388
- for (const [ctor, metas] of SAGA_HANDLERS) {
389
- const instance = this.resolveInstance(ctor);
390
- if (!instance) continue;
391
- for (const meta of metas) {
392
- this.wireCqrsSaga(instance, meta);
393
- }
394
- }
395
- }
396
- wireCqrsSaga(instance, meta) {
397
- const method = instance[meta.methodKey];
398
- if (typeof method !== "function") return;
399
- const bound = method.bind(instance);
400
- const cqrsGraph = this.resolveCqrsGraph(meta.cqrsName);
401
- if (!cqrsGraph) return;
402
- cqrsGraph.saga(meta.sagaName, meta.eventNames, bound);
403
- }
404
- // -----------------------------------------------------------------------
405
- // Helpers
406
- // -----------------------------------------------------------------------
407
- observeNode(name) {
408
- return this.graph.observe(name);
409
- }
410
- observeNodeOn(graph, name) {
411
- return graph.observe(name);
412
- }
413
- resolveCqrsGraph(name) {
414
- try {
415
- return this.moduleRef.get(getGraphToken(name), { strict: false });
416
- } catch {
417
- console.warn(
418
- `[GraphReFly] CqrsGraph "${name}" not found in DI \u2014 did you import GraphReflyModule.forCqrs({ name: "${name}" })?`
419
- );
420
- return null;
421
- }
422
- }
423
- resolveInstance(ctor) {
424
- try {
425
- return this.moduleRef.get(ctor, { strict: false });
426
- } catch {
427
- return null;
428
- }
429
- }
430
- };
431
-
432
- // src/compat/nestjs/gateway.ts
433
- function observeSSE(graph, path, opts) {
434
- const { actor, serialize = defaultSerialize, keepAliveMs, signal } = opts ?? {};
435
- const encoder = new TextEncoder();
436
- let stop;
437
- const useBackpressure = opts?.highWaterMark != null;
438
- let wm;
439
- let pullResolve;
440
- const taggedBuf = [];
441
- let closed = false;
442
- return new ReadableStream({
443
- start(controller) {
444
- let keepAlive;
445
- let unsub = () => {
446
- };
447
- const close = () => {
448
- if (closed) return;
449
- closed = true;
450
- if (keepAlive !== void 0) clearInterval(keepAlive);
451
- signal?.removeEventListener("abort", onAbort);
452
- unsub();
453
- wm?.dispose();
454
- pullResolve?.();
455
- pullResolve = void 0;
456
- for (const entry of taggedBuf) controller.enqueue(entry.frame);
457
- taggedBuf.length = 0;
458
- controller.close();
459
- };
460
- stop = close;
461
- const onAbort = () => close();
462
- const handle = graph.observe(path, { actor });
463
- if (useBackpressure) {
464
- wm = createWatermarkController((msgs) => handle.up(msgs), {
465
- highWaterMark: opts.highWaterMark,
466
- lowWaterMark: opts.lowWaterMark ?? Math.floor(opts.highWaterMark / 2)
467
- });
468
- }
469
- unsub = handle.subscribe((msgs) => {
470
- for (const msg of msgs) {
471
- if (closed) return;
472
- const t = msg[0];
473
- if (t === DATA) {
474
- const frame = encoder.encode(sseFrame("data", serialize(msg[1])));
475
- if (useBackpressure) {
476
- taggedBuf.push({ frame, counted: true });
477
- wm.onEnqueue();
478
- pullResolve?.();
479
- pullResolve = void 0;
480
- } else {
481
- controller.enqueue(frame);
482
- }
483
- } else if (t === ERROR) {
484
- const frame = encoder.encode(sseFrame("error", serialize(msg[1])));
485
- if (useBackpressure) {
486
- taggedBuf.push({ frame, counted: false });
487
- pullResolve?.();
488
- pullResolve = void 0;
489
- } else {
490
- controller.enqueue(frame);
491
- }
492
- close();
493
- return;
494
- } else if (t === COMPLETE || t === TEARDOWN) {
495
- if (t === COMPLETE) {
496
- const frame = encoder.encode(sseFrame("complete"));
497
- if (useBackpressure) {
498
- taggedBuf.push({ frame, counted: false });
499
- pullResolve?.();
500
- pullResolve = void 0;
501
- } else {
502
- controller.enqueue(frame);
503
- }
504
- }
505
- close();
506
- return;
507
- }
508
- }
509
- });
510
- if (keepAliveMs !== void 0 && keepAliveMs > 0) {
511
- keepAlive = setInterval(() => {
512
- if (closed) return;
513
- if (useBackpressure) {
514
- taggedBuf.push({ frame: encoder.encode(": keepalive\n\n"), counted: false });
515
- pullResolve?.();
516
- pullResolve = void 0;
517
- } else {
518
- controller.enqueue(encoder.encode(": keepalive\n\n"));
519
- }
520
- }, keepAliveMs);
521
- }
522
- if (signal?.aborted) onAbort();
523
- else signal?.addEventListener("abort", onAbort, { once: true });
524
- },
525
- pull(controller) {
526
- if (!useBackpressure) return;
527
- if (closed) return;
528
- if (taggedBuf.length > 0) {
529
- const entry = taggedBuf.shift();
530
- controller.enqueue(entry.frame);
531
- if (entry.counted) wm.onDequeue();
532
- return;
533
- }
534
- return new Promise((resolve) => {
535
- pullResolve = resolve;
536
- });
537
- },
538
- cancel() {
539
- try {
540
- stop?.();
541
- } catch {
542
- }
543
- }
544
- });
545
- }
546
- function observeSubscription(graph, path, opts) {
547
- const { actor, filter } = opts ?? {};
548
- const queue = [];
549
- const waiters = [];
550
- let disposed = false;
551
- const handle = graph.observe(path, { actor });
552
- const wm = opts?.highWaterMark != null ? createWatermarkController((msgs) => handle.up(msgs), {
553
- highWaterMark: opts.highWaterMark,
554
- lowWaterMark: opts.lowWaterMark ?? Math.floor(opts.highWaterMark / 2)
555
- }) : void 0;
556
- const dispose = () => {
557
- if (disposed) return;
558
- disposed = true;
559
- wm?.dispose();
560
- unsub();
561
- };
562
- const push = (item) => {
563
- if (disposed) return;
564
- if (waiters.length > 0) {
565
- const w = waiters.shift();
566
- if (item.done && item.error) w.reject(item.error);
567
- else if (item.done) w.resolve({ done: true, value: void 0 });
568
- else w.resolve({ done: false, value: item.value });
569
- } else {
570
- queue.push(item);
571
- if (!item.done) wm?.onEnqueue();
572
- }
573
- };
574
- const unsub = handle.subscribe((msgs) => {
575
- for (const msg of msgs) {
576
- const t = msg[0];
577
- if (t === DATA) {
578
- const value = msg[1];
579
- if (filter && !filter(value)) continue;
580
- push({ done: false, value });
581
- } else if (t === ERROR) {
582
- const err = msg[1] instanceof Error ? msg[1] : new Error(String(msg[1]));
583
- push({ done: true, error: err });
584
- dispose();
585
- return;
586
- } else if (t === COMPLETE || t === TEARDOWN) {
587
- push({ done: true });
588
- dispose();
589
- return;
590
- }
591
- }
592
- });
593
- const iterator = {
594
- next() {
595
- if (queue.length > 0) {
596
- const item = queue.shift();
597
- if (!item.done) wm?.onDequeue();
598
- if (item.done && item.error) return Promise.reject(item.error);
599
- return Promise.resolve(
600
- item.done ? { done: true, value: void 0 } : { done: false, value: item.value }
601
- );
602
- }
603
- if (disposed) return Promise.resolve({ done: true, value: void 0 });
604
- return new Promise((resolve, reject) => {
605
- waiters.push({ resolve, reject });
606
- });
607
- },
608
- return() {
609
- dispose();
610
- for (const w of waiters) w.resolve({ done: true, value: void 0 });
611
- waiters.length = 0;
612
- return Promise.resolve({ done: true, value: void 0 });
613
- },
614
- throw(err) {
615
- dispose();
616
- return Promise.reject(err);
617
- },
618
- [Symbol.asyncIterator]() {
619
- return this;
620
- }
621
- };
622
- return iterator;
623
- }
624
- var ObserveGateway = class {
625
- constructor(graph, opts) {
626
- this.graph = graph;
627
- this.extractActor = opts?.extractActor ?? (() => void 0);
628
- this.parse = opts?.parse ?? defaultParseCommand;
629
- this.highWaterMark = opts?.highWaterMark;
630
- this.lowWaterMark = opts?.lowWaterMark;
631
- }
632
- clients = /* @__PURE__ */ new Map();
633
- extractActor;
634
- parse;
635
- highWaterMark;
636
- lowWaterMark;
637
- /**
638
- * Register a new client. Call from `handleConnection`.
639
- */
640
- handleConnection(client) {
641
- if (!this.clients.has(client)) {
642
- this.clients.set(client, /* @__PURE__ */ new Map());
643
- }
644
- }
645
- /**
646
- * Unregister a client and dispose all its subscriptions. Call from `handleDisconnect`.
647
- */
648
- handleDisconnect(client) {
649
- const subs = this.clients.get(client);
650
- if (!subs) return;
651
- for (const entry of subs.values()) {
652
- entry.wm?.dispose();
653
- entry.unsub();
654
- }
655
- this.clients.delete(client);
656
- }
657
- /**
658
- * Handle an incoming client message (subscribe/unsubscribe/ack command).
659
- *
660
- * @param client - The WebSocket client reference.
661
- * @param raw - Raw message data (string or parsed object).
662
- * @param send - Function to send a message back to the client.
663
- * Defaults to `client.send(JSON.stringify(msg))`.
664
- */
665
- handleMessage(client, raw, send) {
666
- const sender = send ?? defaultSend.bind(null, client);
667
- let cmd;
668
- try {
669
- cmd = typeof raw === "string" ? this.parse(raw) : raw;
670
- } catch {
671
- sender({ type: "err", message: "invalid command" });
672
- return;
673
- }
674
- if (cmd.type === "subscribe") {
675
- this.subscribe(client, cmd.path, sender);
676
- } else if (cmd.type === "unsubscribe") {
677
- this.unsubscribe(client, cmd.path, sender);
678
- } else if (cmd.type === "ack") {
679
- this.ack(client, cmd.path, cmd.count ?? 1);
680
- } else {
681
- sender({ type: "err", message: `unknown command type: ${cmd.type}` });
682
- }
683
- }
684
- /**
685
- * Number of active subscriptions for a client. Useful for tests.
686
- */
687
- subscriptionCount(client) {
688
- return this.clients.get(client)?.size ?? 0;
689
- }
690
- /**
691
- * Dispose all clients and subscriptions.
692
- */
693
- destroy() {
694
- for (const [client] of this.clients) {
695
- this.handleDisconnect(client);
696
- }
697
- }
698
- // -----------------------------------------------------------------------
699
- // Internal
700
- // -----------------------------------------------------------------------
701
- subscribe(client, path, send) {
702
- let subs = this.clients.get(client);
703
- if (!subs) {
704
- subs = /* @__PURE__ */ new Map();
705
- this.clients.set(client, subs);
706
- }
707
- if (subs.has(path)) {
708
- send({ type: "subscribed", path });
709
- return;
710
- }
711
- const actor = this.extractActor(client);
712
- let handle;
713
- try {
714
- handle = this.graph.observe(path, { actor });
715
- } catch (err) {
716
- const message = err instanceof Error ? err.message : String(err);
717
- send({ type: "err", message });
718
- return;
719
- }
720
- const wm = this.highWaterMark != null ? createWatermarkController((msgs) => handle.up(msgs), {
721
- highWaterMark: this.highWaterMark,
722
- lowWaterMark: this.lowWaterMark ?? Math.floor(this.highWaterMark / 2)
723
- }) : void 0;
724
- const cleanup = () => {
725
- wm?.dispose();
726
- unsub();
727
- subs.delete(path);
728
- };
729
- const unsub = handle.subscribe((msgs) => {
730
- for (const msg of msgs) {
731
- const t = msg[0];
732
- if (t === DATA) {
733
- wm?.onEnqueue();
734
- trySend(send, { type: "data", path, value: msg[1] });
735
- } else if (t === ERROR) {
736
- const errMsg = msg[1] instanceof Error ? msg[1].message : String(msg[1]);
737
- trySend(send, { type: "error", path, error: errMsg });
738
- cleanup();
739
- return;
740
- } else if (t === COMPLETE || t === TEARDOWN) {
741
- trySend(send, { type: "complete", path });
742
- cleanup();
743
- return;
744
- }
745
- }
746
- });
747
- subs.set(path, { unsub, wm });
748
- send({ type: "subscribed", path });
749
- }
750
- unsubscribe(client, path, send) {
751
- const subs = this.clients.get(client);
752
- const entry = subs?.get(path);
753
- if (entry) {
754
- entry.wm?.dispose();
755
- entry.unsub();
756
- subs.delete(path);
757
- }
758
- send({ type: "unsubscribed", path });
759
- }
760
- ack(client, path, count) {
761
- const entry = this.clients.get(client)?.get(path);
762
- if (!entry?.wm) return;
763
- const n = Math.min(Math.max(0, Math.floor(count)), 1024);
764
- for (let i = 0; i < n; i++) entry.wm.onDequeue();
765
- }
766
- };
767
- function defaultSerialize(value) {
768
- if (value instanceof Error) return value.message;
769
- try {
770
- return JSON.stringify(value);
771
- } catch {
772
- return String(value);
773
- }
774
- }
775
- function sseFrame(event, data) {
776
- let frame = `event: ${event}
777
- `;
778
- if (data !== void 0) {
779
- for (const line of data.split("\n")) {
780
- frame += `data: ${line}
781
- `;
782
- }
783
- }
784
- frame += "\n";
785
- return frame;
786
- }
787
- function defaultParseCommand(data) {
788
- return JSON.parse(data);
789
- }
790
- function defaultSend(client, msg) {
791
- try {
792
- client.send(JSON.stringify(msg));
793
- } catch {
794
- }
795
- }
796
- function trySend(send, msg) {
797
- try {
798
- send(msg);
799
- } catch {
800
- }
801
- }
802
-
803
- // src/compat/nestjs/guard.ts
804
- var ACTOR_KEY = "graphReflyActor";
805
- function fromJwtPayload(mapping) {
806
- return (context) => {
807
- const req = context.switchToHttp().getRequest();
808
- const user = req?.user;
809
- if (user == null) return void 0;
810
- if (mapping) return mapping(user);
811
- return user;
812
- };
813
- }
814
- function fromHeader(headerName = "x-graphrefly-actor") {
815
- return (context) => {
816
- const req = context.switchToHttp().getRequest();
817
- const raw = req?.headers?.[headerName.toLowerCase()];
818
- if (typeof raw !== "string" || raw.length === 0) return void 0;
819
- try {
820
- return JSON.parse(raw);
821
- } catch {
822
- return void 0;
823
- }
824
- };
825
- }
826
- function getActor(req) {
827
- const actor = req?.[ACTOR_KEY];
828
- return actor != null ? normalizeActor(actor) : DEFAULT_ACTOR;
829
- }
830
- var GraphReflyGuardImpl = class {
831
- constructor(extractor) {
832
- this.extractor = extractor;
833
- }
834
- canActivate(context) {
835
- const actor = normalizeActor(this.extractor(context));
836
- const req = context.switchToHttp().getRequest();
837
- if (req != null) {
838
- req[ACTOR_KEY] = actor;
839
- }
840
- return true;
841
- }
842
- };
843
- function GraphReflyGuard(extractor) {
844
- return new GraphReflyGuardImpl(extractor ?? fromJwtPayload());
845
- }
846
-
847
- // src/compat/nestjs/module.ts
848
- import {
849
- Module,
850
- Scope
851
- } from "@nestjs/common";
852
- import { ModuleRef } from "@nestjs/core";
853
-
854
- // src/patterns/cqrs.ts
855
- var cqrs_exports = {};
856
- __export(cqrs_exports, {
857
- CqrsGraph: () => CqrsGraph,
858
- MemoryEventStore: () => MemoryEventStore,
859
- cqrs: () => cqrs
860
- });
861
- var COMMAND_GUARD = policy((allow, deny) => {
862
- allow("write");
863
- allow("signal");
864
- deny("observe");
865
- });
866
- var PROJECTION_GUARD = policy((allow, deny) => {
867
- allow("observe");
868
- allow("signal");
869
- deny("write");
870
- });
871
- var EVENT_GUARD = policy((allow, deny) => {
872
- allow("observe");
873
- allow("signal");
874
- deny("write");
875
- });
876
- function cqrsMeta(kind, extra) {
877
- return domainMeta("cqrs", kind, extra);
878
- }
879
- var MemoryEventStore = class {
880
- _store = /* @__PURE__ */ new Map();
881
- persist(event) {
882
- let list = this._store.get(event.type);
883
- if (!list) {
884
- list = [];
885
- this._store.set(event.type, list);
886
- }
887
- list.push(event);
888
- }
889
- loadEvents(eventType, cursor) {
890
- const list = this._store.get(eventType) ?? [];
891
- const sinceTs = cursor?.timestampNs;
892
- const sinceSeq = cursor?.seq;
893
- const events = sinceTs == null ? [...list] : list.filter(
894
- (e) => e.timestampNs > sinceTs || e.timestampNs === sinceTs && e.seq > (sinceSeq ?? -1)
895
- );
896
- const lastEvent = events.length > 0 ? events[events.length - 1] : void 0;
897
- return {
898
- events,
899
- cursor: lastEvent ? { timestampNs: lastEvent.timestampNs, seq: lastEvent.seq } : cursor
900
- };
901
- }
902
- clear() {
903
- this._store.clear();
904
- }
905
- };
906
- var CqrsGraph = class extends Graph {
907
- _eventLogs = /* @__PURE__ */ new Map();
908
- _commandHandlers = /* @__PURE__ */ new Map();
909
- _projections = /* @__PURE__ */ new Set();
910
- _sagas = /* @__PURE__ */ new Set();
911
- _keepaliveDisposers = [];
912
- _eventStore;
913
- _seq = 0;
914
- constructor(name, opts = {}) {
915
- super(name, opts.graph);
916
- }
917
- destroy() {
918
- for (const dispose of this._keepaliveDisposers) dispose();
919
- this._keepaliveDisposers.length = 0;
920
- super.destroy();
921
- }
922
- // -- Events ---------------------------------------------------------------
923
- /**
924
- * Register a named event stream backed by `reactiveLog`.
925
- * Guard denies external `write` — only commands append internally.
926
- */
927
- event(name) {
928
- const existing = this._eventLogs.get(name);
929
- if (existing) return existing.node;
930
- const log = reactiveLog([], { name, versioning: 0 });
931
- const entries = log.entries;
932
- const guarded = derived(
933
- [entries],
934
- ([snapshot]) => snapshot,
935
- {
936
- name,
937
- describeKind: "state",
938
- meta: cqrsMeta("event", { event_name: name }),
939
- guard: EVENT_GUARD,
940
- initial: entries.cache
941
- }
942
- );
943
- this.add(name, guarded);
944
- this._keepaliveDisposers.push(keepalive(guarded));
945
- this._eventLogs.set(name, { log, node: guarded });
946
- return guarded;
947
- }
948
- /** Internal: append to an event log, auto-registering if needed. */
949
- _appendEvent(eventName, payload) {
950
- let entry = this._eventLogs.get(eventName);
951
- if (!entry) {
952
- this.event(eventName);
953
- entry = this._eventLogs.get(eventName);
954
- }
955
- if (entry.node.status === "completed" || entry.node.status === "errored") {
956
- throw new Error(
957
- `Cannot dispatch to terminated event stream "${eventName}" (status: ${entry.node.status}).`
958
- );
959
- }
960
- const nv = entry.log.entries.v;
961
- const evt = {
962
- type: eventName,
963
- payload,
964
- timestampNs: wallClockNs(),
965
- seq: ++this._seq,
966
- ...nv != null ? { v0: { id: nv.id, version: nv.version } } : {}
967
- };
968
- entry.log.append(evt);
969
- if (this._eventStore) {
970
- this._eventStore.persist(evt);
971
- }
972
- }
973
- // -- Commands -------------------------------------------------------------
974
- /**
975
- * Register a command with its handler. Guard denies `observe` (write-only).
976
- * Use `dispatch(name, payload)` to execute.
977
- *
978
- * The command node carries dynamic `meta.error` — a reactive companion
979
- * that holds the last handler error (or `null` on success).
980
- */
981
- command(name, handler) {
982
- const cmdNode = state(void 0, {
983
- name,
984
- describeKind: "state",
985
- meta: {
986
- ...cqrsMeta("command", { command_name: name }),
987
- error: null
988
- },
989
- guard: COMMAND_GUARD
990
- });
991
- this.add(name, cmdNode);
992
- this._commandHandlers.set(name, handler);
993
- return cmdNode;
994
- }
995
- /**
996
- * Execute a registered command. Wraps the entire dispatch in `batch()` so
997
- * the command node DATA and all emitted events settle atomically.
998
- *
999
- * If the handler throws, `meta.error` on the command node is set to the
1000
- * error and the exception is re-thrown.
1001
- */
1002
- dispatch(commandName, payload) {
1003
- const handler = this._commandHandlers.get(commandName);
1004
- if (!handler) {
1005
- throw new Error(`Unknown command: "${commandName}". Register with .command() first.`);
1006
- }
1007
- const cmdNode = this.resolve(commandName);
1008
- batch(() => {
1009
- cmdNode.down([[DATA, payload]], { internal: true });
1010
- try {
1011
- handler(payload, { emit: (eName, data) => this._appendEvent(eName, data) });
1012
- cmdNode.meta.error.down([[DATA, null]], { internal: true });
1013
- } catch (err) {
1014
- cmdNode.meta.error.down([[DATA, err]], { internal: true });
1015
- throw err;
1016
- }
1017
- });
1018
- }
1019
- // -- Projections ----------------------------------------------------------
1020
- /**
1021
- * Register a read-only projection derived from event streams.
1022
- * Guard denies `write` — value is computed from events only.
1023
- *
1024
- * **Purity contract:** The `reducer` must be a pure function — it receives
1025
- * the original `initial` on every invocation (full event-sourcing replay).
1026
- * Never mutate `initial`; always return a new value.
1027
- */
1028
- projection(name, eventNames, reducer, initial) {
1029
- const eventNodes = eventNames.map((eName) => {
1030
- if (!this._eventLogs.has(eName)) this.event(eName);
1031
- return this._eventLogs.get(eName).node;
1032
- });
1033
- const projNode = derived(
1034
- eventNodes,
1035
- (snapshots) => {
1036
- const allEvents = [];
1037
- for (const snapshot of snapshots) {
1038
- const entries = snapshot;
1039
- allEvents.push(...entries);
1040
- }
1041
- allEvents.sort((a, b) => a.timestampNs - b.timestampNs || a.seq - b.seq);
1042
- return reducer(initial, allEvents);
1043
- },
1044
- {
1045
- name,
1046
- describeKind: "derived",
1047
- meta: cqrsMeta("projection", { projection_name: name, source_events: eventNames }),
1048
- guard: PROJECTION_GUARD,
1049
- initial
1050
- }
1051
- );
1052
- this.add(name, projNode);
1053
- this._keepaliveDisposers.push(keepalive(projNode));
1054
- this._projections.add(name);
1055
- return projNode;
1056
- }
1057
- // -- Sagas ----------------------------------------------------------------
1058
- /**
1059
- * Register an event-driven side effect. Runs handler for each **new** event
1060
- * from the specified streams (tracks last-processed entry count per stream).
1061
- *
1062
- * The saga node carries dynamic `meta.error` — a reactive companion that
1063
- * holds the last handler error (or `null` on success). Handler errors do
1064
- * not propagate out of the saga run (the event cursor still advances so
1065
- * the same entry is not delivered twice).
1066
- */
1067
- saga(name, eventNames, handler) {
1068
- const eventNodes = eventNames.map((eName) => {
1069
- if (!this._eventLogs.has(eName)) this.event(eName);
1070
- return this._eventLogs.get(eName).node;
1071
- });
1072
- const lastCounts = /* @__PURE__ */ new Map();
1073
- const sagaRef = {};
1074
- const sagaNode = node(
1075
- eventNodes,
1076
- (snapshots, _actions) => {
1077
- const errNode = sagaRef.n.meta.error;
1078
- for (let i = 0; i < snapshots.length; i++) {
1079
- const batch2 = snapshots[i];
1080
- if (batch2 == null || batch2.length === 0) continue;
1081
- const entries = batch2.at(-1);
1082
- if (!entries) continue;
1083
- const eName = eventNames[i];
1084
- const lastCount = lastCounts.get(eName) ?? 0;
1085
- if (entries.length > lastCount) {
1086
- const newEntries = entries.slice(lastCount);
1087
- for (const entry of newEntries) {
1088
- try {
1089
- handler(entry);
1090
- errNode.down([[DATA, null]], { internal: true });
1091
- } catch (err) {
1092
- errNode.down([[DATA, err]], { internal: true });
1093
- }
1094
- }
1095
- lastCounts.set(eName, entries.length);
1096
- }
1097
- }
1098
- },
1099
- {
1100
- name,
1101
- describeKind: "effect",
1102
- meta: {
1103
- ...cqrsMeta("saga", { saga_name: name, source_events: eventNames }),
1104
- error: null
1105
- }
1106
- }
1107
- );
1108
- sagaRef.n = sagaNode;
1109
- this.add(name, sagaNode);
1110
- this._keepaliveDisposers.push(keepalive(sagaNode));
1111
- this._sagas.add(name);
1112
- return sagaNode;
1113
- }
1114
- // -- Event store ----------------------------------------------------------
1115
- useEventStore(adapter) {
1116
- this._eventStore = adapter;
1117
- }
1118
- /**
1119
- * Replay persisted events through a reducer to rebuild a read model.
1120
- * Requires an event store adapter wired via `useEventStore()`.
1121
- */
1122
- async rebuildProjection(eventNames, reducer, initial) {
1123
- if (!this._eventStore) {
1124
- throw new Error("No event store wired. Call useEventStore() first.");
1125
- }
1126
- const allEvents = [];
1127
- for (const eName of eventNames) {
1128
- const result = await this._eventStore.loadEvents(eName);
1129
- allEvents.push(...result.events);
1130
- }
1131
- allEvents.sort((a, b) => a.timestampNs - b.timestampNs || a.seq - b.seq);
1132
- return reducer(initial, allEvents);
1133
- }
1134
- };
1135
- function cqrs(name, opts) {
1136
- return new CqrsGraph(name, opts);
1137
- }
1138
-
1139
- // src/compat/nestjs/module.ts
1140
- var GraphReflyRootLifecycle = class {
1141
- constructor(graph) {
1142
- this.graph = graph;
1143
- }
1144
- onModuleDestroy() {
1145
- this.graph.destroy();
1146
- }
1147
- };
1148
- var GraphReflyRequestLifecycle = class {
1149
- graph = new Graph("request");
1150
- onModuleDestroy() {
1151
- this.graph.destroy();
1152
- }
1153
- };
1154
- var _GraphReflyModule_decorators, _init;
1155
- _GraphReflyModule_decorators = [Module({})];
1156
- var _GraphReflyModule = class _GraphReflyModule {
1157
- /**
1158
- * Register the root `Graph` singleton in the NestJS DI container.
1159
- *
1160
- * The root graph is `@Global()` — injectable everywhere without importing
1161
- * the module again. Use `@InjectGraph()` to inject it.
1162
- *
1163
- * Lifecycle:
1164
- * - **init:** Graph created in factory. If `build` is provided, it runs
1165
- * first (registers nodes/mounts). If `snapshot` is provided, values
1166
- * are restored via `graph.restore()`.
1167
- * - **destroy:** Calls `graph.destroy()` — sends `[[TEARDOWN]]` to all
1168
- * nodes, including mounted feature subgraphs (cascading teardown).
1169
- */
1170
- static forRoot(opts) {
1171
- const options = opts ?? {};
1172
- const graphName = options.name ?? "root";
1173
- const providers = [
1174
- {
1175
- provide: GRAPHREFLY_ROOT_GRAPH,
1176
- useFactory: () => {
1177
- const g = new Graph(graphName);
1178
- if (options.build) options.build(g);
1179
- if (options.snapshot) g.restore(options.snapshot);
1180
- return g;
1181
- }
1182
- },
1183
- {
1184
- provide: /* @__PURE__ */ Symbol.for("graphrefly:root-lifecycle"),
1185
- useFactory: (graph) => new GraphReflyRootLifecycle(graph),
1186
- inject: [GRAPHREFLY_ROOT_GRAPH]
1187
- },
1188
- {
1189
- provide: GraphReflyEventExplorer,
1190
- useFactory: (graph, moduleRef) => new GraphReflyEventExplorer(graph, moduleRef),
1191
- inject: [GRAPHREFLY_ROOT_GRAPH, ModuleRef]
1192
- }
1193
- ];
1194
- if (options.nodes) {
1195
- for (const path of options.nodes) {
1196
- providers.push({
1197
- provide: getNodeToken(path),
1198
- useFactory: (graph) => graph.resolve(path),
1199
- inject: [GRAPHREFLY_ROOT_GRAPH]
1200
- });
1201
- }
1202
- }
1203
- if (options.requestScope) {
1204
- providers.push(
1205
- {
1206
- provide: /* @__PURE__ */ Symbol.for("graphrefly:request-lifecycle"),
1207
- useFactory: () => new GraphReflyRequestLifecycle(),
1208
- scope: Scope.REQUEST
1209
- },
1210
- {
1211
- provide: GRAPHREFLY_REQUEST_GRAPH,
1212
- useFactory: (lifecycle) => lifecycle.graph,
1213
- inject: [/* @__PURE__ */ Symbol.for("graphrefly:request-lifecycle")],
1214
- scope: Scope.REQUEST
1215
- }
1216
- );
1217
- }
1218
- return {
1219
- module: _GraphReflyModule,
1220
- global: true,
1221
- providers,
1222
- exports: [
1223
- GRAPHREFLY_ROOT_GRAPH,
1224
- ...(options.nodes ?? []).map(getNodeToken),
1225
- ...options.requestScope ? [GRAPHREFLY_REQUEST_GRAPH] : []
1226
- ]
1227
- };
1228
- }
1229
- /**
1230
- * Register a feature subgraph that auto-mounts into the root graph.
1231
- *
1232
- * The feature graph is created in the factory, built/restored, then
1233
- * mounted into root via `root.mount(name, featureGraph)`. On app
1234
- * shutdown, root's `graph.destroy()` cascades TEARDOWN through all
1235
- * mounted subgraphs (no explicit remove needed).
1236
- *
1237
- * Node tokens are auto-qualified as `featureName::path` to prevent
1238
- * collisions between features declaring nodes with the same local name.
1239
- *
1240
- * Injectable via `@InjectGraph(name)`.
1241
- */
1242
- static forFeature(opts) {
1243
- const providers = [
1244
- {
1245
- provide: getGraphToken(opts.name),
1246
- useFactory: (rootGraph) => {
1247
- const g = new Graph(opts.name);
1248
- if (opts.build) opts.build(g);
1249
- if (opts.snapshot) g.restore(opts.snapshot);
1250
- rootGraph.mount(opts.name, g);
1251
- return g;
1252
- },
1253
- inject: [GRAPHREFLY_ROOT_GRAPH]
1254
- }
1255
- ];
1256
- if (opts.nodes) {
1257
- for (const path of opts.nodes) {
1258
- providers.push({
1259
- provide: getNodeToken(`${opts.name}::${path}`),
1260
- useFactory: (graph) => graph.resolve(path),
1261
- inject: [getGraphToken(opts.name)]
1262
- });
1263
- }
1264
- }
1265
- return {
1266
- module: _GraphReflyModule,
1267
- providers,
1268
- exports: [
1269
- getGraphToken(opts.name),
1270
- ...(opts.nodes ?? []).map((p) => getNodeToken(`${opts.name}::${p}`))
1271
- ]
1272
- };
1273
- }
1274
- /**
1275
- * Register a CQRS subgraph that auto-mounts into the root graph.
1276
- *
1277
- * Creates a `CqrsGraph` via the `cqrs()` factory (roadmap §4.5), mounts it
1278
- * into the root graph, and exposes it for DI via `@InjectGraph(name)`.
1279
- *
1280
- * CQRS decorators (`@CommandHandler`, `@EventHandler`, `@QueryHandler`,
1281
- * `@SagaHandler`) are discovered by the explorer and wired to this graph
1282
- * on module init.
1283
- *
1284
- * @example
1285
- * ```ts
1286
- * GraphReflyModule.forCqrs({
1287
- * name: "orders",
1288
- * build: (g) => {
1289
- * g.event("orderPlaced");
1290
- * g.projection("orderCount", ["orderPlaced"], (_s, evts) => evts.length, 0);
1291
- * },
1292
- * })
1293
- * ```
1294
- */
1295
- static forCqrs(opts) {
1296
- const providers = [
1297
- {
1298
- provide: getGraphToken(opts.name),
1299
- useFactory: (rootGraph) => {
1300
- const g = cqrs(opts.name, opts.cqrs);
1301
- if (opts.eventStore) g.useEventStore(opts.eventStore);
1302
- if (opts.build) opts.build(g);
1303
- rootGraph.mount(opts.name, g);
1304
- return g;
1305
- },
1306
- inject: [GRAPHREFLY_ROOT_GRAPH]
1307
- }
1308
- ];
1309
- if (opts.nodes) {
1310
- for (const path of opts.nodes) {
1311
- providers.push({
1312
- provide: getNodeToken(`${opts.name}::${path}`),
1313
- useFactory: (graph) => graph.resolve(path),
1314
- inject: [getGraphToken(opts.name)]
1315
- });
1316
- }
1317
- }
1318
- return {
1319
- module: _GraphReflyModule,
1320
- providers,
1321
- exports: [
1322
- getGraphToken(opts.name),
1323
- ...(opts.nodes ?? []).map((p) => getNodeToken(`${opts.name}::${p}`))
1324
- ]
1325
- };
1326
- }
1327
- };
1328
- _init = __decoratorStart(null);
1329
- _GraphReflyModule = __decorateElement(_init, 0, "GraphReflyModule", _GraphReflyModule_decorators, _GraphReflyModule);
1330
- __runInitializers(_init, 1, _GraphReflyModule);
1331
- var GraphReflyModule = _GraphReflyModule;
1332
-
1333
- export {
1334
- GRAPHREFLY_ROOT_GRAPH,
1335
- GRAPHREFLY_REQUEST_GRAPH,
1336
- getGraphToken,
1337
- getNodeToken,
1338
- EVENT_HANDLERS,
1339
- INTERVAL_HANDLERS,
1340
- CRON_HANDLERS,
1341
- COMMAND_HANDLERS,
1342
- CQRS_EVENT_HANDLERS,
1343
- QUERY_HANDLERS,
1344
- SAGA_HANDLERS,
1345
- InjectGraph,
1346
- InjectCqrsGraph,
1347
- InjectNode,
1348
- OnGraphEvent,
1349
- GraphInterval,
1350
- GraphCron,
1351
- CommandHandler,
1352
- EventHandler,
1353
- QueryHandler,
1354
- SagaHandler,
1355
- GraphReflyEventExplorer,
1356
- observeSSE,
1357
- observeSubscription,
1358
- ObserveGateway,
1359
- ACTOR_KEY,
1360
- fromJwtPayload,
1361
- fromHeader,
1362
- getActor,
1363
- GraphReflyGuardImpl,
1364
- GraphReflyGuard,
1365
- cqrs_exports,
1366
- GraphReflyModule,
1367
- nestjs_exports
1368
- };
1369
- //# sourceMappingURL=chunk-IZYUSJC7.js.map