@contractkit/plugin-typescript 0.25.4 → 0.26.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/.turbo/turbo-build$colon$ci.log +4 -4
- package/.turbo/turbo-test$colon$ci.log +12 -12
- package/CHANGELOG.md +11 -0
- package/coverage/clover.xml +353 -352
- package/coverage/coverage-final.json +3 -3
- package/coverage/index.html +12 -12
- package/coverage/src/codegen-contract.ts.html +7 -7
- package/coverage/src/codegen-operation.ts.html +193 -184
- package/coverage/src/codegen-plain-types.ts.html +1 -1
- package/coverage/src/codegen-sdk.ts.html +1 -1
- package/coverage/src/index.html +13 -13
- package/coverage/src/index.ts.html +1 -1
- package/coverage/src/path-utils.ts.html +1 -1
- package/coverage/src/ts-render.ts.html +1 -1
- package/coverage/tests/helpers.ts.html +12 -12
- package/coverage/tests/index.html +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/codegen-operation.ts +4 -1
- package/tests/codegen-operation.test.ts +11 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractkit/plugin-typescript",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "ContractKit built-in plugin: TypeScript codegen (SDK clients, Koa routers, Zod schemas, plain types)",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Marooned Software",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
".": "./dist/index.js"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@contractkit/core": "0.
|
|
29
|
+
"@contractkit/core": "0.21.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@repo/config-
|
|
33
|
-
"@repo/config-
|
|
32
|
+
"@repo/config-typescript": "0.1.0",
|
|
33
|
+
"@repo/config-eslint": "0.3.1"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "tsup src/index.ts --format esm --sourcemap --dts && tsc --emitDeclarationOnly --declaration",
|
package/src/codegen-operation.ts
CHANGED
|
@@ -260,7 +260,10 @@ function generateHandler(route: OpRouteNode, op: OpOperationNode, root: OpRootNo
|
|
|
260
260
|
middlewares.push(`bodyParserMiddleware([${tokensExpr}])`);
|
|
261
261
|
}
|
|
262
262
|
if (op.signature) {
|
|
263
|
-
|
|
263
|
+
const sigArgs = op.signaturePolicy
|
|
264
|
+
? `'${op.signature}', { policy: '${op.signaturePolicy}' }`
|
|
265
|
+
: `'${op.signature}'`;
|
|
266
|
+
middlewares.push(`requireSignature(${sigArgs})`);
|
|
264
267
|
}
|
|
265
268
|
const middlewareStr = middlewares.length > 0 ? `, ${middlewares.join(', ')},` : ',';
|
|
266
269
|
|
|
@@ -851,6 +851,17 @@ describe('generateOp — route modifiers JSDoc', () => {
|
|
|
851
851
|
expect(out).toContain(`requireSignature('MODERN_TREASURY_WEBHOOK')`);
|
|
852
852
|
});
|
|
853
853
|
|
|
854
|
+
it('passes the signature policy to requireSignature when set', () => {
|
|
855
|
+
const op = opOperation('post', {
|
|
856
|
+
signature: 'SLACK_WEBHOOK',
|
|
857
|
+
signaturePolicy: 'slackSignatureValid',
|
|
858
|
+
request: opRequest('Payload'),
|
|
859
|
+
});
|
|
860
|
+
const root = opRoot([opRoute('/webhooks', [op])]);
|
|
861
|
+
const out = generateOp(root);
|
|
862
|
+
expect(out).toContain(`requireSignature('SLACK_WEBHOOK', { policy: 'slackSignatureValid' })`);
|
|
863
|
+
});
|
|
864
|
+
|
|
854
865
|
it('places requireSignature after bodyParserMiddleware in the route line', () => {
|
|
855
866
|
const op = opOperation('post', {
|
|
856
867
|
signature: 'MY_KEY',
|