diff --git a/dist/index.js b/dist/index.js index 2dfb633..742f75f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -6208,7 +6208,7 @@ FormData.prototype.submit = function (params, cb) { request.removeListener('error', callback); request.removeListener('response', onResponse); - return cb.call(this, error, responce); // eslint-disable-line no-invalid-this + return cb.call(this, error, responce); }; onResponse = callback.bind(this, null); @@ -6232,7 +6232,7 @@ FormData.prototype._error = function (err) { FormData.prototype.toString = function () { return '[object FormData]'; }; -setToStringTag(FormData, 'FormData'); +setToStringTag(FormData.prototype, 'FormData'); // Public API module.exports = FormData; @@ -39771,6 +39771,13 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) { ;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/bind.js +/** + * Create a bound version of a function with a specified `this` context + * + * @param {Function} fn - The function to bind + * @param {*} thisArg - The value to be passed as the `this` parameter + * @returns {Function} A new function that will call the original function with the specified `this` context + */ function bind(fn, thisArg) { return function wrap() { return fn.apply(thisArg, arguments); @@ -39784,30 +39791,30 @@ function bind(fn, thisArg) { // utils is a library of generic helper functions non-specific to axios -const {toString: utils_toString} = Object.prototype; -const {getPrototypeOf} = Object; -const {iterator, toStringTag} = Symbol; +const { toString: utils_toString } = Object.prototype; +const { getPrototypeOf } = Object; +const { iterator, toStringTag } = Symbol; -const kindOf = (cache => thing => { - const str = utils_toString.call(thing); - return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); +const kindOf = ((cache) => (thing) => { + const str = utils_toString.call(thing); + return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); })(Object.create(null)); const kindOfTest = (type) => { type = type.toLowerCase(); - return (thing) => kindOf(thing) === type -} + return (thing) => kindOf(thing) === type; +}; -const typeOfTest = type => thing => typeof thing === type; +const typeOfTest = (type) => (thing) => typeof thing === type; /** - * Determine if a value is an Array + * Determine if a value is a non-null object * * @param {Object} val The value to test * * @returns {boolean} True if value is an Array, otherwise false */ -const {isArray} = Array; +const { isArray } = Array; /** * Determine if a value is undefined @@ -39816,7 +39823,7 @@ const {isArray} = Array; * * @returns {boolean} True if the value is undefined, otherwise false */ -const isUndefined = typeOfTest('undefined'); +const isUndefined = typeOfTest("undefined"); /** * Determine if a value is a Buffer @@ -39826,8 +39833,14 @@ const isUndefined = typeOfTest('undefined'); * @returns {boolean} True if value is a Buffer, otherwise false */ function isBuffer(val) { - return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) - && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val); + return ( + val !== null && + !isUndefined(val) && + val.constructor !== null && + !isUndefined(val.constructor) && + isFunction(val.constructor.isBuffer) && + val.constructor.isBuffer(val) + ); } /** @@ -39837,8 +39850,7 @@ function isBuffer(val) { * * @returns {boolean} True if value is an ArrayBuffer, otherwise false */ -const isArrayBuffer = kindOfTest('ArrayBuffer'); - +const isArrayBuffer = kindOfTest("ArrayBuffer"); /** * Determine if a value is a view on an ArrayBuffer @@ -39849,10 +39861,10 @@ const isArrayBuffer = kindOfTest('ArrayBuffer'); */ function isArrayBufferView(val) { let result; - if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { + if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) { result = ArrayBuffer.isView(val); } else { - result = (val) && (val.buffer) && (isArrayBuffer(val.buffer)); + result = val && val.buffer && isArrayBuffer(val.buffer); } return result; } @@ -39864,7 +39876,7 @@ function isArrayBufferView(val) { * * @returns {boolean} True if value is a String, otherwise false */ -const isString = typeOfTest('string'); +const isString = typeOfTest("string"); /** * Determine if a value is a Function @@ -39872,7 +39884,7 @@ const isString = typeOfTest('string'); * @param {*} val The value to test * @returns {boolean} True if value is a Function, otherwise false */ -const isFunction = typeOfTest('function'); +const isFunction = typeOfTest("function"); /** * Determine if a value is a Number @@ -39881,7 +39893,7 @@ const isFunction = typeOfTest('function'); * * @returns {boolean} True if value is a Number, otherwise false */ -const isNumber = typeOfTest('number'); +const isNumber = typeOfTest("number"); /** * Determine if a value is an Object @@ -39890,7 +39902,7 @@ const isNumber = typeOfTest('number'); * * @returns {boolean} True if value is an Object, otherwise false */ -const isObject = (thing) => thing !== null && typeof thing === 'object'; +const isObject = (thing) => thing !== null && typeof thing === "object"; /** * Determine if a value is a Boolean @@ -39898,7 +39910,7 @@ const isObject = (thing) => thing !== null && typeof thing === 'object'; * @param {*} thing The value to test * @returns {boolean} True if value is a Boolean, otherwise false */ -const isBoolean = thing => thing === true || thing === false; +const isBoolean = (thing) => thing === true || thing === false; /** * Determine if a value is a plain Object @@ -39908,13 +39920,19 @@ const isBoolean = thing => thing === true || thing === false; * @returns {boolean} True if value is a plain Object, otherwise false */ const isPlainObject = (val) => { - if (kindOf(val) !== 'object') { + if (kindOf(val) !== "object") { return false; } const prototype = getPrototypeOf(val); - return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val); -} + return ( + (prototype === null || + prototype === Object.prototype || + Object.getPrototypeOf(prototype) === null) && + !(toStringTag in val) && + !(iterator in val) + ); +}; /** * Determine if a value is an empty object (safely handles Buffers) @@ -39930,12 +39948,15 @@ const isEmptyObject = (val) => { } try { - return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype; + return ( + Object.keys(val).length === 0 && + Object.getPrototypeOf(val) === Object.prototype + ); } catch (e) { // Fallback for any other objects that might cause RangeError with Object.keys() return false; } -} +}; /** * Determine if a value is a Date @@ -39944,7 +39965,7 @@ const isEmptyObject = (val) => { * * @returns {boolean} True if value is a Date, otherwise false */ -const isDate = kindOfTest('Date'); +const isDate = kindOfTest("Date"); /** * Determine if a value is a File @@ -39953,7 +39974,7 @@ const isDate = kindOfTest('Date'); * * @returns {boolean} True if value is a File, otherwise false */ -const isFile = kindOfTest('File'); +const isFile = kindOfTest("File"); /** * Determine if a value is a Blob @@ -39962,7 +39983,7 @@ const isFile = kindOfTest('File'); * * @returns {boolean} True if value is a Blob, otherwise false */ -const utils_isBlob = kindOfTest('Blob'); +const utils_isBlob = kindOfTest("Blob"); /** * Determine if a value is a FileList @@ -39971,7 +39992,7 @@ const utils_isBlob = kindOfTest('Blob'); * * @returns {boolean} True if value is a File, otherwise false */ -const isFileList = kindOfTest('FileList'); +const isFileList = kindOfTest("FileList"); /** * Determine if a value is a Stream @@ -39991,16 +40012,17 @@ const isStream = (val) => isObject(val) && isFunction(val.pipe); */ const isFormData = (thing) => { let kind; - return thing && ( - (typeof FormData === 'function' && thing instanceof FormData) || ( - isFunction(thing.append) && ( - (kind = kindOf(thing)) === 'formdata' || - // detect form-data instance - (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]') - ) - ) - ) -} + return ( + thing && + ((typeof FormData === "function" && thing instanceof FormData) || + (isFunction(thing.append) && + ((kind = kindOf(thing)) === "formdata" || + // detect form-data instance + (kind === "object" && + isFunction(thing.toString) && + thing.toString() === "[object FormData]")))) + ); +}; /** * Determine if a value is a URLSearchParams object @@ -40009,9 +40031,14 @@ const isFormData = (thing) => { * * @returns {boolean} True if value is a URLSearchParams object, otherwise false */ -const isURLSearchParams = kindOfTest('URLSearchParams'); +const isURLSearchParams = kindOfTest("URLSearchParams"); -const [isReadableStream, utils_isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest); +const [isReadableStream, utils_isRequest, isResponse, isHeaders] = [ + "ReadableStream", + "Request", + "Response", + "Headers", +].map(kindOfTest); /** * Trim excess whitespace off the beginning and end of a string @@ -40020,8 +40047,8 @@ const [isReadableStream, utils_isRequest, isResponse, isHeaders] = ['ReadableStr * * @returns {String} The String freed of excess whitespace */ -const trim = (str) => str.trim ? - str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); +const trim = (str) => + str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); /** * Iterate over an Array or an Object invoking a function for each item. @@ -40032,15 +40059,16 @@ const trim = (str) => str.trim ? * If 'obj' is an Object callback will be called passing * the value, key, and complete object for each property. * - * @param {Object|Array} obj The object to iterate + * @param {Object|Array} obj The object to iterate * @param {Function} fn The callback to invoke for each item * - * @param {Boolean} [allOwnKeys = false] + * @param {Object} [options] + * @param {Boolean} [options.allOwnKeys = false] * @returns {any} */ -function forEach(obj, fn, {allOwnKeys = false} = {}) { +function forEach(obj, fn, { allOwnKeys = false } = {}) { // Don't bother if no value provided - if (obj === null || typeof obj === 'undefined') { + if (obj === null || typeof obj === "undefined") { return; } @@ -40048,7 +40076,7 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) { let l; // Force an array if not already something iterable - if (typeof obj !== 'object') { + if (typeof obj !== "object") { /*eslint no-param-reassign:0*/ obj = [obj]; } @@ -40065,7 +40093,9 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) { } // Iterate over object keys - const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj); + const keys = allOwnKeys + ? Object.getOwnPropertyNames(obj) + : Object.keys(obj); const len = keys.length; let key; @@ -40077,7 +40107,7 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) { } function findKey(obj, key) { - if (isBuffer(obj)){ + if (isBuffer(obj)) { return null; } @@ -40097,10 +40127,15 @@ function findKey(obj, key) { const _global = (() => { /*eslint no-undef:0*/ if (typeof globalThis !== "undefined") return globalThis; - return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global) + return typeof self !== "undefined" + ? self + : typeof window !== "undefined" + ? window + : global; })(); -const isContextDefined = (context) => !isUndefined(context) && context !== _global; +const isContextDefined = (context) => + !isUndefined(context) && context !== _global; /** * Accepts varargs expecting each argument to be an object, then @@ -40112,7 +40147,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob * Example: * * ```js - * var result = merge({foo: 123}, {foo: 456}); + * const result = merge({foo: 123}, {foo: 456}); * console.log(result.foo); // outputs 456 * ``` * @@ -40121,10 +40156,15 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob * @returns {Object} Result of all merge properties */ function merge(/* obj1, obj2, obj3, ... */) { - const {caseless, skipUndefined} = isContextDefined(this) && this || {}; + const { caseless, skipUndefined } = (isContextDefined(this) && this) || {}; const result = {}; const assignValue = (val, key) => { - const targetKey = caseless && findKey(result, key) || key; + // Skip dangerous property names to prevent prototype pollution + if (key === "__proto__" || key === "constructor" || key === "prototype") { + return; + } + + const targetKey = (caseless && findKey(result, key)) || key; if (isPlainObject(result[targetKey]) && isPlainObject(val)) { result[targetKey] = merge(result[targetKey], val); } else if (isPlainObject(val)) { @@ -40134,7 +40174,7 @@ function merge(/* obj1, obj2, obj3, ... */) { } else if (!skipUndefined || !isUndefined(val)) { result[targetKey] = val; } - } + }; for (let i = 0, l = arguments.length; i < l; i++) { arguments[i] && forEach(arguments[i], assignValue); @@ -40149,19 +40189,34 @@ function merge(/* obj1, obj2, obj3, ... */) { * @param {Object} b The object to copy properties from * @param {Object} thisArg The object to bind function to * - * @param {Boolean} [allOwnKeys] + * @param {Object} [options] + * @param {Boolean} [options.allOwnKeys] * @returns {Object} The resulting value of object a */ -const extend = (a, b, thisArg, {allOwnKeys}= {}) => { - forEach(b, (val, key) => { - if (thisArg && isFunction(val)) { - a[key] = bind(val, thisArg); - } else { - a[key] = val; - } - }, {allOwnKeys}); +const extend = (a, b, thisArg, { allOwnKeys } = {}) => { + forEach( + b, + (val, key) => { + if (thisArg && isFunction(val)) { + Object.defineProperty(a, key, { + value: bind(val, thisArg), + writable: true, + enumerable: true, + configurable: true, + }); + } else { + Object.defineProperty(a, key, { + value: val, + writable: true, + enumerable: true, + configurable: true, + }); + } + }, + { allOwnKeys }, + ); return a; -} +}; /** * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) @@ -40171,11 +40226,11 @@ const extend = (a, b, thisArg, {allOwnKeys}= {}) => { * @returns {string} content value without BOM */ const stripBOM = (content) => { - if (content.charCodeAt(0) === 0xFEFF) { + if (content.charCodeAt(0) === 0xfeff) { content = content.slice(1); } return content; -} +}; /** * Inherit the prototype methods from one constructor into another @@ -40187,13 +40242,21 @@ const stripBOM = (content) => { * @returns {void} */ const inherits = (constructor, superConstructor, props, descriptors) => { - constructor.prototype = Object.create(superConstructor.prototype, descriptors); - constructor.prototype.constructor = constructor; - Object.defineProperty(constructor, 'super', { - value: superConstructor.prototype + constructor.prototype = Object.create( + superConstructor.prototype, + descriptors, + ); + Object.defineProperty(constructor.prototype, "constructor", { + value: constructor, + writable: true, + enumerable: false, + configurable: true, + }); + Object.defineProperty(constructor, "super", { + value: superConstructor.prototype, }); props && Object.assign(constructor.prototype, props); -} +}; /** * Resolve object with deep prototype chain to a flat object @@ -40219,16 +40282,23 @@ const toFlatObject = (sourceObj, destObj, filter, propFilter) => { i = props.length; while (i-- > 0) { prop = props[i]; - if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) { + if ( + (!propFilter || propFilter(prop, sourceObj, destObj)) && + !merged[prop] + ) { destObj[prop] = sourceObj[prop]; merged[prop] = true; } } sourceObj = filter !== false && getPrototypeOf(sourceObj); - } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); + } while ( + sourceObj && + (!filter || filter(sourceObj, destObj)) && + sourceObj !== Object.prototype + ); return destObj; -} +}; /** * Determines whether a string ends with the characters of a specified string @@ -40247,8 +40317,7 @@ const endsWith = (str, searchString, position) => { position -= searchString.length; const lastIndex = str.indexOf(searchString, position); return lastIndex !== -1 && lastIndex === position; -} - +}; /** * Returns new array from array like object or null if failed @@ -40267,7 +40336,7 @@ const toArray = (thing) => { arr[i] = thing[i]; } return arr; -} +}; /** * Checking if the Uint8Array exists and if it does, it returns a function that checks if the @@ -40278,12 +40347,12 @@ const toArray = (thing) => { * @returns {Array} */ // eslint-disable-next-line func-names -const isTypedArray = (TypedArray => { +const isTypedArray = ((TypedArray) => { // eslint-disable-next-line func-names - return thing => { + return (thing) => { return TypedArray && thing instanceof TypedArray; }; -})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array)); +})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array)); /** * For each entry in the object, call the function with the key and value. @@ -40304,7 +40373,7 @@ const forEachEntry = (obj, fn) => { const pair = result.value; fn.call(obj, pair[0], pair[1]); } -} +}; /** * It takes a regular expression and a string, and returns an array of all the matches @@ -40323,21 +40392,25 @@ const matchAll = (regExp, str) => { } return arr; -} +}; /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */ -const isHTMLForm = kindOfTest('HTMLFormElement'); +const isHTMLForm = kindOfTest("HTMLFormElement"); -const toCamelCase = str => { - return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, - function replacer(m, p1, p2) { +const toCamelCase = (str) => { + return str + .toLowerCase() + .replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) { return p1.toUpperCase() + p2; - } - ); + }); }; /* Creating a function that will check if an object has a property. */ -const utils_hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype); +const utils_hasOwnProperty = ( + ({ hasOwnProperty }) => + (obj, prop) => + hasOwnProperty.call(obj, prop) +)(Object.prototype); /** * Determine if a value is a RegExp object @@ -40346,7 +40419,7 @@ const utils_hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnPropert * * @returns {boolean} True if value is a RegExp object, otherwise false */ -const isRegExp = kindOfTest('RegExp'); +const isRegExp = kindOfTest("RegExp"); const reduceDescriptors = (obj, reducer) => { const descriptors = Object.getOwnPropertyDescriptors(obj); @@ -40360,7 +40433,7 @@ const reduceDescriptors = (obj, reducer) => { }); Object.defineProperties(obj, reducedDescriptors); -} +}; /** * Makes all methods read-only @@ -40370,7 +40443,10 @@ const reduceDescriptors = (obj, reducer) => { const freezeMethods = (obj) => { reduceDescriptors(obj, (descriptor, name) => { // skip restricted props in strict mode - if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) { + if ( + isFunction(obj) && + ["arguments", "caller", "callee"].indexOf(name) !== -1 + ) { return false; } @@ -40380,40 +40456,42 @@ const freezeMethods = (obj) => { descriptor.enumerable = false; - if ('writable' in descriptor) { + if ("writable" in descriptor) { descriptor.writable = false; return; } if (!descriptor.set) { descriptor.set = () => { - throw Error('Can not rewrite read-only method \'' + name + '\''); + throw Error("Can not rewrite read-only method '" + name + "'"); }; } }); -} +}; const toObjectSet = (arrayOrString, delimiter) => { const obj = {}; const define = (arr) => { - arr.forEach(value => { + arr.forEach((value) => { obj[value] = true; }); - } + }; - isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter)); + isArray(arrayOrString) + ? define(arrayOrString) + : define(String(arrayOrString).split(delimiter)); return obj; -} +}; -const noop = () => {} +const noop = () => {}; const toFiniteNumber = (value, defaultValue) => { - return value != null && Number.isFinite(value = +value) ? value : defaultValue; -} - - + return value != null && Number.isFinite((value = +value)) + ? value + : defaultValue; +}; /** * If the thing is a FormData object, return true, otherwise return false. @@ -40423,14 +40501,18 @@ const toFiniteNumber = (value, defaultValue) => { * @returns {boolean} */ function isSpecCompliantForm(thing) { - return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]); + return !!( + thing && + isFunction(thing.append) && + thing[toStringTag] === "FormData" && + thing[iterator] + ); } const toJSONObject = (obj) => { const stack = new Array(10); const visit = (source, i) => { - if (isObject(source)) { if (stack.indexOf(source) >= 0) { return; @@ -40441,7 +40523,7 @@ const toJSONObject = (obj) => { return source; } - if(!('toJSON' in source)) { + if (!("toJSON" in source)) { stack[i] = source; const target = isArray(source) ? [] : {}; @@ -40457,15 +40539,18 @@ const toJSONObject = (obj) => { } return source; - } + }; return visit(obj, 0); -} +}; -const isAsyncFn = kindOfTest('AsyncFunction'); +const isAsyncFn = kindOfTest("AsyncFunction"); const isThenable = (thing) => - thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch); + thing && + (isObject(thing) || isFunction(thing)) && + isFunction(thing.then) && + isFunction(thing.catch); // original code // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34 @@ -40475,32 +40560,35 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => { return setImmediate; } - return postMessageSupported ? ((token, callbacks) => { - _global.addEventListener("message", ({source, data}) => { - if (source === _global && data === token) { - callbacks.length && callbacks.shift()(); - } - }, false); + return postMessageSupported + ? ((token, callbacks) => { + _global.addEventListener( + "message", + ({ source, data }) => { + if (source === _global && data === token) { + callbacks.length && callbacks.shift()(); + } + }, + false, + ); - return (cb) => { - callbacks.push(cb); - _global.postMessage(token, "*"); - } - })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb); -})( - typeof setImmediate === 'function', - isFunction(_global.postMessage) -); + return (cb) => { + callbacks.push(cb); + _global.postMessage(token, "*"); + }; + })(`axios@${Math.random()}`, []) + : (cb) => setTimeout(cb); +})(typeof setImmediate === "function", isFunction(_global.postMessage)); -const asap = typeof queueMicrotask !== 'undefined' ? - queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate); +const asap = + typeof queueMicrotask !== "undefined" + ? queueMicrotask.bind(_global) + : (typeof process !== "undefined" && process.nextTick) || _setImmediate; // ********************* - const isIterable = (thing) => thing != null && isFunction(thing[iterator]); - /* harmony default export */ const utils = ({ isArray, isArrayBuffer, @@ -40558,7 +40646,7 @@ const isIterable = (thing) => thing != null && isFunction(thing[iterator]); isThenable, setImmediate: _setImmediate, asap, - isIterable + isIterable, }); ;// CONCATENATED MODULE: ./node_modules/axios/lib/core/AxiosError.js @@ -40566,110 +40654,73 @@ const isIterable = (thing) => thing != null && isFunction(thing[iterator]); -/** - * Create an Error with the specified message, config, error code, request and response. - * - * @param {string} message The error message. - * @param {string} [code] The error code (for example, 'ECONNABORTED'). - * @param {Object} [config] The config. - * @param {Object} [request] The request. - * @param {Object} [response] The response. - * - * @returns {Error} The created error. - */ -function AxiosError(message, code, config, request, response) { - Error.call(this); +class AxiosError extends Error { + static from(error, code, config, request, response, customProps) { + const axiosError = new AxiosError(error.message, code || error.code, config, request, response); + axiosError.cause = error; + axiosError.name = error.name; + customProps && Object.assign(axiosError, customProps); + return axiosError; + } - if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } else { - this.stack = (new Error()).stack; - } + /** + * Create an Error with the specified message, config, error code, request and response. + * + * @param {string} message The error message. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [config] The config. + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * + * @returns {Error} The created error. + */ + constructor(message, code, config, request, response) { + super(message); + this.name = 'AxiosError'; + this.isAxiosError = true; + code && (this.code = code); + config && (this.config = config); + request && (this.request = request); + if (response) { + this.response = response; + this.status = response.status; + } + } - this.message = message; - this.name = 'AxiosError'; - code && (this.code = code); - config && (this.config = config); - request && (this.request = request); - if (response) { - this.response = response; - this.status = response.status ? response.status : null; - } + toJSON() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: utils.toJSONObject(this.config), + code: this.code, + status: this.status, + }; + } } -utils.inherits(AxiosError, Error, { - toJSON: function toJSON() { - return { - // Standard - message: this.message, - name: this.name, - // Microsoft - description: this.description, - number: this.number, - // Mozilla - fileName: this.fileName, - lineNumber: this.lineNumber, - columnNumber: this.columnNumber, - stack: this.stack, - // Axios - config: utils.toJSONObject(this.config), - code: this.code, - status: this.status - }; - } -}); - -const AxiosError_prototype = AxiosError.prototype; -const descriptors = {}; - -[ - 'ERR_BAD_OPTION_VALUE', - 'ERR_BAD_OPTION', - 'ECONNABORTED', - 'ETIMEDOUT', - 'ERR_NETWORK', - 'ERR_FR_TOO_MANY_REDIRECTS', - 'ERR_DEPRECATED', - 'ERR_BAD_RESPONSE', - 'ERR_BAD_REQUEST', - 'ERR_CANCELED', - 'ERR_NOT_SUPPORT', - 'ERR_INVALID_URL' -// eslint-disable-next-line func-names -].forEach(code => { - descriptors[code] = {value: code}; -}); - -Object.defineProperties(AxiosError, descriptors); -Object.defineProperty(AxiosError_prototype, 'isAxiosError', {value: true}); - -// eslint-disable-next-line func-names -AxiosError.from = (error, code, config, request, response, customProps) => { - const axiosError = Object.create(AxiosError_prototype); - - utils.toFlatObject(error, axiosError, function filter(obj) { - return obj !== Error.prototype; - }, prop => { - return prop !== 'isAxiosError'; - }); - - const msg = error && error.message ? error.message : 'Error'; - - // Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED) - const errCode = code == null && error ? error.code : code; - AxiosError.call(axiosError, msg, errCode, config, request, response); - - // Chain the original error on the standard field; non-enumerable to avoid JSON noise - if (error && axiosError.cause == null) { - Object.defineProperty(axiosError, 'cause', { value: error, configurable: true }); - } - - axiosError.name = (error && error.name) || 'Error'; - - customProps && Object.assign(axiosError, customProps); - - return axiosError; -}; +// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated. +AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE'; +AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION'; +AxiosError.ECONNABORTED = 'ECONNABORTED'; +AxiosError.ETIMEDOUT = 'ETIMEDOUT'; +AxiosError.ERR_NETWORK = 'ERR_NETWORK'; +AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS'; +AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED'; +AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE'; +AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST'; +AxiosError.ERR_CANCELED = 'ERR_CANCELED'; +AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT'; +AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL'; /* harmony default export */ const core_AxiosError = (AxiosError); @@ -40997,29 +41048,26 @@ function buildURL_encode(val) { * @returns {string} The formatted url */ function buildURL(url, params, options) { - /*eslint no-param-reassign:0*/ if (!params) { return url; } - + const _encode = options && options.encode || buildURL_encode; - if (utils.isFunction(options)) { - options = { - serialize: options - }; - } + const _options = utils.isFunction(options) ? { + serialize: options + } : options; - const serializeFn = options && options.serialize; + const serializeFn = _options && _options.serialize; let serializedParams; if (serializeFn) { - serializedParams = serializeFn(params, options); + serializedParams = serializeFn(params, _options); } else { serializedParams = utils.isURLSearchParams(params) ? params.toString() : - new helpers_AxiosURLSearchParams(params, options).toString(_encode); + new helpers_AxiosURLSearchParams(params, _options).toString(_encode); } if (serializedParams) { @@ -41049,6 +41097,7 @@ class InterceptorManager { * * @param {Function} fulfilled The function to handle `then` for a `Promise` * @param {Function} rejected The function to handle `reject` for a `Promise` + * @param {Object} options The options for the interceptor, synchronous and runWhen * * @return {Number} An ID used to remove interceptor later */ @@ -41067,7 +41116,7 @@ class InterceptorManager { * * @param {Number} id The ID that was returned by `use` * - * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise + * @returns {void} */ eject(id) { if (this.handlers[id]) { @@ -41113,7 +41162,8 @@ class InterceptorManager { /* harmony default export */ const defaults_transitional = ({ silentJSONParsing: true, forcedJSONParsing: true, - clarifyTimeoutError: false + clarifyTimeoutError: false, + legacyInterceptorReqResOrdering: true }); // EXTERNAL MODULE: external "crypto" @@ -41918,26 +41968,23 @@ function isCancel(value) { - -/** - * A `CanceledError` is an object that is thrown when an operation is canceled. - * - * @param {string=} message The message. - * @param {Object=} config The config. - * @param {Object=} request The request. - * - * @returns {CanceledError} The created error. - */ -function CanceledError(message, config, request) { - // eslint-disable-next-line no-eq-null,eqeqeq - core_AxiosError.call(this, message == null ? 'canceled' : message, core_AxiosError.ERR_CANCELED, config, request); - this.name = 'CanceledError'; +class CanceledError extends core_AxiosError { + /** + * A `CanceledError` is an object that is thrown when an operation is canceled. + * + * @param {string=} message The message. + * @param {Object=} config The config. + * @param {Object=} request The request. + * + * @returns {CanceledError} The created error. + */ + constructor(message, config, request) { + super(message == null ? 'canceled' : message, core_AxiosError.ERR_CANCELED, config, request); + this.name = 'CanceledError'; + this.__CANCEL__ = true; + } } -utils.inherits(CanceledError, core_AxiosError, { - __CANCEL__: true -}); - /* harmony default export */ const cancel_CanceledError = (CanceledError); ;// CONCATENATED MODULE: ./node_modules/axios/lib/core/settle.js @@ -41983,9 +42030,14 @@ function isAbsoluteURL(url) { // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed // by any combination of letters, digits, plus, period, or hyphen. + if (typeof url !== 'string') { + return false; + } + return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); } + ;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/combineURLs.js @@ -42033,6 +42085,8 @@ var proxy_from_env = __nccwpck_require__(7777); var external_http_ = __nccwpck_require__(8611); // EXTERNAL MODULE: external "https" var external_https_ = __nccwpck_require__(5692); +// EXTERNAL MODULE: external "http2" +var external_http2_ = __nccwpck_require__(5675); // EXTERNAL MODULE: external "util" var external_util_ = __nccwpck_require__(9023); // EXTERNAL MODULE: ./node_modules/follow-redirects/index.js @@ -42040,7 +42094,7 @@ var follow_redirects = __nccwpck_require__(1573); // EXTERNAL MODULE: external "zlib" var external_zlib_ = __nccwpck_require__(3106); ;// CONCATENATED MODULE: ./node_modules/axios/lib/env/data.js -const VERSION = "1.12.2"; +const VERSION = "1.13.5"; ;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/parseProtocol.js @@ -42683,7 +42737,6 @@ function estimateDataURLDecodedBytes(url) { - const zlibOptions = { @@ -42715,6 +42768,101 @@ const flushOnFinish = (stream, [throttled, flush]) => { return throttled; } +class Http2Sessions { + constructor() { + this.sessions = Object.create(null); + } + + getSession(authority, options) { + options = Object.assign({ + sessionTimeout: 1000 + }, options); + + let authoritySessions = this.sessions[authority]; + + if (authoritySessions) { + let len = authoritySessions.length; + + for (let i = 0; i < len; i++) { + const [sessionHandle, sessionOptions] = authoritySessions[i]; + if (!sessionHandle.destroyed && !sessionHandle.closed && external_util_.isDeepStrictEqual(sessionOptions, options)) { + return sessionHandle; + } + } + } + + const session = external_http2_.connect(authority, options); + + let removed; + + const removeSession = () => { + if (removed) { + return; + } + + removed = true; + + let entries = authoritySessions, len = entries.length, i = len; + + while (i--) { + if (entries[i][0] === session) { + if (len === 1) { + delete this.sessions[authority]; + } else { + entries.splice(i, 1); + } + return; + } + } + }; + + const originalRequestFn = session.request; + + const {sessionTimeout} = options; + + if(sessionTimeout != null) { + + let timer; + let streamsCount = 0; + + session.request = function () { + const stream = originalRequestFn.apply(this, arguments); + + streamsCount++; + + if (timer) { + clearTimeout(timer); + timer = null; + } + + stream.once('close', () => { + if (!--streamsCount) { + timer = setTimeout(() => { + timer = null; + removeSession(); + }, sessionTimeout); + } + }); + + return stream; + } + } + + session.once('close', removeSession); + + let entry = [ + session, + options + ]; + + authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry]; + + return session; + } +} + +const http2Sessions = new Http2Sessions(); + /** * If the proxy or config beforeRedirects functions are defined, call them with the options @@ -42758,12 +42906,16 @@ function setProxy(options, configProxy, location) { if (proxy.auth) { // Support proxy auth object form - if (proxy.auth.username || proxy.auth.password) { + const validProxyAuth = Boolean(proxy.auth.username || proxy.auth.password); + + if (validProxyAuth) { proxy.auth = (proxy.auth.username || '') + ':' + (proxy.auth.password || ''); + } else if (typeof proxy.auth === 'object') { + throw new core_AxiosError('Invalid proxy authorization', core_AxiosError.ERR_BAD_OPTION, { proxy }); } - const base64 = Buffer - .from(proxy.auth, 'utf8') - .toString('base64'); + + const base64 = Buffer.from(proxy.auth, 'utf8').toString('base64'); + options.headers['Proxy-Authorization'] = 'Basic ' + base64; } @@ -42827,16 +42979,76 @@ const resolveFamily = ({address, family}) => { const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(address) ? address : {address, family}); +const http2Transport = { + request(options, cb) { + const authority = options.protocol + '//' + options.hostname + ':' + (options.port ||(options.protocol === 'https:' ? 443 : 80)); + + + const {http2Options, headers} = options; + + const session = http2Sessions.getSession(authority, http2Options); + + const { + HTTP2_HEADER_SCHEME, + HTTP2_HEADER_METHOD, + HTTP2_HEADER_PATH, + HTTP2_HEADER_STATUS + } = external_http2_.constants; + + const http2Headers = { + [HTTP2_HEADER_SCHEME]: options.protocol.replace(':', ''), + [HTTP2_HEADER_METHOD]: options.method, + [HTTP2_HEADER_PATH]: options.path, + } + + utils.forEach(headers, (header, name) => { + name.charAt(0) !== ':' && (http2Headers[name] = header); + }); + + const req = session.request(http2Headers); + + req.once('response', (responseHeaders) => { + const response = req; //duplex + + responseHeaders = Object.assign({}, responseHeaders); + + const status = responseHeaders[HTTP2_HEADER_STATUS]; + + delete responseHeaders[HTTP2_HEADER_STATUS]; + + response.headers = responseHeaders; + + response.statusCode = +status; + + cb(response); + }) + + return req; + } +} + /*eslint consistent-return:0*/ /* harmony default export */ const http = (isHttpAdapterSupported && function httpAdapter(config) { return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) { - let {data, lookup, family} = config; + let {data, lookup, family, httpVersion = 1, http2Options} = config; const {responseType, responseEncoding} = config; const method = config.method.toUpperCase(); let isDone; let rejected = false; let req; + httpVersion = +httpVersion; + + if (Number.isNaN(httpVersion)) { + throw TypeError(`Invalid protocol version: '${config.httpVersion}' is not a number`); + } + + if (httpVersion !== 1 && httpVersion !== 2) { + throw TypeError(`Unsupported protocol version '${httpVersion}'`); + } + + const isHttp2 = httpVersion === 2; + if (lookup) { const _lookup = helpers_callbackify(lookup, (value) => utils.isArray(value) ? value : [value]); // hotfix to support opt.all option which is required for node 20.x @@ -42853,8 +43065,17 @@ const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(addr } } - // temporary internal emitter until the AxiosRequest class will be implemented - const emitter = new external_events_.EventEmitter(); + const abortEmitter = new external_events_.EventEmitter(); + + function abort(reason) { + try { + abortEmitter.emit('abort', !reason || reason.type ? new cancel_CanceledError(null, config, req) : reason); + } catch(err) { + console.warn('emit error', err); + } + } + + abortEmitter.once('abort', reject); const onFinished = () => { if (config.cancelToken) { @@ -42865,29 +43086,40 @@ const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(addr config.signal.removeEventListener('abort', abort); } - emitter.removeAllListeners(); + abortEmitter.removeAllListeners(); + } + + if (config.cancelToken || config.signal) { + config.cancelToken && config.cancelToken.subscribe(abort); + if (config.signal) { + config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort); + } } - onDone((value, isRejected) => { + onDone((response, isRejected) => { isDone = true; + if (isRejected) { rejected = true; onFinished(); + return; + } + + const {data} = response; + + if (data instanceof external_stream_.Readable || data instanceof external_stream_.Duplex) { + const offListeners = external_stream_.finished(data, () => { + offListeners(); + onFinished(); + }); + } else { + onFinished(); } }); - function abort(reason) { - emitter.emit('abort', !reason || reason.type ? new cancel_CanceledError(null, config, req) : reason); - } - emitter.once('abort', reject); - if (config.cancelToken || config.signal) { - config.cancelToken && config.cancelToken.subscribe(abort); - if (config.signal) { - config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort); - } - } + // Parse url const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls); @@ -43095,7 +43327,8 @@ const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(addr protocol, family, beforeRedirect: dispatchBeforeRedirect, - beforeRedirects: {} + beforeRedirects: {}, + http2Options }; // cacheable-lookup integration hotfix @@ -43112,18 +43345,23 @@ const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(addr let transport; const isHttpsRequest = isHttps.test(options.protocol); options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent; - if (config.transport) { - transport = config.transport; - } else if (config.maxRedirects === 0) { - transport = isHttpsRequest ? external_https_ : external_http_; + + if (isHttp2) { + transport = http2Transport; } else { - if (config.maxRedirects) { - options.maxRedirects = config.maxRedirects; - } - if (config.beforeRedirect) { - options.beforeRedirects.config = config.beforeRedirect; + if (config.transport) { + transport = config.transport; + } else if (config.maxRedirects === 0) { + transport = isHttpsRequest ? external_https_ : external_http_; + } else { + if (config.maxRedirects) { + options.maxRedirects = config.maxRedirects; + } + if (config.beforeRedirect) { + options.beforeRedirects.config = config.beforeRedirect; + } + transport = isHttpsRequest ? httpsFollow : httpFollow; } - transport = isHttpsRequest ? httpsFollow : httpFollow; } if (config.maxBodyLength > -1) { @@ -43143,7 +43381,7 @@ const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(addr const streams = [res]; - const responseLength = +res.headers['content-length']; + const responseLength = utils.toFiniteNumber(res.headers['content-length']); if (onDownloadProgress || maxDownloadRate) { const transformStream = new helpers_AxiosTransformStream({ @@ -43206,10 +43444,7 @@ const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(addr responseStream = streams.length > 1 ? external_stream_.pipeline(streams, utils.noop) : streams[0]; - const offListeners = external_stream_.finished(responseStream, () => { - offListeners(); - onFinished(); - }); + const response = { status: res.statusCode, @@ -43235,7 +43470,7 @@ const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(addr // stream.destroy() emit aborted event before calling reject() on Node.js v16 rejected = true; responseStream.destroy(); - reject(new core_AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded', + abort(new core_AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded', core_AxiosError.ERR_BAD_RESPONSE, config, lastRequest)); } }); @@ -43277,7 +43512,7 @@ const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(addr }); } - emitter.once('abort', err => { + abortEmitter.once('abort', err => { if (!responseStream.destroyed) { responseStream.emit('error', err); responseStream.destroy(); @@ -43285,15 +43520,16 @@ const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(addr }); }); - emitter.once('abort', err => { - reject(err); - req.destroy(err); + abortEmitter.once('abort', err => { + if (req.close) { + req.close(); + } else { + req.destroy(err); + } }); // Handle errors req.on('error', function handleRequestError(err) { - // @todo remove - // if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return; reject(core_AxiosError.from(err, null, config, req)); }); @@ -43309,7 +43545,7 @@ const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(addr const timeout = parseInt(config.timeout, 10); if (Number.isNaN(timeout)) { - reject(new core_AxiosError( + abort(new core_AxiosError( 'error trying to parse `config.timeout` to int', core_AxiosError.ERR_BAD_OPTION_VALUE, config, @@ -43331,14 +43567,16 @@ const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(addr if (config.timeoutErrorMessage) { timeoutErrorMessage = config.timeoutErrorMessage; } - reject(new core_AxiosError( + abort(new core_AxiosError( timeoutErrorMessage, transitional.clarifyTimeoutError ? core_AxiosError.ETIMEDOUT : core_AxiosError.ECONNABORTED, config, req )); - abort(); }); + } else { + // explicitly reset the socket timeout value for a possible `keep-alive` request + req.setTimeout(0); } @@ -43364,7 +43602,8 @@ const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(addr data.pipe(req); } else { - req.end(data); + data && req.write(data); + req.end(); } }); }); @@ -43395,27 +43634,38 @@ const __setProxy = (/* unused pure expression or super */ null && (setProxy)); // Standard browser envs support document.cookie { - write(name, value, expires, path, domain, secure) { - const cookie = [name + '=' + encodeURIComponent(value)]; - - utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString()); - - utils.isString(path) && cookie.push('path=' + path); + write(name, value, expires, path, domain, secure, sameSite) { + if (typeof document === 'undefined') return; - utils.isString(domain) && cookie.push('domain=' + domain); + const cookie = [`${name}=${encodeURIComponent(value)}`]; - secure === true && cookie.push('secure'); + if (utils.isNumber(expires)) { + cookie.push(`expires=${new Date(expires).toUTCString()}`); + } + if (utils.isString(path)) { + cookie.push(`path=${path}`); + } + if (utils.isString(domain)) { + cookie.push(`domain=${domain}`); + } + if (secure === true) { + cookie.push('secure'); + } + if (utils.isString(sameSite)) { + cookie.push(`SameSite=${sameSite}`); + } document.cookie = cookie.join('; '); }, read(name) { - const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); - return (match ? decodeURIComponent(match[3]) : null); + if (typeof document === 'undefined') return null; + const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)')); + return match ? decodeURIComponent(match[1]) : null; }, remove(name) { - this.write(name, '', Date.now() - 86400000); + this.write(name, '', Date.now() - 86400000, '/'); } } @@ -43437,7 +43687,8 @@ const __setProxy = (/* unused pure expression or super */ null && (setProxy)); -const headersToObject = (thing) => thing instanceof core_AxiosHeaders ? { ...thing } : thing; +const headersToObject = (thing) => + thing instanceof core_AxiosHeaders ? { ...thing } : thing; /** * Config-specific merge-function which creates a new config-object @@ -43455,7 +43706,7 @@ function mergeConfig(config1, config2) { function getMergedValue(target, source, prop, caseless) { if (utils.isPlainObject(target) && utils.isPlainObject(source)) { - return utils.merge.call({caseless}, target, source); + return utils.merge.call({ caseless }, target, source); } else if (utils.isPlainObject(source)) { return utils.merge({}, source); } else if (utils.isArray(source)) { @@ -43464,12 +43715,11 @@ function mergeConfig(config1, config2) { return source; } - // eslint-disable-next-line consistent-return - function mergeDeepProperties(a, b, prop , caseless) { + function mergeDeepProperties(a, b, prop, caseless) { if (!utils.isUndefined(b)) { - return getMergedValue(a, b, prop , caseless); + return getMergedValue(a, b, prop, caseless); } else if (!utils.isUndefined(a)) { - return getMergedValue(undefined, a, prop , caseless); + return getMergedValue(undefined, a, prop, caseless); } } @@ -43527,14 +43777,27 @@ function mergeConfig(config1, config2) { socketPath: defaultToConfig2, responseEncoding: defaultToConfig2, validateStatus: mergeDirectKeys, - headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true) + headers: (a, b, prop) => + mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true), }; - utils.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) { - const merge = mergeMap[prop] || mergeDeepProperties; - const configValue = merge(config1[prop], config2[prop], prop); - (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue); - }); + utils.forEach( + Object.keys({ ...config1, ...config2 }), + function computeConfigValue(prop) { + if ( + prop === "__proto__" || + prop === "constructor" || + prop === "prototype" + ) + return; + const merge = utils.hasOwnProp(mergeMap, prop) + ? mergeMap[prop] + : mergeDeepProperties; + const configValue = merge(config1[prop], config2[prop], prop); + (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || + (config[prop] = configValue); + }, + ); return config; } @@ -43828,7 +44091,7 @@ const composeSignals = (signals, timeout) => { let timer = timeout && setTimeout(() => { timer = null; - onabort(new core_AxiosError(`timeout ${timeout} of ms exceeded`, core_AxiosError.ETIMEDOUT)) + onabort(new core_AxiosError(`timeout of ${timeout}ms exceeded`, core_AxiosError.ETIMEDOUT)) }, timeout) const unsubscribe = () => { @@ -44193,14 +44456,14 @@ const factory = (env) => { if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) { throw Object.assign( - new core_AxiosError('Network Error', core_AxiosError.ERR_NETWORK, config, request), + new core_AxiosError('Network Error', core_AxiosError.ERR_NETWORK, config, request, err && err.response), { cause: err.cause || err } ) } - throw core_AxiosError.from(err, err && err.code, config, request); + throw core_AxiosError.from(err, err && err.code, config, request, err && err.response); } } } @@ -44208,7 +44471,7 @@ const factory = (env) => { const seedCache = new Map(); const getFetch = (config) => { - let env = config ? config.env : {}; + let env = (config && config.env) || {}; const {fetch, Request, Response} = env; const seeds = [ Request, Response, fetch @@ -44240,79 +44503,124 @@ const adapter = getFetch(); +/** + * Known adapters mapping. + * Provides environment-specific adapters for Axios: + * - `http` for Node.js + * - `xhr` for browsers + * - `fetch` for fetch API-based requests + * + * @type {Object} + */ const knownAdapters = { http: http, xhr: xhr, fetch: { get: getFetch, } -} +}; +// Assign adapter names for easier debugging and identification utils.forEach(knownAdapters, (fn, value) => { if (fn) { try { - Object.defineProperty(fn, 'name', {value}); + Object.defineProperty(fn, 'name', { value }); } catch (e) { // eslint-disable-next-line no-empty } - Object.defineProperty(fn, 'adapterName', {value}); + Object.defineProperty(fn, 'adapterName', { value }); } }); +/** + * Render a rejection reason string for unknown or unsupported adapters + * + * @param {string} reason + * @returns {string} + */ const renderReason = (reason) => `- ${reason}`; +/** + * Check if the adapter is resolved (function, null, or false) + * + * @param {Function|null|false} adapter + * @returns {boolean} + */ const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false; -/* harmony default export */ const adapters = ({ - getAdapter: (adapters, config) => { - adapters = utils.isArray(adapters) ? adapters : [adapters]; - - const {length} = adapters; - let nameOrAdapter; - let adapter; +/** + * Get the first suitable adapter from the provided list. + * Tries each adapter in order until a supported one is found. + * Throws an AxiosError if no adapter is suitable. + * + * @param {Array|string|Function} adapters - Adapter(s) by name or function. + * @param {Object} config - Axios request configuration + * @throws {AxiosError} If no suitable adapter is available + * @returns {Function} The resolved adapter function + */ +function getAdapter(adapters, config) { + adapters = utils.isArray(adapters) ? adapters : [adapters]; - const rejectedReasons = {}; + const { length } = adapters; + let nameOrAdapter; + let adapter; - for (let i = 0; i < length; i++) { - nameOrAdapter = adapters[i]; - let id; + const rejectedReasons = {}; - adapter = nameOrAdapter; + for (let i = 0; i < length; i++) { + nameOrAdapter = adapters[i]; + let id; - if (!isResolvedHandle(nameOrAdapter)) { - adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()]; + adapter = nameOrAdapter; - if (adapter === undefined) { - throw new core_AxiosError(`Unknown adapter '${id}'`); - } - } + if (!isResolvedHandle(nameOrAdapter)) { + adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()]; - if (adapter && (utils.isFunction(adapter) || (adapter = adapter.get(config)))) { - break; + if (adapter === undefined) { + throw new core_AxiosError(`Unknown adapter '${id}'`); } + } - rejectedReasons[id || '#' + i] = adapter; + if (adapter && (utils.isFunction(adapter) || (adapter = adapter.get(config)))) { + break; } - if (!adapter) { + rejectedReasons[id || '#' + i] = adapter; + } - const reasons = Object.entries(rejectedReasons) - .map(([id, state]) => `adapter ${id} ` + - (state === false ? 'is not supported by the environment' : 'is not available in the build') - ); + if (!adapter) { + const reasons = Object.entries(rejectedReasons) + .map(([id, state]) => `adapter ${id} ` + + (state === false ? 'is not supported by the environment' : 'is not available in the build') + ); - let s = length ? - (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) : - 'as no adapter specified'; + let s = length ? + (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) : + 'as no adapter specified'; - throw new core_AxiosError( - `There is no suitable adapter to dispatch the request ` + s, - 'ERR_NOT_SUPPORT' - ); - } + throw new core_AxiosError( + `There is no suitable adapter to dispatch the request ` + s, + 'ERR_NOT_SUPPORT' + ); + } - return adapter; - }, + return adapter; +} + +/** + * Exports Axios adapters and utility to resolve an adapter + */ +/* harmony default export */ const adapters = ({ + /** + * Resolve an adapter from a list of adapter names or functions. + * @type {Function} + */ + getAdapter, + + /** + * Exposes all known adapters + * @type {Object} + */ adapters: knownAdapters }); @@ -44512,6 +44820,7 @@ function assertOptions(options, schema, allowUnknown) { + const Axios_validators = validator.validators; /** @@ -44583,7 +44892,8 @@ class Axios { validator.assertOptions(transitional, { silentJSONParsing: Axios_validators.transitional(Axios_validators.boolean), forcedJSONParsing: Axios_validators.transitional(Axios_validators.boolean), - clarifyTimeoutError: Axios_validators.transitional(Axios_validators.boolean) + clarifyTimeoutError: Axios_validators.transitional(Axios_validators.boolean), + legacyInterceptorReqResOrdering: Axios_validators.transitional(Axios_validators.boolean) }, false); } @@ -44642,7 +44952,14 @@ class Axios { synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; - requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); + const transitional = config.transitional || defaults_transitional; + const legacyInterceptorReqResOrdering = transitional && transitional.legacyInterceptorReqResOrdering; + + if (legacyInterceptorReqResOrdering) { + requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); + } else { + requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); + } }); const responseInterceptorChain = []; @@ -44889,7 +45206,7 @@ class CancelToken { * * ```js * function f(x, y, z) {} - * var args = [1, 2, 3]; + * const args = [1, 2, 3]; * f.apply(null, args); * ``` * @@ -44990,6 +45307,12 @@ const HttpStatusCode = { LoopDetected: 508, NotExtended: 510, NetworkAuthenticationRequired: 511, + WebServerIsDown: 521, + ConnectionTimedOut: 522, + OriginIsUnreachable: 523, + TimeoutOccurred: 524, + SslHandshakeFailed: 525, + InvalidSslCertificate: 526, }; Object.entries(HttpStatusCode).forEach(([key, value]) => { diff --git a/yarn.lock b/yarn.lock index c4030f1..bd9467c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -297,12 +297,12 @@ asynckit@^0.4.0: integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== axios@^1.9.0: - version "1.12.2" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.12.2.tgz#6c307390136cf7a2278d09cec63b136dfc6e6da7" - integrity "sha1-bDBzkBNs96InjQnOxjsTbfxubac= sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw==" + version "1.13.5" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.13.5.tgz#5e464688fa127e11a660a2c49441c009f6567a43" + integrity "sha1-XkZGiPoSfhGmYKLElEHACfZWekM= sha512-cz4ur7Vb0xS4/KUN0tPWe44eqxrIu31me+fbang3ijiNscE129POzipJJA6zniq2C/Z6sJCjMimjS8Lc/GAs8Q==" dependencies: - follow-redirects "^1.15.6" - form-data "^4.0.4" + follow-redirects "^1.15.11" + form-data "^4.0.5" proxy-from-env "^1.1.0" balanced-match@^1.0.0: @@ -786,15 +786,15 @@ flatted@^3.2.9: resolved "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz" integrity sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ== -follow-redirects@^1.15.6: - version "1.15.9" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.9.tgz#a604fa10e443bf98ca94228d9eebcc2e8a2c8ee1" - integrity sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ== +follow-redirects@^1.15.11: + version "1.15.11" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.11.tgz#777d73d72a92f8ec4d2e410eb47352a56b8e8340" + integrity "sha1-d31z1yqS+OxNLkEOtHNSpWuOg0A= sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==" -form-data@^4.0.4: - version "4.0.4" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.4.tgz#784cdcce0669a9d68e94d11ac4eea98088edd2c4" - integrity sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow== +form-data@^4.0.5: + version "4.0.5" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.5.tgz#b49e48858045ff4cbf6b03e1805cebcad3679053" + integrity "sha1-tJ5IhYBF/0y/awPhgFzrytNnkFM= sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==" dependencies: asynckit "^0.4.0" combined-stream "^1.0.8"