@dans98/prismabox
Version:
Typebox generator for prisma schema
18 lines (15 loc) • 513 B
text/typescript
import type { DMMF } from "@prisma/generator-helper";
import type { ProcessedModel } from "../model";
import { stringifyPlain } from "./plain";
export const processedPlainInput: ProcessedModel[] = [];
export function processPlainInput(
models: DMMF.Model[] | Readonly<DMMF.Model[]>,
) {
for (const m of models) {
const o = stringifyPlain(m, true);
if (o) {
processedPlainInput.push({ name: m.name, stringRepresentation: o });
}
}
Object.freeze(processedPlainInput);
}