import { Sequelize, Op, QueryTypes } from 'sequelize'; import type { DataTypes, Model, ModelStatic, QueryOptions, Transaction, TransactionOptions } from 'sequelize'; type EntityModel = ModelStatic & { associate?: (entities: Record) => void; }; type SequelizeStatic = typeof Sequelize & { DataTypes: typeof DataTypes; Op: typeof Op; QueryTypes: typeof QueryTypes; }; export default class Entities { entitiesPath: string; sequelize: Sequelize | (() => Sequelize) | null; entities: Record; scanned: boolean; constructor(entitiesPath: string, sequelizeInstance?: Sequelize | (() => Sequelize) | null); /** * Add tracer info to end of SQL query logging */ static addTracer(options?: Record): Record & { benchmark: boolean; logging: (...args: unknown[]) => void; }; /** * Scan all entity schemas under a special path */ scan(entitiesPath: string, withAssociate?: boolean): this; /** * Init sequelize instance from DI config */ init(withAssociate?: boolean): this | Sequelize | (() => Sequelize); /** * Shortcut for Sequelize query */ query(sql: string, bind?: Record, options?: QueryOptions): Promise; /** * A shortcut to prevent repeat insert */ uniqueInsert({ tableName, input, uniqueCondition, transaction }: { tableName: string; input: Record; uniqueCondition: string | Record; transaction?: Transaction; }, options?: QueryOptions): Promise<[unknown[], unknown]>; /** * A short cut to start a database transaction */ getTransaction(options?: TransactionOptions): Promise; getSequelize(): SequelizeStatic; getInstance(): Sequelize; get(name: string): T; getAll(): Record; } export {};