@graphql-tools/delegate 8.4.4-alpha-9e783a2c.0 → 8.5.2
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.
- package/checkResultAndHandleErrors.d.ts +1 -1
- package/finalizeGatewayRequest.d.ts +1 -1
- package/index.js +1 -11
- package/index.mjs +1 -11
- package/mergeFields.d.ts +2 -2
- package/package.json +5 -5
- package/resolveExternalValue.d.ts +1 -1
- package/types.d.ts +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GraphQLError } from 'graphql';
|
|
2
2
|
import { ExecutionResult } from '@graphql-tools/utils';
|
|
3
3
|
import { DelegationContext } from './types';
|
|
4
|
-
export declare function checkResultAndHandleErrors(result: ExecutionResult, delegationContext: DelegationContext): any;
|
|
4
|
+
export declare function checkResultAndHandleErrors<TContext>(result: ExecutionResult, 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,3 +1,3 @@
|
|
|
1
1
|
import { ExecutionRequest } from '@graphql-tools/utils';
|
|
2
2
|
import { DelegationContext } from './types';
|
|
3
|
-
export declare function finalizeGatewayRequest(originalRequest: ExecutionRequest, delegationContext: DelegationContext): ExecutionRequest;
|
|
3
|
+
export declare function finalizeGatewayRequest<TContext>(originalRequest: ExecutionRequest, delegationContext: DelegationContext<TContext>): ExecutionRequest;
|
package/index.js
CHANGED
|
@@ -784,17 +784,7 @@ function resolveExternalObject(type, object, unpathedErrors, subschema, context,
|
|
|
784
784
|
if (stitchingInfo == null) {
|
|
785
785
|
return object;
|
|
786
786
|
}
|
|
787
|
-
|
|
788
|
-
if (graphql.isAbstractType(type)) {
|
|
789
|
-
const resolvedType = info.schema.getType(object.__typename);
|
|
790
|
-
if (resolvedType == null) {
|
|
791
|
-
throw new Error(`Unable to resolve type '${object.__typename}'. Did you forget to include a transform that renames types? Did you delegate to the original subschema rather that the subschema config object containing the transform?`);
|
|
792
|
-
}
|
|
793
|
-
typeName = resolvedType.name;
|
|
794
|
-
}
|
|
795
|
-
else {
|
|
796
|
-
typeName = type.name;
|
|
797
|
-
}
|
|
787
|
+
const typeName = graphql.isAbstractType(type) ? object.__typename : type.name;
|
|
798
788
|
const mergedTypeInfo = stitchingInfo.mergedTypes[typeName];
|
|
799
789
|
let targetSubschemas;
|
|
800
790
|
// Within the stitching context, delegation to a stitched GraphQLSchema or SubschemaConfig
|
package/index.mjs
CHANGED
|
@@ -780,17 +780,7 @@ function resolveExternalObject(type, object, unpathedErrors, subschema, context,
|
|
|
780
780
|
if (stitchingInfo == null) {
|
|
781
781
|
return object;
|
|
782
782
|
}
|
|
783
|
-
|
|
784
|
-
if (isAbstractType(type)) {
|
|
785
|
-
const resolvedType = info.schema.getType(object.__typename);
|
|
786
|
-
if (resolvedType == null) {
|
|
787
|
-
throw new Error(`Unable to resolve type '${object.__typename}'. Did you forget to include a transform that renames types? Did you delegate to the original subschema rather that the subschema config object containing the transform?`);
|
|
788
|
-
}
|
|
789
|
-
typeName = resolvedType.name;
|
|
790
|
-
}
|
|
791
|
-
else {
|
|
792
|
-
typeName = type.name;
|
|
793
|
-
}
|
|
783
|
+
const typeName = isAbstractType(type) ? object.__typename : type.name;
|
|
794
784
|
const mergedTypeInfo = stitchingInfo.mergedTypes[typeName];
|
|
795
785
|
let targetSubschemas;
|
|
796
786
|
// Within the stitching context, delegation to a stitched GraphQLSchema or SubschemaConfig
|
package/mergeFields.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { GraphQLResolveInfo, GraphQLError, GraphQLSchema } from 'graphql';
|
|
|
2
2
|
import { ExternalObject, MergedTypeInfo, SubschemaConfig } from './types';
|
|
3
3
|
import { Subschema } from './Subschema';
|
|
4
4
|
export declare function isExternalObject(data: any): data is ExternalObject;
|
|
5
|
-
export declare function annotateExternalObject(object: any, errors: Array<GraphQLError>, subschema: GraphQLSchema | SubschemaConfig | undefined, subschemaMap: Record<string, GraphQLSchema | SubschemaConfig<any, any, any, Record<string, any>>>): ExternalObject;
|
|
5
|
+
export declare function annotateExternalObject<TContext>(object: any, errors: Array<GraphQLError>, subschema: GraphQLSchema | SubschemaConfig<any, any, any, TContext> | undefined, subschemaMap: Record<string, GraphQLSchema | SubschemaConfig<any, any, any, Record<string, any>>>): ExternalObject;
|
|
6
6
|
export declare function getSubschema(object: ExternalObject, responseKey: string): GraphQLSchema | SubschemaConfig;
|
|
7
7
|
export declare function getUnpathedErrors(object: ExternalObject): Array<GraphQLError>;
|
|
8
|
-
export declare function mergeFields(mergedTypeInfo: MergedTypeInfo, object: any, sourceSubschema: Subschema<any, any, any,
|
|
8
|
+
export declare function mergeFields<TContext>(mergedTypeInfo: MergedTypeInfo, object: any, sourceSubschema: Subschema<any, any, any, TContext>, context: any, info: GraphQLResolveInfo): Promise<any>;
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/delegate",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.5.2",
|
|
4
4
|
"description": "A set of utils for faster development of GraphQL tools",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
|
7
7
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@graphql-tools/batch-execute": "8.3.2
|
|
11
|
-
"@graphql-tools/schema": "8.3.2
|
|
12
|
-
"@graphql-tools/utils": "8.6.2
|
|
10
|
+
"@graphql-tools/batch-execute": "^8.3.2",
|
|
11
|
+
"@graphql-tools/schema": "^8.3.2",
|
|
12
|
+
"@graphql-tools/utils": "^8.6.2",
|
|
13
13
|
"dataloader": "2.0.0",
|
|
14
|
-
"graphql-executor": "0.0.
|
|
14
|
+
"graphql-executor": "0.0.18",
|
|
15
15
|
"tslib": "~2.3.0",
|
|
16
16
|
"value-or-promise": "1.0.11"
|
|
17
17
|
},
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { GraphQLResolveInfo, GraphQLError, GraphQLSchema, GraphQLOutputType } from 'graphql';
|
|
2
2
|
import { SubschemaConfig } from './types';
|
|
3
|
-
export declare function resolveExternalValue(result: any, unpathedErrors: Array<GraphQLError>, subschema: GraphQLSchema | SubschemaConfig, context?: Record<string, any>, info?: GraphQLResolveInfo, returnType?: GraphQLOutputType, skipTypeMerging?: boolean): any;
|
|
3
|
+
export declare function resolveExternalValue<TContext>(result: any, unpathedErrors: Array<GraphQLError>, subschema: GraphQLSchema | SubschemaConfig<any, any, any, TContext>, context?: Record<string, any>, info?: GraphQLResolveInfo, returnType?: GraphQLOutputType, skipTypeMerging?: boolean): any;
|
package/types.d.ts
CHANGED
|
@@ -4,12 +4,12 @@ import { ExecutionRequest, ExecutionResult, Executor } from '@graphql-tools/util
|
|
|
4
4
|
import { Subschema } from './Subschema';
|
|
5
5
|
import { OBJECT_SUBSCHEMA_SYMBOL, FIELD_SUBSCHEMA_MAP_SYMBOL, UNPATHED_ERRORS_SYMBOL } from './symbols';
|
|
6
6
|
export declare type SchemaTransform<TContext = Record<any, string>> = (originalWrappingSchema: GraphQLSchema, subschemaConfig: SubschemaConfig<any, any, any, TContext>, transformedSchema?: GraphQLSchema) => GraphQLSchema;
|
|
7
|
-
export declare type RequestTransform<T = Record<string, any>> = (originalRequest: ExecutionRequest, delegationContext: DelegationContext
|
|
8
|
-
export declare type ResultTransform<T = Record<string, any>> = (originalResult: ExecutionResult, delegationContext: DelegationContext
|
|
7
|
+
export declare type RequestTransform<T = Record<string, any>, TContext = Record<any, string>> = (originalRequest: ExecutionRequest, delegationContext: DelegationContext<TContext>, transformationContext: T) => ExecutionRequest;
|
|
8
|
+
export declare type ResultTransform<T = Record<string, any>, TContext = Record<any, string>> = (originalResult: ExecutionResult, delegationContext: DelegationContext<TContext>, transformationContext: T) => ExecutionResult;
|
|
9
9
|
export interface Transform<T = any, TContext = Record<string, any>> {
|
|
10
10
|
transformSchema?: SchemaTransform<TContext>;
|
|
11
|
-
transformRequest?: RequestTransform<T>;
|
|
12
|
-
transformResult?: ResultTransform<T>;
|
|
11
|
+
transformRequest?: RequestTransform<T, TContext>;
|
|
12
|
+
transformResult?: ResultTransform<T, TContext>;
|
|
13
13
|
}
|
|
14
14
|
export interface DelegationContext<TContext = Record<string, any>> {
|
|
15
15
|
subschema: GraphQLSchema | SubschemaConfig<any, any, any, TContext>;
|