@aws/nx-plugin 0.113.0 → 0.114.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/generators.json +33 -1
- package/package.json +1 -1
- package/src/connection/generator.d.ts +2 -2
- package/src/connection/generator.js +19 -0
- package/src/connection/generator.js.map +1 -1
- package/src/smithy/project/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/smithy/project/files/build.Dockerfile.template +1 -1
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +4 -3
- package/src/ts/mcp-server/files/http.ts.template +1 -1
- package/src/ts/mcp-server/files/server.ts.template +1 -1
- package/src/ts/mcp-server/files/stdio.ts.template +2 -1
- package/src/ts/nx-plugin/__snapshots__/generator.spec.ts.snap +3 -2
- package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +54 -44
- package/src/ts/rdb/files/src/prisma.ts.template +54 -46
- package/src/ts/rdb/generator.js +3 -0
- package/src/ts/rdb/generator.js.map +1 -1
- package/src/ts/rdb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +117 -0
- package/src/ts/rdb/mcp-server-connection/generator.d.ts +10 -0
- package/src/ts/rdb/mcp-server-connection/generator.js +59 -0
- package/src/ts/rdb/mcp-server-connection/generator.js.map +1 -0
- package/src/ts/rdb/mcp-server-connection/schema.d.ts +14 -0
- package/src/ts/rdb/mcp-server-connection/schema.json +22 -0
- package/src/ts/rdb/smithy-connection/__snapshots__/generator.spec.ts.snap +286 -0
- package/src/ts/rdb/smithy-connection/generator.d.ts +10 -0
- package/src/ts/rdb/smithy-connection/generator.js +72 -0
- package/src/ts/rdb/smithy-connection/generator.js.map +1 -0
- package/src/ts/rdb/smithy-connection/schema.d.ts +12 -0
- package/src/ts/rdb/smithy-connection/schema.json +18 -0
- package/src/ts/rdb/strands-agent-connection/__snapshots__/generator.spec.ts.snap +183 -0
- package/src/ts/rdb/strands-agent-connection/generator.d.ts +10 -0
- package/src/ts/rdb/strands-agent-connection/generator.js +65 -0
- package/src/ts/rdb/strands-agent-connection/generator.js.map +1 -0
- package/src/ts/rdb/strands-agent-connection/schema.d.ts +14 -0
- package/src/ts/rdb/strands-agent-connection/schema.json +22 -0
- package/src/ts/rdb/trpc-connection/__snapshots__/generator.spec.ts.snap +75 -0
- package/src/ts/rdb/trpc-connection/files/src/middleware/__rdbNameKebab__.ts.template +32 -0
- package/src/ts/rdb/trpc-connection/generator.d.ts +10 -0
- package/src/ts/rdb/trpc-connection/generator.js +41 -0
- package/src/ts/rdb/trpc-connection/generator.js.map +1 -0
- package/src/ts/rdb/trpc-connection/schema.d.ts +12 -0
- package/src/ts/rdb/trpc-connection/schema.json +18 -0
- package/src/utils/ast.js +9 -2
- package/src/utils/ast.js.map +1 -1
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`ts#rdb mcp-server-connection generator > should add rdb serve-local dependency to the mcp-server prefixed serve-local 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
6
|
+
"metadata": {
|
|
7
|
+
"components": [
|
|
8
|
+
{
|
|
9
|
+
"generator": "ts#mcp-server",
|
|
10
|
+
"name": "my-mcp",
|
|
11
|
+
"path": "src/my-mcp",
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
"name": "my-service",
|
|
16
|
+
"root": "packages/my-service",
|
|
17
|
+
"targets": {
|
|
18
|
+
"my-mcp-serve-local": {
|
|
19
|
+
"continuous": true,
|
|
20
|
+
"dependsOn": [
|
|
21
|
+
{
|
|
22
|
+
"projects": [
|
|
23
|
+
"db",
|
|
24
|
+
],
|
|
25
|
+
"target": "serve-local",
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
"executor": "nx:run-commands",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
exports[`ts#rdb mcp-server-connection generator > should be idempotent for server.ts 1`] = `
|
|
35
|
+
"import { getPrisma as getDb } from 'db';
|
|
36
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
37
|
+
|
|
38
|
+
export const createServer = async () => {
|
|
39
|
+
const db = await getDb();
|
|
40
|
+
db.$on('error', console.error);
|
|
41
|
+
const server = new McpServer({
|
|
42
|
+
name: 'my-service',
|
|
43
|
+
version: '1.0.0',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return server;
|
|
47
|
+
};
|
|
48
|
+
"
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
exports[`ts#rdb mcp-server-connection generator > should fall back to mcp-server-serve-local when no component name 1`] = `
|
|
52
|
+
{
|
|
53
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
54
|
+
"metadata": {
|
|
55
|
+
"components": [
|
|
56
|
+
{
|
|
57
|
+
"generator": "ts#mcp-server",
|
|
58
|
+
"name": "mcp-server",
|
|
59
|
+
"path": "src/mcp-server",
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
"name": "my-service",
|
|
64
|
+
"root": "packages/my-service",
|
|
65
|
+
"targets": {
|
|
66
|
+
"mcp-server-serve-local": {
|
|
67
|
+
"continuous": true,
|
|
68
|
+
"dependsOn": [
|
|
69
|
+
{
|
|
70
|
+
"projects": [
|
|
71
|
+
"db",
|
|
72
|
+
],
|
|
73
|
+
"target": "serve-local",
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
"executor": "nx:run-commands",
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
}
|
|
80
|
+
`;
|
|
81
|
+
|
|
82
|
+
exports[`ts#rdb mcp-server-connection generator > should inject db into server.ts 1`] = `
|
|
83
|
+
"import { getPrisma as getDb } from 'db';
|
|
84
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
85
|
+
|
|
86
|
+
export const createServer = async () => {
|
|
87
|
+
const db = await getDb();
|
|
88
|
+
db.$on('error', console.error);
|
|
89
|
+
const server = new McpServer({
|
|
90
|
+
name: 'my-service',
|
|
91
|
+
version: '1.0.0',
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return server;
|
|
95
|
+
};
|
|
96
|
+
"
|
|
97
|
+
`;
|
|
98
|
+
|
|
99
|
+
exports[`ts#rdb mcp-server-connection generator > should support multiple rdb connections 1`] = `
|
|
100
|
+
"import { getPrisma as getMysqlDb } from 'mysql-db';
|
|
101
|
+
import { getPrisma as getPostgresDb } from 'postgres-db';
|
|
102
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
103
|
+
|
|
104
|
+
export const createServer = async () => {
|
|
105
|
+
const mysqlDb = await getMysqlDb();
|
|
106
|
+
mysqlDb.$on('error', console.error);
|
|
107
|
+
const postgresDb = await getPostgresDb();
|
|
108
|
+
postgresDb.$on('error', console.error);
|
|
109
|
+
const server = new McpServer({
|
|
110
|
+
name: 'my-service',
|
|
111
|
+
version: '1.0.0',
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
return server;
|
|
115
|
+
};
|
|
116
|
+
"
|
|
117
|
+
`;
|
|
@@ -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 { Tree } from '@nx/devkit';
|
|
6
|
+
import { TsRdbMcpServerConnectionGeneratorSchema } from './schema';
|
|
7
|
+
import { NxGeneratorInfo } from '../../../utils/nx';
|
|
8
|
+
export declare const TS_RDB_MCP_SERVER_CONNECTION_GENERATOR_INFO: NxGeneratorInfo;
|
|
9
|
+
export declare const tsRdbMcpServerConnectionGenerator: (tree: Tree, options: TsRdbMcpServerConnectionGeneratorSchema) => Promise<void>;
|
|
10
|
+
export default tsRdbMcpServerConnectionGenerator;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tsRdbMcpServerConnectionGenerator = exports.TS_RDB_MCP_SERVER_CONNECTION_GENERATOR_INFO = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
/**
|
|
6
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
7
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
*/
|
|
9
|
+
const devkit_1 = require("@nx/devkit");
|
|
10
|
+
const nx_1 = require("../../../utils/nx");
|
|
11
|
+
const metrics_1 = require("../../../utils/metrics");
|
|
12
|
+
const format_1 = require("../../../utils/format");
|
|
13
|
+
const names_1 = require("../../../utils/names");
|
|
14
|
+
const lodash_camelcase_1 = tslib_1.__importDefault(require("lodash.camelcase"));
|
|
15
|
+
const npm_scope_1 = require("../../../utils/npm-scope");
|
|
16
|
+
const ast_1 = require("../../../utils/ast");
|
|
17
|
+
exports.TS_RDB_MCP_SERVER_CONNECTION_GENERATOR_INFO = (0, nx_1.getGeneratorInfo)(__filename);
|
|
18
|
+
const tsRdbMcpServerConnectionGenerator = async (tree, options) => {
|
|
19
|
+
const sourceProject = (0, nx_1.readProjectConfigurationUnqualified)(tree, options.sourceProject);
|
|
20
|
+
const targetProject = (0, nx_1.readProjectConfigurationUnqualified)(tree, options.targetProject);
|
|
21
|
+
const mcpServerName = options.sourceComponent?.name ?? 'mcp-server';
|
|
22
|
+
const serveLocalTarget = `${mcpServerName}-serve-local`;
|
|
23
|
+
if (sourceProject.targets?.[serveLocalTarget]) {
|
|
24
|
+
(0, nx_1.addDependencyToTargetIfNotPresent)(sourceProject, serveLocalTarget, {
|
|
25
|
+
projects: [targetProject.name],
|
|
26
|
+
target: 'serve-local',
|
|
27
|
+
});
|
|
28
|
+
(0, devkit_1.updateProjectConfiguration)(tree, sourceProject.name, sourceProject);
|
|
29
|
+
}
|
|
30
|
+
const rdbBaseName = targetProject.name.split('/').pop();
|
|
31
|
+
const rdbNameCamel = (0, lodash_camelcase_1.default)(rdbBaseName);
|
|
32
|
+
const rdbNamePascal = (0, names_1.pascalCase)(rdbBaseName);
|
|
33
|
+
const rdbPackageAlias = (0, npm_scope_1.toScopeAlias)(targetProject.name);
|
|
34
|
+
const getterAlias = `getPrisma as get${rdbNamePascal}`;
|
|
35
|
+
const serverPath = (0, devkit_1.joinPathFragments)(sourceProject.root, 'src', mcpServerName, 'server.ts');
|
|
36
|
+
// server.ts: inject db inside createServer body
|
|
37
|
+
if (tree.exists(serverPath)) {
|
|
38
|
+
await (0, ast_1.addDestructuredImport)(tree, serverPath, [getterAlias], rdbPackageAlias);
|
|
39
|
+
await (0, ast_1.applyGritQL)(tree, serverPath, `\`export const createServer = async () => { $body }\` => raw\`export const createServer = async () => {
|
|
40
|
+
const ${rdbNameCamel} = await get${rdbNamePascal}();
|
|
41
|
+
$body
|
|
42
|
+
}\` where { $body <: not some \`const ${rdbNameCamel} = await get${rdbNamePascal}()\` }`);
|
|
43
|
+
// Add $on error handler after the db declaration.
|
|
44
|
+
// Done via string replacement because GritQL treats $on as a metavariable.
|
|
45
|
+
const dbDecl = `const ${rdbNameCamel} = await get${rdbNamePascal}();`;
|
|
46
|
+
const onCall = `${rdbNameCamel}.$on('error', console.error);`;
|
|
47
|
+
const content = tree.read(serverPath, 'utf-8');
|
|
48
|
+
if (content.includes(dbDecl) && !content.includes(`${rdbNameCamel}.$on`)) {
|
|
49
|
+
tree.write(serverPath, content.replace(dbDecl, `${dbDecl}\n ${onCall}`));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
await (0, metrics_1.addGeneratorMetricsIfApplicable)(tree, [
|
|
53
|
+
exports.TS_RDB_MCP_SERVER_CONNECTION_GENERATOR_INFO,
|
|
54
|
+
]);
|
|
55
|
+
await (0, format_1.formatFilesInSubtree)(tree);
|
|
56
|
+
};
|
|
57
|
+
exports.tsRdbMcpServerConnectionGenerator = tsRdbMcpServerConnectionGenerator;
|
|
58
|
+
exports.default = exports.tsRdbMcpServerConnectionGenerator;
|
|
59
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/nx-plugin/src/ts/rdb/mcp-server-connection/generator.ts"],"names":[],"mappings":";;;;AAAA;;;GAGG;AACH,uCAIoB;AAEpB,0CAK2B;AAC3B,oDAAyE;AACzE,kDAA6D;AAC7D,gDAAkD;AAClD,gFAAyC;AACzC,wDAAwD;AACxD,4CAAwE;AAE3D,QAAA,2CAA2C,GACtD,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAExB,MAAM,iCAAiC,GAAG,KAAK,EACpD,IAAU,EACV,OAAgD,EACjC,EAAE;IACjB,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,MAAM,aAAa,GAAG,OAAO,CAAC,eAAe,EAAE,IAAI,IAAI,YAAY,CAAC;IACpE,MAAM,gBAAgB,GAAG,GAAG,aAAa,cAAc,CAAC;IAExD,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,WAAW,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IACxD,MAAM,YAAY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EAAC,IAAI,CAAC,CAAC;AACnC,CAAC,CAAC;AArEW,QAAA,iCAAiC,qCAqE5C;AAEF,kBAAe,yCAAiC,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 TsRdbMcpServerConnectionGeneratorSchema {
|
|
11
|
+
sourceProject: string;
|
|
12
|
+
targetProject: string;
|
|
13
|
+
sourceComponent?: ComponentMetadata;
|
|
14
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "ts#rdb#mcp-server-connection",
|
|
4
|
+
"title": "ts#rdb#mcp-server-connection",
|
|
5
|
+
"description": "Connect a ts#mcp-server to a ts#rdb project",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"sourceProject": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The project containing the ts#mcp-server to connect from"
|
|
11
|
+
},
|
|
12
|
+
"targetProject": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "The ts#rdb project to connect to"
|
|
15
|
+
},
|
|
16
|
+
"sourceComponent": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "The MCP server component name"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"required": ["sourceProject", "targetProject"]
|
|
22
|
+
}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`ts#rdb smithy-connection generator > should add rdb serve-local dependency to smithy backend 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
|
+
`;
|
|
24
|
+
|
|
25
|
+
exports[`ts#rdb smithy-connection generator > should be idempotent across context.ts, handler.ts, and local-server.ts 1`] = `
|
|
26
|
+
"import { getPrisma as getDb } from 'db';
|
|
27
|
+
import { Logger } from '@aws-lambda-powertools/logger';
|
|
28
|
+
import { Metrics } from '@aws-lambda-powertools/metrics';
|
|
29
|
+
import { Tracer } from '@aws-lambda-powertools/tracer';
|
|
30
|
+
|
|
31
|
+
export interface ServiceContext {
|
|
32
|
+
tracer: Tracer;
|
|
33
|
+
logger: Logger;
|
|
34
|
+
metrics: Metrics;
|
|
35
|
+
db: Awaited<ReturnType<typeof getDb>>;
|
|
36
|
+
}
|
|
37
|
+
"
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
exports[`ts#rdb smithy-connection generator > should be idempotent across context.ts, handler.ts, and local-server.ts 2`] = `
|
|
41
|
+
"import { getPrisma as getDb } from 'db';
|
|
42
|
+
import {
|
|
43
|
+
convertEvent,
|
|
44
|
+
convertVersion1Response,
|
|
45
|
+
} from '@aws-smithy/server-apigateway';
|
|
46
|
+
import type { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda';
|
|
47
|
+
import { Tracer } from '@aws-lambda-powertools/tracer';
|
|
48
|
+
import { Logger } from '@aws-lambda-powertools/logger';
|
|
49
|
+
import { Metrics } from '@aws-lambda-powertools/metrics';
|
|
50
|
+
import { Service } from './service.js';
|
|
51
|
+
import { getMyApiServiceHandler } from './generated/ssdk/index.js';
|
|
52
|
+
|
|
53
|
+
const tracer = new Tracer();
|
|
54
|
+
const logger = new Logger();
|
|
55
|
+
const metrics = new Metrics();
|
|
56
|
+
|
|
57
|
+
const serviceHandler = getMyApiServiceHandler(Service);
|
|
58
|
+
|
|
59
|
+
export const lambdaHandler = async (
|
|
60
|
+
event: APIGatewayProxyEvent,
|
|
61
|
+
): Promise<APIGatewayProxyResult> => {
|
|
62
|
+
const httpRequest = convertEvent(event);
|
|
63
|
+
const db = await getDb();
|
|
64
|
+
const httpResponse = await serviceHandler.handle(httpRequest, {
|
|
65
|
+
tracer,
|
|
66
|
+
logger,
|
|
67
|
+
metrics,
|
|
68
|
+
db,
|
|
69
|
+
});
|
|
70
|
+
return convertVersion1Response(httpResponse);
|
|
71
|
+
};
|
|
72
|
+
"
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
exports[`ts#rdb smithy-connection generator > should be idempotent across context.ts, handler.ts, and local-server.ts 3`] = `
|
|
76
|
+
"import { getPrisma as getDb } from 'db';
|
|
77
|
+
import { IncomingMessage, ServerResponse, createServer } from 'http';
|
|
78
|
+
import { convertRequest, writeResponse } from '@aws-smithy/server-node';
|
|
79
|
+
import { Tracer } from '@aws-lambda-powertools/tracer';
|
|
80
|
+
import { Logger } from '@aws-lambda-powertools/logger';
|
|
81
|
+
import { Metrics } from '@aws-lambda-powertools/metrics';
|
|
82
|
+
import { Service } from './service.js';
|
|
83
|
+
import { getMyApiServiceHandler } from './generated/ssdk/index.js';
|
|
84
|
+
|
|
85
|
+
const tracer = new Tracer();
|
|
86
|
+
const logger = new Logger();
|
|
87
|
+
const metrics = new Metrics();
|
|
88
|
+
|
|
89
|
+
const serviceHandler = getMyApiServiceHandler(Service);
|
|
90
|
+
|
|
91
|
+
const server = createServer(async function (
|
|
92
|
+
req: IncomingMessage,
|
|
93
|
+
res: ServerResponse<IncomingMessage> & { req: IncomingMessage },
|
|
94
|
+
) {
|
|
95
|
+
const httpRequest = convertRequest(req);
|
|
96
|
+
const db = await getDb();
|
|
97
|
+
const httpResponse = await serviceHandler.handle(httpRequest, {
|
|
98
|
+
tracer,
|
|
99
|
+
logger,
|
|
100
|
+
metrics,
|
|
101
|
+
db,
|
|
102
|
+
});
|
|
103
|
+
return writeResponse(httpResponse, res);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
server.listen(3000);
|
|
107
|
+
"
|
|
108
|
+
`;
|
|
109
|
+
|
|
110
|
+
exports[`ts#rdb smithy-connection generator > should inject into context.ts, handler.ts, and local-server.ts 1`] = `
|
|
111
|
+
"import { getPrisma as getDb } from 'db';
|
|
112
|
+
import { Logger } from '@aws-lambda-powertools/logger';
|
|
113
|
+
import { Metrics } from '@aws-lambda-powertools/metrics';
|
|
114
|
+
import { Tracer } from '@aws-lambda-powertools/tracer';
|
|
115
|
+
|
|
116
|
+
export interface ServiceContext {
|
|
117
|
+
tracer: Tracer;
|
|
118
|
+
logger: Logger;
|
|
119
|
+
metrics: Metrics;
|
|
120
|
+
db: Awaited<ReturnType<typeof getDb>>;
|
|
121
|
+
}
|
|
122
|
+
"
|
|
123
|
+
`;
|
|
124
|
+
|
|
125
|
+
exports[`ts#rdb smithy-connection generator > should inject into context.ts, handler.ts, and local-server.ts 2`] = `
|
|
126
|
+
"import { getPrisma as getDb } from 'db';
|
|
127
|
+
import {
|
|
128
|
+
convertEvent,
|
|
129
|
+
convertVersion1Response,
|
|
130
|
+
} from '@aws-smithy/server-apigateway';
|
|
131
|
+
import type { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda';
|
|
132
|
+
import { Tracer } from '@aws-lambda-powertools/tracer';
|
|
133
|
+
import { Logger } from '@aws-lambda-powertools/logger';
|
|
134
|
+
import { Metrics } from '@aws-lambda-powertools/metrics';
|
|
135
|
+
import { Service } from './service.js';
|
|
136
|
+
import { getMyApiServiceHandler } from './generated/ssdk/index.js';
|
|
137
|
+
|
|
138
|
+
const tracer = new Tracer();
|
|
139
|
+
const logger = new Logger();
|
|
140
|
+
const metrics = new Metrics();
|
|
141
|
+
|
|
142
|
+
const serviceHandler = getMyApiServiceHandler(Service);
|
|
143
|
+
|
|
144
|
+
export const lambdaHandler = async (
|
|
145
|
+
event: APIGatewayProxyEvent,
|
|
146
|
+
): Promise<APIGatewayProxyResult> => {
|
|
147
|
+
const httpRequest = convertEvent(event);
|
|
148
|
+
const db = await getDb();
|
|
149
|
+
const httpResponse = await serviceHandler.handle(httpRequest, {
|
|
150
|
+
tracer,
|
|
151
|
+
logger,
|
|
152
|
+
metrics,
|
|
153
|
+
db,
|
|
154
|
+
});
|
|
155
|
+
return convertVersion1Response(httpResponse);
|
|
156
|
+
};
|
|
157
|
+
"
|
|
158
|
+
`;
|
|
159
|
+
|
|
160
|
+
exports[`ts#rdb smithy-connection generator > should inject into context.ts, handler.ts, and local-server.ts 3`] = `
|
|
161
|
+
"import { getPrisma as getDb } from 'db';
|
|
162
|
+
import { IncomingMessage, ServerResponse, createServer } from 'http';
|
|
163
|
+
import { convertRequest, writeResponse } from '@aws-smithy/server-node';
|
|
164
|
+
import { Tracer } from '@aws-lambda-powertools/tracer';
|
|
165
|
+
import { Logger } from '@aws-lambda-powertools/logger';
|
|
166
|
+
import { Metrics } from '@aws-lambda-powertools/metrics';
|
|
167
|
+
import { Service } from './service.js';
|
|
168
|
+
import { getMyApiServiceHandler } from './generated/ssdk/index.js';
|
|
169
|
+
|
|
170
|
+
const tracer = new Tracer();
|
|
171
|
+
const logger = new Logger();
|
|
172
|
+
const metrics = new Metrics();
|
|
173
|
+
|
|
174
|
+
const serviceHandler = getMyApiServiceHandler(Service);
|
|
175
|
+
|
|
176
|
+
const server = createServer(async function (
|
|
177
|
+
req: IncomingMessage,
|
|
178
|
+
res: ServerResponse<IncomingMessage> & { req: IncomingMessage },
|
|
179
|
+
) {
|
|
180
|
+
const httpRequest = convertRequest(req);
|
|
181
|
+
const db = await getDb();
|
|
182
|
+
const httpResponse = await serviceHandler.handle(httpRequest, {
|
|
183
|
+
tracer,
|
|
184
|
+
logger,
|
|
185
|
+
metrics,
|
|
186
|
+
db,
|
|
187
|
+
});
|
|
188
|
+
return writeResponse(httpResponse, res);
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
server.listen(3000);
|
|
192
|
+
"
|
|
193
|
+
`;
|
|
194
|
+
|
|
195
|
+
exports[`ts#rdb smithy-connection generator > should support multiple rdb connections 1`] = `
|
|
196
|
+
"import { getPrisma as getMysqlDb } from 'mysql-db';
|
|
197
|
+
import { getPrisma as getPostgresDb } from 'postgres-db';
|
|
198
|
+
import { Logger } from '@aws-lambda-powertools/logger';
|
|
199
|
+
import { Metrics } from '@aws-lambda-powertools/metrics';
|
|
200
|
+
import { Tracer } from '@aws-lambda-powertools/tracer';
|
|
201
|
+
|
|
202
|
+
export interface ServiceContext {
|
|
203
|
+
tracer: Tracer;
|
|
204
|
+
logger: Logger;
|
|
205
|
+
metrics: Metrics;
|
|
206
|
+
postgresDb: Awaited<ReturnType<typeof getPostgresDb>>;
|
|
207
|
+
mysqlDb: Awaited<ReturnType<typeof getMysqlDb>>;
|
|
208
|
+
}
|
|
209
|
+
"
|
|
210
|
+
`;
|
|
211
|
+
|
|
212
|
+
exports[`ts#rdb smithy-connection generator > should support multiple rdb connections 2`] = `
|
|
213
|
+
"import { getPrisma as getMysqlDb } from 'mysql-db';
|
|
214
|
+
import { getPrisma as getPostgresDb } from 'postgres-db';
|
|
215
|
+
import {
|
|
216
|
+
convertEvent,
|
|
217
|
+
convertVersion1Response,
|
|
218
|
+
} from '@aws-smithy/server-apigateway';
|
|
219
|
+
import type { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda';
|
|
220
|
+
import { Tracer } from '@aws-lambda-powertools/tracer';
|
|
221
|
+
import { Logger } from '@aws-lambda-powertools/logger';
|
|
222
|
+
import { Metrics } from '@aws-lambda-powertools/metrics';
|
|
223
|
+
import { Service } from './service.js';
|
|
224
|
+
import { getMyApiServiceHandler } from './generated/ssdk/index.js';
|
|
225
|
+
|
|
226
|
+
const tracer = new Tracer();
|
|
227
|
+
const logger = new Logger();
|
|
228
|
+
const metrics = new Metrics();
|
|
229
|
+
|
|
230
|
+
const serviceHandler = getMyApiServiceHandler(Service);
|
|
231
|
+
|
|
232
|
+
export const lambdaHandler = async (
|
|
233
|
+
event: APIGatewayProxyEvent,
|
|
234
|
+
): Promise<APIGatewayProxyResult> => {
|
|
235
|
+
const httpRequest = convertEvent(event);
|
|
236
|
+
const postgresDb = await getPostgresDb();
|
|
237
|
+
const mysqlDb = await getMysqlDb();
|
|
238
|
+
const httpResponse = await serviceHandler.handle(httpRequest, {
|
|
239
|
+
tracer,
|
|
240
|
+
logger,
|
|
241
|
+
metrics,
|
|
242
|
+
postgresDb,
|
|
243
|
+
mysqlDb,
|
|
244
|
+
});
|
|
245
|
+
return convertVersion1Response(httpResponse);
|
|
246
|
+
};
|
|
247
|
+
"
|
|
248
|
+
`;
|
|
249
|
+
|
|
250
|
+
exports[`ts#rdb smithy-connection generator > should support multiple rdb connections 3`] = `
|
|
251
|
+
"import { getPrisma as getMysqlDb } from 'mysql-db';
|
|
252
|
+
import { getPrisma as getPostgresDb } from 'postgres-db';
|
|
253
|
+
import { IncomingMessage, ServerResponse, createServer } from 'http';
|
|
254
|
+
import { convertRequest, writeResponse } from '@aws-smithy/server-node';
|
|
255
|
+
import { Tracer } from '@aws-lambda-powertools/tracer';
|
|
256
|
+
import { Logger } from '@aws-lambda-powertools/logger';
|
|
257
|
+
import { Metrics } from '@aws-lambda-powertools/metrics';
|
|
258
|
+
import { Service } from './service.js';
|
|
259
|
+
import { getMyApiServiceHandler } from './generated/ssdk/index.js';
|
|
260
|
+
|
|
261
|
+
const tracer = new Tracer();
|
|
262
|
+
const logger = new Logger();
|
|
263
|
+
const metrics = new Metrics();
|
|
264
|
+
|
|
265
|
+
const serviceHandler = getMyApiServiceHandler(Service);
|
|
266
|
+
|
|
267
|
+
const server = createServer(async function (
|
|
268
|
+
req: IncomingMessage,
|
|
269
|
+
res: ServerResponse<IncomingMessage> & { req: IncomingMessage },
|
|
270
|
+
) {
|
|
271
|
+
const httpRequest = convertRequest(req);
|
|
272
|
+
const postgresDb = await getPostgresDb();
|
|
273
|
+
const mysqlDb = await getMysqlDb();
|
|
274
|
+
const httpResponse = await serviceHandler.handle(httpRequest, {
|
|
275
|
+
tracer,
|
|
276
|
+
logger,
|
|
277
|
+
metrics,
|
|
278
|
+
postgresDb,
|
|
279
|
+
mysqlDb,
|
|
280
|
+
});
|
|
281
|
+
return writeResponse(httpResponse, res);
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
server.listen(3000);
|
|
285
|
+
"
|
|
286
|
+
`;
|
|
@@ -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 { Tree } from '@nx/devkit';
|
|
6
|
+
import { TsRdbSmithyConnectionGeneratorSchema } from './schema';
|
|
7
|
+
import { NxGeneratorInfo } from '../../../utils/nx';
|
|
8
|
+
export declare const TS_RDB_SMITHY_CONNECTION_GENERATOR_INFO: NxGeneratorInfo;
|
|
9
|
+
export declare const tsRdbSmithyConnectionGenerator: (tree: Tree, options: TsRdbSmithyConnectionGeneratorSchema) => Promise<void>;
|
|
10
|
+
export default tsRdbSmithyConnectionGenerator;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tsRdbSmithyConnectionGenerator = exports.TS_RDB_SMITHY_CONNECTION_GENERATOR_INFO = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
/**
|
|
6
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
7
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
*/
|
|
9
|
+
const devkit_1 = require("@nx/devkit");
|
|
10
|
+
const nx_1 = require("../../../utils/nx");
|
|
11
|
+
const metrics_1 = require("../../../utils/metrics");
|
|
12
|
+
const format_1 = require("../../../utils/format");
|
|
13
|
+
const names_1 = require("../../../utils/names");
|
|
14
|
+
const lodash_camelcase_1 = tslib_1.__importDefault(require("lodash.camelcase"));
|
|
15
|
+
const npm_scope_1 = require("../../../utils/npm-scope");
|
|
16
|
+
const ast_1 = require("../../../utils/ast");
|
|
17
|
+
exports.TS_RDB_SMITHY_CONNECTION_GENERATOR_INFO = (0, nx_1.getGeneratorInfo)(__filename);
|
|
18
|
+
const tsRdbSmithyConnectionGenerator = async (tree, options) => {
|
|
19
|
+
const sourceProject = (0, nx_1.readProjectConfigurationUnqualified)(tree, options.sourceProject);
|
|
20
|
+
const targetProject = (0, nx_1.readProjectConfigurationUnqualified)(tree, options.targetProject);
|
|
21
|
+
if (sourceProject.targets?.['serve-local']) {
|
|
22
|
+
(0, nx_1.addDependencyToTargetIfNotPresent)(sourceProject, 'serve-local', {
|
|
23
|
+
projects: [targetProject.name],
|
|
24
|
+
target: 'serve-local',
|
|
25
|
+
});
|
|
26
|
+
(0, devkit_1.updateProjectConfiguration)(tree, sourceProject.name, sourceProject);
|
|
27
|
+
}
|
|
28
|
+
const rdbBaseName = targetProject.name.split('/').pop();
|
|
29
|
+
const rdbNameCamel = (0, lodash_camelcase_1.default)(rdbBaseName);
|
|
30
|
+
const rdbNamePascal = (0, names_1.pascalCase)(rdbBaseName);
|
|
31
|
+
const rdbPackageAlias = (0, npm_scope_1.toScopeAlias)(targetProject.name);
|
|
32
|
+
const getterAlias = `getPrisma as get${rdbNamePascal}`;
|
|
33
|
+
const contextPath = (0, devkit_1.joinPathFragments)(sourceProject.root, 'src/context.ts');
|
|
34
|
+
const handlerPath = (0, devkit_1.joinPathFragments)(sourceProject.root, 'src/handler.ts');
|
|
35
|
+
const localServerPath = (0, devkit_1.joinPathFragments)(sourceProject.root, 'src/local-server.ts');
|
|
36
|
+
if (tree.exists(contextPath)) {
|
|
37
|
+
await (0, ast_1.addDestructuredImport)(tree, contextPath, [getterAlias], rdbPackageAlias);
|
|
38
|
+
await (0, ast_1.applyGritQL)(tree, contextPath, `\`interface ServiceContext { $members }\` where {
|
|
39
|
+
$members <: not some \`${rdbNameCamel}: $_\`,
|
|
40
|
+
$members += \`\n ${rdbNameCamel}: Awaited<ReturnType<typeof get${rdbNamePascal}>>\`
|
|
41
|
+
}`);
|
|
42
|
+
}
|
|
43
|
+
if (tree.exists(handlerPath)) {
|
|
44
|
+
await (0, ast_1.addDestructuredImport)(tree, handlerPath, [getterAlias], rdbPackageAlias);
|
|
45
|
+
const alreadyHasDecl = await (0, ast_1.matchGritQL)(tree, handlerPath, `\`const ${rdbNameCamel} = await get${rdbNamePascal}()\``);
|
|
46
|
+
if (!alreadyHasDecl) {
|
|
47
|
+
await (0, ast_1.applyGritQL)(tree, handlerPath, `\`const httpResponse = await serviceHandler.handle($req, $ctx)\` => \`const ${rdbNameCamel} = await get${rdbNamePascal}();\n const httpResponse = await serviceHandler.handle($req, $ctx)\``);
|
|
48
|
+
}
|
|
49
|
+
await (0, ast_1.applyGritQL)(tree, handlerPath, `\`serviceHandler.handle($req, { $props })\` where {
|
|
50
|
+
$props <: not some \`${rdbNameCamel}\`,
|
|
51
|
+
$props += \`\n ${rdbNameCamel}\`
|
|
52
|
+
}`);
|
|
53
|
+
}
|
|
54
|
+
if (tree.exists(localServerPath)) {
|
|
55
|
+
await (0, ast_1.addDestructuredImport)(tree, localServerPath, [getterAlias], rdbPackageAlias);
|
|
56
|
+
const alreadyHasDeclLocal = await (0, ast_1.matchGritQL)(tree, localServerPath, `\`const ${rdbNameCamel} = await get${rdbNamePascal}()\``);
|
|
57
|
+
if (!alreadyHasDeclLocal) {
|
|
58
|
+
await (0, ast_1.applyGritQL)(tree, localServerPath, `\`const httpResponse = await serviceHandler.handle($req, $ctx)\` => \`const ${rdbNameCamel} = await get${rdbNamePascal}();\n const httpResponse = await serviceHandler.handle($req, $ctx)\``);
|
|
59
|
+
}
|
|
60
|
+
await (0, ast_1.applyGritQL)(tree, localServerPath, `\`serviceHandler.handle($req, { $props })\` where {
|
|
61
|
+
$props <: not some \`${rdbNameCamel}\`,
|
|
62
|
+
$props += \`\n ${rdbNameCamel}\`
|
|
63
|
+
}`);
|
|
64
|
+
}
|
|
65
|
+
await (0, metrics_1.addGeneratorMetricsIfApplicable)(tree, [
|
|
66
|
+
exports.TS_RDB_SMITHY_CONNECTION_GENERATOR_INFO,
|
|
67
|
+
]);
|
|
68
|
+
await (0, format_1.formatFilesInSubtree)(tree);
|
|
69
|
+
};
|
|
70
|
+
exports.tsRdbSmithyConnectionGenerator = tsRdbSmithyConnectionGenerator;
|
|
71
|
+
exports.default = exports.tsRdbSmithyConnectionGenerator;
|
|
72
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/nx-plugin/src/ts/rdb/smithy-connection/generator.ts"],"names":[],"mappings":";;;;AAAA;;;GAGG;AACH,uCAIoB;AAEpB,0CAK2B;AAC3B,oDAAyE;AACzE,kDAA6D;AAC7D,gDAAkD;AAClD,gFAAyC;AACzC,wDAAwD;AACxD,4CAI4B;AAEf,QAAA,uCAAuC,GAClD,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAExB,MAAM,8BAA8B,GAAG,KAAK,EACjD,IAAU,EACV,OAA6C,EAC9B,EAAE;IACjB,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,IAAI,aAAa,CAAC,OAAO,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC;QAC3C,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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 TsRdbSmithyConnectionGeneratorSchema {
|
|
10
|
+
sourceProject: string;
|
|
11
|
+
targetProject: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "ts#rdb#smithy-connection",
|
|
4
|
+
"title": "ts#rdb#smithy-connection",
|
|
5
|
+
"description": "Connect a Smithy backend to a ts#rdb project",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"sourceProject": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The TypeScript project to connect from"
|
|
11
|
+
},
|
|
12
|
+
"targetProject": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "The ts#rdb project to connect to"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"required": ["sourceProject", "targetProject"]
|
|
18
|
+
}
|