@impui/imp 1.0.16-beta.0 → 1.0.16

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 (71) hide show
  1. package/dist/axios/index.es.js +1 -143
  2. package/dist/config/index.es.js +1 -127
  3. package/dist/core/index.es.js +1 -34
  4. package/dist/gotool/go2/index.es.js +1 -510
  5. package/dist/gotool/index/index.es.js +1 -164
  6. package/dist/imph5/index.es.js +1 -324
  7. package/dist/index.es.js +1 -49
  8. package/dist/login/index.es.js +1 -711
  9. package/dist/node_modules/axios/index/index.es.js +1 -38
  10. package/dist/node_modules/axios/lib/adapters/adapters/index.es.js +1 -71
  11. package/dist/node_modules/axios/lib/adapters/fetch/index.es.js +1 -219
  12. package/dist/node_modules/axios/lib/adapters/xhr/index.es.js +1 -141
  13. package/dist/node_modules/axios/lib/axios/index.es.js +1 -50
  14. package/dist/node_modules/axios/lib/cancel/CancelToken/index.es.js +1 -99
  15. package/dist/node_modules/axios/lib/cancel/CanceledError/index.es.js +1 -12
  16. package/dist/node_modules/axios/lib/cancel/isCancel/index.es.js +1 -6
  17. package/dist/node_modules/axios/lib/core/Axios/index.es.js +1 -180
  18. package/dist/node_modules/axios/lib/core/AxiosError/index.es.js +1 -80
  19. package/dist/node_modules/axios/lib/core/AxiosHeaders/index.es.js +1 -231
  20. package/dist/node_modules/axios/lib/core/InterceptorManager/index.es.js +1 -65
  21. package/dist/node_modules/axios/lib/core/buildFullPath/index.es.js +1 -12
  22. package/dist/node_modules/axios/lib/core/dispatchRequest/index.es.js +1 -52
  23. package/dist/node_modules/axios/lib/core/mergeConfig/index.es.js +1 -83
  24. package/dist/node_modules/axios/lib/core/settle/index.es.js +1 -18
  25. package/dist/node_modules/axios/lib/core/transformData/index.es.js +1 -17
  26. package/dist/node_modules/axios/lib/defaults/index/index.es.js +1 -116
  27. package/dist/node_modules/axios/lib/defaults/transitional/index.es.js +1 -8
  28. package/dist/node_modules/axios/lib/env/data/index.es.js +1 -4
  29. package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams/index.es.js +1 -34
  30. package/dist/node_modules/axios/lib/helpers/HttpStatusCode/index.es.js +1 -77
  31. package/dist/node_modules/axios/lib/helpers/bind/index.es.js +1 -8
  32. package/dist/node_modules/axios/lib/helpers/buildURL/index.es.js +1 -34
  33. package/dist/node_modules/axios/lib/helpers/combineURLs/index.es.js +1 -6
  34. package/dist/node_modules/axios/lib/helpers/composeSignals/index.es.js +1 -39
  35. package/dist/node_modules/axios/lib/helpers/cookies/index.es.js +1 -49
  36. package/dist/node_modules/axios/lib/helpers/formDataToJSON/index.es.js +1 -54
  37. package/dist/node_modules/axios/lib/helpers/isAbsoluteURL/index.es.js +1 -6
  38. package/dist/node_modules/axios/lib/helpers/isAxiosError/index.es.js +1 -7
  39. package/dist/node_modules/axios/lib/helpers/isURLSameOrigin/index.es.js +1 -11
  40. package/dist/node_modules/axios/lib/helpers/null/index.es.js +1 -4
  41. package/dist/node_modules/axios/lib/helpers/parseHeaders/index.es.js +1 -47
  42. package/dist/node_modules/axios/lib/helpers/parseProtocol/index.es.js +1 -7
  43. package/dist/node_modules/axios/lib/helpers/progressEventReducer/index.es.js +1 -41
  44. package/dist/node_modules/axios/lib/helpers/resolveConfig/index.es.js +1 -46
  45. package/dist/node_modules/axios/lib/helpers/speedometer/index.es.js +1 -36
  46. package/dist/node_modules/axios/lib/helpers/spread/index.es.js +1 -8
  47. package/dist/node_modules/axios/lib/helpers/throttle/index.es.js +1 -35
  48. package/dist/node_modules/axios/lib/helpers/toFormData/index.es.js +1 -117
  49. package/dist/node_modules/axios/lib/helpers/toURLEncodedForm/index.es.js +1 -18
  50. package/dist/node_modules/axios/lib/helpers/trackStream/index.es.js +1 -80
  51. package/dist/node_modules/axios/lib/helpers/validator/index.es.js +1 -67
  52. package/dist/node_modules/axios/lib/platform/browser/classes/Blob/index.es.js +1 -4
  53. package/dist/node_modules/axios/lib/platform/browser/classes/FormData/index.es.js +1 -4
  54. package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams/index.es.js +1 -5
  55. package/dist/node_modules/axios/lib/platform/browser/index/index.es.js +1 -15
  56. package/dist/node_modules/axios/lib/platform/common/utils/index.es.js +1 -15
  57. package/dist/node_modules/axios/lib/platform/index/index.es.js +1 -9
  58. package/dist/node_modules/axios/lib/utils/index.es.js +1 -387
  59. package/dist/packages/com/dist/cache/index.es/index.es.js +1 -145
  60. package/dist/packages/com/dist/core/index.es/index.es.js +1 -154
  61. package/dist/packages/com/dist/data/index.es/index.es.js +1 -26
  62. package/dist/packages/com/dist/date/index.es/index.es.js +2 -194
  63. package/dist/packages/com/dist/log/index.es/index.es.js +1 -110
  64. package/dist/packages/com/dist/message/index.es/index.es.js +1 -90
  65. package/dist/packages/com/dist/req/index.es/index.es.js +1 -35
  66. package/dist/packages/com/dist/str/index.es/index.es.js +1 -25
  67. package/dist/packages/com/dist/typetool/index.es/index.es.js +1 -53
  68. package/dist/packages/com/dist/url/index.es/index.es.js +1 -238
  69. package/dist/restool/index/index.es.js +1 -266
  70. package/dist/restool/index.css/index.es.js +1 -4
  71. package/package.json +5 -1
