@aws/nx-plugin 1.0.0-rc.45 → 1.0.0-rc.46
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 +8 -8
- package/package.json +1 -1
- package/src/py/rdb/__snapshots__/generator.spec.ts.snap +1 -0
- package/src/py/rdb/generator.js +5 -0
- package/src/py/rdb/generator.js.map +1 -1
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +9 -0
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.spec.ts.snap +11 -6
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +12 -2
- package/src/utils/identity-constructs/files/cdk/core/user-identity.ts.template +11 -6
- package/src/utils/identity-constructs/identity-constructs.js +14 -3
- package/src/utils/identity-constructs/identity-constructs.js.map +1 -1
- package/src/utils/versions.d.ts +1 -0
- package/src/utils/versions.js +5 -1
- package/src/utils/versions.js.map +1 -1
- package/src/utils/website-constructs/files/cdk/core/static-website.ts.template +3 -0
package/generators.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"factory": "./src/init/generator",
|
|
8
8
|
"schema": "./src/init/schema.json",
|
|
9
9
|
"description": "Configure an existing Nx workspace to use the @aws/nx-plugin",
|
|
10
|
-
"metric": "
|
|
10
|
+
"metric": "g66",
|
|
11
11
|
"guidePages": ["existing-project"]
|
|
12
12
|
},
|
|
13
13
|
"agentcore-gateway": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"factory": "./src/agentcore-gateway/gateway-connection/generator",
|
|
28
28
|
"schema": "./src/agentcore-gateway/gateway-connection/schema.json",
|
|
29
29
|
"description": "Connect an AgentCore Gateway to another AgentCore Gateway",
|
|
30
|
-
"metric": "
|
|
30
|
+
"metric": "g65",
|
|
31
31
|
"hidden": true
|
|
32
32
|
},
|
|
33
33
|
"connection": {
|
|
@@ -215,7 +215,7 @@
|
|
|
215
215
|
"factory": "./src/ts/dcr-proxy/generator",
|
|
216
216
|
"schema": "./src/ts/dcr-proxy/schema.json",
|
|
217
217
|
"description": "Generate an OAuth Dynamic Client Registration (DCR) proxy construct for Cognito-authenticated MCP servers",
|
|
218
|
-
"metric": "
|
|
218
|
+
"metric": "g67"
|
|
219
219
|
},
|
|
220
220
|
"ts#mcp-server": {
|
|
221
221
|
"factory": "./src/ts/mcp-server/generator",
|
|
@@ -248,7 +248,7 @@
|
|
|
248
248
|
"factory": "./src/ts/website/app/generator",
|
|
249
249
|
"schema": "./src/ts/website/app/schema.json",
|
|
250
250
|
"description": "Generates a website application",
|
|
251
|
-
"metric": "
|
|
251
|
+
"metric": "g60",
|
|
252
252
|
"guidePages": ["website", "react-website"]
|
|
253
253
|
},
|
|
254
254
|
"ts#website#auth": {
|
|
@@ -405,27 +405,27 @@
|
|
|
405
405
|
"factory": "./src/ts/dynamodb/generator",
|
|
406
406
|
"schema": "./src/ts/dynamodb/schema.json",
|
|
407
407
|
"description": "Create a TypeScript DynamoDB project",
|
|
408
|
-
"metric": "
|
|
408
|
+
"metric": "g61"
|
|
409
409
|
},
|
|
410
410
|
"ts#dynamodb#trpc-connection": {
|
|
411
411
|
"factory": "./src/ts/dynamodb/trpc-connection/generator",
|
|
412
412
|
"schema": "./src/ts/dynamodb/trpc-connection/schema.json",
|
|
413
413
|
"description": "Connect a ts#trpc-api project to a ts#dynamodb project",
|
|
414
|
-
"metric": "
|
|
414
|
+
"metric": "g62",
|
|
415
415
|
"hidden": true
|
|
416
416
|
},
|
|
417
417
|
"ts#dynamodb#smithy-connection": {
|
|
418
418
|
"factory": "./src/ts/dynamodb/smithy-connection/generator",
|
|
419
419
|
"schema": "./src/ts/dynamodb/smithy-connection/schema.json",
|
|
420
420
|
"description": "Connect a Smithy backend to a ts#dynamodb project",
|
|
421
|
-
"metric": "
|
|
421
|
+
"metric": "g63",
|
|
422
422
|
"hidden": true
|
|
423
423
|
},
|
|
424
424
|
"ts#dynamodb#agent-connection": {
|
|
425
425
|
"factory": "./src/ts/dynamodb/agent-connection/generator",
|
|
426
426
|
"schema": "./src/ts/dynamodb/agent-connection/schema.json",
|
|
427
427
|
"description": "Connect a ts#agent to a ts#dynamodb project",
|
|
428
|
-
"metric": "
|
|
428
|
+
"metric": "g64",
|
|
429
429
|
"hidden": true
|
|
430
430
|
},
|
|
431
431
|
"ts#dynamodb#mcp-server-connection": {
|
package/package.json
CHANGED
package/src/py/rdb/generator.js
CHANGED
|
@@ -248,6 +248,11 @@ export const pyRdbGenerator = async (tree, options)=>{
|
|
|
248
248
|
addDependenciesToPyProjectToml(tree, dir, [
|
|
249
249
|
'sqlmodel',
|
|
250
250
|
'alembic',
|
|
251
|
+
// SQLAlchemy's async engine (used by connection.py for both engines)
|
|
252
|
+
// requires greenlet at runtime. Vend it explicitly at a pinned version so
|
|
253
|
+
// the dependency graph is fully determined and doesn't float to an
|
|
254
|
+
// unpublished-wheel release at install time.
|
|
255
|
+
'greenlet',
|
|
251
256
|
...engine === 'mysql' ? [
|
|
252
257
|
'aiomysql',
|
|
253
258
|
'boto3',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/py/rdb/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { relative } from 'node:path';\nimport {\n addDependenciesToPackageJson,\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n readProjectConfiguration,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { addPythonBundleTarget } from '../../utils/bundle/bundle';\nimport { resolveContainers } from '../../utils/containers';\nimport { addDockerScanTarget } from '../../utils/docker';\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, snakeCase, toClassName } from '../../utils/names';\nimport { getNpmScope } from '../../utils/npm-scope';\nimport {\n addDependencyToTargetIfNotPresent,\n addGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n projectExists,\n} from '../../utils/nx';\nimport { assignPort } from '../../utils/port';\nimport { addDependenciesToPyProjectToml } from '../../utils/py';\nimport { addRdbInfra } from '../../utils/rdb-constructs/rdb-constructs';\nimport { sharedConstructsGenerator } from '../../utils/shared-constructs';\nimport {\n PACKAGES_DIR,\n SHARED_SCRIPTS_DIR,\n} from '../../utils/shared-constructs-constants';\nimport { sharedRdbScriptsGenerator } from '../../utils/shared-rdb-scripts';\nimport { PY_VERSIONS, withVersions } from '../../utils/versions';\nimport pyProjectGenerator, { getPyProjectDetails } from '../project/generator';\nimport type { PyRdbGeneratorSchema } from './schema';\n\nexport const PY_RDB_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport const pyRdbGenerator = async (\n tree: Tree,\n options: PyRdbGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const nameClassName = toClassName(options.name);\n const databaseUser = options.databaseUser ?? 'dbadmin';\n const databaseName = snakeCase(options.databaseName ?? options.name);\n const containerEngine = await resolveContainers(tree, 'inherit');\n\n const { fullyQualifiedName, dir, normalizedModuleName } = getPyProjectDetails(\n tree,\n {\n name: options.name,\n directory: options.directory,\n subDirectory: options.subDirectory,\n },\n );\n\n if (!projectExists(tree, fullyQualifiedName)) {\n await pyProjectGenerator(tree, {\n name: options.name,\n directory: options.directory,\n subDirectory: options.subDirectory,\n type: 'library',\n });\n }\n\n const projectConfig = readProjectConfiguration(tree, fullyQualifiedName);\n\n const { engine } = options;\n const localDbPort = assignPort(\n tree,\n projectConfig,\n engine === 'mysql' ? 3306 : 5432,\n );\n const localDbHost = 'localhost';\n const localDbUser = engine === 'mysql' ? 'root' : 'dbadmin';\n const localDbPassword = 'password';\n const containerName = `${getNpmScope(tree)}-${databaseName}`;\n const dockerImage =\n engine === 'mysql'\n ? 'public.ecr.aws/docker/library/mysql:8.0.44'\n : 'public.ecr.aws/docker/library/postgres:17.7';\n\n const templateOptions = {\n name: normalizedModuleName,\n runtimeConfigKey: nameClassName,\n engine,\n localDbPort,\n localDbHost,\n localDbName: databaseName,\n localDbUser,\n localDbPassword,\n containerEngine,\n containerName,\n dockerImage,\n sqlmodelVersion: PY_VERSIONS.sqlmodel,\n alembicVersion: PY_VERSIONS.alembic,\n aiomysqlVersion: PY_VERSIONS.aiomysql,\n asyncpgVersion: PY_VERSIONS.asyncpg,\n boto3Version: PY_VERSIONS.boto3,\n awsLambdaPowertoolsVersion: PY_VERSIONS['aws-lambda-powertools'],\n };\n\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files'),\n dir,\n templateOptions,\n );\n\n await sharedRdbScriptsGenerator(tree, engine);\n // Used by local dev script wait-for-*-db.ts\n addDependenciesToPackageJson(\n tree,\n withVersions([engine === 'mysql' ? 'mariadb' : 'pg']),\n engine === 'mysql' ? {} : withVersions(['@types/pg']),\n );\n const scriptsDir = relative(\n dir,\n joinPathFragments(PACKAGES_DIR, SHARED_SCRIPTS_DIR, 'src', 'rdb'),\n );\n const fs = new FsCommands(tree);\n\n const migrationBundleDir = joinPathFragments(\n 'dist',\n projectConfig.root,\n 'docker',\n 'migration',\n );\n const createDbUserBundleDir = joinPathFragments(\n 'dist',\n projectConfig.root,\n 'docker',\n 'create-db-user',\n );\n const migrationDockerImageTag = `${getNpmScope(tree)}-${kebabCase(options.name)}-migration:latest`;\n const createDbUserDockerImageTag = `${getNpmScope(tree)}-${kebabCase(\n options.name,\n )}-create-db-user:latest`;\n\n if (options.infra !== 'none') {\n const { bundleTargetName, bundleOutputDir } = addPythonBundleTarget(\n projectConfig,\n { pythonPlatform: 'aarch64-manylinux_2_28' },\n );\n\n projectConfig.targets['bundle-migration'] = {\n cache: true,\n outputs: ['{workspaceRoot}/dist/{projectRoot}/docker/migration'],\n executor: 'nx:run-commands',\n options: {\n commands: [\n fs.rm(migrationBundleDir),\n fs.mkdir(migrationBundleDir),\n fs.cp(bundleOutputDir, migrationBundleDir),\n fs.cp(\n joinPathFragments(dir, 'migrations'),\n joinPathFragments(migrationBundleDir, 'migrations'),\n ),\n fs.cp(\n joinPathFragments(dir, 'alembic.ini'),\n joinPathFragments(migrationBundleDir, 'alembic.ini'),\n ),\n fs.cp(\n joinPathFragments(dir, 'Dockerfile.migration'),\n joinPathFragments(migrationBundleDir, 'Dockerfile'),\n ),\n ],\n parallel: false,\n },\n dependsOn: [bundleTargetName],\n };\n projectConfig.targets['bundle-create-db-user'] = {\n cache: true,\n outputs: ['{workspaceRoot}/dist/{projectRoot}/docker/create-db-user'],\n executor: 'nx:run-commands',\n options: {\n commands: [\n fs.rm(createDbUserBundleDir),\n fs.mkdir(createDbUserBundleDir),\n fs.cp(bundleOutputDir, createDbUserBundleDir),\n fs.cp(\n joinPathFragments(dir, 'Dockerfile.create-db-user'),\n joinPathFragments(createDbUserBundleDir, 'Dockerfile'),\n ),\n ],\n parallel: false,\n },\n dependsOn: [bundleTargetName],\n };\n addDependencyToTargetIfNotPresent(\n projectConfig,\n 'bundle',\n 'bundle-migration',\n );\n addDependencyToTargetIfNotPresent(\n projectConfig,\n 'bundle',\n 'bundle-create-db-user',\n );\n }\n\n projectConfig.targets['pull-image'] = {\n executor: 'nx:run-commands',\n options: {\n command: `tsx ${scriptsDir}/pull-image.ts`,\n cwd: '{projectRoot}',\n },\n };\n projectConfig.targets['dev'] = {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n command: `tsx ${scriptsDir}/start-container.ts`,\n cwd: '{projectRoot}',\n },\n dependsOn: ['pull-image'],\n };\n projectConfig.targets['wait-for-db'] = {\n executor: 'nx:run-commands',\n dependsOn: ['dev'],\n options: {\n command: `tsx ${scriptsDir}/wait-for-${engine}-db.ts`,\n cwd: '{projectRoot}',\n },\n };\n projectConfig.targets.migrate = {\n executor: 'nx:run-commands',\n dependsOn: ['dev', 'wait-for-db'],\n options: {\n command: 'uv run alembic upgrade head',\n cwd: '{projectRoot}',\n env: {\n LOCAL_DEV: 'true',\n },\n },\n };\n projectConfig.targets.alembic = {\n executor: 'nx:run-commands',\n dependsOn: ['dev', 'wait-for-db'],\n options: {\n command: 'uv run alembic',\n cwd: '{projectRoot}',\n env: {\n LOCAL_DEV: 'true',\n },\n },\n };\n\n if (options.infra !== 'none') {\n const iac = await resolveIac(tree, options.iac);\n if (iac === 'terraform') {\n projectConfig.targets.docker = {\n cache: true,\n executor: 'nx:run-commands',\n options: {\n commands: [\n `${containerEngine} build --platform linux/arm64 --provenance=false -t ${migrationDockerImageTag} ${migrationBundleDir}`,\n `${containerEngine} build --platform linux/arm64 --provenance=false -t ${createDbUserDockerImageTag} ${createDbUserBundleDir}`,\n ],\n parallel: false,\n },\n dependsOn: ['bundle-migration', 'bundle-create-db-user'],\n };\n addDependencyToTargetIfNotPresent(projectConfig, 'build', 'docker');\n\n addDockerScanTarget(tree, {\n project: projectConfig,\n containerEngine,\n trivyTargetName: 'trivy',\n dockerTargetName: 'docker',\n imageTags: [migrationDockerImageTag, createDbUserDockerImageTag],\n });\n }\n addDependencyToTargetIfNotPresent(\n projectConfig,\n 'build',\n 'bundle-migration',\n );\n addDependencyToTargetIfNotPresent(\n projectConfig,\n 'build',\n 'bundle-create-db-user',\n );\n }\n\n updateProjectConfiguration(tree, fullyQualifiedName, projectConfig);\n addGeneratorMetadata(tree, fullyQualifiedName, PY_RDB_GENERATOR_INFO, {\n engine,\n });\n\n if (options.infra !== 'none') {\n const iac = await resolveIac(tree, options.iac);\n await sharedConstructsGenerator(tree, { iac });\n await addRdbInfra(tree, {\n iac,\n projectName: fullyQualifiedName,\n projectRoot: dir,\n nameClassName,\n nameKebabCase: kebabCase(options.name),\n databasePackageAlias: normalizedModuleName,\n databaseName,\n adminUser: databaseUser,\n engine,\n migrationBundleDir,\n createDbUserBundleDir,\n framework: 'sqlmodel',\n createDbUserDockerImageTag,\n migrationDockerImageTag,\n containerEngine,\n });\n }\n\n addDependenciesToPyProjectToml(tree, dir, [\n 'sqlmodel',\n 'alembic',\n ...(engine === 'mysql'\n ? (['aiomysql', 'boto3', 'aws-lambda-powertools'] as const)\n : (['asyncpg', 'boto3', 'aws-lambda-powertools'] as const)),\n ]);\n\n await addGeneratorMetricsIfApplicable(tree, [PY_RDB_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript', 'python'],\n });\n};\n\nexport default pyRdbGenerator;\n"],"names":["relative","addDependenciesToPackageJson","generateFiles","joinPathFragments","readProjectConfiguration","updateProjectConfiguration","addPythonBundleTarget","resolveContainers","addDockerScanTarget","formatFilesInSubtree","FsCommands","resolveIac","installDependencies","addGeneratorMetricsIfApplicable","kebabCase","snakeCase","toClassName","getNpmScope","addDependencyToTargetIfNotPresent","addGeneratorMetadata","getGeneratorInfo","projectExists","assignPort","addDependenciesToPyProjectToml","addRdbInfra","sharedConstructsGenerator","PACKAGES_DIR","SHARED_SCRIPTS_DIR","sharedRdbScriptsGenerator","PY_VERSIONS","withVersions","pyProjectGenerator","getPyProjectDetails","PY_RDB_GENERATOR_INFO","filename","pyRdbGenerator","tree","options","nameClassName","name","databaseUser","databaseName","containerEngine","fullyQualifiedName","dir","normalizedModuleName","directory","subDirectory","type","projectConfig","engine","localDbPort","localDbHost","localDbUser","localDbPassword","containerName","dockerImage","templateOptions","runtimeConfigKey","localDbName","sqlmodelVersion","sqlmodel","alembicVersion","alembic","aiomysqlVersion","aiomysql","asyncpgVersion","asyncpg","boto3Version","boto3","awsLambdaPowertoolsVersion","dirname","scriptsDir","fs","migrationBundleDir","root","createDbUserBundleDir","migrationDockerImageTag","createDbUserDockerImageTag","infra","bundleTargetName","bundleOutputDir","pythonPlatform","targets","cache","outputs","executor","commands","rm","mkdir","cp","parallel","dependsOn","command","cwd","continuous","migrate","env","LOCAL_DEV","iac","docker","project","trivyTargetName","dockerTargetName","imageTags","projectName","projectRoot","nameKebabCase","databasePackageAlias","adminUser","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BwB,MAAMC,QAAQ0E,yBAAyB,EAAE;YAC3DC,WAAW;gBAAC;gBAAc;aAAS;QACrC;AACJ,EAAE;AAEF,eAAe7E,eAAe"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/py/rdb/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { relative } from 'node:path';\nimport {\n addDependenciesToPackageJson,\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n readProjectConfiguration,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { addPythonBundleTarget } from '../../utils/bundle/bundle';\nimport { resolveContainers } from '../../utils/containers';\nimport { addDockerScanTarget } from '../../utils/docker';\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, snakeCase, toClassName } from '../../utils/names';\nimport { getNpmScope } from '../../utils/npm-scope';\nimport {\n addDependencyToTargetIfNotPresent,\n addGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n projectExists,\n} from '../../utils/nx';\nimport { assignPort } from '../../utils/port';\nimport { addDependenciesToPyProjectToml } from '../../utils/py';\nimport { addRdbInfra } from '../../utils/rdb-constructs/rdb-constructs';\nimport { sharedConstructsGenerator } from '../../utils/shared-constructs';\nimport {\n PACKAGES_DIR,\n SHARED_SCRIPTS_DIR,\n} from '../../utils/shared-constructs-constants';\nimport { sharedRdbScriptsGenerator } from '../../utils/shared-rdb-scripts';\nimport { PY_VERSIONS, withVersions } from '../../utils/versions';\nimport pyProjectGenerator, { getPyProjectDetails } from '../project/generator';\nimport type { PyRdbGeneratorSchema } from './schema';\n\nexport const PY_RDB_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport const pyRdbGenerator = async (\n tree: Tree,\n options: PyRdbGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const nameClassName = toClassName(options.name);\n const databaseUser = options.databaseUser ?? 'dbadmin';\n const databaseName = snakeCase(options.databaseName ?? options.name);\n const containerEngine = await resolveContainers(tree, 'inherit');\n\n const { fullyQualifiedName, dir, normalizedModuleName } = getPyProjectDetails(\n tree,\n {\n name: options.name,\n directory: options.directory,\n subDirectory: options.subDirectory,\n },\n );\n\n if (!projectExists(tree, fullyQualifiedName)) {\n await pyProjectGenerator(tree, {\n name: options.name,\n directory: options.directory,\n subDirectory: options.subDirectory,\n type: 'library',\n });\n }\n\n const projectConfig = readProjectConfiguration(tree, fullyQualifiedName);\n\n const { engine } = options;\n const localDbPort = assignPort(\n tree,\n projectConfig,\n engine === 'mysql' ? 3306 : 5432,\n );\n const localDbHost = 'localhost';\n const localDbUser = engine === 'mysql' ? 'root' : 'dbadmin';\n const localDbPassword = 'password';\n const containerName = `${getNpmScope(tree)}-${databaseName}`;\n const dockerImage =\n engine === 'mysql'\n ? 'public.ecr.aws/docker/library/mysql:8.0.44'\n : 'public.ecr.aws/docker/library/postgres:17.7';\n\n const templateOptions = {\n name: normalizedModuleName,\n runtimeConfigKey: nameClassName,\n engine,\n localDbPort,\n localDbHost,\n localDbName: databaseName,\n localDbUser,\n localDbPassword,\n containerEngine,\n containerName,\n dockerImage,\n sqlmodelVersion: PY_VERSIONS.sqlmodel,\n alembicVersion: PY_VERSIONS.alembic,\n aiomysqlVersion: PY_VERSIONS.aiomysql,\n asyncpgVersion: PY_VERSIONS.asyncpg,\n boto3Version: PY_VERSIONS.boto3,\n awsLambdaPowertoolsVersion: PY_VERSIONS['aws-lambda-powertools'],\n };\n\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files'),\n dir,\n templateOptions,\n );\n\n await sharedRdbScriptsGenerator(tree, engine);\n // Used by local dev script wait-for-*-db.ts\n addDependenciesToPackageJson(\n tree,\n withVersions([engine === 'mysql' ? 'mariadb' : 'pg']),\n engine === 'mysql' ? {} : withVersions(['@types/pg']),\n );\n const scriptsDir = relative(\n dir,\n joinPathFragments(PACKAGES_DIR, SHARED_SCRIPTS_DIR, 'src', 'rdb'),\n );\n const fs = new FsCommands(tree);\n\n const migrationBundleDir = joinPathFragments(\n 'dist',\n projectConfig.root,\n 'docker',\n 'migration',\n );\n const createDbUserBundleDir = joinPathFragments(\n 'dist',\n projectConfig.root,\n 'docker',\n 'create-db-user',\n );\n const migrationDockerImageTag = `${getNpmScope(tree)}-${kebabCase(options.name)}-migration:latest`;\n const createDbUserDockerImageTag = `${getNpmScope(tree)}-${kebabCase(\n options.name,\n )}-create-db-user:latest`;\n\n if (options.infra !== 'none') {\n const { bundleTargetName, bundleOutputDir } = addPythonBundleTarget(\n projectConfig,\n { pythonPlatform: 'aarch64-manylinux_2_28' },\n );\n\n projectConfig.targets['bundle-migration'] = {\n cache: true,\n outputs: ['{workspaceRoot}/dist/{projectRoot}/docker/migration'],\n executor: 'nx:run-commands',\n options: {\n commands: [\n fs.rm(migrationBundleDir),\n fs.mkdir(migrationBundleDir),\n fs.cp(bundleOutputDir, migrationBundleDir),\n fs.cp(\n joinPathFragments(dir, 'migrations'),\n joinPathFragments(migrationBundleDir, 'migrations'),\n ),\n fs.cp(\n joinPathFragments(dir, 'alembic.ini'),\n joinPathFragments(migrationBundleDir, 'alembic.ini'),\n ),\n fs.cp(\n joinPathFragments(dir, 'Dockerfile.migration'),\n joinPathFragments(migrationBundleDir, 'Dockerfile'),\n ),\n ],\n parallel: false,\n },\n dependsOn: [bundleTargetName],\n };\n projectConfig.targets['bundle-create-db-user'] = {\n cache: true,\n outputs: ['{workspaceRoot}/dist/{projectRoot}/docker/create-db-user'],\n executor: 'nx:run-commands',\n options: {\n commands: [\n fs.rm(createDbUserBundleDir),\n fs.mkdir(createDbUserBundleDir),\n fs.cp(bundleOutputDir, createDbUserBundleDir),\n fs.cp(\n joinPathFragments(dir, 'Dockerfile.create-db-user'),\n joinPathFragments(createDbUserBundleDir, 'Dockerfile'),\n ),\n ],\n parallel: false,\n },\n dependsOn: [bundleTargetName],\n };\n addDependencyToTargetIfNotPresent(\n projectConfig,\n 'bundle',\n 'bundle-migration',\n );\n addDependencyToTargetIfNotPresent(\n projectConfig,\n 'bundle',\n 'bundle-create-db-user',\n );\n }\n\n projectConfig.targets['pull-image'] = {\n executor: 'nx:run-commands',\n options: {\n command: `tsx ${scriptsDir}/pull-image.ts`,\n cwd: '{projectRoot}',\n },\n };\n projectConfig.targets['dev'] = {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n command: `tsx ${scriptsDir}/start-container.ts`,\n cwd: '{projectRoot}',\n },\n dependsOn: ['pull-image'],\n };\n projectConfig.targets['wait-for-db'] = {\n executor: 'nx:run-commands',\n dependsOn: ['dev'],\n options: {\n command: `tsx ${scriptsDir}/wait-for-${engine}-db.ts`,\n cwd: '{projectRoot}',\n },\n };\n projectConfig.targets.migrate = {\n executor: 'nx:run-commands',\n dependsOn: ['dev', 'wait-for-db'],\n options: {\n command: 'uv run alembic upgrade head',\n cwd: '{projectRoot}',\n env: {\n LOCAL_DEV: 'true',\n },\n },\n };\n projectConfig.targets.alembic = {\n executor: 'nx:run-commands',\n dependsOn: ['dev', 'wait-for-db'],\n options: {\n command: 'uv run alembic',\n cwd: '{projectRoot}',\n env: {\n LOCAL_DEV: 'true',\n },\n },\n };\n\n if (options.infra !== 'none') {\n const iac = await resolveIac(tree, options.iac);\n if (iac === 'terraform') {\n projectConfig.targets.docker = {\n cache: true,\n executor: 'nx:run-commands',\n options: {\n commands: [\n `${containerEngine} build --platform linux/arm64 --provenance=false -t ${migrationDockerImageTag} ${migrationBundleDir}`,\n `${containerEngine} build --platform linux/arm64 --provenance=false -t ${createDbUserDockerImageTag} ${createDbUserBundleDir}`,\n ],\n parallel: false,\n },\n dependsOn: ['bundle-migration', 'bundle-create-db-user'],\n };\n addDependencyToTargetIfNotPresent(projectConfig, 'build', 'docker');\n\n addDockerScanTarget(tree, {\n project: projectConfig,\n containerEngine,\n trivyTargetName: 'trivy',\n dockerTargetName: 'docker',\n imageTags: [migrationDockerImageTag, createDbUserDockerImageTag],\n });\n }\n addDependencyToTargetIfNotPresent(\n projectConfig,\n 'build',\n 'bundle-migration',\n );\n addDependencyToTargetIfNotPresent(\n projectConfig,\n 'build',\n 'bundle-create-db-user',\n );\n }\n\n updateProjectConfiguration(tree, fullyQualifiedName, projectConfig);\n addGeneratorMetadata(tree, fullyQualifiedName, PY_RDB_GENERATOR_INFO, {\n engine,\n });\n\n if (options.infra !== 'none') {\n const iac = await resolveIac(tree, options.iac);\n await sharedConstructsGenerator(tree, { iac });\n await addRdbInfra(tree, {\n iac,\n projectName: fullyQualifiedName,\n projectRoot: dir,\n nameClassName,\n nameKebabCase: kebabCase(options.name),\n databasePackageAlias: normalizedModuleName,\n databaseName,\n adminUser: databaseUser,\n engine,\n migrationBundleDir,\n createDbUserBundleDir,\n framework: 'sqlmodel',\n createDbUserDockerImageTag,\n migrationDockerImageTag,\n containerEngine,\n });\n }\n\n addDependenciesToPyProjectToml(tree, dir, [\n 'sqlmodel',\n 'alembic',\n // SQLAlchemy's async engine (used by connection.py for both engines)\n // requires greenlet at runtime. Vend it explicitly at a pinned version so\n // the dependency graph is fully determined and doesn't float to an\n // unpublished-wheel release at install time.\n 'greenlet',\n ...(engine === 'mysql'\n ? (['aiomysql', 'boto3', 'aws-lambda-powertools'] as const)\n : (['asyncpg', 'boto3', 'aws-lambda-powertools'] as const)),\n ]);\n\n await addGeneratorMetricsIfApplicable(tree, [PY_RDB_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript', 'python'],\n });\n};\n\nexport default pyRdbGenerator;\n"],"names":["relative","addDependenciesToPackageJson","generateFiles","joinPathFragments","readProjectConfiguration","updateProjectConfiguration","addPythonBundleTarget","resolveContainers","addDockerScanTarget","formatFilesInSubtree","FsCommands","resolveIac","installDependencies","addGeneratorMetricsIfApplicable","kebabCase","snakeCase","toClassName","getNpmScope","addDependencyToTargetIfNotPresent","addGeneratorMetadata","getGeneratorInfo","projectExists","assignPort","addDependenciesToPyProjectToml","addRdbInfra","sharedConstructsGenerator","PACKAGES_DIR","SHARED_SCRIPTS_DIR","sharedRdbScriptsGenerator","PY_VERSIONS","withVersions","pyProjectGenerator","getPyProjectDetails","PY_RDB_GENERATOR_INFO","filename","pyRdbGenerator","tree","options","nameClassName","name","databaseUser","databaseName","containerEngine","fullyQualifiedName","dir","normalizedModuleName","directory","subDirectory","type","projectConfig","engine","localDbPort","localDbHost","localDbUser","localDbPassword","containerName","dockerImage","templateOptions","runtimeConfigKey","localDbName","sqlmodelVersion","sqlmodel","alembicVersion","alembic","aiomysqlVersion","aiomysql","asyncpgVersion","asyncpg","boto3Version","boto3","awsLambdaPowertoolsVersion","dirname","scriptsDir","fs","migrationBundleDir","root","createDbUserBundleDir","migrationDockerImageTag","createDbUserDockerImageTag","infra","bundleTargetName","bundleOutputDir","pythonPlatform","targets","cache","outputs","executor","commands","rm","mkdir","cp","parallel","dependsOn","command","cwd","continuous","migrate","env","LOCAL_DEV","iac","docker","project","trivyTargetName","dockerTargetName","imageTags","projectName","projectRoot","nameKebabCase","databasePackageAlias","adminUser","framework","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,GACD,SAASA,QAAQ,QAAQ,YAAY;AACrC,SACEC,4BAA4B,EAE5BC,aAAa,EACbC,iBAAiB,EACjBC,wBAAwB,EAExBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,qBAAqB,QAAQ,+BAA4B;AAClE,SAASC,iBAAiB,QAAQ,4BAAyB;AAC3D,SAASC,mBAAmB,QAAQ,wBAAqB;AACzD,SAASC,oBAAoB,QAAQ,wBAAqB;AAC1D,SAASC,UAAU,QAAQ,oBAAiB;AAC5C,SAASC,UAAU,QAAQ,qBAAkB;AAC7C,SAASC,mBAAmB,QAAQ,yBAAsB;AAC1D,SAASC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kBAAkB;gBAClBC,WAAW;oBAAC3B;oBAAyBC;iBAA2B;YAClE;QACF;QACA5D,kCACE+B,eACA,SACA;QAEF/B,kCACE+B,eACA,SACA;IAEJ;IAEA5C,2BAA2B+B,MAAMO,oBAAoBM;IACrD9B,qBAAqBiB,MAAMO,oBAAoBV,uBAAuB;QACpEiB;IACF;IAEA,IAAIb,QAAQ0C,KAAK,KAAK,QAAQ;QAC5B,MAAMoB,MAAM,MAAMxF,WAAWyB,MAAMC,QAAQ8D,GAAG;QAC9C,MAAM1E,0BAA0BW,MAAM;YAAE+D;QAAI;QAC5C,MAAM3E,YAAYY,MAAM;YACtB+D;YACAM,aAAa9D;YACb+D,aAAa9D;YACbN;YACAqE,eAAe7F,UAAUuB,QAAQE,IAAI;YACrCqE,sBAAsB/D;YACtBJ;YACAoE,WAAWrE;YACXU;YACAwB;YACAE;YACAkC,WAAW;YACXhC;YACAD;YACAnC;QACF;IACF;IAEAnB,+BAA+Ba,MAAMQ,KAAK;QACxC;QACA;QACA,qEAAqE;QACrE,0EAA0E;QAC1E,mEAAmE;QACnE,6CAA6C;QAC7C;WACIM,WAAW,UACV;YAAC;YAAY;YAAS;SAAwB,GAC9C;YAAC;YAAW;YAAS;SAAwB;KACnD;IAED,MAAMrC,gCAAgCuB,MAAM;QAACH;KAAsB;IAEnE,MAAMxB,qBAAqB2B;IAC3B,OAAO,IACLxB,oBAAoBwB,MAAMC,QAAQ0E,yBAAyB,EAAE;YAC3DC,WAAW;gBAAC;gBAAc;aAAS;QACrC;AACJ,EAAE;AAEF,eAAe7E,eAAe"}
|
|
@@ -1820,6 +1820,9 @@ export class StaticWebsite extends Construct {
|
|
|
1820
1820
|
destinationBucket: this.websiteBucket,
|
|
1821
1821
|
// Files in the distribution's edge caches will be invalidated after files are uploaded to the destination bucket.
|
|
1822
1822
|
distribution: this.cloudFrontDistribution,
|
|
1823
|
+
// Exclude the runtime config from this deployment's sync so its default pruning
|
|
1824
|
+
// never deletes the file managed separately by RuntimeConfigDeployment below.
|
|
1825
|
+
exclude: [DEFAULT_RUNTIME_CONFIG_FILENAME],
|
|
1823
1826
|
memoryLimit: 1024,
|
|
1824
1827
|
});
|
|
1825
1828
|
|
|
@@ -3538,6 +3541,9 @@ export class StaticWebsite extends Construct {
|
|
|
3538
3541
|
destinationBucket: this.websiteBucket,
|
|
3539
3542
|
// Files in the distribution's edge caches will be invalidated after files are uploaded to the destination bucket.
|
|
3540
3543
|
distribution: this.cloudFrontDistribution,
|
|
3544
|
+
// Exclude the runtime config from this deployment's sync so its default pruning
|
|
3545
|
+
// never deletes the file managed separately by RuntimeConfigDeployment below.
|
|
3546
|
+
exclude: [DEFAULT_RUNTIME_CONFIG_FILENAME],
|
|
3541
3547
|
memoryLimit: 1024,
|
|
3542
3548
|
});
|
|
3543
3549
|
|
|
@@ -5163,6 +5169,9 @@ export class StaticWebsite extends Construct {
|
|
|
5163
5169
|
destinationBucket: this.websiteBucket,
|
|
5164
5170
|
// Files in the distribution's edge caches will be invalidated after files are uploaded to the destination bucket.
|
|
5165
5171
|
distribution: this.cloudFrontDistribution,
|
|
5172
|
+
// Exclude the runtime config from this deployment's sync so its default pruning
|
|
5173
|
+
// never deletes the file managed separately by RuntimeConfigDeployment below.
|
|
5174
|
+
exclude: [DEFAULT_RUNTIME_CONFIG_FILENAME],
|
|
5166
5175
|
memoryLimit: 1024,
|
|
5167
5176
|
});
|
|
5168
5177
|
|
|
@@ -118,7 +118,7 @@ import {
|
|
|
118
118
|
import { LogGroup, RetentionDays } from 'aws-cdk-lib/aws-logs';
|
|
119
119
|
import { Construct } from 'constructs';
|
|
120
120
|
import { RuntimeConfig } from './runtime-config.js';
|
|
121
|
-
import { Distribution } from 'aws-cdk-lib/aws-cloudfront';
|
|
121
|
+
import { CfnDistribution, Distribution } from 'aws-cdk-lib/aws-cloudfront';
|
|
122
122
|
import { suppressRules } from './checkov.js';
|
|
123
123
|
|
|
124
124
|
const WEB_CLIENT_ID = 'WebClient';
|
|
@@ -334,9 +334,7 @@ export class UserIdentity extends Construct {
|
|
|
334
334
|
const lazilyComputedCallbackUrls = Lazy.list({
|
|
335
335
|
produce: () =>
|
|
336
336
|
['http://localhost:4200', 'http://localhost:4300'].concat(
|
|
337
|
-
this.
|
|
338
|
-
(d) => \`https://\${d.domainName}\`,
|
|
339
|
-
),
|
|
337
|
+
this.findCloudFrontDomainNames().map((domain) => \`https://\${domain}\`),
|
|
340
338
|
),
|
|
341
339
|
});
|
|
342
340
|
|
|
@@ -386,10 +384,17 @@ export class UserIdentity extends Construct {
|
|
|
386
384
|
}).node.addDependency(userPoolClient, userPool, userPoolDomain);
|
|
387
385
|
};
|
|
388
386
|
|
|
389
|
-
|
|
387
|
+
// Includes each distribution's default domain name plus any custom domain names (aliases) configured on it.
|
|
388
|
+
private findCloudFrontDomainNames = (): string[] =>
|
|
390
389
|
Stack.of(this)
|
|
391
390
|
.node.findAll()
|
|
392
|
-
.filter((child) => child instanceof Distribution)
|
|
391
|
+
.filter((child): child is Distribution => child instanceof Distribution)
|
|
392
|
+
.flatMap((d) => {
|
|
393
|
+
const cfnDistribution = d.node.defaultChild as CfnDistribution;
|
|
394
|
+
const distributionConfig =
|
|
395
|
+
cfnDistribution.distributionConfig as CfnDistribution.DistributionConfigProperty;
|
|
396
|
+
return [d.domainName, ...(distributionConfig.aliases ?? [])];
|
|
397
|
+
});
|
|
393
398
|
}
|
|
394
399
|
"
|
|
395
400
|
`;
|
|
@@ -241,11 +241,21 @@ resource "aws_cloudfront_distribution" "website" {
|
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
# Add CloudFront domain to user pool client callback URLs
|
|
244
|
+
# Add CloudFront domain and any custom domain names to user pool client callback URLs.
|
|
245
|
+
# Keyed by statically-known values so for_each keys are resolvable at plan time; the
|
|
246
|
+
# CloudFront domain is only known at apply time, so it appears in the value, not the key.
|
|
247
|
+
locals {
|
|
248
|
+
callback_urls = merge(
|
|
249
|
+
{ cloudfront = "https://\${aws_cloudfront_distribution.website.domain_name}" },
|
|
250
|
+
{ for domain in var.custom_domain_names : domain => "https://\${domain}" },
|
|
251
|
+
)
|
|
252
|
+
}
|
|
253
|
+
|
|
245
254
|
module "add_callback_url" {
|
|
246
255
|
source = "../user-identity/add-callback-url"
|
|
256
|
+
for_each = local.callback_urls
|
|
247
257
|
|
|
248
|
-
callback_url =
|
|
258
|
+
callback_url = each.value
|
|
249
259
|
|
|
250
260
|
depends_on = [aws_cloudfront_distribution.website]
|
|
251
261
|
}
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
import { LogGroup, RetentionDays } from 'aws-cdk-lib/aws-logs';
|
|
31
31
|
import { Construct } from 'constructs';
|
|
32
32
|
import { RuntimeConfig } from './runtime-config<% if (esm) { %>.js<% } %>';
|
|
33
|
-
import { Distribution } from 'aws-cdk-lib/aws-cloudfront';
|
|
33
|
+
import { CfnDistribution, Distribution } from 'aws-cdk-lib/aws-cloudfront';
|
|
34
34
|
import { suppressRules } from './checkov<% if (esm) { %>.js<% } %>';
|
|
35
35
|
|
|
36
36
|
const WEB_CLIENT_ID = 'WebClient';
|
|
@@ -242,9 +242,7 @@ export class UserIdentity extends Construct {
|
|
|
242
242
|
const lazilyComputedCallbackUrls = Lazy.list({
|
|
243
243
|
produce: () =>
|
|
244
244
|
['http://localhost:4200', 'http://localhost:4300'].concat(
|
|
245
|
-
this.
|
|
246
|
-
(d) => `https://${d.domainName}`
|
|
247
|
-
)
|
|
245
|
+
this.findCloudFrontDomainNames().map((domain) => `https://${domain}`)
|
|
248
246
|
),
|
|
249
247
|
});
|
|
250
248
|
|
|
@@ -294,8 +292,15 @@ export class UserIdentity extends Construct {
|
|
|
294
292
|
}).node.addDependency(userPoolClient, userPool, userPoolDomain);
|
|
295
293
|
};
|
|
296
294
|
|
|
297
|
-
|
|
295
|
+
// Includes each distribution's default domain name plus any custom domain names (aliases) configured on it.
|
|
296
|
+
private findCloudFrontDomainNames = (): string[] =>
|
|
298
297
|
Stack.of(this)
|
|
299
298
|
.node.findAll()
|
|
300
|
-
.filter((child) => child instanceof Distribution)
|
|
299
|
+
.filter((child): child is Distribution => child instanceof Distribution)
|
|
300
|
+
.flatMap((d) => {
|
|
301
|
+
const cfnDistribution = d.node.defaultChild as CfnDistribution;
|
|
302
|
+
const distributionConfig =
|
|
303
|
+
cfnDistribution.distributionConfig as CfnDistribution.DistributionConfigProperty;
|
|
304
|
+
return [d.domainName, ...(distributionConfig.aliases ?? [])];
|
|
305
|
+
});
|
|
301
306
|
}
|
|
@@ -37,14 +37,25 @@ const addIdentityTerraformModules = (tree, options)=>{
|
|
|
37
37
|
// Update the static website module to add the callback url
|
|
38
38
|
const staticWebsiteModule = tree.read(joinPathFragments(PACKAGES_DIR, SHARED_TERRAFORM_DIR, 'src', 'core', 'static-website', 'static-website.tf'), 'utf-8');
|
|
39
39
|
if (staticWebsiteModule && !staticWebsiteModule.includes('source = "../user-identity/add-callback-url"')) {
|
|
40
|
-
// Find the aws_cloudfront_distribution.website resource and add the callback URL module after it
|
|
40
|
+
// Find the aws_cloudfront_distribution.website resource and add the callback URL module after it.
|
|
41
|
+
// Includes the CloudFront domain plus any custom domain names (aliases) configured via var.custom_domain_names.
|
|
41
42
|
const callbackUrlModule = `
|
|
42
43
|
|
|
43
|
-
# Add CloudFront domain to user pool client callback URLs
|
|
44
|
+
# Add CloudFront domain and any custom domain names to user pool client callback URLs.
|
|
45
|
+
# Keyed by statically-known values so for_each keys are resolvable at plan time; the
|
|
46
|
+
# CloudFront domain is only known at apply time, so it appears in the value, not the key.
|
|
47
|
+
locals {
|
|
48
|
+
callback_urls = merge(
|
|
49
|
+
{ cloudfront = "https://\${aws_cloudfront_distribution.website.domain_name}" },
|
|
50
|
+
{ for domain in var.custom_domain_names : domain => "https://\${domain}" },
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
44
54
|
module "add_callback_url" {
|
|
45
55
|
source = "../user-identity/add-callback-url"
|
|
56
|
+
for_each = local.callback_urls
|
|
46
57
|
|
|
47
|
-
callback_url =
|
|
58
|
+
callback_url = each.value
|
|
48
59
|
|
|
49
60
|
depends_on = [aws_cloudfront_distribution.website]
|
|
50
61
|
}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/utils/identity-constructs/identity-constructs.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type Tree,\n} from '@nx/devkit';\nimport { addStarExport } from '../ast';\nimport type { Iac } from '../iac';\nimport { esmVars } from '../module-format';\nimport {\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n SHARED_TERRAFORM_DIR,\n} from '../shared-constructs-constants';\nimport { PY_VERSIONS, terraformProviderVersions } from '../versions';\n\nexport interface AddIdentityInfraOptions {\n cognitoDomain: string;\n allowSignup: boolean;\n}\n\n/**\n * Add infrastructure for a static website\n */\nexport const addIdentityInfra = async (\n tree: Tree,\n options: AddIdentityInfraOptions & { iac: Iac },\n) => {\n if (options.iac === 'cdk') {\n await addIdentityCdkConstructs(tree, options);\n } else if (options.iac === 'terraform') {\n addIdentityTerraformModules(tree, options);\n } else {\n throw new Error(`Unsupported iac ${options.iac}`);\n }\n};\n\nconst addIdentityCdkConstructs = async (\n tree: Tree,\n options: AddIdentityInfraOptions,\n) => {\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'cdk', 'core'),\n joinPathFragments(PACKAGES_DIR, SHARED_CONSTRUCTS_DIR, 'src', 'core'),\n { ...options, ...esmVars(tree) },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n await addStarExport(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'core',\n 'index.ts',\n ),\n './user-identity.js',\n );\n};\n\nconst addIdentityTerraformModules = (\n tree: Tree,\n options: AddIdentityInfraOptions,\n) => {\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'terraform', 'core'),\n joinPathFragments(PACKAGES_DIR, SHARED_TERRAFORM_DIR, 'src', 'core'),\n {\n ...options,\n boto3Version: PY_VERSIONS.boto3,\n ...terraformProviderVersions(),\n },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n // Update the static website module to add the callback url\n const staticWebsiteModule = tree.read(\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_TERRAFORM_DIR,\n 'src',\n 'core',\n 'static-website',\n 'static-website.tf',\n ),\n 'utf-8',\n );\n if (\n staticWebsiteModule &&\n !staticWebsiteModule.includes(\n 'source = \"../user-identity/add-callback-url\"',\n )\n ) {\n // Find the aws_cloudfront_distribution.website resource and add the callback URL module after it
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/utils/identity-constructs/identity-constructs.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type Tree,\n} from '@nx/devkit';\nimport { addStarExport } from '../ast';\nimport type { Iac } from '../iac';\nimport { esmVars } from '../module-format';\nimport {\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n SHARED_TERRAFORM_DIR,\n} from '../shared-constructs-constants';\nimport { PY_VERSIONS, terraformProviderVersions } from '../versions';\n\nexport interface AddIdentityInfraOptions {\n cognitoDomain: string;\n allowSignup: boolean;\n}\n\n/**\n * Add infrastructure for a static website\n */\nexport const addIdentityInfra = async (\n tree: Tree,\n options: AddIdentityInfraOptions & { iac: Iac },\n) => {\n if (options.iac === 'cdk') {\n await addIdentityCdkConstructs(tree, options);\n } else if (options.iac === 'terraform') {\n addIdentityTerraformModules(tree, options);\n } else {\n throw new Error(`Unsupported iac ${options.iac}`);\n }\n};\n\nconst addIdentityCdkConstructs = async (\n tree: Tree,\n options: AddIdentityInfraOptions,\n) => {\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'cdk', 'core'),\n joinPathFragments(PACKAGES_DIR, SHARED_CONSTRUCTS_DIR, 'src', 'core'),\n { ...options, ...esmVars(tree) },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n await addStarExport(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'core',\n 'index.ts',\n ),\n './user-identity.js',\n );\n};\n\nconst addIdentityTerraformModules = (\n tree: Tree,\n options: AddIdentityInfraOptions,\n) => {\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'terraform', 'core'),\n joinPathFragments(PACKAGES_DIR, SHARED_TERRAFORM_DIR, 'src', 'core'),\n {\n ...options,\n boto3Version: PY_VERSIONS.boto3,\n ...terraformProviderVersions(),\n },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n // Update the static website module to add the callback url\n const staticWebsiteModule = tree.read(\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_TERRAFORM_DIR,\n 'src',\n 'core',\n 'static-website',\n 'static-website.tf',\n ),\n 'utf-8',\n );\n if (\n staticWebsiteModule &&\n !staticWebsiteModule.includes(\n 'source = \"../user-identity/add-callback-url\"',\n )\n ) {\n // Find the aws_cloudfront_distribution.website resource and add the callback URL module after it.\n // Includes the CloudFront domain plus any custom domain names (aliases) configured via var.custom_domain_names.\n const callbackUrlModule = `\n\n# Add CloudFront domain and any custom domain names to user pool client callback URLs.\n# Keyed by statically-known values so for_each keys are resolvable at plan time; the\n# CloudFront domain is only known at apply time, so it appears in the value, not the key.\nlocals {\n callback_urls = merge(\n { cloudfront = \"https://\\${aws_cloudfront_distribution.website.domain_name}\" },\n { for domain in var.custom_domain_names : domain => \"https://\\${domain}\" },\n )\n}\n\nmodule \"add_callback_url\" {\n source = \"../user-identity/add-callback-url\"\n for_each = local.callback_urls\n\n callback_url = each.value\n\n depends_on = [aws_cloudfront_distribution.website]\n}`;\n\n // Find the CloudFront distribution resource using proper brace counting\n // This handles deeply nested structures correctly\n const resourceStartPattern =\n /resource\\s+\"aws_cloudfront_distribution\"\\s+\"website\"\\s*\\{/;\n const resourceStartMatch = staticWebsiteModule.match(resourceStartPattern);\n\n if (resourceStartMatch) {\n const startIndex =\n resourceStartMatch.index! + resourceStartMatch[0].length - 1; // Position at opening brace\n let braceCount = 0;\n let insertionPoint = -1;\n\n // Count braces to find the end of the resource block\n for (let i = startIndex; i < staticWebsiteModule.length; i++) {\n const char = staticWebsiteModule[i];\n if (char === '{') {\n braceCount++;\n } else if (char === '}') {\n braceCount--;\n if (braceCount === 0) {\n // Found the closing brace of the CloudFront resource\n insertionPoint = i + 1;\n break;\n }\n }\n }\n\n if (insertionPoint !== -1) {\n // Insert the callback URL module right after the CloudFront distribution\n const beforeInsertion = staticWebsiteModule.substring(\n 0,\n insertionPoint,\n );\n const afterInsertion = staticWebsiteModule.substring(insertionPoint);\n const updatedContent =\n beforeInsertion + callbackUrlModule + afterInsertion;\n\n tree.write(\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_TERRAFORM_DIR,\n 'src',\n 'core',\n 'static-website',\n 'static-website.tf',\n ),\n updatedContent,\n );\n }\n }\n }\n};\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","addStarExport","esmVars","PACKAGES_DIR","SHARED_CONSTRUCTS_DIR","SHARED_TERRAFORM_DIR","PY_VERSIONS","terraformProviderVersions","addIdentityInfra","tree","options","iac","addIdentityCdkConstructs","addIdentityTerraformModules","Error","dirname","overwriteStrategy","KeepExisting","boto3Version","boto3","staticWebsiteModule","read","includes","callbackUrlModule","resourceStartPattern","resourceStartMatch","match","startIndex","index","length","braceCount","insertionPoint","i","char","beforeInsertion","substring","afterInsertion","updatedContent","write"],"mappings":"AAAA;;;CAGC,GACD,SACEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,QAEZ,aAAa;AACpB,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MC,oBAAoB,CAAC;;;;;;;;;;;;;;;;;;;CAmB9B,CAAC;QAEE,wEAAwE;QACxE,kDAAkD;QAClD,MAAMC,uBACJ;QACF,MAAMC,qBAAqBL,oBAAoBM,KAAK,CAACF;QAErD,IAAIC,oBAAoB;YACtB,MAAME,aACJF,mBAAmBG,KAAK,GAAIH,kBAAkB,CAAC,EAAE,CAACI,MAAM,GAAG,GAAG,4BAA4B;YAC5F,IAAIC,aAAa;YACjB,IAAIC,iBAAiB,CAAC;YAEtB,qDAAqD;YACrD,IAAK,IAAIC,IAAIL,YAAYK,IAAIZ,oBAAoBS,MAAM,EAAEG,IAAK;gBAC5D,MAAMC,OAAOb,mBAAmB,CAACY,EAAE;gBACnC,IAAIC,SAAS,KAAK;oBAChBH;gBACF,OAAO,IAAIG,SAAS,KAAK;oBACvBH;oBACA,IAAIA,eAAe,GAAG;wBACpB,qDAAqD;wBACrDC,iBAAiBC,IAAI;wBACrB;oBACF;gBACF;YACF;YAEA,IAAID,mBAAmB,CAAC,GAAG;gBACzB,yEAAyE;gBACzE,MAAMG,kBAAkBd,oBAAoBe,SAAS,CACnD,GACAJ;gBAEF,MAAMK,iBAAiBhB,oBAAoBe,SAAS,CAACJ;gBACrD,MAAMM,iBACJH,kBAAkBX,oBAAoBa;gBAExC3B,KAAK6B,KAAK,CACRvC,kBACEI,cACAE,sBACA,OACA,QACA,kBACA,sBAEFgC;YAEJ;QACF;IACF;AACF"}
|
package/src/utils/versions.d.ts
CHANGED
package/src/utils/versions.js
CHANGED
|
@@ -168,7 +168,11 @@
|
|
|
168
168
|
sqlmodel: '==0.0.39',
|
|
169
169
|
alembic: '==1.18.5',
|
|
170
170
|
aiomysql: '==0.3.2',
|
|
171
|
-
asyncpg: '==0.31.0'
|
|
171
|
+
asyncpg: '==0.31.0',
|
|
172
|
+
// Pinned explicitly: SQLAlchemy's async engine pulls greenlet transitively,
|
|
173
|
+
// and leaving it unpinned lets uv resolve to a just-released version whose
|
|
174
|
+
// platform wheels may not all be published yet (breaking aarch64 installs).
|
|
175
|
+
greenlet: '==3.5.4'
|
|
172
176
|
};
|
|
173
177
|
/**
|
|
174
178
|
* Add versions to the given dependencies
|
|
@@ -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.14',\n '@aws/aws-distro-opentelemetry-node-autoinstrumentation': '0.12.0',\n // Pinned above the version the ADOT autoinstrumentation package resolves\n // transitively (2.8.0) to clear CVE-2026-59892 (HIGH).\n '@opentelemetry/propagator-jaeger': '2.9.0',\n '@aws-sdk/client-dynamodb': '3.1090.0',\n '@aws-sdk/client-bedrock-runtime': '3.1090.0',\n '@aws-sdk/client-s3': '3.1090.0',\n '@aws-sdk/client-sts': '3.1090.0',\n '@aws-sdk/credential-providers': '3.1090.0',\n '@aws-sdk/credential-provider-cognito-identity': '3.972.58',\n '@aws-sdk/client-secrets-manager': '3.1090.0',\n '@aws-sdk/rds-signer': '3.1090.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.34.0',\n '@aws-lambda-powertools/metrics': '2.34.0',\n '@aws-lambda-powertools/parameters': '2.34.0',\n '@aws-lambda-powertools/tracer': '2.34.0',\n '@aws-lambda-powertools/parser': '2.34.0',\n '@aws-sdk/client-appconfigdata': '3.1090.0',\n '@middy/core': '7.7.0',\n '@nxlv/python': '22.2.2',\n '@nx-extend/terraform': '10.3.0',\n '@nx/devkit': '23.1.0',\n '@nx/react': '23.1.0',\n 'create-nx-workspace': '23.1.0',\n '@swc-node/register': '1.12.1',\n '@swc/core': '1.15.43',\n '@modelcontextprotocol/sdk': '1.29.0',\n '@modelcontextprotocol/inspector': '0.22.0',\n '@ag-ui/a2ui-toolkit': '0.0.4',\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.63.1',\n rxjs: '7.8.2',\n '@strands-agents/sdk': '1.10.0',\n '@tanstack/react-router': '1.170.18',\n '@tanstack/router-plugin': '1.168.22',\n '@tanstack/router-generator': '1.167.21',\n '@tanstack/virtual-file-routes': '1.162.0',\n '@tanstack/router-utils': '1.162.2',\n '@cloudscape-design/board-components': '3.0.205',\n '@cloudscape-design/chat-components': '1.0.151',\n '@cloudscape-design/components': '3.0.1330',\n '@cloudscape-design/global-styles': '1.0.62',\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': '26.1.1',\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.10',\n '@smithy/node-config-provider': '4.5.10',\n '@smithy/node-http-handler': '4.9.7',\n '@smithy/types': '4.16.1',\n '@vitest/coverage-v8': '4.1.10',\n '@vitest/ui': '4.1.10',\n '@astrojs/react': '6.0.1',\n '@astrojs/starlight': '0.41.3',\n astro: '7.1.1',\n aws4fetch: '1.0.20',\n 'aws-cdk': '2.1132.0',\n 'aws-cdk-lib': '2.261.0',\n 'aws-xray-sdk-core': '3.12.0',\n constructs: '10.7.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: '15.0.0',\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.4',\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.6',\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: '12.0.1',\n 'npm-check-updates': '22.2.9',\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.2.0',\n 'simple-git': '3.36.0',\n 'source-map-support': '0.5.21',\n 'starlight-blog': '0.28.0',\n tailwindcss: '4.3.3',\n '@tailwindcss/vite': '4.3.3',\n tsx: '4.23.1',\n 'lucide-react': '1.25.0',\n 'radix-ui': '1.6.2',\n shadcn: '4.13.1',\n 'tw-animate-css': '1.4.0',\n 'tailwind-merge': '3.6.0',\n vite: '8.1.5',\n typescript: '6.0.3',\n vitest: '4.1.10',\n zod: '4.4.3',\n ws: '8.21.1',\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.1',\n 'aws-lambda-powertools[tracer]': '==3.31.1',\n 'aws-lambda-powertools[parser]': '==3.31.1',\n 'aws-opentelemetry-distro': '==0.18.0',\n 'bedrock-agentcore': '==1.18.1',\n boto3: '==1.43.51',\n checkov: '==3.3.8',\n fastapi: '==0.139.2',\n 'fastapi[standard]': '==0.139.2',\n httpx: '==0.28.1',\n langchain: '==1.3.14',\n 'langchain-aws': '==1.6.2',\n 'langchain-mcp-adapters': '==0.3.0',\n langgraph: '==1.2.9',\n mcp: '==1.28.1',\n 'pip-check-updates': '==0.29.0',\n 'pip-licenses': '==5.5.5',\n ruff: '==0.15.22',\n 'strands-agents': '==1.48.0',\n 'strands-agents[a2a]': '==1.48.0',\n 'strands-agents-tools': '==0.8.4',\n ty: '==0.0.61',\n pynamodb: '==6.1.0',\n uvicorn: '==0.51.0',\n sqlmodel: '==0.0.39',\n alembic: '==1.18.5',\n aiomysql: '==0.3.2',\n asyncpg: '==0.31.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 * Base container images used by generated Dockerfiles. Pinned exactly so\n * generated images are reproducible, and chosen to be free of known\n * HIGH/CRITICAL vulnerabilities at time of generation.\n */\nexport const BASE_IMAGES = {\n node: 'public.ecr.aws/docker/library/node:lts-slim',\n python: 'public.ecr.aws/docker/library/python:3.14-slim',\n} as const;\n\n/**\n * Versions for container tooling used by generated image build/scan targets.\n * Pinned exactly so generated images are reproducible.\n */\nexport const CONTAINER_VERSIONS = {\n // ECR-hosted Trivy image used to scan built images during the build.\n trivy: '0.72.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.55.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","npm","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","ruff","ty","pynamodb","uvicorn","sqlmodel","alembic","aiomysql","asyncpg","withPyVersions","VENDORED_VERSIONS","BASE_IMAGES","node","python","CONTAINER_VERSIONS","trivy","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,yEAAyE;IACzE,uDAAuD;IACvD,oCAAoC;IACpC,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,aAA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AC1CQ,uBAAuBT,mBAAmBE,MAAM;QAChDQ,qBAAqBV,mBAAmBG,IAAI;QAC5CQ,wBAAwBX,mBAAmBI,OAAO;QAClDQ,yBAAyBZ,mBAAmBK,QAAQ;QACpDQ,sBAAsBb,mBAAmBM,KAAK;IAChD,CAAA,EAAG"}
|
|
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.14',\n '@aws/aws-distro-opentelemetry-node-autoinstrumentation': '0.12.0',\n // Pinned above the version the ADOT autoinstrumentation package resolves\n // transitively (2.8.0) to clear CVE-2026-59892 (HIGH).\n '@opentelemetry/propagator-jaeger': '2.9.0',\n '@aws-sdk/client-dynamodb': '3.1090.0',\n '@aws-sdk/client-bedrock-runtime': '3.1090.0',\n '@aws-sdk/client-s3': '3.1090.0',\n '@aws-sdk/client-sts': '3.1090.0',\n '@aws-sdk/credential-providers': '3.1090.0',\n '@aws-sdk/credential-provider-cognito-identity': '3.972.58',\n '@aws-sdk/client-secrets-manager': '3.1090.0',\n '@aws-sdk/rds-signer': '3.1090.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.34.0',\n '@aws-lambda-powertools/metrics': '2.34.0',\n '@aws-lambda-powertools/parameters': '2.34.0',\n '@aws-lambda-powertools/tracer': '2.34.0',\n '@aws-lambda-powertools/parser': '2.34.0',\n '@aws-sdk/client-appconfigdata': '3.1090.0',\n '@middy/core': '7.7.0',\n '@nxlv/python': '22.2.2',\n '@nx-extend/terraform': '10.3.0',\n '@nx/devkit': '23.1.0',\n '@nx/react': '23.1.0',\n 'create-nx-workspace': '23.1.0',\n '@swc-node/register': '1.12.1',\n '@swc/core': '1.15.43',\n '@modelcontextprotocol/sdk': '1.29.0',\n '@modelcontextprotocol/inspector': '0.22.0',\n '@ag-ui/a2ui-toolkit': '0.0.4',\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.63.1',\n rxjs: '7.8.2',\n '@strands-agents/sdk': '1.10.0',\n '@tanstack/react-router': '1.170.18',\n '@tanstack/router-plugin': '1.168.22',\n '@tanstack/router-generator': '1.167.21',\n '@tanstack/virtual-file-routes': '1.162.0',\n '@tanstack/router-utils': '1.162.2',\n '@cloudscape-design/board-components': '3.0.205',\n '@cloudscape-design/chat-components': '1.0.151',\n '@cloudscape-design/components': '3.0.1330',\n '@cloudscape-design/global-styles': '1.0.62',\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': '26.1.1',\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.10',\n '@smithy/node-config-provider': '4.5.10',\n '@smithy/node-http-handler': '4.9.7',\n '@smithy/types': '4.16.1',\n '@vitest/coverage-v8': '4.1.10',\n '@vitest/ui': '4.1.10',\n '@astrojs/react': '6.0.1',\n '@astrojs/starlight': '0.41.3',\n astro: '7.1.1',\n aws4fetch: '1.0.20',\n 'aws-cdk': '2.1132.0',\n 'aws-cdk-lib': '2.261.0',\n 'aws-xray-sdk-core': '3.12.0',\n constructs: '10.7.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: '15.0.0',\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.4',\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.6',\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: '12.0.1',\n 'npm-check-updates': '22.2.9',\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.2.0',\n 'simple-git': '3.36.0',\n 'source-map-support': '0.5.21',\n 'starlight-blog': '0.28.0',\n tailwindcss: '4.3.3',\n '@tailwindcss/vite': '4.3.3',\n tsx: '4.23.1',\n 'lucide-react': '1.25.0',\n 'radix-ui': '1.6.2',\n shadcn: '4.13.1',\n 'tw-animate-css': '1.4.0',\n 'tailwind-merge': '3.6.0',\n vite: '8.1.5',\n typescript: '6.0.3',\n vitest: '4.1.10',\n zod: '4.4.3',\n ws: '8.21.1',\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.1',\n 'aws-lambda-powertools[tracer]': '==3.31.1',\n 'aws-lambda-powertools[parser]': '==3.31.1',\n 'aws-opentelemetry-distro': '==0.18.0',\n 'bedrock-agentcore': '==1.18.1',\n boto3: '==1.43.51',\n checkov: '==3.3.8',\n fastapi: '==0.139.2',\n 'fastapi[standard]': '==0.139.2',\n httpx: '==0.28.1',\n langchain: '==1.3.14',\n 'langchain-aws': '==1.6.2',\n 'langchain-mcp-adapters': '==0.3.0',\n langgraph: '==1.2.9',\n mcp: '==1.28.1',\n 'pip-check-updates': '==0.29.0',\n 'pip-licenses': '==5.5.5',\n ruff: '==0.15.22',\n 'strands-agents': '==1.48.0',\n 'strands-agents[a2a]': '==1.48.0',\n 'strands-agents-tools': '==0.8.4',\n ty: '==0.0.61',\n pynamodb: '==6.1.0',\n uvicorn: '==0.51.0',\n sqlmodel: '==0.0.39',\n alembic: '==1.18.5',\n aiomysql: '==0.3.2',\n asyncpg: '==0.31.0',\n // Pinned explicitly: SQLAlchemy's async engine pulls greenlet transitively,\n // and leaving it unpinned lets uv resolve to a just-released version whose\n // platform wheels may not all be published yet (breaking aarch64 installs).\n greenlet: '==3.5.4',\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 * Base container images used by generated Dockerfiles. Pinned exactly so\n * generated images are reproducible, and chosen to be free of known\n * HIGH/CRITICAL vulnerabilities at time of generation.\n */\nexport const BASE_IMAGES = {\n node: 'public.ecr.aws/docker/library/node:lts-slim',\n python: 'public.ecr.aws/docker/library/python:3.14-slim',\n} as const;\n\n/**\n * Versions for container tooling used by generated image build/scan targets.\n * Pinned exactly so generated images are reproducible.\n */\nexport const CONTAINER_VERSIONS = {\n // ECR-hosted Trivy image used to scan built images during the build.\n trivy: '0.72.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.55.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","npm","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","ruff","ty","pynamodb","uvicorn","sqlmodel","alembic","aiomysql","asyncpg","greenlet","withPyVersions","VENDORED_VERSIONS","BASE_IMAGES","node","python","CONTAINER_VERSIONS","trivy","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,yEAAyE;IACzE,uDAAuD;IACvD,oCAAoC;IACpC,4BAA4B;IAC5B,mCAAmC;IACnC,sBAAsB;IACtB,uBAAuB;IACvB,iCAAiC;IACjC,iDAAiD;IACjD,mCAAmC;IACnC,uBAAuB;IACvB,iCAAiC;IACjC,2BAA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AChC,qEAAqE;IACrEC,OAAO;AACT,EAAW;AAEX;;;CAGC,GACD,OAAO,MAAMC,qBAAqB;IAChCC,KAAK;IACLC,QAAQ;IACRC,MAAM;IACNC,SAAS;IACTC,UAAU;IACVC,OAAO;AACT,EAAW;AAGX;;;CAGC,GACD,OAAO,MAAMC,4BAA4B,IAAO,CAAA;QAC9CC,oBAAoBR,mBAAmBC,GAAG;QAC1CQ,uBAAuBT,mBAAmBE,MAAM;QAChDQ,qBAAqBV,mBAAmBG,IAAI;QAC5CQ,wBAAwBX,mBAAmBI,OAAO;QAClDQ,yBAAyBZ,mBAAmBK,QAAQ;QACpDQ,sBAAsBb,mBAAmBM,KAAK;IAChD,CAAA,EAAG"}
|
|
@@ -259,6 +259,9 @@ export class StaticWebsite extends Construct {
|
|
|
259
259
|
destinationBucket: this.websiteBucket,
|
|
260
260
|
// Files in the distribution's edge caches will be invalidated after files are uploaded to the destination bucket.
|
|
261
261
|
distribution: this.cloudFrontDistribution,
|
|
262
|
+
// Exclude the runtime config from this deployment's sync so its default pruning
|
|
263
|
+
// never deletes the file managed separately by RuntimeConfigDeployment below.
|
|
264
|
+
exclude: [DEFAULT_RUNTIME_CONFIG_FILENAME],
|
|
262
265
|
memoryLimit: 1024,
|
|
263
266
|
});
|
|
264
267
|
|