import type { Schema } from '../schema/Schema'; import type { MultiMap } from '../utils/MultiMap'; import type { Stream, StreamEvent, StreamDispatcher } from "@andyfischer/streams"; import type { StatusTableItem } from '../statustable/StatusTable'; import type { DiffItem } from './diff'; import type { StreamToTableCallbacks } from './streamToTable'; import type { CustomFormatOptions } from './debugFunctions'; import { TableIndex } from './TableIndex'; import { TableListenPlan, ListenToTableOptions } from './Listeners'; export interface Table { schema: Schema; indexType?: TableIndexType; items?: any; attrData?: Map; indexes?: Map; defaultIndex?: TableIndex; insert(item: ItemType): ItemType; set(item: ItemType): void; get(): ItemType; listAll(): ItemType[]; itemEquals(item1: ItemType, item2: ItemType): boolean; item_to_uniqueKey(item: ItemType): any; item_matches_uniqueKey(item: ItemType, uniqueKey: any): boolean; deleteItem(item: ItemType): void; delete_with_uniqueKey(uniqueKey: any): void; supportsFunc(funcName: string): boolean; assertSupport(funcName: string): void; checkInvariants(): void; listenerStreams: StreamDispatcher; listen(options?: ListenToTableOptions): Stream; listenToStream(stream: Stream, callbacks?: StreamToTableCallbacks): void; receiveUpdate(evt: StreamEvent): void; toStream(): Stream; diff(compare: Table): IterableIterator; status: Table; isLoading(): boolean; hasError(): boolean; waitForData(): Promise; consoleLog(options?: CustomFormatOptions): void; each(): IterableIterator; eachWithFilter(condition: (item: ItemType) => boolean): IterableIterator; t: 'table'; [funcName: string]: any; } export interface MultiMapIndex { indexType: 'multimap'; items: MultiMap; } export interface MapIndex { indexType: 'map'; items: Map; } export interface ListIndex { indexType: 'list'; items: Array; } export interface SingleValueIndex { indexType: 'single_value'; items: any[]; } export type TableIndexType = 'map' | 'list' | 'multimap' | 'single_value';