@kontent-ai/core-sdk 10.12.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.11.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
@@ -1054,7 +1061,7 @@ const isEmptyObject = (val) => {
1054
1061
  if (!isObject(val) || isBuffer(val)) {
1055
1062
  return false;
1056
1063
  }
1057
-
1064
+
1058
1065
  try {
1059
1066
  return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
1060
1067
  } catch (e) {
@@ -1106,7 +1113,7 @@ const isFileList = kindOfTest('FileList');
1106
1113
  *
1107
1114
  * @returns {boolean} True if value is a Stream, otherwise false
1108
1115
  */
1109
- const isStream = (val) => isObject(val) && isFunction(val.pipe);
1116
+ const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
1110
1117
 
1111
1118
  /**
1112
1119
  * Determine if a value is a FormData
@@ -1119,10 +1126,10 @@ const isFormData = (thing) => {
1119
1126
  let kind;
1120
1127
  return thing && (
1121
1128
  (typeof FormData === 'function' && thing instanceof FormData) || (
1122
- isFunction(thing.append) && (
1129
+ isFunction$1(thing.append) && (
1123
1130
  (kind = kindOf(thing)) === 'formdata' ||
1124
1131
  // detect form-data instance
1125
- (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
1132
+ (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
1126
1133
  )
1127
1134
  )
1128
1135
  )
@@ -1247,7 +1254,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
1247
1254
  * @returns {Object} Result of all merge properties
1248
1255
  */
1249
1256
  function merge(/* obj1, obj2, obj3, ... */) {
1250
- const {caseless} = isContextDefined(this) && this || {};
1257
+ const {caseless, skipUndefined} = isContextDefined(this) && this || {};
1251
1258
  const result = {};
1252
1259
  const assignValue = (val, key) => {
1253
1260
  const targetKey = caseless && findKey(result, key) || key;
@@ -1257,7 +1264,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
1257
1264
  result[targetKey] = merge({}, val);
1258
1265
  } else if (isArray(val)) {
1259
1266
  result[targetKey] = val.slice();
1260
- } else {
1267
+ } else if (!skipUndefined || !isUndefined(val)) {
1261
1268
  result[targetKey] = val;
1262
1269
  }
1263
1270
  };
@@ -1280,7 +1287,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
1280
1287
  */
1281
1288
  const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
1282
1289
  forEach(b, (val, key) => {
1283
- if (thisArg && isFunction(val)) {
1290
+ if (thisArg && isFunction$1(val)) {
1284
1291
  a[key] = bind(val, thisArg);
1285
1292
  } else {
1286
1293
  a[key] = val;
@@ -1496,13 +1503,13 @@ const reduceDescriptors = (obj, reducer) => {
1496
1503
  const freezeMethods = (obj) => {
1497
1504
  reduceDescriptors(obj, (descriptor, name) => {
1498
1505
  // skip restricted props in strict mode
1499
- if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
1506
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
1500
1507
  return false;
1501
1508
  }
1502
1509
 
1503
1510
  const value = obj[name];
1504
1511
 
1505
- if (!isFunction(value)) return;
1512
+ if (!isFunction$1(value)) return;
1506
1513
 
1507
1514
  descriptor.enumerable = false;
1508
1515
 
@@ -1539,6 +1546,8 @@ const toFiniteNumber = (value, defaultValue) => {
1539
1546
  return value != null && Number.isFinite(value = +value) ? value : defaultValue;
1540
1547
  };
1541
1548
 
1549
+
1550
+
1542
1551
  /**
1543
1552
  * If the thing is a FormData object, return true, otherwise return false.
1544
1553
  *
@@ -1547,7 +1556,7 @@ const toFiniteNumber = (value, defaultValue) => {
1547
1556
  * @returns {boolean}
1548
1557
  */
1549
1558
  function isSpecCompliantForm(thing) {
1550
- return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
1559
+ return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
1551
1560
  }
1552
1561
 
1553
1562
  const toJSONObject = (obj) => {
@@ -1589,7 +1598,7 @@ const toJSONObject = (obj) => {
1589
1598
  const isAsyncFn = kindOfTest('AsyncFunction');
1590
1599
 
1591
1600
  const isThenable = (thing) =>
1592
- 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);
1593
1602
 
1594
1603
  // original code
1595
1604
  // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
@@ -1613,7 +1622,7 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
1613
1622
  })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
1614
1623
  })(
1615
1624
  typeof setImmediate === 'function',
1616
- isFunction(_global.postMessage)
1625
+ isFunction$1(_global.postMessage)
1617
1626
  );
1618
1627
 
1619
1628
  const asap = typeof queueMicrotask !== 'undefined' ?
@@ -1622,7 +1631,7 @@ const asap = typeof queueMicrotask !== 'undefined' ?
1622
1631
  // *********************
1623
1632
 
1624
1633
 
1625
- const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
1634
+ const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
1626
1635
 
1627
1636
 
1628
1637
  var utils$1 = {
@@ -1646,7 +1655,7 @@ var utils$1 = {
1646
1655
  isFile,
1647
1656
  isBlob,
1648
1657
  isRegExp,
1649
- isFunction,
1658
+ isFunction: isFunction$1,
1650
1659
  isStream,
1651
1660
  isURLSearchParams,
1652
1661
  isTypedArray,
@@ -1772,11 +1781,18 @@ AxiosError.from = (error, code, config, request, response, customProps) => {
1772
1781
  return prop !== 'isAxiosError';
1773
1782
  });
1774
1783
 
1775
- AxiosError.call(axiosError, error.message, code, config, request, response);
1784
+ const msg = error && error.message ? error.message : 'Error';
1776
1785
 
1777
- 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);
1778
1789
 
1779
- 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';
1780
1796
 
1781
1797
  customProps && Object.assign(axiosError, customProps);
1782
1798
 
@@ -2067,9 +2083,7 @@ function encode(val) {
2067
2083
  replace(/%3A/gi, ':').
2068
2084
  replace(/%24/g, '$').
2069
2085
  replace(/%2C/gi, ',').
2070
- replace(/%20/g, '+').
2071
- replace(/%5B/gi, '[').
2072
- replace(/%5D/gi, ']');
2086
+ replace(/%20/g, '+');
2073
2087
  }
2074
2088
 
2075
2089
  /**
@@ -2147,7 +2161,7 @@ class InterceptorManager {
2147
2161
  *
2148
2162
  * @param {Number} id The ID that was returned by `use`
2149
2163
  *
2150
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
2164
+ * @returns {void}
2151
2165
  */
2152
2166
  eject(id) {
2153
2167
  if (this.handlers[id]) {
@@ -2474,7 +2488,7 @@ const defaults = {
2474
2488
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
2475
2489
 
2476
2490
  try {
2477
- return JSON.parse(data);
2491
+ return JSON.parse(data, this.parseReviver);
2478
2492
  } catch (e) {
2479
2493
  if (strictJSONParsing) {
2480
2494
  if (e.name === 'SyntaxError') {
@@ -3113,27 +3127,38 @@ var cookies = platform.hasStandardBrowserEnv ?
3113
3127
 
3114
3128
  // Standard browser envs support document.cookie
3115
3129
  {
3116
- write(name, value, expires, path, domain, secure) {
3117
- const cookie = [name + '=' + encodeURIComponent(value)];
3130
+ write(name, value, expires, path, domain, secure, sameSite) {
3131
+ if (typeof document === 'undefined') return;
3118
3132
 
3119
- utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
3133
+ const cookie = [`${name}=${encodeURIComponent(value)}`];
3120
3134
 
3121
- utils$1.isString(path) && cookie.push('path=' + path);
3122
-
3123
- utils$1.isString(domain) && cookie.push('domain=' + domain);
3124
-
3125
- 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
+ }
3126
3150
 
3127
3151
  document.cookie = cookie.join('; ');
3128
3152
  },
3129
3153
 
3130
3154
  read(name) {
3131
- const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
3132
- 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;
3133
3158
  },
3134
3159
 
3135
3160
  remove(name) {
3136
- this.write(name, '', Date.now() - 86400000);
3161
+ this.write(name, '', Date.now() - 86400000, '/');
3137
3162
  }
3138
3163
  }
3139
3164
 
@@ -3222,11 +3247,11 @@ function mergeConfig(config1, config2) {
3222
3247
  }
3223
3248
 
3224
3249
  // eslint-disable-next-line consistent-return
3225
- function mergeDeepProperties(a, b, prop , caseless) {
3250
+ function mergeDeepProperties(a, b, prop, caseless) {
3226
3251
  if (!utils$1.isUndefined(b)) {
3227
- return getMergedValue(a, b, prop , caseless);
3252
+ return getMergedValue(a, b, prop, caseless);
3228
3253
  } else if (!utils$1.isUndefined(a)) {
3229
- return getMergedValue(undefined, a, prop , caseless);
3254
+ return getMergedValue(undefined, a, prop, caseless);
3230
3255
  }
3231
3256
  }
3232
3257
 
@@ -3284,7 +3309,7 @@ function mergeConfig(config1, config2) {
3284
3309
  socketPath: defaultToConfig2,
3285
3310
  responseEncoding: defaultToConfig2,
3286
3311
  validateStatus: mergeDirectKeys,
3287
- headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
3312
+ headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
3288
3313
  };
3289
3314
 
3290
3315
  utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
@@ -3299,7 +3324,7 @@ function mergeConfig(config1, config2) {
3299
3324
  var resolveConfig = (config) => {
3300
3325
  const newConfig = mergeConfig({}, config);
3301
3326
 
3302
- let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
3327
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
3303
3328
 
3304
3329
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
3305
3330
 
@@ -3312,17 +3337,21 @@ var resolveConfig = (config) => {
3312
3337
  );
3313
3338
  }
3314
3339
 
3315
- let contentType;
3316
-
3317
3340
  if (utils$1.isFormData(data)) {
3318
3341
  if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
3319
- headers.setContentType(undefined); // Let the browser set it
3320
- } else if ((contentType = headers.getContentType()) !== false) {
3321
- // fix semicolon duplication issue for ReactNative FormData implementation
3322
- const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
3323
- 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
+ });
3324
3353
  }
3325
- }
3354
+ }
3326
3355
 
3327
3356
  // Add xsrf header
3328
3357
  // This is only done if running in a standard browser environment.
@@ -3439,15 +3468,18 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
3439
3468
  };
3440
3469
 
3441
3470
  // Handle low level network errors
3442
- request.onerror = function handleError() {
3443
- // Real errors are hidden from us by the browser
3444
- // onerror should only fire if it's a network error
3445
- reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
3446
-
3447
- // Clean up request
3448
- 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;
3449
3481
  };
3450
-
3482
+
3451
3483
  // Handle timeout
3452
3484
  request.ontimeout = function handleTimeout() {
3453
3485
  let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
@@ -3663,14 +3695,18 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
3663
3695
  })
3664
3696
  };
3665
3697
 
3666
- const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
3667
- 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;
3668
3709
 
3669
- // used only inside the fetch adapter
3670
- const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
3671
- ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
3672
- async (str) => new Uint8Array(await new Response(str).arrayBuffer())
3673
- );
3674
3710
 
3675
3711
  const test = (fn, ...args) => {
3676
3712
  try {
@@ -3680,278 +3716,380 @@ const test = (fn, ...args) => {
3680
3716
  }
3681
3717
  };
3682
3718
 
3683
- const supportsRequestStream = isReadableStreamSupported && test(() => {
3684
- let duplexAccessed = false;
3719
+ const factory = (env) => {
3720
+ env = utils$1.merge.call({
3721
+ skipUndefined: true
3722
+ }, globalFetchAPI, env);
3685
3723
 
3686
- const hasContentType = new Request(platform.origin, {
3687
- body: new ReadableStream(),
3688
- method: 'POST',
3689
- get duplex() {
3690
- duplexAccessed = true;
3691
- return 'half';
3692
- },
3693
- }).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);
3694
3728
 
3695
- return duplexAccessed && !hasContentType;
3696
- });
3729
+ if (!isFetchSupported) {
3730
+ return false;
3731
+ }
3697
3732
 
3698
- const DEFAULT_CHUNK_SIZE = 64 * 1024;
3733
+ const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
3699
3734
 
3700
- const supportsResponseStream = isReadableStreamSupported &&
3701
- 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
+ );
3702
3739
 
3740
+ const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
3741
+ let duplexAccessed = false;
3703
3742
 
3704
- const resolvers = {
3705
- stream: supportsResponseStream && ((res) => res.body)
3706
- };
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');
3707
3751
 
3708
- isFetchSupported && (((res) => {
3709
- ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
3710
- !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
3711
- (_, config) => {
3712
- throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
3713
- });
3752
+ return duplexAccessed && !hasContentType;
3714
3753
  });
3715
- })(new Response));
3716
3754
 
3717
- const getBodyLength = async (body) => {
3718
- if (body == null) {
3719
- return 0;
3720
- }
3755
+ const supportsResponseStream = isResponseSupported && isReadableStreamSupported &&
3756
+ test(() => utils$1.isReadableStream(new Response('').body));
3721
3757
 
3722
- if(utils$1.isBlob(body)) {
3723
- return body.size;
3724
- }
3758
+ const resolvers = {
3759
+ stream: supportsResponseStream && ((res) => res.body)
3760
+ };
3725
3761
 
3726
- if(utils$1.isSpecCompliantForm(body)) {
3727
- const _request = new Request(platform.origin, {
3728
- method: 'POST',
3729
- 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
+ });
3730
3773
  });
3731
- return (await _request.arrayBuffer()).byteLength;
3732
- }
3774
+ })());
3733
3775
 
