@contractkit/plugin-typescript 0.16.1

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.
Files changed (60) hide show
  1. package/.turbo/turbo-build$colon$ci.log +35 -0
  2. package/.turbo/turbo-build.log +15 -0
  3. package/.turbo/turbo-test$colon$ci.log +81 -0
  4. package/.turbo/turbo-test.log +19 -0
  5. package/CHANGELOG.md +151 -0
  6. package/README.md +153 -0
  7. package/coverage/base.css +224 -0
  8. package/coverage/block-navigation.js +87 -0
  9. package/coverage/clover.xml +1882 -0
  10. package/coverage/coverage-final.json +9 -0
  11. package/coverage/favicon.png +0 -0
  12. package/coverage/index.html +131 -0
  13. package/coverage/prettify.css +1 -0
  14. package/coverage/prettify.js +2 -0
  15. package/coverage/sort-arrow-sprite.png +0 -0
  16. package/coverage/sorter.js +210 -0
  17. package/coverage/src/codegen-contract.ts.html +3331 -0
  18. package/coverage/src/codegen-operation.ts.html +2530 -0
  19. package/coverage/src/codegen-plain-types.ts.html +901 -0
  20. package/coverage/src/codegen-sdk.ts.html +2797 -0
  21. package/coverage/src/index.html +206 -0
  22. package/coverage/src/index.ts.html +1360 -0
  23. package/coverage/src/path-utils.ts.html +649 -0
  24. package/coverage/src/ts-render.ts.html +592 -0
  25. package/coverage/tests/helpers.ts.html +826 -0
  26. package/coverage/tests/index.html +116 -0
  27. package/dist/codegen-contract.d.ts +56 -0
  28. package/dist/codegen-contract.d.ts.map +1 -0
  29. package/dist/codegen-operation.d.ts +25 -0
  30. package/dist/codegen-operation.d.ts.map +1 -0
  31. package/dist/codegen-plain-types.d.ts +10 -0
  32. package/dist/codegen-plain-types.d.ts.map +1 -0
  33. package/dist/codegen-sdk.d.ts +38 -0
  34. package/dist/codegen-sdk.d.ts.map +1 -0
  35. package/dist/index.d.ts +77 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +3162 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/path-utils.d.ts +15 -0
  40. package/dist/path-utils.d.ts.map +1 -0
  41. package/dist/ts-render.d.ts +20 -0
  42. package/dist/ts-render.d.ts.map +1 -0
  43. package/eslint.config.js +6 -0
  44. package/package.json +43 -0
  45. package/src/codegen-contract.ts +1082 -0
  46. package/src/codegen-operation.ts +815 -0
  47. package/src/codegen-plain-types.ts +272 -0
  48. package/src/codegen-sdk.ts +904 -0
  49. package/src/index.ts +425 -0
  50. package/src/path-utils.ts +188 -0
  51. package/src/ts-render.ts +169 -0
  52. package/tests/codegen-contract.test.ts +1004 -0
  53. package/tests/codegen-operation.test.ts +939 -0
  54. package/tests/codegen-plain-types.test.ts +636 -0
  55. package/tests/codegen-sdk.test.ts +1500 -0
  56. package/tests/codegen-server.test.ts +192 -0
  57. package/tests/helpers.ts +247 -0
  58. package/tests/pipeline.test.ts +372 -0
  59. package/tsconfig.json +9 -0
  60. package/vitest.config.ts +14 -0
