Catalog npm
Back to packageRELEASE DETAILS

0.4.3

npm

@021.is/spine-http

Typed HTTP client base with resilience defaults (timeout, retry, circuit-break). TS twin of a proven Kotlin REST kit.

Published28 May 2026
Direct dependencies1
Transitive dependenciesNot calculated

README

Current package documentation

@021.is/spine-http

Typed fetch client with resilience defaults: per-request timeout, retry on idempotent failures, circuit breaker per host. Auto-unwraps ResponseDto envelopes from sibling packages.

Use

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}`);

Resilience defaults (tuned for service-to-service)

DefaultTunable
Timeout per request1000 mstimeoutMs
Retries on GET/HEAD/PUT/DELETE1retries
Circuit-break threshold5 failures in 10sfailureThreshold, windowMs
Retries on POST/PATCH0 (POST is non-idempotent by default)—

Circuit behavior

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.

ResponseDto unwrap

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.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 1

Native requirements
1 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
@021.is/spine-errors
Environment
{
  "local_name": "@021.is/spine-errors",
  "alias": false,
  "peer_metadata": null
}
^0.4.3runtime

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "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"
    }
  ]
}

Repository

PENDING
021is/spine-ts

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:00 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:2e58dd92549302a80409fb077e8527410b2d13ab54b56dc059d18eefdb4dfda4

Other collected versions

0.4.028 MayView all collected versions →