UNPKG

@graphql-codegen/named-operations-object

Version:

GraphQL Code Generator plugin for generating an enum with all loaded operations, for simpler and type-safe access

31 lines (30 loc) 902 B
import { PluginFunction } from '@graphql-codegen/plugin-helpers'; export interface NamedOperationsObjectPluginConfig { /** * @description Allow you to customize the name of the exported identifier * @default namedOperations * * @exampleMarkdown * ```yaml * generates: * path/to/file.ts: * plugins: * - typescript * - named-operations-object * config: * identifierName: ListAllOperations * ``` */ identifierName?: string; /** * @description Will generate a const string instead of regular string. * @default false */ useConsts?: boolean; /** * @description Throws an error if a duplicate operation name is found. * @default false */ throwOnDuplicate?: boolean; } export declare const plugin: PluginFunction<NamedOperationsObjectPluginConfig, string>;