@taquito/http-utils 16.2.0 → 17.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/errors.js +36 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/taquito-http-utils.js +10 -32
- package/dist/lib/taquito-http-utils.js.map +1 -1
- package/dist/lib/version.js +2 -2
- package/dist/taquito-http-utils.es6.js +38 -31
- package/dist/taquito-http-utils.es6.js.map +1 -1
- package/dist/taquito-http-utils.umd.js +41 -35
- package/dist/taquito-http-utils.umd.js.map +1 -1
- package/dist/types/errors.d.ts +25 -0
- package/dist/types/taquito-http-utils.d.ts +2 -23
- package/package.json +3 -2
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpResponseError = exports.HttpRequestFailed = void 0;
|
|
4
|
+
const core_1 = require("@taquito/core");
|
|
5
|
+
/**
|
|
6
|
+
* @category Error
|
|
7
|
+
* @description Error indicates a general failure in making the HTTP request
|
|
8
|
+
*/
|
|
9
|
+
class HttpRequestFailed extends core_1.NetworkError {
|
|
10
|
+
constructor(method, url, cause) {
|
|
11
|
+
super();
|
|
12
|
+
this.method = method;
|
|
13
|
+
this.url = url;
|
|
14
|
+
this.cause = cause;
|
|
15
|
+
this.name = 'HttpRequestFailed';
|
|
16
|
+
this.message = `${method} ${url} ${String(cause)}`;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.HttpRequestFailed = HttpRequestFailed;
|
|
20
|
+
/**
|
|
21
|
+
* @category Error
|
|
22
|
+
* @description Error thrown when the endpoint returns an HTTP error to the client
|
|
23
|
+
*/
|
|
24
|
+
class HttpResponseError extends core_1.NetworkError {
|
|
25
|
+
constructor(message, status, statusText, body, url) {
|
|
26
|
+
super(message);
|
|
27
|
+
this.message = message;
|
|
28
|
+
this.status = status;
|
|
29
|
+
this.statusText = statusText;
|
|
30
|
+
this.body = body;
|
|
31
|
+
this.url = url;
|
|
32
|
+
this.name = 'HttpResponse';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.HttpResponseError = HttpResponseError;
|
|
36
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":";;;AAAA,wCAA6C;AAG7C;;;GAGG;AACH,MAAa,iBAAkB,SAAQ,mBAAY;IACjD,YAAmB,MAAc,EAAS,GAAW,EAAS,KAAY;QACxE,KAAK,EAAE,CAAC;QADS,WAAM,GAAN,MAAM,CAAQ;QAAS,QAAG,GAAH,GAAG,CAAQ;QAAS,UAAK,GAAL,KAAK,CAAO;QAExE,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,GAAG,MAAM,IAAI,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;IACrD,CAAC;CACF;AAND,8CAMC;AAED;;;GAGG;AACH,MAAa,iBAAkB,SAAQ,mBAAY;IAGjD,YACS,OAAe,EACf,MAAmB,EACnB,UAAkB,EAClB,IAAY,EACZ,GAAW;QAElB,KAAK,CAAC,OAAO,CAAC,CAAC;QANR,YAAO,GAAP,OAAO,CAAQ;QACf,WAAM,GAAN,MAAM,CAAa;QACnB,eAAU,GAAV,UAAU,CAAQ;QAClB,SAAI,GAAJ,IAAI,CAAQ;QACZ,QAAG,GAAH,GAAG,CAAQ;QAPb,SAAI,GAAG,cAAc,CAAC;IAU7B,CAAC;CACF;AAZD,8CAYC"}
|
|
@@ -24,47 +24,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
24
24
|
};
|
|
25
25
|
var _a;
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.HttpBackend = exports.
|
|
27
|
+
exports.HttpBackend = exports.HttpResponseError = exports.HttpRequestFailed = exports.VERSION = void 0;
|
|
28
28
|
const fetch_adapter_1 = require("./fetch-adapter");
|
|
29
29
|
const axios_1 = require("axios");
|
|
30
|
+
const errors_1 = require("./errors");
|
|
30
31
|
const isNode = typeof process !== 'undefined' && !!((_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node);
|
|
31
32
|
const adapter = isNode ? undefined : fetch_adapter_1.default;
|
|
32
33
|
__exportStar(require("./status_code"), exports);
|
|
33
34
|
var version_1 = require("./version");
|
|
34
35
|
Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_1.VERSION; } });
|
|
36
|
+
var errors_2 = require("./errors");
|
|
37
|
+
Object.defineProperty(exports, "HttpRequestFailed", { enumerable: true, get: function () { return errors_2.HttpRequestFailed; } });
|
|
38
|
+
Object.defineProperty(exports, "HttpResponseError", { enumerable: true, get: function () { return errors_2.HttpResponseError; } });
|
|
35
39
|
var ResponseType;
|
|
36
40
|
(function (ResponseType) {
|
|
37
41
|
ResponseType["TEXT"] = "text";
|
|
38
42
|
ResponseType["JSON"] = "json";
|
|
39
43
|
})(ResponseType || (ResponseType = {}));
|
|
40
|
-
/**
|
|
41
|
-
* @category Error
|
|
42
|
-
* @description This error will be thrown when the endpoint returns an HTTP error to the client
|
|
43
|
-
*/
|
|
44
|
-
class HttpResponseError extends Error {
|
|
45
|
-
constructor(message, status, statusText, body, url) {
|
|
46
|
-
super(message);
|
|
47
|
-
this.message = message;
|
|
48
|
-
this.status = status;
|
|
49
|
-
this.statusText = statusText;
|
|
50
|
-
this.body = body;
|
|
51
|
-
this.url = url;
|
|
52
|
-
this.name = 'HttpResponse';
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
exports.HttpResponseError = HttpResponseError;
|
|
56
|
-
/**
|
|
57
|
-
* @category Error
|
|
58
|
-
* @description Error that indicates a general failure in making the HTTP request
|
|
59
|
-
*/
|
|
60
|
-
class HttpRequestFailed extends Error {
|
|
61
|
-
constructor(message) {
|
|
62
|
-
super(message);
|
|
63
|
-
this.message = message;
|
|
64
|
-
this.name = 'HttpRequestFailed';
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
exports.HttpRequestFailed = HttpRequestFailed;
|
|
68
44
|
class HttpBackend {
|
|
69
45
|
constructor(timeout = 30000) {
|
|
70
46
|
this.timeout = timeout;
|
|
@@ -106,9 +82,11 @@ class HttpBackend {
|
|
|
106
82
|
/**
|
|
107
83
|
*
|
|
108
84
|
* @param options contains options to be passed for the HTTP request (url, method and timeout)
|
|
85
|
+
* @throws {@link HttpRequestFailed} | {@link HttpResponseError}
|
|
109
86
|
*/
|
|
110
87
|
createRequest({ url, method, timeout = this.timeout, query, headers = {}, json = true }, data) {
|
|
111
88
|
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
const urlWithQuery = url + this.serialize(query);
|
|
112
90
|
let resType;
|
|
113
91
|
let transformResponse = undefined;
|
|
114
92
|
if (!headers['Content-Type']) {
|
|
@@ -123,7 +101,7 @@ class HttpBackend {
|
|
|
123
101
|
}
|
|
124
102
|
try {
|
|
125
103
|
const response = yield axios_1.default.request({
|
|
126
|
-
url:
|
|
104
|
+
url: urlWithQuery,
|
|
127
105
|
method: method !== null && method !== void 0 ? method : 'GET',
|
|
128
106
|
headers: headers,
|
|
129
107
|
responseType: resType,
|
|
@@ -143,10 +121,10 @@ class HttpBackend {
|
|
|
143
121
|
else {
|
|
144
122
|
errorData = err.response.data;
|
|
145
123
|
}
|
|
146
|
-
throw new HttpResponseError(`Http error response: (${err.response.status}) ${errorData}`, err.response.status, err.response.statusText, errorData,
|
|
124
|
+
throw new errors_1.HttpResponseError(`Http error response: (${err.response.status}) ${errorData}`, err.response.status, err.response.statusText, errorData, urlWithQuery);
|
|
147
125
|
}
|
|
148
126
|
else {
|
|
149
|
-
throw new HttpRequestFailed(
|
|
127
|
+
throw new errors_1.HttpRequestFailed(String(method), urlWithQuery, err);
|
|
150
128
|
}
|
|
151
129
|
}
|
|
152
130
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taquito-http-utils.js","sourceRoot":"","sources":["../../src/taquito-http-utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;AAEH,mDAA2C;AAE3C,iCAA0B;
|
|
1
|
+
{"version":3,"file":"taquito-http-utils.js","sourceRoot":"","sources":["../../src/taquito-http-utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;AAEH,mDAA2C;AAE3C,iCAA0B;AAC1B,qCAAgE;AAEhE,MAAM,MAAM,GAAG,OAAO,OAAO,KAAK,WAAW,IAAI,CAAC,QAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,0CAAE,IAAI,CAAA,CAAC;AAE3E,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,uBAAY,CAAC;AAElD,gDAA8B;AAC9B,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,mCAAgE;AAAvD,2GAAA,iBAAiB,OAAA;AAAE,2GAAA,iBAAiB,OAAA;AAE7C,IAAK,YAGJ;AAHD,WAAK,YAAY;IACf,6BAAa,CAAA;IACb,6BAAa,CAAA;AACf,CAAC,EAHI,YAAY,KAAZ,YAAY,QAGhB;AAcD,MAAa,WAAW;IACtB,YAAoB,UAAkB,KAAK;QAAvB,YAAO,GAAP,OAAO,CAAgB;IAAG,CAAC;IAErC,SAAS,CAAC,GAAgB;QAClC,IAAI,CAAC,GAAG,EAAE;YACR,OAAO,EAAE,CAAC;SACX;QAED,MAAM,GAAG,GAAG,EAAE,CAAC;QACf,KAAK,MAAM,CAAC,IAAI,GAAG,EAAE;YACnB,iDAAiD;YACjD,IAAI,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,WAAW,EAAE;gBAC1D,MAAM,IAAI,GAAG,OAAO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EAClC,GAAG,CAAC,QAAQ,CAAC,UAAU,EACvB,SAAS,EACT,YAAY,CACb,CAAC;iBACH;qBAAM;oBACL,MAAM,IAAI,0BAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC;iBAChE;aACF;QACH,CAAC;KAAA;CACF;AAjGD,kCAiGC"}
|
package/dist/lib/version.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.VERSION = void 0;
|
|
4
4
|
// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
|
|
5
5
|
exports.VERSION = {
|
|
6
|
-
"commitHash": "
|
|
7
|
-
"version": "
|
|
6
|
+
"commitHash": "b357541c90c2168d48216d62a07de5dd3baab9a0",
|
|
7
|
+
"version": "17.0.0"
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=version.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
+
import { NetworkError } from '@taquito/core';
|
|
2
3
|
|
|
3
4
|
/******************************************************************************
|
|
4
5
|
Copyright (c) Microsoft Corporation.
|
|
@@ -241,6 +242,36 @@ function enhanceError(error, config, code, request, response) {
|
|
|
241
242
|
return error;
|
|
242
243
|
}
|
|
243
244
|
|
|
245
|
+
/**
|
|
246
|
+
* @category Error
|
|
247
|
+
* @description Error indicates a general failure in making the HTTP request
|
|
248
|
+
*/
|
|
249
|
+
class HttpRequestFailed extends NetworkError {
|
|
250
|
+
constructor(method, url, cause) {
|
|
251
|
+
super();
|
|
252
|
+
this.method = method;
|
|
253
|
+
this.url = url;
|
|
254
|
+
this.cause = cause;
|
|
255
|
+
this.name = 'HttpRequestFailed';
|
|
256
|
+
this.message = `${method} ${url} ${String(cause)}`;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* @category Error
|
|
261
|
+
* @description Error thrown when the endpoint returns an HTTP error to the client
|
|
262
|
+
*/
|
|
263
|
+
class HttpResponseError extends NetworkError {
|
|
264
|
+
constructor(message, status, statusText, body, url) {
|
|
265
|
+
super(message);
|
|
266
|
+
this.message = message;
|
|
267
|
+
this.status = status;
|
|
268
|
+
this.statusText = statusText;
|
|
269
|
+
this.body = body;
|
|
270
|
+
this.url = url;
|
|
271
|
+
this.name = 'HttpResponse';
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
244
275
|
/**
|
|
245
276
|
* Hypertext Transfer Protocol (HTTP) response status codes.
|
|
246
277
|
* @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}
|
|
@@ -563,8 +594,8 @@ var STATUS_CODE;
|
|
|
563
594
|
|
|
564
595
|
// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
|
|
565
596
|
const VERSION = {
|
|
566
|
-
"commitHash": "
|
|
567
|
-
"version": "
|
|
597
|
+
"commitHash": "b357541c90c2168d48216d62a07de5dd3baab9a0",
|
|
598
|
+
"version": "17.0.0"
|
|
568
599
|
};
|
|
569
600
|
|
|
570
601
|
/**
|
|
@@ -579,32 +610,6 @@ var ResponseType;
|
|
|
579
610
|
ResponseType["TEXT"] = "text";
|
|
580
611
|
ResponseType["JSON"] = "json";
|
|
581
612
|
})(ResponseType || (ResponseType = {}));
|
|
582
|
-
/**
|
|
583
|
-
* @category Error
|
|
584
|
-
* @description This error will be thrown when the endpoint returns an HTTP error to the client
|
|
585
|
-
*/
|
|
586
|
-
class HttpResponseError extends Error {
|
|
587
|
-
constructor(message, status, statusText, body, url) {
|
|
588
|
-
super(message);
|
|
589
|
-
this.message = message;
|
|
590
|
-
this.status = status;
|
|
591
|
-
this.statusText = statusText;
|
|
592
|
-
this.body = body;
|
|
593
|
-
this.url = url;
|
|
594
|
-
this.name = 'HttpResponse';
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
/**
|
|
598
|
-
* @category Error
|
|
599
|
-
* @description Error that indicates a general failure in making the HTTP request
|
|
600
|
-
*/
|
|
601
|
-
class HttpRequestFailed extends Error {
|
|
602
|
-
constructor(message) {
|
|
603
|
-
super(message);
|
|
604
|
-
this.message = message;
|
|
605
|
-
this.name = 'HttpRequestFailed';
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
613
|
class HttpBackend {
|
|
609
614
|
constructor(timeout = 30000) {
|
|
610
615
|
this.timeout = timeout;
|
|
@@ -646,9 +651,11 @@ class HttpBackend {
|
|
|
646
651
|
/**
|
|
647
652
|
*
|
|
648
653
|
* @param options contains options to be passed for the HTTP request (url, method and timeout)
|
|
654
|
+
* @throws {@link HttpRequestFailed} | {@link HttpResponseError}
|
|
649
655
|
*/
|
|
650
656
|
createRequest({ url, method, timeout = this.timeout, query, headers = {}, json = true }, data) {
|
|
651
657
|
return __awaiter(this, void 0, void 0, function* () {
|
|
658
|
+
const urlWithQuery = url + this.serialize(query);
|
|
652
659
|
let resType;
|
|
653
660
|
let transformResponse = undefined;
|
|
654
661
|
if (!headers['Content-Type']) {
|
|
@@ -663,7 +670,7 @@ class HttpBackend {
|
|
|
663
670
|
}
|
|
664
671
|
try {
|
|
665
672
|
const response = yield axios.request({
|
|
666
|
-
url:
|
|
673
|
+
url: urlWithQuery,
|
|
667
674
|
method: method !== null && method !== void 0 ? method : 'GET',
|
|
668
675
|
headers: headers,
|
|
669
676
|
responseType: resType,
|
|
@@ -683,10 +690,10 @@ class HttpBackend {
|
|
|
683
690
|
else {
|
|
684
691
|
errorData = err.response.data;
|
|
685
692
|
}
|
|
686
|
-
throw new HttpResponseError(`Http error response: (${err.response.status}) ${errorData}`, err.response.status, err.response.statusText, errorData,
|
|
693
|
+
throw new HttpResponseError(`Http error response: (${err.response.status}) ${errorData}`, err.response.status, err.response.statusText, errorData, urlWithQuery);
|
|
687
694
|
}
|
|
688
695
|
else {
|
|
689
|
-
throw new HttpRequestFailed(
|
|
696
|
+
throw new HttpRequestFailed(String(method), urlWithQuery, err);
|
|
690
697
|
}
|
|
691
698
|
}
|
|
692
699
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taquito-http-utils.es6.js","sources":["../src/fetch-adapter.ts","../src/status_code.ts","../src/version.ts","../src/taquito-http-utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-var-requires */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { AxiosRequestConfig, AxiosResponse } from 'axios';\n\nconst settle = require('axios/lib/core/settle');\nconst buildURL = require('axios/lib/helpers/buildURL');\nconst buildFullPath = require('axios/lib/core/buildFullPath');\nconst { isUndefined, isStandardBrowserEnv, isFormData } = require('axios/lib/utils');\n\n/**\n * - Create a request object\n * - Get response body\n * - Check if timeout\n */\nexport default async function fetchAdapter(config: AxiosRequestConfig): Promise<AxiosResponse> {\n const request = createRequest(config);\n const promiseChain = [getResponse(request, config)];\n\n if (config.timeout && config.timeout > 0) {\n promiseChain.push(\n new Promise((res) => {\n setTimeout(() => {\n const message = config.timeoutErrorMessage\n ? config.timeoutErrorMessage\n : 'timeout of ' + config.timeout + 'ms exceeded';\n res(createError(message, config, 'ECONNABORTED', request));\n }, config.timeout);\n })\n );\n }\n\n const data = await Promise.race(promiseChain);\n return new Promise((resolve, reject) => {\n if (data instanceof Error) {\n reject(data);\n } else {\n const c: any = config;\n 'settle' in c && Object.prototype.toString.call(c.settle) === '[object Function]'\n ? c.settle(resolve, reject, data)\n : settle(resolve, reject, data);\n }\n });\n}\n\n/**\n * Fetch API stage two is to get response body. This function tries to retrieve\n * response body based on response's type\n */\nasync function getResponse(request: RequestInfo | URL, config: AxiosRequestConfig) {\n try {\n const stageOne = await fetch(request as any);\n\n let response: {\n ok: boolean;\n status: number;\n statusText: string;\n headers: Headers;\n config: AxiosRequestConfig;\n request: RequestInfo | URL;\n data?: unknown;\n } = {\n ok: stageOne.ok,\n status: stageOne.status,\n statusText: stageOne.statusText,\n headers: new Headers(stageOne.headers), // Make a copy of headers\n config: config,\n request,\n };\n if (stageOne.status >= 400) {\n return createError('Response Error', config, 'ERR_NETWORK', request, response);\n }\n\n response = {\n ok: stageOne.ok,\n status: stageOne.status,\n statusText: stageOne.statusText,\n headers: new Headers(stageOne.headers), // Make a copy of headers\n config: config,\n request,\n };\n\n if (stageOne.status >= 200 && stageOne.status !== 204) {\n switch (config.responseType) {\n case 'arraybuffer':\n response.data = await stageOne.arrayBuffer();\n break;\n case 'blob':\n response.data = await stageOne.blob();\n break;\n case 'json':\n response.data = await stageOne.json();\n break;\n // TODO: the next option does not exist in response type\n // case 'formData':\n // response.data = await stageOne.formData();\n // break;\n default:\n response.data = await stageOne.text();\n break;\n }\n }\n\n return response;\n } catch (e) {\n return createError('Network Error', config, 'ERR_NETWORK', request);\n }\n}\n\n/**\n * This function will create a Request object based on configuration's axios\n */\nfunction createRequest(config: AxiosRequestConfig) {\n const headers = new Headers(config.headers as any);\n\n // HTTP basic authentication\n if (config.auth) {\n const username = config.auth.username || '';\n const password = config.auth.password\n ? decodeURI(encodeURIComponent(config.auth.password))\n : '';\n headers.set('Authorization', `Basic ${btoa(username + ':' + password)}`);\n }\n\n const method = config.method?.toUpperCase();\n const options: RequestInit = {\n headers: headers,\n method,\n };\n if (method !== 'GET' && method !== 'HEAD') {\n options.body = config.data;\n\n // In these cases the browser will automatically set the correct Content-Type,\n // but only if that header hasn't been set yet. So that's why we're deleting it.\n if (isFormData(options.body) && isStandardBrowserEnv()) {\n headers.delete('Content-Type');\n }\n }\n const c = config as any;\n if ('mode' in c) {\n options.mode = c.mode as RequestMode;\n }\n if ('cache' in c) {\n options.cache = c.cache as RequestCache;\n }\n if ('integrity' in c) {\n options.integrity = c.integrity as string;\n }\n if ('redirect' in c) {\n options.redirect = c.redirect as RequestRedirect;\n }\n if ('referrer' in c) {\n options.referrer = c.referrer as string;\n }\n // This config is similar to XHR’s withCredentials flag, but with three available values instead of two.\n // So if withCredentials is not set, default value 'same-origin' will be used\n if (!isUndefined(c.withCredentials)) {\n options.credentials = c.withCredentials ? 'include' : 'omit';\n }\n\n const fullPath = buildFullPath(c.baseURL, c.url);\n const url = buildURL(fullPath, c.params, c.paramsSerializer);\n\n // Expected browser to throw error if there is any wrong configuration value\n return new Request(url, options);\n}\n\n/**\n * Note:\n *\n * From version >= 0.27.0, createError function is replaced by AxiosError class.\n * So I copy the old createError function here for backward compatible.\n *\n *\n *\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nfunction createError(\n message: string,\n config: AxiosRequestConfig,\n code?: string,\n request?: RequestInfo | URL,\n response?: object\n) {\n // TODO: this code never runs\n // if ('AxiosError' in axios && axios.AxiosError && typeof axios.AxiosError === 'function' && isConstructor(axios.AxiosError)) {\n // return new axios.AxiosError(message, axios.AxiosError[code], config, request, response);\n // }\n\n const error = new Error(message);\n return enhanceError(error, config, code, request, response);\n}\n\n/**\n *\n * Note:\n *\n * This function is for backward compatible.\n *\n *\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nfunction enhanceError(\n error: any,\n config: AxiosRequestConfig,\n code?: string,\n request?: RequestInfo | URL,\n response?: object\n) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n\n error.request = request;\n error.response = response;\n error.isAxiosError = true;\n\n error.toJSON = function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: 'description' in this ? this.description : undefined,\n number: 'number' in this ? this.number : undefined,\n // Mozilla\n fileName: 'fileName' in this ? this.fileName : undefined,\n lineNumber: 'lineNumber' in this ? this.lineNumber : undefined,\n columnNumber: 'columnNumber' in this ? this.columnNumber : undefined,\n stack: this.stack,\n // Axios\n config: this.config,\n code: this.code,\n status: this.response && this.response.status ? this.response.status : null,\n };\n };\n return error;\n}\n","/**\n * Hypertext Transfer Protocol (HTTP) response status codes.\n * @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}\n */\nexport enum STATUS_CODE {\n /**\n * The server has received the request headers and the client should proceed to send the request body\n * (in the case of a request for which a body needs to be sent; for example, a POST request).\n * Sending a large request body to a server after a request has been rejected for inappropriate headers would be inefficient.\n * To have a server check the request's headers, a client must send Expect: 100-continue as a header in its initial request\n * and receive a 100 Continue status code in response before sending the body. The response 417 Expectation Failed indicates the request should not be continued.\n */\n CONTINUE = 100,\n\n /**\n * The requester has asked the server to switch protocols and the server has agreed to do so.\n */\n SWITCHING_PROTOCOLS = 101,\n\n /**\n * A WebDAV request may contain many sub-requests involving file operations, requiring a long time to complete the request.\n * This code indicates that the server has received and is processing the request, but no response is available yet.\n * This prevents the client from timing out and assuming the request was lost.\n */\n PROCESSING = 102,\n\n /**\n * Standard response for successful HTTP requests.\n * The actual response will depend on the request method used.\n * In a GET request, the response will contain an entity corresponding to the requested resource.\n * In a POST request, the response will contain an entity describing or containing the result of the action.\n */\n OK = 200,\n\n /**\n * The request has been fulfilled, resulting in the creation of a new resource.\n */\n CREATED = 201,\n\n /**\n * The request has been accepted for processing, but the processing has not been completed.\n * The request might or might not be eventually acted upon, and may be disallowed when processing occurs.\n */\n ACCEPTED = 202,\n\n /**\n * SINCE HTTP/1.1\n * The server is a transforming proxy that received a 200 OK from its origin,\n * but is returning a modified version of the origin's response.\n */\n NON_AUTHORITATIVE_INFORMATION = 203,\n\n /**\n * The server successfully processed the request and is not returning any content.\n */\n NO_CONTENT = 204,\n\n /**\n * The server successfully processed the request, but is not returning any content.\n * Unlike a 204 response, this response requires that the requester reset the document view.\n */\n RESET_CONTENT = 205,\n\n /**\n * The server is delivering only part of the resource (byte serving) due to a range header sent by the client.\n * The range header is used by HTTP clients to enable resuming of interrupted downloads,\n * or split a download into multiple simultaneous streams.\n */\n PARTIAL_CONTENT = 206,\n\n /**\n * The message body that follows is an XML message and can contain a number of separate response codes,\n * depending on how many sub-requests were made.\n */\n MULTI_STATUS = 207,\n\n /**\n * The members of a DAV binding have already been enumerated in a preceding part of the (multistatus) response,\n * and are not being included again.\n */\n ALREADY_REPORTED = 208,\n\n /**\n * The server has fulfilled a request for the resource,\n * and the response is a representation of the result of one or more instance-manipulations applied to the current instance.\n */\n IM_USED = 226,\n\n /**\n * Indicates multiple options for the resource from which the client may choose (via agent-driven content negotiation).\n * For example, this code could be used to present multiple video format options,\n * to list files with different filename extensions, or to suggest word-sense disambiguation.\n */\n MULTIPLE_CHOICES = 300,\n\n /**\n * This and all future requests should be directed to the given URI.\n */\n MOVED_PERMANENTLY = 301,\n\n /**\n * This is an example of industry practice contradicting the standard.\n * The HTTP/1.0 specification (RFC 1945) required the client to perform a temporary redirect\n * (the original describing phrase was \"Moved Temporarily\"), but popular browsers implemented 302\n * with the functionality of a 303 See Other. Therefore, HTTP/1.1 added status codes 303 and 307\n * to distinguish between the two behaviours. However, some Web applications and frameworks\n * use the 302 status code as if it were the 303.\n */\n FOUND = 302,\n\n /**\n * SINCE HTTP/1.1\n * The response to the request can be found under another URI using a GET method.\n * When received in response to a POST (or PUT/DELETE), the client should presume that\n * the server has received the data and should issue a redirect with a separate GET message.\n */\n SEE_OTHER = 303,\n\n /**\n * Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match.\n * In such case, there is no need to retransmit the resource since the client still has a previously-downloaded copy.\n */\n NOT_MODIFIED = 304,\n\n /**\n * SINCE HTTP/1.1\n * The requested resource is available only through a proxy, the address for which is provided in the response.\n * Many HTTP clients (such as Mozilla and Internet Explorer) do not correctly handle responses with this status code, primarily for security reasons.\n */\n USE_PROXY = 305,\n\n /**\n * No longer used. Originally meant \"Subsequent requests should use the specified proxy.\"\n */\n SWITCH_PROXY = 306,\n\n /**\n * SINCE HTTP/1.1\n * In this case, the request should be repeated with another URI; however, future requests should still use the original URI.\n * In contrast to how 302 was historically implemented, the request method is not allowed to be changed when reissuing the original request.\n * For example, a POST request should be repeated using another POST request.\n */\n TEMPORARY_REDIRECT = 307,\n\n /**\n * The request and all future requests should be repeated using another URI.\n * 307 and 308 parallel the behaviors of 302 and 301, but do not allow the HTTP method to change.\n * So, for example, submitting a form to a permanently redirected resource may continue smoothly.\n */\n PERMANENT_REDIRECT = 308,\n\n /**\n * The server cannot or will not process the request due to an apparent client error\n * (e.g., malformed request syntax, too large size, invalid request message framing, or deceptive request routing).\n */\n BAD_REQUEST = 400,\n\n /**\n * Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet\n * been provided. The response must include a WWW-Authenticate header field containing a challenge applicable to the\n * requested resource. See Basic access authentication and Digest access authentication. 401 semantically means\n * \"unauthenticated\",i.e. the user does not have the necessary credentials.\n */\n UNAUTHORIZED = 401,\n\n /**\n * Reserved for future use. The original intention was that this code might be used as part of some form of digital\n * cash or micro payment scheme, but that has not happened, and this code is not usually used.\n * Google Developers API uses this status if a particular developer has exceeded the daily limit on requests.\n */\n PAYMENT_REQUIRED = 402,\n\n /**\n * The request was valid, but the server is refusing action.\n * The user might not have the necessary permissions for a resource.\n */\n FORBIDDEN = 403,\n\n /**\n * The requested resource could not be found but may be available in the future.\n * Subsequent requests by the client are permissible.\n */\n NOT_FOUND = 404,\n\n /**\n * A request method is not supported for the requested resource;\n * for example, a GET request on a form that requires data to be presented via POST, or a PUT request on a read-only resource.\n */\n METHOD_NOT_ALLOWED = 405,\n\n /**\n * The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.\n */\n NOT_ACCEPTABLE = 406,\n\n /**\n * The client must first authenticate itself with the proxy.\n */\n PROXY_AUTHENTICATION_REQUIRED = 407,\n\n /**\n * The server timed out waiting for the request.\n * According to HTTP specifications:\n * \"The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time.\"\n */\n REQUEST_TIMEOUT = 408,\n\n /**\n * Indicates that the request could not be processed because of conflict in the request,\n * such as an edit conflict between multiple simultaneous updates.\n */\n CONFLICT = 409,\n\n /**\n * Indicates that the resource requested is no longer available and will not be available again.\n * This should be used when a resource has been intentionally removed and the resource should be purged.\n * Upon receiving a 410 status code, the client should not request the resource in the future.\n * Clients such as search engines should remove the resource from their indices.\n * Most use cases do not require clients and search engines to purge the resource, and a \"404 Not Found\" may be used instead.\n */\n GONE = 410,\n\n /**\n * The request did not specify the length of its content, which is required by the requested resource.\n */\n LENGTH_REQUIRED = 411,\n\n /**\n * The server does not meet one of the preconditions that the requester put on the request.\n */\n PRECONDITION_FAILED = 412,\n\n /**\n * The request is larger than the server is willing or able to process. Previously called \"Request Entity Too Large\".\n */\n PAYLOAD_TOO_LARGE = 413,\n\n /**\n * The URI provided was too long for the server to process. Often the result of too much data being encoded as a query-string of a GET request,\n * in which case it should be converted to a POST request.\n * Called \"Request-URI Too Long\" previously.\n */\n URI_TOO_LONG = 414,\n\n /**\n * The request entity has a media type which the server or resource does not support.\n * For example, the client uploads an image as image/svg+xml, but the server requires that images use a different format.\n */\n UNSUPPORTED_MEDIA_TYPE = 415,\n\n /**\n * The client has asked for a portion of the file (byte serving), but the server cannot supply that portion.\n * For example, if the client asked for a part of the file that lies beyond the end of the file.\n * Called \"Requested Range Not Satisfiable\" previously.\n */\n RANGE_NOT_SATISFIABLE = 416,\n\n /**\n * The server cannot meet the requirements of the Expect request-header field.\n */\n EXPECTATION_FAILED = 417,\n\n /**\n * This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol,\n * and is not expected to be implemented by actual HTTP servers. The RFC specifies this code should be returned by\n * teapots requested to brew coffee. This HTTP status is used as an Easter egg in some websites, including Google.com.\n */\n I_AM_A_TEAPOT = 418,\n\n /**\n * The request was directed at a server that is not able to produce a response (for example because a connection reuse).\n */\n MISDIRECTED_REQUEST = 421,\n\n /**\n * The request was well-formed but was unable to be followed due to semantic errors.\n */\n UNPROCESSABLE_ENTITY = 422,\n\n /**\n * The resource that is being accessed is locked.\n */\n LOCKED = 423,\n\n /**\n * The request failed due to failure of a previous request (e.g., a PROPPATCH).\n */\n FAILED_DEPENDENCY = 424,\n\n /**\n * The client should switch to a different protocol such as TLS/1.0, given in the Upgrade header field.\n */\n UPGRADE_REQUIRED = 426,\n\n /**\n * The origin server requires the request to be conditional.\n * Intended to prevent \"the 'lost update' problem, where a client\n * GETs a resource's state, modifies it, and PUTs it back to the server,\n * when meanwhile a third party has modified the state on the server, leading to a conflict.\"\n */\n PRECONDITION_REQUIRED = 428,\n\n /**\n * The user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes.\n */\n TOO_MANY_REQUESTS = 429,\n\n /**\n * The server is unwilling to process the request because either an individual header field,\n * or all the header fields collectively, are too large.\n */\n REQUEST_HEADER_FIELDS_TOO_LARGE = 431,\n\n /**\n * A server operator has received a legal demand to deny access to a resource or to a set of resources\n * that includes the requested resource. The code 451 was chosen as a reference to the novel Fahrenheit 451.\n */\n UNAVAILABLE_FOR_LEGAL_REASONS = 451,\n\n /**\n * A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.\n */\n INTERNAL_SERVER_ERROR = 500,\n\n /**\n * The server either does not recognize the request method, or it lacks the ability to fulfill the request.\n * Usually this implies future availability (e.g., a new feature of a web-service API).\n */\n NOT_IMPLEMENTED = 501,\n\n /**\n * The server was acting as a gateway or proxy and received an invalid response from the upstream server.\n */\n BAD_GATEWAY = 502,\n\n /**\n * The server is currently unavailable (because it is overloaded or down for maintenance).\n * Generally, this is a temporary state.\n */\n SERVICE_UNAVAILABLE = 503,\n\n /**\n * The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.\n */\n GATEWAY_TIMEOUT = 504,\n\n /**\n * The server does not support the HTTP protocol version used in the request\n */\n HTTP_VERSION_NOT_SUPPORTED = 505,\n\n /**\n * Transparent content negotiation for the request results in a circular reference.\n */\n VARIANT_ALSO_NEGOTIATES = 506,\n\n /**\n * The server is unable to store the representation needed to complete the request.\n */\n INSUFFICIENT_STORAGE = 507,\n\n /**\n * The server detected an infinite loop while processing the request.\n */\n LOOP_DETECTED = 508,\n\n /**\n * Further extensions to the request are required for the server to fulfill it.\n */\n NOT_EXTENDED = 510,\n\n /**\n * The client needs to authenticate to gain network access.\n * Intended for use by intercepting proxies used to control access to the network (e.g., \"captive portals\" used\n * to require agreement to Terms of Service before granting full Internet access via a Wi-Fi hotspot).\n */\n NETWORK_AUTHENTICATION_REQUIRED = 511,\n}\n","\n// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!\nexport const VERSION = {\n \"commitHash\": \"adc0f8c31492e8eb2f03b06ac36ba053e8ba6224\",\n \"version\": \"16.2.0\"\n};\n","/**\n * @packageDocumentation\n * @module @taquito/http-utils\n */\n\nimport fetchAdapter from './fetch-adapter';\nimport { STATUS_CODE } from './status_code';\nimport axios from 'axios';\n\nconst isNode = typeof process !== 'undefined' && !!process?.versions?.node;\n\nconst adapter = isNode ? undefined : fetchAdapter;\n\nexport * from './status_code';\nexport { VERSION } from './version';\n\nenum ResponseType {\n TEXT = 'text',\n JSON = 'json',\n}\n\ntype ObjectType = Record<string, any>;\n\nexport interface HttpRequestOptions {\n url: string;\n method?: 'GET' | 'POST';\n timeout?: number;\n json?: boolean;\n query?: ObjectType;\n headers?: { [key: string]: string };\n mimeType?: string;\n}\n\n/**\n * @category Error\n * @description This error will be thrown when the endpoint returns an HTTP error to the client\n */\nexport class HttpResponseError extends Error {\n public name = 'HttpResponse';\n\n constructor(\n public message: string,\n public status: STATUS_CODE,\n public statusText: string,\n public body: string,\n public url: string\n ) {\n super(message);\n }\n}\n\n/**\n * @category Error\n * @description Error that indicates a general failure in making the HTTP request\n */\nexport class HttpRequestFailed extends Error {\n public name = 'HttpRequestFailed';\n\n constructor(public message: string) {\n super(message);\n }\n}\n\nexport class HttpBackend {\n constructor(private timeout: number = 30000) {}\n\n protected serialize(obj?: ObjectType) {\n if (!obj) {\n return '';\n }\n\n const str = [];\n for (const p in obj) {\n // eslint-disable-next-line no-prototype-builtins\n if (obj.hasOwnProperty(p) && typeof obj[p] !== 'undefined') {\n const prop = typeof obj[p].toJSON === 'function' ? obj[p].toJSON() : obj[p];\n // query arguments can have no value so we need some way of handling that\n // example https://domain.com/query?all\n if (prop === null) {\n str.push(encodeURIComponent(p));\n continue;\n }\n // another use case is multiple arguments with the same name\n // they are passed as array\n if (Array.isArray(prop)) {\n prop.forEach((item) => {\n str.push(encodeURIComponent(p) + '=' + encodeURIComponent(item));\n });\n continue;\n }\n str.push(encodeURIComponent(p) + '=' + encodeURIComponent(prop));\n }\n }\n const serialized = str.join('&');\n if (serialized) {\n return `?${serialized}`;\n } else {\n return '';\n }\n }\n\n /**\n *\n * @param options contains options to be passed for the HTTP request (url, method and timeout)\n */\n async createRequest<T>(\n { url, method, timeout = this.timeout, query, headers = {}, json = true }: HttpRequestOptions,\n data?: object | string\n ) {\n let resType: ResponseType;\n let transformResponse = undefined;\n\n if (!headers['Content-Type']) {\n headers['Content-Type'] = 'application/json';\n }\n\n if (!json) {\n resType = ResponseType.TEXT;\n transformResponse = [<Type>(v: Type) => v];\n } else {\n resType = ResponseType.JSON;\n }\n\n try {\n const response = await axios.request<T>({\n url: url + this.serialize(query),\n method: method ?? 'GET',\n headers: headers,\n responseType: resType,\n transformResponse,\n timeout: timeout,\n data: data,\n adapter,\n });\n\n return response.data;\n } catch (err: any) {\n if ((axios.isAxiosError(err) && err.response) || (!isNode && err.response)) {\n let errorData;\n\n if (typeof err.response.data === 'object') {\n errorData = JSON.stringify(err.response.data);\n } else {\n errorData = err.response.data;\n }\n\n throw new HttpResponseError(\n `Http error response: (${err.response.status}) ${errorData}`,\n err.response.status as STATUS_CODE,\n err.response.statusText,\n errorData,\n url + this.serialize(query)\n );\n } else {\n throw new HttpRequestFailed(`${method} ${url + this.serialize(query)} ${String(err)}`);\n }\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAKA,MAAM,M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AAA,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAA,EAAA,EAAK,SAAS,CAAE,CAAA,EAC5D,GAAG,CAAC,QAAQ,CAAC,MAAqB,EAClC,GAAG,CAAC,QAAQ,CAAC,UAAU,EACvB,SAAS,EACT,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAC5B,CAAC;AACH,iBAAA;AAAM,qBAAA;oBACL,MAAM,IAAI,iBAAiB,CAAC,CAAA,EAAG,MAAM,CAAI,CAAA,EAAA,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAI,CAAA,EAAA,MAAM,CAAC,GAAG,CAAC,CAAE,CAAA,CAAC,CAAC;AACxF,iBAAA;AACF,aAAA;SACF,CAAA,CAAA;AAAA,KAAA;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"taquito-http-utils.es6.js","sources":["../src/fetch-adapter.ts","../src/errors.ts","../src/status_code.ts","../src/version.ts","../src/taquito-http-utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-var-requires */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { AxiosRequestConfig, AxiosResponse } from 'axios';\n\nconst settle = require('axios/lib/core/settle');\nconst buildURL = require('axios/lib/helpers/buildURL');\nconst buildFullPath = require('axios/lib/core/buildFullPath');\nconst { isUndefined, isStandardBrowserEnv, isFormData } = require('axios/lib/utils');\n\n/**\n * - Create a request object\n * - Get response body\n * - Check if timeout\n */\nexport default async function fetchAdapter(config: AxiosRequestConfig): Promise<AxiosResponse> {\n const request = createRequest(config);\n const promiseChain = [getResponse(request, config)];\n\n if (config.timeout && config.timeout > 0) {\n promiseChain.push(\n new Promise((res) => {\n setTimeout(() => {\n const message = config.timeoutErrorMessage\n ? config.timeoutErrorMessage\n : 'timeout of ' + config.timeout + 'ms exceeded';\n res(createError(message, config, 'ECONNABORTED', request));\n }, config.timeout);\n })\n );\n }\n\n const data = await Promise.race(promiseChain);\n return new Promise((resolve, reject) => {\n if (data instanceof Error) {\n reject(data);\n } else {\n const c: any = config;\n 'settle' in c && Object.prototype.toString.call(c.settle) === '[object Function]'\n ? c.settle(resolve, reject, data)\n : settle(resolve, reject, data);\n }\n });\n}\n\n/**\n * Fetch API stage two is to get response body. This function tries to retrieve\n * response body based on response's type\n */\nasync function getResponse(request: RequestInfo | URL, config: AxiosRequestConfig) {\n try {\n const stageOne = await fetch(request as any);\n\n let response: {\n ok: boolean;\n status: number;\n statusText: string;\n headers: Headers;\n config: AxiosRequestConfig;\n request: RequestInfo | URL;\n data?: unknown;\n } = {\n ok: stageOne.ok,\n status: stageOne.status,\n statusText: stageOne.statusText,\n headers: new Headers(stageOne.headers), // Make a copy of headers\n config: config,\n request,\n };\n if (stageOne.status >= 400) {\n return createError('Response Error', config, 'ERR_NETWORK', request, response);\n }\n\n response = {\n ok: stageOne.ok,\n status: stageOne.status,\n statusText: stageOne.statusText,\n headers: new Headers(stageOne.headers), // Make a copy of headers\n config: config,\n request,\n };\n\n if (stageOne.status >= 200 && stageOne.status !== 204) {\n switch (config.responseType) {\n case 'arraybuffer':\n response.data = await stageOne.arrayBuffer();\n break;\n case 'blob':\n response.data = await stageOne.blob();\n break;\n case 'json':\n response.data = await stageOne.json();\n break;\n // TODO: the next option does not exist in response type\n // case 'formData':\n // response.data = await stageOne.formData();\n // break;\n default:\n response.data = await stageOne.text();\n break;\n }\n }\n\n return response;\n } catch (e) {\n return createError('Network Error', config, 'ERR_NETWORK', request);\n }\n}\n\n/**\n * This function will create a Request object based on configuration's axios\n */\nfunction createRequest(config: AxiosRequestConfig) {\n const headers = new Headers(config.headers as any);\n\n // HTTP basic authentication\n if (config.auth) {\n const username = config.auth.username || '';\n const password = config.auth.password\n ? decodeURI(encodeURIComponent(config.auth.password))\n : '';\n headers.set('Authorization', `Basic ${btoa(username + ':' + password)}`);\n }\n\n const method = config.method?.toUpperCase();\n const options: RequestInit = {\n headers: headers,\n method,\n };\n if (method !== 'GET' && method !== 'HEAD') {\n options.body = config.data;\n\n // In these cases the browser will automatically set the correct Content-Type,\n // but only if that header hasn't been set yet. So that's why we're deleting it.\n if (isFormData(options.body) && isStandardBrowserEnv()) {\n headers.delete('Content-Type');\n }\n }\n const c = config as any;\n if ('mode' in c) {\n options.mode = c.mode as RequestMode;\n }\n if ('cache' in c) {\n options.cache = c.cache as RequestCache;\n }\n if ('integrity' in c) {\n options.integrity = c.integrity as string;\n }\n if ('redirect' in c) {\n options.redirect = c.redirect as RequestRedirect;\n }\n if ('referrer' in c) {\n options.referrer = c.referrer as string;\n }\n // This config is similar to XHR’s withCredentials flag, but with three available values instead of two.\n // So if withCredentials is not set, default value 'same-origin' will be used\n if (!isUndefined(c.withCredentials)) {\n options.credentials = c.withCredentials ? 'include' : 'omit';\n }\n\n const fullPath = buildFullPath(c.baseURL, c.url);\n const url = buildURL(fullPath, c.params, c.paramsSerializer);\n\n // Expected browser to throw error if there is any wrong configuration value\n return new Request(url, options);\n}\n\n/**\n * Note:\n *\n * From version >= 0.27.0, createError function is replaced by AxiosError class.\n * So I copy the old createError function here for backward compatible.\n *\n *\n *\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nfunction createError(\n message: string,\n config: AxiosRequestConfig,\n code?: string,\n request?: RequestInfo | URL,\n response?: object\n) {\n // TODO: this code never runs\n // if ('AxiosError' in axios && axios.AxiosError && typeof axios.AxiosError === 'function' && isConstructor(axios.AxiosError)) {\n // return new axios.AxiosError(message, axios.AxiosError[code], config, request, response);\n // }\n\n const error = new Error(message);\n return enhanceError(error, config, code, request, response);\n}\n\n/**\n *\n * Note:\n *\n * This function is for backward compatible.\n *\n *\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nfunction enhanceError(\n error: any,\n config: AxiosRequestConfig,\n code?: string,\n request?: RequestInfo | URL,\n response?: object\n) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n\n error.request = request;\n error.response = response;\n error.isAxiosError = true;\n\n error.toJSON = function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: 'description' in this ? this.description : undefined,\n number: 'number' in this ? this.number : undefined,\n // Mozilla\n fileName: 'fileName' in this ? this.fileName : undefined,\n lineNumber: 'lineNumber' in this ? this.lineNumber : undefined,\n columnNumber: 'columnNumber' in this ? this.columnNumber : undefined,\n stack: this.stack,\n // Axios\n config: this.config,\n code: this.code,\n status: this.response && this.response.status ? this.response.status : null,\n };\n };\n return error;\n}\n","import { NetworkError } from '@taquito/core';\nimport { STATUS_CODE } from './status_code';\n\n/**\n * @category Error\n * @description Error indicates a general failure in making the HTTP request\n */\nexport class HttpRequestFailed extends NetworkError {\n constructor(public method: string, public url: string, public cause: Error) {\n super();\n this.name = 'HttpRequestFailed';\n this.message = `${method} ${url} ${String(cause)}`;\n }\n}\n\n/**\n * @category Error\n * @description Error thrown when the endpoint returns an HTTP error to the client\n */\nexport class HttpResponseError extends NetworkError {\n public name = 'HttpResponse';\n\n constructor(\n public message: string,\n public status: STATUS_CODE,\n public statusText: string,\n public body: string,\n public url: string\n ) {\n super(message);\n }\n}\n","/**\n * Hypertext Transfer Protocol (HTTP) response status codes.\n * @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}\n */\nexport enum STATUS_CODE {\n /**\n * The server has received the request headers and the client should proceed to send the request body\n * (in the case of a request for which a body needs to be sent; for example, a POST request).\n * Sending a large request body to a server after a request has been rejected for inappropriate headers would be inefficient.\n * To have a server check the request's headers, a client must send Expect: 100-continue as a header in its initial request\n * and receive a 100 Continue status code in response before sending the body. The response 417 Expectation Failed indicates the request should not be continued.\n */\n CONTINUE = 100,\n\n /**\n * The requester has asked the server to switch protocols and the server has agreed to do so.\n */\n SWITCHING_PROTOCOLS = 101,\n\n /**\n * A WebDAV request may contain many sub-requests involving file operations, requiring a long time to complete the request.\n * This code indicates that the server has received and is processing the request, but no response is available yet.\n * This prevents the client from timing out and assuming the request was lost.\n */\n PROCESSING = 102,\n\n /**\n * Standard response for successful HTTP requests.\n * The actual response will depend on the request method used.\n * In a GET request, the response will contain an entity corresponding to the requested resource.\n * In a POST request, the response will contain an entity describing or containing the result of the action.\n */\n OK = 200,\n\n /**\n * The request has been fulfilled, resulting in the creation of a new resource.\n */\n CREATED = 201,\n\n /**\n * The request has been accepted for processing, but the processing has not been completed.\n * The request might or might not be eventually acted upon, and may be disallowed when processing occurs.\n */\n ACCEPTED = 202,\n\n /**\n * SINCE HTTP/1.1\n * The server is a transforming proxy that received a 200 OK from its origin,\n * but is returning a modified version of the origin's response.\n */\n NON_AUTHORITATIVE_INFORMATION = 203,\n\n /**\n * The server successfully processed the request and is not returning any content.\n */\n NO_CONTENT = 204,\n\n /**\n * The server successfully processed the request, but is not returning any content.\n * Unlike a 204 response, this response requires that the requester reset the document view.\n */\n RESET_CONTENT = 205,\n\n /**\n * The server is delivering only part of the resource (byte serving) due to a range header sent by the client.\n * The range header is used by HTTP clients to enable resuming of interrupted downloads,\n * or split a download into multiple simultaneous streams.\n */\n PARTIAL_CONTENT = 206,\n\n /**\n * The message body that follows is an XML message and can contain a number of separate response codes,\n * depending on how many sub-requests were made.\n */\n MULTI_STATUS = 207,\n\n /**\n * The members of a DAV binding have already been enumerated in a preceding part of the (multistatus) response,\n * and are not being included again.\n */\n ALREADY_REPORTED = 208,\n\n /**\n * The server has fulfilled a request for the resource,\n * and the response is a representation of the result of one or more instance-manipulations applied to the current instance.\n */\n IM_USED = 226,\n\n /**\n * Indicates multiple options for the resource from which the client may choose (via agent-driven content negotiation).\n * For example, this code could be used to present multiple video format options,\n * to list files with different filename extensions, or to suggest word-sense disambiguation.\n */\n MULTIPLE_CHOICES = 300,\n\n /**\n * This and all future requests should be directed to the given URI.\n */\n MOVED_PERMANENTLY = 301,\n\n /**\n * This is an example of industry practice contradicting the standard.\n * The HTTP/1.0 specification (RFC 1945) required the client to perform a temporary redirect\n * (the original describing phrase was \"Moved Temporarily\"), but popular browsers implemented 302\n * with the functionality of a 303 See Other. Therefore, HTTP/1.1 added status codes 303 and 307\n * to distinguish between the two behaviours. However, some Web applications and frameworks\n * use the 302 status code as if it were the 303.\n */\n FOUND = 302,\n\n /**\n * SINCE HTTP/1.1\n * The response to the request can be found under another URI using a GET method.\n * When received in response to a POST (or PUT/DELETE), the client should presume that\n * the server has received the data and should issue a redirect with a separate GET message.\n */\n SEE_OTHER = 303,\n\n /**\n * Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match.\n * In such case, there is no need to retransmit the resource since the client still has a previously-downloaded copy.\n */\n NOT_MODIFIED = 304,\n\n /**\n * SINCE HTTP/1.1\n * The requested resource is available only through a proxy, the address for which is provided in the response.\n * Many HTTP clients (such as Mozilla and Internet Explorer) do not correctly handle responses with this status code, primarily for security reasons.\n */\n USE_PROXY = 305,\n\n /**\n * No longer used. Originally meant \"Subsequent requests should use the specified proxy.\"\n */\n SWITCH_PROXY = 306,\n\n /**\n * SINCE HTTP/1.1\n * In this case, the request should be repeated with another URI; however, future requests should still use the original URI.\n * In contrast to how 302 was historically implemented, the request method is not allowed to be changed when reissuing the original request.\n * For example, a POST request should be repeated using another POST request.\n */\n TEMPORARY_REDIRECT = 307,\n\n /**\n * The request and all future requests should be repeated using another URI.\n * 307 and 308 parallel the behaviors of 302 and 301, but do not allow the HTTP method to change.\n * So, for example, submitting a form to a permanently redirected resource may continue smoothly.\n */\n PERMANENT_REDIRECT = 308,\n\n /**\n * The server cannot or will not process the request due to an apparent client error\n * (e.g., malformed request syntax, too large size, invalid request message framing, or deceptive request routing).\n */\n BAD_REQUEST = 400,\n\n /**\n * Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet\n * been provided. The response must include a WWW-Authenticate header field containing a challenge applicable to the\n * requested resource. See Basic access authentication and Digest access authentication. 401 semantically means\n * \"unauthenticated\",i.e. the user does not have the necessary credentials.\n */\n UNAUTHORIZED = 401,\n\n /**\n * Reserved for future use. The original intention was that this code might be used as part of some form of digital\n * cash or micro payment scheme, but that has not happened, and this code is not usually used.\n * Google Developers API uses this status if a particular developer has exceeded the daily limit on requests.\n */\n PAYMENT_REQUIRED = 402,\n\n /**\n * The request was valid, but the server is refusing action.\n * The user might not have the necessary permissions for a resource.\n */\n FORBIDDEN = 403,\n\n /**\n * The requested resource could not be found but may be available in the future.\n * Subsequent requests by the client are permissible.\n */\n NOT_FOUND = 404,\n\n /**\n * A request method is not supported for the requested resource;\n * for example, a GET request on a form that requires data to be presented via POST, or a PUT request on a read-only resource.\n */\n METHOD_NOT_ALLOWED = 405,\n\n /**\n * The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.\n */\n NOT_ACCEPTABLE = 406,\n\n /**\n * The client must first authenticate itself with the proxy.\n */\n PROXY_AUTHENTICATION_REQUIRED = 407,\n\n /**\n * The server timed out waiting for the request.\n * According to HTTP specifications:\n * \"The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time.\"\n */\n REQUEST_TIMEOUT = 408,\n\n /**\n * Indicates that the request could not be processed because of conflict in the request,\n * such as an edit conflict between multiple simultaneous updates.\n */\n CONFLICT = 409,\n\n /**\n * Indicates that the resource requested is no longer available and will not be available again.\n * This should be used when a resource has been intentionally removed and the resource should be purged.\n * Upon receiving a 410 status code, the client should not request the resource in the future.\n * Clients such as search engines should remove the resource from their indices.\n * Most use cases do not require clients and search engines to purge the resource, and a \"404 Not Found\" may be used instead.\n */\n GONE = 410,\n\n /**\n * The request did not specify the length of its content, which is required by the requested resource.\n */\n LENGTH_REQUIRED = 411,\n\n /**\n * The server does not meet one of the preconditions that the requester put on the request.\n */\n PRECONDITION_FAILED = 412,\n\n /**\n * The request is larger than the server is willing or able to process. Previously called \"Request Entity Too Large\".\n */\n PAYLOAD_TOO_LARGE = 413,\n\n /**\n * The URI provided was too long for the server to process. Often the result of too much data being encoded as a query-string of a GET request,\n * in which case it should be converted to a POST request.\n * Called \"Request-URI Too Long\" previously.\n */\n URI_TOO_LONG = 414,\n\n /**\n * The request entity has a media type which the server or resource does not support.\n * For example, the client uploads an image as image/svg+xml, but the server requires that images use a different format.\n */\n UNSUPPORTED_MEDIA_TYPE = 415,\n\n /**\n * The client has asked for a portion of the file (byte serving), but the server cannot supply that portion.\n * For example, if the client asked for a part of the file that lies beyond the end of the file.\n * Called \"Requested Range Not Satisfiable\" previously.\n */\n RANGE_NOT_SATISFIABLE = 416,\n\n /**\n * The server cannot meet the requirements of the Expect request-header field.\n */\n EXPECTATION_FAILED = 417,\n\n /**\n * This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol,\n * and is not expected to be implemented by actual HTTP servers. The RFC specifies this code should be returned by\n * teapots requested to brew coffee. This HTTP status is used as an Easter egg in some websites, including Google.com.\n */\n I_AM_A_TEAPOT = 418,\n\n /**\n * The request was directed at a server that is not able to produce a response (for example because a connection reuse).\n */\n MISDIRECTED_REQUEST = 421,\n\n /**\n * The request was well-formed but was unable to be followed due to semantic errors.\n */\n UNPROCESSABLE_ENTITY = 422,\n\n /**\n * The resource that is being accessed is locked.\n */\n LOCKED = 423,\n\n /**\n * The request failed due to failure of a previous request (e.g., a PROPPATCH).\n */\n FAILED_DEPENDENCY = 424,\n\n /**\n * The client should switch to a different protocol such as TLS/1.0, given in the Upgrade header field.\n */\n UPGRADE_REQUIRED = 426,\n\n /**\n * The origin server requires the request to be conditional.\n * Intended to prevent \"the 'lost update' problem, where a client\n * GETs a resource's state, modifies it, and PUTs it back to the server,\n * when meanwhile a third party has modified the state on the server, leading to a conflict.\"\n */\n PRECONDITION_REQUIRED = 428,\n\n /**\n * The user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes.\n */\n TOO_MANY_REQUESTS = 429,\n\n /**\n * The server is unwilling to process the request because either an individual header field,\n * or all the header fields collectively, are too large.\n */\n REQUEST_HEADER_FIELDS_TOO_LARGE = 431,\n\n /**\n * A server operator has received a legal demand to deny access to a resource or to a set of resources\n * that includes the requested resource. The code 451 was chosen as a reference to the novel Fahrenheit 451.\n */\n UNAVAILABLE_FOR_LEGAL_REASONS = 451,\n\n /**\n * A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.\n */\n INTERNAL_SERVER_ERROR = 500,\n\n /**\n * The server either does not recognize the request method, or it lacks the ability to fulfill the request.\n * Usually this implies future availability (e.g., a new feature of a web-service API).\n */\n NOT_IMPLEMENTED = 501,\n\n /**\n * The server was acting as a gateway or proxy and received an invalid response from the upstream server.\n */\n BAD_GATEWAY = 502,\n\n /**\n * The server is currently unavailable (because it is overloaded or down for maintenance).\n * Generally, this is a temporary state.\n */\n SERVICE_UNAVAILABLE = 503,\n\n /**\n * The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.\n */\n GATEWAY_TIMEOUT = 504,\n\n /**\n * The server does not support the HTTP protocol version used in the request\n */\n HTTP_VERSION_NOT_SUPPORTED = 505,\n\n /**\n * Transparent content negotiation for the request results in a circular reference.\n */\n VARIANT_ALSO_NEGOTIATES = 506,\n\n /**\n * The server is unable to store the representation needed to complete the request.\n */\n INSUFFICIENT_STORAGE = 507,\n\n /**\n * The server detected an infinite loop while processing the request.\n */\n LOOP_DETECTED = 508,\n\n /**\n * Further extensions to the request are required for the server to fulfill it.\n */\n NOT_EXTENDED = 510,\n\n /**\n * The client needs to authenticate to gain network access.\n * Intended for use by intercepting proxies used to control access to the network (e.g., \"captive portals\" used\n * to require agreement to Terms of Service before granting full Internet access via a Wi-Fi hotspot).\n */\n NETWORK_AUTHENTICATION_REQUIRED = 511,\n}\n","\n// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!\nexport const VERSION = {\n \"commitHash\": \"b357541c90c2168d48216d62a07de5dd3baab9a0\",\n \"version\": \"17.0.0\"\n};\n","/**\n * @packageDocumentation\n * @module @taquito/http-utils\n */\n\nimport fetchAdapter from './fetch-adapter';\nimport { STATUS_CODE } from './status_code';\nimport axios from 'axios';\nimport { HttpRequestFailed, HttpResponseError } from './errors';\n\nconst isNode = typeof process !== 'undefined' && !!process?.versions?.node;\n\nconst adapter = isNode ? undefined : fetchAdapter;\n\nexport * from './status_code';\nexport { VERSION } from './version';\nexport { HttpRequestFailed, HttpResponseError } from './errors';\n\nenum ResponseType {\n TEXT = 'text',\n JSON = 'json',\n}\n\ntype ObjectType = Record<string, any>;\n\nexport interface HttpRequestOptions {\n url: string;\n method?: 'GET' | 'POST';\n timeout?: number;\n json?: boolean;\n query?: ObjectType;\n headers?: { [key: string]: string };\n mimeType?: string;\n}\n\nexport class HttpBackend {\n constructor(private timeout: number = 30000) {}\n\n protected serialize(obj?: ObjectType) {\n if (!obj) {\n return '';\n }\n\n const str = [];\n for (const p in obj) {\n // eslint-disable-next-line no-prototype-builtins\n if (obj.hasOwnProperty(p) && typeof obj[p] !== 'undefined') {\n const prop = typeof obj[p].toJSON === 'function' ? obj[p].toJSON() : obj[p];\n // query arguments can have no value so we need some way of handling that\n // example https://domain.com/query?all\n if (prop === null) {\n str.push(encodeURIComponent(p));\n continue;\n }\n // another use case is multiple arguments with the same name\n // they are passed as array\n if (Array.isArray(prop)) {\n prop.forEach((item) => {\n str.push(encodeURIComponent(p) + '=' + encodeURIComponent(item));\n });\n continue;\n }\n str.push(encodeURIComponent(p) + '=' + encodeURIComponent(prop));\n }\n }\n const serialized = str.join('&');\n if (serialized) {\n return `?${serialized}`;\n } else {\n return '';\n }\n }\n\n /**\n *\n * @param options contains options to be passed for the HTTP request (url, method and timeout)\n * @throws {@link HttpRequestFailed} | {@link HttpResponseError}\n */\n async createRequest<T>(\n { url, method, timeout = this.timeout, query, headers = {}, json = true }: HttpRequestOptions,\n data?: object | string\n ) {\n const urlWithQuery = url + this.serialize(query);\n let resType: ResponseType;\n let transformResponse = undefined;\n\n if (!headers['Content-Type']) {\n headers['Content-Type'] = 'application/json';\n }\n\n if (!json) {\n resType = ResponseType.TEXT;\n transformResponse = [<Type>(v: Type) => v];\n } else {\n resType = ResponseType.JSON;\n }\n\n try {\n const response = await axios.request<T>({\n url: urlWithQuery,\n method: method ?? 'GET',\n headers: headers,\n responseType: resType,\n transformResponse,\n timeout: timeout,\n data: data,\n adapter,\n });\n\n return response.data;\n } catch (err: any) {\n if ((axios.isAxiosError(err) && err.response) || (!isNode && err.response)) {\n let errorData;\n\n if (typeof err.response.data === 'object') {\n errorData = JSON.stringify(err.response.data);\n } else {\n errorData = err.response.data;\n }\n\n throw new HttpResponseError(\n `Http error response: (${err.response.status}) ${errorData}`,\n err.response.status as STATUS_CODE,\n err.response.statusText,\n errorData,\n urlWithQuery\n );\n } else {\n throw new HttpRequestFailed(String(method), urlWithQuery, err);\n }\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAKA,MAAM,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAChD,MAAM,QAAQ,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AACvD,MAAM,aAAa,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAC9D,MAAM,EAAE,WAAW,EAAE,oBAAoB,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAErF;;;;AAIG;AAC2B,SAAA,YAAY,CAAC,MAA0B,EAAA;;AACnE,QAAA,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;QACtC,MAAM,YAAY,GAAG,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;QAEpD,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,GAAG,CAAC,EAAE;YACxC,YAAY,CAAC,IAAI,CACf,IAAI,OAAO,CAAC,CAAC,GAAG,KAAI;gBAClB,UAA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;AACF,aAAA;SACF,CAAA,CAAA;AAAA,KAAA;AACF;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('axios')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'axios'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.taquitoHttpUtils = {}, global.axios));
|
|
5
|
-
})(this, (function (exports, axios) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('axios'), require('@taquito/core')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'axios', '@taquito/core'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.taquitoHttpUtils = {}, global.axios, global.core));
|
|
5
|
+
})(this, (function (exports, axios, core) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -249,6 +249,36 @@
|
|
|
249
249
|
return error;
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
+
/**
|
|
253
|
+
* @category Error
|
|
254
|
+
* @description Error indicates a general failure in making the HTTP request
|
|
255
|
+
*/
|
|
256
|
+
class HttpRequestFailed extends core.NetworkError {
|
|
257
|
+
constructor(method, url, cause) {
|
|
258
|
+
super();
|
|
259
|
+
this.method = method;
|
|
260
|
+
this.url = url;
|
|
261
|
+
this.cause = cause;
|
|
262
|
+
this.name = 'HttpRequestFailed';
|
|
263
|
+
this.message = `${method} ${url} ${String(cause)}`;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* @category Error
|
|
268
|
+
* @description Error thrown when the endpoint returns an HTTP error to the client
|
|
269
|
+
*/
|
|
270
|
+
class HttpResponseError extends core.NetworkError {
|
|
271
|
+
constructor(message, status, statusText, body, url) {
|
|
272
|
+
super(message);
|
|
273
|
+
this.message = message;
|
|
274
|
+
this.status = status;
|
|
275
|
+
this.statusText = statusText;
|
|
276
|
+
this.body = body;
|
|
277
|
+
this.url = url;
|
|
278
|
+
this.name = 'HttpResponse';
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
252
282
|
/**
|
|
253
283
|
* Hypertext Transfer Protocol (HTTP) response status codes.
|
|
254
284
|
* @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}
|
|
@@ -571,8 +601,8 @@
|
|
|
571
601
|
|
|
572
602
|
// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
|
|
573
603
|
const VERSION = {
|
|
574
|
-
"commitHash": "
|
|
575
|
-
"version": "
|
|
604
|
+
"commitHash": "b357541c90c2168d48216d62a07de5dd3baab9a0",
|
|
605
|
+
"version": "17.0.0"
|
|
576
606
|
};
|
|
577
607
|
|
|
578
608
|
/**
|
|
@@ -587,32 +617,6 @@
|
|
|
587
617
|
ResponseType["TEXT"] = "text";
|
|
588
618
|
ResponseType["JSON"] = "json";
|
|
589
619
|
})(ResponseType || (ResponseType = {}));
|
|
590
|
-
/**
|
|
591
|
-
* @category Error
|
|
592
|
-
* @description This error will be thrown when the endpoint returns an HTTP error to the client
|
|
593
|
-
*/
|
|
594
|
-
class HttpResponseError extends Error {
|
|
595
|
-
constructor(message, status, statusText, body, url) {
|
|
596
|
-
super(message);
|
|
597
|
-
this.message = message;
|
|
598
|
-
this.status = status;
|
|
599
|
-
this.statusText = statusText;
|
|
600
|
-
this.body = body;
|
|
601
|
-
this.url = url;
|
|
602
|
-
this.name = 'HttpResponse';
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
/**
|
|
606
|
-
* @category Error
|
|
607
|
-
* @description Error that indicates a general failure in making the HTTP request
|
|
608
|
-
*/
|
|
609
|
-
class HttpRequestFailed extends Error {
|
|
610
|
-
constructor(message) {
|
|
611
|
-
super(message);
|
|
612
|
-
this.message = message;
|
|
613
|
-
this.name = 'HttpRequestFailed';
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
620
|
class HttpBackend {
|
|
617
621
|
constructor(timeout = 30000) {
|
|
618
622
|
this.timeout = timeout;
|
|
@@ -654,9 +658,11 @@
|
|
|
654
658
|
/**
|
|
655
659
|
*
|
|
656
660
|
* @param options contains options to be passed for the HTTP request (url, method and timeout)
|
|
661
|
+
* @throws {@link HttpRequestFailed} | {@link HttpResponseError}
|
|
657
662
|
*/
|
|
658
663
|
createRequest({ url, method, timeout = this.timeout, query, headers = {}, json = true }, data) {
|
|
659
664
|
return __awaiter(this, void 0, void 0, function* () {
|
|
665
|
+
const urlWithQuery = url + this.serialize(query);
|
|
660
666
|
let resType;
|
|
661
667
|
let transformResponse = undefined;
|
|
662
668
|
if (!headers['Content-Type']) {
|
|
@@ -671,7 +677,7 @@
|
|
|
671
677
|
}
|
|
672
678
|
try {
|
|
673
679
|
const response = yield axios__default["default"].request({
|
|
674
|
-
url:
|
|
680
|
+
url: urlWithQuery,
|
|
675
681
|
method: method !== null && method !== void 0 ? method : 'GET',
|
|
676
682
|
headers: headers,
|
|
677
683
|
responseType: resType,
|
|
@@ -691,10 +697,10 @@
|
|
|
691
697
|
else {
|
|
692
698
|
errorData = err.response.data;
|
|
693
699
|
}
|
|
694
|
-
throw new HttpResponseError(`Http error response: (${err.response.status}) ${errorData}`, err.response.status, err.response.statusText, errorData,
|
|
700
|
+
throw new HttpResponseError(`Http error response: (${err.response.status}) ${errorData}`, err.response.status, err.response.statusText, errorData, urlWithQuery);
|
|
695
701
|
}
|
|
696
702
|
else {
|
|
697
|
-
throw new HttpRequestFailed(
|
|
703
|
+
throw new HttpRequestFailed(String(method), urlWithQuery, err);
|
|
698
704
|
}
|
|
699
705
|
}
|
|
700
706
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taquito-http-utils.umd.js","sources":["../src/fetch-adapter.ts","../src/status_code.ts","../src/version.ts","../src/taquito-http-utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-var-requires */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { AxiosRequestConfig, AxiosResponse } from 'axios';\n\nconst settle = require('axios/lib/core/settle');\nconst buildURL = require('axios/lib/helpers/buildURL');\nconst buildFullPath = require('axios/lib/core/buildFullPath');\nconst { isUndefined, isStandardBrowserEnv, isFormData } = require('axios/lib/utils');\n\n/**\n * - Create a request object\n * - Get response body\n * - Check if timeout\n */\nexport default async function fetchAdapter(config: AxiosRequestConfig): Promise<AxiosResponse> {\n const request = createRequest(config);\n const promiseChain = [getResponse(request, config)];\n\n if (config.timeout && config.timeout > 0) {\n promiseChain.push(\n new Promise((res) => {\n setTimeout(() => {\n const message = config.timeoutErrorMessage\n ? config.timeoutErrorMessage\n : 'timeout of ' + config.timeout + 'ms exceeded';\n res(createError(message, config, 'ECONNABORTED', request));\n }, config.timeout);\n })\n );\n }\n\n const data = await Promise.race(promiseChain);\n return new Promise((resolve, reject) => {\n if (data instanceof Error) {\n reject(data);\n } else {\n const c: any = config;\n 'settle' in c && Object.prototype.toString.call(c.settle) === '[object Function]'\n ? c.settle(resolve, reject, data)\n : settle(resolve, reject, data);\n }\n });\n}\n\n/**\n * Fetch API stage two is to get response body. This function tries to retrieve\n * response body based on response's type\n */\nasync function getResponse(request: RequestInfo | URL, config: AxiosRequestConfig) {\n try {\n const stageOne = await fetch(request as any);\n\n let response: {\n ok: boolean;\n status: number;\n statusText: string;\n headers: Headers;\n config: AxiosRequestConfig;\n request: RequestInfo | URL;\n data?: unknown;\n } = {\n ok: stageOne.ok,\n status: stageOne.status,\n statusText: stageOne.statusText,\n headers: new Headers(stageOne.headers), // Make a copy of headers\n config: config,\n request,\n };\n if (stageOne.status >= 400) {\n return createError('Response Error', config, 'ERR_NETWORK', request, response);\n }\n\n response = {\n ok: stageOne.ok,\n status: stageOne.status,\n statusText: stageOne.statusText,\n headers: new Headers(stageOne.headers), // Make a copy of headers\n config: config,\n request,\n };\n\n if (stageOne.status >= 200 && stageOne.status !== 204) {\n switch (config.responseType) {\n case 'arraybuffer':\n response.data = await stageOne.arrayBuffer();\n break;\n case 'blob':\n response.data = await stageOne.blob();\n break;\n case 'json':\n response.data = await stageOne.json();\n break;\n // TODO: the next option does not exist in response type\n // case 'formData':\n // response.data = await stageOne.formData();\n // break;\n default:\n response.data = await stageOne.text();\n break;\n }\n }\n\n return response;\n } catch (e) {\n return createError('Network Error', config, 'ERR_NETWORK', request);\n }\n}\n\n/**\n * This function will create a Request object based on configuration's axios\n */\nfunction createRequest(config: AxiosRequestConfig) {\n const headers = new Headers(config.headers as any);\n\n // HTTP basic authentication\n if (config.auth) {\n const username = config.auth.username || '';\n const password = config.auth.password\n ? decodeURI(encodeURIComponent(config.auth.password))\n : '';\n headers.set('Authorization', `Basic ${btoa(username + ':' + password)}`);\n }\n\n const method = config.method?.toUpperCase();\n const options: RequestInit = {\n headers: headers,\n method,\n };\n if (method !== 'GET' && method !== 'HEAD') {\n options.body = config.data;\n\n // In these cases the browser will automatically set the correct Content-Type,\n // but only if that header hasn't been set yet. So that's why we're deleting it.\n if (isFormData(options.body) && isStandardBrowserEnv()) {\n headers.delete('Content-Type');\n }\n }\n const c = config as any;\n if ('mode' in c) {\n options.mode = c.mode as RequestMode;\n }\n if ('cache' in c) {\n options.cache = c.cache as RequestCache;\n }\n if ('integrity' in c) {\n options.integrity = c.integrity as string;\n }\n if ('redirect' in c) {\n options.redirect = c.redirect as RequestRedirect;\n }\n if ('referrer' in c) {\n options.referrer = c.referrer as string;\n }\n // This config is similar to XHR’s withCredentials flag, but with three available values instead of two.\n // So if withCredentials is not set, default value 'same-origin' will be used\n if (!isUndefined(c.withCredentials)) {\n options.credentials = c.withCredentials ? 'include' : 'omit';\n }\n\n const fullPath = buildFullPath(c.baseURL, c.url);\n const url = buildURL(fullPath, c.params, c.paramsSerializer);\n\n // Expected browser to throw error if there is any wrong configuration value\n return new Request(url, options);\n}\n\n/**\n * Note:\n *\n * From version >= 0.27.0, createError function is replaced by AxiosError class.\n * So I copy the old createError function here for backward compatible.\n *\n *\n *\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nfunction createError(\n message: string,\n config: AxiosRequestConfig,\n code?: string,\n request?: RequestInfo | URL,\n response?: object\n) {\n // TODO: this code never runs\n // if ('AxiosError' in axios && axios.AxiosError && typeof axios.AxiosError === 'function' && isConstructor(axios.AxiosError)) {\n // return new axios.AxiosError(message, axios.AxiosError[code], config, request, response);\n // }\n\n const error = new Error(message);\n return enhanceError(error, config, code, request, response);\n}\n\n/**\n *\n * Note:\n *\n * This function is for backward compatible.\n *\n *\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nfunction enhanceError(\n error: any,\n config: AxiosRequestConfig,\n code?: string,\n request?: RequestInfo | URL,\n response?: object\n) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n\n error.request = request;\n error.response = response;\n error.isAxiosError = true;\n\n error.toJSON = function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: 'description' in this ? this.description : undefined,\n number: 'number' in this ? this.number : undefined,\n // Mozilla\n fileName: 'fileName' in this ? this.fileName : undefined,\n lineNumber: 'lineNumber' in this ? this.lineNumber : undefined,\n columnNumber: 'columnNumber' in this ? this.columnNumber : undefined,\n stack: this.stack,\n // Axios\n config: this.config,\n code: this.code,\n status: this.response && this.response.status ? this.response.status : null,\n };\n };\n return error;\n}\n","/**\n * Hypertext Transfer Protocol (HTTP) response status codes.\n * @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}\n */\nexport enum STATUS_CODE {\n /**\n * The server has received the request headers and the client should proceed to send the request body\n * (in the case of a request for which a body needs to be sent; for example, a POST request).\n * Sending a large request body to a server after a request has been rejected for inappropriate headers would be inefficient.\n * To have a server check the request's headers, a client must send Expect: 100-continue as a header in its initial request\n * and receive a 100 Continue status code in response before sending the body. The response 417 Expectation Failed indicates the request should not be continued.\n */\n CONTINUE = 100,\n\n /**\n * The requester has asked the server to switch protocols and the server has agreed to do so.\n */\n SWITCHING_PROTOCOLS = 101,\n\n /**\n * A WebDAV request may contain many sub-requests involving file operations, requiring a long time to complete the request.\n * This code indicates that the server has received and is processing the request, but no response is available yet.\n * This prevents the client from timing out and assuming the request was lost.\n */\n PROCESSING = 102,\n\n /**\n * Standard response for successful HTTP requests.\n * The actual response will depend on the request method used.\n * In a GET request, the response will contain an entity corresponding to the requested resource.\n * In a POST request, the response will contain an entity describing or containing the result of the action.\n */\n OK = 200,\n\n /**\n * The request has been fulfilled, resulting in the creation of a new resource.\n */\n CREATED = 201,\n\n /**\n * The request has been accepted for processing, but the processing has not been completed.\n * The request might or might not be eventually acted upon, and may be disallowed when processing occurs.\n */\n ACCEPTED = 202,\n\n /**\n * SINCE HTTP/1.1\n * The server is a transforming proxy that received a 200 OK from its origin,\n * but is returning a modified version of the origin's response.\n */\n NON_AUTHORITATIVE_INFORMATION = 203,\n\n /**\n * The server successfully processed the request and is not returning any content.\n */\n NO_CONTENT = 204,\n\n /**\n * The server successfully processed the request, but is not returning any content.\n * Unlike a 204 response, this response requires that the requester reset the document view.\n */\n RESET_CONTENT = 205,\n\n /**\n * The server is delivering only part of the resource (byte serving) due to a range header sent by the client.\n * The range header is used by HTTP clients to enable resuming of interrupted downloads,\n * or split a download into multiple simultaneous streams.\n */\n PARTIAL_CONTENT = 206,\n\n /**\n * The message body that follows is an XML message and can contain a number of separate response codes,\n * depending on how many sub-requests were made.\n */\n MULTI_STATUS = 207,\n\n /**\n * The members of a DAV binding have already been enumerated in a preceding part of the (multistatus) response,\n * and are not being included again.\n */\n ALREADY_REPORTED = 208,\n\n /**\n * The server has fulfilled a request for the resource,\n * and the response is a representation of the result of one or more instance-manipulations applied to the current instance.\n */\n IM_USED = 226,\n\n /**\n * Indicates multiple options for the resource from which the client may choose (via agent-driven content negotiation).\n * For example, this code could be used to present multiple video format options,\n * to list files with different filename extensions, or to suggest word-sense disambiguation.\n */\n MULTIPLE_CHOICES = 300,\n\n /**\n * This and all future requests should be directed to the given URI.\n */\n MOVED_PERMANENTLY = 301,\n\n /**\n * This is an example of industry practice contradicting the standard.\n * The HTTP/1.0 specification (RFC 1945) required the client to perform a temporary redirect\n * (the original describing phrase was \"Moved Temporarily\"), but popular browsers implemented 302\n * with the functionality of a 303 See Other. Therefore, HTTP/1.1 added status codes 303 and 307\n * to distinguish between the two behaviours. However, some Web applications and frameworks\n * use the 302 status code as if it were the 303.\n */\n FOUND = 302,\n\n /**\n * SINCE HTTP/1.1\n * The response to the request can be found under another URI using a GET method.\n * When received in response to a POST (or PUT/DELETE), the client should presume that\n * the server has received the data and should issue a redirect with a separate GET message.\n */\n SEE_OTHER = 303,\n\n /**\n * Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match.\n * In such case, there is no need to retransmit the resource since the client still has a previously-downloaded copy.\n */\n NOT_MODIFIED = 304,\n\n /**\n * SINCE HTTP/1.1\n * The requested resource is available only through a proxy, the address for which is provided in the response.\n * Many HTTP clients (such as Mozilla and Internet Explorer) do not correctly handle responses with this status code, primarily for security reasons.\n */\n USE_PROXY = 305,\n\n /**\n * No longer used. Originally meant \"Subsequent requests should use the specified proxy.\"\n */\n SWITCH_PROXY = 306,\n\n /**\n * SINCE HTTP/1.1\n * In this case, the request should be repeated with another URI; however, future requests should still use the original URI.\n * In contrast to how 302 was historically implemented, the request method is not allowed to be changed when reissuing the original request.\n * For example, a POST request should be repeated using another POST request.\n */\n TEMPORARY_REDIRECT = 307,\n\n /**\n * The request and all future requests should be repeated using another URI.\n * 307 and 308 parallel the behaviors of 302 and 301, but do not allow the HTTP method to change.\n * So, for example, submitting a form to a permanently redirected resource may continue smoothly.\n */\n PERMANENT_REDIRECT = 308,\n\n /**\n * The server cannot or will not process the request due to an apparent client error\n * (e.g., malformed request syntax, too large size, invalid request message framing, or deceptive request routing).\n */\n BAD_REQUEST = 400,\n\n /**\n * Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet\n * been provided. The response must include a WWW-Authenticate header field containing a challenge applicable to the\n * requested resource. See Basic access authentication and Digest access authentication. 401 semantically means\n * \"unauthenticated\",i.e. the user does not have the necessary credentials.\n */\n UNAUTHORIZED = 401,\n\n /**\n * Reserved for future use. The original intention was that this code might be used as part of some form of digital\n * cash or micro payment scheme, but that has not happened, and this code is not usually used.\n * Google Developers API uses this status if a particular developer has exceeded the daily limit on requests.\n */\n PAYMENT_REQUIRED = 402,\n\n /**\n * The request was valid, but the server is refusing action.\n * The user might not have the necessary permissions for a resource.\n */\n FORBIDDEN = 403,\n\n /**\n * The requested resource could not be found but may be available in the future.\n * Subsequent requests by the client are permissible.\n */\n NOT_FOUND = 404,\n\n /**\n * A request method is not supported for the requested resource;\n * for example, a GET request on a form that requires data to be presented via POST, or a PUT request on a read-only resource.\n */\n METHOD_NOT_ALLOWED = 405,\n\n /**\n * The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.\n */\n NOT_ACCEPTABLE = 406,\n\n /**\n * The client must first authenticate itself with the proxy.\n */\n PROXY_AUTHENTICATION_REQUIRED = 407,\n\n /**\n * The server timed out waiting for the request.\n * According to HTTP specifications:\n * \"The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time.\"\n */\n REQUEST_TIMEOUT = 408,\n\n /**\n * Indicates that the request could not be processed because of conflict in the request,\n * such as an edit conflict between multiple simultaneous updates.\n */\n CONFLICT = 409,\n\n /**\n * Indicates that the resource requested is no longer available and will not be available again.\n * This should be used when a resource has been intentionally removed and the resource should be purged.\n * Upon receiving a 410 status code, the client should not request the resource in the future.\n * Clients such as search engines should remove the resource from their indices.\n * Most use cases do not require clients and search engines to purge the resource, and a \"404 Not Found\" may be used instead.\n */\n GONE = 410,\n\n /**\n * The request did not specify the length of its content, which is required by the requested resource.\n */\n LENGTH_REQUIRED = 411,\n\n /**\n * The server does not meet one of the preconditions that the requester put on the request.\n */\n PRECONDITION_FAILED = 412,\n\n /**\n * The request is larger than the server is willing or able to process. Previously called \"Request Entity Too Large\".\n */\n PAYLOAD_TOO_LARGE = 413,\n\n /**\n * The URI provided was too long for the server to process. Often the result of too much data being encoded as a query-string of a GET request,\n * in which case it should be converted to a POST request.\n * Called \"Request-URI Too Long\" previously.\n */\n URI_TOO_LONG = 414,\n\n /**\n * The request entity has a media type which the server or resource does not support.\n * For example, the client uploads an image as image/svg+xml, but the server requires that images use a different format.\n */\n UNSUPPORTED_MEDIA_TYPE = 415,\n\n /**\n * The client has asked for a portion of the file (byte serving), but the server cannot supply that portion.\n * For example, if the client asked for a part of the file that lies beyond the end of the file.\n * Called \"Requested Range Not Satisfiable\" previously.\n */\n RANGE_NOT_SATISFIABLE = 416,\n\n /**\n * The server cannot meet the requirements of the Expect request-header field.\n */\n EXPECTATION_FAILED = 417,\n\n /**\n * This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol,\n * and is not expected to be implemented by actual HTTP servers. The RFC specifies this code should be returned by\n * teapots requested to brew coffee. This HTTP status is used as an Easter egg in some websites, including Google.com.\n */\n I_AM_A_TEAPOT = 418,\n\n /**\n * The request was directed at a server that is not able to produce a response (for example because a connection reuse).\n */\n MISDIRECTED_REQUEST = 421,\n\n /**\n * The request was well-formed but was unable to be followed due to semantic errors.\n */\n UNPROCESSABLE_ENTITY = 422,\n\n /**\n * The resource that is being accessed is locked.\n */\n LOCKED = 423,\n\n /**\n * The request failed due to failure of a previous request (e.g., a PROPPATCH).\n */\n FAILED_DEPENDENCY = 424,\n\n /**\n * The client should switch to a different protocol such as TLS/1.0, given in the Upgrade header field.\n */\n UPGRADE_REQUIRED = 426,\n\n /**\n * The origin server requires the request to be conditional.\n * Intended to prevent \"the 'lost update' problem, where a client\n * GETs a resource's state, modifies it, and PUTs it back to the server,\n * when meanwhile a third party has modified the state on the server, leading to a conflict.\"\n */\n PRECONDITION_REQUIRED = 428,\n\n /**\n * The user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes.\n */\n TOO_MANY_REQUESTS = 429,\n\n /**\n * The server is unwilling to process the request because either an individual header field,\n * or all the header fields collectively, are too large.\n */\n REQUEST_HEADER_FIELDS_TOO_LARGE = 431,\n\n /**\n * A server operator has received a legal demand to deny access to a resource or to a set of resources\n * that includes the requested resource. The code 451 was chosen as a reference to the novel Fahrenheit 451.\n */\n UNAVAILABLE_FOR_LEGAL_REASONS = 451,\n\n /**\n * A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.\n */\n INTERNAL_SERVER_ERROR = 500,\n\n /**\n * The server either does not recognize the request method, or it lacks the ability to fulfill the request.\n * Usually this implies future availability (e.g., a new feature of a web-service API).\n */\n NOT_IMPLEMENTED = 501,\n\n /**\n * The server was acting as a gateway or proxy and received an invalid response from the upstream server.\n */\n BAD_GATEWAY = 502,\n\n /**\n * The server is currently unavailable (because it is overloaded or down for maintenance).\n * Generally, this is a temporary state.\n */\n SERVICE_UNAVAILABLE = 503,\n\n /**\n * The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.\n */\n GATEWAY_TIMEOUT = 504,\n\n /**\n * The server does not support the HTTP protocol version used in the request\n */\n HTTP_VERSION_NOT_SUPPORTED = 505,\n\n /**\n * Transparent content negotiation for the request results in a circular reference.\n */\n VARIANT_ALSO_NEGOTIATES = 506,\n\n /**\n * The server is unable to store the representation needed to complete the request.\n */\n INSUFFICIENT_STORAGE = 507,\n\n /**\n * The server detected an infinite loop while processing the request.\n */\n LOOP_DETECTED = 508,\n\n /**\n * Further extensions to the request are required for the server to fulfill it.\n */\n NOT_EXTENDED = 510,\n\n /**\n * The client needs to authenticate to gain network access.\n * Intended for use by intercepting proxies used to control access to the network (e.g., \"captive portals\" used\n * to require agreement to Terms of Service before granting full Internet access via a Wi-Fi hotspot).\n */\n NETWORK_AUTHENTICATION_REQUIRED = 511,\n}\n","\n// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!\nexport const VERSION = {\n \"commitHash\": \"adc0f8c31492e8eb2f03b06ac36ba053e8ba6224\",\n \"version\": \"16.2.0\"\n};\n","/**\n * @packageDocumentation\n * @module @taquito/http-utils\n */\n\nimport fetchAdapter from './fetch-adapter';\nimport { STATUS_CODE } from './status_code';\nimport axios from 'axios';\n\nconst isNode = typeof process !== 'undefined' && !!process?.versions?.node;\n\nconst adapter = isNode ? undefined : fetchAdapter;\n\nexport * from './status_code';\nexport { VERSION } from './version';\n\nenum ResponseType {\n TEXT = 'text',\n JSON = 'json',\n}\n\ntype ObjectType = Record<string, any>;\n\nexport interface HttpRequestOptions {\n url: string;\n method?: 'GET' | 'POST';\n timeout?: number;\n json?: boolean;\n query?: ObjectType;\n headers?: { [key: string]: string };\n mimeType?: string;\n}\n\n/**\n * @category Error\n * @description This error will be thrown when the endpoint returns an HTTP error to the client\n */\nexport class HttpResponseError extends Error {\n public name = 'HttpResponse';\n\n constructor(\n public message: string,\n public status: STATUS_CODE,\n public statusText: string,\n public body: string,\n public url: string\n ) {\n super(message);\n }\n}\n\n/**\n * @category Error\n * @description Error that indicates a general failure in making the HTTP request\n */\nexport class HttpRequestFailed extends Error {\n public name = 'HttpRequestFailed';\n\n constructor(public message: string) {\n super(message);\n }\n}\n\nexport class HttpBackend {\n constructor(private timeout: number = 30000) {}\n\n protected serialize(obj?: ObjectType) {\n if (!obj) {\n return '';\n }\n\n const str = [];\n for (const p in obj) {\n // eslint-disable-next-line no-prototype-builtins\n if (obj.hasOwnProperty(p) && typeof obj[p] !== 'undefined') {\n const prop = typeof obj[p].toJSON === 'function' ? obj[p].toJSON() : obj[p];\n // query arguments can have no value so we need some way of handling that\n // example https://domain.com/query?all\n if (prop === null) {\n str.push(encodeURIComponent(p));\n continue;\n }\n // another use case is multiple arguments with the same name\n // they are passed as array\n if (Array.isArray(prop)) {\n prop.forEach((item) => {\n str.push(encodeURIComponent(p) + '=' + encodeURIComponent(item));\n });\n continue;\n }\n str.push(encodeURIComponent(p) + '=' + encodeURIComponent(prop));\n }\n }\n const serialized = str.join('&');\n if (serialized) {\n return `?${serialized}`;\n } else {\n return '';\n }\n }\n\n /**\n *\n * @param options contains options to be passed for the HTTP request (url, method and timeout)\n */\n async createRequest<T>(\n { url, method, timeout = this.timeout, query, headers = {}, json = true }: HttpRequestOptions,\n data?: object | string\n ) {\n let resType: ResponseType;\n let transformResponse = undefined;\n\n if (!headers['Content-Type']) {\n headers['Content-Type'] = 'application/json';\n }\n\n if (!json) {\n resType = ResponseType.TEXT;\n transformResponse = [<Type>(v: Type) => v];\n } else {\n resType = ResponseType.JSON;\n }\n\n try {\n const response = await axios.request<T>({\n url: url + this.serialize(query),\n method: method ?? 'GET',\n headers: headers,\n responseType: resType,\n transformResponse,\n timeout: timeout,\n data: data,\n adapter,\n });\n\n return response.data;\n } catch (err: any) {\n if ((axios.isAxiosError(err) && err.response) || (!isNode && err.response)) {\n let errorData;\n\n if (typeof err.response.data === 'object') {\n errorData = JSON.stringify(err.response.data);\n } else {\n errorData = err.response.data;\n }\n\n throw new HttpResponseError(\n `Http error response: (${err.response.status}) ${errorData}`,\n err.response.status as STATUS_CODE,\n err.response.statusText,\n errorData,\n url + this.serialize(query)\n );\n } else {\n throw new HttpRequestFailed(`${method} ${url + this.serialize(query)} ${String(err)}`);\n }\n }\n }\n}\n"],"names":["STATUS_CODE","axios"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA;IAKA,MAAM,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;IACvD,MAAM,aA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AG,CAAC,QAAQ,CAAC,MAAqB,EAClC,GAAG,CAAC,QAAQ,CAAC,UAAU,EACvB,SAAS,EACT,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAC5B,CAAC;IACH,iBAAA;IAAM,qBAAA;wBACL,MAAM,IAAI,iBAAiB,CAAC,CAAA,EAAG,MAAM,CAAI,CAAA,EAAA,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAI,CAAA,EAAA,MAAM,CAAC,GAAG,CAAC,CAAE,CAAA,CAAC,CAAC;IACxF,iBAAA;IACF,aAAA;aACF,CAAA,CAAA;IAAA,KAAA;IACF;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"taquito-http-utils.umd.js","sources":["../src/fetch-adapter.ts","../src/errors.ts","../src/status_code.ts","../src/version.ts","../src/taquito-http-utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-var-requires */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { AxiosRequestConfig, AxiosResponse } from 'axios';\n\nconst settle = require('axios/lib/core/settle');\nconst buildURL = require('axios/lib/helpers/buildURL');\nconst buildFullPath = require('axios/lib/core/buildFullPath');\nconst { isUndefined, isStandardBrowserEnv, isFormData } = require('axios/lib/utils');\n\n/**\n * - Create a request object\n * - Get response body\n * - Check if timeout\n */\nexport default async function fetchAdapter(config: AxiosRequestConfig): Promise<AxiosResponse> {\n const request = createRequest(config);\n const promiseChain = [getResponse(request, config)];\n\n if (config.timeout && config.timeout > 0) {\n promiseChain.push(\n new Promise((res) => {\n setTimeout(() => {\n const message = config.timeoutErrorMessage\n ? config.timeoutErrorMessage\n : 'timeout of ' + config.timeout + 'ms exceeded';\n res(createError(message, config, 'ECONNABORTED', request));\n }, config.timeout);\n })\n );\n }\n\n const data = await Promise.race(promiseChain);\n return new Promise((resolve, reject) => {\n if (data instanceof Error) {\n reject(data);\n } else {\n const c: any = config;\n 'settle' in c && Object.prototype.toString.call(c.settle) === '[object Function]'\n ? c.settle(resolve, reject, data)\n : settle(resolve, reject, data);\n }\n });\n}\n\n/**\n * Fetch API stage two is to get response body. This function tries to retrieve\n * response body based on response's type\n */\nasync function getResponse(request: RequestInfo | URL, config: AxiosRequestConfig) {\n try {\n const stageOne = await fetch(request as any);\n\n let response: {\n ok: boolean;\n status: number;\n statusText: string;\n headers: Headers;\n config: AxiosRequestConfig;\n request: RequestInfo | URL;\n data?: unknown;\n } = {\n ok: stageOne.ok,\n status: stageOne.status,\n statusText: stageOne.statusText,\n headers: new Headers(stageOne.headers), // Make a copy of headers\n config: config,\n request,\n };\n if (stageOne.status >= 400) {\n return createError('Response Error', config, 'ERR_NETWORK', request, response);\n }\n\n response = {\n ok: stageOne.ok,\n status: stageOne.status,\n statusText: stageOne.statusText,\n headers: new Headers(stageOne.headers), // Make a copy of headers\n config: config,\n request,\n };\n\n if (stageOne.status >= 200 && stageOne.status !== 204) {\n switch (config.responseType) {\n case 'arraybuffer':\n response.data = await stageOne.arrayBuffer();\n break;\n case 'blob':\n response.data = await stageOne.blob();\n break;\n case 'json':\n response.data = await stageOne.json();\n break;\n // TODO: the next option does not exist in response type\n // case 'formData':\n // response.data = await stageOne.formData();\n // break;\n default:\n response.data = await stageOne.text();\n break;\n }\n }\n\n return response;\n } catch (e) {\n return createError('Network Error', config, 'ERR_NETWORK', request);\n }\n}\n\n/**\n * This function will create a Request object based on configuration's axios\n */\nfunction createRequest(config: AxiosRequestConfig) {\n const headers = new Headers(config.headers as any);\n\n // HTTP basic authentication\n if (config.auth) {\n const username = config.auth.username || '';\n const password = config.auth.password\n ? decodeURI(encodeURIComponent(config.auth.password))\n : '';\n headers.set('Authorization', `Basic ${btoa(username + ':' + password)}`);\n }\n\n const method = config.method?.toUpperCase();\n const options: RequestInit = {\n headers: headers,\n method,\n };\n if (method !== 'GET' && method !== 'HEAD') {\n options.body = config.data;\n\n // In these cases the browser will automatically set the correct Content-Type,\n // but only if that header hasn't been set yet. So that's why we're deleting it.\n if (isFormData(options.body) && isStandardBrowserEnv()) {\n headers.delete('Content-Type');\n }\n }\n const c = config as any;\n if ('mode' in c) {\n options.mode = c.mode as RequestMode;\n }\n if ('cache' in c) {\n options.cache = c.cache as RequestCache;\n }\n if ('integrity' in c) {\n options.integrity = c.integrity as string;\n }\n if ('redirect' in c) {\n options.redirect = c.redirect as RequestRedirect;\n }\n if ('referrer' in c) {\n options.referrer = c.referrer as string;\n }\n // This config is similar to XHR’s withCredentials flag, but with three available values instead of two.\n // So if withCredentials is not set, default value 'same-origin' will be used\n if (!isUndefined(c.withCredentials)) {\n options.credentials = c.withCredentials ? 'include' : 'omit';\n }\n\n const fullPath = buildFullPath(c.baseURL, c.url);\n const url = buildURL(fullPath, c.params, c.paramsSerializer);\n\n // Expected browser to throw error if there is any wrong configuration value\n return new Request(url, options);\n}\n\n/**\n * Note:\n *\n * From version >= 0.27.0, createError function is replaced by AxiosError class.\n * So I copy the old createError function here for backward compatible.\n *\n *\n *\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nfunction createError(\n message: string,\n config: AxiosRequestConfig,\n code?: string,\n request?: RequestInfo | URL,\n response?: object\n) {\n // TODO: this code never runs\n // if ('AxiosError' in axios && axios.AxiosError && typeof axios.AxiosError === 'function' && isConstructor(axios.AxiosError)) {\n // return new axios.AxiosError(message, axios.AxiosError[code], config, request, response);\n // }\n\n const error = new Error(message);\n return enhanceError(error, config, code, request, response);\n}\n\n/**\n *\n * Note:\n *\n * This function is for backward compatible.\n *\n *\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nfunction enhanceError(\n error: any,\n config: AxiosRequestConfig,\n code?: string,\n request?: RequestInfo | URL,\n response?: object\n) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n\n error.request = request;\n error.response = response;\n error.isAxiosError = true;\n\n error.toJSON = function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: 'description' in this ? this.description : undefined,\n number: 'number' in this ? this.number : undefined,\n // Mozilla\n fileName: 'fileName' in this ? this.fileName : undefined,\n lineNumber: 'lineNumber' in this ? this.lineNumber : undefined,\n columnNumber: 'columnNumber' in this ? this.columnNumber : undefined,\n stack: this.stack,\n // Axios\n config: this.config,\n code: this.code,\n status: this.response && this.response.status ? this.response.status : null,\n };\n };\n return error;\n}\n","import { NetworkError } from '@taquito/core';\nimport { STATUS_CODE } from './status_code';\n\n/**\n * @category Error\n * @description Error indicates a general failure in making the HTTP request\n */\nexport class HttpRequestFailed extends NetworkError {\n constructor(public method: string, public url: string, public cause: Error) {\n super();\n this.name = 'HttpRequestFailed';\n this.message = `${method} ${url} ${String(cause)}`;\n }\n}\n\n/**\n * @category Error\n * @description Error thrown when the endpoint returns an HTTP error to the client\n */\nexport class HttpResponseError extends NetworkError {\n public name = 'HttpResponse';\n\n constructor(\n public message: string,\n public status: STATUS_CODE,\n public statusText: string,\n public body: string,\n public url: string\n ) {\n super(message);\n }\n}\n","/**\n * Hypertext Transfer Protocol (HTTP) response status codes.\n * @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}\n */\nexport enum STATUS_CODE {\n /**\n * The server has received the request headers and the client should proceed to send the request body\n * (in the case of a request for which a body needs to be sent; for example, a POST request).\n * Sending a large request body to a server after a request has been rejected for inappropriate headers would be inefficient.\n * To have a server check the request's headers, a client must send Expect: 100-continue as a header in its initial request\n * and receive a 100 Continue status code in response before sending the body. The response 417 Expectation Failed indicates the request should not be continued.\n */\n CONTINUE = 100,\n\n /**\n * The requester has asked the server to switch protocols and the server has agreed to do so.\n */\n SWITCHING_PROTOCOLS = 101,\n\n /**\n * A WebDAV request may contain many sub-requests involving file operations, requiring a long time to complete the request.\n * This code indicates that the server has received and is processing the request, but no response is available yet.\n * This prevents the client from timing out and assuming the request was lost.\n */\n PROCESSING = 102,\n\n /**\n * Standard response for successful HTTP requests.\n * The actual response will depend on the request method used.\n * In a GET request, the response will contain an entity corresponding to the requested resource.\n * In a POST request, the response will contain an entity describing or containing the result of the action.\n */\n OK = 200,\n\n /**\n * The request has been fulfilled, resulting in the creation of a new resource.\n */\n CREATED = 201,\n\n /**\n * The request has been accepted for processing, but the processing has not been completed.\n * The request might or might not be eventually acted upon, and may be disallowed when processing occurs.\n */\n ACCEPTED = 202,\n\n /**\n * SINCE HTTP/1.1\n * The server is a transforming proxy that received a 200 OK from its origin,\n * but is returning a modified version of the origin's response.\n */\n NON_AUTHORITATIVE_INFORMATION = 203,\n\n /**\n * The server successfully processed the request and is not returning any content.\n */\n NO_CONTENT = 204,\n\n /**\n * The server successfully processed the request, but is not returning any content.\n * Unlike a 204 response, this response requires that the requester reset the document view.\n */\n RESET_CONTENT = 205,\n\n /**\n * The server is delivering only part of the resource (byte serving) due to a range header sent by the client.\n * The range header is used by HTTP clients to enable resuming of interrupted downloads,\n * or split a download into multiple simultaneous streams.\n */\n PARTIAL_CONTENT = 206,\n\n /**\n * The message body that follows is an XML message and can contain a number of separate response codes,\n * depending on how many sub-requests were made.\n */\n MULTI_STATUS = 207,\n\n /**\n * The members of a DAV binding have already been enumerated in a preceding part of the (multistatus) response,\n * and are not being included again.\n */\n ALREADY_REPORTED = 208,\n\n /**\n * The server has fulfilled a request for the resource,\n * and the response is a representation of the result of one or more instance-manipulations applied to the current instance.\n */\n IM_USED = 226,\n\n /**\n * Indicates multiple options for the resource from which the client may choose (via agent-driven content negotiation).\n * For example, this code could be used to present multiple video format options,\n * to list files with different filename extensions, or to suggest word-sense disambiguation.\n */\n MULTIPLE_CHOICES = 300,\n\n /**\n * This and all future requests should be directed to the given URI.\n */\n MOVED_PERMANENTLY = 301,\n\n /**\n * This is an example of industry practice contradicting the standard.\n * The HTTP/1.0 specification (RFC 1945) required the client to perform a temporary redirect\n * (the original describing phrase was \"Moved Temporarily\"), but popular browsers implemented 302\n * with the functionality of a 303 See Other. Therefore, HTTP/1.1 added status codes 303 and 307\n * to distinguish between the two behaviours. However, some Web applications and frameworks\n * use the 302 status code as if it were the 303.\n */\n FOUND = 302,\n\n /**\n * SINCE HTTP/1.1\n * The response to the request can be found under another URI using a GET method.\n * When received in response to a POST (or PUT/DELETE), the client should presume that\n * the server has received the data and should issue a redirect with a separate GET message.\n */\n SEE_OTHER = 303,\n\n /**\n * Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match.\n * In such case, there is no need to retransmit the resource since the client still has a previously-downloaded copy.\n */\n NOT_MODIFIED = 304,\n\n /**\n * SINCE HTTP/1.1\n * The requested resource is available only through a proxy, the address for which is provided in the response.\n * Many HTTP clients (such as Mozilla and Internet Explorer) do not correctly handle responses with this status code, primarily for security reasons.\n */\n USE_PROXY = 305,\n\n /**\n * No longer used. Originally meant \"Subsequent requests should use the specified proxy.\"\n */\n SWITCH_PROXY = 306,\n\n /**\n * SINCE HTTP/1.1\n * In this case, the request should be repeated with another URI; however, future requests should still use the original URI.\n * In contrast to how 302 was historically implemented, the request method is not allowed to be changed when reissuing the original request.\n * For example, a POST request should be repeated using another POST request.\n */\n TEMPORARY_REDIRECT = 307,\n\n /**\n * The request and all future requests should be repeated using another URI.\n * 307 and 308 parallel the behaviors of 302 and 301, but do not allow the HTTP method to change.\n * So, for example, submitting a form to a permanently redirected resource may continue smoothly.\n */\n PERMANENT_REDIRECT = 308,\n\n /**\n * The server cannot or will not process the request due to an apparent client error\n * (e.g., malformed request syntax, too large size, invalid request message framing, or deceptive request routing).\n */\n BAD_REQUEST = 400,\n\n /**\n * Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet\n * been provided. The response must include a WWW-Authenticate header field containing a challenge applicable to the\n * requested resource. See Basic access authentication and Digest access authentication. 401 semantically means\n * \"unauthenticated\",i.e. the user does not have the necessary credentials.\n */\n UNAUTHORIZED = 401,\n\n /**\n * Reserved for future use. The original intention was that this code might be used as part of some form of digital\n * cash or micro payment scheme, but that has not happened, and this code is not usually used.\n * Google Developers API uses this status if a particular developer has exceeded the daily limit on requests.\n */\n PAYMENT_REQUIRED = 402,\n\n /**\n * The request was valid, but the server is refusing action.\n * The user might not have the necessary permissions for a resource.\n */\n FORBIDDEN = 403,\n\n /**\n * The requested resource could not be found but may be available in the future.\n * Subsequent requests by the client are permissible.\n */\n NOT_FOUND = 404,\n\n /**\n * A request method is not supported for the requested resource;\n * for example, a GET request on a form that requires data to be presented via POST, or a PUT request on a read-only resource.\n */\n METHOD_NOT_ALLOWED = 405,\n\n /**\n * The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.\n */\n NOT_ACCEPTABLE = 406,\n\n /**\n * The client must first authenticate itself with the proxy.\n */\n PROXY_AUTHENTICATION_REQUIRED = 407,\n\n /**\n * The server timed out waiting for the request.\n * According to HTTP specifications:\n * \"The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time.\"\n */\n REQUEST_TIMEOUT = 408,\n\n /**\n * Indicates that the request could not be processed because of conflict in the request,\n * such as an edit conflict between multiple simultaneous updates.\n */\n CONFLICT = 409,\n\n /**\n * Indicates that the resource requested is no longer available and will not be available again.\n * This should be used when a resource has been intentionally removed and the resource should be purged.\n * Upon receiving a 410 status code, the client should not request the resource in the future.\n * Clients such as search engines should remove the resource from their indices.\n * Most use cases do not require clients and search engines to purge the resource, and a \"404 Not Found\" may be used instead.\n */\n GONE = 410,\n\n /**\n * The request did not specify the length of its content, which is required by the requested resource.\n */\n LENGTH_REQUIRED = 411,\n\n /**\n * The server does not meet one of the preconditions that the requester put on the request.\n */\n PRECONDITION_FAILED = 412,\n\n /**\n * The request is larger than the server is willing or able to process. Previously called \"Request Entity Too Large\".\n */\n PAYLOAD_TOO_LARGE = 413,\n\n /**\n * The URI provided was too long for the server to process. Often the result of too much data being encoded as a query-string of a GET request,\n * in which case it should be converted to a POST request.\n * Called \"Request-URI Too Long\" previously.\n */\n URI_TOO_LONG = 414,\n\n /**\n * The request entity has a media type which the server or resource does not support.\n * For example, the client uploads an image as image/svg+xml, but the server requires that images use a different format.\n */\n UNSUPPORTED_MEDIA_TYPE = 415,\n\n /**\n * The client has asked for a portion of the file (byte serving), but the server cannot supply that portion.\n * For example, if the client asked for a part of the file that lies beyond the end of the file.\n * Called \"Requested Range Not Satisfiable\" previously.\n */\n RANGE_NOT_SATISFIABLE = 416,\n\n /**\n * The server cannot meet the requirements of the Expect request-header field.\n */\n EXPECTATION_FAILED = 417,\n\n /**\n * This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol,\n * and is not expected to be implemented by actual HTTP servers. The RFC specifies this code should be returned by\n * teapots requested to brew coffee. This HTTP status is used as an Easter egg in some websites, including Google.com.\n */\n I_AM_A_TEAPOT = 418,\n\n /**\n * The request was directed at a server that is not able to produce a response (for example because a connection reuse).\n */\n MISDIRECTED_REQUEST = 421,\n\n /**\n * The request was well-formed but was unable to be followed due to semantic errors.\n */\n UNPROCESSABLE_ENTITY = 422,\n\n /**\n * The resource that is being accessed is locked.\n */\n LOCKED = 423,\n\n /**\n * The request failed due to failure of a previous request (e.g., a PROPPATCH).\n */\n FAILED_DEPENDENCY = 424,\n\n /**\n * The client should switch to a different protocol such as TLS/1.0, given in the Upgrade header field.\n */\n UPGRADE_REQUIRED = 426,\n\n /**\n * The origin server requires the request to be conditional.\n * Intended to prevent \"the 'lost update' problem, where a client\n * GETs a resource's state, modifies it, and PUTs it back to the server,\n * when meanwhile a third party has modified the state on the server, leading to a conflict.\"\n */\n PRECONDITION_REQUIRED = 428,\n\n /**\n * The user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes.\n */\n TOO_MANY_REQUESTS = 429,\n\n /**\n * The server is unwilling to process the request because either an individual header field,\n * or all the header fields collectively, are too large.\n */\n REQUEST_HEADER_FIELDS_TOO_LARGE = 431,\n\n /**\n * A server operator has received a legal demand to deny access to a resource or to a set of resources\n * that includes the requested resource. The code 451 was chosen as a reference to the novel Fahrenheit 451.\n */\n UNAVAILABLE_FOR_LEGAL_REASONS = 451,\n\n /**\n * A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.\n */\n INTERNAL_SERVER_ERROR = 500,\n\n /**\n * The server either does not recognize the request method, or it lacks the ability to fulfill the request.\n * Usually this implies future availability (e.g., a new feature of a web-service API).\n */\n NOT_IMPLEMENTED = 501,\n\n /**\n * The server was acting as a gateway or proxy and received an invalid response from the upstream server.\n */\n BAD_GATEWAY = 502,\n\n /**\n * The server is currently unavailable (because it is overloaded or down for maintenance).\n * Generally, this is a temporary state.\n */\n SERVICE_UNAVAILABLE = 503,\n\n /**\n * The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.\n */\n GATEWAY_TIMEOUT = 504,\n\n /**\n * The server does not support the HTTP protocol version used in the request\n */\n HTTP_VERSION_NOT_SUPPORTED = 505,\n\n /**\n * Transparent content negotiation for the request results in a circular reference.\n */\n VARIANT_ALSO_NEGOTIATES = 506,\n\n /**\n * The server is unable to store the representation needed to complete the request.\n */\n INSUFFICIENT_STORAGE = 507,\n\n /**\n * The server detected an infinite loop while processing the request.\n */\n LOOP_DETECTED = 508,\n\n /**\n * Further extensions to the request are required for the server to fulfill it.\n */\n NOT_EXTENDED = 510,\n\n /**\n * The client needs to authenticate to gain network access.\n * Intended for use by intercepting proxies used to control access to the network (e.g., \"captive portals\" used\n * to require agreement to Terms of Service before granting full Internet access via a Wi-Fi hotspot).\n */\n NETWORK_AUTHENTICATION_REQUIRED = 511,\n}\n","\n// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!\nexport const VERSION = {\n \"commitHash\": \"b357541c90c2168d48216d62a07de5dd3baab9a0\",\n \"version\": \"17.0.0\"\n};\n","/**\n * @packageDocumentation\n * @module @taquito/http-utils\n */\n\nimport fetchAdapter from './fetch-adapter';\nimport { STATUS_CODE } from './status_code';\nimport axios from 'axios';\nimport { HttpRequestFailed, HttpResponseError } from './errors';\n\nconst isNode = typeof process !== 'undefined' && !!process?.versions?.node;\n\nconst adapter = isNode ? undefined : fetchAdapter;\n\nexport * from './status_code';\nexport { VERSION } from './version';\nexport { HttpRequestFailed, HttpResponseError } from './errors';\n\nenum ResponseType {\n TEXT = 'text',\n JSON = 'json',\n}\n\ntype ObjectType = Record<string, any>;\n\nexport interface HttpRequestOptions {\n url: string;\n method?: 'GET' | 'POST';\n timeout?: number;\n json?: boolean;\n query?: ObjectType;\n headers?: { [key: string]: string };\n mimeType?: string;\n}\n\nexport class HttpBackend {\n constructor(private timeout: number = 30000) {}\n\n protected serialize(obj?: ObjectType) {\n if (!obj) {\n return '';\n }\n\n const str = [];\n for (const p in obj) {\n // eslint-disable-next-line no-prototype-builtins\n if (obj.hasOwnProperty(p) && typeof obj[p] !== 'undefined') {\n const prop = typeof obj[p].toJSON === 'function' ? obj[p].toJSON() : obj[p];\n // query arguments can have no value so we need some way of handling that\n // example https://domain.com/query?all\n if (prop === null) {\n str.push(encodeURIComponent(p));\n continue;\n }\n // another use case is multiple arguments with the same name\n // they are passed as array\n if (Array.isArray(prop)) {\n prop.forEach((item) => {\n str.push(encodeURIComponent(p) + '=' + encodeURIComponent(item));\n });\n continue;\n }\n str.push(encodeURIComponent(p) + '=' + encodeURIComponent(prop));\n }\n }\n const serialized = str.join('&');\n if (serialized) {\n return `?${serialized}`;\n } else {\n return '';\n }\n }\n\n /**\n *\n * @param options contains options to be passed for the HTTP request (url, method and timeout)\n * @throws {@link HttpRequestFailed} | {@link HttpResponseError}\n */\n async createRequest<T>(\n { url, method, timeout = this.timeout, query, headers = {}, json = true }: HttpRequestOptions,\n data?: object | string\n ) {\n const urlWithQuery = url + this.serialize(query);\n let resType: ResponseType;\n let transformResponse = undefined;\n\n if (!headers['Content-Type']) {\n headers['Content-Type'] = 'application/json';\n }\n\n if (!json) {\n resType = ResponseType.TEXT;\n transformResponse = [<Type>(v: Type) => v];\n } else {\n resType = ResponseType.JSON;\n }\n\n try {\n const response = await axios.request<T>({\n url: urlWithQuery,\n method: method ?? 'GET',\n headers: headers,\n responseType: resType,\n transformResponse,\n timeout: timeout,\n data: data,\n adapter,\n });\n\n return response.data;\n } catch (err: any) {\n if ((axios.isAxiosError(err) && err.response) || (!isNode && err.response)) {\n let errorData;\n\n if (typeof err.response.data === 'object') {\n errorData = JSON.stringify(err.response.data);\n } else {\n errorData = err.response.data;\n }\n\n throw new HttpResponseError(\n `Http error response: (${err.response.status}) ${errorData}`,\n err.response.status as STATUS_CODE,\n err.response.statusText,\n errorData,\n urlWithQuery\n );\n } else {\n throw new HttpRequestFailed(String(method), urlWithQuery, err);\n }\n }\n }\n}\n"],"names":["NetworkError","STATUS_CODE","axios"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA;IAKA,MAAM,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;IACvD,MAAM,aAAa,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;IAC9D,MAAM,EAAE,WAAW,EAAE,oBAAoB,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAErF;;;;IAIG;IAC2B,SAAA,YAAY,CAAC,MAA0B,EAAA;;IACnE,QAAA,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;YACtC,MAAM,YAAY,GAAG,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;YAEpD,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,GAAG,CAAC,EAAE;gBACxC,YAAY,CAAC,IAAI,CACf,IAAI,OAAO,CAAC,CAAC,GAAG,KAAI;oBAClB,UAAU,CAAC,MAAK;IACd,oBAAA,MAAM,OAAO,G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F,aAAA;aACF,CAAA,CAAA;IAAA,KAAA;IACF;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { NetworkError } from '@taquito/core';
|
|
2
|
+
import { STATUS_CODE } from './status_code';
|
|
3
|
+
/**
|
|
4
|
+
* @category Error
|
|
5
|
+
* @description Error indicates a general failure in making the HTTP request
|
|
6
|
+
*/
|
|
7
|
+
export declare class HttpRequestFailed extends NetworkError {
|
|
8
|
+
method: string;
|
|
9
|
+
url: string;
|
|
10
|
+
cause: Error;
|
|
11
|
+
constructor(method: string, url: string, cause: Error);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @category Error
|
|
15
|
+
* @description Error thrown when the endpoint returns an HTTP error to the client
|
|
16
|
+
*/
|
|
17
|
+
export declare class HttpResponseError extends NetworkError {
|
|
18
|
+
message: string;
|
|
19
|
+
status: STATUS_CODE;
|
|
20
|
+
statusText: string;
|
|
21
|
+
body: string;
|
|
22
|
+
url: string;
|
|
23
|
+
name: string;
|
|
24
|
+
constructor(message: string, status: STATUS_CODE, statusText: string, body: string, url: string);
|
|
25
|
+
}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
* @module @taquito/http-utils
|
|
4
4
|
*/
|
|
5
|
-
import { STATUS_CODE } from './status_code';
|
|
6
5
|
export * from './status_code';
|
|
7
6
|
export { VERSION } from './version';
|
|
7
|
+
export { HttpRequestFailed, HttpResponseError } from './errors';
|
|
8
8
|
declare type ObjectType = Record<string, any>;
|
|
9
9
|
export interface HttpRequestOptions {
|
|
10
10
|
url: string;
|
|
@@ -17,28 +17,6 @@ export interface HttpRequestOptions {
|
|
|
17
17
|
};
|
|
18
18
|
mimeType?: string;
|
|
19
19
|
}
|
|
20
|
-
/**
|
|
21
|
-
* @category Error
|
|
22
|
-
* @description This error will be thrown when the endpoint returns an HTTP error to the client
|
|
23
|
-
*/
|
|
24
|
-
export declare class HttpResponseError extends Error {
|
|
25
|
-
message: string;
|
|
26
|
-
status: STATUS_CODE;
|
|
27
|
-
statusText: string;
|
|
28
|
-
body: string;
|
|
29
|
-
url: string;
|
|
30
|
-
name: string;
|
|
31
|
-
constructor(message: string, status: STATUS_CODE, statusText: string, body: string, url: string);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* @category Error
|
|
35
|
-
* @description Error that indicates a general failure in making the HTTP request
|
|
36
|
-
*/
|
|
37
|
-
export declare class HttpRequestFailed extends Error {
|
|
38
|
-
message: string;
|
|
39
|
-
name: string;
|
|
40
|
-
constructor(message: string);
|
|
41
|
-
}
|
|
42
20
|
export declare class HttpBackend {
|
|
43
21
|
private timeout;
|
|
44
22
|
constructor(timeout?: number);
|
|
@@ -46,6 +24,7 @@ export declare class HttpBackend {
|
|
|
46
24
|
/**
|
|
47
25
|
*
|
|
48
26
|
* @param options contains options to be passed for the HTTP request (url, method and timeout)
|
|
27
|
+
* @throws {@link HttpRequestFailed} | {@link HttpResponseError}
|
|
49
28
|
*/
|
|
50
29
|
createRequest<T>({ url, method, timeout, query, headers, json }: HttpRequestOptions, data?: object | string): Promise<T>;
|
|
51
30
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taquito/http-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tezos"
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
]
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
+
"@taquito/core": "^17.0.0",
|
|
62
63
|
"axios": "^0.26.0"
|
|
63
64
|
},
|
|
64
65
|
"devDependencies": {
|
|
@@ -90,5 +91,5 @@
|
|
|
90
91
|
"ts-toolbelt": "^9.6.0",
|
|
91
92
|
"typescript": "~4.1.5"
|
|
92
93
|
},
|
|
93
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "388db853edd4d45c1e6e0121a96fa9b71fa699c0"
|
|
94
95
|
}
|