contentful-batch-libs
Advanced tools
Comparing version 5.8.0 to 5.8.1
@@ -7,15 +7,15 @@ 'use strict'; | ||
exports.default = function (sourceSpace, destinationSpace, customTransformers) { | ||
exports.default = function (space, destinationSpace, customTransformers) { | ||
var entities = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : spaceEntities; | ||
var transformers = (0, _object.defaults)(customTransformers, defaultTransformers); | ||
var newSpace = _object.omit.apply(undefined, [sourceSpace].concat(_toConsumableArray(entities))); | ||
// Use bluebird collection methods to support async transforms. | ||
// TODO maybe we don't need promises here at all | ||
var newSpace = _object.omit.apply(undefined, [space].concat(_toConsumableArray(entities))); | ||
return _bluebird2.default.reduce(entities, function (newSpace, type) { | ||
var transformer = transformers[type]; | ||
var sourceEntities = sourceSpace[type]; | ||
var destinationEntities = destinationSpace[type]; | ||
var typeTransform = (0, _partialRight.partialRight)(applyTransformer, transformer, destinationEntities, destinationSpace); | ||
return _bluebird2.default.map(sourceEntities, typeTransform).then(function (entities) { | ||
return _bluebird2.default.map(space[type], function (entity) { | ||
return _bluebird2.default.resolve({ | ||
original: entity, | ||
transformed: transformers[type](entity, destinationSpace[type]) | ||
}); | ||
}).then(function (entities) { | ||
newSpace[type] = entities; | ||
@@ -33,4 +33,2 @@ return newSpace; | ||
var _partialRight = require('lodash/partialRight'); | ||
var _transformers = require('./transformers'); | ||
@@ -52,10 +50,2 @@ | ||
*/ | ||
function applyTransformer(entity, transformer, destinationEntities, destinationSpace) { | ||
return _bluebird2.default.props({ | ||
original: entity, | ||
transformed: transformer(entity, destinationEntities, destinationSpace) | ||
}); | ||
} | ||
module.exports = exports['default']; |
{ | ||
"name": "contentful-batch-libs", | ||
"version": "5.8.0", | ||
"version": "5.8.1", | ||
"description": "Library modules used by contentful batch utility CLI tools.", | ||
@@ -5,0 +5,0 @@ "main": "dist/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
52174
1072