@scirexs/fetchy 0.7.0 → 0.8.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 +57 -116
- package/esm/main.js +1 -1
- package/esm/mod.js +1 -1
- package/package.json +1 -1
- package/types/main.d.ts +46 -125
- package/types/main.d.ts.map +1 -1
- package/types/mod.d.ts +1 -1
- package/types/mod.d.ts.map +1 -1
- package/types/types.d.ts +161 -0
- package/types/types.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
[](https://jsr.io/@scirexs/fetchy)
|
|
5
5
|
[](https://github.com/scirexs/fetchy/blob/main/LICENSE)
|
|
6
6
|
|
|
7
|
-
A lightweight
|
|
7
|
+
A lightweight thin fetch wrapper with built-in retry logic, timeout handling, and automatic body parsing. Works in Deno, Node.js, and modern browsers.
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
|
-
- **Lightweight** - Bundle size is ~5KB uncompressed, ~2KB gzipped, zero dependencies
|
|
12
11
|
- **Simple API** - Drop-in replacement for native fetch with enhanced capabilities
|
|
12
|
+
- **Lightweight** - Bundle size is ~5KB uncompressed, ~2KB gzipped, zero dependencies
|
|
13
|
+
- **Native Fetch Compatible** - Thin abstraction layer, easy migration back to native fetch
|
|
13
14
|
- **Promise-like Interface** - Chain parsing methods directly on fetch results
|
|
14
15
|
- **Timeout Support** - Configurable request timeouts with automatic cancellation
|
|
15
16
|
- **Retry Logic** - Exponential backoff with Retry-After header support
|
|
@@ -30,7 +31,7 @@ deno add jsr:@scirexs/fetchy
|
|
|
30
31
|
|
|
31
32
|
## Quick Start
|
|
32
33
|
```ts
|
|
33
|
-
import { fetchy, sfetchy,
|
|
34
|
+
import { fetchy, sfetchy, fy } from "@scirexs/fetchy";
|
|
34
35
|
|
|
35
36
|
// Simple GET request with automatic JSON parsing
|
|
36
37
|
const user = await fetchy("https://api.example.com/user/1").json<User>();
|
|
@@ -105,10 +106,10 @@ Same as `fetchy()`.
|
|
|
105
106
|
|
|
106
107
|
- `text()` → `Promise<string | null>` - Safe text parsing (returns null on error)
|
|
107
108
|
- `json<T>()` → `Promise<T | null>` - Safe JSON parsing (returns null on error)
|
|
108
|
-
- `bytes()` → `Promise<Uint8Array | null>` - Safe bytes parsing
|
|
109
|
-
- `blob()` → `Promise<Blob | null>` - Safe blob parsing
|
|
110
|
-
- `arrayBuffer()` → `Promise<ArrayBuffer | null>` - Safe buffer parsing
|
|
111
|
-
- `formData()` → `Promise<FormData | null>` - Safe form data parsing
|
|
109
|
+
- `bytes()` → `Promise<Uint8Array | null>` - Safe bytes parsing (returns null on error)
|
|
110
|
+
- `blob()` → `Promise<Blob | null>` - Safe blob parsing (returns null on error)
|
|
111
|
+
- `arrayBuffer()` → `Promise<ArrayBuffer | null>` - Safe buffer parsing (returns null on error)
|
|
112
|
+
- `formData()` → `Promise<FormData | null>` - Safe form data parsing (returns null on error)
|
|
112
113
|
|
|
113
114
|
#### Example
|
|
114
115
|
```ts
|
|
@@ -127,51 +128,46 @@ if (data !== null) {
|
|
|
127
128
|
}
|
|
128
129
|
```
|
|
129
130
|
|
|
130
|
-
### `
|
|
131
|
+
### `fy(options?)`
|
|
131
132
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
#### Constructor
|
|
135
|
-
```ts
|
|
136
|
-
const client = new Fetchy(options?: FetchyOptions);
|
|
137
|
-
```
|
|
133
|
+
Creates a fluent HTTP client with pre-configured options that provides HTTP method shortcuts.
|
|
138
134
|
|
|
139
|
-
####
|
|
135
|
+
#### Client Methods
|
|
140
136
|
```ts
|
|
141
|
-
const client =
|
|
137
|
+
const client = fy(options);
|
|
142
138
|
|
|
143
139
|
// Main fetch method
|
|
144
|
-
await client.fetch(url?)
|
|
140
|
+
await client.fetch(url?, options?) // Returns FetchyResponse
|
|
145
141
|
|
|
146
142
|
// HTTP method shortcuts
|
|
147
|
-
await client.get(url?)
|
|
148
|
-
await client.post(url?)
|
|
149
|
-
await client.put(url?)
|
|
150
|
-
await client.patch(url?)
|
|
151
|
-
await client.delete(url?)
|
|
152
|
-
await client.head(url?)
|
|
143
|
+
await client.get(url?, options?) // GET request, returns FetchyResponse
|
|
144
|
+
await client.post(url?, options?) // POST request, returns FetchyResponse
|
|
145
|
+
await client.put(url?, options?) // PUT request, returns FetchyResponse
|
|
146
|
+
await client.patch(url?, options?) // PATCH request, returns FetchyResponse
|
|
147
|
+
await client.delete(url?, options?) // DELETE request, returns FetchyResponse
|
|
148
|
+
await client.head(url?, options?) // HEAD request, returns Promise<Response>
|
|
153
149
|
|
|
154
150
|
// Safe mode methods
|
|
155
|
-
await client.
|
|
156
|
-
await client.sget(url?)
|
|
157
|
-
await client.spost(url?)
|
|
158
|
-
await client.sput(url?)
|
|
159
|
-
await client.spatch(url?)
|
|
160
|
-
await client.sdelete(url?)
|
|
161
|
-
await client.shead(url?)
|
|
151
|
+
await client.sfetch(url?, options?) // Returns FetchySafeResponse
|
|
152
|
+
await client.sget(url?, options?) // Safe GET, returns FetchySafeResponse
|
|
153
|
+
await client.spost(url?, options?) // Safe POST, returns FetchySafeResponse
|
|
154
|
+
await client.sput(url?, options?) // Safe PUT, returns FetchySafeResponse
|
|
155
|
+
await client.spatch(url?, options?) // Safe PATCH, returns FetchySafeResponse
|
|
156
|
+
await client.sdelete(url?, options?) // Safe DELETE, returns FetchySafeResponse
|
|
157
|
+
await client.shead(url?, options?) // Safe HEAD, returns Promise<Response | null>
|
|
162
158
|
```
|
|
163
159
|
|
|
164
160
|
All methods can be chained with parsing methods:
|
|
165
161
|
```ts
|
|
166
162
|
await client.get("/users").json<User[]>();
|
|
167
163
|
await client.post("/create").json<Result>();
|
|
168
|
-
await client.
|
|
164
|
+
await client.sfetch("/data").text();
|
|
169
165
|
```
|
|
170
166
|
|
|
171
167
|
#### Example
|
|
172
168
|
```ts
|
|
173
169
|
// Instance usage - reuse configuration
|
|
174
|
-
const client =
|
|
170
|
+
const client = fy({
|
|
175
171
|
base: "https://api.example.com",
|
|
176
172
|
bearer: "token123",
|
|
177
173
|
timeout: 10,
|
|
@@ -193,24 +189,23 @@ if (data !== null) {
|
|
|
193
189
|
}
|
|
194
190
|
```
|
|
195
191
|
|
|
196
|
-
### `
|
|
192
|
+
### `setFetchy(options)`
|
|
197
193
|
|
|
198
|
-
|
|
199
|
-
```ts
|
|
200
|
-
const client = fy({
|
|
201
|
-
base: "https://api.example.com",
|
|
202
|
-
bearer: "token"
|
|
203
|
-
});
|
|
194
|
+
Sets global default options for all fetchy instances.
|
|
204
195
|
|
|
205
|
-
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
Equivalent to:
|
|
196
|
+
#### Example
|
|
209
197
|
```ts
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
198
|
+
import { setFetchy, fetchy } from "@scirexs/fetchy";
|
|
199
|
+
|
|
200
|
+
// Set global defaults
|
|
201
|
+
setFetchy({
|
|
202
|
+
timeout: 30,
|
|
203
|
+
retry: { maxAttempts: 5 },
|
|
204
|
+
bearer: "global-token"
|
|
213
205
|
});
|
|
206
|
+
|
|
207
|
+
// All subsequent requests use these defaults
|
|
208
|
+
await fetchy("https://api.example.com/data");
|
|
214
209
|
```
|
|
215
210
|
|
|
216
211
|
## Configuration
|
|
@@ -329,7 +324,7 @@ if (response === null) {
|
|
|
329
324
|
}
|
|
330
325
|
|
|
331
326
|
// Safe parsing methods - return null on error
|
|
332
|
-
const data = await
|
|
327
|
+
const data = await sfetchy("https://api.example.com/data").json<Data>();
|
|
333
328
|
if (data !== null) {
|
|
334
329
|
// Process data
|
|
335
330
|
}
|
|
@@ -348,6 +343,19 @@ if (!response.ok) {
|
|
|
348
343
|
}
|
|
349
344
|
```
|
|
350
345
|
|
|
346
|
+
## Compatibility with Native Fetch
|
|
347
|
+
|
|
348
|
+
Designed for easy migration back to native `fetch` if needed, minimizing maintenance risk.
|
|
349
|
+
```ts
|
|
350
|
+
// If this library is discontinued, simply delete these declarations
|
|
351
|
+
// to fall back to native fetch with minimal code changes.
|
|
352
|
+
// import { fetchy as fetch, setFetchy } from "@scirexs/fetchy";
|
|
353
|
+
// setFetchy({ native: true });
|
|
354
|
+
|
|
355
|
+
const options: RequestInit = { method: "POST", body: "hello" };
|
|
356
|
+
const response = await fetch("https://api.example.com/data", options);
|
|
357
|
+
```
|
|
358
|
+
|
|
351
359
|
## Usage Examples
|
|
352
360
|
|
|
353
361
|
### Basic Requests
|
|
@@ -562,10 +570,10 @@ const data = await fetchy("https://api.example.com/rate-limited", {
|
|
|
562
570
|
retry: {
|
|
563
571
|
maxAttempts: 5,
|
|
564
572
|
interval: 1, // Minimum interval if header not present
|
|
565
|
-
respectHeaders: ["retry-after", "ratelimit-reset"]
|
|
573
|
+
respectHeaders: ["retry-after", "ratelimit-reset", "x-rateLimit-reset", "x-my-retry-after"]
|
|
566
574
|
}
|
|
567
575
|
}).json();
|
|
568
|
-
// If response has "Retry-After: 10", will wait 10 seconds before retry
|
|
576
|
+
// If response has "X-My-Retry-After: 10", will wait 10 seconds before retry
|
|
569
577
|
```
|
|
570
578
|
|
|
571
579
|
### Type-Safe API Responses
|
|
@@ -598,73 +606,6 @@ if (result !== null && result.success) {
|
|
|
598
606
|
}
|
|
599
607
|
```
|
|
600
608
|
|
|
601
|
-
## Best Practices
|
|
602
|
-
|
|
603
|
-
### 1. Use Base URL for API Clients
|
|
604
|
-
```ts
|
|
605
|
-
const api = fy({
|
|
606
|
-
base: "https://api.example.com",
|
|
607
|
-
bearer: process.env.API_TOKEN,
|
|
608
|
-
timeout: 10
|
|
609
|
-
});
|
|
610
|
-
|
|
611
|
-
// All requests are relative to base
|
|
612
|
-
await api.get("/users").json();
|
|
613
|
-
await api.post("/posts", { body: data }).json();
|
|
614
|
-
```
|
|
615
|
-
|
|
616
|
-
### 2. Choose Safe vs. Throwing Behavior
|
|
617
|
-
```ts
|
|
618
|
-
// For critical operations: use regular methods (throws on error)
|
|
619
|
-
try {
|
|
620
|
-
const result = await fetchy(url).json();
|
|
621
|
-
// Process result
|
|
622
|
-
} catch (error) {
|
|
623
|
-
// Handle error explicitly
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
// For optional data: use safe methods (returns null)
|
|
627
|
-
const data = await fetchy(url).sjson();
|
|
628
|
-
if (data !== null) {
|
|
629
|
-
// Process data
|
|
630
|
-
}
|
|
631
|
-
// Continue regardless of result
|
|
632
|
-
```
|
|
633
|
-
|
|
634
|
-
### 3. Configure Retry for Resilience
|
|
635
|
-
```ts
|
|
636
|
-
// Aggressive retry for critical operations
|
|
637
|
-
const result = await fetchy(url, {
|
|
638
|
-
retry: {
|
|
639
|
-
maxAttempts: 5,
|
|
640
|
-
interval: 2,
|
|
641
|
-
maxInterval: 30,
|
|
642
|
-
retryOnTimeout: true
|
|
643
|
-
}
|
|
644
|
-
}).json();
|
|
645
|
-
|
|
646
|
-
// No retry for operations that must be fast
|
|
647
|
-
const data = await fetchy(url, {
|
|
648
|
-
retry: false,
|
|
649
|
-
timeout: 2
|
|
650
|
-
}).json();
|
|
651
|
-
```
|
|
652
|
-
|
|
653
|
-
### 4. Use Method Shortcuts for Clarity
|
|
654
|
-
```ts
|
|
655
|
-
const api = fy({ base: "https://api.example.com" });
|
|
656
|
-
|
|
657
|
-
// Clear and concise
|
|
658
|
-
await api.get("/users").json();
|
|
659
|
-
await api.post("/users", { body: newUser }).json();
|
|
660
|
-
await api.delete("/users/123");
|
|
661
|
-
|
|
662
|
-
// Instead of
|
|
663
|
-
await api.fetch("/users", { method: "GET" }).json();
|
|
664
|
-
await api.fetch("/users", { method: "POST", body: newUser }).json();
|
|
665
|
-
await api.fetch("/users/123", { method: "DELETE" });
|
|
666
|
-
```
|
|
667
|
-
|
|
668
609
|
## License
|
|
669
610
|
|
|
670
611
|
MIT
|
package/esm/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{y as fetchy,E as fy,m as HTTPStatusError,x as setFetchy,d as sfetchy};const u={a:15,b:0,c:3,d:30,e:3,f:!0,g:!1,h:[500,502,503,504,408,429],i:["retry-after","ratelimit-reset","x-ratelimit-reset"],j:!1},N=["POST","PATCH","CONNECT"],h=["text","json","bytes","blob","arrayBuffer","formData"],S=["fetch","get","head","post","put","patch","delete"];let l={};class m extends Error{status;response;constructor(t){super(`${t.status} ${t.url}`),this.name="HTTPStatusError",this.status=t.status,this.response=t}}function E(e){const t=Object.assign({},e);return R(t),R(t,!0),t}function d(e,t){return _(e,t,!0)}function y(e,t){return _(e,t)}function x(e){l=e}function _(e,t,n=!1){t=o(l,t);const r=H(e,t),a=v(r,e,t);return z(G(e,r,a,n),n)}function o(e,t,n){return{...e,...t,...n&&{method:n}}}function A(e){return typeof e=="string"}function M(e){return typeof e=="number"}function b(e){return typeof e=="boolean"}function f(e){return e instanceof Request}function C(e){return!!(e&&typeof e=="object"&&Object.getPrototypeOf(e)===Object.prototype)}function s(e,t){return(t??-1)>=0?t:e}function H(e,t){const{method:n,body:r,timeout:a,retry:c,bearer:i,native:Y,jitter:K,headers:Q,signal:V,...j}=t??{};return{headers:D(t,f(e)?e.headers:null),method:n?n.toUpperCase():f(e)?e.method:r==null?"GET":"POST",...P(r),...j}}function P(e){return e instanceof ReadableStream?null:{body:g(e)?JSON.stringify(e):e}}function g(e){return!!(M(e)||b(e)||Array.isArray(e)||C(e))}function D(e,t){const n=new Headers(e?.headers);if(!n.has("Accept")&&!t?.has("Accept")&&n.set("Accept","application/json, text/plain"),!n.has("Content-Type")&&!t?.has("Content-Type")){const r=B(e?.body);r&&n.set("Content-Type",r)}return e?.bearer&&n.set("Authorization",`Bearer ${e.bearer}`),n}function B(e){return g(e)?"application/json":e==null||A(e)||e instanceof FormData||e instanceof URLSearchParams||e instanceof Blob&&e.type?"":"application/octet-stream"}function F(e,t){return b(t)?{...u,e:1}:{e:Math.max(s(u.e,t?.maxAttempts),1),c:Math.max(s(u.c,t?.interval),.01),d:Math.max(s(u.d,t?.maxInterval),1),f:t?.retryOnTimeout??u.f,g:t?.idempotentOnly?N.includes(e.method??""):!1,h:t?.statusCodes??u.h,i:t?.respectHeaders??u.i}}function v(e,t,n){return{...F(e,n?.retry),a:s(u.a,n?.timeout),b:s(u.b,n?.jitter),j:n?.native??u.j,k:w(f(t)?t.signal:null,n?.signal),l:n?.url,m:n?.base,n:n?.body}}function w(e,t){if(!(!e&&!t))return e&&t?AbortSignal.any([e,t]):e||(t??void 0)}function I(e){return e.a<=0?e.k:w(AbortSignal.timeout(e.a*1e3),e.k)}async function T(e,t=!1){if(e<=0)return;const n=Math.trunc((t?Math.random():1)*e*1e3);await new Promise(r=>setTimeout(r,n))}async function O(e,t,n,r){if(t.g||e>=t.e-1||!r)return!1;if(n instanceof Response){if(t.j||!t.h.includes(n.status))return!1;const a=k(e,t,n.headers);return a>t.d?!1:(await T(a),!0)}else return n instanceof Error&&n.name=="TimeoutError"&&t.f}function k(e,t,n){return t.i.some(r=>n.has(r))?U(t,n)??t.c:Math.min(t.c*2**e,t.d)}function U(e,t){for(const n of e.i){const r=q(t.get(n)?.trim());if(!Number.isNaN(r))return Math.max(r,e.c)}}function q(e){if(!e)return NaN;const t=Number.parseInt(e,10);return Number.isNaN(t)?Math.ceil((new Date(e).getTime()-Date.now())/1e3):t}function J(e,t){if(!(t.n instanceof ReadableStream))return e;const n=["GET","HEAD"].includes(e.method)?"POST":e.method;return new Request(e,{method:n,body:t.n})}function L(e,t){return f(t)||(t||(t=e?.l??""),f(t))?t:new Request(URL.parse(t,e?.m)??"")}function $(e){let t;return async n=>{n&&await t?.body?.cancel();const r=t??e;return n||(t=t?t.clone():e.clone()),r}}async function G(e,t,n,r){let a;for(let c=0;c<n.e;c++)try{c===0&&(a=$(J(L(n,e),n)));const i=await W(await a(),t,n);if(await O(c,n,i,a))continue;if((i.status>=400||i.status<100)&&!n.j)throw new m(i);return i}catch(i){if(await O(c,n,i,a))continue;if(r)return null;throw i}finally{await a?.(!0)}throw new Error}async function W(e,t,n){return await T(n.b,!0),await fetch(e,{...t,signal:I(n)})}function z(e,t){return Object.assign(e,Object.fromEntries([...t?h.map(n=>[n,()=>e.then(r=>r[n]()).catch(()=>null)]):h.map(n=>[n,()=>e.then(r=>r[n]())])]))}function R(e,t){for(const n of S){const r=(t?"s":"")+n;e[r]=function(a,c){const i=n==="fetch"?o(this,c):o(this,c,n);return t?d(a,i):y(a,i)}}}
|
package/esm/mod.js
CHANGED
package/package.json
CHANGED
package/types/main.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import type { FetchyBody, FetchyOptions, FetchyResponse, FetchySafeResponse, RetryOptions } from "./types.js";
|
|
1
|
+
export { _buildOption, _cloneRequestF, _correctNumber, _createRequest, _DEFAULT, _fetchWithJitter, _fetchWithRetry, _findRetryHeader, _genMethods, _getBody, _getContentType, _getHeaders, _getNextInterval, _getOptions, _getRequestInit, _getRetryOption, _includeStream, _isBool, _isJSONObject, _isNumber, _isPlain, _isRequest, _isString, _main, _makeFetchyResponse, _mergeSignals, _parseRetryHeader, _shouldRetry, _wait, _withTimeout, fetchy, fy, HTTPStatusError, setFetchy, sfetchy, };
|
|
2
|
+
import type { Fetchy, FetchyBody, FetchyOptions, FetchyResponse, FetchySafeResponse, RetryOptions } from "./types.js";
|
|
3
3
|
/** Default configuration values for fetchy. */
|
|
4
4
|
declare const _DEFAULT: Options;
|
|
5
|
-
/** HTTP methods that do not have idempotency. */
|
|
6
|
-
declare const _NO_IDEM: string[];
|
|
7
|
-
/** Additional methods for Promise-like interface. */
|
|
8
|
-
declare const _METHODS: readonly ["text", "json", "bytes", "blob", "arrayBuffer", "formData"];
|
|
9
5
|
/** Internal normalized options used throughout the fetch process. */
|
|
10
6
|
interface Options {
|
|
11
7
|
ztimeout: number;
|
|
@@ -19,6 +15,9 @@ interface Options {
|
|
|
19
15
|
zrespects: string[];
|
|
20
16
|
znative: boolean;
|
|
21
17
|
zsignal?: AbortSignal;
|
|
18
|
+
zurl?: string | URL | Request;
|
|
19
|
+
zbase?: string | URL;
|
|
20
|
+
zbody?: FetchyBody;
|
|
22
21
|
}
|
|
23
22
|
/** URL argument type for fetchy functions. */
|
|
24
23
|
type InputArg = string | URL | Request | null;
|
|
@@ -46,108 +45,11 @@ declare class HTTPStatusError extends Error {
|
|
|
46
45
|
constructor(resp: Response);
|
|
47
46
|
}
|
|
48
47
|
/**
|
|
49
|
-
* A fluent HTTP client
|
|
48
|
+
* A fluent HTTP client that provides methods for making HTTP requests.
|
|
50
49
|
* Supports features like timeout, retry with exponential backoff, automatic header management, and response parsing.
|
|
51
50
|
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```ts
|
|
54
|
-
* // Instance usage - reuse configuration
|
|
55
|
-
* const client = new Fetchy({
|
|
56
|
-
* bearer: "token123",
|
|
57
|
-
* timeout: 10,
|
|
58
|
-
* retry: { maxAttempts: 3 }
|
|
59
|
-
* });
|
|
60
|
-
* const user = await client.get("https://api.example.com/user").json<User>();
|
|
61
|
-
* const posts = await client.get("https://api.example.com/posts").json<Post[]>();
|
|
62
|
-
*
|
|
63
|
-
* // Safe mode - returns null on error instead of throwing
|
|
64
|
-
* const result = await client.safe("https://api.example.com/data").json<Data>();
|
|
65
|
-
* if (result !== null) {
|
|
66
|
-
* // Handle successful response
|
|
67
|
-
* }
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
declare class Fetchy implements FetchyOptions {
|
|
71
|
-
/** Request URL. Used when calling methods with null as URL argument. */
|
|
72
|
-
url?: string | URL | Request;
|
|
73
|
-
/**
|
|
74
|
-
* Base URL prepended to the request URL.
|
|
75
|
-
* Only used when the URL argument is a string or URL (not when it's a Request object).
|
|
76
|
-
*/
|
|
77
|
-
base?: string | URL;
|
|
78
|
-
/** Request body content. Automatically serializes JSON objects. */
|
|
79
|
-
body?: FetchyBody;
|
|
80
|
-
/** Request timeout in seconds. Default is 15 seconds. */
|
|
81
|
-
timeout?: number;
|
|
82
|
-
/** Retry configuration. Set to false to disable retry functionality. */
|
|
83
|
-
retry?: false | RetryOptions;
|
|
84
|
-
/** Bearer token for Authorization header. Automatically adds "Bearer " prefix. */
|
|
85
|
-
bearer?: string;
|
|
86
|
-
/**
|
|
87
|
-
* Maximum jitter delay in seconds applied before each request (including retries).
|
|
88
|
-
* Adds randomness (0 to specified value) to prevent thundering herd.
|
|
89
|
-
*/
|
|
90
|
-
jitter?: number;
|
|
91
|
-
/** If true, does not throw error on HTTP error status, behaving like native fetch. */
|
|
92
|
-
native?: boolean;
|
|
93
|
-
/** Property of RequestInit. */
|
|
94
|
-
cache?: RequestCache;
|
|
95
|
-
/** Property of RequestInit. */
|
|
96
|
-
credentials?: RequestCredentials;
|
|
97
|
-
/** Property of RequestInit. */
|
|
98
|
-
headers?: HeadersInit;
|
|
99
|
-
/** Property of RequestInit. */
|
|
100
|
-
integrity?: string;
|
|
101
|
-
/** Property of RequestInit. */
|
|
102
|
-
keepalive?: boolean;
|
|
103
|
-
/** Property of RequestInit. */
|
|
104
|
-
method?: string;
|
|
105
|
-
/** Property of RequestInit. */
|
|
106
|
-
mode?: RequestMode;
|
|
107
|
-
/** Property of RequestInit. */
|
|
108
|
-
redirect?: RequestRedirect;
|
|
109
|
-
/** Property of RequestInit. */
|
|
110
|
-
referrer?: string;
|
|
111
|
-
/** Property of RequestInit. */
|
|
112
|
-
referrerPolicy?: ReferrerPolicy;
|
|
113
|
-
/** Property of RequestInit. */
|
|
114
|
-
signal?: AbortSignal | null;
|
|
115
|
-
constructor(options?: FetchyOptions);
|
|
116
|
-
/** Calls fetchy with instance options. */
|
|
117
|
-
fetch(url?: string | URL | Request | null, options?: FetchyOptions): FetchyResponse;
|
|
118
|
-
/** Calls fetchy as GET request with instance options. */
|
|
119
|
-
get(url?: string | URL | Request | null, options?: FetchyOptions): FetchyResponse;
|
|
120
|
-
/** Calls fetchy as HEAD request with instance options. */
|
|
121
|
-
head(url?: string | URL | Request | null, options?: FetchyOptions): Promise<Response>;
|
|
122
|
-
/** Calls fetchy as POST request with instance options. */
|
|
123
|
-
post(url?: string | URL | Request | null, options?: FetchyOptions): FetchyResponse;
|
|
124
|
-
/** Calls fetchy as PUT request with instance options. */
|
|
125
|
-
put(url?: string | URL | Request | null, options?: FetchyOptions): FetchyResponse;
|
|
126
|
-
/** Calls fetchy as PATCH request with instance options. */
|
|
127
|
-
patch(url?: string | URL | Request | null, options?: FetchyOptions): FetchyResponse;
|
|
128
|
-
/** Calls fetchy as DELETE request with instance options. */
|
|
129
|
-
delete(url?: string | URL | Request | null, options?: FetchyOptions): FetchyResponse;
|
|
130
|
-
/** Calls sfetchy with instance options. Returns null on error. */
|
|
131
|
-
safe(url?: string | URL | Request | null, options?: FetchyOptions): FetchySafeResponse | null;
|
|
132
|
-
/** Calls sfetchy as GET request with instance options. Returns null on error. */
|
|
133
|
-
sget(url?: string | URL | Request | null, options?: FetchyOptions): FetchySafeResponse | null;
|
|
134
|
-
/** Calls sfetchy as HEAD request with instance options. Returns null on error. */
|
|
135
|
-
shead(url?: string | URL | Request | null, options?: FetchyOptions): Promise<Response | null> | null;
|
|
136
|
-
/** Calls sfetchy as POST request with instance options. Returns null on error. */
|
|
137
|
-
spost(url?: string | URL | Request | null, options?: FetchyOptions): FetchySafeResponse | null;
|
|
138
|
-
/** Calls sfetchy as PUT request with instance options. Returns null on error. */
|
|
139
|
-
sput(url?: string | URL | Request | null, options?: FetchyOptions): FetchySafeResponse | null;
|
|
140
|
-
/** Calls sfetchy as PATCH request with instance options. Returns null on error. */
|
|
141
|
-
spatch(url?: string | URL | Request | null, options?: FetchyOptions): FetchySafeResponse | null;
|
|
142
|
-
/** Calls sfetchy as DELETE request with instance options. Returns null on error. */
|
|
143
|
-
sdelete(url?: string | URL | Request | null, options?: FetchyOptions): FetchySafeResponse | null;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Creates a new Fetchy instance with the specified options.
|
|
147
|
-
* Shorthand for `new Fetchy(options)`.
|
|
148
|
-
*
|
|
149
51
|
* @param options - Configuration options to apply to all requests made with this instance.
|
|
150
|
-
* @returns
|
|
52
|
+
* @returns An object that has Fetchy interface.
|
|
151
53
|
*
|
|
152
54
|
* @example
|
|
153
55
|
* ```ts
|
|
@@ -161,6 +63,12 @@ declare class Fetchy implements FetchyOptions {
|
|
|
161
63
|
*
|
|
162
64
|
* const user = await client.get("/user").json<User>();
|
|
163
65
|
* const posts = await client.get("/posts").json<Post[]>();
|
|
66
|
+
*
|
|
67
|
+
* // Safe mode - returns null on error instead of throwing
|
|
68
|
+
* const result = await client.sfetch("https://api.example.com/data").json<Data>();
|
|
69
|
+
* if (result !== null) {
|
|
70
|
+
* // Handle successful response
|
|
71
|
+
* }
|
|
164
72
|
* ```
|
|
165
73
|
*/
|
|
166
74
|
declare function fy(options?: FetchyOptions): Fetchy;
|
|
@@ -204,7 +112,7 @@ declare function fy(options?: FetchyOptions): Fetchy;
|
|
|
204
112
|
* }
|
|
205
113
|
* ```
|
|
206
114
|
*/
|
|
207
|
-
declare function sfetchy(url?: string | URL | Request | null, options?: FetchyOptions): FetchySafeResponse
|
|
115
|
+
declare function sfetchy(url?: string | URL | Request | null, options?: FetchyOptions): FetchySafeResponse;
|
|
208
116
|
/**
|
|
209
117
|
* Performs an HTTP request with enhanced features like timeout, retry, and automatic header management.
|
|
210
118
|
* Throws errors on failure unless configured otherwise via the `native` option.
|
|
@@ -229,7 +137,7 @@ declare function sfetchy(url?: string | URL | Request | null, options?: FetchyOp
|
|
|
229
137
|
*
|
|
230
138
|
* // POST request with JSON body and authentication
|
|
231
139
|
* const result = await fetchy("https://api.example.com/create", {
|
|
232
|
-
* method:
|
|
140
|
+
* method: "POST",
|
|
233
141
|
* body: { name: "John", age: 30 },
|
|
234
142
|
* bearer: "your-token-here"
|
|
235
143
|
* }).json();
|
|
@@ -253,6 +161,28 @@ declare function sfetchy(url?: string | URL | Request | null, options?: FetchyOp
|
|
|
253
161
|
* ```
|
|
254
162
|
*/
|
|
255
163
|
declare function fetchy(url?: string | URL | Request | null, options?: FetchyOptions): FetchyResponse;
|
|
164
|
+
/**
|
|
165
|
+
* Sets global default options for all fetchy instances.
|
|
166
|
+
* These options will be merged with instance-specific options, with instance options taking precedence.
|
|
167
|
+
*
|
|
168
|
+
* @param options - Default configuration options to apply globally.
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```ts
|
|
172
|
+
* import { setFetchy, fetchy } from "@scirexs/fetchy";
|
|
173
|
+
*
|
|
174
|
+
* // Set global defaults
|
|
175
|
+
* setFetchy({
|
|
176
|
+
* timeout: 30,
|
|
177
|
+
* retry: { maxAttempts: 5 },
|
|
178
|
+
* bearer: "global-token"
|
|
179
|
+
* });
|
|
180
|
+
*
|
|
181
|
+
* // All subsequent requests use these defaults
|
|
182
|
+
* await fetchy("https://api.example.com/data");
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
declare function setFetchy(options: FetchyOptions): void;
|
|
256
186
|
/** Main procedure for fetchy and sfetchy. @internal */
|
|
257
187
|
declare function _main(url: InputArg | undefined, options: FetchyOptions | undefined, safe?: undefined): FetchyResponse;
|
|
258
188
|
declare function _main(url: InputArg | undefined, options: FetchyOptions | undefined, safe: true): FetchySafeResponse;
|
|
@@ -264,18 +194,12 @@ declare function _isString(v: unknown): v is string;
|
|
|
264
194
|
declare function _isNumber(v: unknown): v is number;
|
|
265
195
|
/** Type guard: checks if value is a boolean. @internal */
|
|
266
196
|
declare function _isBool(v: unknown): v is boolean;
|
|
267
|
-
/** Type guard: checks if value is a ReadableStream. @internal */
|
|
268
|
-
declare function _isStream(v: unknown): v is ReadableStream;
|
|
269
197
|
/** Type guard: checks if value is a Request. @internal */
|
|
270
198
|
declare function _isRequest(v: unknown): v is Request;
|
|
271
199
|
/** Type guard: checks if value is a plain object (not array, null, or other object types). @internal */
|
|
272
200
|
declare function _isPlain(v: unknown): v is object;
|
|
273
201
|
/** Corrects a number to be non-negative, using default if invalid. @internal */
|
|
274
202
|
declare function _correctNumber(dflt: number, num?: number): number;
|
|
275
|
-
/** Creates Request object from various input types. @internal */
|
|
276
|
-
declare function _createRequest(url?: InputArg, options?: FetchyOptions): Request;
|
|
277
|
-
/** Creates new Request with ReadableStream body if present in options. @internal */
|
|
278
|
-
declare function _includeStream(req: Request, options?: FetchyOptions): Request;
|
|
279
203
|
/** Converts FetchyOptions to standard RequestInit format. @internal */
|
|
280
204
|
declare function _getRequestInit(url?: InputArg, options?: FetchyOptions): RequestInit;
|
|
281
205
|
/** Converts FetchyBody to standard BodyInit format. @internal */
|
|
@@ -284,12 +208,8 @@ declare function _getBody(body?: FetchyBody): Record<string, BodyInit> | null;
|
|
|
284
208
|
declare function _isJSONObject(arg?: FetchyBody): boolean;
|
|
285
209
|
/** Constructs request headers with automatic Content-Type and Authorization. @internal */
|
|
286
210
|
declare function _getHeaders(options?: FetchyOptions, reqHeaders?: Headers | null): Headers;
|
|
287
|
-
/** Checks if header is absent in both option headers and request headers. @internal */
|
|
288
|
-
declare function _isNoHeader(name: string, optionHeader: Headers, reqHeaders?: Headers | null): boolean;
|
|
289
211
|
/** Determines Content-Type header based on body type. @internal */
|
|
290
212
|
declare function _getContentType(body?: FetchyBody): string;
|
|
291
|
-
/** Checks if Content-Type should be handled by native fetch. @internal */
|
|
292
|
-
declare function _handleByNative(body?: FetchyBody): boolean;
|
|
293
213
|
/** Extracts retry-related options with defaults. @internal */
|
|
294
214
|
declare function _getRetryOption(init: RequestInit, options?: RetryOptions | false): InternalRetry;
|
|
295
215
|
/** Converts FetchyOptions to internal Options format with validated values. @internal */
|
|
@@ -300,24 +220,25 @@ declare function _mergeSignals(s1?: AbortSignal | null, s2?: AbortSignal | null)
|
|
|
300
220
|
declare function _withTimeout(opts: Options): AbortSignal | undefined;
|
|
301
221
|
/** Waits for specified seconds with optional randomization. @internal */
|
|
302
222
|
declare function _wait(sec: number, random?: boolean): Promise<void>;
|
|
303
|
-
/** Checks if HTTP status code indicates an error. @internal */
|
|
304
|
-
declare function _isHttpError(stat: number): boolean;
|
|
305
223
|
/** Determines whether to retry based on conditions and waits before next attempt. @internal */
|
|
306
|
-
declare function _shouldRetry(count: number, opts: Options, r: Response | unknown): Promise<boolean>;
|
|
224
|
+
declare function _shouldRetry(count: number, opts: Options, r: Response | unknown, fn?: unknown): Promise<boolean>;
|
|
307
225
|
/** Calculates next retry interval using exponential backoff or response headers. @internal */
|
|
308
226
|
declare function _getNextInterval(count: number, opts: Options, headers: Headers): number;
|
|
309
227
|
/** Finds and parses retry timing from response headers. @internal */
|
|
310
228
|
declare function _findRetryHeader(opts: Options, headers: Headers): number | undefined;
|
|
311
229
|
/** Parses retry header value to seconds. @internal */
|
|
312
230
|
declare function _parseRetryHeader(value?: string | null): number;
|
|
313
|
-
/**
|
|
314
|
-
declare function
|
|
315
|
-
/** Creates
|
|
316
|
-
declare function
|
|
231
|
+
/** Creates new Request with ReadableStream body if present in options. @internal */
|
|
232
|
+
declare function _includeStream(req: Request, opts: Options): Request;
|
|
233
|
+
/** Creates Request object from various input types. @internal */
|
|
234
|
+
declare function _createRequest(opts: Options, url?: InputArg): Request;
|
|
317
235
|
/** Creates request cloning function with abort handling. @internal */
|
|
318
236
|
declare function _cloneRequestF(req: Request): (cancel?: boolean) => Promise<Request>;
|
|
319
237
|
/** Executes fetch with retry logic and exponential backoff. @internal */
|
|
320
|
-
declare function _fetchWithRetry(
|
|
238
|
+
declare function _fetchWithRetry(url: InputArg | undefined, init: RequestInit, opts: Options, safe: boolean): Promise<Response | null>;
|
|
321
239
|
/** Executes fetch with initial jitter delay. @internal */
|
|
322
240
|
declare function _fetchWithJitter(req: Request, init: RequestInit, opts: Options): Promise<Response>;
|
|
241
|
+
/** Creates promise-like object with convenience parsing methods. @internal */
|
|
242
|
+
declare function _makeFetchyResponse(resp: Promise<Response | null>, safe: boolean): FetchyResponse | FetchySafeResponse;
|
|
243
|
+
declare function _genMethods(obj: object, safe?: boolean): void;
|
|
323
244
|
//# sourceMappingURL=main.d.ts.map
|
package/types/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,cAAc,EACd,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,eAAe,EACf,cAAc,EACd,OAAO,EACP,aAAa,EACb,SAAS,EACT,QAAQ,EACR,UAAU,EACV,SAAS,EACT,KAAK,EACL,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,MAAM,EACN,EAAE,EACF,eAAe,EACf,SAAS,EACT,OAAO,GACR,CAAC;AAEF,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGtH,+CAA+C;AAC/C,QAAA,MAAM,QAAQ,EAAE,OAWN,CAAC;AASX,qEAAqE;AACrE,UAAU,OAAO;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC;IAC9B,KAAK,CAAC,EAAE,MAA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,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAI5D;AACD,iEAAiE;AACjE,iBAAS,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,QAAQ,GAAG,OAAO,CAK9D;AACD,sEAAsE;AACtE,iBAAS,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAS5E;AACD,yEAAyE;AACzE,iBAAe,eAAe,CAAC,GAAG,EAAE,QAAQ,GAAG,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAkBnI;AACD,0DAA0D;AAC1D,iBAAe,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAGjG;AACD,8EAA8E;AAC9E,iBAAS,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,GAAG,cAAc,GAAG,kBAAkB,CAa/G;AACD,iBAAS,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,QAS/C"}
|
package/types/mod.d.ts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Exports main functions and types for external.
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
|
-
export {
|
|
5
|
+
export { fetchy, fy, HTTPStatusError, setFetchy, sfetchy } from "./main.js";
|
|
6
6
|
export type { FetchyBody, FetchyOptions, FetchyResponse, FetchySafeResponse, JSONValue, RetryOptions } from "./types.js";
|
|
7
7
|
//# sourceMappingURL=mod.d.ts.map
|
package/types/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC5E,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,kBAAkB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
package/types/types.d.ts
CHANGED
|
@@ -170,4 +170,165 @@ export interface FetchySafeResponse extends Promise<Response | null> {
|
|
|
170
170
|
/** Parses response body safety as FormData. */
|
|
171
171
|
formData: () => Promise<FormData | null>;
|
|
172
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Fluent HTTP client interface with pre-configured options.
|
|
175
|
+
* Created by `fy()` function, this interface allows method chaining and provides
|
|
176
|
+
* both standard and safe (error-suppressing) variants of HTTP methods.
|
|
177
|
+
*
|
|
178
|
+
* All methods inherit the options specified when creating the Fetchy instance,
|
|
179
|
+
* which can be overridden by passing additional options to individual method calls.
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```ts
|
|
183
|
+
* import { fy } from "@scirexs/fetchy";
|
|
184
|
+
*
|
|
185
|
+
* // Create client with base configuration
|
|
186
|
+
* const api = fy({
|
|
187
|
+
* base: "https://api.example.com",
|
|
188
|
+
* bearer: "token123",
|
|
189
|
+
* timeout: 10,
|
|
190
|
+
* retry: { maxAttempts: 3 }
|
|
191
|
+
* });
|
|
192
|
+
*
|
|
193
|
+
* // Use standard methods (throw on error)
|
|
194
|
+
* const user = await api.get("/user").json<User>();
|
|
195
|
+
* const result = await api.post("/data", { body: { key: "value" } }).json();
|
|
196
|
+
*
|
|
197
|
+
* // Use safe methods (return null on error)
|
|
198
|
+
* const posts = await api.sget("/posts").json<Post[]>();
|
|
199
|
+
* if (posts === null) {
|
|
200
|
+
* console.log("Failed to fetch posts");
|
|
201
|
+
* }
|
|
202
|
+
*
|
|
203
|
+
* // Override instance options
|
|
204
|
+
* const data = await api.get("/important", {
|
|
205
|
+
* timeout: 30,
|
|
206
|
+
* retry: { maxAttempts: 5 }
|
|
207
|
+
* }).json();
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
export interface Fetchy extends FetchyOptions {
|
|
211
|
+
/**
|
|
212
|
+
* Performs HTTP request with instance options.
|
|
213
|
+
* Equivalent to calling `fetchy()` with pre-configured options.
|
|
214
|
+
*
|
|
215
|
+
* @param url - Request URL (uses instance `url` if omitted).
|
|
216
|
+
* @param options - Additional options to merge with instance options.
|
|
217
|
+
* @returns Promise-like response object with parsing methods.
|
|
218
|
+
*/
|
|
219
|
+
fetch(url?: string | URL | Request | null, options?: FetchyOptions): FetchyResponse;
|
|
220
|
+
/**
|
|
221
|
+
* Performs GET request with instance options.
|
|
222
|
+
*
|
|
223
|
+
* @param url - Request URL (uses instance `url` if omitted).
|
|
224
|
+
* @param options - Additional options to merge with instance options.
|
|
225
|
+
* @returns Promise-like response object with parsing methods.
|
|
226
|
+
*/
|
|
227
|
+
get(url?: string | URL | Request | null, options?: FetchyOptions): FetchyResponse;
|
|
228
|
+
/**
|
|
229
|
+
* Performs HEAD request with instance options.
|
|
230
|
+
* HEAD requests only retrieve headers without response body.
|
|
231
|
+
*
|
|
232
|
+
* @param url - Request URL (uses instance `url` if omitted).
|
|
233
|
+
* @param options - Additional options to merge with instance options.
|
|
234
|
+
* @returns Promise resolving to Response object.
|
|
235
|
+
*/
|
|
236
|
+
head(url?: string | URL | Request | null, options?: FetchyOptions): Promise<Response>;
|
|
237
|
+
/**
|
|
238
|
+
* Performs POST request with instance options.
|
|
239
|
+
*
|
|
240
|
+
* @param url - Request URL (uses instance `url` if omitted).
|
|
241
|
+
* @param options - Additional options to merge with instance options (typically includes `body`).
|
|
242
|
+
* @returns Promise-like response object with parsing methods.
|
|
243
|
+
*/
|
|
244
|
+
post(url?: string | URL | Request | null, options?: FetchyOptions): FetchyResponse;
|
|
245
|
+
/**
|
|
246
|
+
* Performs PUT request with instance options.
|
|
247
|
+
*
|
|
248
|
+
* @param url - Request URL (uses instance `url` if omitted).
|
|
249
|
+
* @param options - Additional options to merge with instance options (typically includes `body`).
|
|
250
|
+
* @returns Promise-like response object with parsing methods.
|
|
251
|
+
*/
|
|
252
|
+
put(url?: string | URL | Request | null, options?: FetchyOptions): FetchyResponse;
|
|
253
|
+
/**
|
|
254
|
+
* Performs PATCH request with instance options.
|
|
255
|
+
*
|
|
256
|
+
* @param url - Request URL (uses instance `url` if omitted).
|
|
257
|
+
* @param options - Additional options to merge with instance options (typically includes `body`).
|
|
258
|
+
* @returns Promise-like response object with parsing methods.
|
|
259
|
+
*/
|
|
260
|
+
patch(url?: string | URL | Request | null, options?: FetchyOptions): FetchyResponse;
|
|
261
|
+
/**
|
|
262
|
+
* Performs DELETE request with instance options.
|
|
263
|
+
*
|
|
264
|
+
* @param url - Request URL (uses instance `url` if omitted).
|
|
265
|
+
* @param options - Additional options to merge with instance options.
|
|
266
|
+
* @returns Promise-like response object with parsing methods.
|
|
267
|
+
*/
|
|
268
|
+
delete(url?: string | URL | Request | null, options?: FetchyOptions): FetchyResponse;
|
|
269
|
+
/**
|
|
270
|
+
* Performs HTTP request in safe mode with instance options.
|
|
271
|
+
* Returns `null` on any error instead of throwing.
|
|
272
|
+
* Equivalent to calling `sfetchy()` with pre-configured options.
|
|
273
|
+
*
|
|
274
|
+
* @param url - Request URL (uses instance `url` if omitted).
|
|
275
|
+
* @param options - Additional options to merge with instance options.
|
|
276
|
+
* @returns Promise-like response object that resolves to Response or null.
|
|
277
|
+
*/
|
|
278
|
+
sfetch(url?: string | URL | Request | null, options?: FetchyOptions): FetchySafeResponse;
|
|
279
|
+
/**
|
|
280
|
+
* Performs GET request in safe mode with instance options.
|
|
281
|
+
* Returns `null` on any error instead of throwing.
|
|
282
|
+
*
|
|
283
|
+
* @param url - Request URL (uses instance `url` if omitted).
|
|
284
|
+
* @param options - Additional options to merge with instance options.
|
|
285
|
+
* @returns Promise-like response object that resolves to Response or null.
|
|
286
|
+
*/
|
|
287
|
+
sget(url?: string | URL | Request | null, options?: FetchyOptions): FetchySafeResponse;
|
|
288
|
+
/**
|
|
289
|
+
* Performs HEAD request in safe mode with instance options.
|
|
290
|
+
* Returns `null` on any error instead of throwing.
|
|
291
|
+
*
|
|
292
|
+
* @param url - Request URL (uses instance `url` if omitted).
|
|
293
|
+
* @param options - Additional options to merge with instance options.
|
|
294
|
+
* @returns Promise resolving to Response or null.
|
|
295
|
+
*/
|
|
296
|
+
shead(url?: string | URL | Request | null, options?: FetchyOptions): Promise<Response | null>;
|
|
297
|
+
/**
|
|
298
|
+
* Performs POST request in safe mode with instance options.
|
|
299
|
+
* Returns `null` on any error instead of throwing.
|
|
300
|
+
*
|
|
301
|
+
* @param url - Request URL (uses instance `url` if omitted).
|
|
302
|
+
* @param options - Additional options to merge with instance options (typically includes `body`).
|
|
303
|
+
* @returns Promise-like response object that resolves to Response or null.
|
|
304
|
+
*/
|
|
305
|
+
spost(url?: string | URL | Request | null, options?: FetchyOptions): FetchySafeResponse;
|
|
306
|
+
/**
|
|
307
|
+
* Performs PUT request in safe mode with instance options.
|
|
308
|
+
* Returns `null` on any error instead of throwing.
|
|
309
|
+
*
|
|
310
|
+
* @param url - Request URL (uses instance `url` if omitted).
|
|
311
|
+
* @param options - Additional options to merge with instance options (typically includes `body`).
|
|
312
|
+
* @returns Promise-like response object that resolves to Response or null.
|
|
313
|
+
*/
|
|
314
|
+
sput(url?: string | URL | Request | null, options?: FetchyOptions): FetchySafeResponse;
|
|
315
|
+
/**
|
|
316
|
+
* Performs PATCH request in safe mode with instance options.
|
|
317
|
+
* Returns `null` on any error instead of throwing.
|
|
318
|
+
*
|
|
319
|
+
* @param url - Request URL (uses instance `url` if omitted).
|
|
320
|
+
* @param options - Additional options to merge with instance options (typically includes `body`).
|
|
321
|
+
* @returns Promise-like response object that resolves to Response or null.
|
|
322
|
+
*/
|
|
323
|
+
spatch(url?: string | URL | Request | null, options?: FetchyOptions): FetchySafeResponse;
|
|
324
|
+
/**
|
|
325
|
+
* Performs DELETE request in safe mode with instance options.
|
|
326
|
+
* Returns `null` on any error instead of throwing.
|
|
327
|
+
*
|
|
328
|
+
* @param url - Request URL (uses instance `url` if omitted).
|
|
329
|
+
* @param options - Additional options to merge with instance options.
|
|
330
|
+
* @returns Promise-like response object that resolves to Response or null.
|
|
331
|
+
*/
|
|
332
|
+
sdelete(url?: string | URL | Request | null, options?: FetchyOptions): FetchySafeResponse;
|
|
333
|
+
}
|
|
173
334
|
//# sourceMappingURL=types.d.ts.map
|
package/types/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEtG;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE9C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC;IAC9D,6EAA6E;IAC7E,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC;IAC7B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IACpB,mEAAmE;IACnE,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wEAAwE;IACxE,KAAK,CAAC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