@rulebricks/cli 1.9.0

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.
Files changed (93) hide show
  1. package/README.md +62 -0
  2. package/dist/commands/clone.d.ts +6 -0
  3. package/dist/commands/clone.js +60 -0
  4. package/dist/commands/deploy.d.ts +8 -0
  5. package/dist/commands/deploy.js +409 -0
  6. package/dist/commands/destroy.d.ts +8 -0
  7. package/dist/commands/destroy.js +298 -0
  8. package/dist/commands/init.d.ts +7 -0
  9. package/dist/commands/init.js +201 -0
  10. package/dist/commands/logs.d.ts +9 -0
  11. package/dist/commands/logs.js +222 -0
  12. package/dist/commands/open.d.ts +7 -0
  13. package/dist/commands/open.js +139 -0
  14. package/dist/commands/status.d.ts +5 -0
  15. package/dist/commands/status.js +125 -0
  16. package/dist/commands/upgrade.d.ts +7 -0
  17. package/dist/commands/upgrade.js +239 -0
  18. package/dist/components/DNSWaitScreen.d.ts +9 -0
  19. package/dist/components/DNSWaitScreen.js +73 -0
  20. package/dist/components/Wizard/WizardContext.d.ts +176 -0
  21. package/dist/components/Wizard/WizardContext.js +346 -0
  22. package/dist/components/Wizard/index.d.ts +2 -0
  23. package/dist/components/Wizard/index.js +2 -0
  24. package/dist/components/Wizard/steps/CloudProviderStep.d.ts +6 -0
  25. package/dist/components/Wizard/steps/CloudProviderStep.js +210 -0
  26. package/dist/components/Wizard/steps/CredentialsStep.d.ts +6 -0
  27. package/dist/components/Wizard/steps/CredentialsStep.js +22 -0
  28. package/dist/components/Wizard/steps/DatabaseStep.d.ts +6 -0
  29. package/dist/components/Wizard/steps/DatabaseStep.js +80 -0
  30. package/dist/components/Wizard/steps/DeploymentModeStep.d.ts +5 -0
  31. package/dist/components/Wizard/steps/DeploymentModeStep.js +26 -0
  32. package/dist/components/Wizard/steps/DomainStep.d.ts +6 -0
  33. package/dist/components/Wizard/steps/DomainStep.js +126 -0
  34. package/dist/components/Wizard/steps/FeatureConfigStep.d.ts +6 -0
  35. package/dist/components/Wizard/steps/FeatureConfigStep.js +765 -0
  36. package/dist/components/Wizard/steps/FeaturesStep.d.ts +6 -0
  37. package/dist/components/Wizard/steps/FeaturesStep.js +119 -0
  38. package/dist/components/Wizard/steps/ReviewStep.d.ts +6 -0
  39. package/dist/components/Wizard/steps/ReviewStep.js +56 -0
  40. package/dist/components/Wizard/steps/SMTPStep.d.ts +6 -0
  41. package/dist/components/Wizard/steps/SMTPStep.js +191 -0
  42. package/dist/components/Wizard/steps/SupabaseCredentialsStep.d.ts +6 -0
  43. package/dist/components/Wizard/steps/SupabaseCredentialsStep.js +76 -0
  44. package/dist/components/Wizard/steps/TierStep.d.ts +6 -0
  45. package/dist/components/Wizard/steps/TierStep.js +29 -0
  46. package/dist/components/Wizard/steps/VersionStep.d.ts +6 -0
  47. package/dist/components/Wizard/steps/VersionStep.js +113 -0
  48. package/dist/components/Wizard/steps/index.d.ts +12 -0
  49. package/dist/components/Wizard/steps/index.js +12 -0
  50. package/dist/components/common/AppShell.d.ts +31 -0
  51. package/dist/components/common/AppShell.js +31 -0
  52. package/dist/components/common/Box.d.ts +20 -0
  53. package/dist/components/common/Box.js +20 -0
  54. package/dist/components/common/Logo.d.ts +7 -0
  55. package/dist/components/common/Logo.js +22 -0
  56. package/dist/components/common/Spinner.d.ts +12 -0
  57. package/dist/components/common/Spinner.js +28 -0
  58. package/dist/components/common/index.d.ts +6 -0
  59. package/dist/components/common/index.js +5 -0
  60. package/dist/index.d.ts +2 -0
  61. package/dist/index.js +202 -0
  62. package/dist/lib/cloudCli.d.ts +156 -0
  63. package/dist/lib/cloudCli.js +691 -0
  64. package/dist/lib/config.d.ts +91 -0
  65. package/dist/lib/config.js +278 -0
  66. package/dist/lib/dns.d.ts +41 -0
  67. package/dist/lib/dns.js +235 -0
  68. package/dist/lib/dockerHub.d.ts +57 -0
  69. package/dist/lib/dockerHub.js +128 -0
  70. package/dist/lib/helm.d.ts +53 -0
  71. package/dist/lib/helm.js +209 -0
  72. package/dist/lib/helmValues.d.ts +17 -0
  73. package/dist/lib/helmValues.js +693 -0
  74. package/dist/lib/kubernetes.d.ts +161 -0
  75. package/dist/lib/kubernetes.js +755 -0
  76. package/dist/lib/terraform.d.ts +44 -0
  77. package/dist/lib/terraform.js +230 -0
  78. package/dist/lib/theme.d.ts +81 -0
  79. package/dist/lib/theme.js +115 -0
  80. package/dist/lib/validation.d.ts +47 -0
  81. package/dist/lib/validation.js +164 -0
  82. package/dist/lib/versions.d.ts +69 -0
  83. package/dist/lib/versions.js +139 -0
  84. package/dist/types/index.d.ts +718 -0
  85. package/dist/types/index.js +556 -0
  86. package/email-templates/email_change.html +325 -0
  87. package/email-templates/invite.html +383 -0
  88. package/email-templates/password_change.html +414 -0
  89. package/email-templates/verify.html +396 -0
  90. package/package.json +78 -0
  91. package/terraform/aws/main.tf +327 -0
  92. package/terraform/azure/main.tf +326 -0
  93. package/terraform/gcp/main.tf +369 -0
