import TypesInternal from "@prismicio/types-internal/lib/customtypes/index.js"; import { CUSTOM_TYPE_MODEL_FILENAME } from "./constants"; import { readCustomTypeFile, ReadCustomTypeFileArgs, } from "./readCustomTypeFile"; export type ReadCustomTypeModelArgs = Omit; export type ReadCustomTypeModelReturnType = { model: TypesInternal.CustomType; }; export const readCustomTypeModel = async ( args: ReadCustomTypeModelArgs, ): Promise => { const model = await readCustomTypeFile({ ...args, filename: CUSTOM_TYPE_MODEL_FILENAME, encoding: "utf8", }); return { model: JSON.parse(model), }; };