Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@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 2.1.0 to 3.0.0

6

CHANGELOG.md
# @ts-rest/nest
## 3.0.0
### Major Changes
- 895112a: Migrate paths to a string rather than function
## 2.1.0

@@ -4,0 +10,0 @@

4

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

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

"@nestjs/common": "^9.0.11",
"@ts-rest/core": "2.1.0",
"@ts-rest/core": "3.0.0",
"zod": "^3.18.0",

@@ -31,0 +31,0 @@ "rxjs": "^7.0.0",

import { CallHandler, ExecutionContext, NestInterceptor } from '@nestjs/common';
import { AppRoute, AppRouteMutation, Without } from '@ts-rest/core';
import { AppRoute, AppRouteMutation, PathParams, Without } from '@ts-rest/core';
import { Observable } from 'rxjs';
import { z, ZodTypeAny } from 'zod';
export declare type ApiDecoratorShape<TRoute extends AppRoute> = Without<{
params: Parameters<TRoute['path']>[0];
params: PathParams<TRoute>;
body: TRoute extends AppRouteMutation ? TRoute['body'] extends ZodTypeAny ? z.infer<TRoute['body']> : TRoute['body'] : never;

@@ -8,0 +8,0 @@ query: TRoute['query'] extends ZodTypeAny ? z.infer<TRoute['query']> : TRoute['query'];

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

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

@@ -92,2 +92,3 @@ const result = appRoute.body.safeParse(body);

query: queryResult.body,
// @ts-expect-error because the decorator shape is any
params: pathParams,

@@ -98,14 +99,13 @@ body: bodyResult.body

const getMethodDecorator = (appRoute)=>{
const path = (0, _core.getAppRoutePathRoute)(appRoute);
switch(appRoute.method){
case 'DELETE':
return (0, _common.Delete)(path);
return (0, _common.Delete)(appRoute.path);
case 'GET':
return (0, _common.Get)(path);
return (0, _common.Get)(appRoute.path);
case 'POST':
return (0, _common.Post)(path);
return (0, _common.Post)(appRoute.path);
case 'PATCH':
return (0, _common.Patch)(path);
return (0, _common.Patch)(appRoute.path);
case 'PUT':
return (0, _common.Put)(path);
return (0, _common.Put)(appRoute.path);
}

@@ -112,0 +112,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