UNPKG

@pothos/plugin-zod

Version:

A Pothos plugin for adding argument validation

18 lines (17 loc) 1.2 kB
import './global-types.js'; import { BasePlugin, type PothosInputFieldConfig, type PothosInputFieldType, type PothosOutputFieldConfig, type SchemaTypes } from '@pothos/core'; import type { GraphQLFieldResolver } from 'graphql'; import * as zod from 'zod'; import type { RefineConstraint, ValidationOptionUnion } from './types.js'; export * from './types.js'; declare const pluginName = "zod"; export declare class PothosZodPlugin<Types extends SchemaTypes> extends BasePlugin<Types> { inputFieldValidators: Map<string, Record<string, zod.ZodType<unknown, zod.ZodTypeDef, unknown>>>; onInputFieldConfig(fieldConfig: PothosInputFieldConfig<Types>): PothosInputFieldConfig<Types>; private mappingCache; wrapResolve(resolver: GraphQLFieldResolver<unknown, Types["Context"], object>, fieldConfig: PothosOutputFieldConfig<Types>): GraphQLFieldResolver<unknown, Types["Context"], object>; createValidator(optionsOrConstraint: RefineConstraint | ValidationOptionUnion | undefined, type: PothosInputFieldType<Types> | null, fieldName: string): zod.ZodTypeAny; } export default pluginName; export { default as createZodSchema } from './createZodSchema.js'; //# sourceMappingURL=index.d.ts.map