From 4d1f4bf2f93111fd0c500d4d47cf097ce2549905 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 4 Jan 2024 18:23:28 -0600 Subject: [PATCH] [create-pull-request] automated change (#61) Co-authored-by: IEvangelist --- dist/resource-translator/index.js | 144 +++++++++++++++++++----------- 1 file changed, 93 insertions(+), 51 deletions(-) diff --git a/dist/resource-translator/index.js b/dist/resource-translator/index.js index 814acbc..cf05df0 100644 --- a/dist/resource-translator/index.js +++ b/dist/resource-translator/index.js @@ -23870,7 +23870,7 @@ module.exports = require("zlib"); /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -// Axios v1.4.0 Copyright (c) 2023 Matt Zabriskie and contributors +// Axios v1.6.0 Copyright (c) 2023 Matt Zabriskie and contributors const FormData$1 = __nccwpck_require__(4334); @@ -24440,8 +24440,9 @@ const reduceDescriptors = (obj, reducer) => { const reducedDescriptors = {}; forEach(descriptors, (descriptor, name) => { - if (reducer(descriptor, name, obj) !== false) { - reducedDescriptors[name] = descriptor; + let ret; + if ((ret = reducer(descriptor, name, obj)) !== false) { + reducedDescriptors[name] = ret || descriptor; } }); @@ -25225,10 +25226,6 @@ function formDataToJSON(formData) { return null; } -const DEFAULT_CONTENT_TYPE = { - 'Content-Type': undefined -}; - /** * It takes a string, tries to parse it, and if it fails, it returns the stringified version * of the input @@ -25367,19 +25364,16 @@ const defaults = { headers: { common: { - 'Accept': 'application/json, text/plain, */*' + 'Accept': 'application/json, text/plain, */*', + 'Content-Type': undefined } } }; -utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { +utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => { defaults.headers[method] = {}; }); -utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { - defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); -}); - const defaults$1 = defaults; // RawAxiosHeaders whose duplicates are ignored by node @@ -25713,7 +25707,17 @@ class AxiosHeaders { AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']); -utils.freezeMethods(AxiosHeaders.prototype); +// reserved names hotfix +utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => { + let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set` + return { + get: () => value, + set(headerValue) { + this[mapped] = headerValue; + } + } +}); + utils.freezeMethods(AxiosHeaders); const AxiosHeaders$1 = AxiosHeaders; @@ -25833,7 +25837,7 @@ function buildFullPath(baseURL, requestedURL) { return requestedURL; } -const VERSION = "1.4.0"; +const VERSION = "1.6.0"; function parseProtocol(url) { const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); @@ -26437,6 +26441,18 @@ const wrapAsync = (asyncExecutor) => { }) }; +const resolveFamily = ({address, family}) => { + if (!utils.isString(address)) { + throw TypeError('address must be a string'); + } + return ({ + address, + family: family || (address.indexOf('.') < 0 ? 6 : 4) + }); +}; + +const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(address) ? address : {address, family}); + /*eslint consistent-return:0*/ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) { return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) { @@ -26447,15 +26463,16 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) { let rejected = false; let req; - if (lookup && utils.isAsyncFn(lookup)) { - lookup = callbackify$1(lookup, (entry) => { - if(utils.isString(entry)) { - entry = [entry, entry.indexOf('.') < 0 ? 6 : 4]; - } else if (!utils.isArray(entry)) { - throw new TypeError('lookup async function must return an array [ip: string, family: number]]') - } - return entry; - }); + if (lookup) { + const _lookup = callbackify$1(lookup, (value) => utils.isArray(value) ? value : [value]); + // hotfix to support opt.all option which is required for node 20.x + lookup = (hostname, opt, cb) => { + _lookup(hostname, opt, (err, arg0, arg1) => { + const addresses = utils.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)]; + + opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family); + }); + }; } // temporary internal emitter until the AxiosRequest class will be implemented @@ -26682,11 +26699,13 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) { auth, protocol, family, - lookup, beforeRedirect: dispatchBeforeRedirect, beforeRedirects: {} }; + // cacheable-lookup integration hotfix + !utils.isUndefined(lookup) && (options.lookup = lookup); + if (config.socketPath) { options.socketPath = config.socketPath; } else { @@ -26760,7 +26779,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) { delete res.headers['content-encoding']; } - switch (res.headers['content-encoding']) { + switch ((res.headers['content-encoding'] || '').toLowerCase()) { /*eslint default-case:0*/ case 'gzip': case 'x-gzip': @@ -26856,7 +26875,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) { } response.data = responseData; } catch (err) { - reject(AxiosError.from(err, null, config, response.request, response)); + return reject(AxiosError.from(err, null, config, response.request, response)); } settle(resolve, reject, response); }); @@ -26893,7 +26912,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) { // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types. const timeout = parseInt(config.timeout, 10); - if (isNaN(timeout)) { + if (Number.isNaN(timeout)) { reject(new AxiosError( 'error trying to parse `config.timeout` to int', AxiosError.ERR_BAD_OPTION_VALUE, @@ -27112,11 +27131,16 @@ const xhrAdapter = isXHRAdapterSupported && function (config) { } } + let contentType; + if (utils.isFormData(requestData)) { if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) { requestHeaders.setContentType(false); // Let the browser set it - } else { - requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks + } else if(!requestHeaders.getContentType(/^\s*multipart\/form-data/)){ + requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks + } else if(utils.isString(contentType = requestHeaders.getContentType())){ + // fix semicolon duplication issue for ReactNative FormData implementation + requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, '$1')); } } @@ -27234,8 +27258,8 @@ const xhrAdapter = isXHRAdapterSupported && function (config) { // Specifically not if we're in a web worker, or react-native. if (platform.isStandardBrowserEnv) { // Add xsrf header - const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) - && config.xsrfCookieName && cookies.read(config.xsrfCookieName); + // regarding CVE-2023-45857 config.withCredentials condition was removed temporarily + const xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName); if (xsrfValue) { requestHeaders.set(config.xsrfHeaderName, xsrfValue); @@ -27309,7 +27333,7 @@ const knownAdapters = { }; utils.forEach(knownAdapters, (fn, value) => { - if(fn) { + if (fn) { try { Object.defineProperty(fn, 'name', {value}); } catch (e) { @@ -27319,6 +27343,10 @@ utils.forEach(knownAdapters, (fn, value) => { } }); +const renderReason = (reason) => `- ${reason}`; + +const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false; + const adapters = { getAdapter: (adapters) => { adapters = utils.isArray(adapters) ? adapters : [adapters]; @@ -27327,30 +27355,44 @@ const adapters = { let nameOrAdapter; let adapter; + const rejectedReasons = {}; + for (let i = 0; i < length; i++) { nameOrAdapter = adapters[i]; - if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) { + let id; + + adapter = nameOrAdapter; + + if (!isResolvedHandle(nameOrAdapter)) { + adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()]; + + if (adapter === undefined) { + throw new AxiosError(`Unknown adapter '${id}'`); + } + } + + if (adapter) { break; } + + rejectedReasons[id || '#' + i] = adapter; } if (!adapter) { - if (adapter === false) { - throw new AxiosError( - `Adapter ${nameOrAdapter} is not supported by the environment`, - 'ERR_NOT_SUPPORT' + + const reasons = Object.entries(rejectedReasons) + .map(([id, state]) => `adapter ${id} ` + + (state === false ? 'is not supported by the environment' : 'is not available in the build') ); - } - throw new Error( - utils.hasOwnProp(knownAdapters, nameOrAdapter) ? - `Adapter '${nameOrAdapter}' is not available in the build` : - `Unknown adapter '${nameOrAdapter}'` - ); - } + let s = length ? + (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) : + 'as no adapter specified'; - if (!utils.isFunction(adapter)) { - throw new TypeError('adapter is not a function'); + throw new AxiosError( + `There is no suitable adapter to dispatch the request ` + s, + 'ERR_NOT_SUPPORT' + ); } return adapter; @@ -27683,15 +27725,13 @@ class Axios { // Set config.method config.method = (config.method || this.defaults.method || 'get').toLowerCase(); - let contextHeaders; - // Flatten headers - contextHeaders = headers && utils.merge( + let contextHeaders = headers && utils.merge( headers.common, headers[config.method] ); - contextHeaders && utils.forEach( + headers && utils.forEach( ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => { delete headers[method]; @@ -28101,6 +28141,8 @@ axios.AxiosHeaders = AxiosHeaders$1; axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing); +axios.getAdapter = adapters.getAdapter; + axios.HttpStatusCode = HttpStatusCode$1; axios.default = axios;