@aws/nx-plugin 1.0.0-rc.0 → 1.0.0-rc.2
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/generators.json +10 -5
- package/package.json +1 -1
- package/src/connection/generator.js +2 -2
- package/src/connection/generator.js.map +1 -1
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +11 -11
- package/src/infra/app/files/app/src/main.ts.template +2 -2
- package/src/infra/app/generator.js +9 -9
- package/src/infra/app/generator.js.map +1 -1
- package/src/infra/app/schema.d.ts +1 -1
- package/src/infra/app/schema.json +1 -1
- package/src/mcp-server/guide-pipeline.js +8 -10
- package/src/mcp-server/guide-pipeline.js.map +1 -1
- package/src/mcp-server/tools/create-workspace-command.js +1 -1
- package/src/mcp-server/tools/create-workspace-command.js.map +1 -1
- package/src/mcp-server/tools/generator-guide.js +2 -2
- package/src/mcp-server/tools/generator-guide.js.map +1 -1
- package/src/preset/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/preset/generator.d.ts +1 -1
- package/src/preset/generator.js +4 -6
- package/src/preset/generator.js.map +1 -1
- package/src/preset/schema.d.ts +5 -5
- package/src/preset/schema.json +4 -4
- package/src/py/agent/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/py/agent/a2a-connection/generator.js +4 -3
- package/src/py/agent/a2a-connection/generator.js.map +1 -1
- package/src/py/agent/files/deploy/Dockerfile.template +3 -3
- package/src/py/agent/generator.js +23 -23
- package/src/py/agent/generator.js.map +1 -1
- package/src/py/agent/mcp-connection/generator.js +1 -1
- package/src/py/agent/mcp-connection/generator.js.map +1 -1
- package/src/py/agent/react-connection/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/py/agent/react-connection/generator.js +4 -4
- package/src/py/agent/react-connection/generator.js.map +1 -1
- package/src/py/agent/schema.d.ts +8 -8
- package/src/py/agent/schema.json +18 -18
- package/src/py/api/generator.js +2 -2
- package/src/py/api/generator.js.map +1 -1
- package/src/py/api/schema.d.ts +4 -6
- package/src/py/api/schema.json +15 -15
- package/src/py/fast-api/__snapshots__/generator.spec.ts.snap +6 -6
- package/src/py/fast-api/generator.js +50 -38
- package/src/py/fast-api/generator.js.map +1 -1
- package/src/py/fast-api/react/generator.js +1 -1
- package/src/py/fast-api/react/generator.js.map +1 -1
- package/src/py/fast-api/schema.d.ts +4 -6
- package/src/py/fast-api/schema.json +15 -15
- package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/py/lambda-function/files/handler/__lambdaFunctionSnakeCase__.py.template +6 -6
- package/src/py/lambda-function/generator.js +23 -20
- package/src/py/lambda-function/generator.js.map +1 -1
- package/src/py/lambda-function/schema.d.ts +7 -4
- package/src/py/lambda-function/schema.json +15 -7
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/py/mcp-server/generator.js +11 -11
- package/src/py/mcp-server/generator.js.map +1 -1
- package/src/py/mcp-server/schema.d.ts +5 -9
- package/src/py/mcp-server/schema.json +15 -15
- package/src/py/project/generator.js +1 -1
- package/src/py/project/generator.js.map +1 -1
- package/src/py/project/schema.d.ts +1 -1
- package/src/py/project/schema.json +2 -2
- package/src/smithy/project/generator.js +2 -2
- package/src/smithy/project/generator.js.map +1 -1
- package/src/smithy/react-connection/generator.js +1 -1
- package/src/smithy/react-connection/generator.js.map +1 -1
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/smithy/ts/api/generator.js +72 -55
- package/src/smithy/ts/api/generator.js.map +1 -1
- package/src/smithy/ts/api/schema.d.ts +4 -6
- package/src/smithy/ts/api/schema.json +15 -15
- package/src/terraform/project/generator.js +1 -1
- package/src/terraform/project/generator.js.map +1 -1
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +6 -6
- package/src/trpc/backend/files/src/client/index.ts.template +5 -5
- package/src/trpc/backend/files/src/handler.ts.template +2 -2
- package/src/trpc/backend/generator.js +69 -51
- package/src/trpc/backend/generator.js.map +1 -1
- package/src/trpc/backend/schema.d.ts +4 -4
- package/src/trpc/backend/schema.json +15 -15
- package/src/trpc/react/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/trpc/react/files/src/components/__apiNameClassName__ClientProvider.tsx.template +14 -14
- package/src/trpc/react/generator.js +6 -5
- package/src/trpc/react/generator.js.map +1 -1
- package/src/ts/agent/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/agent/a2a-connection/generator.js +4 -3
- package/src/ts/agent/a2a-connection/generator.js.map +1 -1
- package/src/ts/agent/files/deploy/Dockerfile.template +1 -1
- package/src/ts/agent/generator.js +22 -22
- package/src/ts/agent/generator.js.map +1 -1
- package/src/ts/agent/mcp-connection/generator.js +1 -1
- package/src/ts/agent/mcp-connection/generator.js.map +1 -1
- package/src/ts/agent/react-connection/files/src/components/__agentNameClassName__AgentClientProvider.tsx.template +8 -8
- package/src/ts/agent/react-connection/generator.js +6 -6
- package/src/ts/agent/react-connection/generator.js.map +1 -1
- package/src/ts/agent/react-connection/serve-local.js +2 -2
- package/src/ts/agent/schema.d.ts +8 -8
- package/src/ts/agent/schema.json +18 -18
- package/src/ts/api/generator.js +6 -4
- package/src/ts/api/generator.js.map +1 -1
- package/src/ts/api/schema.d.ts +4 -4
- package/src/ts/api/schema.json +15 -15
- package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/lambda-function/files/handler/__lambdaFunctionKebabCase__.ts.template +10 -10
- package/src/ts/lambda-function/generator.js +33 -28
- package/src/ts/lambda-function/generator.js.map +1 -1
- package/src/ts/lambda-function/schema.d.ts +7 -4
- package/src/ts/lambda-function/schema.json +15 -7
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/mcp-server/generator.js +12 -12
- package/src/ts/mcp-server/generator.js.map +1 -1
- package/src/ts/mcp-server/schema.d.ts +5 -9
- package/src/ts/mcp-server/schema.json +15 -15
- package/src/ts/nx-generator/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/nx-generator/files/nx-plugin-for-aws/generator/generator.spec.ts.template +1 -1
- package/src/ts/nx-plugin/generator.js +2 -2
- package/src/ts/nx-plugin/generator.js.map +1 -1
- package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/rdb/files/prisma.config.ts.template +1 -1
- package/src/ts/rdb/files/scripts/docker-pull.ts.template +1 -1
- package/src/ts/rdb/files/scripts/docker-start.ts.template +3 -3
- package/src/ts/rdb/files/scripts/wait-for-db.ts.template +3 -3
- package/src/ts/rdb/files/src/create-db-user-handler.ts.template +2 -2
- package/src/ts/rdb/files/src/migration-handler.ts.template +2 -2
- package/src/ts/rdb/files/src/prisma.ts.template +2 -2
- package/src/ts/rdb/generator.js +84 -66
- package/src/ts/rdb/generator.js.map +1 -1
- package/src/ts/rdb/schema.d.ts +5 -5
- package/src/ts/rdb/schema.json +13 -13
- package/src/ts/rdb/trpc-connection/files/src/middleware/__rdbNameKebab__.ts.template +1 -1
- package/src/ts/react-website/agui/files/common/src/hooks/useAgui__agentNameClassName__.tsx.template +9 -9
- package/src/ts/react-website/agui/generator.d.ts +2 -2
- package/src/ts/react-website/agui/generator.js +9 -9
- package/src/ts/react-website/agui/generator.js.map +1 -1
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +27 -25
- package/src/ts/react-website/app/files/app/cloudscape/src/components/AppLayout/index.tsx.template +5 -5
- package/src/ts/react-website/app/files/app/cloudscape/src/main.tsx.template +1 -1
- package/src/ts/react-website/app/files/app/cloudscape/src/styles.css.template +1 -1
- package/src/ts/react-website/app/files/app/none/src/components/AppLayout/index.tsx.template +5 -5
- package/src/ts/react-website/app/files/app/none/src/main.tsx.template +1 -1
- package/src/ts/react-website/app/files/app/none/src/styles.css.template +2 -2
- package/src/ts/react-website/app/files/app/shadcn/src/components/AppLayout/index.tsx.template +6 -6
- package/src/ts/react-website/app/files/app/shadcn/src/main.tsx.template +1 -1
- package/src/ts/react-website/app/generator.d.ts +3 -3
- package/src/ts/react-website/app/generator.js +104 -98
- package/src/ts/react-website/app/generator.js.map +1 -1
- package/src/ts/react-website/app/schema.d.ts +9 -6
- package/src/ts/react-website/app/schema.json +13 -13
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +3 -3
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.ux-provider.spec.ts.snap +3 -3
- package/src/ts/react-website/cognito-auth/generator.js +9 -9
- package/src/ts/react-website/cognito-auth/generator.js.map +1 -1
- package/src/ts/react-website/cognito-auth/schema.d.ts +2 -2
- package/src/ts/react-website/cognito-auth/schema.json +4 -4
- package/src/ts/website/app/schema.d.ts +8 -6
- package/src/ts/website/app/schema.json +21 -13
- package/src/ts/website/auth/generator.js +1 -1
- package/src/ts/website/auth/generator.js.map +1 -1
- package/src/ts/website/auth/schema.d.ts +2 -2
- package/src/ts/website/auth/schema.json +4 -4
- package/src/utils/agent-connection/agent-connection.js +1 -1
- package/src/utils/agent-connection/agent-connection.js.map +1 -1
- package/src/utils/agent-core-constructs/agent-core-constructs.d.ts +9 -9
- package/src/utils/agent-core-constructs/agent-core-constructs.js +11 -13
- package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
- package/src/utils/agent-core-constructs/files/cdk/app/agent-core/__nameKebabCase__/__nameKebabCase__.ts.template +13 -13
- package/src/utils/agent-core-constructs/files/terraform/app/agent-core/__nameKebabCase__/__nameKebabCase__.tf.template +4 -4
- package/src/utils/agent-core-constructs/files/terraform/core/agent-core/runtime.tf.template +5 -5
- package/src/utils/api-constructs/api-constructs.d.ts +3 -3
- package/src/utils/api-constructs/api-constructs.js +4 -6
- package/src/utils/api-constructs/api-constructs.js.map +1 -1
- package/src/utils/api-constructs/files/cdk/app/apis/http/__apiNameKebabCase__.ts.template +12 -12
- package/src/utils/api-constructs/files/cdk/app/apis/rest/__apiNameKebabCase__.ts.template +12 -12
- package/src/utils/api-constructs/files/terraform/app/apis/http/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +7 -7
- package/src/utils/api-constructs/files/terraform/app/apis/rest/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +10 -10
- package/src/utils/api-constructs/open-api-metadata.d.ts +3 -3
- package/src/utils/api-constructs/open-api-metadata.js +2 -2
- package/src/utils/api-constructs/open-api-metadata.js.map +1 -1
- package/src/utils/commands.d.ts +1 -1
- package/src/utils/commands.js +2 -2
- package/src/utils/commands.js.map +1 -1
- package/src/utils/config/__snapshots__/utils.spec.ts.snap +6 -6
- package/src/utils/config/index.d.ts +2 -2
- package/src/utils/connection/open-api/files/components/__apiNameClassName__Provider.tsx.template +7 -7
- package/src/utils/connection/open-api/react.d.ts +1 -1
- package/src/utils/connection/open-api/react.js +3 -3
- package/src/utils/containers.d.ts +5 -5
- package/src/utils/containers.js +6 -6
- package/src/utils/containers.js.map +1 -1
- package/src/utils/function-constructs/files/cdk/app/lambda-functions/{__functionNameKebabCase__.ts.template → __nameKebabCase__.ts.template} +1 -1
- package/src/utils/function-constructs/files/terraform/app/lambda-functions/{__functionNameKebabCase__/__functionNameKebabCase__.tf.template → __nameKebabCase__/__nameKebabCase__.tf.template} +7 -7
- package/src/utils/function-constructs/function-constructs.d.ts +4 -4
- package/src/utils/function-constructs/function-constructs.js +5 -7
- package/src/utils/function-constructs/function-constructs.js.map +1 -1
- package/src/utils/iac-providers.d.ts +3 -3
- package/src/utils/iac-providers.js +1 -1
- package/src/utils/iac.d.ts +2 -2
- package/src/utils/iac.js +6 -6
- package/src/utils/iac.js.map +1 -1
- package/src/utils/identity-constructs/identity-constructs.d.ts +2 -2
- package/src/utils/identity-constructs/identity-constructs.js +3 -3
- package/src/utils/identity-constructs/identity-constructs.js.map +1 -1
- package/src/utils/rdb-constructs/files/terraform/app/dbs/__nameKebabCase__/__nameKebabCase__.tf.template +4 -4
- package/src/utils/rdb-constructs/rdb-constructs.d.ts +4 -4
- package/src/utils/rdb-constructs/rdb-constructs.js +4 -6
- package/src/utils/rdb-constructs/rdb-constructs.js.map +1 -1
- package/src/utils/shared-constructs.d.ts +2 -2
- package/src/utils/shared-constructs.js +3 -3
- package/src/utils/shared-constructs.js.map +1 -1
- package/src/utils/website-constructs/website-constructs.d.ts +2 -2
- package/src/utils/website-constructs/website-constructs.js +4 -6
- package/src/utils/website-constructs/website-constructs.js.map +1 -1
|
@@ -34,12 +34,12 @@ const tsAgentGenerator = async (tree, options) => {
|
|
|
34
34
|
const targetSourceDir = (0, devkit_1.joinPathFragments)(project.root, targetSourceDirRelativeToProjectRoot);
|
|
35
35
|
const relativeSourceDir = targetSourceDir.replace(project.root + '/', './');
|
|
36
36
|
const distDir = (0, devkit_1.joinPathFragments)('dist', project.root);
|
|
37
|
-
const
|
|
38
|
-
const protocol = options.protocol ?? '
|
|
39
|
-
if (
|
|
40
|
-
console.warn('Warning: auth is ignored when no
|
|
37
|
+
const infra = options.infra ?? 'agentcore';
|
|
38
|
+
const protocol = options.protocol ?? 'http';
|
|
39
|
+
if (infra === 'none' && options.auth && options.auth !== 'iam') {
|
|
40
|
+
console.warn('Warning: auth is ignored when no infrastructure is configured (no infrastructure is generated)');
|
|
41
41
|
}
|
|
42
|
-
const auth = options.auth ?? '
|
|
42
|
+
const auth = options.auth ?? 'iam';
|
|
43
43
|
// Ensure the shared agent-connection project exists so the server entry
|
|
44
44
|
// point can import `runWithSessionId` and propagate the AgentCore session
|
|
45
45
|
// ID to any downstream MCP / A2A clients a later connection generator
|
|
@@ -55,8 +55,8 @@ const tsAgentGenerator = async (tree, options) => {
|
|
|
55
55
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files', 'common'), targetSourceDir, templateContext, { overwriteStrategy: devkit_1.OverwriteStrategy.KeepExisting });
|
|
56
56
|
// Generate protocol-specific files
|
|
57
57
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files', protocol.toLowerCase()), targetSourceDir, templateContext, { overwriteStrategy: devkit_1.OverwriteStrategy.KeepExisting });
|
|
58
|
-
if (
|
|
59
|
-
const
|
|
58
|
+
if (infra === 'agentcore') {
|
|
59
|
+
const containers = await (0, containers_1.resolveContainers)(tree, 'inherit');
|
|
60
60
|
const dockerImageTag = `${(0, npm_scope_1.getNpmScope)(tree)}-${name}:latest`;
|
|
61
61
|
// Add bundle target
|
|
62
62
|
await (0, bundle_1.addTypeScriptBundleTarget)(tree, project, {
|
|
@@ -80,7 +80,7 @@ const tsAgentGenerator = async (tree, options) => {
|
|
|
80
80
|
options: {
|
|
81
81
|
commands: [
|
|
82
82
|
fs.cp(`${targetSourceDir}/Dockerfile`, `${dockerOutputDir}/Dockerfile`),
|
|
83
|
-
`${
|
|
83
|
+
`${containers} build --platform linux/arm64 -t ${dockerImageTag} ${dockerOutputDir}`,
|
|
84
84
|
],
|
|
85
85
|
parallel: false,
|
|
86
86
|
},
|
|
@@ -89,20 +89,20 @@ const tsAgentGenerator = async (tree, options) => {
|
|
|
89
89
|
(0, nx_1.addDependencyToTargetIfNotPresent)(project, 'docker', dockerTargetName);
|
|
90
90
|
(0, nx_1.addDependencyToTargetIfNotPresent)(project, 'build', 'docker');
|
|
91
91
|
// Add shared constructs
|
|
92
|
-
const
|
|
93
|
-
await (0, shared_constructs_1.sharedConstructsGenerator)(tree, {
|
|
92
|
+
const iac = await (0, iac_1.resolveIac)(tree, options.iac);
|
|
93
|
+
await (0, shared_constructs_1.sharedConstructsGenerator)(tree, { iac });
|
|
94
94
|
// AG-UI uses HTTP as the AgentCore protocol type (AG-UI is HTTP-based with SSE over POST).
|
|
95
|
-
const infraProtocol = protocol === '
|
|
95
|
+
const infraProtocol = protocol === 'ag-ui' ? 'http' : protocol;
|
|
96
96
|
await (0, agent_core_constructs_1.addAgentInfra)(tree, {
|
|
97
97
|
agentNameKebabCase: name,
|
|
98
98
|
agentNameClassName,
|
|
99
99
|
projectName: project.name,
|
|
100
100
|
dockerImageTag,
|
|
101
101
|
dockerOutputDir,
|
|
102
|
-
|
|
102
|
+
iac,
|
|
103
103
|
auth,
|
|
104
104
|
serverProtocol: infraProtocol,
|
|
105
|
-
|
|
105
|
+
containers,
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
// Add dependencies
|
|
@@ -113,9 +113,9 @@ const tsAgentGenerator = async (tree, options) => {
|
|
|
113
113
|
'@aws-sdk/client-appconfigdata',
|
|
114
114
|
'@aws-lambda-powertools/parameters',
|
|
115
115
|
'@modelcontextprotocol/sdk',
|
|
116
|
-
...(protocol === '
|
|
116
|
+
...(protocol === 'a2a'
|
|
117
117
|
? ['express', '@a2a-js/sdk']
|
|
118
|
-
: protocol === '
|
|
118
|
+
: protocol === 'ag-ui'
|
|
119
119
|
? [
|
|
120
120
|
'@ag-ui/aws-strands',
|
|
121
121
|
'@ag-ui/core',
|
|
@@ -134,18 +134,18 @@ const tsAgentGenerator = async (tree, options) => {
|
|
|
134
134
|
'tsx',
|
|
135
135
|
'@types/node',
|
|
136
136
|
'agent-chat-cli',
|
|
137
|
-
...(protocol === '
|
|
137
|
+
...(protocol === 'a2a' || protocol === 'ag-ui'
|
|
138
138
|
? ['@types/express', '@types/cors']
|
|
139
139
|
: ['@types/ws', '@types/cors']),
|
|
140
140
|
]));
|
|
141
141
|
// A2A servers use port 9000 as per the Strands A2A SDK default and AgentCore A2A contract.
|
|
142
142
|
// HTTP and AG-UI agents use port 8081+ to avoid conflict with VS Code server on 8080.
|
|
143
|
-
const localDevPortStart = protocol === '
|
|
143
|
+
const localDevPortStart = protocol === 'a2a' ? 9000 : 8081;
|
|
144
144
|
const localDevPort = (0, port_1.assignPort)(tree, project, localDevPortStart);
|
|
145
145
|
// HTTP chat needs a tiny generated script to wrap the project's tRPC
|
|
146
146
|
// WebSocket client in a `ChatAdapter`. A2A speaks the standard A2A
|
|
147
147
|
// protocol, so we can run `agent-chat-cli` directly as a binary.
|
|
148
|
-
if (protocol === '
|
|
148
|
+
if (protocol === 'http') {
|
|
149
149
|
const scriptsDir = (0, devkit_1.joinPathFragments)(project.root, 'scripts', agentTargetPrefix);
|
|
150
150
|
const relativeAgentImport = `../../${targetSourceDirRelativeToProjectRoot}`;
|
|
151
151
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'scripts', 'http'), scriptsDir, {
|
|
@@ -155,14 +155,14 @@ const tsAgentGenerator = async (tree, options) => {
|
|
|
155
155
|
relativeAgentImport,
|
|
156
156
|
}, { overwriteStrategy: devkit_1.OverwriteStrategy.KeepExisting });
|
|
157
157
|
}
|
|
158
|
-
const chatUrl = protocol === '
|
|
158
|
+
const chatUrl = protocol === 'http'
|
|
159
159
|
? `ws://localhost:${localDevPort}/ws`
|
|
160
|
-
: protocol === '
|
|
160
|
+
: protocol === 'ag-ui'
|
|
161
161
|
? `http://localhost:${localDevPort}/invocations`
|
|
162
162
|
: `http://localhost:${localDevPort}`;
|
|
163
|
-
const chatCommand = protocol === '
|
|
163
|
+
const chatCommand = protocol === 'http'
|
|
164
164
|
? `tsx ./scripts/${agentTargetPrefix}/chat.ts`
|
|
165
|
-
: protocol === '
|
|
165
|
+
: protocol === 'ag-ui'
|
|
166
166
|
? `agent-chat-cli agui ${chatUrl}`
|
|
167
167
|
: `agent-chat-cli a2a ${chatUrl}`;
|
|
168
168
|
(0, devkit_1.updateProjectConfiguration)(tree, project.name, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/ts/agent/generator.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCASoB;AAEpB,uCAMwB;AACxB,iDAAsE;AACtE,+CAA0D;AAC1D,6CAA2D;AAC3D,mDAAiE;AACjE,qDAAoD;AACpD,sDAAsE;AACtE,
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/ts/agent/generator.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCASoB;AAEpB,uCAMwB;AACxB,iDAAsE;AACtE,+CAA0D;AAC1D,6CAA2D;AAC3D,mDAAiE;AACj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C,CAAC;IAEvE,MAAM,IAAA,6BAAoB,EAAC,IAAI,CAAC,CAAC;IACjC,OAAO,GAAG,EAAE;QACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC,CAAC;AAzRW,QAAA,gBAAgB,oBAyR3B;AAEF,kBAAe,wBAAgB,CAAC"}
|
|
@@ -23,7 +23,7 @@ const tsAgentMcpConnectionGenerator = async (tree, options) => {
|
|
|
23
23
|
if (!agentComponent || !mcpComponent) {
|
|
24
24
|
throw new Error('Both sourceComponent and targetComponent must be provided for ts#agent -> mcp connections');
|
|
25
25
|
}
|
|
26
|
-
if (mcpComponent.auth && mcpComponent.auth !== '
|
|
26
|
+
if (mcpComponent.auth && mcpComponent.auth.toLowerCase() !== 'iam') {
|
|
27
27
|
throw new Error(`MCP server connection currently only supports IAM authentication, but '${mcpComponent.name}' uses '${mcpComponent.auth}' authentication.`);
|
|
28
28
|
}
|
|
29
29
|
const mcpComponentName = mcpComponent.name ?? 'mcp-server';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/nx-plugin/src/ts/agent/mcp-connection/generator.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCASoB;AAEpB,0CAK2B;AAC3B,oDAAyE;AACzE,kDAA6D;AAC7D,gDAAiD;AACjD,sDAAuD;AACvD,wDAAuD;AACvD,4CAI4B;AAC5B,uFAI0D;AAE7C,QAAA,sCAAsC,GACjD,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAExB,MAAM,6BAA6B,GAAG,KAAK,EAChD,IAAU,EACV,OAA4C,EAChB,EAAE;IAC9B,MAAM,aAAa,GAAG,IAAA,wCAAmC,EACvD,IAAI,EACJ,OAAO,CAAC,aAAa,CACtB,CAAC;IACF,MAAM,aAAa,GAAG,IAAA,wCAAmC,EACvD,IAAI,EACJ,OAAO,CAAC,aAAa,CACtB,CAAC;IAEF,MAAM,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAC/C,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC;IAE7C,IAAI,CAAC,cAAc,IAAI,CAAC,YAAY,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CACb,2FAA2F,CAC5F,CAAC;IACJ,CAAC;IAED,IAAI,YAAY,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/nx-plugin/src/ts/agent/mcp-connection/generator.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCASoB;AAEpB,0CAK2B;AAC3B,oDAAyE;AACzE,kDAA6D;AAC7D,gDAAiD;AACjD,sDAAuD;AACvD,wDAAuD;AACvD,4CAI4B;AAC5B,uFAI0D;AAE7C,QAAA,sCAAsC,GACjD,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAExB,MAAM,6BAA6B,GAAG,KAAK,EAChD,IAAU,EACV,OAA4C,EAChB,EAAE;IAC9B,MAAM,aAAa,GAAG,IAAA,wCAAmC,EACvD,IAAI,EACJ,OAAO,CAAC,aAAa,CACtB,CAAC;IACF,MAAM,aAAa,GAAG,IAAA,wCAAmC,EACvD,IAAI,EACJ,OAAO,CAAC,aAAa,CACtB,CAAC;IAEF,MAAM,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAC/C,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC;IAE7C,IAAI,CAAC,cAAc,IAAI,CAAC,YAAY,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CACb,2FAA2F,CAC5F,CAAC;IACJ,CAAC;IAED,IAAI,YAAY,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE,CAAC;QACnE,MAAM,IAAI,KAAK,CACb,0EAA0E,YAAY,CAAC,IAAI,WAAW,YAAY,CAAC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AmC;QACnC,+BAA+B;QAC/B,WAAW;QACX,+BAA+B;KAChC,CAAC,EACF,EAAE,CACH,CAAC;IAEF,MAAM,IAAA,yCAA+B,EAAC,IAAI,EAAE;QAC1C,8CAAsC;KACvC,CAAC,CAAC;IAEH,MAAM,IAAA,6BAAoB,EAAC,IAAI,CAAC,CAAC;IACjC,OAAO,GAAG,EAAE;QACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC,CAAC;AA3IW,QAAA,6BAA6B,iCA2IxC;AAEF,kBAAe,qCAA6B,CAAC"}
|
|
@@ -4,12 +4,12 @@ import { createTRPCOptionsProxy } from "@trpc/tanstack-react-query";
|
|
|
4
4
|
import { createContext, FC, PropsWithChildren, useMemo } from "react";
|
|
5
5
|
import { useRuntimeConfig } from "../hooks/useRuntimeConfig";
|
|
6
6
|
import { TRPCClient, createTRPCClient, createWSClient, wsLink } from "@trpc/client";
|
|
7
|
-
<%_ if (auth === '
|
|
7
|
+
<%_ if (auth === 'iam') { _%>
|
|
8
8
|
import { useSigV4 } from "../hooks/useSigV4";
|
|
9
|
-
<%_ } else if (auth === '
|
|
9
|
+
<%_ } else if (auth === 'cognito') { _%>
|
|
10
10
|
import { useAuth } from "react-oidc-context";
|
|
11
11
|
<%_ } _%>
|
|
12
|
-
<%_ if (auth === '
|
|
12
|
+
<%_ if (auth === 'cognito') { _%>
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Utility to base64url-encode a string (for JWT in WebSocket protocol header)
|
|
@@ -43,9 +43,9 @@ export const <%= agentNameClassName %>AgentClientProvider: FC<PropsWithChildren>
|
|
|
43
43
|
const queryClient = useQueryClient();
|
|
44
44
|
const runtimeConfig = useRuntimeConfig();
|
|
45
45
|
const agentRuntimeValue = runtimeConfig.agentRuntimes.<%= agentNameClassName %>;
|
|
46
|
-
<%_ if (auth === '
|
|
46
|
+
<%_ if (auth === 'iam') { _%>
|
|
47
47
|
const sigv4Client = useSigV4();
|
|
48
|
-
<%_ } else if (auth === '
|
|
48
|
+
<%_ } else if (auth === 'cognito') { _%>
|
|
49
49
|
const auth = useAuth();
|
|
50
50
|
const accessToken = auth?.user?.access_token;
|
|
51
51
|
<%_ } _%>
|
|
@@ -56,7 +56,7 @@ export const <%= agentNameClassName %>AgentClientProvider: FC<PropsWithChildren>
|
|
|
56
56
|
? buildAgentCoreWsUrl(agentRuntimeValue)
|
|
57
57
|
: agentRuntimeValue;
|
|
58
58
|
|
|
59
|
-
<%_ if (auth === '
|
|
59
|
+
<%_ if (auth === 'iam') { _%>
|
|
60
60
|
const wsClient = createWSClient({
|
|
61
61
|
url: async () => {
|
|
62
62
|
const signedRequest = await sigv4Client.sign(wsUrl, {
|
|
@@ -66,7 +66,7 @@ export const <%= agentNameClassName %>AgentClientProvider: FC<PropsWithChildren>
|
|
|
66
66
|
return signedRequest.url;
|
|
67
67
|
},
|
|
68
68
|
});
|
|
69
|
-
<%_ } else if (auth === '
|
|
69
|
+
<%_ } else if (auth === 'cognito') { _%>
|
|
70
70
|
const wsClient = createWSClient({
|
|
71
71
|
url: wsUrl,
|
|
72
72
|
WebSocket: class extends WebSocket {
|
|
@@ -105,7 +105,7 @@ export const <%= agentNameClassName %>AgentClientProvider: FC<PropsWithChildren>
|
|
|
105
105
|
});
|
|
106
106
|
|
|
107
107
|
return { optionsProxy, client };
|
|
108
|
-
}, [agentRuntimeValue, queryClient<% if (auth === '
|
|
108
|
+
}, [agentRuntimeValue, queryClient<% if (auth === 'iam') { %>, sigv4Client<% } else if (auth === 'cognito') { %>, accessToken<% } %>]);
|
|
109
109
|
|
|
110
110
|
return (
|
|
111
111
|
<<%= agentNameClassName %>AgentTRPCContext.Provider value={container}>
|
|
@@ -28,14 +28,14 @@ async function tsAgentReactConnectionGenerator(tree, options) {
|
|
|
28
28
|
const agentName = targetComponent?.name ?? 'agent';
|
|
29
29
|
const agentNameClassName = targetComponent?.rc ?? (0, names_1.toClassName)(agentName);
|
|
30
30
|
const agentPort = targetComponent?.port ?? metadata?.ports?.[0] ?? 8081;
|
|
31
|
-
const auth = targetComponent?.auth ?? metadata?.auth ?? '
|
|
31
|
+
const auth = (targetComponent?.auth ?? metadata?.auth ?? 'iam').toLowerCase();
|
|
32
32
|
const agentProjectAlias = (0, npm_scope_1.toScopeAlias)(agentProjectConfig.name);
|
|
33
33
|
const agentPath = targetComponent?.path ?? 'src/agent';
|
|
34
|
-
if (targetComponent?.protocol === '
|
|
34
|
+
if ((targetComponent?.protocol ?? '').toLowerCase() === 'a2a') {
|
|
35
35
|
throw new Error(`Cannot connect a React website to an A2A agent. ` +
|
|
36
36
|
`Consider generating an agent with the HTTP or AG-UI protocol instead.`);
|
|
37
37
|
}
|
|
38
|
-
if (targetComponent?.protocol === '
|
|
38
|
+
if (targetComponent?.protocol === 'ag-ui') {
|
|
39
39
|
await (0, generator_2.addAgUiReactConnection)(tree, {
|
|
40
40
|
frontendProjectConfig,
|
|
41
41
|
agentName,
|
|
@@ -72,7 +72,7 @@ async function tsAgentReactConnectionGenerator(tree, options) {
|
|
|
72
72
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../../../utils/files/website/components/tanstack-query'), (0, devkit_1.joinPathFragments)(frontendProjectConfig.sourceRoot, 'components'), {}, {
|
|
73
73
|
overwriteStrategy: devkit_1.OverwriteStrategy.KeepExisting,
|
|
74
74
|
});
|
|
75
|
-
if (auth === '
|
|
75
|
+
if (auth === 'iam') {
|
|
76
76
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../../../utils/files/website/hooks/sigv4'), (0, devkit_1.joinPathFragments)(frontendProjectConfig.sourceRoot, 'hooks'), {}, {
|
|
77
77
|
overwriteStrategy: devkit_1.OverwriteStrategy.KeepExisting,
|
|
78
78
|
});
|
|
@@ -107,7 +107,7 @@ async function tsAgentReactConnectionGenerator(tree, options) {
|
|
|
107
107
|
'@tanstack/react-query',
|
|
108
108
|
'@tanstack/react-query-devtools',
|
|
109
109
|
'@trpc/tanstack-react-query',
|
|
110
|
-
...(auth === '
|
|
110
|
+
...(auth === 'iam'
|
|
111
111
|
? [
|
|
112
112
|
'oidc-client-ts',
|
|
113
113
|
'aws4fetch',
|
|
@@ -115,7 +115,7 @@ async function tsAgentReactConnectionGenerator(tree, options) {
|
|
|
115
115
|
'react-oidc-context',
|
|
116
116
|
]
|
|
117
117
|
: []),
|
|
118
|
-
...(auth === '
|
|
118
|
+
...(auth === 'cognito' ? ['react-oidc-context'] : []),
|
|
119
119
|
]), (0, versions_1.withVersions)(['@smithy/types']));
|
|
120
120
|
await (0, metrics_1.addGeneratorMetricsIfApplicable)(tree, [
|
|
121
121
|
exports.TS_AGENT_REACT_CONNECTION_GENERATOR_INFO,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/nx-plugin/src/ts/agent/react-connection/generator.ts"],"names":[],"mappings":";;;AAqCA,0EAsMC;AA3OD;;;GAGG;AACH,uCAQoB;AACpB,4EAAsF;AACtF,wDAAwD;AACxD,sDAAuD;AACvD,4CAAkE;AAClE,gDAA8D;AAC9D,kDAA6D;AAC7D,0CAK2B;AAC3B,oDAAyE;AACzE,+CAA6D;AAE7D,mFAAgG;AAChG,kEAG4C;AAE/B,QAAA,wCAAwC,GACnD,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAExB,KAAK,UAAU,+BAA+B,CACnD,IAAU,EACV,OAAkC;IAElC,MAAM,qBAAqB,GAAG,IAAA,wCAAmC,EAC/D,IAAI,EACJ,OAAO,CAAC,aAAa,CACtB,CAAC;IACF,MAAM,kBAAkB,GAAG,IAAA,wCAAmC,EAC5D,IAAI,EACJ,OAAO,CAAC,aAAa,CACtB,CAAC;IAEF,MAAM,eAAe,GACnB,OAAO,CAAC,eAAe,CAAC;IAE1B,uEAAuE;IACvE,MAAM,QAAQ,GAAG,kBAAkB,CAAC,QAAe,CAAC;IACpD,MAAM,SAAS,GAAG,eAAe,EAAE,IAAI,IAAI,OAAO,CAAC;IACnD,MAAM,kBAAkB,GAAG,eAAe,EAAE,EAAE,IAAI,IAAA,mBAAW,EAAC,SAAS,CAAC,CAAC;IACzE,MAAM,SAAS,GAAG,eAAe,EAAE,IAAI,IAAI,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IACxE,MAAM,IAAI,GAAG,eAAe,EAAE,IAAI,IAAI,QAAQ,EAAE,IAAI,IAAI,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/nx-plugin/src/ts/agent/react-connection/generator.ts"],"names":[],"mappings":";;;AAqCA,0EAsMC;AA3OD;;;GAGG;AACH,uCAQoB;AACpB,4EAAsF;AACtF,wDAAwD;AACxD,sDAAuD;AACvD,4CAAkE;AAClE,gDAA8D;AAC9D,kDAA6D;AAC7D,0CAK2B;AAC3B,oDAAyE;AACzE,+CAA6D;AAE7D,mFAAgG;AAChG,kEAG4C;AAE/B,QAAA,wCAAwC,GACnD,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAExB,KAAK,UAAU,+BAA+B,CACnD,IAAU,EACV,OAAkC;IAElC,MAAM,qBAAqB,GAAG,IAAA,wCAAmC,EAC/D,IAAI,EACJ,OAAO,CAAC,aAAa,CACtB,CAAC;IACF,MAAM,kBAAkB,GAAG,IAAA,wCAAmC,EAC5D,IAAI,EACJ,OAAO,CAAC,aAAa,CACtB,CAAC;IAEF,MAAM,eAAe,GACnB,OAAO,CAAC,eAAe,CAAC;IAE1B,uEAAuE;IACvE,MAAM,QAAQ,GAAG,kBAAkB,CAAC,QAAe,CAAC;IACpD,MAAM,SAAS,GAAG,eAAe,EAAE,IAAI,IAAI,OAAO,CAAC;IACnD,MAAM,kBAAkB,GAAG,eAAe,EAAE,EAAE,IAAI,IAAA,mBAAW,EAAC,SAAS,CAAC,CAAC;IACzE,MAAM,SAAS,GAAG,e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+B,CAAC;AAE/C;;;;GAIG;AACH,SAAS,uBAAuB,CAC9B,IAAU,EACV,WAAmB,EACnB,WAAmB;IAEnB,MAAM,YAAY,GAAG,CAAC,oBAAoB,EAAE,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CACtE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CACf,CAAC;IACF,IAAI,CAAC,YAAY;QAAE,OAAO;IAE1B,MAAM,aAAa,GAAG,CAAC,KAAK,WAAW,IAAI,CAAC,CAAC;IAC7C,MAAM,UAAU,GAAG,IAAA,wBAAY,EAAC,WAAW,CAAC,CAAC;IAE7C,IAAA,mBAAU,EAAC,IAAI,EAAE,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE;QACtC,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE,CAAC;QAChD,iEAAiE;QACjE,MAAM,gBAAgB,GAAG,GAAG,UAAU,IAAI,CAAC;QAC3C,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC7B,KAAK,CAAC,gBAAgB,CAAC,GAAG,aAAa,CAAC;QAC1C,CAAC;QACD,6CAA6C;QAC7C,MAAM,cAAc,GAAG,GAAG,WAAW,IAAI,CAAC;QAC1C,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC;YAC3B,KAAK,CAAC,cAAc,CAAC,GAAG,aAAa,CAAC;QACxC,CAAC;QACD,IAAI,CAAC,eAAe,GAAG;YACrB,GAAG,IAAI,CAAC,eAAe;YACvB,KAAK;SACN,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addTsAgentTargetToServeLocal = void 0;
|
|
4
4
|
const agent_serve_local_1 = require("../../../connection/agent-serve-local");
|
|
5
5
|
const addTsAgentTargetToServeLocal = async (tree, sourceProjectName, targetProjectName, options) => {
|
|
6
|
-
const protocol = options.targetComponent?.protocol ?? '
|
|
7
|
-
const localUrl = protocol === '
|
|
6
|
+
const protocol = options.targetComponent?.protocol ?? 'http';
|
|
7
|
+
const localUrl = protocol === 'ag-ui'
|
|
8
8
|
? `http://localhost:${options.port}/invocations`
|
|
9
9
|
: `ws://localhost:${options.port}/ws`;
|
|
10
10
|
await (0, agent_serve_local_1.addAgentTargetToServeLocal)(tree, sourceProjectName, targetProjectName, {
|
package/src/ts/agent/schema.d.ts
CHANGED
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { IacOption } from '../../utils/iac';
|
|
7
7
|
|
|
8
|
-
export type
|
|
9
|
-
export type
|
|
10
|
-
export type AgentProtocol = '
|
|
8
|
+
export type TsAgentFramework = 'strands';
|
|
9
|
+
export type TsAgentInfra = 'agentcore' | 'none';
|
|
10
|
+
export type AgentProtocol = 'http' | 'a2a' | 'ag-ui';
|
|
11
11
|
|
|
12
|
-
export type TsAgentAuth = '
|
|
12
|
+
export type TsAgentAuth = 'iam' | 'cognito';
|
|
13
13
|
|
|
14
14
|
export interface TsAgentGeneratorSchema {
|
|
15
15
|
project: string;
|
|
16
|
-
|
|
16
|
+
framework?: TsAgentFramework;
|
|
17
17
|
name?: string;
|
|
18
|
-
|
|
18
|
+
infra?: TsAgentInfra;
|
|
19
19
|
auth?: TsAgentAuth;
|
|
20
20
|
protocol?: AgentProtocol;
|
|
21
|
-
|
|
21
|
+
iac: IacOption;
|
|
22
22
|
}
|
package/src/ts/agent/schema.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"x-prompt": "Select the TypeScript project to add the Agent to",
|
|
16
16
|
"x-dropdown": "projects"
|
|
17
17
|
},
|
|
18
|
-
"
|
|
18
|
+
"framework": {
|
|
19
19
|
"type": "string",
|
|
20
20
|
"description": "The agent SDK to use.",
|
|
21
21
|
"x-prompt": "Which agent SDK would you like to use?",
|
|
@@ -23,14 +23,6 @@
|
|
|
23
23
|
"default": "strands",
|
|
24
24
|
"x-priority": "important"
|
|
25
25
|
},
|
|
26
|
-
"computeType": {
|
|
27
|
-
"type": "string",
|
|
28
|
-
"description": "The type of compute to host your Agent.",
|
|
29
|
-
"x-prompt": "How would you like to host your Agent server?",
|
|
30
|
-
"enum": ["BedrockAgentCoreRuntime", "None"],
|
|
31
|
-
"default": "BedrockAgentCoreRuntime",
|
|
32
|
-
"x-priority": "important"
|
|
33
|
-
},
|
|
34
26
|
"name": {
|
|
35
27
|
"type": "string",
|
|
36
28
|
"description": "The name of your Agent (default: agent)",
|
|
@@ -38,9 +30,9 @@
|
|
|
38
30
|
},
|
|
39
31
|
"auth": {
|
|
40
32
|
"type": "string",
|
|
41
|
-
"description": "The method used to authenticate with your Agent. Only applicable when
|
|
42
|
-
"default": "
|
|
43
|
-
"enum": ["
|
|
33
|
+
"description": "The method used to authenticate with your Agent. Only applicable when infra is set (ignored when infra is none).",
|
|
34
|
+
"default": "iam",
|
|
35
|
+
"enum": ["iam", "cognito"],
|
|
44
36
|
"x-prompt": "How would you like to authenticate with your Agent?",
|
|
45
37
|
"x-priority": "important"
|
|
46
38
|
},
|
|
@@ -48,17 +40,25 @@
|
|
|
48
40
|
"type": "string",
|
|
49
41
|
"description": "The server protocol for your Agent. HTTP exposes a tRPC/WebSocket server. A2A exposes an Agent-to-Agent protocol server. AG-UI exposes an AG-UI protocol server for direct frontend integration with CopilotKit.",
|
|
50
42
|
"x-prompt": "Which protocol would you like to use for your Agent?",
|
|
51
|
-
"enum": ["
|
|
52
|
-
"default": "
|
|
43
|
+
"enum": ["http", "a2a", "ag-ui"],
|
|
44
|
+
"default": "http",
|
|
53
45
|
"x-priority": "important"
|
|
54
46
|
},
|
|
55
|
-
"
|
|
47
|
+
"iac": {
|
|
56
48
|
"type": "string",
|
|
57
49
|
"description": "The preferred IaC provider. By default this is inherited from your initial selection.",
|
|
58
|
-
"enum": ["
|
|
50
|
+
"enum": ["inherit", "cdk", "terraform"],
|
|
59
51
|
"x-priority": "important",
|
|
60
|
-
"default": "
|
|
61
|
-
"x-prompt": "Which provider would you like to manage your infrastructure? (default:
|
|
52
|
+
"default": "inherit",
|
|
53
|
+
"x-prompt": "Which provider would you like to manage your infrastructure? (default: inherit)"
|
|
54
|
+
},
|
|
55
|
+
"infra": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"description": "The type of infrastructure to host your Agent.",
|
|
58
|
+
"x-prompt": "How would you like to host your Agent server?",
|
|
59
|
+
"enum": ["agentcore", "none"],
|
|
60
|
+
"default": "agentcore",
|
|
61
|
+
"x-priority": "important"
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"required": ["project"]
|
package/src/ts/api/generator.js
CHANGED
|
@@ -12,23 +12,25 @@ async function tsApiGenerator(tree, options) {
|
|
|
12
12
|
case 'trpc':
|
|
13
13
|
return (0, generator_1.tsTrpcApiGenerator)(tree, {
|
|
14
14
|
name: options.name,
|
|
15
|
-
|
|
15
|
+
infra: options.infra,
|
|
16
16
|
integrationPattern: options.integrationPattern,
|
|
17
17
|
auth: options.auth,
|
|
18
18
|
directory: options.directory,
|
|
19
19
|
subDirectory: options.subDirectory,
|
|
20
|
-
|
|
20
|
+
iac: options.iac,
|
|
21
21
|
});
|
|
22
22
|
case 'smithy':
|
|
23
23
|
return (0, generator_2.tsSmithyApiGenerator)(tree, {
|
|
24
24
|
name: options.name,
|
|
25
25
|
namespace: options.namespace,
|
|
26
|
-
|
|
26
|
+
infra: options.infra === 'none'
|
|
27
|
+
? 'none'
|
|
28
|
+
: (options.infra ?? 'rest-lambda'),
|
|
27
29
|
integrationPattern: options.integrationPattern,
|
|
28
30
|
auth: options.auth,
|
|
29
31
|
directory: options.directory,
|
|
30
32
|
subDirectory: options.subDirectory,
|
|
31
|
-
|
|
33
|
+
iac: options.iac,
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/ts/api/generator.ts"],"names":[],"mappings":";;;AAaA,
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/ts/api/generator.ts"],"names":[],"mappings":";;;AAaA,wCAgCC;AAvCD,uCAAmE;AACnE,4DAAkE;AAClE,6DAAqE;AAExD,QAAA,qBAAqB,GAChC,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAExB,KAAK,UAAU,cAAc,CAClC,IAAU,EACV,OAA6B;IAE7B,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC;IAE9C,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,MAAM;YACT,OAAO,IAAA,8BAAkB,EAAC,IAAI,EAAE;gBAC9B,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;gBAC9C,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,YAAY,EAAE,OAAO,CAAC,YAAY;gBAClC,GAAG,EAAE,OAAO,CAAC,GAAG;aACjB,CAAC,CAAC;QACL,KAAK,QAAQ;YACX,OAAO,IAAA,gCAAoB,EAAC,IAAI,EAAE;gBAChC,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,KAAK,EACH,OAAO,CAAC,KAAK,KAAK,MAAM;oBACtB,CAAC,CAAC,MAAM;oBACR,CAAC,CAAE,CAAC,OAAO,CAAC,KAAK,IAAI,aAAa,CAAmB;gBACzD,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;gBAC9C,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,YAAY,EAAE,OAAO,CAAC,YAAY;gBAClC,GAAG,EAAE,OAAO,CAAC,GAAG;aACjB,CAAC,CAAC;IACP,CAAC;AACH,CAAC;AAED,kBAAe,cAAc,CAAC"}
|
package/src/ts/api/schema.d.ts
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { TsProjectGeneratorSchema } from '../lib/schema';
|
|
6
|
-
import {
|
|
6
|
+
import { IacOption } from '../../utils/iac';
|
|
7
7
|
|
|
8
8
|
export interface TsApiGeneratorSchema {
|
|
9
9
|
name: string;
|
|
10
10
|
framework?: 'trpc' | 'smithy';
|
|
11
11
|
namespace?: string;
|
|
12
|
-
|
|
12
|
+
infra: 'rest-lambda' | 'http-lambda' | 'none';
|
|
13
13
|
integrationPattern?: 'isolated' | 'shared';
|
|
14
|
-
auth: '
|
|
14
|
+
auth: 'iam' | 'cognito' | 'custom';
|
|
15
15
|
directory?: TsProjectGeneratorSchema['directory'];
|
|
16
16
|
subDirectory?: TsProjectGeneratorSchema['subDirectory'];
|
|
17
|
-
|
|
17
|
+
iac: IacOption;
|
|
18
18
|
}
|
package/src/ts/api/schema.json
CHANGED
|
@@ -41,14 +41,6 @@
|
|
|
41
41
|
"description": "The namespace for the Smithy API (only applicable for the smithy framework). Defaults to your monorepo scope",
|
|
42
42
|
"x-prompt": "What namespace would you like your API to have? i.e: com.example"
|
|
43
43
|
},
|
|
44
|
-
"computeType": {
|
|
45
|
-
"type": "string",
|
|
46
|
-
"description": "The type of compute to use to deploy this API.",
|
|
47
|
-
"default": "ServerlessApiGatewayRestApi",
|
|
48
|
-
"enum": ["ServerlessApiGatewayRestApi", "ServerlessApiGatewayHttpApi"],
|
|
49
|
-
"x-prompt": "What compute type would you like to deploy your API with?",
|
|
50
|
-
"x-priority": "important"
|
|
51
|
-
},
|
|
52
44
|
"integrationPattern": {
|
|
53
45
|
"type": "string",
|
|
54
46
|
"description": "How API Gateway integrations are generated for the API. Choose between isolated (default) and shared.",
|
|
@@ -73,9 +65,9 @@
|
|
|
73
65
|
},
|
|
74
66
|
"auth": {
|
|
75
67
|
"type": "string",
|
|
76
|
-
"description": "The method used to authenticate with your API. Choose between
|
|
77
|
-
"default": "
|
|
78
|
-
"enum": ["
|
|
68
|
+
"description": "The method used to authenticate with your API. Choose between iam (default), cognito or custom.",
|
|
69
|
+
"default": "iam",
|
|
70
|
+
"enum": ["iam", "cognito", "custom"],
|
|
79
71
|
"x-prompt": "How would you like users to authenticate with your API?",
|
|
80
72
|
"x-priority": "important"
|
|
81
73
|
},
|
|
@@ -92,13 +84,21 @@
|
|
|
92
84
|
"description": "The sub directory the project is placed in. By default this is the project name.",
|
|
93
85
|
"x-prompt": "Which sub directory do you want to create the project in? (By default this is the project name)"
|
|
94
86
|
},
|
|
95
|
-
"
|
|
87
|
+
"iac": {
|
|
96
88
|
"type": "string",
|
|
97
89
|
"description": "The preferred IaC provider. By default this is inherited from your initial selection.",
|
|
98
|
-
"enum": ["
|
|
90
|
+
"enum": ["inherit", "cdk", "terraform"],
|
|
99
91
|
"x-priority": "important",
|
|
100
|
-
"default": "
|
|
101
|
-
"x-prompt": "Which provider would you like to manage your infrastructure? (default:
|
|
92
|
+
"default": "inherit",
|
|
93
|
+
"x-prompt": "Which provider would you like to manage your infrastructure? (default: inherit)"
|
|
94
|
+
},
|
|
95
|
+
"infra": {
|
|
96
|
+
"type": "string",
|
|
97
|
+
"description": "The type of infrastructure to use to deploy this API.",
|
|
98
|
+
"default": "rest-lambda",
|
|
99
|
+
"enum": ["rest-lambda", "http-lambda", "none"],
|
|
100
|
+
"x-prompt": "What infrastructure would you like to deploy your API with?",
|
|
101
|
+
"x-priority": "important"
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
104
|
"required": ["name"]
|
|
@@ -133,7 +133,7 @@ export const handler = middy()
|
|
|
133
133
|
"
|
|
134
134
|
`;
|
|
135
135
|
|
|
136
|
-
exports[`ts-lambda-function generator > terraform
|
|
136
|
+
exports[`ts-lambda-function generator > terraform iac > should generate terraform files for lambda function and snapshot them > terraform-lambda-files 1`] = `
|
|
137
137
|
{
|
|
138
138
|
"test-project-test-function.tf": "terraform {
|
|
139
139
|
required_providers {
|
|
@@ -315,7 +315,7 @@ output "role_name" {
|
|
|
315
315
|
}
|
|
316
316
|
`;
|
|
317
317
|
|
|
318
|
-
exports[`ts-lambda-function generator > terraform
|
|
318
|
+
exports[`ts-lambda-function generator > terraform iac > should match snapshot for terraform generated files with different configurations > terraform-lambda-snapshot-function.tf 1`] = `
|
|
319
319
|
"terraform {
|
|
320
320
|
required_providers {
|
|
321
321
|
aws = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<%_ if (
|
|
1
|
+
<%_ if (event !== 'Any') { _%>
|
|
2
2
|
import { parser } from '@aws-lambda-powertools/parser/middleware';
|
|
3
|
-
import { <%=
|
|
3
|
+
import { <%= event %> } from '@aws-lambda-powertools/parser/schemas';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
<%_ } _%>
|
|
6
6
|
import middy from '@middy/core';
|
|
@@ -22,19 +22,19 @@ process.env.POWERTOOLS_SERVICE_NAME = "<%= lambdaFunctionClassName %>";
|
|
|
22
22
|
const tracer = new Tracer();
|
|
23
23
|
const logger = new Logger();
|
|
24
24
|
const metrics = new Metrics();
|
|
25
|
-
<%_ const inputType =
|
|
25
|
+
<%_ const inputType = event === 'Any' ? 'any' : `z.infer<typeof ${event}>`; _%>
|
|
26
26
|
<%_ const outputType = `Promise<${returnType.type}>`; %>
|
|
27
27
|
|
|
28
28
|
export const <%= lambdaFunctionCamelCase %> = async (event: <%- inputType %>): <%- outputType %> => {
|
|
29
29
|
logger.info("Received event", event);
|
|
30
30
|
|
|
31
31
|
// TODO: implement
|
|
32
|
-
<%_ if (['APIGatewayProxyEventSchema', 'APIGatewayProxyEventV2Schema', 'APIGatewayProxyWebsocketEventSchema', 'AlbSchema', 'LambdaFunctionUrlSchema'].includes(
|
|
32
|
+
<%_ if (['APIGatewayProxyEventSchema', 'APIGatewayProxyEventV2Schema', 'APIGatewayProxyWebsocketEventSchema', 'AlbSchema', 'LambdaFunctionUrlSchema'].includes(event)) { _%>
|
|
33
33
|
return {
|
|
34
34
|
statusCode: 200,
|
|
35
35
|
body: ''
|
|
36
36
|
};
|
|
37
|
-
<%_ } else if (['APIGatewayRequestAuthorizerEventSchema', 'APIGatewayTokenAuthorizerEventSchema', 'APIGatewayRequestAuthorizerEventV2Schema'].includes(
|
|
37
|
+
<%_ } else if (['APIGatewayRequestAuthorizerEventSchema', 'APIGatewayTokenAuthorizerEventSchema', 'APIGatewayRequestAuthorizerEventV2Schema'].includes(event)) { _%>
|
|
38
38
|
return {
|
|
39
39
|
principalId: 'user',
|
|
40
40
|
policyDocument: {
|
|
@@ -48,17 +48,17 @@ export const <%= lambdaFunctionCamelCase %> = async (event: <%- inputType %>): <
|
|
|
48
48
|
]
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
|
-
<%_ } else if (['KinesisFirehoseSchema', 'KinesisFirehoseSqsSchema'].includes(
|
|
51
|
+
<%_ } else if (['KinesisFirehoseSchema', 'KinesisFirehoseSqsSchema'].includes(event)) { _%>
|
|
52
52
|
return {
|
|
53
53
|
records: []
|
|
54
54
|
};
|
|
55
|
-
<%_ } else if (
|
|
55
|
+
<%_ } else if (event === 'TransferFamilySchema') { _%>
|
|
56
56
|
return {
|
|
57
57
|
Role: '',
|
|
58
58
|
Policy: '',
|
|
59
59
|
HomeDirectory: '/'
|
|
60
60
|
};
|
|
61
|
-
<%_ } else if (['PreSignupTriggerSchema', 'PostConfirmationTriggerSchema', 'CustomMessageTriggerSchema', 'MigrateUserTriggerSchema', 'CustomSMSSenderTriggerSchema', 'CustomEmailSenderTriggerSchema', 'DefineAuthChallengeTriggerSchema', 'CreateAuthChallengeTriggerSchema', 'VerifyAuthChallengeTriggerSchema', 'PreTokenGenerationTriggerSchemaV1', 'PreTokenGenerationTriggerSchemaV2AndV3'].includes(
|
|
61
|
+
<%_ } else if (['PreSignupTriggerSchema', 'PostConfirmationTriggerSchema', 'CustomMessageTriggerSchema', 'MigrateUserTriggerSchema', 'CustomSMSSenderTriggerSchema', 'CustomEmailSenderTriggerSchema', 'DefineAuthChallengeTriggerSchema', 'CreateAuthChallengeTriggerSchema', 'VerifyAuthChallengeTriggerSchema', 'PreTokenGenerationTriggerSchemaV1', 'PreTokenGenerationTriggerSchemaV2AndV3'].includes(event)) { _%>
|
|
62
62
|
return event;
|
|
63
63
|
<%_ } else { /* Event sources which don't need to return a response */ _%>
|
|
64
64
|
<%_ } _%>
|
|
@@ -68,7 +68,7 @@ export const handler = middy()
|
|
|
68
68
|
.use(captureLambdaHandler(tracer))
|
|
69
69
|
.use(injectLambdaContext(logger))
|
|
70
70
|
.use(logMetrics(metrics))
|
|
71
|
-
<%_ if (
|
|
72
|
-
.use(parser({ schema: <%=
|
|
71
|
+
<%_ if (event !== 'Any') { _%>
|
|
72
|
+
.use(parser({ schema: <%= event %> }))
|
|
73
73
|
<%_ } _%>
|
|
74
74
|
.handler(<%= lambdaFunctionCamelCase %>);
|