Skip to content

feat(devex): add a typescript sdk package with a typed ledger client - #312

Merged
tiana-code merged 1 commit into
mainfrom
feat/E-09-typescript-sdk
Jun 19, 2026
Merged

feat(devex): add a typescript sdk package with a typed ledger client#312
tiana-code merged 1 commit into
mainfrom
feat/E-09-typescript-sdk

Conversation

@tiana-code

Copy link
Copy Markdown
Owner

E-09 DevEx #305 (F-09.3) - a TypeScript SDK package.

What

New sdk/typescript/, a hand-written typed fetch client over the REST API (isomorphic - node + browser via global fetch, zero runtime deps), mirroring the Kotlin SDK #304 and web/src/api/client.ts:

  • FincoreClient({baseUrl, token?, fetch?}): listAccounts(page,size) -> Page, getAccount(id) -> Account.
  • Bearer applied only when a token is set; id path segment encodeURIComponent'd; non-2xx -> FincoreError(status); injectable FetchFn for testability.
  • Types (Account/Page/AccountType/AccountStatus) mirror web/src/api/types.ts exactly.
  • package.json is private with NO publish script; a dedicated sdk-ts-ci.yml workflow (node 22) runs npm ci + typecheck + test + build only - nothing is pushed to a registry (§0-safe).

Hand-written over openapi-generator: no codegen toolchain, reviewable, clean-room. Scope is a minimal first surface; broader operations are a follow-up (pairs with #310).

Evidence (node v24 local)

npm run typecheck (covers src + test) clean; 4 vitest tests pass; npm run build emits src-only dist/*.d.ts.

Gate chain

  • code-reviewer: APPROVED with 1 must-fix - typecheck excluded test/; APPLIED (split tsconfig.build.json for src-only emit, base config typechecks src+test). Enabling it caught real test type errors (untyped mock fetch), now fixed via a typed FetchFn contract. Two LOW advisories declined with reason (node 22 matches the web-ci convention; exports field is YAGNI for a private package).
  • security-auditor (opus): PASS, zero must-fix - §0 no-publish confirmed at package + CI layers, no secrets (test bearer is a fake fixture), devDeps-only lockfile, encodeURIComponent blocks path injection, §5.3 clean, SPDX on all files.
  • evaluator: PASS (0.90).

Closes #305

Add sdk/typescript, a hand-written typed fetch client over the REST API
that works in node and the browser with no runtime dependencies. The
first surface covers the ledger account reads, with bearer auth applied
only when a token is set, the id path segment encoded, and a typed
FincoreError carrying the status on a non-2xx response. The package is
private with no publish script, so nothing is pushed to a registry, and
a dedicated workflow typechecks, tests and builds it. Types mirror the
web client exactly.

Closes #305
@tiana-code tiana-code added this to the v0.4.0 milestone Jun 19, 2026
@tiana-code
tiana-code merged commit 2ace2ab into main Jun 19, 2026
9 checks passed
@tiana-code
tiana-code deleted the feat/E-09-typescript-sdk branch June 19, 2026 19:03
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.

DevEx: TypeScript SDK package (generated from OpenAPI, no publish)

1 participant