express-zod-api 16.1.0 → 16.2.0-beta2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -3,15 +3,39 @@ import express, { Request, Response, NextFunction, RequestHandler, IRouter } fro
3
3
  import fileUpload, { UploadedFile } from 'express-fileupload';
4
4
  import https, { ServerOptions } from 'node:https';
5
5
  import { z, ZodTypeDef, ZodType, ParseInput, ParseReturnType, ZodError } from 'zod';
6
- import { HttpError } from 'http-errors';
7
6
  import Winston from 'winston';
7
+ import { HttpError } from 'http-errors';
8
8
  import { ListenOptions } from 'node:net';
9
9
  import * as qs from 'qs';
10
10
  import * as express_serve_static_core from 'express-serve-static-core';
11
11
  import http from 'node:http';
12
- import { ReferenceObject, SchemaObject, OpenApiBuilder, SecuritySchemeType, SecuritySchemeObject } from 'openapi3-ts/oas31';
12
+ import { OpenApiBuilder, SecuritySchemeType, SchemaObject, ReferenceObject, SecuritySchemeObject } from 'openapi3-ts/oas31';
13
13
  import ts from 'typescript';
14
14
 
15
+ interface ApiResponse<S extends z.ZodTypeAny> {
16
+ schema: S;
17
+ /**
18
+ * @default 200 for a positive response
19
+ * @default 400 for a negative response
20
+ * @override statusCodes
21
+ * */
22
+ statusCode?: number;
23
+ /**
24
+ * @default [200] for positive response
25
+ * @default [400] for negative response
26
+ * */
27
+ statusCodes?: [number, ...number[]];
28
+ /**
29
+ * @default "application/json"
30
+ * @override mimeTypes
31
+ * */
32
+ mimeType?: string;
33
+ /** @default [ "application/json" ] */
34
+ mimeTypes?: [string, ...string[]];
35
+ }
36
+ type NormalizedResponse = Required<Pick<ApiResponse<z.ZodTypeAny>, "schema" | "statusCodes" | "mimeTypes">>;
37
+ type AnyResponseDefinition = z.ZodTypeAny | ApiResponse<z.ZodTypeAny> | ApiResponse<z.ZodTypeAny>[];
38
+
15
39
  type LogicalOr<T> = {
16
40
  or: T[];
17
41
  };
@@ -182,112 +206,6 @@ type WithMeta<T extends z.ZodTypeAny> = T & {
182
206
  };
183
207
  declare const withMeta: <T extends z.ZodTypeAny>(schema: T) => WithMeta<T>;
184
208
 
