genesys-cloud-streaming-client 17.2.4-develop.110 → 17.2.4-develop.111
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/cjs/client.js +1 -2
- package/dist/cjs/webrtc.js +0 -4
- package/dist/deploy-info.json +2 -2
- package/dist/es/client.js +1 -2
- package/dist/es/index.bundle.js +779 -307
- package/dist/es/webrtc.js +0 -4
- package/dist/npm/CHANGELOG.md +2 -0
- package/dist/npm/client.js +1 -2
- package/dist/npm/webrtc.js +0 -4
- package/dist/streaming-client.browser.ie.js +6 -6
- package/dist/streaming-client.browser.js +6 -6
- package/dist/v17/streaming-client.browser.ie.js +6 -6
- package/dist/v17/streaming-client.browser.js +6 -6
- package/dist/v17.2.4/streaming-client.browser.ie.js +6 -6
- package/dist/v17.2.4/streaming-client.browser.js +6 -6
- package/package.json +2 -2
package/dist/es/index.bundle.js
CHANGED
|
@@ -1311,6 +1311,8 @@ const isFormData = (thing) => {
|
|
|
1311
1311
|
*/
|
|
1312
1312
|
const isURLSearchParams = kindOfTest('URLSearchParams');
|
|
1313
1313
|
|
|
1314
|
+
const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
|
|
1315
|
+
|
|
1314
1316
|
/**
|
|
1315
1317
|
* Trim excess whitespace off the beginning and end of a string
|
|
1316
1318
|
*
|
|
@@ -1699,8 +1701,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|
|
1699
1701
|
const noop = () => {};
|
|
1700
1702
|
|
|
1701
1703
|
const toFiniteNumber = (value, defaultValue) => {
|
|
1702
|
-
value = +value;
|
|
1703
|
-
return Number.isFinite(value) ? value : defaultValue;
|
|
1704
|
+
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
1704
1705
|
};
|
|
1705
1706
|
|
|
1706
1707
|
const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
|
|
@@ -1770,6 +1771,36 @@ const isAsyncFn = kindOfTest('AsyncFunction');
|
|
|
1770
1771
|
const isThenable = (thing) =>
|
|
1771
1772
|
thing && (isObject$1(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
|
1772
1773
|
|
|
1774
|
+
// original code
|
|
1775
|
+
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
1776
|
+
|
|
1777
|
+
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
1778
|
+
if (setImmediateSupported) {
|
|
1779
|
+
return setImmediate;
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
return postMessageSupported ? ((token, callbacks) => {
|
|
1783
|
+
_global.addEventListener("message", ({source, data}) => {
|
|
1784
|
+
if (source === _global && data === token) {
|
|
1785
|
+
callbacks.length && callbacks.shift()();
|
|
1786
|
+
}
|
|
1787
|
+
}, false);
|
|
1788
|
+
|
|
1789
|
+
return (cb) => {
|
|
1790
|
+
callbacks.push(cb);
|
|
1791
|
+
_global.postMessage(token, "*");
|
|
1792
|
+
}
|
|
1793
|
+
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
1794
|
+
})(
|
|
1795
|
+
typeof setImmediate === 'function',
|
|
1796
|
+
isFunction(_global.postMessage)
|
|
1797
|
+
);
|
|
1798
|
+
|
|
1799
|
+
const asap = typeof queueMicrotask !== 'undefined' ?
|
|
1800
|
+
queueMicrotask.bind(_global) : ( typeof browser$1$1 !== 'undefined' && browser$1$1.nextTick || _setImmediate);
|
|
1801
|
+
|
|
1802
|
+
// *********************
|
|
1803
|
+
|
|
1773
1804
|
var utils$1 = {
|
|
1774
1805
|
isArray: isArray$1,
|
|
1775
1806
|
isArrayBuffer,
|
|
@@ -1781,6 +1812,10 @@ var utils$1 = {
|
|
|
1781
1812
|
isBoolean,
|
|
1782
1813
|
isObject: isObject$1,
|
|
1783
1814
|
isPlainObject,
|
|
1815
|
+
isReadableStream,
|
|
1816
|
+
isRequest,
|
|
1817
|
+
isResponse,
|
|
1818
|
+
isHeaders,
|
|
1784
1819
|
isUndefined,
|
|
1785
1820
|
isDate,
|
|
1786
1821
|
isFile,
|
|
@@ -1821,7 +1856,9 @@ var utils$1 = {
|
|
|
1821
1856
|
isSpecCompliantForm,
|
|
1822
1857
|
toJSONObject,
|
|
1823
1858
|
isAsyncFn,
|
|
1824
|
-
isThenable
|
|
1859
|
+
isThenable,
|
|
1860
|
+
setImmediate: _setImmediate,
|
|
1861
|
+
asap
|
|
1825
1862
|
};
|
|
1826
1863
|
|
|
1827
1864
|
var lookup$1 = [];
|
|
@@ -4345,11 +4382,14 @@ const hasStandardBrowserWebWorkerEnv = (() => {
|
|
|
4345
4382
|
);
|
|
4346
4383
|
})();
|
|
4347
4384
|
|
|
4385
|
+
const origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
4386
|
+
|
|
4348
4387
|
var utils = /*#__PURE__*/Object.freeze({
|
|
4349
4388
|
__proto__: null,
|
|
4350
4389
|
hasBrowserEnv: hasBrowserEnv,
|
|
4351
4390
|
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
4352
|
-
hasStandardBrowserEnv: hasStandardBrowserEnv
|
|
4391
|
+
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
4392
|
+
origin: origin
|
|
4353
4393
|
});
|
|
4354
4394
|
|
|
4355
4395
|
var platform = {
|
|
@@ -4489,7 +4529,7 @@ const defaults = {
|
|
|
4489
4529
|
|
|
4490
4530
|
transitional: transitionalDefaults,
|
|
4491
4531
|
|
|
4492
|
-
adapter: ['xhr', 'http'],
|
|
4532
|
+
adapter: ['xhr', 'http', 'fetch'],
|
|
4493
4533
|
|
|
4494
4534
|
transformRequest: [function transformRequest(data, headers) {
|
|
4495
4535
|
const contentType = headers.getContentType() || '';
|
|
@@ -4503,9 +4543,6 @@ const defaults = {
|
|
|
4503
4543
|
const isFormData = utils$1.isFormData(data);
|
|
4504
4544
|
|
|
4505
4545
|
if (isFormData) {
|
|
4506
|
-
if (!hasJSONContentType) {
|
|
4507
|
-
return data;
|
|
4508
|
-
}
|
|
4509
4546
|
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
4510
4547
|
}
|
|
4511
4548
|
|
|
@@ -4513,7 +4550,8 @@ const defaults = {
|
|
|
4513
4550
|
utils$1.isBuffer(data) ||
|
|
4514
4551
|
utils$1.isStream(data) ||
|
|
4515
4552
|
utils$1.isFile(data) ||
|
|
4516
|
-
utils$1.isBlob(data)
|
|
4553
|
+
utils$1.isBlob(data) ||
|
|
4554
|
+
utils$1.isReadableStream(data)
|
|
4517
4555
|
) {
|
|
4518
4556
|
return data;
|
|
4519
4557
|
}
|
|
@@ -4556,6 +4594,10 @@ const defaults = {
|
|
|
4556
4594
|
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
4557
4595
|
const JSONRequested = this.responseType === 'json';
|
|
4558
4596
|
|
|
4597
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
4598
|
+
return data;
|
|
4599
|
+
}
|
|
4600
|
+
|
|
4559
4601
|
if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
4560
4602
|
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
4561
4603
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
@@ -4759,6 +4801,10 @@ class AxiosHeaders$1 {
|
|
|
4759
4801
|
setHeaders(header, valueOrRewrite);
|
|
4760
4802
|
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
4761
4803
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
4804
|
+
} else if (utils$1.isHeaders(header)) {
|
|
4805
|
+
for (const [key, value] of header.entries()) {
|
|
4806
|
+
setHeader(value, key, rewrite);
|
|
4807
|
+
}
|
|
4762
4808
|
} else {
|
|
4763
4809
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
4764
4810
|
}
|
|
@@ -5026,6 +5072,210 @@ function settle(resolve, reject, response) {
|
|
|
5026
5072
|
}
|
|
5027
5073
|
}
|
|
5028
5074
|
|
|
5075
|
+
function parseProtocol(url) {
|
|
5076
|
+
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
5077
|
+
return match && match[1] || '';
|
|
5078
|
+
}
|
|
5079
|
+
|
|
5080
|
+
/**
|
|
5081
|
+
* Calculate data maxRate
|
|
5082
|
+
* @param {Number} [samplesCount= 10]
|
|
5083
|
+
* @param {Number} [min= 1000]
|
|
5084
|
+
* @returns {Function}
|
|
5085
|
+
*/
|
|
5086
|
+
function speedometer(samplesCount, min) {
|
|
5087
|
+
samplesCount = samplesCount || 10;
|
|
5088
|
+
const bytes = new Array(samplesCount);
|
|
5089
|
+
const timestamps = new Array(samplesCount);
|
|
5090
|
+
let head = 0;
|
|
5091
|
+
let tail = 0;
|
|
5092
|
+
let firstSampleTS;
|
|
5093
|
+
|
|
5094
|
+
min = min !== undefined ? min : 1000;
|
|
5095
|
+
|
|
5096
|
+
return function push(chunkLength) {
|
|
5097
|
+
const now = Date.now();
|
|
5098
|
+
|
|
5099
|
+
const startedAt = timestamps[tail];
|
|
5100
|
+
|
|
5101
|
+
if (!firstSampleTS) {
|
|
5102
|
+
firstSampleTS = now;
|
|
5103
|
+
}
|
|
5104
|
+
|
|
5105
|
+
bytes[head] = chunkLength;
|
|
5106
|
+
timestamps[head] = now;
|
|
5107
|
+
|
|
5108
|
+
let i = tail;
|
|
5109
|
+
let bytesCount = 0;
|
|
5110
|
+
|
|
5111
|
+
while (i !== head) {
|
|
5112
|
+
bytesCount += bytes[i++];
|
|
5113
|
+
i = i % samplesCount;
|
|
5114
|
+
}
|
|
5115
|
+
|
|
5116
|
+
head = (head + 1) % samplesCount;
|
|
5117
|
+
|
|
5118
|
+
if (head === tail) {
|
|
5119
|
+
tail = (tail + 1) % samplesCount;
|
|
5120
|
+
}
|
|
5121
|
+
|
|
5122
|
+
if (now - firstSampleTS < min) {
|
|
5123
|
+
return;
|
|
5124
|
+
}
|
|
5125
|
+
|
|
5126
|
+
const passed = startedAt && now - startedAt;
|
|
5127
|
+
|
|
5128
|
+
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
5129
|
+
};
|
|
5130
|
+
}
|
|
5131
|
+
|
|
5132
|
+
/**
|
|
5133
|
+
* Throttle decorator
|
|
5134
|
+
* @param {Function} fn
|
|
5135
|
+
* @param {Number} freq
|
|
5136
|
+
* @return {Function}
|
|
5137
|
+
*/
|
|
5138
|
+
function throttle$1(fn, freq) {
|
|
5139
|
+
let timestamp = 0;
|
|
5140
|
+
let threshold = 1000 / freq;
|
|
5141
|
+
let lastArgs;
|
|
5142
|
+
let timer;
|
|
5143
|
+
|
|
5144
|
+
const invoke = (args, now = Date.now()) => {
|
|
5145
|
+
timestamp = now;
|
|
5146
|
+
lastArgs = null;
|
|
5147
|
+
if (timer) {
|
|
5148
|
+
clearTimeout(timer);
|
|
5149
|
+
timer = null;
|
|
5150
|
+
}
|
|
5151
|
+
fn.apply(null, args);
|
|
5152
|
+
};
|
|
5153
|
+
|
|
5154
|
+
const throttled = (...args) => {
|
|
5155
|
+
const now = Date.now();
|
|
5156
|
+
const passed = now - timestamp;
|
|
5157
|
+
if ( passed >= threshold) {
|
|
5158
|
+
invoke(args, now);
|
|
5159
|
+
} else {
|
|
5160
|
+
lastArgs = args;
|
|
5161
|
+
if (!timer) {
|
|
5162
|
+
timer = setTimeout(() => {
|
|
5163
|
+
timer = null;
|
|
5164
|
+
invoke(lastArgs);
|
|
5165
|
+
}, threshold - passed);
|
|
5166
|
+
}
|
|
5167
|
+
}
|
|
5168
|
+
};
|
|
5169
|
+
|
|
5170
|
+
const flush = () => lastArgs && invoke(lastArgs);
|
|
5171
|
+
|
|
5172
|
+
return [throttled, flush];
|
|
5173
|
+
}
|
|
5174
|
+
|
|
5175
|
+
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
5176
|
+
let bytesNotified = 0;
|
|
5177
|
+
const _speedometer = speedometer(50, 250);
|
|
5178
|
+
|
|
5179
|
+
return throttle$1(e => {
|
|
5180
|
+
const loaded = e.loaded;
|
|
5181
|
+
const total = e.lengthComputable ? e.total : undefined;
|
|
5182
|
+
const progressBytes = loaded - bytesNotified;
|
|
5183
|
+
const rate = _speedometer(progressBytes);
|
|
5184
|
+
const inRange = loaded <= total;
|
|
5185
|
+
|
|
5186
|
+
bytesNotified = loaded;
|
|
5187
|
+
|
|
5188
|
+
const data = {
|
|
5189
|
+
loaded,
|
|
5190
|
+
total,
|
|
5191
|
+
progress: total ? (loaded / total) : undefined,
|
|
5192
|
+
bytes: progressBytes,
|
|
5193
|
+
rate: rate ? rate : undefined,
|
|
5194
|
+
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
5195
|
+
event: e,
|
|
5196
|
+
lengthComputable: total != null,
|
|
5197
|
+
[isDownloadStream ? 'download' : 'upload']: true
|
|
5198
|
+
};
|
|
5199
|
+
|
|
5200
|
+
listener(data);
|
|
5201
|
+
}, freq);
|
|
5202
|
+
};
|
|
5203
|
+
|
|
5204
|
+
const progressEventDecorator = (total, throttled) => {
|
|
5205
|
+
const lengthComputable = total != null;
|
|
5206
|
+
|
|
5207
|
+
return [(loaded) => throttled[0]({
|
|
5208
|
+
lengthComputable,
|
|
5209
|
+
total,
|
|
5210
|
+
loaded
|
|
5211
|
+
}), throttled[1]];
|
|
5212
|
+
};
|
|
5213
|
+
|
|
5214
|
+
const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
|
|
5215
|
+
|
|
5216
|
+
var isURLSameOrigin = platform.hasStandardBrowserEnv ?
|
|
5217
|
+
|
|
5218
|
+
// Standard browser envs have full support of the APIs needed to test
|
|
5219
|
+
// whether the request URL is of the same origin as current location.
|
|
5220
|
+
(function standardBrowserEnv() {
|
|
5221
|
+
const msie = /(msie|trident)/i.test(navigator.userAgent);
|
|
5222
|
+
const urlParsingNode = document.createElement('a');
|
|
5223
|
+
let originURL;
|
|
5224
|
+
|
|
5225
|
+
/**
|
|
5226
|
+
* Parse a URL to discover its components
|
|
5227
|
+
*
|
|
5228
|
+
* @param {String} url The URL to be parsed
|
|
5229
|
+
* @returns {Object}
|
|
5230
|
+
*/
|
|
5231
|
+
function resolveURL(url) {
|
|
5232
|
+
let href = url;
|
|
5233
|
+
|
|
5234
|
+
if (msie) {
|
|
5235
|
+
// IE needs attribute set twice to normalize properties
|
|
5236
|
+
urlParsingNode.setAttribute('href', href);
|
|
5237
|
+
href = urlParsingNode.href;
|
|
5238
|
+
}
|
|
5239
|
+
|
|
5240
|
+
urlParsingNode.setAttribute('href', href);
|
|
5241
|
+
|
|
5242
|
+
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
|
5243
|
+
return {
|
|
5244
|
+
href: urlParsingNode.href,
|
|
5245
|
+
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
|
5246
|
+
host: urlParsingNode.host,
|
|
5247
|
+
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
|
5248
|
+
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
|
5249
|
+
hostname: urlParsingNode.hostname,
|
|
5250
|
+
port: urlParsingNode.port,
|
|
5251
|
+
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
|
5252
|
+
urlParsingNode.pathname :
|
|
5253
|
+
'/' + urlParsingNode.pathname
|
|
5254
|
+
};
|
|
5255
|
+
}
|
|
5256
|
+
|
|
5257
|
+
originURL = resolveURL(window.location.href);
|
|
5258
|
+
|
|
5259
|
+
/**
|
|
5260
|
+
* Determine if a URL shares the same origin as the current location
|
|
5261
|
+
*
|
|
5262
|
+
* @param {String} requestURL The URL to test
|
|
5263
|
+
* @returns {boolean} True if URL shares the same origin, otherwise false
|
|
5264
|
+
*/
|
|
5265
|
+
return function isURLSameOrigin(requestURL) {
|
|
5266
|
+
const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
|
5267
|
+
return (parsed.protocol === originURL.protocol &&
|
|
5268
|
+
parsed.host === originURL.host);
|
|
5269
|
+
};
|
|
5270
|
+
})() :
|
|
5271
|
+
|
|
5272
|
+
// Non standard browser envs (web workers, react-native) lack needed support.
|
|
5273
|
+
(function nonStandardBrowserEnv() {
|
|
5274
|
+
return function isURLSameOrigin() {
|
|
5275
|
+
return true;
|
|
5276
|
+
};
|
|
5277
|
+
})();
|
|
5278
|
+
|
|
5029
5279
|
var cookies = platform.hasStandardBrowserEnv ?
|
|
5030
5280
|
|
|
5031
5281
|
// Standard browser envs support document.cookie
|
|
@@ -5110,200 +5360,183 @@ function buildFullPath(baseURL, requestedURL) {
|
|
|
5110
5360
|
return requestedURL;
|
|
5111
5361
|
}
|
|
5112
5362
|
|
|
5113
|
-
|
|
5363
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders$2 ? { ...thing } : thing;
|
|
5114
5364
|
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5365
|
+
/**
|
|
5366
|
+
* Config-specific merge-function which creates a new config-object
|
|
5367
|
+
* by merging two configuration objects together.
|
|
5368
|
+
*
|
|
5369
|
+
* @param {Object} config1
|
|
5370
|
+
* @param {Object} config2
|
|
5371
|
+
*
|
|
5372
|
+
* @returns {Object} New object resulting from merging config2 to config1
|
|
5373
|
+
*/
|
|
5374
|
+
function mergeConfig$1(config1, config2) {
|
|
5375
|
+
// eslint-disable-next-line no-param-reassign
|
|
5376
|
+
config2 = config2 || {};
|
|
5377
|
+
const config = {};
|
|
5121
5378
|
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5379
|
+
function getMergedValue(target, source, caseless) {
|
|
5380
|
+
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
5381
|
+
return utils$1.merge.call({caseless}, target, source);
|
|
5382
|
+
} else if (utils$1.isPlainObject(source)) {
|
|
5383
|
+
return utils$1.merge({}, source);
|
|
5384
|
+
} else if (utils$1.isArray(source)) {
|
|
5385
|
+
return source.slice();
|
|
5386
|
+
}
|
|
5387
|
+
return source;
|
|
5388
|
+
}
|
|
5130
5389
|
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5390
|
+
// eslint-disable-next-line consistent-return
|
|
5391
|
+
function mergeDeepProperties(a, b, caseless) {
|
|
5392
|
+
if (!utils$1.isUndefined(b)) {
|
|
5393
|
+
return getMergedValue(a, b, caseless);
|
|
5394
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
5395
|
+
return getMergedValue(undefined, a, caseless);
|
|
5396
|
+
}
|
|
5397
|
+
}
|
|
5136
5398
|
|
|
5137
|
-
|
|
5399
|
+
// eslint-disable-next-line consistent-return
|
|
5400
|
+
function valueFromConfig2(a, b) {
|
|
5401
|
+
if (!utils$1.isUndefined(b)) {
|
|
5402
|
+
return getMergedValue(undefined, b);
|
|
5403
|
+
}
|
|
5404
|
+
}
|
|
5138
5405
|
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
|
5146
|
-
hostname: urlParsingNode.hostname,
|
|
5147
|
-
port: urlParsingNode.port,
|
|
5148
|
-
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
|
5149
|
-
urlParsingNode.pathname :
|
|
5150
|
-
'/' + urlParsingNode.pathname
|
|
5151
|
-
};
|
|
5406
|
+
// eslint-disable-next-line consistent-return
|
|
5407
|
+
function defaultToConfig2(a, b) {
|
|
5408
|
+
if (!utils$1.isUndefined(b)) {
|
|
5409
|
+
return getMergedValue(undefined, b);
|
|
5410
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
5411
|
+
return getMergedValue(undefined, a);
|
|
5152
5412
|
}
|
|
5413
|
+
}
|
|
5153
5414
|
|
|
5154
|
-
|
|
5415
|
+
// eslint-disable-next-line consistent-return
|
|
5416
|
+
function mergeDirectKeys(a, b, prop) {
|
|
5417
|
+
if (prop in config2) {
|
|
5418
|
+
return getMergedValue(a, b);
|
|
5419
|
+
} else if (prop in config1) {
|
|
5420
|
+
return getMergedValue(undefined, a);
|
|
5421
|
+
}
|
|
5422
|
+
}
|
|
5155
5423
|
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5424
|
+
const mergeMap = {
|
|
5425
|
+
url: valueFromConfig2,
|
|
5426
|
+
method: valueFromConfig2,
|
|
5427
|
+
data: valueFromConfig2,
|
|
5428
|
+
baseURL: defaultToConfig2,
|
|
5429
|
+
transformRequest: defaultToConfig2,
|
|
5430
|
+
transformResponse: defaultToConfig2,
|
|
5431
|
+
paramsSerializer: defaultToConfig2,
|
|
5432
|
+
timeout: defaultToConfig2,
|
|
5433
|
+
timeoutMessage: defaultToConfig2,
|
|
5434
|
+
withCredentials: defaultToConfig2,
|
|
5435
|
+
withXSRFToken: defaultToConfig2,
|
|
5436
|
+
adapter: defaultToConfig2,
|
|
5437
|
+
responseType: defaultToConfig2,
|
|
5438
|
+
xsrfCookieName: defaultToConfig2,
|
|
5439
|
+
xsrfHeaderName: defaultToConfig2,
|
|
5440
|
+
onUploadProgress: defaultToConfig2,
|
|
5441
|
+
onDownloadProgress: defaultToConfig2,
|
|
5442
|
+
decompress: defaultToConfig2,
|
|
5443
|
+
maxContentLength: defaultToConfig2,
|
|
5444
|
+
maxBodyLength: defaultToConfig2,
|
|
5445
|
+
beforeRedirect: defaultToConfig2,
|
|
5446
|
+
transport: defaultToConfig2,
|
|
5447
|
+
httpAgent: defaultToConfig2,
|
|
5448
|
+
httpsAgent: defaultToConfig2,
|
|
5449
|
+
cancelToken: defaultToConfig2,
|
|
5450
|
+
socketPath: defaultToConfig2,
|
|
5451
|
+
responseEncoding: defaultToConfig2,
|
|
5452
|
+
validateStatus: mergeDirectKeys,
|
|
5453
|
+
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
5454
|
+
};
|
|
5168
5455
|
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
})();
|
|
5456
|
+
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
5457
|
+
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
5458
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
5459
|
+
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
5460
|
+
});
|
|
5175
5461
|
|
|
5176
|
-
|
|
5177
|
-
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
5178
|
-
return match && match[1] || '';
|
|
5462
|
+
return config;
|
|
5179
5463
|
}
|
|
5180
5464
|
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
* @param {Number} [samplesCount= 10]
|
|
5184
|
-
* @param {Number} [min= 1000]
|
|
5185
|
-
* @returns {Function}
|
|
5186
|
-
*/
|
|
5187
|
-
function speedometer(samplesCount, min) {
|
|
5188
|
-
samplesCount = samplesCount || 10;
|
|
5189
|
-
const bytes = new Array(samplesCount);
|
|
5190
|
-
const timestamps = new Array(samplesCount);
|
|
5191
|
-
let head = 0;
|
|
5192
|
-
let tail = 0;
|
|
5193
|
-
let firstSampleTS;
|
|
5194
|
-
|
|
5195
|
-
min = min !== undefined ? min : 1000;
|
|
5465
|
+
var resolveConfig = (config) => {
|
|
5466
|
+
const newConfig = mergeConfig$1({}, config);
|
|
5196
5467
|
|
|
5197
|
-
|
|
5198
|
-
const now = Date.now();
|
|
5468
|
+
let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
|
|
5199
5469
|
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
if (!firstSampleTS) {
|
|
5203
|
-
firstSampleTS = now;
|
|
5204
|
-
}
|
|
5205
|
-
|
|
5206
|
-
bytes[head] = chunkLength;
|
|
5207
|
-
timestamps[head] = now;
|
|
5208
|
-
|
|
5209
|
-
let i = tail;
|
|
5210
|
-
let bytesCount = 0;
|
|
5470
|
+
newConfig.headers = headers = AxiosHeaders$2.from(headers);
|
|
5211
5471
|
|
|
5212
|
-
|
|
5213
|
-
bytesCount += bytes[i++];
|
|
5214
|
-
i = i % samplesCount;
|
|
5215
|
-
}
|
|
5472
|
+
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
|
|
5216
5473
|
|
|
5217
|
-
|
|
5474
|
+
// HTTP basic authentication
|
|
5475
|
+
if (auth) {
|
|
5476
|
+
headers.set('Authorization', 'Basic ' +
|
|
5477
|
+
btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
|
|
5478
|
+
);
|
|
5479
|
+
}
|
|
5218
5480
|
|
|
5219
|
-
|
|
5220
|
-
tail = (tail + 1) % samplesCount;
|
|
5221
|
-
}
|
|
5481
|
+
let contentType;
|
|
5222
5482
|
|
|
5223
|
-
|
|
5224
|
-
|
|
5483
|
+
if (utils$1.isFormData(data)) {
|
|
5484
|
+
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
5485
|
+
headers.setContentType(undefined); // Let the browser set it
|
|
5486
|
+
} else if ((contentType = headers.getContentType()) !== false) {
|
|
5487
|
+
// fix semicolon duplication issue for ReactNative FormData implementation
|
|
5488
|
+
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
|
|
5489
|
+
headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
|
|
5225
5490
|
}
|
|
5491
|
+
}
|
|
5226
5492
|
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
};
|
|
5231
|
-
}
|
|
5232
|
-
|
|
5233
|
-
function progressEventReducer(listener, isDownloadStream) {
|
|
5234
|
-
let bytesNotified = 0;
|
|
5235
|
-
const _speedometer = speedometer(50, 250);
|
|
5236
|
-
|
|
5237
|
-
return e => {
|
|
5238
|
-
const loaded = e.loaded;
|
|
5239
|
-
const total = e.lengthComputable ? e.total : undefined;
|
|
5240
|
-
const progressBytes = loaded - bytesNotified;
|
|
5241
|
-
const rate = _speedometer(progressBytes);
|
|
5242
|
-
const inRange = loaded <= total;
|
|
5493
|
+
// Add xsrf header
|
|
5494
|
+
// This is only done if running in a standard browser environment.
|
|
5495
|
+
// Specifically not if we're in a web worker, or react-native.
|
|
5243
5496
|
|
|
5244
|
-
|
|
5497
|
+
if (platform.hasStandardBrowserEnv) {
|
|
5498
|
+
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
|
|
5245
5499
|
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
progress: total ? (loaded / total) : undefined,
|
|
5250
|
-
bytes: progressBytes,
|
|
5251
|
-
rate: rate ? rate : undefined,
|
|
5252
|
-
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
5253
|
-
event: e
|
|
5254
|
-
};
|
|
5500
|
+
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
|
|
5501
|
+
// Add xsrf header
|
|
5502
|
+
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
5255
5503
|
|
|
5256
|
-
|
|
5504
|
+
if (xsrfValue) {
|
|
5505
|
+
headers.set(xsrfHeaderName, xsrfValue);
|
|
5506
|
+
}
|
|
5507
|
+
}
|
|
5508
|
+
}
|
|
5257
5509
|
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
}
|
|
5510
|
+
return newConfig;
|
|
5511
|
+
};
|
|
5261
5512
|
|
|
5262
5513
|
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
5263
5514
|
|
|
5264
5515
|
var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
5265
5516
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5517
|
+
const _config = resolveConfig(config);
|
|
5518
|
+
let requestData = _config.data;
|
|
5519
|
+
const requestHeaders = AxiosHeaders$2.from(_config.headers).normalize();
|
|
5520
|
+
let {responseType, onUploadProgress, onDownloadProgress} = _config;
|
|
5269
5521
|
let onCanceled;
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
config.cancelToken.unsubscribe(onCanceled);
|
|
5273
|
-
}
|
|
5522
|
+
let uploadThrottled, downloadThrottled;
|
|
5523
|
+
let flushUpload, flushDownload;
|
|
5274
5524
|
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
}
|
|
5525
|
+
function done() {
|
|
5526
|
+
flushUpload && flushUpload(); // flush events
|
|
5527
|
+
flushDownload && flushDownload(); // flush events
|
|
5279
5528
|
|
|
5280
|
-
|
|
5529
|
+
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
5281
5530
|
|
|
5282
|
-
|
|
5283
|
-
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
5284
|
-
requestHeaders.setContentType(false); // Let the browser set it
|
|
5285
|
-
} else if ((contentType = requestHeaders.getContentType()) !== false) {
|
|
5286
|
-
// fix semicolon duplication issue for ReactNative FormData implementation
|
|
5287
|
-
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
|
|
5288
|
-
requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
|
|
5289
|
-
}
|
|
5531
|
+
_config.signal && _config.signal.removeEventListener('abort', onCanceled);
|
|
5290
5532
|
}
|
|
5291
5533
|
|
|
5292
5534
|
let request = new XMLHttpRequest();
|
|
5293
5535
|
|
|
5294
|
-
|
|
5295
|
-
if (config.auth) {
|
|
5296
|
-
const username = config.auth.username || '';
|
|
5297
|
-
const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
|
5298
|
-
requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
|
|
5299
|
-
}
|
|
5300
|
-
|
|
5301
|
-
const fullPath = buildFullPath(config.baseURL, config.url);
|
|
5302
|
-
|
|
5303
|
-
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
|
5536
|
+
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
5304
5537
|
|
|
5305
5538
|
// Set the request timeout in MS
|
|
5306
|
-
request.timeout =
|
|
5539
|
+
request.timeout = _config.timeout;
|
|
5307
5540
|
|
|
5308
5541
|
function onloadend() {
|
|
5309
5542
|
if (!request) {
|
|
@@ -5383,10 +5616,10 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
5383
5616
|
|
|
5384
5617
|
// Handle timeout
|
|
5385
5618
|
request.ontimeout = function handleTimeout() {
|
|
5386
|
-
let timeoutErrorMessage =
|
|
5387
|
-
const transitional =
|
|
5388
|
-
if (
|
|
5389
|
-
timeoutErrorMessage =
|
|
5619
|
+
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
5620
|
+
const transitional = _config.transitional || transitionalDefaults;
|
|
5621
|
+
if (_config.timeoutErrorMessage) {
|
|
5622
|
+
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
5390
5623
|
}
|
|
5391
5624
|
reject(new AxiosError$1(
|
|
5392
5625
|
timeoutErrorMessage,
|
|
@@ -5398,22 +5631,6 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
5398
5631
|
request = null;
|
|
5399
5632
|
};
|
|
5400
5633
|
|
|
5401
|
-
// Add xsrf header
|
|
5402
|
-
// This is only done if running in a standard browser environment.
|
|
5403
|
-
// Specifically not if we're in a web worker, or react-native.
|
|
5404
|
-
if(platform.hasStandardBrowserEnv) {
|
|
5405
|
-
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
|
|
5406
|
-
|
|
5407
|
-
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
|
|
5408
|
-
// Add xsrf header
|
|
5409
|
-
const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
|
5410
|
-
|
|
5411
|
-
if (xsrfValue) {
|
|
5412
|
-
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
|
5413
|
-
}
|
|
5414
|
-
}
|
|
5415
|
-
}
|
|
5416
|
-
|
|
5417
5634
|
// Remove Content-Type if data is undefined
|
|
5418
5635
|
requestData === undefined && requestHeaders.setContentType(null);
|
|
5419
5636
|
|
|
@@ -5425,26 +5642,31 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
5425
5642
|
}
|
|
5426
5643
|
|
|
5427
5644
|
// Add withCredentials to request if needed
|
|
5428
|
-
if (!utils$1.isUndefined(
|
|
5429
|
-
request.withCredentials = !!
|
|
5645
|
+
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
5646
|
+
request.withCredentials = !!_config.withCredentials;
|
|
5430
5647
|
}
|
|
5431
5648
|
|
|
5432
5649
|
// Add responseType to request if needed
|
|
5433
5650
|
if (responseType && responseType !== 'json') {
|
|
5434
|
-
request.responseType =
|
|
5651
|
+
request.responseType = _config.responseType;
|
|
5435
5652
|
}
|
|
5436
5653
|
|
|
5437
5654
|
// Handle progress if needed
|
|
5438
|
-
if (
|
|
5439
|
-
|
|
5655
|
+
if (onDownloadProgress) {
|
|
5656
|
+
([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
|
|
5657
|
+
request.addEventListener('progress', downloadThrottled);
|
|
5440
5658
|
}
|
|
5441
5659
|
|
|
5442
5660
|
// Not all browsers support upload events
|
|
5443
|
-
if (
|
|
5444
|
-
|
|
5661
|
+
if (onUploadProgress && request.upload) {
|
|
5662
|
+
([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
|
|
5663
|
+
|
|
5664
|
+
request.upload.addEventListener('progress', uploadThrottled);
|
|
5665
|
+
|
|
5666
|
+
request.upload.addEventListener('loadend', flushUpload);
|
|
5445
5667
|
}
|
|
5446
5668
|
|
|
5447
|
-
if (
|
|
5669
|
+
if (_config.cancelToken || _config.signal) {
|
|
5448
5670
|
// Handle cancellation
|
|
5449
5671
|
// eslint-disable-next-line func-names
|
|
5450
5672
|
onCanceled = cancel => {
|
|
@@ -5456,13 +5678,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
5456
5678
|
request = null;
|
|
5457
5679
|
};
|
|
5458
5680
|
|
|
5459
|
-
|
|
5460
|
-
if (
|
|
5461
|
-
|
|
5681
|
+
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
5682
|
+
if (_config.signal) {
|
|
5683
|
+
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
|
|
5462
5684
|
}
|
|
5463
5685
|
}
|
|
5464
5686
|
|
|
5465
|
-
const protocol = parseProtocol(
|
|
5687
|
+
const protocol = parseProtocol(_config.url);
|
|
5466
5688
|
|
|
5467
5689
|
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
5468
5690
|
reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
|
|
@@ -5475,9 +5697,339 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
5475
5697
|
});
|
|
5476
5698
|
};
|
|
5477
5699
|
|
|
5700
|
+
const composeSignals = (signals, timeout) => {
|
|
5701
|
+
let controller = new AbortController();
|
|
5702
|
+
|
|
5703
|
+
let aborted;
|
|
5704
|
+
|
|
5705
|
+
const onabort = function (cancel) {
|
|
5706
|
+
if (!aborted) {
|
|
5707
|
+
aborted = true;
|
|
5708
|
+
unsubscribe();
|
|
5709
|
+
const err = cancel instanceof Error ? cancel : this.reason;
|
|
5710
|
+
controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
|
|
5711
|
+
}
|
|
5712
|
+
};
|
|
5713
|
+
|
|
5714
|
+
let timer = timeout && setTimeout(() => {
|
|
5715
|
+
onabort(new AxiosError$1(`timeout ${timeout} of ms exceeded`, AxiosError$1.ETIMEDOUT));
|
|
5716
|
+
}, timeout);
|
|
5717
|
+
|
|
5718
|
+
const unsubscribe = () => {
|
|
5719
|
+
if (signals) {
|
|
5720
|
+
timer && clearTimeout(timer);
|
|
5721
|
+
timer = null;
|
|
5722
|
+
signals.forEach(signal => {
|
|
5723
|
+
signal &&
|
|
5724
|
+
(signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));
|
|
5725
|
+
});
|
|
5726
|
+
signals = null;
|
|
5727
|
+
}
|
|
5728
|
+
};
|
|
5729
|
+
|
|
5730
|
+
signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));
|
|
5731
|
+
|
|
5732
|
+
const {signal} = controller;
|
|
5733
|
+
|
|
5734
|
+
signal.unsubscribe = unsubscribe;
|
|
5735
|
+
|
|
5736
|
+
return [signal, () => {
|
|
5737
|
+
timer && clearTimeout(timer);
|
|
5738
|
+
timer = null;
|
|
5739
|
+
}];
|
|
5740
|
+
};
|
|
5741
|
+
|
|
5742
|
+
var composeSignals$1 = composeSignals;
|
|
5743
|
+
|
|
5744
|
+
const streamChunk = function* (chunk, chunkSize) {
|
|
5745
|
+
let len = chunk.byteLength;
|
|
5746
|
+
|
|
5747
|
+
if (!chunkSize || len < chunkSize) {
|
|
5748
|
+
yield chunk;
|
|
5749
|
+
return;
|
|
5750
|
+
}
|
|
5751
|
+
|
|
5752
|
+
let pos = 0;
|
|
5753
|
+
let end;
|
|
5754
|
+
|
|
5755
|
+
while (pos < len) {
|
|
5756
|
+
end = pos + chunkSize;
|
|
5757
|
+
yield chunk.slice(pos, end);
|
|
5758
|
+
pos = end;
|
|
5759
|
+
}
|
|
5760
|
+
};
|
|
5761
|
+
|
|
5762
|
+
const readBytes = async function* (iterable, chunkSize, encode) {
|
|
5763
|
+
for await (const chunk of iterable) {
|
|
5764
|
+
yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);
|
|
5765
|
+
}
|
|
5766
|
+
};
|
|
5767
|
+
|
|
5768
|
+
const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
|
|
5769
|
+
const iterator = readBytes(stream, chunkSize, encode);
|
|
5770
|
+
|
|
5771
|
+
let bytes = 0;
|
|
5772
|
+
let done;
|
|
5773
|
+
let _onFinish = (e) => {
|
|
5774
|
+
if (!done) {
|
|
5775
|
+
done = true;
|
|
5776
|
+
onFinish && onFinish(e);
|
|
5777
|
+
}
|
|
5778
|
+
};
|
|
5779
|
+
|
|
5780
|
+
return new ReadableStream({
|
|
5781
|
+
async pull(controller) {
|
|
5782
|
+
try {
|
|
5783
|
+
const {done, value} = await iterator.next();
|
|
5784
|
+
|
|
5785
|
+
if (done) {
|
|
5786
|
+
_onFinish();
|
|
5787
|
+
controller.close();
|
|
5788
|
+
return;
|
|
5789
|
+
}
|
|
5790
|
+
|
|
5791
|
+
let len = value.byteLength;
|
|
5792
|
+
if (onProgress) {
|
|
5793
|
+
let loadedBytes = bytes += len;
|
|
5794
|
+
onProgress(loadedBytes);
|
|
5795
|
+
}
|
|
5796
|
+
controller.enqueue(new Uint8Array(value));
|
|
5797
|
+
} catch (err) {
|
|
5798
|
+
_onFinish(err);
|
|
5799
|
+
throw err;
|
|
5800
|
+
}
|
|
5801
|
+
},
|
|
5802
|
+
cancel(reason) {
|
|
5803
|
+
_onFinish(reason);
|
|
5804
|
+
return iterator.return();
|
|
5805
|
+
}
|
|
5806
|
+
}, {
|
|
5807
|
+
highWaterMark: 2
|
|
5808
|
+
})
|
|
5809
|
+
};
|
|
5810
|
+
|
|
5811
|
+
const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
|
|
5812
|
+
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
|
|
5813
|
+
|
|
5814
|
+
// used only inside the fetch adapter
|
|
5815
|
+
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
5816
|
+
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
5817
|
+
async (str) => new Uint8Array(await new Response(str).arrayBuffer())
|
|
5818
|
+
);
|
|
5819
|
+
|
|
5820
|
+
const test = (fn, ...args) => {
|
|
5821
|
+
try {
|
|
5822
|
+
return !!fn(...args);
|
|
5823
|
+
} catch (e) {
|
|
5824
|
+
return false
|
|
5825
|
+
}
|
|
5826
|
+
};
|
|
5827
|
+
|
|
5828
|
+
const supportsRequestStream = isReadableStreamSupported && test(() => {
|
|
5829
|
+
let duplexAccessed = false;
|
|
5830
|
+
|
|
5831
|
+
const hasContentType = new Request(platform.origin, {
|
|
5832
|
+
body: new ReadableStream(),
|
|
5833
|
+
method: 'POST',
|
|
5834
|
+
get duplex() {
|
|
5835
|
+
duplexAccessed = true;
|
|
5836
|
+
return 'half';
|
|
5837
|
+
},
|
|
5838
|
+
}).headers.has('Content-Type');
|
|
5839
|
+
|
|
5840
|
+
return duplexAccessed && !hasContentType;
|
|
5841
|
+
});
|
|
5842
|
+
|
|
5843
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
5844
|
+
|
|
5845
|
+
const supportsResponseStream = isReadableStreamSupported &&
|
|
5846
|
+
test(() => utils$1.isReadableStream(new Response('').body));
|
|
5847
|
+
|
|
5848
|
+
|
|
5849
|
+
const resolvers = {
|
|
5850
|
+
stream: supportsResponseStream && ((res) => res.body)
|
|
5851
|
+
};
|
|
5852
|
+
|
|
5853
|
+
isFetchSupported && (((res) => {
|
|
5854
|
+
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
5855
|
+
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
|
|
5856
|
+
(_, config) => {
|
|
5857
|
+
throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
|
|
5858
|
+
});
|
|
5859
|
+
});
|
|
5860
|
+
})(new Response));
|
|
5861
|
+
|
|
5862
|
+
const getBodyLength = async (body) => {
|
|
5863
|
+
if (body == null) {
|
|
5864
|
+
return 0;
|
|
5865
|
+
}
|
|
5866
|
+
|
|
5867
|
+
if(utils$1.isBlob(body)) {
|
|
5868
|
+
return body.size;
|
|
5869
|
+
}
|
|
5870
|
+
|
|
5871
|
+
if(utils$1.isSpecCompliantForm(body)) {
|
|
5872
|
+
return (await new Request(body).arrayBuffer()).byteLength;
|
|
5873
|
+
}
|
|
5874
|
+
|
|
5875
|
+
if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
5876
|
+
return body.byteLength;
|
|
5877
|
+
}
|
|
5878
|
+
|
|
5879
|
+
if(utils$1.isURLSearchParams(body)) {
|
|
5880
|
+
body = body + '';
|
|
5881
|
+
}
|
|
5882
|
+
|
|
5883
|
+
if(utils$1.isString(body)) {
|
|
5884
|
+
return (await encodeText(body)).byteLength;
|
|
5885
|
+
}
|
|
5886
|
+
};
|
|
5887
|
+
|
|
5888
|
+
const resolveBodyLength = async (headers, body) => {
|
|
5889
|
+
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
5890
|
+
|
|
5891
|
+
return length == null ? getBodyLength(body) : length;
|
|
5892
|
+
};
|
|
5893
|
+
|
|
5894
|
+
var fetchAdapter = isFetchSupported && (async (config) => {
|
|
5895
|
+
let {
|
|
5896
|
+
url,
|
|
5897
|
+
method,
|
|
5898
|
+
data,
|
|
5899
|
+
signal,
|
|
5900
|
+
cancelToken,
|
|
5901
|
+
timeout,
|
|
5902
|
+
onDownloadProgress,
|
|
5903
|
+
onUploadProgress,
|
|
5904
|
+
responseType,
|
|
5905
|
+
headers,
|
|
5906
|
+
withCredentials = 'same-origin',
|
|
5907
|
+
fetchOptions
|
|
5908
|
+
} = resolveConfig(config);
|
|
5909
|
+
|
|
5910
|
+
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
5911
|
+
|
|
5912
|
+
let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?
|
|
5913
|
+
composeSignals$1([signal, cancelToken], timeout) : [];
|
|
5914
|
+
|
|
5915
|
+
let finished, request;
|
|
5916
|
+
|
|
5917
|
+
const onFinish = () => {
|
|
5918
|
+
!finished && setTimeout(() => {
|
|
5919
|
+
composedSignal && composedSignal.unsubscribe();
|
|
5920
|
+
});
|
|
5921
|
+
|
|
5922
|
+
finished = true;
|
|
5923
|
+
};
|
|
5924
|
+
|
|
5925
|
+
let requestContentLength;
|
|
5926
|
+
|
|
5927
|
+
try {
|
|
5928
|
+
if (
|
|
5929
|
+
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
|
|
5930
|
+
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
5931
|
+
) {
|
|
5932
|
+
let _request = new Request(url, {
|
|
5933
|
+
method: 'POST',
|
|
5934
|
+
body: data,
|
|
5935
|
+
duplex: "half"
|
|
5936
|
+
});
|
|
5937
|
+
|
|
5938
|
+
let contentTypeHeader;
|
|
5939
|
+
|
|
5940
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
5941
|
+
headers.setContentType(contentTypeHeader);
|
|
5942
|
+
}
|
|
5943
|
+
|
|
5944
|
+
if (_request.body) {
|
|
5945
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
5946
|
+
requestContentLength,
|
|
5947
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
5948
|
+
);
|
|
5949
|
+
|
|
5950
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush, encodeText);
|
|
5951
|
+
}
|
|
5952
|
+
}
|
|
5953
|
+
|
|
5954
|
+
if (!utils$1.isString(withCredentials)) {
|
|
5955
|
+
withCredentials = withCredentials ? 'include' : 'omit';
|
|
5956
|
+
}
|
|
5957
|
+
|
|
5958
|
+
request = new Request(url, {
|
|
5959
|
+
...fetchOptions,
|
|
5960
|
+
signal: composedSignal,
|
|
5961
|
+
method: method.toUpperCase(),
|
|
5962
|
+
headers: headers.normalize().toJSON(),
|
|
5963
|
+
body: data,
|
|
5964
|
+
duplex: "half",
|
|
5965
|
+
credentials: withCredentials
|
|
5966
|
+
});
|
|
5967
|
+
|
|
5968
|
+
let response = await fetch(request);
|
|
5969
|
+
|
|
5970
|
+
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
5971
|
+
|
|
5972
|
+
if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
|
|
5973
|
+
const options = {};
|
|
5974
|
+
|
|
5975
|
+
['status', 'statusText', 'headers'].forEach(prop => {
|
|
5976
|
+
options[prop] = response[prop];
|
|
5977
|
+
});
|
|
5978
|
+
|
|
5979
|
+
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
5980
|
+
|
|
5981
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
5982
|
+
responseContentLength,
|
|
5983
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
5984
|
+
) || [];
|
|
5985
|
+
|
|
5986
|
+
response = new Response(
|
|
5987
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
5988
|
+
flush && flush();
|
|
5989
|
+
isStreamResponse && onFinish();
|
|
5990
|
+
}, encodeText),
|
|
5991
|
+
options
|
|
5992
|
+
);
|
|
5993
|
+
}
|
|
5994
|
+
|
|
5995
|
+
responseType = responseType || 'text';
|
|
5996
|
+
|
|
5997
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
|
|
5998
|
+
|
|
5999
|
+
!isStreamResponse && onFinish();
|
|
6000
|
+
|
|
6001
|
+
stopTimeout && stopTimeout();
|
|
6002
|
+
|
|
6003
|
+
return await new Promise((resolve, reject) => {
|
|
6004
|
+
settle(resolve, reject, {
|
|
6005
|
+
data: responseData,
|
|
6006
|
+
headers: AxiosHeaders$2.from(response.headers),
|
|
6007
|
+
status: response.status,
|
|
6008
|
+
statusText: response.statusText,
|
|
6009
|
+
config,
|
|
6010
|
+
request
|
|
6011
|
+
});
|
|
6012
|
+
})
|
|
6013
|
+
} catch (err) {
|
|
6014
|
+
onFinish();
|
|
6015
|
+
|
|
6016
|
+
if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
|
|
6017
|
+
throw Object.assign(
|
|
6018
|
+
new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
|
|
6019
|
+
{
|
|
6020
|
+
cause: err.cause || err
|
|
6021
|
+
}
|
|
6022
|
+
)
|
|
6023
|
+
}
|
|
6024
|
+
|
|
6025
|
+
throw AxiosError$1.from(err, err && err.code, config, request);
|
|
6026
|
+
}
|
|
6027
|
+
});
|
|
6028
|
+
|
|
5478
6029
|
const knownAdapters = {
|
|
5479
6030
|
http: httpAdapter,
|
|
5480
|
-
xhr: xhrAdapter
|
|
6031
|
+
xhr: xhrAdapter,
|
|
6032
|
+
fetch: fetchAdapter
|
|
5481
6033
|
};
|
|
5482
6034
|
|
|
5483
6035
|
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
@@ -5621,109 +6173,7 @@ function dispatchRequest(config) {
|
|
|
5621
6173
|
});
|
|
5622
6174
|
}
|
|
5623
6175
|
|
|
5624
|
-
const
|
|
5625
|
-
|
|
5626
|
-
/**
|
|
5627
|
-
* Config-specific merge-function which creates a new config-object
|
|
5628
|
-
* by merging two configuration objects together.
|
|
5629
|
-
*
|
|
5630
|
-
* @param {Object} config1
|
|
5631
|
-
* @param {Object} config2
|
|
5632
|
-
*
|
|
5633
|
-
* @returns {Object} New object resulting from merging config2 to config1
|
|
5634
|
-
*/
|
|
5635
|
-
function mergeConfig$1(config1, config2) {
|
|
5636
|
-
// eslint-disable-next-line no-param-reassign
|
|
5637
|
-
config2 = config2 || {};
|
|
5638
|
-
const config = {};
|
|
5639
|
-
|
|
5640
|
-
function getMergedValue(target, source, caseless) {
|
|
5641
|
-
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
5642
|
-
return utils$1.merge.call({caseless}, target, source);
|
|
5643
|
-
} else if (utils$1.isPlainObject(source)) {
|
|
5644
|
-
return utils$1.merge({}, source);
|
|
5645
|
-
} else if (utils$1.isArray(source)) {
|
|
5646
|
-
return source.slice();
|
|
5647
|
-
}
|
|
5648
|
-
return source;
|
|
5649
|
-
}
|
|
5650
|
-
|
|
5651
|
-
// eslint-disable-next-line consistent-return
|
|
5652
|
-
function mergeDeepProperties(a, b, caseless) {
|
|
5653
|
-
if (!utils$1.isUndefined(b)) {
|
|
5654
|
-
return getMergedValue(a, b, caseless);
|
|
5655
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
5656
|
-
return getMergedValue(undefined, a, caseless);
|
|
5657
|
-
}
|
|
5658
|
-
}
|
|
5659
|
-
|
|
5660
|
-
// eslint-disable-next-line consistent-return
|
|
5661
|
-
function valueFromConfig2(a, b) {
|
|
5662
|
-
if (!utils$1.isUndefined(b)) {
|
|
5663
|
-
return getMergedValue(undefined, b);
|
|
5664
|
-
}
|
|
5665
|
-
}
|
|
5666
|
-
|
|
5667
|
-
// eslint-disable-next-line consistent-return
|
|
5668
|
-
function defaultToConfig2(a, b) {
|
|
5669
|
-
if (!utils$1.isUndefined(b)) {
|
|
5670
|
-
return getMergedValue(undefined, b);
|
|
5671
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
5672
|
-
return getMergedValue(undefined, a);
|
|
5673
|
-
}
|
|
5674
|
-
}
|
|
5675
|
-
|
|
5676
|
-
// eslint-disable-next-line consistent-return
|
|
5677
|
-
function mergeDirectKeys(a, b, prop) {
|
|
5678
|
-
if (prop in config2) {
|
|
5679
|
-
return getMergedValue(a, b);
|
|
5680
|
-
} else if (prop in config1) {
|
|
5681
|
-
return getMergedValue(undefined, a);
|
|
5682
|
-
}
|
|
5683
|
-
}
|
|
5684
|
-
|
|
5685
|
-
const mergeMap = {
|
|
5686
|
-
url: valueFromConfig2,
|
|
5687
|
-
method: valueFromConfig2,
|
|
5688
|
-
data: valueFromConfig2,
|
|
5689
|
-
baseURL: defaultToConfig2,
|
|
5690
|
-
transformRequest: defaultToConfig2,
|
|
5691
|
-
transformResponse: defaultToConfig2,
|
|
5692
|
-
paramsSerializer: defaultToConfig2,
|
|
5693
|
-
timeout: defaultToConfig2,
|
|
5694
|
-
timeoutMessage: defaultToConfig2,
|
|
5695
|
-
withCredentials: defaultToConfig2,
|
|
5696
|
-
withXSRFToken: defaultToConfig2,
|
|
5697
|
-
adapter: defaultToConfig2,
|
|
5698
|
-
responseType: defaultToConfig2,
|
|
5699
|
-
xsrfCookieName: defaultToConfig2,
|
|
5700
|
-
xsrfHeaderName: defaultToConfig2,
|
|
5701
|
-
onUploadProgress: defaultToConfig2,
|
|
5702
|
-
onDownloadProgress: defaultToConfig2,
|
|
5703
|
-
decompress: defaultToConfig2,
|
|
5704
|
-
maxContentLength: defaultToConfig2,
|
|
5705
|
-
maxBodyLength: defaultToConfig2,
|
|
5706
|
-
beforeRedirect: defaultToConfig2,
|
|
5707
|
-
transport: defaultToConfig2,
|
|
5708
|
-
httpAgent: defaultToConfig2,
|
|
5709
|
-
httpsAgent: defaultToConfig2,
|
|
5710
|
-
cancelToken: defaultToConfig2,
|
|
5711
|
-
socketPath: defaultToConfig2,
|
|
5712
|
-
responseEncoding: defaultToConfig2,
|
|
5713
|
-
validateStatus: mergeDirectKeys,
|
|
5714
|
-
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
5715
|
-
};
|
|
5716
|
-
|
|
5717
|
-
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
5718
|
-
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
5719
|
-
const configValue = merge(config1[prop], config2[prop], prop);
|
|
5720
|
-
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
5721
|
-
});
|
|
5722
|
-
|
|
5723
|
-
return config;
|
|
5724
|
-
}
|
|
5725
|
-
|
|
5726
|
-
const VERSION$1 = "1.6.5";
|
|
6176
|
+
const VERSION$1 = "1.7.4";
|
|
5727
6177
|
|
|
5728
6178
|
const validators$1 = {};
|
|
5729
6179
|
|
|
@@ -5838,7 +6288,34 @@ class Axios$1 {
|
|
|
5838
6288
|
*
|
|
5839
6289
|
* @returns {Promise} The Promise to be fulfilled
|
|
5840
6290
|
*/
|
|
5841
|
-
request(configOrUrl, config) {
|
|
6291
|
+
async request(configOrUrl, config) {
|
|
6292
|
+
try {
|
|
6293
|
+
return await this._request(configOrUrl, config);
|
|
6294
|
+
} catch (err) {
|
|
6295
|
+
if (err instanceof Error) {
|
|
6296
|
+
let dummy;
|
|
6297
|
+
|
|
6298
|
+
Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());
|
|
6299
|
+
|
|
6300
|
+
// slice off the Error: ... line
|
|
6301
|
+
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
|
6302
|
+
try {
|
|
6303
|
+
if (!err.stack) {
|
|
6304
|
+
err.stack = stack;
|
|
6305
|
+
// match without the 2 top stack lines
|
|
6306
|
+
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
|
6307
|
+
err.stack += '\n' + stack;
|
|
6308
|
+
}
|
|
6309
|
+
} catch (e) {
|
|
6310
|
+
// ignore the case where "stack" is an un-writable property
|
|
6311
|
+
}
|
|
6312
|
+
}
|
|
6313
|
+
|
|
6314
|
+
throw err;
|
|
6315
|
+
}
|
|
6316
|
+
}
|
|
6317
|
+
|
|
6318
|
+
_request(configOrUrl, config) {
|
|
5842
6319
|
/*eslint no-param-reassign:0*/
|
|
5843
6320
|
// Allow for axios('example/url'[, config]) a la fetch API
|
|
5844
6321
|
if (typeof configOrUrl === 'string') {
|
|
@@ -30900,10 +31377,6 @@ class WebrtcExtension extends EventEmitter {
|
|
|
30900
31377
|
// This should be moved when the sdk is the primary consumer
|
|
30901
31378
|
proxyStatsForSession(session) {
|
|
30902
31379
|
session.on('stats', (statsEvent) => {
|
|
30903
|
-
/* if our logger was stopped, we need to stop stats logging too */
|
|
30904
|
-
if (this.client.logger['stopReason']) {
|
|
30905
|
-
return;
|
|
30906
|
-
}
|
|
30907
31380
|
const statsCopy = JSON.parse(JSON.stringify(statsEvent));
|
|
30908
31381
|
const extraDetails = {
|
|
30909
31382
|
conversationId: session.conversationId,
|
|
@@ -42036,9 +42509,8 @@ class Client extends EventEmitter {
|
|
|
42036
42509
|
});
|
|
42037
42510
|
}
|
|
42038
42511
|
stopServerLogging() {
|
|
42039
|
-
/* flush all pending logs
|
|
42512
|
+
/* flush all pending logs – then turn off the logger */
|
|
42040
42513
|
this.logger.sendAllLogsInstantly();
|
|
42041
|
-
this._webrtcSessions.sendStatsImmediately();
|
|
42042
42514
|
this.logger.stopServerLogging();
|
|
42043
42515
|
}
|
|
42044
42516
|
startServerLogging() {
|