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

@ts-rest/core

Package Overview
Dependencies
Maintainers
1
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ts-rest/core - npm Package Compare versions

Comparing version 3.25.1 to 3.26.0-rc.0

7

CHANGELOG.md
# @ts-rest/core
## 3.26.0-rc.0
### Minor Changes
- e8ea535: Add new `SingleHandler` and `MultiHandler` API to `@ts-rest/nest`
- 2763208: Added `pathPrefix` to contract options to allow recursive path prefixing.
## 3.25.1

@@ -4,0 +11,0 @@

16

index.js

@@ -81,2 +81,5 @@ 'use strict';

...value,
path: (options === null || options === void 0 ? void 0 : options.pathPrefix)
? options.pathPrefix + value.path
: value.path,
headers: zodMerge(options === null || options === void 0 ? void 0 : options.baseHeaders, value.headers),

@@ -142,7 +145,4 @@ strictStatusCodes: (_a = value.strictStatusCodes) !== null && _a !== void 0 ? _a : options === null || options === void 0 ? void 0 : options.strictStatusCodes,

.flatMap((key) => tokeniseValue(key, query[key]))
.map((pair) => {
const [key, ...rhs] = pair.split('=');
return `${encodeURIComponent(key)}=${rhs
.map(encodeURIComponent)
.join('=')}`;
.map(([key, value]) => {
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
})

@@ -156,6 +156,6 @@ .join('&'));

if (value instanceof Date) {
return [`${key}=${value.toISOString()}`];
return [[`${key}`, value.toISOString()]];
}
if (value === null) {
return [`${key}=`];
return [[`${key}`, '']];
}

@@ -169,3 +169,3 @@ if (value === undefined) {

}
return [`${key}=${value}`];
return [[`${key}`, `${value}`]];
};

@@ -172,0 +172,0 @@ const parseJsonQueryObject = (query) => {

{
"name": "@ts-rest/core",
"version": "3.25.1",
"version": "3.26.0-rc.0",
"description": "RPC-like experience over a regular REST API, with type safe server implementations 🪄",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -56,3 +56,4 @@ import { Merge, Opaque, Prettify, WithoutUnknown } from './type-utils';

type UniversalMerge<A, B> = A extends z.AnyZodObject ? B extends z.AnyZodObject ? z.ZodObject<z.objectUtil.MergeShapes<A['shape'], B['shape']>, B['_def']['unknownKeys'], B['_def']['catchall']> : unknown extends B ? A : MixedZodError<A, B> : unknown extends A ? B : B extends z.AnyZodObject ? MixedZodError<A, B> : unknown extends B ? A : Prettify<Merge<A, B>>;
type ApplyOptions<TRoute extends AppRoute, TOptions extends RouterOptions> = Omit<TRoute, 'headers'> & WithoutUnknown<{
type ApplyOptions<TRoute extends AppRoute, TOptions extends RouterOptions> = Omit<TRoute, 'headers' | 'path'> & WithoutUnknown<{
path: TOptions['pathPrefix'] extends string ? `${TOptions['pathPrefix']}${TRoute['path']}` : TRoute['path'];
headers: UniversalMerge<TOptions['baseHeaders'], TRoute['headers']>;

@@ -75,5 +76,6 @@ strictStatusCodes: TRoute['strictStatusCodes'] extends boolean ? TRoute['strictStatusCodes'] : TOptions['strictStatusCodes'] extends boolean ? TOptions['strictStatusCodes'] : unknown;

};
export type RouterOptions = {
export type RouterOptions<TPrefix extends string = string> = {
baseHeaders?: unknown;
strictStatusCodes?: boolean;
pathPrefix?: TPrefix;
};

@@ -94,3 +96,3 @@ /**

*/
router: <TRouter extends AppRouter, TOptions extends RouterOptions>(endpoints: RecursivelyProcessAppRouter<TRouter, TOptions>, options?: TOptions) => RecursivelyApplyOptions<TRouter, TOptions>;
router: <TRouter extends AppRouter, TPrefix extends string, TOptions extends RouterOptions<TPrefix>>(endpoints: RecursivelyProcessAppRouter<TRouter, TOptions>, options?: TOptions) => RecursivelyApplyOptions<TRouter, TOptions>;
/**

@@ -97,0 +99,0 @@ * A single query route, should exist within

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