@ts-cloud/core 0.2.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.
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2024 Open Web Foundation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # ts-cloud-core
2
+
3
+ Core CloudFormation generation library for ts-cloud. Provides the foundational building blocks for defining and generating AWS CloudFormation templates programmatically in TypeScript.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ bun add ts-cloud-core
9
+ ```
10
+
11
+ ```bash
12
+ npm install ts-cloud-core
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```typescript
18
+ import { defineStack, Resource } from 'ts-cloud-core'
19
+
20
+ // Define a CloudFormation stack using TypeScript
21
+ const stack = defineStack({
22
+ name: 'my-app-stack',
23
+ resources: {
24
+ // Define your AWS resources here
25
+ },
26
+ })
27
+ ```
28
+
29
+ ## Features
30
+
31
+ - Programmatic CloudFormation template generation
32
+ - Full TypeScript type safety via `ts-cloud-aws-types`
33
+ - Support for compute, storage, networking, database, CDN, DNS, and more
34
+ - Auth, security, and permissions abstractions
35
+ - Messaging, queue, and event integrations
36
+ - Monitoring, logging, and workflow support
37
+ - Container and registry resource definitions
38
+ - Template validation
39
+
40
+ ## License
41
+
42
+ MIT
@@ -0,0 +1,327 @@
1
+ /**
2
+ * ts-cloud Core - CloudFormation Generator Engine
3
+ */
4
+ // Core types
5
+ export * from './types';
6
+ // Legacy exports (Phase 1)
7
+ export * from './template-builder';
8
+ // template-validator exports ValidationResult and ValidationError (interface)
9
+ // We prefer ValidationError (class) from errors, so exclude it here
10
+ export {
11
+ validateTemplate,
12
+ validateTemplateSize,
13
+ validateResourceLimits,
14
+ // ValidationResult is also exported here - we'll keep it from template-validator
15
+ type ValidationResult,
16
+ } from './template-validator';
17
+ // intrinsic-functions exports Fn and Pseudo
18
+ // We prefer Fn from cloudformation/types, so only export Pseudo here
19
+ export { Pseudo } from './intrinsic-functions';
20
+ export * from './resource-naming';
21
+ export * from './dependency-graph';
22
+ export * from './stack-diff';
23
+ // modules re-exports many things including Cache (ElastiCache module)
24
+ // We prefer this Cache over utils/cache, so export all from modules
25
+ // But modules also exports: PolicyStatement, LifecycleRule, MetricTransformation
26
+ export * from './modules';
27
+ // CloudFormation builder (Phase 5)
28
+ export * from './cloudformation/builder';
29
+ // cloudformation/types exports Fn (which we prefer over intrinsic-functions)
30
+ export * from './cloudformation/types';
31
+ // Configuration presets (Phase 4)
32
+ export * from './presets/static-site';
33
+ export * from './presets/nodejs-server';
34
+ export * from './presets/nodejs-serverless';
35
+ export * from './presets/fullstack-app';
36
+ export * from './presets/api-backend';
37
+ export * from './presets/wordpress';
38
+ export * from './presets/jamstack';
39
+ export * from './presets/microservices';
40
+ export * from './presets/realtime-app';
41
+ export * from './presets/data-pipeline';
42
+ export * from './presets/ml-api';
43
+ export * from './presets/traditional-web-app';
44
+ export * from './presets/extend';
45
+ // AWS clients (Phase 5)
46
+ export * from './aws/signature';
47
+ export * from './aws/credentials';
48
+ export * from './aws/cloudformation';
49
+ export {
50
+ S3Client,
51
+ S3Error,
52
+ createS3Client,
53
+ type S3ClientOptions,
54
+ type GetObjectOptions,
55
+ type PutObjectOptions,
56
+ type ListObjectsOptions,
57
+ type ListObjectsResult,
58
+ type S3Object,
59
+ type HeadObjectResult,
60
+ type CopyObjectOptions,
61
+ type MultipartUploadOptions,
62
+ type MultipartProgress,
63
+ type PresignedUrlOptions as S3PresignedUrlOptions,
64
+ } from './aws/s3';
65
+ export * from './aws/cloudfront';
66
+ // Error handling (Phase 6)
67
+ // errors exports ValidationError (class) which we prefer
68
+ export * from './errors';
69
+ // Validators (Phase 6)
70
+ export * from './validators/credentials';
71
+ export * from './validators/quotas';
72
+ // Utilities (Phase 6)
73
+ // utils exports Cache (in-memory utility), but we prefer Cache from modules (ElastiCache)
74
+ // So we need to exclude Cache from utils
75
+ export {
76
+ FileCache,
77
+ TemplateCache,
78
+ templateCache,
79
+ type CacheOptions,
80
+ type CacheEntry,
81
+ } from './utils/cache';
82
+ export * from './utils/hash';
83
+ export * from './utils/parallel';
84
+ export * from './utils/diff';
85
+ // Schema (Phase 6.5)
86
+ export * from './schema';
87
+ // Local development (Phase 6.6)
88
+ export * from './local/config';
89
+ export * from './local/mock-aws';
90
+ // Preview environments (Phase 6.7)
91
+ export * from './preview';
92
+ // Advanced CLI utilities (Phase 6.8)
93
+ export * from './cli';
94
+ // Multi-region support (Phase 7.1)
95
+ export * from './multi-region';
96
+ // Multi-account support (Phase 7.2)
97
+ export * from './multi-account';
98
+ // CI/CD integration (Phase 7.3)
99
+ export * from './cicd';
100
+ // Backup & Disaster Recovery (Phase 7.4)
101
+ export * from './backup';
102
+ // Compliance & Governance (Phase 7.5)
103
+ export * from './compliance';
104
+ // Advanced Deployment Strategies (Phase 7.6)
105
+ // deployment exports: RoutingConfig, CustomMetric, ABTest from its submodules
106
+ // These conflict with lambda and observability, so we use explicit exports
107
+ export {
108
+ BlueGreenManager,
109
+ blueGreenManager,
110
+ type BlueGreenDeployment,
111
+ type Environment,
112
+ type RoutingConfig as DeploymentRoutingConfig,
113
+ type HealthCheckConfig,
114
+ type DeploymentResult,
115
+ } from './deployment/blue-green';
116
+ export {
117
+ CanaryManager,
118
+ canaryManager,
119
+ type CanaryDeployment,
120
+ type DeploymentVersion,
121
+ type CanaryStage,
122
+ type AlarmThresholds,
123
+ type CustomMetric as DeploymentCustomMetric,
124
+ type CanaryMetrics,
125
+ type CanaryResult,
126
+ } from './deployment/canary';
127
+ export {
128
+ ABTestManager,
129
+ abTestManager,
130
+ type ABTest as DeploymentABTest,
131
+ type ABVariant,
132
+ type RoutingStrategy,
133
+ type ABMetrics,
134
+ type VariantMetrics,
135
+ type ABTestResult,
136
+ } from './deployment/ab-testing';
137
+ export {
138
+ ProgressiveDeploymentManager,
139
+ progressiveDeploymentManager,
140
+ type ProgressiveRollout,
141
+ type FeatureFlag,
142
+ type DeploymentGate,
143
+ } from './deployment/progressive';
144
+ // Observability (Phase 7.7)
145
+ // observability exports CustomMetric from metrics.ts - we prefer this one
146
+ // observability/logs exports MetricTransformation which conflicts with modules/monitoring
147
+ // We'll use explicit exports to avoid the conflict
148
+ export * from './observability/xray';
149
+ export * from './observability/metrics';
150
+ // observability/logs exports MetricTransformation - we rename it
151
+ export {
152
+ LogsManager,
153
+ logsManager,
154
+ type LogGroup,
155
+ type LogStream,
156
+ type MetricFilter,
157
+ type MetricTransformation as LogMetricTransformation,
158
+ type SubscriptionFilter,
159
+ type LogQuery,
160
+ type LogInsightsQuery,
161
+ } from './observability/logs';
162
+ export {
163
+ SyntheticsManager,
164
+ syntheticsManager,
165
+ type SyntheticCanary,
166
+ type CanaryCode,
167
+ type CanarySchedule,
168
+ type CanaryRunConfig,
169
+ type VpcConfig as SyntheticsVpcConfig,
170
+ type CanaryAlarm,
171
+ type HeartbeatMonitor,
172
+ type ApiMonitor,
173
+ type ApiEndpoint,
174
+ type ApiAssertion,
175
+ type WorkflowStep,
176
+ type WorkflowAction,
177
+ } from './observability/synthetics';
178
+ // Database Advanced Features (Phase 7.8)
179
+ // database exports AutoScalingConfig from replicas.ts
180
+ // We'll rename it to avoid conflict with lambda/concurrency
181
+ export * from './database/migrations';
182
+ export {
183
+ ReplicaManager,
184
+ replicaManager,
185
+ type ReadReplica,
186
+ type ReplicationGroup,
187
+ type LoadBalancingStrategy,
188
+ type AutoScalingConfig as DatabaseAutoScalingConfig,
189
+ type RDSProxy,
190
+ type SessionPinningFilter,
191
+ type ProxyTarget,
192
+ type ConnectionPoolConfig,
193
+ } from './database/replicas';
194
+ export * from './database/performance';
195
+ export * from './database/users';
196
+ // Secrets & Security Advanced (Phase 7.9)
197
+ // security/secrets-manager exports PolicyStatement which conflicts with modules/permissions
198
+ // We prefer PolicyStatement from modules, so rename security's version
199
+ export * from './security/secrets-rotation';
200
+ export {
201
+ SecretsManager,
202
+ secretsManager,
203
+ type SecretVersion,
204
+ type SecretAudit,
205
+ type SecretAction,
206
+ type ExternalSecretManager,
207
+ type ExternalAuthConfig,
208
+ type SecretReplication,
209
+ type SecretPolicy,
210
+ type PolicyDocument,
211
+ type PolicyStatement as SecurityPolicyStatement,
212
+ } from './security/secrets-manager';
213
+ export * from './security/certificate-manager';
214
+ export * from './security/scanning';
215
+ // Container Advanced Features (Phase 7.10)
216
+ // containers/registry exports LifecyclePolicy, LifecycleRule, ReplicationRule
217
+ // These conflict with s3, so we rename them
218
+ export * from './containers/image-scanning';
219
+ export * from './containers/build-optimization';
220
+ export {
221
+ ContainerRegistryManager,
222
+ containerRegistryManager,
223
+ type ContainerRegistry,
224
+ type RegistryEncryption,
225
+ type ScanningConfig,
226
+ type ScanFilter,
227
+ type LifecyclePolicy as ContainerLifecyclePolicy,
228
+ type LifecycleRule as ContainerLifecycleRule,
229
+ type ReplicationConfig,
230
+ type ReplicationDestination,
231
+ type ReplicationRule as ContainerReplicationRule,
232
+ type RegistryCredentials,
233
+ } from './containers/registry';
234
+ // containers/service-mesh exports HealthCheck which conflicts with health-checks
235
+ // We rename it to MeshHealthCheck
236
+ export {
237
+ ServiceMeshManager,
238
+ serviceMeshManager,
239
+ type ServiceMesh,
240
+ type MeshService,
241
+ type VirtualNode,
242
+ type Listener,
243
+ type HealthCheck as MeshHealthCheck,
244
+ type Timeout,
245
+ type TLSConfig,
246
+ type Backend,
247
+ type ClientPolicy,
248
+ type ServiceDiscovery,
249
+ type VirtualRouter,
250
+ type RouterListener,
251
+ type Route,
252
+ type RouteMatch,
253
+ type HeaderMatch,
254
+ type RouteAction,
255
+ type WeightedTarget,
256
+ type RetryPolicy,
257
+ type VirtualGateway,
258
+ type GatewayListener,
259
+ } from './containers/service-mesh';
260
+ // Lambda Advanced Features (Phase 7.11)
261
+ // lambda exports AutoScalingConfig from concurrency.ts and RoutingConfig from versions.ts
262
+ // We'll keep the lambda versions as the primary ones
263
+ export * from './lambda/layers';
264
+ // lambda/versions exports RoutingConfig which conflicts with deployment
265
+ // We keep the lambda version as primary
266
+ export * from './lambda/versions';
267
+ export * from './lambda/concurrency';
268
+ export * from './lambda/destinations';
269
+ export * from './lambda/vpc';
270
+ export * from './lambda/dlq';
271
+ // DNS Advanced Features (Phase 7.12)
272
+ // dns/routing exports HealthCheck which conflicts with health-checks
273
+ // We rename it to DNSHealthCheck
274
+ export {
275
+ Route53RoutingManager,
276
+ route53RoutingManager,
277
+ type RoutingPolicy,
278
+ type WeightedRoutingPolicy,
279
+ type LatencyRoutingPolicy,
280
+ type FailoverRoutingPolicy,
281
+ type GeolocationRoutingPolicy,
282
+ type GeoproximityRoutingPolicy,
283
+ type HealthCheck as DNSHealthCheck,
284
+ type CalculatedHealthCheck,
285
+ type TrafficPolicy,
286
+ type TrafficPolicyDocument,
287
+ type TrafficPolicyEndpoint,
288
+ type TrafficPolicyRule,
289
+ } from './dns/routing';
290
+ export * from './dns/dnssec';
291
+ export * from './dns/resolver';
292
+ // Email Advanced Features (Phase 7.13)
293
+ export * from './email';
294
+ // Phone Advanced Features
295
+ export * from './phone';
296
+ // SMS Advanced Features
297
+ export * from './sms';
298
+ // Queue Advanced Features (Phase 7.14)
299
+ export * from './queue';
300
+ // Static Site Features (Phase 7.15)
301
+ export * from './static-site';
302
+ // S3 Advanced Features (Phase 7.16)
303
+ // s3 exports LifecyclePolicy, ReplicationRule which conflict with modules and containers
304
+ // We'll rename them with S3 prefix
305
+ export {
306
+ StorageAdvancedManager,
307
+ storageAdvancedManager,
308
+ type LifecyclePolicy as S3LifecyclePolicy,
309
+ type VersioningConfig,
310
+ type ReplicationRule as S3ReplicationRule,
311
+ type IntelligentTieringConfig,
312
+ type ObjectLockConfig,
313
+ type TransferAccelerationConfig,
314
+ type AccessPoint,
315
+ type GlacierArchiveConfig,
316
+ type InventoryConfig,
317
+ type BatchOperation,
318
+ type EventNotification,
319
+ } from './s3';
320
+ // Health Checks & Monitoring (Phase 7.17)
321
+ // health-checks exports HealthCheck which conflicts with containers
322
+ // We keep health-checks version as primary (it's more specific to health checks)
323
+ export * from './health-checks';
324
+ // Network Security (Phase 7.18)
325
+ export * from './network-security';
326
+ // Resource Management (Phase 7.20)
327
+ export * from './resource-mgmt';