Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

koa-zod-router

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-zod-router - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4-beta.0

10

dist/index.d.ts
import * as koa from 'koa';
import { Middleware, DefaultState } from 'koa';
import KoaRouter, { RouterOptions, LayerOptions } from '@koa/router';
import KoaRouter, { LayerOptions, RouterOptions } from '@koa/router';
import formidable from 'formidable';

@@ -42,2 +42,8 @@ import bodyParser from 'koa-bodyparser';

} & Spec<H, P, Q, B, F, R>;
declare function RouterMethodFn<H, P, Q, B, F, R>(path: string, handler: ZodMiddleware<H, P, Q, B, F, R>, validationOptions?: ValidationOptions<H, P, Q, B, F, R>): KoaRouter;
declare function RouterMethodFn<H, P, Q, B, F, R>(spec: Spec<H, P, Q, B, F, R>): KoaRouter;
type RouterMethod = typeof RouterMethodFn;
type RouterMethods = {
[key in Method]: RouterMethod;
};
type ZodRouter = ReturnType<typeof zodRouter>;

@@ -220,2 +226,2 @@ interface RouterOpts {

export { RouterOpts, ZodRouter, createRouteSpec, zodRouter as default, zFile };
export { Method, RegisterSpec, RouteSpec, RouterMethod, RouterMethods, RouterOpts, Spec, ValidationOptions, ZodContext, ZodMiddleware, ZodRouter, createRouteSpec, zodRouter as default, zFile, zodRouter };

6

dist/index.js

@@ -31,3 +31,4 @@ "use strict";

default: () => src_default,
zFile: () => zFile
zFile: () => zFile,
zodRouter: () => zod_router_default
});

@@ -385,3 +386,4 @@ module.exports = __toCommonJS(src_exports);

createRouteSpec,
zFile
zFile,
zodRouter
});
{
"name": "koa-zod-router",
"version": "1.0.3",
"version": "1.0.4-beta.0",
"description": "",

@@ -19,3 +19,4 @@ "main": "dist/index.js",

"lint:turbo": "turbo run lint",
"release": "pnpm build:turbo && npm publish"
"release": "pnpm build:turbo && npm publish",
"release:beta": "pnpm build:turbo && npm publish --tag beta"
},

@@ -22,0 +23,0 @@ "author": {

@@ -103,2 +103,14 @@ # ⚡ koa-zod-router ⚡

### Exposing validation errors to the client
By default validation errors will respond with either a generic 400 or 500 error depending on whether the validation fails from the sent fields in the request, or if there is an issue in the response body.
To enable ZodErrors being exposed to the client simply use the following config:
```js
const router = zodRouter({
zodRouter: { exposeRequestErrors: true, exposeResponseErrors: true },
});
```
### Type coercion

@@ -181,6 +193,9 @@

Found a bug? Have a question or idea?
Found a bug?
Please let me know in [Issues section](https://github.com/JakeFenley/koa-zod-router/issues).
Have a question or idea?
Please let me know in [Discussions section](https://github.com/JakeFenley/koa-zod-router/discussions).
Found a vulnerability or other security issue?
Please refer to [Security policy](https://github.com/JakeFenley/koa-zod-router/blob/main/SECURITY.md).

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc