From 31aeefe6fcd000503279a6ca68f4f0d9f3555144 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 27 Mar 2024 13:39:36 +0100 Subject: [PATCH 01/29] @uppy/companion: bump Node.js version support matrix --- .github/workflows/companion.yml | 2 +- packages/@uppy/companion/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/companion.yml b/.github/workflows/companion.yml index 68ebedb803..ed6ab43437 100644 --- a/.github/workflows/companion.yml +++ b/.github/workflows/companion.yml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [14.x, 16.x, 18.x] + node-version: [18.x, 20.x, latest] steps: - name: Checkout sources uses: actions/checkout@v3 diff --git a/packages/@uppy/companion/package.json b/packages/@uppy/companion/package.json index 4b186a4434..bdbf6adf36 100644 --- a/packages/@uppy/companion/package.json +++ b/packages/@uppy/companion/package.json @@ -112,7 +112,7 @@ "test": "jest" }, "engines": { - "node": "^14.19.0 || ^16.15.0 || >=18.0.0" + "node": "^18.20.0 || ^20.10.0 || >=22.0.0" }, "installConfig": { "hoistingLimits": "workspaces" From 4178e47249ec994dfceb95b5f36508098968487f Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 28 Mar 2024 10:54:30 +0100 Subject: [PATCH 02/29] upgrade got to 12 fixes #4317 --- packages/@uppy/companion/package.json | 4 +- .../@uppy/companion/src/server/Uploader.js | 5 +- .../companion/src/server/controllers/url.js | 2 +- packages/@uppy/companion/src/server/got.js | 4 + .../companion/src/server/helpers/request.js | 9 +- packages/@uppy/companion/src/server/jobs.js | 5 +- .../src/server/provider/box/index.js | 19 +- .../src/server/provider/credentials.js | 5 +- .../src/server/provider/drive/index.js | 17 +- .../src/server/provider/dropbox/index.js | 25 +- .../src/server/provider/facebook/index.js | 14 +- .../server/provider/instagram/graph/index.js | 12 +- .../src/server/provider/onedrive/index.js | 16 +- .../src/server/provider/unsplash/index.js | 14 +- .../src/server/provider/zoom/index.js | 15 +- yarn.lock | 252 ++++++++---------- 16 files changed, 195 insertions(+), 223 deletions(-) create mode 100644 packages/@uppy/companion/src/server/got.js diff --git a/packages/@uppy/companion/package.json b/packages/@uppy/companion/package.json index 5ddf06feeb..4283bf905b 100644 --- a/packages/@uppy/companion/package.json +++ b/packages/@uppy/companion/package.json @@ -49,7 +49,7 @@ "express-request-id": "1.4.1", "express-session": "1.17.3", "form-data": "^3.0.0", - "got": "11", + "got": "^12.6.0", "grant": "5.4.21", "helmet": "^4.6.0", "ipaddr.js": "^2.0.1", @@ -109,7 +109,7 @@ "deploy": "kubectl apply -f infra/kube/companion-kube.yml", "prepublishOnly": "yarn run build", "start": "node ./lib/standalone/start-server.js", - "test": "jest" + "test": "NODE_OPTIONS=--experimental-vm-modules jest" }, "engines": { "node": "^18.20.0 || ^20.10.0 || >=22.0.0" diff --git a/packages/@uppy/companion/src/server/Uploader.js b/packages/@uppy/companion/src/server/Uploader.js index 6375b1bdae..7b8aa7e089 100644 --- a/packages/@uppy/companion/src/server/Uploader.js +++ b/packages/@uppy/companion/src/server/Uploader.js @@ -2,7 +2,6 @@ const tus = require('tus-js-client') const { randomUUID } = require('node:crypto') const validator = require('validator') -const got = require('got').default const { pipeline: pipelineCb } = require('node:stream') const { join } = require('node:path') const fs = require('node:fs') @@ -14,6 +13,8 @@ const { Upload } = require('@aws-sdk/lib-storage') const { rfc2047EncodeMetadata, getBucket } = require('./helpers/utils') +const got = require('./got') + // TODO move to `require('streams/promises').pipeline` when dropping support for Node.js 14.x. const pipeline = promisify(pipelineCb) @@ -632,7 +633,7 @@ class Uploader { try { const httpMethod = (this.options.httpMethod || '').toUpperCase() === 'PUT' ? 'put' : 'post' - const runRequest = got[httpMethod] + const runRequest = (await got)[httpMethod] const response = await runRequest(url, reqOptions) diff --git a/packages/@uppy/companion/src/server/controllers/url.js b/packages/@uppy/companion/src/server/controllers/url.js index 0a2a3b0bde..31303a3702 100644 --- a/packages/@uppy/companion/src/server/controllers/url.js +++ b/packages/@uppy/companion/src/server/controllers/url.js @@ -25,7 +25,7 @@ const downloadURL = async (url, blockLocalIPs, traceId) => { // TODO in next major, rename all blockLocalIPs to allowLocalUrls and invert the bool, to make it consistent // see discussion https://github.com/transloadit/uppy/pull/4554/files#r1268677162 try { - const protectedGot = getProtectedGot({ blockLocalIPs }) + const protectedGot = await getProtectedGot({ blockLocalIPs }) const stream = protectedGot.stream.get(url, { responseType: 'json' }) await prepareStream(stream) return stream diff --git a/packages/@uppy/companion/src/server/got.js b/packages/@uppy/companion/src/server/got.js new file mode 100644 index 0000000000..b761d7c6c0 --- /dev/null +++ b/packages/@uppy/companion/src/server/got.js @@ -0,0 +1,4 @@ +// eslint-disable-next-line import/no-unresolved +const gotPromise = import('got') + +module.exports = gotPromise.then((got) => got.default) diff --git a/packages/@uppy/companion/src/server/helpers/request.js b/packages/@uppy/companion/src/server/helpers/request.js index e9631eef71..9de9f5283d 100644 --- a/packages/@uppy/companion/src/server/helpers/request.js +++ b/packages/@uppy/companion/src/server/helpers/request.js @@ -3,11 +3,12 @@ const http = require('node:http') const https = require('node:https') const dns = require('node:dns') const ipaddr = require('ipaddr.js') -const got = require('got').default const path = require('node:path') const contentDisposition = require('content-disposition') const validator = require('validator') +const got = require('../got') + const FORBIDDEN_IP_ADDRESS = 'Forbidden IP address' // Example scary IPs that should return false (ipv6-to-ipv4 mapped): @@ -84,7 +85,7 @@ const getProtectedHttpAgent = ({ protocol, blockLocalIPs }) => { module.exports.getProtectedHttpAgent = getProtectedHttpAgent -function getProtectedGot ({ blockLocalIPs }) { +async function getProtectedGot ({ blockLocalIPs }) { const HttpAgent = getProtectedHttpAgent({ protocol: 'http', blockLocalIPs }) const HttpsAgent = getProtectedHttpAgent({ protocol: 'https', blockLocalIPs }) const httpAgent = new HttpAgent() @@ -92,7 +93,7 @@ function getProtectedGot ({ blockLocalIPs }) { // @ts-ignore - return got.extend({ agent: { http: httpAgent, https: httpsAgent } }) + return (await got).extend({ agent: { http: httpAgent, https: httpsAgent } }) } module.exports.getProtectedGot = getProtectedGot @@ -106,7 +107,7 @@ module.exports.getProtectedGot = getProtectedGot */ exports.getURLMeta = async (url, blockLocalIPs = false) => { async function requestWithMethod (method) { - const protectedGot = getProtectedGot({ blockLocalIPs }) + const protectedGot = await getProtectedGot({ blockLocalIPs }) const stream = protectedGot.stream(url, { method, throwHttpErrors: false }) return new Promise((resolve, reject) => ( diff --git a/packages/@uppy/companion/src/server/jobs.js b/packages/@uppy/companion/src/server/jobs.js index 44f12e39fb..68fde58210 100644 --- a/packages/@uppy/companion/src/server/jobs.js +++ b/packages/@uppy/companion/src/server/jobs.js @@ -2,7 +2,8 @@ const schedule = require('node-schedule') const fs = require('node:fs') const path = require('node:path') const { promisify } = require('node:util') -const got = require('got').default + +const got = require('./got') const { FILE_NAME_PREFIX } = require('./Uploader') const logger = require('./logger') @@ -65,7 +66,7 @@ async function runPeriodicPing ({ urls, payload, requestTimeout }) { // Run requests in parallel await Promise.all(urls.map(async (url) => { try { - await got.post(url, { json: payload, timeout: { request: requestTimeout } }) + await (await got).post(url, { json: payload, timeout: { request: requestTimeout } }) } catch (err) { logger.warn(err, 'jobs.periodic.ping') } diff --git a/packages/@uppy/companion/src/server/provider/box/index.js b/packages/@uppy/companion/src/server/provider/box/index.js index 5ce6278136..923884e35c 100644 --- a/packages/@uppy/companion/src/server/provider/box/index.js +++ b/packages/@uppy/companion/src/server/provider/box/index.js @@ -1,14 +1,14 @@ -const got = require('got').default - const Provider = require('../Provider') const adaptData = require('./adapter') const { withProviderErrorHandling } = require('../providerErrors') const { prepareStream } = require('../../helpers/utils') +const got = require('../../got') + const BOX_FILES_FIELDS = 'id,modified_at,name,permissions,size,type' const BOX_THUMBNAIL_SIZE = 256 -const getClient = ({ token }) => got.extend({ +const getClient = async ({ token }) => (await got).extend({ prefixUrl: 'https://api.box.com/2.0', headers: { authorization: `Bearer ${token}`, @@ -16,13 +16,12 @@ const getClient = ({ token }) => got.extend({ }) async function getUserInfo ({ token }) { - return getClient({ token }).get('users/me', { responseType: 'json' }).json() + return (await getClient({ token })).get('users/me', { responseType: 'json' }).json() } async function list ({ directory, query, token }) { const rootFolderID = '0' - // https://developer.box.com/reference/resources/items/ - return getClient({ token }).get(`folders/${directory || rootFolderID}/items`, { searchParams: { fields: BOX_FILES_FIELDS, offset: query.cursor, limit: 1000 }, responseType: 'json' }).json() + return (await getClient({ token })).get(`folders/${directory || rootFolderID}/items`, { searchParams: { fields: BOX_FILES_FIELDS, offset: query.cursor, limit: 1000 }, responseType: 'json' }).json() } /** @@ -61,7 +60,7 @@ class Box extends Provider { async download ({ id, token }) { return this.#withErrorHandling('provider.box.download.error', async () => { - const stream = getClient({ token }).stream.get(`files/${id}/content`, { responseType: 'json' }) + const stream = (await getClient({ token })).stream.get(`files/${id}/content`, { responseType: 'json' }) await prepareStream(stream) return { stream } @@ -81,7 +80,7 @@ class Box extends Provider { // At that time, retry this endpoint to retrieve the thumbnail. // // This can be reproduced more easily by changing extension to png and trying on a newly uploaded image - const stream = getClient({ token }).stream.get(`files/${id}/thumbnail.${extension}`, { + const stream = (await getClient({ token })).stream.get(`files/${id}/thumbnail.${extension}`, { searchParams: { max_height: BOX_THUMBNAIL_SIZE, max_width: BOX_THUMBNAIL_SIZE }, responseType: 'json', }) @@ -93,7 +92,7 @@ class Box extends Provider { async size ({ id, token }) { return this.#withErrorHandling('provider.box.size.error', async () => { - const { size } = await getClient({ token }).get(`files/${id}`, { responseType: 'json' }).json() + const { size } = await (await getClient({ token })).get(`files/${id}`, { responseType: 'json' }).json() return parseInt(size, 10) }) } @@ -101,7 +100,7 @@ class Box extends Provider { logout ({ companion, token }) { return this.#withErrorHandling('provider.box.logout.error', async () => { const { key, secret } = companion.options.providerOptions.box - await getClient({ token }).post('oauth2/revoke', { + await (await getClient({ token })).post('oauth2/revoke', { prefixUrl: 'https://api.box.com', form: { client_id: key, diff --git a/packages/@uppy/companion/src/server/provider/credentials.js b/packages/@uppy/companion/src/server/provider/credentials.js index 154378f9a6..16f1c58f80 100644 --- a/packages/@uppy/companion/src/server/provider/credentials.js +++ b/packages/@uppy/companion/src/server/provider/credentials.js @@ -1,4 +1,3 @@ -const got = require('got').default const atob = require('atob') const { htmlEscape } = require('escape-goat') const logger = require('../logger') @@ -7,6 +6,8 @@ const tokenService = require('../helpers/jwt') // eslint-disable-next-line const Provider = require('./Provider') +const got = require('../got') + /** * @param {string} url * @param {string} providerName @@ -14,7 +15,7 @@ const Provider = require('./Provider') */ async function fetchKeys (url, providerName, credentialRequestParams) { try { - const { credentials } = await got.post(url, { + const { credentials } = await (await got).post(url, { json: { provider: providerName, parameters: credentialRequestParams }, }).json() diff --git a/packages/@uppy/companion/src/server/provider/drive/index.js b/packages/@uppy/companion/src/server/provider/drive/index.js index 384a86b4ed..95b4561b7e 100644 --- a/packages/@uppy/companion/src/server/provider/drive/index.js +++ b/packages/@uppy/companion/src/server/provider/drive/index.js @@ -1,5 +1,3 @@ -const got = require('got').default - const Provider = require('../Provider') const logger = require('../../logger') const { VIRTUAL_SHARED_DIR, adaptData, isShortcut, isGsuiteFile, getGsuiteExportType } = require('./adapter') @@ -8,6 +6,7 @@ const { prepareStream } = require('../../helpers/utils') const { MAX_AGE_REFRESH_TOKEN } = require('../../helpers/jwt') const { ProviderAuthError } = require('../error') +const got = require('../../got') // For testing refresh token: // first run a download with mockAccessTokenExpiredError = true @@ -22,19 +21,19 @@ const DRIVE_FILES_FIELDS = `kind,nextPageToken,incompleteSearch,files(${DRIVE_FI // using wildcard to get all 'drive' fields because specifying fields seems no to work for the /drives endpoint const SHARED_DRIVE_FIELDS = '*' -const getClient = ({ token }) => got.extend({ +const getClient = async ({ token }) => (await got).extend({ prefixUrl: 'https://www.googleapis.com/drive/v3', headers: { authorization: `Bearer ${token}`, }, }) -const getOauthClient = () => got.extend({ +const getOauthClient = async () => (await got).extend({ prefixUrl: 'https://oauth2.googleapis.com', }) async function getStats ({ id, token }) { - const client = getClient({ token }) + const client = await getClient({ token }) const getStatsInner = async (statsOfId) => ( client.get(`files/${encodeURIComponent(statsOfId)}`, { searchParams: { fields: DRIVE_FILE_FIELDS, supportsAllDrives: true }, responseType: 'json' }).json() @@ -68,7 +67,7 @@ class Drive extends Provider { const isRoot = directory === 'root' const isVirtualSharedDirRoot = directory === VIRTUAL_SHARED_DIR - const client = getClient({ token }) + const client = await getClient({ token }) async function fetchSharedDrives (pageToken = null) { const shouldListSharedDrives = isRoot && !query.cursor @@ -137,7 +136,7 @@ class Drive extends Provider { } return this.#withErrorHandling('provider.drive.download.error', async () => { - const client = getClient({ token }) + const client = await getClient({ token }) const { mimeType, id } = await getStats({ id: idIn, token }) @@ -179,7 +178,7 @@ class Drive extends Provider { logout ({ token }) { return this.#withErrorHandling('provider.drive.logout.error', async () => { - await got.post('https://accounts.google.com/o/oauth2/revoke', { + await (await got).post('https://accounts.google.com/o/oauth2/revoke', { searchParams: { token }, responseType: 'json', }) @@ -190,7 +189,7 @@ class Drive extends Provider { async refreshToken ({ clientId, clientSecret, refreshToken }) { return this.#withErrorHandling('provider.drive.token.refresh.error', async () => { - const { access_token: accessToken } = await getOauthClient().post('token', { responseType: 'json', form: { refresh_token: refreshToken, grant_type: 'refresh_token', client_id: clientId, client_secret: clientSecret } }).json() + const { access_token: accessToken } = await (await getOauthClient()).post('token', { responseType: 'json', form: { refresh_token: refreshToken, grant_type: 'refresh_token', client_id: clientId, client_secret: clientSecret } }).json() return { accessToken } }) } diff --git a/packages/@uppy/companion/src/server/provider/dropbox/index.js b/packages/@uppy/companion/src/server/provider/dropbox/index.js index d696f4cc74..236bb0419c 100644 --- a/packages/@uppy/companion/src/server/provider/dropbox/index.js +++ b/packages/@uppy/companion/src/server/provider/dropbox/index.js @@ -1,11 +1,11 @@ -const got = require('got').default - const Provider = require('../Provider') const adaptData = require('./adapter') const { withProviderErrorHandling } = require('../providerErrors') const { prepareStream } = require('../../helpers/utils') const { MAX_AGE_REFRESH_TOKEN } = require('../../helpers/jwt') +const got = require('../../got') + // From https://www.dropbox.com/developers/reference/json-encoding: // // This function is simple and has OK performance compared to more @@ -18,23 +18,24 @@ function httpHeaderSafeJson (v) { }) } -const getClient = ({ token }) => got.extend({ +const getClient = async ({ token }) => (await got).extend({ prefixUrl: 'https://api.dropboxapi.com/2', headers: { authorization: `Bearer ${token}`, }, }) -const getOauthClient = () => got.extend({ +const getOauthClient = async () => (await got).extend({ prefixUrl: 'https://api.dropboxapi.com/oauth2', }) async function list ({ directory, query, token }) { + const client = await getClient({ token }) if (query.cursor) { - return getClient({ token }).post('files/list_folder/continue', { json: { cursor: query.cursor }, responseType: 'json' }).json() + return client.post('files/list_folder/continue', { json: { cursor: query.cursor }, responseType: 'json' }).json() } - return getClient({ token }).post('files/list_folder', { + return client.post('files/list_folder', { searchParams: query, json: { path: `${directory || ''}`, @@ -47,7 +48,7 @@ async function list ({ directory, query, token }) { } async function userInfo ({ token }) { - return getClient({ token }).post('users/get_current_account', { responseType: 'json' }).json() + return (await getClient({ token })).post('users/get_current_account', { responseType: 'json' }).json() } /** @@ -85,7 +86,7 @@ class DropBox extends Provider { async download ({ id, token }) { return this.#withErrorHandling('provider.dropbox.download.error', async () => { - const stream = getClient({ token }).stream.post('files/download', { + const stream = (await getClient({ token })).stream.post('files/download', { prefixUrl: 'https://content.dropboxapi.com/2', headers: { 'Dropbox-API-Arg': httpHeaderSafeJson({ path: String(id) }), @@ -102,7 +103,7 @@ class DropBox extends Provider { async thumbnail ({ id, token }) { return this.#withErrorHandling('provider.dropbox.thumbnail.error', async () => { - const stream = getClient({ token }).stream.post('files/get_thumbnail_v2', { + const stream = (await getClient({ token })).stream.post('files/get_thumbnail_v2', { prefixUrl: 'https://content.dropboxapi.com/2', headers: { 'Dropbox-API-Arg': httpHeaderSafeJson({ resource: { '.tag': 'path', path: `${id}` }, size: 'w256h256', format: 'jpeg' }) }, body: Buffer.alloc(0), @@ -116,21 +117,21 @@ class DropBox extends Provider { async size ({ id, token }) { return this.#withErrorHandling('provider.dropbox.size.error', async () => { - const { size } = await getClient({ token }).post('files/get_metadata', { json: { path: id }, responseType: 'json' }).json() + const { size } = await (await getClient({ token })).post('files/get_metadata', { json: { path: id }, responseType: 'json' }).json() return parseInt(size, 10) }) } async logout ({ token }) { return this.#withErrorHandling('provider.dropbox.logout.error', async () => { - await getClient({ token }).post('auth/token/revoke', { responseType: 'json' }) + await (await getClient({ token })).post('auth/token/revoke', { responseType: 'json' }) return { revoked: true } }) } async refreshToken ({ clientId, clientSecret, refreshToken }) { return this.#withErrorHandling('provider.dropbox.token.refresh.error', async () => { - const { access_token: accessToken } = await getOauthClient().post('token', { form: { refresh_token: refreshToken, grant_type: 'refresh_token', client_id: clientId, client_secret: clientSecret } }).json() + const { access_token: accessToken } = await (await getOauthClient()).post('token', { form: { refresh_token: refreshToken, grant_type: 'refresh_token', client_id: clientId, client_secret: clientSecret } }).json() return { accessToken } }) } diff --git a/packages/@uppy/companion/src/server/provider/facebook/index.js b/packages/@uppy/companion/src/server/provider/facebook/index.js index e29f98f183..22e6367137 100644 --- a/packages/@uppy/companion/src/server/provider/facebook/index.js +++ b/packages/@uppy/companion/src/server/provider/facebook/index.js @@ -1,5 +1,3 @@ -const got = require('got').default - const Provider = require('../Provider') const { getURLMeta } = require('../../helpers/request') const logger = require('../../logger') @@ -7,7 +5,9 @@ const { adaptData, sortImages } = require('./adapter') const { withProviderErrorHandling } = require('../providerErrors') const { prepareStream } = require('../../helpers/utils') -const getClient = ({ token }) => got.extend({ +const got = require('../../got') + +const getClient = async ({ token }) => (await got).extend({ prefixUrl: 'https://graph.facebook.com', headers: { authorization: `Bearer ${token}`, @@ -15,7 +15,7 @@ const getClient = ({ token }) => got.extend({ }) async function getMediaUrl ({ token, id }) { - const body = await getClient({ token }).get(String(id), { searchParams: { fields: 'images' }, responseType: 'json' }).json() + const body = await (await getClient({ token })).get(String(id), { searchParams: { fields: 'images' }, responseType: 'json' }).json() const sortedImages = sortImages(body.images) return sortedImages[sortedImages.length - 1].source } @@ -40,7 +40,7 @@ class Facebook extends Provider { qs.fields = 'icon,images,name,width,height,created_time' } - const client = getClient({ token }) + const client = await getClient({ token }) const [{ email }, list] = await Promise.all([ client.get('me', { searchParams: { fields: 'email' }, responseType: 'json' }).json(), @@ -53,7 +53,7 @@ class Facebook extends Provider { async download ({ id, token }) { return this.#withErrorHandling('provider.facebook.download.error', async () => { const url = await getMediaUrl({ token, id }) - const stream = got.stream.get(url, { responseType: 'json' }) + const stream = (await got).stream.get(url, { responseType: 'json' }) await prepareStream(stream) return { stream } }) @@ -76,7 +76,7 @@ class Facebook extends Provider { async logout ({ token }) { return this.#withErrorHandling('provider.facebook.logout.error', async () => { - await getClient({ token }).delete('me/permissions', { responseType: 'json' }).json() + await (await getClient({ token })).delete('me/permissions', { responseType: 'json' }).json() return { revoked: true } }) } diff --git a/packages/@uppy/companion/src/server/provider/instagram/graph/index.js b/packages/@uppy/companion/src/server/provider/instagram/graph/index.js index 4bf05c3e0f..13c52aa055 100644 --- a/packages/@uppy/companion/src/server/provider/instagram/graph/index.js +++ b/packages/@uppy/companion/src/server/provider/instagram/graph/index.js @@ -1,5 +1,3 @@ -const got = require('got').default - const Provider = require('../../Provider') const { getURLMeta } = require('../../../helpers/request') const logger = require('../../../logger') @@ -7,7 +5,9 @@ const adaptData = require('./adapter') const { withProviderErrorHandling } = require('../../providerErrors') const { prepareStream } = require('../../../helpers/utils') -const getClient = ({ token }) => got.extend({ +const got = require('../../../got') + +const getClient = async ({ token }) => (await got).extend({ prefixUrl: 'https://graph.instagram.com', headers: { authorization: `Bearer ${token}`, @@ -15,7 +15,7 @@ const getClient = ({ token }) => got.extend({ }) async function getMediaUrl ({ token, id }) { - const body = await getClient({ token }).get(String(id), { searchParams: { fields: 'media_url' }, responseType: 'json' }).json() + const body = await (await getClient({ token })).get(String(id), { searchParams: { fields: 'media_url' }, responseType: 'json' }).json() return body.media_url } @@ -41,7 +41,7 @@ class Instagram extends Provider { if (query.cursor) qs.after = query.cursor - const client = getClient({ token }) + const client = await getClient({ token }) const [{ username }, list] = await Promise.all([ client.get('me', { searchParams: { fields: 'username' }, responseType: 'json' }).json(), @@ -54,7 +54,7 @@ class Instagram extends Provider { async download ({ id, token }) { return this.#withErrorHandling('provider.instagram.download.error', async () => { const url = await getMediaUrl({ token, id }) - const stream = got.stream.get(url, { responseType: 'json' }) + const stream = (await got).stream.get(url, { responseType: 'json' }) await prepareStream(stream) return { stream } }) diff --git a/packages/@uppy/companion/src/server/provider/onedrive/index.js b/packages/@uppy/companion/src/server/provider/onedrive/index.js index 46a599ea5f..2d89efaf23 100644 --- a/packages/@uppy/companion/src/server/provider/onedrive/index.js +++ b/packages/@uppy/companion/src/server/provider/onedrive/index.js @@ -1,19 +1,19 @@ -const got = require('got').default - const Provider = require('../Provider') const logger = require('../../logger') const adaptData = require('./adapter') const { withProviderErrorHandling } = require('../providerErrors') const { prepareStream } = require('../../helpers/utils') -const getClient = ({ token }) => got.extend({ +const got = require('../../got') + +const getClient = async ({ token }) => (await got).extend({ prefixUrl: 'https://graph.microsoft.com/v1.0', headers: { authorization: `Bearer ${token}`, }, }) -const getOauthClient = () => got.extend({ +const getOauthClient = async () => (await got).extend({ prefixUrl: 'https://login.live.com', }) @@ -47,7 +47,7 @@ class OneDrive extends Provider { qs.$skiptoken = query.cursor } - const client = getClient({ token }) + const client = await getClient({ token }) const [{ mail, userPrincipalName }, list] = await Promise.all([ client.get('me', { responseType: 'json' }).json(), @@ -60,7 +60,7 @@ class OneDrive extends Provider { async download ({ id, token, query }) { return this.#withErrorHandling('provider.onedrive.download.error', async () => { - const stream = getClient({ token }).stream.get(`${getRootPath(query)}/items/${id}/content`, { responseType: 'json' }) + const stream = (await getClient({ token })).stream.get(`${getRootPath(query)}/items/${id}/content`, { responseType: 'json' }) await prepareStream(stream) return { stream } }) @@ -75,7 +75,7 @@ class OneDrive extends Provider { async size ({ id, query, token }) { return this.#withErrorHandling('provider.onedrive.size.error', async () => { - const { size } = await getClient({ token }).get(`${getRootPath(query)}/items/${id}`, { responseType: 'json' }).json() + const { size } = await (await getClient({ token })).get(`${getRootPath(query)}/items/${id}`, { responseType: 'json' }).json() return size }) } @@ -88,7 +88,7 @@ class OneDrive extends Provider { async refreshToken ({ clientId, clientSecret, refreshToken, redirectUri }) { return this.#withErrorHandling('provider.onedrive.token.refresh.error', async () => { - const { access_token: accessToken } = await getOauthClient().post('oauth20_token.srf', { responseType: 'json', form: { refresh_token: refreshToken, grant_type: 'refresh_token', client_id: clientId, client_secret: clientSecret, redirect_uri: redirectUri } }).json() + const { access_token: accessToken } = await (await getOauthClient()).post('oauth20_token.srf', { responseType: 'json', form: { refresh_token: refreshToken, grant_type: 'refresh_token', client_id: clientId, client_secret: clientSecret, redirect_uri: redirectUri } }).json() return { accessToken } }) } diff --git a/packages/@uppy/companion/src/server/provider/unsplash/index.js b/packages/@uppy/companion/src/server/provider/unsplash/index.js index 1c3147f013..77c0d5c001 100644 --- a/packages/@uppy/companion/src/server/provider/unsplash/index.js +++ b/packages/@uppy/companion/src/server/provider/unsplash/index.js @@ -1,5 +1,3 @@ -const got = require('got').default - const Provider = require('../Provider') const { getURLMeta } = require('../../helpers/request') const adaptData = require('./adapter') @@ -7,9 +5,11 @@ const { withProviderErrorHandling } = require('../providerErrors') const { prepareStream } = require('../../helpers/utils') const { ProviderApiError } = require('../error') +const got = require('../../got') + const BASE_URL = 'https://api.unsplash.com' -const getClient = ({ token }) => got.extend({ +const getClient = async ({ token }) => (await got).extend({ prefixUrl: BASE_URL, headers: { authorization: `Client-ID ${token}`, @@ -31,18 +31,18 @@ class Unsplash extends Provider { const qs = { per_page: 40, query: query.q } if (query.cursor) qs.page = query.cursor - const response = await getClient({ token }).get('search/photos', { searchParams: qs, responseType: 'json' }).json() + const response = await (await getClient({ token })).get('search/photos', { searchParams: qs, responseType: 'json' }).json() return adaptData(response, query) }) } async download ({ id, token }) { return this.#withErrorHandling('provider.unsplash.download.error', async () => { - const client = getClient({ token }) + const client = await getClient({ token }) const { links: { download: url, download_location: attributionUrl } } = await getPhotoMeta(client, id) - const stream = got.stream.get(url, { responseType: 'json' }) + const stream = (await got).stream.get(url, { responseType: 'json' }) await prepareStream(stream) // To attribute the author of the image, we call the `download_location` @@ -57,7 +57,7 @@ class Unsplash extends Provider { async size ({ id, token }) { return this.#withErrorHandling('provider.unsplash.size.error', async () => { - const { links: { download: url } } = await getPhotoMeta(getClient({ token }), id) + const { links: { download: url } } = await getPhotoMeta(await getClient({ token }), id) const { size } = await getURLMeta(url, true) return size }) diff --git a/packages/@uppy/companion/src/server/provider/zoom/index.js b/packages/@uppy/companion/src/server/provider/zoom/index.js index ea0852dda5..7cf2284185 100644 --- a/packages/@uppy/companion/src/server/provider/zoom/index.js +++ b/packages/@uppy/companion/src/server/provider/zoom/index.js @@ -1,4 +1,3 @@ -const got = require('got').default const moment = require('moment-timezone') const Provider = require('../Provider') @@ -6,11 +5,13 @@ const { initializeData, adaptData } = require('./adapter') const { withProviderErrorHandling } = require('../providerErrors') const { prepareStream, getBasicAuthHeader } = require('../../helpers/utils') +const got = require('../../got') + const BASE_URL = 'https://zoom.us/v2' const PAGE_SIZE = 300 const DEAUTH_EVENT_NAME = 'app_deauthorized' -const getClient = ({ token }) => got.extend({ +const getClient = async ({ token }) => (await got).extend({ prefixUrl: BASE_URL, headers: { authorization: `Bearer ${token}`, @@ -44,7 +45,7 @@ class Zoom extends Provider { const { cursor, from, to } = query const meetingId = options.directory || '' - const client = getClient({ token }) + const client = await getClient({ token }) const user = await client.get('users/me', { responseType: 'json' }).json() const { timezone } = user @@ -86,7 +87,7 @@ class Zoom extends Provider { // cc files don't have an ID or size const { recordingStart, recordingId: fileId } = query - const client = getClient({ token }) + const client = await getClient({ token }) const foundFile = await findFile({ client, meetingId, fileId, recordingStart }) const url = foundFile?.download_url @@ -100,7 +101,7 @@ class Zoom extends Provider { async size ({ id: meetingId, token, query }) { return this.#withErrorHandling('provider.zoom.size.error', async () => { - const client = getClient({ token }) + const client = await getClient({ token }) const { recordingStart, recordingId: fileId } = query const foundFile = await findFile({ client, meetingId, fileId, recordingStart }) @@ -113,7 +114,7 @@ class Zoom extends Provider { return this.#withErrorHandling('provider.zoom.logout.error', async () => { const { key, secret } = await companion.getProviderCredentials() - const { status } = await got.post('https://zoom.us/oauth/revoke', { + const { status } = await (await got).post('https://zoom.us/oauth/revoke', { searchParams: { token }, headers: { Authorization: getBasicAuthHeader(key, secret) }, responseType: 'json', @@ -136,7 +137,7 @@ class Zoom extends Provider { return { data: {}, status: 400 } } - await got.post('https://api.zoom.us/oauth/data/compliance', { + await (await got).post('https://api.zoom.us/oauth/data/compliance', { headers: { Authorization: getBasicAuthHeader(key, secret) }, json: { client_id: key, diff --git a/yarn.lock b/yarn.lock index 03b50eae2d..6df1e810e1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7576,28 +7576,28 @@ __metadata: languageName: node linkType: hard -"@sindresorhus/is@npm:^4.0.0": - version: 4.6.0 - resolution: "@sindresorhus/is@npm:4.6.0" - checksum: 83839f13da2c29d55c97abc3bc2c55b250d33a0447554997a85c539e058e57b8da092da396e252b11ec24a0279a0bed1f537fa26302209327060643e327f81d2 +"@sindresorhus/is@npm:^5.2.0": + version: 5.3.0 + resolution: "@sindresorhus/is@npm:5.3.0" + checksum: b31cebabcdece3d5322de2a4dbc8c0f004e04147a00f2606787bcaf5655ad4b1954f6727fc6914c524009b2b9a2cc01c42835b55f651ce69fd2a0083b60bb852 languageName: node linkType: hard -"@sinonjs/commons@npm:^3.0.0": - version: 3.0.0 - resolution: "@sinonjs/commons@npm:3.0.0" +"@sinonjs/commons@npm:^2.0.0": + version: 2.0.0 + resolution: "@sinonjs/commons@npm:2.0.0" dependencies: type-detect: 4.0.8 - checksum: b4b5b73d4df4560fb8c0c7b38c7ad4aeabedd362f3373859d804c988c725889cde33550e4bcc7cd316a30f5152a2d1d43db71b6d0c38f5feef71fd8d016763f8 + checksum: 5023ba17edf2b85ed58262313b8e9b59e23c6860681a9af0200f239fe939e2b79736d04a260e8270ddd57196851dde3ba754d7230be5c5234e777ae2ca8af137 languageName: node linkType: hard "@sinonjs/fake-timers@npm:^10.0.2": - version: 10.3.0 - resolution: "@sinonjs/fake-timers@npm:10.3.0" + version: 10.0.2 + resolution: "@sinonjs/fake-timers@npm:10.0.2" dependencies: - "@sinonjs/commons": ^3.0.0 - checksum: 614d30cb4d5201550c940945d44c9e0b6d64a888ff2cd5b357f95ad6721070d6b8839cd10e15b76bf5e14af0bcc1d8f9ec00d49a46318f1f669a4bec1d7f3148 + "@sinonjs/commons": ^2.0.0 + checksum: c62aa98e7cefda8dedc101ce227abc888dc46b8ff9706c5f0a8dfd9c3ada97d0a5611384738d9ba0b26b59f99c2ba24efece8e779bb08329e9e87358fa309824 languageName: node linkType: hard @@ -7751,12 +7751,12 @@ __metadata: languageName: node linkType: hard -"@szmarczak/http-timer@npm:^4.0.5": - version: 4.0.6 - resolution: "@szmarczak/http-timer@npm:4.0.6" +"@szmarczak/http-timer@npm:^5.0.1": + version: 5.0.1 + resolution: "@szmarczak/http-timer@npm:5.0.1" dependencies: - defer-to-connect: ^2.0.0 - checksum: c29df3bcec6fc3bdec2b17981d89d9c9fc9bd7d0c9bcfe92821dc533f4440bc890ccde79971838b4ceed1921d456973c4180d7175ee1d0023ad0562240a58d95 + defer-to-connect: ^2.0.1 + checksum: fc9cb993e808806692e4a3337c90ece0ec00c89f4b67e3652a356b89730da98bc824273a6d67ca84d5f33cd85f317dcd5ce39d8cc0a2f060145a608a7cb8ce92 languageName: node linkType: hard @@ -7885,18 +7885,6 @@ __metadata: languageName: node linkType: hard -"@types/cacheable-request@npm:^6.0.1": - version: 6.0.2 - resolution: "@types/cacheable-request@npm:6.0.2" - dependencies: - "@types/http-cache-semantics": "*" - "@types/keyv": "*" - "@types/node": "*" - "@types/responselike": "*" - checksum: 667d25808dbf46fe104d6f029e0281ff56058d50c7c1b9182774b3e38bb9c1124f56e4c367ba54f92dbde2d1cc573f26eb0e9748710b2822bc0fd1e5498859c6 - languageName: node - linkType: hard - "@types/caseless@npm:*": version: 0.12.2 resolution: "@types/caseless@npm:0.12.2" @@ -8096,7 +8084,7 @@ __metadata: languageName: node linkType: hard -"@types/http-cache-semantics@npm:*": +"@types/http-cache-semantics@npm:^4.0.1": version: 4.0.1 resolution: "@types/http-cache-semantics@npm:4.0.1" checksum: 1048aacf627829f0d5f00184e16548205cd9f964bf0841c29b36bc504509230c40bc57c39778703a1c965a6f5b416ae2cbf4c1d4589c889d2838dd9dbfccf6e9 @@ -8165,13 +8153,6 @@ __metadata: languageName: node linkType: hard -"@types/json-buffer@npm:~3.0.0": - version: 3.0.0 - resolution: "@types/json-buffer@npm:3.0.0" - checksum: 6b0a371dd603f0eec9d00874574bae195382570e832560dadf2193ee0d1062b8e0694bbae9798bc758632361c227b1e3b19e3bd914043b498640470a2da38b77 - languageName: node - linkType: hard - "@types/json-schema@npm:*, @types/json-schema@npm:^7.0.8, @types/json-schema@npm:^7.0.9": version: 7.0.11 resolution: "@types/json-schema@npm:7.0.11" @@ -8202,15 +8183,6 @@ __metadata: languageName: node linkType: hard -"@types/keyv@npm:*": - version: 3.1.4 - resolution: "@types/keyv@npm:3.1.4" - dependencies: - "@types/node": "*" - checksum: e009a2bfb50e90ca9b7c6e8f648f8464067271fd99116f881073fa6fa76dc8d0133181dd65e6614d5fb1220d671d67b0124aef7d97dc02d7e342ab143a47779d - languageName: node - linkType: hard - "@types/lodash@npm:4.14.191": version: 4.14.191 resolution: "@types/lodash@npm:4.14.191" @@ -8375,15 +8347,6 @@ __metadata: languageName: node linkType: hard -"@types/responselike@npm:*, @types/responselike@npm:^1.0.0": - version: 1.0.0 - resolution: "@types/responselike@npm:1.0.0" - dependencies: - "@types/node": "*" - checksum: e99fc7cc6265407987b30deda54c1c24bb1478803faf6037557a774b2f034c5b097ffd65847daa87e82a61a250d919f35c3588654b0fdaa816906650f596d1b0 - languageName: node - linkType: hard - "@types/retry@npm:0.12.0": version: 0.12.0 resolution: "@types/retry@npm:0.12.0" @@ -9483,7 +9446,7 @@ __metadata: express-request-id: 1.4.1 express-session: 1.17.3 form-data: ^3.0.0 - got: 11 + got: ^12.6.0 grant: 5.4.21 helmet: ^4.6.0 into-stream: ^6.0.0 @@ -12262,25 +12225,25 @@ __metadata: languageName: node linkType: hard -"cacheable-lookup@npm:^5.0.3": - version: 5.0.4 - resolution: "cacheable-lookup@npm:5.0.4" - checksum: 763e02cf9196bc9afccacd8c418d942fc2677f22261969a4c2c2e760fa44a2351a81557bd908291c3921fe9beb10b976ba8fa50c5ca837c5a0dd945f16468f2d +"cacheable-lookup@npm:^7.0.0": + version: 7.0.0 + resolution: "cacheable-lookup@npm:7.0.0" + checksum: 9e2856763fc0a7347ab34d704c010440b819d4bb5e3593b664381b7433e942dd22e67ee5581f12256f908e79b82d30b86ebbacf40a081bfe10ee93fbfbc2d6a9 languageName: node linkType: hard -"cacheable-request@npm:^7.0.2": - version: 7.0.2 - resolution: "cacheable-request@npm:7.0.2" +"cacheable-request@npm:^10.2.8": + version: 10.2.8 + resolution: "cacheable-request@npm:10.2.8" dependencies: - clone-response: ^1.0.2 - get-stream: ^5.1.0 - http-cache-semantics: ^4.0.0 - keyv: ^4.0.0 - lowercase-keys: ^2.0.0 - normalize-url: ^6.0.1 - responselike: ^2.0.0 - checksum: 6152813982945a5c9989cb457a6c499f12edcc7ade323d2fbfd759abc860bdbd1306e08096916bb413c3c47e812f8e4c0a0cc1e112c8ce94381a960f115bc77f + "@types/http-cache-semantics": ^4.0.1 + get-stream: ^6.0.1 + http-cache-semantics: ^4.1.1 + keyv: ^4.5.2 + mimic-response: ^4.0.0 + normalize-url: ^8.0.0 + responselike: ^3.0.0 + checksum: 5b2abf93866ee7219c7c11929f02e4b97a2bf38b6403a0ad3786d3be607293676a10b70bcd8080e103a0f28e0ab4aa4b03a1550c01a08edbf1abf46ef0a9419f languageName: node linkType: hard @@ -12751,15 +12714,6 @@ __metadata: languageName: node linkType: hard -"clone-response@npm:^1.0.2": - version: 1.0.3 - resolution: "clone-response@npm:1.0.3" - dependencies: - mimic-response: ^1.0.0 - checksum: 4e671cac39b11c60aa8ba0a450657194a5d6504df51bca3fac5b3bd0145c4f8e8464898f87c8406b83232e3bc5cca555f51c1f9c8ac023969ebfbf7f6bdabb2e - languageName: node - linkType: hard - "clone@npm:^1.0.2": version: 1.0.4 resolution: "clone@npm:1.0.4" @@ -13004,16 +12958,6 @@ __metadata: languageName: node linkType: hard -"compress-brotli@npm:^1.3.8": - version: 1.3.8 - resolution: "compress-brotli@npm:1.3.8" - dependencies: - "@types/json-buffer": ~3.0.0 - json-buffer: ~3.0.1 - checksum: de7589d692d40eb362f6c91070b5e51bc10b05a89eabb4a7c76c1aa21b625756f8c101c6999e4df0c4dc6199c5ca2e1353573bfdcca5615810f27485394162a5 - languageName: node - linkType: hard - "compressible@npm:~2.0.16": version: 2.0.18 resolution: "compressible@npm:2.0.18" @@ -14035,7 +13979,7 @@ __metadata: languageName: node linkType: hard -"defer-to-connect@npm:^2.0.0": +"defer-to-connect@npm:^2.0.1": version: 2.0.1 resolution: "defer-to-connect@npm:2.0.1" checksum: 8a9b50d2f25446c0bfefb55a48e90afd58f85b21bcf78e9207cd7b804354f6409032a1705c2491686e202e64fc05f147aa5aa45f9aa82627563f045937f5791b @@ -16914,6 +16858,13 @@ __metadata: languageName: node linkType: hard +"form-data-encoder@npm:^2.1.2": + version: 2.1.4 + resolution: "form-data-encoder@npm:2.1.4" + checksum: e0b3e5950fb69b3f32c273944620f9861f1933df9d3e42066e038e26dfb343d0f4465de9f27e0ead1a09d9df20bc2eed06a63c2ca2f8f00949e7202bae9e29dd + languageName: node + linkType: hard + "form-data@npm:^2.5.0": version: 2.5.1 resolution: "form-data@npm:2.5.1" @@ -17684,22 +17635,22 @@ __metadata: languageName: node linkType: hard -"got@npm:11": - version: 11.8.5 - resolution: "got@npm:11.8.5" +"got@npm:^12.6.0": + version: 12.6.0 + resolution: "got@npm:12.6.0" dependencies: - "@sindresorhus/is": ^4.0.0 - "@szmarczak/http-timer": ^4.0.5 - "@types/cacheable-request": ^6.0.1 - "@types/responselike": ^1.0.0 - cacheable-lookup: ^5.0.3 - cacheable-request: ^7.0.2 + "@sindresorhus/is": ^5.2.0 + "@szmarczak/http-timer": ^5.0.1 + cacheable-lookup: ^7.0.0 + cacheable-request: ^10.2.8 decompress-response: ^6.0.0 - http2-wrapper: ^1.0.0-beta.5.2 - lowercase-keys: ^2.0.0 - p-cancelable: ^2.0.0 - responselike: ^2.0.0 - checksum: 2de8a1bbda4e9b6b2b72b2d2100bc055a59adc1740529e631f61feb44a8b9a1f9f8590941ed9da9df0090b6d6d0ed8ffee94cd9ac086ec3409b392b33440f7d2 + form-data-encoder: ^2.1.2 + get-stream: ^6.0.1 + http2-wrapper: ^2.1.10 + lowercase-keys: ^3.0.0 + p-cancelable: ^3.0.0 + responselike: ^3.0.0 + checksum: 3621897067068dcb3578d05535cfb10f60aac07198032b3349a488f5741964e7f63d6e37c976840f1bcaaf42f5c049ed3c6d8e0d6c622b74639ca9319ad178a1 languageName: node linkType: hard @@ -18106,7 +18057,14 @@ __metadata: languageName: node linkType: hard -"http-cache-semantics@npm:^4.0.0, http-cache-semantics@npm:^4.1.0, http-cache-semantics@npm:^4.1.1": +"http-cache-semantics@npm:^4.1.0": + version: 4.1.0 + resolution: "http-cache-semantics@npm:4.1.0" + checksum: 974de94a81c5474be07f269f9fd8383e92ebb5a448208223bfb39e172a9dbc26feff250192ecc23b9593b3f92098e010406b0f24bd4d588d631f80214648ed42 + languageName: node + linkType: hard + +"http-cache-semantics@npm:^4.1.1": version: 4.1.1 resolution: "http-cache-semantics@npm:4.1.1" checksum: 83ac0bc60b17a3a36f9953e7be55e5c8f41acc61b22583060e8dedc9dd5e3607c823a88d0926f9150e571f90946835c7fe150732801010845c72cd8bbff1a236 @@ -18226,13 +18184,13 @@ __metadata: languageName: node linkType: hard -"http2-wrapper@npm:^1.0.0-beta.5.2": - version: 1.0.3 - resolution: "http2-wrapper@npm:1.0.3" +"http2-wrapper@npm:^2.1.10": + version: 2.2.0 + resolution: "http2-wrapper@npm:2.2.0" dependencies: quick-lru: ^5.1.1 - resolve-alpn: ^1.0.0 - checksum: 74160b862ec699e3f859739101ff592d52ce1cb207b7950295bf7962e4aa1597ef709b4292c673bece9c9b300efad0559fc86c71b1409c7a1e02b7229456003e + resolve-alpn: ^1.2.0 + checksum: 6fd20e5cb6a58151715b3581e06a62a47df943187d2d1f69e538a50cccb7175dd334ecfde7900a37d18f3e13a1a199518a2c211f39860e81e9a16210c199cfaa languageName: node linkType: hard @@ -20302,7 +20260,7 @@ __metadata: languageName: node linkType: hard -"json-buffer@npm:3.0.1, json-buffer@npm:~3.0.1": +"json-buffer@npm:3.0.1": version: 3.0.1 resolution: "json-buffer@npm:3.0.1" checksum: 9026b03edc2847eefa2e37646c579300a1f3a4586cfb62bf857832b60c852042d0d6ae55d1afb8926163fa54c2b01d83ae24705f34990348bdac6273a29d4581 @@ -20643,13 +20601,12 @@ __metadata: languageName: node linkType: hard -"keyv@npm:^4.0.0": - version: 4.4.1 - resolution: "keyv@npm:4.4.1" +"keyv@npm:^4.5.2": + version: 4.5.2 + resolution: "keyv@npm:4.5.2" dependencies: - compress-brotli: ^1.3.8 json-buffer: 3.0.1 - checksum: efce046d161381121b727e9d753deeaad4ce06a98db6d68442cf1542a3731a46f461d0834fa1937c6ce7b27c807fe7892d4de3074440f4d3dff01ac4c7b32692 + checksum: 13ad58303acd2261c0d4831b4658451603fd159e61daea2121fcb15feb623e75ee328cded0572da9ca76b7b3ceaf8e614f1806c6b3af5db73c9c35a345259651 languageName: node linkType: hard @@ -21499,10 +21456,10 @@ __metadata: languageName: node linkType: hard -"lowercase-keys@npm:^2.0.0": - version: 2.0.0 - resolution: "lowercase-keys@npm:2.0.0" - checksum: 24d7ebd56ccdf15ff529ca9e08863f3c54b0b9d1edb97a3ae1af34940ae666c01a1e6d200707bce730a8ef76cb57cc10e65f245ecaaf7e6bc8639f2fb460ac23 +"lowercase-keys@npm:^3.0.0": + version: 3.0.0 + resolution: "lowercase-keys@npm:3.0.0" + checksum: 67a3f81409af969bc0c4ca0e76cd7d16adb1e25aa1c197229587eaf8671275c8c067cd421795dbca4c81be0098e4c426a086a05e30de8a9c587b7a13c0c7ccc5 languageName: node linkType: hard @@ -22767,13 +22724,6 @@ __metadata: languageName: node linkType: hard -"mimic-response@npm:^1.0.0": - version: 1.0.1 - resolution: "mimic-response@npm:1.0.1" - checksum: 034c78753b0e622bc03c983663b1cdf66d03861050e0c8606563d149bc2b02d63f62ce4d32be4ab50d0553ae0ffe647fc34d1f5281184c6e1e8cf4d85e8d9823 - languageName: node - linkType: hard - "mimic-response@npm:^3.1.0": version: 3.1.0 resolution: "mimic-response@npm:3.1.0" @@ -22781,6 +22731,13 @@ __metadata: languageName: node linkType: hard +"mimic-response@npm:^4.0.0": + version: 4.0.0 + resolution: "mimic-response@npm:4.0.0" + checksum: 33b804cc961efe206efdb1fca6a22540decdcfce6c14eb5c0c50e5ae9022267ab22ce8f5568b1f7247ba67500fe20d523d81e0e9f009b321ccd9d472e78d1850 + languageName: node + linkType: hard + "min-indent@npm:^1.0.0, min-indent@npm:^1.0.1": version: 1.0.1 resolution: "min-indent@npm:1.0.1" @@ -23872,6 +23829,13 @@ __metadata: languageName: node linkType: hard +"normalize-url@npm:^8.0.0": + version: 8.0.0 + resolution: "normalize-url@npm:8.0.0" + checksum: 24c20b75ebfd526d8453084692720b49d111c63c0911f1b7447427829597841eef5a8ba3f6bb93d6654007b991c1f5cd85da2c907800e439e2e2ec6c2abd0fc0 + languageName: node + linkType: hard + "npm-bundled@npm:^1.1.1": version: 1.1.2 resolution: "npm-bundled@npm:1.1.2" @@ -24611,10 +24575,10 @@ __metadata: languageName: node linkType: hard -"p-cancelable@npm:^2.0.0": - version: 2.1.1 - resolution: "p-cancelable@npm:2.1.1" - checksum: 3dba12b4fb4a1e3e34524535c7858fc82381bbbd0f247cc32dedc4018592a3950ce66b106d0880b4ec4c2d8d6576f98ca885dc1d7d0f274d1370be20e9523ddf +"p-cancelable@npm:^3.0.0": + version: 3.0.0 + resolution: "p-cancelable@npm:3.0.0" + checksum: 2b5ae34218f9c2cf7a7c18e5d9a726ef9b165ef07e6c959f6738371509e747334b5f78f3bcdeb03d8a12dcb978faf641fd87eb21486ed7d36fb823b8ddef3219 languageName: node linkType: hard @@ -26246,9 +26210,9 @@ __metadata: linkType: hard "pure-rand@npm:^6.0.0": - version: 6.0.2 - resolution: "pure-rand@npm:6.0.2" - checksum: 79de33876a4f515d759c48e98d00756bbd916b4ea260cc572d7adfa4b62cace9952e89f0241d0410214554503d25061140fe325c66f845213d2b1728ba8d413e + version: 6.0.1 + resolution: "pure-rand@npm:6.0.1" + checksum: 4bb565399993b815658a72e359f574ce4f04827a42a905105d61163ae86f456d91595a0e4241e7bce04328fae0638ae70ac0428d93ecb55971c465bd084f8648 languageName: node linkType: hard @@ -27337,7 +27301,7 @@ __metadata: languageName: node linkType: hard -"resolve-alpn@npm:^1.0.0": +"resolve-alpn@npm:^1.2.0": version: 1.2.1 resolution: "resolve-alpn@npm:1.2.1" checksum: f558071fcb2c60b04054c99aebd572a2af97ef64128d59bef7ab73bd50d896a222a056de40ffc545b633d99b304c259ea9d0c06830d5c867c34f0bfa60b8eae0 @@ -27395,9 +27359,9 @@ __metadata: linkType: hard "resolve.exports@npm:^2.0.0": - version: 2.0.2 - resolution: "resolve.exports@npm:2.0.2" - checksum: 1c7778ca1b86a94f8ab4055d196c7d87d1874b96df4d7c3e67bbf793140f0717fd506dcafd62785b079cd6086b9264424ad634fb904409764c3509c3df1653f2 + version: 2.0.1 + resolution: "resolve.exports@npm:2.0.1" + checksum: 03be177026b4fe8dc1b2ffb421bce9cbf7fe3446e9f0c958df9fc8e144864b3eeea19fe788e057fd8be6b5655e65ce245b4f379258c1336e2e8f9205cbd4a9b4 languageName: node linkType: hard @@ -27479,12 +27443,12 @@ __metadata: languageName: node linkType: hard -"responselike@npm:^2.0.0": - version: 2.0.1 - resolution: "responselike@npm:2.0.1" +"responselike@npm:^3.0.0": + version: 3.0.0 + resolution: "responselike@npm:3.0.0" dependencies: - lowercase-keys: ^2.0.0 - checksum: b122535466e9c97b55e69c7f18e2be0ce3823c5d47ee8de0d9c0b114aa55741c6db8bfbfce3766a94d1272e61bfb1ebf0a15e9310ac5629fbb7446a861b4fd3a + lowercase-keys: ^3.0.0 + checksum: e0cc9be30df4f415d6d83cdede3c5c887cd4a73e7cc1708bcaab1d50a28d15acb68460ac5b02bcc55a42f3d493729c8856427dcf6e57e6e128ad05cba4cfb95e languageName: node linkType: hard From dd6757fc163b4b9376098966078ade54c665d1f3 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 28 Mar 2024 11:05:20 +0100 Subject: [PATCH 03/29] Upgrade to Got 13 and bump various packages --- packages/@uppy/companion/package.json | 19 +- .../src/server/controllers/connect.js | 1 - .../src/server/helpers/oauth-state.js | 1 - .../src/server/provider/credentials.js | 1 - yarn.lock | 347 +++++++++++------- 5 files changed, 225 insertions(+), 144 deletions(-) diff --git a/packages/@uppy/companion/package.json b/packages/@uppy/companion/package.json index 4283bf905b..493a4e9cbb 100644 --- a/packages/@uppy/companion/package.json +++ b/packages/@uppy/companion/package.json @@ -33,11 +33,10 @@ "@aws-sdk/lib-storage": "^3.338.0", "@aws-sdk/s3-presigned-post": "^3.338.0", "@aws-sdk/s3-request-presigner": "^3.338.0", - "atob": "2.1.2", - "body-parser": "1.20.0", + "body-parser": "1.20.2", "chalk": "4.1.2", "common-tags": "1.8.2", - "connect-redis": "7.1.0", + "connect-redis": "7.1.1", "content-disposition": "^0.5.4", "cookie-parser": "1.4.6", "cors": "^2.8.5", @@ -48,26 +47,26 @@ "express-prom-bundle": "6.5.0", "express-request-id": "1.4.1", "express-session": "1.17.3", - "form-data": "^3.0.0", - "got": "^12.6.0", - "grant": "5.4.21", + "form-data": "^4.0.0", + "got": "^13.0.0", + "grant": "5.4.22", "helmet": "^4.6.0", "ipaddr.js": "^2.0.1", - "jsonwebtoken": "9.0.0", + "jsonwebtoken": "9.0.2", "lodash": "^4.17.21", "mime-types": "2.1.35", "moment": "^2.29.2", "moment-timezone": "^0.5.31", "morgan": "1.10.0", "ms": "2.1.3", - "node-schedule": "2.1.0", + "node-schedule": "2.1.1", "prom-client": "14.0.1", - "redis": "4.2.0", + "redis": "4.6.13", "serialize-error": "^2.1.0", "serialize-javascript": "^6.0.0", "tus-js-client": "^3.1.3", "validator": "^13.0.0", - "ws": "8.8.1" + "ws": "8.16.0" }, "devDependencies": { "@types/compression": "1.7.0", diff --git a/packages/@uppy/companion/src/server/controllers/connect.js b/packages/@uppy/companion/src/server/controllers/connect.js index 7018e18e38..01506dc197 100644 --- a/packages/@uppy/companion/src/server/controllers/connect.js +++ b/packages/@uppy/companion/src/server/controllers/connect.js @@ -1,4 +1,3 @@ -const atob = require('atob') const oAuthState = require('../helpers/oauth-state') const queryString = (params, prefix = '?') => { diff --git a/packages/@uppy/companion/src/server/helpers/oauth-state.js b/packages/@uppy/companion/src/server/helpers/oauth-state.js index 4a7d1a9b9c..a42438c6e4 100644 --- a/packages/@uppy/companion/src/server/helpers/oauth-state.js +++ b/packages/@uppy/companion/src/server/helpers/oauth-state.js @@ -1,5 +1,4 @@ const crypto = require('node:crypto') -const atob = require('atob') const { encrypt, decrypt } = require('./utils') module.exports.encodeState = (state, secret) => { diff --git a/packages/@uppy/companion/src/server/provider/credentials.js b/packages/@uppy/companion/src/server/provider/credentials.js index 16f1c58f80..166327fdd3 100644 --- a/packages/@uppy/companion/src/server/provider/credentials.js +++ b/packages/@uppy/companion/src/server/provider/credentials.js @@ -1,4 +1,3 @@ -const atob = require('atob') const { htmlEscape } = require('escape-goat') const logger = require('../logger') const oAuthState = require('../helpers/oauth-state') diff --git a/yarn.lock b/yarn.lock index 6df1e810e1..2980818efc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7050,59 +7050,59 @@ __metadata: languageName: node linkType: hard -"@redis/bloom@npm:1.0.2": - version: 1.0.2 - resolution: "@redis/bloom@npm:1.0.2" +"@redis/bloom@npm:1.2.0": + version: 1.2.0 + resolution: "@redis/bloom@npm:1.2.0" peerDependencies: "@redis/client": ^1.0.0 - checksum: 4872e7e5e4ff03d63349ca88d3164d487f62805651ada91924de2592995993401c98a01cb93bff8d71e9a2e54985b2485b6cb0e084a7e8b1283e2ebb8bc4b833 + checksum: 8c214227287d6b278109098bca00afc601cf84f7da9c6c24f4fa7d3854b946170e5893aa86ed607ba017a4198231d570541c79931b98b6d50b262971022d1d6c languageName: node linkType: hard -"@redis/client@npm:1.2.0": - version: 1.2.0 - resolution: "@redis/client@npm:1.2.0" +"@redis/client@npm:1.5.14": + version: 1.5.14 + resolution: "@redis/client@npm:1.5.14" dependencies: - cluster-key-slot: 1.1.0 - generic-pool: 3.8.2 + cluster-key-slot: 1.1.2 + generic-pool: 3.9.0 yallist: 4.0.0 - checksum: 098a550a6728d9d3babb432a1c32f1678cbda5ad7fa3d59316fc334be42ef05d778fc4cf2e3d873a34817447870a5fc0486e62793698a279404b3b086ba7422e + checksum: f401997c6df92055c1a59385ed2fed7ee9295860f39935821107ea2570f76168dd1b25b71a3b37b9bbfaba26a9d18080d6bcd101a4bfc3852f72cc20576c6e7d languageName: node linkType: hard -"@redis/graph@npm:1.0.1": - version: 1.0.1 - resolution: "@redis/graph@npm:1.0.1" +"@redis/graph@npm:1.1.1": + version: 1.1.1 + resolution: "@redis/graph@npm:1.1.1" peerDependencies: "@redis/client": ^1.0.0 - checksum: 72e485efa416bdff10420f6e13c9cb4e1e5c70752e5172717adf62fc1d4d9ba12e708229fd87876f3a93270ff74c4bcd4d916987438dc36a94f7f12c9785fa44 + checksum: caf9b9a3ff82a08ae543c356a3fed548399ae79aba5ed08ce6cf1b522b955eb5cee4406b0ed0c6899345f8fbc06dfd6cd51304ae8422c3ebbc468f53294dc509 languageName: node linkType: hard -"@redis/json@npm:1.0.3": - version: 1.0.3 - resolution: "@redis/json@npm:1.0.3" +"@redis/json@npm:1.0.6": + version: 1.0.6 + resolution: "@redis/json@npm:1.0.6" peerDependencies: "@redis/client": ^1.0.0 - checksum: 26a7003c2fbacfa5998671e3a301cb2285432bf90f237adedcf76c0be0d379528e6710d469a8ea93c04bbd22951f9c2f41d460dbd79e85856f199248c4a250d5 + checksum: 9fda29abc339c72593f34a23f8023b715c1f8f3d73f7c59889af02f25589bac2ad57073ad08d0b8da42cd8c258665a7b38d39e761e92945cc27aca651c8a93a5 languageName: node linkType: hard -"@redis/search@npm:1.0.6": - version: 1.0.6 - resolution: "@redis/search@npm:1.0.6" +"@redis/search@npm:1.1.6": + version: 1.1.6 + resolution: "@redis/search@npm:1.1.6" peerDependencies: "@redis/client": ^1.0.0 - checksum: 5c776143520b11ae2e49a05e7fe3df514a01460f2be90759b15e4f097bf4a985784c48c2184ac2c275ced3ec5a0c77b208a4d46a50161d1ad6025e3ab2990aa7 + checksum: 0d87e6a9e40e62e46064ccfccca9a5ba7ce608890740415008acb1e83a02690edf37ac1ee878bcc0702d30a2eeba7776e7b467b71f87d8e7b278f38637161e16 languageName: node linkType: hard -"@redis/time-series@npm:1.0.3": - version: 1.0.3 - resolution: "@redis/time-series@npm:1.0.3" +"@redis/time-series@npm:1.0.5": + version: 1.0.5 + resolution: "@redis/time-series@npm:1.0.5" peerDependencies: "@redis/client": ^1.0.0 - checksum: 4d11518185dd15f31c5b4a433902e53a3ebc24614a0221080ab12abf4f6fc60b3db00a71a83de7b4b10f11077de611dc1c273274573646d63481d40ca246f82d + checksum: 6bbdb0b793dcbd13518aa60a09a980f953554e4c745bfacc1611baa8098f360e0378e8ee6b7faf600a67f1de83f4b68bbec6f95a0740faee6164c14be3a30752 languageName: node linkType: hard @@ -9430,11 +9430,10 @@ __metadata: "@types/request": 2.48.8 "@types/webpack": ^5.28.0 "@types/ws": 8.5.3 - atob: 2.1.2 - body-parser: 1.20.0 + body-parser: 1.20.2 chalk: 4.1.2 common-tags: 1.8.2 - connect-redis: 7.1.0 + connect-redis: 7.1.1 content-disposition: ^0.5.4 cookie-parser: 1.4.6 cors: ^2.8.5 @@ -9445,14 +9444,14 @@ __metadata: express-prom-bundle: 6.5.0 express-request-id: 1.4.1 express-session: 1.17.3 - form-data: ^3.0.0 - got: ^12.6.0 - grant: 5.4.21 + form-data: ^4.0.0 + got: ^13.0.0 + grant: 5.4.22 helmet: ^4.6.0 into-stream: ^6.0.0 ipaddr.js: ^2.0.1 jest: ^29.0.0 - jsonwebtoken: 9.0.0 + jsonwebtoken: 9.0.2 lodash: ^4.17.21 mime-types: 2.1.35 moment: ^2.29.2 @@ -9460,16 +9459,16 @@ __metadata: morgan: 1.10.0 ms: 2.1.3 nock: ^13.1.3 - node-schedule: 2.1.0 + node-schedule: 2.1.1 prom-client: 14.0.1 - redis: 4.2.0 + redis: 4.6.13 serialize-error: ^2.1.0 serialize-javascript: ^6.0.0 supertest: 6.2.4 tus-js-client: ^3.1.3 typescript: ~5.4 validator: ^13.0.0 - ws: 8.8.1 + ws: 8.16.0 bin: companion: ./bin/companion languageName: unknown @@ -11374,7 +11373,7 @@ __metadata: languageName: node linkType: hard -"atob@npm:2.1.2, atob@npm:^2.1.2": +"atob@npm:^2.1.2": version: 2.1.2 resolution: "atob@npm:2.1.2" bin: @@ -11916,6 +11915,26 @@ __metadata: languageName: node linkType: hard +"body-parser@npm:1.20.2": + version: 1.20.2 + resolution: "body-parser@npm:1.20.2" + dependencies: + bytes: 3.1.2 + content-type: ~1.0.5 + debug: 2.6.9 + depd: 2.0.0 + destroy: 1.2.0 + http-errors: 2.0.0 + iconv-lite: 0.4.24 + on-finished: 2.4.1 + qs: 6.11.0 + raw-body: 2.5.2 + type-is: ~1.6.18 + unpipe: 1.0.0 + checksum: 14d37ec638ab5c93f6099ecaed7f28f890d222c650c69306872e00b9efa081ff6c596cd9afb9930656aae4d6c4e1c17537bea12bb73c87a217cb3cfea8896737 + languageName: node + linkType: hard + "bonjour-service@npm:^1.0.11": version: 1.0.14 resolution: "bonjour-service@npm:1.0.14" @@ -12728,10 +12747,10 @@ __metadata: languageName: node linkType: hard -"cluster-key-slot@npm:1.1.0": - version: 1.1.0 - resolution: "cluster-key-slot@npm:1.1.0" - checksum: fc953c75209b1ef9088081bab4e40a0b2586491c974ab93460569c014515ca5a2e31c043f185285e177007162fc353d07836d98f570c171dbe055775430e495b +"cluster-key-slot@npm:1.1.2": + version: 1.1.2 + resolution: "cluster-key-slot@npm:1.1.2" + checksum: be0ad2d262502adc998597e83f9ded1b80f827f0452127c5a37b22dfca36bab8edf393f7b25bb626006fb9fb2436106939ede6d2d6ecf4229b96a47f27edd681 languageName: node linkType: hard @@ -13056,12 +13075,12 @@ __metadata: languageName: node linkType: hard -"connect-redis@npm:7.1.0": - version: 7.1.0 - resolution: "connect-redis@npm:7.1.0" +"connect-redis@npm:7.1.1": + version: 7.1.1 + resolution: "connect-redis@npm:7.1.1" peerDependencies: express-session: ">=1" - checksum: fb493fae8910a2d61e3babd579c6344c56d7d31d67669d9941465ef00eb54ef9c1a35ccfa761136d36fa38d1f82ebe48c2b10888f292d55b4aadb8ecf1fddf34 + checksum: ac91ee818d0f467866b6982f66b3423fee58de9da3562618f6d1df2ddeea426354c1efe70b3f799be1b52e3cc67f2043b9ae203678fd3ff9db5dff44b078f0ca languageName: node linkType: hard @@ -13125,6 +13144,13 @@ __metadata: languageName: node linkType: hard +"content-type@npm:~1.0.5": + version: 1.0.5 + resolution: "content-type@npm:1.0.5" + checksum: 566271e0a251642254cde0f845f9dd4f9856e52d988f4eb0d0dcffbb7a1f8ec98de7a5215fc628f3bce30fe2fb6fd2bc064b562d721658c59b544e2d34ea2766 + languageName: node + linkType: hard + "convert-source-map@npm:^1.5.1, convert-source-map@npm:^1.6.0, convert-source-map@npm:^1.7.0": version: 1.8.0 resolution: "convert-source-map@npm:1.8.0" @@ -13158,10 +13184,10 @@ __metadata: languageName: node linkType: hard -"cookie-signature@npm:^1.1.0": - version: 1.2.0 - resolution: "cookie-signature@npm:1.2.0" - checksum: d11f56f909733695d989511bf0e1dd874220d818b9d118945dce3c275fa50adfb3f6984354de0f5eefdc9347951a22ba3545230a762576019d23c16055b12d4c +"cookie-signature@npm:^1.2.1": + version: 1.2.1 + resolution: "cookie-signature@npm:1.2.1" + checksum: bb464aacac390b5d7d8ead2d6fff7c1c3b7378c7d0250921f48923fe889688e081ab33950448929db5f24d4f9f1506589a7ee1c685de8f12a3fdb30c49667ec5 languageName: node linkType: hard @@ -13172,14 +13198,14 @@ __metadata: languageName: node linkType: hard -"cookie@npm:0.4.2, cookie@npm:^0.4.1, cookie@npm:~0.4.1": +"cookie@npm:0.4.2, cookie@npm:~0.4.1": version: 0.4.2 resolution: "cookie@npm:0.4.2" checksum: a00833c998bedf8e787b4c342defe5fa419abd96b32f4464f718b91022586b8f1bafbddd499288e75c037642493c83083da426c6a9080d309e3bd90fd11baa9b languageName: node linkType: hard -"cookie@npm:0.5.0": +"cookie@npm:0.5.0, cookie@npm:^0.5.0": version: 0.5.0 resolution: "cookie@npm:0.5.0" checksum: 1f4bd2ca5765f8c9689a7e8954183f5332139eb72b6ff783d8947032ec1fdf43109852c178e21a953a30c0dd42257828185be01b49d1eb1a67fd054ca588a180 @@ -13362,13 +13388,12 @@ __metadata: languageName: node linkType: hard -"cron-parser@npm:^3.5.0": - version: 3.5.0 - resolution: "cron-parser@npm:3.5.0" +"cron-parser@npm:^4.2.0": + version: 4.9.0 + resolution: "cron-parser@npm:4.9.0" dependencies: - is-nan: ^1.3.2 - luxon: ^1.26.0 - checksum: 80096ac1c30fa4017648ad2fa062ae002e6c0d7775b96a00dbadf1e2d7f9e01b3db0324eef2a33fe6136363be3ffb0d6065cf1b91e6a13fd5ed4d3c168abbc69 + luxon: ^3.2.1 + checksum: 3cf248fc5cae6c19ec7124962b1cd84b76f02b9bc4f58976b3bd07624db3ef10aaf1548efcc2d2dcdab0dad4f12029d640a55ecce05ea5e1596af9db585502cf languageName: node linkType: hard @@ -16876,17 +16901,6 @@ __metadata: languageName: node linkType: hard -"form-data@npm:^3.0.0": - version: 3.0.1 - resolution: "form-data@npm:3.0.1" - dependencies: - asynckit: ^0.4.0 - combined-stream: ^1.0.8 - mime-types: ^2.1.12 - checksum: b019e8d35c8afc14a2bd8a7a92fa4f525a4726b6d5a9740e8d2623c30e308fbb58dc8469f90415a856698933c8479b01646a9dff33c87cc4e76d72aedbbf860d - languageName: node - linkType: hard - "form-data@npm:^4.0.0": version: 4.0.0 resolution: "form-data@npm:4.0.0" @@ -17219,10 +17233,10 @@ __metadata: languageName: node linkType: hard -"generic-pool@npm:3.8.2": - version: 3.8.2 - resolution: "generic-pool@npm:3.8.2" - checksum: f549077d90265e5e4d32a2410205b357ec61cf73d17861f1013637984390e09fe7bf537129a2c6ed30ae57662a57c8d54194f80046408d3349836330f422dbde +"generic-pool@npm:3.9.0": + version: 3.9.0 + resolution: "generic-pool@npm:3.9.0" + checksum: 3d89e9b2018d2e3bbf44fec78c76b2b7d56d6a484237aa9daf6ff6eedb14b0899dadd703b5d810219baab2eb28e5128fb18b29e91e602deb2eccac14492d8ca8 languageName: node linkType: hard @@ -17635,9 +17649,9 @@ __metadata: languageName: node linkType: hard -"got@npm:^12.6.0": - version: 12.6.0 - resolution: "got@npm:12.6.0" +"got@npm:^13.0.0": + version: 13.0.0 + resolution: "got@npm:13.0.0" dependencies: "@sindresorhus/is": ^5.2.0 "@szmarczak/http-timer": ^5.0.1 @@ -17650,7 +17664,7 @@ __metadata: lowercase-keys: ^3.0.0 p-cancelable: ^3.0.0 responselike: ^3.0.0 - checksum: 3621897067068dcb3578d05535cfb10f60aac07198032b3349a488f5741964e7f63d6e37c976840f1bcaaf42f5c049ed3c6d8e0d6c622b74639ca9319ad178a1 + checksum: bcae6601efd710bc6c5b454c5e44bcb16fcfe57a1065e2d61ff918c1d69c3cf124984ebf509ca64ed10f0da2d2b5531b77da05aa786e75849d084fb8fbea711b languageName: node linkType: hard @@ -17661,16 +17675,16 @@ __metadata: languageName: node linkType: hard -"grant@npm:5.4.21": - version: 5.4.21 - resolution: "grant@npm:5.4.21" +"grant@npm:5.4.22": + version: 5.4.22 + resolution: "grant@npm:5.4.22" dependencies: - cookie: ^0.4.1 - cookie-signature: ^1.1.0 + cookie: ^0.5.0 + cookie-signature: ^1.2.1 jwk-to-pem: ^2.0.5 jws: ^4.0.0 - qs: ^6.10.2 - request-compose: ^2.1.4 + qs: ^6.11.2 + request-compose: ^2.1.6 request-oauth: ^1.0.1 dependenciesMeta: cookie: @@ -17681,7 +17695,7 @@ __metadata: optional: true jws: optional: true - checksum: 06e36704cc06da824c4d9458c14aa8c7c6764d58054defc061901efd90e14498f2bfb9b472401d8b70308ac061ccf6fbbbafae5493098359ec94491261c59f2b + checksum: 148f688e9427b225ccb0638faa8ca9b3e57906cb3e6cb1f4f4eb9f5de74df6f3ee70cf4423f59068b6b1ce5644a935efed12cc64b8cb6bcf4d0d51f2bf0cff56 languageName: node linkType: hard @@ -19014,16 +19028,6 @@ __metadata: languageName: node linkType: hard -"is-nan@npm:^1.3.2": - version: 1.3.2 - resolution: "is-nan@npm:1.3.2" - dependencies: - call-bind: ^1.0.0 - define-properties: ^1.1.3 - checksum: 5dfadcef6ad12d3029d43643d9800adbba21cf3ce2ec849f734b0e14ee8da4070d82b15fdb35138716d02587c6578225b9a22779cab34888a139cc43e4e3610a - languageName: node - linkType: hard - "is-negative-zero@npm:^2.0.2": version: 2.0.2 resolution: "is-negative-zero@npm:2.0.2" @@ -20426,15 +20430,21 @@ __metadata: languageName: node linkType: hard -"jsonwebtoken@npm:9.0.0": - version: 9.0.0 - resolution: "jsonwebtoken@npm:9.0.0" +"jsonwebtoken@npm:9.0.2": + version: 9.0.2 + resolution: "jsonwebtoken@npm:9.0.2" dependencies: jws: ^3.2.2 - lodash: ^4.17.21 + lodash.includes: ^4.3.0 + lodash.isboolean: ^3.0.3 + lodash.isinteger: ^4.0.4 + lodash.isnumber: ^3.0.3 + lodash.isplainobject: ^4.0.6 + lodash.isstring: ^4.0.1 + lodash.once: ^4.0.0 ms: ^2.1.1 - semver: ^7.3.8 - checksum: b9181cecf9df99f1dc0253f91ba000a1aa4d91f5816d1608c0dba61a5623726a0bfe200b51df25de18c1a6000825d231ad7ce2788aa54fd48dcb760ad9eb9514 + semver: ^7.5.4 + checksum: fc739a6a8b33f1974f9772dca7f8493ca8df4cc31c5a09dcfdb7cff77447dcf22f4236fb2774ef3fe50df0abeb8e1c6f4c41eba82f500a804ab101e2fbc9d61a languageName: node linkType: hard @@ -21234,6 +21244,20 @@ __metadata: languageName: node linkType: hard +"lodash.includes@npm:^4.3.0": + version: 4.3.0 + resolution: "lodash.includes@npm:4.3.0" + checksum: 71092c130515a67ab3bd928f57f6018434797c94def7f46aafa417771e455ce3a4834889f4267b17887d7f75297dfabd96231bf704fd2b8c5096dc4a913568b6 + languageName: node + linkType: hard + +"lodash.isboolean@npm:^3.0.3": + version: 3.0.3 + resolution: "lodash.isboolean@npm:3.0.3" + checksum: b70068b4a8b8837912b54052557b21fc4774174e3512ed3c5b94621e5aff5eb6c68089d0a386b7e801d679cd105d2e35417978a5e99071750aa2ed90bffd0250 + languageName: node + linkType: hard + "lodash.isequal@npm:^4.5.0": version: 4.5.0 resolution: "lodash.isequal@npm:4.5.0" @@ -21241,6 +21265,27 @@ __metadata: languageName: node linkType: hard +"lodash.isinteger@npm:^4.0.4": + version: 4.0.4 + resolution: "lodash.isinteger@npm:4.0.4" + checksum: 6034821b3fc61a2ffc34e7d5644bb50c5fd8f1c0121c554c21ac271911ee0c0502274852845005f8651d51e199ee2e0cfebfe40aaa49c7fe617f603a8a0b1691 + languageName: node + linkType: hard + +"lodash.isnumber@npm:^3.0.3": + version: 3.0.3 + resolution: "lodash.isnumber@npm:3.0.3" + checksum: 913784275b565346255e6ae6a6e30b760a0da70abc29f3e1f409081585875105138cda4a429ff02577e1bc0a7ae2a90e0a3079a37f3a04c3d6c5aaa532f4cab2 + languageName: node + linkType: hard + +"lodash.isplainobject@npm:^4.0.6": + version: 4.0.6 + resolution: "lodash.isplainobject@npm:4.0.6" + checksum: 29c6351f281e0d9a1d58f1a4c8f4400924b4c79f18dfc4613624d7d54784df07efaff97c1ff2659f3e085ecf4fff493300adc4837553104cef2634110b0d5337 + languageName: node + linkType: hard + "lodash.isstring@npm:^4.0.1": version: 4.0.1 resolution: "lodash.isstring@npm:4.0.1" @@ -21276,7 +21321,7 @@ __metadata: languageName: node linkType: hard -"lodash.once@npm:^4.1.1": +"lodash.once@npm:^4.0.0, lodash.once@npm:^4.1.1": version: 4.1.1 resolution: "lodash.once@npm:4.1.1" checksum: d768fa9f9b4e1dc6453be99b753906f58990e0c45e7b2ca5a3b40a33111e5d17f6edf2f768786e2716af90a8e78f8f91431ab8435f761fef00f9b0c256f6d245 @@ -21512,10 +21557,10 @@ __metadata: languageName: node linkType: hard -"luxon@npm:^1.26.0": - version: 1.28.1 - resolution: "luxon@npm:1.28.1" - checksum: 2c62999adea79645fd1e931d685f61aeb33eda7f39fbf79b84261a233b62f9590f48336654ee9efd405848bd9e13dc7fe087c701b7126187201a88998dc68b04 +"luxon@npm:^3.2.1": + version: 3.4.4 + resolution: "luxon@npm:3.4.4" + checksum: 36c1f99c4796ee4bfddf7dc94fa87815add43ebc44c8934c924946260a58512f0fd2743a629302885df7f35ccbd2d13f178c15df046d0e3b6eb71db178f1c60c languageName: node linkType: hard @@ -23662,14 +23707,14 @@ __metadata: languageName: node linkType: hard -"node-schedule@npm:2.1.0": - version: 2.1.0 - resolution: "node-schedule@npm:2.1.0" +"node-schedule@npm:2.1.1": + version: 2.1.1 + resolution: "node-schedule@npm:2.1.1" dependencies: - cron-parser: ^3.5.0 + cron-parser: ^4.2.0 long-timeout: 0.1.1 sorted-array-functions: ^1.3.0 - checksum: e457e76e633ed551e384ab2404628f0980bd3263057665dd3166a72b0eaca093cd57e42e144f9241b913383c1c58c633d3c782580009cbd51b1b9e2623193d52 + checksum: 6a8822b16fb024277c42efe710bdb35b6f1f6ab3a2f826283640511247d693f34ebd5ddf2863cd91609e7f323574e36c81cd2084dc204fa521f931380f0f963f languageName: node linkType: hard @@ -24223,6 +24268,13 @@ __metadata: languageName: node linkType: hard +"object-inspect@npm:^1.13.1": + version: 1.13.1 + resolution: "object-inspect@npm:1.13.1" + checksum: 7d9fa9221de3311dcb5c7c307ee5dc011cdd31dc43624b7c184b3840514e118e05ef0002be5388304c416c0eb592feb46e983db12577fc47e47d5752fbbfb61f + languageName: node + linkType: hard + "object-is@npm:^1.1.5": version: 1.1.5 resolution: "object-is@npm:1.1.5" @@ -26248,6 +26300,15 @@ __metadata: languageName: node linkType: hard +"qs@npm:6.11.0, qs@npm:^6.10.3, qs@npm:^6.9.6": + version: 6.11.0 + resolution: "qs@npm:6.11.0" + dependencies: + side-channel: ^1.0.4 + checksum: 6e1f29dd5385f7488ec74ac7b6c92f4d09a90408882d0c208414a34dd33badc1a621019d4c799a3df15ab9b1d0292f97c1dd71dc7c045e69f81a8064e5af7297 + languageName: node + linkType: hard + "qs@npm:6.9.3": version: 6.9.3 resolution: "qs@npm:6.9.3" @@ -26255,12 +26316,12 @@ __metadata: languageName: node linkType: hard -"qs@npm:^6.10.2, qs@npm:^6.10.3, qs@npm:^6.9.6": - version: 6.11.0 - resolution: "qs@npm:6.11.0" +"qs@npm:^6.11.2": + version: 6.12.0 + resolution: "qs@npm:6.12.0" dependencies: - side-channel: ^1.0.4 - checksum: 6e1f29dd5385f7488ec74ac7b6c92f4d09a90408882d0c208414a34dd33badc1a621019d4c799a3df15ab9b1d0292f97c1dd71dc7c045e69f81a8064e5af7297 + side-channel: ^1.0.6 + checksum: ba007fb2488880b9c6c3df356fe6888b9c1f4c5127552edac214486cfe83a332de09a5c40d490d79bb27bef977ba1085a8497512ff52eaac72e26564f77ce908 languageName: node linkType: hard @@ -26334,6 +26395,18 @@ __metadata: languageName: node linkType: hard +"raw-body@npm:2.5.2": + version: 2.5.2 + resolution: "raw-body@npm:2.5.2" + dependencies: + bytes: 3.1.2 + http-errors: 2.0.0 + iconv-lite: 0.4.24 + unpipe: 1.0.0 + checksum: ba1583c8d8a48e8fbb7a873fdbb2df66ea4ff83775421bfe21ee120140949ab048200668c47d9ae3880012f6e217052690628cf679ddfbd82c9fc9358d574676 + languageName: node + linkType: hard + "react-devtools-core@npm:^4.6.0": version: 4.28.4 resolution: "react-devtools-core@npm:4.28.4" @@ -26721,17 +26794,17 @@ __metadata: languageName: node linkType: hard -"redis@npm:4.2.0": - version: 4.2.0 - resolution: "redis@npm:4.2.0" +"redis@npm:4.6.13": + version: 4.6.13 + resolution: "redis@npm:4.6.13" dependencies: - "@redis/bloom": 1.0.2 - "@redis/client": 1.2.0 - "@redis/graph": 1.0.1 - "@redis/json": 1.0.3 - "@redis/search": 1.0.6 - "@redis/time-series": 1.0.3 - checksum: 6c35b56c6b685e82973c5698c5736c07ccbc59f3bc18d8de61e45ead2df4b8fc82062e5618452f4d3f8c23f02ff8c0b847c8d6a681f909c403a0fb96adcc2b98 + "@redis/bloom": 1.2.0 + "@redis/client": 1.5.14 + "@redis/graph": 1.1.1 + "@redis/json": 1.0.6 + "@redis/search": 1.1.6 + "@redis/time-series": 1.0.5 + checksum: 10150ec30f1f89e47cec41c27dc77a99c78a0b078735de4fc9b79c2a779787d52274c64c52004af161b95b9729067671a4cfca95257719968accb30057856a09 languageName: node linkType: hard @@ -27211,7 +27284,7 @@ __metadata: languageName: node linkType: hard -"request-compose@npm:^2.1.4": +"request-compose@npm:^2.1.6": version: 2.1.6 resolution: "request-compose@npm:2.1.6" checksum: cf43642a5b7821f90f7101bdf69ae8f32dcc81d1724790736f7852cada8df81fbafb055d3f2e3b9cf77c4d1113985c0c9b3fa4024ac4038571f1c60ecba6f19a @@ -28457,6 +28530,18 @@ __metadata: languageName: node linkType: hard +"side-channel@npm:^1.0.6": + version: 1.0.6 + resolution: "side-channel@npm:1.0.6" + dependencies: + call-bind: ^1.0.7 + es-errors: ^1.3.0 + get-intrinsic: ^1.2.4 + object-inspect: ^1.13.1 + checksum: bfc1afc1827d712271453e91b7cd3878ac0efd767495fd4e594c4c2afaa7963b7b510e249572bfd54b0527e66e4a12b61b80c061389e129755f34c493aad9b97 + languageName: node + linkType: hard + "siginfo@npm:^2.0.0": version: 2.0.0 resolution: "siginfo@npm:2.0.0" @@ -32351,18 +32436,18 @@ __metadata: languageName: node linkType: hard -"ws@npm:8.8.1": - version: 8.8.1 - resolution: "ws@npm:8.8.1" +"ws@npm:8.16.0": + version: 8.16.0 + resolution: "ws@npm:8.16.0" peerDependencies: bufferutil: ^4.0.1 - utf-8-validate: ^5.0.2 + utf-8-validate: ">=5.0.2" peerDependenciesMeta: bufferutil: optional: true utf-8-validate: optional: true - checksum: 2152cf862cae0693f3775bc688a6afb2e989d19d626d215e70f5fcd8eb55b1c3b0d3a6a4052905ec320e2d7734e20aeedbf9744496d62f15a26ad79cf4cf7dae + checksum: feb3eecd2bae82fa8a8beef800290ce437d8b8063bdc69712725f21aef77c49cb2ff45c6e5e7fce622248f9c7abaee506bae0a9064067ffd6935460c7357321b languageName: node linkType: hard From 178730b85222ca20dc2097bbbd5455673c7022ac Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 28 Mar 2024 12:09:26 +0100 Subject: [PATCH 04/29] w --- packages/@uppy/companion/package.json | 1 - packages/@uppy/companion/src/server/Uploader.js | 11 +++-------- .../@uppy/companion/test/__tests__/http-agent.js | 12 ++++++------ yarn.lock | 1 - 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/packages/@uppy/companion/package.json b/packages/@uppy/companion/package.json index 493a4e9cbb..e4d1605b79 100644 --- a/packages/@uppy/companion/package.json +++ b/packages/@uppy/companion/package.json @@ -47,7 +47,6 @@ "express-prom-bundle": "6.5.0", "express-request-id": "1.4.1", "express-session": "1.17.3", - "form-data": "^4.0.0", "got": "^13.0.0", "grant": "5.4.22", "helmet": "^4.6.0", diff --git a/packages/@uppy/companion/src/server/Uploader.js b/packages/@uppy/companion/src/server/Uploader.js index 7b8aa7e089..5c279a86a7 100644 --- a/packages/@uppy/companion/src/server/Uploader.js +++ b/packages/@uppy/companion/src/server/Uploader.js @@ -1,4 +1,5 @@ // eslint-disable-next-line max-classes-per-file +const { blob } = require('node:stream/consumers'); const tus = require('tus-js-client') const { randomUUID } = require('node:crypto') const validator = require('validator') @@ -6,7 +7,6 @@ const { pipeline: pipelineCb } = require('node:stream') const { join } = require('node:path') const fs = require('node:fs') const { promisify } = require('node:util') -const FormData = require('form-data') const throttle = require('lodash/throttle') const { Upload } = require('@aws-sdk/lib-storage') @@ -614,16 +614,11 @@ class Uploader { } if (this.options.useFormData) { - // todo refactor once upgraded to got 12 const formData = new FormData() Object.entries(this.options.metadata).forEach(([key, value]) => formData.append(key, value)) - formData.append(this.options.fieldname, stream, { - filename: this.uploadFileName, - contentType: this.options.metadata.type, - knownLength: this.size, - }) + formData.append(this.options.fieldname, await blob(stream), this.uploadFileName) reqOptions.body = formData } else { @@ -663,7 +658,7 @@ class Uploader { extraData: getRespObj(err.response), }) } - throw new Error('Unknown multipart upload error') + throw new Error('Unknown multipart upload error', {cause: err}) } } diff --git a/packages/@uppy/companion/test/__tests__/http-agent.js b/packages/@uppy/companion/test/__tests__/http-agent.js index 8c7a5669ad..5e4452ebfa 100644 --- a/packages/@uppy/companion/test/__tests__/http-agent.js +++ b/packages/@uppy/companion/test/__tests__/http-agent.js @@ -11,24 +11,24 @@ describe('test protected request Agent', () => { test('allows URLs without IP addresses', async () => { nock('https://transloadit.com').get('/').reply(200) const url = 'https://transloadit.com' - await getProtectedGot({ blockLocalIPs: true }).get(url) + return (await getProtectedGot({ blockLocalIPs: true })).get(url) }) test('blocks url that resolves to forbidden IP', async () => { const url = 'https://localhost' - const promise = getProtectedGot({ blockLocalIPs: true }).get(url) + const promise = getProtectedGot({ blockLocalIPs: true }).then(got => got.get(url)) await expect(promise).rejects.toThrow(/^Forbidden resolved IP address/) }) test('blocks private http IP address', async () => { const url = 'http://172.20.10.4:8090' - const promise = getProtectedGot({ blockLocalIPs: true }).get(url) + const promise = getProtectedGot({ blockLocalIPs: true }).then(got => got.get(url)) await expect(promise).rejects.toThrow(new Error(FORBIDDEN_IP_ADDRESS)) }) test('blocks private https IP address', async () => { const url = 'https://172.20.10.4:8090' - const promise = getProtectedGot({ blockLocalIPs: true }).get(url) + const promise = getProtectedGot({ blockLocalIPs: true }).then(got => got.get(url)) await expect(promise).rejects.toThrow(new Error(FORBIDDEN_IP_ADDRESS)) }) @@ -57,12 +57,12 @@ describe('test protected request Agent', () => { for (const ip of ipv4s) { const url = `http://${ip}:8090` - const promise = getProtectedGot({ blockLocalIPs: true }).get(url) + const promise = getProtectedGot({ blockLocalIPs: true }).then(got => got.get(url)) await expect(promise).rejects.toThrow(new Error(FORBIDDEN_IP_ADDRESS)) } for (const ip of ipv6s) { const url = `http://[${ip}]:8090` - const promise = getProtectedGot({ blockLocalIPs: true }).get(url) + const promise = getProtectedGot({ blockLocalIPs: true }).then(got => got.get(url)) await expect(promise).rejects.toThrow(new Error(FORBIDDEN_IP_ADDRESS)) } }) diff --git a/yarn.lock b/yarn.lock index 2980818efc..11054fdb0a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9444,7 +9444,6 @@ __metadata: express-prom-bundle: 6.5.0 express-request-id: 1.4.1 express-session: 1.17.3 - form-data: ^4.0.0 got: ^13.0.0 grant: 5.4.22 helmet: ^4.6.0 From da3b63fa6844b428fbac088d5c2079a2c0034132 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 28 Mar 2024 13:03:37 +0100 Subject: [PATCH 05/29] w --- packages/@uppy/companion/src/server/Uploader.js | 6 +++++- packages/@uppy/companion/tsconfig.json | 2 +- yarn.lock | 7 +++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/@uppy/companion/src/server/Uploader.js b/packages/@uppy/companion/src/server/Uploader.js index 5c279a86a7..46728543a7 100644 --- a/packages/@uppy/companion/src/server/Uploader.js +++ b/packages/@uppy/companion/src/server/Uploader.js @@ -618,7 +618,11 @@ class Uploader { Object.entries(this.options.metadata).forEach(([key, value]) => formData.append(key, value)) - formData.append(this.options.fieldname, await blob(stream), this.uploadFileName) + formData.append( + this.options.fieldname, + // @ts-expect-error Node.js Blob is actually spec compliant + await blob(stream), + this.uploadFileName) reqOptions.body = formData } else { diff --git a/packages/@uppy/companion/tsconfig.json b/packages/@uppy/companion/tsconfig.json index ba8d444ffc..aef633501e 100644 --- a/packages/@uppy/companion/tsconfig.json +++ b/packages/@uppy/companion/tsconfig.json @@ -4,7 +4,7 @@ "module": "Node16", "moduleResolution": "node16", "declaration": true, - "target": "es2019", + "target": "es2022", "noImplicitAny": false, "sourceMap": false, "allowJs": true, diff --git a/yarn.lock b/yarn.lock index 11054fdb0a..4b5bd250c1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -23505,14 +23505,13 @@ __metadata: linkType: hard "nock@npm:^13.1.0, nock@npm:^13.1.3": - version: 13.2.9 - resolution: "nock@npm:13.2.9" + version: 13.5.4 + resolution: "nock@npm:13.5.4" dependencies: debug: ^4.1.0 json-stringify-safe: ^5.0.1 - lodash: ^4.17.21 propagate: ^2.0.0 - checksum: 04a2dc60b4b55fd1240f28fe34865bbc744088a4570db3781fcf66021644cc3cc9178fd86a0cb0c1f28ea77b83e8f1c9288535f6b39a6d07100059f156ccc23b + checksum: d31f924e34c87ae985edfb7b5a56e8a4dcfc3a072334ceb6d686326581f93090b3e23492663a64ce61b8df4f365b113231d926bc300bcfe9e5eb309c3e4b8628 languageName: node linkType: hard From 5820c4388b009b5b627ebf24124ba91777657977 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Sat, 13 Apr 2024 00:14:07 +0200 Subject: [PATCH 06/29] fix form data also adjust tests to match a different form data boundary: `--form-data-boundary-[a-z0-9]+ instead of ----------------------------\d+` note that `await blob(stream)` cannot be used because it reads everything into memory we don't know how many gigabytes the user is uploading so we cannot read into memory --- packages/@uppy/companion/package.json | 2 ++ .../@uppy/companion/src/server/Uploader.js | 23 +++++++++++++------ .../companion/test/__tests__/uploader.js | 6 +++-- yarn.lock | 16 +++++++++++++ 4 files changed, 38 insertions(+), 9 deletions(-) diff --git a/packages/@uppy/companion/package.json b/packages/@uppy/companion/package.json index 5e3f8d0f65..186922dee2 100644 --- a/packages/@uppy/companion/package.json +++ b/packages/@uppy/companion/package.json @@ -47,6 +47,8 @@ "express-prom-bundle": "6.5.0", "express-request-id": "1.4.1", "express-session": "1.17.3", + "form-data-encoder": "^4.0.2", + "formdata-node": "^6.0.3", "got": "^13.0.0", "grant": "5.4.22", "helmet": "^4.6.0", diff --git a/packages/@uppy/companion/src/server/Uploader.js b/packages/@uppy/companion/src/server/Uploader.js index 46728543a7..7e3a636b4c 100644 --- a/packages/@uppy/companion/src/server/Uploader.js +++ b/packages/@uppy/companion/src/server/Uploader.js @@ -1,5 +1,4 @@ // eslint-disable-next-line max-classes-per-file -const { blob } = require('node:stream/consumers'); const tus = require('tus-js-client') const { randomUUID } = require('node:crypto') const validator = require('validator') @@ -8,6 +7,12 @@ const { join } = require('node:path') const fs = require('node:fs') const { promisify } = require('node:util') const throttle = require('lodash/throttle') +const { Readable } = require('node:stream') +// eslint-disable-next-line import/no-extraneous-dependencies +const { FormData } = require('formdata-node') +// eslint-disable-next-line import/no-extraneous-dependencies +const { FormDataEncoder } = require('form-data-encoder') + const { Upload } = require('@aws-sdk/lib-storage') @@ -618,13 +623,17 @@ class Uploader { Object.entries(this.options.metadata).forEach(([key, value]) => formData.append(key, value)) - formData.append( - this.options.fieldname, - // @ts-expect-error Node.js Blob is actually spec compliant - await blob(stream), - this.uploadFileName) + formData.set(this.options.fieldname, { + type: this.options.metadata.type, + name: this.uploadFileName, + [Symbol.toStringTag]: "File", + stream() { return stream } + }) + + const encoder = new FormDataEncoder(formData) - reqOptions.body = formData + reqOptions.body = Readable.from(encoder) + reqOptions.headers['content-type'] = encoder.contentType } else { reqOptions.headers['content-length'] = this.size reqOptions.body = stream diff --git a/packages/@uppy/companion/test/__tests__/uploader.js b/packages/@uppy/companion/test/__tests__/uploader.js index 8b29a3474e..3d4efb84cb 100644 --- a/packages/@uppy/companion/test/__tests__/uploader.js +++ b/packages/@uppy/companion/test/__tests__/uploader.js @@ -190,7 +190,9 @@ describe('uploader with tus protocol', () => { }) // eslint-disable-next-line max-len - const formDataNoMetaMatch = /^----------------------------\d+\r\nContent-Disposition: form-data; name="files\[\]"; filename="uppy-file-[^"]+"\r\nContent-Type: application\/octet-stream\r\n\r\nSome file content\r\n----------------------------\d+--\r\n$/ + const formDataNoMetaMatch = /^--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="files\[\]"; filename="uppy-file-[^"]+"\r\nContent-Type: application\/octet-stream\r\n\r\nSome file content\r\n--form-data-boundary-[a-z0-9]+--\r\n\r\n$/ + // eslint-disable-next-line max-len + const formDataWithMetaMatch = /^--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key1"\r\n\r\nnull\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key2"\r\n\r\ntrue\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key3"\r\n\r\n1234\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key4"\r\n\r\n\[object Object\]\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key5"\r\n\r\n\(\) => {}\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key6"\r\n\r\nSymbol\(\)\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="files\[\]"; filename="uppy-file-[^"]+"\r\nContent-Type: application\/octet-stream\r\n\r\nSome file content\r\n--form-data-boundary-[a-z0-9]+--\r\n\r\n$/ test('upload functions with xhr formdata', async () => { nock('http://localhost').post('/', formDataNoMetaMatch) @@ -212,7 +214,7 @@ describe('uploader with tus protocol', () => { // https://github.com/transloadit/uppy/issues/3477 test('upload functions with xhr formdata and metadata', async () => { // eslint-disable-next-line max-len - nock('http://localhost').post('/', /^----------------------------\d+\r\nContent-Disposition: form-data; name="key1"\r\n\r\nnull\r\n----------------------------\d+\r\nContent-Disposition: form-data; name="key2"\r\n\r\ntrue\r\n----------------------------\d+\r\nContent-Disposition: form-data; name="key3"\r\n\r\n\d+\r\n----------------------------\d+\r\nContent-Disposition: form-data; name="key4"\r\n\r\n\[object Object\]\r\n----------------------------\d+\r\nContent-Disposition: form-data; name="key5"\r\n\r\n\(\) => {}\r\n----------------------------\d+\r\nContent-Disposition: form-data; name="key6"\r\n\r\nSymbol\(\)\r\n----------------------------\d+\r\nContent-Disposition: form-data; name="files\[\]"; filename="uppy-file-[^"]+"\r\nContent-Type: application\/octet-stream\r\n\r\nSome file content\r\n----------------------------\d+--\r\n$/) + nock('http://localhost').post('/', formDataWithMetaMatch) .reply(200) const metadata = { diff --git a/yarn.lock b/yarn.lock index 78dffdbdfc..9f64e05d5c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9420,6 +9420,8 @@ __metadata: express-prom-bundle: 6.5.0 express-request-id: 1.4.1 express-session: 1.17.3 + form-data-encoder: ^4.0.2 + formdata-node: ^6.0.3 got: ^13.0.0 grant: 5.4.22 helmet: ^4.6.0 @@ -16852,6 +16854,13 @@ __metadata: languageName: node linkType: hard +"form-data-encoder@npm:^4.0.2": + version: 4.0.2 + resolution: "form-data-encoder@npm:4.0.2" + checksum: 12769f21af2d750c20111f8a626560eaf613c2c62769d5924d9e5a44ba4ef52406f973844129151efd35533eb79ecf8e0b95b0839560e335204d2212efb9a9ef + languageName: node + linkType: hard + "form-data@npm:^2.5.0": version: 2.5.1 resolution: "form-data@npm:2.5.1" @@ -16892,6 +16901,13 @@ __metadata: languageName: node linkType: hard +"formdata-node@npm:^6.0.3": + version: 6.0.3 + resolution: "formdata-node@npm:6.0.3" + checksum: 0c404dad51aac1e570bef1c20b702da9f4facac9db889398d333ca92a7ae4ab8c005ad249e2df184870fe388aedfe28fc81e8a0aabda7295a19316c1fbaf7407 + languageName: node + linkType: hard + "formdata-polyfill@npm:^4.0.10": version: 4.0.10 resolution: "formdata-polyfill@npm:4.0.10" From 4724571b24f848572224d61c46d8f92f25cab307 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Sat, 13 Apr 2024 11:47:27 +0200 Subject: [PATCH 07/29] fix esm import --- packages/@uppy/companion/src/server/Uploader.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/@uppy/companion/src/server/Uploader.js b/packages/@uppy/companion/src/server/Uploader.js index 7e3a636b4c..d481cd5cfa 100644 --- a/packages/@uppy/companion/src/server/Uploader.js +++ b/packages/@uppy/companion/src/server/Uploader.js @@ -8,10 +8,11 @@ const fs = require('node:fs') const { promisify } = require('node:util') const throttle = require('lodash/throttle') const { Readable } = require('node:stream') + // eslint-disable-next-line import/no-extraneous-dependencies -const { FormData } = require('formdata-node') +const formDataPromise = import('formdata-node') // eslint-disable-next-line import/no-extraneous-dependencies -const { FormDataEncoder } = require('form-data-encoder') +const formDataEncoderPromise = import('form-data-encoder') const { Upload } = require('@aws-sdk/lib-storage') @@ -619,6 +620,7 @@ class Uploader { } if (this.options.useFormData) { + const { FormData } = await formDataPromise; const formData = new FormData() Object.entries(this.options.metadata).forEach(([key, value]) => formData.append(key, value)) @@ -630,6 +632,7 @@ class Uploader { stream() { return stream } }) + const { FormDataEncoder } = await formDataEncoderPromise; const encoder = new FormDataEncoder(formData) reqOptions.body = Readable.from(encoder) From 7d33b9c8fca0d4a770669f63c4430828ee1ec14f Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Sat, 13 Apr 2024 11:47:44 +0200 Subject: [PATCH 08/29] fix test flakiness https://stackoverflow.com/questions/76203449/a-jest-worker-process-was-terminated-by-another-process --- packages/@uppy/companion/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@uppy/companion/package.json b/packages/@uppy/companion/package.json index 186922dee2..9032863165 100644 --- a/packages/@uppy/companion/package.json +++ b/packages/@uppy/companion/package.json @@ -109,7 +109,7 @@ "deploy": "kubectl apply -f infra/kube/companion-kube.yml", "prepublishOnly": "yarn run build", "start": "node ./lib/standalone/start-server.js", - "test": "NODE_OPTIONS=--experimental-vm-modules jest" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --runInBand" }, "engines": { "node": "^18.20.0 || ^20.10.0 || >=22.0.0" From 8988847c248052285305a0fc9c2f8bae7366d769 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Sat, 13 Apr 2024 11:47:57 +0200 Subject: [PATCH 09/29] fix test flakiness --- packages/@uppy/companion/test/__tests__/companion.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@uppy/companion/test/__tests__/companion.js b/packages/@uppy/companion/test/__tests__/companion.js index 5a9ed228b2..5e9553af36 100644 --- a/packages/@uppy/companion/test/__tests__/companion.js +++ b/packages/@uppy/companion/test/__tests__/companion.js @@ -230,7 +230,7 @@ it('periodically pings', (done) => { getServer({ COMPANION_PERIODIC_PING_URLS: 'http://localhost/ping', COMPANION_PERIODIC_PING_STATIC_JSON_PAYLOAD: '{"some": "value"}', - COMPANION_PERIODIC_PING_INTERVAL: '10', + COMPANION_PERIODIC_PING_INTERVAL: '100', COMPANION_PERIODIC_PING_COUNT: '1', }) }, 3000) From a6bf417c6e65fddebbd9f07487df0543653f6641 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Sun, 14 Apr 2024 23:32:46 +0200 Subject: [PATCH 10/29] remove into-stream and upgrade jest/nock --- package.json | 2 + packages/@uppy/companion/package.json | 1 - .../companion/test/__tests__/uploader.js | 18 +- yarn.lock | 860 +++++++++++++++++- 4 files changed, 839 insertions(+), 42 deletions(-) diff --git a/package.json b/package.json index 6803491a61..cd9ae0bdf1 100644 --- a/package.json +++ b/package.json @@ -84,9 +84,11 @@ "eslint-plugin-unicorn": "^46.0.0", "github-contributors-list": "^1.2.4", "glob": "^8.0.0", + "jest": "^29.7.0", "jsdom": "^22.1.0", "lint-staged": "^13.0.0", "mime-types": "^2.1.26", + "nock": "^13.5.4", "nodemon": "^2.0.8", "npm-packlist": "^5.0.0", "npm-run-all": "^4.1.5", diff --git a/packages/@uppy/companion/package.json b/packages/@uppy/companion/package.json index 9032863165..1ad7aafe3f 100644 --- a/packages/@uppy/companion/package.json +++ b/packages/@uppy/companion/package.json @@ -84,7 +84,6 @@ "@types/request": "2.48.8", "@types/webpack": "^5.28.0", "@types/ws": "8.5.3", - "into-stream": "^6.0.0", "jest": "^29.0.0", "nock": "^13.1.3", "supertest": "6.2.4", diff --git a/packages/@uppy/companion/test/__tests__/uploader.js b/packages/@uppy/companion/test/__tests__/uploader.js index 3d4efb84cb..af83bf9363 100644 --- a/packages/@uppy/companion/test/__tests__/uploader.js +++ b/packages/@uppy/companion/test/__tests__/uploader.js @@ -2,15 +2,16 @@ jest.mock('tus-js-client') -const intoStream = require('into-stream') const fs = require('node:fs') const nock = require('nock') +const { Readable } = require('node:stream') const Uploader = require('../../src/server/Uploader') const socketClient = require('../mocksocket') const standalone = require('../../src/standalone') const Emitter = require('../../src/server/emitter') + afterAll(() => { nock.cleanAll() nock.restore() @@ -18,6 +19,7 @@ afterAll(() => { process.env.COMPANION_DATADIR = './test/output' process.env.COMPANION_DOMAIN = 'localhost:3020' +// process.env.COMPANION_STREAMING_UPLOAD = 'true' const { companionOptions } = standalone() describe('uploader with tus protocol', () => { @@ -52,7 +54,7 @@ describe('uploader with tus protocol', () => { test('upload functions with tus protocol', async () => { const fileContent = Buffer.from('Some file content') - const stream = intoStream(fileContent) + const stream = Readable.from([fileContent]) const opts = { companionOptions, endpoint: 'http://url.myendpoint.com/files', @@ -108,7 +110,7 @@ describe('uploader with tus protocol', () => { test('upload functions with tus protocol without size', async () => { const fileContent = Buffer.alloc(1e6) - const stream = intoStream(fileContent) + const stream = Readable.from([fileContent]) const opts = { companionOptions, endpoint: 'http://url.myendpoint.com/files', @@ -153,7 +155,7 @@ describe('uploader with tus protocol', () => { }) socketClient.onUploadSuccess(uploadToken, (message) => { try { - expect(firstReceivedProgress.bytesUploaded).toBe(8192) + expect(firstReceivedProgress.bytesUploaded).toBeGreaterThan(0) // see __mocks__/tus-js-client.js expect(message.payload.url).toBe('https://tus.endpoint/files/foo-bar') @@ -166,7 +168,7 @@ describe('uploader with tus protocol', () => { async function runMultipartTest ({ metadata, useFormData, includeSize = true } = {}) { const fileContent = Buffer.from('Some file content') - const stream = intoStream(fileContent) + const stream = Readable.from([fileContent]) const opts = { companionOptions, @@ -207,8 +209,8 @@ describe('uploader with tus protocol', () => { nock('http://localhost').post('/', formDataNoMetaMatch) .reply(200) - const ret = await runMultipartTest({ useFormData: true, includeSize: false }) - expect(ret).toMatchObject({ url: null, extraData: { response: expect.anything(), bytesUploaded: 17 } }) + const ret = await runMultipartTest({ useFormData: true, includeSize: false }) + expect(ret).toMatchObject({ url: null, extraData: { response: expect.anything(), bytesUploaded: 17 } }) }) // https://github.com/transloadit/uppy/issues/3477 @@ -259,7 +261,7 @@ describe('uploader with tus protocol', () => { test('uploader respects maxFileSize with unknown size', async () => { const fileContent = Buffer.alloc(10000) - const stream = intoStream(fileContent) + const stream = Readable.from([fileContent]) const opts = { companionOptions: { ...companionOptions, maxFileSize: 1000 }, endpoint: 'http://url.myendpoint.com/files', diff --git a/yarn.lock b/yarn.lock index 9f64e05d5c..8688a22d8e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2026,6 +2026,16 @@ __metadata: languageName: node linkType: hard +"@babel/code-frame@npm:^7.24.1, @babel/code-frame@npm:^7.24.2": + version: 7.24.2 + resolution: "@babel/code-frame@npm:7.24.2" + dependencies: + "@babel/highlight": ^7.24.2 + picocolors: ^1.0.0 + checksum: 70e867340cfe09ca5488b2f36372c45cabf43c79a5b6426e6df5ef0611ff5dfa75a57dda841895693de6008f32c21a7c97027a8c7bcabd63a7d17416cbead6f8 + languageName: node + linkType: hard + "@babel/code-frame@npm:~7.10.4": version: 7.10.4 resolution: "@babel/code-frame@npm:7.10.4" @@ -2111,6 +2121,29 @@ __metadata: languageName: node linkType: hard +"@babel/core@npm:^7.23.9": + version: 7.24.4 + resolution: "@babel/core@npm:7.24.4" + dependencies: + "@ampproject/remapping": ^2.2.0 + "@babel/code-frame": ^7.24.2 + "@babel/generator": ^7.24.4 + "@babel/helper-compilation-targets": ^7.23.6 + "@babel/helper-module-transforms": ^7.23.3 + "@babel/helpers": ^7.24.4 + "@babel/parser": ^7.24.4 + "@babel/template": ^7.24.0 + "@babel/traverse": ^7.24.1 + "@babel/types": ^7.24.0 + convert-source-map: ^2.0.0 + debug: ^4.1.0 + gensync: ^1.0.0-beta.2 + json5: ^2.2.3 + semver: ^6.3.1 + checksum: 15ecad7581f3329995956ba461961b1af7bed48901f14fe962ccd3217edca60049e9e6ad4ce48134618397e6c90230168c842e2c28e47ef1f16c97dbbf663c61 + languageName: node + linkType: hard + "@babel/eslint-parser@npm:^7.11.3": version: 7.23.3 resolution: "@babel/eslint-parser@npm:7.23.3" @@ -2149,6 +2182,18 @@ __metadata: languageName: node linkType: hard +"@babel/generator@npm:^7.24.1, @babel/generator@npm:^7.24.4": + version: 7.24.4 + resolution: "@babel/generator@npm:7.24.4" + dependencies: + "@babel/types": ^7.24.0 + "@jridgewell/gen-mapping": ^0.3.5 + "@jridgewell/trace-mapping": ^0.3.25 + jsesc: ^2.5.1 + checksum: 1b6146c31386c9df3eb594a2c36b5c98da4f67f7c06edb3d68a442b92516b21bb5ba3ad7dbe0058fe76625ed24d66923e15c95b0df75ef1907d4068921a699b8 + languageName: node + linkType: hard + "@babel/helper-annotate-as-pure@npm:7.22.5, @babel/helper-annotate-as-pure@npm:^7.22.5": version: 7.22.5 resolution: "@babel/helper-annotate-as-pure@npm:7.22.5" @@ -2446,6 +2491,17 @@ __metadata: languageName: node linkType: hard +"@babel/helpers@npm:^7.24.4": + version: 7.24.4 + resolution: "@babel/helpers@npm:7.24.4" + dependencies: + "@babel/template": ^7.24.0 + "@babel/traverse": ^7.24.1 + "@babel/types": ^7.24.0 + checksum: ecd2dc0b3b32e24b97fa3bcda432dd3235b77c2be1e16eafc35b8ef8f6c461faa99796a8bc2431a408c98b4aabfd572c160e2b67ecea4c5c9dd3a8314a97994a + languageName: node + linkType: hard + "@babel/highlight@npm:^7.10.4, @babel/highlight@npm:^7.23.4": version: 7.23.4 resolution: "@babel/highlight@npm:7.23.4" @@ -2457,6 +2513,18 @@ __metadata: languageName: node linkType: hard +"@babel/highlight@npm:^7.24.2": + version: 7.24.2 + resolution: "@babel/highlight@npm:7.24.2" + dependencies: + "@babel/helper-validator-identifier": ^7.22.20 + chalk: ^2.4.2 + js-tokens: ^4.0.0 + picocolors: ^1.0.0 + checksum: 5f17b131cc3ebf3ab285a62cf98a404aef1bd71a6be045e748f8d5bf66d6a6e1aefd62f5972c84369472e8d9f22a614c58a89cd331eb60b7ba965b31b1bbeaf5 + languageName: node + linkType: hard + "@babel/parser@npm:^7.0.0, @babel/parser@npm:^7.1.0, @babel/parser@npm:^7.1.6, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.16.4, @babel/parser@npm:^7.20.15, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.21.3, @babel/parser@npm:^7.22.15, @babel/parser@npm:^7.23.6": version: 7.23.6 resolution: "@babel/parser@npm:7.23.6" @@ -2475,6 +2543,15 @@ __metadata: languageName: node linkType: hard +"@babel/parser@npm:^7.24.1, @babel/parser@npm:^7.24.4": + version: 7.24.4 + resolution: "@babel/parser@npm:7.24.4" + bin: + parser: ./bin/babel-parser.js + checksum: 94c9e3e592894cd6fc57c519f4e06b65463df9be5f01739bb0d0bfce7ffcf99b3c2fdadd44dc59cc858ba2739ce6e469813a941c2f2dfacf333a3b2c9c5c8465 + languageName: node + linkType: hard + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@npm:7.23.3" @@ -3933,6 +4010,24 @@ __metadata: languageName: node linkType: hard +"@babel/traverse@npm:^7.24.1": + version: 7.24.1 + resolution: "@babel/traverse@npm:7.24.1" + dependencies: + "@babel/code-frame": ^7.24.1 + "@babel/generator": ^7.24.1 + "@babel/helper-environment-visitor": ^7.22.20 + "@babel/helper-function-name": ^7.23.0 + "@babel/helper-hoist-variables": ^7.22.5 + "@babel/helper-split-export-declaration": ^7.22.6 + "@babel/parser": ^7.24.1 + "@babel/types": ^7.24.0 + debug: ^4.3.1 + globals: ^11.1.0 + checksum: 92a5ca906abfba9df17666d2001ab23f18600035f706a687055a0e392a690ae48d6fec67c8bd4ef19ba18699a77a5b7f85727e36b83f7d110141608fe0c24fe9 + languageName: node + linkType: hard + "@babel/types@npm:^7.0.0, @babel/types@npm:^7.17.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.4, @babel/types@npm:^7.23.6, @babel/types@npm:^7.3.0, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4, @babel/types@npm:^7.8.3": version: 7.23.6 resolution: "@babel/types@npm:7.23.6" @@ -5065,7 +5160,7 @@ __metadata: languageName: node linkType: hard -"@istanbuljs/schema@npm:^0.1.2": +"@istanbuljs/schema@npm:^0.1.2, @istanbuljs/schema@npm:^0.1.3": version: 0.1.3 resolution: "@istanbuljs/schema@npm:0.1.3" checksum: 5282759d961d61350f33d9118d16bcaed914ebf8061a52f4fa474b2cb08720c9c81d165e13b82f2e5a8a212cc5af482f0c6fc1ac27b9e067e5394c9a6ed186c9 @@ -5086,6 +5181,20 @@ __metadata: languageName: node linkType: hard +"@jest/console@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/console@npm:29.7.0" + dependencies: + "@jest/types": ^29.6.3 + "@types/node": "*" + chalk: ^4.0.0 + jest-message-util: ^29.7.0 + jest-util: ^29.7.0 + slash: ^3.0.0 + checksum: 0e3624e32c5a8e7361e889db70b170876401b7d70f509a2538c31d5cd50deb0c1ae4b92dc63fe18a0902e0a48c590c21d53787a0df41a52b34fa7cab96c384d6 + languageName: node + linkType: hard + "@jest/core@npm:^29.5.0": version: 29.5.0 resolution: "@jest/core@npm:29.5.0" @@ -5127,6 +5236,47 @@ __metadata: languageName: node linkType: hard +"@jest/core@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/core@npm:29.7.0" + dependencies: + "@jest/console": ^29.7.0 + "@jest/reporters": ^29.7.0 + "@jest/test-result": ^29.7.0 + "@jest/transform": ^29.7.0 + "@jest/types": ^29.6.3 + "@types/node": "*" + ansi-escapes: ^4.2.1 + chalk: ^4.0.0 + ci-info: ^3.2.0 + exit: ^0.1.2 + graceful-fs: ^4.2.9 + jest-changed-files: ^29.7.0 + jest-config: ^29.7.0 + jest-haste-map: ^29.7.0 + jest-message-util: ^29.7.0 + jest-regex-util: ^29.6.3 + jest-resolve: ^29.7.0 + jest-resolve-dependencies: ^29.7.0 + jest-runner: ^29.7.0 + jest-runtime: ^29.7.0 + jest-snapshot: ^29.7.0 + jest-util: ^29.7.0 + jest-validate: ^29.7.0 + jest-watcher: ^29.7.0 + micromatch: ^4.0.4 + pretty-format: ^29.7.0 + slash: ^3.0.0 + strip-ansi: ^6.0.0 + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + checksum: af759c9781cfc914553320446ce4e47775ae42779e73621c438feb1e4231a5d4862f84b1d8565926f2d1aab29b3ec3dcfdc84db28608bdf5f29867124ebcfc0d + languageName: node + linkType: hard + "@jest/create-cache-key-function@npm:^26.5.0": version: 26.6.2 resolution: "@jest/create-cache-key-function@npm:26.6.2" @@ -5148,6 +5298,18 @@ __metadata: languageName: node linkType: hard +"@jest/environment@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/environment@npm:29.7.0" + dependencies: + "@jest/fake-timers": ^29.7.0 + "@jest/types": ^29.6.3 + "@types/node": "*" + jest-mock: ^29.7.0 + checksum: 6fb398143b2543d4b9b8d1c6dbce83fa5247f84f550330604be744e24c2bd2178bb893657d62d1b97cf2f24baf85c450223f8237cccb71192c36a38ea2272934 + languageName: node + linkType: hard + "@jest/expect-utils@npm:^29.5.0": version: 29.5.0 resolution: "@jest/expect-utils@npm:29.5.0" @@ -5157,6 +5319,15 @@ __metadata: languageName: node linkType: hard +"@jest/expect-utils@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/expect-utils@npm:29.7.0" + dependencies: + jest-get-type: ^29.6.3 + checksum: 75eb177f3d00b6331bcaa057e07c0ccb0733a1d0a1943e1d8db346779039cb7f103789f16e502f888a3096fb58c2300c38d1f3748b36a7fa762eb6f6d1b160ed + languageName: node + linkType: hard + "@jest/expect@npm:^29.5.0": version: 29.5.0 resolution: "@jest/expect@npm:29.5.0" @@ -5167,6 +5338,16 @@ __metadata: languageName: node linkType: hard +"@jest/expect@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/expect@npm:29.7.0" + dependencies: + expect: ^29.7.0 + jest-snapshot: ^29.7.0 + checksum: a01cb85fd9401bab3370618f4b9013b90c93536562222d920e702a0b575d239d74cecfe98010aaec7ad464f67cf534a353d92d181646a4b792acaa7e912ae55e + languageName: node + linkType: hard + "@jest/fake-timers@npm:^29.5.0": version: 29.5.0 resolution: "@jest/fake-timers@npm:29.5.0" @@ -5181,6 +5362,20 @@ __metadata: languageName: node linkType: hard +"@jest/fake-timers@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/fake-timers@npm:29.7.0" + dependencies: + "@jest/types": ^29.6.3 + "@sinonjs/fake-timers": ^10.0.2 + "@types/node": "*" + jest-message-util: ^29.7.0 + jest-mock: ^29.7.0 + jest-util: ^29.7.0 + checksum: caf2bbd11f71c9241b458d1b5a66cbe95debc5a15d96442444b5d5c7ba774f523c76627c6931cca5e10e76f0d08761f6f1f01a608898f4751a0eee54fc3d8d00 + languageName: node + linkType: hard + "@jest/globals@npm:^29.5.0": version: 29.5.0 resolution: "@jest/globals@npm:29.5.0" @@ -5193,6 +5388,18 @@ __metadata: languageName: node linkType: hard +"@jest/globals@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/globals@npm:29.7.0" + dependencies: + "@jest/environment": ^29.7.0 + "@jest/expect": ^29.7.0 + "@jest/types": ^29.6.3 + jest-mock: ^29.7.0 + checksum: 97dbb9459135693ad3a422e65ca1c250f03d82b2a77f6207e7fa0edd2c9d2015fbe4346f3dc9ebff1678b9d8da74754d4d440b7837497f8927059c0642a22123 + languageName: node + linkType: hard + "@jest/reporters@npm:^29.5.0": version: 29.5.0 resolution: "@jest/reporters@npm:29.5.0" @@ -5230,6 +5437,43 @@ __metadata: languageName: node linkType: hard +"@jest/reporters@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/reporters@npm:29.7.0" + dependencies: + "@bcoe/v8-coverage": ^0.2.3 + "@jest/console": ^29.7.0 + "@jest/test-result": ^29.7.0 + "@jest/transform": ^29.7.0 + "@jest/types": ^29.6.3 + "@jridgewell/trace-mapping": ^0.3.18 + "@types/node": "*" + chalk: ^4.0.0 + collect-v8-coverage: ^1.0.0 + exit: ^0.1.2 + glob: ^7.1.3 + graceful-fs: ^4.2.9 + istanbul-lib-coverage: ^3.0.0 + istanbul-lib-instrument: ^6.0.0 + istanbul-lib-report: ^3.0.0 + istanbul-lib-source-maps: ^4.0.0 + istanbul-reports: ^3.1.3 + jest-message-util: ^29.7.0 + jest-util: ^29.7.0 + jest-worker: ^29.7.0 + slash: ^3.0.0 + string-length: ^4.0.1 + strip-ansi: ^6.0.0 + v8-to-istanbul: ^9.0.1 + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + checksum: 7eadabd62cc344f629024b8a268ecc8367dba756152b761bdcb7b7e570a3864fc51b2a9810cd310d85e0a0173ef002ba4528d5ea0329fbf66ee2a3ada9c40455 + languageName: node + linkType: hard + "@jest/schemas@npm:^29.4.3": version: 29.4.3 resolution: "@jest/schemas@npm:29.4.3" @@ -5259,6 +5503,17 @@ __metadata: languageName: node linkType: hard +"@jest/source-map@npm:^29.6.3": + version: 29.6.3 + resolution: "@jest/source-map@npm:29.6.3" + dependencies: + "@jridgewell/trace-mapping": ^0.3.18 + callsites: ^3.0.0 + graceful-fs: ^4.2.9 + checksum: bcc5a8697d471396c0003b0bfa09722c3cd879ad697eb9c431e6164e2ea7008238a01a07193dfe3cbb48b1d258eb7251f6efcea36f64e1ebc464ea3c03ae2deb + languageName: node + linkType: hard + "@jest/test-result@npm:^29.5.0": version: 29.5.0 resolution: "@jest/test-result@npm:29.5.0" @@ -5271,6 +5526,18 @@ __metadata: languageName: node linkType: hard +"@jest/test-result@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/test-result@npm:29.7.0" + dependencies: + "@jest/console": ^29.7.0 + "@jest/types": ^29.6.3 + "@types/istanbul-lib-coverage": ^2.0.0 + collect-v8-coverage: ^1.0.0 + checksum: 67b6317d526e335212e5da0e768e3b8ab8a53df110361b80761353ad23b6aea4432b7c5665bdeb87658ea373b90fb1afe02ed3611ef6c858c7fba377505057fa + languageName: node + linkType: hard + "@jest/test-sequencer@npm:^29.5.0": version: 29.5.0 resolution: "@jest/test-sequencer@npm:29.5.0" @@ -5283,6 +5550,18 @@ __metadata: languageName: node linkType: hard +"@jest/test-sequencer@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/test-sequencer@npm:29.7.0" + dependencies: + "@jest/test-result": ^29.7.0 + graceful-fs: ^4.2.9 + jest-haste-map: ^29.7.0 + slash: ^3.0.0 + checksum: 73f43599017946be85c0b6357993b038f875b796e2f0950487a82f4ebcb115fa12131932dd9904026b4ad8be131fe6e28bd8d0aa93b1563705185f9804bff8bd + languageName: node + linkType: hard + "@jest/transform@npm:^29.5.0": version: 29.5.0 resolution: "@jest/transform@npm:29.5.0" @@ -5306,6 +5585,29 @@ __metadata: languageName: node linkType: hard +"@jest/transform@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/transform@npm:29.7.0" + dependencies: + "@babel/core": ^7.11.6 + "@jest/types": ^29.6.3 + "@jridgewell/trace-mapping": ^0.3.18 + babel-plugin-istanbul: ^6.1.1 + chalk: ^4.0.0 + convert-source-map: ^2.0.0 + fast-json-stable-stringify: ^2.1.0 + graceful-fs: ^4.2.9 + jest-haste-map: ^29.7.0 + jest-regex-util: ^29.6.3 + jest-util: ^29.7.0 + micromatch: ^4.0.4 + pirates: ^4.0.4 + slash: ^3.0.0 + write-file-atomic: ^4.0.2 + checksum: 0f8ac9f413903b3cb6d240102db848f2a354f63971ab885833799a9964999dd51c388162106a807f810071f864302cdd8e3f0c241c29ce02d85a36f18f3f40ab + languageName: node + linkType: hard + "@jest/types@npm:^26.6.2": version: 26.6.2 resolution: "@jest/types@npm:26.6.2" @@ -5333,6 +5635,20 @@ __metadata: languageName: node linkType: hard +"@jest/types@npm:^29.6.3": + version: 29.6.3 + resolution: "@jest/types@npm:29.6.3" + dependencies: + "@jest/schemas": ^29.6.3 + "@types/istanbul-lib-coverage": ^2.0.0 + "@types/istanbul-reports": ^3.0.0 + "@types/node": "*" + "@types/yargs": ^17.0.8 + chalk: ^4.0.0 + checksum: a0bcf15dbb0eca6bdd8ce61a3fb055349d40268622a7670a3b2eb3c3dbafe9eb26af59938366d520b86907b9505b0f9b29b85cec11579a9e580694b87cd90fcc + languageName: node + linkType: hard + "@jridgewell/gen-mapping@npm:^0.3.0, @jridgewell/gen-mapping@npm:^0.3.2": version: 0.3.2 resolution: "@jridgewell/gen-mapping@npm:0.3.2" @@ -5447,7 +5763,7 @@ __metadata: languageName: node linkType: hard -"@jridgewell/trace-mapping@npm:^0.3.20, @jridgewell/trace-mapping@npm:^0.3.24": +"@jridgewell/trace-mapping@npm:^0.3.20, @jridgewell/trace-mapping@npm:^0.3.24, @jridgewell/trace-mapping@npm:^0.3.25": version: 0.3.25 resolution: "@jridgewell/trace-mapping@npm:0.3.25" dependencies: @@ -8839,9 +9155,11 @@ __metadata: eslint-plugin-unicorn: ^46.0.0 github-contributors-list: ^1.2.4 glob: ^8.0.0 + jest: ^29.7.0 jsdom: ^22.1.0 lint-staged: ^13.0.0 mime-types: ^2.1.26 + nock: ^13.5.4 nodemon: ^2.0.8 npm-packlist: ^5.0.0 npm-run-all: ^4.1.5 @@ -9425,7 +9743,6 @@ __metadata: got: ^13.0.0 grant: 5.4.22 helmet: ^4.6.0 - into-stream: ^6.0.0 ipaddr.js: ^2.0.1 jest: ^29.0.0 jsonwebtoken: 9.0.2 @@ -11446,6 +11763,23 @@ __metadata: languageName: node linkType: hard +"babel-jest@npm:^29.7.0": + version: 29.7.0 + resolution: "babel-jest@npm:29.7.0" + dependencies: + "@jest/transform": ^29.7.0 + "@types/babel__core": ^7.1.14 + babel-plugin-istanbul: ^6.1.1 + babel-preset-jest: ^29.6.3 + chalk: ^4.0.0 + graceful-fs: ^4.2.9 + slash: ^3.0.0 + peerDependencies: + "@babel/core": ^7.8.0 + checksum: ee6f8e0495afee07cac5e4ee167be705c711a8cc8a737e05a587a131fdae2b3c8f9aa55dfd4d9c03009ac2d27f2de63d8ba96d3e8460da4d00e8af19ef9a83f7 + languageName: node + linkType: hard + "babel-loader@npm:9.1.3": version: 9.1.3 resolution: "babel-loader@npm:9.1.3" @@ -11491,6 +11825,18 @@ __metadata: languageName: node linkType: hard +"babel-plugin-jest-hoist@npm:^29.6.3": + version: 29.6.3 + resolution: "babel-plugin-jest-hoist@npm:29.6.3" + dependencies: + "@babel/template": ^7.3.3 + "@babel/types": ^7.3.3 + "@types/babel__core": ^7.1.14 + "@types/babel__traverse": ^7.0.6 + checksum: 51250f22815a7318f17214a9d44650ba89551e6d4f47a2dc259128428324b52f5a73979d010cefd921fd5a720d8c1d55ad74ff601cd94c7bd44d5f6292fde2d1 + languageName: node + linkType: hard + "babel-plugin-module-resolver@npm:^4.1.0": version: 4.1.0 resolution: "babel-plugin-module-resolver@npm:4.1.0" @@ -11664,6 +12010,18 @@ __metadata: languageName: node linkType: hard +"babel-preset-jest@npm:^29.6.3": + version: 29.6.3 + resolution: "babel-preset-jest@npm:29.6.3" + dependencies: + babel-plugin-jest-hoist: ^29.6.3 + babel-preset-current-node-syntax: ^1.0.0 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: aa4ff2a8a728d9d698ed521e3461a109a1e66202b13d3494e41eea30729a5e7cc03b3a2d56c594423a135429c37bf63a9fa8b0b9ce275298be3095a88c69f6fb + languageName: node + linkType: hard + "bail@npm:^2.0.0": version: 2.0.2 resolution: "bail@npm:2.0.2" @@ -13288,6 +13646,23 @@ __metadata: languageName: node linkType: hard +"create-jest@npm:^29.7.0": + version: 29.7.0 + resolution: "create-jest@npm:29.7.0" + dependencies: + "@jest/types": ^29.6.3 + chalk: ^4.0.0 + exit: ^0.1.2 + graceful-fs: ^4.2.9 + jest-config: ^29.7.0 + jest-util: ^29.7.0 + prompts: ^2.0.1 + bin: + create-jest: bin/create-jest.js + checksum: 1427d49458adcd88547ef6fa39041e1fe9033a661293aa8d2c3aa1b4967cb5bf4f0c00436c7a61816558f28ba2ba81a94d5c962e8022ea9a883978fc8e1f2945 + languageName: node + linkType: hard + "create-react-class@npm:^15.7.0": version: 15.7.0 resolution: "create-react-class@npm:15.7.0" @@ -13842,6 +14217,18 @@ __metadata: languageName: node linkType: hard +"dedent@npm:^1.0.0": + version: 1.5.3 + resolution: "dedent@npm:1.5.3" + peerDependencies: + babel-plugin-macros: ^3.1.0 + peerDependenciesMeta: + babel-plugin-macros: + optional: true + checksum: 045b595557b2a8ea2eb9b0b4623d764e9a87326486fe2b61191b4342ed93dc01245644d8a09f3108a50c0ee7965f1eedd92e4a3a503ed89ea8e810566ea27f9a + languageName: node + linkType: hard + "deep-diff@npm:^0.3.5": version: 0.3.8 resolution: "deep-diff@npm:0.3.8" @@ -15994,6 +16381,19 @@ __metadata: languageName: node linkType: hard +"expect@npm:^29.7.0": + version: 29.7.0 + resolution: "expect@npm:29.7.0" + dependencies: + "@jest/expect-utils": ^29.7.0 + jest-get-type: ^29.6.3 + jest-matcher-utils: ^29.7.0 + jest-message-util: ^29.7.0 + jest-util: ^29.7.0 + checksum: 9257f10288e149b81254a0fda8ffe8d54a7061cd61d7515779998b012579d2b8c22354b0eb901daf0145f347403da582f75f359f4810c007182ad3fb318b5c0c + languageName: node + linkType: hard + "expo-application@npm:~4.0.0": version: 4.0.2 resolution: "expo-application@npm:4.0.2" @@ -16977,16 +17377,6 @@ __metadata: languageName: node linkType: hard -"from2@npm:^2.3.0": - version: 2.3.0 - resolution: "from2@npm:2.3.0" - dependencies: - inherits: ^2.0.1 - readable-stream: ^2.0.0 - checksum: 6080eba0793dce32f475141fb3d54cc15f84ee52e420ee22ac3ab0ad639dc95a1875bc6eb9c0e1140e94972a36a89dc5542491b85f1ab8df0c126241e0f1a61b - languageName: node - linkType: hard - "from@npm:~0": version: 0.1.7 resolution: "from@npm:0.1.7" @@ -18537,16 +18927,6 @@ __metadata: languageName: node linkType: hard -"into-stream@npm:^6.0.0": - version: 6.0.0 - resolution: "into-stream@npm:6.0.0" - dependencies: - from2: ^2.3.0 - p-is-promise: ^3.0.0 - checksum: 8df24c9eadd7cdd1cbc160bc20914b961dfd0ca29767785b69e698f799e85466b6f7c637d237dca1472d09d333399f70cc05a2fb8d08cb449dc9a80d92193980 - languageName: node - linkType: hard - "invariant@npm:^2.2.2, invariant@npm:^2.2.4": version: 2.2.4 resolution: "invariant@npm:2.2.4" @@ -19363,6 +19743,19 @@ __metadata: languageName: node linkType: hard +"istanbul-lib-instrument@npm:^6.0.0": + version: 6.0.2 + resolution: "istanbul-lib-instrument@npm:6.0.2" + dependencies: + "@babel/core": ^7.23.9 + "@babel/parser": ^7.23.9 + "@istanbuljs/schema": ^0.1.3 + istanbul-lib-coverage: ^3.2.0 + semver: ^7.5.4 + checksum: c10aa1e93a022f9767d7f41e6c07d244cc0a5c090fbb5522d70a5f21fcb98c52b7038850276c6fd1a7a17d1868c14a9d4eb8a24efe58a0ebb9a06f3da68131fe + languageName: node + linkType: hard + "istanbul-lib-report@npm:^3.0.0": version: 3.0.0 resolution: "istanbul-lib-report@npm:3.0.0" @@ -19459,6 +19852,17 @@ __metadata: languageName: node linkType: hard +"jest-changed-files@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-changed-files@npm:29.7.0" + dependencies: + execa: ^5.0.0 + jest-util: ^29.7.0 + p-limit: ^3.1.0 + checksum: 963e203893c396c5dfc75e00a49426688efea7361b0f0e040035809cecd2d46b3c01c02be2d9e8d38b1138357d2de7719ea5b5be21f66c10f2e9685a5a73bb99 + languageName: node + linkType: hard + "jest-circus@npm:^29.5.0": version: 29.5.0 resolution: "jest-circus@npm:29.5.0" @@ -19487,6 +19891,34 @@ __metadata: languageName: node linkType: hard +"jest-circus@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-circus@npm:29.7.0" + dependencies: + "@jest/environment": ^29.7.0 + "@jest/expect": ^29.7.0 + "@jest/test-result": ^29.7.0 + "@jest/types": ^29.6.3 + "@types/node": "*" + chalk: ^4.0.0 + co: ^4.6.0 + dedent: ^1.0.0 + is-generator-fn: ^2.0.0 + jest-each: ^29.7.0 + jest-matcher-utils: ^29.7.0 + jest-message-util: ^29.7.0 + jest-runtime: ^29.7.0 + jest-snapshot: ^29.7.0 + jest-util: ^29.7.0 + p-limit: ^3.1.0 + pretty-format: ^29.7.0 + pure-rand: ^6.0.0 + slash: ^3.0.0 + stack-utils: ^2.0.3 + checksum: 349437148924a5a109c9b8aad6d393a9591b4dac1918fc97d81b7fc515bc905af9918495055071404af1fab4e48e4b04ac3593477b1d5dcf48c4e71b527c70a7 + languageName: node + linkType: hard + "jest-cli@npm:^29.5.0": version: 29.5.0 resolution: "jest-cli@npm:29.5.0" @@ -19514,6 +19946,32 @@ __metadata: languageName: node linkType: hard +"jest-cli@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-cli@npm:29.7.0" + dependencies: + "@jest/core": ^29.7.0 + "@jest/test-result": ^29.7.0 + "@jest/types": ^29.6.3 + chalk: ^4.0.0 + create-jest: ^29.7.0 + exit: ^0.1.2 + import-local: ^3.0.2 + jest-config: ^29.7.0 + jest-util: ^29.7.0 + jest-validate: ^29.7.0 + yargs: ^17.3.1 + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + bin: + jest: bin/jest.js + checksum: 664901277a3f5007ea4870632ed6e7889db9da35b2434e7cb488443e6bf5513889b344b7fddf15112135495b9875892b156faeb2d7391ddb9e2a849dcb7b6c36 + languageName: node + linkType: hard + "jest-config@npm:^29.5.0": version: 29.5.0 resolution: "jest-config@npm:29.5.0" @@ -19552,7 +20010,45 @@ __metadata: languageName: node linkType: hard -"jest-diff@npm:^29.4.1": +"jest-config@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-config@npm:29.7.0" + dependencies: + "@babel/core": ^7.11.6 + "@jest/test-sequencer": ^29.7.0 + "@jest/types": ^29.6.3 + babel-jest: ^29.7.0 + chalk: ^4.0.0 + ci-info: ^3.2.0 + deepmerge: ^4.2.2 + glob: ^7.1.3 + graceful-fs: ^4.2.9 + jest-circus: ^29.7.0 + jest-environment-node: ^29.7.0 + jest-get-type: ^29.6.3 + jest-regex-util: ^29.6.3 + jest-resolve: ^29.7.0 + jest-runner: ^29.7.0 + jest-util: ^29.7.0 + jest-validate: ^29.7.0 + micromatch: ^4.0.4 + parse-json: ^5.2.0 + pretty-format: ^29.7.0 + slash: ^3.0.0 + strip-json-comments: ^3.1.1 + peerDependencies: + "@types/node": "*" + ts-node: ">=9.0.0" + peerDependenciesMeta: + "@types/node": + optional: true + ts-node: + optional: true + checksum: 4cabf8f894c180cac80b7df1038912a3fc88f96f2622de33832f4b3314f83e22b08fb751da570c0ab2b7988f21604bdabade95e3c0c041068ac578c085cf7dff + languageName: node + linkType: hard + +"jest-diff@npm:^29.4.1, jest-diff@npm:^29.7.0": version: 29.7.0 resolution: "jest-diff@npm:29.7.0" dependencies: @@ -19585,6 +20081,15 @@ __metadata: languageName: node linkType: hard +"jest-docblock@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-docblock@npm:29.7.0" + dependencies: + detect-newline: ^3.0.0 + checksum: 66390c3e9451f8d96c5da62f577a1dad701180cfa9b071c5025acab2f94d7a3efc2515cfa1654ebe707213241541ce9c5530232cdc8017c91ed64eea1bd3b192 + languageName: node + linkType: hard + "jest-each@npm:^29.5.0": version: 29.5.0 resolution: "jest-each@npm:29.5.0" @@ -19598,6 +20103,19 @@ __metadata: languageName: node linkType: hard +"jest-each@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-each@npm:29.7.0" + dependencies: + "@jest/types": ^29.6.3 + chalk: ^4.0.0 + jest-get-type: ^29.6.3 + jest-util: ^29.7.0 + pretty-format: ^29.7.0 + checksum: e88f99f0184000fc8813f2a0aa79e29deeb63700a3b9b7928b8a418d7d93cd24933608591dbbdea732b473eb2021c72991b5cc51a17966842841c6e28e6f691c + languageName: node + linkType: hard + "jest-environment-node@npm:^29.5.0": version: 29.5.0 resolution: "jest-environment-node@npm:29.5.0" @@ -19612,6 +20130,20 @@ __metadata: languageName: node linkType: hard +"jest-environment-node@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-environment-node@npm:29.7.0" + dependencies: + "@jest/environment": ^29.7.0 + "@jest/fake-timers": ^29.7.0 + "@jest/types": ^29.6.3 + "@types/node": "*" + jest-mock: ^29.7.0 + jest-util: ^29.7.0 + checksum: 501a9966292cbe0ca3f40057a37587cb6def25e1e0c5e39ac6c650fe78d3c70a2428304341d084ac0cced5041483acef41c477abac47e9a290d5545fd2f15646 + languageName: node + linkType: hard + "jest-get-type@npm:^26.3.0": version: 26.3.0 resolution: "jest-get-type@npm:26.3.0" @@ -19681,6 +20213,29 @@ __metadata: languageName: node linkType: hard +"jest-haste-map@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-haste-map@npm:29.7.0" + dependencies: + "@jest/types": ^29.6.3 + "@types/graceful-fs": ^4.1.3 + "@types/node": "*" + anymatch: ^3.0.3 + fb-watchman: ^2.0.0 + fsevents: ^2.3.2 + graceful-fs: ^4.2.9 + jest-regex-util: ^29.6.3 + jest-util: ^29.7.0 + jest-worker: ^29.7.0 + micromatch: ^4.0.4 + walker: ^1.0.8 + dependenciesMeta: + fsevents: + optional: true + checksum: c2c8f2d3e792a963940fbdfa563ce14ef9e14d4d86da645b96d3cd346b8d35c5ce0b992ee08593939b5f718cf0a1f5a90011a056548a1dbf58397d4356786f01 + languageName: node + linkType: hard + "jest-leak-detector@npm:^29.5.0": version: 29.5.0 resolution: "jest-leak-detector@npm:29.5.0" @@ -19691,6 +20246,16 @@ __metadata: languageName: node linkType: hard +"jest-leak-detector@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-leak-detector@npm:29.7.0" + dependencies: + jest-get-type: ^29.6.3 + pretty-format: ^29.7.0 + checksum: e3950e3ddd71e1d0c22924c51a300a1c2db6cf69ec1e51f95ccf424bcc070f78664813bef7aed4b16b96dfbdeea53fe358f8aeaaea84346ae15c3735758f1605 + languageName: node + linkType: hard + "jest-matcher-utils@npm:^29.5.0": version: 29.5.0 resolution: "jest-matcher-utils@npm:29.5.0" @@ -19703,6 +20268,18 @@ __metadata: languageName: node linkType: hard +"jest-matcher-utils@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-matcher-utils@npm:29.7.0" + dependencies: + chalk: ^4.0.0 + jest-diff: ^29.7.0 + jest-get-type: ^29.6.3 + pretty-format: ^29.7.0 + checksum: d7259e5f995d915e8a37a8fd494cb7d6af24cd2a287b200f831717ba0d015190375f9f5dc35393b8ba2aae9b2ebd60984635269c7f8cff7d85b077543b7744cd + languageName: node + linkType: hard + "jest-message-util@npm:^29.5.0": version: 29.5.0 resolution: "jest-message-util@npm:29.5.0" @@ -19720,6 +20297,23 @@ __metadata: languageName: node linkType: hard +"jest-message-util@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-message-util@npm:29.7.0" + dependencies: + "@babel/code-frame": ^7.12.13 + "@jest/types": ^29.6.3 + "@types/stack-utils": ^2.0.0 + chalk: ^4.0.0 + graceful-fs: ^4.2.9 + micromatch: ^4.0.4 + pretty-format: ^29.7.0 + slash: ^3.0.0 + stack-utils: ^2.0.3 + checksum: a9d025b1c6726a2ff17d54cc694de088b0489456c69106be6b615db7a51b7beb66788bea7a59991a019d924fbf20f67d085a445aedb9a4d6760363f4d7d09930 + languageName: node + linkType: hard + "jest-mock@npm:^29.5.0": version: 29.5.0 resolution: "jest-mock@npm:29.5.0" @@ -19731,6 +20325,17 @@ __metadata: languageName: node linkType: hard +"jest-mock@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-mock@npm:29.7.0" + dependencies: + "@jest/types": ^29.6.3 + "@types/node": "*" + jest-util: ^29.7.0 + checksum: 81ba9b68689a60be1482212878973700347cb72833c5e5af09895882b9eb5c4e02843a1bbdf23f94c52d42708bab53a30c45a3482952c9eec173d1eaac5b86c5 + languageName: node + linkType: hard + "jest-pnp-resolver@npm:^1.2.2": version: 1.2.3 resolution: "jest-pnp-resolver@npm:1.2.3" @@ -19757,6 +20362,13 @@ __metadata: languageName: node linkType: hard +"jest-regex-util@npm:^29.6.3": + version: 29.6.3 + resolution: "jest-regex-util@npm:29.6.3" + checksum: 0518beeb9bf1228261695e54f0feaad3606df26a19764bc19541e0fc6e2a3737191904607fb72f3f2ce85d9c16b28df79b7b1ec9443aa08c3ef0e9efda6f8f2a + languageName: node + linkType: hard + "jest-resolve-dependencies@npm:^29.5.0": version: 29.5.0 resolution: "jest-resolve-dependencies@npm:29.5.0" @@ -19767,6 +20379,16 @@ __metadata: languageName: node linkType: hard +"jest-resolve-dependencies@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-resolve-dependencies@npm:29.7.0" + dependencies: + jest-regex-util: ^29.6.3 + jest-snapshot: ^29.7.0 + checksum: aeb75d8150aaae60ca2bb345a0d198f23496494677cd6aefa26fc005faf354061f073982175daaf32b4b9d86b26ca928586344516e3e6969aa614cb13b883984 + languageName: node + linkType: hard + "jest-resolve@npm:^29.5.0": version: 29.5.0 resolution: "jest-resolve@npm:29.5.0" @@ -19784,6 +20406,23 @@ __metadata: languageName: node linkType: hard +"jest-resolve@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-resolve@npm:29.7.0" + dependencies: + chalk: ^4.0.0 + graceful-fs: ^4.2.9 + jest-haste-map: ^29.7.0 + jest-pnp-resolver: ^1.2.2 + jest-util: ^29.7.0 + jest-validate: ^29.7.0 + resolve: ^1.20.0 + resolve.exports: ^2.0.0 + slash: ^3.0.0 + checksum: 0ca218e10731aa17920526ec39deaec59ab9b966237905ffc4545444481112cd422f01581230eceb7e82d86f44a543d520a71391ec66e1b4ef1a578bd5c73487 + languageName: node + linkType: hard + "jest-runner@npm:^29.5.0": version: 29.5.0 resolution: "jest-runner@npm:29.5.0" @@ -19813,6 +20452,35 @@ __metadata: languageName: node linkType: hard +"jest-runner@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-runner@npm:29.7.0" + dependencies: + "@jest/console": ^29.7.0 + "@jest/environment": ^29.7.0 + "@jest/test-result": ^29.7.0 + "@jest/transform": ^29.7.0 + "@jest/types": ^29.6.3 + "@types/node": "*" + chalk: ^4.0.0 + emittery: ^0.13.1 + graceful-fs: ^4.2.9 + jest-docblock: ^29.7.0 + jest-environment-node: ^29.7.0 + jest-haste-map: ^29.7.0 + jest-leak-detector: ^29.7.0 + jest-message-util: ^29.7.0 + jest-resolve: ^29.7.0 + jest-runtime: ^29.7.0 + jest-util: ^29.7.0 + jest-watcher: ^29.7.0 + jest-worker: ^29.7.0 + p-limit: ^3.1.0 + source-map-support: 0.5.13 + checksum: f0405778ea64812bf9b5c50b598850d94ccf95d7ba21f090c64827b41decd680ee19fcbb494007cdd7f5d0d8906bfc9eceddd8fa583e753e736ecd462d4682fb + languageName: node + linkType: hard + "jest-runtime@npm:^29.5.0": version: 29.5.0 resolution: "jest-runtime@npm:29.5.0" @@ -19843,6 +20511,36 @@ __metadata: languageName: node linkType: hard +"jest-runtime@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-runtime@npm:29.7.0" + dependencies: + "@jest/environment": ^29.7.0 + "@jest/fake-timers": ^29.7.0 + "@jest/globals": ^29.7.0 + "@jest/source-map": ^29.6.3 + "@jest/test-result": ^29.7.0 + "@jest/transform": ^29.7.0 + "@jest/types": ^29.6.3 + "@types/node": "*" + chalk: ^4.0.0 + cjs-module-lexer: ^1.0.0 + collect-v8-coverage: ^1.0.0 + glob: ^7.1.3 + graceful-fs: ^4.2.9 + jest-haste-map: ^29.7.0 + jest-message-util: ^29.7.0 + jest-mock: ^29.7.0 + jest-regex-util: ^29.6.3 + jest-resolve: ^29.7.0 + jest-snapshot: ^29.7.0 + jest-util: ^29.7.0 + slash: ^3.0.0 + strip-bom: ^4.0.0 + checksum: d19f113d013e80691e07047f68e1e3448ef024ff2c6b586ce4f90cd7d4c62a2cd1d460110491019719f3c59bfebe16f0e201ed005ef9f80e2cf798c374eed54e + languageName: node + linkType: hard + "jest-serializer@npm:^26.6.2": version: 26.6.2 resolution: "jest-serializer@npm:26.6.2" @@ -19884,6 +20582,34 @@ __metadata: languageName: node linkType: hard +"jest-snapshot@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-snapshot@npm:29.7.0" + dependencies: + "@babel/core": ^7.11.6 + "@babel/generator": ^7.7.2 + "@babel/plugin-syntax-jsx": ^7.7.2 + "@babel/plugin-syntax-typescript": ^7.7.2 + "@babel/types": ^7.3.3 + "@jest/expect-utils": ^29.7.0 + "@jest/transform": ^29.7.0 + "@jest/types": ^29.6.3 + babel-preset-current-node-syntax: ^1.0.0 + chalk: ^4.0.0 + expect: ^29.7.0 + graceful-fs: ^4.2.9 + jest-diff: ^29.7.0 + jest-get-type: ^29.6.3 + jest-matcher-utils: ^29.7.0 + jest-message-util: ^29.7.0 + jest-util: ^29.7.0 + natural-compare: ^1.4.0 + pretty-format: ^29.7.0 + semver: ^7.5.3 + checksum: 86821c3ad0b6899521ce75ee1ae7b01b17e6dfeff9166f2cf17f012e0c5d8c798f30f9e4f8f7f5bed01ea7b55a6bc159f5eda778311162cbfa48785447c237ad + languageName: node + linkType: hard + "jest-util@npm:^26.6.2": version: 26.6.2 resolution: "jest-util@npm:26.6.2" @@ -19912,6 +20638,20 @@ __metadata: languageName: node linkType: hard +"jest-util@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-util@npm:29.7.0" + dependencies: + "@jest/types": ^29.6.3 + "@types/node": "*" + chalk: ^4.0.0 + ci-info: ^3.2.0 + graceful-fs: ^4.2.9 + picomatch: ^2.2.3 + checksum: 042ab4980f4ccd4d50226e01e5c7376a8556b472442ca6091a8f102488c0f22e6e8b89ea874111d2328a2080083bf3225c86f3788c52af0bd0345a00eb57a3ca + languageName: node + linkType: hard + "jest-validate@npm:^26.5.2": version: 26.6.2 resolution: "jest-validate@npm:26.6.2" @@ -19940,6 +20680,20 @@ __metadata: languageName: node linkType: hard +"jest-validate@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-validate@npm:29.7.0" + dependencies: + "@jest/types": ^29.6.3 + camelcase: ^6.2.0 + chalk: ^4.0.0 + jest-get-type: ^29.6.3 + leven: ^3.1.0 + pretty-format: ^29.7.0 + checksum: 191fcdc980f8a0de4dbdd879fa276435d00eb157a48683af7b3b1b98b0f7d9de7ffe12689b617779097ff1ed77601b9f7126b0871bba4f776e222c40f62e9dae + languageName: node + linkType: hard + "jest-watcher@npm:^29.5.0": version: 29.5.0 resolution: "jest-watcher@npm:29.5.0" @@ -19956,6 +20710,22 @@ __metadata: languageName: node linkType: hard +"jest-watcher@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-watcher@npm:29.7.0" + dependencies: + "@jest/test-result": ^29.7.0 + "@jest/types": ^29.6.3 + "@types/node": "*" + ansi-escapes: ^4.2.1 + chalk: ^4.0.0 + emittery: ^0.13.1 + jest-util: ^29.7.0 + string-length: ^4.0.1 + checksum: 67e6e7fe695416deff96b93a14a561a6db69389a0667e9489f24485bb85e5b54e12f3b2ba511ec0b777eca1e727235b073e3ebcdd473d68888650489f88df92f + languageName: node + linkType: hard + "jest-worker@npm:^26.0.0, jest-worker@npm:^26.2.1, jest-worker@npm:^26.6.2": version: 26.6.2 resolution: "jest-worker@npm:26.6.2" @@ -19990,6 +20760,18 @@ __metadata: languageName: node linkType: hard +"jest-worker@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-worker@npm:29.7.0" + dependencies: + "@types/node": "*" + jest-util: ^29.7.0 + merge-stream: ^2.0.0 + supports-color: ^8.0.0 + checksum: 30fff60af49675273644d408b650fc2eb4b5dcafc5a0a455f238322a8f9d8a98d847baca9d51ff197b6747f54c7901daa2287799230b856a0f48287d131f8c13 + languageName: node + linkType: hard + "jest@npm:^29.0.0": version: 29.5.0 resolution: "jest@npm:29.5.0" @@ -20009,6 +20791,25 @@ __metadata: languageName: node linkType: hard +"jest@npm:^29.7.0": + version: 29.7.0 + resolution: "jest@npm:29.7.0" + dependencies: + "@jest/core": ^29.7.0 + "@jest/types": ^29.6.3 + import-local: ^3.0.2 + jest-cli: ^29.7.0 + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + bin: + jest: bin/jest.js + checksum: 17ca8d67504a7dbb1998cf3c3077ec9031ba3eb512da8d71cb91bcabb2b8995c4e4b292b740cb9bf1cbff5ce3e110b3f7c777b0cefb6f41ab05445f248d0ee0b + languageName: node + linkType: hard + "jetifier@npm:^1.6.2": version: 1.6.8 resolution: "jetifier@npm:1.6.8" @@ -23446,7 +24247,7 @@ __metadata: languageName: node linkType: hard -"nock@npm:^13.1.0, nock@npm:^13.1.3": +"nock@npm:^13.1.0, nock@npm:^13.1.3, nock@npm:^13.5.4": version: 13.5.4 resolution: "nock@npm:13.5.4" dependencies: @@ -24581,13 +25382,6 @@ __metadata: languageName: node linkType: hard -"p-is-promise@npm:^3.0.0": - version: 3.0.0 - resolution: "p-is-promise@npm:3.0.0" - checksum: 74e511225fde5eeda7a120d51c60c284de90d68dec7c73611e7e59e8d1c44cc7e2246686544515849149b74ed0571ad470a456ac0d00314f8d03d2cc1ad43aae - languageName: node - linkType: hard - "p-limit@npm:^2.0.0, p-limit@npm:^2.2.0": version: 2.3.0 resolution: "p-limit@npm:2.3.0" @@ -26624,7 +27418,7 @@ __metadata: languageName: node linkType: hard -"readable-stream@npm:^2.0.0, readable-stream@npm:^2.0.1, readable-stream@npm:^2.2.2, readable-stream@npm:~2.3.6": +"readable-stream@npm:^2.0.1, readable-stream@npm:^2.2.2, readable-stream@npm:~2.3.6": version: 2.3.7 resolution: "readable-stream@npm:2.3.7" dependencies: From 9a66c5f4a665a609fda39b8cb3568a5b0dad1691 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Sun, 14 Apr 2024 23:36:06 +0200 Subject: [PATCH 11/29] fix node versions because https://github.com/nock/nock/issues/2595 the issue seems to have been introduced in node.js 20.10 https://github.com/taskcluster/taskcluster/issues/6923 --- .github/workflows/companion.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/companion.yml b/.github/workflows/companion.yml index ed6ab43437..dc4d9952a8 100644 --- a/.github/workflows/companion.yml +++ b/.github/workflows/companion.yml @@ -23,7 +23,9 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [18.x, 20.x, latest] + node-version: [18.x, 20.9.0] + # TODO instead once got upgraded to 13 + # node-version: [20.x, latest] steps: - name: Checkout sources uses: actions/checkout@v3 From dd151bfaabf0e179e6302e8a30a66b1e88deae43 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Tue, 16 Apr 2024 10:17:04 +0200 Subject: [PATCH 12/29] Update .github/workflows/companion.yml Co-authored-by: Antoine du Hamel --- .github/workflows/companion.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/companion.yml b/.github/workflows/companion.yml index dc4d9952a8..a1ed8cf996 100644 --- a/.github/workflows/companion.yml +++ b/.github/workflows/companion.yml @@ -24,7 +24,7 @@ jobs: strategy: matrix: node-version: [18.x, 20.9.0] - # TODO instead once got upgraded to 13 + # TODO instead once got upgraded to 14 # node-version: [20.x, latest] steps: - name: Checkout sources From 94f64572721e8ba9d7c338997ca32d5c12c7e9dd Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 17 Apr 2024 12:39:55 +0200 Subject: [PATCH 13/29] patch Nock to workaround bug with Node.js --- .github/workflows/companion.yml | 4 +--- .yarn/patches/nock-npm-13.5.4-2c4f77b249.patch | 13 +++++++++++++ package.json | 3 ++- yarn.lock | 13 ++++++++++++- 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 .yarn/patches/nock-npm-13.5.4-2c4f77b249.patch diff --git a/.github/workflows/companion.yml b/.github/workflows/companion.yml index a1ed8cf996..ed6ab43437 100644 --- a/.github/workflows/companion.yml +++ b/.github/workflows/companion.yml @@ -23,9 +23,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [18.x, 20.9.0] - # TODO instead once got upgraded to 14 - # node-version: [20.x, latest] + node-version: [18.x, 20.x, latest] steps: - name: Checkout sources uses: actions/checkout@v3 diff --git a/.yarn/patches/nock-npm-13.5.4-2c4f77b249.patch b/.yarn/patches/nock-npm-13.5.4-2c4f77b249.patch new file mode 100644 index 0000000000..74e50f2c75 --- /dev/null +++ b/.yarn/patches/nock-npm-13.5.4-2c4f77b249.patch @@ -0,0 +1,13 @@ +diff --git a/lib/intercepted_request_router.js b/lib/intercepted_request_router.js +index d82c2446b540759cbc54ad7b26222a80109b8ec9..bf24add845d12e436c97b3ea5e2e38f87b77d489 100644 +--- a/lib/intercepted_request_router.js ++++ b/lib/intercepted_request_router.js +@@ -68,7 +68,7 @@ class InterceptedRequestRouter { + // For parity with Node, it's important the socket event is emitted before we begin playback. + // This flag is set when playback is triggered if we haven't yet gotten the + // socket event to indicate that playback should start as soon as it comes in. +- this.readyToStartPlaybackOnSocketEvent = false ++ this.readyToStartPlaybackOnSocketEvent = true + + this.attachToReq() + diff --git a/package.json b/package.json index cd9ae0bdf1..23c904077f 100644 --- a/package.json +++ b/package.json @@ -180,6 +180,7 @@ "stylelint-config-rational-order": "patch:stylelint-config-rational-order@npm%3A0.1.2#./.yarn/patches/stylelint-config-rational-order-npm-0.1.2-d8336e84ed.patch", "uuid@^8.3.2": "patch:uuid@npm:8.3.2#.yarn/patches/uuid-npm-8.3.2-eca0baba53.patch", "tus-js-client": "patch:tus-js-client@npm%3A3.1.3#./.yarn/patches/tus-js-client-npm-3.1.3-dc57874d23.patch", - "resize-observer-polyfill": "patch:resize-observer-polyfill@npm%3A1.5.1#./.yarn/patches/resize-observer-polyfill-npm-1.5.1-603120e8a0.patch" + "resize-observer-polyfill": "patch:resize-observer-polyfill@npm%3A1.5.1#./.yarn/patches/resize-observer-polyfill-npm-1.5.1-603120e8a0.patch", + "nock": "patch:nock@npm%3A13.5.4#./.yarn/patches/nock-npm-13.5.4-2c4f77b249.patch" } } diff --git a/yarn.lock b/yarn.lock index 8688a22d8e..cfb09935cf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -24247,7 +24247,7 @@ __metadata: languageName: node linkType: hard -"nock@npm:^13.1.0, nock@npm:^13.1.3, nock@npm:^13.5.4": +"nock@npm:13.5.4": version: 13.5.4 resolution: "nock@npm:13.5.4" dependencies: @@ -24258,6 +24258,17 @@ __metadata: languageName: node linkType: hard +"nock@patch:nock@npm%3A13.5.4#./.yarn/patches/nock-npm-13.5.4-2c4f77b249.patch::locator=%40uppy-dev%2Fbuild%40workspace%3A.": + version: 13.5.4 + resolution: "nock@patch:nock@npm%3A13.5.4#./.yarn/patches/nock-npm-13.5.4-2c4f77b249.patch::version=13.5.4&hash=8a9abd&locator=%40uppy-dev%2Fbuild%40workspace%3A." + dependencies: + debug: ^4.1.0 + json-stringify-safe: ^5.0.1 + propagate: ^2.0.0 + checksum: fdd3760996dc48213779713a67bb9e1d21725d063dbca00a5f82c988f07f400c2bc1c2cf91ec4572273a0e68ed8f2eb0872cd926e3d7ab53e23f0725d25768eb + languageName: node + linkType: hard + "node-addon-api@npm:^3.0.0": version: 3.2.1 resolution: "node-addon-api@npm:3.2.1" From fb656eba8e73f4af7a853c16d3b0ee8b90cb333c Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 17 Apr 2024 12:53:04 +0200 Subject: [PATCH 14/29] order patches --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index e3282b60dc..5414b10abf 100644 --- a/package.json +++ b/package.json @@ -173,14 +173,14 @@ "@types/react": "^18", "@types/webpack-dev-server": "^4", "@vitest/utils": "patch:@vitest/utils@npm%3A1.2.1#./.yarn/patches/@vitest-utils-npm-1.2.1-3028846845.patch", + "nock": "patch:nock@npm%3A13.5.4#./.yarn/patches/nock-npm-13.5.4-2c4f77b249.patch", "p-queue": "patch:p-queue@npm%3A7.4.1#./.yarn/patches/p-queue-npm-7.4.1-e0cf0a6f17.patch", "pre-commit": "patch:pre-commit@npm:1.2.2#.yarn/patches/pre-commit-npm-1.2.2-f30af83877.patch", "preact": "patch:preact@npm:10.10.0#.yarn/patches/preact-npm-10.10.0-dd04de05e8.patch", + "resize-observer-polyfill": "patch:resize-observer-polyfill@npm%3A1.5.1#./.yarn/patches/resize-observer-polyfill-npm-1.5.1-603120e8a0.patch", "start-server-and-test": "patch:start-server-and-test@npm:1.14.0#.yarn/patches/start-server-and-test-npm-1.14.0-841aa34fdf.patch", "stylelint-config-rational-order": "patch:stylelint-config-rational-order@npm%3A0.1.2#./.yarn/patches/stylelint-config-rational-order-npm-0.1.2-d8336e84ed.patch", - "uuid@^8.3.2": "patch:uuid@npm:8.3.2#.yarn/patches/uuid-npm-8.3.2-eca0baba53.patch", "tus-js-client": "patch:tus-js-client@npm%3A3.1.3#./.yarn/patches/tus-js-client-npm-3.1.3-dc57874d23.patch", - "resize-observer-polyfill": "patch:resize-observer-polyfill@npm%3A1.5.1#./.yarn/patches/resize-observer-polyfill-npm-1.5.1-603120e8a0.patch", - "nock": "patch:nock@npm%3A13.5.4#./.yarn/patches/nock-npm-13.5.4-2c4f77b249.patch" + "uuid@^8.3.2": "patch:uuid@npm:8.3.2#.yarn/patches/uuid-npm-8.3.2-eca0baba53.patch" } } From 6bb7125905fbc169e1badcbf482592ef1ad60e1f Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 17 Apr 2024 12:56:31 +0200 Subject: [PATCH 15/29] Revert "fix form data" This reverts commit 5820c4388b009b5b627ebf24124ba91777657977. --- packages/@uppy/companion/package.json | 2 -- .../@uppy/companion/src/server/Uploader.js | 26 +++++-------------- .../companion/test/__tests__/uploader.js | 6 ++--- yarn.lock | 16 ------------ 4 files changed, 9 insertions(+), 41 deletions(-) diff --git a/packages/@uppy/companion/package.json b/packages/@uppy/companion/package.json index 11649e40fd..1a8f2aaeb2 100644 --- a/packages/@uppy/companion/package.json +++ b/packages/@uppy/companion/package.json @@ -47,8 +47,6 @@ "express-prom-bundle": "6.5.0", "express-request-id": "1.4.1", "express-session": "1.17.3", - "form-data-encoder": "^4.0.2", - "formdata-node": "^6.0.3", "got": "^13.0.0", "grant": "5.4.22", "helmet": "^4.6.0", diff --git a/packages/@uppy/companion/src/server/Uploader.js b/packages/@uppy/companion/src/server/Uploader.js index d481cd5cfa..46728543a7 100644 --- a/packages/@uppy/companion/src/server/Uploader.js +++ b/packages/@uppy/companion/src/server/Uploader.js @@ -1,4 +1,5 @@ // eslint-disable-next-line max-classes-per-file +const { blob } = require('node:stream/consumers'); const tus = require('tus-js-client') const { randomUUID } = require('node:crypto') const validator = require('validator') @@ -7,13 +8,6 @@ const { join } = require('node:path') const fs = require('node:fs') const { promisify } = require('node:util') const throttle = require('lodash/throttle') -const { Readable } = require('node:stream') - -// eslint-disable-next-line import/no-extraneous-dependencies -const formDataPromise = import('formdata-node') -// eslint-disable-next-line import/no-extraneous-dependencies -const formDataEncoderPromise = import('form-data-encoder') - const { Upload } = require('@aws-sdk/lib-storage') @@ -620,23 +614,17 @@ class Uploader { } if (this.options.useFormData) { - const { FormData } = await formDataPromise; const formData = new FormData() Object.entries(this.options.metadata).forEach(([key, value]) => formData.append(key, value)) - formData.set(this.options.fieldname, { - type: this.options.metadata.type, - name: this.uploadFileName, - [Symbol.toStringTag]: "File", - stream() { return stream } - }) - - const { FormDataEncoder } = await formDataEncoderPromise; - const encoder = new FormDataEncoder(formData) + formData.append( + this.options.fieldname, + // @ts-expect-error Node.js Blob is actually spec compliant + await blob(stream), + this.uploadFileName) - reqOptions.body = Readable.from(encoder) - reqOptions.headers['content-type'] = encoder.contentType + reqOptions.body = formData } else { reqOptions.headers['content-length'] = this.size reqOptions.body = stream diff --git a/packages/@uppy/companion/test/__tests__/uploader.js b/packages/@uppy/companion/test/__tests__/uploader.js index af83bf9363..ea24b14ce0 100644 --- a/packages/@uppy/companion/test/__tests__/uploader.js +++ b/packages/@uppy/companion/test/__tests__/uploader.js @@ -192,9 +192,7 @@ describe('uploader with tus protocol', () => { }) // eslint-disable-next-line max-len - const formDataNoMetaMatch = /^--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="files\[\]"; filename="uppy-file-[^"]+"\r\nContent-Type: application\/octet-stream\r\n\r\nSome file content\r\n--form-data-boundary-[a-z0-9]+--\r\n\r\n$/ - // eslint-disable-next-line max-len - const formDataWithMetaMatch = /^--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key1"\r\n\r\nnull\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key2"\r\n\r\ntrue\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key3"\r\n\r\n1234\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key4"\r\n\r\n\[object Object\]\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key5"\r\n\r\n\(\) => {}\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key6"\r\n\r\nSymbol\(\)\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="files\[\]"; filename="uppy-file-[^"]+"\r\nContent-Type: application\/octet-stream\r\n\r\nSome file content\r\n--form-data-boundary-[a-z0-9]+--\r\n\r\n$/ + const formDataNoMetaMatch = /^--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="files\[\]"; filename="uppy-file-[^"]+"\r\nContent-Type: application\/octet-stream\r\n\r\n$/ test('upload functions with xhr formdata', async () => { nock('http://localhost').post('/', formDataNoMetaMatch) @@ -216,7 +214,7 @@ describe('uploader with tus protocol', () => { // https://github.com/transloadit/uppy/issues/3477 test('upload functions with xhr formdata and metadata', async () => { // eslint-disable-next-line max-len - nock('http://localhost').post('/', formDataWithMetaMatch) + nock('http://localhost').post('/', /^--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key1"\r\n\r\n$/) .reply(200) const metadata = { diff --git a/yarn.lock b/yarn.lock index cfad687b9e..53128c3b84 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9832,8 +9832,6 @@ __metadata: express-prom-bundle: 6.5.0 express-request-id: 1.4.1 express-session: 1.17.3 - form-data-encoder: ^4.0.2 - formdata-node: ^6.0.3 got: ^13.0.0 grant: 5.4.22 helmet: ^4.6.0 @@ -17374,13 +17372,6 @@ __metadata: languageName: node linkType: hard -"form-data-encoder@npm:^4.0.2": - version: 4.0.2 - resolution: "form-data-encoder@npm:4.0.2" - checksum: 12769f21af2d750c20111f8a626560eaf613c2c62769d5924d9e5a44ba4ef52406f973844129151efd35533eb79ecf8e0b95b0839560e335204d2212efb9a9ef - languageName: node - linkType: hard - "form-data@npm:^2.5.0": version: 2.5.1 resolution: "form-data@npm:2.5.1" @@ -17421,13 +17412,6 @@ __metadata: languageName: node linkType: hard -"formdata-node@npm:^6.0.3": - version: 6.0.3 - resolution: "formdata-node@npm:6.0.3" - checksum: 0c404dad51aac1e570bef1c20b702da9f4facac9db889398d333ca92a7ae4ab8c005ad249e2df184870fe388aedfe28fc81e8a0aabda7295a19316c1fbaf7407 - languageName: node - linkType: hard - "formdata-polyfill@npm:^4.0.10": version: 4.0.10 resolution: "formdata-polyfill@npm:4.0.10" From 5140f07bd783a5e2988917956cedaab19d4e3acc Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 17 Apr 2024 13:10:09 +0200 Subject: [PATCH 16/29] nits --- packages/@uppy/companion/test/__tests__/companion.js | 2 +- packages/@uppy/companion/test/__tests__/uploader.js | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/@uppy/companion/test/__tests__/companion.js b/packages/@uppy/companion/test/__tests__/companion.js index 5e9553af36..5a9ed228b2 100644 --- a/packages/@uppy/companion/test/__tests__/companion.js +++ b/packages/@uppy/companion/test/__tests__/companion.js @@ -230,7 +230,7 @@ it('periodically pings', (done) => { getServer({ COMPANION_PERIODIC_PING_URLS: 'http://localhost/ping', COMPANION_PERIODIC_PING_STATIC_JSON_PAYLOAD: '{"some": "value"}', - COMPANION_PERIODIC_PING_INTERVAL: '100', + COMPANION_PERIODIC_PING_INTERVAL: '10', COMPANION_PERIODIC_PING_COUNT: '1', }) }, 3000) diff --git a/packages/@uppy/companion/test/__tests__/uploader.js b/packages/@uppy/companion/test/__tests__/uploader.js index ea24b14ce0..7ed33d0429 100644 --- a/packages/@uppy/companion/test/__tests__/uploader.js +++ b/packages/@uppy/companion/test/__tests__/uploader.js @@ -2,16 +2,15 @@ jest.mock('tus-js-client') +const { Readable } = require('node:stream') const fs = require('node:fs') const nock = require('nock') -const { Readable } = require('node:stream') const Uploader = require('../../src/server/Uploader') const socketClient = require('../mocksocket') const standalone = require('../../src/standalone') const Emitter = require('../../src/server/emitter') - afterAll(() => { nock.cleanAll() nock.restore() @@ -19,7 +18,6 @@ afterAll(() => { process.env.COMPANION_DATADIR = './test/output' process.env.COMPANION_DOMAIN = 'localhost:3020' -// process.env.COMPANION_STREAMING_UPLOAD = 'true' const { companionOptions } = standalone() describe('uploader with tus protocol', () => { @@ -207,8 +205,8 @@ describe('uploader with tus protocol', () => { nock('http://localhost').post('/', formDataNoMetaMatch) .reply(200) - const ret = await runMultipartTest({ useFormData: true, includeSize: false }) - expect(ret).toMatchObject({ url: null, extraData: { response: expect.anything(), bytesUploaded: 17 } }) + const ret = await runMultipartTest({ useFormData: true, includeSize: false }) + expect(ret).toMatchObject({ url: null, extraData: { response: expect.anything(), bytesUploaded: 17 } }) }) // https://github.com/transloadit/uppy/issues/3477 From 5b7f3c0267ed7ab93a376605b7b9f329e28a96a3 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 17 Apr 2024 14:01:12 +0200 Subject: [PATCH 17/29] add `Proxy` for got --- .../@uppy/companion/src/server/Uploader.js | 3 +- packages/@uppy/companion/src/server/got.js | 45 +++++++++++++++++-- .../companion/src/server/helpers/request.js | 2 +- packages/@uppy/companion/src/server/jobs.js | 2 +- .../src/server/provider/box/index.js | 2 +- .../src/server/provider/credentials.js | 2 +- .../src/server/provider/drive/index.js | 6 +-- .../src/server/provider/dropbox/index.js | 4 +- .../src/server/provider/facebook/index.js | 2 +- .../server/provider/instagram/graph/index.js | 2 +- .../src/server/provider/onedrive/index.js | 4 +- .../src/server/provider/unsplash/index.js | 4 +- .../src/server/provider/zoom/index.js | 6 +-- .../companion/test/__tests__/providers.js | 2 +- 14 files changed, 61 insertions(+), 25 deletions(-) diff --git a/packages/@uppy/companion/src/server/Uploader.js b/packages/@uppy/companion/src/server/Uploader.js index 46728543a7..5921422cab 100644 --- a/packages/@uppy/companion/src/server/Uploader.js +++ b/packages/@uppy/companion/src/server/Uploader.js @@ -632,9 +632,8 @@ class Uploader { try { const httpMethod = (this.options.httpMethod || '').toUpperCase() === 'PUT' ? 'put' : 'post' - const runRequest = (await got)[httpMethod] - const response = await runRequest(url, reqOptions) + const response = await got[httpMethod](url, reqOptions) if (bytesUploaded !== this.size) { const errMsg = `uploaded only ${bytesUploaded} of ${this.size} with status: ${response.statusCode}` diff --git a/packages/@uppy/companion/src/server/got.js b/packages/@uppy/companion/src/server/got.js index b761d7c6c0..508f6ff9a2 100644 --- a/packages/@uppy/companion/src/server/got.js +++ b/packages/@uppy/companion/src/server/got.js @@ -1,4 +1,41 @@ -// eslint-disable-next-line import/no-unresolved -const gotPromise = import('got') - -module.exports = gotPromise.then((got) => got.default) +const loadingModule = import('got').then(({ default: got }) => { + module.exports = got + return got + }) + + const handler = { + __proto__: null, + get(target, key) { + return async (...args) => { + const module = await loadingModule + let intermediate = module[target.key](...target.args) + if (key === 'then') intermediate = Promise.resolve(intermediate) + return intermediate[key](...args) + } + }, + } + + /** + * @typedef {typeof import('got')} + */ + module.exports = new Proxy( + {}, + { + // @ts-expect-error __proto__ is fine here. + __proto__: null, + get(target, key) { + return (...args) => { + return key === 'then' + ? loadingModule.then(...args) + : new Proxy( + { + key, + args, + }, + handler, + ) + } + }, + }, + ) + \ No newline at end of file diff --git a/packages/@uppy/companion/src/server/helpers/request.js b/packages/@uppy/companion/src/server/helpers/request.js index 9de9f5283d..9f1303fbac 100644 --- a/packages/@uppy/companion/src/server/helpers/request.js +++ b/packages/@uppy/companion/src/server/helpers/request.js @@ -93,7 +93,7 @@ async function getProtectedGot ({ blockLocalIPs }) { // @ts-ignore - return (await got).extend({ agent: { http: httpAgent, https: httpsAgent } }) + return got.extend({ agent: { http: httpAgent, https: httpsAgent } }) } module.exports.getProtectedGot = getProtectedGot diff --git a/packages/@uppy/companion/src/server/jobs.js b/packages/@uppy/companion/src/server/jobs.js index 68fde58210..b1dab62801 100644 --- a/packages/@uppy/companion/src/server/jobs.js +++ b/packages/@uppy/companion/src/server/jobs.js @@ -66,7 +66,7 @@ async function runPeriodicPing ({ urls, payload, requestTimeout }) { // Run requests in parallel await Promise.all(urls.map(async (url) => { try { - await (await got).post(url, { json: payload, timeout: { request: requestTimeout } }) + await got.post(url, { json: payload, timeout: { request: requestTimeout } }) } catch (err) { logger.warn(err, 'jobs.periodic.ping') } diff --git a/packages/@uppy/companion/src/server/provider/box/index.js b/packages/@uppy/companion/src/server/provider/box/index.js index 923884e35c..b858fa8d05 100644 --- a/packages/@uppy/companion/src/server/provider/box/index.js +++ b/packages/@uppy/companion/src/server/provider/box/index.js @@ -8,7 +8,7 @@ const got = require('../../got') const BOX_FILES_FIELDS = 'id,modified_at,name,permissions,size,type' const BOX_THUMBNAIL_SIZE = 256 -const getClient = async ({ token }) => (await got).extend({ +const getClient = async ({ token }) => got.extend({ prefixUrl: 'https://api.box.com/2.0', headers: { authorization: `Bearer ${token}`, diff --git a/packages/@uppy/companion/src/server/provider/credentials.js b/packages/@uppy/companion/src/server/provider/credentials.js index 166327fdd3..75e1291ed9 100644 --- a/packages/@uppy/companion/src/server/provider/credentials.js +++ b/packages/@uppy/companion/src/server/provider/credentials.js @@ -14,7 +14,7 @@ const got = require('../got') */ async function fetchKeys (url, providerName, credentialRequestParams) { try { - const { credentials } = await (await got).post(url, { + const { credentials } = await got.post(url, { json: { provider: providerName, parameters: credentialRequestParams }, }).json() diff --git a/packages/@uppy/companion/src/server/provider/drive/index.js b/packages/@uppy/companion/src/server/provider/drive/index.js index 95b4561b7e..220c8c1f63 100644 --- a/packages/@uppy/companion/src/server/provider/drive/index.js +++ b/packages/@uppy/companion/src/server/provider/drive/index.js @@ -21,14 +21,14 @@ const DRIVE_FILES_FIELDS = `kind,nextPageToken,incompleteSearch,files(${DRIVE_FI // using wildcard to get all 'drive' fields because specifying fields seems no to work for the /drives endpoint const SHARED_DRIVE_FIELDS = '*' -const getClient = async ({ token }) => (await got).extend({ +const getClient = async ({ token }) => got.extend({ prefixUrl: 'https://www.googleapis.com/drive/v3', headers: { authorization: `Bearer ${token}`, }, }) -const getOauthClient = async () => (await got).extend({ +const getOauthClient = async () => got.extend({ prefixUrl: 'https://oauth2.googleapis.com', }) @@ -178,7 +178,7 @@ class Drive extends Provider { logout ({ token }) { return this.#withErrorHandling('provider.drive.logout.error', async () => { - await (await got).post('https://accounts.google.com/o/oauth2/revoke', { + await got.post('https://accounts.google.com/o/oauth2/revoke', { searchParams: { token }, responseType: 'json', }) diff --git a/packages/@uppy/companion/src/server/provider/dropbox/index.js b/packages/@uppy/companion/src/server/provider/dropbox/index.js index 236bb0419c..cb633b5aef 100644 --- a/packages/@uppy/companion/src/server/provider/dropbox/index.js +++ b/packages/@uppy/companion/src/server/provider/dropbox/index.js @@ -18,14 +18,14 @@ function httpHeaderSafeJson (v) { }) } -const getClient = async ({ token }) => (await got).extend({ +const getClient = async ({ token }) => got.extend({ prefixUrl: 'https://api.dropboxapi.com/2', headers: { authorization: `Bearer ${token}`, }, }) -const getOauthClient = async () => (await got).extend({ +const getOauthClient = async () => got.extend({ prefixUrl: 'https://api.dropboxapi.com/oauth2', }) diff --git a/packages/@uppy/companion/src/server/provider/facebook/index.js b/packages/@uppy/companion/src/server/provider/facebook/index.js index 22e6367137..9d83c5e200 100644 --- a/packages/@uppy/companion/src/server/provider/facebook/index.js +++ b/packages/@uppy/companion/src/server/provider/facebook/index.js @@ -7,7 +7,7 @@ const { prepareStream } = require('../../helpers/utils') const got = require('../../got') -const getClient = async ({ token }) => (await got).extend({ +const getClient = async ({ token }) => got.extend({ prefixUrl: 'https://graph.facebook.com', headers: { authorization: `Bearer ${token}`, diff --git a/packages/@uppy/companion/src/server/provider/instagram/graph/index.js b/packages/@uppy/companion/src/server/provider/instagram/graph/index.js index 13c52aa055..78435fdab9 100644 --- a/packages/@uppy/companion/src/server/provider/instagram/graph/index.js +++ b/packages/@uppy/companion/src/server/provider/instagram/graph/index.js @@ -7,7 +7,7 @@ const { prepareStream } = require('../../../helpers/utils') const got = require('../../../got') -const getClient = async ({ token }) => (await got).extend({ +const getClient = async ({ token }) => got.extend({ prefixUrl: 'https://graph.instagram.com', headers: { authorization: `Bearer ${token}`, diff --git a/packages/@uppy/companion/src/server/provider/onedrive/index.js b/packages/@uppy/companion/src/server/provider/onedrive/index.js index 2d89efaf23..99c0b3c59a 100644 --- a/packages/@uppy/companion/src/server/provider/onedrive/index.js +++ b/packages/@uppy/companion/src/server/provider/onedrive/index.js @@ -6,14 +6,14 @@ const { prepareStream } = require('../../helpers/utils') const got = require('../../got') -const getClient = async ({ token }) => (await got).extend({ +const getClient = async ({ token }) => got.extend({ prefixUrl: 'https://graph.microsoft.com/v1.0', headers: { authorization: `Bearer ${token}`, }, }) -const getOauthClient = async () => (await got).extend({ +const getOauthClient = async () => got.extend({ prefixUrl: 'https://login.live.com', }) diff --git a/packages/@uppy/companion/src/server/provider/unsplash/index.js b/packages/@uppy/companion/src/server/provider/unsplash/index.js index 77c0d5c001..6fe7c2cbec 100644 --- a/packages/@uppy/companion/src/server/provider/unsplash/index.js +++ b/packages/@uppy/companion/src/server/provider/unsplash/index.js @@ -9,7 +9,7 @@ const got = require('../../got') const BASE_URL = 'https://api.unsplash.com' -const getClient = async ({ token }) => (await got).extend({ +const getClient = async ({ token }) => got.extend({ prefixUrl: BASE_URL, headers: { authorization: `Client-ID ${token}`, @@ -42,7 +42,7 @@ class Unsplash extends Provider { const { links: { download: url, download_location: attributionUrl } } = await getPhotoMeta(client, id) - const stream = (await got).stream.get(url, { responseType: 'json' }) + const stream = got.stream.get(url, { responseType: 'json' }) await prepareStream(stream) // To attribute the author of the image, we call the `download_location` diff --git a/packages/@uppy/companion/src/server/provider/zoom/index.js b/packages/@uppy/companion/src/server/provider/zoom/index.js index 7cf2284185..4d3ed86205 100644 --- a/packages/@uppy/companion/src/server/provider/zoom/index.js +++ b/packages/@uppy/companion/src/server/provider/zoom/index.js @@ -11,7 +11,7 @@ const BASE_URL = 'https://zoom.us/v2' const PAGE_SIZE = 300 const DEAUTH_EVENT_NAME = 'app_deauthorized' -const getClient = async ({ token }) => (await got).extend({ +const getClient = async ({ token }) => got.extend({ prefixUrl: BASE_URL, headers: { authorization: `Bearer ${token}`, @@ -114,7 +114,7 @@ class Zoom extends Provider { return this.#withErrorHandling('provider.zoom.logout.error', async () => { const { key, secret } = await companion.getProviderCredentials() - const { status } = await (await got).post('https://zoom.us/oauth/revoke', { + const { status } = await got.post('https://zoom.us/oauth/revoke', { searchParams: { token }, headers: { Authorization: getBasicAuthHeader(key, secret) }, responseType: 'json', @@ -137,7 +137,7 @@ class Zoom extends Provider { return { data: {}, status: 400 } } - await (await got).post('https://api.zoom.us/oauth/data/compliance', { + await got.post('https://api.zoom.us/oauth/data/compliance', { headers: { Authorization: getBasicAuthHeader(key, secret) }, json: { client_id: key, diff --git a/packages/@uppy/companion/test/__tests__/providers.js b/packages/@uppy/companion/test/__tests__/providers.js index 98c472e55e..530df82961 100644 --- a/packages/@uppy/companion/test/__tests__/providers.js +++ b/packages/@uppy/companion/test/__tests__/providers.js @@ -295,7 +295,7 @@ describe('list provider files', () => { }) }) -describe('provider file gets downloaded from', () => { +describe.only('provider file gets downloaded from', () => { async function runTest (providerName) { const providerFixtures = fixtures.providers[providerName].expects const res = await request(authServer) From 9b1d2026698e2850a094005c943aa7b5889b3219 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 17 Apr 2024 14:03:16 +0200 Subject: [PATCH 18/29] Update packages/@uppy/companion/src/server/got.js --- packages/@uppy/companion/src/server/got.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/@uppy/companion/src/server/got.js b/packages/@uppy/companion/src/server/got.js index 508f6ff9a2..b55d748003 100644 --- a/packages/@uppy/companion/src/server/got.js +++ b/packages/@uppy/companion/src/server/got.js @@ -37,5 +37,4 @@ const loadingModule = import('got').then(({ default: got }) => { } }, }, - ) - \ No newline at end of file + ) \ No newline at end of file From 498a4423501df7fb372c77e940b40f2f22996c4c Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 17 Apr 2024 15:27:11 +0200 Subject: [PATCH 19/29] Revert "Update packages/@uppy/companion/src/server/got.js" This reverts commit 9b1d2026698e2850a094005c943aa7b5889b3219. --- packages/@uppy/companion/src/server/got.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/@uppy/companion/src/server/got.js b/packages/@uppy/companion/src/server/got.js index b55d748003..508f6ff9a2 100644 --- a/packages/@uppy/companion/src/server/got.js +++ b/packages/@uppy/companion/src/server/got.js @@ -37,4 +37,5 @@ const loadingModule = import('got').then(({ default: got }) => { } }, }, - ) \ No newline at end of file + ) + \ No newline at end of file From 6e94908d02983dcd1bcb1d5c58c59a99a2789787 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 17 Apr 2024 15:27:12 +0200 Subject: [PATCH 20/29] Revert "add `Proxy` for got" This reverts commit 5b7f3c0267ed7ab93a376605b7b9f329e28a96a3. --- .../@uppy/companion/src/server/Uploader.js | 3 +- packages/@uppy/companion/src/server/got.js | 45 ++----------------- .../companion/src/server/helpers/request.js | 2 +- packages/@uppy/companion/src/server/jobs.js | 2 +- .../src/server/provider/box/index.js | 2 +- .../src/server/provider/credentials.js | 2 +- .../src/server/provider/drive/index.js | 6 +-- .../src/server/provider/dropbox/index.js | 4 +- .../src/server/provider/facebook/index.js | 2 +- .../server/provider/instagram/graph/index.js | 2 +- .../src/server/provider/onedrive/index.js | 4 +- .../src/server/provider/unsplash/index.js | 4 +- .../src/server/provider/zoom/index.js | 6 +-- .../companion/test/__tests__/providers.js | 2 +- 14 files changed, 25 insertions(+), 61 deletions(-) diff --git a/packages/@uppy/companion/src/server/Uploader.js b/packages/@uppy/companion/src/server/Uploader.js index 5921422cab..46728543a7 100644 --- a/packages/@uppy/companion/src/server/Uploader.js +++ b/packages/@uppy/companion/src/server/Uploader.js @@ -632,8 +632,9 @@ class Uploader { try { const httpMethod = (this.options.httpMethod || '').toUpperCase() === 'PUT' ? 'put' : 'post' + const runRequest = (await got)[httpMethod] - const response = await got[httpMethod](url, reqOptions) + const response = await runRequest(url, reqOptions) if (bytesUploaded !== this.size) { const errMsg = `uploaded only ${bytesUploaded} of ${this.size} with status: ${response.statusCode}` diff --git a/packages/@uppy/companion/src/server/got.js b/packages/@uppy/companion/src/server/got.js index 508f6ff9a2..b761d7c6c0 100644 --- a/packages/@uppy/companion/src/server/got.js +++ b/packages/@uppy/companion/src/server/got.js @@ -1,41 +1,4 @@ -const loadingModule = import('got').then(({ default: got }) => { - module.exports = got - return got - }) - - const handler = { - __proto__: null, - get(target, key) { - return async (...args) => { - const module = await loadingModule - let intermediate = module[target.key](...target.args) - if (key === 'then') intermediate = Promise.resolve(intermediate) - return intermediate[key](...args) - } - }, - } - - /** - * @typedef {typeof import('got')} - */ - module.exports = new Proxy( - {}, - { - // @ts-expect-error __proto__ is fine here. - __proto__: null, - get(target, key) { - return (...args) => { - return key === 'then' - ? loadingModule.then(...args) - : new Proxy( - { - key, - args, - }, - handler, - ) - } - }, - }, - ) - \ No newline at end of file +// eslint-disable-next-line import/no-unresolved +const gotPromise = import('got') + +module.exports = gotPromise.then((got) => got.default) diff --git a/packages/@uppy/companion/src/server/helpers/request.js b/packages/@uppy/companion/src/server/helpers/request.js index 9f1303fbac..9de9f5283d 100644 --- a/packages/@uppy/companion/src/server/helpers/request.js +++ b/packages/@uppy/companion/src/server/helpers/request.js @@ -93,7 +93,7 @@ async function getProtectedGot ({ blockLocalIPs }) { // @ts-ignore - return got.extend({ agent: { http: httpAgent, https: httpsAgent } }) + return (await got).extend({ agent: { http: httpAgent, https: httpsAgent } }) } module.exports.getProtectedGot = getProtectedGot diff --git a/packages/@uppy/companion/src/server/jobs.js b/packages/@uppy/companion/src/server/jobs.js index b1dab62801..68fde58210 100644 --- a/packages/@uppy/companion/src/server/jobs.js +++ b/packages/@uppy/companion/src/server/jobs.js @@ -66,7 +66,7 @@ async function runPeriodicPing ({ urls, payload, requestTimeout }) { // Run requests in parallel await Promise.all(urls.map(async (url) => { try { - await got.post(url, { json: payload, timeout: { request: requestTimeout } }) + await (await got).post(url, { json: payload, timeout: { request: requestTimeout } }) } catch (err) { logger.warn(err, 'jobs.periodic.ping') } diff --git a/packages/@uppy/companion/src/server/provider/box/index.js b/packages/@uppy/companion/src/server/provider/box/index.js index b858fa8d05..923884e35c 100644 --- a/packages/@uppy/companion/src/server/provider/box/index.js +++ b/packages/@uppy/companion/src/server/provider/box/index.js @@ -8,7 +8,7 @@ const got = require('../../got') const BOX_FILES_FIELDS = 'id,modified_at,name,permissions,size,type' const BOX_THUMBNAIL_SIZE = 256 -const getClient = async ({ token }) => got.extend({ +const getClient = async ({ token }) => (await got).extend({ prefixUrl: 'https://api.box.com/2.0', headers: { authorization: `Bearer ${token}`, diff --git a/packages/@uppy/companion/src/server/provider/credentials.js b/packages/@uppy/companion/src/server/provider/credentials.js index 75e1291ed9..166327fdd3 100644 --- a/packages/@uppy/companion/src/server/provider/credentials.js +++ b/packages/@uppy/companion/src/server/provider/credentials.js @@ -14,7 +14,7 @@ const got = require('../got') */ async function fetchKeys (url, providerName, credentialRequestParams) { try { - const { credentials } = await got.post(url, { + const { credentials } = await (await got).post(url, { json: { provider: providerName, parameters: credentialRequestParams }, }).json() diff --git a/packages/@uppy/companion/src/server/provider/drive/index.js b/packages/@uppy/companion/src/server/provider/drive/index.js index 220c8c1f63..95b4561b7e 100644 --- a/packages/@uppy/companion/src/server/provider/drive/index.js +++ b/packages/@uppy/companion/src/server/provider/drive/index.js @@ -21,14 +21,14 @@ const DRIVE_FILES_FIELDS = `kind,nextPageToken,incompleteSearch,files(${DRIVE_FI // using wildcard to get all 'drive' fields because specifying fields seems no to work for the /drives endpoint const SHARED_DRIVE_FIELDS = '*' -const getClient = async ({ token }) => got.extend({ +const getClient = async ({ token }) => (await got).extend({ prefixUrl: 'https://www.googleapis.com/drive/v3', headers: { authorization: `Bearer ${token}`, }, }) -const getOauthClient = async () => got.extend({ +const getOauthClient = async () => (await got).extend({ prefixUrl: 'https://oauth2.googleapis.com', }) @@ -178,7 +178,7 @@ class Drive extends Provider { logout ({ token }) { return this.#withErrorHandling('provider.drive.logout.error', async () => { - await got.post('https://accounts.google.com/o/oauth2/revoke', { + await (await got).post('https://accounts.google.com/o/oauth2/revoke', { searchParams: { token }, responseType: 'json', }) diff --git a/packages/@uppy/companion/src/server/provider/dropbox/index.js b/packages/@uppy/companion/src/server/provider/dropbox/index.js index cb633b5aef..236bb0419c 100644 --- a/packages/@uppy/companion/src/server/provider/dropbox/index.js +++ b/packages/@uppy/companion/src/server/provider/dropbox/index.js @@ -18,14 +18,14 @@ function httpHeaderSafeJson (v) { }) } -const getClient = async ({ token }) => got.extend({ +const getClient = async ({ token }) => (await got).extend({ prefixUrl: 'https://api.dropboxapi.com/2', headers: { authorization: `Bearer ${token}`, }, }) -const getOauthClient = async () => got.extend({ +const getOauthClient = async () => (await got).extend({ prefixUrl: 'https://api.dropboxapi.com/oauth2', }) diff --git a/packages/@uppy/companion/src/server/provider/facebook/index.js b/packages/@uppy/companion/src/server/provider/facebook/index.js index 9d83c5e200..22e6367137 100644 --- a/packages/@uppy/companion/src/server/provider/facebook/index.js +++ b/packages/@uppy/companion/src/server/provider/facebook/index.js @@ -7,7 +7,7 @@ const { prepareStream } = require('../../helpers/utils') const got = require('../../got') -const getClient = async ({ token }) => got.extend({ +const getClient = async ({ token }) => (await got).extend({ prefixUrl: 'https://graph.facebook.com', headers: { authorization: `Bearer ${token}`, diff --git a/packages/@uppy/companion/src/server/provider/instagram/graph/index.js b/packages/@uppy/companion/src/server/provider/instagram/graph/index.js index 78435fdab9..13c52aa055 100644 --- a/packages/@uppy/companion/src/server/provider/instagram/graph/index.js +++ b/packages/@uppy/companion/src/server/provider/instagram/graph/index.js @@ -7,7 +7,7 @@ const { prepareStream } = require('../../../helpers/utils') const got = require('../../../got') -const getClient = async ({ token }) => got.extend({ +const getClient = async ({ token }) => (await got).extend({ prefixUrl: 'https://graph.instagram.com', headers: { authorization: `Bearer ${token}`, diff --git a/packages/@uppy/companion/src/server/provider/onedrive/index.js b/packages/@uppy/companion/src/server/provider/onedrive/index.js index 99c0b3c59a..2d89efaf23 100644 --- a/packages/@uppy/companion/src/server/provider/onedrive/index.js +++ b/packages/@uppy/companion/src/server/provider/onedrive/index.js @@ -6,14 +6,14 @@ const { prepareStream } = require('../../helpers/utils') const got = require('../../got') -const getClient = async ({ token }) => got.extend({ +const getClient = async ({ token }) => (await got).extend({ prefixUrl: 'https://graph.microsoft.com/v1.0', headers: { authorization: `Bearer ${token}`, }, }) -const getOauthClient = async () => got.extend({ +const getOauthClient = async () => (await got).extend({ prefixUrl: 'https://login.live.com', }) diff --git a/packages/@uppy/companion/src/server/provider/unsplash/index.js b/packages/@uppy/companion/src/server/provider/unsplash/index.js index 6fe7c2cbec..77c0d5c001 100644 --- a/packages/@uppy/companion/src/server/provider/unsplash/index.js +++ b/packages/@uppy/companion/src/server/provider/unsplash/index.js @@ -9,7 +9,7 @@ const got = require('../../got') const BASE_URL = 'https://api.unsplash.com' -const getClient = async ({ token }) => got.extend({ +const getClient = async ({ token }) => (await got).extend({ prefixUrl: BASE_URL, headers: { authorization: `Client-ID ${token}`, @@ -42,7 +42,7 @@ class Unsplash extends Provider { const { links: { download: url, download_location: attributionUrl } } = await getPhotoMeta(client, id) - const stream = got.stream.get(url, { responseType: 'json' }) + const stream = (await got).stream.get(url, { responseType: 'json' }) await prepareStream(stream) // To attribute the author of the image, we call the `download_location` diff --git a/packages/@uppy/companion/src/server/provider/zoom/index.js b/packages/@uppy/companion/src/server/provider/zoom/index.js index 4d3ed86205..7cf2284185 100644 --- a/packages/@uppy/companion/src/server/provider/zoom/index.js +++ b/packages/@uppy/companion/src/server/provider/zoom/index.js @@ -11,7 +11,7 @@ const BASE_URL = 'https://zoom.us/v2' const PAGE_SIZE = 300 const DEAUTH_EVENT_NAME = 'app_deauthorized' -const getClient = async ({ token }) => got.extend({ +const getClient = async ({ token }) => (await got).extend({ prefixUrl: BASE_URL, headers: { authorization: `Bearer ${token}`, @@ -114,7 +114,7 @@ class Zoom extends Provider { return this.#withErrorHandling('provider.zoom.logout.error', async () => { const { key, secret } = await companion.getProviderCredentials() - const { status } = await got.post('https://zoom.us/oauth/revoke', { + const { status } = await (await got).post('https://zoom.us/oauth/revoke', { searchParams: { token }, headers: { Authorization: getBasicAuthHeader(key, secret) }, responseType: 'json', @@ -137,7 +137,7 @@ class Zoom extends Provider { return { data: {}, status: 400 } } - await got.post('https://api.zoom.us/oauth/data/compliance', { + await (await got).post('https://api.zoom.us/oauth/data/compliance', { headers: { Authorization: getBasicAuthHeader(key, secret) }, json: { client_id: key, diff --git a/packages/@uppy/companion/test/__tests__/providers.js b/packages/@uppy/companion/test/__tests__/providers.js index 530df82961..98c472e55e 100644 --- a/packages/@uppy/companion/test/__tests__/providers.js +++ b/packages/@uppy/companion/test/__tests__/providers.js @@ -295,7 +295,7 @@ describe('list provider files', () => { }) }) -describe.only('provider file gets downloaded from', () => { +describe('provider file gets downloaded from', () => { async function runTest (providerName) { const providerFixtures = fixtures.providers[providerName].expects const res = await request(authServer) From 232920f0fddfad06cacb75fabcd600bddd550f42 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 18 Apr 2024 17:00:57 +0200 Subject: [PATCH 21/29] fix incomplete bodies reported by Nock --- .yarn/patches/nock-npm-13.5.4-2c4f77b249.patch | 2 +- packages/@uppy/companion/test/__tests__/uploader.js | 10 ++++++---- yarn.lock | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.yarn/patches/nock-npm-13.5.4-2c4f77b249.patch b/.yarn/patches/nock-npm-13.5.4-2c4f77b249.patch index 74e50f2c75..6a9838ea85 100644 --- a/.yarn/patches/nock-npm-13.5.4-2c4f77b249.patch +++ b/.yarn/patches/nock-npm-13.5.4-2c4f77b249.patch @@ -7,7 +7,7 @@ index d82c2446b540759cbc54ad7b26222a80109b8ec9..bf24add845d12e436c97b3ea5e2e38f8 // This flag is set when playback is triggered if we haven't yet gotten the // socket event to indicate that playback should start as soon as it comes in. - this.readyToStartPlaybackOnSocketEvent = false -+ this.readyToStartPlaybackOnSocketEvent = true ++ this.readyToStartPlaybackOnSocketEvent = 'UPPY_TEST_DO_NOT_WAIT_FOR_COMPLETE_BODY' in process.env this.attachToReq() diff --git a/packages/@uppy/companion/test/__tests__/uploader.js b/packages/@uppy/companion/test/__tests__/uploader.js index 7ed33d0429..3b4504255d 100644 --- a/packages/@uppy/companion/test/__tests__/uploader.js +++ b/packages/@uppy/companion/test/__tests__/uploader.js @@ -18,6 +18,7 @@ afterAll(() => { process.env.COMPANION_DATADIR = './test/output' process.env.COMPANION_DOMAIN = 'localhost:3020' +process.env.UPPY_TEST_DO_NOT_WAIT_FOR_COMPLETE_BODY = true // workaround a limitation in Nock+got+Node.js 20.9+ const { companionOptions } = standalone() describe('uploader with tus protocol', () => { @@ -190,9 +191,10 @@ describe('uploader with tus protocol', () => { }) // eslint-disable-next-line max-len - const formDataNoMetaMatch = /^--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="files\[\]"; filename="uppy-file-[^"]+"\r\nContent-Type: application\/octet-stream\r\n\r\n$/ + const formDataNoMetaMatch = /^--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="files\[\]"; filename="uppy-file-[^"]+"\r\nContent-Type: application\/octet-stream\r\n\r\nSome file content\r\n--form-data-boundary-[a-z0-9]+--\r\n\r\n$/ test('upload functions with xhr formdata', async () => { + delete process.env.UPPY_TEST_DO_NOT_WAIT_FOR_COMPLETE_BODY nock('http://localhost').post('/', formDataNoMetaMatch) .reply(200) @@ -201,7 +203,7 @@ describe('uploader with tus protocol', () => { }) test('upload functions with unknown file size', async () => { - // eslint-disable-next-line max-len + delete process.env.UPPY_TEST_DO_NOT_WAIT_FOR_COMPLETE_BODY nock('http://localhost').post('/', formDataNoMetaMatch) .reply(200) @@ -211,8 +213,8 @@ describe('uploader with tus protocol', () => { // https://github.com/transloadit/uppy/issues/3477 test('upload functions with xhr formdata and metadata', async () => { - // eslint-disable-next-line max-len - nock('http://localhost').post('/', /^--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key1"\r\n\r\n$/) + delete process.env.UPPY_TEST_DO_NOT_WAIT_FOR_COMPLETE_BODY + nock('http://localhost').post('/', /^--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key1"\r\n\r\nnull\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key2"\r\n\r\ntrue\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key3"\r\n\r\n\d+\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key4"\r\n\r\n\[object Object\]\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key5"\r\n\r\n\(\) => \{\}\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key6"\r\n\r\nSymbol\(\)\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="files\[\]"; filename="uppy-file-[^"]+"\r\nContent-Type: application\/octet-stream\r\n\r\nSome file content\r\n--form-data-boundary-[a-z0-9]+--\r\n\r\n$/) .reply(200) const metadata = { diff --git a/yarn.lock b/yarn.lock index 53128c3b84..9c9c474989 100644 --- a/yarn.lock +++ b/yarn.lock @@ -24373,12 +24373,12 @@ __metadata: "nock@patch:nock@npm%3A13.5.4#./.yarn/patches/nock-npm-13.5.4-2c4f77b249.patch::locator=%40uppy-dev%2Fbuild%40workspace%3A.": version: 13.5.4 - resolution: "nock@patch:nock@npm%3A13.5.4#./.yarn/patches/nock-npm-13.5.4-2c4f77b249.patch::version=13.5.4&hash=8a9abd&locator=%40uppy-dev%2Fbuild%40workspace%3A." + resolution: "nock@patch:nock@npm%3A13.5.4#./.yarn/patches/nock-npm-13.5.4-2c4f77b249.patch::version=13.5.4&hash=3af473&locator=%40uppy-dev%2Fbuild%40workspace%3A." dependencies: debug: ^4.1.0 json-stringify-safe: ^5.0.1 propagate: ^2.0.0 - checksum: fdd3760996dc48213779713a67bb9e1d21725d063dbca00a5f82c988f07f400c2bc1c2cf91ec4572273a0e68ed8f2eb0872cd926e3d7ab53e23f0725d25768eb + checksum: ec5476a5c4bba1a976499533e1aee26edbc9b0fbf41d4b6443edac696cd70b6f0d50e1f19f1536cd6dd709c262af8a8727955fc7387919d196517cbb42f200fe languageName: node linkType: hard From bf1754c2aba02d9d0d3aee19ce4958676c2349d9 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 18 Apr 2024 17:15:59 +0200 Subject: [PATCH 22/29] remove unrelated changes --- package.json | 2 - yarn.lock | 828 +-------------------------------------------------- 2 files changed, 3 insertions(+), 827 deletions(-) diff --git a/package.json b/package.json index 5414b10abf..633252fe5e 100644 --- a/package.json +++ b/package.json @@ -84,11 +84,9 @@ "eslint-plugin-unicorn": "^46.0.0", "github-contributors-list": "^1.2.4", "glob": "^8.0.0", - "jest": "^29.7.0", "jsdom": "^22.1.0", "lint-staged": "^13.0.0", "mime-types": "^2.1.26", - "nock": "^13.5.4", "nodemon": "^2.0.8", "npm-packlist": "^5.0.0", "npm-run-all": "^4.1.5", diff --git a/yarn.lock b/yarn.lock index 9c9c474989..6263d1536d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2033,16 +2033,6 @@ __metadata: languageName: node linkType: hard -"@babel/code-frame@npm:^7.24.1, @babel/code-frame@npm:^7.24.2": - version: 7.24.2 - resolution: "@babel/code-frame@npm:7.24.2" - dependencies: - "@babel/highlight": ^7.24.2 - picocolors: ^1.0.0 - checksum: 70e867340cfe09ca5488b2f36372c45cabf43c79a5b6426e6df5ef0611ff5dfa75a57dda841895693de6008f32c21a7c97027a8c7bcabd63a7d17416cbead6f8 - languageName: node - linkType: hard - "@babel/code-frame@npm:~7.10.4": version: 7.10.4 resolution: "@babel/code-frame@npm:7.10.4" @@ -2128,29 +2118,6 @@ __metadata: languageName: node linkType: hard -"@babel/core@npm:^7.23.9": - version: 7.24.4 - resolution: "@babel/core@npm:7.24.4" - dependencies: - "@ampproject/remapping": ^2.2.0 - "@babel/code-frame": ^7.24.2 - "@babel/generator": ^7.24.4 - "@babel/helper-compilation-targets": ^7.23.6 - "@babel/helper-module-transforms": ^7.23.3 - "@babel/helpers": ^7.24.4 - "@babel/parser": ^7.24.4 - "@babel/template": ^7.24.0 - "@babel/traverse": ^7.24.1 - "@babel/types": ^7.24.0 - convert-source-map: ^2.0.0 - debug: ^4.1.0 - gensync: ^1.0.0-beta.2 - json5: ^2.2.3 - semver: ^6.3.1 - checksum: 15ecad7581f3329995956ba461961b1af7bed48901f14fe962ccd3217edca60049e9e6ad4ce48134618397e6c90230168c842e2c28e47ef1f16c97dbbf663c61 - languageName: node - linkType: hard - "@babel/eslint-parser@npm:^7.11.3": version: 7.23.3 resolution: "@babel/eslint-parser@npm:7.23.3" @@ -2189,18 +2156,6 @@ __metadata: languageName: node linkType: hard -"@babel/generator@npm:^7.24.1, @babel/generator@npm:^7.24.4": - version: 7.24.4 - resolution: "@babel/generator@npm:7.24.4" - dependencies: - "@babel/types": ^7.24.0 - "@jridgewell/gen-mapping": ^0.3.5 - "@jridgewell/trace-mapping": ^0.3.25 - jsesc: ^2.5.1 - checksum: 1b6146c31386c9df3eb594a2c36b5c98da4f67f7c06edb3d68a442b92516b21bb5ba3ad7dbe0058fe76625ed24d66923e15c95b0df75ef1907d4068921a699b8 - languageName: node - linkType: hard - "@babel/helper-annotate-as-pure@npm:7.22.5, @babel/helper-annotate-as-pure@npm:^7.22.5": version: 7.22.5 resolution: "@babel/helper-annotate-as-pure@npm:7.22.5" @@ -2498,17 +2453,6 @@ __metadata: languageName: node linkType: hard -"@babel/helpers@npm:^7.24.4": - version: 7.24.4 - resolution: "@babel/helpers@npm:7.24.4" - dependencies: - "@babel/template": ^7.24.0 - "@babel/traverse": ^7.24.1 - "@babel/types": ^7.24.0 - checksum: ecd2dc0b3b32e24b97fa3bcda432dd3235b77c2be1e16eafc35b8ef8f6c461faa99796a8bc2431a408c98b4aabfd572c160e2b67ecea4c5c9dd3a8314a97994a - languageName: node - linkType: hard - "@babel/highlight@npm:^7.10.4, @babel/highlight@npm:^7.23.4": version: 7.23.4 resolution: "@babel/highlight@npm:7.23.4" @@ -2520,18 +2464,6 @@ __metadata: languageName: node linkType: hard -"@babel/highlight@npm:^7.24.2": - version: 7.24.2 - resolution: "@babel/highlight@npm:7.24.2" - dependencies: - "@babel/helper-validator-identifier": ^7.22.20 - chalk: ^2.4.2 - js-tokens: ^4.0.0 - picocolors: ^1.0.0 - checksum: 5f17b131cc3ebf3ab285a62cf98a404aef1bd71a6be045e748f8d5bf66d6a6e1aefd62f5972c84369472e8d9f22a614c58a89cd331eb60b7ba965b31b1bbeaf5 - languageName: node - linkType: hard - "@babel/parser@npm:^7.0.0, @babel/parser@npm:^7.1.0, @babel/parser@npm:^7.1.6, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.16.4, @babel/parser@npm:^7.20.15, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.21.3, @babel/parser@npm:^7.22.15, @babel/parser@npm:^7.23.6": version: 7.23.6 resolution: "@babel/parser@npm:7.23.6" @@ -2550,15 +2482,6 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.24.1, @babel/parser@npm:^7.24.4": - version: 7.24.4 - resolution: "@babel/parser@npm:7.24.4" - bin: - parser: ./bin/babel-parser.js - checksum: 94c9e3e592894cd6fc57c519f4e06b65463df9be5f01739bb0d0bfce7ffcf99b3c2fdadd44dc59cc858ba2739ce6e469813a941c2f2dfacf333a3b2c9c5c8465 - languageName: node - linkType: hard - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@npm:7.23.3" @@ -4026,24 +3949,6 @@ __metadata: languageName: node linkType: hard -"@babel/traverse@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/traverse@npm:7.24.1" - dependencies: - "@babel/code-frame": ^7.24.1 - "@babel/generator": ^7.24.1 - "@babel/helper-environment-visitor": ^7.22.20 - "@babel/helper-function-name": ^7.23.0 - "@babel/helper-hoist-variables": ^7.22.5 - "@babel/helper-split-export-declaration": ^7.22.6 - "@babel/parser": ^7.24.1 - "@babel/types": ^7.24.0 - debug: ^4.3.1 - globals: ^11.1.0 - checksum: 92a5ca906abfba9df17666d2001ab23f18600035f706a687055a0e392a690ae48d6fec67c8bd4ef19ba18699a77a5b7f85727e36b83f7d110141608fe0c24fe9 - languageName: node - linkType: hard - "@babel/types@npm:^7.0.0, @babel/types@npm:^7.17.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.4, @babel/types@npm:^7.23.6, @babel/types@npm:^7.3.0, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4, @babel/types@npm:^7.8.3": version: 7.23.6 resolution: "@babel/types@npm:7.23.6" @@ -5176,7 +5081,7 @@ __metadata: languageName: node linkType: hard -"@istanbuljs/schema@npm:^0.1.2, @istanbuljs/schema@npm:^0.1.3": +"@istanbuljs/schema@npm:^0.1.2": version: 0.1.3 resolution: "@istanbuljs/schema@npm:0.1.3" checksum: 5282759d961d61350f33d9118d16bcaed914ebf8061a52f4fa474b2cb08720c9c81d165e13b82f2e5a8a212cc5af482f0c6fc1ac27b9e067e5394c9a6ed186c9 @@ -5197,20 +5102,6 @@ __metadata: languageName: node linkType: hard -"@jest/console@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/console@npm:29.7.0" - dependencies: - "@jest/types": ^29.6.3 - "@types/node": "*" - chalk: ^4.0.0 - jest-message-util: ^29.7.0 - jest-util: ^29.7.0 - slash: ^3.0.0 - checksum: 0e3624e32c5a8e7361e889db70b170876401b7d70f509a2538c31d5cd50deb0c1ae4b92dc63fe18a0902e0a48c590c21d53787a0df41a52b34fa7cab96c384d6 - languageName: node - linkType: hard - "@jest/core@npm:^29.5.0": version: 29.5.0 resolution: "@jest/core@npm:29.5.0" @@ -5252,47 +5143,6 @@ __metadata: languageName: node linkType: hard -"@jest/core@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/core@npm:29.7.0" - dependencies: - "@jest/console": ^29.7.0 - "@jest/reporters": ^29.7.0 - "@jest/test-result": ^29.7.0 - "@jest/transform": ^29.7.0 - "@jest/types": ^29.6.3 - "@types/node": "*" - ansi-escapes: ^4.2.1 - chalk: ^4.0.0 - ci-info: ^3.2.0 - exit: ^0.1.2 - graceful-fs: ^4.2.9 - jest-changed-files: ^29.7.0 - jest-config: ^29.7.0 - jest-haste-map: ^29.7.0 - jest-message-util: ^29.7.0 - jest-regex-util: ^29.6.3 - jest-resolve: ^29.7.0 - jest-resolve-dependencies: ^29.7.0 - jest-runner: ^29.7.0 - jest-runtime: ^29.7.0 - jest-snapshot: ^29.7.0 - jest-util: ^29.7.0 - jest-validate: ^29.7.0 - jest-watcher: ^29.7.0 - micromatch: ^4.0.4 - pretty-format: ^29.7.0 - slash: ^3.0.0 - strip-ansi: ^6.0.0 - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - checksum: af759c9781cfc914553320446ce4e47775ae42779e73621c438feb1e4231a5d4862f84b1d8565926f2d1aab29b3ec3dcfdc84db28608bdf5f29867124ebcfc0d - languageName: node - linkType: hard - "@jest/create-cache-key-function@npm:^26.5.0": version: 26.6.2 resolution: "@jest/create-cache-key-function@npm:26.6.2" @@ -5314,18 +5164,6 @@ __metadata: languageName: node linkType: hard -"@jest/environment@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/environment@npm:29.7.0" - dependencies: - "@jest/fake-timers": ^29.7.0 - "@jest/types": ^29.6.3 - "@types/node": "*" - jest-mock: ^29.7.0 - checksum: 6fb398143b2543d4b9b8d1c6dbce83fa5247f84f550330604be744e24c2bd2178bb893657d62d1b97cf2f24baf85c450223f8237cccb71192c36a38ea2272934 - languageName: node - linkType: hard - "@jest/expect-utils@npm:^29.5.0": version: 29.5.0 resolution: "@jest/expect-utils@npm:29.5.0" @@ -5335,15 +5173,6 @@ __metadata: languageName: node linkType: hard -"@jest/expect-utils@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/expect-utils@npm:29.7.0" - dependencies: - jest-get-type: ^29.6.3 - checksum: 75eb177f3d00b6331bcaa057e07c0ccb0733a1d0a1943e1d8db346779039cb7f103789f16e502f888a3096fb58c2300c38d1f3748b36a7fa762eb6f6d1b160ed - languageName: node - linkType: hard - "@jest/expect@npm:^29.5.0": version: 29.5.0 resolution: "@jest/expect@npm:29.5.0" @@ -5354,16 +5183,6 @@ __metadata: languageName: node linkType: hard -"@jest/expect@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/expect@npm:29.7.0" - dependencies: - expect: ^29.7.0 - jest-snapshot: ^29.7.0 - checksum: a01cb85fd9401bab3370618f4b9013b90c93536562222d920e702a0b575d239d74cecfe98010aaec7ad464f67cf534a353d92d181646a4b792acaa7e912ae55e - languageName: node - linkType: hard - "@jest/fake-timers@npm:^29.5.0": version: 29.5.0 resolution: "@jest/fake-timers@npm:29.5.0" @@ -5378,20 +5197,6 @@ __metadata: languageName: node linkType: hard -"@jest/fake-timers@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/fake-timers@npm:29.7.0" - dependencies: - "@jest/types": ^29.6.3 - "@sinonjs/fake-timers": ^10.0.2 - "@types/node": "*" - jest-message-util: ^29.7.0 - jest-mock: ^29.7.0 - jest-util: ^29.7.0 - checksum: caf2bbd11f71c9241b458d1b5a66cbe95debc5a15d96442444b5d5c7ba774f523c76627c6931cca5e10e76f0d08761f6f1f01a608898f4751a0eee54fc3d8d00 - languageName: node - linkType: hard - "@jest/globals@npm:^29.5.0": version: 29.5.0 resolution: "@jest/globals@npm:29.5.0" @@ -5404,18 +5209,6 @@ __metadata: languageName: node linkType: hard -"@jest/globals@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/globals@npm:29.7.0" - dependencies: - "@jest/environment": ^29.7.0 - "@jest/expect": ^29.7.0 - "@jest/types": ^29.6.3 - jest-mock: ^29.7.0 - checksum: 97dbb9459135693ad3a422e65ca1c250f03d82b2a77f6207e7fa0edd2c9d2015fbe4346f3dc9ebff1678b9d8da74754d4d440b7837497f8927059c0642a22123 - languageName: node - linkType: hard - "@jest/reporters@npm:^29.5.0": version: 29.5.0 resolution: "@jest/reporters@npm:29.5.0" @@ -5453,43 +5246,6 @@ __metadata: languageName: node linkType: hard -"@jest/reporters@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/reporters@npm:29.7.0" - dependencies: - "@bcoe/v8-coverage": ^0.2.3 - "@jest/console": ^29.7.0 - "@jest/test-result": ^29.7.0 - "@jest/transform": ^29.7.0 - "@jest/types": ^29.6.3 - "@jridgewell/trace-mapping": ^0.3.18 - "@types/node": "*" - chalk: ^4.0.0 - collect-v8-coverage: ^1.0.0 - exit: ^0.1.2 - glob: ^7.1.3 - graceful-fs: ^4.2.9 - istanbul-lib-coverage: ^3.0.0 - istanbul-lib-instrument: ^6.0.0 - istanbul-lib-report: ^3.0.0 - istanbul-lib-source-maps: ^4.0.0 - istanbul-reports: ^3.1.3 - jest-message-util: ^29.7.0 - jest-util: ^29.7.0 - jest-worker: ^29.7.0 - slash: ^3.0.0 - string-length: ^4.0.1 - strip-ansi: ^6.0.0 - v8-to-istanbul: ^9.0.1 - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - checksum: 7eadabd62cc344f629024b8a268ecc8367dba756152b761bdcb7b7e570a3864fc51b2a9810cd310d85e0a0173ef002ba4528d5ea0329fbf66ee2a3ada9c40455 - languageName: node - linkType: hard - "@jest/schemas@npm:^29.4.3": version: 29.4.3 resolution: "@jest/schemas@npm:29.4.3" @@ -5519,17 +5275,6 @@ __metadata: languageName: node linkType: hard -"@jest/source-map@npm:^29.6.3": - version: 29.6.3 - resolution: "@jest/source-map@npm:29.6.3" - dependencies: - "@jridgewell/trace-mapping": ^0.3.18 - callsites: ^3.0.0 - graceful-fs: ^4.2.9 - checksum: bcc5a8697d471396c0003b0bfa09722c3cd879ad697eb9c431e6164e2ea7008238a01a07193dfe3cbb48b1d258eb7251f6efcea36f64e1ebc464ea3c03ae2deb - languageName: node - linkType: hard - "@jest/test-result@npm:^29.5.0": version: 29.5.0 resolution: "@jest/test-result@npm:29.5.0" @@ -5542,18 +5287,6 @@ __metadata: languageName: node linkType: hard -"@jest/test-result@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/test-result@npm:29.7.0" - dependencies: - "@jest/console": ^29.7.0 - "@jest/types": ^29.6.3 - "@types/istanbul-lib-coverage": ^2.0.0 - collect-v8-coverage: ^1.0.0 - checksum: 67b6317d526e335212e5da0e768e3b8ab8a53df110361b80761353ad23b6aea4432b7c5665bdeb87658ea373b90fb1afe02ed3611ef6c858c7fba377505057fa - languageName: node - linkType: hard - "@jest/test-sequencer@npm:^29.5.0": version: 29.5.0 resolution: "@jest/test-sequencer@npm:29.5.0" @@ -5566,18 +5299,6 @@ __metadata: languageName: node linkType: hard -"@jest/test-sequencer@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/test-sequencer@npm:29.7.0" - dependencies: - "@jest/test-result": ^29.7.0 - graceful-fs: ^4.2.9 - jest-haste-map: ^29.7.0 - slash: ^3.0.0 - checksum: 73f43599017946be85c0b6357993b038f875b796e2f0950487a82f4ebcb115fa12131932dd9904026b4ad8be131fe6e28bd8d0aa93b1563705185f9804bff8bd - languageName: node - linkType: hard - "@jest/transform@npm:^29.5.0": version: 29.5.0 resolution: "@jest/transform@npm:29.5.0" @@ -5601,29 +5322,6 @@ __metadata: languageName: node linkType: hard -"@jest/transform@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/transform@npm:29.7.0" - dependencies: - "@babel/core": ^7.11.6 - "@jest/types": ^29.6.3 - "@jridgewell/trace-mapping": ^0.3.18 - babel-plugin-istanbul: ^6.1.1 - chalk: ^4.0.0 - convert-source-map: ^2.0.0 - fast-json-stable-stringify: ^2.1.0 - graceful-fs: ^4.2.9 - jest-haste-map: ^29.7.0 - jest-regex-util: ^29.6.3 - jest-util: ^29.7.0 - micromatch: ^4.0.4 - pirates: ^4.0.4 - slash: ^3.0.0 - write-file-atomic: ^4.0.2 - checksum: 0f8ac9f413903b3cb6d240102db848f2a354f63971ab885833799a9964999dd51c388162106a807f810071f864302cdd8e3f0c241c29ce02d85a36f18f3f40ab - languageName: node - linkType: hard - "@jest/types@npm:^26.6.2": version: 26.6.2 resolution: "@jest/types@npm:26.6.2" @@ -5651,20 +5349,6 @@ __metadata: languageName: node linkType: hard -"@jest/types@npm:^29.6.3": - version: 29.6.3 - resolution: "@jest/types@npm:29.6.3" - dependencies: - "@jest/schemas": ^29.6.3 - "@types/istanbul-lib-coverage": ^2.0.0 - "@types/istanbul-reports": ^3.0.0 - "@types/node": "*" - "@types/yargs": ^17.0.8 - chalk: ^4.0.0 - checksum: a0bcf15dbb0eca6bdd8ce61a3fb055349d40268622a7670a3b2eb3c3dbafe9eb26af59938366d520b86907b9505b0f9b29b85cec11579a9e580694b87cd90fcc - languageName: node - linkType: hard - "@jridgewell/gen-mapping@npm:^0.3.0, @jridgewell/gen-mapping@npm:^0.3.2": version: 0.3.2 resolution: "@jridgewell/gen-mapping@npm:0.3.2" @@ -5779,7 +5463,7 @@ __metadata: languageName: node linkType: hard -"@jridgewell/trace-mapping@npm:^0.3.20, @jridgewell/trace-mapping@npm:^0.3.24, @jridgewell/trace-mapping@npm:^0.3.25": +"@jridgewell/trace-mapping@npm:^0.3.20, @jridgewell/trace-mapping@npm:^0.3.24": version: 0.3.25 resolution: "@jridgewell/trace-mapping@npm:0.3.25" dependencies: @@ -9249,11 +8933,9 @@ __metadata: eslint-plugin-unicorn: ^46.0.0 github-contributors-list: ^1.2.4 glob: ^8.0.0 - jest: ^29.7.0 jsdom: ^22.1.0 lint-staged: ^13.0.0 mime-types: ^2.1.26 - nock: ^13.5.4 nodemon: ^2.0.8 npm-packlist: ^5.0.0 npm-run-all: ^4.1.5 @@ -11860,23 +11542,6 @@ __metadata: languageName: node linkType: hard -"babel-jest@npm:^29.7.0": - version: 29.7.0 - resolution: "babel-jest@npm:29.7.0" - dependencies: - "@jest/transform": ^29.7.0 - "@types/babel__core": ^7.1.14 - babel-plugin-istanbul: ^6.1.1 - babel-preset-jest: ^29.6.3 - chalk: ^4.0.0 - graceful-fs: ^4.2.9 - slash: ^3.0.0 - peerDependencies: - "@babel/core": ^7.8.0 - checksum: ee6f8e0495afee07cac5e4ee167be705c711a8cc8a737e05a587a131fdae2b3c8f9aa55dfd4d9c03009ac2d27f2de63d8ba96d3e8460da4d00e8af19ef9a83f7 - languageName: node - linkType: hard - "babel-loader@npm:9.1.3": version: 9.1.3 resolution: "babel-loader@npm:9.1.3" @@ -11922,18 +11587,6 @@ __metadata: languageName: node linkType: hard -"babel-plugin-jest-hoist@npm:^29.6.3": - version: 29.6.3 - resolution: "babel-plugin-jest-hoist@npm:29.6.3" - dependencies: - "@babel/template": ^7.3.3 - "@babel/types": ^7.3.3 - "@types/babel__core": ^7.1.14 - "@types/babel__traverse": ^7.0.6 - checksum: 51250f22815a7318f17214a9d44650ba89551e6d4f47a2dc259128428324b52f5a73979d010cefd921fd5a720d8c1d55ad74ff601cd94c7bd44d5f6292fde2d1 - languageName: node - linkType: hard - "babel-plugin-module-resolver@npm:^4.1.0": version: 4.1.0 resolution: "babel-plugin-module-resolver@npm:4.1.0" @@ -12107,18 +11760,6 @@ __metadata: languageName: node linkType: hard -"babel-preset-jest@npm:^29.6.3": - version: 29.6.3 - resolution: "babel-preset-jest@npm:29.6.3" - dependencies: - babel-plugin-jest-hoist: ^29.6.3 - babel-preset-current-node-syntax: ^1.0.0 - peerDependencies: - "@babel/core": ^7.0.0 - checksum: aa4ff2a8a728d9d698ed521e3461a109a1e66202b13d3494e41eea30729a5e7cc03b3a2d56c594423a135429c37bf63a9fa8b0b9ce275298be3095a88c69f6fb - languageName: node - linkType: hard - "bail@npm:^2.0.0": version: 2.0.2 resolution: "bail@npm:2.0.2" @@ -13743,23 +13384,6 @@ __metadata: languageName: node linkType: hard -"create-jest@npm:^29.7.0": - version: 29.7.0 - resolution: "create-jest@npm:29.7.0" - dependencies: - "@jest/types": ^29.6.3 - chalk: ^4.0.0 - exit: ^0.1.2 - graceful-fs: ^4.2.9 - jest-config: ^29.7.0 - jest-util: ^29.7.0 - prompts: ^2.0.1 - bin: - create-jest: bin/create-jest.js - checksum: 1427d49458adcd88547ef6fa39041e1fe9033a661293aa8d2c3aa1b4967cb5bf4f0c00436c7a61816558f28ba2ba81a94d5c962e8022ea9a883978fc8e1f2945 - languageName: node - linkType: hard - "create-react-class@npm:^15.7.0": version: 15.7.0 resolution: "create-react-class@npm:15.7.0" @@ -14321,18 +13945,6 @@ __metadata: languageName: node linkType: hard -"dedent@npm:^1.0.0": - version: 1.5.3 - resolution: "dedent@npm:1.5.3" - peerDependencies: - babel-plugin-macros: ^3.1.0 - peerDependenciesMeta: - babel-plugin-macros: - optional: true - checksum: 045b595557b2a8ea2eb9b0b4623d764e9a87326486fe2b61191b4342ed93dc01245644d8a09f3108a50c0ee7965f1eedd92e4a3a503ed89ea8e810566ea27f9a - languageName: node - linkType: hard - "deep-diff@npm:^0.3.5": version: 0.3.8 resolution: "deep-diff@npm:0.3.8" @@ -16499,19 +16111,6 @@ __metadata: languageName: node linkType: hard -"expect@npm:^29.7.0": - version: 29.7.0 - resolution: "expect@npm:29.7.0" - dependencies: - "@jest/expect-utils": ^29.7.0 - jest-get-type: ^29.6.3 - jest-matcher-utils: ^29.7.0 - jest-message-util: ^29.7.0 - jest-util: ^29.7.0 - checksum: 9257f10288e149b81254a0fda8ffe8d54a7061cd61d7515779998b012579d2b8c22354b0eb901daf0145f347403da582f75f359f4810c007182ad3fb318b5c0c - languageName: node - linkType: hard - "expo-application@npm:~4.0.0": version: 4.0.2 resolution: "expo-application@npm:4.0.2" @@ -19847,19 +19446,6 @@ __metadata: languageName: node linkType: hard -"istanbul-lib-instrument@npm:^6.0.0": - version: 6.0.2 - resolution: "istanbul-lib-instrument@npm:6.0.2" - dependencies: - "@babel/core": ^7.23.9 - "@babel/parser": ^7.23.9 - "@istanbuljs/schema": ^0.1.3 - istanbul-lib-coverage: ^3.2.0 - semver: ^7.5.4 - checksum: c10aa1e93a022f9767d7f41e6c07d244cc0a5c090fbb5522d70a5f21fcb98c52b7038850276c6fd1a7a17d1868c14a9d4eb8a24efe58a0ebb9a06f3da68131fe - languageName: node - linkType: hard - "istanbul-lib-report@npm:^3.0.0": version: 3.0.0 resolution: "istanbul-lib-report@npm:3.0.0" @@ -19956,17 +19542,6 @@ __metadata: languageName: node linkType: hard -"jest-changed-files@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-changed-files@npm:29.7.0" - dependencies: - execa: ^5.0.0 - jest-util: ^29.7.0 - p-limit: ^3.1.0 - checksum: 963e203893c396c5dfc75e00a49426688efea7361b0f0e040035809cecd2d46b3c01c02be2d9e8d38b1138357d2de7719ea5b5be21f66c10f2e9685a5a73bb99 - languageName: node - linkType: hard - "jest-circus@npm:^29.5.0": version: 29.5.0 resolution: "jest-circus@npm:29.5.0" @@ -19995,34 +19570,6 @@ __metadata: languageName: node linkType: hard -"jest-circus@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-circus@npm:29.7.0" - dependencies: - "@jest/environment": ^29.7.0 - "@jest/expect": ^29.7.0 - "@jest/test-result": ^29.7.0 - "@jest/types": ^29.6.3 - "@types/node": "*" - chalk: ^4.0.0 - co: ^4.6.0 - dedent: ^1.0.0 - is-generator-fn: ^2.0.0 - jest-each: ^29.7.0 - jest-matcher-utils: ^29.7.0 - jest-message-util: ^29.7.0 - jest-runtime: ^29.7.0 - jest-snapshot: ^29.7.0 - jest-util: ^29.7.0 - p-limit: ^3.1.0 - pretty-format: ^29.7.0 - pure-rand: ^6.0.0 - slash: ^3.0.0 - stack-utils: ^2.0.3 - checksum: 349437148924a5a109c9b8aad6d393a9591b4dac1918fc97d81b7fc515bc905af9918495055071404af1fab4e48e4b04ac3593477b1d5dcf48c4e71b527c70a7 - languageName: node - linkType: hard - "jest-cli@npm:^29.5.0": version: 29.5.0 resolution: "jest-cli@npm:29.5.0" @@ -20050,32 +19597,6 @@ __metadata: languageName: node linkType: hard -"jest-cli@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-cli@npm:29.7.0" - dependencies: - "@jest/core": ^29.7.0 - "@jest/test-result": ^29.7.0 - "@jest/types": ^29.6.3 - chalk: ^4.0.0 - create-jest: ^29.7.0 - exit: ^0.1.2 - import-local: ^3.0.2 - jest-config: ^29.7.0 - jest-util: ^29.7.0 - jest-validate: ^29.7.0 - yargs: ^17.3.1 - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - bin: - jest: bin/jest.js - checksum: 664901277a3f5007ea4870632ed6e7889db9da35b2434e7cb488443e6bf5513889b344b7fddf15112135495b9875892b156faeb2d7391ddb9e2a849dcb7b6c36 - languageName: node - linkType: hard - "jest-config@npm:^29.5.0": version: 29.5.0 resolution: "jest-config@npm:29.5.0" @@ -20114,45 +19635,7 @@ __metadata: languageName: node linkType: hard -"jest-config@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-config@npm:29.7.0" - dependencies: - "@babel/core": ^7.11.6 - "@jest/test-sequencer": ^29.7.0 - "@jest/types": ^29.6.3 - babel-jest: ^29.7.0 - chalk: ^4.0.0 - ci-info: ^3.2.0 - deepmerge: ^4.2.2 - glob: ^7.1.3 - graceful-fs: ^4.2.9 - jest-circus: ^29.7.0 - jest-environment-node: ^29.7.0 - jest-get-type: ^29.6.3 - jest-regex-util: ^29.6.3 - jest-resolve: ^29.7.0 - jest-runner: ^29.7.0 - jest-util: ^29.7.0 - jest-validate: ^29.7.0 - micromatch: ^4.0.4 - parse-json: ^5.2.0 - pretty-format: ^29.7.0 - slash: ^3.0.0 - strip-json-comments: ^3.1.1 - peerDependencies: - "@types/node": "*" - ts-node: ">=9.0.0" - peerDependenciesMeta: - "@types/node": - optional: true - ts-node: - optional: true - checksum: 4cabf8f894c180cac80b7df1038912a3fc88f96f2622de33832f4b3314f83e22b08fb751da570c0ab2b7988f21604bdabade95e3c0c041068ac578c085cf7dff - languageName: node - linkType: hard - -"jest-diff@npm:^29.4.1, jest-diff@npm:^29.7.0": +"jest-diff@npm:^29.4.1": version: 29.7.0 resolution: "jest-diff@npm:29.7.0" dependencies: @@ -20185,15 +19668,6 @@ __metadata: languageName: node linkType: hard -"jest-docblock@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-docblock@npm:29.7.0" - dependencies: - detect-newline: ^3.0.0 - checksum: 66390c3e9451f8d96c5da62f577a1dad701180cfa9b071c5025acab2f94d7a3efc2515cfa1654ebe707213241541ce9c5530232cdc8017c91ed64eea1bd3b192 - languageName: node - linkType: hard - "jest-each@npm:^29.5.0": version: 29.5.0 resolution: "jest-each@npm:29.5.0" @@ -20207,19 +19681,6 @@ __metadata: languageName: node linkType: hard -"jest-each@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-each@npm:29.7.0" - dependencies: - "@jest/types": ^29.6.3 - chalk: ^4.0.0 - jest-get-type: ^29.6.3 - jest-util: ^29.7.0 - pretty-format: ^29.7.0 - checksum: e88f99f0184000fc8813f2a0aa79e29deeb63700a3b9b7928b8a418d7d93cd24933608591dbbdea732b473eb2021c72991b5cc51a17966842841c6e28e6f691c - languageName: node - linkType: hard - "jest-environment-node@npm:^29.5.0": version: 29.5.0 resolution: "jest-environment-node@npm:29.5.0" @@ -20234,20 +19695,6 @@ __metadata: languageName: node linkType: hard -"jest-environment-node@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-environment-node@npm:29.7.0" - dependencies: - "@jest/environment": ^29.7.0 - "@jest/fake-timers": ^29.7.0 - "@jest/types": ^29.6.3 - "@types/node": "*" - jest-mock: ^29.7.0 - jest-util: ^29.7.0 - checksum: 501a9966292cbe0ca3f40057a37587cb6def25e1e0c5e39ac6c650fe78d3c70a2428304341d084ac0cced5041483acef41c477abac47e9a290d5545fd2f15646 - languageName: node - linkType: hard - "jest-get-type@npm:^26.3.0": version: 26.3.0 resolution: "jest-get-type@npm:26.3.0" @@ -20317,29 +19764,6 @@ __metadata: languageName: node linkType: hard -"jest-haste-map@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-haste-map@npm:29.7.0" - dependencies: - "@jest/types": ^29.6.3 - "@types/graceful-fs": ^4.1.3 - "@types/node": "*" - anymatch: ^3.0.3 - fb-watchman: ^2.0.0 - fsevents: ^2.3.2 - graceful-fs: ^4.2.9 - jest-regex-util: ^29.6.3 - jest-util: ^29.7.0 - jest-worker: ^29.7.0 - micromatch: ^4.0.4 - walker: ^1.0.8 - dependenciesMeta: - fsevents: - optional: true - checksum: c2c8f2d3e792a963940fbdfa563ce14ef9e14d4d86da645b96d3cd346b8d35c5ce0b992ee08593939b5f718cf0a1f5a90011a056548a1dbf58397d4356786f01 - languageName: node - linkType: hard - "jest-leak-detector@npm:^29.5.0": version: 29.5.0 resolution: "jest-leak-detector@npm:29.5.0" @@ -20350,16 +19774,6 @@ __metadata: languageName: node linkType: hard -"jest-leak-detector@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-leak-detector@npm:29.7.0" - dependencies: - jest-get-type: ^29.6.3 - pretty-format: ^29.7.0 - checksum: e3950e3ddd71e1d0c22924c51a300a1c2db6cf69ec1e51f95ccf424bcc070f78664813bef7aed4b16b96dfbdeea53fe358f8aeaaea84346ae15c3735758f1605 - languageName: node - linkType: hard - "jest-matcher-utils@npm:^29.5.0": version: 29.5.0 resolution: "jest-matcher-utils@npm:29.5.0" @@ -20372,18 +19786,6 @@ __metadata: languageName: node linkType: hard -"jest-matcher-utils@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-matcher-utils@npm:29.7.0" - dependencies: - chalk: ^4.0.0 - jest-diff: ^29.7.0 - jest-get-type: ^29.6.3 - pretty-format: ^29.7.0 - checksum: d7259e5f995d915e8a37a8fd494cb7d6af24cd2a287b200f831717ba0d015190375f9f5dc35393b8ba2aae9b2ebd60984635269c7f8cff7d85b077543b7744cd - languageName: node - linkType: hard - "jest-message-util@npm:^29.5.0": version: 29.5.0 resolution: "jest-message-util@npm:29.5.0" @@ -20401,23 +19803,6 @@ __metadata: languageName: node linkType: hard -"jest-message-util@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-message-util@npm:29.7.0" - dependencies: - "@babel/code-frame": ^7.12.13 - "@jest/types": ^29.6.3 - "@types/stack-utils": ^2.0.0 - chalk: ^4.0.0 - graceful-fs: ^4.2.9 - micromatch: ^4.0.4 - pretty-format: ^29.7.0 - slash: ^3.0.0 - stack-utils: ^2.0.3 - checksum: a9d025b1c6726a2ff17d54cc694de088b0489456c69106be6b615db7a51b7beb66788bea7a59991a019d924fbf20f67d085a445aedb9a4d6760363f4d7d09930 - languageName: node - linkType: hard - "jest-mock@npm:^29.5.0": version: 29.5.0 resolution: "jest-mock@npm:29.5.0" @@ -20429,17 +19814,6 @@ __metadata: languageName: node linkType: hard -"jest-mock@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-mock@npm:29.7.0" - dependencies: - "@jest/types": ^29.6.3 - "@types/node": "*" - jest-util: ^29.7.0 - checksum: 81ba9b68689a60be1482212878973700347cb72833c5e5af09895882b9eb5c4e02843a1bbdf23f94c52d42708bab53a30c45a3482952c9eec173d1eaac5b86c5 - languageName: node - linkType: hard - "jest-pnp-resolver@npm:^1.2.2": version: 1.2.3 resolution: "jest-pnp-resolver@npm:1.2.3" @@ -20466,13 +19840,6 @@ __metadata: languageName: node linkType: hard -"jest-regex-util@npm:^29.6.3": - version: 29.6.3 - resolution: "jest-regex-util@npm:29.6.3" - checksum: 0518beeb9bf1228261695e54f0feaad3606df26a19764bc19541e0fc6e2a3737191904607fb72f3f2ce85d9c16b28df79b7b1ec9443aa08c3ef0e9efda6f8f2a - languageName: node - linkType: hard - "jest-resolve-dependencies@npm:^29.5.0": version: 29.5.0 resolution: "jest-resolve-dependencies@npm:29.5.0" @@ -20483,16 +19850,6 @@ __metadata: languageName: node linkType: hard -"jest-resolve-dependencies@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-resolve-dependencies@npm:29.7.0" - dependencies: - jest-regex-util: ^29.6.3 - jest-snapshot: ^29.7.0 - checksum: aeb75d8150aaae60ca2bb345a0d198f23496494677cd6aefa26fc005faf354061f073982175daaf32b4b9d86b26ca928586344516e3e6969aa614cb13b883984 - languageName: node - linkType: hard - "jest-resolve@npm:^29.5.0": version: 29.5.0 resolution: "jest-resolve@npm:29.5.0" @@ -20510,23 +19867,6 @@ __metadata: languageName: node linkType: hard -"jest-resolve@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-resolve@npm:29.7.0" - dependencies: - chalk: ^4.0.0 - graceful-fs: ^4.2.9 - jest-haste-map: ^29.7.0 - jest-pnp-resolver: ^1.2.2 - jest-util: ^29.7.0 - jest-validate: ^29.7.0 - resolve: ^1.20.0 - resolve.exports: ^2.0.0 - slash: ^3.0.0 - checksum: 0ca218e10731aa17920526ec39deaec59ab9b966237905ffc4545444481112cd422f01581230eceb7e82d86f44a543d520a71391ec66e1b4ef1a578bd5c73487 - languageName: node - linkType: hard - "jest-runner@npm:^29.5.0": version: 29.5.0 resolution: "jest-runner@npm:29.5.0" @@ -20556,35 +19896,6 @@ __metadata: languageName: node linkType: hard -"jest-runner@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-runner@npm:29.7.0" - dependencies: - "@jest/console": ^29.7.0 - "@jest/environment": ^29.7.0 - "@jest/test-result": ^29.7.0 - "@jest/transform": ^29.7.0 - "@jest/types": ^29.6.3 - "@types/node": "*" - chalk: ^4.0.0 - emittery: ^0.13.1 - graceful-fs: ^4.2.9 - jest-docblock: ^29.7.0 - jest-environment-node: ^29.7.0 - jest-haste-map: ^29.7.0 - jest-leak-detector: ^29.7.0 - jest-message-util: ^29.7.0 - jest-resolve: ^29.7.0 - jest-runtime: ^29.7.0 - jest-util: ^29.7.0 - jest-watcher: ^29.7.0 - jest-worker: ^29.7.0 - p-limit: ^3.1.0 - source-map-support: 0.5.13 - checksum: f0405778ea64812bf9b5c50b598850d94ccf95d7ba21f090c64827b41decd680ee19fcbb494007cdd7f5d0d8906bfc9eceddd8fa583e753e736ecd462d4682fb - languageName: node - linkType: hard - "jest-runtime@npm:^29.5.0": version: 29.5.0 resolution: "jest-runtime@npm:29.5.0" @@ -20615,36 +19926,6 @@ __metadata: languageName: node linkType: hard -"jest-runtime@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-runtime@npm:29.7.0" - dependencies: - "@jest/environment": ^29.7.0 - "@jest/fake-timers": ^29.7.0 - "@jest/globals": ^29.7.0 - "@jest/source-map": ^29.6.3 - "@jest/test-result": ^29.7.0 - "@jest/transform": ^29.7.0 - "@jest/types": ^29.6.3 - "@types/node": "*" - chalk: ^4.0.0 - cjs-module-lexer: ^1.0.0 - collect-v8-coverage: ^1.0.0 - glob: ^7.1.3 - graceful-fs: ^4.2.9 - jest-haste-map: ^29.7.0 - jest-message-util: ^29.7.0 - jest-mock: ^29.7.0 - jest-regex-util: ^29.6.3 - jest-resolve: ^29.7.0 - jest-snapshot: ^29.7.0 - jest-util: ^29.7.0 - slash: ^3.0.0 - strip-bom: ^4.0.0 - checksum: d19f113d013e80691e07047f68e1e3448ef024ff2c6b586ce4f90cd7d4c62a2cd1d460110491019719f3c59bfebe16f0e201ed005ef9f80e2cf798c374eed54e - languageName: node - linkType: hard - "jest-serializer@npm:^26.6.2": version: 26.6.2 resolution: "jest-serializer@npm:26.6.2" @@ -20686,34 +19967,6 @@ __metadata: languageName: node linkType: hard -"jest-snapshot@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-snapshot@npm:29.7.0" - dependencies: - "@babel/core": ^7.11.6 - "@babel/generator": ^7.7.2 - "@babel/plugin-syntax-jsx": ^7.7.2 - "@babel/plugin-syntax-typescript": ^7.7.2 - "@babel/types": ^7.3.3 - "@jest/expect-utils": ^29.7.0 - "@jest/transform": ^29.7.0 - "@jest/types": ^29.6.3 - babel-preset-current-node-syntax: ^1.0.0 - chalk: ^4.0.0 - expect: ^29.7.0 - graceful-fs: ^4.2.9 - jest-diff: ^29.7.0 - jest-get-type: ^29.6.3 - jest-matcher-utils: ^29.7.0 - jest-message-util: ^29.7.0 - jest-util: ^29.7.0 - natural-compare: ^1.4.0 - pretty-format: ^29.7.0 - semver: ^7.5.3 - checksum: 86821c3ad0b6899521ce75ee1ae7b01b17e6dfeff9166f2cf17f012e0c5d8c798f30f9e4f8f7f5bed01ea7b55a6bc159f5eda778311162cbfa48785447c237ad - languageName: node - linkType: hard - "jest-util@npm:^26.6.2": version: 26.6.2 resolution: "jest-util@npm:26.6.2" @@ -20742,20 +19995,6 @@ __metadata: languageName: node linkType: hard -"jest-util@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-util@npm:29.7.0" - dependencies: - "@jest/types": ^29.6.3 - "@types/node": "*" - chalk: ^4.0.0 - ci-info: ^3.2.0 - graceful-fs: ^4.2.9 - picomatch: ^2.2.3 - checksum: 042ab4980f4ccd4d50226e01e5c7376a8556b472442ca6091a8f102488c0f22e6e8b89ea874111d2328a2080083bf3225c86f3788c52af0bd0345a00eb57a3ca - languageName: node - linkType: hard - "jest-validate@npm:^26.5.2": version: 26.6.2 resolution: "jest-validate@npm:26.6.2" @@ -20784,20 +20023,6 @@ __metadata: languageName: node linkType: hard -"jest-validate@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-validate@npm:29.7.0" - dependencies: - "@jest/types": ^29.6.3 - camelcase: ^6.2.0 - chalk: ^4.0.0 - jest-get-type: ^29.6.3 - leven: ^3.1.0 - pretty-format: ^29.7.0 - checksum: 191fcdc980f8a0de4dbdd879fa276435d00eb157a48683af7b3b1b98b0f7d9de7ffe12689b617779097ff1ed77601b9f7126b0871bba4f776e222c40f62e9dae - languageName: node - linkType: hard - "jest-watcher@npm:^29.5.0": version: 29.5.0 resolution: "jest-watcher@npm:29.5.0" @@ -20814,22 +20039,6 @@ __metadata: languageName: node linkType: hard -"jest-watcher@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-watcher@npm:29.7.0" - dependencies: - "@jest/test-result": ^29.7.0 - "@jest/types": ^29.6.3 - "@types/node": "*" - ansi-escapes: ^4.2.1 - chalk: ^4.0.0 - emittery: ^0.13.1 - jest-util: ^29.7.0 - string-length: ^4.0.1 - checksum: 67e6e7fe695416deff96b93a14a561a6db69389a0667e9489f24485bb85e5b54e12f3b2ba511ec0b777eca1e727235b073e3ebcdd473d68888650489f88df92f - languageName: node - linkType: hard - "jest-worker@npm:^26.0.0, jest-worker@npm:^26.2.1, jest-worker@npm:^26.6.2": version: 26.6.2 resolution: "jest-worker@npm:26.6.2" @@ -20864,18 +20073,6 @@ __metadata: languageName: node linkType: hard -"jest-worker@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-worker@npm:29.7.0" - dependencies: - "@types/node": "*" - jest-util: ^29.7.0 - merge-stream: ^2.0.0 - supports-color: ^8.0.0 - checksum: 30fff60af49675273644d408b650fc2eb4b5dcafc5a0a455f238322a8f9d8a98d847baca9d51ff197b6747f54c7901daa2287799230b856a0f48287d131f8c13 - languageName: node - linkType: hard - "jest@npm:^29.0.0": version: 29.5.0 resolution: "jest@npm:29.5.0" @@ -20895,25 +20092,6 @@ __metadata: languageName: node linkType: hard -"jest@npm:^29.7.0": - version: 29.7.0 - resolution: "jest@npm:29.7.0" - dependencies: - "@jest/core": ^29.7.0 - "@jest/types": ^29.6.3 - import-local: ^3.0.2 - jest-cli: ^29.7.0 - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - bin: - jest: bin/jest.js - checksum: 17ca8d67504a7dbb1998cf3c3077ec9031ba3eb512da8d71cb91bcabb2b8995c4e4b292b740cb9bf1cbff5ce3e110b3f7c777b0cefb6f41ab05445f248d0ee0b - languageName: node - linkType: hard - "jetifier@npm:^1.6.2": version: 1.6.8 resolution: "jetifier@npm:1.6.8" From afb687f38011852585f68eecba1bab41cbdd5375 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 18 Apr 2024 17:31:29 +0200 Subject: [PATCH 23/29] edit comment --- packages/@uppy/companion/test/__tests__/uploader.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/@uppy/companion/test/__tests__/uploader.js b/packages/@uppy/companion/test/__tests__/uploader.js index 3b4504255d..9bf18ef60d 100644 --- a/packages/@uppy/companion/test/__tests__/uploader.js +++ b/packages/@uppy/companion/test/__tests__/uploader.js @@ -16,9 +16,13 @@ afterAll(() => { nock.restore() }) +// Workaround a limitation in Nock+got+Node.js 20.9+ when the body of the request +// is a stream. Setting this env variable causes the Nock to receive only the +// first chunk of the request body, which is OK for most of our tests anyway. +process.env.UPPY_TEST_DO_NOT_WAIT_FOR_COMPLETE_BODY = true + process.env.COMPANION_DATADIR = './test/output' process.env.COMPANION_DOMAIN = 'localhost:3020' -process.env.UPPY_TEST_DO_NOT_WAIT_FOR_COMPLETE_BODY = true // workaround a limitation in Nock+got+Node.js 20.9+ const { companionOptions } = standalone() describe('uploader with tus protocol', () => { From e22e8854673202701b60556bed746b86ab4eb10c Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 22 Apr 2024 11:47:29 +0200 Subject: [PATCH 24/29] avoid storing the full stream in memory --- .../@uppy/companion/src/server/Uploader.js | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/@uppy/companion/src/server/Uploader.js b/packages/@uppy/companion/src/server/Uploader.js index 46728543a7..98940de376 100644 --- a/packages/@uppy/companion/src/server/Uploader.js +++ b/packages/@uppy/companion/src/server/Uploader.js @@ -1,5 +1,4 @@ // eslint-disable-next-line max-classes-per-file -const { blob } = require('node:stream/consumers'); const tus = require('tus-js-client') const { randomUUID } = require('node:crypto') const validator = require('validator') @@ -143,6 +142,21 @@ const states = { done: 'done', } +class StreamableBlob { + #stream + + constructor(stream) { + this.#stream = stream + } + + stream(){ + return this.#stream + } + + // eslint-disable-next-line class-methods-use-this + get [Symbol.toStringTag]() { return "File" } +} + class Uploader { /** * Uploads file to destination based on the supplied protocol (tus, s3-multipart, multipart) @@ -620,8 +634,8 @@ class Uploader { formData.append( this.options.fieldname, - // @ts-expect-error Node.js Blob is actually spec compliant - await blob(stream), + // @ts-expect-error Our StreamableBlob is actually spec compliant enough for our purpose + new StreamableBlob(stream), this.uploadFileName) reqOptions.body = formData From 43ba672c6897fe179832bc22c283fb7608638936 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 22 Apr 2024 14:37:37 +0200 Subject: [PATCH 25/29] Update packages/@uppy/companion/test/__tests__/uploader.js --- packages/@uppy/companion/test/__tests__/uploader.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/@uppy/companion/test/__tests__/uploader.js b/packages/@uppy/companion/test/__tests__/uploader.js index 9bf18ef60d..b30d018b52 100644 --- a/packages/@uppy/companion/test/__tests__/uploader.js +++ b/packages/@uppy/companion/test/__tests__/uploader.js @@ -198,6 +198,7 @@ describe('uploader with tus protocol', () => { const formDataNoMetaMatch = /^--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="files\[\]"; filename="uppy-file-[^"]+"\r\nContent-Type: application\/octet-stream\r\n\r\nSome file content\r\n--form-data-boundary-[a-z0-9]+--\r\n\r\n$/ test('upload functions with xhr formdata', async () => { + // We want the complete body for this test: delete process.env.UPPY_TEST_DO_NOT_WAIT_FOR_COMPLETE_BODY nock('http://localhost').post('/', formDataNoMetaMatch) .reply(200) From 88d8388f532f5e41dc398c9f9b5d2b9dfa56ca33 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 22 Apr 2024 15:26:21 +0200 Subject: [PATCH 26/29] remove patch, try with a HTTP server --- .../patches/nock-npm-13.5.4-2c4f77b249.patch | 13 ------- package.json | 5 +-- .../companion/test/__tests__/uploader.js | 38 +++++++++++-------- yarn.lock | 13 +------ 4 files changed, 25 insertions(+), 44 deletions(-) delete mode 100644 .yarn/patches/nock-npm-13.5.4-2c4f77b249.patch diff --git a/.yarn/patches/nock-npm-13.5.4-2c4f77b249.patch b/.yarn/patches/nock-npm-13.5.4-2c4f77b249.patch deleted file mode 100644 index 6a9838ea85..0000000000 --- a/.yarn/patches/nock-npm-13.5.4-2c4f77b249.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/lib/intercepted_request_router.js b/lib/intercepted_request_router.js -index d82c2446b540759cbc54ad7b26222a80109b8ec9..bf24add845d12e436c97b3ea5e2e38f87b77d489 100644 ---- a/lib/intercepted_request_router.js -+++ b/lib/intercepted_request_router.js -@@ -68,7 +68,7 @@ class InterceptedRequestRouter { - // For parity with Node, it's important the socket event is emitted before we begin playback. - // This flag is set when playback is triggered if we haven't yet gotten the - // socket event to indicate that playback should start as soon as it comes in. -- this.readyToStartPlaybackOnSocketEvent = false -+ this.readyToStartPlaybackOnSocketEvent = 'UPPY_TEST_DO_NOT_WAIT_FOR_COMPLETE_BODY' in process.env - - this.attachToReq() - diff --git a/package.json b/package.json index 633252fe5e..9fa7b51718 100644 --- a/package.json +++ b/package.json @@ -171,14 +171,13 @@ "@types/react": "^18", "@types/webpack-dev-server": "^4", "@vitest/utils": "patch:@vitest/utils@npm%3A1.2.1#./.yarn/patches/@vitest-utils-npm-1.2.1-3028846845.patch", - "nock": "patch:nock@npm%3A13.5.4#./.yarn/patches/nock-npm-13.5.4-2c4f77b249.patch", "p-queue": "patch:p-queue@npm%3A7.4.1#./.yarn/patches/p-queue-npm-7.4.1-e0cf0a6f17.patch", "pre-commit": "patch:pre-commit@npm:1.2.2#.yarn/patches/pre-commit-npm-1.2.2-f30af83877.patch", "preact": "patch:preact@npm:10.10.0#.yarn/patches/preact-npm-10.10.0-dd04de05e8.patch", - "resize-observer-polyfill": "patch:resize-observer-polyfill@npm%3A1.5.1#./.yarn/patches/resize-observer-polyfill-npm-1.5.1-603120e8a0.patch", "start-server-and-test": "patch:start-server-and-test@npm:1.14.0#.yarn/patches/start-server-and-test-npm-1.14.0-841aa34fdf.patch", "stylelint-config-rational-order": "patch:stylelint-config-rational-order@npm%3A0.1.2#./.yarn/patches/stylelint-config-rational-order-npm-0.1.2-d8336e84ed.patch", + "uuid@^8.3.2": "patch:uuid@npm:8.3.2#.yarn/patches/uuid-npm-8.3.2-eca0baba53.patch", "tus-js-client": "patch:tus-js-client@npm%3A3.1.3#./.yarn/patches/tus-js-client-npm-3.1.3-dc57874d23.patch", - "uuid@^8.3.2": "patch:uuid@npm:8.3.2#.yarn/patches/uuid-npm-8.3.2-eca0baba53.patch" + "resize-observer-polyfill": "patch:resize-observer-polyfill@npm%3A1.5.1#./.yarn/patches/resize-observer-polyfill-npm-1.5.1-603120e8a0.patch" } } diff --git a/packages/@uppy/companion/test/__tests__/uploader.js b/packages/@uppy/companion/test/__tests__/uploader.js index b30d018b52..8d5e7a2756 100644 --- a/packages/@uppy/companion/test/__tests__/uploader.js +++ b/packages/@uppy/companion/test/__tests__/uploader.js @@ -4,6 +4,8 @@ jest.mock('tus-js-client') const { Readable } = require('node:stream') const fs = require('node:fs') +const { createServer } = require('node:http') +const { once } = require('node:events') const nock = require('nock') const Uploader = require('../../src/server/Uploader') @@ -16,11 +18,6 @@ afterAll(() => { nock.restore() }) -// Workaround a limitation in Nock+got+Node.js 20.9+ when the body of the request -// is a stream. Setting this env variable causes the Nock to receive only the -// first chunk of the request body, which is OK for most of our tests anyway. -process.env.UPPY_TEST_DO_NOT_WAIT_FOR_COMPLETE_BODY = true - process.env.COMPANION_DATADIR = './test/output' process.env.COMPANION_DOMAIN = 'localhost:3020' const { companionOptions } = standalone() @@ -169,13 +166,13 @@ describe('uploader with tus protocol', () => { }) }) - async function runMultipartTest ({ metadata, useFormData, includeSize = true } = {}) { + async function runMultipartTest ({ metadata, useFormData, includeSize = true, address = 'localhost' } = {}) { const fileContent = Buffer.from('Some file content') const stream = Readable.from([fileContent]) const opts = { companionOptions, - endpoint: 'http://localhost', + endpoint: `http://${address}`, protocol: 'multipart', size: includeSize ? fileContent.length : undefined, metadata, @@ -186,20 +183,31 @@ describe('uploader with tus protocol', () => { const uploader = new Uploader(opts) return uploader.uploadStream(stream) } - + test('upload functions with xhr protocol', async () => { - nock('http://localhost').post('/').reply(200) - - const ret = await runMultipartTest() - expect(ret).toMatchObject({ url: null, extraData: { response: expect.anything(), bytesUploaded: 17 } }) + let alreadyCalled = false + const server = createServer((req,res) => { + if (alreadyCalled) throw new Error('already called') + alreadyCalled = true + if (req.url === '/' && req.method==='POST') { + res.writeHead(200) + res.end('OK') + } + }).listen() + try { + await once(server, 'listening') + + const ret = await runMultipartTest({ address: `localhost:${server.address().port}` }) + expect(ret).toMatchObject({ url: null, extraData: { response: expect.anything(), bytesUploaded: 17 } }) + } finally { + server.close() + } }) // eslint-disable-next-line max-len const formDataNoMetaMatch = /^--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="files\[\]"; filename="uppy-file-[^"]+"\r\nContent-Type: application\/octet-stream\r\n\r\nSome file content\r\n--form-data-boundary-[a-z0-9]+--\r\n\r\n$/ test('upload functions with xhr formdata', async () => { - // We want the complete body for this test: - delete process.env.UPPY_TEST_DO_NOT_WAIT_FOR_COMPLETE_BODY nock('http://localhost').post('/', formDataNoMetaMatch) .reply(200) @@ -208,7 +216,6 @@ describe('uploader with tus protocol', () => { }) test('upload functions with unknown file size', async () => { - delete process.env.UPPY_TEST_DO_NOT_WAIT_FOR_COMPLETE_BODY nock('http://localhost').post('/', formDataNoMetaMatch) .reply(200) @@ -218,7 +225,6 @@ describe('uploader with tus protocol', () => { // https://github.com/transloadit/uppy/issues/3477 test('upload functions with xhr formdata and metadata', async () => { - delete process.env.UPPY_TEST_DO_NOT_WAIT_FOR_COMPLETE_BODY nock('http://localhost').post('/', /^--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key1"\r\n\r\nnull\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key2"\r\n\r\ntrue\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key3"\r\n\r\n\d+\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key4"\r\n\r\n\[object Object\]\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key5"\r\n\r\n\(\) => \{\}\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="key6"\r\n\r\nSymbol\(\)\r\n--form-data-boundary-[a-z0-9]+\r\nContent-Disposition: form-data; name="files\[\]"; filename="uppy-file-[^"]+"\r\nContent-Type: application\/octet-stream\r\n\r\nSome file content\r\n--form-data-boundary-[a-z0-9]+--\r\n\r\n$/) .reply(200) diff --git a/yarn.lock b/yarn.lock index 6263d1536d..a4ed8a0ca6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -23538,7 +23538,7 @@ __metadata: languageName: node linkType: hard -"nock@npm:13.5.4": +"nock@npm:^13.1.0, nock@npm:^13.1.3": version: 13.5.4 resolution: "nock@npm:13.5.4" dependencies: @@ -23549,17 +23549,6 @@ __metadata: languageName: node linkType: hard -"nock@patch:nock@npm%3A13.5.4#./.yarn/patches/nock-npm-13.5.4-2c4f77b249.patch::locator=%40uppy-dev%2Fbuild%40workspace%3A.": - version: 13.5.4 - resolution: "nock@patch:nock@npm%3A13.5.4#./.yarn/patches/nock-npm-13.5.4-2c4f77b249.patch::version=13.5.4&hash=3af473&locator=%40uppy-dev%2Fbuild%40workspace%3A." - dependencies: - debug: ^4.1.0 - json-stringify-safe: ^5.0.1 - propagate: ^2.0.0 - checksum: ec5476a5c4bba1a976499533e1aee26edbc9b0fbf41d4b6443edac696cd70b6f0d50e1f19f1536cd6dd709c262af8a8727955fc7387919d196517cbb42f200fe - languageName: node - linkType: hard - "node-addon-api@npm:^3.0.0": version: 3.2.1 resolution: "node-addon-api@npm:3.2.1" From 773edee7d8cfc9278661de8ee780daeeee8c4a1a Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 22 Apr 2024 15:34:32 +0200 Subject: [PATCH 27/29] prettier --- .../@uppy/companion/test/__tests__/uploader.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/@uppy/companion/test/__tests__/uploader.js b/packages/@uppy/companion/test/__tests__/uploader.js index 8d5e7a2756..c759c92d7d 100644 --- a/packages/@uppy/companion/test/__tests__/uploader.js +++ b/packages/@uppy/companion/test/__tests__/uploader.js @@ -183,17 +183,17 @@ describe('uploader with tus protocol', () => { const uploader = new Uploader(opts) return uploader.uploadStream(stream) } - + test('upload functions with xhr protocol', async () => { let alreadyCalled = false - const server = createServer((req,res) => { - if (alreadyCalled) throw new Error('already called') - alreadyCalled = true - if (req.url === '/' && req.method==='POST') { - res.writeHead(200) - res.end('OK') - } - }).listen() + const server = createServer((req,res) => { + if (alreadyCalled) throw new Error('already called') + alreadyCalled = true + if (req.url === '/' && req.method==='POST') { + res.writeHead(200) + res.end('OK') + } + }).listen() try { await once(server, 'listening') From a45aafa6f6a500fa0a30a96964a3d3b1ae9073d4 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 22 Apr 2024 15:38:39 +0200 Subject: [PATCH 28/29] prettier again --- packages/@uppy/companion/test/__tests__/uploader.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@uppy/companion/test/__tests__/uploader.js b/packages/@uppy/companion/test/__tests__/uploader.js index c759c92d7d..acd21c8892 100644 --- a/packages/@uppy/companion/test/__tests__/uploader.js +++ b/packages/@uppy/companion/test/__tests__/uploader.js @@ -155,7 +155,7 @@ describe('uploader with tus protocol', () => { }) socketClient.onUploadSuccess(uploadToken, (message) => { try { - expect(firstReceivedProgress.bytesUploaded).toBeGreaterThan(0) + expect(firstReceivedProgress.bytesUploaded).toBe(500_000) // see __mocks__/tus-js-client.js expect(message.payload.url).toBe('https://tus.endpoint/files/foo-bar') @@ -189,7 +189,7 @@ describe('uploader with tus protocol', () => { const server = createServer((req,res) => { if (alreadyCalled) throw new Error('already called') alreadyCalled = true - if (req.url === '/' && req.method==='POST') { + if (req.url === '/' && req.method === 'POST') { res.writeHead(200) res.end('OK') } From 06a4bc88c1d3b4b00244052655f6d5c58a57d06e Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 22 Apr 2024 15:43:42 +0200 Subject: [PATCH 29/29] Update packages/@uppy/companion/test/__tests__/uploader.js Co-authored-by: Merlijn Vos --- packages/@uppy/companion/test/__tests__/uploader.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/@uppy/companion/test/__tests__/uploader.js b/packages/@uppy/companion/test/__tests__/uploader.js index acd21c8892..9b857394a4 100644 --- a/packages/@uppy/companion/test/__tests__/uploader.js +++ b/packages/@uppy/companion/test/__tests__/uploader.js @@ -186,6 +186,9 @@ describe('uploader with tus protocol', () => { test('upload functions with xhr protocol', async () => { let alreadyCalled = false + // We are creating our own test server for this test + // instead of using nock because of a bug when passing a Node.js stream to got. + // Ref: https://github.com/nock/nock/issues/2595 const server = createServer((req,res) => { if (alreadyCalled) throw new Error('already called') alreadyCalled = true