@neurosity/sdk 7.0.1 → 7.2.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/dist/index.js +2155 -970
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2155 -970
- package/dist/index.mjs.map +1 -1
- package/dist/neurosity.iife.js +2155 -970
- package/dist/neurosity.iife.js.map +1 -1
- package/dist/neurosity.umd.js +2155 -970
- package/dist/neurosity.umd.js.map +1 -1
- package/dist/types/Neurosity.d.ts +102 -0
- package/dist/types/Neurosity.d.ts.map +1 -0
- package/dist/types/api/bluetooth/BluetoothClient.d.ts +77 -0
- package/dist/types/api/bluetooth/BluetoothClient.d.ts.map +1 -0
- package/dist/types/api/bluetooth/BluetoothTransport.d.ts +31 -0
- package/dist/types/api/bluetooth/BluetoothTransport.d.ts.map +1 -0
- package/dist/types/api/bluetooth/constants.d.ts +5 -0
- package/dist/types/api/bluetooth/constants.d.ts.map +1 -0
- package/dist/types/api/bluetooth/index.d.ts +6 -0
- package/dist/types/api/bluetooth/index.d.ts.map +1 -0
- package/dist/types/api/bluetooth/react-native/ReactNativeTransport.d.ts +73 -0
- package/dist/types/api/bluetooth/react-native/ReactNativeTransport.d.ts.map +1 -0
- package/dist/types/api/bluetooth/react-native/index.d.ts +3 -0
- package/dist/types/api/bluetooth/react-native/index.d.ts.map +1 -0
- package/dist/types/api/bluetooth/react-native/types/BleManagerTypes.d.ts +64 -0
- package/dist/types/api/bluetooth/react-native/types/BleManagerTypes.d.ts.map +1 -0
- package/dist/types/api/bluetooth/react-native/types/ReactNativeTypes.d.ts +41 -0
- package/dist/types/api/bluetooth/react-native/types/ReactNativeTypes.d.ts.map +1 -0
- package/dist/types/api/bluetooth/react-native/types/index.d.ts +3 -0
- package/dist/types/api/bluetooth/react-native/types/index.d.ts.map +1 -0
- package/dist/types/api/bluetooth/types/index.d.ts +21 -0
- package/dist/types/api/bluetooth/types/index.d.ts.map +1 -0
- package/dist/types/api/bluetooth/utils/binaryBufferToEpoch.d.ts +10 -0
- package/dist/types/api/bluetooth/utils/binaryBufferToEpoch.d.ts.map +1 -0
- package/dist/types/api/bluetooth/utils/create6DigitPin.d.ts +2 -0
- package/dist/types/api/bluetooth/utils/create6DigitPin.d.ts.map +1 -0
- package/dist/types/api/bluetooth/utils/csvBufferToEpoch.d.ts +6 -0
- package/dist/types/api/bluetooth/utils/csvBufferToEpoch.d.ts.map +1 -0
- package/dist/types/api/bluetooth/utils/decodeJSONChunks.d.ts +10 -0
- package/dist/types/api/bluetooth/utils/decodeJSONChunks.d.ts.map +1 -0
- package/dist/types/api/bluetooth/utils/osHasBluetoothSupport.d.ts +3 -0
- package/dist/types/api/bluetooth/utils/osHasBluetoothSupport.d.ts.map +1 -0
- package/dist/types/api/bluetooth/utils/stitch.d.ts +6 -0
- package/dist/types/api/bluetooth/utils/stitch.d.ts.map +1 -0
- package/dist/types/api/bluetooth/utils/textCodec.d.ts +11 -0
- package/dist/types/api/bluetooth/utils/textCodec.d.ts.map +1 -0
- package/dist/types/api/bluetooth/web/WebBluetoothTransport.d.ts +48 -0
- package/dist/types/api/bluetooth/web/WebBluetoothTransport.d.ts.map +1 -0
- package/dist/types/api/bluetooth/web/isMaybeWebWorkerContext.d.ts +2 -0
- package/dist/types/api/bluetooth/web/isMaybeWebWorkerContext.d.ts.map +1 -0
- package/dist/types/api/bluetooth/web/isWebBluetoothSupported.d.ts +2 -0
- package/dist/types/api/bluetooth/web/isWebBluetoothSupported.d.ts.map +1 -0
- package/dist/types/api/firebase/FirebaseApp.d.ts +13 -0
- package/dist/types/api/firebase/FirebaseApp.d.ts.map +1 -0
- package/dist/types/api/firebase/FirebaseDevice.d.ts +35 -0
- package/dist/types/api/firebase/FirebaseDevice.d.ts.map +1 -0
- package/dist/types/api/firebase/FirebaseUser.d.ts +50 -0
- package/dist/types/api/firebase/FirebaseUser.d.ts.map +1 -0
- package/dist/types/api/firebase/config.d.ts +9 -0
- package/dist/types/api/firebase/config.d.ts.map +1 -0
- package/dist/types/api/firebase/deviceStore.d.ts +24 -0
- package/dist/types/api/firebase/deviceStore.d.ts.map +1 -0
- package/dist/types/api/firebase/index.d.ts +4 -0
- package/dist/types/api/firebase/index.d.ts.map +1 -0
- package/dist/types/api/https/config.d.ts +2 -0
- package/dist/types/api/https/config.d.ts.map +1 -0
- package/dist/types/api/https/createOAuthURL.d.ts +4 -0
- package/dist/types/api/https/createOAuthURL.d.ts.map +1 -0
- package/dist/types/api/https/getOAuthToken.d.ts +4 -0
- package/dist/types/api/https/getOAuthToken.d.ts.map +1 -0
- package/dist/types/api/https/utils.d.ts +3 -0
- package/dist/types/api/https/utils.d.ts.map +1 -0
- package/dist/types/api/index.d.ts +74 -0
- package/dist/types/api/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/subscriptions/SubscriptionManager.d.ts +9 -0
- package/dist/types/subscriptions/SubscriptionManager.d.ts.map +1 -0
- package/dist/types/timesync/Timesync.d.ts +21 -0
- package/dist/types/timesync/Timesync.d.ts.map +1 -0
- package/dist/types/timesync/index.d.ts +2 -0
- package/dist/types/timesync/index.d.ts.map +1 -0
- package/dist/types/types/accelerometer.d.ts +12 -0
- package/dist/types/types/accelerometer.d.ts.map +1 -0
- package/dist/types/types/actions.d.ts +11 -0
- package/dist/types/types/actions.d.ts.map +1 -0
- package/dist/types/types/apiKey.d.ts +31 -0
- package/dist/types/types/apiKey.d.ts.map +1 -0
- package/dist/types/types/awareness.d.ts +2 -0
- package/dist/types/types/awareness.d.ts.map +1 -0
- package/dist/types/types/brainwaves.d.ts +40 -0
- package/dist/types/types/brainwaves.d.ts.map +1 -0
- package/dist/types/types/calm.d.ts +7 -0
- package/dist/types/types/calm.d.ts.map +1 -0
- package/dist/types/types/client.d.ts +20 -0
- package/dist/types/types/client.d.ts.map +1 -0
- package/dist/types/types/credentials.d.ts +16 -0
- package/dist/types/types/credentials.d.ts.map +1 -0
- package/dist/types/types/deviceInfo.d.ts +20 -0
- package/dist/types/types/deviceInfo.d.ts.map +1 -0
- package/dist/types/types/epoch.d.ts +10 -0
- package/dist/types/types/epoch.d.ts.map +1 -0
- package/dist/types/types/experiment.d.ts +10 -0
- package/dist/types/types/experiment.d.ts.map +1 -0
- package/dist/types/types/focus.d.ts +7 -0
- package/dist/types/types/focus.d.ts.map +1 -0
- package/dist/types/types/hapticEffects.d.ts +126 -0
- package/dist/types/types/hapticEffects.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +27 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/types/kinesis.d.ts +7 -0
- package/dist/types/types/kinesis.d.ts.map +1 -0
- package/dist/types/types/marker.d.ts +5 -0
- package/dist/types/types/marker.d.ts.map +1 -0
- package/dist/types/types/metrics.d.ts +13 -0
- package/dist/types/types/metrics.d.ts.map +1 -0
- package/dist/types/types/oauth.d.ts +21 -0
- package/dist/types/types/oauth.d.ts.map +1 -0
- package/dist/types/types/options.d.ts +25 -0
- package/dist/types/types/options.d.ts.map +1 -0
- package/dist/types/types/recording.d.ts +26 -0
- package/dist/types/types/recording.d.ts.map +1 -0
- package/dist/types/types/sample.d.ts +10 -0
- package/dist/types/types/sample.d.ts.map +1 -0
- package/dist/types/types/settings.d.ts +8 -0
- package/dist/types/types/settings.d.ts.map +1 -0
- package/dist/types/types/signalQuality.d.ts +9 -0
- package/dist/types/types/signalQuality.d.ts.map +1 -0
- package/dist/types/types/signalQualityV2.d.ts +14 -0
- package/dist/types/types/signalQualityV2.d.ts.map +1 -0
- package/dist/types/types/skill.d.ts +45 -0
- package/dist/types/types/skill.d.ts.map +1 -0
- package/dist/types/types/status.d.ts +21 -0
- package/dist/types/types/status.d.ts.map +1 -0
- package/dist/types/types/streaming.d.ts +10 -0
- package/dist/types/types/streaming.d.ts.map +1 -0
- package/dist/types/types/subscriptions.d.ts +15 -0
- package/dist/types/types/subscriptions.d.ts.map +1 -0
- package/dist/types/types/training.d.ts +14 -0
- package/dist/types/types/training.d.ts.map +1 -0
- package/dist/types/types/user.d.ts +10 -0
- package/dist/types/types/user.d.ts.map +1 -0
- package/dist/types/utils/errors.d.ts +6 -0
- package/dist/types/utils/errors.d.ts.map +1 -0
- package/dist/types/utils/filterInternalKeys.d.ts +4 -0
- package/dist/types/utils/filterInternalKeys.d.ts.map +1 -0
- package/dist/types/utils/hapticEffects.d.ts +124 -0
- package/dist/types/utils/hapticEffects.d.ts.map +1 -0
- package/dist/types/utils/heartbeat.d.ts +5 -0
- package/dist/types/utils/heartbeat.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +14 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/types/utils/is-node.d.ts +2 -0
- package/dist/types/utils/is-node.d.ts.map +1 -0
- package/dist/types/utils/metrics.d.ts +4 -0
- package/dist/types/utils/metrics.d.ts.map +1 -0
- package/dist/types/utils/permissions.d.ts +16 -0
- package/dist/types/utils/permissions.d.ts.map +1 -0
- package/dist/types/utils/pick.d.ts +2 -0
- package/dist/types/utils/pick.d.ts.map +1 -0
- package/dist/types/utils/pipes.d.ts +18 -0
- package/dist/types/utils/pipes.d.ts.map +1 -0
- package/dist/types/utils/platform.d.ts +31 -0
- package/dist/types/utils/platform.d.ts.map +1 -0
- package/dist/types/utils/subscription.d.ts +7 -0
- package/dist/types/utils/subscription.d.ts.map +1 -0
- package/dist/types/utils/transferDevice.d.ts +10 -0
- package/dist/types/utils/transferDevice.d.ts.map +1 -0
- package/dist/types/utils/whileOnline.d.ts +9 -0
- package/dist/types/utils/whileOnline.d.ts.map +1 -0
- package/package.json +13 -9
- package/dist/index.d.ts +0 -1067
package/dist/index.js
CHANGED
|
@@ -138,7 +138,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
138
138
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
139
139
|
};
|
|
140
140
|
|
|
141
|
-
function isFunction$
|
|
141
|
+
function isFunction$3(value) {
|
|
142
142
|
return typeof value === 'function';
|
|
143
143
|
}
|
|
144
144
|
|
|
@@ -206,7 +206,7 @@ var Subscription$1 = (function () {
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
var initialFinalizer = this.initialTeardown;
|
|
209
|
-
if (isFunction$
|
|
209
|
+
if (isFunction$3(initialFinalizer)) {
|
|
210
210
|
try {
|
|
211
211
|
initialFinalizer();
|
|
212
212
|
}
|
|
@@ -298,10 +298,10 @@ var Subscription$1 = (function () {
|
|
|
298
298
|
var EMPTY_SUBSCRIPTION = Subscription$1.EMPTY;
|
|
299
299
|
function isSubscription(value) {
|
|
300
300
|
return (value instanceof Subscription$1 ||
|
|
301
|
-
(value && 'closed' in value && isFunction$
|
|
301
|
+
(value && 'closed' in value && isFunction$3(value.remove) && isFunction$3(value.add) && isFunction$3(value.unsubscribe)));
|
|
302
302
|
}
|
|
303
303
|
function execFinalizer(finalizer) {
|
|
304
|
-
if (isFunction$
|
|
304
|
+
if (isFunction$3(finalizer)) {
|
|
305
305
|
finalizer();
|
|
306
306
|
}
|
|
307
307
|
else {
|
|
@@ -456,7 +456,7 @@ var SafeSubscriber = (function (_super) {
|
|
|
456
456
|
function SafeSubscriber(observerOrNext, error, complete) {
|
|
457
457
|
var _this = _super.call(this) || this;
|
|
458
458
|
var partialObserver;
|
|
459
|
-
if (isFunction$
|
|
459
|
+
if (isFunction$3(observerOrNext) || !observerOrNext) {
|
|
460
460
|
partialObserver = {
|
|
461
461
|
next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
|
|
462
462
|
error: error !== null && error !== void 0 ? error : undefined,
|
|
@@ -601,14 +601,14 @@ function getPromiseCtor(promiseCtor) {
|
|
|
601
601
|
return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config$1.Promise) !== null && _a !== void 0 ? _a : Promise;
|
|
602
602
|
}
|
|
603
603
|
function isObserver(value) {
|
|
604
|
-
return value && isFunction$
|
|
604
|
+
return value && isFunction$3(value.next) && isFunction$3(value.error) && isFunction$3(value.complete);
|
|
605
605
|
}
|
|
606
606
|
function isSubscriber(value) {
|
|
607
607
|
return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
|
|
608
608
|
}
|
|
609
609
|
|
|
610
610
|
function hasLift(source) {
|
|
611
|
-
return isFunction$
|
|
611
|
+
return isFunction$3(source === null || source === void 0 ? void 0 : source.lift);
|
|
612
612
|
}
|
|
613
613
|
function operate(init) {
|
|
614
614
|
return function (source) {
|
|
@@ -1103,14 +1103,14 @@ var async = asyncScheduler;
|
|
|
1103
1103
|
var EMPTY = new Observable(function (subscriber) { return subscriber.complete(); });
|
|
1104
1104
|
|
|
1105
1105
|
function isScheduler(value) {
|
|
1106
|
-
return value && isFunction$
|
|
1106
|
+
return value && isFunction$3(value.schedule);
|
|
1107
1107
|
}
|
|
1108
1108
|
|
|
1109
1109
|
function last(arr) {
|
|
1110
1110
|
return arr[arr.length - 1];
|
|
1111
1111
|
}
|
|
1112
1112
|
function popResultSelector(args) {
|
|
1113
|
-
return isFunction$
|
|
1113
|
+
return isFunction$3(last(args)) ? args.pop() : undefined;
|
|
1114
1114
|
}
|
|
1115
1115
|
function popScheduler(args) {
|
|
1116
1116
|
return isScheduler(last(args)) ? args.pop() : undefined;
|
|
@@ -1122,15 +1122,15 @@ function popNumber(args, defaultValue) {
|
|
|
1122
1122
|
var isArrayLike = (function (x) { return x && typeof x.length === 'number' && typeof x !== 'function'; });
|
|
1123
1123
|
|
|
1124
1124
|
function isPromise(value) {
|
|
1125
|
-
return isFunction$
|
|
1125
|
+
return isFunction$3(value === null || value === void 0 ? void 0 : value.then);
|
|
1126
1126
|
}
|
|
1127
1127
|
|
|
1128
1128
|
function isInteropObservable(input) {
|
|
1129
|
-
return isFunction$
|
|
1129
|
+
return isFunction$3(input[observable]);
|
|
1130
1130
|
}
|
|
1131
1131
|
|
|
1132
1132
|
function isAsyncIterable(obj) {
|
|
1133
|
-
return Symbol.asyncIterator && isFunction$
|
|
1133
|
+
return Symbol.asyncIterator && isFunction$3(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
|
|
1134
1134
|
}
|
|
1135
1135
|
|
|
1136
1136
|
function createInvalidObservableTypeError(input) {
|
|
@@ -1143,10 +1143,10 @@ function getSymbolIterator() {
|
|
|
1143
1143
|
}
|
|
1144
1144
|
return Symbol.iterator;
|
|
1145
1145
|
}
|
|
1146
|
-
var iterator = getSymbolIterator();
|
|
1146
|
+
var iterator$1 = getSymbolIterator();
|
|
1147
1147
|
|
|
1148
|
-
function isIterable(input) {
|
|
1149
|
-
return isFunction$
|
|
1148
|
+
function isIterable$1(input) {
|
|
1149
|
+
return isFunction$3(input === null || input === void 0 ? void 0 : input[iterator$1]);
|
|
1150
1150
|
}
|
|
1151
1151
|
|
|
1152
1152
|
function readableStreamLikeToAsyncGenerator(readableStream) {
|
|
@@ -1182,7 +1182,7 @@ function readableStreamLikeToAsyncGenerator(readableStream) {
|
|
|
1182
1182
|
});
|
|
1183
1183
|
}
|
|
1184
1184
|
function isReadableStreamLike(obj) {
|
|
1185
|
-
return isFunction$
|
|
1185
|
+
return isFunction$3(obj === null || obj === void 0 ? void 0 : obj.getReader);
|
|
1186
1186
|
}
|
|
1187
1187
|
|
|
1188
1188
|
function innerFrom(input) {
|
|
@@ -1202,7 +1202,7 @@ function innerFrom(input) {
|
|
|
1202
1202
|
if (isAsyncIterable(input)) {
|
|
1203
1203
|
return fromAsyncIterable(input);
|
|
1204
1204
|
}
|
|
1205
|
-
if (isIterable(input)) {
|
|
1205
|
+
if (isIterable$1(input)) {
|
|
1206
1206
|
return fromIterable(input);
|
|
1207
1207
|
}
|
|
1208
1208
|
if (isReadableStreamLike(input)) {
|
|
@@ -1214,7 +1214,7 @@ function innerFrom(input) {
|
|
|
1214
1214
|
function fromInteropObservable(obj) {
|
|
1215
1215
|
return new Observable(function (subscriber) {
|
|
1216
1216
|
var obs = obj[observable]();
|
|
1217
|
-
if (isFunction$
|
|
1217
|
+
if (isFunction$3(obs.subscribe)) {
|
|
1218
1218
|
return obs.subscribe(subscriber);
|
|
1219
1219
|
}
|
|
1220
1220
|
throw new TypeError('Provided object does not correctly implement Symbol.observable');
|
|
@@ -1375,15 +1375,15 @@ function scheduleArray(input, scheduler) {
|
|
|
1375
1375
|
|
|
1376
1376
|
function scheduleIterable(input, scheduler) {
|
|
1377
1377
|
return new Observable(function (subscriber) {
|
|
1378
|
-
var iterator
|
|
1378
|
+
var iterator;
|
|
1379
1379
|
executeSchedule(subscriber, scheduler, function () {
|
|
1380
|
-
iterator
|
|
1380
|
+
iterator = input[iterator$1]();
|
|
1381
1381
|
executeSchedule(subscriber, scheduler, function () {
|
|
1382
1382
|
var _a;
|
|
1383
1383
|
var value;
|
|
1384
1384
|
var done;
|
|
1385
1385
|
try {
|
|
1386
|
-
(_a = iterator
|
|
1386
|
+
(_a = iterator.next(), value = _a.value, done = _a.done);
|
|
1387
1387
|
}
|
|
1388
1388
|
catch (err) {
|
|
1389
1389
|
subscriber.error(err);
|
|
@@ -1397,7 +1397,7 @@ function scheduleIterable(input, scheduler) {
|
|
|
1397
1397
|
}
|
|
1398
1398
|
}, 0, true);
|
|
1399
1399
|
});
|
|
1400
|
-
return function () { return isFunction$
|
|
1400
|
+
return function () { return isFunction$3(iterator === null || iterator === void 0 ? void 0 : iterator.return) && iterator.return(); };
|
|
1401
1401
|
});
|
|
1402
1402
|
}
|
|
1403
1403
|
|
|
@@ -1440,7 +1440,7 @@ function scheduled(input, scheduler) {
|
|
|
1440
1440
|
if (isAsyncIterable(input)) {
|
|
1441
1441
|
return scheduleAsyncIterable(input, scheduler);
|
|
1442
1442
|
}
|
|
1443
|
-
if (isIterable(input)) {
|
|
1443
|
+
if (isIterable$1(input)) {
|
|
1444
1444
|
return scheduleIterable(input, scheduler);
|
|
1445
1445
|
}
|
|
1446
1446
|
if (isReadableStreamLike(input)) {
|
|
@@ -1464,7 +1464,7 @@ function of() {
|
|
|
1464
1464
|
}
|
|
1465
1465
|
|
|
1466
1466
|
function throwError(errorOrErrorFactory, scheduler) {
|
|
1467
|
-
var errorFactory = isFunction$
|
|
1467
|
+
var errorFactory = isFunction$3(errorOrErrorFactory) ? errorOrErrorFactory : function () { return errorOrErrorFactory; };
|
|
1468
1468
|
var init = function (subscriber) { return subscriber.error(errorFactory()); };
|
|
1469
1469
|
return new Observable(init);
|
|
1470
1470
|
}
|
|
@@ -1655,7 +1655,7 @@ function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, e
|
|
|
1655
1655
|
|
|
1656
1656
|
function mergeMap(project, resultSelector, concurrent) {
|
|
1657
1657
|
if (concurrent === void 0) { concurrent = Infinity; }
|
|
1658
|
-
if (isFunction$
|
|
1658
|
+
if (isFunction$3(resultSelector)) {
|
|
1659
1659
|
return mergeMap(function (a, i) { return map$1(function (b, ii) { return resultSelector(a, b, i, ii); })(innerFrom(project(a, i))); }, concurrent);
|
|
1660
1660
|
}
|
|
1661
1661
|
else if (typeof resultSelector === 'number') {
|
|
@@ -1697,7 +1697,7 @@ function fromEventPattern(addHandler, removeHandler, resultSelector) {
|
|
|
1697
1697
|
return subscriber.next(e.length === 1 ? e[0] : e);
|
|
1698
1698
|
};
|
|
1699
1699
|
var retValue = addHandler(handler);
|
|
1700
|
-
return isFunction$
|
|
1700
|
+
return isFunction$3(removeHandler) ? function () { return removeHandler(handler, retValue); } : undefined;
|
|
1701
1701
|
});
|
|
1702
1702
|
}
|
|
1703
1703
|
|
|
@@ -1863,7 +1863,7 @@ function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplet
|
|
|
1863
1863
|
}
|
|
1864
1864
|
|
|
1865
1865
|
function concatMap(project, resultSelector) {
|
|
1866
|
-
return isFunction$
|
|
1866
|
+
return isFunction$3(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1);
|
|
1867
1867
|
}
|
|
1868
1868
|
|
|
1869
1869
|
function concat() {
|
|
@@ -2085,7 +2085,7 @@ function takeUntil(notifier) {
|
|
|
2085
2085
|
}
|
|
2086
2086
|
|
|
2087
2087
|
function tap(observerOrNext, error, complete) {
|
|
2088
|
-
var tapObserver = isFunction$
|
|
2088
|
+
var tapObserver = isFunction$3(observerOrNext) || error || complete
|
|
2089
2089
|
?
|
|
2090
2090
|
{ next: observerOrNext, error: error, complete: complete }
|
|
2091
2091
|
: observerOrNext;
|
|
@@ -2630,7 +2630,7 @@ function isValidKey$1(key) {
|
|
|
2630
2630
|
* @returns the `globalThis` object for the given environment.
|
|
2631
2631
|
* @public
|
|
2632
2632
|
*/
|
|
2633
|
-
function getGlobal() {
|
|
2633
|
+
function getGlobal$1() {
|
|
2634
2634
|
if (typeof self !== 'undefined') {
|
|
2635
2635
|
return self;
|
|
2636
2636
|
}
|
|
@@ -2659,7 +2659,7 @@ function getGlobal() {
|
|
|
2659
2659
|
* See the License for the specific language governing permissions and
|
|
2660
2660
|
* limitations under the License.
|
|
2661
2661
|
*/
|
|
2662
|
-
const getDefaultsFromGlobal = () => getGlobal().__FIREBASE_DEFAULTS__;
|
|
2662
|
+
const getDefaultsFromGlobal = () => getGlobal$1().__FIREBASE_DEFAULTS__;
|
|
2663
2663
|
/**
|
|
2664
2664
|
* Attempt to read defaults from a JSON string provided to
|
|
2665
2665
|
* process(.)env(.)__FIREBASE_DEFAULTS__ or a JSON file whose path is in
|
|
@@ -3129,7 +3129,7 @@ function isBrowserExtension() {
|
|
|
3129
3129
|
*
|
|
3130
3130
|
* @return true if ReactNative environment is detected.
|
|
3131
3131
|
*/
|
|
3132
|
-
function isReactNative() {
|
|
3132
|
+
function isReactNative$1() {
|
|
3133
3133
|
return (typeof navigator === 'object' && navigator['product'] === 'ReactNative');
|
|
3134
3134
|
}
|
|
3135
3135
|
/** Detects Internet Explorer. */
|
|
@@ -9828,7 +9828,7 @@ class PersistentConnection extends ServerActions {
|
|
|
9828
9828
|
if (isMobileCordova()) {
|
|
9829
9829
|
stats['framework.cordova'] = 1;
|
|
9830
9830
|
}
|
|
9831
|
-
else if (isReactNative()) {
|
|
9831
|
+
else if (isReactNative$1()) {
|
|
9832
9832
|
stats['framework.reactnative'] = 1;
|
|
9833
9833
|
}
|
|
9834
9834
|
this.reportStats(stats);
|
|
@@ -19389,7 +19389,7 @@ class Delay {
|
|
|
19389
19389
|
this.longDelay = longDelay;
|
|
19390
19390
|
// Internal error when improperly initialized.
|
|
19391
19391
|
debugAssert(longDelay > shortDelay, 'Short delay should be less than long delay!');
|
|
19392
|
-
this.isMobile = isMobileCordova() || isReactNative();
|
|
19392
|
+
this.isMobile = isMobileCordova() || isReactNative$1();
|
|
19393
19393
|
}
|
|
19394
19394
|
get() {
|
|
19395
19395
|
if (!_isOnline()) {
|
|
@@ -30522,8 +30522,9 @@ QuerySnapshot._jsonSchemaVersion = "firestore/querySnapshot/1.0", QuerySnapshot.
|
|
|
30522
30522
|
registerVersion(F, M, "esm2020");
|
|
30523
30523
|
}();
|
|
30524
30524
|
|
|
30525
|
+
const productionApiKey = ["AIza", "SyB0TkZ83Fj0CIzn8AAmE-Osc92s3ER8hy8"].join("");
|
|
30525
30526
|
const config = {
|
|
30526
|
-
apiKey:
|
|
30527
|
+
apiKey: productionApiKey,
|
|
30527
30528
|
authDomain: "neurosity-device.firebaseapp.com",
|
|
30528
30529
|
databaseURL: "https://neurosity-device.firebaseio.com",
|
|
30529
30530
|
projectId: "neurosity-device",
|
|
@@ -31543,16 +31544,14 @@ class CloudClient {
|
|
|
31543
31544
|
this.firebaseUser.onUserClaimsChange().subscribe((userClaims) => {
|
|
31544
31545
|
this.userClaims = userClaims;
|
|
31545
31546
|
});
|
|
31546
|
-
this.onDeviceChange().subscribe(
|
|
31547
|
+
this.onDeviceChange().subscribe((device) => {
|
|
31547
31548
|
if (this.firebaseDevice) {
|
|
31548
|
-
|
|
31549
|
-
await this.firebaseDevice.disconnect();
|
|
31550
|
-
}
|
|
31551
|
-
catch (error) {
|
|
31549
|
+
this.firebaseDevice.disconnect().catch((error) => {
|
|
31552
31550
|
console.error("Error disconnecting from device", error);
|
|
31553
|
-
}
|
|
31551
|
+
});
|
|
31554
31552
|
}
|
|
31555
31553
|
if (!device) {
|
|
31554
|
+
this.firebaseDevice = undefined;
|
|
31556
31555
|
return;
|
|
31557
31556
|
}
|
|
31558
31557
|
this.firebaseDevice = new FirebaseDevice({
|
|
@@ -31839,6 +31838,7 @@ const BLUETOOTH_CHARACTERISTICS = {
|
|
|
31839
31838
|
calm: "7d47617d-a60a-41d1-8df6-cfb78d02ffeb",
|
|
31840
31839
|
accelerometer: "84501dee-8665-4073-b111-bdecd69fb489",
|
|
31841
31840
|
signalQuality: "cf28ed0c-20cd-48ed-93c5-ee2fb265099a",
|
|
31841
|
+
signalQualityV2: "902ac5f3-ce59-4c11-94fa-437e89f90630",
|
|
31842
31842
|
raw: "009cf0bb-b68d-4af1-a0e5-625f2eb964a6",
|
|
31843
31843
|
rawUnfiltered: "5472432e-3313-4169-add8-6fcb29accb0e",
|
|
31844
31844
|
psd: "d6684fb0-8518-40c0-8e88-4634e762435d",
|
|
@@ -31899,20 +31899,14 @@ const channelNames = {
|
|
|
31899
31899
|
const metrics = {
|
|
31900
31900
|
kinesis,
|
|
31901
31901
|
predictions: kinesis,
|
|
31902
|
-
channelAnalysis: channelNames,
|
|
31903
31902
|
signalQuality: channelNames,
|
|
31904
|
-
|
|
31905
|
-
|
|
31906
|
-
|
|
31907
|
-
|
|
31908
|
-
connected: {},
|
|
31909
|
-
connectedSince: {},
|
|
31910
|
-
connectedLast: {},
|
|
31911
|
-
updatingProgress: {},
|
|
31912
|
-
simulate: {},
|
|
31913
|
-
ssid: {}
|
|
31903
|
+
signalQualityV2: {
|
|
31904
|
+
timestamp: {},
|
|
31905
|
+
overall: {},
|
|
31906
|
+
byChannel: {}
|
|
31914
31907
|
},
|
|
31915
31908
|
accelerometer: {
|
|
31909
|
+
timestamp: {},
|
|
31916
31910
|
acceleration: {},
|
|
31917
31911
|
inclination: {},
|
|
31918
31912
|
orientation: {},
|
|
@@ -32350,6 +32344,13 @@ function getScopeError(...requiredScopes) {
|
|
|
32350
32344
|
return new Error(`${prefix}You are trying to access data with an OAuth token or API key without access to the following scopes: ${requiredScopes.join(", ")}.`);
|
|
32351
32345
|
}
|
|
32352
32346
|
|
|
32347
|
+
/**
|
|
32348
|
+
* Create a bound version of a function with a specified `this` context
|
|
32349
|
+
*
|
|
32350
|
+
* @param {Function} fn - The function to bind
|
|
32351
|
+
* @param {*} thisArg - The value to be passed as the `this` parameter
|
|
32352
|
+
* @returns {Function} A new function that will call the original function with the specified `this` context
|
|
32353
|
+
*/
|
|
32353
32354
|
function bind(fn, thisArg) {
|
|
32354
32355
|
return function wrap() {
|
|
32355
32356
|
return fn.apply(thisArg, arguments);
|
|
@@ -32358,29 +32359,30 @@ function bind(fn, thisArg) {
|
|
|
32358
32359
|
|
|
32359
32360
|
// utils is a library of generic helper functions non-specific to axios
|
|
32360
32361
|
|
|
32361
|
-
const {toString} = Object.prototype;
|
|
32362
|
-
const {getPrototypeOf} = Object;
|
|
32362
|
+
const { toString } = Object.prototype;
|
|
32363
|
+
const { getPrototypeOf } = Object;
|
|
32364
|
+
const { iterator, toStringTag } = Symbol;
|
|
32363
32365
|
|
|
32364
|
-
const kindOf = (cache => thing => {
|
|
32365
|
-
|
|
32366
|
-
|
|
32366
|
+
const kindOf = ((cache) => (thing) => {
|
|
32367
|
+
const str = toString.call(thing);
|
|
32368
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
32367
32369
|
})(Object.create(null));
|
|
32368
32370
|
|
|
32369
32371
|
const kindOfTest = (type) => {
|
|
32370
32372
|
type = type.toLowerCase();
|
|
32371
|
-
return (thing) => kindOf(thing) === type
|
|
32373
|
+
return (thing) => kindOf(thing) === type;
|
|
32372
32374
|
};
|
|
32373
32375
|
|
|
32374
|
-
const typeOfTest = type => thing => typeof thing === type;
|
|
32376
|
+
const typeOfTest = (type) => (thing) => typeof thing === type;
|
|
32375
32377
|
|
|
32376
32378
|
/**
|
|
32377
|
-
* Determine if a value is
|
|
32379
|
+
* Determine if a value is a non-null object
|
|
32378
32380
|
*
|
|
32379
32381
|
* @param {Object} val The value to test
|
|
32380
32382
|
*
|
|
32381
32383
|
* @returns {boolean} True if value is an Array, otherwise false
|
|
32382
32384
|
*/
|
|
32383
|
-
const {isArray} = Array;
|
|
32385
|
+
const { isArray } = Array;
|
|
32384
32386
|
|
|
32385
32387
|
/**
|
|
32386
32388
|
* Determine if a value is undefined
|
|
@@ -32399,8 +32401,14 @@ const isUndefined = typeOfTest('undefined');
|
|
|
32399
32401
|
* @returns {boolean} True if value is a Buffer, otherwise false
|
|
32400
32402
|
*/
|
|
32401
32403
|
function isBuffer(val) {
|
|
32402
|
-
return
|
|
32403
|
-
|
|
32404
|
+
return (
|
|
32405
|
+
val !== null &&
|
|
32406
|
+
!isUndefined(val) &&
|
|
32407
|
+
val.constructor !== null &&
|
|
32408
|
+
!isUndefined(val.constructor) &&
|
|
32409
|
+
isFunction$2(val.constructor.isBuffer) &&
|
|
32410
|
+
val.constructor.isBuffer(val)
|
|
32411
|
+
);
|
|
32404
32412
|
}
|
|
32405
32413
|
|
|
32406
32414
|
/**
|
|
@@ -32412,7 +32420,6 @@ function isBuffer(val) {
|
|
|
32412
32420
|
*/
|
|
32413
32421
|
const isArrayBuffer = kindOfTest('ArrayBuffer');
|
|
32414
32422
|
|
|
32415
|
-
|
|
32416
32423
|
/**
|
|
32417
32424
|
* Determine if a value is a view on an ArrayBuffer
|
|
32418
32425
|
*
|
|
@@ -32422,10 +32429,10 @@ const isArrayBuffer = kindOfTest('ArrayBuffer');
|
|
|
32422
32429
|
*/
|
|
32423
32430
|
function isArrayBufferView(val) {
|
|
32424
32431
|
let result;
|
|
32425
|
-
if (
|
|
32432
|
+
if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
|
|
32426
32433
|
result = ArrayBuffer.isView(val);
|
|
32427
32434
|
} else {
|
|
32428
|
-
result =
|
|
32435
|
+
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
32429
32436
|
}
|
|
32430
32437
|
return result;
|
|
32431
32438
|
}
|
|
@@ -32445,7 +32452,7 @@ const isString = typeOfTest('string');
|
|
|
32445
32452
|
* @param {*} val The value to test
|
|
32446
32453
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
32447
32454
|
*/
|
|
32448
|
-
const isFunction$
|
|
32455
|
+
const isFunction$2 = typeOfTest('function');
|
|
32449
32456
|
|
|
32450
32457
|
/**
|
|
32451
32458
|
* Determine if a value is a Number
|
|
@@ -32471,7 +32478,7 @@ const isObject$1 = (thing) => thing !== null && typeof thing === 'object';
|
|
|
32471
32478
|
* @param {*} thing The value to test
|
|
32472
32479
|
* @returns {boolean} True if value is a Boolean, otherwise false
|
|
32473
32480
|
*/
|
|
32474
|
-
const isBoolean = thing => thing === true || thing === false;
|
|
32481
|
+
const isBoolean = (thing) => thing === true || thing === false;
|
|
32475
32482
|
|
|
32476
32483
|
/**
|
|
32477
32484
|
* Determine if a value is a plain Object
|
|
@@ -32486,7 +32493,34 @@ const isPlainObject = (val) => {
|
|
|
32486
32493
|
}
|
|
32487
32494
|
|
|
32488
32495
|
const prototype = getPrototypeOf(val);
|
|
32489
|
-
return (
|
|
32496
|
+
return (
|
|
32497
|
+
(prototype === null ||
|
|
32498
|
+
prototype === Object.prototype ||
|
|
32499
|
+
Object.getPrototypeOf(prototype) === null) &&
|
|
32500
|
+
!(toStringTag in val) &&
|
|
32501
|
+
!(iterator in val)
|
|
32502
|
+
);
|
|
32503
|
+
};
|
|
32504
|
+
|
|
32505
|
+
/**
|
|
32506
|
+
* Determine if a value is an empty object (safely handles Buffers)
|
|
32507
|
+
*
|
|
32508
|
+
* @param {*} val The value to test
|
|
32509
|
+
*
|
|
32510
|
+
* @returns {boolean} True if value is an empty object, otherwise false
|
|
32511
|
+
*/
|
|
32512
|
+
const isEmptyObject = (val) => {
|
|
32513
|
+
// Early return for non-objects or Buffers to prevent RangeError
|
|
32514
|
+
if (!isObject$1(val) || isBuffer(val)) {
|
|
32515
|
+
return false;
|
|
32516
|
+
}
|
|
32517
|
+
|
|
32518
|
+
try {
|
|
32519
|
+
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
32520
|
+
} catch (e) {
|
|
32521
|
+
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
32522
|
+
return false;
|
|
32523
|
+
}
|
|
32490
32524
|
};
|
|
32491
32525
|
|
|
32492
32526
|
/**
|
|
@@ -32507,6 +32541,31 @@ const isDate = kindOfTest('Date');
|
|
|
32507
32541
|
*/
|
|
32508
32542
|
const isFile = kindOfTest('File');
|
|
32509
32543
|
|
|
32544
|
+
/**
|
|
32545
|
+
* Determine if a value is a React Native Blob
|
|
32546
|
+
* React Native "blob": an object with a `uri` attribute. Optionally, it can
|
|
32547
|
+
* also have a `name` and `type` attribute to specify filename and content type
|
|
32548
|
+
*
|
|
32549
|
+
* @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
|
|
32550
|
+
*
|
|
32551
|
+
* @param {*} value The value to test
|
|
32552
|
+
*
|
|
32553
|
+
* @returns {boolean} True if value is a React Native Blob, otherwise false
|
|
32554
|
+
*/
|
|
32555
|
+
const isReactNativeBlob = (value) => {
|
|
32556
|
+
return !!(value && typeof value.uri !== 'undefined');
|
|
32557
|
+
};
|
|
32558
|
+
|
|
32559
|
+
/**
|
|
32560
|
+
* Determine if environment is React Native
|
|
32561
|
+
* ReactNative `FormData` has a non-standard `getParts()` method
|
|
32562
|
+
*
|
|
32563
|
+
* @param {*} formData The formData to test
|
|
32564
|
+
*
|
|
32565
|
+
* @returns {boolean} True if environment is React Native, otherwise false
|
|
32566
|
+
*/
|
|
32567
|
+
const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
|
|
32568
|
+
|
|
32510
32569
|
/**
|
|
32511
32570
|
* Determine if a value is a Blob
|
|
32512
32571
|
*
|
|
@@ -32532,7 +32591,7 @@ const isFileList = kindOfTest('FileList');
|
|
|
32532
32591
|
*
|
|
32533
32592
|
* @returns {boolean} True if value is a Stream, otherwise false
|
|
32534
32593
|
*/
|
|
32535
|
-
const isStream = (val) => isObject$1(val) && isFunction$
|
|
32594
|
+
const isStream = (val) => isObject$1(val) && isFunction$2(val.pipe);
|
|
32536
32595
|
|
|
32537
32596
|
/**
|
|
32538
32597
|
* Determine if a value is a FormData
|
|
@@ -32541,17 +32600,28 @@ const isStream = (val) => isObject$1(val) && isFunction$1(val.pipe);
|
|
|
32541
32600
|
*
|
|
32542
32601
|
* @returns {boolean} True if value is an FormData, otherwise false
|
|
32543
32602
|
*/
|
|
32603
|
+
function getGlobal() {
|
|
32604
|
+
if (typeof globalThis !== 'undefined') return globalThis;
|
|
32605
|
+
if (typeof self !== 'undefined') return self;
|
|
32606
|
+
if (typeof window !== 'undefined') return window;
|
|
32607
|
+
if (typeof global !== 'undefined') return global;
|
|
32608
|
+
return {};
|
|
32609
|
+
}
|
|
32610
|
+
|
|
32611
|
+
const G = getGlobal();
|
|
32612
|
+
const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
|
|
32613
|
+
|
|
32544
32614
|
const isFormData = (thing) => {
|
|
32545
32615
|
let kind;
|
|
32546
32616
|
return thing && (
|
|
32547
|
-
(
|
|
32548
|
-
isFunction$
|
|
32617
|
+
(FormDataCtor && thing instanceof FormDataCtor) || (
|
|
32618
|
+
isFunction$2(thing.append) && (
|
|
32549
32619
|
(kind = kindOf(thing)) === 'formdata' ||
|
|
32550
32620
|
// detect form-data instance
|
|
32551
|
-
(kind === 'object' && isFunction$
|
|
32621
|
+
(kind === 'object' && isFunction$2(thing.toString) && thing.toString() === '[object FormData]')
|
|
32552
32622
|
)
|
|
32553
32623
|
)
|
|
32554
|
-
)
|
|
32624
|
+
);
|
|
32555
32625
|
};
|
|
32556
32626
|
|
|
32557
32627
|
/**
|
|
@@ -32563,6 +32633,13 @@ const isFormData = (thing) => {
|
|
|
32563
32633
|
*/
|
|
32564
32634
|
const isURLSearchParams = kindOfTest('URLSearchParams');
|
|
32565
32635
|
|
|
32636
|
+
const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
32637
|
+
'ReadableStream',
|
|
32638
|
+
'Request',
|
|
32639
|
+
'Response',
|
|
32640
|
+
'Headers',
|
|
32641
|
+
].map(kindOfTest);
|
|
32642
|
+
|
|
32566
32643
|
/**
|
|
32567
32644
|
* Trim excess whitespace off the beginning and end of a string
|
|
32568
32645
|
*
|
|
@@ -32570,9 +32647,9 @@ const isURLSearchParams = kindOfTest('URLSearchParams');
|
|
|
32570
32647
|
*
|
|
32571
32648
|
* @returns {String} The String freed of excess whitespace
|
|
32572
32649
|
*/
|
|
32573
|
-
const trim = (str) =>
|
|
32574
|
-
str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
|
32575
|
-
|
|
32650
|
+
const trim = (str) => {
|
|
32651
|
+
return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
|
32652
|
+
};
|
|
32576
32653
|
/**
|
|
32577
32654
|
* Iterate over an Array or an Object invoking a function for each item.
|
|
32578
32655
|
*
|
|
@@ -32582,13 +32659,14 @@ const trim = (str) => str.trim ?
|
|
|
32582
32659
|
* If 'obj' is an Object callback will be called passing
|
|
32583
32660
|
* the value, key, and complete object for each property.
|
|
32584
32661
|
*
|
|
32585
|
-
* @param {Object|Array} obj The object to iterate
|
|
32662
|
+
* @param {Object|Array<unknown>} obj The object to iterate
|
|
32586
32663
|
* @param {Function} fn The callback to invoke for each item
|
|
32587
32664
|
*
|
|
32588
|
-
* @param {
|
|
32665
|
+
* @param {Object} [options]
|
|
32666
|
+
* @param {Boolean} [options.allOwnKeys = false]
|
|
32589
32667
|
* @returns {any}
|
|
32590
32668
|
*/
|
|
32591
|
-
function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
32669
|
+
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
32592
32670
|
// Don't bother if no value provided
|
|
32593
32671
|
if (obj === null || typeof obj === 'undefined') {
|
|
32594
32672
|
return;
|
|
@@ -32609,6 +32687,11 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
32609
32687
|
fn.call(null, obj[i], i, obj);
|
|
32610
32688
|
}
|
|
32611
32689
|
} else {
|
|
32690
|
+
// Buffer check
|
|
32691
|
+
if (isBuffer(obj)) {
|
|
32692
|
+
return;
|
|
32693
|
+
}
|
|
32694
|
+
|
|
32612
32695
|
// Iterate over object keys
|
|
32613
32696
|
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
32614
32697
|
const len = keys.length;
|
|
@@ -32621,7 +32704,19 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
32621
32704
|
}
|
|
32622
32705
|
}
|
|
32623
32706
|
|
|
32707
|
+
/**
|
|
32708
|
+
* Finds a key in an object, case-insensitive, returning the actual key name.
|
|
32709
|
+
* Returns null if the object is a Buffer or if no match is found.
|
|
32710
|
+
*
|
|
32711
|
+
* @param {Object} obj - The object to search.
|
|
32712
|
+
* @param {string} key - The key to find (case-insensitive).
|
|
32713
|
+
* @returns {?string} The actual key name if found, otherwise null.
|
|
32714
|
+
*/
|
|
32624
32715
|
function findKey(obj, key) {
|
|
32716
|
+
if (isBuffer(obj)) {
|
|
32717
|
+
return null;
|
|
32718
|
+
}
|
|
32719
|
+
|
|
32625
32720
|
key = key.toLowerCase();
|
|
32626
32721
|
const keys = Object.keys(obj);
|
|
32627
32722
|
let i = keys.length;
|
|
@@ -32637,8 +32732,8 @@ function findKey(obj, key) {
|
|
|
32637
32732
|
|
|
32638
32733
|
const _global = (() => {
|
|
32639
32734
|
/*eslint no-undef:0*/
|
|
32640
|
-
if (typeof globalThis !==
|
|
32641
|
-
return typeof self !==
|
|
32735
|
+
if (typeof globalThis !== 'undefined') return globalThis;
|
|
32736
|
+
return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global;
|
|
32642
32737
|
})();
|
|
32643
32738
|
|
|
32644
32739
|
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
@@ -32653,7 +32748,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
32653
32748
|
* Example:
|
|
32654
32749
|
*
|
|
32655
32750
|
* ```js
|
|
32656
|
-
*
|
|
32751
|
+
* const result = merge({foo: 123}, {foo: 456});
|
|
32657
32752
|
* console.log(result.foo); // outputs 456
|
|
32658
32753
|
* ```
|
|
32659
32754
|
*
|
|
@@ -32662,17 +32757,22 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
32662
32757
|
* @returns {Object} Result of all merge properties
|
|
32663
32758
|
*/
|
|
32664
32759
|
function merge(/* obj1, obj2, obj3, ... */) {
|
|
32665
|
-
const {caseless} = isContextDefined(this) && this || {};
|
|
32760
|
+
const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
|
|
32666
32761
|
const result = {};
|
|
32667
32762
|
const assignValue = (val, key) => {
|
|
32668
|
-
|
|
32763
|
+
// Skip dangerous property names to prevent prototype pollution
|
|
32764
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
32765
|
+
return;
|
|
32766
|
+
}
|
|
32767
|
+
|
|
32768
|
+
const targetKey = (caseless && findKey(result, key)) || key;
|
|
32669
32769
|
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
|
32670
32770
|
result[targetKey] = merge(result[targetKey], val);
|
|
32671
32771
|
} else if (isPlainObject(val)) {
|
|
32672
32772
|
result[targetKey] = merge({}, val);
|
|
32673
32773
|
} else if (isArray(val)) {
|
|
32674
32774
|
result[targetKey] = val.slice();
|
|
32675
|
-
} else {
|
|
32775
|
+
} else if (!skipUndefined || !isUndefined(val)) {
|
|
32676
32776
|
result[targetKey] = val;
|
|
32677
32777
|
}
|
|
32678
32778
|
};
|
|
@@ -32690,17 +32790,32 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
32690
32790
|
* @param {Object} b The object to copy properties from
|
|
32691
32791
|
* @param {Object} thisArg The object to bind function to
|
|
32692
32792
|
*
|
|
32693
|
-
* @param {
|
|
32793
|
+
* @param {Object} [options]
|
|
32794
|
+
* @param {Boolean} [options.allOwnKeys]
|
|
32694
32795
|
* @returns {Object} The resulting value of object a
|
|
32695
32796
|
*/
|
|
32696
|
-
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
32697
|
-
forEach(
|
|
32698
|
-
|
|
32699
|
-
|
|
32700
|
-
|
|
32701
|
-
|
|
32702
|
-
|
|
32703
|
-
|
|
32797
|
+
const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
32798
|
+
forEach(
|
|
32799
|
+
b,
|
|
32800
|
+
(val, key) => {
|
|
32801
|
+
if (thisArg && isFunction$2(val)) {
|
|
32802
|
+
Object.defineProperty(a, key, {
|
|
32803
|
+
value: bind(val, thisArg),
|
|
32804
|
+
writable: true,
|
|
32805
|
+
enumerable: true,
|
|
32806
|
+
configurable: true,
|
|
32807
|
+
});
|
|
32808
|
+
} else {
|
|
32809
|
+
Object.defineProperty(a, key, {
|
|
32810
|
+
value: val,
|
|
32811
|
+
writable: true,
|
|
32812
|
+
enumerable: true,
|
|
32813
|
+
configurable: true,
|
|
32814
|
+
});
|
|
32815
|
+
}
|
|
32816
|
+
},
|
|
32817
|
+
{ allOwnKeys }
|
|
32818
|
+
);
|
|
32704
32819
|
return a;
|
|
32705
32820
|
};
|
|
32706
32821
|
|
|
@@ -32712,7 +32827,7 @@ const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
|
32712
32827
|
* @returns {string} content value without BOM
|
|
32713
32828
|
*/
|
|
32714
32829
|
const stripBOM = (content) => {
|
|
32715
|
-
if (content.charCodeAt(0) ===
|
|
32830
|
+
if (content.charCodeAt(0) === 0xfeff) {
|
|
32716
32831
|
content = content.slice(1);
|
|
32717
32832
|
}
|
|
32718
32833
|
return content;
|
|
@@ -32729,9 +32844,14 @@ const stripBOM = (content) => {
|
|
|
32729
32844
|
*/
|
|
32730
32845
|
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
32731
32846
|
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
32732
|
-
constructor.prototype
|
|
32847
|
+
Object.defineProperty(constructor.prototype, 'constructor', {
|
|
32848
|
+
value: constructor,
|
|
32849
|
+
writable: true,
|
|
32850
|
+
enumerable: false,
|
|
32851
|
+
configurable: true,
|
|
32852
|
+
});
|
|
32733
32853
|
Object.defineProperty(constructor, 'super', {
|
|
32734
|
-
value: superConstructor.prototype
|
|
32854
|
+
value: superConstructor.prototype,
|
|
32735
32855
|
});
|
|
32736
32856
|
props && Object.assign(constructor.prototype, props);
|
|
32737
32857
|
};
|
|
@@ -32790,7 +32910,6 @@ const endsWith = (str, searchString, position) => {
|
|
|
32790
32910
|
return lastIndex !== -1 && lastIndex === position;
|
|
32791
32911
|
};
|
|
32792
32912
|
|
|
32793
|
-
|
|
32794
32913
|
/**
|
|
32795
32914
|
* Returns new array from array like object or null if failed
|
|
32796
32915
|
*
|
|
@@ -32819,9 +32938,9 @@ const toArray = (thing) => {
|
|
|
32819
32938
|
* @returns {Array}
|
|
32820
32939
|
*/
|
|
32821
32940
|
// eslint-disable-next-line func-names
|
|
32822
|
-
const isTypedArray = (TypedArray => {
|
|
32941
|
+
const isTypedArray = ((TypedArray) => {
|
|
32823
32942
|
// eslint-disable-next-line func-names
|
|
32824
|
-
return thing => {
|
|
32943
|
+
return (thing) => {
|
|
32825
32944
|
return TypedArray && thing instanceof TypedArray;
|
|
32826
32945
|
};
|
|
32827
32946
|
})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
|
|
@@ -32835,13 +32954,13 @@ const isTypedArray = (TypedArray => {
|
|
|
32835
32954
|
* @returns {void}
|
|
32836
32955
|
*/
|
|
32837
32956
|
const forEachEntry = (obj, fn) => {
|
|
32838
|
-
const generator = obj && obj[
|
|
32957
|
+
const generator = obj && obj[iterator];
|
|
32839
32958
|
|
|
32840
|
-
const
|
|
32959
|
+
const _iterator = generator.call(obj);
|
|
32841
32960
|
|
|
32842
32961
|
let result;
|
|
32843
32962
|
|
|
32844
|
-
while ((result =
|
|
32963
|
+
while ((result = _iterator.next()) && !result.done) {
|
|
32845
32964
|
const pair = result.value;
|
|
32846
32965
|
fn.call(obj, pair[0], pair[1]);
|
|
32847
32966
|
}
|
|
@@ -32869,16 +32988,18 @@ const matchAll = (regExp, str) => {
|
|
|
32869
32988
|
/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
|
|
32870
32989
|
const isHTMLForm = kindOfTest('HTMLFormElement');
|
|
32871
32990
|
|
|
32872
|
-
const toCamelCase = str => {
|
|
32873
|
-
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
|
|
32874
|
-
|
|
32875
|
-
|
|
32876
|
-
}
|
|
32877
|
-
);
|
|
32991
|
+
const toCamelCase = (str) => {
|
|
32992
|
+
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
|
|
32993
|
+
return p1.toUpperCase() + p2;
|
|
32994
|
+
});
|
|
32878
32995
|
};
|
|
32879
32996
|
|
|
32880
32997
|
/* Creating a function that will check if an object has a property. */
|
|
32881
|
-
const hasOwnProperty = (
|
|
32998
|
+
const hasOwnProperty = (
|
|
32999
|
+
({ hasOwnProperty }) =>
|
|
33000
|
+
(obj, prop) =>
|
|
33001
|
+
hasOwnProperty.call(obj, prop)
|
|
33002
|
+
)(Object.prototype);
|
|
32882
33003
|
|
|
32883
33004
|
/**
|
|
32884
33005
|
* Determine if a value is a RegExp object
|
|
@@ -32911,13 +33032,13 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
32911
33032
|
const freezeMethods = (obj) => {
|
|
32912
33033
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
32913
33034
|
// skip restricted props in strict mode
|
|
32914
|
-
if (isFunction$
|
|
33035
|
+
if (isFunction$2(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
32915
33036
|
return false;
|
|
32916
33037
|
}
|
|
32917
33038
|
|
|
32918
33039
|
const value = obj[name];
|
|
32919
33040
|
|
|
32920
|
-
if (!isFunction$
|
|
33041
|
+
if (!isFunction$2(value)) return;
|
|
32921
33042
|
|
|
32922
33043
|
descriptor.enumerable = false;
|
|
32923
33044
|
|
|
@@ -32928,17 +33049,25 @@ const freezeMethods = (obj) => {
|
|
|
32928
33049
|
|
|
32929
33050
|
if (!descriptor.set) {
|
|
32930
33051
|
descriptor.set = () => {
|
|
32931
|
-
throw Error(
|
|
33052
|
+
throw Error("Can not rewrite read-only method '" + name + "'");
|
|
32932
33053
|
};
|
|
32933
33054
|
}
|
|
32934
33055
|
});
|
|
32935
33056
|
};
|
|
32936
33057
|
|
|
33058
|
+
/**
|
|
33059
|
+
* Converts an array or a delimited string into an object set with values as keys and true as values.
|
|
33060
|
+
* Useful for fast membership checks.
|
|
33061
|
+
*
|
|
33062
|
+
* @param {Array|string} arrayOrString - The array or string to convert.
|
|
33063
|
+
* @param {string} delimiter - The delimiter to use if input is a string.
|
|
33064
|
+
* @returns {Object} An object with keys from the array or string, values set to true.
|
|
33065
|
+
*/
|
|
32937
33066
|
const toObjectSet = (arrayOrString, delimiter) => {
|
|
32938
33067
|
const obj = {};
|
|
32939
33068
|
|
|
32940
33069
|
const define = (arr) => {
|
|
32941
|
-
arr.forEach(value => {
|
|
33070
|
+
arr.forEach((value) => {
|
|
32942
33071
|
obj[value] = true;
|
|
32943
33072
|
});
|
|
32944
33073
|
};
|
|
@@ -32951,28 +33080,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|
|
32951
33080
|
const noop = () => {};
|
|
32952
33081
|
|
|
32953
33082
|
const toFiniteNumber = (value, defaultValue) => {
|
|
32954
|
-
value = +value;
|
|
32955
|
-
return Number.isFinite(value) ? value : defaultValue;
|
|
32956
|
-
};
|
|
32957
|
-
|
|
32958
|
-
const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
|
|
32959
|
-
|
|
32960
|
-
const DIGIT = '0123456789';
|
|
32961
|
-
|
|
32962
|
-
const ALPHABET = {
|
|
32963
|
-
DIGIT,
|
|
32964
|
-
ALPHA,
|
|
32965
|
-
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
|
32966
|
-
};
|
|
32967
|
-
|
|
32968
|
-
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
|
32969
|
-
let str = '';
|
|
32970
|
-
const {length} = alphabet;
|
|
32971
|
-
while (size--) {
|
|
32972
|
-
str += alphabet[Math.random() * length|0];
|
|
32973
|
-
}
|
|
32974
|
-
|
|
32975
|
-
return str;
|
|
33083
|
+
return value != null && Number.isFinite((value = +value)) ? value : defaultValue;
|
|
32976
33084
|
};
|
|
32977
33085
|
|
|
32978
33086
|
/**
|
|
@@ -32983,20 +33091,35 @@ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
|
|
32983
33091
|
* @returns {boolean}
|
|
32984
33092
|
*/
|
|
32985
33093
|
function isSpecCompliantForm(thing) {
|
|
32986
|
-
return !!(
|
|
33094
|
+
return !!(
|
|
33095
|
+
thing &&
|
|
33096
|
+
isFunction$2(thing.append) &&
|
|
33097
|
+
thing[toStringTag] === 'FormData' &&
|
|
33098
|
+
thing[iterator]
|
|
33099
|
+
);
|
|
32987
33100
|
}
|
|
32988
33101
|
|
|
33102
|
+
/**
|
|
33103
|
+
* Recursively converts an object to a JSON-compatible object, handling circular references and Buffers.
|
|
33104
|
+
*
|
|
33105
|
+
* @param {Object} obj - The object to convert.
|
|
33106
|
+
* @returns {Object} The JSON-compatible object.
|
|
33107
|
+
*/
|
|
32989
33108
|
const toJSONObject = (obj) => {
|
|
32990
33109
|
const stack = new Array(10);
|
|
32991
33110
|
|
|
32992
33111
|
const visit = (source, i) => {
|
|
32993
|
-
|
|
32994
33112
|
if (isObject$1(source)) {
|
|
32995
33113
|
if (stack.indexOf(source) >= 0) {
|
|
32996
33114
|
return;
|
|
32997
33115
|
}
|
|
32998
33116
|
|
|
32999
|
-
|
|
33117
|
+
//Buffer check
|
|
33118
|
+
if (isBuffer(source)) {
|
|
33119
|
+
return source;
|
|
33120
|
+
}
|
|
33121
|
+
|
|
33122
|
+
if (!('toJSON' in source)) {
|
|
33000
33123
|
stack[i] = source;
|
|
33001
33124
|
const target = isArray(source) ? [] : {};
|
|
33002
33125
|
|
|
@@ -33017,10 +33140,76 @@ const toJSONObject = (obj) => {
|
|
|
33017
33140
|
return visit(obj, 0);
|
|
33018
33141
|
};
|
|
33019
33142
|
|
|
33143
|
+
/**
|
|
33144
|
+
* Determines if a value is an async function.
|
|
33145
|
+
*
|
|
33146
|
+
* @param {*} thing - The value to test.
|
|
33147
|
+
* @returns {boolean} True if value is an async function, otherwise false.
|
|
33148
|
+
*/
|
|
33020
33149
|
const isAsyncFn = kindOfTest('AsyncFunction');
|
|
33021
33150
|
|
|
33151
|
+
/**
|
|
33152
|
+
* Determines if a value is thenable (has then and catch methods).
|
|
33153
|
+
*
|
|
33154
|
+
* @param {*} thing - The value to test.
|
|
33155
|
+
* @returns {boolean} True if value is thenable, otherwise false.
|
|
33156
|
+
*/
|
|
33022
33157
|
const isThenable = (thing) =>
|
|
33023
|
-
thing &&
|
|
33158
|
+
thing &&
|
|
33159
|
+
(isObject$1(thing) || isFunction$2(thing)) &&
|
|
33160
|
+
isFunction$2(thing.then) &&
|
|
33161
|
+
isFunction$2(thing.catch);
|
|
33162
|
+
|
|
33163
|
+
// original code
|
|
33164
|
+
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
33165
|
+
|
|
33166
|
+
/**
|
|
33167
|
+
* Provides a cross-platform setImmediate implementation.
|
|
33168
|
+
* Uses native setImmediate if available, otherwise falls back to postMessage or setTimeout.
|
|
33169
|
+
*
|
|
33170
|
+
* @param {boolean} setImmediateSupported - Whether setImmediate is supported.
|
|
33171
|
+
* @param {boolean} postMessageSupported - Whether postMessage is supported.
|
|
33172
|
+
* @returns {Function} A function to schedule a callback asynchronously.
|
|
33173
|
+
*/
|
|
33174
|
+
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
33175
|
+
if (setImmediateSupported) {
|
|
33176
|
+
return setImmediate;
|
|
33177
|
+
}
|
|
33178
|
+
|
|
33179
|
+
return postMessageSupported
|
|
33180
|
+
? ((token, callbacks) => {
|
|
33181
|
+
_global.addEventListener(
|
|
33182
|
+
'message',
|
|
33183
|
+
({ source, data }) => {
|
|
33184
|
+
if (source === _global && data === token) {
|
|
33185
|
+
callbacks.length && callbacks.shift()();
|
|
33186
|
+
}
|
|
33187
|
+
},
|
|
33188
|
+
false
|
|
33189
|
+
);
|
|
33190
|
+
|
|
33191
|
+
return (cb) => {
|
|
33192
|
+
callbacks.push(cb);
|
|
33193
|
+
_global.postMessage(token, '*');
|
|
33194
|
+
};
|
|
33195
|
+
})(`axios@${Math.random()}`, [])
|
|
33196
|
+
: (cb) => setTimeout(cb);
|
|
33197
|
+
})(typeof setImmediate === 'function', isFunction$2(_global.postMessage));
|
|
33198
|
+
|
|
33199
|
+
/**
|
|
33200
|
+
* Schedules a microtask or asynchronous callback as soon as possible.
|
|
33201
|
+
* Uses queueMicrotask if available, otherwise falls back to process.nextTick or _setImmediate.
|
|
33202
|
+
*
|
|
33203
|
+
* @type {Function}
|
|
33204
|
+
*/
|
|
33205
|
+
const asap =
|
|
33206
|
+
typeof queueMicrotask !== 'undefined'
|
|
33207
|
+
? queueMicrotask.bind(_global)
|
|
33208
|
+
: (typeof process !== 'undefined' && process.nextTick) || _setImmediate;
|
|
33209
|
+
|
|
33210
|
+
// *********************
|
|
33211
|
+
|
|
33212
|
+
const isIterable = (thing) => thing != null && isFunction$2(thing[iterator]);
|
|
33024
33213
|
|
|
33025
33214
|
var utils$1 = {
|
|
33026
33215
|
isArray,
|
|
@@ -33033,12 +33222,19 @@ var utils$1 = {
|
|
|
33033
33222
|
isBoolean,
|
|
33034
33223
|
isObject: isObject$1,
|
|
33035
33224
|
isPlainObject,
|
|
33225
|
+
isEmptyObject,
|
|
33226
|
+
isReadableStream,
|
|
33227
|
+
isRequest,
|
|
33228
|
+
isResponse,
|
|
33229
|
+
isHeaders,
|
|
33036
33230
|
isUndefined,
|
|
33037
33231
|
isDate,
|
|
33038
33232
|
isFile,
|
|
33233
|
+
isReactNativeBlob,
|
|
33234
|
+
isReactNative,
|
|
33039
33235
|
isBlob,
|
|
33040
33236
|
isRegExp,
|
|
33041
|
-
isFunction: isFunction$
|
|
33237
|
+
isFunction: isFunction$2,
|
|
33042
33238
|
isStream,
|
|
33043
33239
|
isURLSearchParams,
|
|
33044
33240
|
isTypedArray,
|
|
@@ -33068,44 +33264,66 @@ var utils$1 = {
|
|
|
33068
33264
|
findKey,
|
|
33069
33265
|
global: _global,
|
|
33070
33266
|
isContextDefined,
|
|
33071
|
-
ALPHABET,
|
|
33072
|
-
generateString,
|
|
33073
33267
|
isSpecCompliantForm,
|
|
33074
33268
|
toJSONObject,
|
|
33075
33269
|
isAsyncFn,
|
|
33076
|
-
isThenable
|
|
33270
|
+
isThenable,
|
|
33271
|
+
setImmediate: _setImmediate,
|
|
33272
|
+
asap,
|
|
33273
|
+
isIterable,
|
|
33077
33274
|
};
|
|
33078
33275
|
|
|
33079
|
-
|
|
33080
|
-
|
|
33081
|
-
|
|
33082
|
-
|
|
33083
|
-
|
|
33084
|
-
* @param {Object} [config] The config.
|
|
33085
|
-
* @param {Object} [request] The request.
|
|
33086
|
-
* @param {Object} [response] The response.
|
|
33087
|
-
*
|
|
33088
|
-
* @returns {Error} The created error.
|
|
33089
|
-
*/
|
|
33090
|
-
function AxiosError$1(message, code, config, request, response) {
|
|
33091
|
-
Error.call(this);
|
|
33276
|
+
let AxiosError$1 = class AxiosError extends Error {
|
|
33277
|
+
static from(error, code, config, request, response, customProps) {
|
|
33278
|
+
const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
|
33279
|
+
axiosError.cause = error;
|
|
33280
|
+
axiosError.name = error.name;
|
|
33092
33281
|
|
|
33093
|
-
|
|
33094
|
-
|
|
33095
|
-
|
|
33096
|
-
|
|
33282
|
+
// Preserve status from the original error if not already set from response
|
|
33283
|
+
if (error.status != null && axiosError.status == null) {
|
|
33284
|
+
axiosError.status = error.status;
|
|
33285
|
+
}
|
|
33286
|
+
|
|
33287
|
+
customProps && Object.assign(axiosError, customProps);
|
|
33288
|
+
return axiosError;
|
|
33097
33289
|
}
|
|
33098
33290
|
|
|
33099
|
-
|
|
33100
|
-
|
|
33101
|
-
|
|
33102
|
-
|
|
33103
|
-
|
|
33104
|
-
|
|
33105
|
-
}
|
|
33291
|
+
/**
|
|
33292
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
33293
|
+
*
|
|
33294
|
+
* @param {string} message The error message.
|
|
33295
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
33296
|
+
* @param {Object} [config] The config.
|
|
33297
|
+
* @param {Object} [request] The request.
|
|
33298
|
+
* @param {Object} [response] The response.
|
|
33299
|
+
*
|
|
33300
|
+
* @returns {Error} The created error.
|
|
33301
|
+
*/
|
|
33302
|
+
constructor(message, code, config, request, response) {
|
|
33303
|
+
super(message);
|
|
33304
|
+
|
|
33305
|
+
// Make message enumerable to maintain backward compatibility
|
|
33306
|
+
// The native Error constructor sets message as non-enumerable,
|
|
33307
|
+
// but axios < v1.13.3 had it as enumerable
|
|
33308
|
+
Object.defineProperty(this, 'message', {
|
|
33309
|
+
value: message,
|
|
33310
|
+
enumerable: true,
|
|
33311
|
+
writable: true,
|
|
33312
|
+
configurable: true
|
|
33313
|
+
});
|
|
33314
|
+
|
|
33315
|
+
this.name = 'AxiosError';
|
|
33316
|
+
this.isAxiosError = true;
|
|
33317
|
+
code && (this.code = code);
|
|
33318
|
+
config && (this.config = config);
|
|
33319
|
+
request && (this.request = request);
|
|
33320
|
+
if (response) {
|
|
33321
|
+
this.response = response;
|
|
33322
|
+
this.status = response.status;
|
|
33323
|
+
}
|
|
33324
|
+
}
|
|
33106
33325
|
|
|
33107
|
-
|
|
33108
|
-
toJSON: function toJSON() {
|
|
33326
|
+
toJSON() {
|
|
33109
33327
|
return {
|
|
33110
33328
|
// Standard
|
|
33111
33329
|
message: this.message,
|
|
@@ -33121,56 +33339,25 @@ utils$1.inherits(AxiosError$1, Error, {
|
|
|
33121
33339
|
// Axios
|
|
33122
33340
|
config: utils$1.toJSONObject(this.config),
|
|
33123
33341
|
code: this.code,
|
|
33124
|
-
status: this.
|
|
33342
|
+
status: this.status,
|
|
33125
33343
|
};
|
|
33126
33344
|
}
|
|
33127
|
-
});
|
|
33128
|
-
|
|
33129
|
-
const prototype$1 = AxiosError$1.prototype;
|
|
33130
|
-
const descriptors = {};
|
|
33131
|
-
|
|
33132
|
-
[
|
|
33133
|
-
'ERR_BAD_OPTION_VALUE',
|
|
33134
|
-
'ERR_BAD_OPTION',
|
|
33135
|
-
'ECONNABORTED',
|
|
33136
|
-
'ETIMEDOUT',
|
|
33137
|
-
'ERR_NETWORK',
|
|
33138
|
-
'ERR_FR_TOO_MANY_REDIRECTS',
|
|
33139
|
-
'ERR_DEPRECATED',
|
|
33140
|
-
'ERR_BAD_RESPONSE',
|
|
33141
|
-
'ERR_BAD_REQUEST',
|
|
33142
|
-
'ERR_CANCELED',
|
|
33143
|
-
'ERR_NOT_SUPPORT',
|
|
33144
|
-
'ERR_INVALID_URL'
|
|
33145
|
-
// eslint-disable-next-line func-names
|
|
33146
|
-
].forEach(code => {
|
|
33147
|
-
descriptors[code] = {value: code};
|
|
33148
|
-
});
|
|
33149
|
-
|
|
33150
|
-
Object.defineProperties(AxiosError$1, descriptors);
|
|
33151
|
-
Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
|
|
33152
|
-
|
|
33153
|
-
// eslint-disable-next-line func-names
|
|
33154
|
-
AxiosError$1.from = (error, code, config, request, response, customProps) => {
|
|
33155
|
-
const axiosError = Object.create(prototype$1);
|
|
33156
|
-
|
|
33157
|
-
utils$1.toFlatObject(error, axiosError, function filter(obj) {
|
|
33158
|
-
return obj !== Error.prototype;
|
|
33159
|
-
}, prop => {
|
|
33160
|
-
return prop !== 'isAxiosError';
|
|
33161
|
-
});
|
|
33162
|
-
|
|
33163
|
-
AxiosError$1.call(axiosError, error.message, code, config, request, response);
|
|
33164
|
-
|
|
33165
|
-
axiosError.cause = error;
|
|
33166
|
-
|
|
33167
|
-
axiosError.name = error.name;
|
|
33168
|
-
|
|
33169
|
-
customProps && Object.assign(axiosError, customProps);
|
|
33170
|
-
|
|
33171
|
-
return axiosError;
|
|
33172
33345
|
};
|
|
33173
33346
|
|
|
33347
|
+
// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
|
|
33348
|
+
AxiosError$1.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
|
|
33349
|
+
AxiosError$1.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
|
33350
|
+
AxiosError$1.ECONNABORTED = 'ECONNABORTED';
|
|
33351
|
+
AxiosError$1.ETIMEDOUT = 'ETIMEDOUT';
|
|
33352
|
+
AxiosError$1.ERR_NETWORK = 'ERR_NETWORK';
|
|
33353
|
+
AxiosError$1.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
|
33354
|
+
AxiosError$1.ERR_DEPRECATED = 'ERR_DEPRECATED';
|
|
33355
|
+
AxiosError$1.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
|
|
33356
|
+
AxiosError$1.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
|
33357
|
+
AxiosError$1.ERR_CANCELED = 'ERR_CANCELED';
|
|
33358
|
+
AxiosError$1.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
33359
|
+
AxiosError$1.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|
33360
|
+
|
|
33174
33361
|
// eslint-disable-next-line strict
|
|
33175
33362
|
var httpAdapter = null;
|
|
33176
33363
|
|
|
@@ -33207,11 +33394,14 @@ function removeBrackets(key) {
|
|
|
33207
33394
|
*/
|
|
33208
33395
|
function renderKey(path, key, dots) {
|
|
33209
33396
|
if (!path) return key;
|
|
33210
|
-
return path
|
|
33211
|
-
|
|
33212
|
-
|
|
33213
|
-
|
|
33214
|
-
|
|
33397
|
+
return path
|
|
33398
|
+
.concat(key)
|
|
33399
|
+
.map(function each(token, i) {
|
|
33400
|
+
// eslint-disable-next-line no-param-reassign
|
|
33401
|
+
token = removeBrackets(token);
|
|
33402
|
+
return !dots && i ? '[' + token + ']' : token;
|
|
33403
|
+
})
|
|
33404
|
+
.join(dots ? '.' : '');
|
|
33215
33405
|
}
|
|
33216
33406
|
|
|
33217
33407
|
/**
|
|
@@ -33261,21 +33451,26 @@ function toFormData$1(obj, formData, options) {
|
|
|
33261
33451
|
formData = formData || new (FormData)();
|
|
33262
33452
|
|
|
33263
33453
|
// eslint-disable-next-line no-param-reassign
|
|
33264
|
-
options = utils$1.toFlatObject(
|
|
33265
|
-
|
|
33266
|
-
|
|
33267
|
-
|
|
33268
|
-
|
|
33269
|
-
|
|
33270
|
-
|
|
33271
|
-
|
|
33454
|
+
options = utils$1.toFlatObject(
|
|
33455
|
+
options,
|
|
33456
|
+
{
|
|
33457
|
+
metaTokens: true,
|
|
33458
|
+
dots: false,
|
|
33459
|
+
indexes: false,
|
|
33460
|
+
},
|
|
33461
|
+
false,
|
|
33462
|
+
function defined(option, source) {
|
|
33463
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
33464
|
+
return !utils$1.isUndefined(source[option]);
|
|
33465
|
+
}
|
|
33466
|
+
);
|
|
33272
33467
|
|
|
33273
33468
|
const metaTokens = options.metaTokens;
|
|
33274
33469
|
// eslint-disable-next-line no-use-before-define
|
|
33275
33470
|
const visitor = options.visitor || defaultVisitor;
|
|
33276
33471
|
const dots = options.dots;
|
|
33277
33472
|
const indexes = options.indexes;
|
|
33278
|
-
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
33473
|
+
const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
|
|
33279
33474
|
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
33280
33475
|
|
|
33281
33476
|
if (!utils$1.isFunction(visitor)) {
|
|
@@ -33289,6 +33484,10 @@ function toFormData$1(obj, formData, options) {
|
|
|
33289
33484
|
return value.toISOString();
|
|
33290
33485
|
}
|
|
33291
33486
|
|
|
33487
|
+
if (utils$1.isBoolean(value)) {
|
|
33488
|
+
return value.toString();
|
|
33489
|
+
}
|
|
33490
|
+
|
|
33292
33491
|
if (!useBlob && utils$1.isBlob(value)) {
|
|
33293
33492
|
throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
|
|
33294
33493
|
}
|
|
@@ -33313,6 +33512,11 @@ function toFormData$1(obj, formData, options) {
|
|
|
33313
33512
|
function defaultVisitor(value, key, path) {
|
|
33314
33513
|
let arr = value;
|
|
33315
33514
|
|
|
33515
|
+
if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
|
|
33516
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
33517
|
+
return false;
|
|
33518
|
+
}
|
|
33519
|
+
|
|
33316
33520
|
if (value && !path && typeof value === 'object') {
|
|
33317
33521
|
if (utils$1.endsWith(key, '{}')) {
|
|
33318
33522
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -33321,17 +33525,22 @@ function toFormData$1(obj, formData, options) {
|
|
|
33321
33525
|
value = JSON.stringify(value);
|
|
33322
33526
|
} else if (
|
|
33323
33527
|
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
33324
|
-
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
|
|
33325
|
-
|
|
33528
|
+
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
|
|
33529
|
+
) {
|
|
33326
33530
|
// eslint-disable-next-line no-param-reassign
|
|
33327
33531
|
key = removeBrackets(key);
|
|
33328
33532
|
|
|
33329
33533
|
arr.forEach(function each(el, index) {
|
|
33330
|
-
!(utils$1.isUndefined(el) || el === null) &&
|
|
33331
|
-
|
|
33332
|
-
|
|
33333
|
-
|
|
33334
|
-
|
|
33534
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
33535
|
+
formData.append(
|
|
33536
|
+
// eslint-disable-next-line no-nested-ternary
|
|
33537
|
+
indexes === true
|
|
33538
|
+
? renderKey([key], index, dots)
|
|
33539
|
+
: indexes === null
|
|
33540
|
+
? key
|
|
33541
|
+
: key + '[]',
|
|
33542
|
+
convertValue(el)
|
|
33543
|
+
);
|
|
33335
33544
|
});
|
|
33336
33545
|
return false;
|
|
33337
33546
|
}
|
|
@@ -33351,7 +33560,7 @@ function toFormData$1(obj, formData, options) {
|
|
|
33351
33560
|
const exposedHelpers = Object.assign(predicates, {
|
|
33352
33561
|
defaultVisitor,
|
|
33353
33562
|
convertValue,
|
|
33354
|
-
isVisitable
|
|
33563
|
+
isVisitable,
|
|
33355
33564
|
});
|
|
33356
33565
|
|
|
33357
33566
|
function build(value, path) {
|
|
@@ -33364,9 +33573,9 @@ function toFormData$1(obj, formData, options) {
|
|
|
33364
33573
|
stack.push(value);
|
|
33365
33574
|
|
|
33366
33575
|
utils$1.forEach(value, function each(el, key) {
|
|
33367
|
-
const result =
|
|
33368
|
-
|
|
33369
|
-
|
|
33576
|
+
const result =
|
|
33577
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
33578
|
+
visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
33370
33579
|
|
|
33371
33580
|
if (result === true) {
|
|
33372
33581
|
build(el, path ? path.concat(key) : [key]);
|
|
@@ -33401,7 +33610,7 @@ function encode$1(str) {
|
|
|
33401
33610
|
')': '%29',
|
|
33402
33611
|
'~': '%7E',
|
|
33403
33612
|
'%20': '+',
|
|
33404
|
-
'%00': '\x00'
|
|
33613
|
+
'%00': '\x00',
|
|
33405
33614
|
};
|
|
33406
33615
|
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
33407
33616
|
return charMap[match];
|
|
@@ -33429,31 +33638,33 @@ prototype.append = function append(name, value) {
|
|
|
33429
33638
|
};
|
|
33430
33639
|
|
|
33431
33640
|
prototype.toString = function toString(encoder) {
|
|
33432
|
-
const _encode = encoder
|
|
33433
|
-
|
|
33434
|
-
|
|
33641
|
+
const _encode = encoder
|
|
33642
|
+
? function (value) {
|
|
33643
|
+
return encoder.call(this, value, encode$1);
|
|
33644
|
+
}
|
|
33645
|
+
: encode$1;
|
|
33435
33646
|
|
|
33436
|
-
return this._pairs
|
|
33437
|
-
|
|
33438
|
-
|
|
33647
|
+
return this._pairs
|
|
33648
|
+
.map(function each(pair) {
|
|
33649
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
33650
|
+
}, '')
|
|
33651
|
+
.join('&');
|
|
33439
33652
|
};
|
|
33440
33653
|
|
|
33441
33654
|
/**
|
|
33442
|
-
* It replaces
|
|
33443
|
-
*
|
|
33655
|
+
* It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
|
|
33656
|
+
* their plain counterparts (`:`, `$`, `,`, `+`).
|
|
33444
33657
|
*
|
|
33445
33658
|
* @param {string} val The value to be encoded.
|
|
33446
33659
|
*
|
|
33447
33660
|
* @returns {string} The encoded value.
|
|
33448
33661
|
*/
|
|
33449
33662
|
function encode(val) {
|
|
33450
|
-
return encodeURIComponent(val)
|
|
33451
|
-
replace(/%3A/gi, ':')
|
|
33452
|
-
replace(/%24/g, '$')
|
|
33453
|
-
replace(/%2C/gi, ',')
|
|
33454
|
-
replace(/%20/g, '+')
|
|
33455
|
-
replace(/%5B/gi, '[').
|
|
33456
|
-
replace(/%5D/gi, ']');
|
|
33663
|
+
return encodeURIComponent(val)
|
|
33664
|
+
.replace(/%3A/gi, ':')
|
|
33665
|
+
.replace(/%24/g, '$')
|
|
33666
|
+
.replace(/%2C/gi, ',')
|
|
33667
|
+
.replace(/%20/g, '+');
|
|
33457
33668
|
}
|
|
33458
33669
|
|
|
33459
33670
|
/**
|
|
@@ -33461,32 +33672,37 @@ function encode(val) {
|
|
|
33461
33672
|
*
|
|
33462
33673
|
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
33463
33674
|
* @param {object} [params] The params to be appended
|
|
33464
|
-
* @param {?object} options
|
|
33675
|
+
* @param {?(object|Function)} options
|
|
33465
33676
|
*
|
|
33466
33677
|
* @returns {string} The formatted url
|
|
33467
33678
|
*/
|
|
33468
33679
|
function buildURL(url, params, options) {
|
|
33469
|
-
/*eslint no-param-reassign:0*/
|
|
33470
33680
|
if (!params) {
|
|
33471
33681
|
return url;
|
|
33472
33682
|
}
|
|
33473
|
-
|
|
33474
|
-
const _encode = options && options.encode || encode;
|
|
33475
33683
|
|
|
33476
|
-
const
|
|
33684
|
+
const _encode = (options && options.encode) || encode;
|
|
33685
|
+
|
|
33686
|
+
const _options = utils$1.isFunction(options)
|
|
33687
|
+
? {
|
|
33688
|
+
serialize: options,
|
|
33689
|
+
}
|
|
33690
|
+
: options;
|
|
33691
|
+
|
|
33692
|
+
const serializeFn = _options && _options.serialize;
|
|
33477
33693
|
|
|
33478
33694
|
let serializedParams;
|
|
33479
33695
|
|
|
33480
33696
|
if (serializeFn) {
|
|
33481
|
-
serializedParams = serializeFn(params,
|
|
33697
|
+
serializedParams = serializeFn(params, _options);
|
|
33482
33698
|
} else {
|
|
33483
|
-
serializedParams = utils$1.isURLSearchParams(params)
|
|
33484
|
-
params.toString()
|
|
33485
|
-
new AxiosURLSearchParams(params,
|
|
33699
|
+
serializedParams = utils$1.isURLSearchParams(params)
|
|
33700
|
+
? params.toString()
|
|
33701
|
+
: new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
33486
33702
|
}
|
|
33487
33703
|
|
|
33488
33704
|
if (serializedParams) {
|
|
33489
|
-
const hashmarkIndex = url.indexOf(
|
|
33705
|
+
const hashmarkIndex = url.indexOf('#');
|
|
33490
33706
|
|
|
33491
33707
|
if (hashmarkIndex !== -1) {
|
|
33492
33708
|
url = url.slice(0, hashmarkIndex);
|
|
@@ -33507,6 +33723,7 @@ class InterceptorManager {
|
|
|
33507
33723
|
*
|
|
33508
33724
|
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
33509
33725
|
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
33726
|
+
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
|
33510
33727
|
*
|
|
33511
33728
|
* @return {Number} An ID used to remove interceptor later
|
|
33512
33729
|
*/
|
|
@@ -33515,7 +33732,7 @@ class InterceptorManager {
|
|
|
33515
33732
|
fulfilled,
|
|
33516
33733
|
rejected,
|
|
33517
33734
|
synchronous: options ? options.synchronous : false,
|
|
33518
|
-
runWhen: options ? options.runWhen : null
|
|
33735
|
+
runWhen: options ? options.runWhen : null,
|
|
33519
33736
|
});
|
|
33520
33737
|
return this.handlers.length - 1;
|
|
33521
33738
|
}
|
|
@@ -33525,7 +33742,7 @@ class InterceptorManager {
|
|
|
33525
33742
|
*
|
|
33526
33743
|
* @param {Number} id The ID that was returned by `use`
|
|
33527
33744
|
*
|
|
33528
|
-
* @returns {
|
|
33745
|
+
* @returns {void}
|
|
33529
33746
|
*/
|
|
33530
33747
|
eject(id) {
|
|
33531
33748
|
if (this.handlers[id]) {
|
|
@@ -33566,7 +33783,8 @@ class InterceptorManager {
|
|
|
33566
33783
|
var transitionalDefaults = {
|
|
33567
33784
|
silentJSONParsing: true,
|
|
33568
33785
|
forcedJSONParsing: true,
|
|
33569
|
-
clarifyTimeoutError: false
|
|
33786
|
+
clarifyTimeoutError: false,
|
|
33787
|
+
legacyInterceptorReqResOrdering: true,
|
|
33570
33788
|
};
|
|
33571
33789
|
|
|
33572
33790
|
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
@@ -33580,13 +33798,15 @@ var platform$1 = {
|
|
|
33580
33798
|
classes: {
|
|
33581
33799
|
URLSearchParams: URLSearchParams$1,
|
|
33582
33800
|
FormData: FormData$1,
|
|
33583
|
-
Blob: Blob$1
|
|
33801
|
+
Blob: Blob$1,
|
|
33584
33802
|
},
|
|
33585
|
-
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
|
33803
|
+
protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
|
|
33586
33804
|
};
|
|
33587
33805
|
|
|
33588
33806
|
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
33589
33807
|
|
|
33808
|
+
const _navigator = (typeof navigator === 'object' && navigator) || undefined;
|
|
33809
|
+
|
|
33590
33810
|
/**
|
|
33591
33811
|
* Determine if we're running in a standard browser environment
|
|
33592
33812
|
*
|
|
@@ -33604,10 +33824,9 @@ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'unde
|
|
|
33604
33824
|
*
|
|
33605
33825
|
* @returns {boolean}
|
|
33606
33826
|
*/
|
|
33607
|
-
const hasStandardBrowserEnv =
|
|
33608
|
-
|
|
33609
|
-
|
|
33610
|
-
})(typeof navigator !== 'undefined' && navigator.product);
|
|
33827
|
+
const hasStandardBrowserEnv =
|
|
33828
|
+
hasBrowserEnv &&
|
|
33829
|
+
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
|
33611
33830
|
|
|
33612
33831
|
/**
|
|
33613
33832
|
* Determine if we're running in a standard browser webWorker environment
|
|
@@ -33627,29 +33846,34 @@ const hasStandardBrowserWebWorkerEnv = (() => {
|
|
|
33627
33846
|
);
|
|
33628
33847
|
})();
|
|
33629
33848
|
|
|
33849
|
+
const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
|
|
33850
|
+
|
|
33630
33851
|
var utils = /*#__PURE__*/Object.freeze({
|
|
33631
33852
|
__proto__: null,
|
|
33632
33853
|
hasBrowserEnv: hasBrowserEnv,
|
|
33633
33854
|
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
33634
|
-
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv
|
|
33855
|
+
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
33856
|
+
navigator: _navigator,
|
|
33857
|
+
origin: origin
|
|
33635
33858
|
});
|
|
33636
33859
|
|
|
33637
33860
|
var platform = {
|
|
33638
33861
|
...utils,
|
|
33639
|
-
...platform$1
|
|
33862
|
+
...platform$1,
|
|
33640
33863
|
};
|
|
33641
33864
|
|
|
33642
33865
|
function toURLEncodedForm(data, options) {
|
|
33643
|
-
return toFormData$1(data, new platform.classes.URLSearchParams(),
|
|
33644
|
-
visitor: function(value, key, path, helpers) {
|
|
33866
|
+
return toFormData$1(data, new platform.classes.URLSearchParams(), {
|
|
33867
|
+
visitor: function (value, key, path, helpers) {
|
|
33645
33868
|
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
33646
33869
|
this.append(key, value.toString('base64'));
|
|
33647
33870
|
return false;
|
|
33648
33871
|
}
|
|
33649
33872
|
|
|
33650
33873
|
return helpers.defaultVisitor.apply(this, arguments);
|
|
33651
|
-
}
|
|
33652
|
-
|
|
33874
|
+
},
|
|
33875
|
+
...options,
|
|
33876
|
+
});
|
|
33653
33877
|
}
|
|
33654
33878
|
|
|
33655
33879
|
/**
|
|
@@ -33664,7 +33888,7 @@ function parsePropPath(name) {
|
|
|
33664
33888
|
// foo.x.y.z
|
|
33665
33889
|
// foo-x-y-z
|
|
33666
33890
|
// foo x y z
|
|
33667
|
-
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
33891
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
33668
33892
|
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
33669
33893
|
});
|
|
33670
33894
|
}
|
|
@@ -33699,6 +33923,9 @@ function arrayToObject(arr) {
|
|
|
33699
33923
|
function formDataToJSON(formData) {
|
|
33700
33924
|
function buildPath(path, value, target, index) {
|
|
33701
33925
|
let name = path[index++];
|
|
33926
|
+
|
|
33927
|
+
if (name === '__proto__') return true;
|
|
33928
|
+
|
|
33702
33929
|
const isNumericKey = Number.isFinite(+name);
|
|
33703
33930
|
const isLast = index >= path.length;
|
|
33704
33931
|
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
@@ -33765,94 +33992,107 @@ function stringifySafely(rawValue, parser, encoder) {
|
|
|
33765
33992
|
}
|
|
33766
33993
|
|
|
33767
33994
|
const defaults = {
|
|
33768
|
-
|
|
33769
33995
|
transitional: transitionalDefaults,
|
|
33770
33996
|
|
|
33771
|
-
adapter: ['xhr', 'http'],
|
|
33997
|
+
adapter: ['xhr', 'http', 'fetch'],
|
|
33772
33998
|
|
|
33773
|
-
transformRequest: [
|
|
33774
|
-
|
|
33775
|
-
|
|
33776
|
-
|
|
33999
|
+
transformRequest: [
|
|
34000
|
+
function transformRequest(data, headers) {
|
|
34001
|
+
const contentType = headers.getContentType() || '';
|
|
34002
|
+
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
34003
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
33777
34004
|
|
|
33778
|
-
|
|
33779
|
-
|
|
33780
|
-
|
|
34005
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
34006
|
+
data = new FormData(data);
|
|
34007
|
+
}
|
|
34008
|
+
|
|
34009
|
+
const isFormData = utils$1.isFormData(data);
|
|
33781
34010
|
|
|
33782
|
-
|
|
34011
|
+
if (isFormData) {
|
|
34012
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
34013
|
+
}
|
|
33783
34014
|
|
|
33784
|
-
|
|
33785
|
-
|
|
34015
|
+
if (
|
|
34016
|
+
utils$1.isArrayBuffer(data) ||
|
|
34017
|
+
utils$1.isBuffer(data) ||
|
|
34018
|
+
utils$1.isStream(data) ||
|
|
34019
|
+
utils$1.isFile(data) ||
|
|
34020
|
+
utils$1.isBlob(data) ||
|
|
34021
|
+
utils$1.isReadableStream(data)
|
|
34022
|
+
) {
|
|
33786
34023
|
return data;
|
|
33787
34024
|
}
|
|
33788
|
-
|
|
33789
|
-
|
|
34025
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
34026
|
+
return data.buffer;
|
|
34027
|
+
}
|
|
34028
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
34029
|
+
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
34030
|
+
return data.toString();
|
|
34031
|
+
}
|
|
33790
34032
|
|
|
33791
|
-
|
|
33792
|
-
utils$1.isBuffer(data) ||
|
|
33793
|
-
utils$1.isStream(data) ||
|
|
33794
|
-
utils$1.isFile(data) ||
|
|
33795
|
-
utils$1.isBlob(data)
|
|
33796
|
-
) {
|
|
33797
|
-
return data;
|
|
33798
|
-
}
|
|
33799
|
-
if (utils$1.isArrayBufferView(data)) {
|
|
33800
|
-
return data.buffer;
|
|
33801
|
-
}
|
|
33802
|
-
if (utils$1.isURLSearchParams(data)) {
|
|
33803
|
-
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
33804
|
-
return data.toString();
|
|
33805
|
-
}
|
|
34033
|
+
let isFileList;
|
|
33806
34034
|
|
|
33807
|
-
|
|
34035
|
+
if (isObjectPayload) {
|
|
34036
|
+
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
34037
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
34038
|
+
}
|
|
33808
34039
|
|
|
33809
|
-
|
|
33810
|
-
|
|
33811
|
-
|
|
33812
|
-
|
|
34040
|
+
if (
|
|
34041
|
+
(isFileList = utils$1.isFileList(data)) ||
|
|
34042
|
+
contentType.indexOf('multipart/form-data') > -1
|
|
34043
|
+
) {
|
|
34044
|
+
const _FormData = this.env && this.env.FormData;
|
|
33813
34045
|
|
|
33814
|
-
|
|
33815
|
-
|
|
34046
|
+
return toFormData$1(
|
|
34047
|
+
isFileList ? { 'files[]': data } : data,
|
|
34048
|
+
_FormData && new _FormData(),
|
|
34049
|
+
this.formSerializer
|
|
34050
|
+
);
|
|
34051
|
+
}
|
|
34052
|
+
}
|
|
33816
34053
|
|
|
33817
|
-
|
|
33818
|
-
|
|
33819
|
-
|
|
33820
|
-
this.formSerializer
|
|
33821
|
-
);
|
|
34054
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
34055
|
+
headers.setContentType('application/json', false);
|
|
34056
|
+
return stringifySafely(data);
|
|
33822
34057
|
}
|
|
33823
|
-
}
|
|
33824
34058
|
|
|
33825
|
-
|
|
33826
|
-
|
|
33827
|
-
|
|
33828
|
-
}
|
|
34059
|
+
return data;
|
|
34060
|
+
},
|
|
34061
|
+
],
|
|
33829
34062
|
|
|
33830
|
-
|
|
33831
|
-
|
|
34063
|
+
transformResponse: [
|
|
34064
|
+
function transformResponse(data) {
|
|
34065
|
+
const transitional = this.transitional || defaults.transitional;
|
|
34066
|
+
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
34067
|
+
const JSONRequested = this.responseType === 'json';
|
|
33832
34068
|
|
|
33833
|
-
|
|
33834
|
-
|
|
33835
|
-
|
|
33836
|
-
const JSONRequested = this.responseType === 'json';
|
|
34069
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
34070
|
+
return data;
|
|
34071
|
+
}
|
|
33837
34072
|
|
|
33838
|
-
|
|
33839
|
-
|
|
33840
|
-
|
|
34073
|
+
if (
|
|
34074
|
+
data &&
|
|
34075
|
+
utils$1.isString(data) &&
|
|
34076
|
+
((forcedJSONParsing && !this.responseType) || JSONRequested)
|
|
34077
|
+
) {
|
|
34078
|
+
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
34079
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
33841
34080
|
|
|
33842
|
-
|
|
33843
|
-
|
|
33844
|
-
|
|
33845
|
-
|
|
33846
|
-
|
|
33847
|
-
|
|
34081
|
+
try {
|
|
34082
|
+
return JSON.parse(data, this.parseReviver);
|
|
34083
|
+
} catch (e) {
|
|
34084
|
+
if (strictJSONParsing) {
|
|
34085
|
+
if (e.name === 'SyntaxError') {
|
|
34086
|
+
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
34087
|
+
}
|
|
34088
|
+
throw e;
|
|
33848
34089
|
}
|
|
33849
|
-
throw e;
|
|
33850
34090
|
}
|
|
33851
34091
|
}
|
|
33852
|
-
}
|
|
33853
34092
|
|
|
33854
|
-
|
|
33855
|
-
|
|
34093
|
+
return data;
|
|
34094
|
+
},
|
|
34095
|
+
],
|
|
33856
34096
|
|
|
33857
34097
|
/**
|
|
33858
34098
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
@@ -33868,7 +34108,7 @@ const defaults = {
|
|
|
33868
34108
|
|
|
33869
34109
|
env: {
|
|
33870
34110
|
FormData: platform.classes.FormData,
|
|
33871
|
-
Blob: platform.classes.Blob
|
|
34111
|
+
Blob: platform.classes.Blob,
|
|
33872
34112
|
},
|
|
33873
34113
|
|
|
33874
34114
|
validateStatus: function validateStatus(status) {
|
|
@@ -33877,10 +34117,10 @@ const defaults = {
|
|
|
33877
34117
|
|
|
33878
34118
|
headers: {
|
|
33879
34119
|
common: {
|
|
33880
|
-
|
|
33881
|
-
'Content-Type': undefined
|
|
33882
|
-
}
|
|
33883
|
-
}
|
|
34120
|
+
Accept: 'application/json, text/plain, */*',
|
|
34121
|
+
'Content-Type': undefined,
|
|
34122
|
+
},
|
|
34123
|
+
},
|
|
33884
34124
|
};
|
|
33885
34125
|
|
|
33886
34126
|
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
@@ -33890,10 +34130,23 @@ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
|
33890
34130
|
// RawAxiosHeaders whose duplicates are ignored by node
|
|
33891
34131
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
33892
34132
|
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
33893
|
-
'age',
|
|
33894
|
-
'
|
|
33895
|
-
'
|
|
33896
|
-
'
|
|
34133
|
+
'age',
|
|
34134
|
+
'authorization',
|
|
34135
|
+
'content-length',
|
|
34136
|
+
'content-type',
|
|
34137
|
+
'etag',
|
|
34138
|
+
'expires',
|
|
34139
|
+
'from',
|
|
34140
|
+
'host',
|
|
34141
|
+
'if-modified-since',
|
|
34142
|
+
'if-unmodified-since',
|
|
34143
|
+
'last-modified',
|
|
34144
|
+
'location',
|
|
34145
|
+
'max-forwards',
|
|
34146
|
+
'proxy-authorization',
|
|
34147
|
+
'referer',
|
|
34148
|
+
'retry-after',
|
|
34149
|
+
'user-agent',
|
|
33897
34150
|
]);
|
|
33898
34151
|
|
|
33899
34152
|
/**
|
|
@@ -33910,47 +34163,81 @@ const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
|
33910
34163
|
*
|
|
33911
34164
|
* @returns {Object} Headers parsed into an object
|
|
33912
34165
|
*/
|
|
33913
|
-
var parseHeaders = rawHeaders => {
|
|
34166
|
+
var parseHeaders = (rawHeaders) => {
|
|
33914
34167
|
const parsed = {};
|
|
33915
34168
|
let key;
|
|
33916
34169
|
let val;
|
|
33917
34170
|
let i;
|
|
33918
34171
|
|
|
33919
|
-
rawHeaders &&
|
|
33920
|
-
|
|
33921
|
-
|
|
33922
|
-
|
|
34172
|
+
rawHeaders &&
|
|
34173
|
+
rawHeaders.split('\n').forEach(function parser(line) {
|
|
34174
|
+
i = line.indexOf(':');
|
|
34175
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
34176
|
+
val = line.substring(i + 1).trim();
|
|
33923
34177
|
|
|
33924
|
-
|
|
33925
|
-
|
|
33926
|
-
|
|
34178
|
+
if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
|
|
34179
|
+
return;
|
|
34180
|
+
}
|
|
33927
34181
|
|
|
33928
|
-
|
|
33929
|
-
|
|
33930
|
-
|
|
34182
|
+
if (key === 'set-cookie') {
|
|
34183
|
+
if (parsed[key]) {
|
|
34184
|
+
parsed[key].push(val);
|
|
34185
|
+
} else {
|
|
34186
|
+
parsed[key] = [val];
|
|
34187
|
+
}
|
|
33931
34188
|
} else {
|
|
33932
|
-
parsed[key] = [val
|
|
34189
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
33933
34190
|
}
|
|
33934
|
-
}
|
|
33935
|
-
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
33936
|
-
}
|
|
33937
|
-
});
|
|
34191
|
+
});
|
|
33938
34192
|
|
|
33939
34193
|
return parsed;
|
|
33940
34194
|
};
|
|
33941
34195
|
|
|
33942
34196
|
const $internals = Symbol('internals');
|
|
33943
34197
|
|
|
34198
|
+
const isValidHeaderValue = (value) => !/[\r\n]/.test(value);
|
|
34199
|
+
|
|
34200
|
+
function assertValidHeaderValue(value, header) {
|
|
34201
|
+
if (value === false || value == null) {
|
|
34202
|
+
return;
|
|
34203
|
+
}
|
|
34204
|
+
|
|
34205
|
+
if (utils$1.isArray(value)) {
|
|
34206
|
+
value.forEach((v) => assertValidHeaderValue(v, header));
|
|
34207
|
+
return;
|
|
34208
|
+
}
|
|
34209
|
+
|
|
34210
|
+
if (!isValidHeaderValue(String(value))) {
|
|
34211
|
+
throw new Error(`Invalid character in header content ["${header}"]`);
|
|
34212
|
+
}
|
|
34213
|
+
}
|
|
34214
|
+
|
|
33944
34215
|
function normalizeHeader(header) {
|
|
33945
34216
|
return header && String(header).trim().toLowerCase();
|
|
33946
34217
|
}
|
|
33947
34218
|
|
|
34219
|
+
function stripTrailingCRLF(str) {
|
|
34220
|
+
let end = str.length;
|
|
34221
|
+
|
|
34222
|
+
while (end > 0) {
|
|
34223
|
+
const charCode = str.charCodeAt(end - 1);
|
|
34224
|
+
|
|
34225
|
+
if (charCode !== 10 && charCode !== 13) {
|
|
34226
|
+
break;
|
|
34227
|
+
}
|
|
34228
|
+
|
|
34229
|
+
end -= 1;
|
|
34230
|
+
}
|
|
34231
|
+
|
|
34232
|
+
return end === str.length ? str : str.slice(0, end);
|
|
34233
|
+
}
|
|
34234
|
+
|
|
33948
34235
|
function normalizeValue(value) {
|
|
33949
34236
|
if (value === false || value == null) {
|
|
33950
34237
|
return value;
|
|
33951
34238
|
}
|
|
33952
34239
|
|
|
33953
|
-
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
34240
|
+
return utils$1.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
|
|
33954
34241
|
}
|
|
33955
34242
|
|
|
33956
34243
|
function parseTokens(str) {
|
|
@@ -33988,8 +34275,10 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
|
33988
34275
|
}
|
|
33989
34276
|
|
|
33990
34277
|
function formatHeader(header) {
|
|
33991
|
-
return header
|
|
33992
|
-
.
|
|
34278
|
+
return header
|
|
34279
|
+
.trim()
|
|
34280
|
+
.toLowerCase()
|
|
34281
|
+
.replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
33993
34282
|
return char.toUpperCase() + str;
|
|
33994
34283
|
});
|
|
33995
34284
|
}
|
|
@@ -33997,12 +34286,12 @@ function formatHeader(header) {
|
|
|
33997
34286
|
function buildAccessors(obj, header) {
|
|
33998
34287
|
const accessorName = utils$1.toCamelCase(' ' + header);
|
|
33999
34288
|
|
|
34000
|
-
['get', 'set', 'has'].forEach(methodName => {
|
|
34289
|
+
['get', 'set', 'has'].forEach((methodName) => {
|
|
34001
34290
|
Object.defineProperty(obj, methodName + accessorName, {
|
|
34002
|
-
value: function(arg1, arg2, arg3) {
|
|
34291
|
+
value: function (arg1, arg2, arg3) {
|
|
34003
34292
|
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
34004
34293
|
},
|
|
34005
|
-
configurable: true
|
|
34294
|
+
configurable: true,
|
|
34006
34295
|
});
|
|
34007
34296
|
});
|
|
34008
34297
|
}
|
|
@@ -34024,7 +34313,13 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
34024
34313
|
|
|
34025
34314
|
const key = utils$1.findKey(self, lHeader);
|
|
34026
34315
|
|
|
34027
|
-
if
|
|
34316
|
+
if (
|
|
34317
|
+
!key ||
|
|
34318
|
+
self[key] === undefined ||
|
|
34319
|
+
_rewrite === true ||
|
|
34320
|
+
(_rewrite === undefined && self[key] !== false)
|
|
34321
|
+
) {
|
|
34322
|
+
assertValidHeaderValue(_value, _header);
|
|
34028
34323
|
self[key || _header] = normalizeValue(_value);
|
|
34029
34324
|
}
|
|
34030
34325
|
}
|
|
@@ -34034,8 +34329,25 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
34034
34329
|
|
|
34035
34330
|
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
34036
34331
|
setHeaders(header, valueOrRewrite);
|
|
34037
|
-
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
34332
|
+
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
34038
34333
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
34334
|
+
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
34335
|
+
let obj = {},
|
|
34336
|
+
dest,
|
|
34337
|
+
key;
|
|
34338
|
+
for (const entry of header) {
|
|
34339
|
+
if (!utils$1.isArray(entry)) {
|
|
34340
|
+
throw TypeError('Object iterator must return a key-value pair');
|
|
34341
|
+
}
|
|
34342
|
+
|
|
34343
|
+
obj[(key = entry[0])] = (dest = obj[key])
|
|
34344
|
+
? utils$1.isArray(dest)
|
|
34345
|
+
? [...dest, entry[1]]
|
|
34346
|
+
: [dest, entry[1]]
|
|
34347
|
+
: entry[1];
|
|
34348
|
+
}
|
|
34349
|
+
|
|
34350
|
+
setHeaders(obj, valueOrRewrite);
|
|
34039
34351
|
} else {
|
|
34040
34352
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
34041
34353
|
}
|
|
@@ -34079,7 +34391,11 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
34079
34391
|
if (header) {
|
|
34080
34392
|
const key = utils$1.findKey(this, header);
|
|
34081
34393
|
|
|
34082
|
-
return !!(
|
|
34394
|
+
return !!(
|
|
34395
|
+
key &&
|
|
34396
|
+
this[key] !== undefined &&
|
|
34397
|
+
(!matcher || matchHeaderValue(this, this[key], key, matcher))
|
|
34398
|
+
);
|
|
34083
34399
|
}
|
|
34084
34400
|
|
|
34085
34401
|
return false;
|
|
@@ -34119,7 +34435,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
34119
34435
|
|
|
34120
34436
|
while (i--) {
|
|
34121
34437
|
const key = keys[i];
|
|
34122
|
-
if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
34438
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
34123
34439
|
delete this[key];
|
|
34124
34440
|
deleted = true;
|
|
34125
34441
|
}
|
|
@@ -34163,7 +34479,9 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
34163
34479
|
const obj = Object.create(null);
|
|
34164
34480
|
|
|
34165
34481
|
utils$1.forEach(this, (value, header) => {
|
|
34166
|
-
value != null &&
|
|
34482
|
+
value != null &&
|
|
34483
|
+
value !== false &&
|
|
34484
|
+
(obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
|
|
34167
34485
|
});
|
|
34168
34486
|
|
|
34169
34487
|
return obj;
|
|
@@ -34174,7 +34492,13 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
34174
34492
|
}
|
|
34175
34493
|
|
|
34176
34494
|
toString() {
|
|
34177
|
-
return Object.entries(this.toJSON())
|
|
34495
|
+
return Object.entries(this.toJSON())
|
|
34496
|
+
.map(([header, value]) => header + ': ' + value)
|
|
34497
|
+
.join('\n');
|
|
34498
|
+
}
|
|
34499
|
+
|
|
34500
|
+
getSetCookie() {
|
|
34501
|
+
return this.get('set-cookie') || [];
|
|
34178
34502
|
}
|
|
34179
34503
|
|
|
34180
34504
|
get [Symbol.toStringTag]() {
|
|
@@ -34194,9 +34518,12 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
34194
34518
|
}
|
|
34195
34519
|
|
|
34196
34520
|
static accessor(header) {
|
|
34197
|
-
const internals =
|
|
34198
|
-
|
|
34199
|
-
|
|
34521
|
+
const internals =
|
|
34522
|
+
(this[$internals] =
|
|
34523
|
+
this[$internals] =
|
|
34524
|
+
{
|
|
34525
|
+
accessors: {},
|
|
34526
|
+
});
|
|
34200
34527
|
|
|
34201
34528
|
const accessors = internals.accessors;
|
|
34202
34529
|
const prototype = this.prototype;
|
|
@@ -34216,17 +34543,24 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
34216
34543
|
}
|
|
34217
34544
|
};
|
|
34218
34545
|
|
|
34219
|
-
AxiosHeaders$1.accessor([
|
|
34546
|
+
AxiosHeaders$1.accessor([
|
|
34547
|
+
'Content-Type',
|
|
34548
|
+
'Content-Length',
|
|
34549
|
+
'Accept',
|
|
34550
|
+
'Accept-Encoding',
|
|
34551
|
+
'User-Agent',
|
|
34552
|
+
'Authorization',
|
|
34553
|
+
]);
|
|
34220
34554
|
|
|
34221
34555
|
// reserved names hotfix
|
|
34222
|
-
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
|
|
34556
|
+
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
|
|
34223
34557
|
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
34224
34558
|
return {
|
|
34225
34559
|
get: () => value,
|
|
34226
34560
|
set(headerValue) {
|
|
34227
34561
|
this[mapped] = headerValue;
|
|
34228
|
-
}
|
|
34229
|
-
}
|
|
34562
|
+
},
|
|
34563
|
+
};
|
|
34230
34564
|
});
|
|
34231
34565
|
|
|
34232
34566
|
utils$1.freezeMethods(AxiosHeaders$1);
|
|
@@ -34258,24 +34592,22 @@ function isCancel$1(value) {
|
|
|
34258
34592
|
return !!(value && value.__CANCEL__);
|
|
34259
34593
|
}
|
|
34260
34594
|
|
|
34261
|
-
|
|
34262
|
-
|
|
34263
|
-
|
|
34264
|
-
|
|
34265
|
-
|
|
34266
|
-
|
|
34267
|
-
|
|
34268
|
-
|
|
34269
|
-
|
|
34270
|
-
|
|
34271
|
-
|
|
34272
|
-
|
|
34273
|
-
|
|
34274
|
-
|
|
34275
|
-
|
|
34276
|
-
|
|
34277
|
-
__CANCEL__: true
|
|
34278
|
-
});
|
|
34595
|
+
let CanceledError$1 = class CanceledError extends AxiosError$1 {
|
|
34596
|
+
/**
|
|
34597
|
+
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
34598
|
+
*
|
|
34599
|
+
* @param {string=} message The message.
|
|
34600
|
+
* @param {Object=} config The config.
|
|
34601
|
+
* @param {Object=} request The request.
|
|
34602
|
+
*
|
|
34603
|
+
* @returns {CanceledError} The created error.
|
|
34604
|
+
*/
|
|
34605
|
+
constructor(message, config, request) {
|
|
34606
|
+
super(message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
|
|
34607
|
+
this.name = 'CanceledError';
|
|
34608
|
+
this.__CANCEL__ = true;
|
|
34609
|
+
}
|
|
34610
|
+
};
|
|
34279
34611
|
|
|
34280
34612
|
/**
|
|
34281
34613
|
* Resolve or reject a Promise based on response status.
|
|
@@ -34291,166 +34623,23 @@ function settle(resolve, reject, response) {
|
|
|
34291
34623
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
34292
34624
|
resolve(response);
|
|
34293
34625
|
} else {
|
|
34294
|
-
reject(
|
|
34295
|
-
|
|
34296
|
-
|
|
34297
|
-
|
|
34298
|
-
|
|
34299
|
-
|
|
34300
|
-
|
|
34301
|
-
|
|
34302
|
-
|
|
34303
|
-
|
|
34304
|
-
|
|
34305
|
-
|
|
34306
|
-
// Standard browser envs support document.cookie
|
|
34307
|
-
{
|
|
34308
|
-
write(name, value, expires, path, domain, secure) {
|
|
34309
|
-
const cookie = [name + '=' + encodeURIComponent(value)];
|
|
34310
|
-
|
|
34311
|
-
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
|
34312
|
-
|
|
34313
|
-
utils$1.isString(path) && cookie.push('path=' + path);
|
|
34314
|
-
|
|
34315
|
-
utils$1.isString(domain) && cookie.push('domain=' + domain);
|
|
34316
|
-
|
|
34317
|
-
secure === true && cookie.push('secure');
|
|
34318
|
-
|
|
34319
|
-
document.cookie = cookie.join('; ');
|
|
34320
|
-
},
|
|
34321
|
-
|
|
34322
|
-
read(name) {
|
|
34323
|
-
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
|
34324
|
-
return (match ? decodeURIComponent(match[3]) : null);
|
|
34325
|
-
},
|
|
34326
|
-
|
|
34327
|
-
remove(name) {
|
|
34328
|
-
this.write(name, '', Date.now() - 86400000);
|
|
34329
|
-
}
|
|
34330
|
-
}
|
|
34331
|
-
|
|
34332
|
-
:
|
|
34333
|
-
|
|
34334
|
-
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
34335
|
-
{
|
|
34336
|
-
write() {},
|
|
34337
|
-
read() {
|
|
34338
|
-
return null;
|
|
34339
|
-
},
|
|
34340
|
-
remove() {}
|
|
34341
|
-
};
|
|
34342
|
-
|
|
34343
|
-
/**
|
|
34344
|
-
* Determines whether the specified URL is absolute
|
|
34345
|
-
*
|
|
34346
|
-
* @param {string} url The URL to test
|
|
34347
|
-
*
|
|
34348
|
-
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
|
34349
|
-
*/
|
|
34350
|
-
function isAbsoluteURL(url) {
|
|
34351
|
-
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
34352
|
-
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
34353
|
-
// by any combination of letters, digits, plus, period, or hyphen.
|
|
34354
|
-
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
34355
|
-
}
|
|
34356
|
-
|
|
34357
|
-
/**
|
|
34358
|
-
* Creates a new URL by combining the specified URLs
|
|
34359
|
-
*
|
|
34360
|
-
* @param {string} baseURL The base URL
|
|
34361
|
-
* @param {string} relativeURL The relative URL
|
|
34362
|
-
*
|
|
34363
|
-
* @returns {string} The combined URL
|
|
34364
|
-
*/
|
|
34365
|
-
function combineURLs(baseURL, relativeURL) {
|
|
34366
|
-
return relativeURL
|
|
34367
|
-
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
|
34368
|
-
: baseURL;
|
|
34369
|
-
}
|
|
34370
|
-
|
|
34371
|
-
/**
|
|
34372
|
-
* Creates a new URL by combining the baseURL with the requestedURL,
|
|
34373
|
-
* only when the requestedURL is not already an absolute URL.
|
|
34374
|
-
* If the requestURL is absolute, this function returns the requestedURL untouched.
|
|
34375
|
-
*
|
|
34376
|
-
* @param {string} baseURL The base URL
|
|
34377
|
-
* @param {string} requestedURL Absolute or relative URL to combine
|
|
34378
|
-
*
|
|
34379
|
-
* @returns {string} The combined full path
|
|
34380
|
-
*/
|
|
34381
|
-
function buildFullPath(baseURL, requestedURL) {
|
|
34382
|
-
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
|
34383
|
-
return combineURLs(baseURL, requestedURL);
|
|
34626
|
+
reject(
|
|
34627
|
+
new AxiosError$1(
|
|
34628
|
+
'Request failed with status code ' + response.status,
|
|
34629
|
+
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][
|
|
34630
|
+
Math.floor(response.status / 100) - 4
|
|
34631
|
+
],
|
|
34632
|
+
response.config,
|
|
34633
|
+
response.request,
|
|
34634
|
+
response
|
|
34635
|
+
)
|
|
34636
|
+
);
|
|
34384
34637
|
}
|
|
34385
|
-
return requestedURL;
|
|
34386
34638
|
}
|
|
34387
34639
|
|
|
34388
|
-
var isURLSameOrigin = platform.hasStandardBrowserEnv ?
|
|
34389
|
-
|
|
34390
|
-
// Standard browser envs have full support of the APIs needed to test
|
|
34391
|
-
// whether the request URL is of the same origin as current location.
|
|
34392
|
-
(function standardBrowserEnv() {
|
|
34393
|
-
const msie = /(msie|trident)/i.test(navigator.userAgent);
|
|
34394
|
-
const urlParsingNode = document.createElement('a');
|
|
34395
|
-
let originURL;
|
|
34396
|
-
|
|
34397
|
-
/**
|
|
34398
|
-
* Parse a URL to discover its components
|
|
34399
|
-
*
|
|
34400
|
-
* @param {String} url The URL to be parsed
|
|
34401
|
-
* @returns {Object}
|
|
34402
|
-
*/
|
|
34403
|
-
function resolveURL(url) {
|
|
34404
|
-
let href = url;
|
|
34405
|
-
|
|
34406
|
-
if (msie) {
|
|
34407
|
-
// IE needs attribute set twice to normalize properties
|
|
34408
|
-
urlParsingNode.setAttribute('href', href);
|
|
34409
|
-
href = urlParsingNode.href;
|
|
34410
|
-
}
|
|
34411
|
-
|
|
34412
|
-
urlParsingNode.setAttribute('href', href);
|
|
34413
|
-
|
|
34414
|
-
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
|
34415
|
-
return {
|
|
34416
|
-
href: urlParsingNode.href,
|
|
34417
|
-
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
|
34418
|
-
host: urlParsingNode.host,
|
|
34419
|
-
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
|
34420
|
-
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
|
34421
|
-
hostname: urlParsingNode.hostname,
|
|
34422
|
-
port: urlParsingNode.port,
|
|
34423
|
-
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
|
34424
|
-
urlParsingNode.pathname :
|
|
34425
|
-
'/' + urlParsingNode.pathname
|
|
34426
|
-
};
|
|
34427
|
-
}
|
|
34428
|
-
|
|
34429
|
-
originURL = resolveURL(window.location.href);
|
|
34430
|
-
|
|
34431
|
-
/**
|
|
34432
|
-
* Determine if a URL shares the same origin as the current location
|
|
34433
|
-
*
|
|
34434
|
-
* @param {String} requestURL The URL to test
|
|
34435
|
-
* @returns {boolean} True if URL shares the same origin, otherwise false
|
|
34436
|
-
*/
|
|
34437
|
-
return function isURLSameOrigin(requestURL) {
|
|
34438
|
-
const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
|
34439
|
-
return (parsed.protocol === originURL.protocol &&
|
|
34440
|
-
parsed.host === originURL.host);
|
|
34441
|
-
};
|
|
34442
|
-
})() :
|
|
34443
|
-
|
|
34444
|
-
// Non standard browser envs (web workers, react-native) lack needed support.
|
|
34445
|
-
(function nonStandardBrowserEnv() {
|
|
34446
|
-
return function isURLSameOrigin() {
|
|
34447
|
-
return true;
|
|
34448
|
-
};
|
|
34449
|
-
})();
|
|
34450
|
-
|
|
34451
34640
|
function parseProtocol(url) {
|
|
34452
34641
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
34453
|
-
return match && match[1] || '';
|
|
34642
|
+
return (match && match[1]) || '';
|
|
34454
34643
|
}
|
|
34455
34644
|
|
|
34456
34645
|
/**
|
|
@@ -34501,15 +34690,58 @@ function speedometer(samplesCount, min) {
|
|
|
34501
34690
|
|
|
34502
34691
|
const passed = startedAt && now - startedAt;
|
|
34503
34692
|
|
|
34504
|
-
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
34693
|
+
return passed ? Math.round((bytesCount * 1000) / passed) : undefined;
|
|
34505
34694
|
};
|
|
34506
34695
|
}
|
|
34507
34696
|
|
|
34508
|
-
|
|
34697
|
+
/**
|
|
34698
|
+
* Throttle decorator
|
|
34699
|
+
* @param {Function} fn
|
|
34700
|
+
* @param {Number} freq
|
|
34701
|
+
* @return {Function}
|
|
34702
|
+
*/
|
|
34703
|
+
function throttle(fn, freq) {
|
|
34704
|
+
let timestamp = 0;
|
|
34705
|
+
let threshold = 1000 / freq;
|
|
34706
|
+
let lastArgs;
|
|
34707
|
+
let timer;
|
|
34708
|
+
|
|
34709
|
+
const invoke = (args, now = Date.now()) => {
|
|
34710
|
+
timestamp = now;
|
|
34711
|
+
lastArgs = null;
|
|
34712
|
+
if (timer) {
|
|
34713
|
+
clearTimeout(timer);
|
|
34714
|
+
timer = null;
|
|
34715
|
+
}
|
|
34716
|
+
fn(...args);
|
|
34717
|
+
};
|
|
34718
|
+
|
|
34719
|
+
const throttled = (...args) => {
|
|
34720
|
+
const now = Date.now();
|
|
34721
|
+
const passed = now - timestamp;
|
|
34722
|
+
if (passed >= threshold) {
|
|
34723
|
+
invoke(args, now);
|
|
34724
|
+
} else {
|
|
34725
|
+
lastArgs = args;
|
|
34726
|
+
if (!timer) {
|
|
34727
|
+
timer = setTimeout(() => {
|
|
34728
|
+
timer = null;
|
|
34729
|
+
invoke(lastArgs);
|
|
34730
|
+
}, threshold - passed);
|
|
34731
|
+
}
|
|
34732
|
+
}
|
|
34733
|
+
};
|
|
34734
|
+
|
|
34735
|
+
const flush = () => lastArgs && invoke(lastArgs);
|
|
34736
|
+
|
|
34737
|
+
return [throttled, flush];
|
|
34738
|
+
}
|
|
34739
|
+
|
|
34740
|
+
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
34509
34741
|
let bytesNotified = 0;
|
|
34510
34742
|
const _speedometer = speedometer(50, 250);
|
|
34511
34743
|
|
|
34512
|
-
return e => {
|
|
34744
|
+
return throttle((e) => {
|
|
34513
34745
|
const loaded = e.loaded;
|
|
34514
34746
|
const total = e.lengthComputable ? e.total : undefined;
|
|
34515
34747
|
const progressBytes = loaded - bytesNotified;
|
|
@@ -34521,306 +34753,1113 @@ function progressEventReducer(listener, isDownloadStream) {
|
|
|
34521
34753
|
const data = {
|
|
34522
34754
|
loaded,
|
|
34523
34755
|
total,
|
|
34524
|
-
progress: total ?
|
|
34756
|
+
progress: total ? loaded / total : undefined,
|
|
34525
34757
|
bytes: progressBytes,
|
|
34526
34758
|
rate: rate ? rate : undefined,
|
|
34527
34759
|
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
34528
|
-
event: e
|
|
34760
|
+
event: e,
|
|
34761
|
+
lengthComputable: total != null,
|
|
34762
|
+
[isDownloadStream ? 'download' : 'upload']: true,
|
|
34529
34763
|
};
|
|
34530
34764
|
|
|
34531
|
-
data[isDownloadStream ? 'download' : 'upload'] = true;
|
|
34532
|
-
|
|
34533
34765
|
listener(data);
|
|
34766
|
+
}, freq);
|
|
34767
|
+
};
|
|
34768
|
+
|
|
34769
|
+
const progressEventDecorator = (total, throttled) => {
|
|
34770
|
+
const lengthComputable = total != null;
|
|
34771
|
+
|
|
34772
|
+
return [
|
|
34773
|
+
(loaded) =>
|
|
34774
|
+
throttled[0]({
|
|
34775
|
+
lengthComputable,
|
|
34776
|
+
total,
|
|
34777
|
+
loaded,
|
|
34778
|
+
}),
|
|
34779
|
+
throttled[1],
|
|
34780
|
+
];
|
|
34781
|
+
};
|
|
34782
|
+
|
|
34783
|
+
const asyncDecorator =
|
|
34784
|
+
(fn) =>
|
|
34785
|
+
(...args) =>
|
|
34786
|
+
utils$1.asap(() => fn(...args));
|
|
34787
|
+
|
|
34788
|
+
var isURLSameOrigin = platform.hasStandardBrowserEnv
|
|
34789
|
+
? ((origin, isMSIE) => (url) => {
|
|
34790
|
+
url = new URL(url, platform.origin);
|
|
34791
|
+
|
|
34792
|
+
return (
|
|
34793
|
+
origin.protocol === url.protocol &&
|
|
34794
|
+
origin.host === url.host &&
|
|
34795
|
+
(isMSIE || origin.port === url.port)
|
|
34796
|
+
);
|
|
34797
|
+
})(
|
|
34798
|
+
new URL(platform.origin),
|
|
34799
|
+
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
34800
|
+
)
|
|
34801
|
+
: () => true;
|
|
34802
|
+
|
|
34803
|
+
var cookies = platform.hasStandardBrowserEnv
|
|
34804
|
+
? // Standard browser envs support document.cookie
|
|
34805
|
+
{
|
|
34806
|
+
write(name, value, expires, path, domain, secure, sameSite) {
|
|
34807
|
+
if (typeof document === 'undefined') return;
|
|
34808
|
+
|
|
34809
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
34810
|
+
|
|
34811
|
+
if (utils$1.isNumber(expires)) {
|
|
34812
|
+
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
34813
|
+
}
|
|
34814
|
+
if (utils$1.isString(path)) {
|
|
34815
|
+
cookie.push(`path=${path}`);
|
|
34816
|
+
}
|
|
34817
|
+
if (utils$1.isString(domain)) {
|
|
34818
|
+
cookie.push(`domain=${domain}`);
|
|
34819
|
+
}
|
|
34820
|
+
if (secure === true) {
|
|
34821
|
+
cookie.push('secure');
|
|
34822
|
+
}
|
|
34823
|
+
if (utils$1.isString(sameSite)) {
|
|
34824
|
+
cookie.push(`SameSite=${sameSite}`);
|
|
34825
|
+
}
|
|
34826
|
+
|
|
34827
|
+
document.cookie = cookie.join('; ');
|
|
34828
|
+
},
|
|
34829
|
+
|
|
34830
|
+
read(name) {
|
|
34831
|
+
if (typeof document === 'undefined') return null;
|
|
34832
|
+
const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
|
|
34833
|
+
return match ? decodeURIComponent(match[1]) : null;
|
|
34834
|
+
},
|
|
34835
|
+
|
|
34836
|
+
remove(name) {
|
|
34837
|
+
this.write(name, '', Date.now() - 86400000, '/');
|
|
34838
|
+
},
|
|
34839
|
+
}
|
|
34840
|
+
: // Non-standard browser env (web workers, react-native) lack needed support.
|
|
34841
|
+
{
|
|
34842
|
+
write() {},
|
|
34843
|
+
read() {
|
|
34844
|
+
return null;
|
|
34845
|
+
},
|
|
34846
|
+
remove() {},
|
|
34847
|
+
};
|
|
34848
|
+
|
|
34849
|
+
/**
|
|
34850
|
+
* Determines whether the specified URL is absolute
|
|
34851
|
+
*
|
|
34852
|
+
* @param {string} url The URL to test
|
|
34853
|
+
*
|
|
34854
|
+
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
|
34855
|
+
*/
|
|
34856
|
+
function isAbsoluteURL(url) {
|
|
34857
|
+
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
34858
|
+
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
34859
|
+
// by any combination of letters, digits, plus, period, or hyphen.
|
|
34860
|
+
if (typeof url !== 'string') {
|
|
34861
|
+
return false;
|
|
34862
|
+
}
|
|
34863
|
+
|
|
34864
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
34865
|
+
}
|
|
34866
|
+
|
|
34867
|
+
/**
|
|
34868
|
+
* Creates a new URL by combining the specified URLs
|
|
34869
|
+
*
|
|
34870
|
+
* @param {string} baseURL The base URL
|
|
34871
|
+
* @param {string} relativeURL The relative URL
|
|
34872
|
+
*
|
|
34873
|
+
* @returns {string} The combined URL
|
|
34874
|
+
*/
|
|
34875
|
+
function combineURLs(baseURL, relativeURL) {
|
|
34876
|
+
return relativeURL
|
|
34877
|
+
? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
|
34878
|
+
: baseURL;
|
|
34879
|
+
}
|
|
34880
|
+
|
|
34881
|
+
/**
|
|
34882
|
+
* Creates a new URL by combining the baseURL with the requestedURL,
|
|
34883
|
+
* only when the requestedURL is not already an absolute URL.
|
|
34884
|
+
* If the requestURL is absolute, this function returns the requestedURL untouched.
|
|
34885
|
+
*
|
|
34886
|
+
* @param {string} baseURL The base URL
|
|
34887
|
+
* @param {string} requestedURL Absolute or relative URL to combine
|
|
34888
|
+
*
|
|
34889
|
+
* @returns {string} The combined full path
|
|
34890
|
+
*/
|
|
34891
|
+
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
34892
|
+
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
34893
|
+
if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
|
|
34894
|
+
return combineURLs(baseURL, requestedURL);
|
|
34895
|
+
}
|
|
34896
|
+
return requestedURL;
|
|
34897
|
+
}
|
|
34898
|
+
|
|
34899
|
+
const headersToObject = (thing) => (thing instanceof AxiosHeaders$1 ? { ...thing } : thing);
|
|
34900
|
+
|
|
34901
|
+
/**
|
|
34902
|
+
* Config-specific merge-function which creates a new config-object
|
|
34903
|
+
* by merging two configuration objects together.
|
|
34904
|
+
*
|
|
34905
|
+
* @param {Object} config1
|
|
34906
|
+
* @param {Object} config2
|
|
34907
|
+
*
|
|
34908
|
+
* @returns {Object} New object resulting from merging config2 to config1
|
|
34909
|
+
*/
|
|
34910
|
+
function mergeConfig$1(config1, config2) {
|
|
34911
|
+
// eslint-disable-next-line no-param-reassign
|
|
34912
|
+
config2 = config2 || {};
|
|
34913
|
+
const config = {};
|
|
34914
|
+
|
|
34915
|
+
function getMergedValue(target, source, prop, caseless) {
|
|
34916
|
+
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
34917
|
+
return utils$1.merge.call({ caseless }, target, source);
|
|
34918
|
+
} else if (utils$1.isPlainObject(source)) {
|
|
34919
|
+
return utils$1.merge({}, source);
|
|
34920
|
+
} else if (utils$1.isArray(source)) {
|
|
34921
|
+
return source.slice();
|
|
34922
|
+
}
|
|
34923
|
+
return source;
|
|
34924
|
+
}
|
|
34925
|
+
|
|
34926
|
+
function mergeDeepProperties(a, b, prop, caseless) {
|
|
34927
|
+
if (!utils$1.isUndefined(b)) {
|
|
34928
|
+
return getMergedValue(a, b, prop, caseless);
|
|
34929
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
34930
|
+
return getMergedValue(undefined, a, prop, caseless);
|
|
34931
|
+
}
|
|
34932
|
+
}
|
|
34933
|
+
|
|
34934
|
+
// eslint-disable-next-line consistent-return
|
|
34935
|
+
function valueFromConfig2(a, b) {
|
|
34936
|
+
if (!utils$1.isUndefined(b)) {
|
|
34937
|
+
return getMergedValue(undefined, b);
|
|
34938
|
+
}
|
|
34939
|
+
}
|
|
34940
|
+
|
|
34941
|
+
// eslint-disable-next-line consistent-return
|
|
34942
|
+
function defaultToConfig2(a, b) {
|
|
34943
|
+
if (!utils$1.isUndefined(b)) {
|
|
34944
|
+
return getMergedValue(undefined, b);
|
|
34945
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
34946
|
+
return getMergedValue(undefined, a);
|
|
34947
|
+
}
|
|
34948
|
+
}
|
|
34949
|
+
|
|
34950
|
+
// eslint-disable-next-line consistent-return
|
|
34951
|
+
function mergeDirectKeys(a, b, prop) {
|
|
34952
|
+
if (prop in config2) {
|
|
34953
|
+
return getMergedValue(a, b);
|
|
34954
|
+
} else if (prop in config1) {
|
|
34955
|
+
return getMergedValue(undefined, a);
|
|
34956
|
+
}
|
|
34957
|
+
}
|
|
34958
|
+
|
|
34959
|
+
const mergeMap = {
|
|
34960
|
+
url: valueFromConfig2,
|
|
34961
|
+
method: valueFromConfig2,
|
|
34962
|
+
data: valueFromConfig2,
|
|
34963
|
+
baseURL: defaultToConfig2,
|
|
34964
|
+
transformRequest: defaultToConfig2,
|
|
34965
|
+
transformResponse: defaultToConfig2,
|
|
34966
|
+
paramsSerializer: defaultToConfig2,
|
|
34967
|
+
timeout: defaultToConfig2,
|
|
34968
|
+
timeoutMessage: defaultToConfig2,
|
|
34969
|
+
withCredentials: defaultToConfig2,
|
|
34970
|
+
withXSRFToken: defaultToConfig2,
|
|
34971
|
+
adapter: defaultToConfig2,
|
|
34972
|
+
responseType: defaultToConfig2,
|
|
34973
|
+
xsrfCookieName: defaultToConfig2,
|
|
34974
|
+
xsrfHeaderName: defaultToConfig2,
|
|
34975
|
+
onUploadProgress: defaultToConfig2,
|
|
34976
|
+
onDownloadProgress: defaultToConfig2,
|
|
34977
|
+
decompress: defaultToConfig2,
|
|
34978
|
+
maxContentLength: defaultToConfig2,
|
|
34979
|
+
maxBodyLength: defaultToConfig2,
|
|
34980
|
+
beforeRedirect: defaultToConfig2,
|
|
34981
|
+
transport: defaultToConfig2,
|
|
34982
|
+
httpAgent: defaultToConfig2,
|
|
34983
|
+
httpsAgent: defaultToConfig2,
|
|
34984
|
+
cancelToken: defaultToConfig2,
|
|
34985
|
+
socketPath: defaultToConfig2,
|
|
34986
|
+
responseEncoding: defaultToConfig2,
|
|
34987
|
+
validateStatus: mergeDirectKeys,
|
|
34988
|
+
headers: (a, b, prop) =>
|
|
34989
|
+
mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
|
|
34534
34990
|
};
|
|
34991
|
+
|
|
34992
|
+
utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
34993
|
+
if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
|
|
34994
|
+
const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
34995
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
34996
|
+
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
34997
|
+
});
|
|
34998
|
+
|
|
34999
|
+
return config;
|
|
34535
35000
|
}
|
|
34536
35001
|
|
|
34537
|
-
|
|
35002
|
+
var resolveConfig = (config) => {
|
|
35003
|
+
const newConfig = mergeConfig$1({}, config);
|
|
34538
35004
|
|
|
34539
|
-
|
|
34540
|
-
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
34541
|
-
let requestData = config.data;
|
|
34542
|
-
const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
|
|
34543
|
-
let {responseType, withXSRFToken} = config;
|
|
34544
|
-
let onCanceled;
|
|
34545
|
-
function done() {
|
|
34546
|
-
if (config.cancelToken) {
|
|
34547
|
-
config.cancelToken.unsubscribe(onCanceled);
|
|
34548
|
-
}
|
|
35005
|
+
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
34549
35006
|
|
|
34550
|
-
|
|
34551
|
-
|
|
34552
|
-
|
|
35007
|
+
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
35008
|
+
|
|
35009
|
+
newConfig.url = buildURL(
|
|
35010
|
+
buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
|
|
35011
|
+
config.params,
|
|
35012
|
+
config.paramsSerializer
|
|
35013
|
+
);
|
|
35014
|
+
|
|
35015
|
+
// HTTP basic authentication
|
|
35016
|
+
if (auth) {
|
|
35017
|
+
headers.set(
|
|
35018
|
+
'Authorization',
|
|
35019
|
+
'Basic ' +
|
|
35020
|
+
btoa(
|
|
35021
|
+
(auth.username || '') +
|
|
35022
|
+
':' +
|
|
35023
|
+
(auth.password ? unescape(encodeURIComponent(auth.password)) : '')
|
|
35024
|
+
)
|
|
35025
|
+
);
|
|
35026
|
+
}
|
|
35027
|
+
|
|
35028
|
+
if (utils$1.isFormData(data)) {
|
|
35029
|
+
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
35030
|
+
headers.setContentType(undefined); // browser handles it
|
|
35031
|
+
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
35032
|
+
// Node.js FormData (like form-data package)
|
|
35033
|
+
const formHeaders = data.getHeaders();
|
|
35034
|
+
// Only set safe headers to avoid overwriting security headers
|
|
35035
|
+
const allowedHeaders = ['content-type', 'content-length'];
|
|
35036
|
+
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
35037
|
+
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
35038
|
+
headers.set(key, val);
|
|
35039
|
+
}
|
|
35040
|
+
});
|
|
34553
35041
|
}
|
|
35042
|
+
}
|
|
35043
|
+
|
|
35044
|
+
// Add xsrf header
|
|
35045
|
+
// This is only done if running in a standard browser environment.
|
|
35046
|
+
// Specifically not if we're in a web worker, or react-native.
|
|
34554
35047
|
|
|
34555
|
-
|
|
35048
|
+
if (platform.hasStandardBrowserEnv) {
|
|
35049
|
+
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
|
|
34556
35050
|
|
|
34557
|
-
if (
|
|
34558
|
-
|
|
34559
|
-
|
|
34560
|
-
|
|
34561
|
-
|
|
34562
|
-
|
|
34563
|
-
requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
|
|
35051
|
+
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
|
|
35052
|
+
// Add xsrf header
|
|
35053
|
+
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
35054
|
+
|
|
35055
|
+
if (xsrfValue) {
|
|
35056
|
+
headers.set(xsrfHeaderName, xsrfValue);
|
|
34564
35057
|
}
|
|
34565
35058
|
}
|
|
35059
|
+
}
|
|
34566
35060
|
|
|
34567
|
-
|
|
35061
|
+
return newConfig;
|
|
35062
|
+
};
|
|
34568
35063
|
|
|
34569
|
-
|
|
34570
|
-
if (config.auth) {
|
|
34571
|
-
const username = config.auth.username || '';
|
|
34572
|
-
const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
|
34573
|
-
requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
|
|
34574
|
-
}
|
|
35064
|
+
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
34575
35065
|
|
|
34576
|
-
|
|
35066
|
+
var xhrAdapter = isXHRAdapterSupported &&
|
|
35067
|
+
function (config) {
|
|
35068
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
35069
|
+
const _config = resolveConfig(config);
|
|
35070
|
+
let requestData = _config.data;
|
|
35071
|
+
const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
|
|
35072
|
+
let { responseType, onUploadProgress, onDownloadProgress } = _config;
|
|
35073
|
+
let onCanceled;
|
|
35074
|
+
let uploadThrottled, downloadThrottled;
|
|
35075
|
+
let flushUpload, flushDownload;
|
|
34577
35076
|
|
|
34578
|
-
|
|
35077
|
+
function done() {
|
|
35078
|
+
flushUpload && flushUpload(); // flush events
|
|
35079
|
+
flushDownload && flushDownload(); // flush events
|
|
34579
35080
|
|
|
34580
|
-
|
|
34581
|
-
request.timeout = config.timeout;
|
|
35081
|
+
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
34582
35082
|
|
|
34583
|
-
|
|
34584
|
-
if (!request) {
|
|
34585
|
-
return;
|
|
35083
|
+
_config.signal && _config.signal.removeEventListener('abort', onCanceled);
|
|
34586
35084
|
}
|
|
34587
|
-
// Prepare the response
|
|
34588
|
-
const responseHeaders = AxiosHeaders$1.from(
|
|
34589
|
-
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
34590
|
-
);
|
|
34591
|
-
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
|
34592
|
-
request.responseText : request.response;
|
|
34593
|
-
const response = {
|
|
34594
|
-
data: responseData,
|
|
34595
|
-
status: request.status,
|
|
34596
|
-
statusText: request.statusText,
|
|
34597
|
-
headers: responseHeaders,
|
|
34598
|
-
config,
|
|
34599
|
-
request
|
|
34600
|
-
};
|
|
34601
35085
|
|
|
34602
|
-
|
|
34603
|
-
resolve(value);
|
|
34604
|
-
done();
|
|
34605
|
-
}, function _reject(err) {
|
|
34606
|
-
reject(err);
|
|
34607
|
-
done();
|
|
34608
|
-
}, response);
|
|
35086
|
+
let request = new XMLHttpRequest();
|
|
34609
35087
|
|
|
34610
|
-
|
|
34611
|
-
request = null;
|
|
34612
|
-
}
|
|
35088
|
+
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
34613
35089
|
|
|
34614
|
-
|
|
34615
|
-
|
|
34616
|
-
|
|
34617
|
-
|
|
34618
|
-
|
|
34619
|
-
request.onreadystatechange = function handleLoad() {
|
|
34620
|
-
if (!request || request.readyState !== 4) {
|
|
35090
|
+
// Set the request timeout in MS
|
|
35091
|
+
request.timeout = _config.timeout;
|
|
35092
|
+
|
|
35093
|
+
function onloadend() {
|
|
35094
|
+
if (!request) {
|
|
34621
35095
|
return;
|
|
34622
35096
|
}
|
|
35097
|
+
// Prepare the response
|
|
35098
|
+
const responseHeaders = AxiosHeaders$1.from(
|
|
35099
|
+
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
35100
|
+
);
|
|
35101
|
+
const responseData =
|
|
35102
|
+
!responseType || responseType === 'text' || responseType === 'json'
|
|
35103
|
+
? request.responseText
|
|
35104
|
+
: request.response;
|
|
35105
|
+
const response = {
|
|
35106
|
+
data: responseData,
|
|
35107
|
+
status: request.status,
|
|
35108
|
+
statusText: request.statusText,
|
|
35109
|
+
headers: responseHeaders,
|
|
35110
|
+
config,
|
|
35111
|
+
request,
|
|
35112
|
+
};
|
|
35113
|
+
|
|
35114
|
+
settle(
|
|
35115
|
+
function _resolve(value) {
|
|
35116
|
+
resolve(value);
|
|
35117
|
+
done();
|
|
35118
|
+
},
|
|
35119
|
+
function _reject(err) {
|
|
35120
|
+
reject(err);
|
|
35121
|
+
done();
|
|
35122
|
+
},
|
|
35123
|
+
response
|
|
35124
|
+
);
|
|
35125
|
+
|
|
35126
|
+
// Clean up request
|
|
35127
|
+
request = null;
|
|
35128
|
+
}
|
|
34623
35129
|
|
|
34624
|
-
|
|
34625
|
-
//
|
|
34626
|
-
|
|
34627
|
-
|
|
34628
|
-
|
|
35130
|
+
if ('onloadend' in request) {
|
|
35131
|
+
// Use onloadend if available
|
|
35132
|
+
request.onloadend = onloadend;
|
|
35133
|
+
} else {
|
|
35134
|
+
// Listen for ready state to emulate onloadend
|
|
35135
|
+
request.onreadystatechange = function handleLoad() {
|
|
35136
|
+
if (!request || request.readyState !== 4) {
|
|
35137
|
+
return;
|
|
35138
|
+
}
|
|
35139
|
+
|
|
35140
|
+
// The request errored out and we didn't get a response, this will be
|
|
35141
|
+
// handled by onerror instead
|
|
35142
|
+
// With one exception: request that using file: protocol, most browsers
|
|
35143
|
+
// will return status as 0 even though it's a successful request
|
|
35144
|
+
if (
|
|
35145
|
+
request.status === 0 &&
|
|
35146
|
+
!(request.responseURL && request.responseURL.indexOf('file:') === 0)
|
|
35147
|
+
) {
|
|
35148
|
+
return;
|
|
35149
|
+
}
|
|
35150
|
+
// readystate handler is calling before onerror or ontimeout handlers,
|
|
35151
|
+
// so we should call onloadend on the next 'tick'
|
|
35152
|
+
setTimeout(onloadend);
|
|
35153
|
+
};
|
|
35154
|
+
}
|
|
35155
|
+
|
|
35156
|
+
// Handle browser request cancellation (as opposed to a manual cancellation)
|
|
35157
|
+
request.onabort = function handleAbort() {
|
|
35158
|
+
if (!request) {
|
|
34629
35159
|
return;
|
|
34630
35160
|
}
|
|
34631
|
-
|
|
34632
|
-
|
|
34633
|
-
|
|
35161
|
+
|
|
35162
|
+
reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
|
|
35163
|
+
|
|
35164
|
+
// Clean up request
|
|
35165
|
+
request = null;
|
|
35166
|
+
};
|
|
35167
|
+
|
|
35168
|
+
// Handle low level network errors
|
|
35169
|
+
request.onerror = function handleError(event) {
|
|
35170
|
+
// Browsers deliver a ProgressEvent in XHR onerror
|
|
35171
|
+
// (message may be empty; when present, surface it)
|
|
35172
|
+
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
35173
|
+
const msg = event && event.message ? event.message : 'Network Error';
|
|
35174
|
+
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
35175
|
+
// attach the underlying event for consumers who want details
|
|
35176
|
+
err.event = event || null;
|
|
35177
|
+
reject(err);
|
|
35178
|
+
request = null;
|
|
34634
35179
|
};
|
|
34635
|
-
}
|
|
34636
35180
|
|
|
34637
|
-
|
|
34638
|
-
|
|
34639
|
-
|
|
35181
|
+
// Handle timeout
|
|
35182
|
+
request.ontimeout = function handleTimeout() {
|
|
35183
|
+
let timeoutErrorMessage = _config.timeout
|
|
35184
|
+
? 'timeout of ' + _config.timeout + 'ms exceeded'
|
|
35185
|
+
: 'timeout exceeded';
|
|
35186
|
+
const transitional = _config.transitional || transitionalDefaults;
|
|
35187
|
+
if (_config.timeoutErrorMessage) {
|
|
35188
|
+
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
35189
|
+
}
|
|
35190
|
+
reject(
|
|
35191
|
+
new AxiosError$1(
|
|
35192
|
+
timeoutErrorMessage,
|
|
35193
|
+
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
35194
|
+
config,
|
|
35195
|
+
request
|
|
35196
|
+
)
|
|
35197
|
+
);
|
|
35198
|
+
|
|
35199
|
+
// Clean up request
|
|
35200
|
+
request = null;
|
|
35201
|
+
};
|
|
35202
|
+
|
|
35203
|
+
// Remove Content-Type if data is undefined
|
|
35204
|
+
requestData === undefined && requestHeaders.setContentType(null);
|
|
35205
|
+
|
|
35206
|
+
// Add headers to the request
|
|
35207
|
+
if ('setRequestHeader' in request) {
|
|
35208
|
+
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
35209
|
+
request.setRequestHeader(key, val);
|
|
35210
|
+
});
|
|
35211
|
+
}
|
|
35212
|
+
|
|
35213
|
+
// Add withCredentials to request if needed
|
|
35214
|
+
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
35215
|
+
request.withCredentials = !!_config.withCredentials;
|
|
35216
|
+
}
|
|
35217
|
+
|
|
35218
|
+
// Add responseType to request if needed
|
|
35219
|
+
if (responseType && responseType !== 'json') {
|
|
35220
|
+
request.responseType = _config.responseType;
|
|
35221
|
+
}
|
|
35222
|
+
|
|
35223
|
+
// Handle progress if needed
|
|
35224
|
+
if (onDownloadProgress) {
|
|
35225
|
+
[downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
|
|
35226
|
+
request.addEventListener('progress', downloadThrottled);
|
|
35227
|
+
}
|
|
35228
|
+
|
|
35229
|
+
// Not all browsers support upload events
|
|
35230
|
+
if (onUploadProgress && request.upload) {
|
|
35231
|
+
[uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
|
|
35232
|
+
|
|
35233
|
+
request.upload.addEventListener('progress', uploadThrottled);
|
|
35234
|
+
|
|
35235
|
+
request.upload.addEventListener('loadend', flushUpload);
|
|
35236
|
+
}
|
|
35237
|
+
|
|
35238
|
+
if (_config.cancelToken || _config.signal) {
|
|
35239
|
+
// Handle cancellation
|
|
35240
|
+
// eslint-disable-next-line func-names
|
|
35241
|
+
onCanceled = (cancel) => {
|
|
35242
|
+
if (!request) {
|
|
35243
|
+
return;
|
|
35244
|
+
}
|
|
35245
|
+
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
35246
|
+
request.abort();
|
|
35247
|
+
request = null;
|
|
35248
|
+
};
|
|
35249
|
+
|
|
35250
|
+
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
35251
|
+
if (_config.signal) {
|
|
35252
|
+
_config.signal.aborted
|
|
35253
|
+
? onCanceled()
|
|
35254
|
+
: _config.signal.addEventListener('abort', onCanceled);
|
|
35255
|
+
}
|
|
35256
|
+
}
|
|
35257
|
+
|
|
35258
|
+
const protocol = parseProtocol(_config.url);
|
|
35259
|
+
|
|
35260
|
+
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
35261
|
+
reject(
|
|
35262
|
+
new AxiosError$1(
|
|
35263
|
+
'Unsupported protocol ' + protocol + ':',
|
|
35264
|
+
AxiosError$1.ERR_BAD_REQUEST,
|
|
35265
|
+
config
|
|
35266
|
+
)
|
|
35267
|
+
);
|
|
34640
35268
|
return;
|
|
34641
35269
|
}
|
|
34642
35270
|
|
|
34643
|
-
|
|
35271
|
+
// Send the request
|
|
35272
|
+
request.send(requestData || null);
|
|
35273
|
+
});
|
|
35274
|
+
};
|
|
34644
35275
|
|
|
34645
|
-
|
|
34646
|
-
|
|
34647
|
-
|
|
35276
|
+
const composeSignals = (signals, timeout) => {
|
|
35277
|
+
const { length } = (signals = signals ? signals.filter(Boolean) : []);
|
|
35278
|
+
|
|
35279
|
+
if (timeout || length) {
|
|
35280
|
+
let controller = new AbortController();
|
|
34648
35281
|
|
|
34649
|
-
|
|
34650
|
-
request.onerror = function handleError() {
|
|
34651
|
-
// Real errors are hidden from us by the browser
|
|
34652
|
-
// onerror should only fire if it's a network error
|
|
34653
|
-
reject(new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request));
|
|
35282
|
+
let aborted;
|
|
34654
35283
|
|
|
34655
|
-
|
|
34656
|
-
|
|
35284
|
+
const onabort = function (reason) {
|
|
35285
|
+
if (!aborted) {
|
|
35286
|
+
aborted = true;
|
|
35287
|
+
unsubscribe();
|
|
35288
|
+
const err = reason instanceof Error ? reason : this.reason;
|
|
35289
|
+
controller.abort(
|
|
35290
|
+
err instanceof AxiosError$1
|
|
35291
|
+
? err
|
|
35292
|
+
: new CanceledError$1(err instanceof Error ? err.message : err)
|
|
35293
|
+
);
|
|
35294
|
+
}
|
|
34657
35295
|
};
|
|
34658
35296
|
|
|
34659
|
-
|
|
34660
|
-
|
|
34661
|
-
|
|
34662
|
-
|
|
34663
|
-
|
|
34664
|
-
|
|
35297
|
+
let timer =
|
|
35298
|
+
timeout &&
|
|
35299
|
+
setTimeout(() => {
|
|
35300
|
+
timer = null;
|
|
35301
|
+
onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
|
|
35302
|
+
}, timeout);
|
|
35303
|
+
|
|
35304
|
+
const unsubscribe = () => {
|
|
35305
|
+
if (signals) {
|
|
35306
|
+
timer && clearTimeout(timer);
|
|
35307
|
+
timer = null;
|
|
35308
|
+
signals.forEach((signal) => {
|
|
35309
|
+
signal.unsubscribe
|
|
35310
|
+
? signal.unsubscribe(onabort)
|
|
35311
|
+
: signal.removeEventListener('abort', onabort);
|
|
35312
|
+
});
|
|
35313
|
+
signals = null;
|
|
34665
35314
|
}
|
|
34666
|
-
reject(new AxiosError$1(
|
|
34667
|
-
timeoutErrorMessage,
|
|
34668
|
-
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
34669
|
-
config,
|
|
34670
|
-
request));
|
|
34671
|
-
|
|
34672
|
-
// Clean up request
|
|
34673
|
-
request = null;
|
|
34674
35315
|
};
|
|
34675
35316
|
|
|
34676
|
-
|
|
34677
|
-
// This is only done if running in a standard browser environment.
|
|
34678
|
-
// Specifically not if we're in a web worker, or react-native.
|
|
34679
|
-
if(platform.hasStandardBrowserEnv) {
|
|
34680
|
-
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
|
|
35317
|
+
signals.forEach((signal) => signal.addEventListener('abort', onabort));
|
|
34681
35318
|
|
|
34682
|
-
|
|
34683
|
-
// Add xsrf header
|
|
34684
|
-
const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
|
35319
|
+
const { signal } = controller;
|
|
34685
35320
|
|
|
34686
|
-
|
|
34687
|
-
|
|
34688
|
-
|
|
35321
|
+
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
35322
|
+
|
|
35323
|
+
return signal;
|
|
35324
|
+
}
|
|
35325
|
+
};
|
|
35326
|
+
|
|
35327
|
+
const streamChunk = function* (chunk, chunkSize) {
|
|
35328
|
+
let len = chunk.byteLength;
|
|
35329
|
+
|
|
35330
|
+
if (len < chunkSize) {
|
|
35331
|
+
yield chunk;
|
|
35332
|
+
return;
|
|
35333
|
+
}
|
|
35334
|
+
|
|
35335
|
+
let pos = 0;
|
|
35336
|
+
let end;
|
|
35337
|
+
|
|
35338
|
+
while (pos < len) {
|
|
35339
|
+
end = pos + chunkSize;
|
|
35340
|
+
yield chunk.slice(pos, end);
|
|
35341
|
+
pos = end;
|
|
35342
|
+
}
|
|
35343
|
+
};
|
|
35344
|
+
|
|
35345
|
+
const readBytes = async function* (iterable, chunkSize) {
|
|
35346
|
+
for await (const chunk of readStream(iterable)) {
|
|
35347
|
+
yield* streamChunk(chunk, chunkSize);
|
|
35348
|
+
}
|
|
35349
|
+
};
|
|
35350
|
+
|
|
35351
|
+
const readStream = async function* (stream) {
|
|
35352
|
+
if (stream[Symbol.asyncIterator]) {
|
|
35353
|
+
yield* stream;
|
|
35354
|
+
return;
|
|
35355
|
+
}
|
|
35356
|
+
|
|
35357
|
+
const reader = stream.getReader();
|
|
35358
|
+
try {
|
|
35359
|
+
for (;;) {
|
|
35360
|
+
const { done, value } = await reader.read();
|
|
35361
|
+
if (done) {
|
|
35362
|
+
break;
|
|
34689
35363
|
}
|
|
35364
|
+
yield value;
|
|
34690
35365
|
}
|
|
35366
|
+
} finally {
|
|
35367
|
+
await reader.cancel();
|
|
35368
|
+
}
|
|
35369
|
+
};
|
|
35370
|
+
|
|
35371
|
+
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
35372
|
+
const iterator = readBytes(stream, chunkSize);
|
|
35373
|
+
|
|
35374
|
+
let bytes = 0;
|
|
35375
|
+
let done;
|
|
35376
|
+
let _onFinish = (e) => {
|
|
35377
|
+
if (!done) {
|
|
35378
|
+
done = true;
|
|
35379
|
+
onFinish && onFinish(e);
|
|
35380
|
+
}
|
|
35381
|
+
};
|
|
35382
|
+
|
|
35383
|
+
return new ReadableStream(
|
|
35384
|
+
{
|
|
35385
|
+
async pull(controller) {
|
|
35386
|
+
try {
|
|
35387
|
+
const { done, value } = await iterator.next();
|
|
35388
|
+
|
|
35389
|
+
if (done) {
|
|
35390
|
+
_onFinish();
|
|
35391
|
+
controller.close();
|
|
35392
|
+
return;
|
|
35393
|
+
}
|
|
35394
|
+
|
|
35395
|
+
let len = value.byteLength;
|
|
35396
|
+
if (onProgress) {
|
|
35397
|
+
let loadedBytes = (bytes += len);
|
|
35398
|
+
onProgress(loadedBytes);
|
|
35399
|
+
}
|
|
35400
|
+
controller.enqueue(new Uint8Array(value));
|
|
35401
|
+
} catch (err) {
|
|
35402
|
+
_onFinish(err);
|
|
35403
|
+
throw err;
|
|
35404
|
+
}
|
|
35405
|
+
},
|
|
35406
|
+
cancel(reason) {
|
|
35407
|
+
_onFinish(reason);
|
|
35408
|
+
return iterator.return();
|
|
35409
|
+
},
|
|
35410
|
+
},
|
|
35411
|
+
{
|
|
35412
|
+
highWaterMark: 2,
|
|
35413
|
+
}
|
|
35414
|
+
);
|
|
35415
|
+
};
|
|
35416
|
+
|
|
35417
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
35418
|
+
|
|
35419
|
+
const { isFunction: isFunction$1 } = utils$1;
|
|
35420
|
+
|
|
35421
|
+
const globalFetchAPI = (({ Request, Response }) => ({
|
|
35422
|
+
Request,
|
|
35423
|
+
Response,
|
|
35424
|
+
}))(utils$1.global);
|
|
35425
|
+
|
|
35426
|
+
const { ReadableStream: ReadableStream$1, TextEncoder: TextEncoder$1 } = utils$1.global;
|
|
35427
|
+
|
|
35428
|
+
const test = (fn, ...args) => {
|
|
35429
|
+
try {
|
|
35430
|
+
return !!fn(...args);
|
|
35431
|
+
} catch (e) {
|
|
35432
|
+
return false;
|
|
35433
|
+
}
|
|
35434
|
+
};
|
|
35435
|
+
|
|
35436
|
+
const factory = (env) => {
|
|
35437
|
+
env = utils$1.merge.call(
|
|
35438
|
+
{
|
|
35439
|
+
skipUndefined: true,
|
|
35440
|
+
},
|
|
35441
|
+
globalFetchAPI,
|
|
35442
|
+
env
|
|
35443
|
+
);
|
|
35444
|
+
|
|
35445
|
+
const { fetch: envFetch, Request, Response } = env;
|
|
35446
|
+
const isFetchSupported = envFetch ? isFunction$1(envFetch) : typeof fetch === 'function';
|
|
35447
|
+
const isRequestSupported = isFunction$1(Request);
|
|
35448
|
+
const isResponseSupported = isFunction$1(Response);
|
|
35449
|
+
|
|
35450
|
+
if (!isFetchSupported) {
|
|
35451
|
+
return false;
|
|
35452
|
+
}
|
|
35453
|
+
|
|
35454
|
+
const isReadableStreamSupported = isFetchSupported && isFunction$1(ReadableStream$1);
|
|
35455
|
+
|
|
35456
|
+
const encodeText =
|
|
35457
|
+
isFetchSupported &&
|
|
35458
|
+
(typeof TextEncoder$1 === 'function'
|
|
35459
|
+
? (
|
|
35460
|
+
(encoder) => (str) =>
|
|
35461
|
+
encoder.encode(str)
|
|
35462
|
+
)(new TextEncoder$1())
|
|
35463
|
+
: async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
|
|
35464
|
+
|
|
35465
|
+
const supportsRequestStream =
|
|
35466
|
+
isRequestSupported &&
|
|
35467
|
+
isReadableStreamSupported &&
|
|
35468
|
+
test(() => {
|
|
35469
|
+
let duplexAccessed = false;
|
|
35470
|
+
|
|
35471
|
+
const body = new ReadableStream$1();
|
|
35472
|
+
|
|
35473
|
+
const hasContentType = new Request(platform.origin, {
|
|
35474
|
+
body,
|
|
35475
|
+
method: 'POST',
|
|
35476
|
+
get duplex() {
|
|
35477
|
+
duplexAccessed = true;
|
|
35478
|
+
return 'half';
|
|
35479
|
+
},
|
|
35480
|
+
}).headers.has('Content-Type');
|
|
35481
|
+
|
|
35482
|
+
body.cancel();
|
|
35483
|
+
|
|
35484
|
+
return duplexAccessed && !hasContentType;
|
|
35485
|
+
});
|
|
35486
|
+
|
|
35487
|
+
const supportsResponseStream =
|
|
35488
|
+
isResponseSupported &&
|
|
35489
|
+
isReadableStreamSupported &&
|
|
35490
|
+
test(() => utils$1.isReadableStream(new Response('').body));
|
|
34691
35491
|
|
|
34692
|
-
|
|
34693
|
-
|
|
35492
|
+
const resolvers = {
|
|
35493
|
+
stream: supportsResponseStream && ((res) => res.body),
|
|
35494
|
+
};
|
|
35495
|
+
|
|
35496
|
+
isFetchSupported &&
|
|
35497
|
+
(() => {
|
|
35498
|
+
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach((type) => {
|
|
35499
|
+
!resolvers[type] &&
|
|
35500
|
+
(resolvers[type] = (res, config) => {
|
|
35501
|
+
let method = res && res[type];
|
|
35502
|
+
|
|
35503
|
+
if (method) {
|
|
35504
|
+
return method.call(res);
|
|
35505
|
+
}
|
|
34694
35506
|
|
|
34695
|
-
|
|
34696
|
-
|
|
34697
|
-
|
|
34698
|
-
|
|
35507
|
+
throw new AxiosError$1(
|
|
35508
|
+
`Response type '${type}' is not supported`,
|
|
35509
|
+
AxiosError$1.ERR_NOT_SUPPORT,
|
|
35510
|
+
config
|
|
35511
|
+
);
|
|
35512
|
+
});
|
|
34699
35513
|
});
|
|
35514
|
+
})();
|
|
35515
|
+
|
|
35516
|
+
const getBodyLength = async (body) => {
|
|
35517
|
+
if (body == null) {
|
|
35518
|
+
return 0;
|
|
34700
35519
|
}
|
|
34701
35520
|
|
|
34702
|
-
|
|
34703
|
-
|
|
34704
|
-
request.withCredentials = !!config.withCredentials;
|
|
35521
|
+
if (utils$1.isBlob(body)) {
|
|
35522
|
+
return body.size;
|
|
34705
35523
|
}
|
|
34706
35524
|
|
|
34707
|
-
|
|
34708
|
-
|
|
34709
|
-
|
|
35525
|
+
if (utils$1.isSpecCompliantForm(body)) {
|
|
35526
|
+
const _request = new Request(platform.origin, {
|
|
35527
|
+
method: 'POST',
|
|
35528
|
+
body,
|
|
35529
|
+
});
|
|
35530
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
34710
35531
|
}
|
|
34711
35532
|
|
|
34712
|
-
|
|
34713
|
-
|
|
34714
|
-
request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
|
|
35533
|
+
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
35534
|
+
return body.byteLength;
|
|
34715
35535
|
}
|
|
34716
35536
|
|
|
34717
|
-
|
|
34718
|
-
|
|
34719
|
-
request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
|
|
35537
|
+
if (utils$1.isURLSearchParams(body)) {
|
|
35538
|
+
body = body + '';
|
|
34720
35539
|
}
|
|
34721
35540
|
|
|
34722
|
-
if (
|
|
34723
|
-
|
|
34724
|
-
|
|
34725
|
-
|
|
34726
|
-
|
|
34727
|
-
|
|
35541
|
+
if (utils$1.isString(body)) {
|
|
35542
|
+
return (await encodeText(body)).byteLength;
|
|
35543
|
+
}
|
|
35544
|
+
};
|
|
35545
|
+
|
|
35546
|
+
const resolveBodyLength = async (headers, body) => {
|
|
35547
|
+
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
35548
|
+
|
|
35549
|
+
return length == null ? getBodyLength(body) : length;
|
|
35550
|
+
};
|
|
35551
|
+
|
|
35552
|
+
return async (config) => {
|
|
35553
|
+
let {
|
|
35554
|
+
url,
|
|
35555
|
+
method,
|
|
35556
|
+
data,
|
|
35557
|
+
signal,
|
|
35558
|
+
cancelToken,
|
|
35559
|
+
timeout,
|
|
35560
|
+
onDownloadProgress,
|
|
35561
|
+
onUploadProgress,
|
|
35562
|
+
responseType,
|
|
35563
|
+
headers,
|
|
35564
|
+
withCredentials = 'same-origin',
|
|
35565
|
+
fetchOptions,
|
|
35566
|
+
} = resolveConfig(config);
|
|
35567
|
+
|
|
35568
|
+
let _fetch = envFetch || fetch;
|
|
35569
|
+
|
|
35570
|
+
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
35571
|
+
|
|
35572
|
+
let composedSignal = composeSignals(
|
|
35573
|
+
[signal, cancelToken && cancelToken.toAbortSignal()],
|
|
35574
|
+
timeout
|
|
35575
|
+
);
|
|
35576
|
+
|
|
35577
|
+
let request = null;
|
|
35578
|
+
|
|
35579
|
+
const unsubscribe =
|
|
35580
|
+
composedSignal &&
|
|
35581
|
+
composedSignal.unsubscribe &&
|
|
35582
|
+
(() => {
|
|
35583
|
+
composedSignal.unsubscribe();
|
|
35584
|
+
});
|
|
35585
|
+
|
|
35586
|
+
let requestContentLength;
|
|
35587
|
+
|
|
35588
|
+
try {
|
|
35589
|
+
if (
|
|
35590
|
+
onUploadProgress &&
|
|
35591
|
+
supportsRequestStream &&
|
|
35592
|
+
method !== 'get' &&
|
|
35593
|
+
method !== 'head' &&
|
|
35594
|
+
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
35595
|
+
) {
|
|
35596
|
+
let _request = new Request(url, {
|
|
35597
|
+
method: 'POST',
|
|
35598
|
+
body: data,
|
|
35599
|
+
duplex: 'half',
|
|
35600
|
+
});
|
|
35601
|
+
|
|
35602
|
+
let contentTypeHeader;
|
|
35603
|
+
|
|
35604
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
35605
|
+
headers.setContentType(contentTypeHeader);
|
|
34728
35606
|
}
|
|
34729
|
-
|
|
34730
|
-
|
|
34731
|
-
|
|
35607
|
+
|
|
35608
|
+
if (_request.body) {
|
|
35609
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
35610
|
+
requestContentLength,
|
|
35611
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
35612
|
+
);
|
|
35613
|
+
|
|
35614
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
35615
|
+
}
|
|
35616
|
+
}
|
|
35617
|
+
|
|
35618
|
+
if (!utils$1.isString(withCredentials)) {
|
|
35619
|
+
withCredentials = withCredentials ? 'include' : 'omit';
|
|
35620
|
+
}
|
|
35621
|
+
|
|
35622
|
+
// Cloudflare Workers throws when credentials are defined
|
|
35623
|
+
// see https://github.com/cloudflare/workerd/issues/902
|
|
35624
|
+
const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
|
|
35625
|
+
|
|
35626
|
+
const resolvedOptions = {
|
|
35627
|
+
...fetchOptions,
|
|
35628
|
+
signal: composedSignal,
|
|
35629
|
+
method: method.toUpperCase(),
|
|
35630
|
+
headers: headers.normalize().toJSON(),
|
|
35631
|
+
body: data,
|
|
35632
|
+
duplex: 'half',
|
|
35633
|
+
credentials: isCredentialsSupported ? withCredentials : undefined,
|
|
34732
35634
|
};
|
|
34733
35635
|
|
|
34734
|
-
|
|
34735
|
-
|
|
34736
|
-
|
|
35636
|
+
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
35637
|
+
|
|
35638
|
+
let response = await (isRequestSupported
|
|
35639
|
+
? _fetch(request, fetchOptions)
|
|
35640
|
+
: _fetch(url, resolvedOptions));
|
|
35641
|
+
|
|
35642
|
+
const isStreamResponse =
|
|
35643
|
+
supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
35644
|
+
|
|
35645
|
+
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
|
35646
|
+
const options = {};
|
|
35647
|
+
|
|
35648
|
+
['status', 'statusText', 'headers'].forEach((prop) => {
|
|
35649
|
+
options[prop] = response[prop];
|
|
35650
|
+
});
|
|
35651
|
+
|
|
35652
|
+
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
35653
|
+
|
|
35654
|
+
const [onProgress, flush] =
|
|
35655
|
+
(onDownloadProgress &&
|
|
35656
|
+
progressEventDecorator(
|
|
35657
|
+
responseContentLength,
|
|
35658
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
35659
|
+
)) ||
|
|
35660
|
+
[];
|
|
35661
|
+
|
|
35662
|
+
response = new Response(
|
|
35663
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
35664
|
+
flush && flush();
|
|
35665
|
+
unsubscribe && unsubscribe();
|
|
35666
|
+
}),
|
|
35667
|
+
options
|
|
35668
|
+
);
|
|
34737
35669
|
}
|
|
34738
|
-
}
|
|
34739
35670
|
|
|
34740
|
-
|
|
35671
|
+
responseType = responseType || 'text';
|
|
34741
35672
|
|
|
34742
|
-
|
|
34743
|
-
|
|
34744
|
-
|
|
35673
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](
|
|
35674
|
+
response,
|
|
35675
|
+
config
|
|
35676
|
+
);
|
|
35677
|
+
|
|
35678
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
35679
|
+
|
|
35680
|
+
return await new Promise((resolve, reject) => {
|
|
35681
|
+
settle(resolve, reject, {
|
|
35682
|
+
data: responseData,
|
|
35683
|
+
headers: AxiosHeaders$1.from(response.headers),
|
|
35684
|
+
status: response.status,
|
|
35685
|
+
statusText: response.statusText,
|
|
35686
|
+
config,
|
|
35687
|
+
request,
|
|
35688
|
+
});
|
|
35689
|
+
});
|
|
35690
|
+
} catch (err) {
|
|
35691
|
+
unsubscribe && unsubscribe();
|
|
35692
|
+
|
|
35693
|
+
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
35694
|
+
throw Object.assign(
|
|
35695
|
+
new AxiosError$1(
|
|
35696
|
+
'Network Error',
|
|
35697
|
+
AxiosError$1.ERR_NETWORK,
|
|
35698
|
+
config,
|
|
35699
|
+
request,
|
|
35700
|
+
err && err.response
|
|
35701
|
+
),
|
|
35702
|
+
{
|
|
35703
|
+
cause: err.cause || err,
|
|
35704
|
+
}
|
|
35705
|
+
);
|
|
35706
|
+
}
|
|
35707
|
+
|
|
35708
|
+
throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
|
|
34745
35709
|
}
|
|
35710
|
+
};
|
|
35711
|
+
};
|
|
34746
35712
|
|
|
35713
|
+
const seedCache = new Map();
|
|
34747
35714
|
|
|
34748
|
-
|
|
34749
|
-
|
|
34750
|
-
}
|
|
35715
|
+
const getFetch = (config) => {
|
|
35716
|
+
let env = (config && config.env) || {};
|
|
35717
|
+
const { fetch, Request, Response } = env;
|
|
35718
|
+
const seeds = [Request, Response, fetch];
|
|
35719
|
+
|
|
35720
|
+
let len = seeds.length,
|
|
35721
|
+
i = len,
|
|
35722
|
+
seed,
|
|
35723
|
+
target,
|
|
35724
|
+
map = seedCache;
|
|
35725
|
+
|
|
35726
|
+
while (i--) {
|
|
35727
|
+
seed = seeds[i];
|
|
35728
|
+
target = map.get(seed);
|
|
35729
|
+
|
|
35730
|
+
target === undefined && map.set(seed, (target = i ? new Map() : factory(env)));
|
|
35731
|
+
|
|
35732
|
+
map = target;
|
|
35733
|
+
}
|
|
35734
|
+
|
|
35735
|
+
return target;
|
|
34751
35736
|
};
|
|
34752
35737
|
|
|
35738
|
+
getFetch();
|
|
35739
|
+
|
|
35740
|
+
/**
|
|
35741
|
+
* Known adapters mapping.
|
|
35742
|
+
* Provides environment-specific adapters for Axios:
|
|
35743
|
+
* - `http` for Node.js
|
|
35744
|
+
* - `xhr` for browsers
|
|
35745
|
+
* - `fetch` for fetch API-based requests
|
|
35746
|
+
*
|
|
35747
|
+
* @type {Object<string, Function|Object>}
|
|
35748
|
+
*/
|
|
34753
35749
|
const knownAdapters = {
|
|
34754
35750
|
http: httpAdapter,
|
|
34755
|
-
xhr: xhrAdapter
|
|
35751
|
+
xhr: xhrAdapter,
|
|
35752
|
+
fetch: {
|
|
35753
|
+
get: getFetch,
|
|
35754
|
+
},
|
|
34756
35755
|
};
|
|
34757
35756
|
|
|
35757
|
+
// Assign adapter names for easier debugging and identification
|
|
34758
35758
|
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
34759
35759
|
if (fn) {
|
|
34760
35760
|
try {
|
|
34761
|
-
Object.defineProperty(fn, 'name', {value});
|
|
35761
|
+
Object.defineProperty(fn, 'name', { value });
|
|
34762
35762
|
} catch (e) {
|
|
34763
35763
|
// eslint-disable-next-line no-empty
|
|
34764
35764
|
}
|
|
34765
|
-
Object.defineProperty(fn, 'adapterName', {value});
|
|
35765
|
+
Object.defineProperty(fn, 'adapterName', { value });
|
|
34766
35766
|
}
|
|
34767
35767
|
});
|
|
34768
35768
|
|
|
35769
|
+
/**
|
|
35770
|
+
* Render a rejection reason string for unknown or unsupported adapters
|
|
35771
|
+
*
|
|
35772
|
+
* @param {string} reason
|
|
35773
|
+
* @returns {string}
|
|
35774
|
+
*/
|
|
34769
35775
|
const renderReason = (reason) => `- ${reason}`;
|
|
34770
35776
|
|
|
34771
|
-
|
|
35777
|
+
/**
|
|
35778
|
+
* Check if the adapter is resolved (function, null, or false)
|
|
35779
|
+
*
|
|
35780
|
+
* @param {Function|null|false} adapter
|
|
35781
|
+
* @returns {boolean}
|
|
35782
|
+
*/
|
|
35783
|
+
const isResolvedHandle = (adapter) =>
|
|
35784
|
+
utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
34772
35785
|
|
|
34773
|
-
|
|
34774
|
-
|
|
34775
|
-
|
|
35786
|
+
/**
|
|
35787
|
+
* Get the first suitable adapter from the provided list.
|
|
35788
|
+
* Tries each adapter in order until a supported one is found.
|
|
35789
|
+
* Throws an AxiosError if no adapter is suitable.
|
|
35790
|
+
*
|
|
35791
|
+
* @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
|
|
35792
|
+
* @param {Object} config - Axios request configuration
|
|
35793
|
+
* @throws {AxiosError} If no suitable adapter is available
|
|
35794
|
+
* @returns {Function} The resolved adapter function
|
|
35795
|
+
*/
|
|
35796
|
+
function getAdapter$1(adapters, config) {
|
|
35797
|
+
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
|
34776
35798
|
|
|
34777
|
-
|
|
34778
|
-
|
|
34779
|
-
|
|
35799
|
+
const { length } = adapters;
|
|
35800
|
+
let nameOrAdapter;
|
|
35801
|
+
let adapter;
|
|
34780
35802
|
|
|
34781
|
-
|
|
35803
|
+
const rejectedReasons = {};
|
|
34782
35804
|
|
|
34783
|
-
|
|
34784
|
-
|
|
34785
|
-
|
|
35805
|
+
for (let i = 0; i < length; i++) {
|
|
35806
|
+
nameOrAdapter = adapters[i];
|
|
35807
|
+
let id;
|
|
34786
35808
|
|
|
34787
|
-
|
|
35809
|
+
adapter = nameOrAdapter;
|
|
34788
35810
|
|
|
34789
|
-
|
|
34790
|
-
|
|
35811
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
35812
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
34791
35813
|
|
|
34792
|
-
|
|
34793
|
-
|
|
34794
|
-
}
|
|
34795
|
-
}
|
|
34796
|
-
|
|
34797
|
-
if (adapter) {
|
|
34798
|
-
break;
|
|
35814
|
+
if (adapter === undefined) {
|
|
35815
|
+
throw new AxiosError$1(`Unknown adapter '${id}'`);
|
|
34799
35816
|
}
|
|
35817
|
+
}
|
|
34800
35818
|
|
|
34801
|
-
|
|
35819
|
+
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
35820
|
+
break;
|
|
34802
35821
|
}
|
|
34803
35822
|
|
|
34804
|
-
|
|
35823
|
+
rejectedReasons[id || '#' + i] = adapter;
|
|
35824
|
+
}
|
|
34805
35825
|
|
|
34806
|
-
|
|
34807
|
-
|
|
34808
|
-
|
|
34809
|
-
|
|
35826
|
+
if (!adapter) {
|
|
35827
|
+
const reasons = Object.entries(rejectedReasons).map(
|
|
35828
|
+
([id, state]) =>
|
|
35829
|
+
`adapter ${id} ` +
|
|
35830
|
+
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
|
35831
|
+
);
|
|
34810
35832
|
|
|
34811
|
-
|
|
34812
|
-
|
|
34813
|
-
'
|
|
35833
|
+
let s = length
|
|
35834
|
+
? reasons.length > 1
|
|
35835
|
+
? 'since :\n' + reasons.map(renderReason).join('\n')
|
|
35836
|
+
: ' ' + renderReason(reasons[0])
|
|
35837
|
+
: 'as no adapter specified';
|
|
34814
35838
|
|
|
34815
|
-
|
|
34816
|
-
|
|
34817
|
-
|
|
34818
|
-
|
|
34819
|
-
|
|
35839
|
+
throw new AxiosError$1(
|
|
35840
|
+
`There is no suitable adapter to dispatch the request ` + s,
|
|
35841
|
+
'ERR_NOT_SUPPORT'
|
|
35842
|
+
);
|
|
35843
|
+
}
|
|
34820
35844
|
|
|
34821
|
-
|
|
34822
|
-
|
|
34823
|
-
|
|
35845
|
+
return adapter;
|
|
35846
|
+
}
|
|
35847
|
+
|
|
35848
|
+
/**
|
|
35849
|
+
* Exports Axios adapters and utility to resolve an adapter
|
|
35850
|
+
*/
|
|
35851
|
+
var adapters = {
|
|
35852
|
+
/**
|
|
35853
|
+
* Resolve an adapter from a list of adapter names or functions.
|
|
35854
|
+
* @type {Function}
|
|
35855
|
+
*/
|
|
35856
|
+
getAdapter: getAdapter$1,
|
|
35857
|
+
|
|
35858
|
+
/**
|
|
35859
|
+
* Exposes all known adapters
|
|
35860
|
+
* @type {Object<string, Function|Object>}
|
|
35861
|
+
*/
|
|
35862
|
+
adapters: knownAdapters,
|
|
34824
35863
|
};
|
|
34825
35864
|
|
|
34826
35865
|
/**
|
|
@@ -34853,152 +35892,46 @@ function dispatchRequest(config) {
|
|
|
34853
35892
|
config.headers = AxiosHeaders$1.from(config.headers);
|
|
34854
35893
|
|
|
34855
35894
|
// Transform request data
|
|
34856
|
-
config.data = transformData.call(
|
|
34857
|
-
config,
|
|
34858
|
-
config.transformRequest
|
|
34859
|
-
);
|
|
35895
|
+
config.data = transformData.call(config, config.transformRequest);
|
|
34860
35896
|
|
|
34861
35897
|
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
|
34862
35898
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
34863
35899
|
}
|
|
34864
35900
|
|
|
34865
|
-
const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
|
|
34866
|
-
|
|
34867
|
-
return adapter(config).then(function onAdapterResolution(response) {
|
|
34868
|
-
throwIfCancellationRequested(config);
|
|
34869
|
-
|
|
34870
|
-
// Transform response data
|
|
34871
|
-
response.data = transformData.call(
|
|
34872
|
-
config,
|
|
34873
|
-
config.transformResponse,
|
|
34874
|
-
response
|
|
34875
|
-
);
|
|
35901
|
+
const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
|
|
34876
35902
|
|
|
34877
|
-
|
|
34878
|
-
|
|
34879
|
-
return response;
|
|
34880
|
-
}, function onAdapterRejection(reason) {
|
|
34881
|
-
if (!isCancel$1(reason)) {
|
|
35903
|
+
return adapter(config).then(
|
|
35904
|
+
function onAdapterResolution(response) {
|
|
34882
35905
|
throwIfCancellationRequested(config);
|
|
34883
35906
|
|
|
34884
35907
|
// Transform response data
|
|
34885
|
-
|
|
34886
|
-
reason.response.data = transformData.call(
|
|
34887
|
-
config,
|
|
34888
|
-
config.transformResponse,
|
|
34889
|
-
reason.response
|
|
34890
|
-
);
|
|
34891
|
-
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
|
34892
|
-
}
|
|
34893
|
-
}
|
|
35908
|
+
response.data = transformData.call(config, config.transformResponse, response);
|
|
34894
35909
|
|
|
34895
|
-
|
|
34896
|
-
});
|
|
34897
|
-
}
|
|
34898
|
-
|
|
34899
|
-
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
|
|
35910
|
+
response.headers = AxiosHeaders$1.from(response.headers);
|
|
34900
35911
|
|
|
34901
|
-
|
|
34902
|
-
|
|
34903
|
-
|
|
34904
|
-
|
|
34905
|
-
|
|
34906
|
-
|
|
34907
|
-
|
|
34908
|
-
|
|
34909
|
-
|
|
34910
|
-
|
|
34911
|
-
|
|
34912
|
-
|
|
34913
|
-
|
|
34914
|
-
|
|
34915
|
-
|
|
34916
|
-
|
|
34917
|
-
return utils$1.merge.call({caseless}, target, source);
|
|
34918
|
-
} else if (utils$1.isPlainObject(source)) {
|
|
34919
|
-
return utils$1.merge({}, source);
|
|
34920
|
-
} else if (utils$1.isArray(source)) {
|
|
34921
|
-
return source.slice();
|
|
34922
|
-
}
|
|
34923
|
-
return source;
|
|
34924
|
-
}
|
|
34925
|
-
|
|
34926
|
-
// eslint-disable-next-line consistent-return
|
|
34927
|
-
function mergeDeepProperties(a, b, caseless) {
|
|
34928
|
-
if (!utils$1.isUndefined(b)) {
|
|
34929
|
-
return getMergedValue(a, b, caseless);
|
|
34930
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
34931
|
-
return getMergedValue(undefined, a, caseless);
|
|
34932
|
-
}
|
|
34933
|
-
}
|
|
34934
|
-
|
|
34935
|
-
// eslint-disable-next-line consistent-return
|
|
34936
|
-
function valueFromConfig2(a, b) {
|
|
34937
|
-
if (!utils$1.isUndefined(b)) {
|
|
34938
|
-
return getMergedValue(undefined, b);
|
|
34939
|
-
}
|
|
34940
|
-
}
|
|
34941
|
-
|
|
34942
|
-
// eslint-disable-next-line consistent-return
|
|
34943
|
-
function defaultToConfig2(a, b) {
|
|
34944
|
-
if (!utils$1.isUndefined(b)) {
|
|
34945
|
-
return getMergedValue(undefined, b);
|
|
34946
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
34947
|
-
return getMergedValue(undefined, a);
|
|
34948
|
-
}
|
|
34949
|
-
}
|
|
35912
|
+
return response;
|
|
35913
|
+
},
|
|
35914
|
+
function onAdapterRejection(reason) {
|
|
35915
|
+
if (!isCancel$1(reason)) {
|
|
35916
|
+
throwIfCancellationRequested(config);
|
|
35917
|
+
|
|
35918
|
+
// Transform response data
|
|
35919
|
+
if (reason && reason.response) {
|
|
35920
|
+
reason.response.data = transformData.call(
|
|
35921
|
+
config,
|
|
35922
|
+
config.transformResponse,
|
|
35923
|
+
reason.response
|
|
35924
|
+
);
|
|
35925
|
+
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
|
35926
|
+
}
|
|
35927
|
+
}
|
|
34950
35928
|
|
|
34951
|
-
|
|
34952
|
-
function mergeDirectKeys(a, b, prop) {
|
|
34953
|
-
if (prop in config2) {
|
|
34954
|
-
return getMergedValue(a, b);
|
|
34955
|
-
} else if (prop in config1) {
|
|
34956
|
-
return getMergedValue(undefined, a);
|
|
35929
|
+
return Promise.reject(reason);
|
|
34957
35930
|
}
|
|
34958
|
-
|
|
34959
|
-
|
|
34960
|
-
const mergeMap = {
|
|
34961
|
-
url: valueFromConfig2,
|
|
34962
|
-
method: valueFromConfig2,
|
|
34963
|
-
data: valueFromConfig2,
|
|
34964
|
-
baseURL: defaultToConfig2,
|
|
34965
|
-
transformRequest: defaultToConfig2,
|
|
34966
|
-
transformResponse: defaultToConfig2,
|
|
34967
|
-
paramsSerializer: defaultToConfig2,
|
|
34968
|
-
timeout: defaultToConfig2,
|
|
34969
|
-
timeoutMessage: defaultToConfig2,
|
|
34970
|
-
withCredentials: defaultToConfig2,
|
|
34971
|
-
withXSRFToken: defaultToConfig2,
|
|
34972
|
-
adapter: defaultToConfig2,
|
|
34973
|
-
responseType: defaultToConfig2,
|
|
34974
|
-
xsrfCookieName: defaultToConfig2,
|
|
34975
|
-
xsrfHeaderName: defaultToConfig2,
|
|
34976
|
-
onUploadProgress: defaultToConfig2,
|
|
34977
|
-
onDownloadProgress: defaultToConfig2,
|
|
34978
|
-
decompress: defaultToConfig2,
|
|
34979
|
-
maxContentLength: defaultToConfig2,
|
|
34980
|
-
maxBodyLength: defaultToConfig2,
|
|
34981
|
-
beforeRedirect: defaultToConfig2,
|
|
34982
|
-
transport: defaultToConfig2,
|
|
34983
|
-
httpAgent: defaultToConfig2,
|
|
34984
|
-
httpsAgent: defaultToConfig2,
|
|
34985
|
-
cancelToken: defaultToConfig2,
|
|
34986
|
-
socketPath: defaultToConfig2,
|
|
34987
|
-
responseEncoding: defaultToConfig2,
|
|
34988
|
-
validateStatus: mergeDirectKeys,
|
|
34989
|
-
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
34990
|
-
};
|
|
34991
|
-
|
|
34992
|
-
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
34993
|
-
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
34994
|
-
const configValue = merge(config1[prop], config2[prop], prop);
|
|
34995
|
-
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
34996
|
-
});
|
|
34997
|
-
|
|
34998
|
-
return config;
|
|
35931
|
+
);
|
|
34999
35932
|
}
|
|
35000
35933
|
|
|
35001
|
-
const VERSION$1 = "1.
|
|
35934
|
+
const VERSION$1 = "1.15.0";
|
|
35002
35935
|
|
|
35003
35936
|
const validators$1 = {};
|
|
35004
35937
|
|
|
@@ -35022,7 +35955,15 @@ const deprecatedWarnings = {};
|
|
|
35022
35955
|
*/
|
|
35023
35956
|
validators$1.transitional = function transitional(validator, version, message) {
|
|
35024
35957
|
function formatMessage(opt, desc) {
|
|
35025
|
-
return
|
|
35958
|
+
return (
|
|
35959
|
+
'[Axios v' +
|
|
35960
|
+
VERSION$1 +
|
|
35961
|
+
"] Transitional option '" +
|
|
35962
|
+
opt +
|
|
35963
|
+
"'" +
|
|
35964
|
+
desc +
|
|
35965
|
+
(message ? '. ' + message : '')
|
|
35966
|
+
);
|
|
35026
35967
|
}
|
|
35027
35968
|
|
|
35028
35969
|
// eslint-disable-next-line func-names
|
|
@@ -35049,6 +35990,14 @@ validators$1.transitional = function transitional(validator, version, message) {
|
|
|
35049
35990
|
};
|
|
35050
35991
|
};
|
|
35051
35992
|
|
|
35993
|
+
validators$1.spelling = function spelling(correctSpelling) {
|
|
35994
|
+
return (value, opt) => {
|
|
35995
|
+
// eslint-disable-next-line no-console
|
|
35996
|
+
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
35997
|
+
return true;
|
|
35998
|
+
};
|
|
35999
|
+
};
|
|
36000
|
+
|
|
35052
36001
|
/**
|
|
35053
36002
|
* Assert object's properties type
|
|
35054
36003
|
*
|
|
@@ -35072,7 +36021,10 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
35072
36021
|
const value = options[opt];
|
|
35073
36022
|
const result = value === undefined || validator(value, opt, options);
|
|
35074
36023
|
if (result !== true) {
|
|
35075
|
-
throw new AxiosError$1(
|
|
36024
|
+
throw new AxiosError$1(
|
|
36025
|
+
'option ' + opt + ' must be ' + result,
|
|
36026
|
+
AxiosError$1.ERR_BAD_OPTION_VALUE
|
|
36027
|
+
);
|
|
35076
36028
|
}
|
|
35077
36029
|
continue;
|
|
35078
36030
|
}
|
|
@@ -35084,7 +36036,7 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
35084
36036
|
|
|
35085
36037
|
var validator = {
|
|
35086
36038
|
assertOptions,
|
|
35087
|
-
validators: validators$1
|
|
36039
|
+
validators: validators$1,
|
|
35088
36040
|
};
|
|
35089
36041
|
|
|
35090
36042
|
const validators = validator.validators;
|
|
@@ -35098,10 +36050,10 @@ const validators = validator.validators;
|
|
|
35098
36050
|
*/
|
|
35099
36051
|
let Axios$1 = class Axios {
|
|
35100
36052
|
constructor(instanceConfig) {
|
|
35101
|
-
this.defaults = instanceConfig;
|
|
36053
|
+
this.defaults = instanceConfig || {};
|
|
35102
36054
|
this.interceptors = {
|
|
35103
36055
|
request: new InterceptorManager(),
|
|
35104
|
-
response: new InterceptorManager()
|
|
36056
|
+
response: new InterceptorManager(),
|
|
35105
36057
|
};
|
|
35106
36058
|
}
|
|
35107
36059
|
|
|
@@ -35113,7 +36065,50 @@ let Axios$1 = class Axios {
|
|
|
35113
36065
|
*
|
|
35114
36066
|
* @returns {Promise} The Promise to be fulfilled
|
|
35115
36067
|
*/
|
|
35116
|
-
request(configOrUrl, config) {
|
|
36068
|
+
async request(configOrUrl, config) {
|
|
36069
|
+
try {
|
|
36070
|
+
return await this._request(configOrUrl, config);
|
|
36071
|
+
} catch (err) {
|
|
36072
|
+
if (err instanceof Error) {
|
|
36073
|
+
let dummy = {};
|
|
36074
|
+
|
|
36075
|
+
Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
|
|
36076
|
+
|
|
36077
|
+
// slice off the Error: ... line
|
|
36078
|
+
const stack = (() => {
|
|
36079
|
+
if (!dummy.stack) {
|
|
36080
|
+
return '';
|
|
36081
|
+
}
|
|
36082
|
+
|
|
36083
|
+
const firstNewlineIndex = dummy.stack.indexOf('\n');
|
|
36084
|
+
|
|
36085
|
+
return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
|
|
36086
|
+
})();
|
|
36087
|
+
try {
|
|
36088
|
+
if (!err.stack) {
|
|
36089
|
+
err.stack = stack;
|
|
36090
|
+
// match without the 2 top stack lines
|
|
36091
|
+
} else if (stack) {
|
|
36092
|
+
const firstNewlineIndex = stack.indexOf('\n');
|
|
36093
|
+
const secondNewlineIndex =
|
|
36094
|
+
firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
|
|
36095
|
+
const stackWithoutTwoTopLines =
|
|
36096
|
+
secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);
|
|
36097
|
+
|
|
36098
|
+
if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
|
|
36099
|
+
err.stack += '\n' + stack;
|
|
36100
|
+
}
|
|
36101
|
+
}
|
|
36102
|
+
} catch (e) {
|
|
36103
|
+
// ignore the case where "stack" is an un-writable property
|
|
36104
|
+
}
|
|
36105
|
+
}
|
|
36106
|
+
|
|
36107
|
+
throw err;
|
|
36108
|
+
}
|
|
36109
|
+
}
|
|
36110
|
+
|
|
36111
|
+
_request(configOrUrl, config) {
|
|
35117
36112
|
/*eslint no-param-reassign:0*/
|
|
35118
36113
|
// Allow for axios('example/url'[, config]) a la fetch API
|
|
35119
36114
|
if (typeof configOrUrl === 'string') {
|
|
@@ -35125,44 +36120,64 @@ let Axios$1 = class Axios {
|
|
|
35125
36120
|
|
|
35126
36121
|
config = mergeConfig$1(this.defaults, config);
|
|
35127
36122
|
|
|
35128
|
-
const {transitional, paramsSerializer, headers} = config;
|
|
36123
|
+
const { transitional, paramsSerializer, headers } = config;
|
|
35129
36124
|
|
|
35130
36125
|
if (transitional !== undefined) {
|
|
35131
|
-
validator.assertOptions(
|
|
35132
|
-
|
|
35133
|
-
|
|
35134
|
-
|
|
35135
|
-
|
|
36126
|
+
validator.assertOptions(
|
|
36127
|
+
transitional,
|
|
36128
|
+
{
|
|
36129
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
36130
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
36131
|
+
clarifyTimeoutError: validators.transitional(validators.boolean),
|
|
36132
|
+
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
|
|
36133
|
+
},
|
|
36134
|
+
false
|
|
36135
|
+
);
|
|
35136
36136
|
}
|
|
35137
36137
|
|
|
35138
36138
|
if (paramsSerializer != null) {
|
|
35139
36139
|
if (utils$1.isFunction(paramsSerializer)) {
|
|
35140
36140
|
config.paramsSerializer = {
|
|
35141
|
-
serialize: paramsSerializer
|
|
36141
|
+
serialize: paramsSerializer,
|
|
35142
36142
|
};
|
|
35143
36143
|
} else {
|
|
35144
|
-
validator.assertOptions(
|
|
35145
|
-
|
|
35146
|
-
|
|
35147
|
-
|
|
36144
|
+
validator.assertOptions(
|
|
36145
|
+
paramsSerializer,
|
|
36146
|
+
{
|
|
36147
|
+
encode: validators.function,
|
|
36148
|
+
serialize: validators.function,
|
|
36149
|
+
},
|
|
36150
|
+
true
|
|
36151
|
+
);
|
|
35148
36152
|
}
|
|
35149
36153
|
}
|
|
35150
36154
|
|
|
36155
|
+
// Set config.allowAbsoluteUrls
|
|
36156
|
+
if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
|
|
36157
|
+
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
|
|
36158
|
+
} else {
|
|
36159
|
+
config.allowAbsoluteUrls = true;
|
|
36160
|
+
}
|
|
36161
|
+
|
|
36162
|
+
validator.assertOptions(
|
|
36163
|
+
config,
|
|
36164
|
+
{
|
|
36165
|
+
baseUrl: validators.spelling('baseURL'),
|
|
36166
|
+
withXsrfToken: validators.spelling('withXSRFToken'),
|
|
36167
|
+
},
|
|
36168
|
+
true
|
|
36169
|
+
);
|
|
36170
|
+
|
|
35151
36171
|
// Set config.method
|
|
35152
36172
|
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
|
35153
36173
|
|
|
35154
36174
|
// Flatten headers
|
|
35155
|
-
let contextHeaders = headers && utils$1.merge(
|
|
35156
|
-
headers.common,
|
|
35157
|
-
headers[config.method]
|
|
35158
|
-
);
|
|
36175
|
+
let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
|
|
35159
36176
|
|
|
35160
|
-
headers &&
|
|
35161
|
-
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
35162
|
-
(method) => {
|
|
36177
|
+
headers &&
|
|
36178
|
+
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
|
|
35163
36179
|
delete headers[method];
|
|
35164
|
-
}
|
|
35165
|
-
);
|
|
36180
|
+
});
|
|
35166
36181
|
|
|
35167
36182
|
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
|
35168
36183
|
|
|
@@ -35176,7 +36191,15 @@ let Axios$1 = class Axios {
|
|
|
35176
36191
|
|
|
35177
36192
|
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
35178
36193
|
|
|
35179
|
-
|
|
36194
|
+
const transitional = config.transitional || transitionalDefaults;
|
|
36195
|
+
const legacyInterceptorReqResOrdering =
|
|
36196
|
+
transitional && transitional.legacyInterceptorReqResOrdering;
|
|
36197
|
+
|
|
36198
|
+
if (legacyInterceptorReqResOrdering) {
|
|
36199
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
36200
|
+
} else {
|
|
36201
|
+
requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
36202
|
+
}
|
|
35180
36203
|
});
|
|
35181
36204
|
|
|
35182
36205
|
const responseInterceptorChain = [];
|
|
@@ -35190,8 +36213,8 @@ let Axios$1 = class Axios {
|
|
|
35190
36213
|
|
|
35191
36214
|
if (!synchronousRequestInterceptors) {
|
|
35192
36215
|
const chain = [dispatchRequest.bind(this), undefined];
|
|
35193
|
-
chain.unshift
|
|
35194
|
-
chain.push
|
|
36216
|
+
chain.unshift(...requestInterceptorChain);
|
|
36217
|
+
chain.push(...responseInterceptorChain);
|
|
35195
36218
|
len = chain.length;
|
|
35196
36219
|
|
|
35197
36220
|
promise = Promise.resolve(config);
|
|
@@ -35207,8 +36230,6 @@ let Axios$1 = class Axios {
|
|
|
35207
36230
|
|
|
35208
36231
|
let newConfig = config;
|
|
35209
36232
|
|
|
35210
|
-
i = 0;
|
|
35211
|
-
|
|
35212
36233
|
while (i < len) {
|
|
35213
36234
|
const onFulfilled = requestInterceptorChain[i++];
|
|
35214
36235
|
const onRejected = requestInterceptorChain[i++];
|
|
@@ -35238,7 +36259,7 @@ let Axios$1 = class Axios {
|
|
|
35238
36259
|
|
|
35239
36260
|
getUri(config) {
|
|
35240
36261
|
config = mergeConfig$1(this.defaults, config);
|
|
35241
|
-
const fullPath = buildFullPath(config.baseURL, config.url);
|
|
36262
|
+
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
|
35242
36263
|
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
35243
36264
|
}
|
|
35244
36265
|
};
|
|
@@ -35246,28 +36267,32 @@ let Axios$1 = class Axios {
|
|
|
35246
36267
|
// Provide aliases for supported request methods
|
|
35247
36268
|
utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
35248
36269
|
/*eslint func-names:0*/
|
|
35249
|
-
Axios$1.prototype[method] = function(url, config) {
|
|
35250
|
-
return this.request(
|
|
35251
|
-
|
|
35252
|
-
|
|
35253
|
-
|
|
35254
|
-
|
|
36270
|
+
Axios$1.prototype[method] = function (url, config) {
|
|
36271
|
+
return this.request(
|
|
36272
|
+
mergeConfig$1(config || {}, {
|
|
36273
|
+
method,
|
|
36274
|
+
url,
|
|
36275
|
+
data: (config || {}).data,
|
|
36276
|
+
})
|
|
36277
|
+
);
|
|
35255
36278
|
};
|
|
35256
36279
|
});
|
|
35257
36280
|
|
|
35258
36281
|
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
35259
|
-
/*eslint func-names:0*/
|
|
35260
|
-
|
|
35261
36282
|
function generateHTTPMethod(isForm) {
|
|
35262
36283
|
return function httpMethod(url, data, config) {
|
|
35263
|
-
return this.request(
|
|
35264
|
-
|
|
35265
|
-
|
|
35266
|
-
|
|
35267
|
-
|
|
35268
|
-
|
|
35269
|
-
|
|
35270
|
-
|
|
36284
|
+
return this.request(
|
|
36285
|
+
mergeConfig$1(config || {}, {
|
|
36286
|
+
method,
|
|
36287
|
+
headers: isForm
|
|
36288
|
+
? {
|
|
36289
|
+
'Content-Type': 'multipart/form-data',
|
|
36290
|
+
}
|
|
36291
|
+
: {},
|
|
36292
|
+
url,
|
|
36293
|
+
data,
|
|
36294
|
+
})
|
|
36295
|
+
);
|
|
35271
36296
|
};
|
|
35272
36297
|
}
|
|
35273
36298
|
|
|
@@ -35298,7 +36323,7 @@ let CancelToken$1 = class CancelToken {
|
|
|
35298
36323
|
const token = this;
|
|
35299
36324
|
|
|
35300
36325
|
// eslint-disable-next-line func-names
|
|
35301
|
-
this.promise.then(cancel => {
|
|
36326
|
+
this.promise.then((cancel) => {
|
|
35302
36327
|
if (!token._listeners) return;
|
|
35303
36328
|
|
|
35304
36329
|
let i = token._listeners.length;
|
|
@@ -35310,10 +36335,10 @@ let CancelToken$1 = class CancelToken {
|
|
|
35310
36335
|
});
|
|
35311
36336
|
|
|
35312
36337
|
// eslint-disable-next-line func-names
|
|
35313
|
-
this.promise.then = onfulfilled => {
|
|
36338
|
+
this.promise.then = (onfulfilled) => {
|
|
35314
36339
|
let _resolve;
|
|
35315
36340
|
// eslint-disable-next-line func-names
|
|
35316
|
-
const promise = new Promise(resolve => {
|
|
36341
|
+
const promise = new Promise((resolve) => {
|
|
35317
36342
|
token.subscribe(resolve);
|
|
35318
36343
|
_resolve = resolve;
|
|
35319
36344
|
}).then(onfulfilled);
|
|
@@ -35376,6 +36401,20 @@ let CancelToken$1 = class CancelToken {
|
|
|
35376
36401
|
}
|
|
35377
36402
|
}
|
|
35378
36403
|
|
|
36404
|
+
toAbortSignal() {
|
|
36405
|
+
const controller = new AbortController();
|
|
36406
|
+
|
|
36407
|
+
const abort = (err) => {
|
|
36408
|
+
controller.abort(err);
|
|
36409
|
+
};
|
|
36410
|
+
|
|
36411
|
+
this.subscribe(abort);
|
|
36412
|
+
|
|
36413
|
+
controller.signal.unsubscribe = () => this.unsubscribe(abort);
|
|
36414
|
+
|
|
36415
|
+
return controller.signal;
|
|
36416
|
+
}
|
|
36417
|
+
|
|
35379
36418
|
/**
|
|
35380
36419
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
35381
36420
|
* cancels the `CancelToken`.
|
|
@@ -35387,7 +36426,7 @@ let CancelToken$1 = class CancelToken {
|
|
|
35387
36426
|
});
|
|
35388
36427
|
return {
|
|
35389
36428
|
token,
|
|
35390
|
-
cancel
|
|
36429
|
+
cancel,
|
|
35391
36430
|
};
|
|
35392
36431
|
}
|
|
35393
36432
|
};
|
|
@@ -35399,7 +36438,7 @@ let CancelToken$1 = class CancelToken {
|
|
|
35399
36438
|
*
|
|
35400
36439
|
* ```js
|
|
35401
36440
|
* function f(x, y, z) {}
|
|
35402
|
-
*
|
|
36441
|
+
* const args = [1, 2, 3];
|
|
35403
36442
|
* f.apply(null, args);
|
|
35404
36443
|
* ```
|
|
35405
36444
|
*
|
|
@@ -35427,7 +36466,7 @@ function spread$1(callback) {
|
|
|
35427
36466
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
35428
36467
|
*/
|
|
35429
36468
|
function isAxiosError$1(payload) {
|
|
35430
|
-
return utils$1.isObject(payload) &&
|
|
36469
|
+
return utils$1.isObject(payload) && payload.isAxiosError === true;
|
|
35431
36470
|
}
|
|
35432
36471
|
|
|
35433
36472
|
const HttpStatusCode$1 = {
|
|
@@ -35494,6 +36533,12 @@ const HttpStatusCode$1 = {
|
|
|
35494
36533
|
LoopDetected: 508,
|
|
35495
36534
|
NotExtended: 510,
|
|
35496
36535
|
NetworkAuthenticationRequired: 511,
|
|
36536
|
+
WebServerIsDown: 521,
|
|
36537
|
+
ConnectionTimedOut: 522,
|
|
36538
|
+
OriginIsUnreachable: 523,
|
|
36539
|
+
TimeoutOccurred: 524,
|
|
36540
|
+
SslHandshakeFailed: 525,
|
|
36541
|
+
InvalidSslCertificate: 526,
|
|
35497
36542
|
};
|
|
35498
36543
|
|
|
35499
36544
|
Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
|
|
@@ -35512,10 +36557,10 @@ function createInstance(defaultConfig) {
|
|
|
35512
36557
|
const instance = bind(Axios$1.prototype.request, context);
|
|
35513
36558
|
|
|
35514
36559
|
// Copy axios.prototype to instance
|
|
35515
|
-
utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
|
|
36560
|
+
utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
|
|
35516
36561
|
|
|
35517
36562
|
// Copy context to instance
|
|
35518
|
-
utils$1.extend(instance, context, null, {allOwnKeys: true});
|
|
36563
|
+
utils$1.extend(instance, context, null, { allOwnKeys: true });
|
|
35519
36564
|
|
|
35520
36565
|
// Factory for creating new instances
|
|
35521
36566
|
instance.create = function create(instanceConfig) {
|
|
@@ -35559,7 +36604,7 @@ axios.mergeConfig = mergeConfig$1;
|
|
|
35559
36604
|
|
|
35560
36605
|
axios.AxiosHeaders = AxiosHeaders$1;
|
|
35561
36606
|
|
|
35562
|
-
axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
36607
|
+
axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
35563
36608
|
|
|
35564
36609
|
axios.getAdapter = adapters.getAdapter;
|
|
35565
36610
|
|
|
@@ -35586,7 +36631,7 @@ const {
|
|
|
35586
36631
|
HttpStatusCode,
|
|
35587
36632
|
formToJSON,
|
|
35588
36633
|
getAdapter,
|
|
35589
|
-
mergeConfig
|
|
36634
|
+
mergeConfig,
|
|
35590
36635
|
} = axios;
|
|
35591
36636
|
|
|
35592
36637
|
const prodFunctionsBaseUrl = "https://us-central1-neurosity-device.cloudfunctions.net";
|
|
@@ -35978,7 +37023,7 @@ var hasRequiredBuffer;
|
|
|
35978
37023
|
function requireBuffer () {
|
|
35979
37024
|
if (hasRequiredBuffer) return buffer;
|
|
35980
37025
|
hasRequiredBuffer = 1;
|
|
35981
|
-
(function (exports) {
|
|
37026
|
+
(function (exports$1) {
|
|
35982
37027
|
|
|
35983
37028
|
const base64 = requireBase64Js();
|
|
35984
37029
|
const ieee754 = requireIeee754();
|
|
@@ -35987,12 +37032,12 @@ function requireBuffer () {
|
|
|
35987
37032
|
? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
|
|
35988
37033
|
: null;
|
|
35989
37034
|
|
|
35990
|
-
exports.Buffer = Buffer;
|
|
35991
|
-
exports.SlowBuffer = SlowBuffer;
|
|
35992
|
-
exports.INSPECT_MAX_BYTES = 50;
|
|
37035
|
+
exports$1.Buffer = Buffer;
|
|
37036
|
+
exports$1.SlowBuffer = SlowBuffer;
|
|
37037
|
+
exports$1.INSPECT_MAX_BYTES = 50;
|
|
35993
37038
|
|
|
35994
37039
|
const K_MAX_LENGTH = 0x7fffffff;
|
|
35995
|
-
exports.kMaxLength = K_MAX_LENGTH;
|
|
37040
|
+
exports$1.kMaxLength = K_MAX_LENGTH;
|
|
35996
37041
|
|
|
35997
37042
|
/**
|
|
35998
37043
|
* If `Buffer.TYPED_ARRAY_SUPPORT`:
|
|
@@ -36588,7 +37633,7 @@ function requireBuffer () {
|
|
|
36588
37633
|
|
|
36589
37634
|
Buffer.prototype.inspect = function inspect () {
|
|
36590
37635
|
let str = '';
|
|
36591
|
-
const max = exports.INSPECT_MAX_BYTES;
|
|
37636
|
+
const max = exports$1.INSPECT_MAX_BYTES;
|
|
36592
37637
|
str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();
|
|
36593
37638
|
if (this.length > max) str += ' ... ';
|
|
36594
37639
|
return '<Buffer ' + str + '>'
|
|
@@ -39013,6 +40058,7 @@ class BluetoothClient {
|
|
|
39013
40058
|
this._brainwavesPowerByBand$ =
|
|
39014
40059
|
this._subscribeWhileAuthenticated("powerByBand");
|
|
39015
40060
|
this._signalQuality$ = this._subscribeWhileAuthenticated("signalQuality");
|
|
40061
|
+
this._signalQualityV2$ = this._subscribeWhileAuthenticated("signalQualityV2");
|
|
39016
40062
|
this._status$ = this._subscribeWhileAuthenticated("status");
|
|
39017
40063
|
this._settings$ = this._subscribeWhileAuthenticated("settings");
|
|
39018
40064
|
this._wifiNearbyNetworks$ =
|
|
@@ -39149,6 +40195,9 @@ class BluetoothClient {
|
|
|
39149
40195
|
signalQuality() {
|
|
39150
40196
|
return this._signalQuality$;
|
|
39151
40197
|
}
|
|
40198
|
+
signalQualityV2() {
|
|
40199
|
+
return this._signalQualityV2$;
|
|
40200
|
+
}
|
|
39152
40201
|
async addMarker(label) {
|
|
39153
40202
|
await this.dispatchAction({
|
|
39154
40203
|
action: "marker",
|
|
@@ -39311,20 +40360,20 @@ var hasRequiredRe;
|
|
|
39311
40360
|
function requireRe () {
|
|
39312
40361
|
if (hasRequiredRe) return re.exports;
|
|
39313
40362
|
hasRequiredRe = 1;
|
|
39314
|
-
(function (module, exports) {
|
|
40363
|
+
(function (module, exports$1) {
|
|
39315
40364
|
const {
|
|
39316
40365
|
MAX_SAFE_COMPONENT_LENGTH,
|
|
39317
40366
|
MAX_SAFE_BUILD_LENGTH,
|
|
39318
40367
|
MAX_LENGTH,
|
|
39319
40368
|
} = requireConstants();
|
|
39320
40369
|
const debug = requireDebug();
|
|
39321
|
-
exports = module.exports = {};
|
|
40370
|
+
exports$1 = module.exports = {};
|
|
39322
40371
|
|
|
39323
40372
|
// The actual regexps go on exports.re
|
|
39324
|
-
const re = exports.re = [];
|
|
39325
|
-
const safeRe = exports.safeRe = [];
|
|
39326
|
-
const src = exports.src = [];
|
|
39327
|
-
const t = exports.t = {};
|
|
40373
|
+
const re = exports$1.re = [];
|
|
40374
|
+
const safeRe = exports$1.safeRe = [];
|
|
40375
|
+
const src = exports$1.src = [];
|
|
40376
|
+
const t = exports$1.t = {};
|
|
39328
40377
|
let R = 0;
|
|
39329
40378
|
|
|
39330
40379
|
const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
|
|
@@ -39485,7 +40534,7 @@ function requireRe () {
|
|
|
39485
40534
|
createToken('LONETILDE', '(?:~>?)');
|
|
39486
40535
|
|
|
39487
40536
|
createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
39488
|
-
exports.tildeTrimReplace = '$1~';
|
|
40537
|
+
exports$1.tildeTrimReplace = '$1~';
|
|
39489
40538
|
|
|
39490
40539
|
createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
39491
40540
|
createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
@@ -39495,7 +40544,7 @@ function requireRe () {
|
|
|
39495
40544
|
createToken('LONECARET', '(?:\\^)');
|
|
39496
40545
|
|
|
39497
40546
|
createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
39498
|
-
exports.caretTrimReplace = '$1^';
|
|
40547
|
+
exports$1.caretTrimReplace = '$1^';
|
|
39499
40548
|
|
|
39500
40549
|
createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
39501
40550
|
createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
@@ -39508,7 +40557,7 @@ function requireRe () {
|
|
|
39508
40557
|
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
|
39509
40558
|
createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
|
|
39510
40559
|
}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
39511
|
-
exports.comparatorTrimReplace = '$1$2$3';
|
|
40560
|
+
exports$1.comparatorTrimReplace = '$1$2$3';
|
|
39512
40561
|
|
|
39513
40562
|
// Something like `1.2.3 - 1.2.4`
|
|
39514
40563
|
// Note that these all use the loose form, because they'll be
|
|
@@ -40290,6 +41339,127 @@ class Neurosity {
|
|
|
40290
41339
|
bluetooth: () => this.bluetoothClient.brainwaves(label)
|
|
40291
41340
|
});
|
|
40292
41341
|
}
|
|
41342
|
+
async record(options) {
|
|
41343
|
+
var _a;
|
|
41344
|
+
if (!(await this.cloudClient.didSelectDevice())) {
|
|
41345
|
+
return Promise.reject(mustSelectDevice);
|
|
41346
|
+
}
|
|
41347
|
+
const [hasOAuthError, OAuthError] = validateScopeBasedPermissionForAction(this.cloudClient.userClaims, {
|
|
41348
|
+
command: "brainwaves",
|
|
41349
|
+
action: "record"});
|
|
41350
|
+
if (hasOAuthError) {
|
|
41351
|
+
return Promise.reject(OAuthError);
|
|
41352
|
+
}
|
|
41353
|
+
if (!options.label) {
|
|
41354
|
+
return Promise.reject(new Error(`${prefix}A label is required for record.`));
|
|
41355
|
+
}
|
|
41356
|
+
if (!options.duration || options.duration <= 0) {
|
|
41357
|
+
return Promise.reject(new Error(`${prefix}A positive duration is required for record.`));
|
|
41358
|
+
}
|
|
41359
|
+
const MAX_DURATION = 30 * 60 * 1000;
|
|
41360
|
+
if (options.duration > MAX_DURATION) {
|
|
41361
|
+
return Promise.reject(new Error(`${prefix}Duration ${options.duration}ms exceeds maximum of ${MAX_DURATION}ms (30 minutes).`));
|
|
41362
|
+
}
|
|
41363
|
+
const response = await this.dispatchAction({
|
|
41364
|
+
command: "brainwaves",
|
|
41365
|
+
action: "record",
|
|
41366
|
+
message: {
|
|
41367
|
+
name: options.name || options.label,
|
|
41368
|
+
label: options.label,
|
|
41369
|
+
duration: options.duration,
|
|
41370
|
+
experimentId: options.experimentId || "sdk-recording"
|
|
41371
|
+
},
|
|
41372
|
+
responseRequired: true,
|
|
41373
|
+
responseTimeout: options.duration + 90000
|
|
41374
|
+
});
|
|
41375
|
+
return (_a = response === null || response === void 0 ? void 0 : response.message) !== null && _a !== void 0 ? _a : response;
|
|
41376
|
+
}
|
|
41377
|
+
async startRecording(options) {
|
|
41378
|
+
var _a;
|
|
41379
|
+
if (!(await this.cloudClient.didSelectDevice())) {
|
|
41380
|
+
return Promise.reject(mustSelectDevice);
|
|
41381
|
+
}
|
|
41382
|
+
const [hasOAuthError, OAuthError] = validateScopeBasedPermissionForAction(this.cloudClient.userClaims, {
|
|
41383
|
+
command: "brainwaves",
|
|
41384
|
+
action: "startRecording"});
|
|
41385
|
+
if (hasOAuthError) {
|
|
41386
|
+
return Promise.reject(OAuthError);
|
|
41387
|
+
}
|
|
41388
|
+
if (!options.label) {
|
|
41389
|
+
return Promise.reject(new Error(`${prefix}A label is required for startRecording.`));
|
|
41390
|
+
}
|
|
41391
|
+
if (!options.maxDuration || options.maxDuration <= 0) {
|
|
41392
|
+
return Promise.reject(new Error(`${prefix}A positive maxDuration is required for startRecording.`));
|
|
41393
|
+
}
|
|
41394
|
+
const MAX_DURATION = 30 * 60 * 1000;
|
|
41395
|
+
if (options.maxDuration > MAX_DURATION) {
|
|
41396
|
+
return Promise.reject(new Error(`${prefix}Duration ${options.maxDuration}ms exceeds maximum of ${MAX_DURATION}ms (30 minutes).`));
|
|
41397
|
+
}
|
|
41398
|
+
const response = await this.dispatchAction({
|
|
41399
|
+
command: "brainwaves",
|
|
41400
|
+
action: "startRecording",
|
|
41401
|
+
message: {
|
|
41402
|
+
name: options.name || options.label,
|
|
41403
|
+
label: options.label,
|
|
41404
|
+
maxDuration: options.maxDuration,
|
|
41405
|
+
experimentId: options.experimentId || "sdk-recording"
|
|
41406
|
+
},
|
|
41407
|
+
responseRequired: true,
|
|
41408
|
+
responseTimeout: options.maxDuration + 10000
|
|
41409
|
+
});
|
|
41410
|
+
const startResponse = (_a = response === null || response === void 0 ? void 0 : response.message) !== null && _a !== void 0 ? _a : response;
|
|
41411
|
+
if (!(startResponse === null || startResponse === void 0 ? void 0 : startResponse.ok)) {
|
|
41412
|
+
return Promise.reject(new Error(`${prefix}Failed to start recording: ${(startResponse === null || startResponse === void 0 ? void 0 : startResponse.error) || "unknown error"}`));
|
|
41413
|
+
}
|
|
41414
|
+
const { cancel: cancelAction, complete: completeAction } = startResponse;
|
|
41415
|
+
const startTime = Date.now();
|
|
41416
|
+
let stopped = false;
|
|
41417
|
+
let resolveResult;
|
|
41418
|
+
const resultPromise = new Promise((resolve) => {
|
|
41419
|
+
resolveResult = resolve;
|
|
41420
|
+
});
|
|
41421
|
+
const elapsedSubscribers = new Set();
|
|
41422
|
+
const elapsed$ = new Observable((subscriber) => {
|
|
41423
|
+
elapsedSubscribers.add(subscriber);
|
|
41424
|
+
const timer = setInterval(() => {
|
|
41425
|
+
subscriber.next(Date.now() - startTime);
|
|
41426
|
+
}, 1000);
|
|
41427
|
+
return () => {
|
|
41428
|
+
clearInterval(timer);
|
|
41429
|
+
elapsedSubscribers.delete(subscriber);
|
|
41430
|
+
};
|
|
41431
|
+
});
|
|
41432
|
+
const completeAllElapsed = () => {
|
|
41433
|
+
for (const sub of elapsedSubscribers) {
|
|
41434
|
+
sub.complete();
|
|
41435
|
+
}
|
|
41436
|
+
};
|
|
41437
|
+
const stop = async () => {
|
|
41438
|
+
var _a, _b;
|
|
41439
|
+
if (stopped)
|
|
41440
|
+
return resultPromise;
|
|
41441
|
+
stopped = true;
|
|
41442
|
+
completeAllElapsed();
|
|
41443
|
+
const stopResponse = await this.dispatchAction(completeAction);
|
|
41444
|
+
const result = (_b = (_a = stopResponse === null || stopResponse === void 0 ? void 0 : stopResponse.message) !== null && _a !== void 0 ? _a : stopResponse) !== null && _b !== void 0 ? _b : { ok: true };
|
|
41445
|
+
resolveResult(result);
|
|
41446
|
+
return result;
|
|
41447
|
+
};
|
|
41448
|
+
const cancel = async () => {
|
|
41449
|
+
if (stopped)
|
|
41450
|
+
return;
|
|
41451
|
+
stopped = true;
|
|
41452
|
+
completeAllElapsed();
|
|
41453
|
+
await this.dispatchAction(cancelAction);
|
|
41454
|
+
resolveResult({ ok: false, error: "cancelled" });
|
|
41455
|
+
};
|
|
41456
|
+
return {
|
|
41457
|
+
elapsed$,
|
|
41458
|
+
stop,
|
|
41459
|
+
cancel,
|
|
41460
|
+
result: resultPromise
|
|
41461
|
+
};
|
|
41462
|
+
}
|
|
40293
41463
|
calm() {
|
|
40294
41464
|
const [hasOAuthError, OAuthError] = validateScopeBasedPermissionForFunctionName(this.cloudClient.userClaims, "calm");
|
|
40295
41465
|
if (hasOAuthError) {
|
|
@@ -40319,6 +41489,21 @@ class Neurosity {
|
|
|
40319
41489
|
bluetooth: () => this.bluetoothClient.signalQuality()
|
|
40320
41490
|
});
|
|
40321
41491
|
}
|
|
41492
|
+
signalQualityV2() {
|
|
41493
|
+
const metric = "signalQualityV2";
|
|
41494
|
+
const [hasOAuthError, OAuthError] = validateScopeBasedPermissionForFunctionName(this.cloudClient.userClaims, "signalQuality");
|
|
41495
|
+
if (hasOAuthError) {
|
|
41496
|
+
return throwError(() => OAuthError);
|
|
41497
|
+
}
|
|
41498
|
+
return this._withStreamingModeObservable({
|
|
41499
|
+
wifi: () => getCloudMetric(this._getCloudMetricDependencies(), {
|
|
41500
|
+
metric,
|
|
41501
|
+
labels: getLabels(metric),
|
|
41502
|
+
atomic: true
|
|
41503
|
+
}),
|
|
41504
|
+
bluetooth: () => this.bluetoothClient.signalQualityV2()
|
|
41505
|
+
});
|
|
41506
|
+
}
|
|
40322
41507
|
settings() {
|
|
40323
41508
|
const [hasOAuthError, OAuthError] = validateScopeBasedPermissionForFunctionName(this.cloudClient.userClaims, "settings");
|
|
40324
41509
|
if (hasOAuthError) {
|