@aws/nx-plugin 0.49.0 → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/generators.json +22 -1
  2. package/package.json +1 -1
  3. package/sdk/ts.d.ts +2 -0
  4. package/sdk/ts.js +6 -3
  5. package/sdk/ts.js.map +1 -1
  6. package/src/api-connection/generator.d.ts +2 -2
  7. package/src/api-connection/generator.js +20 -0
  8. package/src/api-connection/generator.js.map +1 -1
  9. package/src/infra/app/__snapshots__/generator.spec.ts.snap +124 -14
  10. package/src/infra/app/files/app/README.md.template +5 -5
  11. package/src/infra/app/files/app/checkov.yml.template +12 -0
  12. package/src/infra/app/files/app/src/main.ts.template +2 -4
  13. package/src/infra/app/generator.js +13 -8
  14. package/src/infra/app/generator.js.map +1 -1
  15. package/src/infra/app/schema.d.ts +0 -8
  16. package/src/infra/app/schema.json +0 -16
  17. package/src/license/config.js +3 -3
  18. package/src/license/config.js.map +1 -1
  19. package/src/open-api/ts-hooks/__snapshots__/generator.spec.tsx.snap +114 -0
  20. package/src/open-api/ts-hooks/generator.spec.tsx +176 -0
  21. package/src/open-api/utils/codegen-data.js +42 -5
  22. package/src/open-api/utils/codegen-data.js.map +1 -1
  23. package/src/preset/__snapshots__/generator.spec.ts.snap +2 -0
  24. package/src/py/fast-api/__snapshots__/generator.spec.ts.snap +55 -2
  25. package/src/py/fast-api/generator.js +8 -55
  26. package/src/py/fast-api/generator.js.map +1 -1
  27. package/src/py/fast-api/react/generator.js +9 -111
  28. package/src/py/fast-api/react/generator.js.map +1 -1
  29. package/src/py/lambda-function/generator.js +1 -1
  30. package/src/py/lambda-function/generator.js.map +1 -1
  31. package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +3 -2
  32. package/src/py/mcp-server/generator.js +1 -1
  33. package/src/py/mcp-server/generator.js.map +1 -1
  34. package/src/py/strands-agent/__snapshots__/generator.spec.ts.snap +3 -2
  35. package/src/py/strands-agent/generator.js +1 -1
  36. package/src/py/strands-agent/generator.js.map +1 -1
  37. package/src/smithy/project/__snapshots__/generator.spec.ts.snap +576 -0
  38. package/src/smithy/project/files/build.Dockerfile.template +97 -0
  39. package/src/smithy/project/files/smithy-build.json.template +25 -0
  40. package/src/smithy/project/files/src/main.smithy.template +19 -0
  41. package/src/smithy/project/files/src/operations/echo.smithy.template +18 -0
  42. package/src/smithy/project/generator.d.ts +10 -0
  43. package/src/smithy/project/generator.js +70 -0
  44. package/src/smithy/project/generator.js.map +1 -0
  45. package/src/smithy/project/schema.d.ts +11 -0
  46. package/src/smithy/project/schema.json +42 -0
  47. package/src/smithy/react-connection/__snapshots__/generator.spec.ts.snap +270 -0
  48. package/src/smithy/react-connection/files/model/extensions.smithy.template +33 -0
  49. package/src/smithy/react-connection/generator.d.ts +10 -0
  50. package/src/smithy/react-connection/generator.js +100 -0
  51. package/src/smithy/react-connection/generator.js.map +1 -0
  52. package/src/smithy/react-connection/schema.d.ts +8 -0
  53. package/src/smithy/react-connection/schema.json +26 -0
  54. package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +3023 -0
  55. package/src/smithy/ts/api/files/context.ts.template +12 -0
  56. package/src/smithy/ts/api/files/handler.ts.template +50 -0
  57. package/src/smithy/ts/api/files/index.ts.template +0 -0
  58. package/src/smithy/ts/api/files/local-server.ts.template +41 -0
  59. package/src/smithy/ts/api/files/operations/echo.ts.template +7 -0
  60. package/src/smithy/ts/api/files/service.ts.template +8 -0
  61. package/src/smithy/ts/api/generator.d.ts +10 -0
  62. package/src/smithy/ts/api/generator.js +154 -0
  63. package/src/smithy/ts/api/generator.js.map +1 -0
  64. package/src/smithy/ts/api/schema.d.ts +14 -0
  65. package/src/smithy/ts/api/schema.json +56 -0
  66. package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +61 -2
  67. package/src/trpc/backend/generator.js +6 -20
  68. package/src/trpc/backend/generator.js.map +1 -1
  69. package/src/trpc/backend/schema.d.ts +2 -1
  70. package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +3 -3
  71. package/src/ts/lambda-function/generator.js +10 -10
  72. package/src/ts/lambda-function/generator.js.map +1 -1
  73. package/src/ts/lib/eslint.d.ts +7 -0
  74. package/src/ts/lib/eslint.js +37 -29
  75. package/src/ts/lib/eslint.js.map +1 -1
  76. package/src/ts/lib/generator.js +2 -2
  77. package/src/ts/lib/generator.js.map +1 -1
  78. package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +3 -2
  79. package/src/ts/mcp-server/files/Dockerfile.template +1 -1
  80. package/src/ts/mcp-server/generator.js +20 -14
  81. package/src/ts/mcp-server/generator.js.map +1 -1
  82. package/src/ts/nx-generator/__snapshots__/generator.spec.ts.snap +6 -6
  83. package/src/ts/nx-generator/generator.js +3 -2
  84. package/src/ts/nx-generator/generator.js.map +1 -1
  85. package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +264 -3
  86. package/src/ts/react-website/cognito-auth/__snapshots__/generator.spec.ts.snap +10 -0
  87. package/src/utils/__snapshots__/shared-constructs.spec.ts.snap +49 -0
  88. package/src/utils/agent-core-constructs/files/cdk/app/agent-core/__nameKebabCase__/__nameKebabCase__.ts.template +1 -1
  89. package/src/utils/agent-core-constructs/files/terraform/core/agent-core/runtime.tf.template +1 -1
  90. package/src/utils/api-connection/open-api/react.d.ts +43 -0
  91. package/src/utils/api-connection/open-api/react.js +132 -0
  92. package/src/utils/api-connection/open-api/react.js.map +1 -0
  93. package/src/utils/api-constructs/api-constructs.d.ts +6 -2
  94. package/src/utils/api-constructs/api-constructs.js.map +1 -1
  95. package/src/utils/api-constructs/files/cdk/app/apis/http/__apiNameKebabCase__.ts.template +4 -4
  96. package/src/utils/api-constructs/files/cdk/app/apis/rest/__apiNameKebabCase__.ts.template +7 -4
  97. package/src/utils/api-constructs/files/cdk/core/api/http/http-api.ts.template +37 -2
  98. package/src/utils/api-constructs/files/cdk/core/api/rest/rest-api.ts.template +15 -0
  99. package/src/utils/api-constructs/files/terraform/app/apis/http/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +1 -1
  100. package/src/utils/api-constructs/files/terraform/app/apis/rest/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +1 -1
  101. package/src/utils/api-constructs/open-api-metadata.d.ts +17 -0
  102. package/src/utils/api-constructs/open-api-metadata.js +68 -0
  103. package/src/utils/api-constructs/open-api-metadata.js.map +1 -0
  104. package/src/utils/bundle/bundle.d.ts +35 -0
  105. package/src/utils/bundle/bundle.js +107 -0
  106. package/src/utils/bundle/bundle.js.map +1 -0
  107. package/src/utils/bundle/files/ts/rolldown.config.ts.template +3 -0
  108. package/src/utils/files/common/constructs/src/core/checkov.ts.template +44 -0
  109. package/src/utils/files/common/constructs/src/core/index.ts.template +1 -0
  110. package/src/utils/fs.d.ts +16 -0
  111. package/src/utils/fs.js +32 -0
  112. package/src/utils/fs.js.map +1 -0
  113. package/src/utils/identity-constructs/files/cdk/core/user-identity.ts.template +8 -0
  114. package/src/utils/nx.d.ts +10 -3
  115. package/src/utils/nx.js +18 -3
  116. package/src/utils/nx.js.map +1 -1
  117. package/src/utils/versions.d.ts +6 -2
  118. package/src/utils/versions.js +5 -1
  119. package/src/utils/versions.js.map +1 -1
  120. package/src/utils/website-constructs/files/cdk/core/static-website.ts.template +56 -2
  121. package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/aws-prototyping.guard +0 -1282
  122. package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/cfn-nag.guard +0 -6839
  123. package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/hipaa-security.guard +0 -2807
  124. package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/nist-csf.guard +0 -2585
  125. package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/pci-dss-3-2-1.guard +0 -2236
  126. package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/wa-reliability-pillar.guard +0 -885
  127. package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/wa-security-pillar.guard +0 -2205
  128. package/src/infra/app/files/common/constructs/src/core/cfn-guard.ts.template +0 -67
  129. package/src/utils/bundle.d.ts +0 -16
  130. package/src/utils/bundle.js +0 -48
  131. package/src/utils/bundle.js.map +0 -1
  132. package/src/utils/esbuild.d.ts +0 -15
  133. package/src/utils/esbuild.js +0 -46
  134. package/src/utils/esbuild.js.map +0 -1
  135. /package/src/{py/fast-api/react/files/website → utils/api-connection/open-api/files}/components/__apiNameClassName__Provider.tsx.template +0 -0
  136. /package/src/{py/fast-api/react/files/website → utils/api-connection/open-api/files}/hooks/use__apiNameClassName__.tsx.template +0 -0
  137. /package/src/{py/fast-api/react/files/website → utils/api-connection/open-api/files}/hooks/use__apiNameClassName__Client.tsx.template +0 -0
