Commit 50185f9
fix(node-sdk): protect hand-authored types from napi-rs regen churn
Before this commit, every `napi build` overwrote `index.d.ts` and
silently dropped the hand-added types (`ToolErrorKind`,
`VerificationStatus`, `VerificationCheck`, `VerificationReport`,
`ToolArtifact`). These types aren't generatable from Rust — they
describe JSON wire shapes whose field names must stay snake_case to
match the core's serialization, which napi-derive would auto-camelCase.
Reshape the SDK so generated and hand-authored types live in separate
files:
- napi build now writes to `generated.d.ts` (was `index.d.ts`).
- `extra-types.d.ts` holds the hand-authored types.
- `index.d.ts` becomes a small hand-authored aggregator that re-exports
both. It is never touched by the build.
- `package.json` `files[]` ships all three .d.ts files; `types` field
still points at `index.d.ts` so consumers' imports are unchanged.
Adds `test-types.ts` + `npm run test:types` as a tsc-based smoke check
that fails if the aggregator ever drops a type from either file.1 parent c8a77f9 commit 50185f9
5 files changed
Lines changed: 1624 additions & 1547 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
0 commit comments