@haakco/hostingctl 1.0.394 → 1.0.405

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
@@ -909,13 +909,44 @@ function createTransport(target) {
909
909
  };
910
910
  };
911
911
  }
912
+ /** The target the current command was configured with, so a call that legitimately takes minutes can borrow a budget. */
913
+ var activeTarget = null;
912
914
  /** Point the generated client at one target. Called once, before any command runs. */
913
915
  function configureApi(target) {
916
+ activeTarget = target;
914
917
  client.setConfig({
915
918
  baseURL: target.baseURL,
916
919
  transport: createTransport(target)
917
920
  });
918
921
  }
922
+ /**
923
+ * Run one call with a longer request budget than the default.
924
+ *
925
+ * The default bounds a conversational round trip at a minute. An import upload is not one: it streams a site's files
926
+ * and the API stages the entire archive — expanding every entry and normalizing the database — before it answers, so
927
+ * its duration follows the archive rather than the connection. The first real customer backup is 1.6 GiB across 74,150
928
+ * entries, and the default reported that request as unanswered while the server was still working on it. The ordinary
929
+ * budget is restored afterwards, so every later call in the process keeps the tighter limit.
930
+ */
931
+ async function withRequestBudget(timeoutMs, run) {
932
+ if (activeTarget === null) return await run();
933
+ const previous = activeTarget;
934
+ client.setConfig({
935
+ baseURL: previous.baseURL,
936
+ transport: createTransport({
937
+ ...previous,
938
+ timeoutMs
939
+ })
940
+ });
941
+ try {
942
+ return await run();
943
+ } finally {
944
+ client.setConfig({
945
+ baseURL: previous.baseURL,
946
+ transport: createTransport(previous)
947
+ });
948
+ }
949
+ }
919
950
  //#endregion
920
951
  //#region src/platform.ts
921
952
  /** Whether this platform is Windows. */
@@ -10832,6 +10863,8 @@ var USAGE$40 = [
10832
10863
  "what would be uploaded without reading it."
10833
10864
  ].join("\n");
10834
10865
  /** `application import-upload`, which stages a client site for review. */
10866
+ /** How long one import upload may take before the CLI calls it unanswered. */
10867
+ var UPLOAD_REQUEST_BUDGET_MS = 9e5;
10835
10868
  async function applicationUpload(context, path, rest) {
10836
10869
  if (rest.length > 0) throw new UsageError(USAGE$40);
10837
10870
  const database = context.flags.get("--database")?.trim() ?? "";
@@ -10850,15 +10883,16 @@ async function applicationUpload(context, path, rest) {
10850
10883
  directory === "" ? "" : `, ${String(files.length)} file(s) totalling ${describe(fileBytes)}`,
10851
10884
  ". The import is staged for review; nothing is applied yet."
10852
10885
  ].join(""), async () => {
10853
- return (await hostingWordpressImportStore({
10886
+ const body = {
10887
+ database: database === "" ? null : await partOf(database),
10888
+ archive: archive === "" ? null : await partOf(archive),
10889
+ directory: files.length === 0 ? null : await Promise.all(files.map(async (one) => await partOf(one.absolute))),
10890
+ directoryPaths: files.length === 0 ? null : JSON.stringify(files.map((one) => one.relative))
10891
+ };
10892
+ return await withRequestBudget(UPLOAD_REQUEST_BUDGET_MS, async () => (await hostingWordpressImportStore({
10854
10893
  path,
10855
- body: {
10856
- database: database === "" ? null : await partOf(database),
10857
- archive: archive === "" ? null : await partOf(archive),
10858
- directory: files.length === 0 ? null : await Promise.all(files.map(async (one) => await partOf(one.absolute))),
10859
- directoryPaths: files.length === 0 ? null : JSON.stringify(files.map((one) => one.relative))
10860
- }
10861
- })).data;
10894
+ body
10895
+ })).data);
10862
10896
  })
10863
10897
  };
10864
10898
  }
@@ -24986,7 +25020,18 @@ var confirmHostingApplicationRecoveryRequestSchema = object({
24986
25020
  archiveSha256: string().min(64).max(64).nullish(),
24987
25021
  recordedSha256: string().min(64).max(64).nullish(),
24988
25022
  inputTreeSha256: string().min(64).max(64).nullish(),
24989
- importUuid: uuid().nullish().describe("The staged client import the review was made against. Only its reference travels: every\ninput fact — object key, hashes, prefix, version — is resolved from the platform's own\nrecord of the upload, so the field is a reference rather than an input.")
25023
+ importUuid: uuid().nullish().describe("The staged client import the review was made against. Only its reference travels: every\ninput fact — object key, hashes, prefix, version — is resolved from the platform's own\nrecord of the upload, so the field is a reference rather than an input."),
25024
+ currentDataInnoDb: object({
25025
+ removePlugins: array(string().max(255).regex(/~^[A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)*$~D/)).max(16).optional(),
25026
+ preserveFiles: array(_enum([
25027
+ ".hosting-admin-password-version",
25028
+ ".hosting-db-password-version",
25029
+ "hosting-stats.php",
25030
+ ".well-known"
25031
+ ])).max(32).optional(),
25032
+ excludedUploads: array(string().max(255).regex(/~^[A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)*$~D/)).max(32).optional(),
25033
+ replacedUploads: array(string().max(255).regex(/~^[A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)*$~D/)).max(32).optional()
25034
+ }).optional()
24990
25035
  })
