@blotout/qinto-cli 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -1380,7 +1380,7 @@ var rr = Ln((e, t) => {
|
|
|
1380
1380
|
].filter(Boolean).join("\n").trimEnd()}${Cn}`;
|
|
1381
1381
|
}), ir = {
|
|
1382
1382
|
name: "@blotout/qinto-cli",
|
|
1383
|
-
version: "0.1.
|
|
1383
|
+
version: "0.1.11",
|
|
1384
1384
|
type: "module",
|
|
1385
1385
|
description: "Qinto CLI: authenticate against the Qinto platform and operate it from the terminal or from an agent.",
|
|
1386
1386
|
repository: {
|
|
@@ -5184,7 +5184,7 @@ var Xu = /^[a-z][a-z0-9-]*$/, Zu = /^[A-Z][A-Z0-9_]*$/, Qu = /^[a-z][a-z0-9-]{2,
|
|
|
5184
5184
|
message: `${e} is set by the platform on every authorize URL`
|
|
5185
5185
|
});
|
|
5186
5186
|
}
|
|
5187
|
-
}, gd = /^\/(?:(?::[a-zA-Z][a-zA-Z0-9_]*|[a-zA-Z0-9_-]+)(?:\/(?::[a-zA-Z][a-zA-Z0-9_]*|[a-zA-Z0-9_-]+))*)?$/, _d = (e) => e.startsWith(":"), vd = (e) => e === "/" ? [] : e.slice(1).split("/"), yd = (e) => `/${vd(e).map((e) => _d(e) ? ":" : e).join("/")}`, bd = (e) => vd(e).filter(_d).map((e) => e.slice(1)), xd = /^[a-zA-Z][a-zA-Z0-9_]*$/, Sd = 1024, Cd = /^[a-zA-Z][a-zA-Z0-9_]*$/, wd = [
|
|
5187
|
+
}, gd = /^\/(?:(?::[a-zA-Z][a-zA-Z0-9_]*|[a-zA-Z0-9_-]+)(?:\/(?::[a-zA-Z][a-zA-Z0-9_]*|[a-zA-Z0-9_-]+))*)?$/, _d = (e) => e.startsWith(":"), vd = (e) => e === "/" ? [] : e.slice(1).split("/"), yd = (e) => `/${vd(e).map((e) => _d(e) ? ":" : e).join("/")}`, bd = (e) => vd(e).filter(_d).map((e) => e.slice(1)), xd = /^[a-zA-Z][a-zA-Z0-9_]*$/, Sd = 16 * 1024, Cd = /^[a-zA-Z][a-zA-Z0-9_]*$/, wd = [
|
|
5188
5188
|
"teamId",
|
|
5189
5189
|
"siteId",
|
|
5190
5190
|
"installId"
|
|
@@ -5330,7 +5330,7 @@ var Xu = /^[a-z][a-z0-9-]*$/, Zu = /^[A-Z][A-Z0-9_]*$/, Qu = /^[a-z][a-z0-9-]{2,
|
|
|
5330
5330
|
message: "A read-only tool may not be destructive"
|
|
5331
5331
|
});
|
|
5332
5332
|
}, Gd = (e, t) => {
|
|
5333
|
-
K(t, e.map((e) => e.name.toLowerCase()), ["tools"], "tool name"), new TextEncoder().encode(JSON.stringify(e)).length >
|
|
5333
|
+
K(t, e.map((e) => e.name.toLowerCase()), ["tools"], "tool name"), new TextEncoder().encode(JSON.stringify(e)).length > 153600 && t.addIssue({
|
|
5334
5334
|
code: "custom",
|
|
5335
5335
|
path: ["tools"],
|
|
5336
5336
|
message: "The tools block exceeds the size cap"
|
|
@@ -5414,7 +5414,7 @@ var Xu = /^[a-z][a-z0-9-]*$/, Zu = /^[A-Z][A-Z0-9_]*$/, Qu = /^[a-z][a-z0-9-]{2,
|
|
|
5414
5414
|
"string",
|
|
5415
5415
|
"number",
|
|
5416
5416
|
"boolean"
|
|
5417
|
-
], Of = 10, kf = 512, Af = /^[^"|.$][^"|.]*(?:\.[^"|.]+)*$/, jf = 256, Mf =
|
|
5417
|
+
], Of = 10, kf = 512, Af = /^[^"|.$][^"|.]*(?:\.[^"|.]+)*$/, jf = 256, Mf = 5, Nf = 100 * 1024, Pf = [
|
|
5418
5418
|
"int32",
|
|
5419
5419
|
"int64",
|
|
5420
5420
|
"float32",
|
|
@@ -6907,7 +6907,7 @@ var rh = 16 * 1024, ih = 32 * 1024, ah = 64 * 1024, oh = H({
|
|
|
6907
6907
|
id: I().min(1).max(64),
|
|
6908
6908
|
ord: R().int().min(1),
|
|
6909
6909
|
label: I().max(100),
|
|
6910
|
-
|
|
6910
|
+
queryTicket: I().min(1).max(2048)
|
|
6911
6911
|
}).strict()).min(1).max(15)
|
|
6912
6912
|
}).strict(), fh = H({
|
|
6913
6913
|
name: I().min(1).max(32).regex(xd),
|
|
@@ -6916,7 +6916,8 @@ var rh = 16 * 1024, ih = 32 * 1024, ah = 64 * 1024, oh = H({
|
|
|
6916
6916
|
access: W(["read", "write"])
|
|
6917
6917
|
}).strict(),
|
|
6918
6918
|
arguments: U(I(), B()).default({}),
|
|
6919
|
-
callId: I().min(1).max(64)
|
|
6919
|
+
callId: I().min(1).max(64),
|
|
6920
|
+
queryTicket: I().min(1).max(2048)
|
|
6920
6921
|
}).strict().refine((e) => new TextEncoder().encode(JSON.stringify(e.arguments)).length <= ih, "Tool arguments exceed the size cap");
|
|
6921
6922
|
H({
|
|
6922
6923
|
v: G(1),
|
|
@@ -7207,7 +7208,7 @@ var Ah = (e) => JSON.stringify({
|
|
|
7207
7208
|
appId: I().min(1),
|
|
7208
7209
|
appInstallId: I().min(1),
|
|
7209
7210
|
appVersionId: I().min(1)
|
|
7210
|
-
}).strict(), Gh = (e) => `app-
|
|
7211
|
+
}).strict(), Gh = (e) => `app-runtime-query:${e}`, Kh = async (e) => {
|
|
7211
7212
|
let t = Math.floor(e.now.getTime() / 1e3), n = {
|
|
7212
7213
|
iss: Hh,
|
|
7213
7214
|
aud: Gh(e.slug),
|
|
@@ -7760,13 +7761,140 @@ var Ah = (e) => JSON.stringify({
|
|
|
7760
7761
|
manifest: r.manifest,
|
|
7761
7762
|
app: i
|
|
7762
7763
|
});
|
|
7763
|
-
}, Hg =
|
|
7764
|
+
}, Hg = 64 * 1024, Ug = async (e) => {
|
|
7765
|
+
let t = [], n = 0;
|
|
7766
|
+
for await (let r of e) {
|
|
7767
|
+
if (n += r.length, n > Hg) throw Error("The submitted form is too large.");
|
|
7768
|
+
t.push(r);
|
|
7769
|
+
}
|
|
7770
|
+
return Buffer.concat(t).toString("utf8");
|
|
7771
|
+
}, Wg = async (e) => Object.fromEntries(new URLSearchParams(await Ug(e))), Gg = "/developer/apps", Z = "/site/apps", Kg = "/site/logs", qg = "/site/settings/general", Jg = {
|
|
7772
|
+
href: "https://docs.qinto.io",
|
|
7773
|
+
label: "Docs",
|
|
7774
|
+
icon: "bookOpen",
|
|
7775
|
+
external: !0
|
|
7776
|
+
}, Yg = (e) => {
|
|
7777
|
+
if (e.path.startsWith("/developer")) return {
|
|
7778
|
+
header: {
|
|
7779
|
+
back: {
|
|
7780
|
+
href: Z,
|
|
7781
|
+
label: "Back to site"
|
|
7782
|
+
},
|
|
7783
|
+
icon: "building2",
|
|
7784
|
+
title: "Local organization",
|
|
7785
|
+
subtitle: "Organization",
|
|
7786
|
+
dot: !1
|
|
7787
|
+
},
|
|
7788
|
+
sections: [{ items: [{
|
|
7789
|
+
href: Gg,
|
|
7790
|
+
label: "Apps",
|
|
7791
|
+
icon: "blocks"
|
|
7792
|
+
}] }],
|
|
7793
|
+
footer: [Jg]
|
|
7794
|
+
};
|
|
7795
|
+
let t = [{
|
|
7796
|
+
label: "Domain",
|
|
7797
|
+
items: [
|
|
7798
|
+
{
|
|
7799
|
+
href: Kg,
|
|
7800
|
+
label: "Analytics",
|
|
7801
|
+
icon: "activity",
|
|
7802
|
+
children: [{
|
|
7803
|
+
href: Kg,
|
|
7804
|
+
label: "Real time"
|
|
7805
|
+
}]
|
|
7806
|
+
},
|
|
7807
|
+
{
|
|
7808
|
+
href: Z,
|
|
7809
|
+
label: "Apps",
|
|
7810
|
+
icon: "blocks"
|
|
7811
|
+
},
|
|
7812
|
+
{
|
|
7813
|
+
href: qg,
|
|
7814
|
+
label: "Settings",
|
|
7815
|
+
icon: "settings",
|
|
7816
|
+
children: [{
|
|
7817
|
+
href: qg,
|
|
7818
|
+
label: "General"
|
|
7819
|
+
}]
|
|
7820
|
+
}
|
|
7821
|
+
]
|
|
7822
|
+
}], n = e.apps.filter((e) => e.app.installed && e.manifest.ui !== void 0);
|
|
7823
|
+
return n.length > 0 && t.push({
|
|
7824
|
+
label: "Apps",
|
|
7825
|
+
items: n.map((e) => ({
|
|
7826
|
+
href: `${Z}/${e.slug}/ui`,
|
|
7827
|
+
label: e.manifest.name,
|
|
7828
|
+
icon: "blocks",
|
|
7829
|
+
muted: !e.app.enabled
|
|
7830
|
+
}))
|
|
7831
|
+
}), {
|
|
7832
|
+
header: {
|
|
7833
|
+
back: null,
|
|
7834
|
+
icon: "globe",
|
|
7835
|
+
title: e.state.siteDomain,
|
|
7836
|
+
subtitle: "Active",
|
|
7837
|
+
dot: !0
|
|
7838
|
+
},
|
|
7839
|
+
sections: t,
|
|
7840
|
+
footer: [Jg, {
|
|
7841
|
+
href: Gg,
|
|
7842
|
+
label: "Developer",
|
|
7843
|
+
icon: "code",
|
|
7844
|
+
external: !1
|
|
7845
|
+
}]
|
|
7846
|
+
};
|
|
7847
|
+
}, Xg = (e, t) => {
|
|
7848
|
+
let n = Dg(), r = (t, n) => {
|
|
7849
|
+
let r = e.apps().find((e) => e.slug === t);
|
|
7850
|
+
if (r === void 0) throw Error(`${t === "" ? "No app" : t} is not mounted in this session.`);
|
|
7851
|
+
return wg(r.manifest, e.appValues()[t] ?? {}, n);
|
|
7852
|
+
};
|
|
7853
|
+
return {
|
|
7854
|
+
start: async (i, a) => {
|
|
7855
|
+
let o = {
|
|
7856
|
+
slug: i.slug ?? "",
|
|
7857
|
+
appInstallId: i.appInstallId ?? "",
|
|
7858
|
+
providerId: i.providerId ?? ""
|
|
7859
|
+
}, s = r(o.slug, o.providerId);
|
|
7860
|
+
Eg(e.state().apps[o.slug], o.appInstallId);
|
|
7861
|
+
let c = await n.start(o, s, `${t()}${vg}`, Date.now());
|
|
7862
|
+
a.writeHead(303, { location: c }).end();
|
|
7863
|
+
},
|
|
7864
|
+
complete: async (t, i) => {
|
|
7865
|
+
let a = Date.now(), o = n.claim(t.searchParams.get("state") ?? "", a);
|
|
7866
|
+
if (o === null) {
|
|
7867
|
+
i.writeHead(400, { "content-type": "text/plain" }).end("that connection attempt is unknown, already used, or expired");
|
|
7868
|
+
return;
|
|
7869
|
+
}
|
|
7870
|
+
let s = `${Z}/${o.slug}`, c = t.searchParams.get("error");
|
|
7871
|
+
if (c !== null) {
|
|
7872
|
+
let e = Sg(c, t.searchParams.get("error_description"));
|
|
7873
|
+
if (e.cancelled) {
|
|
7874
|
+
i.writeHead(303, { location: s }).end();
|
|
7875
|
+
return;
|
|
7876
|
+
}
|
|
7877
|
+
throw Error(e.message);
|
|
7878
|
+
}
|
|
7879
|
+
let l = await kg(o, r(o.slug, o.providerId), t.searchParams.get("code") ?? "", a);
|
|
7880
|
+
Eg(e.state().apps[o.slug], o.appInstallId), await e.apply({
|
|
7881
|
+
state: jg(e.state(), {
|
|
7882
|
+
...o,
|
|
7883
|
+
connection: l
|
|
7884
|
+
}),
|
|
7885
|
+
secrets: e.secrets(),
|
|
7886
|
+
appValues: e.appValues()
|
|
7887
|
+
}), i.writeHead(303, { location: s }).end();
|
|
7888
|
+
},
|
|
7889
|
+
discard: n.discard
|
|
7890
|
+
};
|
|
7891
|
+
}, Zg = (e) => e === "application/javascript+module" ? "esm" : "text", Qg = async (e, t) => {
|
|
7764
7892
|
let n = JSON.parse(await S(s(e, "version.json"), "utf8"))[t];
|
|
7765
7893
|
if (n === void 0) throw Error(`The artifact directory ${e} carries no ${t} worker.`);
|
|
7766
7894
|
let r = [];
|
|
7767
7895
|
for (let t of n.modules) r.push({
|
|
7768
7896
|
name: t.name,
|
|
7769
|
-
type:
|
|
7897
|
+
type: Zg(t.contentType),
|
|
7770
7898
|
contents: await S(s(e, t.path), "utf8")
|
|
7771
7899
|
});
|
|
7772
7900
|
return {
|
|
@@ -7776,7 +7904,7 @@ var Ah = (e) => JSON.stringify({
|
|
|
7776
7904
|
mainModule: n.mainModule,
|
|
7777
7905
|
modules: r
|
|
7778
7906
|
};
|
|
7779
|
-
},
|
|
7907
|
+
}, $g = (e, t) => {
|
|
7780
7908
|
let n = /* @__PURE__ */ new Map();
|
|
7781
7909
|
for (let r of e.manifest.rpc?.calls ?? []) {
|
|
7782
7910
|
let i = t.get(r.app);
|
|
@@ -7785,9 +7913,9 @@ var Ah = (e) => JSON.stringify({
|
|
|
7785
7913
|
a.includes(r.fn) || a.push(r.fn), n.set(r.app, a);
|
|
7786
7914
|
}
|
|
7787
7915
|
return n;
|
|
7788
|
-
},
|
|
7916
|
+
}, e_ = (e, t) => {
|
|
7789
7917
|
let n = new Map(e.map((e) => [e.slug, e])), r = {};
|
|
7790
|
-
for (let i of e) for (let [e, a] of
|
|
7918
|
+
for (let i of e) for (let [e, a] of $g(i, n)) {
|
|
7791
7919
|
let n = [...a].sort(), o = ag(i.slug, e), s = t[o];
|
|
7792
7920
|
r[o] = s !== void 0 && JSON.stringify(s.functions) === JSON.stringify(n) ? s : {
|
|
7793
7921
|
caller: i.slug,
|
|
@@ -7797,19 +7925,19 @@ var Ah = (e) => JSON.stringify({
|
|
|
7797
7925
|
};
|
|
7798
7926
|
}
|
|
7799
7927
|
return r;
|
|
7800
|
-
},
|
|
7928
|
+
}, t_ = (e, t) => {
|
|
7801
7929
|
let n = {};
|
|
7802
7930
|
for (let r of Object.values(t)) r.provider === e && r.status === "approved" && (n[r.caller] = r.functions);
|
|
7803
7931
|
return n;
|
|
7804
|
-
},
|
|
7932
|
+
}, n_ = (e, t) => Object.values(t).filter((t) => t.provider === e || t.caller === e).sort((e, t) => `${e.caller}:${e.provider}`.localeCompare(`${t.caller}:${t.provider}`)), r_ = () => ({
|
|
7805
7933
|
v: 3,
|
|
7806
7934
|
appsKeyMaster: ne(32).toString("base64"),
|
|
7807
7935
|
appUiKeyId: ne(4).toString("hex"),
|
|
7808
7936
|
appUiKey: ne(32).toString("base64"),
|
|
7809
7937
|
workerAccessToken: `qwat_dev_${ne(16).toString("hex")}`,
|
|
7810
7938
|
installTokens: {}
|
|
7811
|
-
}),
|
|
7812
|
-
let n = await ng(e.keys), r = n === null ?
|
|
7939
|
+
}), i_ = async (e, t) => {
|
|
7940
|
+
let n = await ng(e.keys), r = n === null ? r_() : JSON.parse(n), i = Object.keys(r.installTokens).length;
|
|
7813
7941
|
for (let e of t) r.installTokens[e] ??= `qwat_dev_install_${ne(16).toString("hex")}`;
|
|
7814
7942
|
return (n === null || Object.keys(r.installTokens).length !== i) && await ge(e.keys, `${JSON.stringify(r, null, 2)}\n`, { mode: 384 }), {
|
|
7815
7943
|
appsKeyMaster: r.appsKeyMaster,
|
|
@@ -7818,12 +7946,12 @@ var Ah = (e) => JSON.stringify({
|
|
|
7818
7946
|
workerAccessToken: r.workerAccessToken,
|
|
7819
7947
|
installTokens: r.installTokens
|
|
7820
7948
|
};
|
|
7821
|
-
},
|
|
7949
|
+
}, a_ = (e) => Ah({ [e.appUiKeyId]: e.appUiKey }), o_ = (e) => {
|
|
7822
7950
|
if (typeof e == "string") return e;
|
|
7823
7951
|
let t = Array.isArray(e) && e.length === 1 ? e[0] : void 0;
|
|
7824
7952
|
return typeof t == "string" ? t : void 0;
|
|
7825
|
-
},
|
|
7826
|
-
let t =
|
|
7953
|
+
}, s_ = (e) => {
|
|
7954
|
+
let t = o_(e);
|
|
7827
7955
|
if (!(t === void 0 || !t.startsWith("qinto:spans "))) try {
|
|
7828
7956
|
let e = JSON.parse(t.slice(12));
|
|
7829
7957
|
return Array.isArray(e.spans) ? e : void 0;
|
|
@@ -7834,11 +7962,11 @@ var Ah = (e) => JSON.stringify({
|
|
|
7834
7962
|
new TextEncoder(), new TextDecoder(), new TextEncoder(), new h();
|
|
7835
7963
|
//#endregion
|
|
7836
7964
|
//#region ../app/dev/src/logs.ts
|
|
7837
|
-
var
|
|
7965
|
+
var c_ = (e = 500) => {
|
|
7838
7966
|
let t = [], n = /* @__PURE__ */ new Set();
|
|
7839
7967
|
return {
|
|
7840
7968
|
accept: (r) => {
|
|
7841
|
-
let i =
|
|
7969
|
+
let i = s_(r.message), a = {
|
|
7842
7970
|
at: r.timestamp,
|
|
7843
7971
|
level: r.level,
|
|
7844
7972
|
message: r.message,
|
|
@@ -7852,7 +7980,7 @@ var $g = (e = 500) => {
|
|
|
7852
7980
|
n.delete(e);
|
|
7853
7981
|
})
|
|
7854
7982
|
};
|
|
7855
|
-
},
|
|
7983
|
+
}, l_ = {
|
|
7856
7984
|
".html": "text/html; charset=utf-8",
|
|
7857
7985
|
".js": "text/javascript; charset=utf-8",
|
|
7858
7986
|
".mjs": "text/javascript; charset=utf-8",
|
|
@@ -7867,23 +7995,23 @@ var $g = (e = 500) => {
|
|
|
7867
7995
|
".ico": "image/x-icon",
|
|
7868
7996
|
".woff": "font/woff",
|
|
7869
7997
|
".woff2": "font/woff2"
|
|
7870
|
-
},
|
|
7998
|
+
}, u_ = (e) => {
|
|
7871
7999
|
let t = e.lastIndexOf(".");
|
|
7872
|
-
return (t === -1 ? void 0 :
|
|
7873
|
-
},
|
|
8000
|
+
return (t === -1 ? void 0 : l_[e.slice(t).toLowerCase()]) ?? "application/octet-stream";
|
|
8001
|
+
}, d_ = (e, t, n) => new Promise((r, i) => {
|
|
7874
8002
|
e.once("error", i), e.listen(n, t, () => {
|
|
7875
8003
|
e.off("error", i), r();
|
|
7876
8004
|
});
|
|
7877
|
-
}),
|
|
8005
|
+
}), f_ = (e) => {
|
|
7878
8006
|
try {
|
|
7879
8007
|
return decodeURIComponent(e);
|
|
7880
8008
|
} catch {
|
|
7881
8009
|
return null;
|
|
7882
8010
|
}
|
|
7883
|
-
},
|
|
8011
|
+
}, p_ = (e, t) => {
|
|
7884
8012
|
let n = u(e), r = u(s(n, c(t)));
|
|
7885
8013
|
return r === n || r.startsWith(`${n}${d}`) ? r : null;
|
|
7886
|
-
},
|
|
8014
|
+
}, m_ = async (e) => {
|
|
7887
8015
|
let t = await he(e).catch(() => null);
|
|
7888
8016
|
if (t === null) return null;
|
|
7889
8017
|
let n = t.isDirectory() ? s(e, "index.html") : e, r = t.isDirectory() ? await he(n).catch(() => null) : t;
|
|
@@ -7891,9 +8019,9 @@ var $g = (e = 500) => {
|
|
|
7891
8019
|
target: n,
|
|
7892
8020
|
size: r.size
|
|
7893
8021
|
};
|
|
7894
|
-
},
|
|
8022
|
+
}, h_ = async (e) => {
|
|
7895
8023
|
let t = e.port, n = async (t, n) => {
|
|
7896
|
-
let r =
|
|
8024
|
+
let r = f_(t);
|
|
7897
8025
|
if (r === null) {
|
|
7898
8026
|
n.writeHead(400, { "content-type": "text/plain" }).end("bad request");
|
|
7899
8027
|
return;
|
|
@@ -7903,18 +8031,18 @@ var $g = (e = 500) => {
|
|
|
7903
8031
|
n.writeHead(404, { "content-type": "text/plain" }).end("not found");
|
|
7904
8032
|
return;
|
|
7905
8033
|
}
|
|
7906
|
-
let a = r.slice(i.basePath.length), o =
|
|
8034
|
+
let a = r.slice(i.basePath.length), o = p_(i.uiRoot, a === "" ? "index.html" : a);
|
|
7907
8035
|
if (o === null) {
|
|
7908
8036
|
n.writeHead(403, { "content-type": "text/plain" }).end("forbidden");
|
|
7909
8037
|
return;
|
|
7910
8038
|
}
|
|
7911
|
-
let s = await
|
|
8039
|
+
let s = await m_(o);
|
|
7912
8040
|
if (s === null) {
|
|
7913
8041
|
n.writeHead(404, { "content-type": "text/plain" }).end("not found");
|
|
7914
8042
|
return;
|
|
7915
8043
|
}
|
|
7916
8044
|
n.writeHead(200, {
|
|
7917
|
-
"content-type":
|
|
8045
|
+
"content-type": u_(s.target),
|
|
7918
8046
|
"content-length": s.size,
|
|
7919
8047
|
"cache-control": "no-store",
|
|
7920
8048
|
"access-control-allow-origin": "*"
|
|
@@ -7926,7 +8054,7 @@ var $g = (e = 500) => {
|
|
|
7926
8054
|
}
|
|
7927
8055
|
n(e.url.split("?")[0], t);
|
|
7928
8056
|
});
|
|
7929
|
-
return await
|
|
8057
|
+
return await d_(r, e.host, e.port), t = r.address().port, {
|
|
7930
8058
|
origin: () => `http://${e.host}:${t}`,
|
|
7931
8059
|
stop: () => new Promise((e) => {
|
|
7932
8060
|
r.close(() => {
|
|
@@ -7934,37 +8062,37 @@ var $g = (e = 500) => {
|
|
|
7934
8062
|
});
|
|
7935
8063
|
})
|
|
7936
8064
|
};
|
|
7937
|
-
},
|
|
8065
|
+
}, g_ = "apps-control.json", __ = (e) => JSON.stringify({
|
|
7938
8066
|
v: 1,
|
|
7939
8067
|
apps: Object.fromEntries(e.map((e) => [e.slug, {
|
|
7940
8068
|
binding: `APP_${e.slug.toUpperCase().replaceAll("-", "_")}`,
|
|
7941
8069
|
versions: e.versions
|
|
7942
8070
|
}]))
|
|
7943
|
-
}),
|
|
8071
|
+
}), v_ = (e) => e.resources.flatMap((e) => e.type !== "durable_object" && e.type !== "workflow" ? [] : [{
|
|
7944
8072
|
className: e.className,
|
|
7945
8073
|
kind: e.type
|
|
7946
|
-
}]),
|
|
8074
|
+
}]), y_ = (e) => `app-${e}.js`, b_ = (e) => {
|
|
7947
8075
|
let t = {};
|
|
7948
8076
|
for (let n of [{
|
|
7949
8077
|
version: e.version,
|
|
7950
8078
|
manifest: e.manifest
|
|
7951
|
-
}, ...e.retained].reverse()) for (let e of
|
|
8079
|
+
}, ...e.retained].reverse()) for (let e of v_(n.manifest)) t[e.className] = {
|
|
7952
8080
|
version: n.version,
|
|
7953
8081
|
kind: e.kind
|
|
7954
8082
|
};
|
|
7955
8083
|
return t;
|
|
7956
|
-
},
|
|
8084
|
+
}, x_ = (e) => {
|
|
7957
8085
|
let t = e.classes.filter((e) => e.kind === "durable_object").map((e) => e.className), n = e.classes.filter((e) => e.kind === "workflow").map((e) => e.className);
|
|
7958
8086
|
return [...t.map((t) => {
|
|
7959
8087
|
let n = JSON.stringify(e.migrations[t] ?? []);
|
|
7960
8088
|
return `export const ${t} = withAppDurableObject(${e.namespace(e.version)}.${t}, ${n})`;
|
|
7961
8089
|
}), ...n.map((t) => `export const ${t} = createWorkflow(${JSON.stringify(t)}, ${e.identifier(e.version)})`)];
|
|
7962
|
-
},
|
|
8090
|
+
}, S_ = (e) => {
|
|
7963
8091
|
let t = [{
|
|
7964
8092
|
version: e.version,
|
|
7965
8093
|
manifest: e.manifest
|
|
7966
8094
|
}, ...e.retained], n = (e) => `app_${e.replaceAll(/[^a-zA-Z0-9]/g, "_")}`, r = (e) => `classes_${e.replaceAll(/[^a-zA-Z0-9]/g, "_")}`, i = /* @__PURE__ */ new Map();
|
|
7967
|
-
for (let [t, n] of Object.entries(
|
|
8095
|
+
for (let [t, n] of Object.entries(b_(e))) i.set(n.version, [...i.get(n.version) ?? [], {
|
|
7968
8096
|
className: t,
|
|
7969
8097
|
kind: n.kind
|
|
7970
8098
|
}]);
|
|
@@ -7977,9 +8105,9 @@ var $g = (e = 500) => {
|
|
|
7977
8105
|
}))], s = o.filter((e) => e.classes.some((e) => e.kind === "durable_object"));
|
|
7978
8106
|
return `${[
|
|
7979
8107
|
"import { createRuntime, createWorkflow, withAppDurableObject } from './runtime.js'",
|
|
7980
|
-
...a.map((e) => `import ${n(e)} from './${
|
|
7981
|
-
...s.map((e) => `import * as ${r(e.version)} from './${
|
|
7982
|
-
...o.flatMap((t) =>
|
|
8108
|
+
...a.map((e) => `import ${n(e)} from './${y_(e)}'`),
|
|
8109
|
+
...s.map((e) => `import * as ${r(e.version)} from './${y_(e.version)}'`),
|
|
8110
|
+
...o.flatMap((t) => x_({
|
|
7983
8111
|
version: t.version,
|
|
7984
8112
|
classes: t.classes,
|
|
7985
8113
|
identifier: n,
|
|
@@ -7988,32 +8116,32 @@ var $g = (e = 500) => {
|
|
|
7988
8116
|
})),
|
|
7989
8117
|
`export default createRuntime({ current: ${JSON.stringify(e.version)}, versions: { ${t.map((e) => `${JSON.stringify(e.version)}: ${n(e.version)}`).join(", ")} } })`
|
|
7990
8118
|
].join("\n")}\n`;
|
|
7991
|
-
},
|
|
8119
|
+
}, C_ = class extends Error {
|
|
7992
8120
|
reason;
|
|
7993
8121
|
constructor(e) {
|
|
7994
8122
|
super(e), this.name = "AppDeployFormatError", this.reason = e;
|
|
7995
8123
|
}
|
|
7996
|
-
},
|
|
8124
|
+
}, w_ = async (e, t, n) => {
|
|
7997
8125
|
let r = Uint8Array.from(atob(e), (e) => e.charCodeAt(0)), i = await crypto.subtle.importKey("raw", r, {
|
|
7998
8126
|
name: "HMAC",
|
|
7999
8127
|
hash: "SHA-256"
|
|
8000
8128
|
}, !1, ["sign"]), a = await crypto.subtle.sign("HMAC", i, new TextEncoder().encode(`${t}|${n}`));
|
|
8001
8129
|
return [...new Uint8Array(a)].map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
8002
|
-
},
|
|
8130
|
+
}, T_ = (e, t) => {
|
|
8003
8131
|
for (let n of e.resources) if (n.type === "durable_object" && n.className === t) return n.migrations;
|
|
8004
8132
|
return [];
|
|
8005
|
-
},
|
|
8133
|
+
}, E_ = (e, t) => {
|
|
8006
8134
|
let n = {};
|
|
8007
8135
|
for (let [r, i] of Object.entries(e)) {
|
|
8008
8136
|
if (i.kind !== "durable_object") continue;
|
|
8009
8137
|
let e = t.get(i.version);
|
|
8010
|
-
n[r] = e === void 0 ? [] :
|
|
8138
|
+
n[r] = e === void 0 ? [] : T_(e, r);
|
|
8011
8139
|
}
|
|
8012
8140
|
return n;
|
|
8013
|
-
},
|
|
8141
|
+
}, D_ = "apps-registry.json", O_ = 256 * 1024, k_ = (e) => `APP_${e.toUpperCase().replaceAll("-", "_")}`, A_ = (e) => {
|
|
8014
8142
|
let t = e.manifest.browser?.capture, n = e.manifest.browser?.eventResults ?? [];
|
|
8015
8143
|
return {
|
|
8016
|
-
binding:
|
|
8144
|
+
binding: k_(e.slug),
|
|
8017
8145
|
name: e.manifest.name,
|
|
8018
8146
|
version: e.version,
|
|
8019
8147
|
versionId: e.versionId,
|
|
@@ -8036,33 +8164,33 @@ var $g = (e = 500) => {
|
|
|
8036
8164
|
events: { publishes: e.manifest.events?.publishes ?? [] },
|
|
8037
8165
|
...t === void 0 ? {} : { capture: t }
|
|
8038
8166
|
};
|
|
8039
|
-
},
|
|
8167
|
+
}, j_ = (e) => {
|
|
8040
8168
|
let t = {
|
|
8041
8169
|
v: 1,
|
|
8042
8170
|
order: e.map((e) => e.slug),
|
|
8043
|
-
apps: Object.fromEntries(e.map((e) => [e.slug,
|
|
8171
|
+
apps: Object.fromEntries(e.map((e) => [e.slug, A_(e)]))
|
|
8044
8172
|
}, n = JSON.stringify(t);
|
|
8045
|
-
if (new TextEncoder().encode(n).length >
|
|
8173
|
+
if (new TextEncoder().encode(n).length > O_) throw new C_("The apps registry exceeds its size budget.");
|
|
8046
8174
|
return n;
|
|
8047
|
-
},
|
|
8175
|
+
}, M_ = "apps-q.json", N_ = 4 * 1024 * 1024, P_ = (e, t) => {
|
|
8048
8176
|
let n = {};
|
|
8049
8177
|
for (let r of e.manifest.variables) {
|
|
8050
8178
|
let e = t.variables[r.name];
|
|
8051
8179
|
r.browser === !0 && e !== void 0 && (n[r.name] = e);
|
|
8052
8180
|
}
|
|
8053
8181
|
return n;
|
|
8054
|
-
},
|
|
8182
|
+
}, F_ = (e, t) => {
|
|
8055
8183
|
let n = e.filter((e) => t.has(e.slug));
|
|
8056
8184
|
if (n.length === 0) return "";
|
|
8057
8185
|
let r = Object.fromEntries(n.map((e) => [e.slug, e.installs.filter((e) => e.active).map((t) => ({
|
|
8058
8186
|
id: t.appInstallId,
|
|
8059
8187
|
ord: t.ordinal,
|
|
8060
8188
|
label: t.label,
|
|
8061
|
-
variables:
|
|
8189
|
+
variables: P_(e, t)
|
|
8062
8190
|
}))])), i = `(function(d){var s=d.currentScript,g=(s&&s.dataset?s.dataset.qintoGlobal:void 0)||"qinto";var q=window[g];if(q&&q._q){q._appInstalls=${JSON.stringify(r)};}})(document);\n` + n.map((e) => t.get(e.slug)).join("");
|
|
8063
|
-
if (new TextEncoder().encode(i).length >
|
|
8191
|
+
if (new TextEncoder().encode(i).length > N_) throw new C_("The assembled apps module exceeds its size budget.");
|
|
8064
8192
|
return i;
|
|
8065
|
-
},
|
|
8193
|
+
}, I_ = (e, t) => {
|
|
8066
8194
|
let n = /* @__PURE__ */ new Map();
|
|
8067
8195
|
for (let e of [...t].reverse()) for (let t of e) n.set(t.name, {
|
|
8068
8196
|
name: t.name,
|
|
@@ -8073,15 +8201,15 @@ var $g = (e = 500) => {
|
|
|
8073
8201
|
kind: t.kind
|
|
8074
8202
|
});
|
|
8075
8203
|
return [...n.values()];
|
|
8076
|
-
},
|
|
8204
|
+
}, L_ = (e, t) => I_(e.variables, t.map((e) => e.manifest.variables)), R_ = (e, t) => I_(e.appVariables, t.map((e) => e.manifest.appVariables)), z_ = (e) => {
|
|
8077
8205
|
throw Error(`Unsupported app resource: ${String(e)}`);
|
|
8078
|
-
},
|
|
8206
|
+
}, B_ = (e, t) => {
|
|
8079
8207
|
let n = te("sha256").update(`${e}|${t}`).digest("hex").slice(0, 8);
|
|
8080
8208
|
return `${e.slice(0, 24)}-${t.slice(0, 30)}-${n}`;
|
|
8081
|
-
},
|
|
8209
|
+
}, V_ = (e) => {
|
|
8082
8210
|
let t = {}, n = {}, r = [], i = [];
|
|
8083
8211
|
for (let a of e.resources) {
|
|
8084
|
-
let o =
|
|
8212
|
+
let o = B_(e.slug, a.identifier);
|
|
8085
8213
|
switch (a.type) {
|
|
8086
8214
|
case "kv":
|
|
8087
8215
|
t[a.binding] = {
|
|
@@ -8165,7 +8293,7 @@ var $g = (e = 500) => {
|
|
|
8165
8293
|
});
|
|
8166
8294
|
break;
|
|
8167
8295
|
/* v8 ignore next 3 -- the resource type is a closed union; a value outside it cannot reach here. */
|
|
8168
|
-
default: return
|
|
8296
|
+
default: return z_(a);
|
|
8169
8297
|
}
|
|
8170
8298
|
}
|
|
8171
8299
|
return {
|
|
@@ -8174,9 +8302,9 @@ var $g = (e = 500) => {
|
|
|
8174
8302
|
inert: r,
|
|
8175
8303
|
migrations: i
|
|
8176
8304
|
};
|
|
8177
|
-
},
|
|
8305
|
+
}, H_ = "qinto-dev-site", U_ = (e) => `qinto-dev-app-${e}`, W_ = (e, t, n) => {
|
|
8178
8306
|
let r = {};
|
|
8179
|
-
for (let i of
|
|
8307
|
+
for (let i of L_(e, [])) {
|
|
8180
8308
|
let e = {};
|
|
8181
8309
|
for (let r of t.installs) {
|
|
8182
8310
|
let t = i.kind === "secret" ? n[r.appInstallId]?.[i.name] : r.variables[i.name];
|
|
@@ -8185,7 +8313,7 @@ var $g = (e = 500) => {
|
|
|
8185
8313
|
Object.keys(e).length > 0 && (r[i.name] = e);
|
|
8186
8314
|
}
|
|
8187
8315
|
return r;
|
|
8188
|
-
},
|
|
8316
|
+
}, G_ = (e, t, n) => {
|
|
8189
8317
|
let r = {};
|
|
8190
8318
|
for (let i of e.oauth) for (let e of t.installs) {
|
|
8191
8319
|
let t = e.oauth[i.id];
|
|
@@ -8201,28 +8329,28 @@ var $g = (e = 500) => {
|
|
|
8201
8329
|
r[yh(i.id, e.ordinal)] = JSON.stringify(a);
|
|
8202
8330
|
}
|
|
8203
8331
|
return r;
|
|
8204
|
-
},
|
|
8205
|
-
let t =
|
|
8332
|
+
}, K_ = async (e) => {
|
|
8333
|
+
let t = y_(e.version), n = b_({
|
|
8206
8334
|
version: e.version,
|
|
8207
8335
|
manifest: e.manifest,
|
|
8208
8336
|
retained: []
|
|
8209
|
-
}), r =
|
|
8337
|
+
}), r = S_({
|
|
8210
8338
|
version: e.version,
|
|
8211
8339
|
manifest: e.manifest,
|
|
8212
8340
|
retained: [],
|
|
8213
8341
|
grace: [],
|
|
8214
|
-
migrations: await
|
|
8215
|
-
}), i =
|
|
8342
|
+
migrations: await E_(n, /* @__PURE__ */ new Map([[e.version, e.manifest]]))
|
|
8343
|
+
}), i = V_({
|
|
8216
8344
|
resources: e.manifest.resources,
|
|
8217
8345
|
slug: e.manifest.slug,
|
|
8218
|
-
workerName:
|
|
8346
|
+
workerName: U_(e.manifest.slug),
|
|
8219
8347
|
hyperdrive: e.app.hyperdrive,
|
|
8220
8348
|
hyperdriveClaims: e.hyperdriveClaims
|
|
8221
8349
|
}), a = {
|
|
8222
8350
|
...i.bindings,
|
|
8223
8351
|
QINTO_INTERNAL_KEY: {
|
|
8224
8352
|
type: "text",
|
|
8225
|
-
value: await
|
|
8353
|
+
value: await w_(e.keys.appsKeyMaster, e.state.domainId, e.manifest.slug)
|
|
8226
8354
|
},
|
|
8227
8355
|
QINTO_INSTALL_TOKEN: {
|
|
8228
8356
|
type: "text",
|
|
@@ -8235,8 +8363,8 @@ var $g = (e = 500) => {
|
|
|
8235
8363
|
slug: e.manifest.slug,
|
|
8236
8364
|
version: e.version,
|
|
8237
8365
|
enabled: e.app.enabled,
|
|
8238
|
-
variableKinds: Object.fromEntries(
|
|
8239
|
-
appVariableKinds: Object.fromEntries(
|
|
8366
|
+
variableKinds: Object.fromEntries(L_(e.manifest, []).map((e) => [e.name, e.kind])),
|
|
8367
|
+
appVariableKinds: Object.fromEntries(R_(e.manifest, []).map((e) => [e.name, e.kind]))
|
|
8240
8368
|
})
|
|
8241
8369
|
},
|
|
8242
8370
|
QINTO_PLATFORM_API: {
|
|
@@ -8245,19 +8373,19 @@ var $g = (e = 500) => {
|
|
|
8245
8373
|
},
|
|
8246
8374
|
QINTO_SITE: {
|
|
8247
8375
|
type: "worker",
|
|
8248
|
-
workerName:
|
|
8376
|
+
workerName: H_,
|
|
8249
8377
|
exportName: "Broker"
|
|
8250
8378
|
}
|
|
8251
8379
|
};
|
|
8252
|
-
for (let [t, n] of Object.entries(
|
|
8380
|
+
for (let [t, n] of Object.entries(W_(e.manifest, e.app, e.secrets))) a[`VAR_${t}`] = {
|
|
8253
8381
|
type: "text",
|
|
8254
8382
|
value: JSON.stringify(n)
|
|
8255
8383
|
};
|
|
8256
|
-
for (let [t, n] of Object.entries(
|
|
8384
|
+
for (let [t, n] of Object.entries(G_(e.manifest, e.app, Date.now()))) a[t] = {
|
|
8257
8385
|
type: "text",
|
|
8258
8386
|
value: n
|
|
8259
8387
|
};
|
|
8260
|
-
for (let t of
|
|
8388
|
+
for (let t of R_(e.manifest, [])) {
|
|
8261
8389
|
let n = e.appValues[t.name];
|
|
8262
8390
|
n !== void 0 && (a[`APPVAR_${t.name}`] = {
|
|
8263
8391
|
type: "text",
|
|
@@ -8288,23 +8416,23 @@ var $g = (e = 500) => {
|
|
|
8288
8416
|
inert: i.inert,
|
|
8289
8417
|
migrations: i.migrations
|
|
8290
8418
|
};
|
|
8291
|
-
},
|
|
8419
|
+
}, q_ = [
|
|
8292
8420
|
"GET",
|
|
8293
8421
|
"POST",
|
|
8294
8422
|
"PUT",
|
|
8295
8423
|
"PATCH",
|
|
8296
8424
|
"DELETE"
|
|
8297
|
-
],
|
|
8425
|
+
], J_ = {
|
|
8298
8426
|
GET: 1,
|
|
8299
8427
|
POST: 2,
|
|
8300
8428
|
PUT: 4,
|
|
8301
8429
|
PATCH: 8,
|
|
8302
8430
|
DELETE: 16
|
|
8303
8431
|
};
|
|
8304
|
-
|
|
8432
|
+
q_.reduce((e, t) => e | J_[t], 0);
|
|
8305
8433
|
//#endregion
|
|
8306
8434
|
//#region ../../libs/worker-access-token/src/scopes.ts
|
|
8307
|
-
var
|
|
8435
|
+
var Y_ = {
|
|
8308
8436
|
track: 1,
|
|
8309
8437
|
identify: 2,
|
|
8310
8438
|
alias: 4,
|
|
@@ -8313,46 +8441,46 @@ var B_ = {
|
|
|
8313
8441
|
consentRead: 32,
|
|
8314
8442
|
sessionRead: 64,
|
|
8315
8443
|
idGraphInspect: 128
|
|
8316
|
-
},
|
|
8317
|
-
|
|
8318
|
-
var
|
|
8444
|
+
}, X_ = Object.values(Y_).reduce((e, t) => e | t, 0);
|
|
8445
|
+
Y_.track, Y_.identify, Y_.alias, Y_.consentWrite, Y_.propertiesRead, Y_.consentRead, Y_.sessionRead;
|
|
8446
|
+
var Z_ = (e) => e.reduce((e, t) => e | Y_[t], 0), Q_ = (e) => {
|
|
8319
8447
|
let t = e.endpoints ?? [];
|
|
8320
8448
|
return e.app === void 0 && t.length === 0 ? e.mask : {
|
|
8321
8449
|
m: e.mask,
|
|
8322
8450
|
...e.app === void 0 ? {} : { a: e.app },
|
|
8323
8451
|
...t.length === 0 ? {} : { e: t.map((e) => [e.methods, e.path]) }
|
|
8324
8452
|
};
|
|
8325
|
-
},
|
|
8453
|
+
}, $_ = (e) => {
|
|
8326
8454
|
let t = {};
|
|
8327
|
-
for (let n of [...e].sort((e, t) => e.hashB64u.localeCompare(t.hashB64u))) t[n.hashB64u] =
|
|
8455
|
+
for (let n of [...e].sort((e, t) => e.hashB64u.localeCompare(t.hashB64u))) t[n.hashB64u] = Q_(n);
|
|
8328
8456
|
return JSON.stringify({
|
|
8329
8457
|
v: 2,
|
|
8330
8458
|
t
|
|
8331
8459
|
});
|
|
8332
|
-
},
|
|
8460
|
+
}, ev = async (e) => {
|
|
8333
8461
|
let t = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(e)), n = "";
|
|
8334
8462
|
for (let e of new Uint8Array(t)) n += String.fromCharCode(e);
|
|
8335
8463
|
return btoa(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
8336
|
-
},
|
|
8464
|
+
}, tv = {
|
|
8337
8465
|
ANON_DO: "AnonDO",
|
|
8338
8466
|
GLOBAL_DO: "GlobalDO",
|
|
8339
8467
|
ALIAS_DO: "AliasDO"
|
|
8340
|
-
},
|
|
8468
|
+
}, nv = async (e) => {
|
|
8341
8469
|
let t = [{
|
|
8342
|
-
hashB64u: await
|
|
8343
|
-
mask:
|
|
8470
|
+
hashB64u: await ev(e.keys.workerAccessToken),
|
|
8471
|
+
mask: X_
|
|
8344
8472
|
}];
|
|
8345
8473
|
for (let n of e.apps) t.push({
|
|
8346
|
-
hashB64u: await
|
|
8347
|
-
mask:
|
|
8474
|
+
hashB64u: await ev(n.installToken),
|
|
8475
|
+
mask: Z_(n.deployable.manifest.capabilities.api),
|
|
8348
8476
|
app: n.deployable.slug
|
|
8349
8477
|
});
|
|
8350
|
-
return
|
|
8351
|
-
},
|
|
8478
|
+
return $_(t);
|
|
8479
|
+
}, rv = async (e) => {
|
|
8352
8480
|
let t = e.apps.map((e) => e.deployable), n = {
|
|
8353
8481
|
WORKER_ACCESS_TOKENS: {
|
|
8354
8482
|
type: "text",
|
|
8355
|
-
value: await
|
|
8483
|
+
value: await nv(e)
|
|
8356
8484
|
},
|
|
8357
8485
|
APPS_KEY_MASTER: {
|
|
8358
8486
|
type: "text",
|
|
@@ -8360,7 +8488,7 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8360
8488
|
},
|
|
8361
8489
|
APP_UI_KEY: {
|
|
8362
8490
|
type: "text",
|
|
8363
|
-
value:
|
|
8491
|
+
value: a_(e.keys)
|
|
8364
8492
|
},
|
|
8365
8493
|
BOT_PROTECTION: {
|
|
8366
8494
|
type: "text",
|
|
@@ -8422,13 +8550,13 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8422
8550
|
name: "qinto_app_errors_dev"
|
|
8423
8551
|
}
|
|
8424
8552
|
};
|
|
8425
|
-
for (let e of t) n[
|
|
8553
|
+
for (let e of t) n[k_(e.slug)] = {
|
|
8426
8554
|
type: "worker",
|
|
8427
8555
|
workerName: e.workerName
|
|
8428
8556
|
};
|
|
8429
|
-
for (let [e, t] of Object.entries(
|
|
8557
|
+
for (let [e, t] of Object.entries(tv)) n[e] = {
|
|
8430
8558
|
type: "durable-object",
|
|
8431
|
-
workerName:
|
|
8559
|
+
workerName: H_,
|
|
8432
8560
|
exportName: t
|
|
8433
8561
|
};
|
|
8434
8562
|
return {
|
|
@@ -8436,9 +8564,9 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8436
8564
|
modules: [
|
|
8437
8565
|
...e.artifact.modules,
|
|
8438
8566
|
{
|
|
8439
|
-
name:
|
|
8567
|
+
name: g_,
|
|
8440
8568
|
type: "text",
|
|
8441
|
-
contents:
|
|
8569
|
+
contents: __(t.map((e) => ({
|
|
8442
8570
|
slug: e.slug,
|
|
8443
8571
|
workerName: e.workerName,
|
|
8444
8572
|
versions: [{
|
|
@@ -8448,23 +8576,23 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8448
8576
|
})))
|
|
8449
8577
|
},
|
|
8450
8578
|
{
|
|
8451
|
-
name:
|
|
8579
|
+
name: D_,
|
|
8452
8580
|
type: "text",
|
|
8453
|
-
contents:
|
|
8581
|
+
contents: j_(t)
|
|
8454
8582
|
},
|
|
8455
8583
|
{
|
|
8456
|
-
name:
|
|
8584
|
+
name: M_,
|
|
8457
8585
|
type: "text",
|
|
8458
|
-
contents:
|
|
8586
|
+
contents: F_(t, e.browserBundles)
|
|
8459
8587
|
}
|
|
8460
8588
|
],
|
|
8461
8589
|
env: n,
|
|
8462
|
-
exports: Object.fromEntries(Object.values(
|
|
8590
|
+
exports: Object.fromEntries(Object.values(tv).map((e) => [e, {
|
|
8463
8591
|
type: "durable-object",
|
|
8464
8592
|
storage: "sqlite"
|
|
8465
8593
|
}]))
|
|
8466
8594
|
};
|
|
8467
|
-
},
|
|
8595
|
+
}, iv = async (e, t) => {
|
|
8468
8596
|
let n = await Nr({
|
|
8469
8597
|
dir: e,
|
|
8470
8598
|
manifest: t,
|
|
@@ -8477,7 +8605,7 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8477
8605
|
server: await S(n.server, "utf8"),
|
|
8478
8606
|
browser: n.browser === null ? null : await S(n.browser, "utf8")
|
|
8479
8607
|
};
|
|
8480
|
-
},
|
|
8608
|
+
}, av = (e, t) => `/${e}/${t}/`, ov = async (e, t, n) => {
|
|
8481
8609
|
if (t.ui === void 0) return null;
|
|
8482
8610
|
await Wr({
|
|
8483
8611
|
dir: e,
|
|
@@ -8489,20 +8617,20 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8489
8617
|
uiRoot: r,
|
|
8490
8618
|
basePath: n
|
|
8491
8619
|
}), r;
|
|
8492
|
-
},
|
|
8493
|
-
let t = await e.readManifest(), n = ig(t.slug), r =
|
|
8620
|
+
}, sv = async (e) => {
|
|
8621
|
+
let t = await e.readManifest(), n = ig(t.slug), r = av(n, e.version);
|
|
8494
8622
|
return {
|
|
8495
8623
|
slug: t.slug,
|
|
8496
8624
|
dir: e.dir,
|
|
8497
8625
|
appId: n,
|
|
8498
8626
|
manifest: t,
|
|
8499
|
-
built: await
|
|
8627
|
+
built: await iv(e.dir, t),
|
|
8500
8628
|
basePath: r,
|
|
8501
|
-
uiRoot: await
|
|
8629
|
+
uiRoot: await ov(e.dir, t, r),
|
|
8502
8630
|
inert: [],
|
|
8503
8631
|
readManifest: e.readManifest
|
|
8504
8632
|
};
|
|
8505
|
-
},
|
|
8633
|
+
}, cv = async (e) => {
|
|
8506
8634
|
let t = e.artifacts.runtime.modules.find((t) => t.name === e.artifacts.runtime.mainModule);
|
|
8507
8635
|
if (t === void 0) throw Error("The app-runtime artifact carries no main module.");
|
|
8508
8636
|
let n = /* @__PURE__ */ new Map(), r = {}, i = [], a = /* @__PURE__ */ new Map();
|
|
@@ -8510,7 +8638,7 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8510
8638
|
let s = e.state.apps[o.slug], c = e.keys.installTokens[o.slug];
|
|
8511
8639
|
/* v8 ignore next 3 -- discharges the index signature: both are seeded for exactly the mounted slugs before the first composition. */
|
|
8512
8640
|
if (s === void 0 || c === void 0) throw Error(`No local state for ${o.slug}.`);
|
|
8513
|
-
let l = await
|
|
8641
|
+
let l = await K_({
|
|
8514
8642
|
manifest: o.manifest,
|
|
8515
8643
|
state: e.state,
|
|
8516
8644
|
app: s,
|
|
@@ -8530,14 +8658,14 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8530
8658
|
app: s,
|
|
8531
8659
|
secrets: e.secrets,
|
|
8532
8660
|
version: e.version,
|
|
8533
|
-
workerName:
|
|
8534
|
-
grants:
|
|
8661
|
+
workerName: U_(o.slug),
|
|
8662
|
+
grants: t_(o.slug, e.state.rpcGrants)
|
|
8535
8663
|
}),
|
|
8536
8664
|
installToken: c
|
|
8537
8665
|
}), o.built.browser !== null && a.set(o.slug, o.built.browser));
|
|
8538
8666
|
}
|
|
8539
8667
|
return {
|
|
8540
|
-
site: await
|
|
8668
|
+
site: await rv({
|
|
8541
8669
|
artifact: e.artifacts.main,
|
|
8542
8670
|
apps: i,
|
|
8543
8671
|
browserBundles: a,
|
|
@@ -8548,7 +8676,7 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8548
8676
|
}),
|
|
8549
8677
|
apps: r
|
|
8550
8678
|
};
|
|
8551
|
-
},
|
|
8679
|
+
}, lv = (e, t, n) => {
|
|
8552
8680
|
let r = t + 1;
|
|
8553
8681
|
for (; r < e.length;) {
|
|
8554
8682
|
if (e[r] === n && e[r + 1] === n) {
|
|
@@ -8565,29 +8693,29 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8565
8693
|
end: r,
|
|
8566
8694
|
closed: !1
|
|
8567
8695
|
};
|
|
8568
|
-
},
|
|
8696
|
+
}, uv = /\b_qinto_migrations\b/i, dv = /\b(BEGIN|COMMIT|ROLLBACK|SAVEPOINT|RELEASE)\b/i, fv = /\b(COMMIT|ROLLBACK|SAVEPOINT|RELEASE)\b/i, pv = /\bBEGIN\b/gi, mv = /^CREATE\s+(TEMP\s+|TEMPORARY\s+)?TRIGGER\b/i, hv = (e) => mv.test(e) ? fv.test(e) || (e.match(pv)?.length ?? 0) > 1 : dv.test(e), gv = /^CREATE\s+(UNIQUE\s+)?(TABLE|INDEX|VIEW)\s+IF\s+NOT\s+EXISTS\s+\S/i, _v = /^CREATE\s+(TEMP\s+|TEMPORARY\s+)?TRIGGER\s+IF\s+NOT\s+EXISTS\s+\S/i, vv = /^ALTER\s+TABLE\s+\S+\s+ADD\s+(COLUMN\s+)?(?!CONSTRAINT\b)\S/i, yv = (e, t) => {
|
|
8569
8697
|
let n = t;
|
|
8570
8698
|
for (; n < e.length && e[n] !== "\n";) n += 1;
|
|
8571
8699
|
return n;
|
|
8572
|
-
},
|
|
8700
|
+
}, bv = (e, t) => {
|
|
8573
8701
|
let n = t + 2;
|
|
8574
8702
|
for (; n < e.length && !(e[n] === "*" && e[n + 1] === "/");) n += 1;
|
|
8575
8703
|
return n + 2;
|
|
8576
|
-
},
|
|
8704
|
+
}, xv = (e, t = !1) => {
|
|
8577
8705
|
let n = "", r = !1, i = 0;
|
|
8578
8706
|
for (; i < e.length;) {
|
|
8579
8707
|
let a = e[i];
|
|
8580
8708
|
if (a === "'" || a === "\"") {
|
|
8581
|
-
let o =
|
|
8709
|
+
let o = lv(e, i, a);
|
|
8582
8710
|
n += t ? " " : e.slice(i, o.end), r ||= !o.closed, i = o.end;
|
|
8583
8711
|
continue;
|
|
8584
8712
|
}
|
|
8585
8713
|
if (a === "-" && e[i + 1] === "-") {
|
|
8586
|
-
i =
|
|
8714
|
+
i = yv(e, i);
|
|
8587
8715
|
continue;
|
|
8588
8716
|
}
|
|
8589
8717
|
if (a === "/" && e[i + 1] === "*") {
|
|
8590
|
-
i =
|
|
8718
|
+
i = bv(e, i);
|
|
8591
8719
|
continue;
|
|
8592
8720
|
}
|
|
8593
8721
|
n += a, i += 1;
|
|
@@ -8596,34 +8724,34 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8596
8724
|
stripped: n,
|
|
8597
8725
|
unterminatedLiteral: r
|
|
8598
8726
|
};
|
|
8599
|
-
},
|
|
8727
|
+
}, Sv = (e, t, n) => {
|
|
8600
8728
|
for (let [r, i] of e.statements.entries()) {
|
|
8601
|
-
let a =
|
|
8729
|
+
let a = xv(i), o = a.stripped.trim();
|
|
8602
8730
|
if (a.unterminatedLiteral) return `Migration ${t} (${e.id}) statement ${r + 1} contains an unterminated quoted string.`;
|
|
8603
8731
|
if (o === "") return `Migration ${t} (${e.id}) statement ${r + 1} is empty.`;
|
|
8604
|
-
if (
|
|
8605
|
-
if (
|
|
8606
|
-
if (n && !
|
|
8732
|
+
if (uv.test(o)) return `Migration ${t} (${e.id}) may not touch the _qinto_migrations table.`;
|
|
8733
|
+
if (hv(xv(i, !0).stripped.trim())) return `Migration ${t} (${e.id}) may not contain explicit transaction control.`;
|
|
8734
|
+
if (n && !gv.test(o) && !_v.test(o) && !vv.test(o)) return `Migration ${t} (${e.id}) must be additive: expand accepts CREATE … IF NOT EXISTS and ALTER TABLE … ADD COLUMN.`;
|
|
8607
8735
|
}
|
|
8608
8736
|
return null;
|
|
8609
|
-
},
|
|
8737
|
+
}, Cv = (e, t) => e.phase === "backfill" ? null : Sv(e, t, e.phase === "expand"), wv = (e) => {
|
|
8610
8738
|
let t = /* @__PURE__ */ new Set();
|
|
8611
8739
|
for (let [n, r] of e.entries()) {
|
|
8612
8740
|
if (t.has(r.id)) return `Migration ${n + 1} repeats id ${r.id}.`;
|
|
8613
8741
|
t.add(r.id);
|
|
8614
|
-
let e =
|
|
8742
|
+
let e = Cv(r, n + 1);
|
|
8615
8743
|
if (e !== null) return e;
|
|
8616
8744
|
}
|
|
8617
8745
|
return null;
|
|
8618
|
-
},
|
|
8619
|
-
await e.exec(`CREATE TABLE IF NOT EXISTS ${
|
|
8620
|
-
let t = await e.prepare(`SELECT id, checksum FROM ${
|
|
8746
|
+
}, Tv = "_qinto_dev_backfills", Ev = "_qinto_migrations", Dv = (e) => te("sha256").update(JSON.stringify(e)).digest("hex"), Ov = "Run `qinto app dev --reset` to rebuild this local database.", kv = async (e) => {
|
|
8747
|
+
await e.exec(`CREATE TABLE IF NOT EXISTS ${Ev} (id text primary key, checksum text not null, phase text not null, applied_at text not null)`);
|
|
8748
|
+
let t = await e.prepare(`SELECT id, checksum FROM ${Ev} ORDER BY applied_at, id`).all();
|
|
8621
8749
|
return new Map(t.results.map((e) => [e.id, e.checksum]));
|
|
8622
|
-
},
|
|
8750
|
+
}, Av = async (e) => {
|
|
8623
8751
|
let { database: t, plan: n, migration: r, checksum: i, run: a } = e;
|
|
8624
|
-
await t.exec(`CREATE TABLE IF NOT EXISTS ${
|
|
8625
|
-
let o = await t.prepare(`SELECT checksum, checkpoint, completed FROM ${
|
|
8626
|
-
if (o !== null && o.checksum !== i) throw Error(`${n.binding} migration ${r.id} changed after it was applied. ${
|
|
8752
|
+
await t.exec(`CREATE TABLE IF NOT EXISTS ${Tv} (id text primary key, checksum text not null, checkpoint text, completed integer not null)`);
|
|
8753
|
+
let o = await t.prepare(`SELECT checksum, checkpoint, completed FROM ${Tv} WHERE id = ?`).bind(r.id).first();
|
|
8754
|
+
if (o !== null && o.checksum !== i) throw Error(`${n.binding} migration ${r.id} changed after it was applied. ${Ov}`);
|
|
8627
8755
|
if (o?.completed === 1) return "already_complete";
|
|
8628
8756
|
let s = o?.checkpoint === null || o?.checkpoint === void 0 ? null : JSON.parse(o.checkpoint), c = await a({
|
|
8629
8757
|
resource: n.resource,
|
|
@@ -8635,18 +8763,18 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8635
8763
|
checkpoint: s
|
|
8636
8764
|
});
|
|
8637
8765
|
if (!c.ok || c.migration === void 0) throw Error(c.error?.message ?? `${n.binding} migration ${r.id} returned no result`);
|
|
8638
|
-
if (c.migration.done) return await t.exec(`INSERT INTO ${
|
|
8766
|
+
if (c.migration.done) return await t.exec(`INSERT INTO ${Tv} (id, checksum, checkpoint, completed) VALUES ('${r.id}', '${i}', NULL, 1)
|
|
8639
8767
|
ON CONFLICT(id) DO UPDATE SET checksum = excluded.checksum, checkpoint = NULL, completed = 1`), "complete";
|
|
8640
8768
|
let l = JSON.stringify(c.migration.checkpoint).replaceAll("'", "''");
|
|
8641
|
-
return await t.exec(`INSERT INTO ${
|
|
8769
|
+
return await t.exec(`INSERT INTO ${Tv} (id, checksum, checkpoint, completed) VALUES ('${r.id}', '${i}', '${l}', 0)
|
|
8642
8770
|
ON CONFLICT(id) DO UPDATE SET checksum = excluded.checksum, checkpoint = excluded.checkpoint, completed = 0`), "pending";
|
|
8643
|
-
},
|
|
8771
|
+
}, jv = (e, t) => {
|
|
8644
8772
|
for (let [n, r] of t) {
|
|
8645
8773
|
let t = e.migrations.find((e) => e.id === n);
|
|
8646
|
-
if (t === void 0 || t.phase === "backfill") throw Error(`${e.binding} has applied migration ${n} which the manifest no longer declares. ${
|
|
8647
|
-
if (
|
|
8774
|
+
if (t === void 0 || t.phase === "backfill") throw Error(`${e.binding} has applied migration ${n} which the manifest no longer declares. ${Ov}`);
|
|
8775
|
+
if (Dv(t) !== r) throw Error(`${e.binding} migration ${n} changed after it was applied. ${Ov}`);
|
|
8648
8776
|
}
|
|
8649
|
-
},
|
|
8777
|
+
}, Mv = async (e) => {
|
|
8650
8778
|
let { plan: t, migration: n, checksum: r, run: i } = e, a = await i({
|
|
8651
8779
|
resource: t.resource,
|
|
8652
8780
|
binding: t.binding,
|
|
@@ -8656,16 +8784,16 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8656
8784
|
statements: n.statements
|
|
8657
8785
|
});
|
|
8658
8786
|
if (!a.ok || a.migration?.done !== !0) throw Error(a.error?.message ?? `${t.binding} migration ${n.id} returned no completion result`);
|
|
8659
|
-
},
|
|
8660
|
-
let r =
|
|
8787
|
+
}, Nv = async (e, t, n) => {
|
|
8788
|
+
let r = wv(t.migrations);
|
|
8661
8789
|
if (r !== null) throw Error(`${t.binding}: ${r}`);
|
|
8662
|
-
let i = await
|
|
8663
|
-
|
|
8790
|
+
let i = await kv(e);
|
|
8791
|
+
jv(t, i);
|
|
8664
8792
|
let a = 0;
|
|
8665
8793
|
for (let r of t.migrations) {
|
|
8666
|
-
let o =
|
|
8794
|
+
let o = Dv(r);
|
|
8667
8795
|
if (r.phase === "backfill") {
|
|
8668
|
-
let i = await
|
|
8796
|
+
let i = await Av({
|
|
8669
8797
|
database: e,
|
|
8670
8798
|
plan: t,
|
|
8671
8799
|
migration: r,
|
|
@@ -8675,7 +8803,7 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8675
8803
|
if (i === "complete" && (a += 1), i === "pending") return a;
|
|
8676
8804
|
continue;
|
|
8677
8805
|
}
|
|
8678
|
-
i.has(r.id) || (await
|
|
8806
|
+
i.has(r.id) || (await Mv({
|
|
8679
8807
|
plan: t,
|
|
8680
8808
|
migration: r,
|
|
8681
8809
|
checksum: o,
|
|
@@ -8683,10 +8811,10 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8683
8811
|
}), i.set(r.id, o), a += 1);
|
|
8684
8812
|
}
|
|
8685
8813
|
return a;
|
|
8686
|
-
},
|
|
8814
|
+
}, Pv = (e) => Object.fromEntries(e.map((e) => [e.name, {
|
|
8687
8815
|
type: e.type,
|
|
8688
8816
|
contents: e.contents
|
|
8689
|
-
}])),
|
|
8817
|
+
}])), Fv = (e, t) => ({
|
|
8690
8818
|
country: e.country,
|
|
8691
8819
|
region: e.region,
|
|
8692
8820
|
city: e.city,
|
|
@@ -8698,7 +8826,7 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8698
8826
|
corporateProxy: !1,
|
|
8699
8827
|
staticResource: !1
|
|
8700
8828
|
}
|
|
8701
|
-
}),
|
|
8829
|
+
}), Iv = (e) => {
|
|
8702
8830
|
let t = { rootPath: e.persistRoot }, n = (n, r) => ({
|
|
8703
8831
|
dev: t,
|
|
8704
8832
|
config: {
|
|
@@ -8708,7 +8836,7 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8708
8836
|
compatibilityFlags: e.compatibilityFlags,
|
|
8709
8837
|
manifest: {
|
|
8710
8838
|
mainModule: r.mainModule,
|
|
8711
|
-
modules:
|
|
8839
|
+
modules: Pv(r.modules)
|
|
8712
8840
|
},
|
|
8713
8841
|
env: r.env,
|
|
8714
8842
|
exports: r.exports
|
|
@@ -8720,10 +8848,10 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8720
8848
|
cf: e.cf,
|
|
8721
8849
|
handleStructuredLogs: e.onLog,
|
|
8722
8850
|
resourcePersistencePath: e.persistRoot,
|
|
8723
|
-
workers: [n(
|
|
8851
|
+
workers: [n(H_, e.stack.site), ...Object.entries(e.stack.apps).map(([e, t]) => n(U_(e), t))]
|
|
8724
8852
|
};
|
|
8725
|
-
},
|
|
8726
|
-
let r = new ye(
|
|
8853
|
+
}, Lv = (e, t, n) => {
|
|
8854
|
+
let r = new ye(Iv({
|
|
8727
8855
|
...e,
|
|
8728
8856
|
stack: t,
|
|
8729
8857
|
cf: n
|
|
@@ -8735,7 +8863,7 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8735
8863
|
key: a.value
|
|
8736
8864
|
};
|
|
8737
8865
|
}, o = async (e, t, n, i) => {
|
|
8738
|
-
let a = await r.ready, o = await (await r.getWorker(
|
|
8866
|
+
let a = await r.ready, o = await (await r.getWorker(U_(e))).fetch("https://app/__qinto/control", {
|
|
8739
8867
|
method: "POST",
|
|
8740
8868
|
headers: {
|
|
8741
8869
|
"content-type": "application/json",
|
|
@@ -8757,7 +8885,7 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8757
8885
|
};
|
|
8758
8886
|
return {
|
|
8759
8887
|
update: async (t) => {
|
|
8760
|
-
await r.setOptions(
|
|
8888
|
+
await r.setOptions(Iv({
|
|
8761
8889
|
...e,
|
|
8762
8890
|
stack: t,
|
|
8763
8891
|
cf: n
|
|
@@ -8767,7 +8895,7 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8767
8895
|
for (let [e, t] of Object.entries(i.apps)) {
|
|
8768
8896
|
if (t.migrations.length === 0) continue;
|
|
8769
8897
|
let n = a(e, "migration"), i = async (t) => o(e, n, "migration", { migration: t });
|
|
8770
|
-
for (let n of t.migrations) await
|
|
8898
|
+
for (let n of t.migrations) await Nv(await r.getD1Database(n.binding, U_(e)), n, i);
|
|
8771
8899
|
}
|
|
8772
8900
|
},
|
|
8773
8901
|
runSchedule: async (e, t, n) => {
|
|
@@ -8783,21 +8911,21 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8783
8911
|
ready: () => r.ready,
|
|
8784
8912
|
dispose: () => r.dispose()
|
|
8785
8913
|
};
|
|
8786
|
-
},
|
|
8914
|
+
}, Q = "0.0.0-dev", Rv = async (e) => {
|
|
8787
8915
|
let t = zm(e.root), n = await sg(t);
|
|
8788
8916
|
await Bm(t);
|
|
8789
8917
|
let r = [];
|
|
8790
|
-
for (let t of e.apps) r.push(await
|
|
8918
|
+
for (let t of e.apps) r.push(await sv({
|
|
8791
8919
|
...t,
|
|
8792
|
-
version:
|
|
8920
|
+
version: Q
|
|
8793
8921
|
}));
|
|
8794
|
-
let i = r.map((e) => e.slug), a = await
|
|
8795
|
-
main: await
|
|
8796
|
-
runtime: await
|
|
8922
|
+
let i = r.map((e) => e.slug), a = await i_(t, i), o = {
|
|
8923
|
+
main: await Qg(e.artifactRoot, "main"),
|
|
8924
|
+
runtime: await Qg(e.artifactRoot, "app-runtime")
|
|
8797
8925
|
}, s = dg(await fg(t), i), c = await mg(t), l = await gg(t), u = r.flatMap((e) => e.uiRoot === null ? [] : [{
|
|
8798
8926
|
basePath: e.basePath,
|
|
8799
8927
|
uiRoot: e.uiRoot
|
|
8800
|
-
}]), d = u.length === 0 ? null : await
|
|
8928
|
+
}]), d = u.length === 0 ? null : await h_({
|
|
8801
8929
|
host: e.host,
|
|
8802
8930
|
port: e.uiPort,
|
|
8803
8931
|
roots: u
|
|
@@ -8806,29 +8934,29 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8806
8934
|
basePath: e.basePath,
|
|
8807
8935
|
iframeUrl: `${d.origin()}${e.basePath}index.html`
|
|
8808
8936
|
}, p = () => {
|
|
8809
|
-
let e =
|
|
8937
|
+
let e = e_(r.filter((e) => s.apps[e.slug]?.installed === !0), s.rpcGrants);
|
|
8810
8938
|
JSON.stringify(e) !== JSON.stringify(s.rpcGrants) && (s = {
|
|
8811
8939
|
...s,
|
|
8812
8940
|
rpcGrants: e
|
|
8813
8941
|
});
|
|
8814
|
-
}, m = async () => (p(),
|
|
8942
|
+
}, m = async () => (p(), cv({
|
|
8815
8943
|
apps: r,
|
|
8816
8944
|
state: s,
|
|
8817
8945
|
secrets: c,
|
|
8818
8946
|
appValues: l,
|
|
8819
8947
|
consoleOrigin: e.consoleOrigin,
|
|
8820
8948
|
keys: a,
|
|
8821
|
-
version:
|
|
8949
|
+
version: Q,
|
|
8822
8950
|
appUiOrigin: d?.origin() ?? null,
|
|
8823
8951
|
artifacts: o
|
|
8824
|
-
})), h = await m(), g =
|
|
8952
|
+
})), h = await m(), g = c_(), _ = Lv({
|
|
8825
8953
|
host: e.host,
|
|
8826
8954
|
port: e.port,
|
|
8827
8955
|
persistRoot: t.persist,
|
|
8828
8956
|
compatibilityDate: o.main.compatibilityDate,
|
|
8829
8957
|
compatibilityFlags: o.main.compatibilityFlags,
|
|
8830
8958
|
onLog: g.accept
|
|
8831
|
-
}, h,
|
|
8959
|
+
}, h, Fv(s.geo, s.botScore)), v;
|
|
8832
8960
|
try {
|
|
8833
8961
|
v = await _.ready(), await _.migrate();
|
|
8834
8962
|
} catch (e) {
|
|
@@ -8847,8 +8975,8 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8847
8975
|
let t = await e.readManifest();
|
|
8848
8976
|
if (t.slug !== e.slug) throw Error(`slug changed in ${e.dir}. Restart \`qinto app dev\` to start the new app on its own local state.`);
|
|
8849
8977
|
if (t.ui?.dir !== e.manifest.ui?.dir) throw Error(`ui.dir changed in ${e.dir}. Restart \`qinto app dev\` to serve the panel from its new directory.`);
|
|
8850
|
-
let n = await
|
|
8851
|
-
return await
|
|
8978
|
+
let n = await iv(e.dir, t);
|
|
8979
|
+
return await ov(e.dir, t, e.basePath), {
|
|
8852
8980
|
manifest: t,
|
|
8853
8981
|
built: n
|
|
8854
8982
|
};
|
|
@@ -8897,7 +9025,7 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8897
9025
|
id: t.appInstallId,
|
|
8898
9026
|
ord: t.ordinal,
|
|
8899
9027
|
label: t.label,
|
|
8900
|
-
|
|
9028
|
+
queryTicket: await Kh({
|
|
8901
9029
|
kid: a.appUiKeyId,
|
|
8902
9030
|
key: a.appUiKey,
|
|
8903
9031
|
now: u,
|
|
@@ -8905,7 +9033,7 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8905
9033
|
domainId: s.domainId,
|
|
8906
9034
|
appId: n.appId,
|
|
8907
9035
|
appInstallId: t.appInstallId,
|
|
8908
|
-
appVersionId:
|
|
9036
|
+
appVersionId: Q
|
|
8909
9037
|
})
|
|
8910
9038
|
})));
|
|
8911
9039
|
await _.runSchedule(e, o, d);
|
|
@@ -8927,7 +9055,29 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8927
9055
|
await _.dispose(), await d?.stop();
|
|
8928
9056
|
}
|
|
8929
9057
|
};
|
|
8930
|
-
},
|
|
9058
|
+
}, zv = {
|
|
9059
|
+
catalog: {
|
|
9060
|
+
status: 409,
|
|
9061
|
+
error: "catalog_not_declared",
|
|
9062
|
+
message: "This app version does not declare that R2 resource as a Data Catalog."
|
|
9063
|
+
},
|
|
9064
|
+
analytics: {
|
|
9065
|
+
status: 409,
|
|
9066
|
+
error: "analytics_not_declared",
|
|
9067
|
+
message: "This app version does not declare that Analytics Engine resource."
|
|
9068
|
+
}
|
|
9069
|
+
}, Bv = {
|
|
9070
|
+
catalog: {
|
|
9071
|
+
status: 503,
|
|
9072
|
+
error: "catalog_unavailable",
|
|
9073
|
+
message: "R2 SQL catalog queries are available after deploying this app to Cloudflare."
|
|
9074
|
+
},
|
|
9075
|
+
analytics: {
|
|
9076
|
+
status: 503,
|
|
9077
|
+
error: "analytics_unavailable",
|
|
9078
|
+
message: "Analytics Engine queries are available after deploying this app to Cloudflare."
|
|
9079
|
+
}
|
|
9080
|
+
}, Vv = (e, t, n) => e.manifest.resources.some((e) => e.identifier === n ? t === "catalog" ? e.type === "r2" && e.catalog : e.type === "analytics_engine" : !1), Hv = async (e) => {
|
|
8931
9081
|
if (typeof e.body != "object" || e.body === null || typeof e.body.sql != "string" || e.body.sql.trim().length === 0 || e.body.sql.length > 16 * 1024) return {
|
|
8932
9082
|
status: 400,
|
|
8933
9083
|
error: "invalid_body"
|
|
@@ -8955,43 +9105,29 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
8955
9105
|
return r === void 0 || !r.enabled ? {
|
|
8956
9106
|
status: 401,
|
|
8957
9107
|
error: "ticket_invalid"
|
|
8958
|
-
} : n
|
|
8959
|
-
|
|
8960
|
-
error: "catalog_not_declared",
|
|
8961
|
-
message: "This app version does not declare that R2 resource as a Data Catalog."
|
|
8962
|
-
} : {
|
|
8963
|
-
status: 503,
|
|
8964
|
-
error: "catalog_unavailable",
|
|
8965
|
-
message: "R2 SQL catalog queries are available after deploying this app to Cloudflare."
|
|
8966
|
-
};
|
|
8967
|
-
}, jv = 64 * 1024, Mv = async (e) => {
|
|
8968
|
-
let t = [], n = 0;
|
|
8969
|
-
for await (let r of e) {
|
|
8970
|
-
if (n += r.length, n > jv) throw Error("The submitted form is too large.");
|
|
8971
|
-
t.push(r);
|
|
8972
|
-
}
|
|
8973
|
-
return Buffer.concat(t).toString("utf8");
|
|
8974
|
-
}, Nv = async (e) => Object.fromEntries(new URLSearchParams(await Mv(e))), Pv = {
|
|
9108
|
+
} : Vv(n, e.kind, e.resourceIdentifier) ? Bv[e.kind] : zv[e.kind];
|
|
9109
|
+
}, Uv = {
|
|
8975
9110
|
"access-control-allow-origin": "*",
|
|
8976
9111
|
"access-control-allow-methods": "POST, OPTIONS",
|
|
8977
9112
|
"access-control-allow-headers": "Authorization, Content-Type",
|
|
8978
9113
|
"access-control-max-age": "86400"
|
|
8979
|
-
},
|
|
8980
|
-
let t = /^\/app-ui\/sites\/([^/]+)\/apps\/([^/]+)\/catalogs\/([^/]+)\/query$/.exec(e);
|
|
9114
|
+
}, Wv = (e) => {
|
|
9115
|
+
let t = /^\/app-ui\/sites\/([^/]+)\/apps\/([^/]+)\/(catalogs|analytics)\/([^/]+)\/query$/.exec(e);
|
|
8981
9116
|
return t === null ? null : {
|
|
9117
|
+
kind: t[3] === "catalogs" ? "catalog" : "analytics",
|
|
8982
9118
|
domainId: t[1],
|
|
8983
9119
|
appSlug: t[2],
|
|
8984
|
-
resourceIdentifier: t[
|
|
9120
|
+
resourceIdentifier: t[4]
|
|
8985
9121
|
};
|
|
8986
|
-
},
|
|
9122
|
+
}, Gv = (e) => {
|
|
8987
9123
|
let t = async (t, n, r) => {
|
|
8988
|
-
let i = t.headers.authorization, a = await
|
|
9124
|
+
let i = t.headers.authorization, a = await Ug(t), o;
|
|
8989
9125
|
try {
|
|
8990
9126
|
o = JSON.parse(a);
|
|
8991
9127
|
} catch {
|
|
8992
9128
|
o = null;
|
|
8993
9129
|
}
|
|
8994
|
-
let { status: s, ...c } = await
|
|
9130
|
+
let { status: s, ...c } = await Hv({
|
|
8995
9131
|
token: i?.startsWith("Bearer ") === !0 ? i.slice(7) : null,
|
|
8996
9132
|
body: o,
|
|
8997
9133
|
...r,
|
|
@@ -9002,12 +9138,12 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
9002
9138
|
});
|
|
9003
9139
|
n.writeHead(s, {
|
|
9004
9140
|
"content-type": "application/json",
|
|
9005
|
-
...
|
|
9141
|
+
...Uv
|
|
9006
9142
|
}).end(JSON.stringify(c));
|
|
9007
9143
|
};
|
|
9008
9144
|
return { handle: async (e, n, r) => {
|
|
9009
9145
|
if (e.method === "OPTIONS") {
|
|
9010
|
-
n.writeHead(204,
|
|
9146
|
+
n.writeHead(204, Uv).end();
|
|
9011
9147
|
return;
|
|
9012
9148
|
}
|
|
9013
9149
|
if (e.method === "POST") {
|
|
@@ -9016,130 +9152,10 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
9016
9152
|
}
|
|
9017
9153
|
n.writeHead(405, {
|
|
9018
9154
|
allow: "POST, OPTIONS",
|
|
9019
|
-
...
|
|
9155
|
+
...Uv
|
|
9020
9156
|
}).end();
|
|
9021
9157
|
} };
|
|
9022
|
-
}, Lv = "/developer/apps", Q = "/site/apps", Rv = "/site/logs", zv = "/site/settings/general", Bv = {
|
|
9023
|
-
href: "https://docs.qinto.io",
|
|
9024
|
-
label: "Docs",
|
|
9025
|
-
icon: "bookOpen",
|
|
9026
|
-
external: !0
|
|
9027
|
-
}, Vv = (e) => {
|
|
9028
|
-
if (e.path.startsWith("/developer")) return {
|
|
9029
|
-
header: {
|
|
9030
|
-
back: {
|
|
9031
|
-
href: Q,
|
|
9032
|
-
label: "Back to site"
|
|
9033
|
-
},
|
|
9034
|
-
icon: "building2",
|
|
9035
|
-
title: "Local organization",
|
|
9036
|
-
subtitle: "Organization",
|
|
9037
|
-
dot: !1
|
|
9038
|
-
},
|
|
9039
|
-
sections: [{ items: [{
|
|
9040
|
-
href: Lv,
|
|
9041
|
-
label: "Apps",
|
|
9042
|
-
icon: "blocks"
|
|
9043
|
-
}] }],
|
|
9044
|
-
footer: [Bv]
|
|
9045
|
-
};
|
|
9046
|
-
let t = [{
|
|
9047
|
-
label: "Domain",
|
|
9048
|
-
items: [
|
|
9049
|
-
{
|
|
9050
|
-
href: Rv,
|
|
9051
|
-
label: "Analytics",
|
|
9052
|
-
icon: "activity",
|
|
9053
|
-
children: [{
|
|
9054
|
-
href: Rv,
|
|
9055
|
-
label: "Real time"
|
|
9056
|
-
}]
|
|
9057
|
-
},
|
|
9058
|
-
{
|
|
9059
|
-
href: Q,
|
|
9060
|
-
label: "Apps",
|
|
9061
|
-
icon: "blocks"
|
|
9062
|
-
},
|
|
9063
|
-
{
|
|
9064
|
-
href: zv,
|
|
9065
|
-
label: "Settings",
|
|
9066
|
-
icon: "settings",
|
|
9067
|
-
children: [{
|
|
9068
|
-
href: zv,
|
|
9069
|
-
label: "General"
|
|
9070
|
-
}]
|
|
9071
|
-
}
|
|
9072
|
-
]
|
|
9073
|
-
}], n = e.apps.filter((e) => e.app.installed && e.manifest.ui !== void 0);
|
|
9074
|
-
return n.length > 0 && t.push({
|
|
9075
|
-
label: "Apps",
|
|
9076
|
-
items: n.map((e) => ({
|
|
9077
|
-
href: `${Q}/${e.slug}/ui`,
|
|
9078
|
-
label: e.manifest.name,
|
|
9079
|
-
icon: "blocks",
|
|
9080
|
-
muted: !e.app.enabled
|
|
9081
|
-
}))
|
|
9082
|
-
}), {
|
|
9083
|
-
header: {
|
|
9084
|
-
back: null,
|
|
9085
|
-
icon: "globe",
|
|
9086
|
-
title: e.state.siteDomain,
|
|
9087
|
-
subtitle: "Active",
|
|
9088
|
-
dot: !0
|
|
9089
|
-
},
|
|
9090
|
-
sections: t,
|
|
9091
|
-
footer: [Bv, {
|
|
9092
|
-
href: Lv,
|
|
9093
|
-
label: "Developer",
|
|
9094
|
-
icon: "code",
|
|
9095
|
-
external: !1
|
|
9096
|
-
}]
|
|
9097
|
-
};
|
|
9098
|
-
}, Hv = (e, t) => {
|
|
9099
|
-
let n = Dg(), r = (t, n) => {
|
|
9100
|
-
let r = e.apps().find((e) => e.slug === t);
|
|
9101
|
-
if (r === void 0) throw Error(`${t === "" ? "No app" : t} is not mounted in this session.`);
|
|
9102
|
-
return wg(r.manifest, e.appValues()[t] ?? {}, n);
|
|
9103
|
-
};
|
|
9104
|
-
return {
|
|
9105
|
-
start: async (i, a) => {
|
|
9106
|
-
let o = {
|
|
9107
|
-
slug: i.slug ?? "",
|
|
9108
|
-
appInstallId: i.appInstallId ?? "",
|
|
9109
|
-
providerId: i.providerId ?? ""
|
|
9110
|
-
}, s = r(o.slug, o.providerId);
|
|
9111
|
-
Eg(e.state().apps[o.slug], o.appInstallId);
|
|
9112
|
-
let c = await n.start(o, s, `${t()}${vg}`, Date.now());
|
|
9113
|
-
a.writeHead(303, { location: c }).end();
|
|
9114
|
-
},
|
|
9115
|
-
complete: async (t, i) => {
|
|
9116
|
-
let a = Date.now(), o = n.claim(t.searchParams.get("state") ?? "", a);
|
|
9117
|
-
if (o === null) {
|
|
9118
|
-
i.writeHead(400, { "content-type": "text/plain" }).end("that connection attempt is unknown, already used, or expired");
|
|
9119
|
-
return;
|
|
9120
|
-
}
|
|
9121
|
-
let s = `${Q}/${o.slug}`, c = t.searchParams.get("error");
|
|
9122
|
-
if (c !== null) {
|
|
9123
|
-
let e = Sg(c, t.searchParams.get("error_description"));
|
|
9124
|
-
if (e.cancelled) {
|
|
9125
|
-
i.writeHead(303, { location: s }).end();
|
|
9126
|
-
return;
|
|
9127
|
-
}
|
|
9128
|
-
throw Error(e.message);
|
|
9129
|
-
}
|
|
9130
|
-
let l = await kg(o, r(o.slug, o.providerId), t.searchParams.get("code") ?? "", a);
|
|
9131
|
-
Eg(e.state().apps[o.slug], o.appInstallId), await e.apply({
|
|
9132
|
-
state: jg(e.state(), {
|
|
9133
|
-
...o,
|
|
9134
|
-
connection: l
|
|
9135
|
-
}),
|
|
9136
|
-
secrets: e.secrets(),
|
|
9137
|
-
appValues: e.appValues()
|
|
9138
|
-
}), i.writeHead(303, { location: s }).end();
|
|
9139
|
-
},
|
|
9140
|
-
discard: n.discard
|
|
9141
|
-
};
|
|
9142
|
-
}, Uv = "\nconst MAX_ROWS = 500\nconst rowsEl = document.getElementById('rows')\nconst statusEl = document.getElementById('status')\nconst dialogEl = document.getElementById('trace')\nconst rows = new Map()\nlet selectedSpan = null\nlet openTrace = null\n\nconst clock = (at) => new Date(at).toISOString().slice(11, 23)\n\nconst duration = (ms) => (ms < 1000 ? ms + 'ms' : (ms / 1000).toFixed(2) + 's')\n\n// Mirrors META_BLOCKS in portal/ui/app/lib/tail-traces.ts; the two consoles must group alike.\nconst META_BLOCKS = [\n { label: 'Init', keys: ['action.type', 'action.event', 'action.id', 'action.user_id', 'action.global_id', 'action.origin'], open: true },\n { label: 'Payload', keys: ['action.payload'], open: true },\n { label: 'Host data', keys: ['qinto.geo'], open: false },\n { label: 'Consent', keys: ['qinto.consent'], open: false },\n { label: 'Full user', keys: ['qinto.user'], open: false }\n]\n\nconst META_KEYS = new Set(META_BLOCKS.flatMap((block) => block.keys))\n\nconst metaSpan = (spans) => spans.filter((span) => span.attrs && span.attrs['qinto.user'] !== undefined).sort((a, b) => a.start - b.start)[0]\n\nconst spanLabel = (span) => {\n const type = span.attrs && span.attrs['action.type']\n if (typeof type !== 'string') { return span.name }\n const event = span.attrs && span.attrs['action.event']\n return typeof event === 'string' ? type + ' - ' + event : type\n}\n\nconst rootSpan = (spans) => {\n const ids = new Set(spans.map((span) => span.spanId))\n return spans.filter((span) => span.parent === undefined || !ids.has(span.parent)).sort((a, b) => a.start - b.start)[0]\n}\n\nconst summary = (row) => {\n const root = rootSpan(row.spans)\n return (root === undefined ? 'trace' : spanLabel(root)) + ' — ' + row.outcome\n}\n\nconst bounds = (spans) => {\n const t0 = Math.min(...spans.map((span) => span.start))\n return { t0, total: Math.max(...spans.map((span) => span.end)) - t0 }\n}\n\nconst forest = (spans) => {\n const nodes = new Map(spans.map((span) => [span.spanId, { span, children: [] }]))\n const roots = []\n for (const node of nodes.values()) {\n const parent = node.span.parent === undefined ? undefined : nodes.get(node.span.parent)\n if (parent === undefined) { roots.push(node) } else { parent.children.push(node) }\n }\n const byStart = (a, b) => a.span.start - b.span.start\n for (const node of nodes.values()) { node.children.sort(byStart) }\n return roots.sort(byStart)\n}\n\nconst flatten = (nodes, depth = 0, out = []) => {\n for (const node of nodes) {\n out.push({ span: node.span, depth })\n flatten(node.children, depth + 1, out)\n }\n return out\n}\n\nconst errored = (row) => row.spans.some((span) => span.error !== undefined)\n\nconst el = (tag, className, text) => {\n const node = document.createElement(tag)\n if (className !== undefined) { node.className = className }\n if (text !== undefined) { node.textContent = text }\n return node\n}\n\nconst renderRows = () => {\n const ordered = [...rows.values()].sort((a, b) => b.at - a.at).slice(0, MAX_ROWS)\n if (ordered.length === 0) {\n rowsEl.replaceChildren(el('li', 'waiting', 'Waiting for traffic on this site…'))\n return\n }\n rowsEl.replaceChildren(\n ...ordered.map((row) => {\n const parts = [summary(row), duration(bounds(row.spans).total)]\n if (row.spans.length > 1) { parts.push(row.spans.length + ' spans') }\n\n const button = el('button', 'trace-row')\n button.appendChild(el('span', 'at', clock(row.at)))\n button.appendChild(el('span', errored(row) ? 'label err' : 'label', parts.join(' · ')))\n for (const event of row.events) {\n button.appendChild(el('span', event.level === 'error' ? 'evt err' : event.level === 'warn' ? 'evt warn' : 'evt', '· ' + event.name))\n }\n button.addEventListener('click', () => { openDialog(row.traceId) })\n\n const item = el('li')\n item.appendChild(button)\n return item\n })\n )\n}\n\nconst kvLine = (key, value) => {\n const line = el('div', 'kv')\n line.appendChild(el('span', 'k', key))\n line.appendChild(el('span', undefined, ': ' + (typeof value === 'string' ? value : JSON.stringify(value))))\n return line\n}\n\nconst metaBlocks = (span, wrap) => {\n for (const block of META_BLOCKS) {\n const present = block.keys.filter((key) => (span.attrs || {})[key] !== undefined)\n if (present.length === 0) { continue }\n const details = el('details', 'meta')\n if (block.open) { details.open = true }\n details.appendChild(el('summary', 'section', block.label))\n for (const key of present) { details.appendChild(kvLine(key, span.attrs[key])) }\n wrap.appendChild(details)\n }\n}\n\nconst fields = (span) => {\n const values = {\n duration: duration(span.end - span.start),\n 'trace.span_id': span.spanId,\n ...(span.parent === undefined ? {} : { 'trace.parent_id': span.parent }),\n 'trace.trace_id': span.traceId,\n ...Object.fromEntries(Object.entries(span.attrs || {}).filter(([key]) => !META_KEYS.has(key)))\n }\n const wrap = el('div')\n const title = el('p', 'span-name', span.name)\n if (span.error !== undefined) { title.appendChild(el('span', 'err', ' — ' + span.error)) }\n wrap.appendChild(title)\n metaBlocks(span, wrap)\n wrap.appendChild(el('p', 'section', 'Fields'))\n for (const [key, value] of Object.entries(values)) {\n wrap.appendChild(kvLine(key, value))\n }\n if (Array.isArray(span.events) && span.events.length > 0) {\n wrap.appendChild(el('p', 'section', 'Span events'))\n for (const event of span.events) {\n const level = event.level === 'error' ? 'err' : event.level === 'warn' ? 'warn' : ''\n wrap.appendChild(el('p', 'evt ' + level, event.name + ' +' + duration(Math.max(0, event.t - span.start))))\n for (const [key, value] of Object.entries(event.attrs || {})) {\n wrap.appendChild(kvLine(key, value))\n }\n }\n }\n return wrap\n}\n\nconst renderDialog = () => {\n const row = rows.get(openTrace)\n if (row === undefined) { return }\n const scale = bounds(row.spans)\n const timeline = flatten(forest(row.spans))\n const selected = row.spans.find((span) => span.spanId === selectedSpan) || metaSpan(row.spans) || timeline[0].span\n\n const list = el('ul', 'timeline')\n for (const { span, depth } of timeline) {\n const left = scale.total === 0 ? 0 : ((span.start - scale.t0) / scale.total) * 100\n const width = scale.total === 0 ? 100 : ((span.end - span.start) / scale.total) * 100\n const button = el('button', 'span-row' + (span.spanId === selected.spanId ? ' on' : ''))\n const name = el('span', span.error === undefined ? 'span-label' : 'span-label err', span.name)\n name.style.paddingLeft = depth * 12 + 'px'\n button.appendChild(name)\n const track = el('span', 'track')\n const bar = el('span', span.error === undefined ? 'bar' : 'bar err')\n bar.style.left = left + '%'\n bar.style.width = width + '%'\n track.appendChild(bar)\n button.appendChild(track)\n button.appendChild(el('span', 'dur', duration(span.end - span.start)))\n button.addEventListener('click', () => { selectedSpan = span.spanId; renderDialog() })\n const item = el('li')\n item.appendChild(button)\n list.appendChild(item)\n }\n\n const head = el('div', 'dialog-head')\n head.appendChild(el('strong', undefined, summary(row) + ' · ' + duration(scale.total)))\n const close = el('button', 'outline sm', 'Close')\n close.addEventListener('click', () => { openTrace = null; dialogEl.close() })\n head.appendChild(close)\n\n const scaleRow = el('div', 'scale')\n scaleRow.appendChild(el('span', undefined, '0ms'))\n scaleRow.appendChild(el('span', undefined, duration(scale.total)))\n\n const left = el('div', 'timeline-pane')\n left.appendChild(scaleRow)\n left.appendChild(list)\n const right = el('div', 'fields-pane')\n right.appendChild(fields(selected))\n const body = el('div', 'dialog-body')\n body.appendChild(left)\n body.appendChild(right)\n\n dialogEl.replaceChildren(head, body)\n}\n\nconst openDialog = (traceId) => {\n openTrace = traceId\n selectedSpan = null\n renderDialog()\n dialogEl.showModal()\n}\n\nconst merge = (record) => {\n for (const span of record.spans) {\n const row = rows.get(span.traceId) || { traceId: span.traceId, at: Date.now(), spans: [], events: [], outcome: 'ok' }\n if (!row.spans.some((known) => known.spanId === span.spanId)) { row.spans.push(span) }\n for (const event of span.events || []) {\n if (event.level !== undefined) { row.events.push(event) }\n }\n if (span.error !== undefined) { row.outcome = 'error' }\n rows.set(span.traceId, row)\n }\n renderRows()\n if (openTrace !== null) { renderDialog() }\n}\n\nrenderRows()\n\nconst stream = new EventSource('/site/logs/stream')\nstream.addEventListener('open', () => { statusEl.textContent = 'Live'; statusEl.className = 'status ok' })\nstream.addEventListener('error', () => { statusEl.textContent = 'Reconnecting…'; statusEl.className = 'status off' })\nstream.addEventListener('spans', (event) => { merge(JSON.parse(event.data)) })\n", Wv = "\n<style>\n .status { font-size: .875rem; line-height: 1.25rem; color: var(--color-brand-700) }\n .status.ok { color: var(--color-green-700) } .status.off { color: var(--color-amber-700) }\n .console { border: 1px solid var(--color-cream-300); border-radius: var(--radius-lg); background: var(--color-white);\n font-family: var(--font-mono); font-size: .75rem; line-height: 1rem; max-height: 62vh; overflow: auto }\n .console li { border-bottom: 1px solid var(--color-cream-200) }\n .console li:last-child { border-bottom: 0 }\n .waiting { padding: 1rem; color: var(--color-brand-700) }\n .trace-row { display: block; width: 100%; height: auto; padding: .5rem; border-radius: 0; text-align: left;\n background: transparent; color: inherit; font-size: inherit; font-weight: 400 }\n .trace-row:hover { background: var(--color-cream-100) }\n .at { margin-right: .5rem; color: var(--color-brand-500) }\n .label { color: var(--color-brand-900) } .label.err, .err { color: var(--color-red-700) } .warn { color: var(--color-amber-700) }\n .evt { display: block; padding-left: 1rem; color: var(--color-brand-700) }\n /* The reset zeroes every margin, which is also the one the user agent centres a modal dialog with. */\n dialog { margin: auto; width: 72rem; max-width: calc(100% - 2rem); height: 80vh; overflow: hidden; padding: 1.5rem;\n border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--color-white); color: var(--color-brand-900);\n font-family: var(--font-mono); font-size: .75rem; line-height: 1rem; box-shadow: 0 10px 15px -3px rgb(0 0 0 / .1) }\n dialog[open] { display: flex; flex-direction: column }\n dialog::backdrop { background: rgb(0 0 0 / .5) }\n .dialog-head { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: 1rem }\n .dialog-head strong { font-size: .875rem; line-height: 1.25rem; font-weight: 600 }\n .dialog-body { display: flex; min-height: 0; flex: 1; gap: 1rem }\n .timeline-pane { min-width: 0; flex: 1; overflow-y: auto; overflow-wrap: anywhere }\n .fields-pane { width: 24rem; flex-shrink: 0; overflow-y: auto; overflow-wrap: anywhere;\n border-left: 1px solid var(--color-cream-200); padding-left: 1rem }\n .scale { display: flex; justify-content: space-between; padding-bottom: .25rem; color: var(--color-brand-500) }\n .span-row { display: flex; width: 100%; height: auto; align-items: center; gap: .5rem; padding: .25rem; border-radius: .25rem;\n text-align: left; background: transparent; color: inherit; font-size: inherit; font-weight: 400 }\n /* A chromeless button still needs its own hover, or the shell's fills the row with solid brand orange. */\n .span-row:hover { background: var(--color-cream-100) }\n .span-row.on, .span-row.on:hover { background: var(--color-cream-100) }\n .span-label { width: 40%; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-brand-900) }\n .track { position: relative; height: .75rem; flex-grow: 1 }\n .bar { position: absolute; top: 0; height: .75rem; min-width: 2px; border-radius: var(--radius-sm); background: var(--color-brand-500) }\n .bar.err { background: var(--color-red-700) }\n .dur { flex-shrink: 0; color: var(--color-brand-500) }\n .span-name { font-weight: 600; margin-bottom: .5rem; color: var(--color-brand-900) }\n .section { margin: .5rem 0 .25rem; text-transform: uppercase; color: var(--color-brand-500) }\n .kv { color: var(--color-brand-700) } .kv .k { color: var(--color-brand-900) }\n .meta > summary { cursor: pointer; list-style: revert }\n</style>", Gv = {
|
|
9158
|
+
}, Kv = "\nconst MAX_ROWS = 500\nconst rowsEl = document.getElementById('rows')\nconst statusEl = document.getElementById('status')\nconst dialogEl = document.getElementById('trace')\nconst rows = new Map()\nlet selectedSpan = null\nlet openTrace = null\n\nconst clock = (at) => new Date(at).toISOString().slice(11, 23)\n\nconst duration = (ms) => (ms < 1000 ? ms + 'ms' : (ms / 1000).toFixed(2) + 's')\n\n// Mirrors META_BLOCKS in portal/ui/app/lib/tail-traces.ts; the two consoles must group alike.\nconst META_BLOCKS = [\n { label: 'Init', keys: ['action.type', 'action.event', 'action.id', 'action.user_id', 'action.global_id', 'action.origin'], open: true },\n { label: 'Payload', keys: ['action.payload'], open: true },\n { label: 'Host data', keys: ['qinto.geo'], open: false },\n { label: 'Consent', keys: ['qinto.consent'], open: false },\n { label: 'Full user', keys: ['qinto.user'], open: false }\n]\n\nconst META_KEYS = new Set(META_BLOCKS.flatMap((block) => block.keys))\n\nconst metaSpan = (spans) => spans.filter((span) => span.attrs && span.attrs['qinto.user'] !== undefined).sort((a, b) => a.start - b.start)[0]\n\nconst spanLabel = (span) => {\n const type = span.attrs && span.attrs['action.type']\n if (typeof type !== 'string') { return span.name }\n const event = span.attrs && span.attrs['action.event']\n return typeof event === 'string' ? type + ' - ' + event : type\n}\n\nconst rootSpan = (spans) => {\n const ids = new Set(spans.map((span) => span.spanId))\n return spans.filter((span) => span.parent === undefined || !ids.has(span.parent)).sort((a, b) => a.start - b.start)[0]\n}\n\nconst summary = (row) => {\n const root = rootSpan(row.spans)\n return (root === undefined ? 'trace' : spanLabel(root)) + ' — ' + row.outcome\n}\n\nconst bounds = (spans) => {\n const t0 = Math.min(...spans.map((span) => span.start))\n return { t0, total: Math.max(...spans.map((span) => span.end)) - t0 }\n}\n\nconst forest = (spans) => {\n const nodes = new Map(spans.map((span) => [span.spanId, { span, children: [] }]))\n const roots = []\n for (const node of nodes.values()) {\n const parent = node.span.parent === undefined ? undefined : nodes.get(node.span.parent)\n if (parent === undefined) { roots.push(node) } else { parent.children.push(node) }\n }\n const byStart = (a, b) => a.span.start - b.span.start\n for (const node of nodes.values()) { node.children.sort(byStart) }\n return roots.sort(byStart)\n}\n\nconst flatten = (nodes, depth = 0, out = []) => {\n for (const node of nodes) {\n out.push({ span: node.span, depth })\n flatten(node.children, depth + 1, out)\n }\n return out\n}\n\nconst errored = (row) => row.spans.some((span) => span.error !== undefined)\n\nconst el = (tag, className, text) => {\n const node = document.createElement(tag)\n if (className !== undefined) { node.className = className }\n if (text !== undefined) { node.textContent = text }\n return node\n}\n\nconst renderRows = () => {\n const ordered = [...rows.values()].sort((a, b) => b.at - a.at).slice(0, MAX_ROWS)\n if (ordered.length === 0) {\n rowsEl.replaceChildren(el('li', 'waiting', 'Waiting for traffic on this site…'))\n return\n }\n rowsEl.replaceChildren(\n ...ordered.map((row) => {\n const parts = [summary(row), duration(bounds(row.spans).total)]\n if (row.spans.length > 1) { parts.push(row.spans.length + ' spans') }\n\n const button = el('button', 'trace-row')\n button.appendChild(el('span', 'at', clock(row.at)))\n button.appendChild(el('span', errored(row) ? 'label err' : 'label', parts.join(' · ')))\n for (const event of row.events) {\n button.appendChild(el('span', event.level === 'error' ? 'evt err' : event.level === 'warn' ? 'evt warn' : 'evt', '· ' + event.name))\n }\n button.addEventListener('click', () => { openDialog(row.traceId) })\n\n const item = el('li')\n item.appendChild(button)\n return item\n })\n )\n}\n\nconst kvLine = (key, value) => {\n const line = el('div', 'kv')\n line.appendChild(el('span', 'k', key))\n line.appendChild(el('span', undefined, ': ' + (typeof value === 'string' ? value : JSON.stringify(value))))\n return line\n}\n\nconst metaBlocks = (span, wrap) => {\n for (const block of META_BLOCKS) {\n const present = block.keys.filter((key) => (span.attrs || {})[key] !== undefined)\n if (present.length === 0) { continue }\n const details = el('details', 'meta')\n if (block.open) { details.open = true }\n details.appendChild(el('summary', 'section', block.label))\n for (const key of present) { details.appendChild(kvLine(key, span.attrs[key])) }\n wrap.appendChild(details)\n }\n}\n\nconst fields = (span) => {\n const values = {\n duration: duration(span.end - span.start),\n 'trace.span_id': span.spanId,\n ...(span.parent === undefined ? {} : { 'trace.parent_id': span.parent }),\n 'trace.trace_id': span.traceId,\n ...Object.fromEntries(Object.entries(span.attrs || {}).filter(([key]) => !META_KEYS.has(key)))\n }\n const wrap = el('div')\n const title = el('p', 'span-name', span.name)\n if (span.error !== undefined) { title.appendChild(el('span', 'err', ' — ' + span.error)) }\n wrap.appendChild(title)\n metaBlocks(span, wrap)\n wrap.appendChild(el('p', 'section', 'Fields'))\n for (const [key, value] of Object.entries(values)) {\n wrap.appendChild(kvLine(key, value))\n }\n if (Array.isArray(span.events) && span.events.length > 0) {\n wrap.appendChild(el('p', 'section', 'Span events'))\n for (const event of span.events) {\n const level = event.level === 'error' ? 'err' : event.level === 'warn' ? 'warn' : ''\n wrap.appendChild(el('p', 'evt ' + level, event.name + ' +' + duration(Math.max(0, event.t - span.start))))\n for (const [key, value] of Object.entries(event.attrs || {})) {\n wrap.appendChild(kvLine(key, value))\n }\n }\n }\n return wrap\n}\n\nconst renderDialog = () => {\n const row = rows.get(openTrace)\n if (row === undefined) { return }\n const scale = bounds(row.spans)\n const timeline = flatten(forest(row.spans))\n const selected = row.spans.find((span) => span.spanId === selectedSpan) || metaSpan(row.spans) || timeline[0].span\n\n const list = el('ul', 'timeline')\n for (const { span, depth } of timeline) {\n const left = scale.total === 0 ? 0 : ((span.start - scale.t0) / scale.total) * 100\n const width = scale.total === 0 ? 100 : ((span.end - span.start) / scale.total) * 100\n const button = el('button', 'span-row' + (span.spanId === selected.spanId ? ' on' : ''))\n const name = el('span', span.error === undefined ? 'span-label' : 'span-label err', span.name)\n name.style.paddingLeft = depth * 12 + 'px'\n button.appendChild(name)\n const track = el('span', 'track')\n const bar = el('span', span.error === undefined ? 'bar' : 'bar err')\n bar.style.left = left + '%'\n bar.style.width = width + '%'\n track.appendChild(bar)\n button.appendChild(track)\n button.appendChild(el('span', 'dur', duration(span.end - span.start)))\n button.addEventListener('click', () => { selectedSpan = span.spanId; renderDialog() })\n const item = el('li')\n item.appendChild(button)\n list.appendChild(item)\n }\n\n const head = el('div', 'dialog-head')\n head.appendChild(el('strong', undefined, summary(row) + ' · ' + duration(scale.total)))\n const close = el('button', 'outline sm', 'Close')\n close.addEventListener('click', () => { openTrace = null; dialogEl.close() })\n head.appendChild(close)\n\n const scaleRow = el('div', 'scale')\n scaleRow.appendChild(el('span', undefined, '0ms'))\n scaleRow.appendChild(el('span', undefined, duration(scale.total)))\n\n const left = el('div', 'timeline-pane')\n left.appendChild(scaleRow)\n left.appendChild(list)\n const right = el('div', 'fields-pane')\n right.appendChild(fields(selected))\n const body = el('div', 'dialog-body')\n body.appendChild(left)\n body.appendChild(right)\n\n dialogEl.replaceChildren(head, body)\n}\n\nconst openDialog = (traceId) => {\n openTrace = traceId\n selectedSpan = null\n renderDialog()\n dialogEl.showModal()\n}\n\nconst merge = (record) => {\n for (const span of record.spans) {\n const row = rows.get(span.traceId) || { traceId: span.traceId, at: Date.now(), spans: [], events: [], outcome: 'ok' }\n if (!row.spans.some((known) => known.spanId === span.spanId)) { row.spans.push(span) }\n for (const event of span.events || []) {\n if (event.level !== undefined) { row.events.push(event) }\n }\n if (span.error !== undefined) { row.outcome = 'error' }\n rows.set(span.traceId, row)\n }\n renderRows()\n if (openTrace !== null) { renderDialog() }\n}\n\nrenderRows()\n\nconst stream = new EventSource('/site/logs/stream')\nstream.addEventListener('open', () => { statusEl.textContent = 'Live'; statusEl.className = 'status ok' })\nstream.addEventListener('error', () => { statusEl.textContent = 'Reconnecting…'; statusEl.className = 'status off' })\nstream.addEventListener('spans', (event) => { merge(JSON.parse(event.data)) })\n", qv = "\n<style>\n .status { font-size: .875rem; line-height: 1.25rem; color: var(--color-brand-700) }\n .status.ok { color: var(--color-green-700) } .status.off { color: var(--color-amber-700) }\n .console { border: 1px solid var(--color-cream-300); border-radius: var(--radius-lg); background: var(--color-white);\n font-family: var(--font-mono); font-size: .75rem; line-height: 1rem; max-height: 62vh; overflow: auto }\n .console li { border-bottom: 1px solid var(--color-cream-200) }\n .console li:last-child { border-bottom: 0 }\n .waiting { padding: 1rem; color: var(--color-brand-700) }\n .trace-row { display: block; width: 100%; height: auto; padding: .5rem; border-radius: 0; text-align: left;\n background: transparent; color: inherit; font-size: inherit; font-weight: 400 }\n .trace-row:hover { background: var(--color-cream-100) }\n .at { margin-right: .5rem; color: var(--color-brand-500) }\n .label { color: var(--color-brand-900) } .label.err, .err { color: var(--color-red-700) } .warn { color: var(--color-amber-700) }\n .evt { display: block; padding-left: 1rem; color: var(--color-brand-700) }\n /* The reset zeroes every margin, which is also the one the user agent centres a modal dialog with. */\n dialog { margin: auto; width: 72rem; max-width: calc(100% - 2rem); height: 80vh; overflow: hidden; padding: 1.5rem;\n border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--color-white); color: var(--color-brand-900);\n font-family: var(--font-mono); font-size: .75rem; line-height: 1rem; box-shadow: 0 10px 15px -3px rgb(0 0 0 / .1) }\n dialog[open] { display: flex; flex-direction: column }\n dialog::backdrop { background: rgb(0 0 0 / .5) }\n .dialog-head { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: 1rem }\n .dialog-head strong { font-size: .875rem; line-height: 1.25rem; font-weight: 600 }\n .dialog-body { display: flex; min-height: 0; flex: 1; gap: 1rem }\n .timeline-pane { min-width: 0; flex: 1; overflow-y: auto; overflow-wrap: anywhere }\n .fields-pane { width: 24rem; flex-shrink: 0; overflow-y: auto; overflow-wrap: anywhere;\n border-left: 1px solid var(--color-cream-200); padding-left: 1rem }\n .scale { display: flex; justify-content: space-between; padding-bottom: .25rem; color: var(--color-brand-500) }\n .span-row { display: flex; width: 100%; height: auto; align-items: center; gap: .5rem; padding: .25rem; border-radius: .25rem;\n text-align: left; background: transparent; color: inherit; font-size: inherit; font-weight: 400 }\n /* A chromeless button still needs its own hover, or the shell's fills the row with solid brand orange. */\n .span-row:hover { background: var(--color-cream-100) }\n .span-row.on, .span-row.on:hover { background: var(--color-cream-100) }\n .span-label { width: 40%; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-brand-900) }\n .track { position: relative; height: .75rem; flex-grow: 1 }\n .bar { position: absolute; top: 0; height: .75rem; min-width: 2px; border-radius: var(--radius-sm); background: var(--color-brand-500) }\n .bar.err { background: var(--color-red-700) }\n .dur { flex-shrink: 0; color: var(--color-brand-500) }\n .span-name { font-weight: 600; margin-bottom: .5rem; color: var(--color-brand-900) }\n .section { margin: .5rem 0 .25rem; text-transform: uppercase; color: var(--color-brand-500) }\n .kv { color: var(--color-brand-700) } .kv .k { color: var(--color-brand-900) }\n .meta > summary { cursor: pointer; list-style: revert }\n</style>", Jv = {
|
|
9143
9159
|
activity: "<path d=\"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2\"/>",
|
|
9144
9160
|
blocks: "<path d=\"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2\"/><rect x=\"14\" y=\"2\" width=\"8\" height=\"8\" rx=\"1\"/>",
|
|
9145
9161
|
bookOpen: "<path d=\"M12 7v14\"/><path d=\"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z\"/>",
|
|
@@ -9151,54 +9167,54 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
9151
9167
|
globe: "<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20\"/><path d=\"M2 12h20\"/>",
|
|
9152
9168
|
layers: "<path d=\"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z\"/><path d=\"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12\"/><path d=\"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17\"/>",
|
|
9153
9169
|
settings: "<path d=\"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/>"
|
|
9154
|
-
}, Kv = (e, t) => `<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${Gv[e]}</svg>`, qv = "\n*, ::before, ::after { box-sizing: border-box; border: 0 solid; margin: 0; padding: 0 }\nhtml { font-family: var(--font-sans); line-height: 1.5; -webkit-text-size-adjust: 100% }\nh1, h2, h3 { font-size: inherit; font-weight: inherit }\nul, ol { list-style: none }\na { color: inherit; text-decoration: inherit }\ncode, pre { font-family: var(--font-mono); font-size: 1em }\ntable { border-collapse: collapse }\nsvg { display: block; vertical-align: middle }\niframe { display: block }\nbutton, input, select { font: inherit; color: inherit; background: transparent; letter-spacing: inherit }\nbutton:not(:disabled) { cursor: pointer }\n::placeholder { color: var(--muted-foreground) }\nbody { background: var(--color-cream-50); color: var(--color-gray-900) }\n.shell { display: flex; min-height: 100dvh; background: var(--color-cream-50) }\naside { position: sticky; top: 0; display: flex; height: 100dvh; width: 16rem; flex-shrink: 0; flex-direction: column;\n overflow-y: auto; border-right: 1px solid var(--line); background: var(--color-white) }\n.sidebar-head { display: flex; height: 73px; align-items: center; padding: 0 .75rem; border-bottom: 1px solid var(--line) }\n.sidebar-head.stacked { display: block; height: auto; padding: .75rem }\n.back { display: flex; align-items: center; gap: .25rem; margin-bottom: .5rem; font-size: .75rem; line-height: 1rem;\n color: var(--color-gray-500); transition: color .15s }\n.back:hover { color: var(--color-gray-700) }\n.switcher { display: flex; width: 100%; align-items: center; gap: .75rem; border: 1px solid var(--line);\n border-radius: var(--radius-xl); padding: .625rem .75rem; text-align: left; transition: background-color .15s }\n.switcher:hover { background: var(--color-cream-50) }\n.switcher-icon { display: flex; height: 2.25rem; width: 2.25rem; flex-shrink: 0; align-items: center; justify-content: center;\n border-radius: var(--radius-lg); background: var(--color-brand-50); color: var(--color-brand-600) }\n.switcher-text { min-width: 0; flex: 1 }\n.switcher-text strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\n font-size: .875rem; line-height: 1.25rem; font-weight: 600; color: var(--color-gray-900) }\n.switcher-sub { display: flex; align-items: center; gap: .375rem; font-size: .75rem; line-height: 1rem; color: var(--color-gray-500) }\n.dot { height: .375rem; width: .375rem; flex-shrink: 0; border-radius: 9999px; background: var(--color-green-500) }\nnav { flex: 1; padding: .75rem }\nnav section + section { margin-top: 1rem }\nnav h2 { padding: 0 .75rem .25rem; font-size: 11px; line-height: 1rem; font-weight: 600; text-transform: uppercase;\n letter-spacing: .025em; color: var(--color-gray-500) }\n.nav-item { display: flex; align-items: center; gap: .625rem; border-radius: var(--radius-lg); padding: .5rem .75rem;\n font-size: .875rem; line-height: 1.25rem; font-weight: 500; color: var(--color-gray-700); transition: background-color .15s, color .15s }\n.nav-item:hover { background: var(--color-cream-100) }\n.nav-item.on, .nav-item[aria-current=\"page\"] { background: var(--color-brand-50); color: var(--color-brand-600) }\n.nav-item.muted { opacity: .6 }\n.nav-item + .nav-item, .nav-group + .nav-item, .nav-item + .nav-group, .nav-group + .nav-group { margin-top: .25rem }\n.nav-group > .nav-item { justify-content: space-between }\n.nav-group-label { display: flex; align-items: center; gap: .625rem }\n.nav-group svg:last-child { color: var(--color-gray-400) }\n.nav-children { margin: .25rem 0 0 1.75rem; padding-left: .5rem; border-left: 1px solid var(--line) }\n.nav-child { display: block; border-radius: var(--radius-lg); padding: .375rem .75rem; font-size: .875rem; line-height: 1.25rem;\n color: var(--color-gray-600); transition: background-color .15s, color .15s }\n.nav-child + .nav-child { margin-top: .25rem }\n.nav-child:hover { background: var(--color-cream-100) }\n.nav-child[aria-current=\"page\"] { background: var(--color-brand-50); font-weight: 500; color: var(--color-brand-600) }\n.sidebar-foot { border-top: 1px solid var(--line); padding: .75rem }\n.sidebar-foot > * + * { margin-top: .75rem }\n.stamp { display: flex; align-items: center; gap: .5rem; padding: 0 .75rem; font-size: .75rem; line-height: 1rem;\n color: var(--color-gray-500) }\n.stamp svg { color: var(--color-brand-500) }\n.content { display: flex; min-width: 0; flex: 1; flex-direction: column }\n.content > header { position: sticky; top: 0; z-index: 20; display: flex; height: 73px; align-items: center; gap: .75rem;\n padding: 0 1.5rem; border-bottom: 1px solid var(--line); background: var(--color-cream-50) }\nh1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.125rem; line-height: 1.75rem;\n font-weight: 600; color: var(--color-gray-900) }\nmain { flex: 1; padding: 1.5rem }\n.page { width: 100% }\n.page.form { margin: 0 auto; max-width: 64rem }\n.page.fill { display: flex; height: calc(100dvh - 73px - 3rem); flex-direction: column; gap: 1.5rem }\n.narrow { max-width: 48rem }\n.stack > * + * { margin-top: 1.5rem }\n.rows > * + * { margin-top: 1rem }\n.lede { max-width: 42rem; font-size: .875rem; line-height: 1.25rem; color: var(--color-gray-600) }\n.card { border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--color-white); padding: 1.5rem }\n.card.dashed { border-style: dashed; border-color: var(--line-dashed); padding: 1rem }\n.card.danger { border-color: var(--color-red-200) }\n.card h2, .section-title { font-size: .875rem; line-height: 1.25rem; font-weight: 600; color: var(--color-gray-900) }\n.hint { margin-top: .25rem; font-size: .875rem; line-height: 1.25rem; color: var(--color-gray-500) }\n.table-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--color-white) }\n.table-scroll { overflow-x: auto }\ntable { width: 100%; font-size: .875rem; line-height: 1.25rem }\nthead tr { text-align: left }\nth { padding: .5rem 1rem .5rem 0; font-weight: 500; color: var(--color-gray-600) }\ntbody tr { border-top: 1px solid var(--line-soft) }\ntd { padding: .5rem 1rem .5rem 0; vertical-align: top; color: var(--color-gray-600) }\n.table-card thead tr { background: var(--color-cream-50) }\n.table-card th, .table-card td { padding: .75rem 1.25rem }\ntd.actions { text-align: right; white-space: nowrap }\ntd.actions form { display: inline-flex; vertical-align: middle }\ntd.actions > * + * { margin-left: .5rem }\n.empty-cell { padding: 2.5rem 1.25rem; text-align: center; color: var(--color-gray-500) }\n.badge { display: inline-block; border-radius: 9999px; background: var(--color-cream-100); padding: .125rem .5rem;\n font-size: .75rem; line-height: 1rem; font-weight: 500; color: var(--color-gray-600) }\n.badge.ok { background: var(--color-green-50); color: var(--color-green-700) }\n.badge.off { background: var(--color-cream-100); color: var(--color-gray-500) }\ncode { font-size: .75rem; line-height: 1rem; color: var(--color-gray-800) }\ncode.dim { color: var(--color-gray-500) }\ncode.sub { display: block; color: var(--color-gray-500) }\ncode.slug { display: block; margin-top: .75rem; overflow-wrap: break-word; border: 1px solid var(--line-dashed);\n border-radius: var(--radius-lg); background: var(--color-cream-50); padding: .5rem .75rem; font-size: .875rem }\n.installed-sites { margin-top: 1rem; border-top: 1px solid var(--line-soft); padding-top: 1rem; font-size: .875rem;\n line-height: 1.25rem }\n.installed-sites li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem }\n.installed-sites li + li { margin-top: .5rem }\ninput[readonly] { color: var(--color-gray-500) }\n.strong { font-weight: 500; color: var(--color-gray-800) }\na.link { font-weight: 500; color: var(--color-brand-600); transition: color .15s }\na.link:hover { color: var(--color-brand-700) }\nbutton, a.btn { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; gap: .5rem; white-space: nowrap;\n height: 2rem; padding: .375rem 1rem; border-radius: var(--radius-md); font-size: .875rem; line-height: 1.25rem;\n font-weight: 500; background: var(--primary); color: var(--primary-foreground); transition: all .15s }\nbutton:hover, a.btn:hover { background: color-mix(in oklab, var(--primary) 90%, transparent) }\nbutton.outline, a.btn.outline { border: 1px solid var(--border); background: var(--background); color: var(--foreground);\n box-shadow: 0 1px 2px 0 rgb(0 0 0 / .05) }\nbutton.outline:hover, a.btn.outline:hover { background: var(--accent); color: var(--accent-foreground) }\nbutton.danger { background: var(--destructive); color: var(--primary-foreground) }\nbutton.danger:hover { background: color-mix(in oklab, var(--destructive) 90%, transparent) }\nbutton.sm, a.btn.sm { height: 1.75rem; gap: .375rem; padding: 0 .75rem }\ninput { height: 2.25rem; width: 100%; min-width: 0; border: 1px solid var(--input); border-radius: var(--radius-md);\n padding: .25rem .75rem; font-size: .875rem; line-height: 1.25rem; box-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);\n transition: color .15s, box-shadow .15s }\ninput:focus-visible { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent) }\ninput.narrow-field { width: 16rem }\ninput[type=\"checkbox\"] { height: 1rem; width: 1rem; margin-top: .125rem; box-shadow: none; accent-color: var(--color-brand-500) }\nlabel { display: flex; align-items: center; gap: .5rem; font-size: .875rem; line-height: 1; font-weight: 500;\n color: var(--color-gray-900) }\nlabel.check { align-items: flex-start; font-weight: 400; line-height: 1.25rem; color: var(--color-gray-700) }\n.field > * + * { margin-top: .375rem }\n.field-help { display: block; font-size: .75rem; line-height: 1rem; color: var(--color-gray-500) }\n.row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem }\n.row.wide { gap: 1rem }\n.between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem }\n.top { align-items: flex-start }\n.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)) }\n.capability-heading { font-size: .75rem; line-height: 1rem; font-weight: 500; text-transform: uppercase; letter-spacing: .025em;\n color: var(--color-gray-500) }\n.capability-list { margin-top: .25rem; padding-left: 1.25rem; list-style: disc; font-size: .875rem; line-height: 1.25rem;\n color: var(--color-gray-700) }\n.notice { border: 1px solid var(--color-amber-300); border-radius: var(--radius-lg); background: var(--color-amber-50);\n padding: .75rem 1rem; font-size: .875rem; line-height: 1.25rem; color: var(--color-amber-700) }\n.endpoint { border-top: 1px solid var(--line-soft); padding: .75rem 0 }\n.endpoint:first-child { border-top: 0 }\n.endpoint code { display: block; word-break: break-all }\n.endpoint-meta { margin-top: .25rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .75rem;\n line-height: 1rem; color: var(--color-gray-500) }\n.meta { font-size: .875rem; line-height: 1.25rem; color: var(--color-gray-600) }\n.dim-sm { font-size: .75rem; line-height: 1rem; color: var(--color-gray-500) }\n.check-label { font-weight: 500 }\n.mt-3 { margin-top: .75rem }\n.mt-4 { margin-top: 1rem }\n.panel { width: 100%; min-height: 0; flex: 1; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--color-white) }", Jv = ":root {\n --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', 'Noto Sans', Arial, sans-serif,\n 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';\n --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;\n --radius: 0.625rem;\n --radius-sm: calc(var(--radius) - 4px);\n --radius-md: calc(var(--radius) - 2px);\n --radius-lg: var(--radius);\n --radius-xl: calc(var(--radius) + 4px);\n --background: oklch(1 0 0);\n --foreground: oklch(0.147 0.004 49.25);\n --primary: #f25c2b;\n --primary-foreground: #ffffff;\n --muted-foreground: oklch(0.553 0.013 58.071);\n --accent: oklch(0.97 0.001 106.424);\n --accent-foreground: oklch(0.216 0.006 56.043);\n --destructive: oklch(0.577 0.245 27.325);\n --border: oklch(0.923 0.003 48.717);\n --input: oklch(0.923 0.003 48.717);\n --ring: #f25c2b;\n --color-brand-50: #fff8f0;\n --color-brand-100: #fff1e0;\n --color-brand-200: #ffe0c2;\n --color-brand-300: #ffcda3;\n --color-brand-400: #ffb085;\n --color-brand-500: #f25c2b;\n --color-brand-600: #d94e22;\n --color-brand-700: #bf401a;\n --color-brand-800: #8c2f13;\n --color-brand-900: #5a1f0c;\n --color-cream-50: #fffdf9;\n --color-cream-100: #fff8f0;\n --color-cream-200: #fff1e0;\n --color-cream-300: #f5e6d3;\n --color-cream-400: #e8d5c4;\n --color-cream-500: #d4c0ae;\n --color-white: #fff;\n --color-gray-300: oklch(87.2% 0.01 258.338);\n --color-gray-400: oklch(70.7% 0.022 261.325);\n --color-gray-500: oklch(55.1% 0.027 264.364);\n --color-gray-600: oklch(44.6% 0.03 256.802);\n --color-gray-700: oklch(37.3% 0.034 259.733);\n --color-gray-800: oklch(27.8% 0.033 256.848);\n --color-gray-900: oklch(21% 0.034 264.665);\n --color-green-50: oklch(98.2% 0.018 155.826);\n --color-green-500: oklch(72.3% 0.219 149.579);\n --color-green-600: oklch(62.7% 0.194 149.214);\n --color-green-700: oklch(52.7% 0.154 150.069);\n --color-amber-50: oklch(98.7% 0.022 95.277);\n --color-amber-300: oklch(87.9% 0.169 91.605);\n --color-amber-700: oklch(55.5% 0.163 48.998);\n --color-red-200: oklch(88.5% 0.062 18.334);\n --color-red-500: oklch(63.7% 0.237 25.331);\n --color-red-700: oklch(50.5% 0.213 27.518);\n --line: color-mix(in oklab, var(--color-cream-400) 40%, transparent);\n --line-soft: color-mix(in oklab, var(--color-cream-400) 20%, transparent);\n --line-dashed: color-mix(in oklab, var(--color-cream-400) 60%, transparent);\n}\n.dark {\n --background: oklch(0.147 0.004 49.25);\n --foreground: oklch(0.985 0.001 106.423);\n --muted-foreground: oklch(0.709 0.01 56.259);\n --accent: oklch(0.268 0.007 34.298);\n --accent-foreground: oklch(0.985 0.001 106.423);\n --destructive: oklch(0.704 0.191 22.216);\n --border: oklch(1 0 0 / 10%);\n --input: oklch(1 0 0 / 15%);\n}\n.theme-developer {\n --color-white: #1c1917;\n --color-cream-50: #121110;\n --color-cream-100: #262322;\n --color-cream-200: #302c2a;\n --color-cream-300: #3b3634;\n --color-cream-400: #6d635d;\n --color-cream-500: #7f746d;\n --color-gray-300: #57504c;\n --color-gray-400: #7b736e;\n --color-gray-500: #9a938d;\n --color-gray-600: #bab2ad;\n --color-gray-700: #d7d1cd;\n --color-gray-800: #ece8e6;\n --color-gray-900: #f8f6f5;\n --color-brand-50: #2b1610;\n --color-brand-100: #3a1d15;\n --color-brand-200: #5a2a18;\n --color-brand-300: #7d3a22;\n --color-brand-600: #ff7043;\n --color-brand-700: #ff8a63;\n --color-red-200: #7f1d1d;\n --color-red-500: #f87171;\n --color-green-600: #4ade80;\n --color-amber-50: #2e2210;\n --color-amber-300: #7c5a1d;\n --color-amber-700: #fbbf24;\n}", Yv = (e) => e === "/developer" || e.startsWith("/developer/") ? "dark theme-developer" : "", Xv = `new EventSource(${JSON.stringify("/reload")}).addEventListener('reload', () => { location.reload() })`, $ = (e) => e.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """), Zv = (e, t) => {
|
|
9170
|
+
}, Yv = (e, t) => `<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${Jv[e]}</svg>`, Xv = "\n*, ::before, ::after { box-sizing: border-box; border: 0 solid; margin: 0; padding: 0 }\nhtml { font-family: var(--font-sans); line-height: 1.5; -webkit-text-size-adjust: 100% }\nh1, h2, h3 { font-size: inherit; font-weight: inherit }\nul, ol { list-style: none }\na { color: inherit; text-decoration: inherit }\ncode, pre { font-family: var(--font-mono); font-size: 1em }\ntable { border-collapse: collapse }\nsvg { display: block; vertical-align: middle }\niframe { display: block }\nbutton, input, select { font: inherit; color: inherit; background: transparent; letter-spacing: inherit }\nbutton:not(:disabled) { cursor: pointer }\n::placeholder { color: var(--muted-foreground) }\nbody { background: var(--color-cream-50); color: var(--color-gray-900) }\n.shell { display: flex; min-height: 100dvh; background: var(--color-cream-50) }\naside { position: sticky; top: 0; display: flex; height: 100dvh; width: 16rem; flex-shrink: 0; flex-direction: column;\n overflow-y: auto; border-right: 1px solid var(--line); background: var(--color-white) }\n.sidebar-head { display: flex; height: 73px; align-items: center; padding: 0 .75rem; border-bottom: 1px solid var(--line) }\n.sidebar-head.stacked { display: block; height: auto; padding: .75rem }\n.back { display: flex; align-items: center; gap: .25rem; margin-bottom: .5rem; font-size: .75rem; line-height: 1rem;\n color: var(--color-gray-500); transition: color .15s }\n.back:hover { color: var(--color-gray-700) }\n.switcher { display: flex; width: 100%; align-items: center; gap: .75rem; border: 1px solid var(--line);\n border-radius: var(--radius-xl); padding: .625rem .75rem; text-align: left; transition: background-color .15s }\n.switcher:hover { background: var(--color-cream-50) }\n.switcher-icon { display: flex; height: 2.25rem; width: 2.25rem; flex-shrink: 0; align-items: center; justify-content: center;\n border-radius: var(--radius-lg); background: var(--color-brand-50); color: var(--color-brand-600) }\n.switcher-text { min-width: 0; flex: 1 }\n.switcher-text strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\n font-size: .875rem; line-height: 1.25rem; font-weight: 600; color: var(--color-gray-900) }\n.switcher-sub { display: flex; align-items: center; gap: .375rem; font-size: .75rem; line-height: 1rem; color: var(--color-gray-500) }\n.dot { height: .375rem; width: .375rem; flex-shrink: 0; border-radius: 9999px; background: var(--color-green-500) }\nnav { flex: 1; padding: .75rem }\nnav section + section { margin-top: 1rem }\nnav h2 { padding: 0 .75rem .25rem; font-size: 11px; line-height: 1rem; font-weight: 600; text-transform: uppercase;\n letter-spacing: .025em; color: var(--color-gray-500) }\n.nav-item { display: flex; align-items: center; gap: .625rem; border-radius: var(--radius-lg); padding: .5rem .75rem;\n font-size: .875rem; line-height: 1.25rem; font-weight: 500; color: var(--color-gray-700); transition: background-color .15s, color .15s }\n.nav-item:hover { background: var(--color-cream-100) }\n.nav-item.on, .nav-item[aria-current=\"page\"] { background: var(--color-brand-50); color: var(--color-brand-600) }\n.nav-item.muted { opacity: .6 }\n.nav-item + .nav-item, .nav-group + .nav-item, .nav-item + .nav-group, .nav-group + .nav-group { margin-top: .25rem }\n.nav-group > .nav-item { justify-content: space-between }\n.nav-group-label { display: flex; align-items: center; gap: .625rem }\n.nav-group svg:last-child { color: var(--color-gray-400) }\n.nav-children { margin: .25rem 0 0 1.75rem; padding-left: .5rem; border-left: 1px solid var(--line) }\n.nav-child { display: block; border-radius: var(--radius-lg); padding: .375rem .75rem; font-size: .875rem; line-height: 1.25rem;\n color: var(--color-gray-600); transition: background-color .15s, color .15s }\n.nav-child + .nav-child { margin-top: .25rem }\n.nav-child:hover { background: var(--color-cream-100) }\n.nav-child[aria-current=\"page\"] { background: var(--color-brand-50); font-weight: 500; color: var(--color-brand-600) }\n.sidebar-foot { border-top: 1px solid var(--line); padding: .75rem }\n.sidebar-foot > * + * { margin-top: .75rem }\n.stamp { display: flex; align-items: center; gap: .5rem; padding: 0 .75rem; font-size: .75rem; line-height: 1rem;\n color: var(--color-gray-500) }\n.stamp svg { color: var(--color-brand-500) }\n.content { display: flex; min-width: 0; flex: 1; flex-direction: column }\n.content > header { position: sticky; top: 0; z-index: 20; display: flex; height: 73px; align-items: center; gap: .75rem;\n padding: 0 1.5rem; border-bottom: 1px solid var(--line); background: var(--color-cream-50) }\nh1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.125rem; line-height: 1.75rem;\n font-weight: 600; color: var(--color-gray-900) }\nmain { flex: 1; padding: 1.5rem }\n.page { width: 100% }\n.page.form { margin: 0 auto; max-width: 64rem }\n.page.fill { display: flex; height: calc(100dvh - 73px - 3rem); flex-direction: column; gap: 1.5rem }\n.narrow { max-width: 48rem }\n.stack > * + * { margin-top: 1.5rem }\n.rows > * + * { margin-top: 1rem }\n.lede { max-width: 42rem; font-size: .875rem; line-height: 1.25rem; color: var(--color-gray-600) }\n.card { border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--color-white); padding: 1.5rem }\n.card.dashed { border-style: dashed; border-color: var(--line-dashed); padding: 1rem }\n.card.danger { border-color: var(--color-red-200) }\n.card h2, .section-title { font-size: .875rem; line-height: 1.25rem; font-weight: 600; color: var(--color-gray-900) }\n.hint { margin-top: .25rem; font-size: .875rem; line-height: 1.25rem; color: var(--color-gray-500) }\n.table-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--color-white) }\n.table-scroll { overflow-x: auto }\ntable { width: 100%; font-size: .875rem; line-height: 1.25rem }\nthead tr { text-align: left }\nth { padding: .5rem 1rem .5rem 0; font-weight: 500; color: var(--color-gray-600) }\ntbody tr { border-top: 1px solid var(--line-soft) }\ntd { padding: .5rem 1rem .5rem 0; vertical-align: top; color: var(--color-gray-600) }\n.table-card thead tr { background: var(--color-cream-50) }\n.table-card th, .table-card td { padding: .75rem 1.25rem }\ntd.actions { text-align: right; white-space: nowrap }\ntd.actions form { display: inline-flex; vertical-align: middle }\ntd.actions > * + * { margin-left: .5rem }\n.empty-cell { padding: 2.5rem 1.25rem; text-align: center; color: var(--color-gray-500) }\n.badge { display: inline-block; border-radius: 9999px; background: var(--color-cream-100); padding: .125rem .5rem;\n font-size: .75rem; line-height: 1rem; font-weight: 500; color: var(--color-gray-600) }\n.badge.ok { background: var(--color-green-50); color: var(--color-green-700) }\n.badge.off { background: var(--color-cream-100); color: var(--color-gray-500) }\ncode { font-size: .75rem; line-height: 1rem; color: var(--color-gray-800) }\ncode.dim { color: var(--color-gray-500) }\ncode.sub { display: block; color: var(--color-gray-500) }\ncode.slug { display: block; margin-top: .75rem; overflow-wrap: break-word; border: 1px solid var(--line-dashed);\n border-radius: var(--radius-lg); background: var(--color-cream-50); padding: .5rem .75rem; font-size: .875rem }\n.installed-sites { margin-top: 1rem; border-top: 1px solid var(--line-soft); padding-top: 1rem; font-size: .875rem;\n line-height: 1.25rem }\n.installed-sites li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem }\n.installed-sites li + li { margin-top: .5rem }\ninput[readonly] { color: var(--color-gray-500) }\n.strong { font-weight: 500; color: var(--color-gray-800) }\na.link { font-weight: 500; color: var(--color-brand-600); transition: color .15s }\na.link:hover { color: var(--color-brand-700) }\nbutton, a.btn { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; gap: .5rem; white-space: nowrap;\n height: 2rem; padding: .375rem 1rem; border-radius: var(--radius-md); font-size: .875rem; line-height: 1.25rem;\n font-weight: 500; background: var(--primary); color: var(--primary-foreground); transition: all .15s }\nbutton:hover, a.btn:hover { background: color-mix(in oklab, var(--primary) 90%, transparent) }\nbutton.outline, a.btn.outline { border: 1px solid var(--border); background: var(--background); color: var(--foreground);\n box-shadow: 0 1px 2px 0 rgb(0 0 0 / .05) }\nbutton.outline:hover, a.btn.outline:hover { background: var(--accent); color: var(--accent-foreground) }\nbutton.danger { background: var(--destructive); color: var(--primary-foreground) }\nbutton.danger:hover { background: color-mix(in oklab, var(--destructive) 90%, transparent) }\nbutton.sm, a.btn.sm { height: 1.75rem; gap: .375rem; padding: 0 .75rem }\ninput { height: 2.25rem; width: 100%; min-width: 0; border: 1px solid var(--input); border-radius: var(--radius-md);\n padding: .25rem .75rem; font-size: .875rem; line-height: 1.25rem; box-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);\n transition: color .15s, box-shadow .15s }\ninput:focus-visible { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent) }\ninput.narrow-field { width: 16rem }\ninput[type=\"checkbox\"] { height: 1rem; width: 1rem; margin-top: .125rem; box-shadow: none; accent-color: var(--color-brand-500) }\nlabel { display: flex; align-items: center; gap: .5rem; font-size: .875rem; line-height: 1; font-weight: 500;\n color: var(--color-gray-900) }\nlabel.check { align-items: flex-start; font-weight: 400; line-height: 1.25rem; color: var(--color-gray-700) }\n.field > * + * { margin-top: .375rem }\n.field-help { display: block; font-size: .75rem; line-height: 1rem; color: var(--color-gray-500) }\n.row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem }\n.row.wide { gap: 1rem }\n.between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem }\n.top { align-items: flex-start }\n.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)) }\n.capability-heading { font-size: .75rem; line-height: 1rem; font-weight: 500; text-transform: uppercase; letter-spacing: .025em;\n color: var(--color-gray-500) }\n.capability-list { margin-top: .25rem; padding-left: 1.25rem; list-style: disc; font-size: .875rem; line-height: 1.25rem;\n color: var(--color-gray-700) }\n.notice { border: 1px solid var(--color-amber-300); border-radius: var(--radius-lg); background: var(--color-amber-50);\n padding: .75rem 1rem; font-size: .875rem; line-height: 1.25rem; color: var(--color-amber-700) }\n.endpoint { border-top: 1px solid var(--line-soft); padding: .75rem 0 }\n.endpoint:first-child { border-top: 0 }\n.endpoint code { display: block; word-break: break-all }\n.endpoint-meta { margin-top: .25rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .75rem;\n line-height: 1rem; color: var(--color-gray-500) }\n.meta { font-size: .875rem; line-height: 1.25rem; color: var(--color-gray-600) }\n.dim-sm { font-size: .75rem; line-height: 1rem; color: var(--color-gray-500) }\n.check-label { font-weight: 500 }\n.mt-3 { margin-top: .75rem }\n.mt-4 { margin-top: 1rem }\n.panel { width: 100%; min-height: 0; flex: 1; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--color-white) }", Zv = ":root {\n --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', 'Noto Sans', Arial, sans-serif,\n 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';\n --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;\n --radius: 0.625rem;\n --radius-sm: calc(var(--radius) - 4px);\n --radius-md: calc(var(--radius) - 2px);\n --radius-lg: var(--radius);\n --radius-xl: calc(var(--radius) + 4px);\n --background: oklch(1 0 0);\n --foreground: oklch(0.147 0.004 49.25);\n --primary: #f25c2b;\n --primary-foreground: #ffffff;\n --muted-foreground: oklch(0.553 0.013 58.071);\n --accent: oklch(0.97 0.001 106.424);\n --accent-foreground: oklch(0.216 0.006 56.043);\n --destructive: oklch(0.577 0.245 27.325);\n --border: oklch(0.923 0.003 48.717);\n --input: oklch(0.923 0.003 48.717);\n --ring: #f25c2b;\n --color-brand-50: #fff8f0;\n --color-brand-100: #fff1e0;\n --color-brand-200: #ffe0c2;\n --color-brand-300: #ffcda3;\n --color-brand-400: #ffb085;\n --color-brand-500: #f25c2b;\n --color-brand-600: #d94e22;\n --color-brand-700: #bf401a;\n --color-brand-800: #8c2f13;\n --color-brand-900: #5a1f0c;\n --color-cream-50: #fffdf9;\n --color-cream-100: #fff8f0;\n --color-cream-200: #fff1e0;\n --color-cream-300: #f5e6d3;\n --color-cream-400: #e8d5c4;\n --color-cream-500: #d4c0ae;\n --color-white: #fff;\n --color-gray-300: oklch(87.2% 0.01 258.338);\n --color-gray-400: oklch(70.7% 0.022 261.325);\n --color-gray-500: oklch(55.1% 0.027 264.364);\n --color-gray-600: oklch(44.6% 0.03 256.802);\n --color-gray-700: oklch(37.3% 0.034 259.733);\n --color-gray-800: oklch(27.8% 0.033 256.848);\n --color-gray-900: oklch(21% 0.034 264.665);\n --color-green-50: oklch(98.2% 0.018 155.826);\n --color-green-500: oklch(72.3% 0.219 149.579);\n --color-green-600: oklch(62.7% 0.194 149.214);\n --color-green-700: oklch(52.7% 0.154 150.069);\n --color-amber-50: oklch(98.7% 0.022 95.277);\n --color-amber-300: oklch(87.9% 0.169 91.605);\n --color-amber-700: oklch(55.5% 0.163 48.998);\n --color-red-200: oklch(88.5% 0.062 18.334);\n --color-red-500: oklch(63.7% 0.237 25.331);\n --color-red-700: oklch(50.5% 0.213 27.518);\n --line: color-mix(in oklab, var(--color-cream-400) 40%, transparent);\n --line-soft: color-mix(in oklab, var(--color-cream-400) 20%, transparent);\n --line-dashed: color-mix(in oklab, var(--color-cream-400) 60%, transparent);\n}\n.dark {\n --background: oklch(0.147 0.004 49.25);\n --foreground: oklch(0.985 0.001 106.423);\n --muted-foreground: oklch(0.709 0.01 56.259);\n --accent: oklch(0.268 0.007 34.298);\n --accent-foreground: oklch(0.985 0.001 106.423);\n --destructive: oklch(0.704 0.191 22.216);\n --border: oklch(1 0 0 / 10%);\n --input: oklch(1 0 0 / 15%);\n}\n.theme-developer {\n --color-white: #1c1917;\n --color-cream-50: #121110;\n --color-cream-100: #262322;\n --color-cream-200: #302c2a;\n --color-cream-300: #3b3634;\n --color-cream-400: #6d635d;\n --color-cream-500: #7f746d;\n --color-gray-300: #57504c;\n --color-gray-400: #7b736e;\n --color-gray-500: #9a938d;\n --color-gray-600: #bab2ad;\n --color-gray-700: #d7d1cd;\n --color-gray-800: #ece8e6;\n --color-gray-900: #f8f6f5;\n --color-brand-50: #2b1610;\n --color-brand-100: #3a1d15;\n --color-brand-200: #5a2a18;\n --color-brand-300: #7d3a22;\n --color-brand-600: #ff7043;\n --color-brand-700: #ff8a63;\n --color-red-200: #7f1d1d;\n --color-red-500: #f87171;\n --color-green-600: #4ade80;\n --color-amber-50: #2e2210;\n --color-amber-300: #7c5a1d;\n --color-amber-700: #fbbf24;\n}", Qv = (e) => e === "/developer" || e.startsWith("/developer/") ? "dark theme-developer" : "", $v = `new EventSource(${JSON.stringify("/reload")}).addEventListener('reload', () => { location.reload() })`, $ = (e) => e.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """), ey = (e, t) => {
|
|
9155
9171
|
let n = e.href === t ? " aria-current=\"page\"" : "";
|
|
9156
9172
|
return `<a class="nav-child" href="${$(e.href)}"${n}>${$(e.label)}</a>`;
|
|
9157
|
-
},
|
|
9173
|
+
}, ty = (e, t) => {
|
|
9158
9174
|
let n = e.children ?? [], r = e.muted === !0 ? " muted" : "", i = t === e.href || t.startsWith(`${e.href}/`);
|
|
9159
9175
|
if (n.length === 0) {
|
|
9160
9176
|
let t = i ? " aria-current=\"page\"" : "";
|
|
9161
|
-
return `<a class="nav-item${r}" href="${$(e.href)}"${t}>${
|
|
9177
|
+
return `<a class="nav-item${r}" href="${$(e.href)}"${t}>${Yv(e.icon, 18)}${$(e.label)}</a>`;
|
|
9162
9178
|
}
|
|
9163
9179
|
return `<div class="nav-group">
|
|
9164
9180
|
<a class="nav-item${i ? " on" : ""}${r}" href="${$(e.href)}" aria-expanded="${i}">
|
|
9165
|
-
<span class="nav-group-label">${
|
|
9181
|
+
<span class="nav-group-label">${Yv(e.icon, 18)}${$(e.label)}</span>${Yv(i ? "chevronDown" : "chevronRight", 16)}
|
|
9166
9182
|
</a>
|
|
9167
|
-
${i ? `<div class="nav-children">${n.map((e) =>
|
|
9183
|
+
${i ? `<div class="nav-children">${n.map((e) => ey(e, t)).join("")}</div>` : ""}
|
|
9168
9184
|
</div>`;
|
|
9169
|
-
},
|
|
9185
|
+
}, ny = (e, t) => `<section>${e.label === void 0 ? "" : `<h2>${$(e.label)}</h2>`}${e.items.map((e) => ty(e, t)).join("")}</section>`, ry = (e) => {
|
|
9170
9186
|
let t = `<div class="switcher">
|
|
9171
|
-
<span class="switcher-icon">${
|
|
9187
|
+
<span class="switcher-icon">${Yv(e.icon, 18)}</span>
|
|
9172
9188
|
<span class="switcher-text">
|
|
9173
9189
|
<strong>${$(e.title)}</strong>
|
|
9174
9190
|
<span class="switcher-sub">${e.dot ? "<span class=\"dot\"></span>" : ""}${$(e.subtitle)}</span>
|
|
9175
9191
|
</span>
|
|
9176
9192
|
</div>`;
|
|
9177
9193
|
return e.back === null ? `<div class="sidebar-head">${t}</div>` : `<div class="sidebar-head stacked">
|
|
9178
|
-
<a class="back" href="${$(e.back.href)}">${
|
|
9194
|
+
<a class="back" href="${$(e.back.href)}">${Yv("chevronLeft", 14)}${$(e.back.label)}</a>
|
|
9179
9195
|
${t}
|
|
9180
9196
|
</div>`;
|
|
9181
|
-
},
|
|
9197
|
+
}, iy = (e) => {
|
|
9182
9198
|
let t = e.external ? " target=\"_blank\" rel=\"noreferrer\"" : "";
|
|
9183
|
-
return `<a class="nav-item" href="${$(e.href)}"${t}>${
|
|
9184
|
-
},
|
|
9185
|
-
let t =
|
|
9199
|
+
return `<a class="nav-item" href="${$(e.href)}"${t}>${Yv(e.icon, 18)}${$(e.label)}</a>`;
|
|
9200
|
+
}, ay = (e) => {
|
|
9201
|
+
let t = Qv(e.path);
|
|
9186
9202
|
return `<!doctype html>
|
|
9187
9203
|
<html lang="en"${t === "" ? "" : ` class="${t}"`}>
|
|
9188
9204
|
<head>
|
|
9189
9205
|
<meta charset="utf-8">
|
|
9190
9206
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
9191
9207
|
<title>${$(e.title)} — Qinto</title>
|
|
9192
|
-
<style>${
|
|
9208
|
+
<style>${Zv}${Xv}</style>
|
|
9193
9209
|
</head>
|
|
9194
9210
|
<body>
|
|
9195
9211
|
<div class="shell">
|
|
9196
9212
|
<aside>
|
|
9197
|
-
${
|
|
9198
|
-
<nav>${e.sections.map((t) =>
|
|
9213
|
+
${ry(e.header)}
|
|
9214
|
+
<nav>${e.sections.map((t) => ny(t, e.path)).join("")}</nav>
|
|
9199
9215
|
<div class="sidebar-foot">
|
|
9200
|
-
${e.footer.map(
|
|
9201
|
-
<div class="stamp">${
|
|
9216
|
+
${e.footer.map(iy).join("")}
|
|
9217
|
+
<div class="stamp">${Yv("layers", 16)}local Qinto · platform ${$(e.platformVersion)}</div>
|
|
9202
9218
|
</div>
|
|
9203
9219
|
</aside>
|
|
9204
9220
|
<div class="content">
|
|
@@ -9206,22 +9222,22 @@ var H_ = (e) => e.reduce((e, t) => e | B_[t], 0), U_ = (e) => {
|
|
|
9206
9222
|
<main><div class="page ${e.width}">${e.body}</div></main>
|
|
9207
9223
|
</div>
|
|
9208
9224
|
</div>
|
|
9209
|
-
<script>${
|
|
9225
|
+
<script>${$v}<\/script>
|
|
9210
9226
|
${e.script === void 0 ? "" : `<script>${e.script}<\/script>`}
|
|
9211
9227
|
</body>
|
|
9212
9228
|
</html>
|
|
9213
9229
|
`;
|
|
9214
|
-
},
|
|
9230
|
+
}, oy = {
|
|
9215
9231
|
transform: "Transform",
|
|
9216
9232
|
destination: "Destination"
|
|
9217
|
-
},
|
|
9233
|
+
}, sy = (e) => e.flows.map((e) => `<span class="badge">${oy[e]}</span>`).join(" "), cy = (e, t) => e.app.installs.filter((n) => Lm(e.manifest, e.app, n, t)).length, ly = (e) => `<input type="hidden" name="slug" value="${$(e)}">`, uy = (e) => `<tr>
|
|
9218
9234
|
<td class="strong">${$(e.manifest.name)}</td>
|
|
9219
9235
|
<td><code>${$(e.slug)}</code></td>
|
|
9220
9236
|
<td>${$(e.manifest.description ?? "—")}</td>
|
|
9221
|
-
<td><div class="row">${
|
|
9222
|
-
<td><code>${
|
|
9223
|
-
<td class="actions"><a class="btn outline sm" href="${
|
|
9224
|
-
</tr>`,
|
|
9237
|
+
<td><div class="row">${sy(e.manifest)}</div></td>
|
|
9238
|
+
<td><code>${Q}</code></td>
|
|
9239
|
+
<td class="actions"><a class="btn outline sm" href="${Gg}/${$(e.slug)}">View</a></td>
|
|
9240
|
+
</tr>`, dy = (e) => {
|
|
9225
9241
|
let t = e.apps.length;
|
|
9226
9242
|
return `<div class="stack">
|
|
9227
9243
|
<p class="lede">Apps run on the sites that install them. This organization builds ${t === 1 ? "one app" : `${t} apps`} locally —
|
|
@@ -9229,99 +9245,99 @@ ${e.script === void 0 ? "" : `<script>${e.script}<\/script>`}
|
|
|
9229
9245
|
<div class="table-card"><div class="table-scroll">
|
|
9230
9246
|
<table>
|
|
9231
9247
|
<thead><tr><th>Name</th><th>Slug</th><th>Description</th><th>Flows</th><th>Version</th><th></th></tr></thead>
|
|
9232
|
-
<tbody>${e.apps.map((e) =>
|
|
9248
|
+
<tbody>${e.apps.map((e) => uy(e)).join("")}</tbody>
|
|
9233
9249
|
</table>
|
|
9234
9250
|
</div></div>
|
|
9235
9251
|
</div>`;
|
|
9236
|
-
},
|
|
9252
|
+
}, fy = (e, t) => {
|
|
9237
9253
|
let n = $(e.manifest.name);
|
|
9238
9254
|
return e.app.installed ? `<tr>
|
|
9239
9255
|
<td>
|
|
9240
|
-
<a class="link" href="${
|
|
9256
|
+
<a class="link" href="${Z}/${$(e.slug)}">${n}</a>
|
|
9241
9257
|
<code class="sub">${$(e.slug)}</code>
|
|
9242
9258
|
</td>
|
|
9243
|
-
<td><div class="row">${
|
|
9244
|
-
<td><code>${
|
|
9245
|
-
<td>${
|
|
9259
|
+
<td><div class="row">${sy(e.manifest)}</div></td>
|
|
9260
|
+
<td><code>${Q}</code></td>
|
|
9261
|
+
<td>${cy(e, t.secrets)} of ${e.app.installs.length} active</td>
|
|
9246
9262
|
<td class="actions">
|
|
9247
9263
|
<form method="post" action="/app-enabled">
|
|
9248
|
-
${
|
|
9264
|
+
${ly(e.slug)}
|
|
9249
9265
|
<input type="hidden" name="enabled" value="${e.app.enabled ? "false" : "true"}">
|
|
9250
9266
|
<button class="sm${e.app.enabled ? " outline" : ""}">${e.app.enabled ? "Disable" : "Enable"}</button>
|
|
9251
9267
|
</form>
|
|
9252
|
-
<a class="btn outline sm" href="${
|
|
9268
|
+
<a class="btn outline sm" href="${Z}/${$(e.slug)}">View</a>
|
|
9253
9269
|
</td>
|
|
9254
9270
|
</tr>` : `<tr>
|
|
9255
9271
|
<td>
|
|
9256
9272
|
<span class="strong">${n}</span>
|
|
9257
9273
|
<code class="sub">${$(e.slug)}</code>
|
|
9258
9274
|
</td>
|
|
9259
|
-
<td><div class="row">${
|
|
9260
|
-
<td><code>${
|
|
9275
|
+
<td><div class="row">${sy(e.manifest)}</div></td>
|
|
9276
|
+
<td><code>${Q}</code></td>
|
|
9261
9277
|
<td>Not installed</td>
|
|
9262
|
-
<td class="actions"><form method="post" action="/install">${
|
|
9278
|
+
<td class="actions"><form method="post" action="/install">${ly(e.slug)}<button class="sm">Install</button></form></td>
|
|
9263
9279
|
</tr>`;
|
|
9264
|
-
},
|
|
9280
|
+
}, py = (e) => `<div class="stack">
|
|
9265
9281
|
<p class="lede">Apps run on this site's edge worker. On the platform they arrive with <code>qinto app publish</code>; here each one is
|
|
9266
9282
|
built from source on every change. Apps installed together share this site, so one can call another over RPC.</p>
|
|
9267
9283
|
<div class="table-card"><div class="table-scroll">
|
|
9268
9284
|
<table>
|
|
9269
9285
|
<thead><tr><th>App</th><th>Flows</th><th>Version</th><th>Installs</th><th></th></tr></thead>
|
|
9270
|
-
<tbody>${e.apps.map((t) =>
|
|
9286
|
+
<tbody>${e.apps.map((t) => fy(t, e)).join("")}</tbody>
|
|
9271
9287
|
</table>
|
|
9272
9288
|
</div></div>
|
|
9273
|
-
</div>`,
|
|
9289
|
+
</div>`, my = (e, t) => {
|
|
9274
9290
|
if (!e.app.installed) return "not installed on this site";
|
|
9275
9291
|
let n = [...new Set(e.app.installs.flatMap((n) => Im(e.manifest, n, t)))];
|
|
9276
9292
|
return n.length === 0 ? "every install disabled" : `set ${n.join(", ")}`;
|
|
9277
|
-
},
|
|
9278
|
-
let t = e.apps.filter((t) =>
|
|
9293
|
+
}, hy = (e) => {
|
|
9294
|
+
let t = e.apps.filter((t) => cy(t, e.secrets) === 0);
|
|
9279
9295
|
return t.length === 0 || t.length !== e.apps.length ? "" : `<p class="notice">No app is active on this site, so its hooks never run and no app span appears below.
|
|
9280
|
-
${t.map((t) => `<br><strong>${$(t.manifest.name)}</strong> — ${$(
|
|
9281
|
-
<br><a class="link" href="${
|
|
9282
|
-
},
|
|
9296
|
+
${t.map((t) => `<br><strong>${$(t.manifest.name)}</strong> — ${$(my(t, e.secrets))}`).join("")}
|
|
9297
|
+
<br><a class="link" href="${Z}">Open the app list</a> to fix it.</p>`;
|
|
9298
|
+
}, gy = (e) => `${qv}
|
|
9283
9299
|
<div class="stack">
|
|
9284
9300
|
<p class="lede">Every request this site worker serves, as OpenTelemetry traces — the same spans the platform streams from a deployed
|
|
9285
9301
|
site. Your apps' own <code>ctx.observability</code> lines arrive as span events. Fire something from the
|
|
9286
9302
|
<a class="link" href="${$(e.demoOrigin)}">demo site</a>.</p>
|
|
9287
|
-
${
|
|
9303
|
+
${hy(e)}
|
|
9288
9304
|
<p class="status" id="status">Connecting…</p>
|
|
9289
9305
|
<ul class="console" id="rows"></ul>
|
|
9290
9306
|
</div>
|
|
9291
|
-
<dialog id="trace"></dialog>`,
|
|
9307
|
+
<dialog id="trace"></dialog>`, _y = (e) => {
|
|
9292
9308
|
if (e.helpText === void 0 && e.helpUrl === void 0) return "";
|
|
9293
9309
|
let t = e.helpUrl === void 0 ? "" : ` <a class="link" href="${$(e.helpUrl)}" target="_blank" rel="noreferrer">Learn more</a>`;
|
|
9294
9310
|
return `<span class="field-help">${$(e.helpText ?? "")}${t}</span>`;
|
|
9295
|
-
},
|
|
9311
|
+
}, vy = (e, t, n) => {
|
|
9296
9312
|
let r = `var_${e.name}`, i = `${t.appInstallId}-${e.name}`, a = $(`${e.label}${e.required === !0 ? " *" : ""}`);
|
|
9297
9313
|
if (e.type === "toggle") return `<label class="check" for="${i}">
|
|
9298
9314
|
<input id="${i}" type="checkbox" name="${r}"${t.variables[e.name] === !0 ? " checked" : ""}>
|
|
9299
|
-
<span><span class="check-label">${a}</span>${
|
|
9315
|
+
<span><span class="check-label">${a}</span>${_y(e)}</span>
|
|
9300
9316
|
</label>`;
|
|
9301
9317
|
if (e.kind === "secret") {
|
|
9302
9318
|
let o = n.secrets[t.appInstallId]?.[e.name] !== void 0;
|
|
9303
9319
|
return `<div class="field">
|
|
9304
9320
|
<div class="row"><label for="${i}">${a}</label><span class="badge ${o ? "ok" : "off"}">${o ? "Set" : "Not set"}</span></div>
|
|
9305
9321
|
<input id="${i}" name="${r}" type="password" autocomplete="off" placeholder="Enter a new value to replace">
|
|
9306
|
-
${
|
|
9322
|
+
${_y(e)}
|
|
9307
9323
|
</div>`;
|
|
9308
9324
|
}
|
|
9309
9325
|
let o = t.variables[e.name];
|
|
9310
9326
|
return `<div class="field">
|
|
9311
9327
|
<label for="${i}">${a}</label>
|
|
9312
9328
|
<input id="${i}" name="${r}" type="${e.type === "password" ? "password" : "text"}" value="${$(typeof o == "string" ? o : "")}">
|
|
9313
|
-
${
|
|
9329
|
+
${_y(e)}
|
|
9314
9330
|
</div>`;
|
|
9315
|
-
},
|
|
9316
|
-
${
|
|
9331
|
+
}, yy = (e, t) => e.current.manifest.variables.length === 0 ? "" : `<form method="post" action="/variables" class="rows mt-4">
|
|
9332
|
+
${ly(e.current.slug)}
|
|
9317
9333
|
<input type="hidden" name="appInstallId" value="${t.appInstallId}">
|
|
9318
|
-
${e.current.manifest.variables.map((n) =>
|
|
9334
|
+
${e.current.manifest.variables.map((n) => vy(n, t, e)).join("")}
|
|
9319
9335
|
<button class="sm">Save variables</button>
|
|
9320
|
-
</form>`,
|
|
9336
|
+
</form>`, by = (e, t, n) => {
|
|
9321
9337
|
let r = new Set(Im(e.current.manifest, t, e.secrets));
|
|
9322
9338
|
return n || r.size === 0 ? "" : `<p class="notice mt-3">Missing required variables: ${$(e.current.manifest.variables.filter((e) => r.has(e.name)).map((e) => e.label).join(", "))}</p>`;
|
|
9323
|
-
},
|
|
9324
|
-
let n = Lm(e.current.manifest, e.current.app, t, e.secrets), r = e.current.manifest.install.multiple && e.current.app.installs.length > 1, i =
|
|
9339
|
+
}, xy = (e, t) => {
|
|
9340
|
+
let n = Lm(e.current.manifest, e.current.app, t, e.secrets), r = e.current.manifest.install.multiple && e.current.app.installs.length > 1, i = ly(e.current.slug);
|
|
9325
9341
|
return `<div class="card">
|
|
9326
9342
|
<div class="between">
|
|
9327
9343
|
<div class="row">
|
|
@@ -9347,17 +9363,17 @@ ${e.script === void 0 ? "" : `<script>${e.script}<\/script>`}
|
|
|
9347
9363
|
</form>` : ""}
|
|
9348
9364
|
</div>
|
|
9349
9365
|
</div>
|
|
9350
|
-
${
|
|
9351
|
-
${
|
|
9366
|
+
${by(e, t, n)}
|
|
9367
|
+
${yy(e, t)}
|
|
9352
9368
|
</div>`;
|
|
9353
|
-
},
|
|
9369
|
+
}, Sy = (e) => e.current.manifest.install.multiple ? `<div class="card dashed">
|
|
9354
9370
|
<form method="post" action="/install-add" class="row">
|
|
9355
|
-
${
|
|
9371
|
+
${ly(e.current.slug)}
|
|
9356
9372
|
<input class="narrow-field" name="label" placeholder="${$(e.current.manifest.install.labelHint ?? "Install label")}"
|
|
9357
9373
|
aria-label="New install label">
|
|
9358
9374
|
<button class="sm">Add install</button>
|
|
9359
9375
|
</form>
|
|
9360
|
-
</div>` : "",
|
|
9376
|
+
</div>` : "", Cy = (e, t, n) => {
|
|
9361
9377
|
if (e === void 0) return {
|
|
9362
9378
|
label: "Not connected",
|
|
9363
9379
|
tone: "off",
|
|
@@ -9374,8 +9390,8 @@ ${e.script === void 0 ? "" : `<script>${e.script}<\/script>`}
|
|
|
9374
9390
|
tone: "ok",
|
|
9375
9391
|
hint: `Granted ${$(r)} — ${i}. Connected ${new Date(e.connectedAt).toISOString()}.`
|
|
9376
9392
|
};
|
|
9377
|
-
},
|
|
9378
|
-
let i = t.oauth[n.id], a =
|
|
9393
|
+
}, wy = (e, t, n, r) => {
|
|
9394
|
+
let i = t.oauth[n.id], a = Cy(i, n, r), o = `${ly(e.current.slug)}
|
|
9379
9395
|
<input type="hidden" name="appInstallId" value="${t.appInstallId}">
|
|
9380
9396
|
<input type="hidden" name="providerId" value="${$(n.id)}">`, s = i === void 0 ? "" : `<form method="post" action="/oauth-disconnect">${o}<button class="outline sm">Disconnect</button></form>`;
|
|
9381
9397
|
return `<div class="between top mt-3">
|
|
@@ -9388,28 +9404,28 @@ ${e.script === void 0 ? "" : `<script>${e.script}<\/script>`}
|
|
|
9388
9404
|
${s}
|
|
9389
9405
|
</div>
|
|
9390
9406
|
</div>`;
|
|
9391
|
-
},
|
|
9407
|
+
}, Ty = (e, t, n) => `<div class="between top mt-3">
|
|
9392
9408
|
<div>
|
|
9393
9409
|
<div class="row"><strong>${$(n)}</strong><span class="badge off">No longer declared</span></div>
|
|
9394
9410
|
<p class="hint">${$(t.label)} — this manifest does not declare <code>${$(n)}</code> any more, so the app is not given its token. Disconnect to remove it.</p>
|
|
9395
9411
|
</div>
|
|
9396
9412
|
<form method="post" action="/oauth-disconnect">
|
|
9397
|
-
${
|
|
9413
|
+
${ly(e.current.slug)}
|
|
9398
9414
|
<input type="hidden" name="appInstallId" value="${t.appInstallId}">
|
|
9399
9415
|
<input type="hidden" name="providerId" value="${$(n)}">
|
|
9400
9416
|
<button class="outline sm">Disconnect</button>
|
|
9401
9417
|
</form>
|
|
9402
|
-
</div>`,
|
|
9403
|
-
let i = n.map((n) =>
|
|
9418
|
+
</div>`, Ey = (e, t, n, r) => {
|
|
9419
|
+
let i = n.map((n) => wy(e, t, n, r)), a = Object.keys(t.oauth).filter((e) => !n.some((t) => t.id === e)).map((n) => Ty(e, t, n));
|
|
9404
9420
|
return [...i, ...a].join("");
|
|
9405
|
-
},
|
|
9406
|
-
let r = e.current.manifest.oauth, i = e.current.app.installs.map((t) =>
|
|
9421
|
+
}, Dy = (e, t, n) => {
|
|
9422
|
+
let r = e.current.manifest.oauth, i = e.current.app.installs.map((t) => Ey(e, t, r, n)).join("");
|
|
9407
9423
|
return i === "" ? "" : `<section class="card">
|
|
9408
9424
|
<h2>Connections</h2>
|
|
9409
9425
|
<p class="hint">The real vendor flow, against your own OAuth client. Register <code>${$(t)}</code> as a redirect URI with each vendor — one that will not accept a loopback URI has to be connected against sandbox.</p>
|
|
9410
9426
|
${i}
|
|
9411
9427
|
</section>`;
|
|
9412
|
-
},
|
|
9428
|
+
}, Oy = {
|
|
9413
9429
|
track: "Send events on your behalf",
|
|
9414
9430
|
identify: "Identify visitors",
|
|
9415
9431
|
alias: "Link visitor identities",
|
|
@@ -9417,7 +9433,7 @@ ${e.script === void 0 ? "" : `<script>${e.script}<\/script>`}
|
|
|
9417
9433
|
consentRead: "Read visitor consent",
|
|
9418
9434
|
propertiesRead: "Read event properties",
|
|
9419
9435
|
sessionRead: "Read session data"
|
|
9420
|
-
},
|
|
9436
|
+
}, ky = {
|
|
9421
9437
|
pii: "Personal information (name, email, phone)",
|
|
9422
9438
|
customProperties: "Custom event properties",
|
|
9423
9439
|
consentState: "Consent state",
|
|
@@ -9425,21 +9441,21 @@ ${e.script === void 0 ? "" : `<script>${e.script}<\/script>`}
|
|
|
9425
9441
|
eventContext: "Page URL and referrer",
|
|
9426
9442
|
sharedContext: "Context shared with the other apps on this site",
|
|
9427
9443
|
facts: "Full visitor fact history"
|
|
9428
|
-
},
|
|
9444
|
+
}, Ay = {
|
|
9429
9445
|
public: "No token",
|
|
9430
9446
|
token: "Edge token"
|
|
9431
|
-
},
|
|
9447
|
+
}, jy = {
|
|
9432
9448
|
webhook: "Webhook",
|
|
9433
9449
|
api: "Request/response"
|
|
9434
|
-
},
|
|
9450
|
+
}, My = {
|
|
9435
9451
|
pending: "Pending",
|
|
9436
9452
|
approved: "Approved",
|
|
9437
9453
|
revoked: "Revoked"
|
|
9438
|
-
},
|
|
9454
|
+
}, Ny = {
|
|
9439
9455
|
pending: "off",
|
|
9440
9456
|
approved: "ok",
|
|
9441
9457
|
revoked: "off"
|
|
9442
|
-
},
|
|
9458
|
+
}, Py = (e) => {
|
|
9443
9459
|
let t = e.current.manifest, n = t.description === void 0 ? "" : `<p class="hint">${$(t.description)}</p>`;
|
|
9444
9460
|
return `<section class="card">
|
|
9445
9461
|
<div class="between top">
|
|
@@ -9449,17 +9465,17 @@ ${e.script === void 0 ? "" : `<script>${e.script}<\/script>`}
|
|
|
9449
9465
|
${n}
|
|
9450
9466
|
</div>
|
|
9451
9467
|
<form method="post" action="/app-enabled">
|
|
9452
|
-
${
|
|
9468
|
+
${ly(e.current.slug)}
|
|
9453
9469
|
<input type="hidden" name="enabled" value="${e.current.app.enabled ? "false" : "true"}">
|
|
9454
9470
|
<button class="sm${e.current.app.enabled ? " outline" : ""}">${e.current.app.enabled ? "Disable app" : "Enable app"}</button>
|
|
9455
9471
|
</form>
|
|
9456
9472
|
</div>
|
|
9457
|
-
<div class="row mt-3">${
|
|
9473
|
+
<div class="row mt-3">${sy(t)}<span class="badge">Consent: ${$(t.consent.category)}</span></div>
|
|
9458
9474
|
<div class="row mt-3 meta">
|
|
9459
|
-
<span>Version <code>${
|
|
9475
|
+
<span>Version <code>${Q}</code></span><span class="dim-sm">rebuilt from source on every change</span>
|
|
9460
9476
|
</div>
|
|
9461
9477
|
</section>`;
|
|
9462
|
-
},
|
|
9478
|
+
}, Fy = (e, t) => `<div><h3 class="capability-heading">${e}</h3>${t.length === 0 ? "<p class=\"hint\">None</p>" : `<ul class="capability-list">${t.map((e) => `<li>${$(e)}</li>`).join("")}</ul>`}</div>`, Iy = (e) => {
|
|
9463
9479
|
let t = e.current.manifest;
|
|
9464
9480
|
return `<section class="card">
|
|
9465
9481
|
<h2>About this app</h2>
|
|
@@ -9468,11 +9484,11 @@ ${e.script === void 0 ? "" : `<script>${e.script}<\/script>`}
|
|
|
9468
9484
|
<a class="link" href="${$(t.legal.privacyUrl)}" target="_blank" rel="noreferrer">Privacy policy</a>
|
|
9469
9485
|
</div>
|
|
9470
9486
|
<div class="grid-2 mt-4">
|
|
9471
|
-
${
|
|
9472
|
-
${
|
|
9487
|
+
${Fy("API access", t.capabilities.api.map((e) => Oy[e]))}
|
|
9488
|
+
${Fy("Data access", t.capabilities.data.map((e) => ky[e]))}
|
|
9473
9489
|
</div>
|
|
9474
9490
|
</section>`;
|
|
9475
|
-
},
|
|
9491
|
+
}, Ly = (e) => {
|
|
9476
9492
|
let t = (t, n, r) => `<form method="post" action="/${t}">
|
|
9477
9493
|
<input type="hidden" name="caller" value="${$(e.caller)}">
|
|
9478
9494
|
<input type="hidden" name="provider" value="${$(e.provider)}">
|
|
@@ -9482,20 +9498,20 @@ ${e.script === void 0 ? "" : `<script>${e.script}<\/script>`}
|
|
|
9482
9498
|
<p><strong>${$(e.caller)}</strong> wants to call <strong>${$(e.provider)}</strong>:
|
|
9483
9499
|
<code>${$(e.functions.join(", "))}</code></p>
|
|
9484
9500
|
<div class="endpoint-meta">
|
|
9485
|
-
<span class="badge ${
|
|
9501
|
+
<span class="badge ${Ny[e.status]}">${My[e.status]}</span>
|
|
9486
9502
|
${e.status === "approved" ? "" : t("grant-approve", "Approve", !1)}
|
|
9487
9503
|
${e.status === "revoked" ? "" : t("grant-revoke", "Revoke", !0)}
|
|
9488
9504
|
</div>
|
|
9489
9505
|
</li>`;
|
|
9490
|
-
},
|
|
9491
|
-
let t =
|
|
9506
|
+
}, Ry = (e) => {
|
|
9507
|
+
let t = n_(e.current.slug, e.state.rpcGrants);
|
|
9492
9508
|
return t.length === 0 ? "" : `<section class="card">
|
|
9493
9509
|
<h2>App-to-app approvals</h2>
|
|
9494
9510
|
<p class="hint">An app may call the private functions another app exposes only after a site manager approves the connection. Until then
|
|
9495
9511
|
the broker answers <code>403 forbidden</code>.</p>
|
|
9496
|
-
<ul class="mt-4">${t.map((e) =>
|
|
9512
|
+
<ul class="mt-4">${t.map((e) => Ly(e)).join("")}</ul>
|
|
9497
9513
|
</section>`;
|
|
9498
|
-
},
|
|
9514
|
+
}, zy = (e) => {
|
|
9499
9515
|
let t = e.current.manifest;
|
|
9500
9516
|
return t.endpoints.length === 0 ? "" : `<section class="card">
|
|
9501
9517
|
<h2>Endpoints</h2>
|
|
@@ -9503,11 +9519,11 @@ ${e.script === void 0 ? "" : `<script>${e.script}<\/script>`}
|
|
|
9503
9519
|
<ul class="mt-4">${t.endpoints.map((t) => `<li class="endpoint">
|
|
9504
9520
|
<code>${$(`${e.siteOrigin}/app/${e.current.slug}${t.path}`)}${t.path.includes("/:") ? " (pattern)" : ""}</code>
|
|
9505
9521
|
<div class="endpoint-meta">
|
|
9506
|
-
<span class="badge">${t.methods.join(", ")}</span><span>${
|
|
9522
|
+
<span class="badge">${t.methods.join(", ")}</span><span>${Ay[t.auth]}</span><span>${jy[t.mode]}</span>
|
|
9507
9523
|
</div>
|
|
9508
9524
|
</li>`).join("")}</ul>
|
|
9509
9525
|
</section>`;
|
|
9510
|
-
},
|
|
9526
|
+
}, By = (e) => {
|
|
9511
9527
|
let t = e.current.manifest.server.schedules ?? [];
|
|
9512
9528
|
return t.length === 0 ? "" : `<section class="card">
|
|
9513
9529
|
<h2>Schedules</h2>
|
|
@@ -9518,48 +9534,48 @@ ${e.script === void 0 ? "" : `<script>${e.script}<\/script>`}
|
|
|
9518
9534
|
</div>
|
|
9519
9535
|
${t.description === void 0 ? "" : `<p class="hint">${$(t.description)}</p>`}
|
|
9520
9536
|
<form method="post" action="/schedule-run">
|
|
9521
|
-
${
|
|
9537
|
+
${ly(e.current.slug)}
|
|
9522
9538
|
<input type="hidden" name="scheduleId" value="${$(t.id)}">
|
|
9523
9539
|
<button>Run now</button>
|
|
9524
9540
|
</form>
|
|
9525
9541
|
</li>`).join("")}</ul>
|
|
9526
9542
|
</section>`;
|
|
9527
|
-
},
|
|
9543
|
+
}, Vy = (e) => {
|
|
9528
9544
|
let t = e.current.manifest.resources.filter((e) => e.type === "hyperdrive");
|
|
9529
9545
|
return t.length === 0 ? "" : `<section class="card">
|
|
9530
9546
|
<h2>Hyperdrive</h2>
|
|
9531
9547
|
<p class="hint">The origin in the manifest is the deployed database, so it is never used here. Give each one a local URL.</p>
|
|
9532
9548
|
<div class="rows mt-4">${t.map((t) => `<form method="post" action="/hyperdrive" class="field">
|
|
9533
|
-
${
|
|
9549
|
+
${ly(e.current.slug)}
|
|
9534
9550
|
<input type="hidden" name="identifier" value="${$(t.identifier)}">
|
|
9535
9551
|
<label for="hyperdrive-${$(t.identifier)}">${$(t.binding)}</label>
|
|
9536
9552
|
<input id="hyperdrive-${$(t.identifier)}" name="url" value="${$(e.current.app.hyperdrive[t.identifier] ?? "")}" placeholder="postgres://user:password@localhost:5432/dev">
|
|
9537
9553
|
<button class="outline sm">Save</button>
|
|
9538
9554
|
</form>`).join("")}</div>
|
|
9539
9555
|
</section>`;
|
|
9540
|
-
},
|
|
9556
|
+
}, Hy = (e) => e.current.inert.length === 0 ? "" : `<section class="card">
|
|
9541
9557
|
<h2>Not available locally</h2>
|
|
9542
9558
|
<div class="rows mt-3">${e.current.inert.map((e) => `<p class="notice"><code>${$(e.binding)}</code> — ${$(e.reason)}</p>`).join("")}</div>
|
|
9543
|
-
</section>`,
|
|
9559
|
+
</section>`, Uy = (e) => `<section class="card danger">
|
|
9544
9560
|
<h2>Uninstall this app</h2>
|
|
9545
9561
|
<p class="hint">Removes ${$(e.current.manifest.name)} and all of its installs from ${$(e.state.siteDomain)}.</p>
|
|
9546
|
-
<div class="mt-4"><form method="post" action="/uninstall">${
|
|
9547
|
-
</section>`,
|
|
9548
|
-
${
|
|
9549
|
-
${Ny(e)}
|
|
9550
|
-
${Fy(e)}
|
|
9562
|
+
<div class="mt-4"><form method="post" action="/uninstall">${ly(e.current.slug)}<button class="danger">Uninstall app</button></form></div>
|
|
9563
|
+
</section>`, Wy = (e) => `<div class="stack narrow">
|
|
9564
|
+
${Py(e)}
|
|
9551
9565
|
${Iy(e)}
|
|
9552
|
-
${Ly(e)}
|
|
9553
|
-
${wy(e, `${e.consoleOrigin}${vg}`, Date.now())}
|
|
9554
9566
|
${Ry(e)}
|
|
9555
9567
|
${zy(e)}
|
|
9568
|
+
${By(e)}
|
|
9569
|
+
${Dy(e, `${e.consoleOrigin}${vg}`, Date.now())}
|
|
9570
|
+
${Vy(e)}
|
|
9571
|
+
${Hy(e)}
|
|
9556
9572
|
<section class="rows">
|
|
9557
9573
|
<h2 class="section-title">Installs</h2>
|
|
9558
|
-
${e.current.app.installs.map((t) =>
|
|
9559
|
-
${
|
|
9574
|
+
${e.current.app.installs.map((t) => xy(e, t)).join("")}
|
|
9575
|
+
${Sy(e)}
|
|
9560
9576
|
</section>
|
|
9561
|
-
${
|
|
9562
|
-
</div>`,
|
|
9577
|
+
${Uy(e)}
|
|
9578
|
+
</div>`, Gy = (e) => {
|
|
9563
9579
|
let t = e.current.manifest, n = t.description === void 0 ? "" : `<p class="hint">${$(t.description)}</p>`;
|
|
9564
9580
|
return `<section class="card">
|
|
9565
9581
|
<h2>${$(t.name)}</h2>
|
|
@@ -9567,50 +9583,50 @@ ${By(e)}
|
|
|
9567
9583
|
<code class="slug">${$(e.current.slug)}</code>
|
|
9568
9584
|
<p class="dim-sm mt-3">The slug is permanent and identifies the app to the Qinto CLI.</p>
|
|
9569
9585
|
</section>`;
|
|
9570
|
-
},
|
|
9586
|
+
}, Ky = (e) => {
|
|
9571
9587
|
let t = $(e.state.siteDomain);
|
|
9572
9588
|
return e.current.app.installed ? `<section class="card">
|
|
9573
9589
|
<h2>Install on a site</h2>
|
|
9574
|
-
<p class="hint">Installs version <code>${
|
|
9590
|
+
<p class="hint">Installs version <code>${Q}</code> on <strong>${t}</strong>, the site this local Qinto seeds.</p>
|
|
9575
9591
|
<ul class="installed-sites">
|
|
9576
9592
|
<li>
|
|
9577
9593
|
<span class="strong">${t}</span>
|
|
9578
|
-
<span class="row"><code class="dim">${
|
|
9594
|
+
<span class="row"><code class="dim">${Q}</code><a class="link" href="${Z}/${$(e.current.slug)}">Manage</a></span>
|
|
9579
9595
|
</li>
|
|
9580
9596
|
</ul>
|
|
9581
9597
|
</section>` : `<section class="card">
|
|
9582
9598
|
<h2>Install on a site</h2>
|
|
9583
|
-
<p class="hint">Installs version <code>${
|
|
9584
|
-
<div class="mt-4"><form method="post" action="/install">${
|
|
9599
|
+
<p class="hint">Installs version <code>${Q}</code> on <strong>${t}</strong>, the site this local Qinto seeds.</p>
|
|
9600
|
+
<div class="mt-4"><form method="post" action="/install">${ly(e.current.slug)}<button>Install ${Q}</button></form></div>
|
|
9585
9601
|
</section>`;
|
|
9586
|
-
},
|
|
9602
|
+
}, qy = (e) => {
|
|
9587
9603
|
if (e.helpText === void 0 && e.helpUrl === void 0) return "";
|
|
9588
9604
|
let t = e.helpUrl === void 0 ? "" : ` <a class="link" href="${$(e.helpUrl)}" target="_blank" rel="noreferrer">Learn more</a>`;
|
|
9589
9605
|
return `<span class="field-help">${$(e.helpText ?? "")}${t}</span>`;
|
|
9590
|
-
},
|
|
9606
|
+
}, Jy = (e, t) => {
|
|
9591
9607
|
let n = `appvar-${e.name}`, r = `appvar_${e.name}`, i = $(`${e.label}${e.required === !0 ? " *" : ""}`), a = t.appValues[t.current.slug]?.[e.name];
|
|
9592
9608
|
if (e.kind === "secret") {
|
|
9593
9609
|
let t = a !== void 0;
|
|
9594
9610
|
return `<div class="field">
|
|
9595
9611
|
<div class="row"><label for="${n}">${i}</label><span class="badge ${t ? "ok" : "off"}">${t ? "Set" : "Not set"}</span></div>
|
|
9596
9612
|
<input id="${n}" name="${r}" type="password" autocomplete="off" placeholder="Enter a new value to replace">
|
|
9597
|
-
${
|
|
9613
|
+
${qy(e)}
|
|
9598
9614
|
</div>`;
|
|
9599
9615
|
}
|
|
9600
9616
|
return `<div class="field">
|
|
9601
9617
|
<label for="${n}">${i}</label>
|
|
9602
9618
|
<input id="${n}" name="${r}" type="${e.type === "password" ? "password" : "text"}" value="${$(a ?? "")}">
|
|
9603
|
-
${
|
|
9619
|
+
${qy(e)}
|
|
9604
9620
|
</div>`;
|
|
9605
|
-
},
|
|
9621
|
+
}, Yy = (e) => e.current.manifest.appVariables.length === 0 ? "" : `<section class="card">
|
|
9606
9622
|
<h2>App variables</h2>
|
|
9607
9623
|
<p class="hint">These values are the same for every site that installs this app. On the platform, changing one redeploys every site running it — about five minutes.</p>
|
|
9608
9624
|
<form method="post" action="/app-variables" class="rows mt-4">
|
|
9609
|
-
${
|
|
9610
|
-
${e.current.manifest.appVariables.map((t) =>
|
|
9625
|
+
${ly(e.current.slug)}
|
|
9626
|
+
${e.current.manifest.appVariables.map((t) => Jy(t, e)).join("\n ")}
|
|
9611
9627
|
<div><button>Save app variables</button></div>
|
|
9612
9628
|
</form>
|
|
9613
|
-
</section>`,
|
|
9629
|
+
</section>`, Xy = (e) => `<section class="card">
|
|
9614
9630
|
<h2>App details</h2>
|
|
9615
9631
|
<div class="rows mt-4">
|
|
9616
9632
|
<div class="field">
|
|
@@ -9623,26 +9639,26 @@ ${By(e)}
|
|
|
9623
9639
|
</div>
|
|
9624
9640
|
<p class="dim-sm">Both come from <code>qinto.app.jsonc</code>. Edit the file and this page reloads with the new values.</p>
|
|
9625
9641
|
</div>
|
|
9626
|
-
</section>`,
|
|
9642
|
+
</section>`, Zy = () => `<section class="card">
|
|
9627
9643
|
<h2>Versions</h2>
|
|
9628
9644
|
<table class="mt-4">
|
|
9629
9645
|
<thead><tr><th>Version</th><th>Status</th><th>Built</th></tr></thead>
|
|
9630
9646
|
<tbody>
|
|
9631
9647
|
<tr>
|
|
9632
|
-
<td><code>${
|
|
9648
|
+
<td><code>${Q}</code></td>
|
|
9633
9649
|
<td><span class="badge ok">Ready</span></td>
|
|
9634
9650
|
<td>from source, on every change</td>
|
|
9635
9651
|
</tr>
|
|
9636
9652
|
</tbody>
|
|
9637
9653
|
</table>
|
|
9638
9654
|
<p class="dim-sm mt-3">On the platform <code>qinto app publish</code> allocates a real version; the local loop only ever runs this one.</p>
|
|
9639
|
-
</section>`,
|
|
9640
|
-
${
|
|
9641
|
-
${Uy(e)}
|
|
9655
|
+
</section>`, Qy = (e) => `<div class="stack narrow">
|
|
9656
|
+
${Gy(e)}
|
|
9642
9657
|
${Ky(e)}
|
|
9643
|
-
${
|
|
9644
|
-
${
|
|
9645
|
-
|
|
9658
|
+
${Yy(e)}
|
|
9659
|
+
${Xy(e)}
|
|
9660
|
+
${Zy()}
|
|
9661
|
+
</div>`, $y = (e) => `<section class="card">
|
|
9646
9662
|
<h2>Consent</h2>
|
|
9647
9663
|
<p class="hint">Do you ask visitors for consent on this site, with a cookie banner or a consent platform? If you do, turn consent mode on
|
|
9648
9664
|
and Qinto sends each event only to the apps whose category that visitor allowed. Leave it off and every connected app receives every
|
|
@@ -9657,17 +9673,17 @@ ${Jy()}
|
|
|
9657
9673
|
</label>
|
|
9658
9674
|
<div class="mt-4"><button class="sm">Save</button></div>
|
|
9659
9675
|
</form>
|
|
9660
|
-
</section>`,
|
|
9676
|
+
</section>`, eb = (e) => `<div class="stack">
|
|
9661
9677
|
<p class="lede">Settings the platform stores against the domain. They ride the site worker's bindings, so saving one recomposes the
|
|
9662
9678
|
local workerd stack the same way a redeploy carries them to the edge.</p>
|
|
9663
|
-
${
|
|
9664
|
-
</div>`,
|
|
9665
|
-
title="${$(t)}" sandbox="allow-scripts allow-same-origin allow-forms"></iframe>`,
|
|
9666
|
-
let n = $(e.current.manifest.name), r = `${
|
|
9679
|
+
${$y(e)}
|
|
9680
|
+
</div>`, tb = (e, t) => e.enabled && t.enabled, nb = (e, t) => `<iframe class="panel" src="${$(e.iframeUrl)}"
|
|
9681
|
+
title="${$(t)}" sandbox="allow-scripts allow-same-origin allow-forms"></iframe>`, rb = (e) => e.installs.find((t) => tb(e, t)), ib = (e, t) => {
|
|
9682
|
+
let n = $(e.current.manifest.name), r = `${Z}/${$(e.current.slug)}`, i = rb(e.current.app) === void 0 ? `<div class="card"><p class="hint">${e.current.app.enabled ? `Every install of ${n} is disabled, so there is no panel to open.` : `${n} is disabled on this site, so there is no panel to open.`} Enable one on the <a class="link" href="${r}">app's own page</a>.</p></div>` : nb(t, e.current.manifest.name);
|
|
9667
9683
|
return `<p class="lede">Served from <code>${$(t.origin)}</code> — a different origin to this console, so the panel's
|
|
9668
9684
|
<code>postMessage</code> checks are the ones a deployed panel makes.</p>
|
|
9669
9685
|
${i}`;
|
|
9670
|
-
},
|
|
9686
|
+
}, ab = (e) => `
|
|
9671
9687
|
const ORIGIN = ${JSON.stringify(e.iframeOrigin)}
|
|
9672
9688
|
const TOKEN_PATH = ${JSON.stringify(e.tokenPath)}
|
|
9673
9689
|
const SLUG = ${JSON.stringify(e.slug)}
|
|
@@ -9716,83 +9732,83 @@ window.addEventListener('message', (event) => {
|
|
|
9716
9732
|
connect(message.id, message.installId)
|
|
9717
9733
|
}
|
|
9718
9734
|
})
|
|
9719
|
-
`,
|
|
9735
|
+
`, ob = "dev-user", sb = (e, t) => {
|
|
9720
9736
|
if (!e.startsWith(`${t}/`)) return null;
|
|
9721
9737
|
let n = e.slice(t.length + 1), r = n.indexOf("/"), i = r === -1 ? n : n.slice(0, r);
|
|
9722
9738
|
return i === "" ? null : {
|
|
9723
9739
|
slug: i,
|
|
9724
9740
|
rest: r === -1 ? "" : n.slice(r + 1)
|
|
9725
9741
|
};
|
|
9726
|
-
},
|
|
9742
|
+
}, cb = (e) => `${Z}/${e}/token`, lb = (e, t) => e.find((e) => e.slug === t), ub = (e, t) => e === "/developer/apps" ? {
|
|
9727
9743
|
title: "Apps",
|
|
9728
9744
|
width: "full",
|
|
9729
|
-
body:
|
|
9745
|
+
body: dy(t)
|
|
9730
9746
|
} : e === "/site/apps" ? {
|
|
9731
9747
|
title: "Apps",
|
|
9732
9748
|
width: "full",
|
|
9733
|
-
body:
|
|
9749
|
+
body: py(t)
|
|
9734
9750
|
} : e === "/site/logs" ? {
|
|
9735
9751
|
title: "Real time",
|
|
9736
9752
|
width: "full",
|
|
9737
|
-
body:
|
|
9738
|
-
script:
|
|
9753
|
+
body: gy(t),
|
|
9754
|
+
script: Kv
|
|
9739
9755
|
} : e === "/site/settings/general" ? {
|
|
9740
9756
|
title: "Settings",
|
|
9741
9757
|
width: "form",
|
|
9742
|
-
body:
|
|
9743
|
-
} : null,
|
|
9744
|
-
let n =
|
|
9758
|
+
body: eb(t)
|
|
9759
|
+
} : null, db = (e, t) => {
|
|
9760
|
+
let n = sb(e, Gg);
|
|
9745
9761
|
if (n !== null && n.rest === "") {
|
|
9746
|
-
let e =
|
|
9762
|
+
let e = lb(t.apps, n.slug);
|
|
9747
9763
|
return e === void 0 ? null : {
|
|
9748
9764
|
title: "App details",
|
|
9749
9765
|
width: "form",
|
|
9750
|
-
body:
|
|
9766
|
+
body: Qy({
|
|
9751
9767
|
...t,
|
|
9752
9768
|
current: e
|
|
9753
9769
|
})
|
|
9754
9770
|
};
|
|
9755
9771
|
}
|
|
9756
|
-
let r =
|
|
9772
|
+
let r = sb(e, Z);
|
|
9757
9773
|
if (r !== null) {
|
|
9758
|
-
let e =
|
|
9774
|
+
let e = lb(t.apps, r.slug);
|
|
9759
9775
|
return e === void 0 || !e.app.installed ? null : r.rest === "" ? {
|
|
9760
9776
|
title: "App details",
|
|
9761
9777
|
width: "form",
|
|
9762
|
-
body:
|
|
9778
|
+
body: Wy({
|
|
9763
9779
|
...t,
|
|
9764
9780
|
current: e
|
|
9765
9781
|
})
|
|
9766
9782
|
} : r.rest === "ui" && e.appUi !== null ? {
|
|
9767
9783
|
title: e.manifest.name,
|
|
9768
9784
|
width: "fill",
|
|
9769
|
-
body:
|
|
9785
|
+
body: ib({
|
|
9770
9786
|
...t,
|
|
9771
9787
|
current: e
|
|
9772
9788
|
}, e.appUi),
|
|
9773
|
-
script:
|
|
9789
|
+
script: ab({
|
|
9774
9790
|
iframeOrigin: e.appUi.origin,
|
|
9775
|
-
tokenPath:
|
|
9791
|
+
tokenPath: cb(e.slug),
|
|
9776
9792
|
slug: e.slug
|
|
9777
9793
|
})
|
|
9778
9794
|
} : null;
|
|
9779
9795
|
}
|
|
9780
|
-
return
|
|
9781
|
-
},
|
|
9782
|
-
let i =
|
|
9796
|
+
return ub(e, t);
|
|
9797
|
+
}, fb = async (e, t, n, r) => {
|
|
9798
|
+
let i = lb(t.apps, n);
|
|
9783
9799
|
if (i === void 0 || !i.app.installed || i.appUi === null) return null;
|
|
9784
|
-
let a =
|
|
9800
|
+
let a = rb(i.app);
|
|
9785
9801
|
return a === void 0 ? null : {
|
|
9786
9802
|
token: await Bh({
|
|
9787
9803
|
kid: e.keys.appUiKeyId,
|
|
9788
9804
|
key: e.keys.appUiKey,
|
|
9789
9805
|
now: /* @__PURE__ */ new Date(),
|
|
9790
9806
|
slug: i.slug,
|
|
9791
|
-
userId:
|
|
9807
|
+
userId: ob,
|
|
9792
9808
|
domainId: t.state.domainId,
|
|
9793
9809
|
appId: i.app.appId,
|
|
9794
9810
|
appInstallId: a.appInstallId,
|
|
9795
|
-
appVersionId:
|
|
9811
|
+
appVersionId: Q,
|
|
9796
9812
|
access: "write"
|
|
9797
9813
|
}),
|
|
9798
9814
|
context: {
|
|
@@ -9801,7 +9817,7 @@ window.addEventListener('message', (event) => {
|
|
|
9801
9817
|
siteOrigin: e.origin,
|
|
9802
9818
|
platformApiOrigin: r,
|
|
9803
9819
|
appSlug: i.slug,
|
|
9804
|
-
appVersion:
|
|
9820
|
+
appVersion: Q,
|
|
9805
9821
|
appInstallId: a.appInstallId,
|
|
9806
9822
|
installs: i.app.installs.map((e) => ({
|
|
9807
9823
|
id: e.appInstallId,
|
|
@@ -9812,18 +9828,18 @@ window.addEventListener('message', (event) => {
|
|
|
9812
9828
|
theme: "light"
|
|
9813
9829
|
}
|
|
9814
9830
|
};
|
|
9815
|
-
},
|
|
9831
|
+
}, pb = (e, t, n) => new Promise((r, i) => {
|
|
9816
9832
|
e.once("error", i), e.listen(n, t, () => {
|
|
9817
9833
|
e.off("error", i), r();
|
|
9818
9834
|
});
|
|
9819
|
-
}),
|
|
9835
|
+
}), mb = /* @__PURE__ */ new Set([
|
|
9820
9836
|
"127.0.0.1",
|
|
9821
9837
|
"localhost",
|
|
9822
9838
|
"[::1]"
|
|
9823
|
-
]),
|
|
9839
|
+
]), hb = (e, t) => {
|
|
9824
9840
|
let n = e === void 0 ? null : URL.parse(e.includes("//") ? e : `http://${e}`);
|
|
9825
|
-
return n !== null &&
|
|
9826
|
-
},
|
|
9841
|
+
return n !== null && mb.has(n.hostname) && n.port === String(t);
|
|
9842
|
+
}, gb = async (e) => {
|
|
9827
9843
|
let t = e.port, n = () => `http://${e.host}:${t}`, r = () => ({
|
|
9828
9844
|
apps: e.stack.apps(),
|
|
9829
9845
|
state: e.stack.state(),
|
|
@@ -9832,14 +9848,14 @@ window.addEventListener('message', (event) => {
|
|
|
9832
9848
|
siteOrigin: e.stack.origin,
|
|
9833
9849
|
demoOrigin: e.demoOrigin(),
|
|
9834
9850
|
consoleOrigin: n()
|
|
9835
|
-
}), i =
|
|
9836
|
-
let n = r(), i =
|
|
9837
|
-
return i === null ? null :
|
|
9851
|
+
}), i = Xg(e.stack, n), a = Gv(e.stack), o = (t) => {
|
|
9852
|
+
let n = r(), i = db(t, n);
|
|
9853
|
+
return i === null ? null : ay({
|
|
9838
9854
|
title: i.title,
|
|
9839
9855
|
path: t,
|
|
9840
9856
|
width: i.width,
|
|
9841
9857
|
platformVersion: e.stack.platformVersion,
|
|
9842
|
-
...
|
|
9858
|
+
...Yg({
|
|
9843
9859
|
apps: n.apps,
|
|
9844
9860
|
state: n.state,
|
|
9845
9861
|
path: t
|
|
@@ -9858,7 +9874,7 @@ window.addEventListener('message', (event) => {
|
|
|
9858
9874
|
s.delete(e), n();
|
|
9859
9875
|
});
|
|
9860
9876
|
}, l = /* @__PURE__ */ new Set(), u = async (t, i) => {
|
|
9861
|
-
let a = await
|
|
9877
|
+
let a = await fb(e.stack, r(), t, n());
|
|
9862
9878
|
if (a === null) {
|
|
9863
9879
|
i.writeHead(409, { "content-type": "text/plain" }).end("no active install to open the panel for");
|
|
9864
9880
|
return;
|
|
@@ -9869,7 +9885,7 @@ window.addEventListener('message', (event) => {
|
|
|
9869
9885
|
}).end(JSON.stringify(a));
|
|
9870
9886
|
}, d = async (t, n) => {
|
|
9871
9887
|
if (t === "/") {
|
|
9872
|
-
n.writeHead(303, { location:
|
|
9888
|
+
n.writeHead(303, { location: Z }).end();
|
|
9873
9889
|
return;
|
|
9874
9890
|
}
|
|
9875
9891
|
if (t === "/site/logs/stream") {
|
|
@@ -9884,7 +9900,7 @@ window.addEventListener('message', (event) => {
|
|
|
9884
9900
|
}));
|
|
9885
9901
|
return;
|
|
9886
9902
|
}
|
|
9887
|
-
let r =
|
|
9903
|
+
let r = sb(t, Z);
|
|
9888
9904
|
if (r !== null && r.rest === "token") {
|
|
9889
9905
|
await u(r.slug, n);
|
|
9890
9906
|
return;
|
|
@@ -9899,7 +9915,7 @@ window.addEventListener('message', (event) => {
|
|
|
9899
9915
|
"cache-control": "no-store"
|
|
9900
9916
|
}), n.end(i);
|
|
9901
9917
|
}, f = async (t) => {
|
|
9902
|
-
let n = await
|
|
9918
|
+
let n = await Wg(t), r = t.url.slice(1), a = {
|
|
9903
9919
|
action: r,
|
|
9904
9920
|
slug: n.slug ?? "",
|
|
9905
9921
|
provider: n.provider ?? ""
|
|
@@ -9914,8 +9930,8 @@ window.addEventListener('message', (event) => {
|
|
|
9914
9930
|
appValues: e.stack.appValues()
|
|
9915
9931
|
});
|
|
9916
9932
|
return await e.stack.apply(o), (r === "uninstall" || r === "install-remove") && i.discard(a.slug), a;
|
|
9917
|
-
}, p = (t) => t.action === "consent" ?
|
|
9918
|
-
let i = t.headers.authorization, a = await
|
|
9933
|
+
}, p = (t) => t.action === "consent" ? qg : t.action === "app-variables" ? `${Gg}/${t.slug}` : t.action === "grant-approve" || t.action === "grant-revoke" ? `${Z}/${t.provider}` : e.stack.state().apps[t.slug]?.installed === !0 ? `${Z}/${t.slug}` : Z, m = async (t, n, r) => {
|
|
9934
|
+
let i = t.headers.authorization, a = await Ug(t), o;
|
|
9919
9935
|
try {
|
|
9920
9936
|
o = JSON.parse(a);
|
|
9921
9937
|
} catch {
|
|
@@ -9950,21 +9966,21 @@ window.addEventListener('message', (event) => {
|
|
|
9950
9966
|
await m(n, r, a);
|
|
9951
9967
|
return;
|
|
9952
9968
|
}
|
|
9953
|
-
if (!
|
|
9969
|
+
if (!hb(n.headers.origin, t)) {
|
|
9954
9970
|
r.writeHead(403, { "content-type": "text/plain" }).end("cross-origin form posts are refused");
|
|
9955
9971
|
return;
|
|
9956
9972
|
}
|
|
9957
9973
|
if (e.pathname === "/oauth-connect") {
|
|
9958
|
-
await i.start(await
|
|
9974
|
+
await i.start(await Wg(n), r);
|
|
9959
9975
|
return;
|
|
9960
9976
|
}
|
|
9961
9977
|
r.writeHead(303, { location: p(await f(n)) }).end();
|
|
9962
9978
|
}, _ = async (e, r) => {
|
|
9963
|
-
if (!
|
|
9979
|
+
if (!hb(e.headers.host, t)) {
|
|
9964
9980
|
r.writeHead(403, { "content-type": "text/plain" }).end("this console answers loopback only");
|
|
9965
9981
|
return;
|
|
9966
9982
|
}
|
|
9967
|
-
let o = new URL(e.url, n()), s =
|
|
9983
|
+
let o = new URL(e.url, n()), s = Wv(o.pathname);
|
|
9968
9984
|
if (s !== null) {
|
|
9969
9985
|
await a.handle(e, r, s);
|
|
9970
9986
|
return;
|
|
@@ -9983,7 +9999,7 @@ window.addEventListener('message', (event) => {
|
|
|
9983
9999
|
t.writeHead(500, { "content-type": "text/plain" }).end(e instanceof Error ? e.message : String(e));
|
|
9984
10000
|
});
|
|
9985
10001
|
});
|
|
9986
|
-
return await
|
|
10002
|
+
return await pb(v, e.host, e.port), t = v.address().port, {
|
|
9987
10003
|
origin: n,
|
|
9988
10004
|
reload: () => {
|
|
9989
10005
|
for (let e of l) e.write("event: reload\ndata: {}\n\n");
|
|
@@ -9995,7 +10011,7 @@ window.addEventListener('message', (event) => {
|
|
|
9995
10011
|
});
|
|
9996
10012
|
})
|
|
9997
10013
|
};
|
|
9998
|
-
},
|
|
10014
|
+
}, _b = (e) => [...new Set(e.map((e) => e.consentCategory))], vb = {
|
|
9999
10015
|
id: "123123123",
|
|
10000
10016
|
quantity: 1,
|
|
10001
10017
|
value: 10.5,
|
|
@@ -10003,7 +10019,7 @@ window.addEventListener('message', (event) => {
|
|
|
10003
10019
|
category: "bracelets",
|
|
10004
10020
|
image: "https://mysite.com/product/fun-main.jpg",
|
|
10005
10021
|
url: "https://mysite.com/summer-fun"
|
|
10006
|
-
},
|
|
10022
|
+
}, yb = [vb, {
|
|
10007
10023
|
id: "4423434343",
|
|
10008
10024
|
quantity: 2,
|
|
10009
10025
|
value: 5,
|
|
@@ -10011,40 +10027,40 @@ window.addEventListener('message', (event) => {
|
|
|
10011
10027
|
category: "shorts",
|
|
10012
10028
|
image: "https://mysite.com/product/shorts-main.jpg",
|
|
10013
10029
|
url: "https://mysite.com/summer-shorts"
|
|
10014
|
-
}],
|
|
10030
|
+
}], bb = "http://www.example.com/path/to/checkout", xb = {
|
|
10015
10031
|
PageView: {},
|
|
10016
10032
|
ViewContent: {
|
|
10017
10033
|
currency: "USD",
|
|
10018
10034
|
value: 10.5,
|
|
10019
|
-
contents: [
|
|
10035
|
+
contents: [vb]
|
|
10020
10036
|
},
|
|
10021
10037
|
AddToCart: {
|
|
10022
10038
|
currency: "USD",
|
|
10023
10039
|
value: 10.5,
|
|
10024
|
-
checkoutUrl:
|
|
10025
|
-
contents: [
|
|
10040
|
+
checkoutUrl: bb,
|
|
10041
|
+
contents: [vb]
|
|
10026
10042
|
},
|
|
10027
10043
|
RemoveFromCart: {
|
|
10028
10044
|
currency: "USD",
|
|
10029
10045
|
value: 10.5,
|
|
10030
|
-
checkoutUrl:
|
|
10031
|
-
contents: [
|
|
10046
|
+
checkoutUrl: bb,
|
|
10047
|
+
contents: [vb]
|
|
10032
10048
|
},
|
|
10033
10049
|
InitiateCheckout: {
|
|
10034
10050
|
currency: "USD",
|
|
10035
10051
|
value: 20.5,
|
|
10036
|
-
checkoutUrl:
|
|
10037
|
-
contents:
|
|
10052
|
+
checkoutUrl: bb,
|
|
10053
|
+
contents: yb
|
|
10038
10054
|
},
|
|
10039
10055
|
AddShippingInfo: {
|
|
10040
10056
|
currency: "USD",
|
|
10041
10057
|
value: 20.5,
|
|
10042
|
-
contents:
|
|
10058
|
+
contents: yb
|
|
10043
10059
|
},
|
|
10044
10060
|
AddPaymentInfo: {
|
|
10045
10061
|
currency: "USD",
|
|
10046
10062
|
value: 20.5,
|
|
10047
|
-
contents:
|
|
10063
|
+
contents: yb
|
|
10048
10064
|
},
|
|
10049
10065
|
Purchase: {
|
|
10050
10066
|
currency: "USD",
|
|
@@ -10059,7 +10075,7 @@ window.addEventListener('message', (event) => {
|
|
|
10059
10075
|
value: "150",
|
|
10060
10076
|
type: "FLAT"
|
|
10061
10077
|
}],
|
|
10062
|
-
contents:
|
|
10078
|
+
contents: yb
|
|
10063
10079
|
},
|
|
10064
10080
|
Subscribe: {
|
|
10065
10081
|
sourceId: "Email",
|
|
@@ -10070,7 +10086,7 @@ window.addEventListener('message', (event) => {
|
|
|
10070
10086
|
currency: "USD",
|
|
10071
10087
|
value: 10.5,
|
|
10072
10088
|
search: "summer",
|
|
10073
|
-
contents: [
|
|
10089
|
+
contents: [vb]
|
|
10074
10090
|
},
|
|
10075
10091
|
Lead: {
|
|
10076
10092
|
category: "offers",
|
|
@@ -10078,19 +10094,19 @@ window.addEventListener('message', (event) => {
|
|
|
10078
10094
|
currency: "USD",
|
|
10079
10095
|
value: 49.99
|
|
10080
10096
|
}
|
|
10081
|
-
},
|
|
10082
|
-
let t =
|
|
10097
|
+
}, Sb = "\n*, ::before, ::after { box-sizing: border-box; border: 0 solid; margin: 0; padding: 0 }\nhtml { font-family: var(--font-sans); line-height: 1.5; -webkit-text-size-adjust: 100%; color-scheme: light }\nh1, h2 { font-size: inherit; font-weight: inherit }\ncode, pre { font-family: var(--font-mono); font-size: 1em }\nbutton, input, textarea { font: inherit; color: inherit; background: transparent; letter-spacing: inherit }\nbutton:not(:disabled) { cursor: pointer }\n::placeholder { color: var(--muted-foreground) }\n\nbody { background: var(--color-cream-50); color: var(--color-gray-900) }\nheader { display: flex; align-items: center; gap: .75rem; min-height: 73px; padding: .75rem 1.5rem;\n border-bottom: 1px solid var(--line); background: var(--color-white) }\n.mark { display: flex; height: 2.25rem; width: 2.25rem; flex-shrink: 0; align-items: center; justify-content: center;\n border-radius: var(--radius-lg); background: var(--color-brand-50); color: var(--color-brand-600) }\n.titles { min-width: 0; flex: 1 }\nh1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.125rem; line-height: 1.75rem;\n font-weight: 600; color: var(--color-gray-900) }\n.status { display: flex; align-items: center; gap: .375rem; font-size: .75rem; line-height: 1rem; color: var(--color-gray-500) }\n.dot { height: .375rem; width: .375rem; flex-shrink: 0; border-radius: 9999px; background: var(--color-gray-400) }\n.dot.on { background: var(--color-green-500) }\n.dot.off { background: var(--color-red-500) }\n.head-meta { display: flex; flex-shrink: 0; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem }\n.badge { border-radius: 9999px; background: var(--color-cream-100); padding: .125rem .5rem; font-size: .75rem;\n line-height: 1rem; font-weight: 500; color: var(--color-gray-600) }\n.head-meta code { font-size: .75rem; line-height: 1rem; color: var(--color-gray-500) }\n\nmain { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 1.5rem;\n margin: 0 auto; max-width: 80rem; padding: 1.5rem }\n.column > * + * { margin-top: 1.5rem }\nsection { border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--color-white); padding: 1.5rem }\nh2 { font-size: .875rem; line-height: 1.25rem; font-weight: 600; color: var(--color-gray-900) }\n.note { margin-top: .25rem; font-size: .875rem; line-height: 1.25rem; color: var(--color-gray-500) }\n.note code { color: var(--color-gray-700) }\n\n.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem }\nbutton { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; white-space: nowrap;\n height: 2rem; padding: .375rem 1rem; border-radius: var(--radius-md); font-size: .875rem; line-height: 1.25rem;\n font-weight: 500; background: var(--primary); color: var(--primary-foreground); transition: all .15s }\nbutton:hover { background: color-mix(in oklab, var(--primary) 90%, transparent) }\nbutton.outline { border: 1px solid var(--border); background: var(--background); color: var(--foreground);\n box-shadow: 0 1px 2px 0 rgb(0 0 0 / .05) }\nbutton.outline:hover { background: var(--accent); color: var(--accent-foreground) }\n\n.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem }\n.field { margin-top: 1rem }\nlabel { display: block; font-size: .875rem; line-height: 1; font-weight: 500; color: var(--color-gray-900) }\ninput, textarea { display: block; width: 100%; margin-top: .375rem; border: 1px solid var(--input);\n border-radius: var(--radius-md); padding: .375rem .75rem; font-size: .875rem; line-height: 1.5rem;\n box-shadow: 0 1px 2px 0 rgb(0 0 0 / .05); transition: color .15s, box-shadow .15s }\ninput:focus-visible, textarea:focus-visible { outline: none; border-color: var(--ring);\n box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent) }\ntextarea { font-family: var(--font-mono); font-size: .8125rem; min-height: 4.5rem; resize: vertical }\n\n.rows { margin-top: 1rem }\n.row { display: flex; align-items: baseline; gap: .75rem; border-top: 1px solid var(--line-soft); padding: .5rem 0;\n font-size: .875rem; line-height: 1.25rem; color: var(--color-gray-700) }\n.row:first-child { border-top: 0; padding-top: 0 }\n.k { min-width: 5rem; flex-shrink: 0; font-size: .75rem; line-height: 1rem; color: var(--color-gray-500) }\n.v { min-width: 0; word-break: break-word }\npre { margin-top: 1rem; max-height: 22rem; overflow: auto; border: 1px solid var(--line-dashed);\n border-radius: var(--radius-lg); background: var(--color-cream-50); padding: .75rem 1rem; font-size: .75rem;\n line-height: 1.5; color: var(--color-gray-700); white-space: pre-wrap; word-break: break-word }\n\n@media (max-width: 60rem) {\n header { flex-wrap: wrap }\n main, .fields { grid-template-columns: minmax(0, 1fr) }\n}", Cb = (e) => {
|
|
10098
|
+
let t = _b(e.apps), n = e.apps.map((e) => e.name).join(", ");
|
|
10083
10099
|
return `<!doctype html>
|
|
10084
10100
|
<html lang="en">
|
|
10085
10101
|
<head>
|
|
10086
10102
|
<meta charset="utf-8">
|
|
10087
10103
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
10088
10104
|
<title>${n} — demo site</title>
|
|
10089
|
-
<style>${
|
|
10105
|
+
<style>${Zv}${Sb}</style>
|
|
10090
10106
|
</head>
|
|
10091
10107
|
<body>
|
|
10092
10108
|
<header>
|
|
10093
|
-
<span class="mark">${
|
|
10109
|
+
<span class="mark">${Yv("globe", 18)}</span>
|
|
10094
10110
|
<div class="titles">
|
|
10095
10111
|
<h1>${n} — demo site</h1>
|
|
10096
10112
|
<p class="status"><span class="dot" id="status-dot"></span><span id="status">loading q.js</span></p>
|
|
@@ -10151,7 +10167,7 @@ ${t.map((e) => ` <button data-grant="${e}">Grant ${e}</button>
|
|
|
10151
10167
|
that also record it as a conversion. See <code>docs/standard-events.md</code>.
|
|
10152
10168
|
</p>
|
|
10153
10169
|
<div class="actions">
|
|
10154
|
-
${Object.keys(
|
|
10170
|
+
${Object.keys(xb).map((e) => ` <button class="outline" data-std="${e}">${e}</button>`).join("\n")}
|
|
10155
10171
|
</div>
|
|
10156
10172
|
<div class="field"><label>Event name <input id="event-name" value="PageView"></label></div>
|
|
10157
10173
|
<div class="field"><label>Properties <textarea id="event-props">{}</textarea></label></div>
|
|
@@ -10173,7 +10189,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10173
10189
|
(() => {
|
|
10174
10190
|
const SITE = ${JSON.stringify(e.siteOrigin)}
|
|
10175
10191
|
const SLUGS = ${JSON.stringify(e.apps.map((e) => e.slug))}
|
|
10176
|
-
const STANDARD_EVENTS = ${JSON.stringify(
|
|
10192
|
+
const STANDARD_EVENTS = ${JSON.stringify(xb)}
|
|
10177
10193
|
const logEl = document.getElementById('log')
|
|
10178
10194
|
const appsEl = document.getElementById('apps')
|
|
10179
10195
|
const statusEl = document.getElementById('status')
|
|
@@ -10364,11 +10380,11 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10364
10380
|
</body>
|
|
10365
10381
|
</html>
|
|
10366
10382
|
`;
|
|
10367
|
-
},
|
|
10383
|
+
}, wb = (e, t, n) => new Promise((r, i) => {
|
|
10368
10384
|
e.once("error", i), e.listen(n, t, () => {
|
|
10369
10385
|
e.off("error", i), r();
|
|
10370
10386
|
});
|
|
10371
|
-
}),
|
|
10387
|
+
}), Tb = async (e) => {
|
|
10372
10388
|
let t = we((t, n) => {
|
|
10373
10389
|
if (t.method !== "GET" && t.method !== "HEAD") {
|
|
10374
10390
|
n.writeHead(405, { allow: "GET, HEAD" }).end();
|
|
@@ -10377,12 +10393,12 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10377
10393
|
n.writeHead(200, {
|
|
10378
10394
|
"content-type": "text/html; charset=utf-8",
|
|
10379
10395
|
"cache-control": "no-store"
|
|
10380
|
-
}), n.end(t.method === "HEAD" ? void 0 :
|
|
10396
|
+
}), n.end(t.method === "HEAD" ? void 0 : Cb({
|
|
10381
10397
|
siteOrigin: e.siteOrigin,
|
|
10382
10398
|
apps: e.page()
|
|
10383
10399
|
}));
|
|
10384
10400
|
});
|
|
10385
|
-
await
|
|
10401
|
+
await wb(t, e.host, e.port);
|
|
10386
10402
|
let n = t.address().port;
|
|
10387
10403
|
return {
|
|
10388
10404
|
origin: () => `http://${e.host}:${n}`,
|
|
@@ -10392,23 +10408,23 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10392
10408
|
});
|
|
10393
10409
|
})
|
|
10394
10410
|
};
|
|
10395
|
-
},
|
|
10411
|
+
}, Eb = /* @__PURE__ */ new Set([
|
|
10396
10412
|
"node_modules",
|
|
10397
10413
|
".git",
|
|
10398
10414
|
".astro",
|
|
10399
10415
|
".wrangler",
|
|
10400
10416
|
".qinto"
|
|
10401
|
-
]),
|
|
10402
|
-
let n =
|
|
10403
|
-
return !n.split("/").some((e) =>
|
|
10404
|
-
let t =
|
|
10417
|
+
]), Db = (e) => e.split(d).join("/"), Ob = (e, t) => {
|
|
10418
|
+
let n = Db(e);
|
|
10419
|
+
return !n.split("/").some((e) => Eb.has(e)) && !t.some((e) => {
|
|
10420
|
+
let t = Db(e);
|
|
10405
10421
|
return n === t || n.startsWith(`${t}/`);
|
|
10406
10422
|
});
|
|
10407
|
-
},
|
|
10423
|
+
}, kb = (e, t, n) => {
|
|
10408
10424
|
if (t === null) return !1;
|
|
10409
10425
|
let r = t.toString();
|
|
10410
|
-
return r !== a(e) &&
|
|
10411
|
-
},
|
|
10426
|
+
return r !== a(e) && Ob(r, n);
|
|
10427
|
+
}, Ab = (e) => {
|
|
10412
10428
|
let t = null, n = !1, r = !1, i = !1, a = async () => {
|
|
10413
10429
|
n = !0;
|
|
10414
10430
|
try {
|
|
@@ -10435,56 +10451,56 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10435
10451
|
i = !0, t !== null && (clearTimeout(t), t = null);
|
|
10436
10452
|
}
|
|
10437
10453
|
};
|
|
10438
|
-
},
|
|
10454
|
+
}, jb = (e) => {
|
|
10439
10455
|
let t = x(e.dir, { recursive: !0 }, (t, n) => {
|
|
10440
|
-
|
|
10456
|
+
kb(e.dir, n, e.ignore) && e.onChange();
|
|
10441
10457
|
});
|
|
10442
10458
|
return { stop: () => {
|
|
10443
10459
|
t.close();
|
|
10444
10460
|
} };
|
|
10445
|
-
},
|
|
10461
|
+
}, Mb = (e) => {
|
|
10446
10462
|
try {
|
|
10447
10463
|
let t = b(e, { withFileTypes: !0 });
|
|
10448
10464
|
return new Set(t.filter((e) => e.isDirectory()).map((e) => e.name));
|
|
10449
10465
|
} catch {
|
|
10450
10466
|
return null;
|
|
10451
10467
|
}
|
|
10452
|
-
},
|
|
10453
|
-
let t =
|
|
10454
|
-
let n =
|
|
10455
|
-
n === null || t === null ||
|
|
10468
|
+
}, Nb = (e, t) => e.size === t.size && [...e].every((e) => t.has(e)), Pb = (e) => {
|
|
10469
|
+
let t = Mb(e.dir), n = setInterval(() => {
|
|
10470
|
+
let n = Mb(e.dir);
|
|
10471
|
+
n === null || t === null || Nb(n, t) || (t = n, e.onChange());
|
|
10456
10472
|
}, e.intervalMs);
|
|
10457
10473
|
return n.unref(), { stop: () => {
|
|
10458
10474
|
clearInterval(n);
|
|
10459
10475
|
} };
|
|
10460
|
-
},
|
|
10461
|
-
for (let e of
|
|
10476
|
+
}, Fb = ["./worker-artifact", "../../../../../portal/services/worker-artifact"], Ib = () => {
|
|
10477
|
+
for (let e of Fb) {
|
|
10462
10478
|
let t = _e(new URL(e, import.meta.url));
|
|
10463
10479
|
if (y(s(t, "version.json"))) return t;
|
|
10464
10480
|
}
|
|
10465
10481
|
throw new T("This build of the Qinto CLI ships no platform bundles, so `qinto app dev` cannot start.");
|
|
10466
|
-
},
|
|
10482
|
+
}, Lb = async (e) => ce(s(e, jp)).then(() => !0, () => !1), Rb = async (e) => (await fe(e, { withFileTypes: !0 }).catch(() => {
|
|
10467
10483
|
throw new E(`${e} cannot be read.`);
|
|
10468
|
-
})).filter((e) => e.isDirectory() && !e.name.startsWith(".")).map((t) => s(e, t.name)),
|
|
10484
|
+
})).filter((e) => e.isDirectory() && !e.name.startsWith(".")).map((t) => s(e, t.name)), zb = (e) => {
|
|
10469
10485
|
let t = /* @__PURE__ */ new Map();
|
|
10470
10486
|
for (let n of e) {
|
|
10471
10487
|
let e = t.get(n.manifest.slug);
|
|
10472
10488
|
if (e !== void 0) throw new E(`${e} and ${n.dir} both declare the slug ${n.manifest.slug}.`);
|
|
10473
10489
|
t.set(n.manifest.slug, n.dir);
|
|
10474
10490
|
}
|
|
10475
|
-
},
|
|
10476
|
-
if (await
|
|
10491
|
+
}, Bb = async (e) => {
|
|
10492
|
+
if (await Lb(e)) return [{
|
|
10477
10493
|
dir: e,
|
|
10478
10494
|
manifest: (await Mp(e)).manifest
|
|
10479
10495
|
}];
|
|
10480
10496
|
let t = [];
|
|
10481
|
-
for (let n of await
|
|
10497
|
+
for (let n of await Rb(e)) await Lb(n) && t.push({
|
|
10482
10498
|
dir: n,
|
|
10483
10499
|
manifest: (await Mp(n)).manifest
|
|
10484
10500
|
});
|
|
10485
10501
|
if (t.length === 0) throw new E(`No ${jp} in ${e} or any folder directly inside it. Run \`qinto app create\` first, or point the command at an app directory.`);
|
|
10486
|
-
return
|
|
10487
|
-
},
|
|
10502
|
+
return zb(t), t.sort((e, t) => e.manifest.slug.localeCompare(t.manifest.slug));
|
|
10503
|
+
}, Vb = async (e, t) => {
|
|
10488
10504
|
let n = e.map((e) => e.manifest.slug);
|
|
10489
10505
|
if (t.requested !== void 0) {
|
|
10490
10506
|
let e = t.requested.split(",").map((e) => e.trim()).filter((e) => e !== ""), r = e.filter((e) => !n.includes(e));
|
|
@@ -10492,29 +10508,29 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10492
10508
|
return e;
|
|
10493
10509
|
}
|
|
10494
10510
|
return n.length === 1 || t.machine ? n : t.checkbox(n);
|
|
10495
|
-
},
|
|
10496
|
-
let n = await
|
|
10511
|
+
}, Hb = async (e, t) => {
|
|
10512
|
+
let n = await Vb(e, t);
|
|
10497
10513
|
if (n.length === 0) throw new E("No app was selected, so there is nothing to run.");
|
|
10498
10514
|
if (n.length > 50) throw new E(`A site takes at most 50 apps, and ${n.length} were selected.`);
|
|
10499
10515
|
return e.filter((e) => n.includes(e.manifest.slug));
|
|
10500
|
-
},
|
|
10516
|
+
}, Ub = "4310", Wb = "4301", Gb = "4300", Kb = "4302", qb = (e, t) => {
|
|
10501
10517
|
let n = Number(t);
|
|
10502
10518
|
if (!Number.isInteger(n) || n < 0 || n > 65535) throw new E(`Pass a port between 0 and 65535 to ${e}.`);
|
|
10503
10519
|
return n;
|
|
10504
|
-
},
|
|
10520
|
+
}, Jb = (e, t) => {
|
|
10505
10521
|
let n = e.state().apps[t], r = e.apps().find((e) => e.slug === t)?.manifest;
|
|
10506
10522
|
if (n === void 0 || r === void 0 || !n.installed) return "not installed on the seeded site";
|
|
10507
10523
|
let i = [...new Set(n.installs.flatMap((t) => Im(r, t, e.secrets())))];
|
|
10508
10524
|
return i.length > 0 ? `installed, but no install is active until you set ${i.join(", ")} in the console` : "installed and active on the seeded site";
|
|
10509
|
-
},
|
|
10525
|
+
}, Yb = (e, t, n) => {
|
|
10510
10526
|
let r = e.apps();
|
|
10511
10527
|
e.discardedRoot && n.stderr("\n ! Local state was written by an older `qinto app dev` — discarded and reseeded.\n"), n.stdout(`\n ${r.length} app${r.length === 1 ? "" : "s"} — local Qinto on platform ${e.platformVersion}\n\n`), n.stdout(` Console ${t.console}\n`), n.stdout(` Demo site ${t.demo}\n`), n.stdout(` Site worker ${e.origin}\n`), n.stdout(` Dev state ${e.paths.root}\n`), n.stdout(` Site token ${e.keys.workerAccessToken}\n\n`);
|
|
10512
10528
|
for (let t of r) {
|
|
10513
|
-
n.stdout(` ${t.manifest.name} (${t.slug}) — ${
|
|
10529
|
+
n.stdout(` ${t.manifest.name} (${t.slug}) — ${Jb(e, t.slug)}\n`), t.appUi !== null && n.stdout(` panel ${t.appUi.origin}${t.appUi.basePath}\n`);
|
|
10514
10530
|
for (let e of t.inert) n.stderr(` ! ${e.binding} is not bound locally — ${e.reason}\n`);
|
|
10515
10531
|
}
|
|
10516
10532
|
n.stdout("\n Watching for changes — a saved file rebuilds that app and reloads the console.\n\n");
|
|
10517
|
-
},
|
|
10533
|
+
}, Xb = 120, Zb = 2e3, Qb = (e, t) => {
|
|
10518
10534
|
if (e.spans === void 0) {
|
|
10519
10535
|
t.stdout(` ${e.message}\n`);
|
|
10520
10536
|
return;
|
|
@@ -10523,14 +10539,14 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10523
10539
|
t.stdout(` ${n.name} ${n.end - n.start}ms\n`);
|
|
10524
10540
|
for (let e of n.events ?? []) t.stdout(` · ${e.name}${e.attrs === void 0 ? "" : ` ${JSON.stringify(e.attrs)}`}\n`);
|
|
10525
10541
|
}
|
|
10526
|
-
},
|
|
10542
|
+
}, $b = () => new Promise((e) => {
|
|
10527
10543
|
let t = () => {
|
|
10528
10544
|
process.off("SIGINT", t), process.off("SIGTERM", t), e();
|
|
10529
10545
|
};
|
|
10530
10546
|
process.on("SIGINT", t), process.on("SIGTERM", t);
|
|
10531
|
-
}),
|
|
10532
|
-
let t = /* @__PURE__ */ new Set(), n =
|
|
10533
|
-
quietMs:
|
|
10547
|
+
}), ex = (e) => {
|
|
10548
|
+
let t = /* @__PURE__ */ new Set(), n = Ab({
|
|
10549
|
+
quietMs: Xb,
|
|
10534
10550
|
onChange: async () => {
|
|
10535
10551
|
let n = [...t];
|
|
10536
10552
|
t.clear(), e.deps.stdout(` rebuilding ${n.join(", ")}…\n`);
|
|
@@ -10542,7 +10558,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10542
10558
|
}
|
|
10543
10559
|
}), r = e.mounted.map((e) => {
|
|
10544
10560
|
let r = e.manifest.ui?.dir;
|
|
10545
|
-
return
|
|
10561
|
+
return jb({
|
|
10546
10562
|
dir: e.dir,
|
|
10547
10563
|
ignore: r === void 0 ? [] : [r],
|
|
10548
10564
|
onChange: () => {
|
|
@@ -10552,16 +10568,16 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10552
10568
|
});
|
|
10553
10569
|
if (!new Set(e.mounted.map((e) => e.dir)).has(e.root)) {
|
|
10554
10570
|
let t = !1;
|
|
10555
|
-
r.push(
|
|
10571
|
+
r.push(Pb({
|
|
10556
10572
|
dir: e.root,
|
|
10557
|
-
intervalMs:
|
|
10573
|
+
intervalMs: Zb,
|
|
10558
10574
|
onChange: () => {
|
|
10559
10575
|
t || (t = !0, e.deps.stderr("\n ! The workspace changed. Restart `qinto app dev` to mount or drop an app.\n"));
|
|
10560
10576
|
}
|
|
10561
10577
|
}));
|
|
10562
10578
|
}
|
|
10563
10579
|
return [...r, { stop: n.stop }];
|
|
10564
|
-
},
|
|
10580
|
+
}, tx = {
|
|
10565
10581
|
path: ["app", "dev"],
|
|
10566
10582
|
description: "Run one app or a folder of them against a local Qinto: the released site worker and app runtime in workerd",
|
|
10567
10583
|
positionals: [{
|
|
@@ -10579,25 +10595,25 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10579
10595
|
flag: "--worker-port <port>",
|
|
10580
10596
|
description: "Port the local site worker listens on",
|
|
10581
10597
|
type: "string",
|
|
10582
|
-
default:
|
|
10598
|
+
default: Ub
|
|
10583
10599
|
},
|
|
10584
10600
|
{
|
|
10585
10601
|
flag: "--console-port <port>",
|
|
10586
10602
|
description: "Port the local console is served from",
|
|
10587
10603
|
type: "string",
|
|
10588
|
-
default:
|
|
10604
|
+
default: Gb
|
|
10589
10605
|
},
|
|
10590
10606
|
{
|
|
10591
10607
|
flag: "--demo-port <port>",
|
|
10592
10608
|
description: "Port the demo site is served from",
|
|
10593
10609
|
type: "string",
|
|
10594
|
-
default:
|
|
10610
|
+
default: Wb
|
|
10595
10611
|
},
|
|
10596
10612
|
{
|
|
10597
10613
|
flag: "--ui-port <port>",
|
|
10598
10614
|
description: "Port the app panels are served from",
|
|
10599
10615
|
type: "string",
|
|
10600
|
-
default:
|
|
10616
|
+
default: Kb
|
|
10601
10617
|
},
|
|
10602
10618
|
{
|
|
10603
10619
|
flag: "--reset",
|
|
@@ -10613,13 +10629,13 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10613
10629
|
result: { type: "app-dev" },
|
|
10614
10630
|
run: async (e, t) => {
|
|
10615
10631
|
let n = u(e.positionals.at(0) ?? "."), r = e.options, i = {
|
|
10616
|
-
worker:
|
|
10617
|
-
demo:
|
|
10618
|
-
console:
|
|
10619
|
-
ui:
|
|
10632
|
+
worker: qb("--worker-port", r.workerPort),
|
|
10633
|
+
demo: qb("--demo-port", r.demoPort),
|
|
10634
|
+
console: qb("--console-port", r.consolePort),
|
|
10635
|
+
ui: qb("--ui-port", r.uiPort)
|
|
10620
10636
|
};
|
|
10621
10637
|
if (i.console === 0) throw new E("--console-port must be a real port: the app workers are given the console address before they start.");
|
|
10622
|
-
let a = await
|
|
10638
|
+
let a = await Hb(await Bb(n), {
|
|
10623
10639
|
requested: r.apps,
|
|
10624
10640
|
machine: Y(r, t),
|
|
10625
10641
|
checkbox: (e) => t.prompts.checkbox("Which apps should this local Qinto mount?", e.map((e) => ({
|
|
@@ -10628,20 +10644,20 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10628
10644
|
})), e)
|
|
10629
10645
|
});
|
|
10630
10646
|
r.reset === !0 && await Vm(zm(n));
|
|
10631
|
-
let o = await
|
|
10647
|
+
let o = await Rv({
|
|
10632
10648
|
apps: a.map((e) => ({
|
|
10633
10649
|
dir: e.dir,
|
|
10634
10650
|
readManifest: async () => (await Mp(e.dir)).manifest
|
|
10635
10651
|
})),
|
|
10636
10652
|
root: n,
|
|
10637
|
-
artifactRoot:
|
|
10653
|
+
artifactRoot: Ib(),
|
|
10638
10654
|
host: "127.0.0.1",
|
|
10639
10655
|
port: i.worker,
|
|
10640
10656
|
uiPort: i.ui,
|
|
10641
10657
|
consoleOrigin: `http://127.0.0.1:${i.console}`
|
|
10642
10658
|
});
|
|
10643
10659
|
try {
|
|
10644
|
-
let e = await
|
|
10660
|
+
let e = await Tb({
|
|
10645
10661
|
host: "127.0.0.1",
|
|
10646
10662
|
port: i.demo,
|
|
10647
10663
|
siteOrigin: o.origin,
|
|
@@ -10652,12 +10668,12 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10652
10668
|
}))
|
|
10653
10669
|
});
|
|
10654
10670
|
try {
|
|
10655
|
-
let r = await
|
|
10671
|
+
let r = await gb({
|
|
10656
10672
|
host: "127.0.0.1",
|
|
10657
10673
|
port: i.console,
|
|
10658
10674
|
stack: o,
|
|
10659
10675
|
demoOrigin: e.origin
|
|
10660
|
-
}), s =
|
|
10676
|
+
}), s = ex({
|
|
10661
10677
|
root: n,
|
|
10662
10678
|
mounted: a,
|
|
10663
10679
|
stack: o,
|
|
@@ -10665,12 +10681,12 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10665
10681
|
deps: t
|
|
10666
10682
|
});
|
|
10667
10683
|
try {
|
|
10668
|
-
|
|
10684
|
+
Yb(o, {
|
|
10669
10685
|
console: r.origin(),
|
|
10670
10686
|
demo: e.origin()
|
|
10671
10687
|
}, t), o.logs.subscribe((e) => {
|
|
10672
|
-
|
|
10673
|
-
}), await
|
|
10688
|
+
Qb(e, t);
|
|
10689
|
+
}), await $b();
|
|
10674
10690
|
} finally {
|
|
10675
10691
|
for (let e of s) e.stop();
|
|
10676
10692
|
await r.stop();
|
|
@@ -10682,7 +10698,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10682
10698
|
await o.stop();
|
|
10683
10699
|
}
|
|
10684
10700
|
}
|
|
10685
|
-
},
|
|
10701
|
+
}, nx = (e, t, n = {}) => {
|
|
10686
10702
|
if (e.length === 0) throw Error("A table must have at least one column.");
|
|
10687
10703
|
for (let n of t) if (n.length !== e.length) throw Error(`Expected ${e.length} table columns, received ${n.length}.`);
|
|
10688
10704
|
let r = e.map((e, n) => Math.max(e.length, ...t.map((e) => e[n].length))), i = " ".repeat(n.indent ?? 0), a = `${i}+${r.map((e) => "-".repeat(e + 2)).join("+")}+`, o = (e) => {
|
|
@@ -10695,7 +10711,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10695
10711
|
...t.map(o)
|
|
10696
10712
|
];
|
|
10697
10713
|
return t.length > 0 && s.push(a), s;
|
|
10698
|
-
},
|
|
10714
|
+
}, rx = async (e, t) => {
|
|
10699
10715
|
let n = e.options, r = await q(t, n), i = await pm(t, r), a = [];
|
|
10700
10716
|
for (let e of i) {
|
|
10701
10717
|
let n = await X(t, r, `/developer/organizations/${e.organizationId}/apps`);
|
|
@@ -10712,7 +10728,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10712
10728
|
t.stdout("No apps yet. Register one with `qinto app register`.\n");
|
|
10713
10729
|
return;
|
|
10714
10730
|
}
|
|
10715
|
-
for (let e of
|
|
10731
|
+
for (let e of nx([
|
|
10716
10732
|
"Organization",
|
|
10717
10733
|
"Name",
|
|
10718
10734
|
"Slug",
|
|
@@ -10723,7 +10739,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10723
10739
|
e.slug,
|
|
10724
10740
|
e.appId
|
|
10725
10741
|
]))) t.stdout(`${e}\n`);
|
|
10726
|
-
},
|
|
10742
|
+
}, ix = {
|
|
10727
10743
|
path: ["app", "list"],
|
|
10728
10744
|
description: "List your developer apps across organizations",
|
|
10729
10745
|
positionals: [],
|
|
@@ -10733,8 +10749,8 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10733
10749
|
type: "boolean"
|
|
10734
10750
|
}],
|
|
10735
10751
|
result: { type: "app-list" },
|
|
10736
|
-
run:
|
|
10737
|
-
},
|
|
10752
|
+
run: rx
|
|
10753
|
+
}, ax = async (e) => {
|
|
10738
10754
|
let { deps: t, origin: n, slug: r, org: i, machine: a } = e, o = await pm(t, n), s = i === void 0 ? o : o.filter((e) => e.organizationId === i || e.name === i);
|
|
10739
10755
|
if (i !== void 0 && s.length === 0) throw new E(`Organization ${i} is not available to this credential.`);
|
|
10740
10756
|
let c = [];
|
|
@@ -10754,14 +10770,14 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10754
10770
|
value: e.organization.organizationId
|
|
10755
10771
|
})));
|
|
10756
10772
|
return c.find((e) => e.organization.organizationId === u);
|
|
10757
|
-
},
|
|
10773
|
+
}, ox = (e) => e.checked ? e.required ? e.valid ? "verified" : "pending" : "not_required" : "unavailable", sx = async (e, t, n) => (await X(e, t, `/teams/${n}/domains`)).sites, cx = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, lx = async (e, t) => {
|
|
10758
10774
|
let { origin: n, teamId: r, reference: i } = t, a = t.allowPrompt ?? e.interactive;
|
|
10759
|
-
if (i !== void 0 &&
|
|
10775
|
+
if (i !== void 0 && cx.test(i)) try {
|
|
10760
10776
|
return (await X(e, n, `/teams/${r}/domains/${i}`)).site;
|
|
10761
10777
|
} catch (e) {
|
|
10762
10778
|
throw e instanceof ar && e.code === "not_found" ? new E(`No authorized site matches ${i} in team ${r}.`) : e;
|
|
10763
10779
|
}
|
|
10764
|
-
let o = await
|
|
10780
|
+
let o = await sx(e, n, r);
|
|
10765
10781
|
if (i !== void 0) {
|
|
10766
10782
|
let e = o.find((e) => e.domainId === i || e.domain === i);
|
|
10767
10783
|
if (e === void 0) throw new E(`No authorized site matches ${i} in team ${r}.`);
|
|
@@ -10775,15 +10791,15 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10775
10791
|
value: e.domainId
|
|
10776
10792
|
})));
|
|
10777
10793
|
return o.find((e) => e.domainId === s);
|
|
10778
|
-
},
|
|
10794
|
+
}, ux = async (e, t) => {
|
|
10779
10795
|
let { origin: n, teamId: r, domainId: i } = t;
|
|
10780
10796
|
return X(e, n, `/teams/${r}/domains/${i}/dns/check`, { method: "POST" });
|
|
10781
|
-
},
|
|
10797
|
+
}, dx = (e) => e.records.length === 0 ? [] : e.records.map((e) => `${e.type} ${e.name} → ${e.value}${e.note === void 0 ? "" : ` (${e.note})`}`), fx = async (e, t) => (await X(e, t, "/teams")).teams, px = (e, t) => {
|
|
10782
10798
|
let n = e.find((e) => e.teamId === t);
|
|
10783
10799
|
if (n === void 0) throw new E(`Team ${t} is not authorized for this credential.`);
|
|
10784
10800
|
return n;
|
|
10785
|
-
},
|
|
10786
|
-
if (r !== void 0) return
|
|
10801
|
+
}, mx = async (e, t, n, r) => {
|
|
10802
|
+
if (r !== void 0) return px(n, r);
|
|
10787
10803
|
let i = await Kp(e, t);
|
|
10788
10804
|
if (i !== null) {
|
|
10789
10805
|
let e = n.find((e) => e.teamId === i);
|
|
@@ -10794,8 +10810,8 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10794
10810
|
return await qp(e, t, r.teamId), r;
|
|
10795
10811
|
}
|
|
10796
10812
|
throw new E("No active team is selected. Run `qinto team active <teamId>` or pass `--team <teamId>`.");
|
|
10797
|
-
},
|
|
10798
|
-
let { deps: t, origin: n } = e, r = await
|
|
10813
|
+
}, hx = async (e) => {
|
|
10814
|
+
let { deps: t, origin: n } = e, r = await mx(t, n, await fx(t, n), e.team), i = await sx(t, n, r.teamId), a = i.find((t) => t.domainId === e.site || t.domain === e.site);
|
|
10799
10815
|
if (a === void 0) {
|
|
10800
10816
|
if (i.length === 0) throw new E(`Team ${r.teamId} has no authorized sites.`);
|
|
10801
10817
|
let t = i.map((e) => `${e.domain} (${e.domainId})`).join(", ");
|
|
@@ -10805,13 +10821,13 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10805
10821
|
team: r,
|
|
10806
10822
|
site: a
|
|
10807
10823
|
};
|
|
10808
|
-
},
|
|
10824
|
+
}, gx = async (e) => {
|
|
10809
10825
|
let t = await S(e);
|
|
10810
10826
|
return {
|
|
10811
10827
|
hash: te("sha256").update(t).digest("hex"),
|
|
10812
10828
|
size: t.byteLength
|
|
10813
10829
|
};
|
|
10814
|
-
},
|
|
10830
|
+
}, _x = {
|
|
10815
10831
|
html: "text/html",
|
|
10816
10832
|
css: "text/css",
|
|
10817
10833
|
js: "text/javascript",
|
|
@@ -10828,41 +10844,41 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10828
10844
|
woff: "font/woff",
|
|
10829
10845
|
woff2: "font/woff2",
|
|
10830
10846
|
wasm: "application/wasm"
|
|
10831
|
-
},
|
|
10847
|
+
}, vx = (e) => _x[e.slice(e.lastIndexOf(".") + 1).toLowerCase()] ?? "application/octet-stream", yx = async (e, t) => {
|
|
10832
10848
|
let n = [];
|
|
10833
10849
|
for (let r of t) {
|
|
10834
|
-
let t = s(e, r), i = await
|
|
10850
|
+
let t = s(e, r), i = await gx(t);
|
|
10835
10851
|
n.push({
|
|
10836
10852
|
absolute: t,
|
|
10837
10853
|
declaration: {
|
|
10838
10854
|
path: r,
|
|
10839
10855
|
...i,
|
|
10840
|
-
contentType:
|
|
10856
|
+
contentType: vx(r)
|
|
10841
10857
|
}
|
|
10842
10858
|
});
|
|
10843
10859
|
}
|
|
10844
10860
|
return n;
|
|
10845
|
-
},
|
|
10861
|
+
}, bx = 4, xx = async (e) => {
|
|
10846
10862
|
let t = (await e.text()).trim(), n = /<Code>([^<]+)<\/Code>/.exec(t)?.at(1);
|
|
10847
10863
|
if (n === void 0) return t === "" ? "" : ` — ${t.slice(0, 200)}`;
|
|
10848
10864
|
let r = /<Message>([^<]+)<\/Message>/.exec(t)?.at(1);
|
|
10849
10865
|
return r === void 0 ? ` — ${n}` : ` — ${n}: ${r}`;
|
|
10850
|
-
},
|
|
10866
|
+
}, Sx = async (e) => {
|
|
10851
10867
|
let t = e.uploads.map((t, n) => ({
|
|
10852
10868
|
upload: t,
|
|
10853
10869
|
path: e.paths[n]
|
|
10854
|
-
})), n = Array.from({ length: Math.min(
|
|
10870
|
+
})), n = Array.from({ length: Math.min(bx, t.length) }, async () => {
|
|
10855
10871
|
for (let n = t.shift(); n !== void 0; n = t.shift()) {
|
|
10856
10872
|
let t = await S(n.path), r = await e.deps.fetch(n.upload.url, {
|
|
10857
10873
|
method: "PUT",
|
|
10858
10874
|
headers: n.upload.headers,
|
|
10859
10875
|
body: new Uint8Array(t)
|
|
10860
10876
|
});
|
|
10861
|
-
if (!r.ok) throw new T(`Uploading ${n.upload.key} failed with status ${r.status}${await
|
|
10877
|
+
if (!r.ok) throw new T(`Uploading ${n.upload.key} failed with status ${r.status}${await xx(r)}.`);
|
|
10862
10878
|
}
|
|
10863
10879
|
});
|
|
10864
10880
|
await Promise.all(n);
|
|
10865
|
-
},
|
|
10881
|
+
}, Cx = {
|
|
10866
10882
|
approval_required: {
|
|
10867
10883
|
flag: "--accept-capabilities",
|
|
10868
10884
|
key: "acceptCapabilities"
|
|
@@ -10871,16 +10887,16 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10871
10887
|
flag: "--acknowledge-necessary",
|
|
10872
10888
|
key: "acknowledgeNecessary"
|
|
10873
10889
|
}
|
|
10874
|
-
},
|
|
10890
|
+
}, wx = "The Qinto API rejected the request: ", Tx = async (e) => {
|
|
10875
10891
|
let { error: t } = e;
|
|
10876
10892
|
if (!(t instanceof ar)) throw t;
|
|
10877
|
-
let n =
|
|
10893
|
+
let n = Cx[t.code ?? ""];
|
|
10878
10894
|
if (n === void 0 || e.consent[n.key]) throw t;
|
|
10879
|
-
let r = t.message.replace(
|
|
10895
|
+
let r = t.message.replace(wx, "");
|
|
10880
10896
|
if (e.machine) throw new E(`${r} Pass ${n.flag} to proceed.`);
|
|
10881
10897
|
if (!await e.deps.prompts.confirm(`${r} Proceed?`, !1)) throw new E(`Install declined. Rerun with ${n.flag} to proceed.`);
|
|
10882
10898
|
return n.key;
|
|
10883
|
-
},
|
|
10899
|
+
}, Ex = async (e) => {
|
|
10884
10900
|
let { deps: t, origin: n, machine: r, target: i, slug: a, appVersionId: o } = e, s = { ...e.consent }, c = `/teams/${i.team.teamId}/domains/${i.site.domainId}/apps/${a}`;
|
|
10885
10901
|
for (;;) try {
|
|
10886
10902
|
return await X(t, n, c, {
|
|
@@ -10892,14 +10908,14 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10892
10908
|
}
|
|
10893
10909
|
});
|
|
10894
10910
|
} catch (e) {
|
|
10895
|
-
s[await
|
|
10911
|
+
s[await Tx({
|
|
10896
10912
|
deps: t,
|
|
10897
10913
|
machine: r,
|
|
10898
10914
|
error: e,
|
|
10899
10915
|
consent: s
|
|
10900
10916
|
})] = !0;
|
|
10901
10917
|
}
|
|
10902
|
-
},
|
|
10918
|
+
}, Dx = async (e, t) => {
|
|
10903
10919
|
let n = s(e, ".qinto", "publish.lock");
|
|
10904
10920
|
await ue(s(e, ".qinto"), { recursive: !0 }), await ge(n, "", { flag: "a" });
|
|
10905
10921
|
let r;
|
|
@@ -10916,7 +10932,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10916
10932
|
} finally {
|
|
10917
10933
|
await r();
|
|
10918
10934
|
}
|
|
10919
|
-
},
|
|
10935
|
+
}, Ox = async (e) => {
|
|
10920
10936
|
let t;
|
|
10921
10937
|
try {
|
|
10922
10938
|
t = await S(s(e, ".qinto", "publish.json"), "utf8");
|
|
@@ -10929,22 +10945,22 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10929
10945
|
} catch {
|
|
10930
10946
|
throw new T(".qinto/publish.json is corrupted. Pass --restart to discard it and start a fresh publish.");
|
|
10931
10947
|
}
|
|
10932
|
-
},
|
|
10948
|
+
}, kx = async (e, t) => {
|
|
10933
10949
|
await ue(s(e, ".qinto"), { recursive: !0 }), await ge(s(e, ".qinto", "publish.json"), `${JSON.stringify(t, null, 2)}\n`);
|
|
10934
|
-
},
|
|
10950
|
+
}, Ax = async (e) => {
|
|
10935
10951
|
await me(s(e, ".qinto", "publish.json"), { force: !0 });
|
|
10936
|
-
},
|
|
10952
|
+
}, jx = "/dry-run/0.0.0/", Mx = (e) => {
|
|
10937
10953
|
if (e.bump !== void 0 && e.version !== void 0) throw new E("Pass either --bump or --version, not both.");
|
|
10938
10954
|
if (e.version !== void 0) {
|
|
10939
10955
|
if (!/^\d+\.\d+\.\d+$/.test(e.version)) throw new E("Pass --version as x.y.z.");
|
|
10940
10956
|
return { version: e.version };
|
|
10941
10957
|
}
|
|
10942
10958
|
return { bump: e.bump ?? "patch" };
|
|
10943
|
-
},
|
|
10959
|
+
}, Nx = (e, t) => (n) => {
|
|
10944
10960
|
t || e.stderr(`${n}\n`);
|
|
10945
|
-
},
|
|
10946
|
-
e.restart && await
|
|
10947
|
-
let t = e.restart ? null : await
|
|
10961
|
+
}, Px = async (e) => {
|
|
10962
|
+
e.restart && await Ax(e.dir);
|
|
10963
|
+
let t = e.restart ? null : await Ox(e.dir);
|
|
10948
10964
|
if (t !== null) {
|
|
10949
10965
|
let n = t.request.bump === e.request.bump && t.request.version === e.request.version;
|
|
10950
10966
|
if (t.slug !== e.slug || t.appId !== e.appId || !n) throw new E("An unfinished publish in this directory was started with different arguments. Rerun it with the same app and version request, or pass --restart to discard it.");
|
|
@@ -10957,10 +10973,10 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10957
10973
|
phase: "init",
|
|
10958
10974
|
request: e.request
|
|
10959
10975
|
};
|
|
10960
|
-
return await
|
|
10961
|
-
},
|
|
10976
|
+
return await kx(e.dir, n), n;
|
|
10977
|
+
}, Fx = (e, t) => {
|
|
10962
10978
|
t.skipped.length > 0 && e.stderr(`Warning: ${t.skipped.length} file(s) were left out of the panel — source maps, dot-prefixed names, and node_modules are never published: ${t.skipped.join(", ")}\n`), t.inlineSourceMaps.length > 0 && e.stderr(`Warning: ${t.inlineSourceMaps.length} published file(s) carry an inline source map, which exposes your original sources at a public URL — set sourcemap to false in the panel's build: ${t.inlineSourceMaps.join(", ")}\n`);
|
|
10963
|
-
},
|
|
10979
|
+
}, Ix = async (e) => {
|
|
10964
10980
|
let { deps: t, dir: n, manifest: r, basePath: i, outDir: a, progress: o } = e;
|
|
10965
10981
|
o("Building the server bundle…");
|
|
10966
10982
|
let s = await Nr({
|
|
@@ -10974,10 +10990,10 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10974
10990
|
});
|
|
10975
10991
|
let c = {
|
|
10976
10992
|
absolute: s.server,
|
|
10977
|
-
...await
|
|
10993
|
+
...await gx(s.server)
|
|
10978
10994
|
}, l = s.browser === null ? null : {
|
|
10979
10995
|
absolute: s.browser,
|
|
10980
|
-
...await
|
|
10996
|
+
...await gx(s.browser)
|
|
10981
10997
|
};
|
|
10982
10998
|
if (r.ui === void 0) return {
|
|
10983
10999
|
server: c,
|
|
@@ -10995,14 +11011,14 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
10995
11011
|
uiRoot: d,
|
|
10996
11012
|
basePath: i
|
|
10997
11013
|
});
|
|
10998
|
-
return
|
|
11014
|
+
return Fx(t, f), {
|
|
10999
11015
|
server: c,
|
|
11000
11016
|
browser: l,
|
|
11001
|
-
ui: await
|
|
11017
|
+
ui: await yx(d, f.files),
|
|
11002
11018
|
skipped: f.skipped,
|
|
11003
11019
|
inlineSourceMaps: f.inlineSourceMaps
|
|
11004
11020
|
};
|
|
11005
|
-
},
|
|
11021
|
+
}, Lx = async (e) => {
|
|
11006
11022
|
let { deps: t, origin: n, versionPath: r, publishId: i, manifest: a, artifacts: o } = e, s = {
|
|
11007
11023
|
publishId: i,
|
|
11008
11024
|
manifestDigest: await gi(a),
|
|
@@ -11023,12 +11039,12 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11023
11039
|
...o.browser === null ? [] : [o.browser.absolute],
|
|
11024
11040
|
...(o.ui ?? []).map((e) => e.absolute)
|
|
11025
11041
|
];
|
|
11026
|
-
await
|
|
11042
|
+
await Sx({
|
|
11027
11043
|
deps: t,
|
|
11028
11044
|
uploads: c.uploads,
|
|
11029
11045
|
paths: l
|
|
11030
11046
|
});
|
|
11031
|
-
},
|
|
11047
|
+
}, Rx = async (e) => {
|
|
11032
11048
|
let { deps: t, origin: n, versionPath: r, publishId: i } = e;
|
|
11033
11049
|
try {
|
|
11034
11050
|
return (await X(t, n, `${r}/finalize`, {
|
|
@@ -11038,12 +11054,12 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11038
11054
|
} catch (a) {
|
|
11039
11055
|
if (a instanceof ar && a.code === "app_variables_unset") throw new T(`${a.message} Set each one with \`qinto app var set\` or \`qinto app secret set\`, then re-run \`qinto app publish\` — this draft is still held, so it resumes on the same version.`);
|
|
11040
11056
|
if (!(a instanceof ar) || a.code !== "artifacts_stale") throw a;
|
|
11041
|
-
return e.progress("The declared artifacts went stale — redeclaring…"), await
|
|
11057
|
+
return e.progress("The declared artifacts went stale — redeclaring…"), await Lx(e), (await X(t, n, `${r}/finalize`, {
|
|
11042
11058
|
method: "POST",
|
|
11043
11059
|
body: { publishId: i }
|
|
11044
11060
|
})).version;
|
|
11045
11061
|
}
|
|
11046
|
-
},
|
|
11062
|
+
}, zx = (e) => {
|
|
11047
11063
|
if (e.json) {
|
|
11048
11064
|
let t = e.install === void 0 ? {} : { install: {
|
|
11049
11065
|
domainAppId: e.install.outcome.domainAppId,
|
|
@@ -11063,10 +11079,10 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11063
11079
|
return;
|
|
11064
11080
|
}
|
|
11065
11081
|
e.resumed === !0 ? e.deps.stdout(`Version ${e.version.version} was already published from this directory.\n`) : e.deps.stdout(`Published '${e.slug}'@${e.version.version}.\nVersion ID: ${e.version.appVersionId}\n`), e.install === void 0 ? e.resumed === !0 && e.deps.stdout("Nothing left to do.\n") : e.deps.stdout(`Install on ${e.install.target.site.domain}: ${e.install.outcome.action}. Deployment pending — the site deploys in the background.\n`);
|
|
11066
|
-
},
|
|
11082
|
+
}, Bx = async (e) => {
|
|
11067
11083
|
let { deps: t, origin: n, dir: r, options: i, machine: a, state: o, prior: s, version: c, resumed: l, progress: u } = e, d = i.json === !0;
|
|
11068
11084
|
if (i.site === void 0) {
|
|
11069
|
-
await
|
|
11085
|
+
await Ax(r), zx({
|
|
11070
11086
|
deps: t,
|
|
11071
11087
|
json: d,
|
|
11072
11088
|
slug: o.slug,
|
|
@@ -11075,13 +11091,13 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11075
11091
|
});
|
|
11076
11092
|
return;
|
|
11077
11093
|
}
|
|
11078
|
-
let f = await
|
|
11094
|
+
let f = await hx({
|
|
11079
11095
|
deps: t,
|
|
11080
11096
|
origin: n,
|
|
11081
11097
|
site: i.site,
|
|
11082
11098
|
team: i.team
|
|
11083
11099
|
}), p = s.phase === "installed" && s.site === f.site.domainId ? s.domainAppId : void 0, m;
|
|
11084
|
-
p === void 0 ? (u(`Installing on ${f.site.domain}…`), m = await
|
|
11100
|
+
p === void 0 ? (u(`Installing on ${f.site.domain}…`), m = await Ex({
|
|
11085
11101
|
deps: t,
|
|
11086
11102
|
origin: n,
|
|
11087
11103
|
machine: a,
|
|
@@ -11092,7 +11108,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11092
11108
|
acceptCapabilities: i.acceptCapabilities === !0,
|
|
11093
11109
|
acknowledgeNecessary: i.acknowledgeNecessary === !0
|
|
11094
11110
|
}
|
|
11095
|
-
}), await
|
|
11111
|
+
}), await kx(r, {
|
|
11096
11112
|
...o,
|
|
11097
11113
|
phase: "installed",
|
|
11098
11114
|
site: f.site.domainId,
|
|
@@ -11100,7 +11116,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11100
11116
|
})) : m = {
|
|
11101
11117
|
domainAppId: p,
|
|
11102
11118
|
action: "unchanged"
|
|
11103
|
-
}, await
|
|
11119
|
+
}, await Ax(r), zx({
|
|
11104
11120
|
deps: t,
|
|
11105
11121
|
json: d,
|
|
11106
11122
|
slug: o.slug,
|
|
@@ -11111,8 +11127,8 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11111
11127
|
target: f
|
|
11112
11128
|
}
|
|
11113
11129
|
});
|
|
11114
|
-
},
|
|
11115
|
-
let { deps: t, origin: n, dir: r, manifest: i, request: a, options: o, machine: c } = e, l =
|
|
11130
|
+
}, Vx = async (e) => {
|
|
11131
|
+
let { deps: t, origin: n, dir: r, manifest: i, request: a, options: o, machine: c } = e, l = Nx(t, c), u = await ax({
|
|
11116
11132
|
deps: t,
|
|
11117
11133
|
origin: n,
|
|
11118
11134
|
slug: i.slug,
|
|
@@ -11120,7 +11136,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11120
11136
|
machine: c,
|
|
11121
11137
|
orgFlag: !0,
|
|
11122
11138
|
notFound: `App '${i.slug}' is not registered. Run \`qinto app register\` first.`
|
|
11123
|
-
}), d = await
|
|
11139
|
+
}), d = await Px({
|
|
11124
11140
|
dir: r,
|
|
11125
11141
|
slug: i.slug,
|
|
11126
11142
|
appId: u.app.appId,
|
|
@@ -11145,7 +11161,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11145
11161
|
request: a
|
|
11146
11162
|
};
|
|
11147
11163
|
if (m.version.status === "ready") {
|
|
11148
|
-
await
|
|
11164
|
+
await Bx({
|
|
11149
11165
|
deps: t,
|
|
11150
11166
|
origin: n,
|
|
11151
11167
|
dir: r,
|
|
@@ -11159,10 +11175,10 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11159
11175
|
});
|
|
11160
11176
|
return;
|
|
11161
11177
|
}
|
|
11162
|
-
await
|
|
11178
|
+
await kx(r, h), l(`Allocated ${m.version.version} (draft).`);
|
|
11163
11179
|
let g = `${p}/${m.version.appVersionId}`, _ = await de(s(r, ".qinto", "build-"));
|
|
11164
11180
|
try {
|
|
11165
|
-
let e = await
|
|
11181
|
+
let e = await Ix({
|
|
11166
11182
|
deps: t,
|
|
11167
11183
|
dir: r,
|
|
11168
11184
|
manifest: i,
|
|
@@ -11170,17 +11186,17 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11170
11186
|
outDir: _,
|
|
11171
11187
|
progress: l
|
|
11172
11188
|
});
|
|
11173
|
-
l(`Uploading ${1 + (e.browser === null ? 0 : 1) + (e.ui?.length ?? 0)} artifact(s)…`), await
|
|
11189
|
+
l(`Uploading ${1 + (e.browser === null ? 0 : 1) + (e.ui?.length ?? 0)} artifact(s)…`), await Lx({
|
|
11174
11190
|
deps: t,
|
|
11175
11191
|
origin: n,
|
|
11176
11192
|
versionPath: g,
|
|
11177
11193
|
publishId: f,
|
|
11178
11194
|
manifest: i,
|
|
11179
11195
|
artifacts: e
|
|
11180
|
-
}), await
|
|
11196
|
+
}), await kx(r, {
|
|
11181
11197
|
...h,
|
|
11182
11198
|
phase: "uploaded"
|
|
11183
|
-
}), l("Finalizing…"), await
|
|
11199
|
+
}), l("Finalizing…"), await Bx({
|
|
11184
11200
|
deps: t,
|
|
11185
11201
|
origin: n,
|
|
11186
11202
|
dir: r,
|
|
@@ -11188,7 +11204,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11188
11204
|
machine: c,
|
|
11189
11205
|
state: h,
|
|
11190
11206
|
prior: d,
|
|
11191
|
-
version: await
|
|
11207
|
+
version: await Rx({
|
|
11192
11208
|
deps: t,
|
|
11193
11209
|
origin: n,
|
|
11194
11210
|
versionPath: g,
|
|
@@ -11206,16 +11222,16 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11206
11222
|
force: !0
|
|
11207
11223
|
});
|
|
11208
11224
|
}
|
|
11209
|
-
},
|
|
11225
|
+
}, Hx = async (e) => {
|
|
11210
11226
|
let { deps: t, dir: n, manifest: i, request: a, json: o, machine: c } = e, l = await de(s(r(), "qinto-publish-"));
|
|
11211
11227
|
try {
|
|
11212
|
-
let e = await
|
|
11228
|
+
let e = await Ix({
|
|
11213
11229
|
deps: t,
|
|
11214
11230
|
dir: n,
|
|
11215
11231
|
manifest: i,
|
|
11216
|
-
basePath:
|
|
11232
|
+
basePath: jx,
|
|
11217
11233
|
outDir: l,
|
|
11218
|
-
progress:
|
|
11234
|
+
progress: Nx(t, c)
|
|
11219
11235
|
});
|
|
11220
11236
|
if (o) {
|
|
11221
11237
|
let n = {
|
|
@@ -11247,10 +11263,10 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11247
11263
|
force: !0
|
|
11248
11264
|
});
|
|
11249
11265
|
}
|
|
11250
|
-
},
|
|
11251
|
-
let n = e.options, r = Y(n, t), i = u(e.positionals.at(0) ?? "."), a =
|
|
11266
|
+
}, Ux = async (e, t) => {
|
|
11267
|
+
let n = e.options, r = Y(n, t), i = u(e.positionals.at(0) ?? "."), a = Mx(n), o = await Mp(i);
|
|
11252
11268
|
if (n.dryRun === !0) {
|
|
11253
|
-
await
|
|
11269
|
+
await Hx({
|
|
11254
11270
|
deps: t,
|
|
11255
11271
|
dir: i,
|
|
11256
11272
|
manifest: o.manifest,
|
|
@@ -11261,8 +11277,8 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11261
11277
|
return;
|
|
11262
11278
|
}
|
|
11263
11279
|
let s = await q(t, n);
|
|
11264
|
-
await
|
|
11265
|
-
await
|
|
11280
|
+
await Dx(i, async () => {
|
|
11281
|
+
await Vx({
|
|
11266
11282
|
deps: t,
|
|
11267
11283
|
origin: s,
|
|
11268
11284
|
dir: i,
|
|
@@ -11272,7 +11288,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11272
11288
|
machine: r
|
|
11273
11289
|
});
|
|
11274
11290
|
});
|
|
11275
|
-
},
|
|
11291
|
+
}, Wx = {
|
|
11276
11292
|
path: ["app", "publish"],
|
|
11277
11293
|
description: "Build an app and publish it as a new version",
|
|
11278
11294
|
positionals: [{
|
|
@@ -11344,17 +11360,17 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11344
11360
|
}
|
|
11345
11361
|
],
|
|
11346
11362
|
result: { type: "app-publish" },
|
|
11347
|
-
run:
|
|
11348
|
-
},
|
|
11363
|
+
run: Ux
|
|
11364
|
+
}, Gx = [
|
|
11349
11365
|
"slug",
|
|
11350
11366
|
"name",
|
|
11351
11367
|
"description"
|
|
11352
|
-
],
|
|
11368
|
+
], Kx = async (e) => {
|
|
11353
11369
|
if (e.value !== void 0 && e.value !== "") return e.value;
|
|
11354
11370
|
if (e.machine) throw new E(`Pass ${e.flag}.`);
|
|
11355
11371
|
return e.deps.prompts.input(e.prompt);
|
|
11356
|
-
},
|
|
11357
|
-
let n =
|
|
11372
|
+
}, qx = async (e, t) => {
|
|
11373
|
+
let n = Gx.filter((e) => t[e] !== void 0);
|
|
11358
11374
|
if (n.length > 0) throw new E(`${jp} in ${e} already names the app. Remove ${n.map((e) => `--${e}`).join(", ")}.`);
|
|
11359
11375
|
let { manifest: r } = await Mp(e);
|
|
11360
11376
|
return {
|
|
@@ -11362,15 +11378,15 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11362
11378
|
name: r.name,
|
|
11363
11379
|
description: r.description
|
|
11364
11380
|
};
|
|
11365
|
-
},
|
|
11366
|
-
slug: await
|
|
11381
|
+
}, Jx = async (e, t, n) => ({
|
|
11382
|
+
slug: await Kx({
|
|
11367
11383
|
deps: e,
|
|
11368
11384
|
value: t.slug,
|
|
11369
11385
|
machine: n,
|
|
11370
11386
|
flag: "--slug <slug>",
|
|
11371
11387
|
prompt: "App slug (3-30 lowercase letters, digits, hyphens)"
|
|
11372
11388
|
}),
|
|
11373
|
-
name: await
|
|
11389
|
+
name: await Kx({
|
|
11374
11390
|
deps: e,
|
|
11375
11391
|
value: t.name,
|
|
11376
11392
|
machine: n,
|
|
@@ -11378,12 +11394,12 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11378
11394
|
prompt: "App name"
|
|
11379
11395
|
}),
|
|
11380
11396
|
description: t.description
|
|
11381
|
-
}),
|
|
11397
|
+
}), Yx = async (e, t) => {
|
|
11382
11398
|
let n = e.options, r = Y(n, t), i = e.positionals.at(0), a = u(i ?? "."), o = await hm({
|
|
11383
11399
|
deps: t,
|
|
11384
11400
|
origin: await q(t, n),
|
|
11385
11401
|
machine: r,
|
|
11386
|
-
...i !== void 0 || y(s(a, "qinto.app.jsonc")) ? await
|
|
11402
|
+
...i !== void 0 || y(s(a, "qinto.app.jsonc")) ? await qx(a, n) : await Jx(t, n, r),
|
|
11387
11403
|
org: n.org
|
|
11388
11404
|
});
|
|
11389
11405
|
if (n.json === !0) {
|
|
@@ -11394,7 +11410,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11394
11410
|
return;
|
|
11395
11411
|
}
|
|
11396
11412
|
gm(t, o);
|
|
11397
|
-
},
|
|
11413
|
+
}, Xx = {
|
|
11398
11414
|
path: ["app", "register"],
|
|
11399
11415
|
description: "Register a developer app under an organization",
|
|
11400
11416
|
positionals: [{
|
|
@@ -11436,31 +11452,31 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11436
11452
|
}
|
|
11437
11453
|
],
|
|
11438
11454
|
result: { type: "app-register" },
|
|
11439
|
-
run:
|
|
11440
|
-
},
|
|
11455
|
+
run: Yx
|
|
11456
|
+
}, Zx = {
|
|
11441
11457
|
kind: "plain",
|
|
11442
11458
|
noun: "variable",
|
|
11443
11459
|
setCommand: "qinto app var set"
|
|
11444
|
-
},
|
|
11460
|
+
}, Qx = {
|
|
11445
11461
|
kind: "secret",
|
|
11446
11462
|
noun: "secret",
|
|
11447
11463
|
setCommand: "qinto app secret set"
|
|
11448
|
-
},
|
|
11464
|
+
}, $x = (e) => `/developer/organizations/${e.organization.organizationId}/apps/${e.app.appId}/variables`, eS = async (e) => ax({
|
|
11449
11465
|
...e,
|
|
11450
11466
|
notFound: `App '${e.slug}' was not found in your organizations.`
|
|
11451
|
-
}),
|
|
11452
|
-
let { deps: t, origin: n, resolved: r, name: i, value: a, scope: o } = e, s = (await
|
|
11467
|
+
}), tS = async (e, t, n) => (await X(e, t, $x(n))).variables, nS = async (e) => {
|
|
11468
|
+
let { deps: t, origin: n, resolved: r, name: i, value: a, scope: o } = e, s = (await tS(t, n, r)).find((e) => e.name === i);
|
|
11453
11469
|
if (s === void 0) throw new T(`No version of '${r.app.slug}' declares an app ${o.noun} named ${i}. Declare it under appVariables in qinto.app.jsonc first.`);
|
|
11454
11470
|
if (s.kind !== o.kind) {
|
|
11455
|
-
let e = o.kind === "secret" ?
|
|
11471
|
+
let e = o.kind === "secret" ? Zx : Qx;
|
|
11456
11472
|
throw new T(`${i} is declared as a ${e.noun}; set it with \`${e.setCommand}\`.`);
|
|
11457
11473
|
}
|
|
11458
|
-
return (await X(t, n,
|
|
11474
|
+
return (await X(t, n, $x(r), {
|
|
11459
11475
|
method: "PATCH",
|
|
11460
11476
|
body: { values: { [i]: a } }
|
|
11461
11477
|
})).variables;
|
|
11462
|
-
},
|
|
11463
|
-
let n = e.options, r = e.positionals.at(0), i = await q(t, n), a = (await
|
|
11478
|
+
}, rS = async (e, t) => {
|
|
11479
|
+
let n = e.options, r = e.positionals.at(0), i = await q(t, n), a = (await tS(t, i, await eS({
|
|
11464
11480
|
deps: t,
|
|
11465
11481
|
origin: i,
|
|
11466
11482
|
slug: r,
|
|
@@ -11474,7 +11490,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11474
11490
|
t.stdout(`No version of '${r}' declares an app secret.\n`);
|
|
11475
11491
|
return;
|
|
11476
11492
|
}
|
|
11477
|
-
for (let e of
|
|
11493
|
+
for (let e of nx([
|
|
11478
11494
|
"Name",
|
|
11479
11495
|
"Required",
|
|
11480
11496
|
"Status"
|
|
@@ -11483,7 +11499,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11483
11499
|
e.required ? "yes" : "no",
|
|
11484
11500
|
e.set ? "Set" : "Not set"
|
|
11485
11501
|
]))) t.stdout(`${e}\n`);
|
|
11486
|
-
},
|
|
11502
|
+
}, iS = {
|
|
11487
11503
|
path: [
|
|
11488
11504
|
"app",
|
|
11489
11505
|
"secret",
|
|
@@ -11501,31 +11517,31 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11501
11517
|
type: "boolean"
|
|
11502
11518
|
}],
|
|
11503
11519
|
result: { type: "app-secret-list" },
|
|
11504
|
-
run:
|
|
11505
|
-
},
|
|
11520
|
+
run: rS
|
|
11521
|
+
}, aS = async (e, t) => {
|
|
11506
11522
|
let n = (e.interactive ? await e.prompts.password(`Value for ${t}`) : await e.readStdin()).trim();
|
|
11507
11523
|
if (n === "") throw new E(`No value for ${t}. Pipe it in (\`echo -n "$SECRET" | qinto app secret set …\`) or run this in a terminal.`);
|
|
11508
11524
|
return n;
|
|
11509
|
-
},
|
|
11510
|
-
let n = e.options, r = e.positionals.at(0), i = e.positionals.at(1), a = await q(t, n), o = await
|
|
11525
|
+
}, oS = async (e, t) => {
|
|
11526
|
+
let n = e.options, r = e.positionals.at(0), i = e.positionals.at(1), a = await q(t, n), o = await nS({
|
|
11511
11527
|
deps: t,
|
|
11512
11528
|
origin: a,
|
|
11513
|
-
resolved: await
|
|
11529
|
+
resolved: await eS({
|
|
11514
11530
|
deps: t,
|
|
11515
11531
|
origin: a,
|
|
11516
11532
|
slug: r,
|
|
11517
11533
|
machine: Y(n, t)
|
|
11518
11534
|
}),
|
|
11519
11535
|
name: i,
|
|
11520
|
-
value: await
|
|
11521
|
-
scope:
|
|
11536
|
+
value: await aS(t, i),
|
|
11537
|
+
scope: Qx
|
|
11522
11538
|
});
|
|
11523
11539
|
if (n.json === !0) {
|
|
11524
11540
|
t.stdout(`${JSON.stringify({ secrets: o.filter((e) => e.kind === "secret") }, null, 2)}\n`);
|
|
11525
11541
|
return;
|
|
11526
11542
|
}
|
|
11527
11543
|
t.stdout(`Set ${i} for '${r}'. Every site running this app picks it up within five minutes.\n`);
|
|
11528
|
-
},
|
|
11544
|
+
}, sS = {
|
|
11529
11545
|
path: [
|
|
11530
11546
|
"app",
|
|
11531
11547
|
"secret",
|
|
@@ -11547,44 +11563,44 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11547
11563
|
type: "boolean"
|
|
11548
11564
|
}],
|
|
11549
11565
|
result: { type: "app-secret-set" },
|
|
11550
|
-
run:
|
|
11551
|
-
},
|
|
11566
|
+
run: oS
|
|
11567
|
+
}, cS = (e, t) => {
|
|
11552
11568
|
let n = [];
|
|
11553
11569
|
return e.enabled || n.push("the app is disabled"), t.enabled || n.push("this install is disabled"), t.missingRequired.length > 0 && n.push(`missing required: ${t.missingRequired.join(", ")}`), [t.active ? "active" : "inactive", ...n].join("; ");
|
|
11554
|
-
},
|
|
11570
|
+
}, lS = (e, t, n) => {
|
|
11555
11571
|
let r = n.path.includes("/:") ? " (pattern)" : "";
|
|
11556
11572
|
return `${n.methods.join(", ")} https://${e.site.domain}/app/${t.slug}${n.path}${r} — ${n.auth}, ${n.mode}`;
|
|
11557
|
-
},
|
|
11573
|
+
}, uS = (e) => `${e.status}: ${e.callerAppSlug} → ${e.providerAppSlug} (${e.functions.join(", ")})`, dS = (e) => e === void 0 ? "" : `, ${e}s`, fS = (e, t, n) => {
|
|
11558
11574
|
let r = n.app;
|
|
11559
11575
|
e.stdout(`${r.name} (${r.slug}) on ${t.site.domain}\n`), e.stdout(`Version: desired ${r.desiredVersion}, deployed ${r.deployedVersion ?? "deployment pending"}\n`), e.stdout(`Enabled: ${r.enabled ? "yes" : "no"}\n`), e.stdout(`Flows: ${r.flows.join(", ")}\n`), e.stdout(`Consent category: ${r.consentCategory}\n`), e.stdout(`UI panel: ${r.ui ? "yes" : "no"}\n`), e.stdout(`API scopes: ${n.capabilities.api.length === 0 ? "none" : n.capabilities.api.join(", ")}\n`), e.stdout(`Event data: ${n.capabilities.data.length === 0 ? "none" : n.capabilities.data.join(", ")}\n`);
|
|
11560
|
-
let i = [...n.capture.queryParams.map((e) => `${e.name} (query${
|
|
11576
|
+
let i = [...n.capture.queryParams.map((e) => `${e.name} (query${dS(e.expiresInSeconds)})`), ...n.capture.cookies.map((e) => `${e.name} (cookie${dS(e.expiresInSeconds)})`)];
|
|
11561
11577
|
if (e.stdout(`Captures: ${i.length === 0 ? "none" : i.join(", ")}\n`), n.endpoints.length === 0) e.stdout("Endpoints: none\n");
|
|
11562
11578
|
else {
|
|
11563
11579
|
e.stdout("Endpoints:\n");
|
|
11564
|
-
for (let i of n.endpoints) e.stdout(` ${
|
|
11580
|
+
for (let i of n.endpoints) e.stdout(` ${lS(t, r, i)}\n`);
|
|
11565
11581
|
}
|
|
11566
11582
|
e.stdout("Installs:\n");
|
|
11567
|
-
for (let t of n.installs) e.stdout(` #${t.ordinal} ${t.label} — ${
|
|
11583
|
+
for (let t of n.installs) e.stdout(` #${t.ordinal} ${t.label} — ${cS(r, t)}\n`);
|
|
11568
11584
|
if (n.grants.length === 0) {
|
|
11569
11585
|
e.stdout("Grants: none\n");
|
|
11570
11586
|
return;
|
|
11571
11587
|
}
|
|
11572
11588
|
e.stdout(`Grants (${r.pendingGrantCount} pending):\n`);
|
|
11573
|
-
for (let t of n.grants) e.stdout(` ${
|
|
11574
|
-
},
|
|
11589
|
+
for (let t of n.grants) e.stdout(` ${uS(t)}\n`);
|
|
11590
|
+
}, pS = async (e) => {
|
|
11575
11591
|
let { deps: t, origin: n, target: r, slug: i } = e;
|
|
11576
11592
|
try {
|
|
11577
11593
|
return await X(t, n, `/teams/${r.team.teamId}/domains/${r.site.domainId}/apps/${i}`);
|
|
11578
11594
|
} catch (e) {
|
|
11579
11595
|
throw e instanceof ar && e.code === "not_found" ? new T(`App '${i}' is not installed on ${r.site.domain}.`) : e;
|
|
11580
11596
|
}
|
|
11581
|
-
},
|
|
11582
|
-
let n = e.options, r = e.positionals.at(0), i = await q(t, n), a = await
|
|
11597
|
+
}, mS = async (e, t) => {
|
|
11598
|
+
let n = e.options, r = e.positionals.at(0), i = await q(t, n), a = await hx({
|
|
11583
11599
|
deps: t,
|
|
11584
11600
|
origin: i,
|
|
11585
11601
|
site: n.site,
|
|
11586
11602
|
team: n.team
|
|
11587
|
-
}), o = await
|
|
11603
|
+
}), o = await pS({
|
|
11588
11604
|
deps: t,
|
|
11589
11605
|
origin: i,
|
|
11590
11606
|
target: a,
|
|
@@ -11600,8 +11616,8 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11600
11616
|
}, null, 2)}\n`);
|
|
11601
11617
|
return;
|
|
11602
11618
|
}
|
|
11603
|
-
|
|
11604
|
-
},
|
|
11619
|
+
fS(t, a, o);
|
|
11620
|
+
}, hS = {
|
|
11605
11621
|
path: ["app", "status"],
|
|
11606
11622
|
description: "Show an app’s desired vs deployed state on a site",
|
|
11607
11623
|
positionals: [{
|
|
@@ -11629,9 +11645,9 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11629
11645
|
}
|
|
11630
11646
|
],
|
|
11631
11647
|
result: { type: "app-status" },
|
|
11632
|
-
run:
|
|
11633
|
-
},
|
|
11634
|
-
let n = e.options, r = e.positionals.at(0), i = await q(t, n), a = (await
|
|
11648
|
+
run: mS
|
|
11649
|
+
}, gS = async (e, t) => {
|
|
11650
|
+
let n = e.options, r = e.positionals.at(0), i = await q(t, n), a = (await tS(t, i, await eS({
|
|
11635
11651
|
deps: t,
|
|
11636
11652
|
origin: i,
|
|
11637
11653
|
slug: r,
|
|
@@ -11645,7 +11661,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11645
11661
|
t.stdout(`No version of '${r}' declares an app variable.\n`);
|
|
11646
11662
|
return;
|
|
11647
11663
|
}
|
|
11648
|
-
for (let e of
|
|
11664
|
+
for (let e of nx([
|
|
11649
11665
|
"Name",
|
|
11650
11666
|
"Required",
|
|
11651
11667
|
"Value"
|
|
@@ -11654,7 +11670,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11654
11670
|
e.required ? "yes" : "no",
|
|
11655
11671
|
e.value ?? "Not set"
|
|
11656
11672
|
]))) t.stdout(`${e}\n`);
|
|
11657
|
-
},
|
|
11673
|
+
}, _S = {
|
|
11658
11674
|
path: [
|
|
11659
11675
|
"app",
|
|
11660
11676
|
"var",
|
|
@@ -11672,12 +11688,12 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11672
11688
|
type: "boolean"
|
|
11673
11689
|
}],
|
|
11674
11690
|
result: { type: "app-var-list" },
|
|
11675
|
-
run:
|
|
11676
|
-
},
|
|
11677
|
-
let n = e.options, r = e.positionals.at(0), i = e.positionals.at(1), a = e.positionals.at(2), o = await q(t, n), s = await
|
|
11691
|
+
run: gS
|
|
11692
|
+
}, vS = async (e, t) => {
|
|
11693
|
+
let n = e.options, r = e.positionals.at(0), i = e.positionals.at(1), a = e.positionals.at(2), o = await q(t, n), s = await nS({
|
|
11678
11694
|
deps: t,
|
|
11679
11695
|
origin: o,
|
|
11680
|
-
resolved: await
|
|
11696
|
+
resolved: await eS({
|
|
11681
11697
|
deps: t,
|
|
11682
11698
|
origin: o,
|
|
11683
11699
|
slug: r,
|
|
@@ -11685,14 +11701,14 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11685
11701
|
}),
|
|
11686
11702
|
name: i,
|
|
11687
11703
|
value: a,
|
|
11688
|
-
scope:
|
|
11704
|
+
scope: Zx
|
|
11689
11705
|
});
|
|
11690
11706
|
if (n.json === !0) {
|
|
11691
11707
|
t.stdout(`${JSON.stringify({ variables: s.filter((e) => e.kind === "plain") }, null, 2)}\n`);
|
|
11692
11708
|
return;
|
|
11693
11709
|
}
|
|
11694
11710
|
t.stdout(`Set ${i} for '${r}'. Every site running this app picks it up within five minutes.\n`);
|
|
11695
|
-
},
|
|
11711
|
+
}, yS = {
|
|
11696
11712
|
path: [
|
|
11697
11713
|
"app",
|
|
11698
11714
|
"var",
|
|
@@ -11722,8 +11738,8 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11722
11738
|
type: "boolean"
|
|
11723
11739
|
}],
|
|
11724
11740
|
result: { type: "app-var-set" },
|
|
11725
|
-
run:
|
|
11726
|
-
},
|
|
11741
|
+
run: vS
|
|
11742
|
+
}, bS = async (e) => {
|
|
11727
11743
|
let { deps: t, origin: n, resolved: r, version: i } = e, a = `/developer/organizations/${r.organization.organizationId}/apps/${r.app.appId}/versions`, o = null;
|
|
11728
11744
|
do {
|
|
11729
11745
|
let e = await X(t, n, `${a}${o === null ? "" : `?cursorCreatedAt=${encodeURIComponent(o.createdAt)}&cursorId=${o.id}`}`), r = e.versions.find((e) => e.version === i);
|
|
@@ -11731,23 +11747,23 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11731
11747
|
o = e.nextCursor;
|
|
11732
11748
|
} while (o !== null);
|
|
11733
11749
|
throw new T(`Version ${i} was not found for '${r.app.slug}'.`);
|
|
11734
|
-
},
|
|
11750
|
+
}, xS = (e, t) => {
|
|
11735
11751
|
throw e instanceof ar && e.code === "not_draft" ? new T(`Version ${t} is already ready and can never be cancelled.`) : e instanceof ar && e.code === "not_holder" ? new T("Another publish holds this draft. Cancel it from that checkout, or pass --force as an organization owner.") : e;
|
|
11736
|
-
},
|
|
11737
|
-
let n = e.options, r = e.positionals.at(0), i = e.positionals.at(1), a = Y(n, t), o = await q(t, n), s = await
|
|
11752
|
+
}, SS = async (e, t) => {
|
|
11753
|
+
let n = e.options, r = e.positionals.at(0), i = e.positionals.at(1), a = Y(n, t), o = await q(t, n), s = await ax({
|
|
11738
11754
|
deps: t,
|
|
11739
11755
|
origin: o,
|
|
11740
11756
|
slug: r,
|
|
11741
11757
|
machine: a,
|
|
11742
11758
|
notFound: `App '${r}' was not found in your organizations.`
|
|
11743
|
-
}), c = await
|
|
11759
|
+
}), c = await bS({
|
|
11744
11760
|
deps: t,
|
|
11745
11761
|
origin: o,
|
|
11746
11762
|
resolved: s,
|
|
11747
11763
|
version: i
|
|
11748
11764
|
});
|
|
11749
11765
|
if (c.status === "ready") throw new T(`Version ${i} is ready. A ready version is never cancelled; publish a new version instead.`);
|
|
11750
|
-
let l = u(n.dir ?? "."), d = await
|
|
11766
|
+
let l = u(n.dir ?? "."), d = await Ox(l), f = d !== null && d.appVersionId === c.appVersionId ? d.publishId : null;
|
|
11751
11767
|
if (f === null && n.force !== !0) throw new E("This checkout does not hold this draft. Organization owners can pass --force to release it.");
|
|
11752
11768
|
let p = {
|
|
11753
11769
|
...f === null ? {} : { publishId: f },
|
|
@@ -11759,9 +11775,9 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11759
11775
|
body: p
|
|
11760
11776
|
});
|
|
11761
11777
|
} catch (e) {
|
|
11762
|
-
|
|
11778
|
+
xS(e, i);
|
|
11763
11779
|
}
|
|
11764
|
-
if (f !== null && await
|
|
11780
|
+
if (f !== null && await Ax(l), n.json === !0) {
|
|
11765
11781
|
t.stdout(`${JSON.stringify({
|
|
11766
11782
|
cancelled: !0,
|
|
11767
11783
|
appVersionId: c.appVersionId,
|
|
@@ -11770,7 +11786,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11770
11786
|
return;
|
|
11771
11787
|
}
|
|
11772
11788
|
t.stdout(`Cancelled draft ${r}@${i}. Its version number is free again.\n`);
|
|
11773
|
-
},
|
|
11789
|
+
}, CS = {
|
|
11774
11790
|
path: [
|
|
11775
11791
|
"app",
|
|
11776
11792
|
"version",
|
|
@@ -11805,14 +11821,14 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11805
11821
|
}
|
|
11806
11822
|
],
|
|
11807
11823
|
result: { type: "app-version-cancel" },
|
|
11808
|
-
run:
|
|
11809
|
-
},
|
|
11824
|
+
run: SS
|
|
11825
|
+
}, wS = (e) => {
|
|
11810
11826
|
if (e === void 0) return;
|
|
11811
11827
|
let t = Number.parseInt(e, 10);
|
|
11812
11828
|
if (!Number.isInteger(t) || t < 1 || `${t}` !== e) throw new E("Pass a positive integer to --limit.");
|
|
11813
11829
|
return t;
|
|
11814
|
-
},
|
|
11815
|
-
let n = e.options, r = e.positionals.at(0), i = Y(n, t), a =
|
|
11830
|
+
}, TS = async (e, t) => {
|
|
11831
|
+
let n = e.options, r = e.positionals.at(0), i = Y(n, t), a = wS(n.limit), o = await q(t, n), s = await ax({
|
|
11816
11832
|
deps: t,
|
|
11817
11833
|
origin: o,
|
|
11818
11834
|
slug: r,
|
|
@@ -11831,7 +11847,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11831
11847
|
t.stdout(`No versions yet for '${r}'. Publish one with \`qinto app publish\`.\n`);
|
|
11832
11848
|
return;
|
|
11833
11849
|
}
|
|
11834
|
-
for (let e of
|
|
11850
|
+
for (let e of nx([
|
|
11835
11851
|
"Version",
|
|
11836
11852
|
"Status",
|
|
11837
11853
|
"Ready at",
|
|
@@ -11842,7 +11858,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11842
11858
|
e.status === "ready" ? e.readyAt : "-",
|
|
11843
11859
|
e.createdAt
|
|
11844
11860
|
]))) t.stdout(`${e}\n`);
|
|
11845
|
-
},
|
|
11861
|
+
}, ES = {
|
|
11846
11862
|
path: ["app", "versions"],
|
|
11847
11863
|
description: "List an app’s versions, drafts included",
|
|
11848
11864
|
positionals: [{
|
|
@@ -11864,8 +11880,8 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11864
11880
|
}
|
|
11865
11881
|
],
|
|
11866
11882
|
result: { type: "app-versions" },
|
|
11867
|
-
run:
|
|
11868
|
-
},
|
|
11883
|
+
run: TS
|
|
11884
|
+
}, DS = {
|
|
11869
11885
|
path: ["describe"],
|
|
11870
11886
|
description: "Print a machine-readable description of the CLI commands",
|
|
11871
11887
|
positionals: [{
|
|
@@ -11876,22 +11892,22 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11876
11892
|
}],
|
|
11877
11893
|
options: [],
|
|
11878
11894
|
run: async (e, t) => {
|
|
11879
|
-
let n = e.positionals, r = n.length === 0 ?
|
|
11895
|
+
let n = e.positionals, r = n.length === 0 ? QC : QC.filter((e) => e.path.join(" ") === n.join(" "));
|
|
11880
11896
|
if (r.length === 0) throw new T(`Unknown command: ${n.join(" ")}. Run \`qinto describe\` for the full list.`);
|
|
11881
11897
|
t.stdout(`${JSON.stringify(Or(r), null, 2)}\n`);
|
|
11882
11898
|
}
|
|
11883
|
-
},
|
|
11884
|
-
let n = e.options, r = await q(t, n), i = await
|
|
11899
|
+
}, OS = async (e, t) => {
|
|
11900
|
+
let n = e.options, r = await q(t, n), i = await mx(t, r, await fx(t, r), n.team), a = await lx(t, {
|
|
11885
11901
|
origin: r,
|
|
11886
11902
|
teamId: i.teamId,
|
|
11887
11903
|
reference: e.positionals.at(0),
|
|
11888
11904
|
allowPrompt: !Y(n, t)
|
|
11889
|
-
}), o = await
|
|
11905
|
+
}), o = await ux(t, {
|
|
11890
11906
|
origin: r,
|
|
11891
11907
|
teamId: i.teamId,
|
|
11892
11908
|
domainId: a.domainId
|
|
11893
11909
|
}), s = {
|
|
11894
|
-
status:
|
|
11910
|
+
status: ox(o),
|
|
11895
11911
|
team: i,
|
|
11896
11912
|
site: a,
|
|
11897
11913
|
dns: o
|
|
@@ -11901,9 +11917,9 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11901
11917
|
return;
|
|
11902
11918
|
}
|
|
11903
11919
|
t.stdout(`DNS for ${a.domain}: ${s.status}\n`);
|
|
11904
|
-
for (let e of
|
|
11920
|
+
for (let e of dx(o)) t.stdout(` ${e}\n`);
|
|
11905
11921
|
o.message !== "" && t.stdout(`${o.message}\n`);
|
|
11906
|
-
},
|
|
11922
|
+
}, kS = {
|
|
11907
11923
|
path: ["domain", "dns"],
|
|
11908
11924
|
description: "Re-check DNS for an onboarded site",
|
|
11909
11925
|
positionals: [{
|
|
@@ -11933,36 +11949,36 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11933
11949
|
"unavailable"
|
|
11934
11950
|
]
|
|
11935
11951
|
},
|
|
11936
|
-
run:
|
|
11937
|
-
},
|
|
11952
|
+
run: OS
|
|
11953
|
+
}, AS = ["eu", "us"], jS = [
|
|
11938
11954
|
"wnam",
|
|
11939
11955
|
"enam",
|
|
11940
11956
|
"weur",
|
|
11941
11957
|
"eeur",
|
|
11942
11958
|
"apac",
|
|
11943
11959
|
"oc"
|
|
11944
|
-
],
|
|
11960
|
+
], MS = (e) => {
|
|
11945
11961
|
let t = e.trim(), n = /^[a-z][a-z0-9+.-]*:\/\//i.test(t) ? t : `http://${t}`;
|
|
11946
11962
|
try {
|
|
11947
11963
|
return new URL(n).hostname.replace(/\.$/, "").replace(/^www\./, "");
|
|
11948
11964
|
} catch {
|
|
11949
11965
|
return null;
|
|
11950
11966
|
}
|
|
11951
|
-
},
|
|
11967
|
+
}, NS = (e) => {
|
|
11952
11968
|
let t = [
|
|
11953
11969
|
"qinto",
|
|
11954
11970
|
"domain",
|
|
11955
11971
|
"onboard"
|
|
11956
11972
|
];
|
|
11957
|
-
return e.rootDomain !== void 0 && t.push(
|
|
11958
|
-
},
|
|
11973
|
+
return e.rootDomain !== void 0 && t.push(MS(e.rootDomain) ?? e.rootDomain), e.siteId !== void 0 && t.push("--site", e.siteId), e.hostId !== void 0 && t.push("--mode", "self", "--host-id", e.hostId), e.needsZone === !0 && t.push("--host-zone", "<zone>"), t.push("--team", e.teamId), e.machine && t.push("--no-input", "--json"), t.push(...zp(e.origin)), t.join(" ");
|
|
11974
|
+
}, PS = {
|
|
11959
11975
|
domain: "domain",
|
|
11960
11976
|
"development-url": "development_url"
|
|
11961
|
-
},
|
|
11977
|
+
}, FS = [
|
|
11962
11978
|
"host_setup_pending",
|
|
11963
11979
|
"dns_pending",
|
|
11964
11980
|
"complete"
|
|
11965
|
-
],
|
|
11981
|
+
], IS = async (e) => {
|
|
11966
11982
|
let { deps: t, origin: n, team: r, site: i, dns: a, delivery: o, shared: s, machine: c } = e, l = (e) => {
|
|
11967
11983
|
c || t.stderr(`${e}\n`);
|
|
11968
11984
|
};
|
|
@@ -11983,15 +11999,15 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
11983
11999
|
snippet: await X(t, n, `/teams/${r.teamId}/domains/${i.domainId}/snippet`),
|
|
11984
12000
|
shared: s
|
|
11985
12001
|
};
|
|
11986
|
-
},
|
|
12002
|
+
}, LS = (e) => {
|
|
11987
12003
|
let t = [...new Set(e.split(",").map((e) => e.trim().toLowerCase()).filter((e) => e !== ""))];
|
|
11988
12004
|
return t.length < 1 || t.length > 10 || t.some((e) => !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)) ? null : t;
|
|
11989
|
-
},
|
|
12005
|
+
}, RS = (e) => {
|
|
11990
12006
|
if (e === void 0) return [];
|
|
11991
|
-
let t =
|
|
12007
|
+
let t = LS(e);
|
|
11992
12008
|
if (t === null) throw new E("--share-dns must contain 1–10 comma-separated email addresses.");
|
|
11993
12009
|
return t;
|
|
11994
|
-
},
|
|
12010
|
+
}, zS = async (e) => {
|
|
11995
12011
|
let { deps: t, origin: n, teamId: r, domainId: i, emails: a, submissionId: o } = e;
|
|
11996
12012
|
return a.length === 0 ? 0 : (await X(t, n, `/teams/${r}/domains/${i}/dns/share`, {
|
|
11997
12013
|
method: "POST",
|
|
@@ -12000,11 +12016,11 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12000
12016
|
submissionId: o ?? re()
|
|
12001
12017
|
}
|
|
12002
12018
|
})).sent;
|
|
12003
|
-
},
|
|
12004
|
-
e.stdout(`DNS for ${t.domain}: ${
|
|
12005
|
-
for (let t of
|
|
12019
|
+
}, BS = (e, t, n) => {
|
|
12020
|
+
e.stdout(`DNS for ${t.domain}: ${ox(n)}\n`);
|
|
12021
|
+
for (let t of dx(n)) e.stdout(` ${t}\n`);
|
|
12006
12022
|
n.message !== "" && e.stdout(`${n.message}\n`);
|
|
12007
|
-
},
|
|
12023
|
+
}, VS = (e) => {
|
|
12008
12024
|
let t = [{
|
|
12009
12025
|
name: "Re-check DNS",
|
|
12010
12026
|
value: "recheck"
|
|
@@ -12019,10 +12035,10 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12019
12035
|
name: "Skip DNS for now and finish setup",
|
|
12020
12036
|
value: "skip"
|
|
12021
12037
|
}), t;
|
|
12022
|
-
},
|
|
12023
|
-
let { deps: t, origin: n, teamId: r, domainId: i } = e, a =
|
|
12038
|
+
}, HS = async (e) => {
|
|
12039
|
+
let { deps: t, origin: n, teamId: r, domainId: i } = e, a = LS(await t.prompts.input("Recipient emails, comma-separated"));
|
|
12024
12040
|
if (a === null) return t.stderr("Enter 1–10 comma-separated email addresses.\n"), 0;
|
|
12025
|
-
let o = await
|
|
12041
|
+
let o = await zS({
|
|
12026
12042
|
deps: t,
|
|
12027
12043
|
origin: n,
|
|
12028
12044
|
teamId: r,
|
|
@@ -12030,11 +12046,11 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12030
12046
|
emails: a
|
|
12031
12047
|
});
|
|
12032
12048
|
return t.stderr(`Emailed DNS instructions to ${o} recipient(s).\n`), o;
|
|
12033
|
-
},
|
|
12034
|
-
let t =
|
|
12049
|
+
}, US = (e) => {
|
|
12050
|
+
let t = ox(e);
|
|
12035
12051
|
return t === "verified" || t === "not_required" ? "domain" : null;
|
|
12036
|
-
},
|
|
12037
|
-
let { deps: t, origin: n, team: r, site: i, initialDns: a, options: o, machine: s, initiallyShared: c } = e, l = a, u = c, d = o.delivery === void 0 ? void 0 :
|
|
12052
|
+
}, WS = async (e) => {
|
|
12053
|
+
let { deps: t, origin: n, team: r, site: i, initialDns: a, options: o, machine: s, initiallyShared: c } = e, l = a, u = c, d = o.delivery === void 0 ? void 0 : PS[o.delivery];
|
|
12038
12054
|
if (d === "development_url") {
|
|
12039
12055
|
if (i.developmentUrl === null) throw new E("This host does not provide a development URL.");
|
|
12040
12056
|
return {
|
|
@@ -12048,18 +12064,18 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12048
12064
|
delivery: "domain",
|
|
12049
12065
|
shared: u
|
|
12050
12066
|
};
|
|
12051
|
-
for (; !s && (
|
|
12052
|
-
let e = await t.prompts.select("DNS is not verified yet",
|
|
12067
|
+
for (; !s && (ox(l) === "pending" || ox(l) === "unavailable");) {
|
|
12068
|
+
let e = await t.prompts.select("DNS is not verified yet", VS(i));
|
|
12053
12069
|
if (e === "recheck") {
|
|
12054
|
-
l = await
|
|
12070
|
+
l = await ux(t, {
|
|
12055
12071
|
origin: n,
|
|
12056
12072
|
teamId: r.teamId,
|
|
12057
12073
|
domainId: i.domainId
|
|
12058
|
-
}),
|
|
12074
|
+
}), BS(t, i, l);
|
|
12059
12075
|
continue;
|
|
12060
12076
|
}
|
|
12061
12077
|
if (e === "share") {
|
|
12062
|
-
u += await
|
|
12078
|
+
u += await HS({
|
|
12063
12079
|
deps: t,
|
|
12064
12080
|
origin: n,
|
|
12065
12081
|
teamId: r.teamId,
|
|
@@ -12075,16 +12091,16 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12075
12091
|
}
|
|
12076
12092
|
return {
|
|
12077
12093
|
dns: l,
|
|
12078
|
-
delivery:
|
|
12094
|
+
delivery: US(l),
|
|
12079
12095
|
shared: u
|
|
12080
12096
|
};
|
|
12081
|
-
},
|
|
12082
|
-
let { deps: t, origin: n, team: r, site: i, options: a, machine: o } = e, s = await
|
|
12097
|
+
}, GS = async (e) => {
|
|
12098
|
+
let { deps: t, origin: n, team: r, site: i, options: a, machine: o } = e, s = await ux(t, {
|
|
12083
12099
|
origin: n,
|
|
12084
12100
|
teamId: r.teamId,
|
|
12085
12101
|
domainId: i.domainId
|
|
12086
12102
|
});
|
|
12087
|
-
return o ||
|
|
12103
|
+
return o || BS(t, i, s), WS({
|
|
12088
12104
|
deps: t,
|
|
12089
12105
|
origin: n,
|
|
12090
12106
|
team: r,
|
|
@@ -12092,48 +12108,48 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12092
12108
|
initialDns: s,
|
|
12093
12109
|
options: a,
|
|
12094
12110
|
machine: o,
|
|
12095
|
-
initiallyShared: await
|
|
12111
|
+
initiallyShared: await zS({
|
|
12096
12112
|
deps: t,
|
|
12097
12113
|
origin: n,
|
|
12098
12114
|
teamId: r.teamId,
|
|
12099
12115
|
domainId: i.domainId,
|
|
12100
|
-
emails:
|
|
12116
|
+
emails: RS(a.shareDns),
|
|
12101
12117
|
submissionId: a.shareSubmissionId
|
|
12102
12118
|
})
|
|
12103
12119
|
});
|
|
12104
|
-
},
|
|
12105
|
-
if (e.stdout(`Host setup is pending for ${t.host.name}: ${
|
|
12120
|
+
}, KS = (e) => e === "zone_required" ? "choose a Cloudflare zone for the host." : e === "wfp_sync_failed" ? "Workers for Platforms could not be synced." : `Workers for Platforms could not be synced (${e}).`, qS = (e, t) => {
|
|
12121
|
+
if (e.stdout(`Host setup is pending for ${t.host.name}: ${KS(t.reason)}\n`), t.zoneRequired !== null && t.zoneRequired.length > 0) {
|
|
12106
12122
|
e.stdout("Pick one of these zones and pass --host-zone:\n");
|
|
12107
12123
|
for (let n of t.zoneRequired) e.stdout(` ${n}\n`);
|
|
12108
12124
|
}
|
|
12109
12125
|
e.stdout(`Resume: ${t.resumeCommand}\n`);
|
|
12110
|
-
},
|
|
12126
|
+
}, JS = (e, t, n) => {
|
|
12111
12127
|
if (n) {
|
|
12112
12128
|
e.stdout(`${JSON.stringify(t, null, 2)}\n`);
|
|
12113
12129
|
return;
|
|
12114
12130
|
}
|
|
12115
12131
|
if (t.status === "host_setup_pending") {
|
|
12116
|
-
|
|
12132
|
+
qS(e, t);
|
|
12117
12133
|
return;
|
|
12118
12134
|
}
|
|
12119
|
-
e.stdout(`Site: ${t.site.domain}\nDNS: ${
|
|
12120
|
-
for (let n of
|
|
12135
|
+
e.stdout(`Site: ${t.site.domain}\nDNS: ${ox(t.dns)}\n`);
|
|
12136
|
+
for (let n of dx(t.dns)) e.stdout(` ${n}\n`);
|
|
12121
12137
|
if (t.shared > 0 && e.stdout(`Emailed DNS instructions to ${t.shared} recipient(s).\n`), t.status === "dns_pending") {
|
|
12122
12138
|
e.stdout(`Resume: ${t.resumeCommand}\n`);
|
|
12123
12139
|
return;
|
|
12124
12140
|
}
|
|
12125
12141
|
e.stdout(`Deployment: ${t.deployment.deploymentId} (${t.deployment.version})\n`), e.stdout(`Install this snippet in your site's <head>:\n${t.snippet.snippet}\n`), t.snippet.usingDevelopmentUrl && e.stdout("The snippet serves from the development URL until DNS is verified.\n");
|
|
12126
|
-
},
|
|
12142
|
+
}, YS = {
|
|
12127
12143
|
eu: "European Union",
|
|
12128
12144
|
us: "United States"
|
|
12129
|
-
},
|
|
12145
|
+
}, XS = {
|
|
12130
12146
|
wnam: "Western North America",
|
|
12131
12147
|
enam: "Eastern North America",
|
|
12132
12148
|
weur: "Western Europe",
|
|
12133
12149
|
eeur: "Eastern Europe",
|
|
12134
12150
|
apac: "Asia Pacific",
|
|
12135
12151
|
oc: "Oceania"
|
|
12136
|
-
},
|
|
12152
|
+
}, ZS = (e, t) => {
|
|
12137
12153
|
let n = [
|
|
12138
12154
|
t.hostId,
|
|
12139
12155
|
t.hostName,
|
|
@@ -12150,7 +12166,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12150
12166
|
t.locationHint,
|
|
12151
12167
|
...n
|
|
12152
12168
|
].some((e) => e !== void 0)) throw new E("--site cannot be combined with site creation or host settings.");
|
|
12153
|
-
},
|
|
12169
|
+
}, QS = (e, t) => {
|
|
12154
12170
|
if ([
|
|
12155
12171
|
e.hostId,
|
|
12156
12172
|
e.hostName,
|
|
@@ -12161,13 +12177,13 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12161
12177
|
if (e.hostId !== void 0 && (e.hostName !== void 0 || e.cloudflareAccountId !== void 0)) throw new E("--host-id cannot be combined with new-host settings.");
|
|
12162
12178
|
if (e.hostId !== void 0 && e.workersForPlatforms === !0) throw new E("--workers-for-platforms is available only when creating a new host.");
|
|
12163
12179
|
if (t && e.mode === "self" && e.hostId === void 0 && (e.hostName === void 0 || e.cloudflareAccountId === void 0)) throw new E("Self-hosting requires --host-id, or both --host-name and --cloudflare-account-id.");
|
|
12164
|
-
},
|
|
12180
|
+
}, $S = (e) => {
|
|
12165
12181
|
if (e.shareSubmissionId !== void 0 && e.shareDns === void 0) throw new E("--share-submission-id requires --share-dns.");
|
|
12166
12182
|
if (e.shareSubmissionId !== void 0 && !/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e.shareSubmissionId)) throw new E("--share-submission-id must be a UUID.");
|
|
12167
|
-
|
|
12168
|
-
},
|
|
12169
|
-
if (
|
|
12170
|
-
},
|
|
12183
|
+
RS(e.shareDns);
|
|
12184
|
+
}, eC = (e, t, n) => {
|
|
12185
|
+
if (ZS(e, t), QS(t, n), $S(t), n && t.site === void 0 && e === void 0) throw new E("Pass [rootDomain] or --site in non-interactive mode.");
|
|
12186
|
+
}, tC = async (e, t, n, r) => {
|
|
12171
12187
|
let i = t ?? await e.prompts.input("Customer root domain");
|
|
12172
12188
|
if (i.trim() === "") throw new E("The customer root domain cannot be empty.");
|
|
12173
12189
|
let a = n.mode ?? (r ? "managed" : await e.prompts.select("Hosting mode", [{
|
|
@@ -12180,14 +12196,14 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12180
12196
|
return !r && (o !== void 0 || s !== void 0 || c !== void 0 || l !== void 0 || await e.prompts.confirm("Configure advanced site settings?", !1)) && (o ??= await e.prompts.input("Site display name", i), s ??= await e.prompts.input("Site subdomain (leave blank for automatic)") || void 0, c ??= await e.prompts.select("Data jurisdiction", [{
|
|
12181
12197
|
name: "Automatic",
|
|
12182
12198
|
value: ""
|
|
12183
|
-
}, ...
|
|
12184
|
-
name:
|
|
12199
|
+
}, ...AS.map((e) => ({
|
|
12200
|
+
name: YS[e],
|
|
12185
12201
|
value: e
|
|
12186
12202
|
}))]) || void 0, l ??= await e.prompts.select("Location hint", [{
|
|
12187
12203
|
name: "Automatic",
|
|
12188
12204
|
value: ""
|
|
12189
|
-
}, ...
|
|
12190
|
-
name:
|
|
12205
|
+
}, ...jS.map((e) => ({
|
|
12206
|
+
name: XS[e],
|
|
12191
12207
|
value: e
|
|
12192
12208
|
}))]) || void 0), {
|
|
12193
12209
|
rootDomain: i,
|
|
@@ -12197,7 +12213,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12197
12213
|
jurisdiction: c,
|
|
12198
12214
|
locationHint: l
|
|
12199
12215
|
};
|
|
12200
|
-
},
|
|
12216
|
+
}, nC = async (e) => {
|
|
12201
12217
|
let { deps: t, origin: n, teamId: r, hostId: i, zoneDomain: a } = e;
|
|
12202
12218
|
return {
|
|
12203
12219
|
...await X(t, n, `/teams/${r}/hosts/${i}/zone`, {
|
|
@@ -12206,23 +12222,23 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12206
12222
|
}),
|
|
12207
12223
|
zoneRequired: null
|
|
12208
12224
|
};
|
|
12209
|
-
},
|
|
12225
|
+
}, rC = async (e) => {
|
|
12210
12226
|
let { deps: t, created: n, options: r, machine: i } = e;
|
|
12211
12227
|
if (!(n.host.zoneDomain !== null || n.zoneRequired === null)) return r.hostZone !== void 0 || i ? r.hostZone : n.zoneRequired.length === 0 ? t.prompts.input("Cloudflare zone domain") : t.prompts.select("Choose the Cloudflare zone for this host", n.zoneRequired.map((e) => ({
|
|
12212
12228
|
name: e,
|
|
12213
12229
|
value: e
|
|
12214
12230
|
})));
|
|
12215
|
-
},
|
|
12216
|
-
let t = await
|
|
12217
|
-
return t === void 0 ? e.created :
|
|
12231
|
+
}, iC = async (e) => {
|
|
12232
|
+
let t = await rC(e);
|
|
12233
|
+
return t === void 0 ? e.created : nC({
|
|
12218
12234
|
deps: e.deps,
|
|
12219
12235
|
origin: e.origin,
|
|
12220
12236
|
teamId: e.teamId,
|
|
12221
12237
|
hostId: e.created.host.hostId,
|
|
12222
12238
|
zoneDomain: t
|
|
12223
12239
|
});
|
|
12224
|
-
},
|
|
12225
|
-
let t = await
|
|
12240
|
+
}, aC = async (e) => {
|
|
12241
|
+
let t = await iC(e), n = t.host.zoneDomain === null ? "zone_required" : t.wfpSync?.pushed === !1 ? t.wfpSync.reason ?? "wfp_sync_failed" : null;
|
|
12226
12242
|
return n === null ? {
|
|
12227
12243
|
status: "ready",
|
|
12228
12244
|
hostId: t.host.hostId
|
|
@@ -12231,7 +12247,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12231
12247
|
host: t.host,
|
|
12232
12248
|
zoneRequired: t.zoneRequired,
|
|
12233
12249
|
reason: n,
|
|
12234
|
-
resumeCommand:
|
|
12250
|
+
resumeCommand: NS({
|
|
12235
12251
|
origin: e.origin,
|
|
12236
12252
|
teamId: e.teamId,
|
|
12237
12253
|
rootDomain: e.rootDomain,
|
|
@@ -12240,7 +12256,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12240
12256
|
machine: e.machine
|
|
12241
12257
|
})
|
|
12242
12258
|
};
|
|
12243
|
-
},
|
|
12259
|
+
}, oC = async (e, t) => {
|
|
12244
12260
|
if (e.options.hostId !== void 0 || e.machine || t.length === 0) return e.options.hostId;
|
|
12245
12261
|
let n = await e.deps.prompts.select("Choose a Cloudflare host", [...t.map((e) => ({
|
|
12246
12262
|
name: `${e.name} (${e.accountId})`,
|
|
@@ -12250,7 +12266,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12250
12266
|
value: "__new__"
|
|
12251
12267
|
}]);
|
|
12252
12268
|
return n === "__new__" ? void 0 : n;
|
|
12253
|
-
},
|
|
12269
|
+
}, sC = async (e, t, n) => {
|
|
12254
12270
|
let r = t.find((e) => e.hostId === n);
|
|
12255
12271
|
if (r === void 0) throw new E(`Host ${n} is not available in team ${e.teamId}.`);
|
|
12256
12272
|
let i = {
|
|
@@ -12258,7 +12274,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12258
12274
|
zoneRequired: r.zoneDomain === null ? [] : null,
|
|
12259
12275
|
wfpSync: null
|
|
12260
12276
|
};
|
|
12261
|
-
if (r.zoneDomain === null && e.options.hostZone !== void 0) i = await
|
|
12277
|
+
if (r.zoneDomain === null && e.options.hostZone !== void 0) i = await nC({
|
|
12262
12278
|
deps: e.deps,
|
|
12263
12279
|
origin: e.origin,
|
|
12264
12280
|
teamId: e.teamId,
|
|
@@ -12272,19 +12288,19 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12272
12288
|
wfpSync: t.wfpSync
|
|
12273
12289
|
};
|
|
12274
12290
|
}
|
|
12275
|
-
return
|
|
12291
|
+
return aC({
|
|
12276
12292
|
...e,
|
|
12277
12293
|
created: i
|
|
12278
12294
|
});
|
|
12279
|
-
},
|
|
12295
|
+
}, cC = async (e, t, n) => {
|
|
12280
12296
|
let r = await t();
|
|
12281
12297
|
for (; r.trim() === "";) e.stderr(`${n}\n`), r = await t();
|
|
12282
12298
|
return r;
|
|
12283
|
-
},
|
|
12284
|
-
let { deps: t, origin: n, teamId: r, options: i, machine: a } = e, o = i.hostName ?? await
|
|
12299
|
+
}, lC = async (e) => {
|
|
12300
|
+
let { deps: t, origin: n, teamId: r, options: i, machine: a } = e, o = i.hostName ?? await cC(t, () => t.prompts.input("Host display name"), "A host display name is required."), s = i.cloudflareAccountId ?? await cC(t, () => t.prompts.input("Cloudflare account ID"), "A Cloudflare account ID is required."), c = t.env.QINTO_CLOUDFLARE_API_TOKEN, l = c === void 0 || c === "" ? void 0 : c;
|
|
12285
12301
|
if (l === void 0) {
|
|
12286
12302
|
if (a) throw new E("Set QINTO_CLOUDFLARE_API_TOKEN when creating a self-host in non-interactive mode.");
|
|
12287
|
-
l = await
|
|
12303
|
+
l = await cC(t, () => t.prompts.password("Cloudflare API token"), "A Cloudflare API token is required.");
|
|
12288
12304
|
}
|
|
12289
12305
|
let u = await X(t, n, `/teams/${r}/hosts`, {
|
|
12290
12306
|
method: "POST",
|
|
@@ -12295,20 +12311,20 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12295
12311
|
wfp: i.workersForPlatforms === !0
|
|
12296
12312
|
}
|
|
12297
12313
|
});
|
|
12298
|
-
return
|
|
12314
|
+
return aC({
|
|
12299
12315
|
...e,
|
|
12300
12316
|
created: u
|
|
12301
12317
|
});
|
|
12302
|
-
},
|
|
12303
|
-
let t = (await X(e.deps, e.origin, `/teams/${e.teamId}/hosts`)).hosts, n = await
|
|
12304
|
-
return n === void 0 ?
|
|
12305
|
-
},
|
|
12318
|
+
}, uC = async (e) => {
|
|
12319
|
+
let t = (await X(e.deps, e.origin, `/teams/${e.teamId}/hosts`)).hosts, n = await oC(e, t);
|
|
12320
|
+
return n === void 0 ? lC(e) : sC(e, t, n);
|
|
12321
|
+
}, dC = async (e) => {
|
|
12306
12322
|
let { deps: t, candidates: n, hostname: r, machine: i } = e, a = n.find((e) => e.domain === r);
|
|
12307
12323
|
if (a === void 0) return null;
|
|
12308
12324
|
if (i) throw new E(`Site ${r} already exists. Pass --site ${a.domainId} to resume it.`);
|
|
12309
12325
|
if (!await t.prompts.confirm(`Resume onboarding for ${r} (site ${a.domainId})?`, !0)) throw new E(`Site ${r} already exists. Pass a different --subdomain, or --site ${a.domainId} to resume it.`);
|
|
12310
12326
|
return a;
|
|
12311
|
-
},
|
|
12327
|
+
}, fC = async (e) => {
|
|
12312
12328
|
let { deps: t, candidates: n, rootDomain: r, machine: i } = e;
|
|
12313
12329
|
if (i) throw new E(`Sites for ${r} already exist (${n.map((e) => e.domainId).join(", ")}). Pass --site <siteId> to resume one, or --subdomain to create a new site.`);
|
|
12314
12330
|
let a = await t.prompts.select(`${r} already has sites`, [...n.map((e) => ({
|
|
@@ -12319,12 +12335,12 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12319
12335
|
value: "__new__"
|
|
12320
12336
|
}]);
|
|
12321
12337
|
return a === "__new__" ? null : n.find((e) => e.domainId === a);
|
|
12322
|
-
},
|
|
12323
|
-
let { deps: t, origin: n, teamId: r, siteInput: i, machine: a } = e, o =
|
|
12338
|
+
}, pC = async (e) => {
|
|
12339
|
+
let { deps: t, origin: n, teamId: r, siteInput: i, machine: a } = e, o = MS(i.rootDomain);
|
|
12324
12340
|
if (o === null) return null;
|
|
12325
12341
|
let s;
|
|
12326
12342
|
try {
|
|
12327
|
-
s = await
|
|
12343
|
+
s = await sx(t, n, r);
|
|
12328
12344
|
} catch (e) {
|
|
12329
12345
|
if (e instanceof ar && e.code === "forbidden") return null;
|
|
12330
12346
|
throw e;
|
|
@@ -12332,28 +12348,28 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12332
12348
|
let c = s.filter((e) => e.rootDomain === o);
|
|
12333
12349
|
if (c.length === 0) return null;
|
|
12334
12350
|
let l = i.subdomain?.trim().toLowerCase();
|
|
12335
|
-
return l !== void 0 && l !== "" ?
|
|
12351
|
+
return l !== void 0 && l !== "" ? dC({
|
|
12336
12352
|
deps: t,
|
|
12337
12353
|
candidates: c,
|
|
12338
12354
|
hostname: `${l}.${o}`,
|
|
12339
12355
|
machine: a
|
|
12340
|
-
}) :
|
|
12356
|
+
}) : fC({
|
|
12341
12357
|
deps: t,
|
|
12342
12358
|
candidates: c,
|
|
12343
12359
|
rootDomain: o,
|
|
12344
12360
|
machine: a
|
|
12345
12361
|
});
|
|
12346
|
-
},
|
|
12362
|
+
}, mC = async (e) => {
|
|
12347
12363
|
let { deps: t, origin: n, teamId: r, rootDomain: i, options: a, machine: o } = e;
|
|
12348
12364
|
if (a.site !== void 0) return {
|
|
12349
12365
|
status: "ready",
|
|
12350
|
-
site: await
|
|
12366
|
+
site: await lx(t, {
|
|
12351
12367
|
origin: n,
|
|
12352
12368
|
teamId: r,
|
|
12353
12369
|
reference: a.site
|
|
12354
12370
|
})
|
|
12355
12371
|
};
|
|
12356
|
-
let s = await
|
|
12372
|
+
let s = await tC(t, i, a, o), c = await pC({
|
|
12357
12373
|
deps: t,
|
|
12358
12374
|
origin: n,
|
|
12359
12375
|
teamId: r,
|
|
@@ -12366,7 +12382,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12366
12382
|
};
|
|
12367
12383
|
let l;
|
|
12368
12384
|
if (s.mode === "self") {
|
|
12369
|
-
let e = await
|
|
12385
|
+
let e = await uC({
|
|
12370
12386
|
deps: t,
|
|
12371
12387
|
origin: n,
|
|
12372
12388
|
teamId: r,
|
|
@@ -12385,7 +12401,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12385
12401
|
}
|
|
12386
12402
|
});
|
|
12387
12403
|
if (!o) {
|
|
12388
|
-
let e =
|
|
12404
|
+
let e = NS({
|
|
12389
12405
|
origin: n,
|
|
12390
12406
|
teamId: r,
|
|
12391
12407
|
siteId: u.site.domainId,
|
|
@@ -12397,27 +12413,27 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12397
12413
|
status: "ready",
|
|
12398
12414
|
site: u.site
|
|
12399
12415
|
};
|
|
12400
|
-
},
|
|
12416
|
+
}, hC = async (e) => {
|
|
12401
12417
|
let { deps: t, origin: n, teams: r, options: i, machine: a } = e;
|
|
12402
|
-
if (i.team !== void 0 || a) return
|
|
12418
|
+
if (i.team !== void 0 || a) return mx(t, n, r, i.team);
|
|
12403
12419
|
if (r.length === 0) throw new E("This credential has no authorized teams.");
|
|
12404
12420
|
let o = await Kp(t, n), s = o === null ? void 0 : r.find((e) => e.teamId === o);
|
|
12405
12421
|
if (s !== void 0 && await t.prompts.confirm(`Use active team ${s.name ?? s.teamId} (${s.teamId})?`, !0)) return s;
|
|
12406
|
-
let c =
|
|
12422
|
+
let c = px(r, await t.prompts.select("Choose the team to onboard", r.map((e) => ({
|
|
12407
12423
|
name: `${e.name ?? "Untitled team"} (${e.teamId})`,
|
|
12408
12424
|
value: e.teamId
|
|
12409
12425
|
})), s?.teamId));
|
|
12410
12426
|
return await qp(t, n, c.teamId), c;
|
|
12411
|
-
},
|
|
12427
|
+
}, gC = async (e, t) => {
|
|
12412
12428
|
let n = e.options, r = e.positionals.at(0), i = Y(n, t);
|
|
12413
|
-
|
|
12414
|
-
let a = await q(t, n), o = await
|
|
12429
|
+
eC(r, n, i);
|
|
12430
|
+
let a = await q(t, n), o = await hC({
|
|
12415
12431
|
deps: t,
|
|
12416
12432
|
origin: a,
|
|
12417
|
-
teams: await
|
|
12433
|
+
teams: await fx(t, a),
|
|
12418
12434
|
options: n,
|
|
12419
12435
|
machine: i
|
|
12420
|
-
}), s = await
|
|
12436
|
+
}), s = await mC({
|
|
12421
12437
|
deps: t,
|
|
12422
12438
|
origin: a,
|
|
12423
12439
|
teamId: o.teamId,
|
|
@@ -12426,7 +12442,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12426
12442
|
machine: i
|
|
12427
12443
|
});
|
|
12428
12444
|
if (s.status === "host_setup_pending") {
|
|
12429
|
-
|
|
12445
|
+
JS(t, {
|
|
12430
12446
|
...s,
|
|
12431
12447
|
team: o
|
|
12432
12448
|
}, n.json === !0);
|
|
@@ -12434,7 +12450,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12434
12450
|
}
|
|
12435
12451
|
let { site: c } = s;
|
|
12436
12452
|
try {
|
|
12437
|
-
let e = await
|
|
12453
|
+
let e = await GS({
|
|
12438
12454
|
deps: t,
|
|
12439
12455
|
origin: a,
|
|
12440
12456
|
team: o,
|
|
@@ -12443,13 +12459,13 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12443
12459
|
machine: i
|
|
12444
12460
|
});
|
|
12445
12461
|
if (e.delivery === null) {
|
|
12446
|
-
|
|
12462
|
+
JS(t, {
|
|
12447
12463
|
status: "dns_pending",
|
|
12448
12464
|
team: o,
|
|
12449
12465
|
site: c,
|
|
12450
12466
|
dns: e.dns,
|
|
12451
12467
|
shared: e.shared,
|
|
12452
|
-
resumeCommand:
|
|
12468
|
+
resumeCommand: NS({
|
|
12453
12469
|
origin: a,
|
|
12454
12470
|
teamId: o.teamId,
|
|
12455
12471
|
siteId: c.domainId,
|
|
@@ -12458,7 +12474,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12458
12474
|
}, n.json === !0);
|
|
12459
12475
|
return;
|
|
12460
12476
|
}
|
|
12461
|
-
|
|
12477
|
+
JS(t, await IS({
|
|
12462
12478
|
deps: t,
|
|
12463
12479
|
origin: a,
|
|
12464
12480
|
team: o,
|
|
@@ -12469,7 +12485,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12469
12485
|
machine: i
|
|
12470
12486
|
}), n.json === !0);
|
|
12471
12487
|
} catch (e) {
|
|
12472
|
-
let n =
|
|
12488
|
+
let n = NS({
|
|
12473
12489
|
origin: a,
|
|
12474
12490
|
teamId: o.teamId,
|
|
12475
12491
|
siteId: c.domainId,
|
|
@@ -12477,7 +12493,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12477
12493
|
}), r = `Onboarding did not finish for site ${c.domainId}. Resume with: ${n}`;
|
|
12478
12494
|
throw i ? (e instanceof Error && (e.message = `${e.message} ${r}`), e) : (t.stderr(`${r}\n`), e);
|
|
12479
12495
|
}
|
|
12480
|
-
},
|
|
12496
|
+
}, _C = {
|
|
12481
12497
|
path: ["domain", "onboard"],
|
|
12482
12498
|
description: "Onboard a domain through DNS, deployment, and snippet installation",
|
|
12483
12499
|
positionals: [{
|
|
@@ -12512,19 +12528,19 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12512
12528
|
flag: "--jurisdiction <jurisdiction>",
|
|
12513
12529
|
description: "Choose the EU or US data jurisdiction",
|
|
12514
12530
|
type: "string",
|
|
12515
|
-
enum:
|
|
12531
|
+
enum: AS
|
|
12516
12532
|
},
|
|
12517
12533
|
{
|
|
12518
12534
|
flag: "--location-hint <locationHint>",
|
|
12519
12535
|
description: "Place site state near a Cloudflare region",
|
|
12520
12536
|
type: "string",
|
|
12521
|
-
enum:
|
|
12537
|
+
enum: jS
|
|
12522
12538
|
},
|
|
12523
12539
|
{
|
|
12524
12540
|
flag: "--delivery <delivery>",
|
|
12525
12541
|
description: "Serve from the customer domain or a development URL",
|
|
12526
12542
|
type: "string",
|
|
12527
|
-
enum: Object.keys(
|
|
12543
|
+
enum: Object.keys(PS)
|
|
12528
12544
|
},
|
|
12529
12545
|
{
|
|
12530
12546
|
flag: "--site <siteId>",
|
|
@@ -12588,10 +12604,10 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12588
12604
|
}],
|
|
12589
12605
|
result: {
|
|
12590
12606
|
type: "domain-onboarding",
|
|
12591
|
-
statuses:
|
|
12607
|
+
statuses: FS
|
|
12592
12608
|
},
|
|
12593
|
-
run:
|
|
12594
|
-
},
|
|
12609
|
+
run: gC
|
|
12610
|
+
}, vC = (e, t, n) => {
|
|
12595
12611
|
if (n) {
|
|
12596
12612
|
e.stdout(`${JSON.stringify({
|
|
12597
12613
|
environment: t,
|
|
@@ -12600,11 +12616,11 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12600
12616
|
return;
|
|
12601
12617
|
}
|
|
12602
12618
|
e.stdout(`${t} (${Fp[t]})\n`);
|
|
12603
|
-
},
|
|
12619
|
+
}, yC = (e) => {
|
|
12604
12620
|
let t = Pp.find((t) => t === e);
|
|
12605
12621
|
if (t === void 0) throw new E(`Unknown environment: ${e}. Choose ${Pp.join(" or ")}.`);
|
|
12606
12622
|
return t;
|
|
12607
|
-
},
|
|
12623
|
+
}, bC = {
|
|
12608
12624
|
path: ["env"],
|
|
12609
12625
|
description: "Show or set the Qinto environment every other command talks to",
|
|
12610
12626
|
positionals: [{
|
|
@@ -12621,18 +12637,18 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12621
12637
|
run: async (e, t) => {
|
|
12622
12638
|
let n = e.options, r = n.json === !0, i = await Lp(t) ?? "production", a = e.positionals.at(0);
|
|
12623
12639
|
if (a === void 0 && Y(n, t)) {
|
|
12624
|
-
|
|
12640
|
+
vC(t, i, r);
|
|
12625
12641
|
return;
|
|
12626
12642
|
}
|
|
12627
|
-
let o =
|
|
12643
|
+
let o = yC(a ?? await t.prompts.select("Choose the Qinto environment", Pp.map((e) => ({
|
|
12628
12644
|
name: `${e} (${Fp[e]})`,
|
|
12629
12645
|
value: e
|
|
12630
12646
|
})), i));
|
|
12631
|
-
await Rp(t, o),
|
|
12647
|
+
await Rp(t, o), vC(t, o, r);
|
|
12632
12648
|
let s = Fp[o];
|
|
12633
12649
|
!r && await Gp(t, s) === null && t.stderr(`You are not logged in to ${o}. Run \`${Bp(s)}\`.\n`);
|
|
12634
12650
|
}
|
|
12635
|
-
},
|
|
12651
|
+
}, xC = [
|
|
12636
12652
|
"body{margin:0;box-sizing:border-box;min-height:100vh;display:grid;place-items:center;padding:40px 16px;",
|
|
12637
12653
|
"background:#fffdf9;color:#101828;font-family:ui-sans-serif,system-ui,-apple-system,\"Segoe UI\",Roboto,sans-serif}",
|
|
12638
12654
|
".mark{width:56px;height:56px;margin:0 auto 24px;display:grid;place-items:center;border-radius:16px;",
|
|
@@ -12642,14 +12658,14 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12642
12658
|
"border:1px solid rgba(232,213,196,.6);box-shadow:0 1px 2px rgba(16,24,40,.05)}",
|
|
12643
12659
|
"h1{margin:0;font-size:20px;line-height:1.4;font-weight:700}",
|
|
12644
12660
|
"p{margin:8px 0 0;font-size:14px;line-height:1.5;color:#6a7282}"
|
|
12645
|
-
].join(""),
|
|
12661
|
+
].join(""), SC = (e, t) => [
|
|
12646
12662
|
"<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\">",
|
|
12647
12663
|
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><title>Qinto CLI</title>",
|
|
12648
|
-
`<style>${
|
|
12664
|
+
`<style>${xC}</style></head><body><main>`,
|
|
12649
12665
|
"<div class=\"mark\">Q</div>",
|
|
12650
12666
|
`<div class="card"><h1>${e}</h1><p>${t}</p></div>`,
|
|
12651
12667
|
"</main></body></html>"
|
|
12652
|
-
].join(""),
|
|
12668
|
+
].join(""), CC = async (e, t) => {
|
|
12653
12669
|
let { promise: n, resolve: r, reject: i } = Promise.withResolvers();
|
|
12654
12670
|
n.catch(() => {});
|
|
12655
12671
|
let a = we(), o, s = !1, c = () => {
|
|
@@ -12666,7 +12682,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12666
12682
|
return;
|
|
12667
12683
|
}
|
|
12668
12684
|
let i = (e, t, r) => {
|
|
12669
|
-
n.writeHead(e, { "content-type": "text/html; charset=utf-8" }).end(
|
|
12685
|
+
n.writeHead(e, { "content-type": "text/html; charset=utf-8" }).end(SC(t, r));
|
|
12670
12686
|
};
|
|
12671
12687
|
if (r.searchParams.get("state") !== e) {
|
|
12672
12688
|
i(400, "This login response does not match", "Close this tab and run the login command again."), u(new T("State mismatch in the login response. Run `qinto login` again."));
|
|
@@ -12709,25 +12725,25 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12709
12725
|
u(new T("Browser login callback closed."));
|
|
12710
12726
|
}
|
|
12711
12727
|
};
|
|
12712
|
-
},
|
|
12728
|
+
}, wC = (e) => te("sha256").update(e).digest("base64url"), TC = () => {
|
|
12713
12729
|
let e = ne(32).toString("base64url");
|
|
12714
12730
|
return {
|
|
12715
12731
|
verifier: e,
|
|
12716
|
-
challenge:
|
|
12732
|
+
challenge: wC(e),
|
|
12717
12733
|
state: ne(16).toString("base64url")
|
|
12718
12734
|
};
|
|
12719
|
-
},
|
|
12735
|
+
}, EC = (e) => {
|
|
12720
12736
|
let t = Number(e);
|
|
12721
12737
|
if (!Number.isFinite(t) || t <= 0) throw new T(`Invalid --timeout value: ${e}`);
|
|
12722
12738
|
return t * 1e3;
|
|
12723
|
-
},
|
|
12739
|
+
}, DC = (e, t) => e === void 0 ? nm(t).join(" ") : e.split(/[\s,]+/).filter((e) => e !== "").join(" "), OC = async (e, t, n) => {
|
|
12724
12740
|
try {
|
|
12725
12741
|
let r = await Qp(e, new URL("/me", t), { headers: { authorization: `Bearer ${n}` } });
|
|
12726
12742
|
return r.ok ? await r.json() : null;
|
|
12727
12743
|
} catch {
|
|
12728
12744
|
return null;
|
|
12729
12745
|
}
|
|
12730
|
-
},
|
|
12746
|
+
}, kC = async (e, t, n, r) => {
|
|
12731
12747
|
if (n === null || n.teams.length === 0) return null;
|
|
12732
12748
|
let i = await Kp(e, t), a = r === void 0 ? void 0 : n.teams.find((e) => e.teamId === r), o = i === null ? void 0 : n.teams.find((e) => e.teamId === i), s = a ?? o;
|
|
12733
12749
|
if (s === void 0 && n.teams.length === 1 && (s = n.teams[0]), s === void 0 && e.interactive) {
|
|
@@ -12738,7 +12754,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12738
12754
|
s = n.teams.find((e) => e.teamId === t);
|
|
12739
12755
|
}
|
|
12740
12756
|
return s === void 0 ? null : (await qp(e, t, s.teamId), s.name ?? s.teamId);
|
|
12741
|
-
},
|
|
12757
|
+
}, AC = async (e, t, n) => {
|
|
12742
12758
|
let r = !1;
|
|
12743
12759
|
try {
|
|
12744
12760
|
await Wp(e, async (i) => {
|
|
@@ -12767,10 +12783,10 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12767
12783
|
}
|
|
12768
12784
|
throw t;
|
|
12769
12785
|
}
|
|
12770
|
-
},
|
|
12771
|
-
let n = e.options, r = await q(t, n), i =
|
|
12786
|
+
}, jC = async (e, t) => {
|
|
12787
|
+
let n = e.options, r = await q(t, n), i = EC(n.timeout), a = t.env.QINTO_API_TOKEN;
|
|
12772
12788
|
a !== void 0 && a !== "" && t.stderr("Note: QINTO_API_TOKEN is set and takes precedence over stored logins.\n");
|
|
12773
|
-
let o = await tm(t, r), s =
|
|
12789
|
+
let o = await tm(t, r), s = DC(n.scopes, o.scopesSupported), c = TC(), l = await CC(c.state, i), u;
|
|
12774
12790
|
try {
|
|
12775
12791
|
let e = rm({
|
|
12776
12792
|
authorizationEndpoint: o.authorizationEndpoint,
|
|
@@ -12796,7 +12812,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12796
12812
|
redirect_uri: l.redirectUri,
|
|
12797
12813
|
code_verifier: c.verifier
|
|
12798
12814
|
});
|
|
12799
|
-
await
|
|
12815
|
+
await AC(t, r, {
|
|
12800
12816
|
accessToken: d.accessToken,
|
|
12801
12817
|
refreshToken: d.refreshToken,
|
|
12802
12818
|
expiresAt: t.now() + d.expiresIn * 1e3,
|
|
@@ -12804,9 +12820,9 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12804
12820
|
tokenEndpoint: o.tokenEndpoint,
|
|
12805
12821
|
revocationEndpoint: o.revocationEndpoint
|
|
12806
12822
|
});
|
|
12807
|
-
let f = await
|
|
12823
|
+
let f = await OC(t, r, d.accessToken), p = await kC(t, r, f, n.team), m = f?.user === null || f?.user === void 0 ? `Logged in to ${r}` : `Logged in as ${f.user.email}`;
|
|
12808
12824
|
t.stdout(`${m}${p === null ? "." : ` (active team ${p}).`}\n`);
|
|
12809
|
-
},
|
|
12825
|
+
}, MC = {
|
|
12810
12826
|
path: ["login"],
|
|
12811
12827
|
description: "Log in to the Qinto platform through your browser",
|
|
12812
12828
|
positionals: [],
|
|
@@ -12839,8 +12855,8 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12839
12855
|
default: "300"
|
|
12840
12856
|
}
|
|
12841
12857
|
],
|
|
12842
|
-
run:
|
|
12843
|
-
},
|
|
12858
|
+
run: jC
|
|
12859
|
+
}, NC = async (e, t) => {
|
|
12844
12860
|
let n = e.options, r = await q(t, n), i = t.env.QINTO_API_TOKEN;
|
|
12845
12861
|
i !== void 0 && i !== "" && t.stderr("Note: QINTO_API_TOKEN cannot be logged out; unset it in your shell.\n");
|
|
12846
12862
|
let a = await Wp(t, async (e) => {
|
|
@@ -12865,40 +12881,40 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12865
12881
|
return;
|
|
12866
12882
|
}
|
|
12867
12883
|
t.stdout(a === "pending" ? `Revoked the sessions left pending for ${r}.\n` : `Logged out of ${r}.\n`);
|
|
12868
|
-
},
|
|
12884
|
+
}, PC = {
|
|
12869
12885
|
path: ["logout"],
|
|
12870
12886
|
description: "Revoke the current login and clear stored credentials",
|
|
12871
12887
|
positionals: [],
|
|
12872
12888
|
options: [...J],
|
|
12873
|
-
run:
|
|
12874
|
-
},
|
|
12889
|
+
run: NC
|
|
12890
|
+
}, FC = (e, t, n) => {
|
|
12875
12891
|
if (n) {
|
|
12876
12892
|
e.stdout(`${JSON.stringify({ activeTeam: t }, null, 2)}\n`);
|
|
12877
12893
|
return;
|
|
12878
12894
|
}
|
|
12879
12895
|
e.stdout(t === null ? "No active team is selected.\n" : `${t.name ?? t.teamId} (${t.teamId})\n`);
|
|
12880
|
-
},
|
|
12896
|
+
}, IC = async (e, t, n, r) => {
|
|
12881
12897
|
let i = await Kp(e, t);
|
|
12882
|
-
|
|
12883
|
-
},
|
|
12884
|
-
let n = e.options, r = await q(t, n), i = await
|
|
12898
|
+
FC(e, i === null ? null : n.find((e) => e.teamId === i) ?? null, r);
|
|
12899
|
+
}, LC = async (e, t) => {
|
|
12900
|
+
let n = e.options, r = await q(t, n), i = await fx(t, r), a = e.positionals.at(0);
|
|
12885
12901
|
if (a === void 0 && Y(n, t)) {
|
|
12886
|
-
await
|
|
12902
|
+
await IC(t, r, i, n.json === !0);
|
|
12887
12903
|
return;
|
|
12888
12904
|
}
|
|
12889
12905
|
if (i.length === 0) throw new E("This credential has no authorized teams.");
|
|
12890
12906
|
let o = a;
|
|
12891
12907
|
if (o === void 0) {
|
|
12892
12908
|
let e = await Kp(t, r), n = e === null ? void 0 : i.find((t) => t.teamId === e);
|
|
12893
|
-
if (n !== void 0 && (
|
|
12909
|
+
if (n !== void 0 && (FC(t, n, !1), !await t.prompts.confirm("Change the active team?", !1))) return;
|
|
12894
12910
|
o = await t.prompts.select("Choose the active team", i.map((e) => ({
|
|
12895
12911
|
name: `${e.name ?? "Untitled team"} (${e.teamId})`,
|
|
12896
12912
|
value: e.teamId
|
|
12897
12913
|
})), n?.teamId);
|
|
12898
12914
|
}
|
|
12899
|
-
let s =
|
|
12915
|
+
let s = px(i, o);
|
|
12900
12916
|
await qp(t, r, s.teamId), n.json === !0 ? t.stdout(`${JSON.stringify({ activeTeam: s }, null, 2)}\n`) : t.stdout(`Active team: ${s.name ?? s.teamId} (${s.teamId})\n`);
|
|
12901
|
-
},
|
|
12917
|
+
}, RC = {
|
|
12902
12918
|
path: ["team", "active"],
|
|
12903
12919
|
description: "Show or set the active team used by default",
|
|
12904
12920
|
positionals: [{
|
|
@@ -12912,9 +12928,9 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12912
12928
|
type: "boolean"
|
|
12913
12929
|
}],
|
|
12914
12930
|
result: { type: "active-team" },
|
|
12915
|
-
run:
|
|
12916
|
-
},
|
|
12917
|
-
let n = e.options, r = await q(t, n), [i, a] = await Promise.all([
|
|
12931
|
+
run: LC
|
|
12932
|
+
}, zC = async (e, t) => {
|
|
12933
|
+
let n = e.options, r = await q(t, n), [i, a] = await Promise.all([fx(t, r), Kp(t, r)]), o = i.some((e) => e.teamId === a) ? a : null;
|
|
12918
12934
|
if (n.json === !0) {
|
|
12919
12935
|
t.stdout(`${JSON.stringify({
|
|
12920
12936
|
activeTeamId: o,
|
|
@@ -12925,7 +12941,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12925
12941
|
}, null, 2)}\n`);
|
|
12926
12942
|
return;
|
|
12927
12943
|
}
|
|
12928
|
-
for (let e of
|
|
12944
|
+
for (let e of nx([
|
|
12929
12945
|
"Active",
|
|
12930
12946
|
"Team",
|
|
12931
12947
|
"ID",
|
|
@@ -12936,7 +12952,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12936
12952
|
e.teamId,
|
|
12937
12953
|
e.scopes.join(" ")
|
|
12938
12954
|
]))) t.stdout(`${e}\n`);
|
|
12939
|
-
},
|
|
12955
|
+
}, BC = {
|
|
12940
12956
|
path: ["team"],
|
|
12941
12957
|
description: "List teams authorized for the current credential",
|
|
12942
12958
|
positionals: [],
|
|
@@ -12949,15 +12965,15 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12949
12965
|
type: "team-list",
|
|
12950
12966
|
activeTeamId: "string|null"
|
|
12951
12967
|
},
|
|
12952
|
-
run:
|
|
12953
|
-
},
|
|
12968
|
+
run: zC
|
|
12969
|
+
}, VC = "@blotout/qinto-cli", HC = [
|
|
12954
12970
|
["/_npx/", "npx"],
|
|
12955
12971
|
["/.bun/", "bun"],
|
|
12956
12972
|
["/.pnpm/", "pnpm"],
|
|
12957
12973
|
["/pnpm/", "pnpm"],
|
|
12958
12974
|
["/.yarn/", "yarn"],
|
|
12959
12975
|
["/yarn/", "yarn"]
|
|
12960
|
-
],
|
|
12976
|
+
], UC = (e = o(_e(import.meta.url))) => {
|
|
12961
12977
|
let t = e;
|
|
12962
12978
|
for (; !y(s(t, "package.json"));) {
|
|
12963
12979
|
let e = o(t);
|
|
@@ -12965,24 +12981,24 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12965
12981
|
t = e;
|
|
12966
12982
|
}
|
|
12967
12983
|
return t;
|
|
12968
|
-
},
|
|
12984
|
+
}, WC = (e) => {
|
|
12969
12985
|
if (y(s(e, "src"))) return "checkout";
|
|
12970
12986
|
let t = e.replaceAll("\\", "/");
|
|
12971
|
-
return
|
|
12972
|
-
},
|
|
12987
|
+
return HC.find(([e]) => t.includes(e))?.[1] ?? "npm";
|
|
12988
|
+
}, GC = (e) => {
|
|
12973
12989
|
throw new T(`Unsupported install source: ${String(e)}`);
|
|
12974
|
-
},
|
|
12990
|
+
}, KC = (e) => {
|
|
12975
12991
|
switch (e) {
|
|
12976
|
-
case "npm": return `npm install --global ${
|
|
12977
|
-
case "pnpm": return `pnpm add --global ${
|
|
12978
|
-
case "yarn": return `yarn global add ${
|
|
12979
|
-
case "bun": return `bun add --global ${
|
|
12992
|
+
case "npm": return `npm install --global ${VC}@latest`;
|
|
12993
|
+
case "pnpm": return `pnpm add --global ${VC}@latest`;
|
|
12994
|
+
case "yarn": return `yarn global add ${VC}@latest`;
|
|
12995
|
+
case "bun": return `bun add --global ${VC}@latest`;
|
|
12980
12996
|
case "npx": throw new T("This CLI runs through npx, which fetches the newest version on every run. There is nothing to update.");
|
|
12981
12997
|
case "checkout": throw new T("This CLI runs from a source checkout. Update it with git, not with a package manager.");
|
|
12982
12998
|
/* v8 ignore next 3 -- InstallSource is a closed union; the default only enforces exhaustive handling. */
|
|
12983
|
-
default: return
|
|
12999
|
+
default: return GC(e);
|
|
12984
13000
|
}
|
|
12985
|
-
},
|
|
13001
|
+
}, qC = async (e, t) => {
|
|
12986
13002
|
let n = await xr(e);
|
|
12987
13003
|
if (n === null) throw new T("Could not reach the npm registry to look up the newest Qinto CLI.");
|
|
12988
13004
|
if (!gr(n, lr)) {
|
|
@@ -12996,25 +13012,25 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
12996
13012
|
throw new T(`\`${t}\` failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
12997
13013
|
}
|
|
12998
13014
|
e.stdout(`Updated the Qinto CLI to ${n}.\n`);
|
|
12999
|
-
},
|
|
13015
|
+
}, JC = {
|
|
13000
13016
|
path: ["update"],
|
|
13001
13017
|
description: "Update the Qinto CLI to the newest version published on npm",
|
|
13002
13018
|
positionals: [],
|
|
13003
13019
|
options: [],
|
|
13004
13020
|
run: async (e, t) => {
|
|
13005
|
-
await
|
|
13021
|
+
await qC(t, KC(WC(UC())));
|
|
13006
13022
|
}
|
|
13007
|
-
},
|
|
13023
|
+
}, YC = (e) => nx(["Scope", "Level / permission"], e.map((e) => {
|
|
13008
13024
|
let t = Yp(e);
|
|
13009
13025
|
return t === null ? [e, "granted"] : [t.category, t.action];
|
|
13010
|
-
}), { indent: 2 }),
|
|
13026
|
+
}), { indent: 2 }), XC = (e, t) => {
|
|
13011
13027
|
let n = [];
|
|
13012
13028
|
if (e.user === null) {
|
|
13013
13029
|
let t = e.tokenType === "api_token" ? "a team API token" : "an OAuth token without the profile scope";
|
|
13014
13030
|
n.push(`Authenticated with ${t} named '${e.name}'.`);
|
|
13015
13031
|
} else n.push(`Logged in as ${e.user.email}.`);
|
|
13016
|
-
return e.teams.length > 0 && n.push("Teams:", ...e.teams.map((e) => ` ${e.teamId === t ? "*" : "-"} ${e.name ?? e.teamId} (${e.teamId})`)), e.organizations.length > 0 && n.push("Organizations:", ...e.organizations.map((e) => ` - ${e.name} (${e.role})`)), n.push("Scopes:", ...
|
|
13017
|
-
},
|
|
13032
|
+
return e.teams.length > 0 && n.push("Teams:", ...e.teams.map((e) => ` ${e.teamId === t ? "*" : "-"} ${e.name ?? e.teamId} (${e.teamId})`)), e.organizations.length > 0 && n.push("Organizations:", ...e.organizations.map((e) => ` - ${e.name} (${e.role})`)), n.push("Scopes:", ...YC(e.scopes)), n;
|
|
13033
|
+
}, ZC = async (e, t) => {
|
|
13018
13034
|
let n = e.options, r = await q(t, n), i = await dm(t, r, "/me");
|
|
13019
13035
|
if (i.status === 401) throw new T(`Your session is no longer valid. Run \`${Bp(r)}\` again.`);
|
|
13020
13036
|
if (!i.ok) throw new T(`The Qinto API answered ${i.status}.`);
|
|
@@ -13026,10 +13042,10 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
13026
13042
|
}, null, 2)}\n`);
|
|
13027
13043
|
return;
|
|
13028
13044
|
}
|
|
13029
|
-
for (let e of
|
|
13030
|
-
},
|
|
13031
|
-
|
|
13032
|
-
|
|
13045
|
+
for (let e of XC(a, o)) t.stdout(`${e}\n`);
|
|
13046
|
+
}, QC = [
|
|
13047
|
+
MC,
|
|
13048
|
+
PC,
|
|
13033
13049
|
{
|
|
13034
13050
|
path: ["whoami"],
|
|
13035
13051
|
description: "Show who you are logged in as, with your teams, organizations, and scopes",
|
|
@@ -13039,45 +13055,45 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
13039
13055
|
description: "Print the identity as JSON",
|
|
13040
13056
|
type: "boolean"
|
|
13041
13057
|
}],
|
|
13042
|
-
run:
|
|
13058
|
+
run: ZC
|
|
13043
13059
|
},
|
|
13060
|
+
bC,
|
|
13061
|
+
BC,
|
|
13062
|
+
RC,
|
|
13044
13063
|
_C,
|
|
13045
|
-
|
|
13046
|
-
FC,
|
|
13047
|
-
mC,
|
|
13048
|
-
ES,
|
|
13064
|
+
kS,
|
|
13049
13065
|
Pm,
|
|
13050
|
-
|
|
13051
|
-
|
|
13066
|
+
Xx,
|
|
13067
|
+
ix,
|
|
13052
13068
|
Np,
|
|
13053
|
-
|
|
13054
|
-
|
|
13055
|
-
|
|
13069
|
+
tx,
|
|
13070
|
+
Wx,
|
|
13071
|
+
hS,
|
|
13072
|
+
ES,
|
|
13056
13073
|
CS,
|
|
13057
|
-
|
|
13058
|
-
|
|
13059
|
-
|
|
13074
|
+
yS,
|
|
13075
|
+
_S,
|
|
13076
|
+
sS,
|
|
13060
13077
|
iS,
|
|
13061
|
-
|
|
13062
|
-
|
|
13063
|
-
|
|
13064
|
-
], XC = class extends Error {
|
|
13078
|
+
DS,
|
|
13079
|
+
JC
|
|
13080
|
+
], $C = class extends Error {
|
|
13065
13081
|
exitCode;
|
|
13066
13082
|
constructor(e, t) {
|
|
13067
13083
|
super(e), this.exitCode = t;
|
|
13068
13084
|
}
|
|
13069
|
-
},
|
|
13085
|
+
}, ew = (e) => {
|
|
13070
13086
|
let t = new se(e.flag, e.description);
|
|
13071
13087
|
return e.required === !0 && t.makeOptionMandatory(), e.enum !== void 0 && t.choices(e.enum), e.default !== void 0 && t.default(e.default), e.env !== void 0 && t.env(e.env), t;
|
|
13072
|
-
},
|
|
13088
|
+
}, tw = async (e, t, n) => {
|
|
13073
13089
|
try {
|
|
13074
13090
|
await e.run(t, n);
|
|
13075
13091
|
} catch (e) {
|
|
13076
|
-
if (e instanceof Error && e.name === "ExitPromptError") throw n.stderr("Aborted.\n"), new
|
|
13092
|
+
if (e instanceof Error && e.name === "ExitPromptError") throw n.stderr("Aborted.\n"), new $C("Aborted.", 130);
|
|
13077
13093
|
let r = e instanceof Error ? e.message : String(e);
|
|
13078
|
-
throw n.stderr(t.options.json === !0 ? `${JSON.stringify({ error: r })}\n` : `${r}\n`), new
|
|
13094
|
+
throw n.stderr(t.options.json === !0 ? `${JSON.stringify({ error: r })}\n` : `${r}\n`), new $C(r, e instanceof E ? 2 : 1);
|
|
13079
13095
|
}
|
|
13080
|
-
},
|
|
13096
|
+
}, nw = (e, t = QC, n = !1) => {
|
|
13081
13097
|
let r = new ae("qinto");
|
|
13082
13098
|
r.description("The Qinto platform CLI"), r.version(ir.version);
|
|
13083
13099
|
let i = (t) => {
|
|
@@ -13104,36 +13120,36 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
13104
13120
|
let n = e.variadic === !0 ? "..." : "";
|
|
13105
13121
|
t.argument(e.required ? `<${e.name}${n}>` : `[${e.name}${n}]`, e.description);
|
|
13106
13122
|
}
|
|
13107
|
-
for (let e of n.options) t.addOption(
|
|
13123
|
+
for (let e of n.options) t.addOption(ew(e));
|
|
13108
13124
|
t.action(async (...r) => {
|
|
13109
13125
|
let i = r.slice(0, n.positionals.length).flatMap((e) => typeof e == "string" ? [e] : Array.isArray(e) ? e.filter((e) => typeof e == "string") : []);
|
|
13110
|
-
await
|
|
13126
|
+
await tw(n, {
|
|
13111
13127
|
options: t.opts(),
|
|
13112
13128
|
positionals: i
|
|
13113
13129
|
}, e);
|
|
13114
13130
|
});
|
|
13115
13131
|
}
|
|
13116
13132
|
return r;
|
|
13117
|
-
},
|
|
13118
|
-
let t = [...
|
|
13133
|
+
}, rw = (e) => {
|
|
13134
|
+
let t = [...QC].sort((e, t) => t.path.length - e.path.length).find((t) => t.path.every((t, n) => e.at(n) === t));
|
|
13119
13135
|
return t === void 0 || !e.includes("--json") ? !1 : t.options.some((e) => Dr(e.flag) === "json");
|
|
13120
|
-
},
|
|
13121
|
-
let n = t.length === 0 ? ["--help"] : t, r =
|
|
13136
|
+
}, iw = async (e, t) => {
|
|
13137
|
+
let n = t.length === 0 ? ["--help"] : t, r = rw(n);
|
|
13122
13138
|
try {
|
|
13123
|
-
return await
|
|
13139
|
+
return await nw(e, QC, r).parseAsync(n, { from: "user" }), 0;
|
|
13124
13140
|
} catch (t) {
|
|
13125
|
-
if (t instanceof
|
|
13141
|
+
if (t instanceof $C) return t.exitCode;
|
|
13126
13142
|
if (t instanceof oe) return t.exitCode === 0 ? 0 : (r && e.stderr(`${JSON.stringify({ error: t.message.replace(/^error: /, "") })}\n`), 2);
|
|
13127
13143
|
throw t;
|
|
13128
13144
|
}
|
|
13129
|
-
},
|
|
13145
|
+
}, aw = async (e, t) => {
|
|
13130
13146
|
let n = Cr(e, t);
|
|
13131
13147
|
try {
|
|
13132
|
-
return await
|
|
13148
|
+
return await iw(e, t);
|
|
13133
13149
|
} finally {
|
|
13134
13150
|
await Tr(e, n);
|
|
13135
13151
|
}
|
|
13136
|
-
},
|
|
13152
|
+
}, ow = f(t), sw = {
|
|
13137
13153
|
fetch: globalThis.fetch,
|
|
13138
13154
|
openBrowser: async (e) => {
|
|
13139
13155
|
await ie(e);
|
|
@@ -13149,7 +13165,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
13149
13165
|
settingsPath: s(n(), ".qinto", "settings.json"),
|
|
13150
13166
|
versionCheckPath: s(n(), ".qinto", "version-check.json"),
|
|
13151
13167
|
runShell: async (e) => {
|
|
13152
|
-
await
|
|
13168
|
+
await ow(e);
|
|
13153
13169
|
},
|
|
13154
13170
|
now: Date.now,
|
|
13155
13171
|
interactive: process.stdin.isTTY === !0 && process.stderr.isTTY === !0,
|
|
@@ -13201,7 +13217,7 @@ ${Object.keys(vb).map((e) => ` <button class="outline" data-std="${e}">${
|
|
|
13201
13217
|
}
|
|
13202
13218
|
};
|
|
13203
13219
|
try {
|
|
13204
|
-
process.exitCode = await
|
|
13220
|
+
process.exitCode = await aw(sw, process.argv.slice(2));
|
|
13205
13221
|
} catch (e) {
|
|
13206
13222
|
process.stderr.write(`${e instanceof Error ? e.message : String(e)}\n`), process.exitCode = 1;
|
|
13207
13223
|
}
|