@pothos/plugin-zod
Version:
A Pothos plugin for adding argument validation
17 lines • 1.22 kB
TypeScript
import './global-types';
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';
export * from './types';
declare const pluginName = "zod";
export declare class PothosZodPlugin<Types extends SchemaTypes> extends BasePlugin<Types> {
inputFieldValidators: Map<string, Record<string, zod.ZodType<unknown, unknown, zod.z.core.$ZodTypeInternals<unknown, 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.ZodType;
}
export default pluginName;
export { default as createZodSchema } from './createZodSchema';
//# sourceMappingURL=index.d.ts.map