@blotout/qinto-cli 0.1.5 → 0.1.6

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
@@ -1240,7 +1240,7 @@ var Kn = Nn((e, t) => {
1240
1240
  ].filter(Boolean).join("\n").trimEnd()}${yn}`;
1241
1241
  }), qn = {
1242
1242
  name: "@blotout/qinto-cli",
1243
- version: "0.1.5",
1243
+ version: "0.1.6",
1244
1244
  type: "module",
1245
1245
  description: "Qinto CLI: authenticate against the Qinto platform and operate it from the terminal or from an agent.",
1246
1246
  repository: {
@@ -9843,44 +9843,63 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
9843
9843
  ],
9844
9844
  result: { type: "app-publish" },
9845
9845
  run: wv
9846
- }, Ev = async (e) => {
9846
+ }, Ev = [
9847
+ "slug",
9848
+ "name",
9849
+ "description"
9850
+ ], Dv = async (e) => {
9847
9851
  if (e.value !== void 0 && e.value !== "") return e.value;
9848
9852
  if (e.machine) throw new E(`Pass ${e.flag}.`);
9849
9853
  return e.deps.prompts.input(e.prompt);
9850
- }, Dv = async (e, t) => {
9851
- let n = e.options, r = X(n, t), i = await If({
9854
+ }, Ov = async (e, t) => {
9855
+ let n = Ev.filter((e) => t[e] !== void 0);
9856
+ if (n.length > 0) throw new E(`${Zd} in ${e} already names the app. Remove ${n.map((e) => `--${e}`).join(", ")}.`);
9857
+ let { manifest: r } = await Qd(e);
9858
+ return {
9859
+ slug: r.slug,
9860
+ name: r.name,
9861
+ description: r.description
9862
+ };
9863
+ }, kv = async (e, t, n) => ({
9864
+ slug: await Dv({
9865
+ deps: e,
9866
+ value: t.slug,
9867
+ machine: n,
9868
+ flag: "--slug <slug>",
9869
+ prompt: "App slug (3-30 lowercase letters, digits, hyphens)"
9870
+ }),
9871
+ name: await Dv({
9872
+ deps: e,
9873
+ value: t.name,
9874
+ machine: n,
9875
+ flag: "--name <name>",
9876
+ prompt: "App name"
9877
+ }),
9878
+ description: t.description
9879
+ }), Av = async (e, t) => {
9880
+ let n = e.options, r = X(n, t), i = e.positionals.at(0), a = u(i ?? "."), o = await If({
9852
9881
  deps: t,
9853
9882
  origin: await J(t, n),
9854
9883
  machine: r,
9855
- slug: await Ev({
9856
- deps: t,
9857
- value: n.slug,
9858
- machine: r,
9859
- flag: "--slug <slug>",
9860
- prompt: "App slug (3-30 lowercase letters, digits, hyphens)"
9861
- }),
9862
- name: await Ev({
9863
- deps: t,
9864
- value: n.name,
9865
- machine: r,
9866
- flag: "--name <name>",
9867
- prompt: "App name"
9868
- }),
9869
- description: n.description,
9884
+ ...i !== void 0 || y(s(a, "qinto.app.jsonc")) ? await Ov(a, n) : await kv(t, n, r),
9870
9885
  org: n.org
9871
9886
  });
9872
9887
  if (n.json === !0) {
9873
9888
  t.stdout(`${JSON.stringify({ app: {
9874
- ...i.app,
9875
- organizationName: i.organization.name
9889
+ ...o.app,
9890
+ organizationName: o.organization.name
9876
9891
  } }, null, 2)}\n`);
9877
9892
  return;
9878
9893
  }
9879
- Lf(t, i);
9880
- }, Ov = {
9894
+ Lf(t, o);
9895
+ }, jv = {
9881
9896
  path: ["app", "register"],
9882
9897
  description: "Register a developer app under an organization",
9883
- positionals: [],
9898
+ positionals: [{
9899
+ name: "dir",
9900
+ description: "App directory to read the slug, name, and description from (defaults to the current one when it holds a manifest)",
9901
+ required: !1
9902
+ }],
9884
9903
  options: [
9885
9904
  ...Y,
9886
9905
  {
@@ -9915,31 +9934,31 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
9915
9934
  }
9916
9935
  ],
9917
9936
  result: { type: "app-register" },
9918
- run: Dv
9919
- }, kv = {
9937
+ run: Av
9938
+ }, Mv = {
9920
9939
  kind: "plain",
9921
9940
  noun: "variable",
9922
9941
  setCommand: "qinto app var set"
9923
- }, Av = {
9942
+ }, Nv = {
9924
9943
  kind: "secret",
9925
9944
  noun: "secret",
9926
9945
  setCommand: "qinto app secret set"
9927
- }, jv = (e) => `/developer/organizations/${e.organization.organizationId}/apps/${e.app.appId}/variables`, Mv = async (e) => V_({
9946
+ }, Pv = (e) => `/developer/organizations/${e.organization.organizationId}/apps/${e.app.appId}/variables`, Fv = async (e) => V_({
9928
9947
  ...e,
9929
9948
  notFound: `App '${e.slug}' was not found in your organizations.`
9930
- }), Nv = async (e, t, n) => (await Z(e, t, jv(n))).variables, Pv = async (e) => {
9931
- let { deps: t, origin: n, resolved: r, name: i, value: a, scope: o } = e, s = (await Nv(t, n, r)).find((e) => e.name === i);
9949
+ }), Iv = async (e, t, n) => (await Z(e, t, Pv(n))).variables, Lv = async (e) => {
9950
+ let { deps: t, origin: n, resolved: r, name: i, value: a, scope: o } = e, s = (await Iv(t, n, r)).find((e) => e.name === i);
9932
9951
  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.`);
9933
9952
  if (s.kind !== o.kind) {
9934
- let e = o.kind === "secret" ? kv : Av;
9953
+ let e = o.kind === "secret" ? Mv : Nv;
9935
9954
  throw new T(`${i} is declared as a ${e.noun}; set it with \`${e.setCommand}\`.`);
9936
9955
  }
