@brightsideoy/kama 0.1.0-alpha.82 → 0.1.0-alpha.84
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/assets/{index-yV2BtKIZ.js → index-Bjj55_1E.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/index.js +314 -321
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3645,11 +3645,11 @@ var cr = /* @__PURE__ */ new Set("0123456789ABCDEFabcdef"), lr = /* @__PURE__ */
|
|
|
3645
3645
|
};
|
|
3646
3646
|
//#endregion
|
|
3647
3647
|
//#region node_modules/yaml/browser/dist/parse/parser.js
|
|
3648
|
-
function
|
|
3648
|
+
function hr(e, t) {
|
|
3649
3649
|
for (let n = 0; n < e.length; ++n) if (e[n].type === t) return !0;
|
|
3650
3650
|
return !1;
|
|
3651
3651
|
}
|
|
3652
|
-
function
|
|
3652
|
+
function gr(e) {
|
|
3653
3653
|
for (let t = 0; t < e.length; ++t) switch (e[t].type) {
|
|
3654
3654
|
case "space":
|
|
3655
3655
|
case "comment":
|
|
@@ -3658,7 +3658,7 @@ function hr(e) {
|
|
|
3658
3658
|
}
|
|
3659
3659
|
return -1;
|
|
3660
3660
|
}
|
|
3661
|
-
function
|
|
3661
|
+
function _r(e) {
|
|
3662
3662
|
switch (e?.type) {
|
|
3663
3663
|
case "alias":
|
|
3664
3664
|
case "scalar":
|
|
@@ -3668,7 +3668,7 @@ function gr(e) {
|
|
|
3668
3668
|
default: return !1;
|
|
3669
3669
|
}
|
|
3670
3670
|
}
|
|
3671
|
-
function
|
|
3671
|
+
function vr(e) {
|
|
3672
3672
|
switch (e.type) {
|
|
3673
3673
|
case "document": return e.start;
|
|
3674
3674
|
case "block-map": {
|
|
@@ -3680,7 +3680,7 @@ function _r(e) {
|
|
|
3680
3680
|
default: return [];
|
|
3681
3681
|
}
|
|
3682
3682
|
}
|
|
3683
|
-
function
|
|
3683
|
+
function yr(e) {
|
|
3684
3684
|
if (e.length === 0) return [];
|
|
3685
3685
|
let t = e.length;
|
|
3686
3686
|
loop: for (; --t >= 0;) switch (e[t].type) {
|
|
@@ -3693,14 +3693,14 @@ function vr(e) {
|
|
|
3693
3693
|
for (; e[++t]?.type === "space";);
|
|
3694
3694
|
return e.splice(t, e.length);
|
|
3695
3695
|
}
|
|
3696
|
-
function
|
|
3696
|
+
function br(e, t) {
|
|
3697
3697
|
if (t.length < 1e5) Array.prototype.push.apply(e, t);
|
|
3698
3698
|
else for (let n = 0; n < t.length; ++n) e.push(t[n]);
|
|
3699
3699
|
}
|
|
3700
|
-
function
|
|
3701
|
-
if (e.start.type === "flow-seq-start") for (let t of e.items) t.sep && !t.value && !
|
|
3700
|
+
function xr(e) {
|
|
3701
|
+
if (e.start.type === "flow-seq-start") for (let t of e.items) t.sep && !t.value && !hr(t.start, "explicit-key-ind") && !hr(t.sep, "map-value-ind") && (t.key && (t.value = t.key), delete t.key, _r(t.value) ? t.value.end ? br(t.value.end, t.sep) : t.value.end = t.sep : br(t.start, t.sep), delete t.sep);
|
|
3702
3702
|
}
|
|
3703
|
-
var
|
|
3703
|
+
var Sr = class {
|
|
3704
3704
|
constructor(e) {
|
|
3705
3705
|
this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new pr(), this.onNewLine = e;
|
|
3706
3706
|
}
|
|
@@ -3797,7 +3797,7 @@ var xr = class {
|
|
|
3797
3797
|
else if (this.stack.length === 0) yield t;
|
|
3798
3798
|
else {
|
|
3799
3799
|
let e = this.peek(1);
|
|
3800
|
-
switch (t.type === "block-scalar" ? t.indent = "indent" in e ? e.indent : 0 : t.type === "flow-collection" && e.type === "document" && (t.indent = 0), t.type === "flow-collection" &&
|
|
3800
|
+
switch (t.type === "block-scalar" ? t.indent = "indent" in e ? e.indent : 0 : t.type === "flow-collection" && e.type === "document" && (t.indent = 0), t.type === "flow-collection" && xr(t), e.type) {
|
|
3801
3801
|
case "document":
|
|
3802
3802
|
e.value = t;
|
|
3803
3803
|
break;
|
|
@@ -3849,7 +3849,7 @@ var xr = class {
|
|
|
3849
3849
|
}
|
|
3850
3850
|
if ((e.type === "document" || e.type === "block-map" || e.type === "block-seq") && (t.type === "block-map" || t.type === "block-seq")) {
|
|
3851
3851
|
let n = t.items[t.items.length - 1];
|
|
3852
|
-
n && !n.sep && !n.value && n.start.length > 0 &&
|
|
3852
|
+
n && !n.sep && !n.value && n.start.length > 0 && gr(n.start) === -1 && (t.indent === 0 || n.start.every((e) => e.type !== "comment" || e.indent < t.indent)) && (e.type === "document" ? e.end = n.start : e.items.push({ start: n.start }), t.items.splice(-1, 1));
|
|
3853
3853
|
}
|
|
3854
3854
|
}
|
|
3855
3855
|
}
|
|
@@ -3890,7 +3890,7 @@ var xr = class {
|
|
|
3890
3890
|
if (e.value) return yield* this.lineEnd(e);
|
|
3891
3891
|
switch (this.type) {
|
|
3892
3892
|
case "doc-start":
|
|
3893
|
-
|
|
3893
|
+
gr(e.start) === -1 ? e.start.push(this.sourceToken) : (yield* this.pop(), yield* this.step());
|
|
3894
3894
|
return;
|
|
3895
3895
|
case "anchor":
|
|
3896
3896
|
case "tag":
|
|
@@ -3910,7 +3910,7 @@ var xr = class {
|
|
|
3910
3910
|
}
|
|
3911
3911
|
*scalar(e) {
|
|
3912
3912
|
if (this.type === "map-value-ind") {
|
|
3913
|
-
let t = vr(
|
|
3913
|
+
let t = yr(vr(this.peek(2))), n;
|
|
3914
3914
|
e.end ? (n = e.end, n.push(this.sourceToken), delete e.end) : n = [this.sourceToken];
|
|
3915
3915
|
let r = {
|
|
3916
3916
|
type: "block-map",
|
|
@@ -3960,7 +3960,7 @@ var xr = class {
|
|
|
3960
3960
|
if (this.atIndentedComment(t.start, e.indent)) {
|
|
3961
3961
|
let n = e.items[e.items.length - 2]?.value?.end;
|
|
3962
3962
|
if (Array.isArray(n)) {
|
|
3963
|
-
|
|
3963
|
+
br(n, t.start), n.push(this.sourceToken), e.items.pop();
|
|
3964
3964
|
return;
|
|
3965
3965
|
}
|
|
3966
3966
|
}
|
|
@@ -4009,12 +4009,12 @@ var xr = class {
|
|
|
4009
4009
|
case "map-value-ind":
|
|
4010
4010
|
if (t.explicitKey) {
|
|
4011
4011
|
if (!t.sep) {
|
|
4012
|
-
if (
|
|
4012
|
+
if (hr(t.start, "newline")) Object.assign(t, {
|
|
4013
4013
|
key: null,
|
|
4014
4014
|
sep: [this.sourceToken]
|
|
4015
4015
|
});
|
|
4016
4016
|
else {
|
|
4017
|
-
let e =
|
|
4017
|
+
let e = yr(t.start);
|
|
4018
4018
|
this.stack.push({
|
|
4019
4019
|
type: "block-map",
|
|
4020
4020
|
offset: this.offset,
|
|
@@ -4031,7 +4031,7 @@ var xr = class {
|
|
|
4031
4031
|
key: null,
|
|
4032
4032
|
sep: [this.sourceToken]
|
|
4033
4033
|
});
|
|
4034
|
-
else if (
|
|
4034
|
+
else if (hr(t.sep, "map-value-ind")) this.stack.push({
|
|
4035
4035
|
type: "block-map",
|
|
4036
4036
|
offset: this.offset,
|
|
4037
4037
|
indent: this.indent,
|
|
@@ -4041,8 +4041,8 @@ var xr = class {
|
|
|
4041
4041
|
sep: [this.sourceToken]
|
|
4042
4042
|
}]
|
|
4043
4043
|
});
|
|
4044
|
-
else if (
|
|
4045
|
-
let e =
|
|
4044
|
+
else if (_r(t.key) && !hr(t.sep, "newline")) {
|
|
4045
|
+
let e = yr(t.start), n = t.key, r = t.sep;
|
|
4046
4046
|
r.push(this.sourceToken), delete t.key, delete t.sep, this.stack.push({
|
|
4047
4047
|
type: "block-map",
|
|
4048
4048
|
offset: this.offset,
|
|
@@ -4058,7 +4058,7 @@ var xr = class {
|
|
|
4058
4058
|
start: i,
|
|
4059
4059
|
key: null,
|
|
4060
4060
|
sep: [this.sourceToken]
|
|
4061
|
-
}) :
|
|
4061
|
+
}) : hr(t.sep, "map-value-ind") ? this.stack.push({
|
|
4062
4062
|
type: "block-map",
|
|
4063
4063
|
offset: this.offset,
|
|
4064
4064
|
indent: this.indent,
|
|
@@ -4092,7 +4092,7 @@ var xr = class {
|
|
|
4092
4092
|
let r = this.startBlockValue(e);
|
|
4093
4093
|
if (r) {
|
|
4094
4094
|
if (r.type === "block-seq") {
|
|
4095
|
-
if (!t.explicitKey && t.sep && !
|
|
4095
|
+
if (!t.explicitKey && t.sep && !hr(t.sep, "newline")) {
|
|
4096
4096
|
yield* this.pop({
|
|
4097
4097
|
type: "error",
|
|
4098
4098
|
offset: this.offset,
|
|
@@ -4126,7 +4126,7 @@ var xr = class {
|
|
|
4126
4126
|
if (this.atIndentedComment(t.start, e.indent)) {
|
|
4127
4127
|
let n = e.items[e.items.length - 2]?.value?.end;
|
|
4128
4128
|
if (Array.isArray(n)) {
|
|
4129
|
-
|
|
4129
|
+
br(n, t.start), n.push(this.sourceToken), e.items.pop();
|
|
4130
4130
|
return;
|
|
4131
4131
|
}
|
|
4132
4132
|
}
|
|
@@ -4140,7 +4140,7 @@ var xr = class {
|
|
|
4140
4140
|
return;
|
|
4141
4141
|
case "seq-item-ind":
|
|
4142
4142
|
if (this.indent !== e.indent) break;
|
|
4143
|
-
t.value ||
|
|
4143
|
+
t.value || hr(t.start, "seq-item-ind") ? e.items.push({ start: [this.sourceToken] }) : t.start.push(this.sourceToken);
|
|
4144
4144
|
return;
|
|
4145
4145
|
}
|
|
4146
4146
|
if (this.indent > e.indent) {
|
|
@@ -4209,8 +4209,8 @@ var xr = class {
|
|
|
4209
4209
|
let t = this.peek(2);
|
|
4210
4210
|
if (t.type === "block-map" && (this.type === "map-value-ind" && t.indent === e.indent || this.type === "newline" && !t.items[t.items.length - 1].sep)) yield* this.pop(), yield* this.step();
|
|
4211
4211
|
else if (this.type === "map-value-ind" && t.type !== "flow-collection") {
|
|
4212
|
-
let n = vr(
|
|
4213
|
-
|
|
4212
|
+
let n = yr(vr(t));
|
|
4213
|
+
xr(e);
|
|
4214
4214
|
let r = e.end.splice(1, e.end.length);
|
|
4215
4215
|
r.push(this.sourceToken);
|
|
4216
4216
|
let i = {
|
|
@@ -4269,7 +4269,7 @@ var xr = class {
|
|
|
4269
4269
|
};
|
|
4270
4270
|
case "explicit-key-ind": {
|
|
4271
4271
|
this.onKeyLine = !0;
|
|
4272
|
-
let t = vr(
|
|
4272
|
+
let t = yr(vr(e));
|
|
4273
4273
|
return t.push(this.sourceToken), {
|
|
4274
4274
|
type: "block-map",
|
|
4275
4275
|
offset: this.offset,
|
|
@@ -4282,7 +4282,7 @@ var xr = class {
|
|
|
4282
4282
|
}
|
|
4283
4283
|
case "map-value-ind": {
|
|
4284
4284
|
this.onKeyLine = !0;
|
|
4285
|
-
let t = vr(
|
|
4285
|
+
let t = yr(vr(e));
|
|
4286
4286
|
return {
|
|
4287
4287
|
type: "block-map",
|
|
4288
4288
|
offset: this.offset,
|
|
@@ -4320,20 +4320,20 @@ var xr = class {
|
|
|
4320
4320
|
};
|
|
4321
4321
|
//#endregion
|
|
4322
4322
|
//#region node_modules/yaml/browser/dist/public-api.js
|
|
4323
|
-
function
|
|
4323
|
+
function Cr(e) {
|
|
4324
4324
|
let t = e.prettyErrors !== !1;
|
|
4325
4325
|
return {
|
|
4326
4326
|
lineCounter: e.lineCounter || t && new mr() || null,
|
|
4327
4327
|
prettyErrors: t
|
|
4328
4328
|
};
|
|
4329
4329
|
}
|
|
4330
|
-
function
|
|
4331
|
-
let { lineCounter: n, prettyErrors: r } =
|
|
4330
|
+
function wr(e, t = {}) {
|
|
4331
|
+
let { lineCounter: n, prettyErrors: r } = Cr(t), i = new Sr(n?.addNewLine), a = new Hn(t), o = Array.from(a.compose(i.parse(e)));
|
|
4332
4332
|
if (r && n) for (let t of o) t.errors.forEach(on(e, n)), t.warnings.forEach(on(e, n));
|
|
4333
4333
|
return o.length > 0 ? o : Object.assign([], { empty: !0 }, a.streamInfo());
|
|
4334
4334
|
}
|
|
4335
|
-
function
|
|
4336
|
-
let { lineCounter: n, prettyErrors: r } =
|
|
4335
|
+
function Tr(e, t = {}) {
|
|
4336
|
+
let { lineCounter: n, prettyErrors: r } = Cr(t), i = new Sr(n?.addNewLine), a = new Hn(t), o = null;
|
|
4337
4337
|
for (let t of a.compose(i.parse(e), !0, e.length)) if (!o) o = t;
|
|
4338
4338
|
else if (o.options.logLevel !== "silent") {
|
|
4339
4339
|
o.errors.push(new rn(t.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
|
|
@@ -4341,10 +4341,10 @@ function wr(e, t = {}) {
|
|
|
4341
4341
|
}
|
|
4342
4342
|
return r && n && (o.errors.forEach(on(e, n)), o.warnings.forEach(on(e, n))), o;
|
|
4343
4343
|
}
|
|
4344
|
-
function
|
|
4344
|
+
function Er(e, t, n) {
|
|
4345
4345
|
let r;
|
|
4346
4346
|
typeof t == "function" ? r = t : n === void 0 && t && typeof t == "object" && (n = t);
|
|
4347
|
-
let i =
|
|
4347
|
+
let i = Tr(e, n);
|
|
4348
4348
|
if (!i) return null;
|
|
4349
4349
|
if (i.warnings.forEach((e) => Be(i.options.logLevel, e)), i.errors.length > 0) {
|
|
4350
4350
|
if (i.options.logLevel !== "silent") throw i.errors[0];
|
|
@@ -4352,7 +4352,7 @@ function Tr(e, t, n) {
|
|
|
4352
4352
|
}
|
|
4353
4353
|
return i.toJS(Object.assign({ reviver: r }, n));
|
|
4354
4354
|
}
|
|
4355
|
-
function
|
|
4355
|
+
function Dr(e, t, n) {
|
|
4356
4356
|
let r = null;
|
|
4357
4357
|
if (typeof t == "function" || Array.isArray(t) ? r = t : n === void 0 && t && (n = t), typeof n == "string" && (n = n.length), typeof n == "number") {
|
|
4358
4358
|
let e = Math.round(n);
|
|
@@ -4366,7 +4366,7 @@ function Er(e, t, n) {
|
|
|
4366
4366
|
}
|
|
4367
4367
|
//#endregion
|
|
4368
4368
|
//#region node_modules/yaml/browser/index.js
|
|
4369
|
-
var
|
|
4369
|
+
var Or = /* @__PURE__ */ a({
|
|
4370
4370
|
Alias: () => de,
|
|
4371
4371
|
CST: () => rr,
|
|
4372
4372
|
Composer: () => Hn,
|
|
@@ -4374,7 +4374,7 @@ var Dr = /* @__PURE__ */ a({
|
|
|
4374
4374
|
Lexer: () => pr,
|
|
4375
4375
|
LineCounter: () => mr,
|
|
4376
4376
|
Pair: () => V,
|
|
4377
|
-
Parser: () =>
|
|
4377
|
+
Parser: () => Sr,
|
|
4378
4378
|
Scalar: () => I,
|
|
4379
4379
|
Schema: () => Qt,
|
|
4380
4380
|
YAMLError: () => nn,
|
|
@@ -4390,13 +4390,13 @@ var Dr = /* @__PURE__ */ a({
|
|
|
4390
4390
|
isPair: () => x,
|
|
4391
4391
|
isScalar: () => S,
|
|
4392
4392
|
isSeq: () => C,
|
|
4393
|
-
parse: () =>
|
|
4394
|
-
parseAllDocuments: () =>
|
|
4395
|
-
parseDocument: () =>
|
|
4396
|
-
stringify: () =>
|
|
4393
|
+
parse: () => Er,
|
|
4394
|
+
parseAllDocuments: () => wr,
|
|
4395
|
+
parseDocument: () => Tr,
|
|
4396
|
+
stringify: () => Dr,
|
|
4397
4397
|
visit: () => k,
|
|
4398
4398
|
visitAsync: () => A
|
|
4399
|
-
}),
|
|
4399
|
+
}), kr = {
|
|
4400
4400
|
rawNodes: {
|
|
4401
4401
|
address: {
|
|
4402
4402
|
id: "address",
|
|
@@ -5981,7 +5981,7 @@ var Dr = /* @__PURE__ */ a({
|
|
|
5981
5981
|
};
|
|
5982
5982
|
//#endregion
|
|
5983
5983
|
//#region server/db/dynamic-sync.ts
|
|
5984
|
-
async function
|
|
5984
|
+
async function Ar(e, t) {
|
|
5985
5985
|
try {
|
|
5986
5986
|
let n = await e.prepare(`PRAGMA table_info("${t}")`).all(), r = Array.isArray(n) ? n : n?.results || [];
|
|
5987
5987
|
return new Set(r.map((e) => e.name));
|
|
@@ -5989,7 +5989,7 @@ async function kr(e, t) {
|
|
|
5989
5989
|
return /* @__PURE__ */ new Set();
|
|
5990
5990
|
}
|
|
5991
5991
|
}
|
|
5992
|
-
var
|
|
5992
|
+
var jr = {
|
|
5993
5993
|
content_schemas: "\n id TEXT PRIMARY KEY,\n name TEXT NOT NULL,\n type TEXT UNIQUE NOT NULL,\n schemaJson TEXT NOT NULL,\n isSystem INTEGER DEFAULT 1,\n createdAt TEXT DEFAULT CURRENT_TIMESTAMP,\n updatedAt TEXT DEFAULT CURRENT_TIMESTAMP\n ",
|
|
5994
5994
|
users: "\n id TEXT PRIMARY KEY,\n email TEXT UNIQUE NOT NULL,\n name TEXT NOT NULL,\n globalRole TEXT DEFAULT 'editor',\n createdAt TEXT DEFAULT CURRENT_TIMESTAMP,\n updatedAt TEXT DEFAULT CURRENT_TIMESTAMP\n ",
|
|
5995
5995
|
user_accounts: "\n id TEXT PRIMARY KEY,\n userId TEXT NOT NULL,\n provider TEXT NOT NULL,\n providerAccountId TEXT NOT NULL,\n passwordHash TEXT NOT NULL,\n createdAt TEXT DEFAULT CURRENT_TIMESTAMP,\n FOREIGN KEY (userId) REFERENCES users(id) ON DELETE CASCADE,\n UNIQUE(provider, providerAccountId)\n ",
|
|
@@ -6004,7 +6004,7 @@ var Ar = {
|
|
|
6004
6004
|
node_revisions: "\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n nodeId INTEGER NOT NULL,\n version INTEGER NOT NULL DEFAULT 1,\n snapshotJson TEXT NOT NULL,\n createdById TEXT,\n createdAt TEXT DEFAULT CURRENT_TIMESTAMP,\n FOREIGN KEY (nodeId) REFERENCES content_nodes(id) ON DELETE CASCADE,\n FOREIGN KEY (createdById) REFERENCES users(id) ON DELETE SET NULL\n ",
|
|
6005
6005
|
assets: "\n id TEXT PRIMARY KEY,\n filename TEXT NOT NULL,\n mimeType TEXT NOT NULL,\n sizeBytes INTEGER NOT NULL,\n storageKeyPrivate TEXT,\n cdnUrl TEXT,\n parentAssetId TEXT,\n cropCoordinatesJson TEXT,\n isSystemVariant INTEGER DEFAULT 0,\n dataJson TEXT DEFAULT '{}',\n createdById TEXT,\n createdAt TEXT DEFAULT CURRENT_TIMESTAMP,\n updatedAt TEXT DEFAULT CURRENT_TIMESTAMP,\n deletedAt TEXT,\n FOREIGN KEY (parentAssetId) REFERENCES assets(id) ON DELETE SET NULL,\n FOREIGN KEY (createdById) REFERENCES users(id) ON DELETE SET NULL\n ",
|
|
6006
6006
|
node_assets: "\n nodeId INTEGER NOT NULL,\n assetId TEXT NOT NULL,\n fieldKey TEXT NOT NULL,\n sortOrder INTEGER DEFAULT 0,\n PRIMARY KEY (nodeId, assetId, fieldKey),\n FOREIGN KEY (nodeId) REFERENCES content_nodes(id) ON DELETE CASCADE,\n FOREIGN KEY (assetId) REFERENCES assets(id) ON DELETE CASCADE\n "
|
|
6007
|
-
},
|
|
6007
|
+
}, Mr = [
|
|
6008
6008
|
"CREATE INDEX IF NOT EXISTS idx_content_schemas_type ON content_schemas(type);",
|
|
6009
6009
|
"CREATE INDEX IF NOT EXISTS idx_sessions_user ON sessions(userId);",
|
|
6010
6010
|
"CREATE INDEX IF NOT EXISTS idx_sessions_expires ON sessions(expiresAt);",
|
|
@@ -6027,13 +6027,13 @@ var Ar = {
|
|
|
6027
6027
|
"CREATE INDEX IF NOT EXISTS idx_assets_deleted ON assets(deletedAt);",
|
|
6028
6028
|
"CREATE INDEX IF NOT EXISTS idx_assets_parent ON assets(parentAssetId);"
|
|
6029
6029
|
];
|
|
6030
|
-
async function
|
|
6030
|
+
async function Nr(e, t) {
|
|
6031
6031
|
try {
|
|
6032
6032
|
await e.prepare("PRAGMA foreign_keys = ON;").run();
|
|
6033
6033
|
} catch {}
|
|
6034
|
-
for (let [t, n] of Object.entries(
|
|
6035
|
-
for (let [t] of Object.entries(
|
|
6036
|
-
let n = await
|
|
6034
|
+
for (let [t, n] of Object.entries(jr)) await e.prepare(`CREATE TABLE IF NOT EXISTS "${t}" (${n});`).run();
|
|
6035
|
+
for (let [t] of Object.entries(jr)) {
|
|
6036
|
+
let n = await Ar(e, t);
|
|
6037
6037
|
if (n.size > 0) {
|
|
6038
6038
|
if (t === "content_nodes" && !n.has("disabledRegionsJson")) try {
|
|
6039
6039
|
await e.prepare("ALTER TABLE \"content_nodes\" ADD COLUMN disabledRegionsJson TEXT DEFAULT '{}';").run();
|
|
@@ -6048,12 +6048,12 @@ async function Mr(e, t) {
|
|
|
6048
6048
|
}
|
|
6049
6049
|
}
|
|
6050
6050
|
}
|
|
6051
|
-
for (let t of
|
|
6051
|
+
for (let t of Mr) try {
|
|
6052
6052
|
await e.prepare(t).run();
|
|
6053
6053
|
} catch {}
|
|
6054
|
-
await
|
|
6054
|
+
await Pr(e, t || kr), await Fr(e);
|
|
6055
6055
|
}
|
|
6056
|
-
async function
|
|
6056
|
+
async function Pr(e, t) {
|
|
6057
6057
|
if (!t) return;
|
|
6058
6058
|
let n = t.rawNodes || {}, r = Object.entries(n);
|
|
6059
6059
|
for (let [t, n] of r) {
|
|
@@ -6070,7 +6070,7 @@ async function Nr(e, t) {
|
|
|
6070
6070
|
}
|
|
6071
6071
|
}
|
|
6072
6072
|
}
|
|
6073
|
-
async function
|
|
6073
|
+
async function Fr(e) {
|
|
6074
6074
|
try {
|
|
6075
6075
|
let t = await e.prepare("SELECT COUNT(*) as count FROM channels").get(), n = 1;
|
|
6076
6076
|
if (!t || t.count === 0) {
|
|
@@ -6091,7 +6091,7 @@ async function Pr(e) {
|
|
|
6091
6091
|
}
|
|
6092
6092
|
//#endregion
|
|
6093
6093
|
//#region server/middleware/media-static.ts
|
|
6094
|
-
function
|
|
6094
|
+
function Ir() {
|
|
6095
6095
|
return async (e, t) => {
|
|
6096
6096
|
if (e.env?.MEDIA_BUCKET) {
|
|
6097
6097
|
let t = e.req.path.replace(/^\/media\//, ""), n = await e.env.MEDIA_BUCKET.get(t, { onlyIf: e.req.raw.headers });
|
|
@@ -6122,18 +6122,18 @@ function Fr() {
|
|
|
6122
6122
|
}
|
|
6123
6123
|
//#endregion
|
|
6124
6124
|
//#region node_modules/lru-cache/dist/esm/browser/index.min.js
|
|
6125
|
-
var
|
|
6126
|
-
typeof
|
|
6127
|
-
},
|
|
6125
|
+
var Lr = { hasSubscribers: !1 }, K = Lr, Rr = Lr, zr = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, Br = () => K.hasSubscribers || Rr.hasSubscribers, Vr = /* @__PURE__ */ new Set(), Hr = typeof process == "object" && process ? process : {}, Ur = (e, t, n, r) => {
|
|
6126
|
+
typeof Hr.emitWarning == "function" ? Hr.emitWarning(e, t, n, r) : console.error(`[${n}] ${t}: ${e}`);
|
|
6127
|
+
}, Wr = (e) => !Vr.has(e), Gr = (e) => !!e && e === Math.floor(e) && e > 0 && isFinite(e), Kr = (e) => Gr(e) ? e <= 256 ? Uint8Array : e <= 2 ** 16 ? Uint16Array : e <= 2 ** 32 ? Uint32Array : e <= 2 ** 53 - 1 ? qr : null : null, qr = class extends Array {
|
|
6128
6128
|
constructor(e) {
|
|
6129
6129
|
super(e), this.fill(0);
|
|
6130
6130
|
}
|
|
6131
|
-
},
|
|
6131
|
+
}, Jr = class e {
|
|
6132
6132
|
heap;
|
|
6133
6133
|
length;
|
|
6134
6134
|
static #e = !1;
|
|
6135
6135
|
static create(t) {
|
|
6136
|
-
let n =
|
|
6136
|
+
let n = Kr(t);
|
|
6137
6137
|
if (!n) return [];
|
|
6138
6138
|
e.#e = !0;
|
|
6139
6139
|
let r = new e(t, n);
|
|
@@ -6149,7 +6149,7 @@ var Ir = { hasSubscribers: !1 }, q = Ir, Lr = Ir, Rr = typeof performance == "ob
|
|
|
6149
6149
|
pop() {
|
|
6150
6150
|
return this.heap[--this.length];
|
|
6151
6151
|
}
|
|
6152
|
-
},
|
|
6152
|
+
}, Yr = class e {
|
|
6153
6153
|
#e;
|
|
6154
6154
|
#t;
|
|
6155
6155
|
#n;
|
|
@@ -6252,8 +6252,8 @@ var Ir = { hasSubscribers: !1 }, q = Ir, Lr = Ir, Rr = typeof performance == "ob
|
|
|
6252
6252
|
constructor(t) {
|
|
6253
6253
|
let { max: n = 0, ttl: r, ttlResolution: i = 1, ttlAutopurge: a, updateAgeOnGet: o, updateAgeOnHas: s, allowStale: c, dispose: l, onInsert: u, disposeAfter: d, noDisposeOnSet: f, noUpdateTTL: p, maxSize: m = 0, maxEntrySize: h = 0, sizeCalculation: g, fetchMethod: _, memoMethod: v, noDeleteOnFetchRejection: y, noDeleteOnStaleGet: b, allowStaleOnFetchRejection: x, allowStaleOnFetchAbort: S, ignoreFetchAbort: C, backgroundFetchSize: w = 1, perf: T } = t;
|
|
6254
6254
|
if (this.backgroundFetchSize = w, T !== void 0 && typeof T?.now != "function") throw TypeError("perf option must have a now() method if specified");
|
|
6255
|
-
if (this.#s = T ??
|
|
6256
|
-
let E = n ?
|
|
6255
|
+
if (this.#s = T ?? zr, n !== 0 && !Gr(n)) throw TypeError("max option must be a nonnegative integer");
|
|
6256
|
+
let E = n ? Kr(n) : Array;
|
|
6257
6257
|
if (!E) throw Error("invalid max value: " + n);
|
|
6258
6258
|
if (this.#e = n, this.#t = m, this.maxEntrySize = h || this.#t, this.sizeCalculation = g, this.sizeCalculation) {
|
|
6259
6259
|
if (!this.#t && !this.maxEntrySize) throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
@@ -6261,26 +6261,26 @@ var Ir = { hasSubscribers: !1 }, q = Ir, Lr = Ir, Rr = typeof performance == "ob
|
|
|
6261
6261
|
}
|
|
6262
6262
|
if (v !== void 0 && typeof v != "function") throw TypeError("memoMethod must be a function if defined");
|
|
6263
6263
|
if (this.#o = v, _ !== void 0 && typeof _ != "function") throw TypeError("fetchMethod must be a function if specified");
|
|
6264
|
-
if (this.#a = _, this.#w = !!_, this.#u = /* @__PURE__ */ new Map(), this.#d = Array.from({ length: n }).fill(void 0), this.#f = Array.from({ length: n }).fill(void 0), this.#p = new E(n), this.#m = new E(n), this.#h = 0, this.#g = 0, this.#_ =
|
|
6265
|
-
if (this.#t !== 0 && !
|
|
6266
|
-
if (!
|
|
6264
|
+
if (this.#a = _, this.#w = !!_, this.#u = /* @__PURE__ */ new Map(), this.#d = Array.from({ length: n }).fill(void 0), this.#f = Array.from({ length: n }).fill(void 0), this.#p = new E(n), this.#m = new E(n), this.#h = 0, this.#g = 0, this.#_ = Jr.create(n), this.#c = 0, this.#l = 0, typeof l == "function" && (this.#n = l), typeof u == "function" && (this.#r = u), typeof d == "function" ? (this.#i = d, this.#v = []) : (this.#i = void 0, this.#v = void 0), this.#C = !!this.#n, this.#E = !!this.#r, this.#T = !!this.#i, this.noDisposeOnSet = !!f, this.noUpdateTTL = !!p, this.noDeleteOnFetchRejection = !!y, this.allowStaleOnFetchRejection = !!x, this.allowStaleOnFetchAbort = !!S, this.ignoreFetchAbort = !!C, this.maxEntrySize !== 0) {
|
|
6265
|
+
if (this.#t !== 0 && !Gr(this.#t)) throw TypeError("maxSize must be a positive integer if specified");
|
|
6266
|
+
if (!Gr(this.maxEntrySize)) throw TypeError("maxEntrySize must be a positive integer if specified");
|
|
6267
6267
|
this.#M();
|
|
6268
6268
|
}
|
|
6269
|
-
if (this.allowStale = !!c, this.noDeleteOnStaleGet = !!b, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!s, this.ttlResolution =
|
|
6270
|
-
if (!
|
|
6269
|
+
if (this.allowStale = !!c, this.noDeleteOnStaleGet = !!b, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!s, this.ttlResolution = Gr(i) || i === 0 ? i : 1, this.ttlAutopurge = !!a, this.ttl = r || 0, this.ttl) {
|
|
6270
|
+
if (!Gr(this.ttl)) throw TypeError("ttl must be a positive integer if specified");
|
|
6271
6271
|
this.#D();
|
|
6272
6272
|
}
|
|
6273
6273
|
if (this.#e === 0 && this.ttl === 0 && this.#t === 0) throw TypeError("At least one of max, maxSize, or ttl is required");
|
|
6274
6274
|
if (!this.ttlAutopurge && !this.#e && !this.#t) {
|
|
6275
6275
|
let t = "LRU_CACHE_UNBOUNDED";
|
|
6276
|
-
|
|
6276
|
+
Wr(t) && (Vr.add(t), Ur("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", t, e));
|
|
6277
6277
|
}
|
|
6278
6278
|
}
|
|
6279
6279
|
getRemainingTTL(e) {
|
|
6280
6280
|
return this.#u.has(e) ? 1 / 0 : 0;
|
|
6281
6281
|
}
|
|
6282
6282
|
#D() {
|
|
6283
|
-
let e = new
|
|
6283
|
+
let e = new qr(this.#e), t = new qr(this.#e);
|
|
6284
6284
|
this.#x = e, this.#b = t;
|
|
6285
6285
|
let n = this.ttlAutopurge ? Array.from({ length: this.#e }) : void 0;
|
|
6286
6286
|
this.#S = n, this.#A = (n, i, a = this.#s.now()) => {
|
|
@@ -6330,15 +6330,15 @@ var Ir = { hasSubscribers: !1 }, q = Ir, Lr = Ir, Rr = typeof performance == "ob
|
|
|
6330
6330
|
#A = () => {};
|
|
6331
6331
|
#j = () => !1;
|
|
6332
6332
|
#M() {
|
|
6333
|
-
let e = new
|
|
6333
|
+
let e = new qr(this.#e);
|
|
6334
6334
|
this.#l = 0, this.#y = e, this.#N = (t) => {
|
|
6335
6335
|
this.#l -= e[t], e[t] = 0;
|
|
6336
6336
|
}, this.#F = (e, t, n, r) => {
|
|
6337
|
-
if (!
|
|
6337
|
+
if (!Gr(n)) {
|
|
6338
6338
|
if (this.#W(t)) return this.backgroundFetchSize;
|
|
6339
6339
|
if (r) {
|
|
6340
6340
|
if (typeof r != "function") throw TypeError("sizeCalculation must be a function");
|
|
6341
|
-
if (n = r(t, e), !
|
|
6341
|
+
if (n = r(t, e), !Gr(n)) throw TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
6342
6342
|
} else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
6343
6343
|
}
|
|
6344
6344
|
return n;
|
|
@@ -6454,10 +6454,10 @@ var Ir = { hasSubscribers: !1 }, q = Ir, Lr = Ir, Rr = typeof performance == "ob
|
|
|
6454
6454
|
}
|
|
6455
6455
|
}
|
|
6456
6456
|
set(e, t, n = {}) {
|
|
6457
|
-
let { status: r =
|
|
6457
|
+
let { status: r = K.hasSubscribers ? {} : void 0 } = n;
|
|
6458
6458
|
n.status = r, r && (r.op = "set", r.key = e, t !== void 0 && (r.value = t), r.cache = this);
|
|
6459
6459
|
let i = this.#z(e, t, n);
|
|
6460
|
-
return r &&
|
|
6460
|
+
return r && K.hasSubscribers && K.publish(r), i;
|
|
6461
6461
|
}
|
|
6462
6462
|
#z(e, t, n, r) {
|
|
6463
6463
|
let { ttl: i = this.ttl, start: a, noDisposeOnSet: o = this.noDisposeOnSet, sizeCalculation: s = this.sizeCalculation, status: c } = n, l = this.#W(t);
|
|
@@ -6525,10 +6525,10 @@ var Ir = { hasSubscribers: !1 }, q = Ir, Lr = Ir, Rr = typeof performance == "ob
|
|
|
6525
6525
|
])), this.#N(t), this.#S?.[t] && (clearTimeout(this.#S[t]), this.#S[t] = void 0), e && (this.#d[t] = void 0, this.#f[t] = void 0, this.#_.push(t)), this.#c === 1 ? (this.#h = this.#g = 0, this.#_.length = 0) : this.#h = this.#p[t], this.#u.delete(n), this.#c--, t;
|
|
6526
6526
|
}
|
|
6527
6527
|
has(e, t = {}) {
|
|
6528
|
-
let { status: n =
|
|
6528
|
+
let { status: n = K.hasSubscribers ? {} : void 0 } = t;
|
|
6529
6529
|
t.status = n, n && (n.op = "has", n.key = e, n.cache = this);
|
|
6530
6530
|
let r = this.#V(e, t);
|
|
6531
|
-
return
|
|
6531
|
+
return K.hasSubscribers && K.publish(n), r;
|
|
6532
6532
|
}
|
|
6533
6533
|
#V(e, t = {}) {
|
|
6534
6534
|
let { updateAgeOnHas: n = this.updateAgeOnHas, status: r } = t, i = this.#u.get(e);
|
|
@@ -6541,10 +6541,10 @@ var Ir = { hasSubscribers: !1 }, q = Ir, Lr = Ir, Rr = typeof performance == "ob
|
|
|
6541
6541
|
return !1;
|
|
6542
6542
|
}
|
|
6543
6543
|
peek(e, t = {}) {
|
|
6544
|
-
let { status: n =
|
|
6544
|
+
let { status: n = Br() ? {} : void 0 } = t;
|
|
6545
6545
|
n && (n.op = "peek", n.key = e, n.cache = this), t.status = n;
|
|
6546
6546
|
let r = this.#H(e, t);
|
|
6547
|
-
return
|
|
6547
|
+
return K.hasSubscribers && K.publish(n), r;
|
|
6548
6548
|
}
|
|
6549
6549
|
#H(e, t) {
|
|
6550
6550
|
let { status: n, allowStale: r = this.allowStale } = t, i = this.#u.get(e);
|
|
@@ -6596,10 +6596,10 @@ var Ir = { hasSubscribers: !1 }, q = Ir, Lr = Ir, Rr = typeof performance == "ob
|
|
|
6596
6596
|
return !!t && t instanceof Promise && t.hasOwnProperty("__staleWhileFetching") && t.__abortController instanceof AbortController;
|
|
6597
6597
|
}
|
|
6598
6598
|
fetch(e, t = {}) {
|
|
6599
|
-
let n =
|
|
6599
|
+
let n = Rr.hasSubscribers, { status: r = Br() ? {} : void 0 } = t;
|
|
6600
6600
|
t.status = r, r && t.context && (r.context = t.context);
|
|
6601
6601
|
let i = this.#G(e, t);
|
|
6602
|
-
return r && n && (r.trace = !0,
|
|
6602
|
+
return r && n && (r.trace = !0, Rr.tracePromise(() => i, r).catch(() => {})), i;
|
|
6603
6603
|
}
|
|
6604
6604
|
async #G(e, t = {}) {
|
|
6605
6605
|
let { allowStale: n = this.allowStale, updateAgeOnGet: r = this.updateAgeOnGet, noDeleteOnStaleGet: i = this.noDeleteOnStaleGet, ttl: a = this.ttl, noDisposeOnSet: o = this.noDisposeOnSet, size: s = 0, sizeCalculation: c = this.sizeCalculation, noUpdateTTL: l = this.noUpdateTTL, noDeleteOnFetchRejection: u = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: d = this.allowStaleOnFetchRejection, ignoreFetchAbort: f = this.ignoreFetchAbort, allowStaleOnFetchAbort: p = this.allowStaleOnFetchAbort, context: m, forceRefresh: h = !1, status: g, signal: _ } = t;
|
|
@@ -6643,10 +6643,10 @@ var Ir = { hasSubscribers: !1 }, q = Ir, Lr = Ir, Rr = typeof performance == "ob
|
|
|
6643
6643
|
}
|
|
6644
6644
|
}
|
|
6645
6645
|
forceFetch(e, t = {}) {
|
|
6646
|
-
let n =
|
|
6646
|
+
let n = Rr.hasSubscribers, { status: r = Br() ? {} : void 0 } = t;
|
|
6647
6647
|
t.status = r, r && t.context && (r.context = t.context);
|
|
6648
6648
|
let i = this.#K(e, t);
|
|
6649
|
-
return r && n && (r.trace = !0,
|
|
6649
|
+
return r && n && (r.trace = !0, Rr.tracePromise(() => i, r).catch(() => {})), i;
|
|
6650
6650
|
}
|
|
6651
6651
|
async #K(e, t = {}) {
|
|
6652
6652
|
let n = await this.#G(e, t);
|
|
@@ -6654,10 +6654,10 @@ var Ir = { hasSubscribers: !1 }, q = Ir, Lr = Ir, Rr = typeof performance == "ob
|
|
|
6654
6654
|
return n;
|
|
6655
6655
|
}
|
|
6656
6656
|
memo(e, t = {}) {
|
|
6657
|
-
let { status: n =
|
|
6657
|
+
let { status: n = K.hasSubscribers ? {} : void 0 } = t;
|
|
6658
6658
|
t.status = n, n && (n.op = "memo", n.key = e, t.context && (n.context = t.context), n.cache = this);
|
|
6659
6659
|
let r = this.#q(e, t);
|
|
6660
|
-
return n && (n.value = r),
|
|
6660
|
+
return n && (n.value = r), K.hasSubscribers && K.publish(n), r;
|
|
6661
6661
|
}
|
|
6662
6662
|
#q(e, t = {}) {
|
|
6663
6663
|
let n = this.#o;
|
|
@@ -6673,10 +6673,10 @@ var Ir = { hasSubscribers: !1 }, q = Ir, Lr = Ir, Rr = typeof performance == "ob
|
|
|
6673
6673
|
return i && (i.value = l), this.#z(e, l, o), l;
|
|
6674
6674
|
}
|
|
6675
6675
|
get(e, t = {}) {
|
|
6676
|
-
let { status: n =
|
|
6676
|
+
let { status: n = K.hasSubscribers ? {} : void 0 } = t;
|
|
6677
6677
|
t.status = n, n && (n.op = "get", n.key = e, n.cache = this);
|
|
6678
6678
|
let r = this.#J(e, t);
|
|
6679
|
-
return n && (r !== void 0 && (n.value = r),
|
|
6679
|
+
return n && (r !== void 0 && (n.value = r), K.hasSubscribers && K.publish(n)), r;
|
|
6680
6680
|
}
|
|
6681
6681
|
#J(e, t = {}) {
|
|
6682
6682
|
let { allowStale: n = this.allowStale, updateAgeOnGet: r = this.updateAgeOnGet, noDeleteOnStaleGet: i = this.noDeleteOnStaleGet, status: a } = t, o = this.#u.get(e);
|
|
@@ -6697,7 +6697,7 @@ var Ir = { hasSubscribers: !1 }, q = Ir, Lr = Ir, Rr = typeof performance == "ob
|
|
|
6697
6697
|
return this.#Z(e, "delete");
|
|
6698
6698
|
}
|
|
6699
6699
|
#Z(e, t) {
|
|
6700
|
-
|
|
6700
|
+
K.hasSubscribers && K.publish({
|
|
6701
6701
|
op: "delete",
|
|
6702
6702
|
delete: t,
|
|
6703
6703
|
key: e,
|
|
@@ -6759,10 +6759,10 @@ var Ir = { hasSubscribers: !1 }, q = Ir, Lr = Ir, Rr = typeof performance == "ob
|
|
|
6759
6759
|
for (; t = e?.shift();) this.#i?.(...t);
|
|
6760
6760
|
}
|
|
6761
6761
|
}
|
|
6762
|
-
},
|
|
6762
|
+
}, Xr = class {
|
|
6763
6763
|
cache;
|
|
6764
6764
|
constructor(e = 1e3, t = 3e5) {
|
|
6765
|
-
this.cache = new
|
|
6765
|
+
this.cache = new Yr({
|
|
6766
6766
|
max: e,
|
|
6767
6767
|
ttl: t
|
|
6768
6768
|
});
|
|
@@ -6781,7 +6781,7 @@ var Ir = { hasSubscribers: !1 }, q = Ir, Lr = Ir, Rr = typeof performance == "ob
|
|
|
6781
6781
|
async clear() {
|
|
6782
6782
|
this.cache.clear();
|
|
6783
6783
|
}
|
|
6784
|
-
},
|
|
6784
|
+
}, Zr = class {
|
|
6785
6785
|
kv;
|
|
6786
6786
|
constructor(e) {
|
|
6787
6787
|
this.kv = e;
|
|
@@ -6798,21 +6798,21 @@ var Ir = { hasSubscribers: !1 }, q = Ir, Lr = Ir, Rr = typeof performance == "ob
|
|
|
6798
6798
|
this.kv && await this.kv.delete(e);
|
|
6799
6799
|
}
|
|
6800
6800
|
async clear() {}
|
|
6801
|
-
},
|
|
6801
|
+
}, Qr = class {
|
|
6802
6802
|
async get() {
|
|
6803
6803
|
return null;
|
|
6804
6804
|
}
|
|
6805
6805
|
async set() {}
|
|
6806
6806
|
async delete() {}
|
|
6807
6807
|
async clear() {}
|
|
6808
|
-
},
|
|
6809
|
-
function
|
|
6808
|
+
}, $r = null;
|
|
6809
|
+
function q(e) {
|
|
6810
6810
|
let t = process.env.CACHE_DRIVER || "lru";
|
|
6811
|
-
return t === "none" || t === "off" || t === "false" ? new
|
|
6811
|
+
return t === "none" || t === "off" || t === "false" ? new Qr() : e?.env?.CMS_CACHE_KV ? new Zr(e.env.CMS_CACHE_KV) : t === "lru" ? ($r ||= new Xr(), $r) : new Qr();
|
|
6812
6812
|
}
|
|
6813
6813
|
//#endregion
|
|
6814
6814
|
//#region server/storage/provider.ts
|
|
6815
|
-
function
|
|
6815
|
+
function ei(e) {
|
|
6816
6816
|
let t = e.split(".").pop()?.toLowerCase() || "bin";
|
|
6817
6817
|
return t = t.replace(/[^a-z0-9]/g, ""), [
|
|
6818
6818
|
"php",
|
|
@@ -6827,14 +6827,14 @@ function $r(e) {
|
|
|
6827
6827
|
"cjs"
|
|
6828
6828
|
].includes(t) ? "bin" : t;
|
|
6829
6829
|
}
|
|
6830
|
-
var
|
|
6830
|
+
var ti = class {
|
|
6831
6831
|
bucket;
|
|
6832
6832
|
publicDomain;
|
|
6833
6833
|
constructor(e, t) {
|
|
6834
6834
|
this.bucket = e, this.publicDomain = t;
|
|
6835
6835
|
}
|
|
6836
6836
|
async upload(e, t = "uploads") {
|
|
6837
|
-
let n =
|
|
6837
|
+
let n = ei(e.name), r = `${t}/${crypto.randomUUID().replace(/-/g, "")}.${n}`;
|
|
6838
6838
|
await this.bucket.put(r, e.stream(), { httpMetadata: { contentType: e.type } });
|
|
6839
6839
|
let i = r.replace(/^\//, ""), a = `/media/${i}`;
|
|
6840
6840
|
if (this.publicDomain && this.publicDomain.trim().length > 0) {
|
|
@@ -6849,7 +6849,7 @@ var ei = class {
|
|
|
6849
6849
|
async delete(e) {
|
|
6850
6850
|
await this.bucket.delete(e);
|
|
6851
6851
|
}
|
|
6852
|
-
},
|
|
6852
|
+
}, ni = class {
|
|
6853
6853
|
customStoragePath;
|
|
6854
6854
|
constructor(e) {
|
|
6855
6855
|
this.customStoragePath = e;
|
|
@@ -6867,7 +6867,7 @@ var ei = class {
|
|
|
6867
6867
|
), { pipeline: a } = await import(
|
|
6868
6868
|
/* @vite-ignore */
|
|
6869
6869
|
"node:stream/promises"
|
|
6870
|
-
), o =
|
|
6870
|
+
), o = ei(e.name), s = `${t}/${crypto.randomUUID().replace(/-/g, "")}.${o}`, c = this.customStoragePath || "./public/media", l = n.resolve(process.cwd(), c), u = n.join(l, s);
|
|
6871
6871
|
await i.mkdir(n.dirname(u), { recursive: !0 });
|
|
6872
6872
|
let d = r.createWriteStream(u);
|
|
6873
6873
|
return await a(e.stream(), d), {
|
|
@@ -6890,16 +6890,16 @@ var ei = class {
|
|
|
6890
6890
|
}
|
|
6891
6891
|
}
|
|
6892
6892
|
};
|
|
6893
|
-
function
|
|
6893
|
+
function ri(e) {
|
|
6894
6894
|
if (e.MEDIA_BUCKET) {
|
|
6895
6895
|
let t = e.CDN_DOMAIN || "cdn.yourdomain.com";
|
|
6896
|
-
return new
|
|
6896
|
+
return new ti(e.MEDIA_BUCKET, t);
|
|
6897
6897
|
}
|
|
6898
|
-
return new
|
|
6898
|
+
return new ni(e.LOCAL_MEDIA_PATH);
|
|
6899
6899
|
}
|
|
6900
6900
|
//#endregion
|
|
6901
6901
|
//#region server/utils/node-assets-interceptor.ts
|
|
6902
|
-
function
|
|
6902
|
+
function ii(e) {
|
|
6903
6903
|
if (!e || typeof e != "object") return {
|
|
6904
6904
|
cleanedData: e,
|
|
6905
6905
|
assetRefs: []
|
|
@@ -6958,7 +6958,7 @@ function ri(e) {
|
|
|
6958
6958
|
assetRefs: t
|
|
6959
6959
|
};
|
|
6960
6960
|
}
|
|
6961
|
-
async function
|
|
6961
|
+
async function ai(e, t, n) {
|
|
6962
6962
|
if (await e.prepare("DELETE FROM node_assets WHERE nodeId = ?").run(t), n.length === 0) return;
|
|
6963
6963
|
let r = /* @__PURE__ */ new Set();
|
|
6964
6964
|
for (let i of n) {
|
|
@@ -6968,23 +6968,23 @@ async function ii(e, t, n) {
|
|
|
6968
6968
|
}
|
|
6969
6969
|
//#endregion
|
|
6970
6970
|
//#region server/utils/asset-hydrator.ts
|
|
6971
|
-
function
|
|
6971
|
+
function oi(e) {
|
|
6972
6972
|
if (!e) return null;
|
|
6973
6973
|
if (typeof e == "string" && e.startsWith("ast_")) return e;
|
|
6974
6974
|
if (typeof e == "object" && e) {
|
|
6975
6975
|
if (typeof e.id == "string" && e.id.startsWith("ast_")) return e.id;
|
|
6976
|
-
if (typeof e.id == "object") return
|
|
6976
|
+
if (typeof e.id == "object") return oi(e.id);
|
|
6977
6977
|
}
|
|
6978
6978
|
return null;
|
|
6979
6979
|
}
|
|
6980
|
-
async function
|
|
6980
|
+
async function si(e, t) {
|
|
6981
6981
|
if (!t || typeof t != "object") return t;
|
|
6982
6982
|
let n = /* @__PURE__ */ new Set(), r = (e) => {
|
|
6983
6983
|
if (!e) return;
|
|
6984
|
-
let t =
|
|
6984
|
+
let t = oi(e);
|
|
6985
6985
|
if (t) {
|
|
6986
6986
|
if (n.add(t), typeof e == "object" && e.parentAssetId) {
|
|
6987
|
-
let t =
|
|
6987
|
+
let t = oi(e.parentAssetId);
|
|
6988
6988
|
t && n.add(t);
|
|
6989
6989
|
}
|
|
6990
6990
|
} else Array.isArray(e) ? e.forEach(r) : typeof e == "object" && Object.values(e).forEach(r);
|
|
@@ -7013,7 +7013,7 @@ async function oi(e, t) {
|
|
|
7013
7013
|
AND (parentAssetId IN (${i}) OR ${Array.from(n).map(() => "filename LIKE ?").join(" OR ")})
|
|
7014
7014
|
`).all(...Array.from(n), ...Array.from(n).map((e) => `%${e}%`)), c = Array.isArray(s) ? s : s?.results || [], l = /* @__PURE__ */ new Map();
|
|
7015
7015
|
for (let e of c) {
|
|
7016
|
-
let t =
|
|
7016
|
+
let t = oi(e.parentAssetId) || Array.from(n).find((t) => e.filename.includes(t));
|
|
7017
7017
|
if (!t) continue;
|
|
7018
7018
|
let r = e.filename.match(/^crop_([a-z0-9]+)_/i), i = r ? r[1] : "standard", a = null;
|
|
7019
7019
|
if (e.cropCoordinatesJson) try {
|
|
@@ -7048,7 +7048,7 @@ async function oi(e, t) {
|
|
|
7048
7048
|
id: e.id,
|
|
7049
7049
|
url: t,
|
|
7050
7050
|
originalUrl: n,
|
|
7051
|
-
parentAssetId:
|
|
7051
|
+
parentAssetId: oi(e.parentAssetId) || null,
|
|
7052
7052
|
cropCoordinates: r,
|
|
7053
7053
|
variants: i && Object.keys(i).length > 0 ? i : void 0,
|
|
7054
7054
|
filename: e.filename,
|
|
@@ -7060,7 +7060,7 @@ async function oi(e, t) {
|
|
|
7060
7060
|
}
|
|
7061
7061
|
let d = (e) => {
|
|
7062
7062
|
if (!e) return e;
|
|
7063
|
-
let t =
|
|
7063
|
+
let t = oi(e);
|
|
7064
7064
|
if (t) {
|
|
7065
7065
|
let n = u.get(t) || {
|
|
7066
7066
|
id: t,
|
|
@@ -7070,7 +7070,7 @@ async function oi(e, t) {
|
|
|
7070
7070
|
return {
|
|
7071
7071
|
...n,
|
|
7072
7072
|
id: t,
|
|
7073
|
-
parentAssetId: n.parentAssetId ?
|
|
7073
|
+
parentAssetId: n.parentAssetId ? oi(n.parentAssetId) : null,
|
|
7074
7074
|
url: typeof e == "object" && e.url && !e.url.startsWith("blob:") ? e.url : n.url,
|
|
7075
7075
|
originalUrl: typeof e == "object" && e.originalUrl && !e.originalUrl.startsWith("blob:") ? e.originalUrl : n.originalUrl,
|
|
7076
7076
|
cropCoordinates: i || n.cropCoordinates || null,
|
|
@@ -7090,7 +7090,7 @@ async function oi(e, t) {
|
|
|
7090
7090
|
}
|
|
7091
7091
|
//#endregion
|
|
7092
7092
|
//#region src/schemas/definitions.ts
|
|
7093
|
-
function
|
|
7093
|
+
function J(e = {}, t = {}) {
|
|
7094
7094
|
let n = {
|
|
7095
7095
|
...e,
|
|
7096
7096
|
...t
|
|
@@ -7108,7 +7108,7 @@ function Y(e = {}, t = {}) {
|
|
|
7108
7108
|
...t.rules || {}
|
|
7109
7109
|
}, n;
|
|
7110
7110
|
}
|
|
7111
|
-
function
|
|
7111
|
+
function ci() {
|
|
7112
7112
|
if (typeof process > "u" || !process?.versions?.node) return null;
|
|
7113
7113
|
try {
|
|
7114
7114
|
let e = (e) => {
|
|
@@ -7137,7 +7137,7 @@ function si() {
|
|
|
7137
7137
|
for (let a of e(r)) {
|
|
7138
7138
|
let e = n.basename(a, n.extname(a));
|
|
7139
7139
|
try {
|
|
7140
|
-
i[e] =
|
|
7140
|
+
i[e] = Or.parse(t.readFileSync(a, "utf-8"));
|
|
7141
7141
|
} catch (e) {
|
|
7142
7142
|
console.warn(`[CMS Schema] Failed to parse ${a}:`, e);
|
|
7143
7143
|
}
|
|
@@ -7147,7 +7147,7 @@ function si() {
|
|
|
7147
7147
|
let i = e(n.dirname(r)), a = n.basename(r), o = i.find((e) => n.basename(e) === a || n.basename(e) === a.replace(/\.yaml$/, ".yml"));
|
|
7148
7148
|
if (!o) return null;
|
|
7149
7149
|
try {
|
|
7150
|
-
return
|
|
7150
|
+
return Or.parse(t.readFileSync(o, "utf-8"));
|
|
7151
7151
|
} catch {
|
|
7152
7152
|
return null;
|
|
7153
7153
|
}
|
|
@@ -7175,12 +7175,12 @@ function si() {
|
|
|
7175
7175
|
return null;
|
|
7176
7176
|
}
|
|
7177
7177
|
}
|
|
7178
|
-
function ci(e) {
|
|
7179
|
-
if (e && (Object.keys(e.rawNodes || {}).length > 0 || Object.keys(e.nodes || {}).length > 0)) return li(e);
|
|
7180
|
-
let t = si();
|
|
7181
|
-
return t && Object.keys(t.rawNodes).length > 0 ? li(t) : li(null);
|
|
7182
|
-
}
|
|
7183
7178
|
function li(e) {
|
|
7179
|
+
if (e && (Object.keys(e.rawNodes || {}).length > 0 || Object.keys(e.nodes || {}).length > 0)) return ui(e);
|
|
7180
|
+
let t = ci();
|
|
7181
|
+
return t && Object.keys(t.rawNodes).length > 0 ? ui(t) : ui(null);
|
|
7182
|
+
}
|
|
7183
|
+
function ui(e) {
|
|
7184
7184
|
if (!e) return {
|
|
7185
7185
|
nodes: {},
|
|
7186
7186
|
trees: {},
|
|
@@ -7200,7 +7200,7 @@ function li(e) {
|
|
|
7200
7200
|
let i = {};
|
|
7201
7201
|
if (!Array.isArray(e)) return typeof e == "object" && e ? (Object.entries(e).forEach(([e, t]) => {
|
|
7202
7202
|
let n = i[e] || m[e] || {};
|
|
7203
|
-
i[e] =
|
|
7203
|
+
i[e] = J(n, t);
|
|
7204
7204
|
}), i) : {};
|
|
7205
7205
|
let a = (e) => {
|
|
7206
7206
|
let a = h[e] || h[`${e}-base`] || {};
|
|
@@ -7213,11 +7213,11 @@ function li(e) {
|
|
|
7213
7213
|
fields: {}
|
|
7214
7214
|
}), Object.entries(s).forEach(([e, r]) => {
|
|
7215
7215
|
let i = n[t].fields[e] || {};
|
|
7216
|
-
n[t].fields[e] =
|
|
7216
|
+
n[t].fields[e] = J(i, r);
|
|
7217
7217
|
});
|
|
7218
7218
|
} else Object.entries(s).forEach(([e, t]) => {
|
|
7219
7219
|
let n = i[e] || {};
|
|
7220
|
-
i[e] =
|
|
7220
|
+
i[e] = J(n, t);
|
|
7221
7221
|
});
|
|
7222
7222
|
};
|
|
7223
7223
|
return e.forEach((e) => {
|
|
@@ -7225,7 +7225,7 @@ function li(e) {
|
|
|
7225
7225
|
if (e.startsWith("fieldSet:")) a(e.replace("fieldSet:", "").trim());
|
|
7226
7226
|
else {
|
|
7227
7227
|
let t = i[e] || m[e] || {};
|
|
7228
|
-
i[e] =
|
|
7228
|
+
i[e] = J(t, {
|
|
7229
7229
|
type: "text",
|
|
7230
7230
|
label: e
|
|
7231
7231
|
});
|
|
@@ -7235,7 +7235,7 @@ function li(e) {
|
|
|
7235
7235
|
if (t === "fieldSet") a(String(n));
|
|
7236
7236
|
else {
|
|
7237
7237
|
let e = i[t] || m[t] || {};
|
|
7238
|
-
i[t] =
|
|
7238
|
+
i[t] = J(e, typeof n == "object" && n ? n : {});
|
|
7239
7239
|
}
|
|
7240
7240
|
}
|
|
7241
7241
|
}), i;
|
|
@@ -7253,7 +7253,7 @@ function li(e) {
|
|
|
7253
7253
|
let s = g(i.fields || i, a, n, t);
|
|
7254
7254
|
Object.entries(s).forEach(([e, t]) => {
|
|
7255
7255
|
let r = n[a].fields[e] || {};
|
|
7256
|
-
n[a].fields[e] =
|
|
7256
|
+
n[a].fields[e] = J(r, t);
|
|
7257
7257
|
});
|
|
7258
7258
|
}
|
|
7259
7259
|
}), n) : (Object.entries(e).forEach(([e, r]) => {
|
|
@@ -7265,7 +7265,7 @@ function li(e) {
|
|
|
7265
7265
|
let o = g(a, e, n, t);
|
|
7266
7266
|
Object.entries(o).forEach(([t, r]) => {
|
|
7267
7267
|
let i = n[e].fields[t] || {};
|
|
7268
|
-
n[e].fields[t] =
|
|
7268
|
+
n[e].fields[t] = J(i, r);
|
|
7269
7269
|
});
|
|
7270
7270
|
}), n);
|
|
7271
7271
|
}, v = {};
|
|
@@ -7283,16 +7283,16 @@ function li(e) {
|
|
|
7283
7283
|
fields: {}
|
|
7284
7284
|
}), Object.entries(o).forEach(([e, r]) => {
|
|
7285
7285
|
let i = n[t].fields[e] || {};
|
|
7286
|
-
n[t].fields[e] =
|
|
7286
|
+
n[t].fields[e] = J(i, r);
|
|
7287
7287
|
});
|
|
7288
7288
|
} else Object.entries(o).forEach(([e, t]) => {
|
|
7289
7289
|
let n = r[e] || m[e] || {};
|
|
7290
|
-
r[e] =
|
|
7290
|
+
r[e] = J(n, t);
|
|
7291
7291
|
});
|
|
7292
7292
|
}), Object.values(n).forEach((e) => {
|
|
7293
7293
|
Object.entries(e.fields).forEach(([e, t]) => {
|
|
7294
7294
|
let n = r[e] || {};
|
|
7295
|
-
r[e] =
|
|
7295
|
+
r[e] = J(n, t);
|
|
7296
7296
|
});
|
|
7297
7297
|
}), Object.keys(n).length === 0 && Object.keys(r).length > 0 && (n.settings = {
|
|
7298
7298
|
label: t.label || "Settings",
|
|
@@ -7315,11 +7315,11 @@ function li(e) {
|
|
|
7315
7315
|
Array.isArray(t.fieldSets) && t.fieldSets.forEach((e) => {
|
|
7316
7316
|
let t = h[e] || {}, i = t.fields || t, a = g(i, "settings", n);
|
|
7317
7317
|
Object.entries(a).forEach(([e, t]) => {
|
|
7318
|
-
r[e] =
|
|
7318
|
+
r[e] = J(r[e] || {}, t);
|
|
7319
7319
|
});
|
|
7320
7320
|
}), Object.values(n).forEach((e) => {
|
|
7321
7321
|
Object.entries(e.fields).forEach(([e, t]) => {
|
|
7322
|
-
r[e] =
|
|
7322
|
+
r[e] = J(r[e] || {}, t);
|
|
7323
7323
|
});
|
|
7324
7324
|
}), y[e] = {
|
|
7325
7325
|
...t,
|
|
@@ -7338,7 +7338,7 @@ function li(e) {
|
|
|
7338
7338
|
Array.isArray(t.fieldSets) && t.fieldSets.forEach((e) => {
|
|
7339
7339
|
let t = h[e] || {}, r = t.fields || t, i = g(r);
|
|
7340
7340
|
Object.entries(i).forEach(([e, t]) => {
|
|
7341
|
-
n[e] =
|
|
7341
|
+
n[e] = J(n[e] || {}, t);
|
|
7342
7342
|
});
|
|
7343
7343
|
}), b[e] = {
|
|
7344
7344
|
...t,
|
|
@@ -7387,7 +7387,7 @@ function li(e) {
|
|
|
7387
7387
|
Array.isArray(f?.fieldSets) && f?.fieldSets.forEach((e) => {
|
|
7388
7388
|
let t = h[e] || {}, n = t.fields || t, r = g(n);
|
|
7389
7389
|
Object.entries(r).forEach(([e, t]) => {
|
|
7390
|
-
T[e] =
|
|
7390
|
+
T[e] = J(T[e] || {}, t);
|
|
7391
7391
|
});
|
|
7392
7392
|
});
|
|
7393
7393
|
let E = f ? {
|
|
@@ -7397,7 +7397,7 @@ function li(e) {
|
|
|
7397
7397
|
Array.isArray(p?.fieldSets) && p?.fieldSets.forEach((e) => {
|
|
7398
7398
|
let t = h[e] || {}, n = t.fields || t, r = g(n);
|
|
7399
7399
|
Object.entries(r).forEach(([e, t]) => {
|
|
7400
|
-
D[e] =
|
|
7400
|
+
D[e] = J(D[e] || {}, t);
|
|
7401
7401
|
});
|
|
7402
7402
|
});
|
|
7403
7403
|
let ee = p ? {
|
|
@@ -7419,7 +7419,7 @@ function li(e) {
|
|
|
7419
7419
|
}
|
|
7420
7420
|
//#endregion
|
|
7421
7421
|
//#region server/services/cache-manager.ts
|
|
7422
|
-
var
|
|
7422
|
+
var Y = class {
|
|
7423
7423
|
zoneId;
|
|
7424
7424
|
apiToken;
|
|
7425
7425
|
frontendUrl;
|
|
@@ -7451,7 +7451,7 @@ var X = class {
|
|
|
7451
7451
|
}
|
|
7452
7452
|
async purgeInternalWorkerCache(e, t, n, r, i = "en") {
|
|
7453
7453
|
try {
|
|
7454
|
-
let a =
|
|
7454
|
+
let a = q(e);
|
|
7455
7455
|
if (n) {
|
|
7456
7456
|
let e = await t.prepare("SELECT treeId FROM tree_nodes WHERE contentId = ?").all(n), r = Array.isArray(e) ? e : e?.results || [];
|
|
7457
7457
|
for (let e of r) await a.delete(`tree:default:${e.treeId}`), await a.delete(`tree:all:${e.treeId}`);
|
|
@@ -7479,20 +7479,31 @@ var X = class {
|
|
|
7479
7479
|
})();
|
|
7480
7480
|
this.dispatch(e, r);
|
|
7481
7481
|
}
|
|
7482
|
-
purgeGlobalCache(e) {
|
|
7483
|
-
let
|
|
7484
|
-
await this.purgeGlobalCacheDirect(e);
|
|
7482
|
+
purgeGlobalCache(e, t) {
|
|
7483
|
+
let n = (async () => {
|
|
7484
|
+
await this.purgeGlobalCacheDirect(e, t);
|
|
7485
7485
|
})();
|
|
7486
|
-
this.dispatch(e,
|
|
7486
|
+
this.dispatch(e, n);
|
|
7487
7487
|
}
|
|
7488
7488
|
purgeSmart(e, t, n, r, i = [], a = !1) {
|
|
7489
7489
|
let o = (async () => {
|
|
7490
7490
|
let o = r;
|
|
7491
|
-
!o && n && (o = (await t.prepare("SELECT slug FROM content_nodes WHERE id = ?").get(n))?.slug), o && (await this.purgeInternalWorkerCache(e, t, n, o), await this.purgeAndWarmSlugDirect(e, o, i), a && (console.log("[CacheManager] Structural change detected (Title/Slug). Triggering Global Version Bump..."), await this.purgeGlobalCacheDirect(e)));
|
|
7491
|
+
!o && n && (o = (await t.prepare("SELECT slug FROM content_nodes WHERE id = ?").get(n))?.slug), o && (await this.purgeInternalWorkerCache(e, t, n, o), await this.purgeAndWarmSlugDirect(e, o, i), a && (console.log("[CacheManager] Structural change detected (Title/Slug). Triggering Global Version Bump..."), await this.purgeGlobalCacheDirect(e, t)));
|
|
7492
7492
|
})();
|
|
7493
7493
|
this.dispatch(e, o);
|
|
7494
7494
|
}
|
|
7495
|
-
async
|
|
7495
|
+
async warmAllPublishedPages(e) {
|
|
7496
|
+
try {
|
|
7497
|
+
let t = await e.prepare("SELECT DISTINCT slug FROM content_nodes WHERE status = 'published' AND slug IS NOT NULL AND (deletedAt IS NULL OR deletedAt = '')").all(), n = Array.isArray(t) ? t : t?.results || [], r = { "X-Cache-Warmer": "true" }, i = Date.now(), a = n.map((e) => {
|
|
7498
|
+
let t = String(e.slug).replace(/^\/+|\/+$/g, ""), n = t === "home" || !t ? this.frontendUrl : `${this.frontendUrl}/${t}`;
|
|
7499
|
+
return fetch(`${n}?_warmer=${i}`, { headers: r }).then((e) => console.log(`🔥 [CacheWarmer] Tree-wide warm for ${t || "/"}: ${e.status}`)).catch((e) => console.warn(`⚠️ [CacheWarmer] Failed to warm ${t}:`, e));
|
|
7500
|
+
});
|
|
7501
|
+
a.push(fetch(`${this.frontendUrl}/?_warmer=${i}`, { headers: r }).then((e) => console.log(`🔥 [CacheWarmer] Tree-wide warm for root /: ${e.status}`)).catch(() => {})), await Promise.all(a), console.log(`✅ [CacheWarmer] Warmed ${a.length} published pages across the tree.`);
|
|
7502
|
+
} catch (e) {
|
|
7503
|
+
console.warn("⚠️ [CacheWarmer] Tree-wide warming failed:", e);
|
|
7504
|
+
}
|
|
7505
|
+
}
|
|
7506
|
+
async purgeGlobalCacheDirect(e, t) {
|
|
7496
7507
|
try {
|
|
7497
7508
|
console.log("[CacheManager] Executing Direct Global Version Purge..."), await fetch(`https://api.cloudflare.com/client/v4/zones/${this.zoneId}/purge_cache`, {
|
|
7498
7509
|
method: "POST",
|
|
@@ -7502,18 +7513,16 @@ var X = class {
|
|
|
7502
7513
|
},
|
|
7503
7514
|
body: JSON.stringify({ purge_everything: !0 })
|
|
7504
7515
|
});
|
|
7505
|
-
let
|
|
7506
|
-
if (
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
console.warn("⚠️ [CacheWarmer] Global Home warm failed:", e);
|
|
7513
|
-
});
|
|
7516
|
+
let n = await this.callAstroPurge(e, { purge_everything: !0 });
|
|
7517
|
+
if (!n.ok) {
|
|
7518
|
+
let e = await n.text();
|
|
7519
|
+
console.error(`❌ [CacheManager] Astro Global Purge FAILED (${n.status}): ${e}`);
|
|
7520
|
+
} else if (console.log("✅ [CacheManager] Dual Global Version Purge SUCCESS"), t) {
|
|
7521
|
+
let n = this.warmAllPublishedPages(t);
|
|
7522
|
+
e.executionCtx && typeof e.executionCtx.waitUntil == "function" ? e.executionCtx.waitUntil(n) : await n;
|
|
7514
7523
|
} else {
|
|
7515
|
-
let e =
|
|
7516
|
-
|
|
7524
|
+
let e = this.frontendUrl.replace(/\/+$/, "");
|
|
7525
|
+
fetch(`${e}/?_warmer=${Date.now()}`, { headers: { "X-Cache-Warmer": "true" } }).catch(() => {});
|
|
7517
7526
|
}
|
|
7518
7527
|
} catch (e) {
|
|
7519
7528
|
console.error("❌ [CacheManager] Direct Global Purge CRASH:", e);
|
|
@@ -7558,8 +7567,8 @@ var X = class {
|
|
|
7558
7567
|
console.error("❌ [CacheManager] Dual Slug Purge CRASH:", e);
|
|
7559
7568
|
}
|
|
7560
7569
|
}
|
|
7561
|
-
},
|
|
7562
|
-
async function
|
|
7570
|
+
}, X = new e();
|
|
7571
|
+
async function di(e, t, n = []) {
|
|
7563
7572
|
let r = e.prepare(t);
|
|
7564
7573
|
if (typeof r.bind == "function") {
|
|
7565
7574
|
let e = await r.bind(...n).all();
|
|
@@ -7571,37 +7580,37 @@ async function ui(e, t, n = []) {
|
|
|
7571
7580
|
}
|
|
7572
7581
|
return [];
|
|
7573
7582
|
}
|
|
7574
|
-
async function
|
|
7583
|
+
async function fi(e, t, n = []) {
|
|
7575
7584
|
let r = e.prepare(t);
|
|
7576
7585
|
if (typeof r.bind == "function") return r.bind(...n).run();
|
|
7577
7586
|
if (typeof r.run == "function") return r.run(...n);
|
|
7578
7587
|
}
|
|
7579
|
-
async function
|
|
7588
|
+
async function pi(e, t) {
|
|
7580
7589
|
try {
|
|
7581
|
-
return (await
|
|
7590
|
+
return (await di(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);
|
|
7582
7591
|
} catch {
|
|
7583
7592
|
return [];
|
|
7584
7593
|
}
|
|
7585
7594
|
}
|
|
7586
|
-
async function
|
|
7595
|
+
async function mi(e, t) {
|
|
7587
7596
|
try {
|
|
7588
|
-
return (await
|
|
7597
|
+
return (await di(e, "\n WITH RECURSIVE tree_path(treeNodeId, contentId, parentId) AS (\n SELECT id, contentId, parentId \n FROM tree_nodes \n WHERE contentId = ?\n UNION ALL\n SELECT tn.id, tn.contentId, tn.parentId\n FROM tree_nodes tn\n INNER JOIN tree_path tp ON tn.parentId = tp.treeNodeId\n )\n SELECT DISTINCT cn.slug\n FROM tree_path tp\n INNER JOIN content_nodes cn ON tp.contentId = cn.id\n WHERE cn.status = 'published' AND cn.slug IS NOT NULL AND cn.id != ?\n ", [t, t])).map((e) => e.slug).filter(Boolean);
|
|
7589
7598
|
} catch (e) {
|
|
7590
7599
|
return console.warn("[Cache] Failed to fetch descendant slugs:", e), [];
|
|
7591
7600
|
}
|
|
7592
7601
|
}
|
|
7593
|
-
function
|
|
7602
|
+
function hi(e) {
|
|
7594
7603
|
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;
|
|
7595
7604
|
}
|
|
7596
|
-
function
|
|
7605
|
+
function gi(e) {
|
|
7597
7606
|
return +(e === !0 || e === 1 || e === "1" || e === "true");
|
|
7598
7607
|
}
|
|
7599
|
-
function
|
|
7608
|
+
function _i(e) {
|
|
7600
7609
|
if (e == null || e === "null" || e === "" || typeof e == "string" && e.startsWith("draft-")) return null;
|
|
7601
7610
|
let t = Number(e);
|
|
7602
7611
|
return isNaN(t) ? null : t;
|
|
7603
7612
|
}
|
|
7604
|
-
function
|
|
7613
|
+
function vi(e) {
|
|
7605
7614
|
let t = { ...e };
|
|
7606
7615
|
for (let e of [
|
|
7607
7616
|
"id",
|
|
@@ -7630,17 +7639,17 @@ function _i(e) {
|
|
|
7630
7639
|
]) delete t[e];
|
|
7631
7640
|
return t;
|
|
7632
7641
|
}
|
|
7633
|
-
function
|
|
7634
|
-
return e ? typeof e == "string" ? (e.startsWith("ast_") && t.add(e), t) : Array.isArray(e) ? (e.forEach((e) =>
|
|
7642
|
+
function yi(e, t = /* @__PURE__ */ new Set()) {
|
|
7643
|
+
return e ? typeof e == "string" ? (e.startsWith("ast_") && t.add(e), t) : Array.isArray(e) ? (e.forEach((e) => yi(e, t)), t) : (typeof e == "object" && Object.values(e).forEach((e) => yi(e, t)), t) : t;
|
|
7635
7644
|
}
|
|
7636
|
-
async function
|
|
7645
|
+
async function bi(e, t, n) {
|
|
7637
7646
|
for (let r of n) {
|
|
7638
|
-
let n = (await
|
|
7639
|
-
if (!n || (await
|
|
7647
|
+
let n = (await di(e, "\n SELECT id, storageKeyPrivate, isSystemVariant, parentAssetId, filename\n FROM assets WHERE id = ?\n ", [r]))[0];
|
|
7648
|
+
if (!n || (await di(e, "SELECT 1 FROM node_assets WHERE assetId = ? LIMIT 1", [n.id])).length > 0) continue;
|
|
7640
7649
|
let i = [n];
|
|
7641
7650
|
if (!n.isSystemVariant) {
|
|
7642
|
-
let t = await
|
|
7643
|
-
if (r.length > 0 && (await
|
|
7651
|
+
let t = await di(e, "\n SELECT id, storageKeyPrivate, isSystemVariant, parentAssetId, filename\n FROM assets\n WHERE parentAssetId = ? OR (isSystemVariant = 1 AND filename LIKE ?)\n ", [n.id, `crop_%${String(n.filename || "").replace(/\.[^/.]+$/, "")}%`]), r = t.map((e) => e.id);
|
|
7652
|
+
if (r.length > 0 && (await di(e, `SELECT DISTINCT assetId FROM node_assets WHERE assetId IN (${r.map(() => "?").join(",")})`, r)).length > 0) continue;
|
|
7644
7653
|
i = [n, ...t];
|
|
7645
7654
|
}
|
|
7646
7655
|
for (let e of i) if (e.storageKeyPrivate) try {
|
|
@@ -7649,10 +7658,10 @@ async function yi(e, t, n) {
|
|
|
7649
7658
|
console.warn(`[Asset Cleanup] Failed to delete ${e.storageKeyPrivate}:`, t);
|
|
7650
7659
|
}
|
|
7651
7660
|
let a = i.map((e) => e.id), o = a.map(() => "?").join(",");
|
|
7652
|
-
await
|
|
7661
|
+
await fi(e, `DELETE FROM node_assets WHERE assetId IN (${o})`, a), await fi(e, `DELETE FROM assets WHERE id IN (${o})`, a);
|
|
7653
7662
|
}
|
|
7654
7663
|
}
|
|
7655
|
-
async function
|
|
7664
|
+
async function xi(e, t, n) {
|
|
7656
7665
|
let r = {}, i = null;
|
|
7657
7666
|
if (t) {
|
|
7658
7667
|
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 || [];
|
|
@@ -7677,7 +7686,7 @@ async function bi(e, t, n) {
|
|
|
7677
7686
|
inheritedFields: r
|
|
7678
7687
|
};
|
|
7679
7688
|
}
|
|
7680
|
-
|
|
7689
|
+
X.get("/", async (e) => {
|
|
7681
7690
|
let t = e.get("db"), n = e.req.query("id"), r = e.req.query("type"), i = e.req.query("q") || e.req.query("search"), a = e.req.query("channelId"), o = e.req.query("trashed") === "true", s = e.req.query("assetId"), c = e.req.query("sort") || "updatedAt", l = (e.req.query("order") || "DESC").toUpperCase() === "ASC" ? "ASC" : "DESC", u = e.req.query("limit"), d = e.req.query("offset"), f = Math.max(1, Math.min(100, parseInt(u || "50", 10))), p = Math.max(0, parseInt(d || "0", 10));
|
|
7682
7691
|
if (n) {
|
|
7683
7692
|
let r = Number(n);
|
|
@@ -7702,13 +7711,13 @@ Z.get("/", async (e) => {
|
|
|
7702
7711
|
updatedAt: i.updatedAt
|
|
7703
7712
|
}, s = i.draftDataJson || i.dataJson;
|
|
7704
7713
|
if (s) try {
|
|
7705
|
-
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 =
|
|
7714
|
+
let n = typeof s == "string" ? JSON.parse(s) : s, a = await t.prepare("SELECT id as treeNodeId, treeId, parentId FROM tree_nodes WHERE contentId = ? LIMIT 1").get(r), c = ui(e.env?.BUNDLED_DEFINITIONS).nodes?.[i.contentType] || {}, l = n.layoutId || null;
|
|
7706
7715
|
if (a) {
|
|
7707
|
-
let { resolvedLayoutId: e, inheritedFields: r } = await
|
|
7716
|
+
let { resolvedLayoutId: e, inheritedFields: r } = await xi(t, a.parentId, a.treeId);
|
|
7708
7717
|
(l === "inherit" || !l) && (l = e || c.defaultLayout || null);
|
|
7709
7718
|
for (let [e, t] of Object.entries(r)) (n[e] === void 0 || n[e] === null || n[e] === "") && t !== void 0 && (n[e] = t);
|
|
7710
7719
|
} else (l === "inherit" || !l) && (l = c.defaultLayout || null);
|
|
7711
|
-
let u = await
|
|
7720
|
+
let u = await si(t, vi(n));
|
|
7712
7721
|
Object.assign(o, u), o.resolvedLayoutId = l;
|
|
7713
7722
|
} catch {}
|
|
7714
7723
|
let c = await t.prepare("SELECT channelId FROM node_channels WHERE nodeId = ?").all(r);
|
|
@@ -7718,7 +7727,7 @@ Z.get("/", async (e) => {
|
|
|
7718
7727
|
let u = await t.prepare("\n SELECT * FROM content_blocks \n WHERE contentId = ? AND isDraft = 1 \n ORDER BY sortOrder ASC\n ").all(r), d = Array.isArray(u) ? u : u?.results || [], f = await Promise.all(d.map(async (e) => {
|
|
7719
7728
|
let n = {};
|
|
7720
7729
|
try {
|
|
7721
|
-
n = typeof e.dataJson == "string" ? JSON.parse(e.dataJson || "{}") : e.dataJson || {}, n && typeof n == "object" && (n = await
|
|
7730
|
+
n = typeof e.dataJson == "string" ? JSON.parse(e.dataJson || "{}") : e.dataJson || {}, n && typeof n == "object" && (n = await si(t, n));
|
|
7722
7731
|
} catch {
|
|
7723
7732
|
n = {};
|
|
7724
7733
|
}
|
|
@@ -7818,7 +7827,7 @@ Z.get("/", async (e) => {
|
|
|
7818
7827
|
assetCount: e.assetCount || 0
|
|
7819
7828
|
}, i = e.draftDataJson || e.dataJson;
|
|
7820
7829
|
if (i) try {
|
|
7821
|
-
let e = typeof i == "string" ? JSON.parse(i) : i, n = await
|
|
7830
|
+
let e = typeof i == "string" ? JSON.parse(i) : i, n = await si(t, vi(e));
|
|
7822
7831
|
Object.assign(r, n);
|
|
7823
7832
|
} catch {}
|
|
7824
7833
|
return r;
|
|
@@ -7830,107 +7839,88 @@ Z.get("/", async (e) => {
|
|
|
7830
7839
|
offset: p,
|
|
7831
7840
|
limit: f
|
|
7832
7841
|
});
|
|
7833
|
-
}),
|
|
7834
|
-
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,
|
|
7842
|
+
}), X.post("/", async (e) => {
|
|
7843
|
+
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 } = ii(vi(_)), b = gi(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();
|
|
7835
7844
|
if (a) {
|
|
7836
|
-
let
|
|
7845
|
+
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 || "{}";
|
|
7837
7846
|
try {
|
|
7838
|
-
|
|
7847
|
+
yi(typeof n == "string" ? JSON.parse(n) : n, T);
|
|
7839
7848
|
} catch {}
|
|
7840
7849
|
if (m !== void 0) {
|
|
7841
7850
|
let e = await t.prepare("SELECT dataJson FROM content_blocks WHERE contentId = ? AND isDraft = 1").all(a);
|
|
7842
7851
|
(Array.isArray(e) ? e : e?.results || []).forEach((e) => {
|
|
7843
7852
|
try {
|
|
7844
|
-
|
|
7853
|
+
yi(typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson, T);
|
|
7845
7854
|
} catch {}
|
|
7846
7855
|
});
|
|
7847
7856
|
}
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
id: a,
|
|
7858
|
-
status: n?.status || "published"
|
|
7859
|
-
});
|
|
7860
|
-
}
|
|
7861
|
-
{
|
|
7862
|
-
let e = o === void 0 ? n?.title || "Untitled" : o, r = s === void 0 ? n?.slug ?? null : mi(s), i = C || n?.contentType || "page", c = S || n?.language || "en", l = n?.draftDataJson || n?.dataJson || "{}", u = {};
|
|
7863
|
-
try {
|
|
7864
|
-
u = JSON.parse(l);
|
|
7865
|
-
} catch {}
|
|
7866
|
-
let d = JSON.stringify({
|
|
7867
|
-
...u,
|
|
7868
|
-
...y
|
|
7869
|
-
});
|
|
7870
|
-
await t.prepare("\n UPDATE content_nodes \n SET title = ?, \n slug = ?, \n language = ?,\n contentType = ?, \n isHidden = ?, \n status = 'draft', \n draftDataJson = ?, \n updatedById = ?, \n updatedAt = CURRENT_TIMESTAMP\n WHERE id = ?\n ").run(e, r, c, i, x, d, w, a);
|
|
7871
|
-
}
|
|
7857
|
+
let r = o === void 0 ? e?.title || "Untitled" : o, i = s === void 0 ? e?.slug ?? null : hi(s), c = S || e?.contentType || "page", l = x || e?.language || "en", u = e?.draftDataJson || e?.dataJson || "{}", d = {};
|
|
7858
|
+
try {
|
|
7859
|
+
d = JSON.parse(u);
|
|
7860
|
+
} catch {}
|
|
7861
|
+
let f = JSON.stringify({
|
|
7862
|
+
...d,
|
|
7863
|
+
...v
|
|
7864
|
+
});
|
|
7865
|
+
await t.prepare("\n UPDATE content_nodes \n SET title = ?, \n slug = ?, \n language = ?,\n contentType = ?, \n isHidden = ?, \n status = 'draft', \n draftDataJson = ?, \n updatedById = ?, \n updatedAt = CURRENT_TIMESTAMP\n WHERE id = ?\n ").run(r, i, l, c, b, f, C, a);
|
|
7872
7866
|
} else {
|
|
7873
|
-
let e = o || "Untitled", n =
|
|
7874
|
-
|
|
7867
|
+
let e = o || "Untitled", n = hi(s), r = JSON.stringify(v), i = await t.prepare("\n INSERT INTO content_nodes (contentType, title, slug, language, isHidden, status, draftDataJson, dataJson, createdById, updatedById)\n VALUES (?, ?, ?, ?, ?, 'draft', ?, NULL, ?, ?)\n ").run(S, e, n, x, b, r, C, C);
|
|
7868
|
+
w = Number(i.lastInsertRowid);
|
|
7875
7869
|
}
|
|
7876
|
-
if (h !== void 0 && Array.isArray(h) &&
|
|
7877
|
-
await t.prepare("DELETE FROM node_channels WHERE nodeId = ?").run(
|
|
7870
|
+
if (h !== void 0 && Array.isArray(h) && w) {
|
|
7871
|
+
await t.prepare("DELETE FROM node_channels WHERE nodeId = ?").run(w);
|
|
7878
7872
|
let e = h.map((e) => typeof e == "object" && e ? e.id || e.channelId : e), n = [...new Set(e)].filter((e) => e && e !== "all").map((e) => Number(e) || e);
|
|
7879
7873
|
if (n.length > 0) {
|
|
7880
|
-
let e = n.map(() => "(?, ?)").join(", "), r = n.flatMap((e) => [
|
|
7874
|
+
let e = n.map(() => "(?, ?)").join(", "), r = n.flatMap((e) => [w, e]);
|
|
7881
7875
|
await t.prepare(`INSERT OR IGNORE INTO node_channels (nodeId, channelId) VALUES ${e}`).run(...r);
|
|
7882
7876
|
}
|
|
7883
7877
|
}
|
|
7884
|
-
if (g !== void 0 && Array.isArray(g) &&
|
|
7885
|
-
await t.prepare("DELETE FROM tree_nodes WHERE contentId = ?").run(
|
|
7878
|
+
if (g !== void 0 && Array.isArray(g) && w) {
|
|
7879
|
+
await t.prepare("DELETE FROM tree_nodes WHERE contentId = ?").run(w);
|
|
7886
7880
|
let e = /* @__PURE__ */ new Set(), n = [], r = [];
|
|
7887
7881
|
for (let t of g) if (t && t.treeId) {
|
|
7888
7882
|
let i = Number(t.treeId) || t.treeId;
|
|
7889
7883
|
if (!e.has(i)) {
|
|
7890
7884
|
e.add(i);
|
|
7891
|
-
let a =
|
|
7892
|
-
n.push("(?, ?, ?, ?)"), r.push(i,
|
|
7885
|
+
let a = _i(t.parentId ?? t._draftParentId ?? null), o = typeof t.sortOrder == "number" ? t.sortOrder : 0;
|
|
7886
|
+
n.push("(?, ?, ?, ?)"), r.push(i, w, a, o);
|
|
7893
7887
|
}
|
|
7894
7888
|
}
|
|
7895
7889
|
n.length > 0 && await t.prepare(`INSERT INTO tree_nodes (treeId, contentId, parentId, sortOrder) VALUES ${n.join(", ")}`).run(...r);
|
|
7896
7890
|
}
|
|
7897
|
-
let
|
|
7898
|
-
if (m !== void 0 && Array.isArray(m) &&
|
|
7899
|
-
await t.prepare("DELETE FROM content_blocks WHERE contentId = ? AND isDraft = 1").run(
|
|
7891
|
+
let E = [];
|
|
7892
|
+
if (m !== void 0 && Array.isArray(m) && w) {
|
|
7893
|
+
await t.prepare("DELETE FROM content_blocks WHERE contentId = ? AND isDraft = 1").run(w);
|
|
7900
7894
|
let e = [], n = [];
|
|
7901
7895
|
for (let t = 0; t < m.length; t++) {
|
|
7902
|
-
let r = m[t], i = r.componentId || r.elementType || "text-block", a = r.data || {}, o = String(r.blockId || a.blockId || r.instanceId || r.id || `block-${Date.now()}`), { cleanedData: s, assetRefs: c } =
|
|
7896
|
+
let r = m[t], i = r.componentId || r.elementType || "text-block", a = r.data || {}, o = String(r.blockId || a.blockId || r.instanceId || r.id || `block-${Date.now()}`), { cleanedData: s, assetRefs: c } = ii({
|
|
7903
7897
|
...a,
|
|
7904
7898
|
blockId: o,
|
|
7905
7899
|
_instanceId: o
|
|
7906
7900
|
});
|
|
7907
7901
|
c.forEach((e) => {
|
|
7908
|
-
|
|
7902
|
+
E.push({
|
|
7909
7903
|
...e,
|
|
7910
7904
|
fieldKey: `blocks[${t}].${e.fieldKey}`
|
|
7911
7905
|
});
|
|
7912
7906
|
});
|
|
7913
7907
|
let l = r.region !== void 0 && r.region !== null && String(r.region).trim() !== "" ? String(r.region) : "content";
|
|
7914
|
-
e.push("(?, ?, ?, ?, ?, 1)"), n.push(
|
|
7908
|
+
e.push("(?, ?, ?, ?, ?, 1)"), n.push(w, t, i, JSON.stringify(s), l);
|
|
7915
7909
|
}
|
|
7916
7910
|
e.length > 0 && await t.prepare(`INSERT INTO content_blocks (contentId, sortOrder, elementType, dataJson, region, isDraft) VALUES ${e.join(", ")}`).run(...n);
|
|
7917
7911
|
}
|
|
7918
|
-
if (
|
|
7919
|
-
let n = [...
|
|
7920
|
-
await
|
|
7921
|
-
let r = new Set(n.map((e) => e.assetId)), i = new Set([...
|
|
7922
|
-
i.size > 0 && await
|
|
7923
|
-
}
|
|
7924
|
-
if (await J(e).clear(), T) {
|
|
7925
|
-
let n = new X(e.env), r = o === void 0 ? s : mi(s);
|
|
7926
|
-
await n.purgeInternalWorkerCache(e, t, T, r || "", S);
|
|
7912
|
+
if (w) {
|
|
7913
|
+
let n = [...y, ...E];
|
|
7914
|
+
await ai(t, w, n);
|
|
7915
|
+
let r = new Set(n.map((e) => e.assetId)), i = new Set([...T].filter((e) => !r.has(e)));
|
|
7916
|
+
i.size > 0 && await bi(t, ri(e.env), i);
|
|
7927
7917
|
}
|
|
7928
|
-
return e.json({
|
|
7918
|
+
return await q(e).clear(), e.json({
|
|
7929
7919
|
success: !0,
|
|
7930
|
-
id:
|
|
7920
|
+
id: w,
|
|
7931
7921
|
status: "draft"
|
|
7932
7922
|
});
|
|
7933
|
-
}),
|
|
7923
|
+
}), X.post("/publish", async (e) => {
|
|
7934
7924
|
let t = e.get("db"), n = await e.req.json(), r = n.id || n.nodeId;
|
|
7935
7925
|
if (!r || isNaN(Number(r))) return e.json({ error: "Node ID required for publishing" }, 400);
|
|
7936
7926
|
let i = Number(r), a = e.get("user")?.id || null, o = await t.prepare("SELECT * FROM content_nodes WHERE id = ?").get(i);
|
|
@@ -7943,7 +7933,7 @@ Z.get("/", async (e) => {
|
|
|
7943
7933
|
try {
|
|
7944
7934
|
c = typeof o.draftDataJson == "string" ? JSON.parse(o.draftDataJson) : o.draftDataJson || {};
|
|
7945
7935
|
} catch {}
|
|
7946
|
-
let l = s.title
|
|
7936
|
+
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 || "{}";
|
|
7947
7937
|
await t.prepare("\n UPDATE content_nodes\n SET publishedDataJson = ?,\n dataJson = ?,\n publishedAt = CURRENT_TIMESTAMP,\n status = 'published',\n updatedById = ?,\n 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);
|
|
7948
7938
|
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 || [];
|
|
7949
7939
|
if (g.length > 0) {
|
|
@@ -7963,12 +7953,11 @@ Z.get("/", async (e) => {
|
|
|
7963
7953
|
},
|
|
7964
7954
|
blocks: g
|
|
7965
7955
|
};
|
|
7966
|
-
await t.prepare("\n INSERT INTO node_revisions (nodeId, version, snapshotJson, createdById)\n VALUES (?, ?, ?, ?)\n ").run(i, _, v.publishedAt, a), await
|
|
7967
|
-
let y = new
|
|
7956
|
+
await t.prepare("\n INSERT INTO node_revisions (nodeId, version, snapshotJson, createdById)\n VALUES (?, ?, ?, ?)\n ").run(i, _, v.publishedAt, a), await q(e).clear();
|
|
7957
|
+
let y = new Y(e.env);
|
|
7968
7958
|
await y.purgeInternalWorkerCache(e, t, i, o.slug, o.language || "en");
|
|
7969
|
-
let b = await
|
|
7970
|
-
y.purgeSmart(e, t, i, o.slug, b, p);
|
|
7971
|
-
for (let t of x) y.purgeAndWarmSlug(e, t);
|
|
7959
|
+
let b = await pi(t, i), x = await mi(t, i);
|
|
7960
|
+
if (y.purgeSmart(e, t, i, o.slug, b, p), !p && x.length > 0) for (let t of x) y.purgeAndWarmSlug(e, t);
|
|
7972
7961
|
return e.json({
|
|
7973
7962
|
success: !0,
|
|
7974
7963
|
id: i,
|
|
@@ -7976,47 +7965,47 @@ Z.get("/", async (e) => {
|
|
|
7976
7965
|
version: _,
|
|
7977
7966
|
publishedAt: v.publishedAt
|
|
7978
7967
|
});
|
|
7979
|
-
}),
|
|
7968
|
+
}), X.delete("/", async (e) => {
|
|
7980
7969
|
let t = e.get("db"), n = e.req.query("id");
|
|
7981
7970
|
if (!n) return e.json({ error: "Node ID required" }, 400);
|
|
7982
7971
|
let r = Number(n), i = await t.prepare("SELECT slug, language, status FROM content_nodes WHERE id = ?").get(r);
|
|
7983
|
-
await t.prepare("UPDATE content_nodes SET deletedAt = CURRENT_TIMESTAMP WHERE id = ?").run(r), await
|
|
7984
|
-
let a = new
|
|
7972
|
+
await t.prepare("UPDATE content_nodes SET deletedAt = CURRENT_TIMESTAMP WHERE id = ?").run(r), await q(e).clear();
|
|
7973
|
+
let a = new Y(e.env);
|
|
7985
7974
|
if (i && await a.purgeInternalWorkerCache(e, t, r, i.slug, i.language || "en"), i && i.status === "published") {
|
|
7986
|
-
let n = await
|
|
7975
|
+
let n = await pi(t, r);
|
|
7987
7976
|
a.purgeSmart(e, t, r, i.slug, n, !0);
|
|
7988
7977
|
}
|
|
7989
7978
|
return e.json({
|
|
7990
7979
|
success: !0,
|
|
7991
7980
|
deletedNodeId: r
|
|
7992
7981
|
});
|
|
7993
|
-
}),
|
|
7982
|
+
}), X.post("/restore", async (e) => {
|
|
7994
7983
|
let t = e.get("db"), n = await e.req.json(), r = Number(n.id);
|
|
7995
7984
|
if (!r) return e.json({ error: "Node ID required" }, 400);
|
|
7996
7985
|
let i = await t.prepare("SELECT slug, language, status FROM content_nodes WHERE id = ?").get(r);
|
|
7997
|
-
await t.prepare("UPDATE content_nodes SET deletedAt = NULL WHERE id = ?").run(r), await
|
|
7998
|
-
let a = new
|
|
7986
|
+
await t.prepare("UPDATE content_nodes SET deletedAt = NULL WHERE id = ?").run(r), await q(e).clear();
|
|
7987
|
+
let a = new Y(e.env);
|
|
7999
7988
|
if (i && await a.purgeInternalWorkerCache(e, t, r, i.slug, i.language || "en"), i && i.status === "published") {
|
|
8000
|
-
let n = await
|
|
7989
|
+
let n = await pi(t, r);
|
|
8001
7990
|
a.purgeSmart(e, t, r, i.slug, n, !0);
|
|
8002
7991
|
}
|
|
8003
7992
|
return e.json({
|
|
8004
7993
|
success: !0,
|
|
8005
7994
|
restoredNodeId: r
|
|
8006
7995
|
});
|
|
8007
|
-
}),
|
|
7996
|
+
}), X.delete("/purge", async (e) => {
|
|
8008
7997
|
let t = e.get("db"), n = e.req.query("id");
|
|
8009
7998
|
if (!n) return e.json({ error: "Node ID required" }, 400);
|
|
8010
|
-
let r = Number(n), i = await t.prepare("SELECT slug, language, status FROM content_nodes WHERE id = ?").get(r), a = await
|
|
8011
|
-
return i && await o.purgeInternalWorkerCache(e, t, r, i.slug, i.language || "en"), 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
|
|
7999
|
+
let r = Number(n), i = await t.prepare("SELECT slug, language, status FROM content_nodes WHERE id = ?").get(r), a = await pi(t, r), o = new Y(e.env);
|
|
8000
|
+
return i && await o.purgeInternalWorkerCache(e, t, r, i.slug, i.language || "en"), await t.prepare("DELETE FROM node_channels WHERE nodeId = ?").run(r), await t.prepare("DELETE FROM tree_nodes WHERE contentId = ?").run(r), await t.prepare("DELETE FROM content_blocks WHERE contentId = ?").run(r), await t.prepare("DELETE FROM node_revisions WHERE nodeId = ?").run(r), await t.prepare("DELETE FROM node_assets WHERE nodeId = ?").run(r), await t.prepare("DELETE FROM content_nodes WHERE id = ?").run(r), await q(e).clear(), i && i.status === "published" && o.purgeSmart(e, t, r, i.slug, a, !0), e.json({
|
|
8012
8001
|
success: !0,
|
|
8013
8002
|
purgedNodeId: r
|
|
8014
8003
|
});
|
|
8015
8004
|
});
|
|
8016
8005
|
//#endregion
|
|
8017
8006
|
//#region server/routes/admin/trees.ts
|
|
8018
|
-
var
|
|
8019
|
-
function
|
|
8007
|
+
var Si = new e();
|
|
8008
|
+
function Ci(e, t = null) {
|
|
8020
8009
|
let n = [];
|
|
8021
8010
|
for (let r = 0; r < e.length; r++) {
|
|
8022
8011
|
let i = e[r];
|
|
@@ -8028,19 +8017,19 @@ function Si(e, t = null) {
|
|
|
8028
8017
|
id: o,
|
|
8029
8018
|
parentId: t,
|
|
8030
8019
|
sortOrder: r
|
|
8031
|
-
}), i.children && Array.isArray(i.children) && i.children.length > 0 && n.push(...
|
|
8020
|
+
}), i.children && Array.isArray(i.children) && i.children.length > 0 && n.push(...Ci(i.children, o)));
|
|
8032
8021
|
}
|
|
8033
8022
|
return n;
|
|
8034
8023
|
}
|
|
8035
|
-
function
|
|
8024
|
+
function wi(e) {
|
|
8036
8025
|
if (e == null || e === "null" || e === "" || typeof e == "string" && e.startsWith("draft-")) return null;
|
|
8037
8026
|
let t = Number(e);
|
|
8038
8027
|
return isNaN(t) ? null : t;
|
|
8039
8028
|
}
|
|
8040
|
-
function
|
|
8029
|
+
function Ti(e) {
|
|
8041
8030
|
return +(e === !0 || e === 1 || e === "1" || e === "true");
|
|
8042
8031
|
}
|
|
8043
|
-
|
|
8032
|
+
Si.get("/tree.json", async (e) => {
|
|
8044
8033
|
try {
|
|
8045
8034
|
let t = e.get("db"), n = e.req.query("treeId") || "main-nav", r = e.req.query("preview") === "true", i = 1;
|
|
8046
8035
|
if (isNaN(Number(n))) {
|
|
@@ -8090,9 +8079,9 @@ xi.get("/tree.json", async (e) => {
|
|
|
8090
8079
|
} catch (t) {
|
|
8091
8080
|
return console.error("[CMS Tree API] GET Error:", t), e.json({ error: t.message || "Failed to fetch tree" }, 500);
|
|
8092
8081
|
}
|
|
8093
|
-
}),
|
|
8082
|
+
}), Si.post("/tree.json", async (e) => {
|
|
8094
8083
|
try {
|
|
8095
|
-
let t = e.get("db"), n = await e.req.json(), r = n.treeId ? String(n.treeId).trim() : "main-nav", i =
|
|
8084
|
+
let t = e.get("db"), n = await e.req.json(), r = n.treeId ? String(n.treeId).trim() : "main-nav", i = q(e), a = new Y(e.env), o = 1;
|
|
8096
8085
|
if (isNaN(Number(r))) {
|
|
8097
8086
|
let e = await t.prepare("SELECT id FROM trees WHERE key = ?").get(r);
|
|
8098
8087
|
if (e && e.id) o = Number(e.id);
|
|
@@ -8102,7 +8091,7 @@ xi.get("/tree.json", async (e) => {
|
|
|
8102
8091
|
}
|
|
8103
8092
|
} else o = Number(r);
|
|
8104
8093
|
if (n.tree && Array.isArray(n.tree)) {
|
|
8105
|
-
let r =
|
|
8094
|
+
let r = Ci(n.tree, null);
|
|
8106
8095
|
if (r.length > 0) for (let e = 0; e < r.length; e += 50) {
|
|
8107
8096
|
let n = r.slice(e, e + 50), i = n.map((e) => e.id), a = i.map(() => "?").join(","), s = "UPDATE tree_nodes SET \n";
|
|
8108
8097
|
s += "parentId = CASE id \n", n.forEach(() => {
|
|
@@ -8117,14 +8106,14 @@ xi.get("/tree.json", async (e) => {
|
|
|
8117
8106
|
c.push(e.id, e.sortOrder);
|
|
8118
8107
|
}), c.push(...i), c.push(o), await t.prepare(s).run(...c);
|
|
8119
8108
|
}
|
|
8120
|
-
return await i.clear(), e.executionCtx && typeof e.executionCtx.waitUntil == "function" ? e.executionCtx.waitUntil(a.
|
|
8109
|
+
return await i.clear(), e.executionCtx && typeof e.executionCtx.waitUntil == "function" ? e.executionCtx.waitUntil(a.purgeGlobalCacheDirect(e, t)) : await a.purgeGlobalCacheDirect(e, t), e.json({
|
|
8121
8110
|
success: !0,
|
|
8122
8111
|
reorderedCount: r.length
|
|
8123
8112
|
});
|
|
8124
8113
|
}
|
|
8125
|
-
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 =
|
|
8114
|
+
let { action: s, title: c, nodeType: l, parentId: u, contentId: d, nodeData: f = {}, pageData: p = {} } = n, m = Object.keys(f).length > 0 ? { ...f } : { ...p }, h = Ti(n.isHidden === void 0 ? m.isHidden === void 0 ? m.hidden : m.isHidden : n.isHidden);
|
|
8126
8115
|
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;
|
|
8127
|
-
let g =
|
|
8116
|
+
let g = wi(u), _ = e.get("user")?.id || null;
|
|
8128
8117
|
if (s === "create") {
|
|
8129
8118
|
let r = m.slug || n.slug || c, s = r ? String(r).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "") : null;
|
|
8130
8119
|
if (s) {
|
|
@@ -8156,7 +8145,7 @@ xi.get("/tree.json", async (e) => {
|
|
|
8156
8145
|
let e = b.map(() => "(?, ?)").join(", "), n = b.flatMap((e) => [f, e]);
|
|
8157
8146
|
await t.prepare(`INSERT OR IGNORE INTO node_channels (nodeId, channelId) VALUES ${e}`).run(...n);
|
|
8158
8147
|
}
|
|
8159
|
-
return await i.clear(), e.executionCtx && typeof e.executionCtx.waitUntil == "function" ? e.executionCtx.waitUntil(a.
|
|
8148
|
+
return await i.clear(), e.executionCtx && typeof e.executionCtx.waitUntil == "function" ? e.executionCtx.waitUntil(a.purgeGlobalCacheDirect(e, t)) : await a.purgeGlobalCacheDirect(e, t), e.json({
|
|
8160
8149
|
success: !0,
|
|
8161
8150
|
id: f,
|
|
8162
8151
|
treeNodeId: v,
|
|
@@ -8194,14 +8183,14 @@ xi.get("/tree.json", async (e) => {
|
|
|
8194
8183
|
}
|
|
8195
8184
|
await t.prepare("DELETE FROM tree_nodes WHERE treeId = ? AND contentId = ?").run(o, d);
|
|
8196
8185
|
let r = await t.prepare("\n INSERT INTO tree_nodes (treeId, contentId, parentId, sortOrder)\n VALUES (?, ?, ?, 0)\n ").run(o, d, g), s = Number(r.lastInsertRowid);
|
|
8197
|
-
return await i.clear(), e.executionCtx && typeof e.executionCtx.waitUntil == "function" ? e.executionCtx.waitUntil(a.
|
|
8186
|
+
return await i.clear(), e.executionCtx && typeof e.executionCtx.waitUntil == "function" ? e.executionCtx.waitUntil(a.purgeGlobalCacheDirect(e, t)) : await a.purgeGlobalCacheDirect(e, t), e.json({
|
|
8198
8187
|
success: !0,
|
|
8199
8188
|
treeNodeId: s
|
|
8200
8189
|
});
|
|
8201
8190
|
}
|
|
8202
8191
|
if (s === "detach") {
|
|
8203
8192
|
let r = n.treeNodeId || n.contentId;
|
|
8204
|
-
return r ? (await t.prepare("\n UPDATE tree_nodes \n SET parentId = (SELECT parentId FROM tree_nodes WHERE (id = ? OR contentId = ?) AND treeId = ?) \n WHERE parentId = ? AND treeId = ?\n ").run(r, r, o, r, o), await t.prepare("DELETE FROM tree_nodes WHERE (id = ? OR contentId = ?) AND treeId = ?").run(r, r, o), await i.clear(), e.executionCtx && typeof e.executionCtx.waitUntil == "function" ? e.executionCtx.waitUntil(a.
|
|
8193
|
+
return r ? (await t.prepare("\n UPDATE tree_nodes \n SET parentId = (SELECT parentId FROM tree_nodes WHERE (id = ? OR contentId = ?) AND treeId = ?) \n WHERE parentId = ? AND treeId = ?\n ").run(r, r, o, r, o), await t.prepare("DELETE FROM tree_nodes WHERE (id = ? OR contentId = ?) AND treeId = ?").run(r, r, o), await i.clear(), e.executionCtx && typeof e.executionCtx.waitUntil == "function" ? e.executionCtx.waitUntil(a.purgeGlobalCacheDirect(e, t)) : await a.purgeGlobalCacheDirect(e, t), e.json({ success: !0 })) : e.json({ error: "treeNodeId or contentId required for detach" }, 400);
|
|
8205
8194
|
}
|
|
8206
8195
|
return e.json({ error: "Invalid payload or action" }, 400);
|
|
8207
8196
|
} catch (t) {
|
|
@@ -8210,7 +8199,7 @@ xi.get("/tree.json", async (e) => {
|
|
|
8210
8199
|
details: t.message
|
|
8211
8200
|
}, 500);
|
|
8212
8201
|
}
|
|
8213
|
-
}),
|
|
8202
|
+
}), Si.get("/trees.json", async (e) => {
|
|
8214
8203
|
try {
|
|
8215
8204
|
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) => {
|
|
8216
8205
|
let n = Number(t.treeId), r = Number(t.channelId);
|
|
@@ -8240,7 +8229,7 @@ xi.get("/tree.json", async (e) => {
|
|
|
8240
8229
|
} catch {
|
|
8241
8230
|
return e.json([]);
|
|
8242
8231
|
}
|
|
8243
|
-
}),
|
|
8232
|
+
}), Si.post("/trees.json", async (e) => {
|
|
8244
8233
|
try {
|
|
8245
8234
|
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 };
|
|
8246
8235
|
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({
|
|
@@ -8265,9 +8254,9 @@ xi.get("/tree.json", async (e) => {
|
|
|
8265
8254
|
await t.prepare(`INSERT OR IGNORE INTO channel_trees (channelId, treeId, key) VALUES ${n}`).run(...r);
|
|
8266
8255
|
}
|
|
8267
8256
|
}
|
|
8268
|
-
await
|
|
8269
|
-
let m = new
|
|
8270
|
-
return e.executionCtx && typeof e.executionCtx.waitUntil == "function" ? e.executionCtx.waitUntil(m.
|
|
8257
|
+
await q(e).clear();
|
|
8258
|
+
let m = new Y(e.env);
|
|
8259
|
+
return e.executionCtx && typeof e.executionCtx.waitUntil == "function" ? e.executionCtx.waitUntil(m.purgeGlobalCacheDirect(e, t)) : await m.purgeGlobalCacheDirect(e, t), e.json({
|
|
8271
8260
|
success: !0,
|
|
8272
8261
|
id: p,
|
|
8273
8262
|
key: o,
|
|
@@ -8281,14 +8270,14 @@ xi.get("/tree.json", async (e) => {
|
|
|
8281
8270
|
} catch (t) {
|
|
8282
8271
|
return console.error("[API Trees] Error saving tree:", t), e.json({ error: t.message || "Failed to save tree" }, 500);
|
|
8283
8272
|
}
|
|
8284
|
-
}),
|
|
8273
|
+
}), Si.delete("/trees.json", async (e) => {
|
|
8285
8274
|
let t = e.get("db"), n = e.req.query("id");
|
|
8286
8275
|
if (!n) return e.json({ error: "Tree ID required" }, 400);
|
|
8287
8276
|
let r = Number(n);
|
|
8288
8277
|
try {
|
|
8289
|
-
await t.prepare("DELETE FROM trees WHERE id = ?").run(r), await t.prepare("DELETE FROM channel_trees WHERE treeId = ?").run(r), await t.prepare("DELETE FROM tree_nodes WHERE treeId = ?").run(r), await
|
|
8290
|
-
let n = new
|
|
8291
|
-
return e.executionCtx && typeof e.executionCtx.waitUntil == "function" ? e.executionCtx.waitUntil(n.
|
|
8278
|
+
await t.prepare("DELETE FROM trees WHERE id = ?").run(r), await t.prepare("DELETE FROM channel_trees WHERE treeId = ?").run(r), await t.prepare("DELETE FROM tree_nodes WHERE treeId = ?").run(r), await q(e).clear();
|
|
8279
|
+
let n = new Y(e.env);
|
|
8280
|
+
return e.executionCtx && typeof e.executionCtx.waitUntil == "function" ? e.executionCtx.waitUntil(n.purgeGlobalCacheDirect(e, t)) : await n.purgeGlobalCacheDirect(e, t), e.json({
|
|
8292
8281
|
success: !0,
|
|
8293
8282
|
deletedTreeId: r
|
|
8294
8283
|
});
|
|
@@ -8298,8 +8287,8 @@ xi.get("/tree.json", async (e) => {
|
|
|
8298
8287
|
});
|
|
8299
8288
|
//#endregion
|
|
8300
8289
|
//#region server/routes/admin/channels.ts
|
|
8301
|
-
var
|
|
8302
|
-
|
|
8290
|
+
var Ei = new e();
|
|
8291
|
+
Ei.get("/", async (e) => {
|
|
8303
8292
|
try {
|
|
8304
8293
|
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) => {
|
|
8305
8294
|
e[t.channelId] || (e[t.channelId] = []);
|
|
@@ -8323,7 +8312,7 @@ Ti.get("/", async (e) => {
|
|
|
8323
8312
|
isHidden: !!e.isHidden,
|
|
8324
8313
|
trees: a[e.id] || []
|
|
8325
8314
|
};
|
|
8326
|
-
}), s = e.env?.BUNDLED_DEFINITIONS, c =
|
|
8315
|
+
}), s = e.env?.BUNDLED_DEFINITIONS, c = ui(s)?.channelTemplate || {
|
|
8327
8316
|
label: "Channel Settings",
|
|
8328
8317
|
fields: {
|
|
8329
8318
|
key: {
|
|
@@ -8365,7 +8354,7 @@ Ti.get("/", async (e) => {
|
|
|
8365
8354
|
error: t.message
|
|
8366
8355
|
}, 500);
|
|
8367
8356
|
}
|
|
8368
|
-
}),
|
|
8357
|
+
}), Ei.post("/", async (e) => {
|
|
8369
8358
|
try {
|
|
8370
8359
|
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;
|
|
8371
8360
|
if (await t.prepare("SELECT id FROM channels WHERE key = ? AND id != ? LIMIT 1").get(y, i ?? -1)) return e.json({
|
|
@@ -8392,7 +8381,9 @@ Ti.get("/", async (e) => {
|
|
|
8392
8381
|
VALUES ${e}
|
|
8393
8382
|
`).run(...n);
|
|
8394
8383
|
}
|
|
8395
|
-
|
|
8384
|
+
await q(e).clear();
|
|
8385
|
+
let E = new Y(e.env);
|
|
8386
|
+
return e.executionCtx && typeof e.executionCtx.waitUntil == "function" ? e.executionCtx.waitUntil(E.purgeGlobalCacheDirect(e, t)) : await E.purgeGlobalCacheDirect(e, t), e.json({
|
|
8396
8387
|
success: !0,
|
|
8397
8388
|
id: w
|
|
8398
8389
|
});
|
|
@@ -8402,12 +8393,14 @@ Ti.get("/", async (e) => {
|
|
|
8402
8393
|
details: t.message
|
|
8403
8394
|
}, 500);
|
|
8404
8395
|
}
|
|
8405
|
-
}),
|
|
8396
|
+
}), Ei.delete("/", async (e) => {
|
|
8406
8397
|
let t = e.get("db"), n = e.req.query("id");
|
|
8407
8398
|
if (!n) return e.json({ error: "Channel ID required" }, 400);
|
|
8408
8399
|
let r = Number(n);
|
|
8409
8400
|
try {
|
|
8410
|
-
|
|
8401
|
+
await t.prepare("DELETE FROM channel_trees WHERE channelId = ?").run(r), await t.prepare("DELETE FROM node_channels WHERE channelId = ?").run(r), await t.prepare("DELETE FROM channels WHERE id = ?").run(r), await q(e).clear();
|
|
8402
|
+
let n = new Y(e.env);
|
|
8403
|
+
return e.executionCtx && typeof e.executionCtx.waitUntil == "function" ? e.executionCtx.waitUntil(n.purgeGlobalCacheDirect(e, t)) : await n.purgeGlobalCacheDirect(e, t), e.json({
|
|
8411
8404
|
success: !0,
|
|
8412
8405
|
deletedSiteId: r
|
|
8413
8406
|
});
|
|
@@ -8420,10 +8413,10 @@ Ti.get("/", async (e) => {
|
|
|
8420
8413
|
});
|
|
8421
8414
|
//#endregion
|
|
8422
8415
|
//#region server/routes/admin/schemas.ts
|
|
8423
|
-
var
|
|
8416
|
+
var Di = new e(), Oi = null, ki = (e) => {
|
|
8424
8417
|
try {
|
|
8425
|
-
if (!
|
|
8426
|
-
let t =
|
|
8418
|
+
if (!Oi) {
|
|
8419
|
+
let t = li(e.env?.BUNDLED_DEFINITIONS || kr), n = t.userTemplate || {
|
|
8427
8420
|
id: "userTemplate",
|
|
8428
8421
|
label: "User Account",
|
|
8429
8422
|
fields: {
|
|
@@ -8459,7 +8452,7 @@ var Ei = new e(), Di = null, Oi = (e) => {
|
|
|
8459
8452
|
}
|
|
8460
8453
|
}
|
|
8461
8454
|
};
|
|
8462
|
-
|
|
8455
|
+
Oi = {
|
|
8463
8456
|
channelTemplate: t.channelTemplate || null,
|
|
8464
8457
|
treeTemplate: t.treeTemplate || null,
|
|
8465
8458
|
userTemplate: n,
|
|
@@ -8471,7 +8464,7 @@ var Ei = new e(), Di = null, Oi = (e) => {
|
|
|
8471
8464
|
blockLayouts: t.blockLayouts || {}
|
|
8472
8465
|
};
|
|
8473
8466
|
}
|
|
8474
|
-
return e.json(
|
|
8467
|
+
return e.json(Oi, 200, { "Cache-Control": "public, max-age=300, stale-while-revalidate=86400" });
|
|
8475
8468
|
} catch (t) {
|
|
8476
8469
|
return console.error("[CMS API] Error loading schemas:", t), e.json({
|
|
8477
8470
|
error: "Failed to load schemas",
|
|
@@ -8479,10 +8472,10 @@ var Ei = new e(), Di = null, Oi = (e) => {
|
|
|
8479
8472
|
}, 500);
|
|
8480
8473
|
}
|
|
8481
8474
|
};
|
|
8482
|
-
|
|
8475
|
+
Di.get("/", ki), Di.get("/schemas.json", ki);
|
|
8483
8476
|
//#endregion
|
|
8484
8477
|
//#region server/routes/admin/validation.ts
|
|
8485
|
-
var
|
|
8478
|
+
var Ai = new e(), ji = {
|
|
8486
8479
|
node: "content_nodes",
|
|
8487
8480
|
nodes: "content_nodes",
|
|
8488
8481
|
content_node: "content_nodes",
|
|
@@ -8494,7 +8487,7 @@ var ki = new e(), Ai = {
|
|
|
8494
8487
|
user: "users",
|
|
8495
8488
|
users: "users",
|
|
8496
8489
|
user_account: "user_accounts"
|
|
8497
|
-
},
|
|
8490
|
+
}, Mi = {
|
|
8498
8491
|
content_nodes: [
|
|
8499
8492
|
"id",
|
|
8500
8493
|
"title",
|
|
@@ -8551,11 +8544,11 @@ var ki = new e(), Ai = {
|
|
|
8551
8544
|
"createdAt"
|
|
8552
8545
|
]
|
|
8553
8546
|
};
|
|
8554
|
-
|
|
8547
|
+
Ai.post("/validate-unique", async (e) => {
|
|
8555
8548
|
try {
|
|
8556
8549
|
let t = e.get("db"), { entityType: n, field: r, value: i, excludeId: a } = await e.req.json();
|
|
8557
8550
|
if (!r || i == null || String(i).trim() === "") return e.json({ isUnique: !0 });
|
|
8558
|
-
let o =
|
|
8551
|
+
let o = ji[n] || "content_nodes", s = r.replace(/[^a-zA-Z0-9_]/g, ""), c = (Mi[o] || Mi.content_nodes).includes(s), l = -1;
|
|
8559
8552
|
if (a != null && String(a).trim() !== "") {
|
|
8560
8553
|
let e = Number(a);
|
|
8561
8554
|
l = isNaN(e) ? String(a) : e;
|
|
@@ -8567,7 +8560,7 @@ ki.post("/validate-unique", async (e) => {
|
|
|
8567
8560
|
} catch (t) {
|
|
8568
8561
|
return console.error("[API Validation] Error validating global uniqueness:", t), e.json({ error: "Failed to validate uniqueness" }, 500);
|
|
8569
8562
|
}
|
|
8570
|
-
}),
|
|
8563
|
+
}), Ai.post("/validate-unique-sibling", async (e) => {
|
|
8571
8564
|
try {
|
|
8572
8565
|
let t = e.get("db"), { slug: n, treeId: r, parentId: i, excludeTreeNodeId: a } = await e.req.json();
|
|
8573
8566
|
if (!n || !String(n).trim() || !r) return e.json({ isUnique: !0 });
|
|
@@ -8594,8 +8587,8 @@ ki.post("/validate-unique", async (e) => {
|
|
|
8594
8587
|
});
|
|
8595
8588
|
//#endregion
|
|
8596
8589
|
//#region server/routes/admin/stats.ts
|
|
8597
|
-
var
|
|
8598
|
-
|
|
8590
|
+
var Ni = new e();
|
|
8591
|
+
Ni.get("/", async (e) => {
|
|
8599
8592
|
try {
|
|
8600
8593
|
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) => ({
|
|
8601
8594
|
...e,
|
|
@@ -8610,7 +8603,7 @@ Mi.get("/", async (e) => {
|
|
|
8610
8603
|
isHidden: !!e.isHidden,
|
|
8611
8604
|
channelNames: e.channelLabels ? e.channelLabels.split(",") : [],
|
|
8612
8605
|
treeNames: e.treeLabels ? e.treeLabels.split(",") : []
|
|
8613
|
-
})), p = e.env?.BUNDLED_DEFINITIONS, m =
|
|
8606
|
+
})), p = e.env?.BUNDLED_DEFINITIONS, m = li(p), h = m.nodes || m.nodeSchemas || {}, g = c.map((e) => {
|
|
8614
8607
|
let t = e.type || "node", n = h[t]?.label || t.charAt(0).toUpperCase() + t.slice(1);
|
|
8615
8608
|
return {
|
|
8616
8609
|
type: t,
|
|
@@ -8638,7 +8631,7 @@ Mi.get("/", async (e) => {
|
|
|
8638
8631
|
});
|
|
8639
8632
|
//#endregion
|
|
8640
8633
|
//#region server/routes/admin/assets.ts
|
|
8641
|
-
var
|
|
8634
|
+
var Z = new e();
|
|
8642
8635
|
async function Q(e, t, n = []) {
|
|
8643
8636
|
let r = e.prepare(t);
|
|
8644
8637
|
if (typeof r.bind == "function") {
|
|
@@ -8662,7 +8655,7 @@ function Fi(e, t, n) {
|
|
|
8662
8655
|
}
|
|
8663
8656
|
async function Ii(e, t, n) {
|
|
8664
8657
|
try {
|
|
8665
|
-
let r = new
|
|
8658
|
+
let r = new Y(e.env), i = await Q(t, "\n SELECT cdnUrl, storageKeyPrivate\n FROM assets\n WHERE id = ? OR parentAssetId = ?\n ", [n, n]), a = [];
|
|
8666
8659
|
for (let t of i) {
|
|
8667
8660
|
let n = Fi(t.cdnUrl, t.storageKeyPrivate, e.env?.CDN_DOMAIN);
|
|
8668
8661
|
n && a.push(n);
|
|
@@ -8673,12 +8666,12 @@ async function Ii(e, t, n) {
|
|
|
8673
8666
|
n
|
|
8674
8667
|
]);
|
|
8675
8668
|
if (o.length === 0) return;
|
|
8676
|
-
for (let n of o) n.id && r.purgeSmart(e, t, n.id, n.slug, a);
|
|
8669
|
+
for (let n of o) n.id && n.slug && r.purgeSmart(e, t, n.id, n.slug, a, !1);
|
|
8677
8670
|
} catch (e) {
|
|
8678
8671
|
console.warn("[Assets Router] Failed to purge edge cache for asset nodes:", e);
|
|
8679
8672
|
}
|
|
8680
8673
|
}
|
|
8681
|
-
|
|
8674
|
+
Z.get("/", async (e) => {
|
|
8682
8675
|
try {
|
|
8683
8676
|
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 = {
|
|
8684
8677
|
createdAt: "a.createdAt",
|
|
@@ -8769,9 +8762,9 @@ Ni.get("/", async (e) => {
|
|
|
8769
8762
|
details: t.message || String(t)
|
|
8770
8763
|
}, 500);
|
|
8771
8764
|
}
|
|
8772
|
-
}),
|
|
8765
|
+
}), Z.post("/upload", async (e) => {
|
|
8773
8766
|
try {
|
|
8774
|
-
let t = u(e), n =
|
|
8767
|
+
let t = u(e), n = ri(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;
|
|
8775
8768
|
s && (await Q(t, "SELECT id FROM assets WHERE id = ?", [s])).length === 0 && (s = null);
|
|
8776
8769
|
let c = r.cropCoordinates, l = null, d = null;
|
|
8777
8770
|
if (c) {
|
|
@@ -8822,7 +8815,7 @@ Ni.get("/", async (e) => {
|
|
|
8822
8815
|
details: t.message || String(t)
|
|
8823
8816
|
}, 500);
|
|
8824
8817
|
}
|
|
8825
|
-
}),
|
|
8818
|
+
}), Z.get("/:id/details", async (e) => {
|
|
8826
8819
|
try {
|
|
8827
8820
|
let t = u(e), n = e.req.param("id"), r = await Q(t, "SELECT * FROM assets WHERE id = ?", [n]);
|
|
8828
8821
|
if (!r || r.length === 0) return e.json({ error: "Asset not found" }, 404);
|
|
@@ -8880,7 +8873,7 @@ Ni.get("/", async (e) => {
|
|
|
8880
8873
|
} catch (t) {
|
|
8881
8874
|
return console.error("❌ [Asset Details Error]:", t), e.json({ error: "Failed to load details" }, 500);
|
|
8882
8875
|
}
|
|
8883
|
-
}),
|
|
8876
|
+
}), Z.put("/:id", async (e) => {
|
|
8884
8877
|
try {
|
|
8885
8878
|
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]);
|
|
8886
8879
|
if (!i || i.length === 0) return e.json({ error: "Asset not found" }, 404);
|
|
@@ -8896,7 +8889,7 @@ Ni.get("/", async (e) => {
|
|
|
8896
8889
|
} catch (t) {
|
|
8897
8890
|
return console.error("❌ [Asset Update Error]:", t), e.json({ error: "Failed to update asset" }, 500);
|
|
8898
8891
|
}
|
|
8899
|
-
}),
|
|
8892
|
+
}), Z.delete("/:id", async (e) => {
|
|
8900
8893
|
try {
|
|
8901
8894
|
let t = u(e), n = e.req.param("id"), r = (await Q(t, "SELECT id, filename, isSystemVariant FROM assets WHERE id = ?", [n]))[0];
|
|
8902
8895
|
return r ? (await Ii(e, t, n), r.isSystemVariant ? await Pi(t, "UPDATE assets SET deletedAt = CURRENT_TIMESTAMP WHERE id = ?", [n]) : await Pi(t, "UPDATE assets\n SET deletedAt = CURRENT_TIMESTAMP\n WHERE id = ? OR parentAssetId = ? OR (isSystemVariant = 1 AND (filename LIKE ? OR filename LIKE ?))", [
|
|
@@ -8915,7 +8908,7 @@ Ni.get("/", async (e) => {
|
|
|
8915
8908
|
details: t.message || String(t)
|
|
8916
8909
|
}, 500);
|
|
8917
8910
|
}
|
|
8918
|
-
}),
|
|
8911
|
+
}), Z.post("/restore", async (e) => {
|
|
8919
8912
|
try {
|
|
8920
8913
|
let t = u(e), n = await e.req.json(), r = n.id || n.assetId;
|
|
8921
8914
|
if (!r) return e.json({ error: "Asset ID required" }, 400);
|
|
@@ -8936,9 +8929,9 @@ Ni.get("/", async (e) => {
|
|
|
8936
8929
|
details: t.message
|
|
8937
8930
|
}, 500);
|
|
8938
8931
|
}
|
|
8939
|
-
}),
|
|
8932
|
+
}), Z.delete("/purge/:id", async (e) => {
|
|
8940
8933
|
try {
|
|
8941
|
-
let t = u(e), n =
|
|
8934
|
+
let t = u(e), n = ri(e.env), r = e.req.param("id"), i = (await Q(t, "SELECT id, filename, storageKeyPrivate, isSystemVariant FROM assets WHERE id = ?", [r]))[0];
|
|
8942
8935
|
if (!i) return e.json({ error: "Asset not found" }, 404);
|
|
8943
8936
|
await Ii(e, t, r);
|
|
8944
8937
|
let a = [i];
|
|
@@ -9093,7 +9086,7 @@ async function Hi(e, t, n, r, i = !1, a) {
|
|
|
9093
9086
|
let o = a.hidden === !0 || a.hidden === 1 || a.hidden === "1" || a.hidden === "true", s = Bi(a.startShowingAt, a.stopShowingAt);
|
|
9094
9087
|
if (!i && (o || !s)) return null;
|
|
9095
9088
|
let c = t.elementType || t.componentId || "text-block", l = r.blocks?.[c]?.fields || r.elements?.[c]?.fields || r.components?.[c]?.fields || {}, u = String(a.blockId || a._instanceId || a.id || t.blockId || t.id), d = Ui(a, l);
|
|
9096
|
-
return d = await
|
|
9089
|
+
return d = await si(e, d), d = Wi(d), d.blockId = u, {
|
|
9097
9090
|
region: t.region || n,
|
|
9098
9091
|
block: {
|
|
9099
9092
|
instanceId: t.id,
|
|
@@ -9346,12 +9339,12 @@ Li.get("/*", async (e) => {
|
|
|
9346
9339
|
if (!c) return e.json({ error: `Channel '${a}' not found` }, 404);
|
|
9347
9340
|
let l = c.status === "disabled" || c.status === "inactive" || c.isEnabled === 0 || c.isEnabled === !1;
|
|
9348
9341
|
if (!s && l) return e.json({ error: `Channel '${c.key || a}' is currently inactive` }, 404);
|
|
9349
|
-
let u = c.id, d = c.key || a, f =
|
|
9342
|
+
let u = c.id, d = c.key || a, f = q(e), p = `node:${u || d}:${o}:${i}`, m = e.req.header("x-bypass-cache") === "true";
|
|
9350
9343
|
if (!s && !m) {
|
|
9351
9344
|
let t = await f.get(p);
|
|
9352
9345
|
if (t) return e.header("X-Cache", "HIT"), e.json(t);
|
|
9353
9346
|
}
|
|
9354
|
-
let h =
|
|
9347
|
+
let h = ui(e.env?.BUNDLED_DEFINITIONS), g = /^\d+$/.test(i), _ = null, v = null, y = e.req.query("treeId"), b = i.split("/"), x = b[b.length - 1], S = "/" + i.replace(/^\/+|\/+$/g, ""), C = `
|
|
9355
9348
|
SELECT
|
|
9356
9349
|
cn.*,
|
|
9357
9350
|
tn.id as treeNodeId,
|
|
@@ -9411,7 +9404,7 @@ Li.get("/*", async (e) => {
|
|
|
9411
9404
|
M.disabledRegions && (ne = M.disabledRegions), ae = M.hidden === !0 || M.hidden === 1 || M.hidden === "1" || M.hidden === "true", re = M.startShowingAt || null, ie = M.stopShowingAt || null;
|
|
9412
9405
|
let oe = M.layoutId, se = oe && oe !== "inherit", { resolvedLayoutId: ce, inheritedFields: le } = await Qi(t, ee, D, s, j), P = se ? oe : ce || A.defaultLayout || null;
|
|
9413
9406
|
for (let [e, t] of Object.entries(le)) (M[e] === void 0 || M[e] === null || M[e] === "" || M[e] === "inherit") && t !== void 0 && (M[e] = t);
|
|
9414
|
-
let F = await
|
|
9407
|
+
let F = await si(t, Ui(M, j));
|
|
9415
9408
|
F = Wi(F), F = await Gi(t, F, n);
|
|
9416
9409
|
let ue = Xi(F);
|
|
9417
9410
|
delete F.socialImage, delete F.fbImage, delete F.xImage, delete F.whatsappImage, ue && (F.socialImages = ue), k.slug = _.slug, k.title = _.title, Object.assign(k, F), k.layoutId = P;
|
|
@@ -9448,7 +9441,7 @@ Li.get("/*", async (e) => {
|
|
|
9448
9441
|
let a = i.hidden === !0 || i.hidden === 1 || i.hidden === "1" || i.hidden === "true", o = Bi(i.startShowingAt, i.stopShowingAt);
|
|
9449
9442
|
if (!s && (a || !o)) return null;
|
|
9450
9443
|
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 = Ui(i, l);
|
|
9451
|
-
return d = await
|
|
9444
|
+
return d = await si(t, d), d = Wi(d), d = await Gi(t, d, n), d.blockId = u, {
|
|
9452
9445
|
region: r,
|
|
9453
9446
|
block: {
|
|
9454
9447
|
instanceId: e.id,
|
|
@@ -9536,7 +9529,7 @@ ta.get("/:treeParam", async (e) => {
|
|
|
9536
9529
|
if (!i && t) return e.json({ error: `Channel '${n.key || r}' is currently inactive` }, 404);
|
|
9537
9530
|
}
|
|
9538
9531
|
}
|
|
9539
|
-
let a =
|
|
9532
|
+
let a = q(e), o = `tree:${r}:${n}`, s = e.req.header("x-bypass-cache") === "true";
|
|
9540
9533
|
if (!i && !s) {
|
|
9541
9534
|
let t = await a.get(o);
|
|
9542
9535
|
if (t) return e.header("X-Cache", "HIT"), e.json(t);
|
|
@@ -9545,7 +9538,7 @@ ta.get("/:treeParam", async (e) => {
|
|
|
9545
9538
|
if (l && Number(l.isHidden) === 1 && !i) return e.json({ error: `Tree '${n}' is hidden` }, 404);
|
|
9546
9539
|
let u = l?.id || (c ? Number(n) : null), d = {};
|
|
9547
9540
|
if (l && l.dataJson) try {
|
|
9548
|
-
let t = typeof l.dataJson == "string" ? JSON.parse(l.dataJson) : l.dataJson, r = e.env?.BUNDLED_DEFINITIONS, i =
|
|
9541
|
+
let t = typeof l.dataJson == "string" ? JSON.parse(l.dataJson) : l.dataJson, r = e.env?.BUNDLED_DEFINITIONS, i = ui(r), a = (i.trees?.[l.treeType || n] || i.trees?.site || {}).fields || {};
|
|
9549
9542
|
for (let [e, n] of Object.entries(t)) a[e]?.public === !0 && (d[e] = n);
|
|
9550
9543
|
} catch (e) {
|
|
9551
9544
|
console.warn("[CMS Public Tree API] Failed to parse tree dataJson", e);
|
|
@@ -9825,12 +9818,12 @@ $.use("*", o()), $.use("/media/*", o({
|
|
|
9825
9818
|
e.set("currentDomain", r);
|
|
9826
9819
|
let i = u(e);
|
|
9827
9820
|
if (e.set("db", i), !ca) try {
|
|
9828
|
-
await
|
|
9821
|
+
await Nr(i), ca = !0;
|
|
9829
9822
|
} catch (e) {
|
|
9830
9823
|
console.error("❌ [CMS Server] Failed to initialize system tables on cold start:", e);
|
|
9831
9824
|
}
|
|
9832
9825
|
await t();
|
|
9833
|
-
}), $.route("/media", ia), $.use("/media/*",
|
|
9826
|
+
}), $.route("/media", ia), $.use("/media/*", Ir()), $.route("/api/cms/nodes", X), $.route("/api/cms/nodes.json", X), $.route("/api/cms/formcsv", X), $.route("/api/cms/formcsv.json", X), $.route("/api/cms/stats", Ni), $.route("/api/cms/stats.json", Ni), $.route("/api/cms", Si), $.route("/api/cms/channels", Ei), $.route("/api/cms/channels.json", Ei), $.route("/api/cms/schemas", Di), $.route("/api/cms/schemas.json", Di), $.route("/api/cms", Ai), $.route("/api/admin/assets", Z), $.route("/api/v1/node", Li), $.route("/api/v1/page", Li), $.route("/api/v1/tree", ta), $.route("/api/v1/all-paths", oa), $.get("*", async (e) => {
|
|
9834
9827
|
if (e.env?.ASSETS) {
|
|
9835
9828
|
let t = await e.env.ASSETS.fetch(e.req.raw);
|
|
9836
9829
|
if (t.status === 404) {
|