@contractkit/plugin-typescript 0.28.2 → 0.30.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 +5 -5
- package/.turbo/turbo-test$colon$ci.log +19 -19
- package/CHANGELOG.md +23 -0
- package/README.md +4 -0
- package/dist/codegen-contract.d.ts +7 -0
- package/dist/codegen-contract.d.ts.map +1 -1
- package/dist/codegen-operation.d.ts +9 -1
- package/dist/codegen-operation.d.ts.map +1 -1
- package/dist/codegen-plain-types.d.ts +3 -0
- package/dist/codegen-plain-types.d.ts.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +144 -120
- package/dist/index.js.map +1 -1
- package/dist/ts-render.d.ts +21 -3
- package/dist/ts-render.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/codegen-contract.ts +7 -0
- package/src/codegen-operation.ts +103 -78
- package/src/codegen-plain-types.ts +47 -22
- package/src/index.ts +21 -1
- package/src/ts-render.ts +52 -32
- package/tests/codegen-operation.test.ts +134 -3
- package/tests/codegen-plain-types.test.ts +48 -0
- package/tests/codegen-server.test.ts +37 -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[32m176.
|
|
9
|
-
[32mESM[39m [1mdist/index.js.map [22m[
|
|
10
|
-
[32mESM[39m ⚡️ Build success in
|
|
8
|
+
[32mESM[39m [1mdist/index.js [22m[32m176.34 KB[39m
|
|
9
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m392.55 KB[39m
|
|
10
|
+
[32mESM[39m ⚡️ Build success in 283ms
|
|
11
11
|
[34mDTS[39m Build start
|
|
12
|
-
[32mDTS[39m ⚡️ Build success in
|
|
13
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
12
|
+
[32mDTS[39m ⚡️ Build success in 7018ms
|
|
13
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m4.55 KB[39m
|
|
@@ -3,34 +3,34 @@ $ 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[2m128 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[
|
|
10
|
-
[32m✓[39m tests/codegen-server.test.ts [2m([22m[
|
|
11
|
-
[32m✓[39m tests/pipeline.test.ts [2m([22m[2m28 tests[22m[2m)[22m[32m
|
|
12
|
-
[32m✓[39m tests/codegen-mcp.test.ts [2m([22m[2m24 tests[22m[2m)[22m[32m
|
|
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[2m128 tests[22m[2m)[22m[32m 300[2mms[22m[39m
|
|
7
|
+
[32m✓[39m tests/codegen-sdk.test.ts [2m([22m[2m140 tests[22m[2m)[22m[32m 255[2mms[22m[39m
|
|
8
|
+
[32m✓[39m tests/codegen-operation.test.ts [2m([22m[2m117 tests[22m[2m)[22m[32m 165[2mms[22m[39m
|
|
9
|
+
[32m✓[39m tests/codegen-plain-types.test.ts [2m([22m[2m66 tests[22m[2m)[22m[32m 41[2mms[22m[39m
|
|
10
|
+
[32m✓[39m tests/codegen-server.test.ts [2m([22m[2m25 tests[22m[2m)[22m[32m 90[2mms[22m[39m
|
|
11
|
+
[32m✓[39m tests/pipeline.test.ts [2m([22m[2m28 tests[22m[2m)[22m[32m 234[2mms[22m[39m
|
|
12
|
+
[32m✓[39m tests/codegen-mcp.test.ts [2m([22m[2m24 tests[22m[2m)[22m[32m 70[2mms[22m[39m
|
|
13
|
+
[32m✓[39m tests/escaping-security.test.ts [2m([22m[2m18 tests[22m[2m)[22m[32m 52[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
|
|
16
|
+
[2m Tests [22m [1m[32m546 passed[39m[22m[90m (546)[39m
|
|
17
|
+
[2m Start at [22m 15:07:03
|
|
18
|
+
[2m Duration [22m 10.03s[2m (transform 6.46s, setup 0ms, import 19.18s, tests 1.21s, environment 1ms)[22m
|
|
19
19
|
|
|
20
20
|
[34m % [39m[2mCoverage report from [22m[33mv8[39m
|
|
21
21
|
-------------------|---------|----------|---------|---------|-------------------
|
|
22
22
|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
|
23
23
|
-------------------|---------|----------|---------|---------|-------------------
|
|
24
|
-
All files |
|
|
25
|
-
src |
|
|
26
|
-
...n-contract.ts | 88.1 | 82.91 | 90.08 | 89.26 | ...
|
|
24
|
+
All files | 82.42 | 76.7 | 85.01 | 85.02 |
|
|
25
|
+
src | 82.27 | 76.44 | 84.72 | 84.86 |
|
|
26
|
+
...n-contract.ts | 88.1 | 82.91 | 90.08 | 89.26 | ...1095,1100-1101
|
|
27
27
|
codegen-mcp.ts | 82.67 | 75.47 | 84.61 | 85.9 | ...85,290-291,374
|
|
28
|
-
...-operation.ts | 78.
|
|
29
|
-
...lain-types.ts | 91.
|
|
28
|
+
...-operation.ts | 78.36 | 75 | 72.88 | 80.34 | ...65-776,781-782
|
|
29
|
+
...lain-types.ts | 91.57 | 81.98 | 96.87 | 94.44 | ...31,157,269,275
|
|
30
30
|
codegen-sdk.ts | 88.37 | 83.2 | 87.83 | 91.48 | ...1187-1188,1191
|
|
31
|
-
index.ts |
|
|
32
|
-
path-utils.ts |
|
|
33
|
-
ts-render.ts |
|
|
31
|
+
index.ts | 66.25 | 53.64 | 72.72 | 70.29 | ...1022,1038-1057
|
|
32
|
+
path-utils.ts | 70.28 | 51.13 | 100 | 73.5 | ...65-168,216-231
|
|
33
|
+
ts-render.ts | 85 | 87.36 | 79.16 | 89.23 | 83,159,192-200
|
|
34
34
|
tests | 90.38 | 90.9 | 89.28 | 93.47 |
|
|
35
35
|
helpers.ts | 90.38 | 90.9 | 89.28 | 93.47 | 110-118
|
|
36
36
|
-------------------|---------|----------|---------|---------|-------------------
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @contractkit/contractkit-plugin-typescript
|
|
2
2
|
|
|
3
|
+
## 0.30.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 23e4beb: Stop emitting unused imports in generated Koa routers. `bodyParserMiddleware` was imported unconditionally even when no operation declared a request body, and `MultipartBody` was imported whenever any body was multipart — including when the multipart body is structurally equal to its sibling MIME types and the handler collapses to a single `parseAndValidate` call that never references it. `requirePolicy`, `requireSignature` and `parseAndValidate` could also go unused when `includeInternal: false` skipped the only handlers that needed them. Each unused import trips `noUnusedLocals` and lint in the consuming project.
|
|
8
|
+
|
|
9
|
+
Imports are now derived from the generated body — a symbol is emitted only if it actually appears in the output — rather than from predicates over the AST that had to be kept in step by hand.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [23e4beb]
|
|
14
|
+
- @contractkit/core@0.24.0
|
|
15
|
+
|
|
16
|
+
## 0.29.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- 79e3049: Fix scalar response bodies in generated Koa routers, which emitted the `.ck` scalar name verbatim as a TypeScript type (`const result: binary`). Only `string`, `number`, `boolean`, `bigint`, `null` and `unknown` compiled by coincidence; `binary`, `int`, `uuid`, `datetime` and friends produced invalid code. Scalars now render as the type the handler actually receives: `binary` → `Buffer`, `int` → `number`, `datetime` → luxon `DateTime`, `interval` → `string`, `json` → `_JsonValue`.
|
|
21
|
+
|
|
22
|
+
Generated routers now also import `Duration` and `Interval` from luxon and emit the `_ZodInterval` helper when an operation uses those scalars, instead of referencing undefined names.
|
|
23
|
+
|
|
24
|
+
Plain type files emitted for the server render `binary` as `Buffer` rather than `Blob`. SDK output is unchanged. The standalone `types` sub-generator gained a `target` option (`"client" | "server"`, default `"client"`) to select between the two.
|
|
25
|
+
|
|
3
26
|
## 0.28.2
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -94,6 +94,10 @@ Generates plain TypeScript interface/type files from `contract` declarations. No
|
|
|
94
94
|
|---|---|---|---|
|
|
95
95
|
| `baseDir` | `string` | `rootDir` | Base directory for output files |
|
|
96
96
|
| `output` | `string` | `"{filename}.types.ts"` | Path template for type files |
|
|
97
|
+
| `target` | `"client" \| "server"` | `"client"` | Runtime the types describe. Affects scalars whose TypeScript type is runtime-specific: `binary` renders as `Buffer` for `server` and `Blob` for `client` |
|
|
98
|
+
|
|
99
|
+
The `server` and `sdk` sub-generators set `target` themselves (`server` and `client` respectively), so
|
|
100
|
+
their plain-type output already matches the runtime that consumes it.
|
|
97
101
|
|
|
98
102
|
## Path templates
|
|
99
103
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ContractRootNode, ModelNode, ContractTypeNode, ObjectMode } from '@contractkit/core';
|
|
2
|
+
import type { TsRenderTarget } from './ts-render.js';
|
|
2
3
|
/**
|
|
3
4
|
* Maps a ContractKit object mode to its Zod constructor name.
|
|
4
5
|
*
|
|
@@ -17,6 +18,12 @@ export interface ContractCodegenContext {
|
|
|
17
18
|
modelsWithOutput?: Set<string>;
|
|
18
19
|
/** If set, import JsonValue from this path instead of re-declaring it (avoids barrel re-export conflicts) */
|
|
19
20
|
jsonValueImportPath?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Runtime the emitted plain types describe. Only affects scalars whose TypeScript type differs
|
|
23
|
+
* per runtime (`binary` → `Buffer` on the server, `Blob` in the client). Ignored by
|
|
24
|
+
* `generateContract`, whose Zod schemas are server-shaped by construction. Default `'client'`.
|
|
25
|
+
*/
|
|
26
|
+
target?: TsRenderTarget;
|
|
20
27
|
}
|
|
21
28
|
/**
|
|
22
29
|
* Compute which models need Input variants, including transitive dependencies.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen-contract.d.ts","sourceRoot":"","sources":["../src/codegen-contract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,gBAAgB,EAChB,SAAS,EAET,gBAAgB,EAWhB,UAAU,EACb,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"codegen-contract.d.ts","sourceRoot":"","sources":["../src/codegen-contract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,gBAAgB,EAChB,SAAS,EAET,gBAAgB,EAWhB,UAAU,EACb,MAAM,mBAAmB,CAAC;AAO3B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAStD;AAID,4GAA4G;AAC5G,MAAM,WAAW,sBAAsB;IACnC,sDAAsD;IACtD,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,8DAA8D;IAC9D,cAAc,EAAE,MAAM,CAAC;IACvB,qFAAqF;IACrF,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,oFAAoF;IACpF,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,6GAA6G;IAC7G,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,MAA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BAAgB,EAAE,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CA4BvG;AAmCD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,CA6D/D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,MAAM,CAgB3F;AAED,gGAAgG;AAChG,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD"}
|
|
@@ -22,7 +22,15 @@ export interface OpCodegenOptions {
|
|
|
22
22
|
*/
|
|
23
23
|
includeInternal?: boolean;
|
|
24
24
|
}
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Generate a Koa router module for every operation in `root`, including the imports, type
|
|
27
|
+
* aliases, and handler list.
|
|
28
|
+
*
|
|
29
|
+
* Imports are derived from the generated body — each candidate symbol is emitted only if it
|
|
30
|
+
* actually appears in the output. Deciding them from predicates over the AST instead means any
|
|
31
|
+
* drift between predicate and codegen leaves an unused import in every generated file, which
|
|
32
|
+
* trips `noUnusedLocals` and lint downstream.
|
|
33
|
+
*/
|
|
26
34
|
export declare function generateOp(root: OpRootNode, options?: OpCodegenOptions): string;
|
|
27
35
|
/**
|
|
28
36
|
* Resolve the service class and method a handler should delegate to.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen-operation.d.ts","sourceRoot":"","sources":["../src/codegen-operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"codegen-operation.d.ts","sourceRoot":"","sources":["../src/codegen-operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,EAA2C,MAAM,mBAAmB,CAAC;AAkC7I;;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()` which produces Zod schemas, this emits
|
|
6
6
|
* vanilla TypeScript `interface` and `type` declarations suitable
|
|
7
7
|
* for SDK consumers that don't need runtime validation.
|
|
8
|
+
*
|
|
9
|
+
* @param context Import resolution and Input/Output variant sets. `context.target` selects the
|
|
10
|
+
* runtime the types describe (`'server'` renders `binary` as `Buffer`, `'client'` as `Blob`).
|
|
8
11
|
*/
|
|
9
12
|
export declare function generatePlainTypes(root: ContractRootNode, context?: ContractCodegenContext): string;
|
|
10
13
|
//# sourceMappingURL=codegen-plain-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen-plain-types.d.ts","sourceRoot":"","sources":["../src/codegen-plain-types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAwB,MAAM,mBAAmB,CAAC;AAEhF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"codegen-plain-types.d.ts","sourceRoot":"","sources":["../src/codegen-plain-types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAwB,MAAM,mBAAmB,CAAC;AAEhF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAcpE;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,MAAM,CA4CnG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ContractKitPlugin } from '@contractkit/core';
|
|
2
|
+
/** Koa server output: routers, and the type or Zod schema files they import. */
|
|
2
3
|
export interface ServerConfig {
|
|
3
4
|
/** Directory (relative to rootDir) where server files are written. Default: rootDir. */
|
|
4
5
|
baseDir?: string;
|
|
@@ -15,6 +16,7 @@ export interface ServerConfig {
|
|
|
15
16
|
/** Whether to emit handlers for `internal` operations. Default true. */
|
|
16
17
|
includeInternal?: boolean;
|
|
17
18
|
}
|
|
19
|
+
/** TypeScript SDK client output: the client class, per-area operation clients, and their types. */
|
|
18
20
|
export interface SdkConfig {
|
|
19
21
|
baseDir?: string;
|
|
20
22
|
name?: string;
|
|
@@ -35,14 +37,23 @@ export interface SdkConfig {
|
|
|
35
37
|
*/
|
|
36
38
|
scaffold?: boolean;
|
|
37
39
|
}
|
|
40
|
+
/** Standalone Zod schema output, independent of the server and SDK sub-generators. */
|
|
38
41
|
export interface ZodConfig {
|
|
39
42
|
baseDir?: string;
|
|
40
43
|
output?: string;
|
|
41
44
|
}
|
|
45
|
+
/** Standalone plain TypeScript type output, independent of the server and SDK sub-generators. */
|
|
42
46
|
export interface TypesConfig {
|
|
43
47
|
baseDir?: string;
|
|
44
48
|
output?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Runtime the emitted types describe. Affects scalars whose TypeScript type is runtime-specific:
|
|
51
|
+
* `binary` renders as `Buffer` for `'server'` and `Blob` for `'client'`. Default `'client'`.
|
|
52
|
+
* The `server` and `sdk` sub-generators set this themselves.
|
|
53
|
+
*/
|
|
54
|
+
target?: 'client' | 'server';
|
|
45
55
|
}
|
|
56
|
+
/** MCP tool output: per-op-file handlers, the aggregator, and the optional POST route. */
|
|
46
57
|
export interface McpConfig {
|
|
47
58
|
/** Directory (relative to rootDir) where MCP files are written. Default: rootDir. */
|
|
48
59
|
baseDir?: string;
|
|
@@ -69,6 +80,7 @@ export interface McpConfig {
|
|
|
69
80
|
/** Whether to expose operations marked `internal` as MCP tools. Default false. */
|
|
70
81
|
includeInternal?: boolean;
|
|
71
82
|
}
|
|
83
|
+
/** Top-level plugin config. Each sub-config that is present enables its sub-generator. */
|
|
72
84
|
export interface TypescriptPluginConfig {
|
|
73
85
|
server?: ServerConfig;
|
|
74
86
|
sdk?: SdkConfig;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":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