From 1bcd04c1dc91f52117b72529e0f8d86a23e042ca Mon Sep 17 00:00:00 2001 From: Murderlon Date: Thu, 23 Jan 2025 14:14:39 +0100 Subject: [PATCH] Rename companionOnly -> onlyRemoteFiles --- packages/@uppy/aws-s3/src/index.ts | 6 +++--- packages/@uppy/transloadit/src/index.ts | 12 ++++++------ packages/@uppy/xhr-upload/src/index.ts | 2 +- private/dev/Dashboard.js | 10 ++-------- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/packages/@uppy/aws-s3/src/index.ts b/packages/@uppy/aws-s3/src/index.ts index 5912398175..111840481b 100644 --- a/packages/@uppy/aws-s3/src/index.ts +++ b/packages/@uppy/aws-s3/src/index.ts @@ -924,7 +924,7 @@ export default class AwsS3Multipart< #getCompanionClientArgs(file: UppyFile) { const opts = { ...this.opts } - // When you .use(AwsS3) with .use(Transloadit, { companionOnly: true }), + // When you .use(AwsS3) with .use(Transloadit, { onlyRemoteFiles: true }), // local files are uploaded with this plugin and remote files with the Transloadit plugin. // Since the Transloadit plugin uses the tus plugin underneath, it's possible to have file.tus // even though we are in this plugin. @@ -933,10 +933,10 @@ export default class AwsS3Multipart< return { ...file.remote?.body, - endpoint: tusOpts.endpoint ?? opts.endpoint, protocol: this.uppy.getState().remoteUploader || 's3-multipart', - size: file.data.size, + endpoint: tusOpts.endpoint ?? opts.endpoint, headers: { ...opts.headers, ...tusOpts.headers }, + size: file.data.size, metadata: file.meta, } } diff --git a/packages/@uppy/transloadit/src/index.ts b/packages/@uppy/transloadit/src/index.ts index 20ad36f64a..90f68b3aea 100644 --- a/packages/@uppy/transloadit/src/index.ts +++ b/packages/@uppy/transloadit/src/index.ts @@ -140,7 +140,7 @@ export interface TransloaditOptions * Enabling this means you have to install another plugin for local files, * such as @uppy/aws-s3 or @uppy/xhr-upload. */ - companionOnly?: boolean + onlyRemoteFiles?: boolean limit?: number clientName?: string | null retryDelays?: number[] @@ -156,7 +156,7 @@ const defaultOptions = { waitForMetadata: false, alwaysRunAssembly: false, importFromUploadURLs: false, - companionOnly: false, + onlyRemoteFiles: false, limit: 20, retryDelays: [7_000, 10_000, 15_000, 20_000], clientName: null, @@ -307,7 +307,7 @@ export default class Transloadit< this.i18nInit() - if (this.opts.companionOnly) { + if (this.opts.onlyRemoteFiles) { // Transloadit is only a pre and post processor. // To let Transloadit hosted Companion download the file, // we instruct any other upload plugin to use tus for remote uploads. @@ -822,7 +822,7 @@ export default class Transloadit< assemblyOptions.fields ??= {} validateParams(assemblyOptions.params) const ids = - this.opts.companionOnly ? + this.opts.onlyRemoteFiles ? fileIDs.filter((id) => this.uppy.getFile(id).isRemote) : fileIDs @@ -960,9 +960,9 @@ export default class Transloadit< if (this.opts.importFromUploadURLs) { // No uploader needed when importing; instead we take the upload URL from an existing uploader. this.uppy.on('upload-success', this.#onFileUploadURLAvailable) - // If companionOnly is true, another uploader plugin is installed for local uploads + // If onlyRemoteFiles is true, another uploader plugin is installed for local uploads // and we only use Transloadit to create an assembly for the remote files. - } else if (!this.opts.companionOnly) { + } else if (!this.opts.onlyRemoteFiles) { this.uppy.use(Tus, { // Disable tus-js-client fingerprinting, otherwise uploading the same file at different times // will upload to an outdated Assembly, and we won't get socket events for it. diff --git a/packages/@uppy/xhr-upload/src/index.ts b/packages/@uppy/xhr-upload/src/index.ts index 29cfca8006..c2944e66d0 100644 --- a/packages/@uppy/xhr-upload/src/index.ts +++ b/packages/@uppy/xhr-upload/src/index.ts @@ -440,7 +440,7 @@ export default class XHRUpload< opts.allowedMetaFields, file.meta, ) - // When you .use(XHR) with .use(Transloadit, { companionOnly: true }), + // When you .use(XHR) with .use(Transloadit, { onlyRemoteFiles: true }), // local files are uploaded with this plugin and remote files with the Transloadit plugin. // Since the Transloadit plugin uses the tus plugin underneath, it's possible to have file.tus // even though we are in this plugin. diff --git a/private/dev/Dashboard.js b/private/dev/Dashboard.js index 3b16662e26..cd8bb5bbd7 100644 --- a/private/dev/Dashboard.js +++ b/private/dev/Dashboard.js @@ -201,7 +201,7 @@ export default () => { service: TRANSLOADIT_SERVICE_URL, waitForEncoding: true, assemblyOptions, - companionOnly: true, + onlyRemoteFiles: true, }) break case 's3-multipart': @@ -216,12 +216,6 @@ export default () => { limit: 6, bundle: false, }) - uppyDashboard.use(Transloadit, { - service: TRANSLOADIT_SERVICE_URL, - waitForEncoding: true, - assemblyOptions, - companionOnly: true, - }) break case 'transloadit': uppyDashboard.use(Transloadit, { @@ -236,7 +230,7 @@ export default () => { waitForEncoding: true, importFromUploadURLs: true, assemblyOptions, - companionOnly: true, + onlyRemoteFiles: true, }) break case 'transloadit-xhr':