@contractkit/plugin-typescript 0.33.1 → 0.33.3
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/.turbo/turbo-build$colon$ci.log +4 -4
- package/.turbo/turbo-test$colon$ci.log +11 -11
- package/CHANGELOG.md +13 -0
- package/dist/codegen-mcp.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/codegen-mcp.ts +5 -4
- package/tests/codegen-mcp.test.ts +31 -0
|
@@ -5,9 +5,9 @@ $ tsup src/index.ts --format esm --sourcemap --dts && tsc --emitDeclarationOnly
|
|
|
5
5
|
[34mCLI[39m tsup v8.5.1
|
|
6
6
|
[34mCLI[39m Target: esnext
|
|
7
7
|
[34mESM[39m Build start
|
|
8
|
-
[32mESM[39m [1mdist/index.js [22m[32m210.
|
|
9
|
-
[32mESM[39m [1mdist/index.js.map [22m[32m480.
|
|
10
|
-
[32mESM[39m ⚡️ Build success in
|
|
8
|
+
[32mESM[39m [1mdist/index.js [22m[32m210.87 KB[39m
|
|
9
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m480.21 KB[39m
|
|
10
|
+
[32mESM[39m ⚡️ Build success in 497ms
|
|
11
11
|
[34mDTS[39m Build start
|
|
12
|
-
[32mDTS[39m ⚡️ Build success in
|
|
12
|
+
[32mDTS[39m ⚡️ Build success in 6324ms
|
|
13
13
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m5.14 KB[39m
|
|
@@ -3,19 +3,19 @@ $ vitest run --coverage
|
|
|
3
3
|
[1m[30m[46m RUN [49m[39m[22m [36mv4.1.5 [39m[90m/home/runner/work/ContractKit/ContractKit/packages/plugin-typescript[39m
|
|
4
4
|
[2mCoverage enabled with [22m[33mv8[39m
|
|
5
5
|
|
|
6
|
-
[32m✓[39m tests/codegen-contract.test.ts [2m([22m[2m140 tests[22m[2m)[22m[32m
|
|
7
|
-
[32m✓[39m tests/codegen-
|
|
8
|
-
[32m✓[39m tests/codegen-
|
|
9
|
-
[32m✓[39m tests/codegen-plain-types.test.ts [2m([22m[2m66 tests[22m[2m)[22m[32m
|
|
10
|
-
[32m✓[39m tests/codegen-server.test.ts [2m([22m[2m30 tests[22m[2m)[22m[32m
|
|
11
|
-
[32m✓[39m tests/pipeline.test.ts [2m([22m[2m30 tests[22m[2m)[22m[
|
|
12
|
-
[32m✓[39m tests/codegen-mcp.test.ts [2m([22m[
|
|
13
|
-
[32m✓[39m tests/escaping-security.test.ts [2m([22m[2m18 tests[22m[2m)[22m[32m
|
|
6
|
+
[32m✓[39m tests/codegen-contract.test.ts [2m([22m[2m140 tests[22m[2m)[22m[32m 233[2mms[22m[39m
|
|
7
|
+
[32m✓[39m tests/codegen-sdk.test.ts [2m([22m[2m159 tests[22m[2m)[22m[32m 222[2mms[22m[39m
|
|
8
|
+
[32m✓[39m tests/codegen-operation.test.ts [2m([22m[2m155 tests[22m[2m)[22m[33m 387[2mms[22m[39m
|
|
9
|
+
[32m✓[39m tests/codegen-plain-types.test.ts [2m([22m[2m66 tests[22m[2m)[22m[32m 71[2mms[22m[39m
|
|
10
|
+
[32m✓[39m tests/codegen-server.test.ts [2m([22m[2m30 tests[22m[2m)[22m[32m 121[2mms[22m[39m
|
|
11
|
+
[32m✓[39m tests/pipeline.test.ts [2m([22m[2m30 tests[22m[2m)[22m[33m 412[2mms[22m[39m
|
|
12
|
+
[32m✓[39m tests/codegen-mcp.test.ts [2m([22m[2m28 tests[22m[2m)[22m[32m 63[2mms[22m[39m
|
|
13
|
+
[32m✓[39m tests/escaping-security.test.ts [2m([22m[2m18 tests[22m[2m)[22m[32m 26[2mms[22m[39m
|
|
14
14
|
|
|
15
15
|
[2m Test Files [22m [1m[32m8 passed[39m[22m[90m (8)[39m
|
|
16
|
-
[2m Tests [22m [1m[
|
|
17
|
-
[2m Start at [22m
|
|
18
|
-
[2m Duration [22m 10.
|
|
16
|
+
[2m Tests [22m [1m[32m626 passed[39m[22m[90m (626)[39m
|
|
17
|
+
[2m Start at [22m 11:22:39
|
|
18
|
+
[2m Duration [22m 10.67s[2m (transform 5.63s, setup 0ms, import 20.55s, tests 1.53s, environment 7ms)[22m
|
|
19
19
|
|
|
20
20
|
[34m % [39m[2mCoverage report from [22m[33mv8[39m
|
|
21
21
|
-------------------|---------|----------|---------|---------|-------------------
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @contractkit/contractkit-plugin-typescript
|
|
2
2
|
|
|
3
|
+
## 0.33.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 637e13b: Fix four defects in the emitted `mcp.router.ts` that left the generated MCP endpoint non-functional. It now emits `bodyParserMiddleware(['json'])` ahead of `requireSignature`, which is what populates the `ctx.rawBody` the signature HMAC is computed over; answers notifications with `else ctx.status = 202` instead of leaving `ctx.body` unset and 404ing the `notifications/initialized` that follows every handshake; wraps the body as `JSON.parse(String(ctx.rawBody))`, since `ctx.rawBody` is `BinaryLike` and `JSON.parse` takes a `string`; and hands the stateful transport `ctx.parsedBody` rather than `ctx.request.body`, which ServerKit never populates and which the new body parser's stream read would otherwise leave empty.
|
|
8
|
+
|
|
9
|
+
## 0.33.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [74b8a28]
|
|
14
|
+
- @contractkit/core@0.28.2
|
|
15
|
+
|
|
3
16
|
## 0.33.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen-mcp.d.ts","sourceRoot":"","sources":["../src/codegen-mcp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAA8E,MAAM,mBAAmB,CAAC;AAUhI,MAAM,WAAW,iBAAiB;IAC9B,mFAAmF;IACnF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uFAAuF;IACvF,aAAa,CAAC,EA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qDAAqD;IACrD,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,sDAAsD;IACtD,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,yFAAyF;IACzF,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,2DAA2D;IAC3D,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AASD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,UAAQ,GAAG,OAAO,CASnF;AA+VD,0GAA0G;AAC1G,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED,sGAAsG;AACtG,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,GAAE,iBAAsB,GAAG,MAAM,CA2DzF;AAED,8EAA8E;AAC9E,MAAM,WAAW,kBAAkB;IAC/B,6EAA6E;IAC7E,UAAU,EAAE,MAAM,CAAC;IACnB,oFAAoF;IACpF,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,0FAA0F;AAC1F,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAe3E;AAED,sGAAsG;AACtG,wBAAgB,iBAAiB,CAAC,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,MAAM,CAwBzE"}
|
package/dist/index.js
CHANGED
|
@@ -4332,23 +4332,24 @@ function generateMcpAggregator(entries) {
|
|
|
4332
4332
|
__name(generateMcpAggregator, "generateMcpAggregator");
|
|
4333
4333
|
function generateMcpRouter(options = {}) {
|
|
4334
4334
|
const path = options.path ?? "/mcp";
|
|
4335
|
-
return `import { ServerKitRouter, requireSignature } from '@maroonedsoftware/koa';
|
|
4335
|
+
return `import { ServerKitRouter, bodyParserMiddleware, requireSignature } from '@maroonedsoftware/koa';
|
|
4336
4336
|
import { McpDispatcher, createMcpRequestContext, MCP_AUTH_POLICY } from '@maroonedsoftware/mcp';
|
|
4337
4337
|
|
|
4338
4338
|
/** Mount the MCP endpoint onto a ServerKit router. Call \`registerMcpTools(container)\` at startup. */
|
|
4339
4339
|
export function mountMcp(router: ReturnType<typeof ServerKitRouter>): void {
|
|
4340
|
-
router.post('${path}', requireSignature('mcp', { policy: MCP_AUTH_POLICY }), async (ctx) => {
|
|
4340
|
+
router.post('${path}', bodyParserMiddleware(['json']), requireSignature('mcp', { policy: MCP_AUTH_POLICY }), async (ctx) => {
|
|
4341
4341
|
const dispatcher = ctx.container.get(McpDispatcher);
|
|
4342
4342
|
const context = createMcpRequestContext({ requestId: ctx.requestId, logger: ctx.logger });
|
|
4343
4343
|
if (dispatcher.sessionMode === 'stateful') {
|
|
4344
4344
|
ctx.respond = false;
|
|
4345
4345
|
await dispatcher.dispatchStateful(
|
|
4346
|
-
{ req: ctx.req, res: ctx.res, body: ctx.
|
|
4346
|
+
{ req: ctx.req, res: ctx.res, body: ctx.parsedBody, sessionId: ctx.get('mcp-session-id') },
|
|
4347
4347
|
context,
|
|
4348
4348
|
);
|
|
4349
4349
|
} else {
|
|
4350
|
-
const response = await dispatcher.dispatch(JSON.parse(ctx.rawBody), context);
|
|
4350
|
+
const response = await dispatcher.dispatch(JSON.parse(String(ctx.rawBody)), context);
|
|
4351
4351
|
if (response) ctx.body = response;
|
|
4352
|
+
else ctx.status = 202; // a notification \u2014 nothing to return
|
|
4352
4353
|
}
|
|
4353
4354
|
});
|
|
4354
4355
|
}
|