@@ -0,0 +1,12 @@
1
+ import { Logger } from '@aws-lambda-powertools/logger';
2
+ import { Metrics } from '@aws-lambda-powertools/metrics';
3
+ import { Tracer } from '@aws-lambda-powertools/tracer';
4
+
5
+ /**
6
+ * Context provided to all operations.
7
+ */
8
+ export interface ServiceContext {
9
+ tracer: Tracer;
10
+ logger: Logger;
11
+ metrics: Metrics;
12
+ }
@@ -0,0 +1,50 @@
1
+ import {
2
+ convertEvent,
3
+ convertVersion1Response,
4
+ } from '@aws-smithy/server-apigateway';
5
+ import type { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda';
6
+ import middy from '@middy/core';
7
+ import { Tracer } from '@aws-lambda-powertools/tracer';
8
+ import { captureLambdaHandler } from '@aws-lambda-powertools/tracer/middleware';
9
+ import { injectLambdaContext } from '@aws-lambda-powertools/logger/middleware';
10
+ import { Logger } from '@aws-lambda-powertools/logger';
11
+ import { Metrics } from '@aws-lambda-powertools/metrics';
12
+ import { logMetrics } from '@aws-lambda-powertools/metrics/middleware';
13
+ import { Service } from './service.js';
14
+ import { get<%- apiNameClassName %>ServiceHandler } from './generated/ssdk/index.js';
15
+
16
+ process.env.POWERTOOLS_METRICS_NAMESPACE = '<%- apiNameClassName %>';
17
+ process.env.POWERTOOLS_SERVICE_NAME = '<%- apiNameClassName %>';
18
+
19
+ const tracer = new Tracer();
20
+ const logger = new Logger();
21
+ const metrics = new Metrics();
22
+
23
+ const serviceHandler = get<%- apiNameClassName %>ServiceHandler(Service);
24
+
25
+ export const lambdaHandler = async (
26
+ event: APIGatewayProxyEvent,
27
+ ): Promise<APIGatewayProxyResult> => {
28
+ const httpRequest = convertEvent(event);
29
+ const httpResponse = await serviceHandler.handle(httpRequest, {
30
+ tracer,
31
+ logger,
32
+ metrics,
33
+ });
34
+ const apiGatewayResponse = convertVersion1Response(httpResponse);
35
+
36
+ return {
37
+ ...apiGatewayResponse,
38
+ headers: {
39
+ 'Access-Control-Allow-Origin': '*',
40
+ 'Access-Control-Allow-Methods': '*',
41
+ ...apiGatewayResponse.headers,
42
+ },
43
+ };
44
+ };
45
+
46
+ export const handler = middy<APIGatewayProxyEvent, APIGatewayProxyResult>()
47
+ .use(captureLambdaHandler(tracer))
48
+ .use(injectLambdaContext(logger))
49
+ .use(logMetrics(metrics))
50
+ .handler(lambdaHandler);
File without changes
@@ -0,0 +1,41 @@
1
+ import { IncomingMessage, ServerResponse, createServer } from 'http';
2
+ import { convertRequest, writeResponse } from '@aws-smithy/server-node';
3
+ import { Logger } from '@aws-lambda-powertools/logger';
4
+ import { Metrics } from '@aws-lambda-powertools/metrics';
5
+ import { Tracer } from '@aws-lambda-powertools/tracer';
6
+ import { Service } from './service.js';
7
+ import { get<%- apiNameClassName %>ServiceHandler } from './generated/ssdk/index.js';
8
+
9
+ const PORT = <%- port %>;
10
+
11
+ const tracer = new Tracer();
12
+ const logger = new Logger();
13
+ const metrics = new Metrics();
14
+
15
+ const serviceHandler = get<%- apiNameClassName %>ServiceHandler(Service);
16
+
17
+ const server = createServer(async function (
18
+ req: IncomingMessage,
19
+ res: ServerResponse<IncomingMessage> & { req: IncomingMessage },
20
+ ) {
21
+ res.setHeader('Access-Control-Allow-Origin', '*');
22
+ res.setHeader('Access-Control-Allow-Methods', '*');
23
+ res.setHeader('Access-Control-Allow-Headers', '*');
24
+
25
+ if (req.method === 'OPTIONS') {
26
+ res.writeHead(204);
27
+ res.end();
28
+ return;
29
+ }
30
+
31
+ const httpRequest = convertRequest(req);
32
+ const httpResponse = await serviceHandler.handle(httpRequest, {
33
+ tracer,
34
+ logger,
35
+ metrics,
36
+ });
37
+ return writeResponse(httpResponse, res);
38
+ });
39
+
40
+ server.listen(PORT);
41
+ console.log(`Started server on port ${PORT}...`);
@@ -0,0 +1,7 @@
1
+ import { ServiceContext } from "../context.js";
2
+ import { Echo as EchoOperation } from "../generated/ssdk/index.js";
3
+
4
+ export const Echo: EchoOperation<ServiceContext> = async (input, ctx) => {
5
+ ctx.logger.info('Starting Echo operation');
6
+ return input;
7
+ };
@@ -0,0 +1,8 @@
1
+ import { ServiceContext } from './context.js';
2
+ import { <%- apiNameClassName %>Service } from './generated/ssdk/index.js';
3
+ import { Echo } from './operations/echo.js';
4
+
5
+ // Register operations to the service here
6
+ export const Service: <%- apiNameClassName %>Service<ServiceContext> = {
7
+ Echo,
8
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { GeneratorCallback, Tree } from '@nx/devkit';
6
+ import { TsSmithyApiGeneratorSchema } from './schema';
7
+ import { NxGeneratorInfo } from '../../../utils/nx';
8
+ export declare const TS_SMITHY_API_GENERATOR_INFO: NxGeneratorInfo;
9
+ export declare const tsSmithyApiGenerator: (tree: Tree, options: TsSmithyApiGeneratorSchema) => Promise<GeneratorCallback>;
10
+ export default tsSmithyApiGenerator;
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tsSmithyApiGenerator = exports.TS_SMITHY_API_GENERATOR_INFO = void 0;
4
+ const tslib_1 = require("tslib");
5
+ /**
6
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
7
+ * SPDX-License-Identifier: Apache-2.0
8
+ */
9
+ const devkit_1 = require("@nx/devkit");
10
+ const nx_1 = require("../../../utils/nx");
11
+ const metrics_1 = require("../../../utils/metrics");
12
+ const format_1 = require("../../../utils/format");
13
+ const iac_1 = require("../../../utils/iac");
14
+ const shared_constructs_1 = require("../../../utils/shared-constructs");
15
+ const names_1 = require("../../../utils/names");
16
+ const generator_1 = tslib_1.__importStar(require("../../../ts/lib/generator"));
17
+ const port_1 = require("../../../utils/port");
18
+ const versions_1 = require("../../../utils/versions");
19
+ const generator_2 = tslib_1.__importDefault(require("../../project/generator"));
20
+ const bundle_1 = require("../../../utils/bundle/bundle");
21
+ const git_1 = require("../../../utils/git");
22
+ const eslint_1 = require("../../../ts/lib/eslint");
23
+ const fs_1 = require("../../../utils/fs");
24
+ const api_constructs_1 = require("../../../utils/api-constructs/api-constructs");
25
+ const open_api_metadata_1 = require("../../../utils/api-constructs/open-api-metadata");
26
+ exports.TS_SMITHY_API_GENERATOR_INFO = (0, nx_1.getGeneratorInfo)(__filename);
27
+ const tsSmithyApiGenerator = (tree, options) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
28
+ const apiNameClassName = (0, names_1.toClassName)(options.name);
29
+ const apiNameKebabCase = (0, names_1.toKebabCase)(options.name);
30
+ const { fullyQualifiedName: backendFullyQualifiedName, dir } = (0, generator_1.getTsLibDetails)(tree, options);
31
+ const modelProjectName = `${apiNameKebabCase}-model`;
32
+ // Generate the model project
33
+ yield (0, generator_2.default)(tree, {
34
+ name: modelProjectName,
35
+ serviceName: apiNameClassName,
36
+ namespace: options.namespace,
37
+ directory: dir,
38
+ subDirectory: 'model',
39
+ });
40
+ // Add metadata to associate backend project with model project
41
+ const modelProjectConfig = (0, nx_1.readProjectConfigurationUnqualified)(tree, modelProjectName);
42
+ (0, devkit_1.updateProjectConfiguration)(tree, modelProjectConfig.name, Object.assign(Object.assign({}, modelProjectConfig), { metadata: Object.assign(Object.assign({}, modelProjectConfig.metadata), { backendProject: backendFullyQualifiedName }) }));
43
+ // Generate the backend project
44
+ yield (0, generator_1.default)(tree, {
45
+ name: options.name,
46
+ directory: dir,
47
+ subDirectory: 'backend',
48
+ });
49
+ (0, nx_1.addGeneratorMetadata)(tree, backendFullyQualifiedName, exports.TS_SMITHY_API_GENERATOR_INFO, {
50
+ apiName: options.name,
51
+ auth: options.auth,
52
+ modelProject: modelProjectConfig.name,
53
+ });
54
+ const backendProjectConfig = (0, nx_1.readProjectConfigurationUnqualified)(tree, backendFullyQualifiedName);
55
+ const port = (0, port_1.assignPort)(tree, backendProjectConfig, 3001);
56
+ // Delete default index.ts with "hello" function
57
+ tree.delete((0, devkit_1.joinPathFragments)(backendProjectConfig.sourceRoot, 'index.ts'));
58
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), backendProjectConfig.sourceRoot, {
59
+ apiNameClassName,
60
+ port,
61
+ });
62
+ // Add infrastructure
63
+ const iacProvider = yield (0, iac_1.resolveIacProvider)(tree, options.iacProvider);
64
+ yield (0, shared_constructs_1.sharedConstructsGenerator)(tree, {
65
+ iacProvider,
66
+ });
67
+ (0, api_constructs_1.addApiGatewayInfra)(tree, {
68
+ iacProvider,
69
+ apiProjectName: backendFullyQualifiedName,
70
+ apiNameClassName,
71
+ apiNameKebabCase,
72
+ auth: options.auth,
73
+ constructType: 'rest', // While possible in theory, Smithy doesn't support HTTP APIs
74
+ backend: {
75
+ type: 'smithy',
76
+ dir: backendProjectConfig.root,
77
+ },
78
+ });
79
+ (0, open_api_metadata_1.addSharedConstructsOpenApiMetadataGenerateTarget)(tree, {
80
+ iacProvider,
81
+ apiNameKebabCase,
82
+ specPath: (0, devkit_1.joinPathFragments)('dist', modelProjectConfig.root, 'build', 'openapi', 'openapi.json'),
83
+ specBuildTargetName: `${modelProjectConfig.name}:build`,
84
+ });
85
+ // Add bundle target using rolldown
86
+ (0, bundle_1.addTypeScriptBundleTarget)(tree, backendProjectConfig, {
87
+ targetFilePath: 'src/handler.ts',
88
+ });
89
+ const cmd = new fs_1.FsCommands(tree);
90
+ const generatedSrcDirFromRoot = (0, devkit_1.joinPathFragments)(backendProjectConfig.sourceRoot, 'generated');
91
+ // Target for copying the ssdk built by the model
92
+ backendProjectConfig.targets['copy-ssdk'] = {
93
+ cache: true,
94
+ inputs: [
95
+ {
96
+ dependentTasksOutputFiles: '**/*',
97
+ },
98
+ ],
99
+ executor: 'nx:run-commands',
100
+ options: {
101
+ commands: [
102
+ cmd.rm(generatedSrcDirFromRoot),
103
+ cmd.mkdir(generatedSrcDirFromRoot),
104
+ cmd.cp((0, devkit_1.joinPathFragments)('dist', modelProjectConfig.root, 'build', 'ssdk'), (0, devkit_1.joinPathFragments)(generatedSrcDirFromRoot, 'ssdk')),
105
+ ],
106
+ parallel: false,
107
+ },
108
+ outputs: ['{projectRoot}/src/generated'],
109
+ dependsOn: [`${modelProjectConfig.name}:build`],
110
+ };
111
+ (0, nx_1.addDependencyToTargetIfNotPresent)(backendProjectConfig, 'compile', 'copy-ssdk');
112
+ // Add a project which continuously copies based on changes to the model project
113
+ // This allows the "serve" target to hot reload when the smithy model is changed
114
+ backendProjectConfig.targets['watch-copy-ssdk'] = {
115
+ executor: 'nx:run-commands',
116
+ options: {
117
+ command: `nx watch --projects=${modelProjectConfig.name} --includeDependentProjects -- nx run ${backendFullyQualifiedName}:copy-ssdk`,
118
+ },
119
+ continuous: true,
120
+ };
121
+ // Add serve target for running the server locally
122
+ backendProjectConfig.targets.serve = {
123
+ executor: 'nx:run-commands',
124
+ options: {
125
+ command: 'tsx --watch src/local-server.ts',
126
+ cwd: '{projectRoot}',
127
+ },
128
+ continuous: true,
129
+ dependsOn: ['copy-ssdk', 'watch-copy-ssdk'],
130
+ };
131
+ // Ignore generated code
132
+ (0, git_1.updateGitIgnore)(tree, backendProjectConfig.root, (patterns) => [
133
+ ...patterns,
134
+ 'src/generated',
135
+ ]);
136
+ (0, eslint_1.addIgnoresToEslintConfig)(tree, (0, devkit_1.joinPathFragments)(backendProjectConfig.root, 'eslint.config.mjs'), ['**/generated']);
137
+ (0, devkit_1.updateProjectConfiguration)(tree, backendFullyQualifiedName, backendProjectConfig);
138
+ (0, devkit_1.addDependenciesToPackageJson)(tree, (0, versions_1.withVersions)([
139
+ '@aws-smithy/server-apigateway',
140
+ '@aws-smithy/server-node',
141
+ '@middy/core',
142
+ '@aws-lambda-powertools/logger',
143
+ '@aws-lambda-powertools/tracer',
144
+ '@aws-lambda-powertools/metrics',
145
+ ]), (0, versions_1.withVersions)(['@types/aws-lambda']));
146
+ yield (0, metrics_1.addGeneratorMetricsIfApplicable)(tree, [exports.TS_SMITHY_API_GENERATOR_INFO]);
147
+ yield (0, format_1.formatFilesInSubtree)(tree);
148
+ return () => {
149
+ (0, devkit_1.installPackagesTask)(tree);
150
+ };
151
+ });
152
+ exports.tsSmithyApiGenerator = tsSmithyApiGenerator;
153
+ exports.default = exports.tsSmithyApiGenerator;
154
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/nx-plugin/src/smithy/ts/api/generator.ts"],"names":[],"mappings":";;;;AAAA;;;GAGG;AACH,uCAQoB;AAEpB,0CAM2B;AAC3B,oDAAyE;AACzE,kDAA6D;AAC7D,4CAAwD;AACxD,wEAA6E;AAC7E,gDAAgE;AAChE,+EAAgF;AAChF,8CAAiD;AACjD,sDAAuD;AACvD,gFAA6D;AAC7D,yDAAyE;AACzE,4CAAqD;AACrD,mDAAkE;AAClE,0CAA+C;AAC/C,iFAAkF;AAClF,uFAAmH;AAEtG,QAAA,4BAA4B,GACvC,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAExB,MAAM,oBAAoB,GAAG,CAClC,IAAU,EACV,OAAmC,EACP,EAAE;IAC9B,MAAM,gBAAgB,GAAG,IAAA,mBAAW,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,MAAM,gBAAgB,GAAG,IAAA,mBAAW,EAAC,O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IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;QAC7D,GAAG,QAAQ;QACX,eAAe;KAChB,CAAC,CAAC;IACH,IAAA,iCAAwB,EACtB,IAAI,EACJ,IAAA,0BAAiB,EAAC,oBAAoB,CAAC,IAAI,EAAE,mBAAmB,CAAC,EACjE,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,IAAA,mCAA0B,EACxB,IAAI,EACJ,yBAAyB,EACzB,oBAAoB,CACrB,CAAC;IAEF,IAAA,qCAA4B,EAC1B,IAAI,EACJ,IAAA,uBAAY,EAAC;QACX,+BAA+B;QAC/B,yBAAyB;QACzB,aAAa;QACb,+BAA+B;QAC/B,+BAA+B;QAC/B,gCAAgC;KACjC,CAAC,EACF,IAAA,uBAAY,EAAC,CAAC,mBAAmB,CAAC,CAAC,CACpC,CAAC;IAEF,MAAM,IAAA,yCAA+B,EAAC,IAAI,EAAE,CAAC,oCAA4B,CAAC,CAAC,CAAC;IAE5E,MAAM,IAAA,6BAAoB,EAAC,IAAI,CAAC,CAAC;IACjC,OAAO,GAAG,EAAE;QACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC,CAAA,CAAC;AApMW,QAAA,oBAAoB,wBAoM/B;AAEF,kBAAe,4BAAoB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ export interface TsSmithyApiGeneratorSchema {
6
+ name: string;
7
+ namespace?: string;
8
+ // Only API Gateway REST APIs are supported by Smithy
9
+ // https://smithy.io/2.0/languages/typescript/ts-ssdk/supported-endpoints.html#amazon-api-gateway-rest-apis-and-aws-lambda
10
+ computeType: 'ServerlessApiGatewayRestApi';
11
+ auth: 'IAM' | 'Cognito' | 'None';
12
+ directory?: TsProjectGeneratorSchema['directory'];
13
+ iacProvider: IacProviderOption;
14
+ }
@@ -0,0 +1,56 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "$id": "ts#smithy-api",
4
+ "title": "ts#smithy-api",
5
+ "description": "Create an API using Smithy and the Smithy TypeScript Server SDK",
6
+ "type": "object",
7
+ "properties": {
8
+ "name": {
9
+ "type": "string",
10
+ "description": "The name of the API (required). Used to generate class names and file paths.",
11
+ "$default": {
12
+ "$source": "argv",
13
+ "index": 0
14
+ },
15
+ "x-prompt": "What name would you like your API to have? i.e: MyApi"
16
+ },
17
+ "namespace": {
18
+ "type": "string",
19
+ "description": "The namespace for the Smithy API. Defaults to your monorepo scope",
20
+ "x-prompt": "What namespace would you like your API to have? i.e: com.example"
21
+ },
22
+ "computeType": {
23
+ "type": "string",
24
+ "description": "The type of compute to use to deploy this API.",
25
+ "default": "ServerlessApiGatewayRestApi",
26
+ "enum": ["ServerlessApiGatewayRestApi"],
27
+ "x-prompt": "What compute type would you like to deploy your API with?",
28
+ "x-priority": "internal"
29
+ },
30
+ "auth": {
31
+ "type": "string",
32
+ "description": "The method used to authenticate with your API. Choose between IAM (default), Cognito or None.",
33
+ "default": "IAM",
34
+ "enum": ["IAM", "Cognito", "None"],
35
+ "x-prompt": "How would you like users to authenticate with your API?",
36
+ "x-priority": "important"
37
+ },
38
+ "directory": {
39
+ "description": "The directory to store the application in.",
40
+ "type": "string",
41
+ "alias": "dir",
42
+ "x-priority": "important",
43
+ "default": "packages",
44
+ "x-prompt": "What directory would you like to store your application in?"
45
+ },
46
+ "iacProvider": {
47
+ "type": "string",
48
+ "description": "The preferred IaC provider. By default this is inherited from your initial selection.",
49
+ "enum": ["Inherit", "CDK", "Terraform"],
50
+ "x-priority": "important",
51
+ "default": "Inherit",
52
+ "x-prompt": "Which provider would you like to manage your infrastructure? (default: Inherit)"
53
+ }
54
+ },
55
+ "required": ["name"]
56
+ }
@@ -458,6 +458,9 @@ export class TestApi<
458
458
  allowOrigins: Cors.ALL_ORIGINS,
