@aws/nx-plugin 0.82.2 → 0.83.1
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-THIRD-PARTY +34 -6
- package/package.json +1 -1
- package/src/py/fast-api/__snapshots__/generator.spec.ts.snap +82 -18
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +53 -3
- package/src/py/mcp-server/generator.js +1 -0
- package/src/py/mcp-server/generator.js.map +1 -1
- package/src/py/strands-agent/__snapshots__/generator.spec.ts.snap +53 -3
- package/src/py/strands-agent/generator.js +1 -0
- package/src/py/strands-agent/generator.js.map +1 -1
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +52 -8
- package/src/smithy/ts/api/generator.js +2 -0
- package/src/smithy/ts/api/generator.js.map +1 -1
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +98 -18
- package/src/trpc/backend/generator.js +2 -0
- package/src/trpc/backend/generator.js.map +1 -1
- package/src/ts/lambda-function/generator.js +2 -0
- package/src/ts/lambda-function/generator.js.map +1 -1
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +54 -3
- package/src/ts/mcp-server/generator.js +7 -1
- package/src/ts/mcp-server/generator.js.map +1 -1
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +366 -20
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +2 -0
- package/src/ts/strands-agent/__snapshots__/generator.spec.ts.snap +52 -3
- package/src/ts/strands-agent/generator.js +3 -1
- package/src/ts/strands-agent/generator.js.map +1 -1
- package/src/utils/__snapshots__/shared-constructs.spec.ts.snap +157 -5
- package/src/utils/agent-core-constructs/files/cdk/app/agent-core/__nameKebabCase__/__nameKebabCase__.ts.template +14 -0
- package/src/utils/agent-core-constructs/files/terraform/app/agent-core/__nameKebabCase__/__nameKebabCase__.tf.template +37 -2
- package/src/utils/agent-core-constructs/files/terraform/core/agent-core/runtime.tf.template +1 -1
- package/src/utils/api-constructs/files/cdk/app/apis/http/__apiNameKebabCase__.ts.template +4 -0
- package/src/utils/api-constructs/files/cdk/app/apis/rest/__apiNameKebabCase__.ts.template +4 -0
- package/src/utils/api-constructs/files/cdk/core/api/http/http-api.ts.template +4 -3
- package/src/utils/api-constructs/files/cdk/core/api/rest/rest-api.ts.template +4 -3
- package/src/utils/api-constructs/files/terraform/app/apis/http/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +11 -2
- package/src/utils/api-constructs/files/terraform/app/apis/rest/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +11 -2
- package/src/utils/files/common/constructs/src/core/runtime-config.ts.template +157 -5
- package/src/utils/files/terraform/src/core/runtime-config/appconfig/appconfig.tf.template +100 -0
- package/src/utils/files/terraform/src/core/runtime-config/entry/entry.tf.template +19 -17
- package/src/utils/files/terraform/src/core/runtime-config/read/read.tf.template +12 -5
- package/src/utils/identity-constructs/files/cdk/core/user-identity.ts.template +2 -2
- package/src/utils/identity-constructs/files/terraform/core/user-identity/add-callback-url/add-callback-url.tf.template +2 -0
- package/src/utils/identity-constructs/files/terraform/core/user-identity/identity/identity.tf.template +10 -1
- package/src/utils/versions.d.ts +2 -0
- package/src/utils/versions.js +2 -0
- package/src/utils/versions.js.map +1 -1
- package/src/utils/website-constructs/files/cdk/core/static-website.ts.template +8 -3
- package/src/utils/website-constructs/files/terraform/core/static-website/static-website.tf.template +10 -1
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
Runtime,
|
|
26
26
|
RuntimeProps,
|
|
27
27
|
} from '@aws-cdk/aws-bedrock-agentcore-alpha';
|
|
28
|
+
import { RuntimeConfig } from '../../../core/runtime-config.js';
|
|
28
29
|
|
|
29
30
|
export type SnapshotBedrockServerProps = Omit<
|
|
30
31
|
RuntimeProps,
|
|
@@ -42,6 +43,8 @@ export class SnapshotBedrockServer extends Construct {
|
|
|
42
43
|
) {
|
|
43
44
|
super(scope, id);
|
|
44
45
|
|
|
46
|
+
const rc = RuntimeConfig.ensure(this);
|
|
47
|
+
|
|
45
48
|
this.dockerImage = AgentRuntimeArtifact.fromAsset(
|
|
46
49
|
path.dirname(url.fileURLToPath(new URL(import.meta.url))),
|
|
47
50
|
{
|
|
@@ -61,6 +64,17 @@ export class SnapshotBedrockServer extends Construct {
|
|
|
61
64
|
protocolConfiguration: ProtocolType.MCP,
|
|
62
65
|
agentRuntimeArtifact: this.dockerImage,
|
|
63
66
|
...props,
|
|
67
|
+
environmentVariables: {
|
|
68
|
+
RUNTIME_CONFIG_APP_ID: rc.appConfigApplicationId,
|
|
69
|
+
...props?.environmentVariables,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
rc.grantReadAppConfig(this.agentCoreRuntime);
|
|
74
|
+
|
|
75
|
+
rc.set('connection', 'agentRuntimes', {
|
|
76
|
+
...rc.get('connection').agentRuntimes,
|
|
77
|
+
SnapshotBedrockServer: this.agentCoreRuntime.agentRuntimeArn,
|
|
64
78
|
});
|
|
65
79
|
}
|
|
66
80
|
}
|
|
@@ -406,7 +420,7 @@ resource "aws_bedrockagentcore_agent_runtime" "agent_runtime" {
|
|
|
406
420
|
|
|
407
421
|
depends_on = [
|
|
408
422
|
null_resource.docker_publish,
|
|
409
|
-
|
|
423
|
+
aws_iam_role_policy_attachment.agent_core_policy
|
|
410
424
|
]
|
|
411
425
|
}
|
|
412
426
|
|
|
@@ -466,6 +480,12 @@ variable "tags" {
|
|
|
466
480
|
default = {}
|
|
467
481
|
}
|
|
468
482
|
|
|
483
|
+
module "appconfig" {
|
|
484
|
+
source = "../../../core/runtime-config/appconfig"
|
|
485
|
+
|
|
486
|
+
application_name = "TerraformSnapshotServer-runtime-config"
|
|
487
|
+
}
|
|
488
|
+
|
|
469
489
|
module "agent_core_runtime" {
|
|
470
490
|
source = "../../../core/agent-core"
|
|
471
491
|
agent_runtime_name = "TerraformSnapshotServer"
|
|
@@ -478,9 +498,33 @@ module "agent_core_runtime" {
|
|
|
478
498
|
# }
|
|
479
499
|
# }
|
|
480
500
|
|
|
481
|
-
env =
|
|
482
|
-
|
|
501
|
+
env = merge({
|
|
502
|
+
RUNTIME_CONFIG_APP_ID = module.appconfig.application_id
|
|
503
|
+
}, var.env)
|
|
504
|
+
additional_iam_policy_statements = concat([
|
|
505
|
+
{
|
|
506
|
+
Effect = "Allow"
|
|
507
|
+
Action = [
|
|
508
|
+
"appconfig:StartConfigurationSession",
|
|
509
|
+
"appconfig:GetLatestConfiguration"
|
|
510
|
+
]
|
|
511
|
+
Resource = ["\${module.appconfig.application_arn}/*"]
|
|
512
|
+
}
|
|
513
|
+
], var.additional_iam_policy_statements)
|
|
483
514
|
tags = var.tags
|
|
515
|
+
|
|
516
|
+
depends_on = [module.appconfig]
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
# Add agent runtime ARN to runtime config
|
|
520
|
+
module "add_agent_runtime_to_runtime_config" {
|
|
521
|
+
source = "../../../core/runtime-config/entry"
|
|
522
|
+
|
|
523
|
+
namespace = "connection"
|
|
524
|
+
key = "agentRuntimes"
|
|
525
|
+
value = { "TerraformSnapshotServer" = module.agent_core_runtime.agent_core_runtime_arn }
|
|
526
|
+
|
|
527
|
+
depends_on = [module.agent_core_runtime]
|
|
484
528
|
}
|
|
485
529
|
|
|
486
530
|
output "agent_core_runtime_role_arn" {
|
|
@@ -492,6 +536,11 @@ output "agent_core_runtime_arn" {
|
|
|
492
536
|
description = "ARN of the Bedrock Agent Core runtime"
|
|
493
537
|
value = module.agent_core_runtime.agent_core_runtime_arn
|
|
494
538
|
}
|
|
539
|
+
|
|
540
|
+
output "appconfig_application_id" {
|
|
541
|
+
description = "AppConfig Application ID for runtime config"
|
|
542
|
+
value = module.appconfig.application_id
|
|
543
|
+
}
|
|
495
544
|
"
|
|
496
545
|
`;
|
|
497
546
|
|
|
@@ -640,6 +689,8 @@ exports[`ts#mcp-server generator > should match snapshot for generated files > u
|
|
|
640
689
|
"snapshot-server": "./src/snapshot-server/stdio.js"
|
|
641
690
|
},
|
|
642
691
|
"dependencies": {
|
|
692
|
+
"@aws-lambda-powertools/parameters": "2.31.0",
|
|
693
|
+
"@aws-sdk/client-appconfigdata": "3.1004.0",
|
|
643
694
|
"@modelcontextprotocol/sdk": "1.27.1",
|
|
644
695
|
"express": "5.2.1",
|
|
645
696
|
"zod": "4.3.6"
|
|
@@ -62,7 +62,13 @@ const tsMcpServerGenerator = (tree, options) => tslib_1.__awaiter(void 0, void 0
|
|
|
62
62
|
distDir,
|
|
63
63
|
}, { overwriteStrategy: devkit_1.OverwriteStrategy.KeepExisting });
|
|
64
64
|
// Add dependencies
|
|
65
|
-
const deps = (0, versions_1.withVersions)([
|
|
65
|
+
const deps = (0, versions_1.withVersions)([
|
|
66
|
+
'@modelcontextprotocol/sdk',
|
|
67
|
+
'zod',
|
|
68
|
+
'express',
|
|
69
|
+
'@aws-lambda-powertools/parameters',
|
|
70
|
+
'@aws-sdk/client-appconfigdata',
|
|
71
|
+
]);
|
|
66
72
|
const devDeps = (0, versions_1.withVersions)([
|
|
67
73
|
'tsx',
|
|
68
74
|
'@types/express',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/ts/mcp-server/generator.ts"],"names":[],"mappings":";;;;AAAA;;;GAGG;AACH,uCAYoB;AAEpB,uCAMwB;AACxB,iDAAsE;AACtE,+CAA0D;AAC1D,mDAAoD;AACpD,6CAA2D;AAC3D,qEAA0E;AAC1E,mGAA4F;AAC5F,qDAAoD;AACpD,yCAAqD;AACrD,sDAAsE;AACtE,2CAA8C;AAEjC,QAAA,4BAA4B,GACvC,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAExB,MAAM,oBAAoB,GAAG,CAClC,IAAU,EACV,OAAmC,EACP,EAAE;;IAC9B,MAAM,OAAO,GAAG,IAAA,wCAAmC,EAAC,IAAI,EAAE,OAAO,CA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O,CAAC,IAAI;YAClB,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;IACL,CAAC;IAED,qFAAqF;IACrF,+DAA+D;IAC/D,0CAA0C;IAC1C,MAAM,GAAG,GAAG,IAAA,iBAAQ,EAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC;IAErE,+DAA+D;IAC/D,uFAAuF;IACvF,+BAA+B;IAC/B,IAAA,mBAAU,EAAC,IAAI,EAAE,sBAAsB,EAAE,CAAC,GAAG,EAAE,EAAE;;QAC/C,MAAA,GAAG,CAAC,GAAG,oCAAP,GAAG,CAAC,GAAG,GAAK,EAAE,EAAC;QACf,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,iBAAiB,WAAW,CAAC;QAChD,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;IAEH,0BAA0B;IAC1B,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,EACrC,eAAe,EACf;QACE,IAAI;QACJ,GAAG;QACH,OAAO;KACR,EACD,EAAE,iBAAiB,EAAE,0BAAiB,CAAC,YAAY,EAAE,CACtD,CAAC;IAEF,mBAAmB;IACnB,MAAM,IAAI,GAAG,IAAA,uBAAY,EAAC,
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/ts/mcp-server/generator.ts"],"names":[],"mappings":";;;;AAAA;;;GAGG;AACH,uCAYoB;AAEpB,uCAMwB;AACxB,iDAAsE;AACtE,+CAA0D;AAC1D,mDAAoD;AACpD,6CAA2D;AAC3D,qEAA0E;AAC1E,mGAA4F;AAC5F,qDAAoD;AACpD,yCAAqD;AACrD,sDAAsE;AACtE,2CAA8C;AAEjC,QAAA,4BAA4B,GACvC,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAExB,MAAM,oBAAoB,GAAG,CAClC,IAAU,EACV,OAAmC,EACP,EAAE;;I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4BAAmB,EAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC,CAAA,CAAC;AAtLW,QAAA,oBAAoB,wBAsL/B;AAEF,kBAAe,4BAAoB,CAAC"}
|
|
@@ -390,6 +390,13 @@ resource "aws_s3_bucket_ownership_controls" "distribution_logs_ownership" {
|
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
|
|
393
|
+
resource "aws_s3_bucket_acl" "distribution_logs_acl" {
|
|
394
|
+
#checkov:skip=CKV_AWS_70:ACL required for CloudFront standard logging
|
|
395
|
+
bucket = aws_s3_bucket.distribution_logs.id
|
|
396
|
+
acl = "log-delivery-write"
|
|
397
|
+
|
|
398
|
+
depends_on = [aws_s3_bucket_ownership_controls.distribution_logs_ownership]
|
|
399
|
+
}
|
|
393
400
|
|
|
394
401
|
resource "aws_s3_bucket_logging" "distribution_logs_logging" {
|
|
395
402
|
bucket = aws_s3_bucket.distribution_logs.id
|
|
@@ -622,9 +629,11 @@ resource "aws_s3_bucket_policy" "website_cloudfront_policy" {
|
|
|
622
629
|
depends_on = [aws_cloudfront_distribution.website]
|
|
623
630
|
}
|
|
624
631
|
|
|
625
|
-
# Read runtime config using the reader module
|
|
632
|
+
# Read runtime config using the reader module (connection namespace for website)
|
|
626
633
|
module "runtime_config_reader" {
|
|
627
634
|
source = "../runtime-config/read"
|
|
635
|
+
|
|
636
|
+
namespace = "connection"
|
|
628
637
|
}
|
|
629
638
|
|
|
630
639
|
# Upload website files to S3
|
|
@@ -1322,13 +1331,44 @@ export * from './runtime-config.js';
|
|
|
1322
1331
|
`;
|
|
1323
1332
|
|
|
1324
1333
|
exports[`react-website generator > Tanstack router integration > should generate website with no router correctly > packages/common/constructs/src/core/runtime-config.ts 1`] = `
|
|
1325
|
-
"import {
|
|
1326
|
-
|
|
1334
|
+
"import {
|
|
1335
|
+
ArnFormat,
|
|
1336
|
+
Aspects,
|
|
1337
|
+
CfnOutput,
|
|
1338
|
+
Lazy,
|
|
1339
|
+
Names,
|
|
1340
|
+
Stack,
|
|
1341
|
+
Stage,
|
|
1342
|
+
} from 'aws-cdk-lib';
|
|
1343
|
+
import {
|
|
1344
|
+
CfnApplication,
|
|
1345
|
+
CfnConfigurationProfile,
|
|
1346
|
+
CfnDeployment,
|
|
1347
|
+
CfnDeploymentStrategy,
|
|
1348
|
+
CfnEnvironment,
|
|
1349
|
+
CfnHostedConfigurationVersion,
|
|
1350
|
+
} from 'aws-cdk-lib/aws-appconfig';
|
|
1351
|
+
import { Grant, IGrantable } from 'aws-cdk-lib/aws-iam';
|
|
1352
|
+
import { Construct, IConstruct } from 'constructs';
|
|
1327
1353
|
|
|
1328
1354
|
const RuntimeConfigKey = '__RuntimeConfig__';
|
|
1329
1355
|
|
|
1356
|
+
/**
|
|
1357
|
+
* Stage-scoped singleton that collects runtime configuration from CDK constructs
|
|
1358
|
+
* and delivers it to server-side (AppConfig) and client-side (S3) consumers.
|
|
1359
|
+
*
|
|
1360
|
+
* Configuration is organised into namespaces (mapped to AppConfig Configuration Profiles):
|
|
1361
|
+
* \`\`\`ts
|
|
1362
|
+
* const rc = RuntimeConfig.ensure(this);
|
|
1363
|
+
* rc.set('connection', 'cognitoProps', { region: '...', userPoolId: '...' });
|
|
1364
|
+
* rc.set('tables', 'users', { tableName: '...', arn: '...' });
|
|
1365
|
+
* \`\`\`
|
|
1366
|
+
*/
|
|
1330
1367
|
export class RuntimeConfig extends Construct {
|
|
1331
|
-
private readonly
|
|
1368
|
+
private readonly _namespaces = new Map<string, Record<string, any>>();
|
|
1369
|
+
private _appConfigApplicationId?: string;
|
|
1370
|
+
private _appConfigApplicationArn?: string;
|
|
1371
|
+
private _aspectRegistered = false;
|
|
1332
1372
|
|
|
1333
1373
|
static ensure(scope: Construct): RuntimeConfig {
|
|
1334
1374
|
const parent = Stage.of(scope) ?? Stack.of(scope);
|
|
@@ -1348,15 +1388,142 @@ export class RuntimeConfig extends Construct {
|
|
|
1348
1388
|
super(scope, id);
|
|
1349
1389
|
}
|
|
1350
1390
|
|
|
1351
|
-
|
|
1352
|
-
|
|
1391
|
+
/** Sets a key in the given namespace. Creates the namespace if it doesn't exist. */
|
|
1392
|
+
set(namespace: string, key: string, value: any): void {
|
|
1393
|
+
let data = this._namespaces.get(namespace);
|
|
1394
|
+
if (!data) {
|
|
1395
|
+
data = {};
|
|
1396
|
+
this._namespaces.set(namespace, data);
|
|
1397
|
+
}
|
|
1398
|
+
data[key] = value;
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
/** Returns the config data for a namespace. Creates it if it doesn't exist. */
|
|
1402
|
+
get(namespace: string): Record<string, any> {
|
|
1403
|
+
let data = this._namespaces.get(namespace);
|
|
1404
|
+
if (!data) {
|
|
1405
|
+
data = {};
|
|
1406
|
+
this._namespaces.set(namespace, data);
|
|
1407
|
+
}
|
|
1408
|
+
return data;
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
/** Returns a lazy token resolving to the AppConfig Application ID. */
|
|
1412
|
+
get appConfigApplicationId(): string {
|
|
1413
|
+
this.ensureAspect();
|
|
1414
|
+
return Lazy.string({
|
|
1415
|
+
produce: () => {
|
|
1416
|
+
if (!this._appConfigApplicationId) {
|
|
1417
|
+
throw new Error(
|
|
1418
|
+
'RuntimeConfig AppConfig resources were not created.',
|
|
1419
|
+
);
|
|
1420
|
+
}
|
|
1421
|
+
return this._appConfigApplicationId;
|
|
1422
|
+
},
|
|
1423
|
+
});
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
/** Grants a server-side consumer permission to read from AppConfig. */
|
|
1427
|
+
grantReadAppConfig(grantee: IGrantable): Grant {
|
|
1428
|
+
this.ensureAspect();
|
|
1429
|
+
return Grant.addToPrincipal({
|
|
1430
|
+
grantee,
|
|
1431
|
+
actions: [
|
|
1432
|
+
'appconfig:StartConfigurationSession',
|
|
1433
|
+
'appconfig:GetLatestConfiguration',
|
|
1434
|
+
],
|
|
1435
|
+
resourceArns: [
|
|
1436
|
+
Lazy.string({ produce: () => this._appConfigApplicationArn }),
|
|
1437
|
+
],
|
|
1438
|
+
});
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
private ensureAspect(): void {
|
|
1442
|
+
if (this._aspectRegistered) return;
|
|
1443
|
+
this._aspectRegistered = true;
|
|
1444
|
+
let created = false;
|
|
1445
|
+
|
|
1446
|
+
Aspects.of(this.node.scope!).add({
|
|
1447
|
+
visit: (node: IConstruct) => {
|
|
1448
|
+
if (created || !(node instanceof Stack)) return;
|
|
1449
|
+
created = true;
|
|
1450
|
+
|
|
1451
|
+
const stack = node;
|
|
1452
|
+
const name = Names.uniqueResourceName(this, {
|
|
1453
|
+
maxLength: 64,
|
|
1454
|
+
separator: '-',
|
|
1455
|
+
});
|
|
1456
|
+
|
|
1457
|
+
const app = new CfnApplication(stack, 'RcAppConfigApp', { name });
|
|
1458
|
+
const strategy = new CfnDeploymentStrategy(
|
|
1459
|
+
stack,
|
|
1460
|
+
'RcAppConfigStrategy',
|
|
1461
|
+
{
|
|
1462
|
+
name,
|
|
1463
|
+
deploymentDurationInMinutes: 0,
|
|
1464
|
+
growthFactor: 100,
|
|
1465
|
+
replicateTo: 'NONE',
|
|
1466
|
+
finalBakeTimeInMinutes: 0,
|
|
1467
|
+
},
|
|
1468
|
+
);
|
|
1469
|
+
const env = new CfnEnvironment(stack, 'RcAppConfigEnv', {
|
|
1470
|
+
applicationId: app.ref,
|
|
1471
|
+
name: 'default',
|
|
1472
|
+
});
|
|
1473
|
+
|
|
1474
|
+
for (const [ns, data] of this._namespaces.entries()) {
|
|
1475
|
+
const profile = new CfnConfigurationProfile(
|
|
1476
|
+
stack,
|
|
1477
|
+
\`RcAppConfigProfile\${ns}\`,
|
|
1478
|
+
{
|
|
1479
|
+
applicationId: app.ref,
|
|
1480
|
+
name: ns,
|
|
1481
|
+
locationUri: 'hosted',
|
|
1482
|
+
type: 'AWS.Freeform',
|
|
1483
|
+
},
|
|
1484
|
+
);
|
|
1485
|
+
const version = new CfnHostedConfigurationVersion(
|
|
1486
|
+
stack,
|
|
1487
|
+
\`RcAppConfigVersion\${ns}\`,
|
|
1488
|
+
{
|
|
1489
|
+
applicationId: app.ref,
|
|
1490
|
+
configurationProfileId: profile.ref,
|
|
1491
|
+
contentType: 'application/json',
|
|
1492
|
+
content: Lazy.string({ produce: () => stack.toJsonString(data) }),
|
|
1493
|
+
},
|
|
1494
|
+
);
|
|
1495
|
+
new CfnDeployment(stack, \`RcAppConfigDeploy\${ns}\`, {
|
|
1496
|
+
applicationId: app.ref,
|
|
1497
|
+
environmentId: env.ref,
|
|
1498
|
+
configurationProfileId: profile.ref,
|
|
1499
|
+
configurationVersion: version.ref,
|
|
1500
|
+
deploymentStrategyId: strategy.ref,
|
|
1501
|
+
});
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
new CfnOutput(stack, 'RuntimeConfigApplicationId', { value: app.ref });
|
|
1505
|
+
this._appConfigApplicationId = app.ref;
|
|
1506
|
+
this._appConfigApplicationArn = stack.formatArn({
|
|
1507
|
+
service: 'appconfig',
|
|
1508
|
+
resource: 'application',
|
|
1509
|
+
resourceName: \`\${app.ref}/*\`,
|
|
1510
|
+
arnFormat: ArnFormat.SLASH_RESOURCE_NAME,
|
|
1511
|
+
});
|
|
1512
|
+
},
|
|
1513
|
+
});
|
|
1353
1514
|
}
|
|
1354
1515
|
}
|
|
1355
1516
|
"
|
|
1356
1517
|
`;
|
|
1357
1518
|
|
|
1358
1519
|
exports[`react-website generator > Tanstack router integration > should generate website with no router correctly > packages/common/constructs/src/core/static-website.ts 1`] = `
|
|
1359
|
-
"import {
|
|
1520
|
+
"import {
|
|
1521
|
+
CfnOutput,
|
|
1522
|
+
CfnResource,
|
|
1523
|
+
Lazy,
|
|
1524
|
+
RemovalPolicy,
|
|
1525
|
+
Stack,
|
|
1526
|
+
} from 'aws-cdk-lib';
|
|
1360
1527
|
import { Distribution, ViewerProtocolPolicy } from 'aws-cdk-lib/aws-cloudfront';
|
|
1361
1528
|
import { S3BucketOrigin } from 'aws-cdk-lib/aws-cloudfront-origins';
|
|
1362
1529
|
import {
|
|
@@ -1503,9 +1670,14 @@ export class StaticWebsite extends Construct {
|
|
|
1503
1670
|
this.bucketDeployment = new BucketDeployment(this, 'WebsiteDeployment', {
|
|
1504
1671
|
sources: [
|
|
1505
1672
|
Source.asset(websiteFilePath),
|
|
1506
|
-
Source.
|
|
1673
|
+
Source.data(
|
|
1507
1674
|
DEFAULT_RUNTIME_CONFIG_FILENAME,
|
|
1508
|
-
|
|
1675
|
+
Lazy.string({
|
|
1676
|
+
produce: () =>
|
|
1677
|
+
Stack.of(this).toJsonString(
|
|
1678
|
+
RuntimeConfig.ensure(this).get('connection'),
|
|
1679
|
+
),
|
|
1680
|
+
}),
|
|
1509
1681
|
),
|
|
1510
1682
|
],
|
|
1511
1683
|
destinationBucket: this.websiteBucket,
|
|
@@ -2754,13 +2926,44 @@ export * from './runtime-config.js';
|
|
|
2754
2926
|
`;
|
|
2755
2927
|
|
|
2756
2928
|
exports[`react-website generator > Tanstack router integration > should generate website with router correctly > packages/common/constructs/src/core/runtime-config.ts 1`] = `
|
|
2757
|
-
"import {
|
|
2758
|
-
|
|
2929
|
+
"import {
|
|
2930
|
+
ArnFormat,
|
|
2931
|
+
Aspects,
|
|
2932
|
+
CfnOutput,
|
|
2933
|
+
Lazy,
|
|
2934
|
+
Names,
|
|
2935
|
+
Stack,
|
|
2936
|
+
Stage,
|
|
2937
|
+
} from 'aws-cdk-lib';
|
|
2938
|
+
import {
|
|
2939
|
+
CfnApplication,
|
|
2940
|
+
CfnConfigurationProfile,
|
|
2941
|
+
CfnDeployment,
|
|
2942
|
+
CfnDeploymentStrategy,
|
|
2943
|
+
CfnEnvironment,
|
|
2944
|
+
CfnHostedConfigurationVersion,
|
|
2945
|
+
} from 'aws-cdk-lib/aws-appconfig';
|
|
2946
|
+
import { Grant, IGrantable } from 'aws-cdk-lib/aws-iam';
|
|
2947
|
+
import { Construct, IConstruct } from 'constructs';
|
|
2759
2948
|
|
|
2760
2949
|
const RuntimeConfigKey = '__RuntimeConfig__';
|
|
2761
2950
|
|
|
2951
|
+
/**
|
|
2952
|
+
* Stage-scoped singleton that collects runtime configuration from CDK constructs
|
|
2953
|
+
* and delivers it to server-side (AppConfig) and client-side (S3) consumers.
|
|
2954
|
+
*
|
|
2955
|
+
* Configuration is organised into namespaces (mapped to AppConfig Configuration Profiles):
|
|
2956
|
+
* \`\`\`ts
|
|
2957
|
+
* const rc = RuntimeConfig.ensure(this);
|
|
2958
|
+
* rc.set('connection', 'cognitoProps', { region: '...', userPoolId: '...' });
|
|
2959
|
+
* rc.set('tables', 'users', { tableName: '...', arn: '...' });
|
|
2960
|
+
* \`\`\`
|
|
2961
|
+
*/
|
|
2762
2962
|
export class RuntimeConfig extends Construct {
|
|
2763
|
-
private readonly
|
|
2963
|
+
private readonly _namespaces = new Map<string, Record<string, any>>();
|
|
2964
|
+
private _appConfigApplicationId?: string;
|
|
2965
|
+
private _appConfigApplicationArn?: string;
|
|
2966
|
+
private _aspectRegistered = false;
|
|
2764
2967
|
|
|
2765
2968
|
static ensure(scope: Construct): RuntimeConfig {
|
|
2766
2969
|
const parent = Stage.of(scope) ?? Stack.of(scope);
|
|
@@ -2780,15 +2983,142 @@ export class RuntimeConfig extends Construct {
|
|
|
2780
2983
|
super(scope, id);
|
|
2781
2984
|
}
|
|
2782
2985
|
|
|
2783
|
-
|
|
2784
|
-
|
|
2986
|
+
/** Sets a key in the given namespace. Creates the namespace if it doesn't exist. */
|
|
2987
|
+
set(namespace: string, key: string, value: any): void {
|
|
2988
|
+
let data = this._namespaces.get(namespace);
|
|
2989
|
+
if (!data) {
|
|
2990
|
+
data = {};
|
|
2991
|
+
this._namespaces.set(namespace, data);
|
|
2992
|
+
}
|
|
2993
|
+
data[key] = value;
|
|
2994
|
+
}
|
|
2995
|
+
|
|
2996
|
+
/** Returns the config data for a namespace. Creates it if it doesn't exist. */
|
|
2997
|
+
get(namespace: string): Record<string, any> {
|
|
2998
|
+
let data = this._namespaces.get(namespace);
|
|
2999
|
+
if (!data) {
|
|
3000
|
+
data = {};
|
|
3001
|
+
this._namespaces.set(namespace, data);
|
|
3002
|
+
}
|
|
3003
|
+
return data;
|
|
3004
|
+
}
|
|
3005
|
+
|
|
3006
|
+
/** Returns a lazy token resolving to the AppConfig Application ID. */
|
|
3007
|
+
get appConfigApplicationId(): string {
|
|
3008
|
+
this.ensureAspect();
|
|
3009
|
+
return Lazy.string({
|
|
3010
|
+
produce: () => {
|
|
3011
|
+
if (!this._appConfigApplicationId) {
|
|
3012
|
+
throw new Error(
|
|
3013
|
+
'RuntimeConfig AppConfig resources were not created.',
|
|
3014
|
+
);
|
|
3015
|
+
}
|
|
3016
|
+
return this._appConfigApplicationId;
|
|
3017
|
+
},
|
|
3018
|
+
});
|
|
3019
|
+
}
|
|
3020
|
+
|
|
3021
|
+
/** Grants a server-side consumer permission to read from AppConfig. */
|
|
3022
|
+
grantReadAppConfig(grantee: IGrantable): Grant {
|
|
3023
|
+
this.ensureAspect();
|
|
3024
|
+
return Grant.addToPrincipal({
|
|
3025
|
+
grantee,
|
|
3026
|
+
actions: [
|
|
3027
|
+
'appconfig:StartConfigurationSession',
|
|
3028
|
+
'appconfig:GetLatestConfiguration',
|
|
3029
|
+
],
|
|
3030
|
+
resourceArns: [
|
|
3031
|
+
Lazy.string({ produce: () => this._appConfigApplicationArn }),
|
|
3032
|
+
],
|
|
3033
|
+
});
|
|
3034
|
+
}
|
|
3035
|
+
|
|
3036
|
+
private ensureAspect(): void {
|
|
3037
|
+
if (this._aspectRegistered) return;
|
|
3038
|
+
this._aspectRegistered = true;
|
|
3039
|
+
let created = false;
|
|
3040
|
+
|
|
3041
|
+
Aspects.of(this.node.scope!).add({
|
|
3042
|
+
visit: (node: IConstruct) => {
|
|
3043
|
+
if (created || !(node instanceof Stack)) return;
|
|
3044
|
+
created = true;
|
|
3045
|
+
|
|
3046
|
+
const stack = node;
|
|
3047
|
+
const name = Names.uniqueResourceName(this, {
|
|
3048
|
+
maxLength: 64,
|
|
3049
|
+
separator: '-',
|
|
3050
|
+
});
|
|
3051
|
+
|
|
3052
|
+
const app = new CfnApplication(stack, 'RcAppConfigApp', { name });
|
|
3053
|
+
const strategy = new CfnDeploymentStrategy(
|
|
3054
|
+
stack,
|
|
3055
|
+
'RcAppConfigStrategy',
|
|
3056
|
+
{
|
|
3057
|
+
name,
|
|
3058
|
+
deploymentDurationInMinutes: 0,
|
|
3059
|
+
growthFactor: 100,
|
|
3060
|
+
replicateTo: 'NONE',
|
|
3061
|
+
finalBakeTimeInMinutes: 0,
|
|
3062
|
+
},
|
|
3063
|
+
);
|
|
3064
|
+
const env = new CfnEnvironment(stack, 'RcAppConfigEnv', {
|
|
3065
|
+
applicationId: app.ref,
|
|
3066
|
+
name: 'default',
|
|
3067
|
+
});
|
|
3068
|
+
|
|
3069
|
+
for (const [ns, data] of this._namespaces.entries()) {
|
|
3070
|
+
const profile = new CfnConfigurationProfile(
|
|
3071
|
+
stack,
|
|
3072
|
+
\`RcAppConfigProfile\${ns}\`,
|
|
3073
|
+
{
|
|
3074
|
+
applicationId: app.ref,
|
|
3075
|
+
name: ns,
|
|
3076
|
+
locationUri: 'hosted',
|
|
3077
|
+
type: 'AWS.Freeform',
|
|
3078
|
+
},
|
|
3079
|
+
);
|
|
3080
|
+
const version = new CfnHostedConfigurationVersion(
|
|
3081
|
+
stack,
|
|
3082
|
+
\`RcAppConfigVersion\${ns}\`,
|
|
3083
|
+
{
|
|
3084
|
+
applicationId: app.ref,
|
|
3085
|
+
configurationProfileId: profile.ref,
|
|
3086
|
+
contentType: 'application/json',
|
|
3087
|
+
content: Lazy.string({ produce: () => stack.toJsonString(data) }),
|
|
3088
|
+
},
|
|
3089
|
+
);
|
|
3090
|
+
new CfnDeployment(stack, \`RcAppConfigDeploy\${ns}\`, {
|
|
3091
|
+
applicationId: app.ref,
|
|
3092
|
+
environmentId: env.ref,
|
|
3093
|
+
configurationProfileId: profile.ref,
|
|
3094
|
+
configurationVersion: version.ref,
|
|
3095
|
+
deploymentStrategyId: strategy.ref,
|
|
3096
|
+
});
|
|
3097
|
+
}
|
|
3098
|
+
|
|
3099
|
+
new CfnOutput(stack, 'RuntimeConfigApplicationId', { value: app.ref });
|
|
3100
|
+
this._appConfigApplicationId = app.ref;
|
|
3101
|
+
this._appConfigApplicationArn = stack.formatArn({
|
|
3102
|
+
service: 'appconfig',
|
|
3103
|
+
resource: 'application',
|
|
3104
|
+
resourceName: \`\${app.ref}/*\`,
|
|
3105
|
+
arnFormat: ArnFormat.SLASH_RESOURCE_NAME,
|
|
3106
|
+
});
|
|
3107
|
+
},
|
|
3108
|
+
});
|
|
2785
3109
|
}
|
|
2786
3110
|
}
|
|
2787
3111
|
"
|
|
2788
3112
|
`;
|
|
2789
3113
|
|
|
2790
3114
|
exports[`react-website generator > Tanstack router integration > should generate website with router correctly > packages/common/constructs/src/core/static-website.ts 1`] = `
|
|
2791
|
-
"import {
|
|
3115
|
+
"import {
|
|
3116
|
+
CfnOutput,
|
|
3117
|
+
CfnResource,
|
|
3118
|
+
Lazy,
|
|
3119
|
+
RemovalPolicy,
|
|
3120
|
+
Stack,
|
|
3121
|
+
} from 'aws-cdk-lib';
|
|
2792
3122
|
import { Distribution, ViewerProtocolPolicy } from 'aws-cdk-lib/aws-cloudfront';
|
|
2793
3123
|
import { S3BucketOrigin } from 'aws-cdk-lib/aws-cloudfront-origins';
|
|
2794
3124
|
import {
|
|
@@ -2935,9 +3265,14 @@ export class StaticWebsite extends Construct {
|
|
|
2935
3265
|
this.bucketDeployment = new BucketDeployment(this, 'WebsiteDeployment', {
|
|
2936
3266
|
sources: [
|
|
2937
3267
|
Source.asset(websiteFilePath),
|
|
2938
|
-
Source.
|
|
3268
|
+
Source.data(
|
|
2939
3269
|
DEFAULT_RUNTIME_CONFIG_FILENAME,
|
|
2940
|
-
|
|
3270
|
+
Lazy.string({
|
|
3271
|
+
produce: () =>
|
|
3272
|
+
Stack.of(this).toJsonString(
|
|
3273
|
+
RuntimeConfig.ensure(this).get('connection'),
|
|
3274
|
+
),
|
|
3275
|
+
}),
|
|
2941
3276
|
),
|
|
2942
3277
|
],
|
|
2943
3278
|
destinationBucket: this.websiteBucket,
|
|
@@ -4253,7 +4588,13 @@ export * from './runtime-config.js';
|
|
|
4253
4588
|
`;
|
|
4254
4589
|
|
|
4255
4590
|
exports[`react-website generator > should generate shared constructs > common/constructs-core-static-website.ts 1`] = `
|
|
4256
|
-
"import {
|
|
4591
|
+
"import {
|
|
4592
|
+
CfnOutput,
|
|
4593
|
+
CfnResource,
|
|
4594
|
+
Lazy,
|
|
4595
|
+
RemovalPolicy,
|
|
4596
|
+
Stack,
|
|
4597
|
+
} from 'aws-cdk-lib';
|
|
4257
4598
|
import { Distribution, ViewerProtocolPolicy } from 'aws-cdk-lib/aws-cloudfront';
|
|
4258
4599
|
import { S3BucketOrigin } from 'aws-cdk-lib/aws-cloudfront-origins';
|
|
4259
4600
|
import {
|
|
@@ -4400,9 +4741,14 @@ export class StaticWebsite extends Construct {
|
|
|
4400
4741
|
this.bucketDeployment = new BucketDeployment(this, 'WebsiteDeployment', {
|
|
4401
4742
|
sources: [
|
|
4402
4743
|
Source.asset(websiteFilePath),
|
|
4403
|
-
Source.
|
|
4744
|
+
Source.data(
|
|
4404
4745
|
DEFAULT_RUNTIME_CONFIG_FILENAME,
|
|
4405
|
-
|
|
4746
|
+
Lazy.string({
|
|
4747
|
+
produce: () =>
|
|
4748
|
+
Stack.of(this).toJsonString(
|
|
4749
|
+
RuntimeConfig.ensure(this).get('connection'),
|
|
4750
|
+
),
|
|
4751
|
+
}),
|
|
4406
4752
|
),
|
|
4407
4753
|
],
|
|
4408
4754
|
destinationBucket: this.websiteBucket,
|
|
@@ -133,12 +133,12 @@ export class UserIdentity extends Construct {
|
|
|
133
133
|
this.userPoolDomain,
|
|
134
134
|
);
|
|
135
135
|
|
|
136
|
-
RuntimeConfig.ensure(this).
|
|
136
|
+
RuntimeConfig.ensure(this).set('connection', 'cognitoProps', {
|
|
137
137
|
region: Stack.of(this).region,
|
|
138
138
|
identityPoolId: this.identityPool.identityPoolId,
|
|
139
139
|
userPoolId: this.userPool.userPoolId,
|
|
140
140
|
userPoolWebClientId: this.userPoolClient.userPoolClientId,
|
|
141
|
-
};
|
|
141
|
+
});
|
|
142
142
|
|
|
143
143
|
suppressRules(
|
|
144
144
|
this.userPool,
|