@ahoo-wang/fetcher 0.8.2 → 0.8.5
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 +7 -5
- package/README.zh-CN.md +7 -5
- package/dist/fetchExchange.d.ts +3 -91
- package/dist/fetchExchange.d.ts.map +1 -1
- package/dist/fetchInterceptor.d.ts +4 -2
- package/dist/fetchInterceptor.d.ts.map +1 -1
- package/dist/fetchRequest.d.ts +60 -0
- package/dist/fetchRequest.d.ts.map +1 -0
- package/dist/fetcher.d.ts +29 -15
- package/dist/fetcher.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +151 -137
- package/dist/index.umd.js +1 -1
- package/dist/mergeRequest.d.ts +12 -6
- package/dist/mergeRequest.d.ts.map +1 -1
- package/dist/requestBodyInterceptor.d.ts +3 -2
- package/dist/requestBodyInterceptor.d.ts.map +1 -1
- package/dist/timeout.d.ts +4 -14
- package/dist/timeout.d.ts.map +1 -1
- package/dist/types.d.ts +0 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/urlBuilder.d.ts +81 -15
- package/dist/urlBuilder.d.ts.map +1 -1
- package/dist/urlResolveInterceptor.d.ts +6 -0
- package/dist/urlResolveInterceptor.d.ts.map +1 -1
- package/dist/utils.d.ts +30 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,8 +51,10 @@ const fetcher = new Fetcher({
|
|
|
51
51
|
|
|
52
52
|
// GET request with path and query parameters
|
|
53
53
|
const response = await fetcher.get('/users/{id}', {
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
urlParams: {
|
|
55
|
+
path: { id: 123 },
|
|
56
|
+
query: { include: 'profile' },
|
|
57
|
+
},
|
|
56
58
|
});
|
|
57
59
|
const userData = await response.json<User>();
|
|
58
60
|
|
|
@@ -121,9 +123,9 @@ responses, and errors at different stages of the HTTP request lifecycle.
|
|
|
121
123
|
|
|
122
124
|
Fetcher comes with several built-in interceptors that are automatically registered:
|
|
123
125
|
|
|
124
|
-
1. **UrlResolveInterceptor**: Resolves URLs with path and query parameters (order: Number.MIN_SAFE_INTEGER)
|
|
125
|
-
2. **RequestBodyInterceptor**: Converts object bodies to JSON strings (order: Number.MIN_SAFE_INTEGER +
|
|
126
|
-
3. **FetchInterceptor**: Executes the actual HTTP request (order: Number.MAX_SAFE_INTEGER)
|
|
126
|
+
1. **UrlResolveInterceptor**: Resolves URLs with path and query parameters (order: Number.MIN_SAFE_INTEGER + 100)
|
|
127
|
+
2. **RequestBodyInterceptor**: Converts object bodies to JSON strings (order: Number.MIN_SAFE_INTEGER + 200)
|
|
128
|
+
3. **FetchInterceptor**: Executes the actual HTTP request (order: Number.MAX_SAFE_INTEGER - 100)
|
|
127
129
|
|
|
128
130
|
### Using Interceptors
|
|
129
131
|
|
package/README.zh-CN.md
CHANGED
|
@@ -50,8 +50,10 @@ const fetcher = new Fetcher({
|
|
|
50
50
|
|
|
51
51
|
// 带路径和查询参数的 GET 请求
|
|
52
52
|
const response = await fetcher.get('/users/{id}', {
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
urlParams: {
|
|
54
|
+
path: { id: 123 },
|
|
55
|
+
query: { include: 'profile' },
|
|
56
|
+
},
|
|
55
57
|
});
|
|
56
58
|
const userData = await response.json<User>();
|
|
57
59
|
|
|
@@ -119,9 +121,9 @@ Fetcher 中的拦截器系统遵循中间件模式,允许您在 HTTP 请求生
|
|
|
119
121
|
|
|
120
122
|
Fetcher 自带几个内置拦截器,它们会自动注册:
|
|
121
123
|
|
|
122
|
-
1. **UrlResolveInterceptor**:解析带路径和查询参数的 URL(顺序:Number.MIN_SAFE_INTEGER)
|
|
123
|
-
2. **RequestBodyInterceptor**:将对象体转换为 JSON 字符串(顺序:Number.MIN_SAFE_INTEGER +
|
|
124
|
-
3. **FetchInterceptor**:执行实际的 HTTP 请求(顺序:Number.MAX_SAFE_INTEGER)
|
|
124
|
+
1. **UrlResolveInterceptor**:解析带路径和查询参数的 URL(顺序:Number.MIN_SAFE_INTEGER + 100)
|
|
125
|
+
2. **RequestBodyInterceptor**:将对象体转换为 JSON 字符串(顺序:Number.MIN_SAFE_INTEGER + 200)
|
|
126
|
+
3. **FetchInterceptor**:执行实际的 HTTP 请求(顺序:Number.MAX_SAFE_INTEGER - 100)
|
|
125
127
|
|
|
126
128
|
### 使用拦截器
|
|
127
129
|
|
package/dist/fetchExchange.d.ts
CHANGED
|
@@ -1,89 +1,5 @@
|
|
|
1
1
|
import { Fetcher } from './fetcher';
|
|
2
|
-
import {
|
|
3
|
-
import { TimeoutCapable } from './timeout';
|
|
4
|
-
/**
|
|
5
|
-
* Fetcher request configuration interface
|
|
6
|
-
*
|
|
7
|
-
* This interface defines all the configuration options available for making HTTP requests
|
|
8
|
-
* with the Fetcher client. It extends the standard RequestInit interface while adding
|
|
9
|
-
* Fetcher-specific features like path parameters, query parameters, and timeout control.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const request: FetcherRequest = {
|
|
14
|
-
* method: 'GET',
|
|
15
|
-
* path: { id: 123 },
|
|
16
|
-
* query: { include: 'profile' },
|
|
17
|
-
* headers: { 'Authorization': 'Bearer token' },
|
|
18
|
-
* timeout: 5000
|
|
19
|
-
* };
|
|
20
|
-
*
|
|
21
|
-
* const response = await fetcher.fetch('/users/{id}', request);
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export interface FetcherRequest extends TimeoutCapable, HeadersCapable, Omit<RequestInit, 'body' | 'headers'> {
|
|
25
|
-
/**
|
|
26
|
-
* Path parameters for URL templating
|
|
27
|
-
*
|
|
28
|
-
* An object containing key-value pairs that will be used to replace placeholders
|
|
29
|
-
* in the URL path. Placeholders are specified using curly braces, e.g., '/users/{id}'.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```typescript
|
|
33
|
-
* // With URL '/users/{id}/posts/{postId}'
|
|
34
|
-
* const request = {
|
|
35
|
-
* path: { id: 123, postId: 456 }
|
|
36
|
-
* };
|
|
37
|
-
* // Results in URL: '/users/123/posts/456'
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
path?: Record<string, any>;
|
|
41
|
-
/**
|
|
42
|
-
* Query parameters for URL query string
|
|
43
|
-
*
|
|
44
|
-
* An object containing key-value pairs that will be serialized and appended
|
|
45
|
-
* to the URL as query parameters. Arrays are serialized as multiple parameters
|
|
46
|
-
* with the same name, and objects are JSON-stringified.
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```typescript
|
|
50
|
-
* const request = {
|
|
51
|
-
* query: {
|
|
52
|
-
* limit: 10,
|
|
53
|
-
* filter: 'active',
|
|
54
|
-
* tags: ['important', 'urgent']
|
|
55
|
-
* }
|
|
56
|
-
* };
|
|
57
|
-
* // Results in query string: '?limit=10&filter=active&tags=important&tags=urgent'
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
query?: Record<string, any>;
|
|
61
|
-
/**
|
|
62
|
-
* Request body
|
|
63
|
-
*
|
|
64
|
-
* The body of the request. Can be a string, Blob, ArrayBuffer, FormData,
|
|
65
|
-
* URLSearchParams, or a plain object. Plain objects are automatically
|
|
66
|
-
* converted to JSON and the appropriate Content-Type header is set.
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* ```typescript
|
|
70
|
-
* // Plain object (automatically converted to JSON)
|
|
71
|
-
* const request = {
|
|
72
|
-
* method: 'POST',
|
|
73
|
-
* body: { name: 'John', email: 'john@example.com' }
|
|
74
|
-
* };
|
|
75
|
-
*
|
|
76
|
-
* // FormData
|
|
77
|
-
* const formData = new FormData();
|
|
78
|
-
* formData.append('name', 'John');
|
|
79
|
-
* const request = {
|
|
80
|
-
* method: 'POST',
|
|
81
|
-
* body: formData
|
|
82
|
-
* };
|
|
83
|
-
* ```
|
|
84
|
-
*/
|
|
85
|
-
body?: BodyInit | Record<string, any> | null;
|
|
86
|
-
}
|
|
2
|
+
import { FetchRequest } from './fetchRequest';
|
|
87
3
|
/**
|
|
88
4
|
* FetchExchange Interface
|
|
89
5
|
*
|
|
@@ -129,13 +45,9 @@ export interface FetchExchange {
|
|
|
129
45
|
*/
|
|
130
46
|
fetcher: Fetcher;
|
|
131
47
|
/**
|
|
132
|
-
* The
|
|
133
|
-
*/
|
|
134
|
-
url: string;
|
|
135
|
-
/**
|
|
136
|
-
* The request configuration including method, headers, body, etc.
|
|
48
|
+
* The request configuration including url, method, headers, body, etc.
|
|
137
49
|
*/
|
|
138
|
-
request:
|
|
50
|
+
request: FetchRequest;
|
|
139
51
|
/**
|
|
140
52
|
* The response object, undefined until the request completes successfully
|
|
141
53
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchExchange.d.ts","sourceRoot":"","sources":["../src/fetchExchange.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"fetchExchange.d.ts","sourceRoot":"","sources":["../src/fetchExchange.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,OAAO,EAAE,YAAY,CAAC;IAEtB;;OAEG;IACH,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC;IAE/B;;OAEG;IACH,KAAK,EAAE,KAAK,GAAG,GAAG,GAAG,SAAS,CAAC;IAE/B;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAClC"}
|
|
@@ -23,12 +23,14 @@ export declare class FetchInterceptor implements Interceptor {
|
|
|
23
23
|
*/
|
|
24
24
|
name: string;
|
|
25
25
|
/**
|
|
26
|
-
* Interceptor execution order, set to maximum safe integer to ensure last execution
|
|
26
|
+
* Interceptor execution order, set to near maximum safe integer to ensure last execution
|
|
27
27
|
*
|
|
28
28
|
* @remarks
|
|
29
29
|
* Since this is the interceptor that actually executes HTTP requests, it should
|
|
30
30
|
* execute after all other request interceptors, so its order is set to
|
|
31
|
-
* Number.MAX_SAFE_INTEGER
|
|
31
|
+
* Number.MAX_SAFE_INTEGER - 100. This ensures that all request preprocessing is
|
|
32
|
+
* completed before the actual network request is made, while still allowing
|
|
33
|
+
* other interceptors to run after it if needed.
|
|
32
34
|
*/
|
|
33
35
|
order: number;
|
|
34
36
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchInterceptor.d.ts","sourceRoot":"","sources":["../src/fetchInterceptor.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;;;;;;;;GAYG;AACH,qBAAa,gBAAiB,YAAW,WAAW;IAClD;;;;;;OAMG;IACH,IAAI,SAAsB;IAE1B
|
|
1
|
+
{"version":3,"file":"fetchInterceptor.d.ts","sourceRoot":"","sources":["../src/fetchInterceptor.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;;;;;;;;GAYG;AACH,qBAAa,gBAAiB,YAAW,WAAW;IAClD;;;;;;OAMG;IACH,IAAI,SAAsB;IAE1B;;;;;;;;;OASG;IACH,KAAK,SAAiC;IAEtC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,SAAS,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;CAIjE"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { TimeoutCapable } from './timeout';
|
|
2
|
+
import { HeadersCapable } from './types';
|
|
3
|
+
import { UrlParams } from './urlBuilder';
|
|
4
|
+
/**
|
|
5
|
+
* Fetcher request configuration interface
|
|
6
|
+
*
|
|
7
|
+
* This interface defines all the configuration options available for making HTTP requests
|
|
8
|
+
* with the Fetcher client. It extends the standard RequestInit interface while adding
|
|
9
|
+
* Fetcher-specific features like path parameters, query parameters, and timeout control.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const request: FetchRequestInit = {
|
|
14
|
+
* method: 'GET',
|
|
15
|
+
* urlParams: {
|
|
16
|
+
* path: { id: 123 },
|
|
17
|
+
* query: { include: 'profile' }
|
|
18
|
+
* },
|
|
19
|
+
* headers: { 'Authorization': 'Bearer token' },
|
|
20
|
+
* timeout: 5000
|
|
21
|
+
* };
|
|
22
|
+
*
|
|
23
|
+
* const response = await fetcher.fetch('/users/{id}', request);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export interface FetchRequestInit extends TimeoutCapable, HeadersCapable, Omit<RequestInit, 'body' | 'headers'> {
|
|
27
|
+
urlParams?: UrlParams;
|
|
28
|
+
/**
|
|
29
|
+
* Request body
|
|
30
|
+
*
|
|
31
|
+
* The body of the request. Can be a string, Blob, ArrayBuffer, FormData,
|
|
32
|
+
* URLSearchParams, or a plain object. Plain objects are automatically
|
|
33
|
+
* converted to JSON and the appropriate Content-Type header is set.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* // Plain object (automatically converted to JSON)
|
|
38
|
+
* const request = {
|
|
39
|
+
* method: 'POST',
|
|
40
|
+
* body: { name: 'John', email: 'john@example.com' }
|
|
41
|
+
* };
|
|
42
|
+
*
|
|
43
|
+
* // FormData
|
|
44
|
+
* const formData = new FormData();
|
|
45
|
+
* formData.append('name', 'John');
|
|
46
|
+
* const request = {
|
|
47
|
+
* method: 'POST',
|
|
48
|
+
* body: formData
|
|
49
|
+
* };
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
body?: BodyInit | Record<string, any> | string | null;
|
|
53
|
+
}
|
|
54
|
+
export interface FetchRequest extends FetchRequestInit {
|
|
55
|
+
/**
|
|
56
|
+
* The URL for this request
|
|
57
|
+
*/
|
|
58
|
+
url: string;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=fetchRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchRequest.d.ts","sourceRoot":"","sources":["../src/fetchRequest.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,gBACf,SAAQ,cAAc,EACpB,cAAc,EACd,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC;CACvD;AAED,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb"}
|
package/dist/fetcher.d.ts
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import { UrlBuilder, UrlBuilderCapable } from './urlBuilder';
|
|
2
2
|
import { TimeoutCapable } from './timeout';
|
|
3
|
-
import { BaseURLCapable, HeadersCapable
|
|
3
|
+
import { BaseURLCapable, HeadersCapable } from './types';
|
|
4
4
|
import { FetcherInterceptors } from './interceptor';
|
|
5
|
-
import {
|
|
5
|
+
import { FetchExchange } from './fetchExchange';
|
|
6
|
+
import { FetchRequest, FetchRequestInit } from './fetchRequest';
|
|
6
7
|
/**
|
|
7
8
|
* Fetcher configuration options interface
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const options: FetcherOptions = {
|
|
13
|
+
* baseURL: 'https://api.example.com',
|
|
14
|
+
* headers: { 'Content-Type': 'application/json' },
|
|
15
|
+
* timeout: 5000,
|
|
16
|
+
* interceptors: new FetcherInterceptors()
|
|
17
|
+
* };
|
|
18
|
+
* ```
|
|
8
19
|
*/
|
|
9
20
|
export interface FetcherOptions extends BaseURLCapable, HeadersCapable, TimeoutCapable {
|
|
10
21
|
interceptors?: FetcherInterceptors;
|
|
@@ -14,12 +25,16 @@ export declare const DEFAULT_OPTIONS: FetcherOptions;
|
|
|
14
25
|
* HTTP client class that supports URL building, timeout control, and more
|
|
15
26
|
*
|
|
16
27
|
* @example
|
|
28
|
+
* ```typescript
|
|
17
29
|
* const fetcher = new Fetcher({ baseURL: 'https://api.example.com' });
|
|
18
30
|
* const response = await fetcher.fetch('/users/{id}', {
|
|
19
|
-
*
|
|
20
|
-
*
|
|
31
|
+
* urlParams: {
|
|
32
|
+
* path: { id: 123 },
|
|
33
|
+
* query: { filter: 'active' }
|
|
34
|
+
* },
|
|
21
35
|
* timeout: 5000
|
|
22
36
|
* });
|
|
37
|
+
* ```
|
|
23
38
|
*/
|
|
24
39
|
export declare class Fetcher implements UrlBuilderCapable, HeadersCapable, TimeoutCapable {
|
|
25
40
|
urlBuilder: UrlBuilder;
|
|
@@ -39,17 +54,16 @@ export declare class Fetcher implements UrlBuilderCapable, HeadersCapable, Timeo
|
|
|
39
54
|
* @param request - Request options, including path parameters, query parameters, etc.
|
|
40
55
|
* @returns Promise<Response> HTTP response
|
|
41
56
|
*/
|
|
42
|
-
fetch(url: string, request?:
|
|
57
|
+
fetch(url: string, request?: FetchRequestInit): Promise<Response>;
|
|
43
58
|
/**
|
|
44
59
|
* Send an HTTP request
|
|
45
60
|
*
|
|
46
|
-
* @param
|
|
47
|
-
* @param request - Request configuration object, including method, headers, body, etc.
|
|
61
|
+
* @param request - Request configuration object, including url, method, headers, body, etc.
|
|
48
62
|
* @returns Promise that resolves to a FetchExchange object containing request and response information
|
|
49
63
|
*
|
|
50
64
|
* @throws Throws an exception when an error occurs during the request and is not handled by error interceptors
|
|
51
65
|
*/
|
|
52
|
-
request(
|
|
66
|
+
request(request: FetchRequest): Promise<FetchExchange>;
|
|
53
67
|
/**
|
|
54
68
|
* Process a fetch exchange through the interceptor chain
|
|
55
69
|
*
|
|
@@ -83,7 +97,7 @@ export declare class Fetcher implements UrlBuilderCapable, HeadersCapable, Timeo
|
|
|
83
97
|
* @param request - Request options, including path parameters, query parameters, etc.
|
|
84
98
|
* @returns Promise<Response> HTTP response
|
|
85
99
|
*/
|
|
86
|
-
get(url: string, request?: Omit<
|
|
100
|
+
get(url: string, request?: Omit<FetchRequestInit, 'method' | 'body'>): Promise<Response>;
|
|
87
101
|
/**
|
|
88
102
|
* Make a POST request
|
|
89
103
|
*
|
|
@@ -91,7 +105,7 @@ export declare class Fetcher implements UrlBuilderCapable, HeadersCapable, Timeo
|
|
|
91
105
|
* @param request - Request options, including path parameters, query parameters, request body, etc.
|
|
92
106
|
* @returns Promise<Response> HTTP response
|
|
93
107
|
*/
|
|
94
|
-
post(url: string, request?: Omit<
|
|
108
|
+
post(url: string, request?: Omit<FetchRequestInit, 'method'>): Promise<Response>;
|
|
95
109
|
/**
|
|
96
110
|
* Make a PUT request
|
|
97
111
|
*
|
|
@@ -99,7 +113,7 @@ export declare class Fetcher implements UrlBuilderCapable, HeadersCapable, Timeo
|
|
|
99
113
|
* @param request - Request options, including path parameters, query parameters, request body, etc.
|
|
100
114
|
* @returns Promise<Response> HTTP response
|
|
101
115
|
*/
|
|
102
|
-
put(url: string, request?: Omit<
|
|
116
|
+
put(url: string, request?: Omit<FetchRequestInit, 'method'>): Promise<Response>;
|
|
103
117
|
/**
|
|
104
118
|
* Make a DELETE request
|
|
105
119
|
*
|
|
@@ -107,7 +121,7 @@ export declare class Fetcher implements UrlBuilderCapable, HeadersCapable, Timeo
|
|
|
107
121
|
* @param request - Request options, including path parameters, query parameters, etc.
|
|
108
122
|
* @returns Promise<Response> HTTP response
|
|
109
123
|
*/
|
|
110
|
-
delete(url: string, request?: Omit<
|
|
124
|
+
delete(url: string, request?: Omit<FetchRequestInit, 'method'>): Promise<Response>;
|
|
111
125
|
/**
|
|
112
126
|
* Make a PATCH request
|
|
113
127
|
*
|
|
@@ -115,7 +129,7 @@ export declare class Fetcher implements UrlBuilderCapable, HeadersCapable, Timeo
|
|
|
115
129
|
* @param request - Request options, including path parameters, query parameters, request body, etc.
|
|
116
130
|
* @returns Promise<Response> HTTP response
|
|
117
131
|
*/
|
|
118
|
-
patch(url: string, request?: Omit<
|
|
132
|
+
patch(url: string, request?: Omit<FetchRequestInit, 'method'>): Promise<Response>;
|
|
119
133
|
/**
|
|
120
134
|
* Make a HEAD request
|
|
121
135
|
*
|
|
@@ -123,7 +137,7 @@ export declare class Fetcher implements UrlBuilderCapable, HeadersCapable, Timeo
|
|
|
123
137
|
* @param request - Request options, including path parameters, query parameters, etc.
|
|
124
138
|
* @returns Promise<Response> HTTP response
|
|
125
139
|
*/
|
|
126
|
-
head(url: string, request?: Omit<
|
|
140
|
+
head(url: string, request?: Omit<FetchRequestInit, 'method' | 'body'>): Promise<Response>;
|
|
127
141
|
/**
|
|
128
142
|
* Make an OPTIONS request
|
|
129
143
|
*
|
|
@@ -131,6 +145,6 @@ export declare class Fetcher implements UrlBuilderCapable, HeadersCapable, Timeo
|
|
|
131
145
|
* @param request - Request options, including path parameters, query parameters, etc.
|
|
132
146
|
* @returns Promise<Response> HTTP response
|
|
133
147
|
*/
|
|
134
|
-
options(url: string, request?: Omit<
|
|
148
|
+
options(url: string, request?: Omit<FetchRequestInit, 'method' | 'body'>): Promise<Response>;
|
|
135
149
|
}
|
|
136
150
|
//# sourceMappingURL=fetcher.d.ts.map
|
package/dist/fetcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../src/fetcher.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAkB,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EACL,cAAc,EAGd,cAAc,
|
|
1
|
+
{"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../src/fetcher.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAkB,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EACL,cAAc,EAGd,cAAc,EAEf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGhE;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,cACf,SAAQ,cAAc,EACpB,cAAc,EACd,cAAc;IAChB,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAMD,eAAO,MAAM,eAAe,EAAE,cAG7B,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,qBAAa,OACX,YAAW,iBAAiB,EAAE,cAAc,EAAE,cAAc;IAE5D,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAmB;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,mBAAmB,CAAC;IAElC;;;;OAIG;gBACS,OAAO,GAAE,cAAgC;IAOrD;;;;;;OAMG;IACG,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAU3E;;;;;;;OAOG;IACG,OAAO,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAmB5D;;;;;;;;;;;;;;;OAeG;IACG,QAAQ,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAkBpE;;;;;;;OAOG;YACW,WAAW;IAWzB;;;;;;OAMG;IACG,GAAG,CACP,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,MAAM,CAAM,GACtD,OAAO,CAAC,QAAQ,CAAC;IAIpB;;;;;;OAMG;IACG,IAAI,CACR,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAM,GAC7C,OAAO,CAAC,QAAQ,CAAC;IAIpB;;;;;;OAMG;IACG,GAAG,CACP,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAM,GAC7C,OAAO,CAAC,QAAQ,CAAC;IAIpB;;;;;;OAMG;IACG,MAAM,CACV,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAM,GAC7C,OAAO,CAAC,QAAQ,CAAC;IAIpB;;;;;;OAMG;IACG,KAAK,CACT,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAM,GAC7C,OAAO,CAAC,QAAQ,CAAC;IAIpB;;;;;;OAMG;IACG,IAAI,CACR,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,MAAM,CAAM,GACtD,OAAO,CAAC,QAAQ,CAAC;IAIpB;;;;;;OAMG;IACG,OAAO,CACX,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,MAAM,CAAM,GACtD,OAAO,CAAC,QAAQ,CAAC;CAGrB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './fetcher';
|
|
|
2
2
|
export * from './fetcherRegistrar';
|
|
3
3
|
export * from './fetchExchange';
|
|
4
4
|
export * from './fetchInterceptor';
|
|
5
|
+
export * from './fetchRequest';
|
|
5
6
|
export * from './interceptor';
|
|
6
7
|
export * from './mergeRequest';
|
|
7
8
|
export * from './namedFetcher';
|
|
@@ -12,4 +13,5 @@ export * from './types';
|
|
|
12
13
|
export * from './urlBuilder';
|
|
13
14
|
export * from './urlResolveInterceptor';
|
|
14
15
|
export * from './urls';
|
|
16
|
+
export * from './utils';
|
|
15
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|