Observed since 20 Oct, 22:00 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
@021.is/spine-http
Typed HTTP client base with resilience defaults (timeout, retry, circuit-break). TS twin of a proven Kotlin REST kit.
Typed fetch client with resilience defaults: per-request timeout, retry on idempotent failures, circuit breaker per host. Auto-unwraps ResponseDto envelopes from sibling packages.
import { SpineHttpClient } from "@021.is/spine-http";
const dcEvents = new SpineHttpClient({
baseUrl: "https://api.example.com",
timeoutMs: 1000, // default
retries: 1, // default — retries idempotent methods only
failureThreshold: 5, // default — open circuit after 5 fails in 10s
windowMs: 10_000,
defaultHeaders: { "x-service": "my-app" },
authToken: async () => mintServiceJwt(), // optional
});
// Auto-unwraps ResponseDto<Event> if peer is your service
const event = await dcEvents.get<Event>(`/events/${id}`);
| Default | Tunable | |
|---|---|---|
| Timeout per request | 1000 ms | timeoutMs |
| Retries on GET/HEAD/PUT/DELETE | 1 | retries |
| Circuit-break threshold | 5 failures in 10s | failureThreshold, windowMs |
| Retries on POST/PATCH | 0 (POST is non-idempotent by default) | — |
After failureThreshold failures within windowMs, the circuit opens for the remainder of windowMs. New requests fail fast with circuit open — Xs remaining until the window expires, then probe-mode resumes.
If peer returns { success, data, code, ... } shape (i.e., they use spine-errors), the client unwraps and returns data directly. If success: false, throws an Error carrying code + errorKey.
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
@021.is/spine-errorsEnvironment{
"local_name": "@021.is/spine-errors",
"alias": false,
"peer_metadata": null
} | ^0.4.3 | runtime |
Source distribution
{
"integrity": "sha512-H/Cjh32/Gvf7aIM4aVQrQWHTk/2CEK9WN8u/h/kV9OzdlmNKIFHHR4q99k3gjBTS5HU7Y8KsQzTCJPznrvDmBA==",
"shasum": "aa4865ab8c52e1bee0eba296fedb91a1c4038b5a",
"tarball": "https://registry.npmjs.org/@021.is/spine-http/-/spine-http-0.4.3.tgz",
"fileCount": 5,
"unpackedSize": 10141,
"signatures": [
{
"keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U",
"sig": "MEYCIQCEr7QcOBbH0mx0Rd0OqtzKzAYGcTEDUiSTkbBwceRYCwIhAI9hSXkShsKQY9T+Gdd7aXPZxYQpwBsaraBJ4EDPtd19"
}
]
}Observed since 20 Oct, 22:00 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:2e58dd92549302a80409fb077e8527410b2d13ab54b56dc059d18eefdb4dfda4