import type { Class } from '@travetto/runtime'; import type { ModelType } from '@travetto/model'; import type { ModelQuery, PageableModelQuery } from '../model/query.ts'; /** * The contract for a model service with query support * @concrete */ export interface ModelQuerySupport { /** * Executes a query against the model space * @param cls The model class * @param query The query to execute */ query(cls: Class, query: PageableModelQuery): Promise; /** * Find one by query, fail if not found * @param cls The model class * @param query The query to search for * @param failOnMany Should the query fail on more than one result found, defaults to true */ queryOne(cls: Class, query: ModelQuery, failOnMany?: boolean): Promise; /** * Find the count of matching documents by query. * @param cls The model class * @param query The query to count for */ queryCount(cls: Class, query: ModelQuery): Promise; }