@ahoo-wang/fetcher 0.0.7 → 0.0.9
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.map +1 -1
- package/dist/index.es.js +85 -78
- package/dist/index.umd.js +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/fetcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../src/fetcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAqC,cAAc,EAAE,MAAM,WAAW,CAAC;AAC9E,OAAO,EACL,cAAc,
|
|
1
|
+
{"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../src/fetcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAqC,cAAc,EAAE,MAAM,WAAW,CAAC;AAC9E,OAAO,EACL,cAAc,EAGd,cAAc,EAEd,YAAY,EACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,cACf,SAAQ,cAAc,EACpB,cAAc,EACd,cAAc;CAAG;AAWrB;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,cAAc,EAAE,WAAW;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACnC;AAED;;;;;;;;;;GAUG;AACH,qBAAa,OAAQ,YAAW,cAAc,EAAE,cAAc;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAkB;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,UAAU,CAAa;IAC/B,YAAY,EAAE,mBAAmB,CAA6B;IAE9D;;;;OAIG;gBACS,OAAO,GAAE,cAA+B;IAQpD;;;;;;OAMG;IACG,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAoCzE;;;;;;;;;;OAUG;YACW,YAAY;IAoC1B;;;;;;OAMG;IACG,GAAG,CACP,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,MAAM,GAAG,YAAY,CAAC,IAAI,CAAM,GAC1E,OAAO,CAAC,QAAQ,CAAC;IAOpB;;;;;;OAMG;IACG,IAAI,CACR,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,MAAM,CAAM,GACtD,OAAO,CAAC,QAAQ,CAAC;IAOpB;;;;;;OAMG;IACG,GAAG,CACP,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,MAAM,CAAM,GACtD,OAAO,CAAC,QAAQ,CAAC;IAOpB;;;;;;OAMG;IACG,MAAM,CACV,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,MAAM,CAAM,GACtD,OAAO,CAAC,QAAQ,CAAC;IAOpB;;;;;;OAMG;IACG,KAAK,CACT,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,MAAM,CAAM,GACtD,OAAO,CAAC,QAAQ,CAAC;IAOpB;;;;;;OAMG;IACG,IAAI,CACR,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,MAAM,GAAG,YAAY,CAAC,IAAI,CAAM,GAC1E,OAAO,CAAC,QAAQ,CAAC;IAOpB;;;;;;OAMG;IACG,OAAO,CACX,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,MAAM,GAAG,YAAY,CAAC,IAAI,CAAM,GAC1E,OAAO,CAAC,QAAQ,CAAC;CAMrB"}
|
package/dist/index.es.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
function
|
|
1
|
+
function m(r) {
|
|
2
2
|
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(r);
|
|
3
3
|
}
|
|
4
|
-
function
|
|
5
|
-
return
|
|
4
|
+
function T(r, e) {
|
|
5
|
+
return m(e) ? e : e ? r.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : r;
|
|
6
6
|
}
|
|
7
|
-
class
|
|
7
|
+
class E {
|
|
8
8
|
/**
|
|
9
9
|
* 创建UrlBuilder实例
|
|
10
10
|
*
|
|
11
11
|
* @param baseURL - 基础URL,所有构建的URL都将基于此URL
|
|
12
12
|
*/
|
|
13
|
-
constructor(
|
|
14
|
-
this.baseURL =
|
|
13
|
+
constructor(e) {
|
|
14
|
+
this.baseURL = e;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* 构建完整的URL,包括路径参数替换和查询参数添加
|
|
@@ -22,8 +22,8 @@ class d {
|
|
|
22
22
|
* @returns 完整的URL字符串
|
|
23
23
|
* @throws 当路径参数中缺少必需的占位符时抛出错误
|
|
24
24
|
*/
|
|
25
|
-
build(
|
|
26
|
-
let i =
|
|
25
|
+
build(e, t, s) {
|
|
26
|
+
let i = T(this.baseURL, e), o = this.interpolateUrl(i, t);
|
|
27
27
|
if (s) {
|
|
28
28
|
const n = new URLSearchParams(s).toString();
|
|
29
29
|
n && (o += "?" + n);
|
|
@@ -38,26 +38,28 @@ class d {
|
|
|
38
38
|
* @returns 替换占位符后的路径字符串
|
|
39
39
|
* @throws 当路径参数中缺少必需的占位符时抛出错误
|
|
40
40
|
*/
|
|
41
|
-
interpolateUrl(
|
|
42
|
-
return
|
|
43
|
-
const o =
|
|
41
|
+
interpolateUrl(e, t) {
|
|
42
|
+
return t ? e.replace(/{([^}]+)}/g, (s, i) => {
|
|
43
|
+
const o = t[i];
|
|
44
44
|
if (o === void 0)
|
|
45
45
|
throw new Error(`Missing required path parameter: ${i}`);
|
|
46
46
|
return String(o);
|
|
47
|
-
}) :
|
|
47
|
+
}) : e;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
return typeof r < "u" ? r :
|
|
50
|
+
function P(r, e) {
|
|
51
|
+
return typeof r < "u" ? r : e;
|
|
52
52
|
}
|
|
53
|
-
class
|
|
54
|
-
constructor(
|
|
55
|
-
const i = `Request timeout of ${s}ms exceeded for ${
|
|
56
|
-
super(i), this.name = "FetchTimeoutError", this.url =
|
|
53
|
+
class h extends Error {
|
|
54
|
+
constructor(e, t, s) {
|
|
55
|
+
const i = `Request timeout of ${s}ms exceeded for ${t?.method || "GET"} ${e}`;
|
|
56
|
+
super(i), this.name = "FetchTimeoutError", this.url = e, this.request = t, Object.setPrototypeOf(this, h.prototype);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
var c = /* @__PURE__ */ ((r) => (r.GET = "GET", r.POST = "POST", r.PUT = "PUT", r.DELETE = "DELETE", r.PATCH = "PATCH", r.HEAD = "HEAD", r.OPTIONS = "OPTIONS", r))(c || {}),
|
|
60
|
-
|
|
59
|
+
var c = /* @__PURE__ */ ((r) => (r.GET = "GET", r.POST = "POST", r.PUT = "PUT", r.DELETE = "DELETE", r.PATCH = "PATCH", r.HEAD = "HEAD", r.OPTIONS = "OPTIONS", r))(c || {}), y = /* @__PURE__ */ ((r) => (r.METHOD = "method", r.BODY = "body", r))(y || {});
|
|
60
|
+
const O = "Content-Type";
|
|
61
|
+
var d = /* @__PURE__ */ ((r) => (r.APPLICATION_JSON = "application/json", r.TEXT_EVENT_STREAM = "text/event-stream", r))(d || {});
|
|
62
|
+
class a {
|
|
61
63
|
constructor() {
|
|
62
64
|
this.interceptors = [];
|
|
63
65
|
}
|
|
@@ -66,16 +68,16 @@ class h {
|
|
|
66
68
|
* @param interceptor - 要添加的拦截器
|
|
67
69
|
* @returns 拦截器在管理器中的索引位置
|
|
68
70
|
*/
|
|
69
|
-
use(
|
|
70
|
-
const
|
|
71
|
-
return this.interceptors.push(
|
|
71
|
+
use(e) {
|
|
72
|
+
const t = this.interceptors.length;
|
|
73
|
+
return this.interceptors.push(e), t;
|
|
72
74
|
}
|
|
73
75
|
/**
|
|
74
76
|
* 根据索引移除拦截器
|
|
75
77
|
* @param index - 要移除的拦截器索引
|
|
76
78
|
*/
|
|
77
|
-
eject(
|
|
78
|
-
this.interceptors[
|
|
79
|
+
eject(e) {
|
|
80
|
+
this.interceptors[e] && (this.interceptors[e] = null);
|
|
79
81
|
}
|
|
80
82
|
/**
|
|
81
83
|
* 清空所有拦截器
|
|
@@ -88,29 +90,32 @@ class h {
|
|
|
88
90
|
* @param data - 需要处理的数据
|
|
89
91
|
* @returns 经过所有拦截器处理后的数据
|
|
90
92
|
*/
|
|
91
|
-
async intercept(
|
|
92
|
-
let
|
|
93
|
+
async intercept(e) {
|
|
94
|
+
let t = e;
|
|
93
95
|
for (let s of this.interceptors)
|
|
94
|
-
s && (
|
|
95
|
-
return
|
|
96
|
+
s && (t = await s.intercept(t));
|
|
97
|
+
return t;
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
100
|
class w {
|
|
99
101
|
constructor() {
|
|
100
|
-
this.request = new
|
|
102
|
+
this.request = new a(), this.response = new a(), this.error = new a();
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
+
const f = {
|
|
106
|
+
[O]: d.APPLICATION_JSON
|
|
107
|
+
}, b = {
|
|
108
|
+
baseURL: "",
|
|
109
|
+
headers: f
|
|
105
110
|
};
|
|
106
|
-
class
|
|
111
|
+
class A {
|
|
107
112
|
/**
|
|
108
113
|
* 创建Fetcher实例
|
|
109
114
|
*
|
|
110
115
|
* @param options - Fetcher配置选项
|
|
111
116
|
*/
|
|
112
|
-
constructor(
|
|
113
|
-
this.interceptors = new w(), this.urlBuilder = new
|
|
117
|
+
constructor(e = b) {
|
|
118
|
+
this.headers = f, this.interceptors = new w(), this.urlBuilder = new E(e.baseURL), e.headers !== void 0 && (this.headers = e.headers), this.timeout = e.timeout;
|
|
114
119
|
}
|
|
115
120
|
/**
|
|
116
121
|
* 发起HTTP请求
|
|
@@ -119,19 +124,19 @@ class O {
|
|
|
119
124
|
* @param request - 请求选项,包括路径参数、查询参数等
|
|
120
125
|
* @returns Promise<Response> HTTP响应
|
|
121
126
|
*/
|
|
122
|
-
async fetch(
|
|
127
|
+
async fetch(e, t = {}) {
|
|
123
128
|
const s = {
|
|
124
129
|
...this.headers || {},
|
|
125
|
-
...
|
|
130
|
+
...t.headers || {}
|
|
126
131
|
};
|
|
127
132
|
let i = {
|
|
128
|
-
...
|
|
133
|
+
...t,
|
|
129
134
|
headers: Object.keys(s).length > 0 ? s : void 0
|
|
130
135
|
};
|
|
131
136
|
const o = this.urlBuilder.build(
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
137
|
+
e,
|
|
138
|
+
t.pathParams,
|
|
139
|
+
t.queryParams
|
|
135
140
|
);
|
|
136
141
|
i = await this.interceptors.request.intercept(i);
|
|
137
142
|
try {
|
|
@@ -152,24 +157,24 @@ class O {
|
|
|
152
157
|
* @returns Promise<Response> HTTP响应Promise
|
|
153
158
|
* @throws FetchTimeoutError 当请求超时时抛出
|
|
154
159
|
*/
|
|
155
|
-
async timeoutFetch(
|
|
156
|
-
const s =
|
|
160
|
+
async timeoutFetch(e, t) {
|
|
161
|
+
const s = P(t.timeout, this.timeout);
|
|
157
162
|
if (!s)
|
|
158
|
-
return fetch(
|
|
163
|
+
return fetch(e, t);
|
|
159
164
|
const i = new AbortController(), o = {
|
|
160
|
-
...
|
|
165
|
+
...t,
|
|
161
166
|
signal: i.signal
|
|
162
167
|
};
|
|
163
168
|
let n = null;
|
|
164
|
-
const u = new Promise((
|
|
169
|
+
const u = new Promise((g, p) => {
|
|
165
170
|
n = setTimeout(() => {
|
|
166
171
|
n && clearTimeout(n);
|
|
167
|
-
const l = new
|
|
168
|
-
i.abort(l),
|
|
172
|
+
const l = new h(e, t, s);
|
|
173
|
+
i.abort(l), p(l);
|
|
169
174
|
}, s);
|
|
170
175
|
});
|
|
171
176
|
try {
|
|
172
|
-
return await Promise.race([fetch(
|
|
177
|
+
return await Promise.race([fetch(e, o), u]);
|
|
173
178
|
} finally {
|
|
174
179
|
n && clearTimeout(n);
|
|
175
180
|
}
|
|
@@ -181,9 +186,9 @@ class O {
|
|
|
181
186
|
* @param request - 请求选项,包括路径参数、查询参数等
|
|
182
187
|
* @returns Promise<Response> HTTP响应
|
|
183
188
|
*/
|
|
184
|
-
async get(
|
|
185
|
-
return this.fetch(
|
|
186
|
-
...
|
|
189
|
+
async get(e, t = {}) {
|
|
190
|
+
return this.fetch(e, {
|
|
191
|
+
...t,
|
|
187
192
|
method: c.GET
|
|
188
193
|
});
|
|
189
194
|
}
|
|
@@ -194,9 +199,9 @@ class O {
|
|
|
194
199
|
* @param request - 请求选项,包括路径参数、查询参数、请求体等
|
|
195
200
|
* @returns Promise<Response> HTTP响应
|
|
196
201
|
*/
|
|
197
|
-
async post(
|
|
198
|
-
return this.fetch(
|
|
199
|
-
...
|
|
202
|
+
async post(e, t = {}) {
|
|
203
|
+
return this.fetch(e, {
|
|
204
|
+
...t,
|
|
200
205
|
method: c.POST
|
|
201
206
|
});
|
|
202
207
|
}
|
|
@@ -207,9 +212,9 @@ class O {
|
|
|
207
212
|
* @param request - 请求选项,包括路径参数、查询参数、请求体等
|
|
208
213
|
* @returns Promise<Response> HTTP响应
|
|
209
214
|
*/
|
|
210
|
-
async put(
|
|
211
|
-
return this.fetch(
|
|
212
|
-
...
|
|
215
|
+
async put(e, t = {}) {
|
|
216
|
+
return this.fetch(e, {
|
|
217
|
+
...t,
|
|
213
218
|
method: c.PUT
|
|
214
219
|
});
|
|
215
220
|
}
|
|
@@ -220,9 +225,9 @@ class O {
|
|
|
220
225
|
* @param request - 请求选项,包括路径参数、查询参数等
|
|
221
226
|
* @returns Promise<Response> HTTP响应
|
|
222
227
|
*/
|
|
223
|
-
async delete(
|
|
224
|
-
return this.fetch(
|
|
225
|
-
...
|
|
228
|
+
async delete(e, t = {}) {
|
|
229
|
+
return this.fetch(e, {
|
|
230
|
+
...t,
|
|
226
231
|
method: c.DELETE
|
|
227
232
|
});
|
|
228
233
|
}
|
|
@@ -233,9 +238,9 @@ class O {
|
|
|
233
238
|
* @param request - 请求选项,包括路径参数、查询参数、请求体等
|
|
234
239
|
* @returns Promise<Response> HTTP响应
|
|
235
240
|
*/
|
|
236
|
-
async patch(
|
|
237
|
-
return this.fetch(
|
|
238
|
-
...
|
|
241
|
+
async patch(e, t = {}) {
|
|
242
|
+
return this.fetch(e, {
|
|
243
|
+
...t,
|
|
239
244
|
method: c.PATCH
|
|
240
245
|
});
|
|
241
246
|
}
|
|
@@ -246,9 +251,9 @@ class O {
|
|
|
246
251
|
* @param request - 请求选项,包括路径参数、查询参数等
|
|
247
252
|
* @returns Promise<Response> HTTP响应
|
|
248
253
|
*/
|
|
249
|
-
async head(
|
|
250
|
-
return this.fetch(
|
|
251
|
-
...
|
|
254
|
+
async head(e, t = {}) {
|
|
255
|
+
return this.fetch(e, {
|
|
256
|
+
...t,
|
|
252
257
|
method: c.HEAD
|
|
253
258
|
});
|
|
254
259
|
}
|
|
@@ -259,22 +264,24 @@ class O {
|
|
|
259
264
|
* @param request - 请求选项,包括路径参数、查询参数等
|
|
260
265
|
* @returns Promise<Response> HTTP响应
|
|
261
266
|
*/
|
|
262
|
-
async options(
|
|
263
|
-
return this.fetch(
|
|
264
|
-
...
|
|
267
|
+
async options(e, t = {}) {
|
|
268
|
+
return this.fetch(e, {
|
|
269
|
+
...t,
|
|
265
270
|
method: c.OPTIONS
|
|
266
271
|
});
|
|
267
272
|
}
|
|
268
273
|
}
|
|
269
274
|
export {
|
|
270
|
-
|
|
271
|
-
|
|
275
|
+
O as ContentTypeHeader,
|
|
276
|
+
d as ContentTypeValues,
|
|
277
|
+
h as FetchTimeoutError,
|
|
278
|
+
A as Fetcher,
|
|
272
279
|
w as FetcherInterceptors,
|
|
273
280
|
c as HttpMethod,
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
281
|
+
a as InterceptorManager,
|
|
282
|
+
y as RequestField,
|
|
283
|
+
E as UrlBuilder,
|
|
284
|
+
T as combineURLs,
|
|
285
|
+
m as isAbsoluteURL,
|
|
286
|
+
P as resolveTimeout
|
|
280
287
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(n,
|
|
1
|
+
(function(n,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(n=typeof globalThis<"u"?globalThis:n||self,h(n.Fetcher={}))})(this,(function(n){"use strict";function h(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function f(r,e){return h(e)?e:e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}class m{constructor(e){this.baseURL=e}build(e,t,s){let o=f(this.baseURL,e),a=this.interpolateUrl(o,t);if(s){const i=new URLSearchParams(s).toString();i&&(a+="?"+i)}return a}interpolateUrl(e,t){return t?e.replace(/{([^}]+)}/g,(s,o)=>{const a=t[o];if(a===void 0)throw new Error(`Missing required path parameter: ${o}`);return String(a)}):e}}function p(r,e){return typeof r<"u"?r:e}class u extends Error{constructor(e,t,s){const o=`Request timeout of ${s}ms exceeded for ${t?.method||"GET"} ${e}`;super(o),this.name="FetchTimeoutError",this.url=e,this.request=t,Object.setPrototypeOf(this,u.prototype)}}var c=(r=>(r.GET="GET",r.POST="POST",r.PUT="PUT",r.DELETE="DELETE",r.PATCH="PATCH",r.HEAD="HEAD",r.OPTIONS="OPTIONS",r))(c||{}),T=(r=>(r.METHOD="method",r.BODY="body",r))(T||{});const E="Content-Type";var d=(r=>(r.APPLICATION_JSON="application/json",r.TEXT_EVENT_STREAM="text/event-stream",r))(d||{});class l{constructor(){this.interceptors=[]}use(e){const t=this.interceptors.length;return this.interceptors.push(e),t}eject(e){this.interceptors[e]&&(this.interceptors[e]=null)}clear(){this.interceptors=[]}async intercept(e){let t=e;for(let s of this.interceptors)s&&(t=await s.intercept(t));return t}}class y{constructor(){this.request=new l,this.response=new l,this.error=new l}}const P={[E]:d.APPLICATION_JSON},w={baseURL:"",headers:P};class g{constructor(e=w){this.headers=P,this.interceptors=new y,this.urlBuilder=new m(e.baseURL),e.headers!==void 0&&(this.headers=e.headers),this.timeout=e.timeout}async fetch(e,t={}){const s={...this.headers||{},...t.headers||{}};let o={...t,headers:Object.keys(s).length>0?s:void 0};const a=this.urlBuilder.build(e,t.pathParams,t.queryParams);o=await this.interceptors.request.intercept(o);try{let i=await this.timeoutFetch(a,o);return i=await this.interceptors.response.intercept(i),i}catch(i){throw await this.interceptors.error.intercept(i)}}async timeoutFetch(e,t){const s=p(t.timeout,this.timeout);if(!s)return fetch(e,t);const o=new AbortController,a={...t,signal:o.signal};let i=null;const O=new Promise((U,S)=>{i=setTimeout(()=>{i&&clearTimeout(i);const b=new u(e,t,s);o.abort(b),S(b)},s)});try{return await Promise.race([fetch(e,a),O])}finally{i&&clearTimeout(i)}}async get(e,t={}){return this.fetch(e,{...t,method:c.GET})}async post(e,t={}){return this.fetch(e,{...t,method:c.POST})}async put(e,t={}){return this.fetch(e,{...t,method:c.PUT})}async delete(e,t={}){return this.fetch(e,{...t,method:c.DELETE})}async patch(e,t={}){return this.fetch(e,{...t,method:c.PATCH})}async head(e,t={}){return this.fetch(e,{...t,method:c.HEAD})}async options(e,t={}){return this.fetch(e,{...t,method:c.OPTIONS})}}n.ContentTypeHeader=E,n.ContentTypeValues=d,n.FetchTimeoutError=u,n.Fetcher=g,n.FetcherInterceptors=y,n.HttpMethod=c,n.InterceptorManager=l,n.RequestField=T,n.UrlBuilder=m,n.combineURLs=f,n.isAbsoluteURL=h,n.resolveTimeout=p,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/types.d.ts
CHANGED
|
@@ -27,4 +27,9 @@ export declare enum RequestField {
|
|
|
27
27
|
METHOD = "method",
|
|
28
28
|
BODY = "body"
|
|
29
29
|
}
|
|
30
|
+
export declare const ContentTypeHeader = "Content-Type";
|
|
31
|
+
export declare enum ContentTypeValues {
|
|
32
|
+
APPLICATION_JSON = "application/json",
|
|
33
|
+
TEXT_EVENT_STREAM = "text/event-stream"
|
|
34
|
+
}
|
|
30
35
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;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,oBAAY,YAAY;IACtB,MAAM,WAAW;IACjB,IAAI,SAAS;CACd"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;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,oBAAY,YAAY;IACtB,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,oBAAY,iBAAiB;IAC3B,gBAAgB,qBAAqB;IACrC,iBAAiB,sBAAsB;CACxC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ahoo-wang/fetcher",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "Core library providing basic HTTP client functionality for Fetcher",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fetch",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"author": "Ahoo-Wang",
|
|
12
12
|
"license": "Apache-2.0",
|
|
13
|
-
"homepage": "https://github.com/Ahoo-Wang/fetcher/tree/master/packages/
|
|
13
|
+
"homepage": "https://github.com/Ahoo-Wang/fetcher/tree/master/packages/fetcher",
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
16
|
"url": "https://github.com/Ahoo-Wang/fetcher.git",
|