@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.
- package/dist/axios/index.es.js +1 -143
- package/dist/config/index.es.js +1 -127
- package/dist/core/index.es.js +1 -34
- package/dist/gotool/go2/index.es.js +1 -510
- package/dist/gotool/index/index.es.js +1 -164
- package/dist/imph5/index.es.js +1 -324
- package/dist/index.es.js +1 -49
- package/dist/login/index.es.js +1 -711
- package/dist/node_modules/axios/index/index.es.js +1 -38
- package/dist/node_modules/axios/lib/adapters/adapters/index.es.js +1 -71
- package/dist/node_modules/axios/lib/adapters/fetch/index.es.js +1 -219
- package/dist/node_modules/axios/lib/adapters/xhr/index.es.js +1 -141
- package/dist/node_modules/axios/lib/axios/index.es.js +1 -50
- package/dist/node_modules/axios/lib/cancel/CancelToken/index.es.js +1 -99
- package/dist/node_modules/axios/lib/cancel/CanceledError/index.es.js +1 -12
- package/dist/node_modules/axios/lib/cancel/isCancel/index.es.js +1 -6
- package/dist/node_modules/axios/lib/core/Axios/index.es.js +1 -180
- package/dist/node_modules/axios/lib/core/AxiosError/index.es.js +1 -80
- package/dist/node_modules/axios/lib/core/AxiosHeaders/index.es.js +1 -231
- package/dist/node_modules/axios/lib/core/InterceptorManager/index.es.js +1 -65
- package/dist/node_modules/axios/lib/core/buildFullPath/index.es.js +1 -12
- package/dist/node_modules/axios/lib/core/dispatchRequest/index.es.js +1 -52
- package/dist/node_modules/axios/lib/core/mergeConfig/index.es.js +1 -83
- package/dist/node_modules/axios/lib/core/settle/index.es.js +1 -18
- package/dist/node_modules/axios/lib/core/transformData/index.es.js +1 -17
- package/dist/node_modules/axios/lib/defaults/index/index.es.js +1 -116
- package/dist/node_modules/axios/lib/defaults/transitional/index.es.js +1 -8
- package/dist/node_modules/axios/lib/env/data/index.es.js +1 -4
- package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams/index.es.js +1 -34
- package/dist/node_modules/axios/lib/helpers/HttpStatusCode/index.es.js +1 -77
- package/dist/node_modules/axios/lib/helpers/bind/index.es.js +1 -8
- package/dist/node_modules/axios/lib/helpers/buildURL/index.es.js +1 -34
- package/dist/node_modules/axios/lib/helpers/combineURLs/index.es.js +1 -6
- package/dist/node_modules/axios/lib/helpers/composeSignals/index.es.js +1 -39
- package/dist/node_modules/axios/lib/helpers/cookies/index.es.js +1 -49
- package/dist/node_modules/axios/lib/helpers/formDataToJSON/index.es.js +1 -54
- package/dist/node_modules/axios/lib/helpers/isAbsoluteURL/index.es.js +1 -6
- package/dist/node_modules/axios/lib/helpers/isAxiosError/index.es.js +1 -7
- package/dist/node_modules/axios/lib/helpers/isURLSameOrigin/index.es.js +1 -11
- package/dist/node_modules/axios/lib/helpers/null/index.es.js +1 -4
- package/dist/node_modules/axios/lib/helpers/parseHeaders/index.es.js +1 -47
- package/dist/node_modules/axios/lib/helpers/parseProtocol/index.es.js +1 -7
- package/dist/node_modules/axios/lib/helpers/progressEventReducer/index.es.js +1 -41
- package/dist/node_modules/axios/lib/helpers/resolveConfig/index.es.js +1 -46
- package/dist/node_modules/axios/lib/helpers/speedometer/index.es.js +1 -36
- package/dist/node_modules/axios/lib/helpers/spread/index.es.js +1 -8
- package/dist/node_modules/axios/lib/helpers/throttle/index.es.js +1 -35
- package/dist/node_modules/axios/lib/helpers/toFormData/index.es.js +1 -117
- package/dist/node_modules/axios/lib/helpers/toURLEncodedForm/index.es.js +1 -18
- package/dist/node_modules/axios/lib/helpers/trackStream/index.es.js +1 -80
- package/dist/node_modules/axios/lib/helpers/validator/index.es.js +1 -67
- package/dist/node_modules/axios/lib/platform/browser/classes/Blob/index.es.js +1 -4
- package/dist/node_modules/axios/lib/platform/browser/classes/FormData/index.es.js +1 -4
- package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams/index.es.js +1 -5
- package/dist/node_modules/axios/lib/platform/browser/index/index.es.js +1 -15
- package/dist/node_modules/axios/lib/platform/common/utils/index.es.js +1 -15
- package/dist/node_modules/axios/lib/platform/index/index.es.js +1 -9
- package/dist/node_modules/axios/lib/utils/index.es.js +1 -387
- package/dist/packages/com/dist/cache/index.es/index.es.js +1 -145
- package/dist/packages/com/dist/core/index.es/index.es.js +1 -154
- package/dist/packages/com/dist/data/index.es/index.es.js +1 -26
- package/dist/packages/com/dist/date/index.es/index.es.js +2 -194
- package/dist/packages/com/dist/log/index.es/index.es.js +1 -110
- package/dist/packages/com/dist/message/index.es/index.es.js +1 -90
- package/dist/packages/com/dist/req/index.es/index.es.js +1 -35
- package/dist/packages/com/dist/str/index.es/index.es.js +1 -25
- package/dist/packages/com/dist/typetool/index.es/index.es.js +1 -53
- package/dist/packages/com/dist/url/index.es/index.es.js +1 -238
- package/dist/restool/index/index.es.js +1 -266
- package/dist/restool/index.css/index.es.js +1 -4
- package/package.json +5 -1
|
@@ -1,47 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
const ignoreDuplicateOf = utils.toObjectSet([
|
|
3
|
-
"age",
|
|
4
|
-
"authorization",
|
|
5
|
-
"content-length",
|
|
6
|
-
"content-type",
|
|
7
|
-
"etag",
|
|
8
|
-
"expires",
|
|
9
|
-
"from",
|
|
10
|
-
"host",
|
|
11
|
-
"if-modified-since",
|
|
12
|
-
"if-unmodified-since",
|
|
13
|
-
"last-modified",
|
|
14
|
-
"location",
|
|
15
|
-
"max-forwards",
|
|
16
|
-
"proxy-authorization",
|
|
17
|
-
"referer",
|
|
18
|
-
"retry-after",
|
|
19
|
-
"user-agent"
|
|
20
|
-
]);
|
|
21
|
-
const parseHeaders = (rawHeaders) => {
|
|
22
|
-
const parsed = {};
|
|
23
|
-
let key;
|
|
24
|
-
let val;
|
|
25
|
-
let i;
|
|
26
|
-
rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
|
|
27
|
-
i = line.indexOf(":");
|
|
28
|
-
key = line.substring(0, i).trim().toLowerCase();
|
|
29
|
-
val = line.substring(i + 1).trim();
|
|
30
|
-
if (!key || parsed[key] && ignoreDuplicateOf[key]) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
if (key === "set-cookie") {
|
|
34
|
-
if (parsed[key]) {
|
|
35
|
-
parsed[key].push(val);
|
|
36
|
-
} else {
|
|
37
|
-
parsed[key] = [val];
|
|
38
|
-
}
|
|
39
|
-
} else {
|
|
40
|
-
parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
return parsed;
|
|
44
|
-
};
|
|
45
|
-
export {
|
|
46
|
-
parseHeaders as default
|
|
47
|
-
};
|
|
1
|
+
import t from"../../utils/index.es.js";const e=t.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),i=t=>{const i={};let o,r,n;return t&&t.split("\n").forEach(function(t){n=t.indexOf(":"),o=t.substring(0,n).trim().toLowerCase(),r=t.substring(n+1).trim(),!o||i[o]&&e[o]||("set-cookie"===o?i[o]?i[o].push(r):i[o]=[r]:i[o]=i[o]?i[o]+", "+r:r)}),i};export{i as default};
|
|
@@ -1,41 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import throttle from "../throttle/index.es.js";
|
|
3
|
-
import utils from "../../utils/index.es.js";
|
|
4
|
-
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
5
|
-
let bytesNotified = 0;
|
|
6
|
-
const _speedometer = speedometer(50, 250);
|
|
7
|
-
return throttle((e) => {
|
|
8
|
-
const loaded = e.loaded;
|
|
9
|
-
const total = e.lengthComputable ? e.total : void 0;
|
|
10
|
-
const progressBytes = loaded - bytesNotified;
|
|
11
|
-
const rate = _speedometer(progressBytes);
|
|
12
|
-
const inRange = loaded <= total;
|
|
13
|
-
bytesNotified = loaded;
|
|
14
|
-
const data = {
|
|
15
|
-
loaded,
|
|
16
|
-
total,
|
|
17
|
-
progress: total ? loaded / total : void 0,
|
|
18
|
-
bytes: progressBytes,
|
|
19
|
-
rate: rate ? rate : void 0,
|
|
20
|
-
estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
|
|
21
|
-
event: e,
|
|
22
|
-
lengthComputable: total != null,
|
|
23
|
-
[isDownloadStream ? "download" : "upload"]: true
|
|
24
|
-
};
|
|
25
|
-
listener(data);
|
|
26
|
-
}, freq);
|
|
27
|
-
};
|
|
28
|
-
const progressEventDecorator = (total, throttled) => {
|
|
29
|
-
const lengthComputable = total != null;
|
|
30
|
-
return [(loaded) => throttled[0]({
|
|
31
|
-
lengthComputable,
|
|
32
|
-
total,
|
|
33
|
-
loaded
|
|
34
|
-
}), throttled[1]];
|
|
35
|
-
};
|
|
36
|
-
const asyncDecorator = (fn) => (...args) => utils.asap(() => fn(...args));
|
|
37
|
-
export {
|
|
38
|
-
asyncDecorator,
|
|
39
|
-
progressEventDecorator,
|
|
40
|
-
progressEventReducer
|
|
41
|
-
};
|
|
1
|
+
import t from"../speedometer/index.es.js";import e from"../throttle/index.es.js";import o from"../../utils/index.es.js";const l=(o,l,d=3)=>{let s=0;const n=t(50,250);return e(t=>{const e=t.loaded,d=t.lengthComputable?t.total:void 0,r=e-s,a=n(r);s=e;o({loaded:e,total:d,progress:d?e/d:void 0,bytes:r,rate:a||void 0,estimated:a&&d&&e<=d?(d-e)/a:void 0,event:t,lengthComputable:null!=d,[l?"download":"upload"]:!0})},d)},d=(t,e)=>{const o=null!=t;return[l=>e[0]({lengthComputable:o,total:t,loaded:l}),e[1]]},s=t=>(...e)=>o.asap(()=>t(...e));export{s as asyncDecorator,d as progressEventDecorator,l as progressEventReducer};
|
|
@@ -1,46 +1 @@
|
|
|
1
|
-
import platform from "../../
|
|
2
|
-
import utils from "../../utils/index.es.js";
|
|
3
|
-
import isURLSameOrigin from "../isURLSameOrigin/index.es.js";
|
|
4
|
-
import cookies from "../cookies/index.es.js";
|
|
5
|
-
import buildFullPath from "../../core/buildFullPath/index.es.js";
|
|
6
|
-
import mergeConfig from "../../core/mergeConfig/index.es.js";
|
|
7
|
-
import AxiosHeaders from "../../core/AxiosHeaders/index.es.js";
|
|
8
|
-
import buildURL from "../buildURL/index.es.js";
|
|
9
|
-
const resolveConfig = (config) => {
|
|
10
|
-
const newConfig = mergeConfig({}, config);
|
|
11
|
-
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
12
|
-
newConfig.headers = headers = AxiosHeaders.from(headers);
|
|
13
|
-
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
|
|
14
|
-
if (auth) {
|
|
15
|
-
headers.set(
|
|
16
|
-
"Authorization",
|
|
17
|
-
"Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
if (utils.isFormData(data)) {
|
|
21
|
-
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
22
|
-
headers.setContentType(void 0);
|
|
23
|
-
} else if (utils.isFunction(data.getHeaders)) {
|
|
24
|
-
const formHeaders = data.getHeaders();
|
|
25
|
-
const allowedHeaders = ["content-type", "content-length"];
|
|
26
|
-
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
27
|
-
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
28
|
-
headers.set(key, val);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
if (platform.hasStandardBrowserEnv) {
|
|
34
|
-
withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
|
|
35
|
-
if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
|
|
36
|
-
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
37
|
-
if (xsrfValue) {
|
|
38
|
-
headers.set(xsrfHeaderName, xsrfValue);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return newConfig;
|
|
43
|
-
};
|
|
44
|
-
export {
|
|
45
|
-
resolveConfig as default
|
|
46
|
-
};
|
|
1
|
+
import e from"../../platform/index/index.es.js";import r from"../../utils/index.es.js";import s from"../isURLSameOrigin/index.es.js";import o from"../cookies/index.es.js";import t from"../../core/buildFullPath/index.es.js";import i from"../../core/mergeConfig/index.es.js";import a from"../../core/AxiosHeaders/index.es.js";import n from"../buildURL/index.es.js";const d=d=>{const m=i({},d);let{data:f,withXSRFToken:l,xsrfHeaderName:c,xsrfCookieName:p,headers:u,auth:x}=m;if(m.headers=u=a.from(u),m.url=n(t(m.baseURL,m.url,m.allowAbsoluteUrls),d.params,d.paramsSerializer),x&&u.set("Authorization","Basic "+btoa((x.username||"")+":"+(x.password?unescape(encodeURIComponent(x.password)):""))),r.isFormData(f))if(e.hasStandardBrowserEnv||e.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if(r.isFunction(f.getHeaders)){const e=f.getHeaders(),r=["content-type","content-length"];Object.entries(e).forEach(([e,s])=>{r.includes(e.toLowerCase())&&u.set(e,s)})}if(e.hasStandardBrowserEnv&&(l&&r.isFunction(l)&&(l=l(m)),l||!1!==l&&s(m.url))){const e=c&&p&&o.read(p);e&&u.set(c,e)}return m};export{d as default};
|
|
@@ -1,36 +1 @@
|
|
|
1
|
-
function
|
|
2
|
-
samplesCount = samplesCount || 10;
|
|
3
|
-
const bytes = new Array(samplesCount);
|
|
4
|
-
const timestamps = new Array(samplesCount);
|
|
5
|
-
let head = 0;
|
|
6
|
-
let tail = 0;
|
|
7
|
-
let firstSampleTS;
|
|
8
|
-
min = min !== void 0 ? min : 1e3;
|
|
9
|
-
return function push(chunkLength) {
|
|
10
|
-
const now = Date.now();
|
|
11
|
-
const startedAt = timestamps[tail];
|
|
12
|
-
if (!firstSampleTS) {
|
|
13
|
-
firstSampleTS = now;
|
|
14
|
-
}
|
|
15
|
-
bytes[head] = chunkLength;
|
|
16
|
-
timestamps[head] = now;
|
|
17
|
-
let i = tail;
|
|
18
|
-
let bytesCount = 0;
|
|
19
|
-
while (i !== head) {
|
|
20
|
-
bytesCount += bytes[i++];
|
|
21
|
-
i = i % samplesCount;
|
|
22
|
-
}
|
|
23
|
-
head = (head + 1) % samplesCount;
|
|
24
|
-
if (head === tail) {
|
|
25
|
-
tail = (tail + 1) % samplesCount;
|
|
26
|
-
}
|
|
27
|
-
if (now - firstSampleTS < min) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const passed = startedAt && now - startedAt;
|
|
31
|
-
return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
export {
|
|
35
|
-
speedometer as default
|
|
36
|
-
};
|
|
1
|
+
function n(n,t){n=n||10;const r=new Array(n),e=new Array(n);let o,u=0,a=0;return t=void 0!==t?t:1e3,function(c){const f=Date.now(),i=e[a];o||(o=f),r[u]=c,e[u]=f;let d=a,s=0;for(;d!==u;)s+=r[d++],d%=n;if(u=(u+1)%n,u===a&&(a=(a+1)%n),f-o<t)return;const l=i&&f-i;return l?Math.round(1e3*s/l):void 0}}export{n as default};
|
|
@@ -1,35 +1 @@
|
|
|
1
|
-
function
|
|
2
|
-
let timestamp = 0;
|
|
3
|
-
let threshold = 1e3 / freq;
|
|
4
|
-
let lastArgs;
|
|
5
|
-
let timer;
|
|
6
|
-
const invoke = (args, now = Date.now()) => {
|
|
7
|
-
timestamp = now;
|
|
8
|
-
lastArgs = null;
|
|
9
|
-
if (timer) {
|
|
10
|
-
clearTimeout(timer);
|
|
11
|
-
timer = null;
|
|
12
|
-
}
|
|
13
|
-
fn(...args);
|
|
14
|
-
};
|
|
15
|
-
const throttled = (...args) => {
|
|
16
|
-
const now = Date.now();
|
|
17
|
-
const passed = now - timestamp;
|
|
18
|
-
if (passed >= threshold) {
|
|
19
|
-
invoke(args, now);
|
|
20
|
-
} else {
|
|
21
|
-
lastArgs = args;
|
|
22
|
-
if (!timer) {
|
|
23
|
-
timer = setTimeout(() => {
|
|
24
|
-
timer = null;
|
|
25
|
-
invoke(lastArgs);
|
|
26
|
-
}, threshold - passed);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
const flush = () => lastArgs && invoke(lastArgs);
|
|
31
|
-
return [throttled, flush];
|
|
32
|
-
}
|
|
33
|
-
export {
|
|
34
|
-
throttle as default
|
|
35
|
-
};
|
|
1
|
+
function t(t,e){let n,l,o=0,u=1e3/e;const a=(e,u=Date.now())=>{o=u,n=null,l&&(clearTimeout(l),l=null),t(...e)};return[(...t)=>{const e=Date.now(),c=e-o;c>=u?a(t,e):(n=t,l||(l=setTimeout(()=>{l=null,a(n)},u-c)))},()=>n&&a(n)]}export{t as default};
|
|
@@ -1,117 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import AxiosError from "../../core/AxiosError/index.es.js";
|
|
3
|
-
function isVisitable(thing) {
|
|
4
|
-
return utils.isPlainObject(thing) || utils.isArray(thing);
|
|
5
|
-
}
|
|
6
|
-
function removeBrackets(key) {
|
|
7
|
-
return utils.endsWith(key, "[]") ? key.slice(0, -2) : key;
|
|
8
|
-
}
|
|
9
|
-
function renderKey(path, key, dots) {
|
|
10
|
-
if (!path) return key;
|
|
11
|
-
return path.concat(key).map(function each(token, i) {
|
|
12
|
-
token = removeBrackets(token);
|
|
13
|
-
return !dots && i ? "[" + token + "]" : token;
|
|
14
|
-
}).join(dots ? "." : "");
|
|
15
|
-
}
|
|
16
|
-
function isFlatArray(arr) {
|
|
17
|
-
return utils.isArray(arr) && !arr.some(isVisitable);
|
|
18
|
-
}
|
|
19
|
-
const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
|
|
20
|
-
return /^is[A-Z]/.test(prop);
|
|
21
|
-
});
|
|
22
|
-
function toFormData(obj, formData, options) {
|
|
23
|
-
if (!utils.isObject(obj)) {
|
|
24
|
-
throw new TypeError("target must be an object");
|
|
25
|
-
}
|
|
26
|
-
formData = formData || new FormData();
|
|
27
|
-
options = utils.toFlatObject(options, {
|
|
28
|
-
metaTokens: true,
|
|
29
|
-
dots: false,
|
|
30
|
-
indexes: false
|
|
31
|
-
}, false, function defined(option, source) {
|
|
32
|
-
return !utils.isUndefined(source[option]);
|
|
33
|
-
});
|
|
34
|
-
const metaTokens = options.metaTokens;
|
|
35
|
-
const visitor = options.visitor || defaultVisitor;
|
|
36
|
-
const dots = options.dots;
|
|
37
|
-
const indexes = options.indexes;
|
|
38
|
-
const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
|
|
39
|
-
const useBlob = _Blob && utils.isSpecCompliantForm(formData);
|
|
40
|
-
if (!utils.isFunction(visitor)) {
|
|
41
|
-
throw new TypeError("visitor must be a function");
|
|
42
|
-
}
|
|
43
|
-
function convertValue(value) {
|
|
44
|
-
if (value === null) return "";
|
|
45
|
-
if (utils.isDate(value)) {
|
|
46
|
-
return value.toISOString();
|
|
47
|
-
}
|
|
48
|
-
if (utils.isBoolean(value)) {
|
|
49
|
-
return value.toString();
|
|
50
|
-
}
|
|
51
|
-
if (!useBlob && utils.isBlob(value)) {
|
|
52
|
-
throw new AxiosError("Blob is not supported. Use a Buffer instead.");
|
|
53
|
-
}
|
|
54
|
-
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
|
|
55
|
-
return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
|
|
56
|
-
}
|
|
57
|
-
return value;
|
|
58
|
-
}
|
|
59
|
-
function defaultVisitor(value, key, path) {
|
|
60
|
-
let arr = value;
|
|
61
|
-
if (value && !path && typeof value === "object") {
|
|
62
|
-
if (utils.endsWith(key, "{}")) {
|
|
63
|
-
key = metaTokens ? key : key.slice(0, -2);
|
|
64
|
-
value = JSON.stringify(value);
|
|
65
|
-
} else if (utils.isArray(value) && isFlatArray(value) || (utils.isFileList(value) || utils.endsWith(key, "[]")) && (arr = utils.toArray(value))) {
|
|
66
|
-
key = removeBrackets(key);
|
|
67
|
-
arr.forEach(function each(el, index) {
|
|
68
|
-
!(utils.isUndefined(el) || el === null) && formData.append(
|
|
69
|
-
// eslint-disable-next-line no-nested-ternary
|
|
70
|
-
indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
|
|
71
|
-
convertValue(el)
|
|
72
|
-
);
|
|
73
|
-
});
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
if (isVisitable(value)) {
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
const stack = [];
|
|
84
|
-
const exposedHelpers = Object.assign(predicates, {
|
|
85
|
-
defaultVisitor,
|
|
86
|
-
convertValue,
|
|
87
|
-
isVisitable
|
|
88
|
-
});
|
|
89
|
-
function build(value, path) {
|
|
90
|
-
if (utils.isUndefined(value)) return;
|
|
91
|
-
if (stack.indexOf(value) !== -1) {
|
|
92
|
-
throw Error("Circular reference detected in " + path.join("."));
|
|
93
|
-
}
|
|
94
|
-
stack.push(value);
|
|
95
|
-
utils.forEach(value, function each(el, key) {
|
|
96
|
-
const result = !(utils.isUndefined(el) || el === null) && visitor.call(
|
|
97
|
-
formData,
|
|
98
|
-
el,
|
|
99
|
-
utils.isString(key) ? key.trim() : key,
|
|
100
|
-
path,
|
|
101
|
-
exposedHelpers
|
|
102
|
-
);
|
|
103
|
-
if (result === true) {
|
|
104
|
-
build(el, path ? path.concat(key) : [key]);
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
stack.pop();
|
|
108
|
-
}
|
|
109
|
-
if (!utils.isObject(obj)) {
|
|
110
|
-
throw new TypeError("data must be an object");
|
|
111
|
-
}
|
|
112
|
-
build(obj);
|
|
113
|
-
return formData;
|
|
114
|
-
}
|
|
115
|
-
export {
|
|
116
|
-
toFormData as default
|
|
117
|
-
};
|
|
1
|
+
import n from"../../utils/index.es.js";import t from"../../core/AxiosError/index.es.js";function e(t){return n.isPlainObject(t)||n.isArray(t)}function i(t){return n.endsWith(t,"[]")?t.slice(0,-2):t}function r(n,t,e){return n?n.concat(t).map(function(n,t){return n=i(n),!e&&t?"["+n+"]":n}).join(e?".":""):t}const o=n.toFlatObject(n,{},null,function(n){return/^is[A-Z]/.test(n)});function s(s,f,u){if(!n.isObject(s))throw new TypeError("target must be an object");f=f||new FormData;const c=(u=n.toFlatObject(u,{metaTokens:!0,dots:!1,indexes:!1},!1,function(t,e){return!n.isUndefined(e[t])})).metaTokens,a=u.visitor||m,l=u.dots,d=u.indexes,p=(u.Blob||"undefined"!=typeof Blob&&Blob)&&n.isSpecCompliantForm(f);if(!n.isFunction(a))throw new TypeError("visitor must be a function");function b(e){if(null===e)return"";if(n.isDate(e))return e.toISOString();if(n.isBoolean(e))return e.toString();if(!p&&n.isBlob(e))throw new t("Blob is not supported. Use a Buffer instead.");return n.isArrayBuffer(e)||n.isTypedArray(e)?p&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function m(t,o,s){let u=t;if(t&&!s&&"object"==typeof t)if(n.endsWith(o,"{}"))o=c?o:o.slice(0,-2),t=JSON.stringify(t);else if(n.isArray(t)&&function(t){return n.isArray(t)&&!t.some(e)}(t)||(n.isFileList(t)||n.endsWith(o,"[]"))&&(u=n.toArray(t)))return o=i(o),u.forEach(function(t,e){!n.isUndefined(t)&&null!==t&&f.append(!0===d?r([o],e,l):null===d?o:o+"[]",b(t))}),!1;return!!e(t)||(f.append(r(s,o,l),b(t)),!1)}const y=[],j=Object.assign(o,{defaultVisitor:m,convertValue:b,isVisitable:e});if(!n.isObject(s))throw new TypeError("data must be an object");return function t(e,i){if(!n.isUndefined(e)){if(-1!==y.indexOf(e))throw Error("Circular reference detected in "+i.join("."));y.push(e),n.forEach(e,function(e,r){!0===(!(n.isUndefined(e)||null===e)&&a.call(f,e,n.isString(r)?r.trim():r,i,j))&&t(e,i?i.concat(r):[r])}),y.pop()}}(s),f}export{s as default};
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
import utils from "../../
|
|
2
|
-
import toFormData from "../toFormData/index.es.js";
|
|
3
|
-
import platform from "../../platform/index/index.es.js";
|
|
4
|
-
function toURLEncodedForm(data, options) {
|
|
5
|
-
return toFormData(data, new platform.classes.URLSearchParams(), {
|
|
6
|
-
visitor: function(value, key, path, helpers) {
|
|
7
|
-
if (platform.isNode && utils.isBuffer(value)) {
|
|
8
|
-
this.append(key, value.toString("base64"));
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
return helpers.defaultVisitor.apply(this, arguments);
|
|
12
|
-
},
|
|
13
|
-
...options
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
toURLEncodedForm as default
|
|
18
|
-
};
|
|
1
|
+
import t from"../../utils/index.es.js";import e from"../toFormData/index.es.js";import i from"../../platform/index/index.es.js";function r(r,s){return e(r,new i.classes.URLSearchParams,{visitor:function(e,r,s,o){return i.isNode&&t.isBuffer(e)?(this.append(r,e.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...s})}export{r as default};
|
|
@@ -1,80 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
let len = chunk.byteLength;
|
|
3
|
-
if (len < chunkSize) {
|
|
4
|
-
yield chunk;
|
|
5
|
-
return;
|
|
6
|
-
}
|
|
7
|
-
let pos = 0;
|
|
8
|
-
let end;
|
|
9
|
-
while (pos < len) {
|
|
10
|
-
end = pos + chunkSize;
|
|
11
|
-
yield chunk.slice(pos, end);
|
|
12
|
-
pos = end;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
const readBytes = async function* (iterable, chunkSize) {
|
|
16
|
-
for await (const chunk of readStream(iterable)) {
|
|
17
|
-
yield* streamChunk(chunk, chunkSize);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
const readStream = async function* (stream) {
|
|
21
|
-
if (stream[Symbol.asyncIterator]) {
|
|
22
|
-
yield* stream;
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const reader = stream.getReader();
|
|
26
|
-
try {
|
|
27
|
-
for (; ; ) {
|
|
28
|
-
const { done, value } = await reader.read();
|
|
29
|
-
if (done) {
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
yield value;
|
|
33
|
-
}
|
|
34
|
-
} finally {
|
|
35
|
-
await reader.cancel();
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
39
|
-
const iterator = readBytes(stream, chunkSize);
|
|
40
|
-
let bytes = 0;
|
|
41
|
-
let done;
|
|
42
|
-
let _onFinish = (e) => {
|
|
43
|
-
if (!done) {
|
|
44
|
-
done = true;
|
|
45
|
-
onFinish && onFinish(e);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
return new ReadableStream({
|
|
49
|
-
async pull(controller) {
|
|
50
|
-
try {
|
|
51
|
-
const { done: done2, value } = await iterator.next();
|
|
52
|
-
if (done2) {
|
|
53
|
-
_onFinish();
|
|
54
|
-
controller.close();
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
let len = value.byteLength;
|
|
58
|
-
if (onProgress) {
|
|
59
|
-
let loadedBytes = bytes += len;
|
|
60
|
-
onProgress(loadedBytes);
|
|
61
|
-
}
|
|
62
|
-
controller.enqueue(new Uint8Array(value));
|
|
63
|
-
} catch (err) {
|
|
64
|
-
_onFinish(err);
|
|
65
|
-
throw err;
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
cancel(reason) {
|
|
69
|
-
_onFinish(reason);
|
|
70
|
-
return iterator.return();
|
|
71
|
-
}
|
|
72
|
-
}, {
|
|
73
|
-
highWaterMark: 2
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
export {
|
|
77
|
-
readBytes,
|
|
78
|
-
streamChunk,
|
|
79
|
-
trackStream
|
|
80
|
-
};
|
|
1
|
+
const e=function*(e,t){let n=e.byteLength;if(n<t)return void(yield e);let a,r=0;for(;r<n;)a=r+t,yield e.slice(r,a),r=a},t=async function*(t,a){for await(const r of n(t))yield*e(r,a)},n=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},a=(e,n,a,r)=>{const i=t(e,n);let o,l=0,c=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await i.next();if(t)return c(),void e.close();let r=n.byteLength;if(a){let e=l+=r;a(e)}e.enqueue(new Uint8Array(n))}catch(t){throw c(t),t}},cancel:e=>(c(e),i.return())},{highWaterMark:2})};export{t as readBytes,e as streamChunk,a as trackStream};
|
|
@@ -1,67 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import AxiosError from "../../core/AxiosError/index.es.js";
|
|
3
|
-
const validators = {};
|
|
4
|
-
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
|
|
5
|
-
validators[type] = function validator2(thing) {
|
|
6
|
-
return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
|
|
7
|
-
};
|
|
8
|
-
});
|
|
9
|
-
const deprecatedWarnings = {};
|
|
10
|
-
validators.transitional = function transitional(validator2, version, message) {
|
|
11
|
-
function formatMessage(opt, desc) {
|
|
12
|
-
return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
|
|
13
|
-
}
|
|
14
|
-
return (value, opt, opts) => {
|
|
15
|
-
if (validator2 === false) {
|
|
16
|
-
throw new AxiosError(
|
|
17
|
-
formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
|
|
18
|
-
AxiosError.ERR_DEPRECATED
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
if (version && !deprecatedWarnings[opt]) {
|
|
22
|
-
deprecatedWarnings[opt] = true;
|
|
23
|
-
console.warn(
|
|
24
|
-
formatMessage(
|
|
25
|
-
opt,
|
|
26
|
-
" has been deprecated since v" + version + " and will be removed in the near future"
|
|
27
|
-
)
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
return validator2 ? validator2(value, opt, opts) : true;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
validators.spelling = function spelling(correctSpelling) {
|
|
34
|
-
return (value, opt) => {
|
|
35
|
-
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
36
|
-
return true;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
function assertOptions(options, schema, allowUnknown) {
|
|
40
|
-
if (typeof options !== "object") {
|
|
41
|
-
throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
|
|
42
|
-
}
|
|
43
|
-
const keys = Object.keys(options);
|
|
44
|
-
let i = keys.length;
|
|
45
|
-
while (i-- > 0) {
|
|
46
|
-
const opt = keys[i];
|
|
47
|
-
const validator2 = schema[opt];
|
|
48
|
-
if (validator2) {
|
|
49
|
-
const value = options[opt];
|
|
50
|
-
const result = value === void 0 || validator2(value, opt, options);
|
|
51
|
-
if (result !== true) {
|
|
52
|
-
throw new AxiosError("option " + opt + " must be " + result, AxiosError.ERR_BAD_OPTION_VALUE);
|
|
53
|
-
}
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
if (allowUnknown !== true) {
|
|
57
|
-
throw new AxiosError("Unknown option " + opt, AxiosError.ERR_BAD_OPTION);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
const validator = {
|
|
62
|
-
assertOptions,
|
|
63
|
-
validators
|
|
64
|
-
};
|
|
65
|
-
export {
|
|
66
|
-
validator as default
|
|
67
|
-
};
|
|
1
|
+
import{VERSION as n}from"../../env/data/index.es.js";import o from"../../core/AxiosError/index.es.js";const e={};["object","boolean","number","function","string","symbol"].forEach((n,o)=>{e[n]=function(e){return typeof e===n||"a"+(o<1?"n ":" ")+n}});const t={};e.transitional=function(e,i,r){function s(o,e){return"[Axios v"+n+"] Transitional option '"+o+"'"+e+(r?". "+r:"")}return(n,r,a)=>{if(!1===e)throw new o(s(r," has been removed"+(i?" in "+i:"")),o.ERR_DEPRECATED);return i&&!t[r]&&(t[r]=!0,console.warn(s(r," has been deprecated since v"+i+" and will be removed in the near future"))),!e||e(n,r,a)}},e.spelling=function(n){return(o,e)=>(console.warn(`${e} is likely a misspelling of ${n}`),!0)};const i={assertOptions:function(n,e,t){if("object"!=typeof n)throw new o("options must be an object",o.ERR_BAD_OPTION_VALUE);const i=Object.keys(n);let r=i.length;for(;r-- >0;){const s=i[r],a=e[s];if(a){const e=n[s],t=void 0===e||a(e,s,n);if(!0!==t)throw new o("option "+s+" must be "+t,o.ERR_BAD_OPTION_VALUE);continue}if(!0!==t)throw new o("Unknown option "+s,o.ERR_BAD_OPTION)}},validators:e};export{i as default};
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
|
|
3
|
-
export {
|
|
4
|
-
URLSearchParams$1 as default
|
|
5
|
-
};
|
|
1
|
+
import e from"../../../../helpers/AxiosURLSearchParams/index.es.js";const a="undefined"!=typeof URLSearchParams?URLSearchParams:e;export{a as default};
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
import URLSearchParams from "../classes/
|
|
2
|
-
import FormData from "../classes/FormData/index.es.js";
|
|
3
|
-
import Blob from "../classes/Blob/index.es.js";
|
|
4
|
-
const platform = {
|
|
5
|
-
isBrowser: true,
|
|
6
|
-
classes: {
|
|
7
|
-
URLSearchParams,
|
|
8
|
-
FormData,
|
|
9
|
-
Blob
|
|
10
|
-
},
|
|
11
|
-
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
12
|
-
};
|
|
13
|
-
export {
|
|
14
|
-
platform as default
|
|
15
|
-
};
|
|
1
|
+
import s from"../classes/URLSearchParams/index.es.js";import a from"../classes/FormData/index.es.js";import o from"../classes/Blob/index.es.js";const r={isBrowser:!0,classes:{URLSearchParams:s,FormData:a,Blob:o},protocols:["http","https","file","blob","url","data"]};export{r as default};
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const _navigator = typeof navigator === "object" && navigator || void 0;
|
|
3
|
-
const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
|
|
4
|
-
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
5
|
-
return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
|
|
6
|
-
self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
|
|
7
|
-
})();
|
|
8
|
-
const origin = hasBrowserEnv && window.location.href || "http://localhost";
|
|
9
|
-
export {
|
|
10
|
-
hasBrowserEnv,
|
|
11
|
-
hasStandardBrowserEnv,
|
|
12
|
-
hasStandardBrowserWebWorkerEnv,
|
|
13
|
-
_navigator as navigator,
|
|
14
|
-
origin
|
|
15
|
-
};
|
|
1
|
+
const o="undefined"!=typeof window&&"undefined"!=typeof document,e="object"==typeof navigator&&navigator||void 0,t=o&&(!e||["ReactNative","NativeScript","NS"].indexOf(e.product)<0),n="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,i=o&&window.location.href||"http://localhost";export{o as hasBrowserEnv,t as hasStandardBrowserEnv,n as hasStandardBrowserWebWorkerEnv,e as navigator,i as origin};
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as utils from "../common/utils/index.es.js";
|
|
3
|
-
const platform = {
|
|
4
|
-
...utils,
|
|
5
|
-
...platform$1
|
|
6
|
-
};
|
|
7
|
-
export {
|
|
8
|
-
platform as default
|
|
9
|
-
};
|
|
1
|
+
import o from"../browser/index/index.es.js";import*as s from"../common/utils/index.es.js";const e={...s,...o};export{e as default};
|