3734
- if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
3735
- return body.byteLength;
3736
- }
3776
+ const getBodyLength = async (body) => {
3777
+ if (body == null) {
3778
+ return 0;
3779
+ }
3737
3780
 
3738
- if(utils$1.isURLSearchParams(body)) {
3739
- body = body + '';
3740
- }
3781
+ if (utils$1.isBlob(body)) {
3782
+ return body.size;
3783
+ }
3741
3784
 
3742
- if(utils$1.isString(body)) {
3743
- return (await encodeText(body)).byteLength;
3744
- }
3745
- };
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
+ }
3746
3792
 
3747
- const resolveBodyLength = async (headers, body) => {
3748
- const length = utils$1.toFiniteNumber(headers.getContentLength());
3793
+ if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
3794
+ return body.byteLength;
3795
+ }
3749
3796
 
3750
- return length == null ? getBodyLength(body) : length;
3751
- };
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
+ };
3811
+
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;
3752
3829
 
3753
- var fetchAdapter = isFetchSupported && (async (config) => {
3754
- let {
3755
- url,
3756
- method,
3757
- data,
3758
- signal,
3759
- cancelToken,
3760
- timeout,
3761
- onDownloadProgress,
3762
- onUploadProgress,
3763
- responseType,
3764
- headers,
3765
- withCredentials = 'same-origin',
3766
- fetchOptions
3767
- } = resolveConfig(config);
3768
-
3769
- responseType = responseType ? (responseType + '').toLowerCase() : 'text';
3770
-
3771
- let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
3772
-
3773
- let request;
3774
-
3775
- const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
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 && (() => {
3776
3837
  composedSignal.unsubscribe();
3777
- });
3838
+ });
3778
3839
 
