@contractkit/plugin-typescript 0.31.2 → 0.33.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.
@@ -5,9 +5,9 @@ $ tsup src/index.ts --format esm --sourcemap --dts && tsc --emitDeclarationOnly
5
5
  CLI tsup v8.5.1
6
6
  CLI Target: esnext
7
7
  ESM Build start
8
- ESM dist/index.js 188.58 KB
9
- ESM dist/index.js.map 418.71 KB
10
- ESM ⚡️ Build success in 405ms
8
+ ESM dist/index.js 210.74 KB
9
+ ESM dist/index.js.map 480.07 KB
10
+ ESM ⚡️ Build success in 478ms
11
11
  DTS Build start
12
- DTS ⚡️ Build success in 6617ms
13
- DTS dist/index.d.ts 4.55 KB
12
+ DTS ⚡️ Build success in 3983ms
13
+ DTS dist/index.d.ts 5.14 KB
@@ -3,34 +3,36 @@ $ vitest run --coverage
3
3
   RUN  v4.1.5 /home/runner/work/ContractKit/ContractKit/packages/plugin-typescript
4
4
  Coverage enabled with v8
5
5
 
6
- ✓ tests/codegen-operation.test.ts (129 tests) 234ms
7
- ✓ tests/codegen-contract.test.ts (128 tests) 148ms
8
- ✓ tests/codegen-sdk.test.ts (152 tests) 300ms
9
- ✓ tests/codegen-plain-types.test.ts (66 tests) 42ms
10
- ✓ tests/codegen-server.test.ts (25 tests) 59ms
11
- ✓ tests/pipeline.test.ts (28 tests) 307ms
12
- ✓ tests/codegen-mcp.test.ts (24 tests) 41ms
6
+ ✓ tests/codegen-contract.test.ts (140 tests) 214ms
7
+ ✓ tests/codegen-operation.test.ts (155 tests) 270ms
8
+ ✓ tests/codegen-sdk.test.ts (159 tests) 239ms
9
+ ✓ tests/codegen-server.test.ts (30 tests) 84ms
10
+ ✓ tests/codegen-plain-types.test.ts (66 tests) 82ms
11
+ ✓ tests/pipeline.test.ts (30 tests) 279ms
12
+ ✓ tests/codegen-mcp.test.ts (24 tests) 31ms
13
13
  ✓ tests/escaping-security.test.ts (18 tests) 21ms
14
14
 
15
15
   Test Files  8 passed (8)
16
-  Tests  570 passed (570)
17
-  Start at  13:44:24
18
-  Duration  10.83s (transform 7.37s, setup 0ms, import 22.36s, tests 1.15s, environment 1ms)
16
+  Tests  622 passed (622)
17
+  Start at  17:30:03
18
+  Duration  8.38s (transform 4.61s, setup 0ms, import 16.31s, tests 1.22s, environment 1ms)
19
19
 
20
20
   % Coverage report from v8
21
21
  -------------------|---------|----------|---------|---------|-------------------
22
22
  File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
23
23
  -------------------|---------|----------|---------|---------|-------------------
24
- All files | 83.71 | 78.1 | 86.07 | 86.33 |
25
- src | 83.57 | 77.84 | 85.81 | 86.18 |
26
- ...n-contract.ts | 88.1 | 82.91 | 90.08 | 89.26 | ...1095,1100-1101
27
- codegen-mcp.ts | 82.79 | 75.47 | 84.21 | 86.02 | ...93,298-299,382
28
- ...-operation.ts | 82.35 | 80.68 | 76.19 | 84.83 | ...99-910,915-916
29
- ...lain-types.ts | 91.57 | 81.98 | 96.87 | 94.44 | ...31,157,269,275
30
- codegen-sdk.ts | 89.92 | 83.94 | 90.62 | 92.67 | ...1411,1425-1426
31
- index.ts | 66.25 | 53.15 | 72.72 | 70.29 | ...1022,1038-1057
24
+ All files | 83.01 | 77.14 | 86.06 | 85.64 |
25
+ src | 82.87 | 76.85 | 85.8 | 85.49 |
26
+ ...n-contract.ts | 89.24 | 83.92 | 90.16 | 90.42 | ...1150,1155-1156
27
+ codegen-mcp.ts | 82.33 | 74.84 | 84.21 | 85.77 | ...97,302-303,386
28
+ ...-operation.ts | 83.02 | 80.71 | 79.71 | 85.18 | ...1032,1037-1038
29
+ ...lain-types.ts | 88.44 | 80.74 | 97.05 | 90.74 | ...71,197,309,315
30
+ ...gen-revive.ts | 57.77 | 52.04 | 75 | 62.74 | ...65-196,278-284
31
+ codegen-sdk.ts | 88.96 | 82.01 | 90.56 | 91.78 | ...1632,1636-1637
32
+ ...al-runtime.ts | 100 | 100 | 100 | 100 |
33
+ index.ts | 67.96 | 54.68 | 75 | 71.09 | ...1079,1095-1114
32
34
  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
