okno 1.0.0-beta.47 → 1.0.0-beta.49
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/astro/index.js +1 -1
- package/dist/check-Dv8k-HKR.js +96 -0
- package/dist/cli/check.d.ts +11 -0
- package/dist/cli/check.d.ts.map +1 -0
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli.js +12 -7
- package/dist/{dispatch-DaiWy5Uk.js → dispatch-dWn8cIFI.js} +89 -89
- package/dist/editor/index.js +20104 -19636
- package/dist/engine/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/local/dispatch.d.ts.map +1 -1
- package/dist/mcp.js +2 -2
- package/dist/next/index.js +1 -1
- package/dist/{plugin-DNXklUmq.js → plugin-BAurTuo8.js} +2 -2
- package/dist/runtime/preview-sync.d.ts.map +1 -1
- package/dist/runtime/values.d.ts +2 -14
- package/dist/runtime/values.d.ts.map +1 -1
- package/dist/runtime/wrap.js +75 -74
- package/dist/{schema-mutation-BWtb40Qj.js → schema-mutation-DQ7d4rmd.js} +45 -45
- package/dist/{schema-mutation-DVgVbjdl.js → schema-mutation-DXOYPQHt.js} +1 -1
- package/dist/vite/index.js +1 -1
- package/package.json +1 -1
- package/skills/connect-okno/SKILL.md +4 -3
- package/skills/connect-okno/references/content.md +20 -2
- package/src/runtime/preview-sync.ts +2 -0
- package/src/runtime/values.ts +12 -4
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { join as m, resolve as pe, sep as Z, dirname as
|
|
2
|
-
import { readdir as
|
|
3
|
-
import { existsSync as w, readFileSync as A, lstatSync as ve, readdirSync as te, statSync as je, writeFileSync as
|
|
1
|
+
import { join as m, resolve as pe, sep as Z, dirname as G, relative as ie, basename as Fe } from "node:path";
|
|
2
|
+
import { readdir as V, readFile as rt, writeFile as at } from "node:fs/promises";
|
|
3
|
+
import { existsSync as w, readFileSync as A, lstatSync as ve, readdirSync as te, statSync as je, writeFileSync as P, chmodSync as it, renameSync as Ye, unlinkSync as ee, realpathSync as lt, mkdirSync as K } from "node:fs";
|
|
4
4
|
import { fileURLToPath as ct } from "node:url";
|
|
5
|
-
import { p as
|
|
5
|
+
import { p as z, q as ze, a as he, r as ut, E, s as ft, i as dt, n as pt, e as mt, t as Ve, u as ht, w as gt, x as yt, y as kt, z as _t, A as $t, B as wt, C as bt } from "./schema-mutation-DQ7d4rmd.js";
|
|
6
6
|
import { prepareSvgIcon as Ot, orderBySlugs as St, FIELD_LABELS as vt, fieldSnippet as jt } from "./engine/index.js";
|
|
7
7
|
import { a as At } from "./acorn-oIjaFBVA.js";
|
|
8
8
|
import { execSync as Ae } from "node:child_process";
|
|
9
9
|
import { simpleGit as Ue } from "simple-git";
|
|
10
|
-
import { m as
|
|
10
|
+
import { m as L, b as le } from "./schema-mutation-DXOYPQHt.js";
|
|
11
11
|
function Qe(e) {
|
|
12
12
|
const t = m(e, "schema.ts");
|
|
13
13
|
if (!w(t)) return [];
|
|
14
|
-
const o =
|
|
14
|
+
const o = z(A(t, "utf8"));
|
|
15
15
|
if (!o || typeof o != "object") return [];
|
|
16
16
|
const s = [], f = (a, r, n = 0, c) => {
|
|
17
17
|
if (!(!a || typeof a != "object" || !r || n > 64))
|
|
@@ -31,7 +31,7 @@ function Qe(e) {
|
|
|
31
31
|
}
|
|
32
32
|
}, l = (o.locales?.supported ?? []).map((a) => typeof a == "string" ? a : a?.id).filter(Boolean), i = (a, r, n, c = !1) => {
|
|
33
33
|
if (!w(a)) return;
|
|
34
|
-
const u =
|
|
34
|
+
const u = z(A(a, "utf8")), d = n && w(n) ? z(A(n, "utf8")) : void 0;
|
|
35
35
|
if (Array.isArray(u)) for (const p of u) f(p, r, 0, Array.isArray(d) ? d.find((h) => h?.slug === p?.slug) : void 0);
|
|
36
36
|
else if (c && u && typeof u == "object") for (const [p, h] of Object.entries(u)) f(h, r, 0, d?.[p]);
|
|
37
37
|
else f(u, r, 0, d);
|
|
@@ -131,7 +131,7 @@ async function _e(e, t) {
|
|
|
131
131
|
async function f(l) {
|
|
132
132
|
let i;
|
|
133
133
|
try {
|
|
134
|
-
i = await
|
|
134
|
+
i = await V(l, { withFileTypes: !0 });
|
|
135
135
|
} catch {
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
@@ -168,7 +168,7 @@ const Nt = "__oknoSetImages({})", Ct = '__oknoSetImages(import.meta.glob("/okno/
|
|
|
168
168
|
function xe(e = "raw") {
|
|
169
169
|
return e === "astro" ? Ct : Nt;
|
|
170
170
|
}
|
|
171
|
-
const Be =
|
|
171
|
+
const Be = G(ct(import.meta.url)), Lt = [
|
|
172
172
|
pe(Be, "./runtime/wrap.js"),
|
|
173
173
|
// bundled at dist/ (Vite plugin chunk)
|
|
174
174
|
pe(Be, "../runtime/wrap.js")
|
|
@@ -192,7 +192,7 @@ function Q(e) {
|
|
|
192
192
|
const t = m(e, "schema.ts");
|
|
193
193
|
if (!w(t)) return null;
|
|
194
194
|
try {
|
|
195
|
-
const s =
|
|
195
|
+
const s = z(A(t, "utf-8"))?.locales?.supported;
|
|
196
196
|
if (!Array.isArray(s) || s.length === 0) return null;
|
|
197
197
|
const f = s.map((l) => typeof l == "string" ? l : l?.id).filter((l) => typeof l == "string");
|
|
198
198
|
return f.length ? new Set(f) : null;
|
|
@@ -213,13 +213,13 @@ function Rt(e) {
|
|
|
213
213
|
return e;
|
|
214
214
|
}
|
|
215
215
|
async function Ee(e) {
|
|
216
|
-
return w(e) ? (await
|
|
216
|
+
return w(e) ? (await V(e)).filter((o) => o.endsWith(".ts") && o !== "index.ts") : [];
|
|
217
217
|
}
|
|
218
218
|
function Pt(e) {
|
|
219
219
|
const t = m(e, "schema.ts"), o = {}, s = [], f = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
|
|
220
220
|
if (!w(t)) return { names: s, orders: o, draftsOff: f, schedulingOff: l };
|
|
221
221
|
try {
|
|
222
|
-
const a =
|
|
222
|
+
const a = z(A(t, "utf-8"))?.collections ?? {};
|
|
223
223
|
for (const [r, n] of Object.entries(a))
|
|
224
224
|
s.push(r), Array.isArray(n?.order) && (o[r] = n.order.filter((c) => typeof c == "string")), n?.drafts === !1 && f.add(r), n?.scheduling === !1 && l.add(r);
|
|
225
225
|
} catch {
|
|
@@ -248,7 +248,7 @@ function bn(e) {
|
|
|
248
248
|
let o = [], s = "";
|
|
249
249
|
if (w(t))
|
|
250
250
|
try {
|
|
251
|
-
const f =
|
|
251
|
+
const f = z(A(t, "utf-8")), l = f?.locales?.supported;
|
|
252
252
|
Array.isArray(l) && (o = l.map((i) => typeof i == "string" ? { id: i } : i).filter((i) => !!i && typeof i.id == "string").map((i) => ({
|
|
253
253
|
id: i.id,
|
|
254
254
|
name: i.name || Rt(i.id),
|
|
@@ -295,7 +295,7 @@ async function On(e) {
|
|
|
295
295
|
`);
|
|
296
296
|
const o = m(e, "schema.ts"), s = w(o), f = [...Q(e) ?? []], l = Q(e), i = m(e, "strings"), a = [];
|
|
297
297
|
if (w(i)) {
|
|
298
|
-
const p = await
|
|
298
|
+
const p = await V(i, { withFileTypes: !0 });
|
|
299
299
|
for (const h of p) {
|
|
300
300
|
if (!h.isFile() || !h.name.endsWith(".ts") || h.name === "index.ts") continue;
|
|
301
301
|
const k = h.name.replace(/\.ts$/, "");
|
|
@@ -321,7 +321,7 @@ async function On(e) {
|
|
|
321
321
|
}
|
|
322
322
|
async function Sn(e, t = /* @__PURE__ */ new Set(), o = "raw", s) {
|
|
323
323
|
const f = m(e, "pages"), l = m(e, "schema.ts"), i = w(l);
|
|
324
|
-
i && H("pages", Object.keys(
|
|
324
|
+
i && H("pages", Object.keys(z(A(l, "utf8"))?.pages ?? {}));
|
|
325
325
|
const a = [
|
|
326
326
|
`import { __oknoWrap, __oknoLocaleNamespace, __oknoLocalize, __oknoResolveEnums, __oknoLiftSlots, __oknoSetImages, __oknoSetRoutes${s ? ", __oknoSetAssets" : ""} } from "okno/runtime"`,
|
|
327
327
|
xe(o),
|
|
@@ -335,7 +335,7 @@ async function Sn(e, t = /* @__PURE__ */ new Set(), o = "raw", s) {
|
|
|
335
335
|
return `__oknoResolveEnums(_${d}, ${h}, ${r})`;
|
|
336
336
|
}, c = (d) => i ? `, undefined, { slots: __oknoLiftSlots(__schema?.pages?.["${d}"]?.fields), defaultLocale: __schema?.locales?.default, fields: __schema?.pages?.["${d}"]?.fields, schema: __schema, collections: __collections, locales: ${r}, fileAlts: __oknoFileAlts }` : ", undefined, { fileAlts: __oknoFileAlts }", u = /* @__PURE__ */ new Set();
|
|
337
337
|
if (w(f)) {
|
|
338
|
-
const d = Q(e), h = (await
|
|
338
|
+
const d = Q(e), h = (await V(f, { withFileTypes: !0 })).filter((_) => _.isDirectory() && ae(_.name, d)).map((_) => _.name), k = await Ee(f);
|
|
339
339
|
for (const _ of k) {
|
|
340
340
|
const $ = Ie(_), v = Ne(_);
|
|
341
341
|
H("pages", [v]);
|
|
@@ -361,11 +361,11 @@ async function Sn(e, t = /* @__PURE__ */ new Set(), o = "raw", s) {
|
|
|
361
361
|
`);
|
|
362
362
|
}
|
|
363
363
|
async function vn(e, t = /* @__PURE__ */ new Set(), o = !1, s = "raw", f) {
|
|
364
|
-
const l = m(e, "collections"), i = Q(e), a = w(l) ? await
|
|
364
|
+
const l = m(e, "collections"), i = Q(e), a = w(l) ? await V(l, { withFileTypes: !0 }) : [], { names: r, orders: n, draftsOff: c, schedulingOff: u } = Pt(e), d = a.filter((y) => y.isDirectory() && ae(y.name, i)).map((y) => y.name), p = a.filter((y) => y.isDirectory() && !d.includes(y.name)).map((y) => y.name);
|
|
365
365
|
H("collections", [...r, ...p]);
|
|
366
366
|
const h = [...new Set([...r, ...p, ...[...t].filter((y) => y !== "locale")].map((y) => y.replace(/_/g, "-")))], k = JSON.stringify([...i ?? []]);
|
|
367
367
|
for (const y of h) {
|
|
368
|
-
const g = await
|
|
368
|
+
const g = await V(m(l, y), { withFileTypes: !0 }).catch(() => []);
|
|
369
369
|
for (const O of g)
|
|
370
370
|
O.isDirectory() && ae(O.name, i) && console.warn(
|
|
371
371
|
`[okno] "collections/${y}/${O.name}/" looks like a misplaced locale folder. Collection locale overrides go at "collections/${O.name}/${y}/<slug>.ts" (locale right after "collections/"). This folder will NOT be localized.`
|
|
@@ -382,24 +382,24 @@ async function vn(e, t = /* @__PURE__ */ new Set(), o = !1, s = "raw", f) {
|
|
|
382
382
|
for (const y of h) {
|
|
383
383
|
const g = $ ? `__schema?.collections?.[${JSON.stringify(y)}]?.fields` : "undefined", O = m(l, y), S = St(await Ee(O), me, n[y]), T = y.replace(/-/g, "_"), x = o && !c.has(y), j = o && !u.has(y), N = [];
|
|
384
384
|
for (const C of S) {
|
|
385
|
-
const I = `_${T}_${Ie(C)}`,
|
|
385
|
+
const I = `_${T}_${Ie(C)}`, R = me(C), J = m(O, C);
|
|
386
386
|
if (d.length === 0)
|
|
387
|
-
v.push(`import ${I}_stored from "${
|
|
387
|
+
v.push(`import ${I}_stored from "${J}"`), v.push(`const ${I} = __oknoNormalizeCollectionDraft(${I}_stored, ${g})`);
|
|
388
388
|
else {
|
|
389
|
-
const
|
|
389
|
+
const M = [`import ${I}_default from "${J}"`], X = [];
|
|
390
390
|
for (const D of d) {
|
|
391
391
|
const ne = m(l, D, y, C);
|
|
392
392
|
if (w(ne)) {
|
|
393
393
|
const oe = ge(D);
|
|
394
|
-
|
|
394
|
+
M.push(`import ${I}_${oe} from "${ne}"`), X.push(`"${D}": __oknoNormalizeCollectionDraft(${I}_${oe}, ${g})`);
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
|
-
v.push(...
|
|
397
|
+
v.push(...M), v.push(`const ${I} = __oknoLocalize(__oknoNormalizeCollectionDraft(${I}_default, ${g}), { ${X.join(", ")} })`);
|
|
398
398
|
}
|
|
399
|
-
N.push({ varName: I, itemName:
|
|
399
|
+
N.push({ varName: I, itemName: R });
|
|
400
400
|
}
|
|
401
|
-
const
|
|
402
|
-
v.push(`const __oknoRaw_${T} = [${N.map((C) => C.varName).join(", ")}]${
|
|
401
|
+
const U = [x ? "item?.draft !== true" : "", j ? "__oknoVisible(item)" : ""].filter(Boolean);
|
|
402
|
+
v.push(`const __oknoRaw_${T} = [${N.map((C) => C.varName).join(", ")}]${U.length ? `.filter(item => ${U.join(" && ")})` : ""}`), b.push({ name: y, safe: T, draftsOn: x, schedulingOn: j, items: N });
|
|
403
403
|
}
|
|
404
404
|
$ && v.push(`const __oknoNs = { ${b.map((y) => `${y.safe}: __oknoRaw_${y.safe}`).join(", ")} }`);
|
|
405
405
|
for (const y of b) {
|
|
@@ -418,7 +418,7 @@ async function vn(e, t = /* @__PURE__ */ new Set(), o = !1, s = "raw", f) {
|
|
|
418
418
|
}
|
|
419
419
|
async function jn(e, t = /* @__PURE__ */ new Set(), o = "raw", s) {
|
|
420
420
|
const f = m(e, "globals"), l = m(e, "schema.ts"), i = w(l);
|
|
421
|
-
i && H("globals", Object.keys(
|
|
421
|
+
i && H("globals", Object.keys(z(A(l, "utf8"))?.globals ?? {}));
|
|
422
422
|
const a = [
|
|
423
423
|
`import { __oknoWrap, __oknoLocaleNamespace, __oknoLocalize, __oknoResolveEnums, __oknoLiftSlots, __oknoSetImages, __oknoSetRoutes${s ? ", __oknoSetAssets" : ""} } from "okno/runtime"`,
|
|
424
424
|
xe(o),
|
|
@@ -432,7 +432,7 @@ async function jn(e, t = /* @__PURE__ */ new Set(), o = "raw", s) {
|
|
|
432
432
|
return `__oknoResolveEnums(_${d}, ${h}, ${r})`;
|
|
433
433
|
}, c = (d) => i ? `, undefined, { slots: __oknoLiftSlots(__schema?.globals?.["${d}"]?.fields), defaultLocale: __schema?.locales?.default, fields: __schema?.globals?.["${d}"]?.fields, schema: __schema, collections: __collections, locales: ${r}, fileAlts: __oknoFileAlts }` : ", undefined, { fileAlts: __oknoFileAlts }", u = /* @__PURE__ */ new Set();
|
|
434
434
|
if (w(f)) {
|
|
435
|
-
const d = Q(e), h = (await
|
|
435
|
+
const d = Q(e), h = (await V(f, { withFileTypes: !0 })).filter((_) => _.isDirectory() && ae(_.name, d)).map((_) => _.name), k = await Ee(f);
|
|
436
436
|
for (const _ of k) {
|
|
437
437
|
const $ = Ie(_), v = Ne(_);
|
|
438
438
|
H("globals", [v]);
|
|
@@ -763,28 +763,28 @@ async function An(e, t, o = "strict", s) {
|
|
|
763
763
|
if (i?.collections?.[g]) return `${S}${k(g)}`;
|
|
764
764
|
const T = i?.collections?.[g]?.fields, x = T ? Object.entries(T) : [], j = x.filter(r), N = x.filter(n);
|
|
765
765
|
if (j.length === 0 && N.length === 0) return `${S}${k(g)}`;
|
|
766
|
-
const
|
|
767
|
-
...j.map(([
|
|
768
|
-
const
|
|
769
|
-
return `${
|
|
766
|
+
const U = [...j, ...N].map(([R]) => `"${R}"`).join(" | "), C = new Set(O).add(g), I = [
|
|
767
|
+
...j.map(([R, J]) => {
|
|
768
|
+
const M = J.collection, X = O.has(M) ? h(M) : _(M, C);
|
|
769
|
+
return `${R}: ${J.multiple ? `(${X})[]` : X}`;
|
|
770
770
|
}),
|
|
771
771
|
...N.map(d)
|
|
772
772
|
].join("; ");
|
|
773
|
-
return `Omit<${S}, ${
|
|
773
|
+
return `Omit<${S}, ${U}> & { ${I} }${k(g)}`;
|
|
774
774
|
}, $ = (g, O, S) => {
|
|
775
|
-
const T = !!i?.[g]?.[O], x = `typeof import("${S}").default`, j = T ? q(g, O) : g === "collections" ? p(O, S) : x, N = i?.[g]?.[O]?.fields,
|
|
775
|
+
const T = !!i?.[g]?.[O], x = `typeof import("${S}").default`, j = T ? q(g, O) : g === "collections" ? p(O, S) : x, N = i?.[g]?.[O]?.fields, U = N ? Object.entries(N) : [], C = U.filter(r), I = U.filter(n), R = U.filter(c), J = '"created" | "updated"', M = g === "collections" ? k(O) : "", X = R.length ? ` & { ${R.map(u).join("; ")} }` : "";
|
|
776
776
|
if (T)
|
|
777
777
|
return `OknoWrapped<${j}>`;
|
|
778
|
-
if (C.length === 0 && I.length === 0 &&
|
|
779
|
-
return `OknoWrapped<Omit<${j}, ${
|
|
780
|
-
const D = g === "collections" ? /* @__PURE__ */ new Set([O]) : /* @__PURE__ */ new Set(), ne = `${[...C, ...I, ...
|
|
778
|
+
if (C.length === 0 && I.length === 0 && R.length === 0)
|
|
779
|
+
return `OknoWrapped<Omit<${j}, ${J}>${M}> & OknoMeta`;
|
|
780
|
+
const D = g === "collections" ? /* @__PURE__ */ new Set([O]) : /* @__PURE__ */ new Set(), ne = `${[...C, ...I, ...R].map(([ye]) => `"${ye}"`).join(" | ")} | ${J}`, oe = [
|
|
781
781
|
...C.map(([ye, Me]) => {
|
|
782
782
|
const ke = Me.collection, We = D.has(ke) ? h(ke) : _(ke, D);
|
|
783
783
|
return `${ye}: ${Me.multiple ? `(${We})[]` : We}`;
|
|
784
784
|
}),
|
|
785
785
|
...I.map(d)
|
|
786
786
|
].join("; ");
|
|
787
|
-
return `OknoWrapped<${oe ? `Omit<${j}, ${ne}> & { ${oe} }` : `Omit<${j}, ${ne}>`}${
|
|
787
|
+
return `OknoWrapped<${oe ? `Omit<${j}, ${ne}> & { ${oe} }` : `Omit<${j}, ${ne}>`}${M}> & OknoMeta${X}`;
|
|
788
788
|
}, [v, b, y] = await Promise.all([
|
|
789
789
|
_e(t, "pages"),
|
|
790
790
|
_e(t, "globals"),
|
|
@@ -931,7 +931,7 @@ function Xt(e) {
|
|
|
931
931
|
async function Yt(e) {
|
|
932
932
|
const t = m(e, "collections");
|
|
933
933
|
if (!w(t)) return [];
|
|
934
|
-
const o = (await
|
|
934
|
+
const o = (await V(t, { withFileTypes: !0 })).filter((f) => f.isDirectory()), s = [];
|
|
935
935
|
for (const f of o) {
|
|
936
936
|
const l = await be(m(t, f.name));
|
|
937
937
|
l.length > 0 && s.push({ name: f.name, first: l[0] });
|
|
@@ -939,7 +939,7 @@ async function Yt(e) {
|
|
|
939
939
|
return s;
|
|
940
940
|
}
|
|
941
941
|
async function be(e) {
|
|
942
|
-
return w(e) ? (await
|
|
942
|
+
return w(e) ? (await V(e)).filter((o) => o.endsWith(".ts") && o !== "index.ts" && o !== "modules.d.ts").map((o) => o.replace(".ts", "")) : [];
|
|
943
943
|
}
|
|
944
944
|
function Pe(e) {
|
|
945
945
|
try {
|
|
@@ -998,7 +998,7 @@ function Y(e, t) {
|
|
|
998
998
|
const o = m(e, t);
|
|
999
999
|
return o !== e && !o.startsWith(e + Z) ? null : ot(e, o);
|
|
1000
1000
|
}
|
|
1001
|
-
function
|
|
1001
|
+
function W(e, t) {
|
|
1002
1002
|
if (!t || t.includes("..") || t.includes("\0") || t.startsWith("/")) return null;
|
|
1003
1003
|
const o = m(e, t);
|
|
1004
1004
|
return o !== e && !o.startsWith(e + Z) ? null : ot(e, o);
|
|
@@ -1017,7 +1017,7 @@ function ot(e, t) {
|
|
|
1017
1017
|
return t;
|
|
1018
1018
|
}
|
|
1019
1019
|
function ue(e, t) {
|
|
1020
|
-
const o = m(
|
|
1020
|
+
const o = m(G(e), `.${Fe(e)}.okno-${crypto.randomUUID()}`);
|
|
1021
1021
|
try {
|
|
1022
1022
|
let s;
|
|
1023
1023
|
try {
|
|
@@ -1025,7 +1025,7 @@ function ue(e, t) {
|
|
|
1025
1025
|
} catch (f) {
|
|
1026
1026
|
if (f.code !== "ENOENT") throw f;
|
|
1027
1027
|
}
|
|
1028
|
-
|
|
1028
|
+
P(o, t, { flag: "wx", mode: s }), s !== void 0 && it(o, s), Ye(o, e);
|
|
1029
1029
|
} catch {
|
|
1030
1030
|
try {
|
|
1031
1031
|
w(o) && ee(o);
|
|
@@ -1076,7 +1076,7 @@ function tn(e) {
|
|
|
1076
1076
|
};
|
|
1077
1077
|
}
|
|
1078
1078
|
function de(e, t) {
|
|
1079
|
-
const o =
|
|
1079
|
+
const o = W(e, t);
|
|
1080
1080
|
if (!o || t.includes("\\") || t.split("/").some((f) => !f || f === ".")) throw new E(400, "Invalid content path");
|
|
1081
1081
|
let s = e;
|
|
1082
1082
|
for (const f of t.split("/"))
|
|
@@ -1111,7 +1111,7 @@ function nn(e) {
|
|
|
1111
1111
|
return l !== null && (t["strings.ts"] = l), { schema: s("schema.ts"), users: s("users.json"), settings: null, origins: s("origins.json"), content: t, collectionPaths: o.sort() };
|
|
1112
1112
|
}
|
|
1113
1113
|
function on(e, t) {
|
|
1114
|
-
if (!Array.isArray(t) || t.length > 100 || t.some((s) => typeof s != "string" || !s.startsWith("collections/") || !s.endsWith(".ts") || s.split("/").at(-1) === "index.ts" || !
|
|
1114
|
+
if (!Array.isArray(t) || t.length > 100 || t.some((s) => typeof s != "string" || !s.startsWith("collections/") || !s.endsWith(".ts") || s.split("/").at(-1) === "index.ts" || !W(e, s))) throw new E(400, "Expected at most 100 collection content paths");
|
|
1115
1115
|
const o = {};
|
|
1116
1116
|
for (const s of t)
|
|
1117
1117
|
try {
|
|
@@ -1122,7 +1122,7 @@ function on(e, t) {
|
|
|
1122
1122
|
return o;
|
|
1123
1123
|
}
|
|
1124
1124
|
const qe = (e) => e.replace(/[^a-zA-Z0-9._-]/g, "-"), He = (e) => e.split("/").map((t) => t.replace(/[^a-zA-Z0-9._-]/g, "-")).filter((t) => t && t !== "-" && t !== "..").join("/");
|
|
1125
|
-
function
|
|
1125
|
+
function B(e) {
|
|
1126
1126
|
if (!Y(e, "schema.ts")) throw new E(400, "Symlink schema paths are not supported");
|
|
1127
1127
|
let t;
|
|
1128
1128
|
try {
|
|
@@ -1141,7 +1141,7 @@ function J(e) {
|
|
|
1141
1141
|
function Ze(e, t, o) {
|
|
1142
1142
|
const s = Y(e, "schema.ts");
|
|
1143
1143
|
if (!s) throw new E(400, "Symlink schema paths are not supported");
|
|
1144
|
-
|
|
1144
|
+
P(s, ft(t, o));
|
|
1145
1145
|
}
|
|
1146
1146
|
let we;
|
|
1147
1147
|
function Oe(e) {
|
|
@@ -1169,7 +1169,7 @@ export default {
|
|
|
1169
1169
|
blocks: {},
|
|
1170
1170
|
} satisfies Schema
|
|
1171
1171
|
`;
|
|
1172
|
-
class
|
|
1172
|
+
class F extends Error {
|
|
1173
1173
|
constructor(t, o, s, f) {
|
|
1174
1174
|
super(t), this.code = o, this.status = s, this.retryable = f;
|
|
1175
1175
|
}
|
|
@@ -1184,27 +1184,27 @@ function Se(e) {
|
|
|
1184
1184
|
} catch (o) {
|
|
1185
1185
|
if (o.code === "ENOENT")
|
|
1186
1186
|
return { hasInstallation: !0, initialized: !1, installUrl: null, missing: ["schema.ts"] };
|
|
1187
|
-
throw new
|
|
1187
|
+
throw new F("Couldn't read okno/schema.ts. Check the file permissions and try again.", "schema_read_failed", 500, !0);
|
|
1188
1188
|
}
|
|
1189
1189
|
try {
|
|
1190
1190
|
const o = t.match(/export\s+default\s+([\s\S]+)/)?.[1];
|
|
1191
1191
|
if (!o) throw new Error("Missing export default");
|
|
1192
1192
|
const s = o.trim().replace(/;$/, "").replace(/\s+satisfies\s+\w+\s*$/, "").replace(/\s+as\s+\w+\s*$/, ""), f = At(`(${s})`, 0, { ecmaVersion: "latest" });
|
|
1193
1193
|
if (f.type !== "ObjectExpression") throw new Error("Schema must be an object");
|
|
1194
|
-
const l =
|
|
1194
|
+
const l = z(t);
|
|
1195
1195
|
if (f.properties.length && !Object.keys(l).length) throw new Error("Schema must contain literal data");
|
|
1196
1196
|
for (const i of ["pages", "collections", "globals", "blocks", "strings", "locales", "layout"]) {
|
|
1197
1197
|
const a = l[i];
|
|
1198
1198
|
if (a !== void 0 && (a === null || typeof a != "object" || Array.isArray(a))) throw new Error(`Invalid ${i}`);
|
|
1199
1199
|
}
|
|
1200
1200
|
} catch {
|
|
1201
|
-
throw new
|
|
1201
|
+
throw new F("Couldn't read the schema. Fix okno/schema.ts before continuing.", "invalid_schema", 422, !1);
|
|
1202
1202
|
}
|
|
1203
1203
|
return { hasInstallation: !0, initialized: !0, installUrl: null };
|
|
1204
1204
|
}
|
|
1205
1205
|
function an(e, t) {
|
|
1206
1206
|
if (t !== void 0) {
|
|
1207
|
-
if (typeof t != "string" || !t.trim()) throw new
|
|
1207
|
+
if (typeof t != "string" || !t.trim()) throw new F("A verified project identity is required", "project_identity_required", 400, !1);
|
|
1208
1208
|
const f = m(e, "project.json");
|
|
1209
1209
|
let l = {};
|
|
1210
1210
|
try {
|
|
@@ -1212,21 +1212,21 @@ function an(e, t) {
|
|
|
1212
1212
|
if (!i || typeof i != "object" || Array.isArray(i)) throw new Error("Invalid project config");
|
|
1213
1213
|
l = i;
|
|
1214
1214
|
} catch (i) {
|
|
1215
|
-
if (i.code !== "ENOENT") throw new
|
|
1215
|
+
if (i.code !== "ENOENT") throw new F("Fix okno/project.json before continuing", "invalid_project_config", 409, !1);
|
|
1216
1216
|
}
|
|
1217
|
-
if (l.projectId !== void 0 && (typeof l.projectId != "string" || !l.projectId.trim())) throw new
|
|
1218
|
-
if (l.projectId && l.projectId !== t) throw new
|
|
1219
|
-
l.projectId !== t && (
|
|
1217
|
+
if (l.projectId !== void 0 && (typeof l.projectId != "string" || !l.projectId.trim())) throw new F("Fix the project identity in okno/project.json before continuing", "invalid_project_config", 409, !1);
|
|
1218
|
+
if (l.projectId && l.projectId !== t) throw new F("This checkout belongs to another Okno project. Reconnect the matching repository before continuing.", "project_identity_mismatch", 409, !1);
|
|
1219
|
+
l.projectId !== t && (K(e, { recursive: !0 }), L(f), P(f, JSON.stringify({ ...l, projectId: t }, null, " ") + `
|
|
1220
1220
|
`));
|
|
1221
1221
|
}
|
|
1222
1222
|
const o = Se(e);
|
|
1223
1223
|
if (o.initialized) return { ...o, ok: !0, alreadyInitialized: !0 };
|
|
1224
1224
|
const s = m(e, "schema.ts");
|
|
1225
1225
|
try {
|
|
1226
|
-
|
|
1226
|
+
K(e, { recursive: !0 }), L(s), P(s, rn, { flag: "wx" });
|
|
1227
1227
|
} catch (f) {
|
|
1228
1228
|
if (f.code !== "EEXIST")
|
|
1229
|
-
throw new
|
|
1229
|
+
throw new F("Couldn't create okno/schema.ts. Check the folder permissions and try again.", "schema_write_failed", 500, !0);
|
|
1230
1230
|
}
|
|
1231
1231
|
return { ...Se(e), ok: !0, alreadyInitialized: !1 };
|
|
1232
1232
|
}
|
|
@@ -1248,7 +1248,7 @@ async function In(e, t) {
|
|
|
1248
1248
|
return r(200, { permissions: A(m(e, "permissions.ts"), "utf8") });
|
|
1249
1249
|
} catch (n) {
|
|
1250
1250
|
if (n.code === "ENOENT") return r(200, { permissions: null });
|
|
1251
|
-
throw new
|
|
1251
|
+
throw new F("Couldn’t read okno/permissions.ts. Check the file permissions and try again.", "permissions_read_failed", 500, !0);
|
|
1252
1252
|
}
|
|
1253
1253
|
if (o === "POST" && s === "setup/init") {
|
|
1254
1254
|
const n = await t.json(), c = an(e, n?.projectId);
|
|
@@ -1263,26 +1263,26 @@ async function In(e, t) {
|
|
|
1263
1263
|
if (dt(n)) return r(400, { error: 'Slug "new" is reserved for creating items' });
|
|
1264
1264
|
const p = Y(e, n);
|
|
1265
1265
|
if (!p) return r(400, { error: "Invalid path" });
|
|
1266
|
-
const h = n.startsWith("collections/") ? pt(n,
|
|
1267
|
-
return G(
|
|
1266
|
+
const h = n.startsWith("collections/") ? pt(n, B(e).schema, c, { forWrite: !0 }) : c, k = mt(h, { now: (/* @__PURE__ */ new Date()).toISOString(), author: d || sn(e), created: u });
|
|
1267
|
+
return K(G(p), { recursive: !0 }), L(p), ue(p, k), l(n, p), r(200, { ok: !0, commit: { fileSha: "" }, canonical: { path: n, source: k } });
|
|
1268
1268
|
}
|
|
1269
1269
|
if (o === "POST" && s === "content/delete") {
|
|
1270
1270
|
const n = (await t.json())?.path;
|
|
1271
1271
|
if (!n) return r(400, { error: "Missing path" });
|
|
1272
1272
|
const c = Y(e, n);
|
|
1273
|
-
return c ? (w(c) && (
|
|
1273
|
+
return c ? (w(c) && (L(c), ee(c), l(n, c)), r(200, { ok: !0 })) : r(400, { error: "Invalid path" });
|
|
1274
1274
|
}
|
|
1275
1275
|
if (o === "POST" && s === "strings/save") {
|
|
1276
1276
|
const { path: n, content: c } = await t.json();
|
|
1277
1277
|
if (!n || !c || typeof c != "object") return r(400, { error: "Missing path or content" });
|
|
1278
1278
|
if (n !== "strings.ts" && !/^strings\/[^/]+\.ts$/.test(n)) return r(400, { error: "Invalid strings path" });
|
|
1279
1279
|
const u = Y(e, n);
|
|
1280
|
-
return u ? (G(
|
|
1280
|
+
return u ? (K(G(u), { recursive: !0 }), L(u), ue(u, Ve(c)), f.modules.push("strings", "content"), f.files.push(u), r(200, { ok: !0, commit: { fileSha: "" } })) : r(400, { error: "Invalid path" });
|
|
1281
1281
|
}
|
|
1282
1282
|
if (o === "POST" && s === "strings/set-schema") {
|
|
1283
1283
|
const { strings: n } = await t.json();
|
|
1284
1284
|
if (n != null && (typeof n != "object" || Array.isArray(n))) return r(400, { error: "Invalid strings" });
|
|
1285
|
-
const { schema: c, header: u } =
|
|
1285
|
+
const { schema: c, header: u } = B(e);
|
|
1286
1286
|
return ht(c, n), a(c, u), f.modules.push("strings", "content"), r(200, { ok: !0, commit: { fileSha: "" }, schema: c });
|
|
1287
1287
|
}
|
|
1288
1288
|
if (o === "GET" && s === "publish-state")
|
|
@@ -1303,7 +1303,7 @@ async function In(e, t) {
|
|
|
1303
1303
|
if (o === "POST" && s === "publish") {
|
|
1304
1304
|
const n = Ue(Oe(e)), c = Xe(e), u = await n.status();
|
|
1305
1305
|
let d = tt(e);
|
|
1306
|
-
u.files.some((v) => v.path.startsWith(c + "/")) && (d += 1,
|
|
1306
|
+
u.files.some((v) => v.path.startsWith(c + "/")) && (d += 1, P(m(e, ".revision"), `${d}
|
|
1307
1307
|
`)), await n.raw(["add", "-A", "--", c]);
|
|
1308
1308
|
const p = await n.status(), h = p.staged.length > 0;
|
|
1309
1309
|
let k = !1;
|
|
@@ -1324,19 +1324,19 @@ async function In(e, t) {
|
|
|
1324
1324
|
return r(200, { ok: !0, commit: { fileSha: "" }, schema: n.schema });
|
|
1325
1325
|
}
|
|
1326
1326
|
if (o === "POST" && s === "schema/set-locales") {
|
|
1327
|
-
const n = (await t.json())?.locales, { schema: c, header: u } =
|
|
1327
|
+
const n = (await t.json())?.locales, { schema: c, header: u } = B(e);
|
|
1328
1328
|
return gt(c, n), a(c, u), r(200, { ok: !0, commit: { fileSha: "" } });
|
|
1329
1329
|
}
|
|
1330
1330
|
if (o === "POST" && s === "schema/set-name") {
|
|
1331
1331
|
const { kind: n, slug: c, name: u } = await t.json();
|
|
1332
1332
|
if (!n || !c || !u) return r(400, { error: "Missing kind, slug or name" });
|
|
1333
|
-
const { schema: d, header: p } =
|
|
1333
|
+
const { schema: d, header: p } = B(e);
|
|
1334
1334
|
return yt(d, n, c, u), a(d, p), r(200, { ok: !0, commit: { fileSha: "" } });
|
|
1335
1335
|
}
|
|
1336
1336
|
if (o === "POST" && s === "schema/set-url") {
|
|
1337
1337
|
const { kind: n, slug: c, url: u } = await t.json();
|
|
1338
1338
|
if (!n || !c) return r(400, { error: "Missing kind or slug" });
|
|
1339
|
-
const { schema: d, header: p } =
|
|
1339
|
+
const { schema: d, header: p } = B(e);
|
|
1340
1340
|
return kt(d, n, c, u), a(d, p), r(200, { ok: !0, commit: { fileSha: "" } });
|
|
1341
1341
|
}
|
|
1342
1342
|
if (o === "POST" && s === "schema/rename-slug") {
|
|
@@ -1349,13 +1349,13 @@ async function In(e, t) {
|
|
|
1349
1349
|
if (o === "POST" && s === "schema/reorder") {
|
|
1350
1350
|
const { kind: n, order: c } = await t.json();
|
|
1351
1351
|
if (!n || !Array.isArray(c)) return r(400, { error: "Missing kind or order" });
|
|
1352
|
-
const { schema: u, header: d } =
|
|
1352
|
+
const { schema: u, header: d } = B(e);
|
|
1353
1353
|
return _t(u, n, c), a(u, d), r(200, { ok: !0, commit: { fileSha: "" }, schema: u });
|
|
1354
1354
|
}
|
|
1355
1355
|
if (o === "POST" && s === "schema/set-layout") {
|
|
1356
1356
|
const { kind: n, layout: c } = await t.json();
|
|
1357
1357
|
if (!n || !Array.isArray(c)) return r(400, { error: "Missing kind or layout" });
|
|
1358
|
-
const { schema: u, header: d } =
|
|
1358
|
+
const { schema: u, header: d } = B(e);
|
|
1359
1359
|
return $t(u, n, c), a(u, d), r(200, { ok: !0, commit: { fileSha: "" }, schema: u });
|
|
1360
1360
|
}
|
|
1361
1361
|
if (o === "POST" && (s === "collections/set-order" || s === "collections/set-drafts")) {
|
|
@@ -1372,11 +1372,11 @@ async function In(e, t) {
|
|
|
1372
1372
|
const { name: n, kind: c, fields: u, label: d } = await t.json() ?? {};
|
|
1373
1373
|
if (typeof n != "string" || !/^[a-z][a-z0-9_-]*$/i.test(n) || !["pages", "globals", "collections", "blocks"].includes(c)) return r(400, { error: "Invalid entry name or kind" });
|
|
1374
1374
|
if (u !== void 0 && !Array.isArray(u)) return r(400, { error: "Fields must be an array" });
|
|
1375
|
-
const p = u ?? [], { schema: h, header: k } =
|
|
1375
|
+
const p = u ?? [], { schema: h, header: k } = B(e), _ = c !== "blocks" ? `${c}/${n}.ts` : void 0, $ = _ ? Y(e, _) : void 0;
|
|
1376
1376
|
if (_ && !$) return r(400, { error: "Invalid content path" });
|
|
1377
1377
|
if (Object.hasOwn(h[c] ?? {}, n) || $ && w($)) return r(409, { error: "An entry with this name already exists" });
|
|
1378
1378
|
if (c === "collections") {
|
|
1379
|
-
const S =
|
|
1379
|
+
const S = W(e, `${c}/${n}`);
|
|
1380
1380
|
if (!S) return r(400, { error: "Invalid content path" });
|
|
1381
1381
|
if (w(S))
|
|
1382
1382
|
try {
|
|
@@ -1405,11 +1405,11 @@ async function In(e, t) {
|
|
|
1405
1405
|
}
|
|
1406
1406
|
let g = !1, O = !1;
|
|
1407
1407
|
try {
|
|
1408
|
-
$ && (G(
|
|
1408
|
+
$ && (K(G($), { recursive: !0 }), g = !0, L($), P($, v)), O = !0, Ze(e, h, k);
|
|
1409
1409
|
} catch {
|
|
1410
1410
|
const S = [];
|
|
1411
1411
|
if (O) try {
|
|
1412
|
-
y !== void 0 ?
|
|
1412
|
+
y !== void 0 ? P(b, y) : w(b) && ee(b);
|
|
1413
1413
|
} catch {
|
|
1414
1414
|
S.push("schema.ts");
|
|
1415
1415
|
}
|
|
@@ -1432,10 +1432,10 @@ async function In(e, t) {
|
|
|
1432
1432
|
if (o === "POST" && s === "files/blob") {
|
|
1433
1433
|
const n = qe(decodeURIComponent(t.header("x-okno-filename") || "")), c = t.header("x-okno-dir") ? decodeURIComponent(t.header("x-okno-dir")) : "";
|
|
1434
1434
|
if (!n || n === "-") return r(400, { error: "Invalid filename" });
|
|
1435
|
-
const u = He(c), d = u ? `${u}/${n}` : n, p =
|
|
1435
|
+
const u = He(c), d = u ? `${u}/${n}` : n, p = W(e, `files/${d}`);
|
|
1436
1436
|
if (!p) return r(400, { error: "Invalid path" });
|
|
1437
1437
|
const h = await t.binary();
|
|
1438
|
-
return h.length === 0 ? r(400, { error: "Empty body" }) : h.length > 25 * 1024 * 1024 ? r(413, { error: "Uploads are capped at 25 MB" }) : (G(
|
|
1438
|
+
return h.length === 0 ? r(400, { error: "Empty body" }) : h.length > 25 * 1024 * 1024 ? r(413, { error: "Uploads are capped at 25 MB" }) : (K(G(p), { recursive: !0 }), ue(p, h), L(p, h), r(200, { ok: !0, persisted: !0, blobSha: "", path: `files/${d}`, filename: n }));
|
|
1439
1439
|
}
|
|
1440
1440
|
if (o === "POST" && s === "files/commit") return r(200, { ok: !0 });
|
|
1441
1441
|
if (o === "POST" && s === "files/upload") {
|
|
@@ -1443,38 +1443,38 @@ async function In(e, t) {
|
|
|
1443
1443
|
if (!n || c == null) return r(400, { error: "Missing filename or content" });
|
|
1444
1444
|
const d = qe(n);
|
|
1445
1445
|
if (!d || d === "-") return r(400, { error: "Invalid filename" });
|
|
1446
|
-
const p = He(u ?? ""), h = p ? `${p}/${d}` : d, k =
|
|
1446
|
+
const p = He(u ?? ""), h = p ? `${p}/${d}` : d, k = W(e, `files/${h}`);
|
|
1447
1447
|
if (!k) return r(400, { error: "Invalid path" });
|
|
1448
|
-
G(
|
|
1448
|
+
K(G(k), { recursive: !0 });
|
|
1449
1449
|
const _ = Buffer.from(c, "base64");
|
|
1450
|
-
return ue(k, _),
|
|
1450
|
+
return ue(k, _), L(k, _), r(200, { ok: !0, path: `files/${h}`, filename: d, commit: { fileSha: "" } });
|
|
1451
1451
|
}
|
|
1452
1452
|
if (o === "POST" && s === "files/delete") {
|
|
1453
1453
|
const n = (await t.json())?.path;
|
|
1454
1454
|
if (!n) return r(400, { error: "Missing path" });
|
|
1455
1455
|
if (!fe(n)) return r(400, { error: "Invalid path" });
|
|
1456
|
-
const c =
|
|
1457
|
-
return c ? (w(c) && ee(c), r(200, { ok: !0 })) : r(400, { error: "Invalid path" });
|
|
1456
|
+
const c = W(e, n);
|
|
1457
|
+
return c ? (w(c) && (L(c), ee(c)), r(200, { ok: !0 })) : r(400, { error: "Invalid path" });
|
|
1458
1458
|
}
|
|
1459
1459
|
if (o === "POST" && s === "files/delete-many") {
|
|
1460
1460
|
const n = (await t.json())?.paths;
|
|
1461
1461
|
if (!Array.isArray(n)) return r(400, { error: "Missing paths" });
|
|
1462
1462
|
if (n.some((u) => !fe(String(u)))) return r(400, { error: "Invalid path" });
|
|
1463
|
-
const c = n.map((u) =>
|
|
1463
|
+
const c = n.map((u) => W(e, String(u)));
|
|
1464
1464
|
if (c.some((u) => !u)) return r(400, { error: "Invalid path" });
|
|
1465
|
-
for (const u of c) u && w(u) && ee(u);
|
|
1465
|
+
for (const u of c) u && w(u) && (L(u), ee(u));
|
|
1466
1466
|
return r(200, { ok: !0 });
|
|
1467
1467
|
}
|
|
1468
1468
|
if (o === "POST" && s === "files/rename") {
|
|
1469
1469
|
const { from: n, to: c } = await t.json();
|
|
1470
1470
|
if (!n || !c) return r(400, { error: "Missing from or to" });
|
|
1471
1471
|
if (!fe(n) || !fe(c)) return r(400, { error: "Invalid path" });
|
|
1472
|
-
const u =
|
|
1473
|
-
return !u || !d ? r(400, { error: "Invalid path" }) : w(u) ? u === d ? r(200, { ok: !0, unchanged: !0 }) : w(d) ? r(409, { error: "Destination already exists" }) : (G(
|
|
1472
|
+
const u = W(e, n), d = W(e, c);
|
|
1473
|
+
return !u || !d ? r(400, { error: "Invalid path" }) : w(u) ? u === d ? r(200, { ok: !0, unchanged: !0 }) : w(d) ? r(409, { error: "Destination already exists" }) : (K(G(d), { recursive: !0 }), L(u), L(d), Ye(u, d), r(200, { ok: !0, commit: { fileSha: "" } })) : r(404, { error: "Source not found" });
|
|
1474
1474
|
}
|
|
1475
1475
|
if (o === "POST" && s === "users/save") {
|
|
1476
1476
|
const n = (await t.json())?.users;
|
|
1477
|
-
return Array.isArray(n) ? (
|
|
1477
|
+
return Array.isArray(n) ? (P(m(e, "users.json"), JSON.stringify(n, null, " ") + `
|
|
1478
1478
|
`), r(200, { ok: !0, commit: { fileSha: "" } })) : r(400, { error: "Missing users" });
|
|
1479
1479
|
}
|
|
1480
1480
|
if (o === "POST" && s === "origins/save") {
|
|
@@ -1483,7 +1483,7 @@ async function In(e, t) {
|
|
|
1483
1483
|
const b = n?.origins;
|
|
1484
1484
|
if (!Array.isArray(b) || b.some((g) => typeof g != "string")) return r(400, { error: "Missing origins" });
|
|
1485
1485
|
const y = [...new Set(b.map((g) => g.trim()).filter(Boolean))];
|
|
1486
|
-
return
|
|
1486
|
+
return P(m(e, "origins.json"), JSON.stringify(y, null, " ") + `
|
|
1487
1487
|
`), r(200, { ok: !0, origins: y, commit: { fileSha: "" } });
|
|
1488
1488
|
}
|
|
1489
1489
|
const { operation: c, origin: u } = n;
|
|
@@ -1519,7 +1519,7 @@ async function In(e, t) {
|
|
|
1519
1519
|
h && $.push(h);
|
|
1520
1520
|
const v = [...new Set($)];
|
|
1521
1521
|
try {
|
|
1522
|
-
|
|
1522
|
+
P(m(e, "origins.json"), JSON.stringify(v, null, " ") + `
|
|
1523
1523
|
`);
|
|
1524
1524
|
} catch {
|
|
1525
1525
|
return r(503, { error: "Could not update the project domain list", code: "ORIGINS_WRITE_FAILED", retryable: !0 });
|
|
@@ -1528,7 +1528,7 @@ async function In(e, t) {
|
|
|
1528
1528
|
}
|
|
1529
1529
|
return null;
|
|
1530
1530
|
} catch (n) {
|
|
1531
|
-
return n instanceof
|
|
1531
|
+
return n instanceof F ? { status: n.status, body: { error: n.message, step: s === "setup/init" ? "init" : s === "setup/permissions" ? "permissions" : "status", code: n.code, retryable: n.retryable, status: n.status } } : n instanceof E ? { status: n.status, body: { error: n.message } } : { status: 500, body: { error: n instanceof Error ? n.message : String(n) } };
|
|
1532
1532
|
}
|
|
1533
1533
|
}
|
|
1534
1534
|
export {
|