@brightsideoy/kama 0.1.0-alpha.134 → 0.1.0-alpha.136
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
|
@@ -28,12 +28,12 @@ function b(e) {
|
|
|
28
28
|
}
|
|
29
29
|
var x = (e) => (_(e) || y(e)) && !!e.anchor, S = Symbol("break visit"), C = Symbol("skip children"), w = Symbol("remove node");
|
|
30
30
|
function T(e, t) {
|
|
31
|
-
let n =
|
|
31
|
+
let n = k(t);
|
|
32
32
|
m(e) ? E(null, e.contents, n, Object.freeze([e])) === w && (e.contents = null) : E(null, e, n, Object.freeze([]));
|
|
33
33
|
}
|
|
34
34
|
T.BREAK = S, T.SKIP = C, T.REMOVE = w;
|
|
35
35
|
function E(e, t, n, r) {
|
|
36
|
-
let i =
|
|
36
|
+
let i = ee(e, t, n, r);
|
|
37
37
|
if (b(i) || g(i)) return te(e, r, i), E(e, i, n, r);
|
|
38
38
|
if (typeof i != "symbol") {
|
|
39
39
|
if (y(t)) {
|
|
@@ -57,12 +57,12 @@ function E(e, t, n, r) {
|
|
|
57
57
|
return i;
|
|
58
58
|
}
|
|
59
59
|
async function D(e, t) {
|
|
60
|
-
let n =
|
|
60
|
+
let n = k(t);
|
|
61
61
|
m(e) ? await O(null, e.contents, n, Object.freeze([e])) === w && (e.contents = null) : await O(null, e, n, Object.freeze([]));
|
|
62
62
|
}
|
|
63
63
|
D.BREAK = S, D.SKIP = C, D.REMOVE = w;
|
|
64
64
|
async function O(e, t, n, r) {
|
|
65
|
-
let i = await
|
|
65
|
+
let i = await ee(e, t, n, r);
|
|
66
66
|
if (b(i) || g(i)) return te(e, r, i), O(e, i, n, r);
|
|
67
67
|
if (typeof i != "symbol") {
|
|
68
68
|
if (y(t)) {
|
|
@@ -85,7 +85,7 @@ async function O(e, t, n, r) {
|
|
|
85
85
|
}
|
|
86
86
|
return i;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function k(e) {
|
|
89
89
|
return typeof e == "object" && (e.Collection || e.Node || e.Value) ? Object.assign({
|
|
90
90
|
Alias: e.Node,
|
|
91
91
|
Map: e.Node,
|
|
@@ -100,7 +100,7 @@ function ee(e) {
|
|
|
100
100
|
Seq: e.Collection
|
|
101
101
|
}, e) : e;
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function ee(e, t, n, r) {
|
|
104
104
|
if (typeof n == "function") return n(e, t, r);
|
|
105
105
|
if (h(t)) return n.Map?.(e, t, r);
|
|
106
106
|
if (v(t)) return n.Seq?.(e, t, r);
|
|
@@ -211,31 +211,31 @@ A.defaultYaml = {
|
|
|
211
211
|
}, A.defaultTags = { "!!": "tag:yaml.org,2002:" };
|
|
212
212
|
//#endregion
|
|
213
213
|
//#region node_modules/yaml/browser/dist/doc/anchors.js
|
|
214
|
-
function
|
|
214
|
+
function ie(e) {
|
|
215
215
|
if (/[\x00-\x19\s,[\]{}]/.test(e)) {
|
|
216
216
|
let t = `Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;
|
|
217
217
|
throw Error(t);
|
|
218
218
|
}
|
|
219
219
|
return !0;
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function ae(e) {
|
|
222
222
|
let t = /* @__PURE__ */ new Set();
|
|
223
223
|
return T(e, { Value(e, n) {
|
|
224
224
|
n.anchor && t.add(n.anchor);
|
|
225
225
|
} }), t;
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function oe(e, t) {
|
|
228
228
|
for (let n = 1;; ++n) {
|
|
229
229
|
let r = `${e}${n}`;
|
|
230
230
|
if (!t.has(r)) return r;
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function se(e, t) {
|
|
234
234
|
let n = [], r = /* @__PURE__ */ new Map(), i = null;
|
|
235
235
|
return {
|
|
236
236
|
onAnchor: (r) => {
|
|
237
|
-
n.push(r), i ??=
|
|
238
|
-
let a =
|
|
237
|
+
n.push(r), i ??= ae(e);
|
|
238
|
+
let a = oe(t, i);
|
|
239
239
|
return i.add(a), a;
|
|
240
240
|
},
|
|
241
241
|
setAnchors: () => {
|
|
@@ -253,22 +253,22 @@ function oe(e, t) {
|
|
|
253
253
|
}
|
|
254
254
|
//#endregion
|
|
255
255
|
//#region node_modules/yaml/browser/dist/doc/applyReviver.js
|
|
256
|
-
function
|
|
256
|
+
function ce(e, t, n, r) {
|
|
257
257
|
if (r && typeof r == "object") {
|
|
258
258
|
if (Array.isArray(r)) for (let t = 0, n = r.length; t < n; ++t) {
|
|
259
|
-
let n = r[t], i =
|
|
259
|
+
let n = r[t], i = ce(e, r, String(t), n);
|
|
260
260
|
i === void 0 ? delete r[t] : i !== n && (r[t] = i);
|
|
261
261
|
}
|
|
262
262
|
else if (r instanceof Map) for (let t of Array.from(r.keys())) {
|
|
263
|
-
let n = r.get(t), i =
|
|
263
|
+
let n = r.get(t), i = ce(e, r, t, n);
|
|
264
264
|
i === void 0 ? r.delete(t) : i !== n && r.set(t, i);
|
|
265
265
|
}
|
|
266
266
|
else if (r instanceof Set) for (let t of Array.from(r)) {
|
|
267
|
-
let n =
|
|
267
|
+
let n = ce(e, r, t, t);
|
|
268
268
|
n === void 0 ? r.delete(t) : n !== t && (r.delete(t), r.add(n));
|
|
269
269
|
}
|
|
270
270
|
else for (let [t, n] of Object.entries(r)) {
|
|
271
|
-
let i =
|
|
271
|
+
let i = ce(e, r, t, n);
|
|
272
272
|
i === void 0 ? delete r[t] : i !== n && (r[t] = i);
|
|
273
273
|
}
|
|
274
274
|
}
|
|
@@ -276,8 +276,8 @@ function se(e, t, n, r) {
|
|
|
276
276
|
}
|
|
277
277
|
//#endregion
|
|
278
278
|
//#region node_modules/yaml/browser/dist/nodes/toJS.js
|
|
279
|
-
function
|
|
280
|
-
if (Array.isArray(e)) return e.map((e, t) =>
|
|
279
|
+
function j(e, t, n) {
|
|
280
|
+
if (Array.isArray(e)) return e.map((e, t) => j(e, String(t), n));
|
|
281
281
|
if (e && typeof e.toJSON == "function") {
|
|
282
282
|
if (!n || !x(e)) return e.toJSON(t, n);
|
|
283
283
|
let r = {
|
|
@@ -295,7 +295,7 @@ function M(e, t, n) {
|
|
|
295
295
|
}
|
|
296
296
|
//#endregion
|
|
297
297
|
//#region node_modules/yaml/browser/dist/nodes/Node.js
|
|
298
|
-
var
|
|
298
|
+
var le = class {
|
|
299
299
|
constructor(e) {
|
|
300
300
|
Object.defineProperty(this, f, { value: e });
|
|
301
301
|
}
|
|
@@ -312,11 +312,11 @@ var ce = class {
|
|
|
312
312
|
mapAsMap: t === !0,
|
|
313
313
|
mapKeyWarned: !1,
|
|
314
314
|
maxAliasCount: typeof n == "number" ? n : 100
|
|
315
|
-
}, o =
|
|
315
|
+
}, o = j(this, "", a);
|
|
316
316
|
if (typeof r == "function") for (let { count: e, res: t } of a.anchors.values()) r(t, e);
|
|
317
|
-
return typeof i == "function" ?
|
|
317
|
+
return typeof i == "function" ? ce(i, { "": o }, "", o) : o;
|
|
318
318
|
}
|
|
319
|
-
},
|
|
319
|
+
}, ue = class extends le {
|
|
320
320
|
constructor(e) {
|
|
321
321
|
super(o), this.source = e, Object.defineProperty(this, "tag", { set() {
|
|
322
322
|
throw Error("Alias nodes cannot have tags");
|
|
@@ -344,14 +344,14 @@ var ce = class {
|
|
|
344
344
|
}
|
|
345
345
|
let o = n.get(a);
|
|
346
346
|
/* istanbul ignore if */
|
|
347
|
-
if (o ||= (
|
|
348
|
-
if (i >= 0 && (o.count += 1, o.aliasCount === 0 && (o.aliasCount =
|
|
347
|
+
if (o ||= (j(a, null, t), n.get(a)), o?.res === void 0) throw ReferenceError("This should not happen: Alias anchor was not resolved?");
|
|
348
|
+
if (i >= 0 && (o.count += 1, o.aliasCount === 0 && (o.aliasCount = M(r, a, n)), o.count * o.aliasCount > i)) throw ReferenceError("Excessive alias count indicates a resource exhaustion attack");
|
|
349
349
|
return o.res;
|
|
350
350
|
}
|
|
351
351
|
toString(e, t, n) {
|
|
352
352
|
let r = `*${this.source}`;
|
|
353
353
|
if (e) {
|
|
354
|
-
if (
|
|
354
|
+
if (ie(this.source), e.options.verifyAliasOrder && !e.anchors.has(this.source)) {
|
|
355
355
|
let e = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
356
356
|
throw Error(e);
|
|
357
357
|
}
|
|
@@ -360,7 +360,7 @@ var ce = class {
|
|
|
360
360
|
return r;
|
|
361
361
|
}
|
|
362
362
|
};
|
|
363
|
-
function
|
|
363
|
+
function M(e, t, n) {
|
|
364
364
|
if (p(t)) {
|
|
365
365
|
let r = t.resolve(e), i = n && r && n.get(r);
|
|
366
366
|
return i ? i.count * i.aliasCount : 0;
|
|
@@ -368,35 +368,35 @@ function le(e, t, n) {
|
|
|
368
368
|
if (y(t)) {
|
|
369
369
|
let r = 0;
|
|
370
370
|
for (let i of t.items) {
|
|
371
|
-
let t =
|
|
371
|
+
let t = M(e, i, n);
|
|
372
372
|
t > r && (r = t);
|
|
373
373
|
}
|
|
374
374
|
return r;
|
|
375
375
|
}
|
|
376
376
|
if (g(t)) {
|
|
377
|
-
let r =
|
|
377
|
+
let r = M(e, t.key, n), i = M(e, t.value, n);
|
|
378
378
|
return Math.max(r, i);
|
|
379
379
|
}
|
|
380
380
|
return 1;
|
|
381
381
|
}
|
|
382
382
|
//#endregion
|
|
383
383
|
//#region node_modules/yaml/browser/dist/nodes/Scalar.js
|
|
384
|
-
var
|
|
384
|
+
var de = (e) => !e || typeof e != "function" && typeof e != "object", N = class extends le {
|
|
385
385
|
constructor(e) {
|
|
386
386
|
super(u), this.value = e;
|
|
387
387
|
}
|
|
388
388
|
toJSON(e, t) {
|
|
389
|
-
return t?.keep ? this.value :
|
|
389
|
+
return t?.keep ? this.value : j(this.value, e, t);
|
|
390
390
|
}
|
|
391
391
|
toString() {
|
|
392
392
|
return String(this.value);
|
|
393
393
|
}
|
|
394
394
|
};
|
|
395
|
-
|
|
395
|
+
N.BLOCK_FOLDED = "BLOCK_FOLDED", N.BLOCK_LITERAL = "BLOCK_LITERAL", N.PLAIN = "PLAIN", N.QUOTE_DOUBLE = "QUOTE_DOUBLE", N.QUOTE_SINGLE = "QUOTE_SINGLE";
|
|
396
396
|
//#endregion
|
|
397
397
|
//#region node_modules/yaml/browser/dist/doc/createNode.js
|
|
398
|
-
var
|
|
399
|
-
function
|
|
398
|
+
var fe = "tag:yaml.org,2002:";
|
|
399
|
+
function pe(e, t, n) {
|
|
400
400
|
if (t) {
|
|
401
401
|
let e = n.filter((e) => e.tag === t), r = e.find((e) => !e.format) ?? e[0];
|
|
402
402
|
if (!r) throw Error(`Tag ${t} not found`);
|
|
@@ -404,7 +404,7 @@ function fe(e, t, n) {
|
|
|
404
404
|
}
|
|
405
405
|
return n.find((t) => t.identify?.(e) && !t.format);
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function P(e, t, n) {
|
|
408
408
|
if (m(e) && (e = e.contents), b(e)) return e;
|
|
409
409
|
if (g(e)) {
|
|
410
410
|
let t = n.schema[c].createNode?.(n.schema, null, n);
|
|
@@ -413,23 +413,23 @@ function pe(e, t, n) {
|
|
|
413
413
|
(e instanceof String || e instanceof Number || e instanceof Boolean || typeof BigInt < "u" && e instanceof BigInt) && (e = e.valueOf());
|
|
414
414
|
let { aliasDuplicateObjects: r, onAnchor: i, onTagObj: a, schema: o, sourceObjects: s } = n, l;
|
|
415
415
|
if (r && e && typeof e == "object") {
|
|
416
|
-
if (l = s.get(e), l) return l.anchor ?? (l.anchor = i(e)), new
|
|
416
|
+
if (l = s.get(e), l) return l.anchor ?? (l.anchor = i(e)), new ue(l.anchor);
|
|
417
417
|
l = {
|
|
418
418
|
anchor: null,
|
|
419
419
|
node: null
|
|
420
420
|
}, s.set(e, l);
|
|
421
421
|
}
|
|
422
|
-
t?.startsWith("!!") && (t =
|
|
423
|
-
let u =
|
|
422
|
+
t?.startsWith("!!") && (t = fe + t.slice(2));
|
|
423
|
+
let u = pe(e, t, o.tags);
|
|
424
424
|
if (!u) {
|
|
425
425
|
if (e && typeof e.toJSON == "function" && (e = e.toJSON()), !e || typeof e != "object") {
|
|
426
|
-
let t = new
|
|
426
|
+
let t = new N(e);
|
|
427
427
|
return l && (l.node = t), t;
|
|
428
428
|
}
|
|
429
429
|
u = e instanceof Map ? o[c] : Symbol.iterator in Object(e) ? o[d] : o[c];
|
|
430
430
|
}
|
|
431
431
|
a && (a(u), delete n.onTagObj);
|
|
432
|
-
let f = u?.createNode ? u.createNode(n.schema, e, n) : typeof u?.nodeClass?.from == "function" ? u.nodeClass.from(n.schema, e, n) : new
|
|
432
|
+
let f = u?.createNode ? u.createNode(n.schema, e, n) : typeof u?.nodeClass?.from == "function" ? u.nodeClass.from(n.schema, e, n) : new N(e);
|
|
433
433
|
return t ? f.tag = t : u.default || (f.tag = u.tag), l && (l.node = f), f;
|
|
434
434
|
}
|
|
435
435
|
//#endregion
|
|
@@ -443,7 +443,7 @@ function me(e, t, n) {
|
|
|
443
443
|
e[n] = r, r = e;
|
|
444
444
|
} else r = /* @__PURE__ */ new Map([[n, r]]);
|
|
445
445
|
}
|
|
446
|
-
return
|
|
446
|
+
return P(r, void 0, {
|
|
447
447
|
aliasDuplicateObjects: !1,
|
|
448
448
|
keepUndefined: !1,
|
|
449
449
|
onAnchor: () => {
|
|
@@ -453,7 +453,7 @@ function me(e, t, n) {
|
|
|
453
453
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
454
454
|
});
|
|
455
455
|
}
|
|
456
|
-
var he = (e) => e == null || typeof e == "object" && !!e[Symbol.iterator]().next().done,
|
|
456
|
+
var he = (e) => e == null || typeof e == "object" && !!e[Symbol.iterator]().next().done, ge = class extends le {
|
|
457
457
|
constructor(e, t) {
|
|
458
458
|
super(e), Object.defineProperty(this, "schema", {
|
|
459
459
|
value: t,
|
|
@@ -509,12 +509,12 @@ var he = (e) => e == null || typeof e == "object" && !!e[Symbol.iterator]().next
|
|
|
509
509
|
else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`);
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
|
-
},
|
|
513
|
-
function
|
|
512
|
+
}, _e = (e) => e.replace(/^(?!$)(?: $)?/gm, "#");
|
|
513
|
+
function F(e, t) {
|
|
514
514
|
return /^\n+$/.test(e) ? e.substring(1) : t ? e.replace(/^(?! *$)/gm, t) : e;
|
|
515
515
|
}
|
|
516
|
-
var
|
|
517
|
-
function
|
|
516
|
+
var ve = (e, t, n) => e.endsWith("\n") ? F(n, t) : n.includes("\n") ? "\n" + F(n, t) : (e.endsWith(" ") ? "" : " ") + n, ye = "flow", be = "block", xe = "quoted";
|
|
517
|
+
function I(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentWidth: a = 20, onFold: o, onOverflow: s } = {}) {
|
|
518
518
|
if (!i || i < 0) return e;
|
|
519
519
|
i < a && (a = 0);
|
|
520
520
|
let c = Math.max(1 + a, 1 + i - t.length);
|
|
@@ -522,7 +522,7 @@ function xe(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentW
|
|
|
522
522
|
let l = [], u = {}, d = i - t.length;
|
|
523
523
|
typeof r == "number" && (r > i - Math.max(2, a) ? l.push(0) : d = i - r);
|
|
524
524
|
let f, p, m = !1, h = -1, g = -1, _ = -1;
|
|
525
|
-
n === "block" && (h =
|
|
525
|
+
n === "block" && (h = Se(e, h, t.length), h !== -1 && (d = h + c));
|
|
526
526
|
for (let r; r = e[h += 1];) {
|
|
527
527
|
if (n === "quoted" && r === "\\") {
|
|
528
528
|
switch (g = h, e[h + 1]) {
|
|
@@ -539,7 +539,7 @@ function xe(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentW
|
|
|
539
539
|
}
|
|
540
540
|
_ = h;
|
|
541
541
|
}
|
|
542
|
-
if (r === "\n") n === "block" && (h =
|
|
542
|
+
if (r === "\n") n === "block" && (h = Se(e, h, t.length)), d = h + t.length + c, f = void 0;
|
|
543
543
|
else {
|
|
544
544
|
if (r === " " && p && p !== " " && p !== "\n" && p !== " ") {
|
|
545
545
|
let t = e[h + 1];
|
|
@@ -566,7 +566,7 @@ function xe(e, t, n = "flow", { indentAtStart: r, lineWidth: i = 80, minContentW
|
|
|
566
566
|
}
|
|
567
567
|
return v;
|
|
568
568
|
}
|
|
569
|
-
function
|
|
569
|
+
function Se(e, t, n) {
|
|
570
570
|
let r = t, i = t + 1, a = e[i];
|
|
571
571
|
for (; a === " " || a === " ";) if (t < i + n) a = e[++t];
|
|
572
572
|
else {
|
|
@@ -579,12 +579,12 @@ function L(e, t, n) {
|
|
|
579
579
|
}
|
|
580
580
|
//#endregion
|
|
581
581
|
//#region node_modules/yaml/browser/dist/stringify/stringifyString.js
|
|
582
|
-
var
|
|
582
|
+
var Ce = (e, t) => ({
|
|
583
583
|
indentAtStart: t ? e.indent.length : e.indentAtStart,
|
|
584
584
|
lineWidth: e.options.lineWidth,
|
|
585
585
|
minContentWidth: e.options.minContentWidth
|
|
586
|
-
}),
|
|
587
|
-
function
|
|
586
|
+
}), L = (e) => /^(%|---|\.\.\.)/m.test(e);
|
|
587
|
+
function R(e, t, n) {
|
|
588
588
|
if (!t || t < 0) return !1;
|
|
589
589
|
let r = t - n, i = e.length;
|
|
590
590
|
if (i <= r) return !1;
|
|
@@ -597,7 +597,7 @@ function Ce(e, t, n) {
|
|
|
597
597
|
function we(e, t) {
|
|
598
598
|
let n = JSON.stringify(e);
|
|
599
599
|
if (t.options.doubleQuotedAsJSON) return n;
|
|
600
|
-
let { implicitKey: r } = t, i = t.options.doubleQuotedMinMultiLineLength, a = t.indent || (
|
|
600
|
+
let { implicitKey: r } = t, i = t.options.doubleQuotedMinMultiLineLength, a = t.indent || (L(e) ? " " : ""), o = "", s = 0;
|
|
601
601
|
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]) {
|
|
602
602
|
case "u":
|
|
603
603
|
{
|
|
@@ -642,12 +642,12 @@ function we(e, t) {
|
|
|
642
642
|
break;
|
|
643
643
|
default: e += 1;
|
|
644
644
|
}
|
|
645
|
-
return o = s ? o + n.slice(s) : n, r ? o :
|
|
645
|
+
return o = s ? o + n.slice(s) : n, r ? o : I(o, a, xe, Ce(t, !1));
|
|
646
646
|
}
|
|
647
647
|
function Te(e, t) {
|
|
648
648
|
if (t.options.singleQuote === !1 || t.implicitKey && e.includes("\n") || /[ \t]\n|\n[ \t]/.test(e)) return we(e, t);
|
|
649
|
-
let n = t.indent || (
|
|
650
|
-
return t.implicitKey ? r :
|
|
649
|
+
let n = t.indent || (L(e) ? " " : ""), r = "'" + e.replace(/'/g, "''").replace(/\n+/g, `$&\n${n}`) + "'";
|
|
650
|
+
return t.implicitKey ? r : I(r, n, ye, Ce(t, !1));
|
|
651
651
|
}
|
|
652
652
|
function Ee(e, t) {
|
|
653
653
|
let { singleQuote: n } = t.options, r;
|
|
@@ -667,7 +667,7 @@ try {
|
|
|
667
667
|
function Oe({ comment: e, type: t, value: n }, r, i, a) {
|
|
668
668
|
let { blockQuote: o, commentString: s, lineWidth: c } = r.options;
|
|
669
669
|
if (!o || /\n[\t ]+$/.test(n)) return Ee(n, r);
|
|
670
|
-
let l = r.indent || (r.forceBlockIndent ||
|
|
670
|
+
let l = r.indent || (r.forceBlockIndent || L(n) ? " " : ""), u = o === "literal" ? !0 : o === "folded" || t === N.BLOCK_FOLDED ? !1 : t === N.BLOCK_LITERAL || !R(n, c, l.length);
|
|
671
671
|
if (!n) return u ? "|\n" : ">\n";
|
|
672
672
|
let d, f;
|
|
673
673
|
for (f = n.length; f > 0; --f) {
|
|
@@ -687,11 +687,11 @@ function Oe({ comment: e, type: t, value: n }, r, i, a) {
|
|
|
687
687
|
v &&= (n = n.substring(v.length), v.replace(/\n+/g, `$&${l}`));
|
|
688
688
|
let y = (h ? l ? "2" : "1" : "") + d;
|
|
689
689
|
if (e && (y += " " + s(e.replace(/ ?[\r\n]+/g, " ")), i && i()), !u) {
|
|
690
|
-
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 =
|
|
691
|
-
o !== "folded" && t !==
|
|
690
|
+
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);
|
|
691
|
+
o !== "folded" && t !== N.BLOCK_FOLDED && (a.onOverflow = () => {
|
|
692
692
|
i = !0;
|
|
693
693
|
});
|
|
694
|
-
let s =
|
|
694
|
+
let s = I(`${v}${e}${p}`, l, be, a);
|
|
695
695
|
if (!i) return `>${y}\n${l}${s}`;
|
|
696
696
|
}
|
|
697
697
|
return n = n.replace(/\n+/g, `$&${l}`), `|${y}\n${l}${v}${n}${p}`;
|
|
@@ -700,8 +700,8 @@ function ke(e, t, n, r) {
|
|
|
700
700
|
let { type: i, value: a } = e, { actualString: o, implicitKey: s, indent: c, indentStep: l, inFlow: u } = t;
|
|
701
701
|
if (s && a.includes("\n") || u && /[[\]{},]/.test(a)) return Ee(a, t);
|
|
702
702
|
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a)) return s || u || !a.includes("\n") ? Ee(a, t) : Oe(e, t, n, r);
|
|
703
|
-
if (!s && !u && i !==
|
|
704
|
-
if (
|
|
703
|
+
if (!s && !u && i !== N.PLAIN && a.includes("\n")) return Oe(e, t, n, r);
|
|
704
|
+
if (L(a)) {
|
|
705
705
|
if (c === "") return t.forceBlockIndent = !0, Oe(e, t, n, r);
|
|
706
706
|
if (s && c === l) return Ee(a, t);
|
|
707
707
|
}
|
|
@@ -710,18 +710,18 @@ function ke(e, t, n, r) {
|
|
|
710
710
|
let e = (e) => e.default && e.tag !== "tag:yaml.org,2002:str" && e.test?.test(d), { compat: n, tags: r } = t.doc.schema;
|
|
711
711
|
if (r.some(e) || n?.some(e)) return Ee(a, t);
|
|
712
712
|
}
|
|
713
|
-
return s ? d :
|
|
713
|
+
return s ? d : I(d, c, ye, Ce(t, !1));
|
|
714
714
|
}
|
|
715
715
|
function Ae(e, t, n, r) {
|
|
716
716
|
let { implicitKey: i, inFlow: a } = t, o = typeof e.value == "string" ? e : Object.assign({}, e, { value: String(e.value) }), { type: s } = e;
|
|
717
|
-
s !==
|
|
717
|
+
s !== N.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (s = N.QUOTE_DOUBLE);
|
|
718
718
|
let c = (e) => {
|
|
719
719
|
switch (e) {
|
|
720
|
-
case
|
|
721
|
-
case
|
|
722
|
-
case
|
|
723
|
-
case
|
|
724
|
-
case
|
|
720
|
+
case N.BLOCK_FOLDED:
|
|
721
|
+
case N.BLOCK_LITERAL: return i || a ? Ee(o.value, t) : Oe(o, t, n, r);
|
|
722
|
+
case N.QUOTE_DOUBLE: return we(o.value, t);
|
|
723
|
+
case N.QUOTE_SINGLE: return Te(o.value, t);
|
|
724
|
+
case N.PLAIN: return ke(o, t, n, r);
|
|
725
725
|
default: return null;
|
|
726
726
|
}
|
|
727
727
|
}, l = c(s);
|
|
@@ -736,7 +736,7 @@ function Ae(e, t, n, r) {
|
|
|
736
736
|
function je(e, t) {
|
|
737
737
|
let n = Object.assign({
|
|
738
738
|
blockQuote: !0,
|
|
739
|
-
commentString:
|
|
739
|
+
commentString: _e,
|
|
740
740
|
defaultKeyType: null,
|
|
741
741
|
defaultStringType: "PLAIN",
|
|
742
742
|
directives: null,
|
|
@@ -797,7 +797,7 @@ function Me(e, t) {
|
|
|
797
797
|
function Ne(e, t, { anchors: n, doc: r }) {
|
|
798
798
|
if (!r.directives) return "";
|
|
799
799
|
let i = [], a = (_(e) || y(e)) && e.anchor;
|
|
800
|
-
a &&
|
|
800
|
+
a && ie(a) && (n.add(a), i.push(`&${a}`));
|
|
801
801
|
let o = e.tag ?? (t.default ? null : t.tag);
|
|
802
802
|
return o && i.push(r.directives.tagString(o)), i.join(" ");
|
|
803
803
|
}
|
|
@@ -823,7 +823,7 @@ function Fe({ key: e, value: t }, n, r, i) {
|
|
|
823
823
|
if (f) throw Error("With simple keys, key nodes cannot have comments");
|
|
824
824
|
if (y(e) || !b(e) && typeof e == "object") throw Error("With simple keys, collection cannot be used as a key value");
|
|
825
825
|
}
|
|
826
|
-
let p = !d && (!e || f && t == null && !n.inFlow || y(e) || (_(e) ? e.type ===
|
|
826
|
+
let p = !d && (!e || f && t == null && !n.inFlow || y(e) || (_(e) ? e.type === N.BLOCK_FOLDED || e.type === N.BLOCK_LITERAL : typeof e == "object"));
|
|
827
827
|
n = Object.assign({}, n, {
|
|
828
828
|
allNullValues: !1,
|
|
829
829
|
implicitKey: !p && (d || !a),
|
|
@@ -836,15 +836,15 @@ function Fe({ key: e, value: t }, n, r, i) {
|
|
|
836
836
|
}
|
|
837
837
|
if (n.inFlow) {
|
|
838
838
|
if (a || t == null) return m && r && r(), g === "" ? "?" : p ? `? ${g}` : g;
|
|
839
|
-
} else if (a && !d || t == null && p) return g = `? ${g}`, f && !m ? g +=
|
|
840
|
-
m && (f = null), p ? (f && (g +=
|
|
839
|
+
} else if (a && !d || t == null && p) return g = `? ${g}`, f && !m ? g += ve(g, n.indent, l(f)) : h && i && i(), g;
|
|
840
|
+
m && (f = null), p ? (f && (g += ve(g, n.indent, l(f))), g = `? ${g}\n${s}:`) : (g = `${g}:`, f && (g += ve(g, n.indent, l(f))));
|
|
841
841
|
let x, S, C;
|
|
842
842
|
b(t) ? (x = !!t.spaceBefore, S = t.commentBefore, C = t.comment) : (x = !1, S = null, C = null, t && typeof t == "object" && (t = o.createNode(t))), n.implicitKey = !1, !p && !f && _(t) && (n.indentAtStart = g.length + 1), h = !1, !u && c.length >= 2 && !n.inFlow && !p && v(t) && !t.flow && !t.tag && !t.anchor && (n.indent = n.indent.substring(2));
|
|
843
843
|
let w = !1, T = Pe(t, n, () => w = !0, () => h = !0), E = " ";
|
|
844
844
|
if (f || x || S) {
|
|
845
845
|
if (E = x ? "\n" : "", S) {
|
|
846
846
|
let e = l(S);
|
|
847
|
-
E += `\n${
|
|
847
|
+
E += `\n${F(e, n.indent)}`;
|
|
848
848
|
}
|
|
849
849
|
T === "" && !n.inFlow ? E === "\n" && C && (E = "\n\n") : E += `\n${n.indent}`;
|
|
850
850
|
} else if (!p && y(t)) {
|
|
@@ -858,7 +858,7 @@ function Fe({ key: e, value: t }, n, r, i) {
|
|
|
858
858
|
t || (E = `\n${n.indent}`);
|
|
859
859
|
}
|
|
860
860
|
} else (T === "" || T[0] === "\n") && (E = "");
|
|
861
|
-
return g += E + T, n.inFlow ? w && r && r() : C && !w ? g +=
|
|
861
|
+
return g += E + T, n.inFlow ? w && r && r() : C && !w ? g += ve(g, n.indent, l(C)) : h && i && i(), g;
|
|
862
862
|
}
|
|
863
863
|
//#endregion
|
|
864
864
|
//#region node_modules/yaml/browser/dist/log.js
|
|
@@ -872,9 +872,9 @@ var Le = "<<", Re = {
|
|
|
872
872
|
default: "key",
|
|
873
873
|
tag: "tag:yaml.org,2002:merge",
|
|
874
874
|
test: /^<<$/,
|
|
875
|
-
resolve: () => Object.assign(new
|
|
875
|
+
resolve: () => Object.assign(new N(Symbol(Le)), { addToJSMap: Be }),
|
|
876
876
|
stringify: () => Le
|
|
877
|
-
}, ze = (e, t) => (Re.identify(t) || _(t) && (!t.type || t.type ===
|
|
877
|
+
}, ze = (e, t) => (Re.identify(t) || _(t) && (!t.type || t.type === N.PLAIN) && Re.identify(t.value)) && e?.doc.schema.tags.some((e) => e.tag === Re.tag && e.default);
|
|
878
878
|
function Be(e, t, n) {
|
|
879
879
|
let r = He(e, n);
|
|
880
880
|
if (v(r)) for (let n of r.items) Ve(e, t, n);
|
|
@@ -902,11 +902,11 @@ function Ue(e, t, { key: n, value: r }) {
|
|
|
902
902
|
if (b(n) && n.addToJSMap) n.addToJSMap(e, t, r);
|
|
903
903
|
else if (ze(e, n)) Be(e, t, r);
|
|
904
904
|
else {
|
|
905
|
-
let i =
|
|
906
|
-
if (t instanceof Map) t.set(i,
|
|
905
|
+
let i = j(n, "", e);
|
|
906
|
+
if (t instanceof Map) t.set(i, j(r, i, e));
|
|
907
907
|
else if (t instanceof Set) t.add(i);
|
|
908
908
|
else {
|
|
909
|
-
let a = We(n, i, e), o =
|
|
909
|
+
let a = We(n, i, e), o = j(r, a, e);
|
|
910
910
|
a in t ? Object.defineProperty(t, a, {
|
|
911
911
|
value: o,
|
|
912
912
|
writable: !0,
|
|
@@ -937,7 +937,7 @@ function We(e, t, n) {
|
|
|
937
937
|
//#endregion
|
|
938
938
|
//#region node_modules/yaml/browser/dist/nodes/Pair.js
|
|
939
939
|
function Ge(e, t, n) {
|
|
940
|
-
return new z(
|
|
940
|
+
return new z(P(e, void 0, n), P(t, void 0, n));
|
|
941
941
|
}
|
|
942
942
|
var z = class e {
|
|
943
943
|
constructor(e, t = null) {
|
|
@@ -973,7 +973,7 @@ function qe({ comment: e, items: t }, n, { blockItemPrefix: r, flowChars: i, ite
|
|
|
973
973
|
}
|
|
974
974
|
d = !1;
|
|
975
975
|
let s = Pe(i, u, () => o = null, () => d = !0);
|
|
976
|
-
o && (s +=
|
|
976
|
+
o && (s += ve(s, a, l(o))), d && o && (d = !1), f.push(r + s);
|
|
977
977
|
}
|
|
978
978
|
let p;
|
|
979
979
|
if (f.length === 0) p = i.start + i.end;
|
|
@@ -984,7 +984,7 @@ function qe({ comment: e, items: t }, n, { blockItemPrefix: r, flowChars: i, ite
|
|
|
984
984
|
p += t ? `\n${c}${t}` : "\n";
|
|
985
985
|
}
|
|
986
986
|
}
|
|
987
|
-
return e ? (p += "\n" +
|
|
987
|
+
return e ? (p += "\n" + F(l(e), c), s && s()) : d && o && o(), p;
|
|
988
988
|
}
|
|
989
989
|
function Je({ items: e }, t, { flowChars: n, itemIndent: r }) {
|
|
990
990
|
let { indent: i, indentStep: a, flowCollectionPadding: o, options: { commentString: s } } = t;
|
|
@@ -1005,7 +1005,7 @@ function Je({ items: e }, t, { flowChars: n, itemIndent: r }) {
|
|
|
1005
1005
|
}
|
|
1006
1006
|
a && (l = !0);
|
|
1007
1007
|
let o = Pe(i, c, () => a = null);
|
|
1008
|
-
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 +=
|
|
1008
|
+
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 += ve(o, r, s(a))), d.push(o), u = d.length;
|
|
1009
1009
|
}
|
|
1010
1010
|
let { start: f, end: p } = n;
|
|
1011
1011
|
if (d.length === 0) return f + p;
|
|
@@ -1022,7 +1022,7 @@ function Je({ items: e }, t, { flowChars: n, itemIndent: r }) {
|
|
|
1022
1022
|
}
|
|
1023
1023
|
function Ye({ indent: e, options: { commentString: t } }, n, r, i) {
|
|
1024
1024
|
if (r && i && (r = r.replace(/^\n+/, "")), r) {
|
|
1025
|
-
let i =
|
|
1025
|
+
let i = F(t(r), e);
|
|
1026
1026
|
n.push(i.trimStart());
|
|
1027
1027
|
}
|
|
1028
1028
|
}
|
|
@@ -1032,7 +1032,7 @@ function Xe(e, t) {
|
|
|
1032
1032
|
let n = _(t) ? t.value : t;
|
|
1033
1033
|
for (let r of e) if (g(r) && (r.key === t || r.key === n || _(r.key) && r.key.value === n)) return r;
|
|
1034
1034
|
}
|
|
1035
|
-
var B = class extends
|
|
1035
|
+
var B = class extends ge {
|
|
1036
1036
|
static get tagName() {
|
|
1037
1037
|
return "tag:yaml.org,2002:map";
|
|
1038
1038
|
}
|
|
@@ -1055,7 +1055,7 @@ var B = class extends F {
|
|
|
1055
1055
|
let r = Xe(this.items, n.key), i = this.schema?.sortMapEntries;
|
|
1056
1056
|
if (r) {
|
|
1057
1057
|
if (!t) throw Error(`Key ${n.key} already set`);
|
|
1058
|
-
_(r.value) &&
|
|
1058
|
+
_(r.value) && de(n.value) ? r.value.value = n.value : r.value = n.value;
|
|
1059
1059
|
} else if (i) {
|
|
1060
1060
|
let e = this.items.findIndex((e) => i(n, e) < 0);
|
|
1061
1061
|
e === -1 ? this.items.push(n) : this.items.splice(e, 0, n);
|
|
@@ -1104,7 +1104,7 @@ var B = class extends F {
|
|
|
1104
1104
|
return h(e) || t("Expected a mapping for this tag"), e;
|
|
1105
1105
|
},
|
|
1106
1106
|
createNode: (e, t, n) => B.from(e, t, n)
|
|
1107
|
-
}, Qe = class extends
|
|
1107
|
+
}, Qe = class extends ge {
|
|
1108
1108
|
static get tagName() {
|
|
1109
1109
|
return "tag:yaml.org,2002:seq";
|
|
1110
1110
|
}
|
|
@@ -1132,13 +1132,13 @@ var B = class extends F {
|
|
|
1132
1132
|
let n = $e(e);
|
|
1133
1133
|
if (typeof n != "number") throw Error(`Expected a valid index, not ${e}.`);
|
|
1134
1134
|
let r = this.items[n];
|
|
1135
|
-
_(r) &&
|
|
1135
|
+
_(r) && de(t) ? r.value = t : this.items[n] = t;
|
|
1136
1136
|
}
|
|
1137
1137
|
toJSON(e, t) {
|
|
1138
1138
|
let n = [];
|
|
1139
1139
|
t?.onCreate && t.onCreate(n);
|
|
1140
1140
|
let r = 0;
|
|
1141
|
-
for (let e of this.items) n.push(
|
|
1141
|
+
for (let e of this.items) n.push(j(e, String(r++), t));
|
|
1142
1142
|
return n;
|
|
1143
1143
|
}
|
|
1144
1144
|
toString(e, t, n) {
|
|
@@ -1162,7 +1162,7 @@ var B = class extends F {
|
|
|
1162
1162
|
let n = t instanceof Set ? a : String(e++);
|
|
1163
1163
|
a = r.call(t, n, a);
|
|
1164
1164
|
}
|
|
1165
|
-
i.items.push(
|
|
1165
|
+
i.items.push(P(a, void 0, n));
|
|
1166
1166
|
}
|
|
1167
1167
|
}
|
|
1168
1168
|
return i;
|
|
@@ -1193,18 +1193,18 @@ var et = {
|
|
|
1193
1193
|
}
|
|
1194
1194
|
}, nt = {
|
|
1195
1195
|
identify: (e) => e == null,
|
|
1196
|
-
createNode: () => new
|
|
1196
|
+
createNode: () => new N(null),
|
|
1197
1197
|
default: !0,
|
|
1198
1198
|
tag: "tag:yaml.org,2002:null",
|
|
1199
1199
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
1200
|
-
resolve: () => new
|
|
1200
|
+
resolve: () => new N(null),
|
|
1201
1201
|
stringify: ({ source: e }, t) => typeof e == "string" && nt.test.test(e) ? e : t.options.nullStr
|
|
1202
1202
|
}, rt = {
|
|
1203
1203
|
identify: (e) => typeof e == "boolean",
|
|
1204
1204
|
default: !0,
|
|
1205
1205
|
tag: "tag:yaml.org,2002:bool",
|
|
1206
1206
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
1207
|
-
resolve: (e) => new
|
|
1207
|
+
resolve: (e) => new N(e[0] === "t" || e[0] === "T"),
|
|
1208
1208
|
stringify({ source: e, value: t }, n) {
|
|
1209
1209
|
return e && rt.test.test(e) && t === (e[0] === "t" || e[0] === "T") ? e : t ? n.options.trueStr : n.options.falseStr;
|
|
1210
1210
|
}
|
|
@@ -1250,7 +1250,7 @@ var it = {
|
|
|
1250
1250
|
tag: "tag:yaml.org,2002:float",
|
|
1251
1251
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
|
|
1252
1252
|
resolve(e) {
|
|
1253
|
-
let t = new
|
|
1253
|
+
let t = new N(parseFloat(e)), n = e.indexOf(".");
|
|
1254
1254
|
return n !== -1 && e[e.length - 1] === "0" && (t.minFractionDigits = e.length - n - 1), t;
|
|
1255
1255
|
},
|
|
1256
1256
|
stringify: V
|
|
@@ -1310,7 +1310,7 @@ var ht = ({ value: e }) => JSON.stringify(e), gt = [
|
|
|
1310
1310
|
},
|
|
1311
1311
|
{
|
|
1312
1312
|
identify: (e) => e == null,
|
|
1313
|
-
createNode: () => new
|
|
1313
|
+
createNode: () => new N(null),
|
|
1314
1314
|
default: !0,
|
|
1315
1315
|
tag: "tag:yaml.org,2002:null",
|
|
1316
1316
|
test: /^null$/,
|
|
@@ -1368,10 +1368,10 @@ var ht = ({ value: e }) => JSON.stringify(e), gt = [
|
|
|
1368
1368
|
for (let t = 0; t < o.length; ++t) e += String.fromCharCode(o[t]);
|
|
1369
1369
|
s = btoa(e);
|
|
1370
1370
|
} else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");
|
|
1371
|
-
if (t ??=
|
|
1371
|
+
if (t ??= N.BLOCK_LITERAL, t !== N.QUOTE_DOUBLE) {
|
|
1372
1372
|
let e = Math.max(r.options.lineWidth - r.indent.length, r.options.minContentWidth), n = Math.ceil(s.length / e), i = Array(n);
|
|
1373
1373
|
for (let t = 0, r = 0; t < n; ++t, r += e) i[t] = s.substr(r, e);
|
|
1374
|
-
s = i.join(t ===
|
|
1374
|
+
s = i.join(t === N.BLOCK_LITERAL ? "\n" : " ");
|
|
1375
1375
|
}
|
|
1376
1376
|
return Ae({
|
|
1377
1377
|
comment: e,
|
|
@@ -1388,7 +1388,7 @@ function yt(e, t) {
|
|
|
1388
1388
|
if (!g(r)) {
|
|
1389
1389
|
if (h(r)) {
|
|
1390
1390
|
r.items.length > 1 && t("Each pair must have its own sequence indicator");
|
|
1391
|
-
let e = r.items[0] || new z(new
|
|
1391
|
+
let e = r.items[0] || new z(new N(null));
|
|
1392
1392
|
if (r.commentBefore && (e.key.commentBefore = e.key.commentBefore ? `${r.commentBefore}\n${e.key.commentBefore}` : r.commentBefore), r.comment) {
|
|
1393
1393
|
let t = e.value ?? e.key;
|
|
1394
1394
|
t.comment = t.comment ? `${r.comment}\n${t.comment}` : r.comment;
|
|
@@ -1436,7 +1436,7 @@ var xt = {
|
|
|
1436
1436
|
t?.onCreate && t.onCreate(n);
|
|
1437
1437
|
for (let e of this.items) {
|
|
1438
1438
|
let r, i;
|
|
1439
|
-
if (g(e) ? (r =
|
|
1439
|
+
if (g(e) ? (r = j(e.key, "", t), i = j(e.value, r, t)) : r = j(e, "", t), n.has(r)) throw Error("Ordered maps must not include duplicate keys");
|
|
1440
1440
|
n.set(r, i);
|
|
1441
1441
|
}
|
|
1442
1442
|
return n;
|
|
@@ -1470,14 +1470,14 @@ var Tt = {
|
|
|
1470
1470
|
default: !0,
|
|
1471
1471
|
tag: "tag:yaml.org,2002:bool",
|
|
1472
1472
|
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
|
1473
|
-
resolve: () => new
|
|
1473
|
+
resolve: () => new N(!0),
|
|
1474
1474
|
stringify: wt
|
|
1475
1475
|
}, Et = {
|
|
1476
1476
|
identify: (e) => e === !1,
|
|
1477
1477
|
default: !0,
|
|
1478
1478
|
tag: "tag:yaml.org,2002:bool",
|
|
1479
1479
|
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
|
|
1480
|
-
resolve: () => new
|
|
1480
|
+
resolve: () => new N(!1),
|
|
1481
1481
|
stringify: wt
|
|
1482
1482
|
}, Dt = {
|
|
1483
1483
|
identify: (e) => typeof e == "number",
|
|
@@ -1503,7 +1503,7 @@ var Tt = {
|
|
|
1503
1503
|
tag: "tag:yaml.org,2002:float",
|
|
1504
1504
|
test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
|
|
1505
1505
|
resolve(e) {
|
|
1506
|
-
let t = new
|
|
1506
|
+
let t = new N(parseFloat(e.replace(/_/g, ""))), n = e.indexOf(".");
|
|
1507
1507
|
if (n !== -1) {
|
|
1508
1508
|
let r = e.substring(n + 1).replace(/_/g, "");
|
|
1509
1509
|
r[r.length - 1] === "0" && (t.minFractionDigits = r.length);
|
|
@@ -1768,28 +1768,28 @@ function Zt(e, t) {
|
|
|
1768
1768
|
if (e.commentBefore) {
|
|
1769
1769
|
n.length !== 1 && n.unshift("");
|
|
1770
1770
|
let t = a(e.commentBefore);
|
|
1771
|
-
n.unshift(
|
|
1771
|
+
n.unshift(F(t, ""));
|
|
1772
1772
|
}
|
|
1773
1773
|
let o = !1, s = null;
|
|
1774
1774
|
if (e.contents) {
|
|
1775
1775
|
if (b(e.contents)) {
|
|
1776
1776
|
if (e.contents.spaceBefore && r && n.push(""), e.contents.commentBefore) {
|
|
1777
1777
|
let t = a(e.contents.commentBefore);
|
|
1778
|
-
n.push(
|
|
1778
|
+
n.push(F(t, ""));
|
|
1779
1779
|
}
|
|
1780
1780
|
i.forceBlockIndent = !!e.comment, s = e.contents.comment;
|
|
1781
1781
|
}
|
|
1782
1782
|
let t = s ? void 0 : () => o = !0, c = Pe(e.contents, i, () => s = null, t);
|
|
1783
|
-
s && (c +=
|
|
1783
|
+
s && (c += ve(c, "", a(s))), (c[0] === "|" || c[0] === ">") && n[n.length - 1] === "---" ? n[n.length - 1] = `--- ${c}` : n.push(c);
|
|
1784
1784
|
} else n.push(Pe(e.contents, i));
|
|
1785
1785
|
if (e.directives?.docEnd) {
|
|
1786
1786
|
if (e.comment) {
|
|
1787
1787
|
let t = a(e.comment);
|
|
1788
|
-
t.includes("\n") ? (n.push("..."), n.push(
|
|
1788
|
+
t.includes("\n") ? (n.push("..."), n.push(F(t, ""))) : n.push(`... ${t}`);
|
|
1789
1789
|
} else n.push("...");
|
|
1790
1790
|
} else {
|
|
1791
1791
|
let t = e.comment;
|
|
1792
|
-
t && o && (t = t.replace(/^\n+/, "")), t && ((!o || s) && n[n.length - 1] !== "" && n.push(""), n.push(
|
|
1792
|
+
t && o && (t = t.replace(/^\n+/, "")), t && ((!o || s) && n[n.length - 1] !== "" && n.push(""), n.push(F(a(t), "")));
|
|
1793
1793
|
}
|
|
1794
1794
|
return n.join("\n") + "\n";
|
|
1795
1795
|
}
|
|
@@ -1826,10 +1826,10 @@ var Qt = class e {
|
|
|
1826
1826
|
}
|
|
1827
1827
|
createAlias(e, t) {
|
|
1828
1828
|
if (!e.anchor) {
|
|
1829
|
-
let n =
|
|
1830
|
-
e.anchor = !t || n.has(t) ?
|
|
1829
|
+
let n = ae(this);
|
|
1830
|
+
e.anchor = !t || n.has(t) ? oe(t || "a", n) : t;
|
|
1831
1831
|
}
|
|
1832
|
-
return new
|
|
1832
|
+
return new ue(e.anchor);
|
|
1833
1833
|
}
|
|
1834
1834
|
createNode(e, t, n) {
|
|
1835
1835
|
let r;
|
|
@@ -1838,7 +1838,7 @@ var Qt = class e {
|
|
|
1838
1838
|
let e = t.filter((e) => typeof e == "number" || e instanceof String || e instanceof Number).map(String);
|
|
1839
1839
|
e.length > 0 && (t = t.concat(e)), r = t;
|
|
1840
1840
|
} else n === void 0 && t && (n = t, t = void 0);
|
|
1841
|
-
let { aliasDuplicateObjects: i, anchorPrefix: a, flow: o, keepUndefined: s, onTagObj: c, tag: l } = n ?? {}, { onAnchor: u, setAnchors: d, sourceObjects: f } =
|
|
1841
|
+
let { aliasDuplicateObjects: i, anchorPrefix: a, flow: o, keepUndefined: s, onTagObj: c, tag: l } = n ?? {}, { onAnchor: u, setAnchors: d, sourceObjects: f } = se(this, a || "a"), p = {
|
|
1842
1842
|
aliasDuplicateObjects: i ?? !0,
|
|
1843
1843
|
keepUndefined: s ?? !1,
|
|
1844
1844
|
onAnchor: u,
|
|
@@ -1846,7 +1846,7 @@ var Qt = class e {
|
|
|
1846
1846
|
replacer: r,
|
|
1847
1847
|
schema: this.schema,
|
|
1848
1848
|
sourceObjects: f
|
|
1849
|
-
}, m =
|
|
1849
|
+
}, m = P(e, l, p);
|
|
1850
1850
|
return o && y(m) && (m.flow = !0), d(), m;
|
|
1851
1851
|
}
|
|
1852
1852
|
createPair(e, t, n = {}) {
|
|
@@ -1913,9 +1913,9 @@ var Qt = class e {
|
|
|
1913
1913
|
mapAsMap: n === !0,
|
|
1914
1914
|
mapKeyWarned: !1,
|
|
1915
1915
|
maxAliasCount: typeof r == "number" ? r : 100
|
|
1916
|
-
}, s =
|
|
1916
|
+
}, s = j(this.contents, t ?? "", o);
|
|
1917
1917
|
if (typeof i == "function") for (let { count: e, res: t } of o.anchors.values()) i(t, e);
|
|
1918
|
-
return typeof a == "function" ?
|
|
1918
|
+
return typeof a == "function" ? ce(a, { "": s }, "", s) : s;
|
|
1919
1919
|
}
|
|
1920
1920
|
toJSON(e, t) {
|
|
1921
1921
|
return this.toJS({
|
|
@@ -2304,7 +2304,7 @@ function _n(e, t, n, r, i) {
|
|
|
2304
2304
|
if (r?.collection === s) t.schema.tags.push(Object.assign({}, r, { default: !1 })), c = r;
|
|
2305
2305
|
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), gn(e, t, n, i, o);
|
|
2306
2306
|
}
|
|
2307
|
-
let l = gn(e, t, n, i, o, c), u = c.resolve?.(l, (e) => i(a, "TAG_RESOLVE_FAILED", e), t.options) ?? l, d = b(u) ? u : new
|
|
2307
|
+
let l = gn(e, t, n, i, o, c), u = c.resolve?.(l, (e) => i(a, "TAG_RESOLVE_FAILED", e), t.options) ?? l, d = b(u) ? u : new N(u);
|
|
2308
2308
|
return d.range = l.range, d.tag = o, c?.format && (d.format = c.format), d;
|
|
2309
2309
|
}
|
|
2310
2310
|
//#endregion
|
|
@@ -2321,7 +2321,7 @@ function vn(e, t, n) {
|
|
|
2321
2321
|
r
|
|
2322
2322
|
]
|
|
2323
2323
|
};
|
|
2324
|
-
let a = i.mode === ">" ?
|
|
2324
|
+
let a = i.mode === ">" ? N.BLOCK_FOLDED : N.BLOCK_LITERAL, o = t.source ? bn(t.source) : [], s = o.length;
|
|
2325
2325
|
for (let e = o.length - 1; e >= 0; --e) {
|
|
2326
2326
|
let t = o[e][1];
|
|
2327
2327
|
if (t === "" || t === "\r") s = e;
|
|
@@ -2362,7 +2362,7 @@ function vn(e, t, n) {
|
|
|
2362
2362
|
let e = `Block scalar lines must not be less indented than their ${i.indent ? "explicit indentation indicator" : "first line"}`;
|
|
2363
2363
|
n(l - r.length - (s ? 2 : 1), "BAD_INDENT", e), t = "";
|
|
2364
2364
|
}
|
|
2365
|
-
a ===
|
|
2365
|
+
a === N.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);
|
|
2366
2366
|
}
|
|
2367
2367
|
switch (i.chomp) {
|
|
2368
2368
|
case "-": break;
|
|
@@ -2438,13 +2438,13 @@ function xn(e, t, n) {
|
|
|
2438
2438
|
let { offset: r, type: i, source: a, end: o } = e, s, c, l = (e, t, i) => n(r + e, t, i);
|
|
2439
2439
|
switch (i) {
|
|
2440
2440
|
case "scalar":
|
|
2441
|
-
s =
|
|
2441
|
+
s = N.PLAIN, c = Sn(a, l);
|
|
2442
2442
|
break;
|
|
2443
2443
|
case "single-quoted-scalar":
|
|
2444
|
-
s =
|
|
2444
|
+
s = N.QUOTE_SINGLE, c = Cn(a, l);
|
|
2445
2445
|
break;
|
|
2446
2446
|
case "double-quoted-scalar":
|
|
2447
|
-
s =
|
|
2447
|
+
s = N.QUOTE_DOUBLE, c = Tn(a, l);
|
|
2448
2448
|
break;
|
|
2449
2449
|
/* istanbul ignore next should not happen */
|
|
2450
2450
|
default: return n(e, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${i}`), {
|
|
@@ -2583,10 +2583,10 @@ function kn(e, t, n, r) {
|
|
|
2583
2583
|
let d;
|
|
2584
2584
|
try {
|
|
2585
2585
|
let a = l.resolve(i, (e) => r(n ?? t, "TAG_RESOLVE_FAILED", e), e.options);
|
|
2586
|
-
d = _(a) ? a : new
|
|
2586
|
+
d = _(a) ? a : new N(a);
|
|
2587
2587
|
} catch (e) {
|
|
2588
2588
|
let a = e instanceof Error ? e.message : String(e);
|
|
2589
|
-
r(n ?? t, "TAG_RESOLVE_FAILED", a), d = new
|
|
2589
|
+
r(n ?? t, "TAG_RESOLVE_FAILED", a), d = new N(i);
|
|
2590
2590
|
}
|
|
2591
2591
|
return d.range = s, d.source = i, a && (d.type = a), c && (d.tag = c), l.format && (d.format = l.format), o && (d.comment = o), d;
|
|
2592
2592
|
}
|
|
@@ -2673,7 +2673,7 @@ function Fn(e, t, n, r, { spaceBefore: i, comment: a, anchor: o, tag: s, end: c
|
|
|
2673
2673
|
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;
|
|
2674
2674
|
}
|
|
2675
2675
|
function In({ options: e }, { offset: t, source: n, end: r }, i) {
|
|
2676
|
-
let a = new
|
|
2676
|
+
let a = new ue(n.substring(1));
|
|
2677
2677
|
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);
|
|
2678
2678
|
let o = t + n.length, s = fn(r, o, e.strict, i);
|
|
2679
2679
|
return a.range = [
|
|
@@ -4253,7 +4253,7 @@ function Tr(e, t, n) {
|
|
|
4253
4253
|
//#endregion
|
|
4254
4254
|
//#region node_modules/yaml/browser/index.js
|
|
4255
4255
|
var Er = /* @__PURE__ */ a({
|
|
4256
|
-
Alias: () =>
|
|
4256
|
+
Alias: () => ue,
|
|
4257
4257
|
CST: () => tr,
|
|
4258
4258
|
Composer: () => Bn,
|
|
4259
4259
|
Document: () => Qt,
|
|
@@ -4261,7 +4261,7 @@ var Er = /* @__PURE__ */ a({
|
|
|
4261
4261
|
LineCounter: () => fr,
|
|
4262
4262
|
Pair: () => z,
|
|
4263
4263
|
Parser: () => br,
|
|
4264
|
-
Scalar: () =>
|
|
4264
|
+
Scalar: () => N,
|
|
4265
4265
|
Schema: () => Xt,
|
|
4266
4266
|
YAMLError: () => en,
|
|
4267
4267
|
YAMLMap: () => B,
|
|
@@ -4720,19 +4720,19 @@ function Lr(e) {
|
|
|
4720
4720
|
O[e] = W(O[e] || {}, t);
|
|
4721
4721
|
});
|
|
4722
4722
|
});
|
|
4723
|
-
let
|
|
4723
|
+
let k = m ? {
|
|
4724
4724
|
...m,
|
|
4725
4725
|
fields: O
|
|
4726
|
-
} : null,
|
|
4726
|
+
} : null, ee = h?.fields || {};
|
|
4727
4727
|
Array.isArray(h?.fieldSets) && h?.fieldSets.forEach((e) => {
|
|
4728
4728
|
let t = _[e] || {}, n = t.fields || t, r = v(n);
|
|
4729
4729
|
Object.entries(r).forEach(([e, t]) => {
|
|
4730
|
-
|
|
4730
|
+
ee[e] = W(ee[e] || {}, t);
|
|
4731
4731
|
});
|
|
4732
4732
|
});
|
|
4733
4733
|
let te = h ? {
|
|
4734
4734
|
...h,
|
|
4735
|
-
fields:
|
|
4735
|
+
fields: ee
|
|
4736
4736
|
} : null;
|
|
4737
4737
|
return {
|
|
4738
4738
|
nodes: b,
|
|
@@ -4744,7 +4744,7 @@ function Lr(e) {
|
|
|
4744
4744
|
fieldSets: _,
|
|
4745
4745
|
nodeTemplate: f || null,
|
|
4746
4746
|
treeTemplate: p || null,
|
|
4747
|
-
channelTemplate:
|
|
4747
|
+
channelTemplate: k,
|
|
4748
4748
|
userTemplate: te
|
|
4749
4749
|
};
|
|
4750
4750
|
}
|
|
@@ -6458,7 +6458,7 @@ function Ci(e, t = null) {
|
|
|
6458
6458
|
return n;
|
|
6459
6459
|
}
|
|
6460
6460
|
function wi(e) {
|
|
6461
|
-
if (e == null || e === "null" || e === "" || typeof e == "string" && e.startsWith("draft-")) return null;
|
|
6461
|
+
if (e == null || e === "null" || e === "" || e === 0 || e === "0" || typeof e == "string" && e.startsWith("draft-")) return null;
|
|
6462
6462
|
let t = Number(e);
|
|
6463
6463
|
return isNaN(t) ? null : t;
|
|
6464
6464
|
}
|
|
@@ -6549,31 +6549,27 @@ xi.get("/tree.json", async (e) => {
|
|
|
6549
6549
|
if (a === "create") {
|
|
6550
6550
|
let r = f.slug || n.slug || o, a = r ? String(r).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "") : null;
|
|
6551
6551
|
if (a) {
|
|
6552
|
-
let r =
|
|
6553
|
-
SELECT 1
|
|
6554
|
-
FROM tree_nodes tn
|
|
6555
|
-
INNER JOIN content_nodes cn ON tn.contentId = cn.id
|
|
6556
|
-
WHERE tn.treeId = ?
|
|
6557
|
-
AND ${r}
|
|
6558
|
-
AND cn.slug = ?
|
|
6559
|
-
AND (cn.deletedAt IS NULL OR cn.deletedAt = '')
|
|
6560
|
-
`, c = m === null ? [i, a] : [
|
|
6552
|
+
let r = "", o = [];
|
|
6553
|
+
m === null ? (r = "\n SELECT 1 \n FROM tree_nodes tn\n INNER JOIN content_nodes cn ON tn.contentId = cn.id\n WHERE tn.treeId = ? \n AND tn.parentId IS NULL\n AND cn.slug = ?\n AND (cn.deletedAt IS NULL OR cn.deletedAt = '')\n ", o = [i, a]) : (r = "\n SELECT 1 \n FROM tree_nodes tn\n INNER JOIN content_nodes cn ON tn.contentId = cn.id\n WHERE tn.treeId = ? \n AND tn.parentId = ?\n AND cn.slug = ?\n AND (cn.deletedAt IS NULL OR cn.deletedAt = '')\n ", o = [
|
|
6561
6554
|
i,
|
|
6562
6555
|
m,
|
|
6563
6556
|
a
|
|
6564
|
-
];
|
|
6565
|
-
|
|
6557
|
+
]);
|
|
6558
|
+
let s = n.contentId || n.id ? Number(n.contentId || n.id) : null;
|
|
6559
|
+
if (s && !isNaN(s) && (r += " AND cn.id != ?", o.push(s)), r += " LIMIT 1", (await X(t, r, o)).length > 0) return e.json({
|
|
6566
6560
|
error: `The slug '${a}' is already in use by another page in this section.`,
|
|
6567
6561
|
field: "slug"
|
|
6568
6562
|
}, 409);
|
|
6569
6563
|
}
|
|
6570
6564
|
let c = JSON.stringify(f), l = 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 || "page", o || "Untitled", a, f.language || n.language || "en", p, c, h, h), u = Number(l.lastInsertRowid);
|
|
6571
6565
|
await Z(t, "DELETE FROM tree_nodes WHERE treeId = ? AND contentId = ?", [i, u]);
|
|
6572
|
-
let d =
|
|
6573
|
-
|
|
6574
|
-
let
|
|
6575
|
-
|
|
6576
|
-
|
|
6566
|
+
let d = [];
|
|
6567
|
+
d = m === null ? await X(t, "SELECT COALESCE(MAX(sortOrder), -1) + 1 as nextSort FROM tree_nodes WHERE treeId = ? AND parentId IS NULL", [i]) : await X(t, "SELECT COALESCE(MAX(sortOrder), -1) + 1 as nextSort FROM tree_nodes WHERE treeId = ? AND parentId = ?", [i, m]);
|
|
6568
|
+
let g = d[0]?.nextSort ?? 0, _ = await t.prepare("\n INSERT INTO tree_nodes (treeId, contentId, parentId, sortOrder)\n VALUES (?, ?, ?, ?)\n ").run(i, u, m, g), v = Number(_.lastInsertRowid), y = [];
|
|
6569
|
+
n.channels && Array.isArray(n.channels) ? y = n.channels : n.channelId && n.channelId !== "all" && (y = [n.channelId]);
|
|
6570
|
+
let b = [...new Set(y)].filter((e) => e && e !== "all").map((e) => Number(e));
|
|
6571
|
+
if (b.length > 0) {
|
|
6572
|
+
let e = b.map(() => "(?, ?)").join(", "), n = b.flatMap((e) => [u, e]);
|
|
6577
6573
|
await Z(t, `INSERT OR IGNORE INTO node_channels (nodeId, channelId) VALUES ${e}`, n);
|
|
6578
6574
|
}
|
|
6579
6575
|
return Si(e, async () => {
|
|
@@ -6581,7 +6577,7 @@ xi.get("/tree.json", async (e) => {
|
|
|
6581
6577
|
}), e.json({
|
|
6582
6578
|
success: !0,
|
|
6583
6579
|
id: u,
|
|
6584
|
-
treeNodeId:
|
|
6580
|
+
treeNodeId: v,
|
|
6585
6581
|
status: "draft"
|
|
6586
6582
|
}, 201);
|
|
6587
6583
|
}
|
|
@@ -6589,27 +6585,17 @@ xi.get("/tree.json", async (e) => {
|
|
|
6589
6585
|
if (!l) return e.json({ error: "contentId is required for attach" }, 400);
|
|
6590
6586
|
let n = (await X(t, "SELECT slug FROM content_nodes WHERE id = ?", [l]))[0];
|
|
6591
6587
|
if (n && n.slug) {
|
|
6592
|
-
let r =
|
|
6588
|
+
let r = "", a = [];
|
|
6589
|
+
if (m === null ? (r = "\n SELECT 1 \n FROM tree_nodes tn\n INNER JOIN content_nodes cn ON tn.contentId = cn.id\n WHERE tn.treeId = ? \n AND tn.parentId IS NULL\n AND cn.slug = ?\n AND cn.id != ?\n AND (cn.deletedAt IS NULL OR cn.deletedAt = '')\n LIMIT 1\n ", a = [
|
|
6593
6590
|
i,
|
|
6594
6591
|
n.slug,
|
|
6595
6592
|
l
|
|
6596
|
-
] : [
|
|
6593
|
+
]) : (r = "\n SELECT 1 \n FROM tree_nodes tn\n INNER JOIN content_nodes cn ON tn.contentId = cn.id\n WHERE tn.treeId = ? \n AND tn.parentId = ?\n AND cn.slug = ?\n AND cn.id != ?\n AND (cn.deletedAt IS NULL OR cn.deletedAt = '')\n LIMIT 1\n ", a = [
|
|
6597
6594
|
i,
|
|
6598
6595
|
m,
|
|
6599
6596
|
n.slug,
|
|
6600
6597
|
l
|
|
6601
|
-
]
|
|
6602
|
-
if ((await X(t, `
|
|
6603
|
-
SELECT 1
|
|
6604
|
-
FROM tree_nodes tn
|
|
6605
|
-
INNER JOIN content_nodes cn ON tn.contentId = cn.id
|
|
6606
|
-
WHERE tn.treeId = ?
|
|
6607
|
-
AND ${r}
|
|
6608
|
-
AND cn.slug = ?
|
|
6609
|
-
AND cn.id != ?
|
|
6610
|
-
AND (cn.deletedAt IS NULL OR cn.deletedAt = '')
|
|
6611
|
-
LIMIT 1
|
|
6612
|
-
`, a)).length > 0) return e.json({
|
|
6598
|
+
]), (await X(t, r, a)).length > 0) return e.json({
|
|
6613
6599
|
error: `Cannot attach. The slug '${n.slug}' is already in use by another page in this section.`,
|
|
6614
6600
|
field: "slug"
|
|
6615
6601
|
}, 409);
|
|
@@ -6826,9 +6812,9 @@ Ei.get("/", async (e) => {
|
|
|
6826
6812
|
O = Number(e.lastInsertRowid);
|
|
6827
6813
|
}
|
|
6828
6814
|
await t.prepare("DELETE FROM channel_trees WHERE channelId = ?").run(O);
|
|
6829
|
-
let
|
|
6830
|
-
if (
|
|
6831
|
-
let n =
|
|
6815
|
+
let k = (Array.isArray(f) ? f : []).filter((e) => e && (e.treeId !== void 0 || e.id !== void 0) && e.key);
|
|
6816
|
+
if (k.length > 0) for (let e = 0; e < k.length; e += 20) {
|
|
6817
|
+
let n = k.slice(e, e + 20), r = n.map(() => "(?, ?, ?, ?)").join(", "), i = n.flatMap((e) => {
|
|
6832
6818
|
let t = e.treeId === void 0 ? e.id : e.treeId;
|
|
6833
6819
|
return [
|
|
6834
6820
|
O,
|
|
@@ -12234,8 +12220,8 @@ async function Ji(e, t, n) {
|
|
|
12234
12220
|
let l = "ORDER BY updatedAt DESC";
|
|
12235
12221
|
o === "published_desc" || o === "createdAt" ? l = "ORDER BY createdAt DESC" : o === "title_asc" && (l = "ORDER BY LOWER(title) ASC");
|
|
12236
12222
|
try {
|
|
12237
|
-
let n = await e.prepare(`SELECT id, title, slug, language, dataJson, createdAt, updatedAt ${s} ${l} LIMIT ?`).all(...c, a)
|
|
12238
|
-
t.data.initialItems =
|
|
12223
|
+
let n = await Promise.resolve(e.prepare(`SELECT id, title, slug, language, dataJson, createdAt, updatedAt ${s} ${l} LIMIT ?`).all(...c, a));
|
|
12224
|
+
t.data.initialItems = (n || []).map((e) => {
|
|
12239
12225
|
let t = {};
|
|
12240
12226
|
if (e.dataJson) try {
|
|
12241
12227
|
t = typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson;
|
|
@@ -12258,66 +12244,78 @@ async function Ji(e, t, n) {
|
|
|
12258
12244
|
}));
|
|
12259
12245
|
}
|
|
12260
12246
|
async function Yi(e, t, n, r, i = !1, a) {
|
|
12261
|
-
if (!t) return { blocks: [] };
|
|
12262
|
-
|
|
12263
|
-
|
|
12264
|
-
|
|
12265
|
-
|
|
12266
|
-
|
|
12267
|
-
|
|
12268
|
-
|
|
12269
|
-
|
|
12270
|
-
|
|
12271
|
-
|
|
12272
|
-
|
|
12273
|
-
|
|
12274
|
-
|
|
12275
|
-
|
|
12276
|
-
|
|
12277
|
-
|
|
12278
|
-
|
|
12279
|
-
|
|
12280
|
-
|
|
12281
|
-
|
|
12282
|
-
|
|
12283
|
-
|
|
12284
|
-
|
|
12285
|
-
|
|
12286
|
-
|
|
12287
|
-
|
|
12247
|
+
if (!t || t === "0" || t === 0 || t === "null") return { blocks: [] };
|
|
12248
|
+
try {
|
|
12249
|
+
let o = await Promise.resolve(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 WHERE ap.parentId IS NOT NULL AND ap.parentId != 0 AND ap.parentId != '0' AND ap.parentId != 'null' AND ap.level < 20\n ) SELECT * FROM ancestor_path ORDER BY level ASC\n ").all(t, t));
|
|
12250
|
+
if (!o || o.length === 0) return { blocks: [] };
|
|
12251
|
+
let s = o.map((e) => e.contentId).filter((e) => e != null);
|
|
12252
|
+
if (s.length === 0) return { blocks: [] };
|
|
12253
|
+
let c = s.map(() => "?").join(","), l = +!!i, u = await Promise.resolve(e.prepare(`SELECT * FROM content_blocks WHERE contentId IN (${c}) AND isDraft = ? ORDER BY contentId ASC, sortOrder ASC`).all(...s, l)), d = [];
|
|
12254
|
+
i || (d = await Promise.resolve(e.prepare(`SELECT * FROM content_blocks WHERE contentId IN (${c}) ORDER BY contentId ASC, sortOrder ASC`).all(...s)));
|
|
12255
|
+
let f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
|
|
12256
|
+
for (let e of u) {
|
|
12257
|
+
let t = String(e.contentId);
|
|
12258
|
+
f.has(t) || f.set(t, []), f.get(t).push(e);
|
|
12259
|
+
}
|
|
12260
|
+
for (let e of d) {
|
|
12261
|
+
let t = String(e.contentId);
|
|
12262
|
+
p.has(t) || p.set(t, []), p.get(t).push(e);
|
|
12263
|
+
}
|
|
12264
|
+
for (let t of o) {
|
|
12265
|
+
let o = f.get(String(t.contentId)) || [];
|
|
12266
|
+
if (o.length === 0 && !i && (o = p.get(String(t.contentId)) || []), o.filter((e) => e.region === n).length === 0) continue;
|
|
12267
|
+
let s = /* @__PURE__ */ new Set([n]), c = !0;
|
|
12268
|
+
for (; c;) {
|
|
12269
|
+
c = !1;
|
|
12270
|
+
for (let e of o) {
|
|
12271
|
+
if (!s.has(e.region)) continue;
|
|
12272
|
+
let t = {};
|
|
12273
|
+
try {
|
|
12274
|
+
t = (typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson) || {};
|
|
12275
|
+
} catch {}
|
|
12276
|
+
let n = String(e.id), r = String(t.blockId || t._instanceId || t.id || e.blockId);
|
|
12277
|
+
for (let e of o) !e.region || s.has(e.region) || (e.region.startsWith(`${n}-`) || e.region.startsWith(`${n}_`) || r && r !== "undefined" && r !== "null" && (e.region.startsWith(`${r}-`) || e.region.startsWith(`${r}_`) || e.region.startsWith(r))) && (s.add(e.region), c = !0);
|
|
12278
|
+
}
|
|
12279
|
+
}
|
|
12280
|
+
let l = o.filter((e) => s.has(e.region)), u = [];
|
|
12281
|
+
for (let e of l) {
|
|
12288
12282
|
let t = {};
|
|
12289
12283
|
try {
|
|
12290
12284
|
t = (typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson) || {};
|
|
12291
12285
|
} catch {}
|
|
12292
|
-
let n =
|
|
12293
|
-
|
|
12286
|
+
let n = t.hidden === !0 || t.hidden === 1 || t.hidden === "1" || t.hidden === "true", a = qi(t.startShowingAt, t.stopShowingAt);
|
|
12287
|
+
if (!i && (n || !a)) continue;
|
|
12288
|
+
let o = e.elementType || e.componentId || "text-block", s = r.blocks?.[o]?.fields || r.elements?.[o]?.fields || r.components?.[o]?.fields || {}, c = String(t.blockId || t._instanceId || (t.id && !String(t.id).startsWith("ast_") ? t.id : null) || e.blockId || e.id), l = Xi(t, s);
|
|
12289
|
+
u.push({
|
|
12290
|
+
original: e,
|
|
12291
|
+
data: l,
|
|
12292
|
+
compId: o,
|
|
12293
|
+
resolvedBlockId: c
|
|
12294
|
+
});
|
|
12294
12295
|
}
|
|
12295
|
-
|
|
12296
|
-
|
|
12297
|
-
let
|
|
12298
|
-
|
|
12299
|
-
|
|
12300
|
-
|
|
12301
|
-
|
|
12302
|
-
|
|
12303
|
-
|
|
12304
|
-
|
|
12305
|
-
|
|
12306
|
-
|
|
12307
|
-
|
|
12308
|
-
|
|
12309
|
-
|
|
12310
|
-
|
|
12311
|
-
|
|
12296
|
+
let d = u.map((e) => e.data);
|
|
12297
|
+
d.length > 0 && (d = await Xr(e, d), d = Zi(d), a && (d = await Qi(e, d, a)));
|
|
12298
|
+
let m = {};
|
|
12299
|
+
for (let e = 0; e < u.length; e++) {
|
|
12300
|
+
let t = u[e], r = d[e];
|
|
12301
|
+
r.blockId = t.resolvedBlockId;
|
|
12302
|
+
let i = t.original.region || n;
|
|
12303
|
+
m[i] || (m[i] = []), m[i].push({
|
|
12304
|
+
instanceId: t.original.id,
|
|
12305
|
+
blockId: t.resolvedBlockId,
|
|
12306
|
+
componentId: t.compId,
|
|
12307
|
+
data: r
|
|
12308
|
+
});
|
|
12309
|
+
}
|
|
12310
|
+
if (m[n] && m[n].length > 0) return {
|
|
12311
|
+
blocks: m[n],
|
|
12312
|
+
subRegions: m,
|
|
12313
|
+
inheritedFromId: String(t.contentId),
|
|
12314
|
+
inheritedFromTitle: t.title || t.slug
|
|
12312
12315
|
};
|
|
12313
|
-
}
|
|
12314
|
-
|
|
12315
|
-
|
|
12316
|
-
blocks: l[n],
|
|
12317
|
-
subRegions: l,
|
|
12318
|
-
inheritedFromId: String(t.contentId),
|
|
12319
|
-
inheritedFromTitle: t.title || t.slug
|
|
12320
|
-
};
|
|
12316
|
+
}
|
|
12317
|
+
} catch (e) {
|
|
12318
|
+
console.error("[CMS Public API] resolveParentBlocks error:", e);
|
|
12321
12319
|
}
|
|
12322
12320
|
return { blocks: [] };
|
|
12323
12321
|
}
|
|
@@ -12366,9 +12364,9 @@ async function Qi(e, t, n) {
|
|
|
12366
12364
|
for (let e of t.matchAll(/(?:#node:|data-node-id\s*=\s*["'])([^"'\s>]+)/gi)) i.add(e[1]);
|
|
12367
12365
|
for (let e of t.matchAll(/(?:#asset:|data-asset-id\s*=\s*["'])([^"'\s>]+)/gi)) a.add(e[1]);
|
|
12368
12366
|
if (i.size === 0 && a.size === 0) return t;
|
|
12369
|
-
let o = i.size > 0 ?
|
|
12367
|
+
let o = i.size > 0 ? await Promise.resolve(e.prepare(`SELECT id, slug FROM content_nodes WHERE id IN (${Array.from(i).map(() => "?").join(",")})`).all(...Array.from(i))) : [], s = /* @__PURE__ */ new Map();
|
|
12370
12368
|
for (let e of o) s.set(String(e.id), String(e.slug || "").replace(/^\/+|\/+$/g, ""));
|
|
12371
|
-
let c = a.size > 0 ?
|
|
12369
|
+
let c = a.size > 0 ? await Promise.resolve(e.prepare(`SELECT id, cdnUrl, storageKeyPrivate FROM assets WHERE id IN (${Array.from(a).map(() => "?").join(",")})`).all(...Array.from(a))) : [], l = /* @__PURE__ */ new Map();
|
|
12372
12370
|
for (let e of c) l.set(String(e.id), e.cdnUrl || (e.storageKeyPrivate ? `/media/${e.storageKeyPrivate}` : ""));
|
|
12373
12371
|
let u = /* @__PURE__ */ new Map(), d = /<a\s+([^>]+)>/gi;
|
|
12374
12372
|
return await Promise.all(Array.from(t.matchAll(d)).map(async (t) => {
|
|
@@ -12427,14 +12425,14 @@ async function $i(e, t, n) {
|
|
|
12427
12425
|
async function ea(e, t, n, r) {
|
|
12428
12426
|
let i = Gi(t, n);
|
|
12429
12427
|
if (r.treeEdges.has(i)) return r.treeEdges.get(i);
|
|
12430
|
-
let a = e.prepare("SELECT id as treeNodeId FROM tree_nodes WHERE contentId = ? AND treeId = ? LIMIT 1").get(t, n);
|
|
12431
|
-
return r.treeEdges.set(i,
|
|
12428
|
+
let a = Promise.resolve(e.prepare("SELECT id as treeNodeId FROM tree_nodes WHERE contentId = ? AND treeId = ? LIMIT 1").get(t, n));
|
|
12429
|
+
return r.treeEdges.set(i, a), a;
|
|
12432
12430
|
}
|
|
12433
12431
|
async function ta(e, t, n) {
|
|
12434
12432
|
let r = String(t);
|
|
12435
12433
|
if (n.nodeSlugs.has(r)) return n.nodeSlugs.get(r);
|
|
12436
12434
|
let i = (async () => {
|
|
12437
|
-
let n = await e.prepare("SELECT slug FROM content_nodes WHERE id = ?").get(t);
|
|
12435
|
+
let n = await Promise.resolve(e.prepare("SELECT slug FROM content_nodes WHERE id = ?").get(t));
|
|
12438
12436
|
return n?.slug ? String(n.slug).replace(/^\/+|\/+$/g, "") : void 0;
|
|
12439
12437
|
})();
|
|
12440
12438
|
return n.nodeSlugs.set(r, i), i;
|
|
@@ -12443,7 +12441,7 @@ async function na(e, t, n) {
|
|
|
12443
12441
|
let r = String(t);
|
|
12444
12442
|
if (n.assetUrls.has(r)) return n.assetUrls.get(r);
|
|
12445
12443
|
let i = (async () => {
|
|
12446
|
-
let n = await e.prepare("SELECT cdnUrl, storageKeyPrivate FROM assets WHERE id = ?").get(t);
|
|
12444
|
+
let n = await Promise.resolve(e.prepare("SELECT cdnUrl, storageKeyPrivate FROM assets WHERE id = ?").get(t));
|
|
12447
12445
|
return n?.cdnUrl || (n?.storageKeyPrivate ? `/media/${n.storageKeyPrivate}` : "#");
|
|
12448
12446
|
})();
|
|
12449
12447
|
return n.assetUrls.set(r, i), i;
|
|
@@ -12480,23 +12478,29 @@ function ra(e) {
|
|
|
12480
12478
|
};
|
|
12481
12479
|
}
|
|
12482
12480
|
async function ia(e, t, n, r) {
|
|
12483
|
-
if (!t) return "";
|
|
12481
|
+
if (!t || t === "0" || t === "null") return "/home";
|
|
12484
12482
|
let i = Gi(t, n);
|
|
12485
12483
|
if (r && r.fullPath.has(i)) return r.fullPath.get(i);
|
|
12486
12484
|
let a = (async () => {
|
|
12487
|
-
|
|
12488
|
-
|
|
12489
|
-
|
|
12490
|
-
|
|
12485
|
+
try {
|
|
12486
|
+
let r = await Promise.resolve(e.prepare("\n WITH RECURSIVE ancestor_path(id, parentId, slug, level) AS (\n SELECT t.id, t.parentId, c.slug, 0 \n FROM tree_nodes t \n INNER JOIN content_nodes c ON t.contentId = c.id \n WHERE t.id = ? AND t.treeId = ?\n \n UNION ALL\n \n SELECT t.id, t.parentId, c.slug, 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 WHERE t.treeId = ? \n AND ap.parentId IS NOT NULL \n AND ap.parentId != 0 \n AND ap.parentId != '0'\n AND ap.parentId != 'null' \n AND ap.level < 20\n ) SELECT slug FROM ancestor_path ORDER BY level DESC\n ").all(t, n, n));
|
|
12487
|
+
if (!r || r.length === 0) return "/home";
|
|
12488
|
+
let i = [];
|
|
12489
|
+
for (let e of r) {
|
|
12490
|
+
let t = (e.slug || "").replace(/^\/+|\/+$/g, "");
|
|
12491
|
+
t && i.push(t);
|
|
12492
|
+
}
|
|
12493
|
+
return "/" + i.join("/");
|
|
12494
|
+
} catch (e) {
|
|
12495
|
+
return console.error("[CMS Public API] resolveNodeFullPath error:", e), "/home";
|
|
12491
12496
|
}
|
|
12492
|
-
return "/" + a.join("/");
|
|
12493
12497
|
})();
|
|
12494
12498
|
return r && r.fullPath.set(i, a), a;
|
|
12495
12499
|
}
|
|
12496
12500
|
async function aa(e, t, n, r, i) {
|
|
12497
12501
|
let a = {}, o = null;
|
|
12498
|
-
if (t) {
|
|
12499
|
-
let n = await e.prepare("\n
|
|
12502
|
+
if (t && t !== "0" && t !== 0 && t !== "null") try {
|
|
12503
|
+
let n = await Promise.resolve(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 WHERE ap.parentId IS NOT NULL AND ap.parentId != 0 AND ap.parentId != '0' AND ap.parentId != 'null' AND ap.level < 20\n ) SELECT c.dataJson, c.draftDataJson FROM ancestor_path ap INNER JOIN content_nodes c ON ap.contentId = c.id ORDER BY ap.level ASC\n ").all(t, t)), i = /* @__PURE__ */ new Set([
|
|
12500
12504
|
"subpageLayoutId",
|
|
12501
12505
|
"layoutId",
|
|
12502
12506
|
"slug",
|
|
@@ -12510,22 +12514,24 @@ async function aa(e, t, n, r, i) {
|
|
|
12510
12514
|
"hidden",
|
|
12511
12515
|
"status"
|
|
12512
12516
|
]);
|
|
12513
|
-
for (let e of
|
|
12517
|
+
for (let e of n) {
|
|
12514
12518
|
let t = r && e.draftDataJson ? e.draftDataJson : e.dataJson || e.draftDataJson;
|
|
12515
12519
|
if (t) try {
|
|
12516
12520
|
let e = typeof t == "string" ? JSON.parse(t) : t;
|
|
12517
12521
|
!o && e.subpageLayoutId && e.subpageLayoutId !== "inherit" && (o = e.subpageLayoutId);
|
|
12518
|
-
for (let [t, n] of Object.entries(e)) n != null && n !== "" && n !== "inherit" && !
|
|
12522
|
+
for (let [t, n] of Object.entries(e)) n != null && n !== "" && n !== "inherit" && !i.has(t) && !t.startsWith("_") && a[t] === void 0 && (a[t] = n);
|
|
12519
12523
|
} catch {}
|
|
12520
12524
|
}
|
|
12525
|
+
} catch (e) {
|
|
12526
|
+
console.error("[CMS Public API] resolveInheritedNodeData error:", e);
|
|
12521
12527
|
}
|
|
12522
|
-
if (!o) {
|
|
12523
|
-
let t = await e.prepare("SELECT dataJson FROM trees WHERE id = ?").get(n);
|
|
12528
|
+
if (!o) try {
|
|
12529
|
+
let t = await Promise.resolve(e.prepare("SELECT dataJson FROM trees WHERE id = ?").get(n));
|
|
12524
12530
|
if (t?.dataJson) try {
|
|
12525
12531
|
let e = typeof t.dataJson == "string" ? JSON.parse(t.dataJson) : t.dataJson;
|
|
12526
12532
|
e.subpageLayoutId && e.subpageLayoutId !== "inherit" && (o = e.subpageLayoutId);
|
|
12527
12533
|
} catch {}
|
|
12528
|
-
}
|
|
12534
|
+
} catch {}
|
|
12529
12535
|
return {
|
|
12530
12536
|
resolvedLayoutId: o,
|
|
12531
12537
|
inheritedFields: a
|
|
@@ -12537,7 +12543,7 @@ function oa(e) {
|
|
|
12537
12543
|
}
|
|
12538
12544
|
Hi.get("/*", async (e) => {
|
|
12539
12545
|
try {
|
|
12540
|
-
let t = e.get("db"), n = Wi(), 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));
|
|
12546
|
+
let t = e.get("db"), n = Wi(), 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 Promise.resolve(t.prepare("SELECT * FROM channels WHERE key = ?").get(a)) : await Promise.resolve(t.prepare("SELECT * FROM channels WHERE id = ?").get(Number(a)));
|
|
12541
12547
|
if (!c) return e.json({ error: `Channel '${a}' not found` }, 404);
|
|
12542
12548
|
let l = c.status === "disabled" || c.status === "inactive" || c.isEnabled === 0 || c.isEnabled === !1;
|
|
12543
12549
|
if (!s && l) return e.json({ error: `Channel '${c.key || a}' is currently inactive` }, 404);
|
|
@@ -12552,108 +12558,120 @@ Hi.get("/*", async (e) => {
|
|
|
12552
12558
|
INNER JOIN tree_nodes tn ON cn.id = tn.contentId
|
|
12553
12559
|
${u === null ? "" : "INNER JOIN node_channels nc ON cn.id = nc.nodeId"}
|
|
12554
12560
|
WHERE cn.slug = ? ${u === null ? "" : "AND nc.channelId = ?"}
|
|
12555
|
-
`, w = u === null ? [x] : [x, u], T = await t.prepare(C).all(...w)
|
|
12556
|
-
if (
|
|
12557
|
-
let e = await Promise.all(
|
|
12561
|
+
`, w = u === null ? [x] : [x, u], T = await Promise.resolve(t.prepare(C).all(...w));
|
|
12562
|
+
if (T.length > 0) {
|
|
12563
|
+
let e = await Promise.all(T.map(async (e) => ({
|
|
12558
12564
|
candidate: e,
|
|
12559
12565
|
calculatedPath: await ia(t, String(e.treeNodeId), String(e.treeId), n)
|
|
12560
12566
|
}))), r = S.replace(/^\/+|\/+$/g, "");
|
|
12561
12567
|
for (let { candidate: t, calculatedPath: n } of e) {
|
|
12562
12568
|
let e = n.replace(/^\/+|\/+$/g, "");
|
|
12563
|
-
if (e === r || r === "home" && (e === "" || e === "
|
|
12569
|
+
if (e === r || (r === "home" || r === "") && (e === "home" || e === "" || e === "/")) {
|
|
12564
12570
|
_ = t, v = t;
|
|
12565
12571
|
break;
|
|
12566
12572
|
}
|
|
12567
12573
|
}
|
|
12568
12574
|
}
|
|
12569
|
-
if (!_ && b.length === 1 && (_ = u === null ? await t.prepare("SELECT * FROM content_nodes WHERE slug = ?").get(x) : await t.prepare("SELECT cn.* FROM content_nodes cn INNER JOIN node_channels nc ON cn.id = nc.nodeId WHERE cn.slug = ? AND nc.channelId = ?").get(x, u)), !_ && g && (_ = u === null ? await t.prepare("SELECT * FROM content_nodes WHERE id = ?").get(Number(i)) : await t.prepare("SELECT cn.* FROM content_nodes cn INNER JOIN node_channels nc ON cn.id = nc.nodeId WHERE cn.id = ? AND nc.channelId = ?").get(Number(i), u)), !_) return e.json({ error: `Node '${i}' not found for Channel '${a}'` }, 404);
|
|
12575
|
+
if (!_ && b.length === 1 && (_ = u === null ? await Promise.resolve(t.prepare("SELECT * FROM content_nodes WHERE slug = ?").get(x)) : await Promise.resolve(t.prepare("SELECT cn.* FROM content_nodes cn INNER JOIN node_channels nc ON cn.id = nc.nodeId WHERE cn.slug = ? AND nc.channelId = ?").get(x, u))), !_ && g && (_ = u === null ? await Promise.resolve(t.prepare("SELECT * FROM content_nodes WHERE id = ?").get(Number(i))) : await Promise.resolve(t.prepare("SELECT cn.* FROM content_nodes cn INNER JOIN node_channels nc ON cn.id = nc.nodeId WHERE cn.id = ? AND nc.channelId = ?").get(Number(i), u))), !_) return e.json({ error: `Node '${i}' not found for Channel '${a}'` }, 404);
|
|
12570
12576
|
if (!v) {
|
|
12571
|
-
let e = y ? [_.id, y] : [_.id];
|
|
12572
|
-
v = await t.prepare(
|
|
12577
|
+
let e = `SELECT id as treeNodeId, treeId, parentId FROM tree_nodes WHERE contentId = ? ${y ? "AND treeId = ?" : ""} LIMIT 1`, n = y ? [_.id, y] : [_.id];
|
|
12578
|
+
v = await Promise.resolve(t.prepare(e).get(...n));
|
|
12573
12579
|
}
|
|
12574
|
-
let
|
|
12575
|
-
if (
|
|
12576
|
-
k = typeof
|
|
12580
|
+
let E = v?.treeId || y || "main-nav", D = v?.parentId || null, O = v?.treeNodeId ? await ia(t, String(v.treeNodeId), String(E), n) : `/${(_.slug || "").replace(/^\/+|\/+$/g, "")}`, k = {}, ee = s && _.draftDataJson ? _.draftDataJson : _.dataJson || _.draftDataJson;
|
|
12581
|
+
if (ee) try {
|
|
12582
|
+
k = typeof ee == "string" ? JSON.parse(ee) : ee;
|
|
12577
12583
|
} catch {}
|
|
12578
|
-
let
|
|
12579
|
-
|
|
12580
|
-
Object.assign(
|
|
12584
|
+
let te = k.nodeType || k.contentType || _.contentType || "page", ne = _.contentType || "node", re = h.nodes?.[ne] || Object.values(h.nodes || {})[0] || {}, A = { ...re.fields || {} };
|
|
12585
|
+
re.tabs && Object.values(re.tabs).forEach((e) => {
|
|
12586
|
+
Object.assign(A, e.fields || {});
|
|
12581
12587
|
});
|
|
12582
|
-
let ie = +!!s,
|
|
12583
|
-
|
|
12584
|
-
|
|
12585
|
-
|
|
12586
|
-
|
|
12588
|
+
let ie = +!!s, ae = s ? "COALESCE(c.draftDataJson, c.dataJson, '{}')" : "COALESCE(c.dataJson, c.draftDataJson, '{}')", oe = `
|
|
12589
|
+
SELECT t.id as treeNodeId, t.contentId as id, c.title, c.slug, c.language, c.contentType as nodeType, c.isHidden,
|
|
12590
|
+
json_extract(${ae}, '$.hidden') as extHidden,
|
|
12591
|
+
json_extract(${ae}, '$.startShowingAt') as extStart,
|
|
12592
|
+
json_extract(${ae}, '$.stopShowingAt') as extStop
|
|
12593
|
+
FROM tree_nodes t
|
|
12594
|
+
INNER JOIN content_nodes c ON t.contentId = c.id
|
|
12595
|
+
WHERE t.parentId = ? AND t.treeId = ?
|
|
12596
|
+
ORDER BY t.sortOrder ASC
|
|
12597
|
+
`, [se, ce, j] = await Promise.all([
|
|
12598
|
+
aa(t, D, E, s, A),
|
|
12599
|
+
v?.treeNodeId ? Promise.resolve(t.prepare(oe).all(v.treeNodeId, E)) : Promise.resolve([]),
|
|
12600
|
+
Promise.resolve(t.prepare("SELECT * FROM content_blocks WHERE contentId = ? AND isDraft = ? ORDER BY sortOrder ASC").all(_.id, ie))
|
|
12601
|
+
]), { resolvedLayoutId: le, inheritedFields: ue } = se, M = {
|
|
12587
12602
|
id: _.id,
|
|
12588
12603
|
title: _.title,
|
|
12589
12604
|
slug: _.slug,
|
|
12590
|
-
path:
|
|
12591
|
-
nodeType:
|
|
12605
|
+
path: O === "" ? "/" : O,
|
|
12606
|
+
nodeType: te,
|
|
12592
12607
|
createdAt: Ki(_.createdAt),
|
|
12593
12608
|
updatedAt: Ki(_.updatedAt),
|
|
12594
12609
|
publishedAt: Ki(k.publishedAt || _.createdAt)
|
|
12595
|
-
},
|
|
12596
|
-
|
|
12597
|
-
let
|
|
12598
|
-
if (
|
|
12599
|
-
else if (!
|
|
12610
|
+
}, de = k.disabledRegions || {}, N = k.hidden === !0 || k.hidden === 1 || k.hidden === "1" || k.hidden === "true", fe = k.startShowingAt || null, pe = k.stopShowingAt || null, P = Xi(k, A), me = P.layoutId || null, he = me && me !== "inherit", ge = !1, _e = null;
|
|
12611
|
+
A.layoutId && (ge = !0, A.layoutId.options && Array.isArray(A.layoutId.options) && (_e = A.layoutId.options.map((e) => typeof e == "object" ? e.value || e.id : e)));
|
|
12612
|
+
let F = null;
|
|
12613
|
+
if (ge && _e && _e.length === 1 && _e[0] !== "inherit") F = _e[0];
|
|
12614
|
+
else if (!ge && re.defaultLayout) F = re.defaultLayout;
|
|
12600
12615
|
else {
|
|
12601
|
-
let e =
|
|
12602
|
-
|
|
12603
|
-
}
|
|
12604
|
-
for (let [e, t] of Object.entries(
|
|
12605
|
-
let
|
|
12606
|
-
I = Zi(I), I = await Qi(t, I, n);
|
|
12607
|
-
let _e = ra(I);
|
|
12608
|
-
delete I.socialImage, delete I.fbImage, delete I.xImage, delete I.whatsappImage, _e && (I.socialImages = _e), delete I.id, delete I.title, delete I.slug, delete I.language, delete I.contentType, delete I.nodeType, delete I.createdAt, delete I.updatedAt, delete I.publishedAt, delete I.channelId, delete I.treeId, delete I.path, I.iconName === "" && (I.iconName = null), Object.assign(N, I), A.hasCanvas && (N.layoutId = ge);
|
|
12609
|
-
let ve = Number(_.isHidden) === 1 || ue, ye = !qi(P, de);
|
|
12616
|
+
let e = he ? me : le;
|
|
12617
|
+
F = e && e !== "inherit" && (!_e || _e.includes(e) || _e.includes("inherit")) ? e : re.defaultLayout || null;
|
|
12618
|
+
}
|
|
12619
|
+
for (let [e, t] of Object.entries(ue)) A[e] && (P[e] === void 0 || P[e] === null || P[e] === "" || P[e] === "inherit") && t !== void 0 && (P[e] = t);
|
|
12620
|
+
let ve = Number(_.isHidden) === 1 || N, ye = !qi(fe, pe);
|
|
12610
12621
|
if (!s && (ve || ye)) return e.json({ error: "Node is hidden or outside its scheduled publishing window" }, 404);
|
|
12611
12622
|
let be = [];
|
|
12612
12623
|
if (v?.treeNodeId) {
|
|
12613
|
-
let e =
|
|
12614
|
-
be =
|
|
12615
|
-
let n =
|
|
12616
|
-
|
|
12617
|
-
|
|
12618
|
-
|
|
12619
|
-
|
|
12620
|
-
|
|
12621
|
-
|
|
12622
|
-
|
|
12623
|
-
|
|
12624
|
-
slug: o,
|
|
12625
|
-
language: e.language || "en",
|
|
12626
|
-
path: `${t}/${o}`.replace(/\/+/g, "/"),
|
|
12627
|
-
nodeType: e.nodeType
|
|
12624
|
+
let e = M.path === "/" ? "" : M.path;
|
|
12625
|
+
be = (ce || []).map((t) => {
|
|
12626
|
+
let n = Number(t.isHidden) === 1 || t.extHidden === 1 || t.extHidden === "1" || t.extHidden === "true" || t.extHidden === !0, r = qi(t.extStart, t.extStop), i = (t.slug || "").replace(/^\/+|\/+$/g, "");
|
|
12627
|
+
return !s && (n || !r) ? null : {
|
|
12628
|
+
treeNodeId: t.treeNodeId,
|
|
12629
|
+
id: t.id,
|
|
12630
|
+
title: t.title,
|
|
12631
|
+
slug: i,
|
|
12632
|
+
language: t.language || "en",
|
|
12633
|
+
path: `${e}/${i}`.replace(/\/+/g, "/"),
|
|
12634
|
+
nodeType: t.nodeType
|
|
12628
12635
|
};
|
|
12629
12636
|
}).filter(Boolean);
|
|
12630
12637
|
}
|
|
12631
|
-
|
|
12632
|
-
let xe =
|
|
12633
|
-
|
|
12634
|
-
|
|
12635
|
-
|
|
12636
|
-
|
|
12637
|
-
let L = {}, R = {}, Se = await Promise.all(xe.map(async (e) => {
|
|
12638
|
-
let r = e.region || "main", i = {};
|
|
12638
|
+
M.children = be;
|
|
12639
|
+
let xe = j || [];
|
|
12640
|
+
xe.length === 0 && !s && (xe = await Promise.resolve(t.prepare("SELECT * FROM content_blocks WHERE contentId = ? ORDER BY sortOrder ASC").all(_.id)));
|
|
12641
|
+
let I = {}, Se = {}, Ce = [];
|
|
12642
|
+
for (let e of xe) {
|
|
12643
|
+
let t = e.region || "main", n = {};
|
|
12639
12644
|
try {
|
|
12640
|
-
|
|
12645
|
+
n = (typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson) || {};
|
|
12641
12646
|
} catch {}
|
|
12642
|
-
let
|
|
12643
|
-
if (!s && (
|
|
12644
|
-
let
|
|
12645
|
-
|
|
12646
|
-
|
|
12647
|
-
|
|
12648
|
-
|
|
12649
|
-
|
|
12650
|
-
|
|
12651
|
-
|
|
12652
|
-
|
|
12653
|
-
|
|
12654
|
-
|
|
12655
|
-
|
|
12656
|
-
|
|
12647
|
+
let r = n.hidden === !0 || n.hidden === 1 || n.hidden === "1" || n.hidden === "true", i = qi(n.startShowingAt, n.stopShowingAt);
|
|
12648
|
+
if (!s && (r || !i)) continue;
|
|
12649
|
+
let a = e.elementType || e.componentId || "text-block", o = h.blocks?.[a]?.fields || h.elements?.[a]?.fields || h.components?.[a]?.fields || {}, c = String(n.blockId || n._instanceId || (n.id && !String(n.id).startsWith("ast_") ? n.id : null) || e.blockId || e.id), l = Xi(n, o);
|
|
12650
|
+
Ce.push({
|
|
12651
|
+
original: e,
|
|
12652
|
+
region: t,
|
|
12653
|
+
data: l,
|
|
12654
|
+
compId: a,
|
|
12655
|
+
resolvedBlockId: c
|
|
12656
|
+
});
|
|
12657
|
+
}
|
|
12658
|
+
let L = await Xr(t, {
|
|
12659
|
+
node: P,
|
|
12660
|
+
blocks: Ce.map((e) => e.data)
|
|
12661
|
+
});
|
|
12662
|
+
L = Zi(L), L = await Qi(t, L, n);
|
|
12663
|
+
let R = L.node, we = ra(R);
|
|
12664
|
+
delete R.socialImage, delete R.fbImage, delete R.xImage, delete R.whatsappImage, we && (R.socialImages = we), delete R.id, delete R.title, delete R.slug, delete R.language, delete R.contentType, delete R.nodeType, delete R.createdAt, delete R.updatedAt, delete R.publishedAt, delete R.channelId, delete R.treeId, delete R.path, R.iconName === "" && (R.iconName = null), Object.assign(M, R), re.hasCanvas && (M.layoutId = F);
|
|
12665
|
+
for (let e = 0; e < Ce.length; e++) {
|
|
12666
|
+
let t = Ce[e], n = L.blocks[e];
|
|
12667
|
+
n.blockId = t.resolvedBlockId, I[t.region] || (I[t.region] = [], Se[t.region] = { isInherited: !1 }), I[t.region].push({
|
|
12668
|
+
instanceId: t.original.id,
|
|
12669
|
+
blockId: t.resolvedBlockId,
|
|
12670
|
+
componentId: t.compId,
|
|
12671
|
+
data: n
|
|
12672
|
+
});
|
|
12673
|
+
}
|
|
12674
|
+
let Te = {
|
|
12657
12675
|
header: {
|
|
12658
12676
|
label: "Header",
|
|
12659
12677
|
inherit: "parent"
|
|
@@ -12662,33 +12680,33 @@ Hi.get("/*", async (e) => {
|
|
|
12662
12680
|
label: "Footer",
|
|
12663
12681
|
inherit: "parent"
|
|
12664
12682
|
},
|
|
12665
|
-
...(
|
|
12683
|
+
...(F ? h.nodeLayouts?.[F] || h.layouts?.[F] : null)?.regions || { main: { label: "Content" } }
|
|
12666
12684
|
};
|
|
12667
|
-
for (let [e, r] of Object.entries(
|
|
12668
|
-
let i =
|
|
12669
|
-
if (
|
|
12670
|
-
let r = await Yi(t,
|
|
12671
|
-
if (r.blocks.length > 0 && (
|
|
12685
|
+
for (let [e, r] of Object.entries(Te)) {
|
|
12686
|
+
let i = I[e] && I[e].length > 0, a = !!de[e];
|
|
12687
|
+
if (I[e] || (I[e] = [], Se[e] = { isInherited: !1 }), (r?.inherit === "parent" || r?.inherit === !0 || r?.inherit === "true" || e === "header" || e === "footer") && !i && !a && D) {
|
|
12688
|
+
let r = await Yi(t, D, e, h, s, n);
|
|
12689
|
+
if (r.blocks.length > 0 && (I[e] = r.blocks, Se[e] = {
|
|
12672
12690
|
isInherited: !0,
|
|
12673
12691
|
inheritedFromId: r.inheritedFromId,
|
|
12674
12692
|
inheritedFromTitle: r.inheritedFromTitle
|
|
12675
|
-
}, r.subRegions)) for (let [t, n] of Object.entries(r.subRegions)) t !== e && (
|
|
12693
|
+
}, r.subRegions)) for (let [t, n] of Object.entries(r.subRegions)) t !== e && (I[t] = n, Se[t] = {
|
|
12676
12694
|
isInherited: !0,
|
|
12677
12695
|
inheritedFromId: r.inheritedFromId,
|
|
12678
12696
|
inheritedFromTitle: r.inheritedFromTitle
|
|
12679
12697
|
});
|
|
12680
12698
|
}
|
|
12681
12699
|
}
|
|
12682
|
-
await Promise.all(Object.keys(
|
|
12683
|
-
let
|
|
12700
|
+
await Promise.all(Object.keys(I).map((e) => Ji(t, I[e], u)));
|
|
12701
|
+
let Ee = {
|
|
12684
12702
|
channelId: u || d,
|
|
12685
|
-
treeId:
|
|
12703
|
+
treeId: E,
|
|
12686
12704
|
language: _.language || o || "en",
|
|
12687
|
-
node:
|
|
12688
|
-
content:
|
|
12689
|
-
regionMeta:
|
|
12705
|
+
node: M,
|
|
12706
|
+
content: I,
|
|
12707
|
+
regionMeta: Se
|
|
12690
12708
|
};
|
|
12691
|
-
return !s && !m ? (e.header("X-Cache", "MISS"), Ui(e, f.set(p,
|
|
12709
|
+
return !s && !m ? (e.header("X-Cache", "MISS"), Ui(e, f.set(p, Ee, oa(e)))) : e.header("Cache-Control", "no-store, no-cache, must-revalidate"), e.json(Ee);
|
|
12692
12710
|
} catch (t) {
|
|
12693
12711
|
console.error("[CMS Public API] Error fetching node by path:", t);
|
|
12694
12712
|
let n = e.env?.ENVIRONMENT === "development";
|
|
@@ -12708,18 +12726,25 @@ function ca(e, t) {
|
|
|
12708
12726
|
} catch {}
|
|
12709
12727
|
}
|
|
12710
12728
|
async function la(e, t, n = []) {
|
|
12711
|
-
|
|
12712
|
-
|
|
12713
|
-
|
|
12714
|
-
|
|
12715
|
-
|
|
12716
|
-
|
|
12717
|
-
|
|
12718
|
-
|
|
12729
|
+
try {
|
|
12730
|
+
let r = e.prepare(t);
|
|
12731
|
+
if (typeof r.bind == "function") {
|
|
12732
|
+
let e = await r.bind(...n).all();
|
|
12733
|
+
return Array.isArray(e) ? e : e?.results || [];
|
|
12734
|
+
}
|
|
12735
|
+
if (typeof r.all == "function") {
|
|
12736
|
+
let e = await r.all(...n);
|
|
12737
|
+
return Array.isArray(e) ? e : e?.results || [];
|
|
12738
|
+
}
|
|
12739
|
+
return [];
|
|
12740
|
+
} catch (e) {
|
|
12741
|
+
return console.error("[Public Tree DB Error]:", e, "SQL:", t, "Params:", n), [];
|
|
12719
12742
|
}
|
|
12720
|
-
return [];
|
|
12721
12743
|
}
|
|
12722
|
-
function ua(e, t) {
|
|
12744
|
+
async function ua(e, t, n = []) {
|
|
12745
|
+
return (await la(e, t, n))[0] || null;
|
|
12746
|
+
}
|
|
12747
|
+
function da(e, t) {
|
|
12723
12748
|
let n = /* @__PURE__ */ new Date();
|
|
12724
12749
|
if (e && String(e).trim() !== "") {
|
|
12725
12750
|
let t = new Date(e);
|
|
@@ -12735,7 +12760,7 @@ sa.get("/:treeParam", async (e) => {
|
|
|
12735
12760
|
try {
|
|
12736
12761
|
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";
|
|
12737
12762
|
if (r && r !== "default" && r !== "all") {
|
|
12738
|
-
let n =
|
|
12763
|
+
let n = isNaN(Number(r)) ? await ua(t, "SELECT * FROM channels WHERE key = ?", [r]) : await ua(t, "SELECT * FROM channels WHERE id = ?", [Number(r)]);
|
|
12739
12764
|
if (n) {
|
|
12740
12765
|
let t = n.status === "disabled" || n.status === "inactive" || n.isEnabled === 0 || n.isEnabled === !1;
|
|
12741
12766
|
if (!i && t) return e.json({ error: `Channel '${n.key || r}' is currently inactive` }, 404);
|
|
@@ -12746,7 +12771,7 @@ sa.get("/:treeParam", async (e) => {
|
|
|
12746
12771
|
let t = await a.get(o);
|
|
12747
12772
|
if (t) return e.header("X-Cache", "HIT"), e.json(t);
|
|
12748
12773
|
}
|
|
12749
|
-
let c = !isNaN(Number(n)), l = c ? Number(n) : n, u =
|
|
12774
|
+
let c = !isNaN(Number(n)), l = c ? Number(n) : n, u = await ua(t, `SELECT * FROM trees WHERE ${c ? "id" : "key"} = ?`, [l]), d = i ? "COALESCE(c.draftDataJson, c.dataJson, '{}')" : "COALESCE(c.dataJson, c.draftDataJson, '{}')", f = await la(t, `
|
|
12750
12775
|
SELECT
|
|
12751
12776
|
t.id as treeNodeId,
|
|
12752
12777
|
t.treeId,
|
|
@@ -12788,7 +12813,7 @@ sa.get("/:treeParam", async (e) => {
|
|
|
12788
12813
|
function h(e = null, t = "") {
|
|
12789
12814
|
let n = e == null || e === "" || e === "null" ? "__ROOT__" : String(e);
|
|
12790
12815
|
return (m.get(n) || []).map((e) => {
|
|
12791
|
-
let n = !i && (e.status === "draft" || e.status === "new"), r = e.extHidden === 1 || e.extHidden === !0 || e.extHidden === "true" || e.extHidden === "1", a = Number(e.isHidden) === 1 || n || r, o =
|
|
12816
|
+
let n = !i && (e.status === "draft" || e.status === "new"), r = e.extHidden === 1 || e.extHidden === !0 || e.extHidden === "true" || e.extHidden === "1", a = Number(e.isHidden) === 1 || n || r, o = da(e.extStart, e.extStop), s = (e.slug || "").replace(/^\/+|\/+$/g, ""), c = (!e.parentId || e.parentId === "null" || e.parentId === "") && (s === "home" || s === "homee") ? "/" : `${t}/${s}`.replace(/\/+/g, "/"), l = {
|
|
12792
12817
|
id: e.id,
|
|
12793
12818
|
treeNodeId: e.treeNodeId,
|
|
12794
12819
|
parentId: e.parentId || null,
|
|
@@ -12823,8 +12848,8 @@ sa.get("/:treeParam", async (e) => {
|
|
|
12823
12848
|
});
|
|
12824
12849
|
//#endregion
|
|
12825
12850
|
//#region server/routes/public/assets.ts
|
|
12826
|
-
var
|
|
12827
|
-
function
|
|
12851
|
+
var fa = new n();
|
|
12852
|
+
function pa(e, t) {
|
|
12828
12853
|
if (t === "webp") return "image/webp";
|
|
12829
12854
|
if (t === "avif") return "image/avif";
|
|
12830
12855
|
if (t === "jpeg" || t === "jpg") return "image/jpeg";
|
|
@@ -12832,7 +12857,7 @@ function fa(e, t) {
|
|
|
12832
12857
|
let n = e.toLowerCase();
|
|
12833
12858
|
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";
|
|
12834
12859
|
}
|
|
12835
|
-
|
|
12860
|
+
fa.get("/*", async (e) => {
|
|
12836
12861
|
let t = e.req.path.replace(/^\/media\//, "").replace(/^\//, "");
|
|
12837
12862
|
if (!t) return e.text("Asset key missing", 400);
|
|
12838
12863
|
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 = "";
|
|
@@ -12849,7 +12874,7 @@ da.get("/*", async (e) => {
|
|
|
12849
12874
|
}
|
|
12850
12875
|
let p = e.req.header("Via")?.includes("image-resizing") || e.req.header("User-Agent")?.includes("Cloudflare-ImgRen"), m = new URL(e.req.url), h = e.env?.CDN_DOMAIN || m.hostname;
|
|
12851
12876
|
if (n) {
|
|
12852
|
-
let l =
|
|
12877
|
+
let l = pa(t), u = l.startsWith("image/") && !l.includes("svg");
|
|
12853
12878
|
if (s && u && h && !p) {
|
|
12854
12879
|
let e = r ? parseInt(r, 10) : void 0, n = i ? parseInt(i, 10) : void 0, s = a ? parseInt(a, 10) : 85, l = o || "auto", u = `https://${h}/media/${t}`;
|
|
12855
12880
|
try {
|
|
@@ -12892,7 +12917,7 @@ da.get("/*", async (e) => {
|
|
|
12892
12917
|
if (!s) {
|
|
12893
12918
|
let n = _(C);
|
|
12894
12919
|
return e.body(n, 200, {
|
|
12895
|
-
"Content-Type":
|
|
12920
|
+
"Content-Type": pa(t),
|
|
12896
12921
|
"Cache-Control": "public, max-age=86400"
|
|
12897
12922
|
});
|
|
12898
12923
|
}
|
|
@@ -12900,7 +12925,7 @@ da.get("/*", async (e) => {
|
|
|
12900
12925
|
if (g(f)) {
|
|
12901
12926
|
let n = _(f);
|
|
12902
12927
|
return e.body(n, 200, {
|
|
12903
|
-
"Content-Type":
|
|
12928
|
+
"Content-Type": pa(t, u),
|
|
12904
12929
|
"Cache-Control": "public, max-age=31536000, immutable",
|
|
12905
12930
|
"X-Local-Cache": "HIT"
|
|
12906
12931
|
});
|
|
@@ -12913,14 +12938,14 @@ da.get("/*", async (e) => {
|
|
|
12913
12938
|
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 }));
|
|
12914
12939
|
let s = await i.toBuffer();
|
|
12915
12940
|
return v(x(f), { recursive: !0 }), y(f, s), e.body(s, 200, {
|
|
12916
|
-
"Content-Type":
|
|
12941
|
+
"Content-Type": pa(t, u),
|
|
12917
12942
|
"Cache-Control": "public, max-age=31536000, immutable",
|
|
12918
12943
|
"X-Local-Cache": "MISS"
|
|
12919
12944
|
});
|
|
12920
12945
|
} catch {
|
|
12921
12946
|
let n = _(C);
|
|
12922
12947
|
return e.body(n, 200, {
|
|
12923
|
-
"Content-Type":
|
|
12948
|
+
"Content-Type": pa(t),
|
|
12924
12949
|
"Cache-Control": "public, max-age=86400"
|
|
12925
12950
|
});
|
|
12926
12951
|
}
|
|
@@ -12931,8 +12956,8 @@ da.get("/*", async (e) => {
|
|
|
12931
12956
|
});
|
|
12932
12957
|
//#endregion
|
|
12933
12958
|
//#region server/routes/public/paths.ts
|
|
12934
|
-
var
|
|
12935
|
-
function
|
|
12959
|
+
var ma = new n();
|
|
12960
|
+
function ha(e, t) {
|
|
12936
12961
|
let n = /* @__PURE__ */ new Date();
|
|
12937
12962
|
if (e && String(e).trim() !== "") {
|
|
12938
12963
|
let t = new Date(e);
|
|
@@ -12944,7 +12969,7 @@ function ma(e, t) {
|
|
|
12944
12969
|
}
|
|
12945
12970
|
return !0;
|
|
12946
12971
|
}
|
|
12947
|
-
|
|
12972
|
+
ma.get("/", async (e) => {
|
|
12948
12973
|
try {
|
|
12949
12974
|
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();
|
|
12950
12975
|
for (let e of n) {
|
|
@@ -12968,7 +12993,7 @@ pa.get("/", async (e) => {
|
|
|
12968
12993
|
function o(e = null, t = "") {
|
|
12969
12994
|
let n = e == null || e === "" || e === "null" ? "__ROOT__" : String(e), s = i.get(n) || [];
|
|
12970
12995
|
for (let e of s) {
|
|
12971
|
-
let n = a.get(String(e.treeNodeId)) || {}, i = e.status === "published" || e.status === "active", s =
|
|
12996
|
+
let n = a.get(String(e.treeNodeId)) || {}, i = e.status === "published" || e.status === "active", s = ha(n.startShowingAt, n.stopShowingAt);
|
|
12972
12997
|
if (!i || !s) continue;
|
|
12973
12998
|
let c = (e.slug || "").replace(/^\/+|\/+$/g, ""), l = c === "home" || c === "homee" ? "/" : `${t}/${c}`.replace(/\/+/g, "/");
|
|
12974
12999
|
e.nodeType !== "external-link" && r.push(l);
|
|
@@ -12985,7 +13010,7 @@ pa.get("/", async (e) => {
|
|
|
12985
13010
|
});
|
|
12986
13011
|
//#endregion
|
|
12987
13012
|
//#region server/index.ts
|
|
12988
|
-
var
|
|
13013
|
+
var ga = Ir(), $ = new n(), _a = !1;
|
|
12989
13014
|
$.use("*", Rr()), $.use("/media/*", Rr({
|
|
12990
13015
|
origin: "*",
|
|
12991
13016
|
allowMethods: [
|
|
@@ -13003,18 +13028,18 @@ $.use("*", Rr()), $.use("/media/*", Rr({
|
|
|
13003
13028
|
await t(), e.header("Cache-Control", "public, max-age=31536000, immutable"), e.header("Access-Control-Allow-Origin", "*");
|
|
13004
13029
|
}), $.use("*", async (e, t) => {
|
|
13005
13030
|
if (e.req.path.startsWith("/media/")) return t();
|
|
13006
|
-
let n =
|
|
13031
|
+
let n = ga;
|
|
13007
13032
|
e.env?.BUNDLED_DEFINITIONS && (e.env.BUNDLED_DEFINITIONS._isCompiled || (e.env.BUNDLED_DEFINITIONS = Ir(e.env.BUNDLED_DEFINITIONS), e.env.BUNDLED_DEFINITIONS._isCompiled = !0), n = e.env.BUNDLED_DEFINITIONS), e.set("schemas", n);
|
|
13008
13033
|
let r = new URL(e.req.url), i = (e.req.header("host") || r.hostname).split(":")[0];
|
|
13009
13034
|
e.set("currentDomain", i);
|
|
13010
13035
|
let a = Hr(e);
|
|
13011
|
-
if (e.set("db", a), !
|
|
13012
|
-
await Kr(a, n),
|
|
13036
|
+
if (e.set("db", a), !_a) try {
|
|
13037
|
+
await Kr(a, n), _a = !0;
|
|
13013
13038
|
} catch (e) {
|
|
13014
13039
|
console.error("❌ [CMS Server] Failed to initialize system tables on cold start:", e);
|
|
13015
13040
|
}
|
|
13016
13041
|
await t();
|
|
13017
|
-
}), $.route("/media",
|
|
13042
|
+
}), $.route("/media", fa), $.use("/media/*", Jr()), $.route("/api/cms/nodes", J), $.route("/api/cms/nodes.json", J), $.route("/api/cms/formcsv", J), $.route("/api/cms/formcsv.json", J), $.route("/api/cms/stats", Pi), $.route("/api/cms/stats.json", Pi), $.route("/api/cms", xi), $.route("/api/cms/channels", Ei), $.route("/api/cms/channels.json", Ei), $.route("/api/cms/schemas", Oi), $.route("/api/cms/schemas.json", Oi), $.route("/api/admin/schemas", Oi), $.route("/api/cms", ji), $.route("/api/admin/assets", zi), $.route("/api/v1/node", Hi), $.route("/api/v1/page", Hi), $.route("/api/v1/tree", sa), $.route("/api/v1/all-paths", ma), $.get("*", async (e) => {
|
|
13018
13043
|
if (e.env?.ASSETS) {
|
|
13019
13044
|
let t = await e.env.ASSETS.fetch(e.req.raw);
|
|
13020
13045
|
if (t.status === 404) {
|