sdk/src/sync/operations.js
function getMetadata(tableName, action, item) {
        
        return Platform.async(function(callback) {
            callback();
        })().then(function() {
            var metadata = {};

            // If action is update and item defines version property OR if action is insert / update,
            // define metadata.version to be the item's version property
            if (action === 'upsert' || 
                action === 'insert' ||
                (action === 'update' && item.hasOwnProperty(versionColumnName))) {
                metadata[versionColumnName] = item[versionColumnName];
                return metadata;
            } else if (action == 'update' || action === 'delete') { // Read item's version property from the table
                return store.lookup(tableName, item[idPropertyName], true /* suppressRecordNotFoundError */).then(function(result) {
                    if (result) {
                        metadata[versionColumnName] = result[versionColumnName];
                    }
                    return metadata;
                });
            } else {
                throw new Error('Invalid action ' + action);
            }
        });
        
    }
function getMetadata(tableName, action, item) {
        
        return Platform.async(function(callback) {
            callback();
        })().then(function() {
            var metadata = {};

            // If action is update and item defines version property OR if action is insert / update,
            // define metadata.version to be the item's version property
            if (action === 'upsert' || 
                action === 'insert' ||
                (action === 'update' && item.hasOwnProperty(versionColumnName))) {
                metadata[versionColumnName] = item[versionColumnName];
                return metadata;
            } else if (action == 'update' || action === 'delete') { // Read item's version property from the table
                return store.lookup(tableName, item[idPropertyName], true /* suppressRecordNotFoundError */).then(function(result) {
                    if (result) {
                        metadata[versionColumnName] = result[versionColumnName];
                    }
                    return metadata;
                });
            } else {
                throw new Error('Invalid action ' + action);
            }
        });
        
    }
function getMetadata ( tableName , action , item ) { return Platform . async ( function ( callback ) { callback ( ) ; } ) ( ) . then ( function ( ) { var metadata = { } ; // If action is update and item defines version property OR if action is insert / update, // define metadata.version to be the item's version property if ( action === 'upsert' || action === 'insert' || ( action === 'update' && item . hasOwnProperty ( versionColumnName ) ) ) { metadata [ versionColumnName ] = item [ versionColumnName ] ; return metadata ; } else if ( action == 'update' || action === 'delete' ) { // Read item's version property from the table return store . lookup ( tableName , item [ idPropertyName ] , true /* suppressRecordNotFoundError */ ) . then ( function ( result ) { if ( result ) { metadata [ versionColumnName ] = result [ versionColumnName ] ; } return metadata ; } ) ; } else { throw new Error ( 'Invalid action ' + action ) ; } } ) ; }
Gets the metadata to associate with a log record in the operation table

@param action 'insert', 'update' and 'delete' correspond to the insert, update and delete operations.
'upsert' is a special action that is used only in the context of conflict handling.
Gets the metadata to associate with a log record in the operation table