A store for most of the data js-sdk needs to store, apart from crypto data

interface IStore {
    accountData: Map<string, MatrixEvent>;
    on?: ((event: "closed" | EventEmitterEvents | "degraded", handler: ((...args: any[]) => void)) => void);
    clearOutOfBandMembers(roomId: string): Promise<void>;
    deleteAllData(): Promise<void>;
    destroy(): Promise<void>;
    getAccountData(eventType: string): undefined | MatrixEvent;
    getClientOptions(): Promise<undefined | IStartClientOpts>;
    getFilter(userId: string, filterId: string): null | Filter;
    getFilterIdByName(filterName: string): null | string;
    getOldestToDeviceBatch(): Promise<null | IndexedToDeviceBatch>;
    getOutOfBandMembers(roomId: string): Promise<null | IStateEventWithRoomId[]>;
    getPendingEvents(roomId: string): Promise<Partial<IEvent>[]>;
    getRoom(roomId: string): null | Room;
    getRooms(): Room[];
    getRoomSummaries(): RoomSummary[];
    getSavedSync(): Promise<null | ISavedSync>;
    getSavedSyncToken(): Promise<null | string>;
    getSyncToken(): null | string;
    getUser(userId: string): null | User;
    getUsers(): User[];
    isNewlyCreated(): Promise<boolean>;
    removeRoom(roomId: string): void;
    removeToDeviceBatch(id: number): Promise<void>;
    save(force?: boolean): Promise<void>;
    saveToDeviceBatches(batch: ToDeviceBatchWithTxnId[]): Promise<void>;
    scrollback(room: Room, limit: number): MatrixEvent[];
    setFilterIdByName(filterName: string, filterId?: string): void;
    setOutOfBandMembers(roomId: string, membershipEvents: IStateEventWithRoomId[]): Promise<void>;
    setPendingEvents(roomId: string, events: Partial<IEvent>[]): Promise<void>;
    setSyncData(syncData: ISyncResponse): Promise<void>;
    setSyncToken(token: string): void;
    setUserCreator(creator: UserCreator): void;
    startup(): Promise<void>;
    storeAccountDataEvents(events: MatrixEvent[]): void;
    storeClientOptions(options: IStartClientOpts): Promise<void>;
    storeEvents(room: Room, events: MatrixEvent[], token: null | string, toStart: boolean): void;
    storeFilter(filter: Filter): void;
    storeRoom(room: Room): void;
    storeUser(user: User): void;
    wantsSave(): boolean;
}

Implemented by

Properties

accountData: Map<string, MatrixEvent>
on?: ((event: "closed" | EventEmitterEvents | "degraded", handler: ((...args: any[]) => void)) => void)

Methods

  • Delete all data from this store. Does nothing since this store doesn't store anything.

    Returns Promise<void>

    An immediately resolved promise.

  • Retrieve a filter.

    Parameters

    • userId: string
    • filterId: string

    Returns null | Filter

    A filter or null.

  • Retrieve a filter ID with the given name.

    Parameters

    • filterName: string

      The filter name.

    Returns null | string

    The filter ID or null.

  • Retrieve a room by its' room ID.

    Parameters

    • roomId: string

      The room ID.

    Returns null | Room

    The room or null.

  • Returns Promise<null | string>

    If there is a saved sync, the nextBatch token for this sync, otherwise null.

  • Retrieve a User by its' user ID.

    Parameters

    • userId: string

      The user ID.

    Returns null | User

    The user or null.

  • Permanently delete a room.

    Parameters

    • roomId: string

    Returns void

  • Retrieve scrollback for this room.

    Parameters

    • room: Room

      The matrix room

    • limit: number

      The max number of old events to retrieve.

    Returns MatrixEvent[]

    An array of objects which will be at most 'limit' length and at least 0. The objects are the raw event JSON.

  • Set a filter name to ID mapping.

    Parameters

    • filterName: string
    • OptionalfilterId: string

    Returns void

  • Stores the out-of-band membership events for this room. Note that it still makes sense to store an empty array as the OOB status for the room is marked as fetched, and getOutOfBandMembers will return an empty array instead of null

    Parameters

    Returns Promise<void>

    when all members have been stored

  • Set the sync token.

    Parameters

    • token: string

    Returns void

  • Set the user creator which is used for creating User objects

    Parameters

    • creator: UserCreator

      A callback that accepts an user-id and returns an User object

    Returns void

  • Store user-scoped account data events

    Parameters

    Returns void

  • Store events for a room.

    Parameters

    • room: Room

      The room to store events for.

    • events: MatrixEvent[]

      The events to store.

    • token: null | string

      The token associated with these events.

    • toStart: boolean

      True if these are paginated results.

    Returns void

  • Store the given room.

    Parameters

    • room: Room

      The room to be stored. All properties must be stored.

    Returns void

  • We never want to save because we have nothing to save to.

    Returns boolean

    If the store wants to save