Socket
Socket
Sign inDemoInstall

@ts-rest/nest

Package Overview
Dependencies
Maintainers
1
Versions
126
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ts-rest/nest - npm Package Compare versions

Comparing version 3.19.5 to 3.20.0

21

index.js
import { SetMetadata, Injectable, UseInterceptors, applyDecorators, Put, Patch, Post, Get, Delete, createParamDecorator, BadRequestException } from '@nestjs/common';
import { map } from 'rxjs';
import { isAppRouteResponse, validateResponse, parseJsonQueryObject, checkZodSchema, zodErrorResponse } from '@ts-rest/core';
import { isAppRouteResponse, validateResponse, checkZodSchema, zodErrorResponse, parseJsonQueryObject } from '@ts-rest/core';
import { Reflector } from '@nestjs/core';

@@ -127,2 +127,14 @@

}
const pathParamsResult = checkZodSchema(req.params, appRoute.pathParams, {
passThroughExtraKeys: true,
});
if (!pathParamsResult.success) {
throw new BadRequestException(zodErrorResponse(pathParamsResult.error));
}
const headersResult = checkZodSchema(req.headers, appRoute.headers, {
passThroughExtraKeys: true,
});
if (!headersResult.success) {
throw new BadRequestException(zodErrorResponse(headersResult.error));
}
const isJsonQuery = !!((_a = Reflect.getMetadata(JsonQuerySymbol, ctx.getHandler())) !== null && _a !== void 0 ? _a : Reflect.getMetadata(JsonQuerySymbol, ctx.getClass()));

@@ -140,8 +152,2 @@ const query = isJsonQuery

}
const pathParamsResult = checkZodSchema(req.params, appRoute.pathParams, {
passThroughExtraKeys: true,
});
if (!pathParamsResult.success) {
throw new BadRequestException(zodErrorResponse(pathParamsResult.error));
}
return {

@@ -151,2 +157,3 @@ query: queryResult.data,

body: bodyResult.data,
headers: headersResult.data,
};

@@ -153,0 +160,0 @@ });

{
"name": "@ts-rest/nest",
"version": "3.19.5",
"version": "3.20.0",
"description": "Nest server integration for @ts-rest",

@@ -27,3 +27,3 @@ "license": "MIT",

"zod": "^3.0.0",
"@ts-rest/core": "3.19.5"
"@ts-rest/core": "3.20.0"
},

@@ -30,0 +30,0 @@ "peerDependenciesMeta": {

@@ -1,2 +0,3 @@

import { AppRoute, AppRouteMutation, PathParamsWithCustomValidators, Without, ZodInferOrType } from '@ts-rest/core';
import { AppRoute, AppRouteMutation, LowercaseKeys, PathParamsWithCustomValidators, Without, ZodInferOrType } from '@ts-rest/core';
import type { Request } from 'express-serve-static-core';
type BodyWithoutFileIfMultiPart<T extends AppRouteMutation> = T['contentType'] extends 'multipart/form-data' ? Without<ZodInferOrType<T['body']>, File> : ZodInferOrType<T['body']>;

@@ -7,2 +8,3 @@ export type TsRestRequestShape<TRoute extends AppRoute> = Without<{

query: ZodInferOrType<TRoute['query']>;
headers: LowercaseKeys<ZodInferOrType<TRoute['headers']>> & Request['headers'];
}, never>;

@@ -9,0 +11,0 @@ /**

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