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.1.4-beta.0 to 1.1.4-beta.1

15

dist/index.d.ts

@@ -1,8 +0,7 @@

import * as KoaRouter from '@koa/router';
import { LayerOptions, RouterOptions, ParamMiddleware } from '@koa/router';
import KoaRouter, { LayerOptions, RouterOptions } from '@koa/router';
import formidable from 'formidable';
import { Response, Middleware, DefaultState, DefaultContext } from 'koa';
import * as formidable from 'formidable';
import * as bodyParser from 'koa-bodyparser';
import { ZodSchema, z, ZodTypeAny } from 'zod';
import * as formidable_PersistentFile from 'formidable/PersistentFile';
import bodyParser from 'koa-bodyparser';
import z, { ZodSchema, ZodTypeAny, z as z$1 } from 'zod';
import PersistentFile from 'formidable/PersistentFile';

@@ -78,3 +77,3 @@ type Method = 'acl' | 'bind' | 'checkout' | 'connect' | 'copy' | 'delete' | 'get' | 'head' | 'link' | 'lock' | 'm-search' | 'merge' | 'mkactivity' | 'mkcalendar' | 'mkcol' | 'move' | 'notify' | 'options' | 'patch' | 'post' | 'propfind' | 'proppatch' | 'purge' | 'put' | 'rebind' | 'report' | 'search' | 'source' | 'subscribe' | 'trace' | 'unbind' | 'unlink' | 'unlock' | 'unsubscribe';

readonly opts: KoaRouter.RouterOptions;
readonly param: <BodyT = unknown>(param: string, middleware: ParamMiddleware<DefaultState, DefaultContext, BodyT>) => KoaRouter<DefaultState, DefaultContext>;
readonly param: <BodyT = unknown>(param: string, middleware: KoaRouter.ParamMiddleware<DefaultState, DefaultContext, BodyT>) => KoaRouter<DefaultState, DefaultContext>;
readonly params: object;

@@ -230,3 +229,3 @@ readonly prefix: (prefix: string) => KoaRouter<DefaultState, DefaultContext>;

declare const zFile: () => z.ZodUnion<[z.ZodType<formidable_PersistentFile, z.ZodTypeDef, formidable_PersistentFile>, z.ZodType<formidable_PersistentFile, z.ZodTypeDef, formidable_PersistentFile>]>;
declare const zFile: () => z$1.ZodType<PersistentFile, z$1.ZodTypeDef, PersistentFile>;
declare const createRouteSpec: <State extends DefaultState, H, P, Q, B, F, R>(spec: RouteSpec<State, H, P, Q, B, F, R>) => RouteSpec<State, H, P, Q, B, F, R>;

@@ -233,0 +232,0 @@ declare const createUseSpec: <S, H, P, Q, B, F, R>(spec: UseSpec<S, H, P, Q, B, F, R>) => UseSpec<S, H, P, Q, B, F, R>;

@@ -43,9 +43,9 @@ "use strict";

// src/zod-router.ts
var bodyParser = __toESM(require("koa-bodyparser"));
var KoaRouter = __toESM(require("@koa/router"));
var import_koa_bodyparser = __toESM(require("koa-bodyparser"));
var import_router = __toESM(require("@koa/router"));
// src/util.ts
var formidable = __toESM(require("formidable"));
var import_formidable = __toESM(require("formidable"));
var import_zod = require("zod");
var { FormidableError } = formidable.errors;
var { FormidableError } = import_formidable.default.errors;
var flatten = (middlewares) => {

@@ -114,3 +114,3 @@ const flattened = middlewares.reduce((acc, curr) => {

var zFile = () => {
return import_zod.z.instanceof(formidable.PersistentFile).or(import_zod.z.instanceof(formidable.VolatileFile));
return import_zod.z.instanceof(import_formidable.default.PersistentFile).or(import_zod.z.instanceof(import_formidable.default.VolatileFile));
};

@@ -289,3 +289,3 @@ var assertFormidableError = (val) => {

// src/multipart-parser-middleware.ts
var formidable2 = __toESM(require("formidable"));
var import_formidable2 = __toESM(require("formidable"));
var multipartParserMiddleware = (options) => {

@@ -297,3 +297,3 @@ return async (ctx, next) => {

}
const form = formidable2({ multiples: true, ...options });
const form = (0, import_formidable2.default)({ multiples: true, ...options });
try {

@@ -327,4 +327,4 @@ await new Promise((resolve, reject) => {

var zodRouter = (opts) => {
const _router = new KoaRouter(opts?.koaRouter);
_router.use(bodyParser(opts?.bodyParser));
const _router = new import_router.default(opts?.koaRouter);
_router.use((0, import_koa_bodyparser.default)(opts?.bodyParser));
if (opts?.zodRouter?.enableMultipart) {

@@ -331,0 +331,0 @@ _router.use(multipartParserMiddleware(opts?.formidable));

{
"name": "koa-zod-router",
"version": "1.1.4-beta.0",
"version": "1.1.4-beta.1",
"description": "",

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

"formidable": "^2.1.1",
"koa-bodyparser": "^4.3.0",
"zod": "^3.21.3"
"koa-bodyparser": "^4.4.0",
"zod": "^3.21.4"
},
"devDependencies": {
"@changesets/cli": "^2.26.0",
"@changesets/cli": "^2.26.1",
"@types/formidable": "^2.0.5",
"@types/koa": "^2.13.5",
"@types/koa": "^2.13.6",
"@types/koa-bodyparser": "^4.3.10",
"@types/koa__router": "^12.0.0",
"@types/node": "^18.14.6",
"@types/node": "^18.15.11",
"@types/sinon": "^10.0.13",
"@types/supertest": "^2.0.12",
"@typescript-eslint/eslint-plugin": "^5.54.1",
"@typescript-eslint/parser": "^5.54.1",
"@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.1",
"coveralls": "^3.1.1",
"eslint": "^8.35.0",
"eslint-config-prettier": "^8.7.0",
"eslint": "^8.37.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",

@@ -64,14 +64,11 @@ "eslint-plugin-prettier": "^4.2.1",

"nyc": "^15.1.0",
"prettier": "^2.8.4",
"sinon": "^15.0.1",
"prettier": "^2.8.7",
"sinon": "^15.0.3",
"supertest": "^6.3.3",
"ts-node-dev": "^2.0.0",
"tsup": "^6.6.3",
"turbo": "^1.8.3",
"tsup": "^6.7.0",
"turbo": "^1.8.8",
"typescript": "4.9.4"
},
"peerDependencies": {
"@koa/router": ">=12.0.0 <13.x",
"@types/koa": ">=2.13.5 <3.x",
"@types/koa__router": ">=12.0.0 <13.x",
"koa": ">=2.14.1 <3.x",

@@ -78,0 +75,0 @@ "zod": ">=3.20.2 <4.x"

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