@tinycloud/cli 1.3.0-beta.25 → 1.3.0-beta.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1666,6 +1666,19 @@ var init_delegation_expiry = __esm({
1666
1666
  }
1667
1667
  });
1668
1668
 
1669
+ // src/lib/retry-policy.ts
1670
+ function cliRetryPolicy() {
1671
+ return process.env.TINYCLOUD_RETRY === "0" ? { retryPolicy: { maxAttempts: 1 } } : {};
1672
+ }
1673
+ function applyNoRetryFlag(opts) {
1674
+ if (opts.retry === false) process.env.TINYCLOUD_RETRY = "0";
1675
+ }
1676
+ var init_retry_policy = __esm({
1677
+ "src/lib/retry-policy.ts"() {
1678
+ "use strict";
1679
+ }
1680
+ });
1681
+
1669
1682
  // src/lib/replication-log.ts
1670
1683
  import { CLI_NAME as CLI_NAME7 } from "@tinycloud/operations/cli-name";
1671
1684
  import { appendFileSync, chmodSync, mkdirSync, renameSync, statSync, writeFileSync } from "fs";
@@ -6740,6 +6753,7 @@ async function storedSessionVerifiesLocally(profileName) {
6740
6753
  if (!session || typeof session.delegationCid !== "string" || typeof session.spaceId !== "string" || session.delegationHeader === null || typeof session.delegationHeader !== "object" || !("Authorization" in session.delegationHeader) || typeof session.delegationHeader.Authorization !== "string") return true;
6741
6754
  const key = await ProfileManager.getKey(profileName);
6742
6755
  const node = new TinyCloudNode({
6756
+ ...cliRetryPolicy(),
6743
6757
  host: profile.host ?? DEFAULT_HOST,
6744
6758
  ...local ? { privateKey: profile.privateKey } : {}
6745
6759
  });
@@ -6785,6 +6799,7 @@ async function createSDKInstance(ctx, options) {
6785
6799
  process.stderr.write("[replication] Enabled, but this profile has no configured prefixes; reads use the network.\n");
6786
6800
  }
6787
6801
  const node2 = new TinyCloudNode({
6802
+ ...cliRetryPolicy(),
6788
6803
  host: ctx.host,
6789
6804
  privateKey: effectivePrivateKey,
6790
6805
  ...replication2 ? { replication: replication2 } : {}
@@ -6825,6 +6840,7 @@ async function createSDKInstance(ctx, options) {
6825
6840
  process.stderr.write("[replication] Enabled, but this profile has no configured prefixes; reads use the network.\n");
6826
6841
  }
6827
6842
  const node = new TinyCloudNode({
6843
+ ...cliRetryPolicy(),
6828
6844
  host: ctx.host,
6829
6845
  privateKey: options?.privateKey,
6830
6846
  ...replication ? { replication } : {}
@@ -6988,6 +7004,7 @@ var init_sdk = __esm({
6988
7004
  init_session_expired();
6989
7005
  init_warnings();
6990
7006
  init_delegation_expiry();
7007
+ init_retry_policy();
6991
7008
  init_replication_config();
6992
7009
  init_replication_registry();
6993
7010
  init_logout_pending();
@@ -27631,6 +27648,7 @@ async function loadCourierEntry() {
27631
27648
  }
27632
27649
 
27633
27650
  // src/index.ts
27651
+ init_retry_policy();
27634
27652
  var { version } = JSON.parse(
27635
27653
  readFileSync2(new URL("../package.json", import.meta.url), "utf-8")
27636
27654
  );
@@ -27648,10 +27666,11 @@ function selectedShareProfile() {
27648
27666
  }
27649
27667
  return process.env.TC_PROFILE;
27650
27668
  }
27651
- program.name(CLI_NAME13).description("TinyCloud CLI \u2014 self-sovereign storage from the terminal").version(version).option("-p, --profile <name>", "Profile to use").option("-H, --host <url>", "TinyCloud node URL").option("-v, --verbose", "Enable verbose output").option("--no-cache", "Disable caching").option("-q, --quiet", "Suppress non-essential output").option("--json", "Force JSON output").option("--replication", "Enable read-through replication for this invocation").option("--no-replication", "Disable read-through replication for this invocation").option("--replication-debug", "Write replication diagnostics to stderr");
27669
+ program.name(CLI_NAME13).description("TinyCloud CLI \u2014 self-sovereign storage from the terminal").version(version).option("-p, --profile <name>", "Profile to use").option("-H, --host <url>", "TinyCloud node URL").option("-v, --verbose", "Enable verbose output").option("--no-cache", "Disable caching").option("-q, --quiet", "Suppress non-essential output").option("--json", "Force JSON output").option("--no-retry", "Do not retry node busy/timeout answers (monitors and probes); same as TINYCLOUD_RETRY=0").option("--replication", "Enable read-through replication for this invocation").option("--no-replication", "Disable read-through replication for this invocation").option("--replication-debug", "Write replication diagnostics to stderr");
27652
27670
  program.hook("preAction", async (thisCommand) => {
27653
27671
  const opts = thisCommand.optsWithGlobals();
27654
27672
  setJsonOutputRequested(opts.json === true);
27673
+ applyNoRetryFlag(opts);
27655
27674
  const parentName = thisCommand.parent?.name();
27656
27675
  const isShareCommand = parentName === "share" || thisCommand.name() === "share";
27657
27676
  if (!opts.quiet && !isShareCommand) {