Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(workflows): Add workflows ids to store options #159

Merged
merged 1 commit into from
Oct 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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