@@ -0,0 +1,35 @@
1
+
2
+ 
3
+ > @contractkit/plugin-typescript@0.16.0 build:ci /Users/robert/projects/contractkit/packages/plugin-typescript
4
+ > eslint --max-warnings=0 && pnpm run build
5
+
6
+ =============
7
+
8
+
9
+ WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.
10
+
11
+
12
+ * @typescript-eslint/typescript-estree version: 8.57.2
13
+ * Supported TypeScript versions: >=4.8.4 <6.0.0
14
+ * Your TypeScript version: 6.0.2
15
+
16
+
17
+ Please only submit bug reports when using the officially supported version.
18
+
19
+
20
+ =============
21
+
22
+ > @contractkit/plugin-typescript@0.16.0 build /Users/robert/projects/contractkit/packages/plugin-typescript
23
+ > tsup src/index.ts --format esm --sourcemap --dts && tsc --emitDeclarationOnly --declaration
24
+
25
+ CLI Building entry: src/index.ts
26
+ CLI Using tsconfig: tsconfig.json
27
+ CLI tsup v8.5.1
28
+ CLI Target: esnext
29
+ ESM Build start
30
+ ESM dist/index.js 123.76 KB
31
+ ESM dist/index.js.map 267.25 KB
32
+ ESM ⚡️ Build success in 156ms
33
+ DTS Build start
34
+ DTS ⚡️ Build success in 702ms
35
+ DTS dist/index.d.ts 3.44 KB
@@ -0,0 +1,15 @@
1
+
2
+ > @contractkit/plugin-typescript@0.16.0 build /Users/robert/projects/contractkit/packages/plugin-typescript
3
+ > tsup src/index.ts --format esm --sourcemap --dts && tsc --emitDeclarationOnly --declaration
4
+
5
+ CLI Building entry: src/index.ts
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v8.5.1
8
+ CLI Target: esnext
9
+ ESM Build start
10
+ ESM dist/index.js 123.76 KB
11
+ ESM dist/index.js.map 267.25 KB
12
+ ESM ⚡️ Build success in 95ms
13
+ DTS Build start
14
+ DTS ⚡️ Build success in 744ms
15
+ DTS dist/index.d.ts 3.44 KB
@@ -0,0 +1,81 @@
1
+
2
+ 
3
+ > @contractkit/plugin-typescript@0.16.0 test:ci /Users/robert/projects/contractkit/packages/plugin-typescript
4
+ > vitest run --coverage
5
+
6
+ [?25l
7
+  RUN  v4.1.5 /Users/robert/projects/contractkit/packages/plugin-typescript
8
+ Coverage enabled with v8
9
+
10
+ [?2026h
11
+  ❯ tests/codegen-operation.test.ts [queued]
12
+
13
+  Test Files 0 passed (6)
14
+  Tests 0 passed (0)
15
+  Start at 08:51:09
16
+  Duration 206ms
17
+ [?2026l[?2026h
18
+  ❯ tests/codegen-contract.test.ts [queued]
19
+  ❯ tests/codegen-operation.test.ts [queued]
20
+  ❯ tests/codegen-plain-types.test.ts [queued]
21
+  ❯ tests/codegen-sdk.test.ts [queued]
22
+  ❯ tests/codegen-server.test.ts [queued]
23
+  ❯ tests/pipeline.test.ts [queued]
24
+
25
+  Test Files 0 passed (6)
26
+  Tests 0 passed (0)
27
+  Start at 08:51:09
28
+  Duration 481ms
29
+ [?2026l[?2026h
30
+  ❯ tests/codegen-contract.test.ts [queued]
31
+  ❯ tests/codegen-operation.test.ts [queued]
32
+  ❯ tests/codegen-plain-types.test.ts [queued]
33
+  ❯ tests/codegen-sdk.test.ts [queued]
34
+  ❯ tests/codegen-server.test.ts [queued]
35
+  ❯ tests/pipeline.test.ts [queued]
36
+
37
+  Test Files 0 passed (6)
38
+  Tests 0 passed (0)
39
+  Start at 08:51:09
40
+  Duration 928ms
41
+ [?2026l[?2026h
42
+  ❯ tests/codegen-contract.test.ts [queued]
43
+  ❯ tests/codegen-operation.test.ts [queued]
44
+  ❯ tests/codegen-plain-types.test.ts [queued]
45
+  ❯ tests/codegen-sdk.test.ts [queued]
46
+  ❯ tests/codegen-server.test.ts [queued]
47
+  ❯ tests/pipeline.test.ts 0/25
48
+
49
+  Test Files 0 passed (6)
50
+  Tests 0 passed (25)
51
+  Start at 08:51:09
52
+  Duration 1.13s
53
+ [?2026l ✓ tests/codegen-plain-types.test.ts (58 tests) 8ms
54
+ ✓ tests/codegen-contract.test.ts (120 tests) 11ms
55
+ ✓ tests/codegen-server.test.ts (15 tests) 10ms
56
+ ✓ tests/codegen-operation.test.ts (86 tests) 28ms
57
+ ✓ tests/pipeline.test.ts (25 tests) 47ms
58
+ ✓ tests/codegen-sdk.test.ts (123 tests) 13ms
59
+
60
+  Test Files  6 passed (6)
61
+  Tests  427 passed (427)
62
+  Start at  08:51:09
63
+  Duration  1.31s (transform 1.99s, setup 0ms, import 4.86s, tests 118ms, environment 0ms)
64
+
65
+  % Coverage report from v8
66
+ -------------------------|---------|----------|---------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------
67
+ File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
68
+ -------------------------|---------|----------|---------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------
69
+ All files  |  77.37 |  73.85 |  82.17 |  79.25 |  
70
+  src  |  77.05 |  73.45 |  81.57 |  78.88 |  
71
+  codegen-contract.ts  |  87.38 |  81.19 |  90.16 |  88.24 | 102,259,348-349,414-416,418,420,432-434,439,494,595,642-646,654-658,664-674,724-726,730,739-755,796-797,807-816,830-831,898,964-969,974-975,980-981
72
+  codegen-operation.ts  |  78.18 |  74.26 |  78.08 |  79.69 | 30,44-77,85-94,164,172-173,312,387,423-426,500-502,511-514,577-597,618,632-646,651-652,668-679,684-685 
73
+  codegen-plain-types.ts |  87.5 |  76.76 |  92.85 |  91.66 | 50-55,91,111,185,199,211,217,269 
74
+  codegen-sdk.ts  |  88.75 |  83.6 |  85 |  91.49 | 23,308-309,578-585,594-599,606-623,678,712-729 
75
+  index.ts  |  23.35 |  19.51 |  33.33 |  25.69 | 136,139,175-375,391,394,397,415,418,421 
76
+  path-utils.ts  |  23.47 |  18.84 |  58.33 |  23.71 | 24-25,51,54-55,80-187 
77
+  ts-render.ts  |  82.19 |  85.39 |  72.22 |  87.09 | 56,90,126,157-165 
78
+  tests  |  90.38 |  90.9 |  89.28 |  93.47 |  
79
+  helpers.ts  |  90.38 |  90.9 |  89.28 |  93.47 | 110-118 
80
+ -------------------------|---------|----------|---------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------
81
+ [?25h
@@ -0,0 +1,19 @@
1
+
2
+ > @contractkit/plugin-typescript@0.16.0 test /Users/robert/projects/contractkit/packages/plugin-typescript
3
+ > vitest run
4
+
5
+
6
+  RUN  v4.1.5 /Users/robert/projects/contractkit/packages/plugin-typescript
7
+
8
+ ✓ tests/codegen-contract.test.ts (120 tests) 10ms
9
+ ✓ tests/codegen-plain-types.test.ts (58 tests) 10ms
10
+ ✓ tests/codegen-sdk.test.ts (123 tests) 16ms
11
+ ✓ tests/codegen-operation.test.ts (86 tests) 9ms
12
+ ✓ tests/pipeline.test.ts (25 tests) 29ms
13
+ ✓ tests/codegen-server.test.ts (15 tests) 6ms
14
+
15
+  Test Files  6 passed (6)
16
+  Tests  427 passed (427)
17
+  Start at  08:51:34
18
+  Duration  472ms (transform 591ms, setup 0ms, import 1.33s, tests 80ms, environment 0ms)
19
+
package/CHANGELOG.md ADDED
@@ -0,0 +1,151 @@
1
+ # @contractkit/contractkit-plugin-typescript
2
+
3
+ ## 0.16.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [c9f2166]
8
+ - @contractkit/core@0.11.0
9
+
10
+ ## 0.16.0
11
+
12
+ ### Minor Changes
13
+
14
+ - bbee232: prep for public release
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [bbee232]
19
+ - @contractkit/core@0.10.0
20
+
21
+ ## 0.15.0
22
+
23
+ ### Minor Changes
24
+
25
+ - e27b771: Add an `includeInternal: boolean` config option to every plugin so consumers can override whether `internal` operations are emitted. Defaults preserve today's behavior: server router and Bruno default to `true` (include); TS SDK, Python SDK, OpenAPI, and Markdown default to `false` (exclude).
26
+
27
+ ## 0.14.1
28
+
29
+ ### Patch Changes
30
+
31
+ - 206120c: Fix double-anchoring in Zod regex codegen: patterns that already contain `^` or an unescaped trailing `$` are now emitted as-written instead of being wrapped a second time. Patterns without anchors continue to be auto-anchored to `^...$` for full-match semantics.
32
+
33
+ ## 0.14.0
34
+
35
+ ### Minor Changes
36
+
37
+ - d13614c: Enhance content type handling in contract DSL. This update introduces support for vendor JSON MIME types and improves the classification of content types, allowing for better handling of text and binary responses. The grammar has been updated to accept a wider range of MIME types, and tests have been added to ensure correct parsing and serialization behavior. Additionally, the code has been refactored to normalize content types for stable comparisons and to support multi-MIME request bodies.
38
+
39
+ ### Patch Changes
40
+
41
+ - Updated dependencies [d13614c]
42
+ - @maroonedsoftware/contractkit@0.9.0
43
+
44
+ ## 0.13.0
45
+
46
+ ### Minor Changes
47
+
48
+ - 353aa10: Implement options-level header globals for request and response in the contract DSL. This update allows headers to be declared at the file level, merging them into every operation's request and response. Added normalization logic to handle header collisions and opt-out scenarios. Updated documentation and tests to reflect these changes, ensuring proper round-trip formatting and validation of headers.
49
+ - 888ded5: Enhance contract DSL with multi-base inheritance support and override modifier. This update introduces the ability to declare multiple base contracts, along with validation rules for field conflicts across bases. The `override` modifier is now required for redeclaring conflicting fields, and the documentation has been updated to reflect these changes. Tests have been added to ensure correct behavior for inheritance and modifier usage.
50
+
51
+ ### Patch Changes
52
+
53
+ - Updated dependencies [353aa10]
54
+ - Updated dependencies [888ded5]
55
+ - @maroonedsoftware/contractkit@0.8.0
56
+
57
+ ## 0.12.0
58
+
59
+ ### Minor Changes
60
+
61
+ - 16ac3a7: Implement support for typed response headers in API operations. Added functionality to declare headers alongside response bodies, affecting OpenAPI, TypeScript SDK, and Markdown documentation generation. Updated related tests to ensure correct parsing and rendering of response headers, including handling optional headers and duplicate declarations.
62
+
63
+ ### Patch Changes
64
+
65
+ - Updated dependencies [16ac3a7]
66
+ - @maroonedsoftware/contractkit@0.7.0
67
+
68
+ ## 0.11.0
69
+
70
+ ### Minor Changes
71
+
72
+ - d3ea773: Enhance model handling by introducing Output variants for response types in code generation. Updated functions to compute and collect models with Output variants, ensuring compatibility with serialization logic. Added tests to verify correct generation of Output types based on model configurations.
73
+
74
+ ### Patch Changes
75
+
76
+ - Updated dependencies [d3ea773]
77
+ - @maroonedsoftware/contractkit@0.6.0
78
+
79
+ ## 0.10.0
80
+
81
+ ### Minor Changes
82
+
83
+ - ddb6a28: Refactor type generation in codegen-contract to use z.input for developer-facing types when outputCase is set. Updated tests to reflect this change in type handling for improved clarity in serialization logic.
84
+
85
+ ## 0.9.0
86
+
87
+ ### Minor Changes
88
+
89
+ - 2c9e9a9: Fix type casting in URLSearchParams serialization for form data in codegen-sdk. Updated tests to reflect changes in body serialization logic.
90
+
91
+ ## 0.8.0
92
+
93
+ ### Minor Changes
94
+
95
+ - 1b336ec: Enhance contract generation by introducing a flattening mechanism for format chains. This allows child models to inline parent fields and inherit transformations, ensuring compatibility with ZodPipe structures. Updated the model generation logic and added tests to verify the new behavior for child models extending formatted parents.
96
+
97
+ ## 0.7.0
98
+
99
+ ### Minor Changes
100
+
101
+ - 181dadb: Refactor request handling to support multiple content types in operations. Updated OpRequestNode to accept an array of bodies, modified related functions and tests to accommodate multi-MIME requests, and enhanced validation for nested structures in URL-encoded bodies. Improved code generation across various plugins to handle new request structure.
102
+
103
+ ### Patch Changes
104
+
105
+ - Updated dependencies [181dadb]
106
+ - @maroonedsoftware/contractkit@0.5.0
107
+
108
+ ## 0.6.0
109
+
110
+ ### Minor Changes
111
+
112
+ - ada5f84: Implement discriminated unions in ContractKit with validation and code generation support. Update README and tests to reflect new functionality, including parsing, rendering, and OpenAPI generation for discriminated unions.
113
+
114
+ ### Patch Changes
115
+
116
+ - Updated dependencies [ada5f84]
117
+ - @maroonedsoftware/contractkit@0.4.0
118
+
119
+ ## 0.5.0
120
+
121
+ ### Minor Changes
122
+
123
+ - 506af42: Enhance input type reference collection in code generation by adding support for tuple, record, union, intersection, lazy, and inlineObject types. Added corresponding test case for intersection query handling.
124
+
125
+ ## 0.4.0
126
+
127
+ ### Minor Changes
128
+
129
+ - 3d90443: Update ZodInterval transformation to include ISO string conversion in contract generation and corresponding test case.
130
+
131
+ ## 0.3.0
132
+
133
+ ### Minor Changes
134
+
135
+ - f396a68: Enhance scalar type support by adding 'interval' to the ContractKit
136
+
137
+ ### Patch Changes
138
+
139
+ - Updated dependencies [f396a68]
140
+ - @maroonedsoftware/contractkit@0.3.0
141
+
142
+ ## 0.2.0
143
+
144
+ ### Minor Changes
145
+
146
+ - db7345b: updating to contractkit as the org
147
+
148
+ ### Patch Changes
149
+
150
+ - Updated dependencies [db7345b]
151
+ - @contractkit/core@0.2.0
package/README.md ADDED
@@ -0,0 +1,153 @@
1
+ # @contractkit/contractkit-plugin-typescript
2
+
3
+ ContractKit plugin that generates TypeScript output from `.ck` contract files. Covers all server-side and client-side TypeScript needs: Koa routers, SDK clients, Zod schemas, and plain TypeScript interfaces.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @contractkit/contractkit-plugin-typescript
9
+ ```
10
+
11
+ ## Configuration
12
+
13
+ Add the plugin to `contractkit.config.json`. Each sub-config is independent — include only what you need.
14
+
15
+ ```json
16
+ {
17
+ "plugins": {
18
+ "@contractkit/contractkit-plugin-typescript": {
19
+ "server": {
20
+ "baseDir": "apps/api/",
21
+ "zod": true,
22
+ "output": {
23
+ "routes": "src/routes/{filename}.router.ts",
24
+ "types": "src/modules/{area}/types/{filename}.ts"
25
+ },
26
+ "servicePathTemplate": "#modules/{module}/{module}.service.js"
27
+ },
28
+ "sdk": {
29
+ "baseDir": "packages/sdk/",
30
+ "name": "acme",
31
+ "zod": true,
32
+ "output": {
33
+ "sdk": "src/{name}.sdk.ts",
34
+ "types": "src/{area}/types/{filename}.ts",
35
+ "clients": "src/{area}/{filename}.client.ts"
36
+ }
37
+ },
38
+ "zod": {
39
+ "baseDir": "packages/schemas/",
40
+ "output": "{filename}.schema.ts"
41
+ },
42
+ "types": {
43
+ "baseDir": "packages/types/",
44
+ "output": "{filename}.types.ts"
45
+ }
46
+ }
47
+ }
48
+ }
49
+ ```
50
+
51
+ ## Sub-configs
52
+
53
+ ### `server`
54
+
55
+ Generates Koa router files from `operation` declarations and optionally type files from `contract` declarations.
56
+
57
+ | Option | Type | Default | Description |
58
+ |---|---|---|---|
59
+ | `baseDir` | `string` | `rootDir` | Base directory for output files |
60
+ | `zod` | `boolean` | `false` | Emit Zod schemas in `output.types` instead of plain interfaces |
61
+ | `output.routes` | `string` | — | Path template for router files |
62
+ | `output.types` | `string` | — | Path template for type/schema files |
63
+ | `servicePathTemplate` | `string` | — | Import path template for service implementations |
64
+
65
+ Each generated router imports handler implementations from a service module. The `servicePathTemplate` controls where that import points. Template variables: `{module}`.
66
+
67
+ ### `sdk`
68
+
69
+ Generates a typed TypeScript SDK client from `operation` declarations. Produces individual client files per operation file plus an aggregator SDK class.
70
+
71
+ | Option | Type | Default | Description |
72
+ |---|---|---|---|
73
+ | `baseDir` | `string` | `rootDir` | Base directory for output files |
74
+ | `name` | `string` | `"sdk"` | SDK class name (e.g. `"acme"` → `AcmeSdk`) |
75
+ | `zod` | `boolean` | `false` | Emit Zod schemas in `output.types` instead of plain interfaces |
76
+ | `output.sdk` | `string` | — | Path template for the aggregator SDK file |
77
+ | `output.types` | `string` | — | Path template for type/schema files |
78
+ | `output.clients` | `string` | — | Path template for individual client files |
79
+
80
+ ### `zod`
81
+
82
+ Generates standalone Zod schema files from `contract` declarations only. Use this when you want schemas without any router or SDK output.
83
+
84
+ | Option | Type | Default | Description |
85
+ |---|---|---|---|
86
+ | `baseDir` | `string` | `rootDir` | Base directory for output files |
87
+ | `output` | `string` | `"{filename}.schema.ts"` | Path template for schema files |
88
+
89
+ ### `types`
90
+
91
+ Generates plain TypeScript interface/type files from `contract` declarations. No Zod runtime dependency.
92
+
93
+ | Option | Type | Default | Description |
94
+ |---|---|---|---|
95
+ | `baseDir` | `string` | `rootDir` | Base directory for output files |
96
+ | `output` | `string` | `"{filename}.types.ts"` | Path template for type files |
97
+
98
+ ## Path templates
99
+
100
+ Output paths support the following variables:
101
+
102
+ | Variable | Value |
103
+ |---|---|
104
+ | `{filename}` | Base name of the `.ck` source file (without extension) |
105
+ | `{dir}` | Relative directory of the `.ck` source file |
106
+ | `{area}` | Value of the `area` key from the `options` block |
107
+ | `{name}` | The `name` option from the SDK sub-config |
108
+
109
+ ## What gets generated
110
+
111
+ ### Zod schema shape (from `contract`)
112
+
113
+ Contracts with `readonly` or `writeonly` fields generate up to three schemas:
114
+
115
+ - **`ModelBase`** — all fields including writeonly (only when writeonly fields exist)
116
+ - **`Model`** — read schema; no writeonly fields; extends `ModelBase` when it exists
117
+ - **`ModelInput`** — input schema; no readonly fields (only when readonly/writeonly fields exist)
118
+
119
+ Contracts without visibility modifiers generate a single `Model` schema.
120
+
121
+ ### Koa router shape (from `operation`)
122
+
123
+ Each operation file generates one Koa router. Request bodies and path/query params are validated against the Zod schemas (when `zod: true`) or plain types. Handlers are expected to be exported from the service module specified by `servicePathTemplate`.
124
+
125
+ ### SDK client shape (from `operation`)
126
+
127
+ Each operation file generates one client class. The aggregator SDK class (in `output.sdk`) instantiates all clients and exposes them as properties.
128
+
129
+ Method names follow this priority:
130
+
131
+ 1. `sdk:` field on the HTTP verb declaration — used as-is (e.g. `sdk: getUser` → `getUser`)
132
+ 2. `name:` field — converted to camelCase (e.g. `name: "Get User"` → `getUser`)
133
+ 3. Inferred from the HTTP method and path (e.g. `GET /users/{id}` → `getUsersById`)
134
+
135
+ A shared `sdk-options.ts` file is emitted alongside the clients. It exports:
136
+
137
+ - `SdkOptions` / `SdkFetch` / `SdkError` / `createSdkFetch` — base client primitives
138
+ - `buildQueryString(query)` — serialises a query params object to `?key=value` or `''`
139
+ - `parseJson<T>(res)` — deserialises a `Response` body to `T`
140
+ - `bigIntReplacer` / `bigIntReviver` — JSON replacer/reviver for `bigint` values
141
+
142
+ ## Programmatic use
143
+
144
+ ```typescript
145
+ import { createTypescriptPlugin } from '@contractkit/contractkit-plugin-typescript';
146
+
147
+ const plugin = createTypescriptPlugin({
148
+ server: {
149
+ output: { routes: 'src/routes/{filename}.router.ts' },
150
+ servicePathTemplate: '#services/{module}.service.js',
151
+ },
152
+ });
153
+ ```
@@ -0,0 +1,224 @@
1
+ body, html {
2
+ margin:0; padding: 0;
3
+ height: 100%;
4
+ }
5
+ body {
6
+ font-family: Helvetica Neue, Helvetica, Arial;
7
+ font-size: 14px;
8
+ color:#333;
9
+ }
10
+ .small { font-size: 12px; }
11
+ *, *:after, *:before {
12
+ -webkit-box-sizing:border-box;
13
+ -moz-box-sizing:border-box;
14
+ box-sizing:border-box;
15
+ }
16
+ h1 { font-size: 20px; margin: 0;}
17
+ h2 { font-size: 14px; }
18
+ pre {
19
+ font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
20
+ margin: 0;
21
+ padding: 0;
22
+ -moz-tab-size: 2;
23
+ -o-tab-size: 2;
24
+ tab-size: 2;
25
+ }
26
+ a { color:#0074D9; text-decoration:none; }
27
+ a:hover { text-decoration:underline; }
28
+ .strong { font-weight: bold; }
29
+ .space-top1 { padding: 10px 0 0 0; }
30
+ .pad2y { padding: 20px 0; }
31
+ .pad1y { padding: 10px 0; }
32
+ .pad2x { padding: 0 20px; }
33
+ .pad2 { padding: 20px; }
34
+ .pad1 { padding: 10px; }
35
+ .space-left2 { padding-left:55px; }
36
+ .space-right2 { padding-right:20px; }
37
+ .center { text-align:center; }
38
+ .clearfix { display:block; }
39
+ .clearfix:after {
40
+ content:'';
41
+ display:block;
42
+ height:0;
43
+ clear:both;
44
+ visibility:hidden;
45
+ }
46
+ .fl { float: left; }
47
+ @media only screen and (max-width:640px) {
48
+ .col3 { width:100%; max-width:100%; }
49
+ .hide-mobile { display:none!important; }
50
+ }
51
+
52
+ .quiet {
53
+ color: #7f7f7f;
54
+ color: rgba(0,0,0,0.5);
55
+ }
56
+ .quiet a { opacity: 0.7; }
57
+
58
+ .fraction {
59
+ font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
60
+ font-size: 10px;
61
+ color: #555;
62
+ background: #E8E8E8;
63
+ padding: 4px 5px;
64
+ border-radius: 3px;
65
+ vertical-align: middle;
66
+ }
67
+
68
+ div.path a:link, div.path a:visited { color: #333; }
69
+ table.coverage {
70
+ border-collapse: collapse;
71
+ margin: 10px 0 0 0;
72
+ padding: 0;
73
+ }
74
+
75
+ table.coverage td {
76
+ margin: 0;
77
+ padding: 0;
78
+ vertical-align: top;
79
+ }
80
+ table.coverage td.line-count {
81
+ text-align: right;
82
+ padding: 0 5px 0 20px;
83
+ }
84
+ table.coverage td.line-coverage {
85
+ text-align: right;
86
+ padding-right: 10px;
87
+ min-width:20px;
88
+ }
89
+
90
+ table.coverage td span.cline-any {
91
+ display: inline-block;
92
+ padding: 0 5px;
93
+ width: 100%;
94
+ }
95
+ .missing-if-branch {
96
+ display: inline-block;
97
+ margin-right: 5px;
98
+ border-radius: 3px;
99
+ position: relative;
100
+ padding: 0 4px;
101
+ background: #333;
102
+ color: yellow;
103
+ }
104
+
105
+ .skip-if-branch {
106
+ display: none;
107
+ margin-right: 10px;
108
+ position: relative;
109
+ padding: 0 4px;
110
+ background: #ccc;
111
+ color: white;
112
+ }
113
+ .missing-if-branch .typ, .skip-if-branch .typ {
114
+ color: inherit !important;
115
+ }
116
+ .coverage-summary {
117
+ border-collapse: collapse;
118
+ width: 100%;
119
+ }
120
+ .coverage-summary tr { border-bottom: 1px solid #bbb; }
121
+ .keyline-all { border: 1px solid #ddd; }
122
+ .coverage-summary td, .coverage-summary th { padding: 10px; }
123
+ .coverage-summary tbody { border: 1px solid #bbb; }
124
+ .coverage-summary td { border-right: 1px solid #bbb; }
125
+ .coverage-summary td:last-child { border-right: none; }
126
+ .coverage-summary th {
127
+ text-align: left;
128
+ font-weight: normal;
129
+ white-space: nowrap;
130
+ }
131
+ .coverage-summary th.file { border-right: none !important; }
132
+ .coverage-summary th.pct { }
133
+ .coverage-summary th.pic,
134
+ .coverage-summary th.abs,
135
+ .coverage-summary td.pct,
136
+ .coverage-summary td.abs { text-align: right; }
137
+ .coverage-summary td.file { white-space: nowrap; }
138
+ .coverage-summary td.pic { min-width: 120px !important; }
139
+ .coverage-summary tfoot td { }
140
+
141
+ .coverage-summary .sorter {
142
+ height: 10px;
143
+ width: 7px;
144
+ display: inline-block;
145
+ margin-left: 0.5em;
146
+ background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
147
+ }
148
+ .coverage-summary .sorted .sorter {
149
+ background-position: 0 -20px;
150
+ }
151
+ .coverage-summary .sorted-desc .sorter {
152
+ background-position: 0 -10px;
153
+ }
154
+ .status-line { height: 10px; }
155
+ /* yellow */
156
+ .cbranch-no { background: yellow !important; color: #111; }
157
+ /* dark red */
158
+ .red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
159
+ .low .chart { border:1px solid #C21F39 }
160
+ .highlighted,
161
+ .highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{
162
+ background: #C21F39 !important;
163
+ }
164
+ /* medium red */
165
+ .cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
166
+ /* light red */
167
+ .low, .cline-no { background:#FCE1E5 }
168
+ /* light green */
169
+ .high, .cline-yes { background:rgb(230,245,208) }
170
+ /* medium green */
171
+ .cstat-yes { background:rgb(161,215,106) }
172
+ /* dark green */
173
+ .status-line.high, .high .cover-fill { background:rgb(77,146,33) }
174
+ .high .chart { border:1px solid rgb(77,146,33) }
175
+ /* dark yellow (gold) */
176
+ .status-line.medium, .medium .cover-fill { background: #f9cd0b; }
177
+ .medium .chart { border:1px solid #f9cd0b; }
178
+ /* light yellow */
179
+ .medium { background: #fff4c2; }
180
+
181
+ .cstat-skip { background: #ddd; color: #111; }
182
+ .fstat-skip { background: #ddd; color: #111 !important; }
183
+ .cbranch-skip { background: #ddd !important; color: #111; }
184
+
185
+ span.cline-neutral { background: #eaeaea; }
186
+
187
+ .coverage-summary td.empty {
188
+ opacity: .5;
189
+ padding-top: 4px;
190
+ padding-bottom: 4px;
191
+ line-height: 1;
192
+ color: #888;
193
+ }
194
+
195
+ .cover-fill, .cover-empty {
196
+ display:inline-block;
197
+ height: 12px;
198
+ }
199
+ .chart {
200
+ line-height: 0;
201
+ }
202
+ .cover-empty {
203
+ background: white;
204
+ }
205
+ .cover-full {
206
+ border-right: none !important;
207
+ }
208
+ pre.prettyprint {
209
+ border: none !important;
210
+ padding: 0 !important;
211
+ margin: 0 !important;
212
+ }
213
+ .com { color: #999 !important; }
214
+ .ignore-none { color: #999; font-weight: normal; }
215
+
216
+ .wrapper {
217
+ min-height: 100%;
218
+ height: auto !important;
219
+ height: 100%;
220
+ margin: 0 auto -48px;
221
+ }
222
+ .footer, .push {
223
+ height: 48px;
224
+ }