@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 +20 -1
- package/dist/index.js.map +1 -1
- package/dist/legacy-entry.js +21 -3
- package/dist/legacy-entry.js.map +1 -1
- package/package.json +7 -7
package/dist/legacy-entry.js
CHANGED
|
@@ -3052,6 +3052,16 @@ var init_delegation_expiry = __esm({
|
|
|
3052
3052
|
}
|
|
3053
3053
|
});
|
|
3054
3054
|
|
|
3055
|
+
// src/lib/retry-policy.ts
|
|
3056
|
+
function cliRetryPolicy() {
|
|
3057
|
+
return process.env.TINYCLOUD_RETRY === "0" ? { retryPolicy: { maxAttempts: 1 } } : {};
|
|
3058
|
+
}
|
|
3059
|
+
var init_retry_policy = __esm({
|
|
3060
|
+
"src/lib/retry-policy.ts"() {
|
|
3061
|
+
"use strict";
|
|
3062
|
+
}
|
|
3063
|
+
});
|
|
3064
|
+
|
|
3055
3065
|
// src/lib/replication-log.ts
|
|
3056
3066
|
import { CLI_NAME as CLI_NAME5 } from "@tinycloud/operations/cli-name";
|
|
3057
3067
|
import { appendFileSync, chmodSync, mkdirSync, renameSync, statSync, writeFileSync } from "fs";
|
|
@@ -9081,6 +9091,7 @@ async function storedSessionVerifiesLocally(profileName2) {
|
|
|
9081
9091
|
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;
|
|
9082
9092
|
const key = await ProfileManager.getKey(profileName2);
|
|
9083
9093
|
const node = new TinyCloudNode({
|
|
9094
|
+
...cliRetryPolicy(),
|
|
9084
9095
|
host: profile.host ?? DEFAULT_HOST,
|
|
9085
9096
|
...local ? { privateKey: profile.privateKey } : {}
|
|
9086
9097
|
});
|
|
@@ -9126,6 +9137,7 @@ async function createSDKInstance(ctx, options) {
|
|
|
9126
9137
|
process.stderr.write("[replication] Enabled, but this profile has no configured prefixes; reads use the network.\n");
|
|
9127
9138
|
}
|
|
9128
9139
|
const node2 = new TinyCloudNode({
|
|
9140
|
+
...cliRetryPolicy(),
|
|
9129
9141
|
host: ctx.host,
|
|
9130
9142
|
privateKey: effectivePrivateKey,
|
|
9131
9143
|
...replication2 ? { replication: replication2 } : {}
|
|
@@ -9166,6 +9178,7 @@ async function createSDKInstance(ctx, options) {
|
|
|
9166
9178
|
process.stderr.write("[replication] Enabled, but this profile has no configured prefixes; reads use the network.\n");
|
|
9167
9179
|
}
|
|
9168
9180
|
const node = new TinyCloudNode({
|
|
9181
|
+
...cliRetryPolicy(),
|
|
9169
9182
|
host: ctx.host,
|
|
9170
9183
|
privateKey: options?.privateKey,
|
|
9171
9184
|
...replication ? { replication } : {}
|
|
@@ -9329,6 +9342,7 @@ var init_sdk = __esm({
|
|
|
9329
9342
|
init_session_expired();
|
|
9330
9343
|
init_warnings();
|
|
9331
9344
|
init_delegation_expiry();
|
|
9345
|
+
init_retry_policy();
|
|
9332
9346
|
init_replication_config();
|
|
9333
9347
|
init_replication_registry();
|
|
9334
9348
|
init_logout_pending();
|
|
@@ -15450,6 +15464,9 @@ async function kvHandle(node, spaceInput, profileName2) {
|
|
|
15450
15464
|
const kv = spaceUri ? node.kvForSpace(spaceUri) : node.kv;
|
|
15451
15465
|
return { kv, spaceUri };
|
|
15452
15466
|
}
|
|
15467
|
+
function retryFields(retry) {
|
|
15468
|
+
return retry ? { attempts: retry.attempts, backoffMs: retry.backoffMs } : {};
|
|
15469
|
+
}
|
|
15453
15470
|
function registerKvCommand(program) {
|
|
15454
15471
|
const kv = program.command("kv").description("Key-value store operations");
|
|
15455
15472
|
kv.command("get <key>").description("Get a value by key").option("--raw", "Output raw value (no JSON wrapping)").option("-o, --output <file>", "Write value to file").option("--space <name|uri>", "Target a non-primary space (short name or full URI)").action(async (key, options, cmd) => {
|
|
@@ -15487,7 +15504,8 @@ function registerKvCommand(program) {
|
|
|
15487
15504
|
outputJson({
|
|
15488
15505
|
key,
|
|
15489
15506
|
data,
|
|
15490
|
-
metadata
|
|
15507
|
+
metadata,
|
|
15508
|
+
...retryFields(result.data.retry)
|
|
15491
15509
|
});
|
|
15492
15510
|
} else {
|
|
15493
15511
|
const content = typeof data === "string" ? data : JSON.stringify(data);
|
|
@@ -15527,7 +15545,7 @@ function registerKvCommand(program) {
|
|
|
15527
15545
|
if (!result.ok) {
|
|
15528
15546
|
await throwKvError(result.error, spaceUri, ctx.profile);
|
|
15529
15547
|
}
|
|
15530
|
-
outputJson({ key, written: true });
|
|
15548
|
+
outputJson({ key, written: true, ...retryFields(result.data?.retry) });
|
|
15531
15549
|
} catch (error) {
|
|
15532
15550
|
return handleError(error);
|
|
15533
15551
|
}
|
|
@@ -15543,7 +15561,7 @@ function registerKvCommand(program) {
|
|
|
15543
15561
|
if (!result.ok) {
|
|
15544
15562
|
await throwKvError(result.error, spaceUri, ctx.profile);
|
|
15545
15563
|
}
|
|
15546
|
-
outputJson({ key, deleted: true });
|
|
15564
|
+
outputJson({ key, deleted: true, ...retryFields(result.data?.retry) });
|
|
15547
15565
|
} catch (error) {
|
|
15548
15566
|
return handleError(error);
|
|
15549
15567
|
}
|