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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (467) hide show
  1. package/git-revision.txt +1 -1
  2. package/lib/@types/global.d.js +0 -2
  3. package/lib/@types/global.d.js.map +1 -1
  4. package/lib/browser-index.d.ts.map +1 -1
  5. package/lib/browser-index.js +0 -11
  6. package/lib/browser-index.js.map +1 -1
  7. package/lib/client.d.ts +2 -1176
  8. package/lib/client.d.ts.map +1 -1
  9. package/lib/client.js +346 -2717
  10. package/lib/client.js.map +1 -1
  11. package/lib/embedded.d.ts +0 -22
  12. package/lib/embedded.d.ts.map +1 -1
  13. package/lib/embedded.js +24 -166
  14. package/lib/embedded.js.map +1 -1
  15. package/lib/event-mapper.d.ts.map +1 -1
  16. package/lib/event-mapper.js +0 -4
  17. package/lib/event-mapper.js.map +1 -1
  18. package/lib/matrix.d.ts +0 -19
  19. package/lib/matrix.d.ts.map +1 -1
  20. package/lib/matrix.js +1 -26
  21. package/lib/matrix.js.map +1 -1
  22. package/lib/models/MSC3089Branch.d.ts.map +1 -1
  23. package/lib/models/MSC3089Branch.js +0 -3
  24. package/lib/models/MSC3089Branch.js.map +1 -1
  25. package/lib/models/event.d.ts +0 -94
  26. package/lib/models/event.d.ts.map +1 -1
  27. package/lib/models/event.js +0 -274
  28. package/lib/models/event.js.map +1 -1
  29. package/lib/models/poll.d.ts.map +1 -1
  30. package/lib/models/poll.js +1 -5
  31. package/lib/models/poll.js.map +1 -1
  32. package/lib/models/relations-container.d.ts.map +1 -1
  33. package/lib/models/relations-container.js +1 -7
  34. package/lib/models/relations-container.js.map +1 -1
  35. package/lib/models/relations.d.ts +0 -1
  36. package/lib/models/relations.d.ts.map +1 -1
  37. package/lib/models/relations.js +0 -8
  38. package/lib/models/relations.js.map +1 -1
  39. package/lib/models/room-state.d.ts.map +1 -1
  40. package/lib/models/room-state.js +10 -26
  41. package/lib/models/room-state.js.map +1 -1
  42. package/lib/models/room.d.ts +0 -18
  43. package/lib/models/room.d.ts.map +1 -1
  44. package/lib/models/room.js +94 -148
  45. package/lib/models/room.js.map +1 -1
  46. package/lib/models/thread.d.ts.map +1 -1
  47. package/lib/models/thread.js +0 -1
  48. package/lib/models/thread.js.map +1 -1
  49. package/lib/sliding-sync-sdk.d.ts +2 -3
  50. package/lib/sliding-sync-sdk.d.ts.map +1 -1
  51. package/lib/sliding-sync-sdk.js +41 -90
  52. package/lib/sliding-sync-sdk.js.map +1 -1
  53. package/lib/sync.d.ts +0 -12
  54. package/lib/sync.d.ts.map +1 -1
  55. package/lib/sync.js +1 -73
  56. package/lib/sync.js.map +1 -1
  57. package/lib/testing.d.ts +0 -48
  58. package/lib/testing.d.ts.map +1 -1
  59. package/lib/testing.js +0 -105
  60. package/lib/testing.js.map +1 -1
  61. package/package.json +1 -3
  62. package/src/@types/global.d.ts +0 -3
  63. package/src/browser-index.ts +0 -11
  64. package/src/client.ts +57 -2732
  65. package/src/embedded.ts +3 -130
  66. package/src/event-mapper.ts +0 -4
  67. package/src/matrix.ts +0 -28
  68. package/src/models/MSC3089Branch.ts +0 -3
  69. package/src/models/event.ts +0 -289
  70. package/src/models/poll.ts +0 -6
  71. package/src/models/relations-container.ts +1 -8
  72. package/src/models/relations.ts +0 -8
  73. package/src/models/room-state.ts +2 -8
  74. package/src/models/room.ts +0 -62
  75. package/src/models/thread.ts +0 -1
  76. package/src/sliding-sync-sdk.ts +2 -72
  77. package/src/sync.ts +1 -98
  78. package/src/testing.ts +0 -108
  79. package/lib/@types/crypto.d.ts +0 -47
  80. package/lib/@types/crypto.d.ts.map +0 -1
  81. package/lib/@types/crypto.js +0 -1
  82. package/lib/@types/crypto.js.map +0 -1
  83. package/lib/@types/matrix-sdk-crypto-wasm.d.js +0 -1
  84. package/lib/@types/matrix-sdk-crypto-wasm.d.js.map +0 -1
  85. package/lib/common-crypto/CryptoBackend.d.ts +0 -240
  86. package/lib/common-crypto/CryptoBackend.d.ts.map +0 -1
  87. package/lib/common-crypto/CryptoBackend.js +0 -73
  88. package/lib/common-crypto/CryptoBackend.js.map +0 -1
  89. package/lib/common-crypto/key-passphrase.d.ts +0 -14
  90. package/lib/common-crypto/key-passphrase.d.ts.map +0 -1
  91. package/lib/common-crypto/key-passphrase.js +0 -33
  92. package/lib/common-crypto/key-passphrase.js.map +0 -1
  93. package/lib/crypto/CrossSigning.d.ts +0 -184
  94. package/lib/crypto/CrossSigning.d.ts.map +0 -1
  95. package/lib/crypto/CrossSigning.js +0 -718
  96. package/lib/crypto/CrossSigning.js.map +0 -1
  97. package/lib/crypto/DeviceList.d.ts +0 -216
  98. package/lib/crypto/DeviceList.d.ts.map +0 -1
  99. package/lib/crypto/DeviceList.js +0 -892
  100. package/lib/crypto/DeviceList.js.map +0 -1
  101. package/lib/crypto/EncryptionSetup.d.ts +0 -152
  102. package/lib/crypto/EncryptionSetup.d.ts.map +0 -1
  103. package/lib/crypto/EncryptionSetup.js +0 -356
  104. package/lib/crypto/EncryptionSetup.js.map +0 -1
  105. package/lib/crypto/OlmDevice.d.ts +0 -457
  106. package/lib/crypto/OlmDevice.d.ts.map +0 -1
  107. package/lib/crypto/OlmDevice.js +0 -1241
  108. package/lib/crypto/OlmDevice.js.map +0 -1
  109. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts +0 -109
  110. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts.map +0 -1
  111. package/lib/crypto/OutgoingRoomKeyRequestManager.js +0 -415
  112. package/lib/crypto/OutgoingRoomKeyRequestManager.js.map +0 -1
  113. package/lib/crypto/RoomList.d.ts +0 -26
  114. package/lib/crypto/RoomList.d.ts.map +0 -1
  115. package/lib/crypto/RoomList.js +0 -71
  116. package/lib/crypto/RoomList.js.map +0 -1
  117. package/lib/crypto/SecretSharing.d.ts +0 -24
  118. package/lib/crypto/SecretSharing.d.ts.map +0 -1
  119. package/lib/crypto/SecretSharing.js +0 -194
  120. package/lib/crypto/SecretSharing.js.map +0 -1
  121. package/lib/crypto/SecretStorage.d.ts +0 -55
  122. package/lib/crypto/SecretStorage.d.ts.map +0 -1
  123. package/lib/crypto/SecretStorage.js +0 -118
  124. package/lib/crypto/SecretStorage.js.map +0 -1
  125. package/lib/crypto/aes.d.ts +0 -6
  126. package/lib/crypto/aes.d.ts.map +0 -1
  127. package/lib/crypto/aes.js +0 -24
  128. package/lib/crypto/aes.js.map +0 -1
  129. package/lib/crypto/algorithms/base.d.ts +0 -156
  130. package/lib/crypto/algorithms/base.d.ts.map +0 -1
  131. package/lib/crypto/algorithms/base.js +0 -187
  132. package/lib/crypto/algorithms/base.js.map +0 -1
  133. package/lib/crypto/algorithms/index.d.ts +0 -4
  134. package/lib/crypto/algorithms/index.d.ts.map +0 -1
  135. package/lib/crypto/algorithms/index.js +0 -20
  136. package/lib/crypto/algorithms/index.js.map +0 -1
  137. package/lib/crypto/algorithms/megolm.d.ts +0 -385
  138. package/lib/crypto/algorithms/megolm.d.ts.map +0 -1
  139. package/lib/crypto/algorithms/megolm.js +0 -1822
  140. package/lib/crypto/algorithms/megolm.js.map +0 -1
  141. package/lib/crypto/algorithms/olm.d.ts +0 -5
  142. package/lib/crypto/algorithms/olm.d.ts.map +0 -1
  143. package/lib/crypto/algorithms/olm.js +0 -299
  144. package/lib/crypto/algorithms/olm.js.map +0 -1
  145. package/lib/crypto/api.d.ts +0 -32
  146. package/lib/crypto/api.d.ts.map +0 -1
  147. package/lib/crypto/api.js +0 -22
  148. package/lib/crypto/api.js.map +0 -1
  149. package/lib/crypto/backup.d.ts +0 -227
  150. package/lib/crypto/backup.d.ts.map +0 -1
  151. package/lib/crypto/backup.js +0 -824
  152. package/lib/crypto/backup.js.map +0 -1
  153. package/lib/crypto/crypto.d.ts +0 -3
  154. package/lib/crypto/crypto.d.ts.map +0 -1
  155. package/lib/crypto/crypto.js +0 -19
  156. package/lib/crypto/crypto.js.map +0 -1
  157. package/lib/crypto/dehydration.d.ts +0 -34
  158. package/lib/crypto/dehydration.d.ts.map +0 -1
  159. package/lib/crypto/dehydration.js +0 -252
  160. package/lib/crypto/dehydration.js.map +0 -1
  161. package/lib/crypto/device-converter.d.ts +0 -9
  162. package/lib/crypto/device-converter.d.ts.map +0 -1
  163. package/lib/crypto/device-converter.js +0 -42
  164. package/lib/crypto/device-converter.js.map +0 -1
  165. package/lib/crypto/deviceinfo.d.ts +0 -99
  166. package/lib/crypto/deviceinfo.d.ts.map +0 -1
  167. package/lib/crypto/deviceinfo.js +0 -148
  168. package/lib/crypto/deviceinfo.js.map +0 -1
  169. package/lib/crypto/index.d.ts +0 -1209
  170. package/lib/crypto/index.d.ts.map +0 -1
  171. package/lib/crypto/index.js +0 -4097
  172. package/lib/crypto/index.js.map +0 -1
  173. package/lib/crypto/key_passphrase.d.ts +0 -14
  174. package/lib/crypto/key_passphrase.d.ts.map +0 -1
  175. package/lib/crypto/key_passphrase.js +0 -44
  176. package/lib/crypto/key_passphrase.js.map +0 -1
  177. package/lib/crypto/keybackup.d.ts +0 -18
  178. package/lib/crypto/keybackup.d.ts.map +0 -1
  179. package/lib/crypto/keybackup.js +0 -1
  180. package/lib/crypto/keybackup.js.map +0 -1
  181. package/lib/crypto/olmlib.d.ts +0 -129
  182. package/lib/crypto/olmlib.d.ts.map +0 -1
  183. package/lib/crypto/olmlib.js +0 -492
  184. package/lib/crypto/olmlib.js.map +0 -1
  185. package/lib/crypto/recoverykey.d.ts +0 -2
  186. package/lib/crypto/recoverykey.d.ts.map +0 -1
  187. package/lib/crypto/recoverykey.js +0 -19
  188. package/lib/crypto/recoverykey.js.map +0 -1
  189. package/lib/crypto/store/base.d.ts +0 -252
  190. package/lib/crypto/store/base.d.ts.map +0 -1
  191. package/lib/crypto/store/base.js +0 -64
  192. package/lib/crypto/store/base.js.map +0 -1
  193. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts +0 -187
  194. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts.map +0 -1
  195. package/lib/crypto/store/indexeddb-crypto-store-backend.js +0 -1145
  196. package/lib/crypto/store/indexeddb-crypto-store-backend.js.map +0 -1
  197. package/lib/crypto/store/indexeddb-crypto-store.d.ts +0 -432
  198. package/lib/crypto/store/indexeddb-crypto-store.d.ts.map +0 -1
  199. package/lib/crypto/store/indexeddb-crypto-store.js +0 -728
  200. package/lib/crypto/store/indexeddb-crypto-store.js.map +0 -1
  201. package/lib/crypto/store/localStorage-crypto-store.d.ts +0 -119
  202. package/lib/crypto/store/localStorage-crypto-store.d.ts.map +0 -1
  203. package/lib/crypto/store/localStorage-crypto-store.js +0 -531
  204. package/lib/crypto/store/localStorage-crypto-store.js.map +0 -1
  205. package/lib/crypto/store/memory-crypto-store.d.ts +0 -215
  206. package/lib/crypto/store/memory-crypto-store.d.ts.map +0 -1
  207. package/lib/crypto/store/memory-crypto-store.js +0 -622
  208. package/lib/crypto/store/memory-crypto-store.js.map +0 -1
  209. package/lib/crypto/verification/Base.d.ts +0 -105
  210. package/lib/crypto/verification/Base.d.ts.map +0 -1
  211. package/lib/crypto/verification/Base.js +0 -372
  212. package/lib/crypto/verification/Base.js.map +0 -1
  213. package/lib/crypto/verification/Error.d.ts +0 -35
  214. package/lib/crypto/verification/Error.d.ts.map +0 -1
  215. package/lib/crypto/verification/Error.js +0 -86
  216. package/lib/crypto/verification/Error.js.map +0 -1
  217. package/lib/crypto/verification/IllegalMethod.d.ts +0 -15
  218. package/lib/crypto/verification/IllegalMethod.d.ts.map +0 -1
  219. package/lib/crypto/verification/IllegalMethod.js +0 -43
  220. package/lib/crypto/verification/IllegalMethod.js.map +0 -1
  221. package/lib/crypto/verification/QRCode.d.ts +0 -51
  222. package/lib/crypto/verification/QRCode.d.ts.map +0 -1
  223. package/lib/crypto/verification/QRCode.js +0 -277
  224. package/lib/crypto/verification/QRCode.js.map +0 -1
  225. package/lib/crypto/verification/SAS.d.ts +0 -27
  226. package/lib/crypto/verification/SAS.d.ts.map +0 -1
  227. package/lib/crypto/verification/SAS.js +0 -485
  228. package/lib/crypto/verification/SAS.js.map +0 -1
  229. package/lib/crypto/verification/SASDecimal.d.ts +0 -8
  230. package/lib/crypto/verification/SASDecimal.d.ts.map +0 -1
  231. package/lib/crypto/verification/SASDecimal.js +0 -34
  232. package/lib/crypto/verification/SASDecimal.js.map +0 -1
  233. package/lib/crypto/verification/request/Channel.d.ts +0 -18
  234. package/lib/crypto/verification/request/Channel.d.ts.map +0 -1
  235. package/lib/crypto/verification/request/Channel.js +0 -1
  236. package/lib/crypto/verification/request/Channel.js.map +0 -1
  237. package/lib/crypto/verification/request/InRoomChannel.d.ts +0 -113
  238. package/lib/crypto/verification/request/InRoomChannel.d.ts.map +0 -1
  239. package/lib/crypto/verification/request/InRoomChannel.js +0 -351
  240. package/lib/crypto/verification/request/InRoomChannel.js.map +0 -1
  241. package/lib/crypto/verification/request/ToDeviceChannel.d.ts +0 -105
  242. package/lib/crypto/verification/request/ToDeviceChannel.d.ts.map +0 -1
  243. package/lib/crypto/verification/request/ToDeviceChannel.js +0 -328
  244. package/lib/crypto/verification/request/ToDeviceChannel.js.map +0 -1
  245. package/lib/crypto/verification/request/VerificationRequest.d.ts +0 -227
  246. package/lib/crypto/verification/request/VerificationRequest.d.ts.map +0 -1
  247. package/lib/crypto/verification/request/VerificationRequest.js +0 -937
  248. package/lib/crypto/verification/request/VerificationRequest.js.map +0 -1
  249. package/lib/crypto-api/CryptoEvent.d.ts +0 -69
  250. package/lib/crypto-api/CryptoEvent.d.ts.map +0 -1
  251. package/lib/crypto-api/CryptoEvent.js +0 -33
  252. package/lib/crypto-api/CryptoEvent.js.map +0 -1
  253. package/lib/crypto-api/CryptoEventHandlerMap.d.ts +0 -16
  254. package/lib/crypto-api/CryptoEventHandlerMap.d.ts.map +0 -1
  255. package/lib/crypto-api/CryptoEventHandlerMap.js +0 -22
  256. package/lib/crypto-api/CryptoEventHandlerMap.js.map +0 -1
  257. package/lib/crypto-api/index.d.ts +0 -978
  258. package/lib/crypto-api/index.d.ts.map +0 -1
  259. package/lib/crypto-api/index.js +0 -304
  260. package/lib/crypto-api/index.js.map +0 -1
  261. package/lib/crypto-api/key-passphrase.d.ts +0 -11
  262. package/lib/crypto-api/key-passphrase.d.ts.map +0 -1
  263. package/lib/crypto-api/key-passphrase.js +0 -51
  264. package/lib/crypto-api/key-passphrase.js.map +0 -1
  265. package/lib/crypto-api/keybackup.d.ts +0 -88
  266. package/lib/crypto-api/keybackup.d.ts.map +0 -1
  267. package/lib/crypto-api/keybackup.js +0 -1
  268. package/lib/crypto-api/keybackup.js.map +0 -1
  269. package/lib/crypto-api/recovery-key.d.ts +0 -11
  270. package/lib/crypto-api/recovery-key.d.ts.map +0 -1
  271. package/lib/crypto-api/recovery-key.js +0 -65
  272. package/lib/crypto-api/recovery-key.js.map +0 -1
  273. package/lib/crypto-api/verification.d.ts +0 -344
  274. package/lib/crypto-api/verification.d.ts.map +0 -1
  275. package/lib/crypto-api/verification.js +0 -91
  276. package/lib/crypto-api/verification.js.map +0 -1
  277. package/lib/rendezvous/MSC4108SignInWithQR.d.ts +0 -112
  278. package/lib/rendezvous/MSC4108SignInWithQR.d.ts.map +0 -1
  279. package/lib/rendezvous/MSC4108SignInWithQR.js +0 -392
  280. package/lib/rendezvous/MSC4108SignInWithQR.js.map +0 -1
  281. package/lib/rendezvous/RendezvousChannel.d.ts +0 -27
  282. package/lib/rendezvous/RendezvousChannel.d.ts.map +0 -1
  283. package/lib/rendezvous/RendezvousChannel.js +0 -1
  284. package/lib/rendezvous/RendezvousChannel.js.map +0 -1
  285. package/lib/rendezvous/RendezvousCode.d.ts +0 -9
  286. package/lib/rendezvous/RendezvousCode.d.ts.map +0 -1
  287. package/lib/rendezvous/RendezvousCode.js +0 -1
  288. package/lib/rendezvous/RendezvousCode.js.map +0 -1
  289. package/lib/rendezvous/RendezvousError.d.ts +0 -6
  290. package/lib/rendezvous/RendezvousError.d.ts.map +0 -1
  291. package/lib/rendezvous/RendezvousError.js +0 -23
  292. package/lib/rendezvous/RendezvousError.js.map +0 -1
  293. package/lib/rendezvous/RendezvousFailureReason.d.ts +0 -31
  294. package/lib/rendezvous/RendezvousFailureReason.d.ts.map +0 -1
  295. package/lib/rendezvous/RendezvousFailureReason.js +0 -38
  296. package/lib/rendezvous/RendezvousFailureReason.js.map +0 -1
  297. package/lib/rendezvous/RendezvousIntent.d.ts +0 -5
  298. package/lib/rendezvous/RendezvousIntent.d.ts.map +0 -1
  299. package/lib/rendezvous/RendezvousIntent.js +0 -22
  300. package/lib/rendezvous/RendezvousIntent.js.map +0 -1
  301. package/lib/rendezvous/RendezvousTransport.d.ts +0 -36
  302. package/lib/rendezvous/RendezvousTransport.d.ts.map +0 -1
  303. package/lib/rendezvous/RendezvousTransport.js +0 -1
  304. package/lib/rendezvous/RendezvousTransport.js.map +0 -1
  305. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts +0 -58
  306. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts.map +0 -1
  307. package/lib/rendezvous/channels/MSC4108SecureChannel.js +0 -246
  308. package/lib/rendezvous/channels/MSC4108SecureChannel.js.map +0 -1
  309. package/lib/rendezvous/channels/index.d.ts +0 -2
  310. package/lib/rendezvous/channels/index.d.ts.map +0 -1
  311. package/lib/rendezvous/channels/index.js +0 -18
  312. package/lib/rendezvous/channels/index.js.map +0 -1
  313. package/lib/rendezvous/index.d.ts +0 -10
  314. package/lib/rendezvous/index.d.ts.map +0 -1
  315. package/lib/rendezvous/index.js +0 -23
  316. package/lib/rendezvous/index.js.map +0 -1
  317. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts +0 -61
  318. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts.map +0 -1
  319. package/lib/rendezvous/transports/MSC4108RendezvousSession.js +0 -253
  320. package/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +0 -1
  321. package/lib/rendezvous/transports/index.d.ts +0 -2
  322. package/lib/rendezvous/transports/index.d.ts.map +0 -1
  323. package/lib/rendezvous/transports/index.js +0 -18
  324. package/lib/rendezvous/transports/index.js.map +0 -1
  325. package/lib/rust-crypto/CrossSigningIdentity.d.ts +0 -33
  326. package/lib/rust-crypto/CrossSigningIdentity.d.ts.map +0 -1
  327. package/lib/rust-crypto/CrossSigningIdentity.js +0 -157
  328. package/lib/rust-crypto/CrossSigningIdentity.js.map +0 -1
  329. package/lib/rust-crypto/DehydratedDeviceManager.d.ts +0 -98
  330. package/lib/rust-crypto/DehydratedDeviceManager.d.ts.map +0 -1
  331. package/lib/rust-crypto/DehydratedDeviceManager.js +0 -285
  332. package/lib/rust-crypto/DehydratedDeviceManager.js.map +0 -1
  333. package/lib/rust-crypto/KeyClaimManager.d.ts +0 -33
  334. package/lib/rust-crypto/KeyClaimManager.d.ts.map +0 -1
  335. package/lib/rust-crypto/KeyClaimManager.js +0 -82
  336. package/lib/rust-crypto/KeyClaimManager.js.map +0 -1
  337. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts +0 -43
  338. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts.map +0 -1
  339. package/lib/rust-crypto/OutgoingRequestProcessor.js +0 -195
  340. package/lib/rust-crypto/OutgoingRequestProcessor.js.map +0 -1
  341. package/lib/rust-crypto/OutgoingRequestsManager.d.ts +0 -47
  342. package/lib/rust-crypto/OutgoingRequestsManager.d.ts.map +0 -1
  343. package/lib/rust-crypto/OutgoingRequestsManager.js +0 -148
  344. package/lib/rust-crypto/OutgoingRequestsManager.js.map +0 -1
  345. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts +0 -120
  346. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts.map +0 -1
  347. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js +0 -467
  348. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +0 -1
  349. package/lib/rust-crypto/RoomEncryptor.d.ts +0 -98
  350. package/lib/rust-crypto/RoomEncryptor.d.ts.map +0 -1
  351. package/lib/rust-crypto/RoomEncryptor.js +0 -299
  352. package/lib/rust-crypto/RoomEncryptor.js.map +0 -1
  353. package/lib/rust-crypto/backup.d.ts +0 -254
  354. package/lib/rust-crypto/backup.d.ts.map +0 -1
  355. package/lib/rust-crypto/backup.js +0 -837
  356. package/lib/rust-crypto/backup.js.map +0 -1
  357. package/lib/rust-crypto/constants.d.ts +0 -3
  358. package/lib/rust-crypto/constants.d.ts.map +0 -1
  359. package/lib/rust-crypto/constants.js +0 -19
  360. package/lib/rust-crypto/constants.js.map +0 -1
  361. package/lib/rust-crypto/device-converter.d.ts +0 -28
  362. package/lib/rust-crypto/device-converter.d.ts.map +0 -1
  363. package/lib/rust-crypto/device-converter.js +0 -123
  364. package/lib/rust-crypto/device-converter.js.map +0 -1
  365. package/lib/rust-crypto/index.d.ts +0 -61
  366. package/lib/rust-crypto/index.d.ts.map +0 -1
  367. package/lib/rust-crypto/index.js +0 -152
  368. package/lib/rust-crypto/index.js.map +0 -1
  369. package/lib/rust-crypto/libolm_migration.d.ts +0 -81
  370. package/lib/rust-crypto/libolm_migration.d.ts.map +0 -1
  371. package/lib/rust-crypto/libolm_migration.js +0 -459
  372. package/lib/rust-crypto/libolm_migration.js.map +0 -1
  373. package/lib/rust-crypto/rust-crypto.d.ts +0 -556
  374. package/lib/rust-crypto/rust-crypto.d.ts.map +0 -1
  375. package/lib/rust-crypto/rust-crypto.js +0 -2016
  376. package/lib/rust-crypto/rust-crypto.js.map +0 -1
  377. package/lib/rust-crypto/secret-storage.d.ts +0 -22
  378. package/lib/rust-crypto/secret-storage.d.ts.map +0 -1
  379. package/lib/rust-crypto/secret-storage.js +0 -63
  380. package/lib/rust-crypto/secret-storage.js.map +0 -1
  381. package/lib/rust-crypto/verification.d.ts +0 -319
  382. package/lib/rust-crypto/verification.d.ts.map +0 -1
  383. package/lib/rust-crypto/verification.js +0 -816
  384. package/lib/rust-crypto/verification.js.map +0 -1
  385. package/lib/secret-storage.d.ts +0 -370
  386. package/lib/secret-storage.d.ts.map +0 -1
  387. package/lib/secret-storage.js +0 -466
  388. package/lib/secret-storage.js.map +0 -1
  389. package/src/@types/crypto.ts +0 -73
  390. package/src/@types/matrix-sdk-crypto-wasm.d.ts +0 -44
  391. package/src/common-crypto/CryptoBackend.ts +0 -302
  392. package/src/common-crypto/README.md +0 -4
  393. package/src/common-crypto/key-passphrase.ts +0 -43
  394. package/src/crypto/CrossSigning.ts +0 -773
  395. package/src/crypto/DeviceList.ts +0 -989
  396. package/src/crypto/EncryptionSetup.ts +0 -351
  397. package/src/crypto/OlmDevice.ts +0 -1500
  398. package/src/crypto/OutgoingRoomKeyRequestManager.ts +0 -485
  399. package/src/crypto/RoomList.ts +0 -70
  400. package/src/crypto/SecretSharing.ts +0 -240
  401. package/src/crypto/SecretStorage.ts +0 -136
  402. package/src/crypto/aes.ts +0 -23
  403. package/src/crypto/algorithms/base.ts +0 -236
  404. package/src/crypto/algorithms/index.ts +0 -20
  405. package/src/crypto/algorithms/megolm.ts +0 -2216
  406. package/src/crypto/algorithms/olm.ts +0 -381
  407. package/src/crypto/api.ts +0 -70
  408. package/src/crypto/backup.ts +0 -922
  409. package/src/crypto/crypto.ts +0 -18
  410. package/src/crypto/dehydration.ts +0 -272
  411. package/src/crypto/device-converter.ts +0 -45
  412. package/src/crypto/deviceinfo.ts +0 -158
  413. package/src/crypto/index.ts +0 -4414
  414. package/src/crypto/key_passphrase.ts +0 -42
  415. package/src/crypto/keybackup.ts +0 -47
  416. package/src/crypto/olmlib.ts +0 -539
  417. package/src/crypto/recoverykey.ts +0 -18
  418. package/src/crypto/store/base.ts +0 -348
  419. package/src/crypto/store/indexeddb-crypto-store-backend.ts +0 -1250
  420. package/src/crypto/store/indexeddb-crypto-store.ts +0 -845
  421. package/src/crypto/store/localStorage-crypto-store.ts +0 -579
  422. package/src/crypto/store/memory-crypto-store.ts +0 -680
  423. package/src/crypto/verification/Base.ts +0 -409
  424. package/src/crypto/verification/Error.ts +0 -76
  425. package/src/crypto/verification/IllegalMethod.ts +0 -50
  426. package/src/crypto/verification/QRCode.ts +0 -310
  427. package/src/crypto/verification/SAS.ts +0 -494
  428. package/src/crypto/verification/SASDecimal.ts +0 -37
  429. package/src/crypto/verification/request/Channel.ts +0 -34
  430. package/src/crypto/verification/request/InRoomChannel.ts +0 -371
  431. package/src/crypto/verification/request/ToDeviceChannel.ts +0 -354
  432. package/src/crypto/verification/request/VerificationRequest.ts +0 -976
  433. package/src/crypto-api/CryptoEvent.ts +0 -93
  434. package/src/crypto-api/CryptoEventHandlerMap.ts +0 -32
  435. package/src/crypto-api/index.ts +0 -1175
  436. package/src/crypto-api/key-passphrase.ts +0 -58
  437. package/src/crypto-api/keybackup.ts +0 -115
  438. package/src/crypto-api/recovery-key.ts +0 -69
  439. package/src/crypto-api/verification.ts +0 -408
  440. package/src/rendezvous/MSC4108SignInWithQR.ts +0 -444
  441. package/src/rendezvous/RendezvousChannel.ts +0 -48
  442. package/src/rendezvous/RendezvousCode.ts +0 -25
  443. package/src/rendezvous/RendezvousError.ts +0 -26
  444. package/src/rendezvous/RendezvousFailureReason.ts +0 -49
  445. package/src/rendezvous/RendezvousIntent.ts +0 -20
  446. package/src/rendezvous/RendezvousTransport.ts +0 -58
  447. package/src/rendezvous/channels/MSC4108SecureChannel.ts +0 -270
  448. package/src/rendezvous/channels/index.ts +0 -17
  449. package/src/rendezvous/index.ts +0 -25
  450. package/src/rendezvous/transports/MSC4108RendezvousSession.ts +0 -270
  451. package/src/rendezvous/transports/index.ts +0 -17
  452. package/src/rust-crypto/CrossSigningIdentity.ts +0 -183
  453. package/src/rust-crypto/DehydratedDeviceManager.ts +0 -306
  454. package/src/rust-crypto/KeyClaimManager.ts +0 -86
  455. package/src/rust-crypto/OutgoingRequestProcessor.ts +0 -236
  456. package/src/rust-crypto/OutgoingRequestsManager.ts +0 -143
  457. package/src/rust-crypto/PerSessionKeyBackupDownloader.ts +0 -501
  458. package/src/rust-crypto/RoomEncryptor.ts +0 -352
  459. package/src/rust-crypto/backup.ts +0 -881
  460. package/src/rust-crypto/constants.ts +0 -18
  461. package/src/rust-crypto/device-converter.ts +0 -128
  462. package/src/rust-crypto/index.ts +0 -237
  463. package/src/rust-crypto/libolm_migration.ts +0 -530
  464. package/src/rust-crypto/rust-crypto.ts +0 -2205
  465. package/src/rust-crypto/secret-storage.ts +0 -60
  466. package/src/rust-crypto/verification.ts +0 -830
  467. package/src/secret-storage.ts +0 -693
