server/server.js
function maintainEditSequence(up, addEditCb){
					if(currentSyncId !== up.syncId){
						//console.log('syncId changed from ' + currentSyncId + ' to ' + up.syncId)
						currentSyncId = up.syncId
						_.assertString(up.syncId)
						addEditCb(editCodes.setSyncId, {syncId: up.syncId}, up.editId)					
					}
					
					//_.assertUndefined(up.id)
					if(up.state){
						if(up.id) _.assertEqual(up.id, up.state.top)
						up.id = up.state.top
					}


					if(up.id !== -1){

						//console.log('currentResponseId: ' + currentResponseId + ' ' + up.id)
						if(currentResponseId !== up.id){
							if(_.isString(up.id)){
								//console.log('selecting: ' + JSON.stringify(up.id))
								addEditCb(editCodes.selectTopViewObject, {id: up.id}, up.editId)					
								curState = {}
							}else{
								addEditCb(editCodes.selectTopObject, {id: up.id},  up.editId)					
								//curPath = []
							}
						}
						currentResponseId = up.id
						
						if(_.isString(up.id)){
							
							if(up.state === undefined) _.errout('no up.state: ' + JSON.stringify(up))
							
							_.assertObject(up.state)
							var newState = up.state//[].concat(up.path)
							//console.log('editing to match: ' + JSON.stringify(curState) + ' -> ' + JSON.stringify(newState))
							pathmerger.editToMatch(curState, newState, function(op, edit){

								addEditCb(op, edit, up.editId)					
							})
							curState = newState
						}
					}
				}
function maintainEditSequence(up, addEditCb){
					if(currentSyncId !== up.syncId){
						//console.log('syncId changed from ' + currentSyncId + ' to ' + up.syncId)
						currentSyncId = up.syncId
						_.assertString(up.syncId)
						addEditCb(editCodes.setSyncId, {syncId: up.syncId}, up.editId)					
					}
					
					//_.assertUndefined(up.id)
					if(up.state){
						if(up.id) _.assertEqual(up.id, up.state.top)
						up.id = up.state.top
					}


					if(up.id !== -1){

						//console.log('currentResponseId: ' + currentResponseId + ' ' + up.id)
						if(currentResponseId !== up.id){
							if(_.isString(up.id)){
								//console.log('selecting: ' + JSON.stringify(up.id))
								addEditCb(editCodes.selectTopViewObject, {id: up.id}, up.editId)					
								curState = {}
							}else{
								addEditCb(editCodes.selectTopObject, {id: up.id},  up.editId)					
								//curPath = []
							}
						}
						currentResponseId = up.id
						
						if(_.isString(up.id)){
							
							if(up.state === undefined) _.errout('no up.state: ' + JSON.stringify(up))
							
							_.assertObject(up.state)
							var newState = up.state//[].concat(up.path)
							//console.log('editing to match: ' + JSON.stringify(curState) + ' -> ' + JSON.stringify(newState))
							pathmerger.editToMatch(curState, newState, function(op, edit){

								addEditCb(op, edit, up.editId)					
							})
							curState = newState
						}
					}
				}
function maintainEditSequence ( up , addEditCb ) { if ( currentSyncId !== up . syncId ) { //console.log('syncId changed from ' + currentSyncId + ' to ' + up.syncId) currentSyncId = up . syncId _ . assertString ( up . syncId ) addEditCb ( editCodes . setSyncId , { syncId : up . syncId } , up . editId ) } //_.assertUndefined(up.id) if ( up . state ) { if ( up . id ) _ . assertEqual ( up . id , up . state . top ) up . id = up . state . top } if ( up . id !== - 1 ) { //console.log('currentResponseId: ' + currentResponseId + ' ' + up.id) if ( currentResponseId !== up . id ) { if ( _ . isString ( up . id ) ) { //console.log('selecting: ' + JSON.stringify(up.id)) addEditCb ( editCodes . selectTopViewObject , { id : up . id } , up . editId ) curState = { } } else { addEditCb ( editCodes . selectTopObject , { id : up . id } , up . editId ) //curPath = [] } } currentResponseId = up . id if ( _ . isString ( up . id ) ) { if ( up . state === undefined ) _ . errout ( 'no up.state: ' + JSON . stringify ( up ) ) _ . assertObject ( up . state ) var newState = up . state //[].concat(up.path) //console.log('editing to match: ' + JSON.stringify(curState) + ' -> ' + JSON.stringify(newState)) pathmerger . editToMatch ( curState , newState , function ( op , edit ) { addEditCb ( op , edit , up . editId ) } ) curState = newState } } }
function blockChangesCb(diff){ _.errout('tODO')  }
function blockChangesCb ( diff ) { _ . errout ( tODO ) }