@ts-cloud/core 0.2.3 → 0.2.4
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/advanced-features.test.d.ts +1 -0
- package/dist/aws/cloudformation.d.ts +136 -0
- package/dist/aws/cloudfront.d.ts +45 -0
- package/dist/aws/credentials.d.ts +77 -0
- package/dist/aws/credentials.test.d.ts +4 -0
- package/dist/aws/index.d.ts +10 -0
- package/dist/aws/s3.d.ts +256 -0
- package/dist/aws/s3.test.d.ts +4 -0
- package/dist/aws/signature.d.ts +142 -0
- package/dist/aws/signature.test.d.ts +4 -0
- package/dist/backup/disaster-recovery.d.ts +140 -0
- package/dist/backup/disaster-recovery.test.d.ts +1 -0
- package/dist/backup/index.d.ts +8 -0
- package/dist/backup/manager.d.ts +172 -0
- package/dist/backup/manager.test.d.ts +1 -0
- package/dist/cicd/circleci.d.ts +50 -0
- package/dist/cicd/github-actions.d.ts +62 -0
- package/dist/cicd/gitlab-ci.d.ts +50 -0
- package/dist/cicd/index.d.ts +7 -0
- package/dist/cli/history.d.ts +137 -0
- package/dist/cli/index.d.ts +9 -0
- package/dist/cli/progress.d.ts +193 -0
- package/dist/cli/repl.d.ts +148 -0
- package/dist/cli/suggestions.d.ts +74 -0
- package/dist/cli/table.d.ts +73 -0
- package/dist/cli/table.test.d.ts +1 -0
- package/dist/cloudformation/builder.d.ts +93 -0
- package/dist/cloudformation/builder.test.d.ts +4 -0
- package/dist/cloudformation/builders/api-gateway.d.ts +30 -0
- package/dist/cloudformation/builders/cache.d.ts +35 -0
- package/dist/cloudformation/builders/cdn.d.ts +34 -0
- package/dist/cloudformation/builders/compute.d.ts +68 -0
- package/dist/cloudformation/builders/database.d.ts +61 -0
- package/dist/cloudformation/builders/functions.d.ts +32 -0
- package/dist/cloudformation/builders/messaging.d.ts +17 -0
- package/dist/cloudformation/builders/monitoring.d.ts +39 -0
- package/dist/cloudformation/builders/network.d.ts +14 -0
- package/dist/cloudformation/builders/queue.d.ts +16 -0
- package/dist/cloudformation/builders/security.d.ts +31 -0
- package/dist/cloudformation/builders/storage.d.ts +36 -0
- package/dist/cloudformation/index.d.ts +10 -0
- package/dist/cloudformation/types.d.ts +200 -0
- package/dist/compliance/aws-config.d.ts +175 -0
- package/dist/compliance/cloudtrail.d.ts +132 -0
- package/dist/compliance/compliance.test.d.ts +1 -0
- package/dist/compliance/guardduty.d.ts +176 -0
- package/dist/compliance/index.d.ts +12 -0
- package/dist/compliance/security-hub.d.ts +178 -0
- package/dist/containers/build-optimization.d.ts +155 -0
- package/dist/containers/containers.test.d.ts +1 -0
- package/dist/containers/image-scanning.d.ts +144 -0
- package/dist/containers/index.d.ts +8 -0
- package/dist/containers/registry.d.ts +129 -0
- package/dist/containers/service-mesh.d.ts +254 -0
- package/dist/database/database.test.d.ts +1 -0
- package/dist/database/index.d.ts +8 -0
- package/dist/database/migrations.d.ts +153 -0
- package/dist/database/performance.d.ts +219 -0
- package/dist/database/replicas.d.ts +218 -0
- package/dist/database/users.d.ts +165 -0
- package/dist/dependency-graph.d.ts +37 -0
- package/dist/deployment/ab-testing.d.ts +165 -0
- package/dist/deployment/blue-green.d.ts +140 -0
- package/dist/deployment/canary.d.ts +165 -0
- package/dist/deployment/deployment.test.d.ts +1 -0
- package/dist/deployment/index.d.ts +12 -0
- package/dist/deployment/progressive.d.ts +50 -0
- package/dist/dns/dns.test.d.ts +1 -0
- package/dist/dns/dnssec.d.ts +120 -0
- package/dist/dns/index.d.ts +7 -0
- package/dist/dns/resolver.d.ts +216 -0
- package/dist/dns/routing.d.ts +277 -0
- package/dist/email/advanced/analytics.d.ts +107 -0
- package/dist/email/advanced/index.d.ts +10 -0
- package/dist/email/advanced/rules.d.ts +131 -0
- package/dist/email/advanced/scheduling.d.ts +81 -0
- package/dist/email/advanced/search.d.ts +91 -0
- package/dist/email/advanced/shared-mailboxes.d.ts +109 -0
- package/dist/email/advanced/templates.d.ts +95 -0
- package/dist/email/advanced/threading.d.ts +65 -0
- package/dist/email/analytics.d.ts +189 -0
- package/dist/email/bounce-handling.d.ts +171 -0
- package/dist/email/email.test.d.ts +1 -0
- package/dist/email/handlers/__tests__/inbound.test.d.ts +1 -0
- package/dist/email/handlers/__tests__/outbound.test.d.ts +1 -0
- package/dist/email/handlers/converter.d.ts +11 -0
- package/dist/email/handlers/feedback.d.ts +11 -0
- package/dist/email/handlers/inbound.d.ts +13 -0
- package/dist/email/handlers/outbound.d.ts +13 -0
- package/dist/email/index.d.ts +10 -0
- package/dist/email/reputation.d.ts +133 -0
- package/dist/email/templates.d.ts +124 -0
- package/dist/errors/index.d.ts +177 -0
- package/dist/errors/index.test.d.ts +4 -0
- package/dist/health-checks/index.d.ts +35 -0
- package/dist/index.d.ts +15 -256
- package/dist/index.js +228 -80
- package/dist/intrinsic-functions.d.ts +77 -0
- package/dist/lambda/concurrency.d.ts +146 -0
- package/dist/lambda/destinations.d.ts +141 -0
- package/dist/lambda/dlq.d.ts +160 -0
- package/dist/lambda/index.d.ts +10 -0
- package/dist/lambda/lambda.test.d.ts +1 -0
- package/dist/lambda/layers.d.ts +117 -0
- package/dist/lambda/versions.d.ts +145 -0
- package/dist/lambda/vpc.d.ts +164 -0
- package/dist/local/config.d.ts +44 -0
- package/dist/local/index.d.ts +5 -0
- package/dist/local/mock-aws.d.ts +69 -0
- package/dist/modules/ai.d.ts +108 -0
- package/dist/modules/api.d.ts +157 -0
- package/dist/modules/auth.d.ts +262 -0
- package/dist/modules/cache.d.ts +108 -0
- package/dist/modules/cdn.d.ts +305 -0
- package/dist/modules/communication.d.ts +117 -0
- package/dist/modules/compute.d.ts +1376 -0
- package/dist/modules/database.d.ts +144 -0
- package/dist/modules/deployment.d.ts +372 -0
- package/dist/modules/dns.d.ts +143 -0
- package/dist/modules/email.d.ts +314 -0
- package/dist/modules/filesystem.d.ts +132 -0
- package/dist/modules/index.d.ts +31 -0
- package/dist/modules/messaging.d.ts +210 -0
- package/dist/modules/monitoring.d.ts +574 -0
- package/dist/modules/network.d.ts +148 -0
- package/dist/modules/parameter-store.d.ts +143 -0
- package/dist/modules/permissions.d.ts +245 -0
- package/dist/modules/phone.d.ts +125 -0
- package/dist/modules/queue.d.ts +411 -0
- package/dist/modules/redirects.d.ts +140 -0
- package/dist/modules/registry.d.ts +189 -0
- package/dist/modules/search.d.ts +135 -0
- package/dist/modules/secrets.d.ts +149 -0
- package/dist/modules/security.d.ts +219 -0
- package/dist/modules/sms.d.ts +130 -0
- package/dist/modules/storage.d.ts +344 -0
- package/dist/modules/workflow.d.ts +288 -0
- package/dist/multi-account/config.d.ts +166 -0
- package/dist/multi-account/index.d.ts +6 -0
- package/dist/multi-account/manager.d.ts +181 -0
- package/dist/multi-region/cross-region.d.ts +204 -0
- package/dist/multi-region/index.d.ts +7 -0
- package/dist/multi-region/manager.d.ts +136 -0
- package/dist/multi-region/regions.d.ts +98 -0
- package/dist/network-security/index.d.ts +55 -0
- package/dist/observability/index.d.ts +8 -0
- package/dist/observability/logs.d.ts +213 -0
- package/dist/observability/metrics.d.ts +187 -0
- package/dist/observability/observability.test.d.ts +1 -0
- package/dist/observability/synthetics.d.ts +189 -0
- package/dist/observability/xray.d.ts +193 -0
- package/dist/phone/advanced/analytics.d.ts +83 -0
- package/dist/phone/advanced/callbacks.d.ts +67 -0
- package/dist/phone/advanced/index.d.ts +7 -0
- package/dist/phone/advanced/ivr-builder.d.ts +130 -0
- package/dist/phone/advanced/recording.d.ts +62 -0
- package/dist/phone/handlers/__tests__/incoming-call.test.d.ts +1 -0
- package/dist/phone/handlers/incoming-call.d.ts +10 -0
- package/dist/phone/handlers/missed-call.d.ts +9 -0
- package/dist/phone/handlers/voicemail.d.ts +10 -0
- package/dist/phone/index.d.ts +5 -0
- package/dist/presets/api-backend.d.ts +11 -0
- package/dist/presets/data-pipeline.d.ts +11 -0
- package/dist/presets/extend.d.ts +194 -0
- package/dist/presets/extend.test.d.ts +4 -0
- package/dist/presets/fullstack-app.d.ts +12 -0
- package/dist/presets/index.d.ts +13 -0
- package/dist/presets/jamstack.d.ts +12 -0
- package/dist/presets/microservices.d.ts +18 -0
- package/dist/presets/ml-api.d.ts +13 -0
- package/dist/presets/nodejs-server.d.ts +14 -0
- package/dist/presets/nodejs-serverless.d.ts +14 -0
- package/dist/presets/realtime-app.d.ts +11 -0
- package/dist/presets/static-site.d.ts +12 -0
- package/dist/presets/traditional-web-app.d.ts +16 -0
- package/dist/presets/wordpress.d.ts +12 -0
- package/dist/preview/github.d.ts +32 -0
- package/dist/preview/github.test.d.ts +1 -0
- package/dist/preview/index.d.ts +10 -0
- package/dist/preview/manager.d.ts +101 -0
- package/dist/preview/manager.test.d.ts +1 -0
- package/dist/preview/notifications.d.ts +89 -0
- package/dist/preview/notifications.test.d.ts +1 -0
- package/dist/queue/batch-processing.d.ts +138 -0
- package/dist/queue/dlq-monitoring.d.ts +143 -0
- package/dist/queue/fifo.d.ts +131 -0
- package/dist/queue/index.d.ts +8 -0
- package/dist/queue/management.d.ts +162 -0
- package/dist/queue/queue.test.d.ts +1 -0
- package/dist/resource-mgmt/index.d.ts +44 -0
- package/dist/resource-naming.d.ts +26 -0
- package/dist/s3/index.d.ts +227 -0
- package/dist/schema/index.d.ts +12 -0
- package/dist/security/certificate-manager.d.ts +184 -0
- package/dist/security/index.d.ts +8 -0
- package/dist/security/scanning.d.ts +196 -0
- package/dist/security/secrets-manager.d.ts +204 -0
- package/dist/security/secrets-rotation.d.ts +167 -0
- package/dist/security/security.test.d.ts +1 -0
- package/dist/sms/advanced/ab-testing.d.ts +74 -0
- package/dist/sms/advanced/analytics.d.ts +75 -0
- package/dist/sms/advanced/campaigns.d.ts +96 -0
- package/dist/sms/advanced/chatbot.d.ts +67 -0
- package/dist/sms/advanced/index.d.ts +9 -0
- package/dist/sms/advanced/link-tracking.d.ts +60 -0
- package/dist/sms/advanced/mms.d.ts +60 -0
- package/dist/sms/handlers/__tests__/send.test.d.ts +1 -0
- package/dist/sms/handlers/delivery-status.d.ts +10 -0
- package/dist/sms/handlers/receive.d.ts +10 -0
- package/dist/sms/handlers/send.d.ts +10 -0
- package/dist/sms/index.d.ts +5 -0
- package/dist/stack-diff.d.ts +38 -0
- package/dist/static-site/index.d.ts +49 -0
- package/dist/template-builder.d.ts +42 -0
- package/dist/template-validator.d.ts +28 -0
- package/dist/types.d.ts +2514 -0
- package/dist/utils/cache.d.ts +117 -0
- package/dist/utils/diff.d.ts +52 -0
- package/dist/utils/hash.d.ts +73 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/parallel.d.ts +78 -0
- package/dist/validators/credentials.d.ts +30 -0
- package/dist/validators/credentials.test.d.ts +4 -0
- package/dist/validators/quotas.d.ts +64 -0
- package/dist/validators/quotas.test.d.ts +4 -0
- package/package.json +2 -2
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Caching utilities for performance optimization
|
|
3
|
+
* Caches CloudFormation templates, credentials, and other data
|
|
4
|
+
*/
|
|
5
|
+
export interface CacheOptions {
|
|
6
|
+
ttl?: number;
|
|
7
|
+
maxSize?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface CacheEntry<T> {
|
|
10
|
+
value: T;
|
|
11
|
+
timestamp: number;
|
|
12
|
+
hash?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Simple in-memory cache with TTL support
|
|
16
|
+
*/
|
|
17
|
+
export declare class Cache<T = any> {
|
|
18
|
+
private cache;
|
|
19
|
+
private ttl;
|
|
20
|
+
private maxSize;
|
|
21
|
+
constructor(options?: CacheOptions);
|
|
22
|
+
/**
|
|
23
|
+
* Get value from cache
|
|
24
|
+
*/
|
|
25
|
+
get(key: string): T | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Set value in cache
|
|
28
|
+
*/
|
|
29
|
+
set(key: string, value: T, hash?: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Check if cache has key and it's not expired
|
|
32
|
+
*/
|
|
33
|
+
has(key: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Clear cache
|
|
36
|
+
*/
|
|
37
|
+
clear(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Remove expired entries
|
|
40
|
+
*/
|
|
41
|
+
prune(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Get cache stats
|
|
44
|
+
*/
|
|
45
|
+
stats(): {
|
|
46
|
+
size: number;
|
|
47
|
+
ttl: number;
|
|
48
|
+
maxSize: number;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* File-based cache for persistent caching
|
|
53
|
+
*/
|
|
54
|
+
export declare class FileCache<T = any> {
|
|
55
|
+
private cacheDir;
|
|
56
|
+
private ttl;
|
|
57
|
+
constructor(cacheDir: string, options?: CacheOptions);
|
|
58
|
+
/**
|
|
59
|
+
* Get cache file path for key
|
|
60
|
+
*/
|
|
61
|
+
private getCachePath;
|
|
62
|
+
/**
|
|
63
|
+
* Get value from cache
|
|
64
|
+
*/
|
|
65
|
+
get(key: string): T | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Set value in cache
|
|
68
|
+
*/
|
|
69
|
+
set(key: string, value: T, hash?: string): void;
|
|
70
|
+
/**
|
|
71
|
+
* Check if cache has key and it's not expired
|
|
72
|
+
*/
|
|
73
|
+
has(key: string): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Clear all cache files
|
|
76
|
+
*/
|
|
77
|
+
clear(): void;
|
|
78
|
+
/**
|
|
79
|
+
* Remove expired entries
|
|
80
|
+
*/
|
|
81
|
+
prune(): void;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Template cache for CloudFormation templates
|
|
85
|
+
*/
|
|
86
|
+
export declare class TemplateCache {
|
|
87
|
+
private cache;
|
|
88
|
+
constructor(cacheDir?: string);
|
|
89
|
+
/**
|
|
90
|
+
* Get template from cache
|
|
91
|
+
*/
|
|
92
|
+
getTemplate(stackName: string): string | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* Save template to cache
|
|
95
|
+
*/
|
|
96
|
+
setTemplate(stackName: string, template: string): void;
|
|
97
|
+
/**
|
|
98
|
+
* Check if template has changed
|
|
99
|
+
*/
|
|
100
|
+
hasChanged(stackName: string, newTemplate: string): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Hash template for comparison
|
|
103
|
+
*/
|
|
104
|
+
private hashTemplate;
|
|
105
|
+
/**
|
|
106
|
+
* Clear all templates
|
|
107
|
+
*/
|
|
108
|
+
clear(): void;
|
|
109
|
+
/**
|
|
110
|
+
* Prune expired templates
|
|
111
|
+
*/
|
|
112
|
+
prune(): void;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Global template cache instance
|
|
116
|
+
*/
|
|
117
|
+
export declare const templateCache: TemplateCache;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template diff utilities for incremental deployments
|
|
3
|
+
* Detect changes between CloudFormation templates to optimize deployments
|
|
4
|
+
*/
|
|
5
|
+
import type { CloudFormationTemplate } from '../cloudformation/types';
|
|
6
|
+
export interface TemplateDiff {
|
|
7
|
+
added: string[];
|
|
8
|
+
modified: string[];
|
|
9
|
+
deleted: string[];
|
|
10
|
+
unchanged: string[];
|
|
11
|
+
parametersChanged: boolean;
|
|
12
|
+
outputsChanged: boolean;
|
|
13
|
+
hasChanges: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Compare two CloudFormation templates
|
|
17
|
+
*/
|
|
18
|
+
export declare function diffTemplates(oldTemplate: CloudFormationTemplate, newTemplate: CloudFormationTemplate): TemplateDiff;
|
|
19
|
+
/**
|
|
20
|
+
* Get diff summary string
|
|
21
|
+
*/
|
|
22
|
+
export declare function getDiffSummary(diff: TemplateDiff): string;
|
|
23
|
+
/**
|
|
24
|
+
* Check if diff requires replacement (destructive changes)
|
|
25
|
+
*/
|
|
26
|
+
export declare function requiresReplacement(diff: TemplateDiff, oldTemplate: CloudFormationTemplate, newTemplate: CloudFormationTemplate): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Categorize changes by risk level
|
|
29
|
+
*/
|
|
30
|
+
export declare function categorizeChanges(diff: TemplateDiff): {
|
|
31
|
+
safe: string[];
|
|
32
|
+
caution: string[];
|
|
33
|
+
dangerous: string[];
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Get deployment strategy based on diff
|
|
37
|
+
*/
|
|
38
|
+
export declare function getDeploymentStrategy(diff: TemplateDiff): {
|
|
39
|
+
strategy: 'create' | 'update' | 'replace' | 'skip';
|
|
40
|
+
reason: string;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Calculate diff statistics
|
|
44
|
+
*/
|
|
45
|
+
export declare function getDiffStats(diff: TemplateDiff): {
|
|
46
|
+
total: number;
|
|
47
|
+
added: number;
|
|
48
|
+
modified: number;
|
|
49
|
+
deleted: number;
|
|
50
|
+
unchanged: number;
|
|
51
|
+
changePercentage: number;
|
|
52
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File hashing utilities for deployment optimization
|
|
3
|
+
* Fast hashing for detecting changed files
|
|
4
|
+
*/
|
|
5
|
+
export interface FileHash {
|
|
6
|
+
path: string;
|
|
7
|
+
hash: string;
|
|
8
|
+
size: number;
|
|
9
|
+
mtime: number;
|
|
10
|
+
}
|
|
11
|
+
export interface HashOptions {
|
|
12
|
+
algorithm?: 'md5' | 'sha1' | 'sha256';
|
|
13
|
+
chunkSize?: number;
|
|
14
|
+
ignorePatterns?: string[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Hash a file using streaming for large files
|
|
18
|
+
*/
|
|
19
|
+
export declare function hashFile(filePath: string, options?: HashOptions): Promise<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Hash a string
|
|
22
|
+
*/
|
|
23
|
+
export declare function hashString(content: string, algorithm?: 'md5' | 'sha1' | 'sha256'): string;
|
|
24
|
+
/**
|
|
25
|
+
* Hash a buffer
|
|
26
|
+
*/
|
|
27
|
+
export declare function hashBuffer(buffer: Buffer, algorithm?: 'md5' | 'sha1' | 'sha256'): string;
|
|
28
|
+
/**
|
|
29
|
+
* Hash all files in a directory
|
|
30
|
+
*/
|
|
31
|
+
export declare function hashDirectory(dirPath: string, options?: HashOptions): Promise<FileHash[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Create a manifest hash from multiple file hashes
|
|
34
|
+
* Useful for detecting if any file in a directory has changed
|
|
35
|
+
*/
|
|
36
|
+
export declare function hashManifest(fileHashes: FileHash[]): string;
|
|
37
|
+
/**
|
|
38
|
+
* Fast hash using file metadata (size + mtime)
|
|
39
|
+
* Much faster than content hash, but less reliable
|
|
40
|
+
* Use for quick change detection
|
|
41
|
+
*/
|
|
42
|
+
export declare function quickHash(filePath: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Compare two sets of file hashes to find changes
|
|
45
|
+
*/
|
|
46
|
+
export declare function findChangedFiles(oldHashes: FileHash[], newHashes: FileHash[]): {
|
|
47
|
+
added: FileHash[];
|
|
48
|
+
modified: FileHash[];
|
|
49
|
+
deleted: FileHash[];
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Cache for file hashes
|
|
53
|
+
*/
|
|
54
|
+
export declare class HashCache {
|
|
55
|
+
private cache;
|
|
56
|
+
constructor();
|
|
57
|
+
/**
|
|
58
|
+
* Get cached hash if file hasn't changed
|
|
59
|
+
*/
|
|
60
|
+
get(filePath: string): string | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Cache a file hash
|
|
63
|
+
*/
|
|
64
|
+
set(filePath: string, hash: string): void;
|
|
65
|
+
/**
|
|
66
|
+
* Get or compute hash
|
|
67
|
+
*/
|
|
68
|
+
getOrCompute(filePath: string, options?: HashOptions): Promise<string>;
|
|
69
|
+
/**
|
|
70
|
+
* Clear cache
|
|
71
|
+
*/
|
|
72
|
+
clear(): void;
|
|
73
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parallel execution utilities
|
|
3
|
+
* Optimize deployment performance with parallel operations
|
|
4
|
+
*/
|
|
5
|
+
export interface ParallelOptions {
|
|
6
|
+
concurrency?: number;
|
|
7
|
+
stopOnError?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface ParallelResult<T> {
|
|
10
|
+
results: T[];
|
|
11
|
+
errors: Error[];
|
|
12
|
+
duration: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Execute tasks in parallel with configurable concurrency
|
|
16
|
+
*/
|
|
17
|
+
export declare function parallel<T>(tasks: (() => Promise<T>)[], options?: ParallelOptions): Promise<ParallelResult<T>>;
|
|
18
|
+
/**
|
|
19
|
+
* Execute tasks in batches with controlled concurrency
|
|
20
|
+
*/
|
|
21
|
+
export declare function batch<T, R>(items: T[], processor: (item: T) => Promise<R>, options?: ParallelOptions): Promise<ParallelResult<R>>;
|
|
22
|
+
/**
|
|
23
|
+
* Map over array with parallel execution
|
|
24
|
+
*/
|
|
25
|
+
export declare function parallelMap<T, R>(items: T[], mapper: (item: T, index: number) => Promise<R>, concurrency?: number): Promise<R[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Execute tasks with retry logic
|
|
28
|
+
*/
|
|
29
|
+
export declare function parallelWithRetry<T>(tasks: (() => Promise<T>)[], options?: ParallelOptions & {
|
|
30
|
+
retries?: number;
|
|
31
|
+
retryDelay?: number;
|
|
32
|
+
}): Promise<ParallelResult<T>>;
|
|
33
|
+
/**
|
|
34
|
+
* Execute tasks in sequence (one after another)
|
|
35
|
+
*/
|
|
36
|
+
export declare function sequence<T>(tasks: (() => Promise<T>)[]): Promise<T[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Execute tasks with timeout
|
|
39
|
+
*/
|
|
40
|
+
export declare function withTimeout<T>(task: () => Promise<T>, timeoutMs: number, timeoutMessage?: string): Promise<T>;
|
|
41
|
+
/**
|
|
42
|
+
* Rate limiter for API calls
|
|
43
|
+
*/
|
|
44
|
+
export declare class RateLimiter {
|
|
45
|
+
private maxConcurrent;
|
|
46
|
+
private minInterval;
|
|
47
|
+
private queue;
|
|
48
|
+
private running;
|
|
49
|
+
private lastExecution;
|
|
50
|
+
constructor(maxConcurrent?: number, minInterval?: number);
|
|
51
|
+
/**
|
|
52
|
+
* Execute task with rate limiting
|
|
53
|
+
*/
|
|
54
|
+
execute<T>(task: () => Promise<T>): Promise<T>;
|
|
55
|
+
/**
|
|
56
|
+
* Wait for available execution slot
|
|
57
|
+
*/
|
|
58
|
+
private waitForSlot;
|
|
59
|
+
/**
|
|
60
|
+
* Process queued tasks
|
|
61
|
+
*/
|
|
62
|
+
private processQueue;
|
|
63
|
+
/**
|
|
64
|
+
* Get stats
|
|
65
|
+
*/
|
|
66
|
+
stats(): {
|
|
67
|
+
running: number;
|
|
68
|
+
queued: number;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Chunk array into smaller batches
|
|
73
|
+
*/
|
|
74
|
+
export declare function chunk<T>(array: T[], size: number): T[][];
|
|
75
|
+
/**
|
|
76
|
+
* Process array in chunks with parallel execution
|
|
77
|
+
*/
|
|
78
|
+
export declare function processInChunks<T, R>(items: T[], chunkSize: number, processor: (chunk: T[]) => Promise<R[]>): Promise<R[]>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AWS Credentials Validation
|
|
3
|
+
* Validate credentials before deployment
|
|
4
|
+
*/
|
|
5
|
+
import type { AWSCredentials } from '../aws/credentials';
|
|
6
|
+
export interface CredentialValidationResult {
|
|
7
|
+
valid: boolean;
|
|
8
|
+
accountId?: string;
|
|
9
|
+
region?: string;
|
|
10
|
+
error?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Validate AWS credentials
|
|
14
|
+
*/
|
|
15
|
+
export declare function validateCredentials(profile?: string): Promise<CredentialValidationResult>;
|
|
16
|
+
/**
|
|
17
|
+
* Check IAM permissions
|
|
18
|
+
*/
|
|
19
|
+
export declare function checkIAMPermissions(_credentials: AWSCredentials, requiredActions: string[]): Promise<{
|
|
20
|
+
allowed: string[];
|
|
21
|
+
denied: string[];
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Get required IAM permissions for deployment
|
|
25
|
+
*/
|
|
26
|
+
export declare function getRequiredPermissions(config: any): string[];
|
|
27
|
+
/**
|
|
28
|
+
* Suggest IAM policy for deployment
|
|
29
|
+
*/
|
|
30
|
+
export declare function suggestIAMPolicy(config: any): string;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AWS Service Quota Checking
|
|
3
|
+
* Check if deployment will exceed service limits
|
|
4
|
+
*/
|
|
5
|
+
export interface ServiceQuota {
|
|
6
|
+
service: string;
|
|
7
|
+
quotaName: string;
|
|
8
|
+
currentValue: number;
|
|
9
|
+
limit: number;
|
|
10
|
+
percentage: number;
|
|
11
|
+
warning: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Common AWS service limits by region
|
|
15
|
+
*/
|
|
16
|
+
export declare const DEFAULT_SERVICE_LIMITS: {
|
|
17
|
+
ec2: {
|
|
18
|
+
'Running On-Demand Instances': number;
|
|
19
|
+
'Elastic IPs': number;
|
|
20
|
+
VPCs: number;
|
|
21
|
+
'Internet Gateways': number;
|
|
22
|
+
'NAT Gateways': number;
|
|
23
|
+
'Security Groups': number;
|
|
24
|
+
};
|
|
25
|
+
rds: {
|
|
26
|
+
'DB Instances': number;
|
|
27
|
+
'DB Snapshots': number;
|
|
28
|
+
'DB Parameter Groups': number;
|
|
29
|
+
};
|
|
30
|
+
lambda: {
|
|
31
|
+
'Concurrent Executions': number;
|
|
32
|
+
'Function Storage': number;
|
|
33
|
+
};
|
|
34
|
+
s3: {
|
|
35
|
+
Buckets: number;
|
|
36
|
+
};
|
|
37
|
+
cloudformation: {
|
|
38
|
+
Stacks: number;
|
|
39
|
+
StackSets: number;
|
|
40
|
+
};
|
|
41
|
+
elasticache: {
|
|
42
|
+
Nodes: number;
|
|
43
|
+
Clusters: number;
|
|
44
|
+
};
|
|
45
|
+
dynamodb: {
|
|
46
|
+
Tables: number;
|
|
47
|
+
};
|
|
48
|
+
ecs: {
|
|
49
|
+
Clusters: number;
|
|
50
|
+
'Services per Cluster': number;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Check service quotas for deployment
|
|
55
|
+
*/
|
|
56
|
+
export declare function checkServiceQuotas(config: any): Promise<ServiceQuota[]>;
|
|
57
|
+
/**
|
|
58
|
+
* Get quota usage summary
|
|
59
|
+
*/
|
|
60
|
+
export declare function getQuotaUsageSummary(quotas: ServiceQuota[]): string;
|
|
61
|
+
/**
|
|
62
|
+
* Suggest quota increase if needed
|
|
63
|
+
*/
|
|
64
|
+
export declare function suggestQuotaIncrease(quotas: ServiceQuota[]): string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-cloud/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core CloudFormation generation library for ts-cloud",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.com>",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"typecheck": "tsc --noEmit"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ts-cloud/aws-types": "0.2.
|
|
34
|
+
"@ts-cloud/aws-types": "0.2.4"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"typescript": "^5.9.3"
|