Dashboard API client
State: open/verified · Kind: module · Audience: system
Summary
Section titled “Summary”- A typed TypeScript client for the SDLC dashboard’s JSON API, giving in-process consumers
compile-checked calls instead of hand-rolled
fetchplumbing. - Request/response types are generated from the server’s shared zod contract, so client and server shapes stay in lockstep under a codegen-drift gate.
Statement
Section titled “Statement”@sdlc/dashboard-client is the sole seam through which the dashboard SPA (and any other in-process
consumer) talks to the SDLC dashboard server: state reads, refresh, per-type entity browsing
(including the capability graph), sessions, and entity body writes all go through
createDashboardClient()’s typed methods, never a caller-assembled fetch. It is a library, not a
runnable unit — one importable package the SPA depends on, exporting no server or CLI surface of its
own.
What it provides
Section titled “What it provides”createDashboardClient(options)returning a typed client overGET /api/state,POST /api/refresh,GET /api/entities/:type[/:id],GET /api/capabilities/graph,GET /api/sessions, andPUT /api/entities/:type/:id/body.- Project-scoped reads/writes via an opaque
ProjectIdquery param, resolved server-side — no caller ever assembles a checkout path. - A
EntityBodySaveresult type that surfaces a lost compare-and-swap (409) or a contract-invalid edit (422) as typed values rather than thrown exceptions, distinct from genuine failures (4xx/5xx/dead server) which still throw. - Generated request/response types (
src/types.ts) kept honest against the server’s zod contract by acodegen-driftcheck.
Underlying implementation
Section titled “Underlying implementation”- packages/ts/dashboard-client/src/index.ts#createDashboardClient
- solutions/ontological/lib/services/dashboard/contract.ts (source-of-truth zod contract)
- solutions/ontological/lib/services/dashboard/gen-client.ts (generates src/types.ts)
Locations
Section titled “Locations”packages/ts/dashboard-client/