Skip to content

Commit

Permalink
@uppy/transloadit: do not rely on deprecated options
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Jun 6, 2023
1 parent 72f579e commit a30ed97
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/@uppy/transloadit/src/AssemblyOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function dedupe (list) {
}))
}

async function getAssemblyOptions (file, options) {
export async function getAssemblyOptions (file, options) {
const assemblyOptions = typeof options.assemblyOptions === 'function'
? await options.assemblyOptions(file, options)
: options.assemblyOptions
Expand Down
10 changes: 3 additions & 7 deletions packages/@uppy/transloadit/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import BasePlugin from '@uppy/core/lib/BasePlugin.js'
import Tus from '@uppy/tus'
import Assembly from './Assembly.js'
import Client from './Client.js'
import AssemblyOptions, { validateParams } from './AssemblyOptions.js'
import AssemblyOptions, { validateParams, getAssemblyOptions } from './AssemblyOptions.js'
import AssemblyWatcher from './AssemblyWatcher.js'

import locale from './locale.js'
Expand Down Expand Up @@ -191,12 +191,8 @@ export default class Transloadit extends BasePlugin {
#createAssembly (fileIDs, uploadID, options) {
this.uppy.log('[Transloadit] Create Assembly')

return this.client.createAssembly({
params: options.params,
fields: options.fields,
expectedFiles: fileIDs.length,
signature: options.signature,
}).then(async (newAssembly) => {
const createAssembly = assemblyOptions => this.client.createAssembly(assemblyOptions)
return getAssemblyOptions(fileIDs, options).then(createAssembly).then(async (newAssembly) => {
const files = this.uppy.getFiles().filter(({ id }) => fileIDs.includes(id))
if (files.length !== fileIDs.length) {
if (files.length === 0) {
Expand Down

0 comments on commit a30ed97

Please sign in to comment.