@haakco/hostingctl 1.0.412 → 1.0.521

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/main.js CHANGED
@@ -28142,6 +28142,24 @@ function credentialsPath(env = process.env, platform = process.platform) {
28142
28142
  function credentialDirectory(env = process.env, platform = process.platform) {
28143
28143
  return path.dirname(credentialsPath(env, platform));
28144
28144
  }
28145
+ /**
28146
+ * Create the private directory the credential document lives in, and refuse one this owner did not make.
28147
+ *
28148
+ * Shared with the credential lock, which has to create the directory before it can create its lock file inside
28149
+ * it; a lock is not worth having if its absence is reported as a missing directory. The check is after creation
28150
+ * because `mkdir` succeeds on a directory that is already there — including one that is a link or a file.
28151
+ */
28152
+ async function ensureCredentialDirectory(env = process.env, platform = process.platform) {
28153
+ const directory = credentialDirectory(env, platform);
28154
+ await mkdir(directory, {
28155
+ recursive: true,
28156
+ mode: DIR_MODE
28157
+ });
28158
+ const directoryStat = await lstat(directory);
28159
+ if (directoryStat.isSymbolicLink() || !directoryStat.isDirectory()) throw new CredentialFileError(`${directory} must be a directory, not a link or a file.`);
28160
+ await chmod(directory, DIR_MODE);
28161
+ return directory;
28162
+ }
28145
28163
  /** Whether a filesystem error means "there is no such file" rather than "I could not reach it". */
28146
28164
  function isMissing(error) {
28147
28165
  return error.code === "ENOENT";
@@ -28186,14 +28204,7 @@ async function readCredentialDocument(env = process.env, platform = process.plat
28186
28204
  */
28187
28205
  async function writeCredentialDocument(document, env = process.env, platform = process.platform) {
28188
28206
  const file = credentialsPath(env, platform);
28189
- const directory = credentialDirectory(env, platform);
28190
- await mkdir(directory, {
28191
- recursive: true,
28192
- mode: DIR_MODE
28193
- });
28194
- const directoryStat = await lstat(directory);
28195
- if (directoryStat.isSymbolicLink() || !directoryStat.isDirectory()) throw new CredentialFileError(`${directory} must be a directory, not a link or a file.`);
28196
- await chmod(directory, DIR_MODE);
28207
+ await ensureCredentialDirectory(env, platform);
28197
28208
  const text = `${JSON.stringify(document, null, 2)}\n`;
28198
28209
  if (Buffer.byteLength(text, "utf8") > 65536) throw new CredentialFileError("The credential document is larger than this CLI writes.");
28199
28210
  const temporary = `${file}.${randomBytes(6).toString("hex")}.tmp`;
@@ -28227,6 +28238,50 @@ function parseCredentials(value, subject) {
28227
28238
  expiresAt: record.expiresAt
28228
28239
  };
28229
28240
  }
28241
+ var RETRY_MS = 25;
28242
+ function sleep(ms) {
28243
+ return new Promise((resolve) => {
28244
+ setTimeout(resolve, ms);
28245
+ });
28246
+ }
28247
+ /** Remove a lock whose holder can no longer be running, and leave a live one alone. */
28248
+ function breakStaleLock(lockFile) {
28249
+ try {
28250
+ if (Date.now() - statSync(lockFile).mtimeMs > 6e4) unlinkSync(lockFile);
28251
+ } catch {}
28252
+ }
28253
+ /**
28254
+ * Run `work` while holding the credential file's lock.
28255
+ *
28256
+ * Two commands that both hold a spent refresh token would each spend it, and the second would then sign the
28257
+ * user out with a rotation the server had already invalidated. The lock serialises read-modify-write of the
28258
+ * document, so the second command re-reads the token the first one saved instead of spending the old one. It is
28259
+ * a file lock rather than an in-process one because the hazard is two separate `hostingctl` invocations.
28260
+ */
28261
+ async function withCredentialLock(work, env = process.env, options = {}) {
28262
+ const waitMs = options.waitMs ?? 1e4;
28263
+ const lockFile = `${credentialsPath(env)}.lock`;
28264
+ await ensureCredentialDirectory(env);
28265
+ const deadline = Date.now() + waitMs;
28266
+ let handle = null;
28267
+ while (handle === null) try {
28268
+ handle = openSync(lockFile, "wx", 384);
28269
+ } catch (error) {
28270
+ if (error.code !== "EEXIST") throw error;
28271
+ breakStaleLock(lockFile);
28272
+ if (Date.now() >= deadline) throw new CredentialFileError(`Another hostingctl is updating ${credentialsPath(env)}; waited ${String(Math.round(waitMs / 1e3))} seconds. Try again.`);
28273
+ await sleep(RETRY_MS);
28274
+ }
28275
+ try {
28276
+ writeSync(handle, `${String(process.pid)}\n`);
28277
+ return await work();
28278
+ } finally {
28279
+ closeSync(handle);
28280
+ try {
28281
+ unlinkSync(lockFile);
28282
+ } catch {}
28283
+ }
28284
+ }
28230
28285
  //#endregion
28231
28286
  //#region src/auth/profiles.ts
28232
28287
  /** The profile a legacy single-credential document becomes, and the default until another is chosen. */
@@ -28297,8 +28352,16 @@ async function readProfiles(env = process.env) {
28297
28352
  * target is the operator saying "this is the session I am using"; selecting another is `--profile` or
28298
28353
  * `HOSTINGCTL_PROFILE`. An impersonation token is stored with `makeDefault: false`: starting one must not change
28299
28354
  * which session later commands use.
28355
+ *
28356
+ * The write happens under the credential lock, like the renewal inside `session.ts`: signing in and signing out
28357
+ * are read-modify-writes of the same document, so leaving them unlocked would let a command that is renewing a
28358
+ * token write back a session another command has just removed.
28300
28359
  */
28301
28360
  async function saveProfile(credentials, name, env = process.env, options = {}) {
28361
+ return await withCredentialLock(async () => await saveProfileLocked(credentials, name, env, options), env);
28362
+ }
28363
+ /** The `saveProfile` read-modify-write for a caller that already holds the credential lock. */
28364
+ async function saveProfileLocked(credentials, name, env = process.env, options = {}) {
28302
28365
  if (!isValidProfileName(name)) throw new CredentialFileError(`"${name}" is not a usable profile name.`);
28303
28366
  const document = await readProfiles(env);
28304
28367
  return await writeCredentialDocument({
@@ -28318,6 +28381,10 @@ async function saveProfile(credentials, name, env = process.env, options = {}) {
28318
28381
  * back to the first profile still present so the next command does not name a profile that is gone.
28319
28382
  */
28320
28383
  async function removeProfile(name, env = process.env) {
28384
+ return await withCredentialLock(async () => await removeProfileLocked(name, env), env);
28385
+ }
28386
+ /** The `removeProfile` read-modify-write for a caller that already holds the credential lock. */
28387
+ async function removeProfileLocked(name, env = process.env) {
28321
28388
  const document = await readProfiles(env);
28322
28389
  if (document.profiles[name] === void 0) return null;
28323
28390
  const profiles = { ...document.profiles };
@@ -28604,12 +28671,12 @@ function authorizeUrl(apiUrl, clientId, state, challenge) {
28604
28671
  return url.toString();
28605
28672
  }
28606
28673
  /**
28607
- * Prove a freshly minted token against the API before anybody is told the sign-in worked.
28674
+ * Prove a token against the API before anybody is told the session works.
28608
28675
  *
28609
28676
  * Tokens are minted by Passport but the API is the only owner of "may this token act here": an audience, a
28610
- * permission or an account-state refusal shows up here and nowhere in the exchange. A failed proof leaves the
28611
- * session exactly as it was — the caller has not saved anything yet — so a bad sign-in cannot replace a working
28612
- * one.
28677
+ * permission or an account-state refusal shows up here and nowhere in the exchange. The messages describe the
28678
+ * proof alone, because the consequence of failing it belongs to the caller: `login` has saved nothing yet, while
28679
+ * `auth status --verify` may have just saved a renewed token, so only that caller can say what a failure means.
28613
28680
  */
28614
28681
  async function proveApiAccess(apiUrl, accessToken, dependencies = {}) {
28615
28682
  const fetchImpl = dependencies.fetchImpl ?? fetch;
@@ -28624,9 +28691,9 @@ async function proveApiAccess(apiUrl, accessToken, dependencies = {}) {
28624
28691
  signal: AbortSignal.timeout(AUTH_REQUEST_TIMEOUT_MS)
28625
28692
  });
28626
28693
  } catch (error) {
28627
- throw new LoginError(error.name === "TimeoutError" ? `The API did not confirm the new session within ${String(AUTH_REQUEST_TIMEOUT_MS / 1e3)} seconds; nothing was saved.` : "The API could not be reached to confirm the new session; nothing was saved.");
28694
+ throw new LoginError(error.name === "TimeoutError" ? `The API did not confirm the session within ${String(AUTH_REQUEST_TIMEOUT_MS / 1e3)} seconds.` : "The API could not be reached to confirm the session.");
28628
28695
  }
28629
- if (!response.ok) throw new LoginError(`The API refused the new session (${String(response.status)}); nothing was saved.`);
28696
+ if (!response.ok) throw new LoginError(`The API refused the session (${String(response.status)}).`);
28630
28697
  const text = await boundedBody(response, "API's identity");
28631
28698
  let parsed;
28632
28699
  try {
@@ -28635,7 +28702,7 @@ async function proveApiAccess(apiUrl, accessToken, dependencies = {}) {
28635
28702
  parsed = null;
28636
28703
  }
28637
28704
  const identity = typeof parsed === "object" && parsed !== null ? parsed : null;
28638
- if (typeof identity?.uuid !== "string" || typeof identity.email !== "string") throw new LoginError("The API's identity answer was not the one this CLI expects; nothing was saved.");
28705
+ if (typeof identity?.uuid !== "string" || typeof identity.email !== "string") throw new LoginError("The API's identity answer was not the one this CLI expects.");
28639
28706
  return {
28640
28707
  uuid: identity.uuid,
28641
28708
  email: identity.email,
@@ -28661,9 +28728,15 @@ async function login$1(apiUrl, clientId, dependencies) {
28661
28728
  code: await receiveAuthorizationCode(state, authorizeUrl(apiUrl, clientId, state, challengeFor(verifier)), dependencies),
28662
28729
  code_verifier: verifier
28663
28730
  }, fetchImpl, now);
28731
+ let account;
28732
+ try {
28733
+ account = await proveApiAccess(apiUrl, credentials.accessToken, { fetchImpl });
28734
+ } catch (error) {
28735
+ throw new LoginError(`${error instanceof Error ? error.message : String(error)} Nothing was saved.`);
28736
+ }
28664
28737
  return {
28665
28738
  credentials,
28666
- account: await proveApiAccess(apiUrl, credentials.accessToken, { fetchImpl })
28739
+ account
28667
28740
  };
28668
28741
  }
28669
28742
  /**
@@ -28678,49 +28751,6 @@ async function receiveAuthorizationCode(state, url, dependencies) {
28678
28751
  await dependencies.open(url);
28679
28752
  return await manualCallback(state, read);
28680
28753
  }
28681
- var RETRY_MS = 25;
28682
- function sleep(ms) {
28683
- return new Promise((resolve) => {
28684
- setTimeout(resolve, ms);
28685
- });
28686
- }
28687
- /** Remove a lock whose holder can no longer be running, and leave a live one alone. */
28688
- function breakStaleLock(lockFile) {
28689
- try {
28690
- if (Date.now() - statSync(lockFile).mtimeMs > 6e4) unlinkSync(lockFile);
28691
- } catch {}
28692
- }
28693
- /**
28694
- * Run `work` while holding the credential file's lock.
28695
- *
28696
- * Two commands that both hold a spent refresh token would each spend it, and the second would then sign the
28697
- * user out with a rotation the server had already invalidated. The lock serialises read-modify-write of the
28698
- * document, so the second command re-reads the token the first one saved instead of spending the old one. It is
28699
- * a file lock rather than an in-process one because the hazard is two separate `hostingctl` invocations.
28700
- */
28701
- async function withCredentialLock(work, env = process.env, options = {}) {
28702
- const waitMs = options.waitMs ?? 1e4;
28703
- const lockFile = `${credentialsPath(env)}.lock`;
28704
- const deadline = Date.now() + waitMs;
28705
- let handle = null;
28706
- while (handle === null) try {
28707
- handle = openSync(lockFile, "wx", 384);
28708
- } catch (error) {
28709
- if (error.code !== "EEXIST") throw error;
28710
- breakStaleLock(lockFile);
28711
- if (Date.now() >= deadline) throw new CredentialFileError(`Another hostingctl is updating ${credentialsPath(env)}; waited ${String(Math.round(waitMs / 1e3))} seconds. Try again.`);
28712
- await sleep(RETRY_MS);
28713
- }
28714
- try {
28715
- writeSync(handle, `${String(process.pid)}\n`);
28716
- return await work();
28717
- } finally {
28718
- closeSync(handle);
28719
- try {
28720
- unlinkSync(lockFile);
28721
- } catch {}
28722
- }
28723
- }
28724
28754
  //#endregion
28725
28755
  //#region src/cli-metadata.ts
28726
28756
  /**
@@ -29006,7 +29036,7 @@ async function renewedCredentials(name, current, env) {
29006
29036
  if (held.accessToken !== current.accessToken && held.expiresAt > Date.now()) return held;
29007
29037
  if (held.refreshToken === "") throw new ApiError(0, `Profile "${name}" is a one-time session with no refresh token; start it again.`);
29008
29038
  const renewed = await refreshOrExplain(held, name);
29009
- await saveProfile(renewed, name, env);
29039
+ await saveProfileLocked(renewed, name, env);
29010
29040
  return renewed;
29011
29041
  }
29012
29042
  /**
@@ -29748,6 +29778,22 @@ function billingCreditNoteDocumentsFile(options) {
29748
29778
  }));
29749
29779
  }
29750
29780
  /**
29781
+ * {@link /c/:company/billing/discounts/redeem}
29782
+ */
29783
+ function companyBillingDiscountRedeem(options) {
29784
+ const { client: request = client, ...config } = options;
29785
+ return withUnwrap(request({
29786
+ method: "POST",
29787
+ url: "/c/{company}/billing/discounts/redeem",
29788
+ security: [{
29789
+ type: "http",
29790
+ scheme: "bearer"
29791
+ }],
29792
+ ...config,
29793
+ throwOnError: config.throwOnError ?? true
29794
+ }));
29795
+ }
29796
+ /**
29751
29797
  * {@link /c/:company/billing/invoices}
29752
29798
  */
29753
29799
  function companyBillingInvoiceIndex(options) {
@@ -32702,6 +32748,22 @@ function hostingCancellationReconfirm(options) {
32702
32748
  }));
32703
32749
  }
32704
32750
  /**
32751
+ * {@link /c/:company/hosting/environments/:environmentUuid/applications/:workloadUuid/public-key}
32752
+ */
32753
+ function hostingApplicationsPublicKey(options) {
32754
+ const { client: request = client, ...config } = options;
32755
+ return withUnwrap(request({
32756
+ method: "GET",
32757
+ url: "/c/{company}/hosting/environments/{environmentUuid}/applications/{workloadUuid}/public-key",
32758
+ security: [{
32759
+ type: "http",
32760
+ scheme: "bearer"
32761
+ }],
32762
+ ...config,
32763
+ throwOnError: config.throwOnError ?? true
32764
+ }));
32765
+ }
32766
+ /**
32705
32767
  * {@link /c/:company/hosting/environments/:environmentUuid/configuration}
32706
32768
  */
32707
32769
  function hostingConfigurationShow(options) {
@@ -33690,6 +33752,22 @@ function hostingPersonalKeyDestroy(options) {
33690
33752
  }));
33691
33753
  }
33692
33754
  /**
33755
+ * {@link /c/:company/hosting/php-versions}
33756
+ */
33757
+ function hostingPhpVersionsIndex(options) {
33758
+ const { client: request = client, ...config } = options;
33759
+ return withUnwrap(request({
33760
+ method: "GET",
33761
+ url: "/c/{company}/hosting/php-versions",
33762
+ security: [{
33763
+ type: "http",
33764
+ scheme: "bearer"
33765
+ }],
33766
+ ...config,
33767
+ throwOnError: config.throwOnError ?? true
33768
+ }));
33769
+ }
33770
+ /**
33693
33771
  * {@link /c/:company/hosting/environments/:environmentUuid/applications/:workloadUuid/runs}
33694
33772
  */
33695
33773
  function hostingProcessRunIndex(options) {
@@ -35113,6 +35191,55 @@ function platformAlertUpdateSettings(options) {
35113
35191
  }));
35114
35192
  }
35115
35193
  /**
35194
+ * {@link /platform/billing/discounts}
35195
+ */
35196
+ function platformBillingDiscountIndex(options = {}) {
35197
+ const { client: request = client, ...config } = options;
35198
+ return withUnwrap(request({
35199
+ method: "GET",
35200
+ url: "/platform/billing/discounts",
35201
+ security: [{
35202
+ type: "http",
35203
+ scheme: "bearer"
35204
+ }],
35205
+ ...config,
35206
+ throwOnError: config.throwOnError ?? true
35207
+ }));
35208
+ }
35209
+ /**
35210
+ * {@link /platform/billing/discounts}
35211
+ */
35212
+ function platformBillingDiscountStore(options) {
35213
+ const { client: request = client, ...config } = options;
35214
+ return withUnwrap(request({
35215
+ method: "POST",
35216
+ url: "/platform/billing/discounts",
35217
+ security: [{
35218
+ type: "http",
35219
+ scheme: "bearer"
35220
+ }],
35221
+ ...config,
35222
+ throwOnError: config.throwOnError ?? true
35223
+ }));
35224
+ }
35225
+ /**
35226
+ * @summary Stop a code being redeemed. The promise it already made keeps running
35227
+ * {@link /platform/billing/discounts/:codeUuid/end}
35228
+ */
35229
+ function platformBillingDiscountEnd(options) {
35230
+ const { client: request = client, ...config } = options;
35231
+ return withUnwrap(request({
35232
+ method: "POST",
35233
+ url: "/platform/billing/discounts/{codeUuid}/end",
35234
+ security: [{
35235
+ type: "http",
35236
+ scheme: "bearer"
35237
+ }],
35238
+ ...config,
35239
+ throwOnError: config.throwOnError ?? true
35240
+ }));
35241
+ }
35242
+ /**
35116
35243
  * @summary The recent packs, bounded rather than paged: an accountant asks for one a month
35117
35244
  * {@link /platform/billing/exports}
35118
35245
  */
@@ -36268,7 +36395,7 @@ function yahooFeedbackUpdate(options) {
36268
36395
  }
36269
36396
  //#endregion
36270
36397
  //#region src/commands/auth-account.ts
36271
- var USAGE$51 = [
36398
+ var USAGE$52 = [
36272
36399
  "Usage: hostingctl auth closure show",
36273
36400
  " hostingctl auth closure request --reason <text> (--current-password-file <path>|--current-password-stdin)",
36274
36401
  " hostingctl auth picture set --image-file <path>",
@@ -36292,26 +36419,26 @@ async function account$1(context, subcommand, rest) {
36292
36419
  if (subcommand === "closure") return await closure(context, action, tail);
36293
36420
  if (subcommand === "picture") return await picture(context, action, tail);
36294
36421
  if (subcommand === "notifications") return await notifications(context, action, tail);
36295
- throw new UsageError(USAGE$51);
36422
+ throw new UsageError(USAGE$52);
36296
36423
  }
36297
36424
  /** `auth closure show|request`. */
36298
36425
  async function closure(context, action, tail) {
36299
- if (tail.length > 0) throw new UsageError(USAGE$51);
36426
+ if (tail.length > 0) throw new UsageError(USAGE$52);
36300
36427
  if (action === "show") return (await accountClosureShow({})).data;
36301
36428
  if (action === "request") return await closeAccount(context);
36302
- throw new UsageError(USAGE$51);
36429
+ throw new UsageError(USAGE$52);
36303
36430
  }
36304
36431
  /** `auth picture set|remove`. */
36305
36432
  async function picture(context, action, tail) {
36306
- if (tail.length > 0) throw new UsageError(USAGE$51);
36433
+ if (tail.length > 0) throw new UsageError(USAGE$52);
36307
36434
  if (action === "set") return await setPicture(context);
36308
36435
  if (action === "remove") return await removePicture(context);
36309
- throw new UsageError(USAGE$51);
36436
+ throw new UsageError(USAGE$52);
36310
36437
  }
36311
36438
  /** `auth notifications`, `read <id>` or `read-all`. */
36312
36439
  async function notifications(context, action, tail) {
36313
36440
  if (action === void 0) {
36314
- if (tail.length > 0) throw new UsageError(USAGE$51);
36441
+ if (tail.length > 0) throw new UsageError(USAGE$52);
36315
36442
  return await allPages(async (page, perPage) => {
36316
36443
  const answer = await notificationIndex({ query: {
36317
36444
  page,
@@ -36327,7 +36454,7 @@ async function notifications(context, action, tail) {
36327
36454
  await notificationMarkAllRead({});
36328
36455
  return null;
36329
36456
  });
36330
- if (action !== "read" || tail.length !== 1) throw new UsageError(USAGE$51);
36457
+ if (action !== "read" || tail.length !== 1) throw new UsageError(USAGE$52);
36331
36458
  const notification = tail[0] ?? "";
36332
36459
  return await confirmableWrite(context, `Mark notification ${notification} read.`, async () => {
36333
36460
  await notificationMarkRead({ path: { notification } });
@@ -36343,11 +36470,11 @@ async function notifications(context, action, tail) {
36343
36470
  */
36344
36471
  async function closeAccount(context) {
36345
36472
  const reason = context.flags.get("--reason")?.trim() ?? "";
36346
- if (reason === "") throw new UsageError(`closure request needs --reason.\n\n${USAGE$51}`);
36473
+ if (reason === "") throw new UsageError(`closure request needs --reason.\n\n${USAGE$52}`);
36347
36474
  return await confirmableWrite(context, ["Close this account, which removes the data the review lists and keeps what it lists as retained.", " The review is re-read first, so the digest sent is the one you are shown now."].join("\n"), async () => {
36348
36475
  const review = (await accountClosureShow({})).data;
36349
36476
  if (review.blockingReasons.length > 0) throw new UsageError(["This account cannot be closed while these reasons block it:", ...review.blockingReasons.map((one) => ` ${one.companySlug} (${one.role}): ${one.reason}`)].join("\n"));
36350
- const currentPassword = readSecret(context, "current-password", 1024, USAGE$51);
36477
+ const currentPassword = readSecret(context, "current-password", 1024, USAGE$52);
36351
36478
  return (await accountClosureStore({ body: {
36352
36479
  reason,
36353
36480
  reviewedDigest: review.digest,
@@ -36359,7 +36486,7 @@ async function closeAccount(context) {
36359
36486
  async function setPicture(context) {
36360
36487
  const file = context.flags.get("--image-file") ?? "";
36361
36488
  return await confirmableWrite(context, file === "" ? "Set the profile picture." : `Set the profile picture to ${file}.`, async () => {
36362
- return (await profilePictureStore({ body: await imageUpload(file, USAGE$51) })).data;
36489
+ return (await profilePictureStore({ body: await imageUpload(file, USAGE$52) })).data;
36363
36490
  });
36364
36491
  }
36365
36492
  /** `auth picture remove`. */
@@ -36370,7 +36497,7 @@ async function removePicture(context) {
36370
36497
  }
36371
36498
  //#endregion
36372
36499
  //#region src/commands/auth-identity.ts
36373
- var USAGE$50 = [
36500
+ var USAGE$51 = [
36374
36501
  "Usage: hostingctl auth profile [--name <name>] [--email <email>] [--current-password-file <path>]",
36375
36502
  " hostingctl auth password (--current-password-file <path>|--current-password-stdin) (--new-password-file <path>|--new-password-stdin)",
36376
36503
  " hostingctl auth register --name <name> --email <email> (--password-file <path>|--password-stdin)",
@@ -36395,12 +36522,12 @@ var MAX_TOKEN_BYTES = 4096;
36395
36522
  /** One required flag's value, or a refusal naming the flag. */
36396
36523
  function required$3(context, flag) {
36397
36524
  const value = context.flags.get(flag)?.trim() ?? "";
36398
- if (value === "") throw new UsageError(`${flag} is required.\n\n${USAGE$50}`);
36525
+ if (value === "") throw new UsageError(`${flag} is required.\n\n${USAGE$51}`);
36399
36526
  return value;
36400
36527
  }
36401
36528
  /** No positional arguments: every input here is a flag or a secret source. */
36402
36529
  function noPositional(rest) {
36403
- if (rest.length > 0) throw new UsageError(USAGE$50);
36530
+ if (rest.length > 0) throw new UsageError(USAGE$51);
36404
36531
  }
36405
36532
  /** The API's password contract takes a confirmation; the CLI's one input is the new password itself. */
36406
36533
  function passwordBody(password) {
@@ -36423,16 +36550,16 @@ async function identity(context, subcommand, rest) {
36423
36550
  if (subcommand === "forgot-password") return await forgotPassword(context);
36424
36551
  if (subcommand === "reset-password") return await resetPassword(context);
36425
36552
  if (subcommand === "verify-email") return await verifyEmail(context);
36426
- throw new UsageError(USAGE$50);
36553
+ throw new UsageError(USAGE$51);
36427
36554
  }
36428
36555
  /** `auth profile`: the account's own name and email, with the current password only when the email changes. */
36429
36556
  async function profile$2(context) {
36430
36557
  const name = context.flags.get("--name")?.trim() ?? "";
36431
36558
  const email = context.flags.get("--email")?.trim() ?? "";
36432
- if (name === "" && email === "" && !context.flags.has("--current-password-file") && !context.flags.has("--current-password-stdin")) throw new UsageError(`Pass --name, --email, or both.\n\n${USAGE$50}`);
36559
+ if (name === "" && email === "" && !context.flags.has("--current-password-file") && !context.flags.has("--current-password-stdin")) throw new UsageError(`Pass --name, --email, or both.\n\n${USAGE$51}`);
36433
36560
  return await confirmableWrite(context, `Update the account's ${[name === "" ? null : `name to "${name}"`, email === "" ? null : `email to ${email}`].filter((one) => one !== null).join(" and ")}.`, async () => {
36434
36561
  const current = (await authMe({})).data;
36435
- const currentPassword = hasSecret(context, "current-password") ? readSecret(context, "current-password", MAX_PASSWORD_BYTES, USAGE$50) : void 0;
36562
+ const currentPassword = hasSecret(context, "current-password") ? readSecret(context, "current-password", MAX_PASSWORD_BYTES, USAGE$51) : void 0;
36436
36563
  return (await authUpdateProfile({ body: {
36437
36564
  name: name === "" ? current.name ?? "" : name,
36438
36565
  email: email === "" ? current.email ?? "" : email,
@@ -36448,8 +36575,8 @@ function hasSecret(context, name) {
36448
36575
  async function password$1(context) {
36449
36576
  return await confirmableWrite(context, "Change the account's password.", async () => {
36450
36577
  return (await authChangePassword({ body: {
36451
- currentPassword: readSecret(context, "current-password", MAX_PASSWORD_BYTES, USAGE$50),
36452
- ...passwordBody(readSecret(context, "new-password", MAX_PASSWORD_BYTES, USAGE$50))
36578
+ currentPassword: readSecret(context, "current-password", MAX_PASSWORD_BYTES, USAGE$51),
36579
+ ...passwordBody(readSecret(context, "new-password", MAX_PASSWORD_BYTES, USAGE$51))
36453
36580
  } })).data;
36454
36581
  });
36455
36582
  }
@@ -36461,7 +36588,7 @@ async function register$1(context) {
36461
36588
  return (await authRegister({ body: {
36462
36589
  name,
36463
36590
  email,
36464
- ...passwordBody(readSecret(context, "password", MAX_PASSWORD_BYTES, USAGE$50))
36591
+ ...passwordBody(readSecret(context, "password", MAX_PASSWORD_BYTES, USAGE$51))
36465
36592
  } })).data;
36466
36593
  });
36467
36594
  }
@@ -36476,8 +36603,8 @@ async function forgotPassword(context) {
36476
36603
  async function resetPassword(context) {
36477
36604
  const email = required$3(context, "--email");
36478
36605
  return await confirmableWrite(context, `Reset the password for ${email}.`, async () => {
36479
- const token = readSecret(context, "token", MAX_TOKEN_BYTES, USAGE$50);
36480
- const password = readSecret(context, "password", MAX_PASSWORD_BYTES, USAGE$50);
36606
+ const token = readSecret(context, "token", MAX_TOKEN_BYTES, USAGE$51);
36607
+ const password = readSecret(context, "password", MAX_PASSWORD_BYTES, USAGE$51);
36481
36608
  return (await authResetPassword({ body: {
36482
36609
  token,
36483
36610
  email,
@@ -36493,7 +36620,7 @@ async function verifyEmail(context) {
36493
36620
  }
36494
36621
  //#endregion
36495
36622
  //#region src/commands/auth-impersonation.ts
36496
- var USAGE$49 = [
36623
+ var USAGE$50 = [
36497
36624
  "Usage: hostingctl auth impersonate start --target <user-uuid> --company <slug> --reason <text> [--minutes <n>] --store-as <profile>",
36498
36625
  " hostingctl auth impersonate status",
36499
36626
  " hostingctl auth impersonate stop",
@@ -36526,7 +36653,7 @@ async function impersonation(context, rest) {
36526
36653
  if (action === "stop" && tail.length === 0) return await stop(context);
36527
36654
  if (action === "list" && tail.length === 0) return await list$5();
36528
36655
  if (action === "end" && tail.length === 1) return await end(context, tail[0] ?? "");
36529
- throw new UsageError(USAGE$49);
36656
+ throw new UsageError(USAGE$50);
36530
36657
  }
36531
36658
  /** `start`: mint a token for another user, and keep it in a profile of its own. */
36532
36659
  async function start(context) {
@@ -36534,8 +36661,8 @@ async function start(context) {
36534
36661
  const company = context.flags.get("--company")?.trim() ?? "";
36535
36662
  const reason = context.flags.get("--reason")?.trim() ?? "";
36536
36663
  const storeAs = context.flags.get("--store-as")?.trim() ?? "";
36537
- if (target === "" || company === "" || reason === "") throw new UsageError(`start needs --target, --company and --reason.\n\n${USAGE$49}`);
36538
- if (storeAs === "") throw new UsageError(`start needs --store-as <profile>.\n\n${USAGE$49}`);
36664
+ if (target === "" || company === "" || reason === "") throw new UsageError(`start needs --target, --company and --reason.\n\n${USAGE$50}`);
36665
+ if (storeAs === "") throw new UsageError(`start needs --store-as <profile>.\n\n${USAGE$50}`);
36539
36666
  const minutes = wholeNumberFlag(context.flags, "--minutes") ?? DEFAULT_MINUTES;
36540
36667
  const document = await readProfiles();
36541
36668
  const operator = namedProfile(context.flags, document);
@@ -36629,7 +36756,7 @@ async function list$5() {
36629
36756
  }
36630
36757
  /** `end <uuid>`: end one recorded session by its uuid. */
36631
36758
  async function end(context, uuid) {
36632
- if (uuid === "") throw new UsageError(USAGE$49);
36759
+ if (uuid === "") throw new UsageError(USAGE$50);
36633
36760
  return await confirmableWrite(context, `End impersonation session ${uuid}.`, async () => ({
36634
36761
  ...EMPTY,
36635
36762
  action: "end",
@@ -36638,7 +36765,7 @@ async function end(context, uuid) {
36638
36765
  }
36639
36766
  //#endregion
36640
36767
  //#region src/commands/auth-push.ts
36641
- var USAGE$48 = [
36768
+ var USAGE$49 = [
36642
36769
  "Usage: hostingctl auth push-token set (--token-file <path>|--token-stdin)",
36643
36770
  " hostingctl auth push-token remove (--token-file <path>|--token-stdin)",
36644
36771
  "",
@@ -36649,12 +36776,12 @@ var USAGE$48 = [
36649
36776
  /** `auth push-token set|remove`: this account's mobile push registration. */
36650
36777
  async function authPush(context, rest) {
36651
36778
  const [action, ...tail] = rest;
36652
- if (tail.length > 0) throw new UsageError(USAGE$48);
36779
+ if (tail.length > 0) throw new UsageError(USAGE$49);
36653
36780
  if (action === "set") return {
36654
36781
  kind: "push-token",
36655
36782
  action: "set",
36656
36783
  sent: (await confirmableWrite(context, "Register this device's push token.", async () => {
36657
- await expoTokenStore({ body: { token: readSecret(context, "token", 4096, USAGE$48) } });
36784
+ await expoTokenStore({ body: { token: readSecret(context, "token", 4096, USAGE$49) } });
36658
36785
  return null;
36659
36786
  })).sent
36660
36787
  };
@@ -36662,11 +36789,11 @@ async function authPush(context, rest) {
36662
36789
  kind: "push-token",
36663
36790
  action: "remove",
36664
36791
  sent: (await confirmableWrite(context, "Remove this device's push token.", async () => {
36665
- await expoTokenDestroy({ query: { token: readSecret(context, "token", 4096, USAGE$48) } });
36792
+ await expoTokenDestroy({ query: { token: readSecret(context, "token", 4096, USAGE$49) } });
36666
36793
  return null;
36667
36794
  })).sent
36668
36795
  };
36669
- throw new UsageError(USAGE$48);
36796
+ throw new UsageError(USAGE$49);
36670
36797
  }
36671
36798
  /** The `auth push-token` renderer. */
36672
36799
  function authPushText(report) {
@@ -36817,47 +36944,47 @@ var AUTH_METADATA = {
36817
36944
  var AUTH_TOPICS = [
36818
36945
  {
36819
36946
  path: ["profile"],
36820
- usage: USAGE$50
36947
+ usage: USAGE$51
36821
36948
  },
36822
36949
  {
36823
36950
  path: ["password"],
36824
- usage: USAGE$50
36951
+ usage: USAGE$51
36825
36952
  },
36826
36953
  {
36827
36954
  path: ["register"],
36828
- usage: USAGE$50
36955
+ usage: USAGE$51
36829
36956
  },
36830
36957
  {
36831
36958
  path: ["forgot-password"],
36832
- usage: USAGE$50
36959
+ usage: USAGE$51
36833
36960
  },
36834
36961
  {
36835
36962
  path: ["reset-password"],
36836
- usage: USAGE$50
36963
+ usage: USAGE$51
36837
36964
  },
36838
36965
  {
36839
36966
  path: ["verify-email"],
36840
- usage: USAGE$50
36967
+ usage: USAGE$51
36841
36968
  },
36842
36969
  {
36843
36970
  path: ["closure"],
36844
- usage: USAGE$51
36971
+ usage: USAGE$52
36845
36972
  },
36846
36973
  {
36847
36974
  path: ["picture"],
36848
- usage: USAGE$51
36975
+ usage: USAGE$52
36849
36976
  },
36850
36977
  {
36851
36978
  path: ["notifications"],
36852
- usage: USAGE$51
36979
+ usage: USAGE$52
36853
36980
  },
36854
36981
  {
36855
36982
  path: ["push-token"],
36856
- usage: USAGE$48
36983
+ usage: USAGE$49
36857
36984
  },
36858
36985
  {
36859
36986
  path: ["impersonate"],
36860
- usage: USAGE$49
36987
+ usage: USAGE$50
36861
36988
  }
36862
36989
  ];
36863
36990
  //#endregion
@@ -37167,16 +37294,23 @@ async function status(context, rest) {
37167
37294
  verificationError: null
37168
37295
  };
37169
37296
  if (!context.flags.has("--verify")) return report;
37297
+ let current = report;
37170
37298
  try {
37171
- const account = await proveApiAccess(stored.apiUrl, stored.accessToken);
37172
- return {
37299
+ const target = await sessionTarget({ profile });
37300
+ const held = (await readProfiles()).profiles[profile];
37301
+ if (held !== void 0) current = {
37173
37302
  ...report,
37303
+ expiresAt: new Date(held.expiresAt).toISOString(),
37304
+ expired: held.expiresAt <= Date.now()
37305
+ };
37306
+ return {
37307
+ ...current,
37174
37308
  verified: true,
37175
- account
37309
+ account: await proveApiAccess(target.baseURL, target.token)
37176
37310
  };
37177
37311
  } catch (error) {
37178
37312
  return {
37179
- ...report,
37313
+ ...current,
37180
37314
  verified: false,
37181
37315
  verificationError: error instanceof Error ? error.message : String(error)
37182
37316
  };
@@ -37390,7 +37524,7 @@ var MAILBOX_TOPICS = [{
37390
37524
  }];
37391
37525
  //#endregion
37392
37526
  //#region src/commands/mailbox-recovery.ts
37393
- var USAGE$47 = [
37527
+ var USAGE$48 = [
37394
37528
  "Usage: hostingctl mailbox recovery <request|verify|reset> [options]",
37395
37529
  "",
37396
37530
  " request --address <address> Ask for a self-service reset link for a mailbox address.",
@@ -37418,16 +37552,16 @@ function isSessionlessMailboxCommand(argv) {
37418
37552
  /** `mailbox recovery request|verify|reset`: the unauthenticated, token-authorized recovery journey. */
37419
37553
  async function runMailboxRecovery(context, rest) {
37420
37554
  const [action, extra] = rest;
37421
- if (extra !== void 0) throw new UsageError(USAGE$47);
37555
+ if (extra !== void 0) throw new UsageError(USAGE$48);
37422
37556
  if (action === "request") return await request$1(context);
37423
37557
  if (action === "verify") return await verify$1(context);
37424
37558
  if (action === "reset") return await reset(context);
37425
- throw new UsageError(USAGE$47);
37559
+ throw new UsageError(USAGE$48);
37426
37560
  }
37427
37561
  /** `request`: the answer is deliberately identical whether or not an eligible mailbox exists. */
37428
37562
  async function request$1(context) {
37429
37563
  const address = context.flags.get("--address");
37430
- if (address === void 0 || address === "") throw new UsageError(USAGE$47);
37564
+ if (address === void 0 || address === "") throw new UsageError(USAGE$48);
37431
37565
  return await confirmableWrite(context, `Request a mailbox recovery link for ${address}. The answer is the same for an unknown mailbox, one with no confirmed fallback, and an eligible one.`, async () => (await emailMailboxRecoveryRequest({ body: { address } })).data);
37432
37566
  }
37433
37567
  /** `verify`: the token is read only when the send actually happens, so a dry run never touches a secret. */
@@ -37448,7 +37582,7 @@ async function reset(context) {
37448
37582
  }
37449
37583
  /** One recovery token or new password, read from a private file or stdin under the recovery bound. */
37450
37584
  function recoverySecret(context, name) {
37451
- return readSecret(context, name, MAX_RECOVERY_SECRET_BYTES, USAGE$47);
37585
+ return readSecret(context, name, MAX_RECOVERY_SECRET_BYTES, USAGE$48);
37452
37586
  }
37453
37587
  //#endregion
37454
37588
  //#region src/commands/mailbox.ts
@@ -37584,7 +37718,7 @@ async function environmentGeneration(path) {
37584
37718
  //#endregion
37585
37719
  //#region src/commands/access-credentials.ts
37586
37720
  /** The usage this module refuses with, owned by the commands it implements. */
37587
- var USAGE$46 = [
37721
+ var USAGE$47 = [
37588
37722
  "Usage: hostingctl access key add <environment-uuid> --company <slug> --access-user <uuid> --name <n> --public-key-file <path>",
37589
37723
  " hostingctl access key remove <environment-uuid> --company <slug> --access-user <uuid> <key-uuid>",
37590
37724
  " hostingctl access password set <environment-uuid> --company <slug> --access-user <uuid> (--password-file <path>|--password-stdin)",
@@ -37602,12 +37736,12 @@ var USAGE$46 = [
37602
37736
  /** `key add|remove`. */
37603
37737
  async function key(context, path, action, tail) {
37604
37738
  const accessUserUuid = context.flags.get("--access-user") ?? "";
37605
- if (accessUserUuid === "") throw new UsageError(`key needs --access-user.\\n\\n${USAGE$46}`);
37739
+ if (accessUserUuid === "") throw new UsageError(`key needs --access-user.\\n\\n${USAGE$47}`);
37606
37740
  if (action === "add") {
37607
- if (tail.length > 0) throw new UsageError(USAGE$46);
37741
+ if (tail.length > 0) throw new UsageError(USAGE$47);
37608
37742
  const name = context.flags.get("--name")?.trim() ?? "";
37609
37743
  const file = context.flags.get("--public-key-file") ?? "";
37610
- if (name === "" || file === "") throw new UsageError(`key add needs --name and --public-key-file.\\n\\n${USAGE$46}`);
37744
+ if (name === "" || file === "") throw new UsageError(`key add needs --name and --public-key-file.\\n\\n${USAGE$47}`);
37611
37745
  const publicKey = readPrivateFile(file, "public key", 8192).trim();
37612
37746
  return await confirmableWrite(context, `Add key "${name}" to login ${accessUserUuid}.`, async () => {
37613
37747
  const body = {
@@ -37626,7 +37760,7 @@ async function key(context, path, action, tail) {
37626
37760
  }
37627
37761
  if (action === "remove") {
37628
37762
  const [keyUuid, ...extra] = tail;
37629
- if (keyUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$46);
37763
+ if (keyUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$47);
37630
37764
  return await confirmableWrite(context, `Remove key ${keyUuid} from login ${accessUserUuid}.`, async () => {
37631
37765
  return (await hostingAccessDestroyKey({
37632
37766
  path: {
@@ -37638,18 +37772,18 @@ async function key(context, path, action, tail) {
37638
37772
  })).data;
37639
37773
  });
37640
37774
  }
37641
- throw new UsageError(USAGE$46);
37775
+ throw new UsageError(USAGE$47);
37642
37776
  }
37643
37777
  /** `password set|clear`. */
37644
37778
  async function password(context, path, action, tail) {
37645
37779
  const accessUserUuid = context.flags.get("--access-user") ?? "";
37646
- if (accessUserUuid === "" || tail.length > 0) throw new UsageError(`password needs --access-user.\\n\\n${USAGE$46}`);
37780
+ if (accessUserUuid === "" || tail.length > 0) throw new UsageError(`password needs --access-user.\\n\\n${USAGE$47}`);
37647
37781
  const userPath = {
37648
37782
  ...path,
37649
37783
  accessUserUuid
37650
37784
  };
37651
37785
  if (action === "set") return await confirmableWrite(context, "Set this login's password. The previous password stops working when the change is applied.", async () => {
37652
- const password = readSecret(context, "password", 1024, USAGE$46);
37786
+ const password = readSecret(context, "password", 1024, USAGE$47);
37653
37787
  const body = {
37654
37788
  desiredGeneration: await environmentGeneration(path),
37655
37789
  password,
@@ -37667,7 +37801,7 @@ async function password(context, path, action, tail) {
37667
37801
  query
37668
37802
  })).data;
37669
37803
  });
37670
- throw new UsageError(USAGE$46);
37804
+ throw new UsageError(USAGE$47);
37671
37805
  }
37672
37806
  //#endregion
37673
37807
  //#region src/commands/booleans.ts
@@ -37692,7 +37826,7 @@ function onOff$5(context, flag, usage) {
37692
37826
  }
37693
37827
  //#endregion
37694
37828
  //#region src/commands/access-admin.ts
37695
- var USAGE$45 = [
37829
+ var USAGE$46 = [
37696
37830
  "Usage: hostingctl access settings <environment-uuid> --company <slug>",
37697
37831
  " hostingctl access settings-set <environment-uuid> --company <slug> --password <on|off> --sftp-only <on|off>",
37698
37832
  " hostingctl access grants <environment-uuid> --company <slug>",
@@ -37720,7 +37854,7 @@ var USAGE$45 = [
37720
37854
  /** `access settings|settings-set|grants|grant|un-grant|key|password|user-show|user-set|received`. */
37721
37855
  async function accessAdmin(context, subcommand, rest) {
37722
37856
  if (subcommand === "received") {
37723
- if (rest.length > 0) throw new UsageError(USAGE$45);
37857
+ if (rest.length > 0) throw new UsageError(USAGE$46);
37724
37858
  return {
37725
37859
  kind: "received",
37726
37860
  grants: (await hostingAccessReceivedIndex({})).data.items
@@ -37728,7 +37862,7 @@ async function accessAdmin(context, subcommand, rest) {
37728
37862
  }
37729
37863
  const [first, ...after] = rest;
37730
37864
  const takesAction = subcommand === "key" || subcommand === "password";
37731
- const path = await environmentPath(context, takesAction ? after[0] : first, USAGE$45);
37865
+ const path = await environmentPath(context, takesAction ? after[0] : first, USAGE$46);
37732
37866
  const tail = takesAction ? after.slice(1) : after;
37733
37867
  return await routed(context, subcommand, path, first ?? "", tail);
37734
37868
  }
@@ -37743,7 +37877,7 @@ async function routed(context, subcommand, path, action, tail) {
37743
37877
  if (subcommand === "password") return await written$7(password(context, path, action, tail));
37744
37878
  if (subcommand === "user-show") return await userShow(path, tail);
37745
37879
  if (subcommand === "user-set") return await written$7(userSet(context, path, tail));
37746
- throw new UsageError(USAGE$45);
37880
+ throw new UsageError(USAGE$46);
37747
37881
  }
37748
37882
  /** Tag one write's outcome with the group that produced it. */
37749
37883
  async function written$7(pending) {
@@ -37754,7 +37888,7 @@ async function written$7(pending) {
37754
37888
  }
37755
37889
  /** A company-wide read takes no positionals. */
37756
37890
  function noExtra$18(rest) {
37757
- if (rest.length > 0) throw new UsageError(USAGE$45);
37891
+ if (rest.length > 0) throw new UsageError(USAGE$46);
37758
37892
  }
37759
37893
  /** `settings`. */
37760
37894
  async function settings$1(path, rest) {
@@ -37767,8 +37901,8 @@ async function settings$1(path, rest) {
37767
37901
  /** `settings-set --password … --sftp-only …`. */
37768
37902
  async function settingsSet(context, path, rest) {
37769
37903
  noExtra$18(rest);
37770
- const passwordEnabled = onOff$5(context, "--password", USAGE$45);
37771
- const sftpOnly = onOff$5(context, "--sftp-only", USAGE$45);
37904
+ const passwordEnabled = onOff$5(context, "--password", USAGE$46);
37905
+ const sftpOnly = onOff$5(context, "--sftp-only", USAGE$46);
37772
37906
  return await confirmableWrite(context, [`Set password sign-in ${passwordEnabled ? "on" : "off"} and SFTP-only ${sftpOnly ? "on" : "off"}.`, " Logins keep their keys either way; this changes how a login may authenticate."].join("\\n"), async () => {
37773
37907
  return (await hostingAccessUpdate({
37774
37908
  path,
@@ -37793,7 +37927,7 @@ async function grant(context, path, rest) {
37793
37927
  noExtra$18(rest);
37794
37928
  const userUuid = context.flags.get("--user") ?? "";
37795
37929
  const accessUserUuid = context.flags.get("--access-user") ?? "";
37796
- if (userUuid === "" || accessUserUuid === "") throw new UsageError(`grant needs --user and --access-user.\\n\\n${USAGE$45}`);
37930
+ if (userUuid === "" || accessUserUuid === "") throw new UsageError(`grant needs --user and --access-user.\\n\\n${USAGE$46}`);
37797
37931
  return await confirmableWrite(context, `Grant user ${userUuid} the login ${accessUserUuid} on this environment.`, async () => {
37798
37932
  return (await hostingAccessGrantStore({
37799
37933
  path,
@@ -37808,7 +37942,7 @@ async function grant(context, path, rest) {
37808
37942
  /** `un-grant <grant-uuid>`. */
37809
37943
  async function unGrant(context, path, rest) {
37810
37944
  const [grantUuid, ...extra] = rest;
37811
- if (grantUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$45);
37945
+ if (grantUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$46);
37812
37946
  return await confirmableWrite(context, `Withdraw grant ${grantUuid}. The login stays; only this account's access to it ends.`, async () => {
37813
37947
  const query = { desiredGeneration: await environmentGeneration(path) };
37814
37948
  return (await hostingAccessGrantDestroy({
@@ -37823,7 +37957,7 @@ async function unGrant(context, path, rest) {
37823
37957
  /** `user-show <access-user-uuid>`. */
37824
37958
  async function userShow(path, rest) {
37825
37959
  const [accessUserUuid, ...extra] = rest;
37826
- if (accessUserUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$45);
37960
+ if (accessUserUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$46);
37827
37961
  return {
37828
37962
  kind: "user",
37829
37963
  user: (await hostingAccessShowUser({ path: {
@@ -37835,7 +37969,7 @@ async function userShow(path, rest) {
37835
37969
  /** `user-set <access-user-uuid> [--name] [--enabled] [--read-only]`. */
37836
37970
  async function userSet(context, path, rest) {
37837
37971
  const [accessUserUuid, ...extra] = rest;
37838
- if (accessUserUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$45);
37972
+ if (accessUserUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$46);
37839
37973
  const userPath = {
37840
37974
  ...path,
37841
37975
  accessUserUuid
@@ -37844,7 +37978,7 @@ async function userSet(context, path, rest) {
37844
37978
  const name = context.flags.get("--name")?.trim();
37845
37979
  const enabled = onOffFlag(context, "--enabled");
37846
37980
  const readOnly = onOffFlag(context, "--read-only");
37847
- if (name === void 0 && enabled === null && readOnly === null) throw new UsageError(`user-set needs --name, --enabled, --read-only or a combination.\\n\\n${USAGE$45}`);
37981
+ if (name === void 0 && enabled === null && readOnly === null) throw new UsageError(`user-set needs --name, --enabled, --read-only or a combination.\\n\\n${USAGE$46}`);
37848
37982
  const body = {
37849
37983
  desiredGeneration: await environmentGeneration(path),
37850
37984
  name: name === void 0 || name === "" ? current.name : name,
@@ -37996,43 +38130,43 @@ var ACCESS_METADATA = {
37996
38130
  var ACCESS_TOPICS = [
37997
38131
  {
37998
38132
  path: ["settings"],
37999
- usage: USAGE$45
38133
+ usage: USAGE$46
38000
38134
  },
38001
38135
  {
38002
38136
  path: ["settings-set"],
38003
- usage: USAGE$45
38137
+ usage: USAGE$46
38004
38138
  },
38005
38139
  {
38006
38140
  path: ["grants"],
38007
- usage: USAGE$45
38141
+ usage: USAGE$46
38008
38142
  },
38009
38143
  {
38010
38144
  path: ["grant"],
38011
- usage: USAGE$45
38145
+ usage: USAGE$46
38012
38146
  },
38013
38147
  {
38014
38148
  path: ["un-grant"],
38015
- usage: USAGE$45
38149
+ usage: USAGE$46
38016
38150
  },
38017
38151
  {
38018
38152
  path: ["user-show"],
38019
- usage: USAGE$45
38153
+ usage: USAGE$46
38020
38154
  },
38021
38155
  {
38022
38156
  path: ["user-set"],
38023
- usage: USAGE$45
38157
+ usage: USAGE$46
38024
38158
  },
38025
38159
  {
38026
38160
  path: ["received"],
38027
- usage: USAGE$45
38161
+ usage: USAGE$46
38028
38162
  },
38029
38163
  {
38030
38164
  path: ["key"],
38031
- usage: USAGE$46
38165
+ usage: USAGE$47
38032
38166
  },
38033
38167
  {
38034
38168
  path: ["password"],
38035
- usage: USAGE$46
38169
+ usage: USAGE$47
38036
38170
  }
38037
38171
  ];
38038
38172
  //#endregion
@@ -38254,7 +38388,7 @@ var ADMIN_ACTIONS = /* @__PURE__ */ new Set([
38254
38388
  ]);
38255
38389
  //#endregion
38256
38390
  //#region src/commands/application-admin.ts
38257
- var USAGE$44 = [
38391
+ var USAGE$45 = [
38258
38392
  "Usage: hostingctl application administrator <environment-uuid> <application-uuid> --company <slug>",
38259
38393
  " hostingctl application administrator-reset|administrator-reveal <environment-uuid> <application-uuid> --company <slug>",
38260
38394
  " hostingctl application recovery-status|recovery-retry|recovery-cancel <environment-uuid> <application-uuid> <recovery-uuid> --company <slug>",
@@ -38281,7 +38415,7 @@ async function applicationAdmin(context, action, path, rest) {
38281
38415
  if (action === "administrator-reset") return await credential(context, path, rest, "reset");
38282
38416
  if (action === "administrator-reveal") return await credential(context, path, rest, "reveal");
38283
38417
  const [recoveryUuid, ...extra] = rest;
38284
- if (recoveryUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$44);
38418
+ if (recoveryUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$45);
38285
38419
  const recoveryPath = {
38286
38420
  ...path,
38287
38421
  recoveryUuid
@@ -38294,7 +38428,7 @@ async function applicationAdmin(context, action, path, rest) {
38294
38428
  return (await hostingApplicationRecoveryRetry({ path: recoveryPath })).data;
38295
38429
  }));
38296
38430
  if (action === "recovery-cancel") return await written$6(confirmableWrite(context, "Cancel this recovery. Writers are released and the application returns to its previous state.", async () => (await hostingApplicationRecoveryCancel({ path: recoveryPath })).data));
38297
- throw new UsageError(USAGE$44);
38431
+ throw new UsageError(USAGE$45);
38298
38432
  }
38299
38433
  /** `administrator-reset|reveal`: the one place the application's own password is printed. */
38300
38434
  async function credential(context, path, rest, kind) {
@@ -38315,7 +38449,7 @@ async function written$6(pending) {
38315
38449
  }
38316
38450
  /** No positional arguments, or a usage refusal. */
38317
38451
  function noExtra$17(rest) {
38318
- if (rest.length > 0) throw new UsageError(USAGE$44);
38452
+ if (rest.length > 0) throw new UsageError(USAGE$45);
38319
38453
  }
38320
38454
  /** One recovery as one line: what it is doing, how far, and what it holds. */
38321
38455
  function recoveryLines$1(one) {
@@ -38352,7 +38486,7 @@ function applicationAdminText(report) {
38352
38486
  }
38353
38487
  //#endregion
38354
38488
  //#region src/commands/application-builds.ts
38355
- var USAGE$43 = [
38489
+ var USAGE$44 = [
38356
38490
  "Usage: hostingctl application build-log <environment-uuid> <application-uuid> <build-uuid> --company <slug>",
38357
38491
  " hostingctl application build-retry|build-cancel <environment-uuid> <application-uuid> <build-uuid> --company <slug>",
38358
38492
  " hostingctl application source-bind <environment-uuid> <application-uuid> --company <slug> --selection <uuid> [--branch <name>] [--tag <name>] [--auto-deploy <on|off>]",
@@ -38375,7 +38509,7 @@ async function applicationBuilds(context, action, path, rest) {
38375
38509
  }
38376
38510
  if (action === "source-bind") return await bind$1(context, path, rest);
38377
38511
  const [buildUuid, ...extra] = rest;
38378
- if (buildUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$43);
38512
+ if (buildUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$44);
38379
38513
  const buildPath = {
38380
38514
  ...path,
38381
38515
  buildUuid
@@ -38390,13 +38524,13 @@ async function applicationBuilds(context, action, path, rest) {
38390
38524
  if (action === "build-cancel") return await written$5(confirmableWrite(context, "Stop this build. A running build stops where it is.", async () => {
38391
38525
  return (await hostingDeploymentCancel({ path: buildPath })).data;
38392
38526
  }));
38393
- throw new UsageError(USAGE$43);
38527
+ throw new UsageError(USAGE$44);
38394
38528
  }
38395
38529
  /** `source-bind --selection … [--branch …] [--tag …] [--auto-deploy …]`. */
38396
38530
  async function bind$1(context, path, rest) {
38397
38531
  noExtra$16(rest);
38398
38532
  const repositorySelectionUuid = context.flags.get("--selection") ?? "";
38399
- if (repositorySelectionUuid === "") throw new UsageError(`source-bind needs --selection.\n\n${USAGE$43}`);
38533
+ if (repositorySelectionUuid === "") throw new UsageError(`source-bind needs --selection.\n\n${USAGE$44}`);
38400
38534
  const branch = context.flags.get("--branch")?.trim();
38401
38535
  const tag = context.flags.get("--tag")?.trim();
38402
38536
  const autoDeploy = onOffFlag(context, "--auto-deploy");
@@ -38422,7 +38556,7 @@ async function written$5(pending) {
38422
38556
  }
38423
38557
  /** No positional arguments, or a usage refusal. */
38424
38558
  function noExtra$16(rest) {
38425
- if (rest.length > 0) throw new UsageError(USAGE$43);
38559
+ if (rest.length > 0) throw new UsageError(USAGE$44);
38426
38560
  }
38427
38561
  /** The write receipt: a build's own fields, or the deployment's source. */
38428
38562
  function writeText$5(report) {
@@ -38451,7 +38585,7 @@ function applicationBuildText(report) {
38451
38585
  }
38452
38586
  //#endregion
38453
38587
  //#region src/commands/application-cache.ts
38454
- var USAGE$42 = [
38588
+ var USAGE$43 = [
38455
38589
  "Usage: hostingctl application cache <environment-uuid> <application-uuid> --company <slug>",
38456
38590
  " hostingctl application cache-set <environment-uuid> <application-uuid> --company <slug> [--enabled <on|off>] [--fresh <s>] [--background <s>] [--browser <s>] [--reset <on|off>]",
38457
38591
  " hostingctl application cache-purge <environment-uuid> <application-uuid> --company <slug>",
@@ -38489,7 +38623,7 @@ async function applicationCache(context, action, path, rest) {
38489
38623
  }
38490
38624
  if (action === "canonical") {
38491
38625
  const routeUuid = context.flags.get("--route") ?? "";
38492
- if (routeUuid === "") throw new UsageError(`canonical needs --route.\n\n${USAGE$42}`);
38626
+ if (routeUuid === "") throw new UsageError(`canonical needs --route.\n\n${USAGE$43}`);
38493
38627
  return await written$4(confirmableWrite(context, `Make route ${routeUuid} this application's canonical address.`, async () => {
38494
38628
  const desiredGeneration = await generation$1(path);
38495
38629
  return (await hostingApplicationRouteSelectCanonical({
@@ -38501,7 +38635,7 @@ async function applicationCache(context, action, path, rest) {
38501
38635
  })).data;
38502
38636
  }));
38503
38637
  }
38504
- throw new UsageError(USAGE$42);
38638
+ throw new UsageError(USAGE$43);
38505
38639
  }
38506
38640
  /** `application routes|route-add|route-remove`, which are environment-scoped. */
38507
38641
  async function applicationRoutes(context, action, path, rest) {
@@ -38515,7 +38649,7 @@ async function applicationRoutes(context, action, path, rest) {
38515
38649
  if (action === "route-add") return await addRoute(context, path, rest);
38516
38650
  if (action === "route-remove") {
38517
38651
  const [routeUuid, ...extra] = rest;
38518
- if (routeUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$42);
38652
+ if (routeUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$43);
38519
38653
  return await written$4(confirmableWrite(context, `Remove route ${routeUuid}.`, async () => {
38520
38654
  const body = { desiredGeneration: await generation$1(path) };
38521
38655
  return (await hostingApplicationRouteRemove({
@@ -38527,7 +38661,7 @@ async function applicationRoutes(context, action, path, rest) {
38527
38661
  })).data;
38528
38662
  }));
38529
38663
  }
38530
- throw new UsageError(USAGE$42);
38664
+ throw new UsageError(USAGE$43);
38531
38665
  }
38532
38666
  /** `route-add --source … --target … --path …`. */
38533
38667
  async function addRoute(context, path, rest) {
@@ -38535,7 +38669,7 @@ async function addRoute(context, path, rest) {
38535
38669
  const sourceWorkloadUuid = context.flags.get("--source") ?? "";
38536
38670
  const targetWorkloadUuid = context.flags.get("--target") ?? "";
38537
38671
  const routePath = context.flags.get("--path") ?? "";
38538
- if (sourceWorkloadUuid === "" || targetWorkloadUuid === "" || routePath === "") throw new UsageError(`route-add needs --source, --target and --path.\n\n${USAGE$42}`);
38672
+ if (sourceWorkloadUuid === "" || targetWorkloadUuid === "" || routePath === "") throw new UsageError(`route-add needs --source, --target and --path.\n\n${USAGE$43}`);
38539
38673
  const domainUuid = context.flags.get("--domain")?.trim();
38540
38674
  const canonical = onOffFlag(context, "--canonical") ?? false;
38541
38675
  return await written$4(confirmableWrite(context, `Route ${routePath} from ${sourceWorkloadUuid} to ${targetWorkloadUuid}${canonical ? " as canonical" : ""}.`, async () => {
@@ -38568,10 +38702,10 @@ function cacheBody(context) {
38568
38702
  const raw = context.flags.get(flag)?.trim() ?? "";
38569
38703
  if (raw === "") continue;
38570
38704
  const value = Number(raw);
38571
- if (!Number.isInteger(value) || value < 0) throw new UsageError(`${flag} must be a whole number of seconds.\n\n${USAGE$42}`);
38705
+ if (!Number.isInteger(value) || value < 0) throw new UsageError(`${flag} must be a whole number of seconds.\n\n${USAGE$43}`);
38572
38706
  body[field] = value;
38573
38707
  }
38574
- if (Object.keys(body).length === 0) throw new UsageError(`cache-set needs at least one field.\n\n${USAGE$42}`);
38708
+ if (Object.keys(body).length === 0) throw new UsageError(`cache-set needs at least one field.\n\n${USAGE$43}`);
38575
38709
  return body;
38576
38710
  }
38577
38711
  /** The environment's generation, which every write here must name. */
@@ -38587,7 +38721,7 @@ async function written$4(pending) {
38587
38721
  }
38588
38722
  /** No positional arguments, or a usage refusal. */
38589
38723
  function noExtra$15(rest) {
38590
- if (rest.length > 0) throw new UsageError(USAGE$42);
38724
+ if (rest.length > 0) throw new UsageError(USAGE$43);
38591
38725
  }
38592
38726
  /** The `application cache*|routes|route-*` renderer. */
38593
38727
  function applicationCacheText(report) {
@@ -38749,29 +38883,37 @@ function describeAuth(workloadUuid, auth) {
38749
38883
  }
38750
38884
  //#endregion
38751
38885
  //#region src/commands/application-create.ts
38752
- var USAGE$41 = [
38886
+ var USAGE$42 = [
38753
38887
  "Usage: hostingctl application create <environment-uuid> --company <slug> --type <wordpress|moodle> --name <name>",
38754
38888
  " --cpu-request <millicores> --cpu-limit <millicores> --memory-request <MiB> --memory-limit <MiB>",
38755
- " [--replicas <count>] [--label <text>] [--hostname <host>]",
38889
+ " [--replicas <count>] [--label <text>] [--hostname <host>] [--php-minor <minor>]",
38756
38890
  "",
38757
38891
  " --type The application recipe to run.",
38758
38892
  " --replicas How many copies to run; one by default.",
38759
38893
  " --cpu-*/--memory-* The request and limit the recipe's container is given. All four are required: the",
38760
38894
  " cluster sizes the pod from them, and this CLI will not invent capacity.",
38761
38895
  " --hostname The name visitors should reach it at; omitted, the platform generates one.",
38896
+ " --php-minor The PHP minor to build and serve it on; omitted, it follows its type's default.",
38897
+ " `environment php-versions` lists the minors a type offers and why one is unavailable.",
38762
38898
  "",
38763
38899
  "The environment's generation is read first and sent back, so a create against a changed environment is",
38764
38900
  "refused rather than applied to a shape the operator never reviewed. Needs --confirm."
38765
38901
  ].join("\n");
38766
38902
  /** The two recipes the API offers, as the generated enum names them. */
38767
38903
  var TYPES = /* @__PURE__ */ new Set(["wordpress", "moodle"]);
38904
+ /** The flag this command reads, declared once and published by the command's own metadata. */
38905
+ var CREATE_FLAGS = [{
38906
+ name: "--php-minor",
38907
+ takesValue: true,
38908
+ description: "The PHP minor the new application is built and served on; omitted, it follows its type's default."
38909
+ }];
38768
38910
  /** `application create <env> …`, from the `application` command. */
38769
38911
  async function applicationCreate(context, path, rest) {
38770
- if (rest.length > 0) throw new UsageError(USAGE$41);
38912
+ if (rest.length > 0) throw new UsageError(USAGE$42);
38771
38913
  const type = context.flags.get("--type")?.trim().toLowerCase() ?? "";
38772
- if (!TYPES.has(type)) throw new UsageError(`create needs --type wordpress or moodle.\n\n${USAGE$41}`);
38914
+ if (!TYPES.has(type)) throw new UsageError(`create needs --type wordpress or moodle.\n\n${USAGE$42}`);
38773
38915
  const name = context.flags.get("--name")?.trim() ?? "";
38774
- if (name === "") throw new UsageError(`create needs --name.\n\n${USAGE$41}`);
38916
+ if (name === "") throw new UsageError(`create needs --name.\n\n${USAGE$42}`);
38775
38917
  const resources = {
38776
38918
  cpuRequestMillicores: required$2(context, "--cpu-request"),
38777
38919
  cpuLimitMillicores: required$2(context, "--cpu-limit"),
@@ -38783,10 +38925,11 @@ async function applicationCreate(context, path, rest) {
38783
38925
  const replicas = wholeNumberFlag(context.flags, "--replicas") ?? 1;
38784
38926
  const label = context.flags.get("--label")?.trim() ?? "";
38785
38927
  const intendedHostname = context.flags.get("--hostname")?.trim().toLowerCase() ?? "";
38928
+ const phpMinor = context.flags.get("--php-minor")?.trim() ?? "";
38786
38929
  const desiredGeneration = await environmentGeneration(path);
38787
38930
  return {
38788
38931
  kind: "create-write",
38789
- outcome: await confirmableWrite(context, `Create ${type} application "${name}" with ${String(replicas)} replica(s) at ${String(resources.cpuRequestMillicores)}m/${String(resources.memoryRequestMib)}MiB requested${intendedHostname === "" ? "" : `, reachable at ${intendedHostname}`}.`, async () => {
38932
+ outcome: await confirmableWrite(context, `Create ${type} application "${name}" with ${String(replicas)} replica(s) at ${String(resources.cpuRequestMillicores)}m/${String(resources.memoryRequestMib)}MiB requested${intendedHostname === "" ? "" : `, reachable at ${intendedHostname}`}${phpMinor === "" ? "" : `, on PHP ${phpMinor}`}.`, async () => {
38790
38933
  return (await hostingApplicationStore({
38791
38934
  path,
38792
38935
  body: {
@@ -38796,6 +38939,7 @@ async function applicationCreate(context, path, rest) {
38796
38939
  replicas,
38797
38940
  resources,
38798
38941
  intendedHostname: intendedHostname === "" ? null : intendedHostname,
38942
+ ...phpMinor === "" ? {} : { phpMinor },
38799
38943
  desiredGeneration
38800
38944
  }
38801
38945
  })).data;
@@ -38805,12 +38949,12 @@ async function applicationCreate(context, path, rest) {
38805
38949
  /** One required whole-number flag, or a usage refusal naming the flag. */
38806
38950
  function required$2(context, flag) {
38807
38951
  const value = wholeNumberFlag(context.flags, flag);
38808
- if (value === null) throw new UsageError(`create needs ${flag}.\n\n${USAGE$41}`);
38952
+ if (value === null) throw new UsageError(`create needs ${flag}.\n\n${USAGE$42}`);
38809
38953
  return value;
38810
38954
  }
38811
38955
  //#endregion
38812
38956
  //#region src/commands/application-upload.ts
38813
- var USAGE$40 = [
38957
+ var USAGE$41 = [
38814
38958
  "Usage: hostingctl application import-upload <environment-uuid> <application-uuid> --company <slug>",
38815
38959
  " --database <path-to.sql> --archive <path-to.zip|path-to.jpa> | --directory <dir>",
38816
38960
  "",
@@ -38839,12 +38983,12 @@ var STAGING_WAIT_MS = 9e5;
38839
38983
  /** How often the staged import is asked for its state while the queue works. */
38840
38984
  var STAGING_POLL_MS = 3e3;
38841
38985
  async function applicationUpload(context, path, rest) {
38842
- if (rest.length > 0) throw new UsageError(USAGE$40);
38986
+ if (rest.length > 0) throw new UsageError(USAGE$41);
38843
38987
  const database = context.flags.get("--database")?.trim() ?? "";
38844
38988
  const archive = context.flags.get("--archive")?.trim() ?? "";
38845
38989
  const directory = context.flags.get("--directory")?.trim() ?? "";
38846
- if (archive !== "" && directory !== "") throw new UsageError(`Send the site files as either --archive or --directory, not both.\n\n${USAGE$40}`);
38847
- if (database === "" && !isAkeebaArchive(archive)) throw new UsageError(`--database is required unless --archive is an Akeeba backup (.jpa or .jps), which carries the site's database inside the archive. If --archive is an Akeeba backup renamed .zip, rename it so its own database is used.\n\n${USAGE$40}`);
38990
+ if (archive !== "" && directory !== "") throw new UsageError(`Send the site files as either --archive or --directory, not both.\n\n${USAGE$41}`);
38991
+ if (database === "" && !isAkeebaArchive(archive)) throw new UsageError(`--database is required unless --archive is an Akeeba backup (.jpa or .jps), which carries the site's database inside the archive. If --archive is an Akeeba backup renamed .zip, rename it so its own database is used.\n\n${USAGE$41}`);
38848
38992
  const databaseBytes = database === "" ? 0 : await sizeOf(database, "database");
38849
38993
  const files = directory === "" ? [] : await manifestOf(directory);
38850
38994
  const fileBytes = directory === "" ? 0 : await totalSize(files);
@@ -38954,7 +39098,7 @@ function describe(bytes) {
38954
39098
  }
38955
39099
  //#endregion
38956
39100
  //#region src/commands/application-import.ts
38957
- var USAGE$39 = [
39101
+ var USAGE$40 = [
38958
39102
  "Usage: hostingctl application import <environment-uuid> <application-uuid> <import-uuid> --company <slug>",
38959
39103
  " hostingctl application import-upload <environment-uuid> <application-uuid> --company <slug>",
38960
39104
  " --database <path-to.sql> [--archive <path-to.zip> | --directory <dir>]",
@@ -38976,7 +39120,7 @@ async function applicationImport(context, action, path, rest) {
38976
39120
  if (action === "url-repair-preview") return await previewRepair(context, path, rest);
38977
39121
  if (action === "import-upload") return await applicationUpload(context, path, rest);
38978
39122
  const [importUuid, ...extra] = rest;
38979
- if (importUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$39);
39123
+ if (importUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$40);
38980
39124
  if (action === "import") return {
38981
39125
  kind: "import",
38982
39126
  staged: (await hostingWordpressImportShowImport({ path: {
@@ -38989,13 +39133,13 @@ async function applicationImport(context, action, path, rest) {
38989
39133
  importUuid
38990
39134
  } })).data));
38991
39135
  if (action === "url-repair-confirm") return await confirmRepair(context, path, importUuid);
38992
- throw new UsageError(USAGE$39);
39136
+ throw new UsageError(USAGE$40);
38993
39137
  }
38994
39138
  /** `url-repair-preview --source-url …`: the review a confirmation is made against. */
38995
39139
  async function previewRepair(context, path, rest) {
38996
- if (rest.length > 0) throw new UsageError(USAGE$39);
39140
+ if (rest.length > 0) throw new UsageError(USAGE$40);
38997
39141
  const sourceUrl = context.flags.get("--source-url")?.trim() ?? "";
38998
- if (sourceUrl === "") throw new UsageError(`url-repair-preview needs --source-url.\n\n${USAGE$39}`);
39142
+ if (sourceUrl === "") throw new UsageError(`url-repair-preview needs --source-url.\n\n${USAGE$40}`);
38999
39143
  return {
39000
39144
  kind: "url-repair",
39001
39145
  recovery: (await hostingWordpressUrlRepairPreview({
@@ -39007,7 +39151,7 @@ async function previewRepair(context, path, rest) {
39007
39151
  /** `url-repair-confirm <recovery> --confirmation …`: the typed text the review asked for. */
39008
39152
  async function confirmRepair(context, path, recoveryUuid) {
39009
39153
  const confirmation = context.flags.get("--confirmation")?.trim() ?? "";
39010
- if (confirmation === "") throw new UsageError(`url-repair-confirm needs --confirmation.\n\n${USAGE$39}`);
39154
+ if (confirmation === "") throw new UsageError(`url-repair-confirm needs --confirmation.\n\n${USAGE$40}`);
39011
39155
  return await written$3(confirmableWrite(context, `Confirm the URL repair by typing its confirmation ("${confirmation}").`, async () => {
39012
39156
  const desiredGeneration = (await hostingEnvironmentShow({ path })).data.desiredGeneration;
39013
39157
  const body = {
@@ -39073,7 +39217,7 @@ function recoveryLines(one) {
39073
39217
  }
39074
39218
  //#endregion
39075
39219
  //#region src/commands/application-recovery.ts
39076
- var USAGE$38 = [
39220
+ var USAGE$39 = [
39077
39221
  "Usage: hostingctl application recovery-review <environment-uuid> <application-uuid> --company <slug> [--import <uuid>]",
39078
39222
  " hostingctl application recovery-confirm <environment-uuid> <application-uuid> --company <slug> --confirmation <text> [--import <uuid>]",
39079
39223
  "",
@@ -39092,9 +39236,9 @@ var USAGE$38 = [
39092
39236
  ].join("\n");
39093
39237
  /** `application recovery-review|recovery-confirm`. */
39094
39238
  async function applicationRecovery(context, action, path, rest) {
39095
- if (rest.length > 0) throw new UsageError(USAGE$38);
39239
+ if (rest.length > 0) throw new UsageError(USAGE$39);
39096
39240
  const importUuid = context.flags.get("--import")?.trim();
39097
- if (importUuid === "") throw new UsageError(`--import needs the staged import's id.\n\n${USAGE$38}`);
39241
+ if (importUuid === "") throw new UsageError(`--import needs the staged import's id.\n\n${USAGE$39}`);
39098
39242
  const review = (await hostingApplicationRecoveryShow({
39099
39243
  path,
39100
39244
  ...importUuid === void 0 ? {} : { query: { importUuid } }
@@ -39103,10 +39247,10 @@ async function applicationRecovery(context, action, path, rest) {
39103
39247
  kind: "recovery-review",
39104
39248
  review
39105
39249
  };
39106
- if (action !== "recovery-confirm") throw new UsageError(USAGE$38);
39250
+ if (action !== "recovery-confirm") throw new UsageError(USAGE$39);
39107
39251
  if (review.blockedReason !== null) throw new UsageError(`This restore is blocked: ${review.blockedReason}`);
39108
39252
  const confirmation = context.flags.get("--confirmation")?.trim() ?? "";
39109
- if (confirmation === "") throw new UsageError(`recovery-confirm needs --confirmation.\n\n${USAGE$38}`);
39253
+ if (confirmation === "") throw new UsageError(`recovery-confirm needs --confirmation.\n\n${USAGE$39}`);
39110
39254
  return {
39111
39255
  kind: "recovery-write",
39112
39256
  outcome: await confirmableWrite(context, `Confirm ${review.actionName} of ${review.name}${review.installedVersion === null ? "" : ` from ${review.installedVersion}`}: ${String(review.routeUuids.length)} route(s) and ${String(review.hosts.length)} host(s) are rewritten.`, async () => {
@@ -39306,7 +39450,7 @@ function siteAccessText(report) {
39306
39450
  }
39307
39451
  //#endregion
39308
39452
  //#region src/commands/application-site-access.ts
39309
- var USAGE$37 = [
39453
+ var USAGE$38 = [
39310
39454
  "Usage: hostingctl application site-access <environment-uuid> <application-uuid> --company <slug>",
39311
39455
  " hostingctl application site-access-set <environment-uuid> <application-uuid> --company <slug> --sign-in <on|off> [--audience <name>]",
39312
39456
  " hostingctl application site-access-rotate <environment-uuid> <application-uuid> --company <slug>",
@@ -39349,10 +39493,10 @@ var flow$1 = siteAccessFlow({
39349
39493
  refresh: async (path) => (await hostingApplicationSiteAccessUsersRefresh({ path })).data,
39350
39494
  destroy: async (path) => (await hostingApplicationSiteAccessUsersDestroy({ path })).data,
39351
39495
  rotate: async (path) => (await hostingApplicationSiteAccessRotate({ path })).data
39352
- }, USAGE$37);
39496
+ }, USAGE$38);
39353
39497
  /** `application site-access*|site-user*`, which the application dispatcher calls with its resolved path. */
39354
39498
  async function applicationSiteAccess(context, action, path, rest) {
39355
- if (rest.some((one) => one === "")) throw new UsageError(USAGE$37);
39499
+ if (rest.some((one) => one === "")) throw new UsageError(USAGE$38);
39356
39500
  return await flow$1(context, action, path, rest);
39357
39501
  }
39358
39502
  //#endregion
@@ -39384,7 +39528,7 @@ function applicationSpeedText(check) {
39384
39528
  * paused. It starts no build and promotes nothing. The pause is the customer's own control: while it holds, a push to
39385
39529
  * the bound ref is read and matched but builds nothing, and the release that is serving is untouched either way.
39386
39530
  */
39387
- var USAGE$36 = [
39531
+ var USAGE$37 = [
39388
39532
  "Usage: hostingctl application updates <environment-uuid> <application-uuid> --company <slug>",
39389
39533
  " hostingctl application updates-pause <environment-uuid> <application-uuid> --company <slug>",
39390
39534
  " hostingctl application updates-resume <environment-uuid> <application-uuid> --company <slug>",
@@ -39397,7 +39541,7 @@ var USAGE$36 = [
39397
39541
  "Both writes need --confirm; --dry-run describes the change without sending it."
39398
39542
  ].join("\n");
39399
39543
  async function applicationUpdates(context, action, path, rest) {
39400
- if (rest.length > 0) throw new UsageError(USAGE$36);
39544
+ if (rest.length > 0) throw new UsageError(USAGE$37);
39401
39545
  if (action === "updates") return {
39402
39546
  kind: "updates",
39403
39547
  surface: (await hostingApplicationUpdatesShow({ path })).data
@@ -39409,7 +39553,7 @@ async function applicationUpdates(context, action, path, rest) {
39409
39553
  outcome: await confirmableWrite(context, pausing ? `Pause updates for application ${path.workloadUuid}: a push to its bound ref stops building it, and the release that is serving is unchanged.` : `Resume updates for application ${path.workloadUuid}: it may be a candidate again. Nothing is deployed by resuming.`, async () => pausing ? (await hostingApplicationUpdatesPause({ path })).data : (await hostingApplicationUpdatesResume({ path })).data)
39410
39554
  };
39411
39555
  }
39412
- throw new UsageError(USAGE$36);
39556
+ throw new UsageError(USAGE$37);
39413
39557
  }
39414
39558
  /**
39415
39559
  * The update state in words.
@@ -39433,6 +39577,7 @@ function applicationUpdatesText(report) {
39433
39577
  var APPLICATION_USAGE = [
39434
39578
  "Usage: hostingctl application list <environment-uuid> --company <slug>",
39435
39579
  " hostingctl application show <environment-uuid> <workload-uuid> --company <slug>",
39580
+ " hostingctl application public-key <environment-uuid> <workload-uuid> --company <slug>",
39436
39581
  " hostingctl application speed-check <environment-uuid> <workload-uuid> --company <slug>",
39437
39582
  " hostingctl application deployment <environment-uuid> <workload-uuid> --company <slug>",
39438
39583
  " hostingctl application build <environment-uuid> <workload-uuid> --company <slug> [--source <selection-uuid>] [--idempotency-key <key>]",
@@ -39448,6 +39593,7 @@ var APPLICATION_USAGE = [
39448
39593
  " hostingctl application remove <environment-uuid> <workload-uuid> --company <slug>",
39449
39594
  "",
39450
39595
  " list|show The applications in an environment, and one in detail.",
39596
+ " public-key Read the component's publishable anonymous key (never its service/signing secrets).",
39451
39597
  " speed-check Three bounded HEAD timing, TLS and cache-header checks; not a browser audit.",
39452
39598
  " deployment The running, requested and interrupted builds and releases of one application.",
39453
39599
  " build Queue a build of the application's applied configuration from a source selection.",
@@ -39647,9 +39793,11 @@ var APPLICATION_METADATA = {
39647
39793
  takesValue: true,
39648
39794
  description: "The address a site sign-in invitation is sent to."
39649
39795
  },
39796
+ ...CREATE_FLAGS,
39650
39797
  ...COMPONENT_SETTINGS_FLAGS
39651
39798
  ],
39652
39799
  subcommands: [
39800
+ "public-key",
39653
39801
  "speed-check",
39654
39802
  "list",
39655
39803
  "show",
@@ -39710,83 +39858,83 @@ var APPLICATION_TOPICS = [
39710
39858
  },
39711
39859
  {
39712
39860
  path: ["create"],
39713
- usage: USAGE$41
39861
+ usage: USAGE$42
39714
39862
  },
39715
39863
  {
39716
39864
  path: ["build-log"],
39717
- usage: USAGE$43
39865
+ usage: USAGE$44
39718
39866
  },
39719
39867
  {
39720
39868
  path: ["build-retry"],
39721
- usage: USAGE$43
39869
+ usage: USAGE$44
39722
39870
  },
39723
39871
  {
39724
39872
  path: ["build-cancel"],
39725
- usage: USAGE$43
39873
+ usage: USAGE$44
39726
39874
  },
39727
39875
  {
39728
39876
  path: ["source-bind"],
39729
- usage: USAGE$43
39877
+ usage: USAGE$44
39730
39878
  },
39731
39879
  {
39732
39880
  path: ["source-unbind"],
39733
- usage: USAGE$43
39881
+ usage: USAGE$44
39734
39882
  },
39735
39883
  {
39736
39884
  path: ["cache"],
39737
- usage: USAGE$42
39885
+ usage: USAGE$43
39738
39886
  },
39739
39887
  {
39740
39888
  path: ["cache-set"],
39741
- usage: USAGE$42
39889
+ usage: USAGE$43
39742
39890
  },
39743
39891
  {
39744
39892
  path: ["cache-purge"],
39745
- usage: USAGE$42
39893
+ usage: USAGE$43
39746
39894
  },
39747
39895
  {
39748
39896
  path: ["routes"],
39749
- usage: USAGE$42
39897
+ usage: USAGE$43
39750
39898
  },
39751
39899
  {
39752
39900
  path: ["route-add"],
39753
- usage: USAGE$42
39901
+ usage: USAGE$43
39754
39902
  },
39755
39903
  {
39756
39904
  path: ["route-remove"],
39757
- usage: USAGE$42
39905
+ usage: USAGE$43
39758
39906
  },
39759
39907
  {
39760
39908
  path: ["canonical"],
39761
- usage: USAGE$42
39909
+ usage: USAGE$43
39762
39910
  },
39763
39911
  {
39764
39912
  path: ["import"],
39765
- usage: USAGE$39
39913
+ usage: USAGE$40
39766
39914
  },
39767
39915
  {
39768
39916
  path: ["import-upload"],
39769
- usage: USAGE$40
39917
+ usage: USAGE$41
39770
39918
  },
39771
39919
  {
39772
39920
  path: ["import-discard"],
39773
- usage: USAGE$39
39921
+ usage: USAGE$40
39774
39922
  },
39775
39923
  {
39776
39924
  path: ["url-repair-preview"],
39777
- usage: USAGE$39
39925
+ usage: USAGE$40
39778
39926
  },
39779
39927
  {
39780
39928
  path: ["url-repair-confirm"],
39781
- usage: USAGE$39
39929
+ usage: USAGE$40
39782
39930
  },
39783
39931
  {
39784
39932
  path: ["recovery-review"],
39785
- usage: USAGE$38
39933
+ usage: USAGE$39
39786
39934
  },
39787
39935
  {
39788
39936
  path: ["recovery-confirm"],
39789
- usage: USAGE$38
39937
+ usage: USAGE$39
39790
39938
  },
39791
39939
  {
39792
39940
  path: ["runtime"],
@@ -39798,59 +39946,59 @@ var APPLICATION_TOPICS = [
39798
39946
  },
39799
39947
  {
39800
39948
  path: ["site-access"],
39801
- usage: USAGE$37
39949
+ usage: USAGE$38
39802
39950
  },
39803
39951
  {
39804
39952
  path: ["site-access-set"],
39805
- usage: USAGE$37
39953
+ usage: USAGE$38
39806
39954
  },
39807
39955
  {
39808
39956
  path: ["site-access-rotate"],
39809
- usage: USAGE$37
39957
+ usage: USAGE$38
39810
39958
  },
39811
39959
  {
39812
39960
  path: ["site-users"],
39813
- usage: USAGE$37
39961
+ usage: USAGE$38
39814
39962
  },
39815
39963
  {
39816
39964
  path: ["site-user"],
39817
- usage: USAGE$37
39965
+ usage: USAGE$38
39818
39966
  },
39819
39967
  {
39820
39968
  path: ["updates"],
39821
- usage: USAGE$36
39969
+ usage: USAGE$37
39822
39970
  },
39823
39971
  {
39824
39972
  path: ["updates-pause"],
39825
- usage: USAGE$36
39973
+ usage: USAGE$37
39826
39974
  },
39827
39975
  {
39828
39976
  path: ["updates-resume"],
39829
- usage: USAGE$36
39977
+ usage: USAGE$37
39830
39978
  },
39831
39979
  {
39832
39980
  path: ["administrator"],
39833
- usage: USAGE$44
39981
+ usage: USAGE$45
39834
39982
  },
39835
39983
  {
39836
39984
  path: ["administrator-reset"],
39837
- usage: USAGE$44
39985
+ usage: USAGE$45
39838
39986
  },
39839
39987
  {
39840
39988
  path: ["administrator-reveal"],
39841
- usage: USAGE$44
39989
+ usage: USAGE$45
39842
39990
  },
39843
39991
  {
39844
39992
  path: ["recovery-status"],
39845
- usage: USAGE$44
39993
+ usage: USAGE$45
39846
39994
  },
39847
39995
  {
39848
39996
  path: ["recovery-retry"],
39849
- usage: USAGE$44
39997
+ usage: USAGE$45
39850
39998
  },
39851
39999
  {
39852
40000
  path: ["recovery-cancel"],
39853
- usage: USAGE$44
40001
+ usage: USAGE$45
39854
40002
  }
39855
40003
  ];
39856
40004
  //#endregion
@@ -39900,6 +40048,7 @@ async function remove$4(context, path) {
39900
40048
  /** The reads and the two remaining writes, which take no further positionals. */
39901
40049
  async function reads(context, action, path, extra) {
39902
40050
  if (extra.length > 0) throw new UsageError(APPLICATION_USAGE);
40051
+ if (action === "public-key") return (await hostingApplicationsPublicKey({ path })).data;
39903
40052
  if (action === "speed-check") return (await hostingApplicationSpeedShow({ path })).data;
39904
40053
  if (action === "deployment") return (await hostingDeploymentShow({ path })).data;
39905
40054
  if (action === "runs") return (await hostingProcessRunIndex({ path })).data;
@@ -39962,6 +40111,7 @@ function taggedText$1(report) {
39962
40111
  return applicationAdminText(report);
39963
40112
  }
39964
40113
  function applicationText(report) {
40114
+ if ("anonymousKey" in report) return report.anonymousKey;
39965
40115
  if ("measurement" in report) return applicationSpeedText(report);
39966
40116
  if ("kind" in report) return taggedText$1(report);
39967
40117
  if ("sent" in report) return renderWriteOutcome(report, writeAnyResultText);
@@ -39986,9 +40136,22 @@ function applicationDetailText(app) {
39986
40136
  ` replicas ${String(app.replicas)}`,
39987
40137
  ` stopped ${app.stoppedAt ?? "no"}`,
39988
40138
  ` web server ${app.webServerEffective ?? "none"}`,
39989
- ` database ${app.database === null ? "none" : app.database.databaseName}`
40139
+ ` php ${phpText(app)}`,
40140
+ ` database ${app.database?.databaseName ?? "none"}`
39990
40141
  ].join("\n");
39991
40142
  }
40143
+ /**
40144
+ * The PHP minor the application asks for and the one serving it, stated only when its type runs PHP.
40145
+ *
40146
+ * They are named separately because a pending upgrade has them differ: the answer the platform accepted and the
40147
+ * interpreter actually serving the site are different facts, and only the second one follows the traffic.
40148
+ */
40149
+ function phpText(app) {
40150
+ const desired = app.phpMinorDesired ?? null;
40151
+ if (desired === null) return "not used by this type";
40152
+ const serving = app.phpMinorEffective ?? null;
40153
+ return serving === null || serving === desired ? desired : `${desired} requested, ${serving} serving`;
40154
+ }
39992
40155
  function deploymentText(data) {
39993
40156
  const running = data.running === null ? "none" : `${data.running.uuid} (sequence ${String(data.running.sequence)})`;
39994
40157
  const requested = data.requested === null ? "none" : data.requested.uuid;
@@ -40535,6 +40698,15 @@ var BILLING_USAGE = `hostingctl billing <subcommand> [flags]
40535
40698
  Change what a client's invoices print (needs --confirm)
40536
40699
  payment-state mark-unpaid --company <slug>
40537
40700
  Record every invoice as unpaid (needs --confirm)
40701
+ discounts Every code issued, what it granted and who spent it
40702
+ discount issue --amount <rand> [--product <MHU|MHS>] [--package <key>]
40703
+ [--redemptions <n>] [--duration-months <n>] [--expires-at <date>]
40704
+ [--company <slug>] [--code <spelling>]
40705
+ Issue a code that grants a price (needs --confirm)
40706
+ discount end <code-uuid> Stop a code being redeemable; prices it granted keep running
40707
+ discount redeem --company <slug> --code <spelling>
40708
+ Spend a code on your own company, changing what it is charged
40709
+ (needs --confirm)
40538
40710
 
40539
40711
  Every write needs --confirm, and --dry-run describes it without sending anything.`;
40540
40712
  function issuerText(issuer) {
@@ -40717,7 +40889,7 @@ function minorUnits(raw) {
40717
40889
  return Number.isSafeInteger(units) ? units : null;
40718
40890
  }
40719
40891
  /** Rand to cents, refusing anything that is not a positive amount of money. */
40720
- function randToCents(context, flag) {
40892
+ function randToCents$1(context, flag) {
40721
40893
  const raw = requiredFlag$2(context, flag);
40722
40894
  const cents = minorUnits(raw);
40723
40895
  if (cents === null || cents <= 0) throw new UsageError(`${flag} must be a positive amount of rand with at most two decimal places, e.g. 12.50 (got ${raw}).`);
@@ -40730,22 +40902,22 @@ function percentToBasisPoints(context) {
40730
40902
  if (basisPoints === null || basisPoints > 1e4) throw new UsageError(`--percent must be between 0 and 100 with at most two decimal places (got ${raw}).`);
40731
40903
  return basisPoints;
40732
40904
  }
40733
- function product(context) {
40905
+ function product$1(context) {
40734
40906
  const raw = requiredFlag$2(context, "--product");
40735
40907
  const known = Object.values(billingProductEnum);
40736
40908
  if (!known.includes(raw)) throw new UsageError(`--product must be one of ${known.join(", ")} (got ${raw}).`);
40737
40909
  return raw;
40738
40910
  }
40739
- var optional$3 = (context, flag) => {
40911
+ var optional$4 = (context, flag) => {
40740
40912
  const value = (context.flags.get(flag) ?? "").trim();
40741
40913
  return value === "" ? null : value;
40742
40914
  };
40743
40915
  async function startRate(context) {
40744
- const amountCents = randToCents(context, "--amount");
40916
+ const amountCents = randToCents$1(context, "--amount");
40745
40917
  const effectiveFrom = requiredFlag$2(context, "--from");
40746
- const chosen = product(context);
40747
- const packageKey = optional$3(context, "--package");
40748
- const company = optional$3(context, "--company");
40918
+ const chosen = product$1(context);
40919
+ const packageKey = optional$4(context, "--package");
40920
+ const company = optional$4(context, "--company");
40749
40921
  return {
40750
40922
  kind: "write",
40751
40923
  outcome: await confirmableWrite(context, `Start a ${chosen} rate${packageKey === null ? "" : ` for ${packageKey}`} of ${(amountCents / 100).toFixed(2)} rand${company === null ? " for every company" : ` for ${company}`} from ${effectiveFrom}.`, async () => platformBillingRateStore({ body: {
@@ -41009,6 +41181,177 @@ async function myCreditNote(context) {
41009
41181
  };
41010
41182
  }
41011
41183
  //#endregion
41184
+ //#region src/commands/billing-discounts.ts
41185
+ /**
41186
+ * Discount codes: the promises the platform has made, and the three things a person may do with one.
41187
+ *
41188
+ * A code grants a price rather than a discount line, so redeeming writes a company-scoped price window and no issued
41189
+ * document changes. Both platform writes are money-adjacent — a code is a price somebody will be charged — so each
41190
+ * describes itself from the flags alone and goes through the shared confirmation gate.
41191
+ *
41192
+ * The renderers live here rather than in a `-text` module because a code's answer is one surface: the list, the
41193
+ * issue, the ending and the redemption all read the same promise. `discountText` answers null for a report this
41194
+ * module does not own, and the `billing` command composes it with `billingText` so neither text module has to
41195
+ * import the other.
41196
+ */
41197
+ /**
41198
+ * Rand as exact integer cents.
41199
+ *
41200
+ * The digits are joined rather than the value multiplied: `Number("1.15") * 100` is 114.99999999999999, so a
41201
+ * rounding would price a code a cent below what the operator typed. A third decimal is refused rather than rounded.
41202
+ * Zero is allowed, unlike a rate: a code granting R0.00 for three months is a free period, which the contract's own
41203
+ * `min: 0` permits and an operator may legitimately promise.
41204
+ */
41205
+ function randToCents(context) {
41206
+ const raw = requiredFlag$2(context, "--amount");
41207
+ const parts = /^(\d+)(?:\.(\d{1,2}))?$/.exec(raw);
41208
+ const cents = parts === null ? NaN : Number(`${parts[1]}${(parts[2] ?? "").padEnd(2, "0")}`);
41209
+ if (!Number.isSafeInteger(cents)) throw new UsageError(`--amount must be an amount of rand with at most two decimal places, e.g. 159.00 (got ${raw}).`);
41210
+ return cents;
41211
+ }
41212
+ /** The product a code prices, defaulting to the recurring unit the API itself defaults to. */
41213
+ function product(context) {
41214
+ const raw = (context.flags.get("--product") ?? "").trim();
41215
+ if (raw === "") return billingProductEnum.MHU;
41216
+ const chosen = Object.values(billingProductEnum).find((one) => one === raw);
41217
+ if (chosen === void 0) throw new UsageError(`--product must be one of ${Object.values(billingProductEnum).join(", ")} (got ${raw}).`);
41218
+ return chosen;
41219
+ }
41220
+ /** A flag that may be absent, where the API's own default then applies. */
41221
+ function optional$3(context, flag) {
41222
+ const raw = (context.flags.get(flag) ?? "").trim();
41223
+ return raw === "" ? null : raw;
41224
+ }
41225
+ /** Every code issued, most recent first. */
41226
+ async function discountIndex() {
41227
+ return {
41228
+ kind: "discounts",
41229
+ items: (await platformBillingDiscountIndex({}).unwrap()).items
41230
+ };
41231
+ }
41232
+ /** Issue a code: a price, how often it may be spent, and when it stops being redeemable. */
41233
+ async function issueDiscount(context) {
41234
+ const amountCents = randToCents(context);
41235
+ const chosen = product(context);
41236
+ const packageKey = optional$3(context, "--package");
41237
+ const company = optional$3(context, "--company");
41238
+ const code = optional$3(context, "--code");
41239
+ const maxRedemptions = wholeNumberFlag(context.flags, "--redemptions") ?? 1;
41240
+ const durationMonths = wholeNumberFlag(context.flags, "--duration-months");
41241
+ const expiresAt = optional$3(context, "--expires-at");
41242
+ return {
41243
+ kind: "discountIssued",
41244
+ outcome: await confirmableWrite(context, [`Issue a ${chosen} code granting ${formatMoney(amountCents, "ZAR")}${packageKey === null ? "" : ` for ${packageKey}`}, redeemable ${String(maxRedemptions)} time(s)${expiresAt === null ? " with no expiry" : ` until ${expiresAt}`}${durationMonths === null ? " as a continual discount" : `, pricing the account for ${String(durationMonths)} month(s) from the month it takes effect`}${company === null ? ", for any company" : `, bound to ${company}`}.`, "Redeeming it writes that price as the company's own window; no issued document changes."].join(" "), async () => platformBillingDiscountStore({ body: {
41245
+ product: chosen,
41246
+ packageKey,
41247
+ amountCents,
41248
+ maxRedemptions,
41249
+ durationMonths,
41250
+ expiresAt,
41251
+ company,
41252
+ code
41253
+ } }).unwrap())
41254
+ };
41255
+ }
41256
+ /** Stop a code being redeemable. Every window it already granted keeps running. */
41257
+ async function endDiscount(context, codeUuid) {
41258
+ if (codeUuid === "") throw new UsageError(`discount end needs the code's uuid.\n\n${BILLING_USAGE}`);
41259
+ return {
41260
+ kind: "discountEnded",
41261
+ outcome: await confirmableWrite(context, `End code ${codeUuid}. It stops being redeemable from now on, and every price it already granted keeps running: a promise already kept is not withdrawn.`, async () => platformBillingDiscountEnd({ path: { codeUuid } }).unwrap())
41262
+ };
41263
+ }
41264
+ /** Spend a code on the caller's own company, which is the only account the route can reach. */
41265
+ async function redeemDiscount(context) {
41266
+ const company = await requireCompany(context.flags);
41267
+ const code = requiredFlag$2(context, "--code");
41268
+ return {
41269
+ kind: "discountRedeemed",
41270
+ outcome: await confirmableWrite(context, `Redeem code ${code} against ${company}. This changes what this company is charged: the code's price becomes its own price window, and no issued document changes.`, async () => companyBillingDiscountRedeem({
41271
+ path: { company },
41272
+ body: { code }
41273
+ }).unwrap())
41274
+ };
41275
+ }
41276
+ /** `discount <verb>`: the three things a person may do with a code. */
41277
+ async function discountCommand(context, rest) {
41278
+ if (rest[0] === "issue") return issueDiscount(context);
41279
+ if (rest[0] === "end") return endDiscount(context, rest[1] ?? "");
41280
+ if (rest[0] === "redeem") return redeemDiscount(context);
41281
+ throw new UsageError(BILLING_USAGE);
41282
+ }
41283
+ /** Who a code or an activation belongs to, in the one spelling both answers print. */
41284
+ function actorName(actor) {
41285
+ return actor === null ? "an account since deleted" : `${actor.name} <${actor.email}>`;
41286
+ }
41287
+ /** Why a code can no longer be redeemed, or that it still can: an expiry and an end are different facts. */
41288
+ function redeemability(code, now) {
41289
+ if (code.endedAt !== null) return `ended ${code.endedAt.slice(0, 10)}`;
41290
+ if (code.expiresAt !== null && Date.parse(code.expiresAt) <= now) return "expired";
41291
+ if (code.redeemedCount >= code.maxRedemptions) return "fully redeemed";
41292
+ return "redeemable";
41293
+ }
41294
+ /** The promise as one line: what it grants, how much of it is spent, and whether it can still be used. */
41295
+ function promiseLine(code, now) {
41296
+ return [
41297
+ formatMoney(code.amountCents, code.currency),
41298
+ code.product,
41299
+ code.packageKey ?? "any package",
41300
+ `${String(code.redeemedCount)}/${String(code.maxRedemptions)} redeemed`,
41301
+ code.durationMonths === null ? "until ended" : `${String(code.durationMonths)} month(s)`,
41302
+ code.expiresAt === null ? "no expiry" : `expires ${code.expiresAt.slice(0, 10)}`,
41303
+ redeemability(code, now),
41304
+ code.companySlug === null ? "any company" : `only ${code.companySlug}`
41305
+ ].join(" ");
41306
+ }
41307
+ /** Every activation the code brought: who spent it, for which company, at what price and over what window. */
41308
+ function activationLines(code) {
41309
+ return (code.redemptions ?? []).map((row) => {
41310
+ const window = row.effectiveFrom === null ? "not priced yet" : `from ${row.effectiveFrom.slice(0, 10)}${row.effectiveUntil === null ? "" : ` until ${row.effectiveUntil.slice(0, 10)}`}`;
41311
+ return ` ${row.state.padEnd(8)} ${row.companySlug.padEnd(18)} ${formatMoney(row.amountCents, row.currency)} ${window} ${actorName(row.redeemedBy)}`;
41312
+ });
41313
+ }
41314
+ function discountsText(items) {
41315
+ if (items.length === 0) return "No discount code has been issued.";
41316
+ const now = Date.now();
41317
+ return items.flatMap((code) => [
41318
+ ` ${code.code} ${promiseLine(code, now)}`,
41319
+ ` issued by ${actorName(code.createdBy)}`,
41320
+ ...activationLines(code)
41321
+ ]).join("\n");
41322
+ }
41323
+ /** An issue's answer: the spelling is the one thing the operator cannot reconstruct, so it leads. */
41324
+ function issuedText(outcome, now) {
41325
+ return renderWriteOutcome(outcome, (code) => [
41326
+ `The code is ${code.code} — that spelling is what the client types, so it is the part to keep.`,
41327
+ ` ${promiseLine(code, now)}`,
41328
+ ` issued by ${actorName(code.createdBy)}`
41329
+ ].join("\n"));
41330
+ }
41331
+ function endedText(outcome) {
41332
+ return renderWriteOutcome(outcome, (code) => [
41333
+ `${code.code} is ${code.endedAt === null ? "still redeemable" : `ended ${code.endedAt.slice(0, 10)}`}.`,
41334
+ " Every price it already granted keeps running; only new redemptions stop.",
41335
+ ...activationLines(code)
41336
+ ].join("\n"));
41337
+ }
41338
+ /** A redemption's answer, saying which state it is in: a held promise or a window that now prices the account. */
41339
+ function redeemedText(outcome) {
41340
+ return renderWriteOutcome(outcome, (row) => {
41341
+ const price = formatMoney(row.amountCents, row.currency);
41342
+ const window = row.effectiveFrom === null ? "" : ` from ${row.effectiveFrom.slice(0, 10)}${row.effectiveUntil === null ? " until it is ended" : ` until ${row.effectiveUntil.slice(0, 10)}`}`;
41343
+ return row.state === "pending" ? `Held: ${row.code} is spent on ${row.companySlug} and prices nothing yet. The first environment that company creates is priced at ${price}${window}; until then the promise waits.` : `Applied: ${row.code} prices ${row.companySlug} at ${price}${window}. No issued document changes.`;
41344
+ });
41345
+ }
41346
+ /** The text for a discount answer, or null when this module does not own the report. */
41347
+ function discountText(report) {
41348
+ if (report.kind === "discounts") return discountsText(report.items);
41349
+ if (report.kind === "discountIssued") return issuedText(report.outcome, Date.now());
41350
+ if (report.kind === "discountEnded") return endedText(report.outcome);
41351
+ if (report.kind === "discountRedeemed") return redeemedText(report.outcome);
41352
+ return null;
41353
+ }
41354
+ //#endregion
41012
41355
  //#region src/commands/billing-exports.ts
41013
41356
  /**
41014
41357
  * The accountant's pack, from a terminal.
@@ -41226,7 +41569,7 @@ var BILLING_METADATA = {
41226
41569
  {
41227
41570
  name: "--amount",
41228
41571
  takesValue: true,
41229
- description: "The amount in rand, for a new price window."
41572
+ description: "The amount in rand, for a new price window or the price a code grants."
41230
41573
  },
41231
41574
  {
41232
41575
  name: "--from",
@@ -41333,6 +41676,26 @@ var BILLING_METADATA = {
41333
41676
  takesValue: true,
41334
41677
  description: "The payment state a person records: paid or unpaid."
41335
41678
  },
41679
+ {
41680
+ name: "--expires-at",
41681
+ takesValue: true,
41682
+ description: "When a discount code stops being redeemable, as an ISO-8601 date and time."
41683
+ },
41684
+ {
41685
+ name: "--redemptions",
41686
+ takesValue: true,
41687
+ description: "How many times a discount code may be redeemed, at least 1."
41688
+ },
41689
+ {
41690
+ name: "--duration-months",
41691
+ takesValue: true,
41692
+ description: "How many months a discount code's price lasts from redemption; without it the code is continual."
41693
+ },
41694
+ {
41695
+ name: "--code",
41696
+ takesValue: true,
41697
+ description: "A discount code's spelling: yours to name, or the one a client types."
41698
+ },
41336
41699
  {
41337
41700
  name: "--confirm",
41338
41701
  takesValue: false,
@@ -41382,7 +41745,12 @@ var BILLING_METADATA = {
41382
41745
  "client invoice download",
41383
41746
  "client credit-note-download",
41384
41747
  "export download",
41385
- "profile update"
41748
+ "profile update",
41749
+ "discounts",
41750
+ "discount",
41751
+ "discount issue",
41752
+ "discount end",
41753
+ "discount redeem"
41386
41754
  ]
41387
41755
  };
41388
41756
  var BILLING_TOPICS = [
@@ -41401,6 +41769,10 @@ var BILLING_TOPICS = [
41401
41769
  {
41402
41770
  path: ["invoice"],
41403
41771
  usage: "hostingctl billing invoice [--uuid <uuid>] [retry|void|credit|payment-state] --company <slug>\n\nAn issued tax invoice is immutable: a mistake is a credit note, and a failed render is retried."
41772
+ },
41773
+ {
41774
+ path: ["discount"],
41775
+ usage: "hostingctl billing discount <issue|end|redeem> [flags]\n\nA code grants a price, never a discount line: redeeming writes the company's own price window, so no issued document changes. Ending a code stops new redemptions and leaves the windows it granted running."
41404
41776
  }
41405
41777
  ];
41406
41778
  //#endregion
@@ -41521,7 +41893,9 @@ var HANDLERS = {
41521
41893
  client: clientDocuments,
41522
41894
  activation: activatePaid,
41523
41895
  "payment-summary": paymentSummary,
41524
- "payment-state": companyPaymentState
41896
+ "payment-state": companyPaymentState,
41897
+ discounts: () => discountIndex(),
41898
+ discount: discountCommand
41525
41899
  };
41526
41900
  var billing = {
41527
41901
  ...BILLING_METADATA,
@@ -41531,7 +41905,9 @@ var billing = {
41531
41905
  if (handler === void 0) throw new UsageError(BILLING_USAGE);
41532
41906
  return handler(context, rest);
41533
41907
  },
41534
- human: billingText
41908
+ human(report) {
41909
+ return discountText(report) ?? billingText(report);
41910
+ }
41535
41911
  };
41536
41912
  //#endregion
41537
41913
  //#region src/commands/cancellation-text.ts
@@ -42013,7 +42389,7 @@ function episode(rest) {
42013
42389
  }
42014
42390
  //#endregion
42015
42391
  //#region src/commands/company-assets.ts
42016
- var USAGE$35 = [
42392
+ var USAGE$36 = [
42017
42393
  "Usage: hostingctl company logo|favicon set --image-file <path> --company <slug>",
42018
42394
  " hostingctl company logo|favicon remove --company <slug>",
42019
42395
  "",
@@ -42028,17 +42404,17 @@ var USAGE$35 = [
42028
42404
  */
42029
42405
  async function companyAssets(context, asset, rest) {
42030
42406
  const [action, ...tail] = rest;
42031
- if (tail.length > 0) throw new UsageError(USAGE$35);
42407
+ if (tail.length > 0) throw new UsageError(USAGE$36);
42032
42408
  const company = await requireCompany(context.flags);
42033
42409
  if (action === "set") return await set(context, asset, company);
42034
42410
  if (action === "remove") return await remove$2(context, asset, company);
42035
- throw new UsageError(USAGE$35);
42411
+ throw new UsageError(USAGE$36);
42036
42412
  }
42037
42413
  /** `set --image-file …`: one multipart upload of the asset. */
42038
42414
  async function set(context, asset, company) {
42039
42415
  const file = context.flags.get("--image-file") ?? "";
42040
42416
  return await confirmableWrite(context, file === "" ? `Set ${company}'s ${asset}.` : `Set ${company}'s ${asset} to ${file}.`, async () => {
42041
- const body = await imageUpload(file, USAGE$35);
42417
+ const body = await imageUpload(file, USAGE$36);
42042
42418
  return asset === "logo" ? (await companyAssetStoreLogo({
42043
42419
  path: { company },
42044
42420
  body
@@ -42076,7 +42452,7 @@ function companyRole(raw, usage) {
42076
42452
  }
42077
42453
  //#endregion
42078
42454
  //#region src/commands/company-invitations.ts
42079
- var USAGE$34 = [
42455
+ var USAGE$35 = [
42080
42456
  "Usage: hostingctl company invitations --company <slug>",
42081
42457
  " hostingctl company invite --company <slug> --email <email> --name <name> --role <admin|member>",
42082
42458
  " hostingctl company cancel-invitation <invitation-uuid> --company <slug>",
@@ -42100,7 +42476,7 @@ var MAX_INVITATION_TOKEN_BYTES = 4096;
42100
42476
  */
42101
42477
  async function companyInvitations(context, subcommand, rest) {
42102
42478
  if (subcommand === "invitations") {
42103
- if (rest.length > 0) throw new UsageError(USAGE$34);
42479
+ if (rest.length > 0) throw new UsageError(USAGE$35);
42104
42480
  const company = await requireCompany(context.flags);
42105
42481
  return {
42106
42482
  kind: "invitations",
@@ -42111,20 +42487,20 @@ async function companyInvitations(context, subcommand, rest) {
42111
42487
  if (subcommand === "invite") return await invite(context, rest);
42112
42488
  if (subcommand === "cancel-invitation") return await cancel(context, rest);
42113
42489
  if (subcommand === "invitation-preview") return (await companyInvitationPreview({
42114
- path: { invitationUuid: oneUuid$7(rest, USAGE$34) },
42115
- body: { token: readSecret(context, "token", MAX_INVITATION_TOKEN_BYTES, USAGE$34) }
42490
+ path: { invitationUuid: oneUuid$7(rest, USAGE$35) },
42491
+ body: { token: readSecret(context, "token", MAX_INVITATION_TOKEN_BYTES, USAGE$35) }
42116
42492
  })).data;
42117
42493
  if (subcommand === "invitation-accept") return await accept(context, rest);
42118
- throw new UsageError(USAGE$34);
42494
+ throw new UsageError(USAGE$35);
42119
42495
  }
42120
42496
  /** `invite --email … --name … --role …`. */
42121
42497
  async function invite(context, rest) {
42122
- if (rest.length > 0) throw new UsageError(USAGE$34);
42498
+ if (rest.length > 0) throw new UsageError(USAGE$35);
42123
42499
  const company = await requireCompany(context.flags);
42124
42500
  const email = context.flags.get("--email")?.trim() ?? "";
42125
42501
  const name = context.flags.get("--name")?.trim() ?? "";
42126
- const role = companyRole(context.flags.get("--role"), USAGE$34);
42127
- if (email === "" || name === "") throw new UsageError(`invite needs --email and --name.\n\n${USAGE$34}`);
42502
+ const role = companyRole(context.flags.get("--role"), USAGE$35);
42503
+ if (email === "" || name === "") throw new UsageError(`invite needs --email and --name.\n\n${USAGE$35}`);
42128
42504
  return await confirmableWrite(context, `Invite ${name} <${email}> into ${company} as ${role}.`, async () => (await companyInvitationStore({
42129
42505
  path: { company },
42130
42506
  body: {
@@ -42136,7 +42512,7 @@ async function invite(context, rest) {
42136
42512
  }
42137
42513
  /** `cancel-invitation <uuid> --company …`. */
42138
42514
  async function cancel(context, rest) {
42139
- const invitationUuid = oneUuid$7(rest, USAGE$34);
42515
+ const invitationUuid = oneUuid$7(rest, USAGE$35);
42140
42516
  const company = await requireCompany(context.flags);
42141
42517
  return await confirmableWrite(context, `Cancel invitation ${invitationUuid}.`, async () => {
42142
42518
  return (await companyInvitationDestroy({ path: {
@@ -42147,11 +42523,11 @@ async function cancel(context, rest) {
42147
42523
  }
42148
42524
  /** `invitation-accept <uuid>`: join the company the invitation names. */
42149
42525
  async function accept(context, rest) {
42150
- const invitationUuid = oneUuid$7(rest, USAGE$34);
42526
+ const invitationUuid = oneUuid$7(rest, USAGE$35);
42151
42527
  return await confirmableWrite(context, `Accept invitation ${invitationUuid}.`, async () => {
42152
42528
  return (await companyInvitationAccept({
42153
42529
  path: { invitationUuid },
42154
- body: { token: readSecret(context, "token", MAX_INVITATION_TOKEN_BYTES, USAGE$34) }
42530
+ body: { token: readSecret(context, "token", MAX_INVITATION_TOKEN_BYTES, USAGE$35) }
42155
42531
  })).data;
42156
42532
  });
42157
42533
  }
@@ -42252,31 +42628,31 @@ var COMPANY_METADATA = {
42252
42628
  var COMPANY_TOPICS = [
42253
42629
  {
42254
42630
  path: ["logo"],
42255
- usage: USAGE$35
42631
+ usage: USAGE$36
42256
42632
  },
42257
42633
  {
42258
42634
  path: ["favicon"],
42259
- usage: USAGE$35
42635
+ usage: USAGE$36
42260
42636
  },
42261
42637
  {
42262
42638
  path: ["invitations"],
42263
- usage: USAGE$34
42639
+ usage: USAGE$35
42264
42640
  },
42265
42641
  {
42266
42642
  path: ["invite"],
42267
- usage: USAGE$34
42643
+ usage: USAGE$35
42268
42644
  },
42269
42645
  {
42270
42646
  path: ["cancel-invitation"],
42271
- usage: USAGE$34
42647
+ usage: USAGE$35
42272
42648
  },
42273
42649
  {
42274
42650
  path: ["invitation-preview"],
42275
- usage: USAGE$34
42651
+ usage: USAGE$35
42276
42652
  },
42277
42653
  {
42278
42654
  path: ["invitation-accept"],
42279
- usage: USAGE$34
42655
+ usage: USAGE$35
42280
42656
  }
42281
42657
  ];
42282
42658
  //#endregion
@@ -43097,7 +43473,7 @@ function readJsonObject(file, subject) {
43097
43473
  }
43098
43474
  //#endregion
43099
43475
  //#region src/commands/dns-records.ts
43100
- var USAGE$33 = [
43476
+ var USAGE$34 = [
43101
43477
  "Usage: hostingctl dns enable <domain-uuid> --company <slug>",
43102
43478
  " hostingctl dns record set <domain-uuid> --company <slug> --file <set.json>",
43103
43479
  " hostingctl dns record remove <domain-uuid> --company <slug> --name <relative> --type <type>",
@@ -43136,7 +43512,7 @@ async function dnsWrites(context, subcommand, rest) {
43136
43512
  if (subcommand === "record") return await record$4(context, rest);
43137
43513
  if (subcommand === "dnssec") return await changeDnssec(context, rest);
43138
43514
  if (subcommand === "handover") return await handover(context, rest);
43139
- throw new UsageError(USAGE$33);
43515
+ throw new UsageError(USAGE$34);
43140
43516
  }
43141
43517
  /** The zone's current desired generation, which every write must name. */
43142
43518
  async function generation(company, domainUuid) {
@@ -43147,7 +43523,7 @@ async function generation(company, domainUuid) {
43147
43523
  }
43148
43524
  /** `dns enable <uuid>`: take the zone over into managed DNS. */
43149
43525
  async function enable(context, rest) {
43150
- const domainUuid = oneUuid$7(rest, USAGE$33);
43526
+ const domainUuid = oneUuid$7(rest, USAGE$34);
43151
43527
  const company = await requireCompany(context.flags);
43152
43528
  return await confirmableWrite(context, "Publish this name's zone in managed DNS.", async () => (await domainsDnsStore({ path: {
43153
43529
  company,
@@ -43157,16 +43533,16 @@ async function enable(context, rest) {
43157
43533
  /** `dns record set|remove`. */
43158
43534
  async function record$4(context, rest) {
43159
43535
  const [action, ...tail] = rest;
43160
- const domainUuid = oneUuid$7(tail, USAGE$33);
43536
+ const domainUuid = oneUuid$7(tail, USAGE$34);
43161
43537
  const company = await requireCompany(context.flags);
43162
43538
  if (action === "set") return await setRecord(context, company, domainUuid);
43163
43539
  if (action === "remove") return await removeRecord(context, company, domainUuid);
43164
- throw new UsageError(USAGE$33);
43540
+ throw new UsageError(USAGE$34);
43165
43541
  }
43166
43542
  /** `record set --file`: replace one set with the file's own values. */
43167
43543
  async function setRecord(context, company, domainUuid) {
43168
43544
  const file = context.flags.get("--file") ?? "";
43169
- if (file === "") throw new UsageError(`record set needs --file <set.json>.\n\n${USAGE$33}`);
43545
+ if (file === "") throw new UsageError(`record set needs --file <set.json>.\n\n${USAGE$34}`);
43170
43546
  const set = recordSetFromFile(file);
43171
43547
  return await confirmableWrite(context, [`Replace the ${set.recordType.toUpperCase()} set "${set.relativeName}" (ttl ${String(set.ttlSeconds)}) with:`, ...set.values.map((one) => ` ${one}`)].join("\n"), async () => {
43172
43548
  const body = {
@@ -43186,7 +43562,7 @@ async function setRecord(context, company, domainUuid) {
43186
43562
  async function removeRecord(context, company, domainUuid) {
43187
43563
  const relativeName = context.flags.get("--name") ?? "";
43188
43564
  const recordType = recordTypeFlag(context);
43189
- if (relativeName === "") throw new UsageError(`record remove needs --name.\n\n${USAGE$33}`);
43565
+ if (relativeName === "") throw new UsageError(`record remove needs --name.\n\n${USAGE$34}`);
43190
43566
  return await confirmableWrite(context, `Remove the ${recordType.toUpperCase()} set "${relativeName}".`, async () => {
43191
43567
  const query = {
43192
43568
  relativeName,
@@ -43205,8 +43581,8 @@ async function removeRecord(context, company, domainUuid) {
43205
43581
  /** `dns dnssec <signed|unsigned> <uuid>`: the signing mode, with the confirmation the API requires. */
43206
43582
  async function changeDnssec(context, rest) {
43207
43583
  const [mode, uuid, ...extra] = rest;
43208
- if (mode === void 0 || mode !== "signed" && mode !== "unsigned" || extra.length > 0) throw new UsageError(USAGE$33);
43209
- const domainUuid = oneUuid$7(uuid === void 0 ? [] : [uuid], USAGE$33);
43584
+ if (mode === void 0 || mode !== "signed" && mode !== "unsigned" || extra.length > 0) throw new UsageError(USAGE$34);
43585
+ const domainUuid = oneUuid$7(uuid === void 0 ? [] : [uuid], USAGE$34);
43210
43586
  const company = await requireCompany(context.flags);
43211
43587
  return await confirmableWrite(context, [`Set the zone's signing mode to ${mode}.`, ...mode === "signed" ? [" DNSSEC signing is added; resolvers that fail validation will not answer until DS records match."] : [" DNSSEC signing is removed; the DS record in the parent zone has to be removed too."]].join("\n"), async () => {
43212
43588
  const body = {
@@ -43225,7 +43601,7 @@ async function changeDnssec(context, rest) {
43225
43601
  }
43226
43602
  /** `dns handover <uuid>`: hand the zone back, dropping what this platform publishes. */
43227
43603
  async function handover(context, rest) {
43228
- const domainUuid = oneUuid$7(rest, USAGE$33);
43604
+ const domainUuid = oneUuid$7(rest, USAGE$34);
43229
43605
  const company = await requireCompany(context.flags);
43230
43606
  return await confirmableWrite(context, ["Hand this name's zone back out of managed DNS.", " Address records published here stop being published; the name and its applications stay."].join("\n"), async () => {
43231
43607
  const body = {
@@ -43244,7 +43620,7 @@ async function handover(context, rest) {
43244
43620
  /** A record type flag, refused when it is not one of the API's own values. */
43245
43621
  function recordTypeFlag(context) {
43246
43622
  const raw = (context.flags.get("--type") ?? "").trim().toLowerCase();
43247
- if (!RECORD_TYPES.has(raw)) throw new UsageError(`--type must be one of ${[...RECORD_TYPES].join(", ")} (got "${raw}").\n\n${USAGE$33}`);
43623
+ if (!RECORD_TYPES.has(raw)) throw new UsageError(`--type must be one of ${[...RECORD_TYPES].join(", ")} (got "${raw}").\n\n${USAGE$34}`);
43248
43624
  return raw;
43249
43625
  }
43250
43626
  /**
@@ -43278,7 +43654,7 @@ function recordSetFromValue(value, subject) {
43278
43654
  }
43279
43655
  //#endregion
43280
43656
  //#region src/commands/dns-templates.ts
43281
- var USAGE$32 = [
43657
+ var USAGE$33 = [
43282
43658
  "Usage: hostingctl dns template list --company <slug>",
43283
43659
  " hostingctl dns template show <template-uuid> --company <slug>",
43284
43660
  " hostingctl dns template save [<template-uuid>] --company <slug> --file <template.json>",
@@ -43300,24 +43676,24 @@ var USAGE$32 = [
43300
43676
  async function dnsTemplates(context, rest) {
43301
43677
  const [action, ...tail] = rest;
43302
43678
  if (action === "list") {
43303
- if (tail.length > 0) throw new UsageError(USAGE$32);
43679
+ if (tail.length > 0) throw new UsageError(USAGE$33);
43304
43680
  return {
43305
43681
  kind: "templates",
43306
43682
  templates: (await dnsTemplatesIndex({ path: { company: await requireCompany(context.flags) } })).data.templates
43307
43683
  };
43308
43684
  }
43309
- if (action === "show") return await show$4(context, oneUuid$7(tail, USAGE$32));
43685
+ if (action === "show") return await show$4(context, oneUuid$7(tail, USAGE$33));
43310
43686
  if (action === "save") return await save$1(context, tail[0]);
43311
- if (action === "delete") return await destroy$1(context, oneUuid$7(tail, USAGE$32));
43312
- if (action === "from-zone") return await fromZone(context, oneUuid$7(tail, USAGE$32));
43687
+ if (action === "delete") return await destroy$1(context, oneUuid$7(tail, USAGE$33));
43688
+ if (action === "from-zone") return await fromZone(context, oneUuid$7(tail, USAGE$33));
43313
43689
  if (action === "preview") return await preview$1(context, tail);
43314
43690
  if (action === "apply") return await apply(context, tail);
43315
- throw new UsageError(USAGE$32);
43691
+ throw new UsageError(USAGE$33);
43316
43692
  }
43317
43693
  /** Two uuids: the template, then the zone it applies to. */
43318
43694
  function templateAndZone(rest) {
43319
43695
  const [templateUuid, domainUuid, ...extra] = rest;
43320
- if (templateUuid === void 0 || templateUuid === "" || domainUuid === void 0 || domainUuid === "" || extra.length > 0) throw new UsageError(USAGE$32);
43696
+ if (templateUuid === void 0 || templateUuid === "" || domainUuid === void 0 || domainUuid === "" || extra.length > 0) throw new UsageError(USAGE$33);
43321
43697
  return {
43322
43698
  templateUuid,
43323
43699
  domainUuid
@@ -43336,7 +43712,7 @@ async function show$4(context, templateUuid) {
43336
43712
  /** `save [<uuid>] --file …`: record a new template, or replace the one named. */
43337
43713
  async function save$1(context, templateUuid) {
43338
43714
  const file = context.flags.get("--file") ?? "";
43339
- if (file === "") throw new UsageError(`template save needs --file <template.json>.\n\n${USAGE$32}`);
43715
+ if (file === "") throw new UsageError(`template save needs --file <template.json>.\n\n${USAGE$33}`);
43340
43716
  const company = await requireCompany(context.flags);
43341
43717
  const document = readJsonObject(file, "template");
43342
43718
  const name = typeof document.name === "string" ? document.name.trim() : "";
@@ -43372,7 +43748,7 @@ async function destroy$1(context, templateUuid) {
43372
43748
  async function fromZone(context, domainUuid) {
43373
43749
  const company = await requireCompany(context.flags);
43374
43750
  const name = context.flags.get("--name")?.trim() ?? "";
43375
- if (name === "") throw new UsageError(`template from-zone needs --name.\n\n${USAGE$32}`);
43751
+ if (name === "") throw new UsageError(`template from-zone needs --name.\n\n${USAGE$33}`);
43376
43752
  const zone = (await domainsDnsShow({ path: {
43377
43753
  company,
43378
43754
  domainUuid
@@ -43442,7 +43818,7 @@ function recordSetsFromFile$1(document, subject) {
43442
43818
  }
43443
43819
  //#endregion
43444
43820
  //#region src/commands/dns-text.ts
43445
- var USAGE$31 = [
43821
+ var USAGE$32 = [
43446
43822
  "Usage: hostingctl dns <zone|export> <domain-uuid> --company <slug>",
43447
43823
  " hostingctl dns import <preview|apply> <domain-uuid> --company <slug> --file <path> [--confirm]",
43448
43824
  " hostingctl dns enable <domain-uuid> --company <slug>",
@@ -43513,7 +43889,7 @@ function applyText(result) {
43513
43889
  var DNS_METADATA = {
43514
43890
  name: "dns",
43515
43891
  summary: "A managed name's zone, its zone-file export, and the reviewed import write.",
43516
- usage: USAGE$31,
43892
+ usage: USAGE$32,
43517
43893
  flags: [
43518
43894
  {
43519
43895
  name: "--file",
@@ -43551,23 +43927,23 @@ var DNS_METADATA = {
43551
43927
  var DNS_TOPICS = [
43552
43928
  {
43553
43929
  path: ["enable"],
43554
- usage: USAGE$33
43930
+ usage: USAGE$34
43555
43931
  },
43556
43932
  {
43557
43933
  path: ["record"],
43558
- usage: USAGE$33
43934
+ usage: USAGE$34
43559
43935
  },
43560
43936
  {
43561
43937
  path: ["dnssec"],
43562
- usage: USAGE$33
43938
+ usage: USAGE$34
43563
43939
  },
43564
43940
  {
43565
43941
  path: ["handover"],
43566
- usage: USAGE$33
43942
+ usage: USAGE$34
43567
43943
  },
43568
43944
  {
43569
43945
  path: ["template"],
43570
- usage: USAGE$32
43946
+ usage: USAGE$33
43571
43947
  }
43572
43948
  ];
43573
43949
  //#endregion
@@ -43585,7 +43961,7 @@ var IMPORT_LINE = /^(\S+)\s+(\d+)\s+(\S+)\s+(.+)$/;
43585
43961
  * hold customer DNS data, so its contents are never printed; only the API's own answer is shown.
43586
43962
  */
43587
43963
  function recordSetsFromFile(file) {
43588
- if (file === void 0 || file === "") throw new UsageError(`Importing needs the record sets from disk: pass --file <path>.\n\n${USAGE$31}`);
43964
+ if (file === void 0 || file === "") throw new UsageError(`Importing needs the record sets from disk: pass --file <path>.\n\n${USAGE$32}`);
43589
43965
  const sets = /* @__PURE__ */ new Map();
43590
43966
  for (const [index, raw] of readBoundedImportFile(file, "import").split("\n").entries()) addLine(sets, raw.trim(), index + 1);
43591
43967
  if (sets.size === 0) throw new UsageError(`The import file [${file}] holds no record sets.`);
@@ -43679,7 +44055,7 @@ var dns = {
43679
44055
  if (subcommand === "import") return await importRecords(context, rest);
43680
44056
  if (subcommand === "template") return await dnsTemplates(context, rest);
43681
44057
  if (WRITE_SUBCOMMANDS$1.has(subcommand ?? "")) return await dnsWrites(context, subcommand ?? "", rest);
43682
- throw new UsageError(USAGE$31);
44058
+ throw new UsageError(USAGE$32);
43683
44059
  },
43684
44060
  human(report) {
43685
44061
  if ("sent" in report) return renderWriteOutcome(report, dnsWriteText);
@@ -43698,7 +44074,7 @@ async function readZone(context, rest, which) {
43698
44074
  /** `import preview|apply <uuid> --file <path>`: the review, or the reviewed write. */
43699
44075
  async function importRecords(context, rest) {
43700
44076
  const [action, ...tail] = rest;
43701
- if (action !== "preview" && action !== "apply") throw new UsageError(USAGE$31);
44077
+ if (action !== "preview" && action !== "apply") throw new UsageError(USAGE$32);
43702
44078
  const path = await domainPath$1(context, tail);
43703
44079
  const recordSets = recordSetsFromFile(context.flags.get("--file"));
43704
44080
  if (action === "preview") return (await domainsDnsImportPreview({
@@ -43735,7 +44111,7 @@ async function applyImport(context, path, recordSets) {
43735
44111
  /** The company and the one domain uuid a DNS subcommand needs, or a usage refusal. */
43736
44112
  async function domainPath$1(context, rest) {
43737
44113
  const [domainUuid, ...extra] = rest;
43738
- if (domainUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$31);
44114
+ if (domainUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$32);
43739
44115
  return {
43740
44116
  company: await requireCompany(context.flags),
43741
44117
  domainUuid
@@ -43904,7 +44280,7 @@ function checkText(check) {
43904
44280
  //#endregion
43905
44281
  //#region src/commands/email-alias.ts
43906
44282
  /** The one usage string this group refuses with, owned by the group it belongs to. */
43907
- var USAGE$30 = [
44283
+ var USAGE$31 = [
43908
44284
  "Usage: hostingctl email alias add <email-domain-uuid> --company <slug> --local <name> --destinations a@x,b@y",
43909
44285
  " hostingctl email alias set <email-domain-uuid> <alias-uuid> --company <slug> --destinations a@x,b@y",
43910
44286
  " hostingctl email alias remove <email-domain-uuid> <alias-uuid> --company <slug>",
@@ -43928,16 +44304,16 @@ async function aliasGroup(context, action, tail) {
43928
44304
  if (action === "set") return await aliasSet(context, tail);
43929
44305
  if (action === "remove") return await aliasRemove(context, tail);
43930
44306
  if (action === "unroute") return await aliasUnroute(context, tail);
43931
- throw new UsageError(USAGE$30);
44307
+ throw new UsageError(USAGE$31);
43932
44308
  }
43933
44309
  /** `alias add <domain> --local … --destinations …`: a new forwarding address. */
43934
44310
  async function aliasAdd(context, tail) {
43935
44311
  const [emailDomainUuid, ...extra] = tail;
43936
- if (emailDomainUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$30);
44312
+ if (emailDomainUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$31);
43937
44313
  const company = await requireCompany(context.flags);
43938
44314
  const localPart = context.flags.get("--local")?.trim().toLowerCase() ?? "";
43939
44315
  const list = destinations$1(context);
43940
- if (localPart === "" || list.length === 0) throw new UsageError(`alias add needs --local and --destinations.\n\n${USAGE$30}`);
44316
+ if (localPart === "" || list.length === 0) throw new UsageError(`alias add needs --local and --destinations.\n\n${USAGE$31}`);
43941
44317
  return await confirmableWrite(context, [`Create ${localPart}@… forwarding to:`, ...list.map((one) => ` ${one}`)].join("\n"), async () => {
43942
44318
  return (await emailAliasesStore({
43943
44319
  path: {
@@ -43954,10 +44330,10 @@ async function aliasAdd(context, tail) {
43954
44330
  /** `alias set <domain> <alias> --destinations …`: replace the complete recipient list. */
43955
44331
  async function aliasSet(context, tail) {
43956
44332
  const [emailDomainUuid, aliasUuid, ...extra] = tail;
43957
- if (emailDomainUuid === void 0 || aliasUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$30);
44333
+ if (emailDomainUuid === void 0 || aliasUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$31);
43958
44334
  const company = await requireCompany(context.flags);
43959
44335
  const list = destinations$1(context);
43960
- if (list.length === 0) throw new UsageError(`alias set needs --destinations.\n\n${USAGE$30}`);
44336
+ if (list.length === 0) throw new UsageError(`alias set needs --destinations.\n\n${USAGE$31}`);
43961
44337
  return await confirmableWrite(context, [`Replace ${aliasUuid}'s destinations with:`, ...list.map((one) => ` ${one}`)].join("\n"), async () => {
43962
44338
  return (await emailAliasesUpdate({
43963
44339
  path: {
@@ -43972,7 +44348,7 @@ async function aliasSet(context, tail) {
43972
44348
  /** `alias remove <domain> <alias>`. */
43973
44349
  async function aliasRemove(context, tail) {
43974
44350
  const [emailDomainUuid, aliasUuid, ...extra] = tail;
43975
- if (emailDomainUuid === void 0 || aliasUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$30);
44351
+ if (emailDomainUuid === void 0 || aliasUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$31);
43976
44352
  const company = await requireCompany(context.flags);
43977
44353
  return await confirmableWrite(context, `Remove alias ${aliasUuid}.`, async () => {
43978
44354
  return (await emailAliasesDestroy({ path: {
@@ -43985,7 +44361,7 @@ async function aliasRemove(context, tail) {
43985
44361
  /** `alias unroute <domain> <alias> <mailbox>`: drop one destination. */
43986
44362
  async function aliasUnroute(context, tail) {
43987
44363
  const [emailDomainUuid, aliasUuid, mailboxUuid, ...extra] = tail;
43988
- if (emailDomainUuid === void 0 || aliasUuid === void 0 || mailboxUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$30);
44364
+ if (emailDomainUuid === void 0 || aliasUuid === void 0 || mailboxUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$31);
43989
44365
  const company = await requireCompany(context.flags);
43990
44366
  return await confirmableWrite(context, `Stop forwarding ${aliasUuid} to mailbox ${mailboxUuid}.`, async () => {
43991
44367
  return (await emailAliasesDestinationsDestroy({ path: {
@@ -43998,7 +44374,7 @@ async function aliasUnroute(context, tail) {
43998
44374
  }
43999
44375
  //#endregion
44000
44376
  //#region src/commands/email-address.ts
44001
- var USAGE$29 = [
44377
+ var USAGE$30 = [
44002
44378
  "Usage: hostingctl email alias add <email-domain-uuid> --company <slug> --local <name> --destinations a@x,b@y",
44003
44379
  " hostingctl email alias set <email-domain-uuid> <alias-uuid> --company <slug> --destinations a@x,b@y",
44004
44380
  " hostingctl email alias remove <email-domain-uuid> <alias-uuid> --company <slug>",
@@ -44024,13 +44400,13 @@ async function emailAddresses(context, subcommand, rest) {
44024
44400
  if (subcommand === "alias") return await aliasGroup(context, action, tail);
44025
44401
  if (subcommand === "app-token") return await appToken(context, action, tail);
44026
44402
  if (subcommand === "send-as") return await sendAs(context, action, tail);
44027
- throw new UsageError(USAGE$29);
44403
+ throw new UsageError(USAGE$30);
44028
44404
  }
44029
44405
  /** `app-token list|issue|revoke|deliver`. */
44030
44406
  async function appToken(context, action, tail) {
44031
44407
  const company = await requireCompany(context.flags);
44032
44408
  const [emailDomainUuid, mailboxUuid, third, ...extra] = tail;
44033
- if (emailDomainUuid === void 0 || mailboxUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$29);
44409
+ if (emailDomainUuid === void 0 || mailboxUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$30);
44034
44410
  const path = {
44035
44411
  company,
44036
44412
  emailDomainUuid,
@@ -44058,7 +44434,7 @@ async function appToken(context, action, tail) {
44058
44434
  }
44059
44435
  if (action === "issue" && third === void 0) {
44060
44436
  const label = context.flags.get("--label")?.trim() ?? "";
44061
- if (label === "") throw new UsageError(`app-token issue needs --label.\n\n${USAGE$29}`);
44437
+ if (label === "") throw new UsageError(`app-token issue needs --label.\n\n${USAGE$30}`);
44062
44438
  return await confirmableWrite(context, `Create an application password labelled "${label}".`, async () => {
44063
44439
  return (await emailAppTokensStore({
44064
44440
  path,
@@ -44066,7 +44442,7 @@ async function appToken(context, action, tail) {
44066
44442
  })).data;
44067
44443
  });
44068
44444
  }
44069
- if (third === void 0) throw new UsageError(USAGE$29);
44445
+ if (third === void 0) throw new UsageError(USAGE$30);
44070
44446
  const tokenPath = {
44071
44447
  ...path,
44072
44448
  tokenUuid: third
@@ -44075,14 +44451,14 @@ async function appToken(context, action, tail) {
44075
44451
  return (await emailAppTokensRevoke({ path: tokenPath })).data;
44076
44452
  });
44077
44453
  if (action === "deliver") return await confirmableWrite(context, [`Return application password ${third} once.`, " The value is printed here and not stored: it cannot be read again after this."].join("\n"), async () => (await emailAppTokensDeliver({ path: tokenPath })).data);
44078
- throw new UsageError(USAGE$29);
44454
+ throw new UsageError(USAGE$30);
44079
44455
  }
44080
44456
  /** `send-as list|grant|revoke`. */
44081
44457
  async function sendAs(context, action, tail) {
44082
44458
  const company = await requireCompany(context.flags);
44083
44459
  if (action === "revoke") {
44084
44460
  const [grantUuid, ...extra] = tail;
44085
- if (grantUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$29);
44461
+ if (grantUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$30);
44086
44462
  return await confirmableWrite(context, `Revoke send-as grant ${grantUuid}.`, async () => {
44087
44463
  return (await emailSendAsGrantsDestroy({ path: {
44088
44464
  company,
@@ -44091,7 +44467,7 @@ async function sendAs(context, action, tail) {
44091
44467
  });
44092
44468
  }
44093
44469
  const [emailDomainUuid, mailboxUuid, ...extra] = tail;
44094
- if (emailDomainUuid === void 0 || mailboxUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$29);
44470
+ if (emailDomainUuid === void 0 || mailboxUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$30);
44095
44471
  const path = {
44096
44472
  company,
44097
44473
  emailDomainUuid,
@@ -44118,7 +44494,7 @@ async function sendAs(context, action, tail) {
44118
44494
  }
44119
44495
  if (action === "grant") {
44120
44496
  const grantedAddressUuid = context.flags.get("--address") ?? "";
44121
- if (grantedAddressUuid === "") throw new UsageError(`send-as grant needs --address.\n\n${USAGE$29}`);
44497
+ if (grantedAddressUuid === "") throw new UsageError(`send-as grant needs --address.\n\n${USAGE$30}`);
44122
44498
  return await confirmableWrite(context, `Allow this mailbox to send as address ${grantedAddressUuid}.`, async () => {
44123
44499
  return (await emailSendAsGrantsStore({
44124
44500
  path,
@@ -44126,7 +44502,7 @@ async function sendAs(context, action, tail) {
44126
44502
  })).data;
44127
44503
  });
44128
44504
  }
44129
- throw new UsageError(USAGE$29);
44505
+ throw new UsageError(USAGE$30);
44130
44506
  }
44131
44507
  //#endregion
44132
44508
  //#region src/commands/email-write-text.ts
@@ -44195,7 +44571,7 @@ function emailAddressText(report) {
44195
44571
  }
44196
44572
  //#endregion
44197
44573
  //#region src/commands/email-domain.ts
44198
- var USAGE$28 = [
44574
+ var USAGE$29 = [
44199
44575
  "Usage: hostingctl email offer",
44200
44576
  " hostingctl email enroll --company <slug>",
44201
44577
  " hostingctl email agree --company <slug> --term <package-term-uuid>",
@@ -44216,7 +44592,7 @@ var USAGE$28 = [
44216
44592
  /** `email offer|agree|provision|domain|catch-all`, dispatched from the `email` command. */
44217
44593
  async function emailDomains(context, subcommand, rest) {
44218
44594
  if (subcommand === "offer") {
44219
- if (rest.length > 0) throw new UsageError(USAGE$28);
44595
+ if (rest.length > 0) throw new UsageError(USAGE$29);
44220
44596
  return {
44221
44597
  kind: "offers",
44222
44598
  offers: (await emailOffers({ path: { company: await requireCompany(context.flags) } })).data
@@ -44227,11 +44603,11 @@ async function emailDomains(context, subcommand, rest) {
44227
44603
  if (subcommand === "provision") return await provision(context, rest);
44228
44604
  if (subcommand === "domain") return await domain(context, rest);
44229
44605
  if (subcommand === "catch-all") return await catchAll(context, rest);
44230
- throw new UsageError(USAGE$28);
44606
+ throw new UsageError(USAGE$29);
44231
44607
  }
44232
44608
  /** A company-wide command takes no positionals. */
44233
44609
  function noExtra$12(rest) {
44234
- if (rest.length > 0) throw new UsageError(USAGE$28);
44610
+ if (rest.length > 0) throw new UsageError(USAGE$29);
44235
44611
  }
44236
44612
  /** `enroll`: create the service record and start provisioning, which is the API's own create. */
44237
44613
  async function enroll(context, rest) {
@@ -44244,7 +44620,7 @@ async function agree(context, rest) {
44244
44620
  noExtra$12(rest);
44245
44621
  const company = await requireCompany(context.flags);
44246
44622
  const packageTermUuid = context.flags.get("--term") ?? "";
44247
- if (packageTermUuid === "") throw new UsageError(`agree needs --term.\n\n${USAGE$28}`);
44623
+ if (packageTermUuid === "") throw new UsageError(`agree needs --term.\n\n${USAGE$29}`);
44248
44624
  return await confirmableWrite(context, `Accept email package term ${packageTermUuid} for ${company}.`, async () => (await emailAgreement({
44249
44625
  path: { company },
44250
44626
  body: { packageTermUuid }
@@ -44263,7 +44639,7 @@ async function domain(context, rest) {
44263
44639
  if (action === "add") {
44264
44640
  noExtra$12(tail);
44265
44641
  const hostname = context.flags.get("--hostname")?.trim().toLowerCase() ?? "";
44266
- if (hostname === "") throw new UsageError(`domain add needs --hostname.\n\n${USAGE$28}`);
44642
+ if (hostname === "") throw new UsageError(`domain add needs --hostname.\n\n${USAGE$29}`);
44267
44643
  return await confirmableWrite(context, `Attach ${hostname} to ${company}'s mail service.`, async () => {
44268
44644
  return (await emailDomainsStore({
44269
44645
  path: { company },
@@ -44273,7 +44649,7 @@ async function domain(context, rest) {
44273
44649
  }
44274
44650
  const path = {
44275
44651
  company,
44276
- emailDomainUuid: oneUuid$7(tail, USAGE$28)
44652
+ emailDomainUuid: oneUuid$7(tail, USAGE$29)
44277
44653
  };
44278
44654
  if (action === "recheck") return await confirmableWrite(context, "Re-observe this name's DNS now.", async () => {
44279
44655
  return (await emailDomainsRecheck({ path })).data;
@@ -44293,14 +44669,14 @@ async function domain(context, rest) {
44293
44669
  body
44294
44670
  })).data;
44295
44671
  });
44296
- throw new UsageError(USAGE$28);
44672
+ throw new UsageError(USAGE$29);
44297
44673
  }
44298
44674
  /** `catch-all show|set|clear`. */
44299
44675
  async function catchAll(context, rest) {
44300
44676
  const [action, ...tail] = rest;
44301
44677
  const path = {
44302
44678
  company: await requireCompany(context.flags),
44303
- emailDomainUuid: oneUuid$7(tail, USAGE$28)
44679
+ emailDomainUuid: oneUuid$7(tail, USAGE$29)
44304
44680
  };
44305
44681
  if (action === "show") return {
44306
44682
  kind: "catch-all",
@@ -44308,7 +44684,7 @@ async function catchAll(context, rest) {
44308
44684
  };
44309
44685
  if (action === "set") {
44310
44686
  const destinations = destinationList(context);
44311
- if (destinations.length === 0) throw new UsageError(`catch-all set needs --destinations a@x,b@y.\n\n${USAGE$28}`);
44687
+ if (destinations.length === 0) throw new UsageError(`catch-all set needs --destinations a@x,b@y.\n\n${USAGE$29}`);
44312
44688
  return await confirmableWrite(context, [`Enable the catch-all for this name, forwarding to:`, ...destinations.map((one) => ` ${one}`)].join("\n"), async () => {
44313
44689
  return (await emailCatchAllUpdate({
44314
44690
  path,
@@ -44320,7 +44696,7 @@ async function catchAll(context, rest) {
44320
44696
  });
44321
44697
  }
44322
44698
  if (action === "clear") return await confirmableWrite(context, "Disable the catch-all: mail to an unknown address at this name is refused rather than forwarded.", async () => (await emailCatchAllDestroy({ path })).data);
44323
- throw new UsageError(USAGE$28);
44699
+ throw new UsageError(USAGE$29);
44324
44700
  }
44325
44701
  /**
44326
44702
  * The comma-separated `--destinations`.
@@ -44352,7 +44728,7 @@ function catchAllText(one) {
44352
44728
  }
44353
44729
  //#endregion
44354
44730
  //#region src/commands/email-holds.ts
44355
- var USAGE$27 = [
44731
+ var USAGE$28 = [
44356
44732
  "Usage: hostingctl email hold list --company <slug>",
44357
44733
  " hostingctl email hold create --company <slug> --reason <compromise|abuse|operator> [--mailbox <uuid>]",
44358
44734
  " hostingctl email hold release <hold-uuid> --company <slug>",
@@ -44375,21 +44751,21 @@ async function emailHolds(context, rest) {
44375
44751
  const [action, ...tail] = rest;
44376
44752
  const company = await requireCompany(context.flags);
44377
44753
  if (action === "list") {
44378
- if (tail.length > 0) throw new UsageError(USAGE$27);
44754
+ if (tail.length > 0) throw new UsageError(USAGE$28);
44379
44755
  return {
44380
44756
  kind: "holds",
44381
44757
  holds: (await emailHoldsIndex({ path: { company } })).data.holds
44382
44758
  };
44383
44759
  }
44384
44760
  if (action === "create") return await create$3(context, tail, company);
44385
- if (action === "release") return await release(context, oneUuid$7(tail, USAGE$27), company);
44386
- throw new UsageError(USAGE$27);
44761
+ if (action === "release") return await release(context, oneUuid$7(tail, USAGE$28), company);
44762
+ throw new UsageError(USAGE$28);
44387
44763
  }
44388
44764
  /** `create --reason … [--mailbox …]`. */
44389
44765
  async function create$3(context, tail, company) {
44390
- if (tail.length > 0) throw new UsageError(USAGE$27);
44766
+ if (tail.length > 0) throw new UsageError(USAGE$28);
44391
44767
  const raw = context.flags.get("--reason")?.trim() ?? "";
44392
- if (!REASONS.has(raw)) throw new UsageError(`--reason must be compromise, abuse or operator (got "${raw}").\n\n${USAGE$27}`);
44768
+ if (!REASONS.has(raw)) throw new UsageError(`--reason must be compromise, abuse or operator (got "${raw}").\n\n${USAGE$28}`);
44393
44769
  const mailboxUuid = context.flags.get("--mailbox")?.trim() ?? "";
44394
44770
  return await confirmableWrite(context, [`Hold outbound mail for ${mailboxUuid === "" ? "the whole service" : `mailbox ${mailboxUuid}`} because: ${raw}.`, " Nothing is sent until this hold is released."].join("\n"), async () => {
44395
44771
  return (await emailHoldsStore({
@@ -44425,7 +44801,7 @@ function emailHoldText(report) {
44425
44801
  }
44426
44802
  //#endregion
44427
44803
  //#region src/commands/email-mailbox-admin.ts
44428
- var USAGE$26 = [
44804
+ var USAGE$27 = [
44429
44805
  "Usage: hostingctl email mailbox add <email-domain-uuid> --company <slug> --local <name> --quota <gb-5|gb-10|gb-20>",
44430
44806
  " hostingctl email mailbox change <email-domain-uuid> <mailbox-uuid> --company <slug> [--status enabled|suspended] [--quota <size>]",
44431
44807
  " hostingctl email mailbox remove <email-domain-uuid> <mailbox-uuid> --company <slug>",
@@ -44457,7 +44833,7 @@ var STATUSES = /* @__PURE__ */ new Set(["enabled", "suspended"]);
44457
44833
  async function emailMailboxAdmin(context, action, tail) {
44458
44834
  if (action === "add") return await add$6(context, tail);
44459
44835
  const [emailDomainUuid, mailboxUuid, ...extra] = tail;
44460
- if (emailDomainUuid === void 0 || mailboxUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$26);
44836
+ if (emailDomainUuid === void 0 || mailboxUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$27);
44461
44837
  const path = {
44462
44838
  company: await requireCompany(context.flags),
44463
44839
  emailDomainUuid,
@@ -44475,7 +44851,7 @@ async function emailMailboxAdmin(context, action, tail) {
44475
44851
  if (action === "preferences-set") return await preferences(context, path);
44476
44852
  if (action === "credential") return await revealCredential(context, path, false);
44477
44853
  if (action === "reset-credential") return await revealCredential(context, path, true);
44478
- throw new UsageError(USAGE$26);
44854
+ throw new UsageError(USAGE$27);
44479
44855
  }
44480
44856
  /** A quota flag from the API's own values. */
44481
44857
  function quota(context) {
@@ -44491,11 +44867,11 @@ function destinations(context) {
44491
44867
  /** `add <domain> --local … --quota …`. */
44492
44868
  async function add$6(context, tail) {
44493
44869
  const [emailDomainUuid, ...extra] = tail;
44494
- if (emailDomainUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$26);
44870
+ if (emailDomainUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$27);
44495
44871
  const company = await requireCompany(context.flags);
44496
44872
  const localPart = context.flags.get("--local")?.trim().toLowerCase() ?? "";
44497
44873
  const size = quota(context);
44498
- if (localPart === "" || size === null) throw new UsageError(`mailbox add needs --local and --quota.\n\n${USAGE$26}`);
44874
+ if (localPart === "" || size === null) throw new UsageError(`mailbox add needs --local and --quota.\n\n${USAGE$27}`);
44499
44875
  return await confirmableWrite(context, `Create mailbox ${localPart}@… with a ${size} quota.`, async () => {
44500
44876
  return (await emailMailboxesStore({
44501
44877
  path: {
@@ -44520,7 +44896,7 @@ function statusFlag(context) {
44520
44896
  async function change$1(context, path) {
44521
44897
  const status = statusFlag(context);
44522
44898
  const size = quota(context);
44523
- if (status === null && size === null) throw new UsageError(`mailbox change needs --status, --quota or both.\n\n${USAGE$26}`);
44899
+ if (status === null && size === null) throw new UsageError(`mailbox change needs --status, --quota or both.\n\n${USAGE$27}`);
44524
44900
  return await confirmableWrite(context, `Set this mailbox's ${[status === null ? null : `status to ${status}`, size === null ? null : `quota to ${size}`].filter((one) => one !== null).join(" and ")}.`, async () => {
44525
44901
  return (await emailMailboxesUpdate({
44526
44902
  path,
@@ -44548,7 +44924,7 @@ async function preferences(context, path) {
44548
44924
  const markRead = onOff$4(context, "--spam-mark-read");
44549
44925
  const threshold = context.flags.get("--spam-threshold");
44550
44926
  const summary = context.flags.get("--vacation-subject");
44551
- if (vacation === null && markRead === null && threshold === void 0 && summary === void 0) throw new UsageError(`preferences-set needs --vacation, --spam-threshold, --spam-mark-read or --vacation-subject.\n\n${USAGE$26}`);
44927
+ if (vacation === null && markRead === null && threshold === void 0 && summary === void 0) throw new UsageError(`preferences-set needs --vacation, --spam-threshold, --spam-mark-read or --vacation-subject.\n\n${USAGE$27}`);
44552
44928
  const body = {
44553
44929
  vacationEnabled: vacation ?? current.vacationEnabled,
44554
44930
  vacationSubject: context.flags.get("--vacation-subject") ?? current.vacationSubject,
@@ -44603,7 +44979,7 @@ function emailMailboxAdminText(report) {
44603
44979
  }
44604
44980
  //#endregion
44605
44981
  //#region src/commands/email-service.ts
44606
- var USAGE$25 = [
44982
+ var USAGE$26 = [
44607
44983
  "Usage: hostingctl email service <suspend|resume> --company <slug>",
44608
44984
  " hostingctl email service cancellation --company <slug>",
44609
44985
  " hostingctl email service cancel --company <slug> --ends-at <iso-date>",
@@ -44630,11 +45006,11 @@ async function emailService(context, subcommand, rest) {
44630
45006
  if (subcommand === "dmarc-set") return await dmarcSet$1(context, rest);
44631
45007
  if (subcommand === "blocklist-set") return await blocklistSet(context, rest);
44632
45008
  if (subcommand === "service") return await service(context, rest);
44633
- throw new UsageError(USAGE$25);
45009
+ throw new UsageError(USAGE$26);
44634
45010
  }
44635
45011
  /** A company-wide command takes no positionals. */
44636
45012
  function noExtra$11(rest) {
44637
- if (rest.length > 0) throw new UsageError(USAGE$25);
45013
+ if (rest.length > 0) throw new UsageError(USAGE$26);
44638
45014
  }
44639
45015
  /** `service suspend|resume|cancellation|cancel|cancel-withdraw`. */
44640
45016
  async function service(context, rest) {
@@ -44660,7 +45036,7 @@ async function service(context, rest) {
44660
45036
  if (action === "cancel") {
44661
45037
  noExtra$11(tail);
44662
45038
  const endsAt = context.flags.get("--ends-at")?.trim() ?? "";
44663
- if (endsAt === "") throw new UsageError(`service cancel needs --ends-at.\n\n${USAGE$25}`);
45039
+ if (endsAt === "") throw new UsageError(`service cancel needs --ends-at.\n\n${USAGE$26}`);
44664
45040
  if (Number.isNaN(Date.parse(endsAt))) throw new UsageError(`--ends-at must be an ISO date (got "${endsAt}").`);
44665
45041
  return await confirmableWrite(context, [`End the mail service at ${endsAt}.`, " Mail keeps working until then; the cancellation can be withdrawn before that date."].join("\n"), async () => (await emailCancellationStore({
44666
45042
  path: { company },
@@ -44673,7 +45049,7 @@ async function service(context, rest) {
44673
45049
  return (await emailCancellationWithdraw({ path: { company } })).data;
44674
45050
  });
44675
45051
  }
44676
- throw new UsageError(USAGE$25);
45052
+ throw new UsageError(USAGE$26);
44677
45053
  }
44678
45054
  /** `dmarc`: DMARC reporting for every attached name. */
44679
45055
  async function dmarc$1(context, rest) {
@@ -44693,7 +45069,7 @@ async function blocklist$1(context, rest) {
44693
45069
  }
44694
45070
  /** `dmarc-set <name> --enabled on|off`. */
44695
45071
  async function dmarcSet$1(context, rest) {
44696
- const emailDomainUuid = oneUuid$7(rest, USAGE$25);
45072
+ const emailDomainUuid = oneUuid$7(rest, USAGE$26);
44697
45073
  const company = await requireCompany(context.flags);
44698
45074
  const enabled = onOff$3(context);
44699
45075
  return await confirmableWrite(context, `${enabled ? "Enable" : "Disable"} DMARC reporting for this name.`, async () => {
@@ -44708,7 +45084,7 @@ async function dmarcSet$1(context, rest) {
44708
45084
  }
44709
45085
  /** `blocklist-set <name> --enabled on|off`. */
44710
45086
  async function blocklistSet(context, rest) {
44711
- const emailDomainUuid = oneUuid$7(rest, USAGE$25);
45087
+ const emailDomainUuid = oneUuid$7(rest, USAGE$26);
44712
45088
  const company = await requireCompany(context.flags);
44713
45089
  const enabled = onOff$3(context);
44714
45090
  return await confirmableWrite(context, `${enabled ? "Enable" : "Disable"} blocklist monitoring for this name.`, async () => {
@@ -44725,7 +45101,7 @@ async function blocklistSet(context, rest) {
44725
45101
  async function importSchema(context, rest) {
44726
45102
  noExtra$11(rest);
44727
45103
  const version = context.flags.get("--version")?.trim() ?? "";
44728
- if (version === "") throw new UsageError(`import-schema needs --version.\n\n${USAGE$25}`);
45104
+ if (version === "") throw new UsageError(`import-schema needs --version.\n\n${USAGE$26}`);
44729
45105
  return {
44730
45106
  kind: "schema",
44731
45107
  version,
@@ -44737,7 +45113,7 @@ function onOff$3(context) {
44737
45113
  const raw = context.flags.get("--enabled")?.trim() ?? "";
44738
45114
  if (raw === "on" || raw === "true") return true;
44739
45115
  if (raw === "off" || raw === "false") return false;
44740
- throw new UsageError(`--enabled must be on or off (got "${raw}").\n\n${USAGE$25}`);
45116
+ throw new UsageError(`--enabled must be on or off (got "${raw}").\n\n${USAGE$26}`);
44741
45117
  }
44742
45118
  /** The `email service|dmarc|blocklist|import-schema` renderer. */
44743
45119
  function emailServiceText(report) {
@@ -44750,7 +45126,7 @@ function emailServiceText(report) {
44750
45126
  //#endregion
44751
45127
  //#region src/commands/email-sync-csv.ts
44752
45128
  /** The usage this group refuses with, owned by the command it belongs to. */
44753
- var USAGE$24 = [
45129
+ var USAGE$25 = [
44754
45130
  "Usage: hostingctl email sync csv <preview|commit> <email-domain-uuid> --company <slug> --file <path>",
44755
45131
  "",
44756
45132
  " preview What the file's rows would become. Writes nothing.",
@@ -44761,7 +45137,7 @@ var USAGE$24 = [
44761
45137
  /** One named uuid, or a usage refusal. */
44762
45138
  function one$1(rest) {
44763
45139
  const [uuid, ...extra] = rest;
44764
- if (uuid === void 0 || uuid === "" || extra.length > 0) throw new UsageError(USAGE$24);
45140
+ if (uuid === void 0 || uuid === "" || extra.length > 0) throw new UsageError(USAGE$25);
44765
45141
  return uuid;
44766
45142
  }
44767
45143
  /** `csv preview|commit <domain> --file <path>`: one multipart upload of the CSV itself. */
@@ -44769,7 +45145,7 @@ async function csv(context, tail) {
44769
45145
  const [action, ...args] = tail;
44770
45146
  const path = await domainPath(context, one$1(args));
44771
45147
  const file = context.flags.get("--file") ?? "";
44772
- if (file === "") throw new UsageError(`sync csv needs --file <path>.\n\n${USAGE$24}`);
45148
+ if (file === "") throw new UsageError(`sync csv needs --file <path>.\n\n${USAGE$25}`);
44773
45149
  if (action === "preview") return {
44774
45150
  kind: "csv-preview",
44775
45151
  rows: (await emailMailboxSyncCsvPreview({
@@ -44777,10 +45153,10 @@ async function csv(context, tail) {
44777
45153
  body: await csvPreviewBody(file)
44778
45154
  })).data.rows
44779
45155
  };
44780
- if (action !== "commit") throw new UsageError(USAGE$24);
45156
+ if (action !== "commit") throw new UsageError(USAGE$25);
44781
45157
  const recurrence = recurrenceFlag(context) ?? "once";
44782
45158
  const endsAt = context.flags.get("--ends-at")?.trim() || null;
44783
- if (recurrence === "until" && endsAt === null) throw new UsageError(`--recurrence until needs --ends-at.\n\n${USAGE$24}`);
45159
+ if (recurrence === "until" && endsAt === null) throw new UsageError(`--recurrence until needs --ends-at.\n\n${USAGE$25}`);
44784
45160
  return await confirmableWrite(context, [`Commit the sync accounts in ${file}, once the API has reviewed it.`, ` The review is re-read here and only its accepted rows are committed: ${recurrence}${endsAt === null ? "" : ` until ${endsAt}`}.`].join("\n"), async () => {
44785
45161
  const accepted = (await emailMailboxSyncCsvPreview({
44786
45162
  path,
@@ -44829,7 +45205,7 @@ async function csvCommitBody(file, accepted, recurrence, endsAt) {
44829
45205
  }
44830
45206
  //#endregion
44831
45207
  //#region src/commands/email-sync.ts
44832
- var USAGE$23 = [
45208
+ var USAGE$24 = [
44833
45209
  "Usage: hostingctl email sync show <email-domain-uuid> --company <slug>",
44834
45210
  " hostingctl email sync server <email-domain-uuid> --company <slug> --host <host> --port <n> --encryption <tls|starttls>",
44835
45211
  " hostingctl email sync account add <email-domain-uuid> --company <slug> --username <login> (--password-file <path>|--password-stdin) --mailbox <uuid> --recurrence <once|until> [--ends-at <iso>]",
@@ -44854,12 +45230,12 @@ async function emailSync(context, rest) {
44854
45230
  if (action === "server") return await server(context, tail);
44855
45231
  if (action === "account") return await account(context, tail);
44856
45232
  if (action === "csv") return await csv(context, tail);
44857
- throw new UsageError(USAGE$23);
45233
+ throw new UsageError(USAGE$24);
44858
45234
  }
44859
45235
  /** One named uuid, or a usage refusal. */
44860
45236
  function one(rest) {
44861
45237
  const [uuid, ...extra] = rest;
44862
- if (uuid === void 0 || uuid === "" || extra.length > 0) throw new UsageError(USAGE$23);
45238
+ if (uuid === void 0 || uuid === "" || extra.length > 0) throw new UsageError(USAGE$24);
44863
45239
  return uuid;
44864
45240
  }
44865
45241
  /** `show`: the server and every account. */
@@ -44875,9 +45251,9 @@ async function server(context, tail) {
44875
45251
  const host = context.flags.get("--host")?.trim() ?? "";
44876
45252
  const port = Number(context.flags.get("--port") ?? "");
44877
45253
  const encryption = context.flags.get("--encryption")?.trim() ?? "";
44878
- if (host === "") throw new UsageError(`sync server needs --host.\n\n${USAGE$23}`);
44879
- if (!Number.isInteger(port) || port < 1 || port > 65535) throw new UsageError(`--port must be a whole number between 1 and 65535.\n\n${USAGE$23}`);
44880
- if (!ENCRYPTIONS.has(encryption)) throw new UsageError(`--encryption must be tls or starttls (got "${encryption}").\n\n${USAGE$23}`);
45254
+ if (host === "") throw new UsageError(`sync server needs --host.\n\n${USAGE$24}`);
45255
+ if (!Number.isInteger(port) || port < 1 || port > 65535) throw new UsageError(`--port must be a whole number between 1 and 65535.\n\n${USAGE$24}`);
45256
+ if (!ENCRYPTIONS.has(encryption)) throw new UsageError(`--encryption must be tls or starttls (got "${encryption}").\n\n${USAGE$24}`);
44881
45257
  return await confirmableWrite(context, `Point the mailbox sync source at ${host}:${String(port)} over ${encryption}.`, async () => {
44882
45258
  return (await emailMailboxSyncServerUpdate({
44883
45259
  path,
@@ -44901,9 +45277,9 @@ async function account(context, tail) {
44901
45277
  const [action, ...args] = tail;
44902
45278
  if (action === "add") return await accountAdd(context, args);
44903
45279
  if (action === "change") return await accountChange(context, args);
44904
- if (action === void 0) throw new UsageError(USAGE$23);
45280
+ if (action === void 0) throw new UsageError(USAGE$24);
44905
45281
  const [emailDomainUuid, accountUuid, ...extra] = args;
44906
- if (emailDomainUuid === void 0 || accountUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$23);
45282
+ if (emailDomainUuid === void 0 || accountUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$24);
44907
45283
  return await accountAction(context, action, {
44908
45284
  ...await domainPath(context, emailDomainUuid),
44909
45285
  accountUuid
@@ -44922,13 +45298,13 @@ async function accountAction(context, action, path) {
44922
45298
  if (action === "start") return await startAccount(context, path);
44923
45299
  if (action === "stop") return await confirmableWrite(context, "Stop this account's scheduled sync. The source credential is kept.", async () => (await emailMailboxSyncAccountsStop({ path })).data);
44924
45300
  if (action === "forget") return await confirmableWrite(context, "Forget this account's source credential and stop future work.", async () => (await emailMailboxSyncAccountsForget({ path })).data);
44925
- throw new UsageError(USAGE$23);
45301
+ throw new UsageError(USAGE$24);
44926
45302
  }
44927
45303
  /** `start`: the schedule the account should run on from now. */
44928
45304
  async function startAccount(context, path) {
44929
45305
  const recurrence = recurrenceFlag(context) ?? "once";
44930
45306
  const endsAt = context.flags.get("--ends-at")?.trim() || null;
44931
- if (recurrence === "until" && endsAt === null) throw new UsageError(`--recurrence until needs --ends-at.\n\n${USAGE$23}`);
45307
+ if (recurrence === "until" && endsAt === null) throw new UsageError(`--recurrence until needs --ends-at.\n\n${USAGE$24}`);
44932
45308
  return await confirmableWrite(context, `Start this account's scheduled sync (${recurrence}${endsAt === null ? "" : ` until ${endsAt}`}).`, async () => (await emailMailboxSyncAccountsStart({
44933
45309
  path,
44934
45310
  body: {
@@ -44941,7 +45317,7 @@ async function startAccount(context, path) {
44941
45317
  async function accountAdd(context, args) {
44942
45318
  const path = await domainPath(context, one(args));
44943
45319
  const body = accountBody(context);
44944
- const sourcePassword = readSecret(context, "password", 4096, USAGE$23);
45320
+ const sourcePassword = readSecret(context, "password", 4096, USAGE$24);
44945
45321
  return await confirmableWrite(context, [`Add a sync account for ${body.sourceUsername} into mailbox ${body.mailboxUuid}.`, ` It runs ${body.recurrence === "once" ? "once" : `until ${String(body.endsAt)}`}.`].join("\n"), async () => (await emailMailboxSyncAccountsStore({
44946
45322
  path,
44947
45323
  body: {
@@ -44953,7 +45329,7 @@ async function accountAdd(context, args) {
44953
45329
  /** `account change <domain> <account> [fields]`: only the fields named are sent. */
44954
45330
  async function accountChange(context, args) {
44955
45331
  const [emailDomainUuid, accountUuid, ...extra] = args;
44956
- if (emailDomainUuid === void 0 || accountUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$23);
45332
+ if (emailDomainUuid === void 0 || accountUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$24);
44957
45333
  const path = {
44958
45334
  ...await domainPath(context, emailDomainUuid),
44959
45335
  accountUuid
@@ -44967,8 +45343,8 @@ async function accountChange(context, args) {
44967
45343
  if (mailbox !== "") body.mailboxUuid = mailbox;
44968
45344
  if (recurrence !== null) body.recurrence = recurrence;
44969
45345
  if (endsAt !== "") body.endsAt = endsAt;
44970
- if (context.flags.has("--password-file") || context.flags.has("--password-stdin")) body.sourcePassword = readSecret(context, "password", 4096, USAGE$23);
44971
- if (Object.keys(body).length === 0) throw new UsageError(`account change needs at least one field.\n\n${USAGE$23}`);
45346
+ if (context.flags.has("--password-file") || context.flags.has("--password-stdin")) body.sourcePassword = readSecret(context, "password", 4096, USAGE$24);
45347
+ if (Object.keys(body).length === 0) throw new UsageError(`account change needs at least one field.\n\n${USAGE$24}`);
44972
45348
  return await confirmableWrite(context, "Change this sync account.", async () => {
44973
45349
  return (await emailMailboxSyncAccountsUpdate({
44974
45350
  path,
@@ -44982,8 +45358,8 @@ function accountBody(context) {
44982
45358
  const mailboxUuid = context.flags.get("--mailbox")?.trim() ?? "";
44983
45359
  const recurrence = recurrenceFlag(context) ?? "once";
44984
45360
  const endsAt = context.flags.get("--ends-at")?.trim() ?? "";
44985
- if (sourceUsername === "" || mailboxUuid === "") throw new UsageError(`account add needs --username and --mailbox.\n\n${USAGE$23}`);
44986
- if (recurrence === "until" && endsAt === "") throw new UsageError(`--recurrence until needs --ends-at.\n\n${USAGE$23}`);
45361
+ if (sourceUsername === "" || mailboxUuid === "") throw new UsageError(`account add needs --username and --mailbox.\n\n${USAGE$24}`);
45362
+ if (recurrence === "until" && endsAt === "") throw new UsageError(`--recurrence until needs --ends-at.\n\n${USAGE$24}`);
44987
45363
  return {
44988
45364
  sourceUsername,
44989
45365
  mailboxUuid,
@@ -45000,7 +45376,7 @@ function recurrenceFlag(context) {
45000
45376
  }
45001
45377
  //#endregion
45002
45378
  //#region src/commands/email-text.ts
45003
- var USAGE$22 = [
45379
+ var USAGE$23 = [
45004
45380
  "Usage: hostingctl email <show|names> --company <slug>",
45005
45381
  " hostingctl email <mailboxes|aliases> <email-domain-uuid> --company <slug>",
45006
45382
  " hostingctl email mailbox <email-domain-uuid> <mailbox-uuid> --company <slug>",
@@ -45083,7 +45459,7 @@ function count(shown, total) {
45083
45459
  var EMAIL_METADATA = {
45084
45460
  name: "email",
45085
45461
  summary: "A company's email service, its attached names, their mailboxes and aliases.",
45086
- usage: USAGE$22,
45462
+ usage: USAGE$23,
45087
45463
  flags: [
45088
45464
  {
45089
45465
  name: "--address",
@@ -45263,75 +45639,75 @@ var EMAIL_METADATA = {
45263
45639
  var EMAIL_TOPICS = [
45264
45640
  {
45265
45641
  path: ["alias"],
45266
- usage: USAGE$30
45642
+ usage: USAGE$31
45267
45643
  },
45268
45644
  {
45269
45645
  path: ["app-token"],
45270
- usage: USAGE$29
45646
+ usage: USAGE$30
45271
45647
  },
45272
45648
  {
45273
45649
  path: ["send-as"],
45274
- usage: USAGE$29
45650
+ usage: USAGE$30
45275
45651
  },
45276
45652
  {
45277
45653
  path: ["offer"],
45278
- usage: USAGE$28
45654
+ usage: USAGE$29
45279
45655
  },
45280
45656
  {
45281
45657
  path: ["enroll"],
45282
- usage: USAGE$28
45658
+ usage: USAGE$29
45283
45659
  },
45284
45660
  {
45285
45661
  path: ["agree"],
45286
- usage: USAGE$28
45662
+ usage: USAGE$29
45287
45663
  },
45288
45664
  {
45289
45665
  path: ["provision"],
45290
- usage: USAGE$28
45666
+ usage: USAGE$29
45291
45667
  },
45292
45668
  {
45293
45669
  path: ["domain"],
45294
- usage: USAGE$28
45670
+ usage: USAGE$29
45295
45671
  },
45296
45672
  {
45297
45673
  path: ["catch-all"],
45298
- usage: USAGE$28
45674
+ usage: USAGE$29
45299
45675
  },
45300
45676
  {
45301
45677
  path: ["service"],
45302
- usage: USAGE$25
45678
+ usage: USAGE$26
45303
45679
  },
45304
45680
  {
45305
45681
  path: ["dmarc"],
45306
- usage: USAGE$25
45682
+ usage: USAGE$26
45307
45683
  },
45308
45684
  {
45309
45685
  path: ["dmarc-set"],
45310
- usage: USAGE$25
45686
+ usage: USAGE$26
45311
45687
  },
45312
45688
  {
45313
45689
  path: ["blocklist"],
45314
- usage: USAGE$25
45690
+ usage: USAGE$26
45315
45691
  },
45316
45692
  {
45317
45693
  path: ["blocklist-set"],
45318
- usage: USAGE$25
45694
+ usage: USAGE$26
45319
45695
  },
45320
45696
  {
45321
45697
  path: ["import-schema"],
45322
- usage: USAGE$25
45698
+ usage: USAGE$26
45323
45699
  },
45324
45700
  {
45325
45701
  path: ["sync"],
45326
- usage: USAGE$23
45702
+ usage: USAGE$24
45327
45703
  },
45328
45704
  {
45329
45705
  path: ["hold"],
45330
- usage: USAGE$27
45706
+ usage: USAGE$28
45331
45707
  },
45332
45708
  {
45333
45709
  path: ["mailbox"],
45334
- usage: USAGE$26
45710
+ usage: USAGE$27
45335
45711
  }
45336
45712
  ];
45337
45713
  //#endregion
@@ -45373,7 +45749,7 @@ async function companyRead(context, subcommand, rest) {
45373
45749
  if (subcommand === "mailboxes") return await mailboxes(company, rest);
45374
45750
  if (subcommand === "mailbox") return await mailbox(company, rest);
45375
45751
  if (subcommand === "aliases") return await aliases(company, rest);
45376
- throw new UsageError(USAGE$22);
45752
+ throw new UsageError(USAGE$23);
45377
45753
  }
45378
45754
  /** The renderer for a tagged feature read, or null when this command renders the answer itself. */
45379
45755
  function taggedText(report) {
@@ -45458,7 +45834,7 @@ var email$2 = {
45458
45834
  ...EMAIL_METADATA,
45459
45835
  async run(context) {
45460
45836
  const [subcommand, ...rest] = context.positional;
45461
- if (subcommand === void 0 || !SUBCOMMANDS.has(subcommand)) throw new UsageError(USAGE$22);
45837
+ if (subcommand === void 0 || !SUBCOMMANDS.has(subcommand)) throw new UsageError(USAGE$23);
45462
45838
  const feature = dispatched$1(context, subcommand, rest);
45463
45839
  if (feature !== null) return await feature;
45464
45840
  return await companyRead(context, subcommand, rest);
@@ -45543,7 +45919,7 @@ async function aliases(company, rest) {
45543
45919
  /** `mailbox <email-domain-uuid> <mailbox-uuid>`: one record, independent of index pagination. */
45544
45920
  async function mailbox(company, rest) {
45545
45921
  const [emailDomainUuid, mailboxUuid, ...extra] = rest;
45546
- if (emailDomainUuid === void 0 || mailboxUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$22);
45922
+ if (emailDomainUuid === void 0 || mailboxUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$23);
45547
45923
  return (await emailMailboxesShow({ path: {
45548
45924
  company,
45549
45925
  emailDomainUuid,
@@ -45553,16 +45929,16 @@ async function mailbox(company, rest) {
45553
45929
  /** The one uuid a collection read names, or a usage refusal. */
45554
45930
  function oneUuid$4(rest) {
45555
45931
  const [uuid, ...extra] = rest;
45556
- if (uuid === void 0 || extra.length > 0) throw new UsageError(USAGE$22);
45932
+ if (uuid === void 0 || extra.length > 0) throw new UsageError(USAGE$23);
45557
45933
  return uuid;
45558
45934
  }
45559
45935
  /** A company-wide read takes no positional arguments. */
45560
45936
  function noExtra$10(rest) {
45561
- if (rest.length > 0) throw new UsageError(USAGE$22);
45937
+ if (rest.length > 0) throw new UsageError(USAGE$23);
45562
45938
  }
45563
45939
  //#endregion
45564
45940
  //#region src/commands/environment-admin.ts
45565
- var USAGE$21 = [
45941
+ var USAGE$22 = [
45566
45942
  "Usage: hostingctl environment retention <environment-uuid> --company <slug>",
45567
45943
  " hostingctl environment retention-set <environment-uuid> --company <slug> --extra-days <n> --effective-at <iso> --agreement <uuid> [--package <key>]",
45568
45944
  " hostingctl environment database-show <environment-uuid> <database-uuid> --company <slug>",
@@ -45586,9 +45962,9 @@ async function environmentAdmin(context, subcommand, rest) {
45586
45962
  if (subcommand === "retention") return await retention(context, first);
45587
45963
  if (subcommand === "retention-set") return await retentionSet(context, first);
45588
45964
  if (subcommand === "database-show" || subcommand === "database-reveal") {
45589
- if (first === void 0 || tail.length !== 1) throw new UsageError(USAGE$21);
45965
+ if (first === void 0 || tail.length !== 1) throw new UsageError(USAGE$22);
45590
45966
  const path = {
45591
- ...await environmentPath(context, first, USAGE$21),
45967
+ ...await environmentPath(context, first, USAGE$22),
45592
45968
  databaseUuid: tail[0] ?? ""
45593
45969
  };
45594
45970
  if (subcommand === "database-show") return {
@@ -45598,24 +45974,24 @@ async function environmentAdmin(context, subcommand, rest) {
45598
45974
  return await revealDatabase(context, path);
45599
45975
  }
45600
45976
  if (subcommand === "tuning") return await tuning(context, first, tail);
45601
- throw new UsageError(USAGE$21);
45977
+ throw new UsageError(USAGE$22);
45602
45978
  }
45603
45979
  /** `retention <env>`. */
45604
45980
  async function retention(context, environmentUuid) {
45605
45981
  return {
45606
45982
  kind: "retention",
45607
- retention: (await hostingRetentionShow({ path: await environmentPath(context, environmentUuid, USAGE$21) })).data
45983
+ retention: (await hostingRetentionShow({ path: await environmentPath(context, environmentUuid, USAGE$22) })).data
45608
45984
  };
45609
45985
  }
45610
45986
  /** `retention-set <env> --extra-days … --effective-at … --agreement …`. */
45611
45987
  async function retentionSet(context, environmentUuid) {
45612
- const path = await environmentPath(context, environmentUuid, USAGE$21);
45988
+ const path = await environmentPath(context, environmentUuid, USAGE$22);
45613
45989
  const extraDays = Number(context.flags.get("--extra-days") ?? "");
45614
45990
  const effectiveAt = context.flags.get("--effective-at")?.trim() ?? "";
45615
45991
  const baselineAgreementUuid = context.flags.get("--agreement")?.trim() ?? "";
45616
- if (!Number.isInteger(extraDays) || extraDays < 1) throw new UsageError(`retention-set needs --extra-days as a whole number of at least 1.\n\n${USAGE$21}`);
45617
- if (effectiveAt === "" || Number.isNaN(Date.parse(effectiveAt))) throw new UsageError(`retention-set needs --effective-at as an ISO date.\n\n${USAGE$21}`);
45618
- if (baselineAgreementUuid === "") throw new UsageError(`retention-set needs --agreement.\n\n${USAGE$21}`);
45992
+ if (!Number.isInteger(extraDays) || extraDays < 1) throw new UsageError(`retention-set needs --extra-days as a whole number of at least 1.\n\n${USAGE$22}`);
45993
+ if (effectiveAt === "" || Number.isNaN(Date.parse(effectiveAt))) throw new UsageError(`retention-set needs --effective-at as an ISO date.\n\n${USAGE$22}`);
45994
+ if (baselineAgreementUuid === "") throw new UsageError(`retention-set needs --agreement.\n\n${USAGE$22}`);
45619
45995
  const packageKey = context.flags.get("--package")?.trim();
45620
45996
  return {
45621
45997
  kind: "write",
@@ -45642,7 +46018,7 @@ async function revealDatabase(context, path) {
45642
46018
  /** `tuning preview|restore <env>`. */
45643
46019
  async function tuning(context, action, rest) {
45644
46020
  const environmentUuid = rest[0];
45645
- const path = await environmentPath(context, environmentUuid, USAGE$21);
46021
+ const path = await environmentPath(context, environmentUuid, USAGE$22);
45646
46022
  if (action === "preview" && rest.length === 1) {
45647
46023
  const body = (await hostingEnvironmentShow({ path })).data;
45648
46024
  return {
@@ -45655,7 +46031,7 @@ async function tuning(context, action, rest) {
45655
46031
  }
45656
46032
  if (action === "restore" && rest.length === 1) {
45657
46033
  const generation = Number(context.flags.get("--generation") ?? "");
45658
- if (!Number.isInteger(generation) || generation < 1) throw new UsageError(`tuning restore needs --generation.\n\n${USAGE$21}`);
46034
+ if (!Number.isInteger(generation) || generation < 1) throw new UsageError(`tuning restore needs --generation.\n\n${USAGE$22}`);
45659
46035
  return {
45660
46036
  kind: "write",
45661
46037
  outcome: await confirmableWrite(context, `Restore the recorded tuning for generation ${String(generation)}.`, async () => (await hostingTuningRestore({
@@ -45664,7 +46040,7 @@ async function tuning(context, action, rest) {
45664
46040
  })).data)
45665
46041
  };
45666
46042
  }
45667
- throw new UsageError(USAGE$21);
46043
+ throw new UsageError(USAGE$22);
45668
46044
  }
45669
46045
  /** One retention window as one line, and the write receipt for it. */
45670
46046
  function retentionText(one) {
@@ -45737,7 +46113,7 @@ async function cacheSet(context, path) {
45737
46113
  }
45738
46114
  //#endregion
45739
46115
  //#region src/commands/environment-component-version.ts
45740
- var USAGE$20 = [
46116
+ var USAGE$21 = [
45741
46117
  "Usage: hostingctl environment component-version <environment-uuid> <workload-uuid> <version> --company <slug>",
45742
46118
  "",
45743
46119
  " component-version Move one curated component instance to another version this platform pins an image",
@@ -45755,7 +46131,7 @@ var USAGE$20 = [
45755
46131
  */
45756
46132
  async function environmentComponentVersion(context, rest) {
45757
46133
  const [uuid, workloadUuid, version, ...extra] = rest;
45758
- if (uuid === void 0 || workloadUuid === void 0 || version === void 0 || extra.length > 0) throw new UsageError(USAGE$20);
46134
+ if (uuid === void 0 || workloadUuid === void 0 || version === void 0 || extra.length > 0) throw new UsageError(USAGE$21);
45759
46135
  const path = {
45760
46136
  company: await requireCompany(context.flags),
45761
46137
  environmentUuid: uuid,
@@ -45909,7 +46285,7 @@ function oneUuid$3(rest) {
45909
46285
  }
45910
46286
  //#endregion
45911
46287
  //#region src/commands/environment-create.ts
45912
- var USAGE$19 = [
46288
+ var USAGE$20 = [
45913
46289
  "Usage: hostingctl environment create --company <slug> --name <name> [--slug <slug>] [--package <key>]",
45914
46290
  "",
45915
46291
  "The package is one of the keys this environment's catalog offers; the platform chooses the placement,",
@@ -45917,16 +46293,16 @@ var USAGE$19 = [
45917
46293
  ].join("\n");
45918
46294
  /** `environment create --name … [--slug …] [--package …]`: a new environment from a platform package. */
45919
46295
  async function create$2(context, rest) {
45920
- if (rest.length > 0) throw new UsageError(USAGE$19);
46296
+ if (rest.length > 0) throw new UsageError(USAGE$20);
45921
46297
  const name = context.flags.get("--name")?.trim() ?? "";
45922
- if (name === "") throw new UsageError(`create needs --name.\n\n${USAGE$19}`);
45923
- const slug = slugFor(context.flags.get("--slug"), name, USAGE$19);
46298
+ if (name === "") throw new UsageError(`create needs --name.\n\n${USAGE$20}`);
46299
+ const slug = slugFor(context.flags.get("--slug"), name, USAGE$20);
45924
46300
  const company = await requireCompany(context.flags);
45925
46301
  const packages = (await hostingEnvironmentPackagesIndex({ path: { company } })).data;
45926
46302
  const offered = packages.map((one) => one.key).join(", ");
45927
46303
  const requested = context.flags.get("--package")?.trim() ?? "";
45928
46304
  const chosen = requested === "" ? packages[0] : packages.find((one) => one.key === requested);
45929
- if (chosen === void 0) throw new UsageError(`--package must be one of ${offered} (got ${requested}).\n\n${USAGE$19}`);
46305
+ if (chosen === void 0) throw new UsageError(`--package must be one of ${offered} (got ${requested}).\n\n${USAGE$20}`);
45930
46306
  const resourceProfile = chosen.key;
45931
46307
  return await confirmableWrite(context, describeCreate$1(name, slug, chosen.key), async () => {
45932
46308
  return (await hostingEnvironmentStore({
@@ -46276,7 +46652,7 @@ function oneUuid$2(rest) {
46276
46652
  }
46277
46653
  //#endregion
46278
46654
  //#region src/commands/environment-domains.ts
46279
- var USAGE$18 = [
46655
+ var USAGE$19 = [
46280
46656
  "Usage: hostingctl environment domains <environment-uuid> --company <slug>",
46281
46657
  " hostingctl environment domain-add <environment-uuid> --company <slug> --hostname <host> --workload <uuid> [--intended on|off]",
46282
46658
  " hostingctl environment domain-verify|domain-check-routing|domain-intended|domain-primary|domain-remove <environment-uuid> <domain-uuid> --company <slug>",
@@ -46307,7 +46683,7 @@ var DOMAIN_ACTIONS = {
46307
46683
  /** `environment domains|domain-add|domain-*|redirects|redirect-set|redirect-remove`. */
46308
46684
  async function environmentDomains(context, subcommand, rest) {
46309
46685
  const [environmentUuid, ...tail] = rest;
46310
- const path = await environmentPath(context, environmentUuid, USAGE$18);
46686
+ const path = await environmentPath(context, environmentUuid, USAGE$19);
46311
46687
  if (subcommand === "domains") return await domains(path, tail);
46312
46688
  if (subcommand === "redirects") return await redirects(path, tail);
46313
46689
  if (subcommand === "domain-add") return await add$5(context, path, tail);
@@ -46316,7 +46692,7 @@ async function environmentDomains(context, subcommand, rest) {
46316
46692
  if (subcommand === "domain-remove") return await removeDomain(context, path, tail);
46317
46693
  const action = DOMAIN_ACTIONS[subcommand];
46318
46694
  if (action !== void 0) return await domainAction(context, subcommand, action, path, tail);
46319
- throw new UsageError(USAGE$18);
46695
+ throw new UsageError(USAGE$19);
46320
46696
  }
46321
46697
  /** `domains <env>`. */
46322
46698
  async function domains(path, rest) {
@@ -46339,7 +46715,7 @@ async function add$5(context, path, rest) {
46339
46715
  noExtra$9(rest);
46340
46716
  const hostname = context.flags.get("--hostname")?.trim().toLowerCase() ?? "";
46341
46717
  const workloadUuid = context.flags.get("--workload")?.trim() ?? "";
46342
- if (hostname === "" || workloadUuid === "") throw new UsageError(`domain-add needs --hostname and --workload.\n\n${USAGE$18}`);
46718
+ if (hostname === "" || workloadUuid === "") throw new UsageError(`domain-add needs --hostname and --workload.\n\n${USAGE$19}`);
46343
46719
  const intended = onOffFlag(context, "--intended") ?? false;
46344
46720
  return await written$2(confirmableWrite(context, `Serve ${hostname} from workload ${workloadUuid}${intended ? " as an intended name" : ""}.`, async () => {
46345
46721
  return (await hostingDomainStore({
@@ -46355,7 +46731,7 @@ async function add$5(context, path, rest) {
46355
46731
  /** The five actions that take only the environment and the name. */
46356
46732
  async function domainAction(context, subcommand, action, path, rest) {
46357
46733
  const [domainUuid, ...extra] = rest;
46358
- if (domainUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$18);
46734
+ if (domainUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$19);
46359
46735
  const described = {
46360
46736
  "domain-verify": "Check this name's routing now.",
46361
46737
  "domain-check-routing": "Check this name's routing now.",
@@ -46373,7 +46749,7 @@ async function domainAction(context, subcommand, action, path, rest) {
46373
46749
  /** `domain-remove <env> <domain>`: stop serving a name. */
46374
46750
  async function removeDomain(context, path, rest) {
46375
46751
  const [domainUuid, ...extra] = rest;
46376
- if (domainUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$18);
46752
+ if (domainUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$19);
46377
46753
  const fallBackToGenerated = onOffFlag(context, "--fall-back-to-generated") ?? true;
46378
46754
  return await written$2(confirmableWrite(context, "Stop serving this name. Its record stays readable, and the environment keeps its generated hostname.", async () => {
46379
46755
  const body = { fallBackToGenerated };
@@ -46389,13 +46765,13 @@ async function removeDomain(context, path, rest) {
46389
46765
  /** `redirect-set <env> <domain> --target … --mode … [--destination …]`. */
46390
46766
  async function setRedirect(context, path, rest) {
46391
46767
  const [domainUuid, ...extra] = rest;
46392
- if (domainUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$18);
46768
+ if (domainUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$19);
46393
46769
  const target = context.flags.get("--target")?.trim() ?? "";
46394
46770
  const mode = context.flags.get("--mode")?.trim() ?? "";
46395
46771
  const destinationUrl = context.flags.get("--destination")?.trim() ?? "";
46396
- if (!TARGETS.has(target)) throw new UsageError(`--target must be application or fixed.\n\n${USAGE$18}`);
46397
- if (!MODES$1.has(mode)) throw new UsageError(`--mode must be temporary or permanent.\n\n${USAGE$18}`);
46398
- if (target === "fixed" && destinationUrl === "") throw new UsageError(`--target fixed needs --destination <url>.\n\n${USAGE$18}`);
46772
+ if (!TARGETS.has(target)) throw new UsageError(`--target must be application or fixed.\n\n${USAGE$19}`);
46773
+ if (!MODES$1.has(mode)) throw new UsageError(`--mode must be temporary or permanent.\n\n${USAGE$19}`);
46774
+ if (target === "fixed" && destinationUrl === "") throw new UsageError(`--target fixed needs --destination <url>.\n\n${USAGE$19}`);
46399
46775
  return await written$2(confirmableWrite(context, [`Redirect this name ${mode} to ${target === "fixed" ? destinationUrl : "its application"}.`, " The redirect activates once the source name's DNS resolves."].join("\n"), async () => {
46400
46776
  const body = {
46401
46777
  target,
@@ -46415,7 +46791,7 @@ async function setRedirect(context, path, rest) {
46415
46791
  /** `redirect-remove <env> <redirect-uuid>`. */
46416
46792
  async function removeRedirect(context, path, rest) {
46417
46793
  const [redirectUuid, ...extra] = rest;
46418
- if (redirectUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$18);
46794
+ if (redirectUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$19);
46419
46795
  return await written$2(confirmableWrite(context, `Remove redirect ${redirectUuid}.`, async () => {
46420
46796
  return (await hostingDomainRedirectDestroy({ path: {
46421
46797
  ...path,
@@ -46432,11 +46808,11 @@ async function written$2(pending) {
46432
46808
  }
46433
46809
  /** No positional arguments, or a usage refusal. */
46434
46810
  function noExtra$9(rest) {
46435
- if (rest.length > 0) throw new UsageError(USAGE$18);
46811
+ if (rest.length > 0) throw new UsageError(USAGE$19);
46436
46812
  }
46437
46813
  //#endregion
46438
46814
  //#region src/commands/environment-exports.ts
46439
- var USAGE$17 = [
46815
+ var USAGE$18 = [
46440
46816
  "Usage: hostingctl environment database-exports <environment-uuid> --company <slug>",
46441
46817
  " hostingctl environment database-export-create <environment-uuid> <database-uuid> --company <slug>",
46442
46818
  " hostingctl environment database-export-download <environment-uuid> <export-uuid> --company <slug>",
@@ -46456,7 +46832,7 @@ var USAGE$17 = [
46456
46832
  async function environmentExports(context, subcommand, rest) {
46457
46833
  if (subcommand === "release-bundle") {
46458
46834
  const [releaseUuid, ...extra] = rest;
46459
- if (releaseUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$17);
46835
+ if (releaseUuid === void 0 || extra.length > 0) throw new UsageError(USAGE$18);
46460
46836
  return {
46461
46837
  kind: "bundle",
46462
46838
  releaseUuid,
@@ -46464,7 +46840,7 @@ async function environmentExports(context, subcommand, rest) {
46464
46840
  };
46465
46841
  }
46466
46842
  const [environmentUuid, ...tail] = rest;
46467
- const path = await environmentPath(context, environmentUuid, USAGE$17);
46843
+ const path = await environmentPath(context, environmentUuid, USAGE$18);
46468
46844
  if (subcommand === "database-exports") {
46469
46845
  noExtra$8(tail);
46470
46846
  return {
@@ -46475,11 +46851,11 @@ async function environmentExports(context, subcommand, rest) {
46475
46851
  if (subcommand === "database-export-create") return await create(context, path, tail);
46476
46852
  if (subcommand === "database-export-download") return await download(path, tail);
46477
46853
  if (subcommand === "database-export-remove") return await remove$1(context, path, tail);
46478
- throw new UsageError(USAGE$17);
46854
+ throw new UsageError(USAGE$18);
46479
46855
  }
46480
46856
  /** `database-export-create <env> <db>`. */
46481
46857
  async function create(context, path, rest) {
46482
- const databaseUuid = oneUuid$7(rest, USAGE$17);
46858
+ const databaseUuid = oneUuid$7(rest, USAGE$18);
46483
46859
  return {
46484
46860
  kind: "export-write",
46485
46861
  outcome: await confirmableWrite(context, "Take a portable export of this database now. It is downloadable until its expiry.", async () => {
@@ -46495,7 +46871,7 @@ async function create(context, path, rest) {
46495
46871
  }
46496
46872
  /** `database-export-download <env> <export>`: a time-limited URL, which is the customer's copy. */
46497
46873
  async function download(path, rest) {
46498
- const exportUuid = oneUuid$7(rest, USAGE$17);
46874
+ const exportUuid = oneUuid$7(rest, USAGE$18);
46499
46875
  return {
46500
46876
  kind: "download",
46501
46877
  download: (await hostingDatabaseExportDownload({ path: {
@@ -46506,7 +46882,7 @@ async function download(path, rest) {
46506
46882
  }
46507
46883
  /** `database-export-remove <env> <export>`. */
46508
46884
  async function remove$1(context, path, rest) {
46509
- const exportUuid = oneUuid$7(rest, USAGE$17);
46885
+ const exportUuid = oneUuid$7(rest, USAGE$18);
46510
46886
  return {
46511
46887
  kind: "export-write",
46512
46888
  outcome: await confirmableWrite(context, `Retire export ${exportUuid}. Its URL stops working once it is gone.`, async () => (await hostingDatabaseExportDestroy({ path: {
@@ -46517,7 +46893,7 @@ async function remove$1(context, path, rest) {
46517
46893
  }
46518
46894
  /** No positional arguments, or a usage refusal. */
46519
46895
  function noExtra$8(rest) {
46520
- if (rest.length > 0) throw new UsageError(USAGE$17);
46896
+ if (rest.length > 0) throw new UsageError(USAGE$18);
46521
46897
  }
46522
46898
  /** One export as one line. */
46523
46899
  function exportLine(one) {
@@ -46565,6 +46941,7 @@ var ENVIRONMENT_USAGE = [
46565
46941
  " hostingctl environment component-version <uuid> <workload-uuid> <version> --company <slug>",
46566
46942
  " hostingctl environment references <uuid> --company <slug>",
46567
46943
  " hostingctl environment storage-usage <uuid> --company <slug>",
46944
+ " hostingctl environment php-versions --company <slug>",
46568
46945
  "",
46569
46946
  " create Create an environment from a platform package; the platform chooses the placement.",
46570
46947
  " show One environment in detail, including the status the listing does not carry.",
@@ -46589,6 +46966,8 @@ var ENVIRONMENT_USAGE = [
46589
46966
  " in `field`, and a credential field is marked rather than valued.",
46590
46967
  " storage-usage What each volume was allocated, what it has written and what room is left, from the",
46591
46968
  " platform's own reading; a volume it could not read says so instead of reporting zero.",
46969
+ " php-versions The PHP minors each application type offers, which of them may be chosen now, and why the",
46970
+ " others may not.",
46592
46971
  "",
46593
46972
  "The writes (create, reconcile, scale, component-version, object-cache-set, portable prepare/confirm, configuration save/apply,",
46594
46973
  "secret write/import, database create/bind/retire) need --confirm; --dry-run describes the change without making it.",
@@ -46599,6 +46978,36 @@ var ENVIRONMENT_USAGE = [
46599
46978
  "to standard output, and it changes nothing on the platform, so it needs no --confirm."
46600
46979
  ].join("\n");
46601
46980
  //#endregion
46981
+ //#region src/commands/environment-php-versions.ts
46982
+ var USAGE$17 = [
46983
+ "Usage: hostingctl environment php-versions --company <slug>",
46984
+ "",
46985
+ " php-versions The PHP minors each application type offers, which may be chosen now, and why the others",
46986
+ " may not. Reading it changes nothing and names no environment.",
46987
+ "",
46988
+ "A minor listed as not offered is still listed, with the reason the platform gives: a version whose images",
46989
+ "are not published is one a customer will ask about, and hiding it would make the list change silently."
46990
+ ].join("\n");
46991
+ /**
46992
+ * `environment php-versions`: every PHP minor an application type offers, and whether it can be chosen.
46993
+ *
46994
+ * The answer is the API's own catalogue rather than anything derived here — the same one that resolves an
46995
+ * application's minor and the image its manifest is composed from — so a choice shown here is one the platform
46996
+ * will accept, and one reported as unavailable says which image is missing.
46997
+ */
46998
+ async function environmentPhpVersions(context, rest) {
46999
+ if (rest.length > 0) throw new UsageError(USAGE$17);
47000
+ return {
47001
+ kind: "php-versions",
47002
+ types: (await hostingPhpVersionsIndex({ path: { company: await requireCompany(context.flags) } })).data
47003
+ };
47004
+ }
47005
+ /** One line per type, then one per minor it declares, with the availability the API reported. */
47006
+ function phpVersionsText(types) {
47007
+ if (types.length === 0) return "No application type on this platform runs PHP.";
47008
+ return types.flatMap((entry) => [` ${entry.type} default ${entry.default}`, ...entry.versions.map((version) => ` ${version.value} ${version.label} ${version.offered ? "offered" : `not offered: ${version.unavailableReason ?? "no image"}`}`)]).join("\n");
47009
+ }
47010
+ //#endregion
46602
47011
  //#region src/commands/export-file.ts
46603
47012
  /**
46604
47013
  * Write an exported pattern to the path `--out` named.
@@ -47321,23 +47730,23 @@ function list$3(values) {
47321
47730
  var ENVIRONMENT_TOPICS = [
47322
47731
  {
47323
47732
  path: ["retention"],
47324
- usage: USAGE$21
47733
+ usage: USAGE$22
47325
47734
  },
47326
47735
  {
47327
47736
  path: ["retention-set"],
47328
- usage: USAGE$21
47737
+ usage: USAGE$22
47329
47738
  },
47330
47739
  {
47331
47740
  path: ["database-show"],
47332
- usage: USAGE$21
47741
+ usage: USAGE$22
47333
47742
  },
47334
47743
  {
47335
47744
  path: ["database-reveal"],
47336
- usage: USAGE$21
47745
+ usage: USAGE$22
47337
47746
  },
47338
47747
  {
47339
47748
  path: ["tuning"],
47340
- usage: USAGE$21
47749
+ usage: USAGE$22
47341
47750
  },
47342
47751
  {
47343
47752
  path: ["configuration"],
@@ -47361,63 +47770,63 @@ var ENVIRONMENT_TOPICS = [
47361
47770
  },
47362
47771
  {
47363
47772
  path: ["domains"],
47364
- usage: USAGE$18
47773
+ usage: USAGE$19
47365
47774
  },
47366
47775
  {
47367
47776
  path: ["domain-add"],
47368
- usage: USAGE$18
47777
+ usage: USAGE$19
47369
47778
  },
47370
47779
  {
47371
47780
  path: ["domain-verify"],
47372
- usage: USAGE$18
47781
+ usage: USAGE$19
47373
47782
  },
47374
47783
  {
47375
47784
  path: ["domain-check-routing"],
47376
- usage: USAGE$18
47785
+ usage: USAGE$19
47377
47786
  },
47378
47787
  {
47379
47788
  path: ["domain-intended"],
47380
- usage: USAGE$18
47789
+ usage: USAGE$19
47381
47790
  },
47382
47791
  {
47383
47792
  path: ["domain-primary"],
47384
- usage: USAGE$18
47793
+ usage: USAGE$19
47385
47794
  },
47386
47795
  {
47387
47796
  path: ["domain-remove"],
47388
- usage: USAGE$18
47797
+ usage: USAGE$19
47389
47798
  },
47390
47799
  {
47391
47800
  path: ["redirects"],
47392
- usage: USAGE$18
47801
+ usage: USAGE$19
47393
47802
  },
47394
47803
  {
47395
47804
  path: ["redirect-set"],
47396
- usage: USAGE$18
47805
+ usage: USAGE$19
47397
47806
  },
47398
47807
  {
47399
47808
  path: ["redirect-remove"],
47400
- usage: USAGE$18
47809
+ usage: USAGE$19
47401
47810
  },
47402
47811
  {
47403
47812
  path: ["database-exports"],
47404
- usage: USAGE$17
47813
+ usage: USAGE$18
47405
47814
  },
47406
47815
  {
47407
47816
  path: ["database-export-create"],
47408
- usage: USAGE$17
47817
+ usage: USAGE$18
47409
47818
  },
47410
47819
  {
47411
47820
  path: ["database-export-download"],
47412
- usage: USAGE$17
47821
+ usage: USAGE$18
47413
47822
  },
47414
47823
  {
47415
47824
  path: ["database-export-remove"],
47416
- usage: USAGE$17
47825
+ usage: USAGE$18
47417
47826
  },
47418
47827
  {
47419
47828
  path: ["release-bundle"],
47420
- usage: USAGE$17
47829
+ usage: USAGE$18
47421
47830
  },
47422
47831
  {
47423
47832
  path: ["service-add-review"],
@@ -47490,6 +47899,10 @@ var ENVIRONMENT_TOPICS = [
47490
47899
  {
47491
47900
  path: ["tools"],
47492
47901
  usage: USAGE$13
47902
+ },
47903
+ {
47904
+ path: ["php-versions"],
47905
+ usage: USAGE$17
47493
47906
  }
47494
47907
  ];
47495
47908
  //#endregion
@@ -47736,6 +48149,7 @@ var ENVIRONMENT_METADATA = {
47736
48149
  "component-version",
47737
48150
  "references",
47738
48151
  "storage-usage",
48152
+ "php-versions",
47739
48153
  "retention",
47740
48154
  "retention-set",
47741
48155
  "database-show",
@@ -47878,10 +48292,24 @@ function describeScale(environment, body) {
47878
48292
  const changes = environment.workloads.map((workload, index) => {
47879
48293
  const before = resourcesLine(workload.resources);
47880
48294
  const after = resourcesLine(body.workloads[index]?.resources ?? workload.resources);
47881
- return ` ${workload.name} ${before} → ${after}${before === after ? " (unchanged)" : ""}`;
48295
+ return ` ${workload.name} ${before} → ${after}${before === after ? " (unchanged)" : ""}${phpNote(workload.phpMinor, workload.phpMinorEffective)}`;
47882
48296
  });
47883
48297
  return [`Scale ${environment.name} (generation ${String(environment.desiredGeneration)}):`, ...changes].join("\n");
47884
48298
  }
48299
+ /**
48300
+ * The PHP minor a scale carries across unchanged, named only where its type runs PHP.
48301
+ *
48302
+ * A scale sends the whole desired state without a `phpMinor`, which the API reads as "unchanged"; saying so in the
48303
+ * preview is what stops a resource change from looking like it might move the interpreter.
48304
+ */
48305
+ function phpNote(chosenMinor, servingMinor) {
48306
+ const chosen = chosenMinor ?? null;
48307
+ const serving = servingMinor ?? null;
48308
+ if (chosen === null && serving === null) return "";
48309
+ if (chosen === null) return ` php ${serving ?? ""} (unchanged)`;
48310
+ if (serving === null || serving === chosen) return ` php ${chosen} (unchanged)`;
48311
+ return ` php ${chosen} requested, ${serving} serving (unchanged)`;
48312
+ }
47885
48313
  /** One workload's request and limit for both resources, so a preview shows what actually goes out. */
47886
48314
  function resourcesLine(resources) {
47887
48315
  return `cpu ${String(resources.cpuRequestMillicores)}m request / ${String(resources.cpuLimitMillicores)}m limit mem ${String(resources.memoryRequestMib)}MiB request / ${String(resources.memoryLimitMib)}MiB limit`;
@@ -48127,6 +48555,7 @@ function referenceOrUsageText(report) {
48127
48555
  }
48128
48556
  /** The tagged answers. A cache change carries an outcome rather than a payload, so it renders as a write. */
48129
48557
  function taggedReportText(report) {
48558
+ if (report.kind === "php-versions") return phpVersionsText(report.types);
48130
48559
  if (report.kind === "cache-write") return renderWriteOutcome(report.outcome, outcomeOf$1);
48131
48560
  if (report.kind === "object-cache") return objectCacheText(report.settings);
48132
48561
  if (report.kind === "object-cache-write") return renderWriteOutcome(report.outcome, objectCacheText);
@@ -54152,9 +54581,18 @@ var billingDeliveryStateEnumSchema = _enum([
54152
54581
  "sent",
54153
54582
  "failed"
54154
54583
  ]).describe("What we know about sending the document. The mail transport can prove submission, not mailbox delivery, so `sent` means \"the transport * accepted it for the billing contact\". A failed or missing contact never un-issues the document.\n");
54155
- var dataCollectionSchema = array(unknown());
54156
- object({ items: dataCollectionSchema });
54157
54584
  var billingProductEnumSchema = _enum(["MHU", "MHS"]).describe("The two tariff lines the accountant's documents define. `MHU` is the recurring managed hosting unit; `MHS` is the one-off managed hosting setup. They are our product codes, not package keys: a package says what an environment holds, a product says what it is billed as.\n");
54585
+ var billingDiscountCodeRedemptionDataSchema = object({
54586
+ state: _enum(["pending", "applied"]).describe("Whether a redeemed code has priced the account yet. A code can be redeemed before the account holds anything to price: a client types it while creating their account, and a brand-new company has no environment, so no purchase period, so nothing a price window could name. `pending` is that state — the promise exists and is spent, and the first environment the client creates prices it. `applied` is a redemption that already wrote the company's price window. The distinction is a fact about the record, not a workflow step a caller advances by hand: only the environment creation path moves a redemption from `pending` to `applied`, in the transaction that opens the period.\n| |\n|---|\n| `pending` <br/> Redeemed, and waiting for the account to hold a package that can be priced. |\n| `applied` <br/> Redeemed, and the company's own price window carries the code's amount. |").describe("Whether a redeemed code has priced the account yet. A code can be redeemed before the account holds anything to price: a client types it while creating their account, and a brand-new company has no environment, so no purchase period, so nothing a price window could name. `pending` is that state — the promise exists and is spent, and the first environment the client creates prices it. `applied` is a redemption that already wrote the company's price window. The distinction is a fact about the record, not a workflow step a caller advances by hand: only the environment creation path moves a redemption from `pending` to `applied`, in the transaction that opens the period.\n| |\n|---|\n| `pending` <br/> Redeemed, and waiting for the account to hold a package that can be priced. |\n| `applied` <br/> Redeemed, and the company's own price window carries the code's amount. |"),
54587
+ code: string(),
54588
+ companySlug: string(),
54589
+ amountCents: int(),
54590
+ currency: string(),
54591
+ effectiveFrom: string().nullable(),
54592
+ effectiveUntil: string().nullable(),
54593
+ redeemedAt: string(),
54594
+ redeemedBy: union([billingActorDataSchema, _null()])
54595
+ });
54158
54596
  var billingDiscountCodeDataSchema = object({
54159
54597
  id: int(),
54160
54598
  uuid: string(),
@@ -54165,22 +54603,14 @@ var billingDiscountCodeDataSchema = object({
54165
54603
  currency: string(),
54166
54604
  durationMonths: int().nullable(),
54167
54605
  expiresAt: string().nullable(),
54606
+ endedAt: string().nullable(),
54168
54607
  maxRedemptions: int(),
54169
54608
  redeemedCount: int(),
54170
54609
  companySlug: string().nullable(),
54171
54610
  createdBy: union([billingActorDataSchema, _null()]),
54172
- redemptions: union([dataCollectionSchema, _null()])
54173
- });
54174
- object({
54175
- code: string(),
54176
- companySlug: string(),
54177
- amountCents: int(),
54178
- currency: string(),
54179
- effectiveFrom: string(),
54180
- effectiveUntil: string().nullable(),
54181
- redeemedAt: string(),
54182
- redeemedBy: union([billingActorDataSchema, _null()])
54611
+ redemptions: array(billingDiscountCodeRedemptionDataSchema).nullable().describe("Every activation, newest first: who spent it, for which company, and the window it produced. Null when the\ncaller did not ask for the report, which is what a redemption's own answer does.")
54183
54612
  });
54613
+ object({ items: array(billingDiscountCodeDataSchema) });
54184
54614
  object({
54185
54615
  grant: string(),
54186
54616
  documentUuid: string(),
@@ -54748,6 +55178,11 @@ var confirmHostingApplicationRecoveryRequestSchema = object({
54748
55178
  desiredGeneration: int().min(0),
54749
55179
  targetVersion: string().max(64).nullish(),
54750
55180
  intake: object({
55181
+ companyName: string().max(191).describe("The identity the review echoes back. `HostingRestoreIntakeRequestData` declares these non-nullable,\nso a body without them reached `Data::from()` and answered 500 (measured 2026-10-27) instead of\nrefusing the request. `format` is also what classifies a physical recovery, so it cannot be absent."),
55182
+ environmentUuid: string().max(64).describe("Strings, not `uuid`: the DTO declares them as strings, and the route already carries the identifiers\nthat authorize this operation. The rule exists so a missing field is a field error, not a server error."),
55183
+ applicationUuid: string().max(64),
55184
+ applicationName: string().max(191),
55185
+ format: string().max(64),
54751
55186
  action: _enum(["restore", "reset"]),
54752
55187
  sourceVersion: string().max(64).nullish(),
54753
55188
  phpVersion: string().max(16).nullish(),
@@ -54854,6 +55289,7 @@ var createHostingApplicationRequestSchema = object({
54854
55289
  memoryLimitMib: int().min(1)
54855
55290
  }),
54856
55291
  intendedHostname: string().max(253).nullish(),
55292
+ phpMinor: string().max(8).nullish().describe("The PHP minor this new application is built and served on, or absent for its recipe's\ndefault. Which minors a recipe offers, and whether the images behind one are published,\nis refused by the catalogue and the tuning validation, by name."),
54857
55293
  desiredGeneration: int().min(0)
54858
55294
  }).describe("Adding one application to an environment that already exists.\n\n`type` is checked against the application types here, so a request that names the database\nserver or the cache is refused as an unknown application rather than travelling to a service\nthat would have to explain why infrastructure is not an application. Everything that compares\nthe new row with the environment's purchase, its existing rows or its volumes belongs to\n`HostingResourceService`, because a static rule cannot see the environment.\n\n`desiredGeneration` is required: adding an application changes the environment, so the\ncustomer states which version of it they reviewed, and a stale one is a conflict rather than\na second application.");
54859
55295
  var hostingRouteRewriteEnumSchema = _enum(["none", "strip"]).describe("How a path route presents its path to the application it routes to. `NONE` is the platform default: the application is served under the route's base path and is told it, because `BASE_PATH` is composed from the instance's canonical address. That is the right answer for an application that honours a base path, and it is what every route does until a customer chooses otherwise. `STRIP` removes the route's own path before the request reaches the application, for an application that cannot be configured with one: a route at `/learn` then answers as if it were served at the host root, so `/learn/foo` arrives as `/foo`. The instance is told no base path, because the paths it receives do not carry one. The customer chooses, because only they know whether their application can be configured for a base path. Neither answer is wrong, and the trade is stated where the choice is offered rather than guessed here: stripping is for an application that cannot be told, and telling it is what keeps its own absolute URLs, redirects and assets correct when it can.\n");
@@ -54937,6 +55373,7 @@ var createHostingEnvironmentRequestSchema = object({
54937
55373
  type: string(),
54938
55374
  name: string().max(100),
54939
55375
  webServer: string().max(32).nullish(),
55376
+ phpMinor: string().max(8).nullish(),
54940
55377
  serverMode: hostingWorkloadServerModeEnumSchema.optional().describe("Whether a workload's database server is shared with the rest of its engine, or bought for it alone. An environment runs ONE server per engine, and every database of that engine binds to it. That is the purchase's shape: one server's memory and CPU serve every application on the engine. A second same-engine server splits that purchase between two Pods that each must still clear the engine's own floor — measured on Home 2026-10-19, where such a split left an engine 512Mi and it was OOM-killed on every boot. A second server is therefore a **client capability request** and never a side effect of declaring a workload. `DEDICATED` is that request: the workload pays its own floor out of the environment's budget, and the reconciler binds the databases to it by name rather than by engine. `SHARED` is every workload that did not ask. This is a named mode rather than a boolean because the same field may grow a third value (for example a replica-bearing server) without reinterpreting two call sites.\n| |\n|---|\n| `shared` <br/> The environment's existing server for this engine serves this workload's databases. |\n| `dedicated` <br/> The client asked for a server of this engine for this workload alone. |"),
54941
55378
  replicas: int().min(1),
54942
55379
  resources: object({
@@ -55033,6 +55470,7 @@ var createHostingServiceRequestSchema = object({
55033
55470
  desiredGeneration: int().min(0)
55034
55471
  }).describe("Adding one shared service to an environment that already exists.\n\n`type` is checked against the same list the cardinality owner decides, so a request cannot name a\ntype this product would never admit as a service, and the application types are refused here\nrather than travelling to a service that would have to explain why an application is not one.\nEverything that compares the new row with the environment's purchase, its existing rows or its\nvolume set belongs to the admission owners, because a static rule cannot see the environment.\n\n`desiredGeneration` is required: adding a service changes the environment, so the customer states\nwhich version of it they reviewed, and a stale one is a conflict rather than a second server.");
55035
55472
  var creditBillingInvoiceRequestSchema = object({ reason: string().min(3).max(255) }).describe("A full credit note for one issued invoice.\n\nThe reason is required because s21 makes it part of the document: a credit note must say why it\ncorrects the invoice it names, and a later reader has no other way to know. It is bounded to the\ncolumn's own width rather than truncated silently after the number has been spent.");
55473
+ var dataCollectionSchema = array(unknown());
55036
55474
  var deleteHostingCancellationNowRequestSchema = object({
55037
55475
  reviewGeneration: int().min(1),
55038
55476
  deletionAcknowledged: boolean().describe("`boolean` rather than `accepted`, for the reason recorded on\nCreateHostingCancellationRequest: the accepted rule's value set is inferred into the\ngenerated client as an enum OpenAPI cannot express. \"Must be true\" is enforced by\nDeleteHostingCancellationNowData, which cannot produce the recorded sentence otherwise.")
@@ -56229,6 +56667,9 @@ object({
56229
56667
  generatedHostnames: array(string()),
56230
56668
  webServer: string().nullable(),
56231
56669
  webServerEffective: string().nullable(),
56670
+ phpMinor: string().nullable().describe("The PHP minor the customer chose, or null when the application follows its type's default."),
56671
+ phpMinorDesired: string().nullable().describe("The PHP minor the application asks for, resolved; null when its type runs no PHP."),
56672
+ phpMinorEffective: string().nullable().describe("The PHP minor actually serving it; null when its type runs no PHP."),
56232
56673
  replicas: int(),
56233
56674
  stoppedAt: string().nullable(),
56234
56675
  runtimeRevision: int().nullable(),
@@ -56282,6 +56723,9 @@ var hostingApplicationSummaryDataSchema = object({
56282
56723
  hostname: string().nullable(),
56283
56724
  webServer: string().nullable(),
56284
56725
  webServerEffective: string().nullable(),
56726
+ phpMinor: string().nullable().describe("The PHP minor the customer chose, or null when the application follows its type's default."),
56727
+ phpMinorDesired: string().nullable().describe("The PHP minor the application asks for, resolved; null when its type runs no PHP."),
56728
+ phpMinorEffective: string().nullable().describe("The PHP minor actually serving it; null when its type runs no PHP."),
56285
56729
  replicas: int(),
56286
56730
  database: union([hostingDatabaseDataSchema, _null()])
56287
56731
  });
@@ -56680,14 +57124,15 @@ object({
56680
57124
  var hostingCacheRuleActionEnumSchema = _enum([
56681
57125
  "bypass",
56682
57126
  "respect_origin",
56683
- "public_assets"
56684
- ]).describe("What one ordered cache rule does to a matching request. `RESPECT_ORIGIN` is the default: the platform's freshness cap bounds the origin's own policy and never lengthens it. `PUBLIC_ASSETS` may supply a missing policy, but only for an explicitly opted-in path and an approved static response type, and never over a restrictive origin response. `BYPASS` sends the request to the origin untouched. The case names are the stored values, so a rule's action is a declared value rather than a string some caller has to remember.\n");
57127
+ "public_assets",
57128
+ "public_pages"
57129
+ ]).describe("What one ordered cache rule does to a matching request. `RESPECT_ORIGIN` bounds the origin's own policy and never lengthens it. `PUBLIC_ASSETS` may supply a missing policy for an approved static response type; it also declares the path public enough that a visitor's cookie is ignored. `PUBLIC_PAGES` may supply a missing policy for an anonymous HTML page, and deliberately does NOT ignore a cookie — a cookie is exactly how WordPress marks a visitor who has signed in, added to a cart or started a session. `BYPASS` sends the request to the origin untouched. Two separate questions are asked below rather than one, because conflating them is how a page cache starts serving one visitor's session to another. The case names are the stored values, so a rule's action is a declared value rather than a string some caller has to remember.\n");
56685
57130
  var hostingCacheRuleMatchEnumSchema = _enum(["exact", "prefix"]).describe("How a rule's path is matched against the request path. `EXACT` matches one path and nothing below it. `PREFIX` matches the path at a segment boundary, so `/media` matches `/media/x.css` but never `/mediaeval`. The rule always matches the path alone; the query string and Host stay in the cache key. There is deliberately no regular-expression case: a customer expression language is not a boundary we can validate, and the two shapes above cover the reviewed use.\n");
56686
57131
  var hostingCacheRuleDataSchema = object({
56687
57132
  label: string(),
56688
57133
  match: hostingCacheRuleMatchEnumSchema.describe("How a rule's path is matched against the request path. `EXACT` matches one path and nothing below it. `PREFIX` matches the path at a segment boundary, so `/media` matches `/media/x.css` but never `/mediaeval`. The rule always matches the path alone; the query string and Host stay in the cache key. There is deliberately no regular-expression case: a customer expression language is not a boundary we can validate, and the two shapes above cover the reviewed use.\n"),
56689
57134
  path: string(),
56690
- action: hostingCacheRuleActionEnumSchema.describe("What one ordered cache rule does to a matching request. `RESPECT_ORIGIN` is the default: the platform's freshness cap bounds the origin's own policy and never lengthens it. `PUBLIC_ASSETS` may supply a missing policy, but only for an explicitly opted-in path and an approved static response type, and never over a restrictive origin response. `BYPASS` sends the request to the origin untouched. The case names are the stored values, so a rule's action is a declared value rather than a string some caller has to remember.\n"),
57135
+ action: hostingCacheRuleActionEnumSchema.describe("What one ordered cache rule does to a matching request. `RESPECT_ORIGIN` bounds the origin's own policy and never lengthens it. `PUBLIC_ASSETS` may supply a missing policy for an approved static response type; it also declares the path public enough that a visitor's cookie is ignored. `PUBLIC_PAGES` may supply a missing policy for an anonymous HTML page, and deliberately does NOT ignore a cookie — a cookie is exactly how WordPress marks a visitor who has signed in, added to a cart or started a session. `BYPASS` sends the request to the origin untouched. Two separate questions are asked below rather than one, because conflating them is how a page cache starts serving one visitor's session to another. The case names are the stored values, so a rule's action is a declared value rather than a string some caller has to remember.\n"),
56691
57136
  enabled: boolean(),
56692
57137
  hostname: string().nullable(),
56693
57138
  freshSeconds: int(),
@@ -56803,6 +57248,7 @@ var hostingClusterDataSchema = object({
56803
57248
  name: string(),
56804
57249
  baseDomain: string()
56805
57250
  });
57251
+ object({ anonymousKey: string() });
56806
57252
  object({
56807
57253
  schemas: array(string()),
56808
57254
  auth: union([hostingAuthSettingsDataSchema, _null()])
@@ -56875,7 +57321,8 @@ var hostingConfigurationApplicationDataSchema = object({
56875
57321
  cron: array(hostingConfigurationScheduleDataSchema),
56876
57322
  release: union([hostingConfigurationReleaseDataSchema, _null()]),
56877
57323
  reverb: union([hostingReverbProcessDataSchema, _null()]),
56878
- cache: union([hostingConfigurationCacheDataSchema, _null()])
57324
+ cache: union([hostingConfigurationCacheDataSchema, _null()]),
57325
+ phpMinor: string().nullable()
56879
57326
  });
56880
57327
  var hostingConfigurationApplicationPreviewDataSchema = object({
56881
57328
  key: string(),
@@ -57341,6 +57788,8 @@ var hostingWorkloadDataSchema = object({
57341
57788
  tuning: hostingWorkloadTuningDataSchema,
57342
57789
  webServer: string().nullable().describe("The web server the customer chose, or null when the application follows the platform\ndefault. Exposed beside `webServerEffective` so a screen can say which one is running\nand why, rather than implying the choice from a value it derived itself."),
57343
57790
  webServerEffective: string().nullable().describe("What this application actually runs: the choice, or the platform default."),
57791
+ phpMinor: string().nullable().describe("The PHP minor the customer chose, or null when the application follows its type's default.\nReported beside `phpMinorEffective` for the same reason the web server pair is: a screen\nsays which minor is running rather than deriving it from a value it guessed."),
57792
+ phpMinorEffective: string().nullable().describe("What this application actually runs: the choice, or its type's default; null when the type runs no PHP."),
57344
57793
  bounds: hostingWorkloadBoundsDataSchema,
57345
57794
  runtime: union([hostingWorkloadRuntimeDataSchema, _null()]),
57346
57795
  address: union([hostingApplicationAddressDataSchema, _null()]),
@@ -57640,6 +58089,17 @@ object({
57640
58089
  items: array(hostingPersonalKeyDataSchema),
57641
58090
  meta: pageMetaDataSchema
57642
58091
  });
58092
+ var hostingPhpVersionOptionDataSchema = object({
58093
+ value: string(),
58094
+ label: string(),
58095
+ offered: boolean(),
58096
+ unavailableReason: string().nullable()
58097
+ });
58098
+ object({
58099
+ type: string(),
58100
+ default: string(),
58101
+ versions: array(hostingPhpVersionOptionDataSchema)
58102
+ });
57643
58103
  var hostingProcessRunDataSchema = object({
57644
58104
  name: string(),
57645
58105
  kind: string(),
@@ -58928,7 +59388,8 @@ object({
58928
59388
  });
58929
59389
  object({
58930
59390
  name: string().max(255),
58931
- slug: string().max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/)
59391
+ slug: string().max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),
59392
+ discountCode: string().max(64).nullish().describe("Optional, because most accounts are created without one. A wrong or unusable code refuses by\nthis field and creates no company, which is what lets the client correct it and try again.")
58932
59393
  });
58933
59394
  var storeDnsRecordSetRequestSchema = object({
58934
59395
  relativeName: string().max(253),
@@ -59182,7 +59643,8 @@ var updateHostingApplicationCacheRequestSchema = object({
59182
59643
  action: _enum([
59183
59644
  "bypass",
59184
59645
  "respect_origin",
59185
- "public_assets"
59646
+ "public_assets",
59647
+ "public_pages"
59186
59648
  ]),
59187
59649
  enabled: boolean().optional(),
59188
59650
  hostname: string().max(255).nullish(),
@@ -59216,6 +59678,7 @@ var updateHostingEnvironmentRequestSchema = object({
59216
59678
  type: string(),
59217
59679
  name: string().max(100),
59218
59680
  webServer: string().max(32).nullish(),
59681
+ phpMinor: string().max(8).nullish(),
59219
59682
  replicas: int().min(1),
59220
59683
  resources: object({
59221
59684
  cpuRequestMillicores: int().min(1),
@@ -59443,7 +59906,7 @@ union([object({ message: string().describe("Error overview.") }), object({ messa
59443
59906
  union([
59444
59907
  object({ message: string().describe("Error overview.") }),
59445
59908
  object({ message: string().describe("Error overview.") }),
59446
- string()
59909
+ messageDataSchema
59447
59910
  ]);
59448
59911
  union([
59449
59912
  object({ message: string().describe("Error overview.") }),
@@ -59467,7 +59930,7 @@ union([object({ message: string().describe("Error overview.") }), object({ messa
59467
59930
  union([
59468
59931
  object({ message: string().describe("Error overview.") }),
59469
59932
  object({ message: string().describe("Error overview.") }),
59470
- string()
59933
+ messageDataSchema
59471
59934
  ]);
59472
59935
  union([
59473
59936
  object({ message: string().describe("Error overview.") }),
@@ -60590,6 +61053,12 @@ union([
60590
61053
  messageDataSchema
60591
61054
  ]);
60592
61055
  reconfirmHostingDeletionRequestSchema.describe("Confirming that the scope a deletion would remove now is the one to remove.\n\nThe approved scope is refused by the teardown once the environment has changed, and the refusal is\nrecorded rather than repaired, because repairing it silently would delete something nobody agreed to.\nThis is the client's answer: the same shape as the delete-now confirmation so a client that can send\none can send the other, with its own sentence, because agreeing to a scope that grew is not the same\nstatement as agreeing to delete now.");
61056
+ union([
61057
+ object({ message: string().describe("Error overview.") }),
61058
+ object({ message: string().describe("Error overview.") }),
61059
+ object({ message: string().describe("Error overview.") }),
61060
+ object({ message: string().describe("Error overview.").meta({ examples: ["The component public key has not been provisioned."] }) })
61061
+ ]);
60593
61062
  union([
60594
61063
  object({ message: string().describe("Error overview.") }),
60595
61064
  object({ message: string().describe("Error overview.") }),
@@ -60982,6 +61451,7 @@ union([hostingPersonalKeyStoreStatus200Schema, hostingPersonalKeyStoreStatus201S
60982
61451
  union([hostingPersonalKeyStoreStatus401Schema, hostingPersonalKeyStoreStatus422Schema]);
60983
61452
  createHostingPersonalKeyRequestSchema.describe("Adding one key to the caller's own library.\n\n`currentPassword` is required, and it is the account password rather than\nanything to do with the key. Adding a key is not a private profile edit once\ngrants exist: it applies to every environment the person was granted, which is\na global expansion of their access. Requiring the password is what stops a\nborrowed session from doing it quietly.\n\nThe form never accepts a private key, and it never accepts options: both are\nrefused with a reason by the shared public-key parser, so the message is a field\nerror rather than a silent rewrite of what the key may do.");
60984
61453
  union([object({ message: string().describe("Error overview.") }), messageDataSchema]);
61454
+ union([object({ message: string().describe("Error overview.") }), object({ message: string().describe("Error overview.") })]);
60985
61455
  union([
60986
61456
  object({ message: string().describe("Error overview.") }),
60987
61457
  object({ message: string().describe("Error overview.") }),
@@ -61543,7 +62013,7 @@ union([
61543
62013
  updatePlatformAlertSettingsRequestSchema.describe("The desired-enabled change to platform alerting.\n\nOne required boolean, because that is the whole settings surface. The service owns the rules that\ndecide whether the change is allowed; the route's `can:` middleware owns permission.");
61544
62014
  union([object({ message: string().describe("Error overview.") }), object({ message: string().describe("Error overview.") })]);
61545
62015
  var platformBillingDiscountStoreStatus200Schema = billingDiscountCodeDataSchema;
61546
- var platformBillingDiscountStoreStatus201Schema = string();
62016
+ var platformBillingDiscountStoreStatus201Schema = billingDiscountCodeDataSchema;
61547
62017
  var platformBillingDiscountStoreStatus401Schema = object({ message: string().describe("Error overview.") });
61548
62018
  var platformBillingDiscountStoreStatus403Schema = object({ message: string().describe("Error overview.") });
61549
62019
  var platformBillingDiscountStoreStatus422Schema = messageDataSchema;
@@ -61554,6 +62024,11 @@ union([
61554
62024
  platformBillingDiscountStoreStatus422Schema
61555
62025
  ]);
61556
62026
  storeBillingDiscountCodeRequestSchema.describe("Issuing one discount code.\n\n`amountCents` is the price the code grants, exclusive of VAT, and it is required: a code whose effect nobody can\npredict is not a promise. The code itself is optional — an operator who names one owns its spelling, and one that\nis omitted is generated unguessable and unambiguous to read aloud.");
62027
+ union([
62028
+ object({ message: string().describe("Error overview.") }),
62029
+ object({ message: string().describe("Error overview.") }),
62030
+ messageDataSchema
62031
+ ]);
61557
62032
  union([object({ message: string().describe("Error overview.") }), object({ message: string().describe("Error overview.") })]);
61558
62033
  union([
61559
62034
  object({ message: string().describe("Error overview.") }),
@@ -62230,7 +62705,8 @@ var SIMPLE_SUBCOMMANDS = {
62230
62705
  configuration,
62231
62706
  secret,
62232
62707
  databases,
62233
- database
62708
+ database,
62709
+ "php-versions": environmentPhpVersions
62234
62710
  };
62235
62711
  /** Which feature group answers this subcommand and arguments, or null when the command itself does. */
62236
62712
  function dispatched(context, subcommand, rest) {
@@ -67252,7 +67728,7 @@ function writeUpdateState(state, env = process.env) {
67252
67728
  }
67253
67729
  //#endregion
67254
67730
  //#region src/version.ts
67255
- var VERSION = "1.0.412";
67731
+ var VERSION = "1.0.521";
67256
67732
  //#endregion
67257
67733
  //#region src/commands/update.ts
67258
67734
  /**
@@ -67327,7 +67803,7 @@ var update = {
67327
67803
  }, process.env);
67328
67804
  return {
67329
67805
  ...known,
67330
- current: after ?? "1.0.412",
67806
+ current: after ?? "1.0.521",
67331
67807
  latest: after ?? latest,
67332
67808
  upToDate: after !== null && (latest === null || !isNewerVersion(latest, after)),
67333
67809
  action: "run",
@@ -67603,7 +68079,7 @@ async function printUpdateNotice(options) {
67603
68079
  }, env, { waitMs: NOTICE_LOCK_WAIT_MS });
67604
68080
  } catch {}
67605
68081
  if (latest === null) return;
67606
- if (!isNewerVersion(latest, "1.0.412")) return;
68082
+ if (!isNewerVersion(latest, "1.0.521")) return;
67607
68083
  process.stderr.write(`A newer hostingctl is published: ${latest} (this copy is ${VERSION}). Run \`hostingctl update\` to update.\n`);
67608
68084
  }
67609
68085
  /** Whether an environment variable is set to something, which is how CI and the opt-out are read. */