@graphql-tools/delegate 8.5.1 → 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/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
- let typeName;
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
- let typeName;
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
@@ -5,4 +5,4 @@ export declare function isExternalObject(data: any): data is ExternalObject;
5
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, any>, context: any, info: GraphQLResolveInfo): Promise<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,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/delegate",
3
- "version": "8.5.1",
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": {