Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
prisma-kysely
Advanced tools
Generate Kysely database types from a Prisma schema
🚧 Library and README in progress...
Do you like Prisma's migration flow, schema language and DX but not the limitations of the Prisma Client? Do you want to harness the raw power of SQL without losing the safety of the TypeScript type system?
Enter prisma-kysely
!
Install prisma-kysely
using your package manager of choice:
yarn add prisma-kysely
Replace the default client generator in your schema.prisma
file with the following:
generator kysely {
provider = "prisma-kysely"
// Optionally provide a destination directory for the generated file
// and a filename of your choice
output = "../src/db"
fileName = "types.ts"
}
Run prisma migrate dev
or prisma generate
and use your freshly generated types when instantiating Kysely!
prisma-kysely
is meant as a more convenient alternative to kysely-codegen
for those that use Prisma only for migrations. The package makes sure that Kysely's types are always up to date with the latest database schema. prisma-kysely
also has better support for enums than kysely-codegen
does. The author has used Prisma Migrate and Kysely together with Postgres and Cloudflare's D1 daily for a few months now and is really happy with the combo, but this has been the missing piece needed to make workflow super smooth.
Key | Description |
---|---|
output | The directory where generated code will be saved |
fileName | The filename for the generated file |
[typename]TypeOverride | Allows you to override the resulting TypeScript type for any Prisma type. Useful when targeting a different environment than Node (e.g. WinterCG compatible runtimes that use UInt8Arrays instead of Buffers for binary types etc.) Check out the config validator for a complete list of options. |
OMG you actually want to contribute? I'm so thankful! 🙇♂️
Here's everything you need to do (let me know if something's missing...)
yarn install
and yarn dev
to start tsc
in watch mode.prisma/schema.prisma
, running yarn prisma generate
and checking the output in prisma/types.ts
.I'm not 100% sure the type maps are correct for every dialect, so any and all contributions on that front would be greatly appreciated. The same goes for any bug you come across or improvement you can think of.
prisma-dbml-generator
. Many-too-many thanks to them!+ 🥹 Make Codd proud!
FAQs
Generate Kysely database types from a Prisma schema
We found that prisma-kysely demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.