@blue-labs/language 3.4.0 → 3.4.2
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/README.md +1 -1
- package/dist/index.js +7 -7
- package/dist/index.mjs +858 -785
- package/dist/lib/merge/Merger.d.ts +14 -5
- package/dist/lib/merge/Merger.d.ts.map +1 -1
- package/dist/lib/model/Node.d.ts +1 -0
- package/dist/lib/model/Node.d.ts.map +1 -1
- package/dist/lib/model/ResolvedNode.d.ts +6 -0
- package/dist/lib/model/ResolvedNode.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import M from "big.js";
|
|
2
|
-
import { isNullable as I, isNonNullable as p, jsonPrimitiveSchema as cr, isReadonlyArray as Ee, isJsonPrimitive as
|
|
3
|
-
import { z as
|
|
4
|
-
import
|
|
5
|
-
import { isObject as Vt, isArray as
|
|
6
|
-
import { OBJECT_CONTRACTS as
|
|
7
|
-
import { sha256 as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
2
|
+
import { isNullable as I, isNonNullable as p, jsonPrimitiveSchema as cr, isReadonlyArray as Ee, isJsonPrimitive as Qe, isPreciseNumberString as Nt } from "@blue-labs/shared-utils";
|
|
3
|
+
import { z as h, ZodOptional as Pt, ZodNullable as St, ZodReadonly as Ct, ZodBranded as At, ZodEffects as Ne, ZodLazy as Pe, ZodString as ee, ZodNumber as te, ZodBoolean as be, ZodBigInt as we, ZodEnum as ur, ZodNativeEnum as dr, ZodIntersection as pr, ZodUnion as hr, ZodObject as fr, ZodRecord as yr } from "zod";
|
|
4
|
+
import ue from "bs58";
|
|
5
|
+
import { isObject as Vt, isArray as et, isString as tt, omit as Rt, pascal as gr, map as mr } from "radash";
|
|
6
|
+
import { OBJECT_CONTRACTS as V, OBJECT_MERGE_POLICY as Ir, OBJECT_SCHEMA as Tr, BLUE_REPOSITORY_STATUS_STABLE as ae, BLUE_REPOSITORY_STATUS_DEV as rt, validateAttributesAddedPointer as vr, parsePointer as Ot } from "@blue-labs/repository-contract";
|
|
7
|
+
import { sha256 as br } from "js-sha256";
|
|
8
|
+
import je from "crypto";
|
|
9
|
+
import wr from "base32.js";
|
|
10
|
+
import H from "js-yaml";
|
|
11
11
|
class S extends M {
|
|
12
12
|
constructor(e) {
|
|
13
13
|
super(e);
|
|
@@ -18,71 +18,71 @@ class E extends M {
|
|
|
18
18
|
super(e);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
const G = "name", J = "description",
|
|
21
|
+
const G = "name", J = "description", W = "type", fe = "itemType", ye = "keyType", ge = "valueType", me = "value", Oe = "items", x = "blueId", De = "blue", st = [
|
|
22
22
|
G,
|
|
23
23
|
J,
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
W,
|
|
25
|
+
fe,
|
|
26
26
|
ye,
|
|
27
27
|
ge,
|
|
28
28
|
me,
|
|
29
29
|
Oe,
|
|
30
30
|
x,
|
|
31
31
|
De
|
|
32
|
-
],
|
|
33
|
-
Ot,
|
|
32
|
+
], Dt = "Text", Mt = "Double", xt = "Integer", Ft = "Boolean", $t = "List", _t = "Dictionary", Me = [
|
|
34
33
|
Dt,
|
|
35
34
|
Mt,
|
|
36
|
-
xt
|
|
37
|
-
|
|
35
|
+
xt,
|
|
36
|
+
Ft
|
|
37
|
+
], nt = [...Me, $t, _t], _ = "DLRQwz7MQeCrzjy9bohPNwtCxKEBbKaMK65KBrwjfG6K", j = "7pwXmXYCJtWnd348c2JQGBkm9C4renmZRwxbfaypsx5y", L = "5WNMiV9Knz63B4dVY5JtMyh3FB4FSGqv7ceScvuapdE1", U = "4EzhSubEimSQD3zrYHRtobfPPWntUuhEz8YcdxHsi12u", it = "6aehfNAxHLC1PHHoDr3tYtFH3RWNbiWdFancJ1bypXEY", ot = "G7fBT9PSod1RfHLHkpafAGBDVAJMrMhAMY51ERcyXNrj", lt = [
|
|
38
38
|
_,
|
|
39
|
-
L,
|
|
40
39
|
j,
|
|
40
|
+
L,
|
|
41
41
|
U
|
|
42
42
|
], X = [
|
|
43
|
-
...
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
],
|
|
47
|
-
|
|
43
|
+
...lt,
|
|
44
|
+
it,
|
|
45
|
+
ot
|
|
46
|
+
], Br = Object.fromEntries(
|
|
47
|
+
nt.map((s, e) => [s, X[e]])
|
|
48
48
|
), xe = Object.fromEntries(
|
|
49
|
-
X.map((s, e) => [s,
|
|
49
|
+
X.map((s, e) => [s, nt[e]])
|
|
50
50
|
), On = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
51
51
|
__proto__: null,
|
|
52
52
|
BASIC_TYPES: Me,
|
|
53
|
-
BASIC_TYPE_BLUE_IDS:
|
|
54
|
-
BOOLEAN_TYPE:
|
|
53
|
+
BASIC_TYPE_BLUE_IDS: lt,
|
|
54
|
+
BOOLEAN_TYPE: Ft,
|
|
55
55
|
BOOLEAN_TYPE_BLUE_ID: U,
|
|
56
|
-
CORE_TYPES:
|
|
56
|
+
CORE_TYPES: nt,
|
|
57
57
|
CORE_TYPE_BLUE_IDS: X,
|
|
58
58
|
CORE_TYPE_BLUE_ID_TO_NAME_MAP: xe,
|
|
59
|
-
CORE_TYPE_NAME_TO_BLUE_ID_MAP:
|
|
60
|
-
DICTIONARY_TYPE:
|
|
61
|
-
DICTIONARY_TYPE_BLUE_ID:
|
|
62
|
-
DOUBLE_TYPE:
|
|
63
|
-
DOUBLE_TYPE_BLUE_ID:
|
|
64
|
-
INTEGER_TYPE:
|
|
65
|
-
INTEGER_TYPE_BLUE_ID:
|
|
66
|
-
LIST_TYPE:
|
|
67
|
-
LIST_TYPE_BLUE_ID:
|
|
59
|
+
CORE_TYPE_NAME_TO_BLUE_ID_MAP: Br,
|
|
60
|
+
DICTIONARY_TYPE: _t,
|
|
61
|
+
DICTIONARY_TYPE_BLUE_ID: ot,
|
|
62
|
+
DOUBLE_TYPE: Mt,
|
|
63
|
+
DOUBLE_TYPE_BLUE_ID: j,
|
|
64
|
+
INTEGER_TYPE: xt,
|
|
65
|
+
INTEGER_TYPE_BLUE_ID: L,
|
|
66
|
+
LIST_TYPE: $t,
|
|
67
|
+
LIST_TYPE_BLUE_ID: it,
|
|
68
68
|
OBJECT_BLUE: De,
|
|
69
69
|
OBJECT_BLUE_ID: x,
|
|
70
|
-
OBJECT_CONTRACTS:
|
|
70
|
+
OBJECT_CONTRACTS: V,
|
|
71
71
|
OBJECT_DESCRIPTION: J,
|
|
72
72
|
OBJECT_ITEMS: Oe,
|
|
73
|
-
OBJECT_ITEM_TYPE:
|
|
73
|
+
OBJECT_ITEM_TYPE: fe,
|
|
74
74
|
OBJECT_KEY_TYPE: ye,
|
|
75
|
-
OBJECT_MERGE_POLICY:
|
|
75
|
+
OBJECT_MERGE_POLICY: Ir,
|
|
76
76
|
OBJECT_NAME: G,
|
|
77
|
-
OBJECT_SCHEMA:
|
|
78
|
-
OBJECT_SPECIFIC_KEYS:
|
|
79
|
-
OBJECT_TYPE:
|
|
77
|
+
OBJECT_SCHEMA: Tr,
|
|
78
|
+
OBJECT_SPECIFIC_KEYS: st,
|
|
79
|
+
OBJECT_TYPE: W,
|
|
80
80
|
OBJECT_VALUE: me,
|
|
81
81
|
OBJECT_VALUE_TYPE: ge,
|
|
82
|
-
TEXT_TYPE:
|
|
82
|
+
TEXT_TYPE: Dt,
|
|
83
83
|
TEXT_TYPE_BLUE_ID: _
|
|
84
84
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
85
|
-
class
|
|
85
|
+
class Er {
|
|
86
86
|
static get(e, t, r, n = !0) {
|
|
87
87
|
if (I(t) || !t.startsWith("/"))
|
|
88
88
|
throw new Error(`Invalid path: ${t}`);
|
|
@@ -108,8 +108,8 @@ class wr {
|
|
|
108
108
|
!1
|
|
109
109
|
);
|
|
110
110
|
if (r === t.length) {
|
|
111
|
-
const
|
|
112
|
-
return i &&
|
|
111
|
+
const a = e.getValue();
|
|
112
|
+
return i && a !== void 0 ? a : e;
|
|
113
113
|
}
|
|
114
114
|
const o = t[r], l = this.getNodeForSegment(
|
|
115
115
|
e,
|
|
@@ -135,12 +135,12 @@ class wr {
|
|
|
135
135
|
switch (t) {
|
|
136
136
|
case "name": {
|
|
137
137
|
const l = e.getName();
|
|
138
|
-
i = new
|
|
138
|
+
i = new c().setValue(l ?? null);
|
|
139
139
|
break;
|
|
140
140
|
}
|
|
141
141
|
case "description": {
|
|
142
142
|
const l = e.getDescription();
|
|
143
|
-
i = new
|
|
143
|
+
i = new c().setValue(l ?? null);
|
|
144
144
|
break;
|
|
145
145
|
}
|
|
146
146
|
case "type":
|
|
@@ -157,12 +157,12 @@ class wr {
|
|
|
157
157
|
break;
|
|
158
158
|
case "value": {
|
|
159
159
|
const l = e.getValue();
|
|
160
|
-
i = new
|
|
160
|
+
i = new c().setValue(l ?? null);
|
|
161
161
|
break;
|
|
162
162
|
}
|
|
163
163
|
case "blueId": {
|
|
164
164
|
const l = e.getBlueId();
|
|
165
|
-
i = new
|
|
165
|
+
i = new c().setValue(l ?? null);
|
|
166
166
|
break;
|
|
167
167
|
}
|
|
168
168
|
case "blue":
|
|
@@ -170,23 +170,23 @@ class wr {
|
|
|
170
170
|
break;
|
|
171
171
|
case "items": {
|
|
172
172
|
const l = e.getItems();
|
|
173
|
-
i = new
|
|
173
|
+
i = new c().setItems(l);
|
|
174
174
|
break;
|
|
175
175
|
}
|
|
176
176
|
case "properties": {
|
|
177
177
|
const l = e.getProperties();
|
|
178
|
-
i = new
|
|
178
|
+
i = new c().setProperties(l);
|
|
179
179
|
break;
|
|
180
180
|
}
|
|
181
|
-
case
|
|
181
|
+
case V: {
|
|
182
182
|
const l = e.getContracts();
|
|
183
|
-
i = new
|
|
183
|
+
i = new c().setContracts(l);
|
|
184
184
|
break;
|
|
185
185
|
}
|
|
186
186
|
default: {
|
|
187
187
|
if (/^\d+$/.test(t)) {
|
|
188
|
-
const l = parseInt(t, 10),
|
|
189
|
-
|
|
188
|
+
const l = parseInt(t, 10), a = e.getItems();
|
|
189
|
+
a && l >= 0 && l < a.length ? i = a[l] : i = void 0;
|
|
190
190
|
} else
|
|
191
191
|
i = void 0;
|
|
192
192
|
break;
|
|
@@ -200,8 +200,8 @@ class wr {
|
|
|
200
200
|
return p(r) ? r : e;
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
class
|
|
204
|
-
static INTEGER = new
|
|
203
|
+
class c {
|
|
204
|
+
static INTEGER = new c("Integer");
|
|
205
205
|
name;
|
|
206
206
|
description;
|
|
207
207
|
type;
|
|
@@ -233,32 +233,32 @@ class a {
|
|
|
233
233
|
return this.type;
|
|
234
234
|
}
|
|
235
235
|
setType(e) {
|
|
236
|
-
return typeof e == "string" ? this.type = new
|
|
236
|
+
return typeof e == "string" ? this.type = new c().setValue(e).setInlineValue(!0) : this.type = e, this;
|
|
237
237
|
}
|
|
238
238
|
getItemType() {
|
|
239
239
|
return this.itemType;
|
|
240
240
|
}
|
|
241
241
|
setItemType(e) {
|
|
242
|
-
return typeof e == "string" ? this.itemType = new
|
|
242
|
+
return typeof e == "string" ? this.itemType = new c().setValue(e).setInlineValue(!0) : this.itemType = e, this;
|
|
243
243
|
}
|
|
244
244
|
getKeyType() {
|
|
245
245
|
return this.keyType;
|
|
246
246
|
}
|
|
247
247
|
setKeyType(e) {
|
|
248
|
-
return typeof e == "string" ? this.keyType = new
|
|
248
|
+
return typeof e == "string" ? this.keyType = new c().setValue(e).setInlineValue(!0) : this.keyType = e, this;
|
|
249
249
|
}
|
|
250
250
|
getValueType() {
|
|
251
251
|
return this.valueType;
|
|
252
252
|
}
|
|
253
253
|
setValueType(e) {
|
|
254
|
-
return typeof e == "string" ? this.valueType = new
|
|
254
|
+
return typeof e == "string" ? this.valueType = new c().setValue(e).setInlineValue(!0) : this.valueType = e, this;
|
|
255
255
|
}
|
|
256
256
|
getValue() {
|
|
257
257
|
const e = this.type?.getBlueId();
|
|
258
258
|
if (p(e) && p(this.value)) {
|
|
259
|
-
if (e ===
|
|
259
|
+
if (e === L && typeof this.value == "string")
|
|
260
260
|
return new E(this.value);
|
|
261
|
-
if (e ===
|
|
261
|
+
if (e === j && typeof this.value == "string") {
|
|
262
262
|
const t = new S(this.value), r = parseFloat(t.toString());
|
|
263
263
|
return new S(r.toString());
|
|
264
264
|
} else if (e === U && typeof this.value == "string")
|
|
@@ -291,22 +291,22 @@ class a {
|
|
|
291
291
|
return this.properties && delete this.properties[e], this;
|
|
292
292
|
}
|
|
293
293
|
getContractsProperty() {
|
|
294
|
-
return this.properties?.[
|
|
294
|
+
return this.properties?.[V];
|
|
295
295
|
}
|
|
296
296
|
getContracts() {
|
|
297
297
|
return this.getContractsProperty()?.getProperties();
|
|
298
298
|
}
|
|
299
299
|
setContracts(e) {
|
|
300
|
-
return I(e) ? this.removeProperty(
|
|
301
|
-
|
|
302
|
-
new
|
|
300
|
+
return I(e) ? this.removeProperty(V) : this.addProperty(
|
|
301
|
+
V,
|
|
302
|
+
new c().setProperties(e)
|
|
303
303
|
), this;
|
|
304
304
|
}
|
|
305
305
|
addContract(e, t) {
|
|
306
306
|
const r = this.getContractsProperty();
|
|
307
307
|
return I(r) ? this.addProperty(
|
|
308
|
-
|
|
309
|
-
new
|
|
308
|
+
V,
|
|
309
|
+
new c().addProperty(e, t)
|
|
310
310
|
) : r.addProperty(e, t), this;
|
|
311
311
|
}
|
|
312
312
|
removeContract(e) {
|
|
@@ -314,7 +314,7 @@ class a {
|
|
|
314
314
|
if (t) {
|
|
315
315
|
t.removeProperty(e);
|
|
316
316
|
const r = t.getProperties();
|
|
317
|
-
r && Object.keys(r).length === 0 && this.removeProperty(
|
|
317
|
+
r && Object.keys(r).length === 0 && this.removeProperty(V);
|
|
318
318
|
}
|
|
319
319
|
return this;
|
|
320
320
|
}
|
|
@@ -344,11 +344,11 @@ class a {
|
|
|
344
344
|
return !1;
|
|
345
345
|
}
|
|
346
346
|
get(e, t) {
|
|
347
|
-
return
|
|
347
|
+
return Er.get(this, e, t);
|
|
348
348
|
}
|
|
349
349
|
getAsNode(e) {
|
|
350
350
|
const t = this.get(e);
|
|
351
|
-
if (t instanceof
|
|
351
|
+
if (t instanceof c)
|
|
352
352
|
return t;
|
|
353
353
|
throw new Error(`Value at path ${e} is not a BlueNode: ${t}`);
|
|
354
354
|
}
|
|
@@ -361,11 +361,15 @@ class a {
|
|
|
361
361
|
);
|
|
362
362
|
}
|
|
363
363
|
clone() {
|
|
364
|
-
const e = new
|
|
364
|
+
const e = new c(this.name);
|
|
365
365
|
return e.description = this.description, e.type = this.type?.clone(), e.itemType = this.itemType?.clone(), e.keyType = this.keyType?.clone(), e.valueType = this.valueType?.clone(), e.value = this.value, e.items = this.items?.map((t) => t.clone()), this.properties && (e.properties = Object.fromEntries(
|
|
366
366
|
Object.entries(this.properties).map(([t, r]) => [t, r.clone()])
|
|
367
367
|
)), e.blueId = this.blueId, e.blue = this.blue?.clone(), e.inlineValue = this.inlineValue, e;
|
|
368
368
|
}
|
|
369
|
+
cloneShallow() {
|
|
370
|
+
const e = new c(this.name);
|
|
371
|
+
return e.description = this.description, e.type = this.type, e.itemType = this.itemType, e.keyType = this.keyType, e.valueType = this.valueType, e.value = this.value, e.items = this.items ? [...this.items] : void 0, e.properties = this.properties ? { ...this.properties } : void 0, e.blueId = this.blueId, e.blue = this.blue, e.inlineValue = this.inlineValue, e;
|
|
372
|
+
}
|
|
369
373
|
toString() {
|
|
370
374
|
return `BlueNode{name='${this.name}', description='${this.description}', type=${this.type}, itemType=${this.itemType}, keyType=${this.keyType}, valueType=${this.valueType}, value=${this.value}, items=${this.items}, properties=${this.properties}, blueId='${this.blueId}', blue=${this.blue}, inlineValue=${this.inlineValue}}`;
|
|
371
375
|
}
|
|
@@ -381,7 +385,7 @@ class Se {
|
|
|
381
385
|
if (n < this.MIN_BLUE_ID_LENGTH || n > this.MAX_BLUE_ID_LENGTH)
|
|
382
386
|
return !1;
|
|
383
387
|
try {
|
|
384
|
-
if (
|
|
388
|
+
if (ue.decode(r).length !== 32)
|
|
385
389
|
return !1;
|
|
386
390
|
} catch {
|
|
387
391
|
return !1;
|
|
@@ -396,14 +400,14 @@ class Se {
|
|
|
396
400
|
return !0;
|
|
397
401
|
}
|
|
398
402
|
}
|
|
399
|
-
const Dn =
|
|
403
|
+
const Dn = h.string().max(Se.MAX_BLUE_ID_LENGTH, {
|
|
400
404
|
message: "Blue Id has a maximum length of 45 characters"
|
|
401
405
|
}).min(Se.MIN_BLUE_ID_LENGTH, {
|
|
402
406
|
message: "Blue Id has a minimum length of 41 characters"
|
|
403
407
|
}).refine(
|
|
404
408
|
(s) => {
|
|
405
409
|
try {
|
|
406
|
-
return
|
|
410
|
+
return ue.decode(s), !0;
|
|
407
411
|
} catch {
|
|
408
412
|
return !1;
|
|
409
413
|
}
|
|
@@ -411,45 +415,45 @@ const Dn = f.string().max(Se.MAX_BLUE_ID_LENGTH, {
|
|
|
411
415
|
{
|
|
412
416
|
message: "Blue Id must be a valid Base58 string"
|
|
413
417
|
}
|
|
414
|
-
),
|
|
415
|
-
() =>
|
|
416
|
-
|
|
417
|
-
blueId:
|
|
418
|
-
name:
|
|
419
|
-
description:
|
|
420
|
-
type:
|
|
421
|
-
value:
|
|
422
|
-
items:
|
|
418
|
+
), de = h.lazy(
|
|
419
|
+
() => h.record(h.unknown()).and(
|
|
420
|
+
h.object({
|
|
421
|
+
blueId: h.string().optional(),
|
|
422
|
+
name: h.string().optional(),
|
|
423
|
+
description: h.string().optional(),
|
|
424
|
+
type: de.optional(),
|
|
425
|
+
value: h.union([h.string(), h.number(), h.boolean()]).optional().nullable(),
|
|
426
|
+
items: h.array(de).optional()
|
|
423
427
|
})
|
|
424
428
|
)
|
|
425
|
-
), Fe =
|
|
426
|
-
blueId:
|
|
427
|
-
name:
|
|
428
|
-
description:
|
|
429
|
-
type:
|
|
429
|
+
), Fe = h.object({
|
|
430
|
+
blueId: h.string().optional(),
|
|
431
|
+
name: h.string().optional(),
|
|
432
|
+
description: h.string().optional(),
|
|
433
|
+
type: de.optional()
|
|
430
434
|
}), Mn = Fe.extend({
|
|
431
|
-
value:
|
|
435
|
+
value: h.string().optional()
|
|
432
436
|
}), xn = Fe.extend({
|
|
433
|
-
value:
|
|
437
|
+
value: h.number().optional()
|
|
434
438
|
}), Fn = Fe.extend({
|
|
435
|
-
value:
|
|
439
|
+
value: h.boolean().optional()
|
|
436
440
|
}), $n = Fe.extend({
|
|
437
|
-
items:
|
|
438
|
-
}), _n = (s) =>
|
|
439
|
-
() =>
|
|
440
|
-
), Vr =
|
|
441
|
-
() =>
|
|
442
|
-
|
|
443
|
-
|
|
441
|
+
items: h.array(h.string()).optional()
|
|
442
|
+
}), _n = (s) => de.safeParse(s).success, Nr = (s) => p(s) && "blueId" in s && p(s.blueId), jn = (s) => p(s) && "name" in s && p(s.name), Pr = (s) => p(s) && "items" in s && p(s.items), Sr = (s) => p(s) && "type" in s && p(s.type), Cr = (s) => p(s) && "value" in s && p(s.value), Ln = (s, e) => s.required({ type: !0 }).safeParse(e).success, C = (s) => s instanceof M, Z = (s) => C(s) && s instanceof E, Ge = (s) => C(s) && s instanceof S, Ar = h.lazy(
|
|
443
|
+
() => h.record(Ce)
|
|
444
|
+
), Vr = h.lazy(
|
|
445
|
+
() => h.union([
|
|
446
|
+
h.array(Ce),
|
|
447
|
+
h.array(Ce).readonly()
|
|
444
448
|
])
|
|
445
|
-
),
|
|
446
|
-
() =>
|
|
449
|
+
), Ce = h.lazy(
|
|
450
|
+
() => h.union([
|
|
447
451
|
cr,
|
|
448
452
|
Ar,
|
|
449
453
|
Vr,
|
|
450
|
-
|
|
454
|
+
h.instanceof(M)
|
|
451
455
|
])
|
|
452
|
-
),
|
|
456
|
+
), jt = (s) => Vt(s) && !et(s) && !Ee(s) && !C(s), Lt = (s) => et(s) || Ee(s), Un = (s) => Lt(s) || jt(s) || C(s) || Qe(s);
|
|
453
457
|
class g {
|
|
454
458
|
static deserialize(e) {
|
|
455
459
|
return g.handleNode(e);
|
|
@@ -459,8 +463,8 @@ class g {
|
|
|
459
463
|
throw new Error(
|
|
460
464
|
"This is not a valid JSON-like value. Found 'undefined' as a value."
|
|
461
465
|
);
|
|
462
|
-
if (
|
|
463
|
-
const t = new
|
|
466
|
+
if (jt(e)) {
|
|
467
|
+
const t = new c(), r = {};
|
|
464
468
|
return Object.entries(e).forEach(([n, i]) => {
|
|
465
469
|
switch (n) {
|
|
466
470
|
case G:
|
|
@@ -483,10 +487,10 @@ class g {
|
|
|
483
487
|
t.setDescription(i);
|
|
484
488
|
}
|
|
485
489
|
break;
|
|
486
|
-
case
|
|
490
|
+
case W:
|
|
487
491
|
t.setType(g.handleNode(i));
|
|
488
492
|
break;
|
|
489
|
-
case
|
|
493
|
+
case fe:
|
|
490
494
|
t.setItemType(g.handleNode(i));
|
|
491
495
|
break;
|
|
492
496
|
case ye:
|
|
@@ -516,10 +520,10 @@ class g {
|
|
|
516
520
|
}), Object.keys(r).length > 0 && t.setProperties(r), t;
|
|
517
521
|
} else {
|
|
518
522
|
if (Lt(e))
|
|
519
|
-
return new
|
|
523
|
+
return new c().setItems(g.handleArray(e));
|
|
520
524
|
{
|
|
521
525
|
const t = e;
|
|
522
|
-
return new
|
|
526
|
+
return new c().setValue(g.handleValue(t)).setInlineValue(!0);
|
|
523
527
|
}
|
|
524
528
|
}
|
|
525
529
|
}
|
|
@@ -528,8 +532,8 @@ class g {
|
|
|
528
532
|
return null;
|
|
529
533
|
if (typeof e == "string")
|
|
530
534
|
return e;
|
|
531
|
-
if (typeof e == "number" ||
|
|
532
|
-
if (
|
|
535
|
+
if (typeof e == "number" || C(e))
|
|
536
|
+
if (Z(e) || Number.isSafeInteger(e)) {
|
|
533
537
|
const t = new E(e.toString()), r = Number.MIN_SAFE_INTEGER, n = Number.MAX_SAFE_INTEGER;
|
|
534
538
|
return t.lt(r) ? new E(r.toString()) : t.gt(n) ? new E(n.toString()) : t;
|
|
535
539
|
} else {
|
|
@@ -550,12 +554,12 @@ class g {
|
|
|
550
554
|
}
|
|
551
555
|
}
|
|
552
556
|
}
|
|
553
|
-
function
|
|
557
|
+
function Rr(s) {
|
|
554
558
|
return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
|
|
555
559
|
}
|
|
556
|
-
var
|
|
557
|
-
function
|
|
558
|
-
return
|
|
560
|
+
var Le, mt;
|
|
561
|
+
function Or() {
|
|
562
|
+
return mt || (mt = 1, Le = function s(e) {
|
|
559
563
|
if (typeof e == "number" && isNaN(e))
|
|
560
564
|
throw new Error("NaN is not allowed");
|
|
561
565
|
if (typeof e == "number" && !isFinite(e))
|
|
@@ -566,47 +570,47 @@ function Rr() {
|
|
|
566
570
|
const i = r.length === 0 ? "" : ",";
|
|
567
571
|
return `${r}${i}${s(n)}:${s(e[n])}`;
|
|
568
572
|
}, "")}}`;
|
|
569
|
-
}),
|
|
573
|
+
}), Le;
|
|
570
574
|
}
|
|
571
|
-
var
|
|
572
|
-
const
|
|
575
|
+
var Dr = Or();
|
|
576
|
+
const Mr = /* @__PURE__ */ Rr(Dr);
|
|
573
577
|
class Je {
|
|
574
578
|
static canonicalize(e) {
|
|
575
|
-
return
|
|
579
|
+
return Mr(e);
|
|
576
580
|
}
|
|
577
581
|
}
|
|
578
582
|
const Ue = typeof process < "u" && process.versions != null && process.versions.node != null;
|
|
579
|
-
class
|
|
583
|
+
class at {
|
|
580
584
|
static instance;
|
|
581
585
|
browserCrypto;
|
|
582
586
|
constructor() {
|
|
583
587
|
this.browserCrypto = this.initBrowserCrypto();
|
|
584
588
|
}
|
|
585
589
|
static getInstance() {
|
|
586
|
-
return this.instance || (this.instance = new
|
|
590
|
+
return this.instance || (this.instance = new at()), this.instance;
|
|
587
591
|
}
|
|
588
592
|
initBrowserCrypto() {
|
|
589
593
|
return Ue ? null : "crypto" in globalThis ? globalThis.crypto : null;
|
|
590
594
|
}
|
|
591
595
|
hasNodeCrypto() {
|
|
592
|
-
return Ue && !!
|
|
596
|
+
return Ue && !!je && typeof je.createHash == "function";
|
|
593
597
|
}
|
|
594
598
|
getBrowserCrypto() {
|
|
595
599
|
return this.browserCrypto;
|
|
596
600
|
}
|
|
597
601
|
getNodeCrypto() {
|
|
598
|
-
return Ue ?
|
|
602
|
+
return Ue ? je : null;
|
|
599
603
|
}
|
|
600
604
|
}
|
|
601
|
-
class
|
|
602
|
-
cryptoEnv =
|
|
605
|
+
class xr {
|
|
606
|
+
cryptoEnv = at.getInstance();
|
|
603
607
|
applySync(e) {
|
|
604
608
|
const t = this.canonicalizeInput(e), r = this.cryptoEnv.hasNodeCrypto() ? this.sha256Sync(t) : this.sha256SyncBrowser(t);
|
|
605
|
-
return
|
|
609
|
+
return ue.encode(r);
|
|
606
610
|
}
|
|
607
611
|
async apply(e) {
|
|
608
612
|
const t = this.canonicalizeInput(e), r = this.cryptoEnv.hasNodeCrypto() ? this.sha256Sync(t) : await this.sha256Async(t);
|
|
609
|
-
return
|
|
613
|
+
return ue.encode(r);
|
|
610
614
|
}
|
|
611
615
|
canonicalizeInput(e) {
|
|
612
616
|
const t = Je.canonicalize(e);
|
|
@@ -624,7 +628,7 @@ class Mr {
|
|
|
624
628
|
return new Uint8Array(r);
|
|
625
629
|
}
|
|
626
630
|
sha256SyncBrowser(e) {
|
|
627
|
-
return new Uint8Array(
|
|
631
|
+
return new Uint8Array(br.arrayBuffer(e));
|
|
628
632
|
}
|
|
629
633
|
async sha256Async(e) {
|
|
630
634
|
if (this.cryptoEnv.hasNodeCrypto())
|
|
@@ -661,31 +665,31 @@ class m {
|
|
|
661
665
|
if (i !== void 0)
|
|
662
666
|
return i;
|
|
663
667
|
}
|
|
664
|
-
const
|
|
665
|
-
o !== void 0 && (
|
|
668
|
+
const a = {};
|
|
669
|
+
o !== void 0 && (a[G] = o), l !== void 0 && (a[J] = l);
|
|
666
670
|
const u = e.getType();
|
|
667
671
|
if (t === "official" && r !== void 0 && u === void 0) {
|
|
668
672
|
const Q = this.inferTypeBlueId(r);
|
|
669
|
-
Q !== null && (
|
|
670
|
-
} else u !== void 0 && (
|
|
673
|
+
Q !== null && (a[W] = { [x]: Q });
|
|
674
|
+
} else u !== void 0 && (a[W] = m.get(u, t));
|
|
671
675
|
const y = e.getItemType();
|
|
672
|
-
y !== void 0 && (
|
|
676
|
+
y !== void 0 && (a[fe] = m.get(y, t));
|
|
673
677
|
const d = e.getKeyType();
|
|
674
|
-
d !== void 0 && (
|
|
675
|
-
const
|
|
676
|
-
|
|
678
|
+
d !== void 0 && (a[ye] = m.get(d, t));
|
|
679
|
+
const f = e.getValueType();
|
|
680
|
+
f !== void 0 && (a[ge] = m.get(f, t)), n !== void 0 && (a[me] = n), i !== void 0 && (a[Oe] = i);
|
|
677
681
|
const v = e.getBlueId();
|
|
678
|
-
v !== void 0 && (
|
|
682
|
+
v !== void 0 && (a[x] = v);
|
|
679
683
|
const k = e.getBlue();
|
|
680
|
-
k !== void 0 && (
|
|
684
|
+
k !== void 0 && (a[De] = k);
|
|
681
685
|
const q = e.getProperties();
|
|
682
|
-
return q !== void 0 && Object.entries(q).forEach(([Q,
|
|
683
|
-
|
|
684
|
-
}),
|
|
686
|
+
return q !== void 0 && Object.entries(q).forEach(([Q, ar]) => {
|
|
687
|
+
a[Q] = m.get(ar, t);
|
|
688
|
+
}), a;
|
|
685
689
|
}
|
|
686
690
|
static handleValue(e) {
|
|
687
|
-
if (
|
|
688
|
-
if (
|
|
691
|
+
if (C(e)) {
|
|
692
|
+
if (Z(e)) {
|
|
689
693
|
const t = new M(Number.MIN_SAFE_INTEGER.toString()), r = new M(Number.MAX_SAFE_INTEGER.toString());
|
|
690
694
|
if (e.lt(t) || e.gt(r))
|
|
691
695
|
return e.toString();
|
|
@@ -695,12 +699,12 @@ class m {
|
|
|
695
699
|
return e;
|
|
696
700
|
}
|
|
697
701
|
static inferTypeBlueId(e) {
|
|
698
|
-
return typeof e == "string" ? _ :
|
|
702
|
+
return typeof e == "string" ? _ : C(e) ? Z(e) ? L : j : typeof e == "boolean" ? U : null;
|
|
699
703
|
}
|
|
700
704
|
}
|
|
701
|
-
const
|
|
705
|
+
const Fr = (s) => Qe(s) && p(s);
|
|
702
706
|
class T {
|
|
703
|
-
static INSTANCE = new T(new
|
|
707
|
+
static INSTANCE = new T(new xr());
|
|
704
708
|
hashProvider;
|
|
705
709
|
constructor(e) {
|
|
706
710
|
this.hashProvider = e;
|
|
@@ -735,7 +739,7 @@ class T {
|
|
|
735
739
|
}
|
|
736
740
|
// Internal method to calculate BlueId recursively
|
|
737
741
|
internalCalculate(e, t) {
|
|
738
|
-
return
|
|
742
|
+
return Fr(e) || C(e) ? this.applyHash(e.toString(), t) : Array.isArray(e) || Ee(e) ? this.calculateList(e, t) : this.calculateMap(e, t);
|
|
739
743
|
}
|
|
740
744
|
calculateMap(e, t) {
|
|
741
745
|
if (e[x] !== void 0)
|
|
@@ -745,16 +749,16 @@ class T {
|
|
|
745
749
|
if ([G, me, J].includes(o))
|
|
746
750
|
return t ? [o, l] : Promise.resolve([o, l]);
|
|
747
751
|
{
|
|
748
|
-
const
|
|
749
|
-
return t ? [o, { blueId:
|
|
752
|
+
const a = this.internalCalculate(l, t);
|
|
753
|
+
return t ? [o, { blueId: a }] : Promise.resolve(a).then((u) => [
|
|
750
754
|
o,
|
|
751
755
|
{ blueId: u }
|
|
752
756
|
]);
|
|
753
757
|
}
|
|
754
758
|
}), i = (o) => {
|
|
755
759
|
const l = {};
|
|
756
|
-
for (const [
|
|
757
|
-
l[
|
|
760
|
+
for (const [a, u] of o)
|
|
761
|
+
l[a] = u;
|
|
758
762
|
return this.applyHash(l, t);
|
|
759
763
|
};
|
|
760
764
|
return t ? i(n) : Promise.all(n).then(i);
|
|
@@ -770,7 +774,7 @@ class T {
|
|
|
770
774
|
[{ blueId: i }, { blueId: o }],
|
|
771
775
|
!0
|
|
772
776
|
) : Promise.all([i, o]).then(
|
|
773
|
-
([l,
|
|
777
|
+
([l, a]) => this.applyHash([{ blueId: l }, { blueId: a }], !1)
|
|
774
778
|
);
|
|
775
779
|
for (let i = 1; i < e.length; i++) {
|
|
776
780
|
const o = this.internalCalculate(e[i], t);
|
|
@@ -785,7 +789,7 @@ class T {
|
|
|
785
789
|
// Method to clean the input structure by removing null or undefined values
|
|
786
790
|
cleanStructure(e) {
|
|
787
791
|
if (e != null) {
|
|
788
|
-
if (
|
|
792
|
+
if (Qe(e) || C(e))
|
|
789
793
|
return e;
|
|
790
794
|
if (Array.isArray(e) || Ee(e)) {
|
|
791
795
|
const t = e.map((r) => this.cleanStructure(r)).filter(p);
|
|
@@ -804,13 +808,13 @@ class T {
|
|
|
804
808
|
}
|
|
805
809
|
class kn {
|
|
806
810
|
static convert(e) {
|
|
807
|
-
const t =
|
|
811
|
+
const t = ue.decode(e), r = new Uint8Array(2 + t.length);
|
|
808
812
|
r[0] = 18, r[1] = 32, r.set(t, 2);
|
|
809
813
|
const n = new Uint8Array(2 + r.length);
|
|
810
|
-
return n[0] = 1, n[1] = 85, n.set(r, 2), "b" + new
|
|
814
|
+
return n[0] = 1, n[1] = 85, n.set(r, 2), "b" + new wr.Encoder({ type: "rfc4648", lc: !0 }).write(n).finalize().replace(/=/g, "");
|
|
811
815
|
}
|
|
812
816
|
}
|
|
813
|
-
class
|
|
817
|
+
class B {
|
|
814
818
|
/**
|
|
815
819
|
* Transforms a node and all its child nodes using the provided transformer function
|
|
816
820
|
* @param node - The node to transform
|
|
@@ -819,30 +823,30 @@ class w {
|
|
|
819
823
|
*/
|
|
820
824
|
static transform(e, t) {
|
|
821
825
|
const r = t(e.clone()), n = r.getType();
|
|
822
|
-
n !== void 0 && r.setType(
|
|
826
|
+
n !== void 0 && r.setType(B.transform(n, t));
|
|
823
827
|
const i = r.getItemType();
|
|
824
828
|
i !== void 0 && r.setItemType(
|
|
825
|
-
|
|
829
|
+
B.transform(i, t)
|
|
826
830
|
);
|
|
827
831
|
const o = r.getKeyType();
|
|
828
832
|
o !== void 0 && r.setKeyType(
|
|
829
|
-
|
|
833
|
+
B.transform(o, t)
|
|
830
834
|
);
|
|
831
835
|
const l = r.getValueType();
|
|
832
836
|
l !== void 0 && r.setValueType(
|
|
833
|
-
|
|
837
|
+
B.transform(l, t)
|
|
834
838
|
);
|
|
835
|
-
const
|
|
836
|
-
if (
|
|
837
|
-
const y =
|
|
838
|
-
(d) =>
|
|
839
|
+
const a = r.getItems();
|
|
840
|
+
if (a !== void 0) {
|
|
841
|
+
const y = a.map(
|
|
842
|
+
(d) => B.transform(d, t)
|
|
839
843
|
);
|
|
840
844
|
r.setItems(y);
|
|
841
845
|
}
|
|
842
846
|
const u = r.getProperties();
|
|
843
847
|
if (u !== void 0) {
|
|
844
848
|
const y = Object.keys(u).reduce(
|
|
845
|
-
(d,
|
|
849
|
+
(d, f) => (d[f] = B.transform(u[f], t), d),
|
|
846
850
|
{}
|
|
847
851
|
);
|
|
848
852
|
r.setProperties(y);
|
|
@@ -850,12 +854,12 @@ class w {
|
|
|
850
854
|
return r;
|
|
851
855
|
}
|
|
852
856
|
}
|
|
853
|
-
const F = (s) => !!s && typeof s == "object" && !Array.isArray(s) && !(s instanceof
|
|
854
|
-
function
|
|
857
|
+
const F = (s) => !!s && typeof s == "object" && !Array.isArray(s) && !(s instanceof c), O = (s) => s instanceof E || s instanceof S, $r = (s) => s.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
858
|
+
function oe(s) {
|
|
855
859
|
if (s === "/") return [];
|
|
856
860
|
if (!s.startsWith("/"))
|
|
857
861
|
throw new Error(`Path must start with '/': ${s}`);
|
|
858
|
-
return s.split("/").slice(1).map(
|
|
862
|
+
return s.split("/").slice(1).map($r);
|
|
859
863
|
}
|
|
860
864
|
function se(s) {
|
|
861
865
|
if (s === "-") return -1;
|
|
@@ -868,7 +872,7 @@ function se(s) {
|
|
|
868
872
|
);
|
|
869
873
|
return e;
|
|
870
874
|
}
|
|
871
|
-
function
|
|
875
|
+
function Ut(s, e, t, r = !0) {
|
|
872
876
|
switch (e) {
|
|
873
877
|
case "name":
|
|
874
878
|
return t ? r ? s.getName() ?? null : s : s.getName();
|
|
@@ -892,15 +896,15 @@ function jt(s, e, t, r = !0) {
|
|
|
892
896
|
return s.getItems();
|
|
893
897
|
case "properties":
|
|
894
898
|
return s.getProperties();
|
|
895
|
-
case
|
|
899
|
+
case V:
|
|
896
900
|
return s.getContracts();
|
|
897
901
|
default:
|
|
898
902
|
return;
|
|
899
903
|
}
|
|
900
904
|
}
|
|
901
|
-
function
|
|
902
|
-
if (s instanceof
|
|
903
|
-
const r =
|
|
905
|
+
function It(s, e, t = !0) {
|
|
906
|
+
if (s instanceof c) {
|
|
907
|
+
const r = Ut(
|
|
904
908
|
s,
|
|
905
909
|
e,
|
|
906
910
|
!0,
|
|
@@ -918,7 +922,7 @@ function mt(s, e, t = !0) {
|
|
|
918
922
|
"blue",
|
|
919
923
|
"items",
|
|
920
924
|
"properties",
|
|
921
|
-
|
|
925
|
+
V
|
|
922
926
|
].includes(e))
|
|
923
927
|
return r;
|
|
924
928
|
if (/^-?\d+$/.test(e) && e !== "-") {
|
|
@@ -935,7 +939,7 @@ function mt(s, e, t = !0) {
|
|
|
935
939
|
}
|
|
936
940
|
if (F(s)) return s[e];
|
|
937
941
|
}
|
|
938
|
-
function
|
|
942
|
+
function le(s, e) {
|
|
939
943
|
if (e.length === 0)
|
|
940
944
|
return {
|
|
941
945
|
parent: s,
|
|
@@ -944,29 +948,29 @@ function oe(s, e) {
|
|
|
944
948
|
};
|
|
945
949
|
let t = s;
|
|
946
950
|
for (let n = 0; n < e.length - 1; ++n) {
|
|
947
|
-
const i = e[n], o =
|
|
951
|
+
const i = e[n], o = It(t, i);
|
|
948
952
|
if (o === void 0)
|
|
949
953
|
throw new Error(`Cannot resolve '/${e.slice(0, n + 1).join("/")}'`);
|
|
950
954
|
t = o;
|
|
951
955
|
}
|
|
952
956
|
const r = e[e.length - 1];
|
|
953
|
-
if (t instanceof
|
|
954
|
-
const n =
|
|
955
|
-
if ((typeof n != "object" || n === null || O(n)) && !(n instanceof
|
|
957
|
+
if (t instanceof c) {
|
|
958
|
+
const n = It(t, r, !1);
|
|
959
|
+
if ((typeof n != "object" || n === null || O(n)) && !(n instanceof c) && !Array.isArray(n) && ["name", "description", "value", "blueId"].includes(r))
|
|
956
960
|
return {
|
|
957
961
|
parent: t,
|
|
958
962
|
key: r,
|
|
959
963
|
actualTarget: n
|
|
960
964
|
};
|
|
961
965
|
}
|
|
962
|
-
return Array.isArray(t) && r === "-" ? { parent: t, key: "-" } : t instanceof
|
|
966
|
+
return Array.isArray(t) && r === "-" ? { parent: t, key: "-" } : t instanceof c && t.getItems() && r === "-" ? { parent: t, key: "-" } : {
|
|
963
967
|
parent: t,
|
|
964
968
|
key: Array.isArray(t) ? se(r) : r
|
|
965
969
|
};
|
|
966
970
|
}
|
|
967
971
|
function ct(s, e) {
|
|
968
|
-
if (s instanceof
|
|
969
|
-
const t = e, r =
|
|
972
|
+
if (s instanceof c) {
|
|
973
|
+
const t = e, r = Ut(s, t, !1);
|
|
970
974
|
if (r !== void 0 || [
|
|
971
975
|
"name",
|
|
972
976
|
"description",
|
|
@@ -979,7 +983,7 @@ function ct(s, e) {
|
|
|
979
983
|
"blue",
|
|
980
984
|
"items",
|
|
981
985
|
"properties",
|
|
982
|
-
|
|
986
|
+
V
|
|
983
987
|
].includes(t))
|
|
984
988
|
return r;
|
|
985
989
|
if (typeof e == "number" || typeof e == "string" && /^\d+$/.test(e)) {
|
|
@@ -991,23 +995,23 @@ function ct(s, e) {
|
|
|
991
995
|
return Array.isArray(s) || F(s) ? s[e] : s;
|
|
992
996
|
}
|
|
993
997
|
function P(s) {
|
|
994
|
-
if (s instanceof
|
|
998
|
+
if (s instanceof c) return s;
|
|
995
999
|
if (s === null || typeof s == "string" || typeof s == "number" || typeof s == "boolean" || O(s))
|
|
996
1000
|
return g.deserialize(s);
|
|
997
|
-
const e =
|
|
1001
|
+
const e = We(s);
|
|
998
1002
|
return g.deserialize(e);
|
|
999
1003
|
}
|
|
1000
|
-
function
|
|
1004
|
+
function We(s) {
|
|
1001
1005
|
if (s === void 0) return null;
|
|
1002
1006
|
if (s === null || typeof s != "object") return s;
|
|
1003
|
-
if (Array.isArray(s)) return s.map(
|
|
1007
|
+
if (Array.isArray(s)) return s.map(We);
|
|
1004
1008
|
const e = {};
|
|
1005
1009
|
for (const [t, r] of Object.entries(s))
|
|
1006
|
-
e[t] =
|
|
1010
|
+
e[t] = We(r);
|
|
1007
1011
|
return e;
|
|
1008
1012
|
}
|
|
1009
|
-
function
|
|
1010
|
-
if (s instanceof
|
|
1013
|
+
function ut(s, e, t) {
|
|
1014
|
+
if (s instanceof c) {
|
|
1011
1015
|
const r = e;
|
|
1012
1016
|
switch (r) {
|
|
1013
1017
|
case "name":
|
|
@@ -1018,22 +1022,22 @@ function at(s, e, t) {
|
|
|
1018
1022
|
return;
|
|
1019
1023
|
case "type":
|
|
1020
1024
|
s.setType(
|
|
1021
|
-
t instanceof
|
|
1025
|
+
t instanceof c || typeof t == "string" || t === void 0 ? t : P(t)
|
|
1022
1026
|
);
|
|
1023
1027
|
return;
|
|
1024
1028
|
case "itemType":
|
|
1025
1029
|
s.setItemType(
|
|
1026
|
-
t instanceof
|
|
1030
|
+
t instanceof c || typeof t == "string" || t === void 0 ? t : P(t)
|
|
1027
1031
|
);
|
|
1028
1032
|
return;
|
|
1029
1033
|
case "keyType":
|
|
1030
1034
|
s.setKeyType(
|
|
1031
|
-
t instanceof
|
|
1035
|
+
t instanceof c || typeof t == "string" || t === void 0 ? t : P(t)
|
|
1032
1036
|
);
|
|
1033
1037
|
return;
|
|
1034
1038
|
case "valueType":
|
|
1035
1039
|
s.setValueType(
|
|
1036
|
-
t instanceof
|
|
1040
|
+
t instanceof c || typeof t == "string" || t === void 0 ? t : P(t)
|
|
1037
1041
|
);
|
|
1038
1042
|
return;
|
|
1039
1043
|
case "value": {
|
|
@@ -1046,7 +1050,7 @@ function at(s, e, t) {
|
|
|
1046
1050
|
return;
|
|
1047
1051
|
case "blue":
|
|
1048
1052
|
s.setBlue(
|
|
1049
|
-
t instanceof
|
|
1053
|
+
t instanceof c || t === void 0 ? t : P(t)
|
|
1050
1054
|
);
|
|
1051
1055
|
return;
|
|
1052
1056
|
case "items":
|
|
@@ -1055,7 +1059,7 @@ function at(s, e, t) {
|
|
|
1055
1059
|
case "properties":
|
|
1056
1060
|
s.setProperties(t);
|
|
1057
1061
|
return;
|
|
1058
|
-
case
|
|
1062
|
+
case V:
|
|
1059
1063
|
s.setContracts(t);
|
|
1060
1064
|
return;
|
|
1061
1065
|
default: {
|
|
@@ -1063,14 +1067,14 @@ function at(s, e, t) {
|
|
|
1063
1067
|
const n = s.getProperties();
|
|
1064
1068
|
n && r in n && delete n[r];
|
|
1065
1069
|
} else
|
|
1066
|
-
s.getProperties() || s.setProperties({}), s.addProperty(r, t instanceof
|
|
1070
|
+
s.getProperties() || s.setProperties({}), s.addProperty(r, t instanceof c ? t : P(t));
|
|
1067
1071
|
return;
|
|
1068
1072
|
}
|
|
1069
1073
|
}
|
|
1070
1074
|
}
|
|
1071
1075
|
Array.isArray(s) ? s.splice(se(e), 1) : F(s) && (t === void 0 ? delete s[e] : s[e] = t);
|
|
1072
1076
|
}
|
|
1073
|
-
function
|
|
1077
|
+
function _r(s, e, t, r) {
|
|
1074
1078
|
let n = -1;
|
|
1075
1079
|
if (e !== "-" && (n = typeof e == "number" ? e : parseInt(e, 10), isNaN(n)))
|
|
1076
1080
|
throw new Error(
|
|
@@ -1096,7 +1100,7 @@ function $r(s, e, t, r) {
|
|
|
1096
1100
|
} else
|
|
1097
1101
|
i.splice(n, 0, t);
|
|
1098
1102
|
}
|
|
1099
|
-
function
|
|
1103
|
+
function Ae(s, e, t, r) {
|
|
1100
1104
|
if (Array.isArray(s)) {
|
|
1101
1105
|
const n = e === "-" ? s.length : se(e);
|
|
1102
1106
|
if (!r && n > s.length)
|
|
@@ -1117,8 +1121,8 @@ function Ve(s, e, t, r) {
|
|
|
1117
1121
|
s.splice(n, 0, i);
|
|
1118
1122
|
return;
|
|
1119
1123
|
}
|
|
1120
|
-
if (s instanceof
|
|
1121
|
-
e === "-" || typeof e == "number" && !isNaN(e) || typeof e == "string" && /^\d+$/.test(e) ?
|
|
1124
|
+
if (s instanceof c) {
|
|
1125
|
+
e === "-" || typeof e == "number" && !isNaN(e) || typeof e == "string" && /^\d+$/.test(e) ? _r(s, e, P(t), r) : ut(s, e, t);
|
|
1122
1126
|
return;
|
|
1123
1127
|
}
|
|
1124
1128
|
if (F(s)) {
|
|
@@ -1127,13 +1131,13 @@ function Ve(s, e, t, r) {
|
|
|
1127
1131
|
}
|
|
1128
1132
|
throw new Error(`Cannot insert into parent of type ${typeof s}`);
|
|
1129
1133
|
}
|
|
1130
|
-
function
|
|
1134
|
+
function jr(s, e) {
|
|
1131
1135
|
if (Array.isArray(s)) {
|
|
1132
1136
|
const t = se(e);
|
|
1133
1137
|
t === -1 && e === "-" ? s.length > 0 && s.pop() : t >= 0 && t < s.length && s.splice(t, 1);
|
|
1134
1138
|
return;
|
|
1135
1139
|
}
|
|
1136
|
-
if (s instanceof
|
|
1140
|
+
if (s instanceof c) {
|
|
1137
1141
|
if (typeof e == "number" || typeof e == "string" && /^-?\d+$/.test(e)) {
|
|
1138
1142
|
const t = s.getItems();
|
|
1139
1143
|
if (t) {
|
|
@@ -1142,25 +1146,25 @@ function _r(s, e) {
|
|
|
1142
1146
|
return;
|
|
1143
1147
|
}
|
|
1144
1148
|
}
|
|
1145
|
-
|
|
1149
|
+
ut(s, e, void 0);
|
|
1146
1150
|
} else F(s) && delete s[e];
|
|
1147
1151
|
}
|
|
1148
|
-
function
|
|
1149
|
-
if (s instanceof
|
|
1152
|
+
function Ze(s) {
|
|
1153
|
+
if (s instanceof c) return s.clone();
|
|
1150
1154
|
if (Array.isArray(s))
|
|
1151
|
-
return s.map((t) =>
|
|
1155
|
+
return s.map((t) => Ze(t));
|
|
1152
1156
|
if (F(s)) {
|
|
1153
1157
|
const e = {};
|
|
1154
1158
|
return Object.keys(s).forEach((t) => {
|
|
1155
|
-
e[t] =
|
|
1159
|
+
e[t] = Ze(s[t]);
|
|
1156
1160
|
}), e;
|
|
1157
1161
|
}
|
|
1158
1162
|
return s;
|
|
1159
1163
|
}
|
|
1160
1164
|
function Y(s, e) {
|
|
1161
|
-
if (s === e || s instanceof
|
|
1165
|
+
if (s === e || s instanceof c && (s.isInlineValue() || s.getValue() !== void 0) && Y(s.getValue() ?? null, e) || e instanceof c && (e.isInlineValue() || e.getValue() !== void 0) && Y(s, e.getValue() ?? null))
|
|
1162
1166
|
return !0;
|
|
1163
|
-
if (s instanceof
|
|
1167
|
+
if (s instanceof c && e instanceof c || O(s) && O(e) || O(s) && typeof e == "number" || typeof s == "number" && O(e))
|
|
1164
1168
|
return s.toString() === e.toString();
|
|
1165
1169
|
if (Array.isArray(s) && Array.isArray(e))
|
|
1166
1170
|
return s.length === e.length && s.every((t, r) => Y(t, e[r]));
|
|
@@ -1170,22 +1174,22 @@ function Y(s, e) {
|
|
|
1170
1174
|
}
|
|
1171
1175
|
return !1;
|
|
1172
1176
|
}
|
|
1173
|
-
function
|
|
1174
|
-
const { parent: t, key: r } =
|
|
1177
|
+
function kt(s, e) {
|
|
1178
|
+
const { parent: t, key: r } = le(s, oe(e));
|
|
1175
1179
|
return ct(t, r);
|
|
1176
1180
|
}
|
|
1177
|
-
function
|
|
1178
|
-
const r =
|
|
1181
|
+
function Kt(s, e, t) {
|
|
1182
|
+
const r = oe(e);
|
|
1179
1183
|
if (r.length === 0 && e === "/") {
|
|
1180
1184
|
const o = P(t);
|
|
1181
1185
|
s.setValue(o.getValue() ?? null), o.getItems() ? s.setItems(o.getItems()) : s.setItems(void 0);
|
|
1182
1186
|
return;
|
|
1183
1187
|
}
|
|
1184
|
-
const { parent: n, key: i } =
|
|
1185
|
-
|
|
1188
|
+
const { parent: n, key: i } = le(s, r);
|
|
1189
|
+
Ae(n, i, t, !0);
|
|
1186
1190
|
}
|
|
1187
1191
|
function Lr(s, e, t) {
|
|
1188
|
-
const r =
|
|
1192
|
+
const r = oe(e);
|
|
1189
1193
|
if (r.length === 0 && e === "/") {
|
|
1190
1194
|
if (s.getItems() && Array.isArray(t)) {
|
|
1191
1195
|
const o = P(t);
|
|
@@ -1196,52 +1200,52 @@ function Lr(s, e, t) {
|
|
|
1196
1200
|
}
|
|
1197
1201
|
return !0;
|
|
1198
1202
|
}
|
|
1199
|
-
const { parent: n, key: i } =
|
|
1200
|
-
return
|
|
1203
|
+
const { parent: n, key: i } = le(s, r);
|
|
1204
|
+
return Ae(n, i, t, !1), !0;
|
|
1201
1205
|
}
|
|
1202
|
-
function
|
|
1203
|
-
const r =
|
|
1206
|
+
function Ur(s, e, t) {
|
|
1207
|
+
const r = oe(e);
|
|
1204
1208
|
if (r.length === 0 && e === "/") {
|
|
1205
1209
|
const l = P(t);
|
|
1206
1210
|
return s.setValue(l.getValue() ?? null), l.getItems() ? s.setItems(l.getItems()) : s.setItems(void 0), !0;
|
|
1207
1211
|
}
|
|
1208
|
-
const { parent: n, key: i, actualTarget: o } =
|
|
1209
|
-
if (o !== void 0 && n instanceof
|
|
1210
|
-
|
|
1212
|
+
const { parent: n, key: i, actualTarget: o } = le(s, r);
|
|
1213
|
+
if (o !== void 0 && n instanceof c)
|
|
1214
|
+
ut(n, i, t);
|
|
1211
1215
|
else {
|
|
1212
|
-
const l = ct(n, i),
|
|
1216
|
+
const l = ct(n, i), a = Array.isArray(n) || n instanceof c && n.getItems() && (typeof i == "number" || typeof i == "string" && /^\d+$/.test(i));
|
|
1213
1217
|
if (l === void 0) {
|
|
1214
|
-
if (
|
|
1218
|
+
if (a)
|
|
1215
1219
|
throw new Error(
|
|
1216
1220
|
`REPLACE failed: Target array index '${i.toString()}' is out of bounds or does not exist at path '${e}'.`
|
|
1217
1221
|
);
|
|
1218
|
-
|
|
1222
|
+
Ae(n, i, t, !0);
|
|
1219
1223
|
} else
|
|
1220
|
-
|
|
1224
|
+
Ae(n, i, t, !0);
|
|
1221
1225
|
}
|
|
1222
1226
|
return !0;
|
|
1223
1227
|
}
|
|
1224
|
-
function
|
|
1225
|
-
const t =
|
|
1228
|
+
function Yt(s, e) {
|
|
1229
|
+
const t = oe(e);
|
|
1226
1230
|
if (t.length === 0 && e === "/")
|
|
1227
1231
|
return s.setValue(null), s.setItems(void 0), s.setProperties(void 0), !0;
|
|
1228
|
-
const { parent: r, key: n } =
|
|
1229
|
-
return
|
|
1230
|
-
}
|
|
1231
|
-
function Ur(s, e, t) {
|
|
1232
|
-
const r = He(Ut(s, e));
|
|
1233
|
-
return kt(s, t, r), !0;
|
|
1232
|
+
const { parent: r, key: n } = le(s, t);
|
|
1233
|
+
return jr(r, n), !0;
|
|
1234
1234
|
}
|
|
1235
1235
|
function kr(s, e, t) {
|
|
1236
|
-
const r =
|
|
1236
|
+
const r = Ze(kt(s, e));
|
|
1237
|
+
return Kt(s, t, r), !0;
|
|
1238
|
+
}
|
|
1239
|
+
function Kr(s, e, t) {
|
|
1240
|
+
const r = oe(e), { parent: n, key: i } = le(s, r), o = ct(n, i);
|
|
1237
1241
|
if (o === void 0)
|
|
1238
1242
|
throw new Error(`MOVE failed: 'from' location '${e}' does not exist.`);
|
|
1239
|
-
return
|
|
1243
|
+
return Yt(s, e) ? (Kt(s, t, o), !0) : !1;
|
|
1240
1244
|
}
|
|
1241
|
-
function
|
|
1242
|
-
const r =
|
|
1245
|
+
function Yr(s, e, t) {
|
|
1246
|
+
const r = kt(s, e);
|
|
1243
1247
|
let n = t;
|
|
1244
|
-
if (r instanceof
|
|
1248
|
+
if (r instanceof c)
|
|
1245
1249
|
if ((t === null || typeof t == "string" || typeof t == "number" || typeof t == "boolean" || O(t)) && (r.isInlineValue() || r.getValue() !== void 0)) {
|
|
1246
1250
|
if (!Y(r.getValue() ?? null, t))
|
|
1247
1251
|
throw new Error(
|
|
@@ -1250,7 +1254,7 @@ function Kr(s, e, t) {
|
|
|
1250
1254
|
)}, got ${JSON.stringify(r.getValue() ?? null)}`
|
|
1251
1255
|
);
|
|
1252
1256
|
return !0;
|
|
1253
|
-
} else typeof t == "object" && !(t instanceof
|
|
1257
|
+
} else typeof t == "object" && !(t instanceof c) && (n = P(t));
|
|
1254
1258
|
else if (O(r) && typeof t == "number")
|
|
1255
1259
|
r instanceof E ? n = new E(t.toString()) : r instanceof S && (n = new S(t.toString()));
|
|
1256
1260
|
else if ((r === null || typeof r == "string" || typeof r == "number" || typeof r == "boolean") && O(t)) {
|
|
@@ -1258,98 +1262,98 @@ function Kr(s, e, t) {
|
|
|
1258
1262
|
!Y(r, i.toString()) && (typeof r == "number" && parseFloat(i.toString()));
|
|
1259
1263
|
}
|
|
1260
1264
|
if (!Y(r, n)) {
|
|
1261
|
-
const i = r instanceof
|
|
1265
|
+
const i = r instanceof c ? r.toString() : JSON.stringify(r), o = n instanceof c ? n.toString() : JSON.stringify(n);
|
|
1262
1266
|
throw new Error(
|
|
1263
1267
|
`TEST failed at '${e}': Expected ${o}, got ${i}`
|
|
1264
1268
|
);
|
|
1265
1269
|
}
|
|
1266
1270
|
return !0;
|
|
1267
1271
|
}
|
|
1268
|
-
function
|
|
1272
|
+
function zr(s, e) {
|
|
1269
1273
|
switch (e.op) {
|
|
1270
1274
|
case "add":
|
|
1271
1275
|
return Lr(s, e.path, e.val);
|
|
1272
1276
|
case "replace":
|
|
1273
|
-
return
|
|
1277
|
+
return Ur(s, e.path, e.val);
|
|
1274
1278
|
case "remove":
|
|
1275
|
-
return
|
|
1279
|
+
return Yt(s, e.path);
|
|
1276
1280
|
case "copy":
|
|
1277
|
-
return Ur(s, e.from, e.path);
|
|
1278
|
-
case "move":
|
|
1279
1281
|
return kr(s, e.from, e.path);
|
|
1282
|
+
case "move":
|
|
1283
|
+
return Kr(s, e.from, e.path);
|
|
1280
1284
|
case "test":
|
|
1281
|
-
return
|
|
1285
|
+
return Yr(s, e.path, e.val);
|
|
1282
1286
|
}
|
|
1283
1287
|
}
|
|
1284
1288
|
function Kn(s, e, t = !1) {
|
|
1285
1289
|
const r = t ? s : s.clone();
|
|
1286
|
-
return
|
|
1290
|
+
return zr(r, e), r;
|
|
1287
1291
|
}
|
|
1288
1292
|
const ke = Symbol.for("zod-schema-annotations");
|
|
1289
|
-
function
|
|
1293
|
+
function Gr() {
|
|
1290
1294
|
if (typeof globalThis < "u") return globalThis;
|
|
1291
1295
|
if (typeof global < "u") return global;
|
|
1292
1296
|
if (typeof window < "u") return window;
|
|
1293
1297
|
if (typeof self < "u") return self;
|
|
1294
1298
|
throw new Error("Unable to locate global object");
|
|
1295
1299
|
}
|
|
1296
|
-
function
|
|
1297
|
-
const s =
|
|
1300
|
+
function zt() {
|
|
1301
|
+
const s = Gr();
|
|
1298
1302
|
return ke in s || (s[ke] = /* @__PURE__ */ new WeakMap()), s[ke];
|
|
1299
1303
|
}
|
|
1300
1304
|
function Ie(s, e) {
|
|
1301
|
-
const t =
|
|
1305
|
+
const t = zt(), r = t.get(s) || {};
|
|
1302
1306
|
return t.set(s, { ...r, ...e }), s;
|
|
1303
1307
|
}
|
|
1304
|
-
const R = (s) =>
|
|
1308
|
+
const R = (s) => zt().get(s), Jr = (s) => (e) => {
|
|
1305
1309
|
const t = R(e);
|
|
1306
1310
|
return Ie(e, {
|
|
1307
1311
|
...t,
|
|
1308
1312
|
blueDescription: s
|
|
1309
1313
|
});
|
|
1310
|
-
},
|
|
1314
|
+
}, Wr = (s) => {
|
|
1311
1315
|
const e = R(s);
|
|
1312
|
-
return p(e) &&
|
|
1313
|
-
}, Yn = (s) =>
|
|
1316
|
+
return p(e) && tt(e.blueDescription) ? e.blueDescription : null;
|
|
1317
|
+
}, Yn = (s) => Jr(s)(h.string().optional()), Zr = h.union([h.string(), h.boolean()]), Hr = (s) => (e) => {
|
|
1314
1318
|
const t = R(e);
|
|
1315
1319
|
return Ie(e, {
|
|
1316
1320
|
...t,
|
|
1317
1321
|
blueId: s
|
|
1318
1322
|
});
|
|
1319
|
-
},
|
|
1323
|
+
}, Xr = (s) => {
|
|
1320
1324
|
const e = R(s), t = Zr.safeParse(e?.blueId);
|
|
1321
1325
|
return t.success ? t.data : null;
|
|
1322
|
-
}, zn = (s) => Hr(s ?? !0)(
|
|
1326
|
+
}, zn = (s) => Hr(s ?? !0)(h.string()), qr = (s) => (e) => {
|
|
1323
1327
|
const t = R(e);
|
|
1324
1328
|
return Ie(e, {
|
|
1325
1329
|
...t,
|
|
1326
1330
|
blueName: s
|
|
1327
1331
|
});
|
|
1328
|
-
},
|
|
1332
|
+
}, Qr = (s) => {
|
|
1329
1333
|
const e = R(s);
|
|
1330
|
-
return p(e) &&
|
|
1334
|
+
return p(e) && tt(e.blueName) ? e.blueName : null;
|
|
1331
1335
|
}, Gn = (s) => {
|
|
1332
|
-
const e =
|
|
1333
|
-
return
|
|
1334
|
-
},
|
|
1336
|
+
const e = h.string().optional();
|
|
1337
|
+
return qr(s)(e);
|
|
1338
|
+
}, es = () => (s) => {
|
|
1335
1339
|
const e = R(s);
|
|
1336
1340
|
return Ie(s, {
|
|
1337
1341
|
...e,
|
|
1338
1342
|
blueNode: !0
|
|
1339
1343
|
});
|
|
1340
|
-
},
|
|
1344
|
+
}, ts = (s) => {
|
|
1341
1345
|
const e = R(s);
|
|
1342
1346
|
return p(e) && p(e.blueNode) && e.blueNode === !0 ? e.blueNode : null;
|
|
1343
|
-
},
|
|
1344
|
-
const s =
|
|
1345
|
-
return
|
|
1346
|
-
},
|
|
1347
|
-
value:
|
|
1348
|
-
defaultValue:
|
|
1349
|
-
}),
|
|
1350
|
-
const e = R(s), t =
|
|
1347
|
+
}, Gt = (s) => !!ts(s), Jn = () => {
|
|
1348
|
+
const s = h.instanceof(c);
|
|
1349
|
+
return es()(s);
|
|
1350
|
+
}, rs = h.object({
|
|
1351
|
+
value: h.array(h.string()).optional(),
|
|
1352
|
+
defaultValue: h.string().optional()
|
|
1353
|
+
}), ss = (s) => {
|
|
1354
|
+
const e = R(s), t = rs.passthrough().safeParse(e?.typeBlueId);
|
|
1351
1355
|
return t.success ? t.data : null;
|
|
1352
|
-
},
|
|
1356
|
+
}, Wn = (s) => (e) => {
|
|
1353
1357
|
const t = R(e), r = typeof s == "string" ? { value: [s] } : s;
|
|
1354
1358
|
return Ie(e, {
|
|
1355
1359
|
...t,
|
|
@@ -1359,32 +1363,32 @@ const R = (s) => Yt().get(s), Gr = (s) => (e) => {
|
|
|
1359
1363
|
}
|
|
1360
1364
|
});
|
|
1361
1365
|
};
|
|
1362
|
-
class
|
|
1366
|
+
class pe {
|
|
1363
1367
|
static resolveBlueId(e) {
|
|
1364
|
-
const t =
|
|
1368
|
+
const t = ss(e);
|
|
1365
1369
|
if (I(t))
|
|
1366
1370
|
return null;
|
|
1367
1371
|
const r = t.defaultValue;
|
|
1368
1372
|
if (p(r))
|
|
1369
1373
|
return r;
|
|
1370
1374
|
const n = t.value?.[0];
|
|
1371
|
-
return p(n) ? n :
|
|
1375
|
+
return p(n) ? n : pe.getRepositoryBlueId(t, e);
|
|
1372
1376
|
}
|
|
1373
1377
|
static getRepositoryBlueId(e, t) {
|
|
1374
1378
|
throw new Error("Not implemented");
|
|
1375
1379
|
}
|
|
1376
1380
|
}
|
|
1377
|
-
class
|
|
1381
|
+
class A {
|
|
1378
1382
|
// TODO: Enhance to support schemas associated with multiple blueIds
|
|
1379
1383
|
static isTypeOf(e, t, r) {
|
|
1380
|
-
const n =
|
|
1384
|
+
const n = pe.resolveBlueId(t), i = e.getType()?.getBlueId();
|
|
1381
1385
|
if (I(n) || I(i))
|
|
1382
1386
|
return !1;
|
|
1383
1387
|
if (n === i)
|
|
1384
1388
|
return !0;
|
|
1385
1389
|
if (r?.checkSchemaExtensions && p(r.typeSchemaResolver)) {
|
|
1386
1390
|
const o = r.typeSchemaResolver.resolveSchema(e);
|
|
1387
|
-
return
|
|
1391
|
+
return A.checkSchemaExtension(o, t, {
|
|
1388
1392
|
typeSchemaResolver: r.typeSchemaResolver
|
|
1389
1393
|
});
|
|
1390
1394
|
}
|
|
@@ -1396,20 +1400,20 @@ class V {
|
|
|
1396
1400
|
static checkSchemaExtension(e, t, r) {
|
|
1397
1401
|
if (!p(e))
|
|
1398
1402
|
return !1;
|
|
1399
|
-
const n =
|
|
1403
|
+
const n = A.unwrapSchema(e), i = A.unwrapSchema(t);
|
|
1400
1404
|
return p(r?.typeSchemaResolver) ? r.typeSchemaResolver.isSchemaExtendedFrom(
|
|
1401
1405
|
n,
|
|
1402
1406
|
i
|
|
1403
1407
|
) : !1;
|
|
1404
1408
|
}
|
|
1405
1409
|
static isWrapperType(e) {
|
|
1406
|
-
return e instanceof
|
|
1410
|
+
return e instanceof Pt || e instanceof St || e instanceof Ct || e instanceof At || e instanceof Ne || e instanceof Pe;
|
|
1407
1411
|
}
|
|
1408
1412
|
static unwrapSchema(e) {
|
|
1409
|
-
return
|
|
1413
|
+
return Gt(e) ? e : A.isWrapperType(e) ? e instanceof Ne ? A.unwrapSchema(e.innerType()) : e instanceof Pe ? A.unwrapSchema(e.schema) : A.unwrapSchema(e.unwrap()) : e;
|
|
1410
1414
|
}
|
|
1411
1415
|
}
|
|
1412
|
-
function
|
|
1416
|
+
function Tt(s, e) {
|
|
1413
1417
|
const t = s.getType();
|
|
1414
1418
|
if (t === void 0)
|
|
1415
1419
|
return;
|
|
@@ -1419,7 +1423,7 @@ function It(s, e) {
|
|
|
1419
1423
|
r
|
|
1420
1424
|
)) {
|
|
1421
1425
|
const i = xe[r];
|
|
1422
|
-
return new
|
|
1426
|
+
return new c().setBlueId(r).setName(i);
|
|
1423
1427
|
}
|
|
1424
1428
|
const n = e.fetchByBlueId(r);
|
|
1425
1429
|
if (!n || n.length === 0)
|
|
@@ -1432,82 +1436,82 @@ function It(s, e) {
|
|
|
1432
1436
|
}
|
|
1433
1437
|
return t;
|
|
1434
1438
|
}
|
|
1435
|
-
function
|
|
1439
|
+
function w(s, e, t) {
|
|
1436
1440
|
const r = T.calculateBlueIdSync(s), n = T.calculateBlueIdSync(e);
|
|
1437
1441
|
if (r === n)
|
|
1438
1442
|
return !0;
|
|
1439
1443
|
if (r && X.includes(
|
|
1440
1444
|
r
|
|
1441
1445
|
)) {
|
|
1442
|
-
let
|
|
1443
|
-
for (;
|
|
1444
|
-
if (T.calculateBlueIdSync(
|
|
1446
|
+
let a = e;
|
|
1447
|
+
for (; a !== void 0; ) {
|
|
1448
|
+
if (T.calculateBlueIdSync(a) === r)
|
|
1445
1449
|
return !0;
|
|
1446
|
-
|
|
1450
|
+
a = Tt(a, t);
|
|
1447
1451
|
}
|
|
1448
1452
|
return !1;
|
|
1449
1453
|
}
|
|
1450
1454
|
let i = s;
|
|
1451
1455
|
const o = s.getBlueId();
|
|
1452
1456
|
if (o) {
|
|
1453
|
-
const
|
|
1454
|
-
|
|
1457
|
+
const a = t.fetchByBlueId(o);
|
|
1458
|
+
a && a.length === 1 && (i = a[0]);
|
|
1455
1459
|
}
|
|
1456
1460
|
let l = i;
|
|
1457
1461
|
for (; l !== void 0; ) {
|
|
1458
1462
|
if (T.calculateBlueIdSync(l) === n)
|
|
1459
1463
|
return !0;
|
|
1460
|
-
l =
|
|
1464
|
+
l = Tt(l, t);
|
|
1461
1465
|
}
|
|
1462
1466
|
return !1;
|
|
1463
1467
|
}
|
|
1464
|
-
function ss(s, e) {
|
|
1465
|
-
return ot.some((t) => {
|
|
1466
|
-
const r = new a().setBlueId(t);
|
|
1467
|
-
return b(s, r, e);
|
|
1468
|
-
});
|
|
1469
|
-
}
|
|
1470
1468
|
function ns(s, e) {
|
|
1471
|
-
|
|
1472
|
-
|
|
1469
|
+
return lt.some((t) => {
|
|
1470
|
+
const r = new c().setBlueId(t);
|
|
1471
|
+
return w(s, r, e);
|
|
1472
|
+
});
|
|
1473
1473
|
}
|
|
1474
1474
|
function is(s, e) {
|
|
1475
|
-
const t = new
|
|
1476
|
-
return
|
|
1475
|
+
const t = new c().setBlueId(_);
|
|
1476
|
+
return w(s, t, e);
|
|
1477
1477
|
}
|
|
1478
1478
|
function os(s, e) {
|
|
1479
|
-
const t = new
|
|
1480
|
-
return
|
|
1479
|
+
const t = new c().setBlueId(L);
|
|
1480
|
+
return w(s, t, e);
|
|
1481
1481
|
}
|
|
1482
1482
|
function ls(s, e) {
|
|
1483
|
-
const t = new
|
|
1484
|
-
return
|
|
1483
|
+
const t = new c().setBlueId(j);
|
|
1484
|
+
return w(s, t, e);
|
|
1485
1485
|
}
|
|
1486
|
-
function
|
|
1487
|
-
const t = new
|
|
1488
|
-
return
|
|
1486
|
+
function as(s, e) {
|
|
1487
|
+
const t = new c().setBlueId(U);
|
|
1488
|
+
return w(s, t, e);
|
|
1489
1489
|
}
|
|
1490
1490
|
function Jt(s, e) {
|
|
1491
|
-
const t = new
|
|
1492
|
-
return
|
|
1491
|
+
const t = new c().setBlueId(it);
|
|
1492
|
+
return w(s, t, e);
|
|
1493
|
+
}
|
|
1494
|
+
function Wt(s, e) {
|
|
1495
|
+
const t = new c().setBlueId(ot);
|
|
1496
|
+
return w(s, t, e);
|
|
1493
1497
|
}
|
|
1494
1498
|
function cs(s, e) {
|
|
1495
1499
|
return Me.some((t) => {
|
|
1496
|
-
const r = new
|
|
1497
|
-
return
|
|
1500
|
+
const r = new c().setName(t);
|
|
1501
|
+
return w(s, r, e);
|
|
1498
1502
|
});
|
|
1499
1503
|
}
|
|
1500
|
-
function
|
|
1504
|
+
function us(s, e) {
|
|
1501
1505
|
for (const t of Me) {
|
|
1502
|
-
const r = new
|
|
1503
|
-
if (
|
|
1506
|
+
const r = new c().setName(t);
|
|
1507
|
+
if (w(s, r, e))
|
|
1504
1508
|
return t;
|
|
1505
1509
|
}
|
|
1506
1510
|
throw new Error(
|
|
1507
1511
|
`Cannot determine the basic type for node of type "${s.getName() || "unknown"}".`
|
|
1508
1512
|
);
|
|
1509
1513
|
}
|
|
1510
|
-
class
|
|
1514
|
+
class ds {
|
|
1511
1515
|
blueIdMap = /* @__PURE__ */ new Map();
|
|
1512
1516
|
nodeProvider;
|
|
1513
1517
|
constructor(e = [], t) {
|
|
@@ -1518,7 +1522,7 @@ class us {
|
|
|
1518
1522
|
this.registerSchema(t);
|
|
1519
1523
|
}
|
|
1520
1524
|
registerSchema(e) {
|
|
1521
|
-
const t =
|
|
1525
|
+
const t = pe.resolveBlueId(e);
|
|
1522
1526
|
if (p(t)) {
|
|
1523
1527
|
if (this.blueIdMap.has(t))
|
|
1524
1528
|
throw new Error(`Duplicate BlueId value: ${t}`);
|
|
@@ -1542,8 +1546,8 @@ class us {
|
|
|
1542
1546
|
return !0;
|
|
1543
1547
|
if (p(this.nodeProvider))
|
|
1544
1548
|
try {
|
|
1545
|
-
const i = new
|
|
1546
|
-
if (
|
|
1549
|
+
const i = new c().setBlueId(r), o = new c().setBlueId(n);
|
|
1550
|
+
if (w(i, o, this.nodeProvider))
|
|
1547
1551
|
return !0;
|
|
1548
1552
|
} catch {
|
|
1549
1553
|
}
|
|
@@ -1552,7 +1556,7 @@ class us {
|
|
|
1552
1556
|
getBlueIdForSchema(e) {
|
|
1553
1557
|
if (I(e))
|
|
1554
1558
|
return null;
|
|
1555
|
-
const t =
|
|
1559
|
+
const t = pe.resolveBlueId(e);
|
|
1556
1560
|
if (p(t))
|
|
1557
1561
|
return t;
|
|
1558
1562
|
for (const [r, n] of this.blueIdMap)
|
|
@@ -1581,7 +1585,7 @@ const N = {
|
|
|
1581
1585
|
BLUE: "blue",
|
|
1582
1586
|
ITEMS: "items"
|
|
1583
1587
|
};
|
|
1584
|
-
class
|
|
1588
|
+
class dt {
|
|
1585
1589
|
/**
|
|
1586
1590
|
* Check if a node is empty (has no fields set)
|
|
1587
1591
|
*/
|
|
@@ -1613,27 +1617,27 @@ class ut {
|
|
|
1613
1617
|
* Create a text node
|
|
1614
1618
|
*/
|
|
1615
1619
|
static textNode(e) {
|
|
1616
|
-
return new
|
|
1620
|
+
return new c().setType(new c().setBlueId(_)).setValue(e);
|
|
1617
1621
|
}
|
|
1618
1622
|
/**
|
|
1619
1623
|
* Create an integer node
|
|
1620
1624
|
*/
|
|
1621
1625
|
static integerNode(e) {
|
|
1622
1626
|
const t = e instanceof E ? e : new E(e.toString());
|
|
1623
|
-
return new
|
|
1627
|
+
return new c().setType(new c().setBlueId(L)).setValue(t);
|
|
1624
1628
|
}
|
|
1625
1629
|
/**
|
|
1626
1630
|
* Create a double node
|
|
1627
1631
|
*/
|
|
1628
1632
|
static doubleNode(e) {
|
|
1629
1633
|
const t = e instanceof S ? e : new S(e.toString());
|
|
1630
|
-
return new
|
|
1634
|
+
return new c().setType(new c().setBlueId(j)).setValue(t);
|
|
1631
1635
|
}
|
|
1632
1636
|
/**
|
|
1633
1637
|
* Create a boolean node
|
|
1634
1638
|
*/
|
|
1635
1639
|
static booleanNode(e) {
|
|
1636
|
-
return new
|
|
1640
|
+
return new c().setType(new c().setBlueId(U)).setValue(e);
|
|
1637
1641
|
}
|
|
1638
1642
|
/**
|
|
1639
1643
|
* Check if a node has exactly the specified fields
|
|
@@ -1685,11 +1689,11 @@ class ut {
|
|
|
1685
1689
|
}
|
|
1686
1690
|
}
|
|
1687
1691
|
}
|
|
1688
|
-
class
|
|
1692
|
+
class pt {
|
|
1689
1693
|
}
|
|
1690
1694
|
class ce {
|
|
1691
1695
|
static convert(e) {
|
|
1692
|
-
const t = new
|
|
1696
|
+
const t = new He();
|
|
1693
1697
|
return ce.traverseNode(e, "", t), t.build();
|
|
1694
1698
|
}
|
|
1695
1699
|
static traverseNode(e, t, r) {
|
|
@@ -1701,22 +1705,22 @@ class ce {
|
|
|
1701
1705
|
return;
|
|
1702
1706
|
}
|
|
1703
1707
|
if (n)
|
|
1704
|
-
for (const [
|
|
1705
|
-
const y = `${t}/${
|
|
1708
|
+
for (const [a, u] of Object.entries(n)) {
|
|
1709
|
+
const y = `${t}/${a}`;
|
|
1706
1710
|
ce.traverseNode(u, y, r);
|
|
1707
1711
|
}
|
|
1708
1712
|
if (i)
|
|
1709
|
-
for (let
|
|
1710
|
-
const u = `${t}/${
|
|
1711
|
-
ce.traverseNode(i[
|
|
1713
|
+
for (let a = 0; a < i.length; a++) {
|
|
1714
|
+
const u = `${t}/${a}`;
|
|
1715
|
+
ce.traverseNode(i[a], u, r);
|
|
1712
1716
|
}
|
|
1713
1717
|
}
|
|
1714
1718
|
}
|
|
1715
|
-
function
|
|
1719
|
+
function vt(s, e) {
|
|
1716
1720
|
const t = s.split(e), r = [...t].reverse().findIndex((i) => i !== ""), n = r === -1 ? 0 : t.length - r;
|
|
1717
1721
|
return t.slice(0, n);
|
|
1718
1722
|
}
|
|
1719
|
-
class $e extends
|
|
1723
|
+
class $e extends pt {
|
|
1720
1724
|
allowedPaths;
|
|
1721
1725
|
maxDepth;
|
|
1722
1726
|
currentPath = [];
|
|
@@ -1767,7 +1771,7 @@ class $e extends dt {
|
|
|
1767
1771
|
* @returns True if the path matches the allowed path pattern, false otherwise
|
|
1768
1772
|
*/
|
|
1769
1773
|
matchesAllowedPath(e, t) {
|
|
1770
|
-
const r =
|
|
1774
|
+
const r = vt(e, "/"), n = vt(t, "/");
|
|
1771
1775
|
if (n.length > r.length)
|
|
1772
1776
|
return !1;
|
|
1773
1777
|
for (let i = 1; i < n.length; i++)
|
|
@@ -1809,7 +1813,7 @@ class $e extends dt {
|
|
|
1809
1813
|
* @returns The path limits
|
|
1810
1814
|
*/
|
|
1811
1815
|
static withMaxDepth(e) {
|
|
1812
|
-
const t = new
|
|
1816
|
+
const t = new He().setMaxDepth(e);
|
|
1813
1817
|
for (let r = 1; r <= e; r++) {
|
|
1814
1818
|
const n = "/" + Array(r).fill("*").join("/");
|
|
1815
1819
|
t.addPath(n);
|
|
@@ -1822,7 +1826,7 @@ class $e extends dt {
|
|
|
1822
1826
|
* @returns The path limits
|
|
1823
1827
|
*/
|
|
1824
1828
|
static withSinglePath(e) {
|
|
1825
|
-
return new
|
|
1829
|
+
return new He().addPath(e).build();
|
|
1826
1830
|
}
|
|
1827
1831
|
/**
|
|
1828
1832
|
* Creates path limits by analyzing the structure of a node.
|
|
@@ -1832,7 +1836,7 @@ class $e extends dt {
|
|
|
1832
1836
|
return ce.convert(e);
|
|
1833
1837
|
}
|
|
1834
1838
|
}
|
|
1835
|
-
class
|
|
1839
|
+
class He {
|
|
1836
1840
|
allowedPaths = /* @__PURE__ */ new Set();
|
|
1837
1841
|
maxDepth = Number.MAX_SAFE_INTEGER;
|
|
1838
1842
|
/**
|
|
@@ -1859,7 +1863,7 @@ class We {
|
|
|
1859
1863
|
return new $e(this.allowedPaths, this.maxDepth);
|
|
1860
1864
|
}
|
|
1861
1865
|
}
|
|
1862
|
-
class
|
|
1866
|
+
class Xe extends pt {
|
|
1863
1867
|
/**
|
|
1864
1868
|
* Determines if a path segment should be extended - always returns true
|
|
1865
1869
|
* @returns Always true
|
|
@@ -1885,7 +1889,7 @@ class ds extends dt {
|
|
|
1885
1889
|
exitPathSegment() {
|
|
1886
1890
|
}
|
|
1887
1891
|
}
|
|
1888
|
-
class _e extends
|
|
1892
|
+
class _e extends pt {
|
|
1889
1893
|
limits;
|
|
1890
1894
|
/**
|
|
1891
1895
|
* Creates a composite limits with the specified limit strategies
|
|
@@ -1945,7 +1949,7 @@ class _e extends dt {
|
|
|
1945
1949
|
return new _e(e);
|
|
1946
1950
|
}
|
|
1947
1951
|
}
|
|
1948
|
-
const K = new
|
|
1952
|
+
const K = new Xe();
|
|
1949
1953
|
class ps {
|
|
1950
1954
|
blue;
|
|
1951
1955
|
constructor(e) {
|
|
@@ -1955,8 +1959,8 @@ class ps {
|
|
|
1955
1959
|
const n = t.getType();
|
|
1956
1960
|
if (this.matchesImplicitStructure(e, n))
|
|
1957
1961
|
return !0;
|
|
1958
|
-
const i = $e.fromNode(t), o = _e.of(r, i), l = this.extendAndResolve(e, o),
|
|
1959
|
-
return this.verifyMatch(l, t, o) && this.recursiveValueComparison(l,
|
|
1962
|
+
const i = $e.fromNode(t), o = _e.of(r, i), l = this.extendAndResolve(e, o), a = this.blue.resolve(t, o);
|
|
1963
|
+
return this.verifyMatch(l, t, o) && this.recursiveValueComparison(l, a);
|
|
1960
1964
|
}
|
|
1961
1965
|
/**
|
|
1962
1966
|
* Resolves a node with the runtime while preserving any structure that could
|
|
@@ -1976,17 +1980,17 @@ class ps {
|
|
|
1976
1980
|
const r = t.getItems(), n = e.getItems();
|
|
1977
1981
|
if (r && r.length > 0)
|
|
1978
1982
|
if (!n || n.length === 0)
|
|
1979
|
-
e.setItems(r.map((
|
|
1983
|
+
e.setItems(r.map((a) => a.clone()));
|
|
1980
1984
|
else
|
|
1981
|
-
for (let
|
|
1982
|
-
this.restoreMissingStructure(n[
|
|
1985
|
+
for (let a = 0; a < Math.min(n.length, r.length); a++)
|
|
1986
|
+
this.restoreMissingStructure(n[a], r[a]);
|
|
1983
1987
|
const i = t.getProperties();
|
|
1984
1988
|
if (i) {
|
|
1985
|
-
let
|
|
1986
|
-
|
|
1989
|
+
let a = e.getProperties();
|
|
1990
|
+
a || (a = {}, e.setProperties(a));
|
|
1987
1991
|
for (const [u, y] of Object.entries(i)) {
|
|
1988
|
-
const d =
|
|
1989
|
-
d === void 0 ?
|
|
1992
|
+
const d = a[u];
|
|
1993
|
+
d === void 0 ? a[u] = y.clone() : this.restoreMissingStructure(d, y);
|
|
1990
1994
|
}
|
|
1991
1995
|
}
|
|
1992
1996
|
const o = t.getBlueId();
|
|
@@ -2013,7 +2017,7 @@ class ps {
|
|
|
2013
2017
|
);
|
|
2014
2018
|
if (r && !n) {
|
|
2015
2019
|
const d = e.getType();
|
|
2016
|
-
if (!d || !
|
|
2020
|
+
if (!d || !w(
|
|
2017
2021
|
d,
|
|
2018
2022
|
r,
|
|
2019
2023
|
this.blue.getNodeProvider()
|
|
@@ -2022,11 +2026,11 @@ class ps {
|
|
|
2022
2026
|
}
|
|
2023
2027
|
const i = t.getBlueId();
|
|
2024
2028
|
if (!n && i !== void 0) {
|
|
2025
|
-
const d = e.getBlueId(),
|
|
2029
|
+
const d = e.getBlueId(), f = e.getType()?.getBlueId();
|
|
2026
2030
|
if (d !== void 0) {
|
|
2027
2031
|
if (i !== d)
|
|
2028
2032
|
return !1;
|
|
2029
|
-
} else if (
|
|
2033
|
+
} else if (f === void 0 || i !== f)
|
|
2030
2034
|
return !1;
|
|
2031
2035
|
}
|
|
2032
2036
|
const o = t.getValue();
|
|
@@ -2034,7 +2038,7 @@ class ps {
|
|
|
2034
2038
|
const d = e.getValue();
|
|
2035
2039
|
if (d === void 0)
|
|
2036
2040
|
return !1;
|
|
2037
|
-
if (
|
|
2041
|
+
if (C(d) && C(o)) {
|
|
2038
2042
|
if (!d.eq(o))
|
|
2039
2043
|
return !1;
|
|
2040
2044
|
} else if (d !== o)
|
|
@@ -2043,26 +2047,26 @@ class ps {
|
|
|
2043
2047
|
const l = t.getItems();
|
|
2044
2048
|
if (l !== void 0) {
|
|
2045
2049
|
const d = e.getItems() ?? [];
|
|
2046
|
-
for (let
|
|
2047
|
-
if (
|
|
2048
|
-
if (!this.recursiveValueComparison(d[
|
|
2050
|
+
for (let f = 0; f < l.length; f++)
|
|
2051
|
+
if (f < d.length) {
|
|
2052
|
+
if (!this.recursiveValueComparison(d[f], l[f]))
|
|
2049
2053
|
return !1;
|
|
2050
|
-
} else if (this.hasValueInNestedStructure(l[
|
|
2054
|
+
} else if (this.hasValueInNestedStructure(l[f]))
|
|
2051
2055
|
return !1;
|
|
2052
2056
|
}
|
|
2053
|
-
const
|
|
2054
|
-
if (
|
|
2057
|
+
const a = t.getItemType();
|
|
2058
|
+
if (a !== void 0) {
|
|
2055
2059
|
const d = e.getItems() ?? [];
|
|
2056
|
-
for (const
|
|
2057
|
-
if (!this.recursiveValueComparison(
|
|
2060
|
+
for (const f of d)
|
|
2061
|
+
if (!this.recursiveValueComparison(f, a))
|
|
2058
2062
|
return !1;
|
|
2059
2063
|
}
|
|
2060
2064
|
const u = t.getProperties();
|
|
2061
2065
|
if (u !== void 0) {
|
|
2062
2066
|
const d = e.getProperties() ?? {};
|
|
2063
|
-
for (const [
|
|
2064
|
-
if (
|
|
2065
|
-
if (!this.recursiveValueComparison(d[
|
|
2067
|
+
for (const [f, v] of Object.entries(u))
|
|
2068
|
+
if (f in d) {
|
|
2069
|
+
if (!this.recursiveValueComparison(d[f], v))
|
|
2066
2070
|
return !1;
|
|
2067
2071
|
} else if (this.hasValueInNestedStructure(v))
|
|
2068
2072
|
return !1;
|
|
@@ -2070,8 +2074,8 @@ class ps {
|
|
|
2070
2074
|
const y = t.getValueType();
|
|
2071
2075
|
if (y !== void 0) {
|
|
2072
2076
|
const d = Object.values(e.getProperties() ?? {});
|
|
2073
|
-
for (const
|
|
2074
|
-
if (!this.recursiveValueComparison(
|
|
2077
|
+
for (const f of d)
|
|
2078
|
+
if (!this.recursiveValueComparison(f, y))
|
|
2075
2079
|
return !1;
|
|
2076
2080
|
}
|
|
2077
2081
|
return !0;
|
|
@@ -2098,7 +2102,7 @@ class ps {
|
|
|
2098
2102
|
* shape of the requested core list or dictionary type.
|
|
2099
2103
|
*/
|
|
2100
2104
|
matchesImplicitStructure(e, t) {
|
|
2101
|
-
return t === void 0 || e.getType() !== void 0 ? !1 :
|
|
2105
|
+
return t === void 0 || e.getType() !== void 0 ? !1 : Jt(t, this.blue.getNodeProvider()) ? this.isImplicitListStructure(e) : Wt(t, this.blue.getNodeProvider()) ? this.isImplicitDictionaryStructure(e) : !1;
|
|
2102
2106
|
}
|
|
2103
2107
|
isImplicitListStructure(e) {
|
|
2104
2108
|
return e.getItems() !== void 0 && e.getValue() === void 0;
|
|
@@ -2107,26 +2111,26 @@ class ps {
|
|
|
2107
2111
|
return e.getProperties() !== void 0 && e.getValue() === void 0;
|
|
2108
2112
|
}
|
|
2109
2113
|
}
|
|
2110
|
-
const
|
|
2114
|
+
const hs = (s) => s instanceof Pt || s instanceof St || s instanceof Ct || s instanceof At || s instanceof Ne || s instanceof Pe, fs = (s) => s instanceof ee || s instanceof te || s instanceof be || s instanceof we;
|
|
2111
2115
|
class Zt {
|
|
2112
2116
|
static convertValue(e, t) {
|
|
2113
2117
|
const r = e.getType()?.getBlueId(), n = e.getValue();
|
|
2114
|
-
return I(n) ?
|
|
2118
|
+
return I(n) ? fs(t) && dt.isValidValueNode(e) ? this.getDefaultPrimitiveValue(t) : n : _ === r ? this.convertFromString(String(n), t) : j === r || n instanceof S ? this.convertFromBigDecimal(
|
|
2115
2119
|
new S(n?.toString()),
|
|
2116
2120
|
t
|
|
2117
|
-
) :
|
|
2121
|
+
) : L === r || n instanceof E ? this.convertFromBigInteger(
|
|
2118
2122
|
new E(n?.toString()),
|
|
2119
2123
|
t
|
|
2120
2124
|
) : U === r || typeof n == "boolean" ? this.convertFromBoolean(!!n, t) : this.convertFromString(String(n), t);
|
|
2121
2125
|
}
|
|
2122
2126
|
static convertFromString(e, t) {
|
|
2123
|
-
if (!t || t instanceof ee || t instanceof
|
|
2127
|
+
if (!t || t instanceof ee || t instanceof ur || t instanceof dr)
|
|
2124
2128
|
return e;
|
|
2125
2129
|
if (t instanceof te)
|
|
2126
2130
|
return Number(e);
|
|
2127
|
-
if (t instanceof Be)
|
|
2128
|
-
return e.toLowerCase() === "true";
|
|
2129
2131
|
if (t instanceof be)
|
|
2132
|
+
return e.toLowerCase() === "true";
|
|
2133
|
+
if (t instanceof we)
|
|
2130
2134
|
return BigInt(e);
|
|
2131
2135
|
throw new Error(`Cannot convert String to ${t._def.typeName}`);
|
|
2132
2136
|
}
|
|
@@ -2140,20 +2144,20 @@ class Zt {
|
|
|
2140
2144
|
static convertFromBigInteger(e, t) {
|
|
2141
2145
|
if (t instanceof te)
|
|
2142
2146
|
return e.toNumber();
|
|
2143
|
-
if (t instanceof
|
|
2147
|
+
if (t instanceof we)
|
|
2144
2148
|
return BigInt(e.toString());
|
|
2145
2149
|
if (t instanceof ee)
|
|
2146
2150
|
return e.toString();
|
|
2147
2151
|
throw new Error(`Cannot convert Number to ${t._def.typeName}`);
|
|
2148
2152
|
}
|
|
2149
2153
|
static convertFromBoolean(e, t) {
|
|
2150
|
-
if (!t || t instanceof
|
|
2154
|
+
if (!t || t instanceof be)
|
|
2151
2155
|
return e;
|
|
2152
2156
|
if (t instanceof ee)
|
|
2153
2157
|
return e.toString();
|
|
2154
2158
|
if (t instanceof te)
|
|
2155
2159
|
return Number(e);
|
|
2156
|
-
if (t instanceof
|
|
2160
|
+
if (t instanceof we)
|
|
2157
2161
|
return BigInt(e);
|
|
2158
2162
|
throw new Error(`Cannot convert Boolean to ${t._def.typeName}`);
|
|
2159
2163
|
}
|
|
@@ -2161,7 +2165,7 @@ class Zt {
|
|
|
2161
2165
|
if (!e) return null;
|
|
2162
2166
|
if (e instanceof te)
|
|
2163
2167
|
return 0;
|
|
2164
|
-
if (e instanceof
|
|
2168
|
+
if (e instanceof be)
|
|
2165
2169
|
return !1;
|
|
2166
2170
|
if (e instanceof ee)
|
|
2167
2171
|
return "";
|
|
@@ -2183,26 +2187,26 @@ class gs {
|
|
|
2183
2187
|
return this.convertFields(e, t);
|
|
2184
2188
|
}
|
|
2185
2189
|
convertFields(e, t) {
|
|
2186
|
-
if (t instanceof
|
|
2190
|
+
if (t instanceof pr) {
|
|
2187
2191
|
const r = t._def.left, n = t._def.right, i = this.convert(e, r), o = this.convert(e, n);
|
|
2188
2192
|
return { ...i, ...o };
|
|
2189
2193
|
}
|
|
2190
|
-
if (t instanceof
|
|
2194
|
+
if (t instanceof hr)
|
|
2191
2195
|
throw new Error("Union not supported");
|
|
2192
2196
|
if (t instanceof fr)
|
|
2193
2197
|
return Object.keys(t.shape).reduce(
|
|
2194
2198
|
(n, i) => {
|
|
2195
|
-
const o = e.getProperties(), l = t.shape[i],
|
|
2196
|
-
if (p(
|
|
2197
|
-
const v =
|
|
2199
|
+
const o = e.getProperties(), l = t.shape[i], a = Xr(l);
|
|
2200
|
+
if (p(a)) {
|
|
2201
|
+
const v = tt(a) ? a : i, k = o?.[v], q = k ? T.calculateBlueIdSync(k) : void 0;
|
|
2198
2202
|
return n[i] = q, n;
|
|
2199
2203
|
}
|
|
2200
|
-
const u =
|
|
2204
|
+
const u = Qr(l);
|
|
2201
2205
|
if (p(u)) {
|
|
2202
2206
|
const v = o?.[u];
|
|
2203
2207
|
return n[i] = v?.getName(), n;
|
|
2204
2208
|
}
|
|
2205
|
-
const y =
|
|
2209
|
+
const y = Wr(l);
|
|
2206
2210
|
if (p(y)) {
|
|
2207
2211
|
const v = o?.[y];
|
|
2208
2212
|
return n[i] = v?.getDescription(), n;
|
|
@@ -2218,11 +2222,11 @@ class gs {
|
|
|
2218
2222
|
const d = o?.[i];
|
|
2219
2223
|
if (I(d))
|
|
2220
2224
|
return n;
|
|
2221
|
-
const
|
|
2225
|
+
const f = this.nodeToObjectConverter.convert(
|
|
2222
2226
|
d,
|
|
2223
2227
|
l
|
|
2224
2228
|
);
|
|
2225
|
-
return n[i] =
|
|
2229
|
+
return n[i] = f, n;
|
|
2226
2230
|
},
|
|
2227
2231
|
{}
|
|
2228
2232
|
);
|
|
@@ -2266,13 +2270,13 @@ class Ts {
|
|
|
2266
2270
|
p(o) && i.set(G, o);
|
|
2267
2271
|
const l = e.getDescription();
|
|
2268
2272
|
p(l) && i.set(J, l);
|
|
2269
|
-
const
|
|
2270
|
-
return p(
|
|
2271
|
-
const d = new
|
|
2272
|
-
d.setType(new
|
|
2273
|
-
const
|
|
2274
|
-
i.set(
|
|
2275
|
-
}), t instanceof
|
|
2273
|
+
const a = e.getProperties();
|
|
2274
|
+
return p(a) && Object.entries(a).forEach(([u, y]) => {
|
|
2275
|
+
const d = new c().setValue(u);
|
|
2276
|
+
d.setType(new c().setBlueId(_));
|
|
2277
|
+
const f = Zt.convertValue(d, r), v = this.nodeToObjectConverter.convert(y, n);
|
|
2278
|
+
i.set(f, v);
|
|
2279
|
+
}), t instanceof yr ? Object.fromEntries(i) : i;
|
|
2276
2280
|
}
|
|
2277
2281
|
}
|
|
2278
2282
|
class vs {
|
|
@@ -2280,12 +2284,12 @@ class vs {
|
|
|
2280
2284
|
return m.get(e);
|
|
2281
2285
|
}
|
|
2282
2286
|
}
|
|
2283
|
-
class
|
|
2287
|
+
class bs {
|
|
2284
2288
|
convert(e) {
|
|
2285
2289
|
return m.get(e);
|
|
2286
2290
|
}
|
|
2287
2291
|
}
|
|
2288
|
-
class
|
|
2292
|
+
class ws {
|
|
2289
2293
|
constructor(e) {
|
|
2290
2294
|
this.nodeToObjectConverter = e;
|
|
2291
2295
|
}
|
|
@@ -2299,21 +2303,21 @@ class bs {
|
|
|
2299
2303
|
);
|
|
2300
2304
|
}
|
|
2301
2305
|
}
|
|
2302
|
-
const
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2306
|
+
const Bs = h.union([
|
|
2307
|
+
h.literal("ZodString"),
|
|
2308
|
+
h.literal("ZodNumber"),
|
|
2309
|
+
h.literal("ZodBoolean"),
|
|
2310
|
+
h.literal("ZodBigInt"),
|
|
2311
|
+
h.literal("ZodArray"),
|
|
2312
|
+
h.literal("ZodSet"),
|
|
2313
|
+
h.literal("ZodMap"),
|
|
2314
|
+
h.literal("ZodRecord"),
|
|
2315
|
+
h.literal("ZodObject"),
|
|
2316
|
+
h.literal("ZodEnum"),
|
|
2317
|
+
h.literal("ZodNativeEnum"),
|
|
2318
|
+
h.literal("ZodUnknown"),
|
|
2319
|
+
h.literal("ZodAny"),
|
|
2320
|
+
h.literal("ZodTuple")
|
|
2317
2321
|
]);
|
|
2318
2322
|
class Es {
|
|
2319
2323
|
constructor(e) {
|
|
@@ -2324,19 +2328,19 @@ class Es {
|
|
|
2324
2328
|
converters = /* @__PURE__ */ new Map();
|
|
2325
2329
|
complexObjectConverter;
|
|
2326
2330
|
registerConverters() {
|
|
2327
|
-
const e = new ys(), t = new ms(this.nodeToObjectConverter), r = new
|
|
2328
|
-
this.converters.set("ZodString", e), this.converters.set("ZodNumber", e), this.converters.set("ZodBoolean", e), this.converters.set("ZodBigInt", e), this.converters.set("ZodEnum", e), this.converters.set("ZodNativeEnum", e), this.converters.set("ZodUnknown", new vs()), this.converters.set("ZodAny", new
|
|
2331
|
+
const e = new ys(), t = new ms(this.nodeToObjectConverter), r = new ws(this.nodeToObjectConverter), n = new Is(this.nodeToObjectConverter), i = new Ts(this.nodeToObjectConverter);
|
|
2332
|
+
this.converters.set("ZodString", e), this.converters.set("ZodNumber", e), this.converters.set("ZodBoolean", e), this.converters.set("ZodBigInt", e), this.converters.set("ZodEnum", e), this.converters.set("ZodNativeEnum", e), this.converters.set("ZodUnknown", new vs()), this.converters.set("ZodAny", new bs()), this.converters.set("ZodArray", t), this.converters.set("ZodTuple", r), this.converters.set("ZodSet", n), this.converters.set("ZodMap", i), this.converters.set("ZodRecord", i), this.converters.set("ZodObject", this.complexObjectConverter);
|
|
2329
2333
|
}
|
|
2330
2334
|
getConverter(e) {
|
|
2331
2335
|
const t = this.getSchemaTypeName(e);
|
|
2332
2336
|
return this.converters.get(t) ?? this.complexObjectConverter;
|
|
2333
2337
|
}
|
|
2334
2338
|
getSchemaTypeName(e) {
|
|
2335
|
-
if (
|
|
2339
|
+
if (hs(e))
|
|
2336
2340
|
return e instanceof Ne ? this.getSchemaTypeName(e.innerType()) : e instanceof Pe ? this.getSchemaTypeName(e.schema) : this.getSchemaTypeName(e.unwrap());
|
|
2337
2341
|
const t = e._def.typeName;
|
|
2338
2342
|
try {
|
|
2339
|
-
return
|
|
2343
|
+
return Bs.parse(t);
|
|
2340
2344
|
} catch {
|
|
2341
2345
|
throw new Error(`Schema type name ${t} is not supported`);
|
|
2342
2346
|
}
|
|
@@ -2348,11 +2352,11 @@ class Ns {
|
|
|
2348
2352
|
}
|
|
2349
2353
|
converterFactory;
|
|
2350
2354
|
convert(e, t) {
|
|
2351
|
-
const r = this.typeSchemaResolver?.resolveSchema(e), n =
|
|
2352
|
-
if (
|
|
2355
|
+
const r = this.typeSchemaResolver?.resolveSchema(e), n = A.unwrapSchema(t);
|
|
2356
|
+
if (Gt(n))
|
|
2353
2357
|
return e;
|
|
2354
2358
|
let i = n;
|
|
2355
|
-
return
|
|
2359
|
+
return A.checkSchemaExtension(
|
|
2356
2360
|
r,
|
|
2357
2361
|
n,
|
|
2358
2362
|
{ typeSchemaResolver: this.typeSchemaResolver }
|
|
@@ -2364,7 +2368,7 @@ class Ns {
|
|
|
2364
2368
|
}
|
|
2365
2369
|
class Ht {
|
|
2366
2370
|
reverse(e) {
|
|
2367
|
-
const t = new
|
|
2371
|
+
const t = new c();
|
|
2368
2372
|
return this.reverseNode(t, e, e.getType()), t;
|
|
2369
2373
|
}
|
|
2370
2374
|
reverseNode(e, t, r) {
|
|
@@ -2379,8 +2383,8 @@ class Ht {
|
|
|
2379
2383
|
}
|
|
2380
2384
|
reverseTypeReferences(e, t, r) {
|
|
2381
2385
|
const n = (i, o) => {
|
|
2382
|
-
const l = i(t),
|
|
2383
|
-
p(u) && (I(
|
|
2386
|
+
const l = i(t), a = r ? i(r) : void 0, u = l?.getBlueId();
|
|
2387
|
+
p(u) && (I(a?.getBlueId()) || u !== a.getBlueId()) && o(e, new c().setBlueId(u));
|
|
2384
2388
|
};
|
|
2385
2389
|
n(
|
|
2386
2390
|
(i) => i.getType(),
|
|
@@ -2402,13 +2406,13 @@ class Ht {
|
|
|
2402
2406
|
return;
|
|
2403
2407
|
const i = r?.getItems(), o = [];
|
|
2404
2408
|
if (p(i) && i.length > 0) {
|
|
2405
|
-
const
|
|
2406
|
-
o.push(new
|
|
2409
|
+
const a = T.calculateBlueIdSync(i);
|
|
2410
|
+
o.push(new c().setBlueId(a));
|
|
2407
2411
|
}
|
|
2408
2412
|
const l = i?.length || 0;
|
|
2409
|
-
for (let
|
|
2410
|
-
const u = new
|
|
2411
|
-
this.reverseNode(u, n[
|
|
2413
|
+
for (let a = l; a < n.length; a++) {
|
|
2414
|
+
const u = new c();
|
|
2415
|
+
this.reverseNode(u, n[a], void 0), o.push(u);
|
|
2412
2416
|
}
|
|
2413
2417
|
o.length > 0 && e.setItems(o);
|
|
2414
2418
|
}
|
|
@@ -2418,12 +2422,12 @@ class Ht {
|
|
|
2418
2422
|
return;
|
|
2419
2423
|
const i = {};
|
|
2420
2424
|
for (const [o, l] of Object.entries(n)) {
|
|
2421
|
-
const
|
|
2425
|
+
const a = this.getInheritedProperty(
|
|
2422
2426
|
o,
|
|
2423
2427
|
t,
|
|
2424
2428
|
r
|
|
2425
|
-
), u = new
|
|
2426
|
-
this.reverseNode(u, l,
|
|
2429
|
+
), u = new c();
|
|
2430
|
+
this.reverseNode(u, l, a), dt.isEmptyNode(u) || (i[o] = u);
|
|
2427
2431
|
}
|
|
2428
2432
|
Object.keys(i).length > 0 && e.setProperties(i);
|
|
2429
2433
|
}
|
|
@@ -2450,20 +2454,20 @@ class Ht {
|
|
|
2450
2454
|
p(o) && r.setItemType(o.clone());
|
|
2451
2455
|
const l = t.getKeyType();
|
|
2452
2456
|
p(l) && r.setKeyType(l.clone());
|
|
2453
|
-
const
|
|
2454
|
-
p(
|
|
2457
|
+
const a = t.getValueType();
|
|
2458
|
+
p(a) && r.setValueType(a.clone());
|
|
2455
2459
|
const u = t.getProperties();
|
|
2456
2460
|
if (p(u)) {
|
|
2457
2461
|
const d = r.getProperties() || {};
|
|
2458
|
-
for (const [
|
|
2459
|
-
d[
|
|
2462
|
+
for (const [f, v] of Object.entries(u))
|
|
2463
|
+
d[f] = v.clone();
|
|
2460
2464
|
r.setProperties(d);
|
|
2461
2465
|
}
|
|
2462
2466
|
const y = t.getItems();
|
|
2463
2467
|
return p(y) && r.setItems(y.map((d) => d.clone())), r;
|
|
2464
2468
|
}
|
|
2465
2469
|
}
|
|
2466
|
-
class
|
|
2470
|
+
class ne extends c {
|
|
2467
2471
|
/**
|
|
2468
2472
|
* Creates a new ResolvedBlueNode from a resolved BlueNode
|
|
2469
2473
|
* @param resolvedNode - The fully resolved node after merge operations
|
|
@@ -2497,7 +2501,16 @@ class pe extends a {
|
|
|
2497
2501
|
*/
|
|
2498
2502
|
clone() {
|
|
2499
2503
|
const e = super.clone();
|
|
2500
|
-
return new
|
|
2504
|
+
return new ne(e);
|
|
2505
|
+
}
|
|
2506
|
+
/**
|
|
2507
|
+
* Creates a shallow clone of this ResolvedBlueNode while preserving
|
|
2508
|
+
* the resolved marker type.
|
|
2509
|
+
* @returns A new ResolvedBlueNode with shallow-copied containers
|
|
2510
|
+
*/
|
|
2511
|
+
cloneShallow() {
|
|
2512
|
+
const e = super.cloneShallow();
|
|
2513
|
+
return new ne(e);
|
|
2501
2514
|
}
|
|
2502
2515
|
/**
|
|
2503
2516
|
* Copies all properties from another BlueNode
|
|
@@ -2529,34 +2542,34 @@ function Ps(s) {
|
|
|
2529
2542
|
}
|
|
2530
2543
|
}();
|
|
2531
2544
|
}
|
|
2532
|
-
const Ke =
|
|
2545
|
+
const Ke = H.types.float.options, Ss = {
|
|
2533
2546
|
...Ke,
|
|
2534
2547
|
construct: (s) => {
|
|
2535
2548
|
const e = s.replace(/_/g, "").toLowerCase();
|
|
2536
|
-
if (!
|
|
2549
|
+
if (!Nt(e))
|
|
2537
2550
|
return new S(e);
|
|
2538
2551
|
if (Ke.construct)
|
|
2539
2552
|
return Ke.construct(s);
|
|
2540
2553
|
}
|
|
2541
|
-
},
|
|
2554
|
+
}, Cs = new H.Type("tag:yaml.org,2002:float", Ss), Ye = H.types.int.options, As = {
|
|
2542
2555
|
...Ye,
|
|
2543
2556
|
construct: (s) => {
|
|
2544
2557
|
let e = s;
|
|
2545
|
-
if (e.indexOf("_") !== -1 && (e = e.replace(/_/g, "")), !
|
|
2558
|
+
if (e.indexOf("_") !== -1 && (e = e.replace(/_/g, "")), !Nt(e))
|
|
2546
2559
|
return new E(e);
|
|
2547
2560
|
if (Ye.construct)
|
|
2548
2561
|
return Ye.construct(s);
|
|
2549
2562
|
}
|
|
2550
|
-
},
|
|
2551
|
-
implicit: [
|
|
2563
|
+
}, Vs = new H.Type("tag:yaml.org,2002:int", As), Xt = H.CORE_SCHEMA.extend({
|
|
2564
|
+
implicit: [Cs, Vs]
|
|
2552
2565
|
}), $ = (s) => {
|
|
2553
|
-
const e =
|
|
2566
|
+
const e = H.load(s, { schema: Xt });
|
|
2554
2567
|
return e === void 0 ? void 0 : e;
|
|
2555
|
-
}, Rs = (s) =>
|
|
2556
|
-
schema:
|
|
2568
|
+
}, Rs = (s) => H.dump(s, {
|
|
2569
|
+
schema: Xt,
|
|
2557
2570
|
replacer: (e, t) => {
|
|
2558
|
-
if (
|
|
2559
|
-
if (
|
|
2571
|
+
if (C(t)) {
|
|
2572
|
+
if (Z(t)) {
|
|
2560
2573
|
const r = new M(Number.MIN_SAFE_INTEGER.toString()), n = new M(Number.MAX_SAFE_INTEGER.toString());
|
|
2561
2574
|
if (t.lt(r) || t.gt(n))
|
|
2562
2575
|
return t.toString();
|
|
@@ -2599,7 +2612,7 @@ class Ds extends Te {
|
|
|
2599
2612
|
return this.nodeProviders;
|
|
2600
2613
|
}
|
|
2601
2614
|
}
|
|
2602
|
-
const
|
|
2615
|
+
const qt = `- type:
|
|
2603
2616
|
blueId: 27B7fuxQCS1VAptiCPc2RMkKoutP5qxkh3uDxZ7dr6Eo
|
|
2604
2617
|
mappings:
|
|
2605
2618
|
Text: DLRQwz7MQeCrzjy9bohPNwtCxKEBbKaMK65KBrwjfG6K
|
|
@@ -2618,7 +2631,7 @@ description: This transformation infers type details for Text, Integer, Number a
|
|
|
2618
2631
|
type:
|
|
2619
2632
|
blueId: Ct1SGRGw1i47qjzm1ruiUdSZofeV6WevPTGuieVvbRS4
|
|
2620
2633
|
description: This transformation replaces`, $s = [
|
|
2621
|
-
|
|
2634
|
+
qt,
|
|
2622
2635
|
Ms,
|
|
2623
2636
|
xs,
|
|
2624
2637
|
Fs
|
|
@@ -2650,8 +2663,8 @@ class _s extends Te {
|
|
|
2650
2663
|
}
|
|
2651
2664
|
}
|
|
2652
2665
|
}
|
|
2653
|
-
class
|
|
2654
|
-
static INSTANCE = new
|
|
2666
|
+
class ht extends Te {
|
|
2667
|
+
static INSTANCE = new ht();
|
|
2655
2668
|
nodeProvider;
|
|
2656
2669
|
constructor() {
|
|
2657
2670
|
super(), this.nodeProvider = new _s();
|
|
@@ -2680,14 +2693,14 @@ class z {
|
|
|
2680
2693
|
let n, i;
|
|
2681
2694
|
const o = Array.isArray(r) && r.length > 1;
|
|
2682
2695
|
if (o) {
|
|
2683
|
-
const l = r.map((
|
|
2684
|
-
const u = g.deserialize(
|
|
2696
|
+
const l = r.map((a) => {
|
|
2697
|
+
const u = g.deserialize(a);
|
|
2685
2698
|
return t(u);
|
|
2686
2699
|
});
|
|
2687
|
-
n = T.calculateBlueIdSync(l), i = l.map((
|
|
2700
|
+
n = T.calculateBlueIdSync(l), i = l.map((a) => m.get(a));
|
|
2688
2701
|
} else {
|
|
2689
|
-
const l = g.deserialize(r),
|
|
2690
|
-
n = T.calculateBlueIdSync(
|
|
2702
|
+
const l = g.deserialize(r), a = t(l);
|
|
2703
|
+
n = T.calculateBlueIdSync(a), i = m.get(a);
|
|
2691
2704
|
}
|
|
2692
2705
|
return new ze(n, i, o);
|
|
2693
2706
|
}
|
|
@@ -2752,7 +2765,7 @@ class z {
|
|
|
2752
2765
|
}
|
|
2753
2766
|
}
|
|
2754
2767
|
}
|
|
2755
|
-
class
|
|
2768
|
+
class js extends Te {
|
|
2756
2769
|
fetchByBlueId(e) {
|
|
2757
2770
|
const t = e.split("#")[0], r = this.fetchContentByBlueId(t);
|
|
2758
2771
|
if (r == null)
|
|
@@ -2767,11 +2780,11 @@ class Ls extends Te {
|
|
|
2767
2780
|
if (o.length > 1) {
|
|
2768
2781
|
const l = parseInt(o[1]);
|
|
2769
2782
|
if (Array.isArray(i) && l < i.length) {
|
|
2770
|
-
const
|
|
2783
|
+
const a = i[l], u = g.deserialize(a);
|
|
2771
2784
|
return u.setBlueId(e), [u];
|
|
2772
2785
|
} else if (l === 0) {
|
|
2773
|
-
const
|
|
2774
|
-
return
|
|
2786
|
+
const a = g.deserialize(i);
|
|
2787
|
+
return a.setBlueId(e), [a];
|
|
2775
2788
|
} else
|
|
2776
2789
|
return null;
|
|
2777
2790
|
}
|
|
@@ -2784,7 +2797,7 @@ class Ls extends Te {
|
|
|
2784
2797
|
}
|
|
2785
2798
|
}
|
|
2786
2799
|
}
|
|
2787
|
-
class
|
|
2800
|
+
class Qt extends js {
|
|
2788
2801
|
nameToBlueIdsMap = /* @__PURE__ */ new Map();
|
|
2789
2802
|
/**
|
|
2790
2803
|
* Find a node by name. Throws an error if multiple nodes are found with the same name.
|
|
@@ -2828,17 +2841,17 @@ class qt extends Ls {
|
|
|
2828
2841
|
]);
|
|
2829
2842
|
}
|
|
2830
2843
|
}
|
|
2831
|
-
const
|
|
2832
|
-
const e =
|
|
2844
|
+
const er = (s) => s instanceof c || Array.isArray(s) && s.every((e) => e instanceof c) ? s : et(s) ? s.map((e) => g.deserialize(e)) : g.deserialize(s), Ls = async (s) => {
|
|
2845
|
+
const e = er(s);
|
|
2833
2846
|
return T.calculateBlueId(e);
|
|
2834
|
-
},
|
|
2835
|
-
const e =
|
|
2847
|
+
}, Zn = (s) => {
|
|
2848
|
+
const e = er(s);
|
|
2836
2849
|
return T.calculateBlueIdSync(e);
|
|
2837
|
-
},
|
|
2838
|
-
if (
|
|
2850
|
+
}, bt = async (s) => {
|
|
2851
|
+
if (Nr(s))
|
|
2839
2852
|
return s;
|
|
2840
2853
|
try {
|
|
2841
|
-
const e =
|
|
2854
|
+
const e = Ce.parse(s), t = await Ls(e);
|
|
2842
2855
|
return {
|
|
2843
2856
|
...s,
|
|
2844
2857
|
blueId: t
|
|
@@ -2846,41 +2859,41 @@ const Qt = (s) => s instanceof a || Array.isArray(s) && s.every((e) => e instanc
|
|
|
2846
2859
|
} catch (e) {
|
|
2847
2860
|
throw new Error(`Failed enriching object with Blue ID: ${e}`);
|
|
2848
2861
|
}
|
|
2849
|
-
},
|
|
2862
|
+
}, Hn = (s) => s?.items, Xn = (s) => s?.value, qn = (s) => I(s) ? {} : Rt(
|
|
2850
2863
|
s,
|
|
2851
|
-
|
|
2852
|
-
), Qn = (s) =>
|
|
2864
|
+
st
|
|
2865
|
+
), Qn = (s) => Sr(s) ? s.type.name ?? null : Cr(s) ? gr(typeof s.value) : Pr(s) ? "List" : null, Us = (s) => p(s) && Object.keys(Rt(s, ["blueId"])).length > 0, ei = (s) => {
|
|
2853
2866
|
try {
|
|
2854
2867
|
const e = g.deserialize(s), t = m.get(e);
|
|
2855
|
-
return
|
|
2868
|
+
return de.parse(t);
|
|
2856
2869
|
} catch (e) {
|
|
2857
2870
|
throw new Error(
|
|
2858
2871
|
`Failed transforming JSON-like value to BlueObject: ${e}`
|
|
2859
2872
|
);
|
|
2860
2873
|
}
|
|
2861
|
-
},
|
|
2874
|
+
}, wt = async (s) => {
|
|
2862
2875
|
const {
|
|
2863
2876
|
resolveFunction: e,
|
|
2864
2877
|
signal: t = new AbortController().signal,
|
|
2865
2878
|
omitItems: r
|
|
2866
2879
|
} = s, n = s.count ?? s.items.length;
|
|
2867
|
-
let i = await
|
|
2880
|
+
let i = await mr(s.items, async (l) => await bt(l));
|
|
2868
2881
|
const o = Math.max(i?.length - n, 0);
|
|
2869
2882
|
for (let l = i.length - 1; l >= o; l--)
|
|
2870
2883
|
if (!Us(i[l])) {
|
|
2871
|
-
const
|
|
2872
|
-
if (Array.isArray(
|
|
2873
|
-
return
|
|
2884
|
+
const a = await e(i[l], { signal: t });
|
|
2885
|
+
if (Array.isArray(a))
|
|
2886
|
+
return wt({
|
|
2874
2887
|
...s,
|
|
2875
2888
|
items: [
|
|
2876
2889
|
...i.slice(0, l),
|
|
2877
|
-
...
|
|
2890
|
+
...a,
|
|
2878
2891
|
...i.slice(l + 1)
|
|
2879
2892
|
]
|
|
2880
2893
|
});
|
|
2881
|
-
const u = await
|
|
2894
|
+
const u = await bt(a);
|
|
2882
2895
|
if (r?.includes(u.blueId))
|
|
2883
|
-
return
|
|
2896
|
+
return wt({
|
|
2884
2897
|
...s,
|
|
2885
2898
|
items: [...i.slice(0, l), ...i.slice(l + 1)]
|
|
2886
2899
|
});
|
|
@@ -2892,7 +2905,7 @@ const Qt = (s) => s instanceof a || Array.isArray(s) && s.every((e) => e instanc
|
|
|
2892
2905
|
}
|
|
2893
2906
|
return i;
|
|
2894
2907
|
};
|
|
2895
|
-
function
|
|
2908
|
+
function Be(s) {
|
|
2896
2909
|
try {
|
|
2897
2910
|
const e = new URL(s);
|
|
2898
2911
|
return e.protocol === "http:" || e.protocol === "https:";
|
|
@@ -2907,7 +2920,7 @@ class ks {
|
|
|
2907
2920
|
* @returns The processed document
|
|
2908
2921
|
*/
|
|
2909
2922
|
process(e) {
|
|
2910
|
-
return
|
|
2923
|
+
return B.transform(e, this.inferType.bind(this));
|
|
2911
2924
|
}
|
|
2912
2925
|
/**
|
|
2913
2926
|
* Infer a basic type for a node
|
|
@@ -2916,10 +2929,10 @@ class ks {
|
|
|
2916
2929
|
*/
|
|
2917
2930
|
inferType(e) {
|
|
2918
2931
|
const t = e.getType(), r = e.getValue();
|
|
2919
|
-
return I(t) && p(r) && (typeof r == "string" ? e.setType(new
|
|
2932
|
+
return I(t) && p(r) && (typeof r == "string" ? e.setType(new c().setBlueId(_)) : typeof r == "bigint" || Z(r) ? e.setType(new c().setBlueId(L)) : Ge(r) ? e.setType(new c().setBlueId(j)) : typeof r == "boolean" && e.setType(new c().setBlueId(U))), e;
|
|
2920
2933
|
}
|
|
2921
2934
|
}
|
|
2922
|
-
class
|
|
2935
|
+
class Ve {
|
|
2923
2936
|
static MAPPINGS = "mappings";
|
|
2924
2937
|
mappings = /* @__PURE__ */ new Map();
|
|
2925
2938
|
/**
|
|
@@ -2927,13 +2940,13 @@ class Ce {
|
|
|
2927
2940
|
* @param transformationOrMappings - The transformation node or mappings to use
|
|
2928
2941
|
*/
|
|
2929
2942
|
constructor(e) {
|
|
2930
|
-
if (e instanceof
|
|
2943
|
+
if (e instanceof c) {
|
|
2931
2944
|
const r = e.getProperties();
|
|
2932
|
-
if (r && r[
|
|
2933
|
-
const i = r[
|
|
2945
|
+
if (r && r[Ve.MAPPINGS]) {
|
|
2946
|
+
const i = r[Ve.MAPPINGS].getProperties();
|
|
2934
2947
|
i && Object.entries(i).forEach(([o, l]) => {
|
|
2935
|
-
const
|
|
2936
|
-
typeof
|
|
2948
|
+
const a = l.getValue();
|
|
2949
|
+
typeof a == "string" && this.mappings.set(o, a);
|
|
2937
2950
|
});
|
|
2938
2951
|
}
|
|
2939
2952
|
} else
|
|
@@ -2945,7 +2958,7 @@ class Ce {
|
|
|
2945
2958
|
* @returns The processed document
|
|
2946
2959
|
*/
|
|
2947
2960
|
process(e) {
|
|
2948
|
-
return
|
|
2961
|
+
return B.transform(e, this.transformNode.bind(this));
|
|
2949
2962
|
}
|
|
2950
2963
|
transformNode(e) {
|
|
2951
2964
|
const t = e.clone();
|
|
@@ -2957,7 +2970,7 @@ class Ce {
|
|
|
2957
2970
|
if (this.mappings.has(r)) {
|
|
2958
2971
|
const n = this.mappings.get(r);
|
|
2959
2972
|
if (n) {
|
|
2960
|
-
const i = new
|
|
2973
|
+
const i = new c().setBlueId(n);
|
|
2961
2974
|
t === e.getType() ? e.setType(i) : t === e.getItemType() ? e.setItemType(i) : t === e.getKeyType() ? e.setKeyType(i) : t === e.getValueType() && e.setValueType(i);
|
|
2962
2975
|
}
|
|
2963
2976
|
}
|
|
@@ -2972,7 +2985,7 @@ class Ks {
|
|
|
2972
2985
|
* @throws Error if any inline type values remain without BlueId mappings
|
|
2973
2986
|
*/
|
|
2974
2987
|
process(e) {
|
|
2975
|
-
return
|
|
2988
|
+
return B.transform(e, this.validateNode.bind(this)), e;
|
|
2976
2989
|
}
|
|
2977
2990
|
validateNode(e) {
|
|
2978
2991
|
return this.validateTypeField(e, e.getType(), "type"), this.validateTypeField(e, e.getItemType(), "itemType"), this.validateTypeField(e, e.getKeyType(), "keyType"), this.validateTypeField(e, e.getValueType(), "valueType"), e;
|
|
@@ -2995,7 +3008,7 @@ class ft {
|
|
|
2995
3008
|
* @param strategy - The strategy to use for missing elements (defaults to THROW_EXCEPTION)
|
|
2996
3009
|
*/
|
|
2997
3010
|
constructor(e, t) {
|
|
2998
|
-
this.nodeProvider =
|
|
3011
|
+
this.nodeProvider = he.wrap(e), this.strategy = t || "THROW_EXCEPTION";
|
|
2999
3012
|
}
|
|
3000
3013
|
/**
|
|
3001
3014
|
* Extends a node with its resolved references
|
|
@@ -3016,13 +3029,13 @@ class ft {
|
|
|
3016
3029
|
if (i && !X.includes(
|
|
3017
3030
|
i
|
|
3018
3031
|
)) {
|
|
3019
|
-
const
|
|
3020
|
-
if (
|
|
3021
|
-
if (
|
|
3022
|
-
const v =
|
|
3032
|
+
const f = this.fetchNode(e);
|
|
3033
|
+
if (f && f.length > 0)
|
|
3034
|
+
if (f.length === 1) {
|
|
3035
|
+
const v = f[0];
|
|
3023
3036
|
this.mergeNodes(e, v);
|
|
3024
3037
|
} else {
|
|
3025
|
-
const v =
|
|
3038
|
+
const v = f.map((q) => q.clone()), k = new c().setItems(v);
|
|
3026
3039
|
this.mergeNodes(e, k);
|
|
3027
3040
|
}
|
|
3028
3041
|
}
|
|
@@ -3030,19 +3043,19 @@ class ft {
|
|
|
3030
3043
|
o && this.extendNode(o, t, "type", !0);
|
|
3031
3044
|
const l = e.getItemType();
|
|
3032
3045
|
l && this.extendNode(l, t, "itemType", !0);
|
|
3033
|
-
const
|
|
3034
|
-
|
|
3046
|
+
const a = e.getKeyType();
|
|
3047
|
+
a && this.extendNode(a, t, "keyType", !0);
|
|
3035
3048
|
const u = e.getValueType();
|
|
3036
3049
|
u && this.extendNode(u, t, "valueType", !0);
|
|
3037
3050
|
const y = e.getProperties();
|
|
3038
|
-
y && Object.entries(y).forEach(([
|
|
3039
|
-
this.extendNode(v, t,
|
|
3051
|
+
y && Object.entries(y).forEach(([f, v]) => {
|
|
3052
|
+
this.extendNode(v, t, f, !1);
|
|
3040
3053
|
});
|
|
3041
3054
|
const d = e.getItems();
|
|
3042
3055
|
if (d && d.length > 0) {
|
|
3043
3056
|
this.reconstructList(d);
|
|
3044
|
-
for (let
|
|
3045
|
-
this.extendNode(d[
|
|
3057
|
+
for (let f = 0; f < d.length; f++)
|
|
3058
|
+
this.extendNode(d[f], t, String(f), !1);
|
|
3046
3059
|
}
|
|
3047
3060
|
} finally {
|
|
3048
3061
|
n || t.exitPathSegment();
|
|
@@ -3080,7 +3093,7 @@ class ft {
|
|
|
3080
3093
|
p(r) && e.setValue(r), e.setItems(t.getItems()), e.setProperties(t.getProperties());
|
|
3081
3094
|
}
|
|
3082
3095
|
}
|
|
3083
|
-
class
|
|
3096
|
+
class yt {
|
|
3084
3097
|
blueIdsCollections = [];
|
|
3085
3098
|
/**
|
|
3086
3099
|
* Initializes the generator with default BlueIds collections
|
|
@@ -3150,7 +3163,7 @@ ${r}`;
|
|
|
3150
3163
|
return Object.keys(this.getAllBlueIds()).length;
|
|
3151
3164
|
}
|
|
3152
3165
|
}
|
|
3153
|
-
class
|
|
3166
|
+
class ie {
|
|
3154
3167
|
static DEFAULT_BLUE_BLUE_ID = "6sqUywMoBRyj9hgQxSu2nDPnqcyiSM7xu9AB9sN98YJK";
|
|
3155
3168
|
processorProvider;
|
|
3156
3169
|
nodeProvider;
|
|
@@ -3164,7 +3177,7 @@ class ne {
|
|
|
3164
3177
|
const { nodeProvider: t, processorProvider: r, blueIdsMappingGenerator: n } = e;
|
|
3165
3178
|
if (!t)
|
|
3166
3179
|
throw new Error("NodeProvider is required");
|
|
3167
|
-
this.nodeProvider =
|
|
3180
|
+
this.nodeProvider = he.wrap(t), this.processorProvider = r || ie.getStandardProvider(), this.blueIdsMappingGenerator = n || new yt(), this.loadDefaultSimpleBlue();
|
|
3168
3181
|
}
|
|
3169
3182
|
/**
|
|
3170
3183
|
* Preprocesses a document node
|
|
@@ -3223,7 +3236,7 @@ class ne {
|
|
|
3223
3236
|
getProcessor(e) {
|
|
3224
3237
|
const t = "27B7fuxQCS1VAptiCPc2RMkKoutP5qxkh3uDxZ7dr6Eo", r = "FGYuTXwaoSKfZmpTysLTLsb8WzSqf43384rKZDkXhxD4", n = e.getType()?.getBlueId();
|
|
3225
3238
|
if (t === n)
|
|
3226
|
-
return new
|
|
3239
|
+
return new Ve(
|
|
3227
3240
|
e
|
|
3228
3241
|
);
|
|
3229
3242
|
if (r === n)
|
|
@@ -3248,7 +3261,7 @@ ${t}
|
|
|
3248
3261
|
*/
|
|
3249
3262
|
loadDefaultSimpleBlue() {
|
|
3250
3263
|
try {
|
|
3251
|
-
const e = this.enrichDefaultBlue(
|
|
3264
|
+
const e = this.enrichDefaultBlue(qt), t = $(e);
|
|
3252
3265
|
if (t)
|
|
3253
3266
|
this.defaultSimpleBlue = g.deserialize(t);
|
|
3254
3267
|
else
|
|
@@ -3258,15 +3271,15 @@ ${t}
|
|
|
3258
3271
|
}
|
|
3259
3272
|
}
|
|
3260
3273
|
}
|
|
3261
|
-
class
|
|
3274
|
+
class gt extends Qt {
|
|
3262
3275
|
blueIdToContentMap = /* @__PURE__ */ new Map();
|
|
3263
3276
|
blueIdToMultipleDocumentsMap = /* @__PURE__ */ new Map();
|
|
3264
3277
|
preprocessor;
|
|
3265
3278
|
constructor(e) {
|
|
3266
3279
|
super();
|
|
3267
|
-
const t = new
|
|
3280
|
+
const t = new yt(), r = gt.collectAliasMappings(e);
|
|
3268
3281
|
Object.keys(r).length > 0 && t.registerBlueIds(r);
|
|
3269
|
-
const n = new
|
|
3282
|
+
const n = new ie({
|
|
3270
3283
|
nodeProvider: this,
|
|
3271
3284
|
blueIdsMappingGenerator: t
|
|
3272
3285
|
});
|
|
@@ -3312,10 +3325,10 @@ class yt extends qt {
|
|
|
3312
3325
|
(o) => o
|
|
3313
3326
|
), i = t || n.blueId;
|
|
3314
3327
|
this.blueIdToContentMap.set(i, n.content), this.blueIdToMultipleDocumentsMap.set(i, !0), r.forEach((o, l) => {
|
|
3315
|
-
const
|
|
3328
|
+
const a = `${i}#${l}`, u = m.get(o), y = T.calculateBlueIdSync(o);
|
|
3316
3329
|
this.blueIdToContentMap.set(y, u), this.blueIdToMultipleDocumentsMap.set(y, !1);
|
|
3317
3330
|
const d = o.getName();
|
|
3318
|
-
d && this.addToNameMap(d,
|
|
3331
|
+
d && this.addToNameMap(d, a);
|
|
3319
3332
|
});
|
|
3320
3333
|
}
|
|
3321
3334
|
fetchContentByBlueId(e) {
|
|
@@ -3340,7 +3353,7 @@ class yt extends qt {
|
|
|
3340
3353
|
return this.blueIdToContentMap.has(t);
|
|
3341
3354
|
}
|
|
3342
3355
|
}
|
|
3343
|
-
class
|
|
3356
|
+
class he {
|
|
3344
3357
|
/**
|
|
3345
3358
|
* Wraps a NodeProvider with a SequentialNodeProvider that includes bootstrap providers and repository definitions
|
|
3346
3359
|
* @param originalProvider - The original NodeProvider to wrap
|
|
@@ -3348,9 +3361,9 @@ class fe {
|
|
|
3348
3361
|
* @returns A wrapped NodeProvider that includes bootstrap providers and repository definitions
|
|
3349
3362
|
*/
|
|
3350
3363
|
static wrap(e, t) {
|
|
3351
|
-
const r = [
|
|
3364
|
+
const r = [ht.INSTANCE];
|
|
3352
3365
|
if (t && t.length > 0) {
|
|
3353
|
-
const n = new
|
|
3366
|
+
const n = new gt(t);
|
|
3354
3367
|
r.push(n);
|
|
3355
3368
|
}
|
|
3356
3369
|
return r.push(e), new Ds(r);
|
|
@@ -3382,7 +3395,7 @@ class Ys {
|
|
|
3382
3395
|
return this.handleAliasValue(r, t);
|
|
3383
3396
|
if (Se.isPotentialBlueId(t))
|
|
3384
3397
|
return this.handleBlueId(r, t);
|
|
3385
|
-
throw
|
|
3398
|
+
throw Be(t) ? new Error(
|
|
3386
3399
|
`URL '${t}' detected. Use the async version of this method to fetch the content.`
|
|
3387
3400
|
) : new Error(`Invalid blue value: ${t}`);
|
|
3388
3401
|
}
|
|
@@ -3402,17 +3415,17 @@ class Ys {
|
|
|
3402
3415
|
return this.handleAliasValue(r, t);
|
|
3403
3416
|
if (Se.isPotentialBlueId(t))
|
|
3404
3417
|
return this.handleBlueId(r, t);
|
|
3405
|
-
if (
|
|
3418
|
+
if (Be(t) && this.urlContentFetcher)
|
|
3406
3419
|
try {
|
|
3407
3420
|
const n = await this.fetchFromUrl(t);
|
|
3408
|
-
return n && r.setBlue(new
|
|
3421
|
+
return n && r.setBlue(new c().setItems(n)), r;
|
|
3409
3422
|
} catch (n) {
|
|
3410
3423
|
throw n instanceof Error ? new Error(
|
|
3411
3424
|
`Failed to fetch from URL '${t}'.
|
|
3412
3425
|
${n.message}`
|
|
3413
3426
|
) : n;
|
|
3414
3427
|
}
|
|
3415
|
-
else throw
|
|
3428
|
+
else throw Be(t) ? new Error(
|
|
3416
3429
|
`UrlContentFetcher not provided for URL: ${t}`
|
|
3417
3430
|
) : new Error(`Invalid blue value: ${t}`);
|
|
3418
3431
|
}
|
|
@@ -3435,7 +3448,7 @@ ${n.message}`
|
|
|
3435
3448
|
*/
|
|
3436
3449
|
handleAliasValue(e, t) {
|
|
3437
3450
|
return e.setBlue(
|
|
3438
|
-
new
|
|
3451
|
+
new c().setBlueId(this.preprocessingAliases.get(t))
|
|
3439
3452
|
), e;
|
|
3440
3453
|
}
|
|
3441
3454
|
/**
|
|
@@ -3445,7 +3458,7 @@ ${n.message}`
|
|
|
3445
3458
|
* @returns The modified node
|
|
3446
3459
|
*/
|
|
3447
3460
|
handleBlueId(e, t) {
|
|
3448
|
-
return e.setBlue(new
|
|
3461
|
+
return e.setBlue(new c().setBlueId(t)), e;
|
|
3449
3462
|
}
|
|
3450
3463
|
/**
|
|
3451
3464
|
* Fetches content from a URL
|
|
@@ -3515,7 +3528,7 @@ class Gs {
|
|
|
3515
3528
|
this.fetchStrategy = e || zs;
|
|
3516
3529
|
}
|
|
3517
3530
|
validateUrl(e) {
|
|
3518
|
-
if (!
|
|
3531
|
+
if (!Be(e))
|
|
3519
3532
|
throw new Error(`Invalid URL: ${e}`);
|
|
3520
3533
|
return !0;
|
|
3521
3534
|
}
|
|
@@ -3646,7 +3659,7 @@ class Js {
|
|
|
3646
3659
|
return this.resolve(e, K);
|
|
3647
3660
|
}
|
|
3648
3661
|
}
|
|
3649
|
-
class
|
|
3662
|
+
class Ws extends Js {
|
|
3650
3663
|
mergingProcessor;
|
|
3651
3664
|
nodeProvider;
|
|
3652
3665
|
/**
|
|
@@ -3655,7 +3668,7 @@ class Zs extends Js {
|
|
|
3655
3668
|
* @param nodeProvider - The provider to use for resolving nodes
|
|
3656
3669
|
*/
|
|
3657
3670
|
constructor(e, t) {
|
|
3658
|
-
super(), this.mergingProcessor = e, this.nodeProvider =
|
|
3671
|
+
super(), this.mergingProcessor = e, this.nodeProvider = he.wrap(t);
|
|
3659
3672
|
}
|
|
3660
3673
|
/**
|
|
3661
3674
|
* Merges a source node into a target node with the given limits
|
|
@@ -3665,6 +3678,13 @@ class Zs extends Js {
|
|
|
3665
3678
|
* @returns A new BlueNode with the merged content
|
|
3666
3679
|
*/
|
|
3667
3680
|
merge(e, t, r) {
|
|
3681
|
+
return this.mergeWithContext(
|
|
3682
|
+
e,
|
|
3683
|
+
t,
|
|
3684
|
+
this.createResolutionContext(r)
|
|
3685
|
+
);
|
|
3686
|
+
}
|
|
3687
|
+
mergeWithContext(e, t, r) {
|
|
3668
3688
|
if (p(t.getBlue()))
|
|
3669
3689
|
throw new Error(
|
|
3670
3690
|
'Document contains "blue" attribute. Preprocess document before merging.'
|
|
@@ -3672,13 +3692,10 @@ class Zs extends Js {
|
|
|
3672
3692
|
let n = e;
|
|
3673
3693
|
const i = t.getType();
|
|
3674
3694
|
if (p(i)) {
|
|
3675
|
-
const o = i.
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
);
|
|
3680
|
-
const l = this.resolve(o, r), c = t.clone().setType(l);
|
|
3681
|
-
return n = this.merge(n, o, r), this.mergeObject(n, c, r);
|
|
3695
|
+
const o = this.resolveTypeNode(i, r), l = o.cloneShallow().setType(void 0);
|
|
3696
|
+
n = this.mergeObject(n, l, r);
|
|
3697
|
+
const a = t.cloneShallow().setType(o);
|
|
3698
|
+
return this.mergeObject(n, a, r);
|
|
3682
3699
|
}
|
|
3683
3700
|
return this.mergeObject(n, t, r);
|
|
3684
3701
|
}
|
|
@@ -3690,21 +3707,20 @@ class Zs extends Js {
|
|
|
3690
3707
|
* @returns A new BlueNode with the merged content
|
|
3691
3708
|
*/
|
|
3692
3709
|
mergeObject(e, t, r) {
|
|
3693
|
-
|
|
3694
|
-
|
|
3710
|
+
const n = e.cloneShallow();
|
|
3711
|
+
let i = this.mergingProcessor.process(
|
|
3712
|
+
n,
|
|
3695
3713
|
t,
|
|
3696
|
-
|
|
3714
|
+
r.nodeProvider
|
|
3697
3715
|
);
|
|
3698
|
-
const
|
|
3699
|
-
p(
|
|
3700
|
-
const
|
|
3701
|
-
return p(
|
|
3702
|
-
|
|
3703
|
-
}), p(t.getBlueId()) && (n = n.clone().setBlueId(t.getBlueId())), this.mergingProcessor.postProcess && (n = this.mergingProcessor.postProcess(
|
|
3704
|
-
n,
|
|
3716
|
+
const o = t.getItems();
|
|
3717
|
+
p(o) && (i = this.mergeChildren(i, o, r));
|
|
3718
|
+
const l = t.getProperties();
|
|
3719
|
+
return p(l) && (i = this.mergeProperties(i, l, r)), p(t.getBlueId()) && (i = i.cloneShallow().setBlueId(t.getBlueId())), this.mergingProcessor.postProcess && (i = this.mergingProcessor.postProcess(
|
|
3720
|
+
i,
|
|
3705
3721
|
t,
|
|
3706
|
-
|
|
3707
|
-
)),
|
|
3722
|
+
r.nodeProvider
|
|
3723
|
+
)), i;
|
|
3708
3724
|
}
|
|
3709
3725
|
/**
|
|
3710
3726
|
* Merges child items from source into target
|
|
@@ -3716,56 +3732,69 @@ class Zs extends Js {
|
|
|
3716
3732
|
mergeChildren(e, t, r) {
|
|
3717
3733
|
const n = e.getItems();
|
|
3718
3734
|
if (I(n)) {
|
|
3719
|
-
const o =
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
r.
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3735
|
+
const o = [];
|
|
3736
|
+
for (let l = 0; l < t.length; l++) {
|
|
3737
|
+
const a = t[l];
|
|
3738
|
+
if (r.limits.shouldMergePathSegment(String(l), a)) {
|
|
3739
|
+
this.enterPathSegment(r, String(l), a);
|
|
3740
|
+
try {
|
|
3741
|
+
const u = a.isResolved() && this.canReuseResolvedSubtree(r) ? a : this.resolveWithContext(a, r);
|
|
3742
|
+
o.push(u);
|
|
3743
|
+
} finally {
|
|
3744
|
+
this.exitPathSegment(r);
|
|
3745
|
+
}
|
|
3746
|
+
}
|
|
3747
|
+
}
|
|
3748
|
+
return e.cloneShallow().setItems(o);
|
|
3727
3749
|
} else if (t.length < n.length)
|
|
3728
3750
|
throw new Error(
|
|
3729
3751
|
`Subtype of element must not have more items (${n.length}) than the element itself (${t.length}).`
|
|
3730
3752
|
);
|
|
3731
3753
|
const i = [...n];
|
|
3732
|
-
for (let o = 0; o < t.length; o++)
|
|
3733
|
-
if (
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3754
|
+
for (let o = 0; o < t.length; o++)
|
|
3755
|
+
if (r.limits.shouldMergePathSegment(String(o), t[o])) {
|
|
3756
|
+
this.enterPathSegment(r, String(o), t[o]);
|
|
3757
|
+
try {
|
|
3758
|
+
if (o >= i.length) {
|
|
3759
|
+
i.push(t[o]);
|
|
3760
|
+
continue;
|
|
3761
|
+
}
|
|
3762
|
+
const l = T.calculateBlueIdSync(
|
|
3763
|
+
t[o]
|
|
3764
|
+
), a = T.calculateBlueIdSync(
|
|
3765
|
+
i[o]
|
|
3766
|
+
);
|
|
3767
|
+
if (l !== a)
|
|
3768
|
+
throw new Error(
|
|
3769
|
+
`Mismatched items at index ${o}: source item has blueId '${l}', but target item has blueId '${a}'.`
|
|
3770
|
+
);
|
|
3771
|
+
} finally {
|
|
3772
|
+
this.exitPathSegment(r);
|
|
3773
|
+
}
|
|
3738
3774
|
}
|
|
3739
|
-
|
|
3740
|
-
t[o]
|
|
3741
|
-
), c = T.calculateBlueIdSync(
|
|
3742
|
-
i[o]
|
|
3743
|
-
);
|
|
3744
|
-
if (l !== c)
|
|
3745
|
-
throw new Error(
|
|
3746
|
-
`Mismatched items at index ${o}: source item has blueId '${l}', but target item has blueId '${c}'.`
|
|
3747
|
-
);
|
|
3748
|
-
r.exitPathSegment();
|
|
3749
|
-
}
|
|
3750
|
-
return e.clone().setItems(i);
|
|
3775
|
+
return e.cloneShallow().setItems(i);
|
|
3751
3776
|
}
|
|
3752
3777
|
/**
|
|
3753
|
-
* Merges
|
|
3778
|
+
* Merges source properties into target using copy-on-write for properties map
|
|
3754
3779
|
* @param target - The target node
|
|
3755
|
-
* @param
|
|
3756
|
-
* @param sourceValue - The property value to merge
|
|
3780
|
+
* @param sourceProperties - The properties to merge from source
|
|
3757
3781
|
* @param limits - The limits to apply
|
|
3758
|
-
* @returns A new BlueNode with
|
|
3759
|
-
*/
|
|
3760
|
-
|
|
3761
|
-
const
|
|
3762
|
-
|
|
3763
|
-
const l
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3782
|
+
* @returns A new BlueNode with merged properties
|
|
3783
|
+
*/
|
|
3784
|
+
mergeProperties(e, t, r) {
|
|
3785
|
+
const n = e.getProperties() ?? {};
|
|
3786
|
+
let i = n, o = !1;
|
|
3787
|
+
for (const [l, a] of Object.entries(t))
|
|
3788
|
+
if (r.limits.shouldMergePathSegment(l, a)) {
|
|
3789
|
+
this.enterPathSegment(r, l, a);
|
|
3790
|
+
try {
|
|
3791
|
+
const u = a.isResolved() && this.canReuseResolvedSubtree(r) ? a : this.resolveWithContext(a, r), y = i[l], d = y === void 0 ? u : this.mergeObject(y, u, r);
|
|
3792
|
+
d !== y && (o || (i = { ...n }, o = !0), i[l] = d);
|
|
3793
|
+
} finally {
|
|
3794
|
+
this.exitPathSegment(r);
|
|
3795
|
+
}
|
|
3796
|
+
}
|
|
3797
|
+
return o ? e.cloneShallow().setProperties(i) : e;
|
|
3769
3798
|
}
|
|
3770
3799
|
/**
|
|
3771
3800
|
* Resolves a node by creating a new node and merging the source into it
|
|
@@ -3774,11 +3803,55 @@ class Zs extends Js {
|
|
|
3774
3803
|
* @returns A ResolvedBlueNode containing the resolved content
|
|
3775
3804
|
*/
|
|
3776
3805
|
resolve(e, t) {
|
|
3777
|
-
|
|
3778
|
-
|
|
3806
|
+
return this.resolveWithContext(e, this.createResolutionContext(t));
|
|
3807
|
+
}
|
|
3808
|
+
resolveWithContext(e, t) {
|
|
3809
|
+
const r = new c(), i = this.mergeWithContext(r, e, t).clone().setName(e.getName()).setDescription(e.getDescription()).setBlueId(e.getBlueId());
|
|
3810
|
+
return new ne(i);
|
|
3811
|
+
}
|
|
3812
|
+
createResolutionContext(e) {
|
|
3813
|
+
return {
|
|
3814
|
+
limits: e,
|
|
3815
|
+
nodeProvider: this.nodeProvider,
|
|
3816
|
+
resolvedTypeCache: /* @__PURE__ */ new Map(),
|
|
3817
|
+
pathStack: []
|
|
3818
|
+
};
|
|
3819
|
+
}
|
|
3820
|
+
resolveTypeNode(e, t) {
|
|
3821
|
+
const r = e.getBlueId();
|
|
3822
|
+
if (p(r)) {
|
|
3823
|
+
const n = this.createResolvedTypeCacheKey(r, t), i = t.resolvedTypeCache.get(n);
|
|
3824
|
+
if (p(i))
|
|
3825
|
+
return i;
|
|
3826
|
+
const o = this.resolveAndExtendTypeNode(e, t);
|
|
3827
|
+
return t.resolvedTypeCache.set(n, o), o;
|
|
3828
|
+
}
|
|
3829
|
+
return this.resolveAndExtendTypeNode(e, t);
|
|
3830
|
+
}
|
|
3831
|
+
resolveAndExtendTypeNode(e, t) {
|
|
3832
|
+
const r = e.clone();
|
|
3833
|
+
return p(r.getBlueId()) && new ft(t.nodeProvider).extend(
|
|
3834
|
+
r,
|
|
3835
|
+
$e.withSinglePath("/")
|
|
3836
|
+
), this.resolveWithContext(r, t);
|
|
3837
|
+
}
|
|
3838
|
+
createResolvedTypeCacheKey(e, t) {
|
|
3839
|
+
return t.limits instanceof Xe ? e : `${e}|${this.getCurrentPointer(t)}`;
|
|
3840
|
+
}
|
|
3841
|
+
canReuseResolvedSubtree(e) {
|
|
3842
|
+
return e.limits instanceof Xe;
|
|
3843
|
+
}
|
|
3844
|
+
getCurrentPointer(e) {
|
|
3845
|
+
return e.pathStack.length === 0 ? "/" : `/${e.pathStack.join("/")}`;
|
|
3846
|
+
}
|
|
3847
|
+
enterPathSegment(e, t, r) {
|
|
3848
|
+
e.pathStack.push(t), e.limits.enterPathSegment(t, r);
|
|
3849
|
+
}
|
|
3850
|
+
exitPathSegment(e) {
|
|
3851
|
+
e.pathStack.pop(), e.limits.exitPathSegment();
|
|
3779
3852
|
}
|
|
3780
3853
|
}
|
|
3781
|
-
class
|
|
3854
|
+
class tr {
|
|
3782
3855
|
mergingProcessors;
|
|
3783
3856
|
/**
|
|
3784
3857
|
* Creates a new SequentialMergingProcessor with the given processors
|
|
@@ -3803,14 +3876,14 @@ class er {
|
|
|
3803
3876
|
return this.mergingProcessors.reduce((n, i) => i.postProcess ? i.postProcess(n, t, r) : n, e);
|
|
3804
3877
|
}
|
|
3805
3878
|
}
|
|
3806
|
-
class
|
|
3879
|
+
class rr {
|
|
3807
3880
|
process(e, t) {
|
|
3808
3881
|
const r = t.getValue();
|
|
3809
3882
|
if (p(r)) {
|
|
3810
3883
|
const n = e.getValue();
|
|
3811
3884
|
if (I(n))
|
|
3812
|
-
return e.
|
|
3813
|
-
if (!
|
|
3885
|
+
return e.cloneShallow().setValue(r);
|
|
3886
|
+
if (!Zs(r, n))
|
|
3814
3887
|
throw new Error(
|
|
3815
3888
|
`Node values conflict. Source node value: ${r}, target node value: ${n}`
|
|
3816
3889
|
);
|
|
@@ -3818,74 +3891,74 @@ class tr {
|
|
|
3818
3891
|
return e;
|
|
3819
3892
|
}
|
|
3820
3893
|
}
|
|
3821
|
-
const
|
|
3822
|
-
class
|
|
3894
|
+
const Zs = (s, e) => Z(s) && Z(e) || Ge(s) && Ge(e) ? s.eq(e) : s === e;
|
|
3895
|
+
class sr {
|
|
3823
3896
|
process(e, t, r) {
|
|
3824
3897
|
const n = e.getType(), i = t.getType();
|
|
3825
3898
|
let o = e;
|
|
3826
3899
|
if (n === void 0)
|
|
3827
|
-
o = e.
|
|
3900
|
+
o = e.cloneShallow().setType(i);
|
|
3828
3901
|
else if (i !== void 0) {
|
|
3829
|
-
if (!
|
|
3902
|
+
if (!w(
|
|
3830
3903
|
i,
|
|
3831
3904
|
n,
|
|
3832
3905
|
r
|
|
3833
3906
|
)) {
|
|
3834
|
-
const
|
|
3907
|
+
const a = m.get(i), u = m.get(n);
|
|
3835
3908
|
throw new Error(
|
|
3836
3909
|
`The source type '${JSON.stringify(
|
|
3837
|
-
|
|
3910
|
+
a
|
|
3838
3911
|
)}' is not a subtype of the target type '${JSON.stringify(
|
|
3839
3912
|
u
|
|
3840
3913
|
)}'.`
|
|
3841
3914
|
);
|
|
3842
3915
|
}
|
|
3843
|
-
o = e.
|
|
3916
|
+
o = e.cloneShallow().setType(i);
|
|
3844
3917
|
}
|
|
3845
3918
|
return o;
|
|
3846
3919
|
}
|
|
3847
3920
|
}
|
|
3848
|
-
class
|
|
3921
|
+
class nr {
|
|
3849
3922
|
process(e, t, r) {
|
|
3850
3923
|
const n = t.getItemType(), i = t.getType();
|
|
3851
|
-
if (n !== void 0 && i !== void 0 && !
|
|
3924
|
+
if (n !== void 0 && i !== void 0 && !Jt(i, r))
|
|
3852
3925
|
throw new Error("Source node with itemType must have a List type");
|
|
3853
3926
|
const o = e.getItemType();
|
|
3854
3927
|
let l = e;
|
|
3855
3928
|
if (o === void 0)
|
|
3856
|
-
n !== void 0 && (l = e.
|
|
3929
|
+
n !== void 0 && (l = e.cloneShallow().setItemType(n));
|
|
3857
3930
|
else if (n !== void 0) {
|
|
3858
|
-
if (!
|
|
3931
|
+
if (!w(
|
|
3859
3932
|
n,
|
|
3860
3933
|
o,
|
|
3861
3934
|
r
|
|
3862
3935
|
)) {
|
|
3863
|
-
const d = m.get(n),
|
|
3936
|
+
const d = m.get(n), f = m.get(o);
|
|
3864
3937
|
throw new Error(
|
|
3865
3938
|
`The source item type '${JSON.stringify(
|
|
3866
3939
|
d
|
|
3867
3940
|
)}' is not a subtype of the target item type '${JSON.stringify(
|
|
3868
|
-
|
|
3941
|
+
f
|
|
3869
3942
|
)}'.`
|
|
3870
3943
|
);
|
|
3871
3944
|
}
|
|
3872
|
-
l = e.
|
|
3945
|
+
l = e.cloneShallow().setItemType(n);
|
|
3873
3946
|
}
|
|
3874
|
-
const
|
|
3875
|
-
if (
|
|
3947
|
+
const a = l.getItemType(), u = t.getItems();
|
|
3948
|
+
if (a !== void 0 && u !== void 0)
|
|
3876
3949
|
for (const y of u) {
|
|
3877
3950
|
const d = y.getType();
|
|
3878
|
-
if (d !== void 0 && !
|
|
3951
|
+
if (d !== void 0 && !w(
|
|
3879
3952
|
d,
|
|
3880
|
-
|
|
3953
|
+
a,
|
|
3881
3954
|
r
|
|
3882
3955
|
)) {
|
|
3883
|
-
const
|
|
3884
|
-
|
|
3956
|
+
const f = m.get(d), v = m.get(
|
|
3957
|
+
a
|
|
3885
3958
|
);
|
|
3886
3959
|
throw new Error(
|
|
3887
3960
|
`Item of type '${JSON.stringify(
|
|
3888
|
-
|
|
3961
|
+
f
|
|
3889
3962
|
)}' is not a subtype of the list's item type '${JSON.stringify(
|
|
3890
3963
|
v
|
|
3891
3964
|
)}'.`
|
|
@@ -3895,41 +3968,41 @@ class sr {
|
|
|
3895
3968
|
return l;
|
|
3896
3969
|
}
|
|
3897
3970
|
}
|
|
3898
|
-
class
|
|
3971
|
+
class ir {
|
|
3899
3972
|
process(e, t, r) {
|
|
3900
3973
|
const n = t.getKeyType(), i = t.getValueType(), o = t.getType();
|
|
3901
|
-
if ((n !== void 0 || i !== void 0) && o !== void 0 && !
|
|
3974
|
+
if ((n !== void 0 || i !== void 0) && o !== void 0 && !Wt(o, r))
|
|
3902
3975
|
throw new Error(
|
|
3903
3976
|
"Source node with keyType or valueType must have a Dictionary type"
|
|
3904
3977
|
);
|
|
3905
3978
|
let l = this.processKeyType(e, t, r);
|
|
3906
3979
|
l = this.processValueType(l, t, r);
|
|
3907
|
-
const
|
|
3908
|
-
return (
|
|
3909
|
-
|
|
3980
|
+
const a = l.getKeyType(), u = l.getValueType(), y = t.getProperties();
|
|
3981
|
+
return (a !== void 0 || u !== void 0) && y !== void 0 && Object.entries(y).forEach(([d, f]) => {
|
|
3982
|
+
a !== void 0 && this.validateKeyType(d, a, r), u !== void 0 && this.validateValueType(f, u, r);
|
|
3910
3983
|
}), l;
|
|
3911
3984
|
}
|
|
3912
3985
|
processKeyType(e, t, r) {
|
|
3913
3986
|
const n = e.getKeyType(), i = t.getKeyType();
|
|
3914
3987
|
if (n === void 0) {
|
|
3915
3988
|
if (i !== void 0)
|
|
3916
|
-
return this.validateBasicKeyType(i, r), e.
|
|
3989
|
+
return this.validateBasicKeyType(i, r), e.cloneShallow().setKeyType(i);
|
|
3917
3990
|
} else if (i !== void 0) {
|
|
3918
|
-
if (this.validateBasicKeyType(i, r), !
|
|
3991
|
+
if (this.validateBasicKeyType(i, r), !w(
|
|
3919
3992
|
i,
|
|
3920
3993
|
n,
|
|
3921
3994
|
r
|
|
3922
3995
|
)) {
|
|
3923
|
-
const l = m.get(i),
|
|
3996
|
+
const l = m.get(i), a = m.get(n);
|
|
3924
3997
|
throw new Error(
|
|
3925
3998
|
`The source key type '${JSON.stringify(
|
|
3926
3999
|
l
|
|
3927
4000
|
)}' is not a subtype of the target key type '${JSON.stringify(
|
|
3928
|
-
|
|
4001
|
+
a
|
|
3929
4002
|
)}'.`
|
|
3930
4003
|
);
|
|
3931
4004
|
}
|
|
3932
|
-
return e.
|
|
4005
|
+
return e.cloneShallow().setKeyType(i);
|
|
3933
4006
|
}
|
|
3934
4007
|
return e;
|
|
3935
4008
|
}
|
|
@@ -3937,41 +4010,41 @@ class nr {
|
|
|
3937
4010
|
const n = e.getValueType(), i = t.getValueType();
|
|
3938
4011
|
if (n === void 0) {
|
|
3939
4012
|
if (i !== void 0)
|
|
3940
|
-
return e.
|
|
4013
|
+
return e.cloneShallow().setValueType(i);
|
|
3941
4014
|
} else if (i !== void 0) {
|
|
3942
|
-
if (!
|
|
4015
|
+
if (!w(
|
|
3943
4016
|
i,
|
|
3944
4017
|
n,
|
|
3945
4018
|
r
|
|
3946
4019
|
)) {
|
|
3947
|
-
const l = m.get(i),
|
|
4020
|
+
const l = m.get(i), a = m.get(n);
|
|
3948
4021
|
throw new Error(
|
|
3949
4022
|
`The source value type '${JSON.stringify(
|
|
3950
4023
|
l
|
|
3951
4024
|
)}' is not a subtype of the target value type '${JSON.stringify(
|
|
3952
|
-
|
|
4025
|
+
a
|
|
3953
4026
|
)}'.`
|
|
3954
4027
|
);
|
|
3955
4028
|
}
|
|
3956
|
-
return e.
|
|
4029
|
+
return e.cloneShallow().setValueType(i);
|
|
3957
4030
|
}
|
|
3958
4031
|
return e;
|
|
3959
4032
|
}
|
|
3960
4033
|
validateBasicKeyType(e, t) {
|
|
3961
|
-
if (!
|
|
4034
|
+
if (!ns(e, t))
|
|
3962
4035
|
throw new Error("Dictionary key type must be a basic type");
|
|
3963
4036
|
}
|
|
3964
4037
|
validateKeyType(e, t, r) {
|
|
3965
|
-
if (!
|
|
3966
|
-
if (
|
|
4038
|
+
if (!is(t, r))
|
|
4039
|
+
if (os(t, r)) {
|
|
3967
4040
|
const n = Number.parseInt(e, 10);
|
|
3968
4041
|
if (Number.isNaN(n) || n.toString() !== e)
|
|
3969
4042
|
throw new Error(`Key '${e}' is not a valid Integer.`);
|
|
3970
|
-
} else if (
|
|
4043
|
+
} else if (ls(t, r)) {
|
|
3971
4044
|
const n = Number.parseFloat(e);
|
|
3972
4045
|
if (Number.isNaN(n))
|
|
3973
4046
|
throw new Error(`Key '${e}' is not a valid Number.`);
|
|
3974
|
-
} else if (
|
|
4047
|
+
} else if (as(t, r)) {
|
|
3975
4048
|
if (e.toLowerCase() !== "true" && e.toLowerCase() !== "false")
|
|
3976
4049
|
throw new Error(`Key '${e}' is not a valid Boolean.`);
|
|
3977
4050
|
} else
|
|
@@ -3981,7 +4054,7 @@ class nr {
|
|
|
3981
4054
|
}
|
|
3982
4055
|
validateValueType(e, t, r) {
|
|
3983
4056
|
const n = e.getType();
|
|
3984
|
-
if (n !== void 0 && !
|
|
4057
|
+
if (n !== void 0 && !w(n, t, r)) {
|
|
3985
4058
|
const i = m.get(n), o = m.get(t);
|
|
3986
4059
|
throw new Error(
|
|
3987
4060
|
`Value of type '${JSON.stringify(
|
|
@@ -3993,7 +4066,7 @@ class nr {
|
|
|
3993
4066
|
}
|
|
3994
4067
|
}
|
|
3995
4068
|
}
|
|
3996
|
-
class
|
|
4069
|
+
class or {
|
|
3997
4070
|
process(e) {
|
|
3998
4071
|
return e;
|
|
3999
4072
|
}
|
|
@@ -4002,45 +4075,45 @@ class ir {
|
|
|
4002
4075
|
if (n !== void 0 && cs(n, r)) {
|
|
4003
4076
|
const i = e.getItems(), o = e.getProperties();
|
|
4004
4077
|
if (i !== void 0 && i.length > 0 || o !== void 0 && Object.keys(o).length > 0) {
|
|
4005
|
-
const l =
|
|
4078
|
+
const l = us(
|
|
4006
4079
|
n,
|
|
4007
4080
|
r
|
|
4008
|
-
),
|
|
4081
|
+
), a = n.getName() || "unknown";
|
|
4009
4082
|
throw new Error(
|
|
4010
|
-
`Node of type "${
|
|
4083
|
+
`Node of type "${a}" (which extends basic type "${l}") must not have items, properties or contracts.`
|
|
4011
4084
|
);
|
|
4012
4085
|
}
|
|
4013
4086
|
}
|
|
4014
4087
|
return e;
|
|
4015
4088
|
}
|
|
4016
4089
|
}
|
|
4017
|
-
class
|
|
4090
|
+
class lr {
|
|
4018
4091
|
process(e, t) {
|
|
4019
4092
|
let r = e;
|
|
4020
4093
|
const n = t.getName(), i = e.getName();
|
|
4021
|
-
n !== void 0 && i === void 0 && (r = r.
|
|
4094
|
+
n !== void 0 && i === void 0 && (r = r.cloneShallow().setName(n));
|
|
4022
4095
|
const o = t.getDescription(), l = r.getDescription();
|
|
4023
|
-
return o !== void 0 && l === void 0 && (r = r.
|
|
4096
|
+
return o !== void 0 && l === void 0 && (r = r.cloneShallow().setDescription(o)), r;
|
|
4024
4097
|
}
|
|
4025
4098
|
}
|
|
4026
4099
|
const ti = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4027
4100
|
__proto__: null,
|
|
4028
|
-
BasicTypesVerifier:
|
|
4029
|
-
DictionaryProcessor:
|
|
4030
|
-
ListProcessor:
|
|
4031
|
-
MetadataPropagator:
|
|
4032
|
-
SequentialMergingProcessor:
|
|
4033
|
-
TypeAssigner:
|
|
4034
|
-
ValuePropagator:
|
|
4101
|
+
BasicTypesVerifier: or,
|
|
4102
|
+
DictionaryProcessor: ir,
|
|
4103
|
+
ListProcessor: nr,
|
|
4104
|
+
MetadataPropagator: lr,
|
|
4105
|
+
SequentialMergingProcessor: tr,
|
|
4106
|
+
TypeAssigner: sr,
|
|
4107
|
+
ValuePropagator: rr
|
|
4035
4108
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4036
|
-
function
|
|
4037
|
-
return new
|
|
4038
|
-
new tr(),
|
|
4109
|
+
function Hs() {
|
|
4110
|
+
return new tr([
|
|
4039
4111
|
new rr(),
|
|
4040
4112
|
new sr(),
|
|
4041
4113
|
new nr(),
|
|
4042
|
-
new
|
|
4043
|
-
new
|
|
4114
|
+
new ir(),
|
|
4115
|
+
new lr(),
|
|
4116
|
+
new or()
|
|
4044
4117
|
]);
|
|
4045
4118
|
}
|
|
4046
4119
|
class Xs {
|
|
@@ -4060,7 +4133,7 @@ class Xs {
|
|
|
4060
4133
|
* Returns a new BlueNode where all type references are restored to inline values when possible.
|
|
4061
4134
|
*/
|
|
4062
4135
|
restore(e) {
|
|
4063
|
-
return
|
|
4136
|
+
return B.transform(
|
|
4064
4137
|
e,
|
|
4065
4138
|
(t) => this.restoreNode(t)
|
|
4066
4139
|
);
|
|
@@ -4094,7 +4167,7 @@ class Xs {
|
|
|
4094
4167
|
const o = this.resolveInlineValue(i, n);
|
|
4095
4168
|
if (!o)
|
|
4096
4169
|
return;
|
|
4097
|
-
const l = new
|
|
4170
|
+
const l = new c().setValue(o).setInlineValue(!0);
|
|
4098
4171
|
r(l);
|
|
4099
4172
|
}
|
|
4100
4173
|
resolveInlineValue(e, t) {
|
|
@@ -4222,7 +4295,7 @@ function sn(s, e, t) {
|
|
|
4222
4295
|
r,
|
|
4223
4296
|
t.name
|
|
4224
4297
|
);
|
|
4225
|
-
if (s.types[r] = i, s.typePackageByCurrentBlueId[r] = t.name, s.typeAliasByCurrentBlueId[r] = `${t.name}/${n.name}`, i.status ===
|
|
4298
|
+
if (s.types[r] = i, s.typePackageByCurrentBlueId[r] = t.name, s.typeAliasByCurrentBlueId[r] = `${t.name}/${n.name}`, i.status === ae && !s.toCurrentBlueIdIndex[r] && (s.toCurrentBlueIdIndex[r] = r), i.status === ae)
|
|
4226
4299
|
for (const o of i.versions) {
|
|
4227
4300
|
const l = s.toCurrentBlueIdIndex[o.typeBlueId];
|
|
4228
4301
|
if (l && l !== r)
|
|
@@ -4242,8 +4315,8 @@ function on(s, e) {
|
|
|
4242
4315
|
s.schemas.push(...Object.values(e.schemas));
|
|
4243
4316
|
}
|
|
4244
4317
|
function ln(s, e, t, r) {
|
|
4245
|
-
if (s.status ===
|
|
4246
|
-
return
|
|
4318
|
+
if (s.status === rt)
|
|
4319
|
+
return an(s, e, t, r), {
|
|
4247
4320
|
...s,
|
|
4248
4321
|
versions: s.versions ? [...s.versions] : s.versions
|
|
4249
4322
|
};
|
|
@@ -4266,7 +4339,7 @@ function ln(s, e, t, r) {
|
|
|
4266
4339
|
);
|
|
4267
4340
|
i.add(o.repositoryVersionIndex);
|
|
4268
4341
|
for (const l of o.attributesAdded ?? [])
|
|
4269
|
-
|
|
4342
|
+
cn(
|
|
4270
4343
|
l,
|
|
4271
4344
|
e.name,
|
|
4272
4345
|
t,
|
|
@@ -4277,8 +4350,8 @@ function ln(s, e, t, r) {
|
|
|
4277
4350
|
versions: n
|
|
4278
4351
|
};
|
|
4279
4352
|
}
|
|
4280
|
-
function
|
|
4281
|
-
if (s.status ===
|
|
4353
|
+
function an(s, e, t, r) {
|
|
4354
|
+
if (s.status === rt) {
|
|
4282
4355
|
if (s.versions && s.versions.length > 1)
|
|
4283
4356
|
throw new Error(
|
|
4284
4357
|
`Dev type ${r}/${s.name} (${t}) must not declare multiple versions`
|
|
@@ -4292,9 +4365,9 @@ function cn(s, e, t, r) {
|
|
|
4292
4365
|
}
|
|
4293
4366
|
}
|
|
4294
4367
|
}
|
|
4295
|
-
function
|
|
4368
|
+
function cn(s, e, t, r) {
|
|
4296
4369
|
try {
|
|
4297
|
-
|
|
4370
|
+
vr(s);
|
|
4298
4371
|
} catch (n) {
|
|
4299
4372
|
const i = n instanceof Error ? n.message : "Unknown error";
|
|
4300
4373
|
throw new Error(
|
|
@@ -4343,22 +4416,22 @@ const D = {
|
|
|
4343
4416
|
REPO_UNREPRESENTABLE_IN_TARGET_VERSION: "REPO_UNREPRESENTABLE_IN_TARGET_VERSION",
|
|
4344
4417
|
INVALID_BLUE_CONTEXT_REPOSITORIES: "INVALID_BLUE_CONTEXT_REPOSITORIES",
|
|
4345
4418
|
INVALID_REPOSITORY_POINTER: "INVALID_REPOSITORY_POINTER"
|
|
4346
|
-
},
|
|
4419
|
+
}, hn = /* @__PURE__ */ new Set([
|
|
4347
4420
|
"__proto__",
|
|
4348
4421
|
"constructor",
|
|
4349
4422
|
"prototype"
|
|
4350
4423
|
]);
|
|
4351
|
-
function
|
|
4424
|
+
function Bt(s) {
|
|
4352
4425
|
const e = s.at(0), t = s.at(-1);
|
|
4353
4426
|
return !e || !t ? s : e === "'" && t === "'" || e === '"' && t === '"' ? s.slice(1, -1) : s;
|
|
4354
4427
|
}
|
|
4355
|
-
function
|
|
4428
|
+
function fn(s, e) {
|
|
4356
4429
|
const t = s.indexOf("=");
|
|
4357
4430
|
if (t === -1)
|
|
4358
4431
|
throw re(e, `Missing '=' in segment '${s.trim()}'`);
|
|
4359
4432
|
if (s.indexOf("=", t + 1) !== -1)
|
|
4360
4433
|
throw re(e, `Unexpected '=' in segment '${s.trim()}'`);
|
|
4361
|
-
const r =
|
|
4434
|
+
const r = Bt(s.slice(0, t).trim()), n = Bt(s.slice(t + 1).trim());
|
|
4362
4435
|
if (!r)
|
|
4363
4436
|
throw re(e, "Repository name is empty");
|
|
4364
4437
|
if (!n)
|
|
@@ -4373,7 +4446,7 @@ function yn(s) {
|
|
|
4373
4446
|
const r = t.trim();
|
|
4374
4447
|
if (!r)
|
|
4375
4448
|
throw re(s, "Empty repository segment");
|
|
4376
|
-
const { name: n, value: i } =
|
|
4449
|
+
const { name: n, value: i } = fn(r, s);
|
|
4377
4450
|
mn(n, s), e[n] = i;
|
|
4378
4451
|
}
|
|
4379
4452
|
return e;
|
|
@@ -4399,23 +4472,23 @@ function re(s, e) {
|
|
|
4399
4472
|
);
|
|
4400
4473
|
}
|
|
4401
4474
|
function mn(s, e) {
|
|
4402
|
-
if (
|
|
4475
|
+
if (hn.has(s))
|
|
4403
4476
|
throw re(e, `Forbidden repository name '${s}'`);
|
|
4404
4477
|
}
|
|
4405
4478
|
function In(s, e) {
|
|
4406
4479
|
const t = s.filter((n) => n.repositoryVersionIndex > e).sort((n, i) => i.repositoryVersionIndex - n.repositoryVersionIndex), r = [];
|
|
4407
4480
|
for (const n of t) {
|
|
4408
4481
|
const i = [...n.attributesAdded].sort(
|
|
4409
|
-
(o, l) =>
|
|
4482
|
+
(o, l) => Et(l) - Et(o)
|
|
4410
4483
|
);
|
|
4411
4484
|
r.push(...i);
|
|
4412
4485
|
}
|
|
4413
4486
|
return r;
|
|
4414
4487
|
}
|
|
4415
|
-
function
|
|
4416
|
-
return
|
|
4488
|
+
function Et(s) {
|
|
4489
|
+
return Ot(s).length;
|
|
4417
4490
|
}
|
|
4418
|
-
const Tn = /* @__PURE__ */ new Set([...
|
|
4491
|
+
const Tn = /* @__PURE__ */ new Set([...st]), b = {
|
|
4419
4492
|
core: "core",
|
|
4420
4493
|
noRuntime: "no-runtime",
|
|
4421
4494
|
noTargetContext: "no-target-context",
|
|
@@ -4431,7 +4504,7 @@ class vn {
|
|
|
4431
4504
|
this.registry = e.registry, this.targetRepoVersionIndexes = e.targetRepoVersionIndexes, this.fallbackToCurrentInlineDefinitions = e.fallbackToCurrentInlineDefinitions;
|
|
4432
4505
|
}
|
|
4433
4506
|
transform(e) {
|
|
4434
|
-
return
|
|
4507
|
+
return B.transform(
|
|
4435
4508
|
e,
|
|
4436
4509
|
(t) => this.transformNode(t)
|
|
4437
4510
|
);
|
|
@@ -4461,11 +4534,11 @@ class vn {
|
|
|
4461
4534
|
return;
|
|
4462
4535
|
const i = this.resolveType(n);
|
|
4463
4536
|
switch (i.kind) {
|
|
4464
|
-
case
|
|
4537
|
+
case b.core: {
|
|
4465
4538
|
r.setBlueId(i.blueId);
|
|
4466
4539
|
return;
|
|
4467
4540
|
}
|
|
4468
|
-
case
|
|
4541
|
+
case b.representable: {
|
|
4469
4542
|
this.applyDropPointers([r], i.dropPointers, {
|
|
4470
4543
|
rootIsSchema: !0
|
|
4471
4544
|
}), this.applyDropPointers(
|
|
@@ -4474,34 +4547,34 @@ class vn {
|
|
|
4474
4547
|
), r.setBlueId(i.targetBlueId);
|
|
4475
4548
|
return;
|
|
4476
4549
|
}
|
|
4477
|
-
case
|
|
4478
|
-
case
|
|
4479
|
-
case
|
|
4550
|
+
case b.noRuntime:
|
|
4551
|
+
case b.noTargetContext:
|
|
4552
|
+
case b.unrepresentable: {
|
|
4480
4553
|
if (this.fallbackToCurrentInlineDefinitions) {
|
|
4481
4554
|
this.inlineDefinition(e, t.setter, n);
|
|
4482
4555
|
return;
|
|
4483
4556
|
}
|
|
4484
|
-
throw i.kind ===
|
|
4557
|
+
throw i.kind === b.unrepresentable ? i.error : this.unrepresentableError(
|
|
4485
4558
|
n,
|
|
4486
|
-
i.kind ===
|
|
4487
|
-
i.kind ===
|
|
4488
|
-
i.kind ===
|
|
4559
|
+
i.kind === b.noTargetContext ? `Repository '${i.runtimeName}' not provided in BlueContext.` : "Type does not belong to any declared repository.",
|
|
4560
|
+
i.kind === b.noTargetContext ? i.runtime : void 0,
|
|
4561
|
+
i.kind === b.noTargetContext ? i.meta : void 0,
|
|
4489
4562
|
void 0,
|
|
4490
|
-
i.kind ===
|
|
4563
|
+
i.kind === b.noTargetContext ? i.typeAlias : void 0
|
|
4491
4564
|
);
|
|
4492
4565
|
}
|
|
4493
4566
|
}
|
|
4494
4567
|
}
|
|
4495
4568
|
resolveType(e) {
|
|
4496
4569
|
if (X.includes(e))
|
|
4497
|
-
return { kind:
|
|
4570
|
+
return { kind: b.core, blueId: e };
|
|
4498
4571
|
const t = this.registry.toCurrentBlueId(e), r = this.registry.getTypeAlias(t), n = this.registry.findRuntimeByBlueId(t);
|
|
4499
4572
|
if (!n || !n.typeMeta)
|
|
4500
|
-
return { kind:
|
|
4573
|
+
return { kind: b.noRuntime };
|
|
4501
4574
|
const i = this.targetRepoVersionIndexes[n.runtime.name];
|
|
4502
4575
|
if (i === void 0)
|
|
4503
4576
|
return {
|
|
4504
|
-
kind:
|
|
4577
|
+
kind: b.noTargetContext,
|
|
4505
4578
|
currentBlueId: t,
|
|
4506
4579
|
runtimeName: n.runtime.name,
|
|
4507
4580
|
runtime: n.runtime,
|
|
@@ -4509,11 +4582,11 @@ class vn {
|
|
|
4509
4582
|
typeAlias: r
|
|
4510
4583
|
};
|
|
4511
4584
|
const o = n.typeMeta;
|
|
4512
|
-
if (o.status ===
|
|
4585
|
+
if (o.status === rt) {
|
|
4513
4586
|
const d = n.runtime.repositoryVersions.length - 1;
|
|
4514
4587
|
if (i !== d)
|
|
4515
4588
|
return {
|
|
4516
|
-
kind:
|
|
4589
|
+
kind: b.unrepresentable,
|
|
4517
4590
|
currentBlueId: t,
|
|
4518
4591
|
error: this.unrepresentableError(
|
|
4519
4592
|
t,
|
|
@@ -4524,18 +4597,18 @@ class vn {
|
|
|
4524
4597
|
r
|
|
4525
4598
|
)
|
|
4526
4599
|
};
|
|
4527
|
-
const
|
|
4600
|
+
const f = o.versions?.[0];
|
|
4528
4601
|
return {
|
|
4529
|
-
kind:
|
|
4602
|
+
kind: b.representable,
|
|
4530
4603
|
currentBlueId: t,
|
|
4531
|
-
targetBlueId:
|
|
4604
|
+
targetBlueId: f?.typeBlueId ?? t,
|
|
4532
4605
|
dropPointers: []
|
|
4533
4606
|
};
|
|
4534
4607
|
}
|
|
4535
4608
|
const l = o.versions || [];
|
|
4536
4609
|
if (l.length === 0)
|
|
4537
4610
|
return {
|
|
4538
|
-
kind:
|
|
4611
|
+
kind: b.unrepresentable,
|
|
4539
4612
|
currentBlueId: t,
|
|
4540
4613
|
error: this.unrepresentableError(
|
|
4541
4614
|
t,
|
|
@@ -4546,10 +4619,10 @@ class vn {
|
|
|
4546
4619
|
r
|
|
4547
4620
|
)
|
|
4548
4621
|
};
|
|
4549
|
-
const
|
|
4550
|
-
if (i <
|
|
4622
|
+
const a = l[0].repositoryVersionIndex;
|
|
4623
|
+
if (i < a)
|
|
4551
4624
|
return {
|
|
4552
|
-
kind:
|
|
4625
|
+
kind: b.unrepresentable,
|
|
4553
4626
|
currentBlueId: t,
|
|
4554
4627
|
error: this.unrepresentableError(
|
|
4555
4628
|
t,
|
|
@@ -4563,16 +4636,16 @@ class vn {
|
|
|
4563
4636
|
let u = l[0].typeBlueId;
|
|
4564
4637
|
for (const d of l)
|
|
4565
4638
|
d.repositoryVersionIndex <= i && (u = d.typeBlueId);
|
|
4566
|
-
const y = o.status ===
|
|
4639
|
+
const y = o.status === ae ? this.getDropPointers(o, i) : [];
|
|
4567
4640
|
return {
|
|
4568
|
-
kind:
|
|
4641
|
+
kind: b.representable,
|
|
4569
4642
|
currentBlueId: t,
|
|
4570
4643
|
targetBlueId: u,
|
|
4571
4644
|
dropPointers: y
|
|
4572
4645
|
};
|
|
4573
4646
|
}
|
|
4574
4647
|
getDropPointers(e, t) {
|
|
4575
|
-
return e.status !==
|
|
4648
|
+
return e.status !== ae ? [] : In(e.versions, t);
|
|
4576
4649
|
}
|
|
4577
4650
|
applyDropPointers(e, t, r = {}) {
|
|
4578
4651
|
if (e.length === 0 || t.length === 0)
|
|
@@ -4585,13 +4658,13 @@ class vn {
|
|
|
4585
4658
|
getDictionaryValueTargets(e) {
|
|
4586
4659
|
const t = e.getProperties();
|
|
4587
4660
|
return t ? Object.entries(t).filter(
|
|
4588
|
-
([r, n]) => n instanceof
|
|
4661
|
+
([r, n]) => n instanceof c && !Tn.has(r)
|
|
4589
4662
|
).map(([, r]) => r) : [];
|
|
4590
4663
|
}
|
|
4591
4664
|
deletePropertyAtPointer(e, t, r) {
|
|
4592
4665
|
let n;
|
|
4593
4666
|
try {
|
|
4594
|
-
n =
|
|
4667
|
+
n = Ot(t);
|
|
4595
4668
|
} catch {
|
|
4596
4669
|
throw this.invalidPointerError(t);
|
|
4597
4670
|
}
|
|
@@ -4601,24 +4674,24 @@ class vn {
|
|
|
4601
4674
|
if (t.length === 0)
|
|
4602
4675
|
return;
|
|
4603
4676
|
const [n, ...i] = t;
|
|
4604
|
-
if (n ===
|
|
4605
|
-
const
|
|
4606
|
-
|
|
4677
|
+
if (n === W) {
|
|
4678
|
+
const a = e.getType();
|
|
4679
|
+
a && this.applyPointerSegments(a, i, !0);
|
|
4607
4680
|
return;
|
|
4608
4681
|
}
|
|
4609
|
-
if (n ===
|
|
4610
|
-
const
|
|
4611
|
-
|
|
4682
|
+
if (n === fe) {
|
|
4683
|
+
const a = e.getItemType();
|
|
4684
|
+
a && this.applyPointerSegments(a, i, !0);
|
|
4612
4685
|
return;
|
|
4613
4686
|
}
|
|
4614
4687
|
if (n === ye) {
|
|
4615
|
-
const
|
|
4616
|
-
|
|
4688
|
+
const a = e.getKeyType();
|
|
4689
|
+
a && this.applyPointerSegments(a, i, !0);
|
|
4617
4690
|
return;
|
|
4618
4691
|
}
|
|
4619
4692
|
if (n === ge) {
|
|
4620
|
-
const
|
|
4621
|
-
|
|
4693
|
+
const a = e.getValueType();
|
|
4694
|
+
a && this.applyPointerSegments(a, i, !0);
|
|
4622
4695
|
return;
|
|
4623
4696
|
}
|
|
4624
4697
|
const o = e.getProperties();
|
|
@@ -4627,12 +4700,12 @@ class vn {
|
|
|
4627
4700
|
if (i.length === 0) {
|
|
4628
4701
|
if (!r || !(n in o))
|
|
4629
4702
|
return;
|
|
4630
|
-
const
|
|
4631
|
-
delete
|
|
4703
|
+
const a = { ...o };
|
|
4704
|
+
delete a[n], e.setProperties(a);
|
|
4632
4705
|
return;
|
|
4633
4706
|
}
|
|
4634
4707
|
const l = o[n];
|
|
4635
|
-
l instanceof
|
|
4708
|
+
l instanceof c && this.applyPointerSegments(l, i, r);
|
|
4636
4709
|
}
|
|
4637
4710
|
inlineDefinition(e, t, r) {
|
|
4638
4711
|
const n = this.registry.toCurrentBlueId(r);
|
|
@@ -4658,9 +4731,9 @@ class vn {
|
|
|
4658
4731
|
try {
|
|
4659
4732
|
const o = g.deserialize(i);
|
|
4660
4733
|
o.setBlueId(void 0);
|
|
4661
|
-
const l =
|
|
4734
|
+
const l = B.transform(
|
|
4662
4735
|
o,
|
|
4663
|
-
(
|
|
4736
|
+
(a) => this.transformNode(a)
|
|
4664
4737
|
);
|
|
4665
4738
|
return t(l), e;
|
|
4666
4739
|
} finally {
|
|
@@ -4679,21 +4752,21 @@ class vn {
|
|
|
4679
4752
|
]);
|
|
4680
4753
|
}
|
|
4681
4754
|
unrepresentableError(e, t, r, n, i, o, l) {
|
|
4682
|
-
const
|
|
4755
|
+
const a = {
|
|
4683
4756
|
currentTypeBlueId: e,
|
|
4684
4757
|
targetRepoVersionIndex: i,
|
|
4685
4758
|
typeAlias: o,
|
|
4686
4759
|
...l
|
|
4687
4760
|
};
|
|
4688
|
-
if (r && (i !== void 0 && (
|
|
4761
|
+
if (r && (i !== void 0 && (a.requestedRepoBlueId = r.repositoryVersions[i]), a.serverRepoBlueId = r.currentRepoBlueId), n && n.status === ae) {
|
|
4689
4762
|
const y = n.versions?.[0]?.repositoryVersionIndex;
|
|
4690
|
-
y !== void 0 && (
|
|
4763
|
+
y !== void 0 && (a.typeIntroducedInRepoBlueId = r?.repositoryVersions[y]);
|
|
4691
4764
|
}
|
|
4692
4765
|
const u = {
|
|
4693
4766
|
code: D.REPO_UNREPRESENTABLE_IN_TARGET_VERSION,
|
|
4694
4767
|
message: t,
|
|
4695
|
-
locationPath: [
|
|
4696
|
-
context:
|
|
4768
|
+
locationPath: [W],
|
|
4769
|
+
context: a
|
|
4697
4770
|
};
|
|
4698
4771
|
return new Re(
|
|
4699
4772
|
D.REPO_UNREPRESENTABLE_IN_TARGET_VERSION,
|
|
@@ -4702,8 +4775,8 @@ class vn {
|
|
|
4702
4775
|
);
|
|
4703
4776
|
}
|
|
4704
4777
|
}
|
|
4705
|
-
function
|
|
4706
|
-
return e ?
|
|
4778
|
+
function qe(s, e) {
|
|
4779
|
+
return e ? B.transform(s, (t) => (ve(
|
|
4707
4780
|
() => t.getType(),
|
|
4708
4781
|
(r) => t.setType(r),
|
|
4709
4782
|
e
|
|
@@ -4731,7 +4804,7 @@ function ve(s, e, t) {
|
|
|
4731
4804
|
const i = t.toCurrentBlueId(n);
|
|
4732
4805
|
i !== n && e(r.clone().setBlueId(i));
|
|
4733
4806
|
}
|
|
4734
|
-
class
|
|
4807
|
+
class bn {
|
|
4735
4808
|
registry;
|
|
4736
4809
|
blueIdMapper;
|
|
4737
4810
|
constructor(e) {
|
|
@@ -4741,7 +4814,7 @@ class Bn {
|
|
|
4741
4814
|
const r = this.computeTargetRepoVersionIndexes(t);
|
|
4742
4815
|
if (Object.keys(r).length === 0)
|
|
4743
4816
|
return e;
|
|
4744
|
-
const n =
|
|
4817
|
+
const n = qe(e, this.blueIdMapper);
|
|
4745
4818
|
return new vn({
|
|
4746
4819
|
registry: this.registry,
|
|
4747
4820
|
targetRepoVersionIndexes: r,
|
|
@@ -4803,24 +4876,24 @@ class ri {
|
|
|
4803
4876
|
repositories: i,
|
|
4804
4877
|
mergingProcessor: o
|
|
4805
4878
|
} = e;
|
|
4806
|
-
this.repositories = i, this.repositoryRegistry = new qs(i ?? []), this.blueContextResolver = new
|
|
4879
|
+
this.repositories = i, this.repositoryRegistry = new qs(i ?? []), this.blueContextResolver = new bn({
|
|
4807
4880
|
registry: this.repositoryRegistry,
|
|
4808
4881
|
blueIdMapper: this.repositoryRegistry
|
|
4809
4882
|
});
|
|
4810
4883
|
const l = Ps(() => []);
|
|
4811
|
-
this.nodeProvider =
|
|
4884
|
+
this.nodeProvider = he.wrap(
|
|
4812
4885
|
t || l,
|
|
4813
4886
|
i
|
|
4814
|
-
), this.typeSchemaResolver = r ?? new
|
|
4887
|
+
), this.typeSchemaResolver = r ?? new ds([], {
|
|
4815
4888
|
nodeProvider: this.nodeProvider
|
|
4816
|
-
}), this.typeSchemaResolver?.setNodeProvider(this.nodeProvider), this.mergingProcessor = o ??
|
|
4889
|
+
}), this.typeSchemaResolver?.setNodeProvider(this.nodeProvider), this.mergingProcessor = o ?? Hs(), this.urlContentFetcher = new Gs(n), this.blueDirectivePreprocessor = new Ys(
|
|
4817
4890
|
void 0,
|
|
4818
4891
|
this.urlContentFetcher
|
|
4819
|
-
), this.blueIdsMappingGenerator = new
|
|
4892
|
+
), this.blueIdsMappingGenerator = new yt(), this.blueIdsMappingGenerator.registerBlueIds(
|
|
4820
4893
|
this.repositoryRegistry.getAliases()
|
|
4821
4894
|
);
|
|
4822
|
-
const
|
|
4823
|
-
|
|
4895
|
+
const a = this.repositoryRegistry.getRuntimes().flatMap((u) => u.schemas);
|
|
4896
|
+
a.length > 0 && this.typeSchemaResolver?.registerSchemas(a);
|
|
4824
4897
|
}
|
|
4825
4898
|
/**
|
|
4826
4899
|
* Converts a BlueNode to a JSON representation based on the specified strategy.
|
|
@@ -4846,7 +4919,7 @@ class ri {
|
|
|
4846
4919
|
}
|
|
4847
4920
|
resolve(e, t = K) {
|
|
4848
4921
|
const r = this.combineWithGlobalLimits(t);
|
|
4849
|
-
return new
|
|
4922
|
+
return new Ws(this.mergingProcessor, this.nodeProvider).resolve(e, r);
|
|
4850
4923
|
}
|
|
4851
4924
|
/**
|
|
4852
4925
|
* Wraps an already resolved (merged) BlueNode in a ResolvedBlueNode.
|
|
@@ -4857,7 +4930,7 @@ class ri {
|
|
|
4857
4930
|
* @returns A new ResolvedBlueNode instance.
|
|
4858
4931
|
*/
|
|
4859
4932
|
createResolvedNode(e) {
|
|
4860
|
-
return e instanceof
|
|
4933
|
+
return e instanceof ne ? e : new ne(e);
|
|
4861
4934
|
}
|
|
4862
4935
|
reverse(e) {
|
|
4863
4936
|
return new Ht().reverse(e);
|
|
@@ -4881,13 +4954,13 @@ class ri {
|
|
|
4881
4954
|
}
|
|
4882
4955
|
jsonValueToNode(e) {
|
|
4883
4956
|
const t = this.preprocess(g.deserialize(e));
|
|
4884
|
-
return
|
|
4957
|
+
return qe(t, this.repositoryRegistry);
|
|
4885
4958
|
}
|
|
4886
4959
|
async jsonValueToNodeAsync(e) {
|
|
4887
4960
|
const t = await this.preprocessAsync(
|
|
4888
4961
|
g.deserialize(e)
|
|
4889
4962
|
);
|
|
4890
|
-
return
|
|
4963
|
+
return qe(t, this.repositoryRegistry);
|
|
4891
4964
|
}
|
|
4892
4965
|
yamlToNode(e) {
|
|
4893
4966
|
const t = $(e);
|
|
@@ -4901,14 +4974,14 @@ class ri {
|
|
|
4901
4974
|
throw new Error("Failed to parse YAML to JSON");
|
|
4902
4975
|
return this.jsonValueToNodeAsync(t);
|
|
4903
4976
|
}
|
|
4904
|
-
prepareForBlueIdCalculation = async (e) => e instanceof
|
|
4977
|
+
prepareForBlueIdCalculation = async (e) => e instanceof c || Array.isArray(e) && e.every((t) => t instanceof c) ? e : Array.isArray(e) ? await Promise.all(
|
|
4905
4978
|
e.map((r) => this.jsonValueToNodeAsync(r))
|
|
4906
4979
|
) : this.jsonValueToNodeAsync(e);
|
|
4907
4980
|
calculateBlueId = async (e) => {
|
|
4908
4981
|
const t = await this.prepareForBlueIdCalculation(e);
|
|
4909
4982
|
return T.calculateBlueId(t);
|
|
4910
4983
|
};
|
|
4911
|
-
prepareForBlueIdCalculationSync = (e) => e instanceof
|
|
4984
|
+
prepareForBlueIdCalculationSync = (e) => e instanceof c || Array.isArray(e) && e.every((t) => t instanceof c) ? e : Array.isArray(e) ? e.map((t) => this.jsonValueToNode(t)) : this.jsonValueToNode(e);
|
|
4912
4985
|
calculateBlueIdSync(e) {
|
|
4913
4986
|
const t = this.prepareForBlueIdCalculationSync(e);
|
|
4914
4987
|
return T.calculateBlueIdSync(t);
|
|
@@ -4918,26 +4991,26 @@ class ri {
|
|
|
4918
4991
|
}
|
|
4919
4992
|
preprocess(e) {
|
|
4920
4993
|
const t = this.blueDirectivePreprocessor.process(e);
|
|
4921
|
-
return new
|
|
4994
|
+
return new ie({
|
|
4922
4995
|
nodeProvider: this.nodeProvider,
|
|
4923
4996
|
blueIdsMappingGenerator: this.blueIdsMappingGenerator
|
|
4924
4997
|
}).preprocessWithDefaultBlue(t);
|
|
4925
4998
|
}
|
|
4926
4999
|
async preprocessAsync(e) {
|
|
4927
5000
|
const t = await this.blueDirectivePreprocessor.processAsync(e);
|
|
4928
|
-
return new
|
|
5001
|
+
return new ie({
|
|
4929
5002
|
nodeProvider: this.nodeProvider,
|
|
4930
5003
|
blueIdsMappingGenerator: this.blueIdsMappingGenerator
|
|
4931
5004
|
}).preprocessWithDefaultBlue(t);
|
|
4932
5005
|
}
|
|
4933
5006
|
transform(e, t) {
|
|
4934
|
-
return
|
|
5007
|
+
return B.transform(e, t);
|
|
4935
5008
|
}
|
|
4936
5009
|
getNodeProvider() {
|
|
4937
5010
|
return this.nodeProvider;
|
|
4938
5011
|
}
|
|
4939
5012
|
setNodeProvider(e) {
|
|
4940
|
-
return this.nodeProvider =
|
|
5013
|
+
return this.nodeProvider = he.wrap(
|
|
4941
5014
|
e,
|
|
4942
5015
|
this.repositories
|
|
4943
5016
|
), this.typeSchemaResolver?.setNodeProvider(this.nodeProvider), this;
|
|
@@ -5061,7 +5134,7 @@ class ri {
|
|
|
5061
5134
|
* @returns true if the node matches the schema type, false otherwise
|
|
5062
5135
|
*/
|
|
5063
5136
|
isTypeOf(e, t, r) {
|
|
5064
|
-
return
|
|
5137
|
+
return A.isTypeOf(e, t, {
|
|
5065
5138
|
checkSchemaExtensions: r?.checkSchemaExtensions,
|
|
5066
5139
|
typeSchemaResolver: this.typeSchemaResolver
|
|
5067
5140
|
});
|
|
@@ -5080,8 +5153,8 @@ class ri {
|
|
|
5080
5153
|
const n = e.getType();
|
|
5081
5154
|
if (!n)
|
|
5082
5155
|
return !1;
|
|
5083
|
-
const i = new
|
|
5084
|
-
return
|
|
5156
|
+
const i = new c().setBlueId(r);
|
|
5157
|
+
return w(n, i, this.nodeProvider);
|
|
5085
5158
|
}
|
|
5086
5159
|
/**
|
|
5087
5160
|
* Checks if a BlueNode matches a BlueNode type.
|
|
@@ -5121,17 +5194,17 @@ class ri {
|
|
|
5121
5194
|
return this.globalLimits == K ? e : e == K ? this.globalLimits : _e.of(this.globalLimits, e);
|
|
5122
5195
|
}
|
|
5123
5196
|
}
|
|
5124
|
-
class si extends
|
|
5197
|
+
class si extends Qt {
|
|
5125
5198
|
blueIdToContentMap = /* @__PURE__ */ new Map();
|
|
5126
5199
|
blueIdToMultipleDocumentsMap = /* @__PURE__ */ new Map();
|
|
5127
5200
|
preprocessor;
|
|
5128
5201
|
constructor(e = []) {
|
|
5129
5202
|
super();
|
|
5130
|
-
const t = new
|
|
5203
|
+
const t = new ie({ nodeProvider: this });
|
|
5131
5204
|
this.preprocessor = (r) => t.preprocessWithDefaultBlue(r), e.forEach((r) => this.processNode(r));
|
|
5132
5205
|
}
|
|
5133
5206
|
processNode(e) {
|
|
5134
|
-
|
|
5207
|
+
dt.hasItemsOnly(e) ? this.processNodeWithItems(e) : this.processSingleNode(e);
|
|
5135
5208
|
}
|
|
5136
5209
|
processSingleNode(e) {
|
|
5137
5210
|
const t = z.parseAndCalculateBlueIdForNode(
|
|
@@ -5248,22 +5321,22 @@ class si extends qt {
|
|
|
5248
5321
|
}
|
|
5249
5322
|
}
|
|
5250
5323
|
export {
|
|
5251
|
-
|
|
5324
|
+
xr as Base58Sha256Provider,
|
|
5252
5325
|
si as BasicNodeProvider,
|
|
5253
5326
|
ri as Blue,
|
|
5254
5327
|
T as BlueIdCalculator,
|
|
5255
5328
|
kn as BlueIdToCid,
|
|
5256
|
-
|
|
5257
|
-
|
|
5329
|
+
c as BlueNode,
|
|
5330
|
+
A as BlueNodeTypeSchema,
|
|
5258
5331
|
Je as JsonCanonicalizer,
|
|
5259
|
-
|
|
5260
|
-
|
|
5332
|
+
pt as Limits,
|
|
5333
|
+
Ws as Merger,
|
|
5261
5334
|
ti as MergingProcessors,
|
|
5262
5335
|
Js as NodeResolver,
|
|
5263
|
-
|
|
5336
|
+
dt as Nodes,
|
|
5264
5337
|
On as Properties,
|
|
5265
|
-
|
|
5266
|
-
|
|
5338
|
+
ne as ResolvedBlueNode,
|
|
5339
|
+
ds as TypeSchemaResolver,
|
|
5267
5340
|
Kn as applyBlueNodePatch,
|
|
5268
5341
|
Fe as baseBlueObjectSchema,
|
|
5269
5342
|
Yn as blueDescriptionField,
|
|
@@ -5273,45 +5346,45 @@ export {
|
|
|
5273
5346
|
Jn as blueNodeField,
|
|
5274
5347
|
Fn as blueObjectBooleanValueSchema,
|
|
5275
5348
|
xn as blueObjectNumberValueSchema,
|
|
5276
|
-
|
|
5349
|
+
de as blueObjectSchema,
|
|
5277
5350
|
$n as blueObjectStringListItemsSchema,
|
|
5278
5351
|
Mn as blueObjectStringValueSchema,
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5352
|
+
Ls as calculateBlueId,
|
|
5353
|
+
Zn as calculateBlueIdSync,
|
|
5354
|
+
bt as enrichWithBlueId,
|
|
5355
|
+
Wr as getBlueDescriptionAnnotation,
|
|
5356
|
+
Xr as getBlueIdAnnotation,
|
|
5357
|
+
Qr as getBlueNameAnnotation,
|
|
5358
|
+
ts as getBlueNodeAnnotation,
|
|
5359
|
+
Hn as getBlueObjectItems,
|
|
5287
5360
|
qn as getBlueObjectProperties,
|
|
5288
5361
|
Qn as getBlueObjectTypeLabel,
|
|
5289
5362
|
Xn as getBlueObjectValue,
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5363
|
+
ss as getTypeBlueIdAnnotation,
|
|
5364
|
+
Nr as hasBlueObjectBlueIdDefined,
|
|
5365
|
+
Pr as hasBlueObjectItemsDefined,
|
|
5366
|
+
jn as hasBlueObjectNameDefined,
|
|
5367
|
+
Sr as hasBlueObjectTypeDefined,
|
|
5368
|
+
Cr as hasBlueObjectValueDefined,
|
|
5296
5369
|
Ge as isBigDecimalNumber,
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5370
|
+
Z as isBigIntegerNumber,
|
|
5371
|
+
C as isBigNumber,
|
|
5372
|
+
Gt as isBlueNodeSchema,
|
|
5300
5373
|
_n as isBlueObject,
|
|
5301
5374
|
Us as isBlueObjectResolved,
|
|
5302
|
-
|
|
5375
|
+
Ln as isGivenBlueObjectTypeSchema,
|
|
5303
5376
|
Lt as isJsonBlueArray,
|
|
5304
|
-
|
|
5377
|
+
jt as isJsonBlueObject,
|
|
5305
5378
|
Un as isJsonBlueValue,
|
|
5306
|
-
|
|
5307
|
-
|
|
5379
|
+
Be as isUrl,
|
|
5380
|
+
Ce as jsonBlueValueSchema,
|
|
5308
5381
|
ei as normalizeToBlueObject,
|
|
5309
|
-
|
|
5310
|
-
|
|
5382
|
+
wt as resolveBlueObjectItems,
|
|
5383
|
+
Jr as withBlueDescription,
|
|
5311
5384
|
Hr as withBlueId,
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5385
|
+
qr as withBlueName,
|
|
5386
|
+
es as withBlueNode,
|
|
5387
|
+
Wn as withTypeBlueId,
|
|
5315
5388
|
Rs as yamlBlueDump,
|
|
5316
5389
|
$ as yamlBlueParse
|
|
5317
5390
|
};
|