Skip to content

Commit dbb0b4b

Browse files
authored
Feature/add fallback option (#212)
* feat(filelink): Add fallback task
1 parent 6041eff commit dbb0b4b

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

rollup.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const nodeResolve = require('rollup-plugin-node-resolve');
66
const replace = require('rollup-plugin-replace');
77
const json = require('rollup-plugin-json');
88
const babel = require('rollup-plugin-babel');
9-
const inject = require('rollup-plugin-inject');
109

1110
const adapters = {
1211
'./lib/api/security': 'build/module/adapters/security.browser.js',

src/lib/filelink.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,11 @@ export interface PdfConvertParams {
420420
pages?: (string | number)[];
421421
}
422422

423+
export interface FallbackParams {
424+
handle: string;
425+
cache: number;
426+
}
427+
423428
const handleRegexp = /^[\w\-]{20}$/;
424429

425430
/**
@@ -1168,6 +1173,18 @@ export class Filelink {
11681173
return this.addTask('pdfconvert', params);
11691174
}
11701175

1176+
/**
1177+
* Adds fallback transformation
1178+
*
1179+
* @see https://www.filestack.com/docs/api/processing/#fallback
1180+
* @param {(FallbackParams)} params
1181+
* @returns this
1182+
* @memberof Filelink
1183+
*/
1184+
fallback(params: FallbackParams) {
1185+
return this.addTask('fallback', params);
1186+
}
1187+
11711188
/**
11721189
* Checks if source is external
11731190
*

src/schema/transforms.schema.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,5 +1335,20 @@ export const TransformSchema = {
13351335
required: ['pages'],
13361336
}],
13371337
},
1338+
fallback: {
1339+
type: 'object',
1340+
additionalProperties: false,
1341+
properties: {
1342+
handle: {
1343+
type: 'string',
1344+
},
1345+
cache: {
1346+
type: 'integer',
1347+
minimum: 1,
1348+
maximum: 31536000,
1349+
},
1350+
},
1351+
required: ['handle'],
1352+
},
13381353
},
13391354
};

0 commit comments

Comments
 (0)