typesense-instantsearch-adapter 3.0.0 → 3.0.2
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/typesense-instantsearch-adapter.js +1675 -1065
- package/dist/typesense-instantsearch-adapter.js.map +1 -1
- package/dist/typesense-instantsearch-adapter.min.js +1 -1
- package/dist/typesense-instantsearch-adapter.min.js.LICENSE.txt +1 -1
- package/dist/typesense-instantsearch-adapter.min.js.map +1 -1
- package/lib/SearchRequestAdapter.js +5 -1
- package/lib/SearchRequestAdapter.js.map +1 -1
- package/package.json +3 -2
- package/src/SearchRequestAdapter.js +5 -1
|
@@ -865,7 +865,11 @@ var SearchRequestAdapter = /*#__PURE__*/function () {
|
|
|
865
865
|
}; // Add union parameter if configured
|
|
866
866
|
if (this.configuration.union) {
|
|
867
867
|
searchRequest.union = this.configuration.union;
|
|
868
|
-
|
|
868
|
+
["page", "per_page", "offset", "limit", "limit_hits"].forEach(function (paramName) {
|
|
869
|
+
if (searches[0][paramName] != null) {
|
|
870
|
+
commonParams[paramName] = searches[0][paramName];
|
|
871
|
+
}
|
|
872
|
+
});
|
|
869
873
|
}
|
|
870
874
|
return _context.abrupt("return", this.typesenseClient.multiSearch.perform(searchRequest, commonParams));
|
|
871
875
|
case 6:
|
|
@@ -1356,6 +1360,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
|
|
|
1356
1360
|
"error"
|
|
1357
1361
|
];
|
|
1358
1362
|
|
|
1363
|
+
var _loggersByName = {};
|
|
1364
|
+
var defaultLogger = null;
|
|
1365
|
+
|
|
1359
1366
|
// Cross-browser bind equivalent that works at least back to IE6
|
|
1360
1367
|
function bindMethod(obj, methodName) {
|
|
1361
1368
|
var method = obj[methodName];
|
|
@@ -1408,25 +1415,33 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
|
|
|
1408
1415
|
|
|
1409
1416
|
// These private functions always need `this` to be set properly
|
|
1410
1417
|
|
|
1411
|
-
function replaceLoggingMethods(
|
|
1418
|
+
function replaceLoggingMethods() {
|
|
1412
1419
|
/*jshint validthis:true */
|
|
1420
|
+
var level = this.getLevel();
|
|
1421
|
+
|
|
1422
|
+
// Replace the actual methods.
|
|
1413
1423
|
for (var i = 0; i < logMethods.length; i++) {
|
|
1414
1424
|
var methodName = logMethods[i];
|
|
1415
1425
|
this[methodName] = (i < level) ?
|
|
1416
1426
|
noop :
|
|
1417
|
-
this.methodFactory(methodName, level,
|
|
1427
|
+
this.methodFactory(methodName, level, this.name);
|
|
1418
1428
|
}
|
|
1419
1429
|
|
|
1420
1430
|
// Define log.log as an alias for log.debug
|
|
1421
1431
|
this.log = this.debug;
|
|
1432
|
+
|
|
1433
|
+
// Return any important warnings.
|
|
1434
|
+
if (typeof console === undefinedType && level < this.levels.SILENT) {
|
|
1435
|
+
return "No console available for logging";
|
|
1436
|
+
}
|
|
1422
1437
|
}
|
|
1423
1438
|
|
|
1424
1439
|
// In old IE versions, the console isn't present until you first open it.
|
|
1425
1440
|
// We build realMethod() replacements here that regenerate logging methods
|
|
1426
|
-
function enableLoggingWhenConsoleArrives(methodName
|
|
1441
|
+
function enableLoggingWhenConsoleArrives(methodName) {
|
|
1427
1442
|
return function () {
|
|
1428
1443
|
if (typeof console !== undefinedType) {
|
|
1429
|
-
replaceLoggingMethods.call(this
|
|
1444
|
+
replaceLoggingMethods.call(this);
|
|
1430
1445
|
this[methodName].apply(this, arguments);
|
|
1431
1446
|
}
|
|
1432
1447
|
};
|
|
@@ -1434,16 +1449,36 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
|
|
|
1434
1449
|
|
|
1435
1450
|
// By default, we use closely bound real methods wherever possible, and
|
|
1436
1451
|
// otherwise we wait for a console to appear, and then try again.
|
|
1437
|
-
function defaultMethodFactory(methodName,
|
|
1452
|
+
function defaultMethodFactory(methodName, _level, _loggerName) {
|
|
1438
1453
|
/*jshint validthis:true */
|
|
1439
1454
|
return realMethod(methodName) ||
|
|
1440
1455
|
enableLoggingWhenConsoleArrives.apply(this, arguments);
|
|
1441
1456
|
}
|
|
1442
1457
|
|
|
1443
|
-
function Logger(name,
|
|
1458
|
+
function Logger(name, factory) {
|
|
1459
|
+
// Private instance variables.
|
|
1444
1460
|
var self = this;
|
|
1445
|
-
|
|
1446
|
-
|
|
1461
|
+
/**
|
|
1462
|
+
* The level inherited from a parent logger (or a global default). We
|
|
1463
|
+
* cache this here rather than delegating to the parent so that it stays
|
|
1464
|
+
* in sync with the actual logging methods that we have installed (the
|
|
1465
|
+
* parent could change levels but we might not have rebuilt the loggers
|
|
1466
|
+
* in this child yet).
|
|
1467
|
+
* @type {number}
|
|
1468
|
+
*/
|
|
1469
|
+
var inheritedLevel;
|
|
1470
|
+
/**
|
|
1471
|
+
* The default level for this logger, if any. If set, this overrides
|
|
1472
|
+
* `inheritedLevel`.
|
|
1473
|
+
* @type {number|null}
|
|
1474
|
+
*/
|
|
1475
|
+
var defaultLevel;
|
|
1476
|
+
/**
|
|
1477
|
+
* A user-specific level for this logger. If set, this overrides
|
|
1478
|
+
* `defaultLevel`.
|
|
1479
|
+
* @type {number|null}
|
|
1480
|
+
*/
|
|
1481
|
+
var userLevel;
|
|
1447
1482
|
|
|
1448
1483
|
var storageKey = "loglevel";
|
|
1449
1484
|
if (typeof name === "string") {
|
|
@@ -1483,10 +1518,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
|
|
|
1483
1518
|
if (typeof storedLevel === undefinedType) {
|
|
1484
1519
|
try {
|
|
1485
1520
|
var cookie = window.document.cookie;
|
|
1486
|
-
var
|
|
1487
|
-
|
|
1521
|
+
var cookieName = encodeURIComponent(storageKey);
|
|
1522
|
+
var location = cookie.indexOf(cookieName + "=");
|
|
1488
1523
|
if (location !== -1) {
|
|
1489
|
-
storedLevel = /^([^;]+)/.exec(
|
|
1524
|
+
storedLevel = /^([^;]+)/.exec(
|
|
1525
|
+
cookie.slice(location + cookieName.length + 1)
|
|
1526
|
+
)[1];
|
|
1490
1527
|
}
|
|
1491
1528
|
} catch (ignore) {}
|
|
1492
1529
|
}
|
|
@@ -1505,7 +1542,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
|
|
|
1505
1542
|
// Use localStorage if available
|
|
1506
1543
|
try {
|
|
1507
1544
|
window.localStorage.removeItem(storageKey);
|
|
1508
|
-
return;
|
|
1509
1545
|
} catch (ignore) {}
|
|
1510
1546
|
|
|
1511
1547
|
// Use session cookie as fallback
|
|
@@ -1515,6 +1551,18 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
|
|
|
1515
1551
|
} catch (ignore) {}
|
|
1516
1552
|
}
|
|
1517
1553
|
|
|
1554
|
+
function normalizeLevel(input) {
|
|
1555
|
+
var level = input;
|
|
1556
|
+
if (typeof level === "string" && self.levels[level.toUpperCase()] !== undefined) {
|
|
1557
|
+
level = self.levels[level.toUpperCase()];
|
|
1558
|
+
}
|
|
1559
|
+
if (typeof level === "number" && level >= 0 && level <= self.levels.SILENT) {
|
|
1560
|
+
return level;
|
|
1561
|
+
} else {
|
|
1562
|
+
throw new TypeError("log.setLevel() called with invalid level: " + input);
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1518
1566
|
/*
|
|
1519
1567
|
*
|
|
1520
1568
|
* Public logger API - see https://github.com/pimterry/loglevel for details
|
|
@@ -1529,37 +1577,36 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
|
|
|
1529
1577
|
self.methodFactory = factory || defaultMethodFactory;
|
|
1530
1578
|
|
|
1531
1579
|
self.getLevel = function () {
|
|
1532
|
-
|
|
1580
|
+
if (userLevel != null) {
|
|
1581
|
+
return userLevel;
|
|
1582
|
+
} else if (defaultLevel != null) {
|
|
1583
|
+
return defaultLevel;
|
|
1584
|
+
} else {
|
|
1585
|
+
return inheritedLevel;
|
|
1586
|
+
}
|
|
1533
1587
|
};
|
|
1534
1588
|
|
|
1535
1589
|
self.setLevel = function (level, persist) {
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
if (typeof level === "number" && level >= 0 && level <= self.levels.SILENT) {
|
|
1540
|
-
currentLevel = level;
|
|
1541
|
-
if (persist !== false) { // defaults to true
|
|
1542
|
-
persistLevelIfPossible(level);
|
|
1543
|
-
}
|
|
1544
|
-
replaceLoggingMethods.call(self, level, name);
|
|
1545
|
-
if (typeof console === undefinedType && level < self.levels.SILENT) {
|
|
1546
|
-
return "No console available for logging";
|
|
1547
|
-
}
|
|
1548
|
-
} else {
|
|
1549
|
-
throw "log.setLevel() called with invalid level: " + level;
|
|
1590
|
+
userLevel = normalizeLevel(level);
|
|
1591
|
+
if (persist !== false) { // defaults to true
|
|
1592
|
+
persistLevelIfPossible(userLevel);
|
|
1550
1593
|
}
|
|
1594
|
+
|
|
1595
|
+
// NOTE: in v2, this should call rebuild(), which updates children.
|
|
1596
|
+
return replaceLoggingMethods.call(self);
|
|
1551
1597
|
};
|
|
1552
1598
|
|
|
1553
1599
|
self.setDefaultLevel = function (level) {
|
|
1554
|
-
defaultLevel = level;
|
|
1600
|
+
defaultLevel = normalizeLevel(level);
|
|
1555
1601
|
if (!getPersistedLevel()) {
|
|
1556
1602
|
self.setLevel(level, false);
|
|
1557
1603
|
}
|
|
1558
1604
|
};
|
|
1559
1605
|
|
|
1560
1606
|
self.resetLevel = function () {
|
|
1561
|
-
|
|
1607
|
+
userLevel = null;
|
|
1562
1608
|
clearPersistedLevel();
|
|
1609
|
+
replaceLoggingMethods.call(self);
|
|
1563
1610
|
};
|
|
1564
1611
|
|
|
1565
1612
|
self.enableAll = function(persist) {
|
|
@@ -1570,12 +1617,28 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
|
|
|
1570
1617
|
self.setLevel(self.levels.SILENT, persist);
|
|
1571
1618
|
};
|
|
1572
1619
|
|
|
1573
|
-
|
|
1620
|
+
self.rebuild = function () {
|
|
1621
|
+
if (defaultLogger !== self) {
|
|
1622
|
+
inheritedLevel = normalizeLevel(defaultLogger.getLevel());
|
|
1623
|
+
}
|
|
1624
|
+
replaceLoggingMethods.call(self);
|
|
1625
|
+
|
|
1626
|
+
if (defaultLogger === self) {
|
|
1627
|
+
for (var childName in _loggersByName) {
|
|
1628
|
+
_loggersByName[childName].rebuild();
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
};
|
|
1632
|
+
|
|
1633
|
+
// Initialize all the internal levels.
|
|
1634
|
+
inheritedLevel = normalizeLevel(
|
|
1635
|
+
defaultLogger ? defaultLogger.getLevel() : "WARN"
|
|
1636
|
+
);
|
|
1574
1637
|
var initialLevel = getPersistedLevel();
|
|
1575
|
-
if (initialLevel
|
|
1576
|
-
|
|
1638
|
+
if (initialLevel != null) {
|
|
1639
|
+
userLevel = normalizeLevel(initialLevel);
|
|
1577
1640
|
}
|
|
1578
|
-
|
|
1641
|
+
replaceLoggingMethods.call(self);
|
|
1579
1642
|
}
|
|
1580
1643
|
|
|
1581
1644
|
/*
|
|
@@ -1584,18 +1647,19 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
|
|
|
1584
1647
|
*
|
|
1585
1648
|
*/
|
|
1586
1649
|
|
|
1587
|
-
|
|
1650
|
+
defaultLogger = new Logger();
|
|
1588
1651
|
|
|
1589
|
-
var _loggersByName = {};
|
|
1590
1652
|
defaultLogger.getLogger = function getLogger(name) {
|
|
1591
1653
|
if ((typeof name !== "symbol" && typeof name !== "string") || name === "") {
|
|
1592
|
-
|
|
1654
|
+
throw new TypeError("You must supply a name when creating a logger.");
|
|
1593
1655
|
}
|
|
1594
1656
|
|
|
1595
1657
|
var logger = _loggersByName[name];
|
|
1596
1658
|
if (!logger) {
|
|
1597
|
-
|
|
1598
|
-
|
|
1659
|
+
logger = _loggersByName[name] = new Logger(
|
|
1660
|
+
name,
|
|
1661
|
+
defaultLogger.methodFactory
|
|
1662
|
+
);
|
|
1599
1663
|
}
|
|
1600
1664
|
return logger;
|
|
1601
1665
|
};
|
|
@@ -2120,10 +2184,10 @@ var ApiCall = /** @class */ (function () {
|
|
|
2120
2184
|
this.initializeMetadataForNodes();
|
|
2121
2185
|
this.currentNodeIndex = -1;
|
|
2122
2186
|
}
|
|
2123
|
-
ApiCall.prototype.get = function (
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2187
|
+
ApiCall.prototype.get = function (endpoint_1) {
|
|
2188
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (endpoint, queryParameters, _a) {
|
|
2189
|
+
if (queryParameters === void 0) { queryParameters = {}; }
|
|
2190
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.abortSignal, abortSignal = _c === void 0 ? null : _c, _d = _b.responseType, responseType = _d === void 0 ? undefined : _d, _e = _b.streamConfig, streamConfig = _e === void 0 ? undefined : _e, isStreamingRequest = _b.isStreamingRequest;
|
|
2127
2191
|
return tslib_1.__generator(this, function (_f) {
|
|
2128
2192
|
return [2 /*return*/, this.performRequest("get", endpoint, {
|
|
2129
2193
|
queryParameters: queryParameters,
|
|
@@ -2135,9 +2199,9 @@ var ApiCall = /** @class */ (function () {
|
|
|
2135
2199
|
});
|
|
2136
2200
|
});
|
|
2137
2201
|
};
|
|
2138
|
-
ApiCall.prototype.delete = function (
|
|
2139
|
-
|
|
2140
|
-
|
|
2202
|
+
ApiCall.prototype.delete = function (endpoint_1) {
|
|
2203
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (endpoint, queryParameters) {
|
|
2204
|
+
if (queryParameters === void 0) { queryParameters = {}; }
|
|
2141
2205
|
return tslib_1.__generator(this, function (_a) {
|
|
2142
2206
|
return [2 /*return*/, this.performRequest("delete", endpoint, {
|
|
2143
2207
|
queryParameters: queryParameters,
|
|
@@ -2146,12 +2210,12 @@ var ApiCall = /** @class */ (function () {
|
|
|
2146
2210
|
});
|
|
2147
2211
|
});
|
|
2148
2212
|
};
|
|
2149
|
-
ApiCall.prototype.post = function (
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2213
|
+
ApiCall.prototype.post = function (endpoint_1) {
|
|
2214
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (endpoint, bodyParameters, queryParameters, additionalHeaders, _a) {
|
|
2215
|
+
if (bodyParameters === void 0) { bodyParameters = {}; }
|
|
2216
|
+
if (queryParameters === void 0) { queryParameters = {}; }
|
|
2217
|
+
if (additionalHeaders === void 0) { additionalHeaders = {}; }
|
|
2218
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.abortSignal, abortSignal = _c === void 0 ? null : _c, _d = _b.responseType, responseType = _d === void 0 ? undefined : _d, _e = _b.streamConfig, streamConfig = _e === void 0 ? undefined : _e, isStreamingRequest = _b.isStreamingRequest;
|
|
2155
2219
|
return tslib_1.__generator(this, function (_f) {
|
|
2156
2220
|
return [2 /*return*/, this.performRequest("post", endpoint, {
|
|
2157
2221
|
queryParameters: queryParameters,
|
|
@@ -2165,10 +2229,10 @@ var ApiCall = /** @class */ (function () {
|
|
|
2165
2229
|
});
|
|
2166
2230
|
});
|
|
2167
2231
|
};
|
|
2168
|
-
ApiCall.prototype.put = function (
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2232
|
+
ApiCall.prototype.put = function (endpoint_1) {
|
|
2233
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (endpoint, bodyParameters, queryParameters) {
|
|
2234
|
+
if (bodyParameters === void 0) { bodyParameters = {}; }
|
|
2235
|
+
if (queryParameters === void 0) { queryParameters = {}; }
|
|
2172
2236
|
return tslib_1.__generator(this, function (_a) {
|
|
2173
2237
|
return [2 /*return*/, this.performRequest("put", endpoint, {
|
|
2174
2238
|
queryParameters: queryParameters,
|
|
@@ -2178,10 +2242,10 @@ var ApiCall = /** @class */ (function () {
|
|
|
2178
2242
|
});
|
|
2179
2243
|
});
|
|
2180
2244
|
};
|
|
2181
|
-
ApiCall.prototype.patch = function (
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2245
|
+
ApiCall.prototype.patch = function (endpoint_1) {
|
|
2246
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (endpoint, bodyParameters, queryParameters) {
|
|
2247
|
+
if (bodyParameters === void 0) { bodyParameters = {}; }
|
|
2248
|
+
if (queryParameters === void 0) { queryParameters = {}; }
|
|
2185
2249
|
return tslib_1.__generator(this, function (_a) {
|
|
2186
2250
|
return [2 /*return*/, this.performRequest("patch", endpoint, {
|
|
2187
2251
|
queryParameters: queryParameters,
|
|
@@ -2202,13 +2266,13 @@ var ApiCall = /** @class */ (function () {
|
|
|
2202
2266
|
? axios_1.default.getAdapter(this.configuration.axiosAdapter).bind(globalThis)
|
|
2203
2267
|
: axios_1.default.getAdapter(this.configuration.axiosAdapter);
|
|
2204
2268
|
};
|
|
2205
|
-
ApiCall.prototype.performRequest = function (
|
|
2206
|
-
|
|
2207
|
-
var _f = _a.queryParameters, queryParameters = _f === void 0 ? null : _f, _g = _a.bodyParameters, bodyParameters = _g === void 0 ? null : _g, _h = _a.additionalHeaders, additionalHeaders = _h === void 0 ? {} : _h, _j = _a.abortSignal, abortSignal = _j === void 0 ? null : _j, _k = _a.responseType, responseType = _k === void 0 ? undefined : _k, _l = _a.skipConnectionTimeout, skipConnectionTimeout = _l === void 0 ? false : _l, _m = _a.enableKeepAlive, enableKeepAlive = _m === void 0 ? undefined : _m, _o = _a.streamConfig, streamConfig = _o === void 0 ? undefined : _o, isStreamingRequest = _a.isStreamingRequest;
|
|
2208
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2269
|
+
ApiCall.prototype.performRequest = function (requestType_1, endpoint_1, _a) {
|
|
2270
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (requestType, endpoint, _b) {
|
|
2209
2271
|
var requestNumber, lastException, wasAborted, _loop_1, this_1, numTries, state_1;
|
|
2210
|
-
|
|
2211
|
-
|
|
2272
|
+
var _c, _d, _e, _f;
|
|
2273
|
+
var _g = _b.queryParameters, queryParameters = _g === void 0 ? null : _g, _h = _b.bodyParameters, bodyParameters = _h === void 0 ? null : _h, _j = _b.additionalHeaders, additionalHeaders = _j === void 0 ? {} : _j, _k = _b.abortSignal, abortSignal = _k === void 0 ? null : _k, _l = _b.responseType, responseType = _l === void 0 ? undefined : _l, _m = _b.skipConnectionTimeout, skipConnectionTimeout = _m === void 0 ? false : _m, _o = _b.enableKeepAlive, enableKeepAlive = _o === void 0 ? undefined : _o, _p = _b.streamConfig, streamConfig = _p === void 0 ? undefined : _p, isStreamingRequest = _b.isStreamingRequest;
|
|
2274
|
+
return tslib_1.__generator(this, function (_q) {
|
|
2275
|
+
switch (_q.label) {
|
|
2212
2276
|
case 0:
|
|
2213
2277
|
this.configuration.validate();
|
|
2214
2278
|
if (isStreamingRequest) {
|
|
@@ -2224,8 +2288,8 @@ var ApiCall = /** @class */ (function () {
|
|
|
2224
2288
|
this.logger.debug("Request #".concat(requestNumber, ": Performing ").concat(requestType.toUpperCase(), " request: ").concat(endpoint));
|
|
2225
2289
|
_loop_1 = function (numTries) {
|
|
2226
2290
|
var node, abortListener, requestOptions, cancelToken, source_1, response, error_1;
|
|
2227
|
-
return tslib_1.__generator(this, function (
|
|
2228
|
-
switch (
|
|
2291
|
+
return tslib_1.__generator(this, function (_r) {
|
|
2292
|
+
switch (_r.label) {
|
|
2229
2293
|
case 0:
|
|
2230
2294
|
node = this_1.getNextNode(requestNumber);
|
|
2231
2295
|
this_1.logger.debug("Request #".concat(requestNumber, ": Attempting ").concat(requestType.toUpperCase(), " request Try #").concat(numTries, " to Node ").concat(node.index));
|
|
@@ -2233,9 +2297,9 @@ var ApiCall = /** @class */ (function () {
|
|
|
2233
2297
|
return [2 /*return*/, { value: Promise.reject(new Error("Request aborted by caller.")) }];
|
|
2234
2298
|
}
|
|
2235
2299
|
abortListener = void 0;
|
|
2236
|
-
|
|
2300
|
+
_r.label = 1;
|
|
2237
2301
|
case 1:
|
|
2238
|
-
|
|
2302
|
+
_r.trys.push([1, 3, 5, 6]);
|
|
2239
2303
|
requestOptions = {
|
|
2240
2304
|
method: requestType,
|
|
2241
2305
|
url: this_1.uriFor(endpoint, node),
|
|
@@ -2336,7 +2400,7 @@ var ApiCall = /** @class */ (function () {
|
|
|
2336
2400
|
}
|
|
2337
2401
|
return [4 /*yield*/, (0, axios_1.default)(requestOptions)];
|
|
2338
2402
|
case 2:
|
|
2339
|
-
response =
|
|
2403
|
+
response = _r.sent();
|
|
2340
2404
|
if (response.status >= 1 && response.status <= 499) {
|
|
2341
2405
|
// Treat any status code > 0 and < 500 to be an indication that node is healthy
|
|
2342
2406
|
// We exclude 0 since some clients return 0 when request fails
|
|
@@ -2350,24 +2414,24 @@ var ApiCall = /** @class */ (function () {
|
|
|
2350
2414
|
return [2 /*return*/, { value: Promise.resolve(response.data) }];
|
|
2351
2415
|
}
|
|
2352
2416
|
else if (response.status < 500) {
|
|
2353
|
-
return [2 /*return*/, { value: Promise.reject(this_1.customErrorForResponse(response, (
|
|
2417
|
+
return [2 /*return*/, { value: Promise.reject(this_1.customErrorForResponse(response, (_c = response.data) === null || _c === void 0 ? void 0 : _c.message, requestOptions.data)) }];
|
|
2354
2418
|
}
|
|
2355
2419
|
else {
|
|
2356
2420
|
// Retry all other HTTP errors (HTTPStatus > 500)
|
|
2357
2421
|
// This will get caught by the catch block below
|
|
2358
|
-
throw this_1.customErrorForResponse(response, (
|
|
2422
|
+
throw this_1.customErrorForResponse(response, (_d = response.data) === null || _d === void 0 ? void 0 : _d.message, requestOptions.data);
|
|
2359
2423
|
}
|
|
2360
2424
|
return [3 /*break*/, 6];
|
|
2361
2425
|
case 3:
|
|
2362
|
-
error_1 =
|
|
2426
|
+
error_1 = _r.sent();
|
|
2363
2427
|
// This block handles retries for HTTPStatus > 500 and network layer issues like connection timeouts
|
|
2364
2428
|
if (!wasAborted) {
|
|
2365
2429
|
this_1.setNodeHealthcheck(node, UNHEALTHY);
|
|
2366
2430
|
}
|
|
2367
2431
|
lastException = error_1;
|
|
2368
|
-
this_1.logger.warn("Request #".concat(requestNumber, ": Request to Node ").concat(node.index, " failed due to \"").concat((
|
|
2432
|
+
this_1.logger.warn("Request #".concat(requestNumber, ": Request to Node ").concat(node.index, " failed due to \"").concat((_e = error_1 === null || error_1 === void 0 ? void 0 : error_1.code) !== null && _e !== void 0 ? _e : "", " ").concat(error_1.message).concat(error_1.response == null
|
|
2369
2433
|
? ""
|
|
2370
|
-
: " - " + JSON.stringify((
|
|
2434
|
+
: " - " + JSON.stringify((_f = error_1.response) === null || _f === void 0 ? void 0 : _f.data), "\""));
|
|
2371
2435
|
if (wasAborted) {
|
|
2372
2436
|
return [2 /*return*/, { value: Promise.reject(new Error("Request aborted by caller.")) }];
|
|
2373
2437
|
}
|
|
@@ -2383,7 +2447,7 @@ var ApiCall = /** @class */ (function () {
|
|
|
2383
2447
|
}
|
|
2384
2448
|
return [4 /*yield*/, this_1.timer(this_1.retryIntervalSeconds)];
|
|
2385
2449
|
case 4:
|
|
2386
|
-
|
|
2450
|
+
_r.sent();
|
|
2387
2451
|
return [3 /*break*/, 6];
|
|
2388
2452
|
case 5:
|
|
2389
2453
|
if (abortSignal && abortListener) {
|
|
@@ -2396,15 +2460,15 @@ var ApiCall = /** @class */ (function () {
|
|
|
2396
2460
|
};
|
|
2397
2461
|
this_1 = this;
|
|
2398
2462
|
numTries = 1;
|
|
2399
|
-
|
|
2463
|
+
_q.label = 1;
|
|
2400
2464
|
case 1:
|
|
2401
2465
|
if (!(numTries <= this.numRetriesPerRequest + 1)) return [3 /*break*/, 4];
|
|
2402
2466
|
return [5 /*yield**/, _loop_1(numTries)];
|
|
2403
2467
|
case 2:
|
|
2404
|
-
state_1 =
|
|
2468
|
+
state_1 = _q.sent();
|
|
2405
2469
|
if (typeof state_1 === "object")
|
|
2406
2470
|
return [2 /*return*/, state_1.value];
|
|
2407
|
-
|
|
2471
|
+
_q.label = 3;
|
|
2408
2472
|
case 3:
|
|
2409
2473
|
numTries++;
|
|
2410
2474
|
return [3 /*break*/, 1];
|
|
@@ -2441,7 +2505,7 @@ var ApiCall = /** @class */ (function () {
|
|
|
2441
2505
|
message: JSON.stringify(jsonData),
|
|
2442
2506
|
};
|
|
2443
2507
|
}
|
|
2444
|
-
catch (
|
|
2508
|
+
catch (_a) {
|
|
2445
2509
|
return {
|
|
2446
2510
|
conversation_id: "unknown",
|
|
2447
2511
|
message: line.trim(),
|
|
@@ -2475,7 +2539,7 @@ var ApiCall = /** @class */ (function () {
|
|
|
2475
2539
|
message: JSON.stringify(jsonData),
|
|
2476
2540
|
};
|
|
2477
2541
|
}
|
|
2478
|
-
catch (
|
|
2542
|
+
catch (_a) {
|
|
2479
2543
|
// Not valid JSON, use as plain text
|
|
2480
2544
|
return {
|
|
2481
2545
|
conversation_id: "unknown",
|
|
@@ -3088,9 +3152,9 @@ var Collection = /** @class */ (function () {
|
|
|
3088
3152
|
});
|
|
3089
3153
|
});
|
|
3090
3154
|
};
|
|
3091
|
-
Collection.prototype.delete = function (
|
|
3092
|
-
|
|
3093
|
-
|
|
3155
|
+
Collection.prototype.delete = function () {
|
|
3156
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (options) {
|
|
3157
|
+
if (options === void 0) { options = {}; }
|
|
3094
3158
|
return tslib_1.__generator(this, function (_a) {
|
|
3095
3159
|
return [2 /*return*/, this.apiCall.delete(this.endpointPath(), options)];
|
|
3096
3160
|
});
|
|
@@ -3182,9 +3246,9 @@ var Collections = /** @class */ (function () {
|
|
|
3182
3246
|
});
|
|
3183
3247
|
});
|
|
3184
3248
|
};
|
|
3185
|
-
Collections.prototype.retrieve = function (
|
|
3186
|
-
|
|
3187
|
-
|
|
3249
|
+
Collections.prototype.retrieve = function () {
|
|
3250
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (options) {
|
|
3251
|
+
if (options === void 0) { options = {}; }
|
|
3188
3252
|
return tslib_1.__generator(this, function (_a) {
|
|
3189
3253
|
return [2 /*return*/, this.apiCall.get(RESOURCEPATH, options)];
|
|
3190
3254
|
});
|
|
@@ -3754,9 +3818,9 @@ var Document = /** @class */ (function () {
|
|
|
3754
3818
|
});
|
|
3755
3819
|
});
|
|
3756
3820
|
};
|
|
3757
|
-
Document.prototype.update = function (
|
|
3758
|
-
|
|
3759
|
-
|
|
3821
|
+
Document.prototype.update = function (partialDocument_1) {
|
|
3822
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (partialDocument, options) {
|
|
3823
|
+
if (options === void 0) { options = {}; }
|
|
3760
3824
|
return tslib_1.__generator(this, function (_a) {
|
|
3761
3825
|
return [2 /*return*/, this.apiCall.patch(this.endpointPath(), partialDocument, options)];
|
|
3762
3826
|
});
|
|
@@ -3792,9 +3856,9 @@ var Documents = /** @class */ (function (_super) {
|
|
|
3792
3856
|
function Documents(collectionName, apiCall, configuration) {
|
|
3793
3857
|
return _super.call(this, collectionName, apiCall, configuration) || this;
|
|
3794
3858
|
}
|
|
3795
|
-
Documents.prototype.create = function (
|
|
3796
|
-
|
|
3797
|
-
|
|
3859
|
+
Documents.prototype.create = function (document_1) {
|
|
3860
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (document, options) {
|
|
3861
|
+
if (options === void 0) { options = {}; }
|
|
3798
3862
|
return tslib_1.__generator(this, function (_a) {
|
|
3799
3863
|
if (!document)
|
|
3800
3864
|
throw new Error("No document provided");
|
|
@@ -3802,9 +3866,9 @@ var Documents = /** @class */ (function (_super) {
|
|
|
3802
3866
|
});
|
|
3803
3867
|
});
|
|
3804
3868
|
};
|
|
3805
|
-
Documents.prototype.upsert = function (
|
|
3806
|
-
|
|
3807
|
-
|
|
3869
|
+
Documents.prototype.upsert = function (document_1) {
|
|
3870
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (document, options) {
|
|
3871
|
+
if (options === void 0) { options = {}; }
|
|
3808
3872
|
return tslib_1.__generator(this, function (_a) {
|
|
3809
3873
|
if (!document)
|
|
3810
3874
|
throw new Error("No document provided");
|
|
@@ -3812,9 +3876,9 @@ var Documents = /** @class */ (function (_super) {
|
|
|
3812
3876
|
});
|
|
3813
3877
|
});
|
|
3814
3878
|
};
|
|
3815
|
-
Documents.prototype.update = function (
|
|
3816
|
-
|
|
3817
|
-
|
|
3879
|
+
Documents.prototype.update = function (document_1) {
|
|
3880
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (document, options) {
|
|
3881
|
+
if (options === void 0) { options = {}; }
|
|
3818
3882
|
return tslib_1.__generator(this, function (_a) {
|
|
3819
3883
|
if (!document)
|
|
3820
3884
|
throw new Error("No document provided");
|
|
@@ -3828,27 +3892,27 @@ var Documents = /** @class */ (function (_super) {
|
|
|
3828
3892
|
});
|
|
3829
3893
|
});
|
|
3830
3894
|
};
|
|
3831
|
-
Documents.prototype.delete = function (
|
|
3832
|
-
|
|
3833
|
-
|
|
3895
|
+
Documents.prototype.delete = function () {
|
|
3896
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (query) {
|
|
3897
|
+
if (query === void 0) { query = {}; }
|
|
3834
3898
|
return tslib_1.__generator(this, function (_a) {
|
|
3835
3899
|
return [2 /*return*/, this.apiCall.delete(this.endpointPath(), query)];
|
|
3836
3900
|
});
|
|
3837
3901
|
});
|
|
3838
3902
|
};
|
|
3839
|
-
Documents.prototype.createMany = function (
|
|
3840
|
-
|
|
3841
|
-
|
|
3903
|
+
Documents.prototype.createMany = function (documents_1) {
|
|
3904
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (documents, options) {
|
|
3905
|
+
if (options === void 0) { options = {}; }
|
|
3842
3906
|
return tslib_1.__generator(this, function (_a) {
|
|
3843
3907
|
this.configuration.logger.warn("createMany is deprecated and will be removed in a future version. Use import instead, which now takes both an array of documents or a JSONL string of documents");
|
|
3844
3908
|
return [2 /*return*/, this.import(documents, options)];
|
|
3845
3909
|
});
|
|
3846
3910
|
});
|
|
3847
3911
|
};
|
|
3848
|
-
Documents.prototype.import = function (
|
|
3849
|
-
|
|
3850
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
3912
|
+
Documents.prototype.import = function (documents_1) {
|
|
3913
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (documents, options) {
|
|
3851
3914
|
var finalOptions, documentsInJSONLFormat, resultsInJSONLFormat, resultsInJSONFormat, failedItems;
|
|
3915
|
+
if (options === void 0) { options = {}; }
|
|
3852
3916
|
return tslib_1.__generator(this, function (_a) {
|
|
3853
3917
|
switch (_a.label) {
|
|
3854
3918
|
case 0:
|
|
@@ -3915,10 +3979,10 @@ var Documents = /** @class */ (function (_super) {
|
|
|
3915
3979
|
/**
|
|
3916
3980
|
* Imports documents from a NodeJS readable stream of JSONL.
|
|
3917
3981
|
*/
|
|
3918
|
-
Documents.prototype.importStream = function (
|
|
3919
|
-
|
|
3920
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
3982
|
+
Documents.prototype.importStream = function (readableStream_1) {
|
|
3983
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (readableStream, options) {
|
|
3921
3984
|
var finalOptions, resultsInJSONLFormat, resultsInJSONFormat, failedItems;
|
|
3985
|
+
if (options === void 0) { options = {}; }
|
|
3922
3986
|
return tslib_1.__generator(this, function (_a) {
|
|
3923
3987
|
switch (_a.label) {
|
|
3924
3988
|
case 0:
|
|
@@ -3955,9 +4019,9 @@ var Documents = /** @class */ (function (_super) {
|
|
|
3955
4019
|
/**
|
|
3956
4020
|
* Returns a JSONL string for all the documents in this collection
|
|
3957
4021
|
*/
|
|
3958
|
-
Documents.prototype.export = function (
|
|
3959
|
-
|
|
3960
|
-
|
|
4022
|
+
Documents.prototype.export = function () {
|
|
4023
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (options) {
|
|
4024
|
+
if (options === void 0) { options = {}; }
|
|
3961
4025
|
return tslib_1.__generator(this, function (_a) {
|
|
3962
4026
|
return [2 /*return*/, this.apiCall.get(this.endpointPath("export"), options)];
|
|
3963
4027
|
});
|
|
@@ -3966,9 +4030,9 @@ var Documents = /** @class */ (function (_super) {
|
|
|
3966
4030
|
/**
|
|
3967
4031
|
* Returns a NodeJS readable stream of JSONL for all the documents in this collection.
|
|
3968
4032
|
*/
|
|
3969
|
-
Documents.prototype.exportStream = function (
|
|
3970
|
-
|
|
3971
|
-
|
|
4033
|
+
Documents.prototype.exportStream = function () {
|
|
4034
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (options) {
|
|
4035
|
+
if (options === void 0) { options = {}; }
|
|
3972
4036
|
return tslib_1.__generator(this, function (_a) {
|
|
3973
4037
|
return [2 /*return*/, this.apiCall.get(this.endpointPath("export"), options, {
|
|
3974
4038
|
responseType: "stream",
|
|
@@ -4441,9 +4505,11 @@ var MultiSearch = /** @class */ (function () {
|
|
|
4441
4505
|
};
|
|
4442
4506
|
MultiSearch.prototype.perform = function (searchRequests, commonParams, options) {
|
|
4443
4507
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
4444
|
-
var params, normalizedSearchRequests, streamConfig, paramsWithoutStream, normalizedQueryParams;
|
|
4445
|
-
|
|
4508
|
+
var params, cacheSearchResultsForSeconds, normalizedSearchRequests, streamConfig, paramsWithoutStream, normalizedQueryParams;
|
|
4509
|
+
var _a;
|
|
4510
|
+
return tslib_1.__generator(this, function (_b) {
|
|
4446
4511
|
params = commonParams ? tslib_1.__assign({}, commonParams) : {};
|
|
4512
|
+
cacheSearchResultsForSeconds = (_a = options === null || options === void 0 ? void 0 : options.cacheSearchResultsForSeconds) !== null && _a !== void 0 ? _a : this.configuration.cacheSearchResultsForSeconds;
|
|
4447
4513
|
if (this.configuration.useServerSideSearchCache === true) {
|
|
4448
4514
|
params.use_cache = true;
|
|
4449
4515
|
}
|
|
@@ -4466,8 +4532,8 @@ var MultiSearch = /** @class */ (function () {
|
|
|
4466
4532
|
streamConfig: streamConfig,
|
|
4467
4533
|
abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
|
|
4468
4534
|
isStreamingRequest: this.isStreamingRequest(params),
|
|
4469
|
-
},
|
|
4470
|
-
? { cacheResponseForSeconds:
|
|
4535
|
+
}, cacheSearchResultsForSeconds !== undefined
|
|
4536
|
+
? { cacheResponseForSeconds: cacheSearchResultsForSeconds }
|
|
4471
4537
|
: undefined)];
|
|
4472
4538
|
});
|
|
4473
4539
|
});
|
|
@@ -4593,14 +4659,21 @@ var Operations = /** @class */ (function () {
|
|
|
4593
4659
|
function Operations(apiCall) {
|
|
4594
4660
|
this.apiCall = apiCall;
|
|
4595
4661
|
}
|
|
4596
|
-
Operations.prototype.perform = function (
|
|
4597
|
-
|
|
4598
|
-
|
|
4662
|
+
Operations.prototype.perform = function (operationName_1) {
|
|
4663
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (operationName, queryParameters) {
|
|
4664
|
+
if (queryParameters === void 0) { queryParameters = {}; }
|
|
4599
4665
|
return tslib_1.__generator(this, function (_a) {
|
|
4600
4666
|
return [2 /*return*/, this.apiCall.post("".concat(RESOURCEPATH, "/").concat(operationName), {}, queryParameters)];
|
|
4601
4667
|
});
|
|
4602
4668
|
});
|
|
4603
4669
|
};
|
|
4670
|
+
Operations.prototype.getSchemaChanges = function () {
|
|
4671
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
4672
|
+
return tslib_1.__generator(this, function (_a) {
|
|
4673
|
+
return [2 /*return*/, this.apiCall.get("".concat(RESOURCEPATH, "/schema_changes"))];
|
|
4674
|
+
});
|
|
4675
|
+
});
|
|
4676
|
+
};
|
|
4604
4677
|
return Operations;
|
|
4605
4678
|
}());
|
|
4606
4679
|
exports["default"] = Operations;
|
|
@@ -5032,17 +5105,17 @@ var SearchOnlyDocuments = /** @class */ (function () {
|
|
|
5032
5105
|
SearchOnlyDocuments.prototype.clearCache = function () {
|
|
5033
5106
|
this.requestWithCache.clearCache();
|
|
5034
5107
|
};
|
|
5035
|
-
SearchOnlyDocuments.prototype.search = function (
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5108
|
+
SearchOnlyDocuments.prototype.search = function (searchParameters_1) {
|
|
5109
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (searchParameters, _a) {
|
|
5110
|
+
var additionalQueryParams, _b, streamConfig, rest, queryParams, isStreamingRequest;
|
|
5111
|
+
var _c = _a === void 0 ? {} : _a, _d = _c.cacheSearchResultsForSeconds, cacheSearchResultsForSeconds = _d === void 0 ? this.configuration
|
|
5112
|
+
.cacheSearchResultsForSeconds : _d, _e = _c.abortSignal, abortSignal = _e === void 0 ? null : _e;
|
|
5040
5113
|
return tslib_1.__generator(this, function (_f) {
|
|
5041
5114
|
additionalQueryParams = {};
|
|
5042
5115
|
if (this.configuration.useServerSideSearchCache === true) {
|
|
5043
5116
|
additionalQueryParams["use_cache"] = true;
|
|
5044
5117
|
}
|
|
5045
|
-
|
|
5118
|
+
_b = (0, Utils_1.normalizeArrayableParams)(searchParameters), streamConfig = _b.streamConfig, rest = tslib_1.__rest(_b, ["streamConfig"]);
|
|
5046
5119
|
queryParams = tslib_1.__assign(tslib_1.__assign({}, additionalQueryParams), rest);
|
|
5047
5120
|
isStreamingRequest = queryParams.conversation_stream === true;
|
|
5048
5121
|
return [2 /*return*/, this.requestWithCache.perform(this.apiCall, "get", {
|
|
@@ -5239,6 +5312,13 @@ var StemmingDictionary = /** @class */ (function () {
|
|
|
5239
5312
|
});
|
|
5240
5313
|
});
|
|
5241
5314
|
};
|
|
5315
|
+
StemmingDictionary.prototype.delete = function () {
|
|
5316
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
5317
|
+
return tslib_1.__generator(this, function (_a) {
|
|
5318
|
+
return [2 /*return*/, this.apiCall.delete(this.endpointPath())];
|
|
5319
|
+
});
|
|
5320
|
+
});
|
|
5321
|
+
};
|
|
5242
5322
|
StemmingDictionary.prototype.endpointPath = function () {
|
|
5243
5323
|
return "".concat(StemmingDictionaries_1.default.RESOURCEPATH, "/").concat(encodeURIComponent(this.id));
|
|
5244
5324
|
};
|
|
@@ -5656,7 +5736,8 @@ exports.arrayableParams = {
|
|
|
5656
5736
|
"use strict";
|
|
5657
5737
|
|
|
5658
5738
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5659
|
-
exports.
|
|
5739
|
+
exports.normalizeArrayableParams = normalizeArrayableParams;
|
|
5740
|
+
exports.toErrorWithMessage = toErrorWithMessage;
|
|
5660
5741
|
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/typesense/node_modules/tslib/tslib.es6.mjs");
|
|
5661
5742
|
var Types_1 = __webpack_require__(/*! ./Types */ "./node_modules/typesense/lib/Typesense/Types.js");
|
|
5662
5743
|
function hasNoArrayValues(params) {
|
|
@@ -5680,7 +5761,6 @@ function normalizeArrayableParams(params) {
|
|
|
5680
5761
|
}
|
|
5681
5762
|
return result;
|
|
5682
5763
|
}
|
|
5683
|
-
exports.normalizeArrayableParams = normalizeArrayableParams;
|
|
5684
5764
|
function isNonArrayValue(value) {
|
|
5685
5765
|
return !Array.isArray(value);
|
|
5686
5766
|
}
|
|
@@ -5703,7 +5783,6 @@ function toErrorWithMessage(couldBeError) {
|
|
|
5703
5783
|
return new Error(String(couldBeError));
|
|
5704
5784
|
}
|
|
5705
5785
|
}
|
|
5706
|
-
exports.toErrorWithMessage = toErrorWithMessage;
|
|
5707
5786
|
//# sourceMappingURL=Utils.js.map
|
|
5708
5787
|
|
|
5709
5788
|
/***/ }),
|
|
@@ -6102,9 +6181,16 @@ try {
|
|
|
6102
6181
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6103
6182
|
|
|
6104
6183
|
"use strict";
|
|
6105
|
-
/*! Axios v1.
|
|
6184
|
+
/*! Axios v1.13.6 Copyright (c) 2026 Matt Zabriskie and contributors */
|
|
6106
6185
|
|
|
6107
6186
|
|
|
6187
|
+
/**
|
|
6188
|
+
* Create a bound version of a function with a specified `this` context
|
|
6189
|
+
*
|
|
6190
|
+
* @param {Function} fn - The function to bind
|
|
6191
|
+
* @param {*} thisArg - The value to be passed as the `this` parameter
|
|
6192
|
+
* @returns {Function} A new function that will call the original function with the specified `this` context
|
|
6193
|
+
*/
|
|
6108
6194
|
function bind(fn, thisArg) {
|
|
6109
6195
|
return function wrap() {
|
|
6110
6196
|
return fn.apply(thisArg, arguments);
|
|
@@ -6113,29 +6199,30 @@ function bind(fn, thisArg) {
|
|
|
6113
6199
|
|
|
6114
6200
|
// utils is a library of generic helper functions non-specific to axios
|
|
6115
6201
|
|
|
6116
|
-
const {toString} = Object.prototype;
|
|
6117
|
-
const {getPrototypeOf} = Object;
|
|
6202
|
+
const { toString } = Object.prototype;
|
|
6203
|
+
const { getPrototypeOf } = Object;
|
|
6204
|
+
const { iterator, toStringTag } = Symbol;
|
|
6118
6205
|
|
|
6119
|
-
const kindOf = (cache => thing => {
|
|
6120
|
-
|
|
6121
|
-
|
|
6206
|
+
const kindOf = ((cache) => (thing) => {
|
|
6207
|
+
const str = toString.call(thing);
|
|
6208
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
6122
6209
|
})(Object.create(null));
|
|
6123
6210
|
|
|
6124
6211
|
const kindOfTest = (type) => {
|
|
6125
6212
|
type = type.toLowerCase();
|
|
6126
|
-
return (thing) => kindOf(thing) === type
|
|
6213
|
+
return (thing) => kindOf(thing) === type;
|
|
6127
6214
|
};
|
|
6128
6215
|
|
|
6129
|
-
const typeOfTest = type => thing => typeof thing === type;
|
|
6216
|
+
const typeOfTest = (type) => (thing) => typeof thing === type;
|
|
6130
6217
|
|
|
6131
6218
|
/**
|
|
6132
|
-
* Determine if a value is
|
|
6219
|
+
* Determine if a value is a non-null object
|
|
6133
6220
|
*
|
|
6134
6221
|
* @param {Object} val The value to test
|
|
6135
6222
|
*
|
|
6136
6223
|
* @returns {boolean} True if value is an Array, otherwise false
|
|
6137
6224
|
*/
|
|
6138
|
-
const {isArray} = Array;
|
|
6225
|
+
const { isArray } = Array;
|
|
6139
6226
|
|
|
6140
6227
|
/**
|
|
6141
6228
|
* Determine if a value is undefined
|
|
@@ -6154,8 +6241,14 @@ const isUndefined = typeOfTest('undefined');
|
|
|
6154
6241
|
* @returns {boolean} True if value is a Buffer, otherwise false
|
|
6155
6242
|
*/
|
|
6156
6243
|
function isBuffer(val) {
|
|
6157
|
-
return
|
|
6158
|
-
|
|
6244
|
+
return (
|
|
6245
|
+
val !== null &&
|
|
6246
|
+
!isUndefined(val) &&
|
|
6247
|
+
val.constructor !== null &&
|
|
6248
|
+
!isUndefined(val.constructor) &&
|
|
6249
|
+
isFunction$1(val.constructor.isBuffer) &&
|
|
6250
|
+
val.constructor.isBuffer(val)
|
|
6251
|
+
);
|
|
6159
6252
|
}
|
|
6160
6253
|
|
|
6161
6254
|
/**
|
|
@@ -6167,7 +6260,6 @@ function isBuffer(val) {
|
|
|
6167
6260
|
*/
|
|
6168
6261
|
const isArrayBuffer = kindOfTest('ArrayBuffer');
|
|
6169
6262
|
|
|
6170
|
-
|
|
6171
6263
|
/**
|
|
6172
6264
|
* Determine if a value is a view on an ArrayBuffer
|
|
6173
6265
|
*
|
|
@@ -6177,10 +6269,10 @@ const isArrayBuffer = kindOfTest('ArrayBuffer');
|
|
|
6177
6269
|
*/
|
|
6178
6270
|
function isArrayBufferView(val) {
|
|
6179
6271
|
let result;
|
|
6180
|
-
if (
|
|
6272
|
+
if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
|
|
6181
6273
|
result = ArrayBuffer.isView(val);
|
|
6182
6274
|
} else {
|
|
6183
|
-
result =
|
|
6275
|
+
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
6184
6276
|
}
|
|
6185
6277
|
return result;
|
|
6186
6278
|
}
|
|
@@ -6200,7 +6292,7 @@ const isString = typeOfTest('string');
|
|
|
6200
6292
|
* @param {*} val The value to test
|
|
6201
6293
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
6202
6294
|
*/
|
|
6203
|
-
const isFunction = typeOfTest('function');
|
|
6295
|
+
const isFunction$1 = typeOfTest('function');
|
|
6204
6296
|
|
|
6205
6297
|
/**
|
|
6206
6298
|
* Determine if a value is a Number
|
|
@@ -6226,7 +6318,7 @@ const isObject = (thing) => thing !== null && typeof thing === 'object';
|
|
|
6226
6318
|
* @param {*} thing The value to test
|
|
6227
6319
|
* @returns {boolean} True if value is a Boolean, otherwise false
|
|
6228
6320
|
*/
|
|
6229
|
-
const isBoolean = thing => thing === true || thing === false;
|
|
6321
|
+
const isBoolean = (thing) => thing === true || thing === false;
|
|
6230
6322
|
|
|
6231
6323
|
/**
|
|
6232
6324
|
* Determine if a value is a plain Object
|
|
@@ -6241,7 +6333,34 @@ const isPlainObject = (val) => {
|
|
|
6241
6333
|
}
|
|
6242
6334
|
|
|
6243
6335
|
const prototype = getPrototypeOf(val);
|
|
6244
|
-
return (
|
|
6336
|
+
return (
|
|
6337
|
+
(prototype === null ||
|
|
6338
|
+
prototype === Object.prototype ||
|
|
6339
|
+
Object.getPrototypeOf(prototype) === null) &&
|
|
6340
|
+
!(toStringTag in val) &&
|
|
6341
|
+
!(iterator in val)
|
|
6342
|
+
);
|
|
6343
|
+
};
|
|
6344
|
+
|
|
6345
|
+
/**
|
|
6346
|
+
* Determine if a value is an empty object (safely handles Buffers)
|
|
6347
|
+
*
|
|
6348
|
+
* @param {*} val The value to test
|
|
6349
|
+
*
|
|
6350
|
+
* @returns {boolean} True if value is an empty object, otherwise false
|
|
6351
|
+
*/
|
|
6352
|
+
const isEmptyObject = (val) => {
|
|
6353
|
+
// Early return for non-objects or Buffers to prevent RangeError
|
|
6354
|
+
if (!isObject(val) || isBuffer(val)) {
|
|
6355
|
+
return false;
|
|
6356
|
+
}
|
|
6357
|
+
|
|
6358
|
+
try {
|
|
6359
|
+
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
6360
|
+
} catch (e) {
|
|
6361
|
+
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
6362
|
+
return false;
|
|
6363
|
+
}
|
|
6245
6364
|
};
|
|
6246
6365
|
|
|
6247
6366
|
/**
|
|
@@ -6262,6 +6381,31 @@ const isDate = kindOfTest('Date');
|
|
|
6262
6381
|
*/
|
|
6263
6382
|
const isFile = kindOfTest('File');
|
|
6264
6383
|
|
|
6384
|
+
/**
|
|
6385
|
+
* Determine if a value is a React Native Blob
|
|
6386
|
+
* React Native "blob": an object with a `uri` attribute. Optionally, it can
|
|
6387
|
+
* also have a `name` and `type` attribute to specify filename and content type
|
|
6388
|
+
*
|
|
6389
|
+
* @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
|
|
6390
|
+
*
|
|
6391
|
+
* @param {*} value The value to test
|
|
6392
|
+
*
|
|
6393
|
+
* @returns {boolean} True if value is a React Native Blob, otherwise false
|
|
6394
|
+
*/
|
|
6395
|
+
const isReactNativeBlob = (value) => {
|
|
6396
|
+
return !!(value && typeof value.uri !== 'undefined');
|
|
6397
|
+
};
|
|
6398
|
+
|
|
6399
|
+
/**
|
|
6400
|
+
* Determine if environment is React Native
|
|
6401
|
+
* ReactNative `FormData` has a non-standard `getParts()` method
|
|
6402
|
+
*
|
|
6403
|
+
* @param {*} formData The formData to test
|
|
6404
|
+
*
|
|
6405
|
+
* @returns {boolean} True if environment is React Native, otherwise false
|
|
6406
|
+
*/
|
|
6407
|
+
const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
|
|
6408
|
+
|
|
6265
6409
|
/**
|
|
6266
6410
|
* Determine if a value is a Blob
|
|
6267
6411
|
*
|
|
@@ -6287,7 +6431,7 @@ const isFileList = kindOfTest('FileList');
|
|
|
6287
6431
|
*
|
|
6288
6432
|
* @returns {boolean} True if value is a Stream, otherwise false
|
|
6289
6433
|
*/
|
|
6290
|
-
const isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
6434
|
+
const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
6291
6435
|
|
|
6292
6436
|
/**
|
|
6293
6437
|
* Determine if a value is a FormData
|
|
@@ -6296,17 +6440,28 @@ const isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
|
6296
6440
|
*
|
|
6297
6441
|
* @returns {boolean} True if value is an FormData, otherwise false
|
|
6298
6442
|
*/
|
|
6443
|
+
function getGlobal() {
|
|
6444
|
+
if (typeof globalThis !== 'undefined') return globalThis;
|
|
6445
|
+
if (typeof self !== 'undefined') return self;
|
|
6446
|
+
if (typeof window !== 'undefined') return window;
|
|
6447
|
+
if (typeof __webpack_require__.g !== 'undefined') return __webpack_require__.g;
|
|
6448
|
+
return {};
|
|
6449
|
+
}
|
|
6450
|
+
|
|
6451
|
+
const G = getGlobal();
|
|
6452
|
+
const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
|
|
6453
|
+
|
|
6299
6454
|
const isFormData = (thing) => {
|
|
6300
6455
|
let kind;
|
|
6301
6456
|
return thing && (
|
|
6302
|
-
(
|
|
6303
|
-
isFunction(thing.append) && (
|
|
6457
|
+
(FormDataCtor && thing instanceof FormDataCtor) || (
|
|
6458
|
+
isFunction$1(thing.append) && (
|
|
6304
6459
|
(kind = kindOf(thing)) === 'formdata' ||
|
|
6305
6460
|
// detect form-data instance
|
|
6306
|
-
(kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
|
|
6461
|
+
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
6307
6462
|
)
|
|
6308
6463
|
)
|
|
6309
|
-
)
|
|
6464
|
+
);
|
|
6310
6465
|
};
|
|
6311
6466
|
|
|
6312
6467
|
/**
|
|
@@ -6318,7 +6473,12 @@ const isFormData = (thing) => {
|
|
|
6318
6473
|
*/
|
|
6319
6474
|
const isURLSearchParams = kindOfTest('URLSearchParams');
|
|
6320
6475
|
|
|
6321
|
-
const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
6476
|
+
const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
6477
|
+
'ReadableStream',
|
|
6478
|
+
'Request',
|
|
6479
|
+
'Response',
|
|
6480
|
+
'Headers',
|
|
6481
|
+
].map(kindOfTest);
|
|
6322
6482
|
|
|
6323
6483
|
/**
|
|
6324
6484
|
* Trim excess whitespace off the beginning and end of a string
|
|
@@ -6327,9 +6487,9 @@ const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream',
|
|
|
6327
6487
|
*
|
|
6328
6488
|
* @returns {String} The String freed of excess whitespace
|
|
6329
6489
|
*/
|
|
6330
|
-
const trim = (str) =>
|
|
6331
|
-
str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
|
6332
|
-
|
|
6490
|
+
const trim = (str) => {
|
|
6491
|
+
return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
|
6492
|
+
};
|
|
6333
6493
|
/**
|
|
6334
6494
|
* Iterate over an Array or an Object invoking a function for each item.
|
|
6335
6495
|
*
|
|
@@ -6339,13 +6499,14 @@ const trim = (str) => str.trim ?
|
|
|
6339
6499
|
* If 'obj' is an Object callback will be called passing
|
|
6340
6500
|
* the value, key, and complete object for each property.
|
|
6341
6501
|
*
|
|
6342
|
-
* @param {Object|Array} obj The object to iterate
|
|
6502
|
+
* @param {Object|Array<unknown>} obj The object to iterate
|
|
6343
6503
|
* @param {Function} fn The callback to invoke for each item
|
|
6344
6504
|
*
|
|
6345
|
-
* @param {
|
|
6505
|
+
* @param {Object} [options]
|
|
6506
|
+
* @param {Boolean} [options.allOwnKeys = false]
|
|
6346
6507
|
* @returns {any}
|
|
6347
6508
|
*/
|
|
6348
|
-
function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
6509
|
+
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
6349
6510
|
// Don't bother if no value provided
|
|
6350
6511
|
if (obj === null || typeof obj === 'undefined') {
|
|
6351
6512
|
return;
|
|
@@ -6366,6 +6527,11 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
6366
6527
|
fn.call(null, obj[i], i, obj);
|
|
6367
6528
|
}
|
|
6368
6529
|
} else {
|
|
6530
|
+
// Buffer check
|
|
6531
|
+
if (isBuffer(obj)) {
|
|
6532
|
+
return;
|
|
6533
|
+
}
|
|
6534
|
+
|
|
6369
6535
|
// Iterate over object keys
|
|
6370
6536
|
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
6371
6537
|
const len = keys.length;
|
|
@@ -6378,7 +6544,19 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
6378
6544
|
}
|
|
6379
6545
|
}
|
|
6380
6546
|
|
|
6547
|
+
/**
|
|
6548
|
+
* Finds a key in an object, case-insensitive, returning the actual key name.
|
|
6549
|
+
* Returns null if the object is a Buffer or if no match is found.
|
|
6550
|
+
*
|
|
6551
|
+
* @param {Object} obj - The object to search.
|
|
6552
|
+
* @param {string} key - The key to find (case-insensitive).
|
|
6553
|
+
* @returns {?string} The actual key name if found, otherwise null.
|
|
6554
|
+
*/
|
|
6381
6555
|
function findKey(obj, key) {
|
|
6556
|
+
if (isBuffer(obj)) {
|
|
6557
|
+
return null;
|
|
6558
|
+
}
|
|
6559
|
+
|
|
6382
6560
|
key = key.toLowerCase();
|
|
6383
6561
|
const keys = Object.keys(obj);
|
|
6384
6562
|
let i = keys.length;
|
|
@@ -6394,8 +6572,8 @@ function findKey(obj, key) {
|
|
|
6394
6572
|
|
|
6395
6573
|
const _global = (() => {
|
|
6396
6574
|
/*eslint no-undef:0*/
|
|
6397
|
-
if (typeof globalThis !==
|
|
6398
|
-
return typeof self !==
|
|
6575
|
+
if (typeof globalThis !== 'undefined') return globalThis;
|
|
6576
|
+
return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : __webpack_require__.g;
|
|
6399
6577
|
})();
|
|
6400
6578
|
|
|
6401
6579
|
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
@@ -6410,7 +6588,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
6410
6588
|
* Example:
|
|
6411
6589
|
*
|
|
6412
6590
|
* ```js
|
|
6413
|
-
*
|
|
6591
|
+
* const result = merge({foo: 123}, {foo: 456});
|
|
6414
6592
|
* console.log(result.foo); // outputs 456
|
|
6415
6593
|
* ```
|
|
6416
6594
|
*
|
|
@@ -6419,17 +6597,22 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
6419
6597
|
* @returns {Object} Result of all merge properties
|
|
6420
6598
|
*/
|
|
6421
6599
|
function merge(/* obj1, obj2, obj3, ... */) {
|
|
6422
|
-
const {caseless} = isContextDefined(this) && this || {};
|
|
6600
|
+
const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
|
|
6423
6601
|
const result = {};
|
|
6424
6602
|
const assignValue = (val, key) => {
|
|
6425
|
-
|
|
6603
|
+
// Skip dangerous property names to prevent prototype pollution
|
|
6604
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
6605
|
+
return;
|
|
6606
|
+
}
|
|
6607
|
+
|
|
6608
|
+
const targetKey = (caseless && findKey(result, key)) || key;
|
|
6426
6609
|
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
|
6427
6610
|
result[targetKey] = merge(result[targetKey], val);
|
|
6428
6611
|
} else if (isPlainObject(val)) {
|
|
6429
6612
|
result[targetKey] = merge({}, val);
|
|
6430
6613
|
} else if (isArray(val)) {
|
|
6431
6614
|
result[targetKey] = val.slice();
|
|
6432
|
-
} else {
|
|
6615
|
+
} else if (!skipUndefined || !isUndefined(val)) {
|
|
6433
6616
|
result[targetKey] = val;
|
|
6434
6617
|
}
|
|
6435
6618
|
};
|
|
@@ -6447,17 +6630,32 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
6447
6630
|
* @param {Object} b The object to copy properties from
|
|
6448
6631
|
* @param {Object} thisArg The object to bind function to
|
|
6449
6632
|
*
|
|
6450
|
-
* @param {
|
|
6633
|
+
* @param {Object} [options]
|
|
6634
|
+
* @param {Boolean} [options.allOwnKeys]
|
|
6451
6635
|
* @returns {Object} The resulting value of object a
|
|
6452
6636
|
*/
|
|
6453
|
-
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
6454
|
-
forEach(
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6637
|
+
const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
6638
|
+
forEach(
|
|
6639
|
+
b,
|
|
6640
|
+
(val, key) => {
|
|
6641
|
+
if (thisArg && isFunction$1(val)) {
|
|
6642
|
+
Object.defineProperty(a, key, {
|
|
6643
|
+
value: bind(val, thisArg),
|
|
6644
|
+
writable: true,
|
|
6645
|
+
enumerable: true,
|
|
6646
|
+
configurable: true,
|
|
6647
|
+
});
|
|
6648
|
+
} else {
|
|
6649
|
+
Object.defineProperty(a, key, {
|
|
6650
|
+
value: val,
|
|
6651
|
+
writable: true,
|
|
6652
|
+
enumerable: true,
|
|
6653
|
+
configurable: true,
|
|
6654
|
+
});
|
|
6655
|
+
}
|
|
6656
|
+
},
|
|
6657
|
+
{ allOwnKeys }
|
|
6658
|
+
);
|
|
6461
6659
|
return a;
|
|
6462
6660
|
};
|
|
6463
6661
|
|
|
@@ -6469,7 +6667,7 @@ const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
|
6469
6667
|
* @returns {string} content value without BOM
|
|
6470
6668
|
*/
|
|
6471
6669
|
const stripBOM = (content) => {
|
|
6472
|
-
if (content.charCodeAt(0) ===
|
|
6670
|
+
if (content.charCodeAt(0) === 0xfeff) {
|
|
6473
6671
|
content = content.slice(1);
|
|
6474
6672
|
}
|
|
6475
6673
|
return content;
|
|
@@ -6486,9 +6684,14 @@ const stripBOM = (content) => {
|
|
|
6486
6684
|
*/
|
|
6487
6685
|
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
6488
6686
|
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
6489
|
-
constructor.prototype
|
|
6687
|
+
Object.defineProperty(constructor.prototype, 'constructor', {
|
|
6688
|
+
value: constructor,
|
|
6689
|
+
writable: true,
|
|
6690
|
+
enumerable: false,
|
|
6691
|
+
configurable: true,
|
|
6692
|
+
});
|
|
6490
6693
|
Object.defineProperty(constructor, 'super', {
|
|
6491
|
-
value: superConstructor.prototype
|
|
6694
|
+
value: superConstructor.prototype,
|
|
6492
6695
|
});
|
|
6493
6696
|
props && Object.assign(constructor.prototype, props);
|
|
6494
6697
|
};
|
|
@@ -6547,7 +6750,6 @@ const endsWith = (str, searchString, position) => {
|
|
|
6547
6750
|
return lastIndex !== -1 && lastIndex === position;
|
|
6548
6751
|
};
|
|
6549
6752
|
|
|
6550
|
-
|
|
6551
6753
|
/**
|
|
6552
6754
|
* Returns new array from array like object or null if failed
|
|
6553
6755
|
*
|
|
@@ -6576,9 +6778,9 @@ const toArray = (thing) => {
|
|
|
6576
6778
|
* @returns {Array}
|
|
6577
6779
|
*/
|
|
6578
6780
|
// eslint-disable-next-line func-names
|
|
6579
|
-
const isTypedArray = (TypedArray => {
|
|
6781
|
+
const isTypedArray = ((TypedArray) => {
|
|
6580
6782
|
// eslint-disable-next-line func-names
|
|
6581
|
-
return thing => {
|
|
6783
|
+
return (thing) => {
|
|
6582
6784
|
return TypedArray && thing instanceof TypedArray;
|
|
6583
6785
|
};
|
|
6584
6786
|
})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
|
|
@@ -6592,13 +6794,13 @@ const isTypedArray = (TypedArray => {
|
|
|
6592
6794
|
* @returns {void}
|
|
6593
6795
|
*/
|
|
6594
6796
|
const forEachEntry = (obj, fn) => {
|
|
6595
|
-
const generator = obj && obj[
|
|
6797
|
+
const generator = obj && obj[iterator];
|
|
6596
6798
|
|
|
6597
|
-
const
|
|
6799
|
+
const _iterator = generator.call(obj);
|
|
6598
6800
|
|
|
6599
6801
|
let result;
|
|
6600
6802
|
|
|
6601
|
-
while ((result =
|
|
6803
|
+
while ((result = _iterator.next()) && !result.done) {
|
|
6602
6804
|
const pair = result.value;
|
|
6603
6805
|
fn.call(obj, pair[0], pair[1]);
|
|
6604
6806
|
}
|
|
@@ -6626,16 +6828,18 @@ const matchAll = (regExp, str) => {
|
|
|
6626
6828
|
/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
|
|
6627
6829
|
const isHTMLForm = kindOfTest('HTMLFormElement');
|
|
6628
6830
|
|
|
6629
|
-
const toCamelCase = str => {
|
|
6630
|
-
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
}
|
|
6634
|
-
);
|
|
6831
|
+
const toCamelCase = (str) => {
|
|
6832
|
+
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
|
|
6833
|
+
return p1.toUpperCase() + p2;
|
|
6834
|
+
});
|
|
6635
6835
|
};
|
|
6636
6836
|
|
|
6637
6837
|
/* Creating a function that will check if an object has a property. */
|
|
6638
|
-
const hasOwnProperty = (
|
|
6838
|
+
const hasOwnProperty = (
|
|
6839
|
+
({ hasOwnProperty }) =>
|
|
6840
|
+
(obj, prop) =>
|
|
6841
|
+
hasOwnProperty.call(obj, prop)
|
|
6842
|
+
)(Object.prototype);
|
|
6639
6843
|
|
|
6640
6844
|
/**
|
|
6641
6845
|
* Determine if a value is a RegExp object
|
|
@@ -6668,13 +6872,13 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
6668
6872
|
const freezeMethods = (obj) => {
|
|
6669
6873
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
6670
6874
|
// skip restricted props in strict mode
|
|
6671
|
-
if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
6875
|
+
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
6672
6876
|
return false;
|
|
6673
6877
|
}
|
|
6674
6878
|
|
|
6675
6879
|
const value = obj[name];
|
|
6676
6880
|
|
|
6677
|
-
if (!isFunction(value)) return;
|
|
6881
|
+
if (!isFunction$1(value)) return;
|
|
6678
6882
|
|
|
6679
6883
|
descriptor.enumerable = false;
|
|
6680
6884
|
|
|
@@ -6685,17 +6889,25 @@ const freezeMethods = (obj) => {
|
|
|
6685
6889
|
|
|
6686
6890
|
if (!descriptor.set) {
|
|
6687
6891
|
descriptor.set = () => {
|
|
6688
|
-
throw Error(
|
|
6892
|
+
throw Error("Can not rewrite read-only method '" + name + "'");
|
|
6689
6893
|
};
|
|
6690
6894
|
}
|
|
6691
6895
|
});
|
|
6692
6896
|
};
|
|
6693
6897
|
|
|
6898
|
+
/**
|
|
6899
|
+
* Converts an array or a delimited string into an object set with values as keys and true as values.
|
|
6900
|
+
* Useful for fast membership checks.
|
|
6901
|
+
*
|
|
6902
|
+
* @param {Array|string} arrayOrString - The array or string to convert.
|
|
6903
|
+
* @param {string} delimiter - The delimiter to use if input is a string.
|
|
6904
|
+
* @returns {Object} An object with keys from the array or string, values set to true.
|
|
6905
|
+
*/
|
|
6694
6906
|
const toObjectSet = (arrayOrString, delimiter) => {
|
|
6695
6907
|
const obj = {};
|
|
6696
6908
|
|
|
6697
6909
|
const define = (arr) => {
|
|
6698
|
-
arr.forEach(value => {
|
|
6910
|
+
arr.forEach((value) => {
|
|
6699
6911
|
obj[value] = true;
|
|
6700
6912
|
});
|
|
6701
6913
|
};
|
|
@@ -6708,7 +6920,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|
|
6708
6920
|
const noop = () => {};
|
|
6709
6921
|
|
|
6710
6922
|
const toFiniteNumber = (value, defaultValue) => {
|
|
6711
|
-
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
6923
|
+
return value != null && Number.isFinite((value = +value)) ? value : defaultValue;
|
|
6712
6924
|
};
|
|
6713
6925
|
|
|
6714
6926
|
/**
|
|
@@ -6719,20 +6931,35 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
|
6719
6931
|
* @returns {boolean}
|
|
6720
6932
|
*/
|
|
6721
6933
|
function isSpecCompliantForm(thing) {
|
|
6722
|
-
return !!(
|
|
6934
|
+
return !!(
|
|
6935
|
+
thing &&
|
|
6936
|
+
isFunction$1(thing.append) &&
|
|
6937
|
+
thing[toStringTag] === 'FormData' &&
|
|
6938
|
+
thing[iterator]
|
|
6939
|
+
);
|
|
6723
6940
|
}
|
|
6724
6941
|
|
|
6942
|
+
/**
|
|
6943
|
+
* Recursively converts an object to a JSON-compatible object, handling circular references and Buffers.
|
|
6944
|
+
*
|
|
6945
|
+
* @param {Object} obj - The object to convert.
|
|
6946
|
+
* @returns {Object} The JSON-compatible object.
|
|
6947
|
+
*/
|
|
6725
6948
|
const toJSONObject = (obj) => {
|
|
6726
6949
|
const stack = new Array(10);
|
|
6727
6950
|
|
|
6728
6951
|
const visit = (source, i) => {
|
|
6729
|
-
|
|
6730
6952
|
if (isObject(source)) {
|
|
6731
6953
|
if (stack.indexOf(source) >= 0) {
|
|
6732
6954
|
return;
|
|
6733
6955
|
}
|
|
6734
6956
|
|
|
6735
|
-
|
|
6957
|
+
//Buffer check
|
|
6958
|
+
if (isBuffer(source)) {
|
|
6959
|
+
return source;
|
|
6960
|
+
}
|
|
6961
|
+
|
|
6962
|
+
if (!('toJSON' in source)) {
|
|
6736
6963
|
stack[i] = source;
|
|
6737
6964
|
const target = isArray(source) ? [] : {};
|
|
6738
6965
|
|
|
@@ -6753,41 +6980,77 @@ const toJSONObject = (obj) => {
|
|
|
6753
6980
|
return visit(obj, 0);
|
|
6754
6981
|
};
|
|
6755
6982
|
|
|
6983
|
+
/**
|
|
6984
|
+
* Determines if a value is an async function.
|
|
6985
|
+
*
|
|
6986
|
+
* @param {*} thing - The value to test.
|
|
6987
|
+
* @returns {boolean} True if value is an async function, otherwise false.
|
|
6988
|
+
*/
|
|
6756
6989
|
const isAsyncFn = kindOfTest('AsyncFunction');
|
|
6757
6990
|
|
|
6991
|
+
/**
|
|
6992
|
+
* Determines if a value is thenable (has then and catch methods).
|
|
6993
|
+
*
|
|
6994
|
+
* @param {*} thing - The value to test.
|
|
6995
|
+
* @returns {boolean} True if value is thenable, otherwise false.
|
|
6996
|
+
*/
|
|
6758
6997
|
const isThenable = (thing) =>
|
|
6759
|
-
thing &&
|
|
6998
|
+
thing &&
|
|
6999
|
+
(isObject(thing) || isFunction$1(thing)) &&
|
|
7000
|
+
isFunction$1(thing.then) &&
|
|
7001
|
+
isFunction$1(thing.catch);
|
|
6760
7002
|
|
|
6761
7003
|
// original code
|
|
6762
7004
|
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
6763
7005
|
|
|
7006
|
+
/**
|
|
7007
|
+
* Provides a cross-platform setImmediate implementation.
|
|
7008
|
+
* Uses native setImmediate if available, otherwise falls back to postMessage or setTimeout.
|
|
7009
|
+
*
|
|
7010
|
+
* @param {boolean} setImmediateSupported - Whether setImmediate is supported.
|
|
7011
|
+
* @param {boolean} postMessageSupported - Whether postMessage is supported.
|
|
7012
|
+
* @returns {Function} A function to schedule a callback asynchronously.
|
|
7013
|
+
*/
|
|
6764
7014
|
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
6765
7015
|
if (setImmediateSupported) {
|
|
6766
7016
|
return setImmediate;
|
|
6767
7017
|
}
|
|
6768
7018
|
|
|
6769
|
-
return postMessageSupported
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
7019
|
+
return postMessageSupported
|
|
7020
|
+
? ((token, callbacks) => {
|
|
7021
|
+
_global.addEventListener(
|
|
7022
|
+
'message',
|
|
7023
|
+
({ source, data }) => {
|
|
7024
|
+
if (source === _global && data === token) {
|
|
7025
|
+
callbacks.length && callbacks.shift()();
|
|
7026
|
+
}
|
|
7027
|
+
},
|
|
7028
|
+
false
|
|
7029
|
+
);
|
|
6775
7030
|
|
|
6776
|
-
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
isFunction(_global.postMessage)
|
|
6784
|
-
);
|
|
7031
|
+
return (cb) => {
|
|
7032
|
+
callbacks.push(cb);
|
|
7033
|
+
_global.postMessage(token, '*');
|
|
7034
|
+
};
|
|
7035
|
+
})(`axios@${Math.random()}`, [])
|
|
7036
|
+
: (cb) => setTimeout(cb);
|
|
7037
|
+
})(typeof setImmediate === 'function', isFunction$1(_global.postMessage));
|
|
6785
7038
|
|
|
6786
|
-
|
|
6787
|
-
|
|
7039
|
+
/**
|
|
7040
|
+
* Schedules a microtask or asynchronous callback as soon as possible.
|
|
7041
|
+
* Uses queueMicrotask if available, otherwise falls back to process.nextTick or _setImmediate.
|
|
7042
|
+
*
|
|
7043
|
+
* @type {Function}
|
|
7044
|
+
*/
|
|
7045
|
+
const asap =
|
|
7046
|
+
typeof queueMicrotask !== 'undefined'
|
|
7047
|
+
? queueMicrotask.bind(_global)
|
|
7048
|
+
: (typeof process !== 'undefined' && process.nextTick) || _setImmediate;
|
|
6788
7049
|
|
|
6789
7050
|
// *********************
|
|
6790
7051
|
|
|
7052
|
+
const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
|
|
7053
|
+
|
|
6791
7054
|
var utils$1 = {
|
|
6792
7055
|
isArray,
|
|
6793
7056
|
isArrayBuffer,
|
|
@@ -6799,6 +7062,7 @@ var utils$1 = {
|
|
|
6799
7062
|
isBoolean,
|
|
6800
7063
|
isObject,
|
|
6801
7064
|
isPlainObject,
|
|
7065
|
+
isEmptyObject,
|
|
6802
7066
|
isReadableStream,
|
|
6803
7067
|
isRequest,
|
|
6804
7068
|
isResponse,
|
|
@@ -6806,9 +7070,11 @@ var utils$1 = {
|
|
|
6806
7070
|
isUndefined,
|
|
6807
7071
|
isDate,
|
|
6808
7072
|
isFile,
|
|
7073
|
+
isReactNativeBlob,
|
|
7074
|
+
isReactNative,
|
|
6809
7075
|
isBlob,
|
|
6810
7076
|
isRegExp,
|
|
6811
|
-
isFunction,
|
|
7077
|
+
isFunction: isFunction$1,
|
|
6812
7078
|
isStream,
|
|
6813
7079
|
isURLSearchParams,
|
|
6814
7080
|
isTypedArray,
|
|
@@ -6843,42 +7109,61 @@ var utils$1 = {
|
|
|
6843
7109
|
isAsyncFn,
|
|
6844
7110
|
isThenable,
|
|
6845
7111
|
setImmediate: _setImmediate,
|
|
6846
|
-
asap
|
|
7112
|
+
asap,
|
|
7113
|
+
isIterable,
|
|
6847
7114
|
};
|
|
6848
7115
|
|
|
6849
|
-
|
|
6850
|
-
|
|
6851
|
-
|
|
6852
|
-
|
|
6853
|
-
|
|
6854
|
-
* @param {Object} [config] The config.
|
|
6855
|
-
* @param {Object} [request] The request.
|
|
6856
|
-
* @param {Object} [response] The response.
|
|
6857
|
-
*
|
|
6858
|
-
* @returns {Error} The created error.
|
|
6859
|
-
*/
|
|
6860
|
-
function AxiosError(message, code, config, request, response) {
|
|
6861
|
-
Error.call(this);
|
|
7116
|
+
class AxiosError extends Error {
|
|
7117
|
+
static from(error, code, config, request, response, customProps) {
|
|
7118
|
+
const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
|
7119
|
+
axiosError.cause = error;
|
|
7120
|
+
axiosError.name = error.name;
|
|
6862
7121
|
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
}
|
|
7122
|
+
// Preserve status from the original error if not already set from response
|
|
7123
|
+
if (error.status != null && axiosError.status == null) {
|
|
7124
|
+
axiosError.status = error.status;
|
|
7125
|
+
}
|
|
6868
7126
|
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
code && (this.code = code);
|
|
6872
|
-
config && (this.config = config);
|
|
6873
|
-
request && (this.request = request);
|
|
6874
|
-
if (response) {
|
|
6875
|
-
this.response = response;
|
|
6876
|
-
this.status = response.status ? response.status : null;
|
|
7127
|
+
customProps && Object.assign(axiosError, customProps);
|
|
7128
|
+
return axiosError;
|
|
6877
7129
|
}
|
|
6878
|
-
}
|
|
6879
7130
|
|
|
6880
|
-
|
|
6881
|
-
|
|
7131
|
+
/**
|
|
7132
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
7133
|
+
*
|
|
7134
|
+
* @param {string} message The error message.
|
|
7135
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
7136
|
+
* @param {Object} [config] The config.
|
|
7137
|
+
* @param {Object} [request] The request.
|
|
7138
|
+
* @param {Object} [response] The response.
|
|
7139
|
+
*
|
|
7140
|
+
* @returns {Error} The created error.
|
|
7141
|
+
*/
|
|
7142
|
+
constructor(message, code, config, request, response) {
|
|
7143
|
+
super(message);
|
|
7144
|
+
|
|
7145
|
+
// Make message enumerable to maintain backward compatibility
|
|
7146
|
+
// The native Error constructor sets message as non-enumerable,
|
|
7147
|
+
// but axios < v1.13.3 had it as enumerable
|
|
7148
|
+
Object.defineProperty(this, 'message', {
|
|
7149
|
+
value: message,
|
|
7150
|
+
enumerable: true,
|
|
7151
|
+
writable: true,
|
|
7152
|
+
configurable: true
|
|
7153
|
+
});
|
|
7154
|
+
|
|
7155
|
+
this.name = 'AxiosError';
|
|
7156
|
+
this.isAxiosError = true;
|
|
7157
|
+
code && (this.code = code);
|
|
7158
|
+
config && (this.config = config);
|
|
7159
|
+
request && (this.request = request);
|
|
7160
|
+
if (response) {
|
|
7161
|
+
this.response = response;
|
|
7162
|
+
this.status = response.status;
|
|
7163
|
+
}
|
|
7164
|
+
}
|
|
7165
|
+
|
|
7166
|
+
toJSON() {
|
|
6882
7167
|
return {
|
|
6883
7168
|
// Standard
|
|
6884
7169
|
message: this.message,
|
|
@@ -6894,55 +7179,26 @@ utils$1.inherits(AxiosError, Error, {
|
|
|
6894
7179
|
// Axios
|
|
6895
7180
|
config: utils$1.toJSONObject(this.config),
|
|
6896
7181
|
code: this.code,
|
|
6897
|
-
status: this.status
|
|
7182
|
+
status: this.status,
|
|
6898
7183
|
};
|
|
6899
7184
|
}
|
|
6900
|
-
}
|
|
6901
|
-
|
|
6902
|
-
const prototype$1 = AxiosError.prototype;
|
|
6903
|
-
const descriptors = {};
|
|
6904
|
-
|
|
6905
|
-
[
|
|
6906
|
-
'ERR_BAD_OPTION_VALUE',
|
|
6907
|
-
'ERR_BAD_OPTION',
|
|
6908
|
-
'ECONNABORTED',
|
|
6909
|
-
'ETIMEDOUT',
|
|
6910
|
-
'ERR_NETWORK',
|
|
6911
|
-
'ERR_FR_TOO_MANY_REDIRECTS',
|
|
6912
|
-
'ERR_DEPRECATED',
|
|
6913
|
-
'ERR_BAD_RESPONSE',
|
|
6914
|
-
'ERR_BAD_REQUEST',
|
|
6915
|
-
'ERR_CANCELED',
|
|
6916
|
-
'ERR_NOT_SUPPORT',
|
|
6917
|
-
'ERR_INVALID_URL'
|
|
6918
|
-
// eslint-disable-next-line func-names
|
|
6919
|
-
].forEach(code => {
|
|
6920
|
-
descriptors[code] = {value: code};
|
|
6921
|
-
});
|
|
6922
|
-
|
|
6923
|
-
Object.defineProperties(AxiosError, descriptors);
|
|
6924
|
-
Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
|
|
6925
|
-
|
|
6926
|
-
// eslint-disable-next-line func-names
|
|
6927
|
-
AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
6928
|
-
const axiosError = Object.create(prototype$1);
|
|
6929
|
-
|
|
6930
|
-
utils$1.toFlatObject(error, axiosError, function filter(obj) {
|
|
6931
|
-
return obj !== Error.prototype;
|
|
6932
|
-
}, prop => {
|
|
6933
|
-
return prop !== 'isAxiosError';
|
|
6934
|
-
});
|
|
6935
|
-
|
|
6936
|
-
AxiosError.call(axiosError, error.message, code, config, request, response);
|
|
6937
|
-
|
|
6938
|
-
axiosError.cause = error;
|
|
6939
|
-
|
|
6940
|
-
axiosError.name = error.name;
|
|
6941
|
-
|
|
6942
|
-
customProps && Object.assign(axiosError, customProps);
|
|
7185
|
+
}
|
|
6943
7186
|
|
|
6944
|
-
|
|
6945
|
-
|
|
7187
|
+
// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
|
|
7188
|
+
AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
|
|
7189
|
+
AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
|
7190
|
+
AxiosError.ECONNABORTED = 'ECONNABORTED';
|
|
7191
|
+
AxiosError.ETIMEDOUT = 'ETIMEDOUT';
|
|
7192
|
+
AxiosError.ERR_NETWORK = 'ERR_NETWORK';
|
|
7193
|
+
AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
|
7194
|
+
AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
|
|
7195
|
+
AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
|
|
7196
|
+
AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
|
7197
|
+
AxiosError.ERR_CANCELED = 'ERR_CANCELED';
|
|
7198
|
+
AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
7199
|
+
AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|
7200
|
+
|
|
7201
|
+
var AxiosError$1 = AxiosError;
|
|
6946
7202
|
|
|
6947
7203
|
// eslint-disable-next-line strict
|
|
6948
7204
|
var httpAdapter = null;
|
|
@@ -6980,11 +7236,14 @@ function removeBrackets(key) {
|
|
|
6980
7236
|
*/
|
|
6981
7237
|
function renderKey(path, key, dots) {
|
|
6982
7238
|
if (!path) return key;
|
|
6983
|
-
return path
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
|
|
7239
|
+
return path
|
|
7240
|
+
.concat(key)
|
|
7241
|
+
.map(function each(token, i) {
|
|
7242
|
+
// eslint-disable-next-line no-param-reassign
|
|
7243
|
+
token = removeBrackets(token);
|
|
7244
|
+
return !dots && i ? '[' + token + ']' : token;
|
|
7245
|
+
})
|
|
7246
|
+
.join(dots ? '.' : '');
|
|
6988
7247
|
}
|
|
6989
7248
|
|
|
6990
7249
|
/**
|
|
@@ -7034,21 +7293,26 @@ function toFormData(obj, formData, options) {
|
|
|
7034
7293
|
formData = formData || new (FormData)();
|
|
7035
7294
|
|
|
7036
7295
|
// eslint-disable-next-line no-param-reassign
|
|
7037
|
-
options = utils$1.toFlatObject(
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
7044
|
-
|
|
7296
|
+
options = utils$1.toFlatObject(
|
|
7297
|
+
options,
|
|
7298
|
+
{
|
|
7299
|
+
metaTokens: true,
|
|
7300
|
+
dots: false,
|
|
7301
|
+
indexes: false,
|
|
7302
|
+
},
|
|
7303
|
+
false,
|
|
7304
|
+
function defined(option, source) {
|
|
7305
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
7306
|
+
return !utils$1.isUndefined(source[option]);
|
|
7307
|
+
}
|
|
7308
|
+
);
|
|
7045
7309
|
|
|
7046
7310
|
const metaTokens = options.metaTokens;
|
|
7047
7311
|
// eslint-disable-next-line no-use-before-define
|
|
7048
7312
|
const visitor = options.visitor || defaultVisitor;
|
|
7049
7313
|
const dots = options.dots;
|
|
7050
7314
|
const indexes = options.indexes;
|
|
7051
|
-
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
7315
|
+
const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
|
|
7052
7316
|
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
7053
7317
|
|
|
7054
7318
|
if (!utils$1.isFunction(visitor)) {
|
|
@@ -7062,8 +7326,12 @@ function toFormData(obj, formData, options) {
|
|
|
7062
7326
|
return value.toISOString();
|
|
7063
7327
|
}
|
|
7064
7328
|
|
|
7329
|
+
if (utils$1.isBoolean(value)) {
|
|
7330
|
+
return value.toString();
|
|
7331
|
+
}
|
|
7332
|
+
|
|
7065
7333
|
if (!useBlob && utils$1.isBlob(value)) {
|
|
7066
|
-
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
7334
|
+
throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
|
|
7067
7335
|
}
|
|
7068
7336
|
|
|
7069
7337
|
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
@@ -7086,6 +7354,11 @@ function toFormData(obj, formData, options) {
|
|
|
7086
7354
|
function defaultVisitor(value, key, path) {
|
|
7087
7355
|
let arr = value;
|
|
7088
7356
|
|
|
7357
|
+
if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
|
|
7358
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
7359
|
+
return false;
|
|
7360
|
+
}
|
|
7361
|
+
|
|
7089
7362
|
if (value && !path && typeof value === 'object') {
|
|
7090
7363
|
if (utils$1.endsWith(key, '{}')) {
|
|
7091
7364
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -7094,17 +7367,22 @@ function toFormData(obj, formData, options) {
|
|
|
7094
7367
|
value = JSON.stringify(value);
|
|
7095
7368
|
} else if (
|
|
7096
7369
|
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
7097
|
-
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
|
|
7098
|
-
|
|
7370
|
+
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
|
|
7371
|
+
) {
|
|
7099
7372
|
// eslint-disable-next-line no-param-reassign
|
|
7100
7373
|
key = removeBrackets(key);
|
|
7101
7374
|
|
|
7102
7375
|
arr.forEach(function each(el, index) {
|
|
7103
|
-
!(utils$1.isUndefined(el) || el === null) &&
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7376
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
7377
|
+
formData.append(
|
|
7378
|
+
// eslint-disable-next-line no-nested-ternary
|
|
7379
|
+
indexes === true
|
|
7380
|
+
? renderKey([key], index, dots)
|
|
7381
|
+
: indexes === null
|
|
7382
|
+
? key
|
|
7383
|
+
: key + '[]',
|
|
7384
|
+
convertValue(el)
|
|
7385
|
+
);
|
|
7108
7386
|
});
|
|
7109
7387
|
return false;
|
|
7110
7388
|
}
|
|
@@ -7124,7 +7402,7 @@ function toFormData(obj, formData, options) {
|
|
|
7124
7402
|
const exposedHelpers = Object.assign(predicates, {
|
|
7125
7403
|
defaultVisitor,
|
|
7126
7404
|
convertValue,
|
|
7127
|
-
isVisitable
|
|
7405
|
+
isVisitable,
|
|
7128
7406
|
});
|
|
7129
7407
|
|
|
7130
7408
|
function build(value, path) {
|
|
@@ -7137,9 +7415,9 @@ function toFormData(obj, formData, options) {
|
|
|
7137
7415
|
stack.push(value);
|
|
7138
7416
|
|
|
7139
7417
|
utils$1.forEach(value, function each(el, key) {
|
|
7140
|
-
const result =
|
|
7141
|
-
|
|
7142
|
-
|
|
7418
|
+
const result =
|
|
7419
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
7420
|
+
visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
7143
7421
|
|
|
7144
7422
|
if (result === true) {
|
|
7145
7423
|
build(el, path ? path.concat(key) : [key]);
|
|
@@ -7174,7 +7452,7 @@ function encode$1(str) {
|
|
|
7174
7452
|
')': '%29',
|
|
7175
7453
|
'~': '%7E',
|
|
7176
7454
|
'%20': '+',
|
|
7177
|
-
'%00': '\x00'
|
|
7455
|
+
'%00': '\x00',
|
|
7178
7456
|
};
|
|
7179
7457
|
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
7180
7458
|
return charMap[match];
|
|
@@ -7202,13 +7480,17 @@ prototype.append = function append(name, value) {
|
|
|
7202
7480
|
};
|
|
7203
7481
|
|
|
7204
7482
|
prototype.toString = function toString(encoder) {
|
|
7205
|
-
const _encode = encoder
|
|
7206
|
-
|
|
7207
|
-
|
|
7483
|
+
const _encode = encoder
|
|
7484
|
+
? function (value) {
|
|
7485
|
+
return encoder.call(this, value, encode$1);
|
|
7486
|
+
}
|
|
7487
|
+
: encode$1;
|
|
7208
7488
|
|
|
7209
|
-
return this._pairs
|
|
7210
|
-
|
|
7211
|
-
|
|
7489
|
+
return this._pairs
|
|
7490
|
+
.map(function each(pair) {
|
|
7491
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
7492
|
+
}, '')
|
|
7493
|
+
.join('&');
|
|
7212
7494
|
};
|
|
7213
7495
|
|
|
7214
7496
|
/**
|
|
@@ -7220,13 +7502,11 @@ prototype.toString = function toString(encoder) {
|
|
|
7220
7502
|
* @returns {string} The encoded value.
|
|
7221
7503
|
*/
|
|
7222
7504
|
function encode(val) {
|
|
7223
|
-
return encodeURIComponent(val)
|
|
7224
|
-
replace(/%3A/gi, ':')
|
|
7225
|
-
replace(/%24/g, '$')
|
|
7226
|
-
replace(/%2C/gi, ',')
|
|
7227
|
-
replace(/%20/g, '+')
|
|
7228
|
-
replace(/%5B/gi, '[').
|
|
7229
|
-
replace(/%5D/gi, ']');
|
|
7505
|
+
return encodeURIComponent(val)
|
|
7506
|
+
.replace(/%3A/gi, ':')
|
|
7507
|
+
.replace(/%24/g, '$')
|
|
7508
|
+
.replace(/%2C/gi, ',')
|
|
7509
|
+
.replace(/%20/g, '+');
|
|
7230
7510
|
}
|
|
7231
7511
|
|
|
7232
7512
|
/**
|
|
@@ -7239,33 +7519,32 @@ function encode(val) {
|
|
|
7239
7519
|
* @returns {string} The formatted url
|
|
7240
7520
|
*/
|
|
7241
7521
|
function buildURL(url, params, options) {
|
|
7242
|
-
/*eslint no-param-reassign:0*/
|
|
7243
7522
|
if (!params) {
|
|
7244
7523
|
return url;
|
|
7245
7524
|
}
|
|
7246
|
-
|
|
7247
|
-
const _encode = options && options.encode || encode;
|
|
7248
7525
|
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7526
|
+
const _encode = (options && options.encode) || encode;
|
|
7527
|
+
|
|
7528
|
+
const _options = utils$1.isFunction(options)
|
|
7529
|
+
? {
|
|
7530
|
+
serialize: options,
|
|
7531
|
+
}
|
|
7532
|
+
: options;
|
|
7254
7533
|
|
|
7255
|
-
const serializeFn =
|
|
7534
|
+
const serializeFn = _options && _options.serialize;
|
|
7256
7535
|
|
|
7257
7536
|
let serializedParams;
|
|
7258
7537
|
|
|
7259
7538
|
if (serializeFn) {
|
|
7260
|
-
serializedParams = serializeFn(params,
|
|
7539
|
+
serializedParams = serializeFn(params, _options);
|
|
7261
7540
|
} else {
|
|
7262
|
-
serializedParams = utils$1.isURLSearchParams(params)
|
|
7263
|
-
params.toString()
|
|
7264
|
-
new AxiosURLSearchParams(params,
|
|
7541
|
+
serializedParams = utils$1.isURLSearchParams(params)
|
|
7542
|
+
? params.toString()
|
|
7543
|
+
: new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
7265
7544
|
}
|
|
7266
7545
|
|
|
7267
7546
|
if (serializedParams) {
|
|
7268
|
-
const hashmarkIndex = url.indexOf(
|
|
7547
|
+
const hashmarkIndex = url.indexOf('#');
|
|
7269
7548
|
|
|
7270
7549
|
if (hashmarkIndex !== -1) {
|
|
7271
7550
|
url = url.slice(0, hashmarkIndex);
|
|
@@ -7286,6 +7565,7 @@ class InterceptorManager {
|
|
|
7286
7565
|
*
|
|
7287
7566
|
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
7288
7567
|
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
7568
|
+
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
|
7289
7569
|
*
|
|
7290
7570
|
* @return {Number} An ID used to remove interceptor later
|
|
7291
7571
|
*/
|
|
@@ -7294,7 +7574,7 @@ class InterceptorManager {
|
|
|
7294
7574
|
fulfilled,
|
|
7295
7575
|
rejected,
|
|
7296
7576
|
synchronous: options ? options.synchronous : false,
|
|
7297
|
-
runWhen: options ? options.runWhen : null
|
|
7577
|
+
runWhen: options ? options.runWhen : null,
|
|
7298
7578
|
});
|
|
7299
7579
|
return this.handlers.length - 1;
|
|
7300
7580
|
}
|
|
@@ -7304,7 +7584,7 @@ class InterceptorManager {
|
|
|
7304
7584
|
*
|
|
7305
7585
|
* @param {Number} id The ID that was returned by `use`
|
|
7306
7586
|
*
|
|
7307
|
-
* @returns {
|
|
7587
|
+
* @returns {void}
|
|
7308
7588
|
*/
|
|
7309
7589
|
eject(id) {
|
|
7310
7590
|
if (this.handlers[id]) {
|
|
@@ -7347,7 +7627,8 @@ var InterceptorManager$1 = InterceptorManager;
|
|
|
7347
7627
|
var transitionalDefaults = {
|
|
7348
7628
|
silentJSONParsing: true,
|
|
7349
7629
|
forcedJSONParsing: true,
|
|
7350
|
-
clarifyTimeoutError: false
|
|
7630
|
+
clarifyTimeoutError: false,
|
|
7631
|
+
legacyInterceptorReqResOrdering: true,
|
|
7351
7632
|
};
|
|
7352
7633
|
|
|
7353
7634
|
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
@@ -7361,14 +7642,14 @@ var platform$1 = {
|
|
|
7361
7642
|
classes: {
|
|
7362
7643
|
URLSearchParams: URLSearchParams$1,
|
|
7363
7644
|
FormData: FormData$1,
|
|
7364
|
-
Blob: Blob$1
|
|
7645
|
+
Blob: Blob$1,
|
|
7365
7646
|
},
|
|
7366
|
-
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
|
7647
|
+
protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
|
|
7367
7648
|
};
|
|
7368
7649
|
|
|
7369
7650
|
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
7370
7651
|
|
|
7371
|
-
const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
7652
|
+
const _navigator = (typeof navigator === 'object' && navigator) || undefined;
|
|
7372
7653
|
|
|
7373
7654
|
/**
|
|
7374
7655
|
* Determine if we're running in a standard browser environment
|
|
@@ -7387,7 +7668,8 @@ const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
|
7387
7668
|
*
|
|
7388
7669
|
* @returns {boolean}
|
|
7389
7670
|
*/
|
|
7390
|
-
const hasStandardBrowserEnv =
|
|
7671
|
+
const hasStandardBrowserEnv =
|
|
7672
|
+
hasBrowserEnv &&
|
|
7391
7673
|
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
|
7392
7674
|
|
|
7393
7675
|
/**
|
|
@@ -7408,7 +7690,7 @@ const hasStandardBrowserWebWorkerEnv = (() => {
|
|
|
7408
7690
|
);
|
|
7409
7691
|
})();
|
|
7410
7692
|
|
|
7411
|
-
const origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
7693
|
+
const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
|
|
7412
7694
|
|
|
7413
7695
|
var utils = /*#__PURE__*/Object.freeze({
|
|
7414
7696
|
__proto__: null,
|
|
@@ -7421,20 +7703,21 @@ var utils = /*#__PURE__*/Object.freeze({
|
|
|
7421
7703
|
|
|
7422
7704
|
var platform = {
|
|
7423
7705
|
...utils,
|
|
7424
|
-
...platform$1
|
|
7706
|
+
...platform$1,
|
|
7425
7707
|
};
|
|
7426
7708
|
|
|
7427
7709
|
function toURLEncodedForm(data, options) {
|
|
7428
|
-
return toFormData(data, new platform.classes.URLSearchParams(),
|
|
7429
|
-
visitor: function(value, key, path, helpers) {
|
|
7710
|
+
return toFormData(data, new platform.classes.URLSearchParams(), {
|
|
7711
|
+
visitor: function (value, key, path, helpers) {
|
|
7430
7712
|
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
7431
7713
|
this.append(key, value.toString('base64'));
|
|
7432
7714
|
return false;
|
|
7433
7715
|
}
|
|
7434
7716
|
|
|
7435
7717
|
return helpers.defaultVisitor.apply(this, arguments);
|
|
7436
|
-
}
|
|
7437
|
-
|
|
7718
|
+
},
|
|
7719
|
+
...options,
|
|
7720
|
+
});
|
|
7438
7721
|
}
|
|
7439
7722
|
|
|
7440
7723
|
/**
|
|
@@ -7449,7 +7732,7 @@ function parsePropPath(name) {
|
|
|
7449
7732
|
// foo.x.y.z
|
|
7450
7733
|
// foo-x-y-z
|
|
7451
7734
|
// foo x y z
|
|
7452
|
-
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
7735
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
7453
7736
|
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
7454
7737
|
});
|
|
7455
7738
|
}
|
|
@@ -7553,96 +7836,107 @@ function stringifySafely(rawValue, parser, encoder) {
|
|
|
7553
7836
|
}
|
|
7554
7837
|
|
|
7555
7838
|
const defaults = {
|
|
7556
|
-
|
|
7557
7839
|
transitional: transitionalDefaults,
|
|
7558
7840
|
|
|
7559
7841
|
adapter: ['xhr', 'http', 'fetch'],
|
|
7560
7842
|
|
|
7561
|
-
transformRequest: [
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7843
|
+
transformRequest: [
|
|
7844
|
+
function transformRequest(data, headers) {
|
|
7845
|
+
const contentType = headers.getContentType() || '';
|
|
7846
|
+
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
7847
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
7565
7848
|
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7849
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
7850
|
+
data = new FormData(data);
|
|
7851
|
+
}
|
|
7569
7852
|
|
|
7570
|
-
|
|
7853
|
+
const isFormData = utils$1.isFormData(data);
|
|
7571
7854
|
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7855
|
+
if (isFormData) {
|
|
7856
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
7857
|
+
}
|
|
7575
7858
|
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7859
|
+
if (
|
|
7860
|
+
utils$1.isArrayBuffer(data) ||
|
|
7861
|
+
utils$1.isBuffer(data) ||
|
|
7862
|
+
utils$1.isStream(data) ||
|
|
7863
|
+
utils$1.isFile(data) ||
|
|
7864
|
+
utils$1.isBlob(data) ||
|
|
7865
|
+
utils$1.isReadableStream(data)
|
|
7866
|
+
) {
|
|
7867
|
+
return data;
|
|
7868
|
+
}
|
|
7869
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
7870
|
+
return data.buffer;
|
|
7871
|
+
}
|
|
7872
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
7873
|
+
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
7874
|
+
return data.toString();
|
|
7875
|
+
}
|
|
7592
7876
|
|
|
7593
|
-
|
|
7877
|
+
let isFileList;
|
|
7594
7878
|
|
|
7595
|
-
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
|
|
7879
|
+
if (isObjectPayload) {
|
|
7880
|
+
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
7881
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
7882
|
+
}
|
|
7599
7883
|
|
|
7600
|
-
|
|
7601
|
-
|
|
7884
|
+
if (
|
|
7885
|
+
(isFileList = utils$1.isFileList(data)) ||
|
|
7886
|
+
contentType.indexOf('multipart/form-data') > -1
|
|
7887
|
+
) {
|
|
7888
|
+
const _FormData = this.env && this.env.FormData;
|
|
7602
7889
|
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
|
|
7890
|
+
return toFormData(
|
|
7891
|
+
isFileList ? { 'files[]': data } : data,
|
|
7892
|
+
_FormData && new _FormData(),
|
|
7893
|
+
this.formSerializer
|
|
7894
|
+
);
|
|
7895
|
+
}
|
|
7608
7896
|
}
|
|
7609
|
-
}
|
|
7610
7897
|
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7898
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
7899
|
+
headers.setContentType('application/json', false);
|
|
7900
|
+
return stringifySafely(data);
|
|
7901
|
+
}
|
|
7615
7902
|
|
|
7616
|
-
|
|
7617
|
-
|
|
7903
|
+
return data;
|
|
7904
|
+
},
|
|
7905
|
+
],
|
|
7618
7906
|
|
|
7619
|
-
transformResponse: [
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7907
|
+
transformResponse: [
|
|
7908
|
+
function transformResponse(data) {
|
|
7909
|
+
const transitional = this.transitional || defaults.transitional;
|
|
7910
|
+
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
7911
|
+
const JSONRequested = this.responseType === 'json';
|
|
7623
7912
|
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7913
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
7914
|
+
return data;
|
|
7915
|
+
}
|
|
7627
7916
|
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7917
|
+
if (
|
|
7918
|
+
data &&
|
|
7919
|
+
utils$1.isString(data) &&
|
|
7920
|
+
((forcedJSONParsing && !this.responseType) || JSONRequested)
|
|
7921
|
+
) {
|
|
7922
|
+
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
7923
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
7631
7924
|
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
|
|
7925
|
+
try {
|
|
7926
|
+
return JSON.parse(data, this.parseReviver);
|
|
7927
|
+
} catch (e) {
|
|
7928
|
+
if (strictJSONParsing) {
|
|
7929
|
+
if (e.name === 'SyntaxError') {
|
|
7930
|
+
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
7931
|
+
}
|
|
7932
|
+
throw e;
|
|
7638
7933
|
}
|
|
7639
|
-
throw e;
|
|
7640
7934
|
}
|
|
7641
7935
|
}
|
|
7642
|
-
}
|
|
7643
7936
|
|
|
7644
|
-
|
|
7645
|
-
|
|
7937
|
+
return data;
|
|
7938
|
+
},
|
|
7939
|
+
],
|
|
7646
7940
|
|
|
7647
7941
|
/**
|
|
7648
7942
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
@@ -7658,7 +7952,7 @@ const defaults = {
|
|
|
7658
7952
|
|
|
7659
7953
|
env: {
|
|
7660
7954
|
FormData: platform.classes.FormData,
|
|
7661
|
-
Blob: platform.classes.Blob
|
|
7955
|
+
Blob: platform.classes.Blob,
|
|
7662
7956
|
},
|
|
7663
7957
|
|
|
7664
7958
|
validateStatus: function validateStatus(status) {
|
|
@@ -7667,10 +7961,10 @@ const defaults = {
|
|
|
7667
7961
|
|
|
7668
7962
|
headers: {
|
|
7669
7963
|
common: {
|
|
7670
|
-
|
|
7671
|
-
'Content-Type': undefined
|
|
7672
|
-
}
|
|
7673
|
-
}
|
|
7964
|
+
Accept: 'application/json, text/plain, */*',
|
|
7965
|
+
'Content-Type': undefined,
|
|
7966
|
+
},
|
|
7967
|
+
},
|
|
7674
7968
|
};
|
|
7675
7969
|
|
|
7676
7970
|
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
@@ -7682,10 +7976,23 @@ var defaults$1 = defaults;
|
|
|
7682
7976
|
// RawAxiosHeaders whose duplicates are ignored by node
|
|
7683
7977
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
7684
7978
|
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
7685
|
-
'age',
|
|
7686
|
-
'
|
|
7687
|
-
'
|
|
7688
|
-
'
|
|
7979
|
+
'age',
|
|
7980
|
+
'authorization',
|
|
7981
|
+
'content-length',
|
|
7982
|
+
'content-type',
|
|
7983
|
+
'etag',
|
|
7984
|
+
'expires',
|
|
7985
|
+
'from',
|
|
7986
|
+
'host',
|
|
7987
|
+
'if-modified-since',
|
|
7988
|
+
'if-unmodified-since',
|
|
7989
|
+
'last-modified',
|
|
7990
|
+
'location',
|
|
7991
|
+
'max-forwards',
|
|
7992
|
+
'proxy-authorization',
|
|
7993
|
+
'referer',
|
|
7994
|
+
'retry-after',
|
|
7995
|
+
'user-agent',
|
|
7689
7996
|
]);
|
|
7690
7997
|
|
|
7691
7998
|
/**
|
|
@@ -7702,31 +8009,32 @@ const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
|
7702
8009
|
*
|
|
7703
8010
|
* @returns {Object} Headers parsed into an object
|
|
7704
8011
|
*/
|
|
7705
|
-
var parseHeaders = rawHeaders => {
|
|
8012
|
+
var parseHeaders = (rawHeaders) => {
|
|
7706
8013
|
const parsed = {};
|
|
7707
8014
|
let key;
|
|
7708
8015
|
let val;
|
|
7709
8016
|
let i;
|
|
7710
8017
|
|
|
7711
|
-
rawHeaders &&
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
8018
|
+
rawHeaders &&
|
|
8019
|
+
rawHeaders.split('\n').forEach(function parser(line) {
|
|
8020
|
+
i = line.indexOf(':');
|
|
8021
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
8022
|
+
val = line.substring(i + 1).trim();
|
|
7715
8023
|
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
8024
|
+
if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
|
|
8025
|
+
return;
|
|
8026
|
+
}
|
|
7719
8027
|
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
8028
|
+
if (key === 'set-cookie') {
|
|
8029
|
+
if (parsed[key]) {
|
|
8030
|
+
parsed[key].push(val);
|
|
8031
|
+
} else {
|
|
8032
|
+
parsed[key] = [val];
|
|
8033
|
+
}
|
|
7723
8034
|
} else {
|
|
7724
|
-
parsed[key] = [val
|
|
8035
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
7725
8036
|
}
|
|
7726
|
-
}
|
|
7727
|
-
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
7728
|
-
}
|
|
7729
|
-
});
|
|
8037
|
+
});
|
|
7730
8038
|
|
|
7731
8039
|
return parsed;
|
|
7732
8040
|
};
|
|
@@ -7780,8 +8088,10 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
|
7780
8088
|
}
|
|
7781
8089
|
|
|
7782
8090
|
function formatHeader(header) {
|
|
7783
|
-
return header
|
|
7784
|
-
.
|
|
8091
|
+
return header
|
|
8092
|
+
.trim()
|
|
8093
|
+
.toLowerCase()
|
|
8094
|
+
.replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
7785
8095
|
return char.toUpperCase() + str;
|
|
7786
8096
|
});
|
|
7787
8097
|
}
|
|
@@ -7789,12 +8099,12 @@ function formatHeader(header) {
|
|
|
7789
8099
|
function buildAccessors(obj, header) {
|
|
7790
8100
|
const accessorName = utils$1.toCamelCase(' ' + header);
|
|
7791
8101
|
|
|
7792
|
-
['get', 'set', 'has'].forEach(methodName => {
|
|
8102
|
+
['get', 'set', 'has'].forEach((methodName) => {
|
|
7793
8103
|
Object.defineProperty(obj, methodName + accessorName, {
|
|
7794
|
-
value: function(arg1, arg2, arg3) {
|
|
8104
|
+
value: function (arg1, arg2, arg3) {
|
|
7795
8105
|
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
7796
8106
|
},
|
|
7797
|
-
configurable: true
|
|
8107
|
+
configurable: true,
|
|
7798
8108
|
});
|
|
7799
8109
|
});
|
|
7800
8110
|
}
|
|
@@ -7816,7 +8126,12 @@ class AxiosHeaders {
|
|
|
7816
8126
|
|
|
7817
8127
|
const key = utils$1.findKey(self, lHeader);
|
|
7818
8128
|
|
|
7819
|
-
if
|
|
8129
|
+
if (
|
|
8130
|
+
!key ||
|
|
8131
|
+
self[key] === undefined ||
|
|
8132
|
+
_rewrite === true ||
|
|
8133
|
+
(_rewrite === undefined && self[key] !== false)
|
|
8134
|
+
) {
|
|
7820
8135
|
self[key || _header] = normalizeValue(_value);
|
|
7821
8136
|
}
|
|
7822
8137
|
}
|
|
@@ -7826,12 +8141,25 @@ class AxiosHeaders {
|
|
|
7826
8141
|
|
|
7827
8142
|
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
7828
8143
|
setHeaders(header, valueOrRewrite);
|
|
7829
|
-
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
8144
|
+
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
7830
8145
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
7831
|
-
} else if (utils$1.
|
|
7832
|
-
|
|
7833
|
-
|
|
8146
|
+
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
8147
|
+
let obj = {},
|
|
8148
|
+
dest,
|
|
8149
|
+
key;
|
|
8150
|
+
for (const entry of header) {
|
|
8151
|
+
if (!utils$1.isArray(entry)) {
|
|
8152
|
+
throw TypeError('Object iterator must return a key-value pair');
|
|
8153
|
+
}
|
|
8154
|
+
|
|
8155
|
+
obj[(key = entry[0])] = (dest = obj[key])
|
|
8156
|
+
? utils$1.isArray(dest)
|
|
8157
|
+
? [...dest, entry[1]]
|
|
8158
|
+
: [dest, entry[1]]
|
|
8159
|
+
: entry[1];
|
|
7834
8160
|
}
|
|
8161
|
+
|
|
8162
|
+
setHeaders(obj, valueOrRewrite);
|
|
7835
8163
|
} else {
|
|
7836
8164
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
7837
8165
|
}
|
|
@@ -7875,7 +8203,11 @@ class AxiosHeaders {
|
|
|
7875
8203
|
if (header) {
|
|
7876
8204
|
const key = utils$1.findKey(this, header);
|
|
7877
8205
|
|
|
7878
|
-
return !!(
|
|
8206
|
+
return !!(
|
|
8207
|
+
key &&
|
|
8208
|
+
this[key] !== undefined &&
|
|
8209
|
+
(!matcher || matchHeaderValue(this, this[key], key, matcher))
|
|
8210
|
+
);
|
|
7879
8211
|
}
|
|
7880
8212
|
|
|
7881
8213
|
return false;
|
|
@@ -7915,7 +8247,7 @@ class AxiosHeaders {
|
|
|
7915
8247
|
|
|
7916
8248
|
while (i--) {
|
|
7917
8249
|
const key = keys[i];
|
|
7918
|
-
if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
8250
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
7919
8251
|
delete this[key];
|
|
7920
8252
|
deleted = true;
|
|
7921
8253
|
}
|
|
@@ -7959,7 +8291,9 @@ class AxiosHeaders {
|
|
|
7959
8291
|
const obj = Object.create(null);
|
|
7960
8292
|
|
|
7961
8293
|
utils$1.forEach(this, (value, header) => {
|
|
7962
|
-
value != null &&
|
|
8294
|
+
value != null &&
|
|
8295
|
+
value !== false &&
|
|
8296
|
+
(obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
|
|
7963
8297
|
});
|
|
7964
8298
|
|
|
7965
8299
|
return obj;
|
|
@@ -7970,7 +8304,13 @@ class AxiosHeaders {
|
|
|
7970
8304
|
}
|
|
7971
8305
|
|
|
7972
8306
|
toString() {
|
|
7973
|
-
return Object.entries(this.toJSON())
|
|
8307
|
+
return Object.entries(this.toJSON())
|
|
8308
|
+
.map(([header, value]) => header + ': ' + value)
|
|
8309
|
+
.join('\n');
|
|
8310
|
+
}
|
|
8311
|
+
|
|
8312
|
+
getSetCookie() {
|
|
8313
|
+
return this.get('set-cookie') || [];
|
|
7974
8314
|
}
|
|
7975
8315
|
|
|
7976
8316
|
get [Symbol.toStringTag]() {
|
|
@@ -7990,9 +8330,12 @@ class AxiosHeaders {
|
|
|
7990
8330
|
}
|
|
7991
8331
|
|
|
7992
8332
|
static accessor(header) {
|
|
7993
|
-
const internals =
|
|
7994
|
-
|
|
7995
|
-
|
|
8333
|
+
const internals =
|
|
8334
|
+
(this[$internals] =
|
|
8335
|
+
this[$internals] =
|
|
8336
|
+
{
|
|
8337
|
+
accessors: {},
|
|
8338
|
+
});
|
|
7996
8339
|
|
|
7997
8340
|
const accessors = internals.accessors;
|
|
7998
8341
|
const prototype = this.prototype;
|
|
@@ -8012,17 +8355,24 @@ class AxiosHeaders {
|
|
|
8012
8355
|
}
|
|
8013
8356
|
}
|
|
8014
8357
|
|
|
8015
|
-
AxiosHeaders.accessor([
|
|
8358
|
+
AxiosHeaders.accessor([
|
|
8359
|
+
'Content-Type',
|
|
8360
|
+
'Content-Length',
|
|
8361
|
+
'Accept',
|
|
8362
|
+
'Accept-Encoding',
|
|
8363
|
+
'User-Agent',
|
|
8364
|
+
'Authorization',
|
|
8365
|
+
]);
|
|
8016
8366
|
|
|
8017
8367
|
// reserved names hotfix
|
|
8018
|
-
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
|
8368
|
+
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
|
|
8019
8369
|
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
8020
8370
|
return {
|
|
8021
8371
|
get: () => value,
|
|
8022
8372
|
set(headerValue) {
|
|
8023
8373
|
this[mapped] = headerValue;
|
|
8024
|
-
}
|
|
8025
|
-
}
|
|
8374
|
+
},
|
|
8375
|
+
};
|
|
8026
8376
|
});
|
|
8027
8377
|
|
|
8028
8378
|
utils$1.freezeMethods(AxiosHeaders);
|
|
@@ -8056,24 +8406,24 @@ function isCancel(value) {
|
|
|
8056
8406
|
return !!(value && value.__CANCEL__);
|
|
8057
8407
|
}
|
|
8058
8408
|
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8409
|
+
class CanceledError extends AxiosError$1 {
|
|
8410
|
+
/**
|
|
8411
|
+
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
8412
|
+
*
|
|
8413
|
+
* @param {string=} message The message.
|
|
8414
|
+
* @param {Object=} config The config.
|
|
8415
|
+
* @param {Object=} request The request.
|
|
8416
|
+
*
|
|
8417
|
+
* @returns {CanceledError} The created error.
|
|
8418
|
+
*/
|
|
8419
|
+
constructor(message, config, request) {
|
|
8420
|
+
super(message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
|
|
8421
|
+
this.name = 'CanceledError';
|
|
8422
|
+
this.__CANCEL__ = true;
|
|
8423
|
+
}
|
|
8072
8424
|
}
|
|
8073
8425
|
|
|
8074
|
-
|
|
8075
|
-
__CANCEL__: true
|
|
8076
|
-
});
|
|
8426
|
+
var CanceledError$1 = CanceledError;
|
|
8077
8427
|
|
|
8078
8428
|
/**
|
|
8079
8429
|
* Resolve or reject a Promise based on response status.
|
|
@@ -8089,19 +8439,23 @@ function settle(resolve, reject, response) {
|
|
|
8089
8439
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
8090
8440
|
resolve(response);
|
|
8091
8441
|
} else {
|
|
8092
|
-
reject(
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8098
|
-
|
|
8442
|
+
reject(
|
|
8443
|
+
new AxiosError$1(
|
|
8444
|
+
'Request failed with status code ' + response.status,
|
|
8445
|
+
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][
|
|
8446
|
+
Math.floor(response.status / 100) - 4
|
|
8447
|
+
],
|
|
8448
|
+
response.config,
|
|
8449
|
+
response.request,
|
|
8450
|
+
response
|
|
8451
|
+
)
|
|
8452
|
+
);
|
|
8099
8453
|
}
|
|
8100
8454
|
}
|
|
8101
8455
|
|
|
8102
8456
|
function parseProtocol(url) {
|
|
8103
8457
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
8104
|
-
return match && match[1] || '';
|
|
8458
|
+
return (match && match[1]) || '';
|
|
8105
8459
|
}
|
|
8106
8460
|
|
|
8107
8461
|
/**
|
|
@@ -8152,7 +8506,7 @@ function speedometer(samplesCount, min) {
|
|
|
8152
8506
|
|
|
8153
8507
|
const passed = startedAt && now - startedAt;
|
|
8154
8508
|
|
|
8155
|
-
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
8509
|
+
return passed ? Math.round((bytesCount * 1000) / passed) : undefined;
|
|
8156
8510
|
};
|
|
8157
8511
|
}
|
|
8158
8512
|
|
|
@@ -8175,13 +8529,13 @@ function throttle(fn, freq) {
|
|
|
8175
8529
|
clearTimeout(timer);
|
|
8176
8530
|
timer = null;
|
|
8177
8531
|
}
|
|
8178
|
-
fn
|
|
8532
|
+
fn(...args);
|
|
8179
8533
|
};
|
|
8180
8534
|
|
|
8181
8535
|
const throttled = (...args) => {
|
|
8182
8536
|
const now = Date.now();
|
|
8183
8537
|
const passed = now - timestamp;
|
|
8184
|
-
if (
|
|
8538
|
+
if (passed >= threshold) {
|
|
8185
8539
|
invoke(args, now);
|
|
8186
8540
|
} else {
|
|
8187
8541
|
lastArgs = args;
|
|
@@ -8203,7 +8557,7 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
8203
8557
|
let bytesNotified = 0;
|
|
8204
8558
|
const _speedometer = speedometer(50, 250);
|
|
8205
8559
|
|
|
8206
|
-
return throttle(e => {
|
|
8560
|
+
return throttle((e) => {
|
|
8207
8561
|
const loaded = e.loaded;
|
|
8208
8562
|
const total = e.lengthComputable ? e.total : undefined;
|
|
8209
8563
|
const progressBytes = loaded - bytesNotified;
|
|
@@ -8215,13 +8569,13 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
8215
8569
|
const data = {
|
|
8216
8570
|
loaded,
|
|
8217
8571
|
total,
|
|
8218
|
-
progress: total ?
|
|
8572
|
+
progress: total ? loaded / total : undefined,
|
|
8219
8573
|
bytes: progressBytes,
|
|
8220
8574
|
rate: rate ? rate : undefined,
|
|
8221
8575
|
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
8222
8576
|
event: e,
|
|
8223
8577
|
lengthComputable: total != null,
|
|
8224
|
-
[isDownloadStream ? 'download' : 'upload']: true
|
|
8578
|
+
[isDownloadStream ? 'download' : 'upload']: true,
|
|
8225
8579
|
};
|
|
8226
8580
|
|
|
8227
8581
|
listener(data);
|
|
@@ -8231,66 +8585,82 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
8231
8585
|
const progressEventDecorator = (total, throttled) => {
|
|
8232
8586
|
const lengthComputable = total != null;
|
|
8233
8587
|
|
|
8234
|
-
return [
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
|
|
8238
|
-
|
|
8588
|
+
return [
|
|
8589
|
+
(loaded) =>
|
|
8590
|
+
throttled[0]({
|
|
8591
|
+
lengthComputable,
|
|
8592
|
+
total,
|
|
8593
|
+
loaded,
|
|
8594
|
+
}),
|
|
8595
|
+
throttled[1],
|
|
8596
|
+
];
|
|
8239
8597
|
};
|
|
8240
8598
|
|
|
8241
|
-
const asyncDecorator =
|
|
8599
|
+
const asyncDecorator =
|
|
8600
|
+
(fn) =>
|
|
8601
|
+
(...args) =>
|
|
8602
|
+
utils$1.asap(() => fn(...args));
|
|
8242
8603
|
|
|
8243
|
-
var isURLSameOrigin = platform.hasStandardBrowserEnv
|
|
8244
|
-
|
|
8604
|
+
var isURLSameOrigin = platform.hasStandardBrowserEnv
|
|
8605
|
+
? ((origin, isMSIE) => (url) => {
|
|
8606
|
+
url = new URL(url, platform.origin);
|
|
8245
8607
|
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
})(
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
)
|
|
8255
|
-
|
|
8256
|
-
var cookies = platform.hasStandardBrowserEnv ?
|
|
8257
|
-
|
|
8258
|
-
// Standard browser envs support document.cookie
|
|
8259
|
-
{
|
|
8260
|
-
write(name, value, expires, path, domain, secure) {
|
|
8261
|
-
const cookie = [name + '=' + encodeURIComponent(value)];
|
|
8262
|
-
|
|
8263
|
-
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
|
8608
|
+
return (
|
|
8609
|
+
origin.protocol === url.protocol &&
|
|
8610
|
+
origin.host === url.host &&
|
|
8611
|
+
(isMSIE || origin.port === url.port)
|
|
8612
|
+
);
|
|
8613
|
+
})(
|
|
8614
|
+
new URL(platform.origin),
|
|
8615
|
+
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
8616
|
+
)
|
|
8617
|
+
: () => true;
|
|
8264
8618
|
|
|
8265
|
-
|
|
8619
|
+
var cookies = platform.hasStandardBrowserEnv
|
|
8620
|
+
? // Standard browser envs support document.cookie
|
|
8621
|
+
{
|
|
8622
|
+
write(name, value, expires, path, domain, secure, sameSite) {
|
|
8623
|
+
if (typeof document === 'undefined') return;
|
|
8266
8624
|
|
|
8267
|
-
|
|
8625
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
8268
8626
|
|
|
8269
|
-
|
|
8627
|
+
if (utils$1.isNumber(expires)) {
|
|
8628
|
+
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
8629
|
+
}
|
|
8630
|
+
if (utils$1.isString(path)) {
|
|
8631
|
+
cookie.push(`path=${path}`);
|
|
8632
|
+
}
|
|
8633
|
+
if (utils$1.isString(domain)) {
|
|
8634
|
+
cookie.push(`domain=${domain}`);
|
|
8635
|
+
}
|
|
8636
|
+
if (secure === true) {
|
|
8637
|
+
cookie.push('secure');
|
|
8638
|
+
}
|
|
8639
|
+
if (utils$1.isString(sameSite)) {
|
|
8640
|
+
cookie.push(`SameSite=${sameSite}`);
|
|
8641
|
+
}
|
|
8270
8642
|
|
|
8271
|
-
|
|
8272
|
-
|
|
8643
|
+
document.cookie = cookie.join('; ');
|
|
8644
|
+
},
|
|
8273
8645
|
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8646
|
+
read(name) {
|
|
8647
|
+
if (typeof document === 'undefined') return null;
|
|
8648
|
+
const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
|
|
8649
|
+
return match ? decodeURIComponent(match[1]) : null;
|
|
8650
|
+
},
|
|
8278
8651
|
|
|
8279
|
-
|
|
8280
|
-
|
|
8652
|
+
remove(name) {
|
|
8653
|
+
this.write(name, '', Date.now() - 86400000, '/');
|
|
8654
|
+
},
|
|
8281
8655
|
}
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
|
|
8286
|
-
|
|
8287
|
-
|
|
8288
|
-
|
|
8289
|
-
|
|
8290
|
-
return null;
|
|
8291
|
-
},
|
|
8292
|
-
remove() {}
|
|
8293
|
-
};
|
|
8656
|
+
: // Non-standard browser env (web workers, react-native) lack needed support.
|
|
8657
|
+
{
|
|
8658
|
+
write() {},
|
|
8659
|
+
read() {
|
|
8660
|
+
return null;
|
|
8661
|
+
},
|
|
8662
|
+
remove() {},
|
|
8663
|
+
};
|
|
8294
8664
|
|
|
8295
8665
|
/**
|
|
8296
8666
|
* Determines whether the specified URL is absolute
|
|
@@ -8303,6 +8673,10 @@ function isAbsoluteURL(url) {
|
|
|
8303
8673
|
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
8304
8674
|
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
8305
8675
|
// by any combination of letters, digits, plus, period, or hyphen.
|
|
8676
|
+
if (typeof url !== 'string') {
|
|
8677
|
+
return false;
|
|
8678
|
+
}
|
|
8679
|
+
|
|
8306
8680
|
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
8307
8681
|
}
|
|
8308
8682
|
|
|
@@ -8338,7 +8712,7 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
|
8338
8712
|
return requestedURL;
|
|
8339
8713
|
}
|
|
8340
8714
|
|
|
8341
|
-
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
|
|
8715
|
+
const headersToObject = (thing) => (thing instanceof AxiosHeaders$1 ? { ...thing } : thing);
|
|
8342
8716
|
|
|
8343
8717
|
/**
|
|
8344
8718
|
* Config-specific merge-function which creates a new config-object
|
|
@@ -8356,7 +8730,7 @@ function mergeConfig(config1, config2) {
|
|
|
8356
8730
|
|
|
8357
8731
|
function getMergedValue(target, source, prop, caseless) {
|
|
8358
8732
|
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
8359
|
-
return utils$1.merge.call({caseless}, target, source);
|
|
8733
|
+
return utils$1.merge.call({ caseless }, target, source);
|
|
8360
8734
|
} else if (utils$1.isPlainObject(source)) {
|
|
8361
8735
|
return utils$1.merge({}, source);
|
|
8362
8736
|
} else if (utils$1.isArray(source)) {
|
|
@@ -8365,12 +8739,11 @@ function mergeConfig(config1, config2) {
|
|
|
8365
8739
|
return source;
|
|
8366
8740
|
}
|
|
8367
8741
|
|
|
8368
|
-
|
|
8369
|
-
function mergeDeepProperties(a, b, prop , caseless) {
|
|
8742
|
+
function mergeDeepProperties(a, b, prop, caseless) {
|
|
8370
8743
|
if (!utils$1.isUndefined(b)) {
|
|
8371
|
-
return getMergedValue(a, b, prop
|
|
8744
|
+
return getMergedValue(a, b, prop, caseless);
|
|
8372
8745
|
} else if (!utils$1.isUndefined(a)) {
|
|
8373
|
-
return getMergedValue(undefined, a, prop
|
|
8746
|
+
return getMergedValue(undefined, a, prop, caseless);
|
|
8374
8747
|
}
|
|
8375
8748
|
}
|
|
8376
8749
|
|
|
@@ -8428,11 +8801,13 @@ function mergeConfig(config1, config2) {
|
|
|
8428
8801
|
socketPath: defaultToConfig2,
|
|
8429
8802
|
responseEncoding: defaultToConfig2,
|
|
8430
8803
|
validateStatus: mergeDirectKeys,
|
|
8431
|
-
headers: (a, b
|
|
8804
|
+
headers: (a, b, prop) =>
|
|
8805
|
+
mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
|
|
8432
8806
|
};
|
|
8433
8807
|
|
|
8434
|
-
utils$1.forEach(Object.keys(
|
|
8435
|
-
|
|
8808
|
+
utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
8809
|
+
if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
|
|
8810
|
+
const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
8436
8811
|
const configValue = merge(config1[prop], config2[prop], prop);
|
|
8437
8812
|
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
8438
8813
|
});
|
|
@@ -8443,28 +8818,42 @@ function mergeConfig(config1, config2) {
|
|
|
8443
8818
|
var resolveConfig = (config) => {
|
|
8444
8819
|
const newConfig = mergeConfig({}, config);
|
|
8445
8820
|
|
|
8446
|
-
let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
|
|
8821
|
+
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
8447
8822
|
|
|
8448
8823
|
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
8449
8824
|
|
|
8450
|
-
newConfig.url = buildURL(
|
|
8825
|
+
newConfig.url = buildURL(
|
|
8826
|
+
buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
|
|
8827
|
+
config.params,
|
|
8828
|
+
config.paramsSerializer
|
|
8829
|
+
);
|
|
8451
8830
|
|
|
8452
8831
|
// HTTP basic authentication
|
|
8453
8832
|
if (auth) {
|
|
8454
|
-
headers.set(
|
|
8455
|
-
|
|
8833
|
+
headers.set(
|
|
8834
|
+
'Authorization',
|
|
8835
|
+
'Basic ' +
|
|
8836
|
+
btoa(
|
|
8837
|
+
(auth.username || '') +
|
|
8838
|
+
':' +
|
|
8839
|
+
(auth.password ? unescape(encodeURIComponent(auth.password)) : '')
|
|
8840
|
+
)
|
|
8456
8841
|
);
|
|
8457
8842
|
}
|
|
8458
8843
|
|
|
8459
|
-
let contentType;
|
|
8460
|
-
|
|
8461
8844
|
if (utils$1.isFormData(data)) {
|
|
8462
8845
|
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
8463
|
-
headers.setContentType(undefined); //
|
|
8464
|
-
} else if ((
|
|
8465
|
-
//
|
|
8466
|
-
const
|
|
8467
|
-
headers
|
|
8846
|
+
headers.setContentType(undefined); // browser handles it
|
|
8847
|
+
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
8848
|
+
// Node.js FormData (like form-data package)
|
|
8849
|
+
const formHeaders = data.getHeaders();
|
|
8850
|
+
// Only set safe headers to avoid overwriting security headers
|
|
8851
|
+
const allowedHeaders = ['content-type', 'content-length'];
|
|
8852
|
+
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
8853
|
+
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
8854
|
+
headers.set(key, val);
|
|
8855
|
+
}
|
|
8856
|
+
});
|
|
8468
8857
|
}
|
|
8469
8858
|
}
|
|
8470
8859
|
|
|
@@ -8490,193 +8879,218 @@ var resolveConfig = (config) => {
|
|
|
8490
8879
|
|
|
8491
8880
|
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
8492
8881
|
|
|
8493
|
-
var xhrAdapter = isXHRAdapterSupported &&
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8882
|
+
var xhrAdapter = isXHRAdapterSupported &&
|
|
8883
|
+
function (config) {
|
|
8884
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
8885
|
+
const _config = resolveConfig(config);
|
|
8886
|
+
let requestData = _config.data;
|
|
8887
|
+
const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
|
|
8888
|
+
let { responseType, onUploadProgress, onDownloadProgress } = _config;
|
|
8889
|
+
let onCanceled;
|
|
8890
|
+
let uploadThrottled, downloadThrottled;
|
|
8891
|
+
let flushUpload, flushDownload;
|
|
8502
8892
|
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
8893
|
+
function done() {
|
|
8894
|
+
flushUpload && flushUpload(); // flush events
|
|
8895
|
+
flushDownload && flushDownload(); // flush events
|
|
8506
8896
|
|
|
8507
|
-
|
|
8897
|
+
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
8508
8898
|
|
|
8509
|
-
|
|
8510
|
-
|
|
8899
|
+
_config.signal && _config.signal.removeEventListener('abort', onCanceled);
|
|
8900
|
+
}
|
|
8511
8901
|
|
|
8512
|
-
|
|
8902
|
+
let request = new XMLHttpRequest();
|
|
8513
8903
|
|
|
8514
|
-
|
|
8904
|
+
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
8515
8905
|
|
|
8516
|
-
|
|
8517
|
-
|
|
8906
|
+
// Set the request timeout in MS
|
|
8907
|
+
request.timeout = _config.timeout;
|
|
8518
8908
|
|
|
8519
|
-
|
|
8520
|
-
|
|
8521
|
-
|
|
8909
|
+
function onloadend() {
|
|
8910
|
+
if (!request) {
|
|
8911
|
+
return;
|
|
8912
|
+
}
|
|
8913
|
+
// Prepare the response
|
|
8914
|
+
const responseHeaders = AxiosHeaders$1.from(
|
|
8915
|
+
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
8916
|
+
);
|
|
8917
|
+
const responseData =
|
|
8918
|
+
!responseType || responseType === 'text' || responseType === 'json'
|
|
8919
|
+
? request.responseText
|
|
8920
|
+
: request.response;
|
|
8921
|
+
const response = {
|
|
8922
|
+
data: responseData,
|
|
8923
|
+
status: request.status,
|
|
8924
|
+
statusText: request.statusText,
|
|
8925
|
+
headers: responseHeaders,
|
|
8926
|
+
config,
|
|
8927
|
+
request,
|
|
8928
|
+
};
|
|
8929
|
+
|
|
8930
|
+
settle(
|
|
8931
|
+
function _resolve(value) {
|
|
8932
|
+
resolve(value);
|
|
8933
|
+
done();
|
|
8934
|
+
},
|
|
8935
|
+
function _reject(err) {
|
|
8936
|
+
reject(err);
|
|
8937
|
+
done();
|
|
8938
|
+
},
|
|
8939
|
+
response
|
|
8940
|
+
);
|
|
8941
|
+
|
|
8942
|
+
// Clean up request
|
|
8943
|
+
request = null;
|
|
8522
8944
|
}
|
|
8523
|
-
// Prepare the response
|
|
8524
|
-
const responseHeaders = AxiosHeaders$1.from(
|
|
8525
|
-
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
8526
|
-
);
|
|
8527
|
-
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
|
8528
|
-
request.responseText : request.response;
|
|
8529
|
-
const response = {
|
|
8530
|
-
data: responseData,
|
|
8531
|
-
status: request.status,
|
|
8532
|
-
statusText: request.statusText,
|
|
8533
|
-
headers: responseHeaders,
|
|
8534
|
-
config,
|
|
8535
|
-
request
|
|
8536
|
-
};
|
|
8537
8945
|
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
}
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8946
|
+
if ('onloadend' in request) {
|
|
8947
|
+
// Use onloadend if available
|
|
8948
|
+
request.onloadend = onloadend;
|
|
8949
|
+
} else {
|
|
8950
|
+
// Listen for ready state to emulate onloadend
|
|
8951
|
+
request.onreadystatechange = function handleLoad() {
|
|
8952
|
+
if (!request || request.readyState !== 4) {
|
|
8953
|
+
return;
|
|
8954
|
+
}
|
|
8545
8955
|
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
|
|
8956
|
+
// The request errored out and we didn't get a response, this will be
|
|
8957
|
+
// handled by onerror instead
|
|
8958
|
+
// With one exception: request that using file: protocol, most browsers
|
|
8959
|
+
// will return status as 0 even though it's a successful request
|
|
8960
|
+
if (
|
|
8961
|
+
request.status === 0 &&
|
|
8962
|
+
!(request.responseURL && request.responseURL.indexOf('file:') === 0)
|
|
8963
|
+
) {
|
|
8964
|
+
return;
|
|
8965
|
+
}
|
|
8966
|
+
// readystate handler is calling before onerror or ontimeout handlers,
|
|
8967
|
+
// so we should call onloadend on the next 'tick'
|
|
8968
|
+
setTimeout(onloadend);
|
|
8969
|
+
};
|
|
8970
|
+
}
|
|
8549
8971
|
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
} else {
|
|
8554
|
-
// Listen for ready state to emulate onloadend
|
|
8555
|
-
request.onreadystatechange = function handleLoad() {
|
|
8556
|
-
if (!request || request.readyState !== 4) {
|
|
8972
|
+
// Handle browser request cancellation (as opposed to a manual cancellation)
|
|
8973
|
+
request.onabort = function handleAbort() {
|
|
8974
|
+
if (!request) {
|
|
8557
8975
|
return;
|
|
8558
8976
|
}
|
|
8559
8977
|
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
//
|
|
8563
|
-
|
|
8564
|
-
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
|
8565
|
-
return;
|
|
8566
|
-
}
|
|
8567
|
-
// readystate handler is calling before onerror or ontimeout handlers,
|
|
8568
|
-
// so we should call onloadend on the next 'tick'
|
|
8569
|
-
setTimeout(onloadend);
|
|
8978
|
+
reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
|
|
8979
|
+
|
|
8980
|
+
// Clean up request
|
|
8981
|
+
request = null;
|
|
8570
8982
|
};
|
|
8571
|
-
}
|
|
8572
8983
|
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8984
|
+
// Handle low level network errors
|
|
8985
|
+
request.onerror = function handleError(event) {
|
|
8986
|
+
// Browsers deliver a ProgressEvent in XHR onerror
|
|
8987
|
+
// (message may be empty; when present, surface it)
|
|
8988
|
+
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
8989
|
+
const msg = event && event.message ? event.message : 'Network Error';
|
|
8990
|
+
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
8991
|
+
// attach the underlying event for consumers who want details
|
|
8992
|
+
err.event = event || null;
|
|
8993
|
+
reject(err);
|
|
8994
|
+
request = null;
|
|
8995
|
+
};
|
|
8578
8996
|
|
|
8579
|
-
|
|
8997
|
+
// Handle timeout
|
|
8998
|
+
request.ontimeout = function handleTimeout() {
|
|
8999
|
+
let timeoutErrorMessage = _config.timeout
|
|
9000
|
+
? 'timeout of ' + _config.timeout + 'ms exceeded'
|
|
9001
|
+
: 'timeout exceeded';
|
|
9002
|
+
const transitional = _config.transitional || transitionalDefaults;
|
|
9003
|
+
if (_config.timeoutErrorMessage) {
|
|
9004
|
+
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
9005
|
+
}
|
|
9006
|
+
reject(
|
|
9007
|
+
new AxiosError$1(
|
|
9008
|
+
timeoutErrorMessage,
|
|
9009
|
+
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
9010
|
+
config,
|
|
9011
|
+
request
|
|
9012
|
+
)
|
|
9013
|
+
);
|
|
8580
9014
|
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
9015
|
+
// Clean up request
|
|
9016
|
+
request = null;
|
|
9017
|
+
};
|
|
8584
9018
|
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
// Real errors are hidden from us by the browser
|
|
8588
|
-
// onerror should only fire if it's a network error
|
|
8589
|
-
reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
|
|
9019
|
+
// Remove Content-Type if data is undefined
|
|
9020
|
+
requestData === undefined && requestHeaders.setContentType(null);
|
|
8590
9021
|
|
|
8591
|
-
//
|
|
8592
|
-
request
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
request.ontimeout = function handleTimeout() {
|
|
8597
|
-
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
8598
|
-
const transitional = _config.transitional || transitionalDefaults;
|
|
8599
|
-
if (_config.timeoutErrorMessage) {
|
|
8600
|
-
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
9022
|
+
// Add headers to the request
|
|
9023
|
+
if ('setRequestHeader' in request) {
|
|
9024
|
+
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
9025
|
+
request.setRequestHeader(key, val);
|
|
9026
|
+
});
|
|
8601
9027
|
}
|
|
8602
|
-
reject(new AxiosError(
|
|
8603
|
-
timeoutErrorMessage,
|
|
8604
|
-
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
|
8605
|
-
config,
|
|
8606
|
-
request));
|
|
8607
|
-
|
|
8608
|
-
// Clean up request
|
|
8609
|
-
request = null;
|
|
8610
|
-
};
|
|
8611
|
-
|
|
8612
|
-
// Remove Content-Type if data is undefined
|
|
8613
|
-
requestData === undefined && requestHeaders.setContentType(null);
|
|
8614
9028
|
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8619
|
-
});
|
|
8620
|
-
}
|
|
9029
|
+
// Add withCredentials to request if needed
|
|
9030
|
+
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
9031
|
+
request.withCredentials = !!_config.withCredentials;
|
|
9032
|
+
}
|
|
8621
9033
|
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
9034
|
+
// Add responseType to request if needed
|
|
9035
|
+
if (responseType && responseType !== 'json') {
|
|
9036
|
+
request.responseType = _config.responseType;
|
|
9037
|
+
}
|
|
8626
9038
|
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
9039
|
+
// Handle progress if needed
|
|
9040
|
+
if (onDownloadProgress) {
|
|
9041
|
+
[downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
|
|
9042
|
+
request.addEventListener('progress', downloadThrottled);
|
|
9043
|
+
}
|
|
8631
9044
|
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
request.addEventListener('progress', downloadThrottled);
|
|
8636
|
-
}
|
|
9045
|
+
// Not all browsers support upload events
|
|
9046
|
+
if (onUploadProgress && request.upload) {
|
|
9047
|
+
[uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
|
|
8637
9048
|
|
|
8638
|
-
|
|
8639
|
-
if (onUploadProgress && request.upload) {
|
|
8640
|
-
([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
|
|
9049
|
+
request.upload.addEventListener('progress', uploadThrottled);
|
|
8641
9050
|
|
|
8642
|
-
|
|
9051
|
+
request.upload.addEventListener('loadend', flushUpload);
|
|
9052
|
+
}
|
|
8643
9053
|
|
|
8644
|
-
|
|
8645
|
-
|
|
9054
|
+
if (_config.cancelToken || _config.signal) {
|
|
9055
|
+
// Handle cancellation
|
|
9056
|
+
// eslint-disable-next-line func-names
|
|
9057
|
+
onCanceled = (cancel) => {
|
|
9058
|
+
if (!request) {
|
|
9059
|
+
return;
|
|
9060
|
+
}
|
|
9061
|
+
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
9062
|
+
request.abort();
|
|
9063
|
+
request = null;
|
|
9064
|
+
};
|
|
8646
9065
|
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
return;
|
|
9066
|
+
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
9067
|
+
if (_config.signal) {
|
|
9068
|
+
_config.signal.aborted
|
|
9069
|
+
? onCanceled()
|
|
9070
|
+
: _config.signal.addEventListener('abort', onCanceled);
|
|
8653
9071
|
}
|
|
8654
|
-
reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
|
|
8655
|
-
request.abort();
|
|
8656
|
-
request = null;
|
|
8657
|
-
};
|
|
8658
|
-
|
|
8659
|
-
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
8660
|
-
if (_config.signal) {
|
|
8661
|
-
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
|
|
8662
9072
|
}
|
|
8663
|
-
}
|
|
8664
9073
|
|
|
8665
|
-
|
|
8666
|
-
|
|
8667
|
-
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
8668
|
-
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
|
8669
|
-
return;
|
|
8670
|
-
}
|
|
9074
|
+
const protocol = parseProtocol(_config.url);
|
|
8671
9075
|
|
|
9076
|
+
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
9077
|
+
reject(
|
|
9078
|
+
new AxiosError$1(
|
|
9079
|
+
'Unsupported protocol ' + protocol + ':',
|
|
9080
|
+
AxiosError$1.ERR_BAD_REQUEST,
|
|
9081
|
+
config
|
|
9082
|
+
)
|
|
9083
|
+
);
|
|
9084
|
+
return;
|
|
9085
|
+
}
|
|
8672
9086
|
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
};
|
|
9087
|
+
// Send the request
|
|
9088
|
+
request.send(requestData || null);
|
|
9089
|
+
});
|
|
9090
|
+
};
|
|
8677
9091
|
|
|
8678
9092
|
const composeSignals = (signals, timeout) => {
|
|
8679
|
-
const {length} = (signals = signals ? signals.filter(Boolean) : []);
|
|
9093
|
+
const { length } = (signals = signals ? signals.filter(Boolean) : []);
|
|
8680
9094
|
|
|
8681
9095
|
if (timeout || length) {
|
|
8682
9096
|
let controller = new AbortController();
|
|
@@ -8688,21 +9102,29 @@ const composeSignals = (signals, timeout) => {
|
|
|
8688
9102
|
aborted = true;
|
|
8689
9103
|
unsubscribe();
|
|
8690
9104
|
const err = reason instanceof Error ? reason : this.reason;
|
|
8691
|
-
controller.abort(
|
|
9105
|
+
controller.abort(
|
|
9106
|
+
err instanceof AxiosError$1
|
|
9107
|
+
? err
|
|
9108
|
+
: new CanceledError$1(err instanceof Error ? err.message : err)
|
|
9109
|
+
);
|
|
8692
9110
|
}
|
|
8693
9111
|
};
|
|
8694
9112
|
|
|
8695
|
-
let timer =
|
|
8696
|
-
|
|
8697
|
-
|
|
8698
|
-
|
|
9113
|
+
let timer =
|
|
9114
|
+
timeout &&
|
|
9115
|
+
setTimeout(() => {
|
|
9116
|
+
timer = null;
|
|
9117
|
+
onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
|
|
9118
|
+
}, timeout);
|
|
8699
9119
|
|
|
8700
9120
|
const unsubscribe = () => {
|
|
8701
9121
|
if (signals) {
|
|
8702
9122
|
timer && clearTimeout(timer);
|
|
8703
9123
|
timer = null;
|
|
8704
|
-
signals.forEach(signal => {
|
|
8705
|
-
signal.unsubscribe
|
|
9124
|
+
signals.forEach((signal) => {
|
|
9125
|
+
signal.unsubscribe
|
|
9126
|
+
? signal.unsubscribe(onabort)
|
|
9127
|
+
: signal.removeEventListener('abort', onabort);
|
|
8706
9128
|
});
|
|
8707
9129
|
signals = null;
|
|
8708
9130
|
}
|
|
@@ -8710,7 +9132,7 @@ const composeSignals = (signals, timeout) => {
|
|
|
8710
9132
|
|
|
8711
9133
|
signals.forEach((signal) => signal.addEventListener('abort', onabort));
|
|
8712
9134
|
|
|
8713
|
-
const {signal} = controller;
|
|
9135
|
+
const { signal } = controller;
|
|
8714
9136
|
|
|
8715
9137
|
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
8716
9138
|
|
|
@@ -8753,7 +9175,7 @@ const readStream = async function* (stream) {
|
|
|
8753
9175
|
const reader = stream.getReader();
|
|
8754
9176
|
try {
|
|
8755
9177
|
for (;;) {
|
|
8756
|
-
const {done, value} = await reader.read();
|
|
9178
|
+
const { done, value } = await reader.read();
|
|
8757
9179
|
if (done) {
|
|
8758
9180
|
break;
|
|
8759
9181
|
}
|
|
@@ -8776,327 +9198,482 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
8776
9198
|
}
|
|
8777
9199
|
};
|
|
8778
9200
|
|
|
8779
|
-
return new ReadableStream(
|
|
8780
|
-
|
|
8781
|
-
|
|
8782
|
-
|
|
9201
|
+
return new ReadableStream(
|
|
9202
|
+
{
|
|
9203
|
+
async pull(controller) {
|
|
9204
|
+
try {
|
|
9205
|
+
const { done, value } = await iterator.next();
|
|
8783
9206
|
|
|
8784
|
-
|
|
8785
|
-
|
|
8786
|
-
|
|
8787
|
-
|
|
8788
|
-
|
|
9207
|
+
if (done) {
|
|
9208
|
+
_onFinish();
|
|
9209
|
+
controller.close();
|
|
9210
|
+
return;
|
|
9211
|
+
}
|
|
8789
9212
|
|
|
8790
|
-
|
|
8791
|
-
|
|
8792
|
-
|
|
8793
|
-
|
|
9213
|
+
let len = value.byteLength;
|
|
9214
|
+
if (onProgress) {
|
|
9215
|
+
let loadedBytes = (bytes += len);
|
|
9216
|
+
onProgress(loadedBytes);
|
|
9217
|
+
}
|
|
9218
|
+
controller.enqueue(new Uint8Array(value));
|
|
9219
|
+
} catch (err) {
|
|
9220
|
+
_onFinish(err);
|
|
9221
|
+
throw err;
|
|
8794
9222
|
}
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
_onFinish(
|
|
8798
|
-
|
|
8799
|
-
}
|
|
9223
|
+
},
|
|
9224
|
+
cancel(reason) {
|
|
9225
|
+
_onFinish(reason);
|
|
9226
|
+
return iterator.return();
|
|
9227
|
+
},
|
|
8800
9228
|
},
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
return iterator.return();
|
|
9229
|
+
{
|
|
9230
|
+
highWaterMark: 2,
|
|
8804
9231
|
}
|
|
8805
|
-
|
|
8806
|
-
highWaterMark: 2
|
|
8807
|
-
})
|
|
9232
|
+
);
|
|
8808
9233
|
};
|
|
8809
9234
|
|
|
8810
|
-
const
|
|
8811
|
-
|
|
9235
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
9236
|
+
|
|
9237
|
+
const { isFunction } = utils$1;
|
|
9238
|
+
|
|
9239
|
+
const globalFetchAPI = (({ Request, Response }) => ({
|
|
9240
|
+
Request,
|
|
9241
|
+
Response,
|
|
9242
|
+
}))(utils$1.global);
|
|
8812
9243
|
|
|
8813
|
-
|
|
8814
|
-
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
8815
|
-
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
8816
|
-
async (str) => new Uint8Array(await new Response(str).arrayBuffer())
|
|
8817
|
-
);
|
|
9244
|
+
const { ReadableStream: ReadableStream$1, TextEncoder } = utils$1.global;
|
|
8818
9245
|
|
|
8819
9246
|
const test = (fn, ...args) => {
|
|
8820
9247
|
try {
|
|
8821
9248
|
return !!fn(...args);
|
|
8822
9249
|
} catch (e) {
|
|
8823
|
-
return false
|
|
9250
|
+
return false;
|
|
8824
9251
|
}
|
|
8825
9252
|
};
|
|
8826
9253
|
|
|
8827
|
-
const
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
body: new ReadableStream(),
|
|
8832
|
-
method: 'POST',
|
|
8833
|
-
get duplex() {
|
|
8834
|
-
duplexAccessed = true;
|
|
8835
|
-
return 'half';
|
|
9254
|
+
const factory = (env) => {
|
|
9255
|
+
env = utils$1.merge.call(
|
|
9256
|
+
{
|
|
9257
|
+
skipUndefined: true,
|
|
8836
9258
|
},
|
|
8837
|
-
|
|
9259
|
+
globalFetchAPI,
|
|
9260
|
+
env
|
|
9261
|
+
);
|
|
8838
9262
|
|
|
8839
|
-
|
|
8840
|
-
|
|
9263
|
+
const { fetch: envFetch, Request, Response } = env;
|
|
9264
|
+
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
|
|
9265
|
+
const isRequestSupported = isFunction(Request);
|
|
9266
|
+
const isResponseSupported = isFunction(Response);
|
|
8841
9267
|
|
|
8842
|
-
|
|
9268
|
+
if (!isFetchSupported) {
|
|
9269
|
+
return false;
|
|
9270
|
+
}
|
|
8843
9271
|
|
|
8844
|
-
const
|
|
8845
|
-
test(() => utils$1.isReadableStream(new Response('').body));
|
|
9272
|
+
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
|
|
8846
9273
|
|
|
9274
|
+
const encodeText =
|
|
9275
|
+
isFetchSupported &&
|
|
9276
|
+
(typeof TextEncoder === 'function'
|
|
9277
|
+
? (
|
|
9278
|
+
(encoder) => (str) =>
|
|
9279
|
+
encoder.encode(str)
|
|
9280
|
+
)(new TextEncoder())
|
|
9281
|
+
: async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
|
|
8847
9282
|
|
|
8848
|
-
const
|
|
8849
|
-
|
|
8850
|
-
|
|
9283
|
+
const supportsRequestStream =
|
|
9284
|
+
isRequestSupported &&
|
|
9285
|
+
isReadableStreamSupported &&
|
|
9286
|
+
test(() => {
|
|
9287
|
+
let duplexAccessed = false;
|
|
9288
|
+
|
|
9289
|
+
const hasContentType = new Request(platform.origin, {
|
|
9290
|
+
body: new ReadableStream$1(),
|
|
9291
|
+
method: 'POST',
|
|
9292
|
+
get duplex() {
|
|
9293
|
+
duplexAccessed = true;
|
|
9294
|
+
return 'half';
|
|
9295
|
+
},
|
|
9296
|
+
}).headers.has('Content-Type');
|
|
9297
|
+
|
|
9298
|
+
return duplexAccessed && !hasContentType;
|
|
9299
|
+
});
|
|
9300
|
+
|
|
9301
|
+
const supportsResponseStream =
|
|
9302
|
+
isResponseSupported &&
|
|
9303
|
+
isReadableStreamSupported &&
|
|
9304
|
+
test(() => utils$1.isReadableStream(new Response('').body));
|
|
9305
|
+
|
|
9306
|
+
const resolvers = {
|
|
9307
|
+
stream: supportsResponseStream && ((res) => res.body),
|
|
9308
|
+
};
|
|
8851
9309
|
|
|
8852
|
-
isFetchSupported &&
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
|
|
8856
|
-
|
|
9310
|
+
isFetchSupported &&
|
|
9311
|
+
(() => {
|
|
9312
|
+
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach((type) => {
|
|
9313
|
+
!resolvers[type] &&
|
|
9314
|
+
(resolvers[type] = (res, config) => {
|
|
9315
|
+
let method = res && res[type];
|
|
9316
|
+
|
|
9317
|
+
if (method) {
|
|
9318
|
+
return method.call(res);
|
|
9319
|
+
}
|
|
9320
|
+
|
|
9321
|
+
throw new AxiosError$1(
|
|
9322
|
+
`Response type '${type}' is not supported`,
|
|
9323
|
+
AxiosError$1.ERR_NOT_SUPPORT,
|
|
9324
|
+
config
|
|
9325
|
+
);
|
|
9326
|
+
});
|
|
8857
9327
|
});
|
|
8858
|
-
|
|
8859
|
-
})(new Response));
|
|
9328
|
+
})();
|
|
8860
9329
|
|
|
8861
|
-
const getBodyLength = async (body) => {
|
|
8862
|
-
|
|
8863
|
-
|
|
8864
|
-
|
|
9330
|
+
const getBodyLength = async (body) => {
|
|
9331
|
+
if (body == null) {
|
|
9332
|
+
return 0;
|
|
9333
|
+
}
|
|
8865
9334
|
|
|
8866
|
-
|
|
8867
|
-
|
|
8868
|
-
|
|
9335
|
+
if (utils$1.isBlob(body)) {
|
|
9336
|
+
return body.size;
|
|
9337
|
+
}
|
|
8869
9338
|
|
|
8870
|
-
|
|
8871
|
-
|
|
8872
|
-
|
|
8873
|
-
|
|
8874
|
-
|
|
8875
|
-
|
|
8876
|
-
|
|
9339
|
+
if (utils$1.isSpecCompliantForm(body)) {
|
|
9340
|
+
const _request = new Request(platform.origin, {
|
|
9341
|
+
method: 'POST',
|
|
9342
|
+
body,
|
|
9343
|
+
});
|
|
9344
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
9345
|
+
}
|
|
8877
9346
|
|
|
8878
|
-
|
|
8879
|
-
|
|
8880
|
-
|
|
9347
|
+
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
9348
|
+
return body.byteLength;
|
|
9349
|
+
}
|
|
8881
9350
|
|
|
8882
|
-
|
|
8883
|
-
|
|
8884
|
-
|
|
9351
|
+
if (utils$1.isURLSearchParams(body)) {
|
|
9352
|
+
body = body + '';
|
|
9353
|
+
}
|
|
8885
9354
|
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
};
|
|
9355
|
+
if (utils$1.isString(body)) {
|
|
9356
|
+
return (await encodeText(body)).byteLength;
|
|
9357
|
+
}
|
|
9358
|
+
};
|
|
8890
9359
|
|
|
8891
|
-
const resolveBodyLength = async (headers, body) => {
|
|
8892
|
-
|
|
9360
|
+
const resolveBodyLength = async (headers, body) => {
|
|
9361
|
+
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
8893
9362
|
|
|
8894
|
-
|
|
8895
|
-
};
|
|
9363
|
+
return length == null ? getBodyLength(body) : length;
|
|
9364
|
+
};
|
|
8896
9365
|
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
});
|
|
9366
|
+
return async (config) => {
|
|
9367
|
+
let {
|
|
9368
|
+
url,
|
|
9369
|
+
method,
|
|
9370
|
+
data,
|
|
9371
|
+
signal,
|
|
9372
|
+
cancelToken,
|
|
9373
|
+
timeout,
|
|
9374
|
+
onDownloadProgress,
|
|
9375
|
+
onUploadProgress,
|
|
9376
|
+
responseType,
|
|
9377
|
+
headers,
|
|
9378
|
+
withCredentials = 'same-origin',
|
|
9379
|
+
fetchOptions,
|
|
9380
|
+
} = resolveConfig(config);
|
|
9381
|
+
|
|
9382
|
+
let _fetch = envFetch || fetch;
|
|
9383
|
+
|
|
9384
|
+
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
9385
|
+
|
|
9386
|
+
let composedSignal = composeSignals$1(
|
|
9387
|
+
[signal, cancelToken && cancelToken.toAbortSignal()],
|
|
9388
|
+
timeout
|
|
9389
|
+
);
|
|
8922
9390
|
|
|
8923
|
-
|
|
9391
|
+
let request = null;
|
|
8924
9392
|
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
(
|
|
8929
|
-
|
|
8930
|
-
let _request = new Request(url, {
|
|
8931
|
-
method: 'POST',
|
|
8932
|
-
body: data,
|
|
8933
|
-
duplex: "half"
|
|
9393
|
+
const unsubscribe =
|
|
9394
|
+
composedSignal &&
|
|
9395
|
+
composedSignal.unsubscribe &&
|
|
9396
|
+
(() => {
|
|
9397
|
+
composedSignal.unsubscribe();
|
|
8934
9398
|
});
|
|
8935
9399
|
|
|
8936
|
-
|
|
9400
|
+
let requestContentLength;
|
|
8937
9401
|
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
|
|
9402
|
+
try {
|
|
9403
|
+
if (
|
|
9404
|
+
onUploadProgress &&
|
|
9405
|
+
supportsRequestStream &&
|
|
9406
|
+
method !== 'get' &&
|
|
9407
|
+
method !== 'head' &&
|
|
9408
|
+
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
9409
|
+
) {
|
|
9410
|
+
let _request = new Request(url, {
|
|
9411
|
+
method: 'POST',
|
|
9412
|
+
body: data,
|
|
9413
|
+
duplex: 'half',
|
|
9414
|
+
});
|
|
8941
9415
|
|
|
8942
|
-
|
|
8943
|
-
const [onProgress, flush] = progressEventDecorator(
|
|
8944
|
-
requestContentLength,
|
|
8945
|
-
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
8946
|
-
);
|
|
9416
|
+
let contentTypeHeader;
|
|
8947
9417
|
|
|
8948
|
-
data =
|
|
9418
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
9419
|
+
headers.setContentType(contentTypeHeader);
|
|
9420
|
+
}
|
|
9421
|
+
|
|
9422
|
+
if (_request.body) {
|
|
9423
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
9424
|
+
requestContentLength,
|
|
9425
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
9426
|
+
);
|
|
9427
|
+
|
|
9428
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
9429
|
+
}
|
|
8949
9430
|
}
|
|
8950
|
-
}
|
|
8951
9431
|
|
|
8952
|
-
|
|
8953
|
-
|
|
8954
|
-
|
|
9432
|
+
if (!utils$1.isString(withCredentials)) {
|
|
9433
|
+
withCredentials = withCredentials ? 'include' : 'omit';
|
|
9434
|
+
}
|
|
8955
9435
|
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
request = new Request(url, {
|
|
8960
|
-
...fetchOptions,
|
|
8961
|
-
signal: composedSignal,
|
|
8962
|
-
method: method.toUpperCase(),
|
|
8963
|
-
headers: headers.normalize().toJSON(),
|
|
8964
|
-
body: data,
|
|
8965
|
-
duplex: "half",
|
|
8966
|
-
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
8967
|
-
});
|
|
9436
|
+
// Cloudflare Workers throws when credentials are defined
|
|
9437
|
+
// see https://github.com/cloudflare/workerd/issues/902
|
|
9438
|
+
const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
|
|
8968
9439
|
|
|
8969
|
-
|
|
9440
|
+
const resolvedOptions = {
|
|
9441
|
+
...fetchOptions,
|
|
9442
|
+
signal: composedSignal,
|
|
9443
|
+
method: method.toUpperCase(),
|
|
9444
|
+
headers: headers.normalize().toJSON(),
|
|
9445
|
+
body: data,
|
|
9446
|
+
duplex: 'half',
|
|
9447
|
+
credentials: isCredentialsSupported ? withCredentials : undefined,
|
|
9448
|
+
};
|
|
8970
9449
|
|
|
8971
|
-
|
|
9450
|
+
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
8972
9451
|
|
|
8973
|
-
|
|
8974
|
-
|
|
9452
|
+
let response = await (isRequestSupported
|
|
9453
|
+
? _fetch(request, fetchOptions)
|
|
9454
|
+
: _fetch(url, resolvedOptions));
|
|
8975
9455
|
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
});
|
|
9456
|
+
const isStreamResponse =
|
|
9457
|
+
supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
8979
9458
|
|
|
8980
|
-
|
|
9459
|
+
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
|
9460
|
+
const options = {};
|
|
8981
9461
|
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
) || [];
|
|
9462
|
+
['status', 'statusText', 'headers'].forEach((prop) => {
|
|
9463
|
+
options[prop] = response[prop];
|
|
9464
|
+
});
|
|
8986
9465
|
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
8994
|
-
|
|
9466
|
+
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
9467
|
+
|
|
9468
|
+
const [onProgress, flush] =
|
|
9469
|
+
(onDownloadProgress &&
|
|
9470
|
+
progressEventDecorator(
|
|
9471
|
+
responseContentLength,
|
|
9472
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
9473
|
+
)) ||
|
|
9474
|
+
[];
|
|
9475
|
+
|
|
9476
|
+
response = new Response(
|
|
9477
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
9478
|
+
flush && flush();
|
|
9479
|
+
unsubscribe && unsubscribe();
|
|
9480
|
+
}),
|
|
9481
|
+
options
|
|
9482
|
+
);
|
|
9483
|
+
}
|
|
8995
9484
|
|
|
8996
|
-
|
|
9485
|
+
responseType = responseType || 'text';
|
|
8997
9486
|
|
|
8998
|
-
|
|
9487
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](
|
|
9488
|
+
response,
|
|
9489
|
+
config
|
|
9490
|
+
);
|
|
8999
9491
|
|
|
9000
|
-
|
|
9492
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
9001
9493
|
|
|
9002
|
-
|
|
9003
|
-
|
|
9004
|
-
|
|
9005
|
-
|
|
9006
|
-
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
|
|
9494
|
+
return await new Promise((resolve, reject) => {
|
|
9495
|
+
settle(resolve, reject, {
|
|
9496
|
+
data: responseData,
|
|
9497
|
+
headers: AxiosHeaders$1.from(response.headers),
|
|
9498
|
+
status: response.status,
|
|
9499
|
+
statusText: response.statusText,
|
|
9500
|
+
config,
|
|
9501
|
+
request,
|
|
9502
|
+
});
|
|
9010
9503
|
});
|
|
9011
|
-
})
|
|
9012
|
-
|
|
9013
|
-
|
|
9504
|
+
} catch (err) {
|
|
9505
|
+
unsubscribe && unsubscribe();
|
|
9506
|
+
|
|
9507
|
+
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
9508
|
+
throw Object.assign(
|
|
9509
|
+
new AxiosError$1(
|
|
9510
|
+
'Network Error',
|
|
9511
|
+
AxiosError$1.ERR_NETWORK,
|
|
9512
|
+
config,
|
|
9513
|
+
request,
|
|
9514
|
+
err && err.response
|
|
9515
|
+
),
|
|
9516
|
+
{
|
|
9517
|
+
cause: err.cause || err,
|
|
9518
|
+
}
|
|
9519
|
+
);
|
|
9520
|
+
}
|
|
9014
9521
|
|
|
9015
|
-
|
|
9016
|
-
throw Object.assign(
|
|
9017
|
-
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
|
|
9018
|
-
{
|
|
9019
|
-
cause: err.cause || err
|
|
9020
|
-
}
|
|
9021
|
-
)
|
|
9522
|
+
throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
|
|
9022
9523
|
}
|
|
9524
|
+
};
|
|
9525
|
+
};
|
|
9526
|
+
|
|
9527
|
+
const seedCache = new Map();
|
|
9528
|
+
|
|
9529
|
+
const getFetch = (config) => {
|
|
9530
|
+
let env = (config && config.env) || {};
|
|
9531
|
+
const { fetch, Request, Response } = env;
|
|
9532
|
+
const seeds = [Request, Response, fetch];
|
|
9023
9533
|
|
|
9024
|
-
|
|
9534
|
+
let len = seeds.length,
|
|
9535
|
+
i = len,
|
|
9536
|
+
seed,
|
|
9537
|
+
target,
|
|
9538
|
+
map = seedCache;
|
|
9539
|
+
|
|
9540
|
+
while (i--) {
|
|
9541
|
+
seed = seeds[i];
|
|
9542
|
+
target = map.get(seed);
|
|
9543
|
+
|
|
9544
|
+
target === undefined && map.set(seed, (target = i ? new Map() : factory(env)));
|
|
9545
|
+
|
|
9546
|
+
map = target;
|
|
9025
9547
|
}
|
|
9026
|
-
});
|
|
9027
9548
|
|
|
9549
|
+
return target;
|
|
9550
|
+
};
|
|
9551
|
+
|
|
9552
|
+
getFetch();
|
|
9553
|
+
|
|
9554
|
+
/**
|
|
9555
|
+
* Known adapters mapping.
|
|
9556
|
+
* Provides environment-specific adapters for Axios:
|
|
9557
|
+
* - `http` for Node.js
|
|
9558
|
+
* - `xhr` for browsers
|
|
9559
|
+
* - `fetch` for fetch API-based requests
|
|
9560
|
+
*
|
|
9561
|
+
* @type {Object<string, Function|Object>}
|
|
9562
|
+
*/
|
|
9028
9563
|
const knownAdapters = {
|
|
9029
9564
|
http: httpAdapter,
|
|
9030
9565
|
xhr: xhrAdapter,
|
|
9031
|
-
fetch:
|
|
9566
|
+
fetch: {
|
|
9567
|
+
get: getFetch,
|
|
9568
|
+
},
|
|
9032
9569
|
};
|
|
9033
9570
|
|
|
9571
|
+
// Assign adapter names for easier debugging and identification
|
|
9034
9572
|
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
9035
9573
|
if (fn) {
|
|
9036
9574
|
try {
|
|
9037
|
-
Object.defineProperty(fn, 'name', {value});
|
|
9575
|
+
Object.defineProperty(fn, 'name', { value });
|
|
9038
9576
|
} catch (e) {
|
|
9039
9577
|
// eslint-disable-next-line no-empty
|
|
9040
9578
|
}
|
|
9041
|
-
Object.defineProperty(fn, 'adapterName', {value});
|
|
9579
|
+
Object.defineProperty(fn, 'adapterName', { value });
|
|
9042
9580
|
}
|
|
9043
9581
|
});
|
|
9044
9582
|
|
|
9583
|
+
/**
|
|
9584
|
+
* Render a rejection reason string for unknown or unsupported adapters
|
|
9585
|
+
*
|
|
9586
|
+
* @param {string} reason
|
|
9587
|
+
* @returns {string}
|
|
9588
|
+
*/
|
|
9045
9589
|
const renderReason = (reason) => `- ${reason}`;
|
|
9046
9590
|
|
|
9047
|
-
|
|
9048
|
-
|
|
9049
|
-
|
|
9050
|
-
|
|
9051
|
-
|
|
9591
|
+
/**
|
|
9592
|
+
* Check if the adapter is resolved (function, null, or false)
|
|
9593
|
+
*
|
|
9594
|
+
* @param {Function|null|false} adapter
|
|
9595
|
+
* @returns {boolean}
|
|
9596
|
+
*/
|
|
9597
|
+
const isResolvedHandle = (adapter) =>
|
|
9598
|
+
utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
9052
9599
|
|
|
9053
|
-
|
|
9054
|
-
|
|
9055
|
-
|
|
9600
|
+
/**
|
|
9601
|
+
* Get the first suitable adapter from the provided list.
|
|
9602
|
+
* Tries each adapter in order until a supported one is found.
|
|
9603
|
+
* Throws an AxiosError if no adapter is suitable.
|
|
9604
|
+
*
|
|
9605
|
+
* @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
|
|
9606
|
+
* @param {Object} config - Axios request configuration
|
|
9607
|
+
* @throws {AxiosError} If no suitable adapter is available
|
|
9608
|
+
* @returns {Function} The resolved adapter function
|
|
9609
|
+
*/
|
|
9610
|
+
function getAdapter(adapters, config) {
|
|
9611
|
+
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
|
9056
9612
|
|
|
9057
|
-
|
|
9613
|
+
const { length } = adapters;
|
|
9614
|
+
let nameOrAdapter;
|
|
9615
|
+
let adapter;
|
|
9058
9616
|
|
|
9059
|
-
|
|
9060
|
-
nameOrAdapter = adapters[i];
|
|
9061
|
-
let id;
|
|
9617
|
+
const rejectedReasons = {};
|
|
9062
9618
|
|
|
9063
|
-
|
|
9619
|
+
for (let i = 0; i < length; i++) {
|
|
9620
|
+
nameOrAdapter = adapters[i];
|
|
9621
|
+
let id;
|
|
9064
9622
|
|
|
9065
|
-
|
|
9066
|
-
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
9623
|
+
adapter = nameOrAdapter;
|
|
9067
9624
|
|
|
9068
|
-
|
|
9069
|
-
|
|
9070
|
-
}
|
|
9071
|
-
}
|
|
9625
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
9626
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
9072
9627
|
|
|
9073
|
-
if (adapter) {
|
|
9074
|
-
|
|
9628
|
+
if (adapter === undefined) {
|
|
9629
|
+
throw new AxiosError$1(`Unknown adapter '${id}'`);
|
|
9075
9630
|
}
|
|
9631
|
+
}
|
|
9076
9632
|
|
|
9077
|
-
|
|
9633
|
+
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
9634
|
+
break;
|
|
9078
9635
|
}
|
|
9079
9636
|
|
|
9080
|
-
|
|
9637
|
+
rejectedReasons[id || '#' + i] = adapter;
|
|
9638
|
+
}
|
|
9081
9639
|
|
|
9082
|
-
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
|
|
9640
|
+
if (!adapter) {
|
|
9641
|
+
const reasons = Object.entries(rejectedReasons).map(
|
|
9642
|
+
([id, state]) =>
|
|
9643
|
+
`adapter ${id} ` +
|
|
9644
|
+
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
|
9645
|
+
);
|
|
9086
9646
|
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
'
|
|
9647
|
+
let s = length
|
|
9648
|
+
? reasons.length > 1
|
|
9649
|
+
? 'since :\n' + reasons.map(renderReason).join('\n')
|
|
9650
|
+
: ' ' + renderReason(reasons[0])
|
|
9651
|
+
: 'as no adapter specified';
|
|
9090
9652
|
|
|
9091
|
-
|
|
9092
|
-
|
|
9093
|
-
|
|
9094
|
-
|
|
9095
|
-
|
|
9653
|
+
throw new AxiosError$1(
|
|
9654
|
+
`There is no suitable adapter to dispatch the request ` + s,
|
|
9655
|
+
'ERR_NOT_SUPPORT'
|
|
9656
|
+
);
|
|
9657
|
+
}
|
|
9096
9658
|
|
|
9097
|
-
|
|
9098
|
-
|
|
9099
|
-
|
|
9659
|
+
return adapter;
|
|
9660
|
+
}
|
|
9661
|
+
|
|
9662
|
+
/**
|
|
9663
|
+
* Exports Axios adapters and utility to resolve an adapter
|
|
9664
|
+
*/
|
|
9665
|
+
var adapters = {
|
|
9666
|
+
/**
|
|
9667
|
+
* Resolve an adapter from a list of adapter names or functions.
|
|
9668
|
+
* @type {Function}
|
|
9669
|
+
*/
|
|
9670
|
+
getAdapter,
|
|
9671
|
+
|
|
9672
|
+
/**
|
|
9673
|
+
* Exposes all known adapters
|
|
9674
|
+
* @type {Object<string, Function|Object>}
|
|
9675
|
+
*/
|
|
9676
|
+
adapters: knownAdapters,
|
|
9100
9677
|
};
|
|
9101
9678
|
|
|
9102
9679
|
/**
|
|
@@ -9112,7 +9689,7 @@ function throwIfCancellationRequested(config) {
|
|
|
9112
9689
|
}
|
|
9113
9690
|
|
|
9114
9691
|
if (config.signal && config.signal.aborted) {
|
|
9115
|
-
throw new CanceledError(null, config);
|
|
9692
|
+
throw new CanceledError$1(null, config);
|
|
9116
9693
|
}
|
|
9117
9694
|
}
|
|
9118
9695
|
|
|
@@ -9129,50 +9706,46 @@ function dispatchRequest(config) {
|
|
|
9129
9706
|
config.headers = AxiosHeaders$1.from(config.headers);
|
|
9130
9707
|
|
|
9131
9708
|
// Transform request data
|
|
9132
|
-
config.data = transformData.call(
|
|
9133
|
-
config,
|
|
9134
|
-
config.transformRequest
|
|
9135
|
-
);
|
|
9709
|
+
config.data = transformData.call(config, config.transformRequest);
|
|
9136
9710
|
|
|
9137
9711
|
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
|
9138
9712
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
9139
9713
|
}
|
|
9140
9714
|
|
|
9141
|
-
const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
|
|
9142
|
-
|
|
9143
|
-
return adapter(config).then(function onAdapterResolution(response) {
|
|
9144
|
-
throwIfCancellationRequested(config);
|
|
9715
|
+
const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
|
|
9145
9716
|
|
|
9146
|
-
|
|
9147
|
-
response
|
|
9148
|
-
config,
|
|
9149
|
-
config.transformResponse,
|
|
9150
|
-
response
|
|
9151
|
-
);
|
|
9152
|
-
|
|
9153
|
-
response.headers = AxiosHeaders$1.from(response.headers);
|
|
9154
|
-
|
|
9155
|
-
return response;
|
|
9156
|
-
}, function onAdapterRejection(reason) {
|
|
9157
|
-
if (!isCancel(reason)) {
|
|
9717
|
+
return adapter(config).then(
|
|
9718
|
+
function onAdapterResolution(response) {
|
|
9158
9719
|
throwIfCancellationRequested(config);
|
|
9159
9720
|
|
|
9160
9721
|
// Transform response data
|
|
9161
|
-
|
|
9162
|
-
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
|
|
9722
|
+
response.data = transformData.call(config, config.transformResponse, response);
|
|
9723
|
+
|
|
9724
|
+
response.headers = AxiosHeaders$1.from(response.headers);
|
|
9725
|
+
|
|
9726
|
+
return response;
|
|
9727
|
+
},
|
|
9728
|
+
function onAdapterRejection(reason) {
|
|
9729
|
+
if (!isCancel(reason)) {
|
|
9730
|
+
throwIfCancellationRequested(config);
|
|
9731
|
+
|
|
9732
|
+
// Transform response data
|
|
9733
|
+
if (reason && reason.response) {
|
|
9734
|
+
reason.response.data = transformData.call(
|
|
9735
|
+
config,
|
|
9736
|
+
config.transformResponse,
|
|
9737
|
+
reason.response
|
|
9738
|
+
);
|
|
9739
|
+
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
|
9740
|
+
}
|
|
9168
9741
|
}
|
|
9169
|
-
}
|
|
9170
9742
|
|
|
9171
|
-
|
|
9172
|
-
|
|
9743
|
+
return Promise.reject(reason);
|
|
9744
|
+
}
|
|
9745
|
+
);
|
|
9173
9746
|
}
|
|
9174
9747
|
|
|
9175
|
-
const VERSION = "1.
|
|
9748
|
+
const VERSION = "1.13.6";
|
|
9176
9749
|
|
|
9177
9750
|
const validators$1 = {};
|
|
9178
9751
|
|
|
@@ -9196,15 +9769,23 @@ const deprecatedWarnings = {};
|
|
|
9196
9769
|
*/
|
|
9197
9770
|
validators$1.transitional = function transitional(validator, version, message) {
|
|
9198
9771
|
function formatMessage(opt, desc) {
|
|
9199
|
-
return
|
|
9772
|
+
return (
|
|
9773
|
+
'[Axios v' +
|
|
9774
|
+
VERSION +
|
|
9775
|
+
"] Transitional option '" +
|
|
9776
|
+
opt +
|
|
9777
|
+
"'" +
|
|
9778
|
+
desc +
|
|
9779
|
+
(message ? '. ' + message : '')
|
|
9780
|
+
);
|
|
9200
9781
|
}
|
|
9201
9782
|
|
|
9202
9783
|
// eslint-disable-next-line func-names
|
|
9203
9784
|
return (value, opt, opts) => {
|
|
9204
9785
|
if (validator === false) {
|
|
9205
|
-
throw new AxiosError(
|
|
9786
|
+
throw new AxiosError$1(
|
|
9206
9787
|
formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
|
|
9207
|
-
AxiosError.ERR_DEPRECATED
|
|
9788
|
+
AxiosError$1.ERR_DEPRECATED
|
|
9208
9789
|
);
|
|
9209
9790
|
}
|
|
9210
9791
|
|
|
@@ -9228,7 +9809,7 @@ validators$1.spelling = function spelling(correctSpelling) {
|
|
|
9228
9809
|
// eslint-disable-next-line no-console
|
|
9229
9810
|
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
9230
9811
|
return true;
|
|
9231
|
-
}
|
|
9812
|
+
};
|
|
9232
9813
|
};
|
|
9233
9814
|
|
|
9234
9815
|
/**
|
|
@@ -9243,7 +9824,7 @@ validators$1.spelling = function spelling(correctSpelling) {
|
|
|
9243
9824
|
|
|
9244
9825
|
function assertOptions(options, schema, allowUnknown) {
|
|
9245
9826
|
if (typeof options !== 'object') {
|
|
9246
|
-
throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
|
|
9827
|
+
throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
9247
9828
|
}
|
|
9248
9829
|
const keys = Object.keys(options);
|
|
9249
9830
|
let i = keys.length;
|
|
@@ -9254,19 +9835,22 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
9254
9835
|
const value = options[opt];
|
|
9255
9836
|
const result = value === undefined || validator(value, opt, options);
|
|
9256
9837
|
if (result !== true) {
|
|
9257
|
-
throw new AxiosError(
|
|
9838
|
+
throw new AxiosError$1(
|
|
9839
|
+
'option ' + opt + ' must be ' + result,
|
|
9840
|
+
AxiosError$1.ERR_BAD_OPTION_VALUE
|
|
9841
|
+
);
|
|
9258
9842
|
}
|
|
9259
9843
|
continue;
|
|
9260
9844
|
}
|
|
9261
9845
|
if (allowUnknown !== true) {
|
|
9262
|
-
throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
|
|
9846
|
+
throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION);
|
|
9263
9847
|
}
|
|
9264
9848
|
}
|
|
9265
9849
|
}
|
|
9266
9850
|
|
|
9267
9851
|
var validator = {
|
|
9268
9852
|
assertOptions,
|
|
9269
|
-
validators: validators$1
|
|
9853
|
+
validators: validators$1,
|
|
9270
9854
|
};
|
|
9271
9855
|
|
|
9272
9856
|
const validators = validator.validators;
|
|
@@ -9280,10 +9864,10 @@ const validators = validator.validators;
|
|
|
9280
9864
|
*/
|
|
9281
9865
|
class Axios {
|
|
9282
9866
|
constructor(instanceConfig) {
|
|
9283
|
-
this.defaults = instanceConfig;
|
|
9867
|
+
this.defaults = instanceConfig || {};
|
|
9284
9868
|
this.interceptors = {
|
|
9285
9869
|
request: new InterceptorManager$1(),
|
|
9286
|
-
response: new InterceptorManager$1()
|
|
9870
|
+
response: new InterceptorManager$1(),
|
|
9287
9871
|
};
|
|
9288
9872
|
}
|
|
9289
9873
|
|
|
@@ -9334,26 +9918,35 @@ class Axios {
|
|
|
9334
9918
|
|
|
9335
9919
|
config = mergeConfig(this.defaults, config);
|
|
9336
9920
|
|
|
9337
|
-
const {transitional, paramsSerializer, headers} = config;
|
|
9921
|
+
const { transitional, paramsSerializer, headers } = config;
|
|
9338
9922
|
|
|
9339
9923
|
if (transitional !== undefined) {
|
|
9340
|
-
validator.assertOptions(
|
|
9341
|
-
|
|
9342
|
-
|
|
9343
|
-
|
|
9344
|
-
|
|
9924
|
+
validator.assertOptions(
|
|
9925
|
+
transitional,
|
|
9926
|
+
{
|
|
9927
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
9928
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
9929
|
+
clarifyTimeoutError: validators.transitional(validators.boolean),
|
|
9930
|
+
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
|
|
9931
|
+
},
|
|
9932
|
+
false
|
|
9933
|
+
);
|
|
9345
9934
|
}
|
|
9346
9935
|
|
|
9347
9936
|
if (paramsSerializer != null) {
|
|
9348
9937
|
if (utils$1.isFunction(paramsSerializer)) {
|
|
9349
9938
|
config.paramsSerializer = {
|
|
9350
|
-
serialize: paramsSerializer
|
|
9939
|
+
serialize: paramsSerializer,
|
|
9351
9940
|
};
|
|
9352
9941
|
} else {
|
|
9353
|
-
validator.assertOptions(
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
9942
|
+
validator.assertOptions(
|
|
9943
|
+
paramsSerializer,
|
|
9944
|
+
{
|
|
9945
|
+
encode: validators.function,
|
|
9946
|
+
serialize: validators.function,
|
|
9947
|
+
},
|
|
9948
|
+
true
|
|
9949
|
+
);
|
|
9357
9950
|
}
|
|
9358
9951
|
}
|
|
9359
9952
|
|
|
@@ -9364,26 +9957,25 @@ class Axios {
|
|
|
9364
9957
|
config.allowAbsoluteUrls = true;
|
|
9365
9958
|
}
|
|
9366
9959
|
|
|
9367
|
-
validator.assertOptions(
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9960
|
+
validator.assertOptions(
|
|
9961
|
+
config,
|
|
9962
|
+
{
|
|
9963
|
+
baseUrl: validators.spelling('baseURL'),
|
|
9964
|
+
withXsrfToken: validators.spelling('withXSRFToken'),
|
|
9965
|
+
},
|
|
9966
|
+
true
|
|
9967
|
+
);
|
|
9371
9968
|
|
|
9372
9969
|
// Set config.method
|
|
9373
9970
|
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
|
9374
9971
|
|
|
9375
9972
|
// Flatten headers
|
|
9376
|
-
let contextHeaders = headers && utils$1.merge(
|
|
9377
|
-
headers.common,
|
|
9378
|
-
headers[config.method]
|
|
9379
|
-
);
|
|
9973
|
+
let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
|
|
9380
9974
|
|
|
9381
|
-
headers &&
|
|
9382
|
-
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
9383
|
-
(method) => {
|
|
9975
|
+
headers &&
|
|
9976
|
+
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
|
|
9384
9977
|
delete headers[method];
|
|
9385
|
-
}
|
|
9386
|
-
);
|
|
9978
|
+
});
|
|
9387
9979
|
|
|
9388
9980
|
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
|
9389
9981
|
|
|
@@ -9397,7 +9989,15 @@ class Axios {
|
|
|
9397
9989
|
|
|
9398
9990
|
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
9399
9991
|
|
|
9400
|
-
|
|
9992
|
+
const transitional = config.transitional || transitionalDefaults;
|
|
9993
|
+
const legacyInterceptorReqResOrdering =
|
|
9994
|
+
transitional && transitional.legacyInterceptorReqResOrdering;
|
|
9995
|
+
|
|
9996
|
+
if (legacyInterceptorReqResOrdering) {
|
|
9997
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
9998
|
+
} else {
|
|
9999
|
+
requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
10000
|
+
}
|
|
9401
10001
|
});
|
|
9402
10002
|
|
|
9403
10003
|
const responseInterceptorChain = [];
|
|
@@ -9411,8 +10011,8 @@ class Axios {
|
|
|
9411
10011
|
|
|
9412
10012
|
if (!synchronousRequestInterceptors) {
|
|
9413
10013
|
const chain = [dispatchRequest.bind(this), undefined];
|
|
9414
|
-
chain.unshift
|
|
9415
|
-
chain.push
|
|
10014
|
+
chain.unshift(...requestInterceptorChain);
|
|
10015
|
+
chain.push(...responseInterceptorChain);
|
|
9416
10016
|
len = chain.length;
|
|
9417
10017
|
|
|
9418
10018
|
promise = Promise.resolve(config);
|
|
@@ -9428,8 +10028,6 @@ class Axios {
|
|
|
9428
10028
|
|
|
9429
10029
|
let newConfig = config;
|
|
9430
10030
|
|
|
9431
|
-
i = 0;
|
|
9432
|
-
|
|
9433
10031
|
while (i < len) {
|
|
9434
10032
|
const onFulfilled = requestInterceptorChain[i++];
|
|
9435
10033
|
const onRejected = requestInterceptorChain[i++];
|
|
@@ -9467,12 +10065,14 @@ class Axios {
|
|
|
9467
10065
|
// Provide aliases for supported request methods
|
|
9468
10066
|
utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
9469
10067
|
/*eslint func-names:0*/
|
|
9470
|
-
Axios.prototype[method] = function(url, config) {
|
|
9471
|
-
return this.request(
|
|
9472
|
-
|
|
9473
|
-
|
|
9474
|
-
|
|
9475
|
-
|
|
10068
|
+
Axios.prototype[method] = function (url, config) {
|
|
10069
|
+
return this.request(
|
|
10070
|
+
mergeConfig(config || {}, {
|
|
10071
|
+
method,
|
|
10072
|
+
url,
|
|
10073
|
+
data: (config || {}).data,
|
|
10074
|
+
})
|
|
10075
|
+
);
|
|
9476
10076
|
};
|
|
9477
10077
|
});
|
|
9478
10078
|
|
|
@@ -9481,14 +10081,18 @@ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method)
|
|
|
9481
10081
|
|
|
9482
10082
|
function generateHTTPMethod(isForm) {
|
|
9483
10083
|
return function httpMethod(url, data, config) {
|
|
9484
|
-
return this.request(
|
|
9485
|
-
|
|
9486
|
-
|
|
9487
|
-
|
|
9488
|
-
|
|
9489
|
-
|
|
9490
|
-
|
|
9491
|
-
|
|
10084
|
+
return this.request(
|
|
10085
|
+
mergeConfig(config || {}, {
|
|
10086
|
+
method,
|
|
10087
|
+
headers: isForm
|
|
10088
|
+
? {
|
|
10089
|
+
'Content-Type': 'multipart/form-data',
|
|
10090
|
+
}
|
|
10091
|
+
: {},
|
|
10092
|
+
url,
|
|
10093
|
+
data,
|
|
10094
|
+
})
|
|
10095
|
+
);
|
|
9492
10096
|
};
|
|
9493
10097
|
}
|
|
9494
10098
|
|
|
@@ -9521,7 +10125,7 @@ class CancelToken {
|
|
|
9521
10125
|
const token = this;
|
|
9522
10126
|
|
|
9523
10127
|
// eslint-disable-next-line func-names
|
|
9524
|
-
this.promise.then(cancel => {
|
|
10128
|
+
this.promise.then((cancel) => {
|
|
9525
10129
|
if (!token._listeners) return;
|
|
9526
10130
|
|
|
9527
10131
|
let i = token._listeners.length;
|
|
@@ -9533,10 +10137,10 @@ class CancelToken {
|
|
|
9533
10137
|
});
|
|
9534
10138
|
|
|
9535
10139
|
// eslint-disable-next-line func-names
|
|
9536
|
-
this.promise.then = onfulfilled => {
|
|
10140
|
+
this.promise.then = (onfulfilled) => {
|
|
9537
10141
|
let _resolve;
|
|
9538
10142
|
// eslint-disable-next-line func-names
|
|
9539
|
-
const promise = new Promise(resolve => {
|
|
10143
|
+
const promise = new Promise((resolve) => {
|
|
9540
10144
|
token.subscribe(resolve);
|
|
9541
10145
|
_resolve = resolve;
|
|
9542
10146
|
}).then(onfulfilled);
|
|
@@ -9554,7 +10158,7 @@ class CancelToken {
|
|
|
9554
10158
|
return;
|
|
9555
10159
|
}
|
|
9556
10160
|
|
|
9557
|
-
token.reason = new CanceledError(message, config, request);
|
|
10161
|
+
token.reason = new CanceledError$1(message, config, request);
|
|
9558
10162
|
resolvePromise(token.reason);
|
|
9559
10163
|
});
|
|
9560
10164
|
}
|
|
@@ -9624,7 +10228,7 @@ class CancelToken {
|
|
|
9624
10228
|
});
|
|
9625
10229
|
return {
|
|
9626
10230
|
token,
|
|
9627
|
-
cancel
|
|
10231
|
+
cancel,
|
|
9628
10232
|
};
|
|
9629
10233
|
}
|
|
9630
10234
|
}
|
|
@@ -9638,7 +10242,7 @@ var CancelToken$1 = CancelToken;
|
|
|
9638
10242
|
*
|
|
9639
10243
|
* ```js
|
|
9640
10244
|
* function f(x, y, z) {}
|
|
9641
|
-
*
|
|
10245
|
+
* const args = [1, 2, 3];
|
|
9642
10246
|
* f.apply(null, args);
|
|
9643
10247
|
* ```
|
|
9644
10248
|
*
|
|
@@ -9666,7 +10270,7 @@ function spread(callback) {
|
|
|
9666
10270
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
9667
10271
|
*/
|
|
9668
10272
|
function isAxiosError(payload) {
|
|
9669
|
-
return utils$1.isObject(payload) &&
|
|
10273
|
+
return utils$1.isObject(payload) && payload.isAxiosError === true;
|
|
9670
10274
|
}
|
|
9671
10275
|
|
|
9672
10276
|
const HttpStatusCode = {
|
|
@@ -9733,6 +10337,12 @@ const HttpStatusCode = {
|
|
|
9733
10337
|
LoopDetected: 508,
|
|
9734
10338
|
NotExtended: 510,
|
|
9735
10339
|
NetworkAuthenticationRequired: 511,
|
|
10340
|
+
WebServerIsDown: 521,
|
|
10341
|
+
ConnectionTimedOut: 522,
|
|
10342
|
+
OriginIsUnreachable: 523,
|
|
10343
|
+
TimeoutOccurred: 524,
|
|
10344
|
+
SslHandshakeFailed: 525,
|
|
10345
|
+
InvalidSslCertificate: 526,
|
|
9736
10346
|
};
|
|
9737
10347
|
|
|
9738
10348
|
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
|
@@ -9753,10 +10363,10 @@ function createInstance(defaultConfig) {
|
|
|
9753
10363
|
const instance = bind(Axios$1.prototype.request, context);
|
|
9754
10364
|
|
|
9755
10365
|
// Copy axios.prototype to instance
|
|
9756
|
-
utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
|
|
10366
|
+
utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
|
|
9757
10367
|
|
|
9758
10368
|
// Copy context to instance
|
|
9759
|
-
utils$1.extend(instance, context, null, {allOwnKeys: true});
|
|
10369
|
+
utils$1.extend(instance, context, null, { allOwnKeys: true });
|
|
9760
10370
|
|
|
9761
10371
|
// Factory for creating new instances
|
|
9762
10372
|
instance.create = function create(instanceConfig) {
|
|
@@ -9773,14 +10383,14 @@ const axios = createInstance(defaults$1);
|
|
|
9773
10383
|
axios.Axios = Axios$1;
|
|
9774
10384
|
|
|
9775
10385
|
// Expose Cancel & CancelToken
|
|
9776
|
-
axios.CanceledError = CanceledError;
|
|
10386
|
+
axios.CanceledError = CanceledError$1;
|
|
9777
10387
|
axios.CancelToken = CancelToken$1;
|
|
9778
10388
|
axios.isCancel = isCancel;
|
|
9779
10389
|
axios.VERSION = VERSION;
|
|
9780
10390
|
axios.toFormData = toFormData;
|
|
9781
10391
|
|
|
9782
10392
|
// Expose AxiosError class
|
|
9783
|
-
axios.AxiosError = AxiosError;
|
|
10393
|
+
axios.AxiosError = AxiosError$1;
|
|
9784
10394
|
|
|
9785
10395
|
// alias for CanceledError for backward compatibility
|
|
9786
10396
|
axios.Cancel = axios.CanceledError;
|
|
@@ -9800,7 +10410,7 @@ axios.mergeConfig = mergeConfig;
|
|
|
9800
10410
|
|
|
9801
10411
|
axios.AxiosHeaders = AxiosHeaders$1;
|
|
9802
10412
|
|
|
9803
|
-
axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
10413
|
+
axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
9804
10414
|
|
|
9805
10415
|
axios.getAdapter = adapters.getAdapter;
|
|
9806
10416
|
|