@rudderhq/cli 0.2.7-canary.10 → 0.2.7-canary.12

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