@unwanted/matrix-sdk-mini 34.12.0-1 → 34.12.0-2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. package/git-revision.txt +1 -1
  2. package/lib/@types/event.d.ts +0 -19
  3. package/lib/@types/event.d.ts.map +1 -1
  4. package/lib/@types/event.js.map +1 -1
  5. package/lib/client.d.ts +2 -50
  6. package/lib/client.d.ts.map +1 -1
  7. package/lib/client.js +391 -501
  8. package/lib/client.js.map +1 -1
  9. package/lib/embedded.d.ts.map +1 -1
  10. package/lib/embedded.js +0 -1
  11. package/lib/embedded.js.map +1 -1
  12. package/lib/matrix.d.ts +0 -6
  13. package/lib/matrix.d.ts.map +1 -1
  14. package/lib/matrix.js +1 -5
  15. package/lib/matrix.js.map +1 -1
  16. package/package.json +1 -1
  17. package/src/@types/event.ts +2 -36
  18. package/src/client.ts +1 -150
  19. package/src/embedded.ts +0 -2
  20. package/src/matrix.ts +0 -13
  21. package/lib/matrixrtc/CallMembership.d.ts +0 -66
  22. package/lib/matrixrtc/CallMembership.d.ts.map +0 -1
  23. package/lib/matrixrtc/CallMembership.js +0 -197
  24. package/lib/matrixrtc/CallMembership.js.map +0 -1
  25. package/lib/matrixrtc/LivekitFocus.d.ts +0 -16
  26. package/lib/matrixrtc/LivekitFocus.d.ts.map +0 -1
  27. package/lib/matrixrtc/LivekitFocus.js +0 -20
  28. package/lib/matrixrtc/LivekitFocus.js.map +0 -1
  29. package/lib/matrixrtc/MatrixRTCSession.d.ts +0 -295
  30. package/lib/matrixrtc/MatrixRTCSession.d.ts.map +0 -1
  31. package/lib/matrixrtc/MatrixRTCSession.js +0 -1043
  32. package/lib/matrixrtc/MatrixRTCSession.js.map +0 -1
  33. package/lib/matrixrtc/MatrixRTCSessionManager.d.ts +0 -40
  34. package/lib/matrixrtc/MatrixRTCSessionManager.d.ts.map +0 -1
  35. package/lib/matrixrtc/MatrixRTCSessionManager.js +0 -146
  36. package/lib/matrixrtc/MatrixRTCSessionManager.js.map +0 -1
  37. package/lib/matrixrtc/focus.d.ts +0 -10
  38. package/lib/matrixrtc/focus.d.ts.map +0 -1
  39. package/lib/matrixrtc/focus.js +0 -1
  40. package/lib/matrixrtc/focus.js.map +0 -1
  41. package/lib/matrixrtc/index.d.ts +0 -7
  42. package/lib/matrixrtc/index.d.ts.map +0 -1
  43. package/lib/matrixrtc/index.js +0 -21
  44. package/lib/matrixrtc/index.js.map +0 -1
  45. package/lib/matrixrtc/types.d.ts +0 -19
  46. package/lib/matrixrtc/types.d.ts.map +0 -1
  47. package/lib/matrixrtc/types.js +0 -1
  48. package/lib/matrixrtc/types.js.map +0 -1
  49. package/lib/webrtc/audioContext.d.ts +0 -15
  50. package/lib/webrtc/audioContext.d.ts.map +0 -1
  51. package/lib/webrtc/audioContext.js +0 -46
  52. package/lib/webrtc/audioContext.js.map +0 -1
  53. package/lib/webrtc/call.d.ts +0 -560
  54. package/lib/webrtc/call.d.ts.map +0 -1
  55. package/lib/webrtc/call.js +0 -2541
  56. package/lib/webrtc/call.js.map +0 -1
  57. package/lib/webrtc/callEventHandler.d.ts +0 -37
  58. package/lib/webrtc/callEventHandler.d.ts.map +0 -1
  59. package/lib/webrtc/callEventHandler.js +0 -344
  60. package/lib/webrtc/callEventHandler.js.map +0 -1
  61. package/lib/webrtc/callEventTypes.d.ts +0 -73
  62. package/lib/webrtc/callEventTypes.d.ts.map +0 -1
  63. package/lib/webrtc/callEventTypes.js +0 -13
  64. package/lib/webrtc/callEventTypes.js.map +0 -1
  65. package/lib/webrtc/callFeed.d.ts +0 -128
  66. package/lib/webrtc/callFeed.d.ts.map +0 -1
  67. package/lib/webrtc/callFeed.js +0 -289
  68. package/lib/webrtc/callFeed.js.map +0 -1
  69. package/lib/webrtc/groupCall.d.ts +0 -323
  70. package/lib/webrtc/groupCall.d.ts.map +0 -1
  71. package/lib/webrtc/groupCall.js +0 -1337
  72. package/lib/webrtc/groupCall.js.map +0 -1
  73. package/lib/webrtc/groupCallEventHandler.d.ts +0 -31
  74. package/lib/webrtc/groupCallEventHandler.d.ts.map +0 -1
  75. package/lib/webrtc/groupCallEventHandler.js +0 -178
  76. package/lib/webrtc/groupCallEventHandler.js.map +0 -1
  77. package/lib/webrtc/mediaHandler.d.ts +0 -89
  78. package/lib/webrtc/mediaHandler.d.ts.map +0 -1
  79. package/lib/webrtc/mediaHandler.js +0 -437
  80. package/lib/webrtc/mediaHandler.js.map +0 -1
  81. package/lib/webrtc/stats/callFeedStatsReporter.d.ts +0 -8
  82. package/lib/webrtc/stats/callFeedStatsReporter.d.ts.map +0 -1
  83. package/lib/webrtc/stats/callFeedStatsReporter.js +0 -82
  84. package/lib/webrtc/stats/callFeedStatsReporter.js.map +0 -1
  85. package/lib/webrtc/stats/callStatsReportGatherer.d.ts +0 -25
  86. package/lib/webrtc/stats/callStatsReportGatherer.d.ts.map +0 -1
  87. package/lib/webrtc/stats/callStatsReportGatherer.js +0 -199
  88. package/lib/webrtc/stats/callStatsReportGatherer.js.map +0 -1
  89. package/lib/webrtc/stats/callStatsReportSummary.d.ts +0 -17
  90. package/lib/webrtc/stats/callStatsReportSummary.d.ts.map +0 -1
  91. package/lib/webrtc/stats/callStatsReportSummary.js +0 -1
  92. package/lib/webrtc/stats/callStatsReportSummary.js.map +0 -1
  93. package/lib/webrtc/stats/connectionStats.d.ts +0 -28
  94. package/lib/webrtc/stats/connectionStats.d.ts.map +0 -1
  95. package/lib/webrtc/stats/connectionStats.js +0 -26
  96. package/lib/webrtc/stats/connectionStats.js.map +0 -1
  97. package/lib/webrtc/stats/connectionStatsBuilder.d.ts +0 -5
  98. package/lib/webrtc/stats/connectionStatsBuilder.d.ts.map +0 -1
  99. package/lib/webrtc/stats/connectionStatsBuilder.js +0 -27
  100. package/lib/webrtc/stats/connectionStatsBuilder.js.map +0 -1
  101. package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts +0 -7
  102. package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts.map +0 -1
  103. package/lib/webrtc/stats/connectionStatsReportBuilder.js +0 -121
  104. package/lib/webrtc/stats/connectionStatsReportBuilder.js.map +0 -1
  105. package/lib/webrtc/stats/groupCallStats.d.ts +0 -22
  106. package/lib/webrtc/stats/groupCallStats.d.ts.map +0 -1
  107. package/lib/webrtc/stats/groupCallStats.js +0 -78
  108. package/lib/webrtc/stats/groupCallStats.js.map +0 -1
  109. package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts +0 -10
  110. package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts.map +0 -1
  111. package/lib/webrtc/stats/media/mediaSsrcHandler.js +0 -57
  112. package/lib/webrtc/stats/media/mediaSsrcHandler.js.map +0 -1
  113. package/lib/webrtc/stats/media/mediaTrackHandler.d.ts +0 -12
  114. package/lib/webrtc/stats/media/mediaTrackHandler.d.ts.map +0 -1
  115. package/lib/webrtc/stats/media/mediaTrackHandler.js +0 -62
  116. package/lib/webrtc/stats/media/mediaTrackHandler.js.map +0 -1
  117. package/lib/webrtc/stats/media/mediaTrackStats.d.ts +0 -86
  118. package/lib/webrtc/stats/media/mediaTrackStats.d.ts.map +0 -1
  119. package/lib/webrtc/stats/media/mediaTrackStats.js +0 -142
  120. package/lib/webrtc/stats/media/mediaTrackStats.js.map +0 -1
  121. package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts +0 -22
  122. package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts.map +0 -1
  123. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js +0 -76
  124. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js.map +0 -1
  125. package/lib/webrtc/stats/statsReport.d.ts +0 -99
  126. package/lib/webrtc/stats/statsReport.d.ts.map +0 -1
  127. package/lib/webrtc/stats/statsReport.js +0 -32
  128. package/lib/webrtc/stats/statsReport.js.map +0 -1
  129. package/lib/webrtc/stats/statsReportEmitter.d.ts +0 -15
  130. package/lib/webrtc/stats/statsReportEmitter.d.ts.map +0 -1
  131. package/lib/webrtc/stats/statsReportEmitter.js +0 -33
  132. package/lib/webrtc/stats/statsReportEmitter.js.map +0 -1
  133. package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts +0 -16
  134. package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts.map +0 -1
  135. package/lib/webrtc/stats/summaryStatsReportGatherer.js +0 -116
  136. package/lib/webrtc/stats/summaryStatsReportGatherer.js.map +0 -1
  137. package/lib/webrtc/stats/trackStatsBuilder.d.ts +0 -19
  138. package/lib/webrtc/stats/trackStatsBuilder.d.ts.map +0 -1
  139. package/lib/webrtc/stats/trackStatsBuilder.js +0 -168
  140. package/lib/webrtc/stats/trackStatsBuilder.js.map +0 -1
  141. package/lib/webrtc/stats/transportStats.d.ts +0 -11
  142. package/lib/webrtc/stats/transportStats.d.ts.map +0 -1
  143. package/lib/webrtc/stats/transportStats.js +0 -1
  144. package/lib/webrtc/stats/transportStats.js.map +0 -1
  145. package/lib/webrtc/stats/transportStatsBuilder.d.ts +0 -5
  146. package/lib/webrtc/stats/transportStatsBuilder.d.ts.map +0 -1
  147. package/lib/webrtc/stats/transportStatsBuilder.js +0 -34
  148. package/lib/webrtc/stats/transportStatsBuilder.js.map +0 -1
  149. package/lib/webrtc/stats/valueFormatter.d.ts +0 -4
  150. package/lib/webrtc/stats/valueFormatter.d.ts.map +0 -1
  151. package/lib/webrtc/stats/valueFormatter.js +0 -25
  152. package/lib/webrtc/stats/valueFormatter.js.map +0 -1
  153. package/src/matrixrtc/CallMembership.ts +0 -247
  154. package/src/matrixrtc/LivekitFocus.ts +0 -39
  155. package/src/matrixrtc/MatrixRTCSession.ts +0 -1319
  156. package/src/matrixrtc/MatrixRTCSessionManager.ts +0 -166
  157. package/src/matrixrtc/focus.ts +0 -25
  158. package/src/matrixrtc/index.ts +0 -22
  159. package/src/matrixrtc/types.ts +0 -36
  160. package/src/webrtc/audioContext.ts +0 -44
  161. package/src/webrtc/call.ts +0 -3074
  162. package/src/webrtc/callEventHandler.ts +0 -425
  163. package/src/webrtc/callEventTypes.ts +0 -93
  164. package/src/webrtc/callFeed.ts +0 -364
  165. package/src/webrtc/groupCall.ts +0 -1735
  166. package/src/webrtc/groupCallEventHandler.ts +0 -234
  167. package/src/webrtc/mediaHandler.ts +0 -484
  168. package/src/webrtc/stats/callFeedStatsReporter.ts +0 -94
  169. package/src/webrtc/stats/callStatsReportGatherer.ts +0 -219
  170. package/src/webrtc/stats/callStatsReportSummary.ts +0 -30
  171. package/src/webrtc/stats/connectionStats.ts +0 -47
  172. package/src/webrtc/stats/connectionStatsBuilder.ts +0 -28
  173. package/src/webrtc/stats/connectionStatsReportBuilder.ts +0 -140
  174. package/src/webrtc/stats/groupCallStats.ts +0 -93
  175. package/src/webrtc/stats/media/mediaSsrcHandler.ts +0 -57
  176. package/src/webrtc/stats/media/mediaTrackHandler.ts +0 -76
  177. package/src/webrtc/stats/media/mediaTrackStats.ts +0 -176
  178. package/src/webrtc/stats/media/mediaTrackStatsHandler.ts +0 -90
  179. package/src/webrtc/stats/statsReport.ts +0 -133
  180. package/src/webrtc/stats/statsReportEmitter.ts +0 -49
  181. package/src/webrtc/stats/summaryStatsReportGatherer.ts +0 -148
  182. package/src/webrtc/stats/trackStatsBuilder.ts +0 -207
  183. package/src/webrtc/stats/transportStats.ts +0 -26
  184. package/src/webrtc/stats/transportStatsBuilder.ts +0 -48
  185. package/src/webrtc/stats/valueFormatter.ts +0 -27
package/lib/client.js CHANGED
@@ -27,10 +27,7 @@ limitations under the License.
27
27
  import { SyncApi, SyncState } from "./sync.js";
28
28
  import { EventStatus, MatrixEvent, MatrixEventEvent } from "./models/event.js";
29
29
  import { StubStore } from "./store/stub.js";
30
- import { createNewMatrixCall, supportsMatrixCall } from "./webrtc/call.js";
31
30
  import { Filter } from "./filter.js";
32
- import { CallEventHandler } from "./webrtc/callEventHandler.js";
33
- import { GroupCallEventHandler } from "./webrtc/groupCallEventHandler.js";
34
31
  import * as utils from "./utils.js";
35
32
  import { noUnsafeEventProps, replaceParam, safeSet, sleep } from "./utils.js";
36
33
  import { Direction, EventTimeline } from "./models/event-timeline.js";
@@ -59,8 +56,6 @@ import { BackupManager } from "./crypto/backup.js";
59
56
  import { DEFAULT_TREE_POWER_LEVELS_TEMPLATE, MSC3089TreeSpace } from "./models/MSC3089TreeSpace.js";
60
57
  import { SearchOrderBy } from "./@types/search.js";
61
58
  import { PushRuleActionName, PushRuleKind } from "./@types/PushRules.js";
62
- import { GroupCall } from "./webrtc/groupCall.js";
63
- import { MediaHandler } from "./webrtc/mediaHandler.js";
64
59
  import { TypedEventEmitter } from "./models/typed-event-emitter.js";
65
60
  import { MAIN_ROOM_TIMELINE, ReceiptType } from "./@types/read_receipts.js";
66
61
  import { SlidingSyncSdk } from "./sliding-sync-sdk.js";
@@ -73,7 +68,6 @@ import { buildFeatureSupportMap, Feature, ServerSupport } from "./feature.js";
73
68
  import { RUST_SDK_STORE_PREFIX } from "./rust-crypto/constants.js";
74
69
  import { decodeRecoveryKey, CryptoEvent } from "./crypto-api/index.js";
75
70
  import { ServerSideSecretStorageImpl } from "./secret-storage.js";
76
- import { MatrixRTCSessionManager } from "./matrixrtc/MatrixRTCSessionManager.js";
77
71
  import { getRelationsThreadFilter } from "./thread-utils.js";
78
72
  import { KnownMembership } from "./@types/membership.js";
79
73
  import { ServerCapabilities } from "./serverCapabilities.js";
