@ahoo-wang/fetcher 1.3.5 → 1.5.0
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/fetcher.d.ts +5 -2
- package/dist/fetcher.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +255 -241
- 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/mergeRequest.d.ts.map +1 -1
- package/dist/resultExtractor.d.ts +42 -0
- package/dist/resultExtractor.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeRequest.d.ts","sourceRoot":"","sources":["../src/mergeRequest.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,gBAAgB,GACvB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"mergeRequest.d.ts","sourceRoot":"","sources":["../src/mergeRequest.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,gBAAgB,GACvB,gBAAgB,CAwClB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { FetchExchange } from './fetchExchange';
|
|
2
|
+
/**
|
|
3
|
+
* Function interface for extracting results from a FetchExchange.
|
|
4
|
+
* Defines how to transform a FetchExchange object into a specific result type.
|
|
5
|
+
* @template R - The type of result to extract
|
|
6
|
+
* @param exchange - The FetchExchange object containing request and response information
|
|
7
|
+
* @returns The extracted result of type R
|
|
8
|
+
*/
|
|
9
|
+
export interface ResultExtractor<R> {
|
|
10
|
+
(exchange: FetchExchange): R | Promise<R>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Returns the original FetchExchange object.
|
|
14
|
+
* @param exchange - The FetchExchange object to return
|
|
15
|
+
* @returns The same FetchExchange object that was passed in
|
|
16
|
+
*/
|
|
17
|
+
export declare const ExchangeResultExtractor: ResultExtractor<FetchExchange>;
|
|
18
|
+
/**
|
|
19
|
+
* Extracts the Response object from the exchange.
|
|
20
|
+
* @param exchange - The FetchExchange containing the response
|
|
21
|
+
* @returns The Response object from the exchange
|
|
22
|
+
*/
|
|
23
|
+
export declare const ResponseResultExtractor: ResultExtractor<Response>;
|
|
24
|
+
/**
|
|
25
|
+
* Extracts and parses the response body as JSON.
|
|
26
|
+
* @param exchange - The FetchExchange containing the response with JSON data
|
|
27
|
+
* @returns A Promise that resolves to the parsed JSON data
|
|
28
|
+
*/
|
|
29
|
+
export declare const JsonResultExtractor: ResultExtractor<Promise<any>>;
|
|
30
|
+
/**
|
|
31
|
+
* Extracts the response body as text.
|
|
32
|
+
* @param exchange - The FetchExchange containing the response with text data
|
|
33
|
+
* @returns A Promise that resolves to the response body as a string
|
|
34
|
+
*/
|
|
35
|
+
export declare const TextResultExtractor: ResultExtractor<Promise<string>>;
|
|
36
|
+
export declare const ResultExtractors: {
|
|
37
|
+
Exchange: ResultExtractor<FetchExchange>;
|
|
38
|
+
Response: ResultExtractor<Response>;
|
|
39
|
+
Json: ResultExtractor<Promise<any>>;
|
|
40
|
+
Text: ResultExtractor<Promise<string>>;
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=resultExtractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resultExtractor.d.ts","sourceRoot":"","sources":["../src/resultExtractor.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,CAAC,QAAQ,EAAE,aAAa,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAC3C;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,eAAe,CAAC,aAAa,CAElE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,eAAe,CAAC,QAAQ,CAE7D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,CAE7D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAEhE,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;CAK5B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ahoo-wang/fetcher",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
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",
|