@ahoo-wang/fetcher 1.3.2 → 1.3.3
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/dist/index.es.js +7 -7
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/timeout.d.ts +8 -7
- package/dist/timeout.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/timeout.d.ts
CHANGED
|
@@ -55,15 +55,16 @@ export interface TimeoutCapable {
|
|
|
55
55
|
*/
|
|
56
56
|
export declare function resolveTimeout(requestTimeout?: number, optionsTimeout?: number): number | undefined;
|
|
57
57
|
/**
|
|
58
|
-
* HTTP request
|
|
58
|
+
* Executes an HTTP request with optional timeout support.
|
|
59
59
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* it
|
|
60
|
+
* This function provides a wrapper around the native fetch API with added timeout functionality.
|
|
61
|
+
* If a timeout is specified, it will create an AbortController to cancel the request if it exceeds the timeout.
|
|
62
|
+
* If the request already has a signal, it will delegate to the native fetch API directly to avoid conflicts.
|
|
63
63
|
*
|
|
64
|
-
* @param request - The request
|
|
65
|
-
* @returns Promise
|
|
66
|
-
* @throws FetchTimeoutError
|
|
64
|
+
* @param request - The request configuration including URL, method, headers, body, and optional timeout
|
|
65
|
+
* @returns Promise that resolves to the Response object
|
|
66
|
+
* @throws FetchTimeoutError if the request times out
|
|
67
|
+
* @throws TypeError for network errors
|
|
67
68
|
*
|
|
68
69
|
* @example
|
|
69
70
|
* ```typescript
|
package/dist/timeout.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeout.d.ts","sourceRoot":"","sources":["../src/timeout.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,iBAAkB,SAAQ,YAAY;IACjD;;OAEG;IACH,OAAO,EAAE,YAAY,CAAC;IAEtB;;;;OAIG;gBACS,OAAO,EAAE,YAAY;CASlC;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC5B,cAAc,CAAC,EAAE,MAAM,EACvB,cAAc,CAAC,EAAE,MAAM,GACtB,MAAM,GAAG,SAAS,CAKpB;AAED
|
|
1
|
+
{"version":3,"file":"timeout.d.ts","sourceRoot":"","sources":["../src/timeout.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,iBAAkB,SAAQ,YAAY;IACjD;;OAEG;IACH,OAAO,EAAE,YAAY,CAAC;IAEtB;;;;OAIG;gBACS,OAAO,EAAE,YAAY;CASlC;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC5B,cAAc,CAAC,EAAE,MAAM,EACvB,cAAc,CAAC,EAAE,MAAM,GACtB,MAAM,GAAG,SAAS,CAKpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CA+C3E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ahoo-wang/fetcher",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "Ultra-lightweight (2.8KiB min+gzip) HTTP client with built-in path parameters, query parameters, and Axios-like API. The foundation of the Fetcher ecosystem with powerful interceptor system and LLM streaming API support.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fetch",
|