blitline-s3
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -18,2 +18,6 @@ 'use strict'; | ||
var _path = require('path'); | ||
var _path2 = _interopRequireDefault(_path); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -71,4 +75,4 @@ | ||
var data = JSON.parse(chunks.join('')); | ||
data.results = JSON.parse(data.results); | ||
resolve(data); | ||
var results = JSON.parse(data.results); | ||
resolve(results); | ||
} catch (e) { | ||
@@ -95,3 +99,3 @@ reject(e); | ||
var configFunction = function configFunction(func) { | ||
var formatFunction = function formatFunction(func, id) { | ||
var save = func.save; | ||
@@ -102,3 +106,3 @@ | ||
save: { | ||
image_identifier: save, | ||
image_identifier: id, | ||
s3_destination: { | ||
@@ -114,33 +118,37 @@ bucket: BUCKET, | ||
var formatImage = function formatImage(_ref) { | ||
var image_identifier = _ref.image_identifier; | ||
var meta = _ref.meta; | ||
return { | ||
uri: uriPrefix + image_identifier, | ||
meta: meta | ||
}; | ||
}; | ||
var formatPollingResponse = function formatPollingResponse(_ref2) { | ||
var _ref2$results = _ref2.results; | ||
var job_id = _ref2$results.job_id; | ||
var original_meta = _ref2$results.original_meta; | ||
var images = _ref2$results.images; | ||
return { | ||
jobId: job_id, | ||
originalMeta: original_meta, | ||
images: images.map(formatImage) | ||
}; | ||
}; | ||
return function (src, functions, options) { | ||
return function (uri, funcMap, options) { | ||
_simple_blitline_node2.default.addJob(_extends({}, jobOptions, { | ||
application_id: APPLICATION_ID | ||
}, options, { | ||
src: src, | ||
functions: functions.map(configFunction) | ||
src: uri, | ||
functions: Object.keys(funcMap).map(function (key) { | ||
return formatFunction(funcMap[key], key); | ||
}) | ||
})); | ||
return _simple_blitline_node2.default.postJobs().then(pollFromJobResponse).then(formatPollingResponse); | ||
return _simple_blitline_node2.default.postJobs().then(pollFromJobResponse).then(function (_ref) { | ||
var job_id = _ref.job_id; | ||
var original_meta = _ref.original_meta; | ||
var images = _ref.images; | ||
return { | ||
jobId: job_id, | ||
images: images.reduce(function (obj, _ref2) { | ||
var image_identifier = _ref2.image_identifier; | ||
var s3_url = _ref2.s3_url; | ||
var meta = _ref2.meta; | ||
obj[image_identifier] = { | ||
uri: uriPrefix + _path2.default.basename(s3_url), | ||
meta: meta | ||
}; | ||
return obj; | ||
}, { | ||
original: { | ||
uri: uri, | ||
meta: original_meta | ||
} | ||
}) | ||
}; | ||
}); | ||
}; | ||
}; |
{ | ||
"name": "blitline-s3", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Post Blitline jobs that uploads to s3 and do polling for the jobs.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6749
123