@ahoo-wang/fetcher 0.8.3 → 0.8.6
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 +4 -2
- package/README.zh-CN.md +4 -2
- package/dist/fetchExchange.d.ts +3 -91
- package/dist/fetchExchange.d.ts.map +1 -1
- package/dist/fetchInterceptor.d.ts.map +1 -1
- package/dist/fetchRequest.d.ts +95 -0
- package/dist/fetchRequest.d.ts.map +1 -0
- package/dist/fetcher.d.ts +31 -18
- 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 +143 -129
- 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.map +1 -1
- package/dist/timeout.d.ts +4 -14
- package/dist/timeout.d.ts.map +1 -1
- package/dist/types.d.ts +0 -34
- package/dist/types.d.ts.map +1 -1
- package/dist/urlBuilder.d.ts +81 -16
- package/dist/urlBuilder.d.ts.map +1 -1
- 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
|
|
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
|
|
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"}
|
|
@@ -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;;;;;;;;;OASG;IACH,KAAK,SAAiC;IAEtC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,SAAS,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;
|
|
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,95 @@
|
|
|
1
|
+
import { TimeoutCapable } from './timeout';
|
|
2
|
+
import { UrlParams } from './urlBuilder';
|
|
3
|
+
export interface BaseURLCapable {
|
|
4
|
+
/**
|
|
5
|
+
* 请求的 baseURL
|
|
6
|
+
* 当值为空时,表示不设置 baseURL,默认值为 undefined
|
|
7
|
+
*/
|
|
8
|
+
baseURL: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* HTTP方法枚举常量
|
|
12
|
+
*/
|
|
13
|
+
export declare enum HttpMethod {
|
|
14
|
+
GET = "GET",
|
|
15
|
+
POST = "POST",
|
|
16
|
+
PUT = "PUT",
|
|
17
|
+
DELETE = "DELETE",
|
|
18
|
+
PATCH = "PATCH",
|
|
19
|
+
HEAD = "HEAD",
|
|
20
|
+
OPTIONS = "OPTIONS"
|
|
21
|
+
}
|
|
22
|
+
export declare const ContentTypeHeader = "Content-Type";
|
|
23
|
+
export declare enum ContentTypeValues {
|
|
24
|
+
APPLICATION_JSON = "application/json",
|
|
25
|
+
TEXT_EVENT_STREAM = "text/event-stream"
|
|
26
|
+
}
|
|
27
|
+
export interface RequestHeaders {
|
|
28
|
+
'Content-Type'?: string;
|
|
29
|
+
'Accept'?: string;
|
|
30
|
+
'Authorization'?: string;
|
|
31
|
+
[key: string]: string | undefined;
|
|
32
|
+
}
|
|
33
|
+
export interface RequestHeadersCapable {
|
|
34
|
+
/**
|
|
35
|
+
* Request headers
|
|
36
|
+
*/
|
|
37
|
+
headers?: RequestHeaders;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Fetcher request configuration interface
|
|
41
|
+
*
|
|
42
|
+
* This interface defines all the configuration options available for making HTTP requests
|
|
43
|
+
* with the Fetcher client. It extends the standard RequestInit interface while adding
|
|
44
|
+
* Fetcher-specific features like path parameters, query parameters, and timeout control.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* const request: FetchRequestInit = {
|
|
49
|
+
* method: 'GET',
|
|
50
|
+
* urlParams: {
|
|
51
|
+
* path: { id: 123 },
|
|
52
|
+
* query: { include: 'profile' }
|
|
53
|
+
* },
|
|
54
|
+
* headers: { 'Authorization': 'Bearer token' },
|
|
55
|
+
* timeout: 5000
|
|
56
|
+
* };
|
|
57
|
+
*
|
|
58
|
+
* const response = await fetcher.fetch('/users/{id}', request);
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export interface FetchRequestInit extends TimeoutCapable, RequestHeadersCapable, Omit<RequestInit, 'body' | 'headers'> {
|
|
62
|
+
urlParams?: UrlParams;
|
|
63
|
+
/**
|
|
64
|
+
* Request body
|
|
65
|
+
*
|
|
66
|
+
* The body of the request. Can be a string, Blob, ArrayBuffer, FormData,
|
|
67
|
+
* URLSearchParams, or a plain object. Plain objects are automatically
|
|
68
|
+
* converted to JSON and the appropriate Content-Type header is set.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* // Plain object (automatically converted to JSON)
|
|
73
|
+
* const request = {
|
|
74
|
+
* method: 'POST',
|
|
75
|
+
* body: { name: 'John', email: 'john@example.com' }
|
|
76
|
+
* };
|
|
77
|
+
*
|
|
78
|
+
* // FormData
|
|
79
|
+
* const formData = new FormData();
|
|
80
|
+
* formData.append('name', 'John');
|
|
81
|
+
* const request = {
|
|
82
|
+
* method: 'POST',
|
|
83
|
+
* body: formData
|
|
84
|
+
* };
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
body?: BodyInit | Record<string, any> | string | null;
|
|
88
|
+
}
|
|
89
|
+
export interface FetchRequest extends FetchRequestInit {
|
|
90
|
+
/**
|
|
91
|
+
* The URL for this request
|
|
92
|
+
*/
|
|
93
|
+
url: string;
|
|
94
|
+
}
|
|
95
|
+
//# 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,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,oBAAY,UAAU;IACpB,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,oBAAY,iBAAiB;IAC3B,gBAAgB,qBAAqB;IACrC,iBAAiB,sBAAsB;CACxC;AAED,MAAM,WAAW,cAAc;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACnC;AAED,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,gBACf,SAAQ,cAAc,EACpB,qBAAqB,EACrB,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,12 +1,22 @@
|
|
|
1
1
|
import { UrlBuilder, UrlBuilderCapable } from './urlBuilder';
|
|
2
2
|
import { TimeoutCapable } from './timeout';
|
|
3
|
-
import { BaseURLCapable, HeadersCapable, RequestField } from './types';
|
|
4
3
|
import { FetcherInterceptors } from './interceptor';
|
|
5
|
-
import {
|
|
4
|
+
import { FetchExchange } from './fetchExchange';
|
|
5
|
+
import { BaseURLCapable, FetchRequest, FetchRequestInit, RequestHeaders, RequestHeadersCapable } from './fetchRequest';
|
|
6
6
|
/**
|
|
7
7
|
* Fetcher configuration options interface
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const options: FetcherOptions = {
|
|
12
|
+
* baseURL: 'https://api.example.com',
|
|
13
|
+
* headers: { 'Content-Type': 'application/json' },
|
|
14
|
+
* timeout: 5000,
|
|
15
|
+
* interceptors: new FetcherInterceptors()
|
|
16
|
+
* };
|
|
17
|
+
* ```
|
|
8
18
|
*/
|
|
9
|
-
export interface FetcherOptions extends BaseURLCapable,
|
|
19
|
+
export interface FetcherOptions extends BaseURLCapable, RequestHeadersCapable, TimeoutCapable {
|
|
10
20
|
interceptors?: FetcherInterceptors;
|
|
11
21
|
}
|
|
12
22
|
export declare const DEFAULT_OPTIONS: FetcherOptions;
|
|
@@ -14,16 +24,20 @@ export declare const DEFAULT_OPTIONS: FetcherOptions;
|
|
|
14
24
|
* HTTP client class that supports URL building, timeout control, and more
|
|
15
25
|
*
|
|
16
26
|
* @example
|
|
27
|
+
* ```typescript
|
|
17
28
|
* const fetcher = new Fetcher({ baseURL: 'https://api.example.com' });
|
|
18
29
|
* const response = await fetcher.fetch('/users/{id}', {
|
|
19
|
-
*
|
|
20
|
-
*
|
|
30
|
+
* urlParams: {
|
|
31
|
+
* path: { id: 123 },
|
|
32
|
+
* query: { filter: 'active' }
|
|
33
|
+
* },
|
|
21
34
|
* timeout: 5000
|
|
22
35
|
* });
|
|
36
|
+
* ```
|
|
23
37
|
*/
|
|
24
|
-
export declare class Fetcher implements UrlBuilderCapable,
|
|
38
|
+
export declare class Fetcher implements UrlBuilderCapable, RequestHeadersCapable, TimeoutCapable {
|
|
25
39
|
urlBuilder: UrlBuilder;
|
|
26
|
-
headers?:
|
|
40
|
+
headers?: RequestHeaders;
|
|
27
41
|
timeout?: number;
|
|
28
42
|
interceptors: FetcherInterceptors;
|
|
29
43
|
/**
|
|
@@ -39,17 +53,16 @@ export declare class Fetcher implements UrlBuilderCapable, HeadersCapable, Timeo
|
|
|
39
53
|
* @param request - Request options, including path parameters, query parameters, etc.
|
|
40
54
|
* @returns Promise<Response> HTTP response
|
|
41
55
|
*/
|
|
42
|
-
fetch(url: string, request?:
|
|
56
|
+
fetch(url: string, request?: FetchRequestInit): Promise<Response>;
|
|
43
57
|
/**
|
|
44
58
|
* Send an HTTP request
|
|
45
59
|
*
|
|
46
|
-
* @param
|
|
47
|
-
* @param request - Request configuration object, including method, headers, body, etc.
|
|
60
|
+
* @param request - Request configuration object, including url, method, headers, body, etc.
|
|
48
61
|
* @returns Promise that resolves to a FetchExchange object containing request and response information
|
|
49
62
|
*
|
|
50
63
|
* @throws Throws an exception when an error occurs during the request and is not handled by error interceptors
|
|
51
64
|
*/
|
|
52
|
-
request(
|
|
65
|
+
request(request: FetchRequest): Promise<FetchExchange>;
|
|
53
66
|
/**
|
|
54
67
|
* Process a fetch exchange through the interceptor chain
|
|
55
68
|
*
|
|
@@ -83,7 +96,7 @@ export declare class Fetcher implements UrlBuilderCapable, HeadersCapable, Timeo
|
|
|
83
96
|
* @param request - Request options, including path parameters, query parameters, etc.
|
|
84
97
|
* @returns Promise<Response> HTTP response
|
|
85
98
|
*/
|
|
86
|
-
get(url: string, request?: Omit<
|
|
99
|
+
get(url: string, request?: Omit<FetchRequestInit, 'method' | 'body'>): Promise<Response>;
|
|
87
100
|
/**
|
|
88
101
|
* Make a POST request
|
|
89
102
|
*
|
|
@@ -91,7 +104,7 @@ export declare class Fetcher implements UrlBuilderCapable, HeadersCapable, Timeo
|
|
|
91
104
|
* @param request - Request options, including path parameters, query parameters, request body, etc.
|
|
92
105
|
* @returns Promise<Response> HTTP response
|
|
93
106
|
*/
|
|
94
|
-
post(url: string, request?: Omit<
|
|
107
|
+
post(url: string, request?: Omit<FetchRequestInit, 'method'>): Promise<Response>;
|
|
95
108
|
/**
|
|
96
109
|
* Make a PUT request
|
|
97
110
|
*
|
|
@@ -99,7 +112,7 @@ export declare class Fetcher implements UrlBuilderCapable, HeadersCapable, Timeo
|
|
|
99
112
|
* @param request - Request options, including path parameters, query parameters, request body, etc.
|
|
100
113
|
* @returns Promise<Response> HTTP response
|
|
101
114
|
*/
|
|
102
|
-
put(url: string, request?: Omit<
|
|
115
|
+
put(url: string, request?: Omit<FetchRequestInit, 'method'>): Promise<Response>;
|
|
103
116
|
/**
|
|
104
117
|
* Make a DELETE request
|
|
105
118
|
*
|
|
@@ -107,7 +120,7 @@ export declare class Fetcher implements UrlBuilderCapable, HeadersCapable, Timeo
|
|
|
107
120
|
* @param request - Request options, including path parameters, query parameters, etc.
|
|
108
121
|
* @returns Promise<Response> HTTP response
|
|
109
122
|
*/
|
|
110
|
-
delete(url: string, request?: Omit<
|
|
123
|
+
delete(url: string, request?: Omit<FetchRequestInit, 'method'>): Promise<Response>;
|
|
111
124
|
/**
|
|
112
125
|
* Make a PATCH request
|
|
113
126
|
*
|
|
@@ -115,7 +128,7 @@ export declare class Fetcher implements UrlBuilderCapable, HeadersCapable, Timeo
|
|
|
115
128
|
* @param request - Request options, including path parameters, query parameters, request body, etc.
|
|
116
129
|
* @returns Promise<Response> HTTP response
|
|
117
130
|
*/
|
|
118
|
-
patch(url: string, request?: Omit<
|
|
131
|
+
patch(url: string, request?: Omit<FetchRequestInit, 'method'>): Promise<Response>;
|
|
119
132
|
/**
|
|
120
133
|
* Make a HEAD request
|
|
121
134
|
*
|
|
@@ -123,7 +136,7 @@ export declare class Fetcher implements UrlBuilderCapable, HeadersCapable, Timeo
|
|
|
123
136
|
* @param request - Request options, including path parameters, query parameters, etc.
|
|
124
137
|
* @returns Promise<Response> HTTP response
|
|
125
138
|
*/
|
|
126
|
-
head(url: string, request?: Omit<
|
|
139
|
+
head(url: string, request?: Omit<FetchRequestInit, 'method' | 'body'>): Promise<Response>;
|
|
127
140
|
/**
|
|
128
141
|
* Make an OPTIONS request
|
|
129
142
|
*
|
|
@@ -131,6 +144,6 @@ export declare class Fetcher implements UrlBuilderCapable, HeadersCapable, Timeo
|
|
|
131
144
|
* @param request - Request options, including path parameters, query parameters, etc.
|
|
132
145
|
* @returns Promise<Response> HTTP response
|
|
133
146
|
*/
|
|
134
|
-
options(url: string, request?: Omit<
|
|
147
|
+
options(url: string, request?: Omit<FetchRequestInit, 'method' | 'body'>): Promise<Response>;
|
|
135
148
|
}
|
|
136
149
|
//# 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,
|
|
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,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,cAAc,EAEd,YAAY,EACZ,gBAAgB,EAEhB,cAAc,EACd,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAGxB;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,cACf,SAAQ,cAAc,EACpB,qBAAqB,EACrB,cAAc;IAChB,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAMD,eAAO,MAAM,eAAe,EAAE,cAG7B,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,qBAAa,OACX,YAAW,iBAAiB,EAAE,qBAAqB,EAAE,cAAc;IAEnE,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,cAAc,CAAmB;IAC3C,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"}
|