@tinycloud/cli 1.3.0-beta.28 → 1.3.0-beta.29
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 +18 -2
- package/dist/index.js.map +1 -1
- package/dist/legacy-entry.js +18 -2
- package/dist/legacy-entry.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3757,6 +3757,20 @@ import { join as join5 } from "path";
|
|
|
3757
3757
|
import { CLI_NAME as CLI_NAME8 } from "@tinycloud/operations/cli-name";
|
|
3758
3758
|
import { profilePath as profilePath2, withProfileLock as withProfileLock2 } from "@tinycloud/operations/state";
|
|
3759
3759
|
import { REPLICA_LOGOUT_PENDING_FILE, sqliteReplicaStorage } from "@tinycloud/node-sdk";
|
|
3760
|
+
import { DEFAULT_GRANT_TTL_MS, MAX_GRANT_TTL_MS } from "@tinycloud/sdk-services/kv/replication/contractConstants";
|
|
3761
|
+
function readPositiveIntegerEnv(name, max) {
|
|
3762
|
+
const raw = process.env[name];
|
|
3763
|
+
if (raw === void 0) return void 0;
|
|
3764
|
+
const value = /^[1-9][0-9]*$/.test(raw) ? Number(raw) : Number.NaN;
|
|
3765
|
+
if (!Number.isSafeInteger(value) || value > max) {
|
|
3766
|
+
throw new CLIError(
|
|
3767
|
+
"INVALID_REPLICATION_ENV",
|
|
3768
|
+
`${name} must be a positive integer no greater than ${max}, got ${JSON.stringify(raw)}`,
|
|
3769
|
+
ExitCode.USAGE_ERROR
|
|
3770
|
+
);
|
|
3771
|
+
}
|
|
3772
|
+
return value;
|
|
3773
|
+
}
|
|
3760
3774
|
function createCliReplicationConfig(profile, settings, output, enabled) {
|
|
3761
3775
|
if (!enabled || !settings || settings.prefixes.length === 0) return void 0;
|
|
3762
3776
|
for (const prefix of settings.prefixes) {
|
|
@@ -3782,6 +3796,8 @@ function createCliReplicationConfig(profile, settings, output, enabled) {
|
|
|
3782
3796
|
verify: process.env.TC_REPLICATION_VERIFY === "1",
|
|
3783
3797
|
maxStalenessMs: Number(process.env.TC_REPLICATION_MAX_STALENESS_MS ?? 6e4),
|
|
3784
3798
|
staleSyncTimeoutMs: Number(process.env.TC_REPLICATION_SYNC_TIMEOUT_MS ?? 1e4),
|
|
3799
|
+
grantTtlMs: readPositiveIntegerEnv("TC_REPLICATION_GRANT_TTL_MS", MAX_GRANT_TTL_MS) ?? DEFAULT_GRANT_TTL_MS,
|
|
3800
|
+
maxBytes: readPositiveIntegerEnv("TC_REPLICATION_MAX_BYTES", Number.MAX_SAFE_INTEGER),
|
|
3785
3801
|
storage: sqliteReplicaStorage({
|
|
3786
3802
|
dir: join5(root, "replication"),
|
|
3787
3803
|
logoutPendingFile: join5(root, REPLICA_LOGOUT_PENDING_FILE),
|
|
@@ -3931,13 +3947,13 @@ async function readState(profileDir) {
|
|
|
3931
3947
|
function readGateSnapshot(profileDir) {
|
|
3932
3948
|
return readState(profileDir);
|
|
3933
3949
|
}
|
|
3934
|
-
var HOUR_MS, DAY_MS,
|
|
3950
|
+
var HOUR_MS, DAY_MS, MAX_GRANT_TTL_MS2, CONSENT_WINDOW_MS, DEFAULT_MIN_FREE_BYTES, REPLICA_GATE_FILE, ReplicaErrorCode2, REPLICA_ERROR2, ReplicaError2, GATE_FILE_VERSION, REPLICA_DENY_FLOOR_FILE, DENY_FLOOR_FILE, LOST_GATE_RECOVERY, INTERRUPTED_SIGN_OUT;
|
|
3935
3951
|
var init_profile_gate = __esm({
|
|
3936
3952
|
"../replica/dist/profile-gate.js"() {
|
|
3937
3953
|
"use strict";
|
|
3938
3954
|
HOUR_MS = 60 * 60 * 1e3;
|
|
3939
3955
|
DAY_MS = 24 * HOUR_MS;
|
|
3940
|
-
|
|
3956
|
+
MAX_GRANT_TTL_MS2 = 7 * DAY_MS;
|
|
3941
3957
|
CONSENT_WINDOW_MS = 7 * DAY_MS;
|
|
3942
3958
|
DEFAULT_MIN_FREE_BYTES = 64 * 1024 * 1024;
|
|
3943
3959
|
REPLICA_GATE_FILE = "replica-gate.json";
|