Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@contractkit/plugin-typescript

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contractkit/plugin-typescript - npm Package Compare versions

Comparing version
0.23.0
to
0.23.1
+6
-6
.turbo/turbo-build$colon$ci.log
> @contractkit/plugin-typescript@0.23.0 build:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-typescript
> @contractkit/plugin-typescript@0.23.1 build:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-typescript
> eslint --max-warnings=0 && pnpm run build
> @contractkit/plugin-typescript@0.23.0 build /home/runner/work/ContractKit/ContractKit/packages/plugin-typescript
> @contractkit/plugin-typescript@0.23.1 build /home/runner/work/ContractKit/ContractKit/packages/plugin-typescript
> tsup src/index.ts --format esm --sourcemap --dts && tsc --emitDeclarationOnly --declaration

@@ -14,7 +14,7 @@

ESM Build start
ESM dist/index.js 149.58 KB
ESM dist/index.js.map 326.20 KB
ESM ⚡️ Build success in 341ms
ESM dist/index.js 149.66 KB
ESM dist/index.js.map 326.35 KB
ESM ⚡️ Build success in 367ms
DTS Build start
DTS ⚡️ Build success in 4515ms
DTS ⚡️ Build success in 6065ms
DTS dist/index.d.ts 1.82 KB
> @contractkit/plugin-typescript@0.23.0 test:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-typescript
> @contractkit/plugin-typescript@0.23.1 test:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-typescript
> vitest run --coverage

@@ -9,13 +9,13 @@

✓ tests/codegen-contract.test.ts (124 tests) 100ms
✓ tests/codegen-sdk.test.ts (132 tests) 143ms
✓ tests/codegen-operation.test.ts (88 tests) 53ms
✓ tests/codegen-plain-types.test.ts (61 tests) 32ms
✓ tests/codegen-server.test.ts (19 tests) 36ms
✓ tests/pipeline.test.ts (25 tests) 186ms
✓ tests/codegen-contract.test.ts (125 tests) 78ms
✓ tests/codegen-sdk.test.ts (132 tests) 128ms
✓ tests/codegen-operation.test.ts (88 tests) 109ms
✓ tests/codegen-plain-types.test.ts (61 tests) 62ms
✓ tests/codegen-server.test.ts (19 tests) 88ms
✓ tests/pipeline.test.ts (25 tests) 277ms
 Test Files  6 passed (6)
 Tests  449 passed (449)
 Start at  12:06:49
 Duration  6.12s (transform 4.90s, setup 0ms, import 11.76s, tests 549ms, environment 20ms)
 Tests  450 passed (450)
 Start at  14:28:27
 Duration  6.25s (transform 3.59s, setup 0ms, import 11.84s, tests 741ms, environment 3ms)

@@ -26,5 +26,5 @@  % Coverage report from v8

-------------------|---------|----------|---------|---------|-------------------
All files | 79.96 | 75.1 | 83.5 | 82.57 |
src | 79.75 | 74.78 | 83.06 | 82.33 |
...n-contract.ts | 87.83 | 82.12 | 90.08 | 88.96 | ...1069,1074-1075
All files | 79.97 | 75.13 | 83.5 | 82.58 |
src | 79.75 | 74.81 | 83.06 | 82.34 |
...n-contract.ts | 87.85 | 82.2 | 90.08 | 88.98 | ...1070,1075-1076
...-operation.ts | 78.13 | 74.26 | 77.77 | 79.69 | ...69-680,685-686

@@ -31,0 +31,0 @@ ...lain-types.ts | 89.08 | 78.37 | 96.66 | 92.3 | ...31,243,249,301

# @contractkit/contractkit-plugin-typescript
## 0.23.1
### Patch Changes
- 22c4a0b: Coerce `null` to `undefined` for optional fields in model-level `format(input=...)` / `format(output=...)` transforms, matching the existing behavior for inline objects.
## 0.23.0

@@ -4,0 +10,0 @@

@@ -26,5 +26,5 @@

