Preview: get-model-by-name.js
Size: 425 B
/proc/thread-self/root/home/byroehnu/.trash/node_modules11/@adminjs/prisma/lib/utils/get-model-by-name.js
import { Prisma } from '@prisma/client';
export const getModelByName = (name, clientModule) => {
const dmmf = clientModule?.Prisma.dmmf.datamodel ?? Prisma.dmmf.datamodel;
const model = dmmf.models.find(({ name: modelName }) => modelName === name);
if (!model) {
throw new Error(`Could not find model: "${name}" in Prisma's DMMF!`);
}
return model;
};
//# sourceMappingURL=get-model-by-name.js.map
Directory Contents
Dirs: 0 × Files: 15