New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

celebrate

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

celebrate - npm Package Compare versions

Comparing version 15.0.1 to 15.0.3

20

lib/index.d.ts
import { ErrorRequestHandler, RequestHandler } from 'express';
import { ParamsDictionary, Query } from 'express-serve-static-core';
import {
Root as joi,
ValidationOptions,
ValidationError,
} from 'joi';
import * as Joi from 'joi';

@@ -25,4 +21,4 @@

interface Celebrator1<P=ParamsDictionary, ResBody=any, ReqBody=any, ReqQuery=Query> {
(joiOpts: ValidationOptions): Celebrator2;
(joiOpts: ValidationOptions, requestRules: SchemaOptions): RequestHandler<P, ResBody, ReqBody, ReqQuery>;
(joiOpts: Joi.ValidationOptions): Celebrator2;
(joiOpts: Joi.ValidationOptions, requestRules: SchemaOptions): RequestHandler<P, ResBody, ReqBody, ReqQuery>;
}

@@ -36,6 +32,6 @@

(opts: CelebrateOptions): Celebrator1;
(opts: CelebrateOptions, joiOpts: ValidationOptions): Celebrator2;
(opts: CelebrateOptions, joiOpts: Joi.ValidationOptions): Celebrator2;
(
opts: CelebrateOptions,
joiOpts: ValidationOptions,
joiOpts: Joi.ValidationOptions,
requestRules: SchemaOptions

@@ -86,3 +82,3 @@ ): RequestHandler<P, ResBody, ReqBody, ReqQuery>;

*/
export declare function celebrate<P=ParamsDictionary, ResBody=any, ReqBody=any, ReqQuery=Query>(requestRules: SchemaOptions, joiOpts?: ValidationOptions, opts?: CelebrateOptions): RequestHandler<P, ResBody, ReqBody, ReqQuery>;
export declare function celebrate<P=ParamsDictionary, ResBody=any, ReqBody=any, ReqQuery=Query>(requestRules: SchemaOptions, joiOpts?: Joi.ValidationOptions, opts?: CelebrateOptions): RequestHandler<P, ResBody, ReqBody, ReqQuery>;

@@ -102,3 +98,3 @@ /**

*/
export declare const Joi: joi;
export { Joi };

@@ -114,4 +110,4 @@ /**

export declare class CelebrateError extends Error {
details: Map<string, ValidationError>;
details: Map<string, Joi.ValidationError>;
constructor(message?:string, opts?: { celebrated?: boolean });
}

2

package.json
{
"name": "celebrate",
"version": "15.0.1",
"version": "15.0.3",
"description": "A joi validation middleware for Express.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

[![celebrate](https://github.com/arb/celebrate/raw/master/images/logo.svg?sanitize=1)](https://www.npmjs.org/package/celebrate)
[![Current Version](https://flat.badgen.net/npm/v/celebrate?icon=npm)](https://www.npmjs.org/package/celebrate)
[![Build Status](https://flat.badgen.net/travis/arb/celebrate?icon=travis)](https://travis-ci.org/arb/celebrate)
[![Build Status](https://flat.badgen.net/github/checks/arb/celebrate?label=build&icon=github)](https://www.google.com)
[![airbnb-style](https://flat.badgen.net/badge/eslint/airbnb/ff5a5f?icon=airbnb)](https://github.com/airbnb/javascript)
[![Code Coverage](https://flat.badgen.net/codecov/c/github/arb/celebrate?icon=codecov)](https://codecov.io/gh/arb/celebrate)
[![Total Downloads](https://badgen.net/npm/dt/celebrate?&color=cyan)](https://www.npmjs.org/package/celebrate)
[![Total Downloads](https://flat.badgen.net/npm/dt/celebrate?&color=cyan)](https://www.npmjs.org/package/celebrate)
<table>
<tbody>
<tr>
<td>Sponsored by</td>
<td>
<a href="https://github.com/webflow/">
<img
height="100"
src="https://github.com/arb/celebrate/raw/master/images/webflow-logo-blue.svg?sanitize=1"
alt="Webflow"
/>
</a>
</td>
</tr>
</tbody>
</table>

@@ -200,3 +184,3 @@ celebrate is an express middleware function that wraps the [joi](https://github.com/hapijs/joi/tree/master) validation library. This allows you to use this middleware in any single route, or globally, and ensure that all of your inputs are correct before any handler function. The middleware allows you to validate `req.params`, `req.headers`, and `req.query`.

An enum containing all the segments of `req` objects that celebrate *can* valiate against.
An enum containing all the segments of `req` objects that celebrate *can* validate against.

@@ -220,2 +204,3 @@ ```js

- `FULL` - validates the entire request object and collects all the validation failures in the result. Does *not* apply joi transformations if any part of the request is invalid.
- Note: In order for this to work, you will need to pass `abortEarly: false` to [#joiOptions](#celebrateschema-joioptions-opts). Or to get the default behavior along with this, `{ abortEarly: false, warnings: true }`

@@ -268,3 +253,3 @@

For example, if you validate `req.query` and have a `default` value in your joi schema, if the incoming `req.query` is missing a value for default, during validation `celebrate` will overrite the original `req.query` with the result of `joi.validate`. This is done so that once `req` has been validated, you can be sure all the inputs are valid and ready to consume in your handler functions and you don't need to re-write all your handlers to look for the query values in `res.locals.*`.
For example, if you validate `req.query` and have a `default` value in your joi schema, if the incoming `req.query` is missing a value for default, during validation `celebrate` will overwrite the original `req.query` with the result of `joi.validate`. This is done so that once `req` has been validated, you can be sure all the inputs are valid and ready to consume in your handler functions and you don't need to re-write all your handlers to look for the query values in `res.locals.*`.

@@ -277,2 +262,2 @@ ### Additional Info

*Before* opening issues on this repo, make sure your joi schema is correct and working as you intended. The bulk of this code is just exposing the joi API as express middleware. All of the heavy lifting still happens inside joi. You can go [here](https://npm.runkit.com/joi) to verify your joi schema easily.
*Before* opening issues on this repo, make sure your joi schema is correct and working as you intended. The bulk of this code is just exposing the joi API as express middleware. All of the heavy lifting still happens inside joi. You can go [here](https://npm.runkit.com/joi) to verify your joi schema easily.
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