<div class='fl pad1y space-right2'>
<span class="strong">79.96% </span>
<span class="strong">79.97% </span>
<span class="quiet">Statements</span>
<span class='fraction'>2028/2536</span>
<span class='fraction'>2029/2537</span>
</div>

@@ -34,5 +34,5 @@

<div class='fl pad1y space-right2'>
<span class="strong">75.1% </span>
<span class="strong">75.13% </span>
<span class="quiet">Branches</span>
<span class='fraction'>1228/1635</span>
<span class='fraction'>1230/1637</span>
</div>

@@ -49,5 +49,5 @@

<div class='fl pad1y space-right2'>
<span class="strong">82.57% </span>
<span class="strong">82.58% </span>
<span class="quiet">Lines</span>
<span class='fraction'>1777/2152</span>
<span class='fraction'>1778/2153</span>
</div>

@@ -90,9 +90,9 @@

<td data-value="79.75" class="pct medium">79.75%</td>
<td data-value="2484" class="abs medium">1981/2484</td>
<td data-value="74.78" class="pct medium">74.78%</td>
<td data-value="1602" class="abs medium">1198/1602</td>
<td data-value="2485" class="abs medium">1982/2485</td>
<td data-value="74.81" class="pct medium">74.81%</td>
<td data-value="1604" class="abs medium">1200/1604</td>
<td data-value="83.06" class="pct high">83.06%</td>
<td data-value="372" class="abs high">309/372</td>
<td data-value="82.33" class="pct high">82.33%</td>
<td data-value="2106" class="abs high">1734/2106</td>
<td data-value="82.34" class="pct high">82.34%</td>
<td data-value="2107" class="abs high">1735/2107</td>
</tr>

@@ -123,3 +123,3 @@

<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-05-12T12:06:55.452Z
at 2026-05-12T14:28:33.558Z
</div>

@@ -126,0 +126,0 @@ <script src="prettify.js"></script>

@@ -985,3 +985,3 @@

<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-05-12T12:06:55.452Z
at 2026-05-12T14:28:33.558Z
</div>

@@ -988,0 +988,0 @@ <script src="../prettify.js"></script>

@@ -28,3 +28,3 @@

<span class="quiet">Statements</span>
<span class='fraction'>1981/2484</span>
<span class='fraction'>1982/2485</span>
</div>

@@ -34,5 +34,5 @@

<div class='fl pad1y space-right2'>
<span class="strong">74.78% </span>
<span class="strong">74.81% </span>
<span class="quiet">Branches</span>
<span class='fraction'>1198/1602</span>
<span class='fraction'>1200/1604</span>
</div>

@@ -49,5 +49,5 @@

<div class='fl pad1y space-right2'>
<span class="strong">82.33% </span>
<span class="strong">82.34% </span>
<span class="quiet">Lines</span>
<span class='fraction'>1734/2106</span>
<span class='fraction'>1735/2107</span>
</div>

@@ -86,13 +86,13 @@

<td class="file high" data-value="codegen-contract.ts"><a href="codegen-contract.ts.html">codegen-contract.ts</a></td>
<td data-value="87.83" class="pic high">
<td data-value="87.85" class="pic high">
<div class="chart"><div class="cover-fill" style="width: 87%"></div><div class="cover-empty" style="width: 13%"></div></div>
</td>
<td data-value="87.83" class="pct high">87.83%</td>
<td data-value="674" class="abs high">592/674</td>
<td data-value="82.12" class="pct high">82.12%</td>
<td data-value="470" class="abs high">386/470</td>
<td data-value="87.85" class="pct high">87.85%</td>
<td data-value="675" class="abs high">593/675</td>
<td data-value="82.2" class="pct high">82.2%</td>
<td data-value="472" class="abs high">388/472</td>
<td data-value="90.08" class="pct high">90.08%</td>
<td data-value="121" class="abs high">109/121</td>
<td data-value="88.96" class="pct high">88.96%</td>
<td data-value="553" class="abs high">492/553</td>
<td data-value="88.98" class="pct high">88.98%</td>
<td data-value="554" class="abs high">493/554</td>
</tr>

