@aws/nx-plugin 0.42.1 → 0.44.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/README.md +1 -0
- package/generators.json +6 -0
- package/package.json +7 -7
- package/sdk/py.d.ts +2 -0
- package/sdk/py.js +3 -1
- package/sdk/py.js.map +1 -1
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +14 -14
- package/src/license/__snapshots__/config.spec.ts.snap +3 -3
- package/src/license/config.js +5 -3
- package/src/license/config.js.map +1 -1
- package/src/mcp-server/tools/create-workspace-command.js +1 -1
- package/src/preset/__snapshots__/generator.spec.ts.snap +5 -3
- package/src/py/fast-api/generator.js +2 -7
- package/src/py/fast-api/generator.js.map +1 -1
- package/src/py/fast-api/react/generator.js +2 -2
- package/src/py/fast-api/react/generator.js.map +1 -1
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +27 -2
- package/src/py/mcp-server/files/Dockerfile.template +1 -5
- package/src/py/mcp-server/generator.js +10 -6
- package/src/py/mcp-server/generator.js.map +1 -1
- package/src/py/mcp-server/schema.json +3 -3
- package/src/py/project/generator.js +16 -1
- package/src/py/project/generator.js.map +1 -1
- package/src/py/strands-agent/__snapshots__/generator.spec.ts.snap +375 -0
- package/src/py/strands-agent/files/Dockerfile.template +14 -0
- package/src/py/strands-agent/files/__init__.py.template +0 -0
- package/src/py/strands-agent/files/agent.py.template +22 -0
- package/src/py/strands-agent/files/agentcore_mcp_client.py.template +99 -0
- package/src/py/strands-agent/files/main.py.template +24 -0
- package/src/py/strands-agent/generator.d.ts +10 -0
- package/src/py/strands-agent/generator.js +137 -0
- package/src/py/strands-agent/generator.js.map +1 -0
- package/src/py/strands-agent/schema.d.ts +12 -0
- package/src/py/strands-agent/schema.json +33 -0
- package/src/terraform/project/files/application/src/main.tf.template +5 -0
- package/src/terraform/project/generator.js +13 -5
- package/src/terraform/project/generator.js.map +1 -1
- package/src/trpc/backend/generator.js +27 -33
- package/src/trpc/backend/generator.js.map +1 -1
- package/src/trpc/react/generator.js +2 -2
- package/src/trpc/react/generator.js.map +1 -1
- package/src/ts/lib/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +22 -1
- package/src/ts/mcp-server/generator.js +4 -3
- package/src/ts/mcp-server/generator.js.map +1 -1
- package/src/ts/mcp-server/schema.json +3 -3
- package/src/ts/nx-plugin/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/nx-plugin/files/mcp-server/tools/create-workspace-command.ts.template +1 -1
- package/src/ts/nx-plugin/generator.js +4 -1
- package/src/ts/nx-plugin/generator.js.map +1 -1
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +33 -484
- package/src/ts/react-website/cognito-auth/generator.js +0 -25
- package/src/ts/react-website/cognito-auth/generator.js.map +1 -1
- package/src/ts/react-website/runtime-config/__snapshots__/generator.spec.ts.snap +6 -5
- package/src/ts/react-website/runtime-config/files/app/components/RuntimeConfig/index.tsx.template +3 -1
- package/src/ts/react-website/runtime-config/files/app/hooks/useRuntimeConfig.tsx.template +1 -2
- package/src/utils/__snapshots__/shared-constructs.spec.ts.snap +3 -15
- package/src/utils/agent-core-constructs/agent-core-constructs.d.ts +16 -0
- package/src/utils/agent-core-constructs/agent-core-constructs.js +33 -8
- package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
- package/src/utils/agent-core-constructs/files/app/{mcp-servers/__mcpServerNameKebabCase__/__mcpServerNameKebabCase__.ts.template → agent-core/__nameKebabCase__/__nameKebabCase__.ts.template} +5 -5
- package/src/utils/agent-core-constructs/files/core/agent-core/runtime.ts.template +22 -1
- package/src/utils/api-constructs/api-constructs.js +0 -30
- package/src/utils/api-constructs/api-constructs.js.map +1 -1
- package/src/utils/files/common/constructs/src/core/runtime-config.ts.template +3 -4
- package/src/utils/files/terraform/src/metrics/metrics.tf.template +19 -0
- package/src/utils/metrics.d.ts +3 -1
- package/src/utils/metrics.js +36 -3
- package/src/utils/metrics.js.map +1 -1
- package/src/utils/port.d.ts +4 -6
- package/src/utils/port.js +32 -12
- package/src/utils/port.js.map +1 -1
- package/src/utils/shared-constructs-constants.d.ts +0 -2
- package/src/utils/shared-constructs-constants.js +1 -3
- package/src/utils/shared-constructs-constants.js.map +1 -1
- package/src/utils/shared-constructs.d.ts +4 -1
- package/src/utils/shared-constructs.js +49 -45
- package/src/utils/shared-constructs.js.map +1 -1
- package/src/utils/versions.d.ts +7 -2
- package/src/utils/versions.js +6 -1
- package/src/utils/versions.js.map +1 -1
- package/src/utils/files/common/types/src/index.ts.template +0 -1
- package/src/utils/files/common/types/src/runtime-config.ts.template +0 -2
- /package/src/utils/agent-core-constructs/files/app/{mcp-servers/__mcpServerNameKebabCase__ → agent-core/__nameKebabCase__}/Dockerfile.template +0 -0
|
@@ -32,31 +32,6 @@ function tsReactWebsiteAuthGenerator(tree, options) {
|
|
|
32
32
|
project: options.project,
|
|
33
33
|
});
|
|
34
34
|
yield (0, shared_constructs_1.sharedConstructsGenerator)(tree);
|
|
35
|
-
// Add ICognitoProps interface and update IRuntimeConfig
|
|
36
|
-
const runtimeConfigPath = (0, devkit_1.joinPathFragments)(shared_constructs_constants_1.PACKAGES_DIR, shared_constructs_constants_1.TYPE_DEFINITIONS_DIR, 'src', 'runtime-config.ts');
|
|
37
|
-
// Check if ICognitoProps interface exists
|
|
38
|
-
const existingCognitoProps = (0, ast_1.query)(tree, runtimeConfigPath, 'InterfaceDeclaration[name.text="ICognitoProps"]');
|
|
39
|
-
// Check if cognitoProps property exists in IRuntimeConfig
|
|
40
|
-
const existingCognitoPropsInConfig = (0, ast_1.query)(tree, runtimeConfigPath, 'InterfaceDeclaration[name.text="IRuntimeConfig"] PropertySignature[name.text="cognitoProps"]');
|
|
41
|
-
// Add ICognitoProps interface if it doesn't exist
|
|
42
|
-
if (existingCognitoProps.length === 0) {
|
|
43
|
-
const cognitoPropsInterface = typescript_1.factory.createInterfaceDeclaration([typescript_1.factory.createModifier(typescript_1.SyntaxKind.ExportKeyword)], typescript_1.factory.createIdentifier('ICognitoProps'), undefined, undefined, [
|
|
44
|
-
typescript_1.factory.createPropertySignature(undefined, typescript_1.factory.createIdentifier('region'), undefined, typescript_1.factory.createKeywordTypeNode(typescript_1.SyntaxKind.StringKeyword)),
|
|
45
|
-
typescript_1.factory.createPropertySignature(undefined, typescript_1.factory.createIdentifier('identityPoolId'), undefined, typescript_1.factory.createKeywordTypeNode(typescript_1.SyntaxKind.StringKeyword)),
|
|
46
|
-
typescript_1.factory.createPropertySignature(undefined, typescript_1.factory.createIdentifier('userPoolId'), undefined, typescript_1.factory.createKeywordTypeNode(typescript_1.SyntaxKind.StringKeyword)),
|
|
47
|
-
typescript_1.factory.createPropertySignature(undefined, typescript_1.factory.createIdentifier('userPoolWebClientId'), undefined, typescript_1.factory.createKeywordTypeNode(typescript_1.SyntaxKind.StringKeyword)),
|
|
48
|
-
]);
|
|
49
|
-
(0, ast_1.prependStatements)(tree, runtimeConfigPath, [cognitoPropsInterface]);
|
|
50
|
-
}
|
|
51
|
-
// Add cognitoProps to IRuntimeConfig if it doesn't exist
|
|
52
|
-
if (existingCognitoPropsInConfig.length === 0) {
|
|
53
|
-
(0, ast_1.replace)(tree, runtimeConfigPath, 'InterfaceDeclaration[name.text="IRuntimeConfig"]', (node) => {
|
|
54
|
-
return typescript_1.factory.updateInterfaceDeclaration(node, node.modifiers, node.name, node.typeParameters, node.heritageClauses, [
|
|
55
|
-
...node.members,
|
|
56
|
-
typescript_1.factory.createPropertySignature(undefined, typescript_1.factory.createIdentifier('cognitoProps'), undefined, typescript_1.factory.createTypeReferenceNode('ICognitoProps', undefined)),
|
|
57
|
-
]);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
35
|
const identityPath = (0, devkit_1.joinPathFragments)(shared_constructs_constants_1.PACKAGES_DIR, shared_constructs_constants_1.SHARED_CONSTRUCTS_DIR, 'src', 'core', 'user-identity.ts');
|
|
61
36
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files', 'app'), srcRoot, options, {
|
|
62
37
|
overwriteStrategy: devkit_1.OverwriteStrategy.KeepExisting,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/nx-plugin/src/ts/react-website/cognito-auth/generator.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/nx-plugin/src/ts/react-website/cognito-auth/generator.ts"],"names":[],"mappings":";;;AAkDA,kEA8XC;;AAhbD;;;GAGG;AACH,uCAOoB;AACpB,wEAA6E;AAC7E,4FAGoD;AAEpD,2DAAqE;AACrE,2CASoB;AACpB,sDAAuD;AACvD,4CAO4B;AAC5B,kDAA6D;AAC7D,0CAI2B;AAC3B,oDAAyE;AACzE,wDAAkF;AAErE,QAAA,2BAA2B,GACtC,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAE/B,SAAsB,2BAA2B,CAC/C,IAAU,EACV,OAA0C;;QAE1C,MAAM,OAAO,GAAG,IAAA,wCAAmC,EACjD,IAAI,EACJ,OAAO,CAAC,OAAO,CAChB,CAAC,UAAU,CAAC;QACb,IACE,IAAI,CAAC,MAAM,CAAC,IAAA,0BAAiB,EAAC,OAAO,EAAE,kCAAkC,CAAC,CAAC,EAC3E,CAAC;YACD,MAAM,IAAI,KAAK,CACb,0CAA0C,OAAO,CAAC,OAAO,GAAG,CAC7D,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QAED,MAAM,IAAA,kCAAsB,EAAC,IAAI,EAAE;YACjC,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB,CAAC,CAAC;QAEH,MAAM,IAAA,6CAAyB,EAAC,IAAI,CAAC,CAAC;QAEtC,MAAM,YAAY,GAAG,IAAA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 import React, {
|
|
|
8
8
|
useEffect,
|
|
9
9
|
useState,
|
|
10
10
|
} from 'react';
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
// Consider specifying types if desired
|
|
13
|
+
export type IRuntimeConfig = any;
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Context for storing the runtimeConfig.
|
|
@@ -69,14 +71,13 @@ export * from './runtime-config.js';
|
|
|
69
71
|
`;
|
|
70
72
|
|
|
71
73
|
exports[`runtime-config generator > should generate shared constructs > runtime-config.ts 1`] = `
|
|
72
|
-
"import
|
|
73
|
-
import { Stack } from 'aws-cdk-lib';
|
|
74
|
+
"import { Stack } from 'aws-cdk-lib';
|
|
74
75
|
import { Construct } from 'constructs';
|
|
75
76
|
|
|
76
77
|
const RuntimeConfigKey = '__RuntimeConfig__';
|
|
77
78
|
|
|
78
79
|
export class RuntimeConfig extends Construct {
|
|
79
|
-
private readonly _runtimeConfig:
|
|
80
|
+
private readonly _runtimeConfig: any = {};
|
|
80
81
|
|
|
81
82
|
static ensure(scope: Construct): RuntimeConfig {
|
|
82
83
|
const stack = Stack.of(scope);
|
|
@@ -96,7 +97,7 @@ export class RuntimeConfig extends Construct {
|
|
|
96
97
|
super(scope, id);
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
get config():
|
|
100
|
+
get config(): any {
|
|
100
101
|
return this._runtimeConfig;
|
|
101
102
|
}
|
|
102
103
|
}
|
package/src/ts/react-website/runtime-config/files/app/components/RuntimeConfig/index.tsx.template
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Spinner } from '@cloudscape-design/components';
|
|
2
2
|
import React, { createContext, PropsWithChildren, useEffect, useState } from 'react';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
// Consider specifying types if desired
|
|
5
|
+
export type IRuntimeConfig = any;
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* Context for storing the runtimeConfig.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
|
-
import { RuntimeConfigContext } from '../components/RuntimeConfig';
|
|
3
|
-
import { IRuntimeConfig } from '<%= scopeAlias %>common-types';
|
|
2
|
+
import { RuntimeConfigContext, IRuntimeConfig } from '../components/RuntimeConfig';
|
|
4
3
|
|
|
5
4
|
export const useRuntimeConfig = (): IRuntimeConfig => {
|
|
6
5
|
const runtimeConfig = useContext(RuntimeConfigContext);
|
|
@@ -38,14 +38,13 @@ export * from './runtime-config.js';
|
|
|
38
38
|
`;
|
|
39
39
|
|
|
40
40
|
exports[`shared-constructs utils > sharedConstructsGenerator > should generate shared constructs when they do not exist > packages/common/constructs/src/core/runtime-config.ts 1`] = `
|
|
41
|
-
"import
|
|
42
|
-
import { Stack } from 'aws-cdk-lib';
|
|
41
|
+
"import { Stack } from 'aws-cdk-lib';
|
|
43
42
|
import { Construct } from 'constructs';
|
|
44
43
|
|
|
45
44
|
const RuntimeConfigKey = '__RuntimeConfig__';
|
|
46
45
|
|
|
47
46
|
export class RuntimeConfig extends Construct {
|
|
48
|
-
private readonly _runtimeConfig:
|
|
47
|
+
private readonly _runtimeConfig: any = {};
|
|
49
48
|
|
|
50
49
|
static ensure(scope: Construct): RuntimeConfig {
|
|
51
50
|
const stack = Stack.of(scope);
|
|
@@ -65,7 +64,7 @@ export class RuntimeConfig extends Construct {
|
|
|
65
64
|
super(scope, id);
|
|
66
65
|
}
|
|
67
66
|
|
|
68
|
-
get config():
|
|
67
|
+
get config(): any {
|
|
69
68
|
return this._runtimeConfig;
|
|
70
69
|
}
|
|
71
70
|
}
|
|
@@ -77,14 +76,3 @@ exports[`shared-constructs utils > sharedConstructsGenerator > should generate s
|
|
|
77
76
|
export * from './core/index.js';
|
|
78
77
|
"
|
|
79
78
|
`;
|
|
80
|
-
|
|
81
|
-
exports[`shared-constructs utils > sharedConstructsGenerator > should generate type definitions when they do not exist > packages/common/types/src/index.ts 1`] = `
|
|
82
|
-
"export * from './runtime-config.js';
|
|
83
|
-
"
|
|
84
|
-
`;
|
|
85
|
-
|
|
86
|
-
exports[`shared-constructs utils > sharedConstructsGenerator > should generate type definitions when they do not exist > packages/common/types/src/runtime-config.ts 1`] = `
|
|
87
|
-
"// eslint-disable-next-line @typescript-eslint/no-empty-object-type, @typescript-eslint/no-empty-interface
|
|
88
|
-
export interface IRuntimeConfig {}
|
|
89
|
-
"
|
|
90
|
-
`;
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { Tree } from '@nx/devkit';
|
|
6
|
+
export interface AddAgentCoreConstructProps {
|
|
7
|
+
nameClassName: string;
|
|
8
|
+
nameKebabCase: string;
|
|
9
|
+
dockerImageTag: string;
|
|
10
|
+
appDirectory: string;
|
|
11
|
+
serverProtocol: 'MCP' | 'HTTP';
|
|
12
|
+
}
|
|
6
13
|
export interface AddMcpServerConstructProps {
|
|
7
14
|
mcpServerNameClassName: string;
|
|
8
15
|
mcpServerNameKebabCase: string;
|
|
@@ -12,3 +19,12 @@ export interface AddMcpServerConstructProps {
|
|
|
12
19
|
* Add an MCP server CDK construct
|
|
13
20
|
*/
|
|
14
21
|
export declare const addMcpServerConstruct: (tree: Tree, options: AddMcpServerConstructProps) => void;
|
|
22
|
+
export interface AddAgentConstructProps {
|
|
23
|
+
agentNameClassName: string;
|
|
24
|
+
agentNameKebabCase: string;
|
|
25
|
+
dockerImageTag: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Add an MCP server CDK construct
|
|
29
|
+
*/
|
|
30
|
+
export declare const addAgentConstruct: (tree: Tree, options: AddAgentConstructProps) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addMcpServerConstruct = void 0;
|
|
3
|
+
exports.addAgentConstruct = exports.addMcpServerConstruct = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
6
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -8,21 +8,46 @@ exports.addMcpServerConstruct = void 0;
|
|
|
8
8
|
const devkit_1 = require("@nx/devkit");
|
|
9
9
|
const shared_constructs_constants_1 = require("../shared-constructs-constants");
|
|
10
10
|
const ast_1 = require("../ast");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const versions_1 = require("../versions");
|
|
12
|
+
const addAgentCoreConstruct = (tree, options) => {
|
|
13
|
+
// Construct uses bedrock agentcore types
|
|
14
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, (0, versions_1.withVersions)(['@aws-sdk/client-bedrock-agentcore-control']));
|
|
15
15
|
// Add the AgentCore runtime construct
|
|
16
16
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files', 'core', 'agent-core'), (0, devkit_1.joinPathFragments)(shared_constructs_constants_1.PACKAGES_DIR, shared_constructs_constants_1.SHARED_CONSTRUCTS_DIR, 'src', 'core', 'agent-core'), {}, {
|
|
17
17
|
overwriteStrategy: devkit_1.OverwriteStrategy.KeepExisting,
|
|
18
18
|
});
|
|
19
19
|
// Generate app specific CDK construct
|
|
20
|
-
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files', 'app', '
|
|
20
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files', 'app', 'agent-core'), (0, devkit_1.joinPathFragments)(shared_constructs_constants_1.PACKAGES_DIR, shared_constructs_constants_1.SHARED_CONSTRUCTS_DIR, 'src', 'app', options.appDirectory), options, {
|
|
21
21
|
overwriteStrategy: devkit_1.OverwriteStrategy.KeepExisting,
|
|
22
22
|
});
|
|
23
23
|
// Export app specific CDK construct
|
|
24
|
-
(0, ast_1.addStarExport)(tree, (0, devkit_1.joinPathFragments)(shared_constructs_constants_1.PACKAGES_DIR, shared_constructs_constants_1.SHARED_CONSTRUCTS_DIR, 'src', 'app',
|
|
25
|
-
(0, ast_1.addStarExport)(tree, (0, devkit_1.joinPathFragments)(shared_constructs_constants_1.PACKAGES_DIR, shared_constructs_constants_1.SHARED_CONSTRUCTS_DIR, 'src', 'app', 'index.ts'),
|
|
24
|
+
(0, ast_1.addStarExport)(tree, (0, devkit_1.joinPathFragments)(shared_constructs_constants_1.PACKAGES_DIR, shared_constructs_constants_1.SHARED_CONSTRUCTS_DIR, 'src', 'app', options.appDirectory, 'index.ts'), `./${options.nameKebabCase}/${options.nameKebabCase}.js`);
|
|
25
|
+
(0, ast_1.addStarExport)(tree, (0, devkit_1.joinPathFragments)(shared_constructs_constants_1.PACKAGES_DIR, shared_constructs_constants_1.SHARED_CONSTRUCTS_DIR, 'src', 'app', 'index.ts'), `./${options.appDirectory}/index.js`);
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Add an MCP server CDK construct
|
|
29
|
+
*/
|
|
30
|
+
const addMcpServerConstruct = (tree, options) => {
|
|
31
|
+
addAgentCoreConstruct(tree, {
|
|
32
|
+
nameClassName: options.mcpServerNameClassName,
|
|
33
|
+
nameKebabCase: options.mcpServerNameKebabCase,
|
|
34
|
+
dockerImageTag: options.dockerImageTag,
|
|
35
|
+
appDirectory: 'mcp-servers',
|
|
36
|
+
serverProtocol: 'MCP',
|
|
37
|
+
});
|
|
26
38
|
};
|
|
27
39
|
exports.addMcpServerConstruct = addMcpServerConstruct;
|
|
40
|
+
/**
|
|
41
|
+
* Add an MCP server CDK construct
|
|
42
|
+
*/
|
|
43
|
+
const addAgentConstruct = (tree, options) => {
|
|
44
|
+
addAgentCoreConstruct(tree, {
|
|
45
|
+
nameClassName: options.agentNameClassName,
|
|
46
|
+
nameKebabCase: options.agentNameKebabCase,
|
|
47
|
+
dockerImageTag: options.dockerImageTag,
|
|
48
|
+
appDirectory: 'agents',
|
|
49
|
+
serverProtocol: 'HTTP',
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
exports.addAgentConstruct = addAgentConstruct;
|
|
28
53
|
//# sourceMappingURL=agent-core-constructs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-core-constructs.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/utils/agent-core-constructs/agent-core-constructs.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,
|
|
1
|
+
{"version":3,"file":"agent-core-constructs.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/utils/agent-core-constructs/agent-core-constructs.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCAMoB;AACpB,gFAGwC;AACxC,gCAAuC;AACvC,0CAA2C;AAU3C,MAAM,qBAAqB,GAAG,CAC5B,IAAU,EACV,OAAmC,EACnC,EAAE;IACF,yCAAyC;IACzC,IAAA,qCAA4B,EAC1B,IAAI,EACJ,EAAE,EACF,IAAA,uBAAY,EAAC,CAAC,2CAA2C,CAAC,CAAC,CAC5D,CAAC;IAEF,sCAAsC;IACtC,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAC3D,IAAA,0BAAiB,EACf,0CAAY,EACZ,mDAAqB,EACrB,KAAK,EACL,MAAM,EACN,YAAY,CACb,EACD,EAAE,EACF;QACE,iBAAiB,EAAE,0BAAiB,CAAC,YAAY;KAClD,CACF,CAAC;IAEF,sCAAsC;IACtC,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,CAAC,EAC1D,IAAA,0BAAiB,EACf,0CAAY,EACZ,mDAAqB,EACrB,KAAK,EACL,KAAK,EACL,OAAO,CAAC,YAAY,CACrB,EACD,OAAO,EACP;QACE,iBAAiB,EAAE,0BAAiB,CAAC,YAAY;KAClD,CACF,CAAC;IAEF,oCAAoC;IACpC,IAAA,mBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EACf,0CAAY,EACZ,mDAAqB,EACrB,KAAK,EACL,KAAK,EACL,OAAO,CAAC,YAAY,EACpB,UAAU,CACX,EACD,KAAK,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,aAAa,KAAK,CACzD,CAAC;IACF,IAAA,mBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EACf,0CAAY,EACZ,mDAAqB,EACrB,KAAK,EACL,KAAK,EACL,UAAU,CACX,EACD,KAAK,OAAO,CAAC,YAAY,WAAW,CACrC,CAAC;AACJ,CAAC,CAAC;AAQF;;GAEG;AACI,MAAM,qBAAqB,GAAG,CACnC,IAAU,EACV,OAAmC,EACnC,EAAE;IACF,qBAAqB,CAAC,IAAI,EAAE;QAC1B,aAAa,EAAE,OAAO,CAAC,sBAAsB;QAC7C,aAAa,EAAE,OAAO,CAAC,sBAAsB;QAC7C,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,YAAY,EAAE,aAAa;QAC3B,cAAc,EAAE,KAAK;KACtB,CAAC,CAAC;AACL,CAAC,CAAC;AAXW,QAAA,qBAAqB,yBAWhC;AAQF;;GAEG;AACI,MAAM,iBAAiB,GAAG,CAC/B,IAAU,EACV,OAA+B,EAC/B,EAAE;IACF,qBAAqB,CAAC,IAAI,EAAE;QAC1B,aAAa,EAAE,OAAO,CAAC,kBAAkB;QACzC,aAAa,EAAE,OAAO,CAAC,kBAAkB;QACzC,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,YAAY,EAAE,QAAQ;QACtB,cAAc,EAAE,MAAM;KACvB,CAAC,CAAC;AACL,CAAC,CAAC;AAXW,QAAA,iBAAiB,qBAW5B"}
|
|
@@ -8,16 +8,16 @@ import {
|
|
|
8
8
|
AgentCoreRuntimeProps,
|
|
9
9
|
} from '../../../core/agent-core/runtime.js';
|
|
10
10
|
|
|
11
|
-
export type <%-
|
|
11
|
+
export type <%- nameClassName %>Props = Omit<
|
|
12
12
|
AgentCoreRuntimeProps,
|
|
13
13
|
'runtimeName' | 'serverProtocol' | 'containerUri'
|
|
14
14
|
>;
|
|
15
15
|
|
|
16
|
-
export class <%-
|
|
16
|
+
export class <%- nameClassName %> extends Construct {
|
|
17
17
|
public readonly dockerImage: DockerImageAsset;
|
|
18
18
|
public readonly agentCoreRuntime: AgentCoreRuntime;
|
|
19
19
|
|
|
20
|
-
constructor(scope: Construct, id: string, props?: <%-
|
|
20
|
+
constructor(scope: Construct, id: string, props?: <%- nameClassName %>Props) {
|
|
21
21
|
super(scope, id);
|
|
22
22
|
|
|
23
23
|
this.dockerImage = new DockerImageAsset(this, 'DockerImage', {
|
|
@@ -30,8 +30,8 @@ export class <%- mcpServerNameClassName %> extends Construct {
|
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
this.agentCoreRuntime = new AgentCoreRuntime(this, 'AgentCore', {
|
|
33
|
-
runtimeName: '<%-
|
|
34
|
-
serverProtocol: '
|
|
33
|
+
runtimeName: '<%- nameClassName %>',
|
|
34
|
+
serverProtocol: '<%- serverProtocol %>',
|
|
35
35
|
containerUri: this.dockerImage.imageUri,
|
|
36
36
|
...props,
|
|
37
37
|
});
|
|
@@ -4,6 +4,9 @@ import {
|
|
|
4
4
|
PolicyStatement,
|
|
5
5
|
Effect,
|
|
6
6
|
PolicyDocument,
|
|
7
|
+
IGrantable,
|
|
8
|
+
Grant,
|
|
9
|
+
IPrincipal,
|
|
7
10
|
} from 'aws-cdk-lib/aws-iam';
|
|
8
11
|
import {
|
|
9
12
|
AwsCustomResource,
|
|
@@ -30,10 +33,12 @@ export interface AgentCoreRuntimeProps {
|
|
|
30
33
|
/**
|
|
31
34
|
* A construct for creating a Bedrock AgentCore Runtime
|
|
32
35
|
*/
|
|
33
|
-
export class AgentCoreRuntime extends Construct {
|
|
36
|
+
export class AgentCoreRuntime extends Construct implements IGrantable {
|
|
34
37
|
public readonly role: Role;
|
|
35
38
|
public readonly arn: string;
|
|
36
39
|
|
|
40
|
+
public readonly grantPrincipal: IPrincipal;
|
|
41
|
+
|
|
37
42
|
constructor(scope: Construct, id: string, props: AgentCoreRuntimeProps) {
|
|
38
43
|
super(scope, id);
|
|
39
44
|
|
|
@@ -125,6 +130,7 @@ export class AgentCoreRuntime extends Construct {
|
|
|
125
130
|
}),
|
|
126
131
|
},
|
|
127
132
|
});
|
|
133
|
+
this.grantPrincipal = this.role.grantPrincipal;
|
|
128
134
|
|
|
129
135
|
const agentRuntime = new AwsCustomResource(this, 'MCPSeverRuntime', {
|
|
130
136
|
onCreate: {
|
|
@@ -137,6 +143,8 @@ export class AgentCoreRuntime extends Construct {
|
|
|
137
143
|
containerUri: props.containerUri,
|
|
138
144
|
},
|
|
139
145
|
},
|
|
146
|
+
description: props.description,
|
|
147
|
+
environmentVariables: props.environment,
|
|
140
148
|
networkConfiguration: {
|
|
141
149
|
networkMode: 'PUBLIC',
|
|
142
150
|
},
|
|
@@ -159,6 +167,8 @@ export class AgentCoreRuntime extends Construct {
|
|
|
159
167
|
containerUri: props.containerUri,
|
|
160
168
|
},
|
|
161
169
|
},
|
|
170
|
+
description: props.description,
|
|
171
|
+
environmentVariables: props.environment,
|
|
162
172
|
networkConfiguration: {
|
|
163
173
|
networkMode: 'PUBLIC',
|
|
164
174
|
},
|
|
@@ -192,4 +202,15 @@ export class AgentCoreRuntime extends Construct {
|
|
|
192
202
|
|
|
193
203
|
this.arn = agentRuntime.getResponseField('agentRuntimeArn');
|
|
194
204
|
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Grant permissions to invoke the agent runtime (if using IAM auth - not required for JWT auth)
|
|
208
|
+
*/
|
|
209
|
+
public grantInvoke = (grantee: IGrantable) => {
|
|
210
|
+
Grant.addToPrincipal({
|
|
211
|
+
grantee,
|
|
212
|
+
actions: ['bedrock-agentcore:InvokeAgentRuntime'],
|
|
213
|
+
resourceArns: [this.arn, `${this.arn}/*`],
|
|
214
|
+
});
|
|
215
|
+
};
|
|
195
216
|
}
|
|
@@ -6,7 +6,6 @@ exports.addApiGatewayConstruct = void 0;
|
|
|
6
6
|
* SPDX-License-Identifier: Apache-2.0
|
|
7
7
|
*/
|
|
8
8
|
const devkit_1 = require("@nx/devkit");
|
|
9
|
-
const typescript_1 = require("typescript");
|
|
10
9
|
const shared_constructs_constants_1 = require("../shared-constructs-constants");
|
|
11
10
|
const ast_1 = require("../ast");
|
|
12
11
|
/**
|
|
@@ -31,35 +30,6 @@ const addApiGatewayConstruct = (tree, options) => {
|
|
|
31
30
|
// Export app specific CDK construct
|
|
32
31
|
(0, ast_1.addStarExport)(tree, (0, devkit_1.joinPathFragments)(shared_constructs_constants_1.PACKAGES_DIR, shared_constructs_constants_1.SHARED_CONSTRUCTS_DIR, 'src', 'app', 'apis', 'index.ts'), `./${options.apiNameKebabCase}.js`);
|
|
33
32
|
(0, ast_1.addStarExport)(tree, (0, devkit_1.joinPathFragments)(shared_constructs_constants_1.PACKAGES_DIR, shared_constructs_constants_1.SHARED_CONSTRUCTS_DIR, 'src', 'app', 'index.ts'), './apis/index.js');
|
|
34
|
-
// Update runtime-config.ts with ApiUrl type and 'apis' property
|
|
35
|
-
const runtimeConfigPath = (0, devkit_1.joinPathFragments)(shared_constructs_constants_1.PACKAGES_DIR, shared_constructs_constants_1.TYPE_DEFINITIONS_DIR, 'src', 'runtime-config.ts');
|
|
36
|
-
// Check if ApiUrl type exists
|
|
37
|
-
const existingApiUrl = (0, ast_1.query)(tree, runtimeConfigPath, 'TypeAliasDeclaration[name.text="ApiUrl"]');
|
|
38
|
-
// Check if apis property exists in IRuntimeConfig
|
|
39
|
-
const existingApis = (0, ast_1.query)(tree, runtimeConfigPath, 'InterfaceDeclaration[name.text="IRuntimeConfig"] PropertySignature[name.text="apis"]');
|
|
40
|
-
// Add ApiUrl type if it doesn't exist
|
|
41
|
-
if (existingApiUrl.length === 0) {
|
|
42
|
-
const apiUrlType = typescript_1.factory.createTypeAliasDeclaration([typescript_1.factory.createModifier(typescript_1.SyntaxKind.ExportKeyword)], typescript_1.factory.createIdentifier('ApiUrl'), undefined, typescript_1.factory.createKeywordTypeNode(typescript_1.SyntaxKind.StringKeyword));
|
|
43
|
-
(0, ast_1.prependStatements)(tree, runtimeConfigPath, [apiUrlType]);
|
|
44
|
-
}
|
|
45
|
-
// Add empty apis to IRuntimeConfig if it doesn't exist
|
|
46
|
-
if (existingApis.length === 0) {
|
|
47
|
-
(0, ast_1.replace)(tree, runtimeConfigPath, 'InterfaceDeclaration[name.text="IRuntimeConfig"]', (node) => {
|
|
48
|
-
const apisProperty = typescript_1.factory.createPropertySignature(undefined, typescript_1.factory.createIdentifier('apis'), undefined, typescript_1.factory.createTypeLiteralNode([]));
|
|
49
|
-
return typescript_1.factory.updateInterfaceDeclaration(node, node.modifiers, node.name, node.typeParameters, node.heritageClauses, [...node.members, apisProperty]);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
// Check if apiNameClassName property exists in apis
|
|
53
|
-
const existingApiNameProperty = (0, ast_1.query)(tree, runtimeConfigPath, `InterfaceDeclaration[name.text="IRuntimeConfig"] PropertySignature[name.text="apis"] TypeLiteral PropertySignature[name.text="${options.apiNameClassName}"]`);
|
|
54
|
-
// Add apiNameClassName property to apis if it doesn't exist
|
|
55
|
-
if (existingApiNameProperty.length === 0) {
|
|
56
|
-
(0, ast_1.replace)(tree, runtimeConfigPath, 'InterfaceDeclaration[name.text="IRuntimeConfig"] PropertySignature[name.text="apis"] TypeLiteral', (node) => {
|
|
57
|
-
return typescript_1.factory.createTypeLiteralNode([
|
|
58
|
-
...node.members,
|
|
59
|
-
typescript_1.factory.createPropertySignature(undefined, typescript_1.factory.createIdentifier(options.apiNameClassName), undefined, typescript_1.factory.createTypeReferenceNode('ApiUrl', undefined)),
|
|
60
|
-
]);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
33
|
};
|
|
64
34
|
exports.addApiGatewayConstruct = addApiGatewayConstruct;
|
|
65
35
|
//# sourceMappingURL=api-constructs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-constructs.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/utils/api-constructs/api-constructs.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCAKoB;AACpB,
|
|
1
|
+
{"version":3,"file":"api-constructs.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/utils/api-constructs/api-constructs.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCAKoB;AACpB,gFAGwC;AACxC,gCAAuC;AA0BvC;;GAEG;AACI,MAAM,sBAAsB,GAAG,CACpC,IAAU,EACV,OAAsC,EACtC,EAAE;IACF,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAE,EAAE;QAC3C,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,EAC1D,IAAA,0BAAiB,EACf,0CAAY,EACZ,mDAAqB,EACrB,KAAK,EACL,MAAM,EACN,KAAK,CACN,EACD,EAAE,EACF;YACE,iBAAiB,EAAE,0BAAiB,CAAC,YAAY;SAClD,CACF,CAAC;IACJ,CAAC,CAAC;IAEF,qDAAqD;IACrD,mBAAmB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAC3C,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC7B,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QACpC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IAED,sCAAsC;IACtC,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,EAC3E,IAAA,0BAAiB,EACf,0CAAY,EACZ,mDAAqB,EACrB,KAAK,EACL,KAAK,EACL,MAAM,CACP,EACD,OAAO,EACP;QACE,iBAAiB,EAAE,0BAAiB,CAAC,YAAY;KAClD,CACF,CAAC;IAEF,oCAAoC;IACpC,IAAA,mBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EACf,0CAAY,EACZ,mDAAqB,EACrB,KAAK,EACL,KAAK,EACL,MAAM,EACN,UAAU,CACX,EACD,KAAK,OAAO,CAAC,gBAAgB,KAAK,CACnC,CAAC;IACF,IAAA,mBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EACf,0CAAY,EACZ,mDAAqB,EACrB,KAAK,EACL,KAAK,EACL,UAAU,CACX,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC,CAAC;AAtEW,QAAA,sBAAsB,0BAsEjC"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import type { IRuntimeConfig } from '<%= scopeAlias %>common-types';
|
|
2
1
|
import { Stack } from 'aws-cdk-lib';
|
|
3
2
|
import { Construct } from 'constructs';
|
|
4
3
|
|
|
5
4
|
const RuntimeConfigKey = '__RuntimeConfig__';
|
|
6
5
|
|
|
7
6
|
export class RuntimeConfig extends Construct {
|
|
8
|
-
private readonly _runtimeConfig:
|
|
9
|
-
|
|
7
|
+
private readonly _runtimeConfig: any = {};
|
|
8
|
+
|
|
10
9
|
static ensure(scope: Construct): RuntimeConfig {
|
|
11
10
|
const stack = Stack.of(scope);
|
|
12
11
|
return (
|
|
@@ -25,7 +24,7 @@ export class RuntimeConfig extends Construct {
|
|
|
25
24
|
super(scope, id);
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
get config():
|
|
27
|
+
get config(): any {
|
|
29
28
|
return this._runtimeConfig;
|
|
30
29
|
}
|
|
31
30
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# CloudFormation stack for metrics tracking
|
|
2
|
+
resource "aws_cloudformation_stack" "metrics" {
|
|
3
|
+
name = "nx-plugin-metrics"
|
|
4
|
+
|
|
5
|
+
template_body = jsonencode({
|
|
6
|
+
AWSTemplateFormatVersion = "2010-09-09"
|
|
7
|
+
Description = "<%= metricId %> (version:<%= version %>) (tag:<%= tags %>)"
|
|
8
|
+
Resources = {
|
|
9
|
+
# Empty stack - used only for metrics tracking via description
|
|
10
|
+
MetricsPlaceholder = {
|
|
11
|
+
Type = "AWS::CloudFormation::WaitConditionHandle"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
tags = {
|
|
17
|
+
Purpose = "nx-plugin-metrics"
|
|
18
|
+
}
|
|
19
|
+
}
|
package/src/utils/metrics.d.ts
CHANGED
|
@@ -6,8 +6,10 @@ import { Tree } from '@nx/devkit';
|
|
|
6
6
|
import { NxGeneratorInfo } from './nx';
|
|
7
7
|
export declare const METRIC_ID = "uksb-4wk0bqpg5s";
|
|
8
8
|
export declare const METRICS_ASPECT_FILE_PATH: string;
|
|
9
|
+
export declare const TERRAFORM_METRICS_FILE_PATH: string;
|
|
9
10
|
export declare const metricsAspectVariableQuery: (variableName: string, valueQuery: string) => string;
|
|
10
11
|
/**
|
|
11
|
-
* Instruments metrics by updating the MetricsAspect in common/constructs/src/core/app.ts if the file exists
|
|
12
|
+
* Instruments metrics by updating the MetricsAspect in common/constructs/src/core/app.ts if the file exists,
|
|
13
|
+
* or updating the Terraform metrics CloudFormation stack if it exists
|
|
12
14
|
*/
|
|
13
15
|
export declare const addGeneratorMetricsIfApplicable: (tree: Tree, generatorInfo: NxGeneratorInfo[]) => Promise<void>;
|
package/src/utils/metrics.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addGeneratorMetricsIfApplicable = exports.metricsAspectVariableQuery = exports.METRICS_ASPECT_FILE_PATH = exports.METRIC_ID = void 0;
|
|
3
|
+
exports.addGeneratorMetricsIfApplicable = exports.metricsAspectVariableQuery = exports.TERRAFORM_METRICS_FILE_PATH = exports.METRICS_ASPECT_FILE_PATH = exports.METRIC_ID = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
/**
|
|
6
6
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
@@ -14,15 +14,19 @@ const nx_1 = require("./nx");
|
|
|
14
14
|
const shared_constructs_constants_1 = require("./shared-constructs-constants");
|
|
15
15
|
// Used to identify @aws/nx-plugin in AWS metrics
|
|
16
16
|
exports.METRIC_ID = 'uksb-4wk0bqpg5s';
|
|
17
|
-
// File in which the MetricsAspect may exist
|
|
17
|
+
// File in which the MetricsAspect may exist (CDK)
|
|
18
18
|
exports.METRICS_ASPECT_FILE_PATH = (0, devkit_1.joinPathFragments)(shared_constructs_constants_1.PACKAGES_DIR, shared_constructs_constants_1.SHARED_CONSTRUCTS_DIR, 'src', 'core', 'app.ts');
|
|
19
|
+
// File in which the Terraform metrics CloudFormation stack may exist
|
|
20
|
+
exports.TERRAFORM_METRICS_FILE_PATH = (0, devkit_1.joinPathFragments)(shared_constructs_constants_1.PACKAGES_DIR, 'common', 'terraform', 'src', 'metrics', 'metrics.tf');
|
|
19
21
|
// Query to find a particular metrics aspect variable
|
|
20
22
|
const metricsAspectVariableQuery = (variableName, valueQuery) => `ClassDeclaration[name.name="MetricsAspect"] MethodDeclaration[name.name="visit"] VariableDeclaration:has(Identifier[name="${variableName}"]) ${valueQuery}`;
|
|
21
23
|
exports.metricsAspectVariableQuery = metricsAspectVariableQuery;
|
|
22
24
|
/**
|
|
23
|
-
* Instruments metrics by updating the MetricsAspect in common/constructs/src/core/app.ts if the file exists
|
|
25
|
+
* Instruments metrics by updating the MetricsAspect in common/constructs/src/core/app.ts if the file exists,
|
|
26
|
+
* or updating the Terraform metrics CloudFormation stack if it exists
|
|
24
27
|
*/
|
|
25
28
|
const addGeneratorMetricsIfApplicable = (tree, generatorInfo) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
+
// Handle CDK metrics
|
|
26
30
|
if (tree.exists(exports.METRICS_ASPECT_FILE_PATH)) {
|
|
27
31
|
// Update the id
|
|
28
32
|
(0, ast_1.replaceIfExists)(tree, exports.METRICS_ASPECT_FILE_PATH, (0, exports.metricsAspectVariableQuery)('id', 'StringLiteral'), () => {
|
|
@@ -44,6 +48,35 @@ const addGeneratorMetricsIfApplicable = (tree, generatorInfo) => tslib_1.__await
|
|
|
44
48
|
});
|
|
45
49
|
yield (0, format_1.formatFilesInSubtree)(tree, exports.METRICS_ASPECT_FILE_PATH);
|
|
46
50
|
}
|
|
51
|
+
// Handle Terraform metrics
|
|
52
|
+
if (tree.exists(exports.TERRAFORM_METRICS_FILE_PATH)) {
|
|
53
|
+
yield updateTerraformMetrics(tree, generatorInfo);
|
|
54
|
+
}
|
|
47
55
|
});
|
|
48
56
|
exports.addGeneratorMetricsIfApplicable = addGeneratorMetricsIfApplicable;
|
|
57
|
+
/**
|
|
58
|
+
* Updates the Terraform metrics CloudFormation stack with generator information
|
|
59
|
+
*/
|
|
60
|
+
const updateTerraformMetrics = (tree, generatorInfo) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
61
|
+
const content = tree.read(exports.TERRAFORM_METRICS_FILE_PATH, 'utf-8') || '';
|
|
62
|
+
// Extract existing tags from the Description field in the CloudFormation template
|
|
63
|
+
const descriptionMatch = content.match(/Description\s*=\s*"([^"]*)"/);
|
|
64
|
+
const existingDescription = descriptionMatch ? descriptionMatch[1] : '';
|
|
65
|
+
// Parse existing metrics from description
|
|
66
|
+
const existingMetrics = new Set();
|
|
67
|
+
const tagMatch = existingDescription.match(/\(tag:([^)]*)\)/);
|
|
68
|
+
if (tagMatch && tagMatch[1]) {
|
|
69
|
+
tagMatch[1].split(',').forEach((tag) => existingMetrics.add(tag.trim()));
|
|
70
|
+
}
|
|
71
|
+
// Add new metrics
|
|
72
|
+
const newTags = generatorInfo
|
|
73
|
+
.filter((info) => !existingMetrics.has(info.metric))
|
|
74
|
+
.map((info) => info.metric);
|
|
75
|
+
const allTags = [...existingMetrics, ...newTags];
|
|
76
|
+
// Build new description
|
|
77
|
+
const newDescription = `(${exports.METRIC_ID}) (version:${(0, nx_1.getPackageVersion)()}) (tag:${allTags.join(',')})`;
|
|
78
|
+
// Update the Description in the CloudFormation template within the Terraform file
|
|
79
|
+
const updatedContent = content.replace(/Description\s*=\s*"[^"]*"/, `Description = "${newDescription}"`);
|
|
80
|
+
tree.write(exports.TERRAFORM_METRICS_FILE_PATH, updatedContent);
|
|
81
|
+
});
|
|
49
82
|
//# sourceMappingURL=metrics.js.map
|
package/src/utils/metrics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../../../packages/nx-plugin/src/utils/metrics.ts"],"names":[],"mappings":";;;;AAAA;;;GAGG;AACH,uCAAqD;AACrD,2CAA4E;AAC5E,+BAAwC;AACxC,qCAAgD;AAChD,6BAA0D;AAC1D,+EAGuC;AAEvC,iDAAiD;AACpC,QAAA,SAAS,GAAG,iBAAiB,CAAC;AAE3C,
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../../../packages/nx-plugin/src/utils/metrics.ts"],"names":[],"mappings":";;;;AAAA;;;GAGG;AACH,uCAAqD;AACrD,2CAA4E;AAC5E,+BAAwC;AACxC,qCAAgD;AAChD,6BAA0D;AAC1D,+EAGuC;AAEvC,iDAAiD;AACpC,QAAA,SAAS,GAAG,iBAAiB,CAAC;AAE3C,kDAAkD;AACrC,QAAA,wBAAwB,GAAG,IAAA,0BAAiB,EACvD,0CAAY,EACZ,mDAAqB,EACrB,KAAK,EACL,MAAM,EACN,QAAQ,CACT,CAAC;AAEF,qEAAqE;AACxD,QAAA,2BAA2B,GAAG,IAAA,0BAAiB,EAC1D,0CAAY,EACZ,QAAQ,EACR,WAAW,EACX,KAAK,EACL,SAAS,EACT,YAAY,CACb,CAAC;AAEF,qDAAqD;AAC9C,MAAM,0BAA0B,GAAG,CACxC,YAAoB,EACpB,UAAkB,EAClB,EAAE,CACF,6HAA6H,YAAY,OAAO,UAAU,EAAE,CAAC;AAJlJ,QAAA,0BAA0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,CAAC,MAAM,CAAC,CAAC;SACnD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAE9B,MAAM,OAAO,GAAG,CAAC,GAAG,eAAe,EAAE,GAAG,OAAO,CAAC,CAAC;IAEjD,wBAAwB;IACxB,MAAM,cAAc,GAAG,IAAI,iBAAS,cAAc,IAAA,sBAAiB,GAAE,UAAU,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAEpG,kFAAkF;IAClF,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CACpC,2BAA2B,EAC3B,kBAAkB,cAAc,GAAG,CACpC,CAAC;IAEF,IAAI,CAAC,KAAK,CAAC,mCAA2B,EAAE,cAAc,CAAC,CAAC;AAC1D,CAAC,CAAA,CAAC"}
|
package/src/utils/port.d.ts
CHANGED
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import { Tree } from '@nx/devkit';
|
|
6
|
-
import { NxGeneratorInfo } from './nx';
|
|
5
|
+
import { ProjectConfiguration, Tree } from '@nx/devkit';
|
|
7
6
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* Assumes startPort is sufficiently spaced from other generators!
|
|
7
|
+
* Assign a port for a particular target within a project.
|
|
8
|
+
* Mutates the project to add/update its metadata.ports with the newly assigned port
|
|
11
9
|
*/
|
|
12
|
-
export declare const
|
|
10
|
+
export declare const assignPort: (tree: Tree, project: ProjectConfiguration, startPort: number) => number;
|