lib/impl/dataSources/updateCache.js
function prepareResponse(validDataSources, invalidDataSources, cb) {
  //There Were Errors Updating Data Sources, should return an error

  logger.debug("prepareResponse Before", validDataSources);
  //For The Valid Data Sources, Just want the updated Document JSON
  validDataSources = _.map(validDataSources, function(validDataSourceData) {
    return processDataSourceResponse(validDataSourceData.document.toJSON());
  });

  logger.debug("prepareResponse After", validDataSources);

  var returnError;
  if (invalidDataSources.length > 0) {
    returnError = buildErrorResponse({
      error: new Error("Error Updating Data Sources"),
      code: ERROR_CODES.FH_FORMS_UNEXPECTED_ERROR
    });
  }

  return cb(returnError, {
    validDataSourceUpdates: validDataSources,
    invalidDataSourceUpdates: invalidDataSources
  });
}
function prepareResponse(validDataSources, invalidDataSources, cb) {
  //There Were Errors Updating Data Sources, should return an error

  logger.debug("prepareResponse Before", validDataSources);
  //For The Valid Data Sources, Just want the updated Document JSON
  validDataSources = _.map(validDataSources, function(validDataSourceData) {
    return processDataSourceResponse(validDataSourceData.document.toJSON());
  });

  logger.debug("prepareResponse After", validDataSources);

  var returnError;
  if (invalidDataSources.length > 0) {
    returnError = buildErrorResponse({
      error: new Error("Error Updating Data Sources"),
      code: ERROR_CODES.FH_FORMS_UNEXPECTED_ERROR
    });
  }

  return cb(returnError, {
    validDataSourceUpdates: validDataSources,
    invalidDataSourceUpdates: invalidDataSources
  });
}
function prepareResponse ( validDataSources , invalidDataSources , cb ) { //There Were Errors Updating Data Sources, should return an error logger . debug ( "prepareResponse Before" , validDataSources ) ; //For The Valid Data Sources, Just want the updated Document JSON validDataSources = _ . map ( validDataSources , function ( validDataSourceData ) { return processDataSourceResponse ( validDataSourceData . document . toJSON ( ) ) ; } ) ; logger . debug ( "prepareResponse After" , validDataSources ) ; var returnError ; if ( invalidDataSources . length > 0 ) { returnError = buildErrorResponse ( { error : new Error ( "Error Updating Data Sources" ) , code : ERROR_CODES . FH_FORMS_UNEXPECTED_ERROR } ) ; } return cb ( returnError , { validDataSourceUpdates : validDataSources , invalidDataSourceUpdates : invalidDataSources } ) ; }
Preparing The JSON Response For The Data Source Cache Update.
@param validDataSources
@param invalidDataSources
@param cb
@returns {*}
Preparing The JSON Response For The Data Source Cache Update .