@brightsideoy/kama 0.1.0-alpha.94 → 0.1.0-alpha.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -142,13 +142,13 @@ function T(e) {
|
|
|
142
142
|
}
|
|
143
143
|
var E = (e) => (S(e) || w(e)) && !!e.anchor, D = Symbol("break visit"), O = Symbol("skip children"), k = Symbol("remove node");
|
|
144
144
|
function A(e, t) {
|
|
145
|
-
let n =
|
|
145
|
+
let n = te(t);
|
|
146
146
|
y(e) ? ee(null, e.contents, n, Object.freeze([e])) === k && (e.contents = null) : ee(null, e, n, Object.freeze([]));
|
|
147
147
|
}
|
|
148
148
|
A.BREAK = D, A.SKIP = O, A.REMOVE = k;
|
|
149
149
|
function ee(e, t, n, r) {
|
|
150
|
-
let i =
|
|
151
|
-
if (T(i) || x(i)) return
|
|
150
|
+
let i = ne(e, t, n, r);
|
|
151
|
+
if (T(i) || x(i)) return re(e, r, i), ee(e, i, n, r);
|
|
152
152
|
if (typeof i != "symbol") {
|
|
153
153
|
if (w(t)) {
|
|
154
154
|
r = Object.freeze(r.concat(t));
|
|
@@ -170,36 +170,36 @@ function ee(e, t, n, r) {
|
|
|
170
170
|
}
|
|
171
171
|
return i;
|
|
172
172
|
}
|
|
173
|
-
async function
|
|
174
|
-
let n =
|
|
175
|
-
y(e) ? await
|
|
173
|
+
async function j(e, t) {
|
|
174
|
+
let n = te(t);
|
|
175
|
+
y(e) ? await M(null, e.contents, n, Object.freeze([e])) === k && (e.contents = null) : await M(null, e, n, Object.freeze([]));
|
|
176
176
|
}
|
|
177
|
-
|
|
178
|
-
async function
|
|
179
|
-
let i = await
|
|
180
|
-
if (T(i) || x(i)) return
|
|
177
|
+
j.BREAK = D, j.SKIP = O, j.REMOVE = k;
|
|
178
|
+
async function M(e, t, n, r) {
|
|
179
|
+
let i = await ne(e, t, n, r);
|
|
180
|
+
if (T(i) || x(i)) return re(e, r, i), M(e, i, n, r);
|
|
181
181
|
if (typeof i != "symbol") {
|
|
182
182
|
if (w(t)) {
|
|
183
183
|
r = Object.freeze(r.concat(t));
|
|
184
184
|
for (let e = 0; e < t.items.length; ++e) {
|
|
185
|
-
let i = await
|
|
185
|
+
let i = await M(e, t.items[e], n, r);
|
|
186
186
|
if (typeof i == "number") e = i - 1;
|
|
187
187
|
else if (i === D) return D;
|
|
188
188
|
else i === k && (t.items.splice(e, 1), --e);
|
|
189
189
|
}
|
|
190
190
|
} else if (x(t)) {
|
|
191
191
|
r = Object.freeze(r.concat(t));
|
|
192
|
-
let e = await
|
|
192
|
+
let e = await M("key", t.key, n, r);
|
|
193
193
|
if (e === D) return D;
|
|
194
194
|
e === k && (t.key = null);
|
|
195
|
-
let i = await
|
|
195
|
+
let i = await M("value", t.value, n, r);
|
|
196
196
|
if (i === D) return D;
|
|
197
197
|
i === k && (t.value = null);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
return i;
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function te(e) {
|
|
203
203
|
return typeof e == "object" && (e.Collection || e.Node || e.Value) ? Object.assign({
|
|
204
204
|
Alias: e.Node,
|
|
205
205
|
Map: e.Node,
|
|
@@ -214,7 +214,7 @@ function ne(e) {
|
|
|
214
214
|
Seq: e.Collection
|
|
215
215
|
}, e) : e;
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function ne(e, t, n, r) {
|
|
218
218
|
if (typeof n == "function") return n(e, t, r);
|
|
219
219
|
if (b(t)) return n.Map?.(e, t, r);
|
|
220
220
|
if (C(t)) return n.Seq?.(e, t, r);
|
|
@@ -222,7 +222,7 @@ function re(e, t, n, r) {
|
|
|
222
222
|
if (S(t)) return n.Scalar?.(e, t, r);
|
|
223
223
|
if (v(t)) return n.Alias?.(e, t, r);
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function re(e, t, n) {
|
|
226
226
|
let r = t[t.length - 1];
|
|
227
227
|
if (w(r)) r.items[e] = n;
|
|
228
228
|
else if (x(r)) e === "key" ? r.key = n : r.value = n;
|
|
@@ -234,14 +234,14 @@ function ie(e, t, n) {
|
|
|
234
234
|
}
|
|
235
235
|
//#endregion
|
|
236
236
|
//#region node_modules/yaml/browser/dist/doc/directives.js
|
|
237
|
-
var
|
|
237
|
+
var ie = {
|
|
238
238
|
"!": "%21",
|
|
239
239
|
",": "%2C",
|
|
240
240
|
"[": "%5B",
|
|
241
241
|
"]": "%5D",
|
|
242
242
|
"{": "%7B",
|
|
243
243
|
"}": "%7D"
|
|
244
|
-
},
|
|
244
|
+
}, N = (e) => e.replace(/[!,[\]{}]/g, (e) => ie[e]), P = 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
|
}
|
|
@@ -304,7 +304,7 @@ var ae = {
|
|
|
304
304
|
return n === "!" ? e : (t(`Could not resolve tag: ${e}`), null);
|
|
305
305
|
}
|
|
306
306
|
tagString(e) {
|
|
307
|
-
for (let [t, n] of Object.entries(this.tags)) if (e.startsWith(n)) return t +
|
|
307
|
+
for (let [t, n] of Object.entries(this.tags)) if (e.startsWith(n)) return t + N(e.substring(n.length));
|
|
308
308
|
return e[0] === "!" ? e : `!<${e}>`;
|
|
309
309
|
}
|
|
310
310
|
toString(e) {
|
|
@@ -319,37 +319,37 @@ var ae = {
|
|
|
319
319
|
return t.join("\n");
|
|
320
320
|
}
|
|
321
321
|
};
|
|
322
|
-
|
|
322
|
+
P.defaultYaml = {
|
|
323
323
|
explicit: !1,
|
|
324
324
|
version: "1.2"
|
|
325
|
-
},
|
|
325
|
+
}, P.defaultTags = { "!!": "tag:yaml.org,2002:" };
|
|
326
326
|
//#endregion
|
|
327
327
|
//#region node_modules/yaml/browser/dist/doc/anchors.js
|
|
328
|
-
function
|
|
328
|
+
function ae(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 oe(e) {
|
|
336
336
|
let t = /* @__PURE__ */ new Set();
|
|
337
337
|
return A(e, { Value(e, n) {
|
|
338
338
|
n.anchor && t.add(n.anchor);
|
|
339
339
|
} }), t;
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function se(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 ce(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 ??= oe(e);
|
|
352
|
+
let a = se(t, i);
|
|
353
353
|
return i.add(a), a;
|
|
354
354
|
},
|
|
355
355
|
setAnchors: () => {
|
|
@@ -367,22 +367,22 @@ function le(e, t) {
|
|
|
367
367
|
}
|
|
368
368
|
//#endregion
|
|
369
369
|
//#region node_modules/yaml/browser/dist/doc/applyReviver.js
|
|
370
|
-
function
|
|
370
|
+
function F(e, t, n, r) {
|
|
371
371
|
if (r && typeof r == "object") {
|
|
372
372
|
if (Array.isArray(r)) for (let t = 0, n = r.length; t < n; ++t) {
|
|
373
|
-
let n = r[t], i =
|
|
373
|
+
let n = r[t], i = F(e, r, String(t), n);
|
|
374
374
|
i === void 0 ? delete r[t] : i !== n && (r[t] = i);
|
|
375
375
|
}
|
|
376
376
|
else if (r instanceof Map) for (let t of Array.from(r.keys())) {
|
|
377
|
-
let n = r.get(t), i =
|
|
377
|
+
let n = r.get(t), i = F(e, r, t, n);
|
|
378
378
|
i === void 0 ? r.delete(t) : i !== n && r.set(t, i);
|
|
379
379
|
}
|
|
380
380
|
else if (r instanceof Set) for (let t of Array.from(r)) {
|
|
381
|
-
let n =
|
|
381
|
+
let n = F(e, r, t, t);
|
|
382
382
|
n === void 0 ? r.delete(t) : n !== t && (r.delete(t), r.add(n));
|
|
383
383
|
}
|
|
384
384
|
else for (let [t, n] of Object.entries(r)) {
|
|
385
|
-
let i =
|
|
385
|
+
let i = F(e, r, t, n);
|
|
386
386
|
i === void 0 ? delete r[t] : i !== n && (r[t] = i);
|
|
387
387
|
}
|
|
388
388
|
}
|
|
@@ -390,8 +390,8 @@ function P(e, t, n, r) {
|
|
|
390
390
|
}
|
|
391
391
|
//#endregion
|
|
392
392
|
//#region node_modules/yaml/browser/dist/nodes/toJS.js
|
|
393
|
-
function
|
|
394
|
-
if (Array.isArray(e)) return e.map((e, t) =>
|
|
393
|
+
function I(e, t, n) {
|
|
394
|
+
if (Array.isArray(e)) return e.map((e, t) => I(e, String(t), n));
|
|
395
395
|
if (e && typeof e.toJSON == "function") {
|
|
396
396
|
if (!n || !E(e)) return e.toJSON(t, n);
|
|
397
397
|
let r = {
|
|
@@ -409,7 +409,7 @@ function F(e, t, n) {
|
|
|
409
409
|
}
|
|
410
410
|
//#endregion
|
|
411
411
|
//#region node_modules/yaml/browser/dist/nodes/Node.js
|
|
412
|
-
var
|
|
412
|
+
var le = class {
|
|
413
413
|
constructor(e) {
|
|
414
414
|
Object.defineProperty(this, _, { value: e });
|
|
415
415
|
}
|
|
@@ -426,11 +426,11 @@ var ue = class {
|
|
|
426
426
|
mapAsMap: t === !0,
|
|
427
427
|
mapKeyWarned: !1,
|
|
428
428
|
maxAliasCount: typeof n == "number" ? n : 100
|
|
429
|
-
}, o =
|
|
429
|
+
}, o = I(this, "", a);
|
|
430
430
|
if (typeof r == "function") for (let { count: e, res: t } of a.anchors.values()) r(t, e);
|
|
431
|
-
return typeof i == "function" ?
|
|
431
|
+
return typeof i == "function" ? F(i, { "": o }, "", o) : o;
|
|
432
432
|
}
|
|
433
|
-
},
|
|
433
|
+
}, ue = class extends le {
|
|
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");
|
|
@@ -458,14 +458,14 @@ var ue = class {
|
|
|
458
458
|
}
|
|
459
459
|
let o = n.get(a);
|
|
460
460
|
/* istanbul ignore if */
|
|
461
|
-
if (o ||= (
|
|
462
|
-
if (i >= 0 && (o.count += 1, o.aliasCount === 0 && (o.aliasCount =
|
|
461
|
+
if (o ||= (I(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 = de(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 (ae(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 ue = class {
|
|
|
474
474
|
return r;
|
|
475
475
|
}
|
|
476
476
|
};
|
|
477
|
-
function
|
|
477
|
+
function de(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,35 +482,35 @@ 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 = de(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 = de(e, t.key, n), i = de(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 fe = (e) => !e || typeof e != "function" && typeof e != "object", L = class extends le {
|
|
499
499
|
constructor(e) {
|
|
500
500
|
super(h), this.value = e;
|
|
501
501
|
}
|
|
502
502
|
toJSON(e, t) {
|
|
503
|
-
return t?.keep ? this.value :
|
|
503
|
+
return t?.keep ? this.value : I(this.value, e, t);
|
|
504
504
|
}
|
|
505
505
|
toString() {
|
|
506
506
|
return String(this.value);
|
|
507
507
|
}
|
|
508
508
|
};
|
|
509
|
-
|
|
509
|
+
L.BLOCK_FOLDED = "BLOCK_FOLDED", L.BLOCK_LITERAL = "BLOCK_LITERAL", L.PLAIN = "PLAIN", L.QUOTE_DOUBLE = "QUOTE_DOUBLE", L.QUOTE_SINGLE = "QUOTE_SINGLE";
|
|
510
510
|
//#endregion
|
|
511
511
|
//#region node_modules/yaml/browser/dist/doc/createNode.js
|
|
512
|
-
var
|
|
513
|
-
function
|
|
512
|
+
var R = "tag:yaml.org,2002:";
|
|
513
|
+
function pe(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 me(e, t, n) {
|
|
|
518
518
|
}
|
|
519
519
|
return n.find((t) => t.identify?.(e) && !t.format);
|
|
520
520
|
}
|
|
521
|
-
function
|
|
521
|
+
function z(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 R(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 ue(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 = R + t.slice(2));
|
|
537
|
+
let l = pe(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 L(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 L(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 B(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 z(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 z(r, void 0, {
|
|
561
561
|
aliasDuplicateObjects: !1,
|
|
562
562
|
keepUndefined: !1,
|
|
563
563
|
onAnchor: () => {
|
|
@@ -567,7 +567,7 @@ function z(e, t, n) {
|
|
|
567
567
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
568
568
|
});
|
|
569
569
|
}
|
|
570
|
-
var
|
|
570
|
+
var me = (e) => e == null || typeof e == "object" && !!e[Symbol.iterator]().next().done, he = class extends le {
|
|
571
571
|
constructor(e, t) {
|
|
572
572
|
super(e), Object.defineProperty(this, "schema", {
|
|
573
573
|
value: t,
|
|
@@ -581,11 +581,11 @@ var he = (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 (me(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, B(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 he = (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, B(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
|
+
}, ge = (e) => e.replace(/^(?!$)(?: $)?/gm, "#");
|
|
627
|
+
function V(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 _e = (e, t, n) => e.endsWith("\n") ? V(n, t) : n.includes("\n") ? "\n" + V(n, t) : (e.endsWith(" ") ? "" : " ") + n, ve = "flow", ye = "block", be = "quoted";
|
|
631
|
+
function xe(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 Se(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 = Se(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 Se(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 = Se(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 Se(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentW
|
|
|
680
680
|
}
|
|
681
681
|
return v;
|
|
682
682
|
}
|
|
683
|
-
function
|
|
683
|
+
function Se(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 Ce(e, t, n) {
|
|
|
693
693
|
}
|
|
694
694
|
//#endregion
|
|
695
695
|
//#region node_modules/yaml/browser/dist/stringify/stringifyString.js
|
|
696
|
-
var
|
|
696
|
+
var Ce = (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
|
+
}), we = (e) => /^(%|---|\.\.\.)/m.test(e);
|
|
701
|
+
function Te(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 Ee(e, t, n) {
|
|
|
708
708
|
}
|
|
709
709
|
return !0;
|
|
710
710
|
}
|
|
711
|
-
function
|
|
711
|
+
function Ee(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 || (we(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 De(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 : xe(o, a, be, Ce(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 De(e, t) {
|
|
762
|
+
if (t.options.singleQuote === !1 || t.implicitKey && e.includes("\n") || /[ \t]\n|\n[ \t]/.test(e)) return Ee(e, t);
|
|
763
|
+
let n = t.indent || (we(e) ? " " : ""), r = "'" + e.replace(/'/g, "''").replace(/\n+/g, `$&\n${n}`) + "'";
|
|
764
|
+
return t.implicitKey ? r : xe(r, n, ve, Ce(t, !1));
|
|
765
765
|
}
|
|
766
|
-
function
|
|
766
|
+
function Oe(e, t) {
|
|
767
767
|
let { singleQuote: n } = t.options, r;
|
|
768
|
-
if (n === !1) r =
|
|
768
|
+
if (n === !1) r = Ee;
|
|
769
769
|
else {
|
|
770
770
|
let t = e.includes("\""), i = e.includes("'");
|
|
771
|
-
r = t && !i ?
|
|
771
|
+
r = t && !i ? De : i && !t ? Ee : n ? De : Ee;
|
|
772
772
|
}
|
|
773
773
|
return r(e, t);
|
|
774
774
|
}
|
|
775
|
-
var
|
|
775
|
+
var ke;
|
|
776
776
|
try {
|
|
777
|
-
|
|
777
|
+
ke = /* @__PURE__ */ RegExp("(^|(?<!\n))\n+(?!\n|$)", "g");
|
|
778
778
|
} catch {
|
|
779
|
-
|
|
779
|
+
ke = /\n+(?!\n|$)/g;
|
|
780
780
|
}
|
|
781
|
-
function
|
|
781
|
+
function Ae({ 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 Oe(n, r);
|
|
784
|
+
let l = r.indent || (r.forceBlockIndent || we(n) ? " " : ""), u = o === "literal" ? !0 : o === "folded" || t === L.BLOCK_FOLDED ? !1 : t === L.BLOCK_LITERAL || !Te(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 je({ 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(ke, `$&${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 je({ 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 = Ce(r, !0);
|
|
805
|
+
o !== "folded" && t !== L.BLOCK_FOLDED && (a.onOverflow = () => {
|
|
806
806
|
i = !0;
|
|
807
807
|
});
|
|
808
|
-
let s =
|
|
808
|
+
let s = xe(`${v}${e}${p}`, l, ye, 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 je(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 Oe(a, t);
|
|
816
|
+
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a)) return s || u || !a.includes("\n") ? Oe(a, t) : Ae(e, t, n, r);
|
|
817
|
+
if (!s && !u && i !== L.PLAIN && a.includes("\n")) return Ae(e, t, n, r);
|
|
818
|
+
if (we(a)) {
|
|
819
|
+
if (c === "") return t.forceBlockIndent = !0, Ae(e, t, n, r);
|
|
820
|
+
if (s && c === l) return Oe(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 Oe(a, t);
|
|
826
826
|
}
|
|
827
|
-
return s ? d :
|
|
827
|
+
return s ? d : xe(d, c, ve, Ce(t, !1));
|
|
828
828
|
}
|
|
829
|
-
function
|
|
829
|
+
function Me(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 !== L.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (s = L.QUOTE_DOUBLE);
|
|
832
832
|
let c = (e) => {
|
|
833
833
|
switch (e) {
|
|
834
|
-
case
|
|
835
|
-
case
|
|
836
|
-
case
|
|
837
|
-
case
|
|
838
|
-
case
|
|
834
|
+
case L.BLOCK_FOLDED:
|
|
835
|
+
case L.BLOCK_LITERAL: return i || a ? Oe(o.value, t) : Ae(o, t, n, r);
|
|
836
|
+
case L.QUOTE_DOUBLE: return Ee(o.value, t);
|
|
837
|
+
case L.QUOTE_SINGLE: return De(o.value, t);
|
|
838
|
+
case L.PLAIN: return je(o, t, n, r);
|
|
839
839
|
default: return null;
|
|
840
840
|
}
|
|
841
841
|
}, l = c(s);
|
|
@@ -847,10 +847,10 @@ function Ne(e, t, n, r) {
|
|
|
847
847
|
}
|
|
848
848
|
//#endregion
|
|
849
849
|
//#region node_modules/yaml/browser/dist/stringify/stringify.js
|
|
850
|
-
function
|
|
850
|
+
function Ne(e, t) {
|
|
851
851
|
let n = Object.assign({
|
|
852
852
|
blockQuote: !0,
|
|
853
|
-
commentString:
|
|
853
|
+
commentString: ge,
|
|
854
854
|
defaultKeyType: null,
|
|
855
855
|
defaultStringType: "PLAIN",
|
|
856
856
|
directives: null,
|
|
@@ -887,7 +887,7 @@ function Pe(e, t) {
|
|
|
887
887
|
options: n
|
|
888
888
|
};
|
|
889
889
|
}
|
|
890
|
-
function
|
|
890
|
+
function Pe(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 Fe(e, t) {
|
|
|
908
908
|
}
|
|
909
909
|
return n;
|
|
910
910
|
}
|
|
911
|
-
function
|
|
911
|
+
function Fe(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 && ae(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 Ie(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 Le(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 ??= Pe(t.doc.schema.tags, a);
|
|
927
|
+
let o = Fe(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) ? Me(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 Le({ 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 === L.BLOCK_FOLDED || e.type === L.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 = Ie(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 += _e(g, n.indent, l(f)) : h && i && i(), g;
|
|
954
|
+
m && (f = null), p ? (f && (g += _e(g, n.indent, l(f))), g = `? ${g}\n${s}:`) : (g = `${g}:`, f && (g += _e(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 = Ie(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${V(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 Re({ 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 += _e(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 Re(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 ze = "<<", H = {
|
|
985
|
+
identify: (e) => e === ze || typeof e == "symbol" && e.description === ze,
|
|
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 L(Symbol(ze)), { addToJSMap: Ve }),
|
|
990
|
+
stringify: () => ze
|
|
991
|
+
}, Be = (e, t) => (H.identify(t) || S(t) && (!t.type || t.type === L.PLAIN) && H.identify(t.value)) && e?.doc.schema.tags.some((e) => e.tag === H.tag && e.default);
|
|
992
|
+
function Ve(e, t, n) {
|
|
993
|
+
let r = Ue(e, n);
|
|
994
|
+
if (C(r)) for (let n of r.items) He(e, t, n);
|
|
995
|
+
else if (Array.isArray(r)) for (let n of r) He(e, t, n);
|
|
996
|
+
else He(e, t, r);
|
|
997
997
|
}
|
|
998
|
-
function
|
|
999
|
-
let r =
|
|
998
|
+
function He(e, t, n) {
|
|
999
|
+
let r = Ue(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 Ue(e, t, n) {
|
|
|
1007
1007
|
});
|
|
1008
1008
|
return t;
|
|
1009
1009
|
}
|
|
1010
|
-
function
|
|
1010
|
+
function Ue(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 We(e, t, { key: n, value: r }) {
|
|
1016
1016
|
if (T(n) && n.addToJSMap) n.addToJSMap(e, t, r);
|
|
1017
|
-
else if (
|
|
1017
|
+
else if (Be(e, n)) Ve(e, t, r);
|
|
1018
1018
|
else {
|
|
1019
|
-
let i =
|
|
1020
|
-
if (t instanceof Map) t.set(i,
|
|
1019
|
+
let i = I(n, "", e);
|
|
1020
|
+
if (t instanceof Map) t.set(i, I(r, i, e));
|
|
1021
1021
|
else if (t instanceof Set) t.add(i);
|
|
1022
1022
|
else {
|
|
1023
|
-
let a =
|
|
1023
|
+
let a = Ge(n, i, e), o = I(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 Ge(e, t, { key: n, value: r }) {
|
|
|
1031
1031
|
}
|
|
1032
1032
|
return t;
|
|
1033
1033
|
}
|
|
1034
|
-
function
|
|
1034
|
+
function Ge(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 = Ne(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) + "...\""), Re(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 Ke(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 Ke(e, t, n) {
|
|
1054
|
+
return new U(z(e, void 0, n), z(t, void 0, n));
|
|
1055
1055
|
}
|
|
1056
|
-
var
|
|
1056
|
+
var U = 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 H = 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 We(t, t?.mapAsMap ? /* @__PURE__ */ new Map() : {}, this);
|
|
1066
1066
|
}
|
|
1067
1067
|
toString(e, t, n) {
|
|
1068
|
-
return e?.doc ?
|
|
1068
|
+
return e?.doc ? Le(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 qe(e, t, n) {
|
|
1074
|
+
return (t.inFlow ?? e.flow ? Ye : Je)(e, t, n);
|
|
1075
1075
|
}
|
|
1076
|
-
function
|
|
1076
|
+
function Je({ 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(""), Xe(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(""), Xe(n, f, e.commentBefore, d));
|
|
1087
1087
|
}
|
|
1088
1088
|
d = !1;
|
|
1089
|
-
let s =
|
|
1090
|
-
o && (s +=
|
|
1089
|
+
let s = Ie(i, u, () => o = null, () => d = !0);
|
|
1090
|
+
o && (s += _e(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 Ye({ 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" + V(l(e), c), s && s()) : d && o && o(), p;
|
|
1102
1102
|
}
|
|
1103
|
-
function
|
|
1103
|
+
function Ye({ 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 Xe({ 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(""), Xe(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(""), Xe(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 = Ie(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 += _e(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 Xe({ items: e }, t, { flowChars: n, itemIndent: r }) {
|
|
|
1134
1134
|
}
|
|
1135
1135
|
return `${f}${o}${d.join(" ")}${o}${p}`;
|
|
1136
1136
|
}
|
|
1137
|
-
function
|
|
1137
|
+
function Xe({ indent: e, options: { commentString: t } }, n, r, i) {
|
|
1138
1138
|
if (r && i && (r = r.replace(/^\n+/, "")), r) {
|
|
1139
|
-
let i =
|
|
1139
|
+
let i = V(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 Ze(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 W = class extends he {
|
|
1150
1150
|
static get tagName() {
|
|
1151
1151
|
return "tag:yaml.org,2002:map";
|
|
1152
1152
|
}
|
|
@@ -1157,7 +1157,7 @@ var U = class extends ge {
|
|
|
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(Ke(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 U = class extends ge {
|
|
|
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 U(e, e?.value) : new U(e.key, e.value);
|
|
1169
|
+
let r = Ze(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) && fe(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 = Ze(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 = Ze(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 !!Ze(this.items, e);
|
|
1188
1188
|
}
|
|
1189
1189
|
set(e, t) {
|
|
1190
|
-
this.add(new
|
|
1190
|
+
this.add(new U(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) We(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 })), qe(this, e, {
|
|
1202
1202
|
blockItemPrefix: "",
|
|
1203
1203
|
flowChars: {
|
|
1204
1204
|
start: "{",
|
|
@@ -1209,16 +1209,16 @@ var U = class extends ge {
|
|
|
1209
1209
|
onComment: t
|
|
1210
1210
|
});
|
|
1211
1211
|
}
|
|
1212
|
-
},
|
|
1212
|
+
}, Qe = {
|
|
1213
1213
|
collection: "map",
|
|
1214
1214
|
default: !0,
|
|
1215
|
-
nodeClass:
|
|
1215
|
+
nodeClass: W,
|
|
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) => W.from(e, t, n)
|
|
1221
|
+
}, $e = class extends he {
|
|
1222
1222
|
static get tagName() {
|
|
1223
1223
|
return "tag:yaml.org,2002:seq";
|
|
1224
1224
|
}
|
|
@@ -1246,17 +1246,17 @@ var U = class extends ge {
|
|
|
1246
1246
|
let n = et(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) && fe(t) ? r.value = t : this.items[n] = t;
|
|
1250
1250
|
}
|
|
1251
1251
|
toJSON(e, t) {
|
|
1252
1252
|
let n = [];
|
|
1253
1253
|
t?.onCreate && t.onCreate(n);
|
|
1254
1254
|
let r = 0;
|
|
1255
|
-
for (let e of this.items) n.push(
|
|
1255
|
+
for (let e of this.items) n.push(I(e, String(r++), t));
|
|
1256
1256
|
return n;
|
|
1257
1257
|
}
|
|
1258
1258
|
toString(e, t, n) {
|
|
1259
|
-
return e ?
|
|
1259
|
+
return e ? qe(this, e, {
|
|
1260
1260
|
blockItemPrefix: "- ",
|
|
1261
1261
|
flowChars: {
|
|
1262
1262
|
start: "[",
|
|
@@ -1276,7 +1276,7 @@ var U = class extends ge {
|
|
|
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(z(a, void 0, n));
|
|
1280
1280
|
}
|
|
1281
1281
|
}
|
|
1282
1282
|
return i;
|
|
@@ -1291,34 +1291,34 @@ function et(e) {
|
|
|
1291
1291
|
var tt = {
|
|
1292
1292
|
collection: "seq",
|
|
1293
1293
|
default: !0,
|
|
1294
|
-
nodeClass:
|
|
1294
|
+
nodeClass: $e,
|
|
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) => $e.from(e, t, n)
|
|
1300
1300
|
}, nt = {
|
|
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), Me(e, t, n, r);
|
|
1307
1307
|
}
|
|
1308
1308
|
}, rt = {
|
|
1309
1309
|
identify: (e) => e == null,
|
|
1310
|
-
createNode: () => new
|
|
1310
|
+
createNode: () => new L(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 L(null),
|
|
1315
1315
|
stringify: ({ source: e }, t) => typeof e == "string" && rt.test.test(e) ? e : t.options.nullStr
|
|
1316
1316
|
}, it = {
|
|
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 L(e[0] === "t" || e[0] === "T"),
|
|
1322
1322
|
stringify({ source: e, value: t }, n) {
|
|
1323
1323
|
return e && it.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 at = {
|
|
|
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 L(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: G
|
|
@@ -1397,7 +1397,7 @@ var dt = {
|
|
|
1397
1397
|
resolve: (e, t, n) => lt(e, 2, 16, n),
|
|
1398
1398
|
stringify: (e) => ut(e, 16, "0x")
|
|
1399
1399
|
}, mt = [
|
|
1400
|
-
|
|
1400
|
+
Qe,
|
|
1401
1401
|
tt,
|
|
1402
1402
|
nt,
|
|
1403
1403
|
rt,
|
|
@@ -1424,7 +1424,7 @@ var gt = ({ value: e }) => JSON.stringify(e), _t = [
|
|
|
1424
1424
|
},
|
|
1425
1425
|
{
|
|
1426
1426
|
identify: (e) => e == null,
|
|
1427
|
-
createNode: () => new
|
|
1427
|
+
createNode: () => new L(null),
|
|
1428
1428
|
default: !0,
|
|
1429
1429
|
tag: "tag:yaml.org,2002:null",
|
|
1430
1430
|
test: /^null$/,
|
|
@@ -1455,7 +1455,7 @@ var gt = ({ value: e }) => JSON.stringify(e), _t = [
|
|
|
1455
1455
|
resolve: (e) => parseFloat(e),
|
|
1456
1456
|
stringify: gt
|
|
1457
1457
|
}
|
|
1458
|
-
], vt = [
|
|
1458
|
+
], vt = [Qe, tt].concat(_t, {
|
|
1459
1459
|
default: !0,
|
|
1460
1460
|
tag: "",
|
|
1461
1461
|
test: /^/,
|
|
@@ -1482,12 +1482,12 @@ var gt = ({ value: e }) => JSON.stringify(e), _t = [
|
|
|
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 ??= L.BLOCK_LITERAL, t !== L.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 === L.BLOCK_LITERAL ? "\n" : " ");
|
|
1489
1489
|
}
|
|
1490
|
-
return
|
|
1490
|
+
return Me({
|
|
1491
1491
|
comment: e,
|
|
1492
1492
|
type: t,
|
|
1493
1493
|
value: s
|
|
@@ -1502,21 +1502,21 @@ function bt(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 U(new L(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 U(r);
|
|
1513
1513
|
}
|
|
1514
1514
|
}
|
|
1515
1515
|
else t("Expected a sequence for this tag");
|
|
1516
1516
|
return e;
|
|
1517
1517
|
}
|
|
1518
1518
|
function xt(e, t, n) {
|
|
1519
|
-
let { replacer: r } = n, i = new
|
|
1519
|
+
let { replacer: r } = n, i = new $e(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 xt(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(Ke(o, s, n));
|
|
1534
1534
|
}
|
|
1535
1535
|
return i;
|
|
1536
1536
|
}
|
|
@@ -1540,9 +1540,9 @@ var St = {
|
|
|
1540
1540
|
tag: "tag:yaml.org,2002:pairs",
|
|
1541
1541
|
resolve: bt,
|
|
1542
1542
|
createNode: xt
|
|
1543
|
-
}, Ct = class e extends
|
|
1543
|
+
}, Ct = class e extends $e {
|
|
1544
1544
|
constructor() {
|
|
1545
|
-
super(), this.add =
|
|
1545
|
+
super(), this.add = W.prototype.add.bind(this), this.delete = W.prototype.delete.bind(this), this.get = W.prototype.get.bind(this), this.has = W.prototype.has.bind(this), this.set = W.prototype.set.bind(this), this.tag = e.tag;
|
|
1546
1546
|
}
|
|
1547
1547
|
toJSON(e, t) {
|
|
1548
1548
|
if (!t) return super.toJSON(e);
|
|
@@ -1550,7 +1550,7 @@ var St = {
|
|
|
1550
1550
|
t?.onCreate && t.onCreate(n);
|
|
1551
1551
|
for (let e of this.items) {
|
|
1552
1552
|
let r, i;
|
|
1553
|
-
if (x(e) ? (r =
|
|
1553
|
+
if (x(e) ? (r = I(e.key, "", t), i = I(e.value, r, t)) : r = I(e, "", t), n.has(r)) throw Error("Ordered maps must not include duplicate keys");
|
|
1554
1554
|
n.set(r, i);
|
|
1555
1555
|
}
|
|
1556
1556
|
return n;
|
|
@@ -1584,14 +1584,14 @@ var Et = {
|
|
|
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 L(!0),
|
|
1588
1588
|
stringify: Tt
|
|
1589
1589
|
}, Dt = {
|
|
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 L(!1),
|
|
1595
1595
|
stringify: Tt
|
|
1596
1596
|
}, Ot = {
|
|
1597
1597
|
identify: (e) => typeof e == "number",
|
|
@@ -1617,7 +1617,7 @@ var Et = {
|
|
|
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 L(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 Pt = {
|
|
|
1683
1683
|
test: /^[-+]?0x[0-9a-fA-F_]+$/,
|
|
1684
1684
|
resolve: (e, t, n) => Mt(e, 2, 16, n),
|
|
1685
1685
|
stringify: (e) => Nt(e, 16, "0x")
|
|
1686
|
-
}, Rt = class e extends
|
|
1686
|
+
}, Rt = class e extends W {
|
|
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 U(e.key, null) : new U(e, null), Ze(this.items, t.key) || this.items.push(t);
|
|
1693
1693
|
}
|
|
1694
1694
|
get(e, t) {
|
|
1695
|
-
let n =
|
|
1695
|
+
let n = Ze(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 = Ze(this.items, e);
|
|
1701
|
+
n && !t ? this.items.splice(this.items.indexOf(n), 1) : !n && t && this.items.push(new U(e));
|
|
1702
1702
|
}
|
|
1703
1703
|
toJSON(e, t) {
|
|
1704
1704
|
return super.toJSON(e, t, Set);
|
|
@@ -1710,7 +1710,7 @@ var Pt = {
|
|
|
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(Ke(e, null, n));
|
|
1714
1714
|
return i;
|
|
1715
1715
|
}
|
|
1716
1716
|
};
|
|
@@ -1778,7 +1778,7 @@ var Ht = {
|
|
|
1778
1778
|
},
|
|
1779
1779
|
stringify: ({ value: e }) => e?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
|
|
1780
1780
|
}, Gt = [
|
|
1781
|
-
|
|
1781
|
+
Qe,
|
|
1782
1782
|
tt,
|
|
1783
1783
|
nt,
|
|
1784
1784
|
rt,
|
|
@@ -1792,7 +1792,7 @@ var Ht = {
|
|
|
1792
1792
|
kt,
|
|
1793
1793
|
At,
|
|
1794
1794
|
yt,
|
|
1795
|
-
|
|
1795
|
+
H,
|
|
1796
1796
|
wt,
|
|
1797
1797
|
St,
|
|
1798
1798
|
zt,
|
|
@@ -1802,7 +1802,7 @@ var Ht = {
|
|
|
1802
1802
|
], Kt = /* @__PURE__ */ new Map([
|
|
1803
1803
|
["core", mt],
|
|
1804
1804
|
["failsafe", [
|
|
1805
|
-
|
|
1805
|
+
Qe,
|
|
1806
1806
|
tt,
|
|
1807
1807
|
nt
|
|
1808
1808
|
]],
|
|
@@ -1820,8 +1820,8 @@ var Ht = {
|
|
|
1820
1820
|
intHex: pt,
|
|
1821
1821
|
intOct: dt,
|
|
1822
1822
|
intTime: Ht,
|
|
1823
|
-
map:
|
|
1824
|
-
merge:
|
|
1823
|
+
map: Qe,
|
|
1824
|
+
merge: H,
|
|
1825
1825
|
null: rt,
|
|
1826
1826
|
omap: wt,
|
|
1827
1827
|
pairs: St,
|
|
@@ -1830,7 +1830,7 @@ var Ht = {
|
|
|
1830
1830
|
timestamp: Wt
|
|
1831
1831
|
}, Jt = {
|
|
1832
1832
|
"tag:yaml.org,2002:binary": yt,
|
|
1833
|
-
"tag:yaml.org,2002:merge":
|
|
1833
|
+
"tag:yaml.org,2002:merge": H,
|
|
1834
1834
|
"tag:yaml.org,2002:omap": wt,
|
|
1835
1835
|
"tag:yaml.org,2002:pairs": St,
|
|
1836
1836
|
"tag:yaml.org,2002:set": zt,
|
|
@@ -1838,7 +1838,7 @@ var Ht = {
|
|
|
1838
1838
|
};
|
|
1839
1839
|
function Yt(e, t, n) {
|
|
1840
1840
|
let r = Kt.get(t);
|
|
1841
|
-
if (r && !e) return n && !r.includes(
|
|
1841
|
+
if (r && !e) return n && !r.includes(H) ? r.concat(H) : r.slice();
|
|
1842
1842
|
let i = r;
|
|
1843
1843
|
if (!i) {
|
|
1844
1844
|
if (Array.isArray(e)) i = [];
|
|
@@ -1849,7 +1849,7 @@ function Yt(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(H)), i.reduce((e, t) => {
|
|
1853
1853
|
let n = typeof t == "string" ? qt[t] : t;
|
|
1854
1854
|
if (!n) {
|
|
1855
1855
|
let e = JSON.stringify(t), n = Object.keys(qt).map((e) => JSON.stringify(e)).join(", ");
|
|
@@ -1862,7 +1862,7 @@ function Yt(e, t, n) {
|
|
|
1862
1862
|
//#region node_modules/yaml/browser/dist/schema/Schema.js
|
|
1863
1863
|
var Xt = (e, t) => e.key < t.key ? -1 : +(e.key > t.key), Zt = 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) ? Yt(e, "compat") : e ? Yt(null, e) : null, this.name = typeof i == "string" && i || "core", this.knownTags = r ? Jt : {}, this.tags = Yt(t, this.name, n), this.toStringOptions = o ?? null, Object.defineProperty(this, p, { value:
|
|
1865
|
+
this.compat = Array.isArray(e) ? Yt(e, "compat") : e ? Yt(null, e) : null, this.name = typeof i == "string" && i || "core", this.knownTags = r ? Jt : {}, this.tags = Yt(t, this.name, n), this.toStringOptions = o ?? null, Object.defineProperty(this, p, { value: Qe }), Object.defineProperty(this, h, { value: nt }), Object.defineProperty(this, g, { value: tt }), this.sortMapEntries = typeof a == "function" ? a : a === !0 ? Xt : null;
|
|
1866
1866
|
}
|
|
1867
1867
|
clone() {
|
|
1868
1868
|
let t = Object.create(e.prototype, Object.getOwnPropertyDescriptors(this));
|
|
@@ -1878,32 +1878,32 @@ function Qt(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 = Ne(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(V(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(V(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 = Ie(e.contents, i, () => s = null, t);
|
|
1897
|
+
s && (c += _e(c, "", a(s))), (c[0] === "|" || c[0] === ">") && n[n.length - 1] === "---" ? n[n.length - 1] = `--- ${c}` : n.push(c);
|
|
1898
|
+
} else n.push(Ie(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(V(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(V(a(t), "")));
|
|
1907
1907
|
}
|
|
1908
1908
|
return n.join("\n") + "\n";
|
|
1909
1909
|
}
|
|
@@ -1926,7 +1926,7 @@ var $t = 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 P({ 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 $t = 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 = oe(this);
|
|
1944
|
+
e.anchor = !t || n.has(t) ? se(t || "a", n) : t;
|
|
1945
1945
|
}
|
|
1946
|
-
return new
|
|
1946
|
+
return new ue(e.anchor);
|
|
1947
1947
|
}
|
|
1948
1948
|
createNode(e, t, n) {
|
|
1949
1949
|
let r;
|
|
@@ -1952,7 +1952,7 @@ var $t = 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 } = ce(this, a || "a"), p = {
|
|
1956
1956
|
aliasDuplicateObjects: i ?? !0,
|
|
1957
1957
|
keepUndefined: s ?? !1,
|
|
1958
1958
|
onAnchor: u,
|
|
@@ -1960,49 +1960,49 @@ var $t = class e {
|
|
|
1960
1960
|
replacer: r,
|
|
1961
1961
|
schema: this.schema,
|
|
1962
1962
|
sourceObjects: f
|
|
1963
|
-
}, m =
|
|
1963
|
+
}, m = z(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 U(this.createNode(e, null, n), this.createNode(t, null, n));
|
|
1968
1968
|
}
|
|
1969
1969
|
delete(e) {
|
|
1970
1970
|
return en(this.contents) ? this.contents.delete(e) : !1;
|
|
1971
1971
|
}
|
|
1972
1972
|
deleteIn(e) {
|
|
1973
|
-
return
|
|
1973
|
+
return me(e) ? this.contents != null && (this.contents = null, !0) : en(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 me(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 me(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 = B(this.schema, [e], t) : en(this.contents) && this.contents.set(e, t);
|
|
1989
1989
|
}
|
|
1990
1990
|
setIn(e, t) {
|
|
1991
|
-
|
|
1991
|
+
me(e) ? this.contents = t : this.contents == null ? this.contents = B(this.schema, Array.from(e), t) : en(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 P({ 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 P({ version: e }), n = {
|
|
2006
2006
|
resolveKnownTags: !0,
|
|
2007
2007
|
schema: "core"
|
|
2008
2008
|
};
|
|
@@ -2027,9 +2027,9 @@ var $t = class e {
|
|
|
2027
2027
|
mapAsMap: n === !0,
|
|
2028
2028
|
mapKeyWarned: !1,
|
|
2029
2029
|
maxAliasCount: typeof r == "number" ? r : 100
|
|
2030
|
-
}, s =
|
|
2030
|
+
}, s = I(this.contents, t ?? "", o);
|
|
2031
2031
|
if (typeof i == "function") for (let { count: e, res: t } of o.anchors.values()) i(t, e);
|
|
2032
|
-
return typeof a == "function" ?
|
|
2032
|
+
return typeof a == "function" ? F(a, { "": s }, "", s) : s;
|
|
2033
2033
|
}
|
|
2034
2034
|
toJSON(e, t) {
|
|
2035
2035
|
return this.toJS({
|
|
@@ -2179,7 +2179,7 @@ function ln(e, t, n) {
|
|
|
2179
2179
|
//#region node_modules/yaml/browser/dist/compose/resolve-block-map.js
|
|
2180
2180
|
var un = "All mapping items must start at the same column";
|
|
2181
2181
|
function dn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
|
|
2182
|
-
let o = new ((a?.nodeClass) ??
|
|
2182
|
+
let o = new ((a?.nodeClass) ?? W)(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 dn({ 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 && cn(r.indent, f, i), s = c.range[2];
|
|
2216
|
-
let l = new
|
|
2216
|
+
let l = new U(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 U(g);
|
|
2221
2221
|
n.options.keepSourceTokens && (e.srcToken = a), o.items.push(e);
|
|
2222
2222
|
}
|
|
2223
2223
|
}
|
|
@@ -2230,7 +2230,7 @@ function dn({ 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 fn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
|
|
2233
|
-
let o = new ((a?.nodeClass) ??
|
|
2233
|
+
let o = new ((a?.nodeClass) ?? $e)(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 pn(e, t, n, r) {
|
|
|
2293
2293
|
//#region node_modules/yaml/browser/dist/compose/resolve-flow-collection.js
|
|
2294
2294
|
var mn = "Block collections are not allowed within flow collections", hn = (e) => e && (e.type === "block-map" || e.type === "block-seq");
|
|
2295
2295
|
function gn({ 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 ? W : $e))(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 gn({ 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 ? hn(m) && i(v.range, "BLOCK_IN_FLOW", mn) : _.comment && (g.comment ? g.comment += "\n" + _.comment : g.comment = _.comment);
|
|
2364
|
-
let y = new
|
|
2364
|
+
let y = new U(g, v);
|
|
2365
2365
|
if (n.options.keepSourceTokens && (y.srcToken = l), o) {
|
|
2366
2366
|
let e = c;
|
|
2367
2367
|
ln(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 W(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 vn(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 === W.tagName && s === "map" || o === $e.tagName && s === "seq") return _n(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), _n(e, t, n, i, o);
|
|
2420
2420
|
}
|
|
2421
|
-
let l = _n(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 = _n(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 L(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 yn(e, t, n) {
|
|
|
2435
2435
|
r
|
|
2436
2436
|
]
|
|
2437
2437
|
};
|
|
2438
|
-
let a = i.mode === ">" ?
|
|
2438
|
+
let a = i.mode === ">" ? L.BLOCK_FOLDED : L.BLOCK_LITERAL, o = t.source ? xn(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 yn(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 === L.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 Sn(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 = L.PLAIN, c = Cn(a, l);
|
|
2556
2556
|
break;
|
|
2557
2557
|
case "single-quoted-scalar":
|
|
2558
|
-
s =
|
|
2558
|
+
s = L.QUOTE_SINGLE, c = wn(a, l);
|
|
2559
2559
|
break;
|
|
2560
2560
|
case "double-quoted-scalar":
|
|
2561
|
-
s =
|
|
2561
|
+
s = L.QUOTE_DOUBLE, c = En(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 An(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 L(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 L(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 In(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 Ln({ options: e }, { offset: t, source: n, end: r }, i) {
|
|
2790
|
-
let a = new
|
|
2790
|
+
let a = new ue(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 = pn(r, o, e.strict, i);
|
|
2793
2793
|
return a.range = [
|
|
@@ -2853,7 +2853,7 @@ var Vn = 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 = zn(e);
|
|
2855
2855
|
r ? this.warnings.push(new rn(i, t, n)) : this.errors.push(new nn(i, t, n));
|
|
2856
|
-
}, this.directives = new
|
|
2856
|
+
}, this.directives = new P({ version: e.version || "1.2" }), this.options = e;
|
|
2857
2857
|
}
|
|
2858
2858
|
decorate(e, t) {
|
|
2859
2859
|
let { comment: n, afterEmptyLine: r } = Bn(this.prelude);
|
|
@@ -2961,7 +2961,7 @@ function Hn(e, t = !0, n) {
|
|
|
2961
2961
|
return null;
|
|
2962
2962
|
}
|
|
2963
2963
|
function Un(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 = Me({
|
|
2965
2965
|
type: o,
|
|
2966
2966
|
value: e
|
|
2967
2967
|
}, {
|
|
@@ -3040,7 +3040,7 @@ function Wn(e, t, n = {}) {
|
|
|
3040
3040
|
}
|
|
3041
3041
|
default: o = "PLAIN";
|
|
3042
3042
|
}
|
|
3043
|
-
let c =
|
|
3043
|
+
let c = Me({
|
|
3044
3044
|
type: o,
|
|
3045
3045
|
value: t
|
|
3046
3046
|
}, {
|
|
@@ -4346,7 +4346,7 @@ function Tr(e, t, n) {
|
|
|
4346
4346
|
typeof t == "function" ? r = t : n === void 0 && t && typeof t == "object" && (n = t);
|
|
4347
4347
|
let i = wr(e, n);
|
|
4348
4348
|
if (!i) return null;
|
|
4349
|
-
if (i.warnings.forEach((e) =>
|
|
4349
|
+
if (i.warnings.forEach((e) => Re(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 Er(e, t, n) {
|
|
|
4367
4367
|
//#endregion
|
|
4368
4368
|
//#region node_modules/yaml/browser/index.js
|
|
4369
4369
|
var Dr = /* @__PURE__ */ a({
|
|
4370
|
-
Alias: () =>
|
|
4370
|
+
Alias: () => ue,
|
|
4371
4371
|
CST: () => nr,
|
|
4372
4372
|
Composer: () => Vn,
|
|
4373
4373
|
Document: () => $t,
|
|
4374
4374
|
Lexer: () => fr,
|
|
4375
4375
|
LineCounter: () => pr,
|
|
4376
|
-
Pair: () =>
|
|
4376
|
+
Pair: () => U,
|
|
4377
4377
|
Parser: () => xr,
|
|
4378
|
-
Scalar: () =>
|
|
4378
|
+
Scalar: () => L,
|
|
4379
4379
|
Schema: () => Zt,
|
|
4380
4380
|
YAMLError: () => tn,
|
|
4381
|
-
YAMLMap: () =>
|
|
4381
|
+
YAMLMap: () => W,
|
|
4382
4382
|
YAMLParseError: () => nn,
|
|
4383
|
-
YAMLSeq: () =>
|
|
4383
|
+
YAMLSeq: () => $e,
|
|
4384
4384
|
YAMLWarning: () => rn,
|
|
4385
4385
|
isAlias: () => v,
|
|
4386
4386
|
isCollection: () => w,
|
|
@@ -4395,7 +4395,7 @@ var Dr = /* @__PURE__ */ a({
|
|
|
4395
4395
|
parseDocument: () => wr,
|
|
4396
4396
|
stringify: () => Er,
|
|
4397
4397
|
visit: () => A,
|
|
4398
|
-
visitAsync: () =>
|
|
4398
|
+
visitAsync: () => j
|
|
4399
4399
|
}), Or = {
|
|
4400
4400
|
rawNodes: {
|
|
4401
4401
|
address: {
|
|
@@ -7407,6 +7407,7 @@ var X = class {
|
|
|
7407
7407
|
zoneId: e.env?.CLOUDFLARE_ZONE_ID || this.env.CLOUDFLARE_ZONE_ID,
|
|
7408
7408
|
apiToken: e.env?.CLOUDFLARE_API_TOKEN || this.env.CLOUDFLARE_API_TOKEN,
|
|
7409
7409
|
frontendUrl: (e.env?.PUBLIC_FRONTEND_URL || this.env.PUBLIC_FRONTEND_URL || "https://kama.t3cloud.eu").replace(/\/+$/, ""),
|
|
7410
|
+
cdnDomain: e.env?.CDN_DOMAIN || this.env.CDN_DOMAIN,
|
|
7410
7411
|
frontendWorker: e.env?.FRONTEND_WORKER || this.env.FRONTEND_WORKER
|
|
7411
7412
|
};
|
|
7412
7413
|
}
|
|
@@ -7422,6 +7423,10 @@ var X = class {
|
|
|
7422
7423
|
}
|
|
7423
7424
|
} catch {}
|
|
7424
7425
|
}
|
|
7426
|
+
getSafeUrl(e, t, n) {
|
|
7427
|
+
let r = e || (t ? `/media/${t}` : "");
|
|
7428
|
+
return r && n && r.startsWith(`https://${n}/`) && !r.includes("/media/") && (r = r.replace(`https://${n}/`, `https://${n}/media/`)), r;
|
|
7429
|
+
}
|
|
7425
7430
|
async callAstroPurge(e, t) {
|
|
7426
7431
|
let { apiToken: n, frontendUrl: r, frontendWorker: i } = this.getEnv(e), a = `${r}/api/purge`, o = { "Content-Type": "application/json" };
|
|
7427
7432
|
return n && (o.Authorization = `Bearer ${n}`), i && typeof i.fetch == "function" ? i.fetch(a, {
|
|
@@ -7438,8 +7443,8 @@ var X = class {
|
|
|
7438
7443
|
try {
|
|
7439
7444
|
let a = J(e);
|
|
7440
7445
|
if (n) {
|
|
7441
|
-
let e =
|
|
7442
|
-
for (let e of
|
|
7446
|
+
let e = t.prepare("SELECT treeId FROM tree_nodes WHERE contentId = ?"), r = typeof e.all == "function" ? await e.all(n) : await e.bind(n).all(), i = Array.isArray(r) ? r : r?.results || [];
|
|
7447
|
+
for (let e of i) await a.delete(`tree:default:${e.treeId}`), await a.delete(`tree:all:${e.treeId}`);
|
|
7443
7448
|
}
|
|
7444
7449
|
if (r) {
|
|
7445
7450
|
let e = r.replace(/^\/+|\/+$/g, "");
|
|
@@ -7451,38 +7456,39 @@ var X = class {
|
|
|
7451
7456
|
]) await a.delete(`node:${t}:${i}:${e}`), await a.delete(`node:${t}:${i}:/${e}`);
|
|
7452
7457
|
}
|
|
7453
7458
|
if (n) {
|
|
7454
|
-
let e =
|
|
7455
|
-
for (let e of
|
|
7459
|
+
let e = t.prepare("SELECT c.key, c.id FROM node_channels nc JOIN channels c ON nc.channelId = c.id WHERE nc.nodeId = ?"), o = typeof e.all == "function" ? await e.all(n) : await e.bind(n).all(), s = Array.isArray(o) ? o : o?.results || [];
|
|
7460
|
+
for (let e of s) await a.delete(`node:${e.id}:${i}:${r}`), await a.delete(`node:${e.key}:${i}:${r}`);
|
|
7456
7461
|
}
|
|
7457
7462
|
} catch (e) {
|
|
7458
7463
|
console.warn("[CacheManager] Failed to purge internal worker cache:", e);
|
|
7459
7464
|
}
|
|
7460
7465
|
}
|
|
7461
|
-
|
|
7462
|
-
let
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7466
|
+
purgeNode(e, t, n, r = !1) {
|
|
7467
|
+
let i = (async () => {
|
|
7468
|
+
try {
|
|
7469
|
+
let i = t.prepare("SELECT slug, status, language FROM content_nodes WHERE id = ?"), a = (typeof i.get == "function" ? await i.get(n) : (await i.bind(n).all())?.results?.[0]) || {};
|
|
7470
|
+
if (!a.slug) return;
|
|
7471
|
+
let o = t.prepare("\n SELECT DISTINCT a.cdnUrl, a.storageKeyPrivate\n FROM node_assets na\n JOIN assets a ON na.assetId = a.id\n WHERE na.nodeId = ?\n "), s = typeof o.all == "function" ? await o.all(n) : await o.bind(n).all(), c = (Array.isArray(s) ? s : s?.results || []).map((t) => t.url || this.getSafeUrl(t.cdnUrl, t.storageKeyPrivate, this.getEnv(e).cdnDomain)).filter(Boolean);
|
|
7472
|
+
await this.purgeInternalWorkerCache(e, t, n, a.slug, a.language || "en"), await this.purgeAndWarmSlugDirect(e, a.slug, c), r && (console.log("[CacheManager] Structural change detected. Triggering Global Version Bump..."), await this.purgeGlobalCacheDirect(e, t));
|
|
7473
|
+
} catch (e) {
|
|
7474
|
+
console.warn("[CacheManager] purgeNode failed:", e);
|
|
7475
|
+
}
|
|
7476
|
+
})();
|
|
7477
|
+
this.dispatch(e, i);
|
|
7468
7478
|
}
|
|
7469
|
-
|
|
7470
|
-
let
|
|
7471
|
-
|
|
7472
|
-
|
|
7479
|
+
purgeAsset(e, t, n) {
|
|
7480
|
+
let r = (async () => {
|
|
7481
|
+
try {
|
|
7482
|
+
let r = t.prepare("SELECT cdnUrl, storageKeyPrivate FROM assets WHERE id = ? OR parentAssetId = ?"), i = typeof r.all == "function" ? await r.all(n, n) : await r.bind(n, n).all(), a = (Array.isArray(i) ? i : i?.results || []).map((t) => this.getSafeUrl(t.cdnUrl, t.storageKeyPrivate, this.getEnv(e).cdnDomain)).filter(Boolean), o = t.prepare("\n SELECT DISTINCT cn.id, cn.slug, cn.language\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 = ? OR crop.parentAssetId = ? OR crop.id = (SELECT parentAssetId FROM assets WHERE id = ?)\n )\n "), s = typeof o.all == "function" ? await o.all(n, n, n) : await o.bind(n, n, n).all(), c = Array.isArray(s) ? s : s?.results || [];
|
|
7483
|
+
for (let n of c) n.id && n.slug && (await this.purgeInternalWorkerCache(e, t, n.id, n.slug, n.language || "en"), await this.purgeAndWarmSlugDirect(e, n.slug, a));
|
|
7484
|
+
} catch (e) {
|
|
7485
|
+
console.warn("[CacheManager] purgeAsset failed:", e);
|
|
7486
|
+
}
|
|
7473
7487
|
})();
|
|
7474
|
-
this.dispatch(e,
|
|
7488
|
+
this.dispatch(e, r);
|
|
7475
7489
|
}
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
let { frontendUrl: n } = this.getEnv(e), r = await t.prepare("SELECT DISTINCT slug FROM content_nodes WHERE status = 'published' AND slug IS NOT NULL AND (deletedAt IS NULL OR deletedAt = '')").all(), i = Array.isArray(r) ? r : r?.results || [], a = { "X-Cache-Warmer": "true" }, o = Date.now(), s = i.map((e) => {
|
|
7479
|
-
let t = String(e.slug).replace(/^\/+|\/+$/g, ""), r = t === "home" || !t ? n : `${n}/${t}`;
|
|
7480
|
-
return fetch(`${r}?_warmer=${o}`, { headers: a }).then((e) => console.log(`🔥 [CacheWarmer] Tree-wide warm for ${t || "/"}: ${e.status}`)).catch((e) => console.warn(`⚠️ [CacheWarmer] Failed to warm ${t}:`, e));
|
|
7481
|
-
});
|
|
7482
|
-
s.push(fetch(`${n}/?_warmer=${o}`, { headers: a }).then((e) => console.log(`🔥 [CacheWarmer] Tree-wide warm for root /: ${e.status}`)).catch(() => {})), await Promise.all(s), console.log(`✅ [CacheWarmer] Warmed ${s.length} published pages across the tree.`);
|
|
7483
|
-
} catch (e) {
|
|
7484
|
-
console.warn("⚠️ [CacheWarmer] Tree-wide warming failed:", e);
|
|
7485
|
-
}
|
|
7490
|
+
purgeGlobalCache(e, t) {
|
|
7491
|
+
this.dispatch(e, this.purgeGlobalCacheDirect(e, t));
|
|
7486
7492
|
}
|
|
7487
7493
|
async purgeGlobalCacheDirect(e, t) {
|
|
7488
7494
|
try {
|
|
@@ -7490,22 +7496,17 @@ var X = class {
|
|
|
7490
7496
|
console.log("[CacheManager] Executing Direct Global Version Purge...");
|
|
7491
7497
|
let a = await this.callAstroPurge(e, { purge_everything: !0 });
|
|
7492
7498
|
if (!a.ok) {
|
|
7493
|
-
|
|
7494
|
-
console.error(`❌ [CacheManager] Astro Global Purge FAILED (${a.status}): ${e}`);
|
|
7499
|
+
console.error(`❌ [CacheManager] Astro Global Purge FAILED (${a.status})`);
|
|
7495
7500
|
return;
|
|
7496
7501
|
}
|
|
7497
|
-
|
|
7502
|
+
n && r && fetch(`https://api.cloudflare.com/client/v4/zones/${n}/purge_cache`, {
|
|
7498
7503
|
method: "POST",
|
|
7499
7504
|
headers: {
|
|
7500
7505
|
Authorization: `Bearer ${r}`,
|
|
7501
7506
|
"Content-Type": "application/json"
|
|
7502
7507
|
},
|
|
7503
7508
|
body: JSON.stringify({ purge_everything: !0 })
|
|
7504
|
-
}).catch((
|
|
7505
|
-
else {
|
|
7506
|
-
let e = i.replace(/\/+$/, "");
|
|
7507
|
-
fetch(`${e}/?_warmer=${Date.now()}`, { headers: { "X-Cache-Warmer": "true" } }).catch(() => {});
|
|
7508
|
-
}
|
|
7509
|
+
}).catch(() => {}), await new Promise((e) => setTimeout(e, 100)), t ? await this.warmAllPublishedPages(e, t) : fetch(`${i.replace(/\/+$/, "")}/?_warmer=${Date.now()}`, { headers: { "X-Cache-Warmer": "true" } }).catch(() => {});
|
|
7509
7510
|
} catch (e) {
|
|
7510
7511
|
console.error("❌ [CacheManager] Direct Global Purge CRASH:", e);
|
|
7511
7512
|
}
|
|
@@ -7519,34 +7520,31 @@ var X = class {
|
|
|
7519
7520
|
`https://admin.t3cloud.eu/api/v1/node/${o}?channelId=corporate&lang=en`,
|
|
7520
7521
|
`https://admin.t3cloud.eu/api/v1/node/${o}?channelId=default&lang=en`
|
|
7521
7522
|
];
|
|
7522
|
-
for (let e of n) {
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
c.push(`${a}${t}`);
|
|
7526
|
-
}
|
|
7527
|
-
console.log(`[CacheManager] Executing Version Invalidation for ${c.length} URLs...`);
|
|
7528
|
-
let l = await this.callAstroPurge(e, { urls: c });
|
|
7529
|
-
if (!l.ok) {
|
|
7530
|
-
let e = await l.text();
|
|
7531
|
-
console.error(`❌ [CacheManager] Astro Slug Invalidation FAILED (${l.status}): ${e}`);
|
|
7532
|
-
return;
|
|
7533
|
-
}
|
|
7534
|
-
console.log("✅ [CacheManager] Dual Slug Invalidation SUCCESS"), r && i && fetch(`https://api.cloudflare.com/client/v4/zones/${r}/purge_cache`, {
|
|
7523
|
+
for (let e of n) e && c.push(`${a}${e.startsWith("/") ? e : `/${e}`}`);
|
|
7524
|
+
if (!(await this.callAstroPurge(e, { urls: c })).ok) return;
|
|
7525
|
+
r && i && fetch(`https://api.cloudflare.com/client/v4/zones/${r}/purge_cache`, {
|
|
7535
7526
|
method: "POST",
|
|
7536
7527
|
headers: {
|
|
7537
7528
|
Authorization: `Bearer ${i}`,
|
|
7538
7529
|
"Content-Type": "application/json"
|
|
7539
7530
|
},
|
|
7540
7531
|
body: JSON.stringify({ files: c })
|
|
7541
|
-
}).catch((
|
|
7542
|
-
console.log(`🔥 [CacheWarmer] Warm state for ${s}: ${e.status}`);
|
|
7543
|
-
}).catch((e) => {
|
|
7544
|
-
console.warn(`⚠️ [CacheWarmer] Failed to warm ${s}:`, e);
|
|
7545
|
-
});
|
|
7532
|
+
}).catch(() => {}), await new Promise((e) => setTimeout(e, 100)), fetch(`${s}?_warmer=${Date.now()}`, { headers: { "X-Cache-Warmer": "true" } }).catch(() => {});
|
|
7546
7533
|
} catch (e) {
|
|
7547
7534
|
console.error("❌ [CacheManager] Dual Slug Purge CRASH:", e);
|
|
7548
7535
|
}
|
|
7549
7536
|
}
|
|
7537
|
+
async warmAllPublishedPages(e, t) {
|
|
7538
|
+
try {
|
|
7539
|
+
let { frontendUrl: n } = this.getEnv(e), r = t.prepare("SELECT DISTINCT slug FROM content_nodes WHERE status = 'published' AND slug IS NOT NULL AND (deletedAt IS NULL OR deletedAt = '')"), i = typeof r.all == "function" ? await r.all() : await r.bind().all(), a = Array.isArray(i) ? i : i?.results || [], o = { "X-Cache-Warmer": "true" }, s = Date.now(), c = a.map((e) => {
|
|
7540
|
+
let t = String(e.slug).replace(/^\/+|\/+$/g, ""), r = t === "home" || !t ? n : `${n}/${t}`;
|
|
7541
|
+
return fetch(`${r}?_warmer=${s}`, { headers: o }).catch(() => {});
|
|
7542
|
+
});
|
|
7543
|
+
c.push(fetch(`${n}/?_warmer=${s}`, { headers: o }).catch(() => {})), await Promise.all(c);
|
|
7544
|
+
} catch (e) {
|
|
7545
|
+
console.warn("⚠️ [CacheWarmer] Tree-wide warming failed:", e);
|
|
7546
|
+
}
|
|
7547
|
+
}
|
|
7550
7548
|
}, Z = new e();
|
|
7551
7549
|
async function ui(e, t, n = []) {
|
|
7552
7550
|
let r = e.prepare(t);
|
|
@@ -7565,25 +7563,18 @@ async function di(e, t, n = []) {
|
|
|
7565
7563
|
if (typeof r.bind == "function") return r.bind(...n).run();
|
|
7566
7564
|
if (typeof r.run == "function") return r.run(...n);
|
|
7567
7565
|
}
|
|
7568
|
-
|
|
7569
|
-
try {
|
|
7570
|
-
return (await ui(e, "\n SELECT DISTINCT a.url\n FROM node_assets na\n JOIN assets a ON na.assetId = a.id\n WHERE na.nodeId = ? AND a.url IS NOT NULL AND a.url != ''\n ", [t])).map((e) => e.url).filter(Boolean);
|
|
7571
|
-
} catch {
|
|
7572
|
-
return [];
|
|
7573
|
-
}
|
|
7574
|
-
}
|
|
7575
|
-
function pi(e) {
|
|
7566
|
+
function fi(e) {
|
|
7576
7567
|
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;
|
|
7577
7568
|
}
|
|
7578
|
-
function
|
|
7569
|
+
function pi(e) {
|
|
7579
7570
|
return +(e === !0 || e === 1 || e === "1" || e === "true");
|
|
7580
7571
|
}
|
|
7581
|
-
function
|
|
7572
|
+
function mi(e) {
|
|
7582
7573
|
if (e == null || e === "null" || e === "" || typeof e == "string" && e.startsWith("draft-")) return null;
|
|
7583
7574
|
let t = Number(e);
|
|
7584
7575
|
return isNaN(t) ? null : t;
|
|
7585
7576
|
}
|
|
7586
|
-
function
|
|
7577
|
+
function hi(e) {
|
|
7587
7578
|
let t = { ...e };
|
|
7588
7579
|
for (let e of [
|
|
7589
7580
|
"id",
|
|
@@ -7612,10 +7603,10 @@ function gi(e) {
|
|
|
7612
7603
|
]) delete t[e];
|
|
7613
7604
|
return t;
|
|
7614
7605
|
}
|
|
7615
|
-
function
|
|
7616
|
-
return e ? typeof e == "string" ? (e.startsWith("ast_") && t.add(e), t) : Array.isArray(e) ? (e.forEach((e) =>
|
|
7606
|
+
function gi(e, t = /* @__PURE__ */ new Set()) {
|
|
7607
|
+
return e ? typeof e == "string" ? (e.startsWith("ast_") && t.add(e), t) : Array.isArray(e) ? (e.forEach((e) => gi(e, t)), t) : (typeof e == "object" && Object.values(e).forEach((e) => gi(e, t)), t) : t;
|
|
7617
7608
|
}
|
|
7618
|
-
async function
|
|
7609
|
+
async function _i(e, t, n) {
|
|
7619
7610
|
for (let r of n) {
|
|
7620
7611
|
let n = (await ui(e, "\n SELECT id, storageKeyPrivate, isSystemVariant, parentAssetId, filename\n FROM assets WHERE id = ?\n ", [r]))[0];
|
|
7621
7612
|
if (!n || (await ui(e, "SELECT 1 FROM node_assets WHERE assetId = ? LIMIT 1", [n.id])).length > 0) continue;
|
|
@@ -7634,7 +7625,7 @@ async function vi(e, t, n) {
|
|
|
7634
7625
|
await di(e, `DELETE FROM node_assets WHERE assetId IN (${o})`, a), await di(e, `DELETE FROM assets WHERE id IN (${o})`, a);
|
|
7635
7626
|
}
|
|
7636
7627
|
}
|
|
7637
|
-
async function
|
|
7628
|
+
async function vi(e, t, n) {
|
|
7638
7629
|
let r = {}, i = null;
|
|
7639
7630
|
if (t) {
|
|
7640
7631
|
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 || [];
|
|
@@ -7686,18 +7677,18 @@ Z.get("/", async (e) => {
|
|
|
7686
7677
|
if (s) try {
|
|
7687
7678
|
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 = li(e.env?.BUNDLED_DEFINITIONS).nodes?.[i.contentType] || {}, l = n.layoutId || null;
|
|
7688
7679
|
if (a) {
|
|
7689
|
-
let { resolvedLayoutId: e, inheritedFields: r } = await
|
|
7680
|
+
let { resolvedLayoutId: e, inheritedFields: r } = await vi(t, a.parentId, a.treeId);
|
|
7690
7681
|
(l === "inherit" || !l) && (l = e || c.defaultLayout || null);
|
|
7691
7682
|
for (let [e, t] of Object.entries(r)) (n[e] === void 0 || n[e] === null || n[e] === "") && t !== void 0 && (n[e] = t);
|
|
7692
7683
|
} else (l === "inherit" || !l) && (l = c.defaultLayout || null);
|
|
7693
|
-
let u = await oi(t,
|
|
7684
|
+
let u = await oi(t, hi(n));
|
|
7694
7685
|
Object.assign(o, u), o.resolvedLayoutId = l;
|
|
7695
7686
|
} catch {}
|
|
7696
7687
|
let c = await t.prepare("SELECT channelId FROM node_channels WHERE nodeId = ?").all(r);
|
|
7697
7688
|
o.channels = (Array.isArray(c) ? c : c?.results || []).map((e) => e.channelId);
|
|
7698
7689
|
let l = await t.prepare("SELECT treeId, parentId, sortOrder FROM tree_nodes WHERE contentId = ?").all(r);
|
|
7699
7690
|
o.trees = Array.isArray(l) ? l : l?.results || [];
|
|
7700
|
-
let u = await t.prepare("
|
|
7691
|
+
let u = await t.prepare("SELECT * FROM content_blocks WHERE contentId = ? AND isDraft = 1 ORDER BY sortOrder ASC").all(r), d = Array.isArray(u) ? u : u?.results || [], f = await Promise.all(d.map(async (e) => {
|
|
7701
7692
|
let n = {};
|
|
7702
7693
|
try {
|
|
7703
7694
|
n = typeof e.dataJson == "string" ? JSON.parse(e.dataJson || "{}") : e.dataJson || {}, n && typeof n == "object" && (n = await oi(t, n));
|
|
@@ -7719,12 +7710,9 @@ Z.get("/", async (e) => {
|
|
|
7719
7710
|
});
|
|
7720
7711
|
}
|
|
7721
7712
|
let m = [], h = [o ? "(cn.deletedAt IS NOT NULL AND cn.deletedAt != '')" : "(cn.deletedAt IS NULL OR cn.deletedAt = '')"];
|
|
7722
|
-
if (a && a !== "all" && (h.push("EXISTS (SELECT 1 FROM node_channels nc WHERE nc.nodeId = cn.id AND nc.channelId = ?)"), m.push(Number(a) || a)), s && (h.push("\n EXISTS (\n SELECT 1 FROM node_assets na_f \n JOIN assets a_f ON a_f.id = na_f.assetId\n WHERE na_f.nodeId = cn.id \n AND (
|
|
7713
|
+
if (a && a !== "all" && (h.push("EXISTS (SELECT 1 FROM node_channels nc WHERE nc.nodeId = cn.id AND nc.channelId = ?)"), m.push(Number(a) || a)), s && (h.push("\n EXISTS (\n SELECT 1 FROM node_assets na_f \n JOIN assets a_f ON a_f.id = na_f.assetId\n WHERE na_f.nodeId = cn.id \n AND (na_f.assetId = ? OR a_f.parentAssetId = ? OR a_f.id = (SELECT parentAssetId FROM assets WHERE id = ?))\n )\n "), m.push(s, s, s)), r && r !== "all") {
|
|
7723
7714
|
let e = r.split(",").map((e) => e.trim()).filter(Boolean);
|
|
7724
|
-
|
|
7725
|
-
let t = e.map(() => "?").join(",");
|
|
7726
|
-
h.push(`cn.contentType IN (${t})`), m.push(...e);
|
|
7727
|
-
}
|
|
7715
|
+
e.length > 0 && (h.push(`cn.contentType IN (${e.map(() => "?").join(",")})`), m.push(...e));
|
|
7728
7716
|
}
|
|
7729
7717
|
if (i && i.trim()) {
|
|
7730
7718
|
h.push("(cn.title LIKE ? OR cn.slug LIKE ?)");
|
|
@@ -7744,19 +7732,12 @@ Z.get("/", async (e) => {
|
|
|
7744
7732
|
b[c] && (y = b[c]);
|
|
7745
7733
|
let x = `
|
|
7746
7734
|
WITH filtered_nodes AS (
|
|
7747
|
-
SELECT cn.*
|
|
7748
|
-
FROM content_nodes cn
|
|
7749
|
-
${g}
|
|
7750
|
-
ORDER BY ${y} ${l}
|
|
7751
|
-
LIMIT ? OFFSET ?
|
|
7735
|
+
SELECT cn.* FROM content_nodes cn ${g} ORDER BY ${y} ${l} LIMIT ? OFFSET ?
|
|
7752
7736
|
)
|
|
7753
|
-
SELECT
|
|
7754
|
-
fn.*,
|
|
7755
|
-
COUNT(na.assetId) as assetCount
|
|
7737
|
+
SELECT fn.*, COUNT(na.assetId) as assetCount
|
|
7756
7738
|
FROM filtered_nodes fn
|
|
7757
7739
|
LEFT JOIN node_assets na ON fn.id = na.nodeId
|
|
7758
|
-
GROUP BY fn.id
|
|
7759
|
-
ORDER BY ${y.replace("cn.", "fn.")} ${l}
|
|
7740
|
+
GROUP BY fn.id ORDER BY ${y.replace("cn.", "fn.")} ${l}
|
|
7760
7741
|
`, S = [
|
|
7761
7742
|
...m,
|
|
7762
7743
|
f,
|
|
@@ -7764,19 +7745,17 @@ Z.get("/", async (e) => {
|
|
|
7764
7745
|
], C = await t.prepare(x).all(...S), w = Array.isArray(C) ? C : C?.results || [], T = w.map((e) => e.id), E = {}, D = {};
|
|
7765
7746
|
if (T.length > 0) {
|
|
7766
7747
|
let e = T.map(() => "?").join(","), n = await t.prepare(`
|
|
7767
|
-
SELECT nc.nodeId, c.label
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
`).all(...T), a = Array.isArray(i) ? i : a?.results || [];
|
|
7779
|
-
for (let e of a) D[e.nodeId] || (D[e.nodeId] = []), D[e.nodeId].includes(e.label) || D[e.nodeId].push(e.label);
|
|
7748
|
+
SELECT nc.nodeId, c.label FROM node_channels nc JOIN channels c ON nc.channelId = c.id WHERE nc.nodeId IN (${e})
|
|
7749
|
+
`).all(...T);
|
|
7750
|
+
(Array.isArray(n) ? n : n?.results || []).forEach((e) => {
|
|
7751
|
+
E[e.nodeId] || (E[e.nodeId] = []), E[e.nodeId].push(e.label);
|
|
7752
|
+
});
|
|
7753
|
+
let r = await t.prepare(`
|
|
7754
|
+
SELECT tn.contentId as nodeId, t.label FROM tree_nodes tn JOIN trees t ON tn.treeId = t.id WHERE tn.contentId IN (${e})
|
|
7755
|
+
`).all(...T);
|
|
7756
|
+
(Array.isArray(r) ? r : r?.results || []).forEach((e) => {
|
|
7757
|
+
D[e.nodeId] || (D[e.nodeId] = []), D[e.nodeId].includes(e.label) || D[e.nodeId].push(e.label);
|
|
7758
|
+
});
|
|
7780
7759
|
}
|
|
7781
7760
|
let O = await Promise.all(w.map(async (e) => {
|
|
7782
7761
|
let n = (e.status === "draft" || !e.status) && !!e.publishedAt, r = {
|
|
@@ -7800,7 +7779,7 @@ Z.get("/", async (e) => {
|
|
|
7800
7779
|
assetCount: e.assetCount || 0
|
|
7801
7780
|
}, i = e.draftDataJson || e.dataJson;
|
|
7802
7781
|
if (i) try {
|
|
7803
|
-
let e = typeof i == "string" ? JSON.parse(i) : i, n = await oi(t,
|
|
7782
|
+
let e = typeof i == "string" ? JSON.parse(i) : i, n = await oi(t, hi(e));
|
|
7804
7783
|
Object.assign(r, n);
|
|
7805
7784
|
} catch {}
|
|
7806
7785
|
return r;
|
|
@@ -7813,21 +7792,50 @@ Z.get("/", async (e) => {
|
|
|
7813
7792
|
limit: f
|
|
7814
7793
|
});
|
|
7815
7794
|
}), Z.post("/", async (e) => {
|
|
7816
|
-
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, { cleanedData: v, assetRefs: y } = ri(
|
|
7817
|
-
if (E
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
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, { cleanedData: v, assetRefs: y } = ri(hi(_)), b = pi(d === void 0 ? f === void 0 ? p : f : d), x = c || "en", S = l || u || "page", C = e.get("user")?.id || null, w = a, T = /* @__PURE__ */ new Set(), E = s === void 0 ? null : fi(s);
|
|
7796
|
+
if (E) {
|
|
7797
|
+
let n = !1, r = [];
|
|
7798
|
+
if (g !== void 0 && Array.isArray(g) && g.length > 0) for (let e of g) r.push({
|
|
7799
|
+
treeId: Number(e.treeId),
|
|
7800
|
+
parentId: mi(e.parentId ?? e._draftParentId ?? null)
|
|
7801
|
+
});
|
|
7802
|
+
else if (a) {
|
|
7803
|
+
let e = await t.prepare("SELECT treeId, parentId FROM tree_nodes WHERE contentId = ?").all(a), n = Array.isArray(e) ? e : e?.results || [];
|
|
7804
|
+
for (let e of n) r.push({
|
|
7805
|
+
treeId: Number(e.treeId),
|
|
7806
|
+
parentId: e.parentId === null ? null : Number(e.parentId)
|
|
7807
|
+
});
|
|
7808
|
+
}
|
|
7809
|
+
for (let e of r) {
|
|
7810
|
+
let r = e.parentId === null ? "tn.parentId IS NULL" : "tn.parentId = ?", i = e.parentId === null ? [e.treeId, E] : [
|
|
7811
|
+
e.treeId,
|
|
7812
|
+
e.parentId,
|
|
7813
|
+
E
|
|
7814
|
+
], o = `
|
|
7815
|
+
SELECT cn.id FROM tree_nodes tn
|
|
7816
|
+
INNER JOIN content_nodes cn ON tn.contentId = cn.id
|
|
7817
|
+
WHERE tn.treeId = ? AND ${r} AND cn.slug = ? AND (cn.deletedAt IS NULL OR cn.deletedAt = '')
|
|
7818
|
+
`;
|
|
7819
|
+
if (a && (o += " AND cn.id != ?", i.push(a)), o += " LIMIT 1", await t.prepare(o).get(...i)) {
|
|
7820
|
+
n = !0;
|
|
7821
|
+
break;
|
|
7822
|
+
}
|
|
7823
|
+
}
|
|
7824
|
+
if (n) return e.json({
|
|
7825
|
+
error: `The slug '${E}' is already in use by another page in this section.`,
|
|
7826
|
+
field: "slug"
|
|
7827
|
+
}, 409);
|
|
7828
|
+
}
|
|
7821
7829
|
if (a) {
|
|
7822
7830
|
let e = await t.prepare("SELECT title, slug, language, contentType, draftDataJson, dataJson, publishedAt, status FROM content_nodes WHERE id = ?").get(a), n = e?.draftDataJson || e?.dataJson || "{}";
|
|
7823
7831
|
try {
|
|
7824
|
-
|
|
7832
|
+
gi(typeof n == "string" ? JSON.parse(n) : n, T);
|
|
7825
7833
|
} catch {}
|
|
7826
7834
|
if (m !== void 0) {
|
|
7827
7835
|
let e = await t.prepare("SELECT dataJson FROM content_blocks WHERE contentId = ? AND isDraft = 1").all(a);
|
|
7828
7836
|
(Array.isArray(e) ? e : e?.results || []).forEach((e) => {
|
|
7829
7837
|
try {
|
|
7830
|
-
|
|
7838
|
+
gi(typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson, T);
|
|
7831
7839
|
} catch {}
|
|
7832
7840
|
});
|
|
7833
7841
|
}
|
|
@@ -7839,17 +7847,17 @@ Z.get("/", async (e) => {
|
|
|
7839
7847
|
...u,
|
|
7840
7848
|
...v
|
|
7841
7849
|
});
|
|
7842
|
-
await t.prepare("\n UPDATE content_nodes \n SET title = ?,
|
|
7850
|
+
await t.prepare("\n UPDATE content_nodes \n SET title = ?, slug = ?, language = ?, contentType = ?, isHidden = ?, status = 'draft', draftDataJson = ?, updatedById = ?, updatedAt = CURRENT_TIMESTAMP\n WHERE id = ?\n ").run(r, i, c, s, b, d, C, a);
|
|
7843
7851
|
} else {
|
|
7844
|
-
let e =
|
|
7845
|
-
w = Number(
|
|
7852
|
+
let e = await t.prepare("\n INSERT INTO content_nodes (contentType, title, slug, language, isHidden, status, draftDataJson, dataJson, createdById, updatedById)\n VALUES (?, ?, ?, ?, ?, 'draft', ?, NULL, ?, ?)\n ").run(S, o || "Untitled", E, x, b, JSON.stringify(v), C, C);
|
|
7853
|
+
w = Number(e.lastInsertRowid);
|
|
7846
7854
|
}
|
|
7847
7855
|
if (h !== void 0 && Array.isArray(h) && w) {
|
|
7848
7856
|
await t.prepare("DELETE FROM node_channels WHERE nodeId = ?").run(w);
|
|
7849
|
-
let e = h.map((e) => typeof e == "object" && e ? e.id || e.channelId : e)
|
|
7850
|
-
if (
|
|
7851
|
-
let
|
|
7852
|
-
await t.prepare(`INSERT OR IGNORE INTO node_channels (nodeId, channelId) VALUES ${
|
|
7857
|
+
let e = [...new Set(h.map((e) => typeof e == "object" && e ? e.id || e.channelId : e))].filter((e) => e && e !== "all").map((e) => Number(e) || e);
|
|
7858
|
+
if (e.length > 0) {
|
|
7859
|
+
let n = e.map(() => "(?, ?)").join(", "), r = e.flatMap((e) => [w, e]);
|
|
7860
|
+
await t.prepare(`INSERT OR IGNORE INTO node_channels (nodeId, channelId) VALUES ${n}`).run(...r);
|
|
7853
7861
|
}
|
|
7854
7862
|
}
|
|
7855
7863
|
if (g !== void 0 && Array.isArray(g) && g.length > 0 && w) {
|
|
@@ -7858,10 +7866,10 @@ Z.get("/", async (e) => {
|
|
|
7858
7866
|
let t = Number(e.treeId) || e.treeId;
|
|
7859
7867
|
if (!r.has(t)) {
|
|
7860
7868
|
r.add(t);
|
|
7861
|
-
let o = n.find((e) => Number(e.treeId) === Number(t)), s =
|
|
7869
|
+
let o = n.find((e) => Number(e.treeId) === Number(t)), s = mi(e.parentId ?? e._draftParentId ?? null);
|
|
7862
7870
|
s === null && o && o.parentId !== null && (s = o.parentId);
|
|
7863
|
-
let c = 0;
|
|
7864
|
-
|
|
7871
|
+
let c = typeof e.sortOrder == "number" ? e.sortOrder : o && typeof o.sortOrder == "number" ? o.sortOrder : 0;
|
|
7872
|
+
i.push("(?, ?, ?, ?)"), a.push(t, w, s, c);
|
|
7865
7873
|
}
|
|
7866
7874
|
}
|
|
7867
7875
|
i.length > 0 && (await t.prepare("DELETE FROM tree_nodes WHERE contentId = ?").run(w), await t.prepare(`INSERT INTO tree_nodes (treeId, contentId, parentId, sortOrder) VALUES ${i.join(", ")}`).run(...a));
|
|
@@ -7876,12 +7884,10 @@ Z.get("/", async (e) => {
|
|
|
7876
7884
|
blockId: o,
|
|
7877
7885
|
_instanceId: o
|
|
7878
7886
|
});
|
|
7879
|
-
c.forEach((e) => {
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
});
|
|
7884
|
-
});
|
|
7887
|
+
c.forEach((e) => D.push({
|
|
7888
|
+
...e,
|
|
7889
|
+
fieldKey: `blocks[${t}].${e.fieldKey}`
|
|
7890
|
+
}));
|
|
7885
7891
|
let l = r.region !== void 0 && r.region !== null && String(r.region).trim() !== "" ? String(r.region) : "content";
|
|
7886
7892
|
e.push("(?, ?, ?, ?, ?, 1)"), n.push(w, t, i, JSON.stringify(s), l);
|
|
7887
7893
|
}
|
|
@@ -7891,7 +7897,7 @@ Z.get("/", async (e) => {
|
|
|
7891
7897
|
let n = [...y, ...D];
|
|
7892
7898
|
await ii(t, w, n);
|
|
7893
7899
|
let r = new Set(n.map((e) => e.assetId)), i = new Set([...T].filter((e) => !r.has(e)));
|
|
7894
|
-
i.size > 0 && await
|
|
7900
|
+
i.size > 0 && await _i(t, ni(e.env), i);
|
|
7895
7901
|
}
|
|
7896
7902
|
return await J(e).clear(), e.json({
|
|
7897
7903
|
success: !0,
|
|
@@ -7912,7 +7918,7 @@ Z.get("/", async (e) => {
|
|
|
7912
7918
|
c = typeof o.draftDataJson == "string" ? JSON.parse(o.draftDataJson) : o.draftDataJson || {};
|
|
7913
7919
|
} catch {}
|
|
7914
7920
|
let l = (s.title ?? o.title ?? "").trim(), u = (c.title ?? n.title ?? o.title ?? "").trim(), d = (s.slug ?? o.slug ?? "").trim(), f = (c.slug ?? n.slug ?? o.slug ?? "").trim(), p = l !== "" && u !== "" && l !== u || d !== "" && f !== "" && d !== f, m = o.draftDataJson || o.dataJson || "{}";
|
|
7915
|
-
await t.prepare("\n UPDATE content_nodes\n SET publishedDataJson =
|
|
7921
|
+
await t.prepare("\n UPDATE content_nodes\n SET publishedDataJson = ?, dataJson = ?, publishedAt = CURRENT_TIMESTAMP, status = 'published', updatedById = ?, updatedAt = CURRENT_TIMESTAMP\n WHERE id = ?\n ").run(m, m, a, i), await t.prepare("DELETE FROM content_blocks WHERE contentId = ? AND isDraft = 0").run(i);
|
|
7916
7922
|
let h = await t.prepare("SELECT * FROM content_blocks WHERE contentId = ? AND isDraft = 1 ORDER BY sortOrder ASC").all(i), g = Array.isArray(h) ? h : h?.results || [];
|
|
7917
7923
|
if (g.length > 0) {
|
|
7918
7924
|
let e = [], n = [];
|
|
@@ -7931,9 +7937,7 @@ Z.get("/", async (e) => {
|
|
|
7931
7937
|
},
|
|
7932
7938
|
blocks: g
|
|
7933
7939
|
};
|
|
7934
|
-
await t.prepare("
|
|
7935
|
-
let y = await fi(t, i), b = new X(e.env);
|
|
7936
|
-
return b.purgeInternalWorkerCache(e, t, i, o.slug, o.language || "en"), b.purgeSmart(e, t, i, o.slug, y, p), e.json({
|
|
7940
|
+
return await t.prepare("INSERT INTO node_revisions (nodeId, version, snapshotJson, createdById) VALUES (?, ?, ?, ?)").run(i, _, v.publishedAt, a), await J(e).clear(), new X(e.env).purgeNode(e, t, i, p), e.json({
|
|
7937
7941
|
success: !0,
|
|
7938
7942
|
id: i,
|
|
7939
7943
|
status: "published",
|
|
@@ -7943,45 +7947,30 @@ Z.get("/", async (e) => {
|
|
|
7943
7947
|
}), Z.delete("/", async (e) => {
|
|
7944
7948
|
let t = e.get("db"), n = e.req.query("id");
|
|
7945
7949
|
if (!n) return e.json({ error: "Node ID required" }, 400);
|
|
7946
|
-
let r = Number(n)
|
|
7947
|
-
await t.prepare("UPDATE content_nodes SET deletedAt = CURRENT_TIMESTAMP WHERE id = ?").run(r), await J(e).clear()
|
|
7948
|
-
let a = new X(e.env);
|
|
7949
|
-
if (i && a.purgeInternalWorkerCache(e, t, r, i.slug, i.language || "en"), i && i.status === "published") {
|
|
7950
|
-
let n = await fi(t, r);
|
|
7951
|
-
i.slug && a.purgeAndWarmSlug(e, i.slug, n), a.purgeSmart(e, t, r, i.slug, n, !0);
|
|
7952
|
-
}
|
|
7953
|
-
return e.json({
|
|
7950
|
+
let r = Number(n);
|
|
7951
|
+
return await t.prepare("UPDATE content_nodes SET deletedAt = CURRENT_TIMESTAMP WHERE id = ?").run(r), await J(e).clear(), new X(e.env).purgeNode(e, t, r, !0), e.json({
|
|
7954
7952
|
success: !0,
|
|
7955
7953
|
deletedNodeId: r
|
|
7956
7954
|
});
|
|
7957
7955
|
}), Z.post("/restore", async (e) => {
|
|
7958
7956
|
let t = e.get("db"), n = await e.req.json(), r = Number(n.id);
|
|
7959
|
-
|
|
7960
|
-
let i = await t.prepare("SELECT slug, language, status FROM content_nodes WHERE id = ?").get(r);
|
|
7961
|
-
if (!i) return e.json({ error: "Node not found" }, 404);
|
|
7962
|
-
await t.prepare("UPDATE content_nodes SET deletedAt = NULL WHERE id = ?").run(r), await J(e).clear();
|
|
7963
|
-
let a = new X(e.env);
|
|
7964
|
-
if (i && a.purgeInternalWorkerCache(e, t, r, i.slug, i.language || "en"), i && i.status === "published") {
|
|
7965
|
-
let n = await fi(t, r);
|
|
7966
|
-
i.slug && a.purgeAndWarmSlug(e, i.slug, n), a.purgeSmart(e, t, r, i.slug, n, !0);
|
|
7967
|
-
}
|
|
7968
|
-
return e.json({
|
|
7957
|
+
return r ? await t.prepare("SELECT id FROM content_nodes WHERE id = ?").get(r) ? (await t.prepare("UPDATE content_nodes SET deletedAt = NULL WHERE id = ?").run(r), await J(e).clear(), new X(e.env).purgeNode(e, t, r, !0), e.json({
|
|
7969
7958
|
success: !0,
|
|
7970
7959
|
restoredNodeId: r
|
|
7971
|
-
});
|
|
7960
|
+
})) : e.json({ error: "Node not found" }, 404) : e.json({ error: "Node ID required" }, 400);
|
|
7972
7961
|
}), Z.delete("/purge", async (e) => {
|
|
7973
7962
|
let t = e.get("db"), n = e.req.query("id");
|
|
7974
7963
|
if (!n) return e.json({ error: "Node ID required" }, 400);
|
|
7975
|
-
let r = Number(n)
|
|
7976
|
-
return
|
|
7964
|
+
let r = Number(n);
|
|
7965
|
+
return new X(e.env).purgeNode(e, t, r, !0), 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 J(e).clear(), e.json({
|
|
7977
7966
|
success: !0,
|
|
7978
7967
|
purgedNodeId: r
|
|
7979
7968
|
});
|
|
7980
7969
|
});
|
|
7981
7970
|
//#endregion
|
|
7982
7971
|
//#region server/routes/admin/trees.ts
|
|
7983
|
-
var
|
|
7984
|
-
function
|
|
7972
|
+
var yi = new e();
|
|
7973
|
+
function bi(e, t = null) {
|
|
7985
7974
|
let n = [];
|
|
7986
7975
|
for (let r = 0; r < e.length; r++) {
|
|
7987
7976
|
let i = e[r];
|
|
@@ -7993,19 +7982,19 @@ function xi(e, t = null) {
|
|
|
7993
7982
|
id: o,
|
|
7994
7983
|
parentId: t,
|
|
7995
7984
|
sortOrder: r
|
|
7996
|
-
}), i.children && Array.isArray(i.children) && i.children.length > 0 && n.push(...
|
|
7985
|
+
}), i.children && Array.isArray(i.children) && i.children.length > 0 && n.push(...bi(i.children, o)));
|
|
7997
7986
|
}
|
|
7998
7987
|
return n;
|
|
7999
7988
|
}
|
|
8000
|
-
function
|
|
7989
|
+
function xi(e) {
|
|
8001
7990
|
if (e == null || e === "null" || e === "" || typeof e == "string" && e.startsWith("draft-")) return null;
|
|
8002
7991
|
let t = Number(e);
|
|
8003
7992
|
return isNaN(t) ? null : t;
|
|
8004
7993
|
}
|
|
8005
|
-
function
|
|
7994
|
+
function Si(e) {
|
|
8006
7995
|
return +(e === !0 || e === 1 || e === "1" || e === "true");
|
|
8007
7996
|
}
|
|
8008
|
-
|
|
7997
|
+
yi.get("/tree.json", async (e) => {
|
|
8009
7998
|
try {
|
|
8010
7999
|
let t = e.get("db"), n = e.req.query("treeId") || "main-nav", r = e.req.query("preview") === "true", i = 1;
|
|
8011
8000
|
if (isNaN(Number(n))) {
|
|
@@ -8055,7 +8044,7 @@ bi.get("/tree.json", async (e) => {
|
|
|
8055
8044
|
} catch (t) {
|
|
8056
8045
|
return console.error("[CMS Tree API] GET Error:", t), e.json({ error: t.message || "Failed to fetch tree" }, 500);
|
|
8057
8046
|
}
|
|
8058
|
-
}),
|
|
8047
|
+
}), yi.post("/tree.json", async (e) => {
|
|
8059
8048
|
try {
|
|
8060
8049
|
let t = e.get("db"), n = await e.req.json(), r = n.treeId ? String(n.treeId).trim() : "main-nav", i = J(e), a = new X(e.env), o = 1;
|
|
8061
8050
|
if (isNaN(Number(r))) {
|
|
@@ -8067,7 +8056,7 @@ bi.get("/tree.json", async (e) => {
|
|
|
8067
8056
|
}
|
|
8068
8057
|
} else o = Number(r);
|
|
8069
8058
|
if (n.tree && Array.isArray(n.tree)) {
|
|
8070
|
-
let r =
|
|
8059
|
+
let r = bi(n.tree, null);
|
|
8071
8060
|
if (r.length > 0) for (let e = 0; e < r.length; e += 50) {
|
|
8072
8061
|
let n = r.slice(e, e + 50), i = n.map((e) => e.id), a = i.map(() => "?").join(","), s = "UPDATE tree_nodes SET \n";
|
|
8073
8062
|
s += "parentId = CASE id \n", n.forEach(() => {
|
|
@@ -8087,9 +8076,9 @@ bi.get("/tree.json", async (e) => {
|
|
|
8087
8076
|
reorderedCount: r.length
|
|
8088
8077
|
});
|
|
8089
8078
|
}
|
|
8090
|
-
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 =
|
|
8079
|
+
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 = Si(n.isHidden === void 0 ? m.isHidden === void 0 ? m.hidden : m.isHidden : n.isHidden);
|
|
8091
8080
|
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;
|
|
8092
|
-
let g =
|
|
8081
|
+
let g = xi(u), _ = e.get("user")?.id || null;
|
|
8093
8082
|
if (s === "create") {
|
|
8094
8083
|
let r = m.slug || n.slug || c, s = r ? String(r).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "") : null;
|
|
8095
8084
|
if (s) {
|
|
@@ -8178,7 +8167,7 @@ bi.get("/tree.json", async (e) => {
|
|
|
8178
8167
|
details: t.message
|
|
8179
8168
|
}, 500);
|
|
8180
8169
|
}
|
|
8181
|
-
}),
|
|
8170
|
+
}), yi.get("/trees.json", async (e) => {
|
|
8182
8171
|
try {
|
|
8183
8172
|
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) => {
|
|
8184
8173
|
let n = Number(t.treeId), r = Number(t.channelId);
|
|
@@ -8208,7 +8197,7 @@ bi.get("/tree.json", async (e) => {
|
|
|
8208
8197
|
} catch {
|
|
8209
8198
|
return e.json([]);
|
|
8210
8199
|
}
|
|
8211
|
-
}),
|
|
8200
|
+
}), yi.post("/trees.json", async (e) => {
|
|
8212
8201
|
try {
|
|
8213
8202
|
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 };
|
|
8214
8203
|
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({
|
|
@@ -8247,7 +8236,7 @@ bi.get("/tree.json", async (e) => {
|
|
|
8247
8236
|
} catch (t) {
|
|
8248
8237
|
return console.error("[API Trees] Error saving tree:", t), e.json({ error: t.message || "Failed to save tree" }, 500);
|
|
8249
8238
|
}
|
|
8250
|
-
}),
|
|
8239
|
+
}), yi.delete("/trees.json", async (e) => {
|
|
8251
8240
|
let t = e.get("db"), n = e.req.query("id");
|
|
8252
8241
|
if (!n) return e.json({ error: "Tree ID required" }, 400);
|
|
8253
8242
|
let r = Number(n);
|
|
@@ -8262,8 +8251,8 @@ bi.get("/tree.json", async (e) => {
|
|
|
8262
8251
|
});
|
|
8263
8252
|
//#endregion
|
|
8264
8253
|
//#region server/routes/admin/channels.ts
|
|
8265
|
-
var
|
|
8266
|
-
|
|
8254
|
+
var Ci = new e();
|
|
8255
|
+
Ci.get("/", async (e) => {
|
|
8267
8256
|
try {
|
|
8268
8257
|
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) => {
|
|
8269
8258
|
e[t.channelId] || (e[t.channelId] = []);
|
|
@@ -8329,7 +8318,7 @@ wi.get("/", async (e) => {
|
|
|
8329
8318
|
error: t.message
|
|
8330
8319
|
}, 500);
|
|
8331
8320
|
}
|
|
8332
|
-
}),
|
|
8321
|
+
}), Ci.post("/", async (e) => {
|
|
8333
8322
|
try {
|
|
8334
8323
|
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;
|
|
8335
8324
|
if (await t.prepare("SELECT id FROM channels WHERE key = ? AND id != ? LIMIT 1").get(y, i ?? -1)) return e.json({
|
|
@@ -8366,7 +8355,7 @@ wi.get("/", async (e) => {
|
|
|
8366
8355
|
details: t.message
|
|
8367
8356
|
}, 500);
|
|
8368
8357
|
}
|
|
8369
|
-
}),
|
|
8358
|
+
}), Ci.delete("/", async (e) => {
|
|
8370
8359
|
let t = e.get("db"), n = e.req.query("id");
|
|
8371
8360
|
if (!n) return e.json({ error: "Channel ID required" }, 400);
|
|
8372
8361
|
let r = Number(n);
|
|
@@ -8384,9 +8373,9 @@ wi.get("/", async (e) => {
|
|
|
8384
8373
|
});
|
|
8385
8374
|
//#endregion
|
|
8386
8375
|
//#region server/routes/admin/schemas.ts
|
|
8387
|
-
var
|
|
8376
|
+
var wi = new e(), Ti = null, Ei = (e) => {
|
|
8388
8377
|
try {
|
|
8389
|
-
if (!
|
|
8378
|
+
if (!Ti) {
|
|
8390
8379
|
let t = ci(e.env?.BUNDLED_DEFINITIONS || Or), n = t.userTemplate || {
|
|
8391
8380
|
id: "userTemplate",
|
|
8392
8381
|
label: "User Account",
|
|
@@ -8423,7 +8412,7 @@ var Ti = new e(), Ei = null, Di = (e) => {
|
|
|
8423
8412
|
}
|
|
8424
8413
|
}
|
|
8425
8414
|
};
|
|
8426
|
-
|
|
8415
|
+
Ti = {
|
|
8427
8416
|
channelTemplate: t.channelTemplate || null,
|
|
8428
8417
|
treeTemplate: t.treeTemplate || null,
|
|
8429
8418
|
userTemplate: n,
|
|
@@ -8435,7 +8424,7 @@ var Ti = new e(), Ei = null, Di = (e) => {
|
|
|
8435
8424
|
blockLayouts: t.blockLayouts || {}
|
|
8436
8425
|
};
|
|
8437
8426
|
}
|
|
8438
|
-
return e.json(
|
|
8427
|
+
return e.json(Ti, 200, { "Cache-Control": "public, max-age=300, stale-while-revalidate=86400" });
|
|
8439
8428
|
} catch (t) {
|
|
8440
8429
|
return console.error("[CMS API] Error loading schemas:", t), e.json({
|
|
8441
8430
|
error: "Failed to load schemas",
|
|
@@ -8443,10 +8432,10 @@ var Ti = new e(), Ei = null, Di = (e) => {
|
|
|
8443
8432
|
}, 500);
|
|
8444
8433
|
}
|
|
8445
8434
|
};
|
|
8446
|
-
|
|
8435
|
+
wi.get("/", Ei), wi.get("/schemas.json", Ei);
|
|
8447
8436
|
//#endregion
|
|
8448
8437
|
//#region server/routes/admin/validation.ts
|
|
8449
|
-
var
|
|
8438
|
+
var Di = new e(), Oi = {
|
|
8450
8439
|
node: "content_nodes",
|
|
8451
8440
|
nodes: "content_nodes",
|
|
8452
8441
|
content_node: "content_nodes",
|
|
@@ -8458,7 +8447,7 @@ var Oi = new e(), ki = {
|
|
|
8458
8447
|
user: "users",
|
|
8459
8448
|
users: "users",
|
|
8460
8449
|
user_account: "user_accounts"
|
|
8461
|
-
},
|
|
8450
|
+
}, ki = {
|
|
8462
8451
|
content_nodes: [
|
|
8463
8452
|
"id",
|
|
8464
8453
|
"title",
|
|
@@ -8515,11 +8504,11 @@ var Oi = new e(), ki = {
|
|
|
8515
8504
|
"createdAt"
|
|
8516
8505
|
]
|
|
8517
8506
|
};
|
|
8518
|
-
|
|
8507
|
+
Di.post("/validate-unique", async (e) => {
|
|
8519
8508
|
try {
|
|
8520
8509
|
let t = e.get("db"), { entityType: n, field: r, value: i, excludeId: a } = await e.req.json();
|
|
8521
8510
|
if (!r || i == null || String(i).trim() === "") return e.json({ isUnique: !0 });
|
|
8522
|
-
let o =
|
|
8511
|
+
let o = Oi[n] || "content_nodes", s = r.replace(/[^a-zA-Z0-9_]/g, ""), c = (ki[o] || ki.content_nodes).includes(s), l = -1;
|
|
8523
8512
|
if (a != null && String(a).trim() !== "") {
|
|
8524
8513
|
let e = Number(a);
|
|
8525
8514
|
l = isNaN(e) ? String(a) : e;
|
|
@@ -8531,35 +8520,11 @@ Oi.post("/validate-unique", async (e) => {
|
|
|
8531
8520
|
} catch (t) {
|
|
8532
8521
|
return console.error("[API Validation] Error validating global uniqueness:", t), e.json({ error: "Failed to validate uniqueness" }, 500);
|
|
8533
8522
|
}
|
|
8534
|
-
}),
|
|
8535
|
-
try {
|
|
8536
|
-
let t = e.get("db"), { slug: n, treeId: r, parentId: i, excludeTreeNodeId: a } = await e.req.json();
|
|
8537
|
-
if (!n || !String(n).trim() || !r) return e.json({ isUnique: !0 });
|
|
8538
|
-
let o = String(n).trim().toLowerCase(), s = i === void 0 || i === "null" || i === "" ? null : i, c = s === null ? "tn.parentId IS NULL" : "tn.parentId = ?", l = s === null ? [r, o] : [
|
|
8539
|
-
r,
|
|
8540
|
-
s,
|
|
8541
|
-
o
|
|
8542
|
-
], u = "";
|
|
8543
|
-
a && !String(a).startsWith("draft-") && (u = "AND tn.id != ? AND tn.contentId != ?", l.push(a, a));
|
|
8544
|
-
let d = `
|
|
8545
|
-
SELECT 1
|
|
8546
|
-
FROM tree_nodes tn
|
|
8547
|
-
INNER JOIN content_nodes cn ON tn.contentId = cn.id
|
|
8548
|
-
WHERE tn.treeId = ?
|
|
8549
|
-
AND ${c}
|
|
8550
|
-
AND cn.slug = ?
|
|
8551
|
-
${u}
|
|
8552
|
-
LIMIT 1
|
|
8553
|
-
`, f = await t.prepare(d).get(...l);
|
|
8554
|
-
return e.json({ isUnique: !f });
|
|
8555
|
-
} catch (t) {
|
|
8556
|
-
return console.error("[Validation Endpoint] Error validating unique sibling:", t), e.json({ isUnique: !0 });
|
|
8557
|
-
}
|
|
8558
|
-
});
|
|
8523
|
+
}), Di.post("/validate-unique-sibling", async (e) => e.json({ isUnique: !0 }));
|
|
8559
8524
|
//#endregion
|
|
8560
8525
|
//#region server/routes/admin/stats.ts
|
|
8561
|
-
var
|
|
8562
|
-
|
|
8526
|
+
var Ai = new e();
|
|
8527
|
+
Ai.get("/", async (e) => {
|
|
8563
8528
|
try {
|
|
8564
8529
|
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) => ({
|
|
8565
8530
|
...e,
|
|
@@ -8602,7 +8567,7 @@ ji.get("/", async (e) => {
|
|
|
8602
8567
|
});
|
|
8603
8568
|
//#endregion
|
|
8604
8569
|
//#region server/routes/admin/assets.ts
|
|
8605
|
-
var
|
|
8570
|
+
var ji = new e();
|
|
8606
8571
|
async function Q(e, t, n = []) {
|
|
8607
8572
|
let r = e.prepare(t);
|
|
8608
8573
|
if (typeof r.bind == "function") {
|
|
@@ -8615,34 +8580,16 @@ async function Q(e, t, n = []) {
|
|
|
8615
8580
|
}
|
|
8616
8581
|
return [];
|
|
8617
8582
|
}
|
|
8618
|
-
async function
|
|
8583
|
+
async function Mi(e, t, n = []) {
|
|
8619
8584
|
let r = e.prepare(t);
|
|
8620
8585
|
if (typeof r.bind == "function") return await r.bind(...n).run();
|
|
8621
8586
|
if (typeof r.run == "function") return await r.run(...n);
|
|
8622
8587
|
}
|
|
8623
|
-
function
|
|
8588
|
+
function Ni(e, t, n) {
|
|
8624
8589
|
let r = e || (t ? `/media/${t}` : "");
|
|
8625
8590
|
return r && n && r.startsWith(`https://${n}/`) && !r.includes("/media/") && (r = r.replace(`https://${n}/`, `https://${n}/media/`)), r;
|
|
8626
8591
|
}
|
|
8627
|
-
async
|
|
8628
|
-
try {
|
|
8629
|
-
let r = new X(e.env), i = await Q(t, "\n SELECT cdnUrl, storageKeyPrivate\n FROM assets\n WHERE id = ? OR parentAssetId = ?\n ", [n, n]), a = [];
|
|
8630
|
-
for (let t of i) {
|
|
8631
|
-
let n = Pi(t.cdnUrl, t.storageKeyPrivate, e.env?.CDN_DOMAIN);
|
|
8632
|
-
n && a.push(n);
|
|
8633
|
-
}
|
|
8634
|
-
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 ", [
|
|
8635
|
-
n,
|
|
8636
|
-
n,
|
|
8637
|
-
n
|
|
8638
|
-
]);
|
|
8639
|
-
if (o.length === 0) return;
|
|
8640
|
-
for (let n of o) n.id && n.slug && r.purgeSmart(e, t, n.id, n.slug, a, !1);
|
|
8641
|
-
} catch (e) {
|
|
8642
|
-
console.warn("[Assets Router] Failed to purge edge cache for asset nodes:", e);
|
|
8643
|
-
}
|
|
8644
|
-
}
|
|
8645
|
-
Mi.get("/", async (e) => {
|
|
8592
|
+
ji.get("/", async (e) => {
|
|
8646
8593
|
try {
|
|
8647
8594
|
let t = u(e), { search: n = "", type: r = "all", page: i = "1", limit: a = "24", sort: o = "createdAt", order: s = "DESC", nodeId: c, channelId: l, trashed: d } = e.req.query(), f = Math.max(1, parseInt(i, 10) || 1), p = Math.max(1, Math.min(100, parseInt(a, 10) || 24)), m = (f - 1) * p, h = {
|
|
8648
8595
|
createdAt: "a.createdAt",
|
|
@@ -8709,7 +8656,7 @@ Mi.get("/", async (e) => {
|
|
|
8709
8656
|
...JSON.parse(t.dataJson || "{}")
|
|
8710
8657
|
};
|
|
8711
8658
|
} catch {}
|
|
8712
|
-
let r =
|
|
8659
|
+
let r = Ni(t.cdnUrl, t.storageKeyPrivate, e.env?.CDN_DOMAIN);
|
|
8713
8660
|
return {
|
|
8714
8661
|
id: t.id,
|
|
8715
8662
|
filename: t.filename || "Untitled Asset",
|
|
@@ -8733,7 +8680,7 @@ Mi.get("/", async (e) => {
|
|
|
8733
8680
|
details: t.message || String(t)
|
|
8734
8681
|
}, 500);
|
|
8735
8682
|
}
|
|
8736
|
-
}),
|
|
8683
|
+
}), ji.post("/upload", async (e) => {
|
|
8737
8684
|
try {
|
|
8738
8685
|
let t = u(e), n = ni(e.env), r = await e.req.parseBody(), i = r.file, a = r.isVariant === "true" || r.isVariant === "1" || r.temporary === "true", o = r.parentAssetId || r.parentAsset, s = typeof o == "string" && o.trim().length > 0 ? o.trim() : null;
|
|
8739
8686
|
s && (await Q(t, "SELECT id FROM assets WHERE id = ?", [s])).length === 0 && (s = null);
|
|
@@ -8752,7 +8699,7 @@ Mi.get("/", async (e) => {
|
|
|
8752
8699
|
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;
|
|
8753
8700
|
T && (await Q(t, "SELECT id FROM users WHERE id = ?", [T])).length === 0 && (T = null);
|
|
8754
8701
|
let E = +!!h;
|
|
8755
|
-
await
|
|
8702
|
+
await Mi(t, "\n INSERT INTO assets (id, filename, mimeType, sizeBytes, storageKeyPrivate, cdnUrl, createdById, isSystemVariant, parentAssetId, cropCoordinatesJson)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n ", [
|
|
8756
8703
|
p,
|
|
8757
8704
|
i.name,
|
|
8758
8705
|
S,
|
|
@@ -8767,7 +8714,7 @@ Mi.get("/", async (e) => {
|
|
|
8767
8714
|
let D = x;
|
|
8768
8715
|
if (s) {
|
|
8769
8716
|
let n = await Q(t, "SELECT cdnUrl, storageKeyPrivate FROM assets WHERE id = ?", [s]);
|
|
8770
|
-
n.length > 0 && (D =
|
|
8717
|
+
n.length > 0 && (D = Ni(n[0].cdnUrl, n[0].storageKeyPrivate, y)), new X(e.env).purgeAsset(e, t, s);
|
|
8771
8718
|
}
|
|
8772
8719
|
return e.json({
|
|
8773
8720
|
id: p,
|
|
@@ -8786,7 +8733,7 @@ Mi.get("/", async (e) => {
|
|
|
8786
8733
|
details: t.message || String(t)
|
|
8787
8734
|
}, 500);
|
|
8788
8735
|
}
|
|
8789
|
-
}),
|
|
8736
|
+
}), ji.get("/:id/details", async (e) => {
|
|
8790
8737
|
try {
|
|
8791
8738
|
let t = u(e), n = e.req.param("id"), r = await Q(t, "SELECT * FROM assets WHERE id = ?", [n]);
|
|
8792
8739
|
if (!r || r.length === 0) return e.json({ error: "Asset not found" }, 404);
|
|
@@ -8809,7 +8756,7 @@ Mi.get("/", async (e) => {
|
|
|
8809
8756
|
...JSON.parse(i.dataJson || "{}")
|
|
8810
8757
|
};
|
|
8811
8758
|
} catch {}
|
|
8812
|
-
let l =
|
|
8759
|
+
let l = Ni(i.cdnUrl, i.storageKeyPrivate, e.env?.CDN_DOMAIN);
|
|
8813
8760
|
return e.json({
|
|
8814
8761
|
id: i.id,
|
|
8815
8762
|
filename: i.filename,
|
|
@@ -8836,7 +8783,7 @@ Mi.get("/", async (e) => {
|
|
|
8836
8783
|
createdAt: t.createdAt,
|
|
8837
8784
|
parentAssetId: t.parentAssetId || i.id,
|
|
8838
8785
|
cropCoordinates: n,
|
|
8839
|
-
url:
|
|
8786
|
+
url: Ni(t.cdnUrl, t.storageKeyPrivate, e.env?.CDN_DOMAIN),
|
|
8840
8787
|
originalUrl: l
|
|
8841
8788
|
};
|
|
8842
8789
|
})
|
|
@@ -8844,7 +8791,7 @@ Mi.get("/", async (e) => {
|
|
|
8844
8791
|
} catch (t) {
|
|
8845
8792
|
return console.error("❌ [Asset Details Error]:", t), e.json({ error: "Failed to load details" }, 500);
|
|
8846
8793
|
}
|
|
8847
|
-
}),
|
|
8794
|
+
}), ji.put("/:id", async (e) => {
|
|
8848
8795
|
try {
|
|
8849
8796
|
let t = u(e), n = e.req.param("id"), r = await e.req.json(), i = await Q(t, "SELECT filename, dataJson FROM assets WHERE id = ?", [n]);
|
|
8850
8797
|
if (!i || i.length === 0) return e.json({ error: "Asset not found" }, 404);
|
|
@@ -8852,18 +8799,18 @@ Mi.get("/", async (e) => {
|
|
|
8852
8799
|
try {
|
|
8853
8800
|
o = JSON.parse(a.dataJson || "{}");
|
|
8854
8801
|
} catch {}
|
|
8855
|
-
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
|
|
8802
|
+
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 Mi(t, "UPDATE assets SET filename = ?, dataJson = ?, updatedAt = CURRENT_TIMESTAMP WHERE id = ?", [
|
|
8856
8803
|
r.filename === void 0 ? a.filename : r.filename,
|
|
8857
8804
|
JSON.stringify(o),
|
|
8858
8805
|
n
|
|
8859
|
-
]),
|
|
8806
|
+
]), new X(e.env).purgeAsset(e, t, n), e.json({ success: !0 });
|
|
8860
8807
|
} catch (t) {
|
|
8861
8808
|
return console.error("❌ [Asset Update Error]:", t), e.json({ error: "Failed to update asset" }, 500);
|
|
8862
8809
|
}
|
|
8863
|
-
}),
|
|
8810
|
+
}), ji.delete("/:id", async (e) => {
|
|
8864
8811
|
try {
|
|
8865
8812
|
let t = u(e), n = e.req.param("id"), r = (await Q(t, "SELECT id, filename, isSystemVariant FROM assets WHERE id = ?", [n]))[0];
|
|
8866
|
-
return r ? (
|
|
8813
|
+
return r ? (new X(e.env).purgeAsset(e, t, n), r.isSystemVariant ? await Mi(t, "UPDATE assets SET deletedAt = CURRENT_TIMESTAMP WHERE id = ?", [n]) : await Mi(t, "UPDATE assets\n SET deletedAt = CURRENT_TIMESTAMP\n WHERE id = ? OR parentAssetId = ? OR (isSystemVariant = 1 AND (filename LIKE ? OR filename LIKE ?))", [
|
|
8867
8814
|
n,
|
|
8868
8815
|
n,
|
|
8869
8816
|
`crop_%${r.filename ? r.filename.replace(/\.[^/.]+$/, "") : ""}%`,
|
|
@@ -8879,17 +8826,17 @@ Mi.get("/", async (e) => {
|
|
|
8879
8826
|
details: t.message || String(t)
|
|
8880
8827
|
}, 500);
|
|
8881
8828
|
}
|
|
8882
|
-
}),
|
|
8829
|
+
}), ji.post("/restore", async (e) => {
|
|
8883
8830
|
try {
|
|
8884
8831
|
let t = u(e), n = await e.req.json(), r = n.id || n.assetId;
|
|
8885
8832
|
if (!r) return e.json({ error: "Asset ID required" }, 400);
|
|
8886
8833
|
let i = (await Q(t, "SELECT id, filename FROM assets WHERE id = ?", [r]))[0];
|
|
8887
|
-
return i ? (await
|
|
8834
|
+
return i ? (await Mi(t, "UPDATE assets \n SET deletedAt = NULL \n WHERE id = ? OR parentAssetId = ? OR (isSystemVariant = 1 AND (filename LIKE ? OR filename LIKE ?))", [
|
|
8888
8835
|
r,
|
|
8889
8836
|
r,
|
|
8890
8837
|
`crop_%${i.filename ? i.filename.replace(/\.[^/.]+$/, "") : ""}%`,
|
|
8891
8838
|
`%${r}%`
|
|
8892
|
-
]),
|
|
8839
|
+
]), new X(e.env).purgeAsset(e, t, r), e.json({
|
|
8893
8840
|
success: !0,
|
|
8894
8841
|
id: r,
|
|
8895
8842
|
restored: !0
|
|
@@ -8900,11 +8847,11 @@ Mi.get("/", async (e) => {
|
|
|
8900
8847
|
details: t.message
|
|
8901
8848
|
}, 500);
|
|
8902
8849
|
}
|
|
8903
|
-
}),
|
|
8850
|
+
}), ji.delete("/purge/:id", async (e) => {
|
|
8904
8851
|
try {
|
|
8905
8852
|
let t = u(e), n = ni(e.env), r = e.req.param("id"), i = (await Q(t, "SELECT id, filename, storageKeyPrivate, isSystemVariant FROM assets WHERE id = ?", [r]))[0];
|
|
8906
8853
|
if (!i) return e.json({ error: "Asset not found" }, 404);
|
|
8907
|
-
|
|
8854
|
+
new X(e.env).purgeAsset(e, t, r);
|
|
8908
8855
|
let a = [i];
|
|
8909
8856
|
i.isSystemVariant || (a = [i, ...await Q(t, "SELECT id, storageKeyPrivate FROM assets \n WHERE parentAssetId = ? OR (isSystemVariant = 1 AND (filename LIKE ? OR filename LIKE ?))", [
|
|
8910
8857
|
r,
|
|
@@ -8920,7 +8867,7 @@ Mi.get("/", async (e) => {
|
|
|
8920
8867
|
}
|
|
8921
8868
|
}
|
|
8922
8869
|
let s = o.map(() => "?").join(",");
|
|
8923
|
-
return await
|
|
8870
|
+
return await Mi(t, `DELETE FROM node_assets WHERE assetId IN (${s})`, o), await Mi(t, `DELETE FROM assets WHERE id IN (${s})`, o), e.json({
|
|
8924
8871
|
success: !0,
|
|
8925
8872
|
id: r,
|
|
8926
8873
|
purged: !0,
|
|
@@ -8936,8 +8883,8 @@ Mi.get("/", async (e) => {
|
|
|
8936
8883
|
});
|
|
8937
8884
|
//#endregion
|
|
8938
8885
|
//#region server/routes/public/node.ts
|
|
8939
|
-
var
|
|
8940
|
-
function
|
|
8886
|
+
var Pi = new e();
|
|
8887
|
+
function Fi() {
|
|
8941
8888
|
return {
|
|
8942
8889
|
fullPath: /* @__PURE__ */ new Map(),
|
|
8943
8890
|
treeEdges: /* @__PURE__ */ new Map(),
|
|
@@ -8945,10 +8892,10 @@ function Li() {
|
|
|
8945
8892
|
assetUrls: /* @__PURE__ */ new Map()
|
|
8946
8893
|
};
|
|
8947
8894
|
}
|
|
8948
|
-
function
|
|
8895
|
+
function Ii(...e) {
|
|
8949
8896
|
return e.map((e) => String(e ?? "")).join(":");
|
|
8950
8897
|
}
|
|
8951
|
-
function
|
|
8898
|
+
function Li(e, t) {
|
|
8952
8899
|
let n = Date.now();
|
|
8953
8900
|
if (e && String(e).trim() !== "") {
|
|
8954
8901
|
let t = Date.parse(e);
|
|
@@ -8960,7 +8907,7 @@ function zi(e, t) {
|
|
|
8960
8907
|
}
|
|
8961
8908
|
return !0;
|
|
8962
8909
|
}
|
|
8963
|
-
async function
|
|
8910
|
+
async function Ri(e, t, n) {
|
|
8964
8911
|
let r = t.filter((e) => e.componentId === "content-feed" || e.componentId === "article-list");
|
|
8965
8912
|
await Promise.all(r.map(async (t) => {
|
|
8966
8913
|
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];
|
|
@@ -8981,7 +8928,7 @@ async function Bi(e, t, n) {
|
|
|
8981
8928
|
if (e.dataJson) try {
|
|
8982
8929
|
t = typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson;
|
|
8983
8930
|
} catch {}
|
|
8984
|
-
return
|
|
8931
|
+
return Li(t.startShowingAt, t.stopShowingAt) ? {
|
|
8985
8932
|
id: e.id,
|
|
8986
8933
|
title: e.title,
|
|
8987
8934
|
slug: e.slug,
|
|
@@ -8998,7 +8945,7 @@ async function Bi(e, t, n) {
|
|
|
8998
8945
|
}
|
|
8999
8946
|
}));
|
|
9000
8947
|
}
|
|
9001
|
-
async function
|
|
8948
|
+
async function zi(e, t, n, r, i = !1, a) {
|
|
9002
8949
|
if (!t) return { blocks: [] };
|
|
9003
8950
|
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 || [];
|
|
9004
8951
|
if (!s || s.length === 0) return { blocks: [] };
|
|
@@ -9054,10 +9001,10 @@ async function Vi(e, t, n, r, i = !1, a) {
|
|
|
9054
9001
|
try {
|
|
9055
9002
|
a = (typeof t.dataJson == "string" ? JSON.parse(t.dataJson) : t.dataJson) || {};
|
|
9056
9003
|
} catch {}
|
|
9057
|
-
let o = a.hidden === !0 || a.hidden === 1 || a.hidden === "1" || a.hidden === "true", s =
|
|
9004
|
+
let o = a.hidden === !0 || a.hidden === 1 || a.hidden === "1" || a.hidden === "true", s = Li(a.startShowingAt, a.stopShowingAt);
|
|
9058
9005
|
if (!i && (o || !s)) return null;
|
|
9059
|
-
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 =
|
|
9060
|
-
return d = await oi(e, d), d =
|
|
9006
|
+
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 = Bi(a, l);
|
|
9007
|
+
return d = await oi(e, d), d = Vi(d), d.blockId = u, {
|
|
9061
9008
|
region: t.region || n,
|
|
9062
9009
|
block: {
|
|
9063
9010
|
instanceId: t.id,
|
|
@@ -9077,7 +9024,7 @@ async function Vi(e, t, n, r, i = !1, a) {
|
|
|
9077
9024
|
}
|
|
9078
9025
|
return { blocks: [] };
|
|
9079
9026
|
}
|
|
9080
|
-
function
|
|
9027
|
+
function Bi(e, t = {}) {
|
|
9081
9028
|
let n = {};
|
|
9082
9029
|
for (let [r, i] of Object.entries(e)) {
|
|
9083
9030
|
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;
|
|
@@ -9086,14 +9033,14 @@ function Hi(e, t = {}) {
|
|
|
9086
9033
|
}
|
|
9087
9034
|
return n;
|
|
9088
9035
|
}
|
|
9089
|
-
function
|
|
9090
|
-
if (Array.isArray(e)) return e.map(
|
|
9036
|
+
function Vi(e) {
|
|
9037
|
+
if (Array.isArray(e)) return e.map(Vi);
|
|
9091
9038
|
if (!e || typeof e != "object") return e;
|
|
9092
9039
|
if (typeof e.id == "string" && e.id.startsWith("ast_") && typeof e.url == "string") {
|
|
9093
9040
|
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 ? {
|
|
9094
9041
|
...t,
|
|
9095
9042
|
...t.crops?.[r] || {}
|
|
9096
|
-
} : t, a = Object.fromEntries(Object.entries(n).filter(([, t]) => t?.id !== e.id).map(([t, n]) => [t,
|
|
9043
|
+
} : t, a = Object.fromEntries(Object.entries(n).filter(([, t]) => t?.id !== e.id).map(([t, n]) => [t, Vi({
|
|
9097
9044
|
...n,
|
|
9098
9045
|
title: n?.title ?? e.title ?? "",
|
|
9099
9046
|
alt: n?.alt ?? e.alt ?? "",
|
|
@@ -9107,9 +9054,9 @@ function Ui(e) {
|
|
|
9107
9054
|
...Object.keys(a).length > 0 ? { variants: a } : {}
|
|
9108
9055
|
};
|
|
9109
9056
|
}
|
|
9110
|
-
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e,
|
|
9057
|
+
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, Vi(t)]));
|
|
9111
9058
|
}
|
|
9112
|
-
async function
|
|
9059
|
+
async function Hi(e, t, n) {
|
|
9113
9060
|
if (typeof t == "string") {
|
|
9114
9061
|
if (!t.includes("#node:") && !t.includes("data-node-id") && !t.includes("#asset:") && !t.includes("data-asset-id")) return t;
|
|
9115
9062
|
let r = (e, t) => {
|
|
@@ -9135,9 +9082,9 @@ async function Wi(e, t, n) {
|
|
|
9135
9082
|
return await Promise.all(Array.from(t.matchAll(h)).map(async (t) => {
|
|
9136
9083
|
let i = t[1], a = r(i, "data-node-id"), o = r(i, "data-tree-id");
|
|
9137
9084
|
if (!a || !o) return;
|
|
9138
|
-
let s = await
|
|
9085
|
+
let s = await Wi(e, a, o, n);
|
|
9139
9086
|
if (s?.treeNodeId) {
|
|
9140
|
-
let t = await
|
|
9087
|
+
let t = await Ji(e, String(s.treeNodeId), o, n);
|
|
9141
9088
|
m.set(`${a}:${o}`, t);
|
|
9142
9089
|
}
|
|
9143
9090
|
})), t.replace(h, (e, t) => {
|
|
@@ -9157,39 +9104,39 @@ async function Wi(e, t, n) {
|
|
|
9157
9104
|
return /href\s*=\s*["'][^"']*["']/i.test(_) ? _ = _.replace(/href\s*=\s*["'][^"']*["']/i, `href="${g || "/"}"`) : _ += ` href="${g || "/"}"`, `<a ${_}>`;
|
|
9158
9105
|
});
|
|
9159
9106
|
}
|
|
9160
|
-
if (Array.isArray(t)) return Promise.all(t.map((t) =>
|
|
9107
|
+
if (Array.isArray(t)) return Promise.all(t.map((t) => Hi(e, t, n)));
|
|
9161
9108
|
if (t && typeof t == "object") {
|
|
9162
9109
|
if (typeof t.href == "string" && (t.href.startsWith("#node:") || t.href.startsWith("#asset:"))) return {
|
|
9163
9110
|
...t,
|
|
9164
|
-
href: await
|
|
9111
|
+
href: await Ui(e, t, n)
|
|
9165
9112
|
};
|
|
9166
|
-
let r = await Promise.all(Object.entries(t).map(async ([t, r]) => [t, await
|
|
9113
|
+
let r = await Promise.all(Object.entries(t).map(async ([t, r]) => [t, await Hi(e, r, n)]));
|
|
9167
9114
|
return Object.fromEntries(r);
|
|
9168
9115
|
}
|
|
9169
9116
|
return t;
|
|
9170
9117
|
}
|
|
9171
|
-
async function
|
|
9118
|
+
async function Ui(e, t, n) {
|
|
9172
9119
|
let r = t.href.match(/^#node:(.+)$/), i = t.href.match(/^#asset:(.+)$/);
|
|
9173
|
-
if (i) return
|
|
9120
|
+
if (i) return Ki(e, i[1], n);
|
|
9174
9121
|
if (!r) return t.href;
|
|
9175
9122
|
let a = r[1];
|
|
9176
9123
|
if (t.treeId) {
|
|
9177
|
-
let r = await
|
|
9124
|
+
let r = await Wi(e, a, String(t.treeId), n);
|
|
9178
9125
|
if (r?.treeNodeId) {
|
|
9179
|
-
let i = await
|
|
9126
|
+
let i = await Ji(e, String(r.treeNodeId), String(t.treeId), n);
|
|
9180
9127
|
if (i) return i;
|
|
9181
9128
|
}
|
|
9182
9129
|
}
|
|
9183
|
-
let o = await
|
|
9130
|
+
let o = await Gi(e, a, n);
|
|
9184
9131
|
return o === void 0 ? "#" : `/${o}`;
|
|
9185
9132
|
}
|
|
9186
|
-
async function
|
|
9187
|
-
let i =
|
|
9133
|
+
async function Wi(e, t, n, r) {
|
|
9134
|
+
let i = Ii(t, n), a = r.treeEdges.get(i);
|
|
9188
9135
|
if (a) return a;
|
|
9189
9136
|
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);
|
|
9190
9137
|
return r.treeEdges.set(i, Promise.resolve(o)), o;
|
|
9191
9138
|
}
|
|
9192
|
-
async function
|
|
9139
|
+
async function Gi(e, t, n) {
|
|
9193
9140
|
let r = String(t), i = n.nodeSlugs.get(r);
|
|
9194
9141
|
if (i) return i;
|
|
9195
9142
|
let a = (async () => {
|
|
@@ -9198,7 +9145,7 @@ async function qi(e, t, n) {
|
|
|
9198
9145
|
})();
|
|
9199
9146
|
return n.nodeSlugs.set(r, a), a;
|
|
9200
9147
|
}
|
|
9201
|
-
async function
|
|
9148
|
+
async function Ki(e, t, n) {
|
|
9202
9149
|
let r = String(t), i = n.assetUrls.get(r);
|
|
9203
9150
|
if (i) return i;
|
|
9204
9151
|
let a = (async () => {
|
|
@@ -9207,7 +9154,7 @@ async function Ji(e, t, n) {
|
|
|
9207
9154
|
})();
|
|
9208
9155
|
return n.assetUrls.set(r, a), a;
|
|
9209
9156
|
}
|
|
9210
|
-
function
|
|
9157
|
+
function qi(e) {
|
|
9211
9158
|
let t = e.socialImage;
|
|
9212
9159
|
if (!t || typeof t != "object") return null;
|
|
9213
9160
|
let n = (e, t) => {
|
|
@@ -9238,9 +9185,9 @@ function Yi(e) {
|
|
|
9238
9185
|
])
|
|
9239
9186
|
};
|
|
9240
9187
|
}
|
|
9241
|
-
async function
|
|
9188
|
+
async function Ji(e, t, n, r) {
|
|
9242
9189
|
if (!t) return "";
|
|
9243
|
-
let i =
|
|
9190
|
+
let i = Ii(t, n);
|
|
9244
9191
|
if (r) {
|
|
9245
9192
|
let e = r.fullPath.get(i);
|
|
9246
9193
|
if (e) return e;
|
|
@@ -9255,7 +9202,7 @@ async function Xi(e, t, n, r) {
|
|
|
9255
9202
|
})();
|
|
9256
9203
|
return r && r.fullPath.set(i, a), a;
|
|
9257
9204
|
}
|
|
9258
|
-
async function
|
|
9205
|
+
async function Yi(e, t, n, r, i) {
|
|
9259
9206
|
let a = {}, o = null;
|
|
9260
9207
|
if (t) {
|
|
9261
9208
|
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([
|
|
@@ -9293,20 +9240,20 @@ async function Zi(e, t, n, r, i) {
|
|
|
9293
9240
|
inheritedFields: a
|
|
9294
9241
|
};
|
|
9295
9242
|
}
|
|
9296
|
-
function
|
|
9243
|
+
function Xi(e) {
|
|
9297
9244
|
let t = Number(e?.env?.CMS_NODE_CACHE_TTL);
|
|
9298
9245
|
return Number.isFinite(t) && t >= 60 ? Math.floor(t) : 300;
|
|
9299
9246
|
}
|
|
9300
|
-
async function
|
|
9247
|
+
async function Zi(e, t, n, r) {
|
|
9301
9248
|
try {
|
|
9302
9249
|
await e.set(t, n, r);
|
|
9303
9250
|
} catch (e) {
|
|
9304
9251
|
console.warn("[CMS Cache] Failed to write node response to cache:", e);
|
|
9305
9252
|
}
|
|
9306
9253
|
}
|
|
9307
|
-
|
|
9254
|
+
Pi.get("/*", async (e) => {
|
|
9308
9255
|
try {
|
|
9309
|
-
let t = e.get("db"), n =
|
|
9256
|
+
let t = e.get("db"), n = Fi(), 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));
|
|
9310
9257
|
if (!c) return e.json({ error: `Channel '${a}' not found` }, 404);
|
|
9311
9258
|
let l = c.status === "disabled" || c.status === "inactive" || c.isEnabled === 0 || c.isEnabled === !1;
|
|
9312
9259
|
if (!s && l) return e.json({ error: `Channel '${c.key || a}' is currently inactive` }, 404);
|
|
@@ -9331,7 +9278,7 @@ Ii.get("/*", async (e) => {
|
|
|
9331
9278
|
if (E.length > 0) {
|
|
9332
9279
|
let e = await Promise.all(E.map(async (e) => ({
|
|
9333
9280
|
candidate: e,
|
|
9334
|
-
calculatedPath: await
|
|
9281
|
+
calculatedPath: await Ji(t, String(e.treeNodeId), String(e.treeId), n)
|
|
9335
9282
|
}))), r = S.replace(/^\/+|\/+$/g, "");
|
|
9336
9283
|
for (let { candidate: t, calculatedPath: n } of e) {
|
|
9337
9284
|
let e = n.replace(/^\/+|\/+$/g, "");
|
|
@@ -9355,7 +9302,7 @@ Ii.get("/*", async (e) => {
|
|
|
9355
9302
|
LIMIT 1
|
|
9356
9303
|
`).get(...e);
|
|
9357
9304
|
}
|
|
9358
|
-
let D = v?.treeId || y || "main-nav", O = v?.parentId || null, k = v?.treeNodeId ? await
|
|
9305
|
+
let D = v?.treeId || y || "main-nav", O = v?.parentId || null, k = v?.treeNodeId ? await Ji(t, String(v.treeNodeId), String(D), n) : `/${(_.slug || "").replace(/^\/+|\/+$/g, "")}`, A = {
|
|
9359
9306
|
id: _.id,
|
|
9360
9307
|
title: _.title,
|
|
9361
9308
|
slug: _.slug,
|
|
@@ -9364,32 +9311,32 @@ Ii.get("/*", async (e) => {
|
|
|
9364
9311
|
nodeType: _.contentType,
|
|
9365
9312
|
createdAt: _.createdAt,
|
|
9366
9313
|
updatedAt: _.updatedAt
|
|
9367
|
-
}, ee = _.contentType || "node",
|
|
9368
|
-
|
|
9369
|
-
Object.assign(
|
|
9314
|
+
}, ee = _.contentType || "node", j = h.nodes?.[ee] || Object.values(h.nodes || {})[0] || {}, M = { ...j.fields || {} };
|
|
9315
|
+
j.tabs && Object.values(j.tabs).forEach((e) => {
|
|
9316
|
+
Object.assign(M, e.fields || {});
|
|
9370
9317
|
});
|
|
9371
|
-
let
|
|
9372
|
-
if (
|
|
9373
|
-
|
|
9318
|
+
let te = {}, ne = null, re = null, ie = !1, N = {}, P = s && _.draftDataJson ? _.draftDataJson : _.dataJson || _.draftDataJson;
|
|
9319
|
+
if (P) try {
|
|
9320
|
+
N = typeof P == "string" ? JSON.parse(P) : P;
|
|
9374
9321
|
} catch {}
|
|
9375
|
-
|
|
9376
|
-
let
|
|
9377
|
-
for (let [e, t] of Object.entries(
|
|
9378
|
-
let
|
|
9379
|
-
|
|
9380
|
-
let
|
|
9381
|
-
delete
|
|
9382
|
-
let
|
|
9383
|
-
if (!s && (
|
|
9384
|
-
let
|
|
9322
|
+
N.disabledRegions && (te = N.disabledRegions), ie = N.hidden === !0 || N.hidden === 1 || N.hidden === "1" || N.hidden === "true", ne = N.startShowingAt || null, re = N.stopShowingAt || null;
|
|
9323
|
+
let ae = N.layoutId, oe = ae && ae !== "inherit", { resolvedLayoutId: se, inheritedFields: ce } = await Yi(t, O, D, s, M), F = oe ? ae : se || j.defaultLayout || null;
|
|
9324
|
+
for (let [e, t] of Object.entries(ce)) (N[e] === void 0 || N[e] === null || N[e] === "" || N[e] === "inherit") && t !== void 0 && (N[e] = t);
|
|
9325
|
+
let I = await oi(t, Bi(N, M));
|
|
9326
|
+
I = Vi(I), I = await Hi(t, I, n);
|
|
9327
|
+
let le = qi(I);
|
|
9328
|
+
delete I.socialImage, delete I.fbImage, delete I.xImage, delete I.whatsappImage, le && (I.socialImages = le), A.slug = _.slug, A.title = _.title, Object.assign(A, I), A.layoutId = F;
|
|
9329
|
+
let ue = Number(_.isHidden) === 1 || ie, de = !Li(ne, re);
|
|
9330
|
+
if (!s && (ue || de)) return e.json({ error: "Node is hidden or outside its scheduled publishing window" }, 404);
|
|
9331
|
+
let fe = [];
|
|
9385
9332
|
if (v?.treeNodeId) {
|
|
9386
9333
|
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(v.treeNodeId, D), n = Array.isArray(e) ? e : e?.results || [], r = A.path === "/" ? "" : A.path;
|
|
9387
|
-
|
|
9334
|
+
fe = n.map((e) => {
|
|
9388
9335
|
let t = {}, n = s && e.draftDataJson ? e.draftDataJson : e.dataJson;
|
|
9389
9336
|
try {
|
|
9390
9337
|
t = (typeof n == "string" ? JSON.parse(n) : n) || {};
|
|
9391
9338
|
} catch {}
|
|
9392
|
-
let i = Number(e.isHidden) === 1 || t.hidden === !0 || t.hidden === 1 || t.hidden === "1", a =
|
|
9339
|
+
let i = Number(e.isHidden) === 1 || t.hidden === !0 || t.hidden === 1 || t.hidden === "1", a = Li(t.startShowingAt, t.stopShowingAt), o = (e.slug || "").replace(/^\/+|\/+$/g, "");
|
|
9393
9340
|
return !s && (i || !a) ? null : {
|
|
9394
9341
|
treeNodeId: e.treeNodeId,
|
|
9395
9342
|
id: e.id,
|
|
@@ -9401,18 +9348,18 @@ Ii.get("/*", async (e) => {
|
|
|
9401
9348
|
};
|
|
9402
9349
|
}).filter(Boolean);
|
|
9403
9350
|
}
|
|
9404
|
-
A.children =
|
|
9405
|
-
let
|
|
9406
|
-
|
|
9407
|
-
let
|
|
9351
|
+
A.children = fe;
|
|
9352
|
+
let L = +!!s, R = await t.prepare("\n SELECT *\n FROM content_blocks\n WHERE contentId = ?\n AND isDraft = ?\n ORDER BY sortOrder ASC\n ").all(_.id, L), pe = Array.isArray(R) ? R : R?.results || [];
|
|
9353
|
+
pe.length === 0 && !s && (R = await t.prepare("\n SELECT *\n FROM content_blocks\n WHERE contentId = ?\n ORDER BY sortOrder ASC\n ").all(_.id), pe = Array.isArray(R) ? R : R?.results || []);
|
|
9354
|
+
let z = {}, B = {}, me = await Promise.all(pe.map(async (e) => {
|
|
9408
9355
|
let r = e.region || "main", i = {};
|
|
9409
9356
|
try {
|
|
9410
9357
|
i = (typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson) || {};
|
|
9411
9358
|
} catch {}
|
|
9412
|
-
let a = i.hidden === !0 || i.hidden === 1 || i.hidden === "1" || i.hidden === "true", o =
|
|
9359
|
+
let a = i.hidden === !0 || i.hidden === 1 || i.hidden === "1" || i.hidden === "true", o = Li(i.startShowingAt, i.stopShowingAt);
|
|
9413
9360
|
if (!s && (a || !o)) return null;
|
|
9414
|
-
let c = e.elementType || e.componentId || "text-block", l = h.blocks?.[c]?.fields || h.elements?.[c]?.fields || h.components?.[c]?.fields || {}, u = String(i.blockId || i._instanceId || i.id || e.blockId || e.id), d =
|
|
9415
|
-
return d = await oi(t, d), d =
|
|
9361
|
+
let c = e.elementType || e.componentId || "text-block", l = h.blocks?.[c]?.fields || h.elements?.[c]?.fields || h.components?.[c]?.fields || {}, u = String(i.blockId || i._instanceId || i.id || e.blockId || e.id), d = Bi(i, l);
|
|
9362
|
+
return d = await oi(t, d), d = Vi(d), d = await Hi(t, d, n), d.blockId = u, {
|
|
9416
9363
|
region: r,
|
|
9417
9364
|
block: {
|
|
9418
9365
|
instanceId: e.id,
|
|
@@ -9422,8 +9369,8 @@ Ii.get("/*", async (e) => {
|
|
|
9422
9369
|
}
|
|
9423
9370
|
};
|
|
9424
9371
|
}));
|
|
9425
|
-
for (let e of
|
|
9426
|
-
let
|
|
9372
|
+
for (let e of me) e && (z[e.region] || (z[e.region] = [], B[e.region] = { isInherited: !1 }), z[e.region].push(e.block));
|
|
9373
|
+
let he = {
|
|
9427
9374
|
header: {
|
|
9428
9375
|
label: "Header",
|
|
9429
9376
|
inherit: "parent"
|
|
@@ -9432,33 +9379,33 @@ Ii.get("/*", async (e) => {
|
|
|
9432
9379
|
label: "Footer",
|
|
9433
9380
|
inherit: "parent"
|
|
9434
9381
|
},
|
|
9435
|
-
...(
|
|
9382
|
+
...(F ? h.nodeLayouts?.[F] || h.layouts?.[F] : null)?.regions || { main: { label: "Content" } }
|
|
9436
9383
|
};
|
|
9437
|
-
for (let [e, r] of Object.entries(
|
|
9438
|
-
let i =
|
|
9439
|
-
if (
|
|
9440
|
-
let r = await
|
|
9441
|
-
if (r.blocks.length > 0 && (
|
|
9384
|
+
for (let [e, r] of Object.entries(he)) {
|
|
9385
|
+
let i = z[e] && z[e].length > 0, a = !!te[e];
|
|
9386
|
+
if (z[e] || (z[e] = [], B[e] = { isInherited: !1 }), (r?.inherit === "parent" || r?.inherit === !0 || r?.inherit === "true" || e === "header" || e === "footer") && !i && !a && O) {
|
|
9387
|
+
let r = await zi(t, O, e, h, s, n);
|
|
9388
|
+
if (r.blocks.length > 0 && (z[e] = r.blocks, B[e] = {
|
|
9442
9389
|
isInherited: !0,
|
|
9443
9390
|
inheritedFromId: r.inheritedFromId,
|
|
9444
9391
|
inheritedFromTitle: r.inheritedFromTitle
|
|
9445
|
-
}, r.subRegions)) for (let [t, n] of Object.entries(r.subRegions)) t !== e && (
|
|
9392
|
+
}, r.subRegions)) for (let [t, n] of Object.entries(r.subRegions)) t !== e && (z[t] = n, B[t] = {
|
|
9446
9393
|
isInherited: !0,
|
|
9447
9394
|
inheritedFromId: r.inheritedFromId,
|
|
9448
9395
|
inheritedFromTitle: r.inheritedFromTitle
|
|
9449
9396
|
});
|
|
9450
9397
|
}
|
|
9451
9398
|
}
|
|
9452
|
-
await Promise.all(Object.keys(
|
|
9453
|
-
let
|
|
9399
|
+
await Promise.all(Object.keys(z).map((e) => Ri(t, z[e], u)));
|
|
9400
|
+
let ge = {
|
|
9454
9401
|
channelId: u || d,
|
|
9455
9402
|
treeId: D,
|
|
9456
9403
|
language: A.language,
|
|
9457
9404
|
node: A,
|
|
9458
|
-
content:
|
|
9459
|
-
regionMeta:
|
|
9405
|
+
content: z,
|
|
9406
|
+
regionMeta: B
|
|
9460
9407
|
};
|
|
9461
|
-
return !s && !m && (e.header("X-Cache", "MISS"), await
|
|
9408
|
+
return !s && !m && (e.header("X-Cache", "MISS"), await Zi(f, p, ge, Xi(e))), e.json(ge);
|
|
9462
9409
|
} catch (t) {
|
|
9463
9410
|
console.error("[CMS Public API] Error fetching node by path:", t);
|
|
9464
9411
|
let n = e.env?.ENVIRONMENT === "development";
|
|
@@ -9470,8 +9417,8 @@ Ii.get("/*", async (e) => {
|
|
|
9470
9417
|
});
|
|
9471
9418
|
//#endregion
|
|
9472
9419
|
//#region server/routes/public/tree.ts
|
|
9473
|
-
var
|
|
9474
|
-
function
|
|
9420
|
+
var Qi = new e();
|
|
9421
|
+
function $i(e, t) {
|
|
9475
9422
|
let n = /* @__PURE__ */ new Date();
|
|
9476
9423
|
if (e && String(e).trim() !== "") {
|
|
9477
9424
|
let t = new Date(e);
|
|
@@ -9483,14 +9430,14 @@ function ta(e, t) {
|
|
|
9483
9430
|
}
|
|
9484
9431
|
return !0;
|
|
9485
9432
|
}
|
|
9486
|
-
async function
|
|
9433
|
+
async function ea(e, t, n, r) {
|
|
9487
9434
|
try {
|
|
9488
9435
|
await e.set(t, n, r);
|
|
9489
9436
|
} catch (e) {
|
|
9490
9437
|
console.warn("[CMS Cache] Failed to write tree response to cache:", e);
|
|
9491
9438
|
}
|
|
9492
9439
|
}
|
|
9493
|
-
|
|
9440
|
+
Qi.get("/:treeParam", async (e) => {
|
|
9494
9441
|
try {
|
|
9495
9442
|
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";
|
|
9496
9443
|
if (r && r !== "default" && r !== "all") {
|
|
@@ -9544,7 +9491,7 @@ ea.get("/:treeParam", async (e) => {
|
|
|
9544
9491
|
return (p.get(n) || []).map((e) => {
|
|
9545
9492
|
let n = m.get(String(e.treeNodeId)) || {}, r = {};
|
|
9546
9493
|
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);
|
|
9547
|
-
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 =
|
|
9494
|
+
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 = $i(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 = {
|
|
9548
9495
|
id: e.id,
|
|
9549
9496
|
treeNodeId: e.treeNodeId,
|
|
9550
9497
|
parentId: e.parentId || null,
|
|
@@ -9569,7 +9516,7 @@ ea.get("/:treeParam", async (e) => {
|
|
|
9569
9516
|
...d,
|
|
9570
9517
|
items: h(null)
|
|
9571
9518
|
};
|
|
9572
|
-
return !i && !s && (e.header("X-Cache", "MISS"), await
|
|
9519
|
+
return !i && !s && (e.header("X-Cache", "MISS"), await ea(a, o, g, 300)), e.json(g);
|
|
9573
9520
|
} catch (t) {
|
|
9574
9521
|
return console.error("[CMS Public Tree API] Error:", t), e.json({
|
|
9575
9522
|
error: "Failed to fetch public tree",
|
|
@@ -9579,8 +9526,8 @@ ea.get("/:treeParam", async (e) => {
|
|
|
9579
9526
|
});
|
|
9580
9527
|
//#endregion
|
|
9581
9528
|
//#region server/routes/public/assets.ts
|
|
9582
|
-
var
|
|
9583
|
-
function
|
|
9529
|
+
var ta = new e();
|
|
9530
|
+
function na(e, t) {
|
|
9584
9531
|
if (t === "webp") return "image/webp";
|
|
9585
9532
|
if (t === "avif") return "image/avif";
|
|
9586
9533
|
if (t === "jpeg" || t === "jpg") return "image/jpeg";
|
|
@@ -9588,7 +9535,7 @@ function ia(e, t) {
|
|
|
9588
9535
|
let n = e.toLowerCase();
|
|
9589
9536
|
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";
|
|
9590
9537
|
}
|
|
9591
|
-
|
|
9538
|
+
ta.get("/*", async (e) => {
|
|
9592
9539
|
let t = e.req.path.replace(/^\/media\//, "").replace(/^\//, "");
|
|
9593
9540
|
if (!t) return e.text("Asset key missing", 400);
|
|
9594
9541
|
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 = "";
|
|
@@ -9611,7 +9558,7 @@ ra.get("/*", async (e) => {
|
|
|
9611
9558
|
c = await n.get(e);
|
|
9612
9559
|
}
|
|
9613
9560
|
if (!c) return e.text(`Asset not found: ${t}`, 404);
|
|
9614
|
-
let d = c.httpMetadata?.contentType ||
|
|
9561
|
+
let d = c.httpMetadata?.contentType || na(t), m = d.startsWith("image/") && !d.includes("svg"), g = !1;
|
|
9615
9562
|
if (s && m && e.env?.IMAGES) {
|
|
9616
9563
|
g = !0;
|
|
9617
9564
|
try {
|
|
@@ -9674,7 +9621,7 @@ ra.get("/*", async (e) => {
|
|
|
9674
9621
|
if (!s) {
|
|
9675
9622
|
let n = _(C);
|
|
9676
9623
|
return e.body(n, 200, {
|
|
9677
|
-
"Content-Type":
|
|
9624
|
+
"Content-Type": na(t),
|
|
9678
9625
|
"Cache-Control": "public, max-age=86400"
|
|
9679
9626
|
});
|
|
9680
9627
|
}
|
|
@@ -9682,7 +9629,7 @@ ra.get("/*", async (e) => {
|
|
|
9682
9629
|
if (g(f)) {
|
|
9683
9630
|
let n = _(f);
|
|
9684
9631
|
return e.body(n, 200, {
|
|
9685
|
-
"Content-Type":
|
|
9632
|
+
"Content-Type": na(t, u),
|
|
9686
9633
|
"Cache-Control": "public, max-age=31536000, immutable",
|
|
9687
9634
|
"X-Local-Cache": "HIT"
|
|
9688
9635
|
});
|
|
@@ -9695,14 +9642,14 @@ ra.get("/*", async (e) => {
|
|
|
9695
9642
|
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 }));
|
|
9696
9643
|
let s = await i.toBuffer();
|
|
9697
9644
|
return v(x(f), { recursive: !0 }), y(f, s), e.body(s, 200, {
|
|
9698
|
-
"Content-Type":
|
|
9645
|
+
"Content-Type": na(t, u),
|
|
9699
9646
|
"Cache-Control": "public, max-age=31536000, immutable",
|
|
9700
9647
|
"X-Local-Cache": "MISS"
|
|
9701
9648
|
});
|
|
9702
9649
|
} catch {
|
|
9703
9650
|
let n = _(C);
|
|
9704
9651
|
return e.body(n, 200, {
|
|
9705
|
-
"Content-Type":
|
|
9652
|
+
"Content-Type": na(t),
|
|
9706
9653
|
"Cache-Control": "public, max-age=86400"
|
|
9707
9654
|
});
|
|
9708
9655
|
}
|
|
@@ -9713,8 +9660,8 @@ ra.get("/*", async (e) => {
|
|
|
9713
9660
|
});
|
|
9714
9661
|
//#endregion
|
|
9715
9662
|
//#region server/routes/public/paths.ts
|
|
9716
|
-
var
|
|
9717
|
-
function
|
|
9663
|
+
var ra = new e();
|
|
9664
|
+
function ia(e, t) {
|
|
9718
9665
|
let n = /* @__PURE__ */ new Date();
|
|
9719
9666
|
if (e && String(e).trim() !== "") {
|
|
9720
9667
|
let t = new Date(e);
|
|
@@ -9726,7 +9673,7 @@ function oa(e, t) {
|
|
|
9726
9673
|
}
|
|
9727
9674
|
return !0;
|
|
9728
9675
|
}
|
|
9729
|
-
|
|
9676
|
+
ra.get("/", async (e) => {
|
|
9730
9677
|
try {
|
|
9731
9678
|
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();
|
|
9732
9679
|
for (let e of n) {
|
|
@@ -9750,7 +9697,7 @@ aa.get("/", async (e) => {
|
|
|
9750
9697
|
function o(e = null, t = "") {
|
|
9751
9698
|
let n = e == null || e === "" || e === "null" ? "__ROOT__" : String(e), s = i.get(n) || [];
|
|
9752
9699
|
for (let e of s) {
|
|
9753
|
-
let n = a.get(String(e.treeNodeId)) || {}, i = e.status === "published" || e.status === "active", s =
|
|
9700
|
+
let n = a.get(String(e.treeNodeId)) || {}, i = e.status === "published" || e.status === "active", s = ia(n.startShowingAt, n.stopShowingAt);
|
|
9754
9701
|
if (!i || !s) continue;
|
|
9755
9702
|
let c = (e.slug || "").replace(/^\/+|\/+$/g, ""), l = c === "home" || c === "homee" ? "/" : `${t}/${c}`.replace(/\/+/g, "/");
|
|
9756
9703
|
e.nodeType !== "external-link" && r.push(l);
|
|
@@ -9767,7 +9714,7 @@ aa.get("/", async (e) => {
|
|
|
9767
9714
|
});
|
|
9768
9715
|
//#endregion
|
|
9769
9716
|
//#region server/index.ts
|
|
9770
|
-
var $ = new e(),
|
|
9717
|
+
var $ = new e(), aa = !1;
|
|
9771
9718
|
$.use("*", o()), $.use("/media/*", o({
|
|
9772
9719
|
origin: "*",
|
|
9773
9720
|
allowMethods: [
|
|
@@ -9788,13 +9735,13 @@ $.use("*", o()), $.use("/media/*", o({
|
|
|
9788
9735
|
let n = new URL(e.req.url), r = (e.req.header("host") || n.hostname).split(":")[0];
|
|
9789
9736
|
e.set("currentDomain", r);
|
|
9790
9737
|
let i = u(e);
|
|
9791
|
-
if (e.set("db", i), !
|
|
9792
|
-
await Mr(i),
|
|
9738
|
+
if (e.set("db", i), !aa) try {
|
|
9739
|
+
await Mr(i), aa = !0;
|
|
9793
9740
|
} catch (e) {
|
|
9794
9741
|
console.error("❌ [CMS Server] Failed to initialize system tables on cold start:", e);
|
|
9795
9742
|
}
|
|
9796
9743
|
await t();
|
|
9797
|
-
}), $.route("/media",
|
|
9744
|
+
}), $.route("/media", ta), $.use("/media/*", Fr()), $.route("/api/cms/nodes", Z), $.route("/api/cms/nodes.json", Z), $.route("/api/cms/formcsv", Z), $.route("/api/cms/formcsv.json", Z), $.route("/api/cms/stats", Ai), $.route("/api/cms/stats.json", Ai), $.route("/api/cms", yi), $.route("/api/cms/channels", Ci), $.route("/api/cms/channels.json", Ci), $.route("/api/cms/schemas", wi), $.route("/api/cms/schemas.json", wi), $.route("/api/cms", Di), $.route("/api/admin/assets", ji), $.route("/api/v1/node", Pi), $.route("/api/v1/page", Pi), $.route("/api/v1/tree", Qi), $.route("/api/v1/all-paths", ra), $.get("*", async (e) => {
|
|
9798
9745
|
if (e.env?.ASSETS) {
|
|
9799
9746
|
let t = await e.env.ASSETS.fetch(e.req.raw);
|
|
9800
9747
|
if (t.status === 404) {
|