@unwanted/matrix-sdk-mini 34.12.0 → 34.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (698) 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/@types/global.d.js +0 -2
  6. package/lib/@types/global.d.js.map +1 -1
  7. package/lib/autodiscovery.d.ts +1 -1
  8. package/lib/autodiscovery.d.ts.map +1 -1
  9. package/lib/autodiscovery.js.map +1 -1
  10. package/lib/base64.d.ts +3 -6
  11. package/lib/base64.d.ts.map +1 -1
  12. package/lib/base64.js +43 -36
  13. package/lib/base64.js.map +1 -1
  14. package/lib/browser-index.d.ts.map +1 -1
  15. package/lib/browser-index.js +0 -11
  16. package/lib/browser-index.js.map +1 -1
  17. package/lib/client.d.ts +2 -1298
  18. package/lib/client.d.ts.map +1 -1
  19. package/lib/client.js +348 -2967
  20. package/lib/client.js.map +1 -1
  21. package/lib/digest.d.ts +2 -2
  22. package/lib/digest.d.ts.map +1 -1
  23. package/lib/digest.js +2 -2
  24. package/lib/digest.js.map +1 -1
  25. package/lib/embedded.d.ts +0 -22
  26. package/lib/embedded.d.ts.map +1 -1
  27. package/lib/embedded.js +58 -168
  28. package/lib/embedded.js.map +1 -1
  29. package/lib/event-mapper.d.ts.map +1 -1
  30. package/lib/event-mapper.js +0 -4
  31. package/lib/event-mapper.js.map +1 -1
  32. package/lib/matrix.d.ts +0 -25
  33. package/lib/matrix.d.ts.map +1 -1
  34. package/lib/matrix.js +1 -30
  35. package/lib/matrix.js.map +1 -1
  36. package/lib/models/MSC3089Branch.d.ts.map +1 -1
  37. package/lib/models/MSC3089Branch.js +0 -3
  38. package/lib/models/MSC3089Branch.js.map +1 -1
  39. package/lib/models/event-timeline-set.d.ts +6 -10
  40. package/lib/models/event-timeline-set.d.ts.map +1 -1
  41. package/lib/models/event-timeline-set.js +28 -36
  42. package/lib/models/event-timeline-set.js.map +1 -1
  43. package/lib/models/event-timeline.d.ts +7 -2
  44. package/lib/models/event-timeline.d.ts.map +1 -1
  45. package/lib/models/event-timeline.js +8 -9
  46. package/lib/models/event-timeline.js.map +1 -1
  47. package/lib/models/event.d.ts +1 -95
  48. package/lib/models/event.d.ts.map +1 -1
  49. package/lib/models/event.js +11 -281
  50. package/lib/models/event.js.map +1 -1
  51. package/lib/models/poll.d.ts.map +1 -1
  52. package/lib/models/poll.js +1 -5
  53. package/lib/models/poll.js.map +1 -1
  54. package/lib/models/relations-container.d.ts.map +1 -1
  55. package/lib/models/relations-container.js +1 -7
  56. package/lib/models/relations-container.js.map +1 -1
  57. package/lib/models/relations.d.ts +0 -1
  58. package/lib/models/relations.d.ts.map +1 -1
  59. package/lib/models/relations.js +0 -8
  60. package/lib/models/relations.js.map +1 -1
  61. package/lib/models/room-state.d.ts +2 -13
  62. package/lib/models/room-state.d.ts.map +1 -1
  63. package/lib/models/room-state.js +12 -56
  64. package/lib/models/room-state.js.map +1 -1
  65. package/lib/models/room.d.ts +2 -20
  66. package/lib/models/room.d.ts.map +1 -1
  67. package/lib/models/room.js +121 -162
  68. package/lib/models/room.js.map +1 -1
  69. package/lib/models/thread.d.ts.map +1 -1
  70. package/lib/models/thread.js +5 -4
  71. package/lib/models/thread.js.map +1 -1
  72. package/lib/sliding-sync-sdk.d.ts +3 -4
  73. package/lib/sliding-sync-sdk.d.ts.map +1 -1
  74. package/lib/sliding-sync-sdk.js +55 -102
  75. package/lib/sliding-sync-sdk.js.map +1 -1
  76. package/lib/sliding-sync.js +9 -6
  77. package/lib/sliding-sync.js.map +1 -1
  78. package/lib/store/indexeddb.d.ts +1 -1
  79. package/lib/store/indexeddb.d.ts.map +1 -1
  80. package/lib/store/indexeddb.js.map +1 -1
  81. package/lib/sync-accumulator.d.ts +6 -4
  82. package/lib/sync-accumulator.d.ts.map +1 -1
  83. package/lib/sync-accumulator.js +23 -12
  84. package/lib/sync-accumulator.js.map +1 -1
  85. package/lib/sync.d.ts +10 -13
  86. package/lib/sync.d.ts.map +1 -1
  87. package/lib/sync.js +94 -115
  88. package/lib/sync.js.map +1 -1
  89. package/lib/testing.d.ts +0 -48
  90. package/lib/testing.d.ts.map +1 -1
  91. package/lib/testing.js +0 -105
  92. package/lib/testing.js.map +1 -1
  93. package/lib/types.d.ts +0 -1
  94. package/lib/types.d.ts.map +1 -1
  95. package/lib/types.js.map +1 -1
  96. package/package.json +10 -11
  97. package/src/@types/event.ts +2 -36
  98. package/src/@types/global.d.ts +21 -4
  99. package/src/autodiscovery.ts +1 -1
  100. package/src/base64.ts +38 -40
  101. package/src/browser-index.ts +0 -11
  102. package/src/client.ts +68 -3087
  103. package/src/digest.ts +3 -3
  104. package/src/embedded.ts +38 -134
  105. package/src/event-mapper.ts +0 -4
  106. package/src/matrix.ts +0 -41
  107. package/src/models/MSC3089Branch.ts +0 -3
  108. package/src/models/event-timeline-set.ts +17 -38
  109. package/src/models/event-timeline.ts +10 -5
  110. package/src/models/event.ts +8 -295
  111. package/src/models/poll.ts +0 -6
  112. package/src/models/relations-container.ts +1 -8
  113. package/src/models/relations.ts +0 -8
  114. package/src/models/room-state.ts +4 -37
  115. package/src/models/room.ts +18 -68
  116. package/src/models/thread.ts +4 -3
  117. package/src/sliding-sync-sdk.ts +10 -83
  118. package/src/sliding-sync.ts +6 -6
  119. package/src/store/indexeddb.ts +1 -1
  120. package/src/sync-accumulator.ts +33 -16
  121. package/src/sync.ts +112 -143
  122. package/src/testing.ts +0 -108
  123. package/src/types.ts +0 -1
  124. package/CHANGELOG.md +0 -5910
  125. package/lib/@types/AESEncryptedSecretStoragePayload.d.ts +0 -14
  126. package/lib/@types/AESEncryptedSecretStoragePayload.d.ts.map +0 -1
  127. package/lib/@types/AESEncryptedSecretStoragePayload.js +0 -1
  128. package/lib/@types/AESEncryptedSecretStoragePayload.js.map +0 -1
  129. package/lib/@types/crypto.d.ts +0 -47
  130. package/lib/@types/crypto.d.ts.map +0 -1
  131. package/lib/@types/crypto.js +0 -1
  132. package/lib/@types/crypto.js.map +0 -1
  133. package/lib/@types/matrix-sdk-crypto-wasm.d.js +0 -1
  134. package/lib/@types/matrix-sdk-crypto-wasm.d.js.map +0 -1
  135. package/lib/common-crypto/CryptoBackend.d.ts +0 -240
  136. package/lib/common-crypto/CryptoBackend.d.ts.map +0 -1
  137. package/lib/common-crypto/CryptoBackend.js +0 -73
  138. package/lib/common-crypto/CryptoBackend.js.map +0 -1
  139. package/lib/common-crypto/key-passphrase.d.ts +0 -14
  140. package/lib/common-crypto/key-passphrase.d.ts.map +0 -1
  141. package/lib/common-crypto/key-passphrase.js +0 -33
  142. package/lib/common-crypto/key-passphrase.js.map +0 -1
  143. package/lib/crypto/CrossSigning.d.ts +0 -184
  144. package/lib/crypto/CrossSigning.d.ts.map +0 -1
  145. package/lib/crypto/CrossSigning.js +0 -718
  146. package/lib/crypto/CrossSigning.js.map +0 -1
  147. package/lib/crypto/DeviceList.d.ts +0 -216
  148. package/lib/crypto/DeviceList.d.ts.map +0 -1
  149. package/lib/crypto/DeviceList.js +0 -892
  150. package/lib/crypto/DeviceList.js.map +0 -1
  151. package/lib/crypto/EncryptionSetup.d.ts +0 -152
  152. package/lib/crypto/EncryptionSetup.d.ts.map +0 -1
  153. package/lib/crypto/EncryptionSetup.js +0 -356
  154. package/lib/crypto/EncryptionSetup.js.map +0 -1
  155. package/lib/crypto/OlmDevice.d.ts +0 -457
  156. package/lib/crypto/OlmDevice.d.ts.map +0 -1
  157. package/lib/crypto/OlmDevice.js +0 -1241
  158. package/lib/crypto/OlmDevice.js.map +0 -1
  159. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts +0 -109
  160. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts.map +0 -1
  161. package/lib/crypto/OutgoingRoomKeyRequestManager.js +0 -415
  162. package/lib/crypto/OutgoingRoomKeyRequestManager.js.map +0 -1
  163. package/lib/crypto/RoomList.d.ts +0 -26
  164. package/lib/crypto/RoomList.d.ts.map +0 -1
  165. package/lib/crypto/RoomList.js +0 -71
  166. package/lib/crypto/RoomList.js.map +0 -1
  167. package/lib/crypto/SecretSharing.d.ts +0 -24
  168. package/lib/crypto/SecretSharing.d.ts.map +0 -1
  169. package/lib/crypto/SecretSharing.js +0 -194
  170. package/lib/crypto/SecretSharing.js.map +0 -1
  171. package/lib/crypto/SecretStorage.d.ts +0 -55
  172. package/lib/crypto/SecretStorage.d.ts.map +0 -1
  173. package/lib/crypto/SecretStorage.js +0 -118
  174. package/lib/crypto/SecretStorage.js.map +0 -1
  175. package/lib/crypto/aes.d.ts +0 -6
  176. package/lib/crypto/aes.d.ts.map +0 -1
  177. package/lib/crypto/aes.js +0 -24
  178. package/lib/crypto/aes.js.map +0 -1
  179. package/lib/crypto/algorithms/base.d.ts +0 -156
  180. package/lib/crypto/algorithms/base.d.ts.map +0 -1
  181. package/lib/crypto/algorithms/base.js +0 -187
  182. package/lib/crypto/algorithms/base.js.map +0 -1
  183. package/lib/crypto/algorithms/index.d.ts +0 -4
  184. package/lib/crypto/algorithms/index.d.ts.map +0 -1
  185. package/lib/crypto/algorithms/index.js +0 -20
  186. package/lib/crypto/algorithms/index.js.map +0 -1
  187. package/lib/crypto/algorithms/megolm.d.ts +0 -385
  188. package/lib/crypto/algorithms/megolm.d.ts.map +0 -1
  189. package/lib/crypto/algorithms/megolm.js +0 -1822
  190. package/lib/crypto/algorithms/megolm.js.map +0 -1
  191. package/lib/crypto/algorithms/olm.d.ts +0 -5
  192. package/lib/crypto/algorithms/olm.d.ts.map +0 -1
  193. package/lib/crypto/algorithms/olm.js +0 -299
  194. package/lib/crypto/algorithms/olm.js.map +0 -1
  195. package/lib/crypto/api.d.ts +0 -32
  196. package/lib/crypto/api.d.ts.map +0 -1
  197. package/lib/crypto/api.js +0 -22
  198. package/lib/crypto/api.js.map +0 -1
  199. package/lib/crypto/backup.d.ts +0 -227
  200. package/lib/crypto/backup.d.ts.map +0 -1
  201. package/lib/crypto/backup.js +0 -824
  202. package/lib/crypto/backup.js.map +0 -1
  203. package/lib/crypto/crypto.d.ts +0 -3
  204. package/lib/crypto/crypto.d.ts.map +0 -1
  205. package/lib/crypto/crypto.js +0 -19
  206. package/lib/crypto/crypto.js.map +0 -1
  207. package/lib/crypto/dehydration.d.ts +0 -34
  208. package/lib/crypto/dehydration.d.ts.map +0 -1
  209. package/lib/crypto/dehydration.js +0 -252
  210. package/lib/crypto/dehydration.js.map +0 -1
  211. package/lib/crypto/device-converter.d.ts +0 -9
  212. package/lib/crypto/device-converter.d.ts.map +0 -1
  213. package/lib/crypto/device-converter.js +0 -42
  214. package/lib/crypto/device-converter.js.map +0 -1
  215. package/lib/crypto/deviceinfo.d.ts +0 -99
  216. package/lib/crypto/deviceinfo.d.ts.map +0 -1
  217. package/lib/crypto/deviceinfo.js +0 -148
  218. package/lib/crypto/deviceinfo.js.map +0 -1
  219. package/lib/crypto/index.d.ts +0 -1210
  220. package/lib/crypto/index.d.ts.map +0 -1
  221. package/lib/crypto/index.js +0 -4101
  222. package/lib/crypto/index.js.map +0 -1
  223. package/lib/crypto/key_passphrase.d.ts +0 -14
  224. package/lib/crypto/key_passphrase.d.ts.map +0 -1
  225. package/lib/crypto/key_passphrase.js +0 -44
  226. package/lib/crypto/key_passphrase.js.map +0 -1
  227. package/lib/crypto/keybackup.d.ts +0 -18
  228. package/lib/crypto/keybackup.d.ts.map +0 -1
  229. package/lib/crypto/keybackup.js +0 -1
  230. package/lib/crypto/keybackup.js.map +0 -1
  231. package/lib/crypto/olmlib.d.ts +0 -129
  232. package/lib/crypto/olmlib.d.ts.map +0 -1
  233. package/lib/crypto/olmlib.js +0 -492
  234. package/lib/crypto/olmlib.js.map +0 -1
  235. package/lib/crypto/recoverykey.d.ts +0 -2
  236. package/lib/crypto/recoverykey.d.ts.map +0 -1
  237. package/lib/crypto/recoverykey.js +0 -19
  238. package/lib/crypto/recoverykey.js.map +0 -1
  239. package/lib/crypto/store/base.d.ts +0 -252
  240. package/lib/crypto/store/base.d.ts.map +0 -1
  241. package/lib/crypto/store/base.js +0 -64
  242. package/lib/crypto/store/base.js.map +0 -1
  243. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts +0 -187
  244. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts.map +0 -1
  245. package/lib/crypto/store/indexeddb-crypto-store-backend.js +0 -1145
  246. package/lib/crypto/store/indexeddb-crypto-store-backend.js.map +0 -1
  247. package/lib/crypto/store/indexeddb-crypto-store.d.ts +0 -432
  248. package/lib/crypto/store/indexeddb-crypto-store.d.ts.map +0 -1
  249. package/lib/crypto/store/indexeddb-crypto-store.js +0 -728
  250. package/lib/crypto/store/indexeddb-crypto-store.js.map +0 -1
  251. package/lib/crypto/store/localStorage-crypto-store.d.ts +0 -119
  252. package/lib/crypto/store/localStorage-crypto-store.d.ts.map +0 -1
  253. package/lib/crypto/store/localStorage-crypto-store.js +0 -531
  254. package/lib/crypto/store/localStorage-crypto-store.js.map +0 -1
  255. package/lib/crypto/store/memory-crypto-store.d.ts +0 -215
  256. package/lib/crypto/store/memory-crypto-store.d.ts.map +0 -1
  257. package/lib/crypto/store/memory-crypto-store.js +0 -622
  258. package/lib/crypto/store/memory-crypto-store.js.map +0 -1
  259. package/lib/crypto/verification/Base.d.ts +0 -105
  260. package/lib/crypto/verification/Base.d.ts.map +0 -1
  261. package/lib/crypto/verification/Base.js +0 -372
  262. package/lib/crypto/verification/Base.js.map +0 -1
  263. package/lib/crypto/verification/Error.d.ts +0 -35
  264. package/lib/crypto/verification/Error.d.ts.map +0 -1
  265. package/lib/crypto/verification/Error.js +0 -86
  266. package/lib/crypto/verification/Error.js.map +0 -1
  267. package/lib/crypto/verification/IllegalMethod.d.ts +0 -15
  268. package/lib/crypto/verification/IllegalMethod.d.ts.map +0 -1
  269. package/lib/crypto/verification/IllegalMethod.js +0 -43
  270. package/lib/crypto/verification/IllegalMethod.js.map +0 -1
  271. package/lib/crypto/verification/QRCode.d.ts +0 -51
  272. package/lib/crypto/verification/QRCode.d.ts.map +0 -1
  273. package/lib/crypto/verification/QRCode.js +0 -277
  274. package/lib/crypto/verification/QRCode.js.map +0 -1
  275. package/lib/crypto/verification/SAS.d.ts +0 -27
  276. package/lib/crypto/verification/SAS.d.ts.map +0 -1
  277. package/lib/crypto/verification/SAS.js +0 -485
  278. package/lib/crypto/verification/SAS.js.map +0 -1
  279. package/lib/crypto/verification/SASDecimal.d.ts +0 -8
  280. package/lib/crypto/verification/SASDecimal.d.ts.map +0 -1
  281. package/lib/crypto/verification/SASDecimal.js +0 -34
  282. package/lib/crypto/verification/SASDecimal.js.map +0 -1
  283. package/lib/crypto/verification/request/Channel.d.ts +0 -18
  284. package/lib/crypto/verification/request/Channel.d.ts.map +0 -1
  285. package/lib/crypto/verification/request/Channel.js +0 -1
  286. package/lib/crypto/verification/request/Channel.js.map +0 -1
  287. package/lib/crypto/verification/request/InRoomChannel.d.ts +0 -113
  288. package/lib/crypto/verification/request/InRoomChannel.d.ts.map +0 -1
  289. package/lib/crypto/verification/request/InRoomChannel.js +0 -351
  290. package/lib/crypto/verification/request/InRoomChannel.js.map +0 -1
  291. package/lib/crypto/verification/request/ToDeviceChannel.d.ts +0 -105
  292. package/lib/crypto/verification/request/ToDeviceChannel.d.ts.map +0 -1
  293. package/lib/crypto/verification/request/ToDeviceChannel.js +0 -328
  294. package/lib/crypto/verification/request/ToDeviceChannel.js.map +0 -1
  295. package/lib/crypto/verification/request/VerificationRequest.d.ts +0 -227
  296. package/lib/crypto/verification/request/VerificationRequest.d.ts.map +0 -1
  297. package/lib/crypto/verification/request/VerificationRequest.js +0 -937
  298. package/lib/crypto/verification/request/VerificationRequest.js.map +0 -1
  299. package/lib/crypto-api/CryptoEvent.d.ts +0 -69
  300. package/lib/crypto-api/CryptoEvent.d.ts.map +0 -1
  301. package/lib/crypto-api/CryptoEvent.js +0 -33
  302. package/lib/crypto-api/CryptoEvent.js.map +0 -1
  303. package/lib/crypto-api/CryptoEventHandlerMap.d.ts +0 -16
  304. package/lib/crypto-api/CryptoEventHandlerMap.d.ts.map +0 -1
  305. package/lib/crypto-api/CryptoEventHandlerMap.js +0 -22
  306. package/lib/crypto-api/CryptoEventHandlerMap.js.map +0 -1
  307. package/lib/crypto-api/index.d.ts +0 -978
  308. package/lib/crypto-api/index.d.ts.map +0 -1
  309. package/lib/crypto-api/index.js +0 -304
  310. package/lib/crypto-api/index.js.map +0 -1
  311. package/lib/crypto-api/key-passphrase.d.ts +0 -11
  312. package/lib/crypto-api/key-passphrase.d.ts.map +0 -1
  313. package/lib/crypto-api/key-passphrase.js +0 -51
  314. package/lib/crypto-api/key-passphrase.js.map +0 -1
  315. package/lib/crypto-api/keybackup.d.ts +0 -88
  316. package/lib/crypto-api/keybackup.d.ts.map +0 -1
  317. package/lib/crypto-api/keybackup.js +0 -1
  318. package/lib/crypto-api/keybackup.js.map +0 -1
  319. package/lib/crypto-api/recovery-key.d.ts +0 -11
  320. package/lib/crypto-api/recovery-key.d.ts.map +0 -1
  321. package/lib/crypto-api/recovery-key.js +0 -65
  322. package/lib/crypto-api/recovery-key.js.map +0 -1
  323. package/lib/crypto-api/verification.d.ts +0 -344
  324. package/lib/crypto-api/verification.d.ts.map +0 -1
  325. package/lib/crypto-api/verification.js +0 -91
  326. package/lib/crypto-api/verification.js.map +0 -1
  327. package/lib/matrixrtc/CallMembership.d.ts +0 -66
  328. package/lib/matrixrtc/CallMembership.d.ts.map +0 -1
  329. package/lib/matrixrtc/CallMembership.js +0 -197
  330. package/lib/matrixrtc/CallMembership.js.map +0 -1
  331. package/lib/matrixrtc/LivekitFocus.d.ts +0 -16
  332. package/lib/matrixrtc/LivekitFocus.d.ts.map +0 -1
  333. package/lib/matrixrtc/LivekitFocus.js +0 -20
  334. package/lib/matrixrtc/LivekitFocus.js.map +0 -1
  335. package/lib/matrixrtc/MatrixRTCSession.d.ts +0 -295
  336. package/lib/matrixrtc/MatrixRTCSession.d.ts.map +0 -1
  337. package/lib/matrixrtc/MatrixRTCSession.js +0 -1043
  338. package/lib/matrixrtc/MatrixRTCSession.js.map +0 -1
  339. package/lib/matrixrtc/MatrixRTCSessionManager.d.ts +0 -40
  340. package/lib/matrixrtc/MatrixRTCSessionManager.d.ts.map +0 -1
  341. package/lib/matrixrtc/MatrixRTCSessionManager.js +0 -146
  342. package/lib/matrixrtc/MatrixRTCSessionManager.js.map +0 -1
  343. package/lib/matrixrtc/focus.d.ts +0 -10
  344. package/lib/matrixrtc/focus.d.ts.map +0 -1
  345. package/lib/matrixrtc/focus.js +0 -1
  346. package/lib/matrixrtc/focus.js.map +0 -1
  347. package/lib/matrixrtc/index.d.ts +0 -7
  348. package/lib/matrixrtc/index.d.ts.map +0 -1
  349. package/lib/matrixrtc/index.js +0 -21
  350. package/lib/matrixrtc/index.js.map +0 -1
  351. package/lib/matrixrtc/types.d.ts +0 -19
  352. package/lib/matrixrtc/types.d.ts.map +0 -1
  353. package/lib/matrixrtc/types.js +0 -1
  354. package/lib/matrixrtc/types.js.map +0 -1
  355. package/lib/rendezvous/MSC4108SignInWithQR.d.ts +0 -112
  356. package/lib/rendezvous/MSC4108SignInWithQR.d.ts.map +0 -1
  357. package/lib/rendezvous/MSC4108SignInWithQR.js +0 -392
  358. package/lib/rendezvous/MSC4108SignInWithQR.js.map +0 -1
  359. package/lib/rendezvous/RendezvousChannel.d.ts +0 -27
  360. package/lib/rendezvous/RendezvousChannel.d.ts.map +0 -1
  361. package/lib/rendezvous/RendezvousChannel.js +0 -1
  362. package/lib/rendezvous/RendezvousChannel.js.map +0 -1
  363. package/lib/rendezvous/RendezvousCode.d.ts +0 -9
  364. package/lib/rendezvous/RendezvousCode.d.ts.map +0 -1
  365. package/lib/rendezvous/RendezvousCode.js +0 -1
  366. package/lib/rendezvous/RendezvousCode.js.map +0 -1
  367. package/lib/rendezvous/RendezvousError.d.ts +0 -6
  368. package/lib/rendezvous/RendezvousError.d.ts.map +0 -1
  369. package/lib/rendezvous/RendezvousError.js +0 -23
  370. package/lib/rendezvous/RendezvousError.js.map +0 -1
  371. package/lib/rendezvous/RendezvousFailureReason.d.ts +0 -31
  372. package/lib/rendezvous/RendezvousFailureReason.d.ts.map +0 -1
  373. package/lib/rendezvous/RendezvousFailureReason.js +0 -38
  374. package/lib/rendezvous/RendezvousFailureReason.js.map +0 -1
  375. package/lib/rendezvous/RendezvousIntent.d.ts +0 -5
  376. package/lib/rendezvous/RendezvousIntent.d.ts.map +0 -1
  377. package/lib/rendezvous/RendezvousIntent.js +0 -22
  378. package/lib/rendezvous/RendezvousIntent.js.map +0 -1
  379. package/lib/rendezvous/RendezvousTransport.d.ts +0 -36
  380. package/lib/rendezvous/RendezvousTransport.d.ts.map +0 -1
  381. package/lib/rendezvous/RendezvousTransport.js +0 -1
  382. package/lib/rendezvous/RendezvousTransport.js.map +0 -1
  383. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts +0 -58
  384. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts.map +0 -1
  385. package/lib/rendezvous/channels/MSC4108SecureChannel.js +0 -246
  386. package/lib/rendezvous/channels/MSC4108SecureChannel.js.map +0 -1
  387. package/lib/rendezvous/channels/index.d.ts +0 -2
  388. package/lib/rendezvous/channels/index.d.ts.map +0 -1
  389. package/lib/rendezvous/channels/index.js +0 -18
  390. package/lib/rendezvous/channels/index.js.map +0 -1
  391. package/lib/rendezvous/index.d.ts +0 -10
  392. package/lib/rendezvous/index.d.ts.map +0 -1
  393. package/lib/rendezvous/index.js +0 -23
  394. package/lib/rendezvous/index.js.map +0 -1
  395. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts +0 -61
  396. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts.map +0 -1
  397. package/lib/rendezvous/transports/MSC4108RendezvousSession.js +0 -253
  398. package/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +0 -1
  399. package/lib/rendezvous/transports/index.d.ts +0 -2
  400. package/lib/rendezvous/transports/index.d.ts.map +0 -1
  401. package/lib/rendezvous/transports/index.js +0 -18
  402. package/lib/rendezvous/transports/index.js.map +0 -1
  403. package/lib/rust-crypto/CrossSigningIdentity.d.ts +0 -33
  404. package/lib/rust-crypto/CrossSigningIdentity.d.ts.map +0 -1
  405. package/lib/rust-crypto/CrossSigningIdentity.js +0 -157
  406. package/lib/rust-crypto/CrossSigningIdentity.js.map +0 -1
  407. package/lib/rust-crypto/DehydratedDeviceManager.d.ts +0 -98
  408. package/lib/rust-crypto/DehydratedDeviceManager.d.ts.map +0 -1
  409. package/lib/rust-crypto/DehydratedDeviceManager.js +0 -285
  410. package/lib/rust-crypto/DehydratedDeviceManager.js.map +0 -1
  411. package/lib/rust-crypto/KeyClaimManager.d.ts +0 -33
  412. package/lib/rust-crypto/KeyClaimManager.d.ts.map +0 -1
  413. package/lib/rust-crypto/KeyClaimManager.js +0 -82
  414. package/lib/rust-crypto/KeyClaimManager.js.map +0 -1
  415. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts +0 -43
  416. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts.map +0 -1
  417. package/lib/rust-crypto/OutgoingRequestProcessor.js +0 -195
  418. package/lib/rust-crypto/OutgoingRequestProcessor.js.map +0 -1
  419. package/lib/rust-crypto/OutgoingRequestsManager.d.ts +0 -47
  420. package/lib/rust-crypto/OutgoingRequestsManager.d.ts.map +0 -1
  421. package/lib/rust-crypto/OutgoingRequestsManager.js +0 -148
  422. package/lib/rust-crypto/OutgoingRequestsManager.js.map +0 -1
  423. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts +0 -120
  424. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts.map +0 -1
  425. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js +0 -467
  426. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +0 -1
  427. package/lib/rust-crypto/RoomEncryptor.d.ts +0 -98
  428. package/lib/rust-crypto/RoomEncryptor.d.ts.map +0 -1
  429. package/lib/rust-crypto/RoomEncryptor.js +0 -299
  430. package/lib/rust-crypto/RoomEncryptor.js.map +0 -1
  431. package/lib/rust-crypto/backup.d.ts +0 -254
  432. package/lib/rust-crypto/backup.d.ts.map +0 -1
  433. package/lib/rust-crypto/backup.js +0 -837
  434. package/lib/rust-crypto/backup.js.map +0 -1
  435. package/lib/rust-crypto/constants.d.ts +0 -3
  436. package/lib/rust-crypto/constants.d.ts.map +0 -1
  437. package/lib/rust-crypto/constants.js +0 -19
  438. package/lib/rust-crypto/constants.js.map +0 -1
  439. package/lib/rust-crypto/device-converter.d.ts +0 -28
  440. package/lib/rust-crypto/device-converter.d.ts.map +0 -1
  441. package/lib/rust-crypto/device-converter.js +0 -123
  442. package/lib/rust-crypto/device-converter.js.map +0 -1
  443. package/lib/rust-crypto/index.d.ts +0 -61
  444. package/lib/rust-crypto/index.d.ts.map +0 -1
  445. package/lib/rust-crypto/index.js +0 -152
  446. package/lib/rust-crypto/index.js.map +0 -1
  447. package/lib/rust-crypto/libolm_migration.d.ts +0 -81
  448. package/lib/rust-crypto/libolm_migration.d.ts.map +0 -1
  449. package/lib/rust-crypto/libolm_migration.js +0 -459
  450. package/lib/rust-crypto/libolm_migration.js.map +0 -1
  451. package/lib/rust-crypto/rust-crypto.d.ts +0 -556
  452. package/lib/rust-crypto/rust-crypto.d.ts.map +0 -1
  453. package/lib/rust-crypto/rust-crypto.js +0 -2016
  454. package/lib/rust-crypto/rust-crypto.js.map +0 -1
  455. package/lib/rust-crypto/secret-storage.d.ts +0 -22
  456. package/lib/rust-crypto/secret-storage.d.ts.map +0 -1
  457. package/lib/rust-crypto/secret-storage.js +0 -63
  458. package/lib/rust-crypto/secret-storage.js.map +0 -1
  459. package/lib/rust-crypto/verification.d.ts +0 -319
  460. package/lib/rust-crypto/verification.d.ts.map +0 -1
  461. package/lib/rust-crypto/verification.js +0 -816
  462. package/lib/rust-crypto/verification.js.map +0 -1
  463. package/lib/secret-storage.d.ts +0 -370
  464. package/lib/secret-storage.d.ts.map +0 -1
  465. package/lib/secret-storage.js +0 -466
  466. package/lib/secret-storage.js.map +0 -1
  467. package/lib/utils/decryptAESSecretStorageItem.d.ts +0 -12
  468. package/lib/utils/decryptAESSecretStorageItem.d.ts.map +0 -1
  469. package/lib/utils/decryptAESSecretStorageItem.js +0 -50
  470. package/lib/utils/decryptAESSecretStorageItem.js.map +0 -1
  471. package/lib/utils/encryptAESSecretStorageItem.d.ts +0 -16
  472. package/lib/utils/encryptAESSecretStorageItem.d.ts.map +0 -1
  473. package/lib/utils/encryptAESSecretStorageItem.js +0 -68
  474. package/lib/utils/encryptAESSecretStorageItem.js.map +0 -1
  475. package/lib/utils/internal/deriveKeys.d.ts +0 -10
  476. package/lib/utils/internal/deriveKeys.d.ts.map +0 -1
  477. package/lib/utils/internal/deriveKeys.js +0 -60
  478. package/lib/utils/internal/deriveKeys.js.map +0 -1
  479. package/lib/webrtc/audioContext.d.ts +0 -15
  480. package/lib/webrtc/audioContext.d.ts.map +0 -1
  481. package/lib/webrtc/audioContext.js +0 -46
  482. package/lib/webrtc/audioContext.js.map +0 -1
  483. package/lib/webrtc/call.d.ts +0 -560
  484. package/lib/webrtc/call.d.ts.map +0 -1
  485. package/lib/webrtc/call.js +0 -2541
  486. package/lib/webrtc/call.js.map +0 -1
  487. package/lib/webrtc/callEventHandler.d.ts +0 -37
  488. package/lib/webrtc/callEventHandler.d.ts.map +0 -1
  489. package/lib/webrtc/callEventHandler.js +0 -344
  490. package/lib/webrtc/callEventHandler.js.map +0 -1
  491. package/lib/webrtc/callEventTypes.d.ts +0 -73
  492. package/lib/webrtc/callEventTypes.d.ts.map +0 -1
  493. package/lib/webrtc/callEventTypes.js +0 -13
  494. package/lib/webrtc/callEventTypes.js.map +0 -1
  495. package/lib/webrtc/callFeed.d.ts +0 -128
  496. package/lib/webrtc/callFeed.d.ts.map +0 -1
  497. package/lib/webrtc/callFeed.js +0 -289
  498. package/lib/webrtc/callFeed.js.map +0 -1
  499. package/lib/webrtc/groupCall.d.ts +0 -323
  500. package/lib/webrtc/groupCall.d.ts.map +0 -1
  501. package/lib/webrtc/groupCall.js +0 -1337
  502. package/lib/webrtc/groupCall.js.map +0 -1
  503. package/lib/webrtc/groupCallEventHandler.d.ts +0 -31
  504. package/lib/webrtc/groupCallEventHandler.d.ts.map +0 -1
  505. package/lib/webrtc/groupCallEventHandler.js +0 -178
  506. package/lib/webrtc/groupCallEventHandler.js.map +0 -1
  507. package/lib/webrtc/mediaHandler.d.ts +0 -89
  508. package/lib/webrtc/mediaHandler.d.ts.map +0 -1
  509. package/lib/webrtc/mediaHandler.js +0 -437
  510. package/lib/webrtc/mediaHandler.js.map +0 -1
  511. package/lib/webrtc/stats/callFeedStatsReporter.d.ts +0 -8
  512. package/lib/webrtc/stats/callFeedStatsReporter.d.ts.map +0 -1
  513. package/lib/webrtc/stats/callFeedStatsReporter.js +0 -82
  514. package/lib/webrtc/stats/callFeedStatsReporter.js.map +0 -1
  515. package/lib/webrtc/stats/callStatsReportGatherer.d.ts +0 -25
  516. package/lib/webrtc/stats/callStatsReportGatherer.d.ts.map +0 -1
  517. package/lib/webrtc/stats/callStatsReportGatherer.js +0 -199
  518. package/lib/webrtc/stats/callStatsReportGatherer.js.map +0 -1
  519. package/lib/webrtc/stats/callStatsReportSummary.d.ts +0 -17
  520. package/lib/webrtc/stats/callStatsReportSummary.d.ts.map +0 -1
  521. package/lib/webrtc/stats/callStatsReportSummary.js +0 -1
  522. package/lib/webrtc/stats/callStatsReportSummary.js.map +0 -1
  523. package/lib/webrtc/stats/connectionStats.d.ts +0 -28
  524. package/lib/webrtc/stats/connectionStats.d.ts.map +0 -1
  525. package/lib/webrtc/stats/connectionStats.js +0 -26
  526. package/lib/webrtc/stats/connectionStats.js.map +0 -1
  527. package/lib/webrtc/stats/connectionStatsBuilder.d.ts +0 -5
  528. package/lib/webrtc/stats/connectionStatsBuilder.d.ts.map +0 -1
  529. package/lib/webrtc/stats/connectionStatsBuilder.js +0 -27
  530. package/lib/webrtc/stats/connectionStatsBuilder.js.map +0 -1
  531. package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts +0 -7
  532. package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts.map +0 -1
  533. package/lib/webrtc/stats/connectionStatsReportBuilder.js +0 -121
  534. package/lib/webrtc/stats/connectionStatsReportBuilder.js.map +0 -1
  535. package/lib/webrtc/stats/groupCallStats.d.ts +0 -22
  536. package/lib/webrtc/stats/groupCallStats.d.ts.map +0 -1
  537. package/lib/webrtc/stats/groupCallStats.js +0 -78
  538. package/lib/webrtc/stats/groupCallStats.js.map +0 -1
  539. package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts +0 -10
  540. package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts.map +0 -1
  541. package/lib/webrtc/stats/media/mediaSsrcHandler.js +0 -57
  542. package/lib/webrtc/stats/media/mediaSsrcHandler.js.map +0 -1
  543. package/lib/webrtc/stats/media/mediaTrackHandler.d.ts +0 -12
  544. package/lib/webrtc/stats/media/mediaTrackHandler.d.ts.map +0 -1
  545. package/lib/webrtc/stats/media/mediaTrackHandler.js +0 -62
  546. package/lib/webrtc/stats/media/mediaTrackHandler.js.map +0 -1
  547. package/lib/webrtc/stats/media/mediaTrackStats.d.ts +0 -86
  548. package/lib/webrtc/stats/media/mediaTrackStats.d.ts.map +0 -1
  549. package/lib/webrtc/stats/media/mediaTrackStats.js +0 -142
  550. package/lib/webrtc/stats/media/mediaTrackStats.js.map +0 -1
  551. package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts +0 -22
  552. package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts.map +0 -1
  553. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js +0 -76
  554. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js.map +0 -1
  555. package/lib/webrtc/stats/statsReport.d.ts +0 -99
  556. package/lib/webrtc/stats/statsReport.d.ts.map +0 -1
  557. package/lib/webrtc/stats/statsReport.js +0 -32
  558. package/lib/webrtc/stats/statsReport.js.map +0 -1
  559. package/lib/webrtc/stats/statsReportEmitter.d.ts +0 -15
  560. package/lib/webrtc/stats/statsReportEmitter.d.ts.map +0 -1
  561. package/lib/webrtc/stats/statsReportEmitter.js +0 -33
  562. package/lib/webrtc/stats/statsReportEmitter.js.map +0 -1
  563. package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts +0 -16
  564. package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts.map +0 -1
  565. package/lib/webrtc/stats/summaryStatsReportGatherer.js +0 -116
  566. package/lib/webrtc/stats/summaryStatsReportGatherer.js.map +0 -1
  567. package/lib/webrtc/stats/trackStatsBuilder.d.ts +0 -19
  568. package/lib/webrtc/stats/trackStatsBuilder.d.ts.map +0 -1
  569. package/lib/webrtc/stats/trackStatsBuilder.js +0 -168
  570. package/lib/webrtc/stats/trackStatsBuilder.js.map +0 -1
  571. package/lib/webrtc/stats/transportStats.d.ts +0 -11
  572. package/lib/webrtc/stats/transportStats.d.ts.map +0 -1
  573. package/lib/webrtc/stats/transportStats.js +0 -1
  574. package/lib/webrtc/stats/transportStats.js.map +0 -1
  575. package/lib/webrtc/stats/transportStatsBuilder.d.ts +0 -5
  576. package/lib/webrtc/stats/transportStatsBuilder.d.ts.map +0 -1
  577. package/lib/webrtc/stats/transportStatsBuilder.js +0 -34
  578. package/lib/webrtc/stats/transportStatsBuilder.js.map +0 -1
  579. package/lib/webrtc/stats/valueFormatter.d.ts +0 -4
  580. package/lib/webrtc/stats/valueFormatter.d.ts.map +0 -1
  581. package/lib/webrtc/stats/valueFormatter.js +0 -25
  582. package/lib/webrtc/stats/valueFormatter.js.map +0 -1
  583. package/src/@types/AESEncryptedSecretStoragePayload.ts +0 -29
  584. package/src/@types/crypto.ts +0 -73
  585. package/src/@types/matrix-sdk-crypto-wasm.d.ts +0 -44
  586. package/src/common-crypto/CryptoBackend.ts +0 -302
  587. package/src/common-crypto/README.md +0 -4
  588. package/src/common-crypto/key-passphrase.ts +0 -43
  589. package/src/crypto/CrossSigning.ts +0 -773
  590. package/src/crypto/DeviceList.ts +0 -989
  591. package/src/crypto/EncryptionSetup.ts +0 -351
  592. package/src/crypto/OlmDevice.ts +0 -1500
  593. package/src/crypto/OutgoingRoomKeyRequestManager.ts +0 -485
  594. package/src/crypto/RoomList.ts +0 -70
  595. package/src/crypto/SecretSharing.ts +0 -240
  596. package/src/crypto/SecretStorage.ts +0 -136
  597. package/src/crypto/aes.ts +0 -23
  598. package/src/crypto/algorithms/base.ts +0 -236
  599. package/src/crypto/algorithms/index.ts +0 -20
  600. package/src/crypto/algorithms/megolm.ts +0 -2216
  601. package/src/crypto/algorithms/olm.ts +0 -381
  602. package/src/crypto/api.ts +0 -70
  603. package/src/crypto/backup.ts +0 -922
  604. package/src/crypto/crypto.ts +0 -18
  605. package/src/crypto/dehydration.ts +0 -272
  606. package/src/crypto/device-converter.ts +0 -45
  607. package/src/crypto/deviceinfo.ts +0 -158
  608. package/src/crypto/index.ts +0 -4418
  609. package/src/crypto/key_passphrase.ts +0 -42
  610. package/src/crypto/keybackup.ts +0 -47
  611. package/src/crypto/olmlib.ts +0 -539
  612. package/src/crypto/recoverykey.ts +0 -18
  613. package/src/crypto/store/base.ts +0 -348
  614. package/src/crypto/store/indexeddb-crypto-store-backend.ts +0 -1250
  615. package/src/crypto/store/indexeddb-crypto-store.ts +0 -845
  616. package/src/crypto/store/localStorage-crypto-store.ts +0 -579
  617. package/src/crypto/store/memory-crypto-store.ts +0 -680
  618. package/src/crypto/verification/Base.ts +0 -409
  619. package/src/crypto/verification/Error.ts +0 -76
  620. package/src/crypto/verification/IllegalMethod.ts +0 -50
  621. package/src/crypto/verification/QRCode.ts +0 -310
  622. package/src/crypto/verification/SAS.ts +0 -494
  623. package/src/crypto/verification/SASDecimal.ts +0 -37
  624. package/src/crypto/verification/request/Channel.ts +0 -34
  625. package/src/crypto/verification/request/InRoomChannel.ts +0 -371
  626. package/src/crypto/verification/request/ToDeviceChannel.ts +0 -354
  627. package/src/crypto/verification/request/VerificationRequest.ts +0 -976
  628. package/src/crypto-api/CryptoEvent.ts +0 -93
  629. package/src/crypto-api/CryptoEventHandlerMap.ts +0 -32
  630. package/src/crypto-api/index.ts +0 -1175
  631. package/src/crypto-api/key-passphrase.ts +0 -58
  632. package/src/crypto-api/keybackup.ts +0 -115
  633. package/src/crypto-api/recovery-key.ts +0 -69
  634. package/src/crypto-api/verification.ts +0 -408
  635. package/src/matrixrtc/CallMembership.ts +0 -247
  636. package/src/matrixrtc/LivekitFocus.ts +0 -39
  637. package/src/matrixrtc/MatrixRTCSession.ts +0 -1319
  638. package/src/matrixrtc/MatrixRTCSessionManager.ts +0 -166
  639. package/src/matrixrtc/focus.ts +0 -25
  640. package/src/matrixrtc/index.ts +0 -22
  641. package/src/matrixrtc/types.ts +0 -36
  642. package/src/rendezvous/MSC4108SignInWithQR.ts +0 -444
  643. package/src/rendezvous/RendezvousChannel.ts +0 -48
  644. package/src/rendezvous/RendezvousCode.ts +0 -25
  645. package/src/rendezvous/RendezvousError.ts +0 -26
  646. package/src/rendezvous/RendezvousFailureReason.ts +0 -49
  647. package/src/rendezvous/RendezvousIntent.ts +0 -20
  648. package/src/rendezvous/RendezvousTransport.ts +0 -58
  649. package/src/rendezvous/channels/MSC4108SecureChannel.ts +0 -270
  650. package/src/rendezvous/channels/index.ts +0 -17
  651. package/src/rendezvous/index.ts +0 -25
  652. package/src/rendezvous/transports/MSC4108RendezvousSession.ts +0 -270
  653. package/src/rendezvous/transports/index.ts +0 -17
  654. package/src/rust-crypto/CrossSigningIdentity.ts +0 -183
  655. package/src/rust-crypto/DehydratedDeviceManager.ts +0 -306
  656. package/src/rust-crypto/KeyClaimManager.ts +0 -86
  657. package/src/rust-crypto/OutgoingRequestProcessor.ts +0 -236
  658. package/src/rust-crypto/OutgoingRequestsManager.ts +0 -143
  659. package/src/rust-crypto/PerSessionKeyBackupDownloader.ts +0 -501
  660. package/src/rust-crypto/RoomEncryptor.ts +0 -352
  661. package/src/rust-crypto/backup.ts +0 -881
  662. package/src/rust-crypto/constants.ts +0 -18
  663. package/src/rust-crypto/device-converter.ts +0 -128
  664. package/src/rust-crypto/index.ts +0 -237
  665. package/src/rust-crypto/libolm_migration.ts +0 -530
  666. package/src/rust-crypto/rust-crypto.ts +0 -2205
  667. package/src/rust-crypto/secret-storage.ts +0 -60
  668. package/src/rust-crypto/verification.ts +0 -830
  669. package/src/secret-storage.ts +0 -693
  670. package/src/utils/decryptAESSecretStorageItem.ts +0 -54
  671. package/src/utils/encryptAESSecretStorageItem.ts +0 -73
  672. package/src/utils/internal/deriveKeys.ts +0 -63
  673. package/src/webrtc/audioContext.ts +0 -44
  674. package/src/webrtc/call.ts +0 -3074
  675. package/src/webrtc/callEventHandler.ts +0 -425
  676. package/src/webrtc/callEventTypes.ts +0 -93
  677. package/src/webrtc/callFeed.ts +0 -364
  678. package/src/webrtc/groupCall.ts +0 -1735
  679. package/src/webrtc/groupCallEventHandler.ts +0 -234
  680. package/src/webrtc/mediaHandler.ts +0 -484
  681. package/src/webrtc/stats/callFeedStatsReporter.ts +0 -94
  682. package/src/webrtc/stats/callStatsReportGatherer.ts +0 -219
  683. package/src/webrtc/stats/callStatsReportSummary.ts +0 -30
  684. package/src/webrtc/stats/connectionStats.ts +0 -47
  685. package/src/webrtc/stats/connectionStatsBuilder.ts +0 -28
  686. package/src/webrtc/stats/connectionStatsReportBuilder.ts +0 -140
  687. package/src/webrtc/stats/groupCallStats.ts +0 -93
  688. package/src/webrtc/stats/media/mediaSsrcHandler.ts +0 -57
  689. package/src/webrtc/stats/media/mediaTrackHandler.ts +0 -76
  690. package/src/webrtc/stats/media/mediaTrackStats.ts +0 -176
  691. package/src/webrtc/stats/media/mediaTrackStatsHandler.ts +0 -90
  692. package/src/webrtc/stats/statsReport.ts +0 -133
  693. package/src/webrtc/stats/statsReportEmitter.ts +0 -49
  694. package/src/webrtc/stats/summaryStatsReportGatherer.ts +0 -148
  695. package/src/webrtc/stats/trackStatsBuilder.ts +0 -207
  696. package/src/webrtc/stats/transportStats.ts +0 -26
  697. package/src/webrtc/stats/transportStatsBuilder.ts +0 -48
  698. package/src/webrtc/stats/valueFormatter.ts +0 -27
