Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
tscont aims to allow for the creation of type safe contracts to be upheld by producers and consumers of the contract.
Some end-to-end type safe libraries such as tRPC are amazing, however, they aren't able to separate the contract from the implementation, in situations with published packages or wanting to avoid unnecessary rebuilds with tools such as NX this is a problem.
One example of this is with NX, in NX you can rebuild only "affected" packages, however, if you export your contract (e.g. tRPC) from the backend, your front end will need to be rebuilt as well.
Unlike tRPC, tscont aims to separate the contract from the server-side implementation, this adds another "jump" to go client->contract->server, however, this additional step provides a much better dev experience in Monorepos with NX.
Contract
import { initTsCont } from 'tscont';
const c = initTsCont();
export type Post = {
id: number;
title: string;
body: string;
};
export const router = c.router({
posts: c.router({
getPost: c.query({
method: 'GET',
path: ({ id }: { id: string }) => `/posts/${id}`,
response: c.response<Post>(),
}),
getPosts: c.query({
method: 'GET',
path: () => '/posts',
response: c.response<Post[]>(),
}),
}),
});
Client
const client = initClient(router, {
api: fetchApi,
baseUrl: 'http://localhost:3333',
baseHeaders: {},
});
const { data } = await client.posts.getPosts();
Server
const server = initServer(router, {
api: fetchApi,
baseUrl: 'http://localhost:3333',
baseHeaders: {},
});
// TRPC-like type-safe generation or just extract input/output types
FAQs
## Motivation
The npm package tscont receives a total of 0 weekly downloads. As such, tscont popularity was classified as not popular.
We found that tscont demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.