import type { Class, DeepPartial } from '@travetto/runtime'; import type { ModelType, OptionalId } from '../types/model.ts'; import type { ModelBasicSupport } from './basic.ts'; /** * Support for simple indexed activity * * @concrete */ export interface ModelIndexedSupport extends ModelBasicSupport { /** * Get entity by index as defined by fields of idx and the body fields * @param cls The type to search by * @param idx The index name to search against * @param body The payload of fields needed to search */ getByIndex(cls: Class, idx: string, body: DeepPartial): Promise; /** * Delete entity by index as defined by fields of idx and the body fields * @param cls The type to search by * @param idx The index name to search against * @param body The payload of fields needed to search */ deleteByIndex(cls: Class, idx: string, body: DeepPartial): Promise; /** * List entity by ranged index as defined by fields of idx and the body fields * @param cls The type to search by * @param idx The index name to search against * @param body The payload of fields needed to search */ listByIndex(cls: Class, idx: string, body?: DeepPartial): AsyncIterable; /** * Upsert by index, allowing the index to act as a primary key * @param cls The type to create for * @param idx The index name to use * @param body The document to potentially store */ upsertByIndex(cls: Class, idx: string, body: OptionalId): Promise; }