185
- interface ApiResponse<S extends z.ZodTypeAny> {
186
- schema: S;
187
- /**
188
- * @default 200 for a positive response
189
- * @default 400 for a negative response
190
- * */
191
- statusCode?: number;
192
- /**
193
- * @default "application/json"
194
- * @override mimeTypes
195
- * */
196
- mimeType?: string;
197
- /** @default [ "application/json" ] */
198
- mimeTypes?: [string, ...string[]];
199
- }
200
-
201
- declare const zodDateInKind = "ZodDateIn";
202
- interface ZodDateInDef extends ZodTypeDef {
203
- typeName: typeof zodDateInKind;
204
- }
205
- declare class ZodDateIn extends ZodType<Date, ZodDateInDef, string> {
206
- _parse(input: ParseInput): ParseReturnType<Date>;
207
- static create: () => ZodDateIn;
208
- }
209
-
210
- declare const zodDateOutKind = "ZodDateOut";
211
- interface ZodDateOutDef extends ZodTypeDef {
212
- typeName: typeof zodDateOutKind;
213
- }
214
- declare class ZodDateOut extends ZodType<string, ZodDateOutDef, Date> {
215
- _parse(input: ParseInput): ParseReturnType<string>;
216
- static create: () => ZodDateOut;
217
- }
218
-
219
- declare const zodFileKind = "ZodFile";
220
- interface ZodFileDef<T extends string | Buffer = string | Buffer> extends ZodTypeDef {
221
- typeName: typeof zodFileKind;
222
- type: T;
223
- encoding?: "binary" | "base64";
224
- message?: string;
225
- }
226
- declare class ZodFile<T extends string | Buffer = string | Buffer> extends ZodType<T, ZodFileDef<T>, T> {
227
- _parse(input: ParseInput): ParseReturnType<T>;
228
- string: (message?: ErrMessage) => ZodFile<string>;
229
- buffer: (message?: ErrMessage) => ZodFile<Buffer>;
230
- binary: (message?: ErrMessage) => ZodFile<T>;
231
- base64: (message?: ErrMessage) => ZodFile<T>;
232
- get isBinary(): boolean;
233
- get isBase64(): boolean;
234
- get isString(): boolean;
235
- get isBuffer(): boolean;
236
- static create: () => ZodFile<string>;
237
- }
238
-
239
- declare const zodUploadKind = "ZodUpload";
240
- interface ZodUploadDef extends ZodTypeDef {
241
- typeName: typeof zodUploadKind;
242
- }
243
- declare class ZodUpload extends ZodType<UploadedFile, ZodUploadDef> {
244
- _parse(input: ParseInput): ParseReturnType<UploadedFile>;
245
- static create: () => ZodUpload;
246
- }
247
-
248
- interface OpenAPIContext extends FlatObject {
249
- isResponse: boolean;
250
- serializer: (schema: z.ZodTypeAny) => string;
251
- getRef: (name: string) => ReferenceObject | undefined;
252
- makeRef: (name: string, schema: SchemaObject | ReferenceObject) => ReferenceObject;
253
- path: string;
254
- method: Method;
255
- }
256
-
257
- /** @desc An error related to the wrong Routing declaration */
258
- declare class RoutingError extends Error {
259
- name: string;
260
- }
261
- /**
262
- * @desc An error related to the generating of the documentation
263
- * */
264
- declare class DocumentationError extends Error {
265
- name: string;
266
- constructor({ message, method, path, isResponse, }: {
267
- message: string;
268
- } & Pick<OpenAPIContext, "path" | "method" | "isResponse">);
269
- }
270
- /** @desc An error related to the input and output schemas declaration */
271
- declare class IOSchemaError extends Error {
272
- name: string;
273
- }
274
- /** @desc An error of validating the Endpoint handler's returns against the Endpoint output schema */
275
- declare class OutputValidationError extends IOSchemaError {
276
- name: string;
277
- readonly originalError: ZodError;
278
- constructor(originalError: ZodError);
279
- }
280
- /** @desc An error of validating the input sources against the Middleware or Endpoint input schema */
281
- declare class InputValidationError extends IOSchemaError {
282
- name: string;
283
- readonly originalError: ZodError;
284
- constructor(originalError: ZodError);
285
- }
286
- declare class MissingPeerError extends Error {
287
- name: string;
288
- constructor(module: string | string[]);
289
- }
290
-
291
209
  interface ResultHandlerParams<RES> {
292
210
  /** null in case of failure to parse or to find the matching endpoint (error: not found) */
293
211
  input: FlatObject | null;
@@ -299,13 +217,14 @@ interface ResultHandlerParams<RES> {
299
217
  logger: AbstractLogger;
300
218
  }
301
219
  type ResultHandler<RES> = (params: ResultHandlerParams<RES>) => void | Promise<void>;
302
- interface ResultHandlerDefinition<POS extends z.ZodTypeAny, NEG extends z.ZodTypeAny> {
303
- getPositiveResponse: (output: IOSchema) => POS | ApiResponse<POS>;
304
- getNegativeResponse: () => NEG | ApiResponse<NEG>;
305
- handler: ResultHandler<z.output<POS> | z.output<NEG>>;
306
- }
307
- type AnyResultHandlerDefinition = ResultHandlerDefinition<z.ZodTypeAny, z.ZodTypeAny>;
308
- declare const createResultHandler: <POS extends z.ZodTypeAny, NEG extends z.ZodTypeAny>(definition: ResultHandlerDefinition<POS, NEG>) => ResultHandlerDefinition<POS, NEG>;
220
+ type ExtractSchema<T extends AnyResponseDefinition> = T extends ApiResponse<infer S>[] ? S : T extends ApiResponse<infer S> ? S : T extends z.ZodTypeAny ? T : never;
221
+ interface ResultHandlerDefinition<POS extends AnyResponseDefinition, NEG extends AnyResponseDefinition> {
222
+ getPositiveResponse: (output: IOSchema) => POS;
223
+ getNegativeResponse: () => NEG;
224
+ handler: ResultHandler<z.output<ExtractSchema<POS>> | z.output<ExtractSchema<NEG>>>;
225
+ }
226
+ type AnyResultHandlerDefinition = ResultHandlerDefinition<AnyResponseDefinition, AnyResponseDefinition>;
227
+ declare function createResultHandler<POS extends AnyResponseDefinition, NEG extends AnyResponseDefinition>(definition: ResultHandlerDefinition<POS, NEG>): ResultHandlerDefinition<POS, NEG>;
309
228
  declare const defaultResultHandler: ResultHandlerDefinition<z.ZodObject<{
310
229
  status: z.ZodLiteral<"success">;
311
230
  data: IOSchema;
@@ -451,21 +370,21 @@ declare abstract class AbstractEndpoint {
451
370
  abstract getSchema(variant: IOVariant): IOSchema;
452
371
  abstract getSchema(variant: ResponseVariant): z.ZodTypeAny;
453
372
  abstract getMimeTypes(variant: MimeVariant): string[];
454
- abstract getStatusCode(variant: ResponseVariant): number;
373
+ abstract getResponses(variant: ResponseVariant): NormalizedResponse[];
455
374
  abstract getSecurity(): LogicalContainer<Security>;
456
375
  abstract getScopes(): string[];
457
376
  abstract getTags(): string[];
458
377
  abstract _setSiblingMethods(methods: Method[]): void;
459
378
  abstract getOperationId(method: Method): string | undefined;
460
379
  }
461
- declare class Endpoint<IN extends IOSchema, OUT extends IOSchema, OPT extends FlatObject, POS extends z.ZodTypeAny, NEG extends z.ZodTypeAny, SCO extends string, TAG extends string> extends AbstractEndpoint {
380
+ declare class Endpoint<IN extends IOSchema, OUT extends IOSchema, OPT extends FlatObject, SCO extends string, TAG extends string> extends AbstractEndpoint {
462
381
  #private;
463
382
  constructor({ methods, inputSchema, outputSchema, handler, resultHandler, getOperationId, scopes, middlewares, tags, description: long, shortDescription: short, }: {
464
383
  middlewares?: AnyMiddlewareDef[];
465
384
  inputSchema: IN;
466
385
  outputSchema: OUT;
467
386
  handler: Handler<z.output<IN>, z.input<OUT>, OPT>;
468
- resultHandler: ResultHandlerDefinition<POS, NEG>;
387
+ resultHandler: AnyResultHandlerDefinition;
469
388
  description?: string;
470
389
  shortDescription?: string;
471
390
  getOperationId?: (method: Method) => string | undefined;
@@ -482,10 +401,9 @@ declare class Endpoint<IN extends IOSchema, OUT extends IOSchema, OPT extends Fl
482
401
  getMethods(): Method[];
483
402
  getSchema(variant: "input"): IN;
484
403
  getSchema(variant: "output"): OUT;
485
- getSchema(variant: "positive"): POS;
486
- getSchema(variant: "negative"): NEG;
404
+ getSchema(variant: ResponseVariant): z.ZodTypeAny;
487
405
  getMimeTypes(variant: MimeVariant): string[];
488
- getStatusCode(variant: ResponseVariant): number;
406
+ getResponses(variant: ResponseVariant): Required<Pick<ApiResponse<z.ZodTypeAny>, "schema" | "statusCodes" | "mimeTypes">>[];
489
407
  getSecurity(): LogicalContainer<Security>;
490
408
  getScopes(): SCO[];
491
409
  getTags(): TAG[];
@@ -617,145 +535,29 @@ type BuildProps<IN extends IOSchema, OUT extends IOSchema, MIN extends IOSchema<
617
535
  } | {
618
536
  tag?: TAG;
619
537
  });
620
- declare class EndpointsFactory<POS extends z.ZodTypeAny, NEG extends z.ZodTypeAny, IN extends IOSchema<"strip"> | null = null, OUT extends FlatObject = {}, SCO extends string = string, TAG extends string = string> {
538
+ declare class EndpointsFactory<IN extends IOSchema<"strip"> | null = null, OUT extends FlatObject = {}, SCO extends string = string, TAG extends string = string> {
621
539
  #private;
622
- protected resultHandler: ResultHandlerDefinition<POS, NEG>;
540
+ protected resultHandler: AnyResultHandlerDefinition;
623
541
  protected middlewares: AnyMiddlewareDef[];
624
542
  /** @desc Consider using the "config" prop with the "tags" option to enforce constraints on tagging the endpoints */
625
- constructor(resultHandler: ResultHandlerDefinition<POS, NEG>);
543
+ constructor(resultHandler: AnyResultHandlerDefinition);
626
544
  constructor(params: {
627
- resultHandler: ResultHandlerDefinition<POS, NEG>;
545
+ resultHandler: AnyResultHandlerDefinition;
628
546
  config?: CommonConfig<TAG>;
629
547
  });
630
- addMiddleware<AIN extends IOSchema<"strip">, AOUT extends FlatObject, ASCO extends string>(subject: MiddlewareDefinition<AIN, OUT, AOUT, ASCO>): EndpointsFactory<POS, NEG, ProbableIntersection<IN, AIN>, OUT & AOUT, SCO & ASCO, TAG>;
631
- use: <R extends Request<express_serve_static_core.ParamsDictionary, any, any, qs.ParsedQs, Record<string, any>>, S extends Response<any, Record<string, any>>, AOUT extends FlatObject = {}>(middleware: ExpressMiddleware<R, S>, features?: ExpressMiddlewareFeatures<R, S, AOUT> | undefined) => EndpointsFactory<POS, NEG, IN, OUT & AOUT, SCO, TAG>;
632
- addExpressMiddleware<R extends Request, S extends Response, AOUT extends FlatObject = {}>(middleware: ExpressMiddleware<R, S>, features?: ExpressMiddlewareFeatures<R, S, AOUT>): EndpointsFactory<POS, NEG, IN, OUT & AOUT, SCO, TAG>;
633
- addOptions<AOUT extends FlatObject>(options: AOUT): EndpointsFactory<POS, NEG, IN, OUT & AOUT, SCO, TAG>;
634
- build<BIN extends IOSchema, BOUT extends IOSchema>({ input, handler, output: outputSchema, description, shortDescription, operationId, ...rest }: BuildProps<BIN, BOUT, IN, OUT, SCO, TAG>): Endpoint<ProbableIntersection<IN, BIN>, BOUT, OUT, POS, NEG, SCO, TAG>;
548
+ addMiddleware<AIN extends IOSchema<"strip">, AOUT extends FlatObject, ASCO extends string>(subject: MiddlewareDefinition<AIN, OUT, AOUT, ASCO>): EndpointsFactory<ProbableIntersection<IN, AIN>, OUT & AOUT, SCO & ASCO, TAG>;
549
+ use: <R extends Request<express_serve_static_core.ParamsDictionary, any, any, qs.ParsedQs, Record<string, any>>, S extends Response<any, Record<string, any>>, AOUT extends FlatObject = {}>(middleware: ExpressMiddleware<R, S>, features?: ExpressMiddlewareFeatures<R, S, AOUT> | undefined) => EndpointsFactory<IN, OUT & AOUT, SCO, TAG>;
550
+ addExpressMiddleware<R extends Request, S extends Response, AOUT extends FlatObject = {}>(middleware: ExpressMiddleware<R, S>, features?: ExpressMiddlewareFeatures<R, S, AOUT>): EndpointsFactory<IN, OUT & AOUT, SCO, TAG>;
551
+ addOptions<AOUT extends FlatObject>(options: AOUT): EndpointsFactory<IN, OUT & AOUT, SCO, TAG>;
552
+ build<BIN extends IOSchema, BOUT extends IOSchema>({ input, handler, output: outputSchema, description, shortDescription, operationId, ...rest }: BuildProps<BIN, BOUT, IN, OUT, SCO, TAG>): Endpoint<ProbableIntersection<IN, BIN>, BOUT, OUT, SCO, TAG>;
635
553
  }
636
- declare const defaultEndpointsFactory: EndpointsFactory<z.ZodObject<{
637
- status: z.ZodLiteral<"success">;
638
- data: IOSchema;
639
- }, "strip", z.ZodTypeAny, {
640
- status: "success";
641
- data?: unknown;
642
- }, {
643
- status: "success";
644
- data?: unknown;
645
- }> & {
646
- _def: z.ZodObjectDef<{
647
- status: z.ZodLiteral<"success">;
648
- data: IOSchema;
649
- }, "strip", z.ZodTypeAny> & MetaDef<z.ZodObject<{
650
- status: z.ZodLiteral<"success">;
651
- data: IOSchema;
652
- }, "strip", z.ZodTypeAny, {
653
- status: "success";
654
- data?: unknown;
655
- }, {
656
- status: "success";
657
- data?: unknown;
658
- }>>;
659
- example: (example: {
660
- status: "success";
661
- data?: unknown;
662
- }) => z.ZodObject<{
663
- status: z.ZodLiteral<"success">;
664
- data: IOSchema;
665
- }, "strip", z.ZodTypeAny, {
666
- status: "success";
667
- data?: unknown;
668
- }, {
669
- status: "success";
670
- data?: unknown;
671
- }> & any;
672
- }, z.ZodObject<{
673
- status: z.ZodLiteral<"error">;
674
- error: z.ZodObject<{
675
- message: z.ZodString;
676
- }, "strip", z.ZodTypeAny, {
677
- message: string;
678
- }, {
679
- message: string;
680
- }>;
681
- }, "strip", z.ZodTypeAny, {
682
- status: "error";
683
- error: {
684
- message: string;
685
- };
686
- }, {
687
- status: "error";
688
- error: {
689
- message: string;
690
- };
691
- }> & {
692
- _def: z.ZodObjectDef<{
693
- status: z.ZodLiteral<"error">;
694
- error: z.ZodObject<{
695
- message: z.ZodString;
696
- }, "strip", z.ZodTypeAny, {
697
- message: string;
698
- }, {
699
- message: string;
700
- }>;
701
- }, "strip", z.ZodTypeAny> & MetaDef<z.ZodObject<{
702
- status: z.ZodLiteral<"error">;
703
- error: z.ZodObject<{
704
- message: z.ZodString;
705
- }, "strip", z.ZodTypeAny, {
706
- message: string;
707
- }, {
708
- message: string;
709
- }>;
710
- }, "strip", z.ZodTypeAny, {
711
- status: "error";
712
- error: {
713
- message: string;
714
- };
715
- }, {
716
- status: "error";
717
- error: {
718
- message: string;
719
- };
720
- }>>;
721
- example: (example: {
722
- status: "error";
723
- error: {
724
- message: string;
725
- };
726
- }) => z.ZodObject<{
727
- status: z.ZodLiteral<"error">;
728
- error: z.ZodObject<{
729
- message: z.ZodString;
730
- }, "strip", z.ZodTypeAny, {
731
- message: string;
732
- }, {
733
- message: string;
734
- }>;
735
- }, "strip", z.ZodTypeAny, {
736
- status: "error";
737
- error: {
738
- message: string;
739
- };
740
- }, {
741
- status: "error";
742
- error: {
743
- message: string;
744
- };
745
- }> & any;
746
- }, null, {}, string, string>;
554
+ declare const defaultEndpointsFactory: EndpointsFactory<null, {}, string, string>;
747
555
  /**
748
556
  * @deprecated Resist the urge of using it: this factory is designed only to simplify the migration of legacy APIs.
749
557
  * @desc Responding with array is a bad practice keeping your endpoints from evolving without breaking changes.
750
558
  * @desc The result handler of this factory expects your endpoint to have the property 'items' in the output schema
751
559
  */
752
- declare const arrayEndpointsFactory: EndpointsFactory<z.ZodArray<z.ZodTypeAny, "many"> & {
753
- _def: z.ZodArrayDef<z.ZodTypeAny> & MetaDef<z.ZodArray<z.ZodTypeAny, "many">>;
754
- example: (example: any[]) => z.ZodArray<z.ZodTypeAny, "many"> & any;
755
- }, z.ZodString & {
756
- _def: z.ZodStringDef & MetaDef<z.ZodString>;
757
- example: (example: string) => z.ZodString & any;
758
- }, null, {}, string, string>;
560
+ declare const arrayEndpointsFactory: EndpointsFactory<null, {}, string, string>;
759
561
 
760
562
  declare class DependsOnMethod {
761
563
  readonly endpoints: Partial<Record<Method, AbstractEndpoint>>;
@@ -787,7 +589,9 @@ declare const createServer: (config: ServerConfig, routing: Routing) => Promise<
787
589
 
788
590
  type Component = "positiveResponse" | "negativeResponse" | "requestParameter" | "requestBody";
789
591
  /** @desc user defined function that creates a component description from its properties */
790
- type Descriptor = (props: Record<"method" | "path" | "operationId", string>) => string;
592
+ type Descriptor = (props: Record<"method" | "path" | "operationId", string> & {
593
+ statusCode?: number;
594
+ }) => string;
791
595
  interface DocumentationParams {
792
596
  title: string;
793
597
  version: string;
@@ -820,6 +624,96 @@ declare class Documentation extends OpenApiBuilder {
820
624
  constructor({ routing, config, title, version, serverUrl, descriptions, hasSummaryFromDescription, composition, serializer, }: DocumentationParams);
821
625
  }
822
626
 
627
+ declare const zodDateInKind = "ZodDateIn";
628
+ interface ZodDateInDef extends ZodTypeDef {
629
+ typeName: typeof zodDateInKind;
630
+ }
631
+ declare class ZodDateIn extends ZodType<Date, ZodDateInDef, string> {
632
+ _parse(input: ParseInput): ParseReturnType<Date>;
633
+ static create: () => ZodDateIn;
634
+ }
635
+
636
+ declare const zodDateOutKind = "ZodDateOut";
637
+ interface ZodDateOutDef extends ZodTypeDef {
638
+ typeName: typeof zodDateOutKind;
639
+ }
640
+ declare class ZodDateOut extends ZodType<string, ZodDateOutDef, Date> {
641
+ _parse(input: ParseInput): ParseReturnType<string>;
642
+ static create: () => ZodDateOut;
643
+ }
644
+
645
+ declare const zodFileKind = "ZodFile";
646
+ interface ZodFileDef<T extends string | Buffer = string | Buffer> extends ZodTypeDef {
647
+ typeName: typeof zodFileKind;
648
+ type: T;
649
+ encoding?: "binary" | "base64";
650
+ message?: string;
651
+ }
652
+ declare class ZodFile<T extends string | Buffer = string | Buffer> extends ZodType<T, ZodFileDef<T>, T> {
653
+ _parse(input: ParseInput): ParseReturnType<T>;
654
+ string: (message?: ErrMessage) => ZodFile<string>;
655
+ buffer: (message?: ErrMessage) => ZodFile<Buffer>;
656
+ binary: (message?: ErrMessage) => ZodFile<T>;
657
+ base64: (message?: ErrMessage) => ZodFile<T>;
658
+ get isBinary(): boolean;
659
+ get isBase64(): boolean;
660
+ get isString(): boolean;
661
+ get isBuffer(): boolean;
662
+ static create: () => ZodFile<string>;
663
+ }
664
+
665
+ declare const zodUploadKind = "ZodUpload";
666
+ interface ZodUploadDef extends ZodTypeDef {
667
+ typeName: typeof zodUploadKind;
668
+ }
669
+ declare class ZodUpload extends ZodType<UploadedFile, ZodUploadDef> {
670
+ _parse(input: ParseInput): ParseReturnType<UploadedFile>;
671
+ static create: () => ZodUpload;
672
+ }
673
+
674
+ interface OpenAPIContext extends FlatObject {
675
+ isResponse: boolean;
676
+ serializer: (schema: z.ZodTypeAny) => string;
677
+ getRef: (name: string) => ReferenceObject | undefined;
678
+ makeRef: (name: string, schema: SchemaObject | ReferenceObject) => ReferenceObject;
679
+ path: string;
680
+ method: Method;
681
+ }
682
+
683
+ /** @desc An error related to the wrong Routing declaration */
684
+ declare class RoutingError extends Error {
685
+ name: string;
686
+ }
687
+ /**
688
+ * @desc An error related to the generating of the documentation
689
+ * */
690
+ declare class DocumentationError extends Error {
691
+ name: string;
692
+ constructor({ message, method, path, isResponse, }: {
693
+ message: string;
694
+ } & Pick<OpenAPIContext, "path" | "method" | "isResponse">);
695
+ }
696
+ /** @desc An error related to the input and output schemas declaration */
697
+ declare class IOSchemaError extends Error {
698
+ name: string;
699
+ }
700
+ /** @desc An error of validating the Endpoint handler's returns against the Endpoint output schema */
701
+ declare class OutputValidationError extends IOSchemaError {
702
+ name: string;
703
+ readonly originalError: ZodError;
704
+ constructor(originalError: ZodError);
705
+ }
706
+ /** @desc An error of validating the input sources against the Middleware or Endpoint input schema */
707
+ declare class InputValidationError extends IOSchemaError {
708
+ name: string;
709
+ readonly originalError: ZodError;
710
+ constructor(originalError: ZodError);
711
+ }
712
+ declare class MissingPeerError extends Error {
713
+ name: string;
714
+ constructor(module: string | string[]);
715
+ }
716
+
823
717
  /**
824
718
  * @desc Using module augmentation approach you can set the Mock type of your actual testing framework.
825
719
  * @example declare module "express-zod-api" { interface MockOverrides extends Mock {} }
@@ -993,4 +887,4 @@ declare namespace proprietarySchemas {
993
887
  export { proprietarySchemas_dateIn as dateIn, proprietarySchemas_dateOut as dateOut, proprietarySchemas_file as file, proprietarySchemas_raw as raw, proprietarySchemas_upload as upload };
994
888
  }
995
889
 
996
- export { AbstractEndpoint, type AppConfig, type BasicSecurity, type BearerSecurity, type CommonConfig, type CookieSecurity, type CustomHeaderSecurity, DependsOnMethod, Documentation, DocumentationError, EndpointsFactory, type FlatObject, type IOSchema, type InputSecurity, InputValidationError, Integration, type LoggerOverrides, type Metadata, type Method, type MiddlewareDefinition, MissingPeerError, type MockOverrides, type OAuth2Security, type OpenIdSecurity, OutputValidationError, type ResultHandlerDefinition, type Routing, RoutingError, ServeStatic, type ServerConfig, type ZodDateInDef, type ZodDateOutDef, type ZodFileDef, type ZodUploadDef, arrayEndpointsFactory, arrayResultHandler, attachRouting, createConfig, createLogger, createMiddleware, createResultHandler, createServer, defaultEndpointsFactory, defaultResultHandler, proprietarySchemas as ez, getExamples, getMessageFromError, getStatusCodeFromError, testEndpoint, withMeta };
890
+ export { AbstractEndpoint, type ApiResponse, type AppConfig, type BasicSecurity, type BearerSecurity, type CommonConfig, type CookieSecurity, type CustomHeaderSecurity, DependsOnMethod, Documentation, DocumentationError, EndpointsFactory, type FlatObject, type IOSchema, type InputSecurity, InputValidationError, Integration, type LoggerOverrides, type Metadata, type Method, type MiddlewareDefinition, MissingPeerError, type MockOverrides, type OAuth2Security, type OpenIdSecurity, OutputValidationError, type ResultHandlerDefinition, type Routing, RoutingError, ServeStatic, type ServerConfig, type ZodDateInDef, type ZodDateOutDef, type ZodFileDef, type ZodUploadDef, arrayEndpointsFactory, arrayResultHandler, attachRouting, createConfig, createLogger, createMiddleware, createResultHandler, createServer, defaultEndpointsFactory, defaultResultHandler, proprietarySchemas as ez, getExamples, getMessageFromError, getStatusCodeFromError, testEndpoint, withMeta };