@haakco/hostingctl 1.0.409 → 1.0.412

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
@@ -27992,8 +27992,9 @@ function createTransport(target) {
27992
27992
  }
27993
27993
  }
27994
27994
  if (!response.ok) throw responseError(response.status, await response.json().catch(() => null), response.headers.get("X-Request-Id"));
27995
+ const contentType = response.headers.get("content-type") ?? "";
27995
27996
  return {
27996
- data: response.status === 204 ? void 0 : await response.json(),
27997
+ data: response.status === 204 ? void 0 : contentType.includes("json") ? await response.json() : await response.blob(),
27997
27998
  status: response.status,
27998
27999
  statusText: response.statusText,
27999
28000
  headers: response.headers,
@@ -28004,6 +28005,31 @@ function createTransport(target) {
28004
28005
  }
28005
28006
  /** The target the current command was configured with, so a call that legitimately takes minutes can borrow a budget. */
28006
28007
  var activeTarget = null;
28008
+ /**
28009
+ * Fetch a signed download link the API handed out, as bytes.
28010
+ *
28011
+ * A signed link is a capability: it is already complete, so it is sent as given rather than resolved against the base
28012
+ * URL, and it may only be this API's own address — a link naming another origin would carry the bearer to a host a
28013
+ * response chose. The bearer and the one silent renewal come from the same transport as every other call.
28014
+ */
28015
+ async function fetchSignedLink(link, apiPath) {
28016
+ if (activeTarget === null) throw new ApiError(0, "No API target was configured.");
28017
+ const base = new URL(activeTarget.baseURL);
28018
+ let target;
28019
+ try {
28020
+ target = new URL(link);
28021
+ } catch {
28022
+ throw new ApiError(0, "The API offered a download link that is not a URL.");
28023
+ }
28024
+ if (target.origin !== base.origin || target.pathname !== `${base.pathname}${apiPath}`) throw new ApiError(0, "The API offered a download link for something else; it was not followed.");
28025
+ const answer = await createTransport(activeTarget)({
28026
+ method: "GET",
28027
+ url: target.href,
28028
+ headers: {}
28029
+ });
28030
+ if (!(answer.data instanceof Blob)) throw new ApiError(0, "The download answered with something other than a file.");
28031
+ return answer.data;
28032
+ }
28007
28033
  /** Point the generated client at one target. Called once, before any command runs. */
28008
28034
  function configureApi(target) {
28009
28035
  activeTarget = target;
@@ -33294,6 +33320,40 @@ function hostingEnvironmentDeletionProtectionStore(options) {
33294
33320
  }));
33295
33321
  }
33296
33322
  /**
33323
+ * {@link /c/:company/hosting/environments/:environmentUuid/object-cache}
33324
+ */
33325
+ function hostingEnvironmentObjectCacheShow(options) {
33326
+ const { client: request = client, ...config } = options;
33327
+ return withUnwrap(request({
33328
+ method: "GET",
33329
+ url: "/c/{company}/hosting/environments/{environmentUuid}/object-cache",
33330
+ security: [{
33331
+ type: "http",
33332
+ scheme: "bearer"
33333
+ }],
33334
+ ...config,
33335
+ throwOnError: config.throwOnError ?? true
33336
+ }));
33337
+ }
33338
+ /**
33339
+ * @summary 200 rather than 201: this records desired state on an environment that already exists, and the
33340
+ * reconciler — not this call — makes the drop-in reach a running Pod
33341
+ * {@link /c/:company/hosting/environments/:environmentUuid/object-cache}
33342
+ */
33343
+ function hostingEnvironmentObjectCacheUpdate(options) {
33344
+ const { client: request = client, ...config } = options;
33345
+ return withUnwrap(request({
33346
+ method: "PUT",
33347
+ url: "/c/{company}/hosting/environments/{environmentUuid}/object-cache",
33348
+ security: [{
33349
+ type: "http",
33350
+ scheme: "bearer"
33351
+ }],
33352
+ ...config,
33353
+ throwOnError: config.throwOnError ?? true
33354
+ }));
33355
+ }
33356
+ /**
33297
33357
  * {@link /c/:company/hosting/environment-packages}
33298
33358
  */
33299
33359
  function hostingEnvironmentPackagesIndex(options) {
@@ -35120,26 +35180,6 @@ function platformBillingExportShow(options) {
35120
35180
  }));
35121
35181
  }
35122
35182
  /**
35123
- * @description The URL carries a Laravel signature naming this export and a purpose claim, both checked before
35124
- * the row is read. Nothing here reveals where the pack is stored, and an expired pack answers
35125
- * `410`: its bytes are gone and only the disposable artefact was ever deleted.
35126
- * @summary Stream one pack as an attachment, through the link `show` handed out
35127
- * {@link /platform/billing/exports/:exportUuid/download}
35128
- */
35129
- function platformBillingExportsDownload(options) {
35130
- const { client: request = client, ...config } = options;
35131
- return withUnwrap(request({
35132
- method: "GET",
35133
- url: "/platform/billing/exports/{exportUuid}/download",
35134
- security: [{
35135
- type: "http",
35136
- scheme: "bearer"
35137
- }],
35138
- ...config,
35139
- throwOnError: config.throwOnError ?? true
35140
- }));
35141
- }
35142
- /**
35143
35183
  * @summary Every saved profile, so an operator can see exactly what the next month will reuse
35144
35184
  * {@link /platform/billing/export-profiles}
35145
35185
  */
