@graphql-tools/wrap
Advanced tools
Comparing version 5.0.1-alpha-f753a84.0 to 6.0.0-alpha.1
@@ -89,5 +89,6 @@ 'use strict'; | ||
const config = type.toConfig(); | ||
Object.keys(config.fields).forEach(fieldName => { | ||
const fields = type.getFields(); | ||
Object.keys(fields).forEach(fieldName => { | ||
config.fields[fieldName] = { | ||
...config.fields[fieldName], | ||
...utils.fieldToFieldConfig(fields[fieldName]), | ||
...proxyingResolvers[type.name][fieldName], | ||
@@ -360,3 +361,2 @@ }; | ||
transformFields(type, fieldTransformer) { | ||
const typeConfig = type.toConfig(); | ||
const fields = type.getFields(); | ||
@@ -368,3 +368,3 @@ const newFields = {}; | ||
if (typeof transformedField === 'undefined') { | ||
newFields[fieldName] = typeConfig.fields[fieldName]; | ||
newFields[fieldName] = utils.fieldToFieldConfig(fields[fieldName]); | ||
} | ||
@@ -377,3 +377,3 @@ else if (transformedField !== null) { | ||
? transformedField.field | ||
: typeConfig.fields[fieldName]; | ||
: utils.fieldToFieldConfig(fields[fieldName]); | ||
if (newName !== fieldName) { | ||
@@ -380,0 +380,0 @@ const typeName = type.name; |
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 { getResponseKeyFromInfo, getErrors, mapSchema, MapperKind, applySchemaTransforms, relocatedError, hoistFieldNodes, removeFields, appendFields, healSchema, wrapFieldNode, renameFieldNode, CombinedError } from '@graphql-tools/utils'; | ||
import { getResponseKeyFromInfo, getErrors, mapSchema, MapperKind, fieldToFieldConfig, applySchemaTransforms, relocatedError, hoistFieldNodes, removeFields, appendFields, healSchema, wrapFieldNode, renameFieldNode, CombinedError } from '@graphql-tools/utils'; | ||
import { delegateToSchema, getSubschema, handleResult, isSubschemaConfig, defaultMergedResolver, createMergedResolver } from '@graphql-tools/delegate'; | ||
@@ -85,5 +85,6 @@ import { addResolversToSchema } from '@graphql-tools/schema'; | ||
const config = type.toConfig(); | ||
Object.keys(config.fields).forEach(fieldName => { | ||
const fields = type.getFields(); | ||
Object.keys(fields).forEach(fieldName => { | ||
config.fields[fieldName] = { | ||
...config.fields[fieldName], | ||
...fieldToFieldConfig(fields[fieldName]), | ||
...proxyingResolvers[type.name][fieldName], | ||
@@ -356,3 +357,2 @@ }; | ||
transformFields(type, fieldTransformer) { | ||
const typeConfig = type.toConfig(); | ||
const fields = type.getFields(); | ||
@@ -364,3 +364,3 @@ const newFields = {}; | ||
if (typeof transformedField === 'undefined') { | ||
newFields[fieldName] = typeConfig.fields[fieldName]; | ||
newFields[fieldName] = fieldToFieldConfig(fields[fieldName]); | ||
} | ||
@@ -373,3 +373,3 @@ else if (transformedField !== null) { | ||
? transformedField.field | ||
: typeConfig.fields[fieldName]; | ||
: fieldToFieldConfig(fields[fieldName]); | ||
if (newName !== fieldName) { | ||
@@ -376,0 +376,0 @@ const typeName = type.name; |
{ | ||
"name": "@graphql-tools/wrap", | ||
"version": "5.0.1-alpha-f753a84.0", | ||
"version": "6.0.0-alpha.1", | ||
"description": "A set of utils for faster development of GraphQL tools", | ||
@@ -9,5 +9,5 @@ "peerDependencies": { | ||
"dependencies": { | ||
"@graphql-tools/delegate": "5.0.1-alpha-f753a84.0", | ||
"@graphql-tools/schema": "5.0.1-alpha-f753a84.0", | ||
"@graphql-tools/utils": "5.0.1-alpha-f753a84.0", | ||
"@graphql-tools/delegate": "6.0.0-alpha.1", | ||
"@graphql-tools/schema": "6.0.0-alpha.1", | ||
"@graphql-tools/utils": "6.0.0-alpha.1", | ||
"tslib": "1.11.1" | ||
@@ -14,0 +14,0 @@ }, |
import { GraphQLSchema } from 'graphql'; | ||
import { Transform, Request, FieldTransformer, FieldNodeTransformer } from '@graphql-tools/utils'; | ||
import { Transform, Request } from '@graphql-tools/utils'; | ||
import { FieldTransformer, FieldNodeTransformer } from '../types'; | ||
export default class TransformCompositeFields implements Transform { | ||
@@ -4,0 +5,0 @@ private readonly fieldTransformer; |
import { GraphQLSchema } from 'graphql'; | ||
import { Transform, Request, FieldTransformer, FieldNodeTransformer } from '@graphql-tools/utils'; | ||
import { Transform, Request } from '@graphql-tools/utils'; | ||
import { FieldTransformer, FieldNodeTransformer } from '../types'; | ||
export default class TransformInterfaceFields implements Transform { | ||
@@ -4,0 +5,0 @@ private readonly interfaceFieldTransformer; |
import { GraphQLSchema } from 'graphql'; | ||
import { Transform, Request, FieldTransformer, FieldNodeTransformer } from '@graphql-tools/utils'; | ||
import { Transform, Request } from '@graphql-tools/utils'; | ||
import { FieldTransformer, FieldNodeTransformer } from '../types'; | ||
export default class TransformObjectFields implements Transform { | ||
@@ -4,0 +5,0 @@ private readonly objectFieldTransformer; |
import { GraphQLSchema } from 'graphql'; | ||
import { Transform, Request, FieldNodeTransformer, RootFieldTransformer } from '@graphql-tools/utils'; | ||
import { Transform, Request } from '@graphql-tools/utils'; | ||
import { RootFieldTransformer, FieldNodeTransformer } from '../types'; | ||
export default class TransformRootFields implements Transform { | ||
@@ -4,0 +5,0 @@ private readonly transformer; |
@@ -1,2 +0,2 @@ | ||
import { GraphQLSchema, GraphQLFieldResolver, BuildSchemaOptions } from 'graphql'; | ||
import { GraphQLSchema, GraphQLFieldResolver, BuildSchemaOptions, GraphQLField, GraphQLFieldConfig, FieldNode, FragmentDefinitionNode, SelectionNode } from 'graphql'; | ||
import { Executor, Subscriber } from '@graphql-tools/delegate'; | ||
@@ -10,1 +10,8 @@ export interface IMakeRemoteExecutableSchemaOptions { | ||
} | ||
export interface RenamedFieldConfig { | ||
name: string; | ||
field?: GraphQLFieldConfig<any, any>; | ||
} | ||
export declare type FieldTransformer = (typeName: string, fieldName: string, field: GraphQLField<any, any>) => GraphQLFieldConfig<any, any> | RenamedFieldConfig | null | undefined; | ||
export declare type RootFieldTransformer = (operation: 'Query' | 'Mutation' | 'Subscription', fieldName: string, field: GraphQLField<any, any>) => GraphQLFieldConfig<any, any> | RenamedFieldConfig | null | undefined; | ||
export declare type FieldNodeTransformer = (typeName: string, fieldName: string, fieldNode: FieldNode, fragments: Record<string, FragmentDefinitionNode>) => SelectionNode | Array<SelectionNode>; |
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
249748
2237
+ Added@graphql-tools/delegate@6.0.0-alpha.1(transitive)
+ Added@graphql-tools/schema@6.0.0-alpha.1(transitive)
+ Added@graphql-tools/utils@6.0.0-alpha.1(transitive)
- Removed@graphql-tools/delegate@5.0.1-alpha-f753a84.0(transitive)
- Removed@graphql-tools/schema@5.0.1-alpha-f753a84.0(transitive)
- Removed@graphql-tools/utils@5.0.1-alpha-f753a84.0(transitive)