@@ -1 +1 @@
1
- {"version":3,"file":"thread.d.ts","sourceRoot":"","sources":["../../src/models/thread.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAGlE,OAAO,EAA8B,WAAW,EAAoB,MAAM,YAAY,CAAC;AACvF,OAAO,EAAa,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAExE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,OAAO,EAAe,MAAM,4BAA4B,CAAC;AAG1F,oBAAY,WAAW;IACnB,GAAG,eAAe;IAClB,MAAM,kBAAkB;IACxB,QAAQ,oBAAoB;IAC5B,UAAU,sBAAsB;IAChC,MAAM,kBAAkB;CAC3B;AAED,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,aAAa,CAAC;AAEvH,MAAM,MAAM,qBAAqB,GAAG;IAChC,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,CAAC,WAAW,CAAC,QAA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E,OAAO,GAAG,IAAI;IAI/D;;;;;;;;OAQG;IACI,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI;IAgEnF;;;;;;;;;;OAUG;IACI,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAkB1D,SAAS,CAAC,IAAI,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAIlE;;;;;;OAMG;IACI,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;CAG1E;AAYD,eAAO,MAAM,yBAAyB,sFAGrC,CAAC;AACF,eAAO,MAAM,2BAA2B,sFAGvC,CAAC;AACF,eAAO,MAAM,oBAAoB,kEAAuE,CAAC;AAEzG,oBAAY,gBAAgB;IACxB,IAAI,IAAA;IACJ,KAAK,IAAA;CACR;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,GAAG,KAAK,GAAG,cAAc,CAO9F"}
@@ -326,7 +326,6 @@ export class Thread extends ReadReceipt {
326
326
  if (!Thread.hasServerSideSupport) {
327
327
  // When there's no server-side support, just add it to the end of the timeline.
328
328
  this.addEventToTimeline(event, toStartOfTimeline);
329
- this.client.decryptEventIfNeeded(event);
330
329
  } else if (event.isRelation(RelationType.Annotation) || event.isRelation(RelationType.Replace)) {
331
330
  this.addRelatedThreadEvent(event, toStartOfTimeline);
332
331
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"thread.js","names":["PendingEventOrdering","TypedReEmitter","RelationType","MatrixEvent","MatrixEventEvent","Direction","EventTimeline","EventTimelineSet","RoomEvent","ServerControlledNamespacedValue","logger","ReadReceipt","ReceiptType","Feature","ServerSupport","ThreadEvent","FeatureSupport","determineFeatureSupport","stable","unstable","Stable","Experimental","None","Thread","constructor","id","rootEvent","opts","_this","_opts$pendingEventOrd","this","_defineProperty","hasServerSideSupport","_asyncToGenerator","processRootEventPromise","undefined","event","redaction","isRelation","THREAD_RELATION_TYPE","name","room","eventShouldLiveIn","threadId","getId","status","replyCount","updatePendingReplyCount","emit","Update","_ref2","threadRootId","threadEvent","timeline","clearEventMetadata","lastEvent","_currentUserParticipated","Delete","_this$lastEvent","getAssociatedId","updateThreadMetadata","_x","_x2","_x3","apply","arguments","toStartOfTimeline","sender","getSender","shouldSendLocalEchoReceipt","addLocalEchoReceipt","Read","onEcho","_ref3","NewReply","_x4","_x5","setMaxListeners","Error","client","pendingEventOrdering","Chronological","timelineSet","timelineSupport","pendingEvents","reEmitter","reEmit","Timeline","TimelineReset","on","BeforeRedaction","onBeforeRedaction","Redaction","onRedaction","LocalEchoUpdated","onLocalEcho","onTimelineReset","onTimelineEvent","processReceipts","receipts","setEventMetadata","fetchRootEvent","_this2","eventData","fetchRoomEvent","roomId","mapper","getEventMapper","e","error","processEvent","setServerSideSupport","FILTER_RELATED_BY_SENDERS","setPreferUnstable","FILTER_RELATED_BY_REL_TYPES","setServerSideListSupport","hasServerSideListSupport","setServerSideFwdPaginationSupport","hasServerSideFwdPaginationSupport","_this$client$canSuppo","recursionSupport","canSupport","get","RelationsRecursion","Unsupported","_this$getReadReceiptF","oldReceiptEventId","getReadReceiptForUserId","eventId","receiptEvent","findEventById","getTs","roomState","getLiveTimeline","getState","FORWARDS","addEventToTimeline","liveTimeline","fromCache","insertEventIntoTimeline","addEvents","events","forEach","ev","addEvent","length","lastReply","isNewestReply","localTimestamp","decryptEventIfNeeded","Annotation","Replace","addRelatedThreadEvent","fetchEditsWhereNeeded","_this$timelineSet$rel","_this$timelineSet$rel2","initialEventsFetched","_this$replayEvents","replayEvents","push","_this$client$canSuppo2","relations","aggregateParentEvent","aggregateChildEvent","_this3","receiptType","userId","receipt","synthetic","addReceiptToStructure","getRootEventBundledRelationship","getServerAggregatedRelation","processRootEvent","_this4","bundledRelationship","count","current_user_participated","_objectSpread","latest_event","room_id","unfilteredPendingEvents","Detached","getPendingEvents","filter","_this$lastEvent2","lastPendingEvent","pendingReplyCount","resetLiveTimeline","backPaginationToken","forwardPaginationToken","_this5","oldLive","newLive","newBackward","oldForward","res","createMessagesRequest","Forward","end","Backward","start","getPaginationToken","_oldForward","setPaginationToken","_newBackward","updateThreadFromRootEvent","_this6","_this7","initalEventFetchProm","addEventsToTimeline","paginateEventTimeline","backwards","_arguments","_this8","_this8$client$canSupp","_len","Array","_key","Promise","all","isAnEncryptedThreadMessage","map","_ref4","getType","limit","editEvent","makeReplaced","_x6","setThread","_event$event","unsigned","matches","i","replyToEvent","_ref5","_this$lastPendingEven","getEvents","has","hasCurrentUserParticipated","getUnfilteredTimelineSet","addReceipt","getEventReadUpTo","ignoreSynthesized","isCurrentUser","getUserId","beforeFirstThreadedReceipt","getOldestThreadedReceiptTs","lastReplyId","readUpToId","unthreadedReceipt","getLastUnthreadedReceiptFor","_this$timeline","_ev$getId","ts","hasUserReadEvent","_this$lastReply$getTs","_this$lastReply","_this$room$getLastUnt","_this$room$getLastUnt2","_this$lastReply$getTs2","_this$lastReply2","unthreadedReceiptTs","beforeLastUnthreadedReceipt","setUnread","type","setThreadUnreadNotificationCount","isEncrypted","isThreadRoot","ThreadFilterType","threadFilterTypeToFilter","My"],"sources":["../../src/models/thread.ts"],"sourcesContent":["/*\nCopyright 2021 - 2023 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 { Optional } from \"matrix-events-sdk\";\n\nimport { MatrixClient, PendingEventOrdering } from \"../client.ts\";\nimport { TypedReEmitter } from \"../ReEmitter.ts\";\nimport { RelationType } from \"../@types/event.ts\";\nimport { IThreadBundledRelationship, MatrixEvent, MatrixEventEvent } from \"./event.ts\";\nimport { Direction, EventTimeline } from \"./event-timeline.ts\";\nimport { EventTimelineSet, EventTimelineSetHandlerMap } from \"./event-timeline-set.ts\";\nimport { NotificationCountType, Room, RoomEvent } from \"./room.ts\";\nimport { RoomState } from \"./room-state.ts\";\nimport { ServerControlledNamespacedValue } from \"../NamespacedValue.ts\";\nimport { logger } from \"../logger.ts\";\nimport { ReadReceipt } from \"./read-receipt.ts\";\nimport { CachedReceiptStructure, Receipt, ReceiptType } from \"../@types/read_receipts.ts\";\nimport { Feature, ServerSupport } from \"../feature.ts\";\n\nexport enum ThreadEvent {\n New = \"Thread.new\",\n Update = \"Thread.update\",\n NewReply = \"Thread.newReply\",\n ViewThread = \"Thread.viewThread\",\n Delete = \"Thread.delete\",\n}\n\nexport type ThreadEmittedEvents = Exclude<ThreadEvent, ThreadEvent.New> | RoomEvent.Timeline | RoomEvent.TimelineReset;\n\nexport type ThreadEventHandlerMap = {\n [ThreadEvent.Update]: (thread: Thread) => void;\n [ThreadEvent.NewReply]: (thread: Thread, event: MatrixEvent) => void;\n [ThreadEvent.ViewThread]: () => void;\n [ThreadEvent.Delete]: (thread: Thread) => void;\n} & EventTimelineSetHandlerMap;\n\ninterface IThreadOpts {\n room: Room;\n client: MatrixClient;\n pendingEventOrdering?: PendingEventOrdering;\n receipts?: CachedReceiptStructure[];\n}\n\nexport enum FeatureSupport {\n None = 0,\n Experimental = 1,\n Stable = 2,\n}\n\nexport function determineFeatureSupport(stable: boolean, unstable: boolean): FeatureSupport {\n if (stable) {\n return FeatureSupport.Stable;\n } else if (unstable) {\n return FeatureSupport.Experimental;\n } else {\n return FeatureSupport.None;\n }\n}\n\nexport class Thread extends ReadReceipt<ThreadEmittedEvents, ThreadEventHandlerMap> {\n public static hasServerSideSupport = FeatureSupport.None;\n public static hasServerSideListSupport = FeatureSupport.None;\n public static hasServerSideFwdPaginationSupport = FeatureSupport.None;\n\n /**\n * A reference to all the events ID at the bottom of the threads\n */\n public readonly timelineSet: EventTimelineSet;\n\n private _currentUserParticipated = false;\n\n private reEmitter: TypedReEmitter<ThreadEmittedEvents, ThreadEventHandlerMap>;\n\n /**\n * The last event in this thread, if we don't yet have this in the timeline.\n *\n * When we run {@link processRootEvent} (which I think happens during the\n * setting-up of the thread), we set this to the event pointed to by the\n * server in `latest_event` [1] that came through with the thread root.\n *\n * [1]: https://spec.matrix.org/v1.8/client-server-api/#server-side-aggregation-of-mthread-relationships\n *\n * Later, when we have populated the timeline, this is set to undefined, so\n * that methods like {@link replyToEvent} fall through to use lastReply,\n * which looks in the timeline for the latest event that is a \"thread reply\"\n * i.e. directly refers to the thread root with an m.thread relation.\n *\n * So it looks like this is only really relevant when initialEventsFetched\n * is false, because as soon as the initial events have been fetched, we\n * should have a proper chunk of timeline from the pagination fetch.\n *\n * If all replies in this thread are redacted, this is set to the root\n * event. I'm not clear what the meaning of this is, since usually after the\n * initial events have been fetched, lastEvent should be undefined.\n * In fact, the whole usage inside onRedaction looks suspect - it may be\n * that we were thinking lastEvent always refers to the actual last event,\n * but it only does so before initialEventsFetched becomes true.\n *\n * The usage of lastEvent inside {@link onEcho} looks suspicious, since I'd\n * think we probably mean {@link replyToEvent} there - we are trying not to\n * echo a duplicate event, and we probably want that behaviour even after\n * initialEventsFetched has become true.\n *\n * -- andyb\n */\n private lastEvent: MatrixEvent | undefined;\n\n private replyCount = 0;\n private lastPendingEvent: MatrixEvent | undefined;\n private pendingReplyCount = 0;\n\n public readonly room: Room;\n public readonly client: MatrixClient;\n private readonly pendingEventOrdering: PendingEventOrdering;\n private processRootEventPromise?: Promise<void>;\n\n /**\n * Whether or not we need to fetch the initial set of events for the thread. We can\n * only do this if the server has support for it, so if it doesn't we just pretend\n * that we've already fetched them.\n */\n public initialEventsFetched = !Thread.hasServerSideSupport;\n private initalEventFetchProm: Promise<boolean> | undefined;\n\n /**\n * An array of events to add to the timeline once the thread has been initialised\n * with server suppport.\n */\n public replayEvents: MatrixEvent[] | null = [];\n\n public constructor(\n public readonly id: string,\n public rootEvent: MatrixEvent | undefined,\n opts: IThreadOpts,\n ) {\n super();\n\n // each Event in the thread adds a reemitter, so we could hit the listener limit.\n this.setMaxListeners(1000);\n\n if (!opts?.room) {\n // Logging/debugging for https://github.com/vector-im/element-web/issues/22141\n // Hope is that we end up with a more obvious stack trace.\n throw new Error(\"element-web#22141: A thread requires a room in order to function\");\n }\n\n this.room = opts.room;\n this.client = opts.client;\n this.pendingEventOrdering = opts.pendingEventOrdering ?? PendingEventOrdering.Chronological;\n this.timelineSet = new EventTimelineSet(\n this.room,\n {\n timelineSupport: true,\n pendingEvents: true,\n },\n this.client,\n this,\n );\n this.reEmitter = new TypedReEmitter(this);\n\n this.reEmitter.reEmit(this.timelineSet, [RoomEvent.Timeline, RoomEvent.TimelineReset]);\n\n this.room.on(MatrixEventEvent.BeforeRedaction, this.onBeforeRedaction);\n this.room.on(RoomEvent.Redaction, this.onRedaction);\n this.room.on(RoomEvent.LocalEchoUpdated, this.onLocalEcho);\n this.room.on(RoomEvent.TimelineReset, this.onTimelineReset);\n this.timelineSet.on(RoomEvent.Timeline, this.onTimelineEvent);\n\n this.processReceipts(opts.receipts);\n\n // even if this thread is thought to be originating from this client, we initialise it as we may be in a\n // gappy sync and a thread around this event may already exist.\n this.updateThreadMetadata();\n this.setEventMetadata(this.rootEvent);\n }\n\n private onTimelineReset = async (): Promise<void> => {\n // We hit a gappy sync, ask the server for an update\n await this.processRootEventPromise;\n this.processRootEventPromise = undefined;\n };\n\n private async fetchRootEvent(): Promise<void> {\n // Always fetch the root event, even if we already have it, so we can get the latest\n // state (via unsigned).\n try {\n const eventData = await this.client.fetchRoomEvent(this.roomId, this.id);\n const mapper = this.client.getEventMapper();\n this.rootEvent = mapper(eventData); // will merge with existing event object if such is known\n } catch (e) {\n logger.error(\"Failed to fetch thread root to construct thread with\", e);\n }\n await this.processEvent(this.rootEvent);\n }\n\n public static setServerSideSupport(status: FeatureSupport): void {\n Thread.hasServerSideSupport = status;\n if (status !== FeatureSupport.Stable) {\n FILTER_RELATED_BY_SENDERS.setPreferUnstable(true);\n FILTER_RELATED_BY_REL_TYPES.setPreferUnstable(true);\n THREAD_RELATION_TYPE.setPreferUnstable(true);\n }\n }\n\n public static setServerSideListSupport(status: FeatureSupport): void {\n Thread.hasServerSideListSupport = status;\n }\n\n public static setServerSideFwdPaginationSupport(status: FeatureSupport): void {\n Thread.hasServerSideFwdPaginationSupport = status;\n }\n\n private onBeforeRedaction = (event: MatrixEvent, redaction: MatrixEvent): void => {\n if (\n event?.isRelation(THREAD_RELATION_TYPE.name) &&\n this.room.eventShouldLiveIn(event).threadId === this.id &&\n event.getId() !== this.id && // the root event isn't counted in the length so ignore this redaction\n !redaction.status // only respect it when it succeeds\n ) {\n this.replyCount--;\n this.updatePendingReplyCount();\n this.emit(ThreadEvent.Update, this);\n }\n };\n\n private onRedaction = async (event: MatrixEvent, room: Room, threadRootId?: string): Promise<void> => {\n if (threadRootId !== this.id) return; // ignore redactions for other timelines\n if (this.replyCount <= 0) {\n for (const threadEvent of this.timeline) {\n this.clearEventMetadata(threadEvent);\n }\n this.lastEvent = this.rootEvent;\n this._currentUserParticipated = false;\n this.emit(ThreadEvent.Delete, this);\n } else {\n if (this.lastEvent?.getId() === event.getAssociatedId()) {\n // XXX: If our last event got redacted we query the server for the last event once again\n await this.processRootEventPromise;\n this.processRootEventPromise = undefined;\n }\n await this.updateThreadMetadata();\n }\n };\n\n private onTimelineEvent = (\n event: MatrixEvent,\n room: Room | undefined,\n toStartOfTimeline: boolean | undefined,\n ): void => {\n // Add a synthesized receipt when paginating forward in the timeline\n if (!toStartOfTimeline) {\n const sender = event.getSender();\n if (sender && room && this.shouldSendLocalEchoReceipt(sender, event)) {\n room.addLocalEchoReceipt(sender, event, ReceiptType.Read);\n }\n if (event.getId() !== this.id && event.isRelation(THREAD_RELATION_TYPE.name)) {\n this.replyCount++;\n }\n }\n this.onEcho(event, toStartOfTimeline ?? false);\n };\n\n private shouldSendLocalEchoReceipt(sender: string, event: MatrixEvent): boolean {\n const recursionSupport = this.client.canSupport.get(Feature.RelationsRecursion) ?? ServerSupport.Unsupported;\n\n if (recursionSupport === ServerSupport.Unsupported) {\n // Normally we add a local receipt, but if we don't have\n // recursion support, then events may arrive out of order, so we\n // only create a receipt if it's after our existing receipt.\n const oldReceiptEventId = this.getReadReceiptForUserId(sender)?.eventId;\n if (oldReceiptEventId) {\n const receiptEvent = this.findEventById(oldReceiptEventId);\n if (receiptEvent && receiptEvent.getTs() > event.getTs()) {\n return false;\n }\n }\n }\n\n return true;\n }\n\n private onLocalEcho = (event: MatrixEvent): void => {\n this.onEcho(event, false);\n };\n\n private onEcho = async (event: MatrixEvent, toStartOfTimeline: boolean): Promise<void> => {\n if (event.threadRootId !== this.id) return; // ignore echoes for other timelines\n if (this.lastEvent === event) return; // ignore duplicate events\n await this.updateThreadMetadata();\n if (!event.isRelation(THREAD_RELATION_TYPE.name)) return; // don't send a new reply event for reactions or edits\n if (toStartOfTimeline) return; // ignore messages added to the start of the timeline\n // Clear the lastEvent and instead start tracking locally using lastReply\n this.lastEvent = undefined;\n this.emit(ThreadEvent.NewReply, this, event);\n };\n\n public get roomState(): RoomState {\n return this.room.getLiveTimeline().getState(EventTimeline.FORWARDS)!;\n }\n\n private addEventToTimeline(event: MatrixEvent, toStartOfTimeline: boolean): void {\n if (!this.findEventById(event.getId()!)) {\n this.timelineSet.addEventToTimeline(event, this.liveTimeline, {\n toStartOfTimeline,\n fromCache: false,\n roomState: this.roomState,\n });\n }\n }\n\n /**\n * TEMPORARY. Only call this when MSC3981 is not available, and we have some\n * late-arriving events to insert, because we recursively found them as part\n * of populating a thread. When we have MSC3981 we won't need it, because\n * they will all be supplied by the homeserver in one request, and they will\n * already be in the right order in that response.\n * This is a copy of addEventToTimeline above, modified to call\n * insertEventIntoTimeline so this event is inserted into our best guess of\n * the right place based on timestamp. (We should be using Sync Order but we\n * don't have it.)\n *\n * @internal\n */\n public insertEventIntoTimeline(event: MatrixEvent): void {\n const eventId = event.getId();\n if (!eventId) {\n return;\n }\n // If the event is already in this thread, bail out\n if (this.findEventById(eventId)) {\n return;\n }\n this.timelineSet.insertEventIntoTimeline(event, this.liveTimeline, this.roomState);\n }\n\n public addEvents(events: MatrixEvent[], toStartOfTimeline: boolean): void {\n events.forEach((ev) => this.addEvent(ev, toStartOfTimeline, false));\n this.updateThreadMetadata();\n }\n\n /**\n * Add an event to the thread and updates\n * the tail/root references if needed\n * Will fire \"Thread.update\"\n * @param event - The event to add\n * @param toStartOfTimeline - whether the event is being added\n * to the start (and not the end) of the timeline.\n * @param emit - whether to emit the Update event if the thread was updated or not.\n */\n public addEvent(event: MatrixEvent, toStartOfTimeline: boolean, emit = true): void {\n // Modify this event to point at our room's state, and mark its thread\n // as this.\n this.setEventMetadata(event);\n\n // Decide whether this event is going to be added at the end of the timeline.\n const lastReply = this.lastReply();\n const isNewestReply = !lastReply || event.localTimestamp >= lastReply!.localTimestamp;\n\n if (!Thread.hasServerSideSupport) {\n // When there's no server-side support, just add it to the end of the timeline.\n this.addEventToTimeline(event, toStartOfTimeline);\n this.client.decryptEventIfNeeded(event);\n } else if (event.isRelation(RelationType.Annotation) || event.isRelation(RelationType.Replace)) {\n this.addRelatedThreadEvent(event, toStartOfTimeline);\n return;\n } else if (!toStartOfTimeline && isNewestReply) {\n // When we've asked for the event to be added to the end,\n // and this event belongs at the end, add it.\n this.addEventToTimeline(event, false);\n this.fetchEditsWhereNeeded(event);\n } else {\n // Otherwise, we should add it, but we suspect it is out of order.\n // This may be because we've just created the thread object and are\n // still fetching events, in which case add it where we think is sensible\n // and it will be removed and replaced with the events from the pagination\n // request once that completes.\n if (toStartOfTimeline) {\n // If we're adding at the start of the timeline, it doesn't\n // matter that it's out of order.\n this.addEventToTimeline(event, toStartOfTimeline);\n } else {\n // We think this event might be out of order, because isNewestReply\n // is false (otherwise we would have gone into the earlier if\n // clause), so try to insert it in the right place based on\n // timestamp.\n this.insertEventIntoTimeline(event);\n }\n }\n\n if (\n event.getId() !== this.id &&\n event.isRelation(THREAD_RELATION_TYPE.name) &&\n !toStartOfTimeline &&\n isNewestReply\n ) {\n // Clear the last event as we have the latest end of the timeline\n this.lastEvent = undefined;\n }\n\n if (emit) {\n this.emit(ThreadEvent.NewReply, this, event);\n this.updateThreadMetadata();\n }\n }\n\n private addRelatedThreadEvent(event: MatrixEvent, toStartOfTimeline: boolean): void {\n // If this event is not a direct member of the thread, but is a\n // reference to something that is, then we have two cases:\n\n if (!this.initialEventsFetched) {\n // Case 1: we haven't yet fetched events from the server. In\n // this case, when we do, the events we get back might only be\n // the first-order ones, so this event (which is second-order -\n // a reference to something directly in the thread) needs to be\n // kept so we can replay it when the first-order ones turn up.\n\n /**\n * A thread can be fully discovered via a single sync response\n * And when that's the case we still ask the server to do an initialisation\n * as it's the safest to ensure we have everything.\n * However when we are in that scenario we might loose annotation or edits\n *\n * This fix keeps a reference to those events and replay them once the thread\n * has been initialised properly.\n */\n this.replayEvents?.push(event);\n } else {\n // Case 2: this is happening later, and we have a timeline. In\n // this case, these events might be out-of order.\n //\n // Specifically, if the server doesn't support recursion, so we\n // only get these events through sync, they might be coming\n // later than the first-order ones, so we insert them based on\n // timestamp (despite the problems with this documented in\n // #3325).\n //\n // If the server does support recursion, we should have got all\n // the interspersed events from the server when we fetched the\n // initial events, so if they are coming via sync they should be\n // the latest ones, so we can add them as normal.\n //\n // (Note that both insertEventIntoTimeline and addEventToTimeline\n // do nothing if we have seen this event before.)\n\n const recursionSupport =\n this.client.canSupport.get(Feature.RelationsRecursion) ?? ServerSupport.Unsupported;\n\n if (recursionSupport === ServerSupport.Unsupported) {\n this.insertEventIntoTimeline(event);\n } else {\n this.addEventToTimeline(event, toStartOfTimeline);\n }\n }\n // Apply annotations and replace relations to the relations of the timeline only\n this.timelineSet.relations?.aggregateParentEvent(event);\n this.timelineSet.relations?.aggregateChildEvent(event, this.timelineSet);\n }\n\n public async processEvent(event: Optional<MatrixEvent>): Promise<void> {\n if (event) {\n this.setEventMetadata(event);\n await this.fetchEditsWhereNeeded(event);\n }\n }\n\n /**\n * Processes the receipts that were caught during initial sync\n * When clients become aware of a thread, they try to retrieve those read receipts\n * and apply them to the current thread\n * @param receipts - A collection of the receipts cached from initial sync\n */\n private processReceipts(receipts: CachedReceiptStructure[] = []): void {\n for (const { eventId, receiptType, userId, receipt, synthetic } of receipts) {\n this.addReceiptToStructure(eventId, receiptType as ReceiptType, userId, receipt, synthetic);\n }\n }\n\n private getRootEventBundledRelationship(rootEvent = this.rootEvent): IThreadBundledRelationship | undefined {\n return rootEvent?.getServerAggregatedRelation<IThreadBundledRelationship>(THREAD_RELATION_TYPE.name);\n }\n\n private async processRootEvent(): Promise<void> {\n const bundledRelationship = this.getRootEventBundledRelationship();\n if (Thread.hasServerSideSupport && bundledRelationship) {\n this.replyCount = bundledRelationship.count;\n this._currentUserParticipated = !!bundledRelationship.current_user_participated;\n\n const mapper = this.client.getEventMapper();\n // re-insert roomId\n this.lastEvent = mapper({\n ...bundledRelationship.latest_event,\n room_id: this.roomId,\n });\n this.updatePendingReplyCount();\n await this.processEvent(this.lastEvent);\n }\n }\n\n private updatePendingReplyCount(): void {\n const unfilteredPendingEvents =\n this.pendingEventOrdering === PendingEventOrdering.Detached ? this.room.getPendingEvents() : this.events;\n const pendingEvents = unfilteredPendingEvents.filter(\n (ev) =>\n ev.threadRootId === this.id &&\n ev.isRelation(THREAD_RELATION_TYPE.name) &&\n ev.status !== null &&\n ev.getId() !== this.lastEvent?.getId(),\n );\n this.lastPendingEvent = pendingEvents.length ? pendingEvents[pendingEvents.length - 1] : undefined;\n this.pendingReplyCount = pendingEvents.length;\n }\n\n /**\n * Reset the live timeline of all timelineSets, and start new ones.\n *\n * <p>This is used when /sync returns a 'limited' timeline. 'Limited' means that there's a gap between the messages\n * /sync returned, and the last known message in our timeline. In such a case, our live timeline isn't live anymore\n * and has to be replaced by a new one. To make sure we can continue paginating our timelines correctly, we have to\n * set new pagination tokens on the old and the new 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, removing old ones (including the previous live\n * timeline which would otherwise be unable to paginate forwards without this token).\n * Removing just the old live timeline whilst preserving previous ones is not supported.\n */\n public async resetLiveTimeline(\n backPaginationToken?: string | null,\n forwardPaginationToken?: string | null,\n ): Promise<void> {\n const oldLive = this.liveTimeline;\n this.timelineSet.resetLiveTimeline(backPaginationToken ?? undefined, forwardPaginationToken ?? undefined);\n const newLive = this.liveTimeline;\n\n // FIXME: Remove the following as soon as https://github.com/matrix-org/synapse/issues/14830 is resolved.\n //\n // The pagination API for thread timelines currently can't handle the type of pagination tokens returned by sync\n //\n // To make this work anyway, we'll have to transform them into one of the types that the API can handle.\n // One option is passing the tokens to /messages, which can handle sync tokens, and returns the right format.\n // /messages does not return new tokens on requests with a limit of 0.\n // This means our timelines might overlap a slight bit, but that's not an issue, as we deduplicate messages\n // anyway.\n\n let newBackward: string | undefined;\n let oldForward: string | undefined;\n if (backPaginationToken) {\n const res = await this.client.createMessagesRequest(this.roomId, backPaginationToken, 1, Direction.Forward);\n newBackward = res.end;\n }\n if (forwardPaginationToken) {\n const res = await this.client.createMessagesRequest(\n this.roomId,\n forwardPaginationToken,\n 1,\n Direction.Backward,\n );\n oldForward = res.start;\n }\n // Only replace the token if we don't have paginated away from this position already. This situation doesn't\n // occur today, but if the above issue is resolved, we'd have to go down this path.\n if (forwardPaginationToken && oldLive.getPaginationToken(Direction.Forward) === forwardPaginationToken) {\n oldLive.setPaginationToken(oldForward ?? null, Direction.Forward);\n }\n if (backPaginationToken && newLive.getPaginationToken(Direction.Backward) === backPaginationToken) {\n newLive.setPaginationToken(newBackward ?? null, Direction.Backward);\n }\n }\n\n private async updateThreadFromRootEvent(): Promise<void> {\n if (Thread.hasServerSideSupport) {\n // Ensure we show *something* as soon as possible, we'll update it as soon as we get better data, but we\n // don't want the thread preview to be empty if we can avoid it\n if (!this.initialEventsFetched && !this.lastEvent) {\n await this.processRootEvent();\n }\n await this.fetchRootEvent();\n }\n await this.processRootEvent();\n }\n\n private async updateThreadMetadata(): Promise<void> {\n this.updatePendingReplyCount();\n\n if (!this.processRootEventPromise) {\n // We only want to do this once otherwise we end up rolling back to the last unsigned summary we have for the thread\n this.processRootEventPromise = this.updateThreadFromRootEvent();\n }\n await this.processRootEventPromise;\n\n if (!this.initialEventsFetched) {\n if (this.initalEventFetchProm) {\n await this.initalEventFetchProm;\n } else {\n // fetch initial events to allow proper pagination\n try {\n // clear out any events that were added before the pagination request\n // completed (eg. from sync). They'll be replaced by those from the pagination.\n // Really, we should do this after the pagination request completes, but\n // paginateEventTimeline does the request and adds the events in one go, so\n // this would need a refactor in order to do. It's therefore possible there's\n // a remaining race where an event comes in while the pagination request is\n // happening.\n this.timelineSet.resetLiveTimeline();\n // if the thread has regular events, this will just load the last reply.\n // if the thread is newly created, this will load the root event.\n if (this.replyCount === 0 && this.rootEvent) {\n this.timelineSet.addEventsToTimeline([this.rootEvent], true, this.liveTimeline, null);\n this.liveTimeline.setPaginationToken(null, Direction.Backward);\n } else {\n this.initalEventFetchProm = this.client.paginateEventTimeline(this.liveTimeline, {\n backwards: true,\n });\n await this.initalEventFetchProm;\n }\n // We have now fetched the initial events, so set the flag. We need to do this before\n // we actually add the events, so `this.addEvents` knows that it can now safely add\n // them rather than buffer them in the pending event list. The main thing is that this\n // must remain false while the async fetch happens, so we don't try to add events before\n // the pagination has finished. The important thing is that we're not await-ing anything\n // else between setting this and adding events, so no races.\n this.initialEventsFetched = true;\n for (const event of this.replayEvents!) {\n this.addEvent(event, false);\n }\n this.replayEvents = null;\n // just to make sure that, if we've created a timeline window for this thread before the thread itself\n // existed (e.g. when creating a new thread), we'll make sure the panel is force refreshed correctly.\n this.emit(RoomEvent.TimelineReset, this.room, this.timelineSet, true);\n } catch (e) {\n logger.error(\"Failed to load start of newly created thread: \", e);\n this.initialEventsFetched = false;\n }\n }\n }\n\n this.emit(ThreadEvent.Update, this);\n }\n\n // XXX: Workaround for https://github.com/matrix-org/matrix-spec-proposals/pull/2676/files#r827240084\n private async fetchEditsWhereNeeded(...events: MatrixEvent[]): Promise<unknown> {\n const recursionSupport = this.client.canSupport.get(Feature.RelationsRecursion) ?? ServerSupport.Unsupported;\n if (recursionSupport === ServerSupport.Unsupported) {\n return Promise.all(\n events.filter(isAnEncryptedThreadMessage).map(async (event: MatrixEvent) => {\n try {\n const relations = await this.client.relations(\n this.roomId,\n event.getId()!,\n RelationType.Replace,\n event.getType(),\n {\n limit: 1,\n },\n );\n if (relations.events.length) {\n const editEvent = relations.events[0];\n event.makeReplaced(editEvent);\n this.insertEventIntoTimeline(editEvent);\n }\n } catch (e) {\n logger.error(\"Failed to load edits for encrypted thread event\", e);\n }\n }),\n );\n }\n }\n\n public setEventMetadata(event: Optional<MatrixEvent>): void {\n if (event) {\n EventTimeline.setEventMetadata(event, this.roomState, false);\n event.setThread(this);\n }\n }\n\n public clearEventMetadata(event: Optional<MatrixEvent>): void {\n if (event) {\n event.setThread(undefined);\n delete event.event?.unsigned?.[\"m.relations\"]?.[THREAD_RELATION_TYPE.name];\n }\n }\n\n /**\n * Finds an event by ID in the current thread\n */\n public findEventById(eventId: string): MatrixEvent | undefined {\n return this.timelineSet.findEventById(eventId);\n }\n\n /**\n * Return last reply to the thread, if known.\n */\n public lastReply(\n matches: (ev: MatrixEvent) => boolean = (ev): boolean => ev.isRelation(THREAD_RELATION_TYPE.name),\n ): MatrixEvent | null {\n for (let i = this.timeline.length - 1; i >= 0; i--) {\n const event = this.timeline[i];\n if (matches(event)) {\n return event;\n }\n }\n return null;\n }\n\n public get roomId(): string {\n return this.room.roomId;\n }\n\n /**\n * The number of messages in the thread\n * Only count rel_type=m.thread as we want to\n * exclude annotations from that number\n */\n public get length(): number {\n return this.replyCount + this.pendingReplyCount;\n }\n\n /**\n * A getter for the last event of the thread.\n * This might be a synthesized event, if so, it will not emit any events to listeners.\n */\n public get replyToEvent(): Optional<MatrixEvent> {\n return this.lastPendingEvent ?? this.lastEvent ?? this.lastReply();\n }\n\n /**\n * The live event timeline for this thread.\n * @deprecated Present for backwards compatibility.\n * Use this.events instead\n * @returns The live event timeline for this thread.\n */\n public get timeline(): MatrixEvent[] {\n return this.events;\n }\n\n public get events(): MatrixEvent[] {\n return this.liveTimeline.getEvents();\n }\n\n public has(eventId: string): boolean {\n return this.timelineSet.findEventById(eventId) instanceof MatrixEvent;\n }\n\n public get hasCurrentUserParticipated(): boolean {\n return this._currentUserParticipated;\n }\n\n public get liveTimeline(): EventTimeline {\n return this.timelineSet.getLiveTimeline();\n }\n\n public getUnfilteredTimelineSet(): EventTimelineSet {\n return this.timelineSet;\n }\n\n public addReceipt(event: MatrixEvent, synthetic: boolean): void {\n throw new Error(\"Unsupported function on the thread model\");\n }\n\n /**\n * Get the ID of the event that a given user has read up to within this thread,\n * or null if we have received no read receipt (at all) from them.\n * @param userId - The user ID to get read receipt event ID for\n * @param ignoreSynthesized - If true, return only receipts that have been\n * sent by the server, not implicit ones generated\n * by the JS SDK.\n * @returns ID of the latest event that the given user has read, or null.\n */\n public getEventReadUpTo(userId: string, ignoreSynthesized?: boolean): string | null {\n // TODO: we think the implementation here is not right. Here is a sketch\n // of the right answer:\n //\n // for event in timeline.events.reversed():\n // if room.hasUserReadEvent(event):\n // return event\n // return null\n //\n // If this is too slow, we might be able to improve it by trying walking\n // forward from the threaded receipt in this thread. We could alternate\n // between backwards-from-front and forwards-from-threaded-receipt to\n // improve our chances of hitting the right answer sooner.\n //\n // Either way, it's still fundamentally slow because we have to walk\n // events.\n //\n // We also might just want to limit the time we spend on this by giving\n // up after, say, 100 events.\n //\n // --- andyb\n\n const isCurrentUser = userId === this.client.getUserId();\n const lastReply = this.timeline[this.timeline.length - 1];\n if (isCurrentUser && lastReply) {\n // If the last activity in a thread is prior to the first threaded read receipt\n // sent in the room (suggesting that it was sent before the user started\n // using a client that supported threaded read receipts), we want to\n // consider this thread as read.\n const beforeFirstThreadedReceipt = lastReply.getTs() < this.room.getOldestThreadedReceiptTs();\n const lastReplyId = lastReply.getId();\n // Some unsent events do not have an ID, we do not want to consider them read\n if (beforeFirstThreadedReceipt && lastReplyId) {\n return lastReplyId;\n }\n }\n\n const readUpToId = super.getEventReadUpTo(userId, ignoreSynthesized);\n\n // Check whether the unthreaded read receipt for that user is more recent\n // than the read receipt inside that thread.\n if (lastReply) {\n const unthreadedReceipt = this.room.getLastUnthreadedReceiptFor(userId);\n if (!unthreadedReceipt) {\n return readUpToId;\n }\n\n for (let i = this.timeline?.length - 1; i >= 0; --i) {\n const ev = this.timeline[i];\n // If we encounter the `readUpToId` we do not need to look further\n // there is no \"more recent\" unthreaded read receipt\n if (ev.getId() === readUpToId) return readUpToId;\n\n // Inspecting events from most recent to oldest, we're checking\n // whether an unthreaded read receipt is more recent that the current event.\n // We usually prefer relying on the order of the DAG but in this scenario\n // it is not possible and we have to rely on timestamp\n if (ev.getTs() < unthreadedReceipt.ts) return ev.getId() ?? readUpToId;\n }\n }\n\n return readUpToId;\n }\n\n /**\n * Determine if the given user has read a particular event.\n *\n * It is invalid to call this method with an event that is not part of this thread.\n *\n * This is not a definitive check as it only checks the events that have been\n * loaded client-side at the time of execution.\n * @param userId - The user ID to check the read state of.\n * @param eventId - The event ID to check if the user read.\n * @returns True if the user has read the event, false otherwise.\n */\n public hasUserReadEvent(userId: string, eventId: string): boolean {\n if (userId === this.client.getUserId()) {\n // Consider an event read if it's part of a thread that is before the\n // first threaded receipt sent in that room. It is likely that it is\n // part of a thread that was created before MSC3771 was implemented.\n // Or before the last unthreaded receipt for the logged in user\n const beforeFirstThreadedReceipt =\n (this.lastReply()?.getTs() ?? 0) < this.room.getOldestThreadedReceiptTs();\n const unthreadedReceiptTs = this.room.getLastUnthreadedReceiptFor(userId)?.ts ?? 0;\n const beforeLastUnthreadedReceipt = (this?.lastReply()?.getTs() ?? 0) < unthreadedReceiptTs;\n if (beforeFirstThreadedReceipt || beforeLastUnthreadedReceipt) {\n return true;\n }\n }\n\n return this.room.hasUserReadEvent(userId, eventId);\n }\n\n public setUnread(type: NotificationCountType, count: number): void {\n return this.room.setThreadUnreadNotificationCount(this.id, type, count);\n }\n\n /**\n * Returns the most recent unthreaded receipt for a given user\n * @param userId - the MxID of the User\n * @returns an unthreaded Receipt. Can be undefined if receipts have been disabled\n * or a user chooses to use private read receipts (or we have simply not received\n * a receipt from this user yet).\n */\n public getLastUnthreadedReceiptFor(userId: string): Receipt | undefined {\n return this.room.getLastUnthreadedReceiptFor(userId);\n }\n}\n\n/**\n * Decide whether an event deserves to have its potential edits fetched.\n *\n * @returns true if this event is encrypted and is a message that is part of a\n * thread - either inside it, or a root.\n */\nfunction isAnEncryptedThreadMessage(event: MatrixEvent): boolean {\n return event.isEncrypted() && (event.isRelation(THREAD_RELATION_TYPE.name) || event.isThreadRoot);\n}\n\nexport const FILTER_RELATED_BY_SENDERS = new ServerControlledNamespacedValue(\n \"related_by_senders\",\n \"io.element.relation_senders\",\n);\nexport const FILTER_RELATED_BY_REL_TYPES = new ServerControlledNamespacedValue(\n \"related_by_rel_types\",\n \"io.element.relation_types\",\n);\nexport const THREAD_RELATION_TYPE = new ServerControlledNamespacedValue(\"m.thread\", \"io.element.thread\");\n\nexport enum ThreadFilterType {\n \"My\",\n \"All\",\n}\n\nexport function threadFilterTypeToFilter(type: ThreadFilterType | null): \"all\" | \"participated\" {\n switch (type) {\n case ThreadFilterType.My:\n return \"participated\";\n default:\n return \"all\";\n }\n}\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAAuBA,oBAAoB,QAAQ,cAAc;AACjE,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAAqCC,WAAW,EAAEC,gBAAgB,QAAQ,YAAY;AACtF,SAASC,SAAS,EAAEC,aAAa,QAAQ,qBAAqB;AAC9D,S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C7D,OAAOA,KAAK,CAACsO,WAAW,CAAC,CAAC,KAAKtO,KAAK,CAACE,UAAU,CAACC,oBAAoB,CAACC,IAAI,CAAC,IAAIJ,KAAK,CAACuO,YAAY,CAAC;AACrG;AAEA,OAAO,IAAM3J,yBAAyB,GAAG,IAAIvG,+BAA+B,CACxE,oBAAoB,EACpB,6BACJ,CAAC;AACD,OAAO,IAAMyG,2BAA2B,GAAG,IAAIzG,+BAA+B,CAC1E,sBAAsB,EACtB,2BACJ,CAAC;AACD,OAAO,IAAM8B,oBAAoB,GAAG,IAAI9B,+BAA+B,CAAC,UAAU,EAAE,mBAAmB,CAAC;AAExG,WAAYmQ,gBAAgB,0BAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AAK5B,OAAO,SAASC,wBAAwBA,CAACL,IAA6B,EAA0B;EAC5F,QAAQA,IAAI;IACR,KAAKI,gBAAgB,CAACE,EAAE;MACpB,OAAO,cAAc;IACzB;MACI,OAAO,KAAK;EACpB;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"thread.js","names":["PendingEventOrdering","TypedReEmitter","RelationType","MatrixEvent","MatrixEventEvent","Direction","EventTimeline","EventTimelineSet","RoomEvent","ServerControlledNamespacedValue","logger","ReadReceipt","ReceiptType","Feature","ServerSupport","ThreadEvent","FeatureSupport","determineFeatureSupport","stable","unstable","Stable","Experimental","None","Thread","constructor","id","rootEvent","opts","_this","_opts$pendingEventOrd","this","_defineProperty","hasServerSideSupport","_asyncToGenerator","processRootEventPromise","undefined","event","redaction","isRelation","THREAD_RELATION_TYPE","name","room","eventShouldLiveIn","threadId","getId","status","replyCount","updatePendingReplyCount","emit","Update","_ref2","threadRootId","threadEvent","timeline","clearEventMetadata","lastEvent","_currentUserParticipated","Delete","_this$lastEvent","getAssociatedId","updateThreadMetadata","_x","_x2","_x3","apply","arguments","toStartOfTimeline","sender","getSender","shouldSendLocalEchoReceipt","addLocalEchoReceipt","Read","onEcho","_ref3","NewReply","_x4","_x5","setMaxListeners","Error","client","pendingEventOrdering","Chronological","timelineSet","timelineSupport","pendingEvents","reEmitter","reEmit","Timeline","TimelineReset","on","BeforeRedaction","onBeforeRedaction","Redaction","onRedaction","LocalEchoUpdated","onLocalEcho","onTimelineReset","onTimelineEvent","processReceipts","receipts","setEventMetadata","fetchRootEvent","_this2","eventData","fetchRoomEvent","roomId","mapper","getEventMapper","e","error","processEvent","setServerSideSupport","FILTER_RELATED_BY_SENDERS","setPreferUnstable","FILTER_RELATED_BY_REL_TYPES","setServerSideListSupport","hasServerSideListSupport","setServerSideFwdPaginationSupport","hasServerSideFwdPaginationSupport","_this$client$canSuppo","recursionSupport","canSupport","get","RelationsRecursion","Unsupported","_this$getReadReceiptF","oldReceiptEventId","getReadReceiptForUserId","eventId","receiptEvent","findEventById","getTs","roomState","getLiveTimeline","getState","FORWARDS","addEventToTimeline","liveTimeline","fromCache","insertEventIntoTimeline","addEvents","events","forEach","ev","addEvent","length","lastReply","isNewestReply","localTimestamp","Annotation","Replace","addRelatedThreadEvent","fetchEditsWhereNeeded","_this$timelineSet$rel","_this$timelineSet$rel2","initialEventsFetched","_this$replayEvents","replayEvents","push","_this$client$canSuppo2","relations","aggregateParentEvent","aggregateChildEvent","_this3","receiptType","userId","receipt","synthetic","addReceiptToStructure","getRootEventBundledRelationship","getServerAggregatedRelation","processRootEvent","_this4","bundledRelationship","count","current_user_participated","_objectSpread","latest_event","room_id","unfilteredPendingEvents","Detached","getPendingEvents","filter","_this$lastEvent2","lastPendingEvent","pendingReplyCount","resetLiveTimeline","backPaginationToken","forwardPaginationToken","_this5","oldLive","newLive","newBackward","oldForward","res","createMessagesRequest","Forward","end","Backward","start","getPaginationToken","_oldForward","setPaginationToken","_newBackward","updateThreadFromRootEvent","_this6","_this7","initalEventFetchProm","addEventsToTimeline","paginateEventTimeline","backwards","_arguments","_this8","_this8$client$canSupp","_len","Array","_key","Promise","all","isAnEncryptedThreadMessage","map","_ref4","getType","limit","editEvent","makeReplaced","_x6","setThread","_event$event","unsigned","matches","i","replyToEvent","_ref5","_this$lastPendingEven","getEvents","has","hasCurrentUserParticipated","getUnfilteredTimelineSet","addReceipt","getEventReadUpTo","ignoreSynthesized","isCurrentUser","getUserId","beforeFirstThreadedReceipt","getOldestThreadedReceiptTs","lastReplyId","readUpToId","unthreadedReceipt","getLastUnthreadedReceiptFor","_this$timeline","_ev$getId","ts","hasUserReadEvent","_this$lastReply$getTs","_this$lastReply","_this$room$getLastUnt","_this$room$getLastUnt2","_this$lastReply$getTs2","_this$lastReply2","unthreadedReceiptTs","beforeLastUnthreadedReceipt","setUnread","type","setThreadUnreadNotificationCount","isEncrypted","isThreadRoot","ThreadFilterType","threadFilterTypeToFilter","My"],"sources":["../../src/models/thread.ts"],"sourcesContent":["/*\nCopyright 2021 - 2023 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 { Optional } from \"matrix-events-sdk\";\n\nimport { MatrixClient, PendingEventOrdering } from \"../client.ts\";\nimport { TypedReEmitter } from \"../ReEmitter.ts\";\nimport { RelationType } from \"../@types/event.ts\";\nimport { IThreadBundledRelationship, MatrixEvent, MatrixEventEvent } from \"./event.ts\";\nimport { Direction, EventTimeline } from \"./event-timeline.ts\";\nimport { EventTimelineSet, EventTimelineSetHandlerMap } from \"./event-timeline-set.ts\";\nimport { NotificationCountType, Room, RoomEvent } from \"./room.ts\";\nimport { RoomState } from \"./room-state.ts\";\nimport { ServerControlledNamespacedValue } from \"../NamespacedValue.ts\";\nimport { logger } from \"../logger.ts\";\nimport { ReadReceipt } from \"./read-receipt.ts\";\nimport { CachedReceiptStructure, Receipt, ReceiptType } from \"../@types/read_receipts.ts\";\nimport { Feature, ServerSupport } from \"../feature.ts\";\n\nexport enum ThreadEvent {\n New = \"Thread.new\",\n Update = \"Thread.update\",\n NewReply = \"Thread.newReply\",\n ViewThread = \"Thread.viewThread\",\n Delete = \"Thread.delete\",\n}\n\nexport type ThreadEmittedEvents = Exclude<ThreadEvent, ThreadEvent.New> | RoomEvent.Timeline | RoomEvent.TimelineReset;\n\nexport type ThreadEventHandlerMap = {\n [ThreadEvent.Update]: (thread: Thread) => void;\n [ThreadEvent.NewReply]: (thread: Thread, event: MatrixEvent) => void;\n [ThreadEvent.ViewThread]: () => void;\n [ThreadEvent.Delete]: (thread: Thread) => void;\n} & EventTimelineSetHandlerMap;\n\ninterface IThreadOpts {\n room: Room;\n client: MatrixClient;\n pendingEventOrdering?: PendingEventOrdering;\n receipts?: CachedReceiptStructure[];\n}\n\nexport enum FeatureSupport {\n None = 0,\n Experimental = 1,\n Stable = 2,\n}\n\nexport function determineFeatureSupport(stable: boolean, unstable: boolean): FeatureSupport {\n if (stable) {\n return FeatureSupport.Stable;\n } else if (unstable) {\n return FeatureSupport.Experimental;\n } else {\n return FeatureSupport.None;\n }\n}\n\nexport class Thread extends ReadReceipt<ThreadEmittedEvents, ThreadEventHandlerMap> {\n public static hasServerSideSupport = FeatureSupport.None;\n public static hasServerSideListSupport = FeatureSupport.None;\n public static hasServerSideFwdPaginationSupport = FeatureSupport.None;\n\n /**\n * A reference to all the events ID at the bottom of the threads\n */\n public readonly timelineSet: EventTimelineSet;\n\n private _currentUserParticipated = false;\n\n private reEmitter: TypedReEmitter<ThreadEmittedEvents, ThreadEventHandlerMap>;\n\n /**\n * The last event in this thread, if we don't yet have this in the timeline.\n *\n * When we run {@link processRootEvent} (which I think happens during the\n * setting-up of the thread), we set this to the event pointed to by the\n * server in `latest_event` [1] that came through with the thread root.\n *\n * [1]: https://spec.matrix.org/v1.8/client-server-api/#server-side-aggregation-of-mthread-relationships\n *\n * Later, when we have populated the timeline, this is set to undefined, so\n * that methods like {@link replyToEvent} fall through to use lastReply,\n * which looks in the timeline for the latest event that is a \"thread reply\"\n * i.e. directly refers to the thread root with an m.thread relation.\n *\n * So it looks like this is only really relevant when initialEventsFetched\n * is false, because as soon as the initial events have been fetched, we\n * should have a proper chunk of timeline from the pagination fetch.\n *\n * If all replies in this thread are redacted, this is set to the root\n * event. I'm not clear what the meaning of this is, since usually after the\n * initial events have been fetched, lastEvent should be undefined.\n * In fact, the whole usage inside onRedaction looks suspect - it may be\n * that we were thinking lastEvent always refers to the actual last event,\n * but it only does so before initialEventsFetched becomes true.\n *\n * The usage of lastEvent inside {@link onEcho} looks suspicious, since I'd\n * think we probably mean {@link replyToEvent} there - we are trying not to\n * echo a duplicate event, and we probably want that behaviour even after\n * initialEventsFetched has become true.\n *\n * -- andyb\n */\n private lastEvent: MatrixEvent | undefined;\n\n private replyCount = 0;\n private lastPendingEvent: MatrixEvent | undefined;\n private pendingReplyCount = 0;\n\n public readonly room: Room;\n public readonly client: MatrixClient;\n private readonly pendingEventOrdering: PendingEventOrdering;\n private processRootEventPromise?: Promise<void>;\n\n /**\n * Whether or not we need to fetch the initial set of events for the thread. We can\n * only do this if the server has support for it, so if it doesn't we just pretend\n * that we've already fetched them.\n */\n public initialEventsFetched = !Thread.hasServerSideSupport;\n private initalEventFetchProm: Promise<boolean> | undefined;\n\n /**\n * An array of events to add to the timeline once the thread has been initialised\n * with server suppport.\n */\n public replayEvents: MatrixEvent[] | null = [];\n\n public constructor(\n public readonly id: string,\n public rootEvent: MatrixEvent | undefined,\n opts: IThreadOpts,\n ) {\n super();\n\n // each Event in the thread adds a reemitter, so we could hit the listener limit.\n this.setMaxListeners(1000);\n\n if (!opts?.room) {\n // Logging/debugging for https://github.com/vector-im/element-web/issues/22141\n // Hope is that we end up with a more obvious stack trace.\n throw new Error(\"element-web#22141: A thread requires a room in order to function\");\n }\n\n this.room = opts.room;\n this.client = opts.client;\n this.pendingEventOrdering = opts.pendingEventOrdering ?? PendingEventOrdering.Chronological;\n this.timelineSet = new EventTimelineSet(\n this.room,\n {\n timelineSupport: true,\n pendingEvents: true,\n },\n this.client,\n this,\n );\n this.reEmitter = new TypedReEmitter(this);\n\n this.reEmitter.reEmit(this.timelineSet, [RoomEvent.Timeline, RoomEvent.TimelineReset]);\n\n this.room.on(MatrixEventEvent.BeforeRedaction, this.onBeforeRedaction);\n this.room.on(RoomEvent.Redaction, this.onRedaction);\n this.room.on(RoomEvent.LocalEchoUpdated, this.onLocalEcho);\n this.room.on(RoomEvent.TimelineReset, this.onTimelineReset);\n this.timelineSet.on(RoomEvent.Timeline, this.onTimelineEvent);\n\n this.processReceipts(opts.receipts);\n\n // even if this thread is thought to be originating from this client, we initialise it as we may be in a\n // gappy sync and a thread around this event may already exist.\n this.updateThreadMetadata();\n this.setEventMetadata(this.rootEvent);\n }\n\n private onTimelineReset = async (): Promise<void> => {\n // We hit a gappy sync, ask the server for an update\n await this.processRootEventPromise;\n this.processRootEventPromise = undefined;\n };\n\n private async fetchRootEvent(): Promise<void> {\n // Always fetch the root event, even if we already have it, so we can get the latest\n // state (via unsigned).\n try {\n const eventData = await this.client.fetchRoomEvent(this.roomId, this.id);\n const mapper = this.client.getEventMapper();\n this.rootEvent = mapper(eventData); // will merge with existing event object if such is known\n } catch (e) {\n logger.error(\"Failed to fetch thread root to construct thread with\", e);\n }\n await this.processEvent(this.rootEvent);\n }\n\n public static setServerSideSupport(status: FeatureSupport): void {\n Thread.hasServerSideSupport = status;\n if (status !== FeatureSupport.Stable) {\n FILTER_RELATED_BY_SENDERS.setPreferUnstable(true);\n FILTER_RELATED_BY_REL_TYPES.setPreferUnstable(true);\n THREAD_RELATION_TYPE.setPreferUnstable(true);\n }\n }\n\n public static setServerSideListSupport(status: FeatureSupport): void {\n Thread.hasServerSideListSupport = status;\n }\n\n public static setServerSideFwdPaginationSupport(status: FeatureSupport): void {\n Thread.hasServerSideFwdPaginationSupport = status;\n }\n\n private onBeforeRedaction = (event: MatrixEvent, redaction: MatrixEvent): void => {\n if (\n event?.isRelation(THREAD_RELATION_TYPE.name) &&\n this.room.eventShouldLiveIn(event).threadId === this.id &&\n event.getId() !== this.id && // the root event isn't counted in the length so ignore this redaction\n !redaction.status // only respect it when it succeeds\n ) {\n this.replyCount--;\n this.updatePendingReplyCount();\n this.emit(ThreadEvent.Update, this);\n }\n };\n\n private onRedaction = async (event: MatrixEvent, room: Room, threadRootId?: string): Promise<void> => {\n if (threadRootId !== this.id) return; // ignore redactions for other timelines\n if (this.replyCount <= 0) {\n for (const threadEvent of this.timeline) {\n this.clearEventMetadata(threadEvent);\n }\n this.lastEvent = this.rootEvent;\n this._currentUserParticipated = false;\n this.emit(ThreadEvent.Delete, this);\n } else {\n if (this.lastEvent?.getId() === event.getAssociatedId()) {\n // XXX: If our last event got redacted we query the server for the last event once again\n await this.processRootEventPromise;\n this.processRootEventPromise = undefined;\n }\n await this.updateThreadMetadata();\n }\n };\n\n private onTimelineEvent = (\n event: MatrixEvent,\n room: Room | undefined,\n toStartOfTimeline: boolean | undefined,\n ): void => {\n // Add a synthesized receipt when paginating forward in the timeline\n if (!toStartOfTimeline) {\n const sender = event.getSender();\n if (sender && room && this.shouldSendLocalEchoReceipt(sender, event)) {\n room.addLocalEchoReceipt(sender, event, ReceiptType.Read);\n }\n if (event.getId() !== this.id && event.isRelation(THREAD_RELATION_TYPE.name)) {\n this.replyCount++;\n }\n }\n this.onEcho(event, toStartOfTimeline ?? false);\n };\n\n private shouldSendLocalEchoReceipt(sender: string, event: MatrixEvent): boolean {\n const recursionSupport = this.client.canSupport.get(Feature.RelationsRecursion) ?? ServerSupport.Unsupported;\n\n if (recursionSupport === ServerSupport.Unsupported) {\n // Normally we add a local receipt, but if we don't have\n // recursion support, then events may arrive out of order, so we\n // only create a receipt if it's after our existing receipt.\n const oldReceiptEventId = this.getReadReceiptForUserId(sender)?.eventId;\n if (oldReceiptEventId) {\n const receiptEvent = this.findEventById(oldReceiptEventId);\n if (receiptEvent && receiptEvent.getTs() > event.getTs()) {\n return false;\n }\n }\n }\n\n return true;\n }\n\n private onLocalEcho = (event: MatrixEvent): void => {\n this.onEcho(event, false);\n };\n\n private onEcho = async (event: MatrixEvent, toStartOfTimeline: boolean): Promise<void> => {\n if (event.threadRootId !== this.id) return; // ignore echoes for other timelines\n if (this.lastEvent === event) return; // ignore duplicate events\n await this.updateThreadMetadata();\n if (!event.isRelation(THREAD_RELATION_TYPE.name)) return; // don't send a new reply event for reactions or edits\n if (toStartOfTimeline) return; // ignore messages added to the start of the timeline\n // Clear the lastEvent and instead start tracking locally using lastReply\n this.lastEvent = undefined;\n this.emit(ThreadEvent.NewReply, this, event);\n };\n\n public get roomState(): RoomState {\n return this.room.getLiveTimeline().getState(EventTimeline.FORWARDS)!;\n }\n\n private addEventToTimeline(event: MatrixEvent, toStartOfTimeline: boolean): void {\n if (!this.findEventById(event.getId()!)) {\n this.timelineSet.addEventToTimeline(event, this.liveTimeline, {\n toStartOfTimeline,\n fromCache: false,\n roomState: this.roomState,\n });\n }\n }\n\n /**\n * TEMPORARY. Only call this when MSC3981 is not available, and we have some\n * late-arriving events to insert, because we recursively found them as part\n * of populating a thread. When we have MSC3981 we won't need it, because\n * they will all be supplied by the homeserver in one request, and they will\n * already be in the right order in that response.\n * This is a copy of addEventToTimeline above, modified to call\n * insertEventIntoTimeline so this event is inserted into our best guess of\n * the right place based on timestamp. (We should be using Sync Order but we\n * don't have it.)\n *\n * @internal\n */\n public insertEventIntoTimeline(event: MatrixEvent): void {\n const eventId = event.getId();\n if (!eventId) {\n return;\n }\n // If the event is already in this thread, bail out\n if (this.findEventById(eventId)) {\n return;\n }\n this.timelineSet.insertEventIntoTimeline(event, this.liveTimeline, this.roomState);\n }\n\n public addEvents(events: MatrixEvent[], toStartOfTimeline: boolean): void {\n events.forEach((ev) => this.addEvent(ev, toStartOfTimeline, false));\n this.updateThreadMetadata();\n }\n\n /**\n * Add an event to the thread and updates\n * the tail/root references if needed\n * Will fire \"Thread.update\"\n * @param event - The event to add\n * @param toStartOfTimeline - whether the event is being added\n * to the start (and not the end) of the timeline.\n * @param emit - whether to emit the Update event if the thread was updated or not.\n */\n public addEvent(event: MatrixEvent, toStartOfTimeline: boolean, emit = true): void {\n // Modify this event to point at our room's state, and mark its thread\n // as this.\n this.setEventMetadata(event);\n\n // Decide whether this event is going to be added at the end of the timeline.\n const lastReply = this.lastReply();\n const isNewestReply = !lastReply || event.localTimestamp >= lastReply!.localTimestamp;\n\n if (!Thread.hasServerSideSupport) {\n // When there's no server-side support, just add it to the end of the timeline.\n this.addEventToTimeline(event, toStartOfTimeline);\n } else if (event.isRelation(RelationType.Annotation) || event.isRelation(RelationType.Replace)) {\n this.addRelatedThreadEvent(event, toStartOfTimeline);\n return;\n } else if (!toStartOfTimeline && isNewestReply) {\n // When we've asked for the event to be added to the end,\n // and this event belongs at the end, add it.\n this.addEventToTimeline(event, false);\n this.fetchEditsWhereNeeded(event);\n } else {\n // Otherwise, we should add it, but we suspect it is out of order.\n // This may be because we've just created the thread object and are\n // still fetching events, in which case add it where we think is sensible\n // and it will be removed and replaced with the events from the pagination\n // request once that completes.\n if (toStartOfTimeline) {\n // If we're adding at the start of the timeline, it doesn't\n // matter that it's out of order.\n this.addEventToTimeline(event, toStartOfTimeline);\n } else {\n // We think this event might be out of order, because isNewestReply\n // is false (otherwise we would have gone into the earlier if\n // clause), so try to insert it in the right place based on\n // timestamp.\n this.insertEventIntoTimeline(event);\n }\n }\n\n if (\n event.getId() !== this.id &&\n event.isRelation(THREAD_RELATION_TYPE.name) &&\n !toStartOfTimeline &&\n isNewestReply\n ) {\n // Clear the last event as we have the latest end of the timeline\n this.lastEvent = undefined;\n }\n\n if (emit) {\n this.emit(ThreadEvent.NewReply, this, event);\n this.updateThreadMetadata();\n }\n }\n\n private addRelatedThreadEvent(event: MatrixEvent, toStartOfTimeline: boolean): void {\n // If this event is not a direct member of the thread, but is a\n // reference to something that is, then we have two cases:\n\n if (!this.initialEventsFetched) {\n // Case 1: we haven't yet fetched events from the server. In\n // this case, when we do, the events we get back might only be\n // the first-order ones, so this event (which is second-order -\n // a reference to something directly in the thread) needs to be\n // kept so we can replay it when the first-order ones turn up.\n\n /**\n * A thread can be fully discovered via a single sync response\n * And when that's the case we still ask the server to do an initialisation\n * as it's the safest to ensure we have everything.\n * However when we are in that scenario we might loose annotation or edits\n *\n * This fix keeps a reference to those events and replay them once the thread\n * has been initialised properly.\n */\n this.replayEvents?.push(event);\n } else {\n // Case 2: this is happening later, and we have a timeline. In\n // this case, these events might be out-of order.\n //\n // Specifically, if the server doesn't support recursion, so we\n // only get these events through sync, they might be coming\n // later than the first-order ones, so we insert them based on\n // timestamp (despite the problems with this documented in\n // #3325).\n //\n // If the server does support recursion, we should have got all\n // the interspersed events from the server when we fetched the\n // initial events, so if they are coming via sync they should be\n // the latest ones, so we can add them as normal.\n //\n // (Note that both insertEventIntoTimeline and addEventToTimeline\n // do nothing if we have seen this event before.)\n\n const recursionSupport =\n this.client.canSupport.get(Feature.RelationsRecursion) ?? ServerSupport.Unsupported;\n\n if (recursionSupport === ServerSupport.Unsupported) {\n this.insertEventIntoTimeline(event);\n } else {\n this.addEventToTimeline(event, toStartOfTimeline);\n }\n }\n // Apply annotations and replace relations to the relations of the timeline only\n this.timelineSet.relations?.aggregateParentEvent(event);\n this.timelineSet.relations?.aggregateChildEvent(event, this.timelineSet);\n }\n\n public async processEvent(event: Optional<MatrixEvent>): Promise<void> {\n if (event) {\n this.setEventMetadata(event);\n await this.fetchEditsWhereNeeded(event);\n }\n }\n\n /**\n * Processes the receipts that were caught during initial sync\n * When clients become aware of a thread, they try to retrieve those read receipts\n * and apply them to the current thread\n * @param receipts - A collection of the receipts cached from initial sync\n */\n private processReceipts(receipts: CachedReceiptStructure[] = []): void {\n for (const { eventId, receiptType, userId, receipt, synthetic } of receipts) {\n this.addReceiptToStructure(eventId, receiptType as ReceiptType, userId, receipt, synthetic);\n }\n }\n\n private getRootEventBundledRelationship(rootEvent = this.rootEvent): IThreadBundledRelationship | undefined {\n return rootEvent?.getServerAggregatedRelation<IThreadBundledRelationship>(THREAD_RELATION_TYPE.name);\n }\n\n private async processRootEvent(): Promise<void> {\n const bundledRelationship = this.getRootEventBundledRelationship();\n if (Thread.hasServerSideSupport && bundledRelationship) {\n this.replyCount = bundledRelationship.count;\n this._currentUserParticipated = !!bundledRelationship.current_user_participated;\n\n const mapper = this.client.getEventMapper();\n // re-insert roomId\n this.lastEvent = mapper({\n ...bundledRelationship.latest_event,\n room_id: this.roomId,\n });\n this.updatePendingReplyCount();\n await this.processEvent(this.lastEvent);\n }\n }\n\n private updatePendingReplyCount(): void {\n const unfilteredPendingEvents =\n this.pendingEventOrdering === PendingEventOrdering.Detached ? this.room.getPendingEvents() : this.events;\n const pendingEvents = unfilteredPendingEvents.filter(\n (ev) =>\n ev.threadRootId === this.id &&\n ev.isRelation(THREAD_RELATION_TYPE.name) &&\n ev.status !== null &&\n ev.getId() !== this.lastEvent?.getId(),\n );\n this.lastPendingEvent = pendingEvents.length ? pendingEvents[pendingEvents.length - 1] : undefined;\n this.pendingReplyCount = pendingEvents.length;\n }\n\n /**\n * Reset the live timeline of all timelineSets, and start new ones.\n *\n * <p>This is used when /sync returns a 'limited' timeline. 'Limited' means that there's a gap between the messages\n * /sync returned, and the last known message in our timeline. In such a case, our live timeline isn't live anymore\n * and has to be replaced by a new one. To make sure we can continue paginating our timelines correctly, we have to\n * set new pagination tokens on the old and the new 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, removing old ones (including the previous live\n * timeline which would otherwise be unable to paginate forwards without this token).\n * Removing just the old live timeline whilst preserving previous ones is not supported.\n */\n public async resetLiveTimeline(\n backPaginationToken?: string | null,\n forwardPaginationToken?: string | null,\n ): Promise<void> {\n const oldLive = this.liveTimeline;\n this.timelineSet.resetLiveTimeline(backPaginationToken ?? undefined, forwardPaginationToken ?? undefined);\n const newLive = this.liveTimeline;\n\n // FIXME: Remove the following as soon as https://github.com/matrix-org/synapse/issues/14830 is resolved.\n //\n // The pagination API for thread timelines currently can't handle the type of pagination tokens returned by sync\n //\n // To make this work anyway, we'll have to transform them into one of the types that the API can handle.\n // One option is passing the tokens to /messages, which can handle sync tokens, and returns the right format.\n // /messages does not return new tokens on requests with a limit of 0.\n // This means our timelines might overlap a slight bit, but that's not an issue, as we deduplicate messages\n // anyway.\n\n let newBackward: string | undefined;\n let oldForward: string | undefined;\n if (backPaginationToken) {\n const res = await this.client.createMessagesRequest(this.roomId, backPaginationToken, 1, Direction.Forward);\n newBackward = res.end;\n }\n if (forwardPaginationToken) {\n const res = await this.client.createMessagesRequest(\n this.roomId,\n forwardPaginationToken,\n 1,\n Direction.Backward,\n );\n oldForward = res.start;\n }\n // Only replace the token if we don't have paginated away from this position already. This situation doesn't\n // occur today, but if the above issue is resolved, we'd have to go down this path.\n if (forwardPaginationToken && oldLive.getPaginationToken(Direction.Forward) === forwardPaginationToken) {\n oldLive.setPaginationToken(oldForward ?? null, Direction.Forward);\n }\n if (backPaginationToken && newLive.getPaginationToken(Direction.Backward) === backPaginationToken) {\n newLive.setPaginationToken(newBackward ?? null, Direction.Backward);\n }\n }\n\n private async updateThreadFromRootEvent(): Promise<void> {\n if (Thread.hasServerSideSupport) {\n // Ensure we show *something* as soon as possible, we'll update it as soon as we get better data, but we\n // don't want the thread preview to be empty if we can avoid it\n if (!this.initialEventsFetched && !this.lastEvent) {\n await this.processRootEvent();\n }\n await this.fetchRootEvent();\n }\n await this.processRootEvent();\n }\n\n private async updateThreadMetadata(): Promise<void> {\n this.updatePendingReplyCount();\n\n if (!this.processRootEventPromise) {\n // We only want to do this once otherwise we end up rolling back to the last unsigned summary we have for the thread\n this.processRootEventPromise = this.updateThreadFromRootEvent();\n }\n await this.processRootEventPromise;\n\n if (!this.initialEventsFetched) {\n if (this.initalEventFetchProm) {\n await this.initalEventFetchProm;\n } else {\n // fetch initial events to allow proper pagination\n try {\n // clear out any events that were added before the pagination request\n // completed (eg. from sync). They'll be replaced by those from the pagination.\n // Really, we should do this after the pagination request completes, but\n // paginateEventTimeline does the request and adds the events in one go, so\n // this would need a refactor in order to do. It's therefore possible there's\n // a remaining race where an event comes in while the pagination request is\n // happening.\n this.timelineSet.resetLiveTimeline();\n // if the thread has regular events, this will just load the last reply.\n // if the thread is newly created, this will load the root event.\n if (this.replyCount === 0 && this.rootEvent) {\n this.timelineSet.addEventsToTimeline([this.rootEvent], true, this.liveTimeline, null);\n this.liveTimeline.setPaginationToken(null, Direction.Backward);\n } else {\n this.initalEventFetchProm = this.client.paginateEventTimeline(this.liveTimeline, {\n backwards: true,\n });\n await this.initalEventFetchProm;\n }\n // We have now fetched the initial events, so set the flag. We need to do this before\n // we actually add the events, so `this.addEvents` knows that it can now safely add\n // them rather than buffer them in the pending event list. The main thing is that this\n // must remain false while the async fetch happens, so we don't try to add events before\n // the pagination has finished. The important thing is that we're not await-ing anything\n // else between setting this and adding events, so no races.\n this.initialEventsFetched = true;\n for (const event of this.replayEvents!) {\n this.addEvent(event, false);\n }\n this.replayEvents = null;\n // just to make sure that, if we've created a timeline window for this thread before the thread itself\n // existed (e.g. when creating a new thread), we'll make sure the panel is force refreshed correctly.\n this.emit(RoomEvent.TimelineReset, this.room, this.timelineSet, true);\n } catch (e) {\n logger.error(\"Failed to load start of newly created thread: \", e);\n this.initialEventsFetched = false;\n }\n }\n }\n\n this.emit(ThreadEvent.Update, this);\n }\n\n // XXX: Workaround for https://github.com/matrix-org/matrix-spec-proposals/pull/2676/files#r827240084\n private async fetchEditsWhereNeeded(...events: MatrixEvent[]): Promise<unknown> {\n const recursionSupport = this.client.canSupport.get(Feature.RelationsRecursion) ?? ServerSupport.Unsupported;\n if (recursionSupport === ServerSupport.Unsupported) {\n return Promise.all(\n events.filter(isAnEncryptedThreadMessage).map(async (event: MatrixEvent) => {\n try {\n const relations = await this.client.relations(\n this.roomId,\n event.getId()!,\n RelationType.Replace,\n event.getType(),\n {\n limit: 1,\n },\n );\n if (relations.events.length) {\n const editEvent = relations.events[0];\n event.makeReplaced(editEvent);\n this.insertEventIntoTimeline(editEvent);\n }\n } catch (e) {\n logger.error(\"Failed to load edits for encrypted thread event\", e);\n }\n }),\n );\n }\n }\n\n public setEventMetadata(event: Optional<MatrixEvent>): void {\n if (event) {\n EventTimeline.setEventMetadata(event, this.roomState, false);\n event.setThread(this);\n }\n }\n\n public clearEventMetadata(event: Optional<MatrixEvent>): void {\n if (event) {\n event.setThread(undefined);\n delete event.event?.unsigned?.[\"m.relations\"]?.[THREAD_RELATION_TYPE.name];\n }\n }\n\n /**\n * Finds an event by ID in the current thread\n */\n public findEventById(eventId: string): MatrixEvent | undefined {\n return this.timelineSet.findEventById(eventId);\n }\n\n /**\n * Return last reply to the thread, if known.\n */\n public lastReply(\n matches: (ev: MatrixEvent) => boolean = (ev): boolean => ev.isRelation(THREAD_RELATION_TYPE.name),\n ): MatrixEvent | null {\n for (let i = this.timeline.length - 1; i >= 0; i--) {\n const event = this.timeline[i];\n if (matches(event)) {\n return event;\n }\n }\n return null;\n }\n\n public get roomId(): string {\n return this.room.roomId;\n }\n\n /**\n * The number of messages in the thread\n * Only count rel_type=m.thread as we want to\n * exclude annotations from that number\n */\n public get length(): number {\n return this.replyCount + this.pendingReplyCount;\n }\n\n /**\n * A getter for the last event of the thread.\n * This might be a synthesized event, if so, it will not emit any events to listeners.\n */\n public get replyToEvent(): Optional<MatrixEvent> {\n return this.lastPendingEvent ?? this.lastEvent ?? this.lastReply();\n }\n\n /**\n * The live event timeline for this thread.\n * @deprecated Present for backwards compatibility.\n * Use this.events instead\n * @returns The live event timeline for this thread.\n */\n public get timeline(): MatrixEvent[] {\n return this.events;\n }\n\n public get events(): MatrixEvent[] {\n return this.liveTimeline.getEvents();\n }\n\n public has(eventId: string): boolean {\n return this.timelineSet.findEventById(eventId) instanceof MatrixEvent;\n }\n\n public get hasCurrentUserParticipated(): boolean {\n return this._currentUserParticipated;\n }\n\n public get liveTimeline(): EventTimeline {\n return this.timelineSet.getLiveTimeline();\n }\n\n public getUnfilteredTimelineSet(): EventTimelineSet {\n return this.timelineSet;\n }\n\n public addReceipt(event: MatrixEvent, synthetic: boolean): void {\n throw new Error(\"Unsupported function on the thread model\");\n }\n\n /**\n * Get the ID of the event that a given user has read up to within this thread,\n * or null if we have received no read receipt (at all) from them.\n * @param userId - The user ID to get read receipt event ID for\n * @param ignoreSynthesized - If true, return only receipts that have been\n * sent by the server, not implicit ones generated\n * by the JS SDK.\n * @returns ID of the latest event that the given user has read, or null.\n */\n public getEventReadUpTo(userId: string, ignoreSynthesized?: boolean): string | null {\n // TODO: we think the implementation here is not right. Here is a sketch\n // of the right answer:\n //\n // for event in timeline.events.reversed():\n // if room.hasUserReadEvent(event):\n // return event\n // return null\n //\n // If this is too slow, we might be able to improve it by trying walking\n // forward from the threaded receipt in this thread. We could alternate\n // between backwards-from-front and forwards-from-threaded-receipt to\n // improve our chances of hitting the right answer sooner.\n //\n // Either way, it's still fundamentally slow because we have to walk\n // events.\n //\n // We also might just want to limit the time we spend on this by giving\n // up after, say, 100 events.\n //\n // --- andyb\n\n const isCurrentUser = userId === this.client.getUserId();\n const lastReply = this.timeline[this.timeline.length - 1];\n if (isCurrentUser && lastReply) {\n // If the last activity in a thread is prior to the first threaded read receipt\n // sent in the room (suggesting that it was sent before the user started\n // using a client that supported threaded read receipts), we want to\n // consider this thread as read.\n const beforeFirstThreadedReceipt = lastReply.getTs() < this.room.getOldestThreadedReceiptTs();\n const lastReplyId = lastReply.getId();\n // Some unsent events do not have an ID, we do not want to consider them read\n if (beforeFirstThreadedReceipt && lastReplyId) {\n return lastReplyId;\n }\n }\n\n const readUpToId = super.getEventReadUpTo(userId, ignoreSynthesized);\n\n // Check whether the unthreaded read receipt for that user is more recent\n // than the read receipt inside that thread.\n if (lastReply) {\n const unthreadedReceipt = this.room.getLastUnthreadedReceiptFor(userId);\n if (!unthreadedReceipt) {\n return readUpToId;\n }\n\n for (let i = this.timeline?.length - 1; i >= 0; --i) {\n const ev = this.timeline[i];\n // If we encounter the `readUpToId` we do not need to look further\n // there is no \"more recent\" unthreaded read receipt\n if (ev.getId() === readUpToId) return readUpToId;\n\n // Inspecting events from most recent to oldest, we're checking\n // whether an unthreaded read receipt is more recent that the current event.\n // We usually prefer relying on the order of the DAG but in this scenario\n // it is not possible and we have to rely on timestamp\n if (ev.getTs() < unthreadedReceipt.ts) return ev.getId() ?? readUpToId;\n }\n }\n\n return readUpToId;\n }\n\n /**\n * Determine if the given user has read a particular event.\n *\n * It is invalid to call this method with an event that is not part of this thread.\n *\n * This is not a definitive check as it only checks the events that have been\n * loaded client-side at the time of execution.\n * @param userId - The user ID to check the read state of.\n * @param eventId - The event ID to check if the user read.\n * @returns True if the user has read the event, false otherwise.\n */\n public hasUserReadEvent(userId: string, eventId: string): boolean {\n if (userId === this.client.getUserId()) {\n // Consider an event read if it's part of a thread that is before the\n // first threaded receipt sent in that room. It is likely that it is\n // part of a thread that was created before MSC3771 was implemented.\n // Or before the last unthreaded receipt for the logged in user\n const beforeFirstThreadedReceipt =\n (this.lastReply()?.getTs() ?? 0) < this.room.getOldestThreadedReceiptTs();\n const unthreadedReceiptTs = this.room.getLastUnthreadedReceiptFor(userId)?.ts ?? 0;\n const beforeLastUnthreadedReceipt = (this?.lastReply()?.getTs() ?? 0) < unthreadedReceiptTs;\n if (beforeFirstThreadedReceipt || beforeLastUnthreadedReceipt) {\n return true;\n }\n }\n\n return this.room.hasUserReadEvent(userId, eventId);\n }\n\n public setUnread(type: NotificationCountType, count: number): void {\n return this.room.setThreadUnreadNotificationCount(this.id, type, count);\n }\n\n /**\n * Returns the most recent unthreaded receipt for a given user\n * @param userId - the MxID of the User\n * @returns an unthreaded Receipt. Can be undefined if receipts have been disabled\n * or a user chooses to use private read receipts (or we have simply not received\n * a receipt from this user yet).\n */\n public getLastUnthreadedReceiptFor(userId: string): Receipt | undefined {\n return this.room.getLastUnthreadedReceiptFor(userId);\n }\n}\n\n/**\n * Decide whether an event deserves to have its potential edits fetched.\n *\n * @returns true if this event is encrypted and is a message that is part of a\n * thread - either inside it, or a root.\n */\nfunction isAnEncryptedThreadMessage(event: MatrixEvent): boolean {\n return event.isEncrypted() && (event.isRelation(THREAD_RELATION_TYPE.name) || event.isThreadRoot);\n}\n\nexport const FILTER_RELATED_BY_SENDERS = new ServerControlledNamespacedValue(\n \"related_by_senders\",\n \"io.element.relation_senders\",\n);\nexport const FILTER_RELATED_BY_REL_TYPES = new ServerControlledNamespacedValue(\n \"related_by_rel_types\",\n \"io.element.relation_types\",\n);\nexport const THREAD_RELATION_TYPE = new ServerControlledNamespacedValue(\"m.thread\", \"io.element.thread\");\n\nexport enum ThreadFilterType {\n \"My\",\n \"All\",\n}\n\nexport function threadFilterTypeToFilter(type: ThreadFilterType | null): \"all\" | \"participated\" {\n switch (type) {\n case ThreadFilterType.My:\n return \"participated\";\n default:\n return \"all\";\n }\n}\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAAuBA,oBAAoB,QAAQ,cAAc;AACjE,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAAqCC,WAAW,EAAEC,gBAAgB,QAAQ,YAAY;AACtF,SAASC,SAAS,EAAEC,aAAa,QAAQ,qBAAqB;AAC9D,SAASC,gBAAgB,QAAoC,yBAAyB;AACtF,SAAsCC,SAAS,QAAQ,WAAW;AAElE,SAASC,+BAA+B,QAAQ,uBAAuB;AACvE,SAASC,MAAM,QAAQ,cAAc;AACrC,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAA0CC,WAAW,QAAQ,4BAA4B;AACzF,SAASC,OAAO,EAAEC,aAAa,QAAQ,eAAe;AAEtD,WAAYC,WAAW,0BAAXA,WAAW;EAAXA,WAAW;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AAG,IAAI9B,+BAA+B,CAAC,UAAU,EAAE,mBAAmB,CAAC;AAExG,WAAYkQ,gBAAgB,0BAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AAK5B,OAAO,SAASC,wBAAwBA,CAACL,IAA6B,EAA0B;EAC5F,QAAQA,IAAI;IACR,KAAKI,gBAAgB,CAACE,EAAE;MACpB,OAAO,cAAc;IACzB;MACI,OAAO,KAAK;EACpB;AACJ","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import { Room } from "./models/room.ts";
2
2
  import { IStoredClientOpts, MatrixClient } from "./client.ts";
3
- import { ISyncStateData, SyncState, SyncApiOptions, SetPresence } from "./sync.ts";
3
+ import { ISyncStateData, SyncState, SetPresence } from "./sync.ts";
4
4
  import { MatrixEvent } from "./models/event.ts";
5
5
  import { SlidingSync } from "./sliding-sync.ts";
6
6
  /**
@@ -11,13 +11,12 @@ export declare class SlidingSyncSdk {
11
11
  private readonly slidingSync;
12
12
  private readonly client;
13
13
  private readonly opts;
14
- private readonly syncOpts;
15
14
  private syncState;
16
15
  private syncStateData?;
17
16
  private lastPos;
18
17
  private failCount;
19
18
  private notifEvents;
20
- constructor(slidingSync: SlidingSync, client: MatrixClient, opts?: IStoredClientOpts, syncOpts?: SyncApiOptions);
19
+ constructor(slidingSync: SlidingSync, client: MatrixClient, opts?: IStoredClientOpts);
21
20
  private onRoomData;
22
21
  private onLifecycle;
23
22
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"sliding-sync-sdk.d.ts","sourceRoot":"","sources":["../src/sliding-sync-sdk.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAyB,IAAI,EAAa,MAAM,kBAAkB,CAAC;AAI1E,OAAO,EAAe,iBAAiB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EACH,cAAc,EACd,SAAS,EAET,cAAc,EAGd,WAAW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