archive/refactoring/definition/merge.js
function defaultConflictResolution(definition, name, type, tgt, src) {
  // TODO: Add support for type/field level conflict settings
  // TODO: Add support for extending types via extend key
  switch(type) {
    case 'type':
      const {
        query,
        mutation,
        subscription
      } = get(definition, [ 'schema' ]) || {};
      // always merge a rootTypes definition
      if ([ query, mutation, subscription].indexOf(name) !== -1) {
        return { name, config: merge(tgt, src) };
      }
      break;
    case 'function':
      return { name, config: Object.assign(tgt, src) };
    case 'context':
      return { name, config: merge(tgt, src) };
    default:
      break;
  }
  // emit a warning
  definition.emit(FactoryEvent.WARN, 'MergeConflict: Duplicate ' + type +
  ' with name "' + name + '" found. Using newer value');
  return { name, config: tgt };
}
function defaultConflictResolution(definition, name, type, tgt, src) {
  // TODO: Add support for type/field level conflict settings
  // TODO: Add support for extending types via extend key
  switch(type) {
    case 'type':
      const {
        query,
        mutation,
        subscription
      } = get(definition, [ 'schema' ]) || {};
      // always merge a rootTypes definition
      if ([ query, mutation, subscription].indexOf(name) !== -1) {
        return { name, config: merge(tgt, src) };
      }
      break;
    case 'function':
      return { name, config: Object.assign(tgt, src) };
    case 'context':
      return { name, config: merge(tgt, src) };
    default:
      break;
  }
  // emit a warning
  definition.emit(FactoryEvent.WARN, 'MergeConflict: Duplicate ' + type +
  ' with name "' + name + '" found. Using newer value');
  return { name, config: tgt };
}
function defaultConflictResolution ( definition , name , type , tgt , src ) { // TODO: Add support for type/field level conflict settings // TODO: Add support for extending types via extend key switch ( type ) { case 'type' : const { query , mutation , subscription } = get ( definition , [ 'schema' ] ) || { } ; // always merge a rootTypes definition if ( [ query , mutation , subscription ] . indexOf ( name ) !== - 1 ) { return { name , config : merge ( tgt , src ) } ; } break ; case 'function' : return { name , config : Object . assign ( tgt , src ) } ; case 'context' : return { name , config : merge ( tgt , src ) } ; default : break ; } // emit a warning definition . emit ( FactoryEvent . WARN , 'MergeConflict: Duplicate ' + type + ' with name "' + name + '" found. Using newer value' ) ; return { name , config : tgt } ; }
Default conflict resolver for merging root types, context, and overwriting
parts of type definitions
@param {*} definition
@param {*} name
@param {*} type
@param {*} tgt
@param {*} src
Default conflict resolver for merging root types context and overwriting parts of type definitions