@setbase/core 0.1.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.
@@ -0,0 +1,783 @@
1
+ import { ProviderCredentials, ProjectState, Manifest, DeploymentConfig, DeploymentOptions, DeploymentResult, Provider, ResourceType, ValidationResult as ValidationResult$1, ProvisionResult, UpdateResult, ResourceStatus, DatabaseConfig, DatabaseOutputs, CacheConfig, CacheOutputs, StorageConfig, StorageOutputs, EmailConfig, EmailOutputs, ComputeConfig, ComputeOutputs } from './types/index.js';
2
+ export { CorsConfig, CredentialsFile, Deployment, DeploymentState, DeploymentStatus, Project, ProjectConfig, ProjectDestroyOptions, ProjectInitOptions, ProviderMetadata, Resource, ResourceConfig, ResourceDefinition, ResourceDefinitions, ResourceOutputs, ResourceState, StateFile } from './types/index.js';
3
+ import { z } from 'zod';
4
+
5
+ /**
6
+ * Credential store - securely manages provider credentials
7
+ */
8
+
9
+ interface CredentialStore {
10
+ /**
11
+ * Save provider credentials
12
+ */
13
+ save(providerId: string, credentials: ProviderCredentials): Promise<void>;
14
+ /**
15
+ * Load provider credentials
16
+ */
17
+ load(providerId: string): Promise<ProviderCredentials | null>;
18
+ /**
19
+ * Delete provider credentials
20
+ */
21
+ delete(providerId: string): Promise<void>;
22
+ /**
23
+ * Check if credentials exist for a provider
24
+ */
25
+ has(providerId: string): Promise<boolean>;
26
+ /**
27
+ * List all provider IDs with credentials
28
+ */
29
+ list(): Promise<string[]>;
30
+ }
31
+ declare class EncryptedCredentialStore implements CredentialStore {
32
+ private readonly credentialsFilePath;
33
+ private readonly passphrase;
34
+ private readonly algorithm;
35
+ private readonly keyLength;
36
+ private readonly ivLength;
37
+ private readonly saltLength;
38
+ private readonly tagLength;
39
+ constructor(credentialsFilePath: string, passphrase: string);
40
+ save(providerId: string, credentials: ProviderCredentials): Promise<void>;
41
+ load(providerId: string): Promise<ProviderCredentials | null>;
42
+ delete(providerId: string): Promise<void>;
43
+ has(providerId: string): Promise<boolean>;
44
+ list(): Promise<string[]>;
45
+ /**
46
+ * Load and decrypt credentials file
47
+ */
48
+ private loadCredentialsFile;
49
+ /**
50
+ * Encrypt and save credentials file
51
+ */
52
+ private saveCredentialsFile;
53
+ /**
54
+ * Check if credentials file exists
55
+ */
56
+ private fileExists;
57
+ /**
58
+ * Create empty credentials file structure
59
+ */
60
+ private createEmptyCredentialsFile;
61
+ /**
62
+ * Encrypt data using AES-256-GCM
63
+ */
64
+ private encrypt;
65
+ /**
66
+ * Decrypt data using AES-256-GCM
67
+ */
68
+ private decrypt;
69
+ }
70
+ /**
71
+ * Create a credential store for a project directory
72
+ */
73
+ declare function createCredentialStore(projectDir?: string, passphrase?: string): CredentialStore;
74
+
75
+ /**
76
+ * State manager - handles project state persistence
77
+ */
78
+
79
+ interface StateManager {
80
+ /**
81
+ * Load project state from disk
82
+ */
83
+ load(): Promise<ProjectState | null>;
84
+ /**
85
+ * Save project state to disk
86
+ */
87
+ save(state: ProjectState): Promise<void>;
88
+ /**
89
+ * Delete project state
90
+ */
91
+ delete(): Promise<void>;
92
+ /**
93
+ * Check if state exists
94
+ */
95
+ exists(): Promise<boolean>;
96
+ }
97
+ declare class FileStateManager implements StateManager {
98
+ private readonly stateFilePath;
99
+ constructor(stateFilePath: string);
100
+ load(): Promise<ProjectState | null>;
101
+ save(state: ProjectState): Promise<void>;
102
+ delete(): Promise<void>;
103
+ exists(): Promise<boolean>;
104
+ }
105
+ /**
106
+ * Create a state manager for a project directory
107
+ */
108
+ declare function createStateManager(projectDir?: string): StateManager;
109
+
110
+ /**
111
+ * Command orchestrator - coordinates multi-provider operations
112
+ */
113
+
114
+ interface CommandOrchestrator {
115
+ /**
116
+ * Initialize a new project
117
+ */
118
+ initializeProject(manifest: Manifest): Promise<ProjectState>;
119
+ /**
120
+ * Provision all resources defined in manifest
121
+ */
122
+ provisionResources(manifest: Manifest): Promise<void>;
123
+ /**
124
+ * Destroy all provisioned resources
125
+ */
126
+ destroyResources(): Promise<void>;
127
+ /**
128
+ * Get current project state
129
+ */
130
+ getState(): Promise<ProjectState>;
131
+ }
132
+ declare class DefaultCommandOrchestrator implements CommandOrchestrator {
133
+ private readonly stateManager;
134
+ private readonly credentialStore;
135
+ constructor(stateManager: StateManager, credentialStore: CredentialStore);
136
+ initializeProject(manifest: Manifest): Promise<ProjectState>;
137
+ provisionResources(manifest: Manifest): Promise<void>;
138
+ destroyResources(): Promise<void>;
139
+ getState(): Promise<ProjectState>;
140
+ }
141
+
142
+ /**
143
+ * Deployment orchestrator - manages application deployments
144
+ */
145
+
146
+ interface DeploymentOrchestrator {
147
+ /**
148
+ * Deploy the application
149
+ */
150
+ deploy(config: DeploymentConfig, options: DeploymentOptions): Promise<DeploymentResult>;
151
+ /**
152
+ * Get deployment status
153
+ */
154
+ getDeploymentStatus(deploymentId: string): Promise<string>;
155
+ /**
156
+ * Get deployment logs
157
+ */
158
+ getLogs(deploymentId: string, options?: LogOptions$1): Promise<string[]>;
159
+ }
160
+ interface LogOptions$1 {
161
+ tail?: number;
162
+ follow?: boolean;
163
+ }
164
+ declare class DefaultDeploymentOrchestrator implements DeploymentOrchestrator {
165
+ private readonly stateManager;
166
+ private readonly credentialStore;
167
+ constructor(stateManager: StateManager, credentialStore: CredentialStore);
168
+ deploy(config: DeploymentConfig, options: DeploymentOptions): Promise<DeploymentResult>;
169
+ getDeploymentStatus(deploymentId: string): Promise<string>;
170
+ getLogs(deploymentId: string, options?: LogOptions$1): Promise<string[]>;
171
+ }
172
+
173
+ declare class ResourceGraph {
174
+ private nodes;
175
+ addNode(id: string, dependencies?: string[]): void;
176
+ /**
177
+ * Get resources in topological order (respecting dependencies)
178
+ */
179
+ getProvisioningOrder(): string[];
180
+ /**
181
+ * Detect circular dependencies
182
+ */
183
+ hasCycle(): boolean;
184
+ }
185
+
186
+ /**
187
+ * Base provider interface
188
+ */
189
+
190
+ declare abstract class BaseProvider<TConfig = unknown, TOutputs = unknown> implements Provider<TConfig, TOutputs> {
191
+ abstract readonly id: string;
192
+ abstract readonly type: ResourceType;
193
+ abstract readonly version: string;
194
+ abstract initialize(credentials: ProviderCredentials): Promise<void>;
195
+ abstract validate(config: TConfig): Promise<ValidationResult$1>;
196
+ abstract provision(config: TConfig): Promise<ProvisionResult<TOutputs>>;
197
+ abstract update(resourceId: string, config: TConfig): Promise<UpdateResult<TOutputs>>;
198
+ abstract destroy(resourceId: string): Promise<void>;
199
+ abstract getStatus(resourceId: string): Promise<ResourceStatus>;
200
+ abstract getOutputs(resourceId: string): Promise<TOutputs>;
201
+ abstract getEnvironmentVariables(resourceId: string): Promise<Record<string, string>>;
202
+ }
203
+
204
+ /**
205
+ * Provider registry - manages provider lifecycle
206
+ */
207
+
208
+ declare class ProviderRegistry {
209
+ private providers;
210
+ /**
211
+ * Register a provider
212
+ */
213
+ register(provider: BaseProvider): void;
214
+ /**
215
+ * Get a provider by ID
216
+ */
217
+ get(providerId: string): BaseProvider | undefined;
218
+ /**
219
+ * Get all providers of a specific type
220
+ */
221
+ getByType(type: ResourceType): BaseProvider[];
222
+ /**
223
+ * Check if a provider is registered
224
+ */
225
+ has(providerId: string): boolean;
226
+ /**
227
+ * Get all registered provider IDs
228
+ */
229
+ list(): string[];
230
+ /**
231
+ * Dynamically load providers
232
+ */
233
+ loadProviders(providerIds: string[]): Promise<void>;
234
+ }
235
+
236
+ /**
237
+ * Provider factory - creates provider instances
238
+ */
239
+
240
+ declare class ProviderFactory {
241
+ /**
242
+ * Create a provider instance
243
+ */
244
+ static create(_type: ResourceType, providerId: string, credentials: ProviderCredentials): Promise<BaseProvider>;
245
+ }
246
+
247
+ /**
248
+ * Database provider interface
249
+ */
250
+
251
+ interface DatabaseProvider extends BaseProvider<DatabaseConfig, DatabaseOutputs> {
252
+ /**
253
+ * Execute a query on the database
254
+ */
255
+ executeQuery(resourceId: string, query: string): Promise<unknown>;
256
+ /**
257
+ * Create a migration
258
+ */
259
+ createMigration(resourceId: string, name: string): Promise<string>;
260
+ }
261
+
262
+ /**
263
+ * Cache provider interface
264
+ */
265
+
266
+ interface CacheProvider extends BaseProvider<CacheConfig, CacheOutputs> {
267
+ /**
268
+ * Flush all cache data
269
+ */
270
+ flushCache(resourceId: string): Promise<void>;
271
+ /**
272
+ * Get cache statistics
273
+ */
274
+ getStats(resourceId: string): Promise<CacheStats>;
275
+ }
276
+ interface CacheStats {
277
+ memoryUsed: number;
278
+ memoryTotal: number;
279
+ keys: number;
280
+ hits: number;
281
+ misses: number;
282
+ }
283
+
284
+ /**
285
+ * Storage provider interface
286
+ */
287
+
288
+ interface StorageProvider extends BaseProvider<StorageConfig, StorageOutputs> {
289
+ /**
290
+ * Upload a file
291
+ */
292
+ uploadFile(resourceId: string, file: Buffer, key: string): Promise<string>;
293
+ /**
294
+ * Download a file
295
+ */
296
+ downloadFile(resourceId: string, key: string): Promise<Buffer>;
297
+ /**
298
+ * Delete a file
299
+ */
300
+ deleteFile(resourceId: string, key: string): Promise<void>;
301
+ /**
302
+ * List files
303
+ */
304
+ listFiles(resourceId: string, prefix?: string): Promise<string[]>;
305
+ }
306
+
307
+ /**
308
+ * Email provider interface
309
+ */
310
+
311
+ interface EmailProvider extends BaseProvider<EmailConfig, EmailOutputs> {
312
+ /**
313
+ * Send an email
314
+ */
315
+ sendEmail(resourceId: string, email: Email): Promise<void>;
316
+ /**
317
+ * Verify domain ownership
318
+ */
319
+ verifyDomain(resourceId: string): Promise<boolean>;
320
+ /**
321
+ * Get domain verification records
322
+ */
323
+ getDomainRecords(resourceId: string): Promise<DomainRecord[]>;
324
+ }
325
+ interface Email {
326
+ from: string;
327
+ to: string | string[];
328
+ subject: string;
329
+ text?: string;
330
+ html?: string;
331
+ cc?: string[];
332
+ bcc?: string[];
333
+ }
334
+ interface DomainRecord {
335
+ type: 'TXT' | 'MX' | 'CNAME';
336
+ name: string;
337
+ value: string;
338
+ }
339
+
340
+ /**
341
+ * Compute/deployment provider interface
342
+ */
343
+
344
+ interface ComputeProvider extends BaseProvider<ComputeConfig, ComputeOutputs> {
345
+ /**
346
+ * Deploy an application
347
+ */
348
+ deploy(config: ComputeConfig): Promise<ComputeOutputs>;
349
+ /**
350
+ * Get deployment logs
351
+ */
352
+ getLogs(deploymentId: string, options?: LogOptions): Promise<string[]>;
353
+ /**
354
+ * Rollback to a previous version
355
+ */
356
+ rollback(deploymentId: string, version: string): Promise<void>;
357
+ /**
358
+ * Scale the deployment
359
+ */
360
+ scale(deploymentId: string, replicas: number): Promise<void>;
361
+ }
362
+ interface LogOptions {
363
+ tail?: number;
364
+ follow?: boolean;
365
+ since?: Date;
366
+ }
367
+
368
+ /**
369
+ * Manifest parser - loads and parses setbase.json
370
+ */
371
+
372
+ interface ManifestParser {
373
+ /**
374
+ * Parse manifest from file path
375
+ */
376
+ parse(filePath: string): Promise<Manifest>;
377
+ /**
378
+ * Parse manifest from string
379
+ */
380
+ parseString(content: string): Promise<Manifest>;
381
+ /**
382
+ * Write manifest to file
383
+ */
384
+ write(filePath: string, manifest: Manifest): Promise<void>;
385
+ /**
386
+ * Check if manifest exists
387
+ */
388
+ exists(filePath: string): Promise<boolean>;
389
+ }
390
+ declare class DefaultManifestParser implements ManifestParser {
391
+ parse(filePath: string): Promise<Manifest>;
392
+ parseString(content: string): Promise<Manifest>;
393
+ write(filePath: string, manifest: Manifest): Promise<void>;
394
+ exists(filePath: string): Promise<boolean>;
395
+ }
396
+ /**
397
+ * Create a manifest parser
398
+ */
399
+ declare function createManifestParser(): ManifestParser;
400
+ /**
401
+ * Load manifest from project directory
402
+ */
403
+ declare function loadManifest(projectDir?: string): Promise<Manifest>;
404
+ /**
405
+ * Save manifest to project directory
406
+ */
407
+ declare function saveManifest(manifest: Manifest, projectDir?: string): Promise<void>;
408
+
409
+ /**
410
+ * Manifest validator - validates manifest against schema
411
+ */
412
+
413
+ interface ManifestValidator {
414
+ /**
415
+ * Validate a manifest
416
+ */
417
+ validate(manifest: Manifest): Promise<ValidationResult>;
418
+ }
419
+ interface ValidationResult {
420
+ valid: boolean;
421
+ errors: ValidationError$1[];
422
+ }
423
+ interface ValidationError$1 {
424
+ path: string;
425
+ message: string;
426
+ }
427
+ declare class DefaultManifestValidator implements ManifestValidator {
428
+ validate(manifest: Manifest): Promise<ValidationResult>;
429
+ }
430
+ /**
431
+ * Create a manifest validator
432
+ */
433
+ declare function createManifestValidator(): ManifestValidator;
434
+ /**
435
+ * Validate a manifest and throw if invalid
436
+ */
437
+ declare function validateManifest(manifest: Manifest): Promise<void>;
438
+
439
+ /**
440
+ * Manifest schema using Zod
441
+ */
442
+
443
+ declare const manifestSchema: z.ZodObject<{
444
+ $schema: z.ZodOptional<z.ZodString>;
445
+ version: z.ZodLiteral<"1.0">;
446
+ project: z.ZodObject<{
447
+ name: z.ZodString;
448
+ description: z.ZodOptional<z.ZodString>;
449
+ runtime: z.ZodEnum<["node", "python", "go"]>;
450
+ framework: z.ZodOptional<z.ZodString>;
451
+ }, "strip", z.ZodTypeAny, {
452
+ name: string;
453
+ runtime: "node" | "python" | "go";
454
+ description?: string | undefined;
455
+ framework?: string | undefined;
456
+ }, {
457
+ name: string;
458
+ runtime: "node" | "python" | "go";
459
+ description?: string | undefined;
460
+ framework?: string | undefined;
461
+ }>;
462
+ resources: z.ZodObject<{
463
+ database: z.ZodOptional<z.ZodObject<{
464
+ provider: z.ZodString;
465
+ config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
466
+ dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
467
+ }, "strip", z.ZodTypeAny, {
468
+ provider: string;
469
+ config: Record<string, unknown>;
470
+ dependsOn?: string[] | undefined;
471
+ }, {
472
+ provider: string;
473
+ config: Record<string, unknown>;
474
+ dependsOn?: string[] | undefined;
475
+ }>>;
476
+ cache: z.ZodOptional<z.ZodObject<{
477
+ provider: z.ZodString;
478
+ config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
479
+ dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
480
+ }, "strip", z.ZodTypeAny, {
481
+ provider: string;
482
+ config: Record<string, unknown>;
483
+ dependsOn?: string[] | undefined;
484
+ }, {
485
+ provider: string;
486
+ config: Record<string, unknown>;
487
+ dependsOn?: string[] | undefined;
488
+ }>>;
489
+ storage: z.ZodOptional<z.ZodObject<{
490
+ provider: z.ZodString;
491
+ config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
492
+ dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
493
+ }, "strip", z.ZodTypeAny, {
494
+ provider: string;
495
+ config: Record<string, unknown>;
496
+ dependsOn?: string[] | undefined;
497
+ }, {
498
+ provider: string;
499
+ config: Record<string, unknown>;
500
+ dependsOn?: string[] | undefined;
501
+ }>>;
502
+ email: z.ZodOptional<z.ZodObject<{
503
+ provider: z.ZodString;
504
+ config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
505
+ dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
506
+ }, "strip", z.ZodTypeAny, {
507
+ provider: string;
508
+ config: Record<string, unknown>;
509
+ dependsOn?: string[] | undefined;
510
+ }, {
511
+ provider: string;
512
+ config: Record<string, unknown>;
513
+ dependsOn?: string[] | undefined;
514
+ }>>;
515
+ }, "strip", z.ZodTypeAny, {
516
+ database?: {
517
+ provider: string;
518
+ config: Record<string, unknown>;
519
+ dependsOn?: string[] | undefined;
520
+ } | undefined;
521
+ cache?: {
522
+ provider: string;
523
+ config: Record<string, unknown>;
524
+ dependsOn?: string[] | undefined;
525
+ } | undefined;
526
+ storage?: {
527
+ provider: string;
528
+ config: Record<string, unknown>;
529
+ dependsOn?: string[] | undefined;
530
+ } | undefined;
531
+ email?: {
532
+ provider: string;
533
+ config: Record<string, unknown>;
534
+ dependsOn?: string[] | undefined;
535
+ } | undefined;
536
+ }, {
537
+ database?: {
538
+ provider: string;
539
+ config: Record<string, unknown>;
540
+ dependsOn?: string[] | undefined;
541
+ } | undefined;
542
+ cache?: {
543
+ provider: string;
544
+ config: Record<string, unknown>;
545
+ dependsOn?: string[] | undefined;
546
+ } | undefined;
547
+ storage?: {
548
+ provider: string;
549
+ config: Record<string, unknown>;
550
+ dependsOn?: string[] | undefined;
551
+ } | undefined;
552
+ email?: {
553
+ provider: string;
554
+ config: Record<string, unknown>;
555
+ dependsOn?: string[] | undefined;
556
+ } | undefined;
557
+ }>;
558
+ deployment: z.ZodOptional<z.ZodObject<{
559
+ provider: z.ZodString;
560
+ config: z.ZodObject<{
561
+ runtime: z.ZodEnum<["node", "python", "go"]>;
562
+ buildCommand: z.ZodOptional<z.ZodString>;
563
+ startCommand: z.ZodString;
564
+ environmentVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
565
+ region: z.ZodOptional<z.ZodString>;
566
+ healthCheck: z.ZodOptional<z.ZodString>;
567
+ }, "strip", z.ZodTypeAny, {
568
+ runtime: "node" | "python" | "go";
569
+ startCommand: string;
570
+ region?: string | undefined;
571
+ buildCommand?: string | undefined;
572
+ environmentVariables?: Record<string, string> | undefined;
573
+ healthCheck?: string | undefined;
574
+ }, {
575
+ runtime: "node" | "python" | "go";
576
+ startCommand: string;
577
+ region?: string | undefined;
578
+ buildCommand?: string | undefined;
579
+ environmentVariables?: Record<string, string> | undefined;
580
+ healthCheck?: string | undefined;
581
+ }>;
582
+ }, "strip", z.ZodTypeAny, {
583
+ provider: string;
584
+ config: {
585
+ runtime: "node" | "python" | "go";
586
+ startCommand: string;
587
+ region?: string | undefined;
588
+ buildCommand?: string | undefined;
589
+ environmentVariables?: Record<string, string> | undefined;
590
+ healthCheck?: string | undefined;
591
+ };
592
+ }, {
593
+ provider: string;
594
+ config: {
595
+ runtime: "node" | "python" | "go";
596
+ startCommand: string;
597
+ region?: string | undefined;
598
+ buildCommand?: string | undefined;
599
+ environmentVariables?: Record<string, string> | undefined;
600
+ healthCheck?: string | undefined;
601
+ };
602
+ }>>;
603
+ }, "strip", z.ZodTypeAny, {
604
+ version: "1.0";
605
+ project: {
606
+ name: string;
607
+ runtime: "node" | "python" | "go";
608
+ description?: string | undefined;
609
+ framework?: string | undefined;
610
+ };
611
+ resources: {
612
+ database?: {
613
+ provider: string;
614
+ config: Record<string, unknown>;
615
+ dependsOn?: string[] | undefined;
616
+ } | undefined;
617
+ cache?: {
618
+ provider: string;
619
+ config: Record<string, unknown>;
620
+ dependsOn?: string[] | undefined;
621
+ } | undefined;
622
+ storage?: {
623
+ provider: string;
624
+ config: Record<string, unknown>;
625
+ dependsOn?: string[] | undefined;
626
+ } | undefined;
627
+ email?: {
628
+ provider: string;
629
+ config: Record<string, unknown>;
630
+ dependsOn?: string[] | undefined;
631
+ } | undefined;
632
+ };
633
+ $schema?: string | undefined;
634
+ deployment?: {
635
+ provider: string;
636
+ config: {
637
+ runtime: "node" | "python" | "go";
638
+ startCommand: string;
639
+ region?: string | undefined;
640
+ buildCommand?: string | undefined;
641
+ environmentVariables?: Record<string, string> | undefined;
642
+ healthCheck?: string | undefined;
643
+ };
644
+ } | undefined;
645
+ }, {
646
+ version: "1.0";
647
+ project: {
648
+ name: string;
649
+ runtime: "node" | "python" | "go";
650
+ description?: string | undefined;
651
+ framework?: string | undefined;
652
+ };
653
+ resources: {
654
+ database?: {
655
+ provider: string;
656
+ config: Record<string, unknown>;
657
+ dependsOn?: string[] | undefined;
658
+ } | undefined;
659
+ cache?: {
660
+ provider: string;
661
+ config: Record<string, unknown>;
662
+ dependsOn?: string[] | undefined;
663
+ } | undefined;
664
+ storage?: {
665
+ provider: string;
666
+ config: Record<string, unknown>;
667
+ dependsOn?: string[] | undefined;
668
+ } | undefined;
669
+ email?: {
670
+ provider: string;
671
+ config: Record<string, unknown>;
672
+ dependsOn?: string[] | undefined;
673
+ } | undefined;
674
+ };
675
+ $schema?: string | undefined;
676
+ deployment?: {
677
+ provider: string;
678
+ config: {
679
+ runtime: "node" | "python" | "go";
680
+ startCommand: string;
681
+ region?: string | undefined;
682
+ buildCommand?: string | undefined;
683
+ environmentVariables?: Record<string, string> | undefined;
684
+ healthCheck?: string | undefined;
685
+ };
686
+ } | undefined;
687
+ }>;
688
+
689
+ /**
690
+ * Environment aggregator - collects environment variables from all resources
691
+ */
692
+
693
+ interface EnvironmentAggregator {
694
+ /**
695
+ * Aggregate environment variables from all provisioned resources
696
+ */
697
+ aggregate(state: ProjectState): Promise<Record<string, string>>;
698
+ }
699
+ declare class DefaultEnvironmentAggregator implements EnvironmentAggregator {
700
+ private readonly credentialStore;
701
+ constructor(credentialStore: CredentialStore);
702
+ aggregate(state: ProjectState): Promise<Record<string, string>>;
703
+ }
704
+
705
+ /**
706
+ * Environment manager - manages environment variables
707
+ */
708
+
709
+ interface EnvironmentManager {
710
+ /**
711
+ * Get all environment variables for a project
712
+ */
713
+ getEnvironmentVariables(environment: string): Promise<Record<string, string>>;
714
+ /**
715
+ * Get environment variables in dotenv format
716
+ */
717
+ toDotenv(environment: string): Promise<string>;
718
+ /**
719
+ * Get environment variables in JSON format
720
+ */
721
+ toJSON(environment: string): Promise<string>;
722
+ /**
723
+ * Write environment variables to file
724
+ */
725
+ writeToFile(environment: string, filePath: string, format: 'env' | 'json'): Promise<void>;
726
+ }
727
+ declare class DefaultEnvironmentManager implements EnvironmentManager {
728
+ private readonly stateManager;
729
+ private readonly envAggregator;
730
+ constructor(stateManager: StateManager, envAggregator: EnvironmentAggregator);
731
+ getEnvironmentVariables(environment: string): Promise<Record<string, string>>;
732
+ toDotenv(environment: string): Promise<string>;
733
+ toJSON(environment: string): Promise<string>;
734
+ writeToFile(environment: string, filePath: string, format: 'env' | 'json'): Promise<void>;
735
+ }
736
+
737
+ /**
738
+ * Custom error classes for Setbase
739
+ */
740
+ declare class SetbaseError extends Error {
741
+ readonly code?: string | undefined;
742
+ readonly details?: unknown | undefined;
743
+ constructor(message: string, code?: string | undefined, details?: unknown | undefined);
744
+ }
745
+ declare class ValidationError extends SetbaseError {
746
+ constructor(message: string, details?: unknown);
747
+ }
748
+ declare class ProviderError extends SetbaseError {
749
+ readonly provider: string;
750
+ constructor(message: string, provider: string, details?: unknown);
751
+ }
752
+ declare class StateError extends SetbaseError {
753
+ constructor(message: string, details?: unknown);
754
+ }
755
+ declare class ManifestError extends SetbaseError {
756
+ constructor(message: string, details?: unknown);
757
+ }
758
+ declare class DeploymentError extends SetbaseError {
759
+ constructor(message: string, details?: unknown);
760
+ }
761
+
762
+ interface Logger {
763
+ debug(message: string, ...args: any[]): void;
764
+ info(message: string, ...args: any[]): void;
765
+ warn(message: string, ...args: any[]): void;
766
+ error(message: string, ...args: any[]): void;
767
+ }
768
+ declare const logger: Logger;
769
+
770
+ /**
771
+ * ID generation utilities
772
+ */
773
+ declare function generateId(): string;
774
+ declare function generateProjectId(): string;
775
+ declare function generateResourceId(): string;
776
+
777
+ /**
778
+ * Validation utilities
779
+ */
780
+ declare function validateProjectName(name: string): void;
781
+ declare function validateResourceName(name: string): void;
782
+
783
+ export { BaseProvider, CacheConfig, CacheOutputs, type CacheProvider, type CommandOrchestrator, ComputeConfig, ComputeOutputs, type ComputeProvider, type CredentialStore, DatabaseConfig, DatabaseOutputs, type DatabaseProvider, DefaultCommandOrchestrator, DefaultDeploymentOrchestrator, DefaultEnvironmentAggregator, DefaultEnvironmentManager, DefaultManifestParser, DefaultManifestValidator, DeploymentConfig, DeploymentError, DeploymentOptions, type DeploymentOrchestrator, DeploymentResult, EmailConfig, EmailOutputs, type EmailProvider, EncryptedCredentialStore, type EnvironmentAggregator, type EnvironmentManager, FileStateManager, Manifest, ManifestError, type ManifestParser, type ManifestValidator, ProjectState, Provider, ProviderCredentials, ProviderError, ProviderFactory, ProviderRegistry, ProvisionResult, ResourceGraph, ResourceStatus, ResourceType, SetbaseError, StateError, type StateManager, StorageConfig, StorageOutputs, type StorageProvider, UpdateResult, ValidationError, ValidationResult$1 as ValidationResult, createCredentialStore, createManifestParser, createManifestValidator, createStateManager, generateId, generateProjectId, generateResourceId, loadManifest, logger, manifestSchema, saveManifest, validateManifest, validateProjectName, validateResourceName };