@@ -0,0 +1,556 @@
1
+ import { z } from "zod";
2
+ // Supported DNS providers that work with external-dns
3
+ export const SUPPORTED_DNS_PROVIDERS = [
4
+ "route53",
5
+ "cloudflare",
6
+ "google",
7
+ "azure",
8
+ ];
9
+ // Sink category mappings
10
+ export const LOGGING_SINK_CATEGORIES = {
11
+ s3: "cloud-storage",
12
+ "azure-blob": "cloud-storage",
13
+ gcs: "cloud-storage",
14
+ datadog: "logging-platform",
15
+ splunk: "logging-platform",
16
+ elasticsearch: "logging-platform",
17
+ loki: "logging-platform",
18
+ newrelic: "logging-platform",
19
+ axiom: "logging-platform",
20
+ };
21
+ // Region mappings
22
+ export const CLOUD_REGIONS = {
23
+ aws: [
24
+ "us-east-1",
25
+ "us-east-2",
26
+ "us-west-1",
27
+ "us-west-2",
28
+ "eu-west-1",
29
+ "eu-west-2",
30
+ "eu-west-3",
31
+ "eu-central-1",
32
+ "ap-south-1",
33
+ "ap-southeast-1",
34
+ "ap-southeast-2",
35
+ "ap-northeast-1",
36
+ "ap-northeast-2",
37
+ "ca-central-1",
38
+ "sa-east-1",
39
+ ],
40
+ gcp: [
41
+ "us-central1",
42
+ "us-east1",
43
+ "us-west1",
44
+ "us-west2",
45
+ "europe-west1",
46
+ "europe-west2",
47
+ "europe-west3",
48
+ "asia-east1",
49
+ "asia-northeast1",
50
+ "asia-southeast1",
51
+ "australia-southeast1",
52
+ "southamerica-east1",
53
+ ],
54
+ azure: [
55
+ "eastus",
56
+ "eastus2",
57
+ "westus",
58
+ "westus2",
59
+ "centralus",
60
+ "northeurope",
61
+ "westeurope",
62
+ "uksouth",
63
+ "eastasia",
64
+ "southeastasia",
65
+ "japaneast",
66
+ "australiaeast",
67
+ "canadacentral",
68
+ "brazilsouth",
69
+ ],
70
+ };
71
+ // Performance tier configurations
72
+ export const TIER_CONFIGS = {
73
+ small: {
74
+ description: "Development & Testing",
75
+ throughput: "<1,000 rules/sec",
76
+ nodes: { min: 4, max: 4 },
77
+ resources: "2 vCPU, 4GB RAM each",
78
+ // HPS
79
+ hpsReplicas: 2,
80
+ hpsWorkerReplicas: { min: 4, max: 8 },
81
+ hpsResources: {
82
+ requests: { cpu: "500m", memory: "1Gi" },
83
+ limits: { cpu: "1500m", memory: "1536Mi" },
84
+ },
85
+ hpsWorkerResources: {
86
+ requests: { cpu: "100m", memory: "128Mi" },
87
+ limits: { cpu: "500m", memory: "512Mi" },
88
+ },
89
+ // Kafka
90
+ kafkaStorage: "10Gi",
91
+ kafkaReplication: 1,
92
+ kafkaResources: {
93
+ requests: { cpu: "500m", memory: "2Gi" },
94
+ limits: { cpu: "2000m", memory: "3Gi" },
95
+ },
96
+ kafkaHeapOpts: "-Xmx1g -Xms1g -XX:+UseZGC -XX:+AlwaysPreTouch",
97
+ // Redis
98
+ redisResources: {
99
+ requests: { cpu: "200m", memory: "256Mi" },
100
+ limits: { cpu: "500m", memory: "2Gi" },
101
+ },
102
+ redisPersistenceSize: "4Gi",
103
+ // Vector
104
+ vectorReplicas: 2,
105
+ vectorResources: {
106
+ requests: { cpu: "50m", memory: "128Mi" },
107
+ limits: { cpu: "200m", memory: "256Mi" },
108
+ },
109
+ // Database
110
+ dbResources: {
111
+ requests: { cpu: "500m", memory: "1Gi" },
112
+ limits: { cpu: "1000m", memory: "2Gi" },
113
+ },
114
+ dbPersistenceSize: "10Gi",
115
+ // App
116
+ appReplicas: 2,
117
+ appResources: {
118
+ requests: { cpu: "500m", memory: "512Mi" },
119
+ limits: { cpu: "2000m", memory: "2Gi" },
120
+ },
121
+ },
122
+ medium: {
123
+ description: "Production",
124
+ throughput: "1,000-10,000 rules/sec",
125
+ nodes: { min: 4, max: 8 },
126
+ resources: "2-4 vCPU, 4-8GB RAM each",
127
+ // HPS
128
+ hpsReplicas: 3,
129
+ hpsWorkerReplicas: { min: 10, max: 24 },
130
+ hpsResources: {
131
+ requests: { cpu: "1000m", memory: "1Gi" },
132
+ limits: { cpu: "4000m", memory: "4Gi" },
133
+ },
134
+ hpsWorkerResources: {
135
+ requests: { cpu: "500m", memory: "512Mi" },
136
+ limits: { cpu: "2000m", memory: "2Gi" },
137
+ },
138
+ // Kafka
139
+ kafkaStorage: "50Gi",
140
+ kafkaReplication: 2,
141
+ kafkaResources: {
142
+ requests: { cpu: "1000m", memory: "3Gi" },
143
+ limits: { cpu: "2000m", memory: "4Gi" },
144
+ },
145
+ kafkaHeapOpts: "-Xmx2g -Xms2g -XX:+UseZGC -XX:+AlwaysPreTouch",
146
+ // Redis
147
+ redisResources: {
148
+ requests: { cpu: "200m", memory: "512Mi" },
149
+ limits: { cpu: "1000m", memory: "4Gi" },
150
+ },
151
+ redisPersistenceSize: "8Gi",
152
+ // Vector
153
+ vectorReplicas: 2,
154
+ vectorResources: {
155
+ requests: { cpu: "100m", memory: "256Mi" },
156
+ limits: { cpu: "500m", memory: "512Mi" },
157
+ },
158
+ // Database
159
+ dbResources: {
160
+ requests: { cpu: "1000m", memory: "2Gi" },
161
+ limits: { cpu: "2000m", memory: "4Gi" },
162
+ },
163
+ dbPersistenceSize: "50Gi",
164
+ // App
165
+ appReplicas: 2,
166
+ appResources: {
167
+ requests: { cpu: "500m", memory: "512Mi" },
168
+ limits: { cpu: "2000m", memory: "2Gi" },
169
+ },
170
+ },
171
+ large: {
172
+ description: "High Performance",
173
+ throughput: ">10,000 rules/sec",
174
+ nodes: { min: 5, max: 16 },
175
+ resources: "2-4 vCPU, 4-8GB RAM each",
176
+ // HPS
177
+ hpsReplicas: 4,
178
+ hpsWorkerReplicas: { min: 10, max: 48 },
179
+ hpsResources: {
180
+ requests: { cpu: "2000m", memory: "2Gi" },
181
+ limits: { cpu: "4000m", memory: "4Gi" },
182
+ },
183
+ hpsWorkerResources: {
184
+ requests: { cpu: "1000m", memory: "1Gi" },
185
+ limits: { cpu: "2000m", memory: "2Gi" },
186
+ },
187
+ // Kafka
188
+ kafkaStorage: "100Gi",
189
+ kafkaReplication: 3,
190
+ kafkaResources: {
191
+ requests: { cpu: "2000m", memory: "4Gi" },
192
+ limits: { cpu: "4000m", memory: "6Gi" },
193
+ },
194
+ kafkaHeapOpts: "-Xmx3g -Xms3g -XX:+UseZGC -XX:+AlwaysPreTouch",
195
+ // Redis
196
+ redisResources: {
197
+ requests: { cpu: "500m", memory: "1Gi" },
198
+ limits: { cpu: "2000m", memory: "8Gi" },
199
+ },
200
+ redisPersistenceSize: "16Gi",
201
+ // Vector
202
+ vectorReplicas: 3,
203
+ vectorResources: {
204
+ requests: { cpu: "200m", memory: "512Mi" },
205
+ limits: { cpu: "1000m", memory: "1Gi" },
206
+ },
207
+ // Database
208
+ dbResources: {
209
+ requests: { cpu: "2000m", memory: "4Gi" },
210
+ limits: { cpu: "4000m", memory: "8Gi" },
211
+ },
212
+ dbPersistenceSize: "100Gi",
213
+ // App
214
+ appReplicas: 3,
215
+ appResources: {
216
+ requests: { cpu: "1000m", memory: "1Gi" },
217
+ limits: { cpu: "2000m", memory: "2Gi" },
218
+ },
219
+ },
220
+ };
221
+ // Default SMTP providers
222
+ export const SMTP_PROVIDERS = {
223
+ "aws-ses": {
224
+ host: "email-smtp.us-east-1.amazonaws.com",
225
+ port: 587,
226
+ user: "",
227
+ },
228
+ sendgrid: { host: "smtp.sendgrid.net", port: 587, user: "" },
229
+ resend: { host: "smtp.resend.com", port: 465, user: "resend" },
230
+ mailgun: { host: "smtp.mailgun.org", port: 587, user: "" },
231
+ postmark: { host: "smtp.postmarkapp.com", port: 587, user: "" },
232
+ mailtrap: { host: "smtp.mailtrap.io", port: 2525, user: "" },
233
+ custom: { host: "", port: 587, user: "" },
234
+ };
235
+ export const DEFAULT_EMAIL_SUBJECTS = {
236
+ invite: "Join your team on Rulebricks",
237
+ confirmation: "Confirm Your Email",
238
+ recovery: "Reset Your Password",
239
+ emailChange: "Confirm Email Change",
240
+ };
241
+ // DNS Provider display names
242
+ export const DNS_PROVIDER_NAMES = {
243
+ route53: "AWS Route 53",
244
+ cloudflare: "Cloudflare",
245
+ google: "Google Cloud DNS",
246
+ azure: "Azure DNS",
247
+ other: "Other / Not sure",
248
+ };
249
+ // Logging sink display info
250
+ export const LOGGING_SINK_INFO = {
251
+ console: {
252
+ name: "Console only",
253
+ description: "Logs written to stdout (default)",
254
+ },
255
+ pending: {
256
+ name: "External (not configured)",
257
+ description: "External logging enabled but destination not selected",
258
+ },
259
+ // Cloud Storage
260
+ s3: {
261
+ name: "AWS S3",
262
+ description: "Store logs in an S3 bucket",
263
+ },
264
+ "azure-blob": {
265
+ name: "Azure Blob Storage",
266
+ description: "Store logs in Azure Blob container",
267
+ },
268
+ gcs: {
269
+ name: "Google Cloud Storage",
270
+ description: "Store logs in a GCS bucket",
271
+ },
272
+ // Logging Platforms
273
+ datadog: {
274
+ name: "Datadog",
275
+ description: "Send logs to Datadog Logs",
276
+ },
277
+ splunk: {
278
+ name: "Splunk",
279
+ description: "Send logs to Splunk via HTTP Event Collector",
280
+ },
281
+ elasticsearch: {
282
+ name: "Elasticsearch",
283
+ description: "Send logs to Elasticsearch cluster",
284
+ },
285
+ loki: {
286
+ name: "Grafana Loki",
287
+ description: "Send logs to Grafana Loki",
288
+ },
289
+ newrelic: {
290
+ name: "New Relic",
291
+ description: "Send logs to New Relic Logs",
292
+ },
293
+ axiom: {
294
+ name: "Axiom",
295
+ description: "Send logs to Axiom dataset",
296
+ },
297
+ };
298
+ // Logging destination labels for UI display (shown in the Rulebricks app)
299
+ export const LOGGING_DESTINATION_LABELS = {
300
+ console: "Console (stdout)",
301
+ pending: "External (configuring...)",
302
+ s3: "AWS S3",
303
+ "azure-blob": "Azure Blob Storage",
304
+ gcs: "Google Cloud Storage",
305
+ datadog: "Datadog",
306
+ splunk: "Splunk",
307
+ elasticsearch: "Elasticsearch",
308
+ loki: "Grafana Loki",
309
+ newrelic: "New Relic",
310
+ axiom: "Axiom",
311
+ };
312
+ // Helper to get logging destination label for Helm values
313
+ export function getLoggingDestinationLabel(sink) {
314
+ return LOGGING_DESTINATION_LABELS[sink] || "Console (stdout)";
315
+ }
316
+ // Deployment configuration schema
317
+ export const DeploymentConfigSchema = z.object({
318
+ name: z
319
+ .string()
320
+ .min(1)
321
+ .max(63)
322
+ .regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/),
323
+ // Infrastructure
324
+ infrastructure: z.object({
325
+ mode: z.enum(["existing", "provision"]),
326
+ provider: z.enum(["aws", "gcp", "azure"]).optional(),
327
+ region: z.string().optional(),
328
+ clusterName: z.string().optional(),
329
+ gcpProjectId: z.string().optional(),
330
+ azureResourceGroup: z.string().optional(),
331
+ }),
332
+ // Domain & TLS
333
+ domain: z.string().min(1),
334
+ adminEmail: z.string().email(),
335
+ tlsEmail: z.string().email(),
336
+ // DNS Configuration
337
+ dns: z.object({
338
+ // Where is the user's DNS hosted?
339
+ provider: z.enum(["route53", "cloudflare", "google", "azure", "other"]),
340
+ // Should we auto-manage DNS records? (only applicable for supported providers)
341
+ autoManage: z.boolean(),
342
+ // For existing clusters: does external-dns already exist cluster-wide?
343
+ existingExternalDns: z.boolean().optional(),
344
+ }),
345
+ // SMTP Configuration
346
+ smtp: z.object({
347
+ host: z.string().min(1),
348
+ port: z.number().min(1).max(65535),
349
+ user: z.string().min(1),
350
+ pass: z.string().min(1),
351
+ from: z.string().email(),
352
+ fromName: z.string().min(1),
353
+ }),
354
+ // Database
355
+ database: z.object({
356
+ type: z.enum(["self-hosted", "supabase-cloud"]),
357
+ // Supabase Cloud specific
358
+ supabaseUrl: z.string().url().optional(),
359
+ supabaseAnonKey: z.string().optional(),
360
+ supabaseServiceKey: z.string().optional(),
361
+ supabaseAccessToken: z.string().optional(),
362
+ supabaseProjectRef: z.string().optional(),
363
+ // Self-hosted specific
364
+ supabaseJwtSecret: z.string().optional(),
365
+ supabaseDbPassword: z.string().optional(),
366
+ supabaseDashboardUser: z.string().optional(),
367
+ supabaseDashboardPass: z.string().optional(),
368
+ }),
369
+ // Performance
370
+ tier: z.enum(["small", "medium", "large"]),
371
+ // Optional features
372
+ features: z.object({
373
+ ai: z.object({
374
+ enabled: z.boolean(),
375
+ openaiApiKey: z.string().optional(),
376
+ }),
377
+ sso: z.object({
378
+ enabled: z.boolean(),
379
+ provider: z
380
+ .enum(["azure", "google", "okta", "keycloak", "ory", "other"])
381
+ .optional(),
382
+ url: z.string().url().optional(),
383
+ clientId: z.string().optional(),
384
+ clientSecret: z.string().optional(),
385
+ }),
386
+ monitoring: z.object({
387
+ enabled: z.boolean(),
388
+ // Optional: Prometheus remote write URL (Datadog, Grafana Cloud, etc.)
389
+ remoteWriteUrl: z.string().url().optional(),
390
+ }),
391
+ logging: z.object({
392
+ // Logging always happens to console by default
393
+ // This configures additional external sinks
394
+ sink: z.enum([
395
+ "console",
396
+ "pending",
397
+ "s3",
398
+ "azure-blob",
399
+ "gcs",
400
+ "datadog",
401
+ "splunk",
402
+ "elasticsearch",
403
+ "loki",
404
+ "newrelic",
405
+ "axiom",
406
+ ]),
407
+ // Sink-specific configuration
408
+ // For cloud storage: bucket name and region
409
+ // For platforms: repurposed for credentials (API key) and extra config
410
+ bucket: z.string().optional(),
411
+ region: z.string().optional(),
412
+ }),
413
+ customEmails: z
414
+ .object({
415
+ enabled: z.boolean(),
416
+ subjects: z
417
+ .object({
418
+ invite: z.string(),
419
+ confirmation: z.string(),
420
+ recovery: z.string(),
421
+ emailChange: z.string(),
422
+ })
423
+ .optional(),
424
+ templates: z
425
+ .object({
426
+ invite: z.string().url(),
427
+ confirmation: z.string().url(),
428
+ recovery: z.string().url(),
429
+ emailChange: z.string().url(),
430
+ })
431
+ .optional(),
432
+ })
433
+ .optional(),
434
+ }),
435
+ // Credentials
436
+ licenseKey: z.string().min(1),
437
+ // Version - app and HPS image versions
438
+ appVersion: z.string().optional(),
439
+ hpsVersion: z.string().optional(),
440
+ // Legacy chart version (deprecated, kept for backwards compatibility)
441
+ chartVersion: z.string().optional(),
442
+ });
443
+ export const WIZARD_STEPS = [
444
+ { id: "mode", title: "Deployment Mode", description: "Choose how to deploy" },
445
+ {
446
+ id: "cloud",
447
+ title: "Cloud Provider",
448
+ description: "Select your cloud provider",
449
+ },
450
+ {
451
+ id: "domain",
452
+ title: "Domain & DNS",
453
+ description: "Configure your domain and DNS",
454
+ },
455
+ {
456
+ id: "smtp",
457
+ title: "Email (SMTP)",
458
+ description: "Configure email delivery",
459
+ },
460
+ {
461
+ id: "database",
462
+ title: "Database",
463
+ description: "Choose your database setup",
464
+ },
465
+ {
466
+ id: "database-creds",
467
+ title: "Database Credentials",
468
+ description: "Configure database access",
469
+ },
470
+ {
471
+ id: "tier",
472
+ title: "Performance Tier",
473
+ description: "Select your deployment size",
474
+ },
475
+ {
476
+ id: "features",
477
+ title: "Optional Features",
478
+ description: "Enable additional features",
479
+ },
480
+ {
481
+ id: "feature-config",
482
+ title: "Feature Settings",
483
+ description: "Configure enabled features",
484
+ },
485
+ {
486
+ id: "credentials",
487
+ title: "License & Version",
488
+ description: "Enter license and select version",
489
+ },
490
+ {
491
+ id: "review",
492
+ title: "Review & Save",
493
+ description: "Review your configuration",
494
+ },
495
+ ];
496
+ // Helper to check if DNS provider supports external-dns
497
+ export function isSupportedDnsProvider(provider) {
498
+ return SUPPORTED_DNS_PROVIDERS.includes(provider);
499
+ }
500
+ // Profile configuration schema for persistent user preferences
501
+ export const ProfileConfigSchema = z.object({
502
+ // Infrastructure preferences
503
+ provider: z.enum(["aws", "gcp", "azure"]).optional(),
504
+ region: z.string().optional(),
505
+ clusterName: z.string().optional(),
506
+ // Domain preferences
507
+ domainSuffix: z.string().optional(), // e.g., ".rulebricks.com"
508
+ adminEmail: z.string().email().optional(),
509
+ tlsEmail: z.string().email().optional(),
510
+ dnsProvider: z
511
+ .enum(["route53", "cloudflare", "google", "azure", "other"])
512
+ .optional(),
513
+ // SMTP settings
514
+ smtpHost: z.string().optional(),
515
+ smtpPort: z.number().optional(),
516
+ smtpUser: z.string().optional(),
517
+ smtpPass: z.string().optional(),
518
+ smtpFrom: z.string().optional(),
519
+ smtpFromName: z.string().optional(),
520
+ // API Keys
521
+ openaiApiKey: z.string().optional(),
522
+ licenseKey: z.string().optional(),
523
+ // Preferences
524
+ tier: z.enum(["small", "medium", "large"]).optional(),
525
+ databaseType: z.enum(["self-hosted", "supabase-cloud"]).optional(),
526
+ infrastructureMode: z.enum(["existing", "provision"]).optional(),
527
+ // SSO (optional)
528
+ ssoProvider: z
529
+ .enum(["azure", "google", "okta", "keycloak", "ory", "other"])
530
+ .optional(),
531
+ ssoUrl: z.string().optional(),
532
+ ssoClientId: z.string().optional(),
533
+ ssoClientSecret: z.string().optional(),
534
+ });
535
+ // Constants
536
+ export const CHANGELOG_URL = "https://rulebricks.com/docs/changelog";
537
+ export const HELM_CHART_OCI = "oci://ghcr.io/rulebricks/charts/stack";
538
+ // Legacy namespace/release name - kept for backwards compatibility with existing deployments
539
+ export const DEFAULT_NAMESPACE = "rulebricks";
540
+ export const LEGACY_RELEASE_NAME = "rulebricks";
541
+ /**
542
+ * Generates a deployment-specific Kubernetes namespace.
543
+ * Format: rulebricks-<deployment-name>
544
+ * Example: rulebricks-prod, rulebricks-staging
545
+ */
546
+ export function getNamespace(deploymentName) {
547
+ return `rulebricks-${deploymentName}`;
548
+ }
549
+ /**
550
+ * Generates a deployment-specific Helm release name.
551
+ * Format: rulebricks-<deployment-name>
552
+ * Example: rulebricks-prod, rulebricks-staging
553
+ */
554
+ export function getReleaseName(deploymentName) {
555
+ return `rulebricks-${deploymentName}`;
556
+ }