@@ -1 +1 @@
1
- {"version":3,"file":"sliding-sync-sdk.js","names":["NotificationCountType","Room","RoomEvent","logger","promiseMapSeries","EventTimeline","ClientEvent","SyncState","_createAndReEmitRoom","defaultClientOpts","defaultSyncApiOpts","MatrixError","ExtensionState","SlidingSyncEvent","SlidingSyncState","EventType","RoomStateEvent","RoomMemberEvent","KnownMembership","FAILED_SYNC_ERROR_THRESHOLD","ExtensionE2EE","constructor","crypto","name","when","PreProcess","onRequest","isInitial","undefined","enabled","onResponse","data","_this","_asyncToGenerator","device_lists","processDeviceLists","processKeyCounts","device_one_time_keys_count","onSyncCompleted","ExtensionToDevice","client","cryptoCallbacks","_defineProperty","extReq","since","nextBatch","_this2","cancelledKeyVerificationTxns","events","length","preprocessToDeviceMessages","map","getEventMapper","toDeviceEvent","getType","txnId","getContent","push","forEach","content","msgtype","log","getSender","includes","flagCancelled","emit","ToDeviceEvent","next_batch","ExtensionAccountData","PostProcess","_this3","global","processGlobalAccountData","roomId","rooms","accountDataEvents","mapEvents","room","getRoom","warn","addAccountData","e","Event","globalAccountData","prevEventsMap","reduce","m","c","store","getAccountData","storeAccountDataEvents","accountDataEvent","PushRules","rules","setPushRules","prevEvent","AccountData","ExtensionTyping","_this4","processEphemeralEvents","ExtensionReceipts","_this5","SlidingSyncSdk","slidingSync","opts","syncOpts","getNotifTimelineSet","reEmitter","reEmit","Timeline","TimelineReset","on","Lifecycle","onLifecycle","bind","RoomData","onRoomData","extensions","ext","registerExtension","roomData","_this6","initial","debug","processRoomData","state","resp","err","Complete","purgeNotifications","lastPos","updateSyncState","Prepared","oldSyncToken","nextSyncToken","pos","catchingUp","fromCache","Syncing","RequestFinished","failCount","Error","Reconnecting","error","shouldAbortSync","syncLeftRooms","peek","stopPeeking","setPresence","presence","getSyncState","syncState","getSyncStateData","_this$syncStateData","syncStateData","createRoom","timelineSupport","getUserId","lazyLoadMembers","pendingEventOrdering","Name","Redaction","RedactionCancelled","Receipt","Tags","LocalEchoUpdated","MyMembership","registerStateListeners","currentState","Events","Members","NewMember","Update","event","member","_this$client$getUser","user","getUser","userId","Typing","PowerLevel","Membership","errcode","stop","_this7","ensureNameEvent","stateEvents","required_state","timelineEvents","timeline","ephemeralEvents","knownEvents","Set","getLiveTimeline","getEvents","add","getId","oldEvents","newEvents","seenKnownEvent","i","recvEvent","has","unshift","addEventsToTimeline","prev_batch","encrypted","hasEncryptionStateEvent","notification_count","setUnreadNotificationCount","Total","highlight_count","getUnreadNotificationCount","Highlight","Number","isInteger","invited_count","setInvitedMemberCount","joined_count","setJoinedMemberCount","invite_state","inviteStateEvents","injectRoomEvents","recalculate","storeRoom","updateMyMembership","Invite","_roomData$prev_batch","setPaginationToken","BACKWARDS","num_live","addEphemeralEvents","Join","addNotifications","processRoomEvent","_ref","isState","RoomEncryption","onCryptoEvent","_x","apply","arguments","decryptCriticalEvents","stateEventList","timelineEventList","numLive","_this8","liveTimeline","timelineWasEmpty","ev","getPushActionsForEvent","initialiseState","oldState","setStateEvents","liveTimelineEvents","slice","addLiveEvents","resolveInvites","resolveInvitesToProfiles","getMembersWithMembership","requestedProfileInfo","promise","Promise","resolve","avatar_url","avatarUrl","displayname","displayName","getProfileInfo","then","info","inviteEvent","membership","setMembershipEvent","_err","retryImmediately","sync","_this9","isGuest","result","getPushRules","pushRules","start","newState","old","Sync","timelineEvent","pushActions","notify","tweaks","highlight","notifEvents","sort","a","b","getTs","_this$client$getNotif","addLiveEvent","stateEvent","type","RoomName","state_key","event_id","sender","origin_server_ts","Date","getTime","decrypt","mapper","room_id","ephEvents"],"sources":["../src/sliding-sync-sdk.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport type { SyncCryptoCallbacks } from \"./common-crypto/CryptoBackend.ts\";\nimport { NotificationCountType, Room, RoomEvent } from \"./models/room.ts\";\nimport { logger } from \"./logger.ts\";\nimport { promiseMapSeries } from \"./utils.ts\";\nimport { EventTimeline } from \"./models/event-timeline.ts\";\nimport { ClientEvent, IStoredClientOpts, MatrixClient } from \"./client.ts\";\nimport {\n ISyncStateData,\n SyncState,\n _createAndReEmitRoom,\n SyncApiOptions,\n defaultClientOpts,\n defaultSyncApiOpts,\n SetPresence,\n} from \"./sync.ts\";\nimport { MatrixEvent } from \"./models/event.ts\";\nimport { Crypto } from \"./crypto/index.ts\";\nimport { IMinimalEvent, IRoomEvent, IStateEvent, IStrippedState, ISyncResponse } from \"./sync-accumulator.ts\";\nimport { MatrixError } from \"./http-api/index.ts\";\nimport {\n Extension,\n ExtensionState,\n MSC3575RoomData,\n MSC3575SlidingSyncResponse,\n SlidingSync,\n SlidingSyncEvent,\n SlidingSyncState,\n} from \"./sliding-sync.ts\";\nimport { EventType } from \"./@types/event.ts\";\nimport { IPushRules } from \"./@types/PushRules.ts\";\nimport { RoomStateEvent } from \"./models/room-state.ts\";\nimport { RoomMemberEvent } from \"./models/room-member.ts\";\nimport { KnownMembership } from \"./@types/membership.ts\";\n\n// Number of consecutive failed syncs that will lead to a syncState of ERROR as opposed\n// to RECONNECTING. This is needed to inform the client of server issues when the\n// keepAlive is successful but the server /sync fails.\nconst FAILED_SYNC_ERROR_THRESHOLD = 3;\n\ntype ExtensionE2EERequest = {\n enabled: boolean;\n};\n\ntype ExtensionE2EEResponse = Pick<\n ISyncResponse,\n | \"device_lists\"\n | \"device_one_time_keys_count\"\n | \"device_unused_fallback_key_types\"\n | \"org.matrix.msc2732.device_unused_fallback_key_types\"\n>;\n\nclass ExtensionE2EE implements Extension<ExtensionE2EERequest, ExtensionE2EEResponse> {\n public constructor(private readonly crypto: Crypto) {}\n\n public name(): string {\n return \"e2ee\";\n }\n\n public when(): ExtensionState {\n return ExtensionState.PreProcess;\n }\n\n public onRequest(isInitial: boolean): ExtensionE2EERequest | undefined {\n if (!isInitial) {\n return undefined;\n }\n return {\n enabled: true, // this is sticky so only send it on the initial request\n };\n }\n\n public async onResponse(data: ExtensionE2EEResponse): Promise<void> {\n // Handle device list updates\n if (data.device_lists) {\n await this.crypto.processDeviceLists(data.device_lists);\n }\n\n // Handle one_time_keys_count and unused_fallback_key_types\n await this.crypto.processKeyCounts(\n data.device_one_time_keys_count,\n data[\"device_unused_fallback_key_types\"] || data[\"org.matrix.msc2732.device_unused_fallback_key_types\"],\n );\n\n this.crypto.onSyncCompleted({});\n }\n}\n\ntype ExtensionToDeviceRequest = {\n since?: string;\n limit?: number;\n enabled?: boolean;\n};\n\ntype ExtensionToDeviceResponse = {\n events: Required<ISyncResponse>[\"to_device\"][\"events\"];\n next_batch: string | null;\n};\n\nclass ExtensionToDevice implements Extension<ExtensionToDeviceRequest, ExtensionToDeviceResponse> {\n private nextBatch: string | null = null;\n\n public constructor(\n private readonly client: MatrixClient,\n private readonly cryptoCallbacks?: SyncCryptoCallbacks,\n ) {}\n\n public name(): string {\n return \"to_device\";\n }\n\n public when(): ExtensionState {\n return ExtensionState.PreProcess;\n }\n\n public onRequest(isInitial: boolean): ExtensionToDeviceRequest {\n const extReq: ExtensionToDeviceRequest = {\n since: this.nextBatch !== null ? this.nextBatch : undefined,\n };\n if (isInitial) {\n extReq[\"limit\"] = 100;\n extReq[\"enabled\"] = true;\n }\n return extReq;\n }\n\n public async onResponse(data: ExtensionToDeviceResponse): Promise<void> {\n const cancelledKeyVerificationTxns: string[] = [];\n let events = data[\"events\"] || [];\n if (events.length > 0 && this.cryptoCallbacks) {\n events = await this.cryptoCallbacks.preprocessToDeviceMessages(events);\n }\n events\n .map(this.client.getEventMapper())\n .map((toDeviceEvent) => {\n // map is a cheap inline forEach\n // We want to flag m.key.verification.start events as cancelled\n // if there's an accompanying m.key.verification.cancel event, so\n // we pull out the transaction IDs from the cancellation events\n // so we can flag the verification events as cancelled in the loop\n // below.\n if (toDeviceEvent.getType() === \"m.key.verification.cancel\") {\n const txnId: string | undefined = toDeviceEvent.getContent()[\"transaction_id\"];\n if (txnId) {\n cancelledKeyVerificationTxns.push(txnId);\n }\n }\n\n // as mentioned above, .map is a cheap inline forEach, so return\n // the unmodified event.\n return toDeviceEvent;\n })\n .forEach((toDeviceEvent) => {\n const content = toDeviceEvent.getContent();\n if (toDeviceEvent.getType() == \"m.room.message\" && content.msgtype == \"m.bad.encrypted\") {\n // the mapper already logged a warning.\n logger.log(\"Ignoring undecryptable to-device event from \" + toDeviceEvent.getSender());\n return;\n }\n\n if (\n toDeviceEvent.getType() === \"m.key.verification.start\" ||\n toDeviceEvent.getType() === \"m.key.verification.request\"\n ) {\n const txnId = content[\"transaction_id\"];\n if (cancelledKeyVerificationTxns.includes(txnId)) {\n toDeviceEvent.flagCancelled();\n }\n }\n\n this.client.emit(ClientEvent.ToDeviceEvent, toDeviceEvent);\n });\n\n this.nextBatch = data.next_batch;\n }\n}\n\ntype ExtensionAccountDataRequest = {\n enabled: boolean;\n};\n\ntype ExtensionAccountDataResponse = {\n global: IMinimalEvent[];\n rooms: Record<string, IMinimalEvent[]>;\n};\n\nclass ExtensionAccountData implements Extension<ExtensionAccountDataRequest, ExtensionAccountDataResponse> {\n public constructor(private readonly client: MatrixClient) {}\n\n public name(): string {\n return \"account_data\";\n }\n\n public when(): ExtensionState {\n return ExtensionState.PostProcess;\n }\n\n public onRequest(isInitial: boolean): ExtensionAccountDataRequest | undefined {\n if (!isInitial) {\n return undefined;\n }\n return {\n enabled: true,\n };\n }\n\n public async onResponse(data: ExtensionAccountDataResponse): Promise<void> {\n if (data.global && data.global.length > 0) {\n this.processGlobalAccountData(data.global);\n }\n\n for (const roomId in data.rooms) {\n const accountDataEvents = mapEvents(this.client, roomId, data.rooms[roomId]);\n const room = this.client.getRoom(roomId);\n if (!room) {\n logger.warn(\"got account data for room but room doesn't exist on client:\", roomId);\n continue;\n }\n room.addAccountData(accountDataEvents);\n accountDataEvents.forEach((e) => {\n this.client.emit(ClientEvent.Event, e);\n });\n }\n }\n\n private processGlobalAccountData(globalAccountData: IMinimalEvent[]): void {\n const events = mapEvents(this.client, undefined, globalAccountData);\n const prevEventsMap = events.reduce<Record<string, MatrixEvent | undefined>>((m, c) => {\n m[c.getType()] = this.client.store.getAccountData(c.getType());\n return m;\n }, {});\n this.client.store.storeAccountDataEvents(events);\n events.forEach((accountDataEvent) => {\n // Honour push rules that come down the sync stream but also\n // honour push rules that were previously cached. Base rules\n // will be updated when we receive push rules via getPushRules\n // (see sync) before syncing over the network.\n if (accountDataEvent.getType() === EventType.PushRules) {\n const rules = accountDataEvent.getContent<IPushRules>();\n this.client.setPushRules(rules);\n }\n const prevEvent = prevEventsMap[accountDataEvent.getType()];\n this.client.emit(ClientEvent.AccountData, accountDataEvent, prevEvent);\n return accountDataEvent;\n });\n }\n}\n\ntype ExtensionTypingRequest = {\n enabled: boolean;\n};\n\ntype ExtensionTypingResponse = {\n rooms: Record<string, IMinimalEvent>;\n};\n\nclass ExtensionTyping implements Extension<ExtensionTypingRequest, ExtensionTypingResponse> {\n public constructor(private readonly client: MatrixClient) {}\n\n public name(): string {\n return \"typing\";\n }\n\n public when(): ExtensionState {\n return ExtensionState.PostProcess;\n }\n\n public onRequest(isInitial: boolean): ExtensionTypingRequest | undefined {\n if (!isInitial) {\n return undefined; // don't send a JSON object for subsequent requests, we don't need to.\n }\n return {\n enabled: true,\n };\n }\n\n public async onResponse(data: ExtensionTypingResponse): Promise<void> {\n if (!data?.rooms) {\n return;\n }\n\n for (const roomId in data.rooms) {\n processEphemeralEvents(this.client, roomId, [data.rooms[roomId]]);\n }\n }\n}\n\ntype ExtensionReceiptsRequest = {\n enabled: boolean;\n};\n\ntype ExtensionReceiptsResponse = {\n rooms: Record<string, IMinimalEvent>;\n};\n\nclass ExtensionReceipts implements Extension<ExtensionReceiptsRequest, ExtensionReceiptsResponse> {\n public constructor(private readonly client: MatrixClient) {}\n\n public name(): string {\n return \"receipts\";\n }\n\n public when(): ExtensionState {\n return ExtensionState.PostProcess;\n }\n\n public onRequest(isInitial: boolean): ExtensionReceiptsRequest | undefined {\n if (isInitial) {\n return {\n enabled: true,\n };\n }\n return undefined; // don't send a JSON object for subsequent requests, we don't need to.\n }\n\n public async onResponse(data: ExtensionReceiptsResponse): Promise<void> {\n if (!data?.rooms) {\n return;\n }\n\n for (const roomId in data.rooms) {\n processEphemeralEvents(this.client, roomId, [data.rooms[roomId]]);\n }\n }\n}\n\n/**\n * A copy of SyncApi such that it can be used as a drop-in replacement for sync v2. For the actual\n * sliding sync API, see sliding-sync.ts or the class SlidingSync.\n */\nexport class SlidingSyncSdk {\n private readonly opts: IStoredClientOpts;\n private readonly syncOpts: SyncApiOptions;\n private syncState: SyncState | null = null;\n private syncStateData?: ISyncStateData;\n private lastPos: string | null = null;\n private failCount = 0;\n private notifEvents: MatrixEvent[] = []; // accumulator of sync events in the current sync response\n\n public constructor(\n private readonly slidingSync: SlidingSync,\n private readonly client: MatrixClient,\n opts?: IStoredClientOpts,\n syncOpts?: SyncApiOptions,\n ) {\n this.opts = defaultClientOpts(opts);\n this.syncOpts = defaultSyncApiOpts(syncOpts);\n\n if (client.getNotifTimelineSet()) {\n client.reEmitter.reEmit(client.getNotifTimelineSet()!, [RoomEvent.Timeline, RoomEvent.TimelineReset]);\n }\n\n this.slidingSync.on(SlidingSyncEvent.Lifecycle, this.onLifecycle.bind(this));\n this.slidingSync.on(SlidingSyncEvent.RoomData, this.onRoomData.bind(this));\n const extensions: Extension<any, any>[] = [\n new ExtensionToDevice(this.client, this.syncOpts.cryptoCallbacks),\n new ExtensionAccountData(this.client),\n new ExtensionTyping(this.client),\n new ExtensionReceipts(this.client),\n ];\n if (this.syncOpts.crypto) {\n extensions.push(new ExtensionE2EE(this.syncOpts.crypto));\n }\n extensions.forEach((ext) => {\n this.slidingSync.registerExtension(ext);\n });\n }\n\n private async onRoomData(roomId: string, roomData: MSC3575RoomData): Promise<void> {\n let room = this.client.store.getRoom(roomId);\n if (!room) {\n if (!roomData.initial) {\n logger.debug(\"initial flag not set but no stored room exists for room \", roomId, roomData);\n return;\n }\n room = _createAndReEmitRoom(this.client, roomId, this.opts);\n }\n await this.processRoomData(this.client, room!, roomData);\n }\n\n private onLifecycle(state: SlidingSyncState, resp: MSC3575SlidingSyncResponse | null, err?: Error): void {\n if (err) {\n logger.debug(\"onLifecycle\", state, err);\n }\n switch (state) {\n case SlidingSyncState.Complete:\n this.purgeNotifications();\n if (!resp) {\n break;\n }\n // Element won't stop showing the initial loading spinner unless we fire SyncState.Prepared\n if (!this.lastPos) {\n this.updateSyncState(SyncState.Prepared, {\n oldSyncToken: undefined,\n nextSyncToken: resp.pos,\n catchingUp: false,\n fromCache: false,\n });\n }\n // Conversely, Element won't show the room list unless there is at least 1x SyncState.Syncing\n // so hence for the very first sync we will fire prepared then immediately syncing.\n this.updateSyncState(SyncState.Syncing, {\n oldSyncToken: this.lastPos!,\n nextSyncToken: resp.pos,\n catchingUp: false,\n fromCache: false,\n });\n this.lastPos = resp.pos;\n break;\n case SlidingSyncState.RequestFinished:\n if (err) {\n this.failCount += 1;\n this.updateSyncState(\n this.failCount > FAILED_SYNC_ERROR_THRESHOLD ? SyncState.Error : SyncState.Reconnecting,\n {\n error: new MatrixError(err),\n },\n );\n if (this.shouldAbortSync(new MatrixError(err))) {\n return; // shouldAbortSync actually stops syncing too so we don't need to do anything.\n }\n } else {\n this.failCount = 0;\n }\n break;\n }\n }\n\n /**\n * Sync rooms the user has left.\n * @returns Resolved when they've been added to the store.\n */\n public async syncLeftRooms(): Promise<Room[]> {\n return []; // TODO\n }\n\n /**\n * Peek into a room. This will result in the room in question being synced so it\n * is accessible via getRooms(). Live updates for the room will be provided.\n * @param roomId - The room ID to peek into.\n * @returns A promise which resolves once the room has been added to the\n * store.\n */\n public async peek(roomId: string): Promise<Room> {\n return null!; // TODO\n }\n\n /**\n * Stop polling for updates in the peeked room. NOPs if there is no room being\n * peeked.\n */\n public stopPeeking(): void {\n // TODO\n }\n\n /**\n * Specify the set_presence value to be used for subsequent calls to the Sync API.\n * @param presence - the presence to specify to set_presence of sync calls\n */\n public setPresence(presence?: SetPresence): void {\n // TODO not possible in sliding sync yet\n }\n\n /**\n * Returns the current state of this sync object\n * @see MatrixClient#event:\"sync\"\n */\n public getSyncState(): SyncState | null {\n return this.syncState;\n }\n\n /**\n * Returns the additional data object associated with\n * the current sync state, or null if there is no\n * such data.\n * Sync errors, if available, are put in the 'error' key of\n * this object.\n */\n public getSyncStateData(): ISyncStateData | null {\n return this.syncStateData ?? null;\n }\n\n // Helper functions which set up JS SDK structs are below and are identical to the sync v2 counterparts\n\n public createRoom(roomId: string): Room {\n // XXX cargoculted from sync.ts\n const { timelineSupport } = this.client;\n const room = new Room(roomId, this.client, this.client.getUserId()!, {\n lazyLoadMembers: this.opts.lazyLoadMembers,\n pendingEventOrdering: this.opts.pendingEventOrdering,\n timelineSupport,\n });\n this.client.reEmitter.reEmit(room, [\n RoomEvent.Name,\n RoomEvent.Redaction,\n RoomEvent.RedactionCancelled,\n RoomEvent.Receipt,\n RoomEvent.Tags,\n RoomEvent.LocalEchoUpdated,\n RoomEvent.AccountData,\n RoomEvent.MyMembership,\n RoomEvent.Timeline,\n RoomEvent.TimelineReset,\n ]);\n this.registerStateListeners(room);\n return room;\n }\n\n private registerStateListeners(room: Room): void {\n // XXX cargoculted from sync.ts\n // we need to also re-emit room state and room member events, so hook it up\n // to the client now. We need to add a listener for RoomState.members in\n // order to hook them correctly.\n this.client.reEmitter.reEmit(room.currentState, [\n RoomStateEvent.Events,\n RoomStateEvent.Members,\n RoomStateEvent.NewMember,\n RoomStateEvent.Update,\n ]);\n room.currentState.on(RoomStateEvent.NewMember, (event, state, member) => {\n member.user = this.client.getUser(member.userId) ?? undefined;\n this.client.reEmitter.reEmit(member, [\n RoomMemberEvent.Name,\n RoomMemberEvent.Typing,\n RoomMemberEvent.PowerLevel,\n RoomMemberEvent.Membership,\n ]);\n });\n }\n\n /*\n private deregisterStateListeners(room: Room): void { // XXX cargoculted from sync.ts\n // could do with a better way of achieving this.\n room.currentState.removeAllListeners(RoomStateEvent.Events);\n room.currentState.removeAllListeners(RoomStateEvent.Members);\n room.currentState.removeAllListeners(RoomStateEvent.NewMember);\n } */\n\n private shouldAbortSync(error: MatrixError): boolean {\n if (error.errcode === \"M_UNKNOWN_TOKEN\") {\n // The logout already happened, we just need to stop.\n logger.warn(\"Token no longer valid - assuming logout\");\n this.stop();\n this.updateSyncState(SyncState.Error, { error });\n return true;\n }\n return false;\n }\n\n private async processRoomData(client: MatrixClient, room: Room, roomData: MSC3575RoomData): Promise<void> {\n roomData = ensureNameEvent(client, room.roomId, roomData);\n const stateEvents = mapEvents(this.client, room.roomId, roomData.required_state);\n // Prevent events from being decrypted ahead of time\n // this helps large account to speed up faster\n // room::decryptCriticalEvent is in charge of decrypting all the events\n // required for a client to function properly\n let timelineEvents = mapEvents(this.client, room.roomId, roomData.timeline, false);\n const ephemeralEvents: MatrixEvent[] = []; // TODO this.mapSyncEventsFormat(joinObj.ephemeral);\n\n // TODO: handle threaded / beacon events\n\n if (roomData.initial) {\n // we should not know about any of these timeline entries if this is a genuinely new room.\n // If we do, then we've effectively done scrollback (e.g requesting timeline_limit: 1 for\n // this room, then timeline_limit: 50).\n const knownEvents = new Set<string>();\n room.getLiveTimeline()\n .getEvents()\n .forEach((e) => {\n knownEvents.add(e.getId()!);\n });\n // all unknown events BEFORE a known event must be scrollback e.g:\n // D E <-- what we know\n // A B C D E F <-- what we just received\n // means:\n // A B C <-- scrollback\n // D E <-- dupes\n // F <-- new event\n // We bucket events based on if we have seen a known event yet.\n const oldEvents: MatrixEvent[] = [];\n const newEvents: MatrixEvent[] = [];\n let seenKnownEvent = false;\n for (let i = timelineEvents.length - 1; i >= 0; i--) {\n const recvEvent = timelineEvents[i];\n if (knownEvents.has(recvEvent.getId()!)) {\n seenKnownEvent = true;\n continue; // don't include this event, it's a dupe\n }\n if (seenKnownEvent) {\n // old -> new\n oldEvents.push(recvEvent);\n } else {\n // old -> new\n newEvents.unshift(recvEvent);\n }\n }\n timelineEvents = newEvents;\n if (oldEvents.length > 0) {\n // old events are scrollback, insert them now\n room.addEventsToTimeline(oldEvents, true, room.getLiveTimeline(), roomData.prev_batch);\n }\n }\n\n const encrypted = room.hasEncryptionStateEvent();\n // we do this first so it's correct when any of the events fire\n if (roomData.notification_count != null) {\n room.setUnreadNotificationCount(NotificationCountType.Total, roomData.notification_count);\n }\n\n if (roomData.highlight_count != null) {\n // We track unread notifications ourselves in encrypted rooms, so don't\n // bother setting it here. We trust our calculations better than the\n // server's for this case, and therefore will assume that our non-zero\n // count is accurate.\n if (!encrypted || (encrypted && room.getUnreadNotificationCount(NotificationCountType.Highlight) <= 0)) {\n room.setUnreadNotificationCount(NotificationCountType.Highlight, roomData.highlight_count);\n }\n }\n\n if (Number.isInteger(roomData.invited_count)) {\n room.currentState.setInvitedMemberCount(roomData.invited_count!);\n }\n if (Number.isInteger(roomData.joined_count)) {\n room.currentState.setJoinedMemberCount(roomData.joined_count!);\n }\n\n if (roomData.invite_state) {\n const inviteStateEvents = mapEvents(this.client, room.roomId, roomData.invite_state);\n await this.injectRoomEvents(room, inviteStateEvents);\n if (roomData.initial) {\n room.recalculate();\n this.client.store.storeRoom(room);\n this.client.emit(ClientEvent.Room, room);\n }\n inviteStateEvents.forEach((e) => {\n this.client.emit(ClientEvent.Event, e);\n });\n room.updateMyMembership(KnownMembership.Invite);\n return;\n }\n\n if (roomData.initial) {\n // set the back-pagination token. Do this *before* adding any\n // events so that clients can start back-paginating.\n room.getLiveTimeline().setPaginationToken(roomData.prev_batch ?? null, EventTimeline.BACKWARDS);\n }\n\n /* TODO\n else if (roomData.limited) {\n\n let limited = true;\n\n // we've got a limited sync, so we *probably* have a gap in the\n // timeline, so should reset. But we might have been peeking or\n // paginating and already have some of the events, in which\n // case we just want to append any subsequent events to the end\n // of the existing timeline.\n //\n // This is particularly important in the case that we already have\n // *all* of the events in the timeline - in that case, if we reset\n // the timeline, we'll end up with an entirely empty timeline,\n // which we'll try to paginate but not get any new events (which\n // will stop us linking the empty timeline into the chain).\n //\n for (let i = timelineEvents.length - 1; i >= 0; i--) {\n const eventId = timelineEvents[i].getId();\n if (room.getTimelineForEvent(eventId)) {\n logger.debug(\"Already have event \" + eventId + \" in limited \" +\n \"sync - not resetting\");\n limited = false;\n\n // we might still be missing some of the events before i;\n // we don't want to be adding them to the end of the\n // timeline because that would put them out of order.\n timelineEvents.splice(0, i);\n\n // XXX: there's a problem here if the skipped part of the\n // timeline modifies the state set in stateEvents, because\n // we'll end up using the state from stateEvents rather\n // than the later state from timelineEvents. We probably\n // need to wind stateEvents forward over the events we're\n // skipping.\n break;\n }\n }\n\n if (limited) {\n room.resetLiveTimeline(\n roomData.prev_batch,\n null, // TODO this.syncOpts.canResetEntireTimeline(room.roomId) ? null : syncEventData.oldSyncToken,\n );\n\n // We have to assume any gap in any timeline is\n // reason to stop incrementally tracking notifications and\n // reset the timeline.\n this.client.resetNotifTimelineSet();\n this.registerStateListeners(room);\n }\n } */\n\n await this.injectRoomEvents(room, stateEvents, timelineEvents, roomData.num_live);\n\n // we deliberately don't add ephemeral events to the timeline\n room.addEphemeralEvents(ephemeralEvents);\n\n // local fields must be set before any async calls because call site assumes\n // synchronous execution prior to emitting SlidingSyncState.Complete\n room.updateMyMembership(KnownMembership.Join);\n\n room.recalculate();\n if (roomData.initial) {\n client.store.storeRoom(room);\n client.emit(ClientEvent.Room, room);\n }\n\n // check if any timeline events should bing and add them to the notifEvents array:\n // we'll purge this once we've fully processed the sync response\n this.addNotifications(timelineEvents);\n\n const processRoomEvent = async (e: MatrixEvent): Promise<void> => {\n client.emit(ClientEvent.Event, e);\n if (e.isState() && e.getType() == EventType.RoomEncryption && this.syncOpts.cryptoCallbacks) {\n await this.syncOpts.cryptoCallbacks.onCryptoEvent(room, e);\n }\n };\n\n await promiseMapSeries(stateEvents, processRoomEvent);\n await promiseMapSeries(timelineEvents, processRoomEvent);\n ephemeralEvents.forEach(function (e) {\n client.emit(ClientEvent.Event, e);\n });\n\n // Decrypt only the last message in all rooms to make sure we can generate a preview\n // And decrypt all events after the recorded read receipt to ensure an accurate\n // notification count\n room.decryptCriticalEvents();\n }\n\n /**\n * Injects events into a room's model.\n * @param stateEventList - A list of state events. This is the state\n * at the *START* of the timeline list if it is supplied.\n * @param timelineEventList - A list of timeline events. Lower index\n * is earlier in time. Higher index is later.\n * @param numLive - the number of events in timelineEventList which just happened,\n * supplied from the server.\n */\n public async injectRoomEvents(\n room: Room,\n stateEventList: MatrixEvent[],\n timelineEventList?: MatrixEvent[],\n numLive?: number,\n ): Promise<void> {\n timelineEventList = timelineEventList || [];\n stateEventList = stateEventList || [];\n numLive = numLive || 0;\n\n // If there are no events in the timeline yet, initialise it with\n // the given state events\n const liveTimeline = room.getLiveTimeline();\n const timelineWasEmpty = liveTimeline.getEvents().length == 0;\n if (timelineWasEmpty) {\n // Passing these events into initialiseState will freeze them, so we need\n // to compute and cache the push actions for them now, otherwise sync dies\n // with an attempt to assign to read only property.\n // XXX: This is pretty horrible and is assuming all sorts of behaviour from\n // these functions that it shouldn't be. We should probably either store the\n // push actions cache elsewhere so we can freeze MatrixEvents, or otherwise\n // find some solution where MatrixEvents are immutable but allow for a cache\n // field.\n for (const ev of stateEventList) {\n this.client.getPushActionsForEvent(ev);\n }\n liveTimeline.initialiseState(stateEventList);\n }\n\n // If the timeline wasn't empty, we process the state events here: they're\n // defined as updates to the state before the start of the timeline, so this\n // starts to roll the state forward.\n // XXX: That's what we *should* do, but this can happen if we were previously\n // peeking in a room, in which case we obviously do *not* want to add the\n // state events here onto the end of the timeline. Historically, the js-sdk\n // has just set these new state events on the old and new state. This seems\n // very wrong because there could be events in the timeline that diverge the\n // state, in which case this is going to leave things out of sync. However,\n // for now I think it;s best to behave the same as the code has done previously.\n if (!timelineWasEmpty) {\n // XXX: As above, don't do this...\n //room.addLiveEvents(stateEventList || []);\n // Do this instead...\n room.oldState.setStateEvents(stateEventList);\n room.currentState.setStateEvents(stateEventList);\n }\n\n // the timeline is broken into 'live' events which just happened and normal timeline events\n // which are still to be appended to the end of the live timeline but happened a while ago.\n // The live events are marked as fromCache=false to ensure that downstream components know\n // this is a live event, not historical (from a remote server cache).\n\n let liveTimelineEvents: MatrixEvent[] = [];\n if (numLive > 0) {\n // last numLive events are live\n liveTimelineEvents = timelineEventList.slice(-1 * numLive);\n // everything else is not live\n timelineEventList = timelineEventList.slice(0, -1 * liveTimelineEvents.length);\n }\n\n // execute the timeline events. This will continue to diverge the current state\n // if the timeline has any state events in it.\n // This also needs to be done before running push rules on the events as they need\n // to be decorated with sender etc.\n await room.addLiveEvents(timelineEventList, {\n fromCache: true,\n });\n if (liveTimelineEvents.length > 0) {\n await room.addLiveEvents(liveTimelineEvents, {\n fromCache: false,\n });\n }\n\n room.recalculate();\n\n // resolve invites now we have set the latest state\n this.resolveInvites(room);\n }\n\n private resolveInvites(room: Room): void {\n if (!room || !this.opts.resolveInvitesToProfiles) {\n return;\n }\n const client = this.client;\n // For each invited room member we want to give them a displayname/avatar url\n // if they have one (the m.room.member invites don't contain this).\n room.getMembersWithMembership(KnownMembership.Invite).forEach(function (member) {\n if (member.requestedProfileInfo) return;\n member.requestedProfileInfo = true;\n // try to get a cached copy first.\n const user = client.getUser(member.userId);\n let promise: ReturnType<MatrixClient[\"getProfileInfo\"]>;\n if (user) {\n promise = Promise.resolve({\n avatar_url: user.avatarUrl,\n displayname: user.displayName,\n });\n } else {\n promise = client.getProfileInfo(member.userId);\n }\n promise.then(\n function (info) {\n // slightly naughty by doctoring the invite event but this means all\n // the code paths remain the same between invite/join display name stuff\n // which is a worthy trade-off for some minor pollution.\n const inviteEvent = member.events.member!;\n if (inviteEvent.getContent().membership !== KnownMembership.Invite) {\n // between resolving and now they have since joined, so don't clobber\n return;\n }\n inviteEvent.getContent().avatar_url = info.avatar_url;\n inviteEvent.getContent().displayname = info.displayname;\n // fire listeners\n member.setMembershipEvent(inviteEvent, room.currentState);\n },\n function (_err) {\n // OH WELL.\n },\n );\n });\n }\n\n public retryImmediately(): boolean {\n return true;\n }\n\n /**\n * Main entry point. Blocks until stop() is called.\n */\n public async sync(): Promise<void> {\n logger.debug(\"Sliding sync init loop\");\n\n // 1) We need to get push rules so we can check if events should bing as we get\n // them from /sync.\n while (!this.client.isGuest()) {\n try {\n logger.debug(\"Getting push rules...\");\n const result = await this.client.getPushRules();\n logger.debug(\"Got push rules\");\n this.client.pushRules = result;\n break;\n } catch (err) {\n logger.error(\"Getting push rules failed\", err);\n if (this.shouldAbortSync(<MatrixError>err)) {\n return;\n }\n }\n }\n\n // start syncing\n await this.slidingSync.start();\n }\n\n /**\n * Stops the sync object from syncing.\n */\n public stop(): void {\n logger.debug(\"SyncApi.stop\");\n this.slidingSync.stop();\n }\n\n /**\n * Sets the sync state and emits an event to say so\n * @param newState - The new state string\n * @param data - Object of additional data to emit in the event\n */\n private updateSyncState(newState: SyncState, data?: ISyncStateData): void {\n const old = this.syncState;\n this.syncState = newState;\n this.syncStateData = data;\n this.client.emit(ClientEvent.Sync, this.syncState, old, data);\n }\n\n /**\n * Takes a list of timelineEvents and adds and adds to notifEvents\n * as appropriate.\n * This must be called after the room the events belong to has been stored.\n *\n * @param timelineEventList - A list of timeline events. Lower index\n * is earlier in time. Higher index is later.\n */\n private addNotifications(timelineEventList: MatrixEvent[]): void {\n // gather our notifications into this.notifEvents\n if (!this.client.getNotifTimelineSet()) {\n return;\n }\n for (const timelineEvent of timelineEventList) {\n const pushActions = this.client.getPushActionsForEvent(timelineEvent);\n if (pushActions && pushActions.notify && pushActions.tweaks && pushActions.tweaks.highlight) {\n this.notifEvents.push(timelineEvent);\n }\n }\n }\n\n /**\n * Purge any events in the notifEvents array. Used after a /sync has been complete.\n * This should not be called at a per-room scope (e.g in onRoomData) because otherwise the ordering\n * will be messed up e.g room A gets a bing, room B gets a newer bing, but both in the same /sync\n * response. If we purge at a per-room scope then we could process room B before room A leading to\n * room B appearing earlier in the notifications timeline, even though it has the higher origin_server_ts.\n */\n private purgeNotifications(): void {\n this.notifEvents.sort(function (a, b) {\n return a.getTs() - b.getTs();\n });\n this.notifEvents.forEach((event) => {\n this.client.getNotifTimelineSet()?.addLiveEvent(event);\n });\n this.notifEvents = [];\n }\n}\n\nfunction ensureNameEvent(client: MatrixClient, roomId: string, roomData: MSC3575RoomData): MSC3575RoomData {\n // make sure m.room.name is in required_state if there is a name, replacing anything previously\n // there if need be. This ensures clients transparently 'calculate' the right room name. Native\n // sliding sync clients should just read the \"name\" field.\n if (!roomData.name) {\n return roomData;\n }\n for (const stateEvent of roomData.required_state) {\n if (stateEvent.type === EventType.RoomName && stateEvent.state_key === \"\") {\n stateEvent.content = {\n name: roomData.name,\n };\n return roomData;\n }\n }\n roomData.required_state.push({\n event_id: \"$fake-sliding-sync-name-event-\" + roomId,\n state_key: \"\",\n type: EventType.RoomName,\n content: {\n name: roomData.name,\n },\n sender: client.getUserId()!,\n origin_server_ts: new Date().getTime(),\n });\n return roomData;\n}\n\ntype TaggedEvent = (IStrippedState | IRoomEvent | IStateEvent | IMinimalEvent) & { room_id?: string };\n\n// Helper functions which set up JS SDK structs are below and are identical to the sync v2 counterparts,\n// just outside the class.\nfunction mapEvents(client: MatrixClient, roomId: string | undefined, events: object[], decrypt = true): MatrixEvent[] {\n const mapper = client.getEventMapper({ decrypt });\n return (events as TaggedEvent[]).map(function (e) {\n e.room_id = roomId;\n return mapper(e);\n });\n}\n\nfunction processEphemeralEvents(client: MatrixClient, roomId: string, ephEvents: IMinimalEvent[]): void {\n const ephemeralEvents = mapEvents(client, roomId, ephEvents);\n const room = client.getRoom(roomId);\n if (!room) {\n logger.warn(\"got ephemeral events for room but room doesn't exist on client:\", roomId);\n return;\n }\n room.addEphemeralEvents(ephemeralEvents);\n ephemeralEvents.forEach((e) => {\n client.emit(ClientEvent.Event, e);\n });\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,qBAAqB,EAAEC,IAAI,EAAEC,SAAS,QAAQ,kBAAkB;AACzE,SAASC,MAAM,QAAQ,aAAa;AACpC,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,WAAW,QAAyC,aAAa;AAC1E,SAEIC,SAAS,EACTC,oBAAoB,EAEpBC,iBAAiB,EACjBC,kBAAkB,QAEf,WAAW;AAIlB,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAEIC,cAAc,EAIdC,gBAAgB,EAChBC,gBAAgB,QACb,mBAAmB;AAC1B,SAASC,SAAS,QAAQ,mBAAmB;AAE7C,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,eAAe,QAAQ,wBAAwB;;AAExD;AACA;AACA;AACA,IAAMC,2BAA2B,GAAG,CAAC;AAcrC,MAAMC,aAAa,CAAmE;EAC3EC,WAAWA,CAAkBC,MAAc,EAAE;IAAA,KAAhBA,MAAc,GAAdA,MAAc;EAAG;EAE9CC,IAAIA,CAAA,EAAW;IAClB,OAAO,MAAM;EACjB;EAEOC,IAAIA,CAAA,EAAmB;IAC1B,OAAOZ,cAAc,CAACa,UAAU;EACpC;EAEOC,SAASA,CAACC,SAAkB,EAAoC;IACnE,IAAI,CAACA,SAAS,EAAE;MACZ,OAAOC,SAAS;IACpB;IACA,OAAO;MACHC,OAAO,EAAE,IAAI,CAAE;IACnB,CAAC;EACL;EAEaC,UAAUA,CAACC,IAA2B,EAAiB;IAAA,IAAAC,KAAA;IAAA,OAAAC,iBAAA;MAChE;MACA,IAAIF,IAAI,CAACG,YAAY,EAAE;QACnB,MAAM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,CAAC;IAAE+P;EAAQ,CAAC,CAAC;EACjD,OAAQnQ,MAAM,CAAmBG,GAAG,CAAC,UAAU8B,CAAC,EAAE;IAC9CA,CAAC,CAACoO,OAAO,GAAG5O,MAAM;IAClB,OAAO2O,MAAM,CAACnO,CAAC,CAAC;EACpB,CAAC,CAAC;AACN;AAEA,SAASkB,sBAAsBA,CAAC3D,MAAoB,EAAEiC,MAAc,EAAE6O,SAA0B,EAAQ;EACpG,IAAMxH,eAAe,GAAGlH,SAAS,CAACpC,MAAM,EAAEiC,MAAM,EAAE6O,SAAS,CAAC;EAC5D,IAAMzO,IAAI,GAAGrC,MAAM,CAACsC,OAAO,CAACL,MAAM,CAAC;EACnC,IAAI,CAACI,IAAI,EAAE;IACP1E,MAAM,CAAC4E,IAAI,CAAC,iEAAiE,EAAEN,MAAM,CAAC;IACtF;EACJ;EACAI,IAAI,CAAC0J,kBAAkB,CAACzC,eAAe,CAAC;EACxCA,eAAe,CAACpI,OAAO,CAAEuB,CAAC,IAAK;IAC3BzC,MAAM,CAACyB,IAAI,CAAC3D,WAAW,CAAC4E,KAAK,EAAED,CAAC,CAAC;EACrC,CAAC,CAAC;AACN","ignoreList":[]}
1
+ {"version":3,"file":"sliding-sync-sdk.js","names":["NotificationCountType","Room","RoomEvent","logger","promiseMapSeries","EventTimeline","ClientEvent","SyncState","_createAndReEmitRoom","defaultClientOpts","MatrixError","ExtensionState","SlidingSyncEvent","SlidingSyncState","EventType","RoomStateEvent","RoomMemberEvent","KnownMembership","FAILED_SYNC_ERROR_THRESHOLD","ExtensionToDevice","constructor","client","_defineProperty","name","when","PreProcess","onRequest","isInitial","extReq","since","nextBatch","undefined","onResponse","data","_this","_asyncToGenerator","cancelledKeyVerificationTxns","events","map","getEventMapper","toDeviceEvent","getType","txnId","getContent","push","forEach","content","msgtype","log","getSender","includes","flagCancelled","emit","ToDeviceEvent","next_batch","ExtensionAccountData","PostProcess","enabled","_this2","global","length","processGlobalAccountData","roomId","rooms","accountDataEvents","mapEvents","room","getRoom","warn","addAccountData","e","Event","globalAccountData","prevEventsMap","reduce","m","c","store","getAccountData","storeAccountDataEvents","accountDataEvent","PushRules","rules","setPushRules","prevEvent","AccountData","ExtensionTyping","_this3","processEphemeralEvents","ExtensionReceipts","_this4","SlidingSyncSdk","slidingSync","opts","getNotifTimelineSet","reEmitter","reEmit","Timeline","TimelineReset","on","Lifecycle","onLifecycle","bind","RoomData","onRoomData","extensions","ext","registerExtension","roomData","_this5","initial","debug","processRoomData","state","resp","err","Complete","purgeNotifications","lastPos","updateSyncState","Prepared","oldSyncToken","nextSyncToken","pos","catchingUp","fromCache","Syncing","RequestFinished","failCount","Error","Reconnecting","error","shouldAbortSync","syncLeftRooms","peek","stopPeeking","setPresence","presence","getSyncState","syncState","getSyncStateData","_this$syncStateData","syncStateData","createRoom","timelineSupport","getUserId","lazyLoadMembers","pendingEventOrdering","Name","Redaction","RedactionCancelled","Receipt","Tags","LocalEchoUpdated","MyMembership","registerStateListeners","currentState","Events","Members","NewMember","Update","event","member","_this$client$getUser","user","getUser","userId","Typing","PowerLevel","Membership","errcode","stop","_this6","ensureNameEvent","stateEvents","required_state","timelineEvents","timeline","ephemeralEvents","knownEvents","Set","getLiveTimeline","getEvents","add","getId","oldEvents","newEvents","seenKnownEvent","i","recvEvent","has","unshift","addEventsToTimeline","prev_batch","encrypted","hasEncryptionStateEvent","notification_count","setUnreadNotificationCount","Total","highlight_count","getUnreadNotificationCount","Highlight","Number","isInteger","invited_count","setInvitedMemberCount","joined_count","setJoinedMemberCount","invite_state","inviteStateEvents","injectRoomEvents","recalculate","storeRoom","updateMyMembership","Invite","_roomData$prev_batch","setPaginationToken","BACKWARDS","num_live","addEphemeralEvents","Join","addNotifications","processRoomEvent","_ref","_x","apply","arguments","stateEventList","_arguments","_this7","timelineEventList","numLive","liveTimeline","timelineWasEmpty","ev","getPushActionsForEvent","initialiseState","oldState","setStateEvents","liveTimelineEvents","slice","addLiveEvents","addToState","resolveInvites","resolveInvitesToProfiles","getMembersWithMembership","requestedProfileInfo","promise","Promise","resolve","avatar_url","avatarUrl","displayname","displayName","getProfileInfo","then","info","inviteEvent","membership","setMembershipEvent","_err","retryImmediately","sync","_this8","isGuest","result","getPushRules","pushRules","start","newState","old","Sync","timelineEvent","pushActions","notify","tweaks","highlight","notifEvents","sort","a","b","getTs","_this$client$getNotif","addLiveEvent","stateEvent","type","RoomName","state_key","event_id","sender","origin_server_ts","Date","getTime","decrypt","mapper","room_id","ephEvents"],"sources":["../src/sliding-sync-sdk.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { NotificationCountType, Room, RoomEvent } from \"./models/room.ts\";\nimport { logger } from \"./logger.ts\";\nimport { promiseMapSeries } from \"./utils.ts\";\nimport { EventTimeline } from \"./models/event-timeline.ts\";\nimport { ClientEvent, IStoredClientOpts, MatrixClient } from \"./client.ts\";\nimport {\n ISyncStateData,\n SyncState,\n _createAndReEmitRoom,\n defaultClientOpts,\n SetPresence,\n} from \"./sync.ts\";\nimport { MatrixEvent } from \"./models/event.ts\";\nimport { IMinimalEvent, IRoomEvent, IStateEvent, IStrippedState, ISyncResponse } from \"./sync-accumulator.ts\";\nimport { MatrixError } from \"./http-api/index.ts\";\nimport {\n Extension,\n ExtensionState,\n MSC3575RoomData,\n MSC3575SlidingSyncResponse,\n SlidingSync,\n SlidingSyncEvent,\n SlidingSyncState,\n} from \"./sliding-sync.ts\";\nimport { EventType } from \"./@types/event.ts\";\nimport { IPushRules } from \"./@types/PushRules.ts\";\nimport { RoomStateEvent } from \"./models/room-state.ts\";\nimport { RoomMemberEvent } from \"./models/room-member.ts\";\nimport { KnownMembership } from \"./@types/membership.ts\";\n\n// Number of consecutive failed syncs that will lead to a syncState of ERROR as opposed\n// to RECONNECTING. This is needed to inform the client of server issues when the\n// keepAlive is successful but the server /sync fails.\nconst FAILED_SYNC_ERROR_THRESHOLD = 3;\n\ntype ExtensionToDeviceRequest = {\n since?: string;\n limit?: number;\n enabled?: boolean;\n};\n\ntype ExtensionToDeviceResponse = {\n events: Required<ISyncResponse>[\"to_device\"][\"events\"];\n next_batch: string | null;\n};\n\nclass ExtensionToDevice implements Extension<ExtensionToDeviceRequest, ExtensionToDeviceResponse> {\n private nextBatch: string | null = null;\n\n public constructor(\n private readonly client: MatrixClient,\n ) {}\n\n public name(): string {\n return \"to_device\";\n }\n\n public when(): ExtensionState {\n return ExtensionState.PreProcess;\n }\n\n public onRequest(isInitial: boolean): ExtensionToDeviceRequest {\n const extReq: ExtensionToDeviceRequest = {\n since: this.nextBatch !== null ? this.nextBatch : undefined,\n };\n if (isInitial) {\n extReq[\"limit\"] = 100;\n extReq[\"enabled\"] = true;\n }\n return extReq;\n }\n\n public async onResponse(data: ExtensionToDeviceResponse): Promise<void> {\n const cancelledKeyVerificationTxns: string[] = [];\n const events = data[\"events\"] || [];\n events\n .map(this.client.getEventMapper())\n .map((toDeviceEvent) => {\n // map is a cheap inline forEach\n // We want to flag m.key.verification.start events as cancelled\n // if there's an accompanying m.key.verification.cancel event, so\n // we pull out the transaction IDs from the cancellation events\n // so we can flag the verification events as cancelled in the loop\n // below.\n if (toDeviceEvent.getType() === \"m.key.verification.cancel\") {\n const txnId: string | undefined = toDeviceEvent.getContent()[\"transaction_id\"];\n if (txnId) {\n cancelledKeyVerificationTxns.push(txnId);\n }\n }\n\n // as mentioned above, .map is a cheap inline forEach, so return\n // the unmodified event.\n return toDeviceEvent;\n })\n .forEach((toDeviceEvent) => {\n const content = toDeviceEvent.getContent();\n if (toDeviceEvent.getType() == \"m.room.message\" && content.msgtype == \"m.bad.encrypted\") {\n // the mapper already logged a warning.\n logger.log(\"Ignoring undecryptable to-device event from \" + toDeviceEvent.getSender());\n return;\n }\n\n if (\n toDeviceEvent.getType() === \"m.key.verification.start\" ||\n toDeviceEvent.getType() === \"m.key.verification.request\"\n ) {\n const txnId = content[\"transaction_id\"];\n if (cancelledKeyVerificationTxns.includes(txnId)) {\n toDeviceEvent.flagCancelled();\n }\n }\n\n this.client.emit(ClientEvent.ToDeviceEvent, toDeviceEvent);\n });\n\n this.nextBatch = data.next_batch;\n }\n}\n\ntype ExtensionAccountDataRequest = {\n enabled: boolean;\n};\n\ntype ExtensionAccountDataResponse = {\n global: IMinimalEvent[];\n rooms: Record<string, IMinimalEvent[]>;\n};\n\nclass ExtensionAccountData implements Extension<ExtensionAccountDataRequest, ExtensionAccountDataResponse> {\n public constructor(private readonly client: MatrixClient) {}\n\n public name(): string {\n return \"account_data\";\n }\n\n public when(): ExtensionState {\n return ExtensionState.PostProcess;\n }\n\n public onRequest(isInitial: boolean): ExtensionAccountDataRequest | undefined {\n if (!isInitial) {\n return undefined;\n }\n return {\n enabled: true,\n };\n }\n\n public async onResponse(data: ExtensionAccountDataResponse): Promise<void> {\n if (data.global && data.global.length > 0) {\n this.processGlobalAccountData(data.global);\n }\n\n for (const roomId in data.rooms) {\n const accountDataEvents = mapEvents(this.client, roomId, data.rooms[roomId]);\n const room = this.client.getRoom(roomId);\n if (!room) {\n logger.warn(\"got account data for room but room doesn't exist on client:\", roomId);\n continue;\n }\n room.addAccountData(accountDataEvents);\n accountDataEvents.forEach((e) => {\n this.client.emit(ClientEvent.Event, e);\n });\n }\n }\n\n private processGlobalAccountData(globalAccountData: IMinimalEvent[]): void {\n const events = mapEvents(this.client, undefined, globalAccountData);\n const prevEventsMap = events.reduce<Record<string, MatrixEvent | undefined>>((m, c) => {\n m[c.getType()] = this.client.store.getAccountData(c.getType());\n return m;\n }, {});\n this.client.store.storeAccountDataEvents(events);\n events.forEach((accountDataEvent) => {\n // Honour push rules that come down the sync stream but also\n // honour push rules that were previously cached. Base rules\n // will be updated when we receive push rules via getPushRules\n // (see sync) before syncing over the network.\n if (accountDataEvent.getType() === EventType.PushRules) {\n const rules = accountDataEvent.getContent<IPushRules>();\n this.client.setPushRules(rules);\n }\n const prevEvent = prevEventsMap[accountDataEvent.getType()];\n this.client.emit(ClientEvent.AccountData, accountDataEvent, prevEvent);\n return accountDataEvent;\n });\n }\n}\n\ntype ExtensionTypingRequest = {\n enabled: boolean;\n};\n\ntype ExtensionTypingResponse = {\n rooms: Record<string, IMinimalEvent>;\n};\n\nclass ExtensionTyping implements Extension<ExtensionTypingRequest, ExtensionTypingResponse> {\n public constructor(private readonly client: MatrixClient) {}\n\n public name(): string {\n return \"typing\";\n }\n\n public when(): ExtensionState {\n return ExtensionState.PostProcess;\n }\n\n public onRequest(isInitial: boolean): ExtensionTypingRequest | undefined {\n if (!isInitial) {\n return undefined; // don't send a JSON object for subsequent requests, we don't need to.\n }\n return {\n enabled: true,\n };\n }\n\n public async onResponse(data: ExtensionTypingResponse): Promise<void> {\n if (!data?.rooms) {\n return;\n }\n\n for (const roomId in data.rooms) {\n processEphemeralEvents(this.client, roomId, [data.rooms[roomId]]);\n }\n }\n}\n\ntype ExtensionReceiptsRequest = {\n enabled: boolean;\n};\n\ntype ExtensionReceiptsResponse = {\n rooms: Record<string, IMinimalEvent>;\n};\n\nclass ExtensionReceipts implements Extension<ExtensionReceiptsRequest, ExtensionReceiptsResponse> {\n public constructor(private readonly client: MatrixClient) {}\n\n public name(): string {\n return \"receipts\";\n }\n\n public when(): ExtensionState {\n return ExtensionState.PostProcess;\n }\n\n public onRequest(isInitial: boolean): ExtensionReceiptsRequest | undefined {\n if (isInitial) {\n return {\n enabled: true,\n };\n }\n return undefined; // don't send a JSON object for subsequent requests, we don't need to.\n }\n\n public async onResponse(data: ExtensionReceiptsResponse): Promise<void> {\n if (!data?.rooms) {\n return;\n }\n\n for (const roomId in data.rooms) {\n processEphemeralEvents(this.client, roomId, [data.rooms[roomId]]);\n }\n }\n}\n\n/**\n * A copy of SyncApi such that it can be used as a drop-in replacement for sync v2. For the actual\n * sliding sync API, see sliding-sync.ts or the class SlidingSync.\n */\nexport class SlidingSyncSdk {\n private readonly opts: IStoredClientOpts;\n private syncState: SyncState | null = null;\n private syncStateData?: ISyncStateData;\n private lastPos: string | null = null;\n private failCount = 0;\n private notifEvents: MatrixEvent[] = []; // accumulator of sync events in the current sync response\n\n public constructor(\n private readonly slidingSync: SlidingSync,\n private readonly client: MatrixClient,\n opts?: IStoredClientOpts,\n ) {\n this.opts = defaultClientOpts(opts);\n\n if (client.getNotifTimelineSet()) {\n client.reEmitter.reEmit(client.getNotifTimelineSet()!, [RoomEvent.Timeline, RoomEvent.TimelineReset]);\n }\n\n this.slidingSync.on(SlidingSyncEvent.Lifecycle, this.onLifecycle.bind(this));\n this.slidingSync.on(SlidingSyncEvent.RoomData, this.onRoomData.bind(this));\n const extensions: Extension<any, any>[] = [\n new ExtensionToDevice(this.client),\n new ExtensionAccountData(this.client),\n new ExtensionTyping(this.client),\n new ExtensionReceipts(this.client),\n ];\n extensions.forEach((ext) => {\n this.slidingSync.registerExtension(ext);\n });\n }\n\n private async onRoomData(roomId: string, roomData: MSC3575RoomData): Promise<void> {\n let room = this.client.store.getRoom(roomId);\n if (!room) {\n if (!roomData.initial) {\n logger.debug(\"initial flag not set but no stored room exists for room \", roomId, roomData);\n return;\n }\n room = _createAndReEmitRoom(this.client, roomId, this.opts);\n }\n await this.processRoomData(this.client, room!, roomData);\n }\n\n private onLifecycle(state: SlidingSyncState, resp: MSC3575SlidingSyncResponse | null, err?: Error): void {\n if (err) {\n logger.debug(\"onLifecycle\", state, err);\n }\n switch (state) {\n case SlidingSyncState.Complete:\n this.purgeNotifications();\n if (!resp) {\n break;\n }\n // Element won't stop showing the initial loading spinner unless we fire SyncState.Prepared\n if (!this.lastPos) {\n this.updateSyncState(SyncState.Prepared, {\n oldSyncToken: undefined,\n nextSyncToken: resp.pos,\n catchingUp: false,\n fromCache: false,\n });\n }\n // Conversely, Element won't show the room list unless there is at least 1x SyncState.Syncing\n // so hence for the very first sync we will fire prepared then immediately syncing.\n this.updateSyncState(SyncState.Syncing, {\n oldSyncToken: this.lastPos!,\n nextSyncToken: resp.pos,\n catchingUp: false,\n fromCache: false,\n });\n this.lastPos = resp.pos;\n break;\n case SlidingSyncState.RequestFinished:\n if (err) {\n this.failCount += 1;\n this.updateSyncState(\n this.failCount > FAILED_SYNC_ERROR_THRESHOLD ? SyncState.Error : SyncState.Reconnecting,\n {\n error: new MatrixError(err),\n },\n );\n if (this.shouldAbortSync(new MatrixError(err))) {\n return; // shouldAbortSync actually stops syncing too so we don't need to do anything.\n }\n } else {\n this.failCount = 0;\n }\n break;\n }\n }\n\n /**\n * Sync rooms the user has left.\n * @returns Resolved when they've been added to the store.\n */\n public async syncLeftRooms(): Promise<Room[]> {\n return []; // TODO\n }\n\n /**\n * Peek into a room. This will result in the room in question being synced so it\n * is accessible via getRooms(). Live updates for the room will be provided.\n * @param roomId - The room ID to peek into.\n * @returns A promise which resolves once the room has been added to the\n * store.\n */\n public async peek(roomId: string): Promise<Room> {\n return null!; // TODO\n }\n\n /**\n * Stop polling for updates in the peeked room. NOPs if there is no room being\n * peeked.\n */\n public stopPeeking(): void {\n // TODO\n }\n\n /**\n * Specify the set_presence value to be used for subsequent calls to the Sync API.\n * @param presence - the presence to specify to set_presence of sync calls\n */\n public setPresence(presence?: SetPresence): void {\n // TODO not possible in sliding sync yet\n }\n\n /**\n * Returns the current state of this sync object\n * @see MatrixClient#event:\"sync\"\n */\n public getSyncState(): SyncState | null {\n return this.syncState;\n }\n\n /**\n * Returns the additional data object associated with\n * the current sync state, or null if there is no\n * such data.\n * Sync errors, if available, are put in the 'error' key of\n * this object.\n */\n public getSyncStateData(): ISyncStateData | null {\n return this.syncStateData ?? null;\n }\n\n // Helper functions which set up JS SDK structs are below and are identical to the sync v2 counterparts\n\n public createRoom(roomId: string): Room {\n // XXX cargoculted from sync.ts\n const { timelineSupport } = this.client;\n const room = new Room(roomId, this.client, this.client.getUserId()!, {\n lazyLoadMembers: this.opts.lazyLoadMembers,\n pendingEventOrdering: this.opts.pendingEventOrdering,\n timelineSupport,\n });\n this.client.reEmitter.reEmit(room, [\n RoomEvent.Name,\n RoomEvent.Redaction,\n RoomEvent.RedactionCancelled,\n RoomEvent.Receipt,\n RoomEvent.Tags,\n RoomEvent.LocalEchoUpdated,\n RoomEvent.AccountData,\n RoomEvent.MyMembership,\n RoomEvent.Timeline,\n RoomEvent.TimelineReset,\n ]);\n this.registerStateListeners(room);\n return room;\n }\n\n private registerStateListeners(room: Room): void {\n // XXX cargoculted from sync.ts\n // we need to also re-emit room state and room member events, so hook it up\n // to the client now. We need to add a listener for RoomState.members in\n // order to hook them correctly.\n this.client.reEmitter.reEmit(room.currentState, [\n RoomStateEvent.Events,\n RoomStateEvent.Members,\n RoomStateEvent.NewMember,\n RoomStateEvent.Update,\n ]);\n room.currentState.on(RoomStateEvent.NewMember, (event, state, member) => {\n member.user = this.client.getUser(member.userId) ?? undefined;\n this.client.reEmitter.reEmit(member, [\n RoomMemberEvent.Name,\n RoomMemberEvent.Typing,\n RoomMemberEvent.PowerLevel,\n RoomMemberEvent.Membership,\n ]);\n });\n }\n\n /*\n private deregisterStateListeners(room: Room): void { // XXX cargoculted from sync.ts\n // could do with a better way of achieving this.\n room.currentState.removeAllListeners(RoomStateEvent.Events);\n room.currentState.removeAllListeners(RoomStateEvent.Members);\n room.currentState.removeAllListeners(RoomStateEvent.NewMember);\n } */\n\n private shouldAbortSync(error: MatrixError): boolean {\n if (error.errcode === \"M_UNKNOWN_TOKEN\") {\n // The logout already happened, we just need to stop.\n logger.warn(\"Token no longer valid - assuming logout\");\n this.stop();\n this.updateSyncState(SyncState.Error, { error });\n return true;\n }\n return false;\n }\n\n private async processRoomData(client: MatrixClient, room: Room, roomData: MSC3575RoomData): Promise<void> {\n roomData = ensureNameEvent(client, room.roomId, roomData);\n const stateEvents = mapEvents(this.client, room.roomId, roomData.required_state);\n // Prevent events from being decrypted ahead of time\n // this helps large account to speed up faster\n // room::decryptCriticalEvent is in charge of decrypting all the events\n // required for a client to function properly\n let timelineEvents = mapEvents(this.client, room.roomId, roomData.timeline, false);\n const ephemeralEvents: MatrixEvent[] = []; // TODO this.mapSyncEventsFormat(joinObj.ephemeral);\n\n // TODO: handle threaded / beacon events\n\n if (roomData.initial) {\n // we should not know about any of these timeline entries if this is a genuinely new room.\n // If we do, then we've effectively done scrollback (e.g requesting timeline_limit: 1 for\n // this room, then timeline_limit: 50).\n const knownEvents = new Set<string>();\n room.getLiveTimeline()\n .getEvents()\n .forEach((e) => {\n knownEvents.add(e.getId()!);\n });\n // all unknown events BEFORE a known event must be scrollback e.g:\n // D E <-- what we know\n // A B C D E F <-- what we just received\n // means:\n // A B C <-- scrollback\n // D E <-- dupes\n // F <-- new event\n // We bucket events based on if we have seen a known event yet.\n const oldEvents: MatrixEvent[] = [];\n const newEvents: MatrixEvent[] = [];\n let seenKnownEvent = false;\n for (let i = timelineEvents.length - 1; i >= 0; i--) {\n const recvEvent = timelineEvents[i];\n if (knownEvents.has(recvEvent.getId()!)) {\n seenKnownEvent = true;\n continue; // don't include this event, it's a dupe\n }\n if (seenKnownEvent) {\n // old -> new\n oldEvents.push(recvEvent);\n } else {\n // old -> new\n newEvents.unshift(recvEvent);\n }\n }\n timelineEvents = newEvents;\n if (oldEvents.length > 0) {\n // old events are scrollback, insert them now\n room.addEventsToTimeline(oldEvents, true, false, room.getLiveTimeline(), roomData.prev_batch);\n }\n }\n\n const encrypted = room.hasEncryptionStateEvent();\n // we do this first so it's correct when any of the events fire\n if (roomData.notification_count != null) {\n room.setUnreadNotificationCount(NotificationCountType.Total, roomData.notification_count);\n }\n\n if (roomData.highlight_count != null) {\n // We track unread notifications ourselves in encrypted rooms, so don't\n // bother setting it here. We trust our calculations better than the\n // server's for this case, and therefore will assume that our non-zero\n // count is accurate.\n if (!encrypted || (encrypted && room.getUnreadNotificationCount(NotificationCountType.Highlight) <= 0)) {\n room.setUnreadNotificationCount(NotificationCountType.Highlight, roomData.highlight_count);\n }\n }\n\n if (Number.isInteger(roomData.invited_count)) {\n room.currentState.setInvitedMemberCount(roomData.invited_count!);\n }\n if (Number.isInteger(roomData.joined_count)) {\n room.currentState.setJoinedMemberCount(roomData.joined_count!);\n }\n\n if (roomData.invite_state) {\n const inviteStateEvents = mapEvents(this.client, room.roomId, roomData.invite_state);\n await this.injectRoomEvents(room, inviteStateEvents);\n if (roomData.initial) {\n room.recalculate();\n this.client.store.storeRoom(room);\n this.client.emit(ClientEvent.Room, room);\n }\n inviteStateEvents.forEach((e) => {\n this.client.emit(ClientEvent.Event, e);\n });\n room.updateMyMembership(KnownMembership.Invite);\n return;\n }\n\n if (roomData.initial) {\n // set the back-pagination token. Do this *before* adding any\n // events so that clients can start back-paginating.\n room.getLiveTimeline().setPaginationToken(roomData.prev_batch ?? null, EventTimeline.BACKWARDS);\n }\n\n /* TODO\n else if (roomData.limited) {\n\n let limited = true;\n\n // we've got a limited sync, so we *probably* have a gap in the\n // timeline, so should reset. But we might have been peeking or\n // paginating and already have some of the events, in which\n // case we just want to append any subsequent events to the end\n // of the existing timeline.\n //\n // This is particularly important in the case that we already have\n // *all* of the events in the timeline - in that case, if we reset\n // the timeline, we'll end up with an entirely empty timeline,\n // which we'll try to paginate but not get any new events (which\n // will stop us linking the empty timeline into the chain).\n //\n for (let i = timelineEvents.length - 1; i >= 0; i--) {\n const eventId = timelineEvents[i].getId();\n if (room.getTimelineForEvent(eventId)) {\n logger.debug(\"Already have event \" + eventId + \" in limited \" +\n \"sync - not resetting\");\n limited = false;\n\n // we might still be missing some of the events before i;\n // we don't want to be adding them to the end of the\n // timeline because that would put them out of order.\n timelineEvents.splice(0, i);\n\n // XXX: there's a problem here if the skipped part of the\n // timeline modifies the state set in stateEvents, because\n // we'll end up using the state from stateEvents rather\n // than the later state from timelineEvents. We probably\n // need to wind stateEvents forward over the events we're\n // skipping.\n break;\n }\n }\n\n if (limited) {\n room.resetLiveTimeline(\n roomData.prev_batch,\n null, // TODO this.syncOpts.canResetEntireTimeline(room.roomId) ? null : syncEventData.oldSyncToken,\n );\n\n // We have to assume any gap in any timeline is\n // reason to stop incrementally tracking notifications and\n // reset the timeline.\n this.client.resetNotifTimelineSet();\n this.registerStateListeners(room);\n }\n } */\n\n await this.injectRoomEvents(room, stateEvents, timelineEvents, roomData.num_live);\n\n // we deliberately don't add ephemeral events to the timeline\n room.addEphemeralEvents(ephemeralEvents);\n\n // local fields must be set before any async calls because call site assumes\n // synchronous execution prior to emitting SlidingSyncState.Complete\n room.updateMyMembership(KnownMembership.Join);\n\n room.recalculate();\n if (roomData.initial) {\n client.store.storeRoom(room);\n client.emit(ClientEvent.Room, room);\n }\n\n // check if any timeline events should bing and add them to the notifEvents array:\n // we'll purge this once we've fully processed the sync response\n this.addNotifications(timelineEvents);\n\n const processRoomEvent = async (e: MatrixEvent): Promise<void> => {\n client.emit(ClientEvent.Event, e);\n };\n\n await promiseMapSeries(stateEvents, processRoomEvent);\n await promiseMapSeries(timelineEvents, processRoomEvent);\n ephemeralEvents.forEach(function (e) {\n client.emit(ClientEvent.Event, e);\n });\n }\n\n /**\n * Injects events into a room's model.\n * @param stateEventList - A list of state events. This is the state\n * at the *END* of the timeline list if it is supplied.\n * @param timelineEventList - A list of timeline events. Lower index\n * is earlier in time. Higher index is later.\n * @param numLive - the number of events in timelineEventList which just happened,\n * supplied from the server.\n */\n public async injectRoomEvents(\n room: Room,\n stateEventList: MatrixEvent[],\n timelineEventList: MatrixEvent[] = [],\n numLive: number = 0,\n ): Promise<void> {\n // If there are no events in the timeline yet, initialise it with\n // the given state events\n const liveTimeline = room.getLiveTimeline();\n const timelineWasEmpty = liveTimeline.getEvents().length == 0;\n if (timelineWasEmpty) {\n // Passing these events into initialiseState will freeze them, so we need\n // to compute and cache the push actions for them now, otherwise sync dies\n // with an attempt to assign to read only property.\n // XXX: This is pretty horrible and is assuming all sorts of behaviour from\n // these functions that it shouldn't be. We should probably either store the\n // push actions cache elsewhere so we can freeze MatrixEvents, or otherwise\n // find some solution where MatrixEvents are immutable but allow for a cache\n // field.\n for (const ev of stateEventList) {\n this.client.getPushActionsForEvent(ev);\n }\n liveTimeline.initialiseState(stateEventList);\n }\n\n // If the timeline wasn't empty, we process the state events here: they're\n // defined as updates to the state before the start of the timeline, so this\n // starts to roll the state forward.\n // XXX: That's what we *should* do, but this can happen if we were previously\n // peeking in a room, in which case we obviously do *not* want to add the\n // state events here onto the end of the timeline. Historically, the js-sdk\n // has just set these new state events on the old and new state. This seems\n // very wrong because there could be events in the timeline that diverge the\n // state, in which case this is going to leave things out of sync. However,\n // for now I think it;s best to behave the same as the code has done previously.\n if (!timelineWasEmpty) {\n // XXX: As above, don't do this...\n //room.addLiveEvents(stateEventList || []);\n // Do this instead...\n room.oldState.setStateEvents(stateEventList);\n room.currentState.setStateEvents(stateEventList);\n }\n\n // the timeline is broken into 'live' events which just happened and normal timeline events\n // which are still to be appended to the end of the live timeline but happened a while ago.\n // The live events are marked as fromCache=false to ensure that downstream components know\n // this is a live event, not historical (from a remote server cache).\n\n let liveTimelineEvents: MatrixEvent[] = [];\n if (numLive > 0) {\n // last numLive events are live\n liveTimelineEvents = timelineEventList.slice(-1 * numLive);\n // everything else is not live\n timelineEventList = timelineEventList.slice(0, -1 * liveTimelineEvents.length);\n }\n\n // Execute the timeline events.\n // This also needs to be done before running push rules on the events as they need\n // to be decorated with sender etc.\n await room.addLiveEvents(timelineEventList, {\n fromCache: true,\n addToState: false,\n });\n if (liveTimelineEvents.length > 0) {\n await room.addLiveEvents(liveTimelineEvents, {\n fromCache: false,\n addToState: false,\n });\n }\n\n room.recalculate();\n\n // resolve invites now we have set the latest state\n this.resolveInvites(room);\n }\n\n private resolveInvites(room: Room): void {\n if (!room || !this.opts.resolveInvitesToProfiles) {\n return;\n }\n const client = this.client;\n // For each invited room member we want to give them a displayname/avatar url\n // if they have one (the m.room.member invites don't contain this).\n room.getMembersWithMembership(KnownMembership.Invite).forEach(function (member) {\n if (member.requestedProfileInfo) return;\n member.requestedProfileInfo = true;\n // try to get a cached copy first.\n const user = client.getUser(member.userId);\n let promise: ReturnType<MatrixClient[\"getProfileInfo\"]>;\n if (user) {\n promise = Promise.resolve({\n avatar_url: user.avatarUrl,\n displayname: user.displayName,\n });\n } else {\n promise = client.getProfileInfo(member.userId);\n }\n promise.then(\n function (info) {\n // slightly naughty by doctoring the invite event but this means all\n // the code paths remain the same between invite/join display name stuff\n // which is a worthy trade-off for some minor pollution.\n const inviteEvent = member.events.member!;\n if (inviteEvent.getContent().membership !== KnownMembership.Invite) {\n // between resolving and now they have since joined, so don't clobber\n return;\n }\n inviteEvent.getContent().avatar_url = info.avatar_url;\n inviteEvent.getContent().displayname = info.displayname;\n // fire listeners\n member.setMembershipEvent(inviteEvent, room.currentState);\n },\n function (_err) {\n // OH WELL.\n },\n );\n });\n }\n\n public retryImmediately(): boolean {\n return true;\n }\n\n /**\n * Main entry point. Blocks until stop() is called.\n */\n public async sync(): Promise<void> {\n logger.debug(\"Sliding sync init loop\");\n\n // 1) We need to get push rules so we can check if events should bing as we get\n // them from /sync.\n while (!this.client.isGuest()) {\n try {\n logger.debug(\"Getting push rules...\");\n const result = await this.client.getPushRules();\n logger.debug(\"Got push rules\");\n this.client.pushRules = result;\n break;\n } catch (err) {\n logger.error(\"Getting push rules failed\", err);\n if (this.shouldAbortSync(<MatrixError>err)) {\n return;\n }\n }\n }\n\n // start syncing\n await this.slidingSync.start();\n }\n\n /**\n * Stops the sync object from syncing.\n */\n public stop(): void {\n logger.debug(\"SyncApi.stop\");\n this.slidingSync.stop();\n }\n\n /**\n * Sets the sync state and emits an event to say so\n * @param newState - The new state string\n * @param data - Object of additional data to emit in the event\n */\n private updateSyncState(newState: SyncState, data?: ISyncStateData): void {\n const old = this.syncState;\n this.syncState = newState;\n this.syncStateData = data;\n this.client.emit(ClientEvent.Sync, this.syncState, old, data);\n }\n\n /**\n * Takes a list of timelineEvents and adds and adds to notifEvents\n * as appropriate.\n * This must be called after the room the events belong to has been stored.\n *\n * @param timelineEventList - A list of timeline events. Lower index\n * is earlier in time. Higher index is later.\n */\n private addNotifications(timelineEventList: MatrixEvent[]): void {\n // gather our notifications into this.notifEvents\n if (!this.client.getNotifTimelineSet()) {\n return;\n }\n for (const timelineEvent of timelineEventList) {\n const pushActions = this.client.getPushActionsForEvent(timelineEvent);\n if (pushActions && pushActions.notify && pushActions.tweaks && pushActions.tweaks.highlight) {\n this.notifEvents.push(timelineEvent);\n }\n }\n }\n\n /**\n * Purge any events in the notifEvents array. Used after a /sync has been complete.\n * This should not be called at a per-room scope (e.g in onRoomData) because otherwise the ordering\n * will be messed up e.g room A gets a bing, room B gets a newer bing, but both in the same /sync\n * response. If we purge at a per-room scope then we could process room B before room A leading to\n * room B appearing earlier in the notifications timeline, even though it has the higher origin_server_ts.\n */\n private purgeNotifications(): void {\n this.notifEvents.sort(function (a, b) {\n return a.getTs() - b.getTs();\n });\n this.notifEvents.forEach((event) => {\n this.client.getNotifTimelineSet()?.addLiveEvent(event, { addToState: false });\n });\n this.notifEvents = [];\n }\n}\n\nfunction ensureNameEvent(client: MatrixClient, roomId: string, roomData: MSC3575RoomData): MSC3575RoomData {\n // make sure m.room.name is in required_state if there is a name, replacing anything previously\n // there if need be. This ensures clients transparently 'calculate' the right room name. Native\n // sliding sync clients should just read the \"name\" field.\n if (!roomData.name) {\n return roomData;\n }\n for (const stateEvent of roomData.required_state) {\n if (stateEvent.type === EventType.RoomName && stateEvent.state_key === \"\") {\n stateEvent.content = {\n name: roomData.name,\n };\n return roomData;\n }\n }\n roomData.required_state.push({\n event_id: \"$fake-sliding-sync-name-event-\" + roomId,\n state_key: \"\",\n type: EventType.RoomName,\n content: {\n name: roomData.name,\n },\n sender: client.getUserId()!,\n origin_server_ts: new Date().getTime(),\n });\n return roomData;\n}\n\ntype TaggedEvent = (IStrippedState | IRoomEvent | IStateEvent | IMinimalEvent) & { room_id?: string };\n\n// Helper functions which set up JS SDK structs are below and are identical to the sync v2 counterparts,\n// just outside the class.\nfunction mapEvents(client: MatrixClient, roomId: string | undefined, events: object[], decrypt = true): MatrixEvent[] {\n const mapper = client.getEventMapper({ decrypt });\n return (events as TaggedEvent[]).map(function (e) {\n e.room_id = roomId;\n return mapper(e);\n });\n}\n\nfunction processEphemeralEvents(client: MatrixClient, roomId: string, ephEvents: IMinimalEvent[]): void {\n const ephemeralEvents = mapEvents(client, roomId, ephEvents);\n const room = client.getRoom(roomId);\n if (!room) {\n logger.warn(\"got ephemeral events for room but room doesn't exist on client:\", roomId);\n return;\n }\n room.addEphemeralEvents(ephemeralEvents);\n ephemeralEvents.forEach((e) => {\n client.emit(ClientEvent.Event, e);\n });\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,qBAAqB,EAAEC,IAAI,EAAEC,SAAS,QAAQ,kBAAkB;AACzE,SAASC,MAAM,QAAQ,aAAa;AACpC,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,WAAW,QAAyC,aAAa;AAC1E,SAEIC,SAAS,EACTC,oBAAoB,EACpBC,iBAAiB,QAEd,WAAW;AAGlB,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAEIC,cAAc,EAIdC,gBAAgB,EAChBC,gBAAgB,QACb,mBAAmB;AAC1B,SAASC,SAAS,QAAQ,mBAAmB;AAE7C,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,eAAe,QAAQ,wBAAwB;;AAExD;AACA;AACA;AACA,IAAMC,2BAA2B,GAAG,CAAC;AAarC,MAAMC,iBAAiB,CAA2E;EAGvFC,WAAWA,CACGC,MAAoB,EACvC;IAAA,KADmBA,MAAoB,GAApBA,MAAoB;IAAAC,eAAA,oBAHN,IAAI;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B,MAAgB,EAAiC;EAAA,IAA/BgQ,OAAO,GAAAnE,SAAA,CAAAtK,MAAA,QAAAsK,SAAA,QAAAnM,SAAA,GAAAmM,SAAA,MAAG,IAAI;EACjG,IAAMoE,MAAM,GAAGjR,MAAM,CAACkB,cAAc,CAAC;IAAE8P;EAAQ,CAAC,CAAC;EACjD,OAAQhQ,MAAM,CAAmBC,GAAG,CAAC,UAAUgC,CAAC,EAAE;IAC9CA,CAAC,CAACiO,OAAO,GAAGzO,MAAM;IAClB,OAAOwO,MAAM,CAAChO,CAAC,CAAC;EACpB,CAAC,CAAC;AACN;AAEA,SAASkB,sBAAsBA,CAACnE,MAAoB,EAAEyC,MAAc,EAAE0O,SAA0B,EAAQ;EACpG,IAAMtH,eAAe,GAAGjH,SAAS,CAAC5C,MAAM,EAAEyC,MAAM,EAAE0O,SAAS,CAAC;EAC5D,IAAMtO,IAAI,GAAG7C,MAAM,CAAC8C,OAAO,CAACL,MAAM,CAAC;EACnC,IAAI,CAACI,IAAI,EAAE;IACP/D,MAAM,CAACiE,IAAI,CAAC,iEAAiE,EAAEN,MAAM,CAAC;IACtF;EACJ;EACAI,IAAI,CAACyJ,kBAAkB,CAACzC,eAAe,CAAC;EACxCA,eAAe,CAACrI,OAAO,CAAEyB,CAAC,IAAK;IAC3BjD,MAAM,CAAC+B,IAAI,CAAC9C,WAAW,CAACiE,KAAK,EAAED,CAAC,CAAC;EACrC,CAAC,CAAC;AACN","ignoreList":[]}
@@ -96,8 +96,9 @@ class SlidingList {
96
96
  * @param list - The new list parameters
97
97
  */
98
98
  replaceList(list) {
99
- list.filters = list.filters || {};
100
- list.ranges = list.ranges || [];
99
+ var _list$filters, _list$ranges;
100
+ list.filters = (_list$filters = list.filters) !== null && _list$filters !== void 0 ? _list$filters : {};
101
+ list.ranges = (_list$ranges = list.ranges) !== null && _list$ranges !== void 0 ? _list$ranges : [];
101
102
  this.list = JSON.parse(JSON.stringify(list));
102
103
  this.isModified = true;
103
104
 
@@ -687,6 +688,7 @@ export class SlidingSync extends TypedEventEmitter {
687
688
  var doNotUpdateList = false;
688
689
  var resp;
689
690
  try {
691
+ var _resp$lists, _resp$rooms, _resp$extensions;
690
692
  var listModifiedCount = _this4.listModifiedCount;
691
693
  var reqLists = {};
692
694
  _this4.lists.forEach((l, key) => {
@@ -742,9 +744,9 @@ export class SlidingSync extends TypedEventEmitter {
742
744
  l.setModified(false);
743
745
  });
744
746
  // set default empty values so we don't need to null check
745
- resp.lists = resp.lists || {};
746
- resp.rooms = resp.rooms || {};
747
- resp.extensions = resp.extensions || {};
747
+ resp.lists = (_resp$lists = resp.lists) !== null && _resp$lists !== void 0 ? _resp$lists : {};
748
+ resp.rooms = (_resp$rooms = resp.rooms) !== null && _resp$rooms !== void 0 ? _resp$rooms : {};
749
+ resp.extensions = (_resp$extensions = resp.extensions) !== null && _resp$extensions !== void 0 ? _resp$extensions : {};
748
750
  Object.keys(resp.lists).forEach(key => {
749
751
  var list = _this4.lists.get(key);
750
752
  if (!list || !resp) {
@@ -781,7 +783,8 @@ export class SlidingSync extends TypedEventEmitter {
781
783
  var listKeysWithUpdates = new Set();
782
784
  if (!doNotUpdateList) {
783
785
  for (var [key, list] of Object.entries(resp.lists)) {
784
- list.ops = list.ops || [];
786
+ var _list$ops;
787
+ list.ops = (_list$ops = list.ops) !== null && _list$ops !== void 0 ? _list$ops : [];
785
788
  if (list.ops.length > 0) {
786
789
  listKeysWithUpdates.add(key);
787
790
  }