packages/ove-lib-appbase/src/index.js
function (source, target, res) {
        if (!module.exports.operations.canDiff || !module.exports.operations.diff) {
            log.warn('Difference operation not implemented by application');
            Utils.sendMessage(res, HttpStatus.NOT_IMPLEMENTED, JSON.stringify({ error: 'operation not implemented' }));
        } else if (Utils.isNullOrEmpty(target)) {
            log.error('Target state not provided');
            Utils.sendMessage(res, HttpStatus.BAD_REQUEST, JSON.stringify({ error: 'invalid states' }));
        } else if (!module.exports.operations.canDiff(source, target)) {
            log.error('Unable to get difference from source:', source, 'to target:', target);
            Utils.sendMessage(res, HttpStatus.BAD_REQUEST, JSON.stringify({ error: 'invalid states' }));
        } else {
            const result = module.exports.operations.diff(source, target);
            log.debug('Successfully computed difference', result, 'from source:', source, 'to target:', target);
            Utils.sendMessage(res, HttpStatus.OK, JSON.stringify(result));
        }
    }
function (source, target, res) {
        if (!module.exports.operations.canDiff || !module.exports.operations.diff) {
            log.warn('Difference operation not implemented by application');
            Utils.sendMessage(res, HttpStatus.NOT_IMPLEMENTED, JSON.stringify({ error: 'operation not implemented' }));
        } else if (Utils.isNullOrEmpty(target)) {
            log.error('Target state not provided');
            Utils.sendMessage(res, HttpStatus.BAD_REQUEST, JSON.stringify({ error: 'invalid states' }));
        } else if (!module.exports.operations.canDiff(source, target)) {
            log.error('Unable to get difference from source:', source, 'to target:', target);
            Utils.sendMessage(res, HttpStatus.BAD_REQUEST, JSON.stringify({ error: 'invalid states' }));
        } else {
            const result = module.exports.operations.diff(source, target);
            log.debug('Successfully computed difference', result, 'from source:', source, 'to target:', target);
            Utils.sendMessage(res, HttpStatus.OK, JSON.stringify(result));
        }
    }
function ( source , target , res ) { if ( ! module . exports . operations . canDiff || ! module . exports . operations . diff ) { log . warn ( 'Difference operation not implemented by application' ) ; Utils . sendMessage ( res , HttpStatus . NOT_IMPLEMENTED , JSON . stringify ( { error : 'operation not implemented' } ) ) ; } else if ( Utils . isNullOrEmpty ( target ) ) { log . error ( 'Target state not provided' ) ; Utils . sendMessage ( res , HttpStatus . BAD_REQUEST , JSON . stringify ( { error : 'invalid states' } ) ) ; } else if ( ! module . exports . operations . canDiff ( source , target ) ) { log . error ( 'Unable to get difference from source:' , source , 'to target:' , target ) ; Utils . sendMessage ( res , HttpStatus . BAD_REQUEST , JSON . stringify ( { error : 'invalid states' } ) ) ; } else { const result = module . exports . operations . diff ( source , target ) ; log . debug ( 'Successfully computed difference' , result , 'from source:' , source , 'to target:' , target ) ; Utils . sendMessage ( res , HttpStatus . OK , JSON . stringify ( result ) ) ; } }
Internal utility function to calculate difference between two states
Internal utility function to calculate difference between two states