diff --git a/src/lib/api/upload/network.ts b/src/lib/api/upload/network.ts index 42dc3e07..adbd746f 100644 --- a/src/lib/api/upload/network.ts +++ b/src/lib/api/upload/network.ts @@ -170,6 +170,7 @@ export const complete = (etags: string, { config, file, params }: Context): Prom /* istanbul ignore next */ const host = getHost(config.host) || getLocationURL(params.location_url); const locationRegion = params.location_region; + const fields = { apikey: config.apikey, size: file.size, @@ -178,6 +179,11 @@ export const complete = (etags: string, { config, file, params }: Context): Prom parts: formatETags(etags), ...params, }; + + if (config.workflowIds && config.workflowIds.length) { + fields['workflow_ids'] = JSON.stringify(config.workflowIds); + } + // Intelligent Ingestion if (config.intelligent) { fields.multipart = true; diff --git a/src/lib/api/upload/types.ts b/src/lib/api/upload/types.ts index ce904b8a..707f4c03 100644 --- a/src/lib/api/upload/types.ts +++ b/src/lib/api/upload/types.ts @@ -98,6 +98,11 @@ export interface UploadOptions { * Set the default intiial chunk size for Intelligent Ingestion. Defaults to 8MB on desktop and 1MB on mobile. */ intelligentChunkSize?: number; + + /** + * Array with workflow ids + */ + workflowIds?: string[]; } export interface FSProgressEvent { diff --git a/src/lib/api/upload/upload.spec.ts b/src/lib/api/upload/upload.spec.ts index ad654ba5..4f49c4fb 100644 --- a/src/lib/api/upload/upload.spec.ts +++ b/src/lib/api/upload/upload.spec.ts @@ -467,6 +467,22 @@ if (ENV.testEnv === 'unit') { done(); }); }); + + it('should upload a file successfully with provided workflows ids', (done) => { + upload(session, smallFile, { + retry: 0, + mimetype: 'image/gif', + workflowIds: ['test', 'test1'] + }) + .then((res: any) => { + assert.ok(res.handle); + assert.ok(res.url); + done(); + }) + .catch((err: Error) => { + done(err); + }); + }); }); }); } diff --git a/src/lib/api/upload/upload.ts b/src/lib/api/upload/upload.ts index d3f4adf9..7b85ac9b 100644 --- a/src/lib/api/upload/upload.ts +++ b/src/lib/api/upload/upload.ts @@ -456,6 +456,7 @@ export const upload = ( { name: 'timeout', type: t.Integer }, { name: 'intelligent', type: t.union([t.Boolean, t.enums.of('fallback')]) }, { name: 'intelligentChunkSize', type: t.Number }, + { name: 'workflowIds', type: t.list(t.String) }, ]; const allowedStoreOptions = [ { name: 'location', type: t.enums.of('s3 gcs rackspace azure dropbox') },