@unwanted/matrix-sdk-mini 34.12.0 → 36.0.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 (759) hide show
  1. package/git-revision.txt +1 -1
  2. package/lib/@types/event.d.ts +25 -19
  3. package/lib/@types/event.d.ts.map +1 -1
  4. package/lib/@types/event.js +5 -0
  5. package/lib/@types/event.js.map +1 -1
  6. package/lib/@types/global.d.js +0 -2
  7. package/lib/@types/global.d.js.map +1 -1
  8. package/lib/autodiscovery.d.ts +1 -1
  9. package/lib/autodiscovery.d.ts.map +1 -1
  10. package/lib/autodiscovery.js.map +1 -1
  11. package/lib/base64.d.ts +3 -6
  12. package/lib/base64.d.ts.map +1 -1
  13. package/lib/base64.js +43 -36
  14. package/lib/base64.js.map +1 -1
  15. package/lib/browser-index.d.ts.map +1 -1
  16. package/lib/browser-index.js +0 -11
  17. package/lib/browser-index.js.map +1 -1
  18. package/lib/client.d.ts +45 -1306
  19. package/lib/client.d.ts.map +1 -1
  20. package/lib/client.js +406 -2963
  21. package/lib/client.js.map +1 -1
  22. package/lib/digest.d.ts +2 -2
  23. package/lib/digest.d.ts.map +1 -1
  24. package/lib/digest.js +2 -2
  25. package/lib/digest.js.map +1 -1
  26. package/lib/embedded.d.ts +2 -23
  27. package/lib/embedded.d.ts.map +1 -1
  28. package/lib/embedded.js +82 -209
  29. package/lib/embedded.js.map +1 -1
  30. package/lib/event-mapper.d.ts.map +1 -1
  31. package/lib/event-mapper.js +0 -4
  32. package/lib/event-mapper.js.map +1 -1
  33. package/lib/feature.d.ts.map +1 -1
  34. package/lib/feature.js +2 -1
  35. package/lib/feature.js.map +1 -1
  36. package/lib/http-api/errors.d.ts +3 -3
  37. package/lib/http-api/errors.js +3 -3
  38. package/lib/http-api/errors.js.map +1 -1
  39. package/lib/http-api/utils.js +2 -2
  40. package/lib/http-api/utils.js.map +1 -1
  41. package/lib/matrix.d.ts +0 -25
  42. package/lib/matrix.d.ts.map +1 -1
  43. package/lib/matrix.js +1 -30
  44. package/lib/matrix.js.map +1 -1
  45. package/lib/models/MSC3089Branch.d.ts.map +1 -1
  46. package/lib/models/MSC3089Branch.js +0 -3
  47. package/lib/models/MSC3089Branch.js.map +1 -1
  48. package/lib/models/event-timeline-set.d.ts +6 -10
  49. package/lib/models/event-timeline-set.d.ts.map +1 -1
  50. package/lib/models/event-timeline-set.js +28 -36
  51. package/lib/models/event-timeline-set.js.map +1 -1
  52. package/lib/models/event-timeline.d.ts +7 -2
  53. package/lib/models/event-timeline.d.ts.map +1 -1
  54. package/lib/models/event-timeline.js +9 -30
  55. package/lib/models/event-timeline.js.map +1 -1
  56. package/lib/models/event.d.ts +12 -96
  57. package/lib/models/event.d.ts.map +1 -1
  58. package/lib/models/event.js +59 -286
  59. package/lib/models/event.js.map +1 -1
  60. package/lib/models/invites-ignorer-types.d.ts +27 -0
  61. package/lib/models/invites-ignorer-types.d.ts.map +1 -0
  62. package/lib/models/invites-ignorer-types.js +36 -0
  63. package/lib/models/invites-ignorer-types.js.map +1 -0
  64. package/lib/models/invites-ignorer.d.ts +2 -26
  65. package/lib/models/invites-ignorer.d.ts.map +1 -1
  66. package/lib/models/invites-ignorer.js +2 -27
  67. package/lib/models/invites-ignorer.js.map +1 -1
  68. package/lib/models/poll.d.ts.map +1 -1
  69. package/lib/models/poll.js +1 -5
  70. package/lib/models/poll.js.map +1 -1
  71. package/lib/models/relations-container.d.ts.map +1 -1
  72. package/lib/models/relations-container.js +1 -7
  73. package/lib/models/relations-container.js.map +1 -1
  74. package/lib/models/relations.d.ts +0 -1
  75. package/lib/models/relations.d.ts.map +1 -1
  76. package/lib/models/relations.js +0 -8
  77. package/lib/models/relations.js.map +1 -1
  78. package/lib/models/room-member.d.ts +6 -1
  79. package/lib/models/room-member.d.ts.map +1 -1
  80. package/lib/models/room-member.js +7 -1
  81. package/lib/models/room-member.js.map +1 -1
  82. package/lib/models/room-state.d.ts +2 -13
  83. package/lib/models/room-state.d.ts.map +1 -1
  84. package/lib/models/room-state.js +12 -56
  85. package/lib/models/room-state.js.map +1 -1
  86. package/lib/models/room.d.ts +8 -21
  87. package/lib/models/room.d.ts.map +1 -1
  88. package/lib/models/room.js +128 -163
  89. package/lib/models/room.js.map +1 -1
  90. package/lib/models/thread.d.ts.map +1 -1
  91. package/lib/models/thread.js +5 -4
  92. package/lib/models/thread.js.map +1 -1
  93. package/lib/oidc/authorize.d.ts +2 -2
  94. package/lib/oidc/authorize.d.ts.map +1 -1
  95. package/lib/oidc/authorize.js +5 -5
  96. package/lib/oidc/authorize.js.map +1 -1
  97. package/lib/oidc/discovery.d.ts +8 -0
  98. package/lib/oidc/discovery.d.ts.map +1 -1
  99. package/lib/oidc/discovery.js +22 -11
  100. package/lib/oidc/discovery.js.map +1 -1
  101. package/lib/oidc/index.d.ts +3 -4
  102. package/lib/oidc/index.d.ts.map +1 -1
  103. package/lib/oidc/index.js.map +1 -1
  104. package/lib/oidc/register.js +3 -3
  105. package/lib/oidc/register.js.map +1 -1
  106. package/lib/oidc/tokenRefresher.d.ts.map +1 -1
  107. package/lib/oidc/tokenRefresher.js +6 -5
  108. package/lib/oidc/tokenRefresher.js.map +1 -1
  109. package/lib/oidc/validate.d.ts +9 -23
  110. package/lib/oidc/validate.d.ts.map +1 -1
  111. package/lib/oidc/validate.js +13 -28
  112. package/lib/oidc/validate.js.map +1 -1
  113. package/lib/randomstring.d.ts +30 -3
  114. package/lib/randomstring.d.ts.map +1 -1
  115. package/lib/randomstring.js +68 -16
  116. package/lib/randomstring.js.map +1 -1
  117. package/lib/sliding-sync-sdk.d.ts +3 -4
  118. package/lib/sliding-sync-sdk.d.ts.map +1 -1
  119. package/lib/sliding-sync-sdk.js +55 -102
  120. package/lib/sliding-sync-sdk.js.map +1 -1
  121. package/lib/sliding-sync.js +9 -6
  122. package/lib/sliding-sync.js.map +1 -1
  123. package/lib/store/indexeddb-local-backend.js +4 -2
  124. package/lib/store/indexeddb-local-backend.js.map +1 -1
  125. package/lib/store/indexeddb.d.ts +1 -1
  126. package/lib/store/indexeddb.d.ts.map +1 -1
  127. package/lib/store/indexeddb.js.map +1 -1
  128. package/lib/sync-accumulator.d.ts +6 -4
  129. package/lib/sync-accumulator.d.ts.map +1 -1
  130. package/lib/sync-accumulator.js +23 -12
  131. package/lib/sync-accumulator.js.map +1 -1
  132. package/lib/sync.d.ts +10 -13
  133. package/lib/sync.d.ts.map +1 -1
  134. package/lib/sync.js +94 -115
  135. package/lib/sync.js.map +1 -1
  136. package/lib/testing.d.ts +13 -44
  137. package/lib/testing.d.ts.map +1 -1
  138. package/lib/testing.js +36 -99
  139. package/lib/testing.js.map +1 -1
  140. package/lib/types.d.ts +0 -1
  141. package/lib/types.d.ts.map +1 -1
  142. package/lib/types.js.map +1 -1
  143. package/package.json +14 -15
  144. package/src/@types/event.ts +19 -36
  145. package/src/@types/global.d.ts +21 -4
  146. package/src/autodiscovery.ts +1 -1
  147. package/src/base64.ts +38 -40
  148. package/src/browser-index.ts +0 -11
  149. package/src/client.ts +175 -3136
  150. package/src/digest.ts +3 -3
  151. package/src/embedded.ts +43 -149
  152. package/src/event-mapper.ts +0 -4
  153. package/src/feature.ts +1 -0
  154. package/src/http-api/errors.ts +3 -3
  155. package/src/http-api/utils.ts +2 -2
  156. package/src/matrix.ts +0 -41
  157. package/src/models/MSC3089Branch.ts +0 -3
  158. package/src/models/event-timeline-set.ts +17 -38
  159. package/src/models/event-timeline.ts +11 -26
  160. package/src/models/event.ts +54 -295
  161. package/src/models/invites-ignorer-types.ts +48 -0
  162. package/src/models/invites-ignorer.ts +7 -42
  163. package/src/models/poll.ts +0 -6
  164. package/src/models/relations-container.ts +1 -8
  165. package/src/models/relations.ts +0 -8
  166. package/src/models/room-member.ts +16 -1
  167. package/src/models/room-state.ts +4 -37
  168. package/src/models/room.ts +34 -69
  169. package/src/models/thread.ts +4 -3
  170. package/src/oidc/authorize.ts +7 -7
  171. package/src/oidc/discovery.ts +16 -10
  172. package/src/oidc/index.ts +3 -4
  173. package/src/oidc/register.ts +3 -3
  174. package/src/oidc/tokenRefresher.ts +3 -2
  175. package/src/oidc/validate.ts +40 -63
  176. package/src/randomstring.ts +65 -19
  177. package/src/sliding-sync-sdk.ts +10 -83
  178. package/src/sliding-sync.ts +6 -6
  179. package/src/store/indexeddb-local-backend.ts +2 -2
  180. package/src/store/indexeddb.ts +1 -1
  181. package/src/sync-accumulator.ts +33 -16
  182. package/src/sync.ts +112 -143
  183. package/src/testing.ts +36 -103
  184. package/src/types.ts +0 -1
  185. package/CHANGELOG.md +0 -5910
  186. package/lib/@types/AESEncryptedSecretStoragePayload.d.ts +0 -14
  187. package/lib/@types/AESEncryptedSecretStoragePayload.d.ts.map +0 -1
  188. package/lib/@types/AESEncryptedSecretStoragePayload.js +0 -1
  189. package/lib/@types/AESEncryptedSecretStoragePayload.js.map +0 -1
  190. package/lib/@types/crypto.d.ts +0 -47
  191. package/lib/@types/crypto.d.ts.map +0 -1
  192. package/lib/@types/crypto.js +0 -1
  193. package/lib/@types/crypto.js.map +0 -1
  194. package/lib/@types/matrix-sdk-crypto-wasm.d.js +0 -1
  195. package/lib/@types/matrix-sdk-crypto-wasm.d.js.map +0 -1
  196. package/lib/common-crypto/CryptoBackend.d.ts +0 -240
  197. package/lib/common-crypto/CryptoBackend.d.ts.map +0 -1
  198. package/lib/common-crypto/CryptoBackend.js +0 -73
  199. package/lib/common-crypto/CryptoBackend.js.map +0 -1
  200. package/lib/common-crypto/key-passphrase.d.ts +0 -14
  201. package/lib/common-crypto/key-passphrase.d.ts.map +0 -1
  202. package/lib/common-crypto/key-passphrase.js +0 -33
  203. package/lib/common-crypto/key-passphrase.js.map +0 -1
  204. package/lib/crypto/CrossSigning.d.ts +0 -184
  205. package/lib/crypto/CrossSigning.d.ts.map +0 -1
  206. package/lib/crypto/CrossSigning.js +0 -718
  207. package/lib/crypto/CrossSigning.js.map +0 -1
  208. package/lib/crypto/DeviceList.d.ts +0 -216
  209. package/lib/crypto/DeviceList.d.ts.map +0 -1
  210. package/lib/crypto/DeviceList.js +0 -892
  211. package/lib/crypto/DeviceList.js.map +0 -1
  212. package/lib/crypto/EncryptionSetup.d.ts +0 -152
  213. package/lib/crypto/EncryptionSetup.d.ts.map +0 -1
  214. package/lib/crypto/EncryptionSetup.js +0 -356
  215. package/lib/crypto/EncryptionSetup.js.map +0 -1
  216. package/lib/crypto/OlmDevice.d.ts +0 -457
  217. package/lib/crypto/OlmDevice.d.ts.map +0 -1
  218. package/lib/crypto/OlmDevice.js +0 -1241
  219. package/lib/crypto/OlmDevice.js.map +0 -1
  220. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts +0 -109
  221. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts.map +0 -1
  222. package/lib/crypto/OutgoingRoomKeyRequestManager.js +0 -415
  223. package/lib/crypto/OutgoingRoomKeyRequestManager.js.map +0 -1
  224. package/lib/crypto/RoomList.d.ts +0 -26
  225. package/lib/crypto/RoomList.d.ts.map +0 -1
  226. package/lib/crypto/RoomList.js +0 -71
  227. package/lib/crypto/RoomList.js.map +0 -1
  228. package/lib/crypto/SecretSharing.d.ts +0 -24
  229. package/lib/crypto/SecretSharing.d.ts.map +0 -1
  230. package/lib/crypto/SecretSharing.js +0 -194
  231. package/lib/crypto/SecretSharing.js.map +0 -1
  232. package/lib/crypto/SecretStorage.d.ts +0 -55
  233. package/lib/crypto/SecretStorage.d.ts.map +0 -1
  234. package/lib/crypto/SecretStorage.js +0 -118
  235. package/lib/crypto/SecretStorage.js.map +0 -1
  236. package/lib/crypto/aes.d.ts +0 -6
  237. package/lib/crypto/aes.d.ts.map +0 -1
  238. package/lib/crypto/aes.js +0 -24
  239. package/lib/crypto/aes.js.map +0 -1
  240. package/lib/crypto/algorithms/base.d.ts +0 -156
  241. package/lib/crypto/algorithms/base.d.ts.map +0 -1
  242. package/lib/crypto/algorithms/base.js +0 -187
  243. package/lib/crypto/algorithms/base.js.map +0 -1
  244. package/lib/crypto/algorithms/index.d.ts +0 -4
  245. package/lib/crypto/algorithms/index.d.ts.map +0 -1
  246. package/lib/crypto/algorithms/index.js +0 -20
  247. package/lib/crypto/algorithms/index.js.map +0 -1
  248. package/lib/crypto/algorithms/megolm.d.ts +0 -385
  249. package/lib/crypto/algorithms/megolm.d.ts.map +0 -1
  250. package/lib/crypto/algorithms/megolm.js +0 -1822
  251. package/lib/crypto/algorithms/megolm.js.map +0 -1
  252. package/lib/crypto/algorithms/olm.d.ts +0 -5
  253. package/lib/crypto/algorithms/olm.d.ts.map +0 -1
  254. package/lib/crypto/algorithms/olm.js +0 -299
  255. package/lib/crypto/algorithms/olm.js.map +0 -1
  256. package/lib/crypto/api.d.ts +0 -32
  257. package/lib/crypto/api.d.ts.map +0 -1
  258. package/lib/crypto/api.js +0 -22
  259. package/lib/crypto/api.js.map +0 -1
  260. package/lib/crypto/backup.d.ts +0 -227
  261. package/lib/crypto/backup.d.ts.map +0 -1
  262. package/lib/crypto/backup.js +0 -824
  263. package/lib/crypto/backup.js.map +0 -1
  264. package/lib/crypto/crypto.d.ts +0 -3
  265. package/lib/crypto/crypto.d.ts.map +0 -1
  266. package/lib/crypto/crypto.js +0 -19
  267. package/lib/crypto/crypto.js.map +0 -1
  268. package/lib/crypto/dehydration.d.ts +0 -34
  269. package/lib/crypto/dehydration.d.ts.map +0 -1
  270. package/lib/crypto/dehydration.js +0 -252
  271. package/lib/crypto/dehydration.js.map +0 -1
  272. package/lib/crypto/device-converter.d.ts +0 -9
  273. package/lib/crypto/device-converter.d.ts.map +0 -1
  274. package/lib/crypto/device-converter.js +0 -42
  275. package/lib/crypto/device-converter.js.map +0 -1
  276. package/lib/crypto/deviceinfo.d.ts +0 -99
  277. package/lib/crypto/deviceinfo.d.ts.map +0 -1
  278. package/lib/crypto/deviceinfo.js +0 -148
  279. package/lib/crypto/deviceinfo.js.map +0 -1
  280. package/lib/crypto/index.d.ts +0 -1210
  281. package/lib/crypto/index.d.ts.map +0 -1
  282. package/lib/crypto/index.js +0 -4101
  283. package/lib/crypto/index.js.map +0 -1
  284. package/lib/crypto/key_passphrase.d.ts +0 -14
  285. package/lib/crypto/key_passphrase.d.ts.map +0 -1
  286. package/lib/crypto/key_passphrase.js +0 -44
  287. package/lib/crypto/key_passphrase.js.map +0 -1
  288. package/lib/crypto/keybackup.d.ts +0 -18
  289. package/lib/crypto/keybackup.d.ts.map +0 -1
  290. package/lib/crypto/keybackup.js +0 -1
  291. package/lib/crypto/keybackup.js.map +0 -1
  292. package/lib/crypto/olmlib.d.ts +0 -129
  293. package/lib/crypto/olmlib.d.ts.map +0 -1
  294. package/lib/crypto/olmlib.js +0 -492
  295. package/lib/crypto/olmlib.js.map +0 -1
  296. package/lib/crypto/recoverykey.d.ts +0 -2
  297. package/lib/crypto/recoverykey.d.ts.map +0 -1
  298. package/lib/crypto/recoverykey.js +0 -19
  299. package/lib/crypto/recoverykey.js.map +0 -1
  300. package/lib/crypto/store/base.d.ts +0 -252
  301. package/lib/crypto/store/base.d.ts.map +0 -1
  302. package/lib/crypto/store/base.js +0 -64
  303. package/lib/crypto/store/base.js.map +0 -1
  304. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts +0 -187
  305. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts.map +0 -1
  306. package/lib/crypto/store/indexeddb-crypto-store-backend.js +0 -1145
  307. package/lib/crypto/store/indexeddb-crypto-store-backend.js.map +0 -1
  308. package/lib/crypto/store/indexeddb-crypto-store.d.ts +0 -432
  309. package/lib/crypto/store/indexeddb-crypto-store.d.ts.map +0 -1
  310. package/lib/crypto/store/indexeddb-crypto-store.js +0 -728
  311. package/lib/crypto/store/indexeddb-crypto-store.js.map +0 -1
  312. package/lib/crypto/store/localStorage-crypto-store.d.ts +0 -119
  313. package/lib/crypto/store/localStorage-crypto-store.d.ts.map +0 -1
  314. package/lib/crypto/store/localStorage-crypto-store.js +0 -531
  315. package/lib/crypto/store/localStorage-crypto-store.js.map +0 -1
  316. package/lib/crypto/store/memory-crypto-store.d.ts +0 -215
  317. package/lib/crypto/store/memory-crypto-store.d.ts.map +0 -1
  318. package/lib/crypto/store/memory-crypto-store.js +0 -622
  319. package/lib/crypto/store/memory-crypto-store.js.map +0 -1
  320. package/lib/crypto/verification/Base.d.ts +0 -105
  321. package/lib/crypto/verification/Base.d.ts.map +0 -1
  322. package/lib/crypto/verification/Base.js +0 -372
  323. package/lib/crypto/verification/Base.js.map +0 -1
  324. package/lib/crypto/verification/Error.d.ts +0 -35
  325. package/lib/crypto/verification/Error.d.ts.map +0 -1
  326. package/lib/crypto/verification/Error.js +0 -86
  327. package/lib/crypto/verification/Error.js.map +0 -1
  328. package/lib/crypto/verification/IllegalMethod.d.ts +0 -15
  329. package/lib/crypto/verification/IllegalMethod.d.ts.map +0 -1
  330. package/lib/crypto/verification/IllegalMethod.js +0 -43
  331. package/lib/crypto/verification/IllegalMethod.js.map +0 -1
  332. package/lib/crypto/verification/QRCode.d.ts +0 -51
  333. package/lib/crypto/verification/QRCode.d.ts.map +0 -1
  334. package/lib/crypto/verification/QRCode.js +0 -277
  335. package/lib/crypto/verification/QRCode.js.map +0 -1
  336. package/lib/crypto/verification/SAS.d.ts +0 -27
  337. package/lib/crypto/verification/SAS.d.ts.map +0 -1
  338. package/lib/crypto/verification/SAS.js +0 -485
  339. package/lib/crypto/verification/SAS.js.map +0 -1
  340. package/lib/crypto/verification/SASDecimal.d.ts +0 -8
  341. package/lib/crypto/verification/SASDecimal.d.ts.map +0 -1
  342. package/lib/crypto/verification/SASDecimal.js +0 -34
  343. package/lib/crypto/verification/SASDecimal.js.map +0 -1
  344. package/lib/crypto/verification/request/Channel.d.ts +0 -18
  345. package/lib/crypto/verification/request/Channel.d.ts.map +0 -1
  346. package/lib/crypto/verification/request/Channel.js +0 -1
  347. package/lib/crypto/verification/request/Channel.js.map +0 -1
  348. package/lib/crypto/verification/request/InRoomChannel.d.ts +0 -113
  349. package/lib/crypto/verification/request/InRoomChannel.d.ts.map +0 -1
  350. package/lib/crypto/verification/request/InRoomChannel.js +0 -351
  351. package/lib/crypto/verification/request/InRoomChannel.js.map +0 -1
  352. package/lib/crypto/verification/request/ToDeviceChannel.d.ts +0 -105
  353. package/lib/crypto/verification/request/ToDeviceChannel.d.ts.map +0 -1
  354. package/lib/crypto/verification/request/ToDeviceChannel.js +0 -328
  355. package/lib/crypto/verification/request/ToDeviceChannel.js.map +0 -1
  356. package/lib/crypto/verification/request/VerificationRequest.d.ts +0 -227
  357. package/lib/crypto/verification/request/VerificationRequest.d.ts.map +0 -1
  358. package/lib/crypto/verification/request/VerificationRequest.js +0 -937
  359. package/lib/crypto/verification/request/VerificationRequest.js.map +0 -1
  360. package/lib/crypto-api/CryptoEvent.d.ts +0 -69
  361. package/lib/crypto-api/CryptoEvent.d.ts.map +0 -1
  362. package/lib/crypto-api/CryptoEvent.js +0 -33
  363. package/lib/crypto-api/CryptoEvent.js.map +0 -1
  364. package/lib/crypto-api/CryptoEventHandlerMap.d.ts +0 -16
  365. package/lib/crypto-api/CryptoEventHandlerMap.d.ts.map +0 -1
  366. package/lib/crypto-api/CryptoEventHandlerMap.js +0 -22
  367. package/lib/crypto-api/CryptoEventHandlerMap.js.map +0 -1
  368. package/lib/crypto-api/index.d.ts +0 -978
  369. package/lib/crypto-api/index.d.ts.map +0 -1
  370. package/lib/crypto-api/index.js +0 -304
  371. package/lib/crypto-api/index.js.map +0 -1
  372. package/lib/crypto-api/key-passphrase.d.ts +0 -11
  373. package/lib/crypto-api/key-passphrase.d.ts.map +0 -1
  374. package/lib/crypto-api/key-passphrase.js +0 -51
  375. package/lib/crypto-api/key-passphrase.js.map +0 -1
  376. package/lib/crypto-api/keybackup.d.ts +0 -88
  377. package/lib/crypto-api/keybackup.d.ts.map +0 -1
  378. package/lib/crypto-api/keybackup.js +0 -1
  379. package/lib/crypto-api/keybackup.js.map +0 -1
  380. package/lib/crypto-api/recovery-key.d.ts +0 -11
  381. package/lib/crypto-api/recovery-key.d.ts.map +0 -1
  382. package/lib/crypto-api/recovery-key.js +0 -65
  383. package/lib/crypto-api/recovery-key.js.map +0 -1
  384. package/lib/crypto-api/verification.d.ts +0 -344
  385. package/lib/crypto-api/verification.d.ts.map +0 -1
  386. package/lib/crypto-api/verification.js +0 -91
  387. package/lib/crypto-api/verification.js.map +0 -1
  388. package/lib/matrixrtc/CallMembership.d.ts +0 -66
  389. package/lib/matrixrtc/CallMembership.d.ts.map +0 -1
  390. package/lib/matrixrtc/CallMembership.js +0 -197
  391. package/lib/matrixrtc/CallMembership.js.map +0 -1
  392. package/lib/matrixrtc/LivekitFocus.d.ts +0 -16
  393. package/lib/matrixrtc/LivekitFocus.d.ts.map +0 -1
  394. package/lib/matrixrtc/LivekitFocus.js +0 -20
  395. package/lib/matrixrtc/LivekitFocus.js.map +0 -1
  396. package/lib/matrixrtc/MatrixRTCSession.d.ts +0 -295
  397. package/lib/matrixrtc/MatrixRTCSession.d.ts.map +0 -1
  398. package/lib/matrixrtc/MatrixRTCSession.js +0 -1043
  399. package/lib/matrixrtc/MatrixRTCSession.js.map +0 -1
  400. package/lib/matrixrtc/MatrixRTCSessionManager.d.ts +0 -40
  401. package/lib/matrixrtc/MatrixRTCSessionManager.d.ts.map +0 -1
  402. package/lib/matrixrtc/MatrixRTCSessionManager.js +0 -146
  403. package/lib/matrixrtc/MatrixRTCSessionManager.js.map +0 -1
  404. package/lib/matrixrtc/focus.d.ts +0 -10
  405. package/lib/matrixrtc/focus.d.ts.map +0 -1
  406. package/lib/matrixrtc/focus.js +0 -1
  407. package/lib/matrixrtc/focus.js.map +0 -1
  408. package/lib/matrixrtc/index.d.ts +0 -7
  409. package/lib/matrixrtc/index.d.ts.map +0 -1
  410. package/lib/matrixrtc/index.js +0 -21
  411. package/lib/matrixrtc/index.js.map +0 -1
  412. package/lib/matrixrtc/types.d.ts +0 -19
  413. package/lib/matrixrtc/types.d.ts.map +0 -1
  414. package/lib/matrixrtc/types.js +0 -1
  415. package/lib/matrixrtc/types.js.map +0 -1
  416. package/lib/rendezvous/MSC4108SignInWithQR.d.ts +0 -112
  417. package/lib/rendezvous/MSC4108SignInWithQR.d.ts.map +0 -1
  418. package/lib/rendezvous/MSC4108SignInWithQR.js +0 -392
  419. package/lib/rendezvous/MSC4108SignInWithQR.js.map +0 -1
  420. package/lib/rendezvous/RendezvousChannel.d.ts +0 -27
  421. package/lib/rendezvous/RendezvousChannel.d.ts.map +0 -1
  422. package/lib/rendezvous/RendezvousChannel.js +0 -1
  423. package/lib/rendezvous/RendezvousChannel.js.map +0 -1
  424. package/lib/rendezvous/RendezvousCode.d.ts +0 -9
  425. package/lib/rendezvous/RendezvousCode.d.ts.map +0 -1
  426. package/lib/rendezvous/RendezvousCode.js +0 -1
  427. package/lib/rendezvous/RendezvousCode.js.map +0 -1
  428. package/lib/rendezvous/RendezvousError.d.ts +0 -6
  429. package/lib/rendezvous/RendezvousError.d.ts.map +0 -1
  430. package/lib/rendezvous/RendezvousError.js +0 -23
  431. package/lib/rendezvous/RendezvousError.js.map +0 -1
  432. package/lib/rendezvous/RendezvousFailureReason.d.ts +0 -31
  433. package/lib/rendezvous/RendezvousFailureReason.d.ts.map +0 -1
  434. package/lib/rendezvous/RendezvousFailureReason.js +0 -38
  435. package/lib/rendezvous/RendezvousFailureReason.js.map +0 -1
  436. package/lib/rendezvous/RendezvousIntent.d.ts +0 -5
  437. package/lib/rendezvous/RendezvousIntent.d.ts.map +0 -1
  438. package/lib/rendezvous/RendezvousIntent.js +0 -22
  439. package/lib/rendezvous/RendezvousIntent.js.map +0 -1
  440. package/lib/rendezvous/RendezvousTransport.d.ts +0 -36
  441. package/lib/rendezvous/RendezvousTransport.d.ts.map +0 -1
  442. package/lib/rendezvous/RendezvousTransport.js +0 -1
  443. package/lib/rendezvous/RendezvousTransport.js.map +0 -1
  444. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts +0 -58
  445. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts.map +0 -1
  446. package/lib/rendezvous/channels/MSC4108SecureChannel.js +0 -246
  447. package/lib/rendezvous/channels/MSC4108SecureChannel.js.map +0 -1
  448. package/lib/rendezvous/channels/index.d.ts +0 -2
  449. package/lib/rendezvous/channels/index.d.ts.map +0 -1
  450. package/lib/rendezvous/channels/index.js +0 -18
  451. package/lib/rendezvous/channels/index.js.map +0 -1
  452. package/lib/rendezvous/index.d.ts +0 -10
  453. package/lib/rendezvous/index.d.ts.map +0 -1
  454. package/lib/rendezvous/index.js +0 -23
  455. package/lib/rendezvous/index.js.map +0 -1
  456. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts +0 -61
  457. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts.map +0 -1
  458. package/lib/rendezvous/transports/MSC4108RendezvousSession.js +0 -253
  459. package/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +0 -1
  460. package/lib/rendezvous/transports/index.d.ts +0 -2
  461. package/lib/rendezvous/transports/index.d.ts.map +0 -1
  462. package/lib/rendezvous/transports/index.js +0 -18
  463. package/lib/rendezvous/transports/index.js.map +0 -1
  464. package/lib/rust-crypto/CrossSigningIdentity.d.ts +0 -33
  465. package/lib/rust-crypto/CrossSigningIdentity.d.ts.map +0 -1
  466. package/lib/rust-crypto/CrossSigningIdentity.js +0 -157
  467. package/lib/rust-crypto/CrossSigningIdentity.js.map +0 -1
  468. package/lib/rust-crypto/DehydratedDeviceManager.d.ts +0 -98
  469. package/lib/rust-crypto/DehydratedDeviceManager.d.ts.map +0 -1
  470. package/lib/rust-crypto/DehydratedDeviceManager.js +0 -285
  471. package/lib/rust-crypto/DehydratedDeviceManager.js.map +0 -1
  472. package/lib/rust-crypto/KeyClaimManager.d.ts +0 -33
  473. package/lib/rust-crypto/KeyClaimManager.d.ts.map +0 -1
  474. package/lib/rust-crypto/KeyClaimManager.js +0 -82
  475. package/lib/rust-crypto/KeyClaimManager.js.map +0 -1
  476. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts +0 -43
  477. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts.map +0 -1
  478. package/lib/rust-crypto/OutgoingRequestProcessor.js +0 -195
  479. package/lib/rust-crypto/OutgoingRequestProcessor.js.map +0 -1
  480. package/lib/rust-crypto/OutgoingRequestsManager.d.ts +0 -47
  481. package/lib/rust-crypto/OutgoingRequestsManager.d.ts.map +0 -1
  482. package/lib/rust-crypto/OutgoingRequestsManager.js +0 -148
  483. package/lib/rust-crypto/OutgoingRequestsManager.js.map +0 -1
  484. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts +0 -120
  485. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts.map +0 -1
  486. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js +0 -467
  487. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +0 -1
  488. package/lib/rust-crypto/RoomEncryptor.d.ts +0 -98
  489. package/lib/rust-crypto/RoomEncryptor.d.ts.map +0 -1
  490. package/lib/rust-crypto/RoomEncryptor.js +0 -299
  491. package/lib/rust-crypto/RoomEncryptor.js.map +0 -1
  492. package/lib/rust-crypto/backup.d.ts +0 -254
  493. package/lib/rust-crypto/backup.d.ts.map +0 -1
  494. package/lib/rust-crypto/backup.js +0 -837
  495. package/lib/rust-crypto/backup.js.map +0 -1
  496. package/lib/rust-crypto/constants.d.ts +0 -3
  497. package/lib/rust-crypto/constants.d.ts.map +0 -1
  498. package/lib/rust-crypto/constants.js +0 -19
  499. package/lib/rust-crypto/constants.js.map +0 -1
  500. package/lib/rust-crypto/device-converter.d.ts +0 -28
  501. package/lib/rust-crypto/device-converter.d.ts.map +0 -1
  502. package/lib/rust-crypto/device-converter.js +0 -123
  503. package/lib/rust-crypto/device-converter.js.map +0 -1
  504. package/lib/rust-crypto/index.d.ts +0 -61
  505. package/lib/rust-crypto/index.d.ts.map +0 -1
  506. package/lib/rust-crypto/index.js +0 -152
  507. package/lib/rust-crypto/index.js.map +0 -1
  508. package/lib/rust-crypto/libolm_migration.d.ts +0 -81
  509. package/lib/rust-crypto/libolm_migration.d.ts.map +0 -1
  510. package/lib/rust-crypto/libolm_migration.js +0 -459
  511. package/lib/rust-crypto/libolm_migration.js.map +0 -1
  512. package/lib/rust-crypto/rust-crypto.d.ts +0 -556
  513. package/lib/rust-crypto/rust-crypto.d.ts.map +0 -1
  514. package/lib/rust-crypto/rust-crypto.js +0 -2016
  515. package/lib/rust-crypto/rust-crypto.js.map +0 -1
  516. package/lib/rust-crypto/secret-storage.d.ts +0 -22
  517. package/lib/rust-crypto/secret-storage.d.ts.map +0 -1
  518. package/lib/rust-crypto/secret-storage.js +0 -63
  519. package/lib/rust-crypto/secret-storage.js.map +0 -1
  520. package/lib/rust-crypto/verification.d.ts +0 -319
  521. package/lib/rust-crypto/verification.d.ts.map +0 -1
  522. package/lib/rust-crypto/verification.js +0 -816
  523. package/lib/rust-crypto/verification.js.map +0 -1
  524. package/lib/secret-storage.d.ts +0 -370
  525. package/lib/secret-storage.d.ts.map +0 -1
  526. package/lib/secret-storage.js +0 -466
  527. package/lib/secret-storage.js.map +0 -1
  528. package/lib/utils/decryptAESSecretStorageItem.d.ts +0 -12
  529. package/lib/utils/decryptAESSecretStorageItem.d.ts.map +0 -1
  530. package/lib/utils/decryptAESSecretStorageItem.js +0 -50
  531. package/lib/utils/decryptAESSecretStorageItem.js.map +0 -1
  532. package/lib/utils/encryptAESSecretStorageItem.d.ts +0 -16
  533. package/lib/utils/encryptAESSecretStorageItem.d.ts.map +0 -1
  534. package/lib/utils/encryptAESSecretStorageItem.js +0 -68
  535. package/lib/utils/encryptAESSecretStorageItem.js.map +0 -1
  536. package/lib/utils/internal/deriveKeys.d.ts +0 -10
  537. package/lib/utils/internal/deriveKeys.d.ts.map +0 -1
  538. package/lib/utils/internal/deriveKeys.js +0 -60
  539. package/lib/utils/internal/deriveKeys.js.map +0 -1
  540. package/lib/webrtc/audioContext.d.ts +0 -15
  541. package/lib/webrtc/audioContext.d.ts.map +0 -1
  542. package/lib/webrtc/audioContext.js +0 -46
  543. package/lib/webrtc/audioContext.js.map +0 -1
  544. package/lib/webrtc/call.d.ts +0 -560
  545. package/lib/webrtc/call.d.ts.map +0 -1
  546. package/lib/webrtc/call.js +0 -2541
  547. package/lib/webrtc/call.js.map +0 -1
  548. package/lib/webrtc/callEventHandler.d.ts +0 -37
  549. package/lib/webrtc/callEventHandler.d.ts.map +0 -1
  550. package/lib/webrtc/callEventHandler.js +0 -344
  551. package/lib/webrtc/callEventHandler.js.map +0 -1
  552. package/lib/webrtc/callEventTypes.d.ts +0 -73
  553. package/lib/webrtc/callEventTypes.d.ts.map +0 -1
  554. package/lib/webrtc/callEventTypes.js +0 -13
  555. package/lib/webrtc/callEventTypes.js.map +0 -1
  556. package/lib/webrtc/callFeed.d.ts +0 -128
  557. package/lib/webrtc/callFeed.d.ts.map +0 -1
  558. package/lib/webrtc/callFeed.js +0 -289
  559. package/lib/webrtc/callFeed.js.map +0 -1
  560. package/lib/webrtc/groupCall.d.ts +0 -323
  561. package/lib/webrtc/groupCall.d.ts.map +0 -1
  562. package/lib/webrtc/groupCall.js +0 -1337
  563. package/lib/webrtc/groupCall.js.map +0 -1
  564. package/lib/webrtc/groupCallEventHandler.d.ts +0 -31
  565. package/lib/webrtc/groupCallEventHandler.d.ts.map +0 -1
  566. package/lib/webrtc/groupCallEventHandler.js +0 -178
  567. package/lib/webrtc/groupCallEventHandler.js.map +0 -1
  568. package/lib/webrtc/mediaHandler.d.ts +0 -89
  569. package/lib/webrtc/mediaHandler.d.ts.map +0 -1
  570. package/lib/webrtc/mediaHandler.js +0 -437
  571. package/lib/webrtc/mediaHandler.js.map +0 -1
  572. package/lib/webrtc/stats/callFeedStatsReporter.d.ts +0 -8
  573. package/lib/webrtc/stats/callFeedStatsReporter.d.ts.map +0 -1
  574. package/lib/webrtc/stats/callFeedStatsReporter.js +0 -82
  575. package/lib/webrtc/stats/callFeedStatsReporter.js.map +0 -1
  576. package/lib/webrtc/stats/callStatsReportGatherer.d.ts +0 -25
  577. package/lib/webrtc/stats/callStatsReportGatherer.d.ts.map +0 -1
  578. package/lib/webrtc/stats/callStatsReportGatherer.js +0 -199
  579. package/lib/webrtc/stats/callStatsReportGatherer.js.map +0 -1
  580. package/lib/webrtc/stats/callStatsReportSummary.d.ts +0 -17
  581. package/lib/webrtc/stats/callStatsReportSummary.d.ts.map +0 -1
  582. package/lib/webrtc/stats/callStatsReportSummary.js +0 -1
  583. package/lib/webrtc/stats/callStatsReportSummary.js.map +0 -1
  584. package/lib/webrtc/stats/connectionStats.d.ts +0 -28
  585. package/lib/webrtc/stats/connectionStats.d.ts.map +0 -1
  586. package/lib/webrtc/stats/connectionStats.js +0 -26
  587. package/lib/webrtc/stats/connectionStats.js.map +0 -1
  588. package/lib/webrtc/stats/connectionStatsBuilder.d.ts +0 -5
  589. package/lib/webrtc/stats/connectionStatsBuilder.d.ts.map +0 -1
  590. package/lib/webrtc/stats/connectionStatsBuilder.js +0 -27
  591. package/lib/webrtc/stats/connectionStatsBuilder.js.map +0 -1
  592. package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts +0 -7
  593. package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts.map +0 -1
  594. package/lib/webrtc/stats/connectionStatsReportBuilder.js +0 -121
  595. package/lib/webrtc/stats/connectionStatsReportBuilder.js.map +0 -1
  596. package/lib/webrtc/stats/groupCallStats.d.ts +0 -22
  597. package/lib/webrtc/stats/groupCallStats.d.ts.map +0 -1
  598. package/lib/webrtc/stats/groupCallStats.js +0 -78
  599. package/lib/webrtc/stats/groupCallStats.js.map +0 -1
  600. package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts +0 -10
  601. package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts.map +0 -1
  602. package/lib/webrtc/stats/media/mediaSsrcHandler.js +0 -57
  603. package/lib/webrtc/stats/media/mediaSsrcHandler.js.map +0 -1
  604. package/lib/webrtc/stats/media/mediaTrackHandler.d.ts +0 -12
  605. package/lib/webrtc/stats/media/mediaTrackHandler.d.ts.map +0 -1
  606. package/lib/webrtc/stats/media/mediaTrackHandler.js +0 -62
  607. package/lib/webrtc/stats/media/mediaTrackHandler.js.map +0 -1
  608. package/lib/webrtc/stats/media/mediaTrackStats.d.ts +0 -86
  609. package/lib/webrtc/stats/media/mediaTrackStats.d.ts.map +0 -1
  610. package/lib/webrtc/stats/media/mediaTrackStats.js +0 -142
  611. package/lib/webrtc/stats/media/mediaTrackStats.js.map +0 -1
  612. package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts +0 -22
  613. package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts.map +0 -1
  614. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js +0 -76
  615. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js.map +0 -1
  616. package/lib/webrtc/stats/statsReport.d.ts +0 -99
  617. package/lib/webrtc/stats/statsReport.d.ts.map +0 -1
  618. package/lib/webrtc/stats/statsReport.js +0 -32
  619. package/lib/webrtc/stats/statsReport.js.map +0 -1
  620. package/lib/webrtc/stats/statsReportEmitter.d.ts +0 -15
  621. package/lib/webrtc/stats/statsReportEmitter.d.ts.map +0 -1
  622. package/lib/webrtc/stats/statsReportEmitter.js +0 -33
  623. package/lib/webrtc/stats/statsReportEmitter.js.map +0 -1
  624. package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts +0 -16
  625. package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts.map +0 -1
  626. package/lib/webrtc/stats/summaryStatsReportGatherer.js +0 -116
  627. package/lib/webrtc/stats/summaryStatsReportGatherer.js.map +0 -1
  628. package/lib/webrtc/stats/trackStatsBuilder.d.ts +0 -19
  629. package/lib/webrtc/stats/trackStatsBuilder.d.ts.map +0 -1
  630. package/lib/webrtc/stats/trackStatsBuilder.js +0 -168
  631. package/lib/webrtc/stats/trackStatsBuilder.js.map +0 -1
  632. package/lib/webrtc/stats/transportStats.d.ts +0 -11
  633. package/lib/webrtc/stats/transportStats.d.ts.map +0 -1
  634. package/lib/webrtc/stats/transportStats.js +0 -1
  635. package/lib/webrtc/stats/transportStats.js.map +0 -1
  636. package/lib/webrtc/stats/transportStatsBuilder.d.ts +0 -5
  637. package/lib/webrtc/stats/transportStatsBuilder.d.ts.map +0 -1
  638. package/lib/webrtc/stats/transportStatsBuilder.js +0 -34
  639. package/lib/webrtc/stats/transportStatsBuilder.js.map +0 -1
  640. package/lib/webrtc/stats/valueFormatter.d.ts +0 -4
  641. package/lib/webrtc/stats/valueFormatter.d.ts.map +0 -1
  642. package/lib/webrtc/stats/valueFormatter.js +0 -25
  643. package/lib/webrtc/stats/valueFormatter.js.map +0 -1
  644. package/src/@types/AESEncryptedSecretStoragePayload.ts +0 -29
  645. package/src/@types/crypto.ts +0 -73
  646. package/src/@types/matrix-sdk-crypto-wasm.d.ts +0 -44
  647. package/src/common-crypto/CryptoBackend.ts +0 -302
  648. package/src/common-crypto/README.md +0 -4
  649. package/src/common-crypto/key-passphrase.ts +0 -43
  650. package/src/crypto/CrossSigning.ts +0 -773
  651. package/src/crypto/DeviceList.ts +0 -989
  652. package/src/crypto/EncryptionSetup.ts +0 -351
  653. package/src/crypto/OlmDevice.ts +0 -1500
  654. package/src/crypto/OutgoingRoomKeyRequestManager.ts +0 -485
  655. package/src/crypto/RoomList.ts +0 -70
  656. package/src/crypto/SecretSharing.ts +0 -240
  657. package/src/crypto/SecretStorage.ts +0 -136
  658. package/src/crypto/aes.ts +0 -23
  659. package/src/crypto/algorithms/base.ts +0 -236
  660. package/src/crypto/algorithms/index.ts +0 -20
  661. package/src/crypto/algorithms/megolm.ts +0 -2216
  662. package/src/crypto/algorithms/olm.ts +0 -381
  663. package/src/crypto/api.ts +0 -70
  664. package/src/crypto/backup.ts +0 -922
  665. package/src/crypto/crypto.ts +0 -18
  666. package/src/crypto/dehydration.ts +0 -272
  667. package/src/crypto/device-converter.ts +0 -45
  668. package/src/crypto/deviceinfo.ts +0 -158
  669. package/src/crypto/index.ts +0 -4418
  670. package/src/crypto/key_passphrase.ts +0 -42
  671. package/src/crypto/keybackup.ts +0 -47
  672. package/src/crypto/olmlib.ts +0 -539
  673. package/src/crypto/recoverykey.ts +0 -18
  674. package/src/crypto/store/base.ts +0 -348
  675. package/src/crypto/store/indexeddb-crypto-store-backend.ts +0 -1250
  676. package/src/crypto/store/indexeddb-crypto-store.ts +0 -845
  677. package/src/crypto/store/localStorage-crypto-store.ts +0 -579
  678. package/src/crypto/store/memory-crypto-store.ts +0 -680
  679. package/src/crypto/verification/Base.ts +0 -409
  680. package/src/crypto/verification/Error.ts +0 -76
  681. package/src/crypto/verification/IllegalMethod.ts +0 -50
  682. package/src/crypto/verification/QRCode.ts +0 -310
  683. package/src/crypto/verification/SAS.ts +0 -494
  684. package/src/crypto/verification/SASDecimal.ts +0 -37
  685. package/src/crypto/verification/request/Channel.ts +0 -34
  686. package/src/crypto/verification/request/InRoomChannel.ts +0 -371
  687. package/src/crypto/verification/request/ToDeviceChannel.ts +0 -354
  688. package/src/crypto/verification/request/VerificationRequest.ts +0 -976
  689. package/src/crypto-api/CryptoEvent.ts +0 -93
  690. package/src/crypto-api/CryptoEventHandlerMap.ts +0 -32
  691. package/src/crypto-api/index.ts +0 -1175
  692. package/src/crypto-api/key-passphrase.ts +0 -58
  693. package/src/crypto-api/keybackup.ts +0 -115
  694. package/src/crypto-api/recovery-key.ts +0 -69
  695. package/src/crypto-api/verification.ts +0 -408
  696. package/src/matrixrtc/CallMembership.ts +0 -247
  697. package/src/matrixrtc/LivekitFocus.ts +0 -39
  698. package/src/matrixrtc/MatrixRTCSession.ts +0 -1319
  699. package/src/matrixrtc/MatrixRTCSessionManager.ts +0 -166
  700. package/src/matrixrtc/focus.ts +0 -25
  701. package/src/matrixrtc/index.ts +0 -22
  702. package/src/matrixrtc/types.ts +0 -36
  703. package/src/rendezvous/MSC4108SignInWithQR.ts +0 -444
  704. package/src/rendezvous/RendezvousChannel.ts +0 -48
  705. package/src/rendezvous/RendezvousCode.ts +0 -25
  706. package/src/rendezvous/RendezvousError.ts +0 -26
  707. package/src/rendezvous/RendezvousFailureReason.ts +0 -49
  708. package/src/rendezvous/RendezvousIntent.ts +0 -20
  709. package/src/rendezvous/RendezvousTransport.ts +0 -58
  710. package/src/rendezvous/channels/MSC4108SecureChannel.ts +0 -270
  711. package/src/rendezvous/channels/index.ts +0 -17
  712. package/src/rendezvous/index.ts +0 -25
  713. package/src/rendezvous/transports/MSC4108RendezvousSession.ts +0 -270
  714. package/src/rendezvous/transports/index.ts +0 -17
  715. package/src/rust-crypto/CrossSigningIdentity.ts +0 -183
  716. package/src/rust-crypto/DehydratedDeviceManager.ts +0 -306
  717. package/src/rust-crypto/KeyClaimManager.ts +0 -86
  718. package/src/rust-crypto/OutgoingRequestProcessor.ts +0 -236
  719. package/src/rust-crypto/OutgoingRequestsManager.ts +0 -143
  720. package/src/rust-crypto/PerSessionKeyBackupDownloader.ts +0 -501
  721. package/src/rust-crypto/RoomEncryptor.ts +0 -352
  722. package/src/rust-crypto/backup.ts +0 -881
  723. package/src/rust-crypto/constants.ts +0 -18
  724. package/src/rust-crypto/device-converter.ts +0 -128
  725. package/src/rust-crypto/index.ts +0 -237
  726. package/src/rust-crypto/libolm_migration.ts +0 -530
  727. package/src/rust-crypto/rust-crypto.ts +0 -2205
  728. package/src/rust-crypto/secret-storage.ts +0 -60
  729. package/src/rust-crypto/verification.ts +0 -830
  730. package/src/secret-storage.ts +0 -693
  731. package/src/utils/decryptAESSecretStorageItem.ts +0 -54
  732. package/src/utils/encryptAESSecretStorageItem.ts +0 -73
  733. package/src/utils/internal/deriveKeys.ts +0 -63
  734. package/src/webrtc/audioContext.ts +0 -44
  735. package/src/webrtc/call.ts +0 -3074
  736. package/src/webrtc/callEventHandler.ts +0 -425
  737. package/src/webrtc/callEventTypes.ts +0 -93
  738. package/src/webrtc/callFeed.ts +0 -364
  739. package/src/webrtc/groupCall.ts +0 -1735
  740. package/src/webrtc/groupCallEventHandler.ts +0 -234
  741. package/src/webrtc/mediaHandler.ts +0 -484
  742. package/src/webrtc/stats/callFeedStatsReporter.ts +0 -94
  743. package/src/webrtc/stats/callStatsReportGatherer.ts +0 -219
  744. package/src/webrtc/stats/callStatsReportSummary.ts +0 -30
  745. package/src/webrtc/stats/connectionStats.ts +0 -47
  746. package/src/webrtc/stats/connectionStatsBuilder.ts +0 -28
  747. package/src/webrtc/stats/connectionStatsReportBuilder.ts +0 -140
  748. package/src/webrtc/stats/groupCallStats.ts +0 -93
  749. package/src/webrtc/stats/media/mediaSsrcHandler.ts +0 -57
  750. package/src/webrtc/stats/media/mediaTrackHandler.ts +0 -76
  751. package/src/webrtc/stats/media/mediaTrackStats.ts +0 -176
  752. package/src/webrtc/stats/media/mediaTrackStatsHandler.ts +0 -90
  753. package/src/webrtc/stats/statsReport.ts +0 -133
  754. package/src/webrtc/stats/statsReportEmitter.ts +0 -49
  755. package/src/webrtc/stats/summaryStatsReportGatherer.ts +0 -148
  756. package/src/webrtc/stats/trackStatsBuilder.ts +0 -207
  757. package/src/webrtc/stats/transportStats.ts +0 -26
  758. package/src/webrtc/stats/transportStatsBuilder.ts +0 -48
  759. package/src/webrtc/stats/valueFormatter.ts +0 -27
