@aws/nx-plugin 1.0.0-rc.54 → 1.0.0-rc.55
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/migrations.json +45 -0
- package/package.json +1 -1
- package/src/agentcore-gateway/gateway-connection/generator.js +3 -1
- package/src/agentcore-gateway/gateway-connection/generator.js.map +1 -1
- package/src/agentcore-gateway/generator.d.ts +49 -1
- package/src/agentcore-gateway/generator.js +55 -22
- package/src/agentcore-gateway/generator.js.map +1 -1
- package/src/agentcore-gateway/mcp-connection/generator.js +3 -1
- package/src/agentcore-gateway/mcp-connection/generator.js.map +1 -1
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +2 -0
- package/src/infra/app/generator.d.ts +43 -0
- package/src/infra/app/generator.js +47 -18
- package/src/infra/app/generator.js.map +1 -1
- package/src/init/generator.d.ts +13 -0
- package/src/init/generator.js +14 -3
- package/src/init/generator.js.map +1 -1
- package/src/migrations/latest/backfill-generator-metadata/migration.d.ts +96 -0
- package/src/migrations/latest/backfill-generator-metadata/migration.js +670 -0
- package/src/migrations/latest/backfill-generator-metadata/migration.js.map +1 -0
- package/src/preset/generator.d.ts +13 -0
- package/src/preset/generator.js +12 -3
- package/src/preset/generator.js.map +1 -1
- package/src/py/agent/a2a-connection/generator.d.ts +24 -0
- package/src/py/agent/a2a-connection/generator.js +49 -20
- package/src/py/agent/a2a-connection/generator.js.map +1 -1
- package/src/py/agent/gateway-connection/generator.d.ts +23 -0
- package/src/py/agent/gateway-connection/generator.js +45 -11
- package/src/py/agent/gateway-connection/generator.js.map +1 -1
- package/src/py/agent/generator.d.ts +146 -1
- package/src/py/agent/generator.js +173 -76
- package/src/py/agent/generator.js.map +1 -1
- package/src/py/agent/mcp-connection/generator.d.ts +23 -0
- package/src/py/agent/mcp-connection/generator.js +45 -11
- package/src/py/agent/mcp-connection/generator.js.map +1 -1
- package/src/py/agent/react-connection/generator.d.ts +146 -0
- package/src/py/agent/react-connection/generator.js +27 -4
- package/src/py/agent/react-connection/generator.js.map +1 -1
- package/src/py/dynamodb/agent-connection/__snapshots__/generator.spec.ts.snap +18 -0
- package/src/py/dynamodb/agent-connection/generator.js +7 -1
- package/src/py/dynamodb/agent-connection/generator.js.map +1 -1
- package/src/py/dynamodb/fast-api-connection/__snapshots__/generator.spec.ts.snap +9 -0
- package/src/py/dynamodb/fast-api-connection/generator.js +3 -1
- package/src/py/dynamodb/fast-api-connection/generator.js.map +1 -1
- package/src/py/dynamodb/generator.d.ts +29 -0
- package/src/py/dynamodb/generator.js +32 -12
- package/src/py/dynamodb/generator.js.map +1 -1
- package/src/py/dynamodb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +18 -0
- package/src/py/dynamodb/mcp-server-connection/generator.js +7 -1
- package/src/py/dynamodb/mcp-server-connection/generator.js.map +1 -1
- package/src/py/fast-api/generator.d.ts +63 -0
- package/src/py/fast-api/generator.js +58 -23
- package/src/py/fast-api/generator.js.map +1 -1
- package/src/py/fast-api/react/generator.d.ts +16 -1
- package/src/py/fast-api/react/generator.js +15 -3
- package/src/py/fast-api/react/generator.js.map +1 -1
- package/src/py/lambda-function/generator.d.ts +21 -0
- package/src/py/lambda-function/generator.js +29 -10
- package/src/py/lambda-function/generator.js.map +1 -1
- package/src/py/mcp-server/generator.d.ts +60 -0
- package/src/py/mcp-server/generator.js +62 -25
- package/src/py/mcp-server/generator.js.map +1 -1
- package/src/py/project/generator.d.ts +13 -0
- package/src/py/project/generator.js +29 -10
- package/src/py/project/generator.js.map +1 -1
- package/src/py/rdb/agent-connection/__snapshots__/generator.spec.ts.snap +19 -0
- package/src/py/rdb/agent-connection/generator.js +7 -1
- package/src/py/rdb/agent-connection/generator.js.map +1 -1
- package/src/py/rdb/fast-api-connection/__snapshots__/generator.spec.ts.snap +7 -0
- package/src/py/rdb/fast-api-connection/generator.js +3 -1
- package/src/py/rdb/fast-api-connection/generator.js.map +1 -1
- package/src/py/rdb/generator.d.ts +89 -0
- package/src/py/rdb/generator.js +88 -40
- package/src/py/rdb/generator.js.map +1 -1
- package/src/py/rdb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +18 -0
- package/src/py/rdb/mcp-server-connection/generator.js +7 -1
- package/src/py/rdb/mcp-server-connection/generator.js.map +1 -1
- package/src/smithy/project/generator.d.ts +7 -0
- package/src/smithy/project/generator.js +8 -2
- package/src/smithy/project/generator.js.map +1 -1
- package/src/smithy/react-connection/generator.d.ts +15 -0
- package/src/smithy/react-connection/generator.js +17 -3
- package/src/smithy/react-connection/generator.js.map +1 -1
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +1 -0
- package/src/smithy/ts/api/generator.d.ts +79 -0
- package/src/smithy/ts/api/generator.js +77 -33
- package/src/smithy/ts/api/generator.js.map +1 -1
- package/src/terraform/project/generator.d.ts +50 -0
- package/src/terraform/project/generator.js +63 -17
- package/src/terraform/project/generator.js.map +1 -1
- package/src/trpc/backend/generator.d.ts +84 -0
- package/src/trpc/backend/generator.js +98 -38
- package/src/trpc/backend/generator.js.map +1 -1
- package/src/trpc/react/generator.d.ts +37 -0
- package/src/trpc/react/generator.js +63 -26
- package/src/trpc/react/generator.js.map +1 -1
- package/src/ts/agent/a2a-connection/generator.d.ts +46 -0
- package/src/ts/agent/a2a-connection/generator.js +53 -16
- package/src/ts/agent/a2a-connection/generator.js.map +1 -1
- package/src/ts/agent/gateway-connection/generator.d.ts +37 -0
- package/src/ts/agent/gateway-connection/generator.js +41 -14
- package/src/ts/agent/gateway-connection/generator.js.map +1 -1
- package/src/ts/agent/generator.d.ts +162 -0
- package/src/ts/agent/generator.js +166 -75
- package/src/ts/agent/generator.js.map +1 -1
- package/src/ts/agent/mcp-connection/generator.d.ts +37 -0
- package/src/ts/agent/mcp-connection/generator.js +41 -14
- package/src/ts/agent/mcp-connection/generator.js.map +1 -1
- package/src/ts/agent/react-connection/generator.d.ts +186 -0
- package/src/ts/agent/react-connection/generator.js +70 -21
- package/src/ts/agent/react-connection/generator.js.map +1 -1
- package/src/ts/astro-docs/generator.d.ts +38 -0
- package/src/ts/astro-docs/generator.js +58 -19
- package/src/ts/astro-docs/generator.js.map +1 -1
- package/src/ts/dcr-proxy/generator.d.ts +24 -0
- package/src/ts/dcr-proxy/generator.js +31 -14
- package/src/ts/dcr-proxy/generator.js.map +1 -1
- package/src/ts/dynamodb/agent-connection/__snapshots__/generator.spec.ts.snap +18 -0
- package/src/ts/dynamodb/agent-connection/generator.js +7 -1
- package/src/ts/dynamodb/agent-connection/generator.js.map +1 -1
- package/src/ts/dynamodb/generator.d.ts +41 -0
- package/src/ts/dynamodb/generator.js +47 -20
- package/src/ts/dynamodb/generator.js.map +1 -1
- package/src/ts/dynamodb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +18 -0
- package/src/ts/dynamodb/mcp-server-connection/generator.js +7 -1
- package/src/ts/dynamodb/mcp-server-connection/generator.js.map +1 -1
- package/src/ts/dynamodb/smithy-connection/__snapshots__/generator.spec.ts.snap +9 -0
- package/src/ts/dynamodb/smithy-connection/generator.js +3 -1
- package/src/ts/dynamodb/smithy-connection/generator.js.map +1 -1
- package/src/ts/dynamodb/trpc-connection/__snapshots__/generator.spec.ts.snap +9 -0
- package/src/ts/dynamodb/trpc-connection/generator.js +3 -1
- package/src/ts/dynamodb/trpc-connection/generator.js.map +1 -1
- package/src/ts/lambda-function/generator.d.ts +38 -0
- package/src/ts/lambda-function/generator.js +49 -20
- package/src/ts/lambda-function/generator.js.map +1 -1
- package/src/ts/lib/generator.d.ts +7 -0
- package/src/ts/lib/generator.js +8 -1
- package/src/ts/lib/generator.js.map +1 -1
- package/src/ts/lib/ts-project-utils.d.ts +3 -1
- package/src/ts/lib/ts-project-utils.js +3 -2
- package/src/ts/lib/ts-project-utils.js.map +1 -1
- package/src/ts/lib/vitest.d.ts +10 -1
- package/src/ts/lib/vitest.js +14 -2
- package/src/ts/lib/vitest.js.map +1 -1
- package/src/ts/mcp-server/generator.d.ts +71 -0
- package/src/ts/mcp-server/generator.js +73 -36
- package/src/ts/mcp-server/generator.js.map +1 -1
- package/src/ts/nx-generator/generator.d.ts +3 -0
- package/src/ts/nx-generator/generator.js +8 -2
- package/src/ts/nx-generator/generator.js.map +1 -1
- package/src/ts/nx-migration/generator.d.ts +3 -0
- package/src/ts/nx-migration/generator.js +8 -2
- package/src/ts/nx-migration/generator.js.map +1 -1
- package/src/ts/nx-plugin/generator.d.ts +3 -0
- package/src/ts/nx-plugin/generator.js +8 -2
- package/src/ts/nx-plugin/generator.js.map +1 -1
- package/src/ts/nx-plugin/utils.d.ts +7 -2
- package/src/ts/nx-plugin/utils.js +10 -4
- package/src/ts/nx-plugin/utils.js.map +1 -1
- package/src/ts/rdb/agent-connection/__snapshots__/generator.spec.ts.snap +10 -0
- package/src/ts/rdb/agent-connection/generator.js +8 -1
- package/src/ts/rdb/agent-connection/generator.js.map +1 -1
- package/src/ts/rdb/generator.d.ts +101 -0
- package/src/ts/rdb/generator.js +93 -41
- package/src/ts/rdb/generator.js.map +1 -1
- package/src/ts/rdb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +10 -0
- package/src/ts/rdb/mcp-server-connection/generator.js +8 -1
- package/src/ts/rdb/mcp-server-connection/generator.js.map +1 -1
- package/src/ts/rdb/smithy-connection/__snapshots__/generator.spec.ts.snap +9 -0
- package/src/ts/rdb/smithy-connection/generator.js +4 -1
- package/src/ts/rdb/smithy-connection/generator.js.map +1 -1
- package/src/ts/rdb/trpc-connection/__snapshots__/generator.spec.ts.snap +9 -0
- package/src/ts/rdb/trpc-connection/generator.js +3 -1
- package/src/ts/rdb/trpc-connection/generator.js.map +1 -1
- package/src/ts/react-website/agui/generator.d.ts +86 -0
- package/src/ts/react-website/agui/generator.js +63 -28
- package/src/ts/react-website/agui/generator.js.map +1 -1
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +8 -2
- package/src/ts/react-website/app/generator.d.ts +136 -1
- package/src/ts/react-website/app/generator.js +109 -40
- package/src/ts/react-website/app/generator.js.map +1 -1
- package/src/ts/react-website/cognito-auth/generator.d.ts +19 -0
- package/src/ts/react-website/cognito-auth/generator.js +21 -9
- package/src/ts/react-website/cognito-auth/generator.js.map +1 -1
- package/src/utils/add-dependencies.d.ts +38 -0
- package/src/utils/add-dependencies.js +83 -0
- package/src/utils/add-dependencies.js.map +1 -0
- package/src/utils/agent-connection/agent-connection.d.ts +27 -6
- package/src/utils/agent-connection/agent-connection.js +47 -18
- package/src/utils/agent-connection/agent-connection.js.map +1 -1
- package/src/utils/agent-core-constructs/agent-core-constructs.d.ts +19 -1
- package/src/utils/agent-core-constructs/agent-core-constructs.js +26 -6
- package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
- package/src/utils/api-constructs/api-constructs.d.ts +21 -2
- package/src/utils/api-constructs/api-constructs.js +26 -5
- package/src/utils/api-constructs/api-constructs.js.map +1 -1
- package/src/utils/bundle/bundle.d.ts +6 -1
- package/src/utils/bundle/bundle.js +8 -2
- package/src/utils/bundle/bundle.js.map +1 -1
- package/src/utils/commands.d.ts +5 -4
- package/src/utils/commands.js +2 -6
- package/src/utils/commands.js.map +1 -1
- package/src/utils/connection/open-api/react.d.ts +18 -1
- package/src/utils/connection/open-api/react.js +27 -3
- package/src/utils/connection/open-api/react.js.map +1 -1
- package/src/utils/declared-dependencies.d.ts +140 -0
- package/src/utils/declared-dependencies.js +64 -0
- package/src/utils/declared-dependencies.js.map +1 -0
- package/src/utils/docker.d.ts +10 -1
- package/src/utils/docker.js +7 -3
- package/src/utils/docker.js.map +1 -1
- package/src/utils/fs.d.ts +15 -4
- package/src/utils/fs.js +26 -13
- package/src/utils/fs.js.map +1 -1
- package/src/utils/init.d.ts +14 -1
- package/src/utils/init.js +25 -7
- package/src/utils/init.js.map +1 -1
- package/src/utils/migration-versions.d.ts +15 -1
- package/src/utils/migration-versions.js +53 -7
- package/src/utils/migration-versions.js.map +1 -1
- package/src/utils/nx.d.ts +18 -0
- package/src/utils/nx.js +4 -0
- package/src/utils/nx.js.map +1 -1
- package/src/utils/py.d.ts +3 -2
- package/src/utils/py.js +10 -10
- package/src/utils/py.js.map +1 -1
- package/src/utils/shared-constructs-constants.d.ts +39 -4
- package/src/utils/shared-constructs-constants.js +29 -0
- package/src/utils/shared-constructs-constants.js.map +1 -1
- package/src/utils/shared-constructs.d.ts +4 -1
- package/src/utils/shared-constructs.js +5 -4
- package/src/utils/shared-constructs.js.map +1 -1
- package/src/utils/shared-dynamodb-scripts.d.ts +8 -1
- package/src/utils/shared-dynamodb-scripts.js +11 -3
- package/src/utils/shared-dynamodb-scripts.js.map +1 -1
- package/src/utils/shared-infra-scripts.d.ts +16 -1
- package/src/utils/shared-infra-scripts.js +18 -3
- package/src/utils/shared-infra-scripts.js.map +1 -1
- package/src/utils/shared-rdb-scripts.d.ts +12 -1
- package/src/utils/shared-rdb-scripts.js +17 -3
- package/src/utils/shared-rdb-scripts.js.map +1 -1
- package/src/utils/shared-shadcn.d.ts +26 -1
- package/src/utils/shared-shadcn.js +31 -14
- package/src/utils/shared-shadcn.js.map +1 -1
- package/src/utils/version-upgrade-migration/migration.d.ts +14 -0
- package/src/utils/version-upgrade-migration/migration.js +16 -0
- package/src/utils/version-upgrade-migration/migration.js.map +1 -0
- package/src/utils/version-upgrade-migration/nx-package-updates.d.ts +35 -0
- package/src/utils/version-upgrade-migration/nx-package-updates.js +42 -0
- package/src/utils/version-upgrade-migration/nx-package-updates.js.map +1 -0
- package/src/utils/version-upgrade-migration/owned-dependencies.d.ts +50 -0
- package/src/utils/version-upgrade-migration/owned-dependencies.js +98 -0
- package/src/utils/version-upgrade-migration/owned-dependencies.js.map +1 -0
- package/src/utils/version-upgrade-migration/register.d.ts +18 -0
- package/src/utils/version-upgrade-migration/register.js +33 -0
- package/src/utils/version-upgrade-migration/register.js.map +1 -0
- package/src/utils/version-upgrade-migration/sync-metrics-version.d.ts +13 -0
- package/src/utils/version-upgrade-migration/sync-metrics-version.js +33 -0
- package/src/utils/version-upgrade-migration/sync-metrics-version.js.map +1 -0
- package/src/utils/version-upgrade-migration/sync-vended-versions.d.ts +10 -0
- package/src/utils/version-upgrade-migration/sync-vended-versions.js +504 -0
- package/src/utils/version-upgrade-migration/sync-vended-versions.js.map +1 -0
- package/src/utils/version-upgrade-migration/vended-upgrade.d.ts +14 -0
- package/src/utils/version-upgrade-migration/vended-upgrade.js +40 -0
- package/src/utils/version-upgrade-migration/vended-upgrade.js.map +1 -0
- package/src/utils/versions.d.ts +25 -5
- package/src/utils/versions.js +46 -4
- package/src/utils/versions.js.map +1 -1
|
@@ -3,19 +3,34 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/ import { generateFiles, joinPathFragments, OverwriteStrategy, updateProjectConfiguration } from "@nx/devkit";
|
|
5
5
|
import tsProjectGenerator from "../lib/generator.js";
|
|
6
|
-
import {
|
|
6
|
+
import { addTsDependencies } from "../../utils/add-dependencies.js";
|
|
7
|
+
import { addTypeScriptBundleTarget, BUNDLE_DEPENDENCIES } from "../../utils/bundle/bundle.js";
|
|
7
8
|
import { addDcrProxyInfra, DCR_PROXY_HANDLERS } from "../../utils/dcr-proxy-constructs/dcr-proxy-constructs.js";
|
|
8
|
-
import {
|
|
9
|
+
import { declareDependencies, ownedElsewhere } from "../../utils/declared-dependencies.js";
|
|
9
10
|
import { formatFilesInSubtree } from "../../utils/format.js";
|
|
10
11
|
import { resolveIac } from "../../utils/iac.js";
|
|
11
12
|
import { installDependencies } from "../../utils/install.js";
|
|
12
13
|
import { addGeneratorMetricsIfApplicable } from "../../utils/metrics.js";
|
|
13
14
|
import { kebabCase, toClassName } from "../../utils/names.js";
|
|
14
15
|
import { getNpmScopePrefix } from "../../utils/npm-scope.js";
|
|
15
|
-
import { getGeneratorInfo, readProjectConfigurationUnqualified } from "../../utils/nx.js";
|
|
16
|
+
import { addGeneratorMetadata, getGeneratorInfo, readProjectConfigurationUnqualified } from "../../utils/nx.js";
|
|
16
17
|
import { sortObjectKeys } from "../../utils/object.js";
|
|
17
|
-
import { sharedConstructsGenerator } from "../../utils/shared-constructs.js";
|
|
18
|
-
|
|
18
|
+
import { SHARED_CONSTRUCTS_DEPENDENCIES, sharedConstructsGenerator } from "../../utils/shared-constructs.js";
|
|
19
|
+
export const DEPENDENCIES = declareDependencies()({
|
|
20
|
+
ts: [
|
|
21
|
+
// Handler imports: @aws-sdk/client-secrets-manager (token handler) and
|
|
22
|
+
// @types/aws-lambda (handler signatures).
|
|
23
|
+
{
|
|
24
|
+
name: '@aws-sdk/client-secrets-manager'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: '@types/aws-lambda',
|
|
28
|
+
dev: true
|
|
29
|
+
},
|
|
30
|
+
...ownedElsewhere(BUNDLE_DEPENDENCIES),
|
|
31
|
+
...ownedElsewhere(SHARED_CONSTRUCTS_DEPENDENCIES)
|
|
32
|
+
]
|
|
33
|
+
});
|
|
19
34
|
export const TS_DCR_PROXY_GENERATOR_INFO = getGeneratorInfo(import.meta.filename);
|
|
20
35
|
export const tsDcrProxyGenerator = async (tree, options)=>{
|
|
21
36
|
const name = kebabCase(options.name ? options.name : 'dcr-proxy');
|
|
@@ -49,13 +64,9 @@ export const tsDcrProxyGenerator = async (tree, options)=>{
|
|
|
49
64
|
}, {
|
|
50
65
|
overwriteStrategy: OverwriteStrategy.KeepExisting
|
|
51
66
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
'@aws-sdk/client-secrets-manager'
|
|
56
|
-
]), withVersions([
|
|
57
|
-
'@types/aws-lambda'
|
|
58
|
-
]), joinPathFragments(proxyRoot, 'package.json'));
|
|
67
|
+
addTsDependencies(tree, DEPENDENCIES, {
|
|
68
|
+
projectRoot: proxyRoot
|
|
69
|
+
});
|
|
59
70
|
// Bundle each handler independently to dist/<root>/bundle/<handler>/index.js
|
|
60
71
|
for (const handler of DCR_PROXY_HANDLERS){
|
|
61
72
|
await addTypeScriptBundleTarget(tree, projectConfig, {
|
|
@@ -65,17 +76,23 @@ export const tsDcrProxyGenerator = async (tree, options)=>{
|
|
|
65
76
|
/@aws-sdk\/.*/
|
|
66
77
|
],
|
|
67
78
|
platform: 'node'
|
|
68
|
-
});
|
|
79
|
+
}, DEPENDENCIES);
|
|
69
80
|
}
|
|
70
81
|
projectConfig.targets = sortObjectKeys(projectConfig.targets);
|
|
71
82
|
updateProjectConfiguration(tree, projectConfig.name, projectConfig);
|
|
83
|
+
// Recorded over the `ts#project` id the underlying generator wrote, so the
|
|
84
|
+
// version sync attributes this project's dependencies to this generator.
|
|
85
|
+
// After the write above, which would otherwise revert it.
|
|
86
|
+
addGeneratorMetadata(tree, projectConfig.name, TS_DCR_PROXY_GENERATOR_INFO, {
|
|
87
|
+
iac
|
|
88
|
+
});
|
|
72
89
|
const bundlePathsFromRoot = Object.fromEntries(DCR_PROXY_HANDLERS.map((handler)=>[
|
|
73
90
|
handler,
|
|
74
91
|
joinPathFragments('dist', proxyRoot, 'bundle', handler)
|
|
75
92
|
]));
|
|
76
93
|
await sharedConstructsGenerator(tree, {
|
|
77
94
|
iac
|
|
78
|
-
});
|
|
95
|
+
}, DEPENDENCIES);
|
|
79
96
|
await addDcrProxyInfra(tree, {
|
|
80
97
|
dcrProxyNameClassName: nameClassName,
|
|
81
98
|
dcrProxyNameKebabCase: name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/dcr-proxy/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport tsProjectGenerator from '../../ts/lib/generator';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/dcr-proxy/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport tsProjectGenerator from '../../ts/lib/generator';\nimport { addTsDependencies } from '../../utils/add-dependencies';\nimport {\n addTypeScriptBundleTarget,\n BUNDLE_DEPENDENCIES,\n} from '../../utils/bundle/bundle';\nimport {\n addDcrProxyInfra,\n DCR_PROXY_HANDLERS,\n type DcrProxyHandler,\n} from '../../utils/dcr-proxy-constructs/dcr-proxy-constructs';\nimport {\n declareDependencies,\n ownedElsewhere,\n} from '../../utils/declared-dependencies';\nimport { formatFilesInSubtree } from '../../utils/format';\nimport { resolveIac } from '../../utils/iac';\nimport { installDependencies } from '../../utils/install';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics';\nimport { kebabCase, toClassName } from '../../utils/names';\nimport { getNpmScopePrefix } from '../../utils/npm-scope';\nimport {\n addGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../utils/nx';\nimport { sortObjectKeys } from '../../utils/object';\nimport {\n SHARED_CONSTRUCTS_DEPENDENCIES,\n sharedConstructsGenerator,\n} from '../../utils/shared-constructs';\nimport type { TsDcrProxyGeneratorSchema } from './schema';\n\nexport const DEPENDENCIES = declareDependencies()({\n ts: [\n // Handler imports: @aws-sdk/client-secrets-manager (token handler) and\n // @types/aws-lambda (handler signatures).\n { name: '@aws-sdk/client-secrets-manager' },\n { name: '@types/aws-lambda', dev: true },\n ...ownedElsewhere(BUNDLE_DEPENDENCIES),\n ...ownedElsewhere(SHARED_CONSTRUCTS_DEPENDENCIES),\n ],\n});\n\nexport const TS_DCR_PROXY_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport const tsDcrProxyGenerator = async (\n tree: Tree,\n options: TsDcrProxyGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const name = kebabCase(options.name ? options.name : 'dcr-proxy');\n const nameClassName = toClassName(name);\n\n const iac = await resolveIac(tree, options.iac);\n\n // The handlers live in a standalone TypeScript project so they can be bundled\n // (rolldown) into deployable artifacts referenced by both CDK and Terraform.\n const namespace = getNpmScopePrefix(tree);\n const proxyProjectName = `${namespace}${name}`;\n\n let projectExists: boolean;\n try {\n readProjectConfigurationUnqualified(tree, proxyProjectName);\n projectExists = true;\n } catch {\n projectExists = false;\n }\n\n if (!projectExists) {\n await tsProjectGenerator(tree, {\n name,\n directory: options.directory,\n subDirectory: options.subDirectory,\n preferInstallDependencies: false,\n });\n }\n\n const projectConfig = readProjectConfigurationUnqualified(\n tree,\n proxyProjectName,\n );\n const proxyRoot = projectConfig.root;\n\n // Place the Lambda handlers in the project source\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n '..',\n '..',\n 'utils',\n 'dcr-proxy-constructs',\n 'files',\n 'project',\n ),\n proxyRoot,\n { nameClassName, nameKebabCase: name },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n addTsDependencies(tree, DEPENDENCIES, { projectRoot: proxyRoot });\n\n // Bundle each handler independently to dist/<root>/bundle/<handler>/index.js\n for (const handler of DCR_PROXY_HANDLERS) {\n await addTypeScriptBundleTarget(\n tree,\n projectConfig,\n {\n targetFilePath: `src/handlers/${handler}.ts`,\n bundleOutputDir: handler,\n external: [/@aws-sdk\\/.*/], // lambda runtime provides the aws sdk\n platform: 'node',\n },\n DEPENDENCIES,\n );\n }\n\n projectConfig.targets = sortObjectKeys(projectConfig.targets);\n updateProjectConfiguration(tree, projectConfig.name, projectConfig);\n\n // Recorded over the `ts#project` id the underlying generator wrote, so the\n // version sync attributes this project's dependencies to this generator.\n // After the write above, which would otherwise revert it.\n addGeneratorMetadata(tree, projectConfig.name, TS_DCR_PROXY_GENERATOR_INFO, {\n iac,\n });\n\n const bundlePathsFromRoot = Object.fromEntries(\n DCR_PROXY_HANDLERS.map((handler) => [\n handler,\n joinPathFragments('dist', proxyRoot, 'bundle', handler),\n ]),\n ) as Record<DcrProxyHandler, string>;\n\n await sharedConstructsGenerator(tree, { iac }, DEPENDENCIES);\n\n await addDcrProxyInfra(tree, {\n dcrProxyNameClassName: nameClassName,\n dcrProxyNameKebabCase: name,\n proxyProjectName,\n bundlePathsFromRoot,\n iac,\n });\n\n await addGeneratorMetricsIfApplicable(tree, [TS_DCR_PROXY_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\n\nexport default tsDcrProxyGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","updateProjectConfiguration","tsProjectGenerator","addTsDependencies","addTypeScriptBundleTarget","BUNDLE_DEPENDENCIES","addDcrProxyInfra","DCR_PROXY_HANDLERS","declareDependencies","ownedElsewhere","formatFilesInSubtree","resolveIac","installDependencies","addGeneratorMetricsIfApplicable","kebabCase","toClassName","getNpmScopePrefix","addGeneratorMetadata","getGeneratorInfo","readProjectConfigurationUnqualified","sortObjectKeys","SHARED_CONSTRUCTS_DEPENDENCIES","sharedConstructsGenerator","DEPENDENCIES","ts","name","dev","TS_DCR_PROXY_GENERATOR_INFO","filename","tsDcrProxyGenerator","tree","options","nameClassName","iac","namespace","proxyProjectName","projectExists","directory","subDirectory","preferInstallDependencies","projectConfig","proxyRoot","root","dirname","nameKebabCase","overwriteStrategy","KeepExisting","projectRoot","handler","targetFilePath","bundleOutputDir","external","platform","targets","bundlePathsFromRoot","Object","fromEntries","map","dcrProxyNameClassName","dcrProxyNameKebabCase","languages"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EAEjBC,0BAA0B,QACrB,aAAa;AACpB,OAAOC,wBAAwB,sBAAyB;AACxD,SAASC,iBAAiB,QAAQ,kCAA+B;AACjE,SACEC,yBAAyB,EACzBC,mBAAmB,QACd,+BAA4B;AACnC,SACEC,gBAAgB,EAChBC,kBAAkB,QAEb,2DAAwD;AAC/D,SACEC,mBAAmB,EACnBC,cAAc,QACT,uCAAoC;AAC3C,SAASC,oBAAoB,QAAQ,wBAAqB;AAC1D,SAASC,UAAU,QAAQ,qBAAkB;AAC7C,SAASC,mBAAmB,QAAQ,yBAAsB;AAC1D,SAASC,+BAA+B,QAAQ,yBAAsB;AACtE,SAASC,SAAS,EAAEC,WAAW,QAAQ,uBAAoB;AAC3D,SAASC,iBAAiB,QAAQ,2BAAwB;AAC1D,SACEC,oBAAoB,EACpBC,gBAAgB,EAEhBC,mCAAmC,QAC9B,oBAAiB;AACxB,SAASC,cAAc,QAAQ,wBAAqB;AACpD,SACEC,8BAA8B,EAC9BC,yBAAyB,QACpB,mCAAgC;AAGvC,OAAO,MAAMC,eAAef,sBAAsB;IAChDgB,IAAI;QACF,uEAAuE;QACvE,0CAA0C;QAC1C;YAAEC,MAAM;QAAkC;QAC1C;YAAEA,MAAM;YAAqBC,KAAK;QAAK;WACpCjB,eAAeJ;WACfI,eAAeY;KACnB;AACH,GAAG;AAEH,OAAO,MAAMM,8BAA+CT,iBAC1D,YAAYU,QAAQ,EACpB;AAEF,OAAO,MAAMC,sBAAsB,OACjCC,MACAC;IAEA,MAAMN,OAAOX,UAAUiB,QAAQN,IAAI,GAAGM,QAAQN,IAAI,GAAG;IACrD,MAAMO,gBAAgBjB,YAAYU;IAElC,MAAMQ,MAAM,MAAMtB,WAAWmB,MAAMC,QAAQE,GAAG;IAE9C,8EAA8E;IAC9E,6EAA6E;IAC7E,MAAMC,YAAYlB,kBAAkBc;IACpC,MAAMK,mBAAmB,GAAGD,YAAYT,MAAM;IAE9C,IAAIW;IACJ,IAAI;QACFjB,oCAAoCW,MAAMK;QAC1CC,gBAAgB;IAClB,EAAE,OAAM;QACNA,gBAAgB;IAClB;IAEA,IAAI,CAACA,eAAe;QAClB,MAAMlC,mBAAmB4B,MAAM;YAC7BL;YACAY,WAAWN,QAAQM,SAAS;YAC5BC,cAAcP,QAAQO,YAAY;YAClCC,2BAA2B;QAC7B;IACF;IAEA,MAAMC,gBAAgBrB,oCACpBW,MACAK;IAEF,MAAMM,YAAYD,cAAcE,IAAI;IAEpC,kDAAkD;IAClD5C,cACEgC,MACA/B,kBACE,YAAY4C,OAAO,EACnB,MACA,MACA,SACA,wBACA,SACA,YAEFF,WACA;QAAET;QAAeY,eAAenB;IAAK,GACrC;QACEoB,mBAAmB7C,kBAAkB8C,YAAY;IACnD;IAGF3C,kBAAkB2B,MAAMP,cAAc;QAAEwB,aAAaN;IAAU;IAE/D,6EAA6E;IAC7E,KAAK,MAAMO,WAAWzC,mBAAoB;QACxC,MAAMH,0BACJ0B,MACAU,eACA;YACES,gBAAgB,CAAC,aAAa,EAAED,QAAQ,GAAG,CAAC;YAC5CE,iBAAiBF;YACjBG,UAAU;gBAAC;aAAe;YAC1BC,UAAU;QACZ,GACA7B;IAEJ;IAEAiB,cAAca,OAAO,GAAGjC,eAAeoB,cAAca,OAAO;IAC5DpD,2BAA2B6B,MAAMU,cAAcf,IAAI,EAAEe;IAErD,2EAA2E;IAC3E,yEAAyE;IACzE,0DAA0D;IAC1DvB,qBAAqBa,MAAMU,cAAcf,IAAI,EAAEE,6BAA6B;QAC1EM;IACF;IAEA,MAAMqB,sBAAsBC,OAAOC,WAAW,CAC5CjD,mBAAmBkD,GAAG,CAAC,CAACT,UAAY;YAClCA;YACAjD,kBAAkB,QAAQ0C,WAAW,UAAUO;SAChD;IAGH,MAAM1B,0BAA0BQ,MAAM;QAAEG;IAAI,GAAGV;IAE/C,MAAMjB,iBAAiBwB,MAAM;QAC3B4B,uBAAuB1B;QACvB2B,uBAAuBlC;QACvBU;QACAmB;QACArB;IACF;IAEA,MAAMpB,gCAAgCiB,MAAM;QAACH;KAA4B;IAEzE,MAAMjB,qBAAqBoB;IAC3B,OAAO,IACLlB,oBAAoBkB,MAAMC,QAAQQ,yBAAyB,EAAE;YAC3DqB,WAAW;gBAAC;aAAa;QAC3B;AACJ,EAAE;AAEF,eAAe/B,oBAAoB"}
|
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
exports[`ts#dynamodb agent-connection generator > should add dynamodb dev dependency to agent dev 1`] = `
|
|
4
4
|
{
|
|
5
5
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
6
|
+
"metadata": {
|
|
7
|
+
"components": [
|
|
8
|
+
{
|
|
9
|
+
"generator": "ts#dynamodb#agent-connection",
|
|
10
|
+
"name": "agent-db",
|
|
11
|
+
"path": "packages/db",
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
},
|
|
6
15
|
"name": "my-agent",
|
|
7
16
|
"root": "packages/my-agent",
|
|
8
17
|
"targets": {
|
|
@@ -25,6 +34,15 @@ exports[`ts#dynamodb agent-connection generator > should add dynamodb dev depend
|
|
|
25
34
|
exports[`ts#dynamodb agent-connection generator > should use sourceComponent name when provided 1`] = `
|
|
26
35
|
{
|
|
27
36
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
37
|
+
"metadata": {
|
|
38
|
+
"components": [
|
|
39
|
+
{
|
|
40
|
+
"generator": "ts#dynamodb#agent-connection",
|
|
41
|
+
"name": "custom-agent-db",
|
|
42
|
+
"path": "packages/db",
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
28
46
|
"name": "my-agent",
|
|
29
47
|
"root": "packages/my-agent",
|
|
30
48
|
"targets": {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/ import { updateProjectConfiguration } from "@nx/devkit";
|
|
5
5
|
import { formatFilesInSubtree } from "../../../utils/format.js";
|
|
6
6
|
import { addGeneratorMetricsIfApplicable } from "../../../utils/metrics.js";
|
|
7
|
-
import { addDependencyToTargetIfNotPresent, getGeneratorInfo, readProjectConfigurationUnqualified } from "../../../utils/nx.js";
|
|
7
|
+
import { addComponentGeneratorMetadata, addDependencyToTargetIfNotPresent, getGeneratorInfo, readProjectConfigurationUnqualified } from "../../../utils/nx.js";
|
|
8
8
|
export const TS_DYNAMODB_AGENT_CONNECTION_GENERATOR_INFO = getGeneratorInfo(import.meta.filename);
|
|
9
9
|
export const tsDynamoDBAgentConnectionGenerator = async (tree, options)=>{
|
|
10
10
|
const sourceProject = readProjectConfigurationUnqualified(tree, options.sourceProject);
|
|
@@ -20,6 +20,12 @@ export const tsDynamoDBAgentConnectionGenerator = async (tree, options)=>{
|
|
|
20
20
|
});
|
|
21
21
|
updateProjectConfiguration(tree, sourceProject.name, sourceProject);
|
|
22
22
|
}
|
|
23
|
+
// Recorded so the version sync can identify this connection.
|
|
24
|
+
addComponentGeneratorMetadata(tree, sourceProject.name, TS_DYNAMODB_AGENT_CONNECTION_GENERATOR_INFO, targetProject.root, `${agentName}-${targetProject.name}`, // The source component this connection is made from, so the pair is
|
|
25
|
+
// identifiable rather than just the two projects.
|
|
26
|
+
{
|
|
27
|
+
sourcePath: options.sourceComponent?.path
|
|
28
|
+
});
|
|
23
29
|
await addGeneratorMetricsIfApplicable(tree, [
|
|
24
30
|
TS_DYNAMODB_AGENT_CONNECTION_GENERATOR_INFO
|
|
25
31
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/ts/dynamodb/agent-connection/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { type Tree, updateProjectConfiguration } from '@nx/devkit';\nimport { formatFilesInSubtree } from '../../../utils/format';\nimport { addGeneratorMetricsIfApplicable } from '../../../utils/metrics';\nimport {\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../../utils/nx';\nimport type { TsDynamoDBAgentConnectionGeneratorSchema } from './schema';\n\nexport const TS_DYNAMODB_AGENT_CONNECTION_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\nexport const tsDynamoDBAgentConnectionGenerator = async (\n tree: Tree,\n options: TsDynamoDBAgentConnectionGeneratorSchema,\n): Promise<void> => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n options.sourceProject,\n );\n const targetProject = readProjectConfigurationUnqualified(\n tree,\n options.targetProject,\n );\n\n const agentName = options.sourceComponent?.name ?? 'agent';\n const devTarget = `${agentName}-dev`;\n\n if (sourceProject.targets?.[devTarget]) {\n addDependencyToTargetIfNotPresent(sourceProject, devTarget, {\n projects: [targetProject.name],\n target: 'dev',\n });\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n }\n\n await addGeneratorMetricsIfApplicable(tree, [\n TS_DYNAMODB_AGENT_CONNECTION_GENERATOR_INFO,\n ]);\n await formatFilesInSubtree(tree);\n};\n\nexport default tsDynamoDBAgentConnectionGenerator;\n"],"names":["updateProjectConfiguration","formatFilesInSubtree","addGeneratorMetricsIfApplicable","addDependencyToTargetIfNotPresent","getGeneratorInfo","readProjectConfigurationUnqualified","TS_DYNAMODB_AGENT_CONNECTION_GENERATOR_INFO","filename","tsDynamoDBAgentConnectionGenerator","tree","options","sourceProject","targetProject","agentName","sourceComponent","name","devTarget","targets","projects","target"],"mappings":"AAAA;;;CAGC,GACD,SAAoBA,0BAA0B,QAAQ,aAAa;AACnE,SAASC,oBAAoB,QAAQ,2BAAwB;AAC7D,SAASC,+BAA+B,QAAQ,4BAAyB;AACzE,SACEC,iCAAiC,EACjCC,gBAAgB,EAEhBC,mCAAmC,QAC9B,uBAAoB;AAG3B,OAAO,MAAMC,8CACXF,iBAAiB,YAAYG,QAAQ,EAAE;AAEzC,OAAO,MAAMC,qCAAqC,OAChDC,MACAC;IAEA,MAAMC,gBAAgBN,oCACpBI,MACAC,QAAQC,aAAa;IAEvB,MAAMC,gBAAgBP,oCACpBI,MACAC,QAAQE,aAAa;IAGvB,MAAMC,YAAYH,QAAQI,eAAe,EAAEC,QAAQ;IACnD,MAAMC,YAAY,GAAGH,UAAU,IAAI,CAAC;IAEpC,IAAIF,cAAcM,OAAO,EAAE,CAACD,UAAU,EAAE;QACtCb,kCAAkCQ,eAAeK,WAAW;YAC1DE,UAAU;gBAACN,cAAcG,IAAI;aAAC;YAC9BI,QAAQ;QACV;
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/ts/dynamodb/agent-connection/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { type Tree, updateProjectConfiguration } from '@nx/devkit';\nimport { formatFilesInSubtree } from '../../../utils/format';\nimport { addGeneratorMetricsIfApplicable } from '../../../utils/metrics';\nimport {\n addComponentGeneratorMetadata,\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../../utils/nx';\nimport type { TsDynamoDBAgentConnectionGeneratorSchema } from './schema';\n\nexport const TS_DYNAMODB_AGENT_CONNECTION_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\nexport const tsDynamoDBAgentConnectionGenerator = async (\n tree: Tree,\n options: TsDynamoDBAgentConnectionGeneratorSchema,\n): Promise<void> => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n options.sourceProject,\n );\n const targetProject = readProjectConfigurationUnqualified(\n tree,\n options.targetProject,\n );\n\n const agentName = options.sourceComponent?.name ?? 'agent';\n const devTarget = `${agentName}-dev`;\n\n if (sourceProject.targets?.[devTarget]) {\n addDependencyToTargetIfNotPresent(sourceProject, devTarget, {\n projects: [targetProject.name],\n target: 'dev',\n });\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n }\n\n // Recorded so the version sync can identify this connection.\n addComponentGeneratorMetadata(\n tree,\n sourceProject.name,\n TS_DYNAMODB_AGENT_CONNECTION_GENERATOR_INFO,\n targetProject.root,\n `${agentName}-${targetProject.name}`,\n // The source component this connection is made from, so the pair is\n // identifiable rather than just the two projects.\n { sourcePath: options.sourceComponent?.path },\n );\n\n await addGeneratorMetricsIfApplicable(tree, [\n TS_DYNAMODB_AGENT_CONNECTION_GENERATOR_INFO,\n ]);\n await formatFilesInSubtree(tree);\n};\n\nexport default tsDynamoDBAgentConnectionGenerator;\n"],"names":["updateProjectConfiguration","formatFilesInSubtree","addGeneratorMetricsIfApplicable","addComponentGeneratorMetadata","addDependencyToTargetIfNotPresent","getGeneratorInfo","readProjectConfigurationUnqualified","TS_DYNAMODB_AGENT_CONNECTION_GENERATOR_INFO","filename","tsDynamoDBAgentConnectionGenerator","tree","options","sourceProject","targetProject","agentName","sourceComponent","name","devTarget","targets","projects","target","root","sourcePath","path"],"mappings":"AAAA;;;CAGC,GACD,SAAoBA,0BAA0B,QAAQ,aAAa;AACnE,SAASC,oBAAoB,QAAQ,2BAAwB;AAC7D,SAASC,+BAA+B,QAAQ,4BAAyB;AACzE,SACEC,6BAA6B,EAC7BC,iCAAiC,EACjCC,gBAAgB,EAEhBC,mCAAmC,QAC9B,uBAAoB;AAG3B,OAAO,MAAMC,8CACXF,iBAAiB,YAAYG,QAAQ,EAAE;AAEzC,OAAO,MAAMC,qCAAqC,OAChDC,MACAC;IAEA,MAAMC,gBAAgBN,oCACpBI,MACAC,QAAQC,aAAa;IAEvB,MAAMC,gBAAgBP,oCACpBI,MACAC,QAAQE,aAAa;IAGvB,MAAMC,YAAYH,QAAQI,eAAe,EAAEC,QAAQ;IACnD,MAAMC,YAAY,GAAGH,UAAU,IAAI,CAAC;IAEpC,IAAIF,cAAcM,OAAO,EAAE,CAACD,UAAU,EAAE;QACtCb,kCAAkCQ,eAAeK,WAAW;YAC1DE,UAAU;gBAACN,cAAcG,IAAI;aAAC;YAC9BI,QAAQ;QACV;QACApB,2BAA2BU,MAAME,cAAcI,IAAI,EAAEJ;IACvD;IAEA,6DAA6D;IAC7DT,8BACEO,MACAE,cAAcI,IAAI,EAClBT,6CACAM,cAAcQ,IAAI,EAClB,GAAGP,UAAU,CAAC,EAAED,cAAcG,IAAI,EAAE,EACpC,oEAAoE;IACpE,kDAAkD;IAClD;QAAEM,YAAYX,QAAQI,eAAe,EAAEQ;IAAK;IAG9C,MAAMrB,gCAAgCQ,MAAM;QAC1CH;KACD;IACD,MAAMN,qBAAqBS;AAC7B,EAAE;AAEF,eAAeD,mCAAmC"}
|
|
@@ -5,6 +5,47 @@
|
|
|
5
5
|
import { type GeneratorCallback, type Tree } from '@nx/devkit';
|
|
6
6
|
import { type NxGeneratorInfo } from '../../utils/nx';
|
|
7
7
|
import type { TsDynamoDBGeneratorSchema } from './schema';
|
|
8
|
+
export declare const DEPENDENCIES: import("../../utils/declared-dependencies").DependencyDeclaration<readonly [{
|
|
9
|
+
readonly name: "@aws-sdk/client-dynamodb";
|
|
10
|
+
}, {
|
|
11
|
+
readonly name: "electrodb";
|
|
12
|
+
}, {
|
|
13
|
+
readonly name: "@aws-lambda-powertools/parameters";
|
|
14
|
+
}, {
|
|
15
|
+
readonly name: "@aws-sdk/client-appconfigdata";
|
|
16
|
+
}, {
|
|
17
|
+
readonly name: "@types/aws-lambda";
|
|
18
|
+
readonly dev: true;
|
|
19
|
+
}, {
|
|
20
|
+
readonly name: "@types/node";
|
|
21
|
+
readonly dev: true;
|
|
22
|
+
}, {
|
|
23
|
+
readonly name: "tsx";
|
|
24
|
+
readonly dev: true;
|
|
25
|
+
readonly root: true;
|
|
26
|
+
}, {
|
|
27
|
+
readonly name: "constructs";
|
|
28
|
+
readonly when: (m: import("../../utils/shared-constructs-constants").IacMetadata) => boolean;
|
|
29
|
+
} & {
|
|
30
|
+
versionOnly: true;
|
|
31
|
+
}, {
|
|
32
|
+
readonly name: "aws-cdk-lib";
|
|
33
|
+
readonly when: (m: import("../../utils/shared-constructs-constants").IacMetadata) => boolean;
|
|
34
|
+
} & {
|
|
35
|
+
versionOnly: true;
|
|
36
|
+
}, {
|
|
37
|
+
readonly name: "@types/node";
|
|
38
|
+
} & {
|
|
39
|
+
versionOnly: true;
|
|
40
|
+
}, {
|
|
41
|
+
readonly name: "@aws-sdk/client-dynamodb";
|
|
42
|
+
} & {
|
|
43
|
+
versionOnly: true;
|
|
44
|
+
}, {
|
|
45
|
+
readonly name: "tsx";
|
|
46
|
+
} & {
|
|
47
|
+
versionOnly: true;
|
|
48
|
+
}], readonly import("../../utils/declared-dependencies").DeclaredPyDependency<"a2a-sdk" | "ag-ui-langgraph" | "ag-ui-protocol" | "ag-ui-strands" | "aws-lambda-powertools" | "aws-lambda-powertools[tracer]" | "aws-lambda-powertools[parser]" | "aws-opentelemetry-distro" | "bedrock-agentcore" | "boto3" | "checkov" | "fastapi" | "fastapi[standard]" | "httpx" | "langchain" | "langchain-aws" | "langchain-mcp-adapters" | "langgraph" | "mcp" | "pip-check-updates" | "pip-licenses" | "ruff" | "strands-agents" | "strands-agents[a2a]" | "strands-agents-tools" | "ty" | "pynamodb" | "uvicorn" | "sqlmodel" | "alembic" | "aiomysql" | "asyncpg" | "greenlet", Record<string, never>>[]>;
|
|
8
49
|
export declare const TS_DYNAMODB_GENERATOR_INFO: NxGeneratorInfo;
|
|
9
50
|
export declare const tsDynamoDBGenerator: (tree: Tree, options: TsDynamoDBGeneratorSchema) => Promise<GeneratorCallback>;
|
|
10
51
|
export default tsDynamoDBGenerator;
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/ import { relative } from "node:path";
|
|
5
5
|
import { generateFiles, joinPathFragments, readProjectConfiguration, updateProjectConfiguration } from "@nx/devkit";
|
|
6
|
+
import { addTsDependencies } from "../../utils/add-dependencies.js";
|
|
6
7
|
import { resolveContainers } from "../../utils/containers.js";
|
|
7
|
-
import {
|
|
8
|
+
import { declareDependencies, ownedElsewhere } from "../../utils/declared-dependencies.js";
|
|
8
9
|
import { addDynamoDBInfra } from "../../utils/dynamodb-constructs/dynamodb-constructs.js";
|
|
9
10
|
import { formatFilesInSubtree } from "../../utils/format.js";
|
|
10
11
|
import { resolveIac } from "../../utils/iac.js";
|
|
@@ -15,11 +16,42 @@ import { kebabCase, toClassName } from "../../utils/names.js";
|
|
|
15
16
|
import { getNpmScope } from "../../utils/npm-scope.js";
|
|
16
17
|
import { addGeneratorMetadata, getGeneratorInfo } from "../../utils/nx.js";
|
|
17
18
|
import { assignSharedPort } from "../../utils/port.js";
|
|
18
|
-
import { sharedConstructsGenerator } from "../../utils/shared-constructs.js";
|
|
19
|
+
import { SHARED_CONSTRUCTS_DEPENDENCIES, sharedConstructsGenerator } from "../../utils/shared-constructs.js";
|
|
19
20
|
import { DYNAMODB_GENERATOR_IDS, PACKAGES_DIR, SHARED_SCRIPTS_DIR } from "../../utils/shared-constructs-constants.js";
|
|
20
|
-
import { sharedDynamoDBScriptsGenerator } from "../../utils/shared-dynamodb-scripts.js";
|
|
21
|
-
import { withVersions } from "../../utils/versions.js";
|
|
21
|
+
import { SHARED_DYNAMODB_SCRIPTS_DEPENDENCIES, sharedDynamoDBScriptsGenerator } from "../../utils/shared-dynamodb-scripts.js";
|
|
22
22
|
import tsProjectGenerator, { getTsLibDetails } from "../lib/generator.js";
|
|
23
|
+
export const DEPENDENCIES = declareDependencies()({
|
|
24
|
+
ts: [
|
|
25
|
+
{
|
|
26
|
+
name: '@aws-sdk/client-dynamodb'
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'electrodb'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: '@aws-lambda-powertools/parameters'
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: '@aws-sdk/client-appconfigdata'
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: '@types/aws-lambda',
|
|
39
|
+
dev: true
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: '@types/node',
|
|
43
|
+
dev: true
|
|
44
|
+
},
|
|
45
|
+
// tsx runs the local-dev scripts from the workspace root.
|
|
46
|
+
{
|
|
47
|
+
name: 'tsx',
|
|
48
|
+
dev: true,
|
|
49
|
+
root: true
|
|
50
|
+
},
|
|
51
|
+
...ownedElsewhere(SHARED_CONSTRUCTS_DEPENDENCIES),
|
|
52
|
+
...ownedElsewhere(SHARED_DYNAMODB_SCRIPTS_DEPENDENCIES)
|
|
53
|
+
]
|
|
54
|
+
});
|
|
23
55
|
export const TS_DYNAMODB_GENERATOR_INFO = getGeneratorInfo(import.meta.filename);
|
|
24
56
|
export const tsDynamoDBGenerator = async (tree, options)=>{
|
|
25
57
|
const nameKebabCase = kebabCase(options.name);
|
|
@@ -57,7 +89,7 @@ export const tsDynamoDBGenerator = async (tree, options)=>{
|
|
|
57
89
|
...esmVars(tree)
|
|
58
90
|
};
|
|
59
91
|
generateFiles(tree, joinPathFragments(import.meta.dirname, 'files'), dir, templateOptions);
|
|
60
|
-
await sharedDynamoDBScriptsGenerator(tree);
|
|
92
|
+
await sharedDynamoDBScriptsGenerator(tree, DEPENDENCIES);
|
|
61
93
|
const scriptsDir = relative(dir, joinPathFragments(PACKAGES_DIR, SHARED_SCRIPTS_DIR, 'src', 'dynamodb'));
|
|
62
94
|
projectConfig.targets['pull-image'] = {
|
|
63
95
|
executor: 'nx:run-commands',
|
|
@@ -79,12 +111,16 @@ export const tsDynamoDBGenerator = async (tree, options)=>{
|
|
|
79
111
|
}
|
|
80
112
|
};
|
|
81
113
|
updateProjectConfiguration(tree, fullyQualifiedName, projectConfig);
|
|
82
|
-
|
|
114
|
+
// Recorded so the version sync can tell a CDK project from a Terraform one;
|
|
115
|
+
// undefined when no infrastructure was generated.
|
|
116
|
+
const iac = options.infra !== 'none' ? await resolveIac(tree, options.iac) : undefined;
|
|
117
|
+
addGeneratorMetadata(tree, fullyQualifiedName, TS_DYNAMODB_GENERATOR_INFO, iac ? {
|
|
118
|
+
iac
|
|
119
|
+
} : {});
|
|
83
120
|
if (options.infra !== 'none') {
|
|
84
|
-
const iac = await resolveIac(tree, options.iac);
|
|
85
121
|
await sharedConstructsGenerator(tree, {
|
|
86
122
|
iac
|
|
87
|
-
});
|
|
123
|
+
}, DEPENDENCIES);
|
|
88
124
|
await addDynamoDBInfra(tree, {
|
|
89
125
|
iac,
|
|
90
126
|
projectName: fullyQualifiedName,
|
|
@@ -94,18 +130,9 @@ export const tsDynamoDBGenerator = async (tree, options)=>{
|
|
|
94
130
|
projectRoot: dir
|
|
95
131
|
});
|
|
96
132
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
'@aws-lambda-powertools/parameters',
|
|
101
|
-
'@aws-sdk/client-appconfigdata'
|
|
102
|
-
]), withVersions([
|
|
103
|
-
'@types/aws-lambda',
|
|
104
|
-
'@types/node'
|
|
105
|
-
]), joinPathFragments(dir, 'package.json'));
|
|
106
|
-
addDependenciesToPackageJson(tree, {}, withVersions([
|
|
107
|
-
'tsx'
|
|
108
|
-
]));
|
|
133
|
+
addTsDependencies(tree, DEPENDENCIES, {
|
|
134
|
+
projectRoot: dir
|
|
135
|
+
});
|
|
109
136
|
await addGeneratorMetricsIfApplicable(tree, [
|
|
110
137
|
TS_DYNAMODB_GENERATOR_INFO
|
|
111
138
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/dynamodb/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { relative } from 'node:path';\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n readProjectConfiguration,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/dynamodb/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { relative } from 'node:path';\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n readProjectConfiguration,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { addTsDependencies } from '../../utils/add-dependencies';\nimport { resolveContainers } from '../../utils/containers';\nimport {\n declareDependencies,\n ownedElsewhere,\n} from '../../utils/declared-dependencies';\nimport { addDynamoDBInfra } from '../../utils/dynamodb-constructs/dynamodb-constructs';\nimport { formatFilesInSubtree } from '../../utils/format';\nimport { resolveIac } from '../../utils/iac';\nimport { installDependencies } from '../../utils/install';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics';\nimport { esmVars } from '../../utils/module-format';\nimport { kebabCase, toClassName } from '../../utils/names';\nimport { getNpmScope } from '../../utils/npm-scope';\nimport {\n addGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n} from '../../utils/nx';\nimport { assignSharedPort } from '../../utils/port';\nimport {\n SHARED_CONSTRUCTS_DEPENDENCIES,\n sharedConstructsGenerator,\n} from '../../utils/shared-constructs';\nimport {\n DYNAMODB_GENERATOR_IDS,\n PACKAGES_DIR,\n SHARED_SCRIPTS_DIR,\n} from '../../utils/shared-constructs-constants';\nimport {\n SHARED_DYNAMODB_SCRIPTS_DEPENDENCIES,\n sharedDynamoDBScriptsGenerator,\n} from '../../utils/shared-dynamodb-scripts';\nimport tsProjectGenerator, { getTsLibDetails } from '../lib/generator';\nimport type { TsDynamoDBGeneratorSchema } from './schema';\n\nexport const DEPENDENCIES = declareDependencies()({\n ts: [\n { name: '@aws-sdk/client-dynamodb' },\n { name: 'electrodb' },\n { name: '@aws-lambda-powertools/parameters' },\n { name: '@aws-sdk/client-appconfigdata' },\n { name: '@types/aws-lambda', dev: true },\n { name: '@types/node', dev: true },\n // tsx runs the local-dev scripts from the workspace root.\n { name: 'tsx', dev: true, root: true },\n ...ownedElsewhere(SHARED_CONSTRUCTS_DEPENDENCIES),\n ...ownedElsewhere(SHARED_DYNAMODB_SCRIPTS_DEPENDENCIES),\n ],\n});\n\nexport const TS_DYNAMODB_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport const tsDynamoDBGenerator = async (\n tree: Tree,\n options: TsDynamoDBGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const nameKebabCase = kebabCase(options.name);\n const nameClassName = toClassName(options.name);\n const localTableName = `${getNpmScope(tree)}-${kebabCase(options.tableName ?? options.name)}`;\n const containerEngine = await resolveContainers(tree, 'inherit');\n const { fullyQualifiedName, dir } = getTsLibDetails(tree, {\n name: options.name,\n directory: options.directory,\n subDirectory: options.subDirectory,\n });\n\n let projectExists: boolean;\n try {\n readProjectConfiguration(tree, fullyQualifiedName);\n projectExists = true;\n } catch {\n projectExists = false;\n }\n\n if (!projectExists) {\n await tsProjectGenerator(tree, {\n name: options.name,\n directory: options.directory,\n preferInstallDependencies: false,\n });\n }\n\n const projectConfig = readProjectConfiguration(tree, fullyQualifiedName);\n\n const localDynamoDBPort = assignSharedPort(\n tree,\n projectConfig,\n DYNAMODB_GENERATOR_IDS,\n 8000,\n );\n\n const containerName = `${getNpmScope(tree)}-dynamodb`;\n\n const templateOptions = {\n runtimeConfigKey: nameClassName,\n localDynamoDBPort,\n localTableName,\n containerName,\n containerEngine,\n ...esmVars(tree),\n };\n\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files'),\n dir,\n templateOptions,\n );\n\n await sharedDynamoDBScriptsGenerator(tree, DEPENDENCIES);\n\n const scriptsDir = relative(\n dir,\n joinPathFragments(PACKAGES_DIR, SHARED_SCRIPTS_DIR, 'src', 'dynamodb'),\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 commands: [\n `tsx ${scriptsDir}/start-container.ts`,\n `tsx ${scriptsDir}/create-local-table.ts`,\n ],\n parallel: true,\n cwd: '{projectRoot}',\n },\n };\n\n updateProjectConfiguration(tree, fullyQualifiedName, projectConfig);\n // Recorded so the version sync can tell a CDK project from a Terraform one;\n // undefined when no infrastructure was generated.\n const iac =\n options.infra !== 'none' ? await resolveIac(tree, options.iac) : undefined;\n\n addGeneratorMetadata(\n tree,\n fullyQualifiedName,\n TS_DYNAMODB_GENERATOR_INFO,\n iac ? { iac } : {},\n );\n\n if (options.infra !== 'none') {\n await sharedConstructsGenerator(tree, { iac }, DEPENDENCIES);\n await addDynamoDBInfra(tree, {\n iac,\n projectName: fullyQualifiedName,\n nameClassName,\n nameKebabCase,\n tableName: localTableName,\n projectRoot: dir,\n });\n }\n\n addTsDependencies(tree, DEPENDENCIES, { projectRoot: dir });\n\n await addGeneratorMetricsIfApplicable(tree, [TS_DYNAMODB_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\n\nexport default tsDynamoDBGenerator;\n"],"names":["relative","generateFiles","joinPathFragments","readProjectConfiguration","updateProjectConfiguration","addTsDependencies","resolveContainers","declareDependencies","ownedElsewhere","addDynamoDBInfra","formatFilesInSubtree","resolveIac","installDependencies","addGeneratorMetricsIfApplicable","esmVars","kebabCase","toClassName","getNpmScope","addGeneratorMetadata","getGeneratorInfo","assignSharedPort","SHARED_CONSTRUCTS_DEPENDENCIES","sharedConstructsGenerator","DYNAMODB_GENERATOR_IDS","PACKAGES_DIR","SHARED_SCRIPTS_DIR","SHARED_DYNAMODB_SCRIPTS_DEPENDENCIES","sharedDynamoDBScriptsGenerator","tsProjectGenerator","getTsLibDetails","DEPENDENCIES","ts","name","dev","root","TS_DYNAMODB_GENERATOR_INFO","filename","tsDynamoDBGenerator","tree","options","nameKebabCase","nameClassName","localTableName","tableName","containerEngine","fullyQualifiedName","dir","directory","subDirectory","projectExists","preferInstallDependencies","projectConfig","localDynamoDBPort","containerName","templateOptions","runtimeConfigKey","dirname","scriptsDir","targets","executor","command","cwd","continuous","commands","parallel","iac","infra","undefined","projectName","projectRoot","languages"],"mappings":"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"}
|
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
exports[`ts#dynamodb mcp-server-connection generator > should add dynamodb dev dependency to mcp-server dev 1`] = `
|
|
4
4
|
{
|
|
5
5
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
6
|
+
"metadata": {
|
|
7
|
+
"components": [
|
|
8
|
+
{
|
|
9
|
+
"generator": "ts#dynamodb#mcp-server-connection",
|
|
10
|
+
"name": "mcp-server-db",
|
|
11
|
+
"path": "packages/db",
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
},
|
|
6
15
|
"name": "my-mcp",
|
|
7
16
|
"root": "packages/my-mcp",
|
|
8
17
|
"targets": {
|
|
@@ -25,6 +34,15 @@ exports[`ts#dynamodb mcp-server-connection generator > should add dynamodb dev d
|
|
|
25
34
|
exports[`ts#dynamodb mcp-server-connection generator > should use sourceComponent name when provided 1`] = `
|
|
26
35
|
{
|
|
27
36
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
37
|
+
"metadata": {
|
|
38
|
+
"components": [
|
|
39
|
+
{
|
|
40
|
+
"generator": "ts#dynamodb#mcp-server-connection",
|
|
41
|
+
"name": "custom-server-db",
|
|
42
|
+
"path": "packages/db",
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
28
46
|
"name": "my-mcp",
|
|
29
47
|
"root": "packages/my-mcp",
|
|
30
48
|
"targets": {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/ import { updateProjectConfiguration } from "@nx/devkit";
|
|
5
5
|
import { formatFilesInSubtree } from "../../../utils/format.js";
|
|
6
6
|
import { addGeneratorMetricsIfApplicable } from "../../../utils/metrics.js";
|
|
7
|
-
import { addDependencyToTargetIfNotPresent, getGeneratorInfo, readProjectConfigurationUnqualified } from "../../../utils/nx.js";
|
|
7
|
+
import { addComponentGeneratorMetadata, addDependencyToTargetIfNotPresent, getGeneratorInfo, readProjectConfigurationUnqualified } from "../../../utils/nx.js";
|
|
8
8
|
export const TS_DYNAMODB_MCP_SERVER_CONNECTION_GENERATOR_INFO = getGeneratorInfo(import.meta.filename);
|
|
9
9
|
export const tsDynamoDBMcpServerConnectionGenerator = async (tree, options)=>{
|
|
10
10
|
const sourceProject = readProjectConfigurationUnqualified(tree, options.sourceProject);
|
|
@@ -20,6 +20,12 @@ export const tsDynamoDBMcpServerConnectionGenerator = async (tree, options)=>{
|
|
|
20
20
|
});
|
|
21
21
|
updateProjectConfiguration(tree, sourceProject.name, sourceProject);
|
|
22
22
|
}
|
|
23
|
+
// Recorded so the version sync can identify this connection.
|
|
24
|
+
addComponentGeneratorMetadata(tree, sourceProject.name, TS_DYNAMODB_MCP_SERVER_CONNECTION_GENERATOR_INFO, targetProject.root, `${mcpServerName}-${targetProject.name}`, // The source component this connection is made from, so the pair is
|
|
25
|
+
// identifiable rather than just the two projects.
|
|
26
|
+
{
|
|
27
|
+
sourcePath: options.sourceComponent?.path
|
|
28
|
+
});
|
|
23
29
|
await addGeneratorMetricsIfApplicable(tree, [
|
|
24
30
|
TS_DYNAMODB_MCP_SERVER_CONNECTION_GENERATOR_INFO
|
|
25
31
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/ts/dynamodb/mcp-server-connection/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { type Tree, updateProjectConfiguration } from '@nx/devkit';\nimport { formatFilesInSubtree } from '../../../utils/format';\nimport { addGeneratorMetricsIfApplicable } from '../../../utils/metrics';\nimport {\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../../utils/nx';\nimport type { TsDynamoDBMcpServerConnectionGeneratorSchema } from './schema';\n\nexport const TS_DYNAMODB_MCP_SERVER_CONNECTION_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\nexport const tsDynamoDBMcpServerConnectionGenerator = async (\n tree: Tree,\n options: TsDynamoDBMcpServerConnectionGeneratorSchema,\n): Promise<void> => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n options.sourceProject,\n );\n const targetProject = readProjectConfigurationUnqualified(\n tree,\n options.targetProject,\n );\n\n const mcpServerName = options.sourceComponent?.name ?? 'mcp-server';\n const devTarget = `${mcpServerName}-dev`;\n\n if (sourceProject.targets?.[devTarget]) {\n addDependencyToTargetIfNotPresent(sourceProject, devTarget, {\n projects: [targetProject.name],\n target: 'dev',\n });\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n }\n\n await addGeneratorMetricsIfApplicable(tree, [\n TS_DYNAMODB_MCP_SERVER_CONNECTION_GENERATOR_INFO,\n ]);\n await formatFilesInSubtree(tree);\n};\n\nexport default tsDynamoDBMcpServerConnectionGenerator;\n"],"names":["updateProjectConfiguration","formatFilesInSubtree","addGeneratorMetricsIfApplicable","addDependencyToTargetIfNotPresent","getGeneratorInfo","readProjectConfigurationUnqualified","TS_DYNAMODB_MCP_SERVER_CONNECTION_GENERATOR_INFO","filename","tsDynamoDBMcpServerConnectionGenerator","tree","options","sourceProject","targetProject","mcpServerName","sourceComponent","name","devTarget","targets","projects","target"],"mappings":"AAAA;;;CAGC,GACD,SAAoBA,0BAA0B,QAAQ,aAAa;AACnE,SAASC,oBAAoB,QAAQ,2BAAwB;AAC7D,SAASC,+BAA+B,QAAQ,4BAAyB;AACzE,SACEC,iCAAiC,EACjCC,gBAAgB,EAEhBC,mCAAmC,QAC9B,uBAAoB;AAG3B,OAAO,MAAMC,mDACXF,iBAAiB,YAAYG,QAAQ,EAAE;AAEzC,OAAO,MAAMC,yCAAyC,OACpDC,MACAC;IAEA,MAAMC,gBAAgBN,oCACpBI,MACAC,QAAQC,aAAa;IAEvB,MAAMC,gBAAgBP,oCACpBI,MACAC,QAAQE,aAAa;IAGvB,MAAMC,gBAAgBH,QAAQI,eAAe,EAAEC,QAAQ;IACvD,MAAMC,YAAY,GAAGH,cAAc,IAAI,CAAC;IAExC,IAAIF,cAAcM,OAAO,EAAE,CAACD,UAAU,EAAE;QACtCb,kCAAkCQ,eAAeK,WAAW;YAC1DE,UAAU;gBAACN,cAAcG,IAAI;aAAC;YAC9BI,QAAQ;QACV;
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/ts/dynamodb/mcp-server-connection/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { type Tree, updateProjectConfiguration } from '@nx/devkit';\nimport { formatFilesInSubtree } from '../../../utils/format';\nimport { addGeneratorMetricsIfApplicable } from '../../../utils/metrics';\nimport {\n addComponentGeneratorMetadata,\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../../utils/nx';\nimport type { TsDynamoDBMcpServerConnectionGeneratorSchema } from './schema';\n\nexport const TS_DYNAMODB_MCP_SERVER_CONNECTION_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\nexport const tsDynamoDBMcpServerConnectionGenerator = async (\n tree: Tree,\n options: TsDynamoDBMcpServerConnectionGeneratorSchema,\n): Promise<void> => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n options.sourceProject,\n );\n const targetProject = readProjectConfigurationUnqualified(\n tree,\n options.targetProject,\n );\n\n const mcpServerName = options.sourceComponent?.name ?? 'mcp-server';\n const devTarget = `${mcpServerName}-dev`;\n\n if (sourceProject.targets?.[devTarget]) {\n addDependencyToTargetIfNotPresent(sourceProject, devTarget, {\n projects: [targetProject.name],\n target: 'dev',\n });\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n }\n\n // Recorded so the version sync can identify this connection.\n addComponentGeneratorMetadata(\n tree,\n sourceProject.name,\n TS_DYNAMODB_MCP_SERVER_CONNECTION_GENERATOR_INFO,\n targetProject.root,\n `${mcpServerName}-${targetProject.name}`,\n // The source component this connection is made from, so the pair is\n // identifiable rather than just the two projects.\n { sourcePath: options.sourceComponent?.path },\n );\n\n await addGeneratorMetricsIfApplicable(tree, [\n TS_DYNAMODB_MCP_SERVER_CONNECTION_GENERATOR_INFO,\n ]);\n await formatFilesInSubtree(tree);\n};\n\nexport default tsDynamoDBMcpServerConnectionGenerator;\n"],"names":["updateProjectConfiguration","formatFilesInSubtree","addGeneratorMetricsIfApplicable","addComponentGeneratorMetadata","addDependencyToTargetIfNotPresent","getGeneratorInfo","readProjectConfigurationUnqualified","TS_DYNAMODB_MCP_SERVER_CONNECTION_GENERATOR_INFO","filename","tsDynamoDBMcpServerConnectionGenerator","tree","options","sourceProject","targetProject","mcpServerName","sourceComponent","name","devTarget","targets","projects","target","root","sourcePath","path"],"mappings":"AAAA;;;CAGC,GACD,SAAoBA,0BAA0B,QAAQ,aAAa;AACnE,SAASC,oBAAoB,QAAQ,2BAAwB;AAC7D,SAASC,+BAA+B,QAAQ,4BAAyB;AACzE,SACEC,6BAA6B,EAC7BC,iCAAiC,EACjCC,gBAAgB,EAEhBC,mCAAmC,QAC9B,uBAAoB;AAG3B,OAAO,MAAMC,mDACXF,iBAAiB,YAAYG,QAAQ,EAAE;AAEzC,OAAO,MAAMC,yCAAyC,OACpDC,MACAC;IAEA,MAAMC,gBAAgBN,oCACpBI,MACAC,QAAQC,aAAa;IAEvB,MAAMC,gBAAgBP,oCACpBI,MACAC,QAAQE,aAAa;IAGvB,MAAMC,gBAAgBH,QAAQI,eAAe,EAAEC,QAAQ;IACvD,MAAMC,YAAY,GAAGH,cAAc,IAAI,CAAC;IAExC,IAAIF,cAAcM,OAAO,EAAE,CAACD,UAAU,EAAE;QACtCb,kCAAkCQ,eAAeK,WAAW;YAC1DE,UAAU;gBAACN,cAAcG,IAAI;aAAC;YAC9BI,QAAQ;QACV;QACApB,2BAA2BU,MAAME,cAAcI,IAAI,EAAEJ;IACvD;IAEA,6DAA6D;IAC7DT,8BACEO,MACAE,cAAcI,IAAI,EAClBT,kDACAM,cAAcQ,IAAI,EAClB,GAAGP,cAAc,CAAC,EAAED,cAAcG,IAAI,EAAE,EACxC,oEAAoE;IACpE,kDAAkD;IAClD;QAAEM,YAAYX,QAAQI,eAAe,EAAEQ;IAAK;IAG9C,MAAMrB,gCAAgCQ,MAAM;QAC1CH;KACD;IACD,MAAMN,qBAAqBS;AAC7B,EAAE;AAEF,eAAeD,uCAAuC"}
|
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
exports[`ts#dynamodb smithy-connection generator > should add dynamodb dev dependency to smithy dev 1`] = `
|
|
4
4
|
{
|
|
5
5
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
6
|
+
"metadata": {
|
|
7
|
+
"components": [
|
|
8
|
+
{
|
|
9
|
+
"generator": "ts#dynamodb#smithy-connection",
|
|
10
|
+
"name": "db",
|
|
11
|
+
"path": "packages/db",
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
},
|
|
6
15
|
"name": "api",
|
|
7
16
|
"root": "packages/api",
|
|
8
17
|
"targets": {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/ import { updateProjectConfiguration } from "@nx/devkit";
|
|
5
5
|
import { formatFilesInSubtree } from "../../../utils/format.js";
|
|
6
6
|
import { addGeneratorMetricsIfApplicable } from "../../../utils/metrics.js";
|
|
7
|
-
import { addDependencyToTargetIfNotPresent, getGeneratorInfo, readProjectConfigurationUnqualified } from "../../../utils/nx.js";
|
|
7
|
+
import { addComponentGeneratorMetadata, addDependencyToTargetIfNotPresent, getGeneratorInfo, readProjectConfigurationUnqualified } from "../../../utils/nx.js";
|
|
8
8
|
export const TS_DYNAMODB_SMITHY_CONNECTION_GENERATOR_INFO = getGeneratorInfo(import.meta.filename);
|
|
9
9
|
export const tsDynamoDBSmithyConnectionGenerator = async (tree, options)=>{
|
|
10
10
|
const sourceProject = readProjectConfigurationUnqualified(tree, options.sourceProject);
|
|
@@ -18,6 +18,8 @@ export const tsDynamoDBSmithyConnectionGenerator = async (tree, options)=>{
|
|
|
18
18
|
});
|
|
19
19
|
updateProjectConfiguration(tree, sourceProject.name, sourceProject);
|
|
20
20
|
}
|
|
21
|
+
// Recorded so the version sync can identify this connection.
|
|
22
|
+
addComponentGeneratorMetadata(tree, sourceProject.name, TS_DYNAMODB_SMITHY_CONNECTION_GENERATOR_INFO, targetProject.root, targetProject.name);
|
|
21
23
|
await addGeneratorMetricsIfApplicable(tree, [
|
|
22
24
|
TS_DYNAMODB_SMITHY_CONNECTION_GENERATOR_INFO
|
|
23
25
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/ts/dynamodb/smithy-connection/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { type Tree, updateProjectConfiguration } from '@nx/devkit';\nimport { formatFilesInSubtree } from '../../../utils/format';\nimport { addGeneratorMetricsIfApplicable } from '../../../utils/metrics';\nimport {\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../../utils/nx';\nimport type { TsDynamoDBSmithyConnectionGeneratorSchema } from './schema';\n\nexport const TS_DYNAMODB_SMITHY_CONNECTION_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\nexport const tsDynamoDBSmithyConnectionGenerator = async (\n tree: Tree,\n options: TsDynamoDBSmithyConnectionGeneratorSchema,\n): Promise<void> => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n options.sourceProject,\n );\n const targetProject = readProjectConfigurationUnqualified(\n tree,\n options.targetProject,\n );\n\n if (sourceProject.targets?.['dev']) {\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', {\n projects: [targetProject.name],\n target: 'dev',\n });\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n }\n\n await addGeneratorMetricsIfApplicable(tree, [\n TS_DYNAMODB_SMITHY_CONNECTION_GENERATOR_INFO,\n ]);\n await formatFilesInSubtree(tree);\n};\n\nexport default tsDynamoDBSmithyConnectionGenerator;\n"],"names":["updateProjectConfiguration","formatFilesInSubtree","addGeneratorMetricsIfApplicable","addDependencyToTargetIfNotPresent","getGeneratorInfo","readProjectConfigurationUnqualified","TS_DYNAMODB_SMITHY_CONNECTION_GENERATOR_INFO","filename","tsDynamoDBSmithyConnectionGenerator","tree","options","sourceProject","targetProject","targets","projects","name","target"],"mappings":"AAAA;;;CAGC,GACD,SAAoBA,0BAA0B,QAAQ,aAAa;AACnE,SAASC,oBAAoB,QAAQ,2BAAwB;AAC7D,SAASC,+BAA+B,QAAQ,4BAAyB;AACzE,SACEC,iCAAiC,EACjCC,gBAAgB,EAEhBC,mCAAmC,QAC9B,uBAAoB;AAG3B,OAAO,MAAMC,+CACXF,iBAAiB,YAAYG,QAAQ,EAAE;AAEzC,OAAO,MAAMC,sCAAsC,OACjDC,MACAC;IAEA,MAAMC,gBAAgBN,oCACpBI,MACAC,QAAQC,aAAa;IAEvB,MAAMC,gBAAgBP,oCACpBI,MACAC,QAAQE,aAAa;IAGvB,IAAID,cAAcE,OAAO,EAAE,CAAC,MAAM,EAAE;QAClCV,kCAAkCQ,eAAe,OAAO;YACtDG,UAAU;gBAACF,cAAcG,IAAI;aAAC;YAC9BC,QAAQ;QACV;
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/ts/dynamodb/smithy-connection/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { type Tree, updateProjectConfiguration } from '@nx/devkit';\nimport { formatFilesInSubtree } from '../../../utils/format';\nimport { addGeneratorMetricsIfApplicable } from '../../../utils/metrics';\nimport {\n addComponentGeneratorMetadata,\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../../utils/nx';\nimport type { TsDynamoDBSmithyConnectionGeneratorSchema } from './schema';\n\nexport const TS_DYNAMODB_SMITHY_CONNECTION_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\nexport const tsDynamoDBSmithyConnectionGenerator = async (\n tree: Tree,\n options: TsDynamoDBSmithyConnectionGeneratorSchema,\n): Promise<void> => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n options.sourceProject,\n );\n const targetProject = readProjectConfigurationUnqualified(\n tree,\n options.targetProject,\n );\n\n if (sourceProject.targets?.['dev']) {\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', {\n projects: [targetProject.name],\n target: 'dev',\n });\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n }\n\n // Recorded so the version sync can identify this connection.\n addComponentGeneratorMetadata(\n tree,\n sourceProject.name,\n TS_DYNAMODB_SMITHY_CONNECTION_GENERATOR_INFO,\n targetProject.root,\n targetProject.name,\n );\n\n await addGeneratorMetricsIfApplicable(tree, [\n TS_DYNAMODB_SMITHY_CONNECTION_GENERATOR_INFO,\n ]);\n await formatFilesInSubtree(tree);\n};\n\nexport default tsDynamoDBSmithyConnectionGenerator;\n"],"names":["updateProjectConfiguration","formatFilesInSubtree","addGeneratorMetricsIfApplicable","addComponentGeneratorMetadata","addDependencyToTargetIfNotPresent","getGeneratorInfo","readProjectConfigurationUnqualified","TS_DYNAMODB_SMITHY_CONNECTION_GENERATOR_INFO","filename","tsDynamoDBSmithyConnectionGenerator","tree","options","sourceProject","targetProject","targets","projects","name","target","root"],"mappings":"AAAA;;;CAGC,GACD,SAAoBA,0BAA0B,QAAQ,aAAa;AACnE,SAASC,oBAAoB,QAAQ,2BAAwB;AAC7D,SAASC,+BAA+B,QAAQ,4BAAyB;AACzE,SACEC,6BAA6B,EAC7BC,iCAAiC,EACjCC,gBAAgB,EAEhBC,mCAAmC,QAC9B,uBAAoB;AAG3B,OAAO,MAAMC,+CACXF,iBAAiB,YAAYG,QAAQ,EAAE;AAEzC,OAAO,MAAMC,sCAAsC,OACjDC,MACAC;IAEA,MAAMC,gBAAgBN,oCACpBI,MACAC,QAAQC,aAAa;IAEvB,MAAMC,gBAAgBP,oCACpBI,MACAC,QAAQE,aAAa;IAGvB,IAAID,cAAcE,OAAO,EAAE,CAAC,MAAM,EAAE;QAClCV,kCAAkCQ,eAAe,OAAO;YACtDG,UAAU;gBAACF,cAAcG,IAAI;aAAC;YAC9BC,QAAQ;QACV;QACAjB,2BAA2BU,MAAME,cAAcI,IAAI,EAAEJ;IACvD;IAEA,6DAA6D;IAC7DT,8BACEO,MACAE,cAAcI,IAAI,EAClBT,8CACAM,cAAcK,IAAI,EAClBL,cAAcG,IAAI;IAGpB,MAAMd,gCAAgCQ,MAAM;QAC1CH;KACD;IACD,MAAMN,qBAAqBS;AAC7B,EAAE;AAEF,eAAeD,oCAAoC"}
|
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
exports[`ts#dynamodb trpc-connection generator > should add dynamodb dev dependency to trpc dev 1`] = `
|
|
4
4
|
{
|
|
5
5
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
6
|
+
"metadata": {
|
|
7
|
+
"components": [
|
|
8
|
+
{
|
|
9
|
+
"generator": "ts#dynamodb#trpc-connection",
|
|
10
|
+
"name": "db",
|
|
11
|
+
"path": "packages/db",
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
},
|
|
6
15
|
"name": "api",
|
|
7
16
|
"root": "packages/api",
|
|
8
17
|
"targets": {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/ import { updateProjectConfiguration } from "@nx/devkit";
|
|
5
5
|
import { formatFilesInSubtree } from "../../../utils/format.js";
|
|
6
6
|
import { addGeneratorMetricsIfApplicable } from "../../../utils/metrics.js";
|
|
7
|
-
import { addDependencyToTargetIfNotPresent, getGeneratorInfo, readProjectConfigurationUnqualified } from "../../../utils/nx.js";
|
|
7
|
+
import { addComponentGeneratorMetadata, addDependencyToTargetIfNotPresent, getGeneratorInfo, readProjectConfigurationUnqualified } from "../../../utils/nx.js";
|
|
8
8
|
export const TS_DYNAMODB_TRPC_CONNECTION_GENERATOR_INFO = getGeneratorInfo(import.meta.filename);
|
|
9
9
|
export const tsDynamoDBTrpcConnectionGenerator = async (tree, options)=>{
|
|
10
10
|
const sourceProject = readProjectConfigurationUnqualified(tree, options.sourceProject);
|
|
@@ -18,6 +18,8 @@ export const tsDynamoDBTrpcConnectionGenerator = async (tree, options)=>{
|
|
|
18
18
|
});
|
|
19
19
|
updateProjectConfiguration(tree, sourceProject.name, sourceProject);
|
|
20
20
|
}
|
|
21
|
+
// Recorded so the version sync can identify this connection.
|
|
22
|
+
addComponentGeneratorMetadata(tree, sourceProject.name, TS_DYNAMODB_TRPC_CONNECTION_GENERATOR_INFO, targetProject.root, targetProject.name);
|
|
21
23
|
await addGeneratorMetricsIfApplicable(tree, [
|
|
22
24
|
TS_DYNAMODB_TRPC_CONNECTION_GENERATOR_INFO
|
|
23
25
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/ts/dynamodb/trpc-connection/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { type Tree, updateProjectConfiguration } from '@nx/devkit';\nimport { formatFilesInSubtree } from '../../../utils/format';\nimport { addGeneratorMetricsIfApplicable } from '../../../utils/metrics';\nimport {\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../../utils/nx';\nimport type { TsDynamoDBTrpcConnectionGeneratorSchema } from './schema';\n\nexport const TS_DYNAMODB_TRPC_CONNECTION_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\nexport const tsDynamoDBTrpcConnectionGenerator = async (\n tree: Tree,\n options: TsDynamoDBTrpcConnectionGeneratorSchema,\n): Promise<void> => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n options.sourceProject,\n );\n const targetProject = readProjectConfigurationUnqualified(\n tree,\n options.targetProject,\n );\n\n if (sourceProject.targets?.['dev']) {\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', {\n projects: [targetProject.name],\n target: 'dev',\n });\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n }\n\n await addGeneratorMetricsIfApplicable(tree, [\n TS_DYNAMODB_TRPC_CONNECTION_GENERATOR_INFO,\n ]);\n await formatFilesInSubtree(tree);\n};\n\nexport default tsDynamoDBTrpcConnectionGenerator;\n"],"names":["updateProjectConfiguration","formatFilesInSubtree","addGeneratorMetricsIfApplicable","addDependencyToTargetIfNotPresent","getGeneratorInfo","readProjectConfigurationUnqualified","TS_DYNAMODB_TRPC_CONNECTION_GENERATOR_INFO","filename","tsDynamoDBTrpcConnectionGenerator","tree","options","sourceProject","targetProject","targets","projects","name","target"],"mappings":"AAAA;;;CAGC,GACD,SAAoBA,0BAA0B,QAAQ,aAAa;AACnE,SAASC,oBAAoB,QAAQ,2BAAwB;AAC7D,SAASC,+BAA+B,QAAQ,4BAAyB;AACzE,SACEC,iCAAiC,EACjCC,gBAAgB,EAEhBC,mCAAmC,QAC9B,uBAAoB;AAG3B,OAAO,MAAMC,6CACXF,iBAAiB,YAAYG,QAAQ,EAAE;AAEzC,OAAO,MAAMC,oCAAoC,OAC/CC,MACAC;IAEA,MAAMC,gBAAgBN,oCACpBI,MACAC,QAAQC,aAAa;IAEvB,MAAMC,gBAAgBP,oCACpBI,MACAC,QAAQE,aAAa;IAGvB,IAAID,cAAcE,OAAO,EAAE,CAAC,MAAM,EAAE;QAClCV,kCAAkCQ,eAAe,OAAO;YACtDG,UAAU;gBAACF,cAAcG,IAAI;aAAC;YAC9BC,QAAQ;QACV;
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/ts/dynamodb/trpc-connection/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { type Tree, updateProjectConfiguration } from '@nx/devkit';\nimport { formatFilesInSubtree } from '../../../utils/format';\nimport { addGeneratorMetricsIfApplicable } from '../../../utils/metrics';\nimport {\n addComponentGeneratorMetadata,\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../../utils/nx';\nimport type { TsDynamoDBTrpcConnectionGeneratorSchema } from './schema';\n\nexport const TS_DYNAMODB_TRPC_CONNECTION_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\nexport const tsDynamoDBTrpcConnectionGenerator = async (\n tree: Tree,\n options: TsDynamoDBTrpcConnectionGeneratorSchema,\n): Promise<void> => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n options.sourceProject,\n );\n const targetProject = readProjectConfigurationUnqualified(\n tree,\n options.targetProject,\n );\n\n if (sourceProject.targets?.['dev']) {\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', {\n projects: [targetProject.name],\n target: 'dev',\n });\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n }\n\n // Recorded so the version sync can identify this connection.\n addComponentGeneratorMetadata(\n tree,\n sourceProject.name,\n TS_DYNAMODB_TRPC_CONNECTION_GENERATOR_INFO,\n targetProject.root,\n targetProject.name,\n );\n\n await addGeneratorMetricsIfApplicable(tree, [\n TS_DYNAMODB_TRPC_CONNECTION_GENERATOR_INFO,\n ]);\n await formatFilesInSubtree(tree);\n};\n\nexport default tsDynamoDBTrpcConnectionGenerator;\n"],"names":["updateProjectConfiguration","formatFilesInSubtree","addGeneratorMetricsIfApplicable","addComponentGeneratorMetadata","addDependencyToTargetIfNotPresent","getGeneratorInfo","readProjectConfigurationUnqualified","TS_DYNAMODB_TRPC_CONNECTION_GENERATOR_INFO","filename","tsDynamoDBTrpcConnectionGenerator","tree","options","sourceProject","targetProject","targets","projects","name","target","root"],"mappings":"AAAA;;;CAGC,GACD,SAAoBA,0BAA0B,QAAQ,aAAa;AACnE,SAASC,oBAAoB,QAAQ,2BAAwB;AAC7D,SAASC,+BAA+B,QAAQ,4BAAyB;AACzE,SACEC,6BAA6B,EAC7BC,iCAAiC,EACjCC,gBAAgB,EAEhBC,mCAAmC,QAC9B,uBAAoB;AAG3B,OAAO,MAAMC,6CACXF,iBAAiB,YAAYG,QAAQ,EAAE;AAEzC,OAAO,MAAMC,oCAAoC,OAC/CC,MACAC;IAEA,MAAMC,gBAAgBN,oCACpBI,MACAC,QAAQC,aAAa;IAEvB,MAAMC,gBAAgBP,oCACpBI,MACAC,QAAQE,aAAa;IAGvB,IAAID,cAAcE,OAAO,EAAE,CAAC,MAAM,EAAE;QAClCV,kCAAkCQ,eAAe,OAAO;YACtDG,UAAU;gBAACF,cAAcG,IAAI;aAAC;YAC9BC,QAAQ;QACV;QACAjB,2BAA2BU,MAAME,cAAcI,IAAI,EAAEJ;IACvD;IAEA,6DAA6D;IAC7DT,8BACEO,MACAE,cAAcI,IAAI,EAClBT,4CACAM,cAAcK,IAAI,EAClBL,cAAcG,IAAI;IAGpB,MAAMd,gCAAgCQ,MAAM;QAC1CH;KACD;IACD,MAAMN,qBAAqBS;AAC7B,EAAE;AAEF,eAAeD,kCAAkC"}
|