hanbiro-react16-sdk 1.0.20 → 1.0.21
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/components/ChatAIDraft/SettingPopper.js +5 -5
- package/dist/components/CountryFlag/flags/KRFlag.js +1 -1
- package/dist/hanbiro-react16-sdk.style.css +1 -1
- package/dist/hanbiro-react16-sdk.umd.js +2 -2
- package/dist/index.js +1 -1
- package/dist/utils/api.d.ts +9 -0
- package/dist/utils/api.js +55 -0
- package/package.json +1 -2
- package/dist/node_modules/axios/index.js +0 -38
- package/dist/node_modules/axios/lib/adapters/adapters.js +0 -71
- package/dist/node_modules/axios/lib/adapters/fetch.js +0 -272
- package/dist/node_modules/axios/lib/adapters/xhr.js +0 -153
- package/dist/node_modules/axios/lib/axios.js +0 -50
- package/dist/node_modules/axios/lib/cancel/CancelToken.js +0 -99
- package/dist/node_modules/axios/lib/cancel/CanceledError.js +0 -20
- package/dist/node_modules/axios/lib/cancel/isCancel.js +0 -6
- package/dist/node_modules/axios/lib/core/Axios.js +0 -220
- package/dist/node_modules/axios/lib/core/AxiosError.js +0 -76
- package/dist/node_modules/axios/lib/core/AxiosHeaders.js +0 -238
- package/dist/node_modules/axios/lib/core/InterceptorManager.js +0 -66
- package/dist/node_modules/axios/lib/core/buildFullPath.js +0 -12
- package/dist/node_modules/axios/lib/core/dispatchRequest.js +0 -48
- package/dist/node_modules/axios/lib/core/mergeConfig.js +0 -100
- package/dist/node_modules/axios/lib/core/settle.js +0 -20
- package/dist/node_modules/axios/lib/core/transformData.js +0 -17
- package/dist/node_modules/axios/lib/defaults/index.js +0 -120
- package/dist/node_modules/axios/lib/defaults/transitional.js +0 -9
- package/dist/node_modules/axios/lib/env/data.js +0 -4
- package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +0 -34
- package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js +0 -77
- package/dist/node_modules/axios/lib/helpers/bind.js +0 -8
- package/dist/node_modules/axios/lib/helpers/buildURL.js +0 -32
- package/dist/node_modules/axios/lib/helpers/combineURLs.js +0 -6
- package/dist/node_modules/axios/lib/helpers/composeSignals.js +0 -41
- package/dist/node_modules/axios/lib/helpers/cookies.js +0 -49
- package/dist/node_modules/axios/lib/helpers/formDataToJSON.js +0 -54
- package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -9
- package/dist/node_modules/axios/lib/helpers/isAxiosError.js +0 -7
- package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -11
- package/dist/node_modules/axios/lib/helpers/null.js +0 -4
- package/dist/node_modules/axios/lib/helpers/parseHeaders.js +0 -47
- package/dist/node_modules/axios/lib/helpers/parseProtocol.js +0 -7
- package/dist/node_modules/axios/lib/helpers/progressEventReducer.js +0 -44
- package/dist/node_modules/axios/lib/helpers/resolveConfig.js +0 -52
- package/dist/node_modules/axios/lib/helpers/speedometer.js +0 -36
- package/dist/node_modules/axios/lib/helpers/spread.js +0 -8
- package/dist/node_modules/axios/lib/helpers/throttle.js +0 -35
- package/dist/node_modules/axios/lib/helpers/toFormData.js +0 -120
- package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js +0 -33
- package/dist/node_modules/axios/lib/helpers/trackStream.js +0 -169
- package/dist/node_modules/axios/lib/helpers/validator.js +0 -70
- package/dist/node_modules/axios/lib/platform/browser/classes/Blob.js +0 -4
- package/dist/node_modules/axios/lib/platform/browser/classes/FormData.js +0 -4
- package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +0 -5
- package/dist/node_modules/axios/lib/platform/browser/index.js +0 -15
- package/dist/node_modules/axios/lib/platform/common/utils.js +0 -15
- package/dist/node_modules/axios/lib/platform/index.js +0 -22
- package/dist/node_modules/axios/lib/utils.js +0 -429
- package/dist/utils/axiosAPI.d.ts +0 -1
- package/dist/utils/axiosAPI.js +0 -89
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import utils from "../utils.js";
|
|
2
|
-
function parsePropPath(name) {
|
|
3
|
-
return utils.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
4
|
-
return match[0] === "[]" ? "" : match[1] || match[0];
|
|
5
|
-
});
|
|
6
|
-
}
|
|
7
|
-
function arrayToObject(arr) {
|
|
8
|
-
const obj = {};
|
|
9
|
-
const keys = Object.keys(arr);
|
|
10
|
-
let i;
|
|
11
|
-
const len = keys.length;
|
|
12
|
-
let key;
|
|
13
|
-
for (i = 0; i < len; i++) {
|
|
14
|
-
key = keys[i];
|
|
15
|
-
obj[key] = arr[key];
|
|
16
|
-
}
|
|
17
|
-
return obj;
|
|
18
|
-
}
|
|
19
|
-
function formDataToJSON(formData) {
|
|
20
|
-
function buildPath(path, value, target, index) {
|
|
21
|
-
let name = path[index++];
|
|
22
|
-
if (name === "__proto__") return true;
|
|
23
|
-
const isNumericKey = Number.isFinite(+name);
|
|
24
|
-
const isLast = index >= path.length;
|
|
25
|
-
name = !name && utils.isArray(target) ? target.length : name;
|
|
26
|
-
if (isLast) {
|
|
27
|
-
if (utils.hasOwnProp(target, name)) {
|
|
28
|
-
target[name] = [target[name], value];
|
|
29
|
-
} else {
|
|
30
|
-
target[name] = value;
|
|
31
|
-
}
|
|
32
|
-
return !isNumericKey;
|
|
33
|
-
}
|
|
34
|
-
if (!target[name] || !utils.isObject(target[name])) {
|
|
35
|
-
target[name] = [];
|
|
36
|
-
}
|
|
37
|
-
const result = buildPath(path, value, target[name], index);
|
|
38
|
-
if (result && utils.isArray(target[name])) {
|
|
39
|
-
target[name] = arrayToObject(target[name]);
|
|
40
|
-
}
|
|
41
|
-
return !isNumericKey;
|
|
42
|
-
}
|
|
43
|
-
if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
|
|
44
|
-
const obj = {};
|
|
45
|
-
utils.forEachEntry(formData, (name, value) => {
|
|
46
|
-
buildPath(parsePropPath(name), value, obj, 0);
|
|
47
|
-
});
|
|
48
|
-
return obj;
|
|
49
|
-
}
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
export {
|
|
53
|
-
formDataToJSON as default
|
|
54
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import platform from "../platform/index.js";
|
|
2
|
-
const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin, isMSIE) => (url) => {
|
|
3
|
-
url = new URL(url, platform.origin);
|
|
4
|
-
return origin.protocol === url.protocol && origin.host === url.host && (isMSIE || origin.port === url.port);
|
|
5
|
-
})(
|
|
6
|
-
new URL(platform.origin),
|
|
7
|
-
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
8
|
-
) : () => true;
|
|
9
|
-
export {
|
|
10
|
-
isURLSameOrigin as default
|
|
11
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import utils from "../utils.js";
|
|
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,44 +0,0 @@
|
|
|
1
|
-
import speedometer from "./speedometer.js";
|
|
2
|
-
import throttle from "./throttle.js";
|
|
3
|
-
import utils from "../utils.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 [
|
|
31
|
-
(loaded) => throttled[0]({
|
|
32
|
-
lengthComputable,
|
|
33
|
-
total,
|
|
34
|
-
loaded
|
|
35
|
-
}),
|
|
36
|
-
throttled[1]
|
|
37
|
-
];
|
|
38
|
-
};
|
|
39
|
-
const asyncDecorator = (fn) => (...args) => utils.asap(() => fn(...args));
|
|
40
|
-
export {
|
|
41
|
-
asyncDecorator,
|
|
42
|
-
progressEventDecorator,
|
|
43
|
-
progressEventReducer
|
|
44
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import platform from "../platform/index.js";
|
|
2
|
-
import utils from "../utils.js";
|
|
3
|
-
import isURLSameOrigin from "./isURLSameOrigin.js";
|
|
4
|
-
import cookies from "./cookies.js";
|
|
5
|
-
import buildFullPath from "../core/buildFullPath.js";
|
|
6
|
-
import mergeConfig from "../core/mergeConfig.js";
|
|
7
|
-
import AxiosHeaders from "../core/AxiosHeaders.js";
|
|
8
|
-
import buildURL from "./buildURL.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(
|
|
14
|
-
buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
|
|
15
|
-
config.params,
|
|
16
|
-
config.paramsSerializer
|
|
17
|
-
);
|
|
18
|
-
if (auth) {
|
|
19
|
-
headers.set(
|
|
20
|
-
"Authorization",
|
|
21
|
-
"Basic " + btoa(
|
|
22
|
-
(auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : "")
|
|
23
|
-
)
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
if (utils.isFormData(data)) {
|
|
27
|
-
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
28
|
-
headers.setContentType(void 0);
|
|
29
|
-
} else if (utils.isFunction(data.getHeaders)) {
|
|
30
|
-
const formHeaders = data.getHeaders();
|
|
31
|
-
const allowedHeaders = ["content-type", "content-length"];
|
|
32
|
-
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
33
|
-
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
34
|
-
headers.set(key, val);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
if (platform.hasStandardBrowserEnv) {
|
|
40
|
-
withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
|
|
41
|
-
if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
|
|
42
|
-
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
43
|
-
if (xsrfValue) {
|
|
44
|
-
headers.set(xsrfHeaderName, xsrfValue);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return newConfig;
|
|
49
|
-
};
|
|
50
|
-
export {
|
|
51
|
-
resolveConfig as default
|
|
52
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
function speedometer(samplesCount, min) {
|
|
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,35 +0,0 @@
|
|
|
1
|
-
function throttle(fn, freq) {
|
|
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,120 +0,0 @@
|
|
|
1
|
-
import utils from "../utils.js";
|
|
2
|
-
import AxiosError from "../core/AxiosError.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(
|
|
28
|
-
options,
|
|
29
|
-
{
|
|
30
|
-
metaTokens: true,
|
|
31
|
-
dots: false,
|
|
32
|
-
indexes: false
|
|
33
|
-
},
|
|
34
|
-
false,
|
|
35
|
-
function defined(option, source) {
|
|
36
|
-
return !utils.isUndefined(source[option]);
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
const metaTokens = options.metaTokens;
|
|
40
|
-
const visitor = options.visitor || defaultVisitor;
|
|
41
|
-
const dots = options.dots;
|
|
42
|
-
const indexes = options.indexes;
|
|
43
|
-
const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
|
|
44
|
-
const useBlob = _Blob && utils.isSpecCompliantForm(formData);
|
|
45
|
-
if (!utils.isFunction(visitor)) {
|
|
46
|
-
throw new TypeError("visitor must be a function");
|
|
47
|
-
}
|
|
48
|
-
function convertValue(value) {
|
|
49
|
-
if (value === null) return "";
|
|
50
|
-
if (utils.isDate(value)) {
|
|
51
|
-
return value.toISOString();
|
|
52
|
-
}
|
|
53
|
-
if (utils.isBoolean(value)) {
|
|
54
|
-
return value.toString();
|
|
55
|
-
}
|
|
56
|
-
if (!useBlob && utils.isBlob(value)) {
|
|
57
|
-
throw new AxiosError("Blob is not supported. Use a Buffer instead.");
|
|
58
|
-
}
|
|
59
|
-
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
|
|
60
|
-
return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
|
|
61
|
-
}
|
|
62
|
-
return value;
|
|
63
|
-
}
|
|
64
|
-
function defaultVisitor(value, key, path) {
|
|
65
|
-
let arr = value;
|
|
66
|
-
if (utils.isReactNative(formData) && utils.isReactNativeBlob(value)) {
|
|
67
|
-
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
if (value && !path && typeof value === "object") {
|
|
71
|
-
if (utils.endsWith(key, "{}")) {
|
|
72
|
-
key = metaTokens ? key : key.slice(0, -2);
|
|
73
|
-
value = JSON.stringify(value);
|
|
74
|
-
} else if (utils.isArray(value) && isFlatArray(value) || (utils.isFileList(value) || utils.endsWith(key, "[]")) && (arr = utils.toArray(value))) {
|
|
75
|
-
key = removeBrackets(key);
|
|
76
|
-
arr.forEach(function each(el, index) {
|
|
77
|
-
!(utils.isUndefined(el) || el === null) && formData.append(
|
|
78
|
-
// eslint-disable-next-line no-nested-ternary
|
|
79
|
-
indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
|
|
80
|
-
convertValue(el)
|
|
81
|
-
);
|
|
82
|
-
});
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (isVisitable(value)) {
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
const stack = [];
|
|
93
|
-
const exposedHelpers = Object.assign(predicates, {
|
|
94
|
-
defaultVisitor,
|
|
95
|
-
convertValue,
|
|
96
|
-
isVisitable
|
|
97
|
-
});
|
|
98
|
-
function build(value, path) {
|
|
99
|
-
if (utils.isUndefined(value)) return;
|
|
100
|
-
if (stack.indexOf(value) !== -1) {
|
|
101
|
-
throw Error("Circular reference detected in " + path.join("."));
|
|
102
|
-
}
|
|
103
|
-
stack.push(value);
|
|
104
|
-
utils.forEach(value, function each(el, key) {
|
|
105
|
-
const result = !(utils.isUndefined(el) || el === null) && visitor.call(formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
106
|
-
if (result === true) {
|
|
107
|
-
build(el, path ? path.concat(key) : [key]);
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
stack.pop();
|
|
111
|
-
}
|
|
112
|
-
if (!utils.isObject(obj)) {
|
|
113
|
-
throw new TypeError("data must be an object");
|
|
114
|
-
}
|
|
115
|
-
build(obj);
|
|
116
|
-
return formData;
|
|
117
|
-
}
|
|
118
|
-
export {
|
|
119
|
-
toFormData as default
|
|
120
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
|
-
import utils from "../utils.js";
|
|
18
|
-
import toFormData from "./toFormData.js";
|
|
19
|
-
import platform from "../platform/index.js";
|
|
20
|
-
function toURLEncodedForm(data, options) {
|
|
21
|
-
return toFormData(data, new platform.classes.URLSearchParams(), __spreadValues({
|
|
22
|
-
visitor: function(value, key, path, helpers) {
|
|
23
|
-
if (platform.isNode && utils.isBuffer(value)) {
|
|
24
|
-
this.append(key, value.toString("base64"));
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
return helpers.defaultVisitor.apply(this, arguments);
|
|
28
|
-
}
|
|
29
|
-
}, options));
|
|
30
|
-
}
|
|
31
|
-
export {
|
|
32
|
-
toURLEncodedForm as default
|
|
33
|
-
};
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
2
|
-
var __typeError = (msg) => {
|
|
3
|
-
throw TypeError(msg);
|
|
4
|
-
};
|
|
5
|
-
var __async = (__this, __arguments, generator) => {
|
|
6
|
-
return new Promise((resolve, reject) => {
|
|
7
|
-
var fulfilled = (value) => {
|
|
8
|
-
try {
|
|
9
|
-
step(generator.next(value));
|
|
10
|
-
} catch (e) {
|
|
11
|
-
reject(e);
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
var rejected = (value) => {
|
|
15
|
-
try {
|
|
16
|
-
step(generator.throw(value));
|
|
17
|
-
} catch (e) {
|
|
18
|
-
reject(e);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
22
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
var __await = function(promise, isYieldStar) {
|
|
26
|
-
this[0] = promise;
|
|
27
|
-
this[1] = isYieldStar;
|
|
28
|
-
};
|
|
29
|
-
var __asyncGenerator = (__this, __arguments, generator) => {
|
|
30
|
-
var resume = (k, v, yes, no) => {
|
|
31
|
-
try {
|
|
32
|
-
var x = generator[k](v), isAwait = (v = x.value) instanceof __await, done = x.done;
|
|
33
|
-
Promise.resolve(isAwait ? v[0] : v).then((y) => isAwait ? resume(k === "return" ? k : "next", v[1] ? { done: y.done, value: y.value } : y, yes, no) : yes({ value: y, done })).catch((e) => resume("throw", e, yes, no));
|
|
34
|
-
} catch (e) {
|
|
35
|
-
no(e);
|
|
36
|
-
}
|
|
37
|
-
}, method = (k) => it[k] = (x) => new Promise((yes, no) => resume(k, x, yes, no)), it = {};
|
|
38
|
-
return generator = generator.apply(__this, __arguments), it[__knownSymbol("asyncIterator")] = () => it, method("next"), method("throw"), method("return"), it;
|
|
39
|
-
};
|
|
40
|
-
var __yieldStar = (value) => {
|
|
41
|
-
var obj = value[__knownSymbol("asyncIterator")], isAwait = false, method, it = {};
|
|
42
|
-
if (obj == null) {
|
|
43
|
-
obj = value[__knownSymbol("iterator")]();
|
|
44
|
-
method = (k) => it[k] = (x) => obj[k](x);
|
|
45
|
-
} else {
|
|
46
|
-
obj = obj.call(value);
|
|
47
|
-
method = (k) => it[k] = (v) => {
|
|
48
|
-
if (isAwait) {
|
|
49
|
-
isAwait = false;
|
|
50
|
-
if (k === "throw") throw v;
|
|
51
|
-
return v;
|
|
52
|
-
}
|
|
53
|
-
isAwait = true;
|
|
54
|
-
return {
|
|
55
|
-
done: false,
|
|
56
|
-
value: new __await(new Promise((resolve) => {
|
|
57
|
-
var x = obj[k](v);
|
|
58
|
-
if (!(x instanceof Object)) __typeError("Object expected");
|
|
59
|
-
resolve(x);
|
|
60
|
-
}), 1)
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
return it[__knownSymbol("iterator")] = () => it, method("next"), "throw" in obj ? method("throw") : it.throw = (x) => {
|
|
65
|
-
throw x;
|
|
66
|
-
}, "return" in obj && method("return"), it;
|
|
67
|
-
};
|
|
68
|
-
var __forAwait = (obj, it, method) => (it = obj[__knownSymbol("asyncIterator")]) ? it.call(obj) : (obj = obj[__knownSymbol("iterator")](), it = {}, method = (key, fn) => (fn = obj[key]) && (it[key] = (arg) => new Promise((yes, no, done) => (arg = fn.call(obj, arg), done = arg.done, Promise.resolve(arg.value).then((value) => yes({ value, done }), no)))), method("next"), method("return"), it);
|
|
69
|
-
const streamChunk = function* (chunk, chunkSize) {
|
|
70
|
-
let len = chunk.byteLength;
|
|
71
|
-
if (len < chunkSize) {
|
|
72
|
-
yield chunk;
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
let pos = 0;
|
|
76
|
-
let end;
|
|
77
|
-
while (pos < len) {
|
|
78
|
-
end = pos + chunkSize;
|
|
79
|
-
yield chunk.slice(pos, end);
|
|
80
|
-
pos = end;
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
const readBytes = function(iterable, chunkSize) {
|
|
84
|
-
return __asyncGenerator(this, null, function* () {
|
|
85
|
-
try {
|
|
86
|
-
for (var iter = __forAwait(readStream(iterable)), more, temp, error; more = !(temp = yield new __await(iter.next())).done; more = false) {
|
|
87
|
-
const chunk = temp.value;
|
|
88
|
-
yield* __yieldStar(streamChunk(chunk, chunkSize));
|
|
89
|
-
}
|
|
90
|
-
} catch (temp) {
|
|
91
|
-
error = [temp];
|
|
92
|
-
} finally {
|
|
93
|
-
try {
|
|
94
|
-
more && (temp = iter.return) && (yield new __await(temp.call(iter)));
|
|
95
|
-
} finally {
|
|
96
|
-
if (error)
|
|
97
|
-
throw error[0];
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
};
|
|
102
|
-
const readStream = function(stream) {
|
|
103
|
-
return __asyncGenerator(this, null, function* () {
|
|
104
|
-
if (stream[Symbol.asyncIterator]) {
|
|
105
|
-
yield* __yieldStar(stream);
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
const reader = stream.getReader();
|
|
109
|
-
try {
|
|
110
|
-
for (; ; ) {
|
|
111
|
-
const { done, value } = yield new __await(reader.read());
|
|
112
|
-
if (done) {
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
yield value;
|
|
116
|
-
}
|
|
117
|
-
} finally {
|
|
118
|
-
yield new __await(reader.cancel());
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
};
|
|
122
|
-
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
123
|
-
const iterator = readBytes(stream, chunkSize);
|
|
124
|
-
let bytes = 0;
|
|
125
|
-
let done;
|
|
126
|
-
let _onFinish = (e) => {
|
|
127
|
-
if (!done) {
|
|
128
|
-
done = true;
|
|
129
|
-
onFinish && onFinish(e);
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
return new ReadableStream(
|
|
133
|
-
{
|
|
134
|
-
pull(controller) {
|
|
135
|
-
return __async(this, null, function* () {
|
|
136
|
-
try {
|
|
137
|
-
const { done: done2, value } = yield iterator.next();
|
|
138
|
-
if (done2) {
|
|
139
|
-
_onFinish();
|
|
140
|
-
controller.close();
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
let len = value.byteLength;
|
|
144
|
-
if (onProgress) {
|
|
145
|
-
let loadedBytes = bytes += len;
|
|
146
|
-
onProgress(loadedBytes);
|
|
147
|
-
}
|
|
148
|
-
controller.enqueue(new Uint8Array(value));
|
|
149
|
-
} catch (err) {
|
|
150
|
-
_onFinish(err);
|
|
151
|
-
throw err;
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
},
|
|
155
|
-
cancel(reason) {
|
|
156
|
-
_onFinish(reason);
|
|
157
|
-
return iterator.return();
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
highWaterMark: 2
|
|
162
|
-
}
|
|
163
|
-
);
|
|
164
|
-
};
|
|
165
|
-
export {
|
|
166
|
-
readBytes,
|
|
167
|
-
streamChunk,
|
|
168
|
-
trackStream
|
|
169
|
-
};
|