28 lines
1.6 KiB
TypeScript
28 lines
1.6 KiB
TypeScript
|
|
import { type ISavedSync } from "./index.ts";
|
||
|
|
import { type IEvent, type IStateEventWithRoomId, type IStoredClientOpts, type ISyncResponse } from "../matrix.ts";
|
||
|
|
import { type IndexedToDeviceBatch, type ToDeviceBatchWithTxnId } from "../models/ToDeviceMessage.ts";
|
||
|
|
import { type SyncUserProfile } from "../models/user.ts";
|
||
|
|
export interface IIndexedDBBackend {
|
||
|
|
connect(onClose?: () => void): Promise<void>;
|
||
|
|
syncToDatabase(userTuples: UserTuple[]): Promise<void>;
|
||
|
|
isNewlyCreated(): Promise<boolean>;
|
||
|
|
setSyncData(syncData: ISyncResponse): Promise<void>;
|
||
|
|
getSavedSync(): Promise<ISavedSync | null>;
|
||
|
|
getNextBatchToken(): Promise<string>;
|
||
|
|
clearDatabase(): Promise<void>;
|
||
|
|
getOutOfBandMembers(roomId: string): Promise<IStateEventWithRoomId[] | null>;
|
||
|
|
setOutOfBandMembers(roomId: string, membershipEvents: IStateEventWithRoomId[]): Promise<void>;
|
||
|
|
clearOutOfBandMembers(roomId: string): Promise<void>;
|
||
|
|
getUserPresenceEvents(): Promise<UserTuple[]>;
|
||
|
|
getClientOptions(): Promise<IStoredClientOpts | undefined>;
|
||
|
|
storeClientOptions(options: IStoredClientOpts): Promise<void>;
|
||
|
|
saveToDeviceBatches(batches: ToDeviceBatchWithTxnId[]): Promise<void>;
|
||
|
|
getOldestToDeviceBatch(): Promise<IndexedToDeviceBatch | null>;
|
||
|
|
removeToDeviceBatch(id: number): Promise<void>;
|
||
|
|
getUserProfile(userId: string): Promise<SyncUserProfile | undefined>;
|
||
|
|
storeUserProfiles(userProfiles: Map<string, SyncUserProfile>): Promise<void>;
|
||
|
|
removeUserProfiles(userIds: string[]): Promise<void>;
|
||
|
|
destroy(): Promise<void>;
|
||
|
|
}
|
||
|
|
export type UserTuple = [userId: string, presenceEvent: Partial<IEvent>];
|
||
|
|
//# sourceMappingURL=indexeddb-backend.d.ts.map
|