@graphql-tools/utils
Advanced tools
Comparing version 5.0.1-alpha-b4a3ab5.0 to 5.0.1-alpha-b5658b2.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, GraphQLScalarType, DocumentNode, FieldNode, GraphQLEnumValue, GraphQLEnumType, GraphQLUnionType, GraphQLArgument, GraphQLInputField, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLObjectType, SelectionSetNode, GraphQLDirective, FragmentDefinitionNode, SelectionNode, VariableDefinitionNode, OperationDefinitionNode, GraphQLError, ExecutionResult as GraphQLExecutionResult, GraphQLOutputType, FieldDefinitionNode } 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 } from 'graphql'; | ||
import { SchemaVisitor } from './SchemaVisitor'; | ||
@@ -71,11 +71,14 @@ export interface ExecutionResult<TData = Record<string, any>> extends GraphQLExecutionResult { | ||
} | ||
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 FieldNodeMapper = (fieldNode: FieldNode, fragments: Record<string, FragmentDefinitionNode>) => SelectionNode | Array<SelectionNode>; | ||
export declare type FieldNodeMappers = Record<string, Record<string, FieldNodeMapper>>; | ||
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 = { | ||
@@ -85,14 +88,2 @@ 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 declare type IFieldResolver<TSource, TContext, TArgs = Record<string, any>, TReturn = any> = (source: TSource, args: TArgs, context: TContext, info: GraphQLResolveInfo) => TReturn; | ||
@@ -218,3 +209,14 @@ export declare type ITypedef = (() => Array<ITypedef>) | string | DocumentNode; | ||
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" | ||
} | ||
@@ -235,2 +237,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; | ||
@@ -241,2 +254,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; | ||
@@ -249,2 +263,6 @@ 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>; | ||
export {}; |
{ | ||
"name": "@graphql-tools/utils", | ||
"version": "5.0.1-alpha-b4a3ab5.0", | ||
"version": "5.0.1-alpha-b5658b2.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
785147
54
6968