@tryghost/content-api 1.11.19 → 1.11.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/content-api.js +10 -10
- package/es/content-api.js +216 -195
- package/es/content-api.js.map +1 -1
- package/package.json +10 -10
- package/umd/content-api.min.js +1 -1
- package/umd/content-api.min.js.map +1 -1
package/es/content-api.js
CHANGED
|
@@ -670,7 +670,7 @@ const isAsyncFn = kindOfTest('AsyncFunction');
|
|
|
670
670
|
const isThenable = (thing) =>
|
|
671
671
|
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
|
672
672
|
|
|
673
|
-
var utils = {
|
|
673
|
+
var utils$1 = {
|
|
674
674
|
isArray,
|
|
675
675
|
isArrayBuffer,
|
|
676
676
|
isBuffer,
|
|
@@ -752,7 +752,7 @@ function AxiosError(message, code, config, request, response) {
|
|
|
752
752
|
response && (this.response = response);
|
|
753
753
|
}
|
|
754
754
|
|
|
755
|
-
utils.inherits(AxiosError, Error, {
|
|
755
|
+
utils$1.inherits(AxiosError, Error, {
|
|
756
756
|
toJSON: function toJSON() {
|
|
757
757
|
return {
|
|
758
758
|
// Standard
|
|
@@ -767,7 +767,7 @@ utils.inherits(AxiosError, Error, {
|
|
|
767
767
|
columnNumber: this.columnNumber,
|
|
768
768
|
stack: this.stack,
|
|
769
769
|
// Axios
|
|
770
|
-
config: utils.toJSONObject(this.config),
|
|
770
|
+
config: utils$1.toJSONObject(this.config),
|
|
771
771
|
code: this.code,
|
|
772
772
|
status: this.response && this.response.status ? this.response.status : null
|
|
773
773
|
};
|
|
@@ -802,7 +802,7 @@ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
|
|
|
802
802
|
AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
803
803
|
const axiosError = Object.create(prototype$1);
|
|
804
804
|
|
|
805
|
-
utils.toFlatObject(error, axiosError, function filter(obj) {
|
|
805
|
+
utils$1.toFlatObject(error, axiosError, function filter(obj) {
|
|
806
806
|
return obj !== Error.prototype;
|
|
807
807
|
}, prop => {
|
|
808
808
|
return prop !== 'isAxiosError';
|
|
@@ -830,7 +830,7 @@ var httpAdapter = null;
|
|
|
830
830
|
* @returns {boolean}
|
|
831
831
|
*/
|
|
832
832
|
function isVisitable(thing) {
|
|
833
|
-
return utils.isPlainObject(thing) || utils.isArray(thing);
|
|
833
|
+
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
|
834
834
|
}
|
|
835
835
|
|
|
836
836
|
/**
|
|
@@ -841,7 +841,7 @@ function isVisitable(thing) {
|
|
|
841
841
|
* @returns {string} the key without the brackets.
|
|
842
842
|
*/
|
|
843
843
|
function removeBrackets(key) {
|
|
844
|
-
return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
844
|
+
return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
845
845
|
}
|
|
846
846
|
|
|
847
847
|
/**
|
|
@@ -870,10 +870,10 @@ function renderKey(path, key, dots) {
|
|
|
870
870
|
* @returns {boolean}
|
|
871
871
|
*/
|
|
872
872
|
function isFlatArray(arr) {
|
|
873
|
-
return utils.isArray(arr) && !arr.some(isVisitable);
|
|
873
|
+
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
|
874
874
|
}
|
|
875
875
|
|
|
876
|
-
const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
|
|
876
|
+
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
|
|
877
877
|
return /^is[A-Z]/.test(prop);
|
|
878
878
|
});
|
|
879
879
|
|
|
@@ -901,7 +901,7 @@ const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
|
|
|
901
901
|
* @returns
|
|
902
902
|
*/
|
|
903
903
|
function toFormData(obj, formData, options) {
|
|
904
|
-
if (!utils.isObject(obj)) {
|
|
904
|
+
if (!utils$1.isObject(obj)) {
|
|
905
905
|
throw new TypeError('target must be an object');
|
|
906
906
|
}
|
|
907
907
|
|
|
@@ -909,13 +909,13 @@ function toFormData(obj, formData, options) {
|
|
|
909
909
|
formData = formData || new (FormData)();
|
|
910
910
|
|
|
911
911
|
// eslint-disable-next-line no-param-reassign
|
|
912
|
-
options = utils.toFlatObject(options, {
|
|
912
|
+
options = utils$1.toFlatObject(options, {
|
|
913
913
|
metaTokens: true,
|
|
914
914
|
dots: false,
|
|
915
915
|
indexes: false
|
|
916
916
|
}, false, function defined(option, source) {
|
|
917
917
|
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
918
|
-
return !utils.isUndefined(source[option]);
|
|
918
|
+
return !utils$1.isUndefined(source[option]);
|
|
919
919
|
});
|
|
920
920
|
|
|
921
921
|
const metaTokens = options.metaTokens;
|
|
@@ -924,24 +924,24 @@ function toFormData(obj, formData, options) {
|
|
|
924
924
|
const dots = options.dots;
|
|
925
925
|
const indexes = options.indexes;
|
|
926
926
|
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
927
|
-
const useBlob = _Blob && utils.isSpecCompliantForm(formData);
|
|
927
|
+
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
928
928
|
|
|
929
|
-
if (!utils.isFunction(visitor)) {
|
|
929
|
+
if (!utils$1.isFunction(visitor)) {
|
|
930
930
|
throw new TypeError('visitor must be a function');
|
|
931
931
|
}
|
|
932
932
|
|
|
933
933
|
function convertValue(value) {
|
|
934
934
|
if (value === null) return '';
|
|
935
935
|
|
|
936
|
-
if (utils.isDate(value)) {
|
|
936
|
+
if (utils$1.isDate(value)) {
|
|
937
937
|
return value.toISOString();
|
|
938
938
|
}
|
|
939
939
|
|
|
940
|
-
if (!useBlob && utils.isBlob(value)) {
|
|
940
|
+
if (!useBlob && utils$1.isBlob(value)) {
|
|
941
941
|
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
942
942
|
}
|
|
943
943
|
|
|
944
|
-
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
|
|
944
|
+
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
945
945
|
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
946
946
|
}
|
|
947
947
|
|
|
@@ -962,20 +962,20 @@ function toFormData(obj, formData, options) {
|
|
|
962
962
|
let arr = value;
|
|
963
963
|
|
|
964
964
|
if (value && !path && typeof value === 'object') {
|
|
965
|
-
if (utils.endsWith(key, '{}')) {
|
|
965
|
+
if (utils$1.endsWith(key, '{}')) {
|
|
966
966
|
// eslint-disable-next-line no-param-reassign
|
|
967
967
|
key = metaTokens ? key : key.slice(0, -2);
|
|
968
968
|
// eslint-disable-next-line no-param-reassign
|
|
969
969
|
value = JSON.stringify(value);
|
|
970
970
|
} else if (
|
|
971
|
-
(utils.isArray(value) && isFlatArray(value)) ||
|
|
972
|
-
((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))
|
|
971
|
+
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
972
|
+
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
|
|
973
973
|
)) {
|
|
974
974
|
// eslint-disable-next-line no-param-reassign
|
|
975
975
|
key = removeBrackets(key);
|
|
976
976
|
|
|
977
977
|
arr.forEach(function each(el, index) {
|
|
978
|
-
!(utils.isUndefined(el) || el === null) && formData.append(
|
|
978
|
+
!(utils$1.isUndefined(el) || el === null) && formData.append(
|
|
979
979
|
// eslint-disable-next-line no-nested-ternary
|
|
980
980
|
indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
|
|
981
981
|
convertValue(el)
|
|
@@ -1003,7 +1003,7 @@ function toFormData(obj, formData, options) {
|
|
|
1003
1003
|
});
|
|
1004
1004
|
|
|
1005
1005
|
function build(value, path) {
|
|
1006
|
-
if (utils.isUndefined(value)) return;
|
|
1006
|
+
if (utils$1.isUndefined(value)) return;
|
|
1007
1007
|
|
|
1008
1008
|
if (stack.indexOf(value) !== -1) {
|
|
1009
1009
|
throw Error('Circular reference detected in ' + path.join('.'));
|
|
@@ -1011,9 +1011,9 @@ function toFormData(obj, formData, options) {
|
|
|
1011
1011
|
|
|
1012
1012
|
stack.push(value);
|
|
1013
1013
|
|
|
1014
|
-
utils.forEach(value, function each(el, key) {
|
|
1015
|
-
const result = !(utils.isUndefined(el) || el === null) && visitor.call(
|
|
1016
|
-
formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
|
|
1014
|
+
utils$1.forEach(value, function each(el, key) {
|
|
1015
|
+
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
|
|
1016
|
+
formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
|
|
1017
1017
|
);
|
|
1018
1018
|
|
|
1019
1019
|
if (result === true) {
|
|
@@ -1024,7 +1024,7 @@ function toFormData(obj, formData, options) {
|
|
|
1024
1024
|
stack.pop();
|
|
1025
1025
|
}
|
|
1026
1026
|
|
|
1027
|
-
if (!utils.isObject(obj)) {
|
|
1027
|
+
if (!utils$1.isObject(obj)) {
|
|
1028
1028
|
throw new TypeError('data must be an object');
|
|
1029
1029
|
}
|
|
1030
1030
|
|
|
@@ -1128,7 +1128,7 @@ function buildURL(url, params, options) {
|
|
|
1128
1128
|
if (serializeFn) {
|
|
1129
1129
|
serializedParams = serializeFn(params, options);
|
|
1130
1130
|
} else {
|
|
1131
|
-
serializedParams = utils.isURLSearchParams(params) ?
|
|
1131
|
+
serializedParams = utils$1.isURLSearchParams(params) ?
|
|
1132
1132
|
params.toString() :
|
|
1133
1133
|
new AxiosURLSearchParams(params, options).toString(_encode);
|
|
1134
1134
|
}
|
|
@@ -1203,7 +1203,7 @@ class InterceptorManager {
|
|
|
1203
1203
|
* @returns {void}
|
|
1204
1204
|
*/
|
|
1205
1205
|
forEach(fn) {
|
|
1206
|
-
utils.forEach(this.handlers, function forEachHandler(h) {
|
|
1206
|
+
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
1207
1207
|
if (h !== null) {
|
|
1208
1208
|
fn(h);
|
|
1209
1209
|
}
|
|
@@ -1225,6 +1225,18 @@ var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
|
|
|
1225
1225
|
|
|
1226
1226
|
var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
|
|
1227
1227
|
|
|
1228
|
+
var platform$1 = {
|
|
1229
|
+
isBrowser: true,
|
|
1230
|
+
classes: {
|
|
1231
|
+
URLSearchParams: URLSearchParams$1,
|
|
1232
|
+
FormData: FormData$1,
|
|
1233
|
+
Blob: Blob$1
|
|
1234
|
+
},
|
|
1235
|
+
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
|
1236
|
+
};
|
|
1237
|
+
|
|
1238
|
+
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
1239
|
+
|
|
1228
1240
|
/**
|
|
1229
1241
|
* Determine if we're running in a standard browser environment
|
|
1230
1242
|
*
|
|
@@ -1242,18 +1254,10 @@ var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
|
|
|
1242
1254
|
*
|
|
1243
1255
|
* @returns {boolean}
|
|
1244
1256
|
*/
|
|
1245
|
-
const
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
product === 'NativeScript' ||
|
|
1250
|
-
product === 'NS')
|
|
1251
|
-
) {
|
|
1252
|
-
return false;
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
|
-
return typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
1256
|
-
})();
|
|
1257
|
+
const hasStandardBrowserEnv = (
|
|
1258
|
+
(product) => {
|
|
1259
|
+
return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
|
|
1260
|
+
})(typeof navigator !== 'undefined' && navigator.product);
|
|
1257
1261
|
|
|
1258
1262
|
/**
|
|
1259
1263
|
* Determine if we're running in a standard browser webWorker environment
|
|
@@ -1264,7 +1268,7 @@ const isStandardBrowserEnv = (() => {
|
|
|
1264
1268
|
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
|
1265
1269
|
* This leads to a problem when axios post `FormData` in webWorker
|
|
1266
1270
|
*/
|
|
1267
|
-
|
|
1271
|
+
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
1268
1272
|
return (
|
|
1269
1273
|
typeof WorkerGlobalScope !== 'undefined' &&
|
|
1270
1274
|
// eslint-disable-next-line no-undef
|
|
@@ -1273,23 +1277,22 @@ const isStandardBrowserEnv = (() => {
|
|
|
1273
1277
|
);
|
|
1274
1278
|
})();
|
|
1275
1279
|
|
|
1280
|
+
var utils = /*#__PURE__*/Object.freeze({
|
|
1281
|
+
__proto__: null,
|
|
1282
|
+
hasBrowserEnv: hasBrowserEnv,
|
|
1283
|
+
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
1284
|
+
hasStandardBrowserEnv: hasStandardBrowserEnv
|
|
1285
|
+
});
|
|
1276
1286
|
|
|
1277
1287
|
var platform = {
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
URLSearchParams: URLSearchParams$1,
|
|
1281
|
-
FormData: FormData$1,
|
|
1282
|
-
Blob: Blob$1
|
|
1283
|
-
},
|
|
1284
|
-
isStandardBrowserEnv,
|
|
1285
|
-
isStandardBrowserWebWorkerEnv,
|
|
1286
|
-
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
|
1288
|
+
...utils,
|
|
1289
|
+
...platform$1
|
|
1287
1290
|
};
|
|
1288
1291
|
|
|
1289
1292
|
function toURLEncodedForm(data, options) {
|
|
1290
1293
|
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
|
|
1291
1294
|
visitor: function(value, key, path, helpers) {
|
|
1292
|
-
if (platform.isNode && utils.isBuffer(value)) {
|
|
1295
|
+
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
1293
1296
|
this.append(key, value.toString('base64'));
|
|
1294
1297
|
return false;
|
|
1295
1298
|
}
|
|
@@ -1311,7 +1314,7 @@ function parsePropPath(name) {
|
|
|
1311
1314
|
// foo.x.y.z
|
|
1312
1315
|
// foo-x-y-z
|
|
1313
1316
|
// foo x y z
|
|
1314
|
-
return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
1317
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
1315
1318
|
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
1316
1319
|
});
|
|
1317
1320
|
}
|
|
@@ -1346,12 +1349,15 @@ function arrayToObject(arr) {
|
|
|
1346
1349
|
function formDataToJSON(formData) {
|
|
1347
1350
|
function buildPath(path, value, target, index) {
|
|
1348
1351
|
let name = path[index++];
|
|
1352
|
+
|
|
1353
|
+
if (name === '__proto__') return true;
|
|
1354
|
+
|
|
1349
1355
|
const isNumericKey = Number.isFinite(+name);
|
|
1350
1356
|
const isLast = index >= path.length;
|
|
1351
|
-
name = !name && utils.isArray(target) ? target.length : name;
|
|
1357
|
+
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
1352
1358
|
|
|
1353
1359
|
if (isLast) {
|
|
1354
|
-
if (utils.hasOwnProp(target, name)) {
|
|
1360
|
+
if (utils$1.hasOwnProp(target, name)) {
|
|
1355
1361
|
target[name] = [target[name], value];
|
|
1356
1362
|
} else {
|
|
1357
1363
|
target[name] = value;
|
|
@@ -1360,23 +1366,23 @@ function formDataToJSON(formData) {
|
|
|
1360
1366
|
return !isNumericKey;
|
|
1361
1367
|
}
|
|
1362
1368
|
|
|
1363
|
-
if (!target[name] || !utils.isObject(target[name])) {
|
|
1369
|
+
if (!target[name] || !utils$1.isObject(target[name])) {
|
|
1364
1370
|
target[name] = [];
|
|
1365
1371
|
}
|
|
1366
1372
|
|
|
1367
1373
|
const result = buildPath(path, value, target[name], index);
|
|
1368
1374
|
|
|
1369
|
-
if (result && utils.isArray(target[name])) {
|
|
1375
|
+
if (result && utils$1.isArray(target[name])) {
|
|
1370
1376
|
target[name] = arrayToObject(target[name]);
|
|
1371
1377
|
}
|
|
1372
1378
|
|
|
1373
1379
|
return !isNumericKey;
|
|
1374
1380
|
}
|
|
1375
1381
|
|
|
1376
|
-
if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
|
|
1382
|
+
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
|
|
1377
1383
|
const obj = {};
|
|
1378
1384
|
|
|
1379
|
-
utils.forEachEntry(formData, (name, value) => {
|
|
1385
|
+
utils$1.forEachEntry(formData, (name, value) => {
|
|
1380
1386
|
buildPath(parsePropPath(name), value, obj, 0);
|
|
1381
1387
|
});
|
|
1382
1388
|
|
|
@@ -1397,10 +1403,10 @@ function formDataToJSON(formData) {
|
|
|
1397
1403
|
* @returns {string} A stringified version of the rawValue.
|
|
1398
1404
|
*/
|
|
1399
1405
|
function stringifySafely(rawValue, parser, encoder) {
|
|
1400
|
-
if (utils.isString(rawValue)) {
|
|
1406
|
+
if (utils$1.isString(rawValue)) {
|
|
1401
1407
|
try {
|
|
1402
1408
|
(parser || JSON.parse)(rawValue);
|
|
1403
|
-
return utils.trim(rawValue);
|
|
1409
|
+
return utils$1.trim(rawValue);
|
|
1404
1410
|
} catch (e) {
|
|
1405
1411
|
if (e.name !== 'SyntaxError') {
|
|
1406
1412
|
throw e;
|
|
@@ -1420,33 +1426,30 @@ const defaults = {
|
|
|
1420
1426
|
transformRequest: [function transformRequest(data, headers) {
|
|
1421
1427
|
const contentType = headers.getContentType() || '';
|
|
1422
1428
|
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
1423
|
-
const isObjectPayload = utils.isObject(data);
|
|
1429
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
1424
1430
|
|
|
1425
|
-
if (isObjectPayload && utils.isHTMLForm(data)) {
|
|
1431
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
1426
1432
|
data = new FormData(data);
|
|
1427
1433
|
}
|
|
1428
1434
|
|
|
1429
|
-
const isFormData = utils.isFormData(data);
|
|
1435
|
+
const isFormData = utils$1.isFormData(data);
|
|
1430
1436
|
|
|
1431
1437
|
if (isFormData) {
|
|
1432
|
-
if (!hasJSONContentType) {
|
|
1433
|
-
return data;
|
|
1434
|
-
}
|
|
1435
1438
|
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
1436
1439
|
}
|
|
1437
1440
|
|
|
1438
|
-
if (utils.isArrayBuffer(data) ||
|
|
1439
|
-
utils.isBuffer(data) ||
|
|
1440
|
-
utils.isStream(data) ||
|
|
1441
|
-
utils.isFile(data) ||
|
|
1442
|
-
utils.isBlob(data)
|
|
1441
|
+
if (utils$1.isArrayBuffer(data) ||
|
|
1442
|
+
utils$1.isBuffer(data) ||
|
|
1443
|
+
utils$1.isStream(data) ||
|
|
1444
|
+
utils$1.isFile(data) ||
|
|
1445
|
+
utils$1.isBlob(data)
|
|
1443
1446
|
) {
|
|
1444
1447
|
return data;
|
|
1445
1448
|
}
|
|
1446
|
-
if (utils.isArrayBufferView(data)) {
|
|
1449
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
1447
1450
|
return data.buffer;
|
|
1448
1451
|
}
|
|
1449
|
-
if (utils.isURLSearchParams(data)) {
|
|
1452
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
1450
1453
|
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
1451
1454
|
return data.toString();
|
|
1452
1455
|
}
|
|
@@ -1458,7 +1461,7 @@ const defaults = {
|
|
|
1458
1461
|
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
1459
1462
|
}
|
|
1460
1463
|
|
|
1461
|
-
if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
|
1464
|
+
if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
|
1462
1465
|
const _FormData = this.env && this.env.FormData;
|
|
1463
1466
|
|
|
1464
1467
|
return toFormData(
|
|
@@ -1482,7 +1485,7 @@ const defaults = {
|
|
|
1482
1485
|
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
1483
1486
|
const JSONRequested = this.responseType === 'json';
|
|
1484
1487
|
|
|
1485
|
-
if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
1488
|
+
if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
1486
1489
|
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
1487
1490
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
1488
1491
|
|
|
@@ -1530,7 +1533,7 @@ const defaults = {
|
|
|
1530
1533
|
}
|
|
1531
1534
|
};
|
|
1532
1535
|
|
|
1533
|
-
utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
1536
|
+
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
1534
1537
|
defaults.headers[method] = {};
|
|
1535
1538
|
});
|
|
1536
1539
|
|
|
@@ -1538,7 +1541,7 @@ var defaults$1 = defaults;
|
|
|
1538
1541
|
|
|
1539
1542
|
// RawAxiosHeaders whose duplicates are ignored by node
|
|
1540
1543
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
1541
|
-
const ignoreDuplicateOf = utils.toObjectSet([
|
|
1544
|
+
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
1542
1545
|
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
|
1543
1546
|
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
|
1544
1547
|
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
|
@@ -1599,7 +1602,7 @@ function normalizeValue(value) {
|
|
|
1599
1602
|
return value;
|
|
1600
1603
|
}
|
|
1601
1604
|
|
|
1602
|
-
return utils.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
1605
|
+
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
1603
1606
|
}
|
|
1604
1607
|
|
|
1605
1608
|
function parseTokens(str) {
|
|
@@ -1617,7 +1620,7 @@ function parseTokens(str) {
|
|
|
1617
1620
|
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
1618
1621
|
|
|
1619
1622
|
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
1620
|
-
if (utils.isFunction(filter)) {
|
|
1623
|
+
if (utils$1.isFunction(filter)) {
|
|
1621
1624
|
return filter.call(this, value, header);
|
|
1622
1625
|
}
|
|
1623
1626
|
|
|
@@ -1625,13 +1628,13 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
|
1625
1628
|
value = header;
|
|
1626
1629
|
}
|
|
1627
1630
|
|
|
1628
|
-
if (!utils.isString(value)) return;
|
|
1631
|
+
if (!utils$1.isString(value)) return;
|
|
1629
1632
|
|
|
1630
|
-
if (utils.isString(filter)) {
|
|
1633
|
+
if (utils$1.isString(filter)) {
|
|
1631
1634
|
return value.indexOf(filter) !== -1;
|
|
1632
1635
|
}
|
|
1633
1636
|
|
|
1634
|
-
if (utils.isRegExp(filter)) {
|
|
1637
|
+
if (utils$1.isRegExp(filter)) {
|
|
1635
1638
|
return filter.test(value);
|
|
1636
1639
|
}
|
|
1637
1640
|
}
|
|
@@ -1644,7 +1647,7 @@ function formatHeader(header) {
|
|
|
1644
1647
|
}
|
|
1645
1648
|
|
|
1646
1649
|
function buildAccessors(obj, header) {
|
|
1647
|
-
const accessorName = utils.toCamelCase(' ' + header);
|
|
1650
|
+
const accessorName = utils$1.toCamelCase(' ' + header);
|
|
1648
1651
|
|
|
1649
1652
|
['get', 'set', 'has'].forEach(methodName => {
|
|
1650
1653
|
Object.defineProperty(obj, methodName + accessorName, {
|
|
@@ -1671,7 +1674,7 @@ class AxiosHeaders {
|
|
|
1671
1674
|
throw new Error('header name must be a non-empty string');
|
|
1672
1675
|
}
|
|
1673
1676
|
|
|
1674
|
-
const key = utils.findKey(self, lHeader);
|
|
1677
|
+
const key = utils$1.findKey(self, lHeader);
|
|
1675
1678
|
|
|
1676
1679
|
if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
|
|
1677
1680
|
self[key || _header] = normalizeValue(_value);
|
|
@@ -1679,11 +1682,11 @@ class AxiosHeaders {
|
|
|
1679
1682
|
}
|
|
1680
1683
|
|
|
1681
1684
|
const setHeaders = (headers, _rewrite) =>
|
|
1682
|
-
utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
1685
|
+
utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
1683
1686
|
|
|
1684
|
-
if (utils.isPlainObject(header) || header instanceof this.constructor) {
|
|
1687
|
+
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
1685
1688
|
setHeaders(header, valueOrRewrite);
|
|
1686
|
-
} else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1689
|
+
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1687
1690
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
1688
1691
|
} else {
|
|
1689
1692
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
@@ -1696,7 +1699,7 @@ class AxiosHeaders {
|
|
|
1696
1699
|
header = normalizeHeader(header);
|
|
1697
1700
|
|
|
1698
1701
|
if (header) {
|
|
1699
|
-
const key = utils.findKey(this, header);
|
|
1702
|
+
const key = utils$1.findKey(this, header);
|
|
1700
1703
|
|
|
1701
1704
|
if (key) {
|
|
1702
1705
|
const value = this[key];
|
|
@@ -1709,11 +1712,11 @@ class AxiosHeaders {
|
|
|
1709
1712
|
return parseTokens(value);
|
|
1710
1713
|
}
|
|
1711
1714
|
|
|
1712
|
-
if (utils.isFunction(parser)) {
|
|
1715
|
+
if (utils$1.isFunction(parser)) {
|
|
1713
1716
|
return parser.call(this, value, key);
|
|
1714
1717
|
}
|
|
1715
1718
|
|
|
1716
|
-
if (utils.isRegExp(parser)) {
|
|
1719
|
+
if (utils$1.isRegExp(parser)) {
|
|
1717
1720
|
return parser.exec(value);
|
|
1718
1721
|
}
|
|
1719
1722
|
|
|
@@ -1726,7 +1729,7 @@ class AxiosHeaders {
|
|
|
1726
1729
|
header = normalizeHeader(header);
|
|
1727
1730
|
|
|
1728
1731
|
if (header) {
|
|
1729
|
-
const key = utils.findKey(this, header);
|
|
1732
|
+
const key = utils$1.findKey(this, header);
|
|
1730
1733
|
|
|
1731
1734
|
return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
1732
1735
|
}
|
|
@@ -1742,7 +1745,7 @@ class AxiosHeaders {
|
|
|
1742
1745
|
_header = normalizeHeader(_header);
|
|
1743
1746
|
|
|
1744
1747
|
if (_header) {
|
|
1745
|
-
const key = utils.findKey(self, _header);
|
|
1748
|
+
const key = utils$1.findKey(self, _header);
|
|
1746
1749
|
|
|
1747
1750
|
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
1748
1751
|
delete self[key];
|
|
@@ -1752,7 +1755,7 @@ class AxiosHeaders {
|
|
|
1752
1755
|
}
|
|
1753
1756
|
}
|
|
1754
1757
|
|
|
1755
|
-
if (utils.isArray(header)) {
|
|
1758
|
+
if (utils$1.isArray(header)) {
|
|
1756
1759
|
header.forEach(deleteHeader);
|
|
1757
1760
|
} else {
|
|
1758
1761
|
deleteHeader(header);
|
|
@@ -1781,8 +1784,8 @@ class AxiosHeaders {
|
|
|
1781
1784
|
const self = this;
|
|
1782
1785
|
const headers = {};
|
|
1783
1786
|
|
|
1784
|
-
utils.forEach(this, (value, header) => {
|
|
1785
|
-
const key = utils.findKey(headers, header);
|
|
1787
|
+
utils$1.forEach(this, (value, header) => {
|
|
1788
|
+
const key = utils$1.findKey(headers, header);
|
|
1786
1789
|
|
|
1787
1790
|
if (key) {
|
|
1788
1791
|
self[key] = normalizeValue(value);
|
|
@@ -1811,8 +1814,8 @@ class AxiosHeaders {
|
|
|
1811
1814
|
toJSON(asStrings) {
|
|
1812
1815
|
const obj = Object.create(null);
|
|
1813
1816
|
|
|
1814
|
-
utils.forEach(this, (value, header) => {
|
|
1815
|
-
value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
|
|
1817
|
+
utils$1.forEach(this, (value, header) => {
|
|
1818
|
+
value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
|
|
1816
1819
|
});
|
|
1817
1820
|
|
|
1818
1821
|
return obj;
|
|
@@ -1859,7 +1862,7 @@ class AxiosHeaders {
|
|
|
1859
1862
|
}
|
|
1860
1863
|
}
|
|
1861
1864
|
|
|
1862
|
-
utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
1865
|
+
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
1863
1866
|
|
|
1864
1867
|
return this;
|
|
1865
1868
|
}
|
|
@@ -1868,7 +1871,7 @@ class AxiosHeaders {
|
|
|
1868
1871
|
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
|
|
1869
1872
|
|
|
1870
1873
|
// reserved names hotfix
|
|
1871
|
-
utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
|
1874
|
+
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
|
1872
1875
|
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
1873
1876
|
return {
|
|
1874
1877
|
get: () => value,
|
|
@@ -1878,7 +1881,7 @@ utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
|
|
1878
1881
|
}
|
|
1879
1882
|
});
|
|
1880
1883
|
|
|
1881
|
-
utils.freezeMethods(AxiosHeaders);
|
|
1884
|
+
utils$1.freezeMethods(AxiosHeaders);
|
|
1882
1885
|
|
|
1883
1886
|
var AxiosHeaders$1 = AxiosHeaders;
|
|
1884
1887
|
|
|
@@ -1896,7 +1899,7 @@ function transformData(fns, response) {
|
|
|
1896
1899
|
const headers = AxiosHeaders$1.from(context.headers);
|
|
1897
1900
|
let data = context.data;
|
|
1898
1901
|
|
|
1899
|
-
utils.forEach(fns, function transform(fn) {
|
|
1902
|
+
utils$1.forEach(fns, function transform(fn) {
|
|
1900
1903
|
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
|
|
1901
1904
|
});
|
|
1902
1905
|
|
|
@@ -1924,7 +1927,7 @@ function CanceledError(message, config, request) {
|
|
|
1924
1927
|
this.name = 'CanceledError';
|
|
1925
1928
|
}
|
|
1926
1929
|
|
|
1927
|
-
utils.inherits(CanceledError, AxiosError, {
|
|
1930
|
+
utils$1.inherits(CanceledError, AxiosError, {
|
|
1928
1931
|
__CANCEL__: true
|
|
1929
1932
|
});
|
|
1930
1933
|
|
|
@@ -1952,53 +1955,44 @@ function settle(resolve, reject, response) {
|
|
|
1952
1955
|
}
|
|
1953
1956
|
}
|
|
1954
1957
|
|
|
1955
|
-
var cookies = platform.
|
|
1958
|
+
var cookies = platform.hasStandardBrowserEnv ?
|
|
1956
1959
|
|
|
1957
|
-
// Standard browser envs support document.cookie
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
const cookie = [];
|
|
1962
|
-
cookie.push(name + '=' + encodeURIComponent(value));
|
|
1960
|
+
// Standard browser envs support document.cookie
|
|
1961
|
+
{
|
|
1962
|
+
write(name, value, expires, path, domain, secure) {
|
|
1963
|
+
const cookie = [name + '=' + encodeURIComponent(value)];
|
|
1963
1964
|
|
|
1964
|
-
|
|
1965
|
-
cookie.push('expires=' + new Date(expires).toGMTString());
|
|
1966
|
-
}
|
|
1965
|
+
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
|
1967
1966
|
|
|
1968
|
-
|
|
1969
|
-
cookie.push('path=' + path);
|
|
1970
|
-
}
|
|
1967
|
+
utils$1.isString(path) && cookie.push('path=' + path);
|
|
1971
1968
|
|
|
1972
|
-
|
|
1973
|
-
cookie.push('domain=' + domain);
|
|
1974
|
-
}
|
|
1969
|
+
utils$1.isString(domain) && cookie.push('domain=' + domain);
|
|
1975
1970
|
|
|
1976
|
-
|
|
1977
|
-
cookie.push('secure');
|
|
1978
|
-
}
|
|
1971
|
+
secure === true && cookie.push('secure');
|
|
1979
1972
|
|
|
1980
|
-
|
|
1981
|
-
|
|
1973
|
+
document.cookie = cookie.join('; ');
|
|
1974
|
+
},
|
|
1982
1975
|
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1976
|
+
read(name) {
|
|
1977
|
+
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
|
1978
|
+
return (match ? decodeURIComponent(match[3]) : null);
|
|
1979
|
+
},
|
|
1987
1980
|
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
})() :
|
|
1981
|
+
remove(name) {
|
|
1982
|
+
this.write(name, '', Date.now() - 86400000);
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1993
1985
|
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
1986
|
+
:
|
|
1987
|
+
|
|
1988
|
+
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
1989
|
+
{
|
|
1990
|
+
write() {},
|
|
1991
|
+
read() {
|
|
1992
|
+
return null;
|
|
1993
|
+
},
|
|
1994
|
+
remove() {}
|
|
1995
|
+
};
|
|
2002
1996
|
|
|
2003
1997
|
/**
|
|
2004
1998
|
* Determines whether the specified URL is absolute
|
|
@@ -2024,7 +2018,7 @@ function isAbsoluteURL(url) {
|
|
|
2024
2018
|
*/
|
|
2025
2019
|
function combineURLs(baseURL, relativeURL) {
|
|
2026
2020
|
return relativeURL
|
|
2027
|
-
? baseURL.replace(
|
|
2021
|
+
? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
|
2028
2022
|
: baseURL;
|
|
2029
2023
|
}
|
|
2030
2024
|
|
|
@@ -2045,7 +2039,7 @@ function buildFullPath(baseURL, requestedURL) {
|
|
|
2045
2039
|
return requestedURL;
|
|
2046
2040
|
}
|
|
2047
2041
|
|
|
2048
|
-
var isURLSameOrigin = platform.
|
|
2042
|
+
var isURLSameOrigin = platform.hasStandardBrowserEnv ?
|
|
2049
2043
|
|
|
2050
2044
|
// Standard browser envs have full support of the APIs needed to test
|
|
2051
2045
|
// whether the request URL is of the same origin as current location.
|
|
@@ -2055,7 +2049,7 @@ var isURLSameOrigin = platform.isStandardBrowserEnv ?
|
|
|
2055
2049
|
let originURL;
|
|
2056
2050
|
|
|
2057
2051
|
/**
|
|
2058
|
-
* Parse a URL to discover
|
|
2052
|
+
* Parse a URL to discover its components
|
|
2059
2053
|
*
|
|
2060
2054
|
* @param {String} url The URL to be parsed
|
|
2061
2055
|
* @returns {Object}
|
|
@@ -2095,7 +2089,7 @@ var isURLSameOrigin = platform.isStandardBrowserEnv ?
|
|
|
2095
2089
|
* @returns {boolean} True if URL shares the same origin, otherwise false
|
|
2096
2090
|
*/
|
|
2097
2091
|
return function isURLSameOrigin(requestURL) {
|
|
2098
|
-
const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
|
2092
|
+
const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
|
2099
2093
|
return (parsed.protocol === originURL.protocol &&
|
|
2100
2094
|
parsed.host === originURL.host);
|
|
2101
2095
|
};
|
|
@@ -2200,7 +2194,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
2200
2194
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
2201
2195
|
let requestData = config.data;
|
|
2202
2196
|
const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
|
|
2203
|
-
|
|
2197
|
+
let {responseType, withXSRFToken} = config;
|
|
2204
2198
|
let onCanceled;
|
|
2205
2199
|
function done() {
|
|
2206
2200
|
if (config.cancelToken) {
|
|
@@ -2214,14 +2208,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
2214
2208
|
|
|
2215
2209
|
let contentType;
|
|
2216
2210
|
|
|
2217
|
-
if (utils.isFormData(requestData)) {
|
|
2218
|
-
if (platform.
|
|
2211
|
+
if (utils$1.isFormData(requestData)) {
|
|
2212
|
+
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
2219
2213
|
requestHeaders.setContentType(false); // Let the browser set it
|
|
2220
|
-
} else if(
|
|
2221
|
-
requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
|
|
2222
|
-
} else if(utils.isString(contentType = requestHeaders.getContentType())){
|
|
2214
|
+
} else if ((contentType = requestHeaders.getContentType()) !== false) {
|
|
2223
2215
|
// fix semicolon duplication issue for ReactNative FormData implementation
|
|
2224
|
-
|
|
2216
|
+
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
|
|
2217
|
+
requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
|
|
2225
2218
|
}
|
|
2226
2219
|
}
|
|
2227
2220
|
|
|
@@ -2337,13 +2330,16 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
2337
2330
|
// Add xsrf header
|
|
2338
2331
|
// This is only done if running in a standard browser environment.
|
|
2339
2332
|
// Specifically not if we're in a web worker, or react-native.
|
|
2340
|
-
if
|
|
2341
|
-
|
|
2342
|
-
// regarding CVE-2023-45857 config.withCredentials condition was removed temporarily
|
|
2343
|
-
const xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
|
2333
|
+
if(platform.hasStandardBrowserEnv) {
|
|
2334
|
+
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
|
|
2344
2335
|
|
|
2345
|
-
if (
|
|
2346
|
-
|
|
2336
|
+
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
|
|
2337
|
+
// Add xsrf header
|
|
2338
|
+
const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
|
2339
|
+
|
|
2340
|
+
if (xsrfValue) {
|
|
2341
|
+
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
|
2342
|
+
}
|
|
2347
2343
|
}
|
|
2348
2344
|
}
|
|
2349
2345
|
|
|
@@ -2352,13 +2348,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
2352
2348
|
|
|
2353
2349
|
// Add headers to the request
|
|
2354
2350
|
if ('setRequestHeader' in request) {
|
|
2355
|
-
utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
2351
|
+
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
2356
2352
|
request.setRequestHeader(key, val);
|
|
2357
2353
|
});
|
|
2358
2354
|
}
|
|
2359
2355
|
|
|
2360
2356
|
// Add withCredentials to request if needed
|
|
2361
|
-
if (!utils.isUndefined(config.withCredentials)) {
|
|
2357
|
+
if (!utils$1.isUndefined(config.withCredentials)) {
|
|
2362
2358
|
request.withCredentials = !!config.withCredentials;
|
|
2363
2359
|
}
|
|
2364
2360
|
|
|
@@ -2413,7 +2409,7 @@ const knownAdapters = {
|
|
|
2413
2409
|
xhr: xhrAdapter
|
|
2414
2410
|
};
|
|
2415
2411
|
|
|
2416
|
-
utils.forEach(knownAdapters, (fn, value) => {
|
|
2412
|
+
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
2417
2413
|
if (fn) {
|
|
2418
2414
|
try {
|
|
2419
2415
|
Object.defineProperty(fn, 'name', {value});
|
|
@@ -2426,11 +2422,11 @@ utils.forEach(knownAdapters, (fn, value) => {
|
|
|
2426
2422
|
|
|
2427
2423
|
const renderReason = (reason) => `- ${reason}`;
|
|
2428
2424
|
|
|
2429
|
-
const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
|
|
2425
|
+
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
2430
2426
|
|
|
2431
2427
|
var adapters = {
|
|
2432
2428
|
getAdapter: (adapters) => {
|
|
2433
|
-
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
|
2429
|
+
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
|
2434
2430
|
|
|
2435
2431
|
const {length} = adapters;
|
|
2436
2432
|
let nameOrAdapter;
|
|
@@ -2554,7 +2550,7 @@ function dispatchRequest(config) {
|
|
|
2554
2550
|
});
|
|
2555
2551
|
}
|
|
2556
2552
|
|
|
2557
|
-
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing
|
|
2553
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
|
|
2558
2554
|
|
|
2559
2555
|
/**
|
|
2560
2556
|
* Config-specific merge-function which creates a new config-object
|
|
@@ -2571,11 +2567,11 @@ function mergeConfig(config1, config2) {
|
|
|
2571
2567
|
const config = {};
|
|
2572
2568
|
|
|
2573
2569
|
function getMergedValue(target, source, caseless) {
|
|
2574
|
-
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
2575
|
-
return utils.merge.call({caseless}, target, source);
|
|
2576
|
-
} else if (utils.isPlainObject(source)) {
|
|
2577
|
-
return utils.merge({}, source);
|
|
2578
|
-
} else if (utils.isArray(source)) {
|
|
2570
|
+
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
2571
|
+
return utils$1.merge.call({caseless}, target, source);
|
|
2572
|
+
} else if (utils$1.isPlainObject(source)) {
|
|
2573
|
+
return utils$1.merge({}, source);
|
|
2574
|
+
} else if (utils$1.isArray(source)) {
|
|
2579
2575
|
return source.slice();
|
|
2580
2576
|
}
|
|
2581
2577
|
return source;
|
|
@@ -2583,25 +2579,25 @@ function mergeConfig(config1, config2) {
|
|
|
2583
2579
|
|
|
2584
2580
|
// eslint-disable-next-line consistent-return
|
|
2585
2581
|
function mergeDeepProperties(a, b, caseless) {
|
|
2586
|
-
if (!utils.isUndefined(b)) {
|
|
2582
|
+
if (!utils$1.isUndefined(b)) {
|
|
2587
2583
|
return getMergedValue(a, b, caseless);
|
|
2588
|
-
} else if (!utils.isUndefined(a)) {
|
|
2584
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
2589
2585
|
return getMergedValue(undefined, a, caseless);
|
|
2590
2586
|
}
|
|
2591
2587
|
}
|
|
2592
2588
|
|
|
2593
2589
|
// eslint-disable-next-line consistent-return
|
|
2594
2590
|
function valueFromConfig2(a, b) {
|
|
2595
|
-
if (!utils.isUndefined(b)) {
|
|
2591
|
+
if (!utils$1.isUndefined(b)) {
|
|
2596
2592
|
return getMergedValue(undefined, b);
|
|
2597
2593
|
}
|
|
2598
2594
|
}
|
|
2599
2595
|
|
|
2600
2596
|
// eslint-disable-next-line consistent-return
|
|
2601
2597
|
function defaultToConfig2(a, b) {
|
|
2602
|
-
if (!utils.isUndefined(b)) {
|
|
2598
|
+
if (!utils$1.isUndefined(b)) {
|
|
2603
2599
|
return getMergedValue(undefined, b);
|
|
2604
|
-
} else if (!utils.isUndefined(a)) {
|
|
2600
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
2605
2601
|
return getMergedValue(undefined, a);
|
|
2606
2602
|
}
|
|
2607
2603
|
}
|
|
@@ -2626,6 +2622,7 @@ function mergeConfig(config1, config2) {
|
|
|
2626
2622
|
timeout: defaultToConfig2,
|
|
2627
2623
|
timeoutMessage: defaultToConfig2,
|
|
2628
2624
|
withCredentials: defaultToConfig2,
|
|
2625
|
+
withXSRFToken: defaultToConfig2,
|
|
2629
2626
|
adapter: defaultToConfig2,
|
|
2630
2627
|
responseType: defaultToConfig2,
|
|
2631
2628
|
xsrfCookieName: defaultToConfig2,
|
|
@@ -2646,16 +2643,16 @@ function mergeConfig(config1, config2) {
|
|
|
2646
2643
|
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
2647
2644
|
};
|
|
2648
2645
|
|
|
2649
|
-
utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
2646
|
+
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
2650
2647
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
2651
2648
|
const configValue = merge(config1[prop], config2[prop], prop);
|
|
2652
|
-
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
2649
|
+
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
2653
2650
|
});
|
|
2654
2651
|
|
|
2655
2652
|
return config;
|
|
2656
2653
|
}
|
|
2657
2654
|
|
|
2658
|
-
const VERSION = "1.6.
|
|
2655
|
+
const VERSION = "1.6.8";
|
|
2659
2656
|
|
|
2660
2657
|
const validators$1 = {};
|
|
2661
2658
|
|
|
@@ -2770,7 +2767,31 @@ class Axios {
|
|
|
2770
2767
|
*
|
|
2771
2768
|
* @returns {Promise} The Promise to be fulfilled
|
|
2772
2769
|
*/
|
|
2773
|
-
request(configOrUrl, config) {
|
|
2770
|
+
async request(configOrUrl, config) {
|
|
2771
|
+
try {
|
|
2772
|
+
return await this._request(configOrUrl, config);
|
|
2773
|
+
} catch (err) {
|
|
2774
|
+
if (err instanceof Error) {
|
|
2775
|
+
let dummy;
|
|
2776
|
+
|
|
2777
|
+
Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());
|
|
2778
|
+
|
|
2779
|
+
// slice off the Error: ... line
|
|
2780
|
+
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
|
2781
|
+
|
|
2782
|
+
if (!err.stack) {
|
|
2783
|
+
err.stack = stack;
|
|
2784
|
+
// match without the 2 top stack lines
|
|
2785
|
+
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
|
2786
|
+
err.stack += '\n' + stack;
|
|
2787
|
+
}
|
|
2788
|
+
}
|
|
2789
|
+
|
|
2790
|
+
throw err;
|
|
2791
|
+
}
|
|
2792
|
+
}
|
|
2793
|
+
|
|
2794
|
+
_request(configOrUrl, config) {
|
|
2774
2795
|
/*eslint no-param-reassign:0*/
|
|
2775
2796
|
// Allow for axios('example/url'[, config]) a la fetch API
|
|
2776
2797
|
if (typeof configOrUrl === 'string') {
|
|
@@ -2793,7 +2814,7 @@ class Axios {
|
|
|
2793
2814
|
}
|
|
2794
2815
|
|
|
2795
2816
|
if (paramsSerializer != null) {
|
|
2796
|
-
if (utils.isFunction(paramsSerializer)) {
|
|
2817
|
+
if (utils$1.isFunction(paramsSerializer)) {
|
|
2797
2818
|
config.paramsSerializer = {
|
|
2798
2819
|
serialize: paramsSerializer
|
|
2799
2820
|
};
|
|
@@ -2809,12 +2830,12 @@ class Axios {
|
|
|
2809
2830
|
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
|
2810
2831
|
|
|
2811
2832
|
// Flatten headers
|
|
2812
|
-
let contextHeaders = headers && utils.merge(
|
|
2833
|
+
let contextHeaders = headers && utils$1.merge(
|
|
2813
2834
|
headers.common,
|
|
2814
2835
|
headers[config.method]
|
|
2815
2836
|
);
|
|
2816
2837
|
|
|
2817
|
-
headers && utils.forEach(
|
|
2838
|
+
headers && utils$1.forEach(
|
|
2818
2839
|
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
2819
2840
|
(method) => {
|
|
2820
2841
|
delete headers[method];
|
|
@@ -2901,7 +2922,7 @@ class Axios {
|
|
|
2901
2922
|
}
|
|
2902
2923
|
|
|
2903
2924
|
// Provide aliases for supported request methods
|
|
2904
|
-
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
2925
|
+
utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
2905
2926
|
/*eslint func-names:0*/
|
|
2906
2927
|
Axios.prototype[method] = function(url, config) {
|
|
2907
2928
|
return this.request(mergeConfig(config || {}, {
|
|
@@ -2912,7 +2933,7 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
|
|
|
2912
2933
|
};
|
|
2913
2934
|
});
|
|
2914
2935
|
|
|
2915
|
-
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
2936
|
+
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
2916
2937
|
/*eslint func-names:0*/
|
|
2917
2938
|
|
|
2918
2939
|
function generateHTTPMethod(isForm) {
|
|
@@ -3088,7 +3109,7 @@ function spread(callback) {
|
|
|
3088
3109
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
3089
3110
|
*/
|
|
3090
3111
|
function isAxiosError(payload) {
|
|
3091
|
-
return utils.isObject(payload) && (payload.isAxiosError === true);
|
|
3112
|
+
return utils$1.isObject(payload) && (payload.isAxiosError === true);
|
|
3092
3113
|
}
|
|
3093
3114
|
|
|
3094
3115
|
const HttpStatusCode = {
|
|
@@ -3175,10 +3196,10 @@ function createInstance(defaultConfig) {
|
|
|
3175
3196
|
const instance = bind(Axios$1.prototype.request, context);
|
|
3176
3197
|
|
|
3177
3198
|
// Copy axios.prototype to instance
|
|
3178
|
-
utils.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
|
|
3199
|
+
utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
|
|
3179
3200
|
|
|
3180
3201
|
// Copy context to instance
|
|
3181
|
-
utils.extend(instance, context, null, {allOwnKeys: true});
|
|
3202
|
+
utils$1.extend(instance, context, null, {allOwnKeys: true});
|
|
3182
3203
|
|
|
3183
3204
|
// Factory for creating new instances
|
|
3184
3205
|
instance.create = function create(instanceConfig) {
|
|
@@ -3222,7 +3243,7 @@ axios.mergeConfig = mergeConfig;
|
|
|
3222
3243
|
|
|
3223
3244
|
axios.AxiosHeaders = AxiosHeaders$1;
|
|
3224
3245
|
|
|
3225
|
-
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
3246
|
+
axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
3226
3247
|
|
|
3227
3248
|
axios.getAdapter = adapters.getAdapter;
|
|
3228
3249
|
|
|
@@ -3234,7 +3255,7 @@ axios.default = axios;
|
|
|
3234
3255
|
var axios$1 = axios;
|
|
3235
3256
|
|
|
3236
3257
|
var name$1 = "@tryghost/content-api";
|
|
3237
|
-
var version = "1.11.
|
|
3258
|
+
var version = "1.11.21";
|
|
3238
3259
|
var repository = "https://github.com/TryGhost/SDK/tree/main/packages/content-api";
|
|
3239
3260
|
var author = "Ghost Foundation";
|
|
3240
3261
|
var license = "MIT";
|
|
@@ -3263,14 +3284,14 @@ var publishConfig = {
|
|
|
3263
3284
|
access: "public"
|
|
3264
3285
|
};
|
|
3265
3286
|
var devDependencies = {
|
|
3266
|
-
"@babel/core": "7.
|
|
3287
|
+
"@babel/core": "7.24.4",
|
|
3267
3288
|
"@babel/polyfill": "7.12.1",
|
|
3268
|
-
"@babel/preset-env": "7.
|
|
3269
|
-
"@rollup/plugin-json": "6.0
|
|
3270
|
-
c8: "
|
|
3271
|
-
"core-js": "3.
|
|
3272
|
-
"eslint-plugin-ghost": "3.
|
|
3273
|
-
mocha: "10.
|
|
3289
|
+
"@babel/preset-env": "7.24.4",
|
|
3290
|
+
"@rollup/plugin-json": "6.1.0",
|
|
3291
|
+
c8: "9.1.0",
|
|
3292
|
+
"core-js": "3.37.0",
|
|
3293
|
+
"eslint-plugin-ghost": "3.4.0",
|
|
3294
|
+
mocha: "10.4.0",
|
|
3274
3295
|
rollup: "2.79.1",
|
|
3275
3296
|
"rollup-plugin-babel": "4.4.0",
|
|
3276
3297
|
"rollup-plugin-commonjs": "10.1.0",
|
|
@@ -3279,12 +3300,12 @@ var devDependencies = {
|
|
|
3279
3300
|
"rollup-plugin-replace": "2.2.0",
|
|
3280
3301
|
"rollup-plugin-terser": "7.0.2",
|
|
3281
3302
|
should: "13.2.3",
|
|
3282
|
-
sinon: "17.0.
|
|
3303
|
+
sinon: "17.0.1"
|
|
3283
3304
|
};
|
|
3284
3305
|
var dependencies = {
|
|
3285
3306
|
axios: "^1.0.0"
|
|
3286
3307
|
};
|
|
3287
|
-
var gitHead = "
|
|
3308
|
+
var gitHead = "048ccde4bd78d2dcd60e778d03eb8dc3227cece5";
|
|
3288
3309
|
var packageInfo = {
|
|
3289
3310
|
name: name$1,
|
|
3290
3311
|
version: version,
|