import { BuildOptions , DataTypes , Model , Sequelize } from 'sequelize' ; export interface Metadata { key : string ; value : number | string | boolean ; } export interface MetadataModel extends Model < Metadata > , Metadata { } export type MetadataRepo = typeof Model & { new ( values ? , options ? ) : MetadataModel ; } ; export function MetadataFactory ( sequelize , schema ) { return < MetadataRepo > sequelize . define ( `_metadata` , { key : { type : DataTypes . STRING , primaryKey : true , } , value : { type : DataTypes . JSONB , } , } , { freezeTableName : true , schema : schema } ) ; }