3779
- let requestContentLength;
3840
+ let requestContentLength;
3780
3841
 
3781
- try {
3782
- if (
3783
- onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
3784
- (requestContentLength = await resolveBodyLength(headers, data)) !== 0
3785
- ) {
3786
- let _request = new Request(url, {
3787
- method: 'POST',
3788
- body: data,
3789
- duplex: "half"
3790
- });
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
+ });
3791
3852
 
3792
- let contentTypeHeader;
3853
+ let contentTypeHeader;
3793
3854
 
3794
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
3795
- headers.setContentType(contentTypeHeader);
3796
- }
3855
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
3856
+ headers.setContentType(contentTypeHeader);
3857
+ }
3797
3858
 
3798
- if (_request.body) {
3799
- const [onProgress, flush] = progressEventDecorator(
3800
- requestContentLength,
3801
- progressEventReducer(asyncDecorator(onUploadProgress))
3802
- );
3859
+ if (_request.body) {
3860
+ const [onProgress, flush] = progressEventDecorator(
3861
+ requestContentLength,
3862
+ progressEventReducer(asyncDecorator(onUploadProgress))
3863
+ );
3803
3864
 
3804
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
3865
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
3866
+ }
3805
3867
  }
3806
- }
3807
3868
 
3808
- if (!utils$1.isString(withCredentials)) {
3809
- withCredentials = withCredentials ? 'include' : 'omit';
3810
- }
3869
+ if (!utils$1.isString(withCredentials)) {
3870
+ withCredentials = withCredentials ? 'include' : 'omit';
3871
+ }
3811
3872
 
