@milaboratories/pl-tree 1.8.47 → 1.8.48
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/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/accessors.cjs +236 -273
- package/dist/accessors.cjs.map +1 -1
- package/dist/accessors.d.ts +93 -93
- package/dist/accessors.js +235 -271
- package/dist/accessors.js.map +1 -1
- package/dist/dump.cjs +79 -80
- package/dist/dump.cjs.map +1 -1
- package/dist/dump.d.ts +16 -18
- package/dist/dump.js +79 -79
- package/dist/dump.js.map +1 -1
- package/dist/index.cjs +31 -35
- package/dist/index.d.ts +10 -10
- package/dist/index.js +9 -8
- package/dist/snapshot.cjs +50 -71
- package/dist/snapshot.cjs.map +1 -1
- package/dist/snapshot.d.ts +36 -38
- package/dist/snapshot.js +49 -69
- package/dist/snapshot.js.map +1 -1
- package/dist/state.cjs +487 -624
- package/dist/state.cjs.map +1 -1
- package/dist/state.d.ts +117 -116
- package/dist/state.js +486 -622
- package/dist/state.js.map +1 -1
- package/dist/sync.cjs +113 -133
- package/dist/sync.cjs.map +1 -1
- package/dist/sync.d.ts +37 -33
- package/dist/sync.js +111 -131
- package/dist/sync.js.map +1 -1
- package/dist/synchronized_tree.cjs +167 -232
- package/dist/synchronized_tree.cjs.map +1 -1
- package/dist/synchronized_tree.d.ts +66 -68
- package/dist/synchronized_tree.js +165 -211
- package/dist/synchronized_tree.js.map +1 -1
- package/dist/traversal_ops.d.ts +42 -42
- package/dist/value_and_error.cjs +9 -12
- package/dist/value_and_error.cjs.map +1 -1
- package/dist/value_and_error.d.ts +8 -5
- package/dist/value_and_error.js +9 -11
- package/dist/value_and_error.js.map +1 -1
- package/dist/value_or_error.d.ts +8 -5
- package/package.json +9 -9
- package/dist/accessors.d.ts.map +0 -1
- package/dist/dump.d.ts.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/snapshot.d.ts.map +0 -1
- package/dist/state.d.ts.map +0 -1
- package/dist/sync.d.ts.map +0 -1
- package/dist/synchronized_tree.d.ts.map +0 -1
- package/dist/test_utils.d.ts +0 -25
- package/dist/test_utils.d.ts.map +0 -1
- package/dist/traversal_ops.d.ts.map +0 -1
- package/dist/value_and_error.d.ts.map +0 -1
- package/dist/value_or_error.d.ts.map +0 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
|
|
29
|
+
exports.__toESM = __toESM;
|
package/dist/accessors.cjs
CHANGED
|
@@ -1,291 +1,254 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var tsHelpers = require('@milaboratories/ts-helpers');
|
|
1
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_value_and_error = require('./value_and_error.cjs');
|
|
3
|
+
let _milaboratories_pl_client = require("@milaboratories/pl-client");
|
|
4
|
+
let _milaboratories_pl_errors = require("@milaboratories/pl-errors");
|
|
5
|
+
let _milaboratories_ts_helpers = require("@milaboratories/ts-helpers");
|
|
7
6
|
|
|
7
|
+
//#region src/accessors.ts
|
|
8
8
|
/** Error encountered during traversal in field or resource. */
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
9
|
+
var PlError = class extends Error {
|
|
10
|
+
constructor(message) {
|
|
11
|
+
super(message);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
14
|
function isPlTreeEntry(obj) {
|
|
15
|
-
|
|
16
|
-
obj !== null &&
|
|
17
|
-
obj["__pl_tree_type_marker__"] === "PlTreeEntry");
|
|
15
|
+
return typeof obj === "object" && obj !== null && obj["__pl_tree_type_marker__"] === "PlTreeEntry";
|
|
18
16
|
}
|
|
19
17
|
function isPlTreeEntryAccessor(obj) {
|
|
20
|
-
|
|
21
|
-
obj !== null &&
|
|
22
|
-
obj["__pl_tree_type_marker__"] === "PlTreeEntryAccessor");
|
|
18
|
+
return typeof obj === "object" && obj !== null && obj["__pl_tree_type_marker__"] === "PlTreeEntryAccessor";
|
|
23
19
|
}
|
|
24
20
|
function isPlTreeNodeAccessor(obj) {
|
|
25
|
-
|
|
26
|
-
obj !== null &&
|
|
27
|
-
obj["__pl_tree_type_marker__"] === "PlTreeNodeAccessor");
|
|
21
|
+
return typeof obj === "object" && obj !== null && obj["__pl_tree_type_marker__"] === "PlTreeNodeAccessor";
|
|
28
22
|
}
|
|
29
23
|
/** Main entry point for using PlTree in reactive setting */
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
}
|
|
24
|
+
var PlTreeEntry = class {
|
|
25
|
+
__pl_tree_type_marker__ = "PlTreeEntry";
|
|
26
|
+
constructor(accessorData, rid) {
|
|
27
|
+
this.accessorData = accessorData;
|
|
28
|
+
this.rid = rid;
|
|
29
|
+
}
|
|
30
|
+
createAccessor(ctx, guard) {
|
|
31
|
+
return new PlTreeEntryAccessor(this.accessorData, this.accessorData.treeProvider(), this.rid, {
|
|
32
|
+
ctx,
|
|
33
|
+
guard
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
toJSON() {
|
|
37
|
+
return this.toString();
|
|
38
|
+
}
|
|
39
|
+
toString() {
|
|
40
|
+
return `[ENTRY:${(0, _milaboratories_pl_client.resourceIdToString)(this.rid)}]`;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
51
43
|
function getResourceFromTree(accessorData, tree, instanceData, rid, ops) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
(Array.isArray(ops.assertResourceType)
|
|
60
|
-
? ops.assertResourceType.findIndex((rt) => plClient.resourceTypesEqual(rt, acc.resourceType)) === -1
|
|
61
|
-
: !plClient.resourceTypesEqual(ops.assertResourceType, acc.resourceType)))
|
|
62
|
-
throw new Error(
|
|
63
|
-
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
64
|
-
`wrong resource type ${plClient.resourceTypeToString(acc.resourceType)} but expected ${ops.assertResourceType}`);
|
|
65
|
-
return acc;
|
|
66
|
-
}
|
|
67
|
-
class PlTreeEntryAccessor {
|
|
68
|
-
accessorData;
|
|
69
|
-
tree;
|
|
70
|
-
rid;
|
|
71
|
-
instanceData;
|
|
72
|
-
__pl_tree_type_marker__ = "PlTreeEntryAccessor";
|
|
73
|
-
constructor(accessorData, tree, rid, instanceData) {
|
|
74
|
-
this.accessorData = accessorData;
|
|
75
|
-
this.tree = tree;
|
|
76
|
-
this.rid = rid;
|
|
77
|
-
this.instanceData = instanceData;
|
|
78
|
-
}
|
|
79
|
-
node(ops = {}) {
|
|
80
|
-
this.instanceData.guard();
|
|
81
|
-
// this is the only entry point to acquire a PlTreeNodeAccessor,
|
|
82
|
-
// so this is the only point where we should attach the hooks
|
|
83
|
-
if (this.accessorData.hooks !== undefined)
|
|
84
|
-
this.instanceData.ctx.attacheHooks(this.accessorData.hooks);
|
|
85
|
-
return getResourceFromTree(this.accessorData, this.tree, this.instanceData, this.rid, ops);
|
|
86
|
-
}
|
|
44
|
+
const acc = new PlTreeNodeAccessor(accessorData, tree, tree.get(instanceData.ctx.watcher, rid), instanceData);
|
|
45
|
+
if (!ops.ignoreError) {
|
|
46
|
+
const err = acc.getError();
|
|
47
|
+
if (err !== void 0) throw (0, _milaboratories_pl_errors.parsePlError)((0, _milaboratories_ts_helpers.notEmpty)(err.getDataAsString()), acc.id, acc.resourceType);
|
|
48
|
+
}
|
|
49
|
+
if (ops.assertResourceType !== void 0 && (Array.isArray(ops.assertResourceType) ? ops.assertResourceType.findIndex((rt) => (0, _milaboratories_pl_client.resourceTypesEqual)(rt, acc.resourceType)) === -1 : !(0, _milaboratories_pl_client.resourceTypesEqual)(ops.assertResourceType, acc.resourceType))) throw new Error(`wrong resource type ${(0, _milaboratories_pl_client.resourceTypeToString)(acc.resourceType)} but expected ${ops.assertResourceType}`);
|
|
50
|
+
return acc;
|
|
87
51
|
}
|
|
52
|
+
var PlTreeEntryAccessor = class {
|
|
53
|
+
__pl_tree_type_marker__ = "PlTreeEntryAccessor";
|
|
54
|
+
constructor(accessorData, tree, rid, instanceData) {
|
|
55
|
+
this.accessorData = accessorData;
|
|
56
|
+
this.tree = tree;
|
|
57
|
+
this.rid = rid;
|
|
58
|
+
this.instanceData = instanceData;
|
|
59
|
+
}
|
|
60
|
+
node(ops = {}) {
|
|
61
|
+
this.instanceData.guard();
|
|
62
|
+
if (this.accessorData.hooks !== void 0) this.instanceData.ctx.attacheHooks(this.accessorData.hooks);
|
|
63
|
+
return getResourceFromTree(this.accessorData, this.tree, this.instanceData, this.rid, ops);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
88
66
|
/**
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
67
|
+
* Can be called only when a ctx is provided, because pl tree entry is a computable entity.
|
|
68
|
+
* @deprecated
|
|
69
|
+
* */
|
|
92
70
|
function treeEntryToResourceInfo(res, ctx) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return res;
|
|
71
|
+
if (res instanceof PlTreeEntry) return ctx.accessor(res).node().resourceInfo;
|
|
72
|
+
return res;
|
|
96
73
|
}
|
|
97
74
|
/**
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
}
|
|
274
|
-
return result;
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Can be used to pass a higher level accessor that will wrap the resource and throw its
|
|
278
|
-
* errors on node resolution.
|
|
279
|
-
* */
|
|
280
|
-
toEntryAccessor() {
|
|
281
|
-
return new PlTreeEntryAccessor(this.accessorData, this.tree, this.id, this.instanceData);
|
|
282
|
-
}
|
|
283
|
-
/** Can be passed to nested computable. */
|
|
284
|
-
persist() {
|
|
285
|
-
return new PlTreeEntry(this.accessorData, this.resource.id);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
75
|
+
* API contracts:
|
|
76
|
+
* - API never return {@link NullResourceId}, absence of link is always modeled as `undefined`
|
|
77
|
+
*
|
|
78
|
+
* Important: never store instances of this class, always get fresh instance from {@link PlTreeState} accessor.
|
|
79
|
+
* */
|
|
80
|
+
var PlTreeNodeAccessor = class {
|
|
81
|
+
__pl_tree_type_marker__ = "PlTreeNodeAccessor";
|
|
82
|
+
constructor(accessorData, tree, resource, instanceData) {
|
|
83
|
+
this.accessorData = accessorData;
|
|
84
|
+
this.tree = tree;
|
|
85
|
+
this.resource = resource;
|
|
86
|
+
this.instanceData = instanceData;
|
|
87
|
+
}
|
|
88
|
+
get id() {
|
|
89
|
+
this.instanceData.guard();
|
|
90
|
+
return this.resource.id;
|
|
91
|
+
}
|
|
92
|
+
get originalId() {
|
|
93
|
+
this.instanceData.guard();
|
|
94
|
+
return this.resource.originalResourceId;
|
|
95
|
+
}
|
|
96
|
+
get resourceType() {
|
|
97
|
+
this.instanceData.guard();
|
|
98
|
+
return this.resource.type;
|
|
99
|
+
}
|
|
100
|
+
get resourceInfo() {
|
|
101
|
+
return {
|
|
102
|
+
id: this.id,
|
|
103
|
+
type: this.resourceType
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
getResourceFromTree(rid, ops) {
|
|
107
|
+
return getResourceFromTree(this.accessorData, this.tree, this.instanceData, rid, ops);
|
|
108
|
+
}
|
|
109
|
+
traverse(...steps) {
|
|
110
|
+
return this.traverseWithCommon({}, ...steps);
|
|
111
|
+
}
|
|
112
|
+
traverseOrError(...steps) {
|
|
113
|
+
return this.traverseOrErrorWithCommon({}, ...steps);
|
|
114
|
+
}
|
|
115
|
+
traverseWithCommon(commonOptions, ...steps) {
|
|
116
|
+
const result = this.traverseOrErrorWithCommon(commonOptions, ...steps);
|
|
117
|
+
if (result === void 0) return void 0;
|
|
118
|
+
if (!result.ok) throw result.error;
|
|
119
|
+
return result.value;
|
|
120
|
+
}
|
|
121
|
+
traverseOrErrorWithCommon(commonOptions, ...steps) {
|
|
122
|
+
let current = this;
|
|
123
|
+
for (const _step of steps) {
|
|
124
|
+
const step = typeof _step === "string" ? {
|
|
125
|
+
...commonOptions,
|
|
126
|
+
field: _step
|
|
127
|
+
} : {
|
|
128
|
+
...commonOptions,
|
|
129
|
+
..._step
|
|
130
|
+
};
|
|
131
|
+
const next = current.getField(_step);
|
|
132
|
+
if (next === void 0) return void 0;
|
|
133
|
+
if (step.pureFieldErrorToUndefined && next.value === void 0 && next.error !== void 0) return void 0;
|
|
134
|
+
if ((!step.ignoreError || next.value === void 0) && next.error !== void 0) return {
|
|
135
|
+
ok: false,
|
|
136
|
+
error: (0, _milaboratories_pl_errors.parsePlError)((0, _milaboratories_ts_helpers.notEmpty)(next.error.getDataAsString()), current.id, current.resourceType, step.field)
|
|
137
|
+
};
|
|
138
|
+
if (next.value === void 0) {
|
|
139
|
+
if (step.errorIfFieldNotSet) return {
|
|
140
|
+
ok: false,
|
|
141
|
+
error: /* @__PURE__ */ new Error(`field have no assigned value ${step.field} of ${(0, _milaboratories_pl_client.resourceIdToString)(current.id)}`)
|
|
142
|
+
};
|
|
143
|
+
this.onUnstableLambda("unpopulated_field:" + step.field);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
current = next.value;
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
ok: true,
|
|
150
|
+
value: current
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
onUnstableLambda = (marker) => {
|
|
154
|
+
this.instanceData.ctx.markUnstable(marker);
|
|
155
|
+
};
|
|
156
|
+
getField(_step) {
|
|
157
|
+
this.instanceData.guard();
|
|
158
|
+
const step = typeof _step === "string" ? { field: _step } : _step;
|
|
159
|
+
const ve = this.resource.getField(this.instanceData.ctx.watcher, step, this.onUnstableLambda);
|
|
160
|
+
if (ve === void 0) return void 0;
|
|
161
|
+
return require_value_and_error.mapValueAndError(ve, (rid) => this.getResourceFromTree(rid, { ignoreError: true }));
|
|
162
|
+
}
|
|
163
|
+
getInputsLocked() {
|
|
164
|
+
this.instanceData.guard();
|
|
165
|
+
const result = this.resource.getInputsLocked(this.instanceData.ctx.watcher);
|
|
166
|
+
if (!result) this.instanceData.ctx.markUnstable("inputs_unlocked:" + this.resourceType.name);
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
getOutputsLocked() {
|
|
170
|
+
this.instanceData.guard();
|
|
171
|
+
const result = this.resource.getOutputsLocked(this.instanceData.ctx.watcher);
|
|
172
|
+
if (!result) this.instanceData.ctx.markUnstable("outputs_unlocked:" + this.resourceType.name);
|
|
173
|
+
return result;
|
|
174
|
+
}
|
|
175
|
+
getIsReadyOrError() {
|
|
176
|
+
this.instanceData.guard();
|
|
177
|
+
const result = this.resource.getIsReadyOrError(this.instanceData.ctx.watcher);
|
|
178
|
+
if (!result) this.instanceData.ctx.markUnstable("not_ready:" + this.resourceType.name);
|
|
179
|
+
return result;
|
|
180
|
+
}
|
|
181
|
+
getIsFinal() {
|
|
182
|
+
this.instanceData.guard();
|
|
183
|
+
return this.resource.getIsFinal(this.instanceData.ctx.watcher);
|
|
184
|
+
}
|
|
185
|
+
getError() {
|
|
186
|
+
this.instanceData.guard();
|
|
187
|
+
const rid = this.resource.getError(this.instanceData.ctx.watcher);
|
|
188
|
+
if (rid === void 0) return void 0;
|
|
189
|
+
return this.getResourceFromTree(rid, {});
|
|
190
|
+
}
|
|
191
|
+
getData() {
|
|
192
|
+
return this.resource.data;
|
|
193
|
+
}
|
|
194
|
+
getDataAsString() {
|
|
195
|
+
return this.resource.getDataAsString();
|
|
196
|
+
}
|
|
197
|
+
getDataAsJson() {
|
|
198
|
+
return this.resource.getDataAsJson();
|
|
199
|
+
}
|
|
200
|
+
listInputFields() {
|
|
201
|
+
this.instanceData.guard();
|
|
202
|
+
this.getInputsLocked();
|
|
203
|
+
return this.resource.listInputFields(this.instanceData.ctx.watcher);
|
|
204
|
+
}
|
|
205
|
+
listOutputFields() {
|
|
206
|
+
this.instanceData.guard();
|
|
207
|
+
this.getOutputsLocked();
|
|
208
|
+
return this.resource.listOutputFields(this.instanceData.ctx.watcher);
|
|
209
|
+
}
|
|
210
|
+
listDynamicFields() {
|
|
211
|
+
this.instanceData.guard();
|
|
212
|
+
return this.resource.listDynamicFields(this.instanceData.ctx.watcher);
|
|
213
|
+
}
|
|
214
|
+
getKeyValue(key, unstableIfNotFound = false) {
|
|
215
|
+
this.instanceData.guard();
|
|
216
|
+
const result = this.resource.getKeyValue(this.instanceData.ctx.watcher, key);
|
|
217
|
+
if (result === void 0 && unstableIfNotFound) this.instanceData.ctx.markUnstable("key_not_found_b:" + key);
|
|
218
|
+
return result;
|
|
219
|
+
}
|
|
220
|
+
/** @deprecated */
|
|
221
|
+
getKeyValueString(key) {
|
|
222
|
+
return this.getKeyValueAsString(key);
|
|
223
|
+
}
|
|
224
|
+
getKeyValueAsString(key, unstableIfNotFound = false) {
|
|
225
|
+
this.instanceData.guard();
|
|
226
|
+
const result = this.resource.getKeyValueString(this.instanceData.ctx.watcher, key);
|
|
227
|
+
if (result === void 0 && unstableIfNotFound) this.instanceData.ctx.markUnstable("key_not_found_s:" + key);
|
|
228
|
+
return result;
|
|
229
|
+
}
|
|
230
|
+
getKeyValueAsJson(key, unstableIfNotFound = false) {
|
|
231
|
+
const result = this.resource.getKeyValueAsJson(this.instanceData.ctx.watcher, key);
|
|
232
|
+
if (result === void 0) {
|
|
233
|
+
if (unstableIfNotFound) this.instanceData.ctx.markUnstable("key_not_found_j:" + key);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
return result;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Can be used to pass a higher level accessor that will wrap the resource and throw its
|
|
240
|
+
* errors on node resolution.
|
|
241
|
+
* */
|
|
242
|
+
toEntryAccessor() {
|
|
243
|
+
return new PlTreeEntryAccessor(this.accessorData, this.tree, this.id, this.instanceData);
|
|
244
|
+
}
|
|
245
|
+
/** Can be passed to nested computable. */
|
|
246
|
+
persist() {
|
|
247
|
+
return new PlTreeEntry(this.accessorData, this.resource.id);
|
|
248
|
+
}
|
|
249
|
+
};
|
|
288
250
|
|
|
251
|
+
//#endregion
|
|
289
252
|
exports.PlError = PlError;
|
|
290
253
|
exports.PlTreeEntry = PlTreeEntry;
|
|
291
254
|
exports.PlTreeEntryAccessor = PlTreeEntryAccessor;
|
|
@@ -294,4 +257,4 @@ exports.isPlTreeEntry = isPlTreeEntry;
|
|
|
294
257
|
exports.isPlTreeEntryAccessor = isPlTreeEntryAccessor;
|
|
295
258
|
exports.isPlTreeNodeAccessor = isPlTreeNodeAccessor;
|
|
296
259
|
exports.treeEntryToResourceInfo = treeEntryToResourceInfo;
|
|
297
|
-
//# sourceMappingURL=accessors.cjs.map
|
|
260
|
+
//# sourceMappingURL=accessors.cjs.map
|