filestack-js
Advanced tools
Comparing version 1.7.6 to 1.7.7
@@ -89,5 +89,4 @@ "use strict"; | ||
var sliceFile = function (ctx, partNumber) { | ||
var slice = File.prototype.slice; | ||
var _a = getRange(ctx, partNumber), start = _a.start, end = _a.end; | ||
return slice.call(ctx.file, start, end); | ||
return ctx.file.slice(start, end); | ||
}; | ||
@@ -94,0 +93,0 @@ /** |
@@ -14,3 +14,3 @@ import { SecurityOptions, getSecurity } from './lib/api/security'; | ||
*/ | ||
export declare const version = "1.7.6"; | ||
export declare const version = "1.7.7"; | ||
export { TransformOptions, EStyleType, EShapeType, ENoiseType, EFitOptions, EColorspaceType, EBlurMode, EAlignOptions, EAlignFacesOptions, ECropfacesType, SecurityOptions, getSecurity }; |
@@ -44,2 +44,2 @@ "use strict"; | ||
*/ | ||
exports.version = '1.7.6'; | ||
exports.version = '1.7.7'; |
@@ -28,3 +28,3 @@ "use strict"; | ||
}; | ||
describe.skip('cloud', function cloud() { | ||
describe('cloud', function cloud() { | ||
this.timeout(60000); | ||
@@ -60,2 +60,5 @@ it('should construct an instance of CloudClient', function () { | ||
it('should save token if sessionCache is true -- BROWSER ONLY', function (done) { | ||
if (typeof localStorage === 'undefined') { | ||
return done(); | ||
} | ||
var client = new cloud_1.CloudClient(session, { sessionCache: true }); | ||
@@ -62,0 +65,0 @@ client.list(mockClouds) |
@@ -28,3 +28,3 @@ "use strict"; | ||
var newReq = agent; | ||
return newReq[method](url).set('Filestack-Source', 'JS-1.7.6'); | ||
return newReq[method](url).set('Filestack-Source', 'JS-1.7.7'); | ||
}; | ||
@@ -31,0 +31,0 @@ exports.requestWithSource = requestWithSource; |
@@ -99,2 +99,13 @@ "use strict"; | ||
}); | ||
it('should support workflows', function (done) { | ||
var options = { workflows: ['test', { id: 'test' }] }; | ||
store_1.storeURL(session, ENV.urls.testImageUrl, options) | ||
.then(function (res) { | ||
assert.ok(res); | ||
done(); | ||
}) | ||
.catch(function (err) { | ||
done(err); | ||
}); | ||
}); | ||
}); |
@@ -61,3 +61,3 @@ "use strict"; | ||
size: inputFile.byteLength, | ||
type: getMimetype(inputFile), | ||
type: getMimetype(inputFile) | ||
}); | ||
@@ -64,0 +64,0 @@ } |
@@ -46,8 +46,16 @@ "use strict"; | ||
Object.keys(fields).forEach(function (key) { | ||
if (fields[key]) | ||
if (typeof fields[key] === 'object') { | ||
fields[key] = JSON.stringify(fields[key]); | ||
} | ||
if (fields[key]) { | ||
fd[key] = fields[key]; | ||
} | ||
}); | ||
Object.keys(store).forEach(function (key) { | ||
if (store[key]) | ||
if (typeof store[key] === 'object') { | ||
store[key] = JSON.stringify(store[key]); | ||
} | ||
if (store[key]) { | ||
fd[key] = store[key]; | ||
} | ||
}); | ||
@@ -166,6 +174,2 @@ return fd; | ||
var fields = tslib_1.__assign({ apikey: config.apikey, size: file.size, filename: utils_1.getName(file, config), mimetype: config.mimetype || file.type || 'application/octet-stream', parts: formatETags(etags) }, params); | ||
if (config.store.workflows && config.store.workflows.length) { | ||
fields['workflows'] = JSON.stringify(config.store.workflows); | ||
delete config.store.workflows; | ||
} | ||
// Intelligent Ingestion | ||
@@ -172,0 +176,0 @@ if (config.intelligent) { |
@@ -5,3 +5,3 @@ /// <reference types="node" /> | ||
*/ | ||
export interface FileObj { | ||
export interface FileObj extends File { | ||
buffer: Buffer; | ||
@@ -8,0 +8,0 @@ name: string; |
@@ -169,4 +169,4 @@ "use strict"; | ||
token.pause(); | ||
setTimeout(function () { return token.resume(); }); | ||
}); | ||
setTimeout(function () { return token.resume(); }, 10); | ||
}, 10); | ||
}); | ||
@@ -299,4 +299,23 @@ it('should upload a file and report progress', function (done) { | ||
}); | ||
setTimeout(function () { return token.cancel(); }); | ||
// wait until upload will start | ||
setTimeout(function () { return token.cancel(); }, 10); | ||
}); | ||
it('should upload a file successfully with provided workflows ids', function (done) { | ||
index_1.upload(session, smallFile, { | ||
mimetype: 'image/gif', | ||
}, { | ||
filename: 'dutton.gif', | ||
workflows: ['test', { | ||
id: 'test', | ||
}] | ||
}) | ||
.then(function (res) { | ||
assert.ok(res.handle); | ||
assert.ok(res.url); | ||
done(); | ||
}) | ||
.catch(function (err) { | ||
done(err); | ||
}); | ||
}); | ||
}); | ||
@@ -410,22 +429,4 @@ // Retry with failure simulation via toxy | ||
}); | ||
it('should upload a file successfully with provided workflows ids', function (done) { | ||
index_1.upload(session, smallFile, { | ||
retry: 0, | ||
mimetype: 'image/gif' | ||
}, { | ||
workflows: ['test', { | ||
id: 'test' | ||
}] | ||
}) | ||
.then(function (res) { | ||
assert.ok(res.handle); | ||
assert.ok(res.url); | ||
done(); | ||
}) | ||
.catch(function (err) { | ||
done(err); | ||
}); | ||
}); | ||
}); | ||
}); | ||
} |
@@ -87,5 +87,4 @@ /* | ||
var sliceFile = function (ctx, partNumber) { | ||
var slice = File.prototype.slice; | ||
var _a = getRange(ctx, partNumber), start = _a.start, end = _a.end; | ||
return slice.call(ctx.file, start, end); | ||
return ctx.file.slice(start, end); | ||
}; | ||
@@ -92,0 +91,0 @@ /** |
@@ -14,3 +14,3 @@ import { SecurityOptions, getSecurity } from './lib/api/security'; | ||
*/ | ||
export declare const version = "1.7.6"; | ||
export declare const version = "1.7.7"; | ||
export { TransformOptions, EStyleType, EShapeType, ENoiseType, EFitOptions, EColorspaceType, EBlurMode, EAlignOptions, EAlignFacesOptions, ECropfacesType, SecurityOptions, getSecurity }; |
@@ -32,3 +32,3 @@ /* | ||
*/ | ||
export var version = '1.7.6'; | ||
export var version = '1.7.7'; | ||
export { EStyleType, EShapeType, ENoiseType, EFitOptions, EColorspaceType, EBlurMode, EAlignOptions, EAlignFacesOptions, ECropfacesType, getSecurity }; |
@@ -26,3 +26,3 @@ /* | ||
}; | ||
describe.skip('cloud', function cloud() { | ||
describe('cloud', function cloud() { | ||
this.timeout(60000); | ||
@@ -58,2 +58,5 @@ it('should construct an instance of CloudClient', function () { | ||
it('should save token if sessionCache is true -- BROWSER ONLY', function (done) { | ||
if (typeof localStorage === 'undefined') { | ||
return done(); | ||
} | ||
var client = new CloudClient(session, { sessionCache: true }); | ||
@@ -60,0 +63,0 @@ client.list(mockClouds) |
@@ -26,3 +26,3 @@ /* | ||
var newReq = agent; | ||
return newReq[method](url).set('Filestack-Source', 'JS-1.7.6'); | ||
return newReq[method](url).set('Filestack-Source', 'JS-1.7.7'); | ||
}; | ||
@@ -29,0 +29,0 @@ /** |
@@ -97,2 +97,13 @@ /* | ||
}); | ||
it('should support workflows', function (done) { | ||
var options = { workflows: ['test', { id: 'test' }] }; | ||
storeURL(session, ENV.urls.testImageUrl, options) | ||
.then(function (res) { | ||
assert.ok(res); | ||
done(); | ||
}) | ||
.catch(function (err) { | ||
done(err); | ||
}); | ||
}); | ||
}); |
@@ -59,3 +59,3 @@ /* | ||
size: inputFile.byteLength, | ||
type: getMimetype(inputFile), | ||
type: getMimetype(inputFile) | ||
}); | ||
@@ -62,0 +62,0 @@ } |
@@ -44,8 +44,16 @@ /* | ||
Object.keys(fields).forEach(function (key) { | ||
if (fields[key]) | ||
if (typeof fields[key] === 'object') { | ||
fields[key] = JSON.stringify(fields[key]); | ||
} | ||
if (fields[key]) { | ||
fd[key] = fields[key]; | ||
} | ||
}); | ||
Object.keys(store).forEach(function (key) { | ||
if (store[key]) | ||
if (typeof store[key] === 'object') { | ||
store[key] = JSON.stringify(store[key]); | ||
} | ||
if (store[key]) { | ||
fd[key] = store[key]; | ||
} | ||
}); | ||
@@ -164,6 +172,2 @@ return fd; | ||
var fields = tslib_1.__assign({ apikey: config.apikey, size: file.size, filename: getName(file, config), mimetype: config.mimetype || file.type || 'application/octet-stream', parts: formatETags(etags) }, params); | ||
if (config.store.workflows && config.store.workflows.length) { | ||
fields['workflows'] = JSON.stringify(config.store.workflows); | ||
delete config.store.workflows; | ||
} | ||
// Intelligent Ingestion | ||
@@ -170,0 +174,0 @@ if (config.intelligent) { |
@@ -5,3 +5,3 @@ /// <reference types="node" /> | ||
*/ | ||
export interface FileObj { | ||
export interface FileObj extends File { | ||
buffer: Buffer; | ||
@@ -8,0 +8,0 @@ name: string; |
@@ -167,4 +167,4 @@ /* | ||
token.pause(); | ||
setTimeout(function () { return token.resume(); }); | ||
}); | ||
setTimeout(function () { return token.resume(); }, 10); | ||
}, 10); | ||
}); | ||
@@ -297,4 +297,23 @@ it('should upload a file and report progress', function (done) { | ||
}); | ||
setTimeout(function () { return token.cancel(); }); | ||
// wait until upload will start | ||
setTimeout(function () { return token.cancel(); }, 10); | ||
}); | ||
it('should upload a file successfully with provided workflows ids', function (done) { | ||
upload(session, smallFile, { | ||
mimetype: 'image/gif', | ||
}, { | ||
filename: 'dutton.gif', | ||
workflows: ['test', { | ||
id: 'test', | ||
}] | ||
}) | ||
.then(function (res) { | ||
assert.ok(res.handle); | ||
assert.ok(res.url); | ||
done(); | ||
}) | ||
.catch(function (err) { | ||
done(err); | ||
}); | ||
}); | ||
}); | ||
@@ -408,22 +427,4 @@ // Retry with failure simulation via toxy | ||
}); | ||
it('should upload a file successfully with provided workflows ids', function (done) { | ||
upload(session, smallFile, { | ||
retry: 0, | ||
mimetype: 'image/gif' | ||
}, { | ||
workflows: ['test', { | ||
id: 'test' | ||
}] | ||
}) | ||
.then(function (res) { | ||
assert.ok(res.handle); | ||
assert.ok(res.url); | ||
done(); | ||
}) | ||
.catch(function (err) { | ||
done(err); | ||
}); | ||
}); | ||
}); | ||
}); | ||
} |
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="1.7.7"></a> | ||
## [1.7.7](https://github.com/filestack/filestack-js/compare/v1.7.6...v1.7.7) (2018-10-29) | ||
### Bug Fixes | ||
* **browser_utils:** fix slice file in browser utils ([#166](https://github.com/filestack/filestack-js/issues/166)) ([9210eb7](https://github.com/filestack/filestack-js/commit/9210eb7)) | ||
<a name="1.7.6"></a> | ||
@@ -7,0 +17,0 @@ ## [1.7.6](https://github.com/filestack/filestack-js/compare/v1.7.5...v1.7.6) (2018-10-25) |
{ | ||
"name": "filestack-js", | ||
"version": "1.7.6", | ||
"version": "1.7.7", | ||
"description": "Official JavaScript library for Filestack", | ||
@@ -26,4 +26,6 @@ "main": "build/main/index.js", | ||
"toxy": "node test/toxy.js", | ||
"test": "npm run build && concurrently -r --kill-others 'npm run prism:mock' 'npm run toxy' 'npm run lint && TEST_ENV=unit karma start && TEST_ENV=unit nyc mocha'", | ||
"test:mocha": "npm run build && concurrently -r --kill-others 'npm run prism:mock' 'npm run toxy' 'npm run lint' 'TEST_ENV=unit nyc mocha'", | ||
"test": "npm run build && npm run lint && npm-run-all -p -r 'prism:mock' 'toxy' 'test:runner'", | ||
"test:runner": "TEST_ENV=unit karma start && TEST_ENV=unit nyc mocha", | ||
"test:runner:mocha": "TEST_ENV=unit nyc mocha", | ||
"test:mocha": "npm run build && npm run lint && npm-run-all -p -r 'prism:mock' 'toxy' 'test:runner:mocha'", | ||
"test:integration": "npm run build && npm run lint && TEST_ENV=integration karma start && TEST_ENV=integration nyc mocha", | ||
@@ -62,3 +64,2 @@ "docs": "trash build/docs && typedoc src && opn build/docs/index.html", | ||
"browserify": "^14.5.0", | ||
"concurrently": "^3.6.1", | ||
"connect": "^3.6.6", | ||
@@ -92,2 +93,3 @@ "connect-prism": "^1.0.20", | ||
"mocha": "^5.2.0", | ||
"npm-run-all": "^4.1.3", | ||
"nyc": "^12.0.2", | ||
@@ -94,0 +96,0 @@ "opn-cli": "^3.1.0", |
@@ -91,5 +91,5 @@ /* | ||
const sliceFile = (ctx: Context, partNumber: number) => { | ||
const slice = File.prototype.slice; | ||
const { start, end } = getRange(ctx, partNumber); | ||
return slice.call(ctx.file, start, end); | ||
return ctx.file.slice(start, end); | ||
}; | ||
@@ -96,0 +96,0 @@ |
@@ -31,3 +31,3 @@ /* | ||
describe.skip('cloud', function cloud() { | ||
describe('cloud', function cloud() { | ||
this.timeout(60000); | ||
@@ -67,2 +67,6 @@ | ||
it('should save token if sessionCache is true -- BROWSER ONLY', (done) => { | ||
if (typeof localStorage === 'undefined') { | ||
return done(); | ||
} | ||
const client = new CloudClient(session, { sessionCache: true }); | ||
@@ -69,0 +73,0 @@ client.list(mockClouds) |
@@ -111,2 +111,15 @@ /* | ||
}); | ||
it('should support workflows', (done) => { | ||
const options = { workflows: ['test', {id: 'test' }] }; | ||
storeURL(session, ENV.urls.testImageUrl, options) | ||
.then((res) => { | ||
assert.ok(res); | ||
done(); | ||
}) | ||
.catch((err) => { | ||
done(err); | ||
}); | ||
}); | ||
}); |
@@ -71,4 +71,4 @@ /* | ||
size: inputFile.byteLength, | ||
type: getMimetype(inputFile), | ||
}); | ||
type: getMimetype(inputFile) | ||
} as FileObj); | ||
} | ||
@@ -75,0 +75,0 @@ |
@@ -47,6 +47,19 @@ /* | ||
Object.keys(fields).forEach((key: string) => { | ||
if (fields[key]) fd[key] = fields[key]; | ||
if (typeof fields[key] === 'object') { | ||
fields[key] = JSON.stringify(fields[key]); | ||
} | ||
if (fields[key]) { | ||
fd[key] = fields[key]; | ||
} | ||
}); | ||
Object.keys(store).forEach((key: string) => { | ||
if (store[key]) fd[key] = store[key]; | ||
if (typeof store[key] === 'object') { | ||
store[key] = JSON.stringify(store[key]); | ||
} | ||
if (store[key]) { | ||
fd[key] = store[key]; | ||
} | ||
}); | ||
@@ -64,2 +77,3 @@ return fd; | ||
export const start = ({ config, file }: Context): Promise<any> => { | ||
const fields: any = { | ||
@@ -185,7 +199,2 @@ apikey: config.apikey, | ||
if (config.store.workflows && config.store.workflows.length) { | ||
fields['workflows'] = JSON.stringify(config.store.workflows); | ||
delete config.store.workflows; | ||
} | ||
// Intelligent Ingestion | ||
@@ -204,2 +213,3 @@ if (config.intelligent) { | ||
const formData = getFormData(fields, config); | ||
const req = requestWithSource('post', `${host}/multipart/complete`); | ||
@@ -206,0 +216,0 @@ /* istanbul ignore next */ |
@@ -21,3 +21,3 @@ /* | ||
*/ | ||
export interface FileObj { | ||
export interface FileObj extends File { | ||
buffer: Buffer; | ||
@@ -24,0 +24,0 @@ name: string; |
@@ -214,4 +214,4 @@ /* | ||
token.pause(); | ||
setTimeout(() => token.resume()); | ||
}); | ||
setTimeout(() => token.resume(), 10); | ||
}, 10); | ||
}); | ||
@@ -353,4 +353,24 @@ | ||
setTimeout(() => token.cancel()); | ||
// wait until upload will start | ||
setTimeout(() => token.cancel(), 10); | ||
}); | ||
it('should upload a file successfully with provided workflows ids', (done) => { | ||
upload(session, smallFile, { | ||
mimetype: 'image/gif', | ||
}, { | ||
filename: 'dutton.gif', | ||
workflows: ['test', { | ||
id: 'test', | ||
}] | ||
}) | ||
.then((res: any) => { | ||
assert.ok(res.handle); | ||
assert.ok(res.url); | ||
done(); | ||
}) | ||
.catch((err: Error) => { | ||
done(err); | ||
}); | ||
}); | ||
}); | ||
@@ -472,23 +492,4 @@ | ||
}); | ||
it('should upload a file successfully with provided workflows ids', (done) => { | ||
upload(session, smallFile, { | ||
retry: 0, | ||
mimetype: 'image/gif' | ||
}, { | ||
workflows: ['test', { | ||
id: 'test' | ||
}] | ||
}) | ||
.then((res: any) => { | ||
assert.ok(res.handle); | ||
assert.ok(res.url); | ||
done(); | ||
}) | ||
.catch((err: Error) => { | ||
done(err); | ||
}); | ||
}); | ||
}); | ||
}); | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
2692809
34944