@kontent-ai/core-sdk 10.11.0 → 10.12.1

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.
@@ -899,9 +899,16 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
899
899
  \***************************************************/
900
900
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
901
901
 
902
- /*! Axios v1.9.0 Copyright (c) 2025 Matt Zabriskie and contributors */
902
+ /*! Axios v1.13.2 Copyright (c) 2025 Matt Zabriskie and contributors */
903
903
 
904
904
 
905
+ /**
906
+ * Create a bound version of a function with a specified `this` context
907
+ *
908
+ * @param {Function} fn - The function to bind
909
+ * @param {*} thisArg - The value to be passed as the `this` parameter
910
+ * @returns {Function} A new function that will call the original function with the specified `this` context
911
+ */
905
912
  function bind(fn, thisArg) {
906
913
  return function wrap() {
907
914
  return fn.apply(thisArg, arguments);
@@ -953,7 +960,7 @@ const isUndefined = typeOfTest('undefined');
953
960
  */
954
961
  function isBuffer(val) {
955
962
  return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
956
- && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
963
+ && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
957
964
  }
958
965
 
959
966
  /**
@@ -998,7 +1005,7 @@ const isString = typeOfTest('string');
998
1005
  * @param {*} val The value to test
999
1006
  * @returns {boolean} True if value is a Function, otherwise false
1000
1007
  */
1001
- const isFunction = typeOfTest('function');
1008
+ const isFunction$1 = typeOfTest('function');
1002
1009
 
1003
1010
  /**
1004
1011
  * Determine if a value is a Number
@@ -1042,6 +1049,27 @@ const isPlainObject = (val) => {
1042
1049
  return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
1043
1050
  };
1044
1051
 
1052
+ /**
1053
+ * Determine if a value is an empty object (safely handles Buffers)
1054
+ *
1055
+ * @param {*} val The value to test
1056
+ *
1057
+ * @returns {boolean} True if value is an empty object, otherwise false
1058
+ */
1059
+ const isEmptyObject = (val) => {
1060
+ // Early return for non-objects or Buffers to prevent RangeError
1061
+ if (!isObject(val) || isBuffer(val)) {
1062
+ return false;
1063
+ }
1064
+
1065
+ try {
1066
+ return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
1067
+ } catch (e) {
1068
+ // Fallback for any other objects that might cause RangeError with Object.keys()
1069
+ return false;
1070
+ }
1071
+ };
1072
+
1045
1073
  /**
1046
1074
  * Determine if a value is a Date
1047
1075
  *
@@ -1085,7 +1113,7 @@ const isFileList = kindOfTest('FileList');
1085
1113
  *
1086
1114
  * @returns {boolean} True if value is a Stream, otherwise false
1087
1115
  */
1088
- const isStream = (val) => isObject(val) && isFunction(val.pipe);
1116
+ const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
1089
1117
 
1090
1118
  /**
1091
1119
  * Determine if a value is a FormData
@@ -1098,10 +1126,10 @@ const isFormData = (thing) => {
1098
1126
  let kind;
1099
1127
  return thing && (
1100
1128
  (typeof FormData === 'function' && thing instanceof FormData) || (
1101
- isFunction(thing.append) && (
1129
+ isFunction$1(thing.append) && (
1102
1130
  (kind = kindOf(thing)) === 'formdata' ||
1103
1131
  // detect form-data instance
1104
- (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
1132
+ (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
1105
1133
  )
1106
1134
  )
1107
1135
  )
@@ -1164,6 +1192,11 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
1164
1192
  fn.call(null, obj[i], i, obj);
1165
1193
  }
1166
1194
  } else {
1195
+ // Buffer check
1196
+ if (isBuffer(obj)) {
1197
+ return;
1198
+ }
1199
+
1167
1200
  // Iterate over object keys
1168
1201
  const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
1169
1202
  const len = keys.length;
@@ -1177,6 +1210,10 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
1177
1210
  }
1178
1211
 
1179
1212
  function findKey(obj, key) {
1213
+ if (isBuffer(obj)){
1214
+ return null;
1215
+ }
1216
+
1180
1217
  key = key.toLowerCase();
1181
1218
  const keys = Object.keys(obj);
1182
1219
  let i = keys.length;
@@ -1217,7 +1254,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
1217
1254
  * @returns {Object} Result of all merge properties
1218
1255
  */
1219
1256
  function merge(/* obj1, obj2, obj3, ... */) {
1220
- const {caseless} = isContextDefined(this) && this || {};
1257
+ const {caseless, skipUndefined} = isContextDefined(this) && this || {};
1221
1258
  const result = {};
1222
1259
  const assignValue = (val, key) => {
1223
1260
  const targetKey = caseless && findKey(result, key) || key;
@@ -1227,7 +1264,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
1227
1264
  result[targetKey] = merge({}, val);
1228
1265
  } else if (isArray(val)) {
1229
1266
  result[targetKey] = val.slice();
1230
- } else {
1267
+ } else if (!skipUndefined || !isUndefined(val)) {
1231
1268
  result[targetKey] = val;
1232
1269
  }
1233
1270
  };
@@ -1250,7 +1287,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
1250
1287
  */
1251
1288
  const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
1252
1289
  forEach(b, (val, key) => {
1253
- if (thisArg && isFunction(val)) {
1290
+ if (thisArg && isFunction$1(val)) {
1254
1291
  a[key] = bind(val, thisArg);
1255
1292
  } else {
1256
1293
  a[key] = val;
@@ -1466,13 +1503,13 @@ const reduceDescriptors = (obj, reducer) => {
1466
1503
  const freezeMethods = (obj) => {
1467
1504
  reduceDescriptors(obj, (descriptor, name) => {
1468
1505
  // skip restricted props in strict mode
1469
- if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
1506
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
1470
1507
  return false;
1471
1508
  }
1472
1509
 
1473
1510
  const value = obj[name];
1474
1511
 
1475
- if (!isFunction(value)) return;
1512
+ if (!isFunction$1(value)) return;
1476
1513
 
1477
1514
  descriptor.enumerable = false;
1478
1515
 
@@ -1509,6 +1546,8 @@ const toFiniteNumber = (value, defaultValue) => {
1509
1546
  return value != null && Number.isFinite(value = +value) ? value : defaultValue;
1510
1547
  };
1511
1548
 
1549
+
1550
+
1512
1551
  /**
1513
1552
  * If the thing is a FormData object, return true, otherwise return false.
1514
1553
  *
@@ -1517,7 +1556,7 @@ const toFiniteNumber = (value, defaultValue) => {
1517
1556
  * @returns {boolean}
1518
1557
  */
1519
1558
  function isSpecCompliantForm(thing) {
1520
- return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
1559
+ return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
1521
1560
  }
1522
1561
 
1523
1562
  const toJSONObject = (obj) => {
@@ -1530,6 +1569,11 @@ const toJSONObject = (obj) => {
1530
1569
  return;
1531
1570
  }
1532
1571
 
1572
+ //Buffer check
1573
+ if (isBuffer(source)) {
1574
+ return source;
1575
+ }
1576
+
1533
1577
  if(!('toJSON' in source)) {
1534
1578
  stack[i] = source;
1535
1579
  const target = isArray(source) ? [] : {};
@@ -1554,7 +1598,7 @@ const toJSONObject = (obj) => {
1554
1598
  const isAsyncFn = kindOfTest('AsyncFunction');
1555
1599
 
1556
1600
  const isThenable = (thing) =>
1557
- thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
1601
+ thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
1558
1602
 
1559
1603
  // original code
1560
1604
  // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
@@ -1578,7 +1622,7 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
1578
1622
  })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
1579
1623
  })(
1580
1624
  typeof setImmediate === 'function',
1581
- isFunction(_global.postMessage)
1625
+ isFunction$1(_global.postMessage)
1582
1626
  );
1583
1627
 
1584
1628
  const asap = typeof queueMicrotask !== 'undefined' ?
@@ -1587,7 +1631,7 @@ const asap = typeof queueMicrotask !== 'undefined' ?
1587
1631
  // *********************
1588
1632
 
1589
1633
 
1590
- const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
1634
+ const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
1591
1635
 
1592
1636
 
1593
1637
  var utils$1 = {
@@ -1601,6 +1645,7 @@ var utils$1 = {
1601
1645
  isBoolean,
1602
1646
  isObject,
1603
1647
  isPlainObject,
1648
+ isEmptyObject,
1604
1649
  isReadableStream,
1605
1650
  isRequest,
1606
1651
  isResponse,
@@ -1610,7 +1655,7 @@ var utils$1 = {
1610
1655
  isFile,
1611
1656
  isBlob,
1612
1657
  isRegExp,
1613
- isFunction,
1658
+ isFunction: isFunction$1,
1614
1659
  isStream,
1615
1660
  isURLSearchParams,
1616
1661
  isTypedArray,
@@ -1736,11 +1781,18 @@ AxiosError.from = (error, code, config, request, response, customProps) => {
1736
1781
  return prop !== 'isAxiosError';
1737
1782
  });
1738
1783
 
1739
- AxiosError.call(axiosError, error.message, code, config, request, response);
1784
+ const msg = error && error.message ? error.message : 'Error';
1740
1785
 
1741
- axiosError.cause = error;
1786
+ // Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
1787
+ const errCode = code == null && error ? error.code : code;
1788
+ AxiosError.call(axiosError, msg, errCode, config, request, response);
1742
1789
 
1743
- axiosError.name = error.name;
1790
+ // Chain the original error on the standard field; non-enumerable to avoid JSON noise
1791
+ if (error && axiosError.cause == null) {
1792
+ Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
1793
+ }
1794
+
1795
+ axiosError.name = (error && error.name) || 'Error';
1744
1796
 
1745
1797
  customProps && Object.assign(axiosError, customProps);
1746
1798
 
@@ -1865,6 +1917,10 @@ function toFormData(obj, formData, options) {
1865
1917
  return value.toISOString();
1866
1918
  }
1867
1919
 
1920
+ if (utils$1.isBoolean(value)) {
1921
+ return value.toString();
1922
+ }
1923
+
1868
1924
  if (!useBlob && utils$1.isBlob(value)) {
1869
1925
  throw new AxiosError('Blob is not supported. Use a Buffer instead.');
1870
1926
  }
@@ -2027,9 +2083,7 @@ function encode(val) {
2027
2083
  replace(/%3A/gi, ':').
2028
2084
  replace(/%24/g, '$').
2029
2085
  replace(/%2C/gi, ',').
2030
- replace(/%20/g, '+').
2031
- replace(/%5B/gi, '[').
2032
- replace(/%5D/gi, ']');
2086
+ replace(/%20/g, '+');
2033
2087
  }
2034
2088
 
2035
2089
  /**
@@ -2107,7 +2161,7 @@ class InterceptorManager {
2107
2161
  *
2108
2162
  * @param {Number} id The ID that was returned by `use`
2109
2163
  *
2110
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
2164
+ * @returns {void}
2111
2165
  */
2112
2166
  eject(id) {
2113
2167
  if (this.handlers[id]) {
@@ -2228,7 +2282,7 @@ var platform = {
2228
2282
  };
2229
2283
 
2230
2284
  function toURLEncodedForm(data, options) {
2231
- return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
2285
+ return toFormData(data, new platform.classes.URLSearchParams(), {
2232
2286
  visitor: function(value, key, path, helpers) {
2233
2287
  if (platform.isNode && utils$1.isBuffer(value)) {
2234
2288
  this.append(key, value.toString('base64'));
@@ -2236,8 +2290,9 @@ function toURLEncodedForm(data, options) {
2236
2290
  }
2237
2291
 
2238
2292
  return helpers.defaultVisitor.apply(this, arguments);
2239
- }
2240
- }, options));
2293
+ },
2294
+ ...options
2295
+ });
2241
2296
  }
2242
2297
 
2243
2298
  /**
@@ -2433,7 +2488,7 @@ const defaults = {
2433
2488
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
2434
2489
 
2435
2490
  try {
2436
- return JSON.parse(data);
2491
+ return JSON.parse(data, this.parseReviver);
2437
2492
  } catch (e) {
2438
2493
  if (strictJSONParsing) {
2439
2494
  if (e.name === 'SyntaxError') {
@@ -2990,7 +3045,7 @@ function throttle(fn, freq) {
2990
3045
  clearTimeout(timer);
2991
3046
  timer = null;
2992
3047
  }
2993
- fn.apply(null, args);
3048
+ fn(...args);
2994
3049
  };
2995
3050
 
2996
3051
  const throttled = (...args) => {
@@ -3072,27 +3127,38 @@ var cookies = platform.hasStandardBrowserEnv ?
3072
3127
 
3073
3128
  // Standard browser envs support document.cookie
3074
3129
  {
3075
- write(name, value, expires, path, domain, secure) {
3076
- const cookie = [name + '=' + encodeURIComponent(value)];
3077
-
3078
- utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
3130
+ write(name, value, expires, path, domain, secure, sameSite) {
3131
+ if (typeof document === 'undefined') return;
3079
3132
 
3080
- utils$1.isString(path) && cookie.push('path=' + path);
3133
+ const cookie = [`${name}=${encodeURIComponent(value)}`];
3081
3134
 
3082
- utils$1.isString(domain) && cookie.push('domain=' + domain);
3083
-
3084
- secure === true && cookie.push('secure');
3135
+ if (utils$1.isNumber(expires)) {
3136
+ cookie.push(`expires=${new Date(expires).toUTCString()}`);
3137
+ }
3138
+ if (utils$1.isString(path)) {
3139
+ cookie.push(`path=${path}`);
3140
+ }
3141
+ if (utils$1.isString(domain)) {
3142
+ cookie.push(`domain=${domain}`);
3143
+ }
3144
+ if (secure === true) {
3145
+ cookie.push('secure');
3146
+ }
3147
+ if (utils$1.isString(sameSite)) {
3148
+ cookie.push(`SameSite=${sameSite}`);
3149
+ }
3085
3150
 
3086
3151
  document.cookie = cookie.join('; ');
3087
3152
  },
3088
3153
 
3089
3154
  read(name) {
3090
- const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
3091
- return (match ? decodeURIComponent(match[3]) : null);
3155
+ if (typeof document === 'undefined') return null;
3156
+ const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
3157
+ return match ? decodeURIComponent(match[1]) : null;
3092
3158
  },
3093
3159
 
3094
3160
  remove(name) {
3095
- this.write(name, '', Date.now() - 86400000);
3161
+ this.write(name, '', Date.now() - 86400000, '/');
3096
3162
  }
3097
3163
  }
3098
3164
 
@@ -3181,11 +3247,11 @@ function mergeConfig(config1, config2) {
3181
3247
  }
3182
3248
 
3183
3249
  // eslint-disable-next-line consistent-return
3184
- function mergeDeepProperties(a, b, prop , caseless) {
3250
+ function mergeDeepProperties(a, b, prop, caseless) {
3185
3251
  if (!utils$1.isUndefined(b)) {
3186
- return getMergedValue(a, b, prop , caseless);
3252
+ return getMergedValue(a, b, prop, caseless);
3187
3253
  } else if (!utils$1.isUndefined(a)) {
3188
- return getMergedValue(undefined, a, prop , caseless);
3254
+ return getMergedValue(undefined, a, prop, caseless);
3189
3255
  }
3190
3256
  }
3191
3257
 
@@ -3243,10 +3309,10 @@ function mergeConfig(config1, config2) {
3243
3309
  socketPath: defaultToConfig2,
3244
3310
  responseEncoding: defaultToConfig2,
3245
3311
  validateStatus: mergeDirectKeys,
3246
- headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
3312
+ headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
3247
3313
  };
3248
3314
 
3249
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
3315
+ utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
3250
3316
  const merge = mergeMap[prop] || mergeDeepProperties;
3251
3317
  const configValue = merge(config1[prop], config2[prop], prop);
3252
3318
  (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
@@ -3258,7 +3324,7 @@ function mergeConfig(config1, config2) {
3258
3324
  var resolveConfig = (config) => {
3259
3325
  const newConfig = mergeConfig({}, config);
3260
3326
 
3261
- let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
3327
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
3262
3328
 
3263
3329
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
3264
3330
 
@@ -3271,17 +3337,21 @@ var resolveConfig = (config) => {
3271
3337
  );
3272
3338
  }
3273
3339
 
3274
- let contentType;
3275
-
3276
3340
  if (utils$1.isFormData(data)) {
3277
3341
  if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
3278
- headers.setContentType(undefined); // Let the browser set it
3279
- } else if ((contentType = headers.getContentType()) !== false) {
3280
- // fix semicolon duplication issue for ReactNative FormData implementation
3281
- const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
3282
- headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
3342
+ headers.setContentType(undefined); // browser handles it
3343
+ } else if (utils$1.isFunction(data.getHeaders)) {
3344
+ // Node.js FormData (like form-data package)
3345
+ const formHeaders = data.getHeaders();
3346
+ // Only set safe headers to avoid overwriting security headers
3347
+ const allowedHeaders = ['content-type', 'content-length'];
3348
+ Object.entries(formHeaders).forEach(([key, val]) => {
3349
+ if (allowedHeaders.includes(key.toLowerCase())) {
3350
+ headers.set(key, val);
3351
+ }
3352
+ });
3283
3353
  }
3284
- }
3354
+ }
3285
3355
 
3286
3356
  // Add xsrf header
3287
3357
  // This is only done if running in a standard browser environment.
@@ -3398,15 +3468,18 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
3398
3468
  };
3399
3469
 
3400
3470
  // Handle low level network errors
3401
- request.onerror = function handleError() {
3402
- // Real errors are hidden from us by the browser
3403
- // onerror should only fire if it's a network error
3404
- reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
3405
-
3406
- // Clean up request
3407
- request = null;
3471
+ request.onerror = function handleError(event) {
3472
+ // Browsers deliver a ProgressEvent in XHR onerror
3473
+ // (message may be empty; when present, surface it)
3474
+ // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
3475
+ const msg = event && event.message ? event.message : 'Network Error';
3476
+ const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
3477
+ // attach the underlying event for consumers who want details
3478
+ err.event = event || null;
3479
+ reject(err);
3480
+ request = null;
3408
3481
  };
3409
-
3482
+
3410
3483
  // Handle timeout
3411
3484
  request.ontimeout = function handleTimeout() {
3412
3485
  let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
@@ -3622,14 +3695,18 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
3622
3695
  })
3623
3696
  };
3624
3697
 
3625
- const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
3626
- const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
3698
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
3699
+
3700
+ const {isFunction} = utils$1;
3701
+
3702
+ const globalFetchAPI = (({Request, Response}) => ({
3703
+ Request, Response
3704
+ }))(utils$1.global);
3705
+
3706
+ const {
3707
+ ReadableStream: ReadableStream$1, TextEncoder
3708
+ } = utils$1.global;
3627
3709
 
3628
- // used only inside the fetch adapter
3629
- const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
3630
- ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
3631
- async (str) => new Uint8Array(await new Response(str).arrayBuffer())
3632
- );
3633
3710
 
3634
3711
  const test = (fn, ...args) => {
3635
3712
  try {
@@ -3639,278 +3716,380 @@ const test = (fn, ...args) => {
3639
3716
  }
3640
3717
  };
3641
3718
 
3642
- const supportsRequestStream = isReadableStreamSupported && test(() => {
3643
- let duplexAccessed = false;
3719
+ const factory = (env) => {
3720
+ env = utils$1.merge.call({
3721
+ skipUndefined: true
3722
+ }, globalFetchAPI, env);
3644
3723
 
3645
- const hasContentType = new Request(platform.origin, {
3646
- body: new ReadableStream(),
3647
- method: 'POST',
3648
- get duplex() {
3649
- duplexAccessed = true;
3650
- return 'half';
3651
- },
3652
- }).headers.has('Content-Type');
3724
+ const {fetch: envFetch, Request, Response} = env;
3725
+ const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
3726
+ const isRequestSupported = isFunction(Request);
3727
+ const isResponseSupported = isFunction(Response);
3653
3728
 
3654
- return duplexAccessed && !hasContentType;
3655
- });
3729
+ if (!isFetchSupported) {
3730
+ return false;
3731
+ }
3656
3732
 
3657
- const DEFAULT_CHUNK_SIZE = 64 * 1024;
3733
+ const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
3658
3734
 
3659
- const supportsResponseStream = isReadableStreamSupported &&
3660
- test(() => utils$1.isReadableStream(new Response('').body));
3735
+ const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
3736
+ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
3737
+ async (str) => new Uint8Array(await new Request(str).arrayBuffer())
3738
+ );
3661
3739
 
3740
+ const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
3741
+ let duplexAccessed = false;
3662
3742
 
3663
- const resolvers = {
3664
- stream: supportsResponseStream && ((res) => res.body)
3665
- };
3743
+ const hasContentType = new Request(platform.origin, {
3744
+ body: new ReadableStream$1(),
3745
+ method: 'POST',
3746
+ get duplex() {
3747
+ duplexAccessed = true;
3748
+ return 'half';
3749
+ },
3750
+ }).headers.has('Content-Type');
3666
3751
 
3667
- isFetchSupported && (((res) => {
3668
- ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
3669
- !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
3670
- (_, config) => {
3671
- throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
3672
- });
3752
+ return duplexAccessed && !hasContentType;
3673
3753
  });
3674
- })(new Response));
3675
3754
 
3676
- const getBodyLength = async (body) => {
3677
- if (body == null) {
3678
- return 0;
3679
- }
3755
+ const supportsResponseStream = isResponseSupported && isReadableStreamSupported &&
3756
+ test(() => utils$1.isReadableStream(new Response('').body));
3680
3757
 
3681
- if(utils$1.isBlob(body)) {
3682
- return body.size;
3683
- }
3758
+ const resolvers = {
3759
+ stream: supportsResponseStream && ((res) => res.body)
3760
+ };
3684
3761
 
3685
- if(utils$1.isSpecCompliantForm(body)) {
3686
- const _request = new Request(platform.origin, {
3687
- method: 'POST',
3688
- body,
3762
+ isFetchSupported && ((() => {
3763
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
3764
+ !resolvers[type] && (resolvers[type] = (res, config) => {
3765
+ let method = res && res[type];
3766
+
3767
+ if (method) {
3768
+ return method.call(res);
3769
+ }
3770
+
3771
+ throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
3772
+ });
3689
3773
  });
3690
- return (await _request.arrayBuffer()).byteLength;
3691
- }
3774
+ })());
3692
3775
 
3693
- if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
3694
- return body.byteLength;
3695
- }
3776
+ const getBodyLength = async (body) => {
3777
+ if (body == null) {
3778
+ return 0;
3779
+ }
3696
3780
 
3697
- if(utils$1.isURLSearchParams(body)) {
3698
- body = body + '';
3699
- }
3781
+ if (utils$1.isBlob(body)) {
3782
+ return body.size;
3783
+ }
3700
3784
 
3701
- if(utils$1.isString(body)) {
3702
- return (await encodeText(body)).byteLength;
3703
- }
3704
- };
3785
+ if (utils$1.isSpecCompliantForm(body)) {
3786
+ const _request = new Request(platform.origin, {
3787
+ method: 'POST',
3788
+ body,
3789
+ });
3790
+ return (await _request.arrayBuffer()).byteLength;
3791
+ }
3705
3792
 
3706
- const resolveBodyLength = async (headers, body) => {
3707
- const length = utils$1.toFiniteNumber(headers.getContentLength());
3793
+ if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
3794
+ return body.byteLength;
3795
+ }
3708
3796
 
3709
- return length == null ? getBodyLength(body) : length;
3710
- };
3797
+ if (utils$1.isURLSearchParams(body)) {
3798
+ body = body + '';
3799
+ }
3800
+
3801
+ if (utils$1.isString(body)) {
3802
+ return (await encodeText(body)).byteLength;
3803
+ }
3804
+ };
3805
+
3806
+ const resolveBodyLength = async (headers, body) => {
3807
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
3808
+
3809
+ return length == null ? getBodyLength(body) : length;
3810
+ };
3711
3811
 
3712
- var fetchAdapter = isFetchSupported && (async (config) => {
3713
- let {
3714
- url,
3715
- method,
3716
- data,
3717
- signal,
3718
- cancelToken,
3719
- timeout,
3720
- onDownloadProgress,
3721
- onUploadProgress,
3722
- responseType,
3723
- headers,
3724
- withCredentials = 'same-origin',
3725
- fetchOptions
3726
- } = resolveConfig(config);
3727
-
3728
- responseType = responseType ? (responseType + '').toLowerCase() : 'text';
3729
-
3730
- let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
3731
-
3732
- let request;
3733
-
3734
- const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
3812
+ return async (config) => {
3813
+ let {
3814
+ url,
3815
+ method,
3816
+ data,
3817
+ signal,
3818
+ cancelToken,
3819
+ timeout,
3820
+ onDownloadProgress,
3821
+ onUploadProgress,
3822
+ responseType,
3823
+ headers,
3824
+ withCredentials = 'same-origin',
3825
+ fetchOptions
3826
+ } = resolveConfig(config);
3827
+
3828
+ let _fetch = envFetch || fetch;
3829
+
3830
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
3831
+
3832
+ let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
3833
+
3834
+ let request = null;
3835
+
3836
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
3735
3837
  composedSignal.unsubscribe();
3736
- });
3838
+ });
3737
3839
 
3738
- let requestContentLength;
3840
+ let requestContentLength;
3739
3841
 
3740
- try {
3741
- if (
3742
- onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
3743
- (requestContentLength = await resolveBodyLength(headers, data)) !== 0
3744
- ) {
3745
- let _request = new Request(url, {
3746
- method: 'POST',
3747
- body: data,
3748
- duplex: "half"
3749
- });
3842
+ try {
3843
+ if (
3844
+ onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
3845
+ (requestContentLength = await resolveBodyLength(headers, data)) !== 0
3846
+ ) {
3847
+ let _request = new Request(url, {
3848
+ method: 'POST',
3849
+ body: data,
3850
+ duplex: "half"
3851
+ });
3750
3852
 
3751
- let contentTypeHeader;
3853
+ let contentTypeHeader;
3752
3854
 
3753
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
3754
- headers.setContentType(contentTypeHeader);
3755
- }
3855
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
3856
+ headers.setContentType(contentTypeHeader);
3857
+ }
3756
3858
 
3757
- if (_request.body) {
3758
- const [onProgress, flush] = progressEventDecorator(
3759
- requestContentLength,
3760
- progressEventReducer(asyncDecorator(onUploadProgress))
3761
- );
3859
+ if (_request.body) {
3860
+ const [onProgress, flush] = progressEventDecorator(
3861
+ requestContentLength,
3862
+ progressEventReducer(asyncDecorator(onUploadProgress))
3863
+ );
3762
3864
 
3763
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
3865
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
3866
+ }
3764
3867
  }
3765
- }
3766
3868
 
3767
- if (!utils$1.isString(withCredentials)) {
3768
- withCredentials = withCredentials ? 'include' : 'omit';
3769
- }
3869
+ if (!utils$1.isString(withCredentials)) {
3870
+ withCredentials = withCredentials ? 'include' : 'omit';
3871
+ }
3770
3872
 
3771
- // Cloudflare Workers throws when credentials are defined
3772
- // see https://github.com/cloudflare/workerd/issues/902
3773
- const isCredentialsSupported = "credentials" in Request.prototype;
3774
- request = new Request(url, {
3775
- ...fetchOptions,
3776
- signal: composedSignal,
3777
- method: method.toUpperCase(),
3778
- headers: headers.normalize().toJSON(),
3779
- body: data,
3780
- duplex: "half",
3781
- credentials: isCredentialsSupported ? withCredentials : undefined
3782
- });
3873
+ // Cloudflare Workers throws when credentials are defined
3874
+ // see https://github.com/cloudflare/workerd/issues/902
3875
+ const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
3876
+
3877
+ const resolvedOptions = {
3878
+ ...fetchOptions,
3879
+ signal: composedSignal,
3880
+ method: method.toUpperCase(),
3881
+ headers: headers.normalize().toJSON(),
3882
+ body: data,
3883
+ duplex: "half",
3884
+ credentials: isCredentialsSupported ? withCredentials : undefined
3885
+ };
3783
3886
 
3784
- let response = await fetch(request);
3887
+ request = isRequestSupported && new Request(url, resolvedOptions);
3785
3888
 
3786
- const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3889
+ let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
3787
3890
 
3788
- if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
3789
- const options = {};
3891
+ const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3790
3892
 
3791
- ['status', 'statusText', 'headers'].forEach(prop => {
3792
- options[prop] = response[prop];
3793
- });
3893
+ if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
3894
+ const options = {};
3794
3895
 
3795
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
3896
+ ['status', 'statusText', 'headers'].forEach(prop => {
3897
+ options[prop] = response[prop];
3898
+ });
3796
3899
 
3797
- const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
3798
- responseContentLength,
3799
- progressEventReducer(asyncDecorator(onDownloadProgress), true)
3800
- ) || [];
3900
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
3801
3901
 
3802
- response = new Response(
3803
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
3804
- flush && flush();
3805
- unsubscribe && unsubscribe();
3806
- }),
3807
- options
3808
- );
3809
- }
3902
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
3903
+ responseContentLength,
3904
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
3905
+ ) || [];
3810
3906
 
3811
- responseType = responseType || 'text';
3907
+ response = new Response(
3908
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
3909
+ flush && flush();
3910
+ unsubscribe && unsubscribe();
3911
+ }),
3912
+ options
3913
+ );
3914
+ }
3812
3915
 
3813
- let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
3916
+ responseType = responseType || 'text';
3814
3917
 
3815
- !isStreamResponse && unsubscribe && unsubscribe();
3918
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
3816
3919
 
3817
- return await new Promise((resolve, reject) => {
3818
- settle(resolve, reject, {
3819
- data: responseData,
3820
- headers: AxiosHeaders$1.from(response.headers),
3821
- status: response.status,
3822
- statusText: response.statusText,
3823
- config,
3824
- request
3825
- });
3826
- })
3827
- } catch (err) {
3828
- unsubscribe && unsubscribe();
3829
-
3830
- if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
3831
- throw Object.assign(
3832
- new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
3833
- {
3834
- cause: err.cause || err
3835
- }
3836
- )
3920
+ !isStreamResponse && unsubscribe && unsubscribe();
3921
+
3922
+ return await new Promise((resolve, reject) => {
3923
+ settle(resolve, reject, {
3924
+ data: responseData,
3925
+ headers: AxiosHeaders$1.from(response.headers),
3926
+ status: response.status,
3927
+ statusText: response.statusText,
3928
+ config,
3929
+ request
3930
+ });
3931
+ })
3932
+ } catch (err) {
3933
+ unsubscribe && unsubscribe();
3934
+
3935
+ if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
3936
+ throw Object.assign(
3937
+ new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
3938
+ {
3939
+ cause: err.cause || err
3940
+ }
3941
+ )
3942
+ }
3943
+
3944
+ throw AxiosError.from(err, err && err.code, config, request);
3837
3945
  }
3946
+ }
3947
+ };
3948
+
3949
+ const seedCache = new Map();
3950
+
3951
+ const getFetch = (config) => {
3952
+ let env = (config && config.env) || {};
3953
+ const {fetch, Request, Response} = env;
3954
+ const seeds = [
3955
+ Request, Response, fetch
3956
+ ];
3957
+
3958
+ let len = seeds.length, i = len,
3959
+ seed, target, map = seedCache;
3960
+
3961
+ while (i--) {
3962
+ seed = seeds[i];
3963
+ target = map.get(seed);
3964
+
3965
+ target === undefined && map.set(seed, target = (i ? new Map() : factory(env)));
3838
3966
 
3839
- throw AxiosError.from(err, err && err.code, config, request);
3967
+ map = target;
3840
3968
  }
3841
- });
3842
3969
 
3970
+ return target;
3971
+ };
3972
+
3973
+ getFetch();
3974
+
3975
+ /**
3976
+ * Known adapters mapping.
3977
+ * Provides environment-specific adapters for Axios:
3978
+ * - `http` for Node.js
3979
+ * - `xhr` for browsers
3980
+ * - `fetch` for fetch API-based requests
3981
+ *
3982
+ * @type {Object<string, Function|Object>}
3983
+ */
3843
3984
  const knownAdapters = {
3844
3985
  http: httpAdapter,
3845
3986
  xhr: xhrAdapter,
3846
- fetch: fetchAdapter
3987
+ fetch: {
3988
+ get: getFetch,
3989
+ }
3847
3990
  };
3848
3991
 
3992
+ // Assign adapter names for easier debugging and identification
3849
3993
  utils$1.forEach(knownAdapters, (fn, value) => {
3850
3994
  if (fn) {
3851
3995
  try {
3852
- Object.defineProperty(fn, 'name', {value});
3996
+ Object.defineProperty(fn, 'name', { value });
3853
3997
  } catch (e) {
3854
3998
  // eslint-disable-next-line no-empty
3855
3999
  }
3856
- Object.defineProperty(fn, 'adapterName', {value});
4000
+ Object.defineProperty(fn, 'adapterName', { value });
3857
4001
  }
3858
4002
  });
3859
4003
 
4004
+ /**
4005
+ * Render a rejection reason string for unknown or unsupported adapters
4006
+ *
4007
+ * @param {string} reason
4008
+ * @returns {string}
4009
+ */
3860
4010
  const renderReason = (reason) => `- ${reason}`;
3861
4011
 
4012
+ /**
4013
+ * Check if the adapter is resolved (function, null, or false)
4014
+ *
4015
+ * @param {Function|null|false} adapter
4016
+ * @returns {boolean}
4017
+ */
3862
4018
  const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
3863
4019
 
3864
- var adapters = {
3865
- getAdapter: (adapters) => {
3866
- adapters = utils$1.isArray(adapters) ? adapters : [adapters];
4020
+ /**
4021
+ * Get the first suitable adapter from the provided list.
4022
+ * Tries each adapter in order until a supported one is found.
4023
+ * Throws an AxiosError if no adapter is suitable.
4024
+ *
4025
+ * @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
4026
+ * @param {Object} config - Axios request configuration
4027
+ * @throws {AxiosError} If no suitable adapter is available
4028
+ * @returns {Function} The resolved adapter function
4029
+ */
4030
+ function getAdapter(adapters, config) {
4031
+ adapters = utils$1.isArray(adapters) ? adapters : [adapters];
3867
4032
 
3868
- const {length} = adapters;
3869
- let nameOrAdapter;
3870
- let adapter;
4033
+ const { length } = adapters;
4034
+ let nameOrAdapter;
4035
+ let adapter;
3871
4036
 
3872
- const rejectedReasons = {};
4037
+ const rejectedReasons = {};
3873
4038
 
3874
- for (let i = 0; i < length; i++) {
3875
- nameOrAdapter = adapters[i];
3876
- let id;
4039
+ for (let i = 0; i < length; i++) {
4040
+ nameOrAdapter = adapters[i];
4041
+ let id;
3877
4042
 
3878
- adapter = nameOrAdapter;
4043
+ adapter = nameOrAdapter;
3879
4044
 
3880
- if (!isResolvedHandle(nameOrAdapter)) {
3881
- adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
4045
+ if (!isResolvedHandle(nameOrAdapter)) {
4046
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
3882
4047
 
3883
- if (adapter === undefined) {
3884
- throw new AxiosError(`Unknown adapter '${id}'`);
3885
- }
3886
- }
3887
-
3888
- if (adapter) {
3889
- break;
4048
+ if (adapter === undefined) {
4049
+ throw new AxiosError(`Unknown adapter '${id}'`);
3890
4050
  }
4051
+ }
3891
4052
 
3892
- rejectedReasons[id || '#' + i] = adapter;
4053
+ if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
4054
+ break;
3893
4055
  }
3894
4056
 
3895
- if (!adapter) {
4057
+ rejectedReasons[id || '#' + i] = adapter;
4058
+ }
3896
4059
 
3897
- const reasons = Object.entries(rejectedReasons)
3898
- .map(([id, state]) => `adapter ${id} ` +
3899
- (state === false ? 'is not supported by the environment' : 'is not available in the build')
3900
- );
4060
+ if (!adapter) {
4061
+ const reasons = Object.entries(rejectedReasons)
4062
+ .map(([id, state]) => `adapter ${id} ` +
4063
+ (state === false ? 'is not supported by the environment' : 'is not available in the build')
4064
+ );
3901
4065
 
3902
- let s = length ?
3903
- (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
3904
- 'as no adapter specified';
4066
+ let s = length ?
4067
+ (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
4068
+ 'as no adapter specified';
3905
4069
 
3906
- throw new AxiosError(
3907
- `There is no suitable adapter to dispatch the request ` + s,
3908
- 'ERR_NOT_SUPPORT'
3909
- );
3910
- }
4070
+ throw new AxiosError(
4071
+ `There is no suitable adapter to dispatch the request ` + s,
4072
+ 'ERR_NOT_SUPPORT'
4073
+ );
4074
+ }
3911
4075
 
3912
- return adapter;
3913
- },
4076
+ return adapter;
4077
+ }
4078
+
4079
+ /**
4080
+ * Exports Axios adapters and utility to resolve an adapter
4081
+ */
4082
+ var adapters = {
4083
+ /**
4084
+ * Resolve an adapter from a list of adapter names or functions.
4085
+ * @type {Function}
4086
+ */
4087
+ getAdapter,
4088
+
4089
+ /**
4090
+ * Exposes all known adapters
4091
+ * @type {Object<string, Function|Object>}
4092
+ */
3914
4093
  adapters: knownAdapters
3915
4094
  };
3916
4095
 
@@ -3953,7 +4132,7 @@ function dispatchRequest(config) {
3953
4132
  config.headers.setContentType('application/x-www-form-urlencoded', false);
3954
4133
  }
3955
4134
 
3956
- const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
4135
+ const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
3957
4136
 
3958
4137
  return adapter(config).then(function onAdapterResolution(response) {
3959
4138
  throwIfCancellationRequested(config);
@@ -3987,7 +4166,7 @@ function dispatchRequest(config) {
3987
4166
  });
3988
4167
  }
3989
4168
 
3990
- const VERSION = "1.9.0";
4169
+ const VERSION = "1.13.2";
3991
4170
 
3992
4171
  const validators$1 = {};
3993
4172
 
@@ -4226,8 +4405,8 @@ class Axios {
4226
4405
 
4227
4406
  if (!synchronousRequestInterceptors) {
4228
4407
  const chain = [dispatchRequest.bind(this), undefined];
4229
- chain.unshift.apply(chain, requestInterceptorChain);
4230
- chain.push.apply(chain, responseInterceptorChain);
4408
+ chain.unshift(...requestInterceptorChain);
4409
+ chain.push(...responseInterceptorChain);
4231
4410
  len = chain.length;
4232
4411
 
4233
4412
  promise = Promise.resolve(config);
@@ -4243,8 +4422,6 @@ class Axios {
4243
4422
 
4244
4423
  let newConfig = config;
4245
4424
 
4246
- i = 0;
4247
-
4248
4425
  while (i < len) {
4249
4426
  const onFulfilled = requestInterceptorChain[i++];
4250
4427
  const onRejected = requestInterceptorChain[i++];
@@ -4548,6 +4725,12 @@ const HttpStatusCode = {
4548
4725
  LoopDetected: 508,
4549
4726
  NotExtended: 510,
4550
4727
  NetworkAuthenticationRequired: 511,
4728
+ WebServerIsDown: 521,
4729
+ ConnectionTimedOut: 522,
4730
+ OriginIsUnreachable: 523,
4731
+ TimeoutOccurred: 524,
4732
+ SslHandshakeFailed: 525,
4733
+ InvalidSslCertificate: 526,
4551
4734
  };
4552
4735
 
4553
4736
  Object.entries(HttpStatusCode).forEach(([key, value]) => {