Skip to content

Commit

Permalink
feat(workflows): Add workflows ids to store options (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
pcholuj committed Oct 10, 2018
1 parent caa6c4a commit 4ca1b34
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/lib/api/upload/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,9 @@ export const complete = (etags: string, { config, file, params }: Context): Prom
...params,
};

if (config.workflowIds && config.workflowIds.length) {
fields['workflow_ids'] = JSON.stringify(config.workflowIds);
if (config.store.workflowIds && config.store.workflowIds.length) {
fields['workflow_ids'] = JSON.stringify(config.store.workflowIds);
delete config.store.workflowIds;
}

// Intelligent Ingestion
Expand Down
5 changes: 0 additions & 5 deletions src/lib/api/upload/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,6 @@ 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 {
Expand Down
3 changes: 2 additions & 1 deletion src/lib/api/upload/upload.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,8 @@ if (ENV.testEnv === 'unit') {
it('should upload a file successfully with provided workflows ids', (done) => {
upload(session, smallFile, {
retry: 0,
mimetype: 'image/gif',
mimetype: 'image/gif'
}, {
workflowIds: ['test', 'test1']
})
.then((res: any) => {
Expand Down
4 changes: 3 additions & 1 deletion src/lib/api/upload/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,15 +456,16 @@ 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') },
{ name: 'region', type: t.String },
{ name: 'path', type: t.String },
{ name: 'container', type: t.String },
{ name: 'filename', type: t.String },
{ name: 'access', type: t.enums.of('public private') },
{ name: 'workflowIds', type: t.list(t.String) },
];

// Throw if any options are invalid
Expand Down Expand Up @@ -517,6 +518,7 @@ export const upload = (
customName,
mimetype: options.mimetype,
store: {
workflowIds: storeOpts.workflowIds,
store_location: storeOpts.location,
store_region: storeOpts.region,
store_container: storeOpts.container,
Expand Down
5 changes: 5 additions & 0 deletions src/lib/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ export interface StoreOptions {
* S3 container access. 'public' or 'private'.
*/
access?: string;

/**
* Workflows ids to run after upload
*/
workflowIds?: string[];
}

export interface ClientOptions {
Expand Down
5 changes: 5 additions & 0 deletions src/lib/picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ export interface PickerStoreOptions {
* S3 container access. 'public' or 'private'.
*/
access?: string;

/**
* Workflows ids to run after upload
*/
workflowsIds?: string[];
}

export interface PickerCustomText {
Expand Down

0 comments on commit 4ca1b34

Please sign in to comment.