@aws/nx-plugin 1.0.0-rc.13 → 1.0.0-rc.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/generators.json +28 -1
- package/package.json +1 -1
- package/src/connection/generator.d.ts +1 -1
- package/src/connection/generator.js +58 -42
- package/src/connection/generator.js.map +1 -1
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +7 -7
- package/src/infra/app/generator.js +4 -4
- package/src/infra/app/generator.js.map +1 -1
- package/src/preset/__snapshots__/generator.spec.ts.snap +3 -1
- package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +1486 -0
- package/src/py/dynamodb/agent-connection/__snapshots__/generator.spec.ts.snap +45 -0
- package/src/py/dynamodb/agent-connection/generator.d.ts +10 -0
- package/src/py/dynamodb/agent-connection/generator.js +39 -0
- package/src/py/dynamodb/agent-connection/generator.js.map +1 -0
- package/src/py/dynamodb/agent-connection/schema.d.ts +14 -0
- package/src/py/dynamodb/agent-connection/schema.json +22 -0
- package/src/py/dynamodb/fast-api-connection/__snapshots__/generator.spec.ts.snap +23 -0
- package/src/py/dynamodb/fast-api-connection/generator.d.ts +10 -0
- package/src/py/dynamodb/fast-api-connection/generator.js +37 -0
- package/src/py/dynamodb/fast-api-connection/generator.js.map +1 -0
- package/src/py/dynamodb/fast-api-connection/schema.d.ts +12 -0
- package/src/py/dynamodb/fast-api-connection/schema.json +18 -0
- package/src/py/dynamodb/files/__name__/__init__.py.template +6 -0
- package/src/py/dynamodb/files/__name__/client.py.template +39 -0
- package/src/py/dynamodb/files/__name__/entities/__init__.py.template +4 -0
- package/src/py/dynamodb/files/__name__/entities/base.py.template +63 -0
- package/src/py/dynamodb/files/__name__/entities/example.py.template +64 -0
- package/src/py/dynamodb/files/config.json.template +24 -0
- package/src/py/dynamodb/generator.d.ts +10 -0
- package/src/py/dynamodb/generator.js +106 -0
- package/src/py/dynamodb/generator.js.map +1 -0
- package/src/py/dynamodb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +45 -0
- package/src/py/dynamodb/mcp-server-connection/generator.d.ts +10 -0
- package/src/py/dynamodb/mcp-server-connection/generator.js +39 -0
- package/src/py/dynamodb/mcp-server-connection/generator.js.map +1 -0
- package/src/py/dynamodb/mcp-server-connection/schema.d.ts +14 -0
- package/src/py/dynamodb/mcp-server-connection/schema.json +22 -0
- package/src/py/dynamodb/schema.d.ts +15 -0
- package/src/py/dynamodb/schema.json +70 -0
- package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +303 -512
- package/src/ts/dynamodb/files/config.json.template +24 -0
- package/src/ts/dynamodb/files/src/client.ts.template +26 -10
- package/src/ts/dynamodb/files/src/index.ts.template +0 -8
- package/src/ts/dynamodb/generator.js +15 -12
- package/src/ts/dynamodb/generator.js.map +1 -1
- package/src/ts/dynamodb/schema.d.ts +1 -0
- package/src/ts/dynamodb/schema.json +20 -2
- package/src/utils/dynamodb-constructs/dynamodb-constructs.d.ts +0 -1
- package/src/utils/dynamodb-constructs/dynamodb-constructs.js.map +1 -1
- package/src/utils/dynamodb-constructs/files/cdk/app/dynamodb/__nameKebabCase__.ts.template +12 -13
- package/src/utils/dynamodb-constructs/files/terraform/app/dynamodb/__nameKebabCase__/__nameKebabCase__.tf.template +3 -3
- package/src/{ts/dynamodb/files/scripts → utils/files/common/scripts/src/dynamodb}/create-local-table.ts.template +63 -36
- package/src/utils/files/common/scripts/src/dynamodb/pull-image.ts.template +13 -0
- package/src/{ts/dynamodb/files/scripts → utils/files/common/scripts/src/dynamodb}/start-container.ts.template +28 -18
- package/src/utils/port.d.ts +6 -5
- package/src/utils/port.js +7 -5
- package/src/utils/port.js.map +1 -1
- package/src/utils/shared-constructs-constants.d.ts +1 -0
- package/src/utils/shared-constructs-constants.js +2 -1
- package/src/utils/shared-constructs-constants.js.map +1 -1
- package/src/utils/shared-dynamodb-scripts.d.ts +11 -0
- package/src/utils/shared-dynamodb-scripts.js +23 -0
- package/src/utils/shared-dynamodb-scripts.js.map +1 -0
- package/src/utils/shared-infra-scripts.d.ts +11 -0
- package/src/utils/shared-infra-scripts.js +35 -0
- package/src/utils/shared-infra-scripts.js.map +1 -0
- package/src/utils/shared-scripts.d.ts +1 -4
- package/src/utils/shared-scripts.js +2 -23
- package/src/utils/shared-scripts.js.map +1 -1
- package/src/utils/versions.d.ts +1 -0
- package/src/utils/versions.js +1 -0
- package/src/utils/versions.js.map +1 -1
- package/src/ts/dynamodb/files/dynamodb.config.json +0 -14
- package/src/ts/dynamodb/files/scripts/pull-image.ts.template +0 -15
- package/src/ts/dynamodb/files/src/constants.ts.template +0 -9
- /package/src/utils/files/common/scripts/src/{index.ts.template → infra/index.ts.template} +0 -0
- /package/src/utils/files/common/scripts/src/{infra-deploy.ts.template → infra/infra-deploy.ts.template} +0 -0
- /package/src/utils/files/common/scripts/src/{infra-destroy.ts.template → infra/infra-destroy.ts.template} +0 -0
- /package/src/utils/files/common/scripts/src/{stage-credentials → infra/stage-credentials}/cdk-command.ts.template +0 -0
- /package/src/utils/files/common/scripts/src/{stage-credentials → infra/stage-credentials}/credentials.ts.template +0 -0
- /package/src/utils/files/common/scripts/src/{stage-credentials → infra/stage-credentials}/run.ts.template +0 -0
- /package/src/utils/files/common/scripts/src/{stage-credentials → infra/stage-credentials}/stage-parser.ts.template +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`py#dynamodb agent-connection generator > should add dynamodb serve-local dependency to agent serve-local 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
6
|
+
"name": "my-agent",
|
|
7
|
+
"root": "packages/my-agent",
|
|
8
|
+
"targets": {
|
|
9
|
+
"agent-serve-local": {
|
|
10
|
+
"continuous": true,
|
|
11
|
+
"dependsOn": [
|
|
12
|
+
{
|
|
13
|
+
"projects": [
|
|
14
|
+
"db",
|
|
15
|
+
],
|
|
16
|
+
"target": "serve-local",
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
"executor": "nx:run-commands",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
exports[`py#dynamodb agent-connection generator > should use sourceComponent name when provided 1`] = `
|
|
26
|
+
{
|
|
27
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
28
|
+
"name": "my-agent",
|
|
29
|
+
"root": "packages/my-agent",
|
|
30
|
+
"targets": {
|
|
31
|
+
"custom-agent-serve-local": {
|
|
32
|
+
"continuous": true,
|
|
33
|
+
"dependsOn": [
|
|
34
|
+
{
|
|
35
|
+
"projects": [
|
|
36
|
+
"db",
|
|
37
|
+
],
|
|
38
|
+
"target": "serve-local",
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
"executor": "nx:run-commands",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
@@ -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 { type GeneratorCallback, type Tree } from '@nx/devkit';
|
|
6
|
+
import { type NxGeneratorInfo } from '../../../utils/nx';
|
|
7
|
+
import type { PyDynamoDBAgentConnectionGeneratorSchema } from './schema';
|
|
8
|
+
export declare const PY_DYNAMODB_AGENT_CONNECTION_GENERATOR_INFO: NxGeneratorInfo;
|
|
9
|
+
export declare const pyDynamoDBAgentConnectionGenerator: (tree: Tree, options: PyDynamoDBAgentConnectionGeneratorSchema) => Promise<GeneratorCallback>;
|
|
10
|
+
export default pyDynamoDBAgentConnectionGenerator;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pyDynamoDBAgentConnectionGenerator = exports.PY_DYNAMODB_AGENT_CONNECTION_GENERATOR_INFO = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
const devkit_1 = require("@nx/devkit");
|
|
9
|
+
const format_1 = require("../../../utils/format");
|
|
10
|
+
const metrics_1 = require("../../../utils/metrics");
|
|
11
|
+
const nx_1 = require("../../../utils/nx");
|
|
12
|
+
const nxlv_python_1 = require("../../../utils/nxlv-python");
|
|
13
|
+
const py_1 = require("../../../utils/py");
|
|
14
|
+
exports.PY_DYNAMODB_AGENT_CONNECTION_GENERATOR_INFO = (0, nx_1.getGeneratorInfo)(__filename);
|
|
15
|
+
const pyDynamoDBAgentConnectionGenerator = async (tree, options) => {
|
|
16
|
+
const sourceProject = (0, nx_1.readProjectConfigurationUnqualified)(tree, options.sourceProject);
|
|
17
|
+
const targetProject = (0, nx_1.readProjectConfigurationUnqualified)(tree, options.targetProject);
|
|
18
|
+
(0, py_1.addWorkspaceDependencyToPyProject)(tree, sourceProject.root, targetProject.name);
|
|
19
|
+
const agentName = options.sourceComponent?.name ?? 'agent';
|
|
20
|
+
const serveLocalTarget = `${agentName}-serve-local`;
|
|
21
|
+
if (sourceProject.targets?.[serveLocalTarget]) {
|
|
22
|
+
(0, nx_1.addDependencyToTargetIfNotPresent)(sourceProject, serveLocalTarget, {
|
|
23
|
+
projects: [targetProject.name],
|
|
24
|
+
target: 'serve-local',
|
|
25
|
+
});
|
|
26
|
+
(0, devkit_1.updateProjectConfiguration)(tree, sourceProject.name, sourceProject);
|
|
27
|
+
}
|
|
28
|
+
await (0, metrics_1.addGeneratorMetricsIfApplicable)(tree, [
|
|
29
|
+
exports.PY_DYNAMODB_AGENT_CONNECTION_GENERATOR_INFO,
|
|
30
|
+
]);
|
|
31
|
+
await (0, format_1.formatFilesInSubtree)(tree);
|
|
32
|
+
return async () => {
|
|
33
|
+
(0, devkit_1.installPackagesTask)(tree);
|
|
34
|
+
await new nxlv_python_1.UVProvider(tree.root, new nxlv_python_1.Logger(), tree).install();
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
exports.pyDynamoDBAgentConnectionGenerator = pyDynamoDBAgentConnectionGenerator;
|
|
38
|
+
exports.default = exports.pyDynamoDBAgentConnectionGenerator;
|
|
39
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/nx-plugin/src/py/dynamodb/agent-connection/generator.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCAKoB;AACpB,kDAA6D;AAC7D,oDAAyE;AACzE,0CAK2B;AAC3B,4DAAgE;AAChE,0CAAsE;AAGzD,QAAA,2CAA2C,GACtD,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAExB,MAAM,kCAAkC,GAAG,KAAK,EACrD,IAAU,EACV,OAAiD,EACrB,EAAE;IAC9B,MAAM,aAAa,GAAG,IAAA,wCAAmC,EACvD,IAAI,EACJ,OAAO,CAAC,aAAa,CACtB,CAAC;IACF,MAAM,aAAa,GAAG,IAAA,wCAAmC,EACvD,IAAI,EACJ,OAAO,CAAC,aAAa,CACtB,CAAC;IAEF,IAAA,sCAAiC,EAC/B,IAAI,EACJ,aAAa,CAAC,IAAI,EAClB,aAAa,CAAC,IAAK,CACpB,CAAC;IAEF,MAAM,SAAS,GAAG,OAAO,CAAC,eAAe,EAAE,IAAI,IAAI,OAAO,CAAC;IAC3D,MAAM,gBAAgB,GAAG,GAAG,SAAS,cAAc,CAAC;IAEpD,IAAI,aAAa,CAAC,OAAO,EAAE,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC9C,IAAA,sCAAiC,EAAC,aAAa,EAAE,gBAAgB,EAAE;YACjE,QAAQ,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC;YAC9B,MAAM,EAAE,aAAa;SACtB,CAAC,CAAC;QACH,IAAA,mCAA0B,EAAC,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,IAAA,yCAA+B,EAAC,IAAI,EAAE;QAC1C,mDAA2C;KAC5C,CAAC,CAAC;IACH,MAAM,IAAA,6BAAoB,EAAC,IAAI,CAAC,CAAC;IACjC,OAAO,KAAK,IAAI,EAAE;QAChB,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;QAC1B,MAAM,IAAI,wBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,oBAAM,EAAE,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;IAChE,CAAC,CAAC;AACJ,CAAC,CAAC;AAtCW,QAAA,kCAAkC,sCAsC7C;AAEF,kBAAe,0CAAkC,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
|
+
import { ComponentMetadata } from '../../../utils/nx';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* TypeScript types for options defined in schema.json
|
|
9
|
+
*/
|
|
10
|
+
export interface PyDynamoDBAgentConnectionGeneratorSchema {
|
|
11
|
+
sourceProject: string;
|
|
12
|
+
targetProject: string;
|
|
13
|
+
sourceComponent?: ComponentMetadata;
|
|
14
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "py#dynamodb#agent-connection",
|
|
4
|
+
"title": "py#dynamodb#agent-connection",
|
|
5
|
+
"description": "Connect a py#agent to a py#dynamodb project",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"sourceProject": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The project containing the py#agent to connect from"
|
|
11
|
+
},
|
|
12
|
+
"targetProject": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "The py#dynamodb project to connect to"
|
|
15
|
+
},
|
|
16
|
+
"sourceComponent": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "The agent component name"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"required": ["sourceProject", "targetProject"]
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`py#dynamodb fast-api-connection generator > should add dynamodb serve-local dependency to fast-api serve-local 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
6
|
+
"name": "api",
|
|
7
|
+
"root": "packages/api",
|
|
8
|
+
"targets": {
|
|
9
|
+
"serve-local": {
|
|
10
|
+
"continuous": true,
|
|
11
|
+
"dependsOn": [
|
|
12
|
+
{
|
|
13
|
+
"projects": [
|
|
14
|
+
"db",
|
|
15
|
+
],
|
|
16
|
+
"target": "serve-local",
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
"executor": "nx:run-commands",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
@@ -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 { type GeneratorCallback, type Tree } from '@nx/devkit';
|
|
6
|
+
import { type NxGeneratorInfo } from '../../../utils/nx';
|
|
7
|
+
import type { PyDynamoDBFastApiConnectionGeneratorSchema } from './schema';
|
|
8
|
+
export declare const PY_DYNAMODB_FAST_API_CONNECTION_GENERATOR_INFO: NxGeneratorInfo;
|
|
9
|
+
export declare const pyDynamoDBFastApiConnectionGenerator: (tree: Tree, options: PyDynamoDBFastApiConnectionGeneratorSchema) => Promise<GeneratorCallback>;
|
|
10
|
+
export default pyDynamoDBFastApiConnectionGenerator;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pyDynamoDBFastApiConnectionGenerator = exports.PY_DYNAMODB_FAST_API_CONNECTION_GENERATOR_INFO = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
const devkit_1 = require("@nx/devkit");
|
|
9
|
+
const format_1 = require("../../../utils/format");
|
|
10
|
+
const metrics_1 = require("../../../utils/metrics");
|
|
11
|
+
const nx_1 = require("../../../utils/nx");
|
|
12
|
+
const nxlv_python_1 = require("../../../utils/nxlv-python");
|
|
13
|
+
const py_1 = require("../../../utils/py");
|
|
14
|
+
exports.PY_DYNAMODB_FAST_API_CONNECTION_GENERATOR_INFO = (0, nx_1.getGeneratorInfo)(__filename);
|
|
15
|
+
const pyDynamoDBFastApiConnectionGenerator = async (tree, options) => {
|
|
16
|
+
const sourceProject = (0, nx_1.readProjectConfigurationUnqualified)(tree, options.sourceProject);
|
|
17
|
+
const targetProject = (0, nx_1.readProjectConfigurationUnqualified)(tree, options.targetProject);
|
|
18
|
+
(0, py_1.addWorkspaceDependencyToPyProject)(tree, sourceProject.root, targetProject.name);
|
|
19
|
+
if (sourceProject.targets?.['serve-local']) {
|
|
20
|
+
(0, nx_1.addDependencyToTargetIfNotPresent)(sourceProject, 'serve-local', {
|
|
21
|
+
projects: [targetProject.name],
|
|
22
|
+
target: 'serve-local',
|
|
23
|
+
});
|
|
24
|
+
(0, devkit_1.updateProjectConfiguration)(tree, sourceProject.name, sourceProject);
|
|
25
|
+
}
|
|
26
|
+
await (0, metrics_1.addGeneratorMetricsIfApplicable)(tree, [
|
|
27
|
+
exports.PY_DYNAMODB_FAST_API_CONNECTION_GENERATOR_INFO,
|
|
28
|
+
]);
|
|
29
|
+
await (0, format_1.formatFilesInSubtree)(tree);
|
|
30
|
+
return async () => {
|
|
31
|
+
(0, devkit_1.installPackagesTask)(tree);
|
|
32
|
+
await new nxlv_python_1.UVProvider(tree.root, new nxlv_python_1.Logger(), tree).install();
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
exports.pyDynamoDBFastApiConnectionGenerator = pyDynamoDBFastApiConnectionGenerator;
|
|
36
|
+
exports.default = exports.pyDynamoDBFastApiConnectionGenerator;
|
|
37
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/nx-plugin/src/py/dynamodb/fast-api-connection/generator.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCAKoB;AACpB,kDAA6D;AAC7D,oDAAyE;AACzE,0CAK2B;AAC3B,4DAAgE;AAChE,0CAAsE;AAGzD,QAAA,8CAA8C,GACzD,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAExB,MAAM,oCAAoC,GAAG,KAAK,EACvD,IAAU,EACV,OAAmD,EACvB,EAAE;IAC9B,MAAM,aAAa,GAAG,IAAA,wCAAmC,EACvD,IAAI,EACJ,OAAO,CAAC,aAAa,CACtB,CAAC;IACF,MAAM,aAAa,GAAG,IAAA,wCAAmC,EACvD,IAAI,EACJ,OAAO,CAAC,aAAa,CACtB,CAAC;IAEF,IAAA,sCAAiC,EAC/B,IAAI,EACJ,aAAa,CAAC,IAAI,EAClB,aAAa,CAAC,IAAK,CACpB,CAAC;IAEF,IAAI,aAAa,CAAC,OAAO,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC;QAC3C,IAAA,sCAAiC,EAAC,aAAa,EAAE,aAAa,EAAE;YAC9D,QAAQ,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC;YAC9B,MAAM,EAAE,aAAa;SACtB,CAAC,CAAC;QACH,IAAA,mCAA0B,EAAC,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,IAAA,yCAA+B,EAAC,IAAI,EAAE;QAC1C,sDAA8C;KAC/C,CAAC,CAAC;IACH,MAAM,IAAA,6BAAoB,EAAC,IAAI,CAAC,CAAC;IACjC,OAAO,KAAK,IAAI,EAAE;QAChB,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;QAC1B,MAAM,IAAI,wBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,oBAAM,EAAE,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;IAChE,CAAC,CAAC;AACJ,CAAC,CAAC;AAnCW,QAAA,oCAAoC,wCAmC/C;AAEF,kBAAe,4CAAoC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* TypeScript types for options defined in schema.json
|
|
8
|
+
*/
|
|
9
|
+
export interface PyDynamoDBFastApiConnectionGeneratorSchema {
|
|
10
|
+
sourceProject: string;
|
|
11
|
+
targetProject: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "py#dynamodb#fast-api-connection",
|
|
4
|
+
"title": "py#dynamodb#fast-api-connection",
|
|
5
|
+
"description": "Connect a py#fast-api project to a py#dynamodb project",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"sourceProject": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The py#fast-api project to connect from"
|
|
11
|
+
},
|
|
12
|
+
"targetProject": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "The py#dynamodb project to connect to"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"required": ["sourceProject", "targetProject"]
|
|
18
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
from typing import Any, cast
|
|
4
|
+
|
|
5
|
+
# Generated: must match runtimeConfigKey in config.json
|
|
6
|
+
runtime_config_key = '<%= runtimeConfigKey %>'
|
|
7
|
+
|
|
8
|
+
# config.json is only present in local dev (not in the deployed bundle),
|
|
9
|
+
# so calls to _serve_local must be guarded by is_local().
|
|
10
|
+
def _serve_local() -> dict:
|
|
11
|
+
config_path = os.path.join(os.path.dirname(__file__), '..', 'config.json')
|
|
12
|
+
with open(config_path) as f:
|
|
13
|
+
return json.load(f)['serveLocal']
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def is_local() -> bool:
|
|
17
|
+
return os.environ.get("SERVE_LOCAL") == "true"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
_table_name: str | None = None
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def get_table_name() -> str:
|
|
24
|
+
global _table_name
|
|
25
|
+
if is_local():
|
|
26
|
+
return _serve_local()['tableName']
|
|
27
|
+
if _table_name is None:
|
|
28
|
+
from aws_lambda_powertools.utilities.parameters import AppConfigProvider
|
|
29
|
+
|
|
30
|
+
app_id = os.environ.get("RUNTIME_CONFIG_APP_ID")
|
|
31
|
+
if not app_id:
|
|
32
|
+
raise ValueError("RUNTIME_CONFIG_APP_ID environment variable is not set")
|
|
33
|
+
provider = AppConfigProvider(application=app_id, environment="default")
|
|
34
|
+
config = cast(dict[str, Any], provider.get("dynamodb", transform="json") or {})
|
|
35
|
+
table_name = (config.get(runtime_config_key) or {}).get("tableName")
|
|
36
|
+
if not table_name:
|
|
37
|
+
raise ValueError("Could not resolve table name from runtime config")
|
|
38
|
+
_table_name = table_name
|
|
39
|
+
return _table_name
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
from pynamodb.attributes import DiscriminatorAttribute, UnicodeAttribute
|
|
4
|
+
from pynamodb.indexes import AllProjection, GlobalSecondaryIndex
|
|
5
|
+
from pynamodb.models import Model
|
|
6
|
+
|
|
7
|
+
from ..client import _serve_local, get_table_name, is_local
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Gsi1Index(GlobalSecondaryIndex):
|
|
11
|
+
class Meta:
|
|
12
|
+
index_name = 'gsi1pk-gsi1sk-index'
|
|
13
|
+
projection = AllProjection()
|
|
14
|
+
|
|
15
|
+
gsi1pk = UnicodeAttribute(hash_key=True)
|
|
16
|
+
gsi1sk = UnicodeAttribute(range_key=True)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class Gsi2Index(GlobalSecondaryIndex):
|
|
20
|
+
class Meta:
|
|
21
|
+
index_name = 'gsi2pk-gsi2sk-index'
|
|
22
|
+
projection = AllProjection()
|
|
23
|
+
|
|
24
|
+
gsi2pk = UnicodeAttribute(hash_key=True)
|
|
25
|
+
gsi2sk = UnicodeAttribute(range_key=True)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class BaseModel(Model):
|
|
29
|
+
"""Base model for all DynamoDB entities in this table.
|
|
30
|
+
|
|
31
|
+
All entity models MUST extend this class. It wires up the correct DynamoDB
|
|
32
|
+
table name at runtime — resolving from AWS AppConfig when deployed, or from
|
|
33
|
+
config.json when running locally via DynamoDB Local — by overriding
|
|
34
|
+
_get_connection(). Without this, PynamoDB will not know which table to use.
|
|
35
|
+
|
|
36
|
+
Also uses PynamoDB polymorphism to support multiple entity types in a single
|
|
37
|
+
table via DiscriminatorAttribute.
|
|
38
|
+
See https://pynamodb.readthedocs.io/en/stable/polymorphism.html
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
class Meta:
|
|
42
|
+
table_name: str
|
|
43
|
+
region = os.environ.get("AWS_REGION", 'us-east-1')
|
|
44
|
+
host = f"http://localhost:{_serve_local()['port']}" if is_local() else None
|
|
45
|
+
aws_access_key_id = 'UNUSED' if is_local() else None
|
|
46
|
+
aws_secret_access_key = 'UNUSED' if is_local() else None
|
|
47
|
+
|
|
48
|
+
entity_type = DiscriminatorAttribute()
|
|
49
|
+
|
|
50
|
+
pk = UnicodeAttribute(hash_key=True)
|
|
51
|
+
sk = UnicodeAttribute(range_key=True)
|
|
52
|
+
gsi1pk = UnicodeAttribute(null=True)
|
|
53
|
+
gsi1sk = UnicodeAttribute(null=True)
|
|
54
|
+
gsi2pk = UnicodeAttribute(null=True)
|
|
55
|
+
gsi2sk = UnicodeAttribute(null=True)
|
|
56
|
+
|
|
57
|
+
gsi1_index = Gsi1Index()
|
|
58
|
+
gsi2_index = Gsi2Index()
|
|
59
|
+
|
|
60
|
+
@classmethod
|
|
61
|
+
def _get_connection(cls):
|
|
62
|
+
cls.Meta.table_name = get_table_name()
|
|
63
|
+
return super()._get_connection()
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
from collections.abc import Iterator
|
|
2
|
+
from datetime import UTC, datetime
|
|
3
|
+
|
|
4
|
+
from pynamodb.attributes import UnicodeAttribute
|
|
5
|
+
|
|
6
|
+
from .base import BaseModel
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Example entity using PynamoDB - replace with your own entities
|
|
10
|
+
# See https://pynamodb.readthedocs.io/en/stable/tutorial.html for documentation
|
|
11
|
+
class ExampleModel(BaseModel, discriminator="ExampleModel"):
|
|
12
|
+
"""Example entity demonstrating single-table design with GSI access patterns.
|
|
13
|
+
|
|
14
|
+
Key design:
|
|
15
|
+
pk=EXAMPLE#{id}, sk=EXAMPLE#{id}
|
|
16
|
+
gsi1pk=CATEGORY#{category}, gsi1sk=EXAMPLE#{id}
|
|
17
|
+
gsi2pk=EXAMPLE, gsi2sk={created_at ISO-8601}
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
name = UnicodeAttribute()
|
|
21
|
+
category = UnicodeAttribute()
|
|
22
|
+
created_at = UnicodeAttribute()
|
|
23
|
+
updated_at = UnicodeAttribute()
|
|
24
|
+
|
|
25
|
+
@classmethod
|
|
26
|
+
def make_pk(cls, id: str) -> str:
|
|
27
|
+
return f"EXAMPLE#{id}"
|
|
28
|
+
|
|
29
|
+
# ── Writes ────────────────────────────────────────────────────────────────
|
|
30
|
+
@classmethod
|
|
31
|
+
def create(cls, id: str, name: str, category: str) -> ExampleModel:
|
|
32
|
+
now = datetime.now(UTC).isoformat()
|
|
33
|
+
item = cls(
|
|
34
|
+
pk=cls.make_pk(id),
|
|
35
|
+
sk=cls.make_pk(id),
|
|
36
|
+
gsi1pk=f"CATEGORY#{category}",
|
|
37
|
+
gsi1sk=cls.make_pk(id),
|
|
38
|
+
gsi2pk="EXAMPLE",
|
|
39
|
+
gsi2sk=now,
|
|
40
|
+
name=name,
|
|
41
|
+
category=category,
|
|
42
|
+
created_at=now,
|
|
43
|
+
updated_at=now,
|
|
44
|
+
)
|
|
45
|
+
item.save()
|
|
46
|
+
return item
|
|
47
|
+
|
|
48
|
+
# ── Primary index ─────────────────────────────────────────────────────────
|
|
49
|
+
@classmethod
|
|
50
|
+
def get_by_id(cls, id: str) -> ExampleModel:
|
|
51
|
+
"""Exact lookup by pk + sk."""
|
|
52
|
+
return cls.get(cls.make_pk(id), cls.make_pk(id))
|
|
53
|
+
|
|
54
|
+
# ── gsi1_index: partition=category, sort=id ───────────────────────────────
|
|
55
|
+
@classmethod
|
|
56
|
+
def list_by_category(cls, category: str) -> Iterator[ExampleModel]:
|
|
57
|
+
"""All items in a category."""
|
|
58
|
+
return cls.gsi1_index.query(f"CATEGORY#{category}")
|
|
59
|
+
|
|
60
|
+
# ── gsi2_index: partition=type, sort=created_at ───────────────────────────
|
|
61
|
+
@classmethod
|
|
62
|
+
def list_by_date(cls, limit: int | None = None) -> Iterator[ExampleModel]:
|
|
63
|
+
"""All examples, newest first."""
|
|
64
|
+
return cls.gsi2_index.query("EXAMPLE", limit=limit, scan_index_forward=False)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"runtimeConfigKey": "<%= runtimeConfigKey %>",
|
|
3
|
+
"serveLocal": {
|
|
4
|
+
"port": <%= localDynamoDBPort %>,
|
|
5
|
+
"tableName": "<%= localTableName %>",
|
|
6
|
+
"image": "public.ecr.aws/aws-dynamodb-local/aws-dynamodb-local:latest",
|
|
7
|
+
"containerName": "<%= containerName %>",
|
|
8
|
+
"containerEngine": "<%= containerEngine %>"
|
|
9
|
+
},
|
|
10
|
+
"tableConfig": {
|
|
11
|
+
"globalSecondaryIndexes": [
|
|
12
|
+
{
|
|
13
|
+
"indexName": "gsi1pk-gsi1sk-index",
|
|
14
|
+
"partitionKey": "gsi1pk",
|
|
15
|
+
"sortKey": "gsi1sk"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"indexName": "gsi2pk-gsi2sk-index",
|
|
19
|
+
"partitionKey": "gsi2pk",
|
|
20
|
+
"sortKey": "gsi2sk"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -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 { type GeneratorCallback, type Tree } from '@nx/devkit';
|
|
6
|
+
import { type NxGeneratorInfo } from '../../utils/nx';
|
|
7
|
+
import type { PyDynamoDBGeneratorSchema } from './schema';
|
|
8
|
+
export declare const PY_DYNAMODB_GENERATOR_INFO: NxGeneratorInfo;
|
|
9
|
+
export declare const pyDynamoDBGenerator: (tree: Tree, options: PyDynamoDBGeneratorSchema) => Promise<GeneratorCallback>;
|
|
10
|
+
export default pyDynamoDBGenerator;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.pyDynamoDBGenerator = exports.PY_DYNAMODB_GENERATOR_INFO = void 0;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const node_path_1 = require("node:path");
|
|
10
|
+
const devkit_1 = require("@nx/devkit");
|
|
11
|
+
const containers_1 = require("../../utils/containers");
|
|
12
|
+
const dynamodb_constructs_1 = require("../../utils/dynamodb-constructs/dynamodb-constructs");
|
|
13
|
+
const format_1 = require("../../utils/format");
|
|
14
|
+
const iac_1 = require("../../utils/iac");
|
|
15
|
+
const metrics_1 = require("../../utils/metrics");
|
|
16
|
+
const names_1 = require("../../utils/names");
|
|
17
|
+
const npm_scope_1 = require("../../utils/npm-scope");
|
|
18
|
+
const nx_1 = require("../../utils/nx");
|
|
19
|
+
const nxlv_python_1 = require("../../utils/nxlv-python");
|
|
20
|
+
const port_1 = require("../../utils/port");
|
|
21
|
+
const py_1 = require("../../utils/py");
|
|
22
|
+
const shared_constructs_1 = require("../../utils/shared-constructs");
|
|
23
|
+
const shared_constructs_constants_1 = require("../../utils/shared-constructs-constants");
|
|
24
|
+
const shared_dynamodb_scripts_1 = require("../../utils/shared-dynamodb-scripts");
|
|
25
|
+
const generator_1 = tslib_1.__importStar(require("../project/generator"));
|
|
26
|
+
exports.PY_DYNAMODB_GENERATOR_INFO = (0, nx_1.getGeneratorInfo)(__filename);
|
|
27
|
+
const pyDynamoDBGenerator = async (tree, options) => {
|
|
28
|
+
const nameClassName = (0, names_1.toClassName)(options.name);
|
|
29
|
+
const localTableName = `${(0, npm_scope_1.getNpmScope)(tree)}-${(0, names_1.kebabCase)(options.tableName ?? options.name)}`;
|
|
30
|
+
const containerEngine = await (0, containers_1.resolveContainers)(tree, 'inherit');
|
|
31
|
+
const { fullyQualifiedName, dir, normalizedModuleName } = (0, generator_1.getPyProjectDetails)(tree, {
|
|
32
|
+
name: options.name,
|
|
33
|
+
directory: options.directory,
|
|
34
|
+
subDirectory: options.subDirectory,
|
|
35
|
+
});
|
|
36
|
+
if (!(0, nx_1.projectExists)(tree, fullyQualifiedName)) {
|
|
37
|
+
await (0, generator_1.default)(tree, {
|
|
38
|
+
name: options.name,
|
|
39
|
+
directory: options.directory,
|
|
40
|
+
subDirectory: options.subDirectory,
|
|
41
|
+
type: 'library',
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, fullyQualifiedName);
|
|
45
|
+
const localDynamoDBPort = (0, port_1.assignSharedPort)(tree, projectConfig, shared_constructs_constants_1.DYNAMODB_GENERATOR_IDS, 8000);
|
|
46
|
+
const containerName = `${(0, npm_scope_1.getNpmScope)(tree)}-dynamodb`;
|
|
47
|
+
const templateOptions = {
|
|
48
|
+
name: normalizedModuleName,
|
|
49
|
+
runtimeConfigKey: nameClassName,
|
|
50
|
+
localDynamoDBPort,
|
|
51
|
+
localTableName,
|
|
52
|
+
containerName,
|
|
53
|
+
containerEngine,
|
|
54
|
+
};
|
|
55
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), dir, templateOptions);
|
|
56
|
+
await (0, shared_dynamodb_scripts_1.sharedDynamoDBScriptsGenerator)(tree);
|
|
57
|
+
const scriptsDir = (0, node_path_1.relative)(dir, (0, devkit_1.joinPathFragments)(shared_constructs_constants_1.PACKAGES_DIR, shared_constructs_constants_1.SHARED_SCRIPTS_DIR, 'src', 'dynamodb'));
|
|
58
|
+
projectConfig.targets['pull-image'] = {
|
|
59
|
+
executor: 'nx:run-commands',
|
|
60
|
+
options: {
|
|
61
|
+
command: `tsx ${scriptsDir}/pull-image.ts`,
|
|
62
|
+
cwd: '{projectRoot}',
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
projectConfig.targets['serve-local'] = {
|
|
66
|
+
executor: 'nx:run-commands',
|
|
67
|
+
continuous: true,
|
|
68
|
+
dependsOn: ['pull-image'],
|
|
69
|
+
options: {
|
|
70
|
+
commands: [
|
|
71
|
+
`tsx ${scriptsDir}/start-container.ts`,
|
|
72
|
+
`tsx ${scriptsDir}/create-local-table.ts`,
|
|
73
|
+
],
|
|
74
|
+
parallel: true,
|
|
75
|
+
cwd: '{projectRoot}',
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
(0, devkit_1.updateProjectConfiguration)(tree, fullyQualifiedName, projectConfig);
|
|
79
|
+
(0, nx_1.addGeneratorMetadata)(tree, fullyQualifiedName, exports.PY_DYNAMODB_GENERATOR_INFO);
|
|
80
|
+
if (options.infra !== 'none') {
|
|
81
|
+
const iac = await (0, iac_1.resolveIac)(tree, options.iac);
|
|
82
|
+
await (0, shared_constructs_1.sharedConstructsGenerator)(tree, { iac });
|
|
83
|
+
await (0, dynamodb_constructs_1.addDynamoDBInfra)(tree, {
|
|
84
|
+
iac,
|
|
85
|
+
projectName: fullyQualifiedName,
|
|
86
|
+
nameClassName,
|
|
87
|
+
nameKebabCase: (0, names_1.kebabCase)(options.name),
|
|
88
|
+
tableName: localTableName,
|
|
89
|
+
projectRoot: dir,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
(0, py_1.addDependenciesToPyProjectToml)(tree, dir, [
|
|
93
|
+
'pynamodb',
|
|
94
|
+
'boto3',
|
|
95
|
+
'aws-lambda-powertools',
|
|
96
|
+
]);
|
|
97
|
+
await (0, metrics_1.addGeneratorMetricsIfApplicable)(tree, [exports.PY_DYNAMODB_GENERATOR_INFO]);
|
|
98
|
+
await (0, format_1.formatFilesInSubtree)(tree);
|
|
99
|
+
return async () => {
|
|
100
|
+
(0, devkit_1.installPackagesTask)(tree);
|
|
101
|
+
await new nxlv_python_1.UVProvider(tree.root, new nxlv_python_1.Logger(), tree).install();
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
exports.pyDynamoDBGenerator = pyDynamoDBGenerator;
|
|
105
|
+
exports.default = exports.pyDynamoDBGenerator;
|
|
106
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/py/dynamodb/generator.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`py#dynamodb mcp-server-connection generator > should add dynamodb serve-local dependency to mcp-server serve-local 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
6
|
+
"name": "my-mcp-server",
|
|
7
|
+
"root": "packages/my-mcp-server",
|
|
8
|
+
"targets": {
|
|
9
|
+
"mcp-server-serve-local": {
|
|
10
|
+
"continuous": true,
|
|
11
|
+
"dependsOn": [
|
|
12
|
+
{
|
|
13
|
+
"projects": [
|
|
14
|
+
"db",
|
|
15
|
+
],
|
|
16
|
+
"target": "serve-local",
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
"executor": "nx:run-commands",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
exports[`py#dynamodb mcp-server-connection generator > should use sourceComponent name when provided 1`] = `
|
|
26
|
+
{
|
|
27
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
28
|
+
"name": "my-mcp-server",
|
|
29
|
+
"root": "packages/my-mcp-server",
|
|
30
|
+
"targets": {
|
|
31
|
+
"custom-mcp-server-serve-local": {
|
|
32
|
+
"continuous": true,
|
|
33
|
+
"dependsOn": [
|
|
34
|
+
{
|
|
35
|
+
"projects": [
|
|
36
|
+
"db",
|
|
37
|
+
],
|
|
38
|
+
"target": "serve-local",
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
"executor": "nx:run-commands",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
@@ -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 { type GeneratorCallback, type Tree } from '@nx/devkit';
|
|
6
|
+
import { type NxGeneratorInfo } from '../../../utils/nx';
|
|
7
|
+
import type { PyDynamoDBMcpServerConnectionGeneratorSchema } from './schema';
|
|
8
|
+
export declare const PY_DYNAMODB_MCP_SERVER_CONNECTION_GENERATOR_INFO: NxGeneratorInfo;
|
|
9
|
+
export declare const pyDynamoDBMcpServerConnectionGenerator: (tree: Tree, options: PyDynamoDBMcpServerConnectionGeneratorSchema) => Promise<GeneratorCallback>;
|
|
10
|
+
export default pyDynamoDBMcpServerConnectionGenerator;
|