kanel-kysely
Version:
Kysely extension for Kanel
18 lines (17 loc) • 1.06 kB
TypeScript
import { type CompositeDetails, type InterfacePropertyDeclaration, type PgTsGeneratorContext, type TsFileContents, type TypeImport } from "kanel";
import type MakeKyselyConfig from "./MakeKyselyConfig";
/**
* This is a quirky way to get Kysely interfaces. Basically, what happens is that this
* hook will filter out initializer and mutators. It takes the selector and transforms
* it into the Kysely *Table interface, by going over each property. In the end,
* it adds the New* and *Update types as per the Kysely documentation.
*
* This only works when the output from Kanel is close to the default configuration,
* if you've changed things around too much it will probably not work.
*/
declare const processFile: (declarations: TsFileContents["declarations"], compositeDetails: CompositeDetails, path: string, makeKyselyConfig: MakeKyselyConfig, pgTsContext: PgTsGeneratorContext) => {
modifiedDeclarations: TsFileContents["declarations"];
tableImport: TypeImport;
tableProperty: InterfacePropertyDeclaration;
};
export default processFile;