@impui/imp 1.0.15 → 1.0.16-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/axios/index.es.js +143 -0
  2. package/dist/config/index.es.js +127 -0
  3. package/dist/core/index.es.js +34 -0
  4. package/dist/gotool/go2/index.es.js +510 -0
  5. package/dist/gotool/index/index.es.js +164 -0
  6. package/dist/imph5/index.es.js +324 -0
  7. package/dist/index.es.js +49 -1
  8. package/dist/login/index.es.js +711 -0
  9. package/dist/node_modules/axios/index/index.es.js +38 -0
  10. package/dist/node_modules/axios/lib/adapters/adapters/index.es.js +71 -0
  11. package/dist/node_modules/axios/lib/adapters/fetch/index.es.js +219 -0
  12. package/dist/node_modules/axios/lib/adapters/xhr/index.es.js +141 -0
  13. package/dist/node_modules/axios/lib/axios/index.es.js +50 -0
  14. package/dist/node_modules/axios/lib/cancel/CancelToken/index.es.js +99 -0
  15. package/dist/node_modules/axios/lib/cancel/CanceledError/index.es.js +12 -0
  16. package/dist/node_modules/axios/lib/cancel/isCancel/index.es.js +6 -0
  17. package/dist/node_modules/axios/lib/core/Axios/index.es.js +180 -0
  18. package/dist/node_modules/axios/lib/core/AxiosError/index.es.js +80 -0
  19. package/dist/node_modules/axios/lib/core/AxiosHeaders/index.es.js +231 -0
  20. package/dist/node_modules/axios/lib/core/InterceptorManager/index.es.js +65 -0
  21. package/dist/node_modules/axios/lib/core/buildFullPath/index.es.js +12 -0
  22. package/dist/node_modules/axios/lib/core/dispatchRequest/index.es.js +52 -0
  23. package/dist/node_modules/axios/lib/core/mergeConfig/index.es.js +83 -0
  24. package/dist/node_modules/axios/lib/core/settle/index.es.js +18 -0
  25. package/dist/node_modules/axios/lib/core/transformData/index.es.js +17 -0
  26. package/dist/node_modules/axios/lib/defaults/index/index.es.js +116 -0
  27. package/dist/node_modules/axios/lib/defaults/transitional/index.es.js +8 -0
  28. package/dist/node_modules/axios/lib/env/data/index.es.js +4 -0
  29. package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams/index.es.js +34 -0
  30. package/dist/node_modules/axios/lib/helpers/HttpStatusCode/index.es.js +77 -0
  31. package/dist/node_modules/axios/lib/helpers/bind/index.es.js +8 -0
  32. package/dist/node_modules/axios/lib/helpers/buildURL/index.es.js +34 -0
  33. package/dist/node_modules/axios/lib/helpers/combineURLs/index.es.js +6 -0
  34. package/dist/node_modules/axios/lib/helpers/composeSignals/index.es.js +39 -0
  35. package/dist/node_modules/axios/lib/helpers/cookies/index.es.js +49 -0
  36. package/dist/node_modules/axios/lib/helpers/formDataToJSON/index.es.js +54 -0
  37. package/dist/node_modules/axios/lib/helpers/isAbsoluteURL/index.es.js +6 -0
  38. package/dist/node_modules/axios/lib/helpers/isAxiosError/index.es.js +7 -0
  39. package/dist/node_modules/axios/lib/helpers/isURLSameOrigin/index.es.js +11 -0
  40. package/dist/node_modules/axios/lib/helpers/null/index.es.js +4 -0
  41. package/dist/node_modules/axios/lib/helpers/parseHeaders/index.es.js +47 -0
  42. package/dist/node_modules/axios/lib/helpers/parseProtocol/index.es.js +7 -0
  43. package/dist/node_modules/axios/lib/helpers/progressEventReducer/index.es.js +41 -0
  44. package/dist/node_modules/axios/lib/helpers/resolveConfig/index.es.js +46 -0
  45. package/dist/node_modules/axios/lib/helpers/speedometer/index.es.js +36 -0
  46. package/dist/node_modules/axios/lib/helpers/spread/index.es.js +8 -0
  47. package/dist/node_modules/axios/lib/helpers/throttle/index.es.js +35 -0
  48. package/dist/node_modules/axios/lib/helpers/toFormData/index.es.js +117 -0
  49. package/dist/node_modules/axios/lib/helpers/toURLEncodedForm/index.es.js +18 -0
  50. package/dist/node_modules/axios/lib/helpers/trackStream/index.es.js +80 -0
  51. package/dist/node_modules/axios/lib/helpers/validator/index.es.js +67 -0
  52. package/dist/node_modules/axios/lib/platform/browser/classes/Blob/index.es.js +4 -0
  53. package/dist/node_modules/axios/lib/platform/browser/classes/FormData/index.es.js +4 -0
  54. package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams/index.es.js +5 -0
  55. package/dist/node_modules/axios/lib/platform/browser/index/index.es.js +15 -0
  56. package/dist/node_modules/axios/lib/platform/common/utils/index.es.js +15 -0
  57. package/dist/node_modules/axios/lib/platform/index/index.es.js +9 -0
  58. package/dist/node_modules/axios/lib/utils/index.es.js +387 -0
  59. package/dist/packages/com/dist/browser/index.es/index.es.js +1 -0
  60. package/dist/packages/com/dist/cache/index.es/index.es.js +145 -0
  61. package/dist/packages/com/dist/core/index.es/index.es.js +154 -0
  62. package/dist/packages/com/dist/data/index.es/index.es.js +26 -0
  63. package/dist/packages/com/dist/date/index.es/index.es.js +194 -0
  64. package/dist/packages/com/dist/log/index.es/index.es.js +110 -0
  65. package/dist/packages/com/dist/message/index.es/index.es.js +90 -0
  66. package/dist/packages/com/dist/req/index.es/index.es.js +35 -0
  67. package/dist/packages/com/dist/str/index.es/index.es.js +25 -0
  68. package/dist/packages/com/dist/typetool/index.es/index.es.js +53 -0
  69. package/dist/packages/com/dist/url/index.es/index.es.js +238 -0
  70. package/dist/restool/index/index.es.js +266 -0
  71. package/dist/restool/index.css/index.es.js +4 -0
  72. package/package.json +2 -3