3812
- // Cloudflare Workers throws when credentials are defined
3813
- // see https://github.com/cloudflare/workerd/issues/902
3814
- const isCredentialsSupported = "credentials" in Request.prototype;
3815
- request = new Request(url, {
3816
- ...fetchOptions,
3817
- signal: composedSignal,
3818
- method: method.toUpperCase(),
3819
- headers: headers.normalize().toJSON(),
3820
- body: data,
3821
- duplex: "half",
3822
- credentials: isCredentialsSupported ? withCredentials : undefined
3823
- });
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;
3824
3876
 
3825
- let response = await fetch(request, fetchOptions);
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
+ };
3826
3886
 
3827
- const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3887
+ request = isRequestSupported && new Request(url, resolvedOptions);
3828
3888
 
3829
- if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
3830
- const options = {};
3889
+ let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
3831
3890
 
3832
- ['status', 'statusText', 'headers'].forEach(prop => {
3833
- options[prop] = response[prop];
3834
- });
3891
+ const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3835
3892
 
3836
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
3893
+ if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
3894
+ const options = {};
3837
3895
 
3838
- const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
3839
- responseContentLength,
3840
- progressEventReducer(asyncDecorator(onDownloadProgress), true)
3841
- ) || [];
3896
+ ['status', 'statusText', 'headers'].forEach(prop => {
3897
+ options[prop] = response[prop];
3898
+ });
3842
3899
 
