@graphql-tools/utils
Advanced tools
Comparing version 5.0.1-alpha-d5fbf81.0 to 5.0.1-alpha-d6a4fa5.0
@@ -1,8 +0,8 @@ | ||
import { GraphQLType } from 'graphql'; | ||
import { GraphQLSchemaWithTransforms, RootFieldFilter } from './Interfaces'; | ||
import { GraphQLType, GraphQLSchema } from 'graphql'; | ||
import { RootFieldFilter } from './Interfaces'; | ||
export declare function filterSchema({ schema, rootFieldFilter, typeFilter, fieldFilter, }: { | ||
schema: GraphQLSchemaWithTransforms; | ||
schema: GraphQLSchema; | ||
rootFieldFilter?: RootFieldFilter; | ||
typeFilter?: (typeName: string, type: GraphQLType) => boolean; | ||
fieldFilter?: (typeName: string, fieldName: string) => boolean; | ||
}): GraphQLSchemaWithTransforms; | ||
}): GraphQLSchema; |
@@ -7,6 +7,4 @@ import { ASTNode } from 'graphql'; | ||
export declare function isValidPath(str: string): boolean; | ||
export declare function resolveBuiltinModule<Module>(moduleName: string, option?: Module | string): Promise<Module>; | ||
export declare function resolveBuiltinModuleSync<Module>(moduleName: string, option?: Module | string): Module; | ||
export declare function compareStrings<A, B>(a: A, b: B): 0 | 1 | -1; | ||
export declare function nodeToString(a: ASTNode): string; | ||
export declare function compareNodes(a: ASTNode, b: ASTNode, customFn?: (a: any, b: any) => number): number; |
@@ -29,6 +29,6 @@ export * from './loaders'; | ||
export * from './map'; | ||
export * from './rewire'; | ||
export * from './mergeDeep'; | ||
export * from './Interfaces'; | ||
export * from './fieldNodes'; | ||
export * from './resolveFromParentTypename'; | ||
export * from './stub'; | ||
@@ -35,0 +35,0 @@ export * from './fragments'; |
@@ -1,5 +0,3 @@ | ||
import { GraphQLSchema, GraphQLField, GraphQLInputType, GraphQLNamedType, GraphQLFieldResolver, GraphQLResolveInfo, GraphQLIsTypeOfFn, GraphQLTypeResolver, GraphQLScalarType, DocumentNode, FieldNode, GraphQLEnumValue, GraphQLEnumType, GraphQLUnionType, GraphQLArgument, GraphQLInputField, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLObjectType, InlineFragmentNode, GraphQLOutputType, SelectionSetNode, GraphQLDirective, GraphQLFieldConfig, FragmentDefinitionNode, SelectionNode, VariableDefinitionNode, OperationDefinitionNode, GraphQLError, ExecutionResult as GraphQLExecutionResult, BuildSchemaOptions } from 'graphql'; | ||
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 { SchemaVisitor } from './SchemaVisitor'; | ||
import { SchemaDirectiveVisitor } from './SchemaDirectiveVisitor'; | ||
export declare type SchemaDirectiveVisitorClass = typeof SchemaDirectiveVisitor; | ||
export interface ExecutionResult<TData = Record<string, any>> extends GraphQLExecutionResult { | ||
@@ -76,89 +74,2 @@ data?: TData | null; | ||
}; | ||
declare module 'graphql' { | ||
interface GraphQLResolveInfo { | ||
mergeInfo?: MergeInfo; | ||
} | ||
} | ||
export interface ExecutionParams<TArgs = Record<string, any>, TContext = any> { | ||
document: DocumentNode; | ||
variables?: TArgs; | ||
context?: TContext; | ||
info?: GraphQLResolveInfo; | ||
} | ||
export declare type AsyncExecutor = <TReturn = Record<string, any>, TArgs = Record<string, any>, TContext = Record<string, any>>(params: ExecutionParams<TArgs, TContext>) => Promise<ExecutionResult<TReturn>>; | ||
export declare type SyncExecutor = <TReturn = Record<string, any>, TArgs = Record<string, any>, TContext = Record<string, any>>(params: ExecutionParams<TArgs, TContext>) => ExecutionResult<TReturn>; | ||
export declare type Executor = AsyncExecutor | SyncExecutor; | ||
export declare type Subscriber = <TReturn = Record<string, any>, TArgs = Record<string, any>, TContext = Record<string, any>>(params: ExecutionParams<TArgs, TContext>) => Promise<AsyncIterator<ExecutionResult<TReturn>> | ExecutionResult<TReturn>>; | ||
export interface SubschemaConfig { | ||
schema: GraphQLSchema; | ||
rootValue?: Record<string, any>; | ||
executor?: Executor; | ||
subscriber?: Subscriber; | ||
createProxyingResolver?: CreateProxyingResolverFn; | ||
transforms?: Array<Transform>; | ||
merge?: Record<string, MergedTypeConfig>; | ||
} | ||
export interface MergedTypeConfig { | ||
selectionSet?: string; | ||
fieldName?: string; | ||
args?: (originalResult: any) => Record<string, any>; | ||
resolve?: MergedTypeResolver; | ||
} | ||
export declare type MergedTypeResolver = (originalResult: any, context: Record<string, any>, info: GraphQLResolveInfo, subschema: GraphQLSchema | SubschemaConfig, selectionSet: SelectionSetNode) => any; | ||
export interface GraphQLSchemaWithTransforms extends GraphQLSchema { | ||
transforms?: Array<Transform>; | ||
} | ||
export declare type MergeTypeCandidate = { | ||
type: GraphQLNamedType; | ||
schema?: GraphQLSchema; | ||
subschema?: GraphQLSchema | SubschemaConfig; | ||
transformedSubschema?: GraphQLSchema; | ||
}; | ||
export declare type MergeTypeFilter = (mergeTypeCandidates: Array<MergeTypeCandidate>, typeName: string) => boolean; | ||
export interface IMakeRemoteExecutableSchemaOptions { | ||
schema: GraphQLSchema | string; | ||
executor?: Executor; | ||
subscriber?: Subscriber; | ||
createResolver?: (executor: Executor, subscriber: Subscriber) => GraphQLFieldResolver<any, any>; | ||
buildSchemaOptions?: BuildSchemaOptions; | ||
} | ||
export interface IStitchSchemasOptions { | ||
subschemas?: Array<GraphQLSchema | SubschemaConfig>; | ||
types?: Array<GraphQLNamedType>; | ||
typeDefs?: string | DocumentNode; | ||
schemas?: Array<SchemaLikeObject>; | ||
onTypeConflict?: OnTypeConflict; | ||
resolvers?: IResolversParameter; | ||
schemaDirectives?: Record<string, SchemaDirectiveVisitorClass>; | ||
inheritResolversFromInterfaces?: boolean; | ||
mergeTypes?: boolean | Array<string> | MergeTypeFilter; | ||
mergeDirectives?: boolean; | ||
queryTypeName?: string; | ||
mutationTypeName?: string; | ||
subscriptionTypeName?: string; | ||
} | ||
export declare type SchemaLikeObject = SubschemaConfig | GraphQLSchema | string | DocumentNode | Array<GraphQLNamedType>; | ||
export declare function isSubschemaConfig(value: SchemaLikeObject): value is SubschemaConfig; | ||
export interface IDelegateToSchemaOptions<TContext = Record<string, any>, TArgs = Record<string, any>> { | ||
schema: GraphQLSchema | SubschemaConfig; | ||
operation?: Operation; | ||
fieldName?: string; | ||
returnType?: GraphQLOutputType; | ||
args?: TArgs; | ||
selectionSet?: SelectionSetNode; | ||
fieldNodes?: ReadonlyArray<FieldNode>; | ||
context?: TContext; | ||
info: GraphQLResolveInfo; | ||
rootValue?: Record<string, any>; | ||
transforms?: Array<Transform>; | ||
skipValidation?: boolean; | ||
skipTypeMerging?: boolean; | ||
} | ||
export interface ICreateRequestFromInfo { | ||
info: GraphQLResolveInfo; | ||
operation: Operation; | ||
fieldName: string; | ||
selectionSet?: SelectionSetNode; | ||
fieldNodes?: ReadonlyArray<FieldNode>; | ||
} | ||
export interface ICreateRequest { | ||
@@ -176,16 +87,2 @@ sourceSchema?: GraphQLSchema; | ||
} | ||
export interface IDelegateRequestOptions extends IDelegateToSchemaOptions { | ||
request: Request; | ||
} | ||
export interface MergeInfo { | ||
delegate: (type: 'query' | 'mutation' | 'subscription', fieldName: string, args: Record<string, any>, context: Record<string, any>, info: GraphQLResolveInfo, transforms?: Array<Transform>) => any; | ||
fragments: Array<{ | ||
field: string; | ||
fragment: string; | ||
}>; | ||
replacementSelectionSets: ReplacementSelectionSetMapping; | ||
replacementFragments: ReplacementFragmentMapping; | ||
mergedTypes: Record<string, MergedTypeInfo>; | ||
delegateToSchema<TContext, TArgs>(options: IDelegateToSchemaOptions<TContext, TArgs>): any; | ||
} | ||
export interface ReplacementSelectionSetMapping { | ||
@@ -201,11 +98,2 @@ [typeName: string]: { | ||
} | ||
export interface MergedTypeInfo { | ||
subschemas: Array<SubschemaConfig>; | ||
selectionSet?: SelectionSetNode; | ||
uniqueFields: Record<string, SubschemaConfig>; | ||
nonUniqueFields: Record<string, Array<SubschemaConfig>>; | ||
typeMaps: Map<SubschemaConfig, TypeMap>; | ||
selectionSets: Map<SubschemaConfig, SelectionSetNode>; | ||
containsSelectionSet: Map<SubschemaConfig, Map<SelectionSetNode, boolean>>; | ||
} | ||
export declare type IFieldResolver<TSource, TContext, TArgs = Record<string, any>, TReturn = any> = (source: TSource, args: TArgs, context: TContext, info: GraphQLResolveInfo) => TReturn; | ||
@@ -219,17 +107,2 @@ export declare type ITypedef = (() => Array<ITypedef>) | string | DocumentNode; | ||
export declare type IResolvers<TSource = any, TContext = any> = Record<string, (() => any) | IResolverObject<TSource, TContext> | IResolverOptions<TSource, TContext> | GraphQLScalarType | IEnumResolver>; | ||
export declare type IResolversParameter = Array<IResolvers | ((mergeInfo: MergeInfo) => IResolvers)> | IResolvers | ((mergeInfo: MergeInfo) => IResolvers); | ||
export interface ILogger { | ||
log: (error: Error) => void; | ||
} | ||
export interface IExecutableSchemaDefinition<TContext = any> { | ||
typeDefs: ITypeDefinitions; | ||
resolvers?: IResolvers<any, TContext> | Array<IResolvers<any, TContext>>; | ||
logger?: ILogger; | ||
allowUndefinedInResolve?: boolean; | ||
resolverValidationOptions?: IResolverValidationOptions; | ||
directiveResolvers?: IDirectiveResolvers<any, TContext>; | ||
schemaDirectives?: Record<string, SchemaDirectiveVisitorClass>; | ||
parseOptions?: GraphQLParseOptions; | ||
inheritResolversFromInterfaces?: boolean; | ||
} | ||
export declare type IFieldIteratorFn = (fieldDef: GraphQLField<any, any>, typeName: string, fieldName: string) => void; | ||
@@ -244,10 +117,2 @@ export declare type IDefaultValueIteratorFn = (type: GraphQLInputType, value: any) => void; | ||
} | ||
export declare type OnTypeConflict = (left: GraphQLNamedType, right: GraphQLNamedType, info?: { | ||
left: { | ||
schema?: GraphQLSchema | SubschemaConfig; | ||
}; | ||
right: { | ||
schema?: GraphQLSchema | SubschemaConfig; | ||
}; | ||
}) => GraphQLNamedType; | ||
export declare type Operation = 'query' | 'mutation' | 'subscription'; | ||
@@ -259,3 +124,2 @@ export interface Request { | ||
} | ||
export declare type IndexedObject<V> = Record<string, V> | ReadonlyArray<V>; | ||
export declare type VisitableSchemaType = GraphQLSchema | GraphQLObjectType | GraphQLInterfaceType | GraphQLInputObjectType | GraphQLNamedType | GraphQLScalarType | GraphQLField<any, any> | GraphQLInputField | GraphQLArgument | GraphQLUnionType | GraphQLEnumType | GraphQLEnumValue; | ||
@@ -344,2 +208,1 @@ export declare type VisitorSelector = (type: VisitableSchemaType, methodName: string) => Array<SchemaVisitor | SchemaVisitorMap>; | ||
export declare type DirectiveMapper = (directive: GraphQLDirective, schema: GraphQLSchema) => GraphQLDirective | null | undefined; | ||
export declare type CreateProxyingResolverFn = (schema: GraphQLSchema | SubschemaConfig, transforms: Array<Transform>, operation: Operation, fieldName: string) => GraphQLFieldResolver<any, any>; |
import { DocumentNode, GraphQLSchema, ParseOptions, BuildSchemaOptions } from 'graphql'; | ||
import { GraphQLSchemaValidationOptions } from 'graphql/type/schema'; | ||
export declare class Source { | ||
export interface Source { | ||
document?: DocumentNode; | ||
@@ -8,7 +8,2 @@ schema?: GraphQLSchema; | ||
location?: string; | ||
constructor({ document, location, schema }: { | ||
document?: DocumentNode; | ||
location?: string; | ||
schema?: GraphQLSchema; | ||
}); | ||
} | ||
@@ -15,0 +10,0 @@ export declare type SingleFileOptions = ParseOptions & GraphQLSchemaValidationOptions & BuildSchemaOptions & { |
@@ -1,7 +0,3 @@ | ||
import { GraphQLDirective, GraphQLNamedType, GraphQLSchema } from 'graphql'; | ||
import { GraphQLSchema } from 'graphql'; | ||
import { SchemaMapper } from './Interfaces'; | ||
export declare function mapSchema(schema: GraphQLSchema, schemaMapper?: SchemaMapper): GraphQLSchema; | ||
export declare function rewireTypes(originalTypeMap: Record<string, GraphQLNamedType | null>, directives: ReadonlyArray<GraphQLDirective>): { | ||
typeMap: Record<string, GraphQLNamedType>; | ||
directives: Array<GraphQLDirective>; | ||
}; |
{ | ||
"name": "@graphql-tools/utils", | ||
"version": "5.0.1-alpha-d5fbf81.0", | ||
"version": "5.0.1-alpha-d6a4fa5.0", | ||
"description": "Common package containting utils and types for GraphQL tools", | ||
@@ -21,4 +21,5 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"graphql-scalars": "1.1.2", | ||
"iterall": "1.3.0" | ||
"@types/dateformat": "3.0.1", | ||
"dateformat": "3.0.3", | ||
"graphql-scalars": "1.1.2" | ||
}, | ||
@@ -25,0 +26,0 @@ "publishConfig": { |
import { GraphQLDirective, GraphQLSchema } from 'graphql'; | ||
import { VisitableSchemaType, SchemaDirectiveVisitorClass } from './Interfaces'; | ||
import { VisitableSchemaType } from './Interfaces'; | ||
import { SchemaVisitor } from './SchemaVisitor'; | ||
export declare type SchemaDirectiveVisitorClass = typeof SchemaDirectiveVisitor; | ||
export declare class SchemaDirectiveVisitor<TArgs = any, TContext = any> extends SchemaVisitor { | ||
@@ -5,0 +6,0 @@ name: string; |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
7
0
675551
3
6112