@graphql-tools/utils 8.2.0-alpha-aa385bc9.0 → 8.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/comments.d.ts +3 -1
  2. package/fixSchemaAst.d.ts +3 -0
  3. package/index.d.ts +1 -0
  4. package/index.js +53 -23
  5. package/index.mjs +53 -25
  6. package/package.json +1 -1
  7. package/es5/AggregateError.d.ts +0 -10
  8. package/es5/Interfaces.d.ts +0 -242
  9. package/es5/addTypes.d.ts +0 -2
  10. package/es5/astFromType.d.ts +0 -2
  11. package/es5/astFromValueUntyped.d.ts +0 -17
  12. package/es5/build-operation-for-field.d.ts +0 -18
  13. package/es5/collectFields.d.ts +0 -5
  14. package/es5/comments.d.ts +0 -28
  15. package/es5/errors.d.ts +0 -2
  16. package/es5/executor.d.ts +0 -7
  17. package/es5/fields.d.ts +0 -5
  18. package/es5/filterSchema.d.ts +0 -12
  19. package/es5/forEachDefaultValue.d.ts +0 -3
  20. package/es5/forEachField.d.ts +0 -3
  21. package/es5/get-directives.d.ts +0 -11
  22. package/es5/get-fields-with-directives.d.ts +0 -16
  23. package/es5/get-implementing-types.d.ts +0 -2
  24. package/es5/getArgumentValues.d.ts +0 -10
  25. package/es5/getObjectTypeFromTypeMap.d.ts +0 -3
  26. package/es5/getResolversFromSchema.d.ts +0 -3
  27. package/es5/getResponseKeyFromInfo.d.ts +0 -7
  28. package/es5/heal.d.ts +0 -3
  29. package/es5/helpers.d.ts +0 -9
  30. package/es5/implementsAbstractType.d.ts +0 -3
  31. package/es5/index.d.ts +0 -48
  32. package/es5/index.js +0 -4818
  33. package/es5/index.mjs +0 -4712
  34. package/es5/inspect.d.ts +0 -4
  35. package/es5/isAsyncIterable.d.ts +0 -1
  36. package/es5/isDocumentNode.d.ts +0 -2
  37. package/es5/loaders.d.ts +0 -18
  38. package/es5/mapAsyncIterator.d.ts +0 -5
  39. package/es5/mapSchema.d.ts +0 -7
  40. package/es5/memoize.d.ts +0 -6
  41. package/es5/mergeDeep.d.ts +0 -9
  42. package/es5/observableToAsyncIterable.d.ts +0 -12
  43. package/es5/package.json +0 -35
  44. package/es5/parse-graphql-json.d.ts +0 -4
  45. package/es5/parse-graphql-sdl.d.ts +0 -13
  46. package/es5/print-schema-with-directives.d.ts +0 -21
  47. package/es5/prune.d.ts +0 -8
  48. package/es5/renameType.d.ts +0 -8
  49. package/es5/rewire.d.ts +0 -5
  50. package/es5/rootTypes.d.ts +0 -5
  51. package/es5/selectionSets.d.ts +0 -3
  52. package/es5/stub.d.ts +0 -9
  53. package/es5/transformInputValue.d.ts +0 -6
  54. package/es5/types.d.ts +0 -49
  55. package/es5/updateArgument.d.ts +0 -3
  56. package/es5/validate-documents.d.ts +0 -9
  57. package/es5/valueMatchesCriteria.d.ts +0 -1
  58. package/es5/visitResult.d.ts +0 -15
  59. package/es5/withCancel.d.ts +0 -3
