@ts-rest/core
Advanced tools
Comparing version 3.14.0 to 3.15.0
31
index.js
@@ -159,21 +159,11 @@ const isAppRoute = (obj) => { | ||
}; | ||
const createNewProxy = (router, args) => { | ||
return new Proxy({}, { | ||
get: (target, propKey) => { | ||
if (typeof propKey === 'string' && propKey in router) { | ||
const subRouter = router[propKey]; | ||
if (isAppRoute(subRouter)) { | ||
return getRouteQuery(subRouter, args); | ||
} | ||
else { | ||
return createNewProxy(subRouter, args); | ||
} | ||
} | ||
return createNewProxy(router, args); | ||
}, | ||
}); | ||
}; | ||
const initClient = (router, args) => { | ||
const proxy = createNewProxy(router, args); | ||
return proxy; | ||
return Object.fromEntries(Object.entries(router).map(([key, subRouter]) => { | ||
if (isAppRoute(subRouter)) { | ||
return [key, getRouteQuery(subRouter, args)]; | ||
} | ||
else { | ||
return [key, initClient(subRouter, args)]; | ||
} | ||
})); | ||
}; | ||
@@ -200,3 +190,6 @@ function getRouteResponses(router) { | ||
success: false, | ||
error: result.error, | ||
error: { | ||
name: result.error.name, | ||
issues: result.error.issues, | ||
}, | ||
}; | ||
@@ -203,0 +196,0 @@ } |
{ | ||
"name": "@ts-rest/core", | ||
"version": "3.14.0", | ||
"version": "3.15.0", | ||
"description": "RPC-like experience over a regular REST API, with type safe server implementations ๐ช", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -7,16 +7,21 @@ # ts-rest | ||
<p align="center">RPC-like client and server helpers for a magical end to end typed experience</p> | ||
<p align="center"> | ||
<a href="https://www.npmjs.com/package/@ts-rest/core"> | ||
<img src="https://img.shields.io/npm/v/@ts-rest/core.svg" alt="langue typescript"/> | ||
</a> | ||
<a href="https://www.npmjs.com/package/@ts-rest/core"/> | ||
<img alt="npm" src="https://img.shields.io/npm/dw/@ts-rest/core"/> | ||
<a href="https://github.com/ts-rest/ts-rest/blob/main/LICENSE"></a> | ||
<img alt="GitHub" src="https://img.shields.io/github/license/ts-rest/ts-rest"/> | ||
<img alt="GitHub Workflow Status" src="https://img.shields.io/bundlephobia/minzip/@ts-rest/core?label=%40ts-rest%2Fcore"/> | ||
<img alt="GitHub Workflow Status" src="https://img.shields.io/discord/1055855205960392724"/> | ||
</p> | ||
<p align="center">RPC-like client and server helpers for a magical end to end typed experience</p> | ||
<p align="center"> | ||
<a href="https://www.npmjs.com/package/@ts-rest/core"> | ||
<img src="https://img.shields.io/npm/v/@ts-rest/core.svg" alt="langue typescript"/> | ||
</a> | ||
<img alt="Github Workflow Status" src="https://img.shields.io/github/actions/workflow/status/ts-rest/ts-rest/release.yml?branch=main"/> | ||
<a href="https://www.npmjs.com/package/@ts-rest/core"> | ||
<img alt="npm" src="https://img.shields.io/npm/dw/@ts-rest/core"/> | ||
</a> | ||
<a href="https://github.com/ts-rest/ts-rest/blob/main/LICENSE"> | ||
<img alt="License" src="https://img.shields.io/github/license/ts-rest/ts-rest"/> | ||
</a> | ||
<img alt="Bundle Size" src="https://img.shields.io/bundlephobia/minzip/@ts-rest/core?label=%40ts-rest%2Fcore"/> | ||
<a href="https://discord.com/invite/2Megk85k5a"> | ||
<img alt="Discord" src="https://img.shields.io/discord/1055855205960392724"/> | ||
</a> | ||
</p> | ||
# Introduction | ||
@@ -87,1 +92,15 @@ | ||
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! | ||
<div style={{paddingTop: "25px"}}> | ||
<a | ||
href="https://vercel.com/?utm_source=ts-rest&utm_campaign=oss" | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
<img | ||
src="https://ts-rest.com/img/powered-by-vercel.svg" | ||
alt="Powered by Vercel" | ||
height="40" | ||
/> | ||
</a> | ||
</div> |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
105
32451
681