@tinycloud/cli 1.3.0-beta.28 → 1.3.0-beta.30
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 +5 -5
package/dist/legacy-entry.js
CHANGED
|
@@ -5997,6 +5997,20 @@ import { join as join5 } from "path";
|
|
|
5997
5997
|
import { CLI_NAME as CLI_NAME6 } from "@tinycloud/operations/cli-name";
|
|
5998
5998
|
import { profilePath as profilePath2, withProfileLock as withProfileLock2 } from "@tinycloud/operations/state";
|
|
5999
5999
|
import { REPLICA_LOGOUT_PENDING_FILE, sqliteReplicaStorage } from "@tinycloud/node-sdk";
|
|
6000
|
+
import { DEFAULT_GRANT_TTL_MS, MAX_GRANT_TTL_MS } from "@tinycloud/sdk-services/kv/replication/contractConstants";
|
|
6001
|
+
function readPositiveIntegerEnv(name, max) {
|
|
6002
|
+
const raw = process.env[name];
|
|
6003
|
+
if (raw === void 0) return void 0;
|
|
6004
|
+
const value = /^[1-9][0-9]*$/.test(raw) ? Number(raw) : Number.NaN;
|
|
6005
|
+
if (!Number.isSafeInteger(value) || value > max) {
|
|
6006
|
+
throw new CLIError(
|
|
6007
|
+
"INVALID_REPLICATION_ENV",
|
|
6008
|
+
`${name} must be a positive integer no greater than ${max}, got ${JSON.stringify(raw)}`,
|
|
6009
|
+
ExitCode.USAGE_ERROR
|
|
6010
|
+
);
|
|
6011
|
+
}
|
|
6012
|
+
return value;
|
|
6013
|
+
}
|
|
6000
6014
|
function createCliReplicationConfig(profile, settings, output2, enabled) {
|
|
6001
6015
|
if (!enabled || !settings || settings.prefixes.length === 0) return void 0;
|
|
6002
6016
|
for (const prefix of settings.prefixes) {
|
|
@@ -6022,6 +6036,8 @@ function createCliReplicationConfig(profile, settings, output2, enabled) {
|
|
|
6022
6036
|
verify: process.env.TC_REPLICATION_VERIFY === "1",
|
|
6023
6037
|
maxStalenessMs: Number(process.env.TC_REPLICATION_MAX_STALENESS_MS ?? 6e4),
|
|
6024
6038
|
staleSyncTimeoutMs: Number(process.env.TC_REPLICATION_SYNC_TIMEOUT_MS ?? 1e4),
|
|
6039
|
+
grantTtlMs: readPositiveIntegerEnv("TC_REPLICATION_GRANT_TTL_MS", MAX_GRANT_TTL_MS) ?? DEFAULT_GRANT_TTL_MS,
|
|
6040
|
+
maxBytes: readPositiveIntegerEnv("TC_REPLICATION_MAX_BYTES", Number.MAX_SAFE_INTEGER),
|
|
6025
6041
|
storage: sqliteReplicaStorage({
|
|
6026
6042
|
dir: join5(root, "replication"),
|
|
6027
6043
|
logoutPendingFile: join5(root, REPLICA_LOGOUT_PENDING_FILE),
|
|
@@ -6232,13 +6248,13 @@ async function restoreSessionStamp(profileDir, principal, persisted) {
|
|
|
6232
6248
|
}
|
|
6233
6249
|
return { incarnation: persisted.incarnation, lifecycleEpoch: persisted.lifecycleEpoch };
|
|
6234
6250
|
}
|
|
6235
|
-
var HOUR_MS, DAY_MS,
|
|
6251
|
+
var HOUR_MS, DAY_MS, MAX_GRANT_TTL_MS2, CONSENT_WINDOW_MS, DEFAULT_MIN_FREE_BYTES, REPLICA_GATE_FILE, ReplicaErrorCode2, REPLICA_ERROR2, ReplicaError2, saltedHash, GATE_FILE_VERSION, REPLICA_DENY_FLOOR_FILE, DENY_FLOOR_FILE, LOST_GATE_RECOVERY, INTERRUPTED_SIGN_OUT;
|
|
6236
6252
|
var init_profile_gate = __esm({
|
|
6237
6253
|
"../replica/dist/profile-gate.js"() {
|
|
6238
6254
|
"use strict";
|
|
6239
6255
|
HOUR_MS = 60 * 60 * 1e3;
|
|
6240
6256
|
DAY_MS = 24 * HOUR_MS;
|
|
6241
|
-
|
|
6257
|
+
MAX_GRANT_TTL_MS2 = 7 * DAY_MS;
|
|
6242
6258
|
CONSENT_WINDOW_MS = 7 * DAY_MS;
|
|
6243
6259
|
DEFAULT_MIN_FREE_BYTES = 64 * 1024 * 1024;
|
|
6244
6260
|
REPLICA_GATE_FILE = "replica-gate.json";
|