diff --git a/src/matrix/storage/idb/QueryTarget.ts b/src/matrix/storage/idb/QueryTarget.ts index cb25657b..ac9e3d16 100644 --- a/src/matrix/storage/idb/QueryTarget.ts +++ b/src/matrix/storage/idb/QueryTarget.ts @@ -21,16 +21,16 @@ type Reducer = (acc: B, val: A) => B type IDBQuery = IDBValidKey | IDBKeyRange interface QueryTargetInterface { - openCursor: (range?: IDBQuery | null , direction?: IDBCursorDirection) => IDBRequest - openKeyCursor: (range?: IDBQuery, direction?: IDBCursorDirection) => IDBRequest - supports: (method: string) => boolean - keyPath: string | string[] - get: (key: IDBQuery) => IDBRequest - getKey: (key: IDBQuery) => IDBRequest + openCursor: (range?: IDBQuery | null , direction?: IDBCursorDirection) => IDBRequest; + openKeyCursor: (range?: IDBQuery, direction?: IDBCursorDirection) => IDBRequest; + supports: (method: string) => boolean; + keyPath: string | string[]; + get: (key: IDBQuery) => IDBRequest; + getKey: (key: IDBQuery) => IDBRequest; } export class QueryTarget { - protected _target: QueryTargetInterface + protected _target: QueryTargetInterface; constructor(target: QueryTargetInterface) { this._target = target; diff --git a/src/matrix/storage/idb/Storage.ts b/src/matrix/storage/idb/Storage.ts index ceab34f9..cc460b26 100644 --- a/src/matrix/storage/idb/Storage.ts +++ b/src/matrix/storage/idb/Storage.ts @@ -21,9 +21,9 @@ import { reqAsPromise } from "./utils"; const WEBKITEARLYCLOSETXNBUG_BOGUS_KEY = "782rh281re38-boguskey"; export class Storage { - private _db: IDBDatabase - private _hasWebkitEarlyCloseTxnBug: boolean - storeNames: { [ name : string] : string } + private _db: IDBDatabase; + private _hasWebkitEarlyCloseTxnBug: boolean; + storeNames: { [ name : string] : string }; constructor(idbDatabase: IDBDatabase, IDBKeyRange, hasWebkitEarlyCloseTxnBug: boolean) { this._db = idbDatabase; diff --git a/src/matrix/storage/idb/StorageFactory.ts b/src/matrix/storage/idb/StorageFactory.ts index dc69d261..93f4c3ac 100644 --- a/src/matrix/storage/idb/StorageFactory.ts +++ b/src/matrix/storage/idb/StorageFactory.ts @@ -26,7 +26,7 @@ const openDatabaseWithSessionId = function(sessionId: string, idbFactory: IDBFac } interface ServiceWorkerHandler { - preventConcurrentSessionAccess: (sessionId: string) => Promise + preventConcurrentSessionAccess: (sessionId: string) => Promise; } async function requestPersistedStorage(): Promise { @@ -47,8 +47,8 @@ async function requestPersistedStorage(): Promise { } export class StorageFactory { - private _serviceWorkerHandler: ServiceWorkerHandler - private _idbFactory: IDBFactory + private _serviceWorkerHandler: ServiceWorkerHandler; + private _idbFactory: IDBFactory; constructor(serviceWorkerHandler: ServiceWorkerHandler, idbFactory: IDBFactory = window.indexedDB, IDBKeyRange = window.IDBKeyRange) { this._serviceWorkerHandler = serviceWorkerHandler; diff --git a/src/matrix/storage/idb/Store.ts b/src/matrix/storage/idb/Store.ts index ffb2dfc1..7dd0b588 100644 --- a/src/matrix/storage/idb/Store.ts +++ b/src/matrix/storage/idb/Store.ts @@ -16,8 +16,8 @@ limitations under the License. import {QueryTarget} from "./QueryTarget"; import {IDBRequestAttemptError} from "./error"; -import {reqAsPromise} from "./utils" -import {Transaction} from "./Transaction" +import {reqAsPromise} from "./utils"; +import {Transaction} from "./Transaction"; const LOG_REQUESTS = false; @@ -28,7 +28,7 @@ function logRequest(method: string, params: any[], source: any) { } class QueryTargetWrapper { - private _qt: IDBIndex | IDBObjectStore + private _qt: IDBIndex | IDBObjectStore; constructor(qt: IDBIndex | IDBObjectStore) { this._qt = qt; @@ -129,7 +129,7 @@ class QueryTargetWrapper { } export class Store extends QueryTarget { - private _transaction: Transaction + private _transaction: Transaction; constructor(idbStore: IDBObjectStore, transaction: Transaction) { super(new QueryTargetWrapper(idbStore)); diff --git a/src/matrix/storage/idb/Transaction.ts b/src/matrix/storage/idb/Transaction.ts index 06ba0801..6ad66f22 100644 --- a/src/matrix/storage/idb/Transaction.ts +++ b/src/matrix/storage/idb/Transaction.ts @@ -36,9 +36,9 @@ import {OperationStore} from "./stores/OperationStore"; import {AccountDataStore} from "./stores/AccountDataStore"; export class Transaction { - private _txn: IDBTransaction - private _allowedStoreNames: string[] - private _stores: { [storeName : string] : any } + private _txn: IDBTransaction; + private _allowedStoreNames: string[]; + private _stores: { [storeName : string] : any }; constructor(txn: IDBTransaction, allowedStoreNames: string[], IDBKeyRange) { this._txn = txn; diff --git a/src/matrix/storage/idb/stores/AccountDataStore.ts b/src/matrix/storage/idb/stores/AccountDataStore.ts index f32f8aee..7538c53e 100644 --- a/src/matrix/storage/idb/stores/AccountDataStore.ts +++ b/src/matrix/storage/idb/stores/AccountDataStore.ts @@ -13,16 +13,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -import {Store} from "../Store" +import {Store} from "../Store"; import {Content} from "../../types"; interface AccountDataEntry { - type: string - content: Content + type: string; + content: Content; } export class AccountDataStore { - private _store: Store + private _store: Store; constructor(store: Store) { this._store = store; diff --git a/src/matrix/storage/idb/stores/DeviceIdentityStore.ts b/src/matrix/storage/idb/stores/DeviceIdentityStore.ts index 12f98d88..b04ce6d7 100644 --- a/src/matrix/storage/idb/stores/DeviceIdentityStore.ts +++ b/src/matrix/storage/idb/stores/DeviceIdentityStore.ts @@ -15,16 +15,16 @@ limitations under the License. */ import {MAX_UNICODE, MIN_UNICODE} from "./common"; -import {Store} from "../Store" +import {Store} from "../Store"; interface DeviceIdentity { - userId: string - deviceId: string - ed25519Key: string - curve25519Key: string - algorithms: string[] - displayName: string - key: string + userId: string; + deviceId: string; + ed25519Key: string; + curve25519Key: string; + algorithms: string[]; + displayName: string; + key: string; } function encodeKey(userId: string, deviceId: string): string { @@ -37,7 +37,7 @@ function decodeKey(key: string): { userId: string, deviceId: string } { } export class DeviceIdentityStore { - private _store: Store + private _store: Store; constructor(store: Store) { this._store = store; diff --git a/src/matrix/storage/idb/stores/GroupSessionDecryptionStore.ts b/src/matrix/storage/idb/stores/GroupSessionDecryptionStore.ts index 25c21b4b..a55bf66b 100644 --- a/src/matrix/storage/idb/stores/GroupSessionDecryptionStore.ts +++ b/src/matrix/storage/idb/stores/GroupSessionDecryptionStore.ts @@ -15,20 +15,20 @@ limitations under the License. */ import {MIN_UNICODE, MAX_UNICODE} from "./common"; -import {Store} from "../Store" +import {Store} from "../Store"; function encodeKey(roomId: string, sessionId: string, messageIndex: number | string): string { return `${roomId}|${sessionId}|${messageIndex}`; } interface GroupSessionDecryption { - eventId: string - timestamp: number - key: string + eventId: string; + timestamp: number; + key: string; } export class GroupSessionDecryptionStore { - private _store: Store + private _store: Store; constructor(store: Store) { this._store = store; diff --git a/src/matrix/storage/idb/stores/InboundGroupSessionStore.ts b/src/matrix/storage/idb/stores/InboundGroupSessionStore.ts index f41ed26b..bc49e146 100644 --- a/src/matrix/storage/idb/stores/InboundGroupSessionStore.ts +++ b/src/matrix/storage/idb/stores/InboundGroupSessionStore.ts @@ -15,16 +15,16 @@ limitations under the License. */ import {MIN_UNICODE, MAX_UNICODE} from "./common"; -import {Store} from "../Store" +import {Store} from "../Store"; interface InboundGroupSession { - roomId: string - senderKey: string - sessionId: string - session?: string - claimedKeys?: { [algorithm : string] : string } - eventIds?: string[] - key: string + roomId: string; + senderKey: string; + sessionId: string; + session?: string; + claimedKeys?: { [algorithm : string] : string }; + eventIds?: string[]; + key: string; } function encodeKey(roomId: string, senderKey: string, sessionId: string) { @@ -32,7 +32,7 @@ function encodeKey(roomId: string, senderKey: string, sessionId: string) { } export class InboundGroupSessionStore { - private _store: Store + private _store: Store; constructor(store: Store) { this._store = store; diff --git a/src/matrix/storage/idb/stores/InviteStore.ts b/src/matrix/storage/idb/stores/InviteStore.ts index 8b500e0e..f8841a71 100644 --- a/src/matrix/storage/idb/stores/InviteStore.ts +++ b/src/matrix/storage/idb/stores/InviteStore.ts @@ -13,25 +13,25 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -import {Store} from "../Store" -import {MemberData} from "./RoomMemberStore" +import {Store} from "../Store"; +import {MemberData} from "./RoomMemberStore"; // TODO: Move to Invite when that's TypeScript. export interface InviteData { - roomId: string - isEncrypted: boolean - isDirectMessage: boolean - name?: string - avatarUrl?: string - avatarColorId: number - canonicalAlias?: string - timestamp: number - joinRule: string - inviter?: MemberData + roomId: string; + isEncrypted: boolean; + isDirectMessage: boolean; + name?: string; + avatarUrl?: string; + avatarColorId: number; + canonicalAlias?: string; + timestamp: number; + joinRule: string; + inviter?: MemberData; } export class InviteStore { - private _inviteStore: Store + private _inviteStore: Store; constructor(inviteStore: Store) { this._inviteStore = inviteStore; diff --git a/src/matrix/storage/idb/stores/OlmSessionStore.ts b/src/matrix/storage/idb/stores/OlmSessionStore.ts index e5a8b5ca..a118b963 100644 --- a/src/matrix/storage/idb/stores/OlmSessionStore.ts +++ b/src/matrix/storage/idb/stores/OlmSessionStore.ts @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -import {Store} from "../Store" +import {Store} from "../Store"; function encodeKey(senderKey: string, sessionId: string): string { return `${senderKey}|${sessionId}`; @@ -25,15 +25,15 @@ function decodeKey(key: string): { senderKey: string, sessionId: string } { } interface OlmSession { - session: string - sessionId: string - senderKey: string - lastUsed: number - key: string + session: string; + sessionId: string; + senderKey: string; + lastUsed: number; + key: string; } export class OlmSessionStore { - private _store: Store + private _store: Store; constructor(store: Store) { this._store = store; diff --git a/src/matrix/storage/idb/stores/OperationStore.ts b/src/matrix/storage/idb/stores/OperationStore.ts index 9fbb15f7..2be6c3d7 100644 --- a/src/matrix/storage/idb/stores/OperationStore.ts +++ b/src/matrix/storage/idb/stores/OperationStore.ts @@ -14,31 +14,31 @@ See the License for the specific language governing permissions and limitations under the License. */ import {MIN_UNICODE, MAX_UNICODE} from "./common"; -import {Store} from "../Store" +import {Store} from "../Store"; export function encodeScopeTypeKey(scope: string, type: string): string { return `${scope}|${type}`; } interface Operation { - id: string - type: string - scope: string - userIds: string[] - scopeTypeKey: string - roomKeyMessage: RoomKeyMessage + id: string; + type: string; + scope: string; + userIds: string[]; + scopeTypeKey: string; + roomKeyMessage: RoomKeyMessage; } interface RoomKeyMessage { - room_id: string - session_id: string - session_key: string - algorithm: string - chain_index: number + room_id: string; + session_id: string; + session_key: string; + algorithm: string; + chain_index: number; } export class OperationStore { - private _store: Store + private _store: Store; constructor(store: Store) { this._store = store; diff --git a/src/matrix/storage/idb/stores/OutboundGroupSessionStore.ts b/src/matrix/storage/idb/stores/OutboundGroupSessionStore.ts index 3e3e781b..5a33ec2c 100644 --- a/src/matrix/storage/idb/stores/OutboundGroupSessionStore.ts +++ b/src/matrix/storage/idb/stores/OutboundGroupSessionStore.ts @@ -13,16 +13,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -import {Store} from "../Store" +import {Store} from "../Store"; interface OutboundSession { - roomId: string - session: string - createdAt: number + roomId: string; + session: string; + createdAt: number; } export class OutboundGroupSessionStore { - private _store: Store + private _store: Store; constructor(store: Store) { this._store = store; diff --git a/src/matrix/storage/idb/stores/PendingEventStore.ts b/src/matrix/storage/idb/stores/PendingEventStore.ts index 3bd1e793..6067c3c4 100644 --- a/src/matrix/storage/idb/stores/PendingEventStore.ts +++ b/src/matrix/storage/idb/stores/PendingEventStore.ts @@ -16,20 +16,20 @@ limitations under the License. import { encodeUint32, decodeUint32 } from "../utils"; import {KeyLimits} from "../../common"; -import {Store} from "../Store" +import {Store} from "../Store"; import {Content} from "../../types"; interface PendingEntry { - roomId: string - queueIndex: number - eventType: string - content: Content - relatexTxnId: string | null - relatedEventId: string | null - txnId?: string - needsEncryption: boolean - needsUpload: boolean - key: string + roomId: string; + queueIndex: number; + eventType: string; + content: Content; + relatexTxnId: string | null; + relatedEventId: string | null; + txnId?: string; + needsEncryption: boolean; + needsUpload: boolean; + key: string; } function encodeKey(roomId: string, queueIndex: number): string { @@ -43,7 +43,7 @@ function decodeKey(key: string): { roomId: string, queueIndex: number } { } export class PendingEventStore { - private _eventStore: Store + private _eventStore: Store; constructor(eventStore: Store) { this._eventStore = eventStore; diff --git a/src/matrix/storage/idb/stores/RoomMemberStore.ts b/src/matrix/storage/idb/stores/RoomMemberStore.ts index efbe6598..1b3df104 100644 --- a/src/matrix/storage/idb/stores/RoomMemberStore.ts +++ b/src/matrix/storage/idb/stores/RoomMemberStore.ts @@ -16,7 +16,7 @@ limitations under the License. */ import {MAX_UNICODE} from "./common"; -import {Store} from "../Store" +import {Store} from "../Store"; function encodeKey(roomId: string, userId: string) { return `${roomId}|${userId}`; @@ -29,18 +29,18 @@ function decodeKey(key: string): { roomId: string, userId: string } { // TODO: Move to RoomMember when that's TypeScript. export interface MemberData { - roomId: string - userId: string - avatarUrl: string - displayName: string - membership: "join" | "leave" | "invite" | "ban" + roomId: string; + userId: string; + avatarUrl: string; + displayName: string; + membership: "join" | "leave" | "invite" | "ban"; } type MemberStorageEntry = MemberData & { key: string } // no historical members export class RoomMemberStore { - private _roomMembersStore: Store + private _roomMembersStore: Store; constructor(roomMembersStore: Store) { this._roomMembersStore = roomMembersStore; diff --git a/src/matrix/storage/idb/stores/RoomStateStore.ts b/src/matrix/storage/idb/stores/RoomStateStore.ts index a206c1ea..d88240a7 100644 --- a/src/matrix/storage/idb/stores/RoomStateStore.ts +++ b/src/matrix/storage/idb/stores/RoomStateStore.ts @@ -24,13 +24,13 @@ function encodeKey(roomId: string, eventType: string, stateKey: string) { } export interface RoomStateEntry { - roomId: string, - event: StateEvent - key: string + roomId: string; + event: StateEvent; + key: string; } export class RoomStateStore { - private _roomStateStore: Store + private _roomStateStore: Store; constructor(idbStore: Store) { this._roomStateStore = idbStore; diff --git a/src/matrix/storage/idb/stores/RoomSummaryStore.ts b/src/matrix/storage/idb/stores/RoomSummaryStore.ts index e4101ad9..19e847b1 100644 --- a/src/matrix/storage/idb/stores/RoomSummaryStore.ts +++ b/src/matrix/storage/idb/stores/RoomSummaryStore.ts @@ -27,12 +27,12 @@ store contains: inviteCount joinCount */ -import {Store} from "../Store" -import {SummaryData} from "../../../room/RoomSummary" +import {Store} from "../Store"; +import {SummaryData} from "../../../room/RoomSummary"; /** Used for both roomSummary and archivedRoomSummary stores */ export class RoomSummaryStore { - private _summaryStore: Store + private _summaryStore: Store; constructor(summaryStore: Store) { this._summaryStore = summaryStore; diff --git a/src/matrix/storage/idb/stores/SessionStore.ts b/src/matrix/storage/idb/stores/SessionStore.ts index b1891b72..1f79839f 100644 --- a/src/matrix/storage/idb/stores/SessionStore.ts +++ b/src/matrix/storage/idb/stores/SessionStore.ts @@ -13,11 +13,11 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -import {Store} from "../Store" +import {Store} from "../Store"; export interface SessionEntry { - key: string - value: any + key: string; + value: any; } export class SessionStore { diff --git a/src/matrix/storage/idb/stores/TimelineEventStore.ts b/src/matrix/storage/idb/stores/TimelineEventStore.ts index d62974d3..e9bdce3a 100644 --- a/src/matrix/storage/idb/stores/TimelineEventStore.ts +++ b/src/matrix/storage/idb/stores/TimelineEventStore.ts @@ -22,21 +22,21 @@ import {Store} from "../Store"; import {RoomEvent, StateEvent} from "../../types"; interface Annotation { - count: number - me: boolean - firstTimestamp: number + count: number; + me: boolean; + firstTimestamp: number; } interface StorageEntry { - roomId: string - fragmentId: number - eventIndex: number - event: RoomEvent | StateEvent - displayName?: string - avatarUrl?: string - annotations?: { [key : string]: Annotation } - key: string - eventIdKey: string + roomId: string; + fragmentId: number; + eventIndex: number; + event: RoomEvent | StateEvent; + displayName?: string; + avatarUrl?: string; + annotations?: { [key : string]: Annotation }; + key: string; + eventIdKey: string; } function encodeKey(roomId: string, fragmentId: number, eventIndex: number): string { @@ -53,12 +53,12 @@ function decodeEventIdKey(eventIdKey: string): { roomId: string, eventId: string } class Range { - private _IDBKeyRange: any // TODO what's the appropriate representation here? - private _only?: EventKey - private _lower?: EventKey - private _upper?: EventKey - private _lowerOpen: boolean - private _upperOpen: boolean + private _IDBKeyRange: any; // TODO what's the appropriate representation here? + private _only?: EventKey; + private _lower?: EventKey; + private _upper?: EventKey; + private _lowerOpen: boolean; + private _upperOpen: boolean; constructor(IDBKeyRange: any, only?: EventKey, lower?: EventKey, upper?: EventKey, lowerOpen: boolean = false, upperOpen: boolean = false) { this._IDBKeyRange = IDBKeyRange; @@ -126,7 +126,7 @@ class Range { * @property {?Gap} gap if a gap entry, the gap */ export class TimelineEventStore { - private _timelineStore: Store + private _timelineStore: Store; constructor(timelineStore: Store) { this._timelineStore = timelineStore; diff --git a/src/matrix/storage/idb/stores/TimelineFragmentStore.ts b/src/matrix/storage/idb/stores/TimelineFragmentStore.ts index 8b490502..7bbae73d 100644 --- a/src/matrix/storage/idb/stores/TimelineFragmentStore.ts +++ b/src/matrix/storage/idb/stores/TimelineFragmentStore.ts @@ -20,12 +20,12 @@ import { encodeUint32 } from "../utils"; import {Store} from "../Store"; interface Fragment { - roomId: string - id: number - previousId: number | null - nextId: number | null - previousToken: string | null - nextToken: string | null + roomId: string; + id: number; + previousId: number | null; + nextId: number | null; + previousToken: string | null; + nextToken: string | null; } type FragmentEntry = Fragment & { key: string } @@ -35,7 +35,7 @@ function encodeKey(roomId: string, fragmentId: number): string { } export class TimelineFragmentStore { - private _store: Store + private _store: Store; constructor(store: Store) { this._store = store; diff --git a/src/matrix/storage/idb/stores/TimelineRelationStore.ts b/src/matrix/storage/idb/stores/TimelineRelationStore.ts index 2b6bddc3..0905eb0c 100644 --- a/src/matrix/storage/idb/stores/TimelineRelationStore.ts +++ b/src/matrix/storage/idb/stores/TimelineRelationStore.ts @@ -14,17 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ import {MIN_UNICODE, MAX_UNICODE} from "./common"; -import {Store} from "../Store" +import {Store} from "../Store"; function encodeKey(roomId: string, targetEventId: string, relType: string, sourceEventId: string): string { return `${roomId}|${targetEventId}|${relType}|${sourceEventId}`; } interface RelationEntry { - roomId: string - targetEventId: string - sourceEventId: string - relType: string + roomId: string; + targetEventId: string; + sourceEventId: string; + relType: string; } function decodeKey(key: string): RelationEntry { @@ -33,7 +33,7 @@ function decodeKey(key: string): RelationEntry { } export class TimelineRelationStore { - private _store: Store<{ key: string }> + private _store: Store<{ key: string }>; constructor(store: Store<{ key: string }>) { this._store = store; diff --git a/src/matrix/storage/idb/stores/UserIdentityStore.ts b/src/matrix/storage/idb/stores/UserIdentityStore.ts index 2ba6440a..b84a2709 100644 --- a/src/matrix/storage/idb/stores/UserIdentityStore.ts +++ b/src/matrix/storage/idb/stores/UserIdentityStore.ts @@ -13,16 +13,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -import {Store} from "../Store" +import {Store} from "../Store"; interface UserIdentity { - userId: string - roomIds: string[] - deviceTrackingStatus: number + userId: string; + roomIds: string[]; + deviceTrackingStatus: number; } export class UserIdentityStore { - private _store: Store + private _store: Store; constructor(store: Store) { this._store = store; diff --git a/src/matrix/storage/types.ts b/src/matrix/storage/types.ts index 142baeb1..bc61e1f8 100644 --- a/src/matrix/storage/types.ts +++ b/src/matrix/storage/types.ts @@ -17,12 +17,12 @@ limitations under the License. export type Content = { [key: string]: any } export interface RoomEvent { - content: Content - type: string - event_id: string - sender: string - origin_server_ts: number - unsigned?: Content + content: Content; + type: string; + event_id: string; + sender: string; + origin_server_ts: number; + unsigned?: Content; } export type StateEvent = RoomEvent & { prev_content?: Content, state_key: string }