Skip to content

Commit

Permalink
Rename companionOnly -> onlyRemoteFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Murderlon committed Jan 23, 2025
1 parent 9fa3f7d commit 1bcd04c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
6 changes: 3 additions & 3 deletions packages/@uppy/aws-s3/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ export default class AwsS3Multipart<
#getCompanionClientArgs(file: UppyFile<M, B>) {
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.
Expand All @@ -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,
}
}
Expand Down
12 changes: 6 additions & 6 deletions packages/@uppy/transloadit/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export interface TransloaditOptions<M extends Meta, B extends Body>
* 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[]
Expand All @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/xhr-upload/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 2 additions & 8 deletions private/dev/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export default () => {
service: TRANSLOADIT_SERVICE_URL,
waitForEncoding: true,
assemblyOptions,
companionOnly: true,
onlyRemoteFiles: true,
})
break
case 's3-multipart':
Expand All @@ -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, {
Expand All @@ -236,7 +230,7 @@ export default () => {
waitForEncoding: true,
importFromUploadURLs: true,
assemblyOptions,
companionOnly: true,
onlyRemoteFiles: true,
})
break
case 'transloadit-xhr':
Expand Down

0 comments on commit 1bcd04c

Please sign in to comment.