Skip to content

Commit 3df1c4b

Browse files
authored
Merge pull request #1779 from matrix-org/t3chguy/ts/c2
2 parents 6ada02e + f9005c3 commit 3df1c4b

12 files changed

+436
-421
lines changed
File renamed without changes.

src/store/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { User } from "../models/user";
2121
import { IEvent, MatrixEvent } from "../models/event";
2222
import { Filter } from "../filter";
2323
import { RoomSummary } from "../models/room-summary";
24-
import { IMinimalEvent, IGroups, IRooms } from "../sync-accumulator";
24+
import { IMinimalEvent, IGroups, IRooms, ISyncResponse } from "../sync-accumulator";
2525
import { IStartClientOpts } from "../client";
2626

2727
export interface ISavedSync {
@@ -185,7 +185,7 @@ export interface IStore {
185185
* @param {Object} syncData The sync data
186186
* @return {Promise} An immediately resolved promise.
187187
*/
188-
setSyncData(syncData: object): Promise<void>;
188+
setSyncData(syncData: ISyncResponse): Promise<void>;
189189

190190
/**
191191
* We never want to save because we have nothing to save to.
@@ -233,5 +233,5 @@ export interface IStore {
233233

234234
getClientOptions(): Promise<IStartClientOpts>;
235235

236-
storeClientOptions(options: object): Promise<void>;
236+
storeClientOptions(options: IStartClientOpts): Promise<void>;
237237
}

src/store/indexeddb-backend.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
Copyright 2021 The Matrix.org Foundation C.I.C.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
import { ISavedSync } from "./index";
18+
import { IEvent, IStartClientOpts, ISyncResponse } from "..";
19+
20+
export interface IIndexedDBBackend {
21+
connect(): Promise<void>;
22+
syncToDatabase(userTuples: UserTuple[]): Promise<void>;
23+
isNewlyCreated(): Promise<boolean>;
24+
setSyncData(syncData: ISyncResponse): Promise<void>;
25+
getSavedSync(): Promise<ISavedSync>;
26+
getNextBatchToken(): Promise<string>;
27+
clearDatabase(): Promise<void>;
28+
getOutOfBandMembers(roomId: string): Promise<IEvent[] | null>;
29+
setOutOfBandMembers(roomId: string, membershipEvents: IEvent[]): Promise<void>;
30+
clearOutOfBandMembers(roomId: string): Promise<void>;
31+
getUserPresenceEvents(): Promise<UserTuple[]>;
32+
getClientOptions(): Promise<IStartClientOpts>;
33+
storeClientOptions(options: IStartClientOpts): Promise<void>;
34+
}
35+
36+
export type UserTuple = [userId: string, presenceEvent: Partial<IEvent>];

0 commit comments

Comments
 (0)