@haakco/hostingctl 1.0.374 → 1.0.377

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
@@ -3671,7 +3671,7 @@ function emailMailboxesCredential(options) {
3671
3671
  }
3672
3672
  /**
3673
3673
  * @description Unlike credential delivery retries, every accepted reset replaces the current password.
3674
- * Adopted native credentials remain protected by the credential service's ownership guard.
3674
+ * An authorized reset may rotate an adopted credential; its ownership binding remains intact.
3675
3675
  * @summary Explicitly reset the mailbox password to a new version and reveal it once
3676
3676
  * {@link /c/:company/email/domains/:emailDomainUuid/mailboxes/:mailboxUuid/credential/reset}
3677
3677
  */
@@ -36939,7 +36939,7 @@ function writeUpdateState(state, env = process.env) {
36939
36939
  }
36940
36940
  //#endregion
36941
36941
  //#region src/version.ts
36942
- var VERSION = "0.0.0-dev";
36942
+ var VERSION = "1.0.377";
36943
36943
  //#endregion
36944
36944
  //#region src/commands/update.ts
36945
36945
  /**
@@ -37014,7 +37014,7 @@ var update = {
37014
37014
  }, process.env);
37015
37015
  return {
37016
37016
  ...known,
37017
- current: after ?? "0.0.0-dev",
37017
+ current: after ?? "1.0.377",
37018
37018
  latest: after ?? latest,
37019
37019
  upToDate: after !== null && (latest === null || !isNewerVersion(latest, after)),
37020
37020
  action: "run",
@@ -37252,6 +37252,13 @@ function startsWith(path, prefix) {
37252
37252
  return prefix.every((one, index) => path[index] === one);
37253
37253
  }
37254
37254
  /**
37255
+ * How long the notice waits for the lock that guards the state file.
37256
+ *
37257
+ * Short, because the notice runs beside a command a person is waiting on: a machine that is busy updating
37258
+ * its session is not a reason to hold this one up, and the check simply happens again next time.
37259
+ */
37260
+ var NOTICE_LOCK_WAIT_MS = 150;
37261
+ /**
37255
37262
  * Tell the client, once a day, that a newer version is published.
37256
37263
  *
37257
37264
  * The notice goes to stderr, so it never mixes into a command's output, and it names `hostingctl update`
@@ -37260,6 +37267,34 @@ function startsWith(path, prefix) {
37260
37267
  */
37261
37268
  async function printUpdateNotice(options) {
37262
37269
  if (options.json) return;
37270
+ const env = options.env ?? process.env;
37271
+ if (isSet(env.CI)) return;
37272
+ if (isSet(env.HOSTINGCTL_NO_UPDATE_CHECK)) return;
37273
+ const state = readUpdateState(env);
37274
+ const now = Date.now();
37275
+ if (state !== null && now - state.checkedAt < 864e5) return;
37276
+ const latest = await latestVersion();
37277
+ try {
37278
+ mkdirSync(credentialDirectory(env), {
37279
+ recursive: true,
37280
+ mode: 448
37281
+ });
37282
+ await withCredentialLock(async () => {
37283
+ writeUpdateState({
37284
+ method: state?.method ?? null,
37285
+ entry: state?.entry ?? "",
37286
+ checkedAt: now,
37287
+ latest
37288
+ }, env);
37289
+ }, env, { waitMs: NOTICE_LOCK_WAIT_MS });
37290
+ } catch {}
37291
+ if (latest === null) return;
37292
+ if (!isNewerVersion(latest, "1.0.377")) return;
37293
+ process.stderr.write(`A newer hostingctl is published: ${latest} (this copy is ${VERSION}). Run \`hostingctl update\` to update.\n`);
37294
+ }
37295
+ /** Whether an environment variable is set to something, which is how CI and the opt-out are read. */
37296
+ function isSet(value) {
37297
+ return value !== void 0 && value !== "";
37263
37298
  }
37264
37299
  //#endregion
37265
37300
  //#region src/main.ts