/** * ObjectQL * Copyright (c) 2026-present ObjectStack Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import { UnifiedQuery, Filter } from "./query"; /** * Repository interface for CRUD operations on a single object type. * * Note: `object` is used for filter/query parameters instead of `Record` * because named TypeScript interfaces (e.g., UnifiedQuery, Filter) lack implicit index * signatures and are not assignable to `Record`. * * @typeParam T - The document shape returned by queries. Defaults to `Record`. */ export interface IObjectRepository> { find(query?: UnifiedQuery): Promise; findOne(idOrQuery: string | number | UnifiedQuery): Promise; count(filters: Filter | object): Promise; create(doc: Record): Promise; update(id: string | number, doc: Record, options?: Record): Promise; delete(id: string | number): Promise; aggregate(query: object): Promise; distinct(field: string, filters?: Filter | object): Promise; findOneAndUpdate?(filters: Filter | object, update: Record, options?: Record): Promise; createMany(data: Record[]): Promise; updateMany(filters: Filter | object, data: Record): Promise; deleteMany(filters: Filter | object): Promise; execute(actionName: string, id: string | number | undefined, params: Record): Promise; }