UNPKG

@cran/lib.gql.core

Version:

GQL Core Functionality

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