UNPKG

@graphql-inspector/core

Version:

Tooling for GraphQL. Compare GraphQL Schemas, check documents, find breaking changes, find similar types.

369 lines (368 loc) • 15.1 kB
import { ConstDirectiveNode, GraphQLArgument, GraphQLEnumType, GraphQLEnumValue, GraphQLField, GraphQLInputField, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLObjectType, GraphQLScalarType, GraphQLSchema, GraphQLUnionType, Kind } from 'graphql'; import { Change, CriticalityLevel, DirectiveUsageArgumentDefinitionChange, DirectiveUsageArgumentDefinitionRemovedChange, DirectiveUsageEnumAddedChange, DirectiveUsageEnumRemovedChange, DirectiveUsageEnumValueAddedChange, DirectiveUsageEnumValueRemovedChange, DirectiveUsageFieldDefinitionAddedChange, DirectiveUsageFieldDefinitionRemovedChange, DirectiveUsageInputFieldDefinitionAddedChange, DirectiveUsageInputFieldDefinitionRemovedChange, DirectiveUsageInputObjectAddedChange, DirectiveUsageInputObjectRemovedChange, DirectiveUsageInterfaceAddedChange, DirectiveUsageInterfaceRemovedChange, DirectiveUsageObjectAddedChange, DirectiveUsageObjectRemovedChange, DirectiveUsageScalarAddedChange, DirectiveUsageScalarRemovedChange, DirectiveUsageSchemaAddedChange, DirectiveUsageSchemaRemovedChange, DirectiveUsageUnionMemberAddedChange, DirectiveUsageUnionMemberRemovedChange } from './change.cjs'; type KindToPayload = { [Kind.ENUM_TYPE_DEFINITION]: { input: GraphQLEnumType; change: DirectiveUsageEnumAddedChange | DirectiveUsageEnumRemovedChange; }; [Kind.FIELD_DEFINITION]: { input: { field: GraphQLField<any, any, any>; parentType: GraphQLInterfaceType | GraphQLObjectType<any, any>; }; change: DirectiveUsageFieldDefinitionAddedChange | DirectiveUsageFieldDefinitionRemovedChange; }; [Kind.UNION_TYPE_DEFINITION]: { input: GraphQLUnionType; change: DirectiveUsageUnionMemberAddedChange | DirectiveUsageUnionMemberRemovedChange; }; [Kind.ENUM_VALUE_DEFINITION]: { input: { type: GraphQLEnumType; value: GraphQLEnumValue; }; change: DirectiveUsageEnumValueAddedChange | DirectiveUsageEnumValueRemovedChange; }; [Kind.SCHEMA_DEFINITION]: { input: GraphQLSchema; change: DirectiveUsageSchemaAddedChange | DirectiveUsageSchemaRemovedChange; }; [Kind.SCALAR_TYPE_DEFINITION]: { input: GraphQLScalarType; change: DirectiveUsageScalarAddedChange | DirectiveUsageScalarRemovedChange; }; [Kind.OBJECT]: { input: GraphQLObjectType; change: DirectiveUsageObjectAddedChange | DirectiveUsageObjectRemovedChange; }; [Kind.INTERFACE_TYPE_DEFINITION]: { input: GraphQLInterfaceType; change: DirectiveUsageInterfaceAddedChange | DirectiveUsageInterfaceRemovedChange; }; [Kind.INPUT_OBJECT_TYPE_DEFINITION]: { input: GraphQLInputObjectType; change: DirectiveUsageInputObjectAddedChange | DirectiveUsageInputObjectRemovedChange; }; [Kind.INPUT_VALUE_DEFINITION]: { input: { field: GraphQLInputField; type: GraphQLInputObjectType; }; change: DirectiveUsageArgumentDefinitionChange | DirectiveUsageArgumentDefinitionRemovedChange; }; [Kind.ARGUMENT]: { input: { field: GraphQLField<any, any, any>; type: GraphQLObjectType | GraphQLInterfaceType; argument: GraphQLArgument; }; change: DirectiveUsageArgumentDefinitionChange | DirectiveUsageArgumentDefinitionRemovedChange; }; }; export declare function directiveUsageArgumentDefinitionAddedFromMeta(args: DirectiveUsageArgumentDefinitionChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was added to argument '${string}'`; }; readonly type: "DIRECTIVE_USAGE_ARGUMENT_DEFINITION_ADDED"; readonly message: string; readonly path: string; readonly meta: { typeName: string; fieldName: string; argumentName: string; addedDirectiveName: string; }; }; export declare function directiveUsageArgumentDefinitionRemovedFromMeta(args: DirectiveUsageArgumentDefinitionRemovedChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was removed from argument '${string}'`; }; readonly type: "DIRECTIVE_USAGE_ARGUMENT_DEFINITION_REMOVED"; readonly message: string; readonly path: string; readonly meta: { typeName: string; fieldName: string; argumentName: string; removedDirectiveName: string; }; }; export declare function directiveUsageInputObjectAddedFromMeta(args: DirectiveUsageInputObjectAddedChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was added to input object '${string}'`; }; readonly type: "DIRECTIVE_USAGE_INPUT_OBJECT_ADDED"; readonly message: string; readonly path: string; readonly meta: { inputObjectName: string; addedInputFieldName: string; isAddedInputFieldTypeNullable: boolean; addedInputFieldType: string; addedDirectiveName: string; }; }; export declare function directiveUsageInputObjectRemovedFromMeta(args: DirectiveUsageInputObjectRemovedChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was removed from input object '${string}'`; }; readonly type: "DIRECTIVE_USAGE_INPUT_OBJECT_REMOVED"; readonly message: string; readonly path: string; readonly meta: { inputObjectName: string; removedInputFieldName: string; isRemovedInputFieldTypeNullable: boolean; removedInputFieldType: string; removedDirectiveName: string; }; }; export declare function directiveUsageInterfaceAddedFromMeta(args: DirectiveUsageInterfaceAddedChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was added to interface '${string}'`; }; readonly type: "DIRECTIVE_USAGE_INTERFACE_ADDED"; readonly message: string; readonly path: string; readonly meta: { interfaceName: string; addedDirectiveName: string; }; }; export declare function directiveUsageInterfaceRemovedFromMeta(args: DirectiveUsageInterfaceRemovedChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was removed from interface '${string}'`; }; readonly type: "DIRECTIVE_USAGE_INTERFACE_REMOVED"; readonly message: string; readonly path: string; readonly meta: { interfaceName: string; removedDirectiveName: string; }; }; export declare function directiveUsageInputFieldDefinitionAddedFromMeta(args: DirectiveUsageInputFieldDefinitionAddedChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was added to input field '${string}'`; }; readonly type: "DIRECTIVE_USAGE_INPUT_FIELD_DEFINITION_ADDED"; readonly message: string; readonly path: string; readonly meta: { inputObjectName: string; inputFieldName: string; addedDirectiveName: string; }; }; export declare function directiveUsageInputFieldDefinitionRemovedFromMeta(args: DirectiveUsageInputFieldDefinitionRemovedChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was removed from input field '${string}'`; }; readonly type: "DIRECTIVE_USAGE_INPUT_FIELD_DEFINITION_REMOVED"; readonly message: string; readonly path: string; readonly meta: { inputObjectName: string; inputFieldName: string; removedDirectiveName: string; }; }; export declare function directiveUsageObjectAddedFromMeta(args: DirectiveUsageObjectAddedChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was added to object '${string}'`; }; readonly type: "DIRECTIVE_USAGE_OBJECT_ADDED"; readonly message: string; readonly path: string; readonly meta: { objectName: string; addedDirectiveName: string; }; }; export declare function directiveUsageObjectRemovedFromMeta(args: DirectiveUsageObjectRemovedChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was removed from object '${string}'`; }; readonly type: "DIRECTIVE_USAGE_OBJECT_REMOVED"; readonly message: string; readonly path: string; readonly meta: { objectName: string; removedDirectiveName: string; }; }; export declare function directiveUsageEnumAddedFromMeta(args: DirectiveUsageEnumAddedChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was added to enum '${string}'`; }; readonly type: "DIRECTIVE_USAGE_ENUM_ADDED"; readonly message: string; readonly path: string; readonly meta: { enumName: string; addedDirectiveName: string; }; }; export declare function directiveUsageEnumRemovedFromMeta(args: DirectiveUsageEnumRemovedChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was removed from enum '${string}'`; }; readonly type: "DIRECTIVE_USAGE_ENUM_REMOVED"; readonly message: string; readonly path: string; readonly meta: { enumName: string; removedDirectiveName: string; }; }; export declare function directiveUsageFieldDefinitionAddedFromMeta(args: DirectiveUsageFieldDefinitionAddedChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was added to field '${string}'`; }; readonly type: "DIRECTIVE_USAGE_FIELD_DEFINITION_ADDED"; readonly message: string; readonly path: string; readonly meta: { typeName: string; fieldName: string; addedDirectiveName: string; }; }; export declare function directiveUsageFieldDefinitionRemovedFromMeta(args: DirectiveUsageFieldDefinitionRemovedChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was removed from field '${string}'`; }; readonly type: "DIRECTIVE_USAGE_FIELD_DEFINITION_REMOVED"; readonly message: string; readonly path: string; readonly meta: { typeName: string; fieldName: string; removedDirectiveName: string; }; }; export declare function directiveUsageEnumValueAddedFromMeta(args: DirectiveUsageEnumValueAddedChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was added to enum value '${string}.${string}'`; }; readonly type: "DIRECTIVE_USAGE_ENUM_VALUE_ADDED"; readonly message: string; readonly path: string; readonly meta: { enumName: string; enumValueName: string; addedDirectiveName: string; }; }; export declare function directiveUsageEnumValueRemovedFromMeta(args: DirectiveUsageEnumValueRemovedChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was removed from enum value '${string}.${string}'`; }; readonly type: "DIRECTIVE_USAGE_ENUM_VALUE_REMOVED"; readonly message: string; readonly path: string; readonly meta: { enumName: string; enumValueName: string; removedDirectiveName: string; }; }; export declare function directiveUsageSchemaAddedFromMeta(args: DirectiveUsageSchemaAddedChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was added to schema '${string}'`; }; readonly type: "DIRECTIVE_USAGE_SCHEMA_ADDED"; readonly message: string; readonly path: string; readonly meta: { addedDirectiveName: string; schemaTypeName: string; }; }; export declare function directiveUsageSchemaRemovedFromMeta(args: DirectiveUsageSchemaRemovedChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was removed from schema '${string}'`; }; readonly type: "DIRECTIVE_USAGE_SCHEMA_REMOVED"; readonly message: string; readonly path: string; readonly meta: { removedDirectiveName: string; schemaTypeName: string; }; }; export declare function directiveUsageScalarAddedFromMeta(args: DirectiveUsageScalarAddedChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was added to scalar '${string}'`; }; readonly type: "DIRECTIVE_USAGE_SCALAR_ADDED"; readonly message: string; readonly path: string; readonly meta: { scalarName: string; addedDirectiveName: string; }; }; export declare function directiveUsageScalarRemovedFromMeta(args: DirectiveUsageScalarRemovedChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was removed from scalar '${string}'`; }; readonly type: "DIRECTIVE_USAGE_SCALAR_REMOVED"; readonly message: string; readonly path: string; readonly meta: { scalarName: string; removedDirectiveName: string; }; }; export declare function directiveUsageUnionMemberAddedFromMeta(args: DirectiveUsageUnionMemberAddedChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was added to union member '${string}.${string}'`; }; readonly type: "DIRECTIVE_USAGE_UNION_MEMBER_ADDED"; readonly message: string; readonly path: string; readonly meta: { unionName: string; addedUnionMemberTypeName: string; addedDirectiveName: string; }; }; export declare function directiveUsageUnionMemberRemovedFromMeta(args: DirectiveUsageUnionMemberRemovedChange): { readonly criticality: { readonly level: CriticalityLevel; readonly reason: `Directive '${string}' was removed from union member '${string}.${string}'`; }; readonly type: "DIRECTIVE_USAGE_UNION_MEMBER_REMOVED"; readonly message: string; readonly path: string; readonly meta: { unionName: string; removedUnionMemberTypeName: string; removedDirectiveName: string; }; }; export declare function directiveUsageAdded<K extends keyof KindToPayload>(kind: K, directive: ConstDirectiveNode, payload: KindToPayload[K]['input']): Change; export declare function directiveUsageRemoved<K extends keyof KindToPayload>(kind: K, directive: ConstDirectiveNode, payload: KindToPayload[K]['input']): Change; export {};