@brightsideoy/kama 0.1.0-alpha.66 → 0.1.0-alpha.68
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/bin/cli.js +3 -0
- package/dist/assets/{index-BJPfXUUJ.js → index-Cj926Ids.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/index.js +526 -475
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -241,7 +241,7 @@ var j = {
|
|
|
241
241
|
"]": "%5D",
|
|
242
242
|
"{": "%7B",
|
|
243
243
|
"}": "%7D"
|
|
244
|
-
}, oe = (e) => e.replace(/[!,[\]{}]/g, (e) => j[e]),
|
|
244
|
+
}, oe = (e) => e.replace(/[!,[\]{}]/g, (e) => j[e]), M = class e {
|
|
245
245
|
constructor(t, n) {
|
|
246
246
|
this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({}, e.defaultYaml, t), this.tags = Object.assign({}, e.defaultTags, n);
|
|
247
247
|
}
|
|
@@ -319,37 +319,37 @@ var j = {
|
|
|
319
319
|
return t.join("\n");
|
|
320
320
|
}
|
|
321
321
|
};
|
|
322
|
-
|
|
322
|
+
M.defaultYaml = {
|
|
323
323
|
explicit: !1,
|
|
324
324
|
version: "1.2"
|
|
325
|
-
},
|
|
325
|
+
}, M.defaultTags = { "!!": "tag:yaml.org,2002:" };
|
|
326
326
|
//#endregion
|
|
327
327
|
//#region node_modules/yaml/browser/dist/doc/anchors.js
|
|
328
|
-
function
|
|
328
|
+
function se(e) {
|
|
329
329
|
if (/[\x00-\x19\s,[\]{}]/.test(e)) {
|
|
330
330
|
let t = `Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;
|
|
331
331
|
throw Error(t);
|
|
332
332
|
}
|
|
333
333
|
return !0;
|
|
334
334
|
}
|
|
335
|
-
function
|
|
335
|
+
function ce(e) {
|
|
336
336
|
let t = /* @__PURE__ */ new Set();
|
|
337
337
|
return k(e, { Value(e, n) {
|
|
338
338
|
n.anchor && t.add(n.anchor);
|
|
339
339
|
} }), t;
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function le(e, t) {
|
|
342
342
|
for (let n = 1;; ++n) {
|
|
343
343
|
let r = `${e}${n}`;
|
|
344
344
|
if (!t.has(r)) return r;
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
function
|
|
347
|
+
function ue(e, t) {
|
|
348
348
|
let n = [], r = /* @__PURE__ */ new Map(), i = null;
|
|
349
349
|
return {
|
|
350
350
|
onAnchor: (r) => {
|
|
351
|
-
n.push(r), i ??=
|
|
352
|
-
let a =
|
|
351
|
+
n.push(r), i ??= ce(e);
|
|
352
|
+
let a = le(t, i);
|
|
353
353
|
return i.add(a), a;
|
|
354
354
|
},
|
|
355
355
|
setAnchors: () => {
|
|
@@ -409,7 +409,7 @@ function P(e, t, n) {
|
|
|
409
409
|
}
|
|
410
410
|
//#endregion
|
|
411
411
|
//#region node_modules/yaml/browser/dist/nodes/Node.js
|
|
412
|
-
var
|
|
412
|
+
var de = class {
|
|
413
413
|
constructor(e) {
|
|
414
414
|
Object.defineProperty(this, _, { value: e });
|
|
415
415
|
}
|
|
@@ -430,7 +430,7 @@ var F = class {
|
|
|
430
430
|
if (typeof r == "function") for (let { count: e, res: t } of a.anchors.values()) r(t, e);
|
|
431
431
|
return typeof i == "function" ? N(i, { "": o }, "", o) : o;
|
|
432
432
|
}
|
|
433
|
-
},
|
|
433
|
+
}, fe = class extends de {
|
|
434
434
|
constructor(e) {
|
|
435
435
|
super(d), this.source = e, Object.defineProperty(this, "tag", { set() {
|
|
436
436
|
throw Error("Alias nodes cannot have tags");
|
|
@@ -459,13 +459,13 @@ var F = class {
|
|
|
459
459
|
let o = n.get(a);
|
|
460
460
|
/* istanbul ignore if */
|
|
461
461
|
if (o ||= (P(a, null, t), n.get(a)), o?.res === void 0) throw ReferenceError("This should not happen: Alias anchor was not resolved?");
|
|
462
|
-
if (i >= 0 && (o.count += 1, o.aliasCount === 0 && (o.aliasCount =
|
|
462
|
+
if (i >= 0 && (o.count += 1, o.aliasCount === 0 && (o.aliasCount = pe(r, a, n)), o.count * o.aliasCount > i)) throw ReferenceError("Excessive alias count indicates a resource exhaustion attack");
|
|
463
463
|
return o.res;
|
|
464
464
|
}
|
|
465
465
|
toString(e, t, n) {
|
|
466
466
|
let r = `*${this.source}`;
|
|
467
467
|
if (e) {
|
|
468
|
-
if (
|
|
468
|
+
if (se(this.source), e.options.verifyAliasOrder && !e.anchors.has(this.source)) {
|
|
469
469
|
let e = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
470
470
|
throw Error(e);
|
|
471
471
|
}
|
|
@@ -474,7 +474,7 @@ var F = class {
|
|
|
474
474
|
return r;
|
|
475
475
|
}
|
|
476
476
|
};
|
|
477
|
-
function
|
|
477
|
+
function pe(e, t, n) {
|
|
478
478
|
if (v(t)) {
|
|
479
479
|
let r = t.resolve(e), i = n && r && n.get(r);
|
|
480
480
|
return i ? i.count * i.aliasCount : 0;
|
|
@@ -482,20 +482,20 @@ function fe(e, t, n) {
|
|
|
482
482
|
if (w(t)) {
|
|
483
483
|
let r = 0;
|
|
484
484
|
for (let i of t.items) {
|
|
485
|
-
let t =
|
|
485
|
+
let t = pe(e, i, n);
|
|
486
486
|
t > r && (r = t);
|
|
487
487
|
}
|
|
488
488
|
return r;
|
|
489
489
|
}
|
|
490
490
|
if (x(t)) {
|
|
491
|
-
let r =
|
|
491
|
+
let r = pe(e, t.key, n), i = pe(e, t.value, n);
|
|
492
492
|
return Math.max(r, i);
|
|
493
493
|
}
|
|
494
494
|
return 1;
|
|
495
495
|
}
|
|
496
496
|
//#endregion
|
|
497
497
|
//#region node_modules/yaml/browser/dist/nodes/Scalar.js
|
|
498
|
-
var
|
|
498
|
+
var me = (e) => !e || typeof e != "function" && typeof e != "object", F = class extends de {
|
|
499
499
|
constructor(e) {
|
|
500
500
|
super(h), this.value = e;
|
|
501
501
|
}
|
|
@@ -506,11 +506,11 @@ var pe = (e) => !e || typeof e != "function" && typeof e != "object", I = class
|
|
|
506
506
|
return String(this.value);
|
|
507
507
|
}
|
|
508
508
|
};
|
|
509
|
-
|
|
509
|
+
F.BLOCK_FOLDED = "BLOCK_FOLDED", F.BLOCK_LITERAL = "BLOCK_LITERAL", F.PLAIN = "PLAIN", F.QUOTE_DOUBLE = "QUOTE_DOUBLE", F.QUOTE_SINGLE = "QUOTE_SINGLE";
|
|
510
510
|
//#endregion
|
|
511
511
|
//#region node_modules/yaml/browser/dist/doc/createNode.js
|
|
512
|
-
var
|
|
513
|
-
function
|
|
512
|
+
var he = "tag:yaml.org,2002:";
|
|
513
|
+
function I(e, t, n) {
|
|
514
514
|
if (t) {
|
|
515
515
|
let e = n.filter((e) => e.tag === t), r = e.find((e) => !e.format) ?? e[0];
|
|
516
516
|
if (!r) throw Error(`Tag ${t} not found`);
|
|
@@ -518,7 +518,7 @@ function he(e, t, n) {
|
|
|
518
518
|
}
|
|
519
519
|
return n.find((t) => t.identify?.(e) && !t.format);
|
|
520
520
|
}
|
|
521
|
-
function
|
|
521
|
+
function L(e, t, n) {
|
|
522
522
|
if (y(e) && (e = e.contents), T(e)) return e;
|
|
523
523
|
if (x(e)) {
|
|
524
524
|
let t = n.schema[p].createNode?.(n.schema, null, n);
|
|
@@ -527,28 +527,28 @@ function ge(e, t, n) {
|
|
|
527
527
|
(e instanceof String || e instanceof Number || e instanceof Boolean || typeof BigInt < "u" && e instanceof BigInt) && (e = e.valueOf());
|
|
528
528
|
let { aliasDuplicateObjects: r, onAnchor: i, onTagObj: a, schema: o, sourceObjects: s } = n, c;
|
|
529
529
|
if (r && e && typeof e == "object") {
|
|
530
|
-
if (c = s.get(e), c) return c.anchor ?? (c.anchor = i(e)), new
|
|
530
|
+
if (c = s.get(e), c) return c.anchor ?? (c.anchor = i(e)), new fe(c.anchor);
|
|
531
531
|
c = {
|
|
532
532
|
anchor: null,
|
|
533
533
|
node: null
|
|
534
534
|
}, s.set(e, c);
|
|
535
535
|
}
|
|
536
|
-
t?.startsWith("!!") && (t =
|
|
537
|
-
let l =
|
|
536
|
+
t?.startsWith("!!") && (t = he + t.slice(2));
|
|
537
|
+
let l = I(e, t, o.tags);
|
|
538
538
|
if (!l) {
|
|
539
539
|
if (e && typeof e.toJSON == "function" && (e = e.toJSON()), !e || typeof e != "object") {
|
|
540
|
-
let t = new
|
|
540
|
+
let t = new F(e);
|
|
541
541
|
return c && (c.node = t), t;
|
|
542
542
|
}
|
|
543
543
|
l = e instanceof Map ? o[p] : Symbol.iterator in Object(e) ? o[g] : o[p];
|
|
544
544
|
}
|
|
545
545
|
a && (a(l), delete n.onTagObj);
|
|
546
|
-
let u = l?.createNode ? l.createNode(n.schema, e, n) : typeof l?.nodeClass?.from == "function" ? l.nodeClass.from(n.schema, e, n) : new
|
|
546
|
+
let u = l?.createNode ? l.createNode(n.schema, e, n) : typeof l?.nodeClass?.from == "function" ? l.nodeClass.from(n.schema, e, n) : new F(e);
|
|
547
547
|
return t ? u.tag = t : l.default || (u.tag = l.tag), c && (c.node = u), u;
|
|
548
548
|
}
|
|
549
549
|
//#endregion
|
|
550
550
|
//#region node_modules/yaml/browser/dist/nodes/Collection.js
|
|
551
|
-
function
|
|
551
|
+
function ge(e, t, n) {
|
|
552
552
|
let r = n;
|
|
553
553
|
for (let e = t.length - 1; e >= 0; --e) {
|
|
554
554
|
let n = t[e];
|
|
@@ -557,7 +557,7 @@ function _e(e, t, n) {
|
|
|
557
557
|
e[n] = r, r = e;
|
|
558
558
|
} else r = /* @__PURE__ */ new Map([[n, r]]);
|
|
559
559
|
}
|
|
560
|
-
return
|
|
560
|
+
return L(r, void 0, {
|
|
561
561
|
aliasDuplicateObjects: !1,
|
|
562
562
|
keepUndefined: !1,
|
|
563
563
|
onAnchor: () => {
|
|
@@ -567,7 +567,7 @@ function _e(e, t, n) {
|
|
|
567
567
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
568
568
|
});
|
|
569
569
|
}
|
|
570
|
-
var
|
|
570
|
+
var _e = (e) => e == null || typeof e == "object" && !!e[Symbol.iterator]().next().done, ve = class extends de {
|
|
571
571
|
constructor(e, t) {
|
|
572
572
|
super(e), Object.defineProperty(this, "schema", {
|
|
573
573
|
value: t,
|
|
@@ -581,11 +581,11 @@ var ve = (e) => e == null || typeof e == "object" && !!e[Symbol.iterator]().next
|
|
|
581
581
|
return e && (t.schema = e), t.items = t.items.map((t) => T(t) || x(t) ? t.clone(e) : t), this.range && (t.range = this.range.slice()), t;
|
|
582
582
|
}
|
|
583
583
|
addIn(e, t) {
|
|
584
|
-
if (
|
|
584
|
+
if (_e(e)) this.add(t);
|
|
585
585
|
else {
|
|
586
586
|
let [n, ...r] = e, i = this.get(n, !0);
|
|
587
587
|
if (w(i)) i.addIn(r, t);
|
|
588
|
-
else if (i === void 0 && this.schema) this.set(n,
|
|
588
|
+
else if (i === void 0 && this.schema) this.set(n, ge(this.schema, r, t));
|
|
589
589
|
else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`);
|
|
590
590
|
}
|
|
591
591
|
}
|
|
@@ -619,16 +619,16 @@ var ve = (e) => e == null || typeof e == "object" && !!e[Symbol.iterator]().next
|
|
|
619
619
|
else {
|
|
620
620
|
let e = this.get(n, !0);
|
|
621
621
|
if (w(e)) e.setIn(r, t);
|
|
622
|
-
else if (e === void 0 && this.schema) this.set(n,
|
|
622
|
+
else if (e === void 0 && this.schema) this.set(n, ge(this.schema, r, t));
|
|
623
623
|
else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`);
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
|
-
},
|
|
627
|
-
function
|
|
626
|
+
}, ye = (e) => e.replace(/^(?!$)(?: $)?/gm, "#");
|
|
627
|
+
function R(e, t) {
|
|
628
628
|
return /^\n+$/.test(e) ? e.substring(1) : t ? e.replace(/^(?! *$)/gm, t) : e;
|
|
629
629
|
}
|
|
630
|
-
var
|
|
631
|
-
function
|
|
630
|
+
var be = (e, t, n) => e.endsWith("\n") ? R(n, t) : n.includes("\n") ? "\n" + R(n, t) : (e.endsWith(" ") ? "" : " ") + n, xe = "flow", Se = "block", Ce = "quoted";
|
|
631
|
+
function we(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentWidth: a = 20, onFold: o, onOverflow: s } = {}) {
|
|
632
632
|
if (!i || i < 0) return e;
|
|
633
633
|
i < a && (a = 0);
|
|
634
634
|
let c = Math.max(1 + a, 1 + i - t.length);
|
|
@@ -636,7 +636,7 @@ function Te(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentW
|
|
|
636
636
|
let l = [], u = {}, d = i - t.length;
|
|
637
637
|
typeof r == "number" && (r > i - Math.max(2, a) ? l.push(0) : d = i - r);
|
|
638
638
|
let f, p, m = !1, h = -1, g = -1, _ = -1;
|
|
639
|
-
n === "block" && (h =
|
|
639
|
+
n === "block" && (h = Te(e, h, t.length), h !== -1 && (d = h + c));
|
|
640
640
|
for (let r; r = e[h += 1];) {
|
|
641
641
|
if (n === "quoted" && r === "\\") {
|
|
642
642
|
switch (g = h, e[h + 1]) {
|
|
@@ -653,7 +653,7 @@ function Te(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentW
|
|
|
653
653
|
}
|
|
654
654
|
_ = h;
|
|
655
655
|
}
|
|
656
|
-
if (r === "\n") n === "block" && (h =
|
|
656
|
+
if (r === "\n") n === "block" && (h = Te(e, h, t.length)), d = h + t.length + c, f = void 0;
|
|
657
657
|
else {
|
|
658
658
|
if (r === " " && p && p !== " " && p !== "\n" && p !== " ") {
|
|
659
659
|
let t = e[h + 1];
|
|
@@ -680,7 +680,7 @@ function Te(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentW
|
|
|
680
680
|
}
|
|
681
681
|
return v;
|
|
682
682
|
}
|
|
683
|
-
function
|
|
683
|
+
function Te(e, t, n) {
|
|
684
684
|
let r = t, i = t + 1, a = e[i];
|
|
685
685
|
for (; a === " " || a === " ";) if (t < i + n) a = e[++t];
|
|
686
686
|
else {
|
|
@@ -693,12 +693,12 @@ function Ee(e, t, n) {
|
|
|
693
693
|
}
|
|
694
694
|
//#endregion
|
|
695
695
|
//#region node_modules/yaml/browser/dist/stringify/stringifyString.js
|
|
696
|
-
var
|
|
696
|
+
var Ee = (e, t) => ({
|
|
697
697
|
indentAtStart: t ? e.indent.length : e.indentAtStart,
|
|
698
698
|
lineWidth: e.options.lineWidth,
|
|
699
699
|
minContentWidth: e.options.minContentWidth
|
|
700
|
-
}),
|
|
701
|
-
function
|
|
700
|
+
}), De = (e) => /^(%|---|\.\.\.)/m.test(e);
|
|
701
|
+
function Oe(e, t, n) {
|
|
702
702
|
if (!t || t < 0) return !1;
|
|
703
703
|
let r = t - n, i = e.length;
|
|
704
704
|
if (i <= r) return !1;
|
|
@@ -708,10 +708,10 @@ function ke(e, t, n) {
|
|
|
708
708
|
}
|
|
709
709
|
return !0;
|
|
710
710
|
}
|
|
711
|
-
function
|
|
711
|
+
function ke(e, t) {
|
|
712
712
|
let n = JSON.stringify(e);
|
|
713
713
|
if (t.options.doubleQuotedAsJSON) return n;
|
|
714
|
-
let { implicitKey: r } = t, i = t.options.doubleQuotedMinMultiLineLength, a = t.indent || (
|
|
714
|
+
let { implicitKey: r } = t, i = t.options.doubleQuotedMinMultiLineLength, a = t.indent || (De(e) ? " " : ""), o = "", s = 0;
|
|
715
715
|
for (let e = 0, t = n[e]; t; t = n[++e]) if (t === " " && n[e + 1] === "\\" && n[e + 2] === "n" && (o += n.slice(s, e) + "\\ ", e += 1, s = e, t = "\\"), t === "\\") switch (n[e + 1]) {
|
|
716
716
|
case "u":
|
|
717
717
|
{
|
|
@@ -756,32 +756,32 @@ function Ae(e, t) {
|
|
|
756
756
|
break;
|
|
757
757
|
default: e += 1;
|
|
758
758
|
}
|
|
759
|
-
return o = s ? o + n.slice(s) : n, r ? o :
|
|
759
|
+
return o = s ? o + n.slice(s) : n, r ? o : we(o, a, Ce, Ee(t, !1));
|
|
760
760
|
}
|
|
761
|
-
function
|
|
762
|
-
if (t.options.singleQuote === !1 || t.implicitKey && e.includes("\n") || /[ \t]\n|\n[ \t]/.test(e)) return
|
|
763
|
-
let n = t.indent || (
|
|
764
|
-
return t.implicitKey ? r :
|
|
761
|
+
function Ae(e, t) {
|
|
762
|
+
if (t.options.singleQuote === !1 || t.implicitKey && e.includes("\n") || /[ \t]\n|\n[ \t]/.test(e)) return ke(e, t);
|
|
763
|
+
let n = t.indent || (De(e) ? " " : ""), r = "'" + e.replace(/'/g, "''").replace(/\n+/g, `$&\n${n}`) + "'";
|
|
764
|
+
return t.implicitKey ? r : we(r, n, xe, Ee(t, !1));
|
|
765
765
|
}
|
|
766
|
-
function
|
|
766
|
+
function je(e, t) {
|
|
767
767
|
let { singleQuote: n } = t.options, r;
|
|
768
|
-
if (n === !1) r =
|
|
768
|
+
if (n === !1) r = ke;
|
|
769
769
|
else {
|
|
770
770
|
let t = e.includes("\""), i = e.includes("'");
|
|
771
|
-
r = t && !i ?
|
|
771
|
+
r = t && !i ? Ae : i && !t ? ke : n ? Ae : ke;
|
|
772
772
|
}
|
|
773
773
|
return r(e, t);
|
|
774
774
|
}
|
|
775
|
-
var
|
|
775
|
+
var Me;
|
|
776
776
|
try {
|
|
777
|
-
|
|
777
|
+
Me = /* @__PURE__ */ RegExp("(^|(?<!\n))\n+(?!\n|$)", "g");
|
|
778
778
|
} catch {
|
|
779
|
-
|
|
779
|
+
Me = /\n+(?!\n|$)/g;
|
|
780
780
|
}
|
|
781
|
-
function
|
|
781
|
+
function Ne({ comment: e, type: t, value: n }, r, i, a) {
|
|
782
782
|
let { blockQuote: o, commentString: s, lineWidth: c } = r.options;
|
|
783
|
-
if (!o || /\n[\t ]+$/.test(n)) return
|
|
784
|
-
let l = r.indent || (r.forceBlockIndent ||
|
|
783
|
+
if (!o || /\n[\t ]+$/.test(n)) return je(n, r);
|
|
784
|
+
let l = r.indent || (r.forceBlockIndent || De(n) ? " " : ""), u = o === "literal" ? !0 : o === "folded" || t === F.BLOCK_FOLDED ? !1 : t === F.BLOCK_LITERAL || !Oe(n, c, l.length);
|
|
785
785
|
if (!n) return u ? "|\n" : ">\n";
|
|
786
786
|
let d, f;
|
|
787
787
|
for (f = n.length; f > 0; --f) {
|
|
@@ -789,7 +789,7 @@ function Pe({ comment: e, type: t, value: n }, r, i, a) {
|
|
|
789
789
|
if (e !== "\n" && e !== " " && e !== " ") break;
|
|
790
790
|
}
|
|
791
791
|
let p = n.substring(f), m = p.indexOf("\n");
|
|
792
|
-
m === -1 ? d = "-" : n === p || m !== p.length - 1 ? (d = "+", a && a()) : d = "", p &&= (n = n.slice(0, -p.length), p[p.length - 1] === "\n" && (p = p.slice(0, -1)), p.replace(
|
|
792
|
+
m === -1 ? d = "-" : n === p || m !== p.length - 1 ? (d = "+", a && a()) : d = "", p &&= (n = n.slice(0, -p.length), p[p.length - 1] === "\n" && (p = p.slice(0, -1)), p.replace(Me, `$&${l}`));
|
|
793
793
|
let h = !1, g, _ = -1;
|
|
794
794
|
for (g = 0; g < n.length; ++g) {
|
|
795
795
|
let e = n[g];
|
|
@@ -801,41 +801,41 @@ function Pe({ comment: e, type: t, value: n }, r, i, a) {
|
|
|
801
801
|
v &&= (n = n.substring(v.length), v.replace(/\n+/g, `$&${l}`));
|
|
802
802
|
let y = (h ? l ? "2" : "1" : "") + d;
|
|
803
803
|
if (e && (y += " " + s(e.replace(/ ?[\r\n]+/g, " ")), i && i()), !u) {
|
|
804
|
-
let e = n.replace(/\n+/g, "\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${l}`), i = !1, a =
|
|
805
|
-
o !== "folded" && t !==
|
|
804
|
+
let e = n.replace(/\n+/g, "\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${l}`), i = !1, a = Ee(r, !0);
|
|
805
|
+
o !== "folded" && t !== F.BLOCK_FOLDED && (a.onOverflow = () => {
|
|
806
806
|
i = !0;
|
|
807
807
|
});
|
|
808
|
-
let s =
|
|
808
|
+
let s = we(`${v}${e}${p}`, l, Se, a);
|
|
809
809
|
if (!i) return `>${y}\n${l}${s}`;
|
|
810
810
|
}
|
|
811
811
|
return n = n.replace(/\n+/g, `$&${l}`), `|${y}\n${l}${v}${n}${p}`;
|
|
812
812
|
}
|
|
813
|
-
function
|
|
813
|
+
function Pe(e, t, n, r) {
|
|
814
814
|
let { type: i, value: a } = e, { actualString: o, implicitKey: s, indent: c, indentStep: l, inFlow: u } = t;
|
|
815
|
-
if (s && a.includes("\n") || u && /[[\]{},]/.test(a)) return
|
|
816
|
-
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a)) return s || u || !a.includes("\n") ?
|
|
817
|
-
if (!s && !u && i !==
|
|
818
|
-
if (
|
|
819
|
-
if (c === "") return t.forceBlockIndent = !0,
|
|
820
|
-
if (s && c === l) return
|
|
815
|
+
if (s && a.includes("\n") || u && /[[\]{},]/.test(a)) return je(a, t);
|
|
816
|
+
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a)) return s || u || !a.includes("\n") ? je(a, t) : Ne(e, t, n, r);
|
|
817
|
+
if (!s && !u && i !== F.PLAIN && a.includes("\n")) return Ne(e, t, n, r);
|
|
818
|
+
if (De(a)) {
|
|
819
|
+
if (c === "") return t.forceBlockIndent = !0, Ne(e, t, n, r);
|
|
820
|
+
if (s && c === l) return je(a, t);
|
|
821
821
|
}
|
|
822
822
|
let d = a.replace(/\n+/g, `$&\n${c}`);
|
|
823
823
|
if (o) {
|
|
824
824
|
let e = (e) => e.default && e.tag !== "tag:yaml.org,2002:str" && e.test?.test(d), { compat: n, tags: r } = t.doc.schema;
|
|
825
|
-
if (r.some(e) || n?.some(e)) return
|
|
825
|
+
if (r.some(e) || n?.some(e)) return je(a, t);
|
|
826
826
|
}
|
|
827
|
-
return s ? d :
|
|
827
|
+
return s ? d : we(d, c, xe, Ee(t, !1));
|
|
828
828
|
}
|
|
829
|
-
function
|
|
829
|
+
function Fe(e, t, n, r) {
|
|
830
830
|
let { implicitKey: i, inFlow: a } = t, o = typeof e.value == "string" ? e : Object.assign({}, e, { value: String(e.value) }), { type: s } = e;
|
|
831
|
-
s !==
|
|
831
|
+
s !== F.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (s = F.QUOTE_DOUBLE);
|
|
832
832
|
let c = (e) => {
|
|
833
833
|
switch (e) {
|
|
834
|
-
case
|
|
835
|
-
case
|
|
836
|
-
case
|
|
837
|
-
case
|
|
838
|
-
case
|
|
834
|
+
case F.BLOCK_FOLDED:
|
|
835
|
+
case F.BLOCK_LITERAL: return i || a ? je(o.value, t) : Ne(o, t, n, r);
|
|
836
|
+
case F.QUOTE_DOUBLE: return ke(o.value, t);
|
|
837
|
+
case F.QUOTE_SINGLE: return Ae(o.value, t);
|
|
838
|
+
case F.PLAIN: return Pe(o, t, n, r);
|
|
839
839
|
default: return null;
|
|
840
840
|
}
|
|
841
841
|
}, l = c(s);
|
|
@@ -847,10 +847,10 @@ function Ie(e, t, n, r) {
|
|
|
847
847
|
}
|
|
848
848
|
//#endregion
|
|
849
849
|
//#region node_modules/yaml/browser/dist/stringify/stringify.js
|
|
850
|
-
function
|
|
850
|
+
function Ie(e, t) {
|
|
851
851
|
let n = Object.assign({
|
|
852
852
|
blockQuote: !0,
|
|
853
|
-
commentString:
|
|
853
|
+
commentString: ye,
|
|
854
854
|
defaultKeyType: null,
|
|
855
855
|
defaultStringType: "PLAIN",
|
|
856
856
|
directives: null,
|
|
@@ -887,7 +887,7 @@ function Le(e, t) {
|
|
|
887
887
|
options: n
|
|
888
888
|
};
|
|
889
889
|
}
|
|
890
|
-
function
|
|
890
|
+
function Le(e, t) {
|
|
891
891
|
if (t.tag) {
|
|
892
892
|
let n = e.filter((e) => e.tag === t.tag);
|
|
893
893
|
if (n.length > 0) return n.find((e) => e.format === t.format) ?? n[0];
|
|
@@ -908,14 +908,14 @@ function Re(e, t) {
|
|
|
908
908
|
}
|
|
909
909
|
return n;
|
|
910
910
|
}
|
|
911
|
-
function
|
|
911
|
+
function Re(e, t, { anchors: n, doc: r }) {
|
|
912
912
|
if (!r.directives) return "";
|
|
913
913
|
let i = [], a = (S(e) || w(e)) && e.anchor;
|
|
914
|
-
a &&
|
|
914
|
+
a && se(a) && (n.add(a), i.push(`&${a}`));
|
|
915
915
|
let o = e.tag ?? (t.default ? null : t.tag);
|
|
916
916
|
return o && i.push(r.directives.tagString(o)), i.join(" ");
|
|
917
917
|
}
|
|
918
|
-
function
|
|
918
|
+
function ze(e, t, n, r) {
|
|
919
919
|
if (x(e)) return e.toString(t, n, r);
|
|
920
920
|
if (v(e)) {
|
|
921
921
|
if (t.doc.directives) return e.toString(t);
|
|
@@ -923,42 +923,42 @@ function Be(e, t, n, r) {
|
|
|
923
923
|
t.resolvedAliases ? t.resolvedAliases.add(e) : t.resolvedAliases = /* @__PURE__ */ new Set([e]), e = e.resolve(t.doc);
|
|
924
924
|
}
|
|
925
925
|
let i, a = T(e) ? e : t.doc.createNode(e, { onTagObj: (e) => i = e });
|
|
926
|
-
i ??=
|
|
927
|
-
let o =
|
|
926
|
+
i ??= Le(t.doc.schema.tags, a);
|
|
927
|
+
let o = Re(a, i, t);
|
|
928
928
|
o.length > 0 && (t.indentAtStart = (t.indentAtStart ?? 0) + o.length + 1);
|
|
929
|
-
let s = typeof i.stringify == "function" ? i.stringify(a, t, n, r) : S(a) ?
|
|
929
|
+
let s = typeof i.stringify == "function" ? i.stringify(a, t, n, r) : S(a) ? Fe(a, t, n, r) : a.toString(t, n, r);
|
|
930
930
|
return o ? S(a) || s[0] === "{" || s[0] === "[" ? `${o} ${s}` : `${o}\n${t.indent}${s}` : s;
|
|
931
931
|
}
|
|
932
932
|
//#endregion
|
|
933
933
|
//#region node_modules/yaml/browser/dist/stringify/stringifyPair.js
|
|
934
|
-
function
|
|
934
|
+
function Be({ key: e, value: t }, n, r, i) {
|
|
935
935
|
let { allNullValues: a, doc: o, indent: s, indentStep: c, options: { commentString: l, indentSeq: u, simpleKeys: d } } = n, f = T(e) && e.comment || null;
|
|
936
936
|
if (d) {
|
|
937
937
|
if (f) throw Error("With simple keys, key nodes cannot have comments");
|
|
938
938
|
if (w(e) || !T(e) && typeof e == "object") throw Error("With simple keys, collection cannot be used as a key value");
|
|
939
939
|
}
|
|
940
|
-
let p = !d && (!e || f && t == null && !n.inFlow || w(e) || (S(e) ? e.type ===
|
|
940
|
+
let p = !d && (!e || f && t == null && !n.inFlow || w(e) || (S(e) ? e.type === F.BLOCK_FOLDED || e.type === F.BLOCK_LITERAL : typeof e == "object"));
|
|
941
941
|
n = Object.assign({}, n, {
|
|
942
942
|
allNullValues: !1,
|
|
943
943
|
implicitKey: !p && (d || !a),
|
|
944
944
|
indent: s + c
|
|
945
945
|
});
|
|
946
|
-
let m = !1, h = !1, g =
|
|
946
|
+
let m = !1, h = !1, g = ze(e, n, () => m = !0, () => h = !0);
|
|
947
947
|
if (!p && !n.inFlow && g.length > 1024) {
|
|
948
948
|
if (d) throw Error("With simple keys, single line scalar must not span more than 1024 characters");
|
|
949
949
|
p = !0;
|
|
950
950
|
}
|
|
951
951
|
if (n.inFlow) {
|
|
952
952
|
if (a || t == null) return m && r && r(), g === "" ? "?" : p ? `? ${g}` : g;
|
|
953
|
-
} else if (a && !d || t == null && p) return g = `? ${g}`, f && !m ? g +=
|
|
954
|
-
m && (f = null), p ? (f && (g +=
|
|
953
|
+
} else if (a && !d || t == null && p) return g = `? ${g}`, f && !m ? g += be(g, n.indent, l(f)) : h && i && i(), g;
|
|
954
|
+
m && (f = null), p ? (f && (g += be(g, n.indent, l(f))), g = `? ${g}\n${s}:`) : (g = `${g}:`, f && (g += be(g, n.indent, l(f))));
|
|
955
955
|
let _, v, y;
|
|
956
956
|
T(t) ? (_ = !!t.spaceBefore, v = t.commentBefore, y = t.comment) : (_ = !1, v = null, y = null, t && typeof t == "object" && (t = o.createNode(t))), n.implicitKey = !1, !p && !f && S(t) && (n.indentAtStart = g.length + 1), h = !1, !u && c.length >= 2 && !n.inFlow && !p && C(t) && !t.flow && !t.tag && !t.anchor && (n.indent = n.indent.substring(2));
|
|
957
|
-
let b = !1, x =
|
|
957
|
+
let b = !1, x = ze(t, n, () => b = !0, () => h = !0), E = " ";
|
|
958
958
|
if (f || _ || v) {
|
|
959
959
|
if (E = _ ? "\n" : "", v) {
|
|
960
960
|
let e = l(v);
|
|
961
|
-
E += `\n${
|
|
961
|
+
E += `\n${R(e, n.indent)}`;
|
|
962
962
|
}
|
|
963
963
|
x === "" && !n.inFlow ? E === "\n" && y && (E = "\n\n") : E += `\n${n.indent}`;
|
|
964
964
|
} else if (!p && w(t)) {
|
|
@@ -972,31 +972,31 @@ function Ve({ key: e, value: t }, n, r, i) {
|
|
|
972
972
|
t || (E = `\n${n.indent}`);
|
|
973
973
|
}
|
|
974
974
|
} else (x === "" || x[0] === "\n") && (E = "");
|
|
975
|
-
return g += E + x, n.inFlow ? b && r && r() : y && !b ? g +=
|
|
975
|
+
return g += E + x, n.inFlow ? b && r && r() : y && !b ? g += be(g, n.indent, l(y)) : h && i && i(), g;
|
|
976
976
|
}
|
|
977
977
|
//#endregion
|
|
978
978
|
//#region node_modules/yaml/browser/dist/log.js
|
|
979
|
-
function
|
|
979
|
+
function Ve(e, t) {
|
|
980
980
|
(e === "debug" || e === "warn") && console.warn(t);
|
|
981
981
|
}
|
|
982
982
|
//#endregion
|
|
983
983
|
//#region node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js
|
|
984
|
-
var
|
|
985
|
-
identify: (e) => e ===
|
|
984
|
+
var He = "<<", z = {
|
|
985
|
+
identify: (e) => e === He || typeof e == "symbol" && e.description === He,
|
|
986
986
|
default: "key",
|
|
987
987
|
tag: "tag:yaml.org,2002:merge",
|
|
988
988
|
test: /^<<$/,
|
|
989
|
-
resolve: () => Object.assign(new
|
|
990
|
-
stringify: () =>
|
|
991
|
-
},
|
|
992
|
-
function
|
|
993
|
-
let r =
|
|
994
|
-
if (C(r)) for (let n of r.items)
|
|
995
|
-
else if (Array.isArray(r)) for (let n of r)
|
|
996
|
-
else
|
|
989
|
+
resolve: () => Object.assign(new F(Symbol(He)), { addToJSMap: We }),
|
|
990
|
+
stringify: () => He
|
|
991
|
+
}, Ue = (e, t) => (z.identify(t) || S(t) && (!t.type || t.type === F.PLAIN) && z.identify(t.value)) && e?.doc.schema.tags.some((e) => e.tag === z.tag && e.default);
|
|
992
|
+
function We(e, t, n) {
|
|
993
|
+
let r = Ke(e, n);
|
|
994
|
+
if (C(r)) for (let n of r.items) Ge(e, t, n);
|
|
995
|
+
else if (Array.isArray(r)) for (let n of r) Ge(e, t, n);
|
|
996
|
+
else Ge(e, t, r);
|
|
997
997
|
}
|
|
998
|
-
function
|
|
999
|
-
let r =
|
|
998
|
+
function Ge(e, t, n) {
|
|
999
|
+
let r = Ke(e, n);
|
|
1000
1000
|
if (!b(r)) throw Error("Merge sources must be maps or map aliases");
|
|
1001
1001
|
let i = r.toJSON(null, e, Map);
|
|
1002
1002
|
for (let [e, n] of i) t instanceof Map ? t.has(e) || t.set(e, n) : t instanceof Set ? t.add(e) : Object.prototype.hasOwnProperty.call(t, e) || Object.defineProperty(t, e, {
|
|
@@ -1007,20 +1007,20 @@ function Ke(e, t, n) {
|
|
|
1007
1007
|
});
|
|
1008
1008
|
return t;
|
|
1009
1009
|
}
|
|
1010
|
-
function
|
|
1010
|
+
function Ke(e, t) {
|
|
1011
1011
|
return e && v(t) ? t.resolve(e.doc, e) : t;
|
|
1012
1012
|
}
|
|
1013
1013
|
//#endregion
|
|
1014
1014
|
//#region node_modules/yaml/browser/dist/nodes/addPairToJSMap.js
|
|
1015
|
-
function
|
|
1015
|
+
function qe(e, t, { key: n, value: r }) {
|
|
1016
1016
|
if (T(n) && n.addToJSMap) n.addToJSMap(e, t, r);
|
|
1017
|
-
else if (
|
|
1017
|
+
else if (Ue(e, n)) We(e, t, r);
|
|
1018
1018
|
else {
|
|
1019
1019
|
let i = P(n, "", e);
|
|
1020
1020
|
if (t instanceof Map) t.set(i, P(r, i, e));
|
|
1021
1021
|
else if (t instanceof Set) t.add(i);
|
|
1022
1022
|
else {
|
|
1023
|
-
let a =
|
|
1023
|
+
let a = Je(n, i, e), o = P(r, a, e);
|
|
1024
1024
|
a in t ? Object.defineProperty(t, a, {
|
|
1025
1025
|
value: o,
|
|
1026
1026
|
writable: !0,
|
|
@@ -1031,18 +1031,18 @@ function Je(e, t, { key: n, value: r }) {
|
|
|
1031
1031
|
}
|
|
1032
1032
|
return t;
|
|
1033
1033
|
}
|
|
1034
|
-
function
|
|
1034
|
+
function Je(e, t, n) {
|
|
1035
1035
|
if (t === null) return "";
|
|
1036
1036
|
if (typeof t != "object") return String(t);
|
|
1037
1037
|
if (T(e) && n?.doc) {
|
|
1038
|
-
let t =
|
|
1038
|
+
let t = Ie(n.doc, {});
|
|
1039
1039
|
t.anchors = /* @__PURE__ */ new Set();
|
|
1040
1040
|
for (let e of n.anchors.keys()) t.anchors.add(e.anchor);
|
|
1041
1041
|
t.inFlow = !0, t.inStringifyKey = !0;
|
|
1042
1042
|
let r = e.toString(t);
|
|
1043
1043
|
if (!n.mapKeyWarned) {
|
|
1044
1044
|
let e = JSON.stringify(r);
|
|
1045
|
-
e.length > 40 && (e = e.substring(0, 36) + "...\""),
|
|
1045
|
+
e.length > 40 && (e = e.substring(0, 36) + "...\""), Ve(n.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`), n.mapKeyWarned = !0;
|
|
1046
1046
|
}
|
|
1047
1047
|
return r;
|
|
1048
1048
|
}
|
|
@@ -1050,10 +1050,10 @@ function Ye(e, t, n) {
|
|
|
1050
1050
|
}
|
|
1051
1051
|
//#endregion
|
|
1052
1052
|
//#region node_modules/yaml/browser/dist/nodes/Pair.js
|
|
1053
|
-
function
|
|
1054
|
-
return new
|
|
1053
|
+
function Ye(e, t, n) {
|
|
1054
|
+
return new B(L(e, void 0, n), L(t, void 0, n));
|
|
1055
1055
|
}
|
|
1056
|
-
var
|
|
1056
|
+
var B = class e {
|
|
1057
1057
|
constructor(e, t = null) {
|
|
1058
1058
|
Object.defineProperty(this, _, { value: m }), this.key = e, this.value = t;
|
|
1059
1059
|
}
|
|
@@ -1062,32 +1062,32 @@ var z = class e {
|
|
|
1062
1062
|
return T(n) && (n = n.clone(t)), T(r) && (r = r.clone(t)), new e(n, r);
|
|
1063
1063
|
}
|
|
1064
1064
|
toJSON(e, t) {
|
|
1065
|
-
return
|
|
1065
|
+
return qe(t, t?.mapAsMap ? /* @__PURE__ */ new Map() : {}, this);
|
|
1066
1066
|
}
|
|
1067
1067
|
toString(e, t, n) {
|
|
1068
|
-
return e?.doc ?
|
|
1068
|
+
return e?.doc ? Be(this, e, t, n) : JSON.stringify(this);
|
|
1069
1069
|
}
|
|
1070
1070
|
};
|
|
1071
1071
|
//#endregion
|
|
1072
1072
|
//#region node_modules/yaml/browser/dist/stringify/stringifyCollection.js
|
|
1073
|
-
function
|
|
1074
|
-
return (t.inFlow ?? e.flow ?
|
|
1073
|
+
function Xe(e, t, n) {
|
|
1074
|
+
return (t.inFlow ?? e.flow ? Qe : Ze)(e, t, n);
|
|
1075
1075
|
}
|
|
1076
|
-
function
|
|
1076
|
+
function Ze({ comment: e, items: t }, n, { blockItemPrefix: r, flowChars: i, itemIndent: a, onChompKeep: o, onComment: s }) {
|
|
1077
1077
|
let { indent: c, options: { commentString: l } } = n, u = Object.assign({}, n, {
|
|
1078
1078
|
indent: a,
|
|
1079
1079
|
type: null
|
|
1080
1080
|
}), d = !1, f = [];
|
|
1081
1081
|
for (let e = 0; e < t.length; ++e) {
|
|
1082
1082
|
let i = t[e], o = null;
|
|
1083
|
-
if (T(i)) !d && i.spaceBefore && f.push(""),
|
|
1083
|
+
if (T(i)) !d && i.spaceBefore && f.push(""), $e(n, f, i.commentBefore, d), i.comment && (o = i.comment);
|
|
1084
1084
|
else if (x(i)) {
|
|
1085
1085
|
let e = T(i.key) ? i.key : null;
|
|
1086
|
-
e && (!d && e.spaceBefore && f.push(""),
|
|
1086
|
+
e && (!d && e.spaceBefore && f.push(""), $e(n, f, e.commentBefore, d));
|
|
1087
1087
|
}
|
|
1088
1088
|
d = !1;
|
|
1089
|
-
let s =
|
|
1090
|
-
o && (s +=
|
|
1089
|
+
let s = ze(i, u, () => o = null, () => d = !0);
|
|
1090
|
+
o && (s += be(s, a, l(o))), d && o && (d = !1), f.push(r + s);
|
|
1091
1091
|
}
|
|
1092
1092
|
let p;
|
|
1093
1093
|
if (f.length === 0) p = i.start + i.end;
|
|
@@ -1098,9 +1098,9 @@ function Qe({ comment: e, items: t }, n, { blockItemPrefix: r, flowChars: i, ite
|
|
|
1098
1098
|
p += t ? `\n${c}${t}` : "\n";
|
|
1099
1099
|
}
|
|
1100
1100
|
}
|
|
1101
|
-
return e ? (p += "\n" +
|
|
1101
|
+
return e ? (p += "\n" + R(l(e), c), s && s()) : d && o && o(), p;
|
|
1102
1102
|
}
|
|
1103
|
-
function
|
|
1103
|
+
function Qe({ items: e }, t, { flowChars: n, itemIndent: r }) {
|
|
1104
1104
|
let { indent: i, indentStep: a, flowCollectionPadding: o, options: { commentString: s } } = t;
|
|
1105
1105
|
r += a;
|
|
1106
1106
|
let c = Object.assign({}, t, {
|
|
@@ -1110,16 +1110,16 @@ function $e({ items: e }, t, { flowChars: n, itemIndent: r }) {
|
|
|
1110
1110
|
}), l = !1, u = 0, d = [];
|
|
1111
1111
|
for (let n = 0; n < e.length; ++n) {
|
|
1112
1112
|
let i = e[n], a = null;
|
|
1113
|
-
if (T(i)) i.spaceBefore && d.push(""),
|
|
1113
|
+
if (T(i)) i.spaceBefore && d.push(""), $e(t, d, i.commentBefore, !1), i.comment && (a = i.comment);
|
|
1114
1114
|
else if (x(i)) {
|
|
1115
1115
|
let e = T(i.key) ? i.key : null;
|
|
1116
|
-
e && (e.spaceBefore && d.push(""),
|
|
1116
|
+
e && (e.spaceBefore && d.push(""), $e(t, d, e.commentBefore, !1), e.comment && (l = !0));
|
|
1117
1117
|
let n = T(i.value) ? i.value : null;
|
|
1118
1118
|
n ? (n.comment && (a = n.comment), n.commentBefore && (l = !0)) : i.value == null && e?.comment && (a = e.comment);
|
|
1119
1119
|
}
|
|
1120
1120
|
a && (l = !0);
|
|
1121
|
-
let o =
|
|
1122
|
-
l ||= d.length > u || o.includes("\n"), n < e.length - 1 ? o += "," : t.options.trailingComma && (t.options.lineWidth > 0 && (l ||= d.reduce((e, t) => e + t.length + 2, 2) + (o.length + 2) > t.options.lineWidth), l && (o += ",")), a && (o +=
|
|
1121
|
+
let o = ze(i, c, () => a = null);
|
|
1122
|
+
l ||= d.length > u || o.includes("\n"), n < e.length - 1 ? o += "," : t.options.trailingComma && (t.options.lineWidth > 0 && (l ||= d.reduce((e, t) => e + t.length + 2, 2) + (o.length + 2) > t.options.lineWidth), l && (o += ",")), a && (o += be(o, r, s(a))), d.push(o), u = d.length;
|
|
1123
1123
|
}
|
|
1124
1124
|
let { start: f, end: p } = n;
|
|
1125
1125
|
if (d.length === 0) return f + p;
|
|
@@ -1134,19 +1134,19 @@ function $e({ items: e }, t, { flowChars: n, itemIndent: r }) {
|
|
|
1134
1134
|
}
|
|
1135
1135
|
return `${f}${o}${d.join(" ")}${o}${p}`;
|
|
1136
1136
|
}
|
|
1137
|
-
function
|
|
1137
|
+
function $e({ indent: e, options: { commentString: t } }, n, r, i) {
|
|
1138
1138
|
if (r && i && (r = r.replace(/^\n+/, "")), r) {
|
|
1139
|
-
let i =
|
|
1139
|
+
let i = R(t(r), e);
|
|
1140
1140
|
n.push(i.trimStart());
|
|
1141
1141
|
}
|
|
1142
1142
|
}
|
|
1143
1143
|
//#endregion
|
|
1144
1144
|
//#region node_modules/yaml/browser/dist/nodes/YAMLMap.js
|
|
1145
|
-
function
|
|
1145
|
+
function et(e, t) {
|
|
1146
1146
|
let n = S(t) ? t.value : t;
|
|
1147
1147
|
for (let r of e) if (x(r) && (r.key === t || r.key === n || S(r.key) && r.key.value === n)) return r;
|
|
1148
1148
|
}
|
|
1149
|
-
var
|
|
1149
|
+
var V = class extends ve {
|
|
1150
1150
|
static get tagName() {
|
|
1151
1151
|
return "tag:yaml.org,2002:map";
|
|
1152
1152
|
}
|
|
@@ -1157,7 +1157,7 @@ var B = class extends ye {
|
|
|
1157
1157
|
let { keepUndefined: r, replacer: i } = n, a = new this(e), o = (e, o) => {
|
|
1158
1158
|
if (typeof i == "function") o = i.call(t, e, o);
|
|
1159
1159
|
else if (Array.isArray(i) && !i.includes(e)) return;
|
|
1160
|
-
(o !== void 0 || r) && a.items.push(
|
|
1160
|
+
(o !== void 0 || r) && a.items.push(Ye(e, o, n));
|
|
1161
1161
|
};
|
|
1162
1162
|
if (t instanceof Map) for (let [e, n] of t) o(e, n);
|
|
1163
1163
|
else if (t && typeof t == "object") for (let e of Object.keys(t)) o(e, t[e]);
|
|
@@ -1165,40 +1165,40 @@ var B = class extends ye {
|
|
|
1165
1165
|
}
|
|
1166
1166
|
add(e, t) {
|
|
1167
1167
|
let n;
|
|
1168
|
-
n = x(e) ? e : !e || typeof e != "object" || !("key" in e) ? new
|
|
1169
|
-
let r =
|
|
1168
|
+
n = x(e) ? e : !e || typeof e != "object" || !("key" in e) ? new B(e, e?.value) : new B(e.key, e.value);
|
|
1169
|
+
let r = et(this.items, n.key), i = this.schema?.sortMapEntries;
|
|
1170
1170
|
if (r) {
|
|
1171
1171
|
if (!t) throw Error(`Key ${n.key} already set`);
|
|
1172
|
-
S(r.value) &&
|
|
1172
|
+
S(r.value) && me(n.value) ? r.value.value = n.value : r.value = n.value;
|
|
1173
1173
|
} else if (i) {
|
|
1174
1174
|
let e = this.items.findIndex((e) => i(n, e) < 0);
|
|
1175
1175
|
e === -1 ? this.items.push(n) : this.items.splice(e, 0, n);
|
|
1176
1176
|
} else this.items.push(n);
|
|
1177
1177
|
}
|
|
1178
1178
|
delete(e) {
|
|
1179
|
-
let t =
|
|
1179
|
+
let t = et(this.items, e);
|
|
1180
1180
|
return t ? this.items.splice(this.items.indexOf(t), 1).length > 0 : !1;
|
|
1181
1181
|
}
|
|
1182
1182
|
get(e, t) {
|
|
1183
|
-
let n =
|
|
1183
|
+
let n = et(this.items, e)?.value;
|
|
1184
1184
|
return (!t && S(n) ? n.value : n) ?? void 0;
|
|
1185
1185
|
}
|
|
1186
1186
|
has(e) {
|
|
1187
|
-
return !!
|
|
1187
|
+
return !!et(this.items, e);
|
|
1188
1188
|
}
|
|
1189
1189
|
set(e, t) {
|
|
1190
|
-
this.add(new
|
|
1190
|
+
this.add(new B(e, t), !0);
|
|
1191
1191
|
}
|
|
1192
1192
|
toJSON(e, t, n) {
|
|
1193
1193
|
let r = n ? new n() : t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
|
|
1194
1194
|
t?.onCreate && t.onCreate(r);
|
|
1195
|
-
for (let e of this.items)
|
|
1195
|
+
for (let e of this.items) qe(t, r, e);
|
|
1196
1196
|
return r;
|
|
1197
1197
|
}
|
|
1198
1198
|
toString(e, t, n) {
|
|
1199
1199
|
if (!e) return JSON.stringify(this);
|
|
1200
1200
|
for (let e of this.items) if (!x(e)) throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);
|
|
1201
|
-
return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })),
|
|
1201
|
+
return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })), Xe(this, e, {
|
|
1202
1202
|
blockItemPrefix: "",
|
|
1203
1203
|
flowChars: {
|
|
1204
1204
|
start: "{",
|
|
@@ -1209,16 +1209,16 @@ var B = class extends ye {
|
|
|
1209
1209
|
onComment: t
|
|
1210
1210
|
});
|
|
1211
1211
|
}
|
|
1212
|
-
},
|
|
1212
|
+
}, tt = {
|
|
1213
1213
|
collection: "map",
|
|
1214
1214
|
default: !0,
|
|
1215
|
-
nodeClass:
|
|
1215
|
+
nodeClass: V,
|
|
1216
1216
|
tag: "tag:yaml.org,2002:map",
|
|
1217
1217
|
resolve(e, t) {
|
|
1218
1218
|
return b(e) || t("Expected a mapping for this tag"), e;
|
|
1219
1219
|
},
|
|
1220
|
-
createNode: (e, t, n) =>
|
|
1221
|
-
},
|
|
1220
|
+
createNode: (e, t, n) => V.from(e, t, n)
|
|
1221
|
+
}, nt = class extends ve {
|
|
1222
1222
|
static get tagName() {
|
|
1223
1223
|
return "tag:yaml.org,2002:seq";
|
|
1224
1224
|
}
|
|
@@ -1246,7 +1246,7 @@ var B = class extends ye {
|
|
|
1246
1246
|
let n = rt(e);
|
|
1247
1247
|
if (typeof n != "number") throw Error(`Expected a valid index, not ${e}.`);
|
|
1248
1248
|
let r = this.items[n];
|
|
1249
|
-
S(r) &&
|
|
1249
|
+
S(r) && me(t) ? r.value = t : this.items[n] = t;
|
|
1250
1250
|
}
|
|
1251
1251
|
toJSON(e, t) {
|
|
1252
1252
|
let n = [];
|
|
@@ -1256,7 +1256,7 @@ var B = class extends ye {
|
|
|
1256
1256
|
return n;
|
|
1257
1257
|
}
|
|
1258
1258
|
toString(e, t, n) {
|
|
1259
|
-
return e ?
|
|
1259
|
+
return e ? Xe(this, e, {
|
|
1260
1260
|
blockItemPrefix: "- ",
|
|
1261
1261
|
flowChars: {
|
|
1262
1262
|
start: "[",
|
|
@@ -1276,7 +1276,7 @@ var B = class extends ye {
|
|
|
1276
1276
|
let n = t instanceof Set ? a : String(e++);
|
|
1277
1277
|
a = r.call(t, n, a);
|
|
1278
1278
|
}
|
|
1279
|
-
i.items.push(
|
|
1279
|
+
i.items.push(L(a, void 0, n));
|
|
1280
1280
|
}
|
|
1281
1281
|
}
|
|
1282
1282
|
return i;
|
|
@@ -1291,34 +1291,34 @@ function rt(e) {
|
|
|
1291
1291
|
var it = {
|
|
1292
1292
|
collection: "seq",
|
|
1293
1293
|
default: !0,
|
|
1294
|
-
nodeClass:
|
|
1294
|
+
nodeClass: nt,
|
|
1295
1295
|
tag: "tag:yaml.org,2002:seq",
|
|
1296
1296
|
resolve(e, t) {
|
|
1297
1297
|
return C(e) || t("Expected a sequence for this tag"), e;
|
|
1298
1298
|
},
|
|
1299
|
-
createNode: (e, t, n) =>
|
|
1299
|
+
createNode: (e, t, n) => nt.from(e, t, n)
|
|
1300
1300
|
}, at = {
|
|
1301
1301
|
identify: (e) => typeof e == "string",
|
|
1302
1302
|
default: !0,
|
|
1303
1303
|
tag: "tag:yaml.org,2002:str",
|
|
1304
1304
|
resolve: (e) => e,
|
|
1305
1305
|
stringify(e, t, n, r) {
|
|
1306
|
-
return t = Object.assign({ actualString: !0 }, t),
|
|
1306
|
+
return t = Object.assign({ actualString: !0 }, t), Fe(e, t, n, r);
|
|
1307
1307
|
}
|
|
1308
1308
|
}, ot = {
|
|
1309
1309
|
identify: (e) => e == null,
|
|
1310
|
-
createNode: () => new
|
|
1310
|
+
createNode: () => new F(null),
|
|
1311
1311
|
default: !0,
|
|
1312
1312
|
tag: "tag:yaml.org,2002:null",
|
|
1313
1313
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
1314
|
-
resolve: () => new
|
|
1314
|
+
resolve: () => new F(null),
|
|
1315
1315
|
stringify: ({ source: e }, t) => typeof e == "string" && ot.test.test(e) ? e : t.options.nullStr
|
|
1316
1316
|
}, st = {
|
|
1317
1317
|
identify: (e) => typeof e == "boolean",
|
|
1318
1318
|
default: !0,
|
|
1319
1319
|
tag: "tag:yaml.org,2002:bool",
|
|
1320
1320
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
1321
|
-
resolve: (e) => new
|
|
1321
|
+
resolve: (e) => new F(e[0] === "t" || e[0] === "T"),
|
|
1322
1322
|
stringify({ source: e, value: t }, n) {
|
|
1323
1323
|
return e && st.test.test(e) && t === (e[0] === "t" || e[0] === "T") ? e : t ? n.options.trueStr : n.options.falseStr;
|
|
1324
1324
|
}
|
|
@@ -1364,7 +1364,7 @@ var ct = {
|
|
|
1364
1364
|
tag: "tag:yaml.org,2002:float",
|
|
1365
1365
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
|
|
1366
1366
|
resolve(e) {
|
|
1367
|
-
let t = new
|
|
1367
|
+
let t = new F(parseFloat(e)), n = e.indexOf(".");
|
|
1368
1368
|
return n !== -1 && e[e.length - 1] === "0" && (t.minFractionDigits = e.length - n - 1), t;
|
|
1369
1369
|
},
|
|
1370
1370
|
stringify: H
|
|
@@ -1397,7 +1397,7 @@ var mt = {
|
|
|
1397
1397
|
resolve: (e, t, n) => ft(e, 2, 16, n),
|
|
1398
1398
|
stringify: (e) => pt(e, 16, "0x")
|
|
1399
1399
|
}, _t = [
|
|
1400
|
-
|
|
1400
|
+
tt,
|
|
1401
1401
|
it,
|
|
1402
1402
|
at,
|
|
1403
1403
|
ot,
|
|
@@ -1424,7 +1424,7 @@ var yt = ({ value: e }) => JSON.stringify(e), bt = [
|
|
|
1424
1424
|
},
|
|
1425
1425
|
{
|
|
1426
1426
|
identify: (e) => e == null,
|
|
1427
|
-
createNode: () => new
|
|
1427
|
+
createNode: () => new F(null),
|
|
1428
1428
|
default: !0,
|
|
1429
1429
|
tag: "tag:yaml.org,2002:null",
|
|
1430
1430
|
test: /^null$/,
|
|
@@ -1455,7 +1455,7 @@ var yt = ({ value: e }) => JSON.stringify(e), bt = [
|
|
|
1455
1455
|
resolve: (e) => parseFloat(e),
|
|
1456
1456
|
stringify: yt
|
|
1457
1457
|
}
|
|
1458
|
-
], xt = [
|
|
1458
|
+
], xt = [tt, it].concat(bt, {
|
|
1459
1459
|
default: !0,
|
|
1460
1460
|
tag: "",
|
|
1461
1461
|
test: /^/,
|
|
@@ -1482,12 +1482,12 @@ var yt = ({ value: e }) => JSON.stringify(e), bt = [
|
|
|
1482
1482
|
for (let t = 0; t < o.length; ++t) e += String.fromCharCode(o[t]);
|
|
1483
1483
|
s = btoa(e);
|
|
1484
1484
|
} else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");
|
|
1485
|
-
if (t ??=
|
|
1485
|
+
if (t ??= F.BLOCK_LITERAL, t !== F.QUOTE_DOUBLE) {
|
|
1486
1486
|
let e = Math.max(r.options.lineWidth - r.indent.length, r.options.minContentWidth), n = Math.ceil(s.length / e), i = Array(n);
|
|
1487
1487
|
for (let t = 0, r = 0; t < n; ++t, r += e) i[t] = s.substr(r, e);
|
|
1488
|
-
s = i.join(t ===
|
|
1488
|
+
s = i.join(t === F.BLOCK_LITERAL ? "\n" : " ");
|
|
1489
1489
|
}
|
|
1490
|
-
return
|
|
1490
|
+
return Fe({
|
|
1491
1491
|
comment: e,
|
|
1492
1492
|
type: t,
|
|
1493
1493
|
value: s
|
|
@@ -1502,21 +1502,21 @@ function Ct(e, t) {
|
|
|
1502
1502
|
if (!x(r)) {
|
|
1503
1503
|
if (b(r)) {
|
|
1504
1504
|
r.items.length > 1 && t("Each pair must have its own sequence indicator");
|
|
1505
|
-
let e = r.items[0] || new
|
|
1505
|
+
let e = r.items[0] || new B(new F(null));
|
|
1506
1506
|
if (r.commentBefore && (e.key.commentBefore = e.key.commentBefore ? `${r.commentBefore}\n${e.key.commentBefore}` : r.commentBefore), r.comment) {
|
|
1507
1507
|
let t = e.value ?? e.key;
|
|
1508
1508
|
t.comment = t.comment ? `${r.comment}\n${t.comment}` : r.comment;
|
|
1509
1509
|
}
|
|
1510
1510
|
r = e;
|
|
1511
1511
|
}
|
|
1512
|
-
e.items[n] = x(r) ? r : new
|
|
1512
|
+
e.items[n] = x(r) ? r : new B(r);
|
|
1513
1513
|
}
|
|
1514
1514
|
}
|
|
1515
1515
|
else t("Expected a sequence for this tag");
|
|
1516
1516
|
return e;
|
|
1517
1517
|
}
|
|
1518
1518
|
function wt(e, t, n) {
|
|
1519
|
-
let { replacer: r } = n, i = new
|
|
1519
|
+
let { replacer: r } = n, i = new nt(e);
|
|
1520
1520
|
i.tag = "tag:yaml.org,2002:pairs";
|
|
1521
1521
|
let a = 0;
|
|
1522
1522
|
if (t && Symbol.iterator in Object(t)) for (let e of t) {
|
|
@@ -1530,7 +1530,7 @@ function wt(e, t, n) {
|
|
|
1530
1530
|
if (t.length === 1) o = t[0], s = e[o];
|
|
1531
1531
|
else throw TypeError(`Expected tuple with one key, not ${t.length} keys`);
|
|
1532
1532
|
} else o = e;
|
|
1533
|
-
i.items.push(
|
|
1533
|
+
i.items.push(Ye(o, s, n));
|
|
1534
1534
|
}
|
|
1535
1535
|
return i;
|
|
1536
1536
|
}
|
|
@@ -1540,9 +1540,9 @@ var Tt = {
|
|
|
1540
1540
|
tag: "tag:yaml.org,2002:pairs",
|
|
1541
1541
|
resolve: Ct,
|
|
1542
1542
|
createNode: wt
|
|
1543
|
-
}, Et = class e extends
|
|
1543
|
+
}, Et = class e extends nt {
|
|
1544
1544
|
constructor() {
|
|
1545
|
-
super(), this.add =
|
|
1545
|
+
super(), this.add = V.prototype.add.bind(this), this.delete = V.prototype.delete.bind(this), this.get = V.prototype.get.bind(this), this.has = V.prototype.has.bind(this), this.set = V.prototype.set.bind(this), this.tag = e.tag;
|
|
1546
1546
|
}
|
|
1547
1547
|
toJSON(e, t) {
|
|
1548
1548
|
if (!t) return super.toJSON(e);
|
|
@@ -1584,14 +1584,14 @@ var kt = {
|
|
|
1584
1584
|
default: !0,
|
|
1585
1585
|
tag: "tag:yaml.org,2002:bool",
|
|
1586
1586
|
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
|
1587
|
-
resolve: () => new
|
|
1587
|
+
resolve: () => new F(!0),
|
|
1588
1588
|
stringify: Ot
|
|
1589
1589
|
}, At = {
|
|
1590
1590
|
identify: (e) => e === !1,
|
|
1591
1591
|
default: !0,
|
|
1592
1592
|
tag: "tag:yaml.org,2002:bool",
|
|
1593
1593
|
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
|
|
1594
|
-
resolve: () => new
|
|
1594
|
+
resolve: () => new F(!1),
|
|
1595
1595
|
stringify: Ot
|
|
1596
1596
|
}, jt = {
|
|
1597
1597
|
identify: (e) => typeof e == "number",
|
|
@@ -1617,7 +1617,7 @@ var kt = {
|
|
|
1617
1617
|
tag: "tag:yaml.org,2002:float",
|
|
1618
1618
|
test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
|
|
1619
1619
|
resolve(e) {
|
|
1620
|
-
let t = new
|
|
1620
|
+
let t = new F(parseFloat(e.replace(/_/g, ""))), n = e.indexOf(".");
|
|
1621
1621
|
if (n !== -1) {
|
|
1622
1622
|
let r = e.substring(n + 1).replace(/_/g, "");
|
|
1623
1623
|
r[r.length - 1] === "0" && (t.minFractionDigits = r.length);
|
|
@@ -1683,22 +1683,22 @@ var Lt = {
|
|
|
1683
1683
|
test: /^[-+]?0x[0-9a-fA-F_]+$/,
|
|
1684
1684
|
resolve: (e, t, n) => Ft(e, 2, 16, n),
|
|
1685
1685
|
stringify: (e) => It(e, 16, "0x")
|
|
1686
|
-
}, Vt = class e extends
|
|
1686
|
+
}, Vt = class e extends V {
|
|
1687
1687
|
constructor(t) {
|
|
1688
1688
|
super(t), this.tag = e.tag;
|
|
1689
1689
|
}
|
|
1690
1690
|
add(e) {
|
|
1691
1691
|
let t;
|
|
1692
|
-
t = x(e) ? e : e && typeof e == "object" && "key" in e && "value" in e && e.value === null ? new
|
|
1692
|
+
t = x(e) ? e : e && typeof e == "object" && "key" in e && "value" in e && e.value === null ? new B(e.key, null) : new B(e, null), et(this.items, t.key) || this.items.push(t);
|
|
1693
1693
|
}
|
|
1694
1694
|
get(e, t) {
|
|
1695
|
-
let n =
|
|
1695
|
+
let n = et(this.items, e);
|
|
1696
1696
|
return !t && x(n) ? S(n.key) ? n.key.value : n.key : n;
|
|
1697
1697
|
}
|
|
1698
1698
|
set(e, t) {
|
|
1699
1699
|
if (typeof t != "boolean") throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);
|
|
1700
|
-
let n =
|
|
1701
|
-
n && !t ? this.items.splice(this.items.indexOf(n), 1) : !n && t && this.items.push(new
|
|
1700
|
+
let n = et(this.items, e);
|
|
1701
|
+
n && !t ? this.items.splice(this.items.indexOf(n), 1) : !n && t && this.items.push(new B(e));
|
|
1702
1702
|
}
|
|
1703
1703
|
toJSON(e, t) {
|
|
1704
1704
|
return super.toJSON(e, t, Set);
|
|
@@ -1710,7 +1710,7 @@ var Lt = {
|
|
|
1710
1710
|
}
|
|
1711
1711
|
static from(e, t, n) {
|
|
1712
1712
|
let { replacer: r } = n, i = new this(e);
|
|
1713
|
-
if (t && Symbol.iterator in Object(t)) for (let e of t) typeof r == "function" && (e = r.call(t, e, e)), i.items.push(
|
|
1713
|
+
if (t && Symbol.iterator in Object(t)) for (let e of t) typeof r == "function" && (e = r.call(t, e, e)), i.items.push(Ye(e, null, n));
|
|
1714
1714
|
return i;
|
|
1715
1715
|
}
|
|
1716
1716
|
};
|
|
@@ -1778,7 +1778,7 @@ var Gt = {
|
|
|
1778
1778
|
},
|
|
1779
1779
|
stringify: ({ value: e }) => e?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
|
|
1780
1780
|
}, Jt = [
|
|
1781
|
-
|
|
1781
|
+
tt,
|
|
1782
1782
|
it,
|
|
1783
1783
|
at,
|
|
1784
1784
|
ot,
|
|
@@ -1792,7 +1792,7 @@ var Gt = {
|
|
|
1792
1792
|
Mt,
|
|
1793
1793
|
Nt,
|
|
1794
1794
|
St,
|
|
1795
|
-
|
|
1795
|
+
z,
|
|
1796
1796
|
Dt,
|
|
1797
1797
|
Tt,
|
|
1798
1798
|
Ht,
|
|
@@ -1802,7 +1802,7 @@ var Gt = {
|
|
|
1802
1802
|
], Yt = /* @__PURE__ */ new Map([
|
|
1803
1803
|
["core", _t],
|
|
1804
1804
|
["failsafe", [
|
|
1805
|
-
|
|
1805
|
+
tt,
|
|
1806
1806
|
it,
|
|
1807
1807
|
at
|
|
1808
1808
|
]],
|
|
@@ -1820,8 +1820,8 @@ var Gt = {
|
|
|
1820
1820
|
intHex: gt,
|
|
1821
1821
|
intOct: mt,
|
|
1822
1822
|
intTime: Gt,
|
|
1823
|
-
map:
|
|
1824
|
-
merge:
|
|
1823
|
+
map: tt,
|
|
1824
|
+
merge: z,
|
|
1825
1825
|
null: ot,
|
|
1826
1826
|
omap: Dt,
|
|
1827
1827
|
pairs: Tt,
|
|
@@ -1830,7 +1830,7 @@ var Gt = {
|
|
|
1830
1830
|
timestamp: qt
|
|
1831
1831
|
}, Zt = {
|
|
1832
1832
|
"tag:yaml.org,2002:binary": St,
|
|
1833
|
-
"tag:yaml.org,2002:merge":
|
|
1833
|
+
"tag:yaml.org,2002:merge": z,
|
|
1834
1834
|
"tag:yaml.org,2002:omap": Dt,
|
|
1835
1835
|
"tag:yaml.org,2002:pairs": Tt,
|
|
1836
1836
|
"tag:yaml.org,2002:set": Ht,
|
|
@@ -1838,7 +1838,7 @@ var Gt = {
|
|
|
1838
1838
|
};
|
|
1839
1839
|
function Qt(e, t, n) {
|
|
1840
1840
|
let r = Yt.get(t);
|
|
1841
|
-
if (r && !e) return n && !r.includes(
|
|
1841
|
+
if (r && !e) return n && !r.includes(z) ? r.concat(z) : r.slice();
|
|
1842
1842
|
let i = r;
|
|
1843
1843
|
if (!i) {
|
|
1844
1844
|
if (Array.isArray(e)) i = [];
|
|
@@ -1849,7 +1849,7 @@ function Qt(e, t, n) {
|
|
|
1849
1849
|
}
|
|
1850
1850
|
if (Array.isArray(e)) for (let t of e) i = i.concat(t);
|
|
1851
1851
|
else typeof e == "function" && (i = e(i.slice()));
|
|
1852
|
-
return n && (i = i.concat(
|
|
1852
|
+
return n && (i = i.concat(z)), i.reduce((e, t) => {
|
|
1853
1853
|
let n = typeof t == "string" ? Xt[t] : t;
|
|
1854
1854
|
if (!n) {
|
|
1855
1855
|
let e = JSON.stringify(t), n = Object.keys(Xt).map((e) => JSON.stringify(e)).join(", ");
|
|
@@ -1862,7 +1862,7 @@ function Qt(e, t, n) {
|
|
|
1862
1862
|
//#region node_modules/yaml/browser/dist/schema/Schema.js
|
|
1863
1863
|
var $t = (e, t) => e.key < t.key ? -1 : +(e.key > t.key), en = class e {
|
|
1864
1864
|
constructor({ compat: e, customTags: t, merge: n, resolveKnownTags: r, schema: i, sortMapEntries: a, toStringDefaults: o }) {
|
|
1865
|
-
this.compat = Array.isArray(e) ? Qt(e, "compat") : e ? Qt(null, e) : null, this.name = typeof i == "string" && i || "core", this.knownTags = r ? Zt : {}, this.tags = Qt(t, this.name, n), this.toStringOptions = o ?? null, Object.defineProperty(this, p, { value:
|
|
1865
|
+
this.compat = Array.isArray(e) ? Qt(e, "compat") : e ? Qt(null, e) : null, this.name = typeof i == "string" && i || "core", this.knownTags = r ? Zt : {}, this.tags = Qt(t, this.name, n), this.toStringOptions = o ?? null, Object.defineProperty(this, p, { value: tt }), Object.defineProperty(this, h, { value: at }), Object.defineProperty(this, g, { value: it }), this.sortMapEntries = typeof a == "function" ? a : a === !0 ? $t : null;
|
|
1866
1866
|
}
|
|
1867
1867
|
clone() {
|
|
1868
1868
|
let t = Object.create(e.prototype, Object.getOwnPropertyDescriptors(this));
|
|
@@ -1878,32 +1878,32 @@ function tn(e, t) {
|
|
|
1878
1878
|
t ? (n.push(t), r = !0) : e.directives.docStart && (r = !0);
|
|
1879
1879
|
}
|
|
1880
1880
|
r && n.push("---");
|
|
1881
|
-
let i =
|
|
1881
|
+
let i = Ie(e, t), { commentString: a } = i.options;
|
|
1882
1882
|
if (e.commentBefore) {
|
|
1883
1883
|
n.length !== 1 && n.unshift("");
|
|
1884
1884
|
let t = a(e.commentBefore);
|
|
1885
|
-
n.unshift(
|
|
1885
|
+
n.unshift(R(t, ""));
|
|
1886
1886
|
}
|
|
1887
1887
|
let o = !1, s = null;
|
|
1888
1888
|
if (e.contents) {
|
|
1889
1889
|
if (T(e.contents)) {
|
|
1890
1890
|
if (e.contents.spaceBefore && r && n.push(""), e.contents.commentBefore) {
|
|
1891
1891
|
let t = a(e.contents.commentBefore);
|
|
1892
|
-
n.push(
|
|
1892
|
+
n.push(R(t, ""));
|
|
1893
1893
|
}
|
|
1894
1894
|
i.forceBlockIndent = !!e.comment, s = e.contents.comment;
|
|
1895
1895
|
}
|
|
1896
|
-
let t = s ? void 0 : () => o = !0, c =
|
|
1897
|
-
s && (c +=
|
|
1898
|
-
} else n.push(
|
|
1896
|
+
let t = s ? void 0 : () => o = !0, c = ze(e.contents, i, () => s = null, t);
|
|
1897
|
+
s && (c += be(c, "", a(s))), (c[0] === "|" || c[0] === ">") && n[n.length - 1] === "---" ? n[n.length - 1] = `--- ${c}` : n.push(c);
|
|
1898
|
+
} else n.push(ze(e.contents, i));
|
|
1899
1899
|
if (e.directives?.docEnd) {
|
|
1900
1900
|
if (e.comment) {
|
|
1901
1901
|
let t = a(e.comment);
|
|
1902
|
-
t.includes("\n") ? (n.push("..."), n.push(
|
|
1902
|
+
t.includes("\n") ? (n.push("..."), n.push(R(t, ""))) : n.push(`... ${t}`);
|
|
1903
1903
|
} else n.push("...");
|
|
1904
1904
|
} else {
|
|
1905
1905
|
let t = e.comment;
|
|
1906
|
-
t && o && (t = t.replace(/^\n+/, "")), t && ((!o || s) && n[n.length - 1] !== "" && n.push(""), n.push(
|
|
1906
|
+
t && o && (t = t.replace(/^\n+/, "")), t && ((!o || s) && n[n.length - 1] !== "" && n.push(""), n.push(R(a(t), "")));
|
|
1907
1907
|
}
|
|
1908
1908
|
return n.join("\n") + "\n";
|
|
1909
1909
|
}
|
|
@@ -1926,7 +1926,7 @@ var nn = class e {
|
|
|
1926
1926
|
}, n);
|
|
1927
1927
|
this.options = i;
|
|
1928
1928
|
let { version: a } = i;
|
|
1929
|
-
n?._directives ? (this.directives = n._directives.atDocument(), this.directives.yaml.explicit && (a = this.directives.yaml.version)) : this.directives = new
|
|
1929
|
+
n?._directives ? (this.directives = n._directives.atDocument(), this.directives.yaml.explicit && (a = this.directives.yaml.version)) : this.directives = new M({ version: a }), this.setSchema(a, n), this.contents = e === void 0 ? null : this.createNode(e, r, n);
|
|
1930
1930
|
}
|
|
1931
1931
|
clone() {
|
|
1932
1932
|
let t = Object.create(e.prototype, { [_]: { value: f } });
|
|
@@ -1940,10 +1940,10 @@ var nn = class e {
|
|
|
1940
1940
|
}
|
|
1941
1941
|
createAlias(e, t) {
|
|
1942
1942
|
if (!e.anchor) {
|
|
1943
|
-
let n =
|
|
1944
|
-
e.anchor = !t || n.has(t) ?
|
|
1943
|
+
let n = ce(this);
|
|
1944
|
+
e.anchor = !t || n.has(t) ? le(t || "a", n) : t;
|
|
1945
1945
|
}
|
|
1946
|
-
return new
|
|
1946
|
+
return new fe(e.anchor);
|
|
1947
1947
|
}
|
|
1948
1948
|
createNode(e, t, n) {
|
|
1949
1949
|
let r;
|
|
@@ -1952,7 +1952,7 @@ var nn = class e {
|
|
|
1952
1952
|
let e = t.filter((e) => typeof e == "number" || e instanceof String || e instanceof Number).map(String);
|
|
1953
1953
|
e.length > 0 && (t = t.concat(e)), r = t;
|
|
1954
1954
|
} else n === void 0 && t && (n = t, t = void 0);
|
|
1955
|
-
let { aliasDuplicateObjects: i, anchorPrefix: a, flow: o, keepUndefined: s, onTagObj: c, tag: l } = n ?? {}, { onAnchor: u, setAnchors: d, sourceObjects: f } =
|
|
1955
|
+
let { aliasDuplicateObjects: i, anchorPrefix: a, flow: o, keepUndefined: s, onTagObj: c, tag: l } = n ?? {}, { onAnchor: u, setAnchors: d, sourceObjects: f } = ue(this, a || "a"), p = {
|
|
1956
1956
|
aliasDuplicateObjects: i ?? !0,
|
|
1957
1957
|
keepUndefined: s ?? !1,
|
|
1958
1958
|
onAnchor: u,
|
|
@@ -1960,49 +1960,49 @@ var nn = class e {
|
|
|
1960
1960
|
replacer: r,
|
|
1961
1961
|
schema: this.schema,
|
|
1962
1962
|
sourceObjects: f
|
|
1963
|
-
}, m =
|
|
1963
|
+
}, m = L(e, l, p);
|
|
1964
1964
|
return o && w(m) && (m.flow = !0), d(), m;
|
|
1965
1965
|
}
|
|
1966
1966
|
createPair(e, t, n = {}) {
|
|
1967
|
-
return new
|
|
1967
|
+
return new B(this.createNode(e, null, n), this.createNode(t, null, n));
|
|
1968
1968
|
}
|
|
1969
1969
|
delete(e) {
|
|
1970
1970
|
return rn(this.contents) ? this.contents.delete(e) : !1;
|
|
1971
1971
|
}
|
|
1972
1972
|
deleteIn(e) {
|
|
1973
|
-
return
|
|
1973
|
+
return _e(e) ? this.contents != null && (this.contents = null, !0) : rn(this.contents) ? this.contents.deleteIn(e) : !1;
|
|
1974
1974
|
}
|
|
1975
1975
|
get(e, t) {
|
|
1976
1976
|
return w(this.contents) ? this.contents.get(e, t) : void 0;
|
|
1977
1977
|
}
|
|
1978
1978
|
getIn(e, t) {
|
|
1979
|
-
return
|
|
1979
|
+
return _e(e) ? !t && S(this.contents) ? this.contents.value : this.contents : w(this.contents) ? this.contents.getIn(e, t) : void 0;
|
|
1980
1980
|
}
|
|
1981
1981
|
has(e) {
|
|
1982
1982
|
return w(this.contents) ? this.contents.has(e) : !1;
|
|
1983
1983
|
}
|
|
1984
1984
|
hasIn(e) {
|
|
1985
|
-
return
|
|
1985
|
+
return _e(e) ? this.contents !== void 0 : w(this.contents) ? this.contents.hasIn(e) : !1;
|
|
1986
1986
|
}
|
|
1987
1987
|
set(e, t) {
|
|
1988
|
-
this.contents == null ? this.contents =
|
|
1988
|
+
this.contents == null ? this.contents = ge(this.schema, [e], t) : rn(this.contents) && this.contents.set(e, t);
|
|
1989
1989
|
}
|
|
1990
1990
|
setIn(e, t) {
|
|
1991
|
-
|
|
1991
|
+
_e(e) ? this.contents = t : this.contents == null ? this.contents = ge(this.schema, Array.from(e), t) : rn(this.contents) && this.contents.setIn(e, t);
|
|
1992
1992
|
}
|
|
1993
1993
|
setSchema(e, t = {}) {
|
|
1994
1994
|
typeof e == "number" && (e = String(e));
|
|
1995
1995
|
let n;
|
|
1996
1996
|
switch (e) {
|
|
1997
1997
|
case "1.1":
|
|
1998
|
-
this.directives ? this.directives.yaml.version = "1.1" : this.directives = new
|
|
1998
|
+
this.directives ? this.directives.yaml.version = "1.1" : this.directives = new M({ version: "1.1" }), n = {
|
|
1999
1999
|
resolveKnownTags: !1,
|
|
2000
2000
|
schema: "yaml-1.1"
|
|
2001
2001
|
};
|
|
2002
2002
|
break;
|
|
2003
2003
|
case "1.2":
|
|
2004
2004
|
case "next":
|
|
2005
|
-
this.directives ? this.directives.yaml.version = e : this.directives = new
|
|
2005
|
+
this.directives ? this.directives.yaml.version = e : this.directives = new M({ version: e }), n = {
|
|
2006
2006
|
resolveKnownTags: !0,
|
|
2007
2007
|
schema: "core"
|
|
2008
2008
|
};
|
|
@@ -2179,7 +2179,7 @@ function fn(e, t, n) {
|
|
|
2179
2179
|
//#region node_modules/yaml/browser/dist/compose/resolve-block-map.js
|
|
2180
2180
|
var pn = "All mapping items must start at the same column";
|
|
2181
2181
|
function mn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
|
|
2182
|
-
let o = new ((a?.nodeClass) ??
|
|
2182
|
+
let o = new ((a?.nodeClass) ?? V)(n.schema);
|
|
2183
2183
|
n.atRoot &&= !1;
|
|
2184
2184
|
let s = r.offset, c = null;
|
|
2185
2185
|
for (let a of r.items) {
|
|
@@ -2213,11 +2213,11 @@ function mn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
|
|
|
2213
2213
|
m && (f?.type === "block-map" && !_.hasNewline && i(s, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings"), n.options.strict && p.start < _.found.offset - 1024 && i(g.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));
|
|
2214
2214
|
let c = f ? e(n, f, _, i) : t(n, s, d, null, _, i);
|
|
2215
2215
|
n.schema.compat && dn(r.indent, f, i), s = c.range[2];
|
|
2216
|
-
let l = new
|
|
2216
|
+
let l = new B(g, c);
|
|
2217
2217
|
n.options.keepSourceTokens && (l.srcToken = a), o.items.push(l);
|
|
2218
2218
|
} else {
|
|
2219
2219
|
m && i(g.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values"), _.comment && (g.comment ? g.comment += "\n" + _.comment : g.comment = _.comment);
|
|
2220
|
-
let e = new
|
|
2220
|
+
let e = new B(g);
|
|
2221
2221
|
n.options.keepSourceTokens && (e.srcToken = a), o.items.push(e);
|
|
2222
2222
|
}
|
|
2223
2223
|
}
|
|
@@ -2230,7 +2230,7 @@ function mn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
|
|
|
2230
2230
|
//#endregion
|
|
2231
2231
|
//#region node_modules/yaml/browser/dist/compose/resolve-block-seq.js
|
|
2232
2232
|
function hn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
|
|
2233
|
-
let o = new ((a?.nodeClass) ??
|
|
2233
|
+
let o = new ((a?.nodeClass) ?? nt)(n.schema);
|
|
2234
2234
|
n.atRoot &&= !1, n.atKey &&= !1;
|
|
2235
2235
|
let s = r.offset, c = null;
|
|
2236
2236
|
for (let { start: a, value: l } of r.items) {
|
|
@@ -2293,7 +2293,7 @@ function gn(e, t, n, r) {
|
|
|
2293
2293
|
//#region node_modules/yaml/browser/dist/compose/resolve-flow-collection.js
|
|
2294
2294
|
var _n = "Block collections are not allowed within flow collections", vn = (e) => e && (e.type === "block-map" || e.type === "block-seq");
|
|
2295
2295
|
function yn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
|
|
2296
|
-
let o = r.start.source === "{", s = o ? "flow map" : "flow sequence", c = new ((a?.nodeClass) ?? (o ?
|
|
2296
|
+
let o = r.start.source === "{", s = o ? "flow map" : "flow sequence", c = new ((a?.nodeClass) ?? (o ? V : nt))(n.schema);
|
|
2297
2297
|
c.flow = !0;
|
|
2298
2298
|
let l = n.atRoot;
|
|
2299
2299
|
l && (n.atRoot = !1), n.atKey &&= !1;
|
|
@@ -2361,12 +2361,12 @@ function yn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
|
|
|
2361
2361
|
} else m && ("source" in m && m.source?.[0] === ":" ? i(m, "MISSING_CHAR", `Missing space after : in ${s}`) : i(_.start, "MISSING_CHAR", `Missing , or : between ${s} items`));
|
|
2362
2362
|
let v = m ? e(n, m, _, i) : _.found ? t(n, _.end, p, null, _, i) : null;
|
|
2363
2363
|
v ? vn(m) && i(v.range, "BLOCK_IN_FLOW", _n) : _.comment && (g.comment ? g.comment += "\n" + _.comment : g.comment = _.comment);
|
|
2364
|
-
let y = new
|
|
2364
|
+
let y = new B(g, v);
|
|
2365
2365
|
if (n.options.keepSourceTokens && (y.srcToken = l), o) {
|
|
2366
2366
|
let e = c;
|
|
2367
2367
|
fn(n, e.items, g) && i(a, "DUPLICATE_KEY", "Map keys must be unique"), e.items.push(y);
|
|
2368
2368
|
} else {
|
|
2369
|
-
let e = new
|
|
2369
|
+
let e = new V(n.schema);
|
|
2370
2370
|
e.flow = !0, e.items.push(y);
|
|
2371
2371
|
let t = (v ?? g).range;
|
|
2372
2372
|
e.range = [
|
|
@@ -2411,14 +2411,14 @@ function xn(e, t, n, r, i) {
|
|
|
2411
2411
|
n && (!t || t.offset < n.offset) && i(n, "MISSING_CHAR", "Missing newline after block sequence props");
|
|
2412
2412
|
}
|
|
2413
2413
|
let s = n.type === "block-map" ? "map" : n.type === "block-seq" ? "seq" : n.start.source === "{" ? "map" : "seq";
|
|
2414
|
-
if (!a || !o || o === "!" || o ===
|
|
2414
|
+
if (!a || !o || o === "!" || o === V.tagName && s === "map" || o === nt.tagName && s === "seq") return bn(e, t, n, i, o);
|
|
2415
2415
|
let c = t.schema.tags.find((e) => e.tag === o && e.collection === s);
|
|
2416
2416
|
if (!c) {
|
|
2417
2417
|
let r = t.schema.knownTags[o];
|
|
2418
2418
|
if (r?.collection === s) t.schema.tags.push(Object.assign({}, r, { default: !1 })), c = r;
|
|
2419
2419
|
else return r ? i(a, "BAD_COLLECTION_TYPE", `${r.tag} used for ${s} collection, but expects ${r.collection ?? "scalar"}`, !0) : i(a, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0), bn(e, t, n, i, o);
|
|
2420
2420
|
}
|
|
2421
|
-
let l = bn(e, t, n, i, o, c), u = c.resolve?.(l, (e) => i(a, "TAG_RESOLVE_FAILED", e), t.options) ?? l, d = T(u) ? u : new
|
|
2421
|
+
let l = bn(e, t, n, i, o, c), u = c.resolve?.(l, (e) => i(a, "TAG_RESOLVE_FAILED", e), t.options) ?? l, d = T(u) ? u : new F(u);
|
|
2422
2422
|
return d.range = l.range, d.tag = o, c?.format && (d.format = c.format), d;
|
|
2423
2423
|
}
|
|
2424
2424
|
//#endregion
|
|
@@ -2435,7 +2435,7 @@ function Sn(e, t, n) {
|
|
|
2435
2435
|
r
|
|
2436
2436
|
]
|
|
2437
2437
|
};
|
|
2438
|
-
let a = i.mode === ">" ?
|
|
2438
|
+
let a = i.mode === ">" ? F.BLOCK_FOLDED : F.BLOCK_LITERAL, o = t.source ? wn(t.source) : [], s = o.length;
|
|
2439
2439
|
for (let e = o.length - 1; e >= 0; --e) {
|
|
2440
2440
|
let t = o[e][1];
|
|
2441
2441
|
if (t === "" || t === "\r") s = e;
|
|
@@ -2476,7 +2476,7 @@ function Sn(e, t, n) {
|
|
|
2476
2476
|
let e = `Block scalar lines must not be less indented than their ${i.indent ? "explicit indentation indicator" : "first line"}`;
|
|
2477
2477
|
n(l - r.length - (s ? 2 : 1), "BAD_INDENT", e), t = "";
|
|
2478
2478
|
}
|
|
2479
|
-
a ===
|
|
2479
|
+
a === F.BLOCK_LITERAL ? (d += f + t.slice(c) + r, f = "\n") : t.length > c || r[0] === " " ? (f === " " ? f = "\n" : !p && f === "\n" && (f = "\n\n"), d += f + t.slice(c) + r, f = "\n", p = !0) : r === "" ? f === "\n" ? d += "\n" : f = "\n" : (d += f + r, f = " ", p = !1);
|
|
2480
2480
|
}
|
|
2481
2481
|
switch (i.chomp) {
|
|
2482
2482
|
case "-": break;
|
|
@@ -2552,13 +2552,13 @@ function Tn(e, t, n) {
|
|
|
2552
2552
|
let { offset: r, type: i, source: a, end: o } = e, s, c, l = (e, t, i) => n(r + e, t, i);
|
|
2553
2553
|
switch (i) {
|
|
2554
2554
|
case "scalar":
|
|
2555
|
-
s =
|
|
2555
|
+
s = F.PLAIN, c = En(a, l);
|
|
2556
2556
|
break;
|
|
2557
2557
|
case "single-quoted-scalar":
|
|
2558
|
-
s =
|
|
2558
|
+
s = F.QUOTE_SINGLE, c = Dn(a, l);
|
|
2559
2559
|
break;
|
|
2560
2560
|
case "double-quoted-scalar":
|
|
2561
|
-
s =
|
|
2561
|
+
s = F.QUOTE_DOUBLE, c = kn(a, l);
|
|
2562
2562
|
break;
|
|
2563
2563
|
/* istanbul ignore next should not happen */
|
|
2564
2564
|
default: return n(e, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${i}`), {
|
|
@@ -2697,10 +2697,10 @@ function Nn(e, t, n, r) {
|
|
|
2697
2697
|
let u;
|
|
2698
2698
|
try {
|
|
2699
2699
|
let a = l.resolve(i, (e) => r(n ?? t, "TAG_RESOLVE_FAILED", e), e.options);
|
|
2700
|
-
u = S(a) ? a : new
|
|
2700
|
+
u = S(a) ? a : new F(a);
|
|
2701
2701
|
} catch (e) {
|
|
2702
2702
|
let a = e instanceof Error ? e.message : String(e);
|
|
2703
|
-
r(n ?? t, "TAG_RESOLVE_FAILED", a), u = new
|
|
2703
|
+
r(n ?? t, "TAG_RESOLVE_FAILED", a), u = new F(i);
|
|
2704
2704
|
}
|
|
2705
2705
|
return u.range = s, u.source = i, a && (u.type = a), c && (u.tag = c), l.format && (u.format = l.format), o && (u.comment = o), u;
|
|
2706
2706
|
}
|
|
@@ -2787,7 +2787,7 @@ function zn(e, t, n, r, { spaceBefore: i, comment: a, anchor: o, tag: s, end: c
|
|
|
2787
2787
|
return o && (u.anchor = o.source.substring(1), u.anchor === "" && l(o, "BAD_ALIAS", "Anchor cannot be an empty string")), i && (u.spaceBefore = !0), a && (u.comment = a, u.range[2] = c), u;
|
|
2788
2788
|
}
|
|
2789
2789
|
function Bn({ options: e }, { offset: t, source: n, end: r }, i) {
|
|
2790
|
-
let a = new
|
|
2790
|
+
let a = new fe(n.substring(1));
|
|
2791
2791
|
a.source === "" && i(t, "BAD_ALIAS", "Alias cannot be an empty string"), a.source.endsWith(":") && i(t + n.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", !0);
|
|
2792
2792
|
let o = t + n.length, s = gn(r, o, e.strict, i);
|
|
2793
2793
|
return a.range = [
|
|
@@ -2853,7 +2853,7 @@ var Wn = class {
|
|
|
2853
2853
|
this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (e, t, n, r) => {
|
|
2854
2854
|
let i = Hn(e);
|
|
2855
2855
|
r ? this.warnings.push(new sn(i, t, n)) : this.errors.push(new on(i, t, n));
|
|
2856
|
-
}, this.directives = new
|
|
2856
|
+
}, this.directives = new M({ version: e.version || "1.2" }), this.options = e;
|
|
2857
2857
|
}
|
|
2858
2858
|
decorate(e, t) {
|
|
2859
2859
|
let { comment: n, afterEmptyLine: r } = Un(this.prelude);
|
|
@@ -2961,7 +2961,7 @@ function Gn(e, t = !0, n) {
|
|
|
2961
2961
|
return null;
|
|
2962
2962
|
}
|
|
2963
2963
|
function Kn(e, t) {
|
|
2964
|
-
let { implicitKey: n = !1, indent: r, inFlow: i = !1, offset: a = -1, type: o = "PLAIN" } = t, s =
|
|
2964
|
+
let { implicitKey: n = !1, indent: r, inFlow: i = !1, offset: a = -1, type: o = "PLAIN" } = t, s = Fe({
|
|
2965
2965
|
type: o,
|
|
2966
2966
|
value: e
|
|
2967
2967
|
}, {
|
|
@@ -3040,7 +3040,7 @@ function qn(e, t, n = {}) {
|
|
|
3040
3040
|
}
|
|
3041
3041
|
default: o = "PLAIN";
|
|
3042
3042
|
}
|
|
3043
|
-
let c =
|
|
3043
|
+
let c = Fe({
|
|
3044
3044
|
type: o,
|
|
3045
3045
|
value: t
|
|
3046
3046
|
}, {
|
|
@@ -4346,7 +4346,7 @@ function Dr(e, t, n) {
|
|
|
4346
4346
|
typeof t == "function" ? r = t : n === void 0 && t && typeof t == "object" && (n = t);
|
|
4347
4347
|
let i = Er(e, n);
|
|
4348
4348
|
if (!i) return null;
|
|
4349
|
-
if (i.warnings.forEach((e) =>
|
|
4349
|
+
if (i.warnings.forEach((e) => Ve(i.options.logLevel, e)), i.errors.length > 0) {
|
|
4350
4350
|
if (i.options.logLevel !== "silent") throw i.errors[0];
|
|
4351
4351
|
i.errors = [];
|
|
4352
4352
|
}
|
|
@@ -4367,20 +4367,20 @@ function Or(e, t, n) {
|
|
|
4367
4367
|
//#endregion
|
|
4368
4368
|
//#region node_modules/yaml/browser/index.js
|
|
4369
4369
|
var kr = /* @__PURE__ */ a({
|
|
4370
|
-
Alias: () =>
|
|
4370
|
+
Alias: () => fe,
|
|
4371
4371
|
CST: () => ar,
|
|
4372
4372
|
Composer: () => Wn,
|
|
4373
4373
|
Document: () => nn,
|
|
4374
4374
|
Lexer: () => hr,
|
|
4375
4375
|
LineCounter: () => gr,
|
|
4376
|
-
Pair: () =>
|
|
4376
|
+
Pair: () => B,
|
|
4377
4377
|
Parser: () => Cr,
|
|
4378
|
-
Scalar: () =>
|
|
4378
|
+
Scalar: () => F,
|
|
4379
4379
|
Schema: () => en,
|
|
4380
4380
|
YAMLError: () => an,
|
|
4381
|
-
YAMLMap: () =>
|
|
4381
|
+
YAMLMap: () => V,
|
|
4382
4382
|
YAMLParseError: () => on,
|
|
4383
|
-
YAMLSeq: () =>
|
|
4383
|
+
YAMLSeq: () => nt,
|
|
4384
4384
|
YAMLWarning: () => sn,
|
|
4385
4385
|
isAlias: () => v,
|
|
4386
4386
|
isCollection: () => w,
|
|
@@ -6835,9 +6835,15 @@ var ti = class {
|
|
|
6835
6835
|
}
|
|
6836
6836
|
async upload(e, t = "uploads") {
|
|
6837
6837
|
let n = ei(e.name), r = `${t}/${crypto.randomUUID().replace(/-/g, "")}.${n}`;
|
|
6838
|
-
|
|
6838
|
+
await this.bucket.put(r, e.stream(), { httpMetadata: { contentType: e.type } });
|
|
6839
|
+
let i = r.replace(/^\//, ""), a = `/media/${i}`;
|
|
6840
|
+
if (this.publicDomain && this.publicDomain.trim().length > 0) {
|
|
6841
|
+
let e = this.publicDomain.replace(/\/+$/, ""), t = e.startsWith("http") ? e : `https://${e}`;
|
|
6842
|
+
a = t.includes("/media") ? `${t}/${i}` : `${t}/media/${i}`;
|
|
6843
|
+
}
|
|
6844
|
+
return {
|
|
6839
6845
|
key: r,
|
|
6840
|
-
url:
|
|
6846
|
+
url: a
|
|
6841
6847
|
};
|
|
6842
6848
|
}
|
|
6843
6849
|
async delete(e) {
|
|
@@ -7537,18 +7543,26 @@ async function pi(e, t) {
|
|
|
7537
7543
|
return [];
|
|
7538
7544
|
}
|
|
7539
7545
|
}
|
|
7540
|
-
function mi(e) {
|
|
7541
|
-
|
|
7546
|
+
async function mi(e, t, n) {
|
|
7547
|
+
try {
|
|
7548
|
+
let r = q(e), i = await t.prepare("SELECT treeId FROM tree_nodes WHERE contentId = ?").all(n), a = Array.isArray(i) ? i : i?.results || [];
|
|
7549
|
+
for (let e of a) await r.delete(`tree:default:${e.treeId}`), await r.delete(`tree:all:${e.treeId}`);
|
|
7550
|
+
} catch (e) {
|
|
7551
|
+
console.warn("[Cache] Failed to invalidate tree caches for node", e);
|
|
7552
|
+
}
|
|
7542
7553
|
}
|
|
7543
7554
|
function hi(e) {
|
|
7544
|
-
return
|
|
7555
|
+
return !e || !e.trim() ? null : e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().trim().replace(/[^a-z0-9\s-]/g, "").replace(/[\s-]+/g, "-").replace(/^-+|-+$/g, "") || null;
|
|
7545
7556
|
}
|
|
7546
7557
|
function gi(e) {
|
|
7558
|
+
return +(e === !0 || e === 1 || e === "1" || e === "true");
|
|
7559
|
+
}
|
|
7560
|
+
function _i(e) {
|
|
7547
7561
|
if (e == null || e === "null" || e === "" || typeof e == "string" && e.startsWith("draft-")) return null;
|
|
7548
7562
|
let t = Number(e);
|
|
7549
7563
|
return isNaN(t) ? null : t;
|
|
7550
7564
|
}
|
|
7551
|
-
function
|
|
7565
|
+
function vi(e) {
|
|
7552
7566
|
let t = { ...e };
|
|
7553
7567
|
for (let e of [
|
|
7554
7568
|
"id",
|
|
@@ -7577,10 +7591,10 @@ function _i(e) {
|
|
|
7577
7591
|
]) delete t[e];
|
|
7578
7592
|
return t;
|
|
7579
7593
|
}
|
|
7580
|
-
function
|
|
7581
|
-
return e ? typeof e == "string" ? (e.startsWith("ast_") && t.add(e), t) : Array.isArray(e) ? (e.forEach((e) =>
|
|
7594
|
+
function yi(e, t = /* @__PURE__ */ new Set()) {
|
|
7595
|
+
return e ? typeof e == "string" ? (e.startsWith("ast_") && t.add(e), t) : Array.isArray(e) ? (e.forEach((e) => yi(e, t)), t) : (typeof e == "object" && Object.values(e).forEach((e) => yi(e, t)), t) : t;
|
|
7582
7596
|
}
|
|
7583
|
-
async function
|
|
7597
|
+
async function bi(e, t, n) {
|
|
7584
7598
|
for (let r of n) {
|
|
7585
7599
|
let n = (await di(e, "\n SELECT id, storageKeyPrivate, isSystemVariant, parentAssetId, filename\n FROM assets WHERE id = ?\n ", [r]))[0];
|
|
7586
7600
|
if (!n || (await di(e, "SELECT 1 FROM node_assets WHERE assetId = ? LIMIT 1", [n.id])).length > 0) continue;
|
|
@@ -7599,7 +7613,7 @@ async function yi(e, t, n) {
|
|
|
7599
7613
|
await fi(e, `DELETE FROM node_assets WHERE assetId IN (${o})`, a), await fi(e, `DELETE FROM assets WHERE id IN (${o})`, a);
|
|
7600
7614
|
}
|
|
7601
7615
|
}
|
|
7602
|
-
async function
|
|
7616
|
+
async function xi(e, t, n) {
|
|
7603
7617
|
let r = {}, i = null;
|
|
7604
7618
|
if (t) {
|
|
7605
7619
|
let n = await e.prepare("\n WITH RECURSIVE ancestor_path(id, parentId, draftDataJson, dataJson, level) AS (\n SELECT t.id, t.parentId, c.draftDataJson, c.dataJson, 0\n FROM tree_nodes t\n INNER JOIN content_nodes c ON t.contentId = c.id\n WHERE t.id = ?\n UNION ALL\n SELECT t.id, t.parentId, c.draftDataJson, c.dataJson, ap.level + 1\n FROM tree_nodes t\n INNER JOIN content_nodes c ON t.contentId = c.id\n INNER JOIN ancestor_path ap ON t.id = ap.parentId\n )\n SELECT draftDataJson, dataJson FROM ancestor_path ORDER BY level ASC\n ").all(t), a = Array.isArray(n) ? n : n?.results || [];
|
|
@@ -7651,11 +7665,11 @@ X.get("/", async (e) => {
|
|
|
7651
7665
|
if (s) try {
|
|
7652
7666
|
let n = typeof s == "string" ? JSON.parse(s) : s, a = await t.prepare("SELECT id as treeNodeId, treeId, parentId FROM tree_nodes WHERE contentId = ? LIMIT 1").get(r), c = ui(e.env?.BUNDLED_DEFINITIONS).nodes?.[i.contentType] || {}, l = n.layoutId || null;
|
|
7653
7667
|
if (a) {
|
|
7654
|
-
let { resolvedLayoutId: e, inheritedFields: r } = await
|
|
7668
|
+
let { resolvedLayoutId: e, inheritedFields: r } = await xi(t, a.parentId, a.treeId);
|
|
7655
7669
|
(l === "inherit" || !l) && (l = e || c.defaultLayout || null);
|
|
7656
7670
|
for (let [e, t] of Object.entries(r)) (n[e] === void 0 || n[e] === null || n[e] === "") && t !== void 0 && (n[e] = t);
|
|
7657
7671
|
} else (l === "inherit" || !l) && (l = c.defaultLayout || null);
|
|
7658
|
-
let u = await si(t,
|
|
7672
|
+
let u = await si(t, vi(n));
|
|
7659
7673
|
Object.assign(o, u), o.resolvedLayoutId = l;
|
|
7660
7674
|
} catch {}
|
|
7661
7675
|
let c = await t.prepare("SELECT channelId FROM node_channels WHERE nodeId = ?").all(r);
|
|
@@ -7765,7 +7779,7 @@ X.get("/", async (e) => {
|
|
|
7765
7779
|
assetCount: e.assetCount || 0
|
|
7766
7780
|
}, i = e.draftDataJson || e.dataJson;
|
|
7767
7781
|
if (i) try {
|
|
7768
|
-
let e = typeof i == "string" ? JSON.parse(i) : i, n = await si(t,
|
|
7782
|
+
let e = typeof i == "string" ? JSON.parse(i) : i, n = await si(t, vi(e));
|
|
7769
7783
|
Object.assign(r, n);
|
|
7770
7784
|
} catch {}
|
|
7771
7785
|
return r;
|
|
@@ -7778,22 +7792,22 @@ X.get("/", async (e) => {
|
|
|
7778
7792
|
limit: f
|
|
7779
7793
|
});
|
|
7780
7794
|
}), X.post("/", async (e) => {
|
|
7781
|
-
let t = e.get("db"), n = await e.req.json(), r = n.node || n.activeNode || n, i = r.id || n.id, a = i != null && i !== "" && !isNaN(Number(i)) ? Number(i) : null, { title: o, slug: s, language: c, nodeType: l, contentType: u, isHidden: d, hidden: f, is_hidden: p, blocks: m, channels: h, trees: g, ..._ } = r, v =
|
|
7795
|
+
let t = e.get("db"), n = await e.req.json(), r = n.node || n.activeNode || n, i = r.id || n.id, a = i != null && i !== "" && !isNaN(Number(i)) ? Number(i) : null, { title: o, slug: s, language: c, nodeType: l, contentType: u, isHidden: d, hidden: f, is_hidden: p, blocks: m, channels: h, trees: g, ..._ } = r, v = vi(_), { cleanedData: y, assetRefs: b } = ii(v), x = gi(d === void 0 ? f === void 0 ? p : f : d), S = c || "en", C = l || u || "page", w = e.get("user")?.id || null, T = a, E = /* @__PURE__ */ new Set();
|
|
7782
7796
|
if (a) {
|
|
7783
7797
|
let n = await t.prepare("SELECT title, slug, contentType, language, draftDataJson, dataJson, publishedAt, status FROM content_nodes WHERE id = ?").get(a), r = n?.draftDataJson || n?.dataJson || "{}";
|
|
7784
7798
|
try {
|
|
7785
|
-
|
|
7799
|
+
yi(typeof r == "string" ? JSON.parse(r) : r, E);
|
|
7786
7800
|
} catch {}
|
|
7787
7801
|
if (m !== void 0) {
|
|
7788
7802
|
let e = await t.prepare("SELECT dataJson FROM content_blocks WHERE contentId = ? AND isDraft = 1").all(a);
|
|
7789
7803
|
(Array.isArray(e) ? e : e?.results || []).forEach((e) => {
|
|
7790
7804
|
try {
|
|
7791
|
-
|
|
7805
|
+
yi(typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson, E);
|
|
7792
7806
|
} catch {}
|
|
7793
7807
|
});
|
|
7794
7808
|
}
|
|
7795
7809
|
if (m === void 0 && o === void 0 && s === void 0 && h === void 0 && g === void 0 && Object.keys(v).length === 0) {
|
|
7796
|
-
if (await t.prepare("\n UPDATE content_nodes \n SET isHidden = ?, \n updatedById = ?, \n updatedAt = CURRENT_TIMESTAMP\n WHERE id = ?\n ").run(x, w, a), await q(e).clear(), n?.status === "published") {
|
|
7810
|
+
if (await t.prepare("\n UPDATE content_nodes \n SET isHidden = ?, \n updatedById = ?, \n updatedAt = CURRENT_TIMESTAMP\n WHERE id = ?\n ").run(x, w, a), await q(e).clear(), await mi(e, t, a), n?.status === "published") {
|
|
7797
7811
|
let r = await pi(t, a);
|
|
7798
7812
|
new Y(e.env).purgeSmart(e, t, a, n.slug, r);
|
|
7799
7813
|
}
|
|
@@ -7804,7 +7818,7 @@ X.get("/", async (e) => {
|
|
|
7804
7818
|
});
|
|
7805
7819
|
}
|
|
7806
7820
|
{
|
|
7807
|
-
let e = o === void 0 ? n?.title || "Untitled" : o, r = s === void 0 ? n?.slug ?? null :
|
|
7821
|
+
let e = o === void 0 ? n?.title || "Untitled" : o, r = s === void 0 ? n?.slug ?? null : hi(s), i = C || n?.contentType || "page", c = S || n?.language || "en", l = n?.draftDataJson || n?.dataJson || "{}", u = {};
|
|
7808
7822
|
try {
|
|
7809
7823
|
u = JSON.parse(l);
|
|
7810
7824
|
} catch {}
|
|
@@ -7815,7 +7829,7 @@ X.get("/", async (e) => {
|
|
|
7815
7829
|
await t.prepare("\n UPDATE content_nodes \n SET title = ?, \n slug = ?, \n language = ?,\n contentType = ?, \n isHidden = ?, \n status = 'draft', \n draftDataJson = ?, \n updatedById = ?, \n updatedAt = CURRENT_TIMESTAMP\n WHERE id = ?\n ").run(e, r, c, i, x, d, w, a);
|
|
7816
7830
|
}
|
|
7817
7831
|
} else {
|
|
7818
|
-
let e = o || "Untitled", n =
|
|
7832
|
+
let e = o || "Untitled", n = hi(s), r = JSON.stringify(y), i = await t.prepare("\n INSERT INTO content_nodes (contentType, title, slug, language, isHidden, status, draftDataJson, dataJson, createdById, updatedById)\n VALUES (?, ?, ?, ?, ?, 'draft', ?, NULL, ?, ?)\n ").run(C, e, n, S, x, r, w, w);
|
|
7819
7833
|
T = Number(i.lastInsertRowid);
|
|
7820
7834
|
}
|
|
7821
7835
|
if (h !== void 0 && Array.isArray(h) && T) {
|
|
@@ -7833,7 +7847,7 @@ X.get("/", async (e) => {
|
|
|
7833
7847
|
let i = Number(t.treeId) || t.treeId;
|
|
7834
7848
|
if (!e.has(i)) {
|
|
7835
7849
|
e.add(i);
|
|
7836
|
-
let a =
|
|
7850
|
+
let a = _i(t.parentId ?? t._draftParentId ?? null), o = typeof t.sortOrder == "number" ? t.sortOrder : 0;
|
|
7837
7851
|
n.push("(?, ?, ?, ?)"), r.push(i, T, a, o);
|
|
7838
7852
|
}
|
|
7839
7853
|
}
|
|
@@ -7864,9 +7878,9 @@ X.get("/", async (e) => {
|
|
|
7864
7878
|
let n = [...b, ...D];
|
|
7865
7879
|
await ai(t, T, n);
|
|
7866
7880
|
let r = new Set(n.map((e) => e.assetId)), i = new Set([...E].filter((e) => !r.has(e)));
|
|
7867
|
-
i.size > 0 && await
|
|
7881
|
+
i.size > 0 && await bi(t, ri(e.env), i);
|
|
7868
7882
|
}
|
|
7869
|
-
return await q(e).clear(), e.json({
|
|
7883
|
+
return await q(e).clear(), T && await mi(e, t, T), e.json({
|
|
7870
7884
|
success: !0,
|
|
7871
7885
|
id: T,
|
|
7872
7886
|
status: "draft"
|
|
@@ -7896,7 +7910,7 @@ X.get("/", async (e) => {
|
|
|
7896
7910
|
},
|
|
7897
7911
|
blocks: l
|
|
7898
7912
|
};
|
|
7899
|
-
await t.prepare("\n INSERT INTO node_revisions (nodeId, version, snapshotJson, createdById)\n VALUES (?, ?, ?, ?)\n ").run(i, u, JSON.stringify(d), a), await q(e).clear();
|
|
7913
|
+
await t.prepare("\n INSERT INTO node_revisions (nodeId, version, snapshotJson, createdById)\n VALUES (?, ?, ?, ?)\n ").run(i, u, JSON.stringify(d), a), await q(e).clear(), await mi(e, t, i);
|
|
7900
7914
|
let f = await pi(t, i);
|
|
7901
7915
|
return new Y(e.env).purgeSmart(e, t, i, o.slug, f), e.json({
|
|
7902
7916
|
success: !0,
|
|
@@ -7909,7 +7923,7 @@ X.get("/", async (e) => {
|
|
|
7909
7923
|
let t = e.get("db"), n = e.req.query("id");
|
|
7910
7924
|
if (!n) return e.json({ error: "Node ID required" }, 400);
|
|
7911
7925
|
let r = Number(n), i = await t.prepare("SELECT slug, status FROM content_nodes WHERE id = ?").get(r);
|
|
7912
|
-
if (await t.prepare("UPDATE content_nodes SET deletedAt = CURRENT_TIMESTAMP WHERE id = ?").run(r), await q(e).clear(), i && i.status === "published") {
|
|
7926
|
+
if (await t.prepare("UPDATE content_nodes SET deletedAt = CURRENT_TIMESTAMP WHERE id = ?").run(r), await q(e).clear(), await mi(e, t, r), i && i.status === "published") {
|
|
7913
7927
|
let n = await pi(t, r);
|
|
7914
7928
|
new Y(e.env).purgeSmart(e, t, r, i.slug, n);
|
|
7915
7929
|
}
|
|
@@ -7921,7 +7935,7 @@ X.get("/", async (e) => {
|
|
|
7921
7935
|
let t = e.get("db"), n = await e.req.json(), r = Number(n.id);
|
|
7922
7936
|
if (!r) return e.json({ error: "Node ID required" }, 400);
|
|
7923
7937
|
let i = await t.prepare("SELECT slug, status FROM content_nodes WHERE id = ?").get(r);
|
|
7924
|
-
if (await t.prepare("UPDATE content_nodes SET deletedAt = NULL WHERE id = ?").run(r), await q(e).clear(), i && i.status === "published") {
|
|
7938
|
+
if (await t.prepare("UPDATE content_nodes SET deletedAt = NULL WHERE id = ?").run(r), await q(e).clear(), await mi(e, t, r), i && i.status === "published") {
|
|
7925
7939
|
let n = await pi(t, r);
|
|
7926
7940
|
new Y(e.env).purgeSmart(e, t, r, i.slug, n);
|
|
7927
7941
|
}
|
|
@@ -7933,15 +7947,15 @@ X.get("/", async (e) => {
|
|
|
7933
7947
|
let t = e.get("db"), n = e.req.query("id");
|
|
7934
7948
|
if (!n) return e.json({ error: "Node ID required" }, 400);
|
|
7935
7949
|
let r = Number(n), i = await t.prepare("SELECT slug, status FROM content_nodes WHERE id = ?").get(r), a = await pi(t, r);
|
|
7936
|
-
return await t.prepare("DELETE FROM node_channels WHERE nodeId = ?").run(r), await t.prepare("DELETE FROM tree_nodes WHERE contentId = ?").run(r), await t.prepare("DELETE FROM content_blocks WHERE contentId = ?").run(r), await t.prepare("DELETE FROM node_revisions WHERE nodeId = ?").run(r), await t.prepare("DELETE FROM node_assets WHERE nodeId = ?").run(r), await t.prepare("DELETE FROM content_nodes WHERE id = ?").run(r), await q(e).clear(), i && i.status === "published" && new Y(e.env).purgeSmart(e, t, r, i.slug, a), e.json({
|
|
7950
|
+
return await mi(e, t, r), await t.prepare("DELETE FROM node_channels WHERE nodeId = ?").run(r), await t.prepare("DELETE FROM tree_nodes WHERE contentId = ?").run(r), await t.prepare("DELETE FROM content_blocks WHERE contentId = ?").run(r), await t.prepare("DELETE FROM node_revisions WHERE nodeId = ?").run(r), await t.prepare("DELETE FROM node_assets WHERE nodeId = ?").run(r), await t.prepare("DELETE FROM content_nodes WHERE id = ?").run(r), await q(e).clear(), i && i.status === "published" && new Y(e.env).purgeSmart(e, t, r, i.slug, a), e.json({
|
|
7937
7951
|
success: !0,
|
|
7938
7952
|
purgedNodeId: r
|
|
7939
7953
|
});
|
|
7940
7954
|
});
|
|
7941
7955
|
//#endregion
|
|
7942
7956
|
//#region server/routes/admin/trees.ts
|
|
7943
|
-
var
|
|
7944
|
-
function
|
|
7957
|
+
var Si = new e();
|
|
7958
|
+
function Ci(e, t = null) {
|
|
7945
7959
|
let n = [];
|
|
7946
7960
|
for (let r = 0; r < e.length; r++) {
|
|
7947
7961
|
let i = e[r];
|
|
@@ -7954,20 +7968,20 @@ function Si(e, t = null) {
|
|
|
7954
7968
|
id: a,
|
|
7955
7969
|
parentId: t,
|
|
7956
7970
|
sortOrder: r
|
|
7957
|
-
}), i.children && Array.isArray(i.children) && i.children.length > 0 && n.push(...
|
|
7971
|
+
}), i.children && Array.isArray(i.children) && i.children.length > 0 && n.push(...Ci(i.children, a));
|
|
7958
7972
|
}
|
|
7959
7973
|
}
|
|
7960
7974
|
return n;
|
|
7961
7975
|
}
|
|
7962
|
-
function
|
|
7976
|
+
function wi(e) {
|
|
7963
7977
|
if (e == null || e === "null" || e === "" || typeof e == "string" && e.startsWith("draft-")) return null;
|
|
7964
7978
|
let t = Number(e);
|
|
7965
7979
|
return isNaN(t) ? null : t;
|
|
7966
7980
|
}
|
|
7967
|
-
function
|
|
7981
|
+
function Ti(e) {
|
|
7968
7982
|
return +(e === !0 || e === 1 || e === "1" || e === "true");
|
|
7969
7983
|
}
|
|
7970
|
-
|
|
7984
|
+
Si.get("/tree.json", async (e) => {
|
|
7971
7985
|
try {
|
|
7972
7986
|
let t = e.get("db"), n = e.req.query("treeId") || "main-nav", r = e.req.query("preview") === "true", i = 1;
|
|
7973
7987
|
if (isNaN(Number(n))) {
|
|
@@ -7990,12 +8004,13 @@ xi.get("/tree.json", async (e) => {
|
|
|
7990
8004
|
}).map((e) => {
|
|
7991
8005
|
let t = {}, n = e.draftDataJson || e.dataJson;
|
|
7992
8006
|
if (n) try {
|
|
7993
|
-
|
|
8007
|
+
let e = typeof n == "string" ? JSON.parse(n) : n;
|
|
8008
|
+
e && typeof e == "object" && (t = e, delete t._isTreeDraft, delete t._draftParentId, delete t.nodeType, delete t.contentType, delete t.title, delete t.slug, delete t.hidden, delete t.is_hidden, delete t.isHidden, delete t.status);
|
|
7994
8009
|
} catch {}
|
|
7995
8010
|
let { dataJson: r, draftDataJson: i, ...a } = e, o = {
|
|
7996
8011
|
...a,
|
|
7997
8012
|
...t
|
|
7998
|
-
}, s =
|
|
8013
|
+
}, s = Number(e.isHidden) === 1 || o.hidden === !0 || o.hidden === 1 || o.hidden === "true", c = (e.status === "draft" || !e.status) && !!e.publishedAt;
|
|
7999
8014
|
return {
|
|
8000
8015
|
...o,
|
|
8001
8016
|
id: e.contentId,
|
|
@@ -8016,7 +8031,7 @@ xi.get("/tree.json", async (e) => {
|
|
|
8016
8031
|
} catch (t) {
|
|
8017
8032
|
return console.error("[CMS Tree API] GET Error:", t), e.json({ error: t.message || "Failed to fetch tree" }, 500);
|
|
8018
8033
|
}
|
|
8019
|
-
}),
|
|
8034
|
+
}), Si.post("/tree.json", async (e) => {
|
|
8020
8035
|
try {
|
|
8021
8036
|
let t = e.get("db"), n = await e.req.json(), r = n.treeId ? String(n.treeId).trim() : "main-nav", i = q(e), a = new Y(e.env), o = 1;
|
|
8022
8037
|
if (isNaN(Number(r))) {
|
|
@@ -8028,7 +8043,7 @@ xi.get("/tree.json", async (e) => {
|
|
|
8028
8043
|
}
|
|
8029
8044
|
} else o = Number(r);
|
|
8030
8045
|
if (n.tree && Array.isArray(n.tree)) {
|
|
8031
|
-
let r =
|
|
8046
|
+
let r = Ci(n.tree, null);
|
|
8032
8047
|
if (r.length > 0) for (let e = 0; e < r.length; e += 50) {
|
|
8033
8048
|
let n = r.slice(e, e + 50), i = n.map((e) => e.id), a = i.map(() => "?").join(","), s = "UPDATE tree_nodes SET \n";
|
|
8034
8049
|
s += "parentId = CASE id \n", n.forEach(() => {
|
|
@@ -8043,11 +8058,11 @@ xi.get("/tree.json", async (e) => {
|
|
|
8043
8058
|
c.push(e.id, e.sortOrder);
|
|
8044
8059
|
}), c.push(...i), c.push(o), await t.prepare(s).run(...c);
|
|
8045
8060
|
}
|
|
8046
|
-
return await i.clear(), a.purgeGlobalCache(e), e.json({ success: !0 });
|
|
8061
|
+
return await i.clear(), await a.purgeGlobalCache(e), e.json({ success: !0 });
|
|
8047
8062
|
}
|
|
8048
|
-
let { action: s, title: c, nodeType: l, parentId: u, contentId: d, nodeData: f = {}, pageData: p = {} } = n, m = Object.keys(f).length > 0 ? { ...f } : { ...p }, h =
|
|
8063
|
+
let { action: s, title: c, nodeType: l, parentId: u, contentId: d, nodeData: f = {}, pageData: p = {} } = n, m = Object.keys(f).length > 0 ? { ...f } : { ...p }, h = Ti(n.isHidden === void 0 ? m.isHidden === void 0 ? m.hidden : m.isHidden : n.isHidden);
|
|
8049
8064
|
delete m._isTreeDraft, delete m._draftParentId, delete m.isNew, delete m.nodeType, delete m.contentType, delete m.title, delete m.slug, delete m.hidden, delete m.is_hidden, delete m.isHidden, delete m.status;
|
|
8050
|
-
let g =
|
|
8065
|
+
let g = wi(u), _ = e.get("user")?.id || null;
|
|
8051
8066
|
if (s === "create") {
|
|
8052
8067
|
let r = m.slug || n.slug || c, s = r ? String(r).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "") : null;
|
|
8053
8068
|
if (s) {
|
|
@@ -8079,7 +8094,7 @@ xi.get("/tree.json", async (e) => {
|
|
|
8079
8094
|
let e = b.map(() => "(?, ?)").join(", "), n = b.flatMap((e) => [f, e]);
|
|
8080
8095
|
await t.prepare(`INSERT OR IGNORE INTO node_channels (nodeId, channelId) VALUES ${e}`).run(...n);
|
|
8081
8096
|
}
|
|
8082
|
-
return await i.clear(), a.purgeGlobalCache(e), e.json({
|
|
8097
|
+
return await i.clear(), await a.purgeGlobalCache(e), e.json({
|
|
8083
8098
|
success: !0,
|
|
8084
8099
|
id: f,
|
|
8085
8100
|
treeNodeId: v,
|
|
@@ -8117,14 +8132,14 @@ xi.get("/tree.json", async (e) => {
|
|
|
8117
8132
|
}
|
|
8118
8133
|
await t.prepare("DELETE FROM tree_nodes WHERE treeId = ? AND contentId = ?").run(o, d);
|
|
8119
8134
|
let r = await t.prepare("\n INSERT INTO tree_nodes (treeId, contentId, parentId, sortOrder)\n VALUES (?, ?, ?, 0)\n ").run(o, d, g), s = Number(r.lastInsertRowid);
|
|
8120
|
-
return await i.clear(), a.purgeGlobalCache(e), e.json({
|
|
8135
|
+
return await i.clear(), await a.purgeGlobalCache(e), e.json({
|
|
8121
8136
|
success: !0,
|
|
8122
8137
|
treeNodeId: s
|
|
8123
8138
|
});
|
|
8124
8139
|
}
|
|
8125
8140
|
if (s === "detach") {
|
|
8126
8141
|
let r = n.treeNodeId || n.contentId;
|
|
8127
|
-
return r ? (await t.prepare("\n UPDATE tree_nodes \n SET parentId = (SELECT parentId FROM tree_nodes WHERE (id = ? OR contentId = ?) AND treeId = ?) \n WHERE parentId = ? AND treeId = ?\n ").run(r, r, o, r, o), await t.prepare("DELETE FROM tree_nodes WHERE (id = ? OR contentId = ?) AND treeId = ?").run(r, r, o), await i.clear(), a.purgeGlobalCache(e), e.json({ success: !0 })) : e.json({ error: "treeNodeId or contentId required for detach" }, 400);
|
|
8142
|
+
return r ? (await t.prepare("\n UPDATE tree_nodes \n SET parentId = (SELECT parentId FROM tree_nodes WHERE (id = ? OR contentId = ?) AND treeId = ?) \n WHERE parentId = ? AND treeId = ?\n ").run(r, r, o, r, o), await t.prepare("DELETE FROM tree_nodes WHERE (id = ? OR contentId = ?) AND treeId = ?").run(r, r, o), await i.clear(), await a.purgeGlobalCache(e), e.json({ success: !0 })) : e.json({ error: "treeNodeId or contentId required for detach" }, 400);
|
|
8128
8143
|
}
|
|
8129
8144
|
return e.json({ error: "Invalid payload or action" }, 400);
|
|
8130
8145
|
} catch (t) {
|
|
@@ -8133,7 +8148,7 @@ xi.get("/tree.json", async (e) => {
|
|
|
8133
8148
|
details: t.message
|
|
8134
8149
|
}, 500);
|
|
8135
8150
|
}
|
|
8136
|
-
}),
|
|
8151
|
+
}), Si.get("/trees.json", async (e) => {
|
|
8137
8152
|
try {
|
|
8138
8153
|
let t = e.get("db"), n = await t.prepare("SELECT * FROM trees ORDER BY LOWER(label) ASC").all(), r = Array.isArray(n) ? n : n?.results || [], i = await t.prepare("SELECT channelId, treeId FROM channel_trees").all(), a = (Array.isArray(i) ? i : i?.results || []).reduce((e, t) => {
|
|
8139
8154
|
let n = Number(t.treeId), r = Number(t.channelId);
|
|
@@ -8141,7 +8156,8 @@ xi.get("/tree.json", async (e) => {
|
|
|
8141
8156
|
}, {}), o = r.map((e) => {
|
|
8142
8157
|
let t = {};
|
|
8143
8158
|
if (e.dataJson) try {
|
|
8144
|
-
|
|
8159
|
+
let n = typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson;
|
|
8160
|
+
n && typeof n == "object" && (t = n);
|
|
8145
8161
|
} catch {}
|
|
8146
8162
|
return {
|
|
8147
8163
|
id: e.id,
|
|
@@ -8150,7 +8166,7 @@ xi.get("/tree.json", async (e) => {
|
|
|
8150
8166
|
treeType: e.treeType ?? "",
|
|
8151
8167
|
channelId: e.channelId || null,
|
|
8152
8168
|
channels: a[e.id] || [],
|
|
8153
|
-
isHidden:
|
|
8169
|
+
isHidden: Number(e.isHidden) === 1,
|
|
8154
8170
|
createdById: e.createdById || null,
|
|
8155
8171
|
updatedById: e.updatedById || null,
|
|
8156
8172
|
createdAt: e.createdAt,
|
|
@@ -8162,7 +8178,7 @@ xi.get("/tree.json", async (e) => {
|
|
|
8162
8178
|
} catch {
|
|
8163
8179
|
return e.json([]);
|
|
8164
8180
|
}
|
|
8165
|
-
}),
|
|
8181
|
+
}), Si.post("/trees.json", async (e) => {
|
|
8166
8182
|
try {
|
|
8167
8183
|
let t = e.get("db"), n = await e.req.json(), r = n.id, i = r != null && r !== "" && !isNaN(Number(r)) ? Number(r) : null, a = `tree-${Date.now().toString(36)}`, o = (n.key || n.slug || a).toLowerCase().replace(/[^a-z0-9_-]/g, "-"), s = n.label?.trim() || o, c = n.treeType !== void 0 && n.treeType !== null ? n.treeType : n.type ?? "site", l = n.channelId !== void 0 && n.channelId !== null && Number(n.channelId) || null, u = +(n.isHidden === !0 || n.isHidden === 1 || n.isHidden === "true"), d = e.get("user")?.id || null, f = { ...n };
|
|
8168
8184
|
if (delete f.id, delete f.key, delete f.label, delete f.treeType, delete f.type, delete f.channelId, delete f.channels, delete f.isHidden, delete f.createdById, delete f.updatedById, delete f.createdAt, delete f.updatedAt, await t.prepare("SELECT id FROM trees WHERE key = ? AND id != ? LIMIT 1").get(o, i ?? -1)) return e.json({
|
|
@@ -8187,7 +8203,7 @@ xi.get("/tree.json", async (e) => {
|
|
|
8187
8203
|
await t.prepare(`INSERT OR IGNORE INTO channel_trees (channelId, treeId, key) VALUES ${n}`).run(...r);
|
|
8188
8204
|
}
|
|
8189
8205
|
}
|
|
8190
|
-
return await q(e).clear(), new Y(e.env).purgeGlobalCache(e), e.json({
|
|
8206
|
+
return await q(e).clear(), await new Y(e.env).purgeGlobalCache(e), e.json({
|
|
8191
8207
|
success: !0,
|
|
8192
8208
|
id: p,
|
|
8193
8209
|
key: o,
|
|
@@ -8201,12 +8217,12 @@ xi.get("/tree.json", async (e) => {
|
|
|
8201
8217
|
} catch (t) {
|
|
8202
8218
|
return console.error("[API Trees] Error saving tree:", t), e.json({ error: t.message || "Failed to save tree" }, 500);
|
|
8203
8219
|
}
|
|
8204
|
-
}),
|
|
8220
|
+
}), Si.delete("/trees.json", async (e) => {
|
|
8205
8221
|
let t = e.get("db"), n = e.req.query("id");
|
|
8206
8222
|
if (!n) return e.json({ error: "Tree ID required" }, 400);
|
|
8207
8223
|
let r = Number(n);
|
|
8208
8224
|
try {
|
|
8209
|
-
return await t.prepare("DELETE FROM trees WHERE id = ?").run(r), await t.prepare("DELETE FROM channel_trees WHERE treeId = ?").run(r), await t.prepare("DELETE FROM tree_nodes WHERE treeId = ?").run(r), await q(e).clear(), new Y(e.env).purgeGlobalCache(e), e.json({
|
|
8225
|
+
return await t.prepare("DELETE FROM trees WHERE id = ?").run(r), await t.prepare("DELETE FROM channel_trees WHERE treeId = ?").run(r), await t.prepare("DELETE FROM tree_nodes WHERE treeId = ?").run(r), await q(e).clear(), await new Y(e.env).purgeGlobalCache(e), e.json({
|
|
8210
8226
|
success: !0,
|
|
8211
8227
|
deletedTreeId: r
|
|
8212
8228
|
});
|
|
@@ -8216,8 +8232,8 @@ xi.get("/tree.json", async (e) => {
|
|
|
8216
8232
|
});
|
|
8217
8233
|
//#endregion
|
|
8218
8234
|
//#region server/routes/admin/channels.ts
|
|
8219
|
-
var
|
|
8220
|
-
|
|
8235
|
+
var Ei = new e();
|
|
8236
|
+
Ei.get("/", async (e) => {
|
|
8221
8237
|
try {
|
|
8222
8238
|
let t = e.get("db"), n = await t.prepare("SELECT * FROM channels ORDER BY id ASC").all(), r = Array.isArray(n) ? n : n?.results || [], i = await t.prepare("SELECT channelId, treeId, key, metaJson FROM channel_trees").all(), a = ((Array.isArray(i) ? i : i?.results || []) || []).reduce((e, t) => {
|
|
8223
8239
|
e[t.channelId] || (e[t.channelId] = []);
|
|
@@ -8283,7 +8299,7 @@ Ti.get("/", async (e) => {
|
|
|
8283
8299
|
error: t.message
|
|
8284
8300
|
}, 500);
|
|
8285
8301
|
}
|
|
8286
|
-
}),
|
|
8302
|
+
}), Ei.post("/", async (e) => {
|
|
8287
8303
|
try {
|
|
8288
8304
|
let t = e.get("db"), n = await e.req.json(), r = n.id, i = r != null && r !== "" && !isNaN(Number(r)) ? Number(r) : null, { key: a, label: o, channelType: s = "website", domain: c = "localhost", baseUrl: l = "http://localhost:4321", defaultLanguage: u = "en", isHidden: d = !1, trees: f = [], createdById: p = null, updatedById: m = null, id: h, createdAt: g, updatedAt: _, ...v } = n, y = a?.trim() || "main", b = o?.trim() || "Untitled Channel", x = Array.isArray(f) ? f : [], S = JSON.stringify(v || {}), C = e.get("user")?.id || m || p || null;
|
|
8289
8305
|
if (await t.prepare("SELECT id FROM channels WHERE key = ? AND id != ? LIMIT 1").get(y, i ?? -1)) return e.json({
|
|
@@ -8320,7 +8336,7 @@ Ti.get("/", async (e) => {
|
|
|
8320
8336
|
details: t.message
|
|
8321
8337
|
}, 500);
|
|
8322
8338
|
}
|
|
8323
|
-
}),
|
|
8339
|
+
}), Ei.delete("/", async (e) => {
|
|
8324
8340
|
let t = e.get("db"), n = e.req.query("id");
|
|
8325
8341
|
if (!n) return e.json({ error: "Channel ID required" }, 400);
|
|
8326
8342
|
let r = Number(n);
|
|
@@ -8338,9 +8354,9 @@ Ti.get("/", async (e) => {
|
|
|
8338
8354
|
});
|
|
8339
8355
|
//#endregion
|
|
8340
8356
|
//#region server/routes/admin/schemas.ts
|
|
8341
|
-
var
|
|
8357
|
+
var Di = new e(), Oi = null, ki = (e) => {
|
|
8342
8358
|
try {
|
|
8343
|
-
if (!
|
|
8359
|
+
if (!Oi) {
|
|
8344
8360
|
let t = li(e.env?.BUNDLED_DEFINITIONS || Ar), n = t.userTemplate || {
|
|
8345
8361
|
id: "userTemplate",
|
|
8346
8362
|
label: "User Account",
|
|
@@ -8377,7 +8393,7 @@ var Ei = new e(), Di = null, Oi = (e) => {
|
|
|
8377
8393
|
}
|
|
8378
8394
|
}
|
|
8379
8395
|
};
|
|
8380
|
-
|
|
8396
|
+
Oi = {
|
|
8381
8397
|
channelTemplate: t.channelTemplate || null,
|
|
8382
8398
|
treeTemplate: t.treeTemplate || null,
|
|
8383
8399
|
userTemplate: n,
|
|
@@ -8389,7 +8405,7 @@ var Ei = new e(), Di = null, Oi = (e) => {
|
|
|
8389
8405
|
blockLayouts: t.blockLayouts || {}
|
|
8390
8406
|
};
|
|
8391
8407
|
}
|
|
8392
|
-
return e.json(
|
|
8408
|
+
return e.json(Oi, 200, { "Cache-Control": "public, max-age=300, stale-while-revalidate=86400" });
|
|
8393
8409
|
} catch (t) {
|
|
8394
8410
|
return console.error("[CMS API] Error loading schemas:", t), e.json({
|
|
8395
8411
|
error: "Failed to load schemas",
|
|
@@ -8397,10 +8413,10 @@ var Ei = new e(), Di = null, Oi = (e) => {
|
|
|
8397
8413
|
}, 500);
|
|
8398
8414
|
}
|
|
8399
8415
|
};
|
|
8400
|
-
|
|
8416
|
+
Di.get("/", ki), Di.get("/schemas.json", ki);
|
|
8401
8417
|
//#endregion
|
|
8402
8418
|
//#region server/routes/admin/validation.ts
|
|
8403
|
-
var
|
|
8419
|
+
var Ai = new e(), ji = {
|
|
8404
8420
|
node: "content_nodes",
|
|
8405
8421
|
nodes: "content_nodes",
|
|
8406
8422
|
content_node: "content_nodes",
|
|
@@ -8412,7 +8428,7 @@ var ki = new e(), Ai = {
|
|
|
8412
8428
|
user: "users",
|
|
8413
8429
|
users: "users",
|
|
8414
8430
|
user_account: "user_accounts"
|
|
8415
|
-
},
|
|
8431
|
+
}, Mi = {
|
|
8416
8432
|
content_nodes: [
|
|
8417
8433
|
"id",
|
|
8418
8434
|
"title",
|
|
@@ -8469,11 +8485,11 @@ var ki = new e(), Ai = {
|
|
|
8469
8485
|
"createdAt"
|
|
8470
8486
|
]
|
|
8471
8487
|
};
|
|
8472
|
-
|
|
8488
|
+
Ai.post("/validate-unique", async (e) => {
|
|
8473
8489
|
try {
|
|
8474
8490
|
let t = e.get("db"), { entityType: n, field: r, value: i, excludeId: a } = await e.req.json();
|
|
8475
8491
|
if (!r || i == null || String(i).trim() === "") return e.json({ isUnique: !0 });
|
|
8476
|
-
let o =
|
|
8492
|
+
let o = ji[n] || "content_nodes", s = r.replace(/[^a-zA-Z0-9_]/g, ""), c = (Mi[o] || Mi.content_nodes).includes(s), l = -1;
|
|
8477
8493
|
if (a != null && String(a).trim() !== "") {
|
|
8478
8494
|
let e = Number(a);
|
|
8479
8495
|
l = isNaN(e) ? String(a) : e;
|
|
@@ -8485,7 +8501,7 @@ ki.post("/validate-unique", async (e) => {
|
|
|
8485
8501
|
} catch (t) {
|
|
8486
8502
|
return console.error("[API Validation] Error validating global uniqueness:", t), e.json({ error: "Failed to validate uniqueness" }, 500);
|
|
8487
8503
|
}
|
|
8488
|
-
}),
|
|
8504
|
+
}), Ai.post("/validate-unique-sibling", async (e) => {
|
|
8489
8505
|
try {
|
|
8490
8506
|
let t = e.get("db"), { slug: n, treeId: r, parentId: i, excludeTreeNodeId: a } = await e.req.json();
|
|
8491
8507
|
if (!n || !String(n).trim() || !r) return e.json({ isUnique: !0 });
|
|
@@ -8512,8 +8528,8 @@ ki.post("/validate-unique", async (e) => {
|
|
|
8512
8528
|
});
|
|
8513
8529
|
//#endregion
|
|
8514
8530
|
//#region server/routes/admin/stats.ts
|
|
8515
|
-
var
|
|
8516
|
-
|
|
8531
|
+
var Ni = new e();
|
|
8532
|
+
Ni.get("/", async (e) => {
|
|
8517
8533
|
try {
|
|
8518
8534
|
let t = e.get("db"), n = await t.prepare("\n SELECT \n COUNT(*) as total,\n SUM(CASE WHEN isHidden = 0 THEN 1 ELSE 0 END) as published,\n SUM(CASE WHEN isHidden = 1 THEN 1 ELSE 0 END) as hidden\n FROM content_nodes\n ").get(), r = Number(n?.total) || 0, i = Number(n?.published) || 0, a = Number(n?.hidden) || 0, o = await t.prepare("\n SELECT \n (SELECT COUNT(*) FROM channels) as totalChannels,\n (SELECT COUNT(*) FROM trees) as totalTrees,\n (SELECT COUNT(*) FROM users) as totalUsers\n ").get(), s = await t.prepare("\n SELECT contentType as type, COUNT(*) as count \n FROM content_nodes \n GROUP BY contentType \n ORDER BY count DESC\n ").all(), c = Array.isArray(s) ? s : s?.results || [], l = await t.prepare("\n SELECT id, title, slug, contentType, isHidden, status, updatedAt \n FROM content_nodes \n ORDER BY updatedAt DESC \n LIMIT 5\n ").all(), u = (Array.isArray(l) ? l : l?.results || []).map((e) => ({
|
|
8519
8535
|
...e,
|
|
@@ -8569,19 +8585,19 @@ async function Q(e, t, n = []) {
|
|
|
8569
8585
|
}
|
|
8570
8586
|
return [];
|
|
8571
8587
|
}
|
|
8572
|
-
async function
|
|
8588
|
+
async function Pi(e, t, n = []) {
|
|
8573
8589
|
let r = e.prepare(t);
|
|
8574
8590
|
if (typeof r.bind == "function") return await r.bind(...n).run();
|
|
8575
8591
|
if (typeof r.run == "function") return await r.run(...n);
|
|
8576
8592
|
}
|
|
8577
|
-
function
|
|
8593
|
+
function Fi(e, t, n) {
|
|
8578
8594
|
let r = e || (t ? `/media/${t}` : "");
|
|
8579
8595
|
return r && n && r.startsWith(`https://${n}/`) && !r.includes("/media/") && (r = r.replace(`https://${n}/`, `https://${n}/media/`)), r;
|
|
8580
8596
|
}
|
|
8581
|
-
async function
|
|
8597
|
+
async function Ii(e, t, n) {
|
|
8582
8598
|
let r = new Y(e.env), i = await Q(t, "\n SELECT cdnUrl, storageKeyPrivate\n FROM assets\n WHERE id = ? OR parentAssetId = ?\n ", [n, n]), a = [];
|
|
8583
8599
|
for (let t of i) {
|
|
8584
|
-
let n =
|
|
8600
|
+
let n = Fi(t.cdnUrl, t.storageKeyPrivate, e.env?.CDN_DOMAIN);
|
|
8585
8601
|
n && a.push(n);
|
|
8586
8602
|
}
|
|
8587
8603
|
let o = await Q(t, "\n SELECT DISTINCT cn.id, cn.slug, cn.status\n FROM node_assets na\n INNER JOIN content_nodes cn ON na.nodeId = cn.id\n LEFT JOIN assets crop ON na.assetId = crop.id\n WHERE cn.status = 'published' AND (\n na.assetId = ?\n OR crop.parentAssetId = ?\n OR crop.id = (SELECT parentAssetId FROM assets WHERE id = ?)\n )\n ", [
|
|
@@ -8658,7 +8674,7 @@ Z.get("/", async (e) => {
|
|
|
8658
8674
|
...JSON.parse(t.dataJson || "{}")
|
|
8659
8675
|
};
|
|
8660
8676
|
} catch {}
|
|
8661
|
-
let r =
|
|
8677
|
+
let r = Fi(t.cdnUrl, t.storageKeyPrivate, e.env?.CDN_DOMAIN);
|
|
8662
8678
|
return {
|
|
8663
8679
|
id: t.id,
|
|
8664
8680
|
filename: t.filename || "Untitled Asset",
|
|
@@ -8701,7 +8717,7 @@ Z.get("/", async (e) => {
|
|
|
8701
8717
|
let y = e.env.CDN_DOMAIN, b = v.replace(/^\//, ""), x = y ? `https://${y}/media/${b}` : `/media/${b}`, S = i.type || "application/octet-stream", C = i.size || 0, w = e.get("userId"), T = typeof w == "string" && w.trim().length > 0 ? w : null;
|
|
8702
8718
|
T && (await Q(t, "SELECT id FROM users WHERE id = ?", [T])).length === 0 && (T = null);
|
|
8703
8719
|
let E = +!!h;
|
|
8704
|
-
await
|
|
8720
|
+
await Pi(t, "\n INSERT INTO assets (id, filename, mimeType, sizeBytes, storageKeyPrivate, cdnUrl, createdById, isSystemVariant, parentAssetId, cropCoordinatesJson)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n ", [
|
|
8705
8721
|
p,
|
|
8706
8722
|
i.name,
|
|
8707
8723
|
S,
|
|
@@ -8716,7 +8732,7 @@ Z.get("/", async (e) => {
|
|
|
8716
8732
|
let D = x;
|
|
8717
8733
|
if (s) {
|
|
8718
8734
|
let n = await Q(t, "SELECT cdnUrl, storageKeyPrivate FROM assets WHERE id = ?", [s]);
|
|
8719
|
-
n.length > 0 && (D =
|
|
8735
|
+
n.length > 0 && (D = Fi(n[0].cdnUrl, n[0].storageKeyPrivate, y)), await Ii(e, t, s);
|
|
8720
8736
|
}
|
|
8721
8737
|
return e.json({
|
|
8722
8738
|
id: p,
|
|
@@ -8758,7 +8774,7 @@ Z.get("/", async (e) => {
|
|
|
8758
8774
|
...JSON.parse(i.dataJson || "{}")
|
|
8759
8775
|
};
|
|
8760
8776
|
} catch {}
|
|
8761
|
-
let l =
|
|
8777
|
+
let l = Fi(i.cdnUrl, i.storageKeyPrivate, e.env?.CDN_DOMAIN);
|
|
8762
8778
|
return e.json({
|
|
8763
8779
|
id: i.id,
|
|
8764
8780
|
filename: i.filename,
|
|
@@ -8785,7 +8801,7 @@ Z.get("/", async (e) => {
|
|
|
8785
8801
|
createdAt: t.createdAt,
|
|
8786
8802
|
parentAssetId: t.parentAssetId || i.id,
|
|
8787
8803
|
cropCoordinates: n,
|
|
8788
|
-
url:
|
|
8804
|
+
url: Fi(t.cdnUrl, t.storageKeyPrivate, e.env?.CDN_DOMAIN),
|
|
8789
8805
|
originalUrl: l
|
|
8790
8806
|
};
|
|
8791
8807
|
})
|
|
@@ -8801,18 +8817,18 @@ Z.get("/", async (e) => {
|
|
|
8801
8817
|
try {
|
|
8802
8818
|
o = JSON.parse(a.dataJson || "{}");
|
|
8803
8819
|
} catch {}
|
|
8804
|
-
return r.title !== void 0 && (o.title = r.title), r.alt !== void 0 && (o.alt = r.alt), r.description !== void 0 && (o.description = r.description), await
|
|
8820
|
+
return r.title !== void 0 && (o.title = r.title), r.alt !== void 0 && (o.alt = r.alt), r.description !== void 0 && (o.description = r.description), await Pi(t, "UPDATE assets SET filename = ?, dataJson = ?, updatedAt = CURRENT_TIMESTAMP WHERE id = ?", [
|
|
8805
8821
|
r.filename === void 0 ? a.filename : r.filename,
|
|
8806
8822
|
JSON.stringify(o),
|
|
8807
8823
|
n
|
|
8808
|
-
]), await
|
|
8824
|
+
]), await Ii(e, t, n), e.json({ success: !0 });
|
|
8809
8825
|
} catch (t) {
|
|
8810
8826
|
return console.error("❌ [Asset Update Error]:", t), e.json({ error: "Failed to update asset" }, 500);
|
|
8811
8827
|
}
|
|
8812
8828
|
}), Z.delete("/:id", async (e) => {
|
|
8813
8829
|
try {
|
|
8814
8830
|
let t = u(e), n = e.req.param("id"), r = (await Q(t, "SELECT id, filename, isSystemVariant FROM assets WHERE id = ?", [n]))[0];
|
|
8815
|
-
return r ? (await
|
|
8831
|
+
return r ? (await Ii(e, t, n), r.isSystemVariant ? await Pi(t, "UPDATE assets SET deletedAt = CURRENT_TIMESTAMP WHERE id = ?", [n]) : await Pi(t, "UPDATE assets\n SET deletedAt = CURRENT_TIMESTAMP\n WHERE id = ? OR parentAssetId = ? OR (isSystemVariant = 1 AND (filename LIKE ? OR filename LIKE ?))", [
|
|
8816
8832
|
n,
|
|
8817
8833
|
n,
|
|
8818
8834
|
`crop_%${r.filename ? r.filename.replace(/\.[^/.]+$/, "") : ""}%`,
|
|
@@ -8833,12 +8849,12 @@ Z.get("/", async (e) => {
|
|
|
8833
8849
|
let t = u(e), n = await e.req.json(), r = n.id || n.assetId;
|
|
8834
8850
|
if (!r) return e.json({ error: "Asset ID required" }, 400);
|
|
8835
8851
|
let i = (await Q(t, "SELECT id, filename FROM assets WHERE id = ?", [r]))[0];
|
|
8836
|
-
return i ? (await
|
|
8852
|
+
return i ? (await Pi(t, "UPDATE assets \n SET deletedAt = NULL \n WHERE id = ? OR parentAssetId = ? OR (isSystemVariant = 1 AND (filename LIKE ? OR filename LIKE ?))", [
|
|
8837
8853
|
r,
|
|
8838
8854
|
r,
|
|
8839
8855
|
`crop_%${i.filename ? i.filename.replace(/\.[^/.]+$/, "") : ""}%`,
|
|
8840
8856
|
`%${r}%`
|
|
8841
|
-
]), await
|
|
8857
|
+
]), await Ii(e, t, r), e.json({
|
|
8842
8858
|
success: !0,
|
|
8843
8859
|
id: r,
|
|
8844
8860
|
restored: !0
|
|
@@ -8853,7 +8869,7 @@ Z.get("/", async (e) => {
|
|
|
8853
8869
|
try {
|
|
8854
8870
|
let t = u(e), n = ri(e.env), r = e.req.param("id"), i = (await Q(t, "SELECT id, filename, storageKeyPrivate, isSystemVariant FROM assets WHERE id = ?", [r]))[0];
|
|
8855
8871
|
if (!i) return e.json({ error: "Asset not found" }, 404);
|
|
8856
|
-
await
|
|
8872
|
+
await Ii(e, t, r);
|
|
8857
8873
|
let a = [i];
|
|
8858
8874
|
i.isSystemVariant || (a = [i, ...await Q(t, "SELECT id, storageKeyPrivate FROM assets \n WHERE parentAssetId = ? OR (isSystemVariant = 1 AND (filename LIKE ? OR filename LIKE ?))", [
|
|
8859
8875
|
r,
|
|
@@ -8869,7 +8885,7 @@ Z.get("/", async (e) => {
|
|
|
8869
8885
|
}
|
|
8870
8886
|
}
|
|
8871
8887
|
let s = o.map(() => "?").join(",");
|
|
8872
|
-
return await
|
|
8888
|
+
return await Pi(t, `DELETE FROM node_assets WHERE assetId IN (${s})`, o), await Pi(t, `DELETE FROM assets WHERE id IN (${s})`, o), e.json({
|
|
8873
8889
|
success: !0,
|
|
8874
8890
|
id: r,
|
|
8875
8891
|
purged: !0,
|
|
@@ -8885,8 +8901,8 @@ Z.get("/", async (e) => {
|
|
|
8885
8901
|
});
|
|
8886
8902
|
//#endregion
|
|
8887
8903
|
//#region server/routes/public/node.ts
|
|
8888
|
-
var
|
|
8889
|
-
function
|
|
8904
|
+
var Li = new e();
|
|
8905
|
+
function Ri() {
|
|
8890
8906
|
return {
|
|
8891
8907
|
fullPath: /* @__PURE__ */ new Map(),
|
|
8892
8908
|
treeEdges: /* @__PURE__ */ new Map(),
|
|
@@ -8894,10 +8910,10 @@ function Li() {
|
|
|
8894
8910
|
assetUrls: /* @__PURE__ */ new Map()
|
|
8895
8911
|
};
|
|
8896
8912
|
}
|
|
8897
|
-
function
|
|
8913
|
+
function zi(...e) {
|
|
8898
8914
|
return e.map((e) => String(e ?? "")).join(":");
|
|
8899
8915
|
}
|
|
8900
|
-
function
|
|
8916
|
+
function Bi(e, t) {
|
|
8901
8917
|
let n = Date.now();
|
|
8902
8918
|
if (e && String(e).trim() !== "") {
|
|
8903
8919
|
let t = Date.parse(e);
|
|
@@ -8909,7 +8925,7 @@ function zi(e, t) {
|
|
|
8909
8925
|
}
|
|
8910
8926
|
return !0;
|
|
8911
8927
|
}
|
|
8912
|
-
async function
|
|
8928
|
+
async function Vi(e, t, n) {
|
|
8913
8929
|
let r = t.filter((e) => e.componentId === "content-feed" || e.componentId === "article-list");
|
|
8914
8930
|
await Promise.all(r.map(async (t) => {
|
|
8915
8931
|
let r = t.data || {}, i = r.nodeType || "article", a = Number(r.limit) || 12, o = r.sortBy || "updatedAt", s = "FROM content_nodes WHERE contentType = ? AND isHidden = 0 AND (status = 'published' OR status IS NULL)", c = [i];
|
|
@@ -8930,7 +8946,7 @@ async function Bi(e, t, n) {
|
|
|
8930
8946
|
if (e.dataJson) try {
|
|
8931
8947
|
t = typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson;
|
|
8932
8948
|
} catch {}
|
|
8933
|
-
return
|
|
8949
|
+
return Bi(t.startShowingAt, t.stopShowingAt) ? {
|
|
8934
8950
|
id: e.id,
|
|
8935
8951
|
title: e.title,
|
|
8936
8952
|
slug: e.slug,
|
|
@@ -8947,7 +8963,7 @@ async function Bi(e, t, n) {
|
|
|
8947
8963
|
}
|
|
8948
8964
|
}));
|
|
8949
8965
|
}
|
|
8950
|
-
async function
|
|
8966
|
+
async function Hi(e, t, n, r, i = !1, a) {
|
|
8951
8967
|
if (!t) return { blocks: [] };
|
|
8952
8968
|
let o = await e.prepare("\n WITH RECURSIVE ancestor_path(id, contentId, title, slug, parentId, level) AS (\n SELECT t.id, t.contentId, c.title, c.slug, t.parentId, 0\n FROM tree_nodes t\n INNER JOIN content_nodes c ON t.contentId = c.id\n WHERE t.id = ? OR c.id = ?\n\n UNION ALL\n\n SELECT t.id, t.contentId, c.title, c.slug, t.parentId, ap.level + 1\n FROM tree_nodes t\n INNER JOIN content_nodes c ON t.contentId = c.id\n INNER JOIN ancestor_path ap ON t.id = ap.parentId\n )\n SELECT *\n FROM ancestor_path\n ORDER BY level ASC\n ").all(t, t), s = Array.isArray(o) ? o : o?.results || [];
|
|
8953
8969
|
if (!s || s.length === 0) return { blocks: [] };
|
|
@@ -9003,10 +9019,10 @@ async function Vi(e, t, n, r, i = !1, a) {
|
|
|
9003
9019
|
try {
|
|
9004
9020
|
a = (typeof t.dataJson == "string" ? JSON.parse(t.dataJson) : t.dataJson) || {};
|
|
9005
9021
|
} catch {}
|
|
9006
|
-
let o = a.hidden === !0 || a.hidden === 1 || a.hidden === "1" || a.hidden === "true", s =
|
|
9022
|
+
let o = a.hidden === !0 || a.hidden === 1 || a.hidden === "1" || a.hidden === "true", s = Bi(a.startShowingAt, a.stopShowingAt);
|
|
9007
9023
|
if (!i && (o || !s)) return null;
|
|
9008
|
-
let c = t.elementType || t.componentId || "text-block", l = r.blocks?.[c]?.fields || r.elements?.[c]?.fields || r.components?.[c]?.fields || {}, u = String(a.blockId || a._instanceId || a.id || t.blockId || t.id), d =
|
|
9009
|
-
return d = await si(e, d), d =
|
|
9024
|
+
let c = t.elementType || t.componentId || "text-block", l = r.blocks?.[c]?.fields || r.elements?.[c]?.fields || r.components?.[c]?.fields || {}, u = String(a.blockId || a._instanceId || a.id || t.blockId || t.id), d = Ui(a, l);
|
|
9025
|
+
return d = await si(e, d), d = Wi(d), d.blockId = u, {
|
|
9010
9026
|
region: t.region || n,
|
|
9011
9027
|
block: {
|
|
9012
9028
|
instanceId: t.id,
|
|
@@ -9026,7 +9042,7 @@ async function Vi(e, t, n, r, i = !1, a) {
|
|
|
9026
9042
|
}
|
|
9027
9043
|
return { blocks: [] };
|
|
9028
9044
|
}
|
|
9029
|
-
function
|
|
9045
|
+
function Ui(e, t = {}) {
|
|
9030
9046
|
let n = {};
|
|
9031
9047
|
for (let [r, i] of Object.entries(e)) {
|
|
9032
9048
|
if (r.endsWith("_meta") || r === "disabledRegions" || r === "hidden" || r === "is_hidden" || r === "isHidden" || r === "status" || r === "startShowingAt" || r === "stopShowingAt" || r === "slug" || r === "title" || r === "id" || r.startsWith("_")) continue;
|
|
@@ -9035,14 +9051,14 @@ function Hi(e, t = {}) {
|
|
|
9035
9051
|
}
|
|
9036
9052
|
return n;
|
|
9037
9053
|
}
|
|
9038
|
-
function
|
|
9039
|
-
if (Array.isArray(e)) return e.map(
|
|
9054
|
+
function Wi(e) {
|
|
9055
|
+
if (Array.isArray(e)) return e.map(Wi);
|
|
9040
9056
|
if (!e || typeof e != "object") return e;
|
|
9041
9057
|
if (typeof e.id == "string" && e.id.startsWith("ast_") && typeof e.url == "string") {
|
|
9042
9058
|
let t = e.metadataOverrides || {}, n = e.variants && typeof e.variants == "object" ? e.variants : {}, r = Object.entries(n).find(([, t]) => t?.id === e.id)?.[0], i = r ? {
|
|
9043
9059
|
...t,
|
|
9044
9060
|
...t.crops?.[r] || {}
|
|
9045
|
-
} : t, a = Object.fromEntries(Object.entries(n).filter(([, t]) => t?.id !== e.id).map(([t, n]) => [t,
|
|
9061
|
+
} : t, a = Object.fromEntries(Object.entries(n).filter(([, t]) => t?.id !== e.id).map(([t, n]) => [t, Wi({
|
|
9046
9062
|
...n,
|
|
9047
9063
|
title: n?.title ?? e.title ?? "",
|
|
9048
9064
|
alt: n?.alt ?? e.alt ?? "",
|
|
@@ -9056,9 +9072,9 @@ function Ui(e) {
|
|
|
9056
9072
|
...Object.keys(a).length > 0 ? { variants: a } : {}
|
|
9057
9073
|
};
|
|
9058
9074
|
}
|
|
9059
|
-
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e,
|
|
9075
|
+
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, Wi(t)]));
|
|
9060
9076
|
}
|
|
9061
|
-
async function
|
|
9077
|
+
async function Gi(e, t, n) {
|
|
9062
9078
|
if (typeof t == "string") {
|
|
9063
9079
|
if (!t.includes("#node:") && !t.includes("data-node-id") && !t.includes("#asset:") && !t.includes("data-asset-id")) return t;
|
|
9064
9080
|
let r = (e, t) => {
|
|
@@ -9084,9 +9100,9 @@ async function Wi(e, t, n) {
|
|
|
9084
9100
|
return await Promise.all(Array.from(t.matchAll(h)).map(async (t) => {
|
|
9085
9101
|
let i = t[1], a = r(i, "data-node-id"), o = r(i, "data-tree-id");
|
|
9086
9102
|
if (!a || !o) return;
|
|
9087
|
-
let s = await
|
|
9103
|
+
let s = await qi(e, a, o, n);
|
|
9088
9104
|
if (s?.treeNodeId) {
|
|
9089
|
-
let t = await
|
|
9105
|
+
let t = await Zi(e, String(s.treeNodeId), o, n);
|
|
9090
9106
|
m.set(`${a}:${o}`, t);
|
|
9091
9107
|
}
|
|
9092
9108
|
})), t.replace(h, (e, t) => {
|
|
@@ -9106,39 +9122,39 @@ async function Wi(e, t, n) {
|
|
|
9106
9122
|
return /href\s*=\s*["'][^"']*["']/i.test(_) ? _ = _.replace(/href\s*=\s*["'][^"']*["']/i, `href="${g || "/"}"`) : _ += ` href="${g || "/"}"`, `<a ${_}>`;
|
|
9107
9123
|
});
|
|
9108
9124
|
}
|
|
9109
|
-
if (Array.isArray(t)) return Promise.all(t.map((t) =>
|
|
9125
|
+
if (Array.isArray(t)) return Promise.all(t.map((t) => Gi(e, t, n)));
|
|
9110
9126
|
if (t && typeof t == "object") {
|
|
9111
9127
|
if (typeof t.href == "string" && (t.href.startsWith("#node:") || t.href.startsWith("#asset:"))) return {
|
|
9112
9128
|
...t,
|
|
9113
|
-
href: await
|
|
9129
|
+
href: await Ki(e, t, n)
|
|
9114
9130
|
};
|
|
9115
|
-
let r = await Promise.all(Object.entries(t).map(async ([t, r]) => [t, await
|
|
9131
|
+
let r = await Promise.all(Object.entries(t).map(async ([t, r]) => [t, await Gi(e, r, n)]));
|
|
9116
9132
|
return Object.fromEntries(r);
|
|
9117
9133
|
}
|
|
9118
9134
|
return t;
|
|
9119
9135
|
}
|
|
9120
|
-
async function
|
|
9136
|
+
async function Ki(e, t, n) {
|
|
9121
9137
|
let r = t.href.match(/^#node:(.+)$/), i = t.href.match(/^#asset:(.+)$/);
|
|
9122
|
-
if (i) return
|
|
9138
|
+
if (i) return Yi(e, i[1], n);
|
|
9123
9139
|
if (!r) return t.href;
|
|
9124
9140
|
let a = r[1];
|
|
9125
9141
|
if (t.treeId) {
|
|
9126
|
-
let r = await
|
|
9142
|
+
let r = await qi(e, a, String(t.treeId), n);
|
|
9127
9143
|
if (r?.treeNodeId) {
|
|
9128
|
-
let i = await
|
|
9144
|
+
let i = await Zi(e, String(r.treeNodeId), String(t.treeId), n);
|
|
9129
9145
|
if (i) return i;
|
|
9130
9146
|
}
|
|
9131
9147
|
}
|
|
9132
|
-
let o = await
|
|
9148
|
+
let o = await Ji(e, a, n);
|
|
9133
9149
|
return o === void 0 ? "#" : `/${o}`;
|
|
9134
9150
|
}
|
|
9135
|
-
async function
|
|
9136
|
-
let i =
|
|
9151
|
+
async function qi(e, t, n, r) {
|
|
9152
|
+
let i = zi(t, n), a = r.treeEdges.get(i);
|
|
9137
9153
|
if (a) return a;
|
|
9138
9154
|
let o = e.prepare("\n SELECT id as treeNodeId\n FROM tree_nodes\n WHERE contentId = ?\n AND treeId = ?\n LIMIT 1\n ").get(t, n);
|
|
9139
9155
|
return r.treeEdges.set(i, Promise.resolve(o)), o;
|
|
9140
9156
|
}
|
|
9141
|
-
async function
|
|
9157
|
+
async function Ji(e, t, n) {
|
|
9142
9158
|
let r = String(t), i = n.nodeSlugs.get(r);
|
|
9143
9159
|
if (i) return i;
|
|
9144
9160
|
let a = (async () => {
|
|
@@ -9147,7 +9163,7 @@ async function qi(e, t, n) {
|
|
|
9147
9163
|
})();
|
|
9148
9164
|
return n.nodeSlugs.set(r, a), a;
|
|
9149
9165
|
}
|
|
9150
|
-
async function
|
|
9166
|
+
async function Yi(e, t, n) {
|
|
9151
9167
|
let r = String(t), i = n.assetUrls.get(r);
|
|
9152
9168
|
if (i) return i;
|
|
9153
9169
|
let a = (async () => {
|
|
@@ -9156,7 +9172,7 @@ async function Ji(e, t, n) {
|
|
|
9156
9172
|
})();
|
|
9157
9173
|
return n.assetUrls.set(r, a), a;
|
|
9158
9174
|
}
|
|
9159
|
-
function
|
|
9175
|
+
function Xi(e) {
|
|
9160
9176
|
let t = e.socialImage;
|
|
9161
9177
|
if (!t || typeof t != "object") return null;
|
|
9162
9178
|
let n = (e, t) => {
|
|
@@ -9187,9 +9203,9 @@ function Yi(e) {
|
|
|
9187
9203
|
])
|
|
9188
9204
|
};
|
|
9189
9205
|
}
|
|
9190
|
-
async function
|
|
9206
|
+
async function Zi(e, t, n, r) {
|
|
9191
9207
|
if (!t) return "";
|
|
9192
|
-
let i =
|
|
9208
|
+
let i = zi(t, n);
|
|
9193
9209
|
if (r) {
|
|
9194
9210
|
let e = r.fullPath.get(i);
|
|
9195
9211
|
if (e) return e;
|
|
@@ -9204,7 +9220,7 @@ async function Xi(e, t, n, r) {
|
|
|
9204
9220
|
})();
|
|
9205
9221
|
return r && r.fullPath.set(i, a), a;
|
|
9206
9222
|
}
|
|
9207
|
-
async function
|
|
9223
|
+
async function Qi(e, t, n, r, i) {
|
|
9208
9224
|
let a = {}, o = null;
|
|
9209
9225
|
if (t) {
|
|
9210
9226
|
let n = await e.prepare("\n WITH RECURSIVE ancestor_path(id, contentId, title, slug, parentId, level) AS (\n SELECT t.id, t.contentId, c.title, c.slug, t.parentId, 0\n FROM tree_nodes t\n INNER JOIN content_nodes c ON t.contentId = c.id\n WHERE t.id = ? OR c.id = ?\n\n UNION ALL\n\n SELECT t.id, t.contentId, c.title, c.slug, t.parentId, ap.level + 1\n FROM tree_nodes t\n INNER JOIN content_nodes c ON t.contentId = c.id\n INNER JOIN ancestor_path ap ON t.id = ap.parentId\n )\n SELECT c.dataJson, c.draftDataJson\n FROM ancestor_path ap\n INNER JOIN content_nodes c ON ap.contentId = c.id\n ORDER BY ap.level ASC\n ").all(t, t), i = Array.isArray(n) ? n : n?.results || [], s = /* @__PURE__ */ new Set([
|
|
@@ -9242,20 +9258,20 @@ async function Zi(e, t, n, r, i) {
|
|
|
9242
9258
|
inheritedFields: a
|
|
9243
9259
|
};
|
|
9244
9260
|
}
|
|
9245
|
-
function
|
|
9261
|
+
function $i(e) {
|
|
9246
9262
|
let t = Number(e?.env?.CMS_NODE_CACHE_TTL);
|
|
9247
9263
|
return Number.isFinite(t) && t >= 60 ? Math.floor(t) : 300;
|
|
9248
9264
|
}
|
|
9249
|
-
async function
|
|
9265
|
+
async function ea(e, t, n, r) {
|
|
9250
9266
|
try {
|
|
9251
9267
|
await e.set(t, n, r);
|
|
9252
9268
|
} catch (e) {
|
|
9253
9269
|
console.warn("[CMS Cache] Failed to write node response to cache:", e);
|
|
9254
9270
|
}
|
|
9255
9271
|
}
|
|
9256
|
-
|
|
9272
|
+
Li.get("/*", async (e) => {
|
|
9257
9273
|
try {
|
|
9258
|
-
let t = e.get("db"), n =
|
|
9274
|
+
let t = e.get("db"), n = Ri(), r = new URL(e.req.url).pathname.match(/\/node\/(.+)$/), i = (r ? r[1] : "home").replace(/^\/+|\/+$/g, ""), a = e.req.query("channelId") || e.req.query("channel") || "1", o = e.req.query("lang") || "en", s = e.req.query("preview") === "true", c = isNaN(Number(a)) ? await t.prepare("SELECT * FROM channels WHERE key = ?").get(a) : await t.prepare("SELECT * FROM channels WHERE id = ?").get(Number(a));
|
|
9259
9275
|
if (!c) return e.json({ error: `Channel '${a}' not found` }, 404);
|
|
9260
9276
|
let l = c.status === "disabled" || c.status === "inactive" || c.isEnabled === 0 || c.isEnabled === !1;
|
|
9261
9277
|
if (!s && l) return e.json({ error: `Channel '${c.key || a}' is currently inactive` }, 404);
|
|
@@ -9264,38 +9280,33 @@ Ii.get("/*", async (e) => {
|
|
|
9264
9280
|
let t = await f.get(p);
|
|
9265
9281
|
if (t) return e.header("X-Cache", "HIT"), e.json(t);
|
|
9266
9282
|
}
|
|
9267
|
-
let m = ui(e.env?.BUNDLED_DEFINITIONS), h =
|
|
9268
|
-
|
|
9269
|
-
|
|
9270
|
-
|
|
9271
|
-
|
|
9272
|
-
|
|
9273
|
-
|
|
9274
|
-
|
|
9275
|
-
|
|
9276
|
-
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
|
|
9281
|
-
|
|
9282
|
-
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
|
-
|
|
9286
|
-
|
|
9287
|
-
|
|
9288
|
-
|
|
9289
|
-
|
|
9290
|
-
if (e === r || r === "home" && (e === "" || e === "home")) {
|
|
9291
|
-
g = t, _ = t;
|
|
9292
|
-
break;
|
|
9293
|
-
}
|
|
9283
|
+
let m = ui(e.env?.BUNDLED_DEFINITIONS), h = /^\d+$/.test(i), g = null, _ = null, v = e.req.query("treeId"), y = i.split("/"), b = y[y.length - 1], x = "/" + i.replace(/^\/+|\/+$/g, ""), S = `
|
|
9284
|
+
SELECT
|
|
9285
|
+
cn.*,
|
|
9286
|
+
tn.id as treeNodeId,
|
|
9287
|
+
tn.parentId,
|
|
9288
|
+
tn.treeId
|
|
9289
|
+
FROM content_nodes cn
|
|
9290
|
+
INNER JOIN tree_nodes tn
|
|
9291
|
+
ON cn.id = tn.contentId
|
|
9292
|
+
${u === null ? "" : "INNER JOIN node_channels nc ON cn.id = nc.nodeId"}
|
|
9293
|
+
WHERE cn.slug = ?
|
|
9294
|
+
${u === null ? "" : "AND nc.channelId = ?"}
|
|
9295
|
+
`, C = u === null ? [b] : [b, u], w = await t.prepare(S).all(...C), T = Array.isArray(w) ? w : w?.results || [];
|
|
9296
|
+
if (T.length > 0) {
|
|
9297
|
+
let e = await Promise.all(T.map(async (e) => ({
|
|
9298
|
+
candidate: e,
|
|
9299
|
+
calculatedPath: await Zi(t, String(e.treeNodeId), String(e.treeId), n)
|
|
9300
|
+
}))), r = x.replace(/^\/+|\/+$/g, "");
|
|
9301
|
+
for (let { candidate: t, calculatedPath: n } of e) {
|
|
9302
|
+
let e = n.replace(/^\/+|\/+$/g, "");
|
|
9303
|
+
if (e === r || r === "home" && (e === "" || e === "home")) {
|
|
9304
|
+
g = t, _ = t;
|
|
9305
|
+
break;
|
|
9294
9306
|
}
|
|
9295
9307
|
}
|
|
9296
|
-
!g && e.length === 1 && (g = u === null ? await t.prepare("SELECT * FROM content_nodes WHERE slug = ?").get(r) : await t.prepare("\n SELECT cn.*\n FROM content_nodes cn\n INNER JOIN node_channels nc\n ON cn.id = nc.nodeId\n WHERE cn.slug = ?\n AND nc.channelId = ?\n ").get(r, u));
|
|
9297
9308
|
}
|
|
9298
|
-
if (!g) return e.json({ error: `Node '${i}' not found for Channel '${a}'` }, 404);
|
|
9309
|
+
if (!g && y.length === 1 && (g = u === null ? await t.prepare("SELECT * FROM content_nodes WHERE slug = ?").get(b) : await t.prepare("\n SELECT cn.*\n FROM content_nodes cn\n INNER JOIN node_channels nc\n ON cn.id = nc.nodeId\n WHERE cn.slug = ?\n AND nc.channelId = ?\n ").get(b, u)), !g && h && (g = u === null ? await t.prepare("SELECT * FROM content_nodes WHERE id = ?").get(Number(i)) : await t.prepare("\n SELECT cn.*\n FROM content_nodes cn\n INNER JOIN node_channels nc\n ON cn.id = nc.nodeId\n WHERE cn.id = ?\n AND nc.channelId = ?\n ").get(Number(i), u)), !g) return e.json({ error: `Node '${i}' not found for Channel '${a}'` }, 404);
|
|
9299
9310
|
if (!_) {
|
|
9300
9311
|
let e = v ? [g.id, v] : [g.id];
|
|
9301
9312
|
_ = await t.prepare(`
|
|
@@ -9309,41 +9320,41 @@ Ii.get("/*", async (e) => {
|
|
|
9309
9320
|
LIMIT 1
|
|
9310
9321
|
`).get(...e);
|
|
9311
9322
|
}
|
|
9312
|
-
let
|
|
9323
|
+
let E = _?.treeId || v || "main-nav", D = _?.parentId || null, ee = _?.treeNodeId ? await Zi(t, String(_.treeNodeId), String(E), n) : `/${(g.slug || "").replace(/^\/+|\/+$/g, "")}`, O = {
|
|
9313
9324
|
id: g.id,
|
|
9314
9325
|
title: g.title,
|
|
9315
9326
|
slug: g.slug,
|
|
9316
9327
|
language: g.language || o || "en",
|
|
9317
|
-
path:
|
|
9328
|
+
path: ee === "" ? "/" : ee,
|
|
9318
9329
|
nodeType: g.contentType,
|
|
9319
9330
|
createdAt: g.createdAt,
|
|
9320
9331
|
updatedAt: g.updatedAt
|
|
9321
|
-
},
|
|
9322
|
-
|
|
9323
|
-
Object.assign(
|
|
9332
|
+
}, k = g.contentType || "node", A = m.nodes?.[k] || Object.values(m.nodes || {})[0] || {}, te = { ...A.fields || {} };
|
|
9333
|
+
A.tabs && Object.values(A.tabs).forEach((e) => {
|
|
9334
|
+
Object.assign(te, e.fields || {});
|
|
9324
9335
|
});
|
|
9325
|
-
let
|
|
9326
|
-
if (
|
|
9327
|
-
|
|
9336
|
+
let ne = {}, re = null, ie = null, ae = !1, j = {}, oe = s && g.draftDataJson ? g.draftDataJson : g.dataJson || g.draftDataJson;
|
|
9337
|
+
if (oe) try {
|
|
9338
|
+
j = typeof oe == "string" ? JSON.parse(oe) : oe;
|
|
9328
9339
|
} catch {}
|
|
9329
|
-
|
|
9330
|
-
let
|
|
9331
|
-
for (let [e, t] of Object.entries(
|
|
9332
|
-
let
|
|
9333
|
-
|
|
9334
|
-
let
|
|
9335
|
-
delete
|
|
9336
|
-
let
|
|
9337
|
-
if (!s && (
|
|
9338
|
-
let
|
|
9340
|
+
j.disabledRegions && (ne = j.disabledRegions), ae = j.hidden === !0 || j.hidden === 1 || j.hidden === "1" || j.hidden === "true", re = j.startShowingAt || null, ie = j.stopShowingAt || null;
|
|
9341
|
+
let M = j.layoutId, se = M && M !== "inherit", { resolvedLayoutId: ce, inheritedFields: le } = await Qi(t, D, E, s, te), ue = se ? M : ce || A.defaultLayout || null;
|
|
9342
|
+
for (let [e, t] of Object.entries(le)) (j[e] === void 0 || j[e] === null || j[e] === "" || j[e] === "inherit") && t !== void 0 && (j[e] = t);
|
|
9343
|
+
let N = await si(t, Ui(j, te));
|
|
9344
|
+
N = Wi(N), N = await Gi(t, N, n);
|
|
9345
|
+
let P = Xi(N);
|
|
9346
|
+
delete N.socialImage, delete N.fbImage, delete N.xImage, delete N.whatsappImage, P && (N.socialImages = P), O.slug = g.slug, O.title = g.title, Object.assign(O, N), O.layoutId = ue;
|
|
9347
|
+
let de = Number(g.isHidden) === 1 || ae, fe = !Bi(re, ie);
|
|
9348
|
+
if (!s && (de || fe)) return e.json({ error: "Node is hidden or outside its scheduled publishing window" }, 404);
|
|
9349
|
+
let pe = [];
|
|
9339
9350
|
if (_?.treeNodeId) {
|
|
9340
|
-
let e = await t.prepare("\n SELECT\n t.id as treeNodeId,\n t.contentId as id,\n c.title,\n c.slug,\n c.language,\n c.contentType as nodeType,\n c.isHidden,\n c.dataJson,\n c.draftDataJson\n FROM tree_nodes t\n INNER JOIN content_nodes c\n ON t.contentId = c.id\n WHERE t.parentId = ?\n AND t.treeId = ?\n ORDER BY t.sortOrder ASC\n ").all(_.treeNodeId,
|
|
9341
|
-
|
|
9351
|
+
let e = await t.prepare("\n SELECT\n t.id as treeNodeId,\n t.contentId as id,\n c.title,\n c.slug,\n c.language,\n c.contentType as nodeType,\n c.isHidden,\n c.dataJson,\n c.draftDataJson\n FROM tree_nodes t\n INNER JOIN content_nodes c\n ON t.contentId = c.id\n WHERE t.parentId = ?\n AND t.treeId = ?\n ORDER BY t.sortOrder ASC\n ").all(_.treeNodeId, E), n = Array.isArray(e) ? e : e?.results || [], r = O.path === "/" ? "" : O.path;
|
|
9352
|
+
pe = n.map((e) => {
|
|
9342
9353
|
let t = {}, n = s && e.draftDataJson ? e.draftDataJson : e.dataJson;
|
|
9343
9354
|
try {
|
|
9344
9355
|
t = (typeof n == "string" ? JSON.parse(n) : n) || {};
|
|
9345
9356
|
} catch {}
|
|
9346
|
-
let i =
|
|
9357
|
+
let i = Number(e.isHidden) === 1 || t.hidden === !0 || t.hidden === 1 || t.hidden === "1", a = Bi(t.startShowingAt, t.stopShowingAt), o = (e.slug || "").replace(/^\/+|\/+$/g, "");
|
|
9347
9358
|
return !s && (i || !a) ? null : {
|
|
9348
9359
|
treeNodeId: e.treeNodeId,
|
|
9349
9360
|
id: e.id,
|
|
@@ -9355,18 +9366,18 @@ Ii.get("/*", async (e) => {
|
|
|
9355
9366
|
};
|
|
9356
9367
|
}).filter(Boolean);
|
|
9357
9368
|
}
|
|
9358
|
-
|
|
9359
|
-
let
|
|
9360
|
-
|
|
9361
|
-
let
|
|
9369
|
+
O.children = pe;
|
|
9370
|
+
let me = +!!s, F = await t.prepare("\n SELECT *\n FROM content_blocks\n WHERE contentId = ?\n AND isDraft = ?\n ORDER BY sortOrder ASC\n ").all(g.id, me), he = Array.isArray(F) ? F : F?.results || [];
|
|
9371
|
+
he.length === 0 && !s && (F = await t.prepare("\n SELECT *\n FROM content_blocks\n WHERE contentId = ?\n ORDER BY sortOrder ASC\n ").all(g.id), he = Array.isArray(F) ? F : F?.results || []);
|
|
9372
|
+
let I = {}, L = {}, ge = await Promise.all(he.map(async (e) => {
|
|
9362
9373
|
let r = e.region || "main", i = {};
|
|
9363
9374
|
try {
|
|
9364
9375
|
i = (typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson) || {};
|
|
9365
9376
|
} catch {}
|
|
9366
|
-
let a = i.hidden === !0 || i.hidden === 1 || i.hidden === "1" || i.hidden === "true", o =
|
|
9377
|
+
let a = i.hidden === !0 || i.hidden === 1 || i.hidden === "1" || i.hidden === "true", o = Bi(i.startShowingAt, i.stopShowingAt);
|
|
9367
9378
|
if (!s && (a || !o)) return null;
|
|
9368
|
-
let c = e.elementType || e.componentId || "text-block", l = m.blocks?.[c]?.fields || m.elements?.[c]?.fields || m.components?.[c]?.fields || {}, u = String(i.blockId || i._instanceId || i.id || e.blockId || e.id), d =
|
|
9369
|
-
return d = await si(t, d), d =
|
|
9379
|
+
let c = e.elementType || e.componentId || "text-block", l = m.blocks?.[c]?.fields || m.elements?.[c]?.fields || m.components?.[c]?.fields || {}, u = String(i.blockId || i._instanceId || i.id || e.blockId || e.id), d = Ui(i, l);
|
|
9380
|
+
return d = await si(t, d), d = Wi(d), d = await Gi(t, d, n), d.blockId = u, {
|
|
9370
9381
|
region: r,
|
|
9371
9382
|
block: {
|
|
9372
9383
|
instanceId: e.id,
|
|
@@ -9376,8 +9387,8 @@ Ii.get("/*", async (e) => {
|
|
|
9376
9387
|
}
|
|
9377
9388
|
};
|
|
9378
9389
|
}));
|
|
9379
|
-
for (let e of
|
|
9380
|
-
let
|
|
9390
|
+
for (let e of ge) e && (I[e.region] || (I[e.region] = [], L[e.region] = { isInherited: !1 }), I[e.region].push(e.block));
|
|
9391
|
+
let _e = {
|
|
9381
9392
|
header: {
|
|
9382
9393
|
label: "Header",
|
|
9383
9394
|
inherit: "parent"
|
|
@@ -9386,33 +9397,33 @@ Ii.get("/*", async (e) => {
|
|
|
9386
9397
|
label: "Footer",
|
|
9387
9398
|
inherit: "parent"
|
|
9388
9399
|
},
|
|
9389
|
-
...(
|
|
9400
|
+
...(ue ? m.nodeLayouts?.[ue] || m.layouts?.[ue] : null)?.regions || { main: { label: "Content" } }
|
|
9390
9401
|
};
|
|
9391
|
-
for (let [e, r] of Object.entries(
|
|
9392
|
-
let i =
|
|
9393
|
-
if (
|
|
9394
|
-
let r = await
|
|
9395
|
-
if (r.blocks.length > 0 && (
|
|
9402
|
+
for (let [e, r] of Object.entries(_e)) {
|
|
9403
|
+
let i = I[e] && I[e].length > 0, a = !!ne[e];
|
|
9404
|
+
if (I[e] || (I[e] = [], L[e] = { isInherited: !1 }), (r?.inherit === "parent" || r?.inherit === !0 || r?.inherit === "true" || e === "header" || e === "footer") && !i && !a && D) {
|
|
9405
|
+
let r = await Hi(t, D, e, m, s, n);
|
|
9406
|
+
if (r.blocks.length > 0 && (I[e] = r.blocks, L[e] = {
|
|
9396
9407
|
isInherited: !0,
|
|
9397
9408
|
inheritedFromId: r.inheritedFromId,
|
|
9398
9409
|
inheritedFromTitle: r.inheritedFromTitle
|
|
9399
|
-
}, r.subRegions)) for (let [t, n] of Object.entries(r.subRegions)) t !== e && (
|
|
9410
|
+
}, r.subRegions)) for (let [t, n] of Object.entries(r.subRegions)) t !== e && (I[t] = n, L[t] = {
|
|
9400
9411
|
isInherited: !0,
|
|
9401
9412
|
inheritedFromId: r.inheritedFromId,
|
|
9402
9413
|
inheritedFromTitle: r.inheritedFromTitle
|
|
9403
9414
|
});
|
|
9404
9415
|
}
|
|
9405
9416
|
}
|
|
9406
|
-
await Promise.all(Object.keys(
|
|
9407
|
-
let
|
|
9417
|
+
await Promise.all(Object.keys(I).map((e) => Vi(t, I[e], u)));
|
|
9418
|
+
let ve = {
|
|
9408
9419
|
channelId: u || d,
|
|
9409
|
-
treeId:
|
|
9410
|
-
language:
|
|
9411
|
-
node:
|
|
9412
|
-
content:
|
|
9413
|
-
regionMeta:
|
|
9420
|
+
treeId: E,
|
|
9421
|
+
language: O.language,
|
|
9422
|
+
node: O,
|
|
9423
|
+
content: I,
|
|
9424
|
+
regionMeta: L
|
|
9414
9425
|
};
|
|
9415
|
-
return s || (e.header("X-Cache", "MISS"), await
|
|
9426
|
+
return s || (e.header("X-Cache", "MISS"), await ea(f, p, ve, $i(e))), e.json(ve);
|
|
9416
9427
|
} catch (t) {
|
|
9417
9428
|
console.error("[CMS Public API] Error fetching node by path:", t);
|
|
9418
9429
|
let n = e.env?.ENVIRONMENT === "development";
|
|
@@ -9424,8 +9435,8 @@ Ii.get("/*", async (e) => {
|
|
|
9424
9435
|
});
|
|
9425
9436
|
//#endregion
|
|
9426
9437
|
//#region server/routes/public/tree.ts
|
|
9427
|
-
var
|
|
9428
|
-
function
|
|
9438
|
+
var ta = new e();
|
|
9439
|
+
function na(e, t) {
|
|
9429
9440
|
let n = /* @__PURE__ */ new Date();
|
|
9430
9441
|
if (e && String(e).trim() !== "") {
|
|
9431
9442
|
let t = new Date(e);
|
|
@@ -9437,14 +9448,14 @@ function ta(e, t) {
|
|
|
9437
9448
|
}
|
|
9438
9449
|
return !0;
|
|
9439
9450
|
}
|
|
9440
|
-
async function
|
|
9451
|
+
async function ra(e, t, n, r) {
|
|
9441
9452
|
try {
|
|
9442
9453
|
await e.set(t, n, r);
|
|
9443
9454
|
} catch (e) {
|
|
9444
9455
|
console.warn("[CMS Cache] Failed to write tree response to cache:", e);
|
|
9445
9456
|
}
|
|
9446
9457
|
}
|
|
9447
|
-
|
|
9458
|
+
ta.get("/:treeParam", async (e) => {
|
|
9448
9459
|
try {
|
|
9449
9460
|
let t = e.get("db"), n = e.req.param("treeParam"), r = e.req.query("channelId") || e.req.query("channel") || "default", i = e.req.query("preview") === "true";
|
|
9450
9461
|
if (r && r !== "default" && r !== "all") {
|
|
@@ -9460,7 +9471,7 @@ ea.get("/:treeParam", async (e) => {
|
|
|
9460
9471
|
if (t) return e.header("X-Cache", "HIT"), e.json(t);
|
|
9461
9472
|
}
|
|
9462
9473
|
let s = !isNaN(Number(n)), c = s ? await t.prepare("SELECT * FROM trees WHERE id = ?").get(Number(n)) : await t.prepare("SELECT * FROM trees WHERE key = ?").get(n);
|
|
9463
|
-
if (c && c.isHidden && !i) return e.json({ error: `Tree '${n}' is hidden` }, 404);
|
|
9474
|
+
if (c && Number(c.isHidden) === 1 && !i) return e.json({ error: `Tree '${n}' is hidden` }, 404);
|
|
9464
9475
|
let l = c?.id || (s ? Number(n) : null), u = {};
|
|
9465
9476
|
if (c && c.dataJson) try {
|
|
9466
9477
|
let t = typeof c.dataJson == "string" ? JSON.parse(c.dataJson) : c.dataJson, r = e.env?.BUNDLED_DEFINITIONS, i = ui(r), a = (i.trees?.[c.treeType || n] || i.trees?.site || {}).fields || {};
|
|
@@ -9498,7 +9509,7 @@ ea.get("/:treeParam", async (e) => {
|
|
|
9498
9509
|
return (f.get(n) || []).map((e) => {
|
|
9499
9510
|
let n = p.get(String(e.treeNodeId)) || {}, r = {};
|
|
9500
9511
|
for (let [e, t] of Object.entries(n)) e !== "_isTreeDraft" && e !== "_draftParentId" && e !== "isNew" && e !== "hidden" && e !== "is_hidden" && e !== "isHidden" && e !== "status" && (r[e] = t);
|
|
9501
|
-
let a = !i && (e.status === "draft" || e.status === "new"), o =
|
|
9512
|
+
let a = !i && (e.status === "draft" || e.status === "new"), o = Number(e.isHidden) === 1 || a || n.hidden === !0 || n.hidden === 1 || n.hidden === "1" || n.hidden === "true", s = na(n.startShowingAt, n.stopShowingAt), c = (e.slug || "").replace(/^\/+|\/+$/g, ""), l = (!e.parentId || e.parentId === "null" || e.parentId === "") && (c === "home" || c === "homee") ? "/" : `${t}/${c}`.replace(/\/+/g, "/"), u = {
|
|
9502
9513
|
id: e.id,
|
|
9503
9514
|
treeNodeId: e.treeNodeId,
|
|
9504
9515
|
parentId: e.parentId || null,
|
|
@@ -9523,7 +9534,7 @@ ea.get("/:treeParam", async (e) => {
|
|
|
9523
9534
|
...u,
|
|
9524
9535
|
items: m(null)
|
|
9525
9536
|
};
|
|
9526
|
-
return i || (e.header("X-Cache", "MISS"), await
|
|
9537
|
+
return i || (e.header("X-Cache", "MISS"), await ra(a, o, h, 300)), e.json(h);
|
|
9527
9538
|
} catch (t) {
|
|
9528
9539
|
return console.error("[CMS Public Tree API] Error:", t), e.json({
|
|
9529
9540
|
error: "Failed to fetch public tree",
|
|
@@ -9533,8 +9544,8 @@ ea.get("/:treeParam", async (e) => {
|
|
|
9533
9544
|
});
|
|
9534
9545
|
//#endregion
|
|
9535
9546
|
//#region server/routes/public/assets.ts
|
|
9536
|
-
var
|
|
9537
|
-
function
|
|
9547
|
+
var ia = new e();
|
|
9548
|
+
function aa(e, t) {
|
|
9538
9549
|
if (t === "webp") return "image/webp";
|
|
9539
9550
|
if (t === "avif") return "image/avif";
|
|
9540
9551
|
if (t === "jpeg" || t === "jpg") return "image/jpeg";
|
|
@@ -9542,13 +9553,52 @@ function ia(e, t) {
|
|
|
9542
9553
|
let n = e.toLowerCase();
|
|
9543
9554
|
return n.endsWith(".jpg") || n.endsWith(".jpeg") ? "image/jpeg" : n.endsWith(".png") ? "image/png" : n.endsWith(".webp") ? "image/webp" : n.endsWith(".gif") ? "image/gif" : n.endsWith(".svg") ? "image/svg+xml" : n.endsWith(".pdf") ? "application/pdf" : n.endsWith(".mp4") ? "video/mp4" : n.endsWith(".webm") ? "video/webm" : "application/octet-stream";
|
|
9544
9555
|
}
|
|
9545
|
-
|
|
9556
|
+
ia.get("/*", async (e) => {
|
|
9546
9557
|
let t = e.req.path.replace(/^\/media\//, "").replace(/^\//, "");
|
|
9547
9558
|
if (!t) return e.text("Asset key missing", 400);
|
|
9548
|
-
let n = e.env?.MEDIA_BUCKET, { w: r, h: i, q: a, f: o } = e.req.query(), s = !!(r || i || a || o), c = e.req.header("
|
|
9559
|
+
let n = e.env?.MEDIA_BUCKET, { w: r, h: i, q: a, f: o } = e.req.query(), s = !!(r || i || a || o), c = e.req.header("Accept") || "", l = "";
|
|
9560
|
+
s && (o === "avif" || !o && c.includes("image/avif") ? l = "avif" : o === "webp" || !o && c.includes("image/webp") ? l = "webp" : o === "jpeg" || o === "jpg" ? l = "jpeg" : o === "png" && (l = "png"));
|
|
9561
|
+
let u = typeof caches < "u" && caches?.default ? caches.default : null, d = e.req.url;
|
|
9562
|
+
if (s && l && !o) {
|
|
9563
|
+
let e = new URL(d);
|
|
9564
|
+
e.searchParams.set("_resolvedFormat", l), d = e.toString();
|
|
9565
|
+
}
|
|
9566
|
+
let f = n || e.env?.IMAGES ? new Request(d, e.req.raw) : null;
|
|
9567
|
+
if (u && f) {
|
|
9568
|
+
let e = await u.match(f);
|
|
9569
|
+
if (e) return e;
|
|
9570
|
+
}
|
|
9571
|
+
let p = e.req.header("Via")?.includes("image-resizing") || e.req.header("User-Agent")?.includes("Cloudflare-ImgRen"), m = new URL(e.req.url), h = e.env?.CDN_DOMAIN || m.hostname;
|
|
9549
9572
|
if (n) {
|
|
9550
|
-
|
|
9551
|
-
|
|
9573
|
+
let c = await n.get(t);
|
|
9574
|
+
if (!c && t.includes("/")) {
|
|
9575
|
+
let e = t.split("/").slice(1).join("/");
|
|
9576
|
+
c = await n.get(e);
|
|
9577
|
+
}
|
|
9578
|
+
if (!c) return e.text(`Asset not found: ${t}`, 404);
|
|
9579
|
+
let d = c.httpMetadata?.contentType || aa(t), m = d.startsWith("image/") && !d.includes("svg"), g = !1;
|
|
9580
|
+
if (s && m && e.env?.IMAGES) {
|
|
9581
|
+
g = !0;
|
|
9582
|
+
try {
|
|
9583
|
+
let t = r ? parseInt(r, 10) : void 0, n = i ? parseInt(i, 10) : void 0, o = {
|
|
9584
|
+
quality: a ? parseInt(a, 10) : 80,
|
|
9585
|
+
fit: "cover"
|
|
9586
|
+
};
|
|
9587
|
+
t && (o.width = t), n && (o.height = n);
|
|
9588
|
+
let s = (await e.env.IMAGES.input(c.body).transform(o).output({ format: `image/${l || "webp"}` })).response(), d = new Headers(s.headers);
|
|
9589
|
+
d.set("Cache-Control", "public, max-age=31536000, immutable"), d.set("Access-Control-Allow-Origin", "*");
|
|
9590
|
+
let p = new Response(s.body, {
|
|
9591
|
+
status: 200,
|
|
9592
|
+
headers: d
|
|
9593
|
+
});
|
|
9594
|
+
return u && f && e.executionCtx?.waitUntil && e.executionCtx.waitUntil(u.put(f, p.clone())), p;
|
|
9595
|
+
} catch (e) {
|
|
9596
|
+
console.warn("[Cloudflare Images Binding] Transformation failed, falling back:", e);
|
|
9597
|
+
}
|
|
9598
|
+
}
|
|
9599
|
+
if (s && h && !p && !e.env?.IMAGES) {
|
|
9600
|
+
g = !0;
|
|
9601
|
+
let n = r ? parseInt(r, 10) : void 0, s = i ? parseInt(i, 10) : void 0, c = a ? parseInt(a, 10) : 85, l = o || "auto", d = `https://${h}/media/${t}`;
|
|
9552
9602
|
try {
|
|
9553
9603
|
let t = await fetch(d, {
|
|
9554
9604
|
headers: { Accept: e.req.header("Accept") || "image/webp,image/avif,image/*,*/*;q=0.8" },
|
|
@@ -9561,42 +9611,43 @@ ra.get("/*", async (e) => {
|
|
|
9561
9611
|
anim: !1
|
|
9562
9612
|
} }
|
|
9563
9613
|
});
|
|
9564
|
-
if (t.ok) return t;
|
|
9614
|
+
if (t.ok) return u && f && e.executionCtx?.waitUntil && e.executionCtx.waitUntil(u.put(f, t.clone())), t;
|
|
9565
9615
|
console.warn(`[Cloudflare Image] Resizing returned status ${t.status}. Falling back to raw R2 stream.`);
|
|
9566
9616
|
} catch (e) {
|
|
9567
9617
|
console.warn("[Cloudflare Image] Resize fetch failed. Falling back to raw R2 stream.", e);
|
|
9568
9618
|
}
|
|
9569
9619
|
}
|
|
9570
|
-
|
|
9571
|
-
if (!l && t.includes("/")) {
|
|
9620
|
+
if (g && (c = await n.get(t), !c && t.includes("/"))) {
|
|
9572
9621
|
let e = t.split("/").slice(1).join("/");
|
|
9573
|
-
|
|
9622
|
+
c = await n.get(e);
|
|
9574
9623
|
}
|
|
9575
|
-
if (
|
|
9624
|
+
if (c) {
|
|
9576
9625
|
let t = new Headers();
|
|
9577
|
-
|
|
9626
|
+
c.writeHttpMetadata(t), t.set("etag", c.httpEtag), t.set("Cache-Control", "public, max-age=31536000, immutable"), t.set("Access-Control-Allow-Origin", "*");
|
|
9627
|
+
let n = e.body(c.body, 200, Object.fromEntries(t.entries()));
|
|
9628
|
+
return u && f && e.executionCtx?.waitUntil && e.executionCtx.waitUntil(u.put(f, n.clone())), n;
|
|
9578
9629
|
}
|
|
9579
9630
|
}
|
|
9580
|
-
let [{ existsSync:
|
|
9631
|
+
let [{ existsSync: g, readFileSync: _, mkdirSync: v, writeFileSync: y }, { join: b, dirname: x }] = await Promise.all([import(
|
|
9581
9632
|
/* @vite-ignore */
|
|
9582
9633
|
"node:fs"
|
|
9583
9634
|
), import(
|
|
9584
9635
|
/* @vite-ignore */
|
|
9585
9636
|
"node:path"
|
|
9586
|
-
)]),
|
|
9587
|
-
if (
|
|
9637
|
+
)]), S = e.env?.LOCAL_MEDIA_PATH || "./public/media", C = b(process.cwd(), S, t);
|
|
9638
|
+
if (g(C)) try {
|
|
9588
9639
|
if (!s) {
|
|
9589
|
-
let n =
|
|
9640
|
+
let n = _(C);
|
|
9590
9641
|
return e.body(n, 200, {
|
|
9591
|
-
"Content-Type":
|
|
9642
|
+
"Content-Type": aa(t),
|
|
9592
9643
|
"Cache-Control": "public, max-age=86400"
|
|
9593
9644
|
});
|
|
9594
9645
|
}
|
|
9595
|
-
let n = r ? parseInt(r, 10) : "auto",
|
|
9596
|
-
if (
|
|
9597
|
-
let n = f
|
|
9646
|
+
let n = r ? parseInt(r, 10) : "auto", o = i ? parseInt(i, 10) : "auto", c = a ? parseInt(a, 10) : 80, u = l || "webp", d = `w${n}_h${o}_q${c}_f${u}_${t.replace(/[/\\?%*:|"<>]/g, "_")}`, f = b(process.cwd(), S, ".cache", d);
|
|
9647
|
+
if (g(f)) {
|
|
9648
|
+
let n = _(f);
|
|
9598
9649
|
return e.body(n, 200, {
|
|
9599
|
-
"Content-Type":
|
|
9650
|
+
"Content-Type": aa(t, u),
|
|
9600
9651
|
"Cache-Control": "public, max-age=31536000, immutable",
|
|
9601
9652
|
"X-Local-Cache": "HIT"
|
|
9602
9653
|
});
|
|
@@ -9605,18 +9656,18 @@ ra.get("/*", async (e) => {
|
|
|
9605
9656
|
let r = (await import(
|
|
9606
9657
|
/* @vite-ignore */
|
|
9607
9658
|
"sharp"
|
|
9608
|
-
)).default, i = r(
|
|
9609
|
-
typeof n == "number" && (a.width = n), typeof
|
|
9610
|
-
let
|
|
9611
|
-
return
|
|
9612
|
-
"Content-Type":
|
|
9659
|
+
)).default, i = r(C), a = {};
|
|
9660
|
+
typeof n == "number" && (a.width = n), typeof o == "number" && (a.height = o), (a.width || a.height) && (a.fit = "cover", i = i.resize(a)), u === "webp" ? i = i.webp({ quality: typeof c == "number" ? c : 80 }) : u === "avif" ? i = i.avif({ quality: typeof c == "number" ? c : 70 }) : u === "jpeg" || u === "jpg" ? i = i.jpeg({ quality: typeof c == "number" ? c : 80 }) : u === "png" && (i = i.png({ quality: typeof c == "number" ? c : 80 }));
|
|
9661
|
+
let s = await i.toBuffer();
|
|
9662
|
+
return v(x(f), { recursive: !0 }), y(f, s), e.body(s, 200, {
|
|
9663
|
+
"Content-Type": aa(t, u),
|
|
9613
9664
|
"Cache-Control": "public, max-age=31536000, immutable",
|
|
9614
9665
|
"X-Local-Cache": "MISS"
|
|
9615
9666
|
});
|
|
9616
9667
|
} catch {
|
|
9617
|
-
let n =
|
|
9668
|
+
let n = _(C);
|
|
9618
9669
|
return e.body(n, 200, {
|
|
9619
|
-
"Content-Type":
|
|
9670
|
+
"Content-Type": aa(t),
|
|
9620
9671
|
"Cache-Control": "public, max-age=86400"
|
|
9621
9672
|
});
|
|
9622
9673
|
}
|
|
@@ -9627,8 +9678,8 @@ ra.get("/*", async (e) => {
|
|
|
9627
9678
|
});
|
|
9628
9679
|
//#endregion
|
|
9629
9680
|
//#region server/routes/public/paths.ts
|
|
9630
|
-
var
|
|
9631
|
-
function
|
|
9681
|
+
var oa = new e();
|
|
9682
|
+
function sa(e, t) {
|
|
9632
9683
|
let n = /* @__PURE__ */ new Date();
|
|
9633
9684
|
if (e && String(e).trim() !== "") {
|
|
9634
9685
|
let t = new Date(e);
|
|
@@ -9640,7 +9691,7 @@ function oa(e, t) {
|
|
|
9640
9691
|
}
|
|
9641
9692
|
return !0;
|
|
9642
9693
|
}
|
|
9643
|
-
|
|
9694
|
+
oa.get("/", async (e) => {
|
|
9644
9695
|
try {
|
|
9645
9696
|
let t = await e.get("db").prepare("\n SELECT\n t.id as treeNodeId,\n t.parentId,\n c.slug,\n c.contentType as nodeType,\n c.status,\n c.dataJson\n FROM tree_nodes t\n INNER JOIN content_nodes c ON t.contentId = c.id\n WHERE (c.deletedAt IS NULL OR c.deletedAt = '')\n ORDER BY t.sortOrder ASC\n ").all(), n = Array.isArray(t) ? t : t?.results || [], r = [], i = /* @__PURE__ */ new Map();
|
|
9646
9697
|
for (let e of n) {
|
|
@@ -9664,7 +9715,7 @@ aa.get("/", async (e) => {
|
|
|
9664
9715
|
function o(e = null, t = "") {
|
|
9665
9716
|
let n = e == null || e === "" || e === "null" ? "__ROOT__" : String(e), s = i.get(n) || [];
|
|
9666
9717
|
for (let e of s) {
|
|
9667
|
-
let n = a.get(String(e.treeNodeId)) || {}, i = e.status === "published" || e.status === "active", s =
|
|
9718
|
+
let n = a.get(String(e.treeNodeId)) || {}, i = e.status === "published" || e.status === "active", s = sa(n.startShowingAt, n.stopShowingAt);
|
|
9668
9719
|
if (!i || !s) continue;
|
|
9669
9720
|
let c = (e.slug || "").replace(/^\/+|\/+$/g, ""), l = c === "home" || c === "homee" ? "/" : `${t}/${c}`.replace(/\/+/g, "/");
|
|
9670
9721
|
e.nodeType !== "external-link" && r.push(l);
|
|
@@ -9681,7 +9732,7 @@ aa.get("/", async (e) => {
|
|
|
9681
9732
|
});
|
|
9682
9733
|
//#endregion
|
|
9683
9734
|
//#region server/index.ts
|
|
9684
|
-
var $ = new e(),
|
|
9735
|
+
var $ = new e(), ca = !1;
|
|
9685
9736
|
$.use("*", o()), $.use("/media/*", o({
|
|
9686
9737
|
origin: "*",
|
|
9687
9738
|
allowMethods: [
|
|
@@ -9702,13 +9753,13 @@ $.use("*", o()), $.use("/media/*", o({
|
|
|
9702
9753
|
let n = new URL(e.req.url), r = (e.req.header("host") || n.hostname).split(":")[0];
|
|
9703
9754
|
e.set("currentDomain", r);
|
|
9704
9755
|
let i = u(e);
|
|
9705
|
-
if (e.set("db", i), !
|
|
9706
|
-
await Pr(i),
|
|
9756
|
+
if (e.set("db", i), !ca) try {
|
|
9757
|
+
await Pr(i), ca = !0;
|
|
9707
9758
|
} catch (e) {
|
|
9708
9759
|
console.error("❌ [CMS Server] Failed to initialize system tables on cold start:", e);
|
|
9709
9760
|
}
|
|
9710
9761
|
await t();
|
|
9711
|
-
}), $.route("/media",
|
|
9762
|
+
}), $.route("/media", ia), $.use("/media/*", Lr()), $.route("/api/cms/nodes", X), $.route("/api/cms/nodes.json", X), $.route("/api/cms/formcsv", X), $.route("/api/cms/formcsv.json", X), $.route("/api/cms/stats", Ni), $.route("/api/cms/stats.json", Ni), $.route("/api/cms", Si), $.route("/api/cms/channels", Ei), $.route("/api/cms/channels.json", Ei), $.route("/api/cms/schemas", Di), $.route("/api/cms/schemas.json", Di), $.route("/api/cms", Ai), $.route("/api/admin/assets", Z), $.route("/api/v1/node", Li), $.route("/api/v1/page", Li), $.route("/api/v1/tree", ta), $.route("/api/v1/all-paths", oa), $.get("*", async (e) => {
|
|
9712
9763
|
if (e.env?.ASSETS) {
|
|
9713
9764
|
let t = await e.env.ASSETS.fetch(e.req.raw);
|
|
9714
9765
|
if (t.status === 404) {
|