459
459
  allowMethods: Cors.ALL_METHODS,
460
460
  },
461
+ deployOptions: {
462
+ tracingEnabled: true,
463
+ },
461
464
  policy: new PolicyDocument({
462
465
  statements: [
463
466
  // Allow all callers to invoke the API in the resource policy, since auth is handled by Cognito
@@ -760,6 +763,9 @@ export class TestApi<
760
763
  allowOrigins: Cors.ALL_ORIGINS,
761
764
  allowMethods: Cors.ALL_METHODS,
762
765
  },
766
+ deployOptions: {
767
+ tracingEnabled: true,
768
+ },
763
769
  policy: new PolicyDocument({
764
770
  statements: [
765
771
  // Allow all callers to invoke the API in the resource policy
@@ -928,7 +934,11 @@ import {
928
934
  HttpApi as _HttpApi,
929
935
  HttpApiProps as _HttpApiProps,
930
936
  HttpMethod,
937
+ HttpStage,
938
+ LogGroupLogDestination,
931
939
  } from 'aws-cdk-lib/aws-apigatewayv2';
940
+ import { LogGroup } from 'aws-cdk-lib/aws-logs';
941
+ import { suppressRules } from '../checkov.js';
932
942
 
933
943
  /**
934
944
  * Properties for creating an HttpApi construct.
@@ -972,6 +982,9 @@ export class HttpApi<
972
982
  /** The underlying CDK HttpApi instance */
973
983
  public readonly api: _HttpApi;
974
984
 
985
+ /** Default auto-deployed stage */
986
+ public readonly defaultStage: HttpStage;
987
+
975
988
  /** Map of operation names to their API Gateway integrations */
976
989
  public readonly integrations: TIntegrations;
977
990
 
@@ -990,9 +1003,30 @@ export class HttpApi<
990
1003
 
991
1004
  // Create the API Gateway REST API
992
1005
  this.api = new _HttpApi(this, 'Api', {
1006
+ createDefaultStage: false,
993
1007
  ...props,
994
1008
  });
995
1009
 
1010
+ const accessLogGroup = new LogGroup(this, 'AccessLogs');
1011
+ suppressRules(
1012
+ accessLogGroup,
1013
+ ['CKV_AWS_158'],
1014
+ 'Using default CloudWatch log encryption',
1015
+ );
1016
+ suppressRules(
1017
+ accessLogGroup,
1018
+ ['CKV_AWS_66', 'CKV_AWS_338'],
1019
+ 'Logs are retained forever',
1020
+ );
1021
+
1022
+ this.defaultStage = new HttpStage(this, 'DefaultStage', {
1023
+ httpApi: this.api,
1024
+ autoDeploy: true,
1025
+ accessLogSettings: {
1026
+ destination: new LogGroupLogDestination(accessLogGroup),
1027
+ },
1028
+ });
1029
+
996
1030
  // Create API resources and methods for each operation
997
1031
  (Object.entries(operations) as [TOperation, OperationDetails][]).map(
998
1032
  ([op, details]) => {
@@ -1008,15 +1042,22 @@ export class HttpApi<
1008
1042
  );
1009
1043
 
1010
1044
  new CfnOutput(this, \`\${apiName}Url\`, {
1011
- value: this.api.url!,
1045
+ value: this.defaultStage.url!,
1012
1046
  });
1013
1047
 
1014
1048
  // Register the API URL in runtime configuration for client discovery
1015
1049
  RuntimeConfig.ensure(this).config.apis = {
1016
1050
  ...RuntimeConfig.ensure(this).config.apis!,
1017
- [apiName]: this.api.url!,
1051
+ [apiName]: this.defaultStage.url!,
1018
1052
  };
1019
1053
  }
1054
+
1055
+ /**
1056
+ * Return the API url
1057
+ */
1058
+ public get url() {
1059
+ return this.defaultStage.url;
1060
+ }
1020
1061
  }
1021
1062
  "
1022
1063
  `;
@@ -1456,9 +1497,11 @@ import {
1456
1497
  RestApi as _RestApi,
1457
1498
  RestApiProps as _RestApiProps,
1458
1499
  IResource,
1500
+ Stage,
1459
1501
  } from 'aws-cdk-lib/aws-apigateway';
1460
1502
  import { RuntimeConfig } from '../runtime-config.js';
1461
1503
  import { OperationDetails, RestApiIntegration } from './utils.js';
1504
+ import { suppressRules } from '../checkov.js';
1462
1505
 
1463
1506
  /**
1464
1507
  * Properties for creating a RestApi construct.
@@ -1521,6 +1564,19 @@ export class RestApi<
1521
1564
  // Create the API Gateway REST API
1522
1565
  this.api = new _RestApi(this, 'Api', props);
1523
1566
 
1567
+ suppressRules(
1568
+ this.api,
1569
+ ['CKV_AWS_120'],
1570
+ 'Caching not required for this use case',
1571
+ (c) => c instanceof Stage,
1572
+ );
1573
+ suppressRules(
1574
+ this.api,
1575
+ ['CKV_AWS_76'],
1576
+ 'API Gateway access logging disabled due to account-level CloudWatch Logs role ARN requirement',
1577
+ (c) => c instanceof Stage,
1578
+ );
1579
+
1524
1580
  // Create API resources and methods for each operation
1525
1581
  (Object.entries(operations) as [TOperation, OperationDetails][]).map(
1526
1582
  ([op, details]) => {
@@ -1674,6 +1730,9 @@ export class TestApi<
1674
1730
  allowOrigins: Cors.ALL_ORIGINS,
1675
1731
  allowMethods: Cors.ALL_METHODS,
1676
1732
  },
1733
+ deployOptions: {
1734
+ tracingEnabled: true,
1735
+ },
1677
1736
  policy: new PolicyDocument({
1678
1737
  statements: [
1679
1738
  // Here we grant any AWS credentials from the account that the project is deployed in to call the api.
@@ -20,10 +20,10 @@ const metrics_1 = require("../../utils/metrics");
20
20
  const api_constructs_1 = require("../../utils/api-constructs/api-constructs");
21
21
  const port_1 = require("../../utils/port");
22
22
  const iac_1 = require("../../utils/iac");
23
+ const bundle_1 = require("../../utils/bundle/bundle");
23
24
  exports.TRPC_BACKEND_GENERATOR_INFO = (0, nx_1.getGeneratorInfo)(__filename);
24
25
  function tsTrpcApiGenerator(tree, options) {
25
26
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
26
- var _a;
27
27
  const iacProvider = yield (0, iac_1.resolveIacProvider)(tree, options.iacProvider);
28
28
  yield (0, shared_constructs_1.sharedConstructsGenerator)(tree, {
29
29
  iacProvider,
@@ -65,18 +65,10 @@ function tsTrpcApiGenerator(tree, options) {
65
65
  },
66
66
  continuous: true,
67
67
  };
68
- projectConfig.targets.bundle = {
69
- cache: true,
70
- executor: 'nx:run-commands',
71
- outputs: [`{workspaceRoot}/dist/${backendRoot}/bundle`],
72
- options: {
73
- command: `esbuild ${backendRoot}/src/router.ts --bundle --outfile=dist/${backendRoot}/bundle/index.js --platform=node --format=cjs`,
74
- },
75
- };
76
- projectConfig.targets.build.dependsOn = [
77
- ...((_a = projectConfig.targets.build.dependsOn) !== null && _a !== void 0 ? _a : []),
78
- 'bundle',
79
- ];
68
+ (0, bundle_1.addTypeScriptBundleTarget)(tree, projectConfig, {
69
+ targetFilePath: 'src/router.ts',
70
+ });
71
+ (0, nx_1.addDependencyToTargetIfNotPresent)(projectConfig, 'build', 'bundle');
80
72
  projectConfig.targets = (0, object_1.sortObjectKeys)(projectConfig.targets);
81
73
  (0, devkit_1.updateProjectConfiguration)(tree, projectConfig.name, projectConfig);
82
74
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), backendRoot, enhancedOptions, {
@@ -93,13 +85,7 @@ function tsTrpcApiGenerator(tree, options) {
93
85
  '@trpc/client',
94
86
  'aws4fetch',
95
87
  '@aws-sdk/credential-providers',
96
- ]), (0, versions_1.withVersions)([
97
- '@types/aws-lambda',
98
- 'esbuild',
99
- 'tsx',
100
- 'cors',
101
- '@types/cors',
102
- ]));
88
+ ]), (0, versions_1.withVersions)(['@types/aws-lambda', 'tsx', 'cors', '@types/cors']));
103
89
  tree.delete((0, devkit_1.joinPathFragments)(backendRoot, 'package.json'));
104
90
  (0, nx_1.addGeneratorMetadata)(tree, backendName, exports.TRPC_BACKEND_GENERATOR_INFO);
105
91
  yield (0, metrics_1.addGeneratorMetricsIfApplicable)(tree, [exports.TRPC_BACKEND_GENERATOR_INFO]);
@@ -1 +1 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/trpc/backend/generator.ts"],"names":[],"mappings":";;;AAoCA,gDAqIC;;AAzKD;;;GAGG;AACH,uCASoB;AAEpB,qEAA0E;AAC1E,+EAAwD;AACxD,qDAAwE;AACxE,mDAAoD;AACpD,6CAA2D;AAC3D,+CAA0D;AAC1D,+CAAoD;AACpD,uCAKwB;AACxB,iDAAsE;AACtE,8EAA+E;AAC/E,2CAA8C;AAC9C,yCAAqD;AAExC,QAAA,2BAA2B,GACtC,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAE/B,SAAsB,kBAAkB,CACtC,IAAU,EACV,OAAiC;;;QAEjC,MAAM,WAAW,GAAG,MAAM,IAAA,wBAAkB,EAAC,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,C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CAAC;IACnD,CAAC;SAAM,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QACtC,OAAO,yCAAyC,CAAC;IACnD,CAAC;IACD,OAAO,wBAAwB,CAAC;AAClC,CAAC,CAAC;AAEF,kBAAe,kBAAkB,CAAC"}
@@ -4,11 +4,12 @@
4
4
  */
5
5
  import { Linter } from '@nx/eslint';
6
6
  import { IacProviderOption } from '../../utils/iac';
7
+ import { TsProjectGeneratorSchema } from '../../ts/lib/schema';
7
8
 
8
9
  export interface TsTrpcApiGeneratorSchema {
9
10
  name: string;
10
11
  computeType: 'ServerlessApiGatewayRestApi' | 'ServerlessApiGatewayHttpApi';
11
12
  auth: 'IAM' | 'Cognito' | 'None';
12
- directory?: TsLibGeneratorSchema['directory'];
13
+ directory?: TsProjectGeneratorSchema['directory'];
13
14
  iacProvider: IacProviderOption;
14
15
  }
@@ -15,7 +15,7 @@ export class TestProjectTestFunction extends Function {
15
15
  code: Code.fromAsset(
16
16
  url.fileURLToPath(
17
17
  new URL(
18
- '../../../../../../dist/packages/test-project/bundle-test-function',
18
+ '../../../../../../dist/packages/test-project/bundle/lambda/test-function',
19
19
  import.meta.url,
20
20
  ),
21
21
  ),
@@ -233,7 +233,7 @@ resource "aws_iam_role_policy_attachment" "lambda_policy_attachment" {
233
233
 
234
234
  data "archive_file" "lambda_zip" {
235
235
  type = "zip"
236
- source_dir = "\${path.module}/../../../../../../../dist/packages/test-project/bundle-test-function"
236
+ source_dir = "\${path.module}/../../../../../../../dist/packages/test-project/bundle/lambda/test-function"
237
237
  output_path = "\${path.module}/../../../../../../../dist/packages/common/terraform/lambda-functions/test-project-test-function/lambda.zip"
238
238
  }
239
239
 
@@ -388,7 +388,7 @@ resource "aws_iam_role_policy_attachment" "lambda_policy_attachment" {
388
388
 
389
389
  data "archive_file" "lambda_zip" {
390
390
  type = "zip"
391
- source_dir = "\${path.module}/../../../../../../../dist/packages/test-project/bundle-snapshot-function"
391
+ source_dir = "\${path.module}/../../../../../../../dist/packages/test-project/bundle/lambda/snapshot-function"
392
392
  output_path = "\${path.module}/../../../../../../../dist/packages/common/terraform/lambda-functions/test-project-snapshot-function/lambda.zip"
393
393
  }
394
394