@blue-labs/language 3.4.3 → 3.5.0
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 -0
- package/dist/index.js +5 -5
- package/dist/index.mjs +630 -500
- package/dist/lib/Blue.d.ts +11 -0
- package/dist/lib/Blue.d.ts.map +1 -1
- package/dist/lib/merge/Merger.d.ts +18 -0
- package/dist/lib/merge/Merger.d.ts.map +1 -1
- package/dist/lib/merge/processors/MetadataPropagator.d.ts +3 -4
- package/dist/lib/merge/processors/MetadataPropagator.d.ts.map +1 -1
- package/dist/lib/utils/MergeReverser.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { isNullable as
|
|
3
|
-
import { z as h, ZodOptional as
|
|
1
|
+
import D from "big.js";
|
|
2
|
+
import { isNullable as m, isNonNullable as d, jsonPrimitiveSchema as cr, isReadonlyArray as Pe, isJsonPrimitive as et, isPreciseNumberString as Pt } from "@blue-labs/shared-utils";
|
|
3
|
+
import { z as h, ZodOptional as Nt, ZodNullable as St, ZodReadonly as Ct, ZodBranded as At, ZodEffects as Ne, ZodLazy as Se, ZodString as ee, ZodNumber as te, ZodBoolean as Be, ZodBigInt as be, ZodEnum as ur, ZodNativeEnum as dr, ZodIntersection as pr, ZodUnion as hr, ZodObject as fr, ZodRecord as yr } from "zod";
|
|
4
4
|
import ue from "bs58";
|
|
5
|
-
import { isObject as Vt, isArray as
|
|
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
|
|
7
|
-
import { sha256 as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
5
|
+
import { isObject as Vt, isArray as tt, isString as rt, 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 st, validateAttributesAddedPointer as vr, parsePointer as Ot } from "@blue-labs/repository-contract";
|
|
7
|
+
import { sha256 as Br } from "js-sha256";
|
|
8
|
+
import Ue from "crypto";
|
|
9
|
+
import br from "base32.js";
|
|
10
10
|
import H from "js-yaml";
|
|
11
|
-
class S extends
|
|
11
|
+
class S extends D {
|
|
12
12
|
constructor(e) {
|
|
13
13
|
super(e);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
class E extends
|
|
16
|
+
class E extends D {
|
|
17
17
|
constructor(e) {
|
|
18
18
|
super(e);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
const G = "name", J = "description", W = "type", fe = "itemType", ye = "keyType", ge = "valueType", me = "value",
|
|
21
|
+
const G = "name", J = "description", W = "type", fe = "itemType", ye = "keyType", ge = "valueType", me = "value", Me = "items", x = "blueId", De = "blue", nt = [
|
|
22
22
|
G,
|
|
23
23
|
J,
|
|
24
24
|
W,
|
|
@@ -26,65 +26,65 @@ const G = "name", J = "description", W = "type", fe = "itemType", ye = "keyType"
|
|
|
26
26
|
ye,
|
|
27
27
|
ge,
|
|
28
28
|
me,
|
|
29
|
-
|
|
29
|
+
Me,
|
|
30
30
|
x,
|
|
31
31
|
De
|
|
32
|
-
],
|
|
33
|
-
Dt,
|
|
32
|
+
], Mt = "Text", Dt = "Double", xt = "Integer", Ft = "Boolean", $t = "List", _t = "Dictionary", xe = [
|
|
34
33
|
Mt,
|
|
34
|
+
Dt,
|
|
35
35
|
xt,
|
|
36
36
|
Ft
|
|
37
|
-
],
|
|
37
|
+
], it = [...xe, $t, _t], _ = "DLRQwz7MQeCrzjy9bohPNwtCxKEBbKaMK65KBrwjfG6K", L = "7pwXmXYCJtWnd348c2JQGBkm9C4renmZRwxbfaypsx5y", j = "5WNMiV9Knz63B4dVY5JtMyh3FB4FSGqv7ceScvuapdE1", U = "4EzhSubEimSQD3zrYHRtobfPPWntUuhEz8YcdxHsi12u", ot = "6aehfNAxHLC1PHHoDr3tYtFH3RWNbiWdFancJ1bypXEY", lt = "G7fBT9PSod1RfHLHkpafAGBDVAJMrMhAMY51ERcyXNrj", at = [
|
|
38
38
|
_,
|
|
39
|
-
j,
|
|
40
39
|
L,
|
|
40
|
+
j,
|
|
41
41
|
U
|
|
42
42
|
], X = [
|
|
43
|
-
...
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
],
|
|
47
|
-
|
|
48
|
-
),
|
|
49
|
-
X.map((s, e) => [s,
|
|
43
|
+
...at,
|
|
44
|
+
ot,
|
|
45
|
+
lt
|
|
46
|
+
], wr = Object.fromEntries(
|
|
47
|
+
it.map((s, e) => [s, X[e]])
|
|
48
|
+
), Fe = Object.fromEntries(
|
|
49
|
+
X.map((s, e) => [s, it[e]])
|
|
50
50
|
), On = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
51
51
|
__proto__: null,
|
|
52
|
-
BASIC_TYPES:
|
|
53
|
-
BASIC_TYPE_BLUE_IDS:
|
|
52
|
+
BASIC_TYPES: xe,
|
|
53
|
+
BASIC_TYPE_BLUE_IDS: at,
|
|
54
54
|
BOOLEAN_TYPE: Ft,
|
|
55
55
|
BOOLEAN_TYPE_BLUE_ID: U,
|
|
56
|
-
CORE_TYPES:
|
|
56
|
+
CORE_TYPES: it,
|
|
57
57
|
CORE_TYPE_BLUE_IDS: X,
|
|
58
|
-
CORE_TYPE_BLUE_ID_TO_NAME_MAP:
|
|
59
|
-
CORE_TYPE_NAME_TO_BLUE_ID_MAP:
|
|
58
|
+
CORE_TYPE_BLUE_ID_TO_NAME_MAP: Fe,
|
|
59
|
+
CORE_TYPE_NAME_TO_BLUE_ID_MAP: wr,
|
|
60
60
|
DICTIONARY_TYPE: _t,
|
|
61
|
-
DICTIONARY_TYPE_BLUE_ID:
|
|
62
|
-
DOUBLE_TYPE:
|
|
63
|
-
DOUBLE_TYPE_BLUE_ID:
|
|
61
|
+
DICTIONARY_TYPE_BLUE_ID: lt,
|
|
62
|
+
DOUBLE_TYPE: Dt,
|
|
63
|
+
DOUBLE_TYPE_BLUE_ID: L,
|
|
64
64
|
INTEGER_TYPE: xt,
|
|
65
|
-
INTEGER_TYPE_BLUE_ID:
|
|
65
|
+
INTEGER_TYPE_BLUE_ID: j,
|
|
66
66
|
LIST_TYPE: $t,
|
|
67
|
-
LIST_TYPE_BLUE_ID:
|
|
67
|
+
LIST_TYPE_BLUE_ID: ot,
|
|
68
68
|
OBJECT_BLUE: De,
|
|
69
69
|
OBJECT_BLUE_ID: x,
|
|
70
70
|
OBJECT_CONTRACTS: V,
|
|
71
71
|
OBJECT_DESCRIPTION: J,
|
|
72
|
-
OBJECT_ITEMS:
|
|
72
|
+
OBJECT_ITEMS: Me,
|
|
73
73
|
OBJECT_ITEM_TYPE: fe,
|
|
74
74
|
OBJECT_KEY_TYPE: ye,
|
|
75
75
|
OBJECT_MERGE_POLICY: Ir,
|
|
76
76
|
OBJECT_NAME: G,
|
|
77
77
|
OBJECT_SCHEMA: Tr,
|
|
78
|
-
OBJECT_SPECIFIC_KEYS:
|
|
78
|
+
OBJECT_SPECIFIC_KEYS: nt,
|
|
79
79
|
OBJECT_TYPE: W,
|
|
80
80
|
OBJECT_VALUE: me,
|
|
81
81
|
OBJECT_VALUE_TYPE: ge,
|
|
82
|
-
TEXT_TYPE:
|
|
82
|
+
TEXT_TYPE: Mt,
|
|
83
83
|
TEXT_TYPE_BLUE_ID: _
|
|
84
84
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
85
85
|
class Er {
|
|
86
86
|
static get(e, t, r, n = !0) {
|
|
87
|
-
if (
|
|
87
|
+
if (m(t) || !t.startsWith("/"))
|
|
88
88
|
throw new Error(`Invalid path: ${t}`);
|
|
89
89
|
if (t === "/") {
|
|
90
90
|
const o = e.getValue();
|
|
@@ -197,7 +197,7 @@ class Er {
|
|
|
197
197
|
}
|
|
198
198
|
static link(e, t) {
|
|
199
199
|
const r = t(e);
|
|
200
|
-
return
|
|
200
|
+
return d(r) ? r : e;
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
class c {
|
|
@@ -255,10 +255,10 @@ class c {
|
|
|
255
255
|
}
|
|
256
256
|
getValue() {
|
|
257
257
|
const e = this.type?.getBlueId();
|
|
258
|
-
if (
|
|
259
|
-
if (e ===
|
|
258
|
+
if (d(e) && d(this.value)) {
|
|
259
|
+
if (e === j && typeof this.value == "string")
|
|
260
260
|
return new E(this.value);
|
|
261
|
-
if (e ===
|
|
261
|
+
if (e === L && 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")
|
|
@@ -297,14 +297,14 @@ class c {
|
|
|
297
297
|
return this.getContractsProperty()?.getProperties();
|
|
298
298
|
}
|
|
299
299
|
setContracts(e) {
|
|
300
|
-
return
|
|
300
|
+
return m(e) ? this.removeProperty(V) : this.addProperty(
|
|
301
301
|
V,
|
|
302
302
|
new c().setProperties(e)
|
|
303
303
|
), this;
|
|
304
304
|
}
|
|
305
305
|
addContract(e, t) {
|
|
306
306
|
const r = this.getContractsProperty();
|
|
307
|
-
return
|
|
307
|
+
return m(r) ? this.addProperty(
|
|
308
308
|
V,
|
|
309
309
|
new c().addProperty(e, t)
|
|
310
310
|
) : r.addProperty(e, t), this;
|
|
@@ -374,7 +374,7 @@ class c {
|
|
|
374
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}}`;
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
|
-
class
|
|
377
|
+
class Ce {
|
|
378
378
|
static MIN_BLUE_ID_LENGTH = 41;
|
|
379
379
|
static MAX_BLUE_ID_LENGTH = 45;
|
|
380
380
|
static BLUE_ID_PATTERN = /^[1-9A-HJ-NP-Za-km-z]{41,45}(?:#\d+)?$/;
|
|
@@ -400,9 +400,9 @@ class Se {
|
|
|
400
400
|
return !0;
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
|
-
const
|
|
403
|
+
const Mn = h.string().max(Ce.MAX_BLUE_ID_LENGTH, {
|
|
404
404
|
message: "Blue Id has a maximum length of 45 characters"
|
|
405
|
-
}).min(
|
|
405
|
+
}).min(Ce.MIN_BLUE_ID_LENGTH, {
|
|
406
406
|
message: "Blue Id has a minimum length of 41 characters"
|
|
407
407
|
}).refine(
|
|
408
408
|
(s) => {
|
|
@@ -426,34 +426,34 @@ const Dn = h.string().max(Se.MAX_BLUE_ID_LENGTH, {
|
|
|
426
426
|
items: h.array(de).optional()
|
|
427
427
|
})
|
|
428
428
|
)
|
|
429
|
-
),
|
|
429
|
+
), $e = h.object({
|
|
430
430
|
blueId: h.string().optional(),
|
|
431
431
|
name: h.string().optional(),
|
|
432
432
|
description: h.string().optional(),
|
|
433
433
|
type: de.optional()
|
|
434
|
-
}),
|
|
434
|
+
}), Dn = $e.extend({
|
|
435
435
|
value: h.string().optional()
|
|
436
|
-
}), xn =
|
|
436
|
+
}), xn = $e.extend({
|
|
437
437
|
value: h.number().optional()
|
|
438
|
-
}), Fn =
|
|
438
|
+
}), Fn = $e.extend({
|
|
439
439
|
value: h.boolean().optional()
|
|
440
|
-
}), $n =
|
|
440
|
+
}), $n = $e.extend({
|
|
441
441
|
items: h.array(h.string()).optional()
|
|
442
|
-
}), _n = (s) => de.safeParse(s).success,
|
|
443
|
-
() => h.record(
|
|
442
|
+
}), _n = (s) => de.safeParse(s).success, Pr = (s) => d(s) && "blueId" in s && d(s.blueId), Ln = (s) => d(s) && "name" in s && d(s.name), Nr = (s) => d(s) && "items" in s && d(s.items), Sr = (s) => d(s) && "type" in s && d(s.type), Cr = (s) => d(s) && "value" in s && d(s.value), jn = (s, e) => s.required({ type: !0 }).safeParse(e).success, C = (s) => s instanceof D, Z = (s) => C(s) && s instanceof E, We = (s) => C(s) && s instanceof S, Ar = h.lazy(
|
|
443
|
+
() => h.record(Ae)
|
|
444
444
|
), Vr = h.lazy(
|
|
445
445
|
() => h.union([
|
|
446
|
-
h.array(
|
|
447
|
-
h.array(
|
|
446
|
+
h.array(Ae),
|
|
447
|
+
h.array(Ae).readonly()
|
|
448
448
|
])
|
|
449
|
-
),
|
|
449
|
+
), Ae = h.lazy(
|
|
450
450
|
() => h.union([
|
|
451
451
|
cr,
|
|
452
452
|
Ar,
|
|
453
453
|
Vr,
|
|
454
|
-
h.instanceof(
|
|
454
|
+
h.instanceof(D)
|
|
455
455
|
])
|
|
456
|
-
),
|
|
456
|
+
), Lt = (s) => Vt(s) && !tt(s) && !Pe(s) && !C(s), jt = (s) => tt(s) || Pe(s), Un = (s) => jt(s) || Lt(s) || C(s) || et(s);
|
|
457
457
|
class g {
|
|
458
458
|
static deserialize(e) {
|
|
459
459
|
return g.handleNode(e);
|
|
@@ -463,7 +463,7 @@ class g {
|
|
|
463
463
|
throw new Error(
|
|
464
464
|
"This is not a valid JSON-like value. Found 'undefined' as a value."
|
|
465
465
|
);
|
|
466
|
-
if (
|
|
466
|
+
if (Lt(e)) {
|
|
467
467
|
const t = new c(), r = {};
|
|
468
468
|
return Object.entries(e).forEach(([n, i]) => {
|
|
469
469
|
switch (n) {
|
|
@@ -507,7 +507,7 @@ class g {
|
|
|
507
507
|
throw new Error(`The ${x} field must be a string.`);
|
|
508
508
|
t.setBlueId(i);
|
|
509
509
|
break;
|
|
510
|
-
case
|
|
510
|
+
case Me:
|
|
511
511
|
t.setItems(g.handleArray(i));
|
|
512
512
|
break;
|
|
513
513
|
case De:
|
|
@@ -519,7 +519,7 @@ class g {
|
|
|
519
519
|
}
|
|
520
520
|
}), Object.keys(r).length > 0 && t.setProperties(r), t;
|
|
521
521
|
} else {
|
|
522
|
-
if (
|
|
522
|
+
if (jt(e))
|
|
523
523
|
return new c().setItems(g.handleArray(e));
|
|
524
524
|
{
|
|
525
525
|
const t = e;
|
|
@@ -557,9 +557,9 @@ class g {
|
|
|
557
557
|
function Rr(s) {
|
|
558
558
|
return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
|
|
559
559
|
}
|
|
560
|
-
var
|
|
560
|
+
var ke, mt;
|
|
561
561
|
function Or() {
|
|
562
|
-
return mt || (mt = 1,
|
|
562
|
+
return mt || (mt = 1, ke = function s(e) {
|
|
563
563
|
if (typeof e == "number" && isNaN(e))
|
|
564
564
|
throw new Error("NaN is not allowed");
|
|
565
565
|
if (typeof e == "number" && !isFinite(e))
|
|
@@ -570,40 +570,40 @@ function Or() {
|
|
|
570
570
|
const i = r.length === 0 ? "" : ",";
|
|
571
571
|
return `${r}${i}${s(n)}:${s(e[n])}`;
|
|
572
572
|
}, "")}}`;
|
|
573
|
-
}),
|
|
573
|
+
}), ke;
|
|
574
574
|
}
|
|
575
|
-
var
|
|
576
|
-
const
|
|
577
|
-
class
|
|
575
|
+
var Mr = Or();
|
|
576
|
+
const Dr = /* @__PURE__ */ Rr(Mr);
|
|
577
|
+
class Ze {
|
|
578
578
|
static canonicalize(e) {
|
|
579
|
-
return
|
|
579
|
+
return Dr(e);
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
|
-
const
|
|
583
|
-
class
|
|
582
|
+
const Ke = typeof process < "u" && process.versions != null && process.versions.node != null;
|
|
583
|
+
class ct {
|
|
584
584
|
static instance;
|
|
585
585
|
browserCrypto;
|
|
586
586
|
constructor() {
|
|
587
587
|
this.browserCrypto = this.initBrowserCrypto();
|
|
588
588
|
}
|
|
589
589
|
static getInstance() {
|
|
590
|
-
return this.instance || (this.instance = new
|
|
590
|
+
return this.instance || (this.instance = new ct()), this.instance;
|
|
591
591
|
}
|
|
592
592
|
initBrowserCrypto() {
|
|
593
|
-
return
|
|
593
|
+
return Ke ? null : "crypto" in globalThis ? globalThis.crypto : null;
|
|
594
594
|
}
|
|
595
595
|
hasNodeCrypto() {
|
|
596
|
-
return
|
|
596
|
+
return Ke && !!Ue && typeof Ue.createHash == "function";
|
|
597
597
|
}
|
|
598
598
|
getBrowserCrypto() {
|
|
599
599
|
return this.browserCrypto;
|
|
600
600
|
}
|
|
601
601
|
getNodeCrypto() {
|
|
602
|
-
return
|
|
602
|
+
return Ke ? Ue : null;
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
605
|
class xr {
|
|
606
|
-
cryptoEnv =
|
|
606
|
+
cryptoEnv = ct.getInstance();
|
|
607
607
|
applySync(e) {
|
|
608
608
|
const t = this.canonicalizeInput(e), r = this.cryptoEnv.hasNodeCrypto() ? this.sha256Sync(t) : this.sha256SyncBrowser(t);
|
|
609
609
|
return ue.encode(r);
|
|
@@ -613,7 +613,7 @@ class xr {
|
|
|
613
613
|
return ue.encode(r);
|
|
614
614
|
}
|
|
615
615
|
canonicalizeInput(e) {
|
|
616
|
-
const t =
|
|
616
|
+
const t = Ze.canonicalize(e);
|
|
617
617
|
if (typeof t != "string")
|
|
618
618
|
throw new Error("Canonized value must be a string");
|
|
619
619
|
return t;
|
|
@@ -628,7 +628,7 @@ class xr {
|
|
|
628
628
|
return new Uint8Array(r);
|
|
629
629
|
}
|
|
630
630
|
sha256SyncBrowser(e) {
|
|
631
|
-
return new Uint8Array(
|
|
631
|
+
return new Uint8Array(Br.arrayBuffer(e));
|
|
632
632
|
}
|
|
633
633
|
async sha256Async(e) {
|
|
634
634
|
if (this.cryptoEnv.hasNodeCrypto())
|
|
@@ -640,7 +640,7 @@ class xr {
|
|
|
640
640
|
return new Uint8Array(i);
|
|
641
641
|
}
|
|
642
642
|
}
|
|
643
|
-
class
|
|
643
|
+
class I {
|
|
644
644
|
/**
|
|
645
645
|
* Converts a BlueNode to a JSON representation based on the specified strategy.
|
|
646
646
|
*
|
|
@@ -655,7 +655,7 @@ class m {
|
|
|
655
655
|
const r = e.getValue(), n = this.handleValue(r);
|
|
656
656
|
if (n !== void 0 && t === "simple")
|
|
657
657
|
return n;
|
|
658
|
-
const i = e.getItems()?.map((Q) =>
|
|
658
|
+
const i = e.getItems()?.map((Q) => I.get(Q, t));
|
|
659
659
|
if (i !== void 0 && t === "simple")
|
|
660
660
|
return i;
|
|
661
661
|
const o = e.getName(), l = e.getDescription();
|
|
@@ -671,26 +671,26 @@ class m {
|
|
|
671
671
|
if (t === "official" && r !== void 0 && u === void 0) {
|
|
672
672
|
const Q = this.inferTypeBlueId(r);
|
|
673
673
|
Q !== null && (a[W] = { [x]: Q });
|
|
674
|
-
} else u !== void 0 && (a[W] =
|
|
674
|
+
} else u !== void 0 && (a[W] = I.get(u, t));
|
|
675
675
|
const y = e.getItemType();
|
|
676
|
-
y !== void 0 && (a[fe] =
|
|
677
|
-
const
|
|
678
|
-
|
|
676
|
+
y !== void 0 && (a[fe] = I.get(y, t));
|
|
677
|
+
const p = e.getKeyType();
|
|
678
|
+
p !== void 0 && (a[ye] = I.get(p, t));
|
|
679
679
|
const f = e.getValueType();
|
|
680
|
-
f !== void 0 && (a[ge] =
|
|
680
|
+
f !== void 0 && (a[ge] = I.get(f, t)), n !== void 0 && (a[me] = n), i !== void 0 && (a[Me] = i);
|
|
681
681
|
const v = e.getBlueId();
|
|
682
682
|
v !== void 0 && (a[x] = v);
|
|
683
683
|
const k = e.getBlue();
|
|
684
684
|
k !== void 0 && (a[De] = k);
|
|
685
685
|
const q = e.getProperties();
|
|
686
686
|
return q !== void 0 && Object.entries(q).forEach(([Q, ar]) => {
|
|
687
|
-
a[Q] =
|
|
687
|
+
a[Q] = I.get(ar, t);
|
|
688
688
|
}), a;
|
|
689
689
|
}
|
|
690
690
|
static handleValue(e) {
|
|
691
691
|
if (C(e)) {
|
|
692
692
|
if (Z(e)) {
|
|
693
|
-
const t = new
|
|
693
|
+
const t = new D(Number.MIN_SAFE_INTEGER.toString()), r = new D(Number.MAX_SAFE_INTEGER.toString());
|
|
694
694
|
if (e.lt(t) || e.gt(r))
|
|
695
695
|
return e.toString();
|
|
696
696
|
}
|
|
@@ -699,10 +699,10 @@ class m {
|
|
|
699
699
|
return e;
|
|
700
700
|
}
|
|
701
701
|
static inferTypeBlueId(e) {
|
|
702
|
-
return typeof e == "string" ? _ : C(e) ? Z(e) ?
|
|
702
|
+
return typeof e == "string" ? _ : C(e) ? Z(e) ? j : L : typeof e == "boolean" ? U : null;
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
|
-
const Fr = (s) =>
|
|
705
|
+
const Fr = (s) => et(s) && d(s);
|
|
706
706
|
class T {
|
|
707
707
|
static INSTANCE = new T(new xr());
|
|
708
708
|
hashProvider;
|
|
@@ -711,18 +711,18 @@ class T {
|
|
|
711
711
|
}
|
|
712
712
|
static calculateBlueId(e) {
|
|
713
713
|
if (Array.isArray(e)) {
|
|
714
|
-
const r = e.map((n) =>
|
|
714
|
+
const r = e.map((n) => I.get(n));
|
|
715
715
|
return T.INSTANCE.calculate(r);
|
|
716
716
|
}
|
|
717
|
-
const t =
|
|
717
|
+
const t = I.get(e);
|
|
718
718
|
return T.INSTANCE.calculate(t);
|
|
719
719
|
}
|
|
720
720
|
static calculateBlueIdSync(e) {
|
|
721
721
|
if (Array.isArray(e)) {
|
|
722
|
-
const r = e.map((n) =>
|
|
722
|
+
const r = e.map((n) => I.get(n));
|
|
723
723
|
return T.INSTANCE.calculateSync(r);
|
|
724
724
|
}
|
|
725
|
-
const t =
|
|
725
|
+
const t = I.get(e);
|
|
726
726
|
return T.INSTANCE.calculateSync(t);
|
|
727
727
|
}
|
|
728
728
|
calculate(e) {
|
|
@@ -739,7 +739,7 @@ class T {
|
|
|
739
739
|
}
|
|
740
740
|
// Internal method to calculate BlueId recursively
|
|
741
741
|
internalCalculate(e, t) {
|
|
742
|
-
return Fr(e) || C(e) ? this.applyHash(e.toString(), t) : Array.isArray(e) ||
|
|
742
|
+
return Fr(e) || C(e) ? this.applyHash(e.toString(), t) : Array.isArray(e) || Pe(e) ? this.calculateList(e, t) : this.calculateMap(e, t);
|
|
743
743
|
}
|
|
744
744
|
calculateMap(e, t) {
|
|
745
745
|
if (e[x] !== void 0)
|
|
@@ -789,10 +789,10 @@ class T {
|
|
|
789
789
|
// Method to clean the input structure by removing null or undefined values
|
|
790
790
|
cleanStructure(e) {
|
|
791
791
|
if (e != null) {
|
|
792
|
-
if (
|
|
792
|
+
if (et(e) || C(e))
|
|
793
793
|
return e;
|
|
794
|
-
if (Array.isArray(e) ||
|
|
795
|
-
const t = e.map((r) => this.cleanStructure(r)).filter(
|
|
794
|
+
if (Array.isArray(e) || Pe(e)) {
|
|
795
|
+
const t = e.map((r) => this.cleanStructure(r)).filter(d);
|
|
796
796
|
return t.length > 0 ? t : void 0;
|
|
797
797
|
} else if (typeof e == "object") {
|
|
798
798
|
const t = {};
|
|
@@ -811,10 +811,10 @@ class kn {
|
|
|
811
811
|
const t = ue.decode(e), r = new Uint8Array(2 + t.length);
|
|
812
812
|
r[0] = 18, r[1] = 32, r.set(t, 2);
|
|
813
813
|
const n = new Uint8Array(2 + r.length);
|
|
814
|
-
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 br.Encoder({ type: "rfc4648", lc: !0 }).write(n).finalize().replace(/=/g, "");
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
|
-
class
|
|
817
|
+
class w {
|
|
818
818
|
/**
|
|
819
819
|
* Transforms a node and all its child nodes using the provided transformer function
|
|
820
820
|
* @param node - The node to transform
|
|
@@ -823,30 +823,30 @@ class B {
|
|
|
823
823
|
*/
|
|
824
824
|
static transform(e, t) {
|
|
825
825
|
const r = t(e.clone()), n = r.getType();
|
|
826
|
-
n !== void 0 && r.setType(
|
|
826
|
+
n !== void 0 && r.setType(w.transform(n, t));
|
|
827
827
|
const i = r.getItemType();
|
|
828
828
|
i !== void 0 && r.setItemType(
|
|
829
|
-
|
|
829
|
+
w.transform(i, t)
|
|
830
830
|
);
|
|
831
831
|
const o = r.getKeyType();
|
|
832
832
|
o !== void 0 && r.setKeyType(
|
|
833
|
-
|
|
833
|
+
w.transform(o, t)
|
|
834
834
|
);
|
|
835
835
|
const l = r.getValueType();
|
|
836
836
|
l !== void 0 && r.setValueType(
|
|
837
|
-
|
|
837
|
+
w.transform(l, t)
|
|
838
838
|
);
|
|
839
839
|
const a = r.getItems();
|
|
840
840
|
if (a !== void 0) {
|
|
841
841
|
const y = a.map(
|
|
842
|
-
(
|
|
842
|
+
(p) => w.transform(p, t)
|
|
843
843
|
);
|
|
844
844
|
r.setItems(y);
|
|
845
845
|
}
|
|
846
846
|
const u = r.getProperties();
|
|
847
847
|
if (u !== void 0) {
|
|
848
848
|
const y = Object.keys(u).reduce(
|
|
849
|
-
(
|
|
849
|
+
(p, f) => (p[f] = w.transform(u[f], t), p),
|
|
850
850
|
{}
|
|
851
851
|
);
|
|
852
852
|
r.setProperties(y);
|
|
@@ -968,7 +968,7 @@ function le(s, e) {
|
|
|
968
968
|
key: Array.isArray(t) ? se(r) : r
|
|
969
969
|
};
|
|
970
970
|
}
|
|
971
|
-
function
|
|
971
|
+
function ut(s, e) {
|
|
972
972
|
if (s instanceof c) {
|
|
973
973
|
const t = e, r = Ut(s, t, !1);
|
|
974
974
|
if (r !== void 0 || [
|
|
@@ -994,23 +994,23 @@ function ct(s, e) {
|
|
|
994
994
|
}
|
|
995
995
|
return Array.isArray(s) || F(s) ? s[e] : s;
|
|
996
996
|
}
|
|
997
|
-
function
|
|
997
|
+
function N(s) {
|
|
998
998
|
if (s instanceof c) return s;
|
|
999
999
|
if (s === null || typeof s == "string" || typeof s == "number" || typeof s == "boolean" || O(s))
|
|
1000
1000
|
return g.deserialize(s);
|
|
1001
|
-
const e =
|
|
1001
|
+
const e = He(s);
|
|
1002
1002
|
return g.deserialize(e);
|
|
1003
1003
|
}
|
|
1004
|
-
function
|
|
1004
|
+
function He(s) {
|
|
1005
1005
|
if (s === void 0) return null;
|
|
1006
1006
|
if (s === null || typeof s != "object") return s;
|
|
1007
|
-
if (Array.isArray(s)) return s.map(
|
|
1007
|
+
if (Array.isArray(s)) return s.map(He);
|
|
1008
1008
|
const e = {};
|
|
1009
1009
|
for (const [t, r] of Object.entries(s))
|
|
1010
|
-
e[t] =
|
|
1010
|
+
e[t] = He(r);
|
|
1011
1011
|
return e;
|
|
1012
1012
|
}
|
|
1013
|
-
function
|
|
1013
|
+
function dt(s, e, t) {
|
|
1014
1014
|
if (s instanceof c) {
|
|
1015
1015
|
const r = e;
|
|
1016
1016
|
switch (r) {
|
|
@@ -1022,22 +1022,22 @@ function ut(s, e, t) {
|
|
|
1022
1022
|
return;
|
|
1023
1023
|
case "type":
|
|
1024
1024
|
s.setType(
|
|
1025
|
-
t instanceof c || typeof t == "string" || t === void 0 ? t :
|
|
1025
|
+
t instanceof c || typeof t == "string" || t === void 0 ? t : N(t)
|
|
1026
1026
|
);
|
|
1027
1027
|
return;
|
|
1028
1028
|
case "itemType":
|
|
1029
1029
|
s.setItemType(
|
|
1030
|
-
t instanceof c || typeof t == "string" || t === void 0 ? t :
|
|
1030
|
+
t instanceof c || typeof t == "string" || t === void 0 ? t : N(t)
|
|
1031
1031
|
);
|
|
1032
1032
|
return;
|
|
1033
1033
|
case "keyType":
|
|
1034
1034
|
s.setKeyType(
|
|
1035
|
-
t instanceof c || typeof t == "string" || t === void 0 ? t :
|
|
1035
|
+
t instanceof c || typeof t == "string" || t === void 0 ? t : N(t)
|
|
1036
1036
|
);
|
|
1037
1037
|
return;
|
|
1038
1038
|
case "valueType":
|
|
1039
1039
|
s.setValueType(
|
|
1040
|
-
t instanceof c || typeof t == "string" || t === void 0 ? t :
|
|
1040
|
+
t instanceof c || typeof t == "string" || t === void 0 ? t : N(t)
|
|
1041
1041
|
);
|
|
1042
1042
|
return;
|
|
1043
1043
|
case "value": {
|
|
@@ -1050,7 +1050,7 @@ function ut(s, e, t) {
|
|
|
1050
1050
|
return;
|
|
1051
1051
|
case "blue":
|
|
1052
1052
|
s.setBlue(
|
|
1053
|
-
t instanceof c || t === void 0 ? t :
|
|
1053
|
+
t instanceof c || t === void 0 ? t : N(t)
|
|
1054
1054
|
);
|
|
1055
1055
|
return;
|
|
1056
1056
|
case "items":
|
|
@@ -1067,7 +1067,7 @@ function ut(s, e, t) {
|
|
|
1067
1067
|
const n = s.getProperties();
|
|
1068
1068
|
n && r in n && delete n[r];
|
|
1069
1069
|
} else
|
|
1070
|
-
s.getProperties() || s.setProperties({}), s.addProperty(r, t instanceof c ? t :
|
|
1070
|
+
s.getProperties() || s.setProperties({}), s.addProperty(r, t instanceof c ? t : N(t));
|
|
1071
1071
|
return;
|
|
1072
1072
|
}
|
|
1073
1073
|
}
|
|
@@ -1100,7 +1100,7 @@ function _r(s, e, t, r) {
|
|
|
1100
1100
|
} else
|
|
1101
1101
|
i.splice(n, 0, t);
|
|
1102
1102
|
}
|
|
1103
|
-
function
|
|
1103
|
+
function Ve(s, e, t, r) {
|
|
1104
1104
|
if (Array.isArray(s)) {
|
|
1105
1105
|
const n = e === "-" ? s.length : se(e);
|
|
1106
1106
|
if (!r && n > s.length)
|
|
@@ -1109,7 +1109,7 @@ function Ae(s, e, t, r) {
|
|
|
1109
1109
|
);
|
|
1110
1110
|
if (n < 0 && e !== "-")
|
|
1111
1111
|
throw new Error(`Invalid negative array index: ${e}`);
|
|
1112
|
-
const i =
|
|
1112
|
+
const i = N(t);
|
|
1113
1113
|
if (r) {
|
|
1114
1114
|
if (n >= 0 && n < s.length) s[n] = i;
|
|
1115
1115
|
else if (n >= s.length) {
|
|
@@ -1122,16 +1122,16 @@ function Ae(s, e, t, r) {
|
|
|
1122
1122
|
return;
|
|
1123
1123
|
}
|
|
1124
1124
|
if (s instanceof c) {
|
|
1125
|
-
e === "-" || typeof e == "number" && !isNaN(e) || typeof e == "string" && /^\d+$/.test(e) ? _r(s, e,
|
|
1125
|
+
e === "-" || typeof e == "number" && !isNaN(e) || typeof e == "string" && /^\d+$/.test(e) ? _r(s, e, N(t), r) : dt(s, e, t);
|
|
1126
1126
|
return;
|
|
1127
1127
|
}
|
|
1128
1128
|
if (F(s)) {
|
|
1129
|
-
s[e] =
|
|
1129
|
+
s[e] = N(t);
|
|
1130
1130
|
return;
|
|
1131
1131
|
}
|
|
1132
1132
|
throw new Error(`Cannot insert into parent of type ${typeof s}`);
|
|
1133
1133
|
}
|
|
1134
|
-
function
|
|
1134
|
+
function Lr(s, e) {
|
|
1135
1135
|
if (Array.isArray(s)) {
|
|
1136
1136
|
const t = se(e);
|
|
1137
1137
|
t === -1 && e === "-" ? s.length > 0 && s.pop() : t >= 0 && t < s.length && s.splice(t, 1);
|
|
@@ -1146,17 +1146,17 @@ function jr(s, e) {
|
|
|
1146
1146
|
return;
|
|
1147
1147
|
}
|
|
1148
1148
|
}
|
|
1149
|
-
|
|
1149
|
+
dt(s, e, void 0);
|
|
1150
1150
|
} else F(s) && delete s[e];
|
|
1151
1151
|
}
|
|
1152
|
-
function
|
|
1152
|
+
function Xe(s) {
|
|
1153
1153
|
if (s instanceof c) return s.clone();
|
|
1154
1154
|
if (Array.isArray(s))
|
|
1155
|
-
return s.map((t) =>
|
|
1155
|
+
return s.map((t) => Xe(t));
|
|
1156
1156
|
if (F(s)) {
|
|
1157
1157
|
const e = {};
|
|
1158
1158
|
return Object.keys(s).forEach((t) => {
|
|
1159
|
-
e[t] =
|
|
1159
|
+
e[t] = Xe(s[t]);
|
|
1160
1160
|
}), e;
|
|
1161
1161
|
}
|
|
1162
1162
|
return s;
|
|
@@ -1176,52 +1176,52 @@ function Y(s, e) {
|
|
|
1176
1176
|
}
|
|
1177
1177
|
function kt(s, e) {
|
|
1178
1178
|
const { parent: t, key: r } = le(s, oe(e));
|
|
1179
|
-
return
|
|
1179
|
+
return ut(t, r);
|
|
1180
1180
|
}
|
|
1181
1181
|
function Kt(s, e, t) {
|
|
1182
1182
|
const r = oe(e);
|
|
1183
1183
|
if (r.length === 0 && e === "/") {
|
|
1184
|
-
const o =
|
|
1184
|
+
const o = N(t);
|
|
1185
1185
|
s.setValue(o.getValue() ?? null), o.getItems() ? s.setItems(o.getItems()) : s.setItems(void 0);
|
|
1186
1186
|
return;
|
|
1187
1187
|
}
|
|
1188
1188
|
const { parent: n, key: i } = le(s, r);
|
|
1189
|
-
|
|
1189
|
+
Ve(n, i, t, !0);
|
|
1190
1190
|
}
|
|
1191
|
-
function
|
|
1191
|
+
function jr(s, e, t) {
|
|
1192
1192
|
const r = oe(e);
|
|
1193
1193
|
if (r.length === 0 && e === "/") {
|
|
1194
1194
|
if (s.getItems() && Array.isArray(t)) {
|
|
1195
|
-
const o =
|
|
1195
|
+
const o = N(t);
|
|
1196
1196
|
o.getItems() ? (s.setItems(o.getItems()), s.setValue(null)) : (s.setValue(o.getValue() ?? null), s.setItems(void 0));
|
|
1197
1197
|
} else {
|
|
1198
|
-
const o =
|
|
1198
|
+
const o = N(t);
|
|
1199
1199
|
s.setValue(o.getValue() ?? null), o.getItems() && s.setItems(o.getItems());
|
|
1200
1200
|
}
|
|
1201
1201
|
return !0;
|
|
1202
1202
|
}
|
|
1203
1203
|
const { parent: n, key: i } = le(s, r);
|
|
1204
|
-
return
|
|
1204
|
+
return Ve(n, i, t, !1), !0;
|
|
1205
1205
|
}
|
|
1206
1206
|
function Ur(s, e, t) {
|
|
1207
1207
|
const r = oe(e);
|
|
1208
1208
|
if (r.length === 0 && e === "/") {
|
|
1209
|
-
const l =
|
|
1209
|
+
const l = N(t);
|
|
1210
1210
|
return s.setValue(l.getValue() ?? null), l.getItems() ? s.setItems(l.getItems()) : s.setItems(void 0), !0;
|
|
1211
1211
|
}
|
|
1212
1212
|
const { parent: n, key: i, actualTarget: o } = le(s, r);
|
|
1213
1213
|
if (o !== void 0 && n instanceof c)
|
|
1214
|
-
|
|
1214
|
+
dt(n, i, t);
|
|
1215
1215
|
else {
|
|
1216
|
-
const l =
|
|
1216
|
+
const l = ut(n, i), a = Array.isArray(n) || n instanceof c && n.getItems() && (typeof i == "number" || typeof i == "string" && /^\d+$/.test(i));
|
|
1217
1217
|
if (l === void 0) {
|
|
1218
1218
|
if (a)
|
|
1219
1219
|
throw new Error(
|
|
1220
1220
|
`REPLACE failed: Target array index '${i.toString()}' is out of bounds or does not exist at path '${e}'.`
|
|
1221
1221
|
);
|
|
1222
|
-
|
|
1222
|
+
Ve(n, i, t, !0);
|
|
1223
1223
|
} else
|
|
1224
|
-
|
|
1224
|
+
Ve(n, i, t, !0);
|
|
1225
1225
|
}
|
|
1226
1226
|
return !0;
|
|
1227
1227
|
}
|
|
@@ -1230,14 +1230,14 @@ function Yt(s, e) {
|
|
|
1230
1230
|
if (t.length === 0 && e === "/")
|
|
1231
1231
|
return s.setValue(null), s.setItems(void 0), s.setProperties(void 0), !0;
|
|
1232
1232
|
const { parent: r, key: n } = le(s, t);
|
|
1233
|
-
return
|
|
1233
|
+
return Lr(r, n), !0;
|
|
1234
1234
|
}
|
|
1235
1235
|
function kr(s, e, t) {
|
|
1236
|
-
const r =
|
|
1236
|
+
const r = Xe(kt(s, e));
|
|
1237
1237
|
return Kt(s, t, r), !0;
|
|
1238
1238
|
}
|
|
1239
1239
|
function Kr(s, e, t) {
|
|
1240
|
-
const r = oe(e), { parent: n, key: i } = le(s, r), o =
|
|
1240
|
+
const r = oe(e), { parent: n, key: i } = le(s, r), o = ut(n, i);
|
|
1241
1241
|
if (o === void 0)
|
|
1242
1242
|
throw new Error(`MOVE failed: 'from' location '${e}' does not exist.`);
|
|
1243
1243
|
return Yt(s, e) ? (Kt(s, t, o), !0) : !1;
|
|
@@ -1254,7 +1254,7 @@ function Yr(s, e, t) {
|
|
|
1254
1254
|
)}, got ${JSON.stringify(r.getValue() ?? null)}`
|
|
1255
1255
|
);
|
|
1256
1256
|
return !0;
|
|
1257
|
-
} else typeof t == "object" && !(t instanceof c) && (n =
|
|
1257
|
+
} else typeof t == "object" && !(t instanceof c) && (n = N(t));
|
|
1258
1258
|
else if (O(r) && typeof t == "number")
|
|
1259
1259
|
r instanceof E ? n = new E(t.toString()) : r instanceof S && (n = new S(t.toString()));
|
|
1260
1260
|
else if ((r === null || typeof r == "string" || typeof r == "number" || typeof r == "boolean") && O(t)) {
|
|
@@ -1272,7 +1272,7 @@ function Yr(s, e, t) {
|
|
|
1272
1272
|
function zr(s, e) {
|
|
1273
1273
|
switch (e.op) {
|
|
1274
1274
|
case "add":
|
|
1275
|
-
return
|
|
1275
|
+
return jr(s, e.path, e.val);
|
|
1276
1276
|
case "replace":
|
|
1277
1277
|
return Ur(s, e.path, e.val);
|
|
1278
1278
|
case "remove":
|
|
@@ -1289,7 +1289,7 @@ function Kn(s, e, t = !1) {
|
|
|
1289
1289
|
const r = t ? s : s.clone();
|
|
1290
1290
|
return zr(r, e), r;
|
|
1291
1291
|
}
|
|
1292
|
-
const
|
|
1292
|
+
const Ye = Symbol.for("zod-schema-annotations");
|
|
1293
1293
|
function Gr() {
|
|
1294
1294
|
if (typeof globalThis < "u") return globalThis;
|
|
1295
1295
|
if (typeof global < "u") return global;
|
|
@@ -1299,7 +1299,7 @@ function Gr() {
|
|
|
1299
1299
|
}
|
|
1300
1300
|
function zt() {
|
|
1301
1301
|
const s = Gr();
|
|
1302
|
-
return
|
|
1302
|
+
return Ye in s || (s[Ye] = /* @__PURE__ */ new WeakMap()), s[Ye];
|
|
1303
1303
|
}
|
|
1304
1304
|
function Ie(s, e) {
|
|
1305
1305
|
const t = zt(), r = t.get(s) || {};
|
|
@@ -1313,7 +1313,7 @@ const R = (s) => zt().get(s), Jr = (s) => (e) => {
|
|
|
1313
1313
|
});
|
|
1314
1314
|
}, Wr = (s) => {
|
|
1315
1315
|
const e = R(s);
|
|
1316
|
-
return
|
|
1316
|
+
return d(e) && rt(e.blueDescription) ? e.blueDescription : null;
|
|
1317
1317
|
}, Yn = (s) => Jr(s)(h.string().optional()), Zr = h.union([h.string(), h.boolean()]), Hr = (s) => (e) => {
|
|
1318
1318
|
const t = R(e);
|
|
1319
1319
|
return Ie(e, {
|
|
@@ -1331,7 +1331,7 @@ const R = (s) => zt().get(s), Jr = (s) => (e) => {
|
|
|
1331
1331
|
});
|
|
1332
1332
|
}, Qr = (s) => {
|
|
1333
1333
|
const e = R(s);
|
|
1334
|
-
return
|
|
1334
|
+
return d(e) && rt(e.blueName) ? e.blueName : null;
|
|
1335
1335
|
}, Gn = (s) => {
|
|
1336
1336
|
const e = h.string().optional();
|
|
1337
1337
|
return qr(s)(e);
|
|
@@ -1343,7 +1343,7 @@ const R = (s) => zt().get(s), Jr = (s) => (e) => {
|
|
|
1343
1343
|
});
|
|
1344
1344
|
}, ts = (s) => {
|
|
1345
1345
|
const e = R(s);
|
|
1346
|
-
return
|
|
1346
|
+
return d(e) && d(e.blueNode) && e.blueNode === !0 ? e.blueNode : null;
|
|
1347
1347
|
}, Gt = (s) => !!ts(s), Jn = () => {
|
|
1348
1348
|
const s = h.instanceof(c);
|
|
1349
1349
|
return es()(s);
|
|
@@ -1366,13 +1366,13 @@ const R = (s) => zt().get(s), Jr = (s) => (e) => {
|
|
|
1366
1366
|
class pe {
|
|
1367
1367
|
static resolveBlueId(e) {
|
|
1368
1368
|
const t = ss(e);
|
|
1369
|
-
if (
|
|
1369
|
+
if (m(t))
|
|
1370
1370
|
return null;
|
|
1371
1371
|
const r = t.defaultValue;
|
|
1372
|
-
if (
|
|
1372
|
+
if (d(r))
|
|
1373
1373
|
return r;
|
|
1374
1374
|
const n = t.value?.[0];
|
|
1375
|
-
return
|
|
1375
|
+
return d(n) ? n : pe.getRepositoryBlueId(t, e);
|
|
1376
1376
|
}
|
|
1377
1377
|
static getRepositoryBlueId(e, t) {
|
|
1378
1378
|
throw new Error("Not implemented");
|
|
@@ -1382,11 +1382,11 @@ class A {
|
|
|
1382
1382
|
// TODO: Enhance to support schemas associated with multiple blueIds
|
|
1383
1383
|
static isTypeOf(e, t, r) {
|
|
1384
1384
|
const n = pe.resolveBlueId(t), i = e.getType()?.getBlueId();
|
|
1385
|
-
if (
|
|
1385
|
+
if (m(n) || m(i))
|
|
1386
1386
|
return !1;
|
|
1387
1387
|
if (n === i)
|
|
1388
1388
|
return !0;
|
|
1389
|
-
if (r?.checkSchemaExtensions &&
|
|
1389
|
+
if (r?.checkSchemaExtensions && d(r.typeSchemaResolver)) {
|
|
1390
1390
|
const o = r.typeSchemaResolver.resolveSchema(e);
|
|
1391
1391
|
return A.checkSchemaExtension(o, t, {
|
|
1392
1392
|
typeSchemaResolver: r.typeSchemaResolver
|
|
@@ -1398,19 +1398,19 @@ class A {
|
|
|
1398
1398
|
* Checks if a schema extends a base schema.
|
|
1399
1399
|
*/
|
|
1400
1400
|
static checkSchemaExtension(e, t, r) {
|
|
1401
|
-
if (!
|
|
1401
|
+
if (!d(e))
|
|
1402
1402
|
return !1;
|
|
1403
1403
|
const n = A.unwrapSchema(e), i = A.unwrapSchema(t);
|
|
1404
|
-
return
|
|
1404
|
+
return d(r?.typeSchemaResolver) ? r.typeSchemaResolver.isSchemaExtendedFrom(
|
|
1405
1405
|
n,
|
|
1406
1406
|
i
|
|
1407
1407
|
) : !1;
|
|
1408
1408
|
}
|
|
1409
1409
|
static isWrapperType(e) {
|
|
1410
|
-
return e instanceof
|
|
1410
|
+
return e instanceof Nt || e instanceof St || e instanceof Ct || e instanceof At || e instanceof Ne || e instanceof Se;
|
|
1411
1411
|
}
|
|
1412
1412
|
static unwrapSchema(e) {
|
|
1413
|
-
return Gt(e) ? e : A.isWrapperType(e) ? e instanceof Ne ? A.unwrapSchema(e.innerType()) : e instanceof
|
|
1413
|
+
return Gt(e) ? e : A.isWrapperType(e) ? e instanceof Ne ? A.unwrapSchema(e.innerType()) : e instanceof Se ? A.unwrapSchema(e.schema) : A.unwrapSchema(e.unwrap()) : e;
|
|
1414
1414
|
}
|
|
1415
1415
|
}
|
|
1416
1416
|
function Tt(s, e) {
|
|
@@ -1422,7 +1422,7 @@ function Tt(s, e) {
|
|
|
1422
1422
|
if (X.includes(
|
|
1423
1423
|
r
|
|
1424
1424
|
)) {
|
|
1425
|
-
const i =
|
|
1425
|
+
const i = Fe[r];
|
|
1426
1426
|
return new c().setBlueId(r).setName(i);
|
|
1427
1427
|
}
|
|
1428
1428
|
const n = e.fetchByBlueId(r);
|
|
@@ -1436,7 +1436,7 @@ function Tt(s, e) {
|
|
|
1436
1436
|
}
|
|
1437
1437
|
return t;
|
|
1438
1438
|
}
|
|
1439
|
-
function
|
|
1439
|
+
function b(s, e, t) {
|
|
1440
1440
|
const r = T.calculateBlueIdSync(s), n = T.calculateBlueIdSync(e);
|
|
1441
1441
|
if (r === n)
|
|
1442
1442
|
return !0;
|
|
@@ -1466,45 +1466,45 @@ function w(s, e, t) {
|
|
|
1466
1466
|
return !1;
|
|
1467
1467
|
}
|
|
1468
1468
|
function ns(s, e) {
|
|
1469
|
-
return
|
|
1469
|
+
return at.some((t) => {
|
|
1470
1470
|
const r = new c().setBlueId(t);
|
|
1471
|
-
return
|
|
1471
|
+
return b(s, r, e);
|
|
1472
1472
|
});
|
|
1473
1473
|
}
|
|
1474
1474
|
function is(s, e) {
|
|
1475
1475
|
const t = new c().setBlueId(_);
|
|
1476
|
-
return
|
|
1476
|
+
return b(s, t, e);
|
|
1477
1477
|
}
|
|
1478
1478
|
function os(s, e) {
|
|
1479
|
-
const t = new c().setBlueId(
|
|
1480
|
-
return
|
|
1479
|
+
const t = new c().setBlueId(j);
|
|
1480
|
+
return b(s, t, e);
|
|
1481
1481
|
}
|
|
1482
1482
|
function ls(s, e) {
|
|
1483
|
-
const t = new c().setBlueId(
|
|
1484
|
-
return
|
|
1483
|
+
const t = new c().setBlueId(L);
|
|
1484
|
+
return b(s, t, e);
|
|
1485
1485
|
}
|
|
1486
1486
|
function as(s, e) {
|
|
1487
1487
|
const t = new c().setBlueId(U);
|
|
1488
|
-
return
|
|
1488
|
+
return b(s, t, e);
|
|
1489
1489
|
}
|
|
1490
1490
|
function Jt(s, e) {
|
|
1491
|
-
const t = new c().setBlueId(
|
|
1492
|
-
return
|
|
1491
|
+
const t = new c().setBlueId(ot);
|
|
1492
|
+
return b(s, t, e);
|
|
1493
1493
|
}
|
|
1494
1494
|
function Wt(s, e) {
|
|
1495
|
-
const t = new c().setBlueId(
|
|
1496
|
-
return
|
|
1495
|
+
const t = new c().setBlueId(lt);
|
|
1496
|
+
return b(s, t, e);
|
|
1497
1497
|
}
|
|
1498
1498
|
function cs(s, e) {
|
|
1499
|
-
return
|
|
1499
|
+
return xe.some((t) => {
|
|
1500
1500
|
const r = new c().setName(t);
|
|
1501
|
-
return
|
|
1501
|
+
return b(s, r, e);
|
|
1502
1502
|
});
|
|
1503
1503
|
}
|
|
1504
1504
|
function us(s, e) {
|
|
1505
|
-
for (const t of
|
|
1505
|
+
for (const t of xe) {
|
|
1506
1506
|
const r = new c().setName(t);
|
|
1507
|
-
if (
|
|
1507
|
+
if (b(s, r, e))
|
|
1508
1508
|
return t;
|
|
1509
1509
|
}
|
|
1510
1510
|
throw new Error(
|
|
@@ -1523,7 +1523,7 @@ class ds {
|
|
|
1523
1523
|
}
|
|
1524
1524
|
registerSchema(e) {
|
|
1525
1525
|
const t = pe.resolveBlueId(e);
|
|
1526
|
-
if (
|
|
1526
|
+
if (d(t)) {
|
|
1527
1527
|
if (this.blueIdMap.has(t))
|
|
1528
1528
|
throw new Error(`Duplicate BlueId value: ${t}`);
|
|
1529
1529
|
this.blueIdMap.set(t, e);
|
|
@@ -1534,30 +1534,30 @@ class ds {
|
|
|
1534
1534
|
}
|
|
1535
1535
|
resolveSchema(e) {
|
|
1536
1536
|
const t = this.getEffectiveBlueId(e);
|
|
1537
|
-
return
|
|
1537
|
+
return m(t) ? null : this.blueIdMap.get(t);
|
|
1538
1538
|
}
|
|
1539
1539
|
isSchemaExtendedFrom(e, t) {
|
|
1540
|
-
if (
|
|
1540
|
+
if (m(e))
|
|
1541
1541
|
return !1;
|
|
1542
1542
|
const r = this.getBlueIdForSchema(e), n = this.getBlueIdForSchema(t);
|
|
1543
|
-
if (
|
|
1543
|
+
if (m(r) || m(n))
|
|
1544
1544
|
return !1;
|
|
1545
1545
|
if (r === n)
|
|
1546
1546
|
return !0;
|
|
1547
|
-
if (
|
|
1547
|
+
if (d(this.nodeProvider))
|
|
1548
1548
|
try {
|
|
1549
1549
|
const i = new c().setBlueId(r), o = new c().setBlueId(n);
|
|
1550
|
-
if (
|
|
1550
|
+
if (b(i, o, this.nodeProvider))
|
|
1551
1551
|
return !0;
|
|
1552
1552
|
} catch {
|
|
1553
1553
|
}
|
|
1554
1554
|
return !1;
|
|
1555
1555
|
}
|
|
1556
1556
|
getBlueIdForSchema(e) {
|
|
1557
|
-
if (
|
|
1557
|
+
if (m(e))
|
|
1558
1558
|
return null;
|
|
1559
1559
|
const t = pe.resolveBlueId(e);
|
|
1560
|
-
if (
|
|
1560
|
+
if (d(t))
|
|
1561
1561
|
return t;
|
|
1562
1562
|
for (const [r, n] of this.blueIdMap)
|
|
1563
1563
|
if (n === e || n._def === e._def)
|
|
@@ -1566,13 +1566,13 @@ class ds {
|
|
|
1566
1566
|
}
|
|
1567
1567
|
getEffectiveBlueId(e) {
|
|
1568
1568
|
const t = e.getType();
|
|
1569
|
-
return
|
|
1569
|
+
return d(t) && d(t.getBlueId()) ? t.getBlueId() : d(t) ? T.calculateBlueIdSync(t) : null;
|
|
1570
1570
|
}
|
|
1571
1571
|
getBlueIdMap() {
|
|
1572
1572
|
return new Map(this.blueIdMap);
|
|
1573
1573
|
}
|
|
1574
1574
|
}
|
|
1575
|
-
const
|
|
1575
|
+
const P = {
|
|
1576
1576
|
NAME: "name",
|
|
1577
1577
|
DESCRIPTION: "description",
|
|
1578
1578
|
TYPE: "type",
|
|
@@ -1585,7 +1585,7 @@ const N = {
|
|
|
1585
1585
|
BLUE: "blue",
|
|
1586
1586
|
ITEMS: "items"
|
|
1587
1587
|
};
|
|
1588
|
-
class
|
|
1588
|
+
class _e {
|
|
1589
1589
|
/**
|
|
1590
1590
|
* Check if a node is empty (has no fields set)
|
|
1591
1591
|
*/
|
|
@@ -1596,13 +1596,13 @@ class dt {
|
|
|
1596
1596
|
* Check if a node has only a Blue ID
|
|
1597
1597
|
*/
|
|
1598
1598
|
static hasBlueIdOnly(e) {
|
|
1599
|
-
return this.hasFieldsAndMayHaveFields(e, /* @__PURE__ */ new Set([
|
|
1599
|
+
return this.hasFieldsAndMayHaveFields(e, /* @__PURE__ */ new Set([P.BLUE_ID]));
|
|
1600
1600
|
}
|
|
1601
1601
|
/**
|
|
1602
1602
|
* Check if a node has only items
|
|
1603
1603
|
*/
|
|
1604
1604
|
static hasItemsOnly(e) {
|
|
1605
|
-
return this.hasFieldsAndMayHaveFields(e, /* @__PURE__ */ new Set([
|
|
1605
|
+
return this.hasFieldsAndMayHaveFields(e, /* @__PURE__ */ new Set([P.ITEMS]));
|
|
1606
1606
|
}
|
|
1607
1607
|
/**
|
|
1608
1608
|
* Check if a node is a valid value node (has a value, no properties, no items)
|
|
@@ -1611,7 +1611,7 @@ class dt {
|
|
|
1611
1611
|
*/
|
|
1612
1612
|
static isValidValueNode(e) {
|
|
1613
1613
|
const t = e.getValue(), r = e.getProperties(), n = e.getItems();
|
|
1614
|
-
return
|
|
1614
|
+
return d(t) && m(r) && m(n);
|
|
1615
1615
|
}
|
|
1616
1616
|
/**
|
|
1617
1617
|
* Create a text node
|
|
@@ -1624,14 +1624,14 @@ class dt {
|
|
|
1624
1624
|
*/
|
|
1625
1625
|
static integerNode(e) {
|
|
1626
1626
|
const t = e instanceof E ? e : new E(e.toString());
|
|
1627
|
-
return new c().setType(new c().setBlueId(
|
|
1627
|
+
return new c().setType(new c().setBlueId(j)).setValue(t);
|
|
1628
1628
|
}
|
|
1629
1629
|
/**
|
|
1630
1630
|
* Create a double node
|
|
1631
1631
|
*/
|
|
1632
1632
|
static doubleNode(e) {
|
|
1633
1633
|
const t = e instanceof S ? e : new S(e.toString());
|
|
1634
|
-
return new c().setType(new c().setBlueId(
|
|
1634
|
+
return new c().setType(new c().setBlueId(L)).setValue(t);
|
|
1635
1635
|
}
|
|
1636
1636
|
/**
|
|
1637
1637
|
* Create a boolean node
|
|
@@ -1647,8 +1647,8 @@ class dt {
|
|
|
1647
1647
|
* @returns true if the node matches the field requirements
|
|
1648
1648
|
*/
|
|
1649
1649
|
static hasFieldsAndMayHaveFields(e, t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set()) {
|
|
1650
|
-
for (const n of Object.values(
|
|
1651
|
-
const i =
|
|
1650
|
+
for (const n of Object.values(P)) {
|
|
1651
|
+
const i = d(this.getFieldValue(e, n));
|
|
1652
1652
|
if (t.has(n)) {
|
|
1653
1653
|
if (!i) return !1;
|
|
1654
1654
|
} else if (!r.has(n)) {
|
|
@@ -1662,27 +1662,27 @@ class dt {
|
|
|
1662
1662
|
*/
|
|
1663
1663
|
static getFieldValue(e, t) {
|
|
1664
1664
|
switch (t) {
|
|
1665
|
-
case
|
|
1665
|
+
case P.NAME:
|
|
1666
1666
|
return e.getName();
|
|
1667
|
-
case
|
|
1667
|
+
case P.TYPE:
|
|
1668
1668
|
return e.getType();
|
|
1669
|
-
case
|
|
1669
|
+
case P.VALUE:
|
|
1670
1670
|
return e.getValue();
|
|
1671
|
-
case
|
|
1671
|
+
case P.DESCRIPTION:
|
|
1672
1672
|
return e.getDescription();
|
|
1673
|
-
case
|
|
1673
|
+
case P.PROPERTIES:
|
|
1674
1674
|
return e.getProperties();
|
|
1675
|
-
case
|
|
1675
|
+
case P.BLUE:
|
|
1676
1676
|
return e.getBlue();
|
|
1677
|
-
case
|
|
1677
|
+
case P.ITEMS:
|
|
1678
1678
|
return e.getItems();
|
|
1679
|
-
case
|
|
1679
|
+
case P.KEY_TYPE:
|
|
1680
1680
|
return e.getKeyType();
|
|
1681
|
-
case
|
|
1681
|
+
case P.VALUE_TYPE:
|
|
1682
1682
|
return e.getValueType();
|
|
1683
|
-
case
|
|
1683
|
+
case P.ITEM_TYPE:
|
|
1684
1684
|
return e.getItemType();
|
|
1685
|
-
case
|
|
1685
|
+
case P.BLUE_ID:
|
|
1686
1686
|
return e.getBlueId();
|
|
1687
1687
|
default:
|
|
1688
1688
|
throw new Error(`Unknown field: ${t}`);
|
|
@@ -1693,7 +1693,7 @@ class pt {
|
|
|
1693
1693
|
}
|
|
1694
1694
|
class ce {
|
|
1695
1695
|
static convert(e) {
|
|
1696
|
-
const t = new
|
|
1696
|
+
const t = new qe();
|
|
1697
1697
|
return ce.traverseNode(e, "", t), t.build();
|
|
1698
1698
|
}
|
|
1699
1699
|
static traverseNode(e, t, r) {
|
|
@@ -1720,7 +1720,7 @@ function vt(s, e) {
|
|
|
1720
1720
|
const t = s.split(e), r = [...t].reverse().findIndex((i) => i !== ""), n = r === -1 ? 0 : t.length - r;
|
|
1721
1721
|
return t.slice(0, n);
|
|
1722
1722
|
}
|
|
1723
|
-
class
|
|
1723
|
+
class Le extends pt {
|
|
1724
1724
|
allowedPaths;
|
|
1725
1725
|
maxDepth;
|
|
1726
1726
|
currentPath = [];
|
|
@@ -1813,7 +1813,7 @@ class $e extends pt {
|
|
|
1813
1813
|
* @returns The path limits
|
|
1814
1814
|
*/
|
|
1815
1815
|
static withMaxDepth(e) {
|
|
1816
|
-
const t = new
|
|
1816
|
+
const t = new qe().setMaxDepth(e);
|
|
1817
1817
|
for (let r = 1; r <= e; r++) {
|
|
1818
1818
|
const n = "/" + Array(r).fill("*").join("/");
|
|
1819
1819
|
t.addPath(n);
|
|
@@ -1826,7 +1826,7 @@ class $e extends pt {
|
|
|
1826
1826
|
* @returns The path limits
|
|
1827
1827
|
*/
|
|
1828
1828
|
static withSinglePath(e) {
|
|
1829
|
-
return new
|
|
1829
|
+
return new qe().addPath(e).build();
|
|
1830
1830
|
}
|
|
1831
1831
|
/**
|
|
1832
1832
|
* Creates path limits by analyzing the structure of a node.
|
|
@@ -1836,7 +1836,7 @@ class $e extends pt {
|
|
|
1836
1836
|
return ce.convert(e);
|
|
1837
1837
|
}
|
|
1838
1838
|
}
|
|
1839
|
-
class
|
|
1839
|
+
class qe {
|
|
1840
1840
|
allowedPaths = /* @__PURE__ */ new Set();
|
|
1841
1841
|
maxDepth = Number.MAX_SAFE_INTEGER;
|
|
1842
1842
|
/**
|
|
@@ -1860,10 +1860,10 @@ class He {
|
|
|
1860
1860
|
* @returns The built PathLimits
|
|
1861
1861
|
*/
|
|
1862
1862
|
build() {
|
|
1863
|
-
return new
|
|
1863
|
+
return new Le(this.allowedPaths, this.maxDepth);
|
|
1864
1864
|
}
|
|
1865
1865
|
}
|
|
1866
|
-
class
|
|
1866
|
+
class we extends pt {
|
|
1867
1867
|
/**
|
|
1868
1868
|
* Determines if a path segment should be extended - always returns true
|
|
1869
1869
|
* @returns Always true
|
|
@@ -1889,7 +1889,7 @@ class Xe extends pt {
|
|
|
1889
1889
|
exitPathSegment() {
|
|
1890
1890
|
}
|
|
1891
1891
|
}
|
|
1892
|
-
class
|
|
1892
|
+
class je extends pt {
|
|
1893
1893
|
limits;
|
|
1894
1894
|
/**
|
|
1895
1895
|
* Creates a composite limits with the specified limit strategies
|
|
@@ -1946,10 +1946,10 @@ class _e extends pt {
|
|
|
1946
1946
|
* @returns A new CompositeLimits instance
|
|
1947
1947
|
*/
|
|
1948
1948
|
static of(...e) {
|
|
1949
|
-
return new
|
|
1949
|
+
return new je(e);
|
|
1950
1950
|
}
|
|
1951
1951
|
}
|
|
1952
|
-
const K = new
|
|
1952
|
+
const K = new we();
|
|
1953
1953
|
class ps {
|
|
1954
1954
|
blue;
|
|
1955
1955
|
constructor(e) {
|
|
@@ -1959,7 +1959,7 @@ class ps {
|
|
|
1959
1959
|
const n = t.getType();
|
|
1960
1960
|
if (this.matchesImplicitStructure(e, n))
|
|
1961
1961
|
return !0;
|
|
1962
|
-
const i =
|
|
1962
|
+
const i = Le.fromNode(t), o = je.of(r, i), l = this.extendAndResolve(e, o), a = this.blue.resolve(t, o);
|
|
1963
1963
|
return this.verifyMatch(l, t, o) && this.recursiveValueComparison(l, a);
|
|
1964
1964
|
}
|
|
1965
1965
|
/**
|
|
@@ -1989,8 +1989,8 @@ class ps {
|
|
|
1989
1989
|
let a = e.getProperties();
|
|
1990
1990
|
a || (a = {}, e.setProperties(a));
|
|
1991
1991
|
for (const [u, y] of Object.entries(i)) {
|
|
1992
|
-
const
|
|
1993
|
-
|
|
1992
|
+
const p = a[u];
|
|
1993
|
+
p === void 0 ? a[u] = y.clone() : this.restoreMissingStructure(p, y);
|
|
1994
1994
|
}
|
|
1995
1995
|
}
|
|
1996
1996
|
const o = t.getBlueId();
|
|
@@ -2016,9 +2016,9 @@ class ps {
|
|
|
2016
2016
|
r
|
|
2017
2017
|
);
|
|
2018
2018
|
if (r && !n) {
|
|
2019
|
-
const
|
|
2020
|
-
if (!
|
|
2021
|
-
|
|
2019
|
+
const p = e.getType();
|
|
2020
|
+
if (!p || !b(
|
|
2021
|
+
p,
|
|
2022
2022
|
r,
|
|
2023
2023
|
this.blue.getNodeProvider()
|
|
2024
2024
|
))
|
|
@@ -2026,55 +2026,55 @@ class ps {
|
|
|
2026
2026
|
}
|
|
2027
2027
|
const i = t.getBlueId();
|
|
2028
2028
|
if (!n && i !== void 0) {
|
|
2029
|
-
const
|
|
2030
|
-
if (
|
|
2031
|
-
if (i !==
|
|
2029
|
+
const p = e.getBlueId(), f = e.getType()?.getBlueId();
|
|
2030
|
+
if (p !== void 0) {
|
|
2031
|
+
if (i !== p)
|
|
2032
2032
|
return !1;
|
|
2033
2033
|
} else if (f === void 0 || i !== f)
|
|
2034
2034
|
return !1;
|
|
2035
2035
|
}
|
|
2036
2036
|
const o = t.getValue();
|
|
2037
2037
|
if (o !== void 0) {
|
|
2038
|
-
const
|
|
2039
|
-
if (
|
|
2038
|
+
const p = e.getValue();
|
|
2039
|
+
if (p === void 0)
|
|
2040
2040
|
return !1;
|
|
2041
|
-
if (C(
|
|
2042
|
-
if (!
|
|
2041
|
+
if (C(p) && C(o)) {
|
|
2042
|
+
if (!p.eq(o))
|
|
2043
2043
|
return !1;
|
|
2044
|
-
} else if (
|
|
2044
|
+
} else if (p !== o)
|
|
2045
2045
|
return !1;
|
|
2046
2046
|
}
|
|
2047
2047
|
const l = t.getItems();
|
|
2048
2048
|
if (l !== void 0) {
|
|
2049
|
-
const
|
|
2049
|
+
const p = e.getItems() ?? [];
|
|
2050
2050
|
for (let f = 0; f < l.length; f++)
|
|
2051
|
-
if (f <
|
|
2052
|
-
if (!this.recursiveValueComparison(
|
|
2051
|
+
if (f < p.length) {
|
|
2052
|
+
if (!this.recursiveValueComparison(p[f], l[f]))
|
|
2053
2053
|
return !1;
|
|
2054
2054
|
} else if (this.hasValueInNestedStructure(l[f]))
|
|
2055
2055
|
return !1;
|
|
2056
2056
|
}
|
|
2057
2057
|
const a = t.getItemType();
|
|
2058
2058
|
if (a !== void 0) {
|
|
2059
|
-
const
|
|
2060
|
-
for (const f of
|
|
2059
|
+
const p = e.getItems() ?? [];
|
|
2060
|
+
for (const f of p)
|
|
2061
2061
|
if (!this.recursiveValueComparison(f, a))
|
|
2062
2062
|
return !1;
|
|
2063
2063
|
}
|
|
2064
2064
|
const u = t.getProperties();
|
|
2065
2065
|
if (u !== void 0) {
|
|
2066
|
-
const
|
|
2066
|
+
const p = e.getProperties() ?? {};
|
|
2067
2067
|
for (const [f, v] of Object.entries(u))
|
|
2068
|
-
if (f in
|
|
2069
|
-
if (!this.recursiveValueComparison(
|
|
2068
|
+
if (f in p) {
|
|
2069
|
+
if (!this.recursiveValueComparison(p[f], v))
|
|
2070
2070
|
return !1;
|
|
2071
2071
|
} else if (this.hasValueInNestedStructure(v))
|
|
2072
2072
|
return !1;
|
|
2073
2073
|
}
|
|
2074
2074
|
const y = t.getValueType();
|
|
2075
2075
|
if (y !== void 0) {
|
|
2076
|
-
const
|
|
2077
|
-
for (const f of
|
|
2076
|
+
const p = Object.values(e.getProperties() ?? {});
|
|
2077
|
+
for (const f of p)
|
|
2078
2078
|
if (!this.recursiveValueComparison(f, y))
|
|
2079
2079
|
return !1;
|
|
2080
2080
|
}
|
|
@@ -2111,14 +2111,14 @@ class ps {
|
|
|
2111
2111
|
return e.getProperties() !== void 0 && e.getValue() === void 0;
|
|
2112
2112
|
}
|
|
2113
2113
|
}
|
|
2114
|
-
const hs = (s) => s instanceof
|
|
2114
|
+
const hs = (s) => s instanceof Nt || s instanceof St || s instanceof Ct || s instanceof At || s instanceof Ne || s instanceof Se, fs = (s) => s instanceof ee || s instanceof te || s instanceof Be || s instanceof be;
|
|
2115
2115
|
class Zt {
|
|
2116
2116
|
static convertValue(e, t) {
|
|
2117
2117
|
const r = e.getType()?.getBlueId(), n = e.getValue();
|
|
2118
|
-
return
|
|
2118
|
+
return m(n) ? fs(t) && _e.isValidValueNode(e) ? this.getDefaultPrimitiveValue(t) : n : _ === r ? this.convertFromString(String(n), t) : L === r || n instanceof S ? this.convertFromBigDecimal(
|
|
2119
2119
|
new S(n?.toString()),
|
|
2120
2120
|
t
|
|
2121
|
-
) :
|
|
2121
|
+
) : j === r || n instanceof E ? this.convertFromBigInteger(
|
|
2122
2122
|
new E(n?.toString()),
|
|
2123
2123
|
t
|
|
2124
2124
|
) : U === r || typeof n == "boolean" ? this.convertFromBoolean(!!n, t) : this.convertFromString(String(n), t);
|
|
@@ -2128,9 +2128,9 @@ class Zt {
|
|
|
2128
2128
|
return e;
|
|
2129
2129
|
if (t instanceof te)
|
|
2130
2130
|
return Number(e);
|
|
2131
|
-
if (t instanceof
|
|
2131
|
+
if (t instanceof Be)
|
|
2132
2132
|
return e.toLowerCase() === "true";
|
|
2133
|
-
if (t instanceof
|
|
2133
|
+
if (t instanceof be)
|
|
2134
2134
|
return BigInt(e);
|
|
2135
2135
|
throw new Error(`Cannot convert String to ${t._def.typeName}`);
|
|
2136
2136
|
}
|
|
@@ -2144,20 +2144,20 @@ class Zt {
|
|
|
2144
2144
|
static convertFromBigInteger(e, t) {
|
|
2145
2145
|
if (t instanceof te)
|
|
2146
2146
|
return e.toNumber();
|
|
2147
|
-
if (t instanceof
|
|
2147
|
+
if (t instanceof be)
|
|
2148
2148
|
return BigInt(e.toString());
|
|
2149
2149
|
if (t instanceof ee)
|
|
2150
2150
|
return e.toString();
|
|
2151
2151
|
throw new Error(`Cannot convert Number to ${t._def.typeName}`);
|
|
2152
2152
|
}
|
|
2153
2153
|
static convertFromBoolean(e, t) {
|
|
2154
|
-
if (!t || t instanceof
|
|
2154
|
+
if (!t || t instanceof Be)
|
|
2155
2155
|
return e;
|
|
2156
2156
|
if (t instanceof ee)
|
|
2157
2157
|
return e.toString();
|
|
2158
2158
|
if (t instanceof te)
|
|
2159
2159
|
return Number(e);
|
|
2160
|
-
if (t instanceof
|
|
2160
|
+
if (t instanceof be)
|
|
2161
2161
|
return BigInt(e);
|
|
2162
2162
|
throw new Error(`Cannot convert Boolean to ${t._def.typeName}`);
|
|
2163
2163
|
}
|
|
@@ -2165,7 +2165,7 @@ class Zt {
|
|
|
2165
2165
|
if (!e) return null;
|
|
2166
2166
|
if (e instanceof te)
|
|
2167
2167
|
return 0;
|
|
2168
|
-
if (e instanceof
|
|
2168
|
+
if (e instanceof Be)
|
|
2169
2169
|
return !1;
|
|
2170
2170
|
if (e instanceof ee)
|
|
2171
2171
|
return "";
|
|
@@ -2197,17 +2197,17 @@ class gs {
|
|
|
2197
2197
|
return Object.keys(t.shape).reduce(
|
|
2198
2198
|
(n, i) => {
|
|
2199
2199
|
const o = e.getProperties(), l = t.shape[i], a = Xr(l);
|
|
2200
|
-
if (
|
|
2201
|
-
const v =
|
|
2200
|
+
if (d(a)) {
|
|
2201
|
+
const v = rt(a) ? a : i, k = o?.[v], q = k ? T.calculateBlueIdSync(k) : void 0;
|
|
2202
2202
|
return n[i] = q, n;
|
|
2203
2203
|
}
|
|
2204
2204
|
const u = Qr(l);
|
|
2205
|
-
if (
|
|
2205
|
+
if (d(u)) {
|
|
2206
2206
|
const v = o?.[u];
|
|
2207
2207
|
return n[i] = v?.getName(), n;
|
|
2208
2208
|
}
|
|
2209
2209
|
const y = Wr(l);
|
|
2210
|
-
if (
|
|
2210
|
+
if (d(y)) {
|
|
2211
2211
|
const v = o?.[y];
|
|
2212
2212
|
return n[i] = v?.getDescription(), n;
|
|
2213
2213
|
}
|
|
@@ -2219,11 +2219,11 @@ class gs {
|
|
|
2219
2219
|
const v = e.getDescription();
|
|
2220
2220
|
return n[i] = v, n;
|
|
2221
2221
|
}
|
|
2222
|
-
const
|
|
2223
|
-
if (
|
|
2222
|
+
const p = o?.[i];
|
|
2223
|
+
if (m(p))
|
|
2224
2224
|
return n;
|
|
2225
2225
|
const f = this.nodeToObjectConverter.convert(
|
|
2226
|
-
|
|
2226
|
+
p,
|
|
2227
2227
|
l
|
|
2228
2228
|
);
|
|
2229
2229
|
return n[i] = f, n;
|
|
@@ -2267,29 +2267,29 @@ class Ts {
|
|
|
2267
2267
|
}
|
|
2268
2268
|
convert(e, t) {
|
|
2269
2269
|
const r = t.keySchema, n = t.valueSchema, i = /* @__PURE__ */ new Map(), o = e.getName();
|
|
2270
|
-
|
|
2270
|
+
d(o) && i.set(G, o);
|
|
2271
2271
|
const l = e.getDescription();
|
|
2272
|
-
|
|
2272
|
+
d(l) && i.set(J, l);
|
|
2273
2273
|
const a = e.getProperties();
|
|
2274
|
-
return
|
|
2275
|
-
const
|
|
2276
|
-
|
|
2277
|
-
const f = Zt.convertValue(
|
|
2274
|
+
return d(a) && Object.entries(a).forEach(([u, y]) => {
|
|
2275
|
+
const p = new c().setValue(u);
|
|
2276
|
+
p.setType(new c().setBlueId(_));
|
|
2277
|
+
const f = Zt.convertValue(p, r), v = this.nodeToObjectConverter.convert(y, n);
|
|
2278
2278
|
i.set(f, v);
|
|
2279
2279
|
}), t instanceof yr ? Object.fromEntries(i) : i;
|
|
2280
2280
|
}
|
|
2281
2281
|
}
|
|
2282
2282
|
class vs {
|
|
2283
2283
|
convert(e) {
|
|
2284
|
-
return
|
|
2284
|
+
return I.get(e);
|
|
2285
2285
|
}
|
|
2286
2286
|
}
|
|
2287
|
-
class
|
|
2287
|
+
class Bs {
|
|
2288
2288
|
convert(e) {
|
|
2289
|
-
return
|
|
2289
|
+
return I.get(e);
|
|
2290
2290
|
}
|
|
2291
2291
|
}
|
|
2292
|
-
class
|
|
2292
|
+
class bs {
|
|
2293
2293
|
constructor(e) {
|
|
2294
2294
|
this.nodeToObjectConverter = e;
|
|
2295
2295
|
}
|
|
@@ -2303,7 +2303,7 @@ class ws {
|
|
|
2303
2303
|
);
|
|
2304
2304
|
}
|
|
2305
2305
|
}
|
|
2306
|
-
const
|
|
2306
|
+
const ws = h.union([
|
|
2307
2307
|
h.literal("ZodString"),
|
|
2308
2308
|
h.literal("ZodNumber"),
|
|
2309
2309
|
h.literal("ZodBoolean"),
|
|
@@ -2328,8 +2328,8 @@ class Es {
|
|
|
2328
2328
|
converters = /* @__PURE__ */ new Map();
|
|
2329
2329
|
complexObjectConverter;
|
|
2330
2330
|
registerConverters() {
|
|
2331
|
-
const e = new ys(), t = new ms(this.nodeToObjectConverter), r = new
|
|
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
|
|
2331
|
+
const e = new ys(), t = new ms(this.nodeToObjectConverter), r = new bs(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);
|
|
2333
2333
|
}
|
|
2334
2334
|
getConverter(e) {
|
|
2335
2335
|
const t = this.getSchemaTypeName(e);
|
|
@@ -2337,16 +2337,16 @@ class Es {
|
|
|
2337
2337
|
}
|
|
2338
2338
|
getSchemaTypeName(e) {
|
|
2339
2339
|
if (hs(e))
|
|
2340
|
-
return e instanceof Ne ? this.getSchemaTypeName(e.innerType()) : e instanceof
|
|
2340
|
+
return e instanceof Ne ? this.getSchemaTypeName(e.innerType()) : e instanceof Se ? this.getSchemaTypeName(e.schema) : this.getSchemaTypeName(e.unwrap());
|
|
2341
2341
|
const t = e._def.typeName;
|
|
2342
2342
|
try {
|
|
2343
|
-
return
|
|
2343
|
+
return ws.parse(t);
|
|
2344
2344
|
} catch {
|
|
2345
2345
|
throw new Error(`Schema type name ${t} is not supported`);
|
|
2346
2346
|
}
|
|
2347
2347
|
}
|
|
2348
2348
|
}
|
|
2349
|
-
class
|
|
2349
|
+
class Ps {
|
|
2350
2350
|
constructor(e) {
|
|
2351
2351
|
this.typeSchemaResolver = e, this.converterFactory = new Es(this);
|
|
2352
2352
|
}
|
|
@@ -2360,7 +2360,7 @@ class Ns {
|
|
|
2360
2360
|
r,
|
|
2361
2361
|
n,
|
|
2362
2362
|
{ typeSchemaResolver: this.typeSchemaResolver }
|
|
2363
|
-
) &&
|
|
2363
|
+
) && d(r) && (i = r), this.convertWithType(e, i);
|
|
2364
2364
|
}
|
|
2365
2365
|
convertWithType(e, t) {
|
|
2366
2366
|
return this.converterFactory.getConverter(t).convert(e, t);
|
|
@@ -2375,16 +2375,16 @@ class Ht {
|
|
|
2375
2375
|
this.isIdenticalToType(t, r) || (this.reverseBasicProperties(e, t, r), this.reverseTypeReferences(e, t, r), this.reverseItems(e, t, r), this.reverseProperties(e, t, r));
|
|
2376
2376
|
}
|
|
2377
2377
|
isIdenticalToType(e, t) {
|
|
2378
|
-
return
|
|
2378
|
+
return d(e.getBlueId()) && d(t?.getBlueId()) && e.getBlueId() === t.getBlueId();
|
|
2379
2379
|
}
|
|
2380
2380
|
reverseBasicProperties(e, t, r) {
|
|
2381
2381
|
const n = t.getValue();
|
|
2382
|
-
|
|
2382
|
+
d(n) && (m(r) || m(r.getValue())) && e.setValue(n), d(t.getName()) && (m(r) || t.getName() !== r.getName()) && e.setName(t.getName()), d(t.getDescription()) && (m(r) || t.getDescription() !== r.getDescription()) && e.setDescription(t.getDescription()), d(t.getBlueId()) && (m(r) || t.getBlueId() !== r.getBlueId()) && e.setBlueId(t.getBlueId());
|
|
2383
2383
|
}
|
|
2384
2384
|
reverseTypeReferences(e, t, r) {
|
|
2385
2385
|
const n = (i, o) => {
|
|
2386
2386
|
const l = i(t), a = r ? i(r) : void 0, u = l?.getBlueId();
|
|
2387
|
-
|
|
2387
|
+
d(u) && (m(a?.getBlueId()) || u !== a.getBlueId()) && o(e, new c().setBlueId(u));
|
|
2388
2388
|
};
|
|
2389
2389
|
n(
|
|
2390
2390
|
(i) => i.getType(),
|
|
@@ -2402,23 +2402,23 @@ class Ht {
|
|
|
2402
2402
|
}
|
|
2403
2403
|
reverseItems(e, t, r) {
|
|
2404
2404
|
const n = t.getItems();
|
|
2405
|
-
if (
|
|
2405
|
+
if (m(n))
|
|
2406
2406
|
return;
|
|
2407
2407
|
const i = r?.getItems(), o = [];
|
|
2408
|
-
if (
|
|
2409
|
-
const
|
|
2410
|
-
o.push(new c().setBlueId(
|
|
2408
|
+
if (d(i) && n.length > i.length && d(i) && i.length > 0) {
|
|
2409
|
+
const u = T.calculateBlueIdSync(i);
|
|
2410
|
+
o.push(new c().setBlueId(u));
|
|
2411
2411
|
}
|
|
2412
|
-
const
|
|
2413
|
-
for (let
|
|
2414
|
-
const
|
|
2415
|
-
this.reverseNode(
|
|
2412
|
+
const a = i?.length || 0;
|
|
2413
|
+
for (let u = a; u < n.length; u++) {
|
|
2414
|
+
const y = new c();
|
|
2415
|
+
this.reverseNode(y, n[u], void 0), o.push(y);
|
|
2416
2416
|
}
|
|
2417
2417
|
o.length > 0 && e.setItems(o);
|
|
2418
2418
|
}
|
|
2419
2419
|
reverseProperties(e, t, r) {
|
|
2420
2420
|
const n = t.getProperties();
|
|
2421
|
-
if (
|
|
2421
|
+
if (m(n))
|
|
2422
2422
|
return;
|
|
2423
2423
|
const i = {};
|
|
2424
2424
|
for (const [o, l] of Object.entries(n)) {
|
|
@@ -2427,7 +2427,7 @@ class Ht {
|
|
|
2427
2427
|
t,
|
|
2428
2428
|
r
|
|
2429
2429
|
), u = new c();
|
|
2430
|
-
this.reverseNode(u, l, a),
|
|
2430
|
+
this.reverseNode(u, l, a), _e.isEmptyNode(u) || (i[o] = u);
|
|
2431
2431
|
}
|
|
2432
2432
|
Object.keys(i).length > 0 && e.setProperties(i);
|
|
2433
2433
|
}
|
|
@@ -2437,8 +2437,8 @@ class Ht {
|
|
|
2437
2437
|
*/
|
|
2438
2438
|
getInheritedProperty(e, t, r) {
|
|
2439
2439
|
const n = r?.getProperties()?.[e], i = t.getType()?.getProperties()?.[e];
|
|
2440
|
-
if (!(
|
|
2441
|
-
return
|
|
2440
|
+
if (!(m(n) && m(i)))
|
|
2441
|
+
return m(n) ? i : m(i) ? n : this.mergeNodes(n, i);
|
|
2442
2442
|
}
|
|
2443
2443
|
/**
|
|
2444
2444
|
* Merges two nodes, with the second node's properties taking precedence.
|
|
@@ -2447,24 +2447,24 @@ class Ht {
|
|
|
2447
2447
|
*/
|
|
2448
2448
|
mergeNodes(e, t) {
|
|
2449
2449
|
const r = e.clone(), n = t.getValue();
|
|
2450
|
-
|
|
2450
|
+
d(n) && r.setValue(n);
|
|
2451
2451
|
const i = t.getType();
|
|
2452
|
-
|
|
2452
|
+
d(i) && r.setType(i.clone());
|
|
2453
2453
|
const o = t.getItemType();
|
|
2454
|
-
|
|
2454
|
+
d(o) && r.setItemType(o.clone());
|
|
2455
2455
|
const l = t.getKeyType();
|
|
2456
|
-
|
|
2456
|
+
d(l) && r.setKeyType(l.clone());
|
|
2457
2457
|
const a = t.getValueType();
|
|
2458
|
-
|
|
2458
|
+
d(a) && r.setValueType(a.clone());
|
|
2459
2459
|
const u = t.getProperties();
|
|
2460
|
-
if (
|
|
2461
|
-
const
|
|
2460
|
+
if (d(u)) {
|
|
2461
|
+
const p = r.getProperties() || {};
|
|
2462
2462
|
for (const [f, v] of Object.entries(u))
|
|
2463
|
-
|
|
2464
|
-
r.setProperties(
|
|
2463
|
+
p[f] = v.clone();
|
|
2464
|
+
r.setProperties(p);
|
|
2465
2465
|
}
|
|
2466
2466
|
const y = t.getItems();
|
|
2467
|
-
return
|
|
2467
|
+
return d(y) && r.setItems(y.map((p) => p.clone())), r;
|
|
2468
2468
|
}
|
|
2469
2469
|
}
|
|
2470
2470
|
class ne extends c {
|
|
@@ -2535,30 +2535,30 @@ class Te {
|
|
|
2535
2535
|
return t && t.length > 0 ? t[0] : null;
|
|
2536
2536
|
}
|
|
2537
2537
|
}
|
|
2538
|
-
function
|
|
2538
|
+
function Ns(s) {
|
|
2539
2539
|
return new class extends Te {
|
|
2540
2540
|
fetchByBlueId(e) {
|
|
2541
2541
|
return s(e);
|
|
2542
2542
|
}
|
|
2543
2543
|
}();
|
|
2544
2544
|
}
|
|
2545
|
-
const
|
|
2546
|
-
...
|
|
2545
|
+
const ze = H.types.float.options, Ss = {
|
|
2546
|
+
...ze,
|
|
2547
2547
|
construct: (s) => {
|
|
2548
2548
|
const e = s.replace(/_/g, "").toLowerCase();
|
|
2549
|
-
if (!
|
|
2549
|
+
if (!Pt(e))
|
|
2550
2550
|
return new S(e);
|
|
2551
|
-
if (
|
|
2552
|
-
return
|
|
2551
|
+
if (ze.construct)
|
|
2552
|
+
return ze.construct(s);
|
|
2553
2553
|
}
|
|
2554
|
-
}, Cs = new H.Type("tag:yaml.org,2002:float", Ss),
|
|
2555
|
-
...
|
|
2554
|
+
}, Cs = new H.Type("tag:yaml.org,2002:float", Ss), Ge = H.types.int.options, As = {
|
|
2555
|
+
...Ge,
|
|
2556
2556
|
construct: (s) => {
|
|
2557
2557
|
let e = s;
|
|
2558
|
-
if (e.indexOf("_") !== -1 && (e = e.replace(/_/g, "")), !
|
|
2558
|
+
if (e.indexOf("_") !== -1 && (e = e.replace(/_/g, "")), !Pt(e))
|
|
2559
2559
|
return new E(e);
|
|
2560
|
-
if (
|
|
2561
|
-
return
|
|
2560
|
+
if (Ge.construct)
|
|
2561
|
+
return Ge.construct(s);
|
|
2562
2562
|
}
|
|
2563
2563
|
}, Vs = new H.Type("tag:yaml.org,2002:int", As), Xt = H.CORE_SCHEMA.extend({
|
|
2564
2564
|
implicit: [Cs, Vs]
|
|
@@ -2570,7 +2570,7 @@ const Ke = H.types.float.options, Ss = {
|
|
|
2570
2570
|
replacer: (e, t) => {
|
|
2571
2571
|
if (C(t)) {
|
|
2572
2572
|
if (Z(t)) {
|
|
2573
|
-
const r = new
|
|
2573
|
+
const r = new D(Number.MIN_SAFE_INTEGER.toString()), n = new D(Number.MAX_SAFE_INTEGER.toString());
|
|
2574
2574
|
if (t.lt(r) || t.gt(n))
|
|
2575
2575
|
return t.toString();
|
|
2576
2576
|
}
|
|
@@ -2581,11 +2581,11 @@ const Ke = H.types.float.options, Ss = {
|
|
|
2581
2581
|
});
|
|
2582
2582
|
class Os {
|
|
2583
2583
|
static get(e, t = {}) {
|
|
2584
|
-
const { strategy: r = "official" } = t, n =
|
|
2584
|
+
const { strategy: r = "official" } = t, n = I.get(e, r);
|
|
2585
2585
|
return Rs(n);
|
|
2586
2586
|
}
|
|
2587
2587
|
}
|
|
2588
|
-
class
|
|
2588
|
+
class Ms extends Te {
|
|
2589
2589
|
nodeProviders;
|
|
2590
2590
|
constructor(e) {
|
|
2591
2591
|
super(), this.nodeProviders = e;
|
|
@@ -2623,7 +2623,7 @@ const qt = `- type:
|
|
|
2623
2623
|
Dictionary: G7fBT9PSod1RfHLHkpafAGBDVAJMrMhAMY51ERcyXNrj
|
|
2624
2624
|
- type:
|
|
2625
2625
|
blueId: FGYuTXwaoSKfZmpTysLTLsb8WzSqf43384rKZDkXhxD4
|
|
2626
|
-
`,
|
|
2626
|
+
`, Ds = `name: Transformation
|
|
2627
2627
|
description: TODO`, xs = `name: Infer Basic Types For Untyped Values
|
|
2628
2628
|
type:
|
|
2629
2629
|
blueId: Ct1SGRGw1i47qjzm1ruiUdSZofeV6WevPTGuieVvbRS4
|
|
@@ -2632,7 +2632,7 @@ type:
|
|
|
2632
2632
|
blueId: Ct1SGRGw1i47qjzm1ruiUdSZofeV6WevPTGuieVvbRS4
|
|
2633
2633
|
description: This transformation replaces`, $s = [
|
|
2634
2634
|
qt,
|
|
2635
|
-
|
|
2635
|
+
Ds,
|
|
2636
2636
|
xs,
|
|
2637
2637
|
Fs
|
|
2638
2638
|
];
|
|
@@ -2673,7 +2673,7 @@ class ht extends Te {
|
|
|
2673
2673
|
return this.nodeProvider.fetchByBlueId(e);
|
|
2674
2674
|
}
|
|
2675
2675
|
}
|
|
2676
|
-
class
|
|
2676
|
+
class Je {
|
|
2677
2677
|
constructor(e, t, r) {
|
|
2678
2678
|
this.blueId = e, this.content = t, this.isMultipleDocuments = r;
|
|
2679
2679
|
}
|
|
@@ -2697,24 +2697,24 @@ class z {
|
|
|
2697
2697
|
const u = g.deserialize(a);
|
|
2698
2698
|
return t(u);
|
|
2699
2699
|
});
|
|
2700
|
-
n = T.calculateBlueIdSync(l), i = l.map((a) =>
|
|
2700
|
+
n = T.calculateBlueIdSync(l), i = l.map((a) => I.get(a));
|
|
2701
2701
|
} else {
|
|
2702
2702
|
const l = g.deserialize(r), a = t(l);
|
|
2703
|
-
n = T.calculateBlueIdSync(a), i =
|
|
2703
|
+
n = T.calculateBlueIdSync(a), i = I.get(a);
|
|
2704
2704
|
}
|
|
2705
|
-
return new
|
|
2705
|
+
return new Je(n, i, o);
|
|
2706
2706
|
}
|
|
2707
2707
|
static parseAndCalculateBlueIdForNode(e, t) {
|
|
2708
|
-
const r = t(e), n = T.calculateBlueIdSync(r), i =
|
|
2709
|
-
return new
|
|
2708
|
+
const r = t(e), n = T.calculateBlueIdSync(r), i = I.get(r);
|
|
2709
|
+
return new Je(n, i, !1);
|
|
2710
2710
|
}
|
|
2711
2711
|
static parseAndCalculateBlueIdForNodeList(e, t) {
|
|
2712
2712
|
if (!e || e.length === 0)
|
|
2713
2713
|
throw new Error("List of nodes cannot be null or empty");
|
|
2714
2714
|
const r = e.map(t), n = T.calculateBlueIdSync(r), i = r.map(
|
|
2715
|
-
(l) =>
|
|
2715
|
+
(l) => I.get(l)
|
|
2716
2716
|
), o = e.length > 1;
|
|
2717
|
-
return new
|
|
2717
|
+
return new Je(n, i, o);
|
|
2718
2718
|
}
|
|
2719
2719
|
static resolveThisReferences(e, t, r) {
|
|
2720
2720
|
return this.resolveThisReferencesRecursive(
|
|
@@ -2765,7 +2765,7 @@ class z {
|
|
|
2765
2765
|
}
|
|
2766
2766
|
}
|
|
2767
2767
|
}
|
|
2768
|
-
class
|
|
2768
|
+
class Ls extends Te {
|
|
2769
2769
|
fetchByBlueId(e) {
|
|
2770
2770
|
const t = e.split("#")[0], r = this.fetchContentByBlueId(t);
|
|
2771
2771
|
if (r == null)
|
|
@@ -2797,7 +2797,7 @@ class js extends Te {
|
|
|
2797
2797
|
}
|
|
2798
2798
|
}
|
|
2799
2799
|
}
|
|
2800
|
-
class Qt extends
|
|
2800
|
+
class Qt extends Ls {
|
|
2801
2801
|
nameToBlueIdsMap = /* @__PURE__ */ new Map();
|
|
2802
2802
|
/**
|
|
2803
2803
|
* Find a node by name. Throws an error if multiple nodes are found with the same name.
|
|
@@ -2841,17 +2841,17 @@ class Qt extends js {
|
|
|
2841
2841
|
]);
|
|
2842
2842
|
}
|
|
2843
2843
|
}
|
|
2844
|
-
const er = (s) => s instanceof c || Array.isArray(s) && s.every((e) => e instanceof c) ? s :
|
|
2844
|
+
const er = (s) => s instanceof c || Array.isArray(s) && s.every((e) => e instanceof c) ? s : tt(s) ? s.map((e) => g.deserialize(e)) : g.deserialize(s), js = async (s) => {
|
|
2845
2845
|
const e = er(s);
|
|
2846
2846
|
return T.calculateBlueId(e);
|
|
2847
2847
|
}, Zn = (s) => {
|
|
2848
2848
|
const e = er(s);
|
|
2849
2849
|
return T.calculateBlueIdSync(e);
|
|
2850
|
-
},
|
|
2851
|
-
if (
|
|
2850
|
+
}, Bt = async (s) => {
|
|
2851
|
+
if (Pr(s))
|
|
2852
2852
|
return s;
|
|
2853
2853
|
try {
|
|
2854
|
-
const e =
|
|
2854
|
+
const e = Ae.parse(s), t = await js(e);
|
|
2855
2855
|
return {
|
|
2856
2856
|
...s,
|
|
2857
2857
|
blueId: t
|
|
@@ -2859,31 +2859,31 @@ const er = (s) => s instanceof c || Array.isArray(s) && s.every((e) => e instanc
|
|
|
2859
2859
|
} catch (e) {
|
|
2860
2860
|
throw new Error(`Failed enriching object with Blue ID: ${e}`);
|
|
2861
2861
|
}
|
|
2862
|
-
}, Hn = (s) => s?.items, Xn = (s) => s?.value, qn = (s) =>
|
|
2862
|
+
}, Hn = (s) => s?.items, Xn = (s) => s?.value, qn = (s) => m(s) ? {} : Rt(
|
|
2863
2863
|
s,
|
|
2864
|
-
|
|
2865
|
-
), Qn = (s) => Sr(s) ? s.type.name ?? null : Cr(s) ? gr(typeof s.value) :
|
|
2864
|
+
nt
|
|
2865
|
+
), Qn = (s) => Sr(s) ? s.type.name ?? null : Cr(s) ? gr(typeof s.value) : Nr(s) ? "List" : null, Us = (s) => d(s) && Object.keys(Rt(s, ["blueId"])).length > 0, ei = (s) => {
|
|
2866
2866
|
try {
|
|
2867
|
-
const e = g.deserialize(s), t =
|
|
2867
|
+
const e = g.deserialize(s), t = I.get(e);
|
|
2868
2868
|
return de.parse(t);
|
|
2869
2869
|
} catch (e) {
|
|
2870
2870
|
throw new Error(
|
|
2871
2871
|
`Failed transforming JSON-like value to BlueObject: ${e}`
|
|
2872
2872
|
);
|
|
2873
2873
|
}
|
|
2874
|
-
},
|
|
2874
|
+
}, bt = async (s) => {
|
|
2875
2875
|
const {
|
|
2876
2876
|
resolveFunction: e,
|
|
2877
2877
|
signal: t = new AbortController().signal,
|
|
2878
2878
|
omitItems: r
|
|
2879
2879
|
} = s, n = s.count ?? s.items.length;
|
|
2880
|
-
let i = await mr(s.items, async (l) => await
|
|
2880
|
+
let i = await mr(s.items, async (l) => await Bt(l));
|
|
2881
2881
|
const o = Math.max(i?.length - n, 0);
|
|
2882
2882
|
for (let l = i.length - 1; l >= o; l--)
|
|
2883
2883
|
if (!Us(i[l])) {
|
|
2884
2884
|
const a = await e(i[l], { signal: t });
|
|
2885
2885
|
if (Array.isArray(a))
|
|
2886
|
-
return
|
|
2886
|
+
return bt({
|
|
2887
2887
|
...s,
|
|
2888
2888
|
items: [
|
|
2889
2889
|
...i.slice(0, l),
|
|
@@ -2891,9 +2891,9 @@ const er = (s) => s instanceof c || Array.isArray(s) && s.every((e) => e instanc
|
|
|
2891
2891
|
...i.slice(l + 1)
|
|
2892
2892
|
]
|
|
2893
2893
|
});
|
|
2894
|
-
const u = await
|
|
2894
|
+
const u = await Bt(a);
|
|
2895
2895
|
if (r?.includes(u.blueId))
|
|
2896
|
-
return
|
|
2896
|
+
return bt({
|
|
2897
2897
|
...s,
|
|
2898
2898
|
items: [...i.slice(0, l), ...i.slice(l + 1)]
|
|
2899
2899
|
});
|
|
@@ -2905,7 +2905,7 @@ const er = (s) => s instanceof c || Array.isArray(s) && s.every((e) => e instanc
|
|
|
2905
2905
|
}
|
|
2906
2906
|
return i;
|
|
2907
2907
|
};
|
|
2908
|
-
function
|
|
2908
|
+
function Ee(s) {
|
|
2909
2909
|
try {
|
|
2910
2910
|
const e = new URL(s);
|
|
2911
2911
|
return e.protocol === "http:" || e.protocol === "https:";
|
|
@@ -2920,7 +2920,7 @@ class ks {
|
|
|
2920
2920
|
* @returns The processed document
|
|
2921
2921
|
*/
|
|
2922
2922
|
process(e) {
|
|
2923
|
-
return
|
|
2923
|
+
return w.transform(e, this.inferType.bind(this));
|
|
2924
2924
|
}
|
|
2925
2925
|
/**
|
|
2926
2926
|
* Infer a basic type for a node
|
|
@@ -2929,10 +2929,10 @@ class ks {
|
|
|
2929
2929
|
*/
|
|
2930
2930
|
inferType(e) {
|
|
2931
2931
|
const t = e.getType(), r = e.getValue();
|
|
2932
|
-
return
|
|
2932
|
+
return m(t) && d(r) && (typeof r == "string" ? e.setType(new c().setBlueId(_)) : typeof r == "bigint" || Z(r) ? e.setType(new c().setBlueId(j)) : We(r) ? e.setType(new c().setBlueId(L)) : typeof r == "boolean" && e.setType(new c().setBlueId(U))), e;
|
|
2933
2933
|
}
|
|
2934
2934
|
}
|
|
2935
|
-
class
|
|
2935
|
+
class Re {
|
|
2936
2936
|
static MAPPINGS = "mappings";
|
|
2937
2937
|
mappings = /* @__PURE__ */ new Map();
|
|
2938
2938
|
/**
|
|
@@ -2942,8 +2942,8 @@ class Ve {
|
|
|
2942
2942
|
constructor(e) {
|
|
2943
2943
|
if (e instanceof c) {
|
|
2944
2944
|
const r = e.getProperties();
|
|
2945
|
-
if (r && r[
|
|
2946
|
-
const i = r[
|
|
2945
|
+
if (r && r[Re.MAPPINGS]) {
|
|
2946
|
+
const i = r[Re.MAPPINGS].getProperties();
|
|
2947
2947
|
i && Object.entries(i).forEach(([o, l]) => {
|
|
2948
2948
|
const a = l.getValue();
|
|
2949
2949
|
typeof a == "string" && this.mappings.set(o, a);
|
|
@@ -2958,7 +2958,7 @@ class Ve {
|
|
|
2958
2958
|
* @returns The processed document
|
|
2959
2959
|
*/
|
|
2960
2960
|
process(e) {
|
|
2961
|
-
return
|
|
2961
|
+
return w.transform(e, this.transformNode.bind(this));
|
|
2962
2962
|
}
|
|
2963
2963
|
transformNode(e) {
|
|
2964
2964
|
const t = e.clone();
|
|
@@ -2985,7 +2985,7 @@ class Ks {
|
|
|
2985
2985
|
* @throws Error if any inline type values remain without BlueId mappings
|
|
2986
2986
|
*/
|
|
2987
2987
|
process(e) {
|
|
2988
|
-
return
|
|
2988
|
+
return w.transform(e, this.validateNode.bind(this)), e;
|
|
2989
2989
|
}
|
|
2990
2990
|
validateNode(e) {
|
|
2991
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;
|
|
@@ -3051,11 +3051,11 @@ class ft {
|
|
|
3051
3051
|
y && Object.entries(y).forEach(([f, v]) => {
|
|
3052
3052
|
this.extendNode(v, t, f, !1);
|
|
3053
3053
|
});
|
|
3054
|
-
const
|
|
3055
|
-
if (
|
|
3056
|
-
this.reconstructList(
|
|
3057
|
-
for (let f = 0; f <
|
|
3058
|
-
this.extendNode(
|
|
3054
|
+
const p = e.getItems();
|
|
3055
|
+
if (p && p.length > 0) {
|
|
3056
|
+
this.reconstructList(p);
|
|
3057
|
+
for (let f = 0; f < p.length; f++)
|
|
3058
|
+
this.extendNode(p[f], t, String(f), !1);
|
|
3059
3059
|
}
|
|
3060
3060
|
} finally {
|
|
3061
3061
|
n || t.exitPathSegment();
|
|
@@ -3090,7 +3090,7 @@ class ft {
|
|
|
3090
3090
|
mergeNodes(e, t) {
|
|
3091
3091
|
e.setName(t.getName()), e.setDescription(t.getDescription()), e.setType(t.getType()), e.setItemType(t.getItemType()), e.setKeyType(t.getKeyType()), e.setValueType(t.getValueType());
|
|
3092
3092
|
const r = t.getValue();
|
|
3093
|
-
|
|
3093
|
+
d(r) && e.setValue(r), e.setItems(t.getItems()), e.setProperties(t.getProperties());
|
|
3094
3094
|
}
|
|
3095
3095
|
}
|
|
3096
3096
|
class yt {
|
|
@@ -3206,7 +3206,7 @@ class ie {
|
|
|
3206
3206
|
if (!n && t && (n = t.clone()), n) {
|
|
3207
3207
|
new ft(this.nodeProvider).extend(
|
|
3208
3208
|
n,
|
|
3209
|
-
|
|
3209
|
+
Le.withSinglePath("/*")
|
|
3210
3210
|
);
|
|
3211
3211
|
const i = n.getItems();
|
|
3212
3212
|
if (i && i.length > 0) {
|
|
@@ -3236,7 +3236,7 @@ class ie {
|
|
|
3236
3236
|
getProcessor(e) {
|
|
3237
3237
|
const t = "27B7fuxQCS1VAptiCPc2RMkKoutP5qxkh3uDxZ7dr6Eo", r = "FGYuTXwaoSKfZmpTysLTLsb8WzSqf43384rKZDkXhxD4", n = e.getType()?.getBlueId();
|
|
3238
3238
|
if (t === n)
|
|
3239
|
-
return new
|
|
3239
|
+
return new Re(
|
|
3240
3240
|
e
|
|
3241
3241
|
);
|
|
3242
3242
|
if (r === n)
|
|
@@ -3325,10 +3325,10 @@ class gt extends Qt {
|
|
|
3325
3325
|
(o) => o
|
|
3326
3326
|
), i = t || n.blueId;
|
|
3327
3327
|
this.blueIdToContentMap.set(i, n.content), this.blueIdToMultipleDocumentsMap.set(i, !0), r.forEach((o, l) => {
|
|
3328
|
-
const a = `${i}#${l}`, u =
|
|
3328
|
+
const a = `${i}#${l}`, u = I.get(o), y = T.calculateBlueIdSync(o);
|
|
3329
3329
|
this.blueIdToContentMap.set(y, u), this.blueIdToMultipleDocumentsMap.set(y, !1);
|
|
3330
|
-
const
|
|
3331
|
-
|
|
3330
|
+
const p = o.getName();
|
|
3331
|
+
p && this.addToNameMap(p, a);
|
|
3332
3332
|
});
|
|
3333
3333
|
}
|
|
3334
3334
|
fetchContentByBlueId(e) {
|
|
@@ -3366,7 +3366,7 @@ class he {
|
|
|
3366
3366
|
const n = new gt(t);
|
|
3367
3367
|
r.push(n);
|
|
3368
3368
|
}
|
|
3369
|
-
return r.push(e), new
|
|
3369
|
+
return r.push(e), new Ms(r);
|
|
3370
3370
|
}
|
|
3371
3371
|
}
|
|
3372
3372
|
class Ys {
|
|
@@ -3393,9 +3393,9 @@ class Ys {
|
|
|
3393
3393
|
const r = e.clone();
|
|
3394
3394
|
if (this.preprocessingAliases.has(t))
|
|
3395
3395
|
return this.handleAliasValue(r, t);
|
|
3396
|
-
if (
|
|
3396
|
+
if (Ce.isPotentialBlueId(t))
|
|
3397
3397
|
return this.handleBlueId(r, t);
|
|
3398
|
-
throw
|
|
3398
|
+
throw Ee(t) ? new Error(
|
|
3399
3399
|
`URL '${t}' detected. Use the async version of this method to fetch the content.`
|
|
3400
3400
|
) : new Error(`Invalid blue value: ${t}`);
|
|
3401
3401
|
}
|
|
@@ -3413,9 +3413,9 @@ class Ys {
|
|
|
3413
3413
|
const r = e.clone();
|
|
3414
3414
|
if (this.preprocessingAliases.has(t))
|
|
3415
3415
|
return this.handleAliasValue(r, t);
|
|
3416
|
-
if (
|
|
3416
|
+
if (Ce.isPotentialBlueId(t))
|
|
3417
3417
|
return this.handleBlueId(r, t);
|
|
3418
|
-
if (
|
|
3418
|
+
if (Ee(t) && this.urlContentFetcher)
|
|
3419
3419
|
try {
|
|
3420
3420
|
const n = await this.fetchFromUrl(t);
|
|
3421
3421
|
return n && r.setBlue(new c().setItems(n)), r;
|
|
@@ -3425,7 +3425,7 @@ class Ys {
|
|
|
3425
3425
|
${n.message}`
|
|
3426
3426
|
) : n;
|
|
3427
3427
|
}
|
|
3428
|
-
else throw
|
|
3428
|
+
else throw Ee(t) ? new Error(
|
|
3429
3429
|
`UrlContentFetcher not provided for URL: ${t}`
|
|
3430
3430
|
) : new Error(`Invalid blue value: ${t}`);
|
|
3431
3431
|
}
|
|
@@ -3528,7 +3528,7 @@ class Gs {
|
|
|
3528
3528
|
this.fetchStrategy = e || zs;
|
|
3529
3529
|
}
|
|
3530
3530
|
validateUrl(e) {
|
|
3531
|
-
if (!
|
|
3531
|
+
if (!Ee(e))
|
|
3532
3532
|
throw new Error(`Invalid URL: ${e}`);
|
|
3533
3533
|
return !0;
|
|
3534
3534
|
}
|
|
@@ -3685,14 +3685,14 @@ class Ws extends Js {
|
|
|
3685
3685
|
);
|
|
3686
3686
|
}
|
|
3687
3687
|
mergeWithContext(e, t, r) {
|
|
3688
|
-
if (
|
|
3688
|
+
if (d(t.getBlue()))
|
|
3689
3689
|
throw new Error(
|
|
3690
3690
|
'Document contains "blue" attribute. Preprocess document before merging.'
|
|
3691
3691
|
);
|
|
3692
3692
|
let n = e;
|
|
3693
3693
|
const i = t.getType();
|
|
3694
|
-
if (
|
|
3695
|
-
const o = this.resolveTypeNode(i, r), l = o.clone().setType(void 0);
|
|
3694
|
+
if (d(i)) {
|
|
3695
|
+
const o = this.resolveTypeNode(i, r), l = o.clone().setType(void 0).setBlueId(void 0);
|
|
3696
3696
|
n = this.mergeObject(n, l, r);
|
|
3697
3697
|
const a = t.cloneShallow().setType(o.clone());
|
|
3698
3698
|
return this.mergeObject(n, a, r);
|
|
@@ -3714,9 +3714,9 @@ class Ws extends Js {
|
|
|
3714
3714
|
r.nodeProvider
|
|
3715
3715
|
);
|
|
3716
3716
|
const o = t.getItems();
|
|
3717
|
-
|
|
3717
|
+
d(o) && (i = this.mergeChildren(i, o, r));
|
|
3718
3718
|
const l = t.getProperties();
|
|
3719
|
-
return
|
|
3719
|
+
return d(l) && (i = this.mergeProperties(i, l, r)), d(t.getBlueId()) && (i = i.cloneShallow().setBlueId(t.getBlueId())), this.mergingProcessor.postProcess && (i = this.mergingProcessor.postProcess(
|
|
3720
3720
|
i,
|
|
3721
3721
|
t,
|
|
3722
3722
|
r.nodeProvider
|
|
@@ -3730,49 +3730,141 @@ class Ws extends Js {
|
|
|
3730
3730
|
* @returns A new BlueNode with the merged children
|
|
3731
3731
|
*/
|
|
3732
3732
|
mergeChildren(e, t, r) {
|
|
3733
|
-
const n = e.getItems()
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3733
|
+
const n = e.getItems(), i = d(n) || this.isInheritedListMarkerNode(t[0]) ? this.getInheritedItemsPrefixLength(
|
|
3734
|
+
t,
|
|
3735
|
+
n ?? [],
|
|
3736
|
+
r
|
|
3737
|
+
) : void 0;
|
|
3738
|
+
if (this.rememberInheritedItemsPrefix(
|
|
3739
|
+
t,
|
|
3740
|
+
i,
|
|
3741
|
+
r
|
|
3742
|
+
), m(n)) {
|
|
3743
|
+
const l = [];
|
|
3744
|
+
for (let a = 0; a < t.length; a++) {
|
|
3745
|
+
const u = t[a];
|
|
3746
|
+
if (r.limits.shouldMergePathSegment(String(a), u)) {
|
|
3747
|
+
this.enterPathSegment(r, String(a), u);
|
|
3740
3748
|
try {
|
|
3741
|
-
const
|
|
3742
|
-
|
|
3749
|
+
const y = this.materializeForCurrentContext(
|
|
3750
|
+
u,
|
|
3751
|
+
r
|
|
3752
|
+
);
|
|
3753
|
+
l.push(y);
|
|
3743
3754
|
} finally {
|
|
3744
3755
|
this.exitPathSegment(r);
|
|
3745
3756
|
}
|
|
3746
3757
|
}
|
|
3747
3758
|
}
|
|
3748
|
-
return e.cloneShallow().setItems(
|
|
3749
|
-
}
|
|
3759
|
+
return e.cloneShallow().setItems(l);
|
|
3760
|
+
}
|
|
3761
|
+
if (d(i)) {
|
|
3762
|
+
const l = this.mergeChildrenWithInheritedItemsPrefix(
|
|
3763
|
+
t,
|
|
3764
|
+
n,
|
|
3765
|
+
i,
|
|
3766
|
+
r
|
|
3767
|
+
);
|
|
3768
|
+
return e.cloneShallow().setItems(l);
|
|
3769
|
+
}
|
|
3770
|
+
if (t.length < n.length)
|
|
3750
3771
|
throw new Error(
|
|
3751
3772
|
`Subtype of element must not have more items (${n.length}) than the element itself (${t.length}).`
|
|
3752
3773
|
);
|
|
3753
|
-
const
|
|
3754
|
-
for (let
|
|
3755
|
-
if (r.limits.shouldMergePathSegment(String(
|
|
3756
|
-
this.enterPathSegment(r, String(
|
|
3774
|
+
const o = [...n];
|
|
3775
|
+
for (let l = 0; l < t.length; l++)
|
|
3776
|
+
if (r.limits.shouldMergePathSegment(String(l), t[l])) {
|
|
3777
|
+
this.enterPathSegment(r, String(l), t[l]);
|
|
3757
3778
|
try {
|
|
3758
|
-
if (
|
|
3759
|
-
|
|
3779
|
+
if (l >= o.length) {
|
|
3780
|
+
const y = this.materializeForCurrentContext(
|
|
3781
|
+
t[l],
|
|
3782
|
+
r
|
|
3783
|
+
);
|
|
3784
|
+
o.push(y);
|
|
3760
3785
|
continue;
|
|
3761
3786
|
}
|
|
3762
|
-
const
|
|
3763
|
-
t[
|
|
3764
|
-
),
|
|
3765
|
-
|
|
3787
|
+
const a = T.calculateBlueIdSync(
|
|
3788
|
+
t[l]
|
|
3789
|
+
), u = T.calculateBlueIdSync(
|
|
3790
|
+
o[l]
|
|
3766
3791
|
);
|
|
3767
|
-
if (
|
|
3792
|
+
if (a !== u)
|
|
3768
3793
|
throw new Error(
|
|
3769
|
-
`Mismatched items at index ${
|
|
3794
|
+
`Mismatched items at index ${l}: source item has blueId '${a}', but target item has blueId '${u}'.`
|
|
3770
3795
|
);
|
|
3771
3796
|
} finally {
|
|
3772
3797
|
this.exitPathSegment(r);
|
|
3773
3798
|
}
|
|
3774
3799
|
}
|
|
3775
|
-
return e.cloneShallow().setItems(
|
|
3800
|
+
return e.cloneShallow().setItems(o);
|
|
3801
|
+
}
|
|
3802
|
+
/**
|
|
3803
|
+
* `reverse()` may encode an inherited list as:
|
|
3804
|
+
* [ { blueId: BlueId(inheritedItems[]) }, ...appendedItems ]
|
|
3805
|
+
* When that marker is present, `resolve` should keep all inherited target
|
|
3806
|
+
* items and append only explicit source suffix items.
|
|
3807
|
+
*/
|
|
3808
|
+
getInheritedItemsPrefixLength(e, t, r) {
|
|
3809
|
+
const n = e[0], i = n?.getBlueId();
|
|
3810
|
+
if (m(i))
|
|
3811
|
+
return;
|
|
3812
|
+
let o;
|
|
3813
|
+
if (t.length > 0) {
|
|
3814
|
+
const l = T.calculateBlueIdSync(t);
|
|
3815
|
+
i === l && (o = t.length);
|
|
3816
|
+
}
|
|
3817
|
+
if (m(o)) {
|
|
3818
|
+
const l = r.inheritedItemsPrefixByPath.get(
|
|
3819
|
+
this.getCurrentPointer(r)
|
|
3820
|
+
);
|
|
3821
|
+
d(l) && l.blueId === i && (o = l.length);
|
|
3822
|
+
}
|
|
3823
|
+
if (!m(o)) {
|
|
3824
|
+
if (!this.isInheritedListMarkerNode(n)) {
|
|
3825
|
+
if (e.length > 1)
|
|
3826
|
+
throw new Error(
|
|
3827
|
+
"Invalid inherited-list marker: first list item must contain only blueId."
|
|
3828
|
+
);
|
|
3829
|
+
return;
|
|
3830
|
+
}
|
|
3831
|
+
return o;
|
|
3832
|
+
}
|
|
3833
|
+
}
|
|
3834
|
+
rememberInheritedItemsPrefix(e, t, r) {
|
|
3835
|
+
const n = this.getCurrentPointer(r);
|
|
3836
|
+
if (e.length === 0)
|
|
3837
|
+
return;
|
|
3838
|
+
const i = e[0], l = this.isInheritedListMarkerNode(i) ? d(t) ? t + e.length - 1 : void 0 : e.length;
|
|
3839
|
+
if (m(l))
|
|
3840
|
+
return;
|
|
3841
|
+
const a = {
|
|
3842
|
+
blueId: T.calculateBlueIdSync(e),
|
|
3843
|
+
length: l
|
|
3844
|
+
}, u = r.inheritedItemsPrefixByPath.get(n);
|
|
3845
|
+
d(u) && u.length >= a.length || r.inheritedItemsPrefixByPath.set(n, a);
|
|
3846
|
+
}
|
|
3847
|
+
isInheritedListMarkerNode(e) {
|
|
3848
|
+
return d(e) && d(e.getBlueId()) && _e.hasBlueIdOnly(e);
|
|
3849
|
+
}
|
|
3850
|
+
mergeChildrenWithInheritedItemsPrefix(e, t, r, n) {
|
|
3851
|
+
const i = [...t];
|
|
3852
|
+
for (let o = 1; o < e.length; o++) {
|
|
3853
|
+
const l = e[o], a = String(r + o - 1);
|
|
3854
|
+
if (n.limits.shouldMergePathSegment(a, l)) {
|
|
3855
|
+
this.enterPathSegment(n, a, l);
|
|
3856
|
+
try {
|
|
3857
|
+
const u = this.materializeForCurrentContext(
|
|
3858
|
+
l,
|
|
3859
|
+
n
|
|
3860
|
+
);
|
|
3861
|
+
i.push(u);
|
|
3862
|
+
} finally {
|
|
3863
|
+
this.exitPathSegment(n);
|
|
3864
|
+
}
|
|
3865
|
+
}
|
|
3866
|
+
}
|
|
3867
|
+
return i;
|
|
3776
3868
|
}
|
|
3777
3869
|
/**
|
|
3778
3870
|
* Merges source properties into target using copy-on-write for properties map
|
|
@@ -3788,14 +3880,33 @@ class Ws extends Js {
|
|
|
3788
3880
|
if (r.limits.shouldMergePathSegment(l, a)) {
|
|
3789
3881
|
this.enterPathSegment(r, l, a);
|
|
3790
3882
|
try {
|
|
3791
|
-
const u =
|
|
3792
|
-
|
|
3883
|
+
const u = i[l], p = this.shouldMergePropertyWithoutPreResolve(
|
|
3884
|
+
u,
|
|
3885
|
+
a,
|
|
3886
|
+
r
|
|
3887
|
+
) ? this.mergeWithContext(u, a, r) : (() => {
|
|
3888
|
+
const f = this.materializeForCurrentContext(
|
|
3889
|
+
a,
|
|
3890
|
+
r
|
|
3891
|
+
);
|
|
3892
|
+
return u === void 0 ? f : this.mergeObject(u, f, r);
|
|
3893
|
+
})();
|
|
3894
|
+
p !== u && (o || (i = { ...n }, o = !0), i[l] = p);
|
|
3793
3895
|
} finally {
|
|
3794
3896
|
this.exitPathSegment(r);
|
|
3795
3897
|
}
|
|
3796
3898
|
}
|
|
3797
3899
|
return o ? e.cloneShallow().setProperties(i) : e;
|
|
3798
3900
|
}
|
|
3901
|
+
/**
|
|
3902
|
+
* Under path-limited resolution, pre-resolving list-like source properties
|
|
3903
|
+
* compacts indexes and may overwrite inherited-prefix metadata for the current
|
|
3904
|
+
* pointer. Merge unresolved source to preserve index semantics, but still
|
|
3905
|
+
* through mergeWithContext so source type overlays are resolved.
|
|
3906
|
+
*/
|
|
3907
|
+
shouldMergePropertyWithoutPreResolve(e, t, r) {
|
|
3908
|
+
return m(e) || r.limits instanceof we ? !1 : d(t.getItems()) || d(e.getItems());
|
|
3909
|
+
}
|
|
3799
3910
|
/**
|
|
3800
3911
|
* Resolves a node by creating a new node and merging the source into it
|
|
3801
3912
|
* @param node - The node to resolve
|
|
@@ -3814,14 +3925,15 @@ class Ws extends Js {
|
|
|
3814
3925
|
limits: e,
|
|
3815
3926
|
nodeProvider: this.nodeProvider,
|
|
3816
3927
|
resolvedTypeCache: /* @__PURE__ */ new Map(),
|
|
3928
|
+
inheritedItemsPrefixByPath: /* @__PURE__ */ new Map(),
|
|
3817
3929
|
pathStack: []
|
|
3818
3930
|
};
|
|
3819
3931
|
}
|
|
3820
3932
|
resolveTypeNode(e, t) {
|
|
3821
3933
|
const r = e.getBlueId();
|
|
3822
|
-
if (
|
|
3934
|
+
if (d(r)) {
|
|
3823
3935
|
const n = this.createResolvedTypeCacheKey(r, t), i = t.resolvedTypeCache.get(n);
|
|
3824
|
-
if (
|
|
3936
|
+
if (d(i))
|
|
3825
3937
|
return i;
|
|
3826
3938
|
const o = this.resolveAndExtendTypeNode(e, t);
|
|
3827
3939
|
return t.resolvedTypeCache.set(n, o), o;
|
|
@@ -3830,16 +3942,19 @@ class Ws extends Js {
|
|
|
3830
3942
|
}
|
|
3831
3943
|
resolveAndExtendTypeNode(e, t) {
|
|
3832
3944
|
const r = e.clone();
|
|
3833
|
-
return
|
|
3945
|
+
return d(r.getBlueId()) && new ft(t.nodeProvider).extend(
|
|
3834
3946
|
r,
|
|
3835
|
-
|
|
3947
|
+
Le.withSinglePath("/")
|
|
3836
3948
|
), this.resolveWithContext(r, t);
|
|
3837
3949
|
}
|
|
3838
3950
|
createResolvedTypeCacheKey(e, t) {
|
|
3839
|
-
return t.limits instanceof
|
|
3951
|
+
return t.limits instanceof we ? e : `${e}|${this.getCurrentPointer(t)}`;
|
|
3952
|
+
}
|
|
3953
|
+
materializeForCurrentContext(e, t) {
|
|
3954
|
+
return e.isResolved() && this.canReuseResolvedSubtree(t) ? e.clone() : this.resolveWithContext(e, t);
|
|
3840
3955
|
}
|
|
3841
3956
|
canReuseResolvedSubtree(e) {
|
|
3842
|
-
return e.limits instanceof
|
|
3957
|
+
return e.limits instanceof we;
|
|
3843
3958
|
}
|
|
3844
3959
|
getCurrentPointer(e) {
|
|
3845
3960
|
return e.pathStack.length === 0 ? "/" : `/${e.pathStack.join("/")}`;
|
|
@@ -3879,9 +3994,9 @@ class tr {
|
|
|
3879
3994
|
class rr {
|
|
3880
3995
|
process(e, t) {
|
|
3881
3996
|
const r = t.getValue();
|
|
3882
|
-
if (
|
|
3997
|
+
if (d(r)) {
|
|
3883
3998
|
const n = e.getValue();
|
|
3884
|
-
if (
|
|
3999
|
+
if (m(n))
|
|
3885
4000
|
return e.cloneShallow().setValue(r);
|
|
3886
4001
|
if (!Zs(r, n))
|
|
3887
4002
|
throw new Error(
|
|
@@ -3891,7 +4006,7 @@ class rr {
|
|
|
3891
4006
|
return e;
|
|
3892
4007
|
}
|
|
3893
4008
|
}
|
|
3894
|
-
const Zs = (s, e) => Z(s) && Z(e) ||
|
|
4009
|
+
const Zs = (s, e) => Z(s) && Z(e) || We(s) && We(e) ? s.eq(e) : s === e;
|
|
3895
4010
|
class sr {
|
|
3896
4011
|
process(e, t, r) {
|
|
3897
4012
|
const n = e.getType(), i = t.getType();
|
|
@@ -3899,12 +4014,12 @@ class sr {
|
|
|
3899
4014
|
if (n === void 0)
|
|
3900
4015
|
o = e.cloneShallow().setType(i);
|
|
3901
4016
|
else if (i !== void 0) {
|
|
3902
|
-
if (!
|
|
4017
|
+
if (!b(
|
|
3903
4018
|
i,
|
|
3904
4019
|
n,
|
|
3905
4020
|
r
|
|
3906
4021
|
)) {
|
|
3907
|
-
const a =
|
|
4022
|
+
const a = I.get(i), u = I.get(n);
|
|
3908
4023
|
throw new Error(
|
|
3909
4024
|
`The source type '${JSON.stringify(
|
|
3910
4025
|
a
|
|
@@ -3928,15 +4043,15 @@ class nr {
|
|
|
3928
4043
|
if (o === void 0)
|
|
3929
4044
|
n !== void 0 && (l = e.cloneShallow().setItemType(n));
|
|
3930
4045
|
else if (n !== void 0) {
|
|
3931
|
-
if (!
|
|
4046
|
+
if (!b(
|
|
3932
4047
|
n,
|
|
3933
4048
|
o,
|
|
3934
4049
|
r
|
|
3935
4050
|
)) {
|
|
3936
|
-
const
|
|
4051
|
+
const p = I.get(n), f = I.get(o);
|
|
3937
4052
|
throw new Error(
|
|
3938
4053
|
`The source item type '${JSON.stringify(
|
|
3939
|
-
|
|
4054
|
+
p
|
|
3940
4055
|
)}' is not a subtype of the target item type '${JSON.stringify(
|
|
3941
4056
|
f
|
|
3942
4057
|
)}'.`
|
|
@@ -3947,13 +4062,13 @@ class nr {
|
|
|
3947
4062
|
const a = l.getItemType(), u = t.getItems();
|
|
3948
4063
|
if (a !== void 0 && u !== void 0)
|
|
3949
4064
|
for (const y of u) {
|
|
3950
|
-
const
|
|
3951
|
-
if (
|
|
3952
|
-
|
|
4065
|
+
const p = y.getType();
|
|
4066
|
+
if (p !== void 0 && !b(
|
|
4067
|
+
p,
|
|
3953
4068
|
a,
|
|
3954
4069
|
r
|
|
3955
4070
|
)) {
|
|
3956
|
-
const f =
|
|
4071
|
+
const f = I.get(p), v = I.get(
|
|
3957
4072
|
a
|
|
3958
4073
|
);
|
|
3959
4074
|
throw new Error(
|
|
@@ -3978,8 +4093,8 @@ class ir {
|
|
|
3978
4093
|
let l = this.processKeyType(e, t, r);
|
|
3979
4094
|
l = this.processValueType(l, t, r);
|
|
3980
4095
|
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(([
|
|
3982
|
-
a !== void 0 && this.validateKeyType(
|
|
4096
|
+
return (a !== void 0 || u !== void 0) && y !== void 0 && Object.entries(y).forEach(([p, f]) => {
|
|
4097
|
+
a !== void 0 && this.validateKeyType(p, a, r), u !== void 0 && this.validateValueType(f, u, r);
|
|
3983
4098
|
}), l;
|
|
3984
4099
|
}
|
|
3985
4100
|
processKeyType(e, t, r) {
|
|
@@ -3988,12 +4103,12 @@ class ir {
|
|
|
3988
4103
|
if (i !== void 0)
|
|
3989
4104
|
return this.validateBasicKeyType(i, r), e.cloneShallow().setKeyType(i);
|
|
3990
4105
|
} else if (i !== void 0) {
|
|
3991
|
-
if (this.validateBasicKeyType(i, r), !
|
|
4106
|
+
if (this.validateBasicKeyType(i, r), !b(
|
|
3992
4107
|
i,
|
|
3993
4108
|
n,
|
|
3994
4109
|
r
|
|
3995
4110
|
)) {
|
|
3996
|
-
const l =
|
|
4111
|
+
const l = I.get(i), a = I.get(n);
|
|
3997
4112
|
throw new Error(
|
|
3998
4113
|
`The source key type '${JSON.stringify(
|
|
3999
4114
|
l
|
|
@@ -4012,12 +4127,12 @@ class ir {
|
|
|
4012
4127
|
if (i !== void 0)
|
|
4013
4128
|
return e.cloneShallow().setValueType(i);
|
|
4014
4129
|
} else if (i !== void 0) {
|
|
4015
|
-
if (!
|
|
4130
|
+
if (!b(
|
|
4016
4131
|
i,
|
|
4017
4132
|
n,
|
|
4018
4133
|
r
|
|
4019
4134
|
)) {
|
|
4020
|
-
const l =
|
|
4135
|
+
const l = I.get(i), a = I.get(n);
|
|
4021
4136
|
throw new Error(
|
|
4022
4137
|
`The source value type '${JSON.stringify(
|
|
4023
4138
|
l
|
|
@@ -4054,8 +4169,8 @@ class ir {
|
|
|
4054
4169
|
}
|
|
4055
4170
|
validateValueType(e, t, r) {
|
|
4056
4171
|
const n = e.getType();
|
|
4057
|
-
if (n !== void 0 && !
|
|
4058
|
-
const i =
|
|
4172
|
+
if (n !== void 0 && !b(n, t, r)) {
|
|
4173
|
+
const i = I.get(n), o = I.get(t);
|
|
4059
4174
|
throw new Error(
|
|
4060
4175
|
`Value of type '${JSON.stringify(
|
|
4061
4176
|
i
|
|
@@ -4090,10 +4205,10 @@ class or {
|
|
|
4090
4205
|
class lr {
|
|
4091
4206
|
process(e, t) {
|
|
4092
4207
|
let r = e;
|
|
4093
|
-
const n = t.getName()
|
|
4094
|
-
n !== void 0 &&
|
|
4095
|
-
const
|
|
4096
|
-
return
|
|
4208
|
+
const n = t.getName();
|
|
4209
|
+
n !== void 0 && n !== e.getName() && (r = r.cloneShallow().setName(n));
|
|
4210
|
+
const i = t.getDescription();
|
|
4211
|
+
return i !== void 0 && i !== r.getDescription() && (r = r.cloneShallow().setDescription(i)), r;
|
|
4097
4212
|
}
|
|
4098
4213
|
}
|
|
4099
4214
|
const ti = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -4121,7 +4236,7 @@ class Xs {
|
|
|
4121
4236
|
blueIdToInlineValue = /* @__PURE__ */ new Map();
|
|
4122
4237
|
constructor(e) {
|
|
4123
4238
|
const { nodeProvider: t, blueIdsMappingGenerator: r } = e;
|
|
4124
|
-
this.nodeProvider = t, Object.entries(
|
|
4239
|
+
this.nodeProvider = t, Object.entries(Fe).forEach(([i, o]) => {
|
|
4125
4240
|
this.blueIdToInlineValue.set(i, o);
|
|
4126
4241
|
});
|
|
4127
4242
|
const n = r.getAllBlueIds();
|
|
@@ -4133,7 +4248,7 @@ class Xs {
|
|
|
4133
4248
|
* Returns a new BlueNode where all type references are restored to inline values when possible.
|
|
4134
4249
|
*/
|
|
4135
4250
|
restore(e) {
|
|
4136
|
-
return
|
|
4251
|
+
return w.transform(
|
|
4137
4252
|
e,
|
|
4138
4253
|
(t) => this.restoreNode(t)
|
|
4139
4254
|
);
|
|
@@ -4215,7 +4330,7 @@ class qs {
|
|
|
4215
4330
|
return e;
|
|
4216
4331
|
}
|
|
4217
4332
|
getTypeAlias(e) {
|
|
4218
|
-
const t = this.toCurrentBlueId(e), r =
|
|
4333
|
+
const t = this.toCurrentBlueId(e), r = Fe[t];
|
|
4219
4334
|
if (r)
|
|
4220
4335
|
return r;
|
|
4221
4336
|
for (const n of this.runtimes) {
|
|
@@ -4315,7 +4430,7 @@ function on(s, e) {
|
|
|
4315
4430
|
s.schemas.push(...Object.values(e.schemas));
|
|
4316
4431
|
}
|
|
4317
4432
|
function ln(s, e, t, r) {
|
|
4318
|
-
if (s.status ===
|
|
4433
|
+
if (s.status === st)
|
|
4319
4434
|
return an(s, e, t, r), {
|
|
4320
4435
|
...s,
|
|
4321
4436
|
versions: s.versions ? [...s.versions] : s.versions
|
|
@@ -4351,7 +4466,7 @@ function ln(s, e, t, r) {
|
|
|
4351
4466
|
};
|
|
4352
4467
|
}
|
|
4353
4468
|
function an(s, e, t, r) {
|
|
4354
|
-
if (s.status ===
|
|
4469
|
+
if (s.status === st) {
|
|
4355
4470
|
if (s.versions && s.versions.length > 1)
|
|
4356
4471
|
throw new Error(
|
|
4357
4472
|
`Dev type ${r}/${s.name} (${t}) must not declare multiple versions`
|
|
@@ -4401,17 +4516,17 @@ function dn(s, e, t) {
|
|
|
4401
4516
|
function pn(s, e) {
|
|
4402
4517
|
if (s === e) return !0;
|
|
4403
4518
|
if (s === null || e === null || typeof s != "object" || typeof e != "object") return !1;
|
|
4404
|
-
const t =
|
|
4519
|
+
const t = Ze.canonicalize(s), r = Ze.canonicalize(e);
|
|
4405
4520
|
return t !== void 0 && t === r;
|
|
4406
4521
|
}
|
|
4407
|
-
class
|
|
4522
|
+
class Oe extends Error {
|
|
4408
4523
|
code;
|
|
4409
4524
|
details;
|
|
4410
4525
|
constructor(e, t, r) {
|
|
4411
4526
|
super(t), this.code = e, this.details = r && r.length > 0 ? r : [], this.name = "BlueError";
|
|
4412
4527
|
}
|
|
4413
4528
|
}
|
|
4414
|
-
const
|
|
4529
|
+
const M = {
|
|
4415
4530
|
REPO_UNKNOWN_REPO_BLUE_ID: "REPO_UNKNOWN_REPO_BLUE_ID",
|
|
4416
4531
|
REPO_UNREPRESENTABLE_IN_TARGET_VERSION: "REPO_UNREPRESENTABLE_IN_TARGET_VERSION",
|
|
4417
4532
|
INVALID_BLUE_CONTEXT_REPOSITORIES: "INVALID_BLUE_CONTEXT_REPOSITORIES",
|
|
@@ -4421,7 +4536,7 @@ const D = {
|
|
|
4421
4536
|
"constructor",
|
|
4422
4537
|
"prototype"
|
|
4423
4538
|
]);
|
|
4424
|
-
function
|
|
4539
|
+
function wt(s) {
|
|
4425
4540
|
const e = s.at(0), t = s.at(-1);
|
|
4426
4541
|
return !e || !t ? s : e === "'" && t === "'" || e === '"' && t === '"' ? s.slice(1, -1) : s;
|
|
4427
4542
|
}
|
|
@@ -4431,7 +4546,7 @@ function fn(s, e) {
|
|
|
4431
4546
|
throw re(e, `Missing '=' in segment '${s.trim()}'`);
|
|
4432
4547
|
if (s.indexOf("=", t + 1) !== -1)
|
|
4433
4548
|
throw re(e, `Unexpected '=' in segment '${s.trim()}'`);
|
|
4434
|
-
const r =
|
|
4549
|
+
const r = wt(s.slice(0, t).trim()), n = wt(s.slice(t + 1).trim());
|
|
4435
4550
|
if (!r)
|
|
4436
4551
|
throw re(e, "Repository name is empty");
|
|
4437
4552
|
if (!n)
|
|
@@ -4455,12 +4570,12 @@ function gn(s) {
|
|
|
4455
4570
|
return typeof s == "string" ? yn(s) : s;
|
|
4456
4571
|
}
|
|
4457
4572
|
function re(s, e) {
|
|
4458
|
-
return new
|
|
4459
|
-
|
|
4573
|
+
return new Oe(
|
|
4574
|
+
M.INVALID_BLUE_CONTEXT_REPOSITORIES,
|
|
4460
4575
|
`Invalid BlueContext repositories value: ${e}`,
|
|
4461
4576
|
[
|
|
4462
4577
|
{
|
|
4463
|
-
code:
|
|
4578
|
+
code: M.INVALID_BLUE_CONTEXT_REPOSITORIES,
|
|
4464
4579
|
message: e,
|
|
4465
4580
|
locationPath: [],
|
|
4466
4581
|
context: {
|
|
@@ -4488,7 +4603,7 @@ function In(s, e) {
|
|
|
4488
4603
|
function Et(s) {
|
|
4489
4604
|
return Ot(s).length;
|
|
4490
4605
|
}
|
|
4491
|
-
const Tn = /* @__PURE__ */ new Set([...
|
|
4606
|
+
const Tn = /* @__PURE__ */ new Set([...nt]), B = {
|
|
4492
4607
|
core: "core",
|
|
4493
4608
|
noRuntime: "no-runtime",
|
|
4494
4609
|
noTargetContext: "no-target-context",
|
|
@@ -4504,7 +4619,7 @@ class vn {
|
|
|
4504
4619
|
this.registry = e.registry, this.targetRepoVersionIndexes = e.targetRepoVersionIndexes, this.fallbackToCurrentInlineDefinitions = e.fallbackToCurrentInlineDefinitions;
|
|
4505
4620
|
}
|
|
4506
4621
|
transform(e) {
|
|
4507
|
-
return
|
|
4622
|
+
return w.transform(
|
|
4508
4623
|
e,
|
|
4509
4624
|
(t) => this.transformNode(t)
|
|
4510
4625
|
);
|
|
@@ -4534,11 +4649,11 @@ class vn {
|
|
|
4534
4649
|
return;
|
|
4535
4650
|
const i = this.resolveType(n);
|
|
4536
4651
|
switch (i.kind) {
|
|
4537
|
-
case
|
|
4652
|
+
case B.core: {
|
|
4538
4653
|
r.setBlueId(i.blueId);
|
|
4539
4654
|
return;
|
|
4540
4655
|
}
|
|
4541
|
-
case
|
|
4656
|
+
case B.representable: {
|
|
4542
4657
|
this.applyDropPointers([r], i.dropPointers, {
|
|
4543
4658
|
rootIsSchema: !0
|
|
4544
4659
|
}), this.applyDropPointers(
|
|
@@ -4547,34 +4662,34 @@ class vn {
|
|
|
4547
4662
|
), r.setBlueId(i.targetBlueId);
|
|
4548
4663
|
return;
|
|
4549
4664
|
}
|
|
4550
|
-
case
|
|
4551
|
-
case
|
|
4552
|
-
case
|
|
4665
|
+
case B.noRuntime:
|
|
4666
|
+
case B.noTargetContext:
|
|
4667
|
+
case B.unrepresentable: {
|
|
4553
4668
|
if (this.fallbackToCurrentInlineDefinitions) {
|
|
4554
4669
|
this.inlineDefinition(e, t.setter, n);
|
|
4555
4670
|
return;
|
|
4556
4671
|
}
|
|
4557
|
-
throw i.kind ===
|
|
4672
|
+
throw i.kind === B.unrepresentable ? i.error : this.unrepresentableError(
|
|
4558
4673
|
n,
|
|
4559
|
-
i.kind ===
|
|
4560
|
-
i.kind ===
|
|
4561
|
-
i.kind ===
|
|
4674
|
+
i.kind === B.noTargetContext ? `Repository '${i.runtimeName}' not provided in BlueContext.` : "Type does not belong to any declared repository.",
|
|
4675
|
+
i.kind === B.noTargetContext ? i.runtime : void 0,
|
|
4676
|
+
i.kind === B.noTargetContext ? i.meta : void 0,
|
|
4562
4677
|
void 0,
|
|
4563
|
-
i.kind ===
|
|
4678
|
+
i.kind === B.noTargetContext ? i.typeAlias : void 0
|
|
4564
4679
|
);
|
|
4565
4680
|
}
|
|
4566
4681
|
}
|
|
4567
4682
|
}
|
|
4568
4683
|
resolveType(e) {
|
|
4569
4684
|
if (X.includes(e))
|
|
4570
|
-
return { kind:
|
|
4685
|
+
return { kind: B.core, blueId: e };
|
|
4571
4686
|
const t = this.registry.toCurrentBlueId(e), r = this.registry.getTypeAlias(t), n = this.registry.findRuntimeByBlueId(t);
|
|
4572
4687
|
if (!n || !n.typeMeta)
|
|
4573
|
-
return { kind:
|
|
4688
|
+
return { kind: B.noRuntime };
|
|
4574
4689
|
const i = this.targetRepoVersionIndexes[n.runtime.name];
|
|
4575
4690
|
if (i === void 0)
|
|
4576
4691
|
return {
|
|
4577
|
-
kind:
|
|
4692
|
+
kind: B.noTargetContext,
|
|
4578
4693
|
currentBlueId: t,
|
|
4579
4694
|
runtimeName: n.runtime.name,
|
|
4580
4695
|
runtime: n.runtime,
|
|
@@ -4582,11 +4697,11 @@ class vn {
|
|
|
4582
4697
|
typeAlias: r
|
|
4583
4698
|
};
|
|
4584
4699
|
const o = n.typeMeta;
|
|
4585
|
-
if (o.status ===
|
|
4586
|
-
const
|
|
4587
|
-
if (i !==
|
|
4700
|
+
if (o.status === st) {
|
|
4701
|
+
const p = n.runtime.repositoryVersions.length - 1;
|
|
4702
|
+
if (i !== p)
|
|
4588
4703
|
return {
|
|
4589
|
-
kind:
|
|
4704
|
+
kind: B.unrepresentable,
|
|
4590
4705
|
currentBlueId: t,
|
|
4591
4706
|
error: this.unrepresentableError(
|
|
4592
4707
|
t,
|
|
@@ -4599,7 +4714,7 @@ class vn {
|
|
|
4599
4714
|
};
|
|
4600
4715
|
const f = o.versions?.[0];
|
|
4601
4716
|
return {
|
|
4602
|
-
kind:
|
|
4717
|
+
kind: B.representable,
|
|
4603
4718
|
currentBlueId: t,
|
|
4604
4719
|
targetBlueId: f?.typeBlueId ?? t,
|
|
4605
4720
|
dropPointers: []
|
|
@@ -4608,7 +4723,7 @@ class vn {
|
|
|
4608
4723
|
const l = o.versions || [];
|
|
4609
4724
|
if (l.length === 0)
|
|
4610
4725
|
return {
|
|
4611
|
-
kind:
|
|
4726
|
+
kind: B.unrepresentable,
|
|
4612
4727
|
currentBlueId: t,
|
|
4613
4728
|
error: this.unrepresentableError(
|
|
4614
4729
|
t,
|
|
@@ -4622,7 +4737,7 @@ class vn {
|
|
|
4622
4737
|
const a = l[0].repositoryVersionIndex;
|
|
4623
4738
|
if (i < a)
|
|
4624
4739
|
return {
|
|
4625
|
-
kind:
|
|
4740
|
+
kind: B.unrepresentable,
|
|
4626
4741
|
currentBlueId: t,
|
|
4627
4742
|
error: this.unrepresentableError(
|
|
4628
4743
|
t,
|
|
@@ -4634,11 +4749,11 @@ class vn {
|
|
|
4634
4749
|
)
|
|
4635
4750
|
};
|
|
4636
4751
|
let u = l[0].typeBlueId;
|
|
4637
|
-
for (const
|
|
4638
|
-
|
|
4752
|
+
for (const p of l)
|
|
4753
|
+
p.repositoryVersionIndex <= i && (u = p.typeBlueId);
|
|
4639
4754
|
const y = o.status === ae ? this.getDropPointers(o, i) : [];
|
|
4640
4755
|
return {
|
|
4641
|
-
kind:
|
|
4756
|
+
kind: B.representable,
|
|
4642
4757
|
currentBlueId: t,
|
|
4643
4758
|
targetBlueId: u,
|
|
4644
4759
|
dropPointers: y
|
|
@@ -4731,7 +4846,7 @@ class vn {
|
|
|
4731
4846
|
try {
|
|
4732
4847
|
const o = g.deserialize(i);
|
|
4733
4848
|
o.setBlueId(void 0);
|
|
4734
|
-
const l =
|
|
4849
|
+
const l = w.transform(
|
|
4735
4850
|
o,
|
|
4736
4851
|
(a) => this.transformNode(a)
|
|
4737
4852
|
);
|
|
@@ -4742,9 +4857,9 @@ class vn {
|
|
|
4742
4857
|
}
|
|
4743
4858
|
invalidPointerError(e) {
|
|
4744
4859
|
const t = `Invalid attributesAdded pointer '${e}'.`;
|
|
4745
|
-
return new
|
|
4860
|
+
return new Oe(M.INVALID_REPOSITORY_POINTER, t, [
|
|
4746
4861
|
{
|
|
4747
|
-
code:
|
|
4862
|
+
code: M.INVALID_REPOSITORY_POINTER,
|
|
4748
4863
|
message: t,
|
|
4749
4864
|
locationPath: [],
|
|
4750
4865
|
context: { pointer: e }
|
|
@@ -4763,20 +4878,20 @@ class vn {
|
|
|
4763
4878
|
y !== void 0 && (a.typeIntroducedInRepoBlueId = r?.repositoryVersions[y]);
|
|
4764
4879
|
}
|
|
4765
4880
|
const u = {
|
|
4766
|
-
code:
|
|
4881
|
+
code: M.REPO_UNREPRESENTABLE_IN_TARGET_VERSION,
|
|
4767
4882
|
message: t,
|
|
4768
4883
|
locationPath: [W],
|
|
4769
4884
|
context: a
|
|
4770
4885
|
};
|
|
4771
|
-
return new
|
|
4772
|
-
|
|
4886
|
+
return new Oe(
|
|
4887
|
+
M.REPO_UNREPRESENTABLE_IN_TARGET_VERSION,
|
|
4773
4888
|
t,
|
|
4774
4889
|
[u]
|
|
4775
4890
|
);
|
|
4776
4891
|
}
|
|
4777
4892
|
}
|
|
4778
|
-
function
|
|
4779
|
-
return e ?
|
|
4893
|
+
function Qe(s, e) {
|
|
4894
|
+
return e ? w.transform(s, (t) => (ve(
|
|
4780
4895
|
() => t.getType(),
|
|
4781
4896
|
(r) => t.setType(r),
|
|
4782
4897
|
e
|
|
@@ -4804,7 +4919,7 @@ function ve(s, e, t) {
|
|
|
4804
4919
|
const i = t.toCurrentBlueId(n);
|
|
4805
4920
|
i !== n && e(r.clone().setBlueId(i));
|
|
4806
4921
|
}
|
|
4807
|
-
class
|
|
4922
|
+
class Bn {
|
|
4808
4923
|
registry;
|
|
4809
4924
|
blueIdMapper;
|
|
4810
4925
|
constructor(e) {
|
|
@@ -4814,7 +4929,7 @@ class bn {
|
|
|
4814
4929
|
const r = this.computeTargetRepoVersionIndexes(t);
|
|
4815
4930
|
if (Object.keys(r).length === 0)
|
|
4816
4931
|
return e;
|
|
4817
|
-
const n =
|
|
4932
|
+
const n = Qe(e, this.blueIdMapper);
|
|
4818
4933
|
return new vn({
|
|
4819
4934
|
registry: this.registry,
|
|
4820
4935
|
targetRepoVersionIndexes: r,
|
|
@@ -4843,7 +4958,7 @@ class bn {
|
|
|
4843
4958
|
}
|
|
4844
4959
|
unknownRepoBlueIdError(e, t, r) {
|
|
4845
4960
|
const n = `Unknown RepoBlueId '${t}' for repository '${e}'.`, i = {
|
|
4846
|
-
code:
|
|
4961
|
+
code: M.REPO_UNKNOWN_REPO_BLUE_ID,
|
|
4847
4962
|
message: n,
|
|
4848
4963
|
locationPath: [],
|
|
4849
4964
|
context: {
|
|
@@ -4852,7 +4967,7 @@ class bn {
|
|
|
4852
4967
|
serverRepoBlueId: r
|
|
4853
4968
|
}
|
|
4854
4969
|
};
|
|
4855
|
-
return new
|
|
4970
|
+
return new Oe(M.REPO_UNKNOWN_REPO_BLUE_ID, n, [
|
|
4856
4971
|
i
|
|
4857
4972
|
]);
|
|
4858
4973
|
}
|
|
@@ -4876,11 +4991,11 @@ class ri {
|
|
|
4876
4991
|
repositories: i,
|
|
4877
4992
|
mergingProcessor: o
|
|
4878
4993
|
} = e;
|
|
4879
|
-
this.repositories = i, this.repositoryRegistry = new qs(i ?? []), this.blueContextResolver = new
|
|
4994
|
+
this.repositories = i, this.repositoryRegistry = new qs(i ?? []), this.blueContextResolver = new Bn({
|
|
4880
4995
|
registry: this.repositoryRegistry,
|
|
4881
4996
|
blueIdMapper: this.repositoryRegistry
|
|
4882
4997
|
});
|
|
4883
|
-
const l =
|
|
4998
|
+
const l = Ns(() => []);
|
|
4884
4999
|
this.nodeProvider = he.wrap(
|
|
4885
5000
|
t || l,
|
|
4886
5001
|
i
|
|
@@ -4904,7 +5019,7 @@ class ri {
|
|
|
4904
5019
|
*/
|
|
4905
5020
|
nodeToJson(e, t = "official") {
|
|
4906
5021
|
const r = this.normalizeNodeToJsonOptions(t), n = r.blueContext ? this.blueContextResolver.transform(e, r.blueContext) : e;
|
|
4907
|
-
return
|
|
5022
|
+
return I.get(n, r.format);
|
|
4908
5023
|
}
|
|
4909
5024
|
/**
|
|
4910
5025
|
* Converts a BlueNode to a deterministic YAML string. Uses nodeToJson under the hood
|
|
@@ -4915,7 +5030,7 @@ class ri {
|
|
|
4915
5030
|
return Os.get(n, { strategy: r.format });
|
|
4916
5031
|
}
|
|
4917
5032
|
nodeToSchemaOutput(e, t) {
|
|
4918
|
-
return new
|
|
5033
|
+
return new Ps(this.typeSchemaResolver).convert(e, t);
|
|
4919
5034
|
}
|
|
4920
5035
|
resolve(e, t = K) {
|
|
4921
5036
|
const r = this.combineWithGlobalLimits(t);
|
|
@@ -4954,13 +5069,13 @@ class ri {
|
|
|
4954
5069
|
}
|
|
4955
5070
|
jsonValueToNode(e) {
|
|
4956
5071
|
const t = this.preprocess(g.deserialize(e));
|
|
4957
|
-
return
|
|
5072
|
+
return Qe(t, this.repositoryRegistry);
|
|
4958
5073
|
}
|
|
4959
5074
|
async jsonValueToNodeAsync(e) {
|
|
4960
5075
|
const t = await this.preprocessAsync(
|
|
4961
5076
|
g.deserialize(e)
|
|
4962
5077
|
);
|
|
4963
|
-
return
|
|
5078
|
+
return Qe(t, this.repositoryRegistry);
|
|
4964
5079
|
}
|
|
4965
5080
|
yamlToNode(e) {
|
|
4966
5081
|
const t = $(e);
|
|
@@ -4986,6 +5101,21 @@ class ri {
|
|
|
4986
5101
|
const t = this.prepareForBlueIdCalculationSync(e);
|
|
4987
5102
|
return T.calculateBlueIdSync(t);
|
|
4988
5103
|
}
|
|
5104
|
+
/**
|
|
5105
|
+
* Resolves a type alias by BlueId.
|
|
5106
|
+
*
|
|
5107
|
+
* For core types this returns inline aliases such as `Text`.
|
|
5108
|
+
* For repository-backed types this resolves historical BlueIds to current aliases
|
|
5109
|
+
* and returns values in `Package/Type` format.
|
|
5110
|
+
*
|
|
5111
|
+
* @param blueId - Type BlueId to resolve.
|
|
5112
|
+
* @returns The resolved type alias or `undefined` when the input is empty or unknown.
|
|
5113
|
+
*/
|
|
5114
|
+
getTypeAliasByBlueId(e) {
|
|
5115
|
+
const t = e?.trim();
|
|
5116
|
+
if (t)
|
|
5117
|
+
return this.repositoryRegistry.getTypeAlias(t);
|
|
5118
|
+
}
|
|
4989
5119
|
addPreprocessingAliases(e) {
|
|
4990
5120
|
this.blueDirectivePreprocessor.addPreprocessingAliases(e);
|
|
4991
5121
|
}
|
|
@@ -5004,7 +5134,7 @@ class ri {
|
|
|
5004
5134
|
}).preprocessWithDefaultBlue(t);
|
|
5005
5135
|
}
|
|
5006
5136
|
transform(e, t) {
|
|
5007
|
-
return
|
|
5137
|
+
return w.transform(e, t);
|
|
5008
5138
|
}
|
|
5009
5139
|
getNodeProvider() {
|
|
5010
5140
|
return this.nodeProvider;
|
|
@@ -5154,7 +5284,7 @@ class ri {
|
|
|
5154
5284
|
if (!n)
|
|
5155
5285
|
return !1;
|
|
5156
5286
|
const i = new c().setBlueId(r);
|
|
5157
|
-
return
|
|
5287
|
+
return b(n, i, this.nodeProvider);
|
|
5158
5288
|
}
|
|
5159
5289
|
/**
|
|
5160
5290
|
* Checks if a BlueNode matches a BlueNode type.
|
|
@@ -5191,7 +5321,7 @@ class ri {
|
|
|
5191
5321
|
};
|
|
5192
5322
|
}
|
|
5193
5323
|
combineWithGlobalLimits(e) {
|
|
5194
|
-
return this.globalLimits == K ? e : e == K ? this.globalLimits :
|
|
5324
|
+
return this.globalLimits == K ? e : e == K ? this.globalLimits : je.of(this.globalLimits, e);
|
|
5195
5325
|
}
|
|
5196
5326
|
}
|
|
5197
5327
|
class si extends Qt {
|
|
@@ -5204,7 +5334,7 @@ class si extends Qt {
|
|
|
5204
5334
|
this.preprocessor = (r) => t.preprocessWithDefaultBlue(r), e.forEach((r) => this.processNode(r));
|
|
5205
5335
|
}
|
|
5206
5336
|
processNode(e) {
|
|
5207
|
-
|
|
5337
|
+
_e.hasItemsOnly(e) ? this.processNodeWithItems(e) : this.processSingleNode(e);
|
|
5208
5338
|
}
|
|
5209
5339
|
processSingleNode(e) {
|
|
5210
5340
|
const t = z.parseAndCalculateBlueIdForNode(
|
|
@@ -5232,7 +5362,7 @@ class si extends Qt {
|
|
|
5232
5362
|
});
|
|
5233
5363
|
}
|
|
5234
5364
|
processNodeList(e) {
|
|
5235
|
-
const t = T.calculateBlueIdSync(e), r = e.map((n) =>
|
|
5365
|
+
const t = T.calculateBlueIdSync(e), r = e.map((n) => I.get(n));
|
|
5236
5366
|
this.blueIdToContentMap.set(t, r), this.blueIdToMultipleDocumentsMap.set(t, !0);
|
|
5237
5367
|
}
|
|
5238
5368
|
fetchContentByBlueId(e) {
|
|
@@ -5328,30 +5458,30 @@ export {
|
|
|
5328
5458
|
kn as BlueIdToCid,
|
|
5329
5459
|
c as BlueNode,
|
|
5330
5460
|
A as BlueNodeTypeSchema,
|
|
5331
|
-
|
|
5461
|
+
Ze as JsonCanonicalizer,
|
|
5332
5462
|
pt as Limits,
|
|
5333
5463
|
Ws as Merger,
|
|
5334
5464
|
ti as MergingProcessors,
|
|
5335
5465
|
Js as NodeResolver,
|
|
5336
|
-
|
|
5466
|
+
_e as Nodes,
|
|
5337
5467
|
On as Properties,
|
|
5338
5468
|
ne as ResolvedBlueNode,
|
|
5339
5469
|
ds as TypeSchemaResolver,
|
|
5340
5470
|
Kn as applyBlueNodePatch,
|
|
5341
|
-
|
|
5471
|
+
$e as baseBlueObjectSchema,
|
|
5342
5472
|
Yn as blueDescriptionField,
|
|
5343
5473
|
zn as blueIdField,
|
|
5344
|
-
|
|
5474
|
+
Mn as blueIdSchema,
|
|
5345
5475
|
Gn as blueNameField,
|
|
5346
5476
|
Jn as blueNodeField,
|
|
5347
5477
|
Fn as blueObjectBooleanValueSchema,
|
|
5348
5478
|
xn as blueObjectNumberValueSchema,
|
|
5349
5479
|
de as blueObjectSchema,
|
|
5350
5480
|
$n as blueObjectStringListItemsSchema,
|
|
5351
|
-
|
|
5352
|
-
|
|
5481
|
+
Dn as blueObjectStringValueSchema,
|
|
5482
|
+
js as calculateBlueId,
|
|
5353
5483
|
Zn as calculateBlueIdSync,
|
|
5354
|
-
|
|
5484
|
+
Bt as enrichWithBlueId,
|
|
5355
5485
|
Wr as getBlueDescriptionAnnotation,
|
|
5356
5486
|
Xr as getBlueIdAnnotation,
|
|
5357
5487
|
Qr as getBlueNameAnnotation,
|
|
@@ -5361,25 +5491,25 @@ export {
|
|
|
5361
5491
|
Qn as getBlueObjectTypeLabel,
|
|
5362
5492
|
Xn as getBlueObjectValue,
|
|
5363
5493
|
ss as getTypeBlueIdAnnotation,
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5494
|
+
Pr as hasBlueObjectBlueIdDefined,
|
|
5495
|
+
Nr as hasBlueObjectItemsDefined,
|
|
5496
|
+
Ln as hasBlueObjectNameDefined,
|
|
5367
5497
|
Sr as hasBlueObjectTypeDefined,
|
|
5368
5498
|
Cr as hasBlueObjectValueDefined,
|
|
5369
|
-
|
|
5499
|
+
We as isBigDecimalNumber,
|
|
5370
5500
|
Z as isBigIntegerNumber,
|
|
5371
5501
|
C as isBigNumber,
|
|
5372
5502
|
Gt as isBlueNodeSchema,
|
|
5373
5503
|
_n as isBlueObject,
|
|
5374
5504
|
Us as isBlueObjectResolved,
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5505
|
+
jn as isGivenBlueObjectTypeSchema,
|
|
5506
|
+
jt as isJsonBlueArray,
|
|
5507
|
+
Lt as isJsonBlueObject,
|
|
5378
5508
|
Un as isJsonBlueValue,
|
|
5379
|
-
|
|
5380
|
-
|
|
5509
|
+
Ee as isUrl,
|
|
5510
|
+
Ae as jsonBlueValueSchema,
|
|
5381
5511
|
ei as normalizeToBlueObject,
|
|
5382
|
-
|
|
5512
|
+
bt as resolveBlueObjectItems,
|
|
5383
5513
|
Jr as withBlueDescription,
|
|
5384
5514
|
Hr as withBlueId,
|
|
5385
5515
|
qr as withBlueName,
|