Socket
Socket
Sign inDemoInstall

rjweb-server

Package Overview
Dependencies
Maintainers
1
Versions
373
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rjweb-server - npm Package Compare versions

Comparing version 9.1.1 to 9.1.2

4

CHANGELOG.md
# Changelog
## 9.1.2
- Fix `<HttpRequestContext>.bindBody`
## 9.1.1

@@ -4,0 +8,0 @@

12

lib/cjs/classes/request/HttpRequestContext.js

@@ -125,3 +125,3 @@ "use strict";

* ```
* const [ infos, error ] = ctr.bindBody((z) => z.object({
* const [ data, error ] = await ctr.bindBody((z) => z.object({
* name: z.string().max(24),

@@ -131,13 +131,13 @@ * gender: z.union([ z.literal('male'), z.literal('female') ])

*
* if (!infos) return ctr.status((s) => s.BAD_REQUEST).print(error.toString())
* if (!data) return ctr.status((s) => s.BAD_REQUEST).print(error.toString())
*
* ctr.print('Everything valid! 👍')
* ctr.printPart(`
* your name is ${infos.name}
* and you are a ${infos.gender}
* your name is ${data.name}
* and you are a ${data.gender}
* `)
* ```
* @since 8.8.0
*/ bindBody(schema) {
const fullSchema = typeof schema === 'function' ? schema(zod_1.z) : schema, parsed = fullSchema.safeParse(this.body);
*/ async bindBody(schema) {
const fullSchema = typeof schema === 'function' ? schema(zod_1.z) : schema, parsed = await fullSchema.safeParseAsync(await this.body());
if (!parsed.success)

@@ -144,0 +144,0 @@ return [null, parsed.error];

@@ -32,3 +32,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Middleware = exports.Throttler = exports.Cookie = exports.Channel = exports.ValueCollection = exports.Server = exports.defaultOptions = exports.html = exports.writeHeaders = exports.parseKV = exports.parseURL = exports.parseContent = exports.WsCloseContext = exports.WsMessageContext = exports.WsOpenContext = exports.HttpRequestContext = exports.RequestContext = exports.GlobalContext = exports.ImplementationWsContext = exports.ImplementationHttpContext = exports.Implementation = exports.version = void 0;
exports.RuntimeError = exports.Middleware = exports.Throttler = exports.Cookie = exports.Channel = exports.ValueCollection = exports.Server = exports.defaultOptions = exports.html = exports.writeHeaders = exports.parseKV = exports.parseURL = exports.parseContent = exports.WsCloseContext = exports.WsMessageContext = exports.WsOpenContext = exports.HttpRequestContext = exports.RequestContext = exports.GlobalContext = exports.ImplementationWsContext = exports.ImplementationHttpContext = exports.Implementation = exports.version = void 0;
const package_json_1 = require("./package.json");

@@ -79,1 +79,3 @@ exports.version = package_json_1.version;

exports.Middleware = Middleware_1.default;
const RuntimeError_1 = __importDefault(require("./classes/RuntimeError"));
exports.RuntimeError = RuntimeError_1.default;
{
"name": "rjweb-server",
"version": "9.1.0",
"version": "9.1.2",
"description": "Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS",

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

@@ -97,3 +97,3 @@ import { Status } from "../../types/global";

* ```
* const [ infos, error ] = ctr.bindBody((z) => z.object({
* const [ data, error ] = await ctr.bindBody((z) => z.object({
* name: z.string().max(24),

@@ -103,13 +103,13 @@ * gender: z.union([ z.literal('male'), z.literal('female') ])

*
* if (!infos) return ctr.status((s) => s.BAD_REQUEST).print(error.toString())
* if (!data) return ctr.status((s) => s.BAD_REQUEST).print(error.toString())
*
* ctr.print('Everything valid! 👍')
* ctr.printPart(`
* your name is ${infos.name}
* and you are a ${infos.gender}
* your name is ${data.name}
* and you are a ${data.gender}
* `)
* ```
* @since 8.8.0
*/ bindBody(schema) {
const fullSchema = typeof schema === 'function' ? schema(z) : schema, parsed = fullSchema.safeParse(this.body);
*/ async bindBody(schema) {
const fullSchema = typeof schema === 'function' ? schema(z) : schema, parsed = await fullSchema.safeParseAsync(await this.body());
if (!parsed.success)

@@ -116,0 +116,0 @@ return [null, parsed.error];

@@ -25,2 +25,3 @@ import { version as packageVersion } from "./package.json";

import Middleware from "./classes/Middleware";
export { parseContent, parseURL, parseKV, writeHeaders, html, defaultOptions, Server, ValueCollection, Channel, Cookie, Throttler, Middleware };
import RuntimeError from "./classes/RuntimeError";
export { parseContent, parseURL, parseKV, writeHeaders, html, defaultOptions, Server, ValueCollection, Channel, Cookie, Throttler, Middleware, RuntimeError };
{
"name": "rjweb-server",
"version": "9.1.0",
"version": "9.1.2",
"description": "Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS",

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

@@ -113,3 +113,3 @@ /// <reference types="node" />

* ```
* const [ infos, error ] = ctr.bindBody((z) => z.object({
* const [ data, error ] = await ctr.bindBody((z) => z.object({
* name: z.string().max(24),

@@ -119,12 +119,12 @@ * gender: z.union([ z.literal('male'), z.literal('female') ])

*
* if (!infos) return ctr.status((s) => s.BAD_REQUEST).print(error.toString())
* if (!data) return ctr.status((s) => s.BAD_REQUEST).print(error.toString())
*
* ctr.print('Everything valid! 👍')
* ctr.printPart(`
* your name is ${infos.name}
* and you are a ${infos.gender}
* your name is ${data.name}
* and you are a ${data.gender}
* `)
* ```
* @since 8.8.0
*/ bindBody<Schema extends z.ZodTypeAny>(schema: Schema | ((z: typeof import('zod')) => Schema)): ZodResponse<Schema>;
*/ bindBody<Schema extends z.ZodTypeAny>(schema: Schema | ((z: typeof import('zod')) => Schema)): Promise<ZodResponse<Schema>>;
/**

@@ -131,0 +131,0 @@ * HTTP WWW-Authentication Checker

@@ -26,3 +26,4 @@ export declare const version: string;

import Middleware from "./classes/Middleware";
export { parseContent, parseURL, parseKV, writeHeaders, html, defaultOptions, Server, ValueCollection, Channel, Cookie, Throttler, Middleware };
import RuntimeError from "./classes/RuntimeError";
export { parseContent, parseURL, parseKV, writeHeaders, html, defaultOptions, Server, ValueCollection, Channel, Cookie, Throttler, Middleware, RuntimeError };
export type { HTMLContent };
{
"name": "rjweb-server",
"version": "9.1.1",
"version": "9.1.2",
"description": "Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS",

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

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