@graphql-tools/wrap
Advanced tools
Comparing version 6.0.0-alpha-0bfc960.0 to 6.0.0-alpha-639f436.0
@@ -762,7 +762,7 @@ 'use strict'; | ||
transformSchema(schema) { | ||
let [newSchema, targetFieldConfigMap] = utils.removeObjectFields(schema, this.outerTypeName, !this.fieldNames ? () => true : fieldName => this.fieldNames.includes(fieldName)); | ||
const targetFieldConfigMap = utils.selectObjectFields(schema, this.outerTypeName, !this.fieldNames ? () => true : fieldName => this.fieldNames.includes(fieldName)); | ||
let wrapIndex = this.numWraps - 1; | ||
let wrappingTypeName = this.wrappingTypeNames[wrapIndex]; | ||
let wrappingFieldName = this.wrappingFieldNames[wrapIndex]; | ||
newSchema = utils.appendObjectFields(newSchema, wrappingTypeName, targetFieldConfigMap); | ||
let newSchema = utils.appendObjectFields(schema, wrappingTypeName, targetFieldConfigMap); | ||
for (wrapIndex--; wrapIndex > -1; wrapIndex--) { | ||
@@ -779,3 +779,4 @@ const nextWrappingTypeName = this.wrappingTypeNames[wrapIndex]; | ||
} | ||
newSchema = utils.appendObjectFields(newSchema, this.outerTypeName, { | ||
const selectedFieldNames = Object.keys(targetFieldConfigMap); | ||
[newSchema] = utils.modifyObjectFields(newSchema, this.outerTypeName, fieldName => selectedFieldNames.includes(fieldName), { | ||
[wrappingFieldName]: { | ||
@@ -782,0 +783,0 @@ type: newSchema.getType(wrappingTypeName), |
import { GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType, isSpecifiedScalarType, isScalarType, isObjectType, isInterfaceType, isUnionType, isInputObjectType, GraphQLInputObjectType, isEnumType, GraphQLEnumType, GraphQLScalarType, visit, Kind, TypeInfo, visitWithTypeInfo, extendSchema, parse, getNullableType, BREAK, buildSchema, getIntrospectionQuery, buildClientSchema } from 'graphql'; | ||
import { applySchemaTransforms, getResponseKeyFromInfo, getErrors, mapSchema, MapperKind, relocatedError, hoistFieldNodes, removeObjectFields, appendObjectFields, wrapFieldNode, renameFieldNode, CombinedError } from '@graphql-tools/utils'; | ||
import { applySchemaTransforms, getResponseKeyFromInfo, getErrors, mapSchema, MapperKind, relocatedError, hoistFieldNodes, selectObjectFields, appendObjectFields, modifyObjectFields, wrapFieldNode, renameFieldNode, removeObjectFields, CombinedError } from '@graphql-tools/utils'; | ||
import { delegateToSchema, isSubschemaConfig, getSubschema, handleResult, defaultMergedResolver, createMergedResolver } from '@graphql-tools/delegate'; | ||
@@ -758,7 +758,7 @@ import { addResolversToSchema } from '@graphql-tools/schema'; | ||
transformSchema(schema) { | ||
let [newSchema, targetFieldConfigMap] = removeObjectFields(schema, this.outerTypeName, !this.fieldNames ? () => true : fieldName => this.fieldNames.includes(fieldName)); | ||
const targetFieldConfigMap = selectObjectFields(schema, this.outerTypeName, !this.fieldNames ? () => true : fieldName => this.fieldNames.includes(fieldName)); | ||
let wrapIndex = this.numWraps - 1; | ||
let wrappingTypeName = this.wrappingTypeNames[wrapIndex]; | ||
let wrappingFieldName = this.wrappingFieldNames[wrapIndex]; | ||
newSchema = appendObjectFields(newSchema, wrappingTypeName, targetFieldConfigMap); | ||
let newSchema = appendObjectFields(schema, wrappingTypeName, targetFieldConfigMap); | ||
for (wrapIndex--; wrapIndex > -1; wrapIndex--) { | ||
@@ -775,3 +775,4 @@ const nextWrappingTypeName = this.wrappingTypeNames[wrapIndex]; | ||
} | ||
newSchema = appendObjectFields(newSchema, this.outerTypeName, { | ||
const selectedFieldNames = Object.keys(targetFieldConfigMap); | ||
[newSchema] = modifyObjectFields(newSchema, this.outerTypeName, fieldName => selectedFieldNames.includes(fieldName), { | ||
[wrappingFieldName]: { | ||
@@ -778,0 +779,0 @@ type: newSchema.getType(wrappingTypeName), |
{ | ||
"name": "@graphql-tools/wrap", | ||
"version": "6.0.0-alpha-0bfc960.0", | ||
"version": "6.0.0-alpha-639f436.0", | ||
"description": "A set of utils for faster development of GraphQL tools", | ||
@@ -9,5 +9,5 @@ "peerDependencies": { | ||
"dependencies": { | ||
"@graphql-tools/delegate": "6.0.0-alpha-0bfc960.0", | ||
"@graphql-tools/schema": "6.0.0-alpha-0bfc960.0", | ||
"@graphql-tools/utils": "6.0.0-alpha-0bfc960.0", | ||
"@graphql-tools/delegate": "6.0.0-alpha-639f436.0", | ||
"@graphql-tools/schema": "6.0.0-alpha-639f436.0", | ||
"@graphql-tools/utils": "6.0.0-alpha-639f436.0", | ||
"tslib": "1.11.1" | ||
@@ -14,0 +14,0 @@ }, |
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
254600
2251
+ Added@graphql-tools/delegate@6.0.0-alpha-639f436.0(transitive)
+ Added@graphql-tools/schema@6.0.0-alpha-639f436.0(transitive)
+ Added@graphql-tools/utils@6.0.0-alpha-639f436.0(transitive)
- Removed@graphql-tools/delegate@6.0.0-alpha-0bfc960.0(transitive)
- Removed@graphql-tools/schema@6.0.0-alpha-0bfc960.0(transitive)
- Removed@graphql-tools/utils@6.0.0-alpha-0bfc960.0(transitive)