@graphql-tools/delegate 9.0.35 → 9.0.36-alpha-20230511224835-2ad0682b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,7 +4,12 @@ exports.mergeDataAndErrors = exports.checkResultAndHandleErrors = void 0;
|
|
|
4
4
|
const graphql_1 = require("graphql");
|
|
5
5
|
const utils_1 = require("@graphql-tools/utils");
|
|
6
6
|
const resolveExternalValue_js_1 = require("./resolveExternalValue.js");
|
|
7
|
-
function checkResultAndHandleErrors(
|
|
7
|
+
function checkResultAndHandleErrors(
|
|
8
|
+
// TODO: investigate the reason
|
|
9
|
+
result = {
|
|
10
|
+
data: null,
|
|
11
|
+
errors: [],
|
|
12
|
+
}, delegationContext) {
|
|
8
13
|
const { context, info, fieldName: responseKey = getResponseKey(info), subschema, returnType = getReturnType(info), skipTypeMerging, onLocatedError, } = delegationContext;
|
|
9
14
|
const { data, unpathedErrors } = mergeDataAndErrors(result.data == null ? undefined : result.data[responseKey], result.errors == null ? [] : result.errors, info != null && info.path ? (0, graphql_1.responsePathAsArray)(info.path) : undefined, onLocatedError);
|
|
10
15
|
return (0, resolveExternalValue_js_1.resolveExternalValue)(data, unpathedErrors, subschema, context, info, returnType, skipTypeMerging);
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { responsePathAsArray, locatedError } from 'graphql';
|
|
2
2
|
import { AggregateError, getResponseKeyFromInfo, relocatedError } from '@graphql-tools/utils';
|
|
3
3
|
import { resolveExternalValue } from './resolveExternalValue.js';
|
|
4
|
-
export function checkResultAndHandleErrors(
|
|
4
|
+
export function checkResultAndHandleErrors(
|
|
5
|
+
// TODO: investigate the reason
|
|
6
|
+
result = {
|
|
7
|
+
data: null,
|
|
8
|
+
errors: [],
|
|
9
|
+
}, delegationContext) {
|
|
5
10
|
const { context, info, fieldName: responseKey = getResponseKey(info), subschema, returnType = getReturnType(info), skipTypeMerging, onLocatedError, } = delegationContext;
|
|
6
11
|
const { data, unpathedErrors } = mergeDataAndErrors(result.data == null ? undefined : result.data[responseKey], result.errors == null ? [] : result.errors, info != null && info.path ? responsePathAsArray(info.path) : undefined, onLocatedError);
|
|
7
12
|
return resolveExternalValue(data, unpathedErrors, subschema, context, info, returnType, skipTypeMerging);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GraphQLError } from 'graphql';
|
|
2
2
|
import { ExecutionResult } from '@graphql-tools/utils';
|
|
3
3
|
import { DelegationContext } from './types.cjs';
|
|
4
|
-
export declare function checkResultAndHandleErrors<TContext extends Record<string, any>>(result: ExecutionResult, delegationContext: DelegationContext<TContext>): any;
|
|
4
|
+
export declare function checkResultAndHandleErrors<TContext extends Record<string, any>>(result: ExecutionResult<any, any> | undefined, delegationContext: DelegationContext<TContext>): any;
|
|
5
5
|
export declare function mergeDataAndErrors(data: any, errors: ReadonlyArray<GraphQLError>, path: Array<string | number> | undefined, onLocatedError?: (originalError: GraphQLError) => GraphQLError, index?: number): {
|
|
6
6
|
data: any;
|
|
7
7
|
unpathedErrors: Array<GraphQLError>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GraphQLError } from 'graphql';
|
|
2
2
|
import { ExecutionResult } from '@graphql-tools/utils';
|
|
3
3
|
import { DelegationContext } from './types.js';
|
|
4
|
-
export declare function checkResultAndHandleErrors<TContext extends Record<string, any>>(result: ExecutionResult, delegationContext: DelegationContext<TContext>): any;
|
|
4
|
+
export declare function checkResultAndHandleErrors<TContext extends Record<string, any>>(result: ExecutionResult<any, any> | undefined, delegationContext: DelegationContext<TContext>): any;
|
|
5
5
|
export declare function mergeDataAndErrors(data: any, errors: ReadonlyArray<GraphQLError>, path: Array<string | number> | undefined, onLocatedError?: (originalError: GraphQLError) => GraphQLError, index?: number): {
|
|
6
6
|
data: any;
|
|
7
7
|
unpathedErrors: Array<GraphQLError>;
|