@aws/nx-plugin 1.0.0-rc.30 → 1.0.0-rc.32
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 +235 -1336
- package/README.md +1 -1
- package/package.json +1 -2
- package/src/mcp-server/tools/create-workspace-command.js +2 -2
- package/src/mcp-server/tools/create-workspace-command.js.map +1 -1
- package/src/open-api/ts-client/__snapshots__/generator.additional-properties.spec.ts.snap +147 -33
- package/src/open-api/ts-client/__snapshots__/generator.arrays.spec.ts.snap +308 -75
- package/src/open-api/ts-client/__snapshots__/generator.complex-types.spec.ts.snap +286 -62
- package/src/open-api/ts-client/__snapshots__/generator.composite-types.spec.ts.snap +674 -93
- package/src/open-api/ts-client/__snapshots__/generator.content-type.spec.ts.snap +211 -36
- package/src/open-api/ts-client/__snapshots__/generator.duplicate-types.spec.ts.snap +196 -44
- package/src/open-api/ts-client/__snapshots__/generator.edge-cases.spec.ts.snap +5507 -0
- package/src/open-api/ts-client/__snapshots__/generator.fast-api.spec.ts.snap +219 -60
- package/src/open-api/ts-client/__snapshots__/generator.multipart.spec.ts.snap +280 -0
- package/src/open-api/ts-client/__snapshots__/generator.primitive-types.spec.ts.snap +351 -80
- package/src/open-api/ts-client/__snapshots__/generator.request.spec.ts.snap +170 -49
- package/src/open-api/ts-client/__snapshots__/generator.reserved-keywords.spec.ts.snap +98 -22
- package/src/open-api/ts-client/__snapshots__/generator.response.spec.ts.snap +147 -33
- package/src/open-api/ts-client/__snapshots__/generator.streaming.spec.ts.snap +392 -88
- package/src/open-api/ts-client/__snapshots__/generator.tags.spec.ts.snap +196 -44
- package/src/open-api/ts-client/files/client.gen.ts.template +166 -19
- package/src/open-api/ts-client/files/types.gen.ts.template +4 -4
- package/src/open-api/ts-client/generator.js +1 -1
- package/src/open-api/ts-client/generator.js.map +1 -1
- package/src/open-api/ts-hooks/files/options-proxy.gen.ts.template +5 -0
- package/src/open-api/ts-hooks/generator.spec.tsx +70 -0
- package/src/open-api/utils/codegen-data/languages.d.ts +0 -6
- package/src/open-api/utils/codegen-data/languages.js +23 -18
- package/src/open-api/utils/codegen-data/languages.js.map +1 -1
- package/src/open-api/utils/codegen-data/types.d.ts +240 -10
- package/src/open-api/utils/codegen-data/types.js +24 -1
- package/src/open-api/utils/codegen-data/types.js.map +1 -1
- package/src/open-api/utils/codegen-data.d.ts +2 -2
- package/src/open-api/utils/codegen-data.js +357 -617
- package/src/open-api/utils/codegen-data.js.map +1 -1
- package/src/open-api/utils/normalise.js +167 -22
- package/src/open-api/utils/normalise.js.map +1 -1
- package/src/open-api/utils/parser.d.ts +55 -0
- package/src/open-api/utils/parser.js +754 -0
- package/src/open-api/utils/parser.js.map +1 -0
- package/src/open-api/utils/types.d.ts +18 -0
- package/src/open-api/utils/types.js.map +1 -1
- package/src/preset/__snapshots__/generator.spec.ts.snap +6 -6
- package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +414 -6
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +276 -4
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +414 -6
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +0 -23
- package/src/ts/mcp-server/generator.js +10 -22
- package/src/ts/mcp-server/generator.js.map +1 -1
- package/src/utils/api-constructs/files/terraform/app/apis/http/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +69 -1
- package/src/utils/api-constructs/files/terraform/app/apis/rest/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +69 -1
- package/src/utils/mcp.js +1 -1
- package/src/utils/mcp.js.map +1 -1
- package/src/utils/names.d.ts +6 -0
- package/src/utils/names.js +6 -1
- package/src/utils/names.js.map +1 -1
- package/src/utils/versions.d.ts +5 -5
- package/src/utils/versions.js +4 -4
- package/src/utils/versions.js.map +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/ import { addDependenciesToPackageJson, detectPackageManager, generateFiles, joinPathFragments, OverwriteStrategy, readJson, updateJson, updateProjectConfiguration
|
|
4
|
+
*/ import { addDependenciesToPackageJson, detectPackageManager, generateFiles, joinPathFragments, OverwriteStrategy, readJson, updateJson, updateProjectConfiguration } from "@nx/devkit";
|
|
5
5
|
import { ensureLicenseExceptions } from "../../license/config.js";
|
|
6
6
|
import { MCP_INSPECTOR_EXCEPTIONS } from "../../license/known-exceptions.js";
|
|
7
7
|
import { addMcpServerInfra } from "../../utils/agent-core-constructs/agent-core-constructs.js";
|
|
@@ -38,27 +38,11 @@ export const tsMcpServerGenerator = async (tree, options)=>{
|
|
|
38
38
|
console.warn('Warning: auth is ignored when no infrastructure is configured (no infrastructure is generated)');
|
|
39
39
|
}
|
|
40
40
|
const auth = options.auth ?? 'iam';
|
|
41
|
-
// Create a package.json if one doesn't exist, since we want to add the server as a bin target
|
|
42
41
|
const projectPackageJsonPath = joinPathFragments(project.root, 'package.json');
|
|
43
|
-
if
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
type: 'module'
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
// Generate esm if the package.json is of type module, otherwise we generate commonjs
|
|
51
|
-
// We support commonjs here because nx plugins must be commonjs
|
|
52
|
-
// https://github.com/nrwl/nx/issues/15682
|
|
53
|
-
const esm = readJson(tree, projectPackageJsonPath).type === 'module';
|
|
54
|
-
// Add a target for running the MCP server with stdio transport
|
|
55
|
-
// This allows for the project to be published to npm and then configured with npx, ie:
|
|
56
|
-
// npx -p my-package mcp-server
|
|
57
|
-
updateJson(tree, projectPackageJsonPath, (pkg)=>{
|
|
58
|
-
pkg.bin ??= {};
|
|
59
|
-
pkg.bin[name] = `${relativeSourceDir}/stdio.js`;
|
|
60
|
-
return pkg;
|
|
61
|
-
});
|
|
42
|
+
// Generate esm if the module system is esm, otherwise commonjs. Projects
|
|
43
|
+
// don't typically have their own package.json (dependencies are declared in
|
|
44
|
+
// the workspace root), so fall back to the root which is esm by default.
|
|
45
|
+
const esm = readJson(tree, tree.exists(projectPackageJsonPath) ? projectPackageJsonPath : 'package.json').type === 'module';
|
|
62
46
|
// Generate example server
|
|
63
47
|
generateFiles(tree, joinPathFragments(import.meta.dirname, 'files'), targetSourceDir, {
|
|
64
48
|
name,
|
|
@@ -133,7 +117,11 @@ export const tsMcpServerGenerator = async (tree, options)=>{
|
|
|
133
117
|
tree.delete(joinPathFragments(targetSourceDir, 'Dockerfile'));
|
|
134
118
|
}
|
|
135
119
|
addDependenciesToPackageJson(tree, deps, devDeps);
|
|
136
|
-
|
|
120
|
+
// Add to the project's package.json too if it has one (e.g. nx plugins),
|
|
121
|
+
// otherwise dependencies live in the workspace root only.
|
|
122
|
+
if (tree.exists(projectPackageJsonPath)) {
|
|
123
|
+
addDependenciesToPackageJson(tree, deps, devDeps, projectPackageJsonPath);
|
|
124
|
+
}
|
|
137
125
|
// @modelcontextprotocol/sdk declares zod as a peer dependency with a wide range
|
|
138
126
|
// (^3.25 || ^4.0). Yarn does not dedupe the peer to the workspace's pinned zod, so
|
|
139
127
|
// without a resolution it installs a separate zod under the SDK's own node_modules.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/mcp-server/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n addDependenciesToPackageJson,\n detectPackageManager,\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n readJson,\n type Tree,\n updateJson,\n updateProjectConfiguration,\n writeJson,\n} from '@nx/devkit';\nimport { ensureLicenseExceptions } from '../../license/config';\nimport { MCP_INSPECTOR_EXCEPTIONS } from '../../license/known-exceptions';\nimport { addMcpServerInfra } from '../../utils/agent-core-constructs/agent-core-constructs';\nimport { addTypeScriptBundleTarget } from '../../utils/bundle/bundle';\nimport { resolveContainers } from '../../utils/containers';\nimport { formatFilesInSubtree } from '../../utils/format';\nimport { FsCommands } from '../../utils/fs';\nimport { resolveIac } from '../../utils/iac';\nimport { installDependencies } from '../../utils/install';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics';\nimport { kebabCase, toClassName } from '../../utils/names';\nimport { getNpmScope } from '../../utils/npm-scope';\nimport {\n addComponentDevTarget,\n addComponentGeneratorMetadata,\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../utils/nx';\nimport { sortObjectKeys } from '../../utils/object';\nimport { assignPort } from '../../utils/port';\nimport { sharedConstructsGenerator } from '../../utils/shared-constructs';\nimport { TS_VERSIONS, withVersions } from '../../utils/versions';\nimport type { TsMcpServerGeneratorSchema } from './schema';\n\nexport const TS_MCP_SERVER_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport const tsMcpServerGenerator = async (\n tree: Tree,\n options: TsMcpServerGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const project = readProjectConfigurationUnqualified(tree, options.project);\n\n if (!tree.exists(joinPathFragments(project.root, 'tsconfig.json'))) {\n throw new Error(\n `Unsupported project ${options.project}. Expected a TypeScript project (with a tsconfig.json)`,\n );\n }\n\n const defaultName = `${kebabCase(project.name.split('/').pop())}-mcp-server`;\n const name = kebabCase(options.name || defaultName);\n const mcpServerNameClassName = toClassName(name);\n const mcpTargetPrefix = options.name ? name : 'mcp-server';\n const targetSourceDirRelativeToProjectRoot = joinPathFragments(\n 'src',\n mcpTargetPrefix,\n );\n const targetSourceDir = joinPathFragments(\n project.root,\n targetSourceDirRelativeToProjectRoot,\n );\n const relativeSourceDir = targetSourceDir.replace(project.root + '/', './');\n const distDir = joinPathFragments('dist', project.root);\n\n const infra = options.infra ?? 'agentcore';\n\n if (infra === 'none' && options.auth && options.auth !== 'iam') {\n console.warn(\n 'Warning: auth is ignored when no infrastructure is configured (no infrastructure is generated)',\n );\n }\n\n const auth = options.auth ?? 'iam';\n\n // Create a package.json if one doesn't exist, since we want to add the server as a bin target\n const projectPackageJsonPath = joinPathFragments(\n project.root,\n 'package.json',\n );\n if (!tree.exists(projectPackageJsonPath)) {\n // Default to esm if no package.json found\n writeJson(tree, projectPackageJsonPath, {\n name: project.name,\n type: 'module',\n });\n }\n\n // Generate esm if the package.json is of type module, otherwise we generate commonjs\n // We support commonjs here because nx plugins must be commonjs\n // https://github.com/nrwl/nx/issues/15682\n const esm = readJson(tree, projectPackageJsonPath).type === 'module';\n\n // Add a target for running the MCP server with stdio transport\n // This allows for the project to be published to npm and then configured with npx, ie:\n // npx -p my-package mcp-server\n updateJson(tree, projectPackageJsonPath, (pkg) => {\n pkg.bin ??= {};\n pkg.bin[name] = `${relativeSourceDir}/stdio.js`;\n return pkg;\n });\n\n // Generate example server\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files'),\n targetSourceDir,\n {\n name,\n esm,\n distDir,\n adotVersion:\n TS_VERSIONS['@aws/aws-distro-opentelemetry-node-autoinstrumentation'],\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n // Add dependencies\n const deps = withVersions([\n '@modelcontextprotocol/sdk',\n 'zod',\n 'express',\n '@aws-lambda-powertools/parameters',\n '@aws-sdk/client-appconfigdata',\n ]);\n const devDeps = withVersions([\n 'tsx',\n '@types/express',\n '@modelcontextprotocol/inspector',\n ]);\n\n // Add hosting based on infra\n if (infra === 'agentcore') {\n const containers = await resolveContainers(tree, 'inherit');\n const dockerImageTag = `${getNpmScope(tree)}-${name}:latest`;\n\n // Add bundle target\n await addTypeScriptBundleTarget(tree, project, {\n targetFilePath: `${targetSourceDirRelativeToProjectRoot}/http.ts`,\n bundleOutputDir: joinPathFragments('mcp', name),\n });\n\n const dockerOutputDir = joinPathFragments(\n 'dist',\n project.root,\n 'bundle',\n 'mcp',\n name,\n );\n const dockerTargetName = `${mcpTargetPrefix}-docker`;\n\n const fs = new FsCommands(tree);\n project.targets[dockerTargetName] = {\n cache: true,\n outputs: [`{workspaceRoot}/${dockerOutputDir}/Dockerfile`],\n executor: 'nx:run-commands',\n options: {\n commands: [\n fs.cp(\n `${targetSourceDir}/Dockerfile`,\n `${dockerOutputDir}/Dockerfile`,\n ),\n `${containers} build --platform linux/arm64 -t ${dockerImageTag} ${dockerOutputDir}`,\n ],\n parallel: false,\n },\n dependsOn: ['bundle'],\n };\n\n addDependencyToTargetIfNotPresent(project, 'docker', dockerTargetName);\n addDependencyToTargetIfNotPresent(project, 'build', 'docker');\n\n // Add shared constructs\n const iac = await resolveIac(tree, options.iac);\n await sharedConstructsGenerator(tree, { iac });\n\n // Add the construct to deploy the mcp server\n await addMcpServerInfra(tree, {\n mcpServerNameKebabCase: name,\n mcpServerNameClassName,\n projectName: project.name,\n dockerImageTag,\n dockerOutputDir,\n iac,\n auth,\n containers,\n });\n } else {\n // No Dockerfile needed for non-hosted MCP\n tree.delete(joinPathFragments(targetSourceDir, 'Dockerfile'));\n }\n\n addDependenciesToPackageJson(tree, deps, devDeps);\n addDependenciesToPackageJson(tree, deps, devDeps, projectPackageJsonPath);\n\n // @modelcontextprotocol/sdk declares zod as a peer dependency with a wide range\n // (^3.25 || ^4.0). Yarn does not dedupe the peer to the workspace's pinned zod, so\n // without a resolution it installs a separate zod under the SDK's own node_modules.\n // The two zod copies have structurally incompatible types, which breaks type\n // inference for registerTool inputSchema. Scope the resolution to the SDK so\n // other consumers (e.g. @tanstack/router-generator pinning zod@3) are unaffected.\n if (detectPackageManager() === 'yarn') {\n updateJson(tree, 'package.json', (packageJson) => {\n packageJson.resolutions = {\n ...packageJson.resolutions,\n '**/@modelcontextprotocol/sdk/zod': TS_VERSIONS['zod'],\n };\n return packageJson;\n });\n }\n\n const localDevPort = assignPort(tree, project, 8000, {\n component: { info: TS_MCP_SERVER_GENERATOR_INFO, name: mcpTargetPrefix },\n });\n\n const mcpTargets = {\n ...project.targets,\n // Add targets for running the MCP server\n [`${mcpTargetPrefix}-serve-stdio`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [`tsx --watch ${relativeSourceDir}/stdio.ts`],\n cwd: '{projectRoot}',\n },\n },\n [`${mcpTargetPrefix}-serve`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [`tsx --watch ${relativeSourceDir}/http.ts`],\n cwd: '{projectRoot}',\n env: {\n PORT: `${localDevPort}`,\n },\n },\n },\n [`${mcpTargetPrefix}-dev`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [`tsx --watch ${relativeSourceDir}/http.ts`],\n cwd: '{projectRoot}',\n env: {\n PORT: `${localDevPort}`,\n LOCAL_DEV: 'true',\n },\n },\n },\n [`${mcpTargetPrefix}-inspect`]: {\n executor: 'nx:run-commands',\n continuous: true,\n // Launch the inspector against the locally served HTTP server. The dev\n // target starts the server and any connected dependencies (e.g. a local\n // database).\n dependsOn: [`${mcpTargetPrefix}-dev`],\n options: {\n commands: [\n `mcp-inspector --transport http --server-url http://localhost:${localDevPort}/mcp`,\n ],\n cwd: '{projectRoot}',\n },\n },\n [`${mcpTargetPrefix}-inspect-stdio`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [\n `mcp-inspector -- tsx --watch ${relativeSourceDir}/stdio.ts`,\n ],\n cwd: '{projectRoot}',\n },\n },\n };\n\n // Aggregate `<mcp>-dev` under the project-level `dev` target.\n addComponentDevTarget(mcpTargets, `${mcpTargetPrefix}-dev`);\n\n updateProjectConfiguration(tree, project.name, {\n ...project,\n // Sort targets so their order is stable regardless of insertion order on\n // first run vs re-run.\n targets: sortObjectKeys(mcpTargets),\n });\n\n addComponentGeneratorMetadata(\n tree,\n project.name,\n TS_MCP_SERVER_GENERATOR_INFO,\n targetSourceDirRelativeToProjectRoot,\n mcpTargetPrefix,\n {\n port: localDevPort,\n rc: mcpServerNameClassName,\n auth,\n },\n );\n\n await addGeneratorMetricsIfApplicable(tree, [TS_MCP_SERVER_GENERATOR_INFO]);\n\n await ensureLicenseExceptions(tree, MCP_INSPECTOR_EXCEPTIONS);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\n\nexport default tsMcpServerGenerator;\n"],"names":["addDependenciesToPackageJson","detectPackageManager","generateFiles","joinPathFragments","OverwriteStrategy","readJson","updateJson","updateProjectConfiguration","writeJson","ensureLicenseExceptions","MCP_INSPECTOR_EXCEPTIONS","addMcpServerInfra","addTypeScriptBundleTarget","resolveContainers","formatFilesInSubtree","FsCommands","resolveIac","installDependencies","addGeneratorMetricsIfApplicable","kebabCase","toClassName","getNpmScope","addComponentDevTarget","addComponentGeneratorMetadata","addDependencyToTargetIfNotPresent","getGeneratorInfo","readProjectConfigurationUnqualified","sortObjectKeys","assignPort","sharedConstructsGenerator","TS_VERSIONS","withVersions","TS_MCP_SERVER_GENERATOR_INFO","filename","tsMcpServerGenerator","tree","options","project","exists","root","Error","defaultName","name","split","pop","mcpServerNameClassName","mcpTargetPrefix","targetSourceDirRelativeToProjectRoot","targetSourceDir","relativeSourceDir","replace","distDir","infra","auth","console","warn","projectPackageJsonPath","type","esm","pkg","bin","dirname","adotVersion","overwriteStrategy","KeepExisting","deps","devDeps","containers","dockerImageTag","targetFilePath","bundleOutputDir","dockerOutputDir","dockerTargetName","fs","targets","cache","outputs","executor","commands","cp","parallel","dependsOn","iac","mcpServerNameKebabCase","projectName","delete","packageJson","resolutions","localDevPort","component","info","mcpTargets","continuous","cwd","env","PORT","LOCAL_DEV","port","rc","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,GACD,SACEA,4BAA4B,EAC5BC,oBAAoB,EAEpBC,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EACjBC,QAAQ,EAERC,UAAU,EACVC,0BAA0B,EAC1BC,SAAS,QACJ,aAAa;AACpB,SAASC,uBAAuB,QAAQ,0BAAuB;AAC/D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gB,QAAQ,CAAC,CAAC,EAAE;YAC9B+B,UAAU;YACVe,YAAY;YACZ,uEAAuE;YACvE,wEAAwE;YACxE,aAAa;YACbX,WAAW;gBAAC,GAAGnC,gBAAgB,IAAI,CAAC;aAAC;YACrCV,SAAS;gBACP0C,UAAU;oBACR,CAAC,6DAA6D,EAAEU,aAAa,IAAI,CAAC;iBACnF;gBACDK,KAAK;YACP;QACF;QACA,CAAC,GAAG/C,gBAAgB,cAAc,CAAC,CAAC,EAAE;YACpC+B,UAAU;YACVe,YAAY;YACZxD,SAAS;gBACP0C,UAAU;oBACR,CAAC,6BAA6B,EAAE7B,kBAAkB,SAAS,CAAC;iBAC7D;gBACD4C,KAAK;YACP;QACF;IACF;IAEA,8DAA8D;IAC9DvE,sBAAsBqE,YAAY,GAAG7C,gBAAgB,IAAI,CAAC;IAE1DvC,2BAA2B4B,MAAME,QAAQK,IAAI,EAAE;QAC7C,GAAGL,OAAO;QACV,yEAAyE;QACzE,uBAAuB;QACvBqC,SAAS/C,eAAegE;IAC1B;IAEApE,8BACEY,MACAE,QAAQK,IAAI,EACZV,8BACAe,sCACAD,iBACA;QACEmD,MAAMT;QACNU,IAAIrD;QACJQ;IACF;IAGF,MAAMnC,gCAAgCiB,MAAM;QAACH;KAA6B;IAE1E,MAAMvB,wBAAwB0B,MAAMzB;IAEpC,MAAMI,qBAAqBqB;IAC3B,OAAO,IACLlB,oBAAoBkB,MAAMC,QAAQ+D,yBAAyB,EAAE;YAC3DC,WAAW;gBAAC;aAAa;QAC3B;AACJ,EAAE;AAEF,eAAelE,qBAAqB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/mcp-server/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n addDependenciesToPackageJson,\n detectPackageManager,\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n readJson,\n type Tree,\n updateJson,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { ensureLicenseExceptions } from '../../license/config';\nimport { MCP_INSPECTOR_EXCEPTIONS } from '../../license/known-exceptions';\nimport { addMcpServerInfra } from '../../utils/agent-core-constructs/agent-core-constructs';\nimport { addTypeScriptBundleTarget } from '../../utils/bundle/bundle';\nimport { resolveContainers } from '../../utils/containers';\nimport { formatFilesInSubtree } from '../../utils/format';\nimport { FsCommands } from '../../utils/fs';\nimport { resolveIac } from '../../utils/iac';\nimport { installDependencies } from '../../utils/install';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics';\nimport { kebabCase, toClassName } from '../../utils/names';\nimport { getNpmScope } from '../../utils/npm-scope';\nimport {\n addComponentDevTarget,\n addComponentGeneratorMetadata,\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../utils/nx';\nimport { sortObjectKeys } from '../../utils/object';\nimport { assignPort } from '../../utils/port';\nimport { sharedConstructsGenerator } from '../../utils/shared-constructs';\nimport { TS_VERSIONS, withVersions } from '../../utils/versions';\nimport type { TsMcpServerGeneratorSchema } from './schema';\n\nexport const TS_MCP_SERVER_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport const tsMcpServerGenerator = async (\n tree: Tree,\n options: TsMcpServerGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const project = readProjectConfigurationUnqualified(tree, options.project);\n\n if (!tree.exists(joinPathFragments(project.root, 'tsconfig.json'))) {\n throw new Error(\n `Unsupported project ${options.project}. Expected a TypeScript project (with a tsconfig.json)`,\n );\n }\n\n const defaultName = `${kebabCase(project.name.split('/').pop())}-mcp-server`;\n const name = kebabCase(options.name || defaultName);\n const mcpServerNameClassName = toClassName(name);\n const mcpTargetPrefix = options.name ? name : 'mcp-server';\n const targetSourceDirRelativeToProjectRoot = joinPathFragments(\n 'src',\n mcpTargetPrefix,\n );\n const targetSourceDir = joinPathFragments(\n project.root,\n targetSourceDirRelativeToProjectRoot,\n );\n const relativeSourceDir = targetSourceDir.replace(project.root + '/', './');\n const distDir = joinPathFragments('dist', project.root);\n\n const infra = options.infra ?? 'agentcore';\n\n if (infra === 'none' && options.auth && options.auth !== 'iam') {\n console.warn(\n 'Warning: auth is ignored when no infrastructure is configured (no infrastructure is generated)',\n );\n }\n\n const auth = options.auth ?? 'iam';\n\n const projectPackageJsonPath = joinPathFragments(\n project.root,\n 'package.json',\n );\n\n // Generate esm if the module system is esm, otherwise commonjs. Projects\n // don't typically have their own package.json (dependencies are declared in\n // the workspace root), so fall back to the root which is esm by default.\n const esm =\n readJson(\n tree,\n tree.exists(projectPackageJsonPath)\n ? projectPackageJsonPath\n : 'package.json',\n ).type === 'module';\n\n // Generate example server\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files'),\n targetSourceDir,\n {\n name,\n esm,\n distDir,\n adotVersion:\n TS_VERSIONS['@aws/aws-distro-opentelemetry-node-autoinstrumentation'],\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n // Add dependencies\n const deps = withVersions([\n '@modelcontextprotocol/sdk',\n 'zod',\n 'express',\n '@aws-lambda-powertools/parameters',\n '@aws-sdk/client-appconfigdata',\n ]);\n const devDeps = withVersions([\n 'tsx',\n '@types/express',\n '@modelcontextprotocol/inspector',\n ]);\n\n // Add hosting based on infra\n if (infra === 'agentcore') {\n const containers = await resolveContainers(tree, 'inherit');\n const dockerImageTag = `${getNpmScope(tree)}-${name}:latest`;\n\n // Add bundle target\n await addTypeScriptBundleTarget(tree, project, {\n targetFilePath: `${targetSourceDirRelativeToProjectRoot}/http.ts`,\n bundleOutputDir: joinPathFragments('mcp', name),\n });\n\n const dockerOutputDir = joinPathFragments(\n 'dist',\n project.root,\n 'bundle',\n 'mcp',\n name,\n );\n const dockerTargetName = `${mcpTargetPrefix}-docker`;\n\n const fs = new FsCommands(tree);\n project.targets[dockerTargetName] = {\n cache: true,\n outputs: [`{workspaceRoot}/${dockerOutputDir}/Dockerfile`],\n executor: 'nx:run-commands',\n options: {\n commands: [\n fs.cp(\n `${targetSourceDir}/Dockerfile`,\n `${dockerOutputDir}/Dockerfile`,\n ),\n `${containers} build --platform linux/arm64 -t ${dockerImageTag} ${dockerOutputDir}`,\n ],\n parallel: false,\n },\n dependsOn: ['bundle'],\n };\n\n addDependencyToTargetIfNotPresent(project, 'docker', dockerTargetName);\n addDependencyToTargetIfNotPresent(project, 'build', 'docker');\n\n // Add shared constructs\n const iac = await resolveIac(tree, options.iac);\n await sharedConstructsGenerator(tree, { iac });\n\n // Add the construct to deploy the mcp server\n await addMcpServerInfra(tree, {\n mcpServerNameKebabCase: name,\n mcpServerNameClassName,\n projectName: project.name,\n dockerImageTag,\n dockerOutputDir,\n iac,\n auth,\n containers,\n });\n } else {\n // No Dockerfile needed for non-hosted MCP\n tree.delete(joinPathFragments(targetSourceDir, 'Dockerfile'));\n }\n\n addDependenciesToPackageJson(tree, deps, devDeps);\n // Add to the project's package.json too if it has one (e.g. nx plugins),\n // otherwise dependencies live in the workspace root only.\n if (tree.exists(projectPackageJsonPath)) {\n addDependenciesToPackageJson(tree, deps, devDeps, projectPackageJsonPath);\n }\n\n // @modelcontextprotocol/sdk declares zod as a peer dependency with a wide range\n // (^3.25 || ^4.0). Yarn does not dedupe the peer to the workspace's pinned zod, so\n // without a resolution it installs a separate zod under the SDK's own node_modules.\n // The two zod copies have structurally incompatible types, which breaks type\n // inference for registerTool inputSchema. Scope the resolution to the SDK so\n // other consumers (e.g. @tanstack/router-generator pinning zod@3) are unaffected.\n if (detectPackageManager() === 'yarn') {\n updateJson(tree, 'package.json', (packageJson) => {\n packageJson.resolutions = {\n ...packageJson.resolutions,\n '**/@modelcontextprotocol/sdk/zod': TS_VERSIONS['zod'],\n };\n return packageJson;\n });\n }\n\n const localDevPort = assignPort(tree, project, 8000, {\n component: { info: TS_MCP_SERVER_GENERATOR_INFO, name: mcpTargetPrefix },\n });\n\n const mcpTargets = {\n ...project.targets,\n // Add targets for running the MCP server\n [`${mcpTargetPrefix}-serve-stdio`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [`tsx --watch ${relativeSourceDir}/stdio.ts`],\n cwd: '{projectRoot}',\n },\n },\n [`${mcpTargetPrefix}-serve`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [`tsx --watch ${relativeSourceDir}/http.ts`],\n cwd: '{projectRoot}',\n env: {\n PORT: `${localDevPort}`,\n },\n },\n },\n [`${mcpTargetPrefix}-dev`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [`tsx --watch ${relativeSourceDir}/http.ts`],\n cwd: '{projectRoot}',\n env: {\n PORT: `${localDevPort}`,\n LOCAL_DEV: 'true',\n },\n },\n },\n [`${mcpTargetPrefix}-inspect`]: {\n executor: 'nx:run-commands',\n continuous: true,\n // Launch the inspector against the locally served HTTP server. The dev\n // target starts the server and any connected dependencies (e.g. a local\n // database).\n dependsOn: [`${mcpTargetPrefix}-dev`],\n options: {\n commands: [\n `mcp-inspector --transport http --server-url http://localhost:${localDevPort}/mcp`,\n ],\n cwd: '{projectRoot}',\n },\n },\n [`${mcpTargetPrefix}-inspect-stdio`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [\n `mcp-inspector -- tsx --watch ${relativeSourceDir}/stdio.ts`,\n ],\n cwd: '{projectRoot}',\n },\n },\n };\n\n // Aggregate `<mcp>-dev` under the project-level `dev` target.\n addComponentDevTarget(mcpTargets, `${mcpTargetPrefix}-dev`);\n\n updateProjectConfiguration(tree, project.name, {\n ...project,\n // Sort targets so their order is stable regardless of insertion order on\n // first run vs re-run.\n targets: sortObjectKeys(mcpTargets),\n });\n\n addComponentGeneratorMetadata(\n tree,\n project.name,\n TS_MCP_SERVER_GENERATOR_INFO,\n targetSourceDirRelativeToProjectRoot,\n mcpTargetPrefix,\n {\n port: localDevPort,\n rc: mcpServerNameClassName,\n auth,\n },\n );\n\n await addGeneratorMetricsIfApplicable(tree, [TS_MCP_SERVER_GENERATOR_INFO]);\n\n await ensureLicenseExceptions(tree, MCP_INSPECTOR_EXCEPTIONS);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\n\nexport default tsMcpServerGenerator;\n"],"names":["addDependenciesToPackageJson","detectPackageManager","generateFiles","joinPathFragments","OverwriteStrategy","readJson","updateJson","updateProjectConfiguration","ensureLicenseExceptions","MCP_INSPECTOR_EXCEPTIONS","addMcpServerInfra","addTypeScriptBundleTarget","resolveContainers","formatFilesInSubtree","FsCommands","resolveIac","installDependencies","addGeneratorMetricsIfApplicable","kebabCase","toClassName","getNpmScope","addComponentDevTarget","addComponentGeneratorMetadata","addDependencyToTargetIfNotPresent","getGeneratorInfo","readProjectConfigurationUnqualified","sortObjectKeys","assignPort","sharedConstructsGenerator","TS_VERSIONS","withVersions","TS_MCP_SERVER_GENERATOR_INFO","filename","tsMcpServerGenerator","tree","options","project","exists","root","Error","defaultName","name","split","pop","mcpServerNameClassName","mcpTargetPrefix","targetSourceDirRelativeToProjectRoot","targetSourceDir","relativeSourceDir","replace","distDir","infra","auth","console","warn","projectPackageJsonPath","esm","type","dirname","adotVersion","overwriteStrategy","KeepExisting","deps","devDeps","containers","dockerImageTag","targetFilePath","bundleOutputDir","dockerOutputDir","dockerTargetName","fs","targets","cache","outputs","executor","commands","cp","parallel","dependsOn","iac","mcpServerNameKebabCase","projectName","delete","packageJson","resolutions","localDevPort","component","info","mcpTargets","continuous","cwd","env","PORT","LOCAL_DEV","port","rc","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,GACD,SACEA,4BAA4B,EAC5BC,oBAAoB,EAEpBC,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EACjBC,QAAQ,EAERC,UAAU,EACVC,0BAA0B,QACrB,aAAa;AACpB,SAASC,uBAAuB,QAAQ,0BAAuB;AAC/D,SAASC,wBAAwB,QAA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,cAAc,CAAC,CAAC,EAAE;YACpC6B,UAAU;YACVe,YAAY;YACZtD,SAAS;gBACPwC,UAAU;oBACR,CAAC,6BAA6B,EAAE3B,kBAAkB,SAAS,CAAC;iBAC7D;gBACD0C,KAAK;YACP;QACF;IACF;IAEA,8DAA8D;IAC9DrE,sBAAsBmE,YAAY,GAAG3C,gBAAgB,IAAI,CAAC;IAE1DtC,2BAA2B2B,MAAME,QAAQK,IAAI,EAAE;QAC7C,GAAGL,OAAO;QACV,yEAAyE;QACzE,uBAAuB;QACvBmC,SAAS7C,eAAe8D;IAC1B;IAEAlE,8BACEY,MACAE,QAAQK,IAAI,EACZV,8BACAe,sCACAD,iBACA;QACEiD,MAAMT;QACNU,IAAInD;QACJQ;IACF;IAGF,MAAMnC,gCAAgCiB,MAAM;QAACH;KAA6B;IAE1E,MAAMvB,wBAAwB0B,MAAMzB;IAEpC,MAAMI,qBAAqBqB;IAC3B,OAAO,IACLlB,oBAAoBkB,MAAMC,QAAQ6D,yBAAyB,EAAE;YAC3DC,WAAW;gBAAC;aAAa;QAC3B;AACJ,EAAE;AAEF,eAAehE,qBAAqB"}
|
|
@@ -43,6 +43,30 @@ variable "asset_bucket_name" {
|
|
|
43
43
|
type = string
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
# VPC Configuration (optional)
|
|
47
|
+
variable "enable_vpc" {
|
|
48
|
+
description = "Deploy the Lambda function into a VPC. Set alongside vpc_id/subnet_ids."
|
|
49
|
+
type = bool
|
|
50
|
+
default = false
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
variable "vpc_id" {
|
|
54
|
+
description = "VPC ID to deploy the Lambda function into. Required when enable_vpc is true."
|
|
55
|
+
type = string
|
|
56
|
+
default = null
|
|
57
|
+
|
|
58
|
+
validation {
|
|
59
|
+
condition = !var.enable_vpc || (var.vpc_id != null && var.subnet_ids != null)
|
|
60
|
+
error_message = "vpc_id and subnet_ids must be set when enable_vpc is true."
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
variable "subnet_ids" {
|
|
65
|
+
description = "Subnet IDs to deploy the Lambda function into. Required when enable_vpc is true."
|
|
66
|
+
type = list(string)
|
|
67
|
+
default = null
|
|
68
|
+
}
|
|
69
|
+
|
|
46
70
|
# CORS Configuration (passed to core module)
|
|
47
71
|
variable "cors_allow_credentials" {
|
|
48
72
|
description = "Whether to allow credentials in CORS requests"
|
|
@@ -129,10 +153,32 @@ module "http_api" {
|
|
|
129
153
|
tags = var.tags
|
|
130
154
|
}
|
|
131
155
|
|
|
156
|
+
# Security group for the API Lambda function, used when deployed into a VPC
|
|
157
|
+
resource "aws_security_group" "api_lambda" {
|
|
158
|
+
count = var.enable_vpc ? 1 : 0
|
|
159
|
+
|
|
160
|
+
#checkov:skip=CKV2_AWS_5:Attached to api_lambda via vpc_config block; Checkov cannot resolve this reference
|
|
161
|
+
name_prefix = "<%- apiNameKebabCase %>-lambda-"
|
|
162
|
+
description = "Security group for the <%- apiNameClassName %> API Lambda function"
|
|
163
|
+
vpc_id = var.vpc_id
|
|
164
|
+
tags = var.tags
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
resource "aws_vpc_security_group_egress_rule" "api_lambda_https" {
|
|
168
|
+
count = var.enable_vpc ? 1 : 0
|
|
169
|
+
|
|
170
|
+
security_group_id = aws_security_group.api_lambda[0].id
|
|
171
|
+
cidr_ipv4 = "0.0.0.0/0"
|
|
172
|
+
from_port = 443
|
|
173
|
+
to_port = 443
|
|
174
|
+
ip_protocol = "tcp"
|
|
175
|
+
description = "Allow outbound HTTPS to AWS service endpoints"
|
|
176
|
+
}
|
|
177
|
+
|
|
132
178
|
# Lambda function
|
|
133
179
|
# This configures a single "router" lambda to serve all requests
|
|
134
180
|
resource "aws_lambda_function" "api_lambda" {
|
|
135
|
-
#checkov:skip=CKV_AWS_117:Lambda function
|
|
181
|
+
#checkov:skip=CKV_AWS_117:Lambda function is optionally deployed into a VPC via vpc_id/subnet_ids; not required for this use case
|
|
136
182
|
#checkov:skip=CKV_AWS_116:Dead Letter Queue not required for this simple API use case
|
|
137
183
|
#checkov:skip=CKV_AWS_272:Code signing not required for this use case
|
|
138
184
|
#checkov:skip=CKV_AWS_115:Concurrent execution limit not required for this use case
|
|
@@ -163,6 +209,14 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
163
209
|
mode = "Active"
|
|
164
210
|
}
|
|
165
211
|
|
|
212
|
+
dynamic "vpc_config" {
|
|
213
|
+
for_each = var.enable_vpc ? [1] : []
|
|
214
|
+
content {
|
|
215
|
+
subnet_ids = var.subnet_ids
|
|
216
|
+
security_group_ids = [aws_security_group.api_lambda[0].id]
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
166
220
|
<%_ if (backend.type === 'fastapi') { _%>
|
|
167
221
|
# Enable SnapStart for faster cold starts
|
|
168
222
|
snap_start {
|
|
@@ -181,6 +235,8 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
181
235
|
}
|
|
182
236
|
|
|
183
237
|
tags = var.tags
|
|
238
|
+
|
|
239
|
+
depends_on = [aws_iam_role_policy_attachment.lambda_vpc_access]
|
|
184
240
|
}
|
|
185
241
|
|
|
186
242
|
# IAM role for Lambda execution
|
|
@@ -215,6 +271,13 @@ resource "aws_iam_role_policy_attachment" "lambda_xray_execution" {
|
|
|
215
271
|
role = aws_iam_role.lambda_execution_role.name
|
|
216
272
|
}
|
|
217
273
|
|
|
274
|
+
# Attach VPC access policy to Lambda role when deployed into a VPC
|
|
275
|
+
resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
276
|
+
count = var.enable_vpc ? 1 : 0
|
|
277
|
+
policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole"
|
|
278
|
+
role = aws_iam_role.lambda_execution_role.name
|
|
279
|
+
}
|
|
280
|
+
|
|
218
281
|
# Additional IAM policies for Lambda (if provided)
|
|
219
282
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
220
283
|
count = length(var.additional_iam_policy_statements) > 0 ? 1 : 0
|
|
@@ -527,6 +590,11 @@ output "lambda_execution_role_name" {
|
|
|
527
590
|
value = aws_iam_role.lambda_execution_role.name
|
|
528
591
|
}
|
|
529
592
|
|
|
593
|
+
output "security_group_id" {
|
|
594
|
+
description = "Security group ID of the API Lambda function, for use in ingress rules on resources it must reach (e.g. a database). Null unless enable_vpc is true."
|
|
595
|
+
value = var.enable_vpc ? aws_security_group.api_lambda[0].id : null
|
|
596
|
+
}
|
|
597
|
+
|
|
530
598
|
# Integration Outputs
|
|
531
599
|
output "integration_id" {
|
|
532
600
|
description = "ID of the Lambda integration"
|
|
@@ -43,6 +43,30 @@ variable "asset_bucket_name" {
|
|
|
43
43
|
type = string
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
# VPC Configuration (optional)
|
|
47
|
+
variable "enable_vpc" {
|
|
48
|
+
description = "Deploy the Lambda function into a VPC. Set alongside vpc_id/subnet_ids."
|
|
49
|
+
type = bool
|
|
50
|
+
default = false
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
variable "vpc_id" {
|
|
54
|
+
description = "VPC ID to deploy the Lambda function into. Required when enable_vpc is true."
|
|
55
|
+
type = string
|
|
56
|
+
default = null
|
|
57
|
+
|
|
58
|
+
validation {
|
|
59
|
+
condition = !var.enable_vpc || (var.vpc_id != null && var.subnet_ids != null)
|
|
60
|
+
error_message = "vpc_id and subnet_ids must be set when enable_vpc is true."
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
variable "subnet_ids" {
|
|
65
|
+
description = "Subnet IDs to deploy the Lambda function into. Required when enable_vpc is true."
|
|
66
|
+
type = list(string)
|
|
67
|
+
default = null
|
|
68
|
+
}
|
|
69
|
+
|
|
46
70
|
# CORS Configuration (passed to core module)
|
|
47
71
|
|
|
48
72
|
variable "cors_allow_headers" {
|
|
@@ -139,9 +163,31 @@ resource "aws_wafv2_web_acl_association" "api_waf_association" {
|
|
|
139
163
|
depends_on = [aws_api_gateway_stage.api_stage]
|
|
140
164
|
}
|
|
141
165
|
|
|
166
|
+
# Security group for the API Lambda function, used when deployed into a VPC
|
|
167
|
+
resource "aws_security_group" "api_lambda" {
|
|
168
|
+
count = var.enable_vpc ? 1 : 0
|
|
169
|
+
|
|
170
|
+
#checkov:skip=CKV2_AWS_5:Attached to api_lambda via vpc_config block; Checkov cannot resolve this reference
|
|
171
|
+
name_prefix = "<%- apiNameKebabCase %>-lambda-"
|
|
172
|
+
description = "Security group for the <%- apiNameClassName %> API Lambda function"
|
|
173
|
+
vpc_id = var.vpc_id
|
|
174
|
+
tags = var.tags
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
resource "aws_vpc_security_group_egress_rule" "api_lambda_https" {
|
|
178
|
+
count = var.enable_vpc ? 1 : 0
|
|
179
|
+
|
|
180
|
+
security_group_id = aws_security_group.api_lambda[0].id
|
|
181
|
+
cidr_ipv4 = "0.0.0.0/0"
|
|
182
|
+
from_port = 443
|
|
183
|
+
to_port = 443
|
|
184
|
+
ip_protocol = "tcp"
|
|
185
|
+
description = "Allow outbound HTTPS to AWS service endpoints"
|
|
186
|
+
}
|
|
187
|
+
|
|
142
188
|
# Lambda function
|
|
143
189
|
resource "aws_lambda_function" "api_lambda" {
|
|
144
|
-
#checkov:skip=CKV_AWS_117:Lambda function
|
|
190
|
+
#checkov:skip=CKV_AWS_117:Lambda function is optionally deployed into a VPC via vpc_id/subnet_ids; not required for this use case
|
|
145
191
|
#checkov:skip=CKV_AWS_116:Dead Letter Queue not required for this simple API use case
|
|
146
192
|
#checkov:skip=CKV_AWS_272:Code signing not required for this use case
|
|
147
193
|
#checkov:skip=CKV_AWS_115:Concurrent execution limit not required for this use case
|
|
@@ -172,6 +218,14 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
172
218
|
mode = "Active"
|
|
173
219
|
}
|
|
174
220
|
|
|
221
|
+
dynamic "vpc_config" {
|
|
222
|
+
for_each = var.enable_vpc ? [1] : []
|
|
223
|
+
content {
|
|
224
|
+
subnet_ids = var.subnet_ids
|
|
225
|
+
security_group_ids = [aws_security_group.api_lambda[0].id]
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
175
229
|
<%_ if (backend.type === 'fastapi') { _%>
|
|
176
230
|
# Enable SnapStart for faster cold starts
|
|
177
231
|
snap_start {
|
|
@@ -190,6 +244,8 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
190
244
|
}
|
|
191
245
|
|
|
192
246
|
tags = var.tags
|
|
247
|
+
|
|
248
|
+
depends_on = [aws_iam_role_policy_attachment.lambda_vpc_access]
|
|
193
249
|
}
|
|
194
250
|
|
|
195
251
|
# IAM role for Lambda execution
|
|
@@ -224,6 +280,13 @@ resource "aws_iam_role_policy_attachment" "lambda_xray_execution" {
|
|
|
224
280
|
role = aws_iam_role.lambda_execution_role.name
|
|
225
281
|
}
|
|
226
282
|
|
|
283
|
+
# Attach VPC access policy to Lambda role when deployed into a VPC
|
|
284
|
+
resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
285
|
+
count = var.enable_vpc ? 1 : 0
|
|
286
|
+
policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole"
|
|
287
|
+
role = aws_iam_role.lambda_execution_role.name
|
|
288
|
+
}
|
|
289
|
+
|
|
227
290
|
# Additional IAM policies for Lambda (if provided)
|
|
228
291
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
229
292
|
count = length(var.additional_iam_policy_statements) > 0 ? 1 : 0
|
|
@@ -794,6 +857,11 @@ output "lambda_execution_role_name" {
|
|
|
794
857
|
value = aws_iam_role.lambda_execution_role.name
|
|
795
858
|
}
|
|
796
859
|
|
|
860
|
+
output "security_group_id" {
|
|
861
|
+
description = "Security group ID of the API Lambda function, for use in ingress rules on resources it must reach (e.g. a database). Null unless enable_vpc is true."
|
|
862
|
+
value = var.enable_vpc ? aws_security_group.api_lambda[0].id : null
|
|
863
|
+
}
|
|
864
|
+
|
|
797
865
|
# Integration Outputs
|
|
798
866
|
output "integration_id" {
|
|
799
867
|
description = "ID of the Lambda integration"
|
package/src/utils/mcp.js
CHANGED
|
@@ -13,7 +13,7 @@ import { updateToml } from "./toml.js";
|
|
|
13
13
|
* Arguments used to launch the Nx Plugin for AWS MCP server.
|
|
14
14
|
*/ export const NX_PLUGIN_MCP_SERVER_ARGS = [
|
|
15
15
|
'-y',
|
|
16
|
-
'@aws/nx-plugin-mcp
|
|
16
|
+
'@aws/nx-plugin-mcp'
|
|
17
17
|
];
|
|
18
18
|
/**
|
|
19
19
|
* A single stdio MCP server entry, shared by agents that use the `mcpServers` config shape.
|
package/src/utils/mcp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../packages/nx-plugin/src/utils/mcp.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { readJson, type Tree, writeJson } from '@nx/devkit';\nimport { updateToml } from './toml';\n\n/**\n * Name of the Nx Plugin for AWS MCP server, used as the key in each agent's config.\n */\nexport const NX_PLUGIN_MCP_SERVER_NAME = 'nx-plugin-for-aws';\n\n/**\n * Command used to launch the Nx Plugin for AWS MCP server.\n */\nexport const NX_PLUGIN_MCP_SERVER_COMMAND = 'npx';\n\n/**\n * Arguments used to launch the Nx Plugin for AWS MCP server.\n */\nexport const NX_PLUGIN_MCP_SERVER_ARGS = ['-y', '@aws/nx-plugin-mcp
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/nx-plugin/src/utils/mcp.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { readJson, type Tree, writeJson } from '@nx/devkit';\nimport { updateToml } from './toml';\n\n/**\n * Name of the Nx Plugin for AWS MCP server, used as the key in each agent's config.\n */\nexport const NX_PLUGIN_MCP_SERVER_NAME = 'nx-plugin-for-aws';\n\n/**\n * Command used to launch the Nx Plugin for AWS MCP server.\n */\nexport const NX_PLUGIN_MCP_SERVER_COMMAND = 'npx';\n\n/**\n * Arguments used to launch the Nx Plugin for AWS MCP server.\n */\nexport const NX_PLUGIN_MCP_SERVER_ARGS = ['-y', '@aws/nx-plugin-mcp'];\n\n/**\n * A single stdio MCP server entry, shared by agents that use the `mcpServers` config shape.\n */\nconst stdioServerEntry = () => ({\n command: NX_PLUGIN_MCP_SERVER_COMMAND,\n args: NX_PLUGIN_MCP_SERVER_ARGS,\n});\n\n/**\n * Merge the Nx Plugin for AWS MCP server into a JSON config file under the given key,\n * preserving any other servers already configured. Creates the file if it does not exist.\n */\nconst mergeJsonMcpConfig = (\n tree: Tree,\n filePath: string,\n key: 'mcpServers' | 'servers',\n entry: Record<string, unknown>,\n) => {\n const config = tree.exists(filePath) ? readJson(tree, filePath) : {};\n config[key] = {\n ...config[key],\n [NX_PLUGIN_MCP_SERVER_NAME]: entry,\n };\n writeJson(tree, filePath, config);\n};\n\n/**\n * Configure the Nx Plugin for AWS MCP server across the project-level config locations\n * used by common coding agents, so agents working in the workspace can use it to scaffold\n * AWS projects with the Nx Plugin for AWS.\n *\n * Existing servers and unrelated config in each file are preserved.\n */\nexport const configureMcpServers = (tree: Tree) => {\n // Agents using the `mcpServers` config shape (Claude Code, Cursor, Kiro, Gemini CLI)\n const mcpServersFiles = [\n '.mcp.json', // Claude Code\n '.cursor/mcp.json', // Cursor\n '.kiro/settings/mcp.json', // Kiro\n '.gemini/settings.json', // Gemini CLI\n ];\n for (const filePath of mcpServersFiles) {\n mergeJsonMcpConfig(tree, filePath, 'mcpServers', stdioServerEntry());\n }\n\n // GitHub Copilot uses the `servers` key with an explicit `type`\n mergeJsonMcpConfig(tree, '.vscode/mcp.json', 'servers', {\n type: 'stdio',\n ...stdioServerEntry(),\n });\n\n // OpenAI Codex CLI uses TOML under the `mcp_servers` table\n const codexConfig = '.codex/config.toml';\n if (!tree.exists(codexConfig)) {\n tree.write(codexConfig, '');\n }\n updateToml(tree, codexConfig, (prev) => ({\n ...prev,\n mcp_servers: {\n ...(prev.mcp_servers as object),\n [NX_PLUGIN_MCP_SERVER_NAME]: {\n command: NX_PLUGIN_MCP_SERVER_COMMAND,\n args: NX_PLUGIN_MCP_SERVER_ARGS,\n },\n },\n }));\n};\n"],"names":["readJson","writeJson","updateToml","NX_PLUGIN_MCP_SERVER_NAME","NX_PLUGIN_MCP_SERVER_COMMAND","NX_PLUGIN_MCP_SERVER_ARGS","stdioServerEntry","command","args","mergeJsonMcpConfig","tree","filePath","key","entry","config","exists","configureMcpServers","mcpServersFiles","type","codexConfig","write","prev","mcp_servers"],"mappings":"AAAA;;;CAGC,GACD,SAASA,QAAQ,EAAaC,SAAS,QAAQ,aAAa;AAC5D,SAASC,UAAU,QAAQ,YAAS;AAEpC;;CAEC,GACD,OAAO,MAAMC,4BAA4B,oBAAoB;AAE7D;;CAEC,GACD,OAAO,MAAMC,+BAA+B,MAAM;AAElD;;CAEC,GACD,OAAO,MAAMC,4BAA4B;IAAC;IAAM;CAAqB,CAAC;AAEtE;;CAEC,GACD,MAAMC,mBAAmB,IAAO,CAAA;QAC9BC,SAASH;QACTI,MAAMH;IACR,CAAA;AAEA;;;CAGC,GACD,MAAMI,qBAAqB,CACzBC,MACAC,UACAC,KACAC;IAEA,MAAMC,SAASJ,KAAKK,MAAM,CAACJ,YAAYX,SAASU,MAAMC,YAAY,CAAC;IACnEG,MAAM,CAACF,IAAI,GAAG;QACZ,GAAGE,MAAM,CAACF,IAAI;QACd,CAACT,0BAA0B,EAAEU;IAC/B;IACAZ,UAAUS,MAAMC,UAAUG;AAC5B;AAEA;;;;;;CAMC,GACD,OAAO,MAAME,sBAAsB,CAACN;IAClC,qFAAqF;IACrF,MAAMO,kBAAkB;QACtB;QACA;QACA;QACA;KACD;IACD,KAAK,MAAMN,YAAYM,gBAAiB;QACtCR,mBAAmBC,MAAMC,UAAU,cAAcL;IACnD;IAEA,gEAAgE;IAChEG,mBAAmBC,MAAM,oBAAoB,WAAW;QACtDQ,MAAM;QACN,GAAGZ,kBAAkB;IACvB;IAEA,2DAA2D;IAC3D,MAAMa,cAAc;IACpB,IAAI,CAACT,KAAKK,MAAM,CAACI,cAAc;QAC7BT,KAAKU,KAAK,CAACD,aAAa;IAC1B;IACAjB,WAAWQ,MAAMS,aAAa,CAACE,OAAU,CAAA;YACvC,GAAGA,IAAI;YACPC,aAAa;gBACX,GAAID,KAAKC,WAAW;gBACpB,CAACnB,0BAA0B,EAAE;oBAC3BI,SAASH;oBACTI,MAAMH;gBACR;YACF;QACF,CAAA;AACF,EAAE"}
|
package/src/utils/names.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* camelCase that first transliterates accents and strips any character that is
|
|
3
|
+
* not a valid identifier character, so inputs like `getFoo≠Bar` or `café` yield
|
|
4
|
+
* valid JS/TS identifiers rather than leaking the raw symbol into generated code.
|
|
5
|
+
*/
|
|
6
|
+
export declare const camelCase: (str: string) => string;
|
|
1
7
|
export declare const toClassName: (str?: string) => string;
|
|
2
8
|
export declare const toKebabCase: (str?: string) => string;
|
|
3
9
|
export declare const toSnakeCase: (str?: string) => string;
|
package/src/utils/names.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/ import
|
|
4
|
+
*/ import lodashCamelCase from "lodash.camelcase";
|
|
5
5
|
import deburr from "lodash.deburr";
|
|
6
|
+
/**
|
|
7
|
+
* camelCase that first transliterates accents and strips any character that is
|
|
8
|
+
* not a valid identifier character, so inputs like `getFoo≠Bar` or `café` yield
|
|
9
|
+
* valid JS/TS identifiers rather than leaking the raw symbol into generated code.
|
|
10
|
+
*/ export const camelCase = (str)=>lodashCamelCase(deburr(str ?? '').replace(/[^a-zA-Z0-9]+/g, ' '));
|
|
6
11
|
export const toClassName = (str)=>{
|
|
7
12
|
if (!str) {
|
|
8
13
|
return str;
|
package/src/utils/names.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../packages/nx-plugin/src/utils/names.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/nx-plugin/src/utils/names.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport lodashCamelCase from 'lodash.camelcase';\nimport deburr from 'lodash.deburr';\n\n/**\n * camelCase that first transliterates accents and strips any character that is\n * not a valid identifier character, so inputs like `getFoo≠Bar` or `café` yield\n * valid JS/TS identifiers rather than leaking the raw symbol into generated code.\n */\nexport const camelCase = (str: string): string =>\n lodashCamelCase(deburr(str ?? '').replace(/[^a-zA-Z0-9]+/g, ' '));\n\nexport const toClassName = (str?: string): string => {\n if (!str) {\n return str;\n }\n const words = str.replace(/[^a-zA-Z0-9]/g, ' ').split(/\\s+/);\n return words\n .map((word, index) => {\n if (index === 0 && /^\\d/.test(word)) {\n return '_' + word;\n }\n return word.charAt(0).toUpperCase() + word.slice(1);\n })\n .join('');\n};\n\nexport const toKebabCase = (str?: string): string =>\n str?.split('/').map(kebabCase).join('/');\n\nexport const toSnakeCase = (str?: string): string =>\n str?.split('/').map(snakeCase).join('/');\n\nexport const upperFirst = (str: string): string =>\n str.charAt(0).toUpperCase() + str.slice(1);\n\nexport const pascalCase = (str: string): string => upperFirst(camelCase(str));\n\nexport const snakeCase = (str: string): string => {\n return (\n deburr(str)\n // Replace series of special characters with underscores\n .replace(/[^a-zA-Z0-9]+/g, '_')\n // Replace capital letters preceded by lowercase or numbers with underscore + lowercase\n .replace(/([a-z0-9])([A-Z])/g, '$1_$2')\n // Convert to lowercase\n .toLowerCase()\n // Remove leading/trailing underscores\n .replace(/^_+|_+$/g, '')\n );\n};\n\nexport const kebabCase = (str: string): string => {\n return (\n deburr(str)\n // Replace series of special characters with hyphens\n .replace(/[^a-zA-Z0-9]+/g, '-')\n // Replace capital letters preceded by lowercase or numbers with hyphen + lowercase\n .replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n // Convert to lowercase\n .toLowerCase()\n // Remove leading/trailing hyphens\n .replace(/^-+|-+$/g, '')\n );\n};\n\n/**\n * Normalise a string to a PEP 503 distribution name.\n *\n * PEP 503 (https://peps.python.org/pep-0503/#normalized-names) defines the\n * canonical form of a Python project distribution name: lower-cased, with any\n * run of `.`, `_` or `-` collapsed to a single `-`. This is the name uv writes\n * into `uv.lock` and the form `@nxlv/python` expects when inferring workspace\n * dependency edges from `[project].dependencies` / `[tool.uv.sources]`.\n *\n * Importantly this is NOT kebab-case: it does not split on camelCase humps,\n * spaces or other punctuation, so a dotted nx id like `scope.my_lib` becomes\n * `scope-my-lib` (and only those three separators are touched).\n *\n * eg. `sojourner.agent_connection` -> `sojourner-agent-connection`\n */\nexport const normalizeDistributionName = (str: string): string =>\n str.toLowerCase().replace(/[._-]+/g, '-');\n\n// Convert a string to a dot notation string (eg. lambda_handler/my_handler.py -> lambda_handler.my_handler)\nexport const toDotNotation = (str: string): string =>\n str\n ?.replace(/^\\/|\\/$/g, '') // Remove leading/trailing slashes\n .replace(/\\.[^/.]+$/g, '') // Remove any file extensions\n .split('/')\n .filter(Boolean) // Remove empty segments (in case of double slashes)\n .join('.');\n"],"names":["lodashCamelCase","deburr","camelCase","str","replace","toClassName","words","split","map","word","index","test","charAt","toUpperCase","slice","join","toKebabCase","kebabCase","toSnakeCase","snakeCase","upperFirst","pascalCase","toLowerCase","normalizeDistributionName","toDotNotation","filter","Boolean"],"mappings":"AAAA;;;CAGC,GACD,OAAOA,qBAAqB,mBAAmB;AAC/C,OAAOC,YAAY,gBAAgB;AAEnC;;;;CAIC,GACD,OAAO,MAAM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EF;;;;;;;;;;;;;;CAcC,GACD,OAAO,MAAMmB,4BAA4B,CAACpB,MACxCA,IAAImB,WAAW,GAAGlB,OAAO,CAAC,WAAW,KAAK;AAE5C,4GAA4G;AAC5G,OAAO,MAAMoB,gBAAgB,CAACrB,MAC5BA,KACIC,QAAQ,YAAY,IAAI,kCAAkC;KAC3DA,QAAQ,cAAc,IAAI,6BAA6B;KACvDG,MAAM,KACNkB,OAAOC,SAAS,oDAAoD;KACpEX,KAAK,KAAK"}
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -68,9 +68,9 @@ export declare const TS_VERSIONS: {
|
|
|
68
68
|
readonly '@smithy/types': "4.15.0";
|
|
69
69
|
readonly '@vitest/coverage-v8': "4.1.9";
|
|
70
70
|
readonly '@vitest/ui': "4.1.9";
|
|
71
|
-
readonly '@astrojs/react': "
|
|
72
|
-
readonly '@astrojs/starlight': "0.
|
|
73
|
-
readonly astro: "
|
|
71
|
+
readonly '@astrojs/react': "6.0.1";
|
|
72
|
+
readonly '@astrojs/starlight': "0.41.3";
|
|
73
|
+
readonly astro: "7.0.6";
|
|
74
74
|
readonly aws4fetch: "1.0.20";
|
|
75
75
|
readonly 'aws-cdk': "2.1129.0";
|
|
76
76
|
readonly 'aws-cdk-lib': "2.260.0";
|
|
@@ -110,7 +110,7 @@ export declare const TS_VERSIONS: {
|
|
|
110
110
|
readonly rolldown: "1.1.3";
|
|
111
111
|
readonly 'simple-git': "3.36.0";
|
|
112
112
|
readonly 'source-map-support': "0.5.21";
|
|
113
|
-
readonly 'starlight-blog': "0.
|
|
113
|
+
readonly 'starlight-blog': "0.27.0";
|
|
114
114
|
readonly tailwindcss: "4.2.2";
|
|
115
115
|
readonly '@tailwindcss/vite': "4.2.2";
|
|
116
116
|
readonly tsx: "4.22.4";
|
|
@@ -130,7 +130,7 @@ export type ITsDepVersion = keyof typeof TS_VERSIONS;
|
|
|
130
130
|
* Add versions to the given dependencies
|
|
131
131
|
*/
|
|
132
132
|
export declare const withVersions: (deps: ITsDepVersion[]) => {
|
|
133
|
-
[k: string]: "0.3.13" | "0.12.0" | "3.1075.0" | "3.972.48" | "1.0.0-alpha.10" | "2.33.1" | "7.7.0" | "22.2.1" | "10.2.1" | "23.0.1" | "1.11.1" | "1.15.43" | "1.29.0" | "0.19.0" | "0.2.3" | "0.0.57" | "0.3.0" | "1.61.2" | "7.8.2" | "1.7.0" | "1.170.16" | "1.168.18" | "1.167.17" | "1.162.0" | "1.162.2" | "3.0.197" | "1.0.146" | "3.0.1320" | "1.0.61" | "5.101.2" | "11.18.0" | "25.9.4" | "8.10.162" | "2.8.19" | "8.20.0" | "8.18.1" | "5.0.6" | "4.6.2" | "4.5.2" | "4.8.2" | "4.15.0" | "4.1.9" | "
|
|
133
|
+
[k: string]: "0.3.13" | "0.12.0" | "3.1075.0" | "3.972.48" | "1.0.0-alpha.10" | "2.33.1" | "7.7.0" | "22.2.1" | "10.2.1" | "23.0.1" | "1.11.1" | "1.15.43" | "1.29.0" | "0.19.0" | "0.2.3" | "0.0.57" | "0.3.0" | "1.61.2" | "7.8.2" | "1.7.0" | "1.170.16" | "1.168.18" | "1.167.17" | "1.162.0" | "1.162.2" | "3.0.197" | "1.0.146" | "3.0.1320" | "1.0.61" | "5.101.2" | "11.18.0" | "25.9.4" | "8.10.162" | "2.8.19" | "8.20.0" | "8.18.1" | "5.0.6" | "4.6.2" | "4.5.2" | "4.8.2" | "4.15.0" | "4.1.9" | "6.0.1" | "0.41.3" | "7.0.6" | "1.0.20" | "2.1129.0" | "2.260.0" | "3.12.0" | "10.6.0" | "2.8.6" | "5.6.2" | "0.7.1" | "2.1.1" | "14.0.3" | "3.9.1" | "0.28.1" | "1.0.31" | "1.0.5" | "2.5.1" | "7.8.0" | "3.1.5" | "5.2.1" | "3.3.3" | "9.1.7" | "11.3.5" | "11.0.4" | "4.0.0" | "3.5.3" | "2.0.0" | "19.6.6" | "3.5.0" | "8.22.0" | "3.3.1" | "19.2.7" | "6.1.3" | "1.1.3" | "3.36.0" | "0.5.21" | "0.27.0" | "4.2.2" | "4.22.4" | "1.22.0" | "1.6.0" | "4.12.0" | "1.4.0" | "3.6.0" | "8.1.0" | "6.0.3" | "4.4.3" | "8.21.0";
|
|
134
134
|
};
|
|
135
135
|
/**
|
|
136
136
|
* Versions for Python dependencies added by generators
|
package/src/utils/versions.js
CHANGED
|
@@ -66,9 +66,9 @@
|
|
|
66
66
|
'@smithy/types': '4.15.0',
|
|
67
67
|
'@vitest/coverage-v8': '4.1.9',
|
|
68
68
|
'@vitest/ui': '4.1.9',
|
|
69
|
-
'@astrojs/react': '
|
|
70
|
-
'@astrojs/starlight': '0.
|
|
71
|
-
astro: '
|
|
69
|
+
'@astrojs/react': '6.0.1',
|
|
70
|
+
'@astrojs/starlight': '0.41.3',
|
|
71
|
+
astro: '7.0.6',
|
|
72
72
|
aws4fetch: '1.0.20',
|
|
73
73
|
'aws-cdk': '2.1129.0',
|
|
74
74
|
'aws-cdk-lib': '2.260.0',
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
rolldown: '1.1.3',
|
|
109
109
|
'simple-git': '3.36.0',
|
|
110
110
|
'source-map-support': '0.5.21',
|
|
111
|
-
'starlight-blog': '0.
|
|
111
|
+
'starlight-blog': '0.27.0',
|
|
112
112
|
tailwindcss: '4.2.2',
|
|
113
113
|
'@tailwindcss/vite': '4.2.2',
|
|
114
114
|
tsx: '4.22.4',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../packages/nx-plugin/src/utils/versions.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Versons for TypeScript dependencies added by generators\n */\nexport const TS_VERSIONS = {\n '@a2a-js/sdk': '0.3.13',\n '@aws/aws-distro-opentelemetry-node-autoinstrumentation': '0.12.0',\n '@aws-sdk/client-dynamodb': '3.1075.0',\n '@aws-sdk/client-bedrock-runtime': '3.1075.0',\n '@aws-sdk/client-s3': '3.1075.0',\n '@aws-sdk/client-sts': '3.1075.0',\n '@aws-sdk/credential-providers': '3.1075.0',\n '@aws-sdk/credential-provider-cognito-identity': '3.972.48',\n '@aws-sdk/client-secrets-manager': '3.1075.0',\n '@aws-sdk/rds-signer': '3.1075.0',\n '@aws-smithy/server-apigateway': '1.0.0-alpha.10',\n '@aws-smithy/server-node': '1.0.0-alpha.10',\n '@aws-lambda-powertools/logger': '2.33.1',\n '@aws-lambda-powertools/metrics': '2.33.1',\n '@aws-lambda-powertools/parameters': '2.33.1',\n '@aws-lambda-powertools/tracer': '2.33.1',\n '@aws-lambda-powertools/parser': '2.33.1',\n '@aws-sdk/client-appconfigdata': '3.1075.0',\n '@middy/core': '7.7.0',\n '@nxlv/python': '22.2.1',\n '@nx-extend/terraform': '10.2.1',\n '@nx/devkit': '23.0.1',\n '@nx/react': '23.0.1',\n 'create-nx-workspace': '23.0.1',\n '@swc-node/register': '1.11.1',\n '@swc/core': '1.15.43',\n '@modelcontextprotocol/sdk': '1.29.0',\n '@modelcontextprotocol/inspector': '0.19.0',\n '@ag-ui/aws-strands': '0.2.3',\n '@ag-ui/client': '0.0.57',\n '@ag-ui/core': '0.0.57',\n '@ag-ui/encoder': '0.0.57',\n 'agent-chat-cli': '0.3.0',\n '@copilotkit/react-core': '1.61.2',\n rxjs: '7.8.2',\n '@strands-agents/sdk': '1.7.0',\n '@tanstack/react-router': '1.170.16',\n '@tanstack/router-plugin': '1.168.18',\n '@tanstack/router-generator': '1.167.17',\n '@tanstack/virtual-file-routes': '1.162.0',\n '@tanstack/router-utils': '1.162.2',\n '@cloudscape-design/board-components': '3.0.197',\n '@cloudscape-design/chat-components': '1.0.146',\n '@cloudscape-design/components': '3.0.1320',\n '@cloudscape-design/global-styles': '1.0.61',\n '@tanstack/react-query': '5.101.2',\n '@tanstack/react-query-devtools': '5.101.2',\n '@trpc/tanstack-react-query': '11.18.0',\n '@trpc/client': '11.18.0',\n '@trpc/server': '11.18.0',\n '@types/node': '25.9.4',\n '@types/aws-lambda': '8.10.162',\n '@types/cors': '2.8.19',\n '@types/pg': '8.20.0',\n '@types/ws': '8.18.1',\n '@types/express': '5.0.6',\n '@smithy/config-resolver': '4.6.2',\n '@smithy/node-config-provider': '4.5.2',\n '@smithy/node-http-handler': '4.8.2',\n '@smithy/types': '4.15.0',\n '@vitest/coverage-v8': '4.1.9',\n '@vitest/ui': '4.1.9',\n '@astrojs/react': '
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/nx-plugin/src/utils/versions.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Versons for TypeScript dependencies added by generators\n */\nexport const TS_VERSIONS = {\n '@a2a-js/sdk': '0.3.13',\n '@aws/aws-distro-opentelemetry-node-autoinstrumentation': '0.12.0',\n '@aws-sdk/client-dynamodb': '3.1075.0',\n '@aws-sdk/client-bedrock-runtime': '3.1075.0',\n '@aws-sdk/client-s3': '3.1075.0',\n '@aws-sdk/client-sts': '3.1075.0',\n '@aws-sdk/credential-providers': '3.1075.0',\n '@aws-sdk/credential-provider-cognito-identity': '3.972.48',\n '@aws-sdk/client-secrets-manager': '3.1075.0',\n '@aws-sdk/rds-signer': '3.1075.0',\n '@aws-smithy/server-apigateway': '1.0.0-alpha.10',\n '@aws-smithy/server-node': '1.0.0-alpha.10',\n '@aws-lambda-powertools/logger': '2.33.1',\n '@aws-lambda-powertools/metrics': '2.33.1',\n '@aws-lambda-powertools/parameters': '2.33.1',\n '@aws-lambda-powertools/tracer': '2.33.1',\n '@aws-lambda-powertools/parser': '2.33.1',\n '@aws-sdk/client-appconfigdata': '3.1075.0',\n '@middy/core': '7.7.0',\n '@nxlv/python': '22.2.1',\n '@nx-extend/terraform': '10.2.1',\n '@nx/devkit': '23.0.1',\n '@nx/react': '23.0.1',\n 'create-nx-workspace': '23.0.1',\n '@swc-node/register': '1.11.1',\n '@swc/core': '1.15.43',\n '@modelcontextprotocol/sdk': '1.29.0',\n '@modelcontextprotocol/inspector': '0.19.0',\n '@ag-ui/aws-strands': '0.2.3',\n '@ag-ui/client': '0.0.57',\n '@ag-ui/core': '0.0.57',\n '@ag-ui/encoder': '0.0.57',\n 'agent-chat-cli': '0.3.0',\n '@copilotkit/react-core': '1.61.2',\n rxjs: '7.8.2',\n '@strands-agents/sdk': '1.7.0',\n '@tanstack/react-router': '1.170.16',\n '@tanstack/router-plugin': '1.168.18',\n '@tanstack/router-generator': '1.167.17',\n '@tanstack/virtual-file-routes': '1.162.0',\n '@tanstack/router-utils': '1.162.2',\n '@cloudscape-design/board-components': '3.0.197',\n '@cloudscape-design/chat-components': '1.0.146',\n '@cloudscape-design/components': '3.0.1320',\n '@cloudscape-design/global-styles': '1.0.61',\n '@tanstack/react-query': '5.101.2',\n '@tanstack/react-query-devtools': '5.101.2',\n '@trpc/tanstack-react-query': '11.18.0',\n '@trpc/client': '11.18.0',\n '@trpc/server': '11.18.0',\n '@types/node': '25.9.4',\n '@types/aws-lambda': '8.10.162',\n '@types/cors': '2.8.19',\n '@types/pg': '8.20.0',\n '@types/ws': '8.18.1',\n '@types/express': '5.0.6',\n '@smithy/config-resolver': '4.6.2',\n '@smithy/node-config-provider': '4.5.2',\n '@smithy/node-http-handler': '4.8.2',\n '@smithy/types': '4.15.0',\n '@vitest/coverage-v8': '4.1.9',\n '@vitest/ui': '4.1.9',\n '@astrojs/react': '6.0.1',\n '@astrojs/starlight': '0.41.3',\n astro: '7.0.6',\n aws4fetch: '1.0.20',\n 'aws-cdk': '2.1129.0',\n 'aws-cdk-lib': '2.260.0',\n 'aws-xray-sdk-core': '3.12.0',\n constructs: '10.6.0',\n cors: '2.8.6',\n chalk: '5.6.2',\n 'class-variance-authority': '0.7.1',\n clsx: '2.1.1',\n commander: '14.0.3',\n electrodb: '3.9.1',\n esbuild: '0.28.1',\n 'event-source-polyfill': '1.0.31',\n '@types/event-source-polyfill': '1.0.5',\n '@biomejs/biome': '2.5.1',\n '@prisma/adapter-mariadb': '7.8.0',\n '@prisma/adapter-pg': '7.8.0',\n '@prisma/client': '7.8.0',\n ejs: '6.0.1',\n '@types/ejs': '3.1.5',\n express: '5.2.1',\n 'fast-glob': '3.3.3',\n husky: '9.1.7',\n 'fs-extra': '11.3.5',\n '@types/fs-extra': '11.0.4',\n 'make-dir-cli': '4.0.0',\n mariadb: '3.5.3',\n ncp: '2.0.0',\n 'npm-check-updates': '19.6.6',\n 'oidc-client-ts': '3.5.0',\n pg: '8.22.0',\n prisma: '7.8.0',\n 'react-oidc-context': '3.3.1',\n react: '19.2.7',\n 'react-dom': '19.2.7',\n rimraf: '6.1.3',\n rolldown: '1.1.3',\n 'simple-git': '3.36.0',\n 'source-map-support': '0.5.21',\n 'starlight-blog': '0.27.0',\n tailwindcss: '4.2.2',\n '@tailwindcss/vite': '4.2.2',\n tsx: '4.22.4',\n 'lucide-react': '1.22.0',\n 'radix-ui': '1.6.0',\n shadcn: '4.12.0',\n 'tw-animate-css': '1.4.0',\n 'tailwind-merge': '3.6.0',\n vite: '8.1.0',\n typescript: '6.0.3',\n vitest: '4.1.9',\n zod: '4.4.3',\n ws: '8.21.0',\n} as const;\nexport type ITsDepVersion = keyof typeof TS_VERSIONS;\n\n/**\n * Add versions to the given dependencies\n */\nexport const withVersions = (deps: ITsDepVersion[]) =>\n Object.fromEntries(deps.map((dep) => [dep, TS_VERSIONS[dep]]));\n\n/**\n * Versions for Python dependencies added by generators\n */\nexport const PY_VERSIONS = {\n 'a2a-sdk': '==0.3.26',\n 'ag-ui-langgraph': '==0.0.42',\n 'ag-ui-protocol': '==0.1.19',\n 'ag-ui-strands': '==0.2.2',\n 'aws-lambda-powertools': '==3.31.0',\n 'aws-lambda-powertools[tracer]': '==3.31.0',\n 'aws-lambda-powertools[parser]': '==3.31.0',\n 'aws-opentelemetry-distro': '==0.18.0',\n 'bedrock-agentcore': '==1.15.1',\n boto3: '==1.43.37',\n checkov: '==3.3.6',\n fastapi: '==0.138.2',\n 'fastapi[standard]': '==0.138.2',\n httpx: '==0.28.1',\n langchain: '==1.3.11',\n 'langchain-aws': '==1.6.1',\n 'langchain-mcp-adapters': '==0.3.0',\n langgraph: '==1.2.7',\n mcp: '==1.28.1',\n 'pip-check-updates': '==0.29.0',\n 'pip-licenses': '==5.5.5',\n 'strands-agents': '==1.45.0',\n 'strands-agents[a2a]': '==1.45.0',\n 'strands-agents-tools': '==0.8.2',\n ty: '==0.0.55',\n pynamodb: '==6.1.0',\n uvicorn: '==0.49.0',\n} as const;\nexport type IPyDepVersion = keyof typeof PY_VERSIONS;\n\n/**\n * Add versions to the given dependencies\n */\nexport const withPyVersions = (deps: IPyDepVersion[]) =>\n deps.map((dep) => `${dep}${PY_VERSIONS[dep]}`);\n\n/**\n * Versions for vendored tools\n */\nexport const VENDORED_VERSIONS = {\n 'git-secrets': '1.3.0',\n} as const;\n\n/**\n * Exact versions for Terraform providers used by generated `.tf` modules.\n * Pinned exactly (no range operator) so generated infrastructure is reproducible.\n */\nexport const TERRAFORM_VERSIONS = {\n aws: '6.52.0',\n random: '3.9.0',\n null: '3.3.0',\n archive: '2.8.0',\n external: '2.4.0',\n local: '2.9.0',\n} as const;\nexport type ITerraformProviderVersion = keyof typeof TERRAFORM_VERSIONS;\n\n/**\n * Substitution variables exposing Terraform provider version constraints to\n * generated `.tf` templates (e.g. `version = \"<%- awsProviderVersion %>\"`)\n */\nexport const terraformProviderVersions = () => ({\n awsProviderVersion: TERRAFORM_VERSIONS.aws,\n randomProviderVersion: TERRAFORM_VERSIONS.random,\n nullProviderVersion: TERRAFORM_VERSIONS.null,\n archiveProviderVersion: TERRAFORM_VERSIONS.archive,\n externalProviderVersion: TERRAFORM_VERSIONS.external,\n localProviderVersion: TERRAFORM_VERSIONS.local,\n});\n"],"names":["TS_VERSIONS","rxjs","astro","aws4fetch","constructs","cors","chalk","clsx","commander","electrodb","esbuild","ejs","express","husky","mariadb","ncp","pg","prisma","react","rimraf","rolldown","tailwindcss","tsx","shadcn","vite","typescript","vitest","zod","ws","withVersions","deps","Object","fromEntries","map","dep","PY_VERSIONS","boto3","checkov","fastapi","httpx","langchain","langgraph","mcp","ty","pynamodb","uvicorn","withPyVersions","VENDORED_VERSIONS","TERRAFORM_VERSIONS","aws","random","null","archive","external","local","terraformProviderVersions","awsProviderVersion","randomProviderVersion","nullProviderVersion","archiveProviderVersion","externalProviderVersion","localProviderVersion"],"mappings":"AAAA;;;CAGC,GAED;;CAEC,GACD,OAAO,MAAMA,cAAc;IACzB,eAAe;IACf,0DAA0D;IAC1D,4BAA4B;IAC5B,mCAAmC;IACnC,sBAAsB;IACtB,uBAAuB;IACvB,iCAAiC;IACjC,iDAAiD;IACjD,mCAAmC;IACnC,uBAAuB;IACvB,iCAAiC;IACjC,2BAA2B;IAC3B,iCAAiC;IACjC,kCAAkC;IAClC,qCAAqC;IACrC,iCAAiC;IACjC,iCAAiC;IACjC,iCAAiC;IACjC,eAAe;IACf,gBAAgB;IAChB,wBAAwB;IACxB,cAAc;IACd,aAAa;IACb,uBAAuB;IACvB,sBAAsB;IACtB,aAAa;IACb,6BAA6B;IAC7B,mCAAmC;IACnC,sBAAsB;IACtB,iBAAiB;IACjB,eAAe;IACf,kBAAkB;IAClB,kBAAkB;IAClB,0BAA0B;IAC1BC,MAAM;IACN,uBAAuB;IACvB,0BAA0B;IAC1B,2BAA2B;IAC3B,8BAA8B;IAC9B,iCAAiC;IACjC,0BAA0B;IAC1B,uCAAuC;IACvC,sCAAsC;IACtC,iCAAiC;IACjC,oCAAoC;IACpC,yBAAyB;IACzB,kCAAkC;IAClC,8BAA8B;IAC9B,gBAAgB;IAChB,gBAAgB;IAChB,eAAe;IACf,qBAAqB;IACrB,eAAe;IACf,aAAa;IACb,aAAa;IACb,kBAAkB;IAClB,2BAA2B;IAC3B,gCAAgC;IAChC,6BAA6B;IAC7B,iBAAiB;IACjB,uBAAuB;IACvB,cAAc;IACd,kBAAkB;IAClB,sBAAsB;IACtBC,OAAO;I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