🚨 Breaking Changes
- client/misina: Instance-only API, drop flat option re-exports - by @productdevbook in #32 (3fe73)
The misina client link no longer accepts misina options (retry, timeout, hooks, idempotencyKey, validateResponse, redirect*, etc.) directly. Configure those on a Misina instance and pass it via the new misina field. Per misina#108, this is the recommended adapter pattern going forward.
Migration
// before
import { createLink } from 'silgi/client/misina'
createLink({
url,
retry: 3,
timeout: 5000,
idempotencyKey: 'auto',
beforeRetry: refreshToken,
})
// after
import { createMisina } from 'misina'
import { createLink } from 'silgi/client/misina'
createLink({
url,
misina: createMisina({
retry: 3,
timeout: 5000,
idempotencyKey: 'auto',
hooks: { beforeRetry: refreshToken },
}),
})Plugin composition is now first-class
import { createMisina } from 'misina'
import { cache } from 'misina/cache'
import { breaker } from 'misina/breaker'
import { bearer, refreshOn401 } from 'misina/auth'
createLink({
url,
misina: createMisina({
baseURL: url,
retry: 3,
use: [
bearer(() => store.token),
refreshOn401({ refresh: getNewToken }),
cache({ ttl: 60_000 }),
breaker({ failureThreshold: 5, windowMs: 30_000 }),
],
}),
})What the adapter still owns
- URL construction from path tuples
- Protocol negotiation (json / messagepack / devalue)
- Per-call
responseType: 'stream'override (SSE branching) - Per-call
throwHttpErrors: falseoverride (SilgiErrorlift) SilgiErrorlifting from response payloads + misina error mapping
Why
The hybrid surface had three costs the adapter couldn't mitigate: drift on every misina release (every new option had to be re-exported manually), plugins were unreachable from flat options (use: [...] is the only way to compose cache / breaker / dedupe / cookies / auth / otel / tracing), and "two ways to do the same thing" forced duplicated documentation.
Stats
- Adapter source: ~250 → ~110 LOC of code
- Generated
.d.mts: ~150 → 41 lines - Tests: 26 → 14 (focused on adapter-only concerns; misina's suite owns retry/timeout/idempotency/validateResponse coverage)
- Bumps
misina:^0.2.0→^0.4.0