- tests | 91.07 | 90.24 | 90 | 93.87 |
35
- helpers.ts | 91.07 | 90.24 | 90 | 93.87 | 110-118
35
+ ts-render.ts | 85.18 | 87.5 | 79.16 | 89.39 | 83,165,198-206
36
+ tests | 91.22 | 92.68 | 90.32 | 94 |
37
+ helpers.ts | 91.22 | 92.68 | 90.32 | 94 | 115-123
36
38
  -------------------|---------|----------|---------|---------|-------------------
package/CHANGELOG.md CHANGED
@@ -1,5 +1,171 @@
1
1
  # @contractkit/contractkit-plugin-typescript
2
2
 
3
+ ## 0.33.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e102a2c: Add a `decimal` scalar, for money and anything else that has to be exact
8
+
9
+ `number` compiles to `z.coerce.number()` — an IEEE-754 double. Anything monetary has to be exact,
10
+ so contracts either lied about their types or routed the value through `string` by hand. `decimal`
11
+ gives the language a type for it:
12
+
13
+ ```
14
+ contract Payslip: {
15
+ gross: decimal(min=0, scale=2)
16
+ rate: decimal
17
+ }
18
+ ```
19
+
20
+ A decimal travels as a **quoted JSON string** (`{"gross": "1250.00"}`) and becomes a decimal.js
21
+ `Decimal` — the same class Prisma hands you for a `Decimal` column, so a value moves between the
22
+ two with no conversion. Python gets `decimal.Decimal`; OpenAPI gets `type: string, format: decimal`.
23
+
24
+ A raw JSON number is **rejected**, not coerced. By the time one reaches the schema it has already
25
+ been through a double, which is precisely the loss the scalar exists to prevent, so accepting it
26
+ would defeat the point silently.
27
+
28
+ **`scale=` is a validation constraint — at most N decimal places — not a formatting directive.**
29
+ It cannot be one: the router assigns `ctx.body` and Koa serializes it with a `JSON.stringify` we
30
+ have no replacer for, so the wire form is whatever decimal.js normalizes to and `"1250.00"` reads
31
+ back as `"1250"`. The two are the same number; format at the display edge if you need the trailing
32
+ zeros. This is also what `scale` means in OpenAPI `pattern`, pydantic `condecimal(decimal_places=)`
33
+ and Prisma `@db.Decimal(_, n)`, so every downstream mapping stays honest.
34
+
35
+ Generated code sets `Decimal.set({ toExpNeg: -9e15, toExpPos: 9e15 })` so values never serialize in
36
+ exponential notation — without it `0.00000001` ships as `"1e-8"` and any peer validating
37
+ `^-?\d+(\.\d+)?$` rejects it. Note this is global decimal.js configuration and affects every
38
+ `Decimal` in the consuming process.
39
+
40
+ SDK clients rehydrate decimals through generated `reviveX` functions. The `bigint` approach does
41
+ not transfer — it works only because bigint invented a tagged `"123n"` wire encoding, and tagging a
42
+ decimal would corrupt the format for every non-ContractKit consumer. Re-parsing responses through
43
+ the Zod schema is not available either: `XOutput` is a type alias with no runtime value, and models
44
+ default to `z.strictObject`, so any field the server added would throw in every deployed client.
45
+ The revivers mutate in place, which preserves unknown server-added keys.
46
+
47
+ Two placements are rejected at parse time, both errors rather than warnings since no existing
48
+ contract can be relying on them. A decimal inside an **undiscriminated union** cannot be rehydrated
49
+ — the SDK has no way to tell which arm arrived, and a convert-if-string fallback would silently
50
+ rewrite a genuine `string` field in a sibling arm. A decimal in a **response header** has no
51
+ parsing step at all, so the annotation would simply be false at runtime.
52
+
53
+ `min`/`max` are kept as exact decimal strings rather than coerced through `Number()`, and OpenAPI
54
+ carries them in `x-contractkit-min`/`-max` extensions, since JSON Schema's numeric `minimum` and
55
+ `maximum` are ignored on a string type. A contract round-trips through OpenAPI and back with its
56
+ bounds intact.
57
+
58
+ SDKs that scaffold a `package.json` gain `decimal.js` as a dependency when a covered model uses the
59
+ scalar. Existing scaffolds are write-once and are not updated, so add it by hand there.
60
+
61
+ ### Patch Changes
62
+
63
+ - e102a2c: Fix scalar lists that had drifted out of sync with the language
64
+
65
+ Four places kept a hand-written copy of the language's scalar names, and three had already fallen
66
+ behind without anything failing to build:
67
+ - The VS Code completion list and hover map were both missing `interval`, so the editor silently
68
+ stopped recognising it — no completion, no hover.
69
+ - The constraint-argument regex that decides when to offer `min=`/`max=` completions was missing
70
+ `time`, `interval`, and every non-constrainable scalar.
71
+ - `docs/language.md`'s scalar table was missing `duration`.
72
+
73
+ The completion and semantic-token providers now read `SCALAR_NAMES` from `@contractkit/core`
74
+ directly, which removes the drift class rather than patching this instance of it, and the
75
+ constraint regex is built from those lists. What genuinely cannot derive from the set — a TextMate
76
+ alternation, a per-scalar documentation map, a Markdown table — is now covered by a test that fails
77
+ when any of them falls behind.
78
+
79
+ Also fixes the SDK scaffold's luxon detection, which omitted `duration`. `generateContract` imports
80
+ `Duration` from luxon whenever that scalar is present, so a contract whose only temporal type was a
81
+ duration scaffolded a `package.json` with no `luxon` dependency and did not compile.
82
+
83
+ - Updated dependencies [e102a2c]
84
+ - @contractkit/core@0.28.0
85
+
86
+ ## 0.32.0
87
+
88
+ ### Minor Changes
89
+
90
+ - 5dc2693: Add `server.validateResponses` — the generated Koa router can now validate what it sends, not just
91
+ what it receives
92
+
93
+ Handlers have always run request params, query, headers and body through `parseAndValidate`. The
94
+ service's return value got nothing: it was type-annotated and assigned straight to `ctx.body`, so a
95
+ service returning a shape its own contract forbids shipped it to the client unchanged. With
96
+ `server.validateResponses: true` the result is re-parsed against the declared response schema and
97
+ the _parsed_ value is written:
98
+
99
+ ```ts
100
+ const result: User = await service.getById(id);
101
+
102
+ ctx.status = 200;
103
+ ctx.type = 'application/json';
104
+ ctx.body = await parseAndValidate(result, User, 500);
105
+ ```
106
+
107
+ Because the parsed value is what reaches the wire, `mode(strip)` now actually strips extra keys off
108
+ responses.
109
+ - **Opt-in, and off by default**, because turning it on surfaces real drift. TypeScript only
110
+ excess-property-checks object _literals_, so a service returning a database row with undeclared
111
+ columns satisfies `const result: User` today and quietly ships them; under the default `strict`
112
+ mode that becomes a 500. That is the flag working, but it is not a change to make on a Friday.
113
+ - **`zod: true` is a hard prerequisite.** Without it `output.types` emits plain interfaces — types
114
+ with no runtime schema value to validate against. Setting `validateResponses` alone now fails the
115
+ build with an explicit message instead of emitting code that cannot compile. This is the plugin's
116
+ first config assertion; it runs for both the default export and `createTypescriptPlugin`.
117
+ - **Requires `@maroonedsoftware/zod` 0.6.1 or later** for the `statusCode` argument. Failures are
118
+ raised as `500`, not the `400` a request-side failure gets — a service breaking its own contract
119
+ is a server fault. At 5xx that package puts the field-level map on `internalDetails` rather than
120
+ `details`, so `errorMiddleware` keeps it out of the response body and on the log path.
121
+
122
+ Two kinds of response body are deliberately left unvalidated, and generate exactly as before:
123
+ - **Anything transitively referencing a model with `format(input=…)` or `format(output=…)`.** Those
124
+ schemas transform keys between wire and developer-facing casing, and the service already returns
125
+ the post-transform shape, so re-parsing it through the same schema would fail on every key. Note
126
+ this needs a wider set than `modelsWithOutput`, which seeds only from `outputCase` because only
127
+ that case needs an `Output` type alias — a `format(input=snake)`-only model is just as
128
+ untouchable. `@contractkit/core` gains `computeModelsWithCaseTransform` for it.
129
+ - **A status whose several content types carry different body shapes**, where `contentType` and
130
+ `body` are correlated across union members. Matching shapes (`image/png` and `image/jpeg` both
131
+ `binary`) share one schema and validate normally.
132
+
133
+ One wart worth knowing: `ctx.status` and any `ctx.set(…)` response headers are written before the
134
+ body, so a validation failure raises its 500 with the success path's headers already set.
135
+
136
+ Projects that do not set the flag generate byte-identical routers.
137
+
138
+ ### Patch Changes
139
+
140
+ - 5dc2693: Stop the generated Koa router emitting imports nothing in the file references
141
+
142
+ `collectTypes` and `collectServices` walk the AST, and the AST over-approximates what a router
143
+ actually uses in three ways:
144
+ - A model with an `Input` or `Output` variant contributed **both** its base name and the variant,
145
+ even when only the variant is ever annotated. A response typed `AuthTokenOutput` emitted
146
+ `import { AuthToken, AuthTokenOutput }`, and a request body validated against `CreateUserInput`
147
+ emitted `import { CreateUser, CreateUserInput }`.
148
+ - Both collectors walk every operation, including the `internal` ones `includeInternal: false`
149
+ drops. A router whose only operation was excluded still imported that operation's service and
150
+ response model, with no handler left to use either.
151
+
152
+ In a consuming project with `noUnusedLocals` — or the equivalent lint rule — each of those is a
153
+ compile error in generated code the user cannot edit.
154
+
155
+ Every collected service and model name is now filtered through the same `uses` gate that already
156
+ prunes `parseAndValidate`, `requirePolicy`, `MultipartBody` and the luxon imports: a name is
157
+ imported only if it appears in the generated body. This is the approach the file's own comment
158
+ already argued for — deciding imports from the emitted text rather than from predicates over the
159
+ AST that have to be kept in step with it by hand.
160
+
161
+ Names that are genuinely used are unaffected, including a base model used as the runtime schema
162
+ under `server.validateResponses`. `@contractkit/plugin-typescript`'s MCP output does not have this
163
+ gap — its schema ids and service imports are both derived from the emitted tool plans.
164
+
165
+ - Updated dependencies [aea5e21]
166
+ - Updated dependencies [5dc2693]
167
+ - @contractkit/core@0.27.0
168
+
3
169
  ## 0.31.2
