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 1.3.0 to 2.0.0

10

CHANGELOG.md
# @ts-rest/nest
## 2.0.0
### Major Changes
- 223c7cc: Change contract to support multiple responses, for different statuses
### Patch Changes
- 9a42657: Add error handling support to express
## 1.3.0

@@ -4,0 +14,0 @@

6

package.json
{
"name": "@ts-rest/nest",
"version": "1.3.0",
"version": "2.0.0",
"description": "Nest server integration for @ts-rest",

@@ -28,4 +28,4 @@ "type": "commonjs",

"@nestjs/common": "^9.0.8",
"@ts-rest/core": "1.3.0",
"zod": "^3.17.10",
"@ts-rest/core": "2.0.0",
"zod": "^3.18.0",
"rxjs": "^7.0.0",

@@ -32,0 +32,0 @@ "@swc/helpers": "~0.4.3"

@@ -17,2 +17,3 @@ "use strict";

const _core = require("@ts-rest/core");
const _rxjs = require("rxjs");
const getQueryParams = (url)=>{

@@ -50,3 +51,3 @@ const searchParams = new URLSearchParams(url.split('?')[1]);

const checkBodySchema = (body, appRoute)=>{
if (appRoute.__type === 'AppRouteMutation' && appRoute.body) {
if (appRoute.__tsType === 'AppRouteMutation' && appRoute.body) {
if (isZodObject(appRoute.body)) {

@@ -135,3 +136,8 @@ const result = appRoute.body.safeParse(body);

req.appRoute = this.appRoute;
return next.handle();
return next.handle().pipe((0, _rxjs.map)((value)=>{
if (typeof value === 'object' && typeof value.status === 'number' && value.data !== undefined) {
throw new _common.HttpException(value == null ? void 0 : value.data, value.status);
}
return value;
}));
}

@@ -138,0 +144,0 @@ constructor(appRoute){

@@ -1,4 +0,4 @@

import { AppRoute, AppRouter, Without, ZodInferOrType } from '@ts-rest/core';
import { AppRoute, AppRouter, ApiRouteResponse, Without } from '@ts-rest/core';
import { ApiDecoratorShape } from './api.decorator';
declare type AppRouterMethodShape<T extends AppRoute> = (...args: any[]) => Promise<ZodInferOrType<T['response']>>;
declare type AppRouterMethodShape<T extends AppRoute> = (...args: any[]) => Promise<ApiRouteResponse<T['responses']>>;
declare type AppRouterControllerShape<T extends AppRouter> = {

@@ -5,0 +5,0 @@ [K in keyof T]: T[K] extends AppRouter ? undefined : T[K] extends AppRoute ? AppRouterMethodShape<T[K]> : never;

Sorry, the diff of this file is not supported yet

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