@sharptrick/parley-net-util
v0.8.0
Published
@sharptrick/parley-net-util — tiny internal HTTP helper (fetchWithRetry + delay) shared by the HTTP chat backends. NOT bridge-core: keeps the seam HTTP-free for SQLite/Redis/NATS/Postgres. Lockstep-published with the rest of Parley (semantic-release, no h
Maintainers
Readme
@sharptrick/parley-net-util
A tiny internal HTTP helper shared by Parley's HTTP chat backends (Zulip, Matrix, Discord, Telegram, Slack). It exports exactly two things:
fetchWithRetry(url, init, opts)— the onefetch+ 429-retry loop. The caller passes a fully-formedinit(auth headers + encoded body + optionalsignal); the helper retries429by honoring the caller'sretryAfterOf(res)parser, stops the momentisStopped()is true, returns theResponseonok/allowStatuses, and otherwise throws<label> → <status>: <text>.delay(ms)— asetTimeoutpromise (the single copy that replaces the per-plugin duplicates).
Why this is not bridge-core
bridge-core is a dependency-free seam that the non-HTTP backends (SQLite, Redis, NATS, Postgres)
consume without any HTTP concerns. The retry loop lives here instead so core stays HTTP-free.
Per-backend specifics that genuinely differ — auth-header building, body encoding, the
Retry-After parser, and transport response shapes (Slack's ok:false envelope, XMPP IQ) —
stay in each plugin. Only the loop/guard/cap/default/stopped semantics are shared.
Releases
This is a lockstep-published package: semantic-release publishes it alongside every other Parley
package. Do not hand-edit its version.
