@fjall/components-infrastructure 0.86.0 → 0.87.3
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/README.md +3 -3
- package/dist/lib/app.d.ts +166 -6
- package/dist/lib/app.js +212 -20
- package/dist/lib/aspects/resourceInventory.d.ts +4 -4
- package/dist/lib/aspects/resourceInventory.js +3 -3
- package/dist/lib/config/aws/backupGlobalSettings.js +1 -2
- package/dist/lib/config/aws/identityCenter.js +1 -5
- package/dist/lib/config/aws/organisation.js +1 -4
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +7 -1
- package/dist/lib/patterns/aws/buildkite.js +3 -2
- package/dist/lib/patterns/aws/cdn.d.ts +164 -0
- package/dist/lib/patterns/aws/cdn.js +264 -0
- package/dist/lib/patterns/aws/compute.d.ts +278 -59
- package/dist/lib/patterns/aws/compute.js +384 -188
- package/dist/lib/patterns/aws/connections.d.ts +46 -0
- package/dist/lib/patterns/aws/connections.js +159 -0
- package/dist/lib/patterns/aws/database.d.ts +124 -11
- package/dist/lib/patterns/aws/database.js +188 -66
- package/dist/lib/patterns/aws/hostedZone.js +1 -1
- package/dist/lib/patterns/aws/index.d.ts +3 -0
- package/dist/lib/patterns/aws/index.js +4 -1
- package/dist/lib/patterns/aws/interfaces/compute.d.ts +121 -0
- package/dist/lib/patterns/aws/interfaces/compute.js +48 -0
- package/dist/lib/patterns/aws/interfaces/connector.d.ts +183 -0
- package/dist/lib/patterns/aws/interfaces/connector.js +117 -0
- package/dist/lib/patterns/aws/interfaces/database.d.ts +136 -0
- package/dist/lib/patterns/aws/interfaces/database.js +65 -0
- package/dist/lib/patterns/aws/interfaces/index.d.ts +12 -0
- package/dist/lib/patterns/aws/interfaces/index.js +49 -0
- package/dist/lib/patterns/aws/interfaces/messaging.d.ts +146 -0
- package/dist/lib/patterns/aws/interfaces/messaging.js +56 -0
- package/dist/lib/patterns/aws/interfaces/pattern.d.ts +403 -0
- package/dist/lib/patterns/aws/interfaces/pattern.js +36 -0
- package/dist/lib/patterns/aws/interfaces/storage.d.ts +136 -0
- package/dist/lib/patterns/aws/interfaces/storage.js +48 -0
- package/dist/lib/patterns/aws/messaging.d.ts +183 -0
- package/dist/lib/patterns/aws/messaging.js +239 -0
- package/dist/lib/patterns/aws/network.js +4 -4
- package/dist/lib/patterns/aws/pattern.d.ts +67 -0
- package/dist/lib/patterns/aws/pattern.js +69 -0
- package/dist/lib/patterns/aws/payload.d.ts +87 -0
- package/dist/lib/patterns/aws/payload.js +526 -0
- package/dist/lib/patterns/aws/storage.d.ts +127 -15
- package/dist/lib/patterns/aws/storage.js +234 -38
- package/dist/lib/resources/aws/backup/backupPlan.js +1 -6
- package/dist/lib/resources/aws/backup/backupVault.js +1 -2
- package/dist/lib/resources/aws/base/awsStack.d.ts +0 -2
- package/dist/lib/resources/aws/base/awsStack.js +1 -7
- package/dist/lib/resources/aws/cdn/cloudFront.d.ts +71 -0
- package/dist/lib/resources/aws/cdn/cloudFront.js +176 -0
- package/dist/lib/resources/aws/cdn/index.d.ts +1 -0
- package/dist/lib/resources/aws/cdn/index.js +18 -0
- package/dist/lib/resources/aws/compute/ec2.d.ts +5 -0
- package/dist/lib/resources/aws/compute/ec2.js +33 -6
- package/dist/lib/resources/aws/compute/ecs.d.ts +32 -25
- package/dist/lib/resources/aws/compute/ecs.js +31 -115
- package/dist/lib/resources/aws/compute/lambda.d.ts +94 -5
- package/dist/lib/resources/aws/compute/lambda.js +209 -32
- package/dist/lib/resources/aws/database/database.js +1 -1
- package/dist/lib/resources/aws/database/dynamodb.d.ts +70 -0
- package/dist/lib/resources/aws/database/dynamodb.js +181 -0
- package/dist/lib/resources/aws/database/index.d.ts +1 -0
- package/dist/lib/resources/aws/database/index.js +2 -1
- package/dist/lib/resources/aws/database/migrationLambda.d.ts +80 -0
- package/dist/lib/resources/aws/database/migrationLambda.js +119 -0
- package/dist/lib/resources/aws/database/rdsAurora.d.ts +15 -0
- package/dist/lib/resources/aws/database/rdsAurora.js +41 -18
- package/dist/lib/resources/aws/database/rdsAuroraGlobal.js +12 -8
- package/dist/lib/resources/aws/database/rdsInstance.js +2 -2
- package/dist/lib/resources/aws/index.d.ts +2 -0
- package/dist/lib/resources/aws/index.js +3 -1
- package/dist/lib/resources/aws/messaging/eventbridge.d.ts +28 -0
- package/dist/lib/resources/aws/messaging/eventbridge.js +53 -0
- package/dist/lib/resources/aws/messaging/index.d.ts +3 -0
- package/dist/lib/resources/aws/messaging/index.js +20 -0
- package/dist/lib/resources/aws/messaging/sns.d.ts +35 -0
- package/dist/lib/resources/aws/messaging/sns.js +70 -0
- package/dist/lib/resources/aws/messaging/sqs.d.ts +105 -0
- package/dist/lib/resources/aws/messaging/sqs.js +231 -0
- package/dist/lib/resources/aws/messaging/utils.d.ts +3 -0
- package/dist/lib/resources/aws/messaging/utils.js +7 -0
- package/dist/lib/resources/aws/networking/ipam.js +1 -2
- package/dist/lib/resources/aws/networking/ipamPool.js +3 -2
- package/dist/lib/resources/aws/networking/vpc.js +1 -2
- package/dist/lib/resources/aws/storage/ecr.js +8 -5
- package/dist/lib/resources/aws/storage/s3.js +1 -2
- package/dist/lib/resources/aws/utilities/awsCustomResource.js +1 -1
- package/dist/lib/resources/aws/utilities/customResource.js +1 -1
- package/dist/lib/utils/getConfig.js +3 -2
- package/dist/lib/utils/index.d.ts +1 -0
- package/dist/lib/utils/index.js +2 -1
- package/dist/lib/utils/manifestWriter.d.ts +174 -0
- package/dist/lib/utils/manifestWriter.js +233 -0
- package/dist/lib/utils/standardTagsAspect.js +1 -8
- package/dist/lib/utils/validationLogger.d.ts +34 -0
- package/dist/lib/utils/validationLogger.js +83 -0
- package/package.json +3 -3
- package/dist/lib/__tests__/setup.d.ts +0 -48
- package/dist/lib/__tests__/setup.js +0 -1
- package/dist/lib/patterns/aws/cicdRole.d.ts +0 -67
- package/dist/lib/patterns/aws/cicdRole.js +0 -68
- package/dist/lib/resources/aws/cicd/cicdRole.d.ts +0 -65
- package/dist/lib/resources/aws/cicd/cicdRole.js +0 -191
- package/dist/lib/resources/aws/compute/ecsFreeTier.d.ts +0 -75
- package/dist/lib/resources/aws/compute/ecsFreeTier.js +0 -1
- package/dist/lib/resources/aws/compute/ecsSpot.d.ts +0 -75
- package/dist/lib/resources/aws/compute/ecsSpot.js +0 -1
- package/dist/lib/resources/aws/compute/utilities/capacityProviderDrainWaiter.d.ts +0 -20
- package/dist/lib/resources/aws/compute/utilities/capacityProviderDrainWaiter.js +0 -1
- package/dist/lib/resources/aws/utilities/cfnOutput.d.ts +0 -5
- package/dist/lib/resources/aws/utilities/cfnOutput.js +0 -1
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ When a VPC is created in the same stack resources that rely on it will automatic
|
|
|
26
26
|
```typescript
|
|
27
27
|
new AwsStack(`${id}App`)
|
|
28
28
|
.addNetwork(FjallVpc.build(`${id}Vpc`))
|
|
29
|
-
.
|
|
29
|
+
.addConstruct(Fargate.build(`${id}Fargate`));
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
2. In the same CDK Application but different stack
|
|
@@ -41,7 +41,7 @@ const vpcStack = new AwsStack(`${id}Network`).addNetwork(
|
|
|
41
41
|
|
|
42
42
|
const newStack = new AwsStack(`${id}Compute`, { dependencies: [vpcStack] })
|
|
43
43
|
.addNetwork(vpcStack.getNetwork())
|
|
44
|
-
.
|
|
44
|
+
.addConstruct(Fargate.build(`${id}Fargate`));
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
3. Different CDK Applications
|
|
@@ -64,7 +64,7 @@ const newStack = new AwsStack(`${id}Compute`, {
|
|
|
64
64
|
dependencies: [vpcStack]
|
|
65
65
|
})
|
|
66
66
|
.addNetwork(FjallVpc.import(`${id}Vpc`, `${id}Network`))
|
|
67
|
-
.
|
|
67
|
+
.addConstruct(Fargate.build(`${id}Fargate`));
|
|
68
68
|
```
|
|
69
69
|
|
|
70
70
|
## Publishing package to npm
|
package/dist/lib/app.d.ts
CHANGED
|
@@ -5,9 +5,15 @@ import { type IVpc } from "aws-cdk-lib/aws-ec2";
|
|
|
5
5
|
import { type Role } from "aws-cdk-lib/aws-iam";
|
|
6
6
|
import { AwsStack } from "./resources";
|
|
7
7
|
import { type Ecr } from "./resources/aws/storage/ecr";
|
|
8
|
-
import { type
|
|
8
|
+
import { type AnyDatabase } from "./patterns/aws/database";
|
|
9
9
|
import { type INetworkProps, type Network } from "./patterns/aws/network";
|
|
10
|
+
import { type Cdn } from "./patterns/aws/cdn";
|
|
11
|
+
import { type AnyMessaging } from "./patterns/aws/messaging";
|
|
12
|
+
import { type AnyCompute } from "./patterns/aws/compute";
|
|
13
|
+
import { type AnyStorage } from "./patterns/aws/storage";
|
|
14
|
+
import { type AnyPattern } from "./patterns/aws/pattern";
|
|
10
15
|
import { type ResourceInventory } from "./aspects/resourceInventory";
|
|
16
|
+
import { type ManifestCollector } from "./utils/manifestWriter";
|
|
11
17
|
/**
|
|
12
18
|
* Configuration options for App.getApp().
|
|
13
19
|
*
|
|
@@ -57,6 +63,7 @@ export declare class App extends CdkApp {
|
|
|
57
63
|
private globalTags;
|
|
58
64
|
private aspectApplied;
|
|
59
65
|
private resourceInventory;
|
|
66
|
+
private manifestCollector;
|
|
60
67
|
private constructor();
|
|
61
68
|
/**
|
|
62
69
|
* Initialise the network (VPC) for this application.
|
|
@@ -131,6 +138,25 @@ export declare class App extends CdkApp {
|
|
|
131
138
|
* @returns {AwsStack}
|
|
132
139
|
*/
|
|
133
140
|
getDefaultStorageStack(): AwsStack;
|
|
141
|
+
/**
|
|
142
|
+
* Retrieve default CDN stack - named as `${this.name}Cdn`
|
|
143
|
+
*
|
|
144
|
+
* Depends on Network. Compute/Storage dependencies are added automatically
|
|
145
|
+
* by CDK when CDN resources reference ALB or S3 bucket resources.
|
|
146
|
+
*
|
|
147
|
+
* @returns {AwsStack}
|
|
148
|
+
*/
|
|
149
|
+
getDefaultCdnStack(): AwsStack;
|
|
150
|
+
/**
|
|
151
|
+
* Retrieve default messaging stack - named as `${this.name}Messaging`
|
|
152
|
+
*
|
|
153
|
+
* Used for SQS queues, SNS topics, and EventBridge event buses.
|
|
154
|
+
* Depends on Network only. These are regional services that don't
|
|
155
|
+
* require VPC, but we maintain consistent stack dependency patterns.
|
|
156
|
+
*
|
|
157
|
+
* @returns {AwsStack}
|
|
158
|
+
*/
|
|
159
|
+
getDefaultMessagingStack(): AwsStack;
|
|
134
160
|
/**
|
|
135
161
|
* Get a VPC by name. If no name is provided, returns the default VPC.
|
|
136
162
|
*
|
|
@@ -187,21 +213,150 @@ export declare class App extends CdkApp {
|
|
|
187
213
|
* Add a compute resource to the default compute stack using the factory pattern.
|
|
188
214
|
* Automatically creates monitoring role if not already created.
|
|
189
215
|
*
|
|
190
|
-
*
|
|
216
|
+
* Returns the appropriate compute type based on the factory configuration:
|
|
217
|
+
* - EcsCompute for type: "ecs"
|
|
218
|
+
* - LambdaCompute for type: "lambda"
|
|
219
|
+
* - Ec2Compute for type: "ec2"
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* // ECS compute - returns EcsCompute
|
|
223
|
+
* const api = app.addCompute(ComputeFactory.build("Api", {
|
|
224
|
+
* type: "ecs",
|
|
225
|
+
* services: [{ name: "api", ... }]
|
|
226
|
+
* }));
|
|
227
|
+
* api.getLoadBalancer(); // Available on EcsCompute
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* // Lambda compute - returns LambdaCompute
|
|
231
|
+
* const worker = app.addCompute(ComputeFactory.build("Worker", {
|
|
232
|
+
* type: "lambda",
|
|
233
|
+
* functions: [{ name: "process", ... }]
|
|
234
|
+
* }));
|
|
235
|
+
* worker.getFunction("process"); // Available on LambdaCompute
|
|
191
236
|
*/
|
|
192
|
-
addCompute<T extends
|
|
237
|
+
addCompute<T extends AnyCompute>(fn: (app: App, scope: Construct) => T): T;
|
|
193
238
|
/**
|
|
194
239
|
* Manually add a resource to the default compute stack.
|
|
195
240
|
*/
|
|
196
241
|
addComputeResource(resource: Construct): void;
|
|
197
242
|
/**
|
|
198
243
|
* Add a database resource to the default database stack using the factory pattern.
|
|
244
|
+
* Returns the appropriate database type based on the factory used.
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* // Aurora database - returns RelationalDatabase
|
|
248
|
+
* const db = app.addDatabase(DatabaseFactory.build("Main", {
|
|
249
|
+
* type: "Aurora",
|
|
250
|
+
* databaseName: "myapp"
|
|
251
|
+
* }));
|
|
252
|
+
* db.getHostEndpoint(); // Available
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* // DynamoDB table - returns DynamoDBDatabase
|
|
256
|
+
* const cache = app.addDatabase(DatabaseFactory.build("Cache", {
|
|
257
|
+
* type: "DynamoDB",
|
|
258
|
+
* partitionKey: { name: "id", type: "S" }
|
|
259
|
+
* }));
|
|
260
|
+
* cache.getTableName(); // Available
|
|
199
261
|
*/
|
|
200
|
-
addDatabase(fn: (app: App, scope: Construct) =>
|
|
262
|
+
addDatabase<T extends AnyDatabase>(fn: (app: App, scope: Construct) => T): T;
|
|
201
263
|
/**
|
|
202
264
|
* Add a storage resource (S3) to the default storage stack using the factory pattern.
|
|
265
|
+
*
|
|
266
|
+
* Returns the appropriate storage type based on the factory configuration:
|
|
267
|
+
* - PrivateStorage for bucketType: "private"
|
|
268
|
+
* - WebsiteStorage for bucketType: "website"
|
|
269
|
+
* - PublicStorage for bucketType: "publicRead"
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* // Private storage - returns PrivateStorage
|
|
273
|
+
* const assets = app.addStorage(StorageFactory.build("Assets", {
|
|
274
|
+
* bucketType: "private"
|
|
275
|
+
* }));
|
|
276
|
+
* assets.grantPublicAccess("public/*"); // Available on PrivateStorage
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* // Website storage - returns WebsiteStorage
|
|
280
|
+
* const site = app.addStorage(StorageFactory.build("Site", {
|
|
281
|
+
* bucketType: "website"
|
|
282
|
+
* }));
|
|
283
|
+
* site.getWebsiteUrl(); // Available on WebsiteStorage
|
|
203
284
|
*/
|
|
204
|
-
addStorage(fn: (app: App, scope: Construct) =>
|
|
285
|
+
addStorage<T extends AnyStorage>(fn: (app: App, scope: Construct) => T): T;
|
|
286
|
+
/**
|
|
287
|
+
* Add a CDN resource (CloudFront) to the default CDN stack using the factory pattern.
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* // S3 origin
|
|
291
|
+
* const assets = app.addStorage(StorageFactory.build("Assets", { bucketType: "private" }));
|
|
292
|
+
* app.addCdn(CdnFactory.build("AssetsCdn", {
|
|
293
|
+
* originType: "s3",
|
|
294
|
+
* bucket: assets
|
|
295
|
+
* }));
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* // ALB origin (ECS)
|
|
299
|
+
* const api = app.addCompute(ComputeFactory.build("Api", { type: "ecs", ... }));
|
|
300
|
+
* app.addCdn(CdnFactory.build("ApiCdn", {
|
|
301
|
+
* originType: "alb",
|
|
302
|
+
* loadBalancer: api
|
|
303
|
+
* }));
|
|
304
|
+
*/
|
|
305
|
+
addCdn(fn: (app: App, scope: Construct) => Cdn): Cdn;
|
|
306
|
+
/**
|
|
307
|
+
* Add a messaging resource to the default queue stack using the factory pattern.
|
|
308
|
+
*
|
|
309
|
+
* Returns the appropriate messaging type based on the factory configuration.
|
|
310
|
+
* Currently supports queue (SQS), with future support planned for
|
|
311
|
+
* topic (SNS), eventbus (EventBridge), and stream (Kinesis).
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* // Queue messaging - returns QueueMessaging
|
|
315
|
+
* const notifications = app.addMessaging(MessagingFactory.build("Notifications", {
|
|
316
|
+
* type: "queue",
|
|
317
|
+
* queueType: "standard",
|
|
318
|
+
* deadLetterQueue: { enabled: true, maxReceiveCount: 3 }
|
|
319
|
+
* }));
|
|
320
|
+
* notifications.grantSendMessages(apiFunction);
|
|
321
|
+
*
|
|
322
|
+
* @example
|
|
323
|
+
* // FIFO queue for OpenNext revalidation
|
|
324
|
+
* const revalidation = app.addMessaging(MessagingFactory.build("Revalidation", {
|
|
325
|
+
* type: "queue",
|
|
326
|
+
* queueType: "fifo",
|
|
327
|
+
* visibilityTimeout: 300,
|
|
328
|
+
* contentBasedDeduplication: true
|
|
329
|
+
* }));
|
|
330
|
+
*/
|
|
331
|
+
addMessaging<T extends AnyMessaging>(fn: (app: App, scope: Construct) => T): T;
|
|
332
|
+
/**
|
|
333
|
+
* Add a high-level infrastructure pattern to the application.
|
|
334
|
+
*
|
|
335
|
+
* Patterns are composite constructs that create multiple related resources
|
|
336
|
+
* as a single, cohesive unit. They encapsulate best practices and reduce
|
|
337
|
+
* boilerplate for common deployment scenarios.
|
|
338
|
+
*
|
|
339
|
+
* Currently supported patterns:
|
|
340
|
+
* - `payload`: Payload CMS deployment with OpenNext
|
|
341
|
+
*
|
|
342
|
+
* Returns the appropriate pattern interface based on the factory configuration,
|
|
343
|
+
* providing access to all underlying resources via escape hatches.
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* // Payload CMS pattern - returns Payload
|
|
347
|
+
* const payload = app.addPattern(PatternFactory.build("PayloadApp", {
|
|
348
|
+
* type: "payload",
|
|
349
|
+
* name: "my-cms",
|
|
350
|
+
* source: "../.."
|
|
351
|
+
* }));
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* // Escape hatches - access underlying resources
|
|
355
|
+
* payload.getDatabase().grantConnect(otherLambda);
|
|
356
|
+
* payload.getServer().getLambdaFunction().addEnvironment("CUSTOM", "value");
|
|
357
|
+
* payload.getCdn().getDistribution().addBehavior("/custom/*", customOrigin);
|
|
358
|
+
*/
|
|
359
|
+
addPattern<T extends AnyPattern>(fn: (app: App, scope: Construct) => T): T;
|
|
205
360
|
/**
|
|
206
361
|
* Add an additional network (VPC) to the application.
|
|
207
362
|
*
|
|
@@ -254,7 +409,12 @@ export declare class App extends CdkApp {
|
|
|
254
409
|
*/
|
|
255
410
|
exportResourceInventory(): ResourceInventory;
|
|
256
411
|
/**
|
|
257
|
-
*
|
|
412
|
+
* Get the manifest collector for registering services and patterns.
|
|
413
|
+
* Used by ComputeFactory and PatternFactory to register their configurations.
|
|
414
|
+
*/
|
|
415
|
+
getManifestCollector(): ManifestCollector;
|
|
416
|
+
/**
|
|
417
|
+
* Override synth to automatically export resource inventory and manifest
|
|
258
418
|
*/
|
|
259
419
|
synth(options?: StageSynthesisOptions): CloudAssembly;
|
|
260
420
|
}
|