Skip to content

feat!: rewrite as modern TypeScript v2.0.0#202

Merged
bkaney merged 5 commits into
masterfrom
typescript-rewrite
Apr 29, 2026
Merged

feat!: rewrite as modern TypeScript v2.0.0#202
bkaney merged 5 commits into
masterfrom
typescript-rewrite

Conversation

@bkaney
Copy link
Copy Markdown
Member

@bkaney bkaney commented Apr 29, 2026

Summary

A complete ground-up rewrite of fhir-kit-client as native TypeScript ESM, targeting v2.0.0.


Breaking Changes

  • ESM only — CommonJS require() is no longer supported; all imports use .js extensions
  • PatchParams.JSONPatch renamed to PatchParams.jsonPatch (camelCase consistency)
  • Node.js ≥ 18 required
  • No separate @types/fhir-kit-client package needed — types are bundled

What's New

TypeScript Rewrite

  • Full native TypeScript source in src/ with strict mode
  • Complete type definitions for all public APIs
  • HttpMethod union type for stricter method typing
  • params?: T patterns replace unsafe = {} as T defaults
  • New exports: splitReference, SplitReference, SupportForParams, CapabilityWhere
  • Comprehensive JSDoc on all public Client and CapabilityTool methods

Tooling

  • Biome formatter/linter replaces ESLint
  • yarn.lock removed; project now uses npm
  • All packages updated to latest (vitest 4.x, TypeScript 6.x) — 0 audit vulnerabilities

CI/CD

  • Updated to actions/checkout@v4 and actions/setup-node@v4
  • Test matrix: Node 20 and 22
  • Pipeline: typecheckbuildformat:checklinttest

Documentation

  • README fully rewritten with TypeScript examples
  • Examples using @types/fhir and @reasonhealth/fhir-zod
  • All 4 example apps rewritten as ESM with full JSDoc

Tests

Test Files  6 passed (6)
     Tests  141 passed (141)

bkaney and others added 5 commits April 29, 2026 09:06
- TypeScript 5.x source in src/, compiled to dist/
- ESM only (type:module), Node >=18 required
- Native fetch, AbortController, URLSearchParams, no polyfills
- Replace Mocha/Chai/nock with Vitest + msw v2
- Drop deprecated positional headers params (v2 breaking change)
- Remove lib/ and types/, declarations generated by tsc
- 141 tests passing

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- README: complete rewrite covering v2 API, @types/fhir type guards,
  @reasonhealth/fhir-zod runtime validation, full API reference,
  and migration guide from v1
- examples/README.md: updated for ESM / Node 18+ setup
- All 4 example apps converted from CommonJS to ESM:
  - confidential-smart-ehr: simple-oauth2 v5 API, EHR launch
  - public-smart-ehr: same pattern without CLIENT_SECRET
  - smart-standalone: standalone launch with iss+scope query params
  - cds-hooks: native fetch replaces axios, express.json() replaces
    body-parser, CapabilityTool v2 supportFor() API
- All example package.json files updated: type module,
  current dep versions, no devDependencies

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add Biome for formatting/linting; remove ESLint config
- Add format, format:check, lint, check scripts to package.json
- Update CI workflow: actions v4, Node 20/22, npm ci, typecheck + build + format:check steps
- Rename JSONPatch → jsonPatch in PatchParams interface (idiomatic camelCase)
- Rename SearchParams_ → SearchCallParams, RequestParams → RawRequestParams
- Replace = {} as T anti-patterns in capability-tool.ts with params?: T
- Make FetchJob.resolving private with markResolving() accessor
- Convert numJobs to a getter in FetchQueue
- Fix baseUrl non-null assertion in reference-resolver.ts
- Add comprehensive JSDoc to all public Client and CapabilityTool methods
- Export SupportForParams, CapabilityWhere, splitReference, SplitReference from index.ts
- Update README patch example: JSONPatch → jsonPatch

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Update vitest 1.x → 4.x (fixes esbuild/vite moderate CVEs)
- Update @vitest/coverage-v8 to match vitest v4
- Update typescript 5.x → 6.x
- Update agentkeepalive, debug, @types/node, @types/debug to latest
- Fix brace-expansion, cross-spawn, minimatch ReDoS vulnerabilities (npm audit fix)
- Add types: ["node"] to tsconfig.json (required by TypeScript 6.x)

All 141 tests pass. npm audit: 0 vulnerabilities.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bkaney bkaney force-pushed the typescript-rewrite branch from 3a5a2ad to 61ec5be Compare April 29, 2026 13:07
@bkaney bkaney merged commit 62e8fad into master Apr 29, 2026
4 checks passed
@bkaney bkaney deleted the typescript-rewrite branch April 29, 2026 14:41
@bkaney bkaney restored the typescript-rewrite branch April 29, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant