@graphql-tools/delegate
Advanced tools
Comparing version 6.0.0-alpha-b3f9b0a.0 to 6.0.0-alpha-bbd6275.0
@@ -781,9 +781,11 @@ 'use strict'; | ||
function handleObject(type, object, errors, subschema, context, info, skipTypeMerging) { | ||
var _a; | ||
const stitchingInfo = (_a = info === null || info === void 0 ? void 0 : info.schema.extensions) === null || _a === void 0 ? void 0 : _a.stitchingInfo; | ||
utils.setErrors(object, errors.map(error => utils.slicedError(error))); | ||
setObjectSubschema(object, subschema); | ||
if (skipTypeMerging || !(info === null || info === void 0 ? void 0 : info.mergeInfo)) { | ||
if (skipTypeMerging || !stitchingInfo) { | ||
return object; | ||
} | ||
const typeName = graphql.isAbstractType(type) ? info.schema.getTypeMap()[object.__typename].name : type.name; | ||
const mergedTypeInfo = info.mergeInfo.mergedTypes[typeName]; | ||
const mergedTypeInfo = stitchingInfo.mergedTypes[typeName]; | ||
let targetSubschemas; | ||
@@ -1114,11 +1116,12 @@ if (mergedTypeInfo != null) { | ||
function buildDelegationTransforms(subschemaOrSubschemaConfig, info, context, targetSchema, fieldName, args, returnType, transforms, transformedSchema, skipTypeMerging) { | ||
var _a; | ||
var _a, _b; | ||
const stitchingInfo = (_a = info === null || info === void 0 ? void 0 : info.schema.extensions) === null || _a === void 0 ? void 0 : _a.stitchingInfo; | ||
let delegationTransforms = [ | ||
new CheckResultAndHandleErrors(info, fieldName, subschemaOrSubschemaConfig, context, returnType, skipTypeMerging), | ||
]; | ||
if ((info === null || info === void 0 ? void 0 : info.mergeInfo) != null) { | ||
delegationTransforms.push(new AddReplacementSelectionSets(info.schema, info.mergeInfo.replacementSelectionSets), new AddMergedTypeFragments(info.schema, info.mergeInfo.mergedTypes)); | ||
if (stitchingInfo != null) { | ||
delegationTransforms.push(new AddReplacementSelectionSets(info.schema, stitchingInfo.replacementSelectionSets), new AddMergedTypeFragments(info.schema, stitchingInfo.mergedTypes)); | ||
} | ||
const transformedTargetSchema = (info === null || info === void 0 ? void 0 : info.mergeInfo) == null | ||
? transformedSchema !== null && transformedSchema !== void 0 ? transformedSchema : targetSchema : (_a = transformedSchema !== null && transformedSchema !== void 0 ? transformedSchema : info.mergeInfo.transformedSchemas.get(subschemaOrSubschemaConfig)) !== null && _a !== void 0 ? _a : targetSchema; | ||
const transformedTargetSchema = stitchingInfo == null | ||
? transformedSchema !== null && transformedSchema !== void 0 ? transformedSchema : targetSchema : (_b = transformedSchema !== null && transformedSchema !== void 0 ? transformedSchema : stitchingInfo.transformedSchemas.get(subschemaOrSubschemaConfig)) !== null && _b !== void 0 ? _b : targetSchema; | ||
delegationTransforms.push(new WrapConcreteTypes(returnType, transformedTargetSchema)); | ||
@@ -1129,4 +1132,4 @@ if (info != null) { | ||
delegationTransforms = delegationTransforms.concat(transforms); | ||
if ((info === null || info === void 0 ? void 0 : info.mergeInfo) != null) { | ||
delegationTransforms.push(new AddReplacementFragments(targetSchema, info.mergeInfo.replacementFragments)); | ||
if (stitchingInfo != null) { | ||
delegationTransforms.push(new AddReplacementFragments(targetSchema, stitchingInfo.replacementFragments)); | ||
} | ||
@@ -1133,0 +1136,0 @@ if (args != null) { |
@@ -777,9 +777,11 @@ import { visit, visitWithTypeInfo, Kind, getNamedType, isAbstractType, TypeInfo, isObjectType, isInterfaceType, TypeNameMetaFieldDef, getNullableType, isLeafType, isCompositeType, isListType, typeFromAST, isSchema, getOperationAST, validate, execute, subscribe, defaultFieldResolver, parse } from 'graphql'; | ||
function handleObject(type, object, errors, subschema, context, info, skipTypeMerging) { | ||
var _a; | ||
const stitchingInfo = (_a = info === null || info === void 0 ? void 0 : info.schema.extensions) === null || _a === void 0 ? void 0 : _a.stitchingInfo; | ||
setErrors(object, errors.map(error => slicedError(error))); | ||
setObjectSubschema(object, subschema); | ||
if (skipTypeMerging || !(info === null || info === void 0 ? void 0 : info.mergeInfo)) { | ||
if (skipTypeMerging || !stitchingInfo) { | ||
return object; | ||
} | ||
const typeName = isAbstractType(type) ? info.schema.getTypeMap()[object.__typename].name : type.name; | ||
const mergedTypeInfo = info.mergeInfo.mergedTypes[typeName]; | ||
const mergedTypeInfo = stitchingInfo.mergedTypes[typeName]; | ||
let targetSubschemas; | ||
@@ -1110,11 +1112,12 @@ if (mergedTypeInfo != null) { | ||
function buildDelegationTransforms(subschemaOrSubschemaConfig, info, context, targetSchema, fieldName, args, returnType, transforms, transformedSchema, skipTypeMerging) { | ||
var _a; | ||
var _a, _b; | ||
const stitchingInfo = (_a = info === null || info === void 0 ? void 0 : info.schema.extensions) === null || _a === void 0 ? void 0 : _a.stitchingInfo; | ||
let delegationTransforms = [ | ||
new CheckResultAndHandleErrors(info, fieldName, subschemaOrSubschemaConfig, context, returnType, skipTypeMerging), | ||
]; | ||
if ((info === null || info === void 0 ? void 0 : info.mergeInfo) != null) { | ||
delegationTransforms.push(new AddReplacementSelectionSets(info.schema, info.mergeInfo.replacementSelectionSets), new AddMergedTypeFragments(info.schema, info.mergeInfo.mergedTypes)); | ||
if (stitchingInfo != null) { | ||
delegationTransforms.push(new AddReplacementSelectionSets(info.schema, stitchingInfo.replacementSelectionSets), new AddMergedTypeFragments(info.schema, stitchingInfo.mergedTypes)); | ||
} | ||
const transformedTargetSchema = (info === null || info === void 0 ? void 0 : info.mergeInfo) == null | ||
? transformedSchema !== null && transformedSchema !== void 0 ? transformedSchema : targetSchema : (_a = transformedSchema !== null && transformedSchema !== void 0 ? transformedSchema : info.mergeInfo.transformedSchemas.get(subschemaOrSubschemaConfig)) !== null && _a !== void 0 ? _a : targetSchema; | ||
const transformedTargetSchema = stitchingInfo == null | ||
? transformedSchema !== null && transformedSchema !== void 0 ? transformedSchema : targetSchema : (_b = transformedSchema !== null && transformedSchema !== void 0 ? transformedSchema : stitchingInfo.transformedSchemas.get(subschemaOrSubschemaConfig)) !== null && _b !== void 0 ? _b : targetSchema; | ||
delegationTransforms.push(new WrapConcreteTypes(returnType, transformedTargetSchema)); | ||
@@ -1125,4 +1128,4 @@ if (info != null) { | ||
delegationTransforms = delegationTransforms.concat(transforms); | ||
if ((info === null || info === void 0 ? void 0 : info.mergeInfo) != null) { | ||
delegationTransforms.push(new AddReplacementFragments(targetSchema, info.mergeInfo.replacementFragments)); | ||
if (stitchingInfo != null) { | ||
delegationTransforms.push(new AddReplacementFragments(targetSchema, stitchingInfo.replacementFragments)); | ||
} | ||
@@ -1129,0 +1132,0 @@ if (args != null) { |
{ | ||
"name": "@graphql-tools/delegate", | ||
"version": "6.0.0-alpha-b3f9b0a.0", | ||
"version": "6.0.0-alpha-bbd6275.0", | ||
"description": "A set of utils for faster development of GraphQL tools", | ||
@@ -9,5 +9,5 @@ "peerDependencies": { | ||
"dependencies": { | ||
"@graphql-tools/schema": "6.0.0-alpha-b3f9b0a.0", | ||
"@graphql-tools/utils": "6.0.0-alpha-b3f9b0a.0", | ||
"tslib": "1.11.1" | ||
"@graphql-tools/schema": "6.0.0-alpha-bbd6275.0", | ||
"@graphql-tools/utils": "6.0.0-alpha-bbd6275.0", | ||
"tslib": "~2.0.0" | ||
}, | ||
@@ -14,0 +14,0 @@ "repository": "git@github.com:ardatan/graphql-tools.git", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
366699
2908
+ Added@graphql-tools/schema@6.0.0-alpha-bbd6275.0(transitive)
+ Added@graphql-tools/utils@6.0.0-alpha-bbd6275.0(transitive)
+ Addedtslib@1.14.12.0.3(transitive)
- Removed@graphql-tools/schema@6.0.0-alpha-b3f9b0a.0(transitive)
- Removed@graphql-tools/utils@6.0.0-alpha-b3f9b0a.0(transitive)
- Removedtslib@1.11.12.8.0(transitive)
Updatedtslib@~2.0.0