Add missing semicolons
This commit is contained in:
parent
c8f4cb5046
commit
31b02f1eff
23 changed files with 157 additions and 157 deletions
|
@ -21,16 +21,16 @@ type Reducer<A,B> = (acc: B, val: A) => B
|
||||||
type IDBQuery = IDBValidKey | IDBKeyRange
|
type IDBQuery = IDBValidKey | IDBKeyRange
|
||||||
|
|
||||||
interface QueryTargetInterface<T> {
|
interface QueryTargetInterface<T> {
|
||||||
openCursor: (range?: IDBQuery | null , direction?: IDBCursorDirection) => IDBRequest<IDBCursorWithValue | null>
|
openCursor: (range?: IDBQuery | null , direction?: IDBCursorDirection) => IDBRequest<IDBCursorWithValue | null>;
|
||||||
openKeyCursor: (range?: IDBQuery, direction?: IDBCursorDirection) => IDBRequest<IDBCursor | null>
|
openKeyCursor: (range?: IDBQuery, direction?: IDBCursorDirection) => IDBRequest<IDBCursor | null>;
|
||||||
supports: (method: string) => boolean
|
supports: (method: string) => boolean;
|
||||||
keyPath: string | string[]
|
keyPath: string | string[];
|
||||||
get: (key: IDBQuery) => IDBRequest<T | null>
|
get: (key: IDBQuery) => IDBRequest<T | null>;
|
||||||
getKey: (key: IDBQuery) => IDBRequest<IDBValidKey | undefined>
|
getKey: (key: IDBQuery) => IDBRequest<IDBValidKey | undefined>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class QueryTarget<T> {
|
export class QueryTarget<T> {
|
||||||
protected _target: QueryTargetInterface<T>
|
protected _target: QueryTargetInterface<T>;
|
||||||
|
|
||||||
constructor(target: QueryTargetInterface<T>) {
|
constructor(target: QueryTargetInterface<T>) {
|
||||||
this._target = target;
|
this._target = target;
|
||||||
|
|
|
@ -21,9 +21,9 @@ import { reqAsPromise } from "./utils";
|
||||||
const WEBKITEARLYCLOSETXNBUG_BOGUS_KEY = "782rh281re38-boguskey";
|
const WEBKITEARLYCLOSETXNBUG_BOGUS_KEY = "782rh281re38-boguskey";
|
||||||
|
|
||||||
export class Storage {
|
export class Storage {
|
||||||
private _db: IDBDatabase
|
private _db: IDBDatabase;
|
||||||
private _hasWebkitEarlyCloseTxnBug: boolean
|
private _hasWebkitEarlyCloseTxnBug: boolean;
|
||||||
storeNames: { [ name : string] : string }
|
storeNames: { [ name : string] : string };
|
||||||
|
|
||||||
constructor(idbDatabase: IDBDatabase, IDBKeyRange, hasWebkitEarlyCloseTxnBug: boolean) {
|
constructor(idbDatabase: IDBDatabase, IDBKeyRange, hasWebkitEarlyCloseTxnBug: boolean) {
|
||||||
this._db = idbDatabase;
|
this._db = idbDatabase;
|
||||||
|
|
|
@ -26,7 +26,7 @@ const openDatabaseWithSessionId = function(sessionId: string, idbFactory: IDBFac
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ServiceWorkerHandler {
|
interface ServiceWorkerHandler {
|
||||||
preventConcurrentSessionAccess: (sessionId: string) => Promise<void>
|
preventConcurrentSessionAccess: (sessionId: string) => Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function requestPersistedStorage(): Promise<boolean> {
|
async function requestPersistedStorage(): Promise<boolean> {
|
||||||
|
@ -47,8 +47,8 @@ async function requestPersistedStorage(): Promise<boolean> {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class StorageFactory {
|
export class StorageFactory {
|
||||||
private _serviceWorkerHandler: ServiceWorkerHandler
|
private _serviceWorkerHandler: ServiceWorkerHandler;
|
||||||
private _idbFactory: IDBFactory
|
private _idbFactory: IDBFactory;
|
||||||
|
|
||||||
constructor(serviceWorkerHandler: ServiceWorkerHandler, idbFactory: IDBFactory = window.indexedDB, IDBKeyRange = window.IDBKeyRange) {
|
constructor(serviceWorkerHandler: ServiceWorkerHandler, idbFactory: IDBFactory = window.indexedDB, IDBKeyRange = window.IDBKeyRange) {
|
||||||
this._serviceWorkerHandler = serviceWorkerHandler;
|
this._serviceWorkerHandler = serviceWorkerHandler;
|
||||||
|
|
|
@ -16,8 +16,8 @@ limitations under the License.
|
||||||
|
|
||||||
import {QueryTarget} from "./QueryTarget";
|
import {QueryTarget} from "./QueryTarget";
|
||||||
import {IDBRequestAttemptError} from "./error";
|
import {IDBRequestAttemptError} from "./error";
|
||||||
import {reqAsPromise} from "./utils"
|
import {reqAsPromise} from "./utils";
|
||||||
import {Transaction} from "./Transaction"
|
import {Transaction} from "./Transaction";
|
||||||
|
|
||||||
const LOG_REQUESTS = false;
|
const LOG_REQUESTS = false;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ function logRequest(method: string, params: any[], source: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
class QueryTargetWrapper<T> {
|
class QueryTargetWrapper<T> {
|
||||||
private _qt: IDBIndex | IDBObjectStore
|
private _qt: IDBIndex | IDBObjectStore;
|
||||||
|
|
||||||
constructor(qt: IDBIndex | IDBObjectStore) {
|
constructor(qt: IDBIndex | IDBObjectStore) {
|
||||||
this._qt = qt;
|
this._qt = qt;
|
||||||
|
@ -129,7 +129,7 @@ class QueryTargetWrapper<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Store<T> extends QueryTarget<T> {
|
export class Store<T> extends QueryTarget<T> {
|
||||||
private _transaction: Transaction
|
private _transaction: Transaction;
|
||||||
|
|
||||||
constructor(idbStore: IDBObjectStore, transaction: Transaction) {
|
constructor(idbStore: IDBObjectStore, transaction: Transaction) {
|
||||||
super(new QueryTargetWrapper<T>(idbStore));
|
super(new QueryTargetWrapper<T>(idbStore));
|
||||||
|
|
|
@ -36,9 +36,9 @@ import {OperationStore} from "./stores/OperationStore";
|
||||||
import {AccountDataStore} from "./stores/AccountDataStore";
|
import {AccountDataStore} from "./stores/AccountDataStore";
|
||||||
|
|
||||||
export class Transaction {
|
export class Transaction {
|
||||||
private _txn: IDBTransaction
|
private _txn: IDBTransaction;
|
||||||
private _allowedStoreNames: string[]
|
private _allowedStoreNames: string[];
|
||||||
private _stores: { [storeName : string] : any }
|
private _stores: { [storeName : string] : any };
|
||||||
|
|
||||||
constructor(txn: IDBTransaction, allowedStoreNames: string[], IDBKeyRange) {
|
constructor(txn: IDBTransaction, allowedStoreNames: string[], IDBKeyRange) {
|
||||||
this._txn = txn;
|
this._txn = txn;
|
||||||
|
|
|
@ -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
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
import {Store} from "../Store"
|
import {Store} from "../Store";
|
||||||
import {Content} from "../../types";
|
import {Content} from "../../types";
|
||||||
|
|
||||||
interface AccountDataEntry {
|
interface AccountDataEntry {
|
||||||
type: string
|
type: string;
|
||||||
content: Content
|
content: Content;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AccountDataStore {
|
export class AccountDataStore {
|
||||||
private _store: Store<AccountDataEntry>
|
private _store: Store<AccountDataEntry>;
|
||||||
|
|
||||||
constructor(store: Store<AccountDataEntry>) {
|
constructor(store: Store<AccountDataEntry>) {
|
||||||
this._store = store;
|
this._store = store;
|
||||||
|
|
|
@ -15,16 +15,16 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {MAX_UNICODE, MIN_UNICODE} from "./common";
|
import {MAX_UNICODE, MIN_UNICODE} from "./common";
|
||||||
import {Store} from "../Store"
|
import {Store} from "../Store";
|
||||||
|
|
||||||
interface DeviceIdentity {
|
interface DeviceIdentity {
|
||||||
userId: string
|
userId: string;
|
||||||
deviceId: string
|
deviceId: string;
|
||||||
ed25519Key: string
|
ed25519Key: string;
|
||||||
curve25519Key: string
|
curve25519Key: string;
|
||||||
algorithms: string[]
|
algorithms: string[];
|
||||||
displayName: string
|
displayName: string;
|
||||||
key: string
|
key: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
function encodeKey(userId: string, deviceId: string): string {
|
function encodeKey(userId: string, deviceId: string): string {
|
||||||
|
@ -37,7 +37,7 @@ function decodeKey(key: string): { userId: string, deviceId: string } {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DeviceIdentityStore {
|
export class DeviceIdentityStore {
|
||||||
private _store: Store<DeviceIdentity>
|
private _store: Store<DeviceIdentity>;
|
||||||
|
|
||||||
constructor(store: Store<DeviceIdentity>) {
|
constructor(store: Store<DeviceIdentity>) {
|
||||||
this._store = store;
|
this._store = store;
|
||||||
|
|
|
@ -15,20 +15,20 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {MIN_UNICODE, MAX_UNICODE} from "./common";
|
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 {
|
function encodeKey(roomId: string, sessionId: string, messageIndex: number | string): string {
|
||||||
return `${roomId}|${sessionId}|${messageIndex}`;
|
return `${roomId}|${sessionId}|${messageIndex}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface GroupSessionDecryption {
|
interface GroupSessionDecryption {
|
||||||
eventId: string
|
eventId: string;
|
||||||
timestamp: number
|
timestamp: number;
|
||||||
key: string
|
key: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GroupSessionDecryptionStore {
|
export class GroupSessionDecryptionStore {
|
||||||
private _store: Store<GroupSessionDecryption>
|
private _store: Store<GroupSessionDecryption>;
|
||||||
|
|
||||||
constructor(store: Store<GroupSessionDecryption>) {
|
constructor(store: Store<GroupSessionDecryption>) {
|
||||||
this._store = store;
|
this._store = store;
|
||||||
|
|
|
@ -15,16 +15,16 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {MIN_UNICODE, MAX_UNICODE} from "./common";
|
import {MIN_UNICODE, MAX_UNICODE} from "./common";
|
||||||
import {Store} from "../Store"
|
import {Store} from "../Store";
|
||||||
|
|
||||||
interface InboundGroupSession {
|
interface InboundGroupSession {
|
||||||
roomId: string
|
roomId: string;
|
||||||
senderKey: string
|
senderKey: string;
|
||||||
sessionId: string
|
sessionId: string;
|
||||||
session?: string
|
session?: string;
|
||||||
claimedKeys?: { [algorithm : string] : string }
|
claimedKeys?: { [algorithm : string] : string };
|
||||||
eventIds?: string[]
|
eventIds?: string[];
|
||||||
key: string
|
key: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
function encodeKey(roomId: string, senderKey: string, sessionId: string) {
|
function encodeKey(roomId: string, senderKey: string, sessionId: string) {
|
||||||
|
@ -32,7 +32,7 @@ function encodeKey(roomId: string, senderKey: string, sessionId: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class InboundGroupSessionStore {
|
export class InboundGroupSessionStore {
|
||||||
private _store: Store<InboundGroupSession>
|
private _store: Store<InboundGroupSession>;
|
||||||
|
|
||||||
constructor(store: Store<InboundGroupSession>) {
|
constructor(store: Store<InboundGroupSession>) {
|
||||||
this._store = store;
|
this._store = store;
|
||||||
|
|
|
@ -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
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
import {Store} from "../Store"
|
import {Store} from "../Store";
|
||||||
import {MemberData} from "./RoomMemberStore"
|
import {MemberData} from "./RoomMemberStore";
|
||||||
|
|
||||||
// TODO: Move to Invite when that's TypeScript.
|
// TODO: Move to Invite when that's TypeScript.
|
||||||
export interface InviteData {
|
export interface InviteData {
|
||||||
roomId: string
|
roomId: string;
|
||||||
isEncrypted: boolean
|
isEncrypted: boolean;
|
||||||
isDirectMessage: boolean
|
isDirectMessage: boolean;
|
||||||
name?: string
|
name?: string;
|
||||||
avatarUrl?: string
|
avatarUrl?: string;
|
||||||
avatarColorId: number
|
avatarColorId: number;
|
||||||
canonicalAlias?: string
|
canonicalAlias?: string;
|
||||||
timestamp: number
|
timestamp: number;
|
||||||
joinRule: string
|
joinRule: string;
|
||||||
inviter?: MemberData
|
inviter?: MemberData;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class InviteStore {
|
export class InviteStore {
|
||||||
private _inviteStore: Store<InviteData>
|
private _inviteStore: Store<InviteData>;
|
||||||
|
|
||||||
constructor(inviteStore: Store<InviteData>) {
|
constructor(inviteStore: Store<InviteData>) {
|
||||||
this._inviteStore = inviteStore;
|
this._inviteStore = inviteStore;
|
||||||
|
|
|
@ -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
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
import {Store} from "../Store"
|
import {Store} from "../Store";
|
||||||
|
|
||||||
function encodeKey(senderKey: string, sessionId: string): string {
|
function encodeKey(senderKey: string, sessionId: string): string {
|
||||||
return `${senderKey}|${sessionId}`;
|
return `${senderKey}|${sessionId}`;
|
||||||
|
@ -25,15 +25,15 @@ function decodeKey(key: string): { senderKey: string, sessionId: string } {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OlmSession {
|
interface OlmSession {
|
||||||
session: string
|
session: string;
|
||||||
sessionId: string
|
sessionId: string;
|
||||||
senderKey: string
|
senderKey: string;
|
||||||
lastUsed: number
|
lastUsed: number;
|
||||||
key: string
|
key: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class OlmSessionStore {
|
export class OlmSessionStore {
|
||||||
private _store: Store<OlmSession>
|
private _store: Store<OlmSession>;
|
||||||
|
|
||||||
constructor(store: Store<OlmSession>) {
|
constructor(store: Store<OlmSession>) {
|
||||||
this._store = store;
|
this._store = store;
|
||||||
|
|
|
@ -14,31 +14,31 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
import {MIN_UNICODE, MAX_UNICODE} from "./common";
|
import {MIN_UNICODE, MAX_UNICODE} from "./common";
|
||||||
import {Store} from "../Store"
|
import {Store} from "../Store";
|
||||||
|
|
||||||
export function encodeScopeTypeKey(scope: string, type: string): string {
|
export function encodeScopeTypeKey(scope: string, type: string): string {
|
||||||
return `${scope}|${type}`;
|
return `${scope}|${type}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Operation {
|
interface Operation {
|
||||||
id: string
|
id: string;
|
||||||
type: string
|
type: string;
|
||||||
scope: string
|
scope: string;
|
||||||
userIds: string[]
|
userIds: string[];
|
||||||
scopeTypeKey: string
|
scopeTypeKey: string;
|
||||||
roomKeyMessage: RoomKeyMessage
|
roomKeyMessage: RoomKeyMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RoomKeyMessage {
|
interface RoomKeyMessage {
|
||||||
room_id: string
|
room_id: string;
|
||||||
session_id: string
|
session_id: string;
|
||||||
session_key: string
|
session_key: string;
|
||||||
algorithm: string
|
algorithm: string;
|
||||||
chain_index: number
|
chain_index: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class OperationStore {
|
export class OperationStore {
|
||||||
private _store: Store<Operation>
|
private _store: Store<Operation>;
|
||||||
|
|
||||||
constructor(store: Store<Operation>) {
|
constructor(store: Store<Operation>) {
|
||||||
this._store = store;
|
this._store = store;
|
||||||
|
|
|
@ -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
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
import {Store} from "../Store"
|
import {Store} from "../Store";
|
||||||
|
|
||||||
interface OutboundSession {
|
interface OutboundSession {
|
||||||
roomId: string
|
roomId: string;
|
||||||
session: string
|
session: string;
|
||||||
createdAt: number
|
createdAt: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class OutboundGroupSessionStore {
|
export class OutboundGroupSessionStore {
|
||||||
private _store: Store<OutboundSession>
|
private _store: Store<OutboundSession>;
|
||||||
|
|
||||||
constructor(store: Store<OutboundSession>) {
|
constructor(store: Store<OutboundSession>) {
|
||||||
this._store = store;
|
this._store = store;
|
||||||
|
|
|
@ -16,20 +16,20 @@ limitations under the License.
|
||||||
|
|
||||||
import { encodeUint32, decodeUint32 } from "../utils";
|
import { encodeUint32, decodeUint32 } from "../utils";
|
||||||
import {KeyLimits} from "../../common";
|
import {KeyLimits} from "../../common";
|
||||||
import {Store} from "../Store"
|
import {Store} from "../Store";
|
||||||
import {Content} from "../../types";
|
import {Content} from "../../types";
|
||||||
|
|
||||||
interface PendingEntry {
|
interface PendingEntry {
|
||||||
roomId: string
|
roomId: string;
|
||||||
queueIndex: number
|
queueIndex: number;
|
||||||
eventType: string
|
eventType: string;
|
||||||
content: Content
|
content: Content;
|
||||||
relatexTxnId: string | null
|
relatexTxnId: string | null;
|
||||||
relatedEventId: string | null
|
relatedEventId: string | null;
|
||||||
txnId?: string
|
txnId?: string;
|
||||||
needsEncryption: boolean
|
needsEncryption: boolean;
|
||||||
needsUpload: boolean
|
needsUpload: boolean;
|
||||||
key: string
|
key: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
function encodeKey(roomId: string, queueIndex: number): string {
|
function encodeKey(roomId: string, queueIndex: number): string {
|
||||||
|
@ -43,7 +43,7 @@ function decodeKey(key: string): { roomId: string, queueIndex: number } {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PendingEventStore {
|
export class PendingEventStore {
|
||||||
private _eventStore: Store<PendingEntry>
|
private _eventStore: Store<PendingEntry>;
|
||||||
|
|
||||||
constructor(eventStore: Store<PendingEntry>) {
|
constructor(eventStore: Store<PendingEntry>) {
|
||||||
this._eventStore = eventStore;
|
this._eventStore = eventStore;
|
||||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {MAX_UNICODE} from "./common";
|
import {MAX_UNICODE} from "./common";
|
||||||
import {Store} from "../Store"
|
import {Store} from "../Store";
|
||||||
|
|
||||||
function encodeKey(roomId: string, userId: string) {
|
function encodeKey(roomId: string, userId: string) {
|
||||||
return `${roomId}|${userId}`;
|
return `${roomId}|${userId}`;
|
||||||
|
@ -29,18 +29,18 @@ function decodeKey(key: string): { roomId: string, userId: string } {
|
||||||
|
|
||||||
// TODO: Move to RoomMember when that's TypeScript.
|
// TODO: Move to RoomMember when that's TypeScript.
|
||||||
export interface MemberData {
|
export interface MemberData {
|
||||||
roomId: string
|
roomId: string;
|
||||||
userId: string
|
userId: string;
|
||||||
avatarUrl: string
|
avatarUrl: string;
|
||||||
displayName: string
|
displayName: string;
|
||||||
membership: "join" | "leave" | "invite" | "ban"
|
membership: "join" | "leave" | "invite" | "ban";
|
||||||
}
|
}
|
||||||
|
|
||||||
type MemberStorageEntry = MemberData & { key: string }
|
type MemberStorageEntry = MemberData & { key: string }
|
||||||
|
|
||||||
// no historical members
|
// no historical members
|
||||||
export class RoomMemberStore {
|
export class RoomMemberStore {
|
||||||
private _roomMembersStore: Store<MemberStorageEntry>
|
private _roomMembersStore: Store<MemberStorageEntry>;
|
||||||
|
|
||||||
constructor(roomMembersStore: Store<MemberStorageEntry>) {
|
constructor(roomMembersStore: Store<MemberStorageEntry>) {
|
||||||
this._roomMembersStore = roomMembersStore;
|
this._roomMembersStore = roomMembersStore;
|
||||||
|
|
|
@ -24,13 +24,13 @@ function encodeKey(roomId: string, eventType: string, stateKey: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RoomStateEntry {
|
export interface RoomStateEntry {
|
||||||
roomId: string,
|
roomId: string;
|
||||||
event: StateEvent
|
event: StateEvent;
|
||||||
key: string
|
key: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RoomStateStore {
|
export class RoomStateStore {
|
||||||
private _roomStateStore: Store<RoomStateEntry>
|
private _roomStateStore: Store<RoomStateEntry>;
|
||||||
|
|
||||||
constructor(idbStore: Store<RoomStateEntry>) {
|
constructor(idbStore: Store<RoomStateEntry>) {
|
||||||
this._roomStateStore = idbStore;
|
this._roomStateStore = idbStore;
|
||||||
|
|
|
@ -27,12 +27,12 @@ store contains:
|
||||||
inviteCount
|
inviteCount
|
||||||
joinCount
|
joinCount
|
||||||
*/
|
*/
|
||||||
import {Store} from "../Store"
|
import {Store} from "../Store";
|
||||||
import {SummaryData} from "../../../room/RoomSummary"
|
import {SummaryData} from "../../../room/RoomSummary";
|
||||||
|
|
||||||
/** Used for both roomSummary and archivedRoomSummary stores */
|
/** Used for both roomSummary and archivedRoomSummary stores */
|
||||||
export class RoomSummaryStore {
|
export class RoomSummaryStore {
|
||||||
private _summaryStore: Store<SummaryData>
|
private _summaryStore: Store<SummaryData>;
|
||||||
|
|
||||||
constructor(summaryStore: Store<SummaryData>) {
|
constructor(summaryStore: Store<SummaryData>) {
|
||||||
this._summaryStore = summaryStore;
|
this._summaryStore = summaryStore;
|
||||||
|
|
|
@ -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
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
import {Store} from "../Store"
|
import {Store} from "../Store";
|
||||||
|
|
||||||
export interface SessionEntry {
|
export interface SessionEntry {
|
||||||
key: string
|
key: string;
|
||||||
value: any
|
value: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SessionStore {
|
export class SessionStore {
|
||||||
|
|
|
@ -22,21 +22,21 @@ import {Store} from "../Store";
|
||||||
import {RoomEvent, StateEvent} from "../../types";
|
import {RoomEvent, StateEvent} from "../../types";
|
||||||
|
|
||||||
interface Annotation {
|
interface Annotation {
|
||||||
count: number
|
count: number;
|
||||||
me: boolean
|
me: boolean;
|
||||||
firstTimestamp: number
|
firstTimestamp: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface StorageEntry {
|
interface StorageEntry {
|
||||||
roomId: string
|
roomId: string;
|
||||||
fragmentId: number
|
fragmentId: number;
|
||||||
eventIndex: number
|
eventIndex: number;
|
||||||
event: RoomEvent | StateEvent
|
event: RoomEvent | StateEvent;
|
||||||
displayName?: string
|
displayName?: string;
|
||||||
avatarUrl?: string
|
avatarUrl?: string;
|
||||||
annotations?: { [key : string]: Annotation }
|
annotations?: { [key : string]: Annotation };
|
||||||
key: string
|
key: string;
|
||||||
eventIdKey: string
|
eventIdKey: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
function encodeKey(roomId: string, fragmentId: number, eventIndex: number): string {
|
function encodeKey(roomId: string, fragmentId: number, eventIndex: number): string {
|
||||||
|
@ -53,12 +53,12 @@ function decodeEventIdKey(eventIdKey: string): { roomId: string, eventId: string
|
||||||
}
|
}
|
||||||
|
|
||||||
class Range {
|
class Range {
|
||||||
private _IDBKeyRange: any // TODO what's the appropriate representation here?
|
private _IDBKeyRange: any; // TODO what's the appropriate representation here?
|
||||||
private _only?: EventKey
|
private _only?: EventKey;
|
||||||
private _lower?: EventKey
|
private _lower?: EventKey;
|
||||||
private _upper?: EventKey
|
private _upper?: EventKey;
|
||||||
private _lowerOpen: boolean
|
private _lowerOpen: boolean;
|
||||||
private _upperOpen: boolean
|
private _upperOpen: boolean;
|
||||||
|
|
||||||
constructor(IDBKeyRange: any, only?: EventKey, lower?: EventKey, upper?: EventKey, lowerOpen: boolean = false, upperOpen: boolean = false) {
|
constructor(IDBKeyRange: any, only?: EventKey, lower?: EventKey, upper?: EventKey, lowerOpen: boolean = false, upperOpen: boolean = false) {
|
||||||
this._IDBKeyRange = IDBKeyRange;
|
this._IDBKeyRange = IDBKeyRange;
|
||||||
|
@ -126,7 +126,7 @@ class Range {
|
||||||
* @property {?Gap} gap if a gap entry, the gap
|
* @property {?Gap} gap if a gap entry, the gap
|
||||||
*/
|
*/
|
||||||
export class TimelineEventStore {
|
export class TimelineEventStore {
|
||||||
private _timelineStore: Store<StorageEntry>
|
private _timelineStore: Store<StorageEntry>;
|
||||||
|
|
||||||
constructor(timelineStore: Store<StorageEntry>) {
|
constructor(timelineStore: Store<StorageEntry>) {
|
||||||
this._timelineStore = timelineStore;
|
this._timelineStore = timelineStore;
|
||||||
|
|
|
@ -20,12 +20,12 @@ import { encodeUint32 } from "../utils";
|
||||||
import {Store} from "../Store";
|
import {Store} from "../Store";
|
||||||
|
|
||||||
interface Fragment {
|
interface Fragment {
|
||||||
roomId: string
|
roomId: string;
|
||||||
id: number
|
id: number;
|
||||||
previousId: number | null
|
previousId: number | null;
|
||||||
nextId: number | null
|
nextId: number | null;
|
||||||
previousToken: string | null
|
previousToken: string | null;
|
||||||
nextToken: string | null
|
nextToken: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
type FragmentEntry = Fragment & { key: string }
|
type FragmentEntry = Fragment & { key: string }
|
||||||
|
@ -35,7 +35,7 @@ function encodeKey(roomId: string, fragmentId: number): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TimelineFragmentStore {
|
export class TimelineFragmentStore {
|
||||||
private _store: Store<FragmentEntry>
|
private _store: Store<FragmentEntry>;
|
||||||
|
|
||||||
constructor(store: Store<FragmentEntry>) {
|
constructor(store: Store<FragmentEntry>) {
|
||||||
this._store = store;
|
this._store = store;
|
||||||
|
|
|
@ -14,17 +14,17 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
import {MIN_UNICODE, MAX_UNICODE} from "./common";
|
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 {
|
function encodeKey(roomId: string, targetEventId: string, relType: string, sourceEventId: string): string {
|
||||||
return `${roomId}|${targetEventId}|${relType}|${sourceEventId}`;
|
return `${roomId}|${targetEventId}|${relType}|${sourceEventId}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RelationEntry {
|
interface RelationEntry {
|
||||||
roomId: string
|
roomId: string;
|
||||||
targetEventId: string
|
targetEventId: string;
|
||||||
sourceEventId: string
|
sourceEventId: string;
|
||||||
relType: string
|
relType: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
function decodeKey(key: string): RelationEntry {
|
function decodeKey(key: string): RelationEntry {
|
||||||
|
@ -33,7 +33,7 @@ function decodeKey(key: string): RelationEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TimelineRelationStore {
|
export class TimelineRelationStore {
|
||||||
private _store: Store<{ key: string }>
|
private _store: Store<{ key: string }>;
|
||||||
|
|
||||||
constructor(store: Store<{ key: string }>) {
|
constructor(store: Store<{ key: string }>) {
|
||||||
this._store = store;
|
this._store = store;
|
||||||
|
|
|
@ -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
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
import {Store} from "../Store"
|
import {Store} from "../Store";
|
||||||
|
|
||||||
interface UserIdentity {
|
interface UserIdentity {
|
||||||
userId: string
|
userId: string;
|
||||||
roomIds: string[]
|
roomIds: string[];
|
||||||
deviceTrackingStatus: number
|
deviceTrackingStatus: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UserIdentityStore {
|
export class UserIdentityStore {
|
||||||
private _store: Store<UserIdentity>
|
private _store: Store<UserIdentity>;
|
||||||
|
|
||||||
constructor(store: Store<UserIdentity>) {
|
constructor(store: Store<UserIdentity>) {
|
||||||
this._store = store;
|
this._store = store;
|
||||||
|
|
|
@ -17,12 +17,12 @@ limitations under the License.
|
||||||
export type Content = { [key: string]: any }
|
export type Content = { [key: string]: any }
|
||||||
|
|
||||||
export interface RoomEvent {
|
export interface RoomEvent {
|
||||||
content: Content
|
content: Content;
|
||||||
type: string
|
type: string;
|
||||||
event_id: string
|
event_id: string;
|
||||||
sender: string
|
sender: string;
|
||||||
origin_server_ts: number
|
origin_server_ts: number;
|
||||||
unsigned?: Content
|
unsigned?: Content;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type StateEvent = RoomEvent & { prev_content?: Content, state_key: string }
|
export type StateEvent = RoomEvent & { prev_content?: Content, state_key: string }
|
||||||
|
|
Reference in a new issue