@@ -177,9 +171,6 @@ export class MatrixClient extends TypedEventEmitter {
177
171
  // one of crypto or rustCrypto
178
172
  _defineProperty(this, "cryptoCallbacks", void 0);
179
173
  // XXX: Intended private, used in code.
180
- _defineProperty(this, "callEventHandler", void 0);
181
- // XXX: Intended private, used in code.
182
- _defineProperty(this, "groupCallEventHandler", void 0);
183
174
  _defineProperty(this, "supportsCallTransfer", false);
184
175
  // XXX: Intended private, used in code.
185
176
  _defineProperty(this, "forceTURN", false);
@@ -222,7 +213,6 @@ export class MatrixClient extends TypedEventEmitter {
222
213
  _defineProperty(this, "checkTurnServersIntervalID", void 0);
223
214
  _defineProperty(this, "exportedOlmDeviceToImport", void 0);
224
215
  _defineProperty(this, "txnCtr", 0);
225
- _defineProperty(this, "mediaHandler", new MediaHandler(this));
226
216
  _defineProperty(this, "sessionId", void 0);
227
217
  /** IDs of events which are currently being encrypted.
228
218
  *
@@ -236,23 +226,7 @@ export class MatrixClient extends TypedEventEmitter {
236
226
  _defineProperty(this, "_secretStorage", void 0);
237
227
  // A manager for determining which invites should be ignored.
238
228
  _defineProperty(this, "ignoredInvites", void 0);
239
- _defineProperty(this, "matrixRTC", void 0);
240
229
  _defineProperty(this, "serverCapabilitiesService", void 0);
241
- _defineProperty(this, "startCallEventHandler", () => {
242
- if (this.isInitialSyncComplete()) {
243
- if (supportsMatrixCall()) {
244
- this.callEventHandler.start();
245
- this.groupCallEventHandler.start();
246
- }
247
- this.off(ClientEvent.Sync, this.startCallEventHandler);
248
- }
249
- });
250
- _defineProperty(this, "startMatrixRTC", () => {
251
- if (this.isInitialSyncComplete()) {
252
- this.matrixRTC.start();
253
- this.off(ClientEvent.Sync, this.startMatrixRTC);
254
- }
255
- });
256
230
  /**
257
231
  * Once the client has been initialised, we want to clear notifications we
258
232
  * know for a fact should be here.
@@ -342,19 +316,6 @@ export class MatrixClient extends TypedEventEmitter {
342
316
  };
343
317
  }());
344
318
  }
345
- if (supportsMatrixCall()) {
346
- this.callEventHandler = new CallEventHandler(this);
347
- this.groupCallEventHandler = new GroupCallEventHandler(this);
348
- this.canSupportVoip = true;
349
- // Start listening for calls after the initial sync is done
350
- // We do not need to backfill the call event buffer
351
- // with encrypted events that might never get decrypted
352
- this.on(ClientEvent.Sync, this.startCallEventHandler);
353
- }
354
-
355
- // NB. We initialise MatrixRTC whether we have call support or not: this is just
356
- // the underlying session management and doesn't use any actual media capabilities
357
- this.matrixRTC = new MatrixRTCSessionManager(this);
358
319
  this.serverCapabilitiesService = new ServerCapabilities(this.http);
359
320
  this.on(ClientEvent.Sync, this.fixupRoomNotifications);
360
321
  this.timelineSupport = Boolean(opts.timelineSupport);
@@ -407,7 +368,6 @@ export class MatrixClient extends TypedEventEmitter {
407
368
  return;
408
369
  }
409
370
  _this2.clientRunning = true;
410
- _this2.on(ClientEvent.Sync, _this2.startMatrixRTC);
411
371
 
412
372
  // Create our own user object artificially (instead of waiting for sync)
413
373
  // so it's always available, even if the user is not in any rooms etc.
@@ -484,10 +444,9 @@ export class MatrixClient extends TypedEventEmitter {
484
444
  * clean shutdown.
485
445
  */
486
446
  stopClient() {
487
- var _this$cryptoBackend, _this$syncApi, _this$peekSync, _this$callEventHandle, _this$groupCallEventH;
447
+ var _this$cryptoBackend, _this$syncApi, _this$peekSync;
488
448
  (_this$cryptoBackend = this.cryptoBackend) === null || _this$cryptoBackend === void 0 || _this$cryptoBackend.stop(); // crypto might have been initialised even if the client wasn't fully started
489
449
 
490
- this.off(ClientEvent.Sync, this.startMatrixRTC);
491
450
  if (!this.clientRunning) return; // already stopped
492
451
 
493
452
  this.logger.debug("stopping MatrixClient");
@@ -495,17 +454,12 @@ export class MatrixClient extends TypedEventEmitter {
495
454
  (_this$syncApi = this.syncApi) === null || _this$syncApi === void 0 || _this$syncApi.stop();
496
455
  this.syncApi = undefined;
497
456
  (_this$peekSync = this.peekSync) === null || _this$peekSync === void 0 || _this$peekSync.stopPeeking();
498
- (_this$callEventHandle = this.callEventHandler) === null || _this$callEventHandle === void 0 || _this$callEventHandle.stop();
499
- (_this$groupCallEventH = this.groupCallEventHandler) === null || _this$groupCallEventH === void 0 || _this$groupCallEventH.stop();
500
- this.callEventHandler = undefined;
501
- this.groupCallEventHandler = undefined;
502
457
  globalThis.clearInterval(this.checkTurnServersIntervalID);
503
458
  this.checkTurnServersIntervalID = undefined;
504
459
  if (this.clientWellKnownIntervalID !== undefined) {
505
460
  globalThis.clearInterval(this.clientWellKnownIntervalID);
506
461
  }
507
462
  this.toDeviceMessageQueue.stop();
508
- this.matrixRTC.stop();
509
463
  this.serverCapabilitiesService.stop();
510
464
  }
511
465
 
@@ -797,13 +751,6 @@ export class MatrixClient extends TypedEventEmitter {
797
751
  return this.canSupportVoip;
798
752
  }
799
753
 
800
- /**
801
- * @returns
802
- */
803
- getMediaHandler() {
804
- return this.mediaHandler;
805
- }
806
-
807
754
  /**
808
755
  * Set whether VoIP calls are forced to use only TURN
809
756
  * candidates. This is the same as the forceTURN option
@@ -830,40 +777,6 @@ export class MatrixClient extends TypedEventEmitter {
830
777
  getUseE2eForGroupCall() {
831
778
  return this.useE2eForGroupCall;
832
779
  }
833
-
834
- /**
835
- * Creates a new call.
836
- * The place*Call methods on the returned call can be used to actually place a call
837
- *
838
- * @param roomId - The room the call is to be placed in.
839
- * @returns the call or null if the browser doesn't support calling.
840
- */
841
- createCall(roomId) {
842
- return createNewMatrixCall(this, roomId);
843
- }
844
-
845
- /**
846
- * Creates a new group call and sends the associated state event
847
- * to alert other members that the room now has a group call.
848
- *
849
- * @param roomId - The room the call is to be placed in.
850
- */
851
- createGroupCall(roomId, type, isPtt, intent, dataChannelsEnabled, dataChannelOptions) {
852
- var _this9 = this;
853
- return _asyncToGenerator(function* () {
854
- if (_this9.getGroupCallForRoom(roomId)) {
855
- throw new Error("".concat(roomId, " already has an existing group call"));
856
- }
857
- var room = _this9.getRoom(roomId);
858
- if (!room) {
859
- throw new Error("Cannot find room ".concat(roomId));
860
- }
861
-
862
- // Because without Media section a WebRTC connection is not possible, so need a RTCDataChannel to set up a
863
- // no media WebRTC connection anyway.
864
- return new GroupCall(_this9, room, type, isPtt, intent, undefined, dataChannelsEnabled || _this9.isVoipWithNoMediaAllowed, dataChannelOptions, _this9.isVoipWithNoMediaAllowed, _this9.useLivekitForGroupCalls, _this9.livekitServiceURL).create();
865
- })();
866
- }
867
780
  getLivekitServiceURL() {
868
781
  return this.livekitServiceURL;
869
782
  }
@@ -874,29 +787,6 @@ export class MatrixClient extends TypedEventEmitter {
874
787
  this.livekitServiceURL = newURL;
875
788
  }
876
789
 
877
- /**
878
- * Wait until an initial state for the given room has been processed by the
879
- * client and the client is aware of any ongoing group calls. Awaiting on
880
- * the promise returned by this method before calling getGroupCallForRoom()
881
- * avoids races where getGroupCallForRoom is called before the state for that
882
- * room has been processed. It does not, however, fix other races, eg. two
883
- * clients both creating a group call at the same time.
884
- * @param roomId - The room ID to wait for
885
- * @returns A promise that resolves once existing group calls in the room
886
- * have been processed.
887
- */
888
- waitUntilRoomReadyForGroupCalls(roomId) {
889
- return this.groupCallEventHandler.waitUntilRoomReadyForGroupCalls(roomId);
890
- }
891
-
892
- /**
893
- * Get an existing group call for the provided room.
894
- * @returns The group call or null if it doesn't already exist.
895
- */
896
- getGroupCallForRoom(roomId) {
897
- return this.groupCallEventHandler.groupCalls.get(roomId) || null;
898
- }
899
-
900
790
  /**
901
791
  * Get the current sync state.
902
792
  * @returns the sync state, which may be null.
@@ -999,11 +889,11 @@ export class MatrixClient extends TypedEventEmitter {
999
889
  * @returns Promise resolving with The capabilities of the homeserver
1000
890
  */
1001
891
  getCapabilities() {
1002
- var _this10 = this;
892
+ var _this9 = this;
1003
893
  return _asyncToGenerator(function* () {
1004
- var caps = _this10.serverCapabilitiesService.getCachedCapabilities();
894
+ var caps = _this9.serverCapabilitiesService.getCachedCapabilities();
1005
895
  if (caps) return caps;
1006
- return _this10.serverCapabilitiesService.fetchCapabilities();
896
+ return _this9.serverCapabilitiesService.fetchCapabilities();
1007
897
  })();
1008
898
  }
1009
899
 
@@ -1039,43 +929,43 @@ export class MatrixClient extends TypedEventEmitter {
1039
929
  * @deprecated libolm is deprecated. Prefer {@link initRustCrypto}.
1040
930
  */
1041
931
  initCrypto() {
1042
- var _this11 = this;
932
+ var _this10 = this;
1043
933
  return _asyncToGenerator(function* () {
1044
- if (_this11.cryptoBackend) {
1045
- _this11.logger.warn("Attempt to re-initialise e2e encryption on MatrixClient");
934
+ if (_this10.cryptoBackend) {
935
+ _this10.logger.warn("Attempt to re-initialise e2e encryption on MatrixClient");
1046
936
  return;
1047
937
  }
1048
- if (!_this11.cryptoStore) {
938
+ if (!_this10.cryptoStore) {
1049
939
  // the cryptostore is provided by sdk.createClient, so this shouldn't happen
1050
940
  throw new Error("Cannot enable encryption: no cryptoStore provided");
1051
941
  }
1052
- _this11.logger.debug("Crypto: Starting up crypto store...");
1053
- yield _this11.cryptoStore.startup();
1054
- var userId = _this11.getUserId();
942
+ _this10.logger.debug("Crypto: Starting up crypto store...");
943
+ yield _this10.cryptoStore.startup();
944
+ var userId = _this10.getUserId();
1055
945
  if (userId === null) {
1056
946
  throw new Error("Cannot enable encryption on MatrixClient with unknown userId: " + "ensure userId is passed in createClient().");
1057
947
  }
1058
- if (_this11.deviceId === null) {
948
+ if (_this10.deviceId === null) {
1059
949
  throw new Error("Cannot enable encryption on MatrixClient with unknown deviceId: " + "ensure deviceId is passed in createClient().");
1060
950
  }
1061
- var crypto = new Crypto(_this11, userId, _this11.deviceId, _this11.store, _this11.cryptoStore, _this11.verificationMethods);
1062
- _this11.reEmitter.reEmit(crypto, [LegacyCryptoEvent.KeyBackupFailed, LegacyCryptoEvent.KeyBackupSessionsRemaining, LegacyCryptoEvent.RoomKeyRequest, LegacyCryptoEvent.RoomKeyRequestCancellation, LegacyCryptoEvent.Warning, LegacyCryptoEvent.DevicesUpdated, LegacyCryptoEvent.WillUpdateDevices, LegacyCryptoEvent.DeviceVerificationChanged, LegacyCryptoEvent.UserTrustStatusChanged, LegacyCryptoEvent.KeysChanged]);
1063
- _this11.logger.debug("Crypto: initialising crypto object...");
951
+ var crypto = new Crypto(_this10, userId, _this10.deviceId, _this10.store, _this10.cryptoStore, _this10.verificationMethods);
952
+ _this10.reEmitter.reEmit(crypto, [LegacyCryptoEvent.KeyBackupFailed, LegacyCryptoEvent.KeyBackupSessionsRemaining, LegacyCryptoEvent.RoomKeyRequest, LegacyCryptoEvent.RoomKeyRequestCancellation, LegacyCryptoEvent.Warning, LegacyCryptoEvent.DevicesUpdated, LegacyCryptoEvent.WillUpdateDevices, LegacyCryptoEvent.DeviceVerificationChanged, LegacyCryptoEvent.UserTrustStatusChanged, LegacyCryptoEvent.KeysChanged]);
953
+ _this10.logger.debug("Crypto: initialising crypto object...");
1064
954
  yield crypto.init({
1065
- exportedOlmDevice: _this11.exportedOlmDeviceToImport,
1066
- pickleKey: _this11.pickleKey
955
+ exportedOlmDevice: _this10.exportedOlmDeviceToImport,
956
+ pickleKey: _this10.pickleKey
1067
957
  });
1068
- delete _this11.exportedOlmDeviceToImport;
1069
- _this11.olmVersion = Crypto.getOlmVersion();
958
+ delete _this10.exportedOlmDeviceToImport;
959
+ _this10.olmVersion = Crypto.getOlmVersion();
1070
960
 
1071
961
  // if crypto initialisation was successful, tell it to attach its event handlers.
1072
- crypto.registerEventHandlers(_this11);
1073
- _this11.cryptoBackend = _this11.crypto = crypto;
962
+ crypto.registerEventHandlers(_this10);
963
+ _this10.cryptoBackend = _this10.crypto = crypto;
1074
964
 
1075
965
  // upload our keys in the background
1076
- _this11.crypto.uploadDeviceKeys().catch(e => {
966
+ _this10.crypto.uploadDeviceKeys().catch(e => {
1077
967
  // TODO: throwing away this error is a really bad idea.
1078
- _this11.logger.error("Error uploading device keys", e);
968
+ _this10.logger.error("Error uploading device keys", e);
1079
969
  });
1080
970
  })();
1081
971
  }
@@ -1098,54 +988,54 @@ export class MatrixClient extends TypedEventEmitter {
1098
988
  */
1099
989
  initRustCrypto() {
1100
990
  var _arguments = arguments,
1101
- _this12 = this;
991
+ _this11 = this;
1102
992
  return _asyncToGenerator(function* () {
1103
- var _this12$pickleKey;
993
+ var _this11$pickleKey;
1104
994
  var args = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : {};
1105
- if (_this12.cryptoBackend) {
1106
- _this12.logger.warn("Attempt to re-initialise e2e encryption on MatrixClient");
995
+ if (_this11.cryptoBackend) {
996
+ _this11.logger.warn("Attempt to re-initialise e2e encryption on MatrixClient");
1107
997
  return;
1108
998
  }
1109
- var userId = _this12.getUserId();
999
+ var userId = _this11.getUserId();
1110
1000
  if (userId === null) {
1111
1001
  throw new Error("Cannot enable encryption on MatrixClient with unknown userId: " + "ensure userId is passed in createClient().");
1112
1002
  }
1113
- var deviceId = _this12.getDeviceId();
1003
+ var deviceId = _this11.getDeviceId();
1114
1004
  if (deviceId === null) {
1115
1005
  throw new Error("Cannot enable encryption on MatrixClient with unknown deviceId: " + "ensure deviceId is passed in createClient().");
1116
1006
  }
1117
1007
 
1118
1008
  // importing rust-crypto will download the webassembly, so we delay it until we know it will be
1119
1009
  // needed.
1120
- _this12.logger.debug("Downloading Rust crypto library");
1010
+ _this11.logger.debug("Downloading Rust crypto library");
1121
1011
  var RustCrypto = yield import("./rust-crypto/index.js");
1122
1012
  var rustCrypto = yield RustCrypto.initRustCrypto({
1123
- logger: _this12.logger,
1124
- http: _this12.http,
1013
+ logger: _this11.logger,
1014
+ http: _this11.http,
1125
1015
  userId: userId,
1126
1016
  deviceId: deviceId,
1127
- secretStorage: _this12.secretStorage,
1128
- cryptoCallbacks: _this12.cryptoCallbacks,
1017
+ secretStorage: _this11.secretStorage,
1018
+ cryptoCallbacks: _this11.cryptoCallbacks,
1129
1019
  storePrefix: args.useIndexedDB === false ? null : RUST_SDK_STORE_PREFIX,
1130
1020
  storeKey: args.storageKey,
1131
1021
  storePassphrase: args.storagePassword,
1132
- legacyCryptoStore: _this12.cryptoStore,
1133
- legacyPickleKey: (_this12$pickleKey = _this12.pickleKey) !== null && _this12$pickleKey !== void 0 ? _this12$pickleKey : "DEFAULT_KEY",
1022
+ legacyCryptoStore: _this11.cryptoStore,
1023
+ legacyPickleKey: (_this11$pickleKey = _this11.pickleKey) !== null && _this11$pickleKey !== void 0 ? _this11$pickleKey : "DEFAULT_KEY",
1134
1024
  legacyMigrationProgressListener: (progress, total) => {
1135
- _this12.emit(CryptoEvent.LegacyCryptoStoreMigrationProgress, progress, total);
1025
+ _this11.emit(CryptoEvent.LegacyCryptoStoreMigrationProgress, progress, total);
1136
1026
  }
1137
1027
  });
1138
- rustCrypto.setSupportedVerificationMethods(_this12.verificationMethods);
1139
- _this12.cryptoBackend = rustCrypto;
1028
+ rustCrypto.setSupportedVerificationMethods(_this11.verificationMethods);
1029
+ _this11.cryptoBackend = rustCrypto;
1140
1030
 
1141
1031
  // attach the event listeners needed by RustCrypto
1142
- _this12.on(RoomMemberEvent.Membership, rustCrypto.onRoomMembership.bind(rustCrypto));
1143
- _this12.on(ClientEvent.Event, event => {
1032
+ _this11.on(RoomMemberEvent.Membership, rustCrypto.onRoomMembership.bind(rustCrypto));
1033
+ _this11.on(ClientEvent.Event, event => {
1144
1034
  rustCrypto.onLiveEventFromSync(event);
1145
1035
  });
1146
1036
 
1147
1037
  // re-emit the events emitted by the crypto impl
1148
- _this12.reEmitter.reEmit(rustCrypto, [CryptoEvent.VerificationRequestReceived, CryptoEvent.UserTrustStatusChanged, CryptoEvent.KeyBackupStatus, CryptoEvent.KeyBackupSessionsRemaining, CryptoEvent.KeyBackupFailed, CryptoEvent.KeyBackupDecryptionKeyCached, CryptoEvent.KeysChanged, CryptoEvent.DevicesUpdated, CryptoEvent.WillUpdateDevices]);
1038
+ _this11.reEmitter.reEmit(rustCrypto, [CryptoEvent.VerificationRequestReceived, CryptoEvent.UserTrustStatusChanged, CryptoEvent.KeyBackupStatus, CryptoEvent.KeyBackupSessionsRemaining, CryptoEvent.KeyBackupFailed, CryptoEvent.KeyBackupDecryptionKeyCached, CryptoEvent.KeysChanged, CryptoEvent.DevicesUpdated, CryptoEvent.WillUpdateDevices]);
1149
1039
  })();
1150
1040
  }
1151
1041
 
@@ -1205,9 +1095,9 @@ export class MatrixClient extends TypedEventEmitter {
1205
1095
  * @deprecated Does nothing.
1206
1096
  */
1207
1097
  uploadKeys() {
1208
- var _this13 = this;
1098
+ var _this12 = this;
1209
1099
  return _asyncToGenerator(function* () {
1210
- _this13.logger.warn("MatrixClient.uploadKeys is deprecated");
1100
+ _this12.logger.warn("MatrixClient.uploadKeys is deprecated");
1211
1101
  })();
1212
1102
  }
1213
1103
 
@@ -1331,12 +1221,12 @@ export class MatrixClient extends TypedEventEmitter {
1331
1221
  return this.setDeviceVerification(userId, deviceId, null, null, known);
1332
1222
  }
1333
1223
  setDeviceVerification(userId, deviceId, verified, blocked, known) {
1334
- var _this14 = this;
1224
+ var _this13 = this;
1335
1225
  return _asyncToGenerator(function* () {
1336
- if (!_this14.crypto) {
1226
+ if (!_this13.crypto) {
1337
1227
  throw new Error("End-to-end encryption disabled");
1338
1228
  }
1339
- yield _this14.crypto.setDeviceVerification(userId, deviceId, verified, blocked, known);
1229
+ yield _this13.crypto.setDeviceVerification(userId, deviceId, verified, blocked, known);
1340
1230
  })();
1341
1231
  }
1342
1232
 
@@ -1983,12 +1873,12 @@ export class MatrixClient extends TypedEventEmitter {
1983
1873
  * @deprecated Not supported for Rust Cryptography.
1984
1874
  */
1985
1875
  getEventSenderDeviceInfo(event) {
1986
- var _this15 = this;
1876
+ var _this14 = this;
1987
1877
  return _asyncToGenerator(function* () {
1988
- if (!_this15.crypto) {
1878
+ if (!_this14.crypto) {
1989
1879
  return null;
1990
1880
  }
1991
- return _this15.crypto.getEventSenderDeviceInfo(event);
1881
+ return _this14.crypto.getEventSenderDeviceInfo(event);
1992
1882
  })();
1993
1883
  }
1994
1884
 
@@ -2003,9 +1893,9 @@ export class MatrixClient extends TypedEventEmitter {
2003
1893
  * @deprecated Not supported for Rust Cryptography.
2004
1894
  */
2005
1895
  isEventSenderVerified(event) {
2006
- var _this16 = this;
1896
+ var _this15 = this;
2007
1897
  return _asyncToGenerator(function* () {
2008
- var device = yield _this16.getEventSenderDeviceInfo(event);
1898
+ var device = yield _this15.getEventSenderDeviceInfo(event);
2009
1899
  if (!device) {
2010
1900
  return false;
2011
1901
  }
@@ -2208,11 +2098,11 @@ export class MatrixClient extends TypedEventEmitter {
2208
2098
  * @deprecated Prefer {@link CryptoApi.getKeyBackupInfo}.
2209
2099
  */
2210
2100
  getKeyBackupVersion() {
2211
- var _this17 = this;
2101
+ var _this16 = this;
2212
2102
  return _asyncToGenerator(function* () {
2213
2103
  var res;
2214
2104
  try {
2215
- res = yield _this17.http.authedRequest(Method.Get, "/room_keys/version", undefined, undefined, {
2105
+ res = yield _this16.http.authedRequest(Method.Get, "/room_keys/version", undefined, undefined, {
2216
2106
  prefix: ClientPrefix.V3
2217
2107
  });
2218
2108
  } catch (e) {
@@ -2300,12 +2190,12 @@ export class MatrixClient extends TypedEventEmitter {
2300
2190
  */
2301
2191
  prepareKeyBackupVersion(password) {
2302
2192
  var _arguments2 = arguments,
2303
- _this18 = this;
2193
+ _this17 = this;
2304
2194
  return _asyncToGenerator(function* () {
2305
2195
  var opts = _arguments2.length > 1 && _arguments2[1] !== undefined ? _arguments2[1] : {
2306
2196
  secureSecretStorage: false
2307
2197
  };
2308
- if (!_this18.crypto) {
2198
+ if (!_this17.crypto) {
2309
2199
  throw new Error("End-to-end encryption disabled");
2310
2200
  }
2311
2201
 
@@ -2315,10 +2205,10 @@ export class MatrixClient extends TypedEventEmitter {
2315
2205
  auth_data,
2316
2206
  recovery_key,
2317
2207
  privateKey
2318
- } = yield _this18.crypto.backupManager.prepareKeyBackupVersion(password);
2208
+ } = yield _this17.crypto.backupManager.prepareKeyBackupVersion(password);
2319
2209
  if (opts.secureSecretStorage) {
2320
- yield _this18.secretStorage.store("m.megolm_backup.v1", encodeBase64(privateKey));
2321
- _this18.logger.info("Key backup private key stored in secret storage");
2210
+ yield _this17.secretStorage.store("m.megolm_backup.v1", encodeBase64(privateKey));
2211
+ _this17.logger.info("Key backup private key stored in secret storage");
2322
2212
  }
2323
2213
  return {
2324
2214
  algorithm,
@@ -2350,12 +2240,12 @@ export class MatrixClient extends TypedEventEmitter {
2350
2240
  * @deprecated Use {@link Crypto.CryptoApi.resetKeyBackup | `CryptoApi.resetKeyBackup`}.
2351
2241
  */
2352
2242
  createKeyBackupVersion(info) {
2353
- var _this19 = this;
2243
+ var _this18 = this;
2354
2244
  return _asyncToGenerator(function* () {
2355
- if (!_this19.crypto) {
2245
+ if (!_this18.crypto) {
2356
2246
  throw new Error("End-to-end encryption disabled");
2357
2247
  }
2358
- yield _this19.crypto.backupManager.createKeyBackupVersion(info);
2248
+ yield _this18.crypto.backupManager.createKeyBackupVersion(info);
2359
2249
  var data = {
2360
2250
  algorithm: info.algorithm,
2361
2251
  auth_data: info.auth_data
@@ -2365,25 +2255,25 @@ export class MatrixClient extends TypedEventEmitter {
2365
2255
  // older devices with cross-signing. This can probably go away very soon in
2366
2256
  // favour of just signing with the cross-singing master key.
2367
2257
  // XXX: Private member access
2368
- yield _this19.crypto.signObject(data.auth_data);
2369
- if (_this19.cryptoCallbacks.getCrossSigningKey &&
2258
+ yield _this18.crypto.signObject(data.auth_data);
2259
+ if (_this18.cryptoCallbacks.getCrossSigningKey &&
2370
2260
  // XXX: Private member access
2371
- _this19.crypto.crossSigningInfo.getId()) {
2261
+ _this18.crypto.crossSigningInfo.getId()) {
2372
2262
  // now also sign the auth data with the cross-signing master key
2373
2263
  // we check for the callback explicitly here because we still want to be able
2374
2264
  // to create an un-cross-signed key backup if there is a cross-signing key but
2375
2265
  // no callback supplied.
2376
2266
  // XXX: Private member access
2377
- yield _this19.crypto.crossSigningInfo.signObject(data.auth_data, "master");
2267
+ yield _this18.crypto.crossSigningInfo.signObject(data.auth_data, "master");
2378
2268
  }
2379
- var res = yield _this19.http.authedRequest(Method.Post, "/room_keys/version", undefined, data);
2269
+ var res = yield _this18.http.authedRequest(Method.Post, "/room_keys/version", undefined, data);
2380
2270
 
2381
2271
  // We could assume everything's okay and enable directly, but this ensures
2382
2272
  // we run the same signature verification that will be used for future
2383
2273
  // sessions.
2384
- yield _this19.checkKeyBackup();
2385
- if (!_this19.getKeyBackupEnabled()) {
2386
- _this19.logger.error("Key backup not usable even though we just created it");
2274
+ yield _this18.checkKeyBackup();
2275
+ if (!_this18.getKeyBackupEnabled()) {
2276
+ _this18.logger.error("Key backup not usable even though we just created it");
2387
2277
  }
2388
2278
  return res;
2389
2279
  })();
@@ -2393,12 +2283,12 @@ export class MatrixClient extends TypedEventEmitter {
2393
2283
  * @deprecated Use {@link Crypto.CryptoApi.deleteKeyBackupVersion | `CryptoApi.deleteKeyBackupVersion`}.
2394
2284
  */
2395
2285
  deleteKeyBackupVersion(version) {
2396
- var _this20 = this;
2286
+ var _this19 = this;
2397
2287
  return _asyncToGenerator(function* () {
2398
- if (!_this20.cryptoBackend) {
2288
+ if (!_this19.cryptoBackend) {
2399
2289
  throw new Error("End-to-end encryption disabled");
2400
2290
  }
2401
- yield _this20.cryptoBackend.deleteKeyBackupVersion(version);
2291
+ yield _this19.cryptoBackend.deleteKeyBackupVersion(version);
2402
2292
  })();
2403
2293
  }
2404
2294
  makeKeyBackupPath(roomId, sessionId, version) {
@@ -2437,13 +2327,13 @@ export class MatrixClient extends TypedEventEmitter {
2437
2327
  */
2438
2328
 
2439
2329
  sendKeyBackup(roomId, sessionId, version, data) {
2440
- var _this21 = this;
2330
+ var _this20 = this;
2441
2331
  return _asyncToGenerator(function* () {
2442
- if (!_this21.crypto) {
2332
+ if (!_this20.crypto) {
2443
2333
  throw new Error("End-to-end encryption disabled");
2444
2334
  }
2445
- var path = _this21.makeKeyBackupPath(roomId, sessionId, version);
2446
- yield _this21.http.authedRequest(Method.Put, path.path, path.queryData, data, {
2335
+ var path = _this20.makeKeyBackupPath(roomId, sessionId, version);
2336
+ yield _this20.http.authedRequest(Method.Put, path.path, path.queryData, data, {
2447
2337
  prefix: ClientPrefix.V3
2448
2338
  });
2449
2339
  })();
@@ -2457,12 +2347,12 @@ export class MatrixClient extends TypedEventEmitter {
2457
2347
  * {@link CryptoApi.resetKeyBackup}, so there is probably no need to call this manually.
2458
2348
  */
2459
2349
  scheduleAllGroupSessionsForBackup() {
2460
- var _this22 = this;
2350
+ var _this21 = this;
2461
2351
  return _asyncToGenerator(function* () {
2462
- if (!_this22.crypto) {
2352
+ if (!_this21.crypto) {
2463
2353
  throw new Error("End-to-end encryption disabled");
2464
2354
  }
2465
- yield _this22.crypto.backupManager.scheduleAllGroupSessionsForBackup();
2355
+ yield _this21.crypto.backupManager.scheduleAllGroupSessionsForBackup();
2466
2356
  })();
2467
2357
  }
2468
2358
 
@@ -2555,10 +2445,10 @@ export class MatrixClient extends TypedEventEmitter {
2555
2445
  * @deprecated Prefer {@link CryptoApi.restoreKeyBackupWithPassphrase | `CryptoApi.restoreKeyBackupWithPassphrase`}.
2556
2446
  */
2557
2447
  restoreKeyBackupWithPassword(password, targetRoomId, targetSessionId, backupInfo, opts) {
2558
- var _this23 = this;
2448
+ var _this22 = this;
2559
2449
  return _asyncToGenerator(function* () {
2560
2450
  var privKey = yield keyFromAuthData(backupInfo.auth_data, password);
2561
- return _this23.restoreKeyBackup(privKey, targetRoomId, targetSessionId, backupInfo, opts);
2451
+ return _this22.restoreKeyBackup(privKey, targetRoomId, targetSessionId, backupInfo, opts);
2562
2452
  })();
2563
2453
  }
2564
2454
 
@@ -2578,22 +2468,22 @@ export class MatrixClient extends TypedEventEmitter {
2578
2468
  * @deprecated Prefer {@link CryptoApi.restoreKeyBackup | `CryptoApi.restoreKeyBackup`}.
2579
2469
  */
2580
2470
  restoreKeyBackupWithSecretStorage(backupInfo, targetRoomId, targetSessionId, opts) {
2581
- var _this24 = this;
2471
+ var _this23 = this;
2582
2472
  return _asyncToGenerator(function* () {
2583
- if (!_this24.cryptoBackend) {
2473
+ if (!_this23.cryptoBackend) {
2584
2474
  throw new Error("End-to-end encryption disabled");
2585
2475
  }
2586
- var storedKey = yield _this24.secretStorage.get("m.megolm_backup.v1");
2476
+ var storedKey = yield _this23.secretStorage.get("m.megolm_backup.v1");
2587
2477
 
2588
2478
  // ensure that the key is in the right format. If not, fix the key and
2589
2479
  // store the fixed version
2590
2480
  var fixedKey = fixBackupKey(storedKey);
2591
2481
  if (fixedKey) {
2592
- var keys = yield _this24.secretStorage.getKey();
2593
- yield _this24.secretStorage.store("m.megolm_backup.v1", fixedKey, [keys[0]]);
2482
+ var keys = yield _this23.secretStorage.getKey();
2483
+ yield _this23.secretStorage.store("m.megolm_backup.v1", fixedKey, [keys[0]]);
2594
2484
  }
2595
2485
  var privKey = decodeBase64(fixedKey || storedKey);
2596
- return _this24.restoreKeyBackup(privKey, targetRoomId, targetSessionId, backupInfo, opts);
2486
+ return _this23.restoreKeyBackup(privKey, targetRoomId, targetSessionId, backupInfo, opts);
2597
2487
  })();
2598
2488
  }
2599
2489
 
@@ -2651,24 +2541,24 @@ export class MatrixClient extends TypedEventEmitter {
2651
2541
  * @deprecated Prefer {@link CryptoApi.restoreKeyBackup | `CryptoApi.restoreKeyBackup`}.
2652
2542
  */
2653
2543
  restoreKeyBackupWithCache(targetRoomId, targetSessionId, backupInfo, opts) {
2654
- var _this25 = this;
2544
+ var _this24 = this;
2655
2545
  return _asyncToGenerator(function* () {
2656
- if (!_this25.cryptoBackend) {
2546
+ if (!_this24.cryptoBackend) {
2657
2547
  throw new Error("End-to-end encryption disabled");
2658
2548
  }
2659
- var privKey = yield _this25.cryptoBackend.getSessionBackupPrivateKey();
2549
+ var privKey = yield _this24.cryptoBackend.getSessionBackupPrivateKey();
2660
2550
  if (!privKey) {
2661
2551
  throw new Error("Couldn't get key");
2662
2552
  }
2663
- return _this25.restoreKeyBackup(privKey, targetRoomId, targetSessionId, backupInfo, opts);
2553
+ return _this24.restoreKeyBackup(privKey, targetRoomId, targetSessionId, backupInfo, opts);
2664
2554
  })();
2665
2555
  }
2666
2556
  restoreKeyBackup(privKey, targetRoomId, targetSessionId, backupInfo, opts) {
2667
- var _this26 = this;
2557
+ var _this25 = this;
2668
2558
  return _asyncToGenerator(function* () {
2669
2559
  var cacheCompleteCallback = opts === null || opts === void 0 ? void 0 : opts.cacheCompleteCallback;
2670
2560
  var progressCallback = opts === null || opts === void 0 ? void 0 : opts.progressCallback;
2671
- if (!_this26.cryptoBackend) {
2561
+ if (!_this25.cryptoBackend) {
2672
2562
  throw new Error("End-to-end encryption disabled");
2673
2563
  }
2674
2564
  if (!backupInfo.version) {
@@ -2678,8 +2568,8 @@ export class MatrixClient extends TypedEventEmitter {
2678
2568
  var totalKeyCount = 0;
2679
2569
  var totalFailures = 0;
2680
2570
  var totalImported = 0;
2681
- var path = _this26.makeKeyBackupPath(targetRoomId, targetSessionId, backupVersion);
2682
- var backupDecryptor = yield _this26.cryptoBackend.getBackupDecryptor(backupInfo, privKey);
2571
+ var path = _this25.makeKeyBackupPath(targetRoomId, targetSessionId, backupVersion);
2572
+ var backupDecryptor = yield _this25.cryptoBackend.getBackupDecryptor(backupInfo, privKey);
2683
2573
  var untrusted = !backupDecryptor.sourceTrusted;
2684
2574
  try {
2685
2575
  if (!(privKey instanceof Uint8Array)) {
@@ -2688,15 +2578,15 @@ export class MatrixClient extends TypedEventEmitter {
2688
2578
  }
2689
2579
  // Cache the key, if possible.
2690
2580
  // This is async.
2691
- _this26.cryptoBackend.storeSessionBackupPrivateKey(privKey, backupVersion).catch(e => {
2692
- _this26.logger.warn("Error caching session backup key:", e);
2581
+ _this25.cryptoBackend.storeSessionBackupPrivateKey(privKey, backupVersion).catch(e => {
2582
+ _this25.logger.warn("Error caching session backup key:", e);
2693
2583
  }).then(cacheCompleteCallback);
2694
2584
  if (progressCallback) {
2695
2585
  progressCallback({
2696
2586
  stage: "fetch"
2697
2587
  });
2698
2588
  }
2699
- var res = yield _this26.http.authedRequest(Method.Get, path.path, path.queryData, undefined, {
2589
+ var res = yield _this25.http.authedRequest(Method.Get, path.path, path.queryData, undefined, {
2700
2590
  prefix: ClientPrefix.V3
2701
2591
  });
2702
2592
 
@@ -2710,14 +2600,14 @@ export class MatrixClient extends TypedEventEmitter {
2710
2600
  // We have a full backup here, it can get quite big, so we need to decrypt and import it in chunks.
2711
2601
 
2712
2602
  // Get the total count as a first pass
2713
- totalKeyCount = _this26.getTotalKeyCount(res);
2603
+ totalKeyCount = _this25.getTotalKeyCount(res);
2714
2604
  // Now decrypt and import the keys in chunks
2715
- yield _this26.handleDecryptionOfAFullBackup(res, backupDecryptor, 200, /*#__PURE__*/function () {
2605
+ yield _this25.handleDecryptionOfAFullBackup(res, backupDecryptor, 200, /*#__PURE__*/function () {
2716
2606
  var _ref3 = _asyncToGenerator(function* (chunk) {
2717
2607
  // We have a chunk of decrypted keys: import them
2718
2608
  try {
2719
2609
  var _backupVersion = backupInfo.version;
2720
- yield _this26.cryptoBackend.importBackedUpRoomKeys(chunk, _backupVersion, {
2610
+ yield _this25.cryptoBackend.importBackedUpRoomKeys(chunk, _backupVersion, {
2721
2611
  untrusted
2722
2612
  });
2723
2613
  totalImported += chunk.length;
@@ -2749,7 +2639,7 @@ export class MatrixClient extends TypedEventEmitter {
2749
2639
  for (var _k of keys) {
2750
2640
  _k.room_id = targetRoomId;
2751
2641
  }
2752
- yield _this26.cryptoBackend.importBackedUpRoomKeys(keys, backupVersion, {
2642
+ yield _this25.cryptoBackend.importBackedUpRoomKeys(keys, backupVersion, {
2753
2643
  progressCallback,
2754
2644
  untrusted
2755
2645
  });
@@ -2762,13 +2652,13 @@ export class MatrixClient extends TypedEventEmitter {
2762
2652
  });
2763
2653
  _key2.room_id = targetRoomId;
2764
2654
  _key2.session_id = targetSessionId;
2765
- yield _this26.cryptoBackend.importBackedUpRoomKeys([_key2], backupVersion, {
2655
+ yield _this25.cryptoBackend.importBackedUpRoomKeys([_key2], backupVersion, {
2766
2656
  progressCallback,
2767
2657
  untrusted
2768
2658
  });
2769
2659
  totalImported = 1;
2770
2660
  } catch (e) {
2771
- _this26.logger.debug("Failed to decrypt megolm session from backup", e);
2661
+ _this25.logger.debug("Failed to decrypt megolm session from backup", e);
2772
2662
  }
2773
2663
  }
2774
2664
  } finally {
@@ -2776,7 +2666,7 @@ export class MatrixClient extends TypedEventEmitter {
2776
2666
  }
2777
2667
 
2778
2668
  /// in case entering the passphrase would add a new signature?
2779
- yield _this26.cryptoBackend.checkKeyBackupAndEnable();
2669
+ yield _this25.cryptoBackend.checkKeyBackupAndEnable();
2780
2670
  return {
2781
2671
  total: totalKeyCount,
2782
2672
  imported: totalImported
@@ -2859,10 +2749,10 @@ export class MatrixClient extends TypedEventEmitter {
2859
2749
  })();
2860
2750
  }
2861
2751
  deleteKeysFromBackup(roomId, sessionId, version) {
2862
- var _this27 = this;
2752
+ var _this26 = this;
2863
2753
  return _asyncToGenerator(function* () {
2864
- var path = _this27.makeKeyBackupPath(roomId, sessionId, version);
2865
- yield _this27.http.authedRequest(Method.Delete, path.path, path.queryData, undefined, {
2754
+ var path = _this26.makeKeyBackupPath(roomId, sessionId, version);
2755
+ yield _this26.http.authedRequest(Method.Delete, path.path, path.queryData, undefined, {
2866
2756
  prefix: ClientPrefix.V3
2867
2757
  });
2868
2758
  })();
@@ -2986,10 +2876,10 @@ export class MatrixClient extends TypedEventEmitter {
2986
2876
  * @returns Rejects: with an error response.
2987
2877
  */
2988
2878
  getAccountDataFromServer(eventType) {
2989
- var _this28 = this;
2879
+ var _this27 = this;
2990
2880
  return _asyncToGenerator(function* () {
2991
- if (_this28.isInitialSyncComplete()) {
2992
- var _event = _this28.store.getAccountData(eventType);
2881
+ if (_this27.isInitialSyncComplete()) {
2882
+ var _event = _this27.store.getAccountData(eventType);
2993
2883
  if (!_event) {
2994
2884
  return null;
2995
2885
  }
@@ -2998,11 +2888,11 @@ export class MatrixClient extends TypedEventEmitter {
2998
2888
  return _event.getContent();
2999
2889
  }
3000
2890
  var path = utils.encodeUri("/user/$userId/account_data/$type", {
3001
- $userId: _this28.credentials.userId,
2891
+ $userId: _this27.credentials.userId,
3002
2892
  $type: eventType
3003
2893
  });
3004
2894
  try {
3005
- return yield _this28.http.authedRequest(Method.Get, path);
2895
+ return yield _this27.http.authedRequest(Method.Get, path);
3006
2896
  } catch (e) {
3007
2897
  var _data;
3008
2898
  if (((_data = e.data) === null || _data === void 0 ? void 0 : _data.errcode) === "M_NOT_FOUND") {
@@ -3013,22 +2903,22 @@ export class MatrixClient extends TypedEventEmitter {
3013
2903
  })();
3014
2904
  }
3015
2905
  deleteAccountData(eventType) {
3016
- var _this29 = this;
2906
+ var _this28 = this;
3017
2907
  return _asyncToGenerator(function* () {
3018
- var msc3391DeleteAccountDataServerSupport = _this29.canSupport.get(Feature.AccountDataDeletion);
2908
+ var msc3391DeleteAccountDataServerSupport = _this28.canSupport.get(Feature.AccountDataDeletion);
3019
2909
  // if deletion is not supported overwrite with empty content
3020
2910
  if (msc3391DeleteAccountDataServerSupport === ServerSupport.Unsupported) {
3021
- yield _this29.setAccountData(eventType, {});
2911
+ yield _this28.setAccountData(eventType, {});
3022
2912
  return;
3023
2913
  }
3024
2914
  var path = utils.encodeUri("/user/$userId/account_data/$type", {
3025
- $userId: _this29.getSafeUserId(),
2915
+ $userId: _this28.getSafeUserId(),
3026
2916
  $type: eventType
3027
2917
  });
3028
2918
  var options = msc3391DeleteAccountDataServerSupport === ServerSupport.Unstable ? {
3029
2919
  prefix: "/_matrix/client/unstable/org.matrix.msc3391"
3030
2920
  } : undefined;
3031
- return yield _this29.http.authedRequest(Method.Delete, path, undefined, undefined, options);
2921
+ return yield _this28.http.authedRequest(Method.Delete, path, undefined, undefined, options);
3032
2922
  })();
3033
2923
  }
3034
2924
 
@@ -3076,19 +2966,19 @@ export class MatrixClient extends TypedEventEmitter {
3076
2966
  */
3077
2967
  joinRoom(roomIdOrAlias) {
3078
2968
  var _arguments3 = arguments,
3079
- _this30 = this;
2969
+ _this29 = this;
3080
2970
  return _asyncToGenerator(function* () {
3081
2971
  var opts = _arguments3.length > 1 && _arguments3[1] !== undefined ? _arguments3[1] : {};
3082
2972
  if (opts.syncRoom === undefined) {
3083
2973
  opts.syncRoom = true;
3084
2974
  }
3085
- var room = _this30.getRoom(roomIdOrAlias);
3086
- if (room !== null && room !== void 0 && room.hasMembershipState(_this30.credentials.userId, KnownMembership.Join)) return room;
2975
+ var room = _this29.getRoom(roomIdOrAlias);
2976
+ if (room !== null && room !== void 0 && room.hasMembershipState(_this29.credentials.userId, KnownMembership.Join)) return room;
3087
2977
  var signPromise = Promise.resolve();
3088
2978
  if (opts.inviteSignUrl) {
3089
2979
  var _url = new URL(opts.inviteSignUrl);
3090
- _url.searchParams.set("mxid", _this30.credentials.userId);
3091
- signPromise = _this30.http.requestOtherUrl(Method.Post, _url);
2980
+ _url.searchParams.set("mxid", _this29.credentials.userId);
2981
+ signPromise = _this29.http.requestOtherUrl(Method.Post, _url);
3092
2982
  }
3093
2983
  var queryParams = {};
3094
2984
  if (opts.viaServers) {
@@ -3104,14 +2994,14 @@ export class MatrixClient extends TypedEventEmitter {
3104
2994
  var path = utils.encodeUri("/join/$roomid", {
3105
2995
  $roomid: roomIdOrAlias
3106
2996
  });
3107
- var res = yield _this30.http.authedRequest(Method.Post, path, queryParams, data);
2997
+ var res = yield _this29.http.authedRequest(Method.Post, path, queryParams, data);
3108
2998
  var roomId = res.room_id;
3109
2999
  // In case we were originally given an alias, check the room cache again
3110
3000
  // with the resolved ID - this method is supposed to no-op if we already
3111
3001
  // were in the room, after all.
3112
- var resolvedRoom = _this30.getRoom(roomId);
3113
- if (resolvedRoom !== null && resolvedRoom !== void 0 && resolvedRoom.hasMembershipState(_this30.credentials.userId, KnownMembership.Join)) return resolvedRoom;
3114
- var syncApi = new SyncApi(_this30, _this30.clientOpts, _this30.buildSyncApiOptions());
3002
+ var resolvedRoom = _this29.getRoom(roomId);
3003
+ if (resolvedRoom !== null && resolvedRoom !== void 0 && resolvedRoom.hasMembershipState(_this29.credentials.userId, KnownMembership.Join)) return resolvedRoom;
3004
+ var syncApi = new SyncApi(_this29, _this29.clientOpts, _this29.buildSyncApiOptions());
3115
3005
  var syncRoom = syncApi.createRoom(roomId);
3116
3006
  if (opts.syncRoom) {
3117
3007
  // v2 will do this for us
@@ -3281,17 +3171,17 @@ export class MatrixClient extends TypedEventEmitter {
3281
3171
  * @returns Rejects: with an error response.
3282
3172
  */
3283
3173
  setPowerLevel(roomId, userId, powerLevel) {
3284
- var _this31 = this;
3174
+ var _this30 = this;
3285
3175
  return _asyncToGenerator(function* () {
3286
3176
  var _content;
3287
3177
  var content;
3288
- if (_this31.clientRunning && _this31.isInitialSyncComplete()) {
3289
- var _this31$getRoom;
3290
- content = (_this31$getRoom = _this31.getRoom(roomId)) === null || _this31$getRoom === void 0 || (_this31$getRoom = _this31$getRoom.currentState) === null || _this31$getRoom === void 0 || (_this31$getRoom = _this31$getRoom.getStateEvents(EventType.RoomPowerLevels, "")) === null || _this31$getRoom === void 0 ? void 0 : _this31$getRoom.getContent();
3178
+ if (_this30.clientRunning && _this30.isInitialSyncComplete()) {
3179
+ var _this30$getRoom;
3180
+ content = (_this30$getRoom = _this30.getRoom(roomId)) === null || _this30$getRoom === void 0 || (_this30$getRoom = _this30$getRoom.currentState) === null || _this30$getRoom === void 0 || (_this30$getRoom = _this30$getRoom.getStateEvents(EventType.RoomPowerLevels, "")) === null || _this30$getRoom === void 0 ? void 0 : _this30$getRoom.getContent();
3291
3181
  }
3292
3182
  if (!content) {
3293
3183
  try {
3294
- content = yield _this31.getStateEvent(roomId, EventType.RoomPowerLevels, "");
3184
+ content = yield _this30.getStateEvent(roomId, EventType.RoomPowerLevels, "");
3295
3185
  } catch (e) {
3296
3186
  // It is possible for a Matrix room to not have a power levels event
3297
3187
  if (e instanceof MatrixError && e.errcode === "M_NOT_FOUND") {
@@ -3316,7 +3206,7 @@ export class MatrixClient extends TypedEventEmitter {
3316
3206
  content.users[user] = powerLevel;
3317
3207
  }
3318
3208
  }
3319
- return _this31.sendStateEvent(roomId, EventType.RoomPowerLevels, content, "");
3209
+ return _this30.sendStateEvent(roomId, EventType.RoomPowerLevels, content, "");
3320
3210
  })();
3321
3211
  }
3322
3212
 
@@ -3326,9 +3216,9 @@ export class MatrixClient extends TypedEventEmitter {
3326
3216
  */
3327
3217
  // eslint-disable-next-line @typescript-eslint/naming-convention
3328
3218
  unstable_createLiveBeacon(roomId, beaconInfoContent) {
3329
- var _this32 = this;
3219
+ var _this31 = this;
3330
3220
  return _asyncToGenerator(function* () {
3331
- return _this32.unstable_setLiveBeacon(roomId, beaconInfoContent);
3221
+ return _this31.unstable_setLiveBeacon(roomId, beaconInfoContent);
3332
3222
  })();
3333
3223
  }
3334
3224
 
@@ -3340,9 +3230,9 @@ export class MatrixClient extends TypedEventEmitter {
3340
3230
  */
3341
3231
  // eslint-disable-next-line @typescript-eslint/naming-convention
3342
3232
  unstable_setLiveBeacon(roomId, beaconInfoContent) {
3343
- var _this33 = this;
3233
+ var _this32 = this;
3344
3234
  return _asyncToGenerator(function* () {
3345
- return _this33.sendStateEvent(roomId, M_BEACON_INFO.name, beaconInfoContent, _this33.getUserId());
3235
+ return _this32.sendStateEvent(roomId, M_BEACON_INFO.name, beaconInfoContent, _this32.getUserId());
3346
3236
  })();
3347
3237
  }
3348
3238
  sendEvent(roomId, threadIdOrEventType, eventTypeOrContent, contentOrTxnId, txnIdOrVoid) {
@@ -3490,18 +3380,18 @@ export class MatrixClient extends TypedEventEmitter {
3490
3380
  */
3491
3381
 
3492
3382
  encryptAndSendEvent(room, event, delayOpts) {
3493
- var _this34 = this;
3383
+ var _this33 = this;
3494
3384
  return _asyncToGenerator(function* () {
3495
3385
  if (delayOpts) {
3496
- return _this34.sendEventHttpRequest(event, delayOpts);
3386
+ return _this33.sendEventHttpRequest(event, delayOpts);
3497
3387
  }
3498
3388
  try {
3499
3389
  var cancelled;
3500
- _this34.eventsBeingEncrypted.add(event.getId());
3390
+ _this33.eventsBeingEncrypted.add(event.getId());
3501
3391
  try {
3502
- yield _this34.encryptEventIfNeeded(event, room !== null && room !== void 0 ? room : undefined);
3392
+ yield _this33.encryptEventIfNeeded(event, room !== null && room !== void 0 ? room : undefined);
3503
3393
  } finally {
3504
- cancelled = !_this34.eventsBeingEncrypted.delete(event.getId());
3394
+ cancelled = !_this33.eventsBeingEncrypted.delete(event.getId());
3505
3395
  }
3506
3396
  if (cancelled) {
3507
3397
  // cancelled via MatrixClient::cancelPendingEvent
@@ -3511,23 +3401,23 @@ export class MatrixClient extends TypedEventEmitter {
3511
3401
  // encryptEventIfNeeded may have updated the status from SENDING to ENCRYPTING. If so, we need
3512
3402
  // to put it back.
3513
3403
  if (event.status === EventStatus.ENCRYPTING) {
3514
- _this34.updatePendingEventStatus(room, event, EventStatus.SENDING);
3404
+ _this33.updatePendingEventStatus(room, event, EventStatus.SENDING);
3515
3405
  }
3516
3406
  var promise = null;
3517
- if (_this34.scheduler) {
3407
+ if (_this33.scheduler) {
3518
3408
  // if this returns a promise then the scheduler has control now and will
3519
3409
  // resolve/reject when it is done. Internally, the scheduler will invoke
3520
3410
  // processFn which is set to this._sendEventHttpRequest so the same code
3521
3411
  // path is executed regardless.
3522
- promise = _this34.scheduler.queueEvent(event);
3523
- if (promise && _this34.scheduler.getQueueForEvent(event).length > 1) {
3412
+ promise = _this33.scheduler.queueEvent(event);
3413
+ if (promise && _this33.scheduler.getQueueForEvent(event).length > 1) {
3524
3414
  // event is processed FIFO so if the length is 2 or more we know
3525
3415
  // this event is stuck behind an earlier event.
3526
- _this34.updatePendingEventStatus(room, event, EventStatus.QUEUED);
3416
+ _this33.updatePendingEventStatus(room, event, EventStatus.QUEUED);
3527
3417
  }
3528
3418
  }
3529
3419
  if (!promise) {
3530
- promise = _this34.sendEventHttpRequest(event);
3420
+ promise = _this33.sendEventHttpRequest(event);
3531
3421
  if (room) {
3532
3422
  promise = promise.then(res => {
3533
3423
  room.updatePendingEvent(event, EventStatus.SENT, res["event_id"]);
@@ -3537,15 +3427,15 @@ export class MatrixClient extends TypedEventEmitter {
3537
3427
  }
3538
3428
  return yield promise;
3539
3429
  } catch (err) {
3540
- _this34.logger.error("Error sending event", err);
3430
+ _this33.logger.error("Error sending event", err);
3541
3431
  try {
3542
3432
  // set the error on the event before we update the status:
3543
3433
  // updating the status emits the event, so the state should be
3544
3434
  // consistent at that point.
3545
3435
  event.error = err;
3546
- _this34.updatePendingEventStatus(room, event, EventStatus.NOT_SENT);
3436
+ _this33.updatePendingEventStatus(room, event, EventStatus.NOT_SENT);
3547
3437
  } catch (e) {
3548
- _this34.logger.error("Exception in error handler!", e);
3438
+ _this33.logger.error("Exception in error handler!", e);
3549
3439
  }
3550
3440
  if (err instanceof MatrixError) {
3551
3441
  err.event = event;
@@ -3555,22 +3445,22 @@ export class MatrixClient extends TypedEventEmitter {
3555
3445
  })();
3556
3446
  }
3557
3447
  encryptEventIfNeeded(event, room) {
3558
- var _this35 = this;
3448
+ var _this34 = this;
3559
3449
  return _asyncToGenerator(function* () {
3560
3450
  // If the room is unknown, we cannot encrypt for it
3561
3451
  if (!room) return;
3562
- if (!(yield _this35.shouldEncryptEventForRoom(event, room))) return;
3563
- if (!_this35.cryptoBackend && _this35.usingExternalCrypto) {
3452
+ if (!(yield _this34.shouldEncryptEventForRoom(event, room))) return;
3453
+ if (!_this34.cryptoBackend && _this34.usingExternalCrypto) {
3564
3454
  // The client has opted to allow sending messages to encrypted
3565
3455
  // rooms even if the room is encrypted, and we haven't set up
3566
3456
  // crypto. This is useful for users of matrix-org/pantalaimon
3567
3457
  return;
3568
3458
  }
3569
- if (!_this35.cryptoBackend) {
3459
+ if (!_this34.cryptoBackend) {
3570
3460
  throw new Error("This room is configured to use encryption, but your client does not support encryption.");
3571
3461
  }
3572
- _this35.updatePendingEventStatus(room, event, EventStatus.ENCRYPTING);
3573
- yield _this35.cryptoBackend.encryptEvent(event, room);
3462
+ _this34.updatePendingEventStatus(room, event, EventStatus.ENCRYPTING);
3463
+ yield _this34.cryptoBackend.encryptEvent(event, room);
3574
3464
  })();
3575
3465
  }
3576
3466
 
@@ -3580,9 +3470,9 @@ export class MatrixClient extends TypedEventEmitter {
3580
3470
  * This takes into account event type and room configuration.
3581
3471
  */
3582
3472
  shouldEncryptEventForRoom(event, room) {
3583
- var _this36 = this;
3473
+ var _this35 = this;
3584
3474
  return _asyncToGenerator(function* () {
3585
- var _this36$cryptoBackend;
3475
+ var _this35$cryptoBackend;
3586
3476
  if (event.isEncrypted()) {
3587
3477
  // this event has already been encrypted; this happens if the
3588
3478
  // encryption step succeeded, but the send step failed on the first
@@ -3612,7 +3502,7 @@ export class MatrixClient extends TypedEventEmitter {
3612
3502
  if (room.hasEncryptionStateEvent()) return true;
3613
3503
 
3614
3504
  // If we have a crypto impl, and *it* thinks we should encrypt, then we should.
3615
- if (yield (_this36$cryptoBackend = _this36.cryptoBackend) === null || _this36$cryptoBackend === void 0 ? void 0 : _this36$cryptoBackend.isEncryptionEnabledInRoom(room.roomId)) return true;
3505
+ if (yield (_this35$cryptoBackend = _this35.cryptoBackend) === null || _this35$cryptoBackend === void 0 ? void 0 : _this35$cryptoBackend.isEncryptionEnabledInRoom(room.roomId)) return true;
3616
3506
 
3617
3507
  // Otherwise, no need to encrypt.
3618
3508
  return false;
@@ -3880,13 +3770,13 @@ export class MatrixClient extends TypedEventEmitter {
3880
3770
  */
3881
3771
  // eslint-disable-next-line
3882
3772
  _unstable_sendDelayedEvent(roomId, delayOpts, threadId, eventType, content, txnId) {
3883
- var _this37 = this;
3773
+ var _this36 = this;
3884
3774
  return _asyncToGenerator(function* () {
3885
- if (!(yield _this37.doesServerSupportUnstableFeature(UNSTABLE_MSC4140_DELAYED_EVENTS))) {
3775
+ if (!(yield _this36.doesServerSupportUnstableFeature(UNSTABLE_MSC4140_DELAYED_EVENTS))) {
3886
3776
  throw Error("Server does not support the delayed events API");
3887
3777
  }
3888
- _this37.addThreadRelationIfNeeded(content, threadId, roomId);
3889
- return _this37.sendCompleteEvent(roomId, threadId, {
3778
+ _this36.addThreadRelationIfNeeded(content, threadId, roomId);
3779
+ return _this36.sendCompleteEvent(roomId, threadId, {
3890
3780
  type: eventType,
3891
3781
  content
3892
3782
  }, delayOpts, txnId);
@@ -3902,11 +3792,11 @@ export class MatrixClient extends TypedEventEmitter {
3902
3792
  // eslint-disable-next-line
3903
3793
  _unstable_sendDelayedStateEvent(roomId, delayOpts, eventType, content) {
3904
3794
  var _arguments4 = arguments,
3905
- _this38 = this;
3795
+ _this37 = this;
3906
3796
  return _asyncToGenerator(function* () {
3907
3797
  var stateKey = _arguments4.length > 4 && _arguments4[4] !== undefined ? _arguments4[4] : "";
3908
3798
  var opts = _arguments4.length > 5 && _arguments4[5] !== undefined ? _arguments4[5] : {};
3909
- if (!(yield _this38.doesServerSupportUnstableFeature(UNSTABLE_MSC4140_DELAYED_EVENTS))) {
3799
+ if (!(yield _this37.doesServerSupportUnstableFeature(UNSTABLE_MSC4140_DELAYED_EVENTS))) {
3910
3800
  throw Error("Server does not support the delayed events API");
3911
3801
  }
3912
3802
  var pathParams = {
@@ -3918,7 +3808,7 @@ export class MatrixClient extends TypedEventEmitter {
3918
3808
  if (stateKey !== undefined) {
3919
3809
  path = utils.encodeUri(path + "/$stateKey", pathParams);
3920
3810
  }
3921
- return _this38.http.authedRequest(Method.Put, path, getUnstableDelayQueryOpts(delayOpts), content, opts);
3811
+ return _this37.http.authedRequest(Method.Put, path, getUnstableDelayQueryOpts(delayOpts), content, opts);
3922
3812
  })();
3923
3813
  }
3924
3814
 
@@ -3930,15 +3820,15 @@ export class MatrixClient extends TypedEventEmitter {
3930
3820
  */
3931
3821
  // eslint-disable-next-line
3932
3822
  _unstable_getDelayedEvents(fromToken) {
3933
- var _this39 = this;
3823
+ var _this38 = this;
3934
3824
  return _asyncToGenerator(function* () {
3935
- if (!(yield _this39.doesServerSupportUnstableFeature(UNSTABLE_MSC4140_DELAYED_EVENTS))) {
3825
+ if (!(yield _this38.doesServerSupportUnstableFeature(UNSTABLE_MSC4140_DELAYED_EVENTS))) {
3936
3826
  throw Error("Server does not support the delayed events API");
3937
3827
  }
3938
3828
  var queryDict = fromToken ? {
3939
3829
  from: fromToken
3940
3830
  } : undefined;
3941
- return yield _this39.http.authedRequest(Method.Get, "/delayed_events", queryDict, undefined, {
3831
+ return yield _this38.http.authedRequest(Method.Get, "/delayed_events", queryDict, undefined, {
3942
3832
  prefix: "".concat(ClientPrefix.Unstable, "/").concat(UNSTABLE_MSC4140_DELAYED_EVENTS)
3943
3833
  });
3944
3834
  })();
@@ -3952,9 +3842,9 @@ export class MatrixClient extends TypedEventEmitter {
3952
3842
  */
3953
3843
  // eslint-disable-next-line
3954
3844
  _unstable_updateDelayedEvent(delayId, action) {
3955
- var _this40 = this;
3845
+ var _this39 = this;
3956
3846
  return _asyncToGenerator(function* () {
3957
- if (!(yield _this40.doesServerSupportUnstableFeature(UNSTABLE_MSC4140_DELAYED_EVENTS))) {
3847
+ if (!(yield _this39.doesServerSupportUnstableFeature(UNSTABLE_MSC4140_DELAYED_EVENTS))) {
3958
3848
  throw Error("Server does not support the delayed events API");
3959
3849
  }
3960
3850
  var path = utils.encodeUri("/delayed_events/$delayId", {
@@ -3963,7 +3853,7 @@ export class MatrixClient extends TypedEventEmitter {
3963
3853
  var data = {
3964
3854
  action
3965
3855
  };
3966
- return yield _this40.http.authedRequest(Method.Post, path, undefined, data, {
3856
+ return yield _this39.http.authedRequest(Method.Post, path, undefined, data, {
3967
3857
  prefix: "".concat(ClientPrefix.Unstable, "/").concat(UNSTABLE_MSC4140_DELAYED_EVENTS)
3968
3858
  });
3969
3859
  })();
@@ -3981,10 +3871,10 @@ export class MatrixClient extends TypedEventEmitter {
3981
3871
  */
3982
3872
  sendReceipt(event, receiptType, body) {
3983
3873
  var _arguments5 = arguments,
3984
- _this41 = this;
3874
+ _this40 = this;
3985
3875
  return _asyncToGenerator(function* () {
3986
3876
  var unthreaded = _arguments5.length > 3 && _arguments5[3] !== undefined ? _arguments5[3] : false;
3987
- if (_this41.isGuest()) {
3877
+ if (_this40.isGuest()) {
3988
3878
  return Promise.resolve({}); // guests cannot send receipts so don't bother.
3989
3879
  }
3990
3880
  var path = utils.encodeUri("/rooms/$roomId/receipt/$receiptType/$eventId", {
@@ -3995,14 +3885,14 @@ export class MatrixClient extends TypedEventEmitter {
3995
3885
 
3996
3886
  // Unless we're explicitly making an unthreaded receipt or we don't
3997
3887
  // support threads, include the `thread_id` property in the body.
3998
- var shouldAddThreadId = !unthreaded && _this41.supportsThreads();
3888
+ var shouldAddThreadId = !unthreaded && _this40.supportsThreads();
3999
3889
  var fullBody = shouldAddThreadId ? _objectSpread(_objectSpread({}, body), {}, {
4000
3890
  thread_id: threadIdForReceipt(event)
4001
3891
  }) : body;
4002
- var promise = _this41.http.authedRequest(Method.Post, path, undefined, fullBody || {});
4003
- var room = _this41.getRoom(event.getRoomId());
4004
- if (room && _this41.credentials.userId) {
4005
- room.addLocalEchoReceipt(_this41.credentials.userId, event, receiptType, unthreaded);
3892
+ var promise = _this40.http.authedRequest(Method.Post, path, undefined, fullBody || {});
3893
+ var room = _this40.getRoom(event.getRoomId());
3894
+ if (room && _this40.credentials.userId) {
3895
+ room.addLocalEchoReceipt(_this40.credentials.userId, event, receiptType, unthreaded);
4006
3896
  }
4007
3897
  return promise;
4008
3898
  })();
@@ -4017,17 +3907,17 @@ export class MatrixClient extends TypedEventEmitter {
4017
3907
  */
4018
3908
  sendReadReceipt(event) {
4019
3909
  var _arguments6 = arguments,
4020
- _this42 = this;
3910
+ _this41 = this;
4021
3911
  return _asyncToGenerator(function* () {
4022
3912
  var receiptType = _arguments6.length > 1 && _arguments6[1] !== undefined ? _arguments6[1] : ReceiptType.Read;
4023
3913
  var unthreaded = _arguments6.length > 2 && _arguments6[2] !== undefined ? _arguments6[2] : false;
4024
3914
  if (!event) return;
4025
3915
  var eventId = event.getId();
4026
- var room = _this42.getRoom(event.getRoomId());
3916
+ var room = _this41.getRoom(event.getRoomId());
4027
3917
  if (room !== null && room !== void 0 && room.hasPendingEvent(eventId)) {
4028
3918
  throw new Error("Cannot set read receipt to a pending event (".concat(eventId, ")"));
4029
3919
  }
4030
- return _this42.sendReceipt(event, receiptType, {}, unthreaded);
3920
+ return _this41.sendReceipt(event, receiptType, {}, unthreaded);
4031
3921
  })();
4032
3922
  }
4033
3923
 
@@ -4046,9 +3936,9 @@ export class MatrixClient extends TypedEventEmitter {
4046
3936
  * @returns Promise which resolves: the empty object, `{}`.
4047
3937
  */
4048
3938
  setRoomReadMarkers(roomId, rmEventId, rrEvent, rpEvent) {
4049
- var _this43 = this;
3939
+ var _this42 = this;
4050
3940
  return _asyncToGenerator(function* () {
4051
- var room = _this43.getRoom(roomId);
3941
+ var room = _this42.getRoom(roomId);
4052
3942
  if (room !== null && room !== void 0 && room.hasPendingEvent(rmEventId)) {
4053
3943
  throw new Error("Cannot set read marker to a pending event (".concat(rmEventId, ")"));
4054
3944
  }
@@ -4060,7 +3950,7 @@ export class MatrixClient extends TypedEventEmitter {
4060
3950
  if (room !== null && room !== void 0 && room.hasPendingEvent(rrEventId)) {
4061
3951
  throw new Error("Cannot set read receipt to a pending event (".concat(rrEventId, ")"));
4062
3952
  }
4063
- room === null || room === void 0 || room.addLocalEchoReceipt(_this43.credentials.userId, rrEvent, ReceiptType.Read);
3953
+ room === null || room === void 0 || room.addLocalEchoReceipt(_this42.credentials.userId, rrEvent, ReceiptType.Read);
4064
3954
  }
4065
3955
 
4066
3956
  // Add the optional private RR update, do local echo like `sendReceipt`
@@ -4070,9 +3960,9 @@ export class MatrixClient extends TypedEventEmitter {
4070
3960
  if (room !== null && room !== void 0 && room.hasPendingEvent(rpEventId)) {
4071
3961
  throw new Error("Cannot set read receipt to a pending event (".concat(rpEventId, ")"));
4072
3962
  }
4073
- room === null || room === void 0 || room.addLocalEchoReceipt(_this43.credentials.userId, rpEvent, ReceiptType.ReadPrivate);
3963
+ room === null || room === void 0 || room.addLocalEchoReceipt(_this42.credentials.userId, rpEvent, ReceiptType.ReadPrivate);
4074
3964
  }
4075
- return yield _this43.setRoomReadMarkersHttpRequest(roomId, rmEventId, rrEventId, rpEventId);
3965
+ return yield _this42.setRoomReadMarkersHttpRequest(roomId, rmEventId, rrEventId, rpEventId);
4076
3966
  })();
4077
3967
  }
4078
3968
 
@@ -4256,13 +4146,13 @@ export class MatrixClient extends TypedEventEmitter {
4256
4146
  * @returns Rejects: with an error response.
4257
4147
  */
4258
4148
  inviteByThreePid(roomId, medium, address) {
4259
- var _this44 = this;
4149
+ var _this43 = this;
4260
4150
  return _asyncToGenerator(function* () {
4261
- var _this44$identityServe;
4151
+ var _this43$identityServe;
4262
4152
  var path = utils.encodeUri("/rooms/$roomId/invite", {
4263
4153
  $roomId: roomId
4264
4154
  });
4265
- var identityServerUrl = _this44.getIdentityServerUrl(true);
4155
+ var identityServerUrl = _this43.getIdentityServerUrl(true);
4266
4156
  if (!identityServerUrl) {
4267
4157
  return Promise.reject(new MatrixError({
4268
4158
  error: "No supplied identity server URL",
@@ -4274,13 +4164,13 @@ export class MatrixClient extends TypedEventEmitter {
4274
4164
  medium: medium,
4275
4165
  address: address
4276
4166
  };
4277
- if ((_this44$identityServe = _this44.identityServer) !== null && _this44$identityServe !== void 0 && _this44$identityServe.getAccessToken) {
4278
- var identityAccessToken = yield _this44.identityServer.getAccessToken();
4167
+ if ((_this43$identityServe = _this43.identityServer) !== null && _this43$identityServe !== void 0 && _this43$identityServe.getAccessToken) {
4168
+ var identityAccessToken = yield _this43.identityServer.getAccessToken();
4279
4169
  if (identityAccessToken) {
4280
4170
  params["id_access_token"] = identityAccessToken;
4281
4171
  }
4282
4172
  }
4283
- return _this44.http.authedRequest(Method.Post, path, undefined, params);
4173
+ return _this43.http.authedRequest(Method.Post, path, undefined, params);
4284
4174
  })();
4285
4175
  }
4286
4176
 
@@ -4349,17 +4239,17 @@ export class MatrixClient extends TypedEventEmitter {
4349
4239
  */
4350
4240
  forget(roomId) {
4351
4241
  var _arguments7 = arguments,
4352
- _this45 = this;
4242
+ _this44 = this;
4353
4243
  return _asyncToGenerator(function* () {
4354
4244
  var deleteRoom = _arguments7.length > 1 && _arguments7[1] !== undefined ? _arguments7[1] : true;
4355
4245
  // API returns an empty object
4356
4246
  var path = utils.encodeUri("/rooms/$room_id/forget", {
4357
4247
  $room_id: roomId
4358
4248
  });
4359
- var response = yield _this45.http.authedRequest(Method.Post, path);
4249
+ var response = yield _this44.http.authedRequest(Method.Post, path);
4360
4250
  if (deleteRoom) {
4361
- _this45.store.removeRoom(roomId);
4362
- _this45.emit(ClientEvent.DeleteRoom, roomId);
4251
+ _this44.store.removeRoom(roomId);
4252
+ _this44.emit(ClientEvent.DeleteRoom, roomId);
4363
4253
  }
4364
4254
  return response;
4365
4255
  })();
@@ -4473,13 +4363,13 @@ export class MatrixClient extends TypedEventEmitter {
4473
4363
  * @returns Rejects: with an error response.
4474
4364
  */
4475
4365
  setDisplayName(name) {
4476
- var _this46 = this;
4366
+ var _this45 = this;
4477
4367
  return _asyncToGenerator(function* () {
4478
- var prom = yield _this46.setProfileInfo("displayname", {
4368
+ var prom = yield _this45.setProfileInfo("displayname", {
4479
4369
  displayname: name
4480
4370
  });
4481
4371
  // XXX: synthesise a profile update for ourselves because Synapse is broken and won't
4482
- var user = _this46.getUser(_this46.getUserId());
4372
+ var user = _this45.getUser(_this45.getUserId());
4483
4373
  if (user) {
4484
4374
  user.displayName = name;
4485
4375
  user.emit(UserEvent.DisplayName, user.events.presence, user);
@@ -4493,13 +4383,13 @@ export class MatrixClient extends TypedEventEmitter {
4493
4383
  * @returns Rejects: with an error response.
4494
4384
  */
4495
4385
  setAvatarUrl(url) {
4496
- var _this47 = this;
4386
+ var _this46 = this;
4497
4387
  return _asyncToGenerator(function* () {
4498
- var prom = yield _this47.setProfileInfo("avatar_url", {
4388
+ var prom = yield _this46.setProfileInfo("avatar_url", {
4499
4389
  avatar_url: url
4500
4390
  });
4501
4391
  // XXX: synthesise a profile update for ourselves because Synapse is broken and won't
4502
- var user = _this47.getUser(_this47.getUserId());
4392
+ var user = _this46.getUser(_this46.getUserId());
4503
4393
  if (user) {
4504
4394
  user.avatarUrl = url;
4505
4395
  user.emit(UserEvent.AvatarUrl, user.events.presence, user);
@@ -4540,10 +4430,10 @@ export class MatrixClient extends TypedEventEmitter {
4540
4430
  * @param presence - the presence to specify to set_presence of sync calls
4541
4431
  */
4542
4432
  setSyncPresence(presence) {
4543
- var _this48 = this;
4433
+ var _this47 = this;
4544
4434
  return _asyncToGenerator(function* () {
4545
- var _this48$syncApi;
4546
- (_this48$syncApi = _this48.syncApi) === null || _this48$syncApi === void 0 || _this48$syncApi.setPresence(presence);
4435
+ var _this47$syncApi;
4436
+ (_this47$syncApi = _this47.syncApi) === null || _this47$syncApi === void 0 || _this47$syncApi.setPresence(presence);
4547
4437
  })();
4548
4438
  }
4549
4439
 
@@ -4554,16 +4444,16 @@ export class MatrixClient extends TypedEventEmitter {
4554
4444
  * @throws If 'presence' isn't a valid presence enum value.
4555
4445
  */
4556
4446
  setPresence(opts) {
4557
- var _this49 = this;
4447
+ var _this48 = this;
4558
4448
  return _asyncToGenerator(function* () {
4559
4449
  var path = utils.encodeUri("/presence/$userId/status", {
4560
- $userId: _this49.credentials.userId
4450
+ $userId: _this48.credentials.userId
4561
4451
  });
4562
4452
  var validStates = ["offline", "online", "unavailable"];
4563
4453
  if (validStates.indexOf(opts.presence) === -1) {
4564
4454
  throw new Error("Bad presence value: " + opts.presence);
4565
4455
  }
4566
- yield _this49.http.authedRequest(Method.Put, path, undefined, opts);
4456
+ yield _this48.http.authedRequest(Method.Put, path, undefined, opts);
4567
4457
  })();
4568
4458
  }
4569
4459
 
@@ -4672,11 +4562,11 @@ export class MatrixClient extends TypedEventEmitter {
4672
4562
  * {@link EventTimeline} including the given event
4673
4563
  */
4674
4564
  getEventTimeline(timelineSet, eventId) {
4675
- var _this50 = this;
4565
+ var _this49 = this;
4676
4566
  return _asyncToGenerator(function* () {
4677
- var _this50$clientOpts, _ref5, _timelineSet$getTimel, _timelineSet$room$fin;
4567
+ var _this49$clientOpts, _ref5, _timelineSet$getTimel, _timelineSet$room$fin;
4678
4568
  // don't allow any timeline support unless it's been enabled.
4679
- if (!_this50.timelineSupport) {
4569
+ if (!_this49.timelineSupport) {
4680
4570
  throw new Error("timeline support is disabled. Set the 'timelineSupport'" + " parameter to true when creating MatrixClient to enable it.");
4681
4571
  }
4682
4572
  if (!(timelineSet !== null && timelineSet !== void 0 && timelineSet.room)) {
@@ -4685,22 +4575,22 @@ export class MatrixClient extends TypedEventEmitter {
4685
4575
  if (timelineSet.getTimelineForEvent(eventId)) {
4686
4576
  return timelineSet.getTimelineForEvent(eventId);
4687
4577
  }
4688
- if (timelineSet.thread && _this50.supportsThreads()) {
4689
- return _this50.getThreadTimeline(timelineSet, eventId);
4578
+ if (timelineSet.thread && _this49.supportsThreads()) {
4579
+ return _this49.getThreadTimeline(timelineSet, eventId);
4690
4580
  }
4691
4581
  var path = utils.encodeUri("/rooms/$roomId/context/$eventId", {
4692
4582
  $roomId: timelineSet.room.roomId,
4693
4583
  $eventId: eventId
4694
4584
  });
4695
4585
  var params = undefined;
4696
- if ((_this50$clientOpts = _this50.clientOpts) !== null && _this50$clientOpts !== void 0 && _this50$clientOpts.lazyLoadMembers) {
4586
+ if ((_this49$clientOpts = _this49.clientOpts) !== null && _this49$clientOpts !== void 0 && _this49$clientOpts.lazyLoadMembers) {
4697
4587
  params = {
4698
4588
  filter: JSON.stringify(Filter.LAZY_LOADING_MESSAGES_FILTER)
4699
4589
  };
4700
4590
  }
4701
4591
 
4702
4592
  // TODO: we should implement a backoff (as per scrollback()) to deal more nicely with HTTP errors.
4703
- var res = yield _this50.http.authedRequest(Method.Get, path, params);
4593
+ var res = yield _this49.http.authedRequest(Method.Get, path, params);
4704
4594
  if (!res.event) {
4705
4595
  throw new Error("'event' not in '/context' result - homeserver too old?");
4706
4596
  }
@@ -4709,10 +4599,10 @@ export class MatrixClient extends TypedEventEmitter {
4709
4599
  if (timelineSet.getTimelineForEvent(eventId)) {
4710
4600
  return timelineSet.getTimelineForEvent(eventId);
4711
4601
  }
4712
- var mapper = _this50.getEventMapper();
4602
+ var mapper = _this49.getEventMapper();
4713
4603
  var event = mapper(res.event);
4714
4604
  if (event.isRelation(THREAD_RELATION_TYPE.name)) {
4715
- _this50.logger.warn("Tried loading a regular timeline at the position of a thread event");
4605
+ _this49.logger.warn("Tried loading a regular timeline at the position of a thread event");
4716
4606
  return undefined;
4717
4607
  }
4718
4608
  var events = [
@@ -4733,8 +4623,8 @@ export class MatrixClient extends TypedEventEmitter {
4733
4623
  var [timelineEvents, threadedEvents, unknownRelations] = timelineSet.room.partitionThreadedEvents(events);
4734
4624
  timelineSet.addEventsToTimeline(timelineEvents, true, timeline, res.start);
4735
4625
  // The target event is not in a thread but process the contextual events, so we can show any threads around it.
4736
- _this50.processThreadEvents(timelineSet.room, threadedEvents, true);
4737
- _this50.processAggregatedTimelineEvents(timelineSet.room, timelineEvents);
4626
+ _this49.processThreadEvents(timelineSet.room, threadedEvents, true);
4627
+ _this49.processAggregatedTimelineEvents(timelineSet.room, timelineEvents);
4738
4628
  unknownRelations.forEach(event => timelineSet.relations.aggregateChildEvent(event));
4739
4629
 
4740
4630
  // There is no guarantee that the event ended up in "timeline" (we might have switched to a neighbouring
@@ -4746,10 +4636,10 @@ export class MatrixClient extends TypedEventEmitter {
4746
4636
  })();
4747
4637
  }
4748
4638
  getThreadTimeline(timelineSet, eventId) {
4749
- var _this51 = this;
4639
+ var _this50 = this;
4750
4640
  return _asyncToGenerator(function* () {
4751
- var _this51$clientOpts;
4752
- if (!_this51.supportsThreads()) {
4641
+ var _this50$clientOpts;
4642
+ if (!_this50.supportsThreads()) {
4753
4643
  throw new Error("could not get thread timeline: no client support");
4754
4644
  }
4755
4645
  if (!timelineSet.room) {
@@ -4765,18 +4655,18 @@ export class MatrixClient extends TypedEventEmitter {
4765
4655
  var params = {
4766
4656
  limit: "0"
4767
4657
  };
4768
- if ((_this51$clientOpts = _this51.clientOpts) !== null && _this51$clientOpts !== void 0 && _this51$clientOpts.lazyLoadMembers) {
4658
+ if ((_this50$clientOpts = _this50.clientOpts) !== null && _this50$clientOpts !== void 0 && _this50$clientOpts.lazyLoadMembers) {
4769
4659
  params.filter = JSON.stringify(Filter.LAZY_LOADING_MESSAGES_FILTER);
4770
4660
  }
4771
4661
 
4772
4662
  // TODO: we should implement a backoff (as per scrollback()) to deal more nicely with HTTP errors.
4773
- var res = yield _this51.http.authedRequest(Method.Get, path, params);
4774
- var mapper = _this51.getEventMapper();
4663
+ var res = yield _this50.http.authedRequest(Method.Get, path, params);
4664
+ var mapper = _this50.getEventMapper();
4775
4665
  var event = mapper(res.event);
4776
4666
  if (!timelineSet.canContain(event)) {
4777
4667
  return undefined;
4778
4668
  }
4779
- var recurse = _this51.canSupport.get(Feature.RelationsRecursion) !== ServerSupport.Unsupported;
4669
+ var recurse = _this50.canSupport.get(Feature.RelationsRecursion) !== ServerSupport.Unsupported;
4780
4670
  if (Thread.hasServerSideSupport) {
4781
4671
  if (Thread.hasServerSideFwdPaginationSupport) {
4782
4672
  var _resOlder$next_batch, _resNewer$next_batch, _timelineSet$getTimel2;
@@ -4784,12 +4674,12 @@ export class MatrixClient extends TypedEventEmitter {
4784
4674
  throw new Error("could not get thread timeline: not a thread timeline");
4785
4675
  }
4786
4676
  var thread = timelineSet.thread;
4787
- var resOlder = yield _this51.fetchRelations(timelineSet.room.roomId, thread.id, null, null, {
4677
+ var resOlder = yield _this50.fetchRelations(timelineSet.room.roomId, thread.id, null, null, {
4788
4678
  dir: Direction.Backward,
4789
4679
  from: res.start,
4790
4680
  recurse: recurse || undefined
4791
4681
  });
4792
- var resNewer = yield _this51.fetchRelations(timelineSet.room.roomId, thread.id, null, null, {
4682
+ var resNewer = yield _this50.fetchRelations(timelineSet.room.roomId, thread.id, null, null, {
4793
4683
  dir: Direction.Forward,
4794
4684
  from: res.end,
4795
4685
  recurse: recurse || undefined
@@ -4814,12 +4704,12 @@ export class MatrixClient extends TypedEventEmitter {
4814
4704
  }
4815
4705
  timelineSet.addEventsToTimeline(events, true, timeline, resNewer.next_batch);
4816
4706
  if (!resOlder.next_batch) {
4817
- var originalEvent = yield _this51.fetchRoomEvent(timelineSet.room.roomId, thread.id);
4707
+ var originalEvent = yield _this50.fetchRoomEvent(timelineSet.room.roomId, thread.id);
4818
4708
  timelineSet.addEventsToTimeline([mapper(originalEvent)], true, timeline, null);
4819
4709
  }
4820
4710
  timeline.setPaginationToken((_resOlder$next_batch = resOlder.next_batch) !== null && _resOlder$next_batch !== void 0 ? _resOlder$next_batch : null, Direction.Backward);
4821
4711
  timeline.setPaginationToken((_resNewer$next_batch = resNewer.next_batch) !== null && _resNewer$next_batch !== void 0 ? _resNewer$next_batch : null, Direction.Forward);
4822
- _this51.processAggregatedTimelineEvents(timelineSet.room, events);
4712
+ _this50.processAggregatedTimelineEvents(timelineSet.room, events);
4823
4713
 
4824
4714
  // There is no guarantee that the event ended up in "timeline" (we might have switched to a neighbouring
4825
4715
  // timeline) - so check the room's index again. On the other hand, there's no guarantee the event ended up
@@ -4832,7 +4722,7 @@ export class MatrixClient extends TypedEventEmitter {
4832
4722
  // XXX: workaround for https://github.com/vector-im/element-meta/issues/150
4833
4723
 
4834
4724
  var _thread = timelineSet.thread;
4835
- var _resOlder = yield _this51.fetchRelations(timelineSet.room.roomId, _thread.id, THREAD_RELATION_TYPE.name, null, {
4725
+ var _resOlder = yield _this50.fetchRelations(timelineSet.room.roomId, _thread.id, THREAD_RELATION_TYPE.name, null, {
4836
4726
  dir: Direction.Backward,
4837
4727
  from: res.start,
4838
4728
  recurse: recurse || undefined
@@ -4841,7 +4731,7 @@ export class MatrixClient extends TypedEventEmitter {
4841
4731
  var nextBatch = res.end;
4842
4732
  while (nextBatch) {
4843
4733
  var _resNewer$next_batch2;
4844
- var _resNewer = yield _this51.fetchRelations(timelineSet.room.roomId, _thread.id, THREAD_RELATION_TYPE.name, null, {
4734
+ var _resNewer = yield _this50.fetchRelations(timelineSet.room.roomId, _thread.id, THREAD_RELATION_TYPE.name, null, {
4845
4735
  dir: Direction.Forward,
4846
4736
  from: nextBatch,
4847
4737
  recurse: recurse || undefined
@@ -4865,12 +4755,12 @@ export class MatrixClient extends TypedEventEmitter {
4865
4755
  _timeline.getState(EventTimeline.BACKWARDS).setUnknownStateEvents(res.state.map(mapper));
4866
4756
  timelineSet.addEventsToTimeline(_events, true, _timeline, null);
4867
4757
  if (!_resOlder.next_batch) {
4868
- var _originalEvent = yield _this51.fetchRoomEvent(timelineSet.room.roomId, _thread.id);
4758
+ var _originalEvent = yield _this50.fetchRoomEvent(timelineSet.room.roomId, _thread.id);
4869
4759
  timelineSet.addEventsToTimeline([mapper(_originalEvent)], true, _timeline, null);
4870
4760
  }
4871
4761
  _timeline.setPaginationToken((_resOlder$next_batch2 = _resOlder.next_batch) !== null && _resOlder$next_batch2 !== void 0 ? _resOlder$next_batch2 : null, Direction.Backward);
4872
4762
  _timeline.setPaginationToken(null, Direction.Forward);
4873
- _this51.processAggregatedTimelineEvents(timelineSet.room, _events);
4763
+ _this50.processAggregatedTimelineEvents(timelineSet.room, _events);
4874
4764
  return _timeline;
4875
4765
  }
4876
4766
  }
@@ -4888,10 +4778,10 @@ export class MatrixClient extends TypedEventEmitter {
4888
4778
  * {@link EventTimeline} timeline with the latest events in the room
4889
4779
  */
4890
4780
  getLatestTimeline(timelineSet) {
4891
- var _this52 = this;
4781
+ var _this51 = this;
4892
4782
  return _asyncToGenerator(function* () {
4893
4783
  // don't allow any timeline support unless it's been enabled.
4894
- if (!_this52.timelineSupport) {
4784
+ if (!_this51.timelineSupport) {
4895
4785
  throw new Error("timeline support is disabled. Set the 'timelineSupport'" + " parameter to true when creating MatrixClient to enable it.");
4896
4786
  }
4897
4787
  if (!timelineSet.room) {
@@ -4900,35 +4790,35 @@ export class MatrixClient extends TypedEventEmitter {
4900
4790
  var event;
4901
4791
  if (timelineSet.threadListType !== null) {
4902
4792
  var _res$chunk;
4903
- var res = yield _this52.createThreadListMessagesRequest(timelineSet.room.roomId, null, 1, Direction.Backward, timelineSet.threadListType, timelineSet.getFilter());
4793
+ var res = yield _this51.createThreadListMessagesRequest(timelineSet.room.roomId, null, 1, Direction.Backward, timelineSet.threadListType, timelineSet.getFilter());
4904
4794
  event = (_res$chunk = res.chunk) === null || _res$chunk === void 0 ? void 0 : _res$chunk[0];
4905
4795
  } else if (timelineSet.thread && Thread.hasServerSideSupport) {
4906
4796
  var _res$chunk2;
4907
- var recurse = _this52.canSupport.get(Feature.RelationsRecursion) !== ServerSupport.Unsupported;
4908
- var _res = yield _this52.fetchRelations(timelineSet.room.roomId, timelineSet.thread.id, THREAD_RELATION_TYPE.name, null, {
4797
+ var recurse = _this51.canSupport.get(Feature.RelationsRecursion) !== ServerSupport.Unsupported;
4798
+ var _res = yield _this51.fetchRelations(timelineSet.room.roomId, timelineSet.thread.id, THREAD_RELATION_TYPE.name, null, {
4909
4799
  dir: Direction.Backward,
4910
4800
  limit: 1,
4911
4801
  recurse: recurse || undefined
4912
4802
  });
4913
4803
  event = (_res$chunk2 = _res.chunk) === null || _res$chunk2 === void 0 ? void 0 : _res$chunk2[0];
4914
4804
  } else {
4915
- var _this52$clientOpts, _res2$chunk;
4805
+ var _this51$clientOpts, _res2$chunk;
4916
4806
  var messagesPath = utils.encodeUri("/rooms/$roomId/messages", {
4917
4807
  $roomId: timelineSet.room.roomId
4918
4808
  });
4919
4809
  var params = {
4920
4810
  dir: "b"
4921
4811
  };
4922
- if ((_this52$clientOpts = _this52.clientOpts) !== null && _this52$clientOpts !== void 0 && _this52$clientOpts.lazyLoadMembers) {
4812
+ if ((_this51$clientOpts = _this51.clientOpts) !== null && _this51$clientOpts !== void 0 && _this51$clientOpts.lazyLoadMembers) {
4923
4813
  params.filter = JSON.stringify(Filter.LAZY_LOADING_MESSAGES_FILTER);
4924
4814
  }
4925
- var _res2 = yield _this52.http.authedRequest(Method.Get, messagesPath, params);
4815
+ var _res2 = yield _this51.http.authedRequest(Method.Get, messagesPath, params);
4926
4816
  event = (_res2$chunk = _res2.chunk) === null || _res2$chunk === void 0 ? void 0 : _res2$chunk[0];
4927
4817
  }
4928
4818
  if (!event) {
4929
4819
  throw new Error("No message returned when trying to construct getLatestTimeline");
4930
4820
  }
4931
- return _this52.getEventTimeline(timelineSet, event.event_id);
4821
+ return _this51.getEventTimeline(timelineSet, event.event_id);
4932
4822
  })();
4933
4823
  }
4934
4824
 
@@ -5040,7 +4930,7 @@ export class MatrixClient extends TypedEventEmitter {
5040
4930
  * events and we reached either end of the timeline; else true.
5041
4931
  */
5042
4932
  paginateEventTimeline(eventTimeline, opts) {
5043
- var _this53 = this;
4933
+ var _this52 = this;
5044
4934
  var isNotifTimeline = eventTimeline.getTimelineSet() === this.notifTimelineSet;
5045
4935
  var room = this.getRoom(eventTimeline.getRoomId());
5046
4936
  var threadListType = eventTimeline.getTimelineSet().threadListType;
@@ -5082,11 +4972,11 @@ export class MatrixClient extends TypedEventEmitter {
5082
4972
  res.notifications = res.notifications.filter(noUnsafeEventProps);
5083
4973
  for (var i = 0; i < res.notifications.length; i++) {
5084
4974
  var notification = res.notifications[i];
5085
- var _event4 = _this53.getEventMapper()(notification.event);
4975
+ var _event4 = _this52.getEventMapper()(notification.event);
5086
4976
 
5087
4977
  // @TODO(kerrya) reprocessing every notification is ugly
5088
4978
  // remove if we get server MSC3994 support
5089
- _this53.getPushDetailsForEvent(_event4, true);
4979
+ _this52.getPushDetailsForEvent(_event4, true);
5090
4980
  _event4.event.room_id = notification.room_id; // XXX: gutwrenching
5091
4981
  matrixEvents[i] = _event4;
5092
4982
  }
@@ -5095,7 +4985,7 @@ export class MatrixClient extends TypedEventEmitter {
5095
4985
  // in the notification timeline set
5096
4986
  var timelineSet = eventTimeline.getTimelineSet();
5097
4987
  timelineSet.addEventsToTimeline(matrixEvents, backwards, eventTimeline, token);
5098
- _this53.processAggregatedTimelineEvents(timelineSet.room, matrixEvents);
4988
+ _this52.processAggregatedTimelineEvents(timelineSet.room, matrixEvents);
5099
4989
 
5100
4990
  // if we've hit the end of the timeline, we need to stop trying to
5101
4991
  // paginate. We need to keep the 'forwards' token though, to make sure
@@ -5157,7 +5047,7 @@ export class MatrixClient extends TypedEventEmitter {
5157
5047
  recurse: recurse || undefined
5158
5048
  }).then(/*#__PURE__*/function () {
5159
5049
  var _ref7 = _asyncToGenerator(function* (res) {
5160
- var mapper = _this53.getEventMapper();
5050
+ var mapper = _this52.getEventMapper();
5161
5051
  var matrixEvents = res.chunk.filter(noUnsafeEventProps).filter(getRelationsThreadFilter(thread.id)).map(mapper);
5162
5052
 
5163
5053
  // Process latest events first
@@ -5173,10 +5063,10 @@ export class MatrixClient extends TypedEventEmitter {
5173
5063
  timelineSet.addEventsToTimeline(matrixEvents, backwards, eventTimeline, newToken !== null && newToken !== void 0 ? newToken : null);
5174
5064
  if (!newToken && backwards) {
5175
5065
  var _thread$rootEvent, _eventTimeline$getRoo3;
5176
- var originalEvent = (_thread$rootEvent = thread.rootEvent) !== null && _thread$rootEvent !== void 0 ? _thread$rootEvent : mapper(yield _this53.fetchRoomEvent((_eventTimeline$getRoo3 = eventTimeline.getRoomId()) !== null && _eventTimeline$getRoo3 !== void 0 ? _eventTimeline$getRoo3 : "", thread.id));
5066
+ var originalEvent = (_thread$rootEvent = thread.rootEvent) !== null && _thread$rootEvent !== void 0 ? _thread$rootEvent : mapper(yield _this52.fetchRoomEvent((_eventTimeline$getRoo3 = eventTimeline.getRoomId()) !== null && _eventTimeline$getRoo3 !== void 0 ? _eventTimeline$getRoo3 : "", thread.id));
5177
5067
  timelineSet.addEventsToTimeline([originalEvent], true, eventTimeline, null);
5178
5068
  }
5179
- _this53.processAggregatedTimelineEvents(timelineSet.room, matrixEvents);
5069
+ _this52.processAggregatedTimelineEvents(timelineSet.room, matrixEvents);
5180
5070
 
5181
5071
  // if we've hit the end of the timeline, we need to stop trying to
5182
5072
  // paginate. We need to keep the 'forwards' token though, to make sure
@@ -5462,10 +5352,10 @@ export class MatrixClient extends TypedEventEmitter {
5462
5352
  * @returns Promise which resolves: As requestEmailToken
5463
5353
  */
5464
5354
  requestTokenFromEndpoint(endpoint, params) {
5465
- var _this54 = this;
5355
+ var _this53 = this;
5466
5356
  return _asyncToGenerator(function* () {
5467
5357
  var postParams = Object.assign({}, params);
5468
- return _this54.http.request(Method.Post, endpoint, undefined, postParams);
5358
+ return _this53.http.request(Method.Post, endpoint, undefined, postParams);
5469
5359
  })();
5470
5360
  }
5471
5361
 
@@ -5760,14 +5650,14 @@ export class MatrixClient extends TypedEventEmitter {
5760
5650
  * @returns Filter ID
5761
5651
  */
5762
5652
  getOrCreateFilter(filterName, filter) {
5763
- var _this55 = this;
5653
+ var _this54 = this;
5764
5654
  return _asyncToGenerator(function* () {
5765
- var filterId = _this55.store.getFilterIdByName(filterName);
5655
+ var filterId = _this54.store.getFilterIdByName(filterName);
5766
5656
  var existingId;
5767
5657
  if (filterId) {
5768
5658
  // check that the existing filter matches our expectations
5769
5659
  try {
5770
- var existingFilter = yield _this55.getFilter(_this55.credentials.userId, filterId, true);
5660
+ var existingFilter = yield _this54.getFilter(_this54.credentials.userId, filterId, true);
5771
5661
  if (existingFilter) {
5772
5662
  var oldDef = existingFilter.getDefinition();
5773
5663
  var newDef = filter.getDefinition();
@@ -5791,7 +5681,7 @@ export class MatrixClient extends TypedEventEmitter {
5791
5681
  }
5792
5682
  // if the filter doesn't exist anymore on the server, remove from store
5793
5683
  if (!existingId) {
5794
- _this55.store.setFilterIdByName(filterName, undefined);
5684
+ _this54.store.setFilterIdByName(filterName, undefined);
5795
5685
  }
5796
5686
  }
5797
5687
  if (existingId) {
@@ -5799,8 +5689,8 @@ export class MatrixClient extends TypedEventEmitter {
5799
5689
  }
5800
5690
 
5801
5691
  // create a new filter
5802
- var createdFilter = yield _this55.createFilter(filter.getDefinition());
5803
- _this55.store.setFilterIdByName(filterName, createdFilter.filterId);
5692
+ var createdFilter = yield _this54.createFilter(filter.getDefinition());
5693
+ _this54.store.setFilterIdByName(filterName, createdFilter.filterId);
5804
5694
  return createdFilter.filterId;
5805
5695
  })();
5806
5696
  }
@@ -5848,47 +5738,47 @@ export class MatrixClient extends TypedEventEmitter {
5848
5738
 
5849
5739
  // XXX: Intended private, used in code.
5850
5740
  checkTurnServers() {
5851
- var _this56 = this;
5741
+ var _this55 = this;
5852
5742
  return _asyncToGenerator(function* () {
5853
- if (!_this56.canSupportVoip) {
5743
+ if (!_this55.canSupportVoip) {
5854
5744
  return;
5855
5745
  }
5856
5746
  var credentialsGood = false;
5857
- var remainingTime = _this56.turnServersExpiry - Date.now();
5747
+ var remainingTime = _this55.turnServersExpiry - Date.now();
5858
5748
  if (remainingTime > TURN_CHECK_INTERVAL) {
5859
- _this56.logger.debug("TURN creds are valid for another " + remainingTime + " ms: not fetching new ones.");
5749
+ _this55.logger.debug("TURN creds are valid for another " + remainingTime + " ms: not fetching new ones.");
5860
5750
  credentialsGood = true;
5861
5751
  } else {
5862
- _this56.logger.debug("Fetching new TURN credentials");
5752
+ _this55.logger.debug("Fetching new TURN credentials");
5863
5753
  try {
5864
- var res = yield _this56.turnServer();
5754
+ var res = yield _this55.turnServer();
5865
5755
  if (res.uris) {
5866
- _this56.logger.debug("Got TURN URIs: " + res.uris + " refresh in " + res.ttl + " secs");
5756
+ _this55.logger.debug("Got TURN URIs: " + res.uris + " refresh in " + res.ttl + " secs");
5867
5757
  // map the response to a format that can be fed to RTCPeerConnection
5868
5758
  var servers = {
5869
5759
  urls: res.uris,
5870
5760
  username: res.username,
5871
5761
  credential: res.password
5872
5762
  };
5873
- _this56.turnServers = [servers];
5763
+ _this55.turnServers = [servers];
5874
5764
  // The TTL is in seconds but we work in ms
5875
- _this56.turnServersExpiry = Date.now() + res.ttl * 1000;
5765
+ _this55.turnServersExpiry = Date.now() + res.ttl * 1000;
5876
5766
  credentialsGood = true;
5877
- _this56.emit(ClientEvent.TurnServers, _this56.turnServers);
5767
+ _this55.emit(ClientEvent.TurnServers, _this55.turnServers);
5878
5768
  }
5879
5769
  } catch (err) {
5880
- _this56.logger.error("Failed to get TURN URIs", err);
5770
+ _this55.logger.error("Failed to get TURN URIs", err);
5881
5771
  if (err.httpStatus === 403) {
5882
5772
  // We got a 403, so there's no point in looping forever.
5883
- _this56.logger.info("TURN access unavailable for this account: stopping credentials checks");
5884
- if (_this56.checkTurnServersIntervalID !== null) {
5885
- globalThis.clearInterval(_this56.checkTurnServersIntervalID);
5773
+ _this55.logger.info("TURN access unavailable for this account: stopping credentials checks");
5774
+ if (_this55.checkTurnServersIntervalID !== null) {
5775
+ globalThis.clearInterval(_this55.checkTurnServersIntervalID);
5886
5776
  }
5887
- _this56.checkTurnServersIntervalID = undefined;
5888
- _this56.emit(ClientEvent.TurnServersError, err, true); // fatal
5777
+ _this55.checkTurnServersIntervalID = undefined;
5778
+ _this55.emit(ClientEvent.TurnServersError, err, true); // fatal
5889
5779
  } else {
5890
5780
  // otherwise, if we failed for whatever reason, try again the next time we're called.
5891
- _this56.emit(ClientEvent.TurnServersError, err, false); // non-fatal
5781
+ _this55.emit(ClientEvent.TurnServersError, err, false); // non-fatal
5892
5782
  }
5893
5783
  }
5894
5784
  }
@@ -5964,14 +5854,14 @@ export class MatrixClient extends TypedEventEmitter {
5964
5854
  });
5965
5855
  }
5966
5856
  fetchClientWellKnown() {
5967
- var _this57 = this;
5857
+ var _this56 = this;
5968
5858
  return _asyncToGenerator(function* () {
5969
- var _this57$getDomain;
5859
+ var _this56$getDomain;
5970
5860
  // `getRawClientConfig` does not throw or reject on network errors, instead
5971
5861
  // it absorbs errors and returns `{}`.
5972
- _this57.clientWellKnownPromise = AutoDiscovery.getRawClientConfig((_this57$getDomain = _this57.getDomain()) !== null && _this57$getDomain !== void 0 ? _this57$getDomain : undefined);
5973
- _this57.clientWellKnown = yield _this57.clientWellKnownPromise;
5974
- _this57.emit(ClientEvent.ClientWellKnown, _this57.clientWellKnown);
5862
+ _this56.clientWellKnownPromise = AutoDiscovery.getRawClientConfig((_this56$getDomain = _this56.getDomain()) !== null && _this56$getDomain !== void 0 ? _this56$getDomain : undefined);
5863
+ _this56.clientWellKnown = yield _this56.clientWellKnownPromise;
5864
+ _this56.emit(ClientEvent.ClientWellKnown, _this56.clientWellKnown);
5975
5865
  })();
5976
5866
  }
5977
5867
  getClientWellKnown() {
@@ -6017,16 +5907,16 @@ export class MatrixClient extends TypedEventEmitter {
6017
5907
  // TODO: on spec release, rename this to getMutualRooms
6018
5908
  // eslint-disable-next-line
6019
5909
  _unstable_getSharedRooms(userId) {
6020
- var _this58 = this;
5910
+ var _this57 = this;
6021
5911
  return _asyncToGenerator(function* () {
6022
5912
  // Initial variant of the MSC
6023
- var sharedRoomsSupport = yield _this58.doesServerSupportUnstableFeature(UNSTABLE_MSC2666_SHARED_ROOMS);
5913
+ var sharedRoomsSupport = yield _this57.doesServerSupportUnstableFeature(UNSTABLE_MSC2666_SHARED_ROOMS);
6024
5914
 
6025
5915
  // Newer variant that renamed shared rooms to mutual rooms
6026
- var mutualRoomsSupport = yield _this58.doesServerSupportUnstableFeature(UNSTABLE_MSC2666_MUTUAL_ROOMS);
5916
+ var mutualRoomsSupport = yield _this57.doesServerSupportUnstableFeature(UNSTABLE_MSC2666_MUTUAL_ROOMS);
6027
5917
 
6028
5918
  // Latest variant that changed from path elements to query elements
6029
- var queryMutualRoomsSupport = yield _this58.doesServerSupportUnstableFeature(UNSTABLE_MSC2666_QUERY_MUTUAL_ROOMS);
5919
+ var queryMutualRoomsSupport = yield _this57.doesServerSupportUnstableFeature(UNSTABLE_MSC2666_QUERY_MUTUAL_ROOMS);
6030
5920
  if (!sharedRoomsSupport && !mutualRoomsSupport && !queryMutualRoomsSupport) {
6031
5921
  throw Error("Server does not support the Mutual Rooms API");
6032
5922
  }
@@ -6054,7 +5944,7 @@ export class MatrixClient extends TypedEventEmitter {
6054
5944
  if (token != null && queryMutualRoomsSupport) {
6055
5945
  tokenQuery["batch_token"] = token;
6056
5946
  }
6057
- var res = yield _this58.http.authedRequest(Method.Get, path, _objectSpread(_objectSpread({}, query), tokenQuery), undefined, {
5947
+ var res = yield _this57.http.authedRequest(Method.Get, path, _objectSpread(_objectSpread({}, query), tokenQuery), undefined, {
6058
5948
  prefix: ClientPrefix.Unstable
6059
5949
  });
6060
5950
  rooms.push(...res.joined);
@@ -6074,24 +5964,24 @@ export class MatrixClient extends TypedEventEmitter {
6074
5964
  * @returns The server /versions response
6075
5965
  */
6076
5966
  getVersions() {
6077
- var _this59 = this;
5967
+ var _this58 = this;
6078
5968
  return _asyncToGenerator(function* () {
6079
- if (_this59.serverVersionsPromise) {
6080
- return _this59.serverVersionsPromise;
5969
+ if (_this58.serverVersionsPromise) {
5970
+ return _this58.serverVersionsPromise;
6081
5971
  }
6082
5972
 
6083
5973
  // We send an authenticated request as of MSC4026
6084
- _this59.serverVersionsPromise = _this59.http.authedRequest(Method.Get, "/_matrix/client/versions", undefined, undefined, {
5974
+ _this58.serverVersionsPromise = _this58.http.authedRequest(Method.Get, "/_matrix/client/versions", undefined, undefined, {
6085
5975
  prefix: ""
6086
5976
  }).catch(e => {
6087
5977
  // Need to unset this if it fails, otherwise we'll never retry
6088
- _this59.serverVersionsPromise = undefined;
5978
+ _this58.serverVersionsPromise = undefined;
6089
5979
  // but rethrow the exception to anything that was waiting
6090
5980
  throw e;
6091
5981
  });
6092
- var serverVersions = yield _this59.serverVersionsPromise;
6093
- _this59.canSupport = yield buildFeatureSupportMap(serverVersions);
6094
- return _this59.serverVersionsPromise;
5982
+ var serverVersions = yield _this58.serverVersionsPromise;
5983
+ _this58.canSupport = yield buildFeatureSupportMap(serverVersions);
5984
+ return _this58.serverVersionsPromise;
6095
5985
  })();
6096
5986
  }
6097
5987
 
@@ -6101,11 +5991,11 @@ export class MatrixClient extends TypedEventEmitter {
6101
5991
  * @returns Whether it is supported
6102
5992
  */
6103
5993
  isVersionSupported(version) {
6104
- var _this60 = this;
5994
+ var _this59 = this;
6105
5995
  return _asyncToGenerator(function* () {
6106
5996
  var {
6107
5997
  versions
6108
- } = yield _this60.getVersions();
5998
+ } = yield _this59.getVersions();
6109
5999
  return versions && versions.includes(version);
6110
6000
  })();
6111
6001
  }
@@ -6117,9 +6007,9 @@ export class MatrixClient extends TypedEventEmitter {
6117
6007
  * @returns true if the feature is supported
6118
6008
  */
6119
6009
  doesServerSupportUnstableFeature(feature) {
6120
- var _this61 = this;
6010
+ var _this60 = this;
6121
6011
  return _asyncToGenerator(function* () {
6122
- var response = yield _this61.getVersions();
6012
+ var response = yield _this60.getVersions();
6123
6013
  if (!response) return false;
6124
6014
  var unstableFeatures = response["unstable_features"];
6125
6015
  return unstableFeatures && !!unstableFeatures[feature];
@@ -6134,9 +6024,9 @@ export class MatrixClient extends TypedEventEmitter {
6134
6024
  * for the preset.
6135
6025
  */
6136
6026
  doesServerForceEncryptionForPreset(presetName) {
6137
- var _this62 = this;
6027
+ var _this61 = this;
6138
6028
  return _asyncToGenerator(function* () {
6139
- var response = yield _this62.getVersions();
6029
+ var response = yield _this61.getVersions();
6140
6030
  if (!response) return false;
6141
6031
  var unstableFeatures = response["unstable_features"];
6142
6032
 
@@ -6146,9 +6036,9 @@ export class MatrixClient extends TypedEventEmitter {
6146
6036
  })();
6147
6037
  }
6148
6038
  doesServerSupportThread() {
6149
- var _this63 = this;
6039
+ var _this62 = this;
6150
6040
  return _asyncToGenerator(function* () {
6151
- if (yield _this63.isVersionSupported("v1.4")) {
6041
+ if (yield _this62.isVersionSupported("v1.4")) {
6152
6042
  return {
6153
6043
  threads: FeatureSupport.Stable,
6154
6044
  list: FeatureSupport.Stable,
@@ -6156,7 +6046,7 @@ export class MatrixClient extends TypedEventEmitter {
6156
6046
  };
6157
6047
  }
6158
6048
  try {
6159
- var [threadUnstable, threadStable, listUnstable, listStable, fwdPaginationUnstable, fwdPaginationStable] = yield Promise.all([_this63.doesServerSupportUnstableFeature("org.matrix.msc3440"), _this63.doesServerSupportUnstableFeature("org.matrix.msc3440.stable"), _this63.doesServerSupportUnstableFeature("org.matrix.msc3856"), _this63.doesServerSupportUnstableFeature("org.matrix.msc3856.stable"), _this63.doesServerSupportUnstableFeature("org.matrix.msc3715"), _this63.doesServerSupportUnstableFeature("org.matrix.msc3715.stable")]);
6049
+ var [threadUnstable, threadStable, listUnstable, listStable, fwdPaginationUnstable, fwdPaginationStable] = yield Promise.all([_this62.doesServerSupportUnstableFeature("org.matrix.msc3440"), _this62.doesServerSupportUnstableFeature("org.matrix.msc3440.stable"), _this62.doesServerSupportUnstableFeature("org.matrix.msc3856"), _this62.doesServerSupportUnstableFeature("org.matrix.msc3856.stable"), _this62.doesServerSupportUnstableFeature("org.matrix.msc3715"), _this62.doesServerSupportUnstableFeature("org.matrix.msc3715.stable")]);
6160
6050
  return {
6161
6051
  threads: determineFeatureSupport(threadStable, threadUnstable),
6162
6052
  list: determineFeatureSupport(listStable, listUnstable),
@@ -6215,20 +6105,20 @@ export class MatrixClient extends TypedEventEmitter {
6215
6105
  */
6216
6106
  relations(roomId, eventId, relationType, eventType) {
6217
6107
  var _arguments8 = arguments,
6218
- _this64 = this;
6108
+ _this63 = this;
6219
6109
  return _asyncToGenerator(function* () {
6220
6110
  var _result$next_batch, _result$prev_batch;
6221
6111
  var opts = _arguments8.length > 4 && _arguments8[4] !== undefined ? _arguments8[4] : {
6222
6112
  dir: Direction.Backward
6223
6113
  };
6224
- var fetchedEventType = eventType ? _this64.getEncryptedIfNeededEventType(roomId, eventType) : null;
6225
- var [eventResult, result] = yield Promise.all([_this64.fetchRoomEvent(roomId, eventId), _this64.fetchRelations(roomId, eventId, relationType, fetchedEventType, opts)]);
6226
- var mapper = _this64.getEventMapper();
6114
+ var fetchedEventType = eventType ? _this63.getEncryptedIfNeededEventType(roomId, eventType) : null;
6115
+ var [eventResult, result] = yield Promise.all([_this63.fetchRoomEvent(roomId, eventId), _this63.fetchRelations(roomId, eventId, relationType, fetchedEventType, opts)]);
6116
+ var mapper = _this63.getEventMapper();
6227
6117
  var originalEvent = eventResult ? mapper(eventResult) : undefined;
6228
6118
  var events = result.chunk.map(mapper);
6229
6119
  if (fetchedEventType === EventType.RoomMessageEncrypted) {
6230
6120
  var allEvents = originalEvent ? events.concat(originalEvent) : events;
6231
- yield Promise.all(allEvents.map(e => _this64.decryptEventIfNeeded(e)));
6121
+ yield Promise.all(allEvents.map(e => _this63.decryptEventIfNeeded(e)));
6232
6122
  if (eventType !== null) {
6233
6123
  events = events.filter(e => e.getType() === eventType);
6234
6124
  }
@@ -6579,22 +6469,22 @@ export class MatrixClient extends TypedEventEmitter {
6579
6469
  */
6580
6470
  logout() {
6581
6471
  var _arguments9 = arguments,
6582
- _this65 = this;
6472
+ _this64 = this;
6583
6473
  return _asyncToGenerator(function* () {
6584
- var _this65$crypto;
6474
+ var _this64$crypto;
6585
6475
  var stopClient = _arguments9.length > 0 && _arguments9[0] !== undefined ? _arguments9[0] : false;
6586
- if ((_this65$crypto = _this65.crypto) !== null && _this65$crypto !== void 0 && (_this65$crypto = _this65$crypto.backupManager) !== null && _this65$crypto !== void 0 && _this65$crypto.getKeyBackupEnabled()) {
6476
+ if ((_this64$crypto = _this64.crypto) !== null && _this64$crypto !== void 0 && (_this64$crypto = _this64$crypto.backupManager) !== null && _this64$crypto !== void 0 && _this64$crypto.getKeyBackupEnabled()) {
6587
6477
  try {
6588
- while ((yield _this65.crypto.backupManager.backupPendingKeys(200)) > 0);
6478
+ while ((yield _this64.crypto.backupManager.backupPendingKeys(200)) > 0);
6589
6479
  } catch (err) {
6590
- _this65.logger.error("Key backup request failed when logging out. Some keys may be missing from backup", err);
6480
+ _this64.logger.error("Key backup request failed when logging out. Some keys may be missing from backup", err);
6591
6481
  }
6592
6482
  }
6593
6483
  if (stopClient) {
6594
- _this65.stopClient();
6595
- _this65.http.abort();
6484
+ _this64.stopClient();
6485
+ _this64.http.abort();
6596
6486
  }
6597
- return _this65.http.authedRequest(Method.Post, "/logout");
6487
+ return _this64.http.authedRequest(Method.Post, "/logout");
6598
6488
  })();
6599
6489
  }
6600
6490
 
@@ -6632,12 +6522,12 @@ export class MatrixClient extends TypedEventEmitter {
6632
6522
  * or UIA auth data.
6633
6523
  */
6634
6524
  requestLoginToken(auth) {
6635
- var _this66 = this;
6525
+ var _this65 = this;
6636
6526
  return _asyncToGenerator(function* () {
6637
6527
  var body = {
6638
6528
  auth
6639
6529
  };
6640
- return _this66.http.authedRequest(Method.Post, "/login/get_token", undefined,
6530
+ return _this65.http.authedRequest(Method.Post, "/login/get_token", undefined,
6641
6531
  // no query params
6642
6532
  body, {
6643
6533
  prefix: ClientPrefix.V1
@@ -6669,23 +6559,23 @@ export class MatrixClient extends TypedEventEmitter {
6669
6559
  * @returns Rejects: with an error response.
6670
6560
  */
6671
6561
  createRoom(options) {
6672
- var _this67 = this;
6562
+ var _this66 = this;
6673
6563
  return _asyncToGenerator(function* () {
6674
- var _this67$identityServe;
6564
+ var _this66$identityServe;
6675
6565
  // eslint-disable-line camelcase
6676
6566
  // some valid options include: room_alias_name, visibility, invite
6677
6567
 
6678
6568
  // inject the id_access_token if inviting 3rd party addresses
6679
6569
  var invitesNeedingToken = (options.invite_3pid || []).filter(i => !i.id_access_token);
6680
- if (invitesNeedingToken.length > 0 && (_this67$identityServe = _this67.identityServer) !== null && _this67$identityServe !== void 0 && _this67$identityServe.getAccessToken) {
6681
- var identityAccessToken = yield _this67.identityServer.getAccessToken();
6570
+ if (invitesNeedingToken.length > 0 && (_this66$identityServe = _this66.identityServer) !== null && _this66$identityServe !== void 0 && _this66$identityServe.getAccessToken) {
6571
+ var identityAccessToken = yield _this66.identityServer.getAccessToken();
6682
6572
  if (identityAccessToken) {
6683
6573
  for (var invite of invitesNeedingToken) {
6684
6574
  invite.id_access_token = identityAccessToken;
6685
6575
  }
6686
6576
  }
6687
6577
  }
6688
- return _this67.http.authedRequest(Method.Post, "/createRoom", undefined, options);
6578
+ return _this66.http.authedRequest(Method.Post, "/createRoom", undefined, options);
6689
6579
  })();
6690
6580
  }
6691
6581
 
@@ -6869,7 +6759,7 @@ export class MatrixClient extends TypedEventEmitter {
6869
6759
  * @returns Promise which resolves: the empty object, `{}`.
6870
6760
  */
6871
6761
  setRoomReadMarkersHttpRequest(roomId, rmEventId, rrEventId, rpEventId) {
6872
- var _this68 = this;
6762
+ var _this67 = this;
6873
6763
  return _asyncToGenerator(function* () {
6874
6764
  var path = utils.encodeUri("/rooms/$roomId/read_markers", {
6875
6765
  $roomId: roomId
@@ -6878,10 +6768,10 @@ export class MatrixClient extends TypedEventEmitter {
6878
6768
  [ReceiptType.FullyRead]: rmEventId,
6879
6769
  [ReceiptType.Read]: rrEventId
6880
6770
  };
6881
- if ((yield _this68.doesServerSupportUnstableFeature("org.matrix.msc2285.stable")) || (yield _this68.isVersionSupported("v1.4"))) {
6771
+ if ((yield _this67.doesServerSupportUnstableFeature("org.matrix.msc2285.stable")) || (yield _this67.isVersionSupported("v1.4"))) {
6882
6772
  content[ReceiptType.ReadPrivate] = rpEventId;
6883
6773
  }
6884
- return _this68.http.authedRequest(Method.Post, path, undefined, content);
6774
+ return _this67.http.authedRequest(Method.Post, path, undefined, content);
6885
6775
  })();
6886
6776
  }
6887
6777
 
@@ -7114,9 +7004,9 @@ export class MatrixClient extends TypedEventEmitter {
7114
7004
  * @returns `true` if supported, otherwise `false`
7115
7005
  */
7116
7006
  doesServerSupportExtendedProfiles() {
7117
- var _this69 = this;
7007
+ var _this68 = this;
7118
7008
  return _asyncToGenerator(function* () {
7119
- return _this69.doesServerSupportUnstableFeature(UNSTABLE_MSC4133_EXTENDED_PROFILES);
7009
+ return _this68.doesServerSupportUnstableFeature(UNSTABLE_MSC4133_EXTENDED_PROFILES);
7120
7010
  })();
7121
7011
  }
7122
7012
 
@@ -7126,9 +7016,9 @@ export class MatrixClient extends TypedEventEmitter {
7126
7016
  * @returns The prefix for use with `authedRequest`
7127
7017
  */
7128
7018
  getExtendedProfileRequestPrefix() {
7129
- var _this70 = this;
7019
+ var _this69 = this;
7130
7020
  return _asyncToGenerator(function* () {
7131
- if (yield _this70.doesServerSupportUnstableFeature("uk.tcpip.msc4133.stable")) {
7021
+ if (yield _this69.doesServerSupportUnstableFeature("uk.tcpip.msc4133.stable")) {
7132
7022
  return ClientPrefix.V3;
7133
7023
  }
7134
7024
  return "/_matrix/client/unstable/uk.tcpip.msc4133";
@@ -7146,15 +7036,15 @@ export class MatrixClient extends TypedEventEmitter {
7146
7036
  * @throws A M_NOT_FOUND error if the profile could not be found.
7147
7037
  */
7148
7038
  getExtendedProfile(userId) {
7149
- var _this71 = this;
7039
+ var _this70 = this;
7150
7040
  return _asyncToGenerator(function* () {
7151
- if (!(yield _this71.doesServerSupportExtendedProfiles())) {
7041
+ if (!(yield _this70.doesServerSupportExtendedProfiles())) {
7152
7042
  throw new Error("Server does not support extended profiles");
7153
7043
  }
7154
- return _this71.http.authedRequest(Method.Get, utils.encodeUri("/profile/$userId", {
7044
+ return _this70.http.authedRequest(Method.Get, utils.encodeUri("/profile/$userId", {
7155
7045
  $userId: userId
7156
7046
  }), undefined, undefined, {
7157
- prefix: yield _this71.getExtendedProfileRequestPrefix()
7047
+ prefix: yield _this70.getExtendedProfileRequestPrefix()
7158
7048
  });
7159
7049
  })();
7160
7050
  }
@@ -7171,16 +7061,16 @@ export class MatrixClient extends TypedEventEmitter {
7171
7061
  * @throws A M_NOT_FOUND error if the key was not set OR the profile could not be found.
7172
7062
  */
7173
7063
  getExtendedProfileProperty(userId, key) {
7174
- var _this72 = this;
7064
+ var _this71 = this;
7175
7065
  return _asyncToGenerator(function* () {
7176
- if (!(yield _this72.doesServerSupportExtendedProfiles())) {
7066
+ if (!(yield _this71.doesServerSupportExtendedProfiles())) {
7177
7067
  throw new Error("Server does not support extended profiles");
7178
7068
  }
7179
- var profile = yield _this72.http.authedRequest(Method.Get, utils.encodeUri("/profile/$userId/$key", {
7069
+ var profile = yield _this71.http.authedRequest(Method.Get, utils.encodeUri("/profile/$userId/$key", {
7180
7070
  $userId: userId,
7181
7071
  $key: key
7182
7072
  }), undefined, undefined, {
7183
- prefix: yield _this72.getExtendedProfileRequestPrefix()
7073
+ prefix: yield _this71.getExtendedProfileRequestPrefix()
7184
7074
  });
7185
7075
  return profile[key];
7186
7076
  })();
@@ -7196,19 +7086,19 @@ export class MatrixClient extends TypedEventEmitter {
7196
7086
  * @throws An error if the server does not support MSC4133 OR the server disallows editing the user profile.
7197
7087
  */
7198
7088
  setExtendedProfileProperty(key, value) {
7199
- var _this73 = this;
7089
+ var _this72 = this;
7200
7090
  return _asyncToGenerator(function* () {
7201
- if (!(yield _this73.doesServerSupportExtendedProfiles())) {
7091
+ if (!(yield _this72.doesServerSupportExtendedProfiles())) {
7202
7092
  throw new Error("Server does not support extended profiles");
7203
7093
  }
7204
- var userId = _this73.getUserId();
7205
- yield _this73.http.authedRequest(Method.Put, utils.encodeUri("/profile/$userId/$key", {
7094
+ var userId = _this72.getUserId();
7095
+ yield _this72.http.authedRequest(Method.Put, utils.encodeUri("/profile/$userId/$key", {
7206
7096
  $userId: userId,
7207
7097
  $key: key
7208
7098
  }), undefined, {
7209
7099
  [key]: value
7210
7100
  }, {
7211
- prefix: yield _this73.getExtendedProfileRequestPrefix()
7101
+ prefix: yield _this72.getExtendedProfileRequestPrefix()
7212
7102
  });
7213
7103
  })();
7214
7104
  }
@@ -7222,17 +7112,17 @@ export class MatrixClient extends TypedEventEmitter {
7222
7112
  * @throws An error if the server does not support MSC4133 OR the server disallows editing the user profile.
7223
7113
  */
7224
7114
  deleteExtendedProfileProperty(key) {
7225
- var _this74 = this;
7115
+ var _this73 = this;
7226
7116
  return _asyncToGenerator(function* () {
7227
- if (!(yield _this74.doesServerSupportExtendedProfiles())) {
7117
+ if (!(yield _this73.doesServerSupportExtendedProfiles())) {
7228
7118
  throw new Error("Server does not support extended profiles");
7229
7119
  }
7230
- var userId = _this74.getUserId();
7231
- yield _this74.http.authedRequest(Method.Delete, utils.encodeUri("/profile/$userId/$key", {
7120
+ var userId = _this73.getUserId();
7121
+ yield _this73.http.authedRequest(Method.Delete, utils.encodeUri("/profile/$userId/$key", {
7232
7122
  $userId: userId,
7233
7123
  $key: key
7234
7124
  }), undefined, undefined, {
7235
- prefix: yield _this74.getExtendedProfileRequestPrefix()
7125
+ prefix: yield _this73.getExtendedProfileRequestPrefix()
7236
7126
  });
7237
7127
  })();
7238
7128
  }
@@ -7248,16 +7138,16 @@ export class MatrixClient extends TypedEventEmitter {
7248
7138
  * @throws An error if the server does not support MSC4133 OR the server disallows editing the user profile.
7249
7139
  */
7250
7140
  patchExtendedProfile(profile) {
7251
- var _this75 = this;
7141
+ var _this74 = this;
7252
7142
  return _asyncToGenerator(function* () {
7253
- if (!(yield _this75.doesServerSupportExtendedProfiles())) {
7143
+ if (!(yield _this74.doesServerSupportExtendedProfiles())) {
7254
7144
  throw new Error("Server does not support extended profiles");
7255
7145
  }
7256
- var userId = _this75.getUserId();
7257
- return _this75.http.authedRequest(Method.Patch, utils.encodeUri("/profile/$userId", {
7146
+ var userId = _this74.getUserId();
7147
+ return _this74.http.authedRequest(Method.Patch, utils.encodeUri("/profile/$userId", {
7258
7148
  $userId: userId
7259
7149
  }), {}, profile, {
7260
- prefix: yield _this75.getExtendedProfileRequestPrefix()
7150
+ prefix: yield _this74.getExtendedProfileRequestPrefix()
7261
7151
  });
7262
7152
  })();
7263
7153
  }
@@ -7272,16 +7162,16 @@ export class MatrixClient extends TypedEventEmitter {
7272
7162
  * @throws An error if the server does not support MSC4133 OR the server disallows editing the user profile.
7273
7163
  */
7274
7164
  setExtendedProfile(profile) {
7275
- var _this76 = this;
7165
+ var _this75 = this;
7276
7166
  return _asyncToGenerator(function* () {
7277
- if (!(yield _this76.doesServerSupportExtendedProfiles())) {
7167
+ if (!(yield _this75.doesServerSupportExtendedProfiles())) {
7278
7168
  throw new Error("Server does not support extended profiles");
7279
7169
  }
7280
- var userId = _this76.getUserId();
7281
- yield _this76.http.authedRequest(Method.Put, utils.encodeUri("/profile/$userId", {
7170
+ var userId = _this75.getUserId();
7171
+ yield _this75.http.authedRequest(Method.Put, utils.encodeUri("/profile/$userId", {
7282
7172
  $userId: userId
7283
7173
  }), {}, profile, {
7284
- prefix: yield _this76.getExtendedProfileRequestPrefix()
7174
+ prefix: yield _this75.getExtendedProfileRequestPrefix()
7285
7175
  });
7286
7176
  })();
7287
7177
  }
@@ -7304,10 +7194,10 @@ export class MatrixClient extends TypedEventEmitter {
7304
7194
  * @returns Rejects: with an error response.
7305
7195
  */
7306
7196
  addThreePidOnly(data) {
7307
- var _this77 = this;
7197
+ var _this76 = this;
7308
7198
  return _asyncToGenerator(function* () {
7309
7199
  var path = "/account/3pid/add";
7310
- return _this77.http.authedRequest(Method.Post, path, undefined, data);
7200
+ return _this76.http.authedRequest(Method.Post, path, undefined, data);
7311
7201
  })();
7312
7202
  }
7313
7203
 
@@ -7323,10 +7213,10 @@ export class MatrixClient extends TypedEventEmitter {
7323
7213
  * @returns Rejects: with an error response.
7324
7214
  */
7325
7215
  bindThreePid(data) {
7326
- var _this78 = this;
7216
+ var _this77 = this;
7327
7217
  return _asyncToGenerator(function* () {
7328
7218
  var path = "/account/3pid/bind";
7329
- return _this78.http.authedRequest(Method.Post, path, undefined, data);
7219
+ return _this77.http.authedRequest(Method.Post, path, undefined, data);
7330
7220
  })();
7331
7221
  }
7332
7222
 
@@ -7344,15 +7234,15 @@ export class MatrixClient extends TypedEventEmitter {
7344
7234
  unbindThreePid(medium, address
7345
7235
  // eslint-disable-next-line camelcase
7346
7236
  ) {
7347
- var _this79 = this;
7237
+ var _this78 = this;
7348
7238
  return _asyncToGenerator(function* () {
7349
7239
  var path = "/account/3pid/unbind";
7350
7240
  var data = {
7351
7241
  medium,
7352
7242
  address,
7353
- id_server: _this79.getIdentityServerUrl(true)
7243
+ id_server: _this78.getIdentityServerUrl(true)
7354
7244
  };
7355
- return _this79.http.authedRequest(Method.Post, path, undefined, data);
7245
+ return _this78.http.authedRequest(Method.Post, path, undefined, data);
7356
7246
  })();
7357
7247
  }
7358
7248
 
@@ -7474,13 +7364,13 @@ export class MatrixClient extends TypedEventEmitter {
7474
7364
  * @returns Rejects: with an error response.
7475
7365
  */
7476
7366
  getPushers() {
7477
- var _this80 = this;
7367
+ var _this79 = this;
7478
7368
  return _asyncToGenerator(function* () {
7479
- var response = yield _this80.http.authedRequest(Method.Get, "/pushers");
7369
+ var response = yield _this79.http.authedRequest(Method.Get, "/pushers");
7480
7370
 
7481
7371
  // Migration path for clients that connect to a homeserver that does not support
7482
7372
  // MSC3881 yet, see https://github.com/matrix-org/matrix-spec-proposals/blob/kerry/remote-push-toggle/proposals/3881-remote-push-notification-toggling.md#migration
7483
- if (!(yield _this80.doesServerSupportUnstableFeature("org.matrix.msc3881"))) {
7373
+ if (!(yield _this79.doesServerSupportUnstableFeature("org.matrix.msc3881"))) {
7484
7374
  response.pushers = response.pushers.map(pusher => {
7485
7375
  if (!pusher.hasOwnProperty(PUSHER_ENABLED.name)) {
7486
7376
  pusher[PUSHER_ENABLED.name] = true;
@@ -7910,7 +7800,7 @@ export class MatrixClient extends TypedEventEmitter {
7910
7800
  * found MXIDs. Results where no user could be found will not be listed.
7911
7801
  */
7912
7802
  identityHashedLookup(addressPairs, identityAccessToken) {
7913
- var _this81 = this;
7803
+ var _this80 = this;
7914
7804
  return _asyncToGenerator(function* () {
7915
7805
  var params = {
7916
7806
  // addresses: ["email@example.org", "10005550000"],
@@ -7919,7 +7809,7 @@ export class MatrixClient extends TypedEventEmitter {
7919
7809
  };
7920
7810
 
7921
7811
  // Get hash information first before trying to do a lookup
7922
- var hashes = yield _this81.getIdentityHashDetails(identityAccessToken);
7812
+ var hashes = yield _this80.getIdentityHashDetails(identityAccessToken);
7923
7813
  if (!hashes || !hashes["lookup_pepper"] || !hashes["algorithms"]) {
7924
7814
  throw new Error("Unsupported identity server: bad response");
7925
7815
  }
@@ -7962,7 +7852,7 @@ export class MatrixClient extends TypedEventEmitter {
7962
7852
  } else {
7963
7853
  throw new Error("Unsupported identity server: unknown hash algorithm");
7964
7854
  }
7965
- var response = yield _this81.http.idServerRequest(Method.Post, "/lookup", params, IdentityPrefix.V2, identityAccessToken);
7855
+ var response = yield _this80.http.idServerRequest(Method.Post, "/lookup", params, IdentityPrefix.V2, identityAccessToken);
7966
7856
  if (!(response !== null && response !== void 0 && response["mappings"])) return []; // no results
7967
7857
 
7968
7858
  var foundAddresses = [];
@@ -7996,12 +7886,12 @@ export class MatrixClient extends TypedEventEmitter {
7996
7886
  * @returns Rejects: with an error response.
7997
7887
  */
7998
7888
  lookupThreePid(medium, address, identityAccessToken) {
7999
- var _this82 = this;
7889
+ var _this81 = this;
8000
7890
  return _asyncToGenerator(function* () {
8001
7891
  // Note: we're using the V2 API by calling this function, but our
8002
7892
  // function contract requires a V1 response. We therefore have to
8003
7893
  // convert it manually.
8004
- var response = yield _this82.identityHashedLookup([[address, medium]], identityAccessToken);
7894
+ var response = yield _this81.identityHashedLookup([[address, medium]], identityAccessToken);
8005
7895
  var result = response.find(p => p.address === address);
8006
7896
  if (!result) {
8007
7897
  return {};
@@ -8033,12 +7923,12 @@ export class MatrixClient extends TypedEventEmitter {
8033
7923
  * @returns Rejects: with an error response.
8034
7924
  */
8035
7925
  bulkLookupThreePids(query, identityAccessToken) {
8036
- var _this83 = this;
7926
+ var _this82 = this;
8037
7927
  return _asyncToGenerator(function* () {
8038
7928
  // Note: we're using the V2 API by calling this function, but our
8039
7929
  // function contract requires a V1 response. We therefore have to
8040
7930
  // convert it manually.
8041
- var response = yield _this83.identityHashedLookup(
7931
+ var response = yield _this82.identityHashedLookup(
8042
7932
  // We have to reverse the query order to get [address, medium] pairs
8043
7933
  query.map(p => [p[1], p[0]]), identityAccessToken);
8044
7934
  var v1results = [];
@@ -8239,16 +8129,16 @@ export class MatrixClient extends TypedEventEmitter {
8239
8129
  * @returns Promise which resolves to the created space.
8240
8130
  */
8241
8131
  unstableCreateFileTree(name) {
8242
- var _this84 = this;
8132
+ var _this83 = this;
8243
8133
  return _asyncToGenerator(function* () {
8244
8134
  var {
8245
8135
  room_id: roomId
8246
- } = yield _this84.createRoom({
8136
+ } = yield _this83.createRoom({
8247
8137
  name: name,
8248
8138
  preset: Preset.PrivateChat,
8249
8139
  power_level_content_override: _objectSpread(_objectSpread({}, DEFAULT_TREE_POWER_LEVELS_TEMPLATE), {}, {
8250
8140
  users: {
8251
- [_this84.getUserId()]: 100
8141
+ [_this83.getUserId()]: 100
8252
8142
  }
8253
8143
  }),
8254
8144
  creation_content: {
@@ -8268,7 +8158,7 @@ export class MatrixClient extends TypedEventEmitter {
8268
8158
  }
8269
8159
  }]
8270
8160
  });
8271
- return new MSC3089TreeSpace(_this84, roomId);
8161
+ return new MSC3089TreeSpace(_this83, roomId);
8272
8162
  })();
8273
8163
  }
8274
8164
 
@@ -8345,7 +8235,7 @@ export class MatrixClient extends TypedEventEmitter {
8345
8235
  * @param via - The list of servers which know about the room if only an ID was provided.
8346
8236
  */
8347
8237
  getRoomSummary(roomIdOrAlias, via) {
8348
- var _this85 = this;
8238
+ var _this84 = this;
8349
8239
  return _asyncToGenerator(function* () {
8350
8240
  var paramOpts = {
8351
8241
  prefix: "/_matrix/client/unstable/im.nheko.summary"
@@ -8354,7 +8244,7 @@ export class MatrixClient extends TypedEventEmitter {
8354
8244
  var path = utils.encodeUri("/summary/$roomid", {
8355
8245
  $roomid: roomIdOrAlias
8356
8246
  });
8357
- return yield _this85.http.authedRequest(Method.Get, path, {
8247
+ return yield _this84.http.authedRequest(Method.Get, path, {
8358
8248
  via
8359
8249
  }, undefined, paramOpts);
8360
8250
  } catch (e) {
@@ -8362,7 +8252,7 @@ export class MatrixClient extends TypedEventEmitter {
8362
8252
  var _path = utils.encodeUri("/rooms/$roomid/summary", {
8363
8253
  $roomid: roomIdOrAlias
8364
8254
  });
8365
- return yield _this85.http.authedRequest(Method.Get, _path, {
8255
+ return yield _this84.http.authedRequest(Method.Get, _path, {
8366
8256
  via
8367
8257
  }, undefined, paramOpts);
8368
8258
  } else {
@@ -8414,9 +8304,9 @@ export class MatrixClient extends TypedEventEmitter {
8414
8304
  * Fetches information about the user for the configured access token.
8415
8305
  */
8416
8306
  whoami() {
8417
- var _this86 = this;
8307
+ var _this85 = this;
8418
8308
  return _asyncToGenerator(function* () {
8419
- return _this86.http.authedRequest(Method.Get, "/account/whoami");
8309
+ return _this85.http.authedRequest(Method.Get, "/account/whoami");
8420
8310
  })();
8421
8311
  }
8422
8312
 
@@ -8427,7 +8317,7 @@ export class MatrixClient extends TypedEventEmitter {
8427
8317
  * @returns Rejects: when the request fails (module:http-api.MatrixError)
8428
8318
  */
8429
8319
  timestampToEvent(roomId, timestamp, dir) {
8430
- var _this87 = this;
8320
+ var _this86 = this;
8431
8321
  return _asyncToGenerator(function* () {
8432
8322
  var path = utils.encodeUri("/rooms/$roomId/timestamp_to_event", {
8433
8323
  $roomId: roomId
@@ -8437,7 +8327,7 @@ export class MatrixClient extends TypedEventEmitter {
8437
8327
  dir: dir
8438
8328
  };
8439
8329
  try {
8440
- return yield _this87.http.authedRequest(Method.Get, path, queryParams, undefined, {
8330
+ return yield _this86.http.authedRequest(Method.Get, path, queryParams, undefined, {
8441
8331
  prefix: ClientPrefix.V1
8442
8332
  });
8443
8333
  } catch (err) {
@@ -8453,7 +8343,7 @@ export class MatrixClient extends TypedEventEmitter {
8453
8343
  // both indicate that this endpoint+verb combination is
8454
8344
  // not supported.
8455
8345
  err.httpStatus === 404 || err.httpStatus === 405)) {
8456
- return yield _this87.http.authedRequest(Method.Get, path, queryParams, undefined, {
8346
+ return yield _this86.http.authedRequest(Method.Get, path, queryParams, undefined, {
8457
8347
  prefix: "/_matrix/client/unstable/org.matrix.msc3030"
8458
8348
  });
8459
8349
  }
@@ -8469,9 +8359,9 @@ export class MatrixClient extends TypedEventEmitter {
8469
8359
  * @experimental - part of MSC2965
8470
8360
  */
8471
8361
  getAuthIssuer() {
8472
- var _this88 = this;
8362
+ var _this87 = this;
8473
8363
  return _asyncToGenerator(function* () {
8474
- return _this88.http.request(Method.Get, "/auth_issuer", undefined, undefined, {
8364
+ return _this87.http.request(Method.Get, "/auth_issuer", undefined, undefined, {
8475
8365
  prefix: ClientPrefix.Unstable + "/org.matrix.msc2965"
8476
8366
  });
8477
8367
  })();