3843
- response = new Response(
3844
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
3845
- flush && flush();
3846
- unsubscribe && unsubscribe();
3847
- }),
3848
- options
3849
- );
3850
- }
3900
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
3851
3901
 
3852
- responseType = responseType || 'text';
3902
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
3903
+ responseContentLength,
3904
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
3905
+ ) || [];
3853
3906
 
3854
- let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
3907
+ response = new Response(
3908
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
3909
+ flush && flush();
3910
+ unsubscribe && unsubscribe();
3911
+ }),
3912
+ options
3913
+ );
3914
+ }
3855
3915
 
3856
- !isStreamResponse && unsubscribe && unsubscribe();
3916
+ responseType = responseType || 'text';
3857
3917
 
3858
- return await new Promise((resolve, reject) => {
3859
- settle(resolve, reject, {
3860
- data: responseData,
3861
- headers: AxiosHeaders$1.from(response.headers),
3862
- status: response.status,
3863
- statusText: response.statusText,
3864
- config,
3865
- request
3866
- });
3867
- })
3868
- } catch (err) {
3869
- unsubscribe && unsubscribe();
3870
-
3871
- if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
3872
- throw Object.assign(
3873
- new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
3874
- {
3875
- cause: err.cause || err
3876
- }
3877
- )
3918
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
3919
+
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);
3878
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)));
3879
3966
 
3880
- throw AxiosError.from(err, err && err.code, config, request);
3967
+ map = target;
3881
3968
  }
3882
- });
3883
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
+ */
3884
3984
  const knownAdapters = {
3885
3985
  http: httpAdapter,
3886
3986
  xhr: xhrAdapter,
3887
- fetch: fetchAdapter
3987
+ fetch: {
3988
+ get: getFetch,
3989
+ }
3888
3990
  };
3889
3991
 
3992
+ // Assign adapter names for easier debugging and identification
3890
3993
  utils$1.forEach(knownAdapters, (fn, value) => {
3891
3994
  if (fn) {
3892
3995
  try {
3893
- Object.defineProperty(fn, 'name', {value});
3996
+ Object.defineProperty(fn, 'name', { value });
3894
3997
  } catch (e) {
3895
3998
  // eslint-disable-next-line no-empty
3896
3999
  }
3897
- Object.defineProperty(fn, 'adapterName', {value});
4000
+ Object.defineProperty(fn, 'adapterName', { value });
3898
4001
  }
3899
4002
  });
3900
4003
 
4004
+ /**
4005
+ * Render a rejection reason string for unknown or unsupported adapters
4006
+ *
4007
+ * @param {string} reason
4008
+ * @returns {string}
4009
+ */
3901
4010
  const renderReason = (reason) => `- ${reason}`;
3902
4011
 
4012
+ /**
4013
+ * Check if the adapter is resolved (function, null, or false)
4014
+ *
4015
+ * @param {Function|null|false} adapter
4016
+ * @returns {boolean}
4017
+ */
3903
4018
  const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
3904
4019
 
