@openkarta/sdk-node
v0.2.0
Published
Node 22+ SDK for OpenKarta v0.1.
Downloads
276
Readme
@openkarta/sdk-node
Node 22+ SDK for OpenKarta v0.1.
createServer({ handlers, secret })— Fastify app wiring the 8 protocol actions. Handlers throw{ code: ErrorCode }to produce deterministic error responses.createClient({ baseUrl, timeoutMs?, userToken?, fetchImpl? })— typed HTTP client wrapping all 8 verbs. Returns spec-typed values (CapabilitiesManifest,Quote,Order,Refund, …) and exposes the configuredbaseUrl. Failures raiseOpenKartaErrorwith{ code, httpStatus, message, details? }. Per-calltimeoutMsaborts long-running requests viaAbortController.signQuoteToken(payload, secret)/verifyQuoteToken(token, secret)— HMAC-SHA256, expiry-aware.toErrorResponse(code, message, retryable, details)— turn anErrorCodeinto a{ status, body }pair.
Install
pnpm add @openkarta/sdk-node @openkarta/spec zod fastify