Skip to content

Commit

Permalink
rename handleResult to resolveExternalValue
Browse files Browse the repository at this point in the history
  • Loading branch information
yaacovCR committed Sep 4, 2020
1 parent f735c87 commit 3051fdc
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions packages/delegate/src/defaultMergedResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defaultFieldResolver, GraphQLResolveInfo } from 'graphql';

import { getResponseKeyFromInfo } from '@graphql-tools/utils';

import { handleResult } from './results/handleResult';
import { resolveExternalValue } from './resolveExternalValue';
import { getSubschema } from './Subschema';
import { getErrors, isExternalData } from './externalData';
import { ExternalData } from './types';
Expand Down Expand Up @@ -31,9 +31,9 @@ export function defaultMergedResolver(
return defaultFieldResolver(parent, args, context, info);
}

const result = parent[responseKey];
const data = parent[responseKey];
const subschema = getSubschema(parent, responseKey);
const errors = getErrors(parent, responseKey);

return handleResult(result, errors, subschema, context, info);
return resolveExternalValue(data, errors, subschema, context, info);
}
2 changes: 1 addition & 1 deletion packages/delegate/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export { delegateToSchema, delegateRequest } from './delegateToSchema';
export { createRequestFromInfo, createRequest } from './createRequest';
export { defaultMergedResolver } from './defaultMergedResolver';
export { handleResult } from './results/handleResult';
export { resolveExternalValue } from './resolveExternalValue';
export { Subschema, isSubschema, isSubschemaConfig } from './Subschema';

export * from './applySchemaTransforms';
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { handleObject } from './handleObject';
import { handleList } from './handleList';
import { extendedError } from '@graphql-tools/utils';

export function handleResult(
export function resolveExternalValue(
result: any,
errors: ReadonlyArray<GraphQLError>,
subschema: GraphQLSchema | SubschemaConfig,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GraphQLResolveInfo, GraphQLOutputType, GraphQLSchema } from 'graphql';

import { getResponseKeyFromInfo, ExecutionResult } from '@graphql-tools/utils';
import { handleResult } from '../results/handleResult';
import { resolveExternalValue } from '../resolveExternalValue';
import { SubschemaConfig, Transform, DelegationContext } from '../types';

export default class CheckResultAndHandleErrors implements Transform {
Expand Down Expand Up @@ -57,5 +57,5 @@ export function checkResultAndHandleErrors(
const errors = result.errors != null ? result.errors : [];
const data = result.data != null ? result.data[responseKey] : undefined;

return handleResult(data, errors, subschema, context, info, returnType, skipTypeMerging);
return resolveExternalValue(data, errors, subschema, context, info, returnType, skipTypeMerging);
}
4 changes: 2 additions & 2 deletions packages/wrap/src/generateProxyingResolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Operation, getResponseKeyFromInfo } from '@graphql-tools/utils';
import {
delegateToSchema,
getSubschema,
handleResult,
resolveExternalValue,
SubschemaConfig,
isSubschemaConfig,
CreateProxyingResolverFn,
Expand Down Expand Up @@ -100,7 +100,7 @@ function createPossiblyNestedProxyingResolver(
// This can happen even for a root field when the root type ia
// also nested as a field within a different type.
if (subschemaOrSubschemaConfig === subschema && parent[responseKey] !== undefined) {
return handleResult(parent[responseKey], errors, subschema, context, info);
return resolveExternalValue(parent[responseKey], errors, subschema, context, info);
}
}
}
Expand Down

0 comments on commit 3051fdc

Please sign in to comment.