@@ -198,3 +198,3 @@

<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-05-12T12:06:55.452Z
at 2026-05-12T14:28:33.558Z
</div>

@@ -201,0 +201,0 @@ <script src="../prettify.js"></script>

@@ -733,3 +733,3 @@

<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-05-12T12:06:55.452Z
at 2026-05-12T14:28:33.558Z
</div>

@@ -736,0 +736,0 @@ <script src="../prettify.js"></script>

@@ -580,3 +580,3 @@

<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-05-12T12:06:55.452Z
at 2026-05-12T14:28:33.558Z
</div>

@@ -583,0 +583,0 @@ <script src="../prettify.js"></script>

@@ -344,7 +344,7 @@

<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">892x</span>
<span class="cline-any cline-yes">895x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">318x</span>
<span class="cline-any cline-yes">320x</span>
<span class="cline-any cline-neutral">&nbsp;</span>

@@ -393,3 +393,3 @@ <span class="cline-any cline-neutral">&nbsp;</span>

<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">257x</span>
<span class="cline-any cline-yes">259x</span>
<span class="cline-any cline-neutral">&nbsp;</span>

@@ -406,3 +406,3 @@ <span class="cline-any cline-neutral">&nbsp;</span>

<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">178x</span>
<span class="cline-any cline-yes">179x</span>
<span class="cline-any cline-neutral">&nbsp;</span>

@@ -417,3 +417,3 @@ <span class="cline-any cline-neutral">&nbsp;</span>

<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">137x</span>
<span class="cline-any cline-yes">138x</span>
<span class="cline-any cline-neutral">&nbsp;</span>

@@ -818,3 +818,3 @@ <span class="cline-any cline-neutral">&nbsp;</span>

<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-05-12T12:06:55.452Z
at 2026-05-12T14:28:33.558Z
</div>

@@ -821,0 +821,0 @@ <script src="../prettify.js"></script>

@@ -104,3 +104,3 @@

<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-05-12T12:06:55.452Z
at 2026-05-12T14:28:33.558Z
</div>

@@ -107,0 +107,0 @@ <script src="../prettify.js"></script>

@@ -1,1 +0,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;;;;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,EAA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AAE,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"}
{
"name": "@contractkit/plugin-typescript",
"version": "0.23.0",
"version": "0.23.1",
"description": "ContractKit built-in plugin: TypeScript codegen (SDK clients, Koa routers, Zod schemas, plain types)",

@@ -5,0 +5,0 @@ "author": {

@@ -303,3 +303,4 @@ import { relative, dirname } from 'node:path';

const outputKey = applyCase(field.name, outputCase);
lines.push(` ${quoteKey(outputKey)}: data.${inputKey},`);
const val = field.optional ? `data.${inputKey} ?? undefined` : `data.${inputKey}`;
lines.push(` ${quoteKey(outputKey)}: ${val},`);
}

@@ -306,0 +307,0 @@ lines.push(`}));`);

@@ -1063,7 +1063,21 @@ import { generateContract, renderType } from '../src/codegen-contract.js';

expect(output).toContain('grantType: data.grant_type');
expect(output).toContain('clientId: data.client_id');
expect(output).toContain('clientId: data.client_id ?? undefined');
expect(output).toContain('clientSecret: data.client_secret');
expect(output).toContain('export type Child = z.output<typeof Child>');
});
it('input=snake: optional fields coerce null → undefined in the transform', () => {
const root = contractRoot([
model(
'User',
[field('firstName', scalarType('string')), field('clientId', scalarType('uuid'), { optional: true })],
{ inputCase: 'snake' },
),
]);
const output = generateContract(root);
expect(output).toContain('client_id: z.uuid().nullish()');
expect(output).toContain('firstName: data.first_name,');
expect(output).toContain('clientId: data.client_id ?? undefined,');
});
});
});

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display