24991
25036
  }).describe("Confirming one application's reset or restore against the inventory that was reviewed.\n\n`confirmation` is the digest the review returned, and it is required rather than optional: it is\nwhat makes the confirmation an approval of an exact inventory instead of an approval of a label.\n`desiredGeneration` is the same idea at the environment level, so a request composed before\nanother change is a conflict rather than a reset of something else.\n\nThe reviewed figures travel as one typed `intake` object rather than flat fields, so the HTTP\nboundary and the domain contract cannot drift into two shapes with the same names. The intake\nitself is validated by the DTO's own types when it is hydrated.");
24992
25037
  object({
@@ -26578,6 +26623,12 @@ var hostingApplicationRecoveryDataSchema = object({
26578
26623
  completedAt: string().nullable(),
26579
26624
  urlRepair: union([hostingWordpressUrlRepairDataSchema, _null()])
26580
26625
  });
26626
+ var hostingRecoveryCurrentDataDataSchema = object({
26627
+ removePlugins: array(string()),
26628
+ preserveFiles: array(string()),
26629
+ excludedUploads: array(string()),
26630
+ replacedUploads: array(string())
26631
+ });
26581
26632
  var hostingRestoreIntakeRequestDataSchema = object({
26582
26633
  companyName: string(),
26583
26634
  environmentUuid: string(),
@@ -26623,7 +26674,8 @@ var hostingRestoreIntakeRequestDataSchema = object({
26623
26674
  toolsPeakMib: int().nullable(),
26624
26675
  toolsLimitMib: int(),
26625
26676
  activeRestores: int(),
26626
- importUuid: string().nullable()
26677
+ importUuid: string().nullable(),
26678
+ currentDataInnoDb: union([hostingRecoveryCurrentDataDataSchema, _null()])
26627
26679
  });
26628
26680
  var hostingRestoreCheckOutcomeEnumSchema = _enum([
26629
26681
  "ok",
@@ -30328,6 +30380,8 @@ string().optional().describe("When the retained data stops being recoverable.");
30328
30380
  string().optional().describe("The private object key of the reviewed bundle on the platform backup storage.");
30329
30381
  string().optional().describe("The hash the reviewed archive must match before extraction.");
30330
30382
  string().optional().describe("The hash the expanded tree must match after extraction.");
30383
+ int().optional().describe("Maximum bytes for each held-current SQL export; required for currentDataInnoDb.");
30384
+ string().optional().describe("JSON policy for held-current WordPress data and private InnoDB conversion.");
30331
30385
  string().optional().describe("The staged client import this review is about, when the input was uploaded rather than staged by staff.");
30332
30386
  union([
30333
30387
  object({ message: string().describe("Error overview.") }),
@@ -36987,7 +37041,7 @@ function writeUpdateState(state, env = process.env) {
36987
37041
  }
36988
37042
  //#endregion
36989
37043
  //#region src/version.ts
36990
- var VERSION = "1.0.394";
37044
+ var VERSION = "1.0.405";
36991
37045
  //#endregion
36992
37046
  //#region src/commands/update.ts
36993
37047
  /**
@@ -37062,7 +37116,7 @@ var update = {
37062
37116
  }, process.env);
37063
37117
  return {
37064
37118
  ...known,
37065
- current: after ?? "1.0.394",
37119
+ current: after ?? "1.0.405",
37066
37120
  latest: after ?? latest,
37067
37121
  upToDate: after !== null && (latest === null || !isNewerVersion(latest, after)),
37068
37122
  action: "run",
@@ -37337,7 +37391,7 @@ async function printUpdateNotice(options) {
37337
37391
  }, env, { waitMs: NOTICE_LOCK_WAIT_MS });
37338
37392
  } catch {}
37339
37393
  if (latest === null) return;
37340
- if (!isNewerVersion(latest, "1.0.394")) return;
37394
+ if (!isNewerVersion(latest, "1.0.405")) return;
37341
37395
  process.stderr.write(`A newer hostingctl is published: ${latest} (this copy is ${VERSION}). Run \`hostingctl update\` to update.\n`);
37342
37396
  }
37343
37397
  /** Whether an environment variable is set to something, which is how CI and the opt-out are read. */