@raphy-js/raph 1.0.0-dev.2 → 1.0.1-dev.20

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 (211) hide show
  1. package/README.md +1096 -0
  2. package/dist/api/Raph.d.ts +59 -190
  3. package/dist/api/RaphFacadeSession.d.ts +90 -0
  4. package/dist/api/RaphReactivityInstance.d.ts +72 -0
  5. package/dist/api/errors.d.ts +9 -4
  6. package/dist/api/types.d.ts +162 -17
  7. package/dist/core-CyilRD7s.js +1055 -0
  8. package/dist/core-ugchZNqC.cjs +1 -0
  9. package/dist/debug/api/Raph.cjs +1 -1
  10. package/dist/debug/api/Raph.js +368 -366
  11. package/dist/debug/api/RaphFacadeSession.cjs +1 -0
  12. package/dist/debug/api/RaphFacadeSession.js +306 -0
  13. package/dist/debug/api/RaphReactivityInstance.cjs +1 -0
  14. package/dist/debug/api/RaphReactivityInstance.js +149 -0
  15. package/dist/debug/api/errors.cjs +1 -1
  16. package/dist/debug/api/errors.js +10 -7
  17. package/dist/debug/path/DataPath.cjs +1 -0
  18. package/dist/debug/path/{data-path.js → DataPath.js} +151 -180
  19. package/dist/debug/path/PathRouter.cjs +1 -0
  20. package/dist/debug/path/{path-router.js → PathRouter.js} +1 -1
  21. package/dist/debug/path/RaphKernel.cjs +1 -1
  22. package/dist/debug/path/RaphKernel.js +258 -207
  23. package/dist/debug/path/data-path.utils.cjs +1 -0
  24. package/dist/debug/path/data-path.utils.js +56 -0
  25. package/dist/debug/path/derived/DerivedRegistry.cjs +1 -0
  26. package/dist/debug/path/{DerivedRegistry.js → derived/DerivedRegistry.js} +5 -5
  27. package/dist/debug/path/derived/derived-collection.utils.cjs +1 -0
  28. package/dist/debug/path/{derived-collection.js → derived/derived-collection.utils.js} +1 -1
  29. package/dist/debug/path/derived/derived-strategy.types.cjs +1 -0
  30. package/dist/debug/path/derived/derived-strategy.types.js +1 -0
  31. package/dist/debug/path/{MetaController.cjs → meta/MetaController.cjs} +1 -1
  32. package/dist/debug/path/{MetaController.js → meta/MetaController.js} +3 -3
  33. package/dist/debug/path/meta/RaphMetaStore.cjs +1 -0
  34. package/dist/debug/path/{RaphMetaStore.js → meta/RaphMetaStore.js} +1 -1
  35. package/dist/debug/path/meta/meta.types.cjs +1 -0
  36. package/dist/debug/path/meta/meta.types.js +1 -0
  37. package/dist/debug/path/storage/AdapterPathStore.cjs +1 -0
  38. package/dist/debug/path/{AdapterPathStore.js → storage/AdapterPathStore.js} +9 -9
  39. package/dist/debug/path/storage/DefaultDataAdapter.cjs +1 -0
  40. package/dist/debug/path/{data-adapter.js → storage/DefaultDataAdapter.js} +2 -2
  41. package/dist/debug/path/storage/PathEventHub.cjs +1 -0
  42. package/dist/debug/path/{PathEventHub.js → storage/PathEventHub.js} +34 -34
  43. package/dist/debug/path/storage/PathStore.cjs +1 -0
  44. package/dist/debug/path/{PathStore.js → storage/PathStore.js} +28 -28
  45. package/dist/debug/path/storage/data-adapter.types.cjs +1 -0
  46. package/dist/debug/path/storage/data-adapter.types.js +1 -0
  47. package/dist/debug/reactivity/engine.cjs +1 -1
  48. package/dist/debug/reactivity/engine.js +478 -306
  49. package/dist/debug/reactivity/reactive-object.cjs +1 -0
  50. package/dist/debug/reactivity/reactive-object.js +280 -0
  51. package/dist/debug/runtime/RaphRuntime.cjs +1 -1
  52. package/dist/debug/runtime/RaphRuntime.js +798 -519
  53. package/dist/debug/runtime/diagnostics/RaphDebug.cjs +1 -0
  54. package/dist/debug/runtime/diagnostics/RaphDebug.js +297 -0
  55. package/dist/debug/runtime/errors.cjs +1 -1
  56. package/dist/debug/runtime/errors.js +6 -3
  57. package/dist/debug/runtime/ownership/RaphEffectScope.cjs +1 -0
  58. package/dist/debug/runtime/ownership/RaphEffectScope.js +171 -0
  59. package/dist/debug/runtime/ownership/RaphNode.cjs +1 -0
  60. package/dist/debug/runtime/ownership/RaphNode.js +206 -0
  61. package/dist/debug/runtime/ownership/RaphScope.cjs +1 -0
  62. package/dist/debug/runtime/ownership/RaphScope.js +101 -0
  63. package/dist/debug/runtime/ownership/parent-graph.types.cjs +1 -0
  64. package/dist/debug/runtime/ownership/parent-graph.types.js +1 -0
  65. package/dist/debug/runtime/phases/RaphPhasePipeline.cjs +1 -0
  66. package/dist/debug/runtime/phases/RaphPhasePipeline.js +587 -0
  67. package/dist/debug/runtime/phases/orderPhaseTasks.cjs +1 -0
  68. package/dist/debug/runtime/phases/orderPhaseTasks.js +59 -0
  69. package/dist/debug/runtime/reactivity/PathHandle.cjs +1 -0
  70. package/dist/debug/runtime/{PathHandle.js → reactivity/PathHandle.js} +75 -39
  71. package/dist/debug/runtime/reactivity/RaphMetaSource.cjs +1 -0
  72. package/dist/debug/runtime/reactivity/RaphMetaSource.js +112 -0
  73. package/dist/debug/runtime/reactivity/RaphWorkGraph.cjs +1 -0
  74. package/dist/debug/runtime/reactivity/RaphWorkGraph.js +995 -0
  75. package/dist/debug/runtime/reactivity/RuntimeReactivity.cjs +1 -0
  76. package/dist/debug/runtime/reactivity/RuntimeReactivity.js +156 -0
  77. package/dist/debug/runtime/reactivity/RuntimeWatch.cjs +1 -0
  78. package/dist/debug/runtime/reactivity/RuntimeWatch.js +88 -0
  79. package/dist/debug/runtime/reactivity/runtime-reactivity.types.cjs +1 -0
  80. package/dist/debug/runtime/reactivity/runtime-reactivity.types.js +1 -0
  81. package/dist/entrypoints/machine-testing.d.ts +2 -0
  82. package/dist/entrypoints/machine.d.ts +5 -0
  83. package/dist/entrypoints/path.d.ts +14 -0
  84. package/dist/entrypoints/reactivity.d.ts +1 -0
  85. package/dist/entrypoints/runtime.d.ts +17 -0
  86. package/dist/index.cjs +1 -1
  87. package/dist/index.js +46 -38
  88. package/dist/machine/compiler.d.ts +71 -0
  89. package/dist/machine/core.d.ts +50 -0
  90. package/dist/machine/persistence.d.ts +5 -0
  91. package/dist/machine/runtime.d.ts +4 -0
  92. package/dist/machine/testing.d.ts +43 -0
  93. package/dist/machine/types.d.ts +155 -0
  94. package/dist/machine-testing.cjs +1 -0
  95. package/dist/machine-testing.js +188 -0
  96. package/dist/machine.cjs +1 -0
  97. package/dist/machine.js +837 -0
  98. package/dist/main.d.ts +20 -0
  99. package/dist/path/{data-path.d.ts → DataPath.d.ts} +16 -40
  100. package/dist/path/{path-router.d.ts → PathRouter.d.ts} +1 -1
  101. package/dist/path/RaphKernel.d.ts +13 -10
  102. package/dist/path/data-path.types.d.ts +34 -0
  103. package/dist/path/data-path.utils.d.ts +9 -0
  104. package/dist/path/{DerivedRegistry.d.ts → derived/DerivedRegistry.d.ts} +2 -2
  105. package/dist/path/{RaphDerivedHandle.d.ts → derived/RaphDerivedHandle.d.ts} +3 -3
  106. package/dist/path/derived/derived-collection.types.d.ts +12 -0
  107. package/dist/path/{derived-collection.d.ts → derived/derived-collection.utils.d.ts} +3 -13
  108. package/dist/path/{derived-strategies.d.ts → derived/derived-strategy.types.d.ts} +0 -3
  109. package/dist/path/derived/derived-strategy.utils.d.ts +4 -0
  110. package/dist/path/{MetaController.d.ts → meta/MetaController.d.ts} +4 -4
  111. package/dist/path/{RaphMeta.d.ts → meta/RaphMeta.d.ts} +2 -2
  112. package/dist/path/{RaphMetaStore.d.ts → meta/RaphMetaStore.d.ts} +1 -1
  113. package/dist/path/{meta.types.d.ts → meta/meta.types.d.ts} +2 -4
  114. package/dist/path/path.types.d.ts +3 -2
  115. package/dist/path/{segment-key.d.ts → pathSegmentKey.d.ts} +1 -1
  116. package/dist/path/{AdapterPathStore.d.ts → storage/AdapterPathStore.d.ts} +4 -4
  117. package/dist/path/{data-adapter.d.ts → storage/DefaultDataAdapter.d.ts} +2 -17
  118. package/dist/path/{PathEventHub.d.ts → storage/PathEventHub.d.ts} +9 -9
  119. package/dist/path/{PathStore.d.ts → storage/PathStore.d.ts} +3 -3
  120. package/dist/path/storage/data-adapter.types.d.ts +17 -0
  121. package/dist/path.cjs +1 -1
  122. package/dist/path.js +16 -16
  123. package/dist/raph.cjs +1 -1
  124. package/dist/raph.js +46 -38
  125. package/dist/reactivity/engine.d.ts +17 -3
  126. package/dist/reactivity/reactive-object.d.ts +36 -0
  127. package/dist/reactivity/types.d.ts +25 -0
  128. package/dist/reactivity.cjs +1 -1
  129. package/dist/reactivity.js +12 -12
  130. package/dist/runtime/RaphRuntime.d.ts +132 -192
  131. package/dist/runtime/diagnostics/RaphDebug.d.ts +239 -0
  132. package/dist/runtime/errors.d.ts +5 -0
  133. package/dist/runtime/ownership/RaphEffectScope.d.ts +29 -0
  134. package/dist/runtime/ownership/RaphNode.d.ts +40 -0
  135. package/dist/runtime/ownership/RaphScope.d.ts +38 -0
  136. package/dist/runtime/{parent-graph.d.ts → ownership/parent-graph.types.d.ts} +0 -1
  137. package/dist/runtime/ownership/parentGraph.d.ts +3 -0
  138. package/dist/runtime/phases/RaphPhasePipeline.d.ts +79 -0
  139. package/dist/runtime/phases/orderPhaseTasks.d.ts +6 -0
  140. package/dist/runtime/phases/phase.types.d.ts +92 -0
  141. package/dist/runtime/{PathHandle.d.ts → reactivity/PathHandle.d.ts} +14 -6
  142. package/dist/runtime/reactivity/RaphMetaSource.d.ts +32 -0
  143. package/dist/runtime/reactivity/RaphWorkGraph.d.ts +171 -0
  144. package/dist/runtime/{RuntimeReactivity.d.ts → reactivity/RuntimeReactivity.d.ts} +14 -9
  145. package/dist/runtime/{RuntimeWatch.d.ts → reactivity/RuntimeWatch.d.ts} +9 -3
  146. package/dist/runtime/{runtime-reactivity.types.d.ts → reactivity/runtime-reactivity.types.d.ts} +3 -1
  147. package/dist/runtime.cjs +1 -1
  148. package/dist/runtime.js +21 -16
  149. package/package.json +68 -35
  150. package/ReadMe.md +0 -153
  151. package/dist/api/public.d.ts +0 -22
  152. package/dist/debug/api/public.cjs +0 -1
  153. package/dist/debug/api/public.js +0 -40
  154. package/dist/debug/path/AdapterPathStore.cjs +0 -1
  155. package/dist/debug/path/DerivedRegistry.cjs +0 -1
  156. package/dist/debug/path/PathEventHub.cjs +0 -1
  157. package/dist/debug/path/PathStore.cjs +0 -1
  158. package/dist/debug/path/RaphMetaStore.cjs +0 -1
  159. package/dist/debug/path/data-adapter.cjs +0 -1
  160. package/dist/debug/path/data-path.cjs +0 -1
  161. package/dist/debug/path/derived-collection.cjs +0 -1
  162. package/dist/debug/path/path-router.cjs +0 -1
  163. package/dist/debug/path/public.cjs +0 -1
  164. package/dist/debug/path/public.js +0 -18
  165. package/dist/debug/runtime/PathHandle.cjs +0 -1
  166. package/dist/debug/runtime/RaphDebug.cjs +0 -1
  167. package/dist/debug/runtime/RaphDebug.js +0 -15
  168. package/dist/debug/runtime/RaphNode.cjs +0 -1
  169. package/dist/debug/runtime/RaphNode.js +0 -143
  170. package/dist/debug/runtime/RaphPhasePipeline.cjs +0 -1
  171. package/dist/debug/runtime/RaphPhasePipeline.js +0 -526
  172. package/dist/debug/runtime/RaphScope.cjs +0 -1
  173. package/dist/debug/runtime/RaphScope.js +0 -64
  174. package/dist/debug/runtime/RuntimeReactivity.cjs +0 -1
  175. package/dist/debug/runtime/RuntimeReactivity.js +0 -154
  176. package/dist/debug/runtime/RuntimeWatch.cjs +0 -1
  177. package/dist/debug/runtime/RuntimeWatch.js +0 -71
  178. package/dist/debug/runtime/public.cjs +0 -1
  179. package/dist/debug/runtime/public.js +0 -18
  180. package/dist/path/public.d.ts +0 -14
  181. package/dist/runtime/RaphDebug.d.ts +0 -32
  182. package/dist/runtime/RaphNode.d.ts +0 -68
  183. package/dist/runtime/RaphPhasePipeline.d.ts +0 -133
  184. package/dist/runtime/RaphScope.d.ts +0 -50
  185. package/dist/runtime/phase.types.d.ts +0 -49
  186. package/dist/runtime/public.d.ts +0 -13
  187. /package/dist/debug/path/{meta.types.cjs → data-path.types.cjs} +0 -0
  188. /package/dist/debug/path/{meta.types.js → data-path.types.js} +0 -0
  189. /package/dist/debug/path/{RaphDerivedHandle.cjs → derived/RaphDerivedHandle.cjs} +0 -0
  190. /package/dist/debug/path/{RaphDerivedHandle.js → derived/RaphDerivedHandle.js} +0 -0
  191. /package/dist/debug/{runtime/runtime-reactivity.types.cjs → path/derived/derived-collection.types.cjs} +0 -0
  192. /package/dist/debug/{runtime/runtime-reactivity.types.js → path/derived/derived-collection.types.js} +0 -0
  193. /package/dist/debug/path/{derived-strategies.cjs → derived/derived-strategy.utils.cjs} +0 -0
  194. /package/dist/debug/path/{derived-strategies.js → derived/derived-strategy.utils.js} +0 -0
  195. /package/dist/debug/path/{RaphMeta.cjs → meta/RaphMeta.cjs} +0 -0
  196. /package/dist/debug/path/{RaphMeta.js → meta/RaphMeta.js} +0 -0
  197. /package/dist/debug/path/{segment-key.cjs → pathSegmentKey.cjs} +0 -0
  198. /package/dist/debug/path/{segment-key.js → pathSegmentKey.js} +0 -0
  199. /package/dist/debug/path/{data-draft.cjs → storage/createDataDraft.cjs} +0 -0
  200. /package/dist/debug/path/{data-draft.js → storage/createDataDraft.js} +0 -0
  201. /package/dist/debug/runtime/{parent-graph.cjs → ownership/parentGraph.cjs} +0 -0
  202. /package/dist/debug/runtime/{parent-graph.js → ownership/parentGraph.js} +0 -0
  203. /package/dist/debug/runtime/{disposal.cjs → ownership/throwDisposalErrors.cjs} +0 -0
  204. /package/dist/debug/runtime/{disposal.js → ownership/throwDisposalErrors.js} +0 -0
  205. /package/dist/debug/runtime/{RaphFrameLoop.cjs → phases/RaphFrameLoop.cjs} +0 -0
  206. /package/dist/debug/runtime/{RaphFrameLoop.js → phases/RaphFrameLoop.js} +0 -0
  207. /package/dist/debug/runtime/{phase.types.cjs → phases/phase.types.cjs} +0 -0
  208. /package/dist/debug/runtime/{phase.types.js → phases/phase.types.js} +0 -0
  209. /package/dist/path/{data-draft.d.ts → storage/createDataDraft.d.ts} +0 -0
  210. /package/dist/runtime/{disposal.d.ts → ownership/throwDisposalErrors.d.ts} +0 -0
  211. /package/dist/runtime/{RaphFrameLoop.d.ts → phases/RaphFrameLoop.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ "use strict";var f=Object.defineProperty;var p=(i,s,e)=>s in i?f(i,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[s]=e;var a=(i,s,e)=>p(i,typeof s!="symbol"?s+"":s,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("../../reactivity/engine.cjs");let n;class A{constructor(){a(this,"_active")}bind(s){const e=this._active;return e===void 0?{schedule:s,dispose:k}:e.binding(s)}runWith(s,e){const t=this._active;this._active=s===void 0?void 0:{binding:s};try{return e()}finally{this._active=t}}}class y extends g.RaphReactivity{constructor(e,t={}){const u=new A;super({...t.adaptiveDependencyIndex===void 0?{}:{adaptiveDependencyIndex:t.adaptiveDependencyIndex},effectScheduler:{bind:u.bind.bind(u)}});a(this,"_bindings");this._lifecycle=e,this._bindings=u}withEffectBinding(e,t){return this._bindings.runWith(e,t)}untrackedWithOwner(e){const t=n;n=void 0;try{return this.untracked(e)}finally{n=t}}getActiveOwner(){return n==null?void 0:n.lifecycle.owner}getActiveConsumerOwner(){return n==null?void 0:n.consumerOwner}hasActiveContext(){return n!==void 0||this._isTracking()}runWithOwner(e,t,u){const d=n;n=e===void 0?void 0:{consumerOwner:t,lifecycle:e};try{return u()}finally{n=d}}signalForOwner(e,t,u,d){const r=this._lifecycle,c=t._adoptSource(this._ownedSignal(e,u)),_=r.assertWriteAllowed,h=r.runWrite??b;return d==null||d(v=>{o(r),t._assertAlive(),c.set(v)}),_!==void 0?{get(){return l(r,t),t._assertAlive(),c.get()},peek(){return o(r),t._assertAlive(),c.peek()},set(v){t._assertAlive(),_(),h(()=>c.set(v))}}:{get(){return l(r,t),t._assertAlive(),c.get()},peek(){return o(r),t._assertAlive(),c.peek()},set(v){o(r),t._assertAlive(),h(()=>c.set(v))}}}computedForOwner(e,t,u){const d=this._lifecycle,r=t._adoptSource(this._ownedComputed(e,u));return{get(){l(d,t),t._assertAlive();const c=r.get();return t._assertAlive(),c},peek(){o(d),t._assertAlive();const c=r.peek();return t._assertAlive(),c}}}}function o(i){i.owner===void 0&&i.throwDisposed()}function l(i,s){o(i);const e=n;e!==void 0&&e.lifecycle!==i&&i.throwCrossRuntime(e.lifecycle.owner),(e==null?void 0:e.consumerOwner)!==void 0&&i.assertDependencyAllowed(s,e.consumerOwner)}function b(i){return i()}function k(){}exports.RuntimeReactivity=y;
@@ -0,0 +1,156 @@
1
+ var f = Object.defineProperty;
2
+ var p = (s, i, e) => i in s ? f(s, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[i] = e;
3
+ var l = (s, i, e) => p(s, typeof i != "symbol" ? i + "" : i, e);
4
+ import { RaphReactivity as A } from "../../reactivity/engine.js";
5
+ let n;
6
+ class g {
7
+ constructor() {
8
+ // Хранит binding только на время синхронной регистрации effect.
9
+ l(this, "_active");
10
+ }
11
+ /**
12
+ * Связывает effect с owner и phase только на время регистрации.
13
+ */
14
+ bind(i) {
15
+ const e = this._active;
16
+ return e === void 0 ? { schedule: i, dispose: m } : e.binding(i);
17
+ }
18
+ /**
19
+ * Выполняет операцию с текущим effect binding.
20
+ */
21
+ runWith(i, e) {
22
+ const t = this._active;
23
+ this._active = i === void 0 ? void 0 : { binding: i };
24
+ try {
25
+ return e();
26
+ } finally {
27
+ this._active = t;
28
+ }
29
+ }
30
+ }
31
+ class O extends A {
32
+ /**
33
+ * Создаёт policy adapter реактивного графа для одного runtime.
34
+ */
35
+ constructor(e, t = {}) {
36
+ const o = new g();
37
+ super({
38
+ ...t.adaptiveDependencyIndex === void 0 ? {} : { adaptiveDependencyIndex: t.adaptiveDependencyIndex },
39
+ effectScheduler: {
40
+ bind: o.bind.bind(o)
41
+ }
42
+ });
43
+ // Изолирует registration binding от алгоритмов базового reactive graph.
44
+ l(this, "_bindings");
45
+ this._lifecycle = e, this._bindings = o;
46
+ }
47
+ /**
48
+ * Создаёт временную registration boundary для runtime effect.
49
+ */
50
+ withEffectBinding(e, t) {
51
+ return this._bindings.runWith(e, t);
52
+ }
53
+ /**
54
+ * Выполняет untracked-операцию, сохраняя runtime owner context.
55
+ */
56
+ untrackedWithOwner(e) {
57
+ const t = n;
58
+ n = void 0;
59
+ try {
60
+ return this.untracked(e);
61
+ } finally {
62
+ n = t;
63
+ }
64
+ }
65
+ /**
66
+ * Возвращает owner текущего синхронного реактивного контекста.
67
+ */
68
+ getActiveOwner() {
69
+ return n == null ? void 0 : n.lifecycle.owner;
70
+ }
71
+ /** Returns the Runtime resource owner whose implicit dependencies are being collected. */
72
+ getActiveConsumerOwner() {
73
+ return n == null ? void 0 : n.consumerOwner;
74
+ }
75
+ /**
76
+ * Сообщает, должен ли untracked work очищать graph consumer или Runtime owner context.
77
+ */
78
+ hasActiveContext() {
79
+ return n !== void 0 || this._isTracking();
80
+ }
81
+ /**
82
+ * Выполняет операцию с указанным active owner.
83
+ */
84
+ runWithOwner(e, t, o) {
85
+ const d = n;
86
+ n = e === void 0 ? void 0 : { consumerOwner: t, lifecycle: e };
87
+ try {
88
+ return o();
89
+ } finally {
90
+ n = d;
91
+ }
92
+ }
93
+ /**
94
+ * Создаёт owned signal с runtime lifecycle policy.
95
+ */
96
+ signalForOwner(e, t, o, d) {
97
+ const r = this._lifecycle, c = t._adoptSource(this._ownedSignal(e, o)), _ = r.assertWriteAllowed, h = r.runWrite ?? k;
98
+ return d == null || d((v) => {
99
+ u(r), t._assertAlive(), c.set(v);
100
+ }), _ !== void 0 ? {
101
+ get() {
102
+ return a(r, t), t._assertAlive(), c.get();
103
+ },
104
+ peek() {
105
+ return u(r), t._assertAlive(), c.peek();
106
+ },
107
+ set(v) {
108
+ t._assertAlive(), _(), h(() => c.set(v));
109
+ }
110
+ } : {
111
+ get() {
112
+ return a(r, t), t._assertAlive(), c.get();
113
+ },
114
+ peek() {
115
+ return u(r), t._assertAlive(), c.peek();
116
+ },
117
+ set(v) {
118
+ u(r), t._assertAlive(), h(() => c.set(v));
119
+ }
120
+ };
121
+ }
122
+ /**
123
+ * Создаёт owned computed с runtime lifecycle policy.
124
+ */
125
+ computedForOwner(e, t, o) {
126
+ const d = this._lifecycle, r = t._adoptSource(this._ownedComputed(e, o));
127
+ return {
128
+ get() {
129
+ a(d, t), t._assertAlive();
130
+ const c = r.get();
131
+ return t._assertAlive(), c;
132
+ },
133
+ peek() {
134
+ u(d), t._assertAlive();
135
+ const c = r.peek();
136
+ return t._assertAlive(), c;
137
+ }
138
+ };
139
+ }
140
+ }
141
+ function u(s) {
142
+ s.owner === void 0 && s.throwDisposed();
143
+ }
144
+ function a(s, i) {
145
+ u(s);
146
+ const e = n;
147
+ e !== void 0 && e.lifecycle !== s && s.throwCrossRuntime(e.lifecycle.owner), (e == null ? void 0 : e.consumerOwner) !== void 0 && s.assertDependencyAllowed(i, e.consumerOwner);
148
+ }
149
+ function k(s) {
150
+ return s();
151
+ }
152
+ function m() {
153
+ }
154
+ export {
155
+ O as RuntimeReactivity
156
+ };
@@ -0,0 +1 @@
1
+ "use strict";var p=Object.defineProperty;var c=(i,e,t)=>e in i?p(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var r=(i,e,t)=>c(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class h{constructor(e,t){r(this,"_cleanup");r(this,"_stopped",!1);r(this,"deliver",()=>{if(this._stopped)return;const e=this._cleanup;if(e===void 0){const t=this._callback();if(typeof t!="function")return;this._stopped?this._runUntracked(t):this._cleanup=t;return}this._deliverWithCleanup(e)});this._runUntracked=e,this._callback=t}get stopped(){return this._stopped}_deliverWithCleanup(e){const t=[];if(this._cleanup=void 0,this._attempt(e,t),!this._stopped){let n=null;try{const s=this._runUntracked(this._callback);typeof s=="function"&&(n=s)}catch(s){t.push(s)}n!==null&&(this._stopped?this._attempt(n,t):this._cleanup=n)}a(t)}stop(e){if(this._stopped)return;this._stopped=!0;const t=[];if(e!==void 0)try{e()}catch(s){t.push(s)}const n=this._cleanup;this._cleanup=void 0,n!==void 0&&this._attempt(n,t),a(t)}_attempt(e,t){try{this._runUntracked(e)}catch(n){t.push(n)}}}function a(i){if(i.length===1)throw i[0];if(i.length>1)throw new AggregateError(i,"[Raph] Runtime watch delivery failed.")}exports.RuntimeWatch=h;
@@ -0,0 +1,88 @@
1
+ var h = Object.defineProperty;
2
+ var a = (i, e, t) => e in i ? h(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var r = (i, e, t) => a(i, typeof e != "symbol" ? e + "" : e, t);
4
+ class l {
5
+ /**
6
+ * Создаёт runtime-owned watch с явным lifecycle остановки.
7
+ */
8
+ constructor(e, t) {
9
+ // Хранят cleanup последней доставки и окончательное состояние watcher.
10
+ r(this, "_cleanup");
11
+ r(this, "_stopped", !1);
12
+ /**
13
+ * Освобождает предыдущий результат callback и выполняет новую доставку.
14
+ * Ошибка cleanup не лишает живой watcher текущего события.
15
+ */
16
+ r(this, "deliver", () => {
17
+ if (this._stopped)
18
+ return;
19
+ const e = this._cleanup;
20
+ if (e === void 0) {
21
+ const t = this._callback();
22
+ if (typeof t != "function")
23
+ return;
24
+ this._stopped ? this._runUntracked(t) : this._cleanup = t;
25
+ return;
26
+ }
27
+ this._deliverWithCleanup(e);
28
+ });
29
+ this._runUntracked = e, this._callback = t;
30
+ }
31
+ /**
32
+ * Показывает, остановлен ли watch.
33
+ */
34
+ get stopped() {
35
+ return this._stopped;
36
+ }
37
+ /**
38
+ * Preserves cleanup/callback error aggregation and reentrant stop semantics
39
+ * for the less common resource-returning callback path.
40
+ */
41
+ _deliverWithCleanup(e) {
42
+ const t = [];
43
+ if (this._cleanup = void 0, this._attempt(e, t), !this._stopped) {
44
+ let n = null;
45
+ try {
46
+ const s = this._runUntracked(this._callback);
47
+ typeof s == "function" && (n = s);
48
+ } catch (s) {
49
+ t.push(s);
50
+ }
51
+ n !== null && (this._stopped ? this._attempt(n, t) : this._cleanup = n);
52
+ }
53
+ p(t);
54
+ }
55
+ /**
56
+ * Останавливает внешнюю регистрацию и cleanup callback, сохраняя обе ошибки.
57
+ */
58
+ stop(e) {
59
+ if (this._stopped)
60
+ return;
61
+ this._stopped = !0;
62
+ const t = [];
63
+ if (e !== void 0)
64
+ try {
65
+ e();
66
+ } catch (s) {
67
+ t.push(s);
68
+ }
69
+ const n = this._cleanup;
70
+ this._cleanup = void 0, n !== void 0 && this._attempt(n, t), p(t);
71
+ }
72
+ _attempt(e, t) {
73
+ try {
74
+ this._runUntracked(e);
75
+ } catch (n) {
76
+ t.push(n);
77
+ }
78
+ }
79
+ }
80
+ function p(i) {
81
+ if (i.length === 1)
82
+ throw i[0];
83
+ if (i.length > 1)
84
+ throw new AggregateError(i, "[Raph] Runtime watch delivery failed.");
85
+ }
86
+ export {
87
+ l as RuntimeWatch
88
+ };
@@ -0,0 +1,2 @@
1
+ export { createMachineCoverage, createManualMachineClock, enumerateMachinePaths, inspectMachine, } from '../machine/testing';
2
+ export type { EnumeratedMachinePath, EnumerateMachinePathOptions, MachineCoverage, MachineCoverageReport, MachineInspection, ManualMachineClock, } from '../machine/testing';
@@ -0,0 +1,5 @@
1
+ export { defineMachine } from '../machine/compiler';
2
+ export { getInitialSnapshot, transition } from '../machine/core';
3
+ export { MachinePersistenceError, persistMachineSnapshot, restoreMachineSnapshot, } from '../machine/persistence';
4
+ export { createMachine } from '../machine/runtime';
5
+ export type { CreateMachineOptions, MachineActorRef, MachineBindings, MachineClock, MachineConfig, MachineEvent, MachineEventStatus, MachineGuard, MachineGuardArgs, MachineInstance, MachineInvokeConfig, MachineMigration, MachineModel, MachineOutput, MachineOutputArgs, MachineReducer, MachineReducerArgs, MachineResource, MachineResourceArgs, MachineSendResult, MachineSnapshot, MachineStateConfig, MachineStatus, MachineTask, MachineTaskArgs, MachineTransitionConfig, MachineTransitionDefinition, PersistedMachineSnapshot, } from '../machine/types';
@@ -0,0 +1,14 @@
1
+ export type { DataPathParseOptions, PathScalar, PathSegment, PlainDataPath, } from '../path/data-path.types';
2
+ export { DataPath } from '../path/DataPath';
3
+ export type { DerivedCollectionByKeyStrategy, DerivedFilterByKeyStrategy, DerivedFullStrategy, DerivedStrategy, } from '../path/derived/derived-strategy.types';
4
+ export { collectionByKey, filterByKey, full } from '../path/derived/derived-strategy.utils';
5
+ export { RaphDerivedHandle } from '../path/derived/RaphDerivedHandle';
6
+ export type { DerivedOptions } from '../path/derived/RaphDerivedHandle';
7
+ export type { RaphMetaApi, RaphMetaEvents, RaphMetaMutationCause, RaphMetaMutationEvent, RaphMetaMutationKind, RaphMetaReadOptions, RaphMetaWatchCallback, RaphMetaWatchOptions, RaphMetaWriteOptions, } from '../path/meta/meta.types';
8
+ export { RaphMeta } from '../path/meta/RaphMeta';
9
+ export type { DataPathDef, PathApi, PathEvent, PathEvents, PathMutationKind, PathOptions, PathWatchCallback, } from '../path/path.types';
10
+ export { RaphKernel } from '../path/RaphKernel';
11
+ export type { RaphKernelOptions, RaphKernelRoot, RaphKernelRuntime, } from '../path/RaphKernel';
12
+ export type { DataAdapter, DataObject, DefaultAdapterOptions, } from '../path/storage/data-adapter.types';
13
+ export { DefaultDataAdapter } from '../path/storage/DefaultDataAdapter';
14
+ export { PathStore } from '../path/storage/PathStore';
@@ -0,0 +1 @@
1
+ export * from '../reactivity/engine';
@@ -0,0 +1,17 @@
1
+ export type { RaphDebugFrameLoopSnapshot, RaphDebugMachinesApi, RaphDebugOptions, RaphDebugOwnerSnapshot, RaphDebugSnapshot, RaphDebugStats, RaphDebugTraceApi, RaphDebugTreeNode, RaphMachineDebugSnapshot, RaphMachineDebugSummary, RaphRuntimeDebug, RaphTraceContextMode, RaphTraceEvent, RaphTraceGuardMode, RaphTraceKind, RaphTraceOptions, RaphTraceReadOptions, RaphTraceStatus, } from '../runtime/diagnostics/RaphDebug';
2
+ export { RaphActionError, RaphCrossRuntimeError, RaphDisposedError, RaphPhaseProcessError, } from '../runtime/errors';
3
+ export type { DepGraph } from '../runtime/ownership/parent-graph.types';
4
+ export { parentGraph } from '../runtime/ownership/parentGraph';
5
+ export { RaphEffectScope } from '../runtime/ownership/RaphEffectScope';
6
+ export { RaphNode } from '../runtime/ownership/RaphNode';
7
+ export type { NodeOptions } from '../runtime/ownership/RaphNode';
8
+ export { RaphScope } from '../runtime/ownership/RaphScope';
9
+ export { orderPhaseTasks } from '../runtime/phases/orderPhaseTasks';
10
+ export { RaphSchedulerType } from '../runtime/phases/phase.types';
11
+ export type { FrameLoopLease, RaphAggregateSource, RaphEffectInitialMode, RaphEffectOptions, RaphFrameContext, RaphPhase, RaphPhaseBatch, RaphPhaseEffect, RaphPhaseTask, RaphSchedulerMode, RaphStructureCause, RaphTaskOrderOptions, RaphWatchInclude, RaphWatchInitialMode, RaphWatchOptions, RaphWatchSource, RaphWorkCause, RaphWorkCauseKind, } from '../runtime/phases/phase.types';
12
+ export { RaphRuntime } from '../runtime/RaphRuntime';
13
+ export type { RaphRuntimeConfiguration, RaphRuntimeMeta, RaphRuntimeOptions, } from '../runtime/RaphRuntime';
14
+ export { PathHandle } from '../runtime/reactivity/PathHandle';
15
+ export type { RaphMetaSource } from '../runtime/reactivity/RaphMetaSource';
16
+ export type { RaphMetaSourceOptions } from '../runtime/reactivity/RaphMetaSource';
17
+ export type { RaphAggregate } from '../runtime/reactivity/RaphWorkGraph';
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./debug/path/data-adapter.cjs"),o=require("./debug/path/data-path.cjs"),r=require("./debug/path/derived-strategies.cjs"),t=require("./debug/path/RaphDerivedHandle.cjs"),h=require("./debug/path/RaphKernel.cjs"),u=require("./debug/path/RaphMeta.cjs"),a=require("./debug/runtime/errors.cjs"),i=require("./debug/runtime/parent-graph.cjs"),n=require("./debug/runtime/PathHandle.cjs"),R=require("./debug/runtime/phase.types.cjs"),d=require("./debug/runtime/RaphNode.cjs"),_=require("./debug/runtime/RaphRuntime.cjs"),s=require("./debug/runtime/RaphScope.cjs"),e=require("./debug/api/errors.cjs"),c=require("./debug/api/Raph.cjs");exports.DefaultDataAdapter=p.DefaultDataAdapter;exports.DataPath=o.DataPath;exports.collectionByKey=r.collectionByKey;exports.filterByKey=r.filterByKey;exports.full=r.full;exports.RaphDerivedHandle=t.RaphDerivedHandle;exports.RaphDerivedTargetWriteError=t.RaphDerivedTargetWriteError;exports.RaphKernel=h.RaphKernel;exports.RaphMeta=u.RaphMeta;exports.RaphActionError=a.RaphActionError;exports.RaphCrossRuntimeError=a.RaphCrossRuntimeError;exports.RaphDisposedError=a.RaphDisposedError;exports.parentGraph=i.parentGraph;exports.PathHandle=n.PathHandle;exports.RaphSchedulerType=R.RaphSchedulerType;exports.RaphNode=d.RaphNode;exports.RaphRuntime=_.RaphRuntime;exports.RaphScope=s.RaphScope;exports.RaphConfigurationError=e.RaphConfigurationError;exports.RaphDefaultRuntimeError=e.RaphDefaultRuntimeError;exports.RaphError=e.RaphError;exports.RaphModeError=e.RaphModeError;exports.Raph=c.Raph;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./debug/api/errors.cjs"),p=require("./debug/api/Raph.cjs"),i=require("./debug/api/RaphReactivityInstance.cjs"),r=require("./debug/runtime/errors.cjs"),o=require("./debug/runtime/ownership/parentGraph.cjs"),h=require("./debug/runtime/ownership/RaphEffectScope.cjs"),n=require("./debug/runtime/ownership/RaphNode.cjs"),s=require("./debug/runtime/ownership/RaphScope.cjs"),u=require("./debug/runtime/phases/orderPhaseTasks.cjs"),R=require("./debug/runtime/phases/phase.types.cjs"),d=require("./debug/runtime/RaphRuntime.cjs"),c=require("./debug/runtime/reactivity/PathHandle.cjs"),_=require("./debug/path/DataPath.cjs"),a=require("./debug/path/derived/derived-strategy.utils.cjs"),t=require("./debug/path/derived/RaphDerivedHandle.cjs"),l=require("./debug/path/meta/RaphMeta.cjs"),g=require("./debug/path/RaphKernel.cjs"),E=require("./debug/path/storage/DefaultDataAdapter.cjs");exports.RaphCapabilityError=e.RaphCapabilityError;exports.RaphConfigurationError=e.RaphConfigurationError;exports.RaphDefaultInstanceError=e.RaphDefaultInstanceError;exports.RaphError=e.RaphError;exports.RaphFacadeDisposedError=e.RaphFacadeDisposedError;exports.Raph=p.Raph;exports.RaphReactivityInstance=i.RaphReactivityInstance;exports.RaphActionError=r.RaphActionError;exports.RaphCrossRuntimeError=r.RaphCrossRuntimeError;exports.RaphDisposedError=r.RaphDisposedError;exports.RaphPhaseProcessError=r.RaphPhaseProcessError;exports.parentGraph=o.parentGraph;exports.RaphEffectScope=h.RaphEffectScope;exports.RaphNode=n.RaphNode;exports.RaphScope=s.RaphScope;exports.orderPhaseTasks=u.orderPhaseTasks;exports.RaphSchedulerType=R.RaphSchedulerType;exports.RaphRuntime=d.RaphRuntime;exports.PathHandle=c.PathHandle;exports.DataPath=_.DataPath;exports.collectionByKey=a.collectionByKey;exports.filterByKey=a.filterByKey;exports.full=a.full;exports.RaphDerivedHandle=t.RaphDerivedHandle;exports.RaphDerivedTargetWriteError=t.RaphDerivedTargetWriteError;exports.RaphMeta=l.RaphMeta;exports.RaphKernel=g.RaphKernel;exports.DefaultDataAdapter=E.DefaultDataAdapter;
package/dist/index.js CHANGED
@@ -1,40 +1,48 @@
1
- import { DefaultDataAdapter as e } from "./debug/path/data-adapter.js";
2
- import { DataPath as t } from "./debug/path/data-path.js";
3
- import { collectionByKey as f, filterByKey as h, full as R } from "./debug/path/derived-strategies.js";
4
- import { RaphDerivedHandle as x, RaphDerivedTargetWriteError as i } from "./debug/path/RaphDerivedHandle.js";
5
- import { RaphKernel as n } from "./debug/path/RaphKernel.js";
6
- import { RaphMeta as u } from "./debug/path/RaphMeta.js";
7
- import { RaphActionError as D, RaphCrossRuntimeError as c, RaphDisposedError as y } from "./debug/runtime/errors.js";
8
- import { parentGraph as K } from "./debug/runtime/parent-graph.js";
9
- import { PathHandle as v } from "./debug/runtime/PathHandle.js";
10
- import { RaphSchedulerType as B } from "./debug/runtime/phase.types.js";
11
- import { RaphNode as H } from "./debug/runtime/RaphNode.js";
12
- import { RaphRuntime as P } from "./debug/runtime/RaphRuntime.js";
13
- import { RaphScope as T } from "./debug/runtime/RaphScope.js";
14
- import { RaphConfigurationError as N, RaphDefaultRuntimeError as W, RaphError as b, RaphModeError as j } from "./debug/api/errors.js";
15
- import { Raph as q } from "./debug/api/Raph.js";
1
+ import { RaphCapabilityError as e, RaphConfigurationError as p, RaphDefaultInstanceError as a, RaphError as t, RaphFacadeDisposedError as h } from "./debug/api/errors.js";
2
+ import { Raph as R } from "./debug/api/Raph.js";
3
+ import { RaphReactivityInstance as x } from "./debug/api/RaphReactivityInstance.js";
4
+ import { RaphActionError as n, RaphCrossRuntimeError as s, RaphDisposedError as c, RaphPhaseProcessError as l } from "./debug/runtime/errors.js";
5
+ import { parentGraph as E } from "./debug/runtime/ownership/parentGraph.js";
6
+ import { RaphEffectScope as u } from "./debug/runtime/ownership/RaphEffectScope.js";
7
+ import { RaphNode as P } from "./debug/runtime/ownership/RaphNode.js";
8
+ import { RaphScope as C } from "./debug/runtime/ownership/RaphScope.js";
9
+ import { orderPhaseTasks as S } from "./debug/runtime/phases/orderPhaseTasks.js";
10
+ import { RaphSchedulerType as g } from "./debug/runtime/phases/phase.types.js";
11
+ import { RaphRuntime as B } from "./debug/runtime/RaphRuntime.js";
12
+ import { PathHandle as I } from "./debug/runtime/reactivity/PathHandle.js";
13
+ import { DataPath as k } from "./debug/path/DataPath.js";
14
+ import { collectionByKey as G, filterByKey as M, full as N } from "./debug/path/derived/derived-strategy.utils.js";
15
+ import { RaphDerivedHandle as j, RaphDerivedTargetWriteError as q } from "./debug/path/derived/RaphDerivedHandle.js";
16
+ import { RaphMeta as z } from "./debug/path/meta/RaphMeta.js";
17
+ import { RaphKernel as L } from "./debug/path/RaphKernel.js";
18
+ import { DefaultDataAdapter as Q } from "./debug/path/storage/DefaultDataAdapter.js";
16
19
  export {
17
- t as DataPath,
18
- e as DefaultDataAdapter,
19
- v as PathHandle,
20
- q as Raph,
21
- D as RaphActionError,
22
- N as RaphConfigurationError,
23
- c as RaphCrossRuntimeError,
24
- W as RaphDefaultRuntimeError,
25
- x as RaphDerivedHandle,
26
- i as RaphDerivedTargetWriteError,
27
- y as RaphDisposedError,
28
- b as RaphError,
29
- n as RaphKernel,
30
- u as RaphMeta,
31
- j as RaphModeError,
32
- H as RaphNode,
33
- P as RaphRuntime,
34
- B as RaphSchedulerType,
35
- T as RaphScope,
36
- f as collectionByKey,
37
- h as filterByKey,
38
- R as full,
39
- K as parentGraph
20
+ k as DataPath,
21
+ Q as DefaultDataAdapter,
22
+ I as PathHandle,
23
+ R as Raph,
24
+ n as RaphActionError,
25
+ e as RaphCapabilityError,
26
+ p as RaphConfigurationError,
27
+ s as RaphCrossRuntimeError,
28
+ a as RaphDefaultInstanceError,
29
+ j as RaphDerivedHandle,
30
+ q as RaphDerivedTargetWriteError,
31
+ c as RaphDisposedError,
32
+ u as RaphEffectScope,
33
+ t as RaphError,
34
+ h as RaphFacadeDisposedError,
35
+ L as RaphKernel,
36
+ z as RaphMeta,
37
+ P as RaphNode,
38
+ l as RaphPhaseProcessError,
39
+ x as RaphReactivityInstance,
40
+ B as RaphRuntime,
41
+ g as RaphSchedulerType,
42
+ C as RaphScope,
43
+ G as collectionByKey,
44
+ M as filterByKey,
45
+ N as full,
46
+ S as orderPhaseTasks,
47
+ E as parentGraph
40
48
  };
@@ -0,0 +1,71 @@
1
+ import { MachineConfig, MachineEvent, MachineGuardRef, MachineInvokeConfig, MachineMigration, MachineModel, MachineOutputRef, MachineReducerRef } from './types';
2
+ export type CompiledStateKind = 'atomic' | 'compound' | 'final' | 'history' | 'parallel';
3
+ export interface CompiledTransition {
4
+ readonly emit: readonly MachineOutputRef<unknown, MachineEvent, unknown>[];
5
+ readonly guard?: MachineGuardRef<unknown, MachineEvent, unknown>;
6
+ readonly index: number;
7
+ readonly raise?: MachineEvent | ((args: {
8
+ readonly context: Readonly<unknown>;
9
+ readonly event: MachineEvent;
10
+ readonly input: unknown;
11
+ }) => MachineEvent);
12
+ readonly reason?: string;
13
+ readonly reduce: readonly MachineReducerRef<unknown, MachineEvent, unknown>[];
14
+ readonly reenter: boolean;
15
+ readonly source: number;
16
+ readonly target?: number;
17
+ }
18
+ export interface CompiledInvoke {
19
+ readonly id: string;
20
+ readonly input?: MachineInvokeConfig<unknown, MachineEvent, unknown>['input'];
21
+ readonly onDone: readonly CompiledTransition[];
22
+ readonly onError: readonly CompiledTransition[];
23
+ readonly src: MachineInvokeConfig<unknown, MachineEvent, unknown>['src'];
24
+ readonly type: 'machine' | 'task';
25
+ }
26
+ export interface CompiledState {
27
+ readonly after: ReadonlyMap<string, readonly CompiledTransition[]>;
28
+ readonly always: readonly CompiledTransition[];
29
+ readonly children: readonly number[];
30
+ readonly depth: number;
31
+ readonly entry: readonly MachineOutputRef<unknown, MachineEvent, unknown>[];
32
+ readonly exit: readonly MachineOutputRef<unknown, MachineEvent, unknown>[];
33
+ readonly history: 'deep' | 'shallow';
34
+ readonly historyFallback?: number;
35
+ readonly id: number;
36
+ readonly initial?: number;
37
+ readonly invokes: readonly CompiledInvoke[];
38
+ readonly key: string;
39
+ readonly kind: CompiledStateKind;
40
+ readonly meta?: Readonly<Record<string, unknown>>;
41
+ readonly on: ReadonlyMap<string, readonly CompiledTransition[]>;
42
+ readonly onDone: readonly CompiledTransition[];
43
+ readonly output?: unknown | ((args: {
44
+ readonly context: Readonly<unknown>;
45
+ readonly event: MachineEvent;
46
+ readonly input: unknown;
47
+ }) => unknown);
48
+ readonly parent?: number;
49
+ readonly path: string;
50
+ readonly resources: readonly string[];
51
+ readonly tags: readonly string[];
52
+ }
53
+ export interface CompiledMachine {
54
+ readonly ancestry: readonly (readonly number[])[];
55
+ readonly context: MachineConfig<unknown, MachineEvent, unknown, unknown>['context'];
56
+ readonly eventIndexes: ReadonlyMap<string, number>;
57
+ readonly eventTypes: readonly string[];
58
+ readonly flat: boolean;
59
+ readonly flatDispatch?: readonly (readonly CompiledTransition[] | undefined)[];
60
+ readonly id: string;
61
+ readonly initial: number;
62
+ readonly migrations: ReadonlyMap<number, MachineMigration>;
63
+ readonly output?: MachineConfig<unknown, MachineEvent, unknown, unknown>['output'];
64
+ readonly pathToState: ReadonlyMap<string, number>;
65
+ readonly rootChildren: readonly number[];
66
+ readonly states: readonly CompiledState[];
67
+ readonly version: number;
68
+ }
69
+ export declare function defineMachine<Context, Event extends MachineEvent, Input = void, Output = unknown>(config: MachineConfig<Context, Event, Input, Output>): MachineModel<Context, Event, Input, Output>;
70
+ /** @internal */
71
+ export declare function getCompiledMachine(model: MachineModel<unknown, MachineEvent, unknown, unknown>): CompiledMachine;
@@ -0,0 +1,50 @@
1
+ import { CompiledMachine, CompiledTransition } from './compiler';
2
+ import { MachineBindings, MachineEvent, MachineModel, MachineOutputRef, MachineSnapshot, PersistedMachineSnapshot } from './types';
3
+ export interface MachineEvaluationHooks {
4
+ readonly guard?: (name: string, passed: boolean, context: Readonly<Record<string, unknown>> | undefined) => void;
5
+ readonly transition?: (details: {
6
+ readonly reason?: string;
7
+ readonly source: string;
8
+ readonly target?: string;
9
+ }) => void;
10
+ }
11
+ export interface MachineEffectPlan {
12
+ readonly entered: readonly number[];
13
+ readonly entryOutputs: readonly PlannedOutput[];
14
+ readonly event: MachineEvent;
15
+ readonly exited: readonly number[];
16
+ readonly exitOutputs: readonly PlannedOutput[];
17
+ readonly transitionOutputRefs?: readonly MachineOutputRef<unknown, MachineEvent, unknown>[];
18
+ readonly transitionOutputs: readonly PlannedOutput[];
19
+ }
20
+ export interface PlannedOutput {
21
+ readonly event: MachineEvent;
22
+ readonly ref: MachineOutputRef<unknown, MachineEvent, unknown>;
23
+ }
24
+ export interface MachineMacrostepResult<Context, Output> {
25
+ readonly changed: boolean;
26
+ readonly plan: MachineEffectPlan;
27
+ readonly snapshot: MachineSnapshot<Context, Output>;
28
+ }
29
+ export declare function getInitialSnapshot<Context, Event extends MachineEvent, Input, Output>(model: MachineModel<Context, Event, Input, Output>, input?: Input): MachineSnapshot<Context, Output>;
30
+ export declare function transition<Context, Event extends MachineEvent, Input, Output>(model: MachineModel<Context, Event, Input, Output>, snapshot: MachineSnapshot<Context, Output>, event: Event, bindings?: MachineBindings<Context, Event, Input>, hooks?: MachineEvaluationHooks): MachineSnapshot<Context, Output>;
31
+ /** @internal */
32
+ export declare function assertMachineSnapshot(model: MachineModel<unknown, MachineEvent, unknown, unknown>, snapshot: MachineSnapshot<unknown>): void;
33
+ /** Creates a terminal snapshot while retaining model/input provenance. @internal */
34
+ export declare function stopMachineSnapshot<Context, Event extends MachineEvent, Input, Output>(model: MachineModel<Context, Event, Input, Output>, snapshot: MachineSnapshot<Context, Output>): MachineSnapshot<Context, Output>;
35
+ /** @internal */
36
+ export declare function createInitialSnapshot<Context, Event extends MachineEvent, Input, Output>(model: MachineModel<Context, Event, Input, Output>, input: Input, bindings: MachineBindings<Context, Event, Input> | undefined, hooks?: MachineEvaluationHooks): MachineMacrostepResult<Context, Output>;
37
+ /** @internal */
38
+ export declare function runMacrostep<Context, Event extends MachineEvent, Input, Output>(model: MachineModel<Context, Event, Input, Output>, snapshot: MachineSnapshot<Context, Output>, event: Event, bindings: MachineBindings<Context, Event, Input> | undefined, input: Input, hooks?: MachineEvaluationHooks, compiledInput?: CompiledMachine, stabilizeOnly?: boolean, initialRaised?: readonly MachineEvent[]): MachineMacrostepResult<Context, Output>;
39
+ /**
40
+ * Выполняет macrostep после проверки события владеющим Runtime.
41
+ *
42
+ * @internal
43
+ */
44
+ export declare function runValidatedMacrostep<Context, Event extends MachineEvent, Input, Output>(model: MachineModel<Context, Event, Input, Output>, snapshot: MachineSnapshot<Context, Output>, event: Event, bindings: MachineBindings<Context, Event, Input> | undefined, input: Input, hooks?: MachineEvaluationHooks, compiledInput?: CompiledMachine, flatEventId?: number, stabilizeOnly?: boolean, initialRaised?: readonly MachineEvent[]): MachineMacrostepResult<Context, Output>;
45
+ /** @internal */
46
+ export declare function runExplicitTransitions<Context, Event extends MachineEvent, Input, Output>(model: MachineModel<Context, Event, Input, Output>, snapshot: MachineSnapshot<Context, Output>, event: Event, transitions: readonly CompiledTransition[], bindings: MachineBindings<Context, Event, Input> | undefined, input: Input, hooks?: MachineEvaluationHooks): MachineMacrostepResult<Context, Output>;
47
+ /** Создаёт validated immutable live snapshot без повторения entry outputs. @internal */
48
+ export declare function hydrateSnapshot<Context, Event extends MachineEvent, Input, Output>(model: MachineModel<Context, Event, Input, Output>, persisted: PersistedMachineSnapshot<Context, Output>, input: Input): MachineSnapshot<Context, Output>;
49
+ /** @internal */
50
+ export declare function canHandleEvent(compiled: CompiledMachine, active: readonly string[], eventType: string): boolean;
@@ -0,0 +1,5 @@
1
+ import { MachineEvent, MachineModel, MachineSnapshot, PersistedMachineSnapshot } from './types';
2
+ export declare class MachinePersistenceError extends Error {
3
+ }
4
+ export declare function persistMachineSnapshot<Context, Event extends MachineEvent, Input, Output>(model: MachineModel<Context, Event, Input, Output>, snapshot: MachineSnapshot<Context, Output>): PersistedMachineSnapshot<Context, Output>;
5
+ export declare function restoreMachineSnapshot<Context, Event extends MachineEvent, Input, Output>(model: MachineModel<Context, Event, Input, Output>, persisted: PersistedMachineSnapshot<unknown, unknown>, input?: Input): MachineSnapshot<Context, Output>;
@@ -0,0 +1,4 @@
1
+ import { RaphNode } from '../runtime/ownership/RaphNode';
2
+ import { CreateMachineOptions, MachineBindings, MachineEvent, MachineInstance, MachineModel } from './types';
3
+ import { RaphScope } from '../runtime/ownership/RaphScope';
4
+ export declare function createMachine<Context, Event extends MachineEvent, Input = void, Output = unknown>(owner: RaphNode | RaphScope, model: MachineModel<Context, Event, Input, Output>, bindings?: MachineBindings<Context, Event, Input>, options?: CreateMachineOptions<Context, Input, Output>): MachineInstance<Context, Event, Input, Output>;
@@ -0,0 +1,43 @@
1
+ import { MachineBindings, MachineClock, MachineEvent, MachineModel, MachineSnapshot } from './types';
2
+ export interface MachineInspection {
3
+ readonly deadEnds: readonly string[];
4
+ readonly inconsistencies: readonly string[];
5
+ readonly reachable: readonly string[];
6
+ readonly unreachable: readonly string[];
7
+ readonly valid: boolean;
8
+ }
9
+ export interface EnumeratedMachinePath<Context, Output> {
10
+ readonly events: readonly MachineEvent[];
11
+ readonly snapshot: MachineSnapshot<Context, Output>;
12
+ }
13
+ export interface EnumerateMachinePathOptions<Context, Event extends MachineEvent, Input> {
14
+ readonly bindings?: MachineBindings<Context, Event, Input>;
15
+ readonly events?: readonly Event[];
16
+ readonly input?: Input;
17
+ readonly maxDepth?: number;
18
+ readonly maxPaths?: number;
19
+ }
20
+ export interface MachineCoverageReport {
21
+ readonly guards: Readonly<Record<string, Readonly<{
22
+ failed: number;
23
+ passed: number;
24
+ }>>>;
25
+ readonly states: Readonly<Record<string, number>>;
26
+ readonly transitions: Readonly<Record<string, number>>;
27
+ }
28
+ export interface MachineCoverage {
29
+ guard: (name: string, passed: boolean) => void;
30
+ record: <Context, Output>(before: MachineSnapshot<Context, Output>, event: MachineEvent, after: MachineSnapshot<Context, Output>) => void;
31
+ report: () => MachineCoverageReport;
32
+ reset: () => void;
33
+ transition: <Context, Event extends MachineEvent, Input, Output>(model: MachineModel<Context, Event, Input, Output>, before: MachineSnapshot<Context, Output>, event: Event, bindings?: MachineBindings<Context, Event, Input>) => MachineSnapshot<Context, Output>;
34
+ }
35
+ export interface ManualMachineClock extends MachineClock {
36
+ readonly pending: number;
37
+ advance: (duration: number) => void;
38
+ runAll: () => void;
39
+ }
40
+ export declare function inspectMachine<Context, Event extends MachineEvent, Input, Output>(model: MachineModel<Context, Event, Input, Output>): MachineInspection;
41
+ export declare function enumerateMachinePaths<Context, Event extends MachineEvent, Input, Output>(model: MachineModel<Context, Event, Input, Output>, options?: EnumerateMachinePathOptions<Context, Event, Input>): readonly EnumeratedMachinePath<Context, Output>[];
42
+ export declare function createMachineCoverage(): MachineCoverage;
43
+ export declare function createManualMachineClock(initialNow?: number): ManualMachineClock;