4
170
 
5
171
  ### Patch Changes
package/README.md CHANGED
@@ -61,6 +61,7 @@ Generates Koa router files from `operation` declarations and optionally type fil
61
61
  | `output.routes` | `string` | — | Path template for router files |
62
62
  | `output.types` | `string` | — | Path template for type/schema files |
63
63
  | `servicePathTemplate` | `string` | — | Import path template for service implementations |
64
+ | `validateResponses` | `boolean` | `false` | Re-parse the service result against its response schema before writing `ctx.body`. Requires `zod: true`. |
64
65
 
65
66
  Each generated router imports handler implementations from a service module. The `servicePathTemplate` controls where that import points. Template variables: `{module}`.
66
67
 
@@ -99,6 +100,11 @@ Generates plain TypeScript interface/type files from `contract` declarations. No
99
100
  The `server` and `sdk` sub-generators set `target` themselves (`server` and `client` respectively), so
100
101
  their plain-type output already matches the runtime that consumes it.
101
102
 
103
+ `decimal` is the one scalar that renders the same for both targets — decimal.js `Decimal` — because
104
+ it has no output transform, so the wire view and the server view agree. That also means plain-type
105
+ output carries a real `import Decimal from 'decimal.js'`, and the scaffolded `package.json` adds
106
+ `decimal.js` as a dependency whenever a covered model uses the scalar.
107
+
102
108
  ## Path templates