@@ -39911,7 +39951,7 @@ async function scheduleAction(context, action, path, extra) {
39911
39951
  //#region src/commands/application-text.ts
39912
39952
  /** The `application` group's human rendering, each answer read from the API's own payload. */
39913
39953
  /** Each group tags its own answers, so the kind names the renderer. */
39914
- function taggedText$2(report) {
39954
+ function taggedText$1(report) {
39915
39955
  if (report.kind === "updates" || report.kind === "updates-write") return applicationUpdatesText(report);
39916
39956
  if (report.kind === "cache" || report.kind === "routes" || report.kind === "cache-write") return applicationCacheText(report);
39917
39957
  if (report.kind === "build-log" || report.kind === "build-write") return applicationBuildText(report);
@@ -39923,7 +39963,7 @@ function taggedText$2(report) {
39923
39963
  }
39924
39964
  function applicationText(report) {
39925
39965
  if ("measurement" in report) return applicationSpeedText(report);
39926
- if ("kind" in report) return taggedText$2(report);
39966
+ if ("kind" in report) return taggedText$1(report);
39927
39967
  if ("sent" in report) return renderWriteOutcome(report, writeAnyResultText);
39928
39968
  if ("applications" in report) return listText(report);
39929
39969
  if ("runs" in report) return runsText(report);
@@ -40368,9 +40408,10 @@ var backups = {
40368
40408
  * separators depend on the machine that ran the command is a figure two people can read differently.
40369
40409
  */
40370
40410
  function formatMoney(cents, currency) {
40371
- const whole = Math.trunc(cents / 100);
40372
- const fraction = Math.abs(cents % 100).toString().padStart(2, "0");
40373
- return `${currency} ${String(whole).replace(/\B(?=(\d{3})+(?!\d))/g, " ")}.${fraction}`;
40411
+ const magnitude = Math.abs(cents);
40412
+ const whole = Math.trunc(magnitude / 100);
40413
+ const fraction = (magnitude % 100).toString().padStart(2, "0");
40414
+ return `${currency} ${cents < 0 ? "-" : ""}${String(whole).replace(/\B(?=(\d{3})+(?!\d))/g, " ")}.${fraction}`;
40374
40415
  }
40375
40416
  //#endregion
40376
40417
  //#region src/commands/billing-text-documents.ts
@@ -40980,12 +41021,25 @@ async function myCreditNote(context) {
40980
41021
  * The download itself stays a panel action: it returns a zip, and streaming a binary into a terminal that
40981
41022
  * redirects it is a different decision from printing a list.
40982
41023
  */
41024
+ /**
41025
+ * A pack as a printable report.
41026
+ *
41027
+ * `downloadUrl` is left out of every readable answer: it is a live signed capability, so printing it would hand a
41028
+ * bearer to whoever reads the terminal, a log or a pasted transcript. Only the download itself uses it, and that path
41029
+ * never echoes it either.
41030
+ */
41031
+ function printable(pack) {
41032
+ return {
41033
+ ...pack,
41034
+ downloadUrl: null
41035
+ };
41036
+ }
40983
41037
  /** What a window would produce, without writing anything. */
40984
41038
  async function exportPreview(context) {
40985
41039
  return {
40986
41040
  kind: "exportPreview",
40987
41041
  preview: await platformBillingExportPreview({ query: {
40988
- profile: requiredFlag$2(context, "--profile"),
41042
+ profile: requiredFlag$2(context, "--export-profile"),
40989
41043
  from: requiredFlag$2(context, "--from"),
40990
41044
  to: requiredFlag$2(context, "--to")
40991
41045
  } }).unwrap()
@@ -40995,14 +41049,14 @@ async function exportPreview(context) {
40995
41049
  async function exportsIndex() {
40996
41050
  return {
40997
41051
  kind: "exports",
40998
- items: (await platformBillingExportIndex({}).unwrap()).items
41052
+ items: (await platformBillingExportIndex({}).unwrap()).items.map(printable)
40999
41053
  };
41000
41054
  }
41001
41055
  /** One pack, as the API reports it. */
41002
41056
  async function exportShow(context) {
41003
41057
  return {
41004
41058
  kind: "export",
41005
- export: await platformBillingExportShow({ path: { exportUuid: requiredFlag$2(context, "--uuid") } }).unwrap()
41059
+ export: printable(await platformBillingExportShow({ path: { exportUuid: requiredFlag$2(context, "--uuid") } }).unwrap())
41006
41060
  };
41007
41061
  }
41008
41062
  /** The saved mappings a request can name. */
@@ -41014,16 +41068,16 @@ async function exportProfiles() {
41014
41068
  }
41015
41069
  /** Queue one pack for a window. */
41016
41070
  async function exportRequest(context) {
41017
- const profile = requiredFlag$2(context, "--profile");
41071
+ const profile = requiredFlag$2(context, "--export-profile");
41018
41072
  const from = requiredFlag$2(context, "--from");
41019
41073
  const to = requiredFlag$2(context, "--to");
41020
41074
  return {
41021
41075
  kind: "write",
41022
- outcome: await confirmableWrite(context, `Request an export pack for ${from} to ${to} using profile ${profile}. It is queued, not written here, and it covers only the documents the request selects.`, async () => platformBillingExportStore({ body: {
41076
+ outcome: await confirmableWrite(context, `Request an export pack for ${from} to ${to} using profile ${profile}. It is queued, not written here, and it covers only the documents the request selects.`, async () => printable(await platformBillingExportStore({ body: {
41023
41077
  profile,
41024
41078
  from,
41025
41079
  to
41026
- } }).unwrap())
41080
+ } }).unwrap()))
41027
41081
  };
41028
41082
  }
41029
41083
  //#endregion
@@ -41035,10 +41089,26 @@ async function exportRequest(context) {
41035
41089
  * the CLI never builds a URL out of a grant and never navigates to one. The bytes land in a file the caller names,
41036
41090
  * because a PDF or a zip written into a terminal is not something anybody can read.
41037
41091
  */
41038
- /** Write bytes to a path and report what was written. */
41092
+ /**
41093
+ * Write bytes to a path and report what was written.
41094
+ *
41095
+ * `wx` and `0600` are the contract, not a preference: a document download is customer data, so the file is created
41096
+ * exclusively at a mode only its owner can read. An existing path is refused rather than truncated, and a prepared
41097
+ * symlink cannot be followed, so this can neither destroy a file the caller already had nor adopt another file's
41098
+ * permissions.
41099
+ */
41039
41100
  async function saveBinary(data, path) {
41040
41101
  const bytes = data instanceof ArrayBuffer ? Buffer.from(data) : Buffer.from(await data.arrayBuffer());
41041
- await writeFile(path, bytes);
41102
+ try {
41103
+ await writeFile(path, bytes, {
41104
+ flag: "wx",
41105
+ mode: 384
41106
+ });
41107
+ } catch (error) {
41108
+ if (error.code === "EEXIST") throw new UsageError(`${path} already exists; pass a path that does not, so a document already saved there is not replaced`);
41109
+ if (error.code === "EACCES" || error.code === "EPERM") throw new UsageError(`${path} could not be created: permission denied`);
41110
+ throw error;
41111
+ }
41042
41112
  return bytes.byteLength;
41043
41113
  }
41044
41114
  var out = (context) => requiredFlag$2(context, "--out");
@@ -41080,10 +41150,12 @@ async function downloadCreditNote(context) {
41080
41150
  async function downloadExport(context) {
41081
41151
  const exportUuid = requiredFlag$2(context, "--uuid");
41082
41152
  const destination = out(context);
41153
+ const pack = await platformBillingExportShow({ path: { exportUuid } }).unwrap();
41154
+ if (pack.downloadUrl === null) throw new UsageError(`Export ${exportUuid} has no file: it is ${pack.state}, and only a ready pack has one.`);
41083
41155
  return {
41084
41156
  kind: "saved",
41085
41157
  path: destination,
41086
- bytes: await saveBinary(await platformBillingExportsDownload({ path: { exportUuid } }).unwrap(), destination)
41158
+ bytes: await saveBinary(await fetchSignedLink(pack.downloadUrl, `/platform/billing/exports/${exportUuid}/download`), destination)
41087
41159
  };
41088
41160
  }
41089
41161
  /**
@@ -41182,9 +41254,9 @@ var BILLING_METADATA = {
41182
41254
  description: "The first issued month, as YYYY-MM."
41183
41255
  },
41184
41256
  {
41185
- name: "--profile",
41257
+ name: "--export-profile",
41186
41258
  takesValue: true,
41187
- description: "The export profile's uuid."
41259
+ description: "The export profile's uuid. Distinct from --profile, which selects a stored session."
41188
41260
  },
41189
41261
  {
41190
41262
  name: "--environment",
@@ -41335,7 +41407,7 @@ var BILLING_TOPICS = [
41335
41407
  //#region src/commands/billing.ts
41336
41408
  async function issuer(context, rest) {
41337
41409
  if (rest[0] === "activate") return activateIssuer(context);
41338
- if (rest[0] === "update") return updateProfile(context);
41410
+ if (rest[0] !== void 0) throw new UsageError(BILLING_USAGE);
41339
41411
  return {
41340
41412
  kind: "issuer",
41341
41413
  issuer: await platformBillingIssuerShow({}).unwrap()
@@ -41410,10 +41482,9 @@ async function companyPaymentState(context, rest) {
41410
41482
  /** `client <noun>`: what the caller's own company may read of its documents. */
41411
41483
  async function clientDocuments(context, rest) {
41412
41484
  if (rest[0] === "invoices") return myInvoices(context);
41413
- if (rest[0] === "invoice") return myInvoice(context);
41485
+ if (rest[0] === "invoice") return rest[1] === "download" ? downloadInvoice(context) : myInvoice(context);
41414
41486
  if (rest[0] === "credit-notes") return myCreditNotes(context);
41415
41487
  if (rest[0] === "credit-note") return myCreditNote(context);
41416
- if (rest[0] === "invoice" && rest[1] === "download") return downloadInvoice(context);
41417
41488
  if (rest[0] === "credit-note-download") return downloadCreditNote(context);
41418
41489
  throw new UsageError(BILLING_USAGE);
41419
41490
  }
@@ -41423,11 +41494,12 @@ async function pack(context, rest) {
41423
41494
  if (rest[0] === "request") return exportRequest(context);
41424
41495
  if (rest[0] === "profiles") return exportProfiles();
41425
41496
  if (rest[0] === "download") return downloadExport(context);
41426
- if (rest[0] === "show") return exportShow(context);
41427
- if (rest[0] !== void 0) return exportShow(context);
41497
+ if (rest[0] === "show" || rest[0] === void 0 && context.flags.has("--uuid")) return exportShow(context);
41428
41498
  throw new UsageError(BILLING_USAGE);
41429
41499
  }
41430
- async function profile$1(context) {
41500
+ async function profile$1(context, rest) {
41501
+ if (rest[0] === "update") return updateProfile(context);
41502
+ if (rest[0] !== void 0) throw new UsageError(BILLING_USAGE);
41431
41503
  return {
41432
41504
  kind: "profile",
41433
41505
  profile: await companyBillingProfileShow({ path: { company: await requireCompany(context.flags) } }).unwrap()
@@ -41673,7 +41745,7 @@ function stamp(instant, by) {
41673
41745
  * environment's counter without changing anything the customer reviewed, so the value `cancellation show`
41674
41746
  * prints is the episode's recorded one and would be refused as stale.
41675
41747
  */
41676
- function generationFlag$1(context) {
41748
+ function generationFlag$2(context) {
41677
41749
  const raw = context.flags.get("--generation")?.trim() ?? "";
41678
41750
  const generation = Number(raw);
41679
41751
  if (!/^[0-9]+$/.test(raw) || !Number.isSafeInteger(generation)) throw new UsageError(`--generation is the whole-number environment generation the review was rendered against.\n\n${CANCELLATION_USAGE}`);
@@ -41690,7 +41762,7 @@ function generationFlag$1(context) {
41690
41762
  */
41691
41763
  /** `cancellation delete-now <uuid> <cancellation-uuid>`: delete the environment, keep the backups. */
41692
41764
  async function deleteNow(context, environmentUuid, cancellationUuid) {
41693
- const reviewGeneration = generationFlag$1(context);
41765
+ const reviewGeneration = generationFlag$2(context);
41694
41766
  return await confirmableWrite(context, deleteNowDescription(environmentUuid, cancellationUuid, reviewGeneration), async () => {
41695
41767
  return (await hostingCancellationDeleteNow({
41696
41768
  path: {
@@ -41707,7 +41779,7 @@ async function deleteNow(context, environmentUuid, cancellationUuid) {
41707
41779
  }
41708
41780
  /** `cancellation purge <uuid> <cancellation-uuid>`: delete the environment **and** its backups. */
41709
41781
  async function purge(context, environmentUuid, cancellationUuid) {
41710
- const reviewGeneration = generationFlag$1(context);
41782
+ const reviewGeneration = generationFlag$2(context);
41711
41783
  return await confirmableWrite(context, purgeDescription(environmentUuid, cancellationUuid, reviewGeneration), async () => {
41712
41784
  return (await hostingCancellationPurge({
41713
41785
  path: {
@@ -41828,7 +41900,7 @@ async function show$5(context, environmentUuid) {
41828
41900
  async function request(context, environmentUuid) {
41829
41901
  const timing = timingFlag(context);
41830
41902
  const serviceEnd = serviceEndFlag(context, timing);
41831
- const reviewGeneration = generationFlag$1(context);
41903
+ const reviewGeneration = generationFlag$2(context);
41832
41904
  const reason = requiredFlag$1(context, "--reason", "request needs --reason");
41833
41905
  return await confirmableWrite(context, requestDescription({
41834
41906
  environmentUuid,
@@ -41876,7 +41948,7 @@ async function withdraw(context, environmentUuid, cancellationUuid) {
41876
41948
  * scope — attaching a domain changes the digest without advancing it. The ordinary pass continues afterwards.
41877
41949
  */
41878
41950
  async function reconfirm(context, environmentUuid, cancellationUuid) {
41879
- const reviewGeneration = generationFlag$1(context);
41951
+ const reviewGeneration = generationFlag$2(context);
41880
41952
  const inventoryDigest = requiredFlag$1(context, "--digest", "reconfirm needs --digest, the inventoryDigest from the review it approves");
41881
41953
  return await confirmableWrite(context, reconfirmDescription(environmentUuid, cancellationUuid, reviewGeneration, inventoryDigest), async () => {
41882
41954
  return (await hostingCancellationReconfirm({
@@ -42898,12 +42970,12 @@ function lockTerms(context, environmentUuid, workloadUuid) {
42898
42970
  return {
42899
42971
  environmentUuid,
42900
42972
  workloadUuid,
42901
- desiredGeneration: generationFlag(context),
42973
+ desiredGeneration: generationFlag$1(context),
42902
42974
  locked: !context.flags.has("--unlock")
42903
42975
  };
42904
42976
  }
42905
42977
  /** `--generation`: the whole-number environment generation the change is made against. */
42906
- function generationFlag(context) {
42978
+ function generationFlag$1(context) {
42907
42979
  const raw = context.flags.get("--generation")?.trim() ?? "";
42908
42980
  const generation = Number(raw);
42909
42981
  if (!/^[0-9]+$/.test(raw) || !Number.isSafeInteger(generation)) throw new UsageError(`--generation is the environment generation \`environment show\` prints.\n\n${DELETION_LOCK_USAGE}`);
@@ -45304,7 +45376,7 @@ async function companyRead(context, subcommand, rest) {
45304
45376
  throw new UsageError(USAGE$22);
45305
45377
  }
45306
45378
  /** The renderer for a tagged feature read, or null when this command renders the answer itself. */
45307
- function taggedText$1(report) {
45379
+ function taggedText(report) {
45308
45380
  if (!("kind" in report)) return null;
45309
45381
  if (report.kind === "offers" || report.kind === "catch-all") return emailDomainText(report);
45310
45382
  if (report.kind === "preferences") return emailMailboxAdminText(report);
@@ -45393,7 +45465,7 @@ var email$2 = {
45393
45465
  },
45394
45466
  human(report) {
45395
45467
  if ("sent" in report) return renderWriteOutcome(report, emailWriteText);
45396
- const tagged = taggedText$1(report);
45468
+ const tagged = taggedText(report);
45397
45469
  if (tagged !== null) return tagged;
45398
45470
  if (Array.isArray(report)) return namesText(report);
45399
45471
  if ("service" in report) return serviceText$1(report);
@@ -46484,6 +46556,8 @@ var ENVIRONMENT_USAGE = [
46484
46556
  " hostingctl environment reconcile <uuid> --company <slug>",
46485
46557
  " hostingctl environment scale <uuid> --company <slug> [--cpu <millicores>] [--memory <mib>]",
46486
46558
  " hostingctl environment cache-set <uuid> --company <slug> [--template <name>]",
46559
+ " hostingctl environment object-cache <uuid> --company <slug>",
46560
+ " hostingctl environment object-cache-set <uuid> --company <slug> --enabled <true|false> --generation <n>",
46487
46561
  " hostingctl environment portable <export|preview|prepare|confirm> <uuid> --company <slug> [--file <path>]",
46488
46562
  " hostingctl environment configuration <show|preview|save|apply> <uuid> --company <slug> [--file <path>]",
46489
46563
  " hostingctl environment secret <write|import|local> <uuid> --company <slug> …",
@@ -46498,6 +46572,11 @@ var ENVIRONMENT_USAGE = [
46498
46572
  " reconcile Ask the platform to apply this environment's recorded desired state again.",
46499
46573
  " scale Set every workload's CPU/memory requests, keeping the existing request-to-limit headroom.",
46500
46574
  " cache-set Turn on the HTTP cache for every application that can carry it, using a starting pattern.",
46575
+ " object-cache This environment's recorded WordPress object-cache choice, whether it can serve it, and",
46576
+ " what the platform has applied.",
46577
+ " object-cache-set Turn the WordPress object cache on or off. Enabling is refused when the environment cannot",
46578
+ " serve it; turning it off is always allowed. --generation is the environment generation",
46579
+ " `environment show` prints.",
46501
46580
  " portable Export, preview, draft and confirm this environment's portable YAML pattern.",
46502
46581
  " configuration Read, review, draft and apply this environment's YAML configuration.",
46503
46582
  " secret Set declared configuration secret values through the write-only control, or write the",
@@ -46511,7 +46590,7 @@ var ENVIRONMENT_USAGE = [
46511
46590
  " storage-usage What each volume was allocated, what it has written and what room is left, from the",
46512
46591
  " platform's own reading; a volume it could not read says so instead of reporting zero.",
46513
46592
  "",
46514
- "The writes (create, reconcile, scale, component-version, portable prepare/confirm, configuration save/apply,",
46593
+ "The writes (create, reconcile, scale, component-version, object-cache-set, portable prepare/confirm, configuration save/apply,",
46515
46594
  "secret write/import, database create/bind/retire) need --confirm; --dry-run describes the change without making it.",
46516
46595
  "",
46517
46596
  "`secret local` is the one exception and is a read: it writes each declaration's local development value - a",
@@ -47444,6 +47523,16 @@ var ENVIRONMENT_METADATA = {
47444
47523
  takesValue: true,
47445
47524
  description: "The cache starting pattern: wordpress, static_build or application_headers."
47446
47525
  },
47526
+ {
47527
+ name: "--enabled",
47528
+ takesValue: true,
47529
+ description: "Whether the WordPress object cache is on: true or false."
47530
+ },
47531
+ {
47532
+ name: "--generation",
47533
+ takesValue: true,
47534
+ description: "The environment generation `environment show` prints, which the write is made against."
47535
+ },
47447
47536
  {
47448
47537
  name: "--cpu",
47449
47538
  takesValue: true,
@@ -47637,6 +47726,8 @@ var ENVIRONMENT_METADATA = {
47637
47726
  "reconcile",
47638
47727
  "scale",
47639
47728
  "cache-set",
47729
+ "object-cache",
47730
+ "object-cache-set",
47640
47731
  "portable",
47641
47732
  "configuration",
47642
47733
  "secret",
@@ -47686,6 +47777,51 @@ var ENVIRONMENT_METADATA = {
47686
47777
  ]
47687
47778
  };
47688
47779
  //#endregion
47780
+ //#region src/commands/environment-object-cache.ts
47781
+ /** `environment object-cache <uuid>`: the environment's recorded WordPress object-cache choice. */
47782
+ async function objectCache(path) {
47783
+ return {
47784
+ kind: "object-cache",
47785
+ settings: (await hostingEnvironmentObjectCacheShow({ path })).data
47786
+ };
47787
+ }
47788
+ /** `--enabled`: the direction the switch points, refused when it says anything else. */
47789
+ function enabledFlag(context, usage) {
47790
+ const raw = context.flags.get("--enabled")?.trim() ?? "";
47791
+ if (raw !== "true" && raw !== "false") throw new UsageError(`--enabled must be true or false.\n\n${usage}`);
47792
+ return raw === "true";
47793
+ }
47794
+ /** `--generation`: the environment generation the change is made against, as a positive whole number. */
47795
+ function generationFlag(context, usage) {
47796
+ const raw = context.flags.get("--generation")?.trim() ?? "";
47797
+ const generation = Number(raw);
47798
+ if (!/^[0-9]+$/.test(raw) || !Number.isSafeInteger(generation) || generation < 1) throw new UsageError(`--generation is the environment generation \`environment show\` prints, and must be at least 1.\n\n${usage}`);
47799
+ return generation;
47800
+ }
47801
+ /**
47802
+ * `environment object-cache-set <uuid> --enabled <on|off> --generation <n>`: record the environment's
47803
+ * WordPress object-cache choice.
47804
+ *
47805
+ * The generation is required rather than read first, matching every other optimistic-concurrency
47806
+ * write: the API refuses one that has moved, so two people cannot silently overwrite each other.
47807
+ * Enabling is refused by the API when the environment cannot serve the cache; disabling is always
47808
+ * allowed, because removing the drop-in is the safe direction.
47809
+ */
47810
+ async function objectCacheSet(context, path, usage) {
47811
+ const enabled = enabledFlag(context, usage);
47812
+ const desiredGeneration = generationFlag(context, usage);
47813
+ return {
47814
+ kind: "object-cache-write",
47815
+ outcome: await confirmableWrite(context, `turn the WordPress object cache ${enabled ? "on" : "off"} for ${path.environmentUuid} at generation ${String(desiredGeneration)}`, async () => (await hostingEnvironmentObjectCacheUpdate({
47816
+ path,
47817
+ body: {
47818
+ enabled,
47819
+ desiredGeneration
47820
+ }
47821
+ })).data)
47822
+ };
47823
+ }
47824
+ //#endregion
47689
47825
  //#region src/commands/environment-references.ts
47690
47826
  var USAGE$12 = [
47691
47827
  "Usage: hostingctl environment references <environment-uuid> --company <slug>",
@@ -47907,6 +48043,24 @@ function configurationPreviewText(review) {
47907
48043
  return lines.join("\n");
47908
48044
  }
47909
48045
  //#endregion
48046
+ //#region src/commands/environment-object-cache-text.ts
48047
+ /**
48048
+ * The environment's WordPress object-cache answer: the recorded choice, whether it can serve, and
48049
+ * what the platform has applied.
48050
+ *
48051
+ * The choice and the rollout are named separately, because "turned on" is not "applied", and the
48052
+ * capability is reported independently of the choice — an environment that can no longer serve it
48053
+ * still reads as on if it was recorded on.
48054
+ */
48055
+ function objectCacheText(settings) {
48056
+ const capability = settings.capability.available ? "can serve it" : `cannot serve it: ${settings.capability.reason ?? "the reason was not given"}`;
48057
+ return [
48058
+ ` choice ${settings.enabled ? "on" : "off"}`,
48059
+ ` can serve ${capability}`,
48060
+ ` rollout ${settings.status.status}; applied generation ${String(settings.status.appliedGeneration)} of ${String(settings.desiredGeneration)} requested`
48061
+ ].join("\n");
48062
+ }
48063
+ //#endregion
47910
48064
  //#region src/commands/environment-domains-text.ts
47911
48065
  /** One name as one line: its address, where it points and how far routing has got. */
47912
48066
  function domainLine(one) {
@@ -47933,21 +48087,14 @@ function environmentDomainText(report) {
47933
48087
  return redirects.length === 0 ? "This environment answers no redirects." : redirects.map((one) => ` ${one.sourceHostname.padEnd(36)} ${one.modeName.padEnd(10)} → ${one.destinationUrl ?? one.applicationLabel ?? "its application"} ${one.active ? "active" : one.pendingReason ?? "pending"}`).join("\n");
47934
48088
  }
47935
48089
  //#endregion
47936
- //#region src/commands/environment-text-cache.ts
47937
- /** The environment-wide cache answer: the generation that applies it, and what each application did. */
47938
- function cacheEnablementText(enablement) {
47939
- const lines = enablement.applications.map((application) => ` ${application.name} ${application.reason ?? application.outcome}`);
47940
- return [`HTTP cache recorded for generation ${String(enablement.desiredGeneration)}; it starts serving once that generation is applied.`, ...lines].join("\n");
47941
- }
47942
- //#endregion
47943
- //#region src/commands/environment-text.ts
48090
+ //#region src/commands/environment-tagged-text.ts
47944
48091
  /**
47945
48092
  * The renderer for a group-tagged answer.
47946
48093
  *
47947
48094
  * Each group tags its answers with kinds only it produces, so the tag names the owner and this command never has
47948
48095
  * to know what a group's reads look like.
47949
48096
  */
47950
- function taggedText(report) {
48097
+ function environmentTaggedText(report) {
47951
48098
  if (report.kind === "domains" || report.kind === "redirects" || report.kind === "domain-write") return environmentDomainText(report);
47952
48099
  if (report.kind === "site-access" || report.kind === "site-users" || report.kind === "site-write") return siteAccessText(report);
47953
48100
  if (report.kind === "tool" || report.kind === "tools-write") return environmentToolsText(report);
@@ -47956,6 +48103,15 @@ function taggedText(report) {
47956
48103
  if (report.kind === "service-addition" || report.kind === "service-retirement" || report.kind === "service-write") return environmentServicesText(report);
47957
48104
  return environmentAdminText(report);
47958
48105
  }
48106
+ //#endregion
48107
+ //#region src/commands/environment-text-cache.ts
48108
+ /** The environment-wide cache answer: the generation that applies it, and what each application did. */
48109
+ function cacheEnablementText(enablement) {
48110
+ const lines = enablement.applications.map((application) => ` ${application.name} ${application.reason ?? application.outcome}`);
48111
+ return [`HTTP cache recorded for generation ${String(enablement.desiredGeneration)}; it starts serving once that generation is applied.`, ...lines].join("\n");
48112
+ }
48113
+ //#endregion
48114
+ //#region src/commands/environment-text.ts
47959
48115
  /**
47960
48116
  * The two answers that describe what an environment may reference or hold.
47961
48117
  *
@@ -47971,7 +48127,10 @@ function referenceOrUsageText(report) {
47971
48127
  }
47972
48128
  /** The tagged answers. A cache change carries an outcome rather than a payload, so it renders as a write. */
47973
48129
  function taggedReportText(report) {
47974
- return report.kind === "cache-write" ? renderWriteOutcome(report.outcome, outcomeOf$1) : taggedText(report);
48130
+ if (report.kind === "cache-write") return renderWriteOutcome(report.outcome, outcomeOf$1);
48131
+ if (report.kind === "object-cache") return objectCacheText(report.settings);
48132
+ if (report.kind === "object-cache-write") return renderWriteOutcome(report.outcome, objectCacheText);
48133
+ return environmentTaggedText(report);
47975
48134
  }
47976
48135
  /** Render one `environment` answer to a person, never to a value the payload does not carry. */
47977
48136
  function environmentText(report) {
@@ -54590,10 +54749,10 @@ var confirmHostingApplicationRecoveryRequestSchema = object({
54590
54749
  targetVersion: string().max(64).nullish(),
54591
54750
  intake: object({
54592
54751
  action: _enum(["restore", "reset"]),
54593
- sourceVersion: string().max(64),
54594
- phpVersion: string().max(16),
54595
- tablePrefix: string().max(32),
54596
- inputLocation: string().max(191),
54752
+ sourceVersion: string().max(64).nullish(),
54753
+ phpVersion: string().max(16).nullish(),
54754
+ tablePrefix: string().max(32).nullish(),
54755
+ inputLocation: string().max(191).nullish(),
54597
54756
  inputObjectKey: string().max(512).regex(/^[A-Za-z0-9][A-Za-z0-9._\/-]*$/).nullish().describe("The private object key on the cluster's backup object storage. A path, never a URL, and\nnever absolute or traversing: the Job joins it onto the configured bucket."),
54598
54757
  retentionOwner: string().max(191),
54599
54758
  retentionExpiresAt: string().max(64).nullish(),
@@ -57436,6 +57595,17 @@ object({
57436
57595
  maximumReuseSeconds: int(),
57437
57596
  capabilities: hostingHttpCacheCapabilitiesDataSchema
57438
57597
  });
57598
+ var hostingObjectCacheCapabilityDataSchema = object({
57599
+ available: boolean(),
57600
+ reason: string().nullable()
57601
+ });
57602
+ object({
57603
+ environmentUuid: string(),
57604
+ enabled: boolean(),
57605
+ desiredGeneration: int(),
57606
+ capability: hostingObjectCacheCapabilityDataSchema,
57607
+ status: hostingEnvironmentStatusDataSchema
57608
+ });
57439
57609
  var hostingPackageDataSchema = object({
57440
57610
  slug: string(),
57441
57611
  name: string(),
@@ -59083,6 +59253,10 @@ var updateHostingEnvironmentRequestSchema = object({
59083
59253
  })).min(1).max(20)
59084
59254
  }).describe("A change to an existing environment's budget and allocations.\n\nThe submitted lists must name exactly the workloads and volumes that already\nexist: this request replaces values, and adding or removing a workload or\nvolume is a different operation. `desiredGeneration` must match the stored\ngeneration, which the service checks under its lock.");
59085
59255
  var updateHostingGeneratedHostnameWordRequestSchema = object({ enabled: boolean() }).describe("Switch one word in the generated-hostname vocabulary on or off.\n\nDisabling is the only write: a word already drawn into an address is never removed or renamed, because\nthe address is a client's permanent fallback route. Disabling stops a word being drawn again.");
59256
+ var updateHostingObjectCacheSettingsRequestSchema = object({
59257
+ desiredGeneration: int().min(1),
59258
+ enabled: boolean()
59259
+ }).describe("The body of \"serve this environment's WordPress sites from the Redis object cache, or stop\".\n\nBoth fields are required: the switch decides whether a mounted platform file stands in front of\nevery page of every WordPress member, and an omitted `enabled` must not read as `false`.");
59086
59260
  var updateHostingSeedConsumptionRequestSchema = object({ enabled: boolean() }).describe("Record whether a definition's verified version may serve future claims.\n\nOnly the flag is accepted. Enabling is checked against the selected version's verified placement in\nthe service, so this request stays a field shape rather than a second eligibility owner.");
59087
59261
  var updateHostingSeedDefinitionRequestSchema = object({ preparationMode: hostingSeedPreparationModeEnumSchema }).describe("Record the preparation policy a recipe carries.\n\nDeliberately only the policy: enabling a definition and selecting a version are activation, and\nboth wait for a verified placement rather than an editable field.");
59088
59262
  object({
@@ -60661,6 +60835,19 @@ union([
60661
60835
  messageDataSchema
60662
60836
  ]);
60663
60837
  setHostingEnvironmentDeletionProtectionRequestSchema.describe("Turning one environment's deletion protection on or off.\n\n`locked` is required rather than defaulted, so a request can never arm or disarm a lock by\nomission, and `desiredGeneration` is what the client was reading. No workload, status or runtime\ncan be sent here: the environment is resolved inside the authorized Company, so this request cannot\nreach a different environment or a piece inside it.");
60838
+ union([
60839
+ object({ message: string().describe("Error overview.") }),
60840
+ object({ message: string().describe("Error overview.") }),
60841
+ messageDataSchema
60842
+ ]);
60843
+ union([
60844
+ object({ message: string().describe("Error overview.") }),
60845
+ object({ message: string().describe("Error overview.") }),
60846
+ messageDataSchema,
60847
+ messageDataSchema,
60848
+ messageDataSchema
60849
+ ]);
60850
+ updateHostingObjectCacheSettingsRequestSchema.describe("The body of \"serve this environment's WordPress sites from the Redis object cache, or stop\".\n\nBoth fields are required: the switch decides whether a mounted platform file stands in front of\nevery page of every WordPress member, and an omitted `enabled` must not read as `false`.");
60664
60851
  union([object({ message: string().describe("Error overview.") }), object({ message: string().describe("Error overview.") })]);
60665
60852
  union([
60666
60853
  object({ message: string().describe("Error overview.") }),
@@ -61416,16 +61603,10 @@ union([
61416
61603
  object({ message: string().describe("Error overview.") }),
61417
61604
  messageDataSchema
61418
61605
  ]);
61419
- var platformBillingInvoiceIssueStatus200Schema = string();
61420
- var platformBillingInvoiceIssueStatus201Schema = billingInvoiceDataSchema;
61421
- var platformBillingInvoiceIssueStatus401Schema = object({ message: string().describe("Error overview.") });
61422
- var platformBillingInvoiceIssueStatus403Schema = object({ message: string().describe("Error overview.") });
61423
- var platformBillingInvoiceIssueStatus422Schema = messageDataSchema;
61424
- union([platformBillingInvoiceIssueStatus200Schema, platformBillingInvoiceIssueStatus201Schema]);
61425
61606
  union([
61426
- platformBillingInvoiceIssueStatus401Schema,
61427
- platformBillingInvoiceIssueStatus403Schema,
61428
- platformBillingInvoiceIssueStatus422Schema
61607
+ object({ message: string().describe("Error overview.") }),
61608
+ object({ message: string().describe("Error overview.") }),
61609
+ messageDataSchema
61429
61610
  ]);
61430
61611
  issueBillingInvoiceRequestSchema.describe("Issuing one run revision, or issuing the replacement for an already-credited invoice.\n\nThe revision is required and explicit: an issue is the moment a number is spent, so an operator says\nwhich reviewed revision they are issuing rather than letting the platform guess the current one. The\noptional `issuingRequestKey` is the caller's own idempotency handle for a retried request; the\nservice also treats a run revision that already has a live document as the same document.\n\nThe run itself is a route parameter for an ordinary issue and the `run` field for a replacement,\nbecause a replacement is a *new* run that names the run it corrects.");
61431
61612
  union([
@@ -61444,28 +61625,16 @@ union([
61444
61625
  messageDataSchema
61445
61626
  ]);
61446
61627
  voidBillingReservationRequestSchema.describe("Voiding an unissued reservation, with the reason that explains the gap in the number series.\n\nOnly a reservation may be voided: once a document is issued, correcting it is a credit note, not a\nvoid. The reason is compulsory because the number stays spent and a reader of the series must be able\nto see why.");
61447
- var platformBillingInvoiceCreditStatus200Schema = string();
61448
- var platformBillingInvoiceCreditStatus201Schema = billingCreditNoteDataSchema;
61449
- var platformBillingInvoiceCreditStatus401Schema = object({ message: string().describe("Error overview.") });
61450
- var platformBillingInvoiceCreditStatus403Schema = object({ message: string().describe("Error overview.") });
61451
- var platformBillingInvoiceCreditStatus422Schema = messageDataSchema;
61452
- union([platformBillingInvoiceCreditStatus200Schema, platformBillingInvoiceCreditStatus201Schema]);
61453
61628
  union([
61454
- platformBillingInvoiceCreditStatus401Schema,
61455
- platformBillingInvoiceCreditStatus403Schema,
61456
- platformBillingInvoiceCreditStatus422Schema
61629
+ object({ message: string().describe("Error overview.") }),
61630
+ object({ message: string().describe("Error overview.") }),
61631
+ messageDataSchema
61457
61632
  ]);
61458
61633
  creditBillingInvoiceRequestSchema.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.");
61459
- var platformBillingInvoiceReplaceStatus200Schema = string();
61460
- var platformBillingInvoiceReplaceStatus201Schema = billingInvoiceDataSchema;
61461
- var platformBillingInvoiceReplaceStatus401Schema = object({ message: string().describe("Error overview.") });
61462
- var platformBillingInvoiceReplaceStatus403Schema = object({ message: string().describe("Error overview.") });
61463
- var platformBillingInvoiceReplaceStatus422Schema = messageDataSchema;
61464
- union([platformBillingInvoiceReplaceStatus200Schema, platformBillingInvoiceReplaceStatus201Schema]);
61465
61634
  union([
61466
- platformBillingInvoiceReplaceStatus401Schema,
61467
- platformBillingInvoiceReplaceStatus403Schema,
61468
- platformBillingInvoiceReplaceStatus422Schema
61635
+ object({ message: string().describe("Error overview.") }),
61636
+ object({ message: string().describe("Error overview.") }),
61637
+ messageDataSchema
61469
61638
  ]);
61470
61639
  issueBillingInvoiceRequestSchema.describe("Issuing one run revision, or issuing the replacement for an already-credited invoice.\n\nThe revision is required and explicit: an issue is the moment a number is spent, so an operator says\nwhich reviewed revision they are issuing rather than letting the platform guess the current one. The\noptional `issuingRequestKey` is the caller's own idempotency handle for a retried request; the\nservice also treats a run revision that already has a live document as the same document.\n\nThe run itself is a route parameter for an ordinary issue and the `run` field for a replacement,\nbecause a replacement is a *new* run that names the run it corrects.");
61471
61640
  union([object({ message: string().describe("Error overview.") }), object({ message: string().describe("Error overview.") })]);
@@ -62170,6 +62339,8 @@ var environment = {
62170
62339
  if (subcommand === "reconcile") return await reconcile(context, path);
62171
62340
  if (subcommand === "scale") return await scale(context, path);
62172
62341
  if (subcommand === "cache-set") return await cacheSet(context, path);
62342
+ if (subcommand === "object-cache") return await objectCache(path);
62343
+ if (subcommand === "object-cache-set") return await objectCacheSet(context, path, ENVIRONMENT_USAGE);
62173
62344
  if (subcommand === "profile") return (await hostingEnvironmentsProfile({ path })).data;
62174
62345
  if (subcommand !== "show") throw new UsageError(ENVIRONMENT_USAGE);
62175
62346
  return (await hostingEnvironmentShow({ path })).data;
@@ -67081,7 +67252,7 @@ function writeUpdateState(state, env = process.env) {
67081
67252
  }
67082
67253
  //#endregion
67083
67254
  //#region src/version.ts
67084
- var VERSION = "1.0.409";
67255
+ var VERSION = "1.0.412";
67085
67256
  //#endregion
67086
67257
  //#region src/commands/update.ts
67087
67258
  /**
@@ -67156,7 +67327,7 @@ var update = {
67156
67327
  }, process.env);
67157
67328
  return {
67158
67329
  ...known,
67159
- current: after ?? "1.0.409",
67330
+ current: after ?? "1.0.412",
67160
67331
  latest: after ?? latest,
67161
67332
  upToDate: after !== null && (latest === null || !isNewerVersion(latest, after)),
67162
67333
  action: "run",
@@ -67432,7 +67603,7 @@ async function printUpdateNotice(options) {
67432
67603
  }, env, { waitMs: NOTICE_LOCK_WAIT_MS });
67433
67604
  } catch {}
67434
67605
  if (latest === null) return;
67435
- if (!isNewerVersion(latest, "1.0.409")) return;
67606
+ if (!isNewerVersion(latest, "1.0.412")) return;
67436
67607
  process.stderr.write(`A newer hostingctl is published: ${latest} (this copy is ${VERSION}). Run \`hostingctl update\` to update.\n`);
67437
67608
  }
67438
67609
  /** Whether an environment variable is set to something, which is how CI and the opt-out are read. */