3905
- var adapters = {
3906
- getAdapter: (adapters) => {
3907
- adapters = utils$1.isArray(adapters) ? adapters : [adapters];
3908
-
3909
- const {length} = adapters;
3910
- let nameOrAdapter;
3911
- let adapter;
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];
3912
4032
 
3913
- const rejectedReasons = {};
4033
+ const { length } = adapters;
4034
+ let nameOrAdapter;
4035
+ let adapter;
3914
4036
 
3915
- for (let i = 0; i < length; i++) {
3916
- nameOrAdapter = adapters[i];
3917
- let id;
4037
+ const rejectedReasons = {};
3918
4038
 
3919
- adapter = nameOrAdapter;
4039
+ for (let i = 0; i < length; i++) {
4040
+ nameOrAdapter = adapters[i];
4041
+ let id;
3920
4042
 
3921
- if (!isResolvedHandle(nameOrAdapter)) {
3922
- adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
4043
+ adapter = nameOrAdapter;
3923
4044
 
3924
- if (adapter === undefined) {
3925
- throw new AxiosError(`Unknown adapter '${id}'`);
3926
- }
3927
- }
4045
+ if (!isResolvedHandle(nameOrAdapter)) {
4046
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
3928
4047
 
3929
- if (adapter) {
3930
- break;
4048
+ if (adapter === undefined) {
4049
+ throw new AxiosError(`Unknown adapter '${id}'`);
3931
4050
  }
4051
+ }
3932
4052
 
3933
- rejectedReasons[id || '#' + i] = adapter;
4053
+ if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
4054
+ break;
3934
4055
  }
3935
4056
 
3936
- if (!adapter) {
4057
+ rejectedReasons[id || '#' + i] = adapter;
4058
+ }
3937
4059
 
3938
- const reasons = Object.entries(rejectedReasons)
3939
- .map(([id, state]) => `adapter ${id} ` +
3940
- (state === false ? 'is not supported by the environment' : 'is not available in the build')
3941
- );
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
+ );
3942
4065
 
3943
- let s = length ?
3944
- (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
3945
- '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';
3946
4069
 
3947
- throw new AxiosError(
3948
- `There is no suitable adapter to dispatch the request ` + s,
3949
- 'ERR_NOT_SUPPORT'
3950
- );
3951
- }
4070
+ throw new AxiosError(
4071
+ `There is no suitable adapter to dispatch the request ` + s,
4072
+ 'ERR_NOT_SUPPORT'
4073
+ );
4074
+ }
3952
4075
 
3953
- return adapter;
3954
- },
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
+ */
3955
4093
  adapters: knownAdapters
3956
4094
  };
3957
4095
 
@@ -3994,7 +4132,7 @@ function dispatchRequest(config) {
3994
4132
  config.headers.setContentType('application/x-www-form-urlencoded', false);
3995
4133
  }
3996
4134
 
3997
- const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
4135
+ const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
3998
4136
 
3999
4137
  return adapter(config).then(function onAdapterResolution(response) {
4000
4138
  throwIfCancellationRequested(config);
@@ -4028,7 +4166,7 @@ function dispatchRequest(config) {
4028
4166
  });
4029
4167
  }
4030
4168
 
4031
- const VERSION = "1.11.0";
4169
+ const VERSION = "1.13.2";
4032
4170
 
4033
4171
  const validators$1 = {};
4034
4172
 
@@ -4284,8 +4422,6 @@ class Axios {
4284
4422
 
4285
4423
  let newConfig = config;
4286
4424
 
4287
- i = 0;
4288
-
4289
4425
  while (i < len) {
4290
4426
  const onFulfilled = requestInterceptorChain[i++];
4291
4427
  const onRejected = requestInterceptorChain[i++];
@@ -4589,6 +4725,12 @@ const HttpStatusCode = {
4589
4725
  LoopDetected: 508,
4590
4726
  NotExtended: 510,
4591
4727
  NetworkAuthenticationRequired: 511,
4728
+ WebServerIsDown: 521,
4729
+ ConnectionTimedOut: 522,
4730
+ OriginIsUnreachable: 523,
4731
+ TimeoutOccurred: 524,
4732
+ SslHandshakeFailed: 525,
4733
+ InvalidSslCertificate: 526,
4592
4734
  };
4593
4735
 
4594
4736
  Object.entries(HttpStatusCode).forEach(([key, value]) => {