@utiliread/http 1.19.5 → 1.20.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.
Files changed (76) hide show
  1. package/dist/event-aggregator.d.ts +11 -0
  2. package/dist/events.d.ts +11 -0
  3. package/dist/header-names.d.ts +182 -0
  4. package/dist/helpers.d.ts +5 -0
  5. package/dist/http-builder.d.ts +61 -0
  6. package/dist/http-error.d.ts +10 -0
  7. package/dist/http-response.d.ts +18 -0
  8. package/dist/http.d.ts +33 -0
  9. package/dist/http.spec.d.ts +1 -0
  10. package/dist/index.d.ts +16 -231
  11. package/dist/index.js +616 -242
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +601 -215
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/mapper.d.ts +9 -0
  16. package/dist/pagination.d.ts +23 -0
  17. package/dist/{json.d.ts → plugins/json/index.d.ts} +1 -2
  18. package/dist/plugins/json/index.js +87 -0
  19. package/dist/plugins/json/index.js.map +1 -0
  20. package/dist/plugins/json/index.mjs +85 -0
  21. package/dist/plugins/json/index.mjs.map +1 -0
  22. package/dist/{jsonpatch.d.ts → plugins/jsonpatch/index.d.ts} +0 -2
  23. package/dist/plugins/jsonpatch/index.js +21 -0
  24. package/dist/plugins/jsonpatch/index.js.map +1 -0
  25. package/dist/plugins/jsonpatch/index.mjs +19 -0
  26. package/dist/plugins/jsonpatch/index.mjs.map +1 -0
  27. package/dist/{msgpack.d.ts → plugins/msgpack/index.d.ts} +1 -2
  28. package/dist/plugins/msgpack/index.js +41 -0
  29. package/dist/plugins/msgpack/index.js.map +1 -0
  30. package/dist/plugins/msgpack/index.mjs +39 -0
  31. package/dist/plugins/msgpack/index.mjs.map +1 -0
  32. package/dist/problem-details.d.ts +7 -0
  33. package/dist/query-string.d.ts +6 -0
  34. package/dist/query-string.spec.d.ts +1 -0
  35. package/dist/status-codes.d.ts +65 -0
  36. package/dist/timeout-error.d.ts +3 -0
  37. package/json.d.ts +2 -0
  38. package/json.rollup.config.mjs +32 -0
  39. package/jsonpatch.d.ts +2 -0
  40. package/jsonpatch.rollup.config.mjs +32 -0
  41. package/msgpack.d.ts +2 -0
  42. package/msgpack.rollup.config.mjs +37 -0
  43. package/package.json +24 -24
  44. package/rollup.config.mjs +31 -0
  45. package/src/header-names.ts +273 -0
  46. package/src/index.ts +2 -1
  47. package/{plugins/json/src → src/plugins/json}/index.ts +138 -142
  48. package/{plugins/jsonpatch/src → src/plugins/jsonpatch}/index.ts +36 -36
  49. package/{plugins/msgpack/src → src/plugins/msgpack}/index.ts +69 -66
  50. package/src/status-codes.ts +65 -67
  51. package/tsconfig.json +6 -11
  52. package/dist/index.d.ts.map +0 -1
  53. package/dist/json.d.ts.map +0 -1
  54. package/dist/json.js +0 -93
  55. package/dist/json.js.map +0 -1
  56. package/dist/json.mjs +0 -82
  57. package/dist/json.mjs.map +0 -1
  58. package/dist/jsonpatch.d.ts.map +0 -1
  59. package/dist/jsonpatch.js +0 -33
  60. package/dist/jsonpatch.js.map +0 -1
  61. package/dist/jsonpatch.mjs +0 -22
  62. package/dist/jsonpatch.mjs.map +0 -1
  63. package/dist/msgpack.d.ts.map +0 -1
  64. package/dist/msgpack.js +0 -50
  65. package/dist/msgpack.js.map +0 -1
  66. package/dist/msgpack.mjs +0 -39
  67. package/dist/msgpack.mjs.map +0 -1
  68. package/plugins/json/node_modules/@utiliread/http/package.json +0 -4
  69. package/plugins/json/package.json +0 -15
  70. package/plugins/json/tsconfig.json +0 -7
  71. package/plugins/jsonpatch/node_modules/@utiliread/http/package.json +0 -4
  72. package/plugins/jsonpatch/package.json +0 -16
  73. package/plugins/jsonpatch/tsconfig.json +0 -7
  74. package/plugins/msgpack/node_modules/@utiliread/http/package.json +0 -4
  75. package/plugins/msgpack/package.json +0 -16
  76. package/plugins/msgpack/tsconfig.json +0 -7
package/dist/index.mjs CHANGED
@@ -1,58 +1,58 @@
1
- import {DateTime as $hgUW1$DateTime} from "luxon";
1
+ import { DateTime } from 'luxon';
2
2
 
