UNPKG

@worktif/purews

Version:

Work TIF TypeScript-based AWS infrastructure toolkit featuring DynamoDB integration, AppSync support, SES functionality, and GraphQL capabilities with comprehensive audit logging and AWS Signature V4 authentication.

18 lines (17 loc) 801 B
import 'reflect-metadata'; import { z } from 'zod'; /** * Middleware to validate the incoming request body against a Zod schema. * * This middleware uses a Zod schema to validate the `body` property of the incoming request. * If validation is successful, the parsed body replaces the provided `body`. * If validation fails, an appropriate error response is returned, and the handler is terminated. * * @param {z.ZodSchema<any>} schema - The Zod schema used for validating the input data. * @returns {Object} Middleware object with a `before` hook for request validation. * * @todo Extend validation to include query parameters, headers, and other request components. */ export declare const zodValidationMiddleware: <T>(schema: z.ZodSchema<any>) => { before: (handler: any) => void; };