@raphy-js/raph 1.0.0-dev.18
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.
- package/LICENSE +202 -0
- package/dist/api/Raph.d.ts +97 -0
- package/dist/api/RaphFacadeSession.d.ts +90 -0
- package/dist/api/RaphReactivityInstance.d.ts +72 -0
- package/dist/api/errors.d.ts +25 -0
- package/dist/api/types.d.ts +170 -0
- package/dist/core-CyilRD7s.js +1055 -0
- package/dist/core-ugchZNqC.cjs +1 -0
- package/dist/debug/api/Raph.cjs +1 -0
- package/dist/debug/api/Raph.js +421 -0
- package/dist/debug/api/RaphFacadeSession.cjs +1 -0
- package/dist/debug/api/RaphFacadeSession.js +306 -0
- package/dist/debug/api/RaphReactivityInstance.cjs +1 -0
- package/dist/debug/api/RaphReactivityInstance.js +149 -0
- package/dist/debug/api/errors.cjs +1 -0
- package/dist/debug/api/errors.js +17 -0
- package/dist/debug/api/types.cjs +1 -0
- package/dist/debug/api/types.js +1 -0
- package/dist/debug/path/DataPath.cjs +1 -0
- package/dist/debug/path/DataPath.js +394 -0
- package/dist/debug/path/PathRouter.cjs +1 -0
- package/dist/debug/path/PathRouter.js +86 -0
- package/dist/debug/path/RaphKernel.cjs +1 -0
- package/dist/debug/path/RaphKernel.js +687 -0
- package/dist/debug/path/data-path.types.cjs +1 -0
- package/dist/debug/path/data-path.types.js +1 -0
- package/dist/debug/path/data-path.utils.cjs +1 -0
- package/dist/debug/path/data-path.utils.js +56 -0
- package/dist/debug/path/derived/DerivedRegistry.cjs +1 -0
- package/dist/debug/path/derived/DerivedRegistry.js +157 -0
- package/dist/debug/path/derived/RaphDerivedHandle.cjs +1 -0
- package/dist/debug/path/derived/RaphDerivedHandle.js +125 -0
- package/dist/debug/path/derived/derived-collection.types.cjs +1 -0
- package/dist/debug/path/derived/derived-collection.types.js +1 -0
- package/dist/debug/path/derived/derived-collection.utils.cjs +1 -0
- package/dist/debug/path/derived/derived-collection.utils.js +179 -0
- package/dist/debug/path/derived/derived-strategy.types.cjs +1 -0
- package/dist/debug/path/derived/derived-strategy.types.js +1 -0
- package/dist/debug/path/derived/derived-strategy.utils.cjs +1 -0
- package/dist/debug/path/derived/derived-strategy.utils.js +20 -0
- package/dist/debug/path/meta/MetaController.cjs +1 -0
- package/dist/debug/path/meta/MetaController.js +214 -0
- package/dist/debug/path/meta/RaphMeta.cjs +1 -0
- package/dist/debug/path/meta/RaphMeta.js +68 -0
- package/dist/debug/path/meta/RaphMetaStore.cjs +1 -0
- package/dist/debug/path/meta/RaphMetaStore.js +184 -0
- package/dist/debug/path/meta/meta.types.cjs +1 -0
- package/dist/debug/path/meta/meta.types.js +1 -0
- package/dist/debug/path/path.types.cjs +1 -0
- package/dist/debug/path/path.types.js +1 -0
- package/dist/debug/path/pathSegmentKey.cjs +1 -0
- package/dist/debug/path/pathSegmentKey.js +12 -0
- package/dist/debug/path/storage/AdapterPathStore.cjs +1 -0
- package/dist/debug/path/storage/AdapterPathStore.js +133 -0
- package/dist/debug/path/storage/DefaultDataAdapter.cjs +1 -0
- package/dist/debug/path/storage/DefaultDataAdapter.js +356 -0
- package/dist/debug/path/storage/PathEventHub.cjs +1 -0
- package/dist/debug/path/storage/PathEventHub.js +148 -0
- package/dist/debug/path/storage/PathStore.cjs +1 -0
- package/dist/debug/path/storage/PathStore.js +326 -0
- package/dist/debug/path/storage/createDataDraft.cjs +1 -0
- package/dist/debug/path/storage/createDataDraft.js +71 -0
- package/dist/debug/path/storage/data-adapter.types.cjs +1 -0
- package/dist/debug/path/storage/data-adapter.types.js +1 -0
- package/dist/debug/reactivity/engine.cjs +1 -0
- package/dist/debug/reactivity/engine.js +1305 -0
- package/dist/debug/reactivity/reactive-object.cjs +1 -0
- package/dist/debug/reactivity/reactive-object.js +280 -0
- package/dist/debug/reactivity/scope.cjs +1 -0
- package/dist/debug/reactivity/scope.js +274 -0
- package/dist/debug/reactivity/types.cjs +1 -0
- package/dist/debug/reactivity/types.js +1 -0
- package/dist/debug/reactivity/watch.cjs +1 -0
- package/dist/debug/reactivity/watch.js +64 -0
- package/dist/debug/runtime/RaphRuntime.cjs +1 -0
- package/dist/debug/runtime/RaphRuntime.js +979 -0
- package/dist/debug/runtime/diagnostics/RaphDebug.cjs +1 -0
- package/dist/debug/runtime/diagnostics/RaphDebug.js +297 -0
- package/dist/debug/runtime/errors.cjs +1 -0
- package/dist/debug/runtime/errors.js +15 -0
- package/dist/debug/runtime/ownership/RaphEffectScope.cjs +1 -0
- package/dist/debug/runtime/ownership/RaphEffectScope.js +171 -0
- package/dist/debug/runtime/ownership/RaphNode.cjs +1 -0
- package/dist/debug/runtime/ownership/RaphNode.js +206 -0
- package/dist/debug/runtime/ownership/RaphScope.cjs +1 -0
- package/dist/debug/runtime/ownership/RaphScope.js +101 -0
- package/dist/debug/runtime/ownership/parent-graph.types.cjs +1 -0
- package/dist/debug/runtime/ownership/parent-graph.types.js +1 -0
- package/dist/debug/runtime/ownership/parentGraph.cjs +1 -0
- package/dist/debug/runtime/ownership/parentGraph.js +10 -0
- package/dist/debug/runtime/ownership/throwDisposalErrors.cjs +1 -0
- package/dist/debug/runtime/ownership/throwDisposalErrors.js +9 -0
- package/dist/debug/runtime/phases/RaphFrameLoop.cjs +1 -0
- package/dist/debug/runtime/phases/RaphFrameLoop.js +106 -0
- package/dist/debug/runtime/phases/RaphPhasePipeline.cjs +1 -0
- package/dist/debug/runtime/phases/RaphPhasePipeline.js +587 -0
- package/dist/debug/runtime/phases/orderPhaseTasks.cjs +1 -0
- package/dist/debug/runtime/phases/orderPhaseTasks.js +59 -0
- package/dist/debug/runtime/phases/phase.types.cjs +1 -0
- package/dist/debug/runtime/phases/phase.types.js +8 -0
- package/dist/debug/runtime/reactivity/PathHandle.cjs +1 -0
- package/dist/debug/runtime/reactivity/PathHandle.js +175 -0
- package/dist/debug/runtime/reactivity/RaphMetaSource.cjs +1 -0
- package/dist/debug/runtime/reactivity/RaphMetaSource.js +112 -0
- package/dist/debug/runtime/reactivity/RaphWorkGraph.cjs +1 -0
- package/dist/debug/runtime/reactivity/RaphWorkGraph.js +995 -0
- package/dist/debug/runtime/reactivity/RuntimeReactivity.cjs +1 -0
- package/dist/debug/runtime/reactivity/RuntimeReactivity.js +156 -0
- package/dist/debug/runtime/reactivity/RuntimeWatch.cjs +1 -0
- package/dist/debug/runtime/reactivity/RuntimeWatch.js +88 -0
- package/dist/debug/runtime/reactivity/runtime-reactivity.types.cjs +1 -0
- package/dist/debug/runtime/reactivity/runtime-reactivity.types.js +1 -0
- package/dist/entrypoints/machine-testing.d.ts +2 -0
- package/dist/entrypoints/machine.d.ts +5 -0
- package/dist/entrypoints/path.d.ts +14 -0
- package/dist/entrypoints/reactivity.d.ts +1 -0
- package/dist/entrypoints/runtime.d.ts +17 -0
- package/dist/index.cjs +1 -0
- package/dist/index.js +48 -0
- package/dist/machine/compiler.d.ts +71 -0
- package/dist/machine/core.d.ts +50 -0
- package/dist/machine/persistence.d.ts +5 -0
- package/dist/machine/runtime.d.ts +4 -0
- package/dist/machine/testing.d.ts +43 -0
- package/dist/machine/types.d.ts +155 -0
- package/dist/machine-testing.cjs +1 -0
- package/dist/machine-testing.js +188 -0
- package/dist/machine.cjs +1 -0
- package/dist/machine.js +837 -0
- package/dist/main.d.ts +20 -0
- package/dist/path/DataPath.d.ts +73 -0
- package/dist/path/PathRouter.d.ts +21 -0
- package/dist/path/RaphKernel.d.ts +169 -0
- package/dist/path/data-path.types.d.ts +34 -0
- package/dist/path/data-path.utils.d.ts +9 -0
- package/dist/path/derived/DerivedRegistry.d.ts +67 -0
- package/dist/path/derived/RaphDerivedHandle.d.ts +97 -0
- package/dist/path/derived/derived-collection.types.d.ts +12 -0
- package/dist/path/derived/derived-collection.utils.d.ts +20 -0
- package/dist/path/derived/derived-strategy.types.d.ts +12 -0
- package/dist/path/derived/derived-strategy.utils.d.ts +4 -0
- package/dist/path/meta/MetaController.d.ts +85 -0
- package/dist/path/meta/RaphMeta.d.ts +45 -0
- package/dist/path/meta/RaphMetaStore.d.ts +45 -0
- package/dist/path/meta/meta.types.d.ts +31 -0
- package/dist/path/path.types.d.ts +27 -0
- package/dist/path/pathSegmentKey.d.ts +2 -0
- package/dist/path/storage/AdapterPathStore.d.ts +45 -0
- package/dist/path/storage/DefaultDataAdapter.d.ts +63 -0
- package/dist/path/storage/PathEventHub.d.ts +48 -0
- package/dist/path/storage/PathStore.d.ts +51 -0
- package/dist/path/storage/createDataDraft.d.ts +4 -0
- package/dist/path/storage/data-adapter.types.d.ts +17 -0
- package/dist/path.cjs +1 -0
- package/dist/path.js +18 -0
- package/dist/raph.cjs +1 -0
- package/dist/raph.js +48 -0
- package/dist/reactivity/engine.d.ts +393 -0
- package/dist/reactivity/reactive-object.d.ts +36 -0
- package/dist/reactivity/scope.d.ts +146 -0
- package/dist/reactivity/types.d.ts +175 -0
- package/dist/reactivity/watch.d.ts +15 -0
- package/dist/reactivity.cjs +1 -0
- package/dist/reactivity.js +14 -0
- package/dist/runtime/RaphRuntime.d.ts +225 -0
- package/dist/runtime/diagnostics/RaphDebug.d.ts +239 -0
- package/dist/runtime/errors.d.ts +21 -0
- package/dist/runtime/ownership/RaphEffectScope.d.ts +29 -0
- package/dist/runtime/ownership/RaphNode.d.ts +40 -0
- package/dist/runtime/ownership/RaphScope.d.ts +38 -0
- package/dist/runtime/ownership/parent-graph.types.d.ts +4 -0
- package/dist/runtime/ownership/parentGraph.d.ts +3 -0
- package/dist/runtime/ownership/throwDisposalErrors.d.ts +1 -0
- package/dist/runtime/phases/RaphFrameLoop.d.ts +51 -0
- package/dist/runtime/phases/RaphPhasePipeline.d.ts +79 -0
- package/dist/runtime/phases/orderPhaseTasks.d.ts +6 -0
- package/dist/runtime/phases/phase.types.d.ts +92 -0
- package/dist/runtime/reactivity/PathHandle.d.ts +80 -0
- package/dist/runtime/reactivity/RaphMetaSource.d.ts +32 -0
- package/dist/runtime/reactivity/RaphWorkGraph.d.ts +171 -0
- package/dist/runtime/reactivity/RuntimeReactivity.d.ts +45 -0
- package/dist/runtime/reactivity/RuntimeWatch.d.ts +34 -0
- package/dist/runtime/reactivity/runtime-reactivity.types.d.ts +11 -0
- package/dist/runtime.cjs +1 -0
- package/dist/runtime.js +23 -0
- package/package.json +141 -0
|
@@ -0,0 +1,687 @@
|
|
|
1
|
+
var F = Object.defineProperty;
|
|
2
|
+
var O = (_, e, t) => e in _ ? F(_, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : _[e] = t;
|
|
3
|
+
var y = (_, e, t) => O(_, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { parseDataPath as w } from "./data-path.utils.js";
|
|
5
|
+
import { DataPath as T } from "./DataPath.js";
|
|
6
|
+
import { validateFullFilter as S, cloneMaterializedValue as C, validateFullCollection as W, collectionIndex as k, collectionError as b, indexesAreStale as z, validateIncrementalCollection as B, collectionKeys as x, keyedPath as A, filterError as P, validateIncrementalFilter as K } from "./derived/derived-collection.utils.js";
|
|
7
|
+
import { DerivedRegistry as q } from "./derived/DerivedRegistry.js";
|
|
8
|
+
import { RaphDerivedHandle as N, RaphDerivedTargetWriteError as $ } from "./derived/RaphDerivedHandle.js";
|
|
9
|
+
import { MetaController as j } from "./meta/MetaController.js";
|
|
10
|
+
import { AdapterPathStore as R } from "./storage/AdapterPathStore.js";
|
|
11
|
+
import { DefaultDataAdapter as L } from "./storage/DefaultDataAdapter.js";
|
|
12
|
+
import { PathStore as H } from "./storage/PathStore.js";
|
|
13
|
+
const M = class M {
|
|
14
|
+
/**
|
|
15
|
+
* Создаёт data/meta owner с независимым lifecycle и derived registry.
|
|
16
|
+
*/
|
|
17
|
+
constructor(e = {}) {
|
|
18
|
+
// Публикует стабильную identity data/meta owner.
|
|
19
|
+
y(this, "id");
|
|
20
|
+
// Лениво создают независимые data, derived, runtime и metadata controllers.
|
|
21
|
+
y(this, "_paths");
|
|
22
|
+
y(this, "_derivedController");
|
|
23
|
+
y(this, "_runtimes");
|
|
24
|
+
y(this, "_metaController");
|
|
25
|
+
// Защищают batch stabilization и записи в derived targets.
|
|
26
|
+
y(this, "_batchDepth", 0);
|
|
27
|
+
y(this, "_runtimeMutationDepth", 0);
|
|
28
|
+
y(this, "_stabilizing", !1);
|
|
29
|
+
y(this, "_derivedWriteDepth", 0);
|
|
30
|
+
if (this.id = e.id ?? `kernel-${M._kernelCounter++}`, e.adapter !== void 0) {
|
|
31
|
+
if (e.initial !== void 0 || e.adapterOptions !== void 0)
|
|
32
|
+
throw new TypeError("[Raph] A custom adapter cannot be combined with initial or adapterOptions.");
|
|
33
|
+
this._paths = new R(e.adapter);
|
|
34
|
+
} else if (e.adapterOptions !== void 0)
|
|
35
|
+
this._paths = new R(new L(
|
|
36
|
+
e.initial,
|
|
37
|
+
e.adapterOptions
|
|
38
|
+
));
|
|
39
|
+
else {
|
|
40
|
+
const t = this._paths = new H();
|
|
41
|
+
e.initial !== void 0 && t.set("", e.initial);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Показывает, освобождён ли Kernel.
|
|
46
|
+
*/
|
|
47
|
+
get disposed() {
|
|
48
|
+
return this._paths === void 0;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Формирует диагностический снимок materialized derived registry.
|
|
52
|
+
*/
|
|
53
|
+
getDerivedSnapshot() {
|
|
54
|
+
var t;
|
|
55
|
+
const e = this._derivedController;
|
|
56
|
+
return {
|
|
57
|
+
registrations: (e == null ? void 0 : e.size) ?? 0,
|
|
58
|
+
errors: [...(e == null ? void 0 : e.values()) ?? []].filter((r) => r.status === "error").length,
|
|
59
|
+
pending: ((t = e == null ? void 0 : e.pending) == null ? void 0 : t.size) ?? 0,
|
|
60
|
+
stabilizing: this._stabilizing
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Возвращает лениво созданный metadata facade.
|
|
65
|
+
*/
|
|
66
|
+
get meta() {
|
|
67
|
+
return this._metadata.facade;
|
|
68
|
+
}
|
|
69
|
+
get(e, t) {
|
|
70
|
+
return this._store.get(e ?? "", t);
|
|
71
|
+
}
|
|
72
|
+
peek(e, t) {
|
|
73
|
+
return this._store.peek(e ?? "", t);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Проверяет наличие значения по указанному пути.
|
|
77
|
+
*/
|
|
78
|
+
has(e, t) {
|
|
79
|
+
return this._store.has(e, t);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Записывает значение и публикует соответствующее изменение.
|
|
83
|
+
*/
|
|
84
|
+
set(e, t, r) {
|
|
85
|
+
var s;
|
|
86
|
+
if (this._runtimeMutationDepth === 0 && this._runtimes !== void 0) {
|
|
87
|
+
this._withAttachedRuntimeBoundary(() => this.set(e, t, r));
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
this._assertWritablePath("set", e, t, r);
|
|
91
|
+
const i = this._store;
|
|
92
|
+
if ((((s = this._metaController) == null ? void 0 : s.size) ?? 0) === 0) {
|
|
93
|
+
if (this._derivedController === void 0) {
|
|
94
|
+
i.set(e, t, r);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
this._mutateDerived(i, "set", e, t, r);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
this._mutateWithMetaLifecycle(() => {
|
|
101
|
+
this._derivedController === void 0 ? i.set(e, t, r) : this._mutateDerived(i, "set", e, t, r), this._pruneMissingMetaOwners(e, "owner-replaced", r);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Объединяет значение по пути и публикует соответствующее изменение.
|
|
106
|
+
*/
|
|
107
|
+
merge(e, t, r) {
|
|
108
|
+
var s;
|
|
109
|
+
if (this._runtimeMutationDepth === 0 && this._runtimes !== void 0) {
|
|
110
|
+
this._withAttachedRuntimeBoundary(() => this.merge(e, t, r));
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
this._assertWritablePath("merge", e, t, r);
|
|
114
|
+
const i = this._store;
|
|
115
|
+
if ((((s = this._metaController) == null ? void 0 : s.size) ?? 0) === 0) {
|
|
116
|
+
if (this._derivedController === void 0) {
|
|
117
|
+
i.merge(e, t, r);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
this._mutateDerived(i, "merge", e, t, r);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
this._mutateWithMetaLifecycle(() => {
|
|
124
|
+
this._derivedController === void 0 ? i.merge(e, t, r) : this._mutateDerived(i, "merge", e, t, r), this._pruneMissingMetaOwners(e, "owner-replaced", r);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Удаляет значение по пути и публикует изменение при наличии данных.
|
|
129
|
+
*/
|
|
130
|
+
delete(e, t) {
|
|
131
|
+
var i;
|
|
132
|
+
if (this._runtimeMutationDepth === 0 && this._runtimes !== void 0) {
|
|
133
|
+
this._withAttachedRuntimeBoundary(() => this.delete(e, t));
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
this._assertWritablePath("delete", e, void 0, t);
|
|
137
|
+
const r = this._store;
|
|
138
|
+
if ((((i = this._metaController) == null ? void 0 : i.size) ?? 0) === 0) {
|
|
139
|
+
if (this._derivedController === void 0) {
|
|
140
|
+
r.delete(e, t);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
this._mutateDerived(r, "delete", e, void 0, t);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
r.has(e, t) && this._mutateWithMetaLifecycle(() => {
|
|
147
|
+
this._derivedController === void 0 ? r.delete(e, t) : this._mutateDerived(r, "delete", e, void 0, t);
|
|
148
|
+
const s = this._metaPath(e, t);
|
|
149
|
+
this._metaController.deleteSubtree(s, "owner-delete"), this._pruneMissingMetaOwners(s, "owner-delete");
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Выполняет операцию в общей синхронной batch boundary.
|
|
154
|
+
*/
|
|
155
|
+
batch(e) {
|
|
156
|
+
var o;
|
|
157
|
+
if (this._runtimeMutationDepth === 0 && this._runtimes !== void 0)
|
|
158
|
+
return this._withAttachedRuntimeBoundary(() => this.batch(e));
|
|
159
|
+
const t = this._store;
|
|
160
|
+
if (this._derivedController === void 0 && !((o = this._metaController) != null && o.hasWatchers))
|
|
161
|
+
return t.batch(e);
|
|
162
|
+
let r, i, s = !1;
|
|
163
|
+
try {
|
|
164
|
+
r = t.batch(() => this._runDerivedBatch(e));
|
|
165
|
+
} catch (h) {
|
|
166
|
+
s = !0, i = h;
|
|
167
|
+
}
|
|
168
|
+
if (s)
|
|
169
|
+
throw i;
|
|
170
|
+
return r;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Подписывает callback на подходящие изменения и возвращает disposer.
|
|
174
|
+
*/
|
|
175
|
+
watch(e, t) {
|
|
176
|
+
return this._store.watch(e, t);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Возвращает metadata указанного data-owner.
|
|
180
|
+
*/
|
|
181
|
+
getMeta(e, t, r) {
|
|
182
|
+
var i;
|
|
183
|
+
return this._store, t !== void 0 && this._assertMetaNamespace(t), (i = this._metaController) == null ? void 0 : i.get(this._metaPath(e, r), t);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Проверяет наличие metadata у указанного data-owner.
|
|
187
|
+
*/
|
|
188
|
+
hasMeta(e, t, r) {
|
|
189
|
+
var i;
|
|
190
|
+
return this._store, t !== void 0 && this._assertMetaNamespace(t), ((i = this._metaController) == null ? void 0 : i.has(this._metaPath(e, r), t)) ?? !1;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Записывает metadata указанного data-owner.
|
|
194
|
+
*/
|
|
195
|
+
setMeta(e, t, r, i) {
|
|
196
|
+
if (this._runtimeMutationDepth === 0 && this._runtimes !== void 0) {
|
|
197
|
+
this._withAttachedRuntimeBoundary(() => this.setMeta(e, t, r, i));
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
this._assertMetaNamespace(t);
|
|
201
|
+
const s = this._exactMetaPath(e, i);
|
|
202
|
+
this._assertMetaOwner(s), this._metadata.set(s, t, r, i);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Объединяет metadata указанного data-owner.
|
|
206
|
+
*/
|
|
207
|
+
mergeMeta(e, t, r, i) {
|
|
208
|
+
if (this._runtimeMutationDepth === 0 && this._runtimes !== void 0) {
|
|
209
|
+
this._withAttachedRuntimeBoundary(() => this.mergeMeta(e, t, r, i));
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
this._assertMetaNamespace(t);
|
|
213
|
+
const s = this._exactMetaPath(e, i);
|
|
214
|
+
this._assertMetaOwner(s), this._metadata.merge(s, t, r, i);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Удаляет metadata указанного data-owner.
|
|
218
|
+
*/
|
|
219
|
+
deleteMeta(e, t, r) {
|
|
220
|
+
var s;
|
|
221
|
+
if (this._runtimeMutationDepth === 0 && this._runtimes !== void 0) {
|
|
222
|
+
this._withAttachedRuntimeBoundary(() => this.deleteMeta(e, t, r));
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
t !== void 0 && this._assertMetaNamespace(t);
|
|
226
|
+
const i = this._exactMetaPath(e, r);
|
|
227
|
+
(s = this._metaController) == null || s.delete(i, t, r);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Подписывает runtime adapter на metadata-события Kernel.
|
|
231
|
+
* @internal
|
|
232
|
+
*/
|
|
233
|
+
_watchMeta(e, t, r = {}, i) {
|
|
234
|
+
return this._store, r.namespace !== void 0 && this._assertMetaNamespace(r.namespace), this._metadata.watch(e, t, r, i);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Создаёт управляемое derived-представление source path в target path.
|
|
238
|
+
*/
|
|
239
|
+
derive(e) {
|
|
240
|
+
var d, u, m;
|
|
241
|
+
if (this._store, e.strategy !== void 0 && e.strategy.kind !== "full" && e.strategy.kind !== "collection-by-key" && e.strategy.kind !== "filter-by-key")
|
|
242
|
+
throw new Error(`[Raph] Unsupported derived strategy "${String(e.strategy.kind)}".`);
|
|
243
|
+
if (e.id !== void 0 && ((d = this._derivedController) != null && d.has(e.id)))
|
|
244
|
+
throw new Error(`[Raph] Duplicate derived id "${e.id}".`);
|
|
245
|
+
const t = w(e.from), r = w(e.to);
|
|
246
|
+
if (E(t, r))
|
|
247
|
+
throw new Error("[Raph] Derived source and target must not overlap.");
|
|
248
|
+
const i = this._derivedController ?? new q(), s = e.id ?? i.nextId(), o = {
|
|
249
|
+
...e,
|
|
250
|
+
from: t.canonical,
|
|
251
|
+
to: r.canonical
|
|
252
|
+
}, h = new N(this, s, o), l = ((u = e.strategy) == null ? void 0 : u.kind) === "collection-by-key" || ((m = e.strategy) == null ? void 0 : m.kind) === "filter-by-key" ? e.strategy : void 0;
|
|
253
|
+
this._derivedController = i, i.register(h, t, l);
|
|
254
|
+
try {
|
|
255
|
+
e.immediate !== !1 && h.recompute();
|
|
256
|
+
} catch (a) {
|
|
257
|
+
throw this._removeDerived(h), h._disposeFromKernel(), a;
|
|
258
|
+
}
|
|
259
|
+
return h;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Регистрирует runtime, разделяющий этот Kernel.
|
|
263
|
+
* @internal
|
|
264
|
+
*/
|
|
265
|
+
_attachRuntime(e) {
|
|
266
|
+
this._store, (this._runtimes ?? (this._runtimes = /* @__PURE__ */ new Set())).add(e);
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Удаляет runtime из shared Kernel registry.
|
|
270
|
+
* @internal
|
|
271
|
+
*/
|
|
272
|
+
_detachRuntime(e) {
|
|
273
|
+
const t = this._runtimes;
|
|
274
|
+
t !== void 0 && (t.delete(e), t.size === 0 && (this._runtimes = void 0));
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Освобождает shared runtimes, derived handles и data/meta state Kernel.
|
|
278
|
+
*/
|
|
279
|
+
dispose() {
|
|
280
|
+
var t, r;
|
|
281
|
+
if (this._paths === void 0)
|
|
282
|
+
return;
|
|
283
|
+
const e = [];
|
|
284
|
+
if (this._runtimes !== void 0)
|
|
285
|
+
for (const i of [...this._runtimes])
|
|
286
|
+
try {
|
|
287
|
+
i.dispose();
|
|
288
|
+
} catch (s) {
|
|
289
|
+
e.push(s);
|
|
290
|
+
}
|
|
291
|
+
if (this._runtimes = void 0, (t = this._derivedController) == null || t.dispose(), this._derivedController = void 0, (r = this._metaController) == null || r.dispose(), this._metaController = void 0, this._paths = void 0, e.length === 1)
|
|
292
|
+
throw e[0];
|
|
293
|
+
if (e.length > 1)
|
|
294
|
+
throw new AggregateError(e, `[Raph] Kernel "${this.id}" disposal failed.`);
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Пересчитывает указанный derived handle через его стратегию.
|
|
298
|
+
* @internal
|
|
299
|
+
*/
|
|
300
|
+
_recomputeDerived(e) {
|
|
301
|
+
if (!(e.paused || e.disposed))
|
|
302
|
+
try {
|
|
303
|
+
this._recomputeDerivedFull(e), e._recordSuccess();
|
|
304
|
+
} catch (t) {
|
|
305
|
+
throw e._recordFailure(t), t;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Удаляет derived handle из registry и освобождает его routes.
|
|
310
|
+
* @internal
|
|
311
|
+
*/
|
|
312
|
+
_removeDerived(e) {
|
|
313
|
+
const t = this._derivedController;
|
|
314
|
+
t !== void 0 && (t.remove(e), t.size === 0 && (this._derivedController = void 0));
|
|
315
|
+
}
|
|
316
|
+
get _store() {
|
|
317
|
+
const e = this._paths;
|
|
318
|
+
if (e !== void 0)
|
|
319
|
+
return e;
|
|
320
|
+
throw new Error(`[Raph] Kernel "${this.id}" is disposed.`);
|
|
321
|
+
}
|
|
322
|
+
get _metadata() {
|
|
323
|
+
return this._store, this._metaController ?? (this._metaController = new j(
|
|
324
|
+
this,
|
|
325
|
+
(e) => this.has(e),
|
|
326
|
+
() => this._batchDepth !== 0 || this._stabilizing
|
|
327
|
+
));
|
|
328
|
+
}
|
|
329
|
+
/** Keeps every attached Runtime quiescent until one Kernel publication completes. */
|
|
330
|
+
_withAttachedRuntimeBoundary(e) {
|
|
331
|
+
var h, l, d;
|
|
332
|
+
const t = this._runtimes === void 0 ? [] : [...this._runtimes];
|
|
333
|
+
if (t.length === 0)
|
|
334
|
+
return e();
|
|
335
|
+
const r = [], i = [];
|
|
336
|
+
let s, o = !1;
|
|
337
|
+
this._runtimeMutationDepth++;
|
|
338
|
+
try {
|
|
339
|
+
for (const u of t)
|
|
340
|
+
(h = u._beginKernelBatch) == null || h.call(u), r.push(u);
|
|
341
|
+
try {
|
|
342
|
+
s = e();
|
|
343
|
+
} catch (u) {
|
|
344
|
+
o = !0, i.push(u);
|
|
345
|
+
}
|
|
346
|
+
} catch (u) {
|
|
347
|
+
o = !0, i.push(u);
|
|
348
|
+
} finally {
|
|
349
|
+
this._runtimeMutationDepth--;
|
|
350
|
+
for (let u = r.length - 1; u >= 0; u--)
|
|
351
|
+
try {
|
|
352
|
+
(d = (l = r[u])._endKernelBatch) == null || d.call(l);
|
|
353
|
+
} catch (m) {
|
|
354
|
+
i.push(m);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
if (i.length === 1)
|
|
358
|
+
throw i[0];
|
|
359
|
+
if (i.length > 1)
|
|
360
|
+
throw new AggregateError(
|
|
361
|
+
i,
|
|
362
|
+
o ? "[Raph] Kernel mutation and Runtime publication failed." : "[Raph] Runtime publication failed after a Kernel mutation."
|
|
363
|
+
);
|
|
364
|
+
return s;
|
|
365
|
+
}
|
|
366
|
+
_assertWritablePath(e, t, r, i) {
|
|
367
|
+
const s = this._derivedController;
|
|
368
|
+
if (s === void 0 || this._derivedWriteDepth !== 0)
|
|
369
|
+
return;
|
|
370
|
+
const o = w(t, i);
|
|
371
|
+
for (const h of s.values()) {
|
|
372
|
+
const l = w(h.options.to);
|
|
373
|
+
if (!E(o, l))
|
|
374
|
+
continue;
|
|
375
|
+
const d = o.segments.length < l.segments.length;
|
|
376
|
+
if (!(e === "merge" && d && !U(r, l.segments[o.segments.length])))
|
|
377
|
+
throw new $(o.canonical);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
_writeDerivedTarget(e, t) {
|
|
381
|
+
this._derivedWriteDepth++;
|
|
382
|
+
try {
|
|
383
|
+
this.set(e, t);
|
|
384
|
+
} finally {
|
|
385
|
+
this._derivedWriteDepth--;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
_mutateDerived(e, t, r, i, s) {
|
|
389
|
+
const o = w(r, s);
|
|
390
|
+
t === "delete" && !e.has(r, s) || e.batch(() => {
|
|
391
|
+
t === "set" ? e.set(r, i, s) : t === "merge" ? e.merge(r, i, s) : e.delete(r, s), this._queueDerived(o), this._batchDepth === 0 && !this._stabilizing && this._stabilizeDerived();
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
_runDerivedBatch(e) {
|
|
395
|
+
var u;
|
|
396
|
+
let t = !1, r, i = !1, s, o = !1, h, l;
|
|
397
|
+
this._batchDepth++;
|
|
398
|
+
try {
|
|
399
|
+
l = e();
|
|
400
|
+
} catch (m) {
|
|
401
|
+
t = !0, r = m;
|
|
402
|
+
} finally {
|
|
403
|
+
if (this._batchDepth--, this._batchDepth === 0) {
|
|
404
|
+
if (!this._stabilizing)
|
|
405
|
+
try {
|
|
406
|
+
this._stabilizeDerived();
|
|
407
|
+
} catch (m) {
|
|
408
|
+
i = !0, s = m;
|
|
409
|
+
}
|
|
410
|
+
try {
|
|
411
|
+
(u = this._metaController) == null || u.publish();
|
|
412
|
+
} catch (m) {
|
|
413
|
+
o = !0, h = m;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
const d = [];
|
|
418
|
+
if (t && d.push(r), i && d.push(s), o && d.push(h), d.length > 1)
|
|
419
|
+
throw new AggregateError(
|
|
420
|
+
d,
|
|
421
|
+
"[Raph] Kernel batch publication failed."
|
|
422
|
+
);
|
|
423
|
+
if (d.length === 1)
|
|
424
|
+
throw d[0];
|
|
425
|
+
return l;
|
|
426
|
+
}
|
|
427
|
+
_mutateWithMetaLifecycle(e) {
|
|
428
|
+
if (this._batchDepth !== 0 || this._stabilizing) {
|
|
429
|
+
e();
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
this.batch(e);
|
|
433
|
+
}
|
|
434
|
+
_pruneMissingMetaOwners(e, t, r) {
|
|
435
|
+
var i;
|
|
436
|
+
(i = this._metaController) == null || i.pruneMissing(this._metaPath(e, r), t);
|
|
437
|
+
}
|
|
438
|
+
_metaPath(e, t) {
|
|
439
|
+
return T.from(e, t);
|
|
440
|
+
}
|
|
441
|
+
_exactMetaPath(e, t) {
|
|
442
|
+
const r = this._metaPath(e, t);
|
|
443
|
+
if (r.segments().some((i) => i.kind === "wildcard"))
|
|
444
|
+
throw new Error("[RaphMeta] wildcard paths are read-only observation masks.");
|
|
445
|
+
return r;
|
|
446
|
+
}
|
|
447
|
+
_assertMetaNamespace(e) {
|
|
448
|
+
if (this._store, !e.trim())
|
|
449
|
+
throw new Error("[RaphMeta] namespace must not be empty.");
|
|
450
|
+
}
|
|
451
|
+
_assertMetaOwner(e) {
|
|
452
|
+
if (!this.has(e))
|
|
453
|
+
throw new Error(`[RaphMeta] Owner data path does not exist: "${e}".`);
|
|
454
|
+
}
|
|
455
|
+
_queueDerived(e) {
|
|
456
|
+
var t;
|
|
457
|
+
(t = this._derivedController) == null || t.queue(e);
|
|
458
|
+
}
|
|
459
|
+
_queueDerivedReplacement(e, t) {
|
|
460
|
+
var r;
|
|
461
|
+
(r = this._derivedController) == null || r.queueReplacement(e, t);
|
|
462
|
+
}
|
|
463
|
+
_replaceDerivedTarget(e, t, r) {
|
|
464
|
+
const i = w(e);
|
|
465
|
+
this._store.set(i.canonical, t), this._queueDerivedReplacement(i, r);
|
|
466
|
+
}
|
|
467
|
+
_stabilizeDerived() {
|
|
468
|
+
const e = this._derivedController, t = e == null ? void 0 : e.pending;
|
|
469
|
+
if (t === void 0 || t.size === 0)
|
|
470
|
+
return;
|
|
471
|
+
this._stabilizing = !0;
|
|
472
|
+
let r = 0;
|
|
473
|
+
try {
|
|
474
|
+
for (; t.size !== 0; ) {
|
|
475
|
+
const i = t.values().next().value;
|
|
476
|
+
if (t.delete(i), !(i.paused || i.disposed)) {
|
|
477
|
+
try {
|
|
478
|
+
this._recomputePendingDerived(i), i._recordSuccess();
|
|
479
|
+
} catch (s) {
|
|
480
|
+
throw i._recordFailure(s), s;
|
|
481
|
+
}
|
|
482
|
+
if (++r > 1e4)
|
|
483
|
+
throw new Error("[Raph] Derived stabilization exceeded 10000 recomputations.");
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
} catch (i) {
|
|
487
|
+
throw t.clear(), i;
|
|
488
|
+
} finally {
|
|
489
|
+
this._stabilizing = !1, e == null || e.clearPendingIfEmpty();
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
_recomputePendingDerived(e) {
|
|
493
|
+
var r;
|
|
494
|
+
const t = (r = this._derivedController) == null ? void 0 : r.state(e);
|
|
495
|
+
if (t === void 0 || !t.initialized || t.full) {
|
|
496
|
+
this._recomputeDerivedFull(e);
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
t.kind === "filter-by-key" ? this._recomputeDerivedFilter(e, t) : this._recomputeDerivedCollection(e, t);
|
|
500
|
+
}
|
|
501
|
+
_recomputeDerivedFull(e) {
|
|
502
|
+
var l;
|
|
503
|
+
const t = (l = this._derivedController) == null ? void 0 : l.state(e);
|
|
504
|
+
t !== void 0 && (t.full = !0);
|
|
505
|
+
const r = this.get(e.options.from), i = e.options.compute(r);
|
|
506
|
+
let s = i, o, h;
|
|
507
|
+
t !== void 0 && (r === void 0 && (i === void 0 || Array.isArray(i) && i.length === 0) ? (o = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map()) : (t.kind === "filter-by-key" ? (S(e.id, t.key, r, i), s = C(i)) : W(e.id, t.key, r, i), o = k(r, t.key, "source"), h = k(s, t.key, "output"))), this._writeDerivedTarget(e.options.to, s), t !== void 0 && (t.sourceIndex = o, t.targetIndex = h, t.initialized = !0, t.full = !1, t.keys.clear());
|
|
508
|
+
}
|
|
509
|
+
_recomputeDerivedCollection(e, t) {
|
|
510
|
+
t.full = !0;
|
|
511
|
+
const r = this.get(e.options.from), i = this.get(e.options.to);
|
|
512
|
+
if (!Array.isArray(r) || !Array.isArray(i))
|
|
513
|
+
throw b(e.id, "requires array source and target");
|
|
514
|
+
(t.sourceIndex === void 0 || z(r, t.key, t.sourceIndex, t.keys)) && (t.sourceIndex = k(r, t.key, "source"));
|
|
515
|
+
const s = t.targetIndex;
|
|
516
|
+
if (s === void 0)
|
|
517
|
+
throw b(e.id, "has no materialized target index");
|
|
518
|
+
const o = [], h = [];
|
|
519
|
+
for (const a of t.keys) {
|
|
520
|
+
const g = t.sourceIndex.get(a);
|
|
521
|
+
g === void 0 ? h.push(a) : o.push({ key: a, index: g, item: r[g] });
|
|
522
|
+
}
|
|
523
|
+
o.sort((a, g) => a.index - g.index);
|
|
524
|
+
const l = o.map((a) => a.item), d = l.length === 0 ? [] : e.options.compute(l);
|
|
525
|
+
B(
|
|
526
|
+
e.id,
|
|
527
|
+
t.key,
|
|
528
|
+
o.map((a) => a.key),
|
|
529
|
+
d
|
|
530
|
+
);
|
|
531
|
+
const u = d;
|
|
532
|
+
if (h.length !== 0 || o.some((a) => !s.has(a.key))) {
|
|
533
|
+
const a = /* @__PURE__ */ new Map();
|
|
534
|
+
for (let f = 0; f < o.length; f++)
|
|
535
|
+
a.set(o[f].key, u[f]);
|
|
536
|
+
const g = /* @__PURE__ */ new Map();
|
|
537
|
+
for (const [f, v] of s)
|
|
538
|
+
g.set(f, i[v]);
|
|
539
|
+
const n = x(r, t.key, "source"), c = [];
|
|
540
|
+
c.length = n.length;
|
|
541
|
+
for (let f = 0; f < n.length; f++) {
|
|
542
|
+
const v = n[f];
|
|
543
|
+
if (v === void 0)
|
|
544
|
+
continue;
|
|
545
|
+
const D = a.has(v) ? a.get(v) : g.get(v);
|
|
546
|
+
if (D === void 0)
|
|
547
|
+
throw b(e.id, `is missing target item for key "${String(v)}"`);
|
|
548
|
+
c[f] = D;
|
|
549
|
+
}
|
|
550
|
+
const p = k(c, t.key, "target");
|
|
551
|
+
this._replaceDerivedTarget(e.options.to, c, t.keys), t.targetIndex = p;
|
|
552
|
+
} else
|
|
553
|
+
for (let a = 0; a < o.length; a++)
|
|
554
|
+
this._writeDerivedTarget(
|
|
555
|
+
A(e.options.to, t.key, o[a].key),
|
|
556
|
+
u[a]
|
|
557
|
+
);
|
|
558
|
+
t.keys.clear(), t.full = !1;
|
|
559
|
+
}
|
|
560
|
+
_recomputeDerivedFilter(e, t) {
|
|
561
|
+
t.full = !0;
|
|
562
|
+
const r = this.get(e.options.from), i = this.get(e.options.to);
|
|
563
|
+
if (!Array.isArray(r) || !Array.isArray(i))
|
|
564
|
+
throw P(e.id, "requires array source and target");
|
|
565
|
+
(t.sourceIndex === void 0 || z(r, t.key, t.sourceIndex, t.keys)) && (t.sourceIndex = k(r, t.key, "source"));
|
|
566
|
+
const s = t.targetIndex;
|
|
567
|
+
if (s === void 0)
|
|
568
|
+
throw P(e.id, "has no materialized target index");
|
|
569
|
+
const o = [];
|
|
570
|
+
for (const n of t.keys) {
|
|
571
|
+
const c = t.sourceIndex.get(n);
|
|
572
|
+
c !== void 0 && o.push({ key: n, index: c, item: r[c] });
|
|
573
|
+
}
|
|
574
|
+
o.sort((n, c) => n.index - c.index);
|
|
575
|
+
const h = o.map((n) => n.item), l = h.length === 0 ? [] : e.options.compute(h);
|
|
576
|
+
K(
|
|
577
|
+
e.id,
|
|
578
|
+
t.key,
|
|
579
|
+
o.map((n) => n.key),
|
|
580
|
+
l
|
|
581
|
+
);
|
|
582
|
+
const d = /* @__PURE__ */ new Map(), u = l, m = x(u, t.key, "output");
|
|
583
|
+
for (let n = 0; n < m.length; n++) {
|
|
584
|
+
const c = m[n];
|
|
585
|
+
c !== void 0 && d.set(c, C(u[n]));
|
|
586
|
+
}
|
|
587
|
+
const a = /* @__PURE__ */ new Set();
|
|
588
|
+
let g = !1;
|
|
589
|
+
for (const n of t.keys) {
|
|
590
|
+
const c = s.has(n), p = d.has(n);
|
|
591
|
+
!c && !p || (a.add(n), c !== p && (g = !0));
|
|
592
|
+
}
|
|
593
|
+
if (g && t.keys.size === 1 && i.length === s.size && this._patchSingleFilterMembership(
|
|
594
|
+
e,
|
|
595
|
+
t,
|
|
596
|
+
i,
|
|
597
|
+
s,
|
|
598
|
+
d,
|
|
599
|
+
a
|
|
600
|
+
)) {
|
|
601
|
+
t.keys.clear(), t.full = !1;
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
if (g) {
|
|
605
|
+
const n = /* @__PURE__ */ new Map();
|
|
606
|
+
for (const [f, v] of s)
|
|
607
|
+
n.set(f, i[v]);
|
|
608
|
+
const c = [];
|
|
609
|
+
for (const f of x(r, t.key, "source"))
|
|
610
|
+
if (f !== void 0) {
|
|
611
|
+
if (t.keys.has(f)) {
|
|
612
|
+
d.has(f) && c.push(d.get(f));
|
|
613
|
+
continue;
|
|
614
|
+
}
|
|
615
|
+
n.has(f) && c.push(n.get(f));
|
|
616
|
+
}
|
|
617
|
+
const p = k(c, t.key, "target");
|
|
618
|
+
this._replaceDerivedTarget(e.options.to, c, a), t.targetIndex = p;
|
|
619
|
+
} else
|
|
620
|
+
for (const [n, c] of d)
|
|
621
|
+
this._writeDerivedTarget(A(e.options.to, t.key, n), c);
|
|
622
|
+
t.keys.clear(), t.full = !1;
|
|
623
|
+
}
|
|
624
|
+
_patchSingleFilterMembership(e, t, r, i, s, o) {
|
|
625
|
+
const h = t.sourceIndex;
|
|
626
|
+
if (h === void 0)
|
|
627
|
+
return !1;
|
|
628
|
+
const l = t.keys.values().next().value;
|
|
629
|
+
if (l === void 0)
|
|
630
|
+
return !1;
|
|
631
|
+
const d = i.get(l), u = s.has(l);
|
|
632
|
+
if (d !== void 0 === u)
|
|
633
|
+
return !1;
|
|
634
|
+
const m = r.slice();
|
|
635
|
+
let a;
|
|
636
|
+
if (d !== void 0)
|
|
637
|
+
a = d, m.splice(a, 1);
|
|
638
|
+
else {
|
|
639
|
+
const g = h.get(l);
|
|
640
|
+
if (g === void 0)
|
|
641
|
+
return !1;
|
|
642
|
+
let n = 0, c = m.length;
|
|
643
|
+
for (; n < c; ) {
|
|
644
|
+
const p = n + c >>> 1, f = m[p];
|
|
645
|
+
if (typeof f != "object" || f === null || Array.isArray(f))
|
|
646
|
+
return !1;
|
|
647
|
+
const v = f[t.key];
|
|
648
|
+
if (typeof v != "string" && typeof v != "number")
|
|
649
|
+
return !1;
|
|
650
|
+
const D = h.get(v);
|
|
651
|
+
if (D === void 0)
|
|
652
|
+
return !1;
|
|
653
|
+
D < g ? n = p + 1 : c = p;
|
|
654
|
+
}
|
|
655
|
+
a = n, m.splice(a, 0, s.get(l));
|
|
656
|
+
}
|
|
657
|
+
if (this._replaceDerivedTarget(e.options.to, m, o), d !== void 0) {
|
|
658
|
+
i.delete(l);
|
|
659
|
+
for (const [g, n] of i)
|
|
660
|
+
n > a && i.set(g, n - 1);
|
|
661
|
+
} else {
|
|
662
|
+
for (const [g, n] of i)
|
|
663
|
+
n >= a && i.set(g, n + 1);
|
|
664
|
+
i.set(l, a);
|
|
665
|
+
}
|
|
666
|
+
return !0;
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
// Формирует локальный id для Kernel без явно заданного имени.
|
|
670
|
+
y(M, "_kernelCounter", 0);
|
|
671
|
+
let I = M;
|
|
672
|
+
function E(_, e) {
|
|
673
|
+
const t = Math.min(_.segments.length, e.segments.length);
|
|
674
|
+
for (let r = 0; r < t; r++)
|
|
675
|
+
if (!V(_.segments[r], e.segments[r]))
|
|
676
|
+
return !1;
|
|
677
|
+
return !0;
|
|
678
|
+
}
|
|
679
|
+
function U(_, e) {
|
|
680
|
+
return typeof _ != "object" || _ === null || Array.isArray(_) || e.kind !== "key" ? !0 : Object.hasOwn(_, e.key);
|
|
681
|
+
}
|
|
682
|
+
function V(_, e) {
|
|
683
|
+
return _.kind !== e.kind ? !1 : _.kind === "key" && e.kind === "key" ? _.key === e.key : _.kind === "index" && e.kind === "index" ? _.index === e.index : _.kind === "selector" && e.kind === "selector" && _.key === e.key && Object.is(_.value, e.value);
|
|
684
|
+
}
|
|
685
|
+
export {
|
|
686
|
+
I as RaphKernel
|
|
687
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./DataPath.cjs"),f=2e4;let n,s;function u(e,t){if(!(t!=null&&t.vars)){const r=n==null?void 0:n.get(e);if(r!==void 0)return r}if(typeof e!="string")return g(e,t);const a=c.DataPath._parseExactString(e,t);if(!(t!=null&&t.vars)){const r=n??(n=new Map);r.size>=f&&r.clear(),r.set(e,a)}return a}function i(e){const t=s==null?void 0:s.get(e);if(t!==void 0)return t;if(typeof e!="string")return h(e);const a=c.DataPath._parseMaskString(e),r=s??(s=new Map);return r.size>=f&&r.clear(),r.set(e,a),a}function l(e){if(e.segments.length===0)return["*"];const t=[`${e.canonical}.*`];for(let a=1;a<e.segments.length;a++)t.push(c.DataPath._renderSegments(e.segments.slice(0,a)));return t}function g(e,t){const a=c.DataPath.from(e,t)._asExact();if(e instanceof c.DataPath&&!(t!=null&&t.vars)){const r=n??(n=new Map);r.size>=f&&r.clear(),r.set(e,a)}return a}function h(e){const t=c.DataPath.from(e)._asMask();if(e instanceof c.DataPath){const a=s??(s=new Map);a.size>=f&&a.clear(),a.set(e,t)}return t}exports.parseDataPath=u;exports.parsePathMask=i;exports.pathRelationMasks=l;
|