The bulk of this is just export/import changes, though there's a couple pieces to highlight:
* We no longer use default exports. This is because it's discouraged by the JS community, though not in any official capacity.
* We now use `polyfillSuper` for some prototype inheritance because the tests, and sometimes webpack, break on "cannot call EncryptionAlgorithm without 'new'". It's very much a workaround, and definitely not needed when we use real classes.
There is some import shuffling to help keep the imports clean - this was done by my IDE.
* Bump version
* Add a couple of rules to match our existing precedent
* Fix a few genuine lint errors
* Ignore a guard-for-in (not sure why eslint doesn't like this?)
* Update max warnings
Previously, we treated the `MatrixEvents` that were in `this.accountData` in
`MatrixInMemoryStore` as the ground truth and saved those to disk and restored
them back upon load. This did not consider that there are **no emitted events**
when they are restored. Riot-Web was listening for a specific account data
event in order to dynamically update the theme. When the page was reloaded, we
dutifully put the right event in `MatrixInMemoryStore`, but failed to emit an
event to tell Riot-Web this. This led to vector-im/riot-web#3247
This patch fixes it by treating the `/sync` response as the ground truth and
ignoring `this.accountData` entirely. This means that upon load, we will be
injecting an `account_data` key into the initial `/sync` response. This will
cause it to be added to `this.accountData` in the store AND cause the event to
be emitted.
We need to use the *previous* state when rolling back or else
causality breaks. Consider the messages:
- m.room.member : Alice
- Alice: 1
- Alice: 2
- m.room.member : Alice -> Bob
- Bob: 3
- Bob: 4
If we roll back 4 messages (to Alice: 2), we want the rolled
back m.room.member value to be "Alice" and NOT Bob. This
means we need to look at the previous state of the m.room.member
event and not the current state.
The user of the SDK is responsible for DIing the main components:
let store = new IndexedDBStore(
new IndexedDBStoreBackend(window.indexedDB),
new SyncAccumulator(),
});
await store.startup();
let client = matrix.createClient({store: store});