@graphql-tools/utils
Advanced tools
Comparing version 5.0.1-alpha-bdd506c.0 to 5.0.1-alpha-c49b0a5.0
@@ -1,4 +0,3 @@ | ||
import { GraphQLFieldConfigMap, GraphQLFieldConfig } from 'graphql'; | ||
import { TypeMap } from './Interfaces'; | ||
export declare function appendFields(typeMap: TypeMap, typeName: string, fields: GraphQLFieldConfigMap<any, any>): void; | ||
export declare function removeFields(typeMap: TypeMap, typeName: string, testFn: (fieldName: string, field: GraphQLFieldConfig<any, any>) => boolean): GraphQLFieldConfigMap<any, any>; | ||
import { GraphQLFieldConfigMap, GraphQLFieldConfig, GraphQLSchema } from 'graphql'; | ||
export declare function appendObjectFields(schema: GraphQLSchema, typeName: string, additionalFields: GraphQLFieldConfigMap<any, any>): GraphQLSchema; | ||
export declare function removeObjectFields(schema: GraphQLSchema, typeName: string, testFn: (fieldName: string, field: GraphQLFieldConfig<any, any>) => boolean): [GraphQLSchema, GraphQLFieldConfigMap<any, any>]; |
@@ -1,5 +0,7 @@ | ||
import { GraphQLSchema } from 'graphql'; | ||
import { GraphQLSchema, GraphQLNamedType, GraphQLField, GraphQLInputField, GraphQLFieldConfig, GraphQLInputFieldConfig, GraphQLSchemaConfig, GraphQLObjectTypeConfig, GraphQLInterfaceTypeConfig, GraphQLUnionTypeConfig, GraphQLScalarTypeConfig, GraphQLEnumTypeConfig, GraphQLInputObjectTypeConfig, GraphQLEnumValue, GraphQLEnumValueConfig } from 'graphql'; | ||
export declare type DirectiveUseMap = { | ||
[key: string]: any; | ||
}; | ||
export declare function getDirectives(schema: GraphQLSchema, node: any): DirectiveUseMap; | ||
declare type DirectableGraphQLObject = GraphQLSchema | GraphQLSchemaConfig | GraphQLNamedType | GraphQLObjectTypeConfig<any, any> | GraphQLInterfaceTypeConfig<any, any> | GraphQLUnionTypeConfig<any, any> | GraphQLScalarTypeConfig<any, any> | GraphQLEnumTypeConfig | GraphQLEnumValue | GraphQLEnumValueConfig | GraphQLInputObjectTypeConfig | GraphQLField<any, any> | GraphQLInputField | GraphQLFieldConfig<any, any> | GraphQLInputFieldConfig; | ||
export declare function getDirectives(schema: GraphQLSchema, node: DirectableGraphQLObject): DirectiveUseMap; | ||
export {}; |
@@ -28,3 +28,4 @@ export * from './loaders'; | ||
export * from './forEachDefaultValue'; | ||
export * from './map'; | ||
export * from './mapSchema'; | ||
export * from './addTypes'; | ||
export * from './rewire'; | ||
@@ -31,0 +32,0 @@ export * from './mergeDeep'; |
@@ -1,2 +0,2 @@ | ||
import { GraphQLSchema, GraphQLField, GraphQLInputType, GraphQLNamedType, GraphQLFieldResolver, GraphQLResolveInfo, GraphQLIsTypeOfFn, GraphQLTypeResolver, GraphQLScalarType, DocumentNode, FieldNode, GraphQLEnumValue, GraphQLEnumType, GraphQLUnionType, GraphQLArgument, GraphQLInputField, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLObjectType, InlineFragmentNode, SelectionSetNode, GraphQLDirective, GraphQLFieldConfig, FragmentDefinitionNode, SelectionNode, VariableDefinitionNode, OperationDefinitionNode, GraphQLError, ExecutionResult as GraphQLExecutionResult } from 'graphql'; | ||
import { GraphQLSchema, GraphQLField, GraphQLInputType, GraphQLNamedType, GraphQLFieldResolver, GraphQLResolveInfo, GraphQLScalarType, DocumentNode, FieldNode, GraphQLEnumValue, GraphQLEnumType, GraphQLUnionType, GraphQLArgument, GraphQLInputField, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLObjectType, GraphQLDirective, FragmentDefinitionNode, SelectionNode, OperationDefinitionNode, GraphQLError, ExecutionResult as GraphQLExecutionResult, GraphQLOutputType, FieldDefinitionNode, GraphQLFieldConfig, GraphQLInputFieldConfig, GraphQLArgumentConfig, GraphQLEnumValueConfig, GraphQLScalarSerializer, GraphQLScalarValueParser, GraphQLScalarLiteralParser, ScalarTypeDefinitionNode, ScalarTypeExtensionNode, EnumTypeDefinitionNode, EnumTypeExtensionNode, GraphQLIsTypeOfFn, ObjectTypeDefinitionNode, ObjectTypeExtensionNode, InterfaceTypeExtensionNode, InterfaceTypeDefinitionNode, GraphQLTypeResolver, UnionTypeDefinitionNode, UnionTypeExtensionNode, InputObjectTypeExtensionNode, InputObjectTypeDefinitionNode } from 'graphql'; | ||
import { SchemaVisitor } from './SchemaVisitor'; | ||
@@ -32,9 +32,2 @@ export interface ExecutionResult<TData = Record<string, any>> extends GraphQLExecutionResult { | ||
} | ||
export interface IAddResolveFunctionsToSchemaOptions { | ||
schema: GraphQLSchema; | ||
resolvers: IResolvers; | ||
defaultFieldResolver: IFieldResolver<any, any>; | ||
resolverValidationOptions: IResolverValidationOptions; | ||
inheritResolversFromInterfaces: boolean; | ||
} | ||
export interface IAddResolversToSchemaOptions { | ||
@@ -47,26 +40,43 @@ schema: GraphQLSchema; | ||
} | ||
export interface IResolverOptions<TSource = any, TContext = any, TArgs = any> { | ||
fragment?: string; | ||
export declare type IScalarTypeResolver = GraphQLScalarType & { | ||
__name?: string; | ||
__description?: string; | ||
__serialize?: GraphQLScalarSerializer<any>; | ||
__parseValue?: GraphQLScalarValueParser<any>; | ||
__parseLiteral?: GraphQLScalarLiteralParser<any>; | ||
__extensions?: Record<string, any>; | ||
__astNode?: ScalarTypeDefinitionNode; | ||
__extensionASTNodes?: Array<ScalarTypeExtensionNode>; | ||
}; | ||
export declare type IEnumTypeResolver = Record<string, any> & { | ||
__name?: string; | ||
__description?: string; | ||
__extensions?: Record<string, any>; | ||
__astNode?: EnumTypeDefinitionNode; | ||
__extensionASTNodes?: Array<EnumTypeExtensionNode>; | ||
}; | ||
export interface IFieldResolverOptions<TSource = any, TContext = any, TArgs = any> { | ||
name?: string; | ||
description?: string; | ||
type?: GraphQLOutputType; | ||
args?: Array<GraphQLArgument>; | ||
resolve?: IFieldResolver<TSource, TContext, TArgs>; | ||
subscribe?: IFieldResolver<TSource, TContext, TArgs>; | ||
isDeprecated?: boolean; | ||
deprecationReason?: string; | ||
extensions?: Record<string, any>; | ||
__resolveType?: GraphQLTypeResolver<TSource, TContext>; | ||
__isTypeOf?: GraphQLIsTypeOfFn<TSource, TContext>; | ||
astNode?: FieldDefinitionNode; | ||
} | ||
export declare type SchemaTransform = (originalSchema: GraphQLSchema) => GraphQLSchema; | ||
export declare type RequestTransform = (originalRequest: Request) => Request; | ||
export declare type ResultTransform = (originalResult: ExecutionResult) => ExecutionResult; | ||
export interface Transform { | ||
transformSchema?: (originalSchema: GraphQLSchema) => GraphQLSchema; | ||
transformRequest?: (originalRequest: Request) => Request; | ||
transformResult?: (originalResult: ExecutionResult) => ExecutionResult; | ||
transformSchema?: SchemaTransform; | ||
transformRequest?: RequestTransform; | ||
transformResult?: ResultTransform; | ||
} | ||
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>; | ||
export declare type FieldNodeMapper = (fieldNode: FieldNode, fragments: Record<string, FragmentDefinitionNode>) => SelectionNode | Array<SelectionNode>; | ||
export declare type FieldNodeMappers = Record<string, Record<string, FieldNodeMapper>>; | ||
export interface RenamedFieldConfig { | ||
name: string; | ||
field?: GraphQLFieldConfig<any, any>; | ||
} | ||
export declare type FieldFilter = (typeName?: string, fieldName?: string, field?: GraphQLField<any, any>) => boolean; | ||
export declare type RootFieldFilter = (operation?: 'Query' | 'Mutation' | 'Subscription', rootFieldName?: string, field?: GraphQLField<any, any>) => boolean; | ||
export declare type FieldFilter = (typeName?: string, fieldName?: string, fieldConfig?: GraphQLFieldConfig<any, any>) => boolean; | ||
export declare type RootFieldFilter = (operation?: 'Query' | 'Mutation' | 'Subscription', rootFieldName?: string, fieldConfig?: GraphQLFieldConfig<any, any>) => boolean; | ||
export declare type RenameTypesOptions = { | ||
@@ -76,32 +86,42 @@ renameBuiltins: boolean; | ||
}; | ||
export interface ICreateRequest { | ||
sourceSchema?: GraphQLSchema; | ||
sourceParentType?: GraphQLObjectType; | ||
sourceFieldName?: string; | ||
fragments?: Record<string, FragmentDefinitionNode>; | ||
variableDefinitions?: ReadonlyArray<VariableDefinitionNode>; | ||
variableValues?: Record<string, any>; | ||
targetOperation: Operation; | ||
targetFieldName: string; | ||
selectionSet?: SelectionSetNode; | ||
fieldNodes?: ReadonlyArray<FieldNode>; | ||
} | ||
export interface ReplacementSelectionSetMapping { | ||
[typeName: string]: { | ||
[fieldName: string]: SelectionSetNode; | ||
}; | ||
} | ||
export interface ReplacementFragmentMapping { | ||
[typeName: string]: { | ||
[fieldName: string]: InlineFragmentNode; | ||
}; | ||
} | ||
export declare type IFieldResolver<TSource, TContext, TArgs = Record<string, any>, TReturn = any> = (source: TSource, args: TArgs, context: TContext, info: GraphQLResolveInfo) => TReturn; | ||
export declare type ITypedef = (() => Array<ITypedef>) | string | DocumentNode; | ||
export declare type ITypeDefinitions = ITypedef | Array<ITypedef>; | ||
export interface IResolverObject<TSource = any, TContext = any, TArgs = any> { | ||
[key: string]: IFieldResolver<TSource, TContext, TArgs> | IResolverOptions<TSource, TContext> | IResolverObject<TSource, TContext>; | ||
} | ||
export declare type IEnumResolver = Record<string, string | number>; | ||
export declare type IResolvers<TSource = any, TContext = any> = Record<string, (() => any) | IResolverObject<TSource, TContext> | IResolverOptions<TSource, TContext> | GraphQLScalarType | IEnumResolver>; | ||
export declare type IObjectTypeResolver<TSource = any, TContext = any, TArgs = any> = { | ||
[key: string]: IFieldResolver<TSource, TContext, TArgs> | IFieldResolverOptions<TSource, TContext>; | ||
} & { | ||
__name?: string; | ||
__description?: string; | ||
__isTypeOf?: GraphQLIsTypeOfFn<TSource, TContext>; | ||
__extensions?: Record<string, any>; | ||
__astNode?: ObjectTypeDefinitionNode; | ||
__extensionASTNodes?: ObjectTypeExtensionNode; | ||
}; | ||
export declare type IInterfaceTypeResolver<TSource = any, TContext = any, TArgs = any> = { | ||
[key: string]: IFieldResolver<TSource, TContext, TArgs> | IFieldResolverOptions<TSource, TContext>; | ||
} & { | ||
__name?: string; | ||
__description?: string; | ||
__resolveType?: GraphQLTypeResolver<any, any>; | ||
__extensions?: Record<string, any>; | ||
__astNode?: InterfaceTypeDefinitionNode; | ||
__extensionASTNodes?: Array<InterfaceTypeExtensionNode>; | ||
}; | ||
export declare type IUnionTypeResolver = { | ||
__name?: string; | ||
__description?: string; | ||
__resolveType?: GraphQLTypeResolver<any, any>; | ||
__extensions?: Record<string, any>; | ||
__astNode?: UnionTypeDefinitionNode; | ||
__extensionASTNodes?: Array<UnionTypeExtensionNode>; | ||
}; | ||
export declare type IInputObjectTypeResolver = { | ||
__name?: string; | ||
__description?: string; | ||
__extensions?: Record<string, any>; | ||
__astNode?: InputObjectTypeDefinitionNode; | ||
__extensionASTNodes?: Array<InputObjectTypeExtensionNode>; | ||
}; | ||
export declare type ISchemaLevelResolver<TSource, TContext, TArgs = Record<string, any>, TReturn = any> = IFieldResolver<TSource, TContext, TArgs, TReturn>; | ||
export declare type IResolvers<TSource = any, TContext = any, TArgs = Record<string, any>, TReturn = any> = Record<string, ISchemaLevelResolver<TSource, TContext, TArgs, TReturn> | IObjectTypeResolver<TSource, TContext> | IInterfaceTypeResolver<TSource, TContext> | IUnionTypeResolver | IScalarTypeResolver | IEnumTypeResolver | IInputObjectTypeResolver>; | ||
export declare type IFieldIteratorFn = (fieldDef: GraphQLField<any, any>, typeName: string, fieldName: string) => void; | ||
@@ -177,3 +197,14 @@ export declare type IDefaultValueIteratorFn = (type: GraphQLInputType, value: any) => void; | ||
SUBSCRIPTION = "MapperKind.SUBSCRIPTION", | ||
DIRECTIVE = "MapperKind.DIRECTIVE" | ||
DIRECTIVE = "MapperKind.DIRECTIVE", | ||
FIELD = "MapperKind.FIELD", | ||
COMPOSITE_FIELD = "MapperKind.COMPOSITE_FIELD", | ||
OBJECT_FIELD = "MapperKind.OBJECT_FIELD", | ||
ROOT_FIELD = "MapperKind.ROOT_FIELD", | ||
QUERY_ROOT_FIELD = "MapperKind.QUERY_ROOT_FIELD", | ||
MUTATION_ROOT_FIELD = "MapperKind.MUTATION_ROOT_FIELD", | ||
SUBSCRIPTION_ROOT_FIELD = "MapperKind.SUBSCRIPTION_ROOT_FIELD", | ||
INTERFACE_FIELD = "MapperKind.INTERFACE_FIELD", | ||
INPUT_OBJECT_FIELD = "MapperKind.INPUT_OBJECT_FIELD", | ||
ARGUMENT = "MapperKind.ARGUMENT", | ||
ENUM_VALUE = "MapperKind.ENUM_VALUE" | ||
} | ||
@@ -194,2 +225,13 @@ export interface SchemaMapper { | ||
[MapperKind.SUBSCRIPTION]?: ObjectTypeMapper; | ||
[MapperKind.ENUM_VALUE]?: EnumValueMapper; | ||
[MapperKind.FIELD]?: GenericFieldMapper<GraphQLFieldConfig<any, any> | GraphQLInputFieldConfig>; | ||
[MapperKind.OBJECT_FIELD]?: FieldMapper; | ||
[MapperKind.ROOT_FIELD]?: FieldMapper; | ||
[MapperKind.QUERY_ROOT_FIELD]?: FieldMapper; | ||
[MapperKind.MUTATION_ROOT_FIELD]?: FieldMapper; | ||
[MapperKind.SUBSCRIPTION_ROOT_FIELD]?: FieldMapper; | ||
[MapperKind.INTERFACE_FIELD]?: FieldMapper; | ||
[MapperKind.COMPOSITE_FIELD]?: FieldMapper; | ||
[MapperKind.ARGUMENT]?: ArgumentMapper; | ||
[MapperKind.INPUT_OBJECT_FIELD]?: InputFieldMapper; | ||
[MapperKind.DIRECTIVE]?: DirectiveMapper; | ||
@@ -200,2 +242,3 @@ } | ||
export declare type EnumTypeMapper = (type: GraphQLEnumType, schema: GraphQLSchema) => GraphQLEnumType | null | undefined; | ||
export declare type EnumValueMapper = (value: GraphQLEnumValueConfig, typeName: string, schema: GraphQLSchema) => GraphQLEnumValueConfig | [string, GraphQLEnumValueConfig] | null | undefined; | ||
export declare type CompositeTypeMapper = (type: GraphQLObjectType | GraphQLInterfaceType | GraphQLUnionType, schema: GraphQLSchema) => GraphQLObjectType | GraphQLInterfaceType | GraphQLUnionType | null | undefined; | ||
@@ -208,1 +251,5 @@ export declare type ObjectTypeMapper = (type: GraphQLObjectType, schema: GraphQLSchema) => GraphQLObjectType | null | undefined; | ||
export declare type DirectiveMapper = (directive: GraphQLDirective, schema: GraphQLSchema) => GraphQLDirective | null | undefined; | ||
export declare type GenericFieldMapper<F extends GraphQLFieldConfig<any, any> | GraphQLInputFieldConfig> = (fieldConfig: F, fieldName: string, typeName: string, schema: GraphQLSchema) => F | [string, F] | null | undefined; | ||
export declare type FieldMapper = GenericFieldMapper<GraphQLFieldConfig<any, any>>; | ||
export declare type ArgumentMapper = (argumentConfig: GraphQLArgumentConfig, fieldName: string, typeName: string, schema: GraphQLSchema) => GraphQLArgumentConfig | [string, GraphQLArgumentConfig] | null | undefined; | ||
export declare type InputFieldMapper = GenericFieldMapper<GraphQLInputFieldConfig>; |
{ | ||
"name": "@graphql-tools/utils", | ||
"version": "5.0.1-alpha-bdd506c.0", | ||
"version": "5.0.1-alpha-c49b0a5.0", | ||
"description": "Common package containting utils and types for GraphQL tools", | ||
@@ -5,0 +5,0 @@ "peerDependencies": { |
import { GraphQLDirective, GraphQLNamedType } from 'graphql'; | ||
import { TypeMap } from './Interfaces'; | ||
export declare function rewireTypes(originalTypeMap: Record<string, GraphQLNamedType | null>, directives: ReadonlyArray<GraphQLDirective>, options?: { | ||
skipPruning: boolean; | ||
}): { | ||
typeMap: Record<string, GraphQLNamedType>; | ||
typeMap: TypeMap; | ||
directives: Array<GraphQLDirective>; | ||
}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
779638
54
6937