@@ -1 +1 @@
1
- {"version":3,"file":"event-timeline-set.js","names":["EventTimeline","logger","RoomEvent","TypedEventEmitter","RelationsContainer","DEBUG","debuglog","log","bind","DuplicateStrategy","EventTimelineSet","constructor","room","_this$room$relations","_this$room","_room$client","opts","arguments","length","undefined","client","thread","threadListType","_defineProperty","Map","timelineSupport","Boolean","liveTimeline","displayPendingEvents","pendingEvents","timelines","_eventIdToTimeline","filter","relations","getTimelines","getFilter","setFilter","getPendingEvents","getLiveTimeline","setLiveTimeline","timeline","eventIdToTimeline","eventId","get","replaceEventId","oldEventId","newEventId","existingTimeline","delete","set","resetLiveTimeline","backPaginationToken","forwardPaginationToken","resetAllTimelines","oldTimeline","newTimeline","forkLive","FORWARDS","fork","push","setPaginationToken","BACKWARDS","emit","TimelineReset","getTimelineForEvent","res","findEventById","tl","getEvents","find","ev","getId","addTimeline","Error","addEventsToTimeline","events","toStartOfTimeline","paginationToken","filterRoomTimeline","direction","inverseDirection","didUpdate","lastEventWasNew","event","addEventToTimeline","neighbour","getNeighbouringTimeline","info","existingIsLive","timelineIsLive","backwardsIsLive","forwardsIsLive","warn","setNeighbouringTimeline","concat","addLiveEvent","duplicateStrategy","fromCache","roomState","timelineWasEmpty","Replace","tlEvents","j","getState","setEventMetadata","toStartOfTimelineOrOpts","getTimelineSet","_this$thread","toString","id","aggregateParentEvent","aggregateChildEvent","canContain","_this$thread2","eventDebugString","threadRootId","addEvent","data","liveEvent","Timeline","insertEventIntoTimeline","_this$thread3","_this$thread4","parentEventId","relationEventId","parentEvent","timelineEvents","parentIndex","indexOf","insertIndex","nextEvent","getTs","insertEvent","handleRemoteEcho","localEvent","removeEvent","removed","compareEventOrdering","eventId1","eventId2","timeline1","timeline2","idx1","idx2","idx","evId","difference","threadId","shouldLiveInRoom","shouldLiveInThread","eventShouldLiveIn","_this$room2","roomId"],"sources":["../../src/models/event-timeline-set.ts"],"sourcesContent":["/*\nCopyright 2016 - 2021 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 { EventTimeline, IAddEventOptions } from \"./event-timeline.ts\";\nimport { MatrixEvent } from \"./event.ts\";\nimport { logger } from \"../logger.ts\";\nimport { Room, RoomEvent } from \"./room.ts\";\nimport { Filter } from \"../filter.ts\";\nimport { RoomState } from \"./room-state.ts\";\nimport { TypedEventEmitter } from \"./typed-event-emitter.ts\";\nimport { RelationsContainer } from \"./relations-container.ts\";\nimport { MatrixClient } from \"../client.ts\";\nimport { Thread, ThreadFilterType } from \"./thread.ts\";\n\nconst DEBUG = true;\n\n/* istanbul ignore next */\nlet debuglog: (...args: any[]) => void;\nif (DEBUG) {\n // using bind means that we get to keep useful line numbers in the console\n debuglog = logger.log.bind(logger);\n} else {\n /* istanbul ignore next */\n debuglog = function (): void {};\n}\n\ninterface IOpts {\n // Set to true to enable improved timeline support.\n timelineSupport?: boolean;\n // The filter object, if any, for this timelineSet.\n filter?: Filter;\n pendingEvents?: boolean;\n}\n\nexport enum DuplicateStrategy {\n Ignore = \"ignore\",\n Replace = \"replace\",\n}\n\nexport interface IRoomTimelineData {\n // the timeline the event was added to/removed from\n timeline: EventTimeline;\n // true if the event was a real-time event added to the end of the live timeline\n liveEvent?: boolean;\n}\n\nexport interface IAddEventToTimelineOptions\n extends Pick<IAddEventOptions, \"toStartOfTimeline\" | \"roomState\" | \"timelineWasEmpty\"> {\n /** Whether the sync response came from cache */\n fromCache?: boolean;\n}\n\nexport interface IAddLiveEventOptions\n extends Pick<IAddEventToTimelineOptions, \"fromCache\" | \"roomState\" | \"timelineWasEmpty\"> {\n /** Applies to events in the timeline only. If this is 'replace' then if a\n * duplicate is encountered, the event passed to this function will replace\n * the existing event in the timeline. If this is not specified, or is\n * 'ignore', then the event passed to this function will be ignored\n * entirely, preserving the existing event in the timeline. Events are\n * identical based on their event ID <b>only</b>. */\n duplicateStrategy?: DuplicateStrategy;\n}\n\ntype EmittedEvents = RoomEvent.Timeline | RoomEvent.TimelineReset;\n\nexport type EventTimelineSetHandlerMap = {\n /**\n * Fires whenever the timeline in a room is updated.\n * @param event - The matrix event which caused this event to fire.\n * @param room - The room, if any, whose timeline was updated.\n * @param toStartOfTimeline - True if this event was added to the start\n * @param removed - True if this event has just been removed from the timeline\n * (beginning; oldest) of the timeline e.g. due to pagination.\n *\n * @param data - more data about the event\n *\n * @example\n * ```\n * matrixClient.on(\"Room.timeline\",\n * function(event, room, toStartOfTimeline, removed, data) {\n * if (!toStartOfTimeline && data.liveEvent) {\n * var messageToAppend = room.timeline.[room.timeline.length - 1];\n * }\n * });\n * ```\n */\n [RoomEvent.Timeline]: (\n event: MatrixEvent,\n room: Room | undefined,\n toStartOfTimeline: boolean | undefined,\n removed: boolean,\n data: IRoomTimelineData,\n ) => void;\n /**\n * Fires whenever the live timeline in a room is reset.\n *\n * When we get a 'limited' sync (for example, after a network outage), we reset\n * the live timeline to be empty before adding the recent events to the new\n * timeline. This event is fired after the timeline is reset, and before the\n * new events are added.\n *\n * @param room - The room whose live timeline was reset, if any\n * @param timelineSet - timelineSet room whose live timeline was reset\n * @param resetAllTimelines - True if all timelines were reset.\n */\n [RoomEvent.TimelineReset]: (\n room: Room | undefined,\n timelineSet: EventTimelineSet,\n resetAllTimelines: boolean,\n ) => void;\n};\n\nexport class EventTimelineSet extends TypedEventEmitter<EmittedEvents, EventTimelineSetHandlerMap> {\n public readonly relations: RelationsContainer;\n private readonly timelineSupport: boolean;\n private readonly displayPendingEvents: boolean;\n private liveTimeline: EventTimeline;\n private timelines: EventTimeline[];\n private _eventIdToTimeline = new Map<string, EventTimeline>();\n private filter?: Filter;\n\n /**\n * Construct a set of EventTimeline objects, typically on behalf of a given\n * room. A room may have multiple EventTimelineSets for different levels\n * of filtering. The global notification list is also an EventTimelineSet, but\n * lacks a room.\n *\n * <p>This is an ordered sequence of timelines, which may or may not\n * be continuous. Each timeline lists a series of events, as well as tracking\n * the room state at the start and the end of the timeline (if appropriate).\n * It also tracks forward and backward pagination tokens, as well as containing\n * links to the next timeline in the sequence.\n *\n * <p>There is one special timeline - the 'live' timeline, which represents the\n * timeline to which events are being added in real-time as they are received\n * from the /sync API. Note that you should not retain references to this\n * timeline - even if it is the current timeline right now, it may not remain\n * so if the server gives us a timeline gap in /sync.\n *\n * <p>In order that we can find events from their ids later, we also maintain a\n * map from event_id to timeline and index.\n *\n * @param room - Room for this timelineSet. May be null for non-room cases, such as the\n * notification timeline.\n * @param opts - Options inherited from Room.\n * @param client - the Matrix client which owns this EventTimelineSet,\n * can be omitted if room is specified.\n * @param thread - the thread to which this timeline set relates.\n * @param threadListType - the type of thread list represented, if any\n * (e.g., All threads or My threads)\n */\n public constructor(\n public readonly room: Room | undefined,\n opts: IOpts = {},\n client?: MatrixClient,\n public readonly thread?: Thread,\n public readonly threadListType: ThreadFilterType | null = null,\n ) {\n super();\n\n this.timelineSupport = Boolean(opts.timelineSupport);\n this.liveTimeline = new EventTimeline(this);\n this.displayPendingEvents = opts.pendingEvents !== false;\n\n // just a list - *not* ordered.\n this.timelines = [this.liveTimeline];\n this._eventIdToTimeline = new Map<string, EventTimeline>();\n\n this.filter = opts.filter;\n\n this.relations = this.room?.relations ?? new RelationsContainer(room?.client ?? client!);\n }\n\n /**\n * Get all the timelines in this set\n * @returns the timelines in this set\n */\n public getTimelines(): EventTimeline[] {\n return this.timelines;\n }\n\n /**\n * Get the filter object this timeline set is filtered on, if any\n * @returns the optional filter for this timelineSet\n */\n public getFilter(): Filter | undefined {\n return this.filter;\n }\n\n /**\n * Set the filter object this timeline set is filtered on\n * (passed to the server when paginating via /messages).\n * @param filter - the filter for this timelineSet\n */\n public setFilter(filter?: Filter): void {\n this.filter = filter;\n }\n\n /**\n * Get the list of pending sent events for this timelineSet's room, filtered\n * by the timelineSet's filter if appropriate.\n *\n * @returns A list of the sent events\n * waiting for remote echo.\n *\n * @throws If `opts.pendingEventOrdering` was not 'detached'\n */\n public getPendingEvents(): MatrixEvent[] {\n if (!this.room || !this.displayPendingEvents) {\n return [];\n }\n\n return this.room.getPendingEvents();\n }\n /**\n * Get the live timeline for this room.\n *\n * @returns live timeline\n */\n public getLiveTimeline(): EventTimeline {\n return this.liveTimeline;\n }\n\n /**\n * Set the live timeline for this room.\n *\n * @returns live timeline\n */\n public setLiveTimeline(timeline: EventTimeline): void {\n this.liveTimeline = timeline;\n }\n\n /**\n * Return the timeline (if any) this event is in.\n * @param eventId - the eventId being sought\n * @returns timeline\n */\n public eventIdToTimeline(eventId: string): EventTimeline | undefined {\n return this._eventIdToTimeline.get(eventId);\n }\n\n /**\n * Track a new event as if it were in the same timeline as an old event,\n * replacing it.\n * @param oldEventId - event ID of the original event\n * @param newEventId - event ID of the replacement event\n */\n public replaceEventId(oldEventId: string, newEventId: string): void {\n const existingTimeline = this._eventIdToTimeline.get(oldEventId);\n if (existingTimeline) {\n this._eventIdToTimeline.delete(oldEventId);\n this._eventIdToTimeline.set(newEventId, existingTimeline);\n }\n }\n\n /**\n * Reset the live timeline, and start a new one.\n *\n * <p>This is used when /sync returns a 'limited' timeline.\n *\n * @param backPaginationToken - token for back-paginating the new timeline\n * @param forwardPaginationToken - token for forward-paginating the old live timeline,\n * if absent or null, all timelines are reset.\n *\n * @remarks\n * Fires {@link RoomEvent.TimelineReset}\n */\n public resetLiveTimeline(backPaginationToken?: string, forwardPaginationToken?: string): void {\n // Each EventTimeline has RoomState objects tracking the state at the start\n // and end of that timeline. The copies at the end of the live timeline are\n // special because they will have listeners attached to monitor changes to\n // the current room state, so we move this RoomState from the end of the\n // current live timeline to the end of the new one and, if necessary,\n // replace it with a newly created one. We also make a copy for the start\n // of the new timeline.\n\n // if timeline support is disabled, forget about the old timelines\n const resetAllTimelines = !this.timelineSupport || !forwardPaginationToken;\n\n const oldTimeline = this.liveTimeline;\n const newTimeline = resetAllTimelines\n ? oldTimeline.forkLive(EventTimeline.FORWARDS)\n : oldTimeline.fork(EventTimeline.FORWARDS);\n\n if (resetAllTimelines) {\n this.timelines = [newTimeline];\n this._eventIdToTimeline = new Map<string, EventTimeline>();\n } else {\n this.timelines.push(newTimeline);\n }\n\n if (forwardPaginationToken) {\n // Now set the forward pagination token on the old live timeline\n // so it can be forward-paginated.\n oldTimeline.setPaginationToken(forwardPaginationToken, EventTimeline.FORWARDS);\n }\n\n // make sure we set the pagination token before firing timelineReset,\n // otherwise clients which start back-paginating will fail, and then get\n // stuck without realising that they *can* back-paginate.\n newTimeline.setPaginationToken(backPaginationToken ?? null, EventTimeline.BACKWARDS);\n\n // Now we can swap the live timeline to the new one.\n this.liveTimeline = newTimeline;\n this.emit(RoomEvent.TimelineReset, this.room, this, resetAllTimelines);\n }\n\n /**\n * Get the timeline which contains the given event, if any\n *\n * @param eventId - event ID to look for\n * @returns timeline containing\n * the given event, or null if unknown\n */\n public getTimelineForEvent(eventId?: string): EventTimeline | null {\n if (eventId === null || eventId === undefined) {\n return null;\n }\n const res = this._eventIdToTimeline.get(eventId);\n return res === undefined ? null : res;\n }\n\n /**\n * Get an event which is stored in our timelines\n *\n * @param eventId - event ID to look for\n * @returns the given event, or undefined if unknown\n */\n public findEventById(eventId: string): MatrixEvent | undefined {\n const tl = this.getTimelineForEvent(eventId);\n if (!tl) {\n return undefined;\n }\n return tl.getEvents().find(function (ev) {\n return ev.getId() == eventId;\n });\n }\n\n /**\n * Add a new timeline to this timeline list\n *\n * @returns newly-created timeline\n */\n public addTimeline(): EventTimeline {\n if (!this.timelineSupport) {\n throw new Error(\n \"timeline support is disabled. Set the 'timelineSupport'\" +\n \" parameter to true when creating MatrixClient to enable\" +\n \" it.\",\n );\n }\n\n const timeline = new EventTimeline(this);\n this.timelines.push(timeline);\n return timeline;\n }\n\n /**\n * Add events to a timeline\n *\n * <p>Will fire \"Room.timeline\" for each event added.\n *\n * @param events - A list of events to add.\n *\n * @param toStartOfTimeline - True to add these events to the start\n * (oldest) instead of the end (newest) of the timeline. If true, the oldest\n * event will be the <b>last</b> element of 'events'.\n *\n * @param timeline - timeline to\n * add events to.\n *\n * @param paginationToken - token for the next batch of events\n *\n * @remarks\n * Fires {@link RoomEvent.Timeline}\n *\n */\n public addEventsToTimeline(\n events: MatrixEvent[],\n toStartOfTimeline: boolean,\n timeline: EventTimeline,\n paginationToken?: string | null,\n ): void {\n if (!timeline) {\n throw new Error(\"'timeline' not specified for EventTimelineSet.addEventsToTimeline\");\n }\n\n if (!toStartOfTimeline && timeline == this.liveTimeline) {\n throw new Error(\n \"EventTimelineSet.addEventsToTimeline cannot be used for adding events to \" +\n \"the live timeline - use Room.addLiveEvents instead\",\n );\n }\n\n if (this.filter) {\n events = this.filter.filterRoomTimeline(events);\n if (!events.length) {\n return;\n }\n }\n\n const direction = toStartOfTimeline ? EventTimeline.BACKWARDS : EventTimeline.FORWARDS;\n const inverseDirection = toStartOfTimeline ? EventTimeline.FORWARDS : EventTimeline.BACKWARDS;\n\n // Adding events to timelines can be quite complicated. The following\n // illustrates some of the corner-cases.\n //\n // Let's say we start by knowing about four timelines. timeline3 and\n // timeline4 are neighbours:\n //\n // timeline1 timeline2 timeline3 timeline4\n // [M] [P] [S] <------> [T]\n //\n // Now we paginate timeline1, and get the following events from the server:\n // [M, N, P, R, S, T, U].\n //\n // 1. First, we ignore event M, since we already know about it.\n //\n // 2. Next, we append N to timeline 1.\n //\n // 3. Next, we don't add event P, since we already know about it,\n // but we do link together the timelines. We now have:\n //\n // timeline1 timeline2 timeline3 timeline4\n // [M, N] <---> [P] [S] <------> [T]\n //\n // 4. Now we add event R to timeline2:\n //\n // timeline1 timeline2 timeline3 timeline4\n // [M, N] <---> [P, R] [S] <------> [T]\n //\n // Note that we have switched the timeline we are working on from\n // timeline1 to timeline2.\n //\n // 5. We ignore event S, but again join the timelines:\n //\n // timeline1 timeline2 timeline3 timeline4\n // [M, N] <---> [P, R] <---> [S] <------> [T]\n //\n // 6. We ignore event T, and the timelines are already joined, so there\n // is nothing to do.\n //\n // 7. Finally, we add event U to timeline4:\n //\n // timeline1 timeline2 timeline3 timeline4\n // [M, N] <---> [P, R] <---> [S] <------> [T, U]\n //\n // The important thing to note in the above is what happened when we\n // already knew about a given event:\n //\n // - if it was appropriate, we joined up the timelines (steps 3, 5).\n // - in any case, we started adding further events to the timeline which\n // contained the event we knew about (steps 3, 5, 6).\n //\n //\n // So much for adding events to the timeline. But what do we want to do\n // with the pagination token?\n //\n // In the case above, we will be given a pagination token which tells us how to\n // get events beyond 'U' - in this case, it makes sense to store this\n // against timeline4. But what if timeline4 already had 'U' and beyond? in\n // that case, our best bet is to throw away the pagination token we were\n // given and stick with whatever token timeline4 had previously. In short,\n // we want to only store the pagination token if the last event we receive\n // is one we didn't previously know about.\n //\n // We make an exception for this if it turns out that we already knew about\n // *all* of the events, and we weren't able to join up any timelines. When\n // that happens, it means our existing pagination token is faulty, since it\n // is only telling us what we already know. Rather than repeatedly\n // paginating with the same token, we might as well use the new pagination\n // token in the hope that we eventually work our way out of the mess.\n\n let didUpdate = false;\n let lastEventWasNew = false;\n for (const event of events) {\n const eventId = event.getId()!;\n\n const existingTimeline = this._eventIdToTimeline.get(eventId);\n\n if (!existingTimeline) {\n // we don't know about this event yet. Just add it to the timeline.\n this.addEventToTimeline(event, timeline, {\n toStartOfTimeline,\n });\n lastEventWasNew = true;\n didUpdate = true;\n continue;\n }\n\n lastEventWasNew = false;\n\n if (existingTimeline == timeline) {\n debuglog(\"Event \" + eventId + \" already in timeline \" + timeline);\n continue;\n }\n\n const neighbour = timeline.getNeighbouringTimeline(direction);\n if (neighbour) {\n // this timeline already has a neighbour in the relevant direction;\n // let's assume the timelines are already correctly linked up, and\n // skip over to it.\n //\n // there's probably some edge-case here where we end up with an\n // event which is in a timeline a way down the chain, and there is\n // a break in the chain somewhere. But I can't really imagine how\n // that would happen, so I'm going to ignore it for now.\n //\n if (existingTimeline == neighbour) {\n debuglog(\"Event \" + eventId + \" in neighbouring timeline - \" + \"switching to \" + existingTimeline);\n } else {\n debuglog(\"Event \" + eventId + \" already in a different \" + \"timeline \" + existingTimeline);\n }\n timeline = existingTimeline;\n continue;\n }\n\n // time to join the timelines.\n logger.info(\n \"Already have timeline for \" + eventId + \" - joining timeline \" + timeline + \" to \" + existingTimeline,\n );\n\n // Variables to keep the line length limited below.\n const existingIsLive = existingTimeline === this.liveTimeline;\n const timelineIsLive = timeline === this.liveTimeline;\n\n const backwardsIsLive = direction === EventTimeline.BACKWARDS && existingIsLive;\n const forwardsIsLive = direction === EventTimeline.FORWARDS && timelineIsLive;\n\n if (backwardsIsLive || forwardsIsLive) {\n // The live timeline should never be spliced into a non-live position.\n // We use independent logging to better discover the problem at a glance.\n if (backwardsIsLive) {\n logger.warn(\n \"Refusing to set a preceding existingTimeLine on our \" +\n \"timeline as the existingTimeLine is live (\" +\n existingTimeline +\n \")\",\n );\n }\n if (forwardsIsLive) {\n logger.warn(\n \"Refusing to set our preceding timeline on a existingTimeLine \" +\n \"as our timeline is live (\" +\n timeline +\n \")\",\n );\n }\n continue; // abort splicing - try next event\n }\n\n timeline.setNeighbouringTimeline(existingTimeline, direction);\n existingTimeline.setNeighbouringTimeline(timeline, inverseDirection);\n\n timeline = existingTimeline;\n didUpdate = true;\n }\n\n // see above - if the last event was new to us, or if we didn't find any\n // new information, we update the pagination token for whatever\n // timeline we ended up on.\n if (lastEventWasNew || !didUpdate) {\n if (direction === EventTimeline.FORWARDS && timeline === this.liveTimeline) {\n logger.warn({ lastEventWasNew, didUpdate }); // for debugging\n logger.warn(\n `Refusing to set forwards pagination token of live timeline ` + `${timeline} to ${paginationToken}`,\n );\n return;\n }\n timeline.setPaginationToken(paginationToken ?? null, direction);\n }\n }\n\n /**\n * Add an event to the end of this live timeline.\n *\n * @param event - Event to be added\n * @param options - addLiveEvent options\n */\n public addLiveEvent(\n event: MatrixEvent,\n { duplicateStrategy, fromCache, roomState, timelineWasEmpty }: IAddLiveEventOptions = {},\n ): void {\n if (this.filter) {\n const events = this.filter.filterRoomTimeline([event]);\n if (!events.length) {\n return;\n }\n }\n\n const timeline = this._eventIdToTimeline.get(event.getId()!);\n if (timeline) {\n if (duplicateStrategy === DuplicateStrategy.Replace) {\n debuglog(\"EventTimelineSet.addLiveEvent: replacing duplicate event \" + event.getId());\n const tlEvents = timeline.getEvents();\n for (let j = 0; j < tlEvents.length; j++) {\n if (tlEvents[j].getId() === event.getId()) {\n // still need to set the right metadata on this event\n if (!roomState) {\n roomState = timeline.getState(EventTimeline.FORWARDS);\n }\n EventTimeline.setEventMetadata(event, roomState!, false);\n tlEvents[j] = event;\n\n // XXX: we need to fire an event when this happens.\n break;\n }\n }\n } else {\n debuglog(\"EventTimelineSet.addLiveEvent: ignoring duplicate event \" + event.getId());\n }\n return;\n }\n\n this.addEventToTimeline(event, this.liveTimeline, {\n toStartOfTimeline: false,\n fromCache,\n roomState,\n timelineWasEmpty,\n });\n }\n\n /**\n * Add event to the given timeline, and emit Room.timeline. Assumes\n * we have already checked we don't know about this event.\n *\n * Will fire \"Room.timeline\" for each event added.\n *\n * @param event - the event to add\n * @param timeline - the timeline onto which to add it\n * @param options - addEventToTimeline options\n *\n * @remarks\n * Fires {@link RoomEvent.Timeline}\n */\n public addEventToTimeline(\n event: MatrixEvent,\n timeline: EventTimeline,\n { toStartOfTimeline, fromCache, roomState, timelineWasEmpty }: IAddEventToTimelineOptions,\n ): void;\n /**\n * @deprecated In favor of the overload with `IAddEventToTimelineOptions`\n */\n public addEventToTimeline(\n event: MatrixEvent,\n timeline: EventTimeline,\n toStartOfTimeline: boolean,\n fromCache?: boolean,\n roomState?: RoomState,\n ): void;\n public addEventToTimeline(\n event: MatrixEvent,\n timeline: EventTimeline,\n toStartOfTimelineOrOpts: boolean | IAddEventToTimelineOptions,\n fromCache = false,\n roomState?: RoomState,\n ): void {\n let toStartOfTimeline = !!toStartOfTimelineOrOpts;\n let timelineWasEmpty: boolean | undefined;\n if (typeof toStartOfTimelineOrOpts === \"object\") {\n ({ toStartOfTimeline, fromCache = false, roomState, timelineWasEmpty } = toStartOfTimelineOrOpts);\n } else if (toStartOfTimelineOrOpts !== undefined) {\n // Deprecation warning\n // FIXME: Remove after 2023-06-01 (technical debt)\n logger.warn(\n \"Overload deprecated: \" +\n \"`EventTimelineSet.addEventToTimeline(event, timeline, toStartOfTimeline, fromCache?, roomState?)` \" +\n \"is deprecated in favor of the overload with \" +\n \"`EventTimelineSet.addEventToTimeline(event, timeline, IAddEventToTimelineOptions)`\",\n );\n }\n\n if (timeline.getTimelineSet() !== this) {\n throw new Error(`EventTimelineSet.addEventToTimeline: Timeline=${timeline.toString()} does not belong \" +\n \"in timelineSet(threadId=${this.thread?.id})`);\n }\n\n const eventId = event.getId()!;\n this.relations.aggregateParentEvent(event);\n this.relations.aggregateChildEvent(event, this);\n\n // Make sure events don't get mixed in timelines they shouldn't be in (e.g. a\n // threaded message should not be in the main timeline).\n //\n // We can only run this check for timelines with a `room` because `canContain`\n // requires it\n if (this.room && !this.canContain(event)) {\n let eventDebugString = `event=${eventId}`;\n if (event.threadRootId) {\n eventDebugString += `(belongs to thread=${event.threadRootId})`;\n }\n logger.warn(\n `EventTimelineSet.addEventToTimeline: Ignoring ${eventDebugString} that does not belong ` +\n `in timeline=${timeline.toString()} timelineSet(threadId=${this.thread?.id})`,\n );\n return;\n }\n\n timeline.addEvent(event, {\n toStartOfTimeline,\n roomState,\n timelineWasEmpty,\n });\n this._eventIdToTimeline.set(eventId, timeline);\n\n const data: IRoomTimelineData = {\n timeline: timeline,\n liveEvent: !toStartOfTimeline && timeline == this.liveTimeline && !fromCache,\n };\n this.emit(RoomEvent.Timeline, event, this.room, Boolean(toStartOfTimeline), false, data);\n }\n\n /**\n * Insert event to the given timeline, and emit Room.timeline. Assumes\n * we have already checked we don't know about this event.\n *\n * TEMPORARY: until we have recursive relations, we need this function\n * to exist to allow us to insert events in timeline order, which is our\n * best guess for Sync Order.\n * This is a copy of addEventToTimeline above, modified to insert the event\n * after the event it relates to, and before any event with a later\n * timestamp. This is our best guess at Sync Order.\n *\n * Will fire \"Room.timeline\" for each event added.\n *\n * @internal\n *\n * @remarks\n * Fires {@link RoomEvent.Timeline}\n */\n public insertEventIntoTimeline(event: MatrixEvent, timeline: EventTimeline, roomState: RoomState): void {\n if (timeline.getTimelineSet() !== this) {\n throw new Error(`EventTimelineSet.insertEventIntoTimeline: Timeline=${timeline.toString()} does not belong \" +\n \"in timelineSet(threadId=${this.thread?.id})`);\n }\n\n const eventId = event.getId()!;\n this.relations.aggregateParentEvent(event);\n this.relations.aggregateChildEvent(event, this);\n\n // Make sure events don't get mixed in timelines they shouldn't be in (e.g. a\n // threaded message should not be in the main timeline).\n //\n // We can only run this check for timelines with a `room` because `canContain`\n // requires it\n if (this.room && !this.canContain(event)) {\n let eventDebugString = `event=${eventId}`;\n if (event.threadRootId) {\n eventDebugString += `(belongs to thread=${event.threadRootId})`;\n }\n logger.warn(\n `EventTimelineSet.insertEventIntoTimeline: Ignoring ${eventDebugString} that does not belong ` +\n `in timeline=${timeline.toString()} timelineSet(threadId=${this.thread?.id})`,\n );\n return;\n }\n\n // Find the event that this event is related to - the \"parent\"\n const parentEventId = event.relationEventId;\n if (!parentEventId) {\n // Not related to anything - we just append\n this.addEventToTimeline(event, timeline, {\n toStartOfTimeline: false,\n fromCache: false,\n timelineWasEmpty: false,\n roomState,\n });\n return;\n }\n\n const parentEvent = this.findEventById(parentEventId);\n\n const timelineEvents = timeline.getEvents();\n\n // Start searching from the parent event, or if it's not loaded, start\n // at the beginning and insert purely using timestamp order.\n const parentIndex = parentEvent !== undefined ? timelineEvents.indexOf(parentEvent) : 0;\n let insertIndex = parentIndex;\n for (; insertIndex < timelineEvents.length; insertIndex++) {\n const nextEvent = timelineEvents[insertIndex];\n if (nextEvent.getTs() > event.getTs()) {\n // We found an event later than ours, so insert before that.\n break;\n }\n }\n // If we got to the end of the loop, insertIndex points at the end of\n // the list.\n\n timeline.insertEvent(event, insertIndex, roomState);\n this._eventIdToTimeline.set(eventId, timeline);\n\n const data: IRoomTimelineData = {\n timeline: timeline,\n // The purpose of this method is inserting events in the middle of the\n // timeline, so the events are, by definition, not live (whether or not\n // we're adding them to the live timeline).\n liveEvent: false,\n };\n this.emit(RoomEvent.Timeline, event, this.room, false, false, data);\n }\n\n /**\n * Replaces event with ID oldEventId with one with newEventId, if oldEventId is\n * recognised. Otherwise, add to the live timeline. Used to handle remote echos.\n *\n * @param localEvent - the new event to be added to the timeline\n * @param oldEventId - the ID of the original event\n * @param newEventId - the ID of the replacement event\n *\n * @remarks\n * Fires {@link RoomEvent.Timeline}\n */\n public handleRemoteEcho(localEvent: MatrixEvent, oldEventId: string, newEventId: string): void {\n // XXX: why don't we infer newEventId from localEvent?\n const existingTimeline = this._eventIdToTimeline.get(oldEventId);\n if (existingTimeline) {\n this._eventIdToTimeline.delete(oldEventId);\n this._eventIdToTimeline.set(newEventId, existingTimeline);\n } else if (!this.filter || this.filter.filterRoomTimeline([localEvent]).length) {\n this.addEventToTimeline(localEvent, this.liveTimeline, {\n toStartOfTimeline: false,\n });\n }\n }\n\n /**\n * Removes a single event from this room.\n *\n * @param eventId - The id of the event to remove\n *\n * @returns the removed event, or null if the event was not found\n * in this room.\n */\n public removeEvent(eventId: string): MatrixEvent | null {\n const timeline = this._eventIdToTimeline.get(eventId);\n if (!timeline) {\n return null;\n }\n\n const removed = timeline.removeEvent(eventId);\n if (removed) {\n this._eventIdToTimeline.delete(eventId);\n const data = {\n timeline: timeline,\n };\n this.emit(RoomEvent.Timeline, removed, this.room, undefined, true, data);\n }\n return removed;\n }\n\n /**\n * Determine where two events appear in the timeline relative to one another\n *\n * @param eventId1 - The id of the first event\n * @param eventId2 - The id of the second event\n\n * @returns -1 if eventId1 precedes eventId2, and +1 eventId1 succeeds\n * eventId2. 0 if they are the same event; null if we can't tell (either\n * because we don't know about one of the events, or because they are in\n * separate timelines which don't join up).\n */\n public compareEventOrdering(eventId1: string, eventId2: string): number | null {\n if (eventId1 == eventId2) {\n // optimise this case\n return 0;\n }\n\n const timeline1 = this._eventIdToTimeline.get(eventId1);\n const timeline2 = this._eventIdToTimeline.get(eventId2);\n\n if (timeline1 === undefined) {\n return null;\n }\n if (timeline2 === undefined) {\n return null;\n }\n\n if (timeline1 === timeline2) {\n // both events are in the same timeline - figure out their relative indices\n let idx1: number | undefined = undefined;\n let idx2: number | undefined = undefined;\n const events = timeline1.getEvents();\n for (let idx = 0; idx < events.length && (idx1 === undefined || idx2 === undefined); idx++) {\n const evId = events[idx].getId();\n if (evId == eventId1) {\n idx1 = idx;\n }\n if (evId == eventId2) {\n idx2 = idx;\n }\n }\n const difference = idx1! - idx2!;\n\n // Return the sign of difference.\n if (difference < 0) {\n return -1;\n } else if (difference > 0) {\n return 1;\n } else {\n return 0;\n }\n }\n\n // the events are in different timelines. Iterate through the\n // linkedlist to see which comes first.\n\n // first work forwards from timeline1\n let tl: EventTimeline | null = timeline1;\n while (tl) {\n if (tl === timeline2) {\n // timeline1 is before timeline2\n return -1;\n }\n tl = tl.getNeighbouringTimeline(EventTimeline.FORWARDS);\n }\n\n // now try backwards from timeline1\n tl = timeline1;\n while (tl) {\n if (tl === timeline2) {\n // timeline2 is before timeline1\n return 1;\n }\n tl = tl.getNeighbouringTimeline(EventTimeline.BACKWARDS);\n }\n\n // the timelines are not contiguous.\n return null;\n }\n\n /**\n * Determine whether a given event can sanely be added to this event timeline set,\n * for timeline sets relating to a thread, only return true for events in the same\n * thread timeline, for timeline sets not relating to a thread only return true\n * for events which should be shown in the main room timeline.\n * Requires the `room` property to have been set at EventTimelineSet construction time.\n *\n * @param event - the event to check whether it belongs to this timeline set.\n * @throws Error if `room` was not set when constructing this timeline set.\n * @returns whether the event belongs to this timeline set.\n */\n public canContain(event: MatrixEvent): boolean {\n if (!this.room) {\n throw new Error(\n \"Cannot call `EventTimelineSet::canContain without a `room` set. \" +\n \"Set the room when creating the EventTimelineSet to call this method.\",\n );\n }\n\n const { threadId, shouldLiveInRoom, shouldLiveInThread } = this.room.eventShouldLiveIn(event);\n\n if (this.thread) {\n return this.thread.id === threadId;\n }\n\n if (!shouldLiveInRoom && !shouldLiveInThread) {\n logger.warn(\n `EventTimelineSet:canContain event encountered which cannot be added to any timeline roomId=${\n this.room?.roomId\n } eventId=${event.getId()} threadId=${event.threadRootId}`,\n );\n }\n\n return shouldLiveInRoom;\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,aAAa,QAA0B,qBAAqB;AAErE,SAASC,MAAM,QAAQ,cAAc;AACrC,SAAeC,SAAS,QAAQ,WAAW;AAG3C,SAASC,iBAAiB,QAAQ,0BAA0B;AAC5D,SAASC,kBAAkB,QAAQ,0BAA0B;AAI7D,IAAMC,K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Y,CAC5D,CAAC;IACL;IAEA,OAAOiC,gBAAgB;EAC3B;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"event-timeline-set.js","names":["EventTimeline","logger","RoomEvent","TypedEventEmitter","RelationsContainer","DEBUG","debuglog","log","bind","DuplicateStrategy","EventTimelineSet","constructor","room","_this$room$relations","_this$room","_room$client","opts","arguments","length","undefined","client","thread","threadListType","_defineProperty","Map","timelineSupport","Boolean","liveTimeline","displayPendingEvents","pendingEvents","timelines","_eventIdToTimeline","filter","relations","getTimelines","getFilter","setFilter","getPendingEvents","getLiveTimeline","setLiveTimeline","timeline","eventIdToTimeline","eventId","get","replaceEventId","oldEventId","newEventId","existingTimeline","delete","set","resetLiveTimeline","backPaginationToken","forwardPaginationToken","resetAllTimelines","oldTimeline","newTimeline","forkLive","FORWARDS","fork","push","setPaginationToken","BACKWARDS","emit","TimelineReset","getTimelineForEvent","res","findEventById","tl","getEvents","find","ev","getId","addTimeline","Error","addEventsToTimeline","events","toStartOfTimeline","addToState","paginationToken","filterRoomTimeline","direction","inverseDirection","didUpdate","lastEventWasNew","event","addEventToTimeline","neighbour","getNeighbouringTimeline","info","existingIsLive","timelineIsLive","backwardsIsLive","forwardsIsLive","warn","setNeighbouringTimeline","concat","addLiveEvent","_ref","duplicateStrategy","fromCache","roomState","timelineWasEmpty","Replace","tlEvents","j","getState","setEventMetadata","_ref2","getTimelineSet","_this$thread","toString","id","aggregateParentEvent","aggregateChildEvent","canContain","_this$thread2","eventDebugString","threadRootId","addEvent","data","liveEvent","Timeline","insertEventIntoTimeline","_this$thread3","_this$thread4","parentEventId","relationEventId","parentEvent","timelineEvents","parentIndex","indexOf","insertIndex","nextEvent","getTs","insertEvent","handleRemoteEcho","localEvent","removeEvent","removed","compareEventOrdering","eventId1","eventId2","timeline1","timeline2","idx1","idx2","idx","evId","difference","threadId","shouldLiveInRoom","shouldLiveInThread","eventShouldLiveIn","_this$room2","roomId"],"sources":["../../src/models/event-timeline-set.ts"],"sourcesContent":["/*\nCopyright 2016 - 2021 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 { EventTimeline, IAddEventOptions } from \"./event-timeline.ts\";\nimport { MatrixEvent } from \"./event.ts\";\nimport { logger } from \"../logger.ts\";\nimport { Room, RoomEvent } from \"./room.ts\";\nimport { Filter } from \"../filter.ts\";\nimport { RoomState } from \"./room-state.ts\";\nimport { TypedEventEmitter } from \"./typed-event-emitter.ts\";\nimport { RelationsContainer } from \"./relations-container.ts\";\nimport { MatrixClient } from \"../client.ts\";\nimport { Thread, ThreadFilterType } from \"./thread.ts\";\n\nconst DEBUG = true;\n\n/* istanbul ignore next */\nlet debuglog: (...args: any[]) => void;\nif (DEBUG) {\n // using bind means that we get to keep useful line numbers in the console\n debuglog = logger.log.bind(logger);\n} else {\n /* istanbul ignore next */\n debuglog = function (): void {};\n}\n\ninterface IOpts {\n // Set to true to enable improved timeline support.\n timelineSupport?: boolean;\n // The filter object, if any, for this timelineSet.\n filter?: Filter;\n pendingEvents?: boolean;\n}\n\nexport enum DuplicateStrategy {\n Ignore = \"ignore\",\n Replace = \"replace\",\n}\n\nexport interface IRoomTimelineData {\n // the timeline the event was added to/removed from\n timeline: EventTimeline;\n // true if the event was a real-time event added to the end of the live timeline\n liveEvent?: boolean;\n}\n\nexport interface IAddEventToTimelineOptions\n extends Pick<IAddEventOptions, \"toStartOfTimeline\" | \"roomState\" | \"timelineWasEmpty\" | \"addToState\"> {\n /** Whether the sync response came from cache */\n fromCache?: boolean;\n}\n\nexport interface IAddLiveEventOptions\n extends Pick<IAddEventToTimelineOptions, \"fromCache\" | \"roomState\" | \"timelineWasEmpty\" | \"addToState\"> {\n /** Applies to events in the timeline only. If this is 'replace' then if a\n * duplicate is encountered, the event passed to this function will replace\n * the existing event in the timeline. If this is not specified, or is\n * 'ignore', then the event passed to this function will be ignored\n * entirely, preserving the existing event in the timeline. Events are\n * identical based on their event ID <b>only</b>. */\n duplicateStrategy?: DuplicateStrategy;\n}\n\ntype EmittedEvents = RoomEvent.Timeline | RoomEvent.TimelineReset;\n\nexport type EventTimelineSetHandlerMap = {\n /**\n * Fires whenever the timeline in a room is updated.\n * @param event - The matrix event which caused this event to fire.\n * @param room - The room, if any, whose timeline was updated.\n * @param toStartOfTimeline - True if this event was added to the start\n * @param removed - True if this event has just been removed from the timeline\n * (beginning; oldest) of the timeline e.g. due to pagination.\n *\n * @param data - more data about the event\n *\n * @example\n * ```\n * matrixClient.on(\"Room.timeline\",\n * function(event, room, toStartOfTimeline, removed, data) {\n * if (!toStartOfTimeline && data.liveEvent) {\n * var messageToAppend = room.timeline.[room.timeline.length - 1];\n * }\n * });\n * ```\n */\n [RoomEvent.Timeline]: (\n event: MatrixEvent,\n room: Room | undefined,\n toStartOfTimeline: boolean | undefined,\n removed: boolean,\n data: IRoomTimelineData,\n ) => void;\n /**\n * Fires whenever the live timeline in a room is reset.\n *\n * When we get a 'limited' sync (for example, after a network outage), we reset\n * the live timeline to be empty before adding the recent events to the new\n * timeline. This event is fired after the timeline is reset, and before the\n * new events are added.\n *\n * @param room - The room whose live timeline was reset, if any\n * @param timelineSet - timelineSet room whose live timeline was reset\n * @param resetAllTimelines - True if all timelines were reset.\n */\n [RoomEvent.TimelineReset]: (\n room: Room | undefined,\n timelineSet: EventTimelineSet,\n resetAllTimelines: boolean,\n ) => void;\n};\n\nexport class EventTimelineSet extends TypedEventEmitter<EmittedEvents, EventTimelineSetHandlerMap> {\n public readonly relations: RelationsContainer;\n private readonly timelineSupport: boolean;\n private readonly displayPendingEvents: boolean;\n private liveTimeline: EventTimeline;\n private timelines: EventTimeline[];\n private _eventIdToTimeline = new Map<string, EventTimeline>();\n private filter?: Filter;\n\n /**\n * Construct a set of EventTimeline objects, typically on behalf of a given\n * room. A room may have multiple EventTimelineSets for different levels\n * of filtering. The global notification list is also an EventTimelineSet, but\n * lacks a room.\n *\n * <p>This is an ordered sequence of timelines, which may or may not\n * be continuous. Each timeline lists a series of events, as well as tracking\n * the room state at the start and the end of the timeline (if appropriate).\n * It also tracks forward and backward pagination tokens, as well as containing\n * links to the next timeline in the sequence.\n *\n * <p>There is one special timeline - the 'live' timeline, which represents the\n * timeline to which events are being added in real-time as they are received\n * from the /sync API. Note that you should not retain references to this\n * timeline - even if it is the current timeline right now, it may not remain\n * so if the server gives us a timeline gap in /sync.\n *\n * <p>In order that we can find events from their ids later, we also maintain a\n * map from event_id to timeline and index.\n *\n * @param room - Room for this timelineSet. May be null for non-room cases, such as the\n * notification timeline.\n * @param opts - Options inherited from Room.\n * @param client - the Matrix client which owns this EventTimelineSet,\n * can be omitted if room is specified.\n * @param thread - the thread to which this timeline set relates.\n * @param threadListType - the type of thread list represented, if any\n * (e.g., All threads or My threads)\n */\n public constructor(\n public readonly room: Room | undefined,\n opts: IOpts = {},\n client?: MatrixClient,\n public readonly thread?: Thread,\n public readonly threadListType: ThreadFilterType | null = null,\n ) {\n super();\n\n this.timelineSupport = Boolean(opts.timelineSupport);\n this.liveTimeline = new EventTimeline(this);\n this.displayPendingEvents = opts.pendingEvents !== false;\n\n // just a list - *not* ordered.\n this.timelines = [this.liveTimeline];\n this._eventIdToTimeline = new Map<string, EventTimeline>();\n\n this.filter = opts.filter;\n\n this.relations = this.room?.relations ?? new RelationsContainer(room?.client ?? client!);\n }\n\n /**\n * Get all the timelines in this set\n * @returns the timelines in this set\n */\n public getTimelines(): EventTimeline[] {\n return this.timelines;\n }\n\n /**\n * Get the filter object this timeline set is filtered on, if any\n * @returns the optional filter for this timelineSet\n */\n public getFilter(): Filter | undefined {\n return this.filter;\n }\n\n /**\n * Set the filter object this timeline set is filtered on\n * (passed to the server when paginating via /messages).\n * @param filter - the filter for this timelineSet\n */\n public setFilter(filter?: Filter): void {\n this.filter = filter;\n }\n\n /**\n * Get the list of pending sent events for this timelineSet's room, filtered\n * by the timelineSet's filter if appropriate.\n *\n * @returns A list of the sent events\n * waiting for remote echo.\n *\n * @throws If `opts.pendingEventOrdering` was not 'detached'\n */\n public getPendingEvents(): MatrixEvent[] {\n if (!this.room || !this.displayPendingEvents) {\n return [];\n }\n\n return this.room.getPendingEvents();\n }\n /**\n * Get the live timeline for this room.\n *\n * @returns live timeline\n */\n public getLiveTimeline(): EventTimeline {\n return this.liveTimeline;\n }\n\n /**\n * Set the live timeline for this room.\n *\n * @returns live timeline\n */\n public setLiveTimeline(timeline: EventTimeline): void {\n this.liveTimeline = timeline;\n }\n\n /**\n * Return the timeline (if any) this event is in.\n * @param eventId - the eventId being sought\n * @returns timeline\n */\n public eventIdToTimeline(eventId: string): EventTimeline | undefined {\n return this._eventIdToTimeline.get(eventId);\n }\n\n /**\n * Track a new event as if it were in the same timeline as an old event,\n * replacing it.\n * @param oldEventId - event ID of the original event\n * @param newEventId - event ID of the replacement event\n */\n public replaceEventId(oldEventId: string, newEventId: string): void {\n const existingTimeline = this._eventIdToTimeline.get(oldEventId);\n if (existingTimeline) {\n this._eventIdToTimeline.delete(oldEventId);\n this._eventIdToTimeline.set(newEventId, existingTimeline);\n }\n }\n\n /**\n * Reset the live timeline, and start a new one.\n *\n * <p>This is used when /sync returns a 'limited' timeline.\n *\n * @param backPaginationToken - token for back-paginating the new timeline\n * @param forwardPaginationToken - token for forward-paginating the old live timeline,\n * if absent or null, all timelines are reset.\n *\n * @remarks\n * Fires {@link RoomEvent.TimelineReset}\n */\n public resetLiveTimeline(backPaginationToken?: string, forwardPaginationToken?: string): void {\n // Each EventTimeline has RoomState objects tracking the state at the start\n // and end of that timeline. The copies at the end of the live timeline are\n // special because they will have listeners attached to monitor changes to\n // the current room state, so we move this RoomState from the end of the\n // current live timeline to the end of the new one and, if necessary,\n // replace it with a newly created one. We also make a copy for the start\n // of the new timeline.\n\n // if timeline support is disabled, forget about the old timelines\n const resetAllTimelines = !this.timelineSupport || !forwardPaginationToken;\n\n const oldTimeline = this.liveTimeline;\n const newTimeline = resetAllTimelines\n ? oldTimeline.forkLive(EventTimeline.FORWARDS)\n : oldTimeline.fork(EventTimeline.FORWARDS);\n\n if (resetAllTimelines) {\n this.timelines = [newTimeline];\n this._eventIdToTimeline = new Map<string, EventTimeline>();\n } else {\n this.timelines.push(newTimeline);\n }\n\n if (forwardPaginationToken) {\n // Now set the forward pagination token on the old live timeline\n // so it can be forward-paginated.\n oldTimeline.setPaginationToken(forwardPaginationToken, EventTimeline.FORWARDS);\n }\n\n // make sure we set the pagination token before firing timelineReset,\n // otherwise clients which start back-paginating will fail, and then get\n // stuck without realising that they *can* back-paginate.\n newTimeline.setPaginationToken(backPaginationToken ?? null, EventTimeline.BACKWARDS);\n\n // Now we can swap the live timeline to the new one.\n this.liveTimeline = newTimeline;\n this.emit(RoomEvent.TimelineReset, this.room, this, resetAllTimelines);\n }\n\n /**\n * Get the timeline which contains the given event, if any\n *\n * @param eventId - event ID to look for\n * @returns timeline containing\n * the given event, or null if unknown\n */\n public getTimelineForEvent(eventId?: string): EventTimeline | null {\n if (eventId === null || eventId === undefined) {\n return null;\n }\n const res = this._eventIdToTimeline.get(eventId);\n return res === undefined ? null : res;\n }\n\n /**\n * Get an event which is stored in our timelines\n *\n * @param eventId - event ID to look for\n * @returns the given event, or undefined if unknown\n */\n public findEventById(eventId: string): MatrixEvent | undefined {\n const tl = this.getTimelineForEvent(eventId);\n if (!tl) {\n return undefined;\n }\n return tl.getEvents().find(function (ev) {\n return ev.getId() == eventId;\n });\n }\n\n /**\n * Add a new timeline to this timeline list\n *\n * @returns newly-created timeline\n */\n public addTimeline(): EventTimeline {\n if (!this.timelineSupport) {\n throw new Error(\n \"timeline support is disabled. Set the 'timelineSupport'\" +\n \" parameter to true when creating MatrixClient to enable\" +\n \" it.\",\n );\n }\n\n const timeline = new EventTimeline(this);\n this.timelines.push(timeline);\n return timeline;\n }\n\n /**\n * Add events to a timeline\n *\n * <p>Will fire \"Room.timeline\" for each event added.\n *\n * @param events - A list of events to add.\n *\n * @param toStartOfTimeline - True to add these events to the start\n * (oldest) instead of the end (newest) of the timeline. If true, the oldest\n * event will be the <b>last</b> element of 'events'.\n *\n * @param timeline - timeline to\n * add events to.\n *\n * @param paginationToken - token for the next batch of events\n *\n * @remarks\n * Fires {@link RoomEvent.Timeline}\n *\n */\n public addEventsToTimeline(\n events: MatrixEvent[],\n toStartOfTimeline: boolean,\n addToState: boolean,\n timeline: EventTimeline,\n paginationToken?: string | null,\n ): void {\n if (!timeline) {\n throw new Error(\"'timeline' not specified for EventTimelineSet.addEventsToTimeline\");\n }\n\n if (!toStartOfTimeline && timeline == this.liveTimeline) {\n throw new Error(\n \"EventTimelineSet.addEventsToTimeline cannot be used for adding events to \" +\n \"the live timeline - use Room.addLiveEvents instead\",\n );\n }\n\n if (this.filter) {\n events = this.filter.filterRoomTimeline(events);\n if (!events.length) {\n return;\n }\n }\n\n const direction = toStartOfTimeline ? EventTimeline.BACKWARDS : EventTimeline.FORWARDS;\n const inverseDirection = toStartOfTimeline ? EventTimeline.FORWARDS : EventTimeline.BACKWARDS;\n\n // Adding events to timelines can be quite complicated. The following\n // illustrates some of the corner-cases.\n //\n // Let's say we start by knowing about four timelines. timeline3 and\n // timeline4 are neighbours:\n //\n // timeline1 timeline2 timeline3 timeline4\n // [M] [P] [S] <------> [T]\n //\n // Now we paginate timeline1, and get the following events from the server:\n // [M, N, P, R, S, T, U].\n //\n // 1. First, we ignore event M, since we already know about it.\n //\n // 2. Next, we append N to timeline 1.\n //\n // 3. Next, we don't add event P, since we already know about it,\n // but we do link together the timelines. We now have:\n //\n // timeline1 timeline2 timeline3 timeline4\n // [M, N] <---> [P] [S] <------> [T]\n //\n // 4. Now we add event R to timeline2:\n //\n // timeline1 timeline2 timeline3 timeline4\n // [M, N] <---> [P, R] [S] <------> [T]\n //\n // Note that we have switched the timeline we are working on from\n // timeline1 to timeline2.\n //\n // 5. We ignore event S, but again join the timelines:\n //\n // timeline1 timeline2 timeline3 timeline4\n // [M, N] <---> [P, R] <---> [S] <------> [T]\n //\n // 6. We ignore event T, and the timelines are already joined, so there\n // is nothing to do.\n //\n // 7. Finally, we add event U to timeline4:\n //\n // timeline1 timeline2 timeline3 timeline4\n // [M, N] <---> [P, R] <---> [S] <------> [T, U]\n //\n // The important thing to note in the above is what happened when we\n // already knew about a given event:\n //\n // - if it was appropriate, we joined up the timelines (steps 3, 5).\n // - in any case, we started adding further events to the timeline which\n // contained the event we knew about (steps 3, 5, 6).\n //\n //\n // So much for adding events to the timeline. But what do we want to do\n // with the pagination token?\n //\n // In the case above, we will be given a pagination token which tells us how to\n // get events beyond 'U' - in this case, it makes sense to store this\n // against timeline4. But what if timeline4 already had 'U' and beyond? in\n // that case, our best bet is to throw away the pagination token we were\n // given and stick with whatever token timeline4 had previously. In short,\n // we want to only store the pagination token if the last event we receive\n // is one we didn't previously know about.\n //\n // We make an exception for this if it turns out that we already knew about\n // *all* of the events, and we weren't able to join up any timelines. When\n // that happens, it means our existing pagination token is faulty, since it\n // is only telling us what we already know. Rather than repeatedly\n // paginating with the same token, we might as well use the new pagination\n // token in the hope that we eventually work our way out of the mess.\n\n let didUpdate = false;\n let lastEventWasNew = false;\n for (const event of events) {\n const eventId = event.getId()!;\n\n const existingTimeline = this._eventIdToTimeline.get(eventId);\n\n if (!existingTimeline) {\n // we don't know about this event yet. Just add it to the timeline.\n this.addEventToTimeline(event, timeline, {\n toStartOfTimeline,\n addToState,\n });\n lastEventWasNew = true;\n didUpdate = true;\n continue;\n }\n\n lastEventWasNew = false;\n\n if (existingTimeline == timeline) {\n debuglog(\"Event \" + eventId + \" already in timeline \" + timeline);\n continue;\n }\n\n const neighbour = timeline.getNeighbouringTimeline(direction);\n if (neighbour) {\n // this timeline already has a neighbour in the relevant direction;\n // let's assume the timelines are already correctly linked up, and\n // skip over to it.\n //\n // there's probably some edge-case here where we end up with an\n // event which is in a timeline a way down the chain, and there is\n // a break in the chain somewhere. But I can't really imagine how\n // that would happen, so I'm going to ignore it for now.\n //\n if (existingTimeline == neighbour) {\n debuglog(\"Event \" + eventId + \" in neighbouring timeline - \" + \"switching to \" + existingTimeline);\n } else {\n debuglog(\"Event \" + eventId + \" already in a different \" + \"timeline \" + existingTimeline);\n }\n timeline = existingTimeline;\n continue;\n }\n\n // time to join the timelines.\n logger.info(\n \"Already have timeline for \" + eventId + \" - joining timeline \" + timeline + \" to \" + existingTimeline,\n );\n\n // Variables to keep the line length limited below.\n const existingIsLive = existingTimeline === this.liveTimeline;\n const timelineIsLive = timeline === this.liveTimeline;\n\n const backwardsIsLive = direction === EventTimeline.BACKWARDS && existingIsLive;\n const forwardsIsLive = direction === EventTimeline.FORWARDS && timelineIsLive;\n\n if (backwardsIsLive || forwardsIsLive) {\n // The live timeline should never be spliced into a non-live position.\n // We use independent logging to better discover the problem at a glance.\n if (backwardsIsLive) {\n logger.warn(\n \"Refusing to set a preceding existingTimeLine on our \" +\n \"timeline as the existingTimeLine is live (\" +\n existingTimeline +\n \")\",\n );\n }\n if (forwardsIsLive) {\n logger.warn(\n \"Refusing to set our preceding timeline on a existingTimeLine \" +\n \"as our timeline is live (\" +\n timeline +\n \")\",\n );\n }\n continue; // abort splicing - try next event\n }\n\n timeline.setNeighbouringTimeline(existingTimeline, direction);\n existingTimeline.setNeighbouringTimeline(timeline, inverseDirection);\n\n timeline = existingTimeline;\n didUpdate = true;\n }\n\n // see above - if the last event was new to us, or if we didn't find any\n // new information, we update the pagination token for whatever\n // timeline we ended up on.\n if (lastEventWasNew || !didUpdate) {\n if (direction === EventTimeline.FORWARDS && timeline === this.liveTimeline) {\n logger.warn({ lastEventWasNew, didUpdate }); // for debugging\n logger.warn(\n `Refusing to set forwards pagination token of live timeline ` + `${timeline} to ${paginationToken}`,\n );\n return;\n }\n timeline.setPaginationToken(paginationToken ?? null, direction);\n }\n }\n\n /**\n * Add an event to the end of this live timeline.\n *\n * @param event - Event to be added\n * @param options - addLiveEvent options\n */\n public addLiveEvent(\n event: MatrixEvent,\n { duplicateStrategy, fromCache, roomState, timelineWasEmpty, addToState }: IAddLiveEventOptions,\n ): void {\n if (this.filter) {\n const events = this.filter.filterRoomTimeline([event]);\n if (!events.length) {\n return;\n }\n }\n\n const timeline = this._eventIdToTimeline.get(event.getId()!);\n if (timeline) {\n if (duplicateStrategy === DuplicateStrategy.Replace) {\n debuglog(\"EventTimelineSet.addLiveEvent: replacing duplicate event \" + event.getId());\n const tlEvents = timeline.getEvents();\n for (let j = 0; j < tlEvents.length; j++) {\n if (tlEvents[j].getId() === event.getId()) {\n // still need to set the right metadata on this event\n if (!roomState) {\n roomState = timeline.getState(EventTimeline.FORWARDS);\n }\n EventTimeline.setEventMetadata(event, roomState!, false);\n tlEvents[j] = event;\n\n // XXX: we need to fire an event when this happens.\n break;\n }\n }\n } else {\n debuglog(\"EventTimelineSet.addLiveEvent: ignoring duplicate event \" + event.getId());\n }\n return;\n }\n\n this.addEventToTimeline(event, this.liveTimeline, {\n toStartOfTimeline: false,\n fromCache,\n roomState,\n timelineWasEmpty,\n addToState\n });\n }\n\n /**\n * Add event to the given timeline, and emit Room.timeline. Assumes\n * we have already checked we don't know about this event.\n *\n * Will fire \"Room.timeline\" for each event added.\n *\n * @param event - the event to add\n * @param timeline - the timeline onto which to add it\n * @param options - addEventToTimeline options\n *\n * @remarks\n * Fires {@link RoomEvent.Timeline}\n */\n public addEventToTimeline(\n event: MatrixEvent,\n timeline: EventTimeline,\n { toStartOfTimeline, fromCache = false, roomState, timelineWasEmpty, addToState }: IAddEventToTimelineOptions,\n ): void {\n if (timeline.getTimelineSet() !== this) {\n throw new Error(`EventTimelineSet.addEventToTimeline: Timeline=${timeline.toString()} does not belong \" +\n \"in timelineSet(threadId=${this.thread?.id})`);\n }\n\n const eventId = event.getId()!;\n this.relations.aggregateParentEvent(event);\n this.relations.aggregateChildEvent(event, this);\n\n // Make sure events don't get mixed in timelines they shouldn't be in (e.g. a\n // threaded message should not be in the main timeline).\n //\n // We can only run this check for timelines with a `room` because `canContain`\n // requires it\n if (this.room && !this.canContain(event)) {\n let eventDebugString = `event=${eventId}`;\n if (event.threadRootId) {\n eventDebugString += `(belongs to thread=${event.threadRootId})`;\n }\n logger.warn(\n `EventTimelineSet.addEventToTimeline: Ignoring ${eventDebugString} that does not belong ` +\n `in timeline=${timeline.toString()} timelineSet(threadId=${this.thread?.id})`,\n );\n return;\n }\n\n timeline.addEvent(event, {\n toStartOfTimeline,\n roomState,\n timelineWasEmpty,\n addToState,\n });\n this._eventIdToTimeline.set(eventId, timeline);\n\n const data: IRoomTimelineData = {\n timeline: timeline,\n liveEvent: !toStartOfTimeline && timeline == this.liveTimeline && !fromCache,\n };\n this.emit(RoomEvent.Timeline, event, this.room, Boolean(toStartOfTimeline), false, data);\n }\n\n /**\n * Insert event to the given timeline, and emit Room.timeline. Assumes\n * we have already checked we don't know about this event.\n *\n * TEMPORARY: until we have recursive relations, we need this function\n * to exist to allow us to insert events in timeline order, which is our\n * best guess for Sync Order.\n * This is a copy of addEventToTimeline above, modified to insert the event\n * after the event it relates to, and before any event with a later\n * timestamp. This is our best guess at Sync Order.\n *\n * Will fire \"Room.timeline\" for each event added.\n *\n * @internal\n *\n * @remarks\n * Fires {@link RoomEvent.Timeline}\n */\n public insertEventIntoTimeline(\n event: MatrixEvent,\n timeline: EventTimeline,\n roomState: RoomState,\n addToState: boolean,\n ): void {\n if (timeline.getTimelineSet() !== this) {\n throw new Error(`EventTimelineSet.insertEventIntoTimeline: Timeline=${timeline.toString()} does not belong \" +\n \"in timelineSet(threadId=${this.thread?.id})`);\n }\n\n const eventId = event.getId()!;\n this.relations.aggregateParentEvent(event);\n this.relations.aggregateChildEvent(event, this);\n\n // Make sure events don't get mixed in timelines they shouldn't be in (e.g. a\n // threaded message should not be in the main timeline).\n //\n // We can only run this check for timelines with a `room` because `canContain`\n // requires it\n if (this.room && !this.canContain(event)) {\n let eventDebugString = `event=${eventId}`;\n if (event.threadRootId) {\n eventDebugString += `(belongs to thread=${event.threadRootId})`;\n }\n logger.warn(\n `EventTimelineSet.insertEventIntoTimeline: Ignoring ${eventDebugString} that does not belong ` +\n `in timeline=${timeline.toString()} timelineSet(threadId=${this.thread?.id})`,\n );\n return;\n }\n\n // Find the event that this event is related to - the \"parent\"\n const parentEventId = event.relationEventId;\n if (!parentEventId) {\n // Not related to anything - we just append\n this.addEventToTimeline(event, timeline, {\n toStartOfTimeline: false,\n fromCache: false,\n timelineWasEmpty: false,\n roomState,\n addToState,\n });\n return;\n }\n\n const parentEvent = this.findEventById(parentEventId);\n\n const timelineEvents = timeline.getEvents();\n\n // Start searching from the parent event, or if it's not loaded, start\n // at the beginning and insert purely using timestamp order.\n const parentIndex = parentEvent !== undefined ? timelineEvents.indexOf(parentEvent) : 0;\n let insertIndex = parentIndex;\n for (; insertIndex < timelineEvents.length; insertIndex++) {\n const nextEvent = timelineEvents[insertIndex];\n if (nextEvent.getTs() > event.getTs()) {\n // We found an event later than ours, so insert before that.\n break;\n }\n }\n // If we got to the end of the loop, insertIndex points at the end of\n // the list.\n\n timeline.insertEvent(event, insertIndex, roomState, addToState);\n this._eventIdToTimeline.set(eventId, timeline);\n\n const data: IRoomTimelineData = {\n timeline: timeline,\n // The purpose of this method is inserting events in the middle of the\n // timeline, so the events are, by definition, not live (whether or not\n // we're adding them to the live timeline).\n liveEvent: false,\n };\n this.emit(RoomEvent.Timeline, event, this.room, false, false, data);\n }\n\n /**\n * Replaces event with ID oldEventId with one with newEventId, if oldEventId is\n * recognised. Otherwise, add to the live timeline. Used to handle remote echos.\n *\n * @param localEvent - the new event to be added to the timeline\n * @param oldEventId - the ID of the original event\n * @param newEventId - the ID of the replacement event\n *\n * @remarks\n * Fires {@link RoomEvent.Timeline}\n */\n public handleRemoteEcho(localEvent: MatrixEvent, oldEventId: string, newEventId: string): void {\n // XXX: why don't we infer newEventId from localEvent?\n const existingTimeline = this._eventIdToTimeline.get(oldEventId);\n if (existingTimeline) {\n this._eventIdToTimeline.delete(oldEventId);\n this._eventIdToTimeline.set(newEventId, existingTimeline);\n } else if (!this.filter || this.filter.filterRoomTimeline([localEvent]).length) {\n this.addEventToTimeline(localEvent, this.liveTimeline, {\n toStartOfTimeline: false,\n addToState: false,\n });\n }\n }\n\n /**\n * Removes a single event from this room.\n *\n * @param eventId - The id of the event to remove\n *\n * @returns the removed event, or null if the event was not found\n * in this room.\n */\n public removeEvent(eventId: string): MatrixEvent | null {\n const timeline = this._eventIdToTimeline.get(eventId);\n if (!timeline) {\n return null;\n }\n\n const removed = timeline.removeEvent(eventId);\n if (removed) {\n this._eventIdToTimeline.delete(eventId);\n const data = {\n timeline: timeline,\n };\n this.emit(RoomEvent.Timeline, removed, this.room, undefined, true, data);\n }\n return removed;\n }\n\n /**\n * Determine where two events appear in the timeline relative to one another\n *\n * @param eventId1 - The id of the first event\n * @param eventId2 - The id of the second event\n\n * @returns -1 if eventId1 precedes eventId2, and +1 eventId1 succeeds\n * eventId2. 0 if they are the same event; null if we can't tell (either\n * because we don't know about one of the events, or because they are in\n * separate timelines which don't join up).\n */\n public compareEventOrdering(eventId1: string, eventId2: string): number | null {\n if (eventId1 == eventId2) {\n // optimise this case\n return 0;\n }\n\n const timeline1 = this._eventIdToTimeline.get(eventId1);\n const timeline2 = this._eventIdToTimeline.get(eventId2);\n\n if (timeline1 === undefined) {\n return null;\n }\n if (timeline2 === undefined) {\n return null;\n }\n\n if (timeline1 === timeline2) {\n // both events are in the same timeline - figure out their relative indices\n let idx1: number | undefined = undefined;\n let idx2: number | undefined = undefined;\n const events = timeline1.getEvents();\n for (let idx = 0; idx < events.length && (idx1 === undefined || idx2 === undefined); idx++) {\n const evId = events[idx].getId();\n if (evId == eventId1) {\n idx1 = idx;\n }\n if (evId == eventId2) {\n idx2 = idx;\n }\n }\n const difference = idx1! - idx2!;\n\n // Return the sign of difference.\n if (difference < 0) {\n return -1;\n } else if (difference > 0) {\n return 1;\n } else {\n return 0;\n }\n }\n\n // the events are in different timelines. Iterate through the\n // linkedlist to see which comes first.\n\n // first work forwards from timeline1\n let tl: EventTimeline | null = timeline1;\n while (tl) {\n if (tl === timeline2) {\n // timeline1 is before timeline2\n return -1;\n }\n tl = tl.getNeighbouringTimeline(EventTimeline.FORWARDS);\n }\n\n // now try backwards from timeline1\n tl = timeline1;\n while (tl) {\n if (tl === timeline2) {\n // timeline2 is before timeline1\n return 1;\n }\n tl = tl.getNeighbouringTimeline(EventTimeline.BACKWARDS);\n }\n\n // the timelines are not contiguous.\n return null;\n }\n\n /**\n * Determine whether a given event can sanely be added to this event timeline set,\n * for timeline sets relating to a thread, only return true for events in the same\n * thread timeline, for timeline sets not relating to a thread only return true\n * for events which should be shown in the main room timeline.\n * Requires the `room` property to have been set at EventTimelineSet construction time.\n *\n * @param event - the event to check whether it belongs to this timeline set.\n * @throws Error if `room` was not set when constructing this timeline set.\n * @returns whether the event belongs to this timeline set.\n */\n public canContain(event: MatrixEvent): boolean {\n if (!this.room) {\n throw new Error(\n \"Cannot call `EventTimelineSet::canContain without a `room` set. \" +\n \"Set the room when creating the EventTimelineSet to call this method.\",\n );\n }\n\n const { threadId, shouldLiveInRoom, shouldLiveInThread } = this.room.eventShouldLiveIn(event);\n\n if (this.thread) {\n return this.thread.id === threadId;\n }\n\n if (!shouldLiveInRoom && !shouldLiveInThread) {\n logger.warn(\n `EventTimelineSet:canContain event encountered which cannot be added to any timeline roomId=${\n this.room?.roomId\n } eventId=${event.getId()} threadId=${event.threadRootId}`,\n );\n }\n\n return shouldLiveInRoom;\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,aAAa,QAA0B,qBAAqB;AAErE,SAASC,MAAM,QAAQ,cAAc;AACrC,SAAeC,SAAS,QAAQ,WAAW;AAG3C,SAASC,iBAAiB,QAAQ,0BAA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O3E,EAAE,EAAE;MACP,IAAIA,EAAE,KAAK4E,SAAS,EAAE;QAClB;QACA,OAAO,CAAC;MACZ;MACA5E,EAAE,GAAGA,EAAE,CAACoB,uBAAuB,CAACvF,aAAa,CAAC6D,SAAS,CAAC;IAC5D;;IAEA;IACA,OAAO,IAAI;EACf;;EAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACWqD,UAAUA,CAAC9B,KAAkB,EAAW;IAC3C,IAAI,CAAC,IAAI,CAACxE,IAAI,EAAE;MACZ,MAAM,IAAI6D,KAAK,CACX,kEAAkE,GAC9D,sEACR,CAAC;IACL;IAEA,IAAM;MAAE4E,QAAQ;MAAEC,gBAAgB;MAAEC;IAAmB,CAAC,GAAG,IAAI,CAAC3I,IAAI,CAAC4I,iBAAiB,CAACpE,KAAK,CAAC;IAE7F,IAAI,IAAI,CAAC/D,MAAM,EAAE;MACb,OAAO,IAAI,CAACA,MAAM,CAAC0F,EAAE,KAAKsC,QAAQ;IACtC;IAEA,IAAI,CAACC,gBAAgB,IAAI,CAACC,kBAAkB,EAAE;MAAA,IAAAE,WAAA;MAC1CxJ,MAAM,CAAC4F,IAAI,+FAAAE,MAAA,EAAA0D,WAAA,GAEH,IAAI,CAAC7I,IAAI,cAAA6I,WAAA,uBAATA,WAAA,CAAWC,MAAM,eAAA3D,MAAA,CACTX,KAAK,CAACb,KAAK,CAAC,CAAC,gBAAAwB,MAAA,CAAaX,KAAK,CAACiC,YAAY,CAC5D,CAAC;IACL;IAEA,OAAOiC,gBAAgB;EAC3B;AACJ","ignoreList":[]}
@@ -11,6 +11,11 @@ export interface IAddEventOptions extends Pick<IMarkerFoundOptions, "timelineWas
11
11
  toStartOfTimeline: boolean;
12
12
  /** The state events to reconcile metadata from */
13
13
  roomState?: RoomState;
14
+ /** Whether to add timeline events to the state as was done in legacy sync v2.
15
+ * If true then timeline events will be added to the state.
16
+ * In sync v2 with org.matrix.msc4222.use_state_after and simplified sliding sync,
17
+ * all state arrives explicitly and timeline events should not be added. */
18
+ addToState: boolean;
14
19
  }
15
20
  export declare enum Direction {
16
21
  Backward = "b",
@@ -189,7 +194,7 @@ export declare class EventTimeline {
189
194
  * @param event - new event
190
195
  * @param options - addEvent options
191
196
  */
192
- addEvent(event: MatrixEvent, { toStartOfTimeline, roomState, timelineWasEmpty }?: IAddEventOptions): void;
197
+ addEvent(event: MatrixEvent, { toStartOfTimeline, roomState, timelineWasEmpty, addToState }: IAddEventOptions): void;
193
198
  /**
194
199
  * Insert a new event into the timeline, and update the state.
195
200
  *
@@ -201,7 +206,7 @@ export declare class EventTimeline {
201
206
  *
202
207
  * @internal
203
208
  */
204
- insertEvent(event: MatrixEvent, insertIndex: number, roomState: RoomState): void;
209
+ insertEvent(event: MatrixEvent, insertIndex: number, roomState: RoomState, addToState: boolean): void;
205
210
  /**
206
211
  * Remove an event from the timeline
207
212
  *
@@ -1 +1 @@
1
- {"version":3,"file":"event-timeline.d.ts","sourceRoot":"","sources":["../../src/models/event-timeline.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,mBAAmB,EAAE,kBAAkB,CAAC;CAM7F;AAED,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,mBAAmB,EAAE,kBAAkB,CAAC;IACnF;;iBAEa;IACb,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kDAAkD;IAClD,SAAS,CAAC,EAAE,SAAS,CAAC;CACzB;AAED,oBAAY,SAAS;IACjB,QAAQ,MAAM;IACd,OAAO,MAAM;CAChB;AAED,qBAAa,aAAa;IAkFH,OAAO,CAAC,QAAQ,CAAC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32
32
  */
33
33
  static setEventMetadata(event, stateContext, toStartOfTimeline) {
34
- var _event$sender, _event$target;
35
- // When we try to generate a sentinel member before we have that member
36
- // in the members object, we still generate a sentinel but it doesn't
37
- // have a membership event, so test to see if events.member is set. We
38
- // check this to avoid overriding non-sentinel members by sentinel ones
39
- // when adding the event to a filtered timeline
40
- if (!((_event$sender = event.sender) !== null && _event$sender !== void 0 && (_event$sender = _event$sender.events) !== null && _event$sender !== void 0 && _event$sender.member)) {
41
- event.sender = stateContext.getSentinelMember(event.getSender());
42
- }
43
- if (!((_event$target = event.target) !== null && _event$target !== void 0 && (_event$target = _event$target.events) !== null && _event$target !== void 0 && _event$target.member) && event.getType() === EventType.RoomMember) {
44
- event.target = stateContext.getSentinelMember(event.getStateKey());
45
- }
46
- if (event.isState()) {
47
- // room state has no concept of 'old' or 'current', but we want the
48
- // room state to regress back to previous values if toStartOfTimeline
49
- // is set, which means inspecting prev_content if it exists. This
50
- // is done by toggling the forwardLooking flag.
51
- if (toStartOfTimeline) {
52
- event.forwardLooking = false;
53
- }
54
- }
34
+ event.setMetadata(stateContext, toStartOfTimeline);
55
35
  }
56
36
  /**
57
37
  * Construct a new EventTimeline
@@ -93,7 +73,7 @@ export class EventTimeline {
93
73
  });
94
74
  this.roomId = (_eventTimelineSet$roo = (_eventTimelineSet$roo2 = eventTimelineSet.room) === null || _eventTimelineSet$roo2 === void 0 ? void 0 : _eventTimelineSet$roo2.roomId) !== null && _eventTimelineSet$roo !== void 0 ? _eventTimelineSet$roo : null;
95
75
  if (this.roomId) {
96
- this.startState = new RoomState(this.roomId, undefined, true);
76
+ this.startState = new RoomState(this.roomId);
97
77
  this.endState = new RoomState(this.roomId);
98
78
  }
99
79
 
@@ -328,14 +308,13 @@ export class EventTimeline {
328
308
  * @param event - new event
329
309
  * @param options - addEvent options
330
310
  */
331
- addEvent(event) {
311
+ addEvent(event, _ref) {
332
312
  var {
333
313
  toStartOfTimeline,
334
314
  roomState,
335
- timelineWasEmpty
336
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
337
- toStartOfTimeline: false
338
- };
315
+ timelineWasEmpty,
316
+ addToState
317
+ } = _ref;
339
318
  if (!roomState) {
340
319
  roomState = toStartOfTimeline ? this.startState : this.endState;
341
320
  }
@@ -344,7 +323,7 @@ export class EventTimeline {
344
323
  EventTimeline.setEventMetadata(event, roomState, toStartOfTimeline);
345
324
 
346
325
  // modify state but only on unfiltered timelineSets
347
- if (event.isState() && timelineSet.room.getUnfilteredTimelineSet() === timelineSet) {
326
+ if (addToState && event.isState() && timelineSet.room.getUnfilteredTimelineSet() === timelineSet) {
348
327
  var _roomState;
349
328
  (_roomState = roomState) === null || _roomState === void 0 || _roomState.setStateEvents([event], {
350
329
  timelineWasEmpty
@@ -387,13 +366,13 @@ export class EventTimeline {
387
366
  *
388
367
  * @internal
389
368
  */
390
- insertEvent(event, insertIndex, roomState) {
369
+ insertEvent(event, insertIndex, roomState, addToState) {
391
370
  var timelineSet = this.getTimelineSet();
392
371
  if (timelineSet.room) {
393
372
  EventTimeline.setEventMetadata(event, roomState, false);
394
373
 
395
374
  // modify state but only on unfiltered timelineSets
396
- if (event.isState() && timelineSet.room.getUnfilteredTimelineSet() === timelineSet) {
375
+ if (addToState && event.isState() && timelineSet.room.getUnfilteredTimelineSet() === timelineSet) {
397
376
  roomState.setStateEvents([event], {});
398
377
  // it is possible that the act of setting the state event means we
399
378
  // can set more metadata (specifically sender/target props), so try
@@ -1 +1 @@
1
- {"version":3,"file":"event-timeline.js","names":["RoomState","EventType","Direction","EventTimeline","setEventMetadata","event","stateContext","toStartOfTimeline","_event$sender","_event$target","sender","events","member","getSentinelMember","getSender","target","getType","RoomMember","getStateKey","isState","forwardLooking","constructor","eventTimelineSet","_eventTimelineSet$roo","_eventTimelineSet$roo2","_defineProperty","Backward","Forward","roomId","room","startState","undefined","endState","paginationRequests","b","f","name","Date","toISOString","initialiseState","stateEvents","_this$startState","_this$endState","timelineWasEmpty","arguments","length","Error","setStateEvents","forkLive","direction","forkState","getState","timeline","clone","fork","getRoomId","getFilter","getTimelineSet","getBaseIndex","baseIndex","getEvents","BACKWARDS","FORWARDS","getPaginationToken","paginationToken","startToken","endToken","setPaginationToken","token","getNeighbouringTimeline","prevTimeline","nextTimeline","setNeighbouringTimeline","neighbour","addEvent","roomState","timelineSet","getUnfilteredTimelineSet","_roomState","insertIndex","splice","insertEvent","removeEvent","eventId","i","ev","getId","toString"],"sources":["../../src/models/event-timeline.ts"],"sourcesContent":["/*\nCopyright 2016 - 2021 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 { IMarkerFoundOptions, RoomState } from \"./room-state.ts\";\nimport { EventTimelineSet } from \"./event-timeline-set.ts\";\nimport { MatrixEvent } from \"./event.ts\";\nimport { Filter } from \"../filter.ts\";\nimport { EventType } from \"../@types/event.ts\";\n\nexport interface IInitialiseStateOptions extends Pick<IMarkerFoundOptions, \"timelineWasEmpty\"> {\n // This is a separate interface without any extra stuff currently added on\n // top of `IMarkerFoundOptions` just because it feels like they have\n // different concerns. One shouldn't necessarily look to add to\n // `IMarkerFoundOptions` just because they want to add an extra option to\n // `initialiseState`.\n}\n\nexport interface IAddEventOptions extends Pick<IMarkerFoundOptions, \"timelineWasEmpty\"> {\n /** Whether to insert the new event at the start of the timeline where the\n * oldest events are (timeline is in chronological order, oldest to most\n * recent) */\n toStartOfTimeline: boolean;\n /** The state events to reconcile metadata from */\n roomState?: RoomState;\n}\n\nexport enum Direction {\n Backward = \"b\",\n Forward = \"f\",\n}\n\nexport class EventTimeline {\n /**\n * Symbolic constant for methods which take a 'direction' argument:\n * refers to the start of the timeline, or backwards in time.\n */\n public static readonly BACKWARDS = Direction.Backward;\n\n /**\n * Symbolic constant for methods which take a 'direction' argument:\n * refers to the end of the timeline, or forwards in time.\n */\n public static readonly FORWARDS = Direction.Forward;\n\n /**\n * Static helper method to set sender and target properties\n *\n * @param event - the event whose metadata is to be set\n * @param stateContext - the room state to be queried\n * @param toStartOfTimeline - if true the event's forwardLooking flag is set false\n */\n public static setEventMetadata(event: MatrixEvent, stateContext: RoomState, toStartOfTimeline: boolean): void {\n // When we try to generate a sentinel member before we have that member\n // in the members object, we still generate a sentinel but it doesn't\n // have a membership event, so test to see if events.member is set. We\n // check this to avoid overriding non-sentinel members by sentinel ones\n // when adding the event to a filtered timeline\n if (!event.sender?.events?.member) {\n event.sender = stateContext.getSentinelMember(event.getSender()!);\n }\n if (!event.target?.events?.member && event.getType() === EventType.RoomMember) {\n event.target = stateContext.getSentinelMember(event.getStateKey()!);\n }\n\n if (event.isState()) {\n // room state has no concept of 'old' or 'current', but we want the\n // room state to regress back to previous values if toStartOfTimeline\n // is set, which means inspecting prev_content if it exists. This\n // is done by toggling the forwardLooking flag.\n if (toStartOfTimeline) {\n event.forwardLooking = false;\n }\n }\n }\n\n private readonly roomId: string | null;\n private readonly name: string;\n private events: MatrixEvent[] = [];\n private baseIndex = 0;\n\n private startState?: RoomState;\n private endState?: RoomState;\n // If we have a roomId then we delegate pagination token storage to the room state objects `startState` and\n // `endState`, but for things like the notification timeline which mix multiple rooms we store the tokens ourselves.\n private startToken: string | null = null;\n private endToken: string | null = null;\n\n private prevTimeline: EventTimeline | null = null;\n private nextTimeline: EventTimeline | null = null;\n public paginationRequests: Record<Direction, Promise<boolean> | null> = {\n [Direction.Backward]: null,\n [Direction.Forward]: null,\n };\n\n /**\n * Construct a new EventTimeline\n *\n * <p>An EventTimeline represents a contiguous sequence of events in a room.\n *\n * <p>As well as keeping track of the events themselves, it stores the state of\n * the room at the beginning and end of the timeline, and pagination tokens for\n * going backwards and forwards in the timeline.\n *\n * <p>In order that clients can meaningfully maintain an index into a timeline,\n * the EventTimeline object tracks a 'baseIndex'. This starts at zero, but is\n * incremented when events are prepended to the timeline. The index of an event\n * relative to baseIndex therefore remains constant.\n *\n * <p>Once a timeline joins up with its neighbour, they are linked together into a\n * doubly-linked list.\n *\n * @param eventTimelineSet - the set of timelines this is part of\n */\n public constructor(private readonly eventTimelineSet: EventTimelineSet) {\n this.roomId = eventTimelineSet.room?.roomId ?? null;\n if (this.roomId) {\n this.startState = new RoomState(this.roomId, undefined, true);\n this.endState = new RoomState(this.roomId);\n }\n\n // this is used by client.js\n this.paginationRequests = { b: null, f: null };\n\n this.name = this.roomId + \":\" + new Date().toISOString();\n }\n\n /**\n * Initialise the start and end state with the given events\n *\n * <p>This can only be called before any events are added.\n *\n * @param stateEvents - list of state events to initialise the\n * state with.\n * @throws Error if an attempt is made to call this after addEvent is called.\n */\n public initialiseState(stateEvents: MatrixEvent[], { timelineWasEmpty }: IInitialiseStateOptions = {}): void {\n if (this.events.length > 0) {\n throw new Error(\"Cannot initialise state after events are added\");\n }\n\n this.startState?.setStateEvents(stateEvents, { timelineWasEmpty });\n this.endState?.setStateEvents(stateEvents, { timelineWasEmpty });\n }\n\n /**\n * Forks the (live) timeline, taking ownership of the existing directional state of this timeline.\n * All attached listeners will keep receiving state updates from the new live timeline state.\n * The end state of this timeline gets replaced with an independent copy of the current RoomState,\n * and will need a new pagination token if it ever needs to paginate forwards.\n\n * @param direction - EventTimeline.BACKWARDS to get the state at the\n * start of the timeline; EventTimeline.FORWARDS to get the state at the end\n * of the timeline.\n *\n * @returns the new timeline\n */\n public forkLive(direction: Direction): EventTimeline {\n const forkState = this.getState(direction);\n const timeline = new EventTimeline(this.eventTimelineSet);\n timeline.startState = forkState?.clone();\n // Now clobber the end state of the new live timeline with that from the\n // previous live timeline. It will be identical except that we'll keep\n // using the same RoomMember objects for the 'live' set of members with any\n // listeners still attached\n timeline.endState = forkState;\n // Firstly, we just stole the current timeline's end state, so it needs a new one.\n // Make an immutable copy of the state so back pagination will get the correct sentinels.\n this.endState = forkState?.clone();\n return timeline;\n }\n\n /**\n * Creates an independent timeline, inheriting the directional state from this timeline.\n *\n * @param direction - EventTimeline.BACKWARDS to get the state at the\n * start of the timeline; EventTimeline.FORWARDS to get the state at the end\n * of the timeline.\n *\n * @returns the new timeline\n */\n public fork(direction: Direction): EventTimeline {\n const forkState = this.getState(direction);\n const timeline = new EventTimeline(this.eventTimelineSet);\n timeline.startState = forkState?.clone();\n timeline.endState = forkState?.clone();\n return timeline;\n }\n\n /**\n * Get the ID of the room for this timeline\n * @returns room ID\n */\n public getRoomId(): string | null {\n return this.roomId;\n }\n\n /**\n * Get the filter for this timeline's timelineSet (if any)\n * @returns filter\n */\n public getFilter(): Filter | undefined {\n return this.eventTimelineSet.getFilter();\n }\n\n /**\n * Get the timelineSet for this timeline\n * @returns timelineSet\n */\n public getTimelineSet(): EventTimelineSet {\n return this.eventTimelineSet;\n }\n\n /**\n * Get the base index.\n *\n * <p>This is an index which is incremented when events are prepended to the\n * timeline. An individual event therefore stays at the same index in the array\n * relative to the base index (although note that a given event's index may\n * well be less than the base index, thus giving that event a negative relative\n * index).\n */\n public getBaseIndex(): number {\n return this.baseIndex;\n }\n\n /**\n * Get the list of events in this context\n *\n * @returns An array of MatrixEvents\n */\n public getEvents(): MatrixEvent[] {\n return this.events;\n }\n\n /**\n * Get the room state at the start/end of the timeline\n *\n * @param direction - EventTimeline.BACKWARDS to get the state at the\n * start of the timeline; EventTimeline.FORWARDS to get the state at the end\n * of the timeline.\n *\n * @returns state at the start/end of the timeline\n */\n public getState(direction: Direction): RoomState | undefined {\n if (direction == EventTimeline.BACKWARDS) {\n return this.startState;\n } else if (direction == EventTimeline.FORWARDS) {\n return this.endState;\n } else {\n throw new Error(\"Invalid direction '\" + direction + \"'\");\n }\n }\n\n /**\n * Get a pagination token\n *\n * @param direction - EventTimeline.BACKWARDS to get the pagination\n * token for going backwards in time; EventTimeline.FORWARDS to get the\n * pagination token for going forwards in time.\n *\n * @returns pagination token\n */\n public getPaginationToken(direction: Direction): string | null {\n if (this.roomId) {\n return this.getState(direction)!.paginationToken;\n } else if (direction === Direction.Backward) {\n return this.startToken;\n } else {\n return this.endToken;\n }\n }\n\n /**\n * Set a pagination token\n *\n * @param token - pagination token\n *\n * @param direction - EventTimeline.BACKWARDS to set the pagination\n * token for going backwards in time; EventTimeline.FORWARDS to set the\n * pagination token for going forwards in time.\n */\n public setPaginationToken(token: string | null, direction: Direction): void {\n if (this.roomId) {\n this.getState(direction)!.paginationToken = token;\n } else if (direction === Direction.Backward) {\n this.startToken = token;\n } else {\n this.endToken = token;\n }\n }\n\n /**\n * Get the next timeline in the series\n *\n * @param direction - EventTimeline.BACKWARDS to get the previous\n * timeline; EventTimeline.FORWARDS to get the next timeline.\n *\n * @returns previous or following timeline, if they have been\n * joined up.\n */\n public getNeighbouringTimeline(direction: Direction): EventTimeline | null {\n if (direction == EventTimeline.BACKWARDS) {\n return this.prevTimeline;\n } else if (direction == EventTimeline.FORWARDS) {\n return this.nextTimeline;\n } else {\n throw new Error(\"Invalid direction '\" + direction + \"'\");\n }\n }\n\n /**\n * Set the next timeline in the series\n *\n * @param neighbour - previous/following timeline\n *\n * @param direction - EventTimeline.BACKWARDS to set the previous\n * timeline; EventTimeline.FORWARDS to set the next timeline.\n *\n * @throws Error if an attempt is made to set the neighbouring timeline when\n * it is already set.\n */\n public setNeighbouringTimeline(neighbour: EventTimeline, direction: Direction): void {\n if (this.getNeighbouringTimeline(direction)) {\n throw new Error(\n \"timeline already has a neighbouring timeline - \" +\n \"cannot reset neighbour (direction: \" +\n direction +\n \")\",\n );\n }\n\n if (direction == EventTimeline.BACKWARDS) {\n this.prevTimeline = neighbour;\n } else if (direction == EventTimeline.FORWARDS) {\n this.nextTimeline = neighbour;\n } else {\n throw new Error(\"Invalid direction '\" + direction + \"'\");\n }\n\n // make sure we don't try to paginate this timeline\n this.setPaginationToken(null, direction);\n }\n\n /**\n * Add a new event to the timeline, and update the state\n *\n * @param event - new event\n * @param options - addEvent options\n */\n public addEvent(\n event: MatrixEvent,\n { toStartOfTimeline, roomState, timelineWasEmpty }: IAddEventOptions = { toStartOfTimeline: false },\n ): void {\n if (!roomState) {\n roomState = toStartOfTimeline ? this.startState : this.endState;\n }\n\n const timelineSet = this.getTimelineSet();\n\n if (timelineSet.room) {\n EventTimeline.setEventMetadata(event, roomState!, toStartOfTimeline);\n\n // modify state but only on unfiltered timelineSets\n if (event.isState() && timelineSet.room.getUnfilteredTimelineSet() === timelineSet) {\n roomState?.setStateEvents([event], { timelineWasEmpty });\n // it is possible that the act of setting the state event means we\n // can set more metadata (specifically sender/target props), so try\n // it again if the prop wasn't previously set. It may also mean that\n // the sender/target is updated (if the event set was a room member event)\n // so we want to use the *updated* member (new avatar/name) instead.\n //\n // However, we do NOT want to do this on member events if we're going\n // back in time, else we'll set the .sender value for BEFORE the given\n // member event, whereas we want to set the .sender value for the ACTUAL\n // member event itself.\n if (!event.sender || (event.getType() === EventType.RoomMember && !toStartOfTimeline)) {\n EventTimeline.setEventMetadata(event, roomState!, toStartOfTimeline);\n }\n }\n }\n\n let insertIndex: number;\n\n if (toStartOfTimeline) {\n insertIndex = 0;\n } else {\n insertIndex = this.events.length;\n }\n\n this.events.splice(insertIndex, 0, event); // insert element\n if (toStartOfTimeline) {\n this.baseIndex++;\n }\n }\n\n /**\n * Insert a new event into the timeline, and update the state.\n *\n * TEMPORARY: until we have recursive relations, we need this function\n * to exist to allow us to insert events in timeline order, which is our\n * best guess for Sync Order.\n * This is a copy of addEvent above, modified to allow inserting an event at\n * a specific index.\n *\n * @internal\n */\n public insertEvent(event: MatrixEvent, insertIndex: number, roomState: RoomState): void {\n const timelineSet = this.getTimelineSet();\n\n if (timelineSet.room) {\n EventTimeline.setEventMetadata(event, roomState, false);\n\n // modify state but only on unfiltered timelineSets\n if (event.isState() && timelineSet.room.getUnfilteredTimelineSet() === timelineSet) {\n roomState.setStateEvents([event], {});\n // it is possible that the act of setting the state event means we\n // can set more metadata (specifically sender/target props), so try\n // it again if the prop wasn't previously set. It may also mean that\n // the sender/target is updated (if the event set was a room member event)\n // so we want to use the *updated* member (new avatar/name) instead.\n //\n // However, we do NOT want to do this on member events if we're going\n // back in time, else we'll set the .sender value for BEFORE the given\n // member event, whereas we want to set the .sender value for the ACTUAL\n // member event itself.\n if (!event.sender || event.getType() === EventType.RoomMember) {\n EventTimeline.setEventMetadata(event, roomState, false);\n }\n }\n }\n\n this.events.splice(insertIndex, 0, event); // insert element\n }\n\n /**\n * Remove an event from the timeline\n *\n * @param eventId - ID of event to be removed\n * @returns removed event, or null if not found\n */\n public removeEvent(eventId: string): MatrixEvent | null {\n for (let i = this.events.length - 1; i >= 0; i--) {\n const ev = this.events[i];\n if (ev.getId() == eventId) {\n this.events.splice(i, 1);\n if (i < this.baseIndex) {\n this.baseIndex--;\n }\n return ev;\n }\n }\n return null;\n }\n\n /**\n * Return a string to identify this timeline, for debugging\n *\n * @returns name for this timeline\n */\n public toString(): string {\n return this.name;\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAA8BA,SAAS,QAAQ,iBAAiB;AAIhE,SAASC,SAAS,QAAQ,oBAAoB;AAmB9C,WAAYC,SAAS,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AAKrB,OAAO,MAAMC,aAAa,CAAC;EAavB;AACJ;AACA;AACA;AACA;AACA;AACA;EACI,OAAcC,gBAAgBA,CAACC,KAAkB,EAAEC,YAAuB,EAAEC,iBAA0B,EAAQ;IAAA,IAAAC,aAAA,EAAAC,aAAA;IAC1G;IACA;IACA;IACA;IACA;IACA,IAAI,GAAAD,aAAA,GAACH,KAAK,CAACK,MAAM,cAAAF,aAAA,gBAAAA,aAAA,GAAZA,aAAA,CAAcG,MAAM,cAAAH,aAAA,eAApBA,aAAA,CAAsBI,MAA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b;IACJ;IACA,OAAO,IAAI;EACf;;EAEA;AACJ;AACA;AACA;AACA;EACWE,QAAQA,CAAA,EAAW;IACtB,OAAO,IAAI,CAACnD,IAAI;EACpB;AACJ;AA9aI;AACJ;AACA;AACA;AAHIX,eAAA,CADStB,aAAa,eAKaD,SAAS,CAACwB,QAAQ;AAErD;AACJ;AACA;AACA;AAHID,eAAA,CAPStB,aAAa,cAWYD,SAAS,CAACyB,OAAO","ignoreList":[]}
1
+ {"version":3,"file":"event-timeline.js","names":["RoomState","EventType","Direction","EventTimeline","setEventMetadata","event","stateContext","toStartOfTimeline","setMetadata","constructor","eventTimelineSet","_eventTimelineSet$roo","_eventTimelineSet$roo2","_defineProperty","Backward","Forward","roomId","room","startState","endState","paginationRequests","b","f","name","Date","toISOString","initialiseState","stateEvents","_this$startState","_this$endState","timelineWasEmpty","arguments","length","undefined","events","Error","setStateEvents","forkLive","direction","forkState","getState","timeline","clone","fork","getRoomId","getFilter","getTimelineSet","getBaseIndex","baseIndex","getEvents","BACKWARDS","FORWARDS","getPaginationToken","paginationToken","startToken","endToken","setPaginationToken","token","getNeighbouringTimeline","prevTimeline","nextTimeline","setNeighbouringTimeline","neighbour","addEvent","_ref","roomState","addToState","timelineSet","isState","getUnfilteredTimelineSet","_roomState","sender","getType","RoomMember","insertIndex","splice","insertEvent","removeEvent","eventId","i","ev","getId","toString"],"sources":["../../src/models/event-timeline.ts"],"sourcesContent":["/*\nCopyright 2016 - 2021 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 { IMarkerFoundOptions, RoomState } from \"./room-state.ts\";\nimport { EventTimelineSet } from \"./event-timeline-set.ts\";\nimport { MatrixEvent } from \"./event.ts\";\nimport { Filter } from \"../filter.ts\";\nimport { EventType } from \"../@types/event.ts\";\n\nexport interface IInitialiseStateOptions extends Pick<IMarkerFoundOptions, \"timelineWasEmpty\"> {\n // This is a separate interface without any extra stuff currently added on\n // top of `IMarkerFoundOptions` just because it feels like they have\n // different concerns. One shouldn't necessarily look to add to\n // `IMarkerFoundOptions` just because they want to add an extra option to\n // `initialiseState`.\n}\n\nexport interface IAddEventOptions extends Pick<IMarkerFoundOptions, \"timelineWasEmpty\"> {\n /** Whether to insert the new event at the start of the timeline where the\n * oldest events are (timeline is in chronological order, oldest to most\n * recent) */\n toStartOfTimeline: boolean;\n /** The state events to reconcile metadata from */\n roomState?: RoomState;\n /** Whether to add timeline events to the state as was done in legacy sync v2.\n * If true then timeline events will be added to the state.\n * In sync v2 with org.matrix.msc4222.use_state_after and simplified sliding sync,\n * all state arrives explicitly and timeline events should not be added. */\n addToState: boolean;\n}\n\nexport enum Direction {\n Backward = \"b\",\n Forward = \"f\",\n}\n\nexport class EventTimeline {\n /**\n * Symbolic constant for methods which take a 'direction' argument:\n * refers to the start of the timeline, or backwards in time.\n */\n public static readonly BACKWARDS = Direction.Backward;\n\n /**\n * Symbolic constant for methods which take a 'direction' argument:\n * refers to the end of the timeline, or forwards in time.\n */\n public static readonly FORWARDS = Direction.Forward;\n\n /**\n * Static helper method to set sender and target properties\n *\n * @param event - the event whose metadata is to be set\n * @param stateContext - the room state to be queried\n * @param toStartOfTimeline - if true the event's forwardLooking flag is set false\n */\n public static setEventMetadata(event: MatrixEvent, stateContext: RoomState, toStartOfTimeline: boolean): void {\n event.setMetadata(stateContext, toStartOfTimeline);\n }\n\n private readonly roomId: string | null;\n private readonly name: string;\n private events: MatrixEvent[] = [];\n private baseIndex = 0;\n\n private startState?: RoomState;\n private endState?: RoomState;\n // If we have a roomId then we delegate pagination token storage to the room state objects `startState` and\n // `endState`, but for things like the notification timeline which mix multiple rooms we store the tokens ourselves.\n private startToken: string | null = null;\n private endToken: string | null = null;\n\n private prevTimeline: EventTimeline | null = null;\n private nextTimeline: EventTimeline | null = null;\n public paginationRequests: Record<Direction, Promise<boolean> | null> = {\n [Direction.Backward]: null,\n [Direction.Forward]: null,\n };\n\n /**\n * Construct a new EventTimeline\n *\n * <p>An EventTimeline represents a contiguous sequence of events in a room.\n *\n * <p>As well as keeping track of the events themselves, it stores the state of\n * the room at the beginning and end of the timeline, and pagination tokens for\n * going backwards and forwards in the timeline.\n *\n * <p>In order that clients can meaningfully maintain an index into a timeline,\n * the EventTimeline object tracks a 'baseIndex'. This starts at zero, but is\n * incremented when events are prepended to the timeline. The index of an event\n * relative to baseIndex therefore remains constant.\n *\n * <p>Once a timeline joins up with its neighbour, they are linked together into a\n * doubly-linked list.\n *\n * @param eventTimelineSet - the set of timelines this is part of\n */\n public constructor(private readonly eventTimelineSet: EventTimelineSet) {\n this.roomId = eventTimelineSet.room?.roomId ?? null;\n if (this.roomId) {\n this.startState = new RoomState(this.roomId);\n this.endState = new RoomState(this.roomId);\n }\n\n // this is used by client.js\n this.paginationRequests = { b: null, f: null };\n\n this.name = this.roomId + \":\" + new Date().toISOString();\n }\n\n /**\n * Initialise the start and end state with the given events\n *\n * <p>This can only be called before any events are added.\n *\n * @param stateEvents - list of state events to initialise the\n * state with.\n * @throws Error if an attempt is made to call this after addEvent is called.\n */\n public initialiseState(stateEvents: MatrixEvent[], { timelineWasEmpty }: IInitialiseStateOptions = {}): void {\n if (this.events.length > 0) {\n throw new Error(\"Cannot initialise state after events are added\");\n }\n\n this.startState?.setStateEvents(stateEvents, { timelineWasEmpty });\n this.endState?.setStateEvents(stateEvents, { timelineWasEmpty });\n }\n\n /**\n * Forks the (live) timeline, taking ownership of the existing directional state of this timeline.\n * All attached listeners will keep receiving state updates from the new live timeline state.\n * The end state of this timeline gets replaced with an independent copy of the current RoomState,\n * and will need a new pagination token if it ever needs to paginate forwards.\n\n * @param direction - EventTimeline.BACKWARDS to get the state at the\n * start of the timeline; EventTimeline.FORWARDS to get the state at the end\n * of the timeline.\n *\n * @returns the new timeline\n */\n public forkLive(direction: Direction): EventTimeline {\n const forkState = this.getState(direction);\n const timeline = new EventTimeline(this.eventTimelineSet);\n timeline.startState = forkState?.clone();\n // Now clobber the end state of the new live timeline with that from the\n // previous live timeline. It will be identical except that we'll keep\n // using the same RoomMember objects for the 'live' set of members with any\n // listeners still attached\n timeline.endState = forkState;\n // Firstly, we just stole the current timeline's end state, so it needs a new one.\n // Make an immutable copy of the state so back pagination will get the correct sentinels.\n this.endState = forkState?.clone();\n return timeline;\n }\n\n /**\n * Creates an independent timeline, inheriting the directional state from this timeline.\n *\n * @param direction - EventTimeline.BACKWARDS to get the state at the\n * start of the timeline; EventTimeline.FORWARDS to get the state at the end\n * of the timeline.\n *\n * @returns the new timeline\n */\n public fork(direction: Direction): EventTimeline {\n const forkState = this.getState(direction);\n const timeline = new EventTimeline(this.eventTimelineSet);\n timeline.startState = forkState?.clone();\n timeline.endState = forkState?.clone();\n return timeline;\n }\n\n /**\n * Get the ID of the room for this timeline\n * @returns room ID\n */\n public getRoomId(): string | null {\n return this.roomId;\n }\n\n /**\n * Get the filter for this timeline's timelineSet (if any)\n * @returns filter\n */\n public getFilter(): Filter | undefined {\n return this.eventTimelineSet.getFilter();\n }\n\n /**\n * Get the timelineSet for this timeline\n * @returns timelineSet\n */\n public getTimelineSet(): EventTimelineSet {\n return this.eventTimelineSet;\n }\n\n /**\n * Get the base index.\n *\n * <p>This is an index which is incremented when events are prepended to the\n * timeline. An individual event therefore stays at the same index in the array\n * relative to the base index (although note that a given event's index may\n * well be less than the base index, thus giving that event a negative relative\n * index).\n */\n public getBaseIndex(): number {\n return this.baseIndex;\n }\n\n /**\n * Get the list of events in this context\n *\n * @returns An array of MatrixEvents\n */\n public getEvents(): MatrixEvent[] {\n return this.events;\n }\n\n /**\n * Get the room state at the start/end of the timeline\n *\n * @param direction - EventTimeline.BACKWARDS to get the state at the\n * start of the timeline; EventTimeline.FORWARDS to get the state at the end\n * of the timeline.\n *\n * @returns state at the start/end of the timeline\n */\n public getState(direction: Direction): RoomState | undefined {\n if (direction == EventTimeline.BACKWARDS) {\n return this.startState;\n } else if (direction == EventTimeline.FORWARDS) {\n return this.endState;\n } else {\n throw new Error(\"Invalid direction '\" + direction + \"'\");\n }\n }\n\n /**\n * Get a pagination token\n *\n * @param direction - EventTimeline.BACKWARDS to get the pagination\n * token for going backwards in time; EventTimeline.FORWARDS to get the\n * pagination token for going forwards in time.\n *\n * @returns pagination token\n */\n public getPaginationToken(direction: Direction): string | null {\n if (this.roomId) {\n return this.getState(direction)!.paginationToken;\n } else if (direction === Direction.Backward) {\n return this.startToken;\n } else {\n return this.endToken;\n }\n }\n\n /**\n * Set a pagination token\n *\n * @param token - pagination token\n *\n * @param direction - EventTimeline.BACKWARDS to set the pagination\n * token for going backwards in time; EventTimeline.FORWARDS to set the\n * pagination token for going forwards in time.\n */\n public setPaginationToken(token: string | null, direction: Direction): void {\n if (this.roomId) {\n this.getState(direction)!.paginationToken = token;\n } else if (direction === Direction.Backward) {\n this.startToken = token;\n } else {\n this.endToken = token;\n }\n }\n\n /**\n * Get the next timeline in the series\n *\n * @param direction - EventTimeline.BACKWARDS to get the previous\n * timeline; EventTimeline.FORWARDS to get the next timeline.\n *\n * @returns previous or following timeline, if they have been\n * joined up.\n */\n public getNeighbouringTimeline(direction: Direction): EventTimeline | null {\n if (direction == EventTimeline.BACKWARDS) {\n return this.prevTimeline;\n } else if (direction == EventTimeline.FORWARDS) {\n return this.nextTimeline;\n } else {\n throw new Error(\"Invalid direction '\" + direction + \"'\");\n }\n }\n\n /**\n * Set the next timeline in the series\n *\n * @param neighbour - previous/following timeline\n *\n * @param direction - EventTimeline.BACKWARDS to set the previous\n * timeline; EventTimeline.FORWARDS to set the next timeline.\n *\n * @throws Error if an attempt is made to set the neighbouring timeline when\n * it is already set.\n */\n public setNeighbouringTimeline(neighbour: EventTimeline, direction: Direction): void {\n if (this.getNeighbouringTimeline(direction)) {\n throw new Error(\n \"timeline already has a neighbouring timeline - \" +\n \"cannot reset neighbour (direction: \" +\n direction +\n \")\",\n );\n }\n\n if (direction == EventTimeline.BACKWARDS) {\n this.prevTimeline = neighbour;\n } else if (direction == EventTimeline.FORWARDS) {\n this.nextTimeline = neighbour;\n } else {\n throw new Error(\"Invalid direction '\" + direction + \"'\");\n }\n\n // make sure we don't try to paginate this timeline\n this.setPaginationToken(null, direction);\n }\n\n /**\n * Add a new event to the timeline, and update the state\n *\n * @param event - new event\n * @param options - addEvent options\n */\n public addEvent(\n event: MatrixEvent,\n { toStartOfTimeline, roomState, timelineWasEmpty, addToState }: IAddEventOptions,\n ): void {\n if (!roomState) {\n roomState = toStartOfTimeline ? this.startState : this.endState;\n }\n\n const timelineSet = this.getTimelineSet();\n\n if (timelineSet.room) {\n EventTimeline.setEventMetadata(event, roomState!, toStartOfTimeline);\n\n // modify state but only on unfiltered timelineSets\n if (addToState && event.isState() && timelineSet.room.getUnfilteredTimelineSet() === timelineSet) {\n roomState?.setStateEvents([event], { timelineWasEmpty });\n // it is possible that the act of setting the state event means we\n // can set more metadata (specifically sender/target props), so try\n // it again if the prop wasn't previously set. It may also mean that\n // the sender/target is updated (if the event set was a room member event)\n // so we want to use the *updated* member (new avatar/name) instead.\n //\n // However, we do NOT want to do this on member events if we're going\n // back in time, else we'll set the .sender value for BEFORE the given\n // member event, whereas we want to set the .sender value for the ACTUAL\n // member event itself.\n if (!event.sender || (event.getType() === EventType.RoomMember && !toStartOfTimeline)) {\n EventTimeline.setEventMetadata(event, roomState!, toStartOfTimeline);\n }\n }\n }\n\n let insertIndex: number;\n\n if (toStartOfTimeline) {\n insertIndex = 0;\n } else {\n insertIndex = this.events.length;\n }\n\n this.events.splice(insertIndex, 0, event); // insert element\n if (toStartOfTimeline) {\n this.baseIndex++;\n }\n }\n\n /**\n * Insert a new event into the timeline, and update the state.\n *\n * TEMPORARY: until we have recursive relations, we need this function\n * to exist to allow us to insert events in timeline order, which is our\n * best guess for Sync Order.\n * This is a copy of addEvent above, modified to allow inserting an event at\n * a specific index.\n *\n * @internal\n */\n public insertEvent(event: MatrixEvent, insertIndex: number, roomState: RoomState, addToState: boolean): void {\n const timelineSet = this.getTimelineSet();\n\n if (timelineSet.room) {\n EventTimeline.setEventMetadata(event, roomState, false);\n\n // modify state but only on unfiltered timelineSets\n if (addToState && event.isState() && timelineSet.room.getUnfilteredTimelineSet() === timelineSet) {\n roomState.setStateEvents([event], {});\n // it is possible that the act of setting the state event means we\n // can set more metadata (specifically sender/target props), so try\n // it again if the prop wasn't previously set. It may also mean that\n // the sender/target is updated (if the event set was a room member event)\n // so we want to use the *updated* member (new avatar/name) instead.\n //\n // However, we do NOT want to do this on member events if we're going\n // back in time, else we'll set the .sender value for BEFORE the given\n // member event, whereas we want to set the .sender value for the ACTUAL\n // member event itself.\n if (!event.sender || event.getType() === EventType.RoomMember) {\n EventTimeline.setEventMetadata(event, roomState, false);\n }\n }\n }\n\n this.events.splice(insertIndex, 0, event); // insert element\n }\n\n /**\n * Remove an event from the timeline\n *\n * @param eventId - ID of event to be removed\n * @returns removed event, or null if not found\n */\n public removeEvent(eventId: string): MatrixEvent | null {\n for (let i = this.events.length - 1; i >= 0; i--) {\n const ev = this.events[i];\n if (ev.getId() == eventId) {\n this.events.splice(i, 1);\n if (i < this.baseIndex) {\n this.baseIndex--;\n }\n return ev;\n }\n }\n return null;\n }\n\n /**\n * Return a string to identify this timeline, for debugging\n *\n * @returns name for this timeline\n */\n public toString(): string {\n return this.name;\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAA8BA,SAAS,QAAQ,iBAAiB;AAIhE,SAASC,SAAS,QAAQ,oBAAoB;AAwB9C,WAAYC,SAAS,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AAKrB,OAAO,MAAMC,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