3
-
4
- function $parcel$export(e, n, v, s) {
5
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
6
- }
7
- class $f6f81ea7d7db103c$export$f93b90549b868d0 {
3
+ class EventAggregator {
4
+ constructor() {
5
+ this.callbacks = [];
6
+ }
8
7
  get any() {
9
8
  return this.callbacks.length > 0;
10
9
  }
11
10
  subscribe(callback) {
12
11
  this.callbacks.push(callback);
13
12
  return {
14
- dispose: ()=>{
13
+ dispose: () => {
15
14
  const index = this.callbacks.indexOf(callback);
16
- if (index >= 0) this.callbacks.splice(index, 1);
17
- }
15
+ if (index >= 0) {
16
+ this.callbacks.splice(index, 1);
17
+ }
18
+ },
18
19
  };
19
20
  }
20
21
  async publish(...params) {
21
22
  const callbacks = this.callbacks.slice();
22
- for (const callback of callbacks)await Promise.resolve(callback.apply(this, params));
23
- }
24
- constructor(){
25
- this.callbacks = [];
23
+ for (const callback of callbacks) {
24
+ await Promise.resolve(callback.apply(this, params));
25
+ }
26
26
  }
27
27
  }
28
28
 
29
-
30
- class $19b86d1629a73d25$export$65bd6083489bd8bb extends Error {
29
+ class HttpError extends Error {
31
30
  get hasDetails() {
32
31
  const contentType = this.response?.rawResponse?.headers.get("Content-Type");
33
32
  return contentType?.includes("application/problem+json");
34
33
  }
35
- constructor(statusCode, response){
34
+ constructor(statusCode, response = undefined) {
36
35
  super(`The response was not successful: ${statusCode}`);
37
36
  this.statusCode = statusCode;
38
37
  this.response = response;
39
38
  this.name = "HttpError";
40
39
  // Set the prototype explicitly to allow for "... instanceof HttpError",
41
40
  // see https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
42
- Object.setPrototypeOf(this, $19b86d1629a73d25$export$65bd6083489bd8bb.prototype);
41
+ Object.setPrototypeOf(this, HttpError.prototype);
43
42
  }
44
43
  details() {
45
44
  const rawResponse = this.response?.rawResponse;
46
45
  if (rawResponse && this.hasDetails) {
47
- this.detailsPromise ??= rawResponse.json().then((details)=>details);
48
- return this.detailsPromise.then((details)=>details);
46
+ this.detailsPromise ?? (this.detailsPromise = rawResponse
47
+ .json()
48
+ .then((details) => details));
49
+ return this.detailsPromise.then((details) => details);
49
50
  }
50
51
  return Promise.reject(new Error("There are no problem details in the response"));
51
52
  }
52
53
  }
53
54
 
54
-
55
- class $985d219a1441065d$export$1d94dfe0d9d1f1e7 {
55
+ class HttpResponse {
56
56
  get url() {
57
57
  return this.rawResponse.url;
58
58
  }
@@ -77,16 +77,18 @@ class $985d219a1441065d$export$1d94dfe0d9d1f1e7 {
77
77
  get isServerError() {
78
78
  return this.statusCode >= 500 && this.statusCode < 600;
79
79
  }
80
- constructor(rawResponse){
80
+ constructor(rawResponse) {
81
81
  this.rawResponse = rawResponse;
82
82
  }
83
83
  ensureSuccessfulStatusCode() {
84
- if (!this.isSuccessful) throw new (0, $19b86d1629a73d25$export$65bd6083489bd8bb)(this.statusCode, this);
84
+ if (!this.isSuccessful) {
85
+ throw new HttpError(this.statusCode, this);
86
+ }
85
87
  return this;
86
88
  }
87
89
  }
88
- class $985d219a1441065d$export$bcbae67b865a76d2 extends $985d219a1441065d$export$1d94dfe0d9d1f1e7 {
89
- constructor(rawResponse, handler){
90
+ class HttpResponseOfT extends HttpResponse {
91
+ constructor(rawResponse, handler) {
90
92
  super(rawResponse);
91
93
  this.handler = handler;
92
94
  }
@@ -95,27 +97,25 @@ class $985d219a1441065d$export$bcbae67b865a76d2 extends $985d219a1441065d$export
95
97
  }
96
98
  }
97
99
 
98
-
99
- class $9fbb9c114bac59ad$export$66d311bf29d5c89c extends Error {
100
- constructor(){
100
+ class TimeoutError extends Error {
101
+ constructor() {
101
102
  super("Timeout: The request was not successful");
102
103
  this.name = "TimeoutError";
103
104
  // Set the prototype explicitly to allow for "... instanceof TimeoutError",
104
105
  // see https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
105
- Object.setPrototypeOf(this, $9fbb9c114bac59ad$export$66d311bf29d5c89c.prototype);
106
+ Object.setPrototypeOf(this, TimeoutError.prototype);
106
107
  }
107
108
  }
108
109
 
109
-
110
-
111
- class $23dbc0de8db3984c$export$fc624c0231d0f8a {
112
- constructor(message, options, /** @internal */ http){
110
+ class HttpBuilder {
111
+ constructor(message, options,
112
+ /** @internal */ http) {
113
113
  this.message = message;
114
114
  this.options = options;
115
115
  this.http = http;
116
116
  this._ensureSuccessStatusCode = true;
117
- this._onSend = new (0, $f6f81ea7d7db103c$export$f93b90549b868d0)();
118
- this._onSent = new (0, $f6f81ea7d7db103c$export$f93b90549b868d0)();
117
+ this._onSend = new EventAggregator();
118
+ this._onSent = new EventAggregator();
119
119
  }
120
120
  onSend(callback) {
121
121
  this._onSend.subscribe(callback);
@@ -126,10 +126,12 @@ class $23dbc0de8db3984c$export$fc624c0231d0f8a {
126
126
  return this;
127
127
  }
128
128
  useHandler(handler) {
129
- return new $23dbc0de8db3984c$export$7dfcf6a5b7becec8(this, handler);
129
+ return new HttpBuilderOfT(this, handler);
130
130
  }
131
131
  async send(abortSignal) {
132
- if (this.message.contentType) this.message.headers.set("Content-Type", this.message.contentType);
132
+ if (this.message.contentType) {
133
+ this.message.headers.set("Content-Type", this.message.contentType);
134
+ }
133
135
  // Resolve the final url and assign it to the message
134
136
  // This makes the final url apper in onSend, onSent, and on Received handlers
135
137
  this.message.url = this.getUrl();
@@ -139,40 +141,57 @@ class $23dbc0de8db3984c$export$fc624c0231d0f8a {
139
141
  method: this.message.method,
140
142
  body: this.message.content,
141
143
  headers: this.message.headers,
142
- mode: this.message.mode
144
+ mode: this.message.mode,
143
145
  };
144
146
  if (abortSignal || this.options.timeout) {
145
147
  var outerController = new AbortController();
146
- if (abortSignal) abortSignal.addEventListener("abort", ()=>{
147
- outerController.abort();
148
- });
148
+ if (abortSignal) {
149
+ abortSignal.addEventListener("abort", () => {
150
+ outerController.abort();
151
+ });
152
+ }
149
153
  init.signal = outerController.signal;
150
154
  }
151
155
  const fetchResponsePromise = this.options.fetch(this.message.url, init);
152
156
  let fetchResponse;
153
- if (this.options.timeout) fetchResponse = await Promise.race([
154
- fetchResponsePromise,
155
- new Promise((_, reject)=>setTimeout(()=>{
157
+ if (this.options.timeout) {
158
+ fetchResponse = await Promise.race([
159
+ fetchResponsePromise,
160
+ new Promise((_, reject) => setTimeout(() => {
156
161
  outerController.abort();
157
- reject(new (0, $9fbb9c114bac59ad$export$66d311bf29d5c89c)());
158
- }, this.options.timeout))
159
- ]);
160
- else fetchResponse = await fetchResponsePromise;
161
- const httpResponse = new (0, $985d219a1441065d$export$1d94dfe0d9d1f1e7)(fetchResponse);
162
- if (this._ensureSuccessStatusCode) httpResponse.ensureSuccessfulStatusCode();
162
+ reject(new TimeoutError());
163
+ }, this.options.timeout)),
164
+ ]);
165
+ }
166
+ else {
167
+ fetchResponse = await fetchResponsePromise;
168
+ }
169
+ const httpResponse = new HttpResponse(fetchResponse);
170
+ if (this._ensureSuccessStatusCode) {
171
+ httpResponse.ensureSuccessfulStatusCode();
172
+ }
163
173
  await this._onSent.publish(httpResponse, this.message);
164
174
  await this.http._onSent.publish(httpResponse, this.message);
165
175
  return httpResponse;
166
176
  }
167
177
  getUrl() {
168
178
  let baseUrl = this.options.baseUrl;
169
- if (!baseUrl) return this.message.url;
170
- if (baseUrl.endsWith("/")) baseUrl = baseUrl.substr(0, baseUrl.length - 1);
171
- if (this.message.url.startsWith("/")) return baseUrl + this.message.url;
172
- else return baseUrl + "/" + this.message.url;
179
+ if (!baseUrl) {
180
+ return this.message.url;
181
+ }
182
+ if (baseUrl.endsWith("/")) {
183
+ baseUrl = baseUrl.substr(0, baseUrl.length - 1);
184
+ }
185
+ if (this.message.url.startsWith("/")) {
186
+ return baseUrl + this.message.url;
187
+ }
188
+ else {
189
+ return baseUrl + "/" + this.message.url;
190
+ }
173
191
  }
174
192
  ensureSuccessStatusCode(ensureSuccessStatusCode) {
175
- this._ensureSuccessStatusCode = ensureSuccessStatusCode === false ? false : true;
193
+ this._ensureSuccessStatusCode =
194
+ ensureSuccessStatusCode === false ? false : true;
176
195
  return this;
177
196
  }
178
197
  useCors(mode) {
@@ -201,22 +220,22 @@ class $23dbc0de8db3984c$export$fc624c0231d0f8a {
201
220
  }
202
221
  // Expect Extensions
203
222
  expectString() {
204
- return this.useHandler((response)=>{
223
+ return this.useHandler((response) => {
205
224
  return response.rawResponse.text();
206
225
  });
207
226
  }
208
227
  expectBinary() {
209
- return this.useHandler((response)=>{
228
+ return this.useHandler((response) => {
210
229
  return response.rawResponse.arrayBuffer();
211
230
  });
212
231
  }
213
232
  }
214
- class $23dbc0de8db3984c$export$7dfcf6a5b7becec8 extends $23dbc0de8db3984c$export$fc624c0231d0f8a {
215
- constructor(inner, handler){
233
+ class HttpBuilderOfT extends HttpBuilder {
234
+ constructor(inner, handler) {
216
235
  super(inner.message, inner.options, inner.http);
217
236
  this.inner = inner;
218
237
  this.handler = handler;
219
- this._onReceived = new (0, $f6f81ea7d7db103c$export$f93b90549b868d0)();
238
+ this._onReceived = new EventAggregator();
220
239
  }
221
240
  onSend(callback) {
222
241
  this.inner.onSend(callback);
@@ -239,9 +258,13 @@ class $23dbc0de8db3984c$export$7dfcf6a5b7becec8 extends $23dbc0de8db3984c$export
239
258
  return this;
240
259
  }
241
260
  allowEmptyResponse() {
242
- if (this._onReceived.any) throw new Error("onReceived() must be called after allowEmptyResponse() because the callback type changes");
243
- return new $23dbc0de8db3984c$export$7dfcf6a5b7becec8(this.inner, (response)=>{
244
- if (response.statusCode === 204) return Promise.resolve(null);
261
+ if (this._onReceived.any) {
262
+ throw new Error("onReceived() must be called after allowEmptyResponse() because the callback type changes");
263
+ }
264
+ return new HttpBuilderOfT(this.inner, (response) => {
265
+ if (response.statusCode === 204) {
266
+ return Promise.resolve(null);
267
+ }
245
268
  return this.handler(response);
246
269
  });
247
270
  }
@@ -250,11 +273,13 @@ class $23dbc0de8db3984c$export$7dfcf6a5b7becec8 extends $23dbc0de8db3984c$export
250
273
  return this;
251
274
  }
252
275
  send(abortSignal) {
253
- const responsePromise = this.inner.send(abortSignal).then((x)=>new (0, $985d219a1441065d$export$bcbae67b865a76d2)(x.rawResponse, this.handler));
254
- return $23dbc0de8db3984c$var$asSendPromise(responsePromise, ()=>responsePromise.then((response)=>this.handleReceive(response)));
276
+ const responsePromise = this.inner
277
+ .send(abortSignal)
278
+ .then((x) => new HttpResponseOfT(x.rawResponse, this.handler));
279
+ return asSendPromise(responsePromise, () => responsePromise.then((response) => this.handleReceive(response)));
255
280
  }
256
281
  transfer(abortSignal) {
257
- return this.send(abortSignal).then((response)=>this.handleReceive(response));
282
+ return this.send(abortSignal).then((response) => this.handleReceive(response));
258
283
  }
259
284
  async handleReceive(response) {
260
285
  const request = this.message;
@@ -264,23 +289,27 @@ class $23dbc0de8db3984c$export$7dfcf6a5b7becec8 extends $23dbc0de8db3984c$export
264
289
  return value;
265
290
  }
266
291
  }
267
- function $23dbc0de8db3984c$var$asSendPromise(responsePromise, thenReceive) {
292
+ function asSendPromise(responsePromise, thenReceive) {
268
293
  const sendPromise = responsePromise;
269
294
  sendPromise.thenReceive = thenReceive;
270
295
  return sendPromise;
271
296
  }
272
297
 
273
-
274
-
275
- class $eec59bff903a2666$export$eada748df1dd417f {
298
+ class QueryString {
276
299
  static serialize(params) {
277
- if (!params) return "";
300
+ if (!params) {
301
+ return "";
302
+ }
278
303
  const serialized = this._serializeQueryString(params);
279
- if (!serialized.length) return "";
304
+ if (!serialized.length) {
305
+ return "";
306
+ }
280
307
  return "?" + serialized;
281
308
  }
282
309
  static append(url, params) {
283
- if (!params) return url;
310
+ if (!params) {
311
+ return url;
312
+ }
284
313
  const any = url.indexOf("?") >= 0;
285
314
  const separator = any ? "&" : "?";
286
315
  return url + separator + this._serializeQueryString(params);
@@ -289,39 +318,56 @@ class $eec59bff903a2666$export$eada748df1dd417f {
289
318
  const regex = new RegExp(`[?&]${name}(=([^&#]*)|&|#|$)`);
290
319
  const match = regex.exec(window.location.href);
291
320
  if (match) {
292
- if (match[1].length > 0) return decodeURIComponent(match[2]);
293
- else return null;
321
+ if (match[1].length > 0) {
322
+ return decodeURIComponent(match[2]);
323
+ }
324
+ else {
325
+ return null;
326
+ }
294
327
  }
295
328
  }
296
329
  static _serializeQueryString(source, prefix) {
297
330
  const parts = [];
298
- for(const propertyName in source)if (source.hasOwnProperty(propertyName)) {
299
- const key = prefix != null ? prefix + (Array.isArray(source) ? "[" + encodeURIComponent(propertyName) + "]" : "." + encodeURIComponent(propertyName)) : encodeURIComponent(propertyName);
300
- const value = source[propertyName];
301
- if (value instanceof (0, $hgUW1$DateTime)) {
302
- if (value.isValid) parts.push(key + "=" + encodeURIComponent(value.toISO()));
303
- } else if (value === null) parts.push(key);
304
- else if (value !== undefined) {
305
- if (typeof value === "object") parts.push(this._serializeQueryString(value, key));
306
- else parts.push(key + "=" + encodeURIComponent(value));
331
+ for (const propertyName in source) {
332
+ if (source.hasOwnProperty(propertyName)) {
333
+ const key = prefix != null
334
+ ? prefix +
335
+ (Array.isArray(source)
336
+ ? "[" + encodeURIComponent(propertyName) + "]"
337
+ : "." + encodeURIComponent(propertyName))
338
+ : encodeURIComponent(propertyName);
339
+ const value = source[propertyName];
340
+ if (value instanceof DateTime) {
341
+ if (value.isValid) {
342
+ parts.push(key + "=" + encodeURIComponent(value.toISO()));
343
+ }
344
+ }
345
+ else if (value === null) {
346
+ parts.push(key);
347
+ }
348
+ else if (value !== undefined) {
349
+ if (typeof value === "object") {
350
+ parts.push(this._serializeQueryString(value, key));
351
+ }
352
+ else {
353
+ parts.push(key + "=" + encodeURIComponent(value));
354
+ }
355
+ }
307
356
  }
308
357
  }
309
358
  return parts.join("&");
310
359
  }
311
360
  }
312
361
 
313
-
314
- class $d41f8f42b7b1f821$export$2a5b27776dbece47 {
315
- static{
316
- this.defaults = {
317
- fetch: self.fetch ? self.fetch.bind(self) : undefined
318
- };
319
- }
320
- constructor(options){
321
- /** @internal */ this._onSend = new (0, $f6f81ea7d7db103c$export$f93b90549b868d0)();
322
- /** @internal */ this._onSent = new (0, $f6f81ea7d7db103c$export$f93b90549b868d0)();
323
- /** @internal */ this._onReceived = new (0, $f6f81ea7d7db103c$export$f93b90549b868d0)();
324
- this.options = Object.assign({}, $d41f8f42b7b1f821$export$2a5b27776dbece47.defaults, options); // Later sources' properties overwrite earlier ones.
362
+ class Http {
363
+ constructor(options) {
364
+ /** @internal */
365
+ this._onSend = new EventAggregator();
366
+ /** @internal */
367
+ this._onSent = new EventAggregator();
368
+ /** @internal */
369
+ this._onReceived = new EventAggregator();
370
+ this.options = Object.assign({}, Http.defaults, options); // Later sources' properties overwrite earlier ones.
325
371
  }
326
372
  static request(method, url, params) {
327
373
  return this.getInstance().request(method, url, params);
@@ -346,25 +392,27 @@ class $d41f8f42b7b1f821$export$2a5b27776dbece47 {
346
392
  }
347
393
  static getInstance() {
348
394
  if (!this.instance) {
349
- this.instance = new $d41f8f42b7b1f821$export$2a5b27776dbece47();
395
+ this.instance = new Http();
350
396
  // The singleton instance should always use the static options
351
- this.instance.options = $d41f8f42b7b1f821$export$2a5b27776dbece47.defaults;
397
+ this.instance.options = Http.defaults;
352
398
  }
353
399
  return this.instance;
354
400
  }
355
401
  request(method, url, params) {
356
402
  const message = {
357
- method: method,
358
- url: url + (0, $eec59bff903a2666$export$eada748df1dd417f).serialize(params),
403
+ method,
404
+ url: url + QueryString.serialize(params),
359
405
  headers: new Headers(),
360
- properties: {}
406
+ properties: {},
361
407
  };
362
408
  const fetch = this.options.fetch;
363
- if (!fetch) throw Error("fetch() is not properly configured");
364
- const builder = new (0, $23dbc0de8db3984c$export$fc624c0231d0f8a)(message, {
365
- fetch: fetch,
409
+ if (!fetch) {
410
+ throw Error("fetch() is not properly configured");
411
+ }
412
+ const builder = new HttpBuilder(message, {
413
+ fetch,
366
414
  timeout: this.options.timeout,
367
- baseUrl: this.options.baseUrl
415
+ baseUrl: this.options.baseUrl,
368
416
  }, this);
369
417
  return builder;
370
418
  }
@@ -396,140 +444,478 @@ class $d41f8f42b7b1f821$export$2a5b27776dbece47 {
396
444
  return this._onReceived.subscribe(callback);
397
445
  }
398
446
  }
447
+ Http.defaults = {
448
+ fetch: self.fetch ? self.fetch.bind(self) : undefined,
449
+ };
399
450
 
400
-
401
-
402
-
403
-
404
-
405
-
406
-
407
- function $840e5d50f4dfb604$export$4bf9923669ad6c63(action, configure) {
408
- return function(...params) {
451
+ function events(action, configure) {
452
+ return function (...params) {
409
453
  const builder = action(...params);
410
454
  const events = configure(...params);
411
- if (events.sent) builder.onSent(events.sent);
412
- if (builder instanceof (0, $23dbc0de8db3984c$export$7dfcf6a5b7becec8) && events.received) builder.onReceived(events.received);
455
+ if (events.sent) {
456
+ builder.onSent(events.sent);
457
+ }
458
+ if (builder instanceof HttpBuilderOfT && events.received) {
459
+ builder.onReceived(events.received);
460
+ }
413
461
  return builder;
414
462
  };
415
463
  }
416
464
 
417
-
418
- var $e2e1ea6dd3b7d2e1$exports = {};
419
-
420
- $parcel$export($e2e1ea6dd3b7d2e1$exports, "isHttpError", () => $e2e1ea6dd3b7d2e1$export$97b788730ba59845);
421
- $parcel$export($e2e1ea6dd3b7d2e1$exports, "isAbortError", () => $e2e1ea6dd3b7d2e1$export$d2c30ea522b3259e);
422
- $parcel$export($e2e1ea6dd3b7d2e1$exports, "isTimeoutError", () => $e2e1ea6dd3b7d2e1$export$f47339bf28a93789);
423
- function $e2e1ea6dd3b7d2e1$export$97b788730ba59845(error) {
465
+ function isHttpError(error) {
424
466
  return error.name === "HttpError";
425
467
  }
426
- function $e2e1ea6dd3b7d2e1$export$d2c30ea522b3259e(error) {
468
+ function isAbortError(error) {
427
469
  return error.name === "AbortError";
428
470
  }
429
- function $e2e1ea6dd3b7d2e1$export$f47339bf28a93789(error) {
471
+ function isTimeoutError(error) {
430
472
  return error.name === "TimeoutError";
431
473
  }
432
474
 
433
-
434
- const $b192b846965e591b$export$5b6a6a9b6e9a7920 = Object.freeze({
435
- status100Continue: 100,
436
- status101SwitchingProtocols: 101,
437
- status102Processing: 102,
438
- status200OK: 200,
439
- status201Created: 201,
440
- status202Accepted: 202,
441
- status203NonAuthoritative: 203,
442
- status204NoContent: 204,
443
- status205ResetContent: 205,
444
- status206PartialContent: 206,
445
- status207MultiStatus: 207,
446
- status208AlreadyReported: 208,
447
- status226IMUsed: 226,
448
- status300MultipleChoices: 300,
449
- status301MovedPermanently: 301,
450
- status302Found: 302,
451
- status303SeeOther: 303,
452
- status304NotModified: 304,
453
- status305UseProxy: 305,
454
- status306SwitchProxy: 306,
455
- status307TemporaryRedirect: 307,
456
- status308PermanentRedirect: 308,
457
- status400BadRequest: 400,
458
- status401Unauthorized: 401,
459
- status402PaymentRequired: 402,
460
- status403Forbidden: 403,
461
- status404NotFound: 404,
462
- status405MethodNotAllowed: 405,
463
- status406NotAcceptable: 406,
464
- status407ProxyAuthenticationRequired: 407,
465
- status408RequestTimeout: 408,
466
- status409Conflict: 409,
467
- status410Gone: 410,
468
- status411LengthRequired: 411,
469
- status412PreconditionFailed: 412,
470
- status413RequestEntityTooLarge: 413,
471
- status413PayloadTooLarge: 413,
472
- status414RequestUriTooLong: 414,
473
- status414UriTooLong: 414,
474
- status415UnsupportedMediaType: 415,
475
- status416RequestedRangeNotSatisfiable: 416,
476
- status416RangeNotSatisfiable: 416,
477
- status417ExpectationFailed: 417,
478
- status418ImATeapot: 418,
479
- status419AuthenticationTimeout: 419,
480
- status421MisdirectedRequest: 421,
481
- status422UnprocessableEntity: 422,
482
- status423Locked: 423,
483
- status424FailedDependency: 424,
484
- status426UpgradeRequired: 426,
485
- status428PreconditionRequired: 428,
486
- status429TooManyRequests: 429,
487
- status431RequestHeaderFieldsTooLarge: 431,
488
- status451UnavailableForLegalReasons: 451,
489
- status500InternalServerError: 500,
490
- status501NotImplemented: 501,
491
- status502BadGateway: 502,
492
- status503ServiceUnavailable: 503,
493
- status504GatewayTimeout: 504,
494
- status505HttpVersionNotsupported: 505,
495
- status506VariantAlsoNegotiates: 506,
496
- status507InsufficientStorage: 507,
497
- status508LoopDetected: 508,
498
- status510NotExtended: 510,
499
- status511NetworkAuthenticationRequired: 511
475
+ /** Gets the `Accept` HTTP header name. */
476
+ const accept = "Accept";
477
+ /** Gets the `Accept-Charset` HTTP header name. */
478
+ const acceptCharset = "Accept-Charset";
479
+ /** Gets the `Accept-Encoding` HTTP header name. */
480
+ const acceptEncoding = "Accept-Encoding";
481
+ /** Gets the `Accept-Language` HTTP header name. */
482
+ const acceptLanguage = "Accept-Language";
483
+ /** Gets the `Accept-Ranges` HTTP header name. */
484
+ const acceptRanges = "Accept-Ranges";
485
+ /** Gets the `Access-Control-Allow-Credentials` HTTP header name. */
486
+ const accessControlAllowCredentials = "Access-Control-Allow-Credentials";
487
+ /** Gets the `Access-Control-Allow-Headers` HTTP header name. */
488
+ const accessControlAllowHeaders = "Access-Control-Allow-Headers";
489
+ /** Gets the `Access-Control-Allow-Methods` HTTP header name. */
490
+ const accessControlAllowMethods = "Access-Control-Allow-Methods";
491
+ /** Gets the `Access-Control-Allow-Origin` HTTP header name. */
492
+ const accessControlAllowOrigin = "Access-Control-Allow-Origin";
493
+ /** Gets the `Access-Control-Expose-Headers` HTTP header name. */
494
+ const accessControlExposeHeaders = "Access-Control-Expose-Headers";
495
+ /** Gets the `Access-Control-Max-Age` HTTP header name. */
496
+ const accessControlMaxAge = "Access-Control-Max-Age";
497
+ /** Gets the `Access-Control-Request-Headers` HTTP header name. */
498
+ const accessControlRequestHeaders = "Access-Control-Request-Headers";
499
+ /** Gets the `Access-Control-Request-Method` HTTP header name. */
500
+ const accessControlRequestMethod = "Access-Control-Request-Method";
501
+ /** Gets the `Age` HTTP header name. */
502
+ const age = "Age";
503
+ /** Gets the `Allow` HTTP header name. */
504
+ const allow = "Allow";
505
+ /** Gets the `Alt-Svc` HTTP header name. */
506
+ const altSvc = "Alt-Svc";
507
+ /** Gets the `Authorization` HTTP header name. */
508
+ const authorization = "Authorization";
509
+ /** Gets the `baggage` HTTP header name. */
510
+ const baggage = "baggage";
511
+ /** Gets the `Cache-Control` HTTP header name. */
512
+ const cacheControl = "Cache-Control";
513
+ /** Gets the `Connection` HTTP header name. */
514
+ const connection = "Connection";
515
+ /** Gets the `Content-Disposition` HTTP header name. */
516
+ const contentDisposition = "Content-Disposition";
517
+ /** Gets the `Content-Encoding` HTTP header name. */
518
+ const contentEncoding = "Content-Encoding";
519
+ /** Gets the `Content-Language` HTTP header name. */
520
+ const contentLanguage = "Content-Language";
521
+ /** Gets the `Content-Length` HTTP header name. */
522
+ const contentLength = "Content-Length";
523
+ /** Gets the `Content-Location` HTTP header name. */
524
+ const contentLocation = "Content-Location";
525
+ /** Gets the `Content-MD5` HTTP header name. */
526
+ const contentMD5 = "Content-MD5";
527
+ /** Gets the `Content-Range` HTTP header name. */
528
+ const contentRange = "Content-Range";
529
+ /** Gets the `Content-Security-Policy` HTTP header name. */
530
+ const contentSecurityPolicy = "Content-Security-Policy";
531
+ /** Gets the `Content-Security-Policy-Report-Only` HTTP header name. */
532
+ const contentSecurityPolicyReportOnly = "Content-Security-Policy-Report-Only";
533
+ /** Gets the `Content-Type` HTTP header name. */
534
+ const contentType = "Content-Type";
535
+ /** Gets the `Correlation-Context` HTTP header name. */
536
+ const correlationContext = "Correlation-Context";
537
+ /** Gets the `Cookie` HTTP header name. */
538
+ const cookie = "Cookie";
539
+ /** Gets the `Date` HTTP header name. */
540
+ const date = "Date";
541
+ /** Gets the `DNT` HTTP header name. */
542
+ const dnt = "DNT";
543
+ /** Gets the `ETag` HTTP header name. */
544
+ const eTag = "ETag";
545
+ /** Gets the `Expires` HTTP header name. */
546
+ const expires = "Expires";
547
+ /** Gets the `Expect` HTTP header name. */
548
+ const expect = "Expect";
549
+ /** Gets the `From` HTTP header name. */
550
+ const from = "From";
551
+ /** Gets the `Grpc-Accept-Encoding` HTTP header name. */
552
+ const grpcAcceptEncoding = "Grpc-Accept-Encoding";
553
+ /** Gets the `Grpc-Encoding` HTTP header name. */
554
+ const grpcEncoding = "Grpc-Encoding";
555
+ /** Gets the `Grpc-Message` HTTP header name. */
556
+ const grpcMessage = "Grpc-Message";
557
+ /** Gets the `Grpc-Status` HTTP header name. */
558
+ const grpcStatus = "Grpc-Status";
559
+ /** Gets the `Grpc-Timeout` HTTP header name. */
560
+ const grpcTimeout = "Grpc-Timeout";
561
+ /** Gets the `Host` HTTP header name. */
562
+ const host = "Host";
563
+ /** Gets the `Keep-Alive` HTTP header name. */
564
+ const keepAlive = "Keep-Alive";
565
+ /** Gets the `If-Match` HTTP header name. */
566
+ const ifMatch = "If-Match";
567
+ /** Gets the `If-Modified-Since` HTTP header name. */
568
+ const ifModifiedSince = "If-Modified-Since";
569
+ /** Gets the `If-None-Match` HTTP header name. */
570
+ const ifNoneMatch = "If-None-Match";
571
+ /** Gets the `If-Range` HTTP header name. */
572
+ const ifRange = "If-Range";
573
+ /** Gets the `If-Unmodified-Since` HTTP header name. */
574
+ const ifUnmodifiedSince = "If-Unmodified-Since";
575
+ /** Gets the `Last-Modified` HTTP header name. */
576
+ const lastModified = "Last-Modified";
577
+ /** Gets the `Link` HTTP header name. */
578
+ const link = "Link";
579
+ /** Gets the `Location` HTTP header name. */
580
+ const location = "Location";
581
+ /** Gets the `Max-Forwards` HTTP header name. */
582
+ const maxForwards = "Max-Forwards";
583
+ /** Gets the `Origin` HTTP header name. */
584
+ const origin = "Origin";
585
+ /** Gets the `Pragma` HTTP header name. */
586
+ const pragma = "Pragma";
587
+ /** Gets the `Proxy-Authenticate` HTTP header name. */
588
+ const proxyAuthenticate = "Proxy-Authenticate";
589
+ /** Gets the `Proxy-Authorization` HTTP header name. */
590
+ const proxyAuthorization = "Proxy-Authorization";
591
+ /** Gets the `Proxy-Connection` HTTP header name. */
592
+ const proxyConnection = "Proxy-Connection";
593
+ /** Gets the `Range` HTTP header name. */
594
+ const range = "Range";
595
+ /** Gets the `Referer` HTTP header name. */
596
+ const referer = "Referer";
597
+ /** Gets the `Retry-After` HTTP header name. */
598
+ const retryAfter = "Retry-After";
599
+ /** Gets the `Request-Id` HTTP header name. */
600
+ const requestId = "Request-Id";
601
+ /** Gets the `Sec-WebSocket-Accept` HTTP header name. */
602
+ const secWebSocketAccept = "Sec-WebSocket-Accept";
603
+ /** Gets the `Sec-WebSocket-Key` HTTP header name. */
604
+ const secWebSocketKey = "Sec-WebSocket-Key";
605
+ /** Gets the `Sec-WebSocket-Protocol` HTTP header name. */
606
+ const secWebSocketProtocol = "Sec-WebSocket-Protocol";
607
+ /** Gets the `Sec-WebSocket-Version` HTTP header name. */
608
+ const secWebSocketVersion = "Sec-WebSocket-Version";
609
+ /** Gets the `Sec-WebSocket-Extensions` HTTP header name. */
610
+ const secWebSocketExtensions = "Sec-WebSocket-Extensions";
611
+ /** Gets the `Server` HTTP header name. */
612
+ const server = "Server";
613
+ /** Gets the `Set-Cookie` HTTP header name. */
614
+ const setCookie = "Set-Cookie";
615
+ /** Gets the `Strict-Transport-Security` HTTP header name. */
616
+ const strictTransportSecurity = "Strict-Transport-Security";
617
+ /** Gets the `TE` HTTP header name. */
618
+ const te = "TE";
619
+ /** Gets the `Trailer` HTTP header name. */
620
+ const trailer = "Trailer";
621
+ /** Gets the `Transfer-Encoding` HTTP header name. */
622
+ const transferEncoding = "Transfer-Encoding";
623
+ /** Gets the `Translate` HTTP header name. */
624
+ const translate = "Translate";
625
+ /** Gets the `traceparent` HTTP header name. */
626
+ const traceParent = "traceparent";
627
+ /** Gets the `tracestate` HTTP header name. */
628
+ const traceState = "tracestate";
629
+ /** Gets the `Upgrade` HTTP header name. */
630
+ const upgrade = "Upgrade";
631
+ /** Gets the `Upgrade-Insecure-Requests` HTTP header name. */
632
+ const upgradeInsecureRequests = "Upgrade-Insecure-Requests";
633
+ /** Gets the `User-Agent` HTTP header name. */
634
+ const userAgent = "User-Agent";
635
+ /** Gets the `Vary` HTTP header name. */
636
+ const vary = "Vary";
637
+ /** Gets the `Via` HTTP header name. */
638
+ const via = "Via";
639
+ /** Gets the `Warning` HTTP header name. */
640
+ const warning = "Warning";
641
+ /** Gets the `Sec-WebSocket-Protocol` HTTP header name. */
642
+ const webSocketSubProtocols = "Sec-WebSocket-Protocol";
643
+ /** Gets the `WWW-Authenticate` HTTP header name. */
644
+ const wWWAuthenticate = "WWW-Authenticate";
645
+ /** Gets the `X-Content-Type-Options` HTTP header name. */
646
+ const xContentTypeOptions = "X-Content-Type-Options";
647
+ /** Gets the `X-Frame-Options` HTTP header name. */
648
+ const xFrameOptions = "X-Frame-Options";
649
+ /** Gets the `X-Powered-By` HTTP header name. */
650
+ const xPoweredBy = "X-Powered-By";
651
+ /** Gets the `X-Requested-With` HTTP header name. */
652
+ const xRequestedWith = "X-Requested-With";
653
+ /** Gets the `X-UA-Compatible` HTTP header name. */
654
+ const xUACompatible = "X-UA-Compatible";
655
+ /** Gets the `X-XSS-Protection` HTTP header name. */
656
+ const xXSSProtection = "X-XSS-Protection";
657
+
658
+ var headerNames = /*#__PURE__*/Object.freeze({
659
+ __proto__: null,
660
+ accept: accept,
661
+ acceptCharset: acceptCharset,
662
+ acceptEncoding: acceptEncoding,
663
+ acceptLanguage: acceptLanguage,
664
+ acceptRanges: acceptRanges,
665
+ accessControlAllowCredentials: accessControlAllowCredentials,
666
+ accessControlAllowHeaders: accessControlAllowHeaders,
667
+ accessControlAllowMethods: accessControlAllowMethods,
668
+ accessControlAllowOrigin: accessControlAllowOrigin,
669
+ accessControlExposeHeaders: accessControlExposeHeaders,
670
+ accessControlMaxAge: accessControlMaxAge,
671
+ accessControlRequestHeaders: accessControlRequestHeaders,
672
+ accessControlRequestMethod: accessControlRequestMethod,
673
+ age: age,
674
+ allow: allow,
675
+ altSvc: altSvc,
676
+ authorization: authorization,
677
+ baggage: baggage,
678
+ cacheControl: cacheControl,
679
+ connection: connection,
680
+ contentDisposition: contentDisposition,
681
+ contentEncoding: contentEncoding,
682
+ contentLanguage: contentLanguage,
683
+ contentLength: contentLength,
684
+ contentLocation: contentLocation,
685
+ contentMD5: contentMD5,
686
+ contentRange: contentRange,
687
+ contentSecurityPolicy: contentSecurityPolicy,
688
+ contentSecurityPolicyReportOnly: contentSecurityPolicyReportOnly,
689
+ contentType: contentType,
690
+ cookie: cookie,
691
+ correlationContext: correlationContext,
692
+ date: date,
693
+ dnt: dnt,
694
+ eTag: eTag,
695
+ expect: expect,
696
+ expires: expires,
697
+ from: from,
698
+ grpcAcceptEncoding: grpcAcceptEncoding,
699
+ grpcEncoding: grpcEncoding,
700
+ grpcMessage: grpcMessage,
701
+ grpcStatus: grpcStatus,
702
+ grpcTimeout: grpcTimeout,
703
+ host: host,
704
+ ifMatch: ifMatch,
705
+ ifModifiedSince: ifModifiedSince,
706
+ ifNoneMatch: ifNoneMatch,
707
+ ifRange: ifRange,
708
+ ifUnmodifiedSince: ifUnmodifiedSince,
709
+ keepAlive: keepAlive,
710
+ lastModified: lastModified,
711
+ link: link,
712
+ location: location,
713
+ maxForwards: maxForwards,
714
+ origin: origin,
715
+ pragma: pragma,
716
+ proxyAuthenticate: proxyAuthenticate,
717
+ proxyAuthorization: proxyAuthorization,
718
+ proxyConnection: proxyConnection,
719
+ range: range,
720
+ referer: referer,
721
+ requestId: requestId,
722
+ retryAfter: retryAfter,
723
+ secWebSocketAccept: secWebSocketAccept,
724
+ secWebSocketExtensions: secWebSocketExtensions,
725
+ secWebSocketKey: secWebSocketKey,
726
+ secWebSocketProtocol: secWebSocketProtocol,
727
+ secWebSocketVersion: secWebSocketVersion,
728
+ server: server,
729
+ setCookie: setCookie,
730
+ strictTransportSecurity: strictTransportSecurity,
731
+ te: te,
732
+ traceParent: traceParent,
733
+ traceState: traceState,
734
+ trailer: trailer,
735
+ transferEncoding: transferEncoding,
736
+ translate: translate,
737
+ upgrade: upgrade,
738
+ upgradeInsecureRequests: upgradeInsecureRequests,
739
+ userAgent: userAgent,
740
+ vary: vary,
741
+ via: via,
742
+ wWWAuthenticate: wWWAuthenticate,
743
+ warning: warning,
744
+ webSocketSubProtocols: webSocketSubProtocols,
745
+ xContentTypeOptions: xContentTypeOptions,
746
+ xFrameOptions: xFrameOptions,
747
+ xPoweredBy: xPoweredBy,
748
+ xRequestedWith: xRequestedWith,
749
+ xUACompatible: xUACompatible,
750
+ xXSSProtection: xXSSProtection
500
751
  });
501
752
 
753
+ const status100Continue = 100;
754
+ const status101SwitchingProtocols = 101;
755
+ const status102Processing = 102;
756
+ const status200OK = 200;
757
+ const status201Created = 201;
758
+ const status202Accepted = 202;
759
+ const status203NonAuthoritative = 203;
760
+ const status204NoContent = 204;
761
+ const status205ResetContent = 205;
762
+ const status206PartialContent = 206;
763
+ const status207MultiStatus = 207;
764
+ const status208AlreadyReported = 208;
765
+ const status226IMUsed = 226;
766
+ const status300MultipleChoices = 300;
767
+ const status301MovedPermanently = 301;
768
+ const status302Found = 302;
769
+ const status303SeeOther = 303;
770
+ const status304NotModified = 304;
771
+ const status305UseProxy = 305;
772
+ const status306SwitchProxy = 306;
773
+ const status307TemporaryRedirect = 307;
774
+ const status308PermanentRedirect = 308;
775
+ const status400BadRequest = 400;
776
+ const status401Unauthorized = 401;
777
+ const status402PaymentRequired = 402;
778
+ const status403Forbidden = 403;
779
+ const status404NotFound = 404;
780
+ const status405MethodNotAllowed = 405;
781
+ const status406NotAcceptable = 406;
782
+ const status407ProxyAuthenticationRequired = 407;
783
+ const status408RequestTimeout = 408;
784
+ const status409Conflict = 409;
785
+ const status410Gone = 410;
786
+ const status411LengthRequired = 411;
787
+ const status412PreconditionFailed = 412;
788
+ const status413RequestEntityTooLarge = 413;
789
+ const status413PayloadTooLarge = 413;
790
+ const status414RequestUriTooLong = 414;
791
+ const status414UriTooLong = 414;
792
+ const status415UnsupportedMediaType = 415;
793
+ const status416RequestedRangeNotSatisfiable = 416;
794
+ const status416RangeNotSatisfiable = 416;
795
+ const status417ExpectationFailed = 417;
796
+ const status418ImATeapot = 418;
797
+ const status419AuthenticationTimeout = 419;
798
+ const status421MisdirectedRequest = 421;
799
+ const status422UnprocessableEntity = 422;
800
+ const status423Locked = 423;
801
+ const status424FailedDependency = 424;
802
+ const status426UpgradeRequired = 426;
803
+ const status428PreconditionRequired = 428;
804
+ const status429TooManyRequests = 429;
805
+ const status431RequestHeaderFieldsTooLarge = 431;
806
+ const status451UnavailableForLegalReasons = 451;
807
+ const status500InternalServerError = 500;
808
+ const status501NotImplemented = 501;
809
+ const status502BadGateway = 502;
810
+ const status503ServiceUnavailable = 503;
811
+ const status504GatewayTimeout = 504;
812
+ const status505HttpVersionNotsupported = 505;
813
+ const status506VariantAlsoNegotiates = 506;
814
+ const status507InsufficientStorage = 507;
815
+ const status508LoopDetected = 508;
816
+ const status510NotExtended = 510;
817
+ const status511NetworkAuthenticationRequired = 511;
818
+
819
+ var statusCodes = /*#__PURE__*/Object.freeze({
820
+ __proto__: null,
821
+ status100Continue: status100Continue,
822
+ status101SwitchingProtocols: status101SwitchingProtocols,
823
+ status102Processing: status102Processing,
824
+ status200OK: status200OK,
825
+ status201Created: status201Created,
826
+ status202Accepted: status202Accepted,
827
+ status203NonAuthoritative: status203NonAuthoritative,
828
+ status204NoContent: status204NoContent,
829
+ status205ResetContent: status205ResetContent,
830
+ status206PartialContent: status206PartialContent,
831
+ status207MultiStatus: status207MultiStatus,
832
+ status208AlreadyReported: status208AlreadyReported,
833
+ status226IMUsed: status226IMUsed,
834
+ status300MultipleChoices: status300MultipleChoices,
835
+ status301MovedPermanently: status301MovedPermanently,
836
+ status302Found: status302Found,
837
+ status303SeeOther: status303SeeOther,
838
+ status304NotModified: status304NotModified,
839
+ status305UseProxy: status305UseProxy,
840
+ status306SwitchProxy: status306SwitchProxy,
841
+ status307TemporaryRedirect: status307TemporaryRedirect,
842
+ status308PermanentRedirect: status308PermanentRedirect,
843
+ status400BadRequest: status400BadRequest,
844
+ status401Unauthorized: status401Unauthorized,
845
+ status402PaymentRequired: status402PaymentRequired,
846
+ status403Forbidden: status403Forbidden,
847
+ status404NotFound: status404NotFound,
848
+ status405MethodNotAllowed: status405MethodNotAllowed,
849
+ status406NotAcceptable: status406NotAcceptable,
850
+ status407ProxyAuthenticationRequired: status407ProxyAuthenticationRequired,
851
+ status408RequestTimeout: status408RequestTimeout,
852
+ status409Conflict: status409Conflict,
853
+ status410Gone: status410Gone,
854
+ status411LengthRequired: status411LengthRequired,
855
+ status412PreconditionFailed: status412PreconditionFailed,
856
+ status413PayloadTooLarge: status413PayloadTooLarge,
857
+ status413RequestEntityTooLarge: status413RequestEntityTooLarge,
858
+ status414RequestUriTooLong: status414RequestUriTooLong,
859
+ status414UriTooLong: status414UriTooLong,
860
+ status415UnsupportedMediaType: status415UnsupportedMediaType,
861
+ status416RangeNotSatisfiable: status416RangeNotSatisfiable,
862
+ status416RequestedRangeNotSatisfiable: status416RequestedRangeNotSatisfiable,
863
+ status417ExpectationFailed: status417ExpectationFailed,
864
+ status418ImATeapot: status418ImATeapot,
865
+ status419AuthenticationTimeout: status419AuthenticationTimeout,
866
+ status421MisdirectedRequest: status421MisdirectedRequest,
867
+ status422UnprocessableEntity: status422UnprocessableEntity,
868
+ status423Locked: status423Locked,
869
+ status424FailedDependency: status424FailedDependency,
870
+ status426UpgradeRequired: status426UpgradeRequired,
871
+ status428PreconditionRequired: status428PreconditionRequired,
872
+ status429TooManyRequests: status429TooManyRequests,
873
+ status431RequestHeaderFieldsTooLarge: status431RequestHeaderFieldsTooLarge,
874
+ status451UnavailableForLegalReasons: status451UnavailableForLegalReasons,
875
+ status500InternalServerError: status500InternalServerError,
876
+ status501NotImplemented: status501NotImplemented,
877
+ status502BadGateway: status502BadGateway,
878
+ status503ServiceUnavailable: status503ServiceUnavailable,
879
+ status504GatewayTimeout: status504GatewayTimeout,
880
+ status505HttpVersionNotsupported: status505HttpVersionNotsupported,
881
+ status506VariantAlsoNegotiates: status506VariantAlsoNegotiates,
882
+ status507InsufficientStorage: status507InsufficientStorage,
883
+ status508LoopDetected: status508LoopDetected,
884
+ status510NotExtended: status510NotExtended,
885
+ status511NetworkAuthenticationRequired: status511NetworkAuthenticationRequired
886
+ });
502
887
 
503
- var $29a09fd3a3f15b5c$exports = {};
504
-
505
- $parcel$export($29a09fd3a3f15b5c$exports, "getNullableMapper", () => $29a09fd3a3f15b5c$export$27b49540aaa79f4f);
506
- $parcel$export($29a09fd3a3f15b5c$exports, "getMapper", () => $29a09fd3a3f15b5c$export$bf53df0dfe06e237);
507
- function $29a09fd3a3f15b5c$export$27b49540aaa79f4f(deserialize, typeOrMap) {
508
- if (!typeOrMap) return (x)=>x;
509
- if ($29a09fd3a3f15b5c$var$isZeroArgumentFunction(typeOrMap)) // It cannot be a factory function if it takes no arguments,
510
- // so it must be a (zero argument) type (constructor)
511
- return (x)=>{
512
- const bound = deserialize(x, typeOrMap);
513
- // The server cannot produce the undefined result
514
- if (bound === undefined) throw Error("The model factory created a undefined result");
515
- return bound;
516
- };
888
+ function getNullableMapper(deserialize, typeOrMap) {
889
+ if (!typeOrMap) {
890
+ return (x) => x;
891
+ }
892
+ if (isZeroArgumentFunction(typeOrMap)) {
893
+ // It cannot be a factory function if it takes no arguments,
894
+ // so it must be a (zero argument) type (constructor)
895
+ return (x) => {
896
+ const bound = deserialize(x, typeOrMap);
897
+ // The server cannot produce the undefined result
898
+ if (bound === undefined) {
899
+ throw Error("The model factory created a undefined result");
900
+ }
901
+ return bound;
902
+ };
903
+ }
517
904
  return typeOrMap;
518
905
  }
519
- function $29a09fd3a3f15b5c$export$bf53df0dfe06e237(deserialize, typeOrMap) {
520
- const nullableFactory = $29a09fd3a3f15b5c$export$27b49540aaa79f4f(deserialize, typeOrMap);
521
- return (x)=>{
906
+ function getMapper(deserialize, typeOrMap) {
907
+ const nullableFactory = getNullableMapper(deserialize, typeOrMap);
908
+ return (x) => {
522
909
  const result = nullableFactory(x);
523
- if (result === null) throw Error("The model factory created a null result");
910
+ if (result === null) {
911
+ throw Error("The model factory created a null result");
912
+ }
524
913
  return result;
525
914
  };
526
915
  }
527
- function $29a09fd3a3f15b5c$var$isZeroArgumentFunction(typeCtor) {
916
+ function isZeroArgumentFunction(typeCtor) {
528
917
  return typeCtor.length === 0;
529
918
  }
530
919
 
531
-
532
-
533
-
534
- export {$d41f8f42b7b1f821$export$2a5b27776dbece47 as Http, $eec59bff903a2666$export$eada748df1dd417f as QueryString, $985d219a1441065d$export$1d94dfe0d9d1f1e7 as HttpResponse, $985d219a1441065d$export$bcbae67b865a76d2 as HttpResponseOfT, $23dbc0de8db3984c$export$fc624c0231d0f8a as HttpBuilder, $23dbc0de8db3984c$export$7dfcf6a5b7becec8 as HttpBuilderOfT, $19b86d1629a73d25$export$65bd6083489bd8bb as HttpError, $9fbb9c114bac59ad$export$66d311bf29d5c89c as TimeoutError, $840e5d50f4dfb604$export$4bf9923669ad6c63 as events, $b192b846965e591b$export$5b6a6a9b6e9a7920 as statusCodes, $e2e1ea6dd3b7d2e1$export$97b788730ba59845 as isHttpError, $e2e1ea6dd3b7d2e1$export$d2c30ea522b3259e as isAbortError, $e2e1ea6dd3b7d2e1$export$f47339bf28a93789 as isTimeoutError, $29a09fd3a3f15b5c$export$27b49540aaa79f4f as getNullableMapper, $29a09fd3a3f15b5c$export$bf53df0dfe06e237 as getMapper};
920
+ export { Http, HttpBuilder, HttpBuilderOfT, HttpError, HttpResponse, HttpResponseOfT, QueryString, TimeoutError, events, getMapper, getNullableMapper, headerNames, isAbortError, isHttpError, isTimeoutError, statusCodes };
535
921
  //# sourceMappingURL=index.mjs.map