import type { Constructor } from '../utils/mixins'; import type { BaseRecord, TagsBase } from './BaseRecord'; export declare type SimpleQuery = Partial> & TagsBase; interface AdvancedQuery { $and?: Query[]; $or?: Query[]; $not?: Query; } export declare type Query = AdvancedQuery | SimpleQuery; export interface BaseRecordConstructor extends Constructor { type: string; } export interface StorageService> { /** * Save record in storage * * @param record the record to store * @throws {RecordDuplicateError} if a record with this id already exists */ save(record: T): Promise; /** * Update record in storage * * @param record the record to update * @throws {RecordNotFoundError} if a record with this id and type does not exist */ update(record: T): Promise; /** * Delete record from storage * * @param record the record to delete * @throws {RecordNotFoundError} if a record with this id and type does not exist */ delete(record: T): Promise; /** * Get record by id. * * @param recordClass the record class to get the record for * @param id the id of the record to retrieve from storage * @throws {RecordNotFoundError} if a record with this id and type does not exist */ getById(recordClass: BaseRecordConstructor, id: string): Promise; /** * Get all records by specified record class. * * @param recordClass the record class to get records for */ getAll(recordClass: BaseRecordConstructor): Promise; /** * Find all records by specified record class and query. * * @param recordClass the record class to find records for * @param query the query to use for finding records */ findByQuery(recordClass: BaseRecordConstructor, query: Query): Promise; } export {};