orange-orm 4.3.0 → 4.4.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/changelog.md +0 -2
- package/getManyDto4.js +313 -0
- package/getManyDtoFast.js +530 -0
- package/package.json +1 -1
- package/src/client/index.mjs +373 -784
- package/src/getManyDto.js +117 -102
- package/src/getManyDtoFast2.js +293 -0
- package/src/getManyDtoFastes.js +588 -0
- package/src/table/column/binary/newEncode.js +7 -0
- package/src/table/column/boolean/newEncode.js +12 -0
- package/src/table/column/date/newEncode.js +13 -2
- package/src/table/column/dateWithTimeZone/newEncode.js +10 -0
- package/src/table/column/guid/newEncode.js +10 -0
- package/src/table/column/in.js +11 -14
- package/src/table/column/json/newEncode.js +15 -0
- package/src/table/column/numeric/newEncode.js +10 -0
- package/src/table/column/string/newEncode.js +10 -1
- package/src/table/getManyDtoFast3.js +313 -0
package/src/client/index.mjs
CHANGED
|
@@ -1851,8 +1851,6 @@ const isFormData = (thing) => {
|
|
|
1851
1851
|
*/
|
|
1852
1852
|
const isURLSearchParams = kindOfTest('URLSearchParams');
|
|
1853
1853
|
|
|
1854
|
-
const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
|
|
1855
|
-
|
|
1856
1854
|
/**
|
|
1857
1855
|
* Trim excess whitespace off the beginning and end of a string
|
|
1858
1856
|
*
|
|
@@ -2241,7 +2239,8 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|
|
2241
2239
|
const noop = () => {};
|
|
2242
2240
|
|
|
2243
2241
|
const toFiniteNumber = (value, defaultValue) => {
|
|
2244
|
-
|
|
2242
|
+
value = +value;
|
|
2243
|
+
return Number.isFinite(value) ? value : defaultValue;
|
|
2245
2244
|
};
|
|
2246
2245
|
|
|
2247
2246
|
const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
|
|
@@ -2322,10 +2321,6 @@ var utils$1 = {
|
|
|
2322
2321
|
isBoolean,
|
|
2323
2322
|
isObject,
|
|
2324
2323
|
isPlainObject,
|
|
2325
|
-
isReadableStream,
|
|
2326
|
-
isRequest,
|
|
2327
|
-
isResponse,
|
|
2328
|
-
isHeaders,
|
|
2329
2324
|
isUndefined,
|
|
2330
2325
|
isDate,
|
|
2331
2326
|
isFile,
|
|
@@ -2922,14 +2917,11 @@ const hasStandardBrowserWebWorkerEnv = (() => {
|
|
|
2922
2917
|
);
|
|
2923
2918
|
})();
|
|
2924
2919
|
|
|
2925
|
-
const origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
2926
|
-
|
|
2927
2920
|
var utils = /*#__PURE__*/Object.freeze({
|
|
2928
2921
|
__proto__: null,
|
|
2929
2922
|
hasBrowserEnv: hasBrowserEnv,
|
|
2930
2923
|
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
2931
|
-
hasStandardBrowserEnv: hasStandardBrowserEnv
|
|
2932
|
-
origin: origin
|
|
2924
|
+
hasStandardBrowserEnv: hasStandardBrowserEnv
|
|
2933
2925
|
});
|
|
2934
2926
|
|
|
2935
2927
|
var platform = {
|
|
@@ -2997,9 +2989,6 @@ function arrayToObject(arr) {
|
|
|
2997
2989
|
function formDataToJSON(formData) {
|
|
2998
2990
|
function buildPath(path, value, target, index) {
|
|
2999
2991
|
let name = path[index++];
|
|
3000
|
-
|
|
3001
|
-
if (name === '__proto__') return true;
|
|
3002
|
-
|
|
3003
2992
|
const isNumericKey = Number.isFinite(+name);
|
|
3004
2993
|
const isLast = index >= path.length;
|
|
3005
2994
|
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
@@ -3069,7 +3058,7 @@ const defaults = {
|
|
|
3069
3058
|
|
|
3070
3059
|
transitional: transitionalDefaults,
|
|
3071
3060
|
|
|
3072
|
-
adapter: ['xhr', 'http'
|
|
3061
|
+
adapter: ['xhr', 'http'],
|
|
3073
3062
|
|
|
3074
3063
|
transformRequest: [function transformRequest(data, headers) {
|
|
3075
3064
|
const contentType = headers.getContentType() || '';
|
|
@@ -3083,6 +3072,9 @@ const defaults = {
|
|
|
3083
3072
|
const isFormData = utils$1.isFormData(data);
|
|
3084
3073
|
|
|
3085
3074
|
if (isFormData) {
|
|
3075
|
+
if (!hasJSONContentType) {
|
|
3076
|
+
return data;
|
|
3077
|
+
}
|
|
3086
3078
|
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
3087
3079
|
}
|
|
3088
3080
|
|
|
@@ -3090,8 +3082,7 @@ const defaults = {
|
|
|
3090
3082
|
utils$1.isBuffer(data) ||
|
|
3091
3083
|
utils$1.isStream(data) ||
|
|
3092
3084
|
utils$1.isFile(data) ||
|
|
3093
|
-
utils$1.isBlob(data)
|
|
3094
|
-
utils$1.isReadableStream(data)
|
|
3085
|
+
utils$1.isBlob(data)
|
|
3095
3086
|
) {
|
|
3096
3087
|
return data;
|
|
3097
3088
|
}
|
|
@@ -3134,10 +3125,6 @@ const defaults = {
|
|
|
3134
3125
|
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
3135
3126
|
const JSONRequested = this.responseType === 'json';
|
|
3136
3127
|
|
|
3137
|
-
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
3138
|
-
return data;
|
|
3139
|
-
}
|
|
3140
|
-
|
|
3141
3128
|
if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
3142
3129
|
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
3143
3130
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
@@ -3341,10 +3328,6 @@ class AxiosHeaders {
|
|
|
3341
3328
|
setHeaders(header, valueOrRewrite);
|
|
3342
3329
|
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
3343
3330
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
3344
|
-
} else if (utils$1.isHeaders(header)) {
|
|
3345
|
-
for (const [key, value] of header.entries()) {
|
|
3346
|
-
setHeader(value, key, rewrite);
|
|
3347
|
-
}
|
|
3348
3331
|
} else {
|
|
3349
3332
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
3350
3333
|
}
|
|
@@ -3612,124 +3595,89 @@ function settle(resolve, reject, response) {
|
|
|
3612
3595
|
}
|
|
3613
3596
|
}
|
|
3614
3597
|
|
|
3615
|
-
|
|
3616
|
-
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
3617
|
-
return match && match[1] || '';
|
|
3618
|
-
}
|
|
3619
|
-
|
|
3620
|
-
/**
|
|
3621
|
-
* Calculate data maxRate
|
|
3622
|
-
* @param {Number} [samplesCount= 10]
|
|
3623
|
-
* @param {Number} [min= 1000]
|
|
3624
|
-
* @returns {Function}
|
|
3625
|
-
*/
|
|
3626
|
-
function speedometer(samplesCount, min) {
|
|
3627
|
-
samplesCount = samplesCount || 10;
|
|
3628
|
-
const bytes = new Array(samplesCount);
|
|
3629
|
-
const timestamps = new Array(samplesCount);
|
|
3630
|
-
let head = 0;
|
|
3631
|
-
let tail = 0;
|
|
3632
|
-
let firstSampleTS;
|
|
3633
|
-
|
|
3634
|
-
min = min !== undefined ? min : 1000;
|
|
3635
|
-
|
|
3636
|
-
return function push(chunkLength) {
|
|
3637
|
-
const now = Date.now();
|
|
3598
|
+
var cookies = platform.hasStandardBrowserEnv ?
|
|
3638
3599
|
|
|
3639
|
-
|
|
3600
|
+
// Standard browser envs support document.cookie
|
|
3601
|
+
{
|
|
3602
|
+
write(name, value, expires, path, domain, secure) {
|
|
3603
|
+
const cookie = [name + '=' + encodeURIComponent(value)];
|
|
3640
3604
|
|
|
3641
|
-
|
|
3642
|
-
firstSampleTS = now;
|
|
3643
|
-
}
|
|
3605
|
+
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
|
3644
3606
|
|
|
3645
|
-
|
|
3646
|
-
timestamps[head] = now;
|
|
3607
|
+
utils$1.isString(path) && cookie.push('path=' + path);
|
|
3647
3608
|
|
|
3648
|
-
|
|
3649
|
-
let bytesCount = 0;
|
|
3609
|
+
utils$1.isString(domain) && cookie.push('domain=' + domain);
|
|
3650
3610
|
|
|
3651
|
-
|
|
3652
|
-
bytesCount += bytes[i++];
|
|
3653
|
-
i = i % samplesCount;
|
|
3654
|
-
}
|
|
3611
|
+
secure === true && cookie.push('secure');
|
|
3655
3612
|
|
|
3656
|
-
|
|
3613
|
+
document.cookie = cookie.join('; ');
|
|
3614
|
+
},
|
|
3657
3615
|
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3616
|
+
read(name) {
|
|
3617
|
+
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
|
3618
|
+
return (match ? decodeURIComponent(match[3]) : null);
|
|
3619
|
+
},
|
|
3661
3620
|
|
|
3662
|
-
|
|
3663
|
-
|
|
3621
|
+
remove(name) {
|
|
3622
|
+
this.write(name, '', Date.now() - 86400000);
|
|
3664
3623
|
}
|
|
3624
|
+
}
|
|
3665
3625
|
|
|
3666
|
-
|
|
3626
|
+
:
|
|
3667
3627
|
|
|
3668
|
-
|
|
3628
|
+
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
3629
|
+
{
|
|
3630
|
+
write() {},
|
|
3631
|
+
read() {
|
|
3632
|
+
return null;
|
|
3633
|
+
},
|
|
3634
|
+
remove() {}
|
|
3669
3635
|
};
|
|
3670
|
-
}
|
|
3671
3636
|
|
|
3672
3637
|
/**
|
|
3673
|
-
*
|
|
3674
|
-
*
|
|
3675
|
-
* @param {
|
|
3676
|
-
*
|
|
3638
|
+
* Determines whether the specified URL is absolute
|
|
3639
|
+
*
|
|
3640
|
+
* @param {string} url The URL to test
|
|
3641
|
+
*
|
|
3642
|
+
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
|
3677
3643
|
*/
|
|
3678
|
-
function
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
return
|
|
3683
|
-
const force = this === true;
|
|
3684
|
-
|
|
3685
|
-
const now = Date.now();
|
|
3686
|
-
if (force || now - timestamp > threshold) {
|
|
3687
|
-
if (timer) {
|
|
3688
|
-
clearTimeout(timer);
|
|
3689
|
-
timer = null;
|
|
3690
|
-
}
|
|
3691
|
-
timestamp = now;
|
|
3692
|
-
return fn.apply(null, arguments);
|
|
3693
|
-
}
|
|
3694
|
-
if (!timer) {
|
|
3695
|
-
timer = setTimeout(() => {
|
|
3696
|
-
timer = null;
|
|
3697
|
-
timestamp = Date.now();
|
|
3698
|
-
return fn.apply(null, arguments);
|
|
3699
|
-
}, threshold - (now - timestamp));
|
|
3700
|
-
}
|
|
3701
|
-
};
|
|
3644
|
+
function isAbsoluteURL(url) {
|
|
3645
|
+
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
3646
|
+
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
3647
|
+
// by any combination of letters, digits, plus, period, or hyphen.
|
|
3648
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
3702
3649
|
}
|
|
3703
3650
|
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
const data = {
|
|
3718
|
-
loaded,
|
|
3719
|
-
total,
|
|
3720
|
-
progress: total ? (loaded / total) : undefined,
|
|
3721
|
-
bytes: progressBytes,
|
|
3722
|
-
rate: rate ? rate : undefined,
|
|
3723
|
-
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
3724
|
-
event: e,
|
|
3725
|
-
lengthComputable: total != null
|
|
3726
|
-
};
|
|
3727
|
-
|
|
3728
|
-
data[isDownloadStream ? 'download' : 'upload'] = true;
|
|
3651
|
+
/**
|
|
3652
|
+
* Creates a new URL by combining the specified URLs
|
|
3653
|
+
*
|
|
3654
|
+
* @param {string} baseURL The base URL
|
|
3655
|
+
* @param {string} relativeURL The relative URL
|
|
3656
|
+
*
|
|
3657
|
+
* @returns {string} The combined URL
|
|
3658
|
+
*/
|
|
3659
|
+
function combineURLs(baseURL, relativeURL) {
|
|
3660
|
+
return relativeURL
|
|
3661
|
+
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
|
3662
|
+
: baseURL;
|
|
3663
|
+
}
|
|
3729
3664
|
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3665
|
+
/**
|
|
3666
|
+
* Creates a new URL by combining the baseURL with the requestedURL,
|
|
3667
|
+
* only when the requestedURL is not already an absolute URL.
|
|
3668
|
+
* If the requestURL is absolute, this function returns the requestedURL untouched.
|
|
3669
|
+
*
|
|
3670
|
+
* @param {string} baseURL The base URL
|
|
3671
|
+
* @param {string} requestedURL Absolute or relative URL to combine
|
|
3672
|
+
*
|
|
3673
|
+
* @returns {string} The combined full path
|
|
3674
|
+
*/
|
|
3675
|
+
function buildFullPath(baseURL, requestedURL) {
|
|
3676
|
+
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
|
3677
|
+
return combineURLs(baseURL, requestedURL);
|
|
3678
|
+
}
|
|
3679
|
+
return requestedURL;
|
|
3680
|
+
}
|
|
3733
3681
|
|
|
3734
3682
|
var isURLSameOrigin = platform.hasStandardBrowserEnv ?
|
|
3735
3683
|
|
|
@@ -3794,265 +3742,137 @@ var isURLSameOrigin = platform.hasStandardBrowserEnv ?
|
|
|
3794
3742
|
};
|
|
3795
3743
|
})();
|
|
3796
3744
|
|
|
3797
|
-
|
|
3745
|
+
function parseProtocol(url) {
|
|
3746
|
+
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
3747
|
+
return match && match[1] || '';
|
|
3748
|
+
}
|
|
3798
3749
|
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3750
|
+
/**
|
|
3751
|
+
* Calculate data maxRate
|
|
3752
|
+
* @param {Number} [samplesCount= 10]
|
|
3753
|
+
* @param {Number} [min= 1000]
|
|
3754
|
+
* @returns {Function}
|
|
3755
|
+
*/
|
|
3756
|
+
function speedometer(samplesCount, min) {
|
|
3757
|
+
samplesCount = samplesCount || 10;
|
|
3758
|
+
const bytes = new Array(samplesCount);
|
|
3759
|
+
const timestamps = new Array(samplesCount);
|
|
3760
|
+
let head = 0;
|
|
3761
|
+
let tail = 0;
|
|
3762
|
+
let firstSampleTS;
|
|
3803
3763
|
|
|
3804
|
-
|
|
3764
|
+
min = min !== undefined ? min : 1000;
|
|
3805
3765
|
|
|
3806
|
-
|
|
3766
|
+
return function push(chunkLength) {
|
|
3767
|
+
const now = Date.now();
|
|
3807
3768
|
|
|
3808
|
-
|
|
3769
|
+
const startedAt = timestamps[tail];
|
|
3809
3770
|
|
|
3810
|
-
|
|
3771
|
+
if (!firstSampleTS) {
|
|
3772
|
+
firstSampleTS = now;
|
|
3773
|
+
}
|
|
3811
3774
|
|
|
3812
|
-
|
|
3813
|
-
|
|
3775
|
+
bytes[head] = chunkLength;
|
|
3776
|
+
timestamps[head] = now;
|
|
3814
3777
|
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
return (match ? decodeURIComponent(match[3]) : null);
|
|
3818
|
-
},
|
|
3778
|
+
let i = tail;
|
|
3779
|
+
let bytesCount = 0;
|
|
3819
3780
|
|
|
3820
|
-
|
|
3821
|
-
|
|
3781
|
+
while (i !== head) {
|
|
3782
|
+
bytesCount += bytes[i++];
|
|
3783
|
+
i = i % samplesCount;
|
|
3822
3784
|
}
|
|
3823
|
-
}
|
|
3824
3785
|
|
|
3825
|
-
|
|
3786
|
+
head = (head + 1) % samplesCount;
|
|
3826
3787
|
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
read() {
|
|
3831
|
-
return null;
|
|
3832
|
-
},
|
|
3833
|
-
remove() {}
|
|
3834
|
-
};
|
|
3788
|
+
if (head === tail) {
|
|
3789
|
+
tail = (tail + 1) % samplesCount;
|
|
3790
|
+
}
|
|
3835
3791
|
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
* @param {string} url The URL to test
|
|
3840
|
-
*
|
|
3841
|
-
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
|
3842
|
-
*/
|
|
3843
|
-
function isAbsoluteURL(url) {
|
|
3844
|
-
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
3845
|
-
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
3846
|
-
// by any combination of letters, digits, plus, period, or hyphen.
|
|
3847
|
-
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
3848
|
-
}
|
|
3792
|
+
if (now - firstSampleTS < min) {
|
|
3793
|
+
return;
|
|
3794
|
+
}
|
|
3849
3795
|
|
|
3850
|
-
|
|
3851
|
-
* Creates a new URL by combining the specified URLs
|
|
3852
|
-
*
|
|
3853
|
-
* @param {string} baseURL The base URL
|
|
3854
|
-
* @param {string} relativeURL The relative URL
|
|
3855
|
-
*
|
|
3856
|
-
* @returns {string} The combined URL
|
|
3857
|
-
*/
|
|
3858
|
-
function combineURLs(baseURL, relativeURL) {
|
|
3859
|
-
return relativeURL
|
|
3860
|
-
? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
|
3861
|
-
: baseURL;
|
|
3862
|
-
}
|
|
3796
|
+
const passed = startedAt && now - startedAt;
|
|
3863
3797
|
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
* only when the requestedURL is not already an absolute URL.
|
|
3867
|
-
* If the requestURL is absolute, this function returns the requestedURL untouched.
|
|
3868
|
-
*
|
|
3869
|
-
* @param {string} baseURL The base URL
|
|
3870
|
-
* @param {string} requestedURL Absolute or relative URL to combine
|
|
3871
|
-
*
|
|
3872
|
-
* @returns {string} The combined full path
|
|
3873
|
-
*/
|
|
3874
|
-
function buildFullPath(baseURL, requestedURL) {
|
|
3875
|
-
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
|
3876
|
-
return combineURLs(baseURL, requestedURL);
|
|
3877
|
-
}
|
|
3878
|
-
return requestedURL;
|
|
3798
|
+
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
3799
|
+
};
|
|
3879
3800
|
}
|
|
3880
3801
|
|
|
3881
|
-
|
|
3802
|
+
function progressEventReducer(listener, isDownloadStream) {
|
|
3803
|
+
let bytesNotified = 0;
|
|
3804
|
+
const _speedometer = speedometer(50, 250);
|
|
3882
3805
|
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
*
|
|
3890
|
-
* @returns {Object} New object resulting from merging config2 to config1
|
|
3891
|
-
*/
|
|
3892
|
-
function mergeConfig(config1, config2) {
|
|
3893
|
-
// eslint-disable-next-line no-param-reassign
|
|
3894
|
-
config2 = config2 || {};
|
|
3895
|
-
const config = {};
|
|
3896
|
-
|
|
3897
|
-
function getMergedValue(target, source, caseless) {
|
|
3898
|
-
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
3899
|
-
return utils$1.merge.call({caseless}, target, source);
|
|
3900
|
-
} else if (utils$1.isPlainObject(source)) {
|
|
3901
|
-
return utils$1.merge({}, source);
|
|
3902
|
-
} else if (utils$1.isArray(source)) {
|
|
3903
|
-
return source.slice();
|
|
3904
|
-
}
|
|
3905
|
-
return source;
|
|
3906
|
-
}
|
|
3907
|
-
|
|
3908
|
-
// eslint-disable-next-line consistent-return
|
|
3909
|
-
function mergeDeepProperties(a, b, caseless) {
|
|
3910
|
-
if (!utils$1.isUndefined(b)) {
|
|
3911
|
-
return getMergedValue(a, b, caseless);
|
|
3912
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
3913
|
-
return getMergedValue(undefined, a, caseless);
|
|
3914
|
-
}
|
|
3915
|
-
}
|
|
3806
|
+
return e => {
|
|
3807
|
+
const loaded = e.loaded;
|
|
3808
|
+
const total = e.lengthComputable ? e.total : undefined;
|
|
3809
|
+
const progressBytes = loaded - bytesNotified;
|
|
3810
|
+
const rate = _speedometer(progressBytes);
|
|
3811
|
+
const inRange = loaded <= total;
|
|
3916
3812
|
|
|
3917
|
-
|
|
3918
|
-
function valueFromConfig2(a, b) {
|
|
3919
|
-
if (!utils$1.isUndefined(b)) {
|
|
3920
|
-
return getMergedValue(undefined, b);
|
|
3921
|
-
}
|
|
3922
|
-
}
|
|
3813
|
+
bytesNotified = loaded;
|
|
3923
3814
|
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3815
|
+
const data = {
|
|
3816
|
+
loaded,
|
|
3817
|
+
total,
|
|
3818
|
+
progress: total ? (loaded / total) : undefined,
|
|
3819
|
+
bytes: progressBytes,
|
|
3820
|
+
rate: rate ? rate : undefined,
|
|
3821
|
+
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
3822
|
+
event: e
|
|
3823
|
+
};
|
|
3932
3824
|
|
|
3933
|
-
|
|
3934
|
-
function mergeDirectKeys(a, b, prop) {
|
|
3935
|
-
if (prop in config2) {
|
|
3936
|
-
return getMergedValue(a, b);
|
|
3937
|
-
} else if (prop in config1) {
|
|
3938
|
-
return getMergedValue(undefined, a);
|
|
3939
|
-
}
|
|
3940
|
-
}
|
|
3825
|
+
data[isDownloadStream ? 'download' : 'upload'] = true;
|
|
3941
3826
|
|
|
3942
|
-
|
|
3943
|
-
url: valueFromConfig2,
|
|
3944
|
-
method: valueFromConfig2,
|
|
3945
|
-
data: valueFromConfig2,
|
|
3946
|
-
baseURL: defaultToConfig2,
|
|
3947
|
-
transformRequest: defaultToConfig2,
|
|
3948
|
-
transformResponse: defaultToConfig2,
|
|
3949
|
-
paramsSerializer: defaultToConfig2,
|
|
3950
|
-
timeout: defaultToConfig2,
|
|
3951
|
-
timeoutMessage: defaultToConfig2,
|
|
3952
|
-
withCredentials: defaultToConfig2,
|
|
3953
|
-
withXSRFToken: defaultToConfig2,
|
|
3954
|
-
adapter: defaultToConfig2,
|
|
3955
|
-
responseType: defaultToConfig2,
|
|
3956
|
-
xsrfCookieName: defaultToConfig2,
|
|
3957
|
-
xsrfHeaderName: defaultToConfig2,
|
|
3958
|
-
onUploadProgress: defaultToConfig2,
|
|
3959
|
-
onDownloadProgress: defaultToConfig2,
|
|
3960
|
-
decompress: defaultToConfig2,
|
|
3961
|
-
maxContentLength: defaultToConfig2,
|
|
3962
|
-
maxBodyLength: defaultToConfig2,
|
|
3963
|
-
beforeRedirect: defaultToConfig2,
|
|
3964
|
-
transport: defaultToConfig2,
|
|
3965
|
-
httpAgent: defaultToConfig2,
|
|
3966
|
-
httpsAgent: defaultToConfig2,
|
|
3967
|
-
cancelToken: defaultToConfig2,
|
|
3968
|
-
socketPath: defaultToConfig2,
|
|
3969
|
-
responseEncoding: defaultToConfig2,
|
|
3970
|
-
validateStatus: mergeDirectKeys,
|
|
3971
|
-
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
3827
|
+
listener(data);
|
|
3972
3828
|
};
|
|
3973
|
-
|
|
3974
|
-
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
3975
|
-
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
3976
|
-
const configValue = merge(config1[prop], config2[prop], prop);
|
|
3977
|
-
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
3978
|
-
});
|
|
3979
|
-
|
|
3980
|
-
return config;
|
|
3981
3829
|
}
|
|
3982
3830
|
|
|
3983
|
-
var resolveConfig = (config) => {
|
|
3984
|
-
const newConfig = mergeConfig({}, config);
|
|
3985
|
-
|
|
3986
|
-
let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
|
|
3987
|
-
|
|
3988
|
-
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
3989
|
-
|
|
3990
|
-
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
|
|
3991
|
-
|
|
3992
|
-
// HTTP basic authentication
|
|
3993
|
-
if (auth) {
|
|
3994
|
-
headers.set('Authorization', 'Basic ' +
|
|
3995
|
-
btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
|
|
3996
|
-
);
|
|
3997
|
-
}
|
|
3998
|
-
|
|
3999
|
-
let contentType;
|
|
4000
|
-
|
|
4001
|
-
if (utils$1.isFormData(data)) {
|
|
4002
|
-
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
4003
|
-
headers.setContentType(undefined); // Let the browser set it
|
|
4004
|
-
} else if ((contentType = headers.getContentType()) !== false) {
|
|
4005
|
-
// fix semicolon duplication issue for ReactNative FormData implementation
|
|
4006
|
-
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
|
|
4007
|
-
headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
|
|
4008
|
-
}
|
|
4009
|
-
}
|
|
4010
|
-
|
|
4011
|
-
// Add xsrf header
|
|
4012
|
-
// This is only done if running in a standard browser environment.
|
|
4013
|
-
// Specifically not if we're in a web worker, or react-native.
|
|
4014
|
-
|
|
4015
|
-
if (platform.hasStandardBrowserEnv) {
|
|
4016
|
-
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
|
|
4017
|
-
|
|
4018
|
-
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
|
|
4019
|
-
// Add xsrf header
|
|
4020
|
-
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
4021
|
-
|
|
4022
|
-
if (xsrfValue) {
|
|
4023
|
-
headers.set(xsrfHeaderName, xsrfValue);
|
|
4024
|
-
}
|
|
4025
|
-
}
|
|
4026
|
-
}
|
|
4027
|
-
|
|
4028
|
-
return newConfig;
|
|
4029
|
-
};
|
|
4030
|
-
|
|
4031
3831
|
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
4032
3832
|
|
|
4033
3833
|
var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
4034
3834
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
let {responseType} = _config;
|
|
3835
|
+
let requestData = config.data;
|
|
3836
|
+
const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
|
|
3837
|
+
let {responseType, withXSRFToken} = config;
|
|
4039
3838
|
let onCanceled;
|
|
4040
3839
|
function done() {
|
|
4041
|
-
if (
|
|
4042
|
-
|
|
3840
|
+
if (config.cancelToken) {
|
|
3841
|
+
config.cancelToken.unsubscribe(onCanceled);
|
|
4043
3842
|
}
|
|
4044
3843
|
|
|
4045
|
-
if (
|
|
4046
|
-
|
|
3844
|
+
if (config.signal) {
|
|
3845
|
+
config.signal.removeEventListener('abort', onCanceled);
|
|
3846
|
+
}
|
|
3847
|
+
}
|
|
3848
|
+
|
|
3849
|
+
let contentType;
|
|
3850
|
+
|
|
3851
|
+
if (utils$1.isFormData(requestData)) {
|
|
3852
|
+
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
3853
|
+
requestHeaders.setContentType(false); // Let the browser set it
|
|
3854
|
+
} else if ((contentType = requestHeaders.getContentType()) !== false) {
|
|
3855
|
+
// fix semicolon duplication issue for ReactNative FormData implementation
|
|
3856
|
+
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
|
|
3857
|
+
requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
|
|
4047
3858
|
}
|
|
4048
3859
|
}
|
|
4049
3860
|
|
|
4050
3861
|
let request = new XMLHttpRequest();
|
|
4051
3862
|
|
|
4052
|
-
|
|
3863
|
+
// HTTP basic authentication
|
|
3864
|
+
if (config.auth) {
|
|
3865
|
+
const username = config.auth.username || '';
|
|
3866
|
+
const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
|
3867
|
+
requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
|
|
3868
|
+
}
|
|
3869
|
+
|
|
3870
|
+
const fullPath = buildFullPath(config.baseURL, config.url);
|
|
3871
|
+
|
|
3872
|
+
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
|
4053
3873
|
|
|
4054
3874
|
// Set the request timeout in MS
|
|
4055
|
-
request.timeout =
|
|
3875
|
+
request.timeout = config.timeout;
|
|
4056
3876
|
|
|
4057
3877
|
function onloadend() {
|
|
4058
3878
|
if (!request) {
|
|
@@ -4114,7 +3934,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
4114
3934
|
return;
|
|
4115
3935
|
}
|
|
4116
3936
|
|
|
4117
|
-
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED,
|
|
3937
|
+
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
|
|
4118
3938
|
|
|
4119
3939
|
// Clean up request
|
|
4120
3940
|
request = null;
|
|
@@ -4124,7 +3944,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
4124
3944
|
request.onerror = function handleError() {
|
|
4125
3945
|
// Real errors are hidden from us by the browser
|
|
4126
3946
|
// onerror should only fire if it's a network error
|
|
4127
|
-
reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK,
|
|
3947
|
+
reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
|
|
4128
3948
|
|
|
4129
3949
|
// Clean up request
|
|
4130
3950
|
request = null;
|
|
@@ -4132,21 +3952,37 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
4132
3952
|
|
|
4133
3953
|
// Handle timeout
|
|
4134
3954
|
request.ontimeout = function handleTimeout() {
|
|
4135
|
-
let timeoutErrorMessage =
|
|
4136
|
-
const transitional =
|
|
4137
|
-
if (
|
|
4138
|
-
timeoutErrorMessage =
|
|
3955
|
+
let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
3956
|
+
const transitional = config.transitional || transitionalDefaults;
|
|
3957
|
+
if (config.timeoutErrorMessage) {
|
|
3958
|
+
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
4139
3959
|
}
|
|
4140
3960
|
reject(new AxiosError(
|
|
4141
3961
|
timeoutErrorMessage,
|
|
4142
3962
|
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
|
4143
|
-
|
|
3963
|
+
config,
|
|
4144
3964
|
request));
|
|
4145
3965
|
|
|
4146
3966
|
// Clean up request
|
|
4147
3967
|
request = null;
|
|
4148
3968
|
};
|
|
4149
3969
|
|
|
3970
|
+
// Add xsrf header
|
|
3971
|
+
// This is only done if running in a standard browser environment.
|
|
3972
|
+
// Specifically not if we're in a web worker, or react-native.
|
|
3973
|
+
if(platform.hasStandardBrowserEnv) {
|
|
3974
|
+
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
|
|
3975
|
+
|
|
3976
|
+
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
|
|
3977
|
+
// Add xsrf header
|
|
3978
|
+
const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
|
3979
|
+
|
|
3980
|
+
if (xsrfValue) {
|
|
3981
|
+
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
|
3982
|
+
}
|
|
3983
|
+
}
|
|
3984
|
+
}
|
|
3985
|
+
|
|
4150
3986
|
// Remove Content-Type if data is undefined
|
|
4151
3987
|
requestData === undefined && requestHeaders.setContentType(null);
|
|
4152
3988
|
|
|
@@ -4158,26 +3994,26 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
4158
3994
|
}
|
|
4159
3995
|
|
|
4160
3996
|
// Add withCredentials to request if needed
|
|
4161
|
-
if (!utils$1.isUndefined(
|
|
4162
|
-
request.withCredentials = !!
|
|
3997
|
+
if (!utils$1.isUndefined(config.withCredentials)) {
|
|
3998
|
+
request.withCredentials = !!config.withCredentials;
|
|
4163
3999
|
}
|
|
4164
4000
|
|
|
4165
4001
|
// Add responseType to request if needed
|
|
4166
4002
|
if (responseType && responseType !== 'json') {
|
|
4167
|
-
request.responseType =
|
|
4003
|
+
request.responseType = config.responseType;
|
|
4168
4004
|
}
|
|
4169
4005
|
|
|
4170
4006
|
// Handle progress if needed
|
|
4171
|
-
if (typeof
|
|
4172
|
-
request.addEventListener('progress', progressEventReducer(
|
|
4007
|
+
if (typeof config.onDownloadProgress === 'function') {
|
|
4008
|
+
request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
|
|
4173
4009
|
}
|
|
4174
4010
|
|
|
4175
4011
|
// Not all browsers support upload events
|
|
4176
|
-
if (typeof
|
|
4177
|
-
request.upload.addEventListener('progress', progressEventReducer(
|
|
4012
|
+
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
|
4013
|
+
request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
|
|
4178
4014
|
}
|
|
4179
4015
|
|
|
4180
|
-
if (
|
|
4016
|
+
if (config.cancelToken || config.signal) {
|
|
4181
4017
|
// Handle cancellation
|
|
4182
4018
|
// eslint-disable-next-line func-names
|
|
4183
4019
|
onCanceled = cancel => {
|
|
@@ -4189,13 +4025,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
4189
4025
|
request = null;
|
|
4190
4026
|
};
|
|
4191
4027
|
|
|
4192
|
-
|
|
4193
|
-
if (
|
|
4194
|
-
|
|
4028
|
+
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
|
4029
|
+
if (config.signal) {
|
|
4030
|
+
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
|
4195
4031
|
}
|
|
4196
4032
|
}
|
|
4197
4033
|
|
|
4198
|
-
const protocol = parseProtocol(
|
|
4034
|
+
const protocol = parseProtocol(fullPath);
|
|
4199
4035
|
|
|
4200
4036
|
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
4201
4037
|
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
|
@@ -4208,324 +4044,9 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
4208
4044
|
});
|
|
4209
4045
|
};
|
|
4210
4046
|
|
|
4211
|
-
const composeSignals = (signals, timeout) => {
|
|
4212
|
-
let controller = new AbortController();
|
|
4213
|
-
|
|
4214
|
-
let aborted;
|
|
4215
|
-
|
|
4216
|
-
const onabort = function (cancel) {
|
|
4217
|
-
if (!aborted) {
|
|
4218
|
-
aborted = true;
|
|
4219
|
-
unsubscribe();
|
|
4220
|
-
const err = cancel instanceof Error ? cancel : this.reason;
|
|
4221
|
-
controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
|
|
4222
|
-
}
|
|
4223
|
-
};
|
|
4224
|
-
|
|
4225
|
-
let timer = timeout && setTimeout(() => {
|
|
4226
|
-
onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
|
|
4227
|
-
}, timeout);
|
|
4228
|
-
|
|
4229
|
-
const unsubscribe = () => {
|
|
4230
|
-
if (signals) {
|
|
4231
|
-
timer && clearTimeout(timer);
|
|
4232
|
-
timer = null;
|
|
4233
|
-
signals.forEach(signal => {
|
|
4234
|
-
signal &&
|
|
4235
|
-
(signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));
|
|
4236
|
-
});
|
|
4237
|
-
signals = null;
|
|
4238
|
-
}
|
|
4239
|
-
};
|
|
4240
|
-
|
|
4241
|
-
signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));
|
|
4242
|
-
|
|
4243
|
-
const {signal} = controller;
|
|
4244
|
-
|
|
4245
|
-
signal.unsubscribe = unsubscribe;
|
|
4246
|
-
|
|
4247
|
-
return [signal, () => {
|
|
4248
|
-
timer && clearTimeout(timer);
|
|
4249
|
-
timer = null;
|
|
4250
|
-
}];
|
|
4251
|
-
};
|
|
4252
|
-
|
|
4253
|
-
var composeSignals$1 = composeSignals;
|
|
4254
|
-
|
|
4255
|
-
const streamChunk = function* (chunk, chunkSize) {
|
|
4256
|
-
let len = chunk.byteLength;
|
|
4257
|
-
|
|
4258
|
-
if (!chunkSize || len < chunkSize) {
|
|
4259
|
-
yield chunk;
|
|
4260
|
-
return;
|
|
4261
|
-
}
|
|
4262
|
-
|
|
4263
|
-
let pos = 0;
|
|
4264
|
-
let end;
|
|
4265
|
-
|
|
4266
|
-
while (pos < len) {
|
|
4267
|
-
end = pos + chunkSize;
|
|
4268
|
-
yield chunk.slice(pos, end);
|
|
4269
|
-
pos = end;
|
|
4270
|
-
}
|
|
4271
|
-
};
|
|
4272
|
-
|
|
4273
|
-
const readBytes = async function* (iterable, chunkSize, encode) {
|
|
4274
|
-
for await (const chunk of iterable) {
|
|
4275
|
-
yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);
|
|
4276
|
-
}
|
|
4277
|
-
};
|
|
4278
|
-
|
|
4279
|
-
const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
|
|
4280
|
-
const iterator = readBytes(stream, chunkSize, encode);
|
|
4281
|
-
|
|
4282
|
-
let bytes = 0;
|
|
4283
|
-
|
|
4284
|
-
return new ReadableStream({
|
|
4285
|
-
type: 'bytes',
|
|
4286
|
-
|
|
4287
|
-
async pull(controller) {
|
|
4288
|
-
const {done, value} = await iterator.next();
|
|
4289
|
-
|
|
4290
|
-
if (done) {
|
|
4291
|
-
controller.close();
|
|
4292
|
-
onFinish();
|
|
4293
|
-
return;
|
|
4294
|
-
}
|
|
4295
|
-
|
|
4296
|
-
let len = value.byteLength;
|
|
4297
|
-
onProgress && onProgress(bytes += len);
|
|
4298
|
-
controller.enqueue(new Uint8Array(value));
|
|
4299
|
-
},
|
|
4300
|
-
cancel(reason) {
|
|
4301
|
-
onFinish(reason);
|
|
4302
|
-
return iterator.return();
|
|
4303
|
-
}
|
|
4304
|
-
}, {
|
|
4305
|
-
highWaterMark: 2
|
|
4306
|
-
})
|
|
4307
|
-
};
|
|
4308
|
-
|
|
4309
|
-
const fetchProgressDecorator = (total, fn) => {
|
|
4310
|
-
const lengthComputable = total != null;
|
|
4311
|
-
return (loaded) => setTimeout(() => fn({
|
|
4312
|
-
lengthComputable,
|
|
4313
|
-
total,
|
|
4314
|
-
loaded
|
|
4315
|
-
}));
|
|
4316
|
-
};
|
|
4317
|
-
|
|
4318
|
-
const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
|
|
4319
|
-
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
|
|
4320
|
-
|
|
4321
|
-
// used only inside the fetch adapter
|
|
4322
|
-
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
4323
|
-
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
4324
|
-
async (str) => new Uint8Array(await new Response(str).arrayBuffer())
|
|
4325
|
-
);
|
|
4326
|
-
|
|
4327
|
-
const supportsRequestStream = isReadableStreamSupported && (() => {
|
|
4328
|
-
let duplexAccessed = false;
|
|
4329
|
-
|
|
4330
|
-
const hasContentType = new Request(platform.origin, {
|
|
4331
|
-
body: new ReadableStream(),
|
|
4332
|
-
method: 'POST',
|
|
4333
|
-
get duplex() {
|
|
4334
|
-
duplexAccessed = true;
|
|
4335
|
-
return 'half';
|
|
4336
|
-
},
|
|
4337
|
-
}).headers.has('Content-Type');
|
|
4338
|
-
|
|
4339
|
-
return duplexAccessed && !hasContentType;
|
|
4340
|
-
})();
|
|
4341
|
-
|
|
4342
|
-
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
4343
|
-
|
|
4344
|
-
const supportsResponseStream = isReadableStreamSupported && !!(()=> {
|
|
4345
|
-
try {
|
|
4346
|
-
return utils$1.isReadableStream(new Response('').body);
|
|
4347
|
-
} catch(err) {
|
|
4348
|
-
// return undefined
|
|
4349
|
-
}
|
|
4350
|
-
})();
|
|
4351
|
-
|
|
4352
|
-
const resolvers = {
|
|
4353
|
-
stream: supportsResponseStream && ((res) => res.body)
|
|
4354
|
-
};
|
|
4355
|
-
|
|
4356
|
-
isFetchSupported && (((res) => {
|
|
4357
|
-
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
4358
|
-
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
|
|
4359
|
-
(_, config) => {
|
|
4360
|
-
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
|
4361
|
-
});
|
|
4362
|
-
});
|
|
4363
|
-
})(new Response));
|
|
4364
|
-
|
|
4365
|
-
const getBodyLength = async (body) => {
|
|
4366
|
-
if (body == null) {
|
|
4367
|
-
return 0;
|
|
4368
|
-
}
|
|
4369
|
-
|
|
4370
|
-
if(utils$1.isBlob(body)) {
|
|
4371
|
-
return body.size;
|
|
4372
|
-
}
|
|
4373
|
-
|
|
4374
|
-
if(utils$1.isSpecCompliantForm(body)) {
|
|
4375
|
-
return (await new Request(body).arrayBuffer()).byteLength;
|
|
4376
|
-
}
|
|
4377
|
-
|
|
4378
|
-
if(utils$1.isArrayBufferView(body)) {
|
|
4379
|
-
return body.byteLength;
|
|
4380
|
-
}
|
|
4381
|
-
|
|
4382
|
-
if(utils$1.isURLSearchParams(body)) {
|
|
4383
|
-
body = body + '';
|
|
4384
|
-
}
|
|
4385
|
-
|
|
4386
|
-
if(utils$1.isString(body)) {
|
|
4387
|
-
return (await encodeText(body)).byteLength;
|
|
4388
|
-
}
|
|
4389
|
-
};
|
|
4390
|
-
|
|
4391
|
-
const resolveBodyLength = async (headers, body) => {
|
|
4392
|
-
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
4393
|
-
|
|
4394
|
-
return length == null ? getBodyLength(body) : length;
|
|
4395
|
-
};
|
|
4396
|
-
|
|
4397
|
-
var fetchAdapter = isFetchSupported && (async (config) => {
|
|
4398
|
-
let {
|
|
4399
|
-
url,
|
|
4400
|
-
method,
|
|
4401
|
-
data,
|
|
4402
|
-
signal,
|
|
4403
|
-
cancelToken,
|
|
4404
|
-
timeout,
|
|
4405
|
-
onDownloadProgress,
|
|
4406
|
-
onUploadProgress,
|
|
4407
|
-
responseType,
|
|
4408
|
-
headers,
|
|
4409
|
-
withCredentials = 'same-origin',
|
|
4410
|
-
fetchOptions
|
|
4411
|
-
} = resolveConfig(config);
|
|
4412
|
-
|
|
4413
|
-
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
4414
|
-
|
|
4415
|
-
let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?
|
|
4416
|
-
composeSignals$1([signal, cancelToken], timeout) : [];
|
|
4417
|
-
|
|
4418
|
-
let finished, request;
|
|
4419
|
-
|
|
4420
|
-
const onFinish = () => {
|
|
4421
|
-
!finished && setTimeout(() => {
|
|
4422
|
-
composedSignal && composedSignal.unsubscribe();
|
|
4423
|
-
});
|
|
4424
|
-
|
|
4425
|
-
finished = true;
|
|
4426
|
-
};
|
|
4427
|
-
|
|
4428
|
-
let requestContentLength;
|
|
4429
|
-
|
|
4430
|
-
try {
|
|
4431
|
-
if (
|
|
4432
|
-
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
|
|
4433
|
-
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
4434
|
-
) {
|
|
4435
|
-
let _request = new Request(url, {
|
|
4436
|
-
method: 'POST',
|
|
4437
|
-
body: data,
|
|
4438
|
-
duplex: "half"
|
|
4439
|
-
});
|
|
4440
|
-
|
|
4441
|
-
let contentTypeHeader;
|
|
4442
|
-
|
|
4443
|
-
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
4444
|
-
headers.setContentType(contentTypeHeader);
|
|
4445
|
-
}
|
|
4446
|
-
|
|
4447
|
-
if (_request.body) {
|
|
4448
|
-
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(
|
|
4449
|
-
requestContentLength,
|
|
4450
|
-
progressEventReducer(onUploadProgress)
|
|
4451
|
-
), null, encodeText);
|
|
4452
|
-
}
|
|
4453
|
-
}
|
|
4454
|
-
|
|
4455
|
-
if (!utils$1.isString(withCredentials)) {
|
|
4456
|
-
withCredentials = withCredentials ? 'cors' : 'omit';
|
|
4457
|
-
}
|
|
4458
|
-
|
|
4459
|
-
request = new Request(url, {
|
|
4460
|
-
...fetchOptions,
|
|
4461
|
-
signal: composedSignal,
|
|
4462
|
-
method: method.toUpperCase(),
|
|
4463
|
-
headers: headers.normalize().toJSON(),
|
|
4464
|
-
body: data,
|
|
4465
|
-
duplex: "half",
|
|
4466
|
-
withCredentials
|
|
4467
|
-
});
|
|
4468
|
-
|
|
4469
|
-
let response = await fetch(request);
|
|
4470
|
-
|
|
4471
|
-
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
4472
|
-
|
|
4473
|
-
if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
|
|
4474
|
-
const options = {};
|
|
4475
|
-
|
|
4476
|
-
['status', 'statusText', 'headers'].forEach(prop => {
|
|
4477
|
-
options[prop] = response[prop];
|
|
4478
|
-
});
|
|
4479
|
-
|
|
4480
|
-
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
4481
|
-
|
|
4482
|
-
response = new Response(
|
|
4483
|
-
trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(
|
|
4484
|
-
responseContentLength,
|
|
4485
|
-
progressEventReducer(onDownloadProgress, true)
|
|
4486
|
-
), isStreamResponse && onFinish, encodeText),
|
|
4487
|
-
options
|
|
4488
|
-
);
|
|
4489
|
-
}
|
|
4490
|
-
|
|
4491
|
-
responseType = responseType || 'text';
|
|
4492
|
-
|
|
4493
|
-
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
|
|
4494
|
-
|
|
4495
|
-
!isStreamResponse && onFinish();
|
|
4496
|
-
|
|
4497
|
-
stopTimeout && stopTimeout();
|
|
4498
|
-
|
|
4499
|
-
return await new Promise((resolve, reject) => {
|
|
4500
|
-
settle(resolve, reject, {
|
|
4501
|
-
data: responseData,
|
|
4502
|
-
headers: AxiosHeaders$1.from(response.headers),
|
|
4503
|
-
status: response.status,
|
|
4504
|
-
statusText: response.statusText,
|
|
4505
|
-
config,
|
|
4506
|
-
request
|
|
4507
|
-
});
|
|
4508
|
-
})
|
|
4509
|
-
} catch (err) {
|
|
4510
|
-
onFinish();
|
|
4511
|
-
|
|
4512
|
-
if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
|
|
4513
|
-
throw Object.assign(
|
|
4514
|
-
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
|
|
4515
|
-
{
|
|
4516
|
-
cause: err.cause || err
|
|
4517
|
-
}
|
|
4518
|
-
)
|
|
4519
|
-
}
|
|
4520
|
-
|
|
4521
|
-
throw AxiosError.from(err, err && err.code, config, request);
|
|
4522
|
-
}
|
|
4523
|
-
});
|
|
4524
|
-
|
|
4525
4047
|
const knownAdapters = {
|
|
4526
4048
|
http: httpAdapter$1,
|
|
4527
|
-
xhr: xhrAdapter
|
|
4528
|
-
fetch: fetchAdapter
|
|
4049
|
+
xhr: xhrAdapter
|
|
4529
4050
|
};
|
|
4530
4051
|
|
|
4531
4052
|
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
@@ -4669,7 +4190,109 @@ function dispatchRequest(config) {
|
|
|
4669
4190
|
});
|
|
4670
4191
|
}
|
|
4671
4192
|
|
|
4672
|
-
const
|
|
4193
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
|
|
4194
|
+
|
|
4195
|
+
/**
|
|
4196
|
+
* Config-specific merge-function which creates a new config-object
|
|
4197
|
+
* by merging two configuration objects together.
|
|
4198
|
+
*
|
|
4199
|
+
* @param {Object} config1
|
|
4200
|
+
* @param {Object} config2
|
|
4201
|
+
*
|
|
4202
|
+
* @returns {Object} New object resulting from merging config2 to config1
|
|
4203
|
+
*/
|
|
4204
|
+
function mergeConfig(config1, config2) {
|
|
4205
|
+
// eslint-disable-next-line no-param-reassign
|
|
4206
|
+
config2 = config2 || {};
|
|
4207
|
+
const config = {};
|
|
4208
|
+
|
|
4209
|
+
function getMergedValue(target, source, caseless) {
|
|
4210
|
+
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
4211
|
+
return utils$1.merge.call({caseless}, target, source);
|
|
4212
|
+
} else if (utils$1.isPlainObject(source)) {
|
|
4213
|
+
return utils$1.merge({}, source);
|
|
4214
|
+
} else if (utils$1.isArray(source)) {
|
|
4215
|
+
return source.slice();
|
|
4216
|
+
}
|
|
4217
|
+
return source;
|
|
4218
|
+
}
|
|
4219
|
+
|
|
4220
|
+
// eslint-disable-next-line consistent-return
|
|
4221
|
+
function mergeDeepProperties(a, b, caseless) {
|
|
4222
|
+
if (!utils$1.isUndefined(b)) {
|
|
4223
|
+
return getMergedValue(a, b, caseless);
|
|
4224
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
4225
|
+
return getMergedValue(undefined, a, caseless);
|
|
4226
|
+
}
|
|
4227
|
+
}
|
|
4228
|
+
|
|
4229
|
+
// eslint-disable-next-line consistent-return
|
|
4230
|
+
function valueFromConfig2(a, b) {
|
|
4231
|
+
if (!utils$1.isUndefined(b)) {
|
|
4232
|
+
return getMergedValue(undefined, b);
|
|
4233
|
+
}
|
|
4234
|
+
}
|
|
4235
|
+
|
|
4236
|
+
// eslint-disable-next-line consistent-return
|
|
4237
|
+
function defaultToConfig2(a, b) {
|
|
4238
|
+
if (!utils$1.isUndefined(b)) {
|
|
4239
|
+
return getMergedValue(undefined, b);
|
|
4240
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
4241
|
+
return getMergedValue(undefined, a);
|
|
4242
|
+
}
|
|
4243
|
+
}
|
|
4244
|
+
|
|
4245
|
+
// eslint-disable-next-line consistent-return
|
|
4246
|
+
function mergeDirectKeys(a, b, prop) {
|
|
4247
|
+
if (prop in config2) {
|
|
4248
|
+
return getMergedValue(a, b);
|
|
4249
|
+
} else if (prop in config1) {
|
|
4250
|
+
return getMergedValue(undefined, a);
|
|
4251
|
+
}
|
|
4252
|
+
}
|
|
4253
|
+
|
|
4254
|
+
const mergeMap = {
|
|
4255
|
+
url: valueFromConfig2,
|
|
4256
|
+
method: valueFromConfig2,
|
|
4257
|
+
data: valueFromConfig2,
|
|
4258
|
+
baseURL: defaultToConfig2,
|
|
4259
|
+
transformRequest: defaultToConfig2,
|
|
4260
|
+
transformResponse: defaultToConfig2,
|
|
4261
|
+
paramsSerializer: defaultToConfig2,
|
|
4262
|
+
timeout: defaultToConfig2,
|
|
4263
|
+
timeoutMessage: defaultToConfig2,
|
|
4264
|
+
withCredentials: defaultToConfig2,
|
|
4265
|
+
withXSRFToken: defaultToConfig2,
|
|
4266
|
+
adapter: defaultToConfig2,
|
|
4267
|
+
responseType: defaultToConfig2,
|
|
4268
|
+
xsrfCookieName: defaultToConfig2,
|
|
4269
|
+
xsrfHeaderName: defaultToConfig2,
|
|
4270
|
+
onUploadProgress: defaultToConfig2,
|
|
4271
|
+
onDownloadProgress: defaultToConfig2,
|
|
4272
|
+
decompress: defaultToConfig2,
|
|
4273
|
+
maxContentLength: defaultToConfig2,
|
|
4274
|
+
maxBodyLength: defaultToConfig2,
|
|
4275
|
+
beforeRedirect: defaultToConfig2,
|
|
4276
|
+
transport: defaultToConfig2,
|
|
4277
|
+
httpAgent: defaultToConfig2,
|
|
4278
|
+
httpsAgent: defaultToConfig2,
|
|
4279
|
+
cancelToken: defaultToConfig2,
|
|
4280
|
+
socketPath: defaultToConfig2,
|
|
4281
|
+
responseEncoding: defaultToConfig2,
|
|
4282
|
+
validateStatus: mergeDirectKeys,
|
|
4283
|
+
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
4284
|
+
};
|
|
4285
|
+
|
|
4286
|
+
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
4287
|
+
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
4288
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
4289
|
+
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
4290
|
+
});
|
|
4291
|
+
|
|
4292
|
+
return config;
|
|
4293
|
+
}
|
|
4294
|
+
|
|
4295
|
+
const VERSION = "1.6.2";
|
|
4673
4296
|
|
|
4674
4297
|
const validators$1 = {};
|
|
4675
4298
|
|
|
@@ -4784,34 +4407,7 @@ class Axios {
|
|
|
4784
4407
|
*
|
|
4785
4408
|
* @returns {Promise} The Promise to be fulfilled
|
|
4786
4409
|
*/
|
|
4787
|
-
|
|
4788
|
-
try {
|
|
4789
|
-
return await this._request(configOrUrl, config);
|
|
4790
|
-
} catch (err) {
|
|
4791
|
-
if (err instanceof Error) {
|
|
4792
|
-
let dummy;
|
|
4793
|
-
|
|
4794
|
-
Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());
|
|
4795
|
-
|
|
4796
|
-
// slice off the Error: ... line
|
|
4797
|
-
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
|
4798
|
-
try {
|
|
4799
|
-
if (!err.stack) {
|
|
4800
|
-
err.stack = stack;
|
|
4801
|
-
// match without the 2 top stack lines
|
|
4802
|
-
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
|
4803
|
-
err.stack += '\n' + stack;
|
|
4804
|
-
}
|
|
4805
|
-
} catch (e) {
|
|
4806
|
-
// ignore the case where "stack" is an un-writable property
|
|
4807
|
-
}
|
|
4808
|
-
}
|
|
4809
|
-
|
|
4810
|
-
throw err;
|
|
4811
|
-
}
|
|
4812
|
-
}
|
|
4813
|
-
|
|
4814
|
-
_request(configOrUrl, config) {
|
|
4410
|
+
request(configOrUrl, config) {
|
|
4815
4411
|
/*eslint no-param-reassign:0*/
|
|
4816
4412
|
// Allow for axios('example/url'[, config]) a la fetch API
|
|
4817
4413
|
if (typeof configOrUrl === 'string') {
|
|
@@ -5523,32 +5119,20 @@ function copyBuffer (cur) {
|
|
|
5523
5119
|
|
|
5524
5120
|
function rfdc (opts) {
|
|
5525
5121
|
opts = opts || {};
|
|
5526
|
-
if (opts.circles) return rfdcCircles(opts)
|
|
5527
|
-
|
|
5528
|
-
const constructorHandlers = new Map();
|
|
5529
|
-
constructorHandlers.set(Date, (o) => new Date(o));
|
|
5530
|
-
constructorHandlers.set(Map, (o, fn) => new Map(cloneArray(Array.from(o), fn)));
|
|
5531
|
-
constructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)));
|
|
5532
|
-
if (opts.constructorHandlers) {
|
|
5533
|
-
for (const handler of opts.constructorHandlers) {
|
|
5534
|
-
constructorHandlers.set(handler[0], handler[1]);
|
|
5535
|
-
}
|
|
5536
|
-
}
|
|
5537
|
-
|
|
5538
|
-
let handler = null;
|
|
5539
5122
|
|
|
5123
|
+
if (opts.circles) return rfdcCircles(opts)
|
|
5540
5124
|
return opts.proto ? cloneProto : clone
|
|
5541
5125
|
|
|
5542
5126
|
function cloneArray (a, fn) {
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
for (
|
|
5546
|
-
|
|
5547
|
-
|
|
5127
|
+
var keys = Object.keys(a);
|
|
5128
|
+
var a2 = new Array(keys.length);
|
|
5129
|
+
for (var i = 0; i < keys.length; i++) {
|
|
5130
|
+
var k = keys[i];
|
|
5131
|
+
var cur = a[k];
|
|
5548
5132
|
if (typeof cur !== 'object' || cur === null) {
|
|
5549
5133
|
a2[k] = cur;
|
|
5550
|
-
} else if (cur
|
|
5551
|
-
a2[k] =
|
|
5134
|
+
} else if (cur instanceof Date) {
|
|
5135
|
+
a2[k] = new Date(cur);
|
|
5552
5136
|
} else if (ArrayBuffer.isView(cur)) {
|
|
5553
5137
|
a2[k] = copyBuffer(cur);
|
|
5554
5138
|
} else {
|
|
@@ -5560,18 +5144,22 @@ function rfdc (opts) {
|
|
|
5560
5144
|
|
|
5561
5145
|
function clone (o) {
|
|
5562
5146
|
if (typeof o !== 'object' || o === null) return o
|
|
5147
|
+
if (o instanceof Date) return new Date(o)
|
|
5563
5148
|
if (Array.isArray(o)) return cloneArray(o, clone)
|
|
5564
|
-
if (o
|
|
5565
|
-
|
|
5566
|
-
}
|
|
5567
|
-
|
|
5568
|
-
for (const k in o) {
|
|
5149
|
+
if (o instanceof Map) return new Map(cloneArray(Array.from(o), clone))
|
|
5150
|
+
if (o instanceof Set) return new Set(cloneArray(Array.from(o), clone))
|
|
5151
|
+
var o2 = {};
|
|
5152
|
+
for (var k in o) {
|
|
5569
5153
|
if (Object.hasOwnProperty.call(o, k) === false) continue
|
|
5570
|
-
|
|
5154
|
+
var cur = o[k];
|
|
5571
5155
|
if (typeof cur !== 'object' || cur === null) {
|
|
5572
5156
|
o2[k] = cur;
|
|
5573
|
-
} else if (cur
|
|
5574
|
-
o2[k] =
|
|
5157
|
+
} else if (cur instanceof Date) {
|
|
5158
|
+
o2[k] = new Date(cur);
|
|
5159
|
+
} else if (cur instanceof Map) {
|
|
5160
|
+
o2[k] = new Map(cloneArray(Array.from(cur), clone));
|
|
5161
|
+
} else if (cur instanceof Set) {
|
|
5162
|
+
o2[k] = new Set(cloneArray(Array.from(cur), clone));
|
|
5575
5163
|
} else if (ArrayBuffer.isView(cur)) {
|
|
5576
5164
|
o2[k] = copyBuffer(cur);
|
|
5577
5165
|
} else {
|
|
@@ -5583,17 +5171,21 @@ function rfdc (opts) {
|
|
|
5583
5171
|
|
|
5584
5172
|
function cloneProto (o) {
|
|
5585
5173
|
if (typeof o !== 'object' || o === null) return o
|
|
5174
|
+
if (o instanceof Date) return new Date(o)
|
|
5586
5175
|
if (Array.isArray(o)) return cloneArray(o, cloneProto)
|
|
5587
|
-
if (o
|
|
5588
|
-
|
|
5589
|
-
}
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
const cur = o[k];
|
|
5176
|
+
if (o instanceof Map) return new Map(cloneArray(Array.from(o), cloneProto))
|
|
5177
|
+
if (o instanceof Set) return new Set(cloneArray(Array.from(o), cloneProto))
|
|
5178
|
+
var o2 = {};
|
|
5179
|
+
for (var k in o) {
|
|
5180
|
+
var cur = o[k];
|
|
5593
5181
|
if (typeof cur !== 'object' || cur === null) {
|
|
5594
5182
|
o2[k] = cur;
|
|
5595
|
-
} else if (cur
|
|
5596
|
-
o2[k] =
|
|
5183
|
+
} else if (cur instanceof Date) {
|
|
5184
|
+
o2[k] = new Date(cur);
|
|
5185
|
+
} else if (cur instanceof Map) {
|
|
5186
|
+
o2[k] = new Map(cloneArray(Array.from(cur), cloneProto));
|
|
5187
|
+
} else if (cur instanceof Set) {
|
|
5188
|
+
o2[k] = new Set(cloneArray(Array.from(cur), cloneProto));
|
|
5597
5189
|
} else if (ArrayBuffer.isView(cur)) {
|
|
5598
5190
|
o2[k] = copyBuffer(cur);
|
|
5599
5191
|
} else {
|
|
@@ -5605,36 +5197,25 @@ function rfdc (opts) {
|
|
|
5605
5197
|
}
|
|
5606
5198
|
|
|
5607
5199
|
function rfdcCircles (opts) {
|
|
5608
|
-
|
|
5609
|
-
|
|
5200
|
+
var refs = [];
|
|
5201
|
+
var refsNew = [];
|
|
5610
5202
|
|
|
5611
|
-
const constructorHandlers = new Map();
|
|
5612
|
-
constructorHandlers.set(Date, (o) => new Date(o));
|
|
5613
|
-
constructorHandlers.set(Map, (o, fn) => new Map(cloneArray(Array.from(o), fn)));
|
|
5614
|
-
constructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)));
|
|
5615
|
-
if (opts.constructorHandlers) {
|
|
5616
|
-
for (const handler of opts.constructorHandlers) {
|
|
5617
|
-
constructorHandlers.set(handler[0], handler[1]);
|
|
5618
|
-
}
|
|
5619
|
-
}
|
|
5620
|
-
|
|
5621
|
-
let handler = null;
|
|
5622
5203
|
return opts.proto ? cloneProto : clone
|
|
5623
5204
|
|
|
5624
5205
|
function cloneArray (a, fn) {
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
for (
|
|
5628
|
-
|
|
5629
|
-
|
|
5206
|
+
var keys = Object.keys(a);
|
|
5207
|
+
var a2 = new Array(keys.length);
|
|
5208
|
+
for (var i = 0; i < keys.length; i++) {
|
|
5209
|
+
var k = keys[i];
|
|
5210
|
+
var cur = a[k];
|
|
5630
5211
|
if (typeof cur !== 'object' || cur === null) {
|
|
5631
5212
|
a2[k] = cur;
|
|
5632
|
-
} else if (cur
|
|
5633
|
-
a2[k] =
|
|
5213
|
+
} else if (cur instanceof Date) {
|
|
5214
|
+
a2[k] = new Date(cur);
|
|
5634
5215
|
} else if (ArrayBuffer.isView(cur)) {
|
|
5635
5216
|
a2[k] = copyBuffer(cur);
|
|
5636
5217
|
} else {
|
|
5637
|
-
|
|
5218
|
+
var index = refs.indexOf(cur);
|
|
5638
5219
|
if (index !== -1) {
|
|
5639
5220
|
a2[k] = refsNew[index];
|
|
5640
5221
|
} else {
|
|
@@ -5647,24 +5228,28 @@ function rfdcCircles (opts) {
|
|
|
5647
5228
|
|
|
5648
5229
|
function clone (o) {
|
|
5649
5230
|
if (typeof o !== 'object' || o === null) return o
|
|
5231
|
+
if (o instanceof Date) return new Date(o)
|
|
5650
5232
|
if (Array.isArray(o)) return cloneArray(o, clone)
|
|
5651
|
-
if (o
|
|
5652
|
-
|
|
5653
|
-
}
|
|
5654
|
-
const o2 = {};
|
|
5233
|
+
if (o instanceof Map) return new Map(cloneArray(Array.from(o), clone))
|
|
5234
|
+
if (o instanceof Set) return new Set(cloneArray(Array.from(o), clone))
|
|
5235
|
+
var o2 = {};
|
|
5655
5236
|
refs.push(o);
|
|
5656
5237
|
refsNew.push(o2);
|
|
5657
|
-
for (
|
|
5238
|
+
for (var k in o) {
|
|
5658
5239
|
if (Object.hasOwnProperty.call(o, k) === false) continue
|
|
5659
|
-
|
|
5240
|
+
var cur = o[k];
|
|
5660
5241
|
if (typeof cur !== 'object' || cur === null) {
|
|
5661
5242
|
o2[k] = cur;
|
|
5662
|
-
} else if (cur
|
|
5663
|
-
o2[k] =
|
|
5243
|
+
} else if (cur instanceof Date) {
|
|
5244
|
+
o2[k] = new Date(cur);
|
|
5245
|
+
} else if (cur instanceof Map) {
|
|
5246
|
+
o2[k] = new Map(cloneArray(Array.from(cur), clone));
|
|
5247
|
+
} else if (cur instanceof Set) {
|
|
5248
|
+
o2[k] = new Set(cloneArray(Array.from(cur), clone));
|
|
5664
5249
|
} else if (ArrayBuffer.isView(cur)) {
|
|
5665
5250
|
o2[k] = copyBuffer(cur);
|
|
5666
5251
|
} else {
|
|
5667
|
-
|
|
5252
|
+
var i = refs.indexOf(cur);
|
|
5668
5253
|
if (i !== -1) {
|
|
5669
5254
|
o2[k] = refsNew[i];
|
|
5670
5255
|
} else {
|
|
@@ -5679,23 +5264,27 @@ function rfdcCircles (opts) {
|
|
|
5679
5264
|
|
|
5680
5265
|
function cloneProto (o) {
|
|
5681
5266
|
if (typeof o !== 'object' || o === null) return o
|
|
5267
|
+
if (o instanceof Date) return new Date(o)
|
|
5682
5268
|
if (Array.isArray(o)) return cloneArray(o, cloneProto)
|
|
5683
|
-
if (o
|
|
5684
|
-
|
|
5685
|
-
}
|
|
5686
|
-
const o2 = {};
|
|
5269
|
+
if (o instanceof Map) return new Map(cloneArray(Array.from(o), cloneProto))
|
|
5270
|
+
if (o instanceof Set) return new Set(cloneArray(Array.from(o), cloneProto))
|
|
5271
|
+
var o2 = {};
|
|
5687
5272
|
refs.push(o);
|
|
5688
5273
|
refsNew.push(o2);
|
|
5689
|
-
for (
|
|
5690
|
-
|
|
5274
|
+
for (var k in o) {
|
|
5275
|
+
var cur = o[k];
|
|
5691
5276
|
if (typeof cur !== 'object' || cur === null) {
|
|
5692
5277
|
o2[k] = cur;
|
|
5693
|
-
} else if (cur
|
|
5694
|
-
o2[k] =
|
|
5278
|
+
} else if (cur instanceof Date) {
|
|
5279
|
+
o2[k] = new Date(cur);
|
|
5280
|
+
} else if (cur instanceof Map) {
|
|
5281
|
+
o2[k] = new Map(cloneArray(Array.from(cur), cloneProto));
|
|
5282
|
+
} else if (cur instanceof Set) {
|
|
5283
|
+
o2[k] = new Set(cloneArray(Array.from(cur), cloneProto));
|
|
5695
5284
|
} else if (ArrayBuffer.isView(cur)) {
|
|
5696
5285
|
o2[k] = copyBuffer(cur);
|
|
5697
5286
|
} else {
|
|
5698
|
-
|
|
5287
|
+
var i = refs.indexOf(cur);
|
|
5699
5288
|
if (i !== -1) {
|
|
5700
5289
|
o2[k] = refsNew[i];
|
|
5701
5290
|
} else {
|