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 3.11.2 to 3.12.0

src/lib/json-query.decorator.d.ts

19

index.js

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

import { getRouteResponses, parseJsonQueryObject, checkZodSchema } from '@ts-rest/core';
import { createParamDecorator, BadRequestException, Injectable, applyDecorators, SetMetadata, UseInterceptors, Put, Patch, Post, Get, Delete } from '@nestjs/common';
import { checkZodSchema } from '@ts-rest/core';
import { map } from 'rxjs';

@@ -9,2 +9,3 @@

routeShapes: {},
responseShapes: getRouteResponses(router),
route: router,

@@ -36,2 +37,9 @@ };

const JsonQuerySymbol = Symbol('JsonQuery');
const JsonQuery = (jsonQuery = true) => {
return (target) => {
Reflect.defineMetadata(JsonQuerySymbol, jsonQuery, target);
};
};
const tsRestAppRouteMetadataKey = Symbol('ts-rest-app-route');

@@ -45,3 +53,8 @@ const ApiDecorator = createParamDecorator((_, ctx) => {

}
const queryResult = checkZodSchema(req.query, appRoute.query);
const isJsonQuery = !!(Reflect.getMetadata(JsonQuerySymbol, ctx.getHandler()) ||
Reflect.getMetadata(JsonQuerySymbol, ctx.getClass()));
const query = isJsonQuery
? parseJsonQueryObject(req.query)
: req.query;
const queryResult = checkZodSchema(query, appRoute.query);
if (!queryResult.success) {

@@ -102,2 +115,2 @@ throw new BadRequestException(queryResult.error);

export { Api, ApiDecorator, ApiRouteInterceptor, initNestServer };
export { Api, ApiDecorator, ApiRouteInterceptor, JsonQuery, JsonQuerySymbol, initNestServer };

4

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

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

"zod": "3.x.x",
"@ts-rest/core": "3.11.2"
"@ts-rest/core": "3.12.0"
},

@@ -37,0 +37,0 @@ "devDependencies": {

export * from './lib/ts-rest-nest';
export * from './lib/api.decorator';
export * from './lib/json-query.decorator';

@@ -15,4 +15,5 @@ import { AppRoute, AppRouter, ApiRouteResponse, Without } from '@ts-rest/core';

routeShapes: AppRouteShape<T>;
responseShapes: { [K in keyof T]: T[K] extends AppRoute ? import("@ts-rest/core").ApiResponseForRoute<T[K]> : "not a route"; };
route: T;
};
export {};

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