@@ -0,0 +1,180 @@
1
+ import utils from "../../utils/index.es.js";
2
+ import buildURL from "../../helpers/buildURL/index.es.js";
3
+ import InterceptorManager from "../InterceptorManager/index.es.js";
4
+ import dispatchRequest from "../dispatchRequest/index.es.js";
5
+ import mergeConfig from "../mergeConfig/index.es.js";
6
+ import buildFullPath from "../buildFullPath/index.es.js";
7
+ import validator from "../../helpers/validator/index.es.js";
8
+ import AxiosHeaders from "../AxiosHeaders/index.es.js";
9
+ const validators = validator.validators;
10
+ class Axios {
11
+ constructor(instanceConfig) {
12
+ this.defaults = instanceConfig || {};
13
+ this.interceptors = {
14
+ request: new InterceptorManager(),
15
+ response: new InterceptorManager()
16
+ };
17
+ }
18
+ /**
19
+ * Dispatch a request
20
+ *
21
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
22
+ * @param {?Object} config
23
+ *
24
+ * @returns {Promise} The Promise to be fulfilled
25
+ */
26
+ async request(configOrUrl, config) {
27
+ try {
28
+ return await this._request(configOrUrl, config);
29
+ } catch (err) {
30
+ if (err instanceof Error) {
31
+ let dummy = {};
32
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
33
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
34
+ try {
35
+ if (!err.stack) {
36
+ err.stack = stack;
37
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
38
+ err.stack += "\n" + stack;
39
+ }
40
+ } catch (e) {
41
+ }
42
+ }
43
+ throw err;
44
+ }
45
+ }
46
+ _request(configOrUrl, config) {
47
+ if (typeof configOrUrl === "string") {
48
+ config = config || {};
49
+ config.url = configOrUrl;
50
+ } else {
51
+ config = configOrUrl || {};
52
+ }
53
+ config = mergeConfig(this.defaults, config);
54
+ const { transitional, paramsSerializer, headers } = config;
55
+ if (transitional !== void 0) {
56
+ validator.assertOptions(transitional, {
57
+ silentJSONParsing: validators.transitional(validators.boolean),
58
+ forcedJSONParsing: validators.transitional(validators.boolean),
59
+ clarifyTimeoutError: validators.transitional(validators.boolean)
60
+ }, false);
61
+ }
62
+ if (paramsSerializer != null) {
63
+ if (utils.isFunction(paramsSerializer)) {
64
+ config.paramsSerializer = {
65
+ serialize: paramsSerializer
66
+ };
67
+ } else {
68
+ validator.assertOptions(paramsSerializer, {
69
+ encode: validators.function,
70
+ serialize: validators.function
71
+ }, true);
72
+ }
73
+ }
74
+ if (config.allowAbsoluteUrls !== void 0) ;
75
+ else if (this.defaults.allowAbsoluteUrls !== void 0) {
76
+ config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
77
+ } else {
78
+ config.allowAbsoluteUrls = true;
79
+ }
80
+ validator.assertOptions(config, {
81
+ baseUrl: validators.spelling("baseURL"),
82
+ withXsrfToken: validators.spelling("withXSRFToken")
83
+ }, true);
84
+ config.method = (config.method || this.defaults.method || "get").toLowerCase();
85
+ let contextHeaders = headers && utils.merge(
86
+ headers.common,
87
+ headers[config.method]
88
+ );
89
+ headers && utils.forEach(
90
+ ["delete", "get", "head", "post", "put", "patch", "common"],
91
+ (method) => {
92
+ delete headers[method];
93
+ }
94
+ );
95
+ config.headers = AxiosHeaders.concat(contextHeaders, headers);
96
+ const requestInterceptorChain = [];
97
+ let synchronousRequestInterceptors = true;
98
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
99
+ if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
100
+ return;
101
+ }
102
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
103
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
104
+ });
105
+ const responseInterceptorChain = [];
106
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
107
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
108
+ });
109
+ let promise;
110
+ let i = 0;
111
+ let len;
112
+ if (!synchronousRequestInterceptors) {
113
+ const chain = [dispatchRequest.bind(this), void 0];
114
+ chain.unshift(...requestInterceptorChain);
115
+ chain.push(...responseInterceptorChain);
116
+ len = chain.length;
117
+ promise = Promise.resolve(config);
118
+ while (i < len) {
119
+ promise = promise.then(chain[i++], chain[i++]);
120
+ }
121
+ return promise;
122
+ }
123
+ len = requestInterceptorChain.length;
124
+ let newConfig = config;
125
+ while (i < len) {
126
+ const onFulfilled = requestInterceptorChain[i++];
127
+ const onRejected = requestInterceptorChain[i++];
128
+ try {
129
+ newConfig = onFulfilled(newConfig);
130
+ } catch (error) {
131
+ onRejected.call(this, error);
132
+ break;
133
+ }
134
+ }
135
+ try {
136
+ promise = dispatchRequest.call(this, newConfig);
137
+ } catch (error) {
138
+ return Promise.reject(error);
139
+ }
140
+ i = 0;
141
+ len = responseInterceptorChain.length;
142
+ while (i < len) {
143
+ promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
144
+ }
145
+ return promise;
146
+ }
147
+ getUri(config) {
148
+ config = mergeConfig(this.defaults, config);
149
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
150
+ return buildURL(fullPath, config.params, config.paramsSerializer);
151
+ }
152
+ }
153
+ utils.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
154
+ Axios.prototype[method] = function(url, config) {
155
+ return this.request(mergeConfig(config || {}, {
156
+ method,
157
+ url,
158
+ data: (config || {}).data
159
+ }));
160
+ };
161
+ });
162
+ utils.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
163
+ function generateHTTPMethod(isForm) {
164
+ return function httpMethod(url, data, config) {
165
+ return this.request(mergeConfig(config || {}, {
166
+ method,
167
+ headers: isForm ? {
168
+ "Content-Type": "multipart/form-data"
169
+ } : {},
170
+ url,
171
+ data
172
+ }));
173
+ };
174
+ }
175
+ Axios.prototype[method] = generateHTTPMethod();
176
+ Axios.prototype[method + "Form"] = generateHTTPMethod(true);
177
+ });
178
+ export {
179
+ Axios as default
180
+ };
@@ -0,0 +1,80 @@
1
+ import utils from "../../utils/index.es.js";
2
+ function AxiosError(message, code, config, request, response) {
3
+ Error.call(this);
4
+ if (Error.captureStackTrace) {
5
+ Error.captureStackTrace(this, this.constructor);
6
+ } else {
7
+ this.stack = new Error().stack;
8
+ }
9
+ this.message = message;
10
+ this.name = "AxiosError";
11
+ code && (this.code = code);
12
+ config && (this.config = config);
13
+ request && (this.request = request);
14
+ if (response) {
15
+ this.response = response;
16
+ this.status = response.status ? response.status : null;
17
+ }
18
+ }
19
+ utils.inherits(AxiosError, Error, {
20
+ toJSON: function toJSON() {
21
+ return {
22
+ // Standard
23
+ message: this.message,
24
+ name: this.name,
25
+ // Microsoft
26
+ description: this.description,
27
+ number: this.number,
28
+ // Mozilla
29
+ fileName: this.fileName,
30
+ lineNumber: this.lineNumber,
31
+ columnNumber: this.columnNumber,
32
+ stack: this.stack,
33
+ // Axios
34
+ config: utils.toJSONObject(this.config),
35
+ code: this.code,
36
+ status: this.status
37
+ };
38
+ }
39
+ });
40
+ const prototype = AxiosError.prototype;
41
+ const descriptors = {};
42
+ [
43
+ "ERR_BAD_OPTION_VALUE",
44
+ "ERR_BAD_OPTION",
45
+ "ECONNABORTED",
46
+ "ETIMEDOUT",
47
+ "ERR_NETWORK",
48
+ "ERR_FR_TOO_MANY_REDIRECTS",
49
+ "ERR_DEPRECATED",
50
+ "ERR_BAD_RESPONSE",
51
+ "ERR_BAD_REQUEST",
52
+ "ERR_CANCELED",
53
+ "ERR_NOT_SUPPORT",
54
+ "ERR_INVALID_URL"
55
+ // eslint-disable-next-line func-names
56
+ ].forEach((code) => {
57
+ descriptors[code] = { value: code };
58
+ });
59
+ Object.defineProperties(AxiosError, descriptors);
60
+ Object.defineProperty(prototype, "isAxiosError", { value: true });
61
+ AxiosError.from = (error, code, config, request, response, customProps) => {
62
+ const axiosError = Object.create(prototype);
63
+ utils.toFlatObject(error, axiosError, function filter(obj) {
64
+ return obj !== Error.prototype;
65
+ }, (prop) => {
66
+ return prop !== "isAxiosError";
67
+ });
68
+ const msg = error && error.message ? error.message : "Error";
69
+ const errCode = code == null && error ? error.code : code;
70
+ AxiosError.call(axiosError, msg, errCode, config, request, response);
71
+ if (error && axiosError.cause == null) {
72
+ Object.defineProperty(axiosError, "cause", { value: error, configurable: true });
73
+ }
74
+ axiosError.name = error && error.name || "Error";
75
+ customProps && Object.assign(axiosError, customProps);
76
+ return axiosError;
77
+ };
78
+ export {
79
+ AxiosError as default
80
+ };
@@ -0,0 +1,231 @@
1
+ import utils from "../../utils/index.es.js";
2
+ import parseHeaders from "../../helpers/parseHeaders/index.es.js";
3
+ const $internals = Symbol("internals");
4
+ function normalizeHeader(header) {
5
+ return header && String(header).trim().toLowerCase();
6
+ }
7
+ function normalizeValue(value) {
8
+ if (value === false || value == null) {
9
+ return value;
10
+ }
11
+ return utils.isArray(value) ? value.map(normalizeValue) : String(value);
12
+ }
13
+ function parseTokens(str) {
14
+ const tokens = /* @__PURE__ */ Object.create(null);
15
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
16
+ let match;
17
+ while (match = tokensRE.exec(str)) {
18
+ tokens[match[1]] = match[2];
19
+ }
20
+ return tokens;
21
+ }
22
+ const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
23
+ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
24
+ if (utils.isFunction(filter)) {
25
+ return filter.call(this, value, header);
26
+ }
27
+ if (isHeaderNameFilter) {
28
+ value = header;
29
+ }
30
+ if (!utils.isString(value)) return;
31
+ if (utils.isString(filter)) {
32
+ return value.indexOf(filter) !== -1;
33
+ }
34
+ if (utils.isRegExp(filter)) {
35
+ return filter.test(value);
36
+ }
37
+ }
38
+ function formatHeader(header) {
39
+ return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
40
+ return char.toUpperCase() + str;
41
+ });
42
+ }
43
+ function buildAccessors(obj, header) {
44
+ const accessorName = utils.toCamelCase(" " + header);
45
+ ["get", "set", "has"].forEach((methodName) => {
46
+ Object.defineProperty(obj, methodName + accessorName, {
47
+ value: function(arg1, arg2, arg3) {
48
+ return this[methodName].call(this, header, arg1, arg2, arg3);
49
+ },
50
+ configurable: true
51
+ });
52
+ });
53
+ }
54
+ class AxiosHeaders {
55
+ constructor(headers) {
56
+ headers && this.set(headers);
57
+ }
58
+ set(header, valueOrRewrite, rewrite) {
59
+ const self = this;
60
+ function setHeader(_value, _header, _rewrite) {
61
+ const lHeader = normalizeHeader(_header);
62
+ if (!lHeader) {
63
+ throw new Error("header name must be a non-empty string");
64
+ }
65
+ const key = utils.findKey(self, lHeader);
66
+ if (!key || self[key] === void 0 || _rewrite === true || _rewrite === void 0 && self[key] !== false) {
67
+ self[key || _header] = normalizeValue(_value);
68
+ }
69
+ }
70
+ const setHeaders = (headers, _rewrite) => utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
71
+ if (utils.isPlainObject(header) || header instanceof this.constructor) {
72
+ setHeaders(header, valueOrRewrite);
73
+ } else if (utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
74
+ setHeaders(parseHeaders(header), valueOrRewrite);
75
+ } else if (utils.isObject(header) && utils.isIterable(header)) {
76
+ let obj = {}, dest, key;
77
+ for (const entry of header) {
78
+ if (!utils.isArray(entry)) {
79
+ throw TypeError("Object iterator must return a key-value pair");
80
+ }
81
+ obj[key = entry[0]] = (dest = obj[key]) ? utils.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
82
+ }
83
+ setHeaders(obj, valueOrRewrite);
84
+ } else {
85
+ header != null && setHeader(valueOrRewrite, header, rewrite);
86
+ }
87
+ return this;
88
+ }
89
+ get(header, parser) {
90
+ header = normalizeHeader(header);
91
+ if (header) {
92
+ const key = utils.findKey(this, header);
93
+ if (key) {
94
+ const value = this[key];
95
+ if (!parser) {
96
+ return value;
97
+ }
98
+ if (parser === true) {
99
+ return parseTokens(value);
100
+ }
101
+ if (utils.isFunction(parser)) {
102
+ return parser.call(this, value, key);
103
+ }
104
+ if (utils.isRegExp(parser)) {
105
+ return parser.exec(value);
106
+ }
107
+ throw new TypeError("parser must be boolean|regexp|function");
108
+ }
109
+ }
110
+ }
111
+ has(header, matcher) {
112
+ header = normalizeHeader(header);
113
+ if (header) {
114
+ const key = utils.findKey(this, header);
115
+ return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
116
+ }
117
+ return false;
118
+ }
119
+ delete(header, matcher) {
120
+ const self = this;
121
+ let deleted = false;
122
+ function deleteHeader(_header) {
123
+ _header = normalizeHeader(_header);
124
+ if (_header) {
125
+ const key = utils.findKey(self, _header);
126
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
127
+ delete self[key];
128
+ deleted = true;
129
+ }
130
+ }
131
+ }
132
+ if (utils.isArray(header)) {
133
+ header.forEach(deleteHeader);
134
+ } else {
135
+ deleteHeader(header);
136
+ }
137
+ return deleted;
138
+ }
139
+ clear(matcher) {
140
+ const keys = Object.keys(this);
141
+ let i = keys.length;
142
+ let deleted = false;
143
+ while (i--) {
144
+ const key = keys[i];
145
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
146
+ delete this[key];
147
+ deleted = true;
148
+ }
149
+ }
150
+ return deleted;
151
+ }
152
+ normalize(format) {
153
+ const self = this;
154
+ const headers = {};
155
+ utils.forEach(this, (value, header) => {
156
+ const key = utils.findKey(headers, header);
157
+ if (key) {
158
+ self[key] = normalizeValue(value);
159
+ delete self[header];
160
+ return;
161
+ }
162
+ const normalized = format ? formatHeader(header) : String(header).trim();
163
+ if (normalized !== header) {
164
+ delete self[header];
165
+ }
166
+ self[normalized] = normalizeValue(value);
167
+ headers[normalized] = true;
168
+ });
169
+ return this;
170
+ }
171
+ concat(...targets) {
172
+ return this.constructor.concat(this, ...targets);
173
+ }
174
+ toJSON(asStrings) {
175
+ const obj = /* @__PURE__ */ Object.create(null);
176
+ utils.forEach(this, (value, header) => {
177
+ value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(", ") : value);
178
+ });
179
+ return obj;
180
+ }
181
+ [Symbol.iterator]() {
182
+ return Object.entries(this.toJSON())[Symbol.iterator]();
183
+ }
184
+ toString() {
185
+ return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
186
+ }
187
+ getSetCookie() {
188
+ return this.get("set-cookie") || [];
189
+ }
190
+ get [Symbol.toStringTag]() {
191
+ return "AxiosHeaders";
192
+ }
193
+ static from(thing) {
194
+ return thing instanceof this ? thing : new this(thing);
195
+ }
196
+ static concat(first, ...targets) {
197
+ const computed = new this(first);
198
+ targets.forEach((target) => computed.set(target));
199
+ return computed;
200
+ }
201
+ static accessor(header) {
202
+ const internals = this[$internals] = this[$internals] = {
203
+ accessors: {}
204
+ };
205
+ const accessors = internals.accessors;
206
+ const prototype = this.prototype;
207
+ function defineAccessor(_header) {
208
+ const lHeader = normalizeHeader(_header);
209
+ if (!accessors[lHeader]) {
210
+ buildAccessors(prototype, _header);
211
+ accessors[lHeader] = true;
212
+ }
213
+ }
214
+ utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
215
+ return this;
216
+ }
217
+ }
218
+ AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
219
+ utils.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
220
+ let mapped = key[0].toUpperCase() + key.slice(1);
221
+ return {
222
+ get: () => value,
223
+ set(headerValue) {
224
+ this[mapped] = headerValue;
225
+ }
226
+ };
227
+ });
228
+ utils.freezeMethods(AxiosHeaders);
229
+ export {
230
+ AxiosHeaders as default
231
+ };
@@ -0,0 +1,65 @@
1
+ import utils from "../../utils/index.es.js";
2
+ class InterceptorManager {
3
+ constructor() {
4
+ this.handlers = [];
5
+ }
6
+ /**
7
+ * Add a new interceptor to the stack
8
+ *
9
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
10
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
11
+ *
12
+ * @return {Number} An ID used to remove interceptor later
13
+ */
14
+ use(fulfilled, rejected, options) {
15
+ this.handlers.push({
16
+ fulfilled,
17
+ rejected,
18
+ synchronous: options ? options.synchronous : false,
19
+ runWhen: options ? options.runWhen : null
20
+ });
21
+ return this.handlers.length - 1;
22
+ }
23
+ /**
24
+ * Remove an interceptor from the stack
25
+ *
26
+ * @param {Number} id The ID that was returned by `use`
27
+ *
28
+ * @returns {void}
29
+ */
30
+ eject(id) {
31
+ if (this.handlers[id]) {
32
+ this.handlers[id] = null;
33
+ }
34
+ }
35
+ /**
36
+ * Clear all interceptors from the stack
37
+ *
38
+ * @returns {void}
39
+ */
40
+ clear() {
41
+ if (this.handlers) {
42
+ this.handlers = [];
43
+ }
44
+ }
45
+ /**
46
+ * Iterate over all the registered interceptors
47
+ *
48
+ * This method is particularly useful for skipping over any
49
+ * interceptors that may have become `null` calling `eject`.
50
+ *
51
+ * @param {Function} fn The function to call for each interceptor
52
+ *
53
+ * @returns {void}
54
+ */
55
+ forEach(fn) {
56
+ utils.forEach(this.handlers, function forEachHandler(h) {
57
+ if (h !== null) {
58
+ fn(h);
59
+ }
60
+ });
61
+ }
62
+ }
63
+ export {
64
+ InterceptorManager as default
65
+ };
@@ -0,0 +1,12 @@
1
+ import isAbsoluteURL from "../../helpers/isAbsoluteURL/index.es.js";
2
+ import combineURLs from "../../helpers/combineURLs/index.es.js";
3
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
4
+ let isRelativeUrl = !isAbsoluteURL(requestedURL);
5
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
6
+ return combineURLs(baseURL, requestedURL);
7
+ }
8
+ return requestedURL;
9
+ }
10
+ export {
11
+ buildFullPath as default
12
+ };
@@ -0,0 +1,52 @@
1
+ import transformData from "../transformData/index.es.js";
2
+ import isCancel from "../../cancel/isCancel/index.es.js";
3
+ import defaults from "../../defaults/index/index.es.js";
4
+ import CanceledError from "../../cancel/CanceledError/index.es.js";
5
+ import AxiosHeaders from "../AxiosHeaders/index.es.js";
6
+ import adapters from "../../adapters/adapters/index.es.js";
7
+ function throwIfCancellationRequested(config) {
8
+ if (config.cancelToken) {
9
+ config.cancelToken.throwIfRequested();
10
+ }
11
+ if (config.signal && config.signal.aborted) {
12
+ throw new CanceledError(null, config);
13
+ }
14
+ }
15
+ function dispatchRequest(config) {
16
+ throwIfCancellationRequested(config);
17
+ config.headers = AxiosHeaders.from(config.headers);
18
+ config.data = transformData.call(
19
+ config,
20
+ config.transformRequest
21
+ );
22
+ if (["post", "put", "patch"].indexOf(config.method) !== -1) {
23
+ config.headers.setContentType("application/x-www-form-urlencoded", false);
24
+ }
25
+ const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
26
+ return adapter(config).then(function onAdapterResolution(response) {
27
+ throwIfCancellationRequested(config);
28
+ response.data = transformData.call(
29
+ config,
30
+ config.transformResponse,
31
+ response
32
+ );
33
+ response.headers = AxiosHeaders.from(response.headers);
34
+ return response;
35
+ }, function onAdapterRejection(reason) {
36
+ if (!isCancel(reason)) {
37
+ throwIfCancellationRequested(config);
38
+ if (reason && reason.response) {
39
+ reason.response.data = transformData.call(
40
+ config,
41
+ config.transformResponse,
42
+ reason.response
43
+ );
44
+ reason.response.headers = AxiosHeaders.from(reason.response.headers);
45
+ }
46
+ }
47
+ return Promise.reject(reason);
48
+ });
49
+ }
50
+ export {
51
+ dispatchRequest as default
52
+ };
@@ -0,0 +1,83 @@
1
+ import utils from "../../utils/index.es.js";
2
+ import AxiosHeaders from "../AxiosHeaders/index.es.js";
3
+ const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
4
+ function mergeConfig(config1, config2) {
5
+ config2 = config2 || {};
6
+ const config = {};
7
+ function getMergedValue(target, source, prop, caseless) {
8
+ if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
9
+ return utils.merge.call({ caseless }, target, source);
10
+ } else if (utils.isPlainObject(source)) {
11
+ return utils.merge({}, source);
12
+ } else if (utils.isArray(source)) {
13
+ return source.slice();
14
+ }
15
+ return source;
16
+ }
17
+ function mergeDeepProperties(a, b, prop, caseless) {
18
+ if (!utils.isUndefined(b)) {
19
+ return getMergedValue(a, b, prop, caseless);
20
+ } else if (!utils.isUndefined(a)) {
21
+ return getMergedValue(void 0, a, prop, caseless);
22
+ }
23
+ }
24
+ function valueFromConfig2(a, b) {
25
+ if (!utils.isUndefined(b)) {
26
+ return getMergedValue(void 0, b);
27
+ }
28
+ }
29
+ function defaultToConfig2(a, b) {
30
+ if (!utils.isUndefined(b)) {
31
+ return getMergedValue(void 0, b);
32
+ } else if (!utils.isUndefined(a)) {
33
+ return getMergedValue(void 0, a);
34
+ }
35
+ }
36
+ function mergeDirectKeys(a, b, prop) {
37
+ if (prop in config2) {
38
+ return getMergedValue(a, b);
39
+ } else if (prop in config1) {
40
+ return getMergedValue(void 0, a);
41
+ }
42
+ }
43
+ const mergeMap = {
44
+ url: valueFromConfig2,
45
+ method: valueFromConfig2,
46
+ data: valueFromConfig2,
47
+ baseURL: defaultToConfig2,
48
+ transformRequest: defaultToConfig2,
49
+ transformResponse: defaultToConfig2,
50
+ paramsSerializer: defaultToConfig2,
51
+ timeout: defaultToConfig2,
52
+ timeoutMessage: defaultToConfig2,
53
+ withCredentials: defaultToConfig2,
54
+ withXSRFToken: defaultToConfig2,
55
+ adapter: defaultToConfig2,
56
+ responseType: defaultToConfig2,
57
+ xsrfCookieName: defaultToConfig2,
58
+ xsrfHeaderName: defaultToConfig2,
59
+ onUploadProgress: defaultToConfig2,
60
+ onDownloadProgress: defaultToConfig2,
61
+ decompress: defaultToConfig2,
62
+ maxContentLength: defaultToConfig2,
63
+ maxBodyLength: defaultToConfig2,
64
+ beforeRedirect: defaultToConfig2,
65
+ transport: defaultToConfig2,
66
+ httpAgent: defaultToConfig2,
67
+ httpsAgent: defaultToConfig2,
68
+ cancelToken: defaultToConfig2,
69
+ socketPath: defaultToConfig2,
70
+ responseEncoding: defaultToConfig2,
71
+ validateStatus: mergeDirectKeys,
72
+ headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
73
+ };
74
+ utils.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
75
+ const merge = mergeMap[prop] || mergeDeepProperties;
76
+ const configValue = merge(config1[prop], config2[prop], prop);
77
+ utils.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
78
+ });
79
+ return config;
80
+ }
81
+ export {
82
+ mergeConfig as default
83
+ };