@@ -1,180 +1 @@
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
- };
1
+ import t from"../../utils/index.es.js";import e from"../../helpers/buildURL/index.es.js";import r from"../InterceptorManager/index.es.js";import s from"../dispatchRequest/index.es.js";import o from"../mergeConfig/index.es.js";import n from"../buildFullPath/index.es.js";import a from"../../helpers/validator/index.es.js";import i from"../AxiosHeaders/index.es.js";const l=a.validators;class c{constructor(t){this.defaults=t||{},this.interceptors={request:new r,response:new r}}async request(t,e){try{return await this._request(t,e)}catch(r){if(r instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const e=t.stack?t.stack.replace(/^.+\n/,""):"";try{r.stack?e&&!String(r.stack).endsWith(e.replace(/^.+\n.+\n/,""))&&(r.stack+="\n"+e):r.stack=e}catch(s){}}throw r}}_request(e,r){"string"==typeof e?(r=r||{}).url=e:r=e||{},r=o(this.defaults,r);const{transitional:n,paramsSerializer:c,headers:u}=r;void 0!==n&&a.assertOptions(n,{silentJSONParsing:l.transitional(l.boolean),forcedJSONParsing:l.transitional(l.boolean),clarifyTimeoutError:l.transitional(l.boolean)},!1),null!=c&&(t.isFunction(c)?r.paramsSerializer={serialize:c}:a.assertOptions(c,{encode:l.function,serialize:l.function},!0)),void 0!==r.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),a.assertOptions(r,{baseUrl:l.spelling("baseURL"),withXsrfToken:l.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let h=u&&t.merge(u.common,u[r.method]);u&&t.forEach(["delete","get","head","post","put","patch","common"],t=>{delete u[t]}),r.headers=i.concat(h,u);const d=[];let p=!0;this.interceptors.request.forEach(function(t){"function"==typeof t.runWhen&&!1===t.runWhen(r)||(p=p&&t.synchronous,d.unshift(t.fulfilled,t.rejected))});const f=[];let m;this.interceptors.response.forEach(function(t){f.push(t.fulfilled,t.rejected)});let g,b=0;if(!p){const t=[s.bind(this),void 0];for(t.unshift(...d),t.push(...f),g=t.length,m=Promise.resolve(r);b<g;)m=m.then(t[b++],t[b++]);return m}g=d.length;let w=r;for(;b<g;){const t=d[b++],e=d[b++];try{w=t(w)}catch(y){e.call(this,y);break}}try{m=s.call(this,w)}catch(y){return Promise.reject(y)}for(b=0,g=f.length;b<g;)m=m.then(f[b++],f[b++]);return m}getUri(t){t=o(this.defaults,t);const r=n(t.baseURL,t.url,t.allowAbsoluteUrls);return e(r,t.params,t.paramsSerializer)}}t.forEach(["delete","get","head","options"],function(t){c.prototype[t]=function(e,r){return this.request(o(r||{},{method:t,url:e,data:(r||{}).data}))}}),t.forEach(["post","put","patch"],function(t){function e(e){return function(r,s,n){return this.request(o(n||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:r,data:s}))}}c.prototype[t]=e(),c.prototype[t+"Form"]=e(!0)});export{c as default};
@@ -1,80 +1 @@
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
- };
1
+ import t from"../../utils/index.es.js";function e(t,e,r,s,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),s&&(this.request=s),i&&(this.response=i,this.status=i.status?i.status:null)}t.inherits(e,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:t.toJSONObject(this.config),code:this.code,status:this.status}}});const r=e.prototype,s={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{s[t]={value:t}}),Object.defineProperties(e,s),Object.defineProperty(r,"isAxiosError",{value:!0}),e.from=(s,i,o,c,a,n)=>{const E=Object.create(r);t.toFlatObject(s,E,function(t){return t!==Error.prototype},t=>"isAxiosError"!==t);const u=s&&s.message?s.message:"Error",R=null==i&&s?s.code:i;return e.call(E,u,R,o,c,a),s&&null==E.cause&&Object.defineProperty(E,"cause",{value:s,configurable:!0}),E.name=s&&s.name||"Error",n&&Object.assign(E,n),E};export{e as default};
@@ -1,231 +1 @@
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
- };
1
+ import t from"../../utils/index.es.js";import e from"../../helpers/parseHeaders/index.es.js";const r=Symbol("internals");function s(t){return t&&String(t).trim().toLowerCase()}function n(e){return!1===e||null==e?e:t.isArray(e)?e.map(n):String(e)}function i(e,r,s,n,i){return t.isFunction(n)?n.call(this,r,s):(i&&(r=s),t.isString(r)?t.isString(n)?-1!==r.indexOf(n):t.isRegExp(n)?n.test(r):void 0:void 0)}class o{constructor(t){t&&this.set(t)}set(r,i,o){const c=this;function a(e,r,i){const o=s(r);if(!o)throw new Error("header name must be a non-empty string");const a=t.findKey(c,o);(!a||void 0===c[a]||!0===i||void 0===i&&!1!==c[a])&&(c[a||r]=n(e))}const u=(e,r)=>t.forEach(e,(t,e)=>a(t,e,r));if(t.isPlainObject(r)||r instanceof this.constructor)u(r,i);else if(t.isString(r)&&(r=r.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim()))u(e(r),i);else if(t.isObject(r)&&t.isIterable(r)){let e,s,n={};for(const i of r){if(!t.isArray(i))throw TypeError("Object iterator must return a key-value pair");n[s=i[0]]=(e=n[s])?t.isArray(e)?[...e,i[1]]:[e,i[1]]:i[1]}u(n,i)}else null!=r&&a(i,r,o);return this}get(e,r){if(e=s(e)){const s=t.findKey(this,e);if(s){const e=this[s];if(!r)return e;if(!0===r)return function(t){const e=/* @__PURE__ */Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=r.exec(t);)e[s[1]]=s[2];return e}(e);if(t.isFunction(r))return r.call(this,e,s);if(t.isRegExp(r))return r.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=s(e)){const s=t.findKey(this,e);return!(!s||void 0===this[s]||r&&!i(0,this[s],s,r))}return!1}delete(e,r){const n=this;let o=!1;function c(e){if(e=s(e)){const s=t.findKey(n,e);!s||r&&!i(0,n[s],s,r)||(delete n[s],o=!0)}}return t.isArray(e)?e.forEach(c):c(e),o}clear(t){const e=Object.keys(this);let r=e.length,s=!1;for(;r--;){const n=e[r];t&&!i(0,this[n],n,t,!0)||(delete this[n],s=!0)}return s}normalize(e){const r=this,s={};return t.forEach(this,(i,o)=>{const c=t.findKey(s,o);if(c)return r[c]=n(i),void delete r[o];const a=e?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,e,r)=>e.toUpperCase()+r)}(o):String(o).trim();a!==o&&delete r[o],r[a]=n(i),s[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(e){const r=/* @__PURE__ */Object.create(null);return t.forEach(this,(s,n)=>{null!=s&&!1!==s&&(r[n]=e&&t.isArray(s)?s.join(", "):s)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const r=new this(t);return e.forEach(t=>r.set(t)),r}static accessor(e){const n=(this[r]=this[r]={accessors:{}}).accessors,i=this.prototype;function o(e){const r=s(e);n[r]||(!function(e,r){const s=t.toCamelCase(" "+r);["get","set","has"].forEach(t=>{Object.defineProperty(e,t+s,{value:function(e,s,n){return this[t].call(this,r,e,s,n)},configurable:!0})})}(i,e),n[r]=!0)}return t.isArray(e)?e.forEach(o):o(e),this}}o.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),t.reduceDescriptors(o.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[r]=t}}}),t.freezeMethods(o);export{o as default};
@@ -1,65 +1 @@
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
- };
1
+ import s from"../../utils/index.es.js";class n{constructor(){this.handlers=[]}use(s,n,e){return this.handlers.push({fulfilled:s,rejected:n,synchronous:!!e&&e.synchronous,runWhen:e?e.runWhen:null}),this.handlers.length-1}eject(s){this.handlers[s]&&(this.handlers[s]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(n){s.forEach(this.handlers,function(s){null!==s&&n(s)})}}export{n as default};
@@ -1,12 +1 @@
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
- };
1
+ import e from"../../helpers/isAbsoluteURL/index.es.js";import s from"../../helpers/combineURLs/index.es.js";function r(r,o,t){let i=!e(o);return r&&(i||0==t)?s(r,o):o}export{r as default};
@@ -1,52 +1 @@
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
- };
1
+ import e from"../transformData/index.es.js";import r from"../../cancel/isCancel/index.es.js";import s from"../../defaults/index/index.es.js";import a from"../../cancel/CanceledError/index.es.js";import n from"../AxiosHeaders/index.es.js";import o from"../../adapters/adapters/index.es.js";function t(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new a(null,e)}function d(a){t(a),a.headers=n.from(a.headers),a.data=e.call(a,a.transformRequest),-1!==["post","put","patch"].indexOf(a.method)&&a.headers.setContentType("application/x-www-form-urlencoded",!1);return o.getAdapter(a.adapter||s.adapter,a)(a).then(function(r){return t(a),r.data=e.call(a,a.transformResponse,r),r.headers=n.from(r.headers),r},function(s){return r(s)||(t(a),s&&s.response&&(s.response.data=e.call(a,a.transformResponse,s.response),s.response.headers=n.from(s.response.headers))),Promise.reject(s)})}export{d as default};