
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
prisma-json-types-generator
Advanced tools
// schema.prisma
generator client {
provider = "prisma-client-js"
binaryTargets = ["windows", "native"]
}
/// >>> ALWAYS PUT AFTER THE PRISMA CLIENT GENERATOR <<<
generator test {
provider = "prisma-json-types-generator"
namespace = "PrismaJson" // default
output = "./custom.d.ts" // defaults to where the prisma client is generated.
// uses ./ to resolve from this schema path, or an importable path to resolve with require.resolve
}
model Test {
/// @json("NormalType")
field Json
/// @json("OptionalType")
field2 Json
/// @json("ArrayType")
field3 Json
}
// index.ts
declare global {
namespace PrismaJson {
type NormalType = boolean;
type OptionalType = { a: number } | null;
type ArrayType = { a: number }[];
// you can use classes, interfaces, types, etc.
}
}
// myFile.ts
import { Test } from '@prisma/client';
const test: Test = {
// Intellisense works!
};
It works by using the typescript compiler api to interpret all emitted type declarations and changes their field type in the original file.
⚠️ It just changes the declaration files of your generated client, no runtime code is affected!
type
declarations won't work. (see
https://github.com/prisma/prisma/issues/13726)FAQs
Changes JsonValues to your custom typescript type
The npm package prisma-json-types-generator receives a total of 146,604 weekly downloads. As such, prisma-json-types-generator popularity was classified as popular.
We found that prisma-json-types-generator 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.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.