New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More โ†’
Socket
Sign inDemoInstall
Socket

@ts-rest/fastify

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ts-rest/fastify - npm Package Compare versions

Comparing version 3.28.0 to 3.30.0

11

CHANGELOG.md
# @ts-rest/fastify
## 3.30.0
## 3.29.0
### Patch Changes
- f45aa1b: fix: Type error when combining server contracts with fastify
- 5f7b236: - bump `@ts-rest/react-query` peer dependency `@tanstack/react-query` to `^4.0.0` (latest 4.33.0)
- bump `@ts-rest/react-query` peer dependency `zod` to `^3.21.0`
- upgrades NX to 16.7 for project root
## 3.28.0

@@ -4,0 +15,0 @@

13

index.js

@@ -122,7 +122,16 @@ 'use strict';

};
const implementationIsInitialisedRouter = (implementation) => {
return 'contract' in implementation && 'routes' in implementation;
};
const recursivelyRegisterRouter = (routerImpl, appRouter, path, fastify, options) => {
if (typeof routerImpl === 'object') {
for (const key in routerImpl) {
recursivelyRegisterRouter(routerImpl[key], appRouter[key], [...path, key], fastify, options);
console.log(routerImpl);
if (implementationIsInitialisedRouter(routerImpl)) {
recursivelyRegisterRouter(routerImpl.routes, routerImpl.contract, [...path], fastify, options);
}
else {
for (const key in routerImpl) {
recursivelyRegisterRouter(routerImpl[key], appRouter[key], [...path, key], fastify, options);
}
}
}

@@ -129,0 +138,0 @@ else if (typeof routerImpl === 'function') {

8

package.json
{
"name": "@ts-rest/fastify",
"version": "3.28.0",
"version": "3.30.0",
"peerDependencies": {
"fastify": "^4.0.0",
"zod": "^3.21.0",
"@ts-rest/core": "3.28.0"
"@ts-rest/core": "3.30.0"
},

@@ -14,6 +14,2 @@ "peerDependenciesMeta": {

},
"typedoc": {
"entryPoint": "./src/index.ts",
"tsconfig": "./tsconfig.lib.json"
},
"module": "./index.mjs",

@@ -20,0 +16,0 @@ "main": "./index.js",

@@ -7,13 +7,26 @@ # ts-rest

<p align="center">RPC-like client and server helpers for a magical end to end typed experience</p>
<p align="center">Incrementally adoptable 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>
<a href="https://github.com/ts-rest/ts-rest">
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/ts-rest/ts-rest"/>
</a>
<a href="https://www.npmjs.com/package/@ts-rest/core">
<img src="https://img.shields.io/npm/dm/%40ts-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>
<a href="https://bundlephobia.com/package/@ts-rest/core">
<img alt="Bundle Size" src="https://img.shields.io/bundlephobia/minzip/@ts-rest/core?label=%40ts-rest%2Fcore"/>
</a>
</p>
<div align="center">
<div>Join us on Discord for help, feedback, and discussions!</div><br></br>
<a href="https://discord.gg/2Megk85k5a">
<img src="https://discordapp.com/api/guilds/1055855205960392724/widget.png?style=banner2" alt="Discord Shield"/>
</a>
</div>
# Introduction

@@ -25,10 +38,13 @@

- End to end type safety ๐Ÿ›Ÿ
- RPC-like client side interface ๐Ÿ“ก
- [Tiny bundle size ๐ŸŒŸ](https://bundlephobia.com/package/@ts-rest/core) (1kb!)
- Well-tested and production ready โœ…
- End-to-end type safety ๐Ÿ›Ÿ
- RPC-like client side API โšก๏ธ
- Small Bundle Size ๐Ÿ“‰
- No Code Generation ๐Ÿƒโ€โ™€๏ธ
- Zod support for runtime type checks ๐Ÿ‘ฎโ€โ™€๏ธ
- Zod support for runtime validation ๐Ÿ”’
- Full optional OpenAPI integration ๐Ÿ“
<div align="center">
<h3>๐Ÿ‘‰ Start reading the official <a href="https://ts-rest.com/docs/quickstart?utm_source=github&utm_medium=documentation&utm_campaign=readme">Quickstart Guide</a> ๐Ÿ‘ˆ</h3>
</div>
### Super Simple Example

@@ -57,7 +73,7 @@

Fulfil the contract on your server, with a type-safe router:
Fulfill the contract on your server, with a type-safe router:
```typescript
const router = s.router(contract, {
getPost: async ({ params: { id } }) => {
getPosts: async ({ params: { id } }) => {
return {

@@ -83,27 +99,11 @@ status: 200,

Install the core package
```bash
yarn add @ts-rest/core
# Optional react-query integration
yarn add @ts-rest/react-query
# Pick your backend
yarn add @ts-rest/nest @ts-rest/express
# For automatic server OpenAPI gen
yarn add @ts-rest/open-api
```
Create a contract, implement it on your server then consume it in your client. Incrementally adopt, trial it with your team, then get shipping faster.
<div align="center">
<h3>๐Ÿ‘‰ Read more on the official <a href="https://ts-rest.com/docs/quickstart?utm_source=github&utm_medium=documentation&utm_campaign=readme">Quickstart Guide</a> ๐Ÿ‘ˆ</h3>
<h3>๐Ÿ‘‰ Start reading the official <a href="https://ts-rest.com/docs/quickstart?utm_source=github&utm_medium=documentation&utm_campaign=readme">Quickstart Guide</a> ๐Ÿ‘ˆ</h3>
</div>
## Star History
[![Star History Chart](https://api.star-history.com/svg?repos=ts-rest/ts-rest&type=Timeline)](https://star-history.com/#ts-rest/ts-rest&Timeline)
## Contributors โœจ
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
MASSIVE Thanks to all of these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)), who have helped make ts-rest possible:

@@ -129,2 +129,5 @@ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->

<td align="center" valign="top" width="14.28%"><a href="https://nad.dev"><img src="https://avatars.githubusercontent.com/u/6670753?v=4?s=100" width="100px;" alt="Neil A. Dobson"/><br /><sub><b>Neil A. Dobson</b></sub></a><br /><a href="https://github.com/ts-rest/ts-rest/commits?author=neildobson-au" title="Code">๐Ÿ’ป</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/dohaicuong"><img src="https://avatars.githubusercontent.com/u/20808725?v=4?s=100" width="100px;" alt="Eric Do"/><br /><sub><b>Eric Do</b></sub></a><br /><a href="https://github.com/ts-rest/ts-rest/commits?author=dohaicuong" title="Documentation">๐Ÿ“–</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/fruchtzwerg"><img src="https://avatars.githubusercontent.com/u/15377955?v=4?s=100" width="100px;" alt="Ben"/><br /><sub><b>Ben</b></sub></a><br /><a href="https://github.com/ts-rest/ts-rest/commits?author=fruchtzwerg" title="Code">๐Ÿ’ป</a> <a href="https://github.com/ts-rest/ts-rest/commits?author=fruchtzwerg" title="Documentation">๐Ÿ“–</a> <a href="https://github.com/ts-rest/ts-rest/commits?author=fruchtzwerg" title="Tests">โš ๏ธ</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://llllvvuu.dev"><img src="https://avatars.githubusercontent.com/u/5601392?v=4?s=100" width="100px;" alt="LW"/><br /><sub><b>LW</b></sub></a><br /><a href="https://github.com/ts-rest/ts-rest/commits?author=llllvvuu" title="Code">๐Ÿ’ป</a> <a href="https://github.com/ts-rest/ts-rest/issues?q=author%3Allllvvuu" title="Bug reports">๐Ÿ›</a></td>
</tr>

@@ -139,5 +142,24 @@ </tbody>

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
## Star History
<div style={{paddingTop: "25px"}}>
Since our first commit in 2022 we've been growing steadily. We're proud of our progress and we're excited about the future.
<div align="center">
<a href="https://star-history.com/#ts-rest/ts-rest&Timeline">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=ts-rest/ts-rest&type=Timeline&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=ts-rest/ts-rest&type=Timeline" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=ts-rest/ts-rest&type=Timeline" />
</picture>
</a>
</div>
<div align="center" >
<div>Join us on Discord for help, feedback, and discussions!</div><br></br>
<a href="https://discord.gg/2Megk85k5a">
<img src="https://discordapp.com/api/guilds/1055855205960392724/widget.png?style=banner2" alt="Discord Shield"/>
</a>
</div>
<div align="center">
<a

@@ -144,0 +166,0 @@ href="https://vercel.com/?utm_source=ts-rest&utm_campaign=oss"

export * from './lib/ts-rest-fastify';

@@ -16,3 +16,3 @@ import { AppRoute, AppRouter, ServerInferRequest, ServerInferResponses } from '@ts-rest/core';

type RecursiveRouterObj<T extends AppRouter> = {
[TKey in keyof T]: T[TKey] extends AppRouter ? RecursiveRouterObj<T[TKey]> : T[TKey] extends AppRoute ? AppRouteImplementation<T[TKey]> : never;
[TKey in keyof T]: T[TKey] extends AppRouter ? InitialisedRouter<T[TKey]> | RecursiveRouterObj<T[TKey]> : T[TKey] extends AppRoute ? AppRouteImplementation<T[TKey]> : never;
};

@@ -19,0 +19,0 @@ type InitialisedRouter<TContract extends AppRouter> = {

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