@boy-offi9-inc/reqkit 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/package.json +1 -1
- package/assets/logo-wordmark.svg +0 -37
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="https://www.npmjs.com/package/@boy-offi9-inc/reqkit" aria-label="npm">
|
|
3
|
-
<img src="
|
|
3
|
+
<img src="https://i.ibb.co/1f63mDTg/logo-wordmark.png" alt="reqkit on npm" width="480" />
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
# reqkit
|
|
17
17
|
|
|
18
|
-
Small, composable HTTP helper functions. Not a client, not an axios replacement — works alongside `fetch`, `axios`, or anything else you're already using. Pull in the one function you need;
|
|
18
|
+
Small, composable HTTP helper functions. Not a client, not an axios replacement — works alongside `fetch`, `axios`, or anything else you're already using. Pull in the one function you need; ignore the rest.
|
|
19
19
|
|
|
20
20
|
```js
|
|
21
21
|
const { withRetry, normalizeError } = require("@boy-offi9-inc/reqkit");
|
|
@@ -27,11 +27,11 @@ const data = await withRetry(() => fetch(url).then(r => r.json()));
|
|
|
27
27
|
|
|
28
28
|
## Why this exists
|
|
29
29
|
|
|
30
|
-
Most HTTP retry/timeout wrappers bundle everything into a client you have to fully adopt. This is the opposite: standalone functions that compose with whatever you're already using, and a couple
|
|
30
|
+
Most HTTP retry/timeout wrappers bundle everything into a client you have to fully adopt. This is the opposite: standalone functions that compose with whatever you're already using, and a couple of small helpers that you can pick up independently.
|
|
31
31
|
|
|
32
|
-
**Honest note:** `withRetry`, `withTimeout`, and `normalizeError` solve a well-covered problem — there are other solid packages doing similar things (`fetchy`, `fetchpilot`, `p-retry`, to name a
|
|
32
|
+
**Honest note:** `withRetry`, `withTimeout`, and `normalizeError` solve a well-covered problem — there are other solid packages doing similar things (`fetchy`, `fetchpilot`, `p-retry`, to name a few).
|
|
33
33
|
|
|
34
|
-
- **`retryAfterAware`** — actually reads `Retry-After`/`X-RateLimit-Reset` headers instead of blind backoff on 429s. Most retry libraries treat rate-limit responses like any other failure and
|
|
34
|
+
- **`retryAfterAware`** — actually reads `Retry-After`/`X-RateLimit-Reset` headers instead of blind backoff on 429s. Most retry libraries treat rate-limit responses like any other failure and ignore the server's suggested retry time.
|
|
35
35
|
- **`withProgress`** — progress callback for any streamed response body (downloads, large payloads, anything), not tied to a specific HTTP client.
|
|
36
36
|
|
|
37
37
|
Zero dependencies. CJS + ESM. TypeScript types included.
|
|
@@ -138,7 +138,7 @@ const bytes = await withProgress(response, ({ loaded, total, percent }) => {
|
|
|
138
138
|
});
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
Works without `Content-Length` too — `total`/`percent` are just `null` in that case, `loaded` is still accurate. Falls back to a single-shot read (still calling `onProgress` once) if the
|
|
141
|
+
Works without `Content-Length` too — `total`/`percent` are just `null` in that case, `loaded` is still accurate. Falls back to a single-shot read (still calling `onProgress` once) if the response body is not a stream.
|
|
142
142
|
|
|
143
143
|
---
|
|
144
144
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boy-offi9-inc/reqkit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Small, composable HTTP helper functions — retry with backoff, timeouts, normalized errors, safe JSON parsing, rate-limit-aware retry, and download progress. Not a client, works alongside fetch/axios/anything.",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./types/index.d.ts",
|
package/assets/logo-wordmark.svg
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<svg width="640" height="160" viewBox="0 0 640 160" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<defs>
|
|
4
|
-
<linearGradient id="wm-bg" x1="0" y1="0" x2="640" y2="160" gradientUnits="userSpaceOnUse">
|
|
5
|
-
<stop offset="0" stop-color="#101825"/>
|
|
6
|
-
<stop offset="1" stop-color="#080c14"/>
|
|
7
|
-
</linearGradient>
|
|
8
|
-
<linearGradient id="wm-icon-bg" x1="0" y1="0" x2="240" y2="240" gradientUnits="userSpaceOnUse">
|
|
9
|
-
<stop offset="0" stop-color="#16202e"/>
|
|
10
|
-
<stop offset="1" stop-color="#0c121c"/>
|
|
11
|
-
</linearGradient>
|
|
12
|
-
<linearGradient id="wm-arc" x1="175" y1="88" x2="98" y2="60" gradientUnits="userSpaceOnUse">
|
|
13
|
-
<stop offset="0" stop-color="#3d8bff"/>
|
|
14
|
-
<stop offset="1" stop-color="#ffb43d"/>
|
|
15
|
-
</linearGradient>
|
|
16
|
-
</defs>
|
|
17
|
-
|
|
18
|
-
<rect x="0" y="0" width="640" height="160" rx="20" fill="url(#wm-bg)"/>
|
|
19
|
-
|
|
20
|
-
<!-- icon, scaled down from the 240x240 mark -->
|
|
21
|
-
<g transform="translate(24,20) scale(0.5)">
|
|
22
|
-
<rect x="6" y="6" width="228" height="228" rx="46" fill="url(#wm-icon-bg)"/>
|
|
23
|
-
|
|
24
|
-
<path d="M 175.4 88 A 64 64 0 1 1 98.1 59.9"
|
|
25
|
-
fill="none" stroke="url(#wm-arc)" stroke-width="13" stroke-linecap="round"/>
|
|
26
|
-
|
|
27
|
-
<polygon points="113.1,54.4 103.1,67.7 96.9,50.8" fill="#ffb43d"/>
|
|
28
|
-
|
|
29
|
-
<circle cx="169" cy="161.1" r="7" fill="#3d8bff"/>
|
|
30
|
-
<circle cx="78.9" cy="169" r="6" fill="#6f9fff"/>
|
|
31
|
-
<circle cx="59.9" cy="98.1" r="5" fill="#a3c2ff"/>
|
|
32
|
-
</g>
|
|
33
|
-
|
|
34
|
-
<!-- wordmark -->
|
|
35
|
-
<text x="164" y="82" font-family="'JetBrains Mono', 'Courier New', monospace" font-size="42" font-weight="700" fill="#eef2f7">req<tspan fill="#ffb43d">kit</tspan></text>
|
|
36
|
-
<text x="165" y="112" font-family="'JetBrains Mono', 'Courier New', monospace" font-size="16" fill="#6b7688">HTTP helpers — retry, timeout, rate-limit aware</text>
|
|
37
|
-
</svg>
|