@milaboratories/pl-tree 1.3.17 → 1.3.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/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +328 -286
- package/dist/index.mjs.map +1 -1
- package/dist/sync.d.ts +14 -1
- package/dist/sync.d.ts.map +1 -1
- package/dist/synchronized_tree.d.ts +7 -1
- package/dist/synchronized_tree.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/sync.ts +92 -7
- package/src/synchronized_tree.test.ts +32 -12
- package/src/synchronized_tree.ts +37 -7
package/dist/index.mjs
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { resourceIdToString as
|
|
5
|
-
import { ChangeSource as
|
|
6
|
-
import { notEmpty as
|
|
7
|
-
import
|
|
8
|
-
import * as
|
|
9
|
-
function
|
|
10
|
-
if (
|
|
11
|
-
return
|
|
1
|
+
var J = Object.defineProperty;
|
|
2
|
+
var q = (n, e, t) => e in n ? J(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var d = (n, e, t) => q(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { resourceIdToString as C, resourceTypeToString as I, resourceTypesEqual as A, isNotNullResourceId as g, NullResourceId as S, isNullResourceId as V, stringifyWithResourceId as L, isTimeoutOrCancelError as M } from "@milaboratories/pl-client";
|
|
5
|
+
import { ChangeSource as m, PollingComputableHooks as z } from "@milaboratories/computable";
|
|
6
|
+
import { notEmpty as y, msToHumanReadable as B } from "@milaboratories/ts-helpers";
|
|
7
|
+
import H from "denque";
|
|
8
|
+
import * as j from "node:timers/promises";
|
|
9
|
+
function se(n, e) {
|
|
10
|
+
if (n !== void 0)
|
|
11
|
+
return P(n, e);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function P(n, e) {
|
|
14
14
|
const t = {};
|
|
15
|
-
return
|
|
15
|
+
return n.value !== void 0 && (t.value = e(n.value)), n.error !== void 0 && (t.error = e(n.error)), t;
|
|
16
16
|
}
|
|
17
|
-
class
|
|
17
|
+
class N extends Error {
|
|
18
18
|
constructor(e) {
|
|
19
19
|
super(e);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
return typeof
|
|
22
|
+
function ne(n) {
|
|
23
|
+
return typeof n == "object" && n !== null && n.__pl_tree_type_marker__ === "PlTreeEntry";
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
return typeof
|
|
25
|
+
function oe(n) {
|
|
26
|
+
return typeof n == "object" && n !== null && n.__pl_tree_type_marker__ === "PlTreeEntryAccessor";
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
return typeof
|
|
28
|
+
function ae(n) {
|
|
29
|
+
return typeof n == "object" && n !== null && n.__pl_tree_type_marker__ === "PlTreeNodeAccessor";
|
|
30
30
|
}
|
|
31
|
-
class
|
|
31
|
+
class R {
|
|
32
32
|
constructor(e, t) {
|
|
33
|
-
|
|
33
|
+
d(this, "__pl_tree_type_marker__", "PlTreeEntry");
|
|
34
34
|
this.accessorData = e, this.rid = t;
|
|
35
35
|
}
|
|
36
36
|
createAccessor(e, t) {
|
|
@@ -43,45 +43,45 @@ class k {
|
|
|
43
43
|
return this.toString();
|
|
44
44
|
}
|
|
45
45
|
toString() {
|
|
46
|
-
return `[ENTRY:${
|
|
46
|
+
return `[ENTRY:${C(this.rid)}]`;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
const
|
|
51
|
-
|
|
49
|
+
function W(n, e, t, r, s) {
|
|
50
|
+
const a = new Y(
|
|
51
|
+
n,
|
|
52
52
|
e,
|
|
53
53
|
e.get(t.ctx.watcher, r),
|
|
54
54
|
t
|
|
55
55
|
);
|
|
56
56
|
if (!s.ignoreError) {
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
throw new
|
|
60
|
-
`error encountered on resource ${
|
|
57
|
+
const o = a.getError();
|
|
58
|
+
if (o !== void 0)
|
|
59
|
+
throw new N(
|
|
60
|
+
`error encountered on resource ${C(a.id)} (${I(a.resourceType)}): ${o.getDataAsString()}`
|
|
61
61
|
);
|
|
62
62
|
}
|
|
63
|
-
if (s.assertResourceType !== void 0 && (Array.isArray(s.assertResourceType) ? s.assertResourceType.findIndex((
|
|
63
|
+
if (s.assertResourceType !== void 0 && (Array.isArray(s.assertResourceType) ? s.assertResourceType.findIndex((o) => A(o, a.resourceType)) === -1 : !A(s.assertResourceType, a.resourceType)))
|
|
64
64
|
throw new Error(
|
|
65
|
-
`wrong resource type ${
|
|
65
|
+
`wrong resource type ${I(a.resourceType)} but expected ${s.assertResourceType}`
|
|
66
66
|
);
|
|
67
|
-
return
|
|
67
|
+
return a;
|
|
68
68
|
}
|
|
69
69
|
class E {
|
|
70
70
|
constructor(e, t, r, s) {
|
|
71
|
-
|
|
71
|
+
d(this, "__pl_tree_type_marker__", "PlTreeEntryAccessor");
|
|
72
72
|
this.accessorData = e, this.tree = t, this.rid = r, this.instanceData = s;
|
|
73
73
|
}
|
|
74
74
|
node(e = {}) {
|
|
75
|
-
return this.instanceData.guard(), this.accessorData.hooks !== void 0 && this.instanceData.ctx.attacheHooks(this.accessorData.hooks),
|
|
75
|
+
return this.instanceData.guard(), this.accessorData.hooks !== void 0 && this.instanceData.ctx.attacheHooks(this.accessorData.hooks), W(this.accessorData, this.tree, this.instanceData, this.rid, e);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return
|
|
78
|
+
function ue(n, e) {
|
|
79
|
+
return n instanceof R ? e.accessor(n).node().resourceInfo : n;
|
|
80
80
|
}
|
|
81
|
-
class
|
|
81
|
+
class Y {
|
|
82
82
|
constructor(e, t, r, s) {
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
d(this, "__pl_tree_type_marker__", "PlTreeNodeAccessor");
|
|
84
|
+
d(this, "onUnstableLambda", (e) => {
|
|
85
85
|
this.instanceData.ctx.markUnstable(e);
|
|
86
86
|
});
|
|
87
87
|
this.accessorData = e, this.tree = t, this.resource = r, this.instanceData = s;
|
|
@@ -99,7 +99,7 @@ class M {
|
|
|
99
99
|
return { id: this.id, type: this.resourceType };
|
|
100
100
|
}
|
|
101
101
|
getResourceFromTree(e, t) {
|
|
102
|
-
return
|
|
102
|
+
return W(this.accessorData, this.tree, this.instanceData, e, t);
|
|
103
103
|
}
|
|
104
104
|
traverse(...e) {
|
|
105
105
|
return this.traverseWithCommon({}, ...e);
|
|
@@ -110,34 +110,34 @@ class M {
|
|
|
110
110
|
traverseWithCommon(e, ...t) {
|
|
111
111
|
const r = this.traverseOrErrorWithCommon(e, ...t);
|
|
112
112
|
if (r !== void 0) {
|
|
113
|
-
if (!r.ok) throw new
|
|
113
|
+
if (!r.ok) throw new N(r.error);
|
|
114
114
|
return r.value;
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
traverseOrErrorWithCommon(e, ...t) {
|
|
118
118
|
let r = this;
|
|
119
119
|
for (const s of t) {
|
|
120
|
-
const
|
|
120
|
+
const a = typeof s == "string" ? {
|
|
121
121
|
...e,
|
|
122
122
|
field: s
|
|
123
|
-
} : { ...e, ...s },
|
|
124
|
-
if (
|
|
123
|
+
} : { ...e, ...s }, o = r.getField(s);
|
|
124
|
+
if (o === void 0 || a.pureFieldErrorToUndefined && o.value === void 0 && o.error !== void 0)
|
|
125
125
|
return;
|
|
126
|
-
if ((!
|
|
126
|
+
if ((!a.ignoreError || o.value === void 0) && o.error !== void 0)
|
|
127
127
|
return {
|
|
128
128
|
ok: !1,
|
|
129
|
-
error: `error in field ${
|
|
129
|
+
error: `error in field ${a.field} of ${C(r.id)}: ${o.error.getDataAsString()}`
|
|
130
130
|
};
|
|
131
|
-
if (
|
|
132
|
-
if (
|
|
131
|
+
if (o.value === void 0) {
|
|
132
|
+
if (a.errorIfFieldNotSet)
|
|
133
133
|
return {
|
|
134
134
|
ok: !1,
|
|
135
|
-
error: `field have no assigned value ${
|
|
135
|
+
error: `field have no assigned value ${a.field} of ${C(r.id)}`
|
|
136
136
|
};
|
|
137
|
-
this.onUnstableLambda("unpopulated_field:" +
|
|
137
|
+
this.onUnstableLambda("unpopulated_field:" + a.field);
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
140
|
-
r =
|
|
140
|
+
r = o.value;
|
|
141
141
|
}
|
|
142
142
|
return { ok: !0, value: r };
|
|
143
143
|
}
|
|
@@ -145,7 +145,7 @@ class M {
|
|
|
145
145
|
this.instanceData.guard();
|
|
146
146
|
const t = typeof e == "string" ? { field: e } : e, r = this.resource.getField(this.instanceData.ctx.watcher, t, this.onUnstableLambda);
|
|
147
147
|
if (r !== void 0)
|
|
148
|
-
return
|
|
148
|
+
return P(r, (s) => this.getResourceFromTree(s, { ignoreError: !0 }));
|
|
149
149
|
}
|
|
150
150
|
getInputsLocked() {
|
|
151
151
|
this.instanceData.guard();
|
|
@@ -220,55 +220,55 @@ class M {
|
|
|
220
220
|
}
|
|
221
221
|
/** Can be passed to nested computable. */
|
|
222
222
|
persist() {
|
|
223
|
-
return new
|
|
223
|
+
return new R(this.accessorData, this.resource.id);
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
class
|
|
226
|
+
class D extends Error {
|
|
227
227
|
constructor(e) {
|
|
228
228
|
super(e);
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
class
|
|
231
|
+
class $ {
|
|
232
232
|
constructor(e, t, r, s) {
|
|
233
|
-
|
|
233
|
+
d(this, "change", new m());
|
|
234
234
|
this.type = e, this.value = t, this.error = r, this.resourceVersion = s;
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
-
const
|
|
238
|
-
class
|
|
237
|
+
const F = 0, x = new TextDecoder();
|
|
238
|
+
class G {
|
|
239
239
|
constructor(e, t) {
|
|
240
240
|
/** Tracks number of other resources referencing this resource. Used to perform garbage collection in tree patching procedure */
|
|
241
|
-
|
|
241
|
+
d(this, "refCount", 0);
|
|
242
242
|
/** Increments each time resource is checked for difference with new state */
|
|
243
|
-
|
|
243
|
+
d(this, "version", F);
|
|
244
244
|
/** Set to resource version when resource state, or it's fields have changed */
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
245
|
+
d(this, "dataVersion", F);
|
|
246
|
+
d(this, "fields", /* @__PURE__ */ new Map());
|
|
247
|
+
d(this, "kv", /* @__PURE__ */ new Map());
|
|
248
|
+
d(this, "resourceRemoved", new m());
|
|
249
249
|
// following change source are removed when resource is marked as final
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
250
|
+
d(this, "finalChanged", new m());
|
|
251
|
+
d(this, "resourceStateChange", new m());
|
|
252
|
+
d(this, "lockedChange", new m());
|
|
253
|
+
d(this, "inputAndServiceFieldListChanged", new m());
|
|
254
|
+
d(this, "outputFieldListChanged", new m());
|
|
255
|
+
d(this, "dynamicFieldListChanged", new m());
|
|
256
|
+
d(this, "kvChanged", new m());
|
|
257
|
+
d(this, "id");
|
|
258
|
+
d(this, "originalResourceId");
|
|
259
|
+
d(this, "kind");
|
|
260
|
+
d(this, "type");
|
|
261
|
+
d(this, "data");
|
|
262
|
+
d(this, "dataAsString");
|
|
263
|
+
d(this, "dataAsJson");
|
|
264
|
+
d(this, "error");
|
|
265
|
+
d(this, "inputsLocked");
|
|
266
|
+
d(this, "outputsLocked");
|
|
267
|
+
d(this, "resourceReady");
|
|
268
|
+
d(this, "finalFlag");
|
|
269
269
|
/** Set externally by the tree, using {@link FinalPredicate} */
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
d(this, "_final", !1);
|
|
271
|
+
d(this, "logger");
|
|
272
272
|
this.id = e.id, this.originalResourceId = e.originalResourceId, this.kind = e.kind, this.type = e.type, this.data = e.data, this.error = e.error, this.inputsLocked = e.inputsLocked, this.outputsLocked = e.outputsLocked, this.resourceReady = e.resourceReady, this.finalFlag = e.final, this.logger = t;
|
|
273
273
|
}
|
|
274
274
|
// TODO add logging
|
|
@@ -283,14 +283,14 @@ class z {
|
|
|
283
283
|
}
|
|
284
284
|
getField(e, t, r = () => {
|
|
285
285
|
}) {
|
|
286
|
-
var
|
|
287
|
-
const s = typeof t == "string" ? { field: t } : t,
|
|
288
|
-
if (
|
|
286
|
+
var o, i, l;
|
|
287
|
+
const s = typeof t == "string" ? { field: t } : t, a = this.fields.get(s.field);
|
|
288
|
+
if (a === void 0) {
|
|
289
289
|
if (s.errorIfFieldNotFound || s.errorIfFieldNotSet)
|
|
290
290
|
throw new Error(
|
|
291
|
-
`Field "${s.field}" not found in resource ${
|
|
291
|
+
`Field "${s.field}" not found in resource ${C(this.id)}`
|
|
292
292
|
);
|
|
293
|
-
if (!this.inputsLocked) (
|
|
293
|
+
if (!this.inputsLocked) (o = this.inputAndServiceFieldListChanged) == null || o.attachWatcher(e);
|
|
294
294
|
else if (s.assertFieldType === "Service" || s.assertFieldType === "Input") {
|
|
295
295
|
if (s.allowPermanentAbsence)
|
|
296
296
|
return;
|
|
@@ -302,15 +302,15 @@ class z {
|
|
|
302
302
|
return;
|
|
303
303
|
throw new Error(`Output field not found ${s.field}.`);
|
|
304
304
|
}
|
|
305
|
-
(
|
|
305
|
+
(l = this.dynamicFieldListChanged) == null || l.attachWatcher(e), !this._final && !s.stableIfNotFound && r("field_not_found:" + s.field);
|
|
306
306
|
return;
|
|
307
307
|
} else {
|
|
308
|
-
if (s.assertFieldType !== void 0 &&
|
|
308
|
+
if (s.assertFieldType !== void 0 && a.type !== s.assertFieldType)
|
|
309
309
|
throw new Error(
|
|
310
|
-
`Unexpected field type: expected ${s.assertFieldType} but got ${
|
|
310
|
+
`Unexpected field type: expected ${s.assertFieldType} but got ${a.type} for the field name ${s.field}`
|
|
311
311
|
);
|
|
312
|
-
const
|
|
313
|
-
return g(
|
|
312
|
+
const c = {};
|
|
313
|
+
return g(a.value) && (c.value = a.value), g(a.error) && (c.error = a.error), c.value === void 0 && c.error === void 0 && r("field_not_resolved:" + s.field), a.change.attachWatcher(e), c;
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
getInputsLocked(e) {
|
|
@@ -322,7 +322,7 @@ class z {
|
|
|
322
322
|
return this.outputsLocked || (t = this.resourceStateChange) == null || t.attachWatcher(e), this.outputsLocked;
|
|
323
323
|
}
|
|
324
324
|
get isReadyOrError() {
|
|
325
|
-
return this.error !==
|
|
325
|
+
return this.error !== S || this.resourceReady || this.originalResourceId !== S;
|
|
326
326
|
}
|
|
327
327
|
getIsFinal(e) {
|
|
328
328
|
var t;
|
|
@@ -334,7 +334,7 @@ class z {
|
|
|
334
334
|
}
|
|
335
335
|
getError(e) {
|
|
336
336
|
var t;
|
|
337
|
-
if (
|
|
337
|
+
if (V(this.error)) {
|
|
338
338
|
(t = this.resourceStateChange) == null || t.attachWatcher(e);
|
|
339
339
|
return;
|
|
340
340
|
} else
|
|
@@ -343,22 +343,22 @@ class z {
|
|
|
343
343
|
listInputFields(e) {
|
|
344
344
|
var r;
|
|
345
345
|
const t = [];
|
|
346
|
-
return this.fields.forEach((s,
|
|
347
|
-
(s.type === "Input" || s.type === "Service") && t.push(
|
|
346
|
+
return this.fields.forEach((s, a) => {
|
|
347
|
+
(s.type === "Input" || s.type === "Service") && t.push(a);
|
|
348
348
|
}), this.inputsLocked || (r = this.inputAndServiceFieldListChanged) == null || r.attachWatcher(e), t;
|
|
349
349
|
}
|
|
350
350
|
listOutputFields(e) {
|
|
351
351
|
var r;
|
|
352
352
|
const t = [];
|
|
353
|
-
return this.fields.forEach((s,
|
|
354
|
-
s.type === "Output" && t.push(
|
|
353
|
+
return this.fields.forEach((s, a) => {
|
|
354
|
+
s.type === "Output" && t.push(a);
|
|
355
355
|
}), this.outputsLocked || (r = this.outputFieldListChanged) == null || r.attachWatcher(e), t;
|
|
356
356
|
}
|
|
357
357
|
listDynamicFields(e) {
|
|
358
358
|
var r;
|
|
359
359
|
const t = [];
|
|
360
|
-
return this.fields.forEach((s,
|
|
361
|
-
s.type !== "Input" && s.type !== "Output" && t.push(
|
|
360
|
+
return this.fields.forEach((s, a) => {
|
|
361
|
+
s.type !== "Input" && s.type !== "Output" && t.push(a);
|
|
362
362
|
}), (r = this.dynamicFieldListChanged) == null || r.attachWatcher(e), t;
|
|
363
363
|
}
|
|
364
364
|
getKeyValue(e, t) {
|
|
@@ -368,11 +368,11 @@ class z {
|
|
|
368
368
|
getKeyValueString(e, t) {
|
|
369
369
|
const r = this.getKeyValue(e, t);
|
|
370
370
|
if (r !== void 0)
|
|
371
|
-
return
|
|
371
|
+
return x.decode(r);
|
|
372
372
|
}
|
|
373
373
|
getDataAsString() {
|
|
374
374
|
if (this.data !== void 0)
|
|
375
|
-
return this.dataAsString === void 0 && (this.dataAsString =
|
|
375
|
+
return this.dataAsString === void 0 && (this.dataAsString = x.decode(this.data)), this.dataAsString;
|
|
376
376
|
}
|
|
377
377
|
getDataAsJson() {
|
|
378
378
|
if (this.data !== void 0)
|
|
@@ -397,23 +397,23 @@ class z {
|
|
|
397
397
|
};
|
|
398
398
|
}
|
|
399
399
|
markFinal() {
|
|
400
|
-
this._final || (this._final = !0,
|
|
400
|
+
this._final || (this._final = !0, y(this.finalChanged).markChanged(), this.finalChanged = void 0, this.resourceStateChange = void 0, this.dynamicFieldListChanged = void 0, this.inputAndServiceFieldListChanged = void 0, this.outputFieldListChanged = void 0, this.lockedChange = void 0);
|
|
401
401
|
}
|
|
402
402
|
/** Used for invalidation */
|
|
403
403
|
markAllChanged() {
|
|
404
|
-
var e, t, r, s,
|
|
405
|
-
this.fields.forEach((
|
|
404
|
+
var e, t, r, s, a, o, i;
|
|
405
|
+
this.fields.forEach((l) => l.change.markChanged()), (e = this.finalChanged) == null || e.markChanged(), (t = this.resourceStateChange) == null || t.markChanged(), (r = this.lockedChange) == null || r.markChanged(), (s = this.inputAndServiceFieldListChanged) == null || s.markChanged(), (a = this.outputFieldListChanged) == null || a.markChanged(), (o = this.dynamicFieldListChanged) == null || o.markChanged(), (i = this.kvChanged) == null || i.markChanged(), this.resourceRemoved.markChanged();
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
|
-
class
|
|
408
|
+
class O {
|
|
409
409
|
constructor(e, t = (r) => !1) {
|
|
410
410
|
/** resource heap */
|
|
411
|
-
|
|
412
|
-
|
|
411
|
+
d(this, "resources", /* @__PURE__ */ new Map());
|
|
412
|
+
d(this, "resourcesAdded", new m());
|
|
413
413
|
/** Resets to false if any invalid state transitions are registered,
|
|
414
414
|
* after that tree will produce errors for any read or write operations */
|
|
415
|
-
|
|
416
|
-
|
|
415
|
+
d(this, "_isValid", !0);
|
|
416
|
+
d(this, "invalidationMessage");
|
|
417
417
|
this.root = e, this.isFinalPredicate = t;
|
|
418
418
|
}
|
|
419
419
|
forEachResource(e) {
|
|
@@ -426,91 +426,91 @@ class I {
|
|
|
426
426
|
this.checkValid();
|
|
427
427
|
const r = this.resources.get(t);
|
|
428
428
|
if (r === void 0)
|
|
429
|
-
throw this.resourcesAdded.attachWatcher(e), new Error(`resource ${
|
|
429
|
+
throw this.resourcesAdded.attachWatcher(e), new Error(`resource ${C(t)} not found in the tree`);
|
|
430
430
|
return r.resourceRemoved.attachWatcher(e), r;
|
|
431
431
|
}
|
|
432
432
|
updateFromResourceData(e, t = !1) {
|
|
433
433
|
this.checkValid();
|
|
434
434
|
const r = [], s = [];
|
|
435
|
-
for (const
|
|
436
|
-
let i = this.resources.get(
|
|
437
|
-
const
|
|
438
|
-
const { fields:
|
|
439
|
-
throw this.invalidateTree(), new
|
|
440
|
-
`Unexpected resource state transition (${
|
|
441
|
-
|
|
442
|
-
)} -> ${L(
|
|
435
|
+
for (const o of e) {
|
|
436
|
+
let i = this.resources.get(o.id);
|
|
437
|
+
const l = i == null ? void 0 : i.state, c = (f) => {
|
|
438
|
+
const { fields: k, ...u } = o;
|
|
439
|
+
throw this.invalidateTree(), new D(
|
|
440
|
+
`Unexpected resource state transition (${f}): ${L(
|
|
441
|
+
u
|
|
442
|
+
)} -> ${L(l)}`
|
|
443
443
|
);
|
|
444
444
|
};
|
|
445
445
|
if (i !== void 0) {
|
|
446
|
-
i.final &&
|
|
447
|
-
let
|
|
448
|
-
i.version += 1, i.originalResourceId !==
|
|
449
|
-
for (const
|
|
450
|
-
let
|
|
451
|
-
|
|
452
|
-
`adding input field "${
|
|
453
|
-
),
|
|
454
|
-
`adding output field "${
|
|
455
|
-
),
|
|
456
|
-
`adding ${
|
|
457
|
-
),
|
|
458
|
-
`adding ${
|
|
459
|
-
),
|
|
446
|
+
i.final && c("resource state can be updated after it is marked as final");
|
|
447
|
+
let f = !1;
|
|
448
|
+
i.version += 1, i.originalResourceId !== o.originalResourceId && (i.originalResourceId !== S && c("originalResourceId can't change after it is set"), i.originalResourceId = o.originalResourceId, y(i.resourceStateChange).markChanged(), f = !0), i.error !== o.error && (g(i.error) && c("resource can't change attached error after it is set"), i.error = o.error, r.push(i.error), y(i.resourceStateChange).markChanged(), f = !0);
|
|
449
|
+
for (const u of o.fields) {
|
|
450
|
+
let h = i.fields.get(u.name);
|
|
451
|
+
h ? (h.type !== u.type && (h.type !== "Dynamic" && c(`field changed type ${h.type} -> ${u.type}`), y(i.dynamicFieldListChanged).markChanged(), (h.type === "Input" || h.type === "Service") && (i.inputsLocked && c(
|
|
452
|
+
`adding input field "${u.name}", while corresponding list is locked`
|
|
453
|
+
), y(i.inputAndServiceFieldListChanged).markChanged()), h.type === "Output" && (i.outputsLocked && c(
|
|
454
|
+
`adding output field "${u.name}", while corresponding list is locked`
|
|
455
|
+
), y(i.outputFieldListChanged).markChanged()), h.type = u.type, h.change.markChanged(), f = !0), h.value !== u.value && (g(h.value) && s.push(h.value), h.value = u.value, g(u.value) && r.push(u.value), h.change.markChanged(), f = !0), h.error !== u.error && (g(h.error) && s.push(h.error), h.error = u.error, g(u.error) && r.push(u.error), h.change.markChanged(), f = !0), h.resourceVersion = i.version) : (h = new $(u.type, u.value, u.error, i.version), g(u.value) && r.push(u.value), g(u.error) && r.push(u.error), u.type === "Input" || u.type === "Service" ? (i.inputsLocked && c(
|
|
456
|
+
`adding ${u.type} (${u.name}) field while inputs locked`
|
|
457
|
+
), y(i.inputAndServiceFieldListChanged).markChanged()) : u.type === "Output" ? (i.outputsLocked && c(
|
|
458
|
+
`adding ${u.type} (${u.name}) field while outputs locked`
|
|
459
|
+
), y(i.outputFieldListChanged).markChanged()) : y(i.dynamicFieldListChanged).markChanged(), i.fields.set(u.name, h), f = !0);
|
|
460
460
|
}
|
|
461
|
-
if (i.fields.forEach((
|
|
462
|
-
|
|
463
|
-
}), i.inputsLocked !==
|
|
464
|
-
const
|
|
465
|
-
i.resourceReady =
|
|
466
|
-
`resource can't lose it's ready or error state (ready state before ${
|
|
467
|
-
),
|
|
461
|
+
if (i.fields.forEach((u, h, p) => {
|
|
462
|
+
u.resourceVersion !== i.version && ((u.type === "Input" || u.type === "Service" || u.type === "Output") && c(`removal of ${u.type} field ${h}`), u.change.markChanged(), p.delete(h), g(u.value) && s.push(u.value), g(u.error) && s.push(u.error), y(i.dynamicFieldListChanged).markChanged());
|
|
463
|
+
}), i.inputsLocked !== o.inputsLocked && (i.inputsLocked && c("inputs unlocking is not permitted"), i.inputsLocked = o.inputsLocked, y(i.lockedChange).markChanged(), f = !0), i.outputsLocked !== o.outputsLocked && (i.outputsLocked && c("outputs unlocking is not permitted"), i.outputsLocked = o.outputsLocked, y(i.lockedChange).markChanged(), f = !0), i.resourceReady !== o.resourceReady) {
|
|
464
|
+
const u = i.resourceReady;
|
|
465
|
+
i.resourceReady = o.resourceReady, i.verifyReadyState(), i.isReadyOrError || c(
|
|
466
|
+
`resource can't lose it's ready or error state (ready state before ${u})`
|
|
467
|
+
), y(i.resourceStateChange).markChanged(), f = !0;
|
|
468
468
|
}
|
|
469
|
-
let
|
|
470
|
-
for (const
|
|
471
|
-
const
|
|
472
|
-
(
|
|
469
|
+
let k = !1;
|
|
470
|
+
for (const u of o.kv) {
|
|
471
|
+
const h = i.kv.get(u.key);
|
|
472
|
+
(h === void 0 || Buffer.compare(h, u.value) !== 0) && (i.kv.set(u.key, u.value), k = !0);
|
|
473
473
|
}
|
|
474
|
-
if (i.kv.size >
|
|
475
|
-
const
|
|
476
|
-
i.kv.forEach((
|
|
477
|
-
|
|
478
|
-
}),
|
|
474
|
+
if (i.kv.size > o.kv.length) {
|
|
475
|
+
const u = new Set(o.kv.map((h) => h.key));
|
|
476
|
+
i.kv.forEach((h, p, v) => {
|
|
477
|
+
u.has(p) || v.delete(p);
|
|
478
|
+
}), k = !0;
|
|
479
479
|
}
|
|
480
|
-
|
|
480
|
+
k && y(i.kvChanged).markChanged(), f && (i.dataVersion = i.version, this.isFinalPredicate(i) && i.markFinal());
|
|
481
481
|
} else {
|
|
482
|
-
i = new
|
|
483
|
-
for (const
|
|
484
|
-
const
|
|
485
|
-
g(
|
|
482
|
+
i = new G(o), i.verifyReadyState(), g(i.error) && r.push(i.error);
|
|
483
|
+
for (const f of o.fields) {
|
|
484
|
+
const k = new $(f.type, f.value, f.error, F);
|
|
485
|
+
g(f.value) && r.push(f.value), g(f.error) && r.push(f.error), i.fields.set(f.name, k);
|
|
486
486
|
}
|
|
487
|
-
for (const
|
|
487
|
+
for (const f of o.kv) i.kv.set(f.key, f.value);
|
|
488
488
|
this.resources.set(i.id, i), this.resourcesAdded.markChanged();
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
|
-
for (const
|
|
492
|
-
const i = this.resources.get(
|
|
491
|
+
for (const o of r) {
|
|
492
|
+
const i = this.resources.get(o);
|
|
493
493
|
if (!i)
|
|
494
|
-
throw this.invalidateTree(), new
|
|
494
|
+
throw this.invalidateTree(), new D(`orphan resource ${o}`);
|
|
495
495
|
i.refCount++;
|
|
496
496
|
}
|
|
497
|
-
let
|
|
498
|
-
for (;
|
|
499
|
-
const
|
|
500
|
-
for (const i of
|
|
501
|
-
const
|
|
502
|
-
if (!
|
|
503
|
-
throw this.invalidateTree(), new
|
|
504
|
-
|
|
505
|
-
g(
|
|
506
|
-
}), g(
|
|
497
|
+
let a = s;
|
|
498
|
+
for (; a.length > 0; ) {
|
|
499
|
+
const o = [];
|
|
500
|
+
for (const i of a) {
|
|
501
|
+
const l = this.resources.get(i);
|
|
502
|
+
if (!l)
|
|
503
|
+
throw this.invalidateTree(), new D(`orphan resource ${i}`);
|
|
504
|
+
l.refCount--, l.refCount === 0 && l.id !== this.root && (l.fields.forEach((c) => {
|
|
505
|
+
g(c.value) && o.push(c.value), g(c.error) && o.push(c.error), c.change.markChanged();
|
|
506
|
+
}), g(l.error) && o.push(l.error), l.resourceRemoved.markChanged(), this.resources.delete(i));
|
|
507
507
|
}
|
|
508
|
-
|
|
508
|
+
a = o;
|
|
509
509
|
}
|
|
510
510
|
if (!t) {
|
|
511
|
-
for (const
|
|
512
|
-
if (!this.resources.has(
|
|
513
|
-
throw this.invalidateTree(), new
|
|
511
|
+
for (const o of e)
|
|
512
|
+
if (!this.resources.has(o.id))
|
|
513
|
+
throw this.invalidateTree(), new D(`orphan input resource ${o.id}`);
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
516
|
/** @deprecated use "entry" instead */
|
|
@@ -518,7 +518,7 @@ class I {
|
|
|
518
518
|
return this.checkValid(), this.entry(e);
|
|
519
519
|
}
|
|
520
520
|
entry(e = this.root) {
|
|
521
|
-
return this.checkValid(), new
|
|
521
|
+
return this.checkValid(), new R({ treeProvider: () => this }, e);
|
|
522
522
|
}
|
|
523
523
|
invalidateTree(e) {
|
|
524
524
|
this._isValid = !1, this.invalidationMessage = e, this.resources.forEach((t) => {
|
|
@@ -526,118 +526,157 @@ class I {
|
|
|
526
526
|
});
|
|
527
527
|
}
|
|
528
528
|
}
|
|
529
|
-
function
|
|
529
|
+
function Q(n, e) {
|
|
530
530
|
const t = [], r = /* @__PURE__ */ new Set();
|
|
531
|
-
return
|
|
531
|
+
return n.forEachResource((s) => {
|
|
532
532
|
s.final ? r.add(s.id) : t.push(s.id);
|
|
533
|
-
}), t.length === 0 && r.size === 0 && t.push(
|
|
533
|
+
}), t.length === 0 && r.size === 0 && t.push(n.root), { seedResources: t, finalResources: r, pruningFunction: e };
|
|
534
|
+
}
|
|
535
|
+
function b() {
|
|
536
|
+
return {
|
|
537
|
+
requests: 0,
|
|
538
|
+
roundtrips: 0,
|
|
539
|
+
retrievedResources: 0,
|
|
540
|
+
retrievedFields: 0,
|
|
541
|
+
retrievedKeyValues: 0,
|
|
542
|
+
retrievedResourceDataBytes: 0,
|
|
543
|
+
prunnedFields: 0,
|
|
544
|
+
finalResourcesSkipped: 0,
|
|
545
|
+
millisSpent: 0
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
function de(n) {
|
|
549
|
+
let e = `Requests: ${n.requests}
|
|
550
|
+
`;
|
|
551
|
+
return e += `Total time: ${B(n.millisSpent)}
|
|
552
|
+
`, e += `Roundtrips: ${n.roundtrips}
|
|
553
|
+
`, e += `Resources: ${n.retrievedResources}
|
|
554
|
+
`, e += `Fields: ${n.retrievedFields}
|
|
555
|
+
`, e += `KV: ${n.retrievedKeyValues}
|
|
556
|
+
`, e += `Data Bytes: ${n.retrievedResourceDataBytes}
|
|
557
|
+
`, e += `Pruned fields: ${n.prunnedFields}
|
|
558
|
+
`, e += `Final resources skipped: ${n.finalResourcesSkipped}`, e;
|
|
534
559
|
}
|
|
535
|
-
async function
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
560
|
+
async function X(n, e, t) {
|
|
561
|
+
var h;
|
|
562
|
+
const r = Date.now();
|
|
563
|
+
t && t.requests++;
|
|
564
|
+
const { seedResources: s, finalResources: a, pruningFunction: o } = e, i = new H();
|
|
565
|
+
let l = !0, c = 0;
|
|
566
|
+
const f = /* @__PURE__ */ new Set(), k = (p) => {
|
|
567
|
+
if (V(p) || f.has(p)) return;
|
|
568
|
+
if (a.has(p)) {
|
|
569
|
+
t && t.finalResourcesSkipped++;
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
f.add(p);
|
|
573
|
+
const v = n.getResourceDataIfExists(p, !0), w = n.listKeyValuesIfResourceExists(p), U = l;
|
|
574
|
+
l && (l = !1), i.push(
|
|
541
575
|
(async () => {
|
|
542
|
-
const
|
|
543
|
-
if (
|
|
544
|
-
if (
|
|
545
|
-
return { ...
|
|
576
|
+
const [T, _] = await Promise.all([v, w]);
|
|
577
|
+
if (U && (c++, l = !0), T !== void 0) {
|
|
578
|
+
if (_ === void 0) throw new Error("Inconsistent replies");
|
|
579
|
+
return { ...T, kv: _ };
|
|
546
580
|
}
|
|
547
581
|
})()
|
|
548
582
|
);
|
|
549
583
|
};
|
|
550
|
-
|
|
551
|
-
const
|
|
584
|
+
s.forEach((p) => k(p));
|
|
585
|
+
const u = [];
|
|
552
586
|
for (; ; ) {
|
|
553
|
-
const
|
|
554
|
-
if (
|
|
587
|
+
const p = i.shift();
|
|
588
|
+
if (p === void 0)
|
|
555
589
|
break;
|
|
556
|
-
let
|
|
557
|
-
if (
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
590
|
+
let v = await p;
|
|
591
|
+
if (v !== void 0) {
|
|
592
|
+
if (o !== void 0) {
|
|
593
|
+
const w = o(v);
|
|
594
|
+
t && (t.prunnedFields += v.fields.length - w.length), v = { ...v, fields: w };
|
|
595
|
+
}
|
|
596
|
+
k(v.error);
|
|
597
|
+
for (const w of v.fields)
|
|
598
|
+
k(w.value), k(w.error);
|
|
599
|
+
t && (t.retrievedResources++, t.retrievedFields += v.fields.length, t.retrievedKeyValues += v.kv.length, t.retrievedResourceDataBytes += ((h = v.data) == null ? void 0 : h.length) ?? 0), u.push(v);
|
|
562
600
|
}
|
|
563
601
|
}
|
|
564
|
-
return
|
|
602
|
+
return t && (t.millisSpent += Date.now() - r, t.roundtrips += c), u;
|
|
565
603
|
}
|
|
566
|
-
function
|
|
567
|
-
return
|
|
604
|
+
function ce(n) {
|
|
605
|
+
return n;
|
|
568
606
|
}
|
|
569
|
-
function
|
|
570
|
-
var
|
|
571
|
-
const r =
|
|
572
|
-
if (e.data !== void 0 && (e.data === "raw" ?
|
|
607
|
+
function he(n, e, t) {
|
|
608
|
+
var o;
|
|
609
|
+
const r = n instanceof R ? y(t).accessor(n).node() : n instanceof E ? n.node() : n, a = { ...r.resourceInfo };
|
|
610
|
+
if (e.data !== void 0 && (e.data === "raw" ? a.data = r.getData() : a.data = e.data.parse(r.getDataAsJson())), e.fields !== void 0) {
|
|
573
611
|
const i = {};
|
|
574
|
-
for (const [
|
|
575
|
-
i[
|
|
576
|
-
field:
|
|
577
|
-
errorIfFieldNotSet:
|
|
578
|
-
stableIfNotFound: !
|
|
579
|
-
})) == null ? void 0 :
|
|
580
|
-
|
|
612
|
+
for (const [l, c] of Object.entries(e.fields))
|
|
613
|
+
i[l] = (o = r.traverse({
|
|
614
|
+
field: l,
|
|
615
|
+
errorIfFieldNotSet: c,
|
|
616
|
+
stableIfNotFound: !c
|
|
617
|
+
})) == null ? void 0 : o.id;
|
|
618
|
+
a.fields = i;
|
|
581
619
|
}
|
|
582
620
|
if (e.kv !== void 0) {
|
|
583
621
|
const i = {};
|
|
584
|
-
for (const [
|
|
585
|
-
const
|
|
586
|
-
if (
|
|
587
|
-
throw new Error(`Key not found ${
|
|
588
|
-
|
|
622
|
+
for (const [l, c] of Object.entries(e.kv)) {
|
|
623
|
+
const f = r.getKeyValue(l);
|
|
624
|
+
if (f === void 0)
|
|
625
|
+
throw new Error(`Key not found ${l}`);
|
|
626
|
+
c === "raw" ? i[l] = f : i[l] = c.parse(JSON.parse(Buffer.from(f).toString("utf-8")));
|
|
589
627
|
}
|
|
590
|
-
|
|
628
|
+
a.kv = i;
|
|
591
629
|
}
|
|
592
|
-
return
|
|
630
|
+
return a;
|
|
593
631
|
}
|
|
594
|
-
function
|
|
595
|
-
if (
|
|
596
|
-
const r = t.accessor(
|
|
597
|
-
var i,
|
|
632
|
+
function le(n, e, t) {
|
|
633
|
+
if (n instanceof R) {
|
|
634
|
+
const r = t.accessor(n).node(), s = r.resourceInfo, a = e.map((o) => {
|
|
635
|
+
var i, l;
|
|
598
636
|
return [
|
|
599
|
-
|
|
600
|
-
(
|
|
637
|
+
o,
|
|
638
|
+
(l = (i = r.getField(o)) == null ? void 0 : i.value) == null ? void 0 : l.id
|
|
601
639
|
];
|
|
602
640
|
});
|
|
603
641
|
return {
|
|
604
642
|
...s,
|
|
605
|
-
fields: new Map(
|
|
643
|
+
fields: new Map(a),
|
|
606
644
|
data: r.getData() ?? new Uint8Array()
|
|
607
645
|
};
|
|
608
646
|
}
|
|
609
|
-
return
|
|
647
|
+
return n;
|
|
610
648
|
}
|
|
611
|
-
function
|
|
612
|
-
if (!(
|
|
613
|
-
const r = t.accessor(
|
|
649
|
+
function fe(n, e, t) {
|
|
650
|
+
if (!(n instanceof R)) return n;
|
|
651
|
+
const r = t.accessor(n).node(), s = r.resourceInfo, a = e.map((o) => [o, r.getKeyValue(o)]);
|
|
614
652
|
return {
|
|
615
653
|
...s,
|
|
616
|
-
metadata: Object.fromEntries(
|
|
654
|
+
metadata: Object.fromEntries(a)
|
|
617
655
|
};
|
|
618
656
|
}
|
|
619
|
-
class
|
|
657
|
+
class K {
|
|
620
658
|
constructor(e, t, r, s) {
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
659
|
+
d(this, "finalPredicate");
|
|
660
|
+
d(this, "state");
|
|
661
|
+
d(this, "pollingInterval");
|
|
662
|
+
d(this, "pruning");
|
|
663
|
+
d(this, "logStat");
|
|
664
|
+
d(this, "hooks");
|
|
665
|
+
d(this, "abortController", new AbortController());
|
|
666
|
+
d(this, "scheduledOnNextState", []);
|
|
628
667
|
/** If true, main loop will continue polling pl state. */
|
|
629
|
-
|
|
668
|
+
d(this, "keepRunning", !1);
|
|
630
669
|
/** Actual state of main loop. */
|
|
631
|
-
|
|
670
|
+
d(this, "currentLoop");
|
|
632
671
|
/** If true this tree state is permanently terminaed. */
|
|
633
|
-
|
|
672
|
+
d(this, "terminated", !1);
|
|
634
673
|
this.pl = e, this.root = t, this.logger = s;
|
|
635
|
-
const { finalPredicate:
|
|
636
|
-
this.pruning =
|
|
674
|
+
const { finalPredicate: a, pruning: o, pollingInterval: i, stopPollingDelay: l, logStat: c } = r;
|
|
675
|
+
this.pruning = o, this.pollingInterval = i, this.finalPredicate = a, this.logStat = c, this.state = new O(t, a), this.hooks = new z(
|
|
637
676
|
() => this.startUpdating(),
|
|
638
677
|
() => this.stopUpdating(),
|
|
639
|
-
{ stopDebounce:
|
|
640
|
-
(
|
|
678
|
+
{ stopDebounce: l },
|
|
679
|
+
(f, k) => this.scheduleOnNextState(f, k)
|
|
641
680
|
);
|
|
642
681
|
}
|
|
643
682
|
/** @deprecated use "entry" instead */
|
|
@@ -647,7 +686,7 @@ class b {
|
|
|
647
686
|
}
|
|
648
687
|
entry(e = this.root) {
|
|
649
688
|
if (this.terminated) throw new Error("tree synchronization is terminated");
|
|
650
|
-
return new
|
|
689
|
+
return new R({ treeProvider: () => this.state, hooks: this.hooks }, e);
|
|
651
690
|
}
|
|
652
691
|
/** Can be used to externally kick off the synchronization polling loop, and
|
|
653
692
|
* await for the first synchronization to happen. */
|
|
@@ -667,30 +706,31 @@ class b {
|
|
|
667
706
|
this.keepRunning = !1;
|
|
668
707
|
}
|
|
669
708
|
/** Executed from the main loop, and initialization procedure. */
|
|
670
|
-
async refresh() {
|
|
709
|
+
async refresh(e) {
|
|
671
710
|
if (this.terminated) throw new Error("tree synchronization is terminated");
|
|
672
|
-
const
|
|
673
|
-
this.state.updateFromResourceData(
|
|
711
|
+
const t = Q(this.state, this.pruning), r = await this.pl.withReadTx("ReadingTree", async (s) => await X(s, t, e));
|
|
712
|
+
this.state.updateFromResourceData(r, !0);
|
|
674
713
|
}
|
|
675
714
|
async mainLoop() {
|
|
676
|
-
var
|
|
715
|
+
var t, r;
|
|
716
|
+
let e = this.logStat ? b() : void 0;
|
|
677
717
|
for (; this.keepRunning; ) {
|
|
678
|
-
let
|
|
679
|
-
this.scheduledOnNextState.length > 0 && (
|
|
718
|
+
let s;
|
|
719
|
+
this.scheduledOnNextState.length > 0 && (s = this.scheduledOnNextState, this.scheduledOnNextState = []);
|
|
680
720
|
try {
|
|
681
|
-
if (await this.refresh(),
|
|
682
|
-
} catch (
|
|
683
|
-
if (
|
|
684
|
-
if (
|
|
685
|
-
(
|
|
721
|
+
if (this.logStat === "per-request" && (e = b()), await this.refresh(e), e && this.logger && this.logger.info(`Tree stat (success): ${JSON.stringify(e)}`), s !== void 0) for (const a of s) a.resolve();
|
|
722
|
+
} catch (a) {
|
|
723
|
+
if (e && this.logger && this.logger.info(`Tree stat (error): ${JSON.stringify(e)}`), s !== void 0) for (const o of s) o.reject(a);
|
|
724
|
+
if (a instanceof D) {
|
|
725
|
+
(t = this.logger) == null || t.error(a), this.state.invalidateTree("stat update error"), this.state = new O(this.root, this.finalPredicate);
|
|
686
726
|
continue;
|
|
687
|
-
} else (
|
|
727
|
+
} else (r = this.logger) == null || r.warn(a);
|
|
688
728
|
}
|
|
689
729
|
if (!this.keepRunning || this.terminated) break;
|
|
690
730
|
try {
|
|
691
|
-
await
|
|
692
|
-
} catch (
|
|
693
|
-
if (!
|
|
731
|
+
await j.setTimeout(this.pollingInterval, this.abortController.signal);
|
|
732
|
+
} catch (a) {
|
|
733
|
+
if (!M(a)) throw new Error("Unexpected error", { cause: a });
|
|
694
734
|
break;
|
|
695
735
|
}
|
|
696
736
|
}
|
|
@@ -707,31 +747,33 @@ class b {
|
|
|
707
747
|
async awaitSyncLoopTermination() {
|
|
708
748
|
this.currentLoop !== void 0 && await this.currentLoop;
|
|
709
749
|
}
|
|
710
|
-
static async init(e, t, r) {
|
|
711
|
-
const
|
|
712
|
-
return await
|
|
750
|
+
static async init(e, t, r, s) {
|
|
751
|
+
const a = new K(e, t, r, s);
|
|
752
|
+
return await a.refresh(), a;
|
|
713
753
|
}
|
|
714
754
|
}
|
|
715
755
|
export {
|
|
716
|
-
|
|
717
|
-
|
|
756
|
+
N as PlError,
|
|
757
|
+
R as PlTreeEntry,
|
|
718
758
|
E as PlTreeEntryAccessor,
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
759
|
+
Y as PlTreeNodeAccessor,
|
|
760
|
+
G as PlTreeResource,
|
|
761
|
+
O as PlTreeState,
|
|
762
|
+
K as SynchronizedTreeState,
|
|
763
|
+
D as TreeStateUpdateError,
|
|
764
|
+
Q as constructTreeLoadingRequest,
|
|
765
|
+
de as formatTreeLoadingStat,
|
|
766
|
+
b as initialTreeLoadingStat,
|
|
767
|
+
ne as isPlTreeEntry,
|
|
768
|
+
oe as isPlTreeEntryAccessor,
|
|
769
|
+
ae as isPlTreeNodeAccessor,
|
|
770
|
+
X as loadTreeState,
|
|
771
|
+
he as makeResourceSnapshot,
|
|
772
|
+
P as mapValueAndError,
|
|
773
|
+
se as mapValueAndErrorIfDefined,
|
|
774
|
+
ce as rsSchema,
|
|
775
|
+
ue as treeEntryToResourceInfo,
|
|
776
|
+
le as treeEntryToResourceWithData,
|
|
777
|
+
fe as treeEntryToResourceWithMetadata
|
|
736
778
|
};
|
|
737
779
|
//# sourceMappingURL=index.mjs.map
|