lib/delta/delta.js
function resolveDirectoryConflicts(node, callback) {
  var rActions = node.remoteActions;
  var lActions = node.localActions;

  if(rActions && lActions) {
    if(rActions.create && lActions.create) {
      //on both sides created, we just need to add remoteId and remoteParent
      node.remoteId = rActions.create.remoteId;
      node.remoteParent = rActions.create.remoteParent;

      delete node.remoteActions;
      delete node.localActions;
    }

    //both sides renamed, remote wins
    if(rActions.rename && lActions.rename) delete lActions.rename;

    //both sides moved, remote wins
    if(rActions.move && lActions.move) delete lActions.move;

    //if remotely created and localy deleted node should be created localy
    if(rActions.create && lActions.delete) delete lActions.delete;

    //if localy created and remotely deleted node should be created remotely
    if(rActions.delete && lActions.create) delete rActions.delete;

    return syncDb.update(node._id, node, (err, updatedNode) => {
      return callback(null);
    });
  }

  return callback(null);
}
function resolveDirectoryConflicts(node, callback) {
  var rActions = node.remoteActions;
  var lActions = node.localActions;

  if(rActions && lActions) {
    if(rActions.create && lActions.create) {
      //on both sides created, we just need to add remoteId and remoteParent
      node.remoteId = rActions.create.remoteId;
      node.remoteParent = rActions.create.remoteParent;

      delete node.remoteActions;
      delete node.localActions;
    }

    //both sides renamed, remote wins
    if(rActions.rename && lActions.rename) delete lActions.rename;

    //both sides moved, remote wins
    if(rActions.move && lActions.move) delete lActions.move;

    //if remotely created and localy deleted node should be created localy
    if(rActions.create && lActions.delete) delete lActions.delete;

    //if localy created and remotely deleted node should be created remotely
    if(rActions.delete && lActions.create) delete rActions.delete;

    return syncDb.update(node._id, node, (err, updatedNode) => {
      return callback(null);
    });
  }

  return callback(null);
}
function resolveDirectoryConflicts ( node , callback ) { var rActions = node . remoteActions ; var lActions = node . localActions ; if ( rActions && lActions ) { if ( rActions . create && lActions . create ) { //on both sides created, we just need to add remoteId and remoteParent node . remoteId = rActions . create . remoteId ; node . remoteParent = rActions . create . remoteParent ; delete node . remoteActions ; delete node . localActions ; } //both sides renamed, remote wins if ( rActions . rename && lActions . rename ) delete lActions . rename ; //both sides moved, remote wins if ( rActions . move && lActions . move ) delete lActions . move ; //if remotely created and localy deleted node should be created localy if ( rActions . create && lActions . delete ) delete lActions . delete ; //if localy created and remotely deleted node should be created remotely if ( rActions . delete && lActions . create ) delete rActions . delete ; return syncDb . update ( node . _id , node , ( err , updatedNode ) => { return callback ( null ) ; } ) ; } return callback ( null ) ; }
Resolves conflicts for a directory node

@param {Object} node - node with applied actions from database
@param {Function} callback - callback function
@returns {void} - no return value
Resolves conflicts for a directory node