UNPKG

rex-server

Version:

Rex Server is a Node.js-based reverse proxy server available as an npm package. It allows you to handle HTTP and HTTPS traffic, route requests to upstream servers, and manage worker processes efficiently. With its CLI interface, Rex makes it easy to confi

104 lines (103 loc) 3.12 kB
import { z } from 'zod'; /** * Schema for validating a Node.js error object. * * This schema defines the structure of a Node.js error object, which can include various properties such as: * - `code`: A string representing the error code. * - `errno`: An optional number representing the error number. * - `syscall`: An optional string representing the system call that failed. * - `message`: An optional string containing the error message. * - `stack`: An optional string containing the stack trace. * - `port`: An optional number representing the port that caused the error (if applicable). * - `path`: An optional string representing the file path related to the error. * - `address`: An optional string or null representing the address associated with the error. * * @example * const error = { * code: "EADDRINUSE", * message: "Address already in use", * port: 8080 * }; * const parsedError = ErrorSchema.parse(error); */ export declare const ErrorSchema: z.ZodObject<{ /** * The error code (e.g., "EADDRINUSE"). * * @type {string} */ code: z.ZodString; /** * The error number, if available. * * @type {number | undefined} */ errno: z.ZodOptional<z.ZodNumber>; /** * The system call that failed, if available. * * @type {string | undefined} */ syscall: z.ZodOptional<z.ZodString>; /** * The error message, if available. * * @type {string | undefined} */ message: z.ZodOptional<z.ZodString>; /** * The stack trace, if available. * * @type {string | undefined} */ stack: z.ZodOptional<z.ZodString>; /** * The port that caused the error, if applicable. * * @type {number | undefined} */ port: z.ZodOptional<z.ZodNumber>; /** * The file path related to the error, if available. * * @type {string | undefined} */ path: z.ZodOptional<z.ZodString>; /** * The address associated with the error, which could be a string or null. * * @type {string | null | undefined} */ address: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>; }, "strip", z.ZodTypeAny, { code: string; path?: string | undefined; message?: string | undefined; port?: number | undefined; errno?: number | undefined; syscall?: string | undefined; stack?: string | undefined; address?: string | null | undefined; }, { code: string; path?: string | undefined; message?: string | undefined; port?: number | undefined; errno?: number | undefined; syscall?: string | undefined; stack?: string | undefined; address?: string | null | undefined; }>; /** * Type representing a Node.js error object as inferred from the `ErrorSchema`. * * This type is automatically inferred from the `ErrorSchema` and represents the shape of a valid Node.js error object. * * @example * const error: NodeJsErr = { * code: "EADDRINUSE", * message: "Address already in use", * port: 8080 * }; */ export type NodeJsErr = z.infer<typeof ErrorSchema>;