Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@kakasoo/sortable
Advanced tools
$ npm i @kakasoo/sortable
This is very simple function to create object for make prisma
orderBy statement.
For example, you can just write user.articles.created_at
as parameter, like below code.
getSortable("user.articles.created_at", "desc"); // { user: { articles: { created_at: "desc" } } }
Because it is a type inference, it is much easier to use if you create and use a function in advance.
namespace IUser {
namespace IRequest {
type SortbaleColumns =
| "user.articles.created_at"
| "user.articles.updated_at";
}
}
export const orderBy = <T extends IUser.IRequest.SortableColumns>(
key: T,
direction: "asc" | "desc"
) => {
return getSortable(
key,
direction
) satisfies Prisma.usersOrderByWithRelationInput;
};
then, You can use like it, Right?
prisma.user.findMany({
orderBy: orderBy("user.articles.created_at", "desc"),
});
interface Example {
user: {
name: string;
createdAt: string;
};
}
// #1
const sortable = createSortable<Example>();
sortable("user.createdAt", "asc"); // It guarantees type inference.
// #2
// also you can use like this:
createSortable<Example>()("user.createdAt", "asc");
FAQs
## getSortable
We found that @kakasoo/sortable demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.