UNPKG

@cran/gql.core

Version:

Cran/GraphQL Core Utilities

15 lines (14 loc) 1.18 kB
import type { Plugin } from "../plugins/Plugin"; import type { SchemaMapper } from "@graphql-tools/utils"; import { MapperKind, getDirective } from "@graphql-tools/utils"; export declare type DirectableGraphQLObject = Parameters<typeof getDirective>[1]; export declare type SchemaMapperType<Kind extends MapperKind | null = null> = Parameters<NonNullable<Kind extends MapperKind ? SchemaMapper[Kind] : SchemaMapper[keyof SchemaMapper]>>[0]; export declare type SchemaMapperTypes = { [Kind in MapperKind]: SchemaMapperType<Kind>; }; export declare type SchemaMapperArgs<Kind extends MapperKind | null = null> = Parameters<NonNullable<Kind extends MapperKind ? SchemaMapper[Kind] : SchemaMapper[keyof SchemaMapper]>>; export declare type SchemaMapperFunction<Kind extends MapperKind | null = null> = (directives: Array<Record<string, unknown>>, ...original: SchemaMapperArgs<Kind>) => void | null | undefined | SchemaMapperType<Kind>; export declare type SchemaMapperExtended = { [Kind in MapperKind]: SchemaMapperFunction<Kind>; }; export declare function createDirective(name: string, args: Record<string, string>, mapper: Partial<SchemaMapperExtended>): Plugin<any>;