9937
- return (await Z(t, n, jv(r), {
9956
+ return (await Z(t, n, Pv(r), {
9938
9957
  method: "PATCH",
9939
9958
  body: { values: { [i]: a } }
9940
9959
  })).variables;
9941
- }, Fv = async (e, t) => {
9942
- let n = e.options, r = e.positionals.at(0), i = await J(t, n), a = (await Nv(t, i, await Mv({
9960
+ }, Rv = async (e, t) => {
9961
+ let n = e.options, r = e.positionals.at(0), i = await J(t, n), a = (await Iv(t, i, await Fv({
9943
9962
  deps: t,
9944
9963
  origin: i,
9945
9964
  slug: r,
@@ -9962,7 +9981,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
9962
9981
  e.required ? "yes" : "no",
9963
9982
  e.set ? "Set" : "Not set"
9964
9983
  ]))) t.stdout(`${e}\n`);
9965
- }, Iv = {
9984
+ }, zv = {
9966
9985
  path: [
9967
9986
  "app",
9968
9987
  "secret",
@@ -9980,31 +9999,31 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
9980
9999
  type: "boolean"
9981
10000
  }],
9982
10001
  result: { type: "app-secret-list" },
9983
- run: Fv
9984
- }, Lv = async (e, t) => {
10002
+ run: Rv
10003
+ }, Bv = async (e, t) => {
9985
10004
  let n = (e.interactive ? await e.prompts.password(`Value for ${t}`) : await e.readStdin()).trim();
9986
10005
  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.`);
9987
10006
  return n;
9988
- }, Rv = async (e, t) => {
9989
- let n = e.options, r = e.positionals.at(0), i = e.positionals.at(1), a = await J(t, n), o = await Pv({
10007
+ }, Vv = async (e, t) => {
10008
+ let n = e.options, r = e.positionals.at(0), i = e.positionals.at(1), a = await J(t, n), o = await Lv({
9990
10009
  deps: t,
9991
10010
  origin: a,
9992
- resolved: await Mv({
10011
+ resolved: await Fv({
9993
10012
  deps: t,
9994
10013
  origin: a,
9995
10014
  slug: r,
9996
10015
  machine: X(n, t)
9997
10016
  }),
9998
10017
  name: i,
9999
- value: await Lv(t, i),
10000
- scope: Av
10018
+ value: await Bv(t, i),
10019
+ scope: Nv
10001
10020
  });
10002
10021
  if (n.json === !0) {
10003
10022
  t.stdout(`${JSON.stringify({ secrets: o.filter((e) => e.kind === "secret") }, null, 2)}\n`);
10004
10023
  return;
10005
10024
  }
10006
10025
  t.stdout(`Set ${i} for '${r}'. Every site running this app picks it up within five minutes.\n`);
10007
- }, zv = {
10026
+ }, Hv = {
10008
10027
  path: [
10009
10028
  "app",
10010
10029
  "secret",
@@ -10026,41 +10045,41 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10026
10045
  type: "boolean"
10027
10046
  }],
10028
10047
  result: { type: "app-secret-set" },
10029
- run: Rv
10030
- }, Bv = (e, t) => {
10048
+ run: Vv
10049
+ }, Uv = (e, t) => {
10031
10050
  let n = [];
10032
10051
  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("; ");
10033
- }, Vv = (e, t, n) => `${n.methods.join(", ")} https://${e.site.domain}/app/${t.slug}${n.path} — ${n.auth}, ${n.mode}`, Hv = (e) => `${e.status}: ${e.callerAppSlug} → ${e.providerAppSlug} (${e.functions.join(", ")})`, Uv = (e, t, n) => {
10052
+ }, Wv = (e, t, n) => `${n.methods.join(", ")} https://${e.site.domain}/app/${t.slug}${n.path} — ${n.auth}, ${n.mode}`, Gv = (e) => `${e.status}: ${e.callerAppSlug} → ${e.providerAppSlug} (${e.functions.join(", ")})`, Kv = (e, t, n) => {
10034
10053
  let r = n.app;
10035
10054
  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`);
10036
10055
  let i = [...n.capture.queryParams.map((e) => `${e} (query)`), ...n.capture.cookies.map((e) => `${e} (cookie)`)];
10037
10056
  if (e.stdout(`Captures: ${i.length === 0 ? "none" : i.join(", ")}\n`), n.endpoints.length === 0) e.stdout("Endpoints: none\n");
10038
10057
  else {
10039
10058
  e.stdout("Endpoints:\n");
10040
- for (let i of n.endpoints) e.stdout(` ${Vv(t, r, i)}\n`);
10059
+ for (let i of n.endpoints) e.stdout(` ${Wv(t, r, i)}\n`);
10041
10060
  }
10042
10061
  e.stdout("Installs:\n");
10043
- for (let t of n.installs) e.stdout(` #${t.ordinal} ${t.label} — ${Bv(r, t)}\n`);
10062
+ for (let t of n.installs) e.stdout(` #${t.ordinal} ${t.label} — ${Uv(r, t)}\n`);
10044
10063
  if (n.grants.length === 0) {
10045
10064
  e.stdout("Grants: none\n");
10046
10065
  return;
10047
10066
  }
10048
10067
  e.stdout(`Grants (${r.pendingGrantCount} pending):\n`);
10049
- for (let t of n.grants) e.stdout(` ${Hv(t)}\n`);
10050
- }, Wv = async (e) => {
10068
+ for (let t of n.grants) e.stdout(` ${Gv(t)}\n`);
10069
+ }, qv = async (e) => {
10051
10070
  let { deps: t, origin: n, target: r, slug: i } = e;
10052
10071
  try {
10053
10072
  return await Z(t, n, `/teams/${r.team.teamId}/domains/${r.site.domainId}/apps/${i}`);
10054
10073
  } catch (e) {
10055
10074
  throw e instanceof Jn && e.code === "not_found" ? new T(`App '${i}' is not installed on ${r.site.domain}.`) : e;
10056
10075
  }
10057
- }, Gv = async (e, t) => {
10076
+ }, Jv = async (e, t) => {
10058
10077
  let n = e.options, r = e.positionals.at(0), i = await J(t, n), a = await Z_({
10059
10078
  deps: t,
10060
10079
  origin: i,
10061
10080
  site: n.site,
10062
10081
  team: n.team
10063
- }), o = await Wv({
10082
+ }), o = await qv({
10064
10083
  deps: t,
10065
10084
  origin: i,
10066
10085
  target: a,
@@ -10076,8 +10095,8 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10076
10095
  }, null, 2)}\n`);
10077
10096
  return;
10078
10097
  }
10079
- Uv(t, a, o);
10080
- }, Kv = {
10098
+ Kv(t, a, o);
10099
+ }, Yv = {
10081
10100
  path: ["app", "status"],
10082
10101
  description: "Show an app’s desired vs deployed state on a site",
10083
10102
  positionals: [{
@@ -10105,9 +10124,9 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10105
10124
  }
10106
10125
  ],
10107
10126
  result: { type: "app-status" },
10108
- run: Gv
10109
- }, qv = async (e, t) => {
10110
- let n = e.options, r = e.positionals.at(0), i = await J(t, n), a = (await Nv(t, i, await Mv({
10127
+ run: Jv
10128
+ }, Xv = async (e, t) => {
10129
+ let n = e.options, r = e.positionals.at(0), i = await J(t, n), a = (await Iv(t, i, await Fv({
10111
10130
  deps: t,
10112
10131
  origin: i,
10113
10132
  slug: r,
@@ -10130,7 +10149,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10130
10149
  e.required ? "yes" : "no",
10131
10150
  e.value ?? "Not set"
10132
10151
  ]))) t.stdout(`${e}\n`);
10133
- }, Jv = {
10152
+ }, Zv = {
10134
10153
  path: [
10135
10154
  "app",
10136
10155
  "var",
@@ -10148,12 +10167,12 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10148
10167
  type: "boolean"
10149
10168
  }],
10150
10169
  result: { type: "app-var-list" },
10151
- run: qv
10152
- }, Yv = async (e, t) => {
10153
- let n = e.options, r = e.positionals.at(0), i = e.positionals.at(1), a = e.positionals.at(2), o = await J(t, n), s = await Pv({
10170
+ run: Xv
10171
+ }, Qv = async (e, t) => {
10172
+ let n = e.options, r = e.positionals.at(0), i = e.positionals.at(1), a = e.positionals.at(2), o = await J(t, n), s = await Lv({
10154
10173
  deps: t,
10155
10174
  origin: o,
10156
- resolved: await Mv({
10175
+ resolved: await Fv({
10157
10176
  deps: t,
10158
10177
  origin: o,
10159
10178
  slug: r,
@@ -10161,14 +10180,14 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10161
10180
  }),
10162
10181
  name: i,
10163
10182
  value: a,
10164
- scope: kv
10183
+ scope: Mv
10165
10184
  });
10166
10185
  if (n.json === !0) {
10167
10186
  t.stdout(`${JSON.stringify({ variables: s.filter((e) => e.kind === "plain") }, null, 2)}\n`);
10168
10187
  return;
10169
10188
  }
10170
10189
  t.stdout(`Set ${i} for '${r}'. Every site running this app picks it up within five minutes.\n`);
10171
- }, Xv = {
10190
+ }, $v = {
10172
10191
  path: [
10173
10192
  "app",
10174
10193
  "var",
@@ -10198,8 +10217,8 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10198
10217
  type: "boolean"
10199
10218
  }],
10200
10219
  result: { type: "app-var-set" },
10201
- run: Yv
10202
- }, Zv = async (e) => {
10220
+ run: Qv
10221
+ }, ey = async (e) => {
10203
10222
  let { deps: t, origin: n, resolved: r, version: i } = e, a = `/developer/organizations/${r.organization.organizationId}/apps/${r.app.appId}/versions`, o = null;
10204
10223
  do {
10205
10224
  let e = await Z(t, n, `${a}${o === null ? "" : `?cursorCreatedAt=${encodeURIComponent(o.createdAt)}&cursorId=${o.id}`}`), r = e.versions.find((e) => e.version === i);
@@ -10207,16 +10226,16 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10207
10226
  o = e.nextCursor;
10208
10227
  } while (o !== null);
10209
10228
  throw new T(`Version ${i} was not found for '${r.app.slug}'.`);
10210
- }, Qv = (e, t) => {
10229
+ }, ty = (e, t) => {
10211
10230
  throw e instanceof Jn && e.code === "not_draft" ? new T(`Version ${t} is already ready and can never be cancelled.`) : e instanceof Jn && e.code === "not_holder" ? new T("Another publish holds this draft. Cancel it from that checkout, or pass --force as an organization owner.") : e;
10212
- }, $v = async (e, t) => {
10231
+ }, ny = async (e, t) => {
10213
10232
  let n = e.options, r = e.positionals.at(0), i = e.positionals.at(1), a = X(n, t), o = await J(t, n), s = await V_({
10214
10233
  deps: t,
10215
10234
  origin: o,
10216
10235
  slug: r,
10217
10236
  machine: a,
10218
10237
  notFound: `App '${r}' was not found in your organizations.`
10219
- }), c = await Zv({
10238
+ }), c = await ey({
10220
10239
  deps: t,
10221
10240
  origin: o,
10222
10241
  resolved: s,
@@ -10235,7 +10254,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10235
10254
  body: p
10236
10255
  });
10237
10256
  } catch (e) {
10238
- Qv(e, i);
10257
+ ty(e, i);
10239
10258
  }
10240
10259
  if (f !== null && await fv(l), n.json === !0) {
10241
10260
  t.stdout(`${JSON.stringify({
@@ -10246,7 +10265,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10246
10265
  return;
10247
10266
  }
10248
10267
  t.stdout(`Cancelled draft ${r}@${i}. Its version number is free again.\n`);
10249
- }, ey = {
10268
+ }, ry = {
10250
10269
  path: [
10251
10270
  "app",
10252
10271
  "version",
@@ -10281,14 +10300,14 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10281
10300
  }
10282
10301
  ],
10283
10302
  result: { type: "app-version-cancel" },
10284
- run: $v
10285
- }, ty = (e) => {
10303
+ run: ny
10304
+ }, iy = (e) => {
10286
10305
  if (e === void 0) return;
10287
10306
  let t = Number.parseInt(e, 10);
10288
10307
  if (!Number.isInteger(t) || t < 1 || `${t}` !== e) throw new E("Pass a positive integer to --limit.");
10289
10308
  return t;
10290
- }, ny = async (e, t) => {
10291
- let n = e.options, r = e.positionals.at(0), i = X(n, t), a = ty(n.limit), o = await J(t, n), s = await V_({
10309
+ }, ay = async (e, t) => {
10310
+ let n = e.options, r = e.positionals.at(0), i = X(n, t), a = iy(n.limit), o = await J(t, n), s = await V_({
10292
10311
  deps: t,
10293
10312
  origin: o,
10294
10313
  slug: r,
@@ -10318,7 +10337,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10318
10337
  e.status === "ready" ? e.readyAt : "-",
10319
10338
  e.createdAt
10320
10339
  ]))) t.stdout(`${e}\n`);
10321
- }, ry = {
10340
+ }, oy = {
10322
10341
  path: ["app", "versions"],
10323
10342
  description: "List an app’s versions, drafts included",
10324
10343
  positionals: [{
@@ -10340,8 +10359,8 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10340
10359
  }
10341
10360
  ],
10342
10361
  result: { type: "app-versions" },
10343
- run: ny
10344
- }, iy = {
10362
+ run: ay
10363
+ }, sy = {
10345
10364
  path: ["describe"],
10346
10365
  description: "Print a machine-readable description of the CLI commands",
10347
10366
  positionals: [{
@@ -10352,11 +10371,11 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10352
10371
  }],
10353
10372
  options: [],
10354
10373
  run: async (e, t) => {
10355
- let n = e.positionals, r = n.length === 0 ? kb : kb.filter((e) => e.path.join(" ") === n.join(" "));
10374
+ let n = e.positionals, r = n.length === 0 ? Mb : Mb.filter((e) => e.path.join(" ") === n.join(" "));
10356
10375
  if (r.length === 0) throw new T(`Unknown command: ${n.join(" ")}. Run \`qinto describe\` for the full list.`);
10357
10376
  t.stdout(`${JSON.stringify(_r(r), null, 2)}\n`);
10358
10377
  }
10359
- }, ay = async (e, t) => {
10378
+ }, cy = async (e, t) => {
10360
10379
  let n = e.options, r = await J(t, n), i = await X_(t, r, await J_(t, r), n.team), a = await G_(t, {
10361
10380
  origin: r,
10362
10381
  teamId: i.teamId,
@@ -10379,7 +10398,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10379
10398
  t.stdout(`DNS for ${a.domain}: ${s.status}\n`);
10380
10399
  for (let e of q_(o)) t.stdout(` ${e}\n`);
10381
10400
  o.message !== "" && t.stdout(`${o.message}\n`);
10382
- }, oy = {
10401
+ }, ly = {
10383
10402
  path: ["domain", "dns"],
10384
10403
  description: "Re-check DNS for an onboarded site",
10385
10404
  positionals: [{
@@ -10409,36 +10428,36 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10409
10428
  "unavailable"
10410
10429
  ]
10411
10430
  },
10412
- run: ay
10413
- }, sy = ["eu", "us"], cy = [
10431
+ run: cy
10432
+ }, uy = ["eu", "us"], dy = [
10414
10433
  "wnam",
10415
10434
  "enam",
10416
10435
  "weur",
10417
10436
  "eeur",
10418
10437
  "apac",
10419
10438
  "oc"
10420
- ], ly = (e) => {
10439
+ ], fy = (e) => {
10421
10440
  let t = e.trim(), n = /^[a-z][a-z0-9+.-]*:\/\//i.test(t) ? t : `http://${t}`;
10422
10441
  try {
10423
10442
  return new URL(n).hostname.replace(/\.$/, "").replace(/^www\./, "");
10424
10443
  } catch {
10425
10444
  return null;
10426
10445
  }
10427
- }, uy = (e) => {
10446
+ }, py = (e) => {
10428
10447
  let t = [
10429
10448
  "qinto",
10430
10449
  "domain",
10431
10450
  "onboard"
10432
10451
  ];
10433
- return e.rootDomain !== void 0 && t.push(ly(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(...of(e.origin)), t.join(" ");
10434
- }, dy = {
10452
+ return e.rootDomain !== void 0 && t.push(fy(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(...of(e.origin)), t.join(" ");
10453
+ }, my = {
10435
10454
  domain: "domain",
10436
10455
  "development-url": "development_url"
10437
- }, fy = [
10456
+ }, hy = [
10438
10457
  "host_setup_pending",
10439
10458
  "dns_pending",
10440
10459
  "complete"
10441
- ], py = async (e) => {
10460
+ ], gy = async (e) => {
10442
10461
  let { deps: t, origin: n, team: r, site: i, dns: a, delivery: o, shared: s, machine: c } = e, l = (e) => {
10443
10462
  c || t.stderr(`${e}\n`);
10444
10463
  };
@@ -10459,15 +10478,15 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10459
10478
  snippet: await Z(t, n, `/teams/${r.teamId}/domains/${i.domainId}/snippet`),
10460
10479
  shared: s
10461
10480
  };
10462
- }, my = (e) => {
10481
+ }, _y = (e) => {
10463
10482
  let t = [...new Set(e.split(",").map((e) => e.trim().toLowerCase()).filter((e) => e !== ""))];
10464
10483
  return t.length < 1 || t.length > 10 || t.some((e) => !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)) ? null : t;
10465
- }, hy = (e) => {
10484
+ }, vy = (e) => {
10466
10485
  if (e === void 0) return [];
10467
- let t = my(e);
10486
+ let t = _y(e);
10468
10487
  if (t === null) throw new E("--share-dns must contain 1–10 comma-separated email addresses.");
10469
10488
  return t;
10470
- }, gy = async (e) => {
10489
+ }, yy = async (e) => {
10471
10490
  let { deps: t, origin: n, teamId: r, domainId: i, emails: a, submissionId: o } = e;
10472
10491
  return a.length === 0 ? 0 : (await Z(t, n, `/teams/${r}/domains/${i}/dns/share`, {
10473
10492
  method: "POST",
@@ -10476,11 +10495,11 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10476
10495
  submissionId: o ?? ne()
10477
10496
  }
10478
10497
  })).sent;
10479
- }, _y = (e, t, n) => {
10498
+ }, by = (e, t, n) => {
10480
10499
  e.stdout(`DNS for ${t.domain}: ${H_(n)}\n`);
10481
10500
  for (let t of q_(n)) e.stdout(` ${t}\n`);
10482
10501
  n.message !== "" && e.stdout(`${n.message}\n`);
10483
- }, vy = (e) => {
10502
+ }, xy = (e) => {
10484
10503
  let t = [{
10485
10504
  name: "Re-check DNS",
10486
10505
  value: "recheck"
@@ -10495,10 +10514,10 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10495
10514
  name: "Skip DNS for now and finish setup",
10496
10515
  value: "skip"
10497
10516
  }), t;
10498
- }, yy = async (e) => {
10499
- let { deps: t, origin: n, teamId: r, domainId: i } = e, a = my(await t.prompts.input("Recipient emails, comma-separated"));
10517
+ }, Sy = async (e) => {
10518
+ let { deps: t, origin: n, teamId: r, domainId: i } = e, a = _y(await t.prompts.input("Recipient emails, comma-separated"));
10500
10519
  if (a === null) return t.stderr("Enter 1–10 comma-separated email addresses.\n"), 0;
10501
- let o = await gy({
10520
+ let o = await yy({
10502
10521
  deps: t,
10503
10522
  origin: n,
10504
10523
  teamId: r,
@@ -10506,11 +10525,11 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10506
10525
  emails: a
10507
10526
  });
10508
10527
  return t.stderr(`Emailed DNS instructions to ${o} recipient(s).\n`), o;
10509
- }, by = (e) => {
10528
+ }, Cy = (e) => {
10510
10529
  let t = H_(e);
10511
10530
  return t === "verified" || t === "not_required" ? "domain" : null;
10512
- }, xy = async (e) => {
10513
- 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 : dy[o.delivery];
10531
+ }, wy = async (e) => {
10532
+ 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 : my[o.delivery];
10514
10533
  if (d === "development_url") {
10515
10534
  if (i.developmentUrl === null) throw new E("This host does not provide a development URL.");
10516
10535
  return {
@@ -10525,17 +10544,17 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10525
10544
  shared: u
10526
10545
  };
10527
10546
  for (; !s && (H_(l) === "pending" || H_(l) === "unavailable");) {
10528
- let e = await t.prompts.select("DNS is not verified yet", vy(i));
10547
+ let e = await t.prompts.select("DNS is not verified yet", xy(i));
10529
10548
  if (e === "recheck") {
10530
10549
  l = await K_(t, {
10531
10550
  origin: n,
10532
10551
  teamId: r.teamId,
10533
10552
  domainId: i.domainId
10534
- }), _y(t, i, l);
10553
+ }), by(t, i, l);
10535
10554
  continue;
10536
10555
  }
10537
10556
  if (e === "share") {
10538
- u += await yy({
10557
+ u += await Sy({
10539
10558
  deps: t,
10540
10559
  origin: n,
10541
10560
  teamId: r.teamId,
@@ -10551,16 +10570,16 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10551
10570
  }
10552
10571
  return {
10553
10572
  dns: l,
10554
- delivery: by(l),
10573
+ delivery: Cy(l),
10555
10574
  shared: u
10556
10575
  };
10557
- }, Sy = async (e) => {
10576
+ }, Ty = async (e) => {
10558
10577
  let { deps: t, origin: n, team: r, site: i, options: a, machine: o } = e, s = await K_(t, {
10559
10578
  origin: n,
10560
10579
  teamId: r.teamId,
10561
10580
  domainId: i.domainId
10562
10581
  });
10563
- return o || _y(t, i, s), xy({
10582
+ return o || by(t, i, s), wy({
10564
10583
  deps: t,
10565
10584
  origin: n,
10566
10585
  team: r,
@@ -10568,28 +10587,28 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10568
10587
  initialDns: s,
10569
10588
  options: a,
10570
10589
  machine: o,
10571
- initiallyShared: await gy({
10590
+ initiallyShared: await yy({
10572
10591
  deps: t,
10573
10592
  origin: n,
10574
10593
  teamId: r.teamId,
10575
10594
  domainId: i.domainId,
10576
- emails: hy(a.shareDns),
10595
+ emails: vy(a.shareDns),
10577
10596
  submissionId: a.shareSubmissionId
10578
10597
  })
10579
10598
  });
10580
- }, Cy = (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}).`, wy = (e, t) => {
10581
- if (e.stdout(`Host setup is pending for ${t.host.name}: ${Cy(t.reason)}\n`), t.zoneRequired !== null && t.zoneRequired.length > 0) {
10599
+ }, Ey = (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}).`, Dy = (e, t) => {
10600
+ if (e.stdout(`Host setup is pending for ${t.host.name}: ${Ey(t.reason)}\n`), t.zoneRequired !== null && t.zoneRequired.length > 0) {
10582
10601
  e.stdout("Pick one of these zones and pass --host-zone:\n");
10583
10602
  for (let n of t.zoneRequired) e.stdout(` ${n}\n`);
10584
10603
  }
10585
10604
  e.stdout(`Resume: ${t.resumeCommand}\n`);
10586
- }, Ty = (e, t, n) => {
10605
+ }, Oy = (e, t, n) => {
10587
10606
  if (n) {
10588
10607
  e.stdout(`${JSON.stringify(t, null, 2)}\n`);
10589
10608
  return;
10590
10609
  }
10591
10610
  if (t.status === "host_setup_pending") {
10592
- wy(e, t);
10611
+ Dy(e, t);
10593
10612
  return;
10594
10613
  }
10595
10614
  e.stdout(`Site: ${t.site.domain}\nDNS: ${H_(t.dns)}\n`);
@@ -10599,17 +10618,17 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10599
10618
  return;
10600
10619
  }
10601
10620
  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");
10602
- }, Ey = {
10621
+ }, ky = {
10603
10622
  eu: "European Union",
10604
10623
  us: "United States"
10605
- }, Dy = {
10624
+ }, Ay = {
10606
10625
  wnam: "Western North America",
10607
10626
  enam: "Eastern North America",
10608
10627
  weur: "Western Europe",
10609
10628
  eeur: "Eastern Europe",
10610
10629
  apac: "Asia Pacific",
10611
10630
  oc: "Oceania"
10612
- }, Oy = (e, t) => {
10631
+ }, jy = (e, t) => {
10613
10632
  let n = [
10614
10633
  t.hostId,
10615
10634
  t.hostName,
@@ -10626,7 +10645,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10626
10645
  t.locationHint,
10627
10646
  ...n
10628
10647
  ].some((e) => e !== void 0)) throw new E("--site cannot be combined with site creation or host settings.");
10629
- }, ky = (e, t) => {
10648
+ }, My = (e, t) => {
10630
10649
  if ([
10631
10650
  e.hostId,
10632
10651
  e.hostName,
@@ -10637,13 +10656,13 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10637
10656
  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.");
10638
10657
  if (e.hostId !== void 0 && e.workersForPlatforms === !0) throw new E("--workers-for-platforms is available only when creating a new host.");
10639
10658
  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.");
10640
- }, Ay = (e) => {
10659
+ }, Ny = (e) => {
10641
10660
  if (e.shareSubmissionId !== void 0 && e.shareDns === void 0) throw new E("--share-submission-id requires --share-dns.");
10642
10661
  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.");
10643
- hy(e.shareDns);
10644
- }, jy = (e, t, n) => {
10645
- if (Oy(e, t), ky(t, n), Ay(t), n && t.site === void 0 && e === void 0) throw new E("Pass [rootDomain] or --site in non-interactive mode.");
10646
- }, My = async (e, t, n, r) => {
10662
+ vy(e.shareDns);
10663
+ }, Py = (e, t, n) => {
10664
+ if (jy(e, t), My(t, n), Ny(t), n && t.site === void 0 && e === void 0) throw new E("Pass [rootDomain] or --site in non-interactive mode.");
10665
+ }, Fy = async (e, t, n, r) => {
10647
10666
  let i = t ?? await e.prompts.input("Customer root domain");
10648
10667
  if (i.trim() === "") throw new E("The customer root domain cannot be empty.");
10649
10668
  let a = n.mode ?? (r ? "managed" : await e.prompts.select("Hosting mode", [{
@@ -10656,14 +10675,14 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10656
10675
  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", [{
10657
10676
  name: "Automatic",
10658
10677
  value: ""
10659
- }, ...sy.map((e) => ({
10660
- name: Ey[e],
10678
+ }, ...uy.map((e) => ({
10679
+ name: ky[e],
10661
10680
  value: e
10662
10681
  }))]) || void 0, l ??= await e.prompts.select("Location hint", [{
10663
10682
  name: "Automatic",
10664
10683
  value: ""
10665
- }, ...cy.map((e) => ({
10666
- name: Dy[e],
10684
+ }, ...dy.map((e) => ({
10685
+ name: Ay[e],
10667
10686
  value: e
10668
10687
  }))]) || void 0), {
10669
10688
  rootDomain: i,
@@ -10673,7 +10692,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10673
10692
  jurisdiction: c,
10674
10693
  locationHint: l
10675
10694
  };
10676
- }, Ny = async (e) => {
10695
+ }, Iy = async (e) => {
10677
10696
  let { deps: t, origin: n, teamId: r, hostId: i, zoneDomain: a } = e;
10678
10697
  return {
10679
10698
  ...await Z(t, n, `/teams/${r}/hosts/${i}/zone`, {
@@ -10682,23 +10701,23 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10682
10701
  }),
10683
10702
  zoneRequired: null
10684
10703
  };
10685
- }, Py = async (e) => {
10704
+ }, Ly = async (e) => {
10686
10705
  let { deps: t, created: n, options: r, machine: i } = e;
10687
10706
  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) => ({
10688
10707
  name: e,
10689
10708
  value: e
10690
10709
  })));
10691
- }, Fy = async (e) => {
10692
- let t = await Py(e);
10693
- return t === void 0 ? e.created : Ny({
10710
+ }, Ry = async (e) => {
10711
+ let t = await Ly(e);
10712
+ return t === void 0 ? e.created : Iy({
10694
10713
  deps: e.deps,
10695
10714
  origin: e.origin,
10696
10715
  teamId: e.teamId,
10697
10716
  hostId: e.created.host.hostId,
10698
10717
  zoneDomain: t
10699
10718
  });
10700
- }, Iy = async (e) => {
10701
- let t = await Fy(e), n = t.host.zoneDomain === null ? "zone_required" : t.wfpSync?.pushed === !1 ? t.wfpSync.reason ?? "wfp_sync_failed" : null;
10719
+ }, zy = async (e) => {
10720
+ let t = await Ry(e), n = t.host.zoneDomain === null ? "zone_required" : t.wfpSync?.pushed === !1 ? t.wfpSync.reason ?? "wfp_sync_failed" : null;
10702
10721
  return n === null ? {
10703
10722
  status: "ready",
10704
10723
  hostId: t.host.hostId
@@ -10707,7 +10726,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10707
10726
  host: t.host,
10708
10727
  zoneRequired: t.zoneRequired,
10709
10728
  reason: n,
10710
- resumeCommand: uy({
10729
+ resumeCommand: py({
10711
10730
  origin: e.origin,
10712
10731
  teamId: e.teamId,
10713
10732
  rootDomain: e.rootDomain,
@@ -10716,7 +10735,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10716
10735
  machine: e.machine
10717
10736
  })
10718
10737
  };
10719
- }, Ly = async (e, t) => {
10738
+ }, By = async (e, t) => {
10720
10739
  if (e.options.hostId !== void 0 || e.machine || t.length === 0) return e.options.hostId;
10721
10740
  let n = await e.deps.prompts.select("Choose a Cloudflare host", [...t.map((e) => ({
10722
10741
  name: `${e.name} (${e.accountId})`,
@@ -10726,7 +10745,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10726
10745
  value: "__new__"
10727
10746
  }]);
10728
10747
  return n === "__new__" ? void 0 : n;
10729
- }, Ry = async (e, t, n) => {
10748
+ }, Vy = async (e, t, n) => {
10730
10749
  let r = t.find((e) => e.hostId === n);
10731
10750
  if (r === void 0) throw new E(`Host ${n} is not available in team ${e.teamId}.`);
10732
10751
  let i = {
@@ -10734,7 +10753,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10734
10753
  zoneRequired: r.zoneDomain === null ? [] : null,
10735
10754
  wfpSync: null
10736
10755
  };
10737
- if (r.zoneDomain === null && e.options.hostZone !== void 0) i = await Ny({
10756
+ if (r.zoneDomain === null && e.options.hostZone !== void 0) i = await Iy({
10738
10757
  deps: e.deps,
10739
10758
  origin: e.origin,
10740
10759
  teamId: e.teamId,
@@ -10748,19 +10767,19 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10748
10767
  wfpSync: t.wfpSync
10749
10768
  };
10750
10769
  }
10751
- return Iy({
10770
+ return zy({
10752
10771
  ...e,
10753
10772
  created: i
10754
10773
  });
10755
- }, zy = async (e, t, n) => {
10774
+ }, Hy = async (e, t, n) => {
10756
10775
  let r = await t();
10757
10776
  for (; r.trim() === "";) e.stderr(`${n}\n`), r = await t();
10758
10777
  return r;
10759
- }, By = async (e) => {
10760
- let { deps: t, origin: n, teamId: r, options: i, machine: a } = e, o = i.hostName ?? await zy(t, () => t.prompts.input("Host display name"), "A host display name is required."), s = i.cloudflareAccountId ?? await zy(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;
10778
+ }, Uy = async (e) => {
10779
+ let { deps: t, origin: n, teamId: r, options: i, machine: a } = e, o = i.hostName ?? await Hy(t, () => t.prompts.input("Host display name"), "A host display name is required."), s = i.cloudflareAccountId ?? await Hy(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;
10761
10780
  if (l === void 0) {
10762
10781
  if (a) throw new E("Set QINTO_CLOUDFLARE_API_TOKEN when creating a self-host in non-interactive mode.");
10763
- l = await zy(t, () => t.prompts.password("Cloudflare API token"), "A Cloudflare API token is required.");
10782
+ l = await Hy(t, () => t.prompts.password("Cloudflare API token"), "A Cloudflare API token is required.");
10764
10783
  }
10765
10784
  let u = await Z(t, n, `/teams/${r}/hosts`, {
10766
10785
  method: "POST",
@@ -10771,20 +10790,20 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10771
10790
  wfp: i.workersForPlatforms === !0
10772
10791
  }
10773
10792
  });
10774
- return Iy({
10793
+ return zy({
10775
10794
  ...e,
10776
10795
  created: u
10777
10796
  });
10778
- }, Vy = async (e) => {
10779
- let t = (await Z(e.deps, e.origin, `/teams/${e.teamId}/hosts`)).hosts, n = await Ly(e, t);
10780
- return n === void 0 ? By(e) : Ry(e, t, n);
10781
- }, Hy = async (e) => {
10797
+ }, Wy = async (e) => {
10798
+ let t = (await Z(e.deps, e.origin, `/teams/${e.teamId}/hosts`)).hosts, n = await By(e, t);
10799
+ return n === void 0 ? Uy(e) : Vy(e, t, n);
10800
+ }, Gy = async (e) => {
10782
10801
  let { deps: t, candidates: n, hostname: r, machine: i } = e, a = n.find((e) => e.domain === r);
10783
10802
  if (a === void 0) return null;
10784
10803
  if (i) throw new E(`Site ${r} already exists. Pass --site ${a.domainId} to resume it.`);
10785
10804
  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.`);
10786
10805
  return a;
10787
- }, Uy = async (e) => {
10806
+ }, Ky = async (e) => {
10788
10807
  let { deps: t, candidates: n, rootDomain: r, machine: i } = e;
10789
10808
  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.`);
10790
10809
  let a = await t.prompts.select(`${r} already has sites`, [...n.map((e) => ({
@@ -10795,8 +10814,8 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10795
10814
  value: "__new__"
10796
10815
  }]);
10797
10816
  return a === "__new__" ? null : n.find((e) => e.domainId === a);
10798
- }, Wy = async (e) => {
10799
- let { deps: t, origin: n, teamId: r, siteInput: i, machine: a } = e, o = ly(i.rootDomain);
10817
+ }, qy = async (e) => {
10818
+ let { deps: t, origin: n, teamId: r, siteInput: i, machine: a } = e, o = fy(i.rootDomain);
10800
10819
  if (o === null) return null;
10801
10820
  let s;
10802
10821
  try {
@@ -10808,18 +10827,18 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10808
10827
  let c = s.filter((e) => e.rootDomain === o);
10809
10828
  if (c.length === 0) return null;
10810
10829
  let l = i.subdomain?.trim().toLowerCase();
10811
- return l !== void 0 && l !== "" ? Hy({
10830
+ return l !== void 0 && l !== "" ? Gy({
10812
10831
  deps: t,
10813
10832
  candidates: c,
10814
10833
  hostname: `${l}.${o}`,
10815
10834
  machine: a
10816
- }) : Uy({
10835
+ }) : Ky({
10817
10836
  deps: t,
10818
10837
  candidates: c,
10819
10838
  rootDomain: o,
10820
10839
  machine: a
10821
10840
  });
10822
- }, Gy = async (e) => {
10841
+ }, Jy = async (e) => {
10823
10842
  let { deps: t, origin: n, teamId: r, rootDomain: i, options: a, machine: o } = e;
10824
10843
  if (a.site !== void 0) return {
10825
10844
  status: "ready",
@@ -10829,7 +10848,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10829
10848
  reference: a.site
10830
10849
  })
10831
10850
  };
10832
- let s = await My(t, i, a, o), c = await Wy({
10851
+ let s = await Fy(t, i, a, o), c = await qy({
10833
10852
  deps: t,
10834
10853
  origin: n,
10835
10854
  teamId: r,
@@ -10842,7 +10861,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10842
10861
  };
10843
10862
  let l;
10844
10863
  if (s.mode === "self") {
10845
- let e = await Vy({
10864
+ let e = await Wy({
10846
10865
  deps: t,
10847
10866
  origin: n,
10848
10867
  teamId: r,
@@ -10861,7 +10880,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10861
10880
  }
10862
10881
  });
10863
10882
  if (!o) {
10864
- let e = uy({
10883
+ let e = py({
10865
10884
  origin: n,
10866
10885
  teamId: r,
10867
10886
  siteId: u.site.domainId,
@@ -10873,7 +10892,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10873
10892
  status: "ready",
10874
10893
  site: u.site
10875
10894
  };
10876
- }, Ky = async (e) => {
10895
+ }, Yy = async (e) => {
10877
10896
  let { deps: t, origin: n, teams: r, options: i, machine: a } = e;
10878
10897
  if (i.team !== void 0 || a) return X_(t, n, r, i.team);
10879
10898
  if (r.length === 0) throw new E("This credential has no authorized teams.");
@@ -10884,16 +10903,16 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10884
10903
  value: e.teamId
10885
10904
  })), s?.teamId));
10886
10905
  return await mf(t, n, c.teamId), c;
10887
- }, qy = async (e, t) => {
10906
+ }, Xy = async (e, t) => {
10888
10907
  let n = e.options, r = e.positionals.at(0), i = X(n, t);
10889
- jy(r, n, i);
10890
- let a = await J(t, n), o = await Ky({
10908
+ Py(r, n, i);
10909
+ let a = await J(t, n), o = await Yy({
10891
10910
  deps: t,
10892
10911
  origin: a,
10893
10912
  teams: await J_(t, a),
10894
10913
  options: n,
10895
10914
  machine: i
10896
- }), s = await Gy({
10915
+ }), s = await Jy({
10897
10916
  deps: t,
10898
10917
  origin: a,
10899
10918
  teamId: o.teamId,
@@ -10902,7 +10921,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10902
10921
  machine: i
10903
10922
  });
10904
10923
  if (s.status === "host_setup_pending") {
10905
- Ty(t, {
10924
+ Oy(t, {
10906
10925
  ...s,
10907
10926
  team: o
10908
10927
  }, n.json === !0);
@@ -10910,7 +10929,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10910
10929
  }
10911
10930
  let { site: c } = s;
10912
10931
  try {
10913
- let e = await Sy({
10932
+ let e = await Ty({
10914
10933
  deps: t,
10915
10934
  origin: a,
10916
10935
  team: o,
@@ -10919,13 +10938,13 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10919
10938
  machine: i
10920
10939
  });
10921
10940
  if (e.delivery === null) {
10922
- Ty(t, {
10941
+ Oy(t, {
10923
10942
  status: "dns_pending",
10924
10943
  team: o,
10925
10944
  site: c,
10926
10945
  dns: e.dns,
10927
10946
  shared: e.shared,
10928
- resumeCommand: uy({
10947
+ resumeCommand: py({
10929
10948
  origin: a,
10930
10949
  teamId: o.teamId,
10931
10950
  siteId: c.domainId,
@@ -10934,7 +10953,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10934
10953
  }, n.json === !0);
10935
10954
  return;
10936
10955
  }
10937
- Ty(t, await py({
10956
+ Oy(t, await gy({
10938
10957
  deps: t,
10939
10958
  origin: a,
10940
10959
  team: o,
@@ -10945,7 +10964,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10945
10964
  machine: i
10946
10965
  }), n.json === !0);
10947
10966
  } catch (e) {
10948
- let n = uy({
10967
+ let n = py({
10949
10968
  origin: a,
10950
10969
  teamId: o.teamId,
10951
10970
  siteId: c.domainId,
@@ -10953,7 +10972,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10953
10972
  }), r = `Onboarding did not finish for site ${c.domainId}. Resume with: ${n}`;
10954
10973
  throw i ? (e instanceof Error && (e.message = `${e.message} ${r}`), e) : (t.stderr(`${r}\n`), e);
10955
10974
  }
10956
- }, Jy = {
10975
+ }, Zy = {
10957
10976
  path: ["domain", "onboard"],
10958
10977
  description: "Onboard a domain through DNS, deployment, and snippet installation",
10959
10978
  positionals: [{
@@ -10988,19 +11007,19 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
10988
11007
  flag: "--jurisdiction <jurisdiction>",
10989
11008
  description: "Choose the EU or US data jurisdiction",
10990
11009
  type: "string",
10991
- enum: sy
11010
+ enum: uy
10992
11011
  },
10993
11012
  {
10994
11013
  flag: "--location-hint <locationHint>",
10995
11014
  description: "Place site state near a Cloudflare region",
10996
11015
  type: "string",
10997
- enum: cy
11016
+ enum: dy
10998
11017
  },
10999
11018
  {
11000
11019
  flag: "--delivery <delivery>",
11001
11020
  description: "Serve from the customer domain or a development URL",
11002
11021
  type: "string",
11003
- enum: Object.keys(dy)
11022
+ enum: Object.keys(my)
11004
11023
  },
11005
11024
  {
11006
11025
  flag: "--site <siteId>",
@@ -11064,10 +11083,10 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11064
11083
  }],
11065
11084
  result: {
11066
11085
  type: "domain-onboarding",
11067
- statuses: fy
11086
+ statuses: hy
11068
11087
  },
11069
- run: qy
11070
- }, Yy = (e, t, n) => {
11088
+ run: Xy
11089
+ }, Qy = (e, t, n) => {
11071
11090
  if (n) {
11072
11091
  e.stdout(`${JSON.stringify({
11073
11092
  environment: t,
@@ -11076,11 +11095,11 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11076
11095
  return;
11077
11096
  }
11078
11097
  e.stdout(`${t} (${tf[t]})\n`);
11079
- }, Xy = (e) => {
11098
+ }, $y = (e) => {
11080
11099
  let t = ef.find((t) => t === e);
11081
11100
  if (t === void 0) throw new E(`Unknown environment: ${e}. Choose ${ef.join(" or ")}.`);
11082
11101
  return t;
11083
- }, Zy = {
11102
+ }, eb = {
11084
11103
  path: ["env"],
11085
11104
  description: "Show or set the Qinto environment every other command talks to",
11086
11105
  positionals: [{
@@ -11097,18 +11116,18 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11097
11116
  run: async (e, t) => {
11098
11117
  let n = e.options, r = n.json === !0, i = await rf(t) ?? "production", a = e.positionals.at(0);
11099
11118
  if (a === void 0 && X(n, t)) {
11100
- Yy(t, i, r);
11119
+ Qy(t, i, r);
11101
11120
  return;
11102
11121
  }
11103
- let o = Xy(a ?? await t.prompts.select("Choose the Qinto environment", ef.map((e) => ({
11122
+ let o = $y(a ?? await t.prompts.select("Choose the Qinto environment", ef.map((e) => ({
11104
11123
  name: `${e} (${tf[e]})`,
11105
11124
  value: e
11106
11125
  })), i));
11107
- await af(t, o), Yy(t, o, r);
11126
+ await af(t, o), Qy(t, o, r);
11108
11127
  let s = tf[o];
11109
11128
  !r && await ff(t, s) === null && t.stderr(`You are not logged in to ${o}. Run \`${sf(s)}\`.\n`);
11110
11129
  }
11111
- }, Qy = [
11130
+ }, tb = [
11112
11131
  "body{margin:0;box-sizing:border-box;min-height:100vh;display:grid;place-items:center;padding:40px 16px;",
11113
11132
  "background:#fffdf9;color:#101828;font-family:ui-sans-serif,system-ui,-apple-system,\"Segoe UI\",Roboto,sans-serif}",
11114
11133
  ".mark{width:56px;height:56px;margin:0 auto 24px;display:grid;place-items:center;border-radius:16px;",
@@ -11118,14 +11137,14 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11118
11137
  "border:1px solid rgba(232,213,196,.6);box-shadow:0 1px 2px rgba(16,24,40,.05)}",
11119
11138
  "h1{margin:0;font-size:20px;line-height:1.4;font-weight:700}",
11120
11139
  "p{margin:8px 0 0;font-size:14px;line-height:1.5;color:#6a7282}"
11121
- ].join(""), $y = (e, t) => [
11140
+ ].join(""), nb = (e, t) => [
11122
11141
  "<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\">",
11123
11142
  "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><title>Qinto CLI</title>",
11124
- `<style>${Qy}</style></head><body><main>`,
11143
+ `<style>${tb}</style></head><body><main>`,
11125
11144
  "<div class=\"mark\">Q</div>",
11126
11145
  `<div class="card"><h1>${e}</h1><p>${t}</p></div>`,
11127
11146
  "</main></body></html>"
11128
- ].join(""), eb = async (e, t) => {
11147
+ ].join(""), rb = async (e, t) => {
11129
11148
  let { promise: n, resolve: r, reject: i } = Promise.withResolvers();
11130
11149
  n.catch(() => {});
11131
11150
  let a = xe(), o, s = !1, c = () => {
@@ -11142,7 +11161,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11142
11161
  return;
11143
11162
  }
11144
11163
  let i = (e, t, r) => {
11145
- n.writeHead(e, { "content-type": "text/html; charset=utf-8" }).end($y(t, r));
11164
+ n.writeHead(e, { "content-type": "text/html; charset=utf-8" }).end(nb(t, r));
11146
11165
  };
11147
11166
  if (r.searchParams.get("state") !== e) {
11148
11167
  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."));
@@ -11185,25 +11204,25 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11185
11204
  u(new T("Browser login callback closed."));
11186
11205
  }
11187
11206
  };
11188
- }, tb = (e) => x("sha256").update(e).digest("base64url"), nb = () => {
11207
+ }, ib = (e) => x("sha256").update(e).digest("base64url"), ab = () => {
11189
11208
  let e = te(32).toString("base64url");
11190
11209
  return {
11191
11210
  verifier: e,
11192
- challenge: tb(e),
11211
+ challenge: ib(e),
11193
11212
  state: te(16).toString("base64url")
11194
11213
  };
11195
- }, rb = (e) => {
11214
+ }, ob = (e) => {
11196
11215
  let t = Number(e);
11197
11216
  if (!Number.isFinite(t) || t <= 0) throw new T(`Invalid --timeout value: ${e}`);
11198
11217
  return t * 1e3;
11199
- }, ib = (e, t) => e === void 0 ? Cf(t).join(" ") : e.split(/[\s,]+/).filter((e) => e !== "").join(" "), ab = async (e, t, n) => {
11218
+ }, sb = (e, t) => e === void 0 ? Cf(t).join(" ") : e.split(/[\s,]+/).filter((e) => e !== "").join(" "), cb = async (e, t, n) => {
11200
11219
  try {
11201
11220
  let r = await yf(e, new URL("/me", t), { headers: { authorization: `Bearer ${n}` } });
11202
11221
  return r.ok ? await r.json() : null;
11203
11222
  } catch {
11204
11223
  return null;
11205
11224
  }
11206
- }, ob = async (e, t, n, r) => {
11225
+ }, lb = async (e, t, n, r) => {
11207
11226
  if (n === null || n.teams.length === 0) return null;
11208
11227
  let i = await pf(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;
11209
11228
  if (s === void 0 && n.teams.length === 1 && (s = n.teams[0]), s === void 0 && e.interactive) {
@@ -11214,7 +11233,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11214
11233
  s = n.teams.find((e) => e.teamId === t);
11215
11234
  }
11216
11235
  return s === void 0 ? null : (await mf(e, t, s.teamId), s.name ?? s.teamId);
11217
- }, sb = async (e, t, n) => {
11236
+ }, ub = async (e, t, n) => {
11218
11237
  let r = !1;
11219
11238
  try {
11220
11239
  await df(e, async (i) => {
@@ -11243,10 +11262,10 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11243
11262
  }
11244
11263
  throw t;
11245
11264
  }
11246
- }, cb = async (e, t) => {
11247
- let n = e.options, r = await J(t, n), i = rb(n.timeout), a = t.env.QINTO_API_TOKEN;
11265
+ }, db = async (e, t) => {
11266
+ let n = e.options, r = await J(t, n), i = ob(n.timeout), a = t.env.QINTO_API_TOKEN;
11248
11267
  a !== void 0 && a !== "" && t.stderr("Note: QINTO_API_TOKEN is set and takes precedence over stored logins.\n");
11249
- let o = await Sf(t, r), s = ib(n.scopes, o.scopesSupported), c = nb(), l = await eb(c.state, i), u;
11268
+ let o = await Sf(t, r), s = sb(n.scopes, o.scopesSupported), c = ab(), l = await rb(c.state, i), u;
11250
11269
  try {
11251
11270
  let e = wf({
11252
11271
  authorizationEndpoint: o.authorizationEndpoint,
@@ -11272,7 +11291,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11272
11291
  redirect_uri: l.redirectUri,
11273
11292
  code_verifier: c.verifier
11274
11293
  });
11275
- await sb(t, r, {
11294
+ await ub(t, r, {
11276
11295
  accessToken: d.accessToken,
11277
11296
  refreshToken: d.refreshToken,
11278
11297
  expiresAt: t.now() + d.expiresIn * 1e3,
@@ -11280,9 +11299,9 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11280
11299
  tokenEndpoint: o.tokenEndpoint,
11281
11300
  revocationEndpoint: o.revocationEndpoint
11282
11301
  });
11283
- let f = await ab(t, r, d.accessToken), p = await ob(t, r, f, n.team), m = f?.user === null || f?.user === void 0 ? `Logged in to ${r}` : `Logged in as ${f.user.email}`;
11302
+ let f = await cb(t, r, d.accessToken), p = await lb(t, r, f, n.team), m = f?.user === null || f?.user === void 0 ? `Logged in to ${r}` : `Logged in as ${f.user.email}`;
11284
11303
  t.stdout(`${m}${p === null ? "." : ` (active team ${p}).`}\n`);
11285
- }, lb = {
11304
+ }, fb = {
11286
11305
  path: ["login"],
11287
11306
  description: "Log in to the Qinto platform through your browser",
11288
11307
  positionals: [],
@@ -11315,8 +11334,8 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11315
11334
  default: "300"
11316
11335
  }
11317
11336
  ],
11318
- run: cb
11319
- }, ub = async (e, t) => {
11337
+ run: db
11338
+ }, pb = async (e, t) => {
11320
11339
  let n = e.options, r = await J(t, n), i = t.env.QINTO_API_TOKEN;
11321
11340
  i !== void 0 && i !== "" && t.stderr("Note: QINTO_API_TOKEN cannot be logged out; unset it in your shell.\n");
11322
11341
  let a = await df(t, async (e) => {
@@ -11341,32 +11360,32 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11341
11360
  return;
11342
11361
  }
11343
11362
  t.stdout(a === "pending" ? `Revoked the sessions left pending for ${r}.\n` : `Logged out of ${r}.\n`);
11344
- }, db = {
11363
+ }, mb = {
11345
11364
  path: ["logout"],
11346
11365
  description: "Revoke the current login and clear stored credentials",
11347
11366
  positionals: [],
11348
11367
  options: [...Y],
11349
- run: ub
11350
- }, fb = (e, t, n) => {
11368
+ run: pb
11369
+ }, hb = (e, t, n) => {
11351
11370
  if (n) {
11352
11371
  e.stdout(`${JSON.stringify({ activeTeam: t }, null, 2)}\n`);
11353
11372
  return;
11354
11373
  }
11355
11374
  e.stdout(t === null ? "No active team is selected.\n" : `${t.name ?? t.teamId} (${t.teamId})\n`);
11356
- }, pb = async (e, t, n, r) => {
11375
+ }, gb = async (e, t, n, r) => {
11357
11376
  let i = await pf(e, t);
11358
- fb(e, i === null ? null : n.find((e) => e.teamId === i) ?? null, r);
11359
- }, mb = async (e, t) => {
11377
+ hb(e, i === null ? null : n.find((e) => e.teamId === i) ?? null, r);
11378
+ }, _b = async (e, t) => {
11360
11379
  let n = e.options, r = await J(t, n), i = await J_(t, r), a = e.positionals.at(0);
11361
11380
  if (a === void 0 && X(n, t)) {
11362
- await pb(t, r, i, n.json === !0);
11381
+ await gb(t, r, i, n.json === !0);
11363
11382
  return;
11364
11383
  }
11365
11384
  if (i.length === 0) throw new E("This credential has no authorized teams.");
11366
11385
  let o = a;
11367
11386
  if (o === void 0) {
11368
11387
  let e = await pf(t, r), n = e === null ? void 0 : i.find((t) => t.teamId === e);
11369
- if (n !== void 0 && (fb(t, n, !1), !await t.prompts.confirm("Change the active team?", !1))) return;
11388
+ if (n !== void 0 && (hb(t, n, !1), !await t.prompts.confirm("Change the active team?", !1))) return;
11370
11389
  o = await t.prompts.select("Choose the active team", i.map((e) => ({
11371
11390
  name: `${e.name ?? "Untitled team"} (${e.teamId})`,
11372
11391
  value: e.teamId
@@ -11374,7 +11393,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11374
11393
  }
11375
11394
  let s = Y_(i, o);
11376
11395
  await mf(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`);
11377
- }, hb = {
11396
+ }, vb = {
11378
11397
  path: ["team", "active"],
11379
11398
  description: "Show or set the active team used by default",
11380
11399
  positionals: [{
@@ -11388,8 +11407,8 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11388
11407
  type: "boolean"
11389
11408
  }],
11390
11409
  result: { type: "active-team" },
11391
- run: mb
11392
- }, gb = async (e, t) => {
11410
+ run: _b
11411
+ }, yb = async (e, t) => {
11393
11412
  let n = e.options, r = await J(t, n), [i, a] = await Promise.all([J_(t, r), pf(t, r)]), o = i.some((e) => e.teamId === a) ? a : null;
11394
11413
  if (n.json === !0) {
11395
11414
  t.stdout(`${JSON.stringify({
@@ -11412,7 +11431,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11412
11431
  e.teamId,
11413
11432
  e.scopes.join(" ")
11414
11433
  ]))) t.stdout(`${e}\n`);
11415
- }, _b = {
11434
+ }, bb = {
11416
11435
  path: ["team"],
11417
11436
  description: "List teams authorized for the current credential",
11418
11437
  positionals: [],
@@ -11425,15 +11444,15 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11425
11444
  type: "team-list",
11426
11445
  activeTeamId: "string|null"
11427
11446
  },
11428
- run: gb
11429
- }, vb = "@blotout/qinto-cli", yb = [
11447
+ run: yb
11448
+ }, xb = "@blotout/qinto-cli", Sb = [
11430
11449
  ["/_npx/", "npx"],
11431
11450
  ["/.bun/", "bun"],
11432
11451
  ["/.pnpm/", "pnpm"],
11433
11452
  ["/pnpm/", "pnpm"],
11434
11453
  ["/.yarn/", "yarn"],
11435
11454
  ["/yarn/", "yarn"]
11436
- ], bb = (e = o(me(import.meta.url))) => {
11455
+ ], Cb = (e = o(me(import.meta.url))) => {
11437
11456
  let t = e;
11438
11457
  for (; !y(s(t, "package.json"));) {
11439
11458
  let e = o(t);
@@ -11441,24 +11460,24 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11441
11460
  t = e;
11442
11461
  }
11443
11462
  return t;
11444
- }, xb = (e) => {
11463
+ }, wb = (e) => {
11445
11464
  if (y(s(e, "src"))) return "checkout";
11446
11465
  let t = e.replaceAll("\\", "/");
11447
- return yb.find(([e]) => t.includes(e))?.[1] ?? "npm";
11448
- }, Sb = (e) => {
11466
+ return Sb.find(([e]) => t.includes(e))?.[1] ?? "npm";
11467
+ }, Tb = (e) => {
11449
11468
  throw new T(`Unsupported install source: ${String(e)}`);
11450
- }, Cb = (e) => {
11469
+ }, Eb = (e) => {
11451
11470
  switch (e) {
11452
- case "npm": return `npm install --global ${vb}@latest`;
11453
- case "pnpm": return `pnpm add --global ${vb}@latest`;
11454
- case "yarn": return `yarn global add ${vb}@latest`;
11455
- case "bun": return `bun add --global ${vb}@latest`;
11471
+ case "npm": return `npm install --global ${xb}@latest`;
11472
+ case "pnpm": return `pnpm add --global ${xb}@latest`;
11473
+ case "yarn": return `yarn global add ${xb}@latest`;
11474
+ case "bun": return `bun add --global ${xb}@latest`;
11456
11475
  case "npx": throw new T("This CLI runs through npx, which fetches the newest version on every run. There is nothing to update.");
11457
11476
  case "checkout": throw new T("This CLI runs from a source checkout. Update it with git, not with a package manager.");
11458
11477
  /* v8 ignore next 3 -- InstallSource is a closed union; the default only enforces exhaustive handling. */
11459
- default: return Sb(e);
11478
+ default: return Tb(e);
11460
11479
  }
11461
- }, wb = async (e, t) => {
11480
+ }, Db = async (e, t) => {
11462
11481
  let n = await ur(e);
11463
11482
  if (n === null) throw new T("Could not reach the npm registry to look up the newest Qinto CLI.");
11464
11483
  if (!ar(n, Qn)) {
@@ -11472,25 +11491,25 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11472
11491
  throw new T(`\`${t}\` failed: ${e instanceof Error ? e.message : String(e)}`);
11473
11492
  }
11474
11493
  e.stdout(`Updated the Qinto CLI to ${n}.\n`);
11475
- }, Tb = {
11494
+ }, Ob = {
11476
11495
  path: ["update"],
11477
11496
  description: "Update the Qinto CLI to the newest version published on npm",
11478
11497
  positionals: [],
11479
11498
  options: [],
11480
11499
  run: async (e, t) => {
11481
- await wb(t, Cb(xb(bb())));
11500
+ await Db(t, Eb(wb(Cb())));
11482
11501
  }
11483
- }, Eb = (e) => R_(["Scope", "Level / permission"], e.map((e) => {
11502
+ }, kb = (e) => R_(["Scope", "Level / permission"], e.map((e) => {
11484
11503
  let t = gf(e);
11485
11504
  return t === null ? [e, "granted"] : [t.category, t.action];
11486
- }), { indent: 2 }), Db = (e, t) => {
11505
+ }), { indent: 2 }), Ab = (e, t) => {
11487
11506
  let n = [];
11488
11507
  if (e.user === null) {
11489
11508
  let t = e.tokenType === "api_token" ? "a team API token" : "an OAuth token without the profile scope";
11490
11509
  n.push(`Authenticated with ${t} named '${e.name}'.`);
11491
11510
  } else n.push(`Logged in as ${e.user.email}.`);
11492
- 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:", ...Eb(e.scopes)), n;
11493
- }, Ob = async (e, t) => {
11511
+ 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:", ...kb(e.scopes)), n;
11512
+ }, jb = async (e, t) => {
11494
11513
  let n = e.options, r = await J(t, n), i = await Mf(t, r, "/me");
11495
11514
  if (i.status === 401) throw new T(`Your session is no longer valid. Run \`${sf(r)}\` again.`);
11496
11515
  if (!i.ok) throw new T(`The Qinto API answered ${i.status}.`);
@@ -11502,10 +11521,10 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11502
11521
  }, null, 2)}\n`);
11503
11522
  return;
11504
11523
  }
11505
- for (let e of Db(a, o)) t.stdout(`${e}\n`);
11506
- }, kb = [
11507
- lb,
11508
- db,
11524
+ for (let e of Ab(a, o)) t.stdout(`${e}\n`);
11525
+ }, Mb = [
11526
+ fb,
11527
+ mb,
11509
11528
  {
11510
11529
  path: ["whoami"],
11511
11530
  description: "Show who you are logged in as, with your teams, organizations, and scopes",
@@ -11515,45 +11534,45 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11515
11534
  description: "Print the identity as JSON",
11516
11535
  type: "boolean"
11517
11536
  }],
11518
- run: Ob
11537
+ run: jb
11519
11538
  },
11539
+ eb,
11540
+ bb,
11541
+ vb,
11520
11542
  Zy,
11521
- _b,
11522
- hb,
11523
- Jy,
11524
- oy,
11543
+ ly,
11525
11544
  tp,
11526
- Ov,
11545
+ jv,
11527
11546
  B_,
11528
11547
  $d,
11529
11548
  L_,
11530
11549
  Tv,
11531
- Kv,
11550
+ Yv,
11551
+ oy,
11532
11552
  ry,
11533
- ey,
11534
- Xv,
11535
- Jv,
11553
+ $v,
11554
+ Zv,
11555
+ Hv,
11536
11556
  zv,
11537
- Iv,
11538
- iy,
11539
- Tb
11540
- ], Ab = class extends Error {
11557
+ sy,
11558
+ Ob
11559
+ ], Nb = class extends Error {
11541
11560
  exitCode;
11542
11561
  constructor(e, t) {
11543
11562
  super(e), this.exitCode = t;
11544
11563
  }
11545
- }, jb = (e) => {
11564
+ }, Pb = (e) => {
11546
11565
  let t = new oe(e.flag, e.description);
11547
11566
  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;
11548
- }, Mb = async (e, t, n) => {
11567
+ }, Fb = async (e, t, n) => {
11549
11568
  try {
11550
11569
  await e.run(t, n);
11551
11570
  } catch (e) {
11552
- if (e instanceof Error && e.name === "ExitPromptError") throw n.stderr("Aborted.\n"), new Ab("Aborted.", 130);
11571
+ if (e instanceof Error && e.name === "ExitPromptError") throw n.stderr("Aborted.\n"), new Nb("Aborted.", 130);
11553
11572
  let r = e instanceof Error ? e.message : String(e);
11554
- throw n.stderr(t.options.json === !0 ? `${JSON.stringify({ error: r })}\n` : `${r}\n`), new Ab(r, e instanceof E ? 2 : 1);
11573
+ throw n.stderr(t.options.json === !0 ? `${JSON.stringify({ error: r })}\n` : `${r}\n`), new Nb(r, e instanceof E ? 2 : 1);
11555
11574
  }
11556
- }, Nb = (e, t = kb, n = !1) => {
11575
+ }, Ib = (e, t = Mb, n = !1) => {
11557
11576
  let r = new ie("qinto");
11558
11577
  r.description("The Qinto platform CLI"), r.version(qn.version);
11559
11578
  let i = (t) => {
@@ -11580,36 +11599,36 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11580
11599
  let n = e.variadic === !0 ? "..." : "";
11581
11600
  t.argument(e.required ? `<${e.name}${n}>` : `[${e.name}${n}]`, e.description);
11582
11601
  }
11583
- for (let e of n.options) t.addOption(jb(e));
11602
+ for (let e of n.options) t.addOption(Pb(e));
11584
11603
  t.action(async (...r) => {
11585
11604
  let i = r.slice(0, n.positionals.length).flatMap((e) => typeof e == "string" ? [e] : Array.isArray(e) ? e.filter((e) => typeof e == "string") : []);
11586
- await Mb(n, {
11605
+ await Fb(n, {
11587
11606
  options: t.opts(),
11588
11607
  positionals: i
11589
11608
  }, e);
11590
11609
  });
11591
11610
  }
11592
11611
  return r;
11593
- }, Pb = (e) => {
11594
- let t = [...kb].sort((e, t) => t.path.length - e.path.length).find((t) => t.path.every((t, n) => e.at(n) === t));
11612
+ }, Lb = (e) => {
11613
+ let t = [...Mb].sort((e, t) => t.path.length - e.path.length).find((t) => t.path.every((t, n) => e.at(n) === t));
11595
11614
  return t === void 0 || !e.includes("--json") ? !1 : t.options.some((e) => gr(e.flag) === "json");
11596
- }, Fb = async (e, t) => {
11597
- let n = t.length === 0 ? ["--help"] : t, r = Pb(n);
11615
+ }, Rb = async (e, t) => {
11616
+ let n = t.length === 0 ? ["--help"] : t, r = Lb(n);
11598
11617
  try {
11599
- return await Nb(e, kb, r).parseAsync(n, { from: "user" }), 0;
11618
+ return await Ib(e, Mb, r).parseAsync(n, { from: "user" }), 0;
11600
11619
  } catch (t) {
11601
- if (t instanceof Ab) return t.exitCode;
11620
+ if (t instanceof Nb) return t.exitCode;
11602
11621
  if (t instanceof ae) return t.exitCode === 0 ? 0 : (r && e.stderr(`${JSON.stringify({ error: t.message.replace(/^error: /, "") })}\n`), 2);
11603
11622
  throw t;
11604
11623
  }
11605
- }, Ib = async (e, t) => {
11624
+ }, zb = async (e, t) => {
11606
11625
  let n = fr(e, t);
11607
11626
  try {
11608
- return await Fb(e, t);
11627
+ return await Rb(e, t);
11609
11628
  } finally {
11610
11629
  await mr(e, n);
11611
11630
  }
11612
- }, Lb = f(t), Rb = {
11631
+ }, Bb = f(t), Vb = {
11613
11632
  fetch: globalThis.fetch,
11614
11633
  openBrowser: async (e) => {
11615
11634
  await re(e);
@@ -11625,7 +11644,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11625
11644
  settingsPath: s(n(), ".qinto", "settings.json"),
11626
11645
  versionCheckPath: s(n(), ".qinto", "version-check.json"),
11627
11646
  runShell: async (e) => {
11628
- await Lb(e);
11647
+ await Bb(e);
11629
11648
  },
11630
11649
  now: Date.now,
11631
11650
  interactive: process.stdin.isTTY === !0 && process.stderr.isTTY === !0,
@@ -11667,7 +11686,7 @@ ${Object.keys(m_).map((e) => ` <button class="outline" data-std="${e}">${
11667
11686
  }
11668
11687
  };
11669
11688
  try {
11670
- process.exitCode = await Ib(Rb, process.argv.slice(2));
11689
+ process.exitCode = await zb(Vb, process.argv.slice(2));
11671
11690
  } catch (e) {
11672
11691
  process.stderr.write(`${e instanceof Error ? e.message : String(e)}\n`), process.exitCode = 1;
11673
11692
  }