TypeScript SDK
@skadi/partner-sdk is the typed TypeScript wrapper around the
Partner API. Wire types are generated from
public/openapi.yaml via openapi-typescript;
the runtime client adds HMAC signing, OAuth Bearer support, automatic
Idempotency-Key generation, and RFC 7807 → typed error
mapping.
Current version: 0.1.0 — early
access. Published to GitHub Packages
(npm.pkg.github.com); see
Getting started for auth setup.
Install
npm install @skadi/partner-sdk Quick start
import { SkadiClient, SkadiApiError } from '@skadi/partner-sdk';
const skadi = new SkadiClient({
baseUrl: 'https://zsznsjvcluslttkxjhng.supabase.co/functions/v1',
apiVersion: '2026-04-25', // pin in production
auth: {
mode: 'hmac',
apiKey: process.env.SKADI_API_KEY!,
hmacSecret: process.env.SKADI_HMAC_SECRET!,
},
});
try {
const { data } = await skadi.POST('/rate-quote', {
body: {
account: { naicsClass: '236220', addressState: 'CA' },
towers: [{ lineType: 'GL', attachment: 1_000_000, limit: 4_000_000 }],
},
});
} catch (e) {
if (e instanceof SkadiApiError && e.slug === 'rate-limit-exceeded') {
await sleep((e.retryAfterSeconds ?? 60) * 1000);
}
} What it handles for you
| Concern | Auto |
|---|---|
Skadi-API-Version | From SkadiClientOptions.apiVersion |
| HMAC-SHA256 signing | auth.mode = 'hmac' — signs every request body, sets X-Timestamp and X-Signature |
| OAuth Bearer | auth.mode = 'oauth' — sets Authorization: Bearer <token> |
Idempotency-Key | UUIDv4 per POST (override or disable per call) |
| RFC 7807 problems | Thrown as SkadiApiError with .slug, .requestId, .retryAfterSeconds |
| Trace correlation | error.traceId carries W3C traceparent from the response |
Pinning the API version
Always pass apiVersion explicitly. Unpinned requests use
the carrier's current version, which may shift under you. The SDK's
generated types are pinned to the version in
public/openapi.yaml at build time.
Errors
All non-2xx responses throw SkadiApiError. The
.slug field is one of the values in
the problem-type catalog;
.requestId correlates to server logs;
.retryAfterSeconds is populated for 429 / 503.
The README in the repo
(apps/partner-sdk/README.md) carries the full surface,
including OAuth flow, custom fetch injection, and CI
pinning recipes.