package/es5/inspect.d.ts DELETED
@@ -1,4 +0,0 @@
1
- /**
2
- * Used to print values in error messages.
3
- */
4
- export declare function inspect(value: unknown): string;
@@ -1 +0,0 @@
1
- export declare function isAsyncIterable<T>(value: any): value is AsyncIterableIterator<T>;
@@ -1,2 +0,0 @@
1
- import { DocumentNode } from 'graphql';
2
- export declare function isDocumentNode(object: any): object is DocumentNode;
package/es5/loaders.d.ts DELETED
@@ -1,18 +0,0 @@
1
- import { DocumentNode, GraphQLSchema, BuildSchemaOptions } from 'graphql';
2
- import { GraphQLParseOptions } from './Interfaces';
3
- export interface Source {
4
- document?: DocumentNode;
5
- schema?: GraphQLSchema;
6
- rawSDL?: string;
7
- location?: string;
8
- }
9
- export declare type BaseLoaderOptions = GraphQLParseOptions & BuildSchemaOptions & {
10
- cwd?: string;
11
- ignore?: string | string[];
12
- };
13
- export declare type WithList<T> = T | T[];
14
- export declare type ElementOf<TList> = TList extends Array<infer TElement> ? TElement : never;
15
- export interface Loader<TOptions extends BaseLoaderOptions = BaseLoaderOptions> {
16
- load(pointer: string, options?: TOptions): Promise<Source[] | null | never>;
17
- loadSync?(pointer: string, options?: TOptions): Source[] | null | never;
18
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * Given an AsyncIterable and a callback function, return an AsyncIterator
3
- * which produces values mapped via calling the callback function.
4
- */
5
- export declare function mapAsyncIterator<T, U>(iterator: AsyncIterator<T>, callback: (value: T) => Promise<U> | U, rejectCallback?: any): AsyncIterableIterator<U>;
@@ -1,7 +0,0 @@
1
- import { GraphQLObjectType, GraphQLSchema, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLEnumType } from 'graphql';
2
- import { SchemaMapper } from './Interfaces';
3
- export declare function mapSchema(schema: GraphQLSchema, schemaMapper?: SchemaMapper): GraphQLSchema;
4
- export declare function correctASTNodes(type: GraphQLObjectType): GraphQLObjectType;
5
- export declare function correctASTNodes(type: GraphQLInterfaceType): GraphQLInterfaceType;
6
- export declare function correctASTNodes(type: GraphQLInputObjectType): GraphQLInputObjectType;
7
- export declare function correctASTNodes(type: GraphQLEnumType): GraphQLEnumType;
package/es5/memoize.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export declare function memoize1<F extends (a1: any) => any>(fn: F): F;
2
- export declare function memoize2<F extends (a1: any, a2: any) => any>(fn: F): F;
3
- export declare function memoize3<F extends (a1: any, a2: any, a3: any) => any>(fn: F): F;
4
- export declare function memoize4<F extends (a1: any, a2: any, a3: any, a4: any) => any>(fn: F): F;
5
- export declare function memoize5<F extends (a1: any, a2: any, a3: any, a4: any, a5: any) => any>(fn: F): F;
6
- export declare function memoize2of4<F extends (a1: any, a2: any, a3: any, a4: any) => any>(fn: F): F;
@@ -1,9 +0,0 @@
1
- declare type BoxedTupleTypes<T extends any[]> = {
2
- [P in keyof T]: [T[P]];
3
- }[Exclude<keyof T, keyof any[]>];
4
- declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
5
- declare type UnboxIntersection<T> = T extends {
6
- 0: infer U;
7
- } ? U : never;
8
- export declare function mergeDeep<S extends any[]>(sources: S, respectPrototype?: boolean): UnboxIntersection<UnionToIntersection<BoxedTupleTypes<S>>> & any;
9
- export {};
@@ -1,12 +0,0 @@
1
- export interface Observer<T> {
2
- next: (value: T) => void;
3
- error: (error: Error) => void;
4
- complete: () => void;
5
- }
6
- export interface Observable<T> {
7
- subscribe(observer: Observer<T>): {
8
- unsubscribe: () => void;
9
- };
10
- }
11
- export declare type Callback = (value?: any) => any;
12
- export declare function observableToAsyncIterable<T>(observable: Observable<T>): AsyncIterableIterator<T>;
package/es5/package.json DELETED
@@ -1,35 +0,0 @@
1
- {
2
- "name": "@graphql-tools/utils/es5",
3
- "version": "8.2.0-alpha-aa385bc9.0",
4
- "description": "Common package containing utils and types for GraphQL tools",
5
- "sideEffects": false,
6
- "peerDependencies": {
7
- "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
8
- },
9
- "dependencies": {
10
- "tslib": "~2.3.0"
11
- },
12
- "repository": {
13
- "type": "git",
14
- "url": "ardatan/graphql-tools",
15
- "directory": "packages/utils"
16
- },
17
- "author": "Dotan Simha <dotansimha@gmail.com>",
18
- "license": "MIT",
19
- "main": "index.js",
20
- "module": "index.mjs",
21
- "typings": "index.d.ts",
22
- "typescript": {
23
- "definition": "index.d.ts"
24
- },
25
- "exports": {
26
- ".": {
27
- "require": "./index.js",
28
- "import": "./index.mjs"
29
- },
30
- "./*": {
31
- "require": "./*.js",
32
- "import": "./*.mjs"
33
- }
34
- }
35
- }
@@ -1,4 +0,0 @@
1
- import { ParseOptions } from 'graphql';
2
- import { Source } from './loaders';
3
- import { SchemaPrintOptions } from './types';
4
- export declare function parseGraphQLJSON(location: string, jsonContent: string, options: SchemaPrintOptions & ParseOptions): Source;
@@ -1,13 +0,0 @@
1
- import { DocumentNode, ASTNode, StringValueNode } from 'graphql';
2
- import { GraphQLParseOptions } from './Interfaces';
3
- export declare function parseGraphQLSDL(location: string | undefined, rawSDL: string, options?: GraphQLParseOptions): {
4
- location: string | undefined;
5
- document: DocumentNode;
6
- };
7
- export declare function transformCommentsToDescriptions(sourceSdl: string, options?: GraphQLParseOptions): DocumentNode;
8
- declare type DiscriminateUnion<T, U> = T extends U ? T : never;
9
- declare type DescribableASTNodes = DiscriminateUnion<ASTNode, {
10
- description?: StringValueNode;
11
- }>;
12
- export declare function isDescribable(node: ASTNode): node is DescribableASTNodes;
13
- export {};
@@ -1,21 +0,0 @@
1
- import { GraphQLSchema, GraphQLNamedType, DirectiveNode, FieldDefinitionNode, InputValueDefinitionNode, GraphQLArgument, EnumValueDefinitionNode, GraphQLDirective, DirectiveDefinitionNode, SchemaDefinitionNode, SchemaExtensionNode, GraphQLObjectType, ObjectTypeDefinitionNode, GraphQLField, GraphQLInterfaceType, InterfaceTypeDefinitionNode, UnionTypeDefinitionNode, GraphQLUnionType, GraphQLInputObjectType, InputObjectTypeDefinitionNode, GraphQLInputField, GraphQLEnumType, GraphQLEnumValue, EnumTypeDefinitionNode, GraphQLScalarType, ScalarTypeDefinitionNode, DocumentNode } from 'graphql';
2
- import { GetDocumentNodeFromSchemaOptions, PrintSchemaWithDirectivesOptions, Maybe } from './types';
3
- export declare function getDocumentNodeFromSchema(schema: GraphQLSchema, options?: GetDocumentNodeFromSchemaOptions): DocumentNode;
4
- export declare function printSchemaWithDirectives(schema: GraphQLSchema, options?: PrintSchemaWithDirectivesOptions): string;
5
- export declare function astFromSchema(schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): SchemaDefinitionNode | SchemaExtensionNode | null;
6
- export declare function astFromDirective(directive: GraphQLDirective, schema?: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): DirectiveDefinitionNode;
7
- export declare function getDirectiveNodes(entity: GraphQLSchema | GraphQLNamedType | GraphQLEnumValue, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): Array<DirectiveNode>;
8
- export declare function getDeprecatableDirectiveNodes(entity: GraphQLArgument | GraphQLField<any, any> | GraphQLInputField, schema?: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): Array<DirectiveNode>;
9
- export declare function astFromArg(arg: GraphQLArgument, schema?: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): InputValueDefinitionNode;
10
- export declare function astFromObjectType(type: GraphQLObjectType, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): ObjectTypeDefinitionNode;
11
- export declare function astFromInterfaceType(type: GraphQLInterfaceType, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): InterfaceTypeDefinitionNode;
12
- export declare function astFromUnionType(type: GraphQLUnionType, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): UnionTypeDefinitionNode;
13
- export declare function astFromInputObjectType(type: GraphQLInputObjectType, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): InputObjectTypeDefinitionNode;
14
- export declare function astFromEnumType(type: GraphQLEnumType, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): EnumTypeDefinitionNode;
15
- export declare function astFromScalarType(type: GraphQLScalarType, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): ScalarTypeDefinitionNode;
16
- export declare function astFromField(field: GraphQLField<any, any>, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): FieldDefinitionNode;
17
- export declare function astFromInputField(field: GraphQLInputField, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): InputValueDefinitionNode;
18
- export declare function astFromEnumValue(value: GraphQLEnumValue, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>): EnumValueDefinitionNode;
19
- export declare function makeDeprecatedDirective(deprecationReason: string): DirectiveNode;
20
- export declare function makeDirectiveNode(name: string, args: Record<string, any>, directive?: Maybe<GraphQLDirective>): DirectiveNode;
21
- export declare function makeDirectiveNodes(schema: Maybe<GraphQLSchema>, directiveValues: Record<string, any>): Array<DirectiveNode>;
package/es5/prune.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import { GraphQLSchema } from 'graphql';
2
- import { PruneSchemaOptions } from './types';
3
- /**
4
- * Prunes the provided schema, removing unused and empty types
5
- * @param schema The schema to prune
6
- * @param options Additional options for removing unused types from the schema
7
- */
8
- export declare function pruneSchema(schema: GraphQLSchema, options?: PruneSchemaOptions): GraphQLSchema;
@@ -1,8 +0,0 @@
1
- import { GraphQLEnumType, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLObjectType, GraphQLNamedType, GraphQLScalarType, GraphQLUnionType } from 'graphql';
2
- export declare function renameType(type: GraphQLObjectType, newTypeName: string): GraphQLObjectType;
3
- export declare function renameType(type: GraphQLInterfaceType, newTypeName: string): GraphQLInterfaceType;
4
- export declare function renameType(type: GraphQLUnionType, newTypeName: string): GraphQLUnionType;
5
- export declare function renameType(type: GraphQLEnumType, newTypeName: string): GraphQLEnumType;
6
- export declare function renameType(type: GraphQLScalarType, newTypeName: string): GraphQLScalarType;
7
- export declare function renameType(type: GraphQLInputObjectType, newTypeName: string): GraphQLInputObjectType;
8
- export declare function renameType(type: GraphQLNamedType, newTypeName: string): GraphQLNamedType;
package/es5/rewire.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { GraphQLDirective, GraphQLNamedType } from 'graphql';
2
- export declare function rewireTypes(originalTypeMap: Record<string, GraphQLNamedType | null>, directives: ReadonlyArray<GraphQLDirective>): {
3
- typeMap: Record<string, GraphQLNamedType>;
4
- directives: Array<GraphQLDirective>;
5
- };
@@ -1,5 +0,0 @@
1
- import { GraphQLObjectType, GraphQLSchema, OperationTypeNode } from 'graphql';
2
- export declare function getDefinedRootType(schema: GraphQLSchema, operation: OperationTypeNode): GraphQLObjectType;
3
- export declare const getRootTypeNames: (schema: GraphQLSchema) => Set<string>;
4
- export declare const getRootTypes: (schema: GraphQLSchema) => Set<GraphQLObjectType>;
5
- export declare const getRootTypeMap: (schema: GraphQLSchema) => Map<OperationTypeNode, GraphQLObjectType>;
@@ -1,3 +0,0 @@
1
- import { SelectionSetNode } from 'graphql';
2
- import { GraphQLParseOptions } from './Interfaces';
3
- export declare function parseSelectionSet(selectionSet: string, options?: GraphQLParseOptions): SelectionSetNode;
package/es5/stub.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { GraphQLObjectType, GraphQLInterfaceType, GraphQLInputObjectType, GraphQLNamedType, TypeNode, GraphQLType, GraphQLOutputType, GraphQLInputType } from 'graphql';
2
- export declare function createNamedStub(name: string, type: 'object'): GraphQLObjectType;
3
- export declare function createNamedStub(name: string, type: 'interface'): GraphQLInterfaceType;
4
- export declare function createNamedStub(name: string, type: 'input'): GraphQLInputObjectType;
5
- export declare function createStub(node: TypeNode, type: 'output'): GraphQLOutputType;
6
- export declare function createStub(node: TypeNode, type: 'input'): GraphQLInputType;
7
- export declare function createStub(node: TypeNode, type: 'output' | 'input'): GraphQLType;
8
- export declare function isNamedStub(type: GraphQLNamedType): boolean;
9
- export declare function getBuiltInForStub(type: GraphQLNamedType): GraphQLNamedType;
@@ -1,6 +0,0 @@
1
- import { GraphQLInputType } from 'graphql';
2
- import { InputLeafValueTransformer, InputObjectValueTransformer, Maybe } from './types';
3
- export declare function transformInputValue(type: GraphQLInputType, value: any, inputLeafValueTransformer?: Maybe<InputLeafValueTransformer>, inputObjectValueTransformer?: Maybe<InputObjectValueTransformer>): any;
4
- export declare function serializeInputValue(type: GraphQLInputType, value: any): any;
5
- export declare function parseInputValue(type: GraphQLInputType, value: any): any;
6
- export declare function parseInputValueLiteral(type: GraphQLInputType, value: any): any;
package/es5/types.d.ts DELETED
@@ -1,49 +0,0 @@
1
- import { GraphQLEnumType, GraphQLInputObjectType, GraphQLNamedType, GraphQLScalarType } from 'graphql';
2
- export interface SchemaPrintOptions {
3
- /**
4
- * Descriptions are defined as preceding string literals, however an older
5
- * experimental version of the SDL supported preceding comments as
6
- * descriptions. Set to true to enable this deprecated behavior.
7
- * This option is provided to ease adoption and will be removed in v16.
8
- *
9
- * Default: false
10
- */
11
- commentDescriptions?: boolean;
12
- assumeValid?: boolean;
13
- }
14
- export interface GetDocumentNodeFromSchemaOptions {
15
- pathToDirectivesInExtensions?: Array<string>;
16
- }
17
- export declare type PrintSchemaWithDirectivesOptions = SchemaPrintOptions & GetDocumentNodeFromSchemaOptions;
18
- export declare type Maybe<T> = null | undefined | T;
19
- export declare type Constructor<T> = new (...args: any[]) => T;
20
- export declare type PruneSchemaFilter = (type: GraphQLNamedType) => boolean;
21
- /**
22
- * Options for removing unused types from the schema
23
- */
24
- export interface PruneSchemaOptions {
25
- /**
26
- * Return true to skip pruning this type. This check will run first before any other options.
27
- * This can be helpful for schemas that support type extensions like Apollo Federation.
28
- */
29
- skipPruning?: PruneSchemaFilter;
30
- /**
31
- * Set to `true` to skip pruning object types or interfaces with no no fields
32
- */
33
- skipEmptyCompositeTypePruning?: boolean;
34
- /**
35
- * Set to `true` to skip pruning interfaces that are not implemented by any
36
- * other types
37
- */
38
- skipUnimplementedInterfacesPruning?: boolean;
39
- /**
40
- * Set to `true` to skip pruning empty unions
41
- */
42
- skipEmptyUnionPruning?: boolean;
43
- /**
44
- * Set to `true` to skip pruning unused types
45
- */
46
- skipUnusedTypesPruning?: boolean;
47
- }
48
- export declare type InputLeafValueTransformer = (type: GraphQLEnumType | GraphQLScalarType, originalValue: any) => any;
49
- export declare type InputObjectValueTransformer = (type: GraphQLInputObjectType, originalValue: Record<string, any>) => Record<string, any>;
@@ -1,3 +0,0 @@
1
- import { GraphQLInputType, ArgumentNode, VariableDefinitionNode } from 'graphql';
2
- export declare function updateArgument(argumentNodes: Record<string, ArgumentNode>, variableDefinitionsMap: Record<string, VariableDefinitionNode>, variableValues: Record<string, any>, argName: string, varName: string, type: GraphQLInputType, value: any): void;
3
- export declare function createVariableNameGenerator(variableDefinitionMap: Record<string, VariableDefinitionNode>): (argName: string) => string;
@@ -1,9 +0,0 @@
1
- import { GraphQLSchema, GraphQLError, ValidationContext, ASTVisitor } from 'graphql';
2
- import { Source } from './loaders';
3
- export declare type ValidationRule = (context: ValidationContext) => ASTVisitor;
4
- export interface LoadDocumentError {
5
- readonly filePath?: string;
6
- readonly errors: ReadonlyArray<GraphQLError>;
7
- }
8
- export declare function validateGraphQlDocuments(schema: GraphQLSchema, documentFiles: Source[], effectiveRules?: ValidationRule[]): Promise<ReadonlyArray<LoadDocumentError>>;
9
- export declare function checkValidationErrors(loadDocumentErrors: ReadonlyArray<LoadDocumentError>): void | never;
@@ -1 +0,0 @@
1
- export declare function valueMatchesCriteria(value: any, criteria: any): boolean;
@@ -1,15 +0,0 @@
1
- import { GraphQLSchema, GraphQLError } from 'graphql';
2
- import { ExecutionRequest, ExecutionResult } from './Interfaces';
3
- export declare type ValueVisitor = (value: any) => any;
4
- export declare type ObjectValueVisitor = {
5
- __enter?: ValueVisitor;
6
- __leave?: ValueVisitor;
7
- } & Record<string, ValueVisitor>;
8
- export declare type ResultVisitorMap = Record<string, ValueVisitor | ObjectValueVisitor>;
9
- export declare type ErrorVisitor = (error: GraphQLError, pathIndex: number) => GraphQLError;
10
- export declare type ErrorVisitorMap = {
11
- __unpathed?: (error: GraphQLError) => GraphQLError;
12
- } & Record<string, Record<string, ErrorVisitor>>;
13
- export declare function visitData(data: any, enter?: ValueVisitor, leave?: ValueVisitor): any;
14
- export declare function visitErrors(errors: ReadonlyArray<GraphQLError>, visitor: (error: GraphQLError) => GraphQLError): Array<GraphQLError>;
15
- export declare function visitResult(result: ExecutionResult, request: ExecutionRequest, schema: GraphQLSchema, resultVisitorMap?: ResultVisitorMap, errorVisitorMap?: ErrorVisitorMap): any;
@@ -1,3 +0,0 @@
1
- export declare function withCancel<T>(asyncIteratorLike: {
2
- [Symbol.asyncIterator](): AsyncIterator<T>;
3
- }, onCancel: () => void): AsyncIterator<T | undefined>;