103
109
 
104
110
  Output paths support the following variables:
@@ -127,6 +133,8 @@ Contracts without visibility modifiers generate a single `Model` schema.
127
133
 
128
134
  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`.
129
135
 
136
+ Responses are only type-annotated by default. With `validateResponses: true` (which requires `zod: true`) the service's return value is re-parsed against its declared response schema and the parsed value is written to `ctx.body`, so a service returning a shape the contract does not allow fails with a 500 instead of shipping it. See [docs/config.md](../../docs/config.md#validateresponses) for the caveats — notably that models using `format(input=…)`/`format(output=…)` are skipped.
137
+
130
138
  ### SDK client shape (from `operation`)
131
139
 
132
140
  Operation files cluster on the SDK based on `keys.area` and `keys.subarea` (set in each file's `options { keys: { ... } }` block):
@@ -24,6 +24,13 @@ export interface ContractCodegenContext {
24
24
  * `generateContract`, whose Zod schemas are server-shaped by construction. Default `'client'`.
25
25
  */
26
26
  target?: TsRenderTarget;
27
+ /** Model names that carry a `decimal`, directly or transitively. */
28
+ modelsWithDecimal?: Set<string>;
29
+ /**
30
+ * Emit `reviveX()` hydration functions alongside the schemas. Set only for SDK type files: a
31
+ * server handler receives decimals already parsed by `_ZodDecimal`, so it has nothing to revive.
32
+ */
33
+ emitRevivers?: boolean;
27
34
  }
28
35
  /**
29
36
  * 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;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,GAA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AAE,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,CAuBzE"}
@@ -21,6 +21,18 @@ export interface OpCodegenOptions {
21
21
  * from the generated router entirely.
22
22
  */
23
23
  includeInternal?: boolean;
24
+ /**
25
+ * Re-parse the service result through its declared response schema before writing `ctx.body`,
26
+ * and write the parsed value. Requires the type file to hold Zod schemas (`server.zod`) —
27
+ * plain interfaces are types, with no runtime schema value to validate against. Default false.
28
+ */
29
+ validateResponses?: boolean;
30
+ /**
31
+ * Set of model names whose schema applies a `format(...)` key transform, directly or through a
32
+ * referenced model. Response bodies touching one are left unvalidated: the service returns the
33
+ * post-transform shape, which the schema itself cannot re-parse.
34
+ */
35
+ modelsWithTransform?: Set<string>;
24
36
  }
25
37
  /**
26
38
  * Generate a Koa router module for every operation in `root`, including the imports, type
@@ -1 +1 @@
1
- {"version":3,"file":"codegen-operation.d.ts","sourceRoot":"","sources":["../src/codegen-operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,UAAU,EACV,WAAW,EACX,eAAe,EAGf,gBAAgB,EAInB,MAAM,mBAAmB,CAAC;AAiC3B;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAkE5F;AAID,8EAA8E;AAC9E,MAAM,WAAW,gBAAgB;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,sBAAsB,C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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"}
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;AAgBpE;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,MAAM,CAkFnG"}
@@ -0,0 +1,42 @@
1
+ import type { ContractTypeNode, ModelNode } from '@contractkit/core';
2
+ /**
3
+ * Emitters for the `reviveX` functions that rehydrate `decimal` fields in an SDK response.
4
+ *
5
+ * A decimal arrives as a quoted JSON string, but the generated types say `Decimal`, so something
6
+ * has to construct one. The SDK cannot do it the way `bigint` does — `bigIntReviver` works only
7
+ * because bigint invented a tagged `"123n"` wire encoding, and `"10.50"` is indistinguishable from
8
+ * an ordinary string without knowing the schema. Nor can it re-parse the response through the Zod
9
+ * schema: `XOutput` is a `z.output<>` type alias with no runtime value behind it, and models
10
+ * default to `z.strictObject`, so any field the server added would throw in every deployed client.
11
+ *
12
+ * So the knowledge lives in generated code instead: one function per model that walks to the field
13
+ * positions a decimal can occupy and converts in place. Mutating rather than rebuilding keeps the
14
+ * cost proportional to the number of decimal fields, and preserves unknown server-added keys —
15
+ * the forward compatibility a strict re-parse would destroy.
16
+ *
17
+ * Emitted from the AST, so zod mode and plain-types mode produce identical runtime behaviour.
18
+ */
19
+ export interface ReviveCodegenOptions {
20
+ /** Models that carry a decimal, directly or transitively. Only these get a reviver. */
21
+ modelsWithDecimal: Set<string>;
22
+ /** Models with an `Output` variant, which need a second reviver keyed by the output casing. */
23
+ modelsWithOutput?: Set<string>;
24
+ /** Every model in scope, for resolving discriminated-union members to their literal tag. */
25
+ modelMap?: Map<string, ModelNode>;
26
+ }
27
+ /** The per-file coercion helper. Emitted once in any file that declares a reviver. */
28
+ export declare const DECIMAL_COERCE_DECL: string[];
29
+ /** `reviveInvoice` / `reviveInvoiceOutput`. */
30
+ export declare function reviveFnName(model: string, variant?: 'base' | 'output'): string;
31
+ /** Whether a type reaches a decimal, following refs through `modelsWithDecimal`. */
32
+ export declare function typeReachesDecimal(type: ContractTypeNode, opts: ReviveCodegenOptions): boolean;
33
+ /**
34
+ * A standalone reviver for an arbitrary type node — used for a response body that is not a plain
35
+ * model reference (an inline object, a record, a tuple), where there is no `reviveX` to call.
36
+ *
37
+ * Returns `null` when the type holds no decimal, so the caller emits nothing at all.
38
+ */
39
+ export declare function renderInlineReviver(fnName: string, tsType: string, type: ContractTypeNode, opts: ReviveCodegenOptions, variant?: 'base' | 'output'): string[] | null;
40
+ /** The `reviveX` (and `reviveXOutput`) declarations for one model, or `[]` if it holds no decimal. */
41
+ export declare function renderReviveFunctions(model: ModelNode, opts: ReviveCodegenOptions): string[];
42
+ //# sourceMappingURL=codegen-revive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codegen-revive.d.ts","sourceRoot":"","sources":["../src/codegen-revive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAa,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEhF;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,oBAAoB;IACjC,uFAAuF;IACvF,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,+FAA+F;IAC/F,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,4FAA4F;IAC5F,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACrC;AAED,sFAAsF;AACtF,eAAO,MAAM,mBAAmB,UAW/B,CAAC;AAEF,+CAA+C;AAC/C,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,GAAG,QAAiB,GAAG,MAAM,CAEvF;AAQD,oFAAoF;AACpF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAuB9F;AA0JD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAC/B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,gBAAgB,EACtB,IAAI,EAAE,oBAAoB,EAC1B,OAAO,GAAE,MAAM,GAAG,QAAmB,GACtC,MAAM,EAAE,GAAG,IAAI,CAajB;AAED,sGAAsG;AACtG,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,oBAAoB,GAAG,MAAM,EAAE,CAQ5F"}
@@ -1,4 +1,4 @@
1
- import type { OpRootNode } from '@contractkit/core';
1
+ import type { OpRootNode, ModelNode } from '@contractkit/core';
2
2
  /** Options shared by every SDK code-generation entry point. */
3
3
  export interface SdkCodegenOptions {
4
4
  /** Template for type import paths when `modelOutPaths` is not provided. Supports `{module}` and `{base}`. */
@@ -13,6 +13,10 @@ export interface SdkCodegenOptions {
13
13
  modelsWithInput?: Set<string>;
14
14
  /** Set of model names that have Output variants (models with format(output=...)) */
15
15
  modelsWithOutput?: Set<string>;
16
+ /** Model names carrying a `decimal`, whose response bodies need rehydrating client-side. */
17
+ modelsWithDecimal?: Set<string>;
18
+ /** Every model in scope, for resolving discriminated-union members inside an inline reviver. */
19
+ modelMap?: Map<string, ModelNode>;
16
20
  /**
17
21
  * Whether to emit SDK methods for operations marked `internal`. Defaults to `false` —
18
22
  * internal ops are omitted from the SDK so consumers don't pick them up. Set to `true`
@@ -41,16 +45,22 @@ export declare function hasPublicOperations(root: OpRootNode, includeInternal?:
41
45
  export declare function generateSdk(root: OpRootNode, options?: SdkCodegenOptions): string;
42
46
  /**
43
47
  * Render the method-block lines for an operation file as if they were declared inside a
44
- * client class. Returns one consolidated array of strings (each pre-indented for class body
45
- * level, with leading blank lines between methods) plus the set of method names emitted —
46
- * the caller uses the names to detect cross-file collisions when multiple files contribute
47
- * to the same area-level client.
48
+ * client class.
48
49
  *
49
50
  * Skips operations marked `internal` unless `options.includeInternal` is set.
51
+ *
52
+ * @returns `lines`, one consolidated array pre-indented for class-body level with leading blank
53
+ * lines between methods; `methodNames`, used by the caller to detect cross-file collisions when
54
+ * several files contribute to the same area-level client; `preludeLines`, module-level
55
+ * declarations the methods reference (decimal revivers and their `__dec` helper) which the caller
56
+ * must splice in above the class; and `needsDecimalImport`, true when those declarations require
57
+ * `import { Decimal } from 'decimal.js'` in the emitting file.
50
58
  */
51
59
  export declare function generateClientMethods(root: OpRootNode, options: SdkCodegenOptions): {
52
60
  lines: string[];
53
61
  methodNames: string[];
62
+ preludeLines: string[];
63
+ needsDecimalImport: boolean;
54
64
  };
55
65
  /**
56
66
  * Module-level `…ErrorBody` aliases for every operation whose thrown statuses declare a body.
@@ -87,8 +97,10 @@ export declare function generateSdkOptions(): string;
87
97
  export interface SdkScaffoldDeps {
88
98
  /** Zod schema files are emitted (`config.zod`) — the SDK imports `zod`. */
89
99
  zod: boolean;
90
- /** Any covered model uses a `date`/`time`/`datetime`/`interval` scalar — the SDK imports `luxon`. */
100
+ /** Any covered model uses a `date`/`time`/`datetime`/`duration`/`interval` scalar — the SDK imports `luxon`. */
91
101
  luxon: boolean;
102
+ /** Any covered model uses a `decimal` scalar — the SDK imports `decimal.js`. */
103
+ decimal: boolean;
92
104
  }
93
105
  /**
94
106
  * Generate a starter `package.json` for a generated SDK package. Emitted with
@@ -1 +1 @@
1
- {"version":3,"file":"codegen-s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,CAAC;IACjB,mIAAmI;IACnI,cAAc,EAAE,iBAAiB,CAAC;CACrC;AAED,2DAA2D;AAC3D,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,MAAM,EAAE,aAAa,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IAC/B,8FAA8F;IAC9F,eAAe,EAAE,aAAa,EAAE,CAAC;IACjC,iCAAiC;IACjC,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,kFAAkF;IAClF,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,4CAA4C;AAC5C,MAAM,WAAW,eAAe;IAC5B,uFAAuF;IACvF,IAAI,EAAE,MAAM,CAAC;IACb,+HAA+H;IAC/H,OAAO,EAAE,MAAM,CAAC;IAChB,0GAA0G;IAC1G,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,2EAA2E;IAC3E,cAAc,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,aAAa,CAAA;KAAE,EAAE,CAAC;IAClE,yEAAyE;IACzE,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAqJjE;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAyCvE"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The emitted decimal.js runtime shared by every generator that renders a `decimal` scalar.
3
+ *
4
+ * `_ZodBinary`/`_ZodDatetime`/`_ZodInterval` are duplicated as literals across codegen-contract,
5
+ * codegen-operation and codegen-mcp, and have already drifted once (the three files emit their
6
+ * luxon import lists in two different orders). The decimal runtime is defined once here so the
7
+ * three call sites cannot disagree about it; each still decides *whether* to emit it with its own
8
+ * detection strategy, which is the part that legitimately differs between them.
9
+ */
10
+ /**
11
+ * The decimal.js import — **named, not default**.
12
+ *
13
+ * `decimal.d.ts` declares `Decimal` three times over: a class, a namespace, and a function, with
14
+ * `export default Decimal` alongside. Under the `NodeNext` resolution the scaffolded SDK uses
15
+ * (`module: NodeNext` + `"type": "module"`), the default export resolves to the *namespace*
16
+ * meaning, so `import Decimal from 'decimal.js'` fails to compile with "Cannot use namespace
17
+ * 'Decimal' as a type" and "Property 'set' does not exist". The named import binds the merged
18
+ * class and is the only form that typechecks.
19
+ */
20
+ export declare const DECIMAL_IMPORT = "import { Decimal } from 'decimal.js';";
21
+ /**
22
+ * Global decimal.js configuration, emitted in **every** file that imports `Decimal` — plain-types
23
+ * mode included, where there is no Zod schema but `String(value)` and `JSON.stringify` still run.
24
+ *
25
+ * Load-bearing, not cosmetic. decimal.js switches to exponential
26
+ * notation outside `toExpNeg`/`toExpPos` (defaults -7/21), so without it `new Decimal('0.00000001')`
27
+ * serializes as `"1e-8"` and any peer validating `^-?\d+(\.\d+)?$` rejects it. It is the only lever
28
+ * that reaches the `JSON.stringify` Koa runs over `ctx.body`, which we do not otherwise control.
29
+ *
30
+ */
31
+ export declare const DECIMAL_CONFIG_LINE = "Decimal.set({ toExpNeg: -9e15, toExpPos: 9e15 });";
32
+ /**
33
+ * The Zod schema for a `decimal`.
34
+ *
35
+ * Deliberately has no output `.transform()`. `isRevalidatable` in codegen-operation treats every
36
+ * scalar as idempotent under re-parse — the assumption `server.validateResponses` rests on — and
37
+ * preprocess passes an already-`Decimal` value through untouched, so it holds.
38
+ *
39
+ * A raw JSON number fails validation rather than being coerced: by the time one reaches us it has
40
+ * already been through an IEEE-754 double, which is the loss this scalar exists to prevent. Bad
41
+ * strings are returned unchanged from preprocess rather than throwing, so they surface as an
42
+ * ordinary Zod issue instead of a `DecimalError` escaping the parse.
43
+ */
44
+ export declare const DECIMAL_ZOD_SCHEMA_LINE = "const _ZodDecimal = z.preprocess((val) => { if (typeof val !== 'string') return val; try { return new Decimal(val); } catch { return val; } }, z.custom<Decimal>((val) => Decimal.isDecimal(val), { message: 'Must be an exact decimal sent as a quoted string, e.g. \"1250.00\"' }));";
45
+ /** The decimal runtime for a file that also holds Zod schemas, in emission order. */
46
+ export declare const DECIMAL_PRELUDE_LINES: readonly string[];
47
+ //# sourceMappingURL=decimal-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decimal-runtime.d.ts","sourceRoot":"","sources":["../src/decimal-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,0CAA0C,CAAC;AAEtE;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,sDAAsD,CAAC;AAEvF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB,2RAAyR,CAAC;AAE9T,qFAAqF;AACrF,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAAmD,CAAC"}
package/dist/index.d.ts CHANGED
@@ -15,6 +15,15 @@ export interface ServerConfig {
15
15
  servicePathTemplate?: string;
16
16
  /** Whether to emit handlers for `internal` operations. Default true. */
17
17
  includeInternal?: boolean;
18
+ /**
19
+ * When true, each handler re-parses the service result through its declared response schema
20
+ * before writing `ctx.body`, and writes the parsed value. Requires `zod: true` — without it
21
+ * `output.types` emits plain interfaces, which are types with no runtime schema value.
22
+ *
23
+ * A body that transitively references a model with `format(input=...)`/`format(output=...)`, and
24
+ * a status whose several mimes carry different body types, are left unvalidated. Default false.
25
+ */
26
+ validateResponses?: boolean;
18
27
  }
19
28
  /** TypeScript SDK client output: the client class, per-area operation clients, and their types. */
20
29
  export interface SdkConfig {
@@ -33,7 +42,8 @@ export interface SdkConfig {
33
42
  * write-once: the files are created only when absent and are never overwritten or
34
43
  * cleaned up on later builds, so any edits you make to them are preserved.
35
44
  * Dependency ranges are derived from the contracts (always `zod` when `zod: true`;
36
- * `luxon` when any covered model uses a date/time/datetime/interval scalar).
45
+ * `luxon` when any covered model uses a date/time/datetime/duration/interval scalar;
46
+ * `decimal.js` when any uses a decimal).
37
47
  */
38
48
  scaffold?: boolean;
39
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACR,iBAAiB,EAQpB,MAAM,mBAAmB,CAAC;AA8C3B,gFAAgF;AAChF,MAAM,WAAW,YAAY;IACzB,wFAAwF;IACxF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6HAA6H;IAC7H,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE;QACL,8EAA8E;QAC9E,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,+EAA+E;QAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,wDAAwD;IACxD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,wEAAwE;IACxE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,mGAAmG;AACnG,MAAM,WAAW,SAAS;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE;QACL,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,sFAAsF;AACtF,MAAM,WAAW,SAAS;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,iGAAiG;AACjG,MAAM,WAAW,WAAW;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;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