import { EventEmitter } from 'events'; export interface CrudEvent { created: [T[]]; updated: [T[]]; deleted: [T[]]; } /** * Represents a generic CRUD repository. * * @template T - The type of the values stored in the repository. */ export declare abstract class CrudRepository extends EventEmitter { constructor(); /** * Creates a new entry in the database with the specified value. */ create(tenantId: number, value: T, namespace?: string): Promise; /** * Attempts to read a value from storage based on the given query, or throws if more than one value is found. */ readOnlyOneByQuery(tenantId: number, query: object, namespace?: string): Promise; /** * Reads a value from storage or creates it if none exists. */ readOrCreateByQuery(tenantId: number, query: object, namespace?: string): Promise<[T, boolean]>; /** * Updates the value associated with the given key. */ updateByKey(tenantId: number, value: Partial, key: string, namespace?: string): Promise; /** * Updates all values matching the given query. */ updateAllByQuery(tenantId: number, value: Partial, query: object, namespace?: string): Promise; /** * Deletes the entry with the given key. */ deleteByKey(tenantId: number, key: string, namespace?: string): Promise; /** * Deletes all values associated with a query from the specified namespace. */ deleteAllByQuery(tenantId: number, query: object, namespace?: string): Promise; abstract readByKey(tenantId: number, key: string | number, namespace?: string): Promise; abstract readAllByQuery(tenantId: number, query: object, namespace?: string): Promise; abstract readNextValue(tenantId: number, columnName: string, query?: object, startValue?: number, namespace?: string): Promise; abstract existsByKey(tenantId: number, key: string, namespace?: string): Promise; abstract existByQuery(tenantId: number, query: object, namespace?: string): Promise; protected abstract _create(tenantId: number, value: T, namespace?: string): Promise; protected abstract _readOrCreateByQuery(tenantId: number, query: object, namespace?: string): Promise<[T, boolean]>; protected abstract _updateByKey(tenantId: number, value: Partial, key: string, namespace?: string): Promise; protected abstract _updateAllByQuery(tenantId: number, value: Partial, query: object, namespace?: string): Promise; protected abstract _deleteByKey(tenantId: number, key: string, namespace?: string): Promise; protected abstract _deleteAllByQuery(tenantId: number, query: object, namespace?: string): Promise; }