// We create a new instance of the actual API for every item being processed. This is necessary because some of the input arguments will default to item-specific values, and some of the logic is dependent on task-specific metadata. This is a more efficient (and understandable) approach than pretending the API is stateless and then separately wrapping the API *again* for every individual item with a whole separate layer of input validation rules.
@ -261,6 +262,11 @@ module.exports = function (state) {
]
});
if(options.id===item.id){
// This hook is necessary to allow the task kernel to skip certain operations in this case, eg. storing the task result - it would be redundant, and reference a now non-existent item.
onDeleteSelf();
}
returnmutableOperation((tx)=>{
returnbackend.deleteItem(tx,options);
});
@ -294,6 +300,7 @@ module.exports = function (state) {
updateData:function(_options){
// NOTE: This is a semantically self-describing convenience wrapper for `storeItem` that updates the currently-being-processed item
// TODO: Have a dedicated alias and/or signature (for this function) for the common case of "just add a few attributes to whatever is already there"? ie. a shallow merge