@rudderhq/cli 0.2.7-canary.10 → 0.2.7-canary.11
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 +38 -1
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2598,11 +2598,12 @@ var init_project_mentions = __esm({
|
|
|
2598
2598
|
|
|
2599
2599
|
// ../packages/shared/dist/config-schema.js
|
|
2600
2600
|
import { z as z27 } from "zod";
|
|
2601
|
-
var configMetaSchema, llmConfigSchema, databaseBackupConfigSchema, databaseConfigSchema, loggingConfigSchema, serverConfigSchema, authConfigSchema, storageLocalDiskConfigSchema, storageS3ConfigSchema, storageConfigSchema, secretsLocalEncryptedConfigSchema, secretsConfigSchema, langfuseConfigSchema, rudderConfigSchema;
|
|
2601
|
+
var DEFAULT_DATABASE_BACKUP_MAX_ESTIMATED_BYTES, configMetaSchema, llmConfigSchema, databaseBackupConfigSchema, databaseConfigSchema, loggingConfigSchema, serverConfigSchema, authConfigSchema, storageLocalDiskConfigSchema, storageS3ConfigSchema, storageConfigSchema, secretsLocalEncryptedConfigSchema, secretsConfigSchema, langfuseConfigSchema, rudderConfigSchema;
|
|
2602
2602
|
var init_config_schema = __esm({
|
|
2603
2603
|
"../packages/shared/dist/config-schema.js"() {
|
|
2604
2604
|
"use strict";
|
|
2605
2605
|
init_constants();
|
|
2606
|
+
DEFAULT_DATABASE_BACKUP_MAX_ESTIMATED_BYTES = 256 * 1024 * 1024;
|
|
2606
2607
|
configMetaSchema = z27.object({
|
|
2607
2608
|
version: z27.literal(1),
|
|
2608
2609
|
updatedAt: z27.string(),
|
|
@@ -2616,6 +2617,7 @@ var init_config_schema = __esm({
|
|
|
2616
2617
|
enabled: z27.boolean().default(true),
|
|
2617
2618
|
intervalMinutes: z27.number().int().min(1).max(7 * 24 * 60).default(60),
|
|
2618
2619
|
retentionDays: z27.number().int().min(1).max(3650).default(30),
|
|
2620
|
+
maxEstimatedBytes: z27.number().int().min(1).default(DEFAULT_DATABASE_BACKUP_MAX_ESTIMATED_BYTES),
|
|
2619
2621
|
dir: z27.string().default("~/.rudder/instances/default/data/backups")
|
|
2620
2622
|
});
|
|
2621
2623
|
databaseConfigSchema = z27.object({
|
|
@@ -2627,6 +2629,7 @@ var init_config_schema = __esm({
|
|
|
2627
2629
|
enabled: true,
|
|
2628
2630
|
intervalMinutes: 60,
|
|
2629
2631
|
retentionDays: 30,
|
|
2632
|
+
maxEstimatedBytes: DEFAULT_DATABASE_BACKUP_MAX_ESTIMATED_BYTES,
|
|
2630
2633
|
dir: "~/.rudder/instances/default/data/backups"
|
|
2631
2634
|
})
|
|
2632
2635
|
});
|
|
@@ -3140,6 +3143,7 @@ async function promptDatabase(current) {
|
|
|
3140
3143
|
enabled: true,
|
|
3141
3144
|
intervalMinutes: 60,
|
|
3142
3145
|
retentionDays: 30,
|
|
3146
|
+
maxEstimatedBytes: DEFAULT_DATABASE_BACKUP_MAX_ESTIMATED_BYTES,
|
|
3143
3147
|
dir: defaultBackupDir
|
|
3144
3148
|
}
|
|
3145
3149
|
};
|
|
@@ -3248,6 +3252,20 @@ async function promptDatabase(current) {
|
|
|
3248
3252
|
p.cancel("Setup cancelled.");
|
|
3249
3253
|
process.exit(0);
|
|
3250
3254
|
}
|
|
3255
|
+
const backupMaxEstimatedInput = await p.text({
|
|
3256
|
+
message: "Scheduled backup max database estimate (bytes)",
|
|
3257
|
+
defaultValue: String(base.backup.maxEstimatedBytes || DEFAULT_DATABASE_BACKUP_MAX_ESTIMATED_BYTES),
|
|
3258
|
+
placeholder: String(DEFAULT_DATABASE_BACKUP_MAX_ESTIMATED_BYTES),
|
|
3259
|
+
validate: (val) => {
|
|
3260
|
+
const n = Number(val);
|
|
3261
|
+
if (!Number.isInteger(n) || n < 1) return "Max estimate must be a positive integer byte count";
|
|
3262
|
+
return void 0;
|
|
3263
|
+
}
|
|
3264
|
+
});
|
|
3265
|
+
if (p.isCancel(backupMaxEstimatedInput)) {
|
|
3266
|
+
p.cancel("Setup cancelled.");
|
|
3267
|
+
process.exit(0);
|
|
3268
|
+
}
|
|
3251
3269
|
return {
|
|
3252
3270
|
mode,
|
|
3253
3271
|
connectionString,
|
|
@@ -3257,6 +3275,7 @@ async function promptDatabase(current) {
|
|
|
3257
3275
|
enabled: backupEnabled,
|
|
3258
3276
|
intervalMinutes: Number(backupIntervalInput || "60"),
|
|
3259
3277
|
retentionDays: Number(backupRetentionInput || "30"),
|
|
3278
|
+
maxEstimatedBytes: Number(backupMaxEstimatedInput || String(DEFAULT_DATABASE_BACKUP_MAX_ESTIMATED_BYTES)),
|
|
3260
3279
|
dir: backupDirInput || defaultBackupDir
|
|
3261
3280
|
}
|
|
3262
3281
|
};
|
|
@@ -3264,6 +3283,7 @@ async function promptDatabase(current) {
|
|
|
3264
3283
|
var init_database = __esm({
|
|
3265
3284
|
"src/prompts/database.ts"() {
|
|
3266
3285
|
"use strict";
|
|
3286
|
+
init_schema();
|
|
3267
3287
|
init_home();
|
|
3268
3288
|
}
|
|
3269
3289
|
});
|
|
@@ -5471,6 +5491,18 @@ function parseNumberFromEnv(rawValue) {
|
|
|
5471
5491
|
if (!Number.isFinite(parsed)) return null;
|
|
5472
5492
|
return parsed;
|
|
5473
5493
|
}
|
|
5494
|
+
function parseBytesFromEnv(rawValue) {
|
|
5495
|
+
const value = rawValue?.trim();
|
|
5496
|
+
if (!value) return null;
|
|
5497
|
+
const match = value.match(/^(\d+(?:\.\d+)?)\s*(b|kb|kib|mb|mib|gb|gib)?$/i);
|
|
5498
|
+
if (!match) return null;
|
|
5499
|
+
const amount = Number(match[1]);
|
|
5500
|
+
const unit = match[2]?.toLowerCase() ?? "b";
|
|
5501
|
+
const multiplier = unit === "gb" || unit === "gib" ? 1024 ** 3 : unit === "mb" || unit === "mib" ? 1024 ** 2 : unit === "kb" || unit === "kib" ? 1024 : 1;
|
|
5502
|
+
const parsed = Math.floor(amount * multiplier);
|
|
5503
|
+
if (!Number.isSafeInteger(parsed) || parsed < 1) return null;
|
|
5504
|
+
return parsed;
|
|
5505
|
+
}
|
|
5474
5506
|
function parseEnumFromEnv(rawValue, allowedValues) {
|
|
5475
5507
|
if (!rawValue) return null;
|
|
5476
5508
|
return allowedValues.includes(rawValue) ? rawValue : null;
|
|
@@ -5516,6 +5548,7 @@ function quickstartDefaultsFromEnv() {
|
|
|
5516
5548
|
1,
|
|
5517
5549
|
parseNumberFromEnv(process.env.RUDDER_DB_BACKUP_RETENTION_DAYS) ?? 30
|
|
5518
5550
|
);
|
|
5551
|
+
const databaseBackupMaxEstimatedBytes = parseBytesFromEnv(process.env.RUDDER_DB_BACKUP_MAX_ESTIMATED_BYTES) ?? DEFAULT_DATABASE_BACKUP_MAX_ESTIMATED_BYTES;
|
|
5519
5552
|
const defaults = {
|
|
5520
5553
|
database: {
|
|
5521
5554
|
mode: databaseUrl ? "postgres" : "embedded-postgres",
|
|
@@ -5529,6 +5562,7 @@ function quickstartDefaultsFromEnv() {
|
|
|
5529
5562
|
enabled: databaseBackupEnabled,
|
|
5530
5563
|
intervalMinutes: databaseBackupIntervalMinutes,
|
|
5531
5564
|
retentionDays: databaseBackupRetentionDays,
|
|
5565
|
+
maxEstimatedBytes: databaseBackupMaxEstimatedBytes,
|
|
5532
5566
|
dir: resolvePathFromEnv(process.env.RUDDER_DB_BACKUP_DIR) ?? resolveDefaultBackupDir(instanceId)
|
|
5533
5567
|
}
|
|
5534
5568
|
},
|
|
@@ -5880,6 +5914,7 @@ var init_onboard = __esm({
|
|
|
5880
5914
|
"RUDDER_DB_BACKUP_INTERVAL_MINUTES",
|
|
5881
5915
|
"RUDDER_DB_BACKUP_RETENTION_DAYS",
|
|
5882
5916
|
"RUDDER_DB_BACKUP_DIR",
|
|
5917
|
+
"RUDDER_DB_BACKUP_MAX_ESTIMATED_BYTES",
|
|
5883
5918
|
"RUDDER_DEPLOYMENT_MODE",
|
|
5884
5919
|
"RUDDER_DEPLOYMENT_EXPOSURE",
|
|
5885
5920
|
"HOST",
|
|
@@ -6211,6 +6246,7 @@ function quoteShellValue(value) {
|
|
|
6211
6246
|
|
|
6212
6247
|
// src/commands/configure.ts
|
|
6213
6248
|
init_store();
|
|
6249
|
+
init_schema();
|
|
6214
6250
|
init_secrets_key();
|
|
6215
6251
|
init_database();
|
|
6216
6252
|
init_llm();
|
|
@@ -6248,6 +6284,7 @@ function defaultConfig() {
|
|
|
6248
6284
|
enabled: true,
|
|
6249
6285
|
intervalMinutes: 60,
|
|
6250
6286
|
retentionDays: 30,
|
|
6287
|
+
maxEstimatedBytes: DEFAULT_DATABASE_BACKUP_MAX_ESTIMATED_BYTES,
|
|
6251
6288
|
dir: resolveDefaultBackupDir(instanceId)
|
|
6252
6289
|
}
|
|
6253
6290
|
},
|