@unwanted/matrix-sdk-mini 34.12.0 → 34.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (698) hide show
  1. package/git-revision.txt +1 -1
  2. package/lib/@types/event.d.ts +0 -19
  3. package/lib/@types/event.d.ts.map +1 -1
  4. package/lib/@types/event.js.map +1 -1
  5. package/lib/@types/global.d.js +0 -2
  6. package/lib/@types/global.d.js.map +1 -1
  7. package/lib/autodiscovery.d.ts +1 -1
  8. package/lib/autodiscovery.d.ts.map +1 -1
  9. package/lib/autodiscovery.js.map +1 -1
  10. package/lib/base64.d.ts +3 -6
  11. package/lib/base64.d.ts.map +1 -1
  12. package/lib/base64.js +43 -36
  13. package/lib/base64.js.map +1 -1
  14. package/lib/browser-index.d.ts.map +1 -1
  15. package/lib/browser-index.js +0 -11
  16. package/lib/browser-index.js.map +1 -1
  17. package/lib/client.d.ts +2 -1298
  18. package/lib/client.d.ts.map +1 -1
  19. package/lib/client.js +348 -2967
  20. package/lib/client.js.map +1 -1
  21. package/lib/digest.d.ts +2 -2
  22. package/lib/digest.d.ts.map +1 -1
  23. package/lib/digest.js +2 -2
  24. package/lib/digest.js.map +1 -1
  25. package/lib/embedded.d.ts +0 -22
  26. package/lib/embedded.d.ts.map +1 -1
  27. package/lib/embedded.js +58 -168
  28. package/lib/embedded.js.map +1 -1
  29. package/lib/event-mapper.d.ts.map +1 -1
  30. package/lib/event-mapper.js +0 -4
  31. package/lib/event-mapper.js.map +1 -1
  32. package/lib/matrix.d.ts +0 -25
  33. package/lib/matrix.d.ts.map +1 -1
  34. package/lib/matrix.js +1 -30
  35. package/lib/matrix.js.map +1 -1
  36. package/lib/models/MSC3089Branch.d.ts.map +1 -1
  37. package/lib/models/MSC3089Branch.js +0 -3
  38. package/lib/models/MSC3089Branch.js.map +1 -1
  39. package/lib/models/event-timeline-set.d.ts +6 -10
  40. package/lib/models/event-timeline-set.d.ts.map +1 -1
  41. package/lib/models/event-timeline-set.js +28 -36
  42. package/lib/models/event-timeline-set.js.map +1 -1
  43. package/lib/models/event-timeline.d.ts +7 -2
  44. package/lib/models/event-timeline.d.ts.map +1 -1
  45. package/lib/models/event-timeline.js +8 -9
  46. package/lib/models/event-timeline.js.map +1 -1
  47. package/lib/models/event.d.ts +1 -95
  48. package/lib/models/event.d.ts.map +1 -1
  49. package/lib/models/event.js +11 -281
  50. package/lib/models/event.js.map +1 -1
  51. package/lib/models/poll.d.ts.map +1 -1
  52. package/lib/models/poll.js +1 -5
  53. package/lib/models/poll.js.map +1 -1
  54. package/lib/models/relations-container.d.ts.map +1 -1
  55. package/lib/models/relations-container.js +1 -7
  56. package/lib/models/relations-container.js.map +1 -1
  57. package/lib/models/relations.d.ts +0 -1
  58. package/lib/models/relations.d.ts.map +1 -1
  59. package/lib/models/relations.js +0 -8
  60. package/lib/models/relations.js.map +1 -1
  61. package/lib/models/room-state.d.ts +2 -13
  62. package/lib/models/room-state.d.ts.map +1 -1
  63. package/lib/models/room-state.js +12 -56
  64. package/lib/models/room-state.js.map +1 -1
  65. package/lib/models/room.d.ts +2 -20
  66. package/lib/models/room.d.ts.map +1 -1
  67. package/lib/models/room.js +121 -162
  68. package/lib/models/room.js.map +1 -1
  69. package/lib/models/thread.d.ts.map +1 -1
  70. package/lib/models/thread.js +5 -4
  71. package/lib/models/thread.js.map +1 -1
  72. package/lib/sliding-sync-sdk.d.ts +3 -4
  73. package/lib/sliding-sync-sdk.d.ts.map +1 -1
  74. package/lib/sliding-sync-sdk.js +55 -102
  75. package/lib/sliding-sync-sdk.js.map +1 -1
  76. package/lib/sliding-sync.js +9 -6
  77. package/lib/sliding-sync.js.map +1 -1
  78. package/lib/store/indexeddb.d.ts +1 -1
  79. package/lib/store/indexeddb.d.ts.map +1 -1
  80. package/lib/store/indexeddb.js.map +1 -1
  81. package/lib/sync-accumulator.d.ts +6 -4
  82. package/lib/sync-accumulator.d.ts.map +1 -1
  83. package/lib/sync-accumulator.js +23 -12
  84. package/lib/sync-accumulator.js.map +1 -1
  85. package/lib/sync.d.ts +10 -13
  86. package/lib/sync.d.ts.map +1 -1
  87. package/lib/sync.js +94 -115
  88. package/lib/sync.js.map +1 -1
  89. package/lib/testing.d.ts +0 -48
  90. package/lib/testing.d.ts.map +1 -1
  91. package/lib/testing.js +0 -105
  92. package/lib/testing.js.map +1 -1
  93. package/lib/types.d.ts +0 -1
  94. package/lib/types.d.ts.map +1 -1
  95. package/lib/types.js.map +1 -1
  96. package/package.json +10 -11
  97. package/src/@types/event.ts +2 -36
  98. package/src/@types/global.d.ts +21 -4
  99. package/src/autodiscovery.ts +1 -1
  100. package/src/base64.ts +38 -40
  101. package/src/browser-index.ts +0 -11
  102. package/src/client.ts +68 -3087
  103. package/src/digest.ts +3 -3
  104. package/src/embedded.ts +38 -134
  105. package/src/event-mapper.ts +0 -4
  106. package/src/matrix.ts +0 -41
  107. package/src/models/MSC3089Branch.ts +0 -3
  108. package/src/models/event-timeline-set.ts +17 -38
  109. package/src/models/event-timeline.ts +10 -5
  110. package/src/models/event.ts +8 -295
  111. package/src/models/poll.ts +0 -6
  112. package/src/models/relations-container.ts +1 -8
  113. package/src/models/relations.ts +0 -8
  114. package/src/models/room-state.ts +4 -37
  115. package/src/models/room.ts +18 -68
  116. package/src/models/thread.ts +4 -3
  117. package/src/sliding-sync-sdk.ts +10 -83
  118. package/src/sliding-sync.ts +6 -6
  119. package/src/store/indexeddb.ts +1 -1
  120. package/src/sync-accumulator.ts +33 -16
  121. package/src/sync.ts +112 -143
  122. package/src/testing.ts +0 -108
  123. package/src/types.ts +0 -1
  124. package/CHANGELOG.md +0 -5910
  125. package/lib/@types/AESEncryptedSecretStoragePayload.d.ts +0 -14
  126. package/lib/@types/AESEncryptedSecretStoragePayload.d.ts.map +0 -1
  127. package/lib/@types/AESEncryptedSecretStoragePayload.js +0 -1
  128. package/lib/@types/AESEncryptedSecretStoragePayload.js.map +0 -1
  129. package/lib/@types/crypto.d.ts +0 -47
  130. package/lib/@types/crypto.d.ts.map +0 -1
  131. package/lib/@types/crypto.js +0 -1
  132. package/lib/@types/crypto.js.map +0 -1
  133. package/lib/@types/matrix-sdk-crypto-wasm.d.js +0 -1
  134. package/lib/@types/matrix-sdk-crypto-wasm.d.js.map +0 -1
  135. package/lib/common-crypto/CryptoBackend.d.ts +0 -240
  136. package/lib/common-crypto/CryptoBackend.d.ts.map +0 -1
  137. package/lib/common-crypto/CryptoBackend.js +0 -73
  138. package/lib/common-crypto/CryptoBackend.js.map +0 -1
  139. package/lib/common-crypto/key-passphrase.d.ts +0 -14
  140. package/lib/common-crypto/key-passphrase.d.ts.map +0 -1
  141. package/lib/common-crypto/key-passphrase.js +0 -33
  142. package/lib/common-crypto/key-passphrase.js.map +0 -1
  143. package/lib/crypto/CrossSigning.d.ts +0 -184
  144. package/lib/crypto/CrossSigning.d.ts.map +0 -1
  145. package/lib/crypto/CrossSigning.js +0 -718
  146. package/lib/crypto/CrossSigning.js.map +0 -1
  147. package/lib/crypto/DeviceList.d.ts +0 -216
  148. package/lib/crypto/DeviceList.d.ts.map +0 -1
  149. package/lib/crypto/DeviceList.js +0 -892
  150. package/lib/crypto/DeviceList.js.map +0 -1
  151. package/lib/crypto/EncryptionSetup.d.ts +0 -152
  152. package/lib/crypto/EncryptionSetup.d.ts.map +0 -1
  153. package/lib/crypto/EncryptionSetup.js +0 -356
  154. package/lib/crypto/EncryptionSetup.js.map +0 -1
  155. package/lib/crypto/OlmDevice.d.ts +0 -457
  156. package/lib/crypto/OlmDevice.d.ts.map +0 -1
  157. package/lib/crypto/OlmDevice.js +0 -1241
  158. package/lib/crypto/OlmDevice.js.map +0 -1
  159. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts +0 -109
  160. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts.map +0 -1
  161. package/lib/crypto/OutgoingRoomKeyRequestManager.js +0 -415
  162. package/lib/crypto/OutgoingRoomKeyRequestManager.js.map +0 -1
  163. package/lib/crypto/RoomList.d.ts +0 -26
  164. package/lib/crypto/RoomList.d.ts.map +0 -1
  165. package/lib/crypto/RoomList.js +0 -71
  166. package/lib/crypto/RoomList.js.map +0 -1
  167. package/lib/crypto/SecretSharing.d.ts +0 -24
  168. package/lib/crypto/SecretSharing.d.ts.map +0 -1
  169. package/lib/crypto/SecretSharing.js +0 -194
  170. package/lib/crypto/SecretSharing.js.map +0 -1
  171. package/lib/crypto/SecretStorage.d.ts +0 -55
  172. package/lib/crypto/SecretStorage.d.ts.map +0 -1
  173. package/lib/crypto/SecretStorage.js +0 -118
  174. package/lib/crypto/SecretStorage.js.map +0 -1
  175. package/lib/crypto/aes.d.ts +0 -6
  176. package/lib/crypto/aes.d.ts.map +0 -1
  177. package/lib/crypto/aes.js +0 -24
  178. package/lib/crypto/aes.js.map +0 -1
  179. package/lib/crypto/algorithms/base.d.ts +0 -156
  180. package/lib/crypto/algorithms/base.d.ts.map +0 -1
  181. package/lib/crypto/algorithms/base.js +0 -187
  182. package/lib/crypto/algorithms/base.js.map +0 -1
  183. package/lib/crypto/algorithms/index.d.ts +0 -4
  184. package/lib/crypto/algorithms/index.d.ts.map +0 -1
  185. package/lib/crypto/algorithms/index.js +0 -20
  186. package/lib/crypto/algorithms/index.js.map +0 -1
  187. package/lib/crypto/algorithms/megolm.d.ts +0 -385
  188. package/lib/crypto/algorithms/megolm.d.ts.map +0 -1
  189. package/lib/crypto/algorithms/megolm.js +0 -1822
  190. package/lib/crypto/algorithms/megolm.js.map +0 -1
  191. package/lib/crypto/algorithms/olm.d.ts +0 -5
  192. package/lib/crypto/algorithms/olm.d.ts.map +0 -1
  193. package/lib/crypto/algorithms/olm.js +0 -299
  194. package/lib/crypto/algorithms/olm.js.map +0 -1
  195. package/lib/crypto/api.d.ts +0 -32
  196. package/lib/crypto/api.d.ts.map +0 -1
  197. package/lib/crypto/api.js +0 -22
  198. package/lib/crypto/api.js.map +0 -1
  199. package/lib/crypto/backup.d.ts +0 -227
  200. package/lib/crypto/backup.d.ts.map +0 -1
  201. package/lib/crypto/backup.js +0 -824
  202. package/lib/crypto/backup.js.map +0 -1
  203. package/lib/crypto/crypto.d.ts +0 -3
  204. package/lib/crypto/crypto.d.ts.map +0 -1
  205. package/lib/crypto/crypto.js +0 -19
  206. package/lib/crypto/crypto.js.map +0 -1
  207. package/lib/crypto/dehydration.d.ts +0 -34
  208. package/lib/crypto/dehydration.d.ts.map +0 -1
  209. package/lib/crypto/dehydration.js +0 -252
  210. package/lib/crypto/dehydration.js.map +0 -1
  211. package/lib/crypto/device-converter.d.ts +0 -9
  212. package/lib/crypto/device-converter.d.ts.map +0 -1
  213. package/lib/crypto/device-converter.js +0 -42
  214. package/lib/crypto/device-converter.js.map +0 -1
  215. package/lib/crypto/deviceinfo.d.ts +0 -99
  216. package/lib/crypto/deviceinfo.d.ts.map +0 -1
  217. package/lib/crypto/deviceinfo.js +0 -148
  218. package/lib/crypto/deviceinfo.js.map +0 -1
  219. package/lib/crypto/index.d.ts +0 -1210
  220. package/lib/crypto/index.d.ts.map +0 -1
  221. package/lib/crypto/index.js +0 -4101
  222. package/lib/crypto/index.js.map +0 -1
  223. package/lib/crypto/key_passphrase.d.ts +0 -14
  224. package/lib/crypto/key_passphrase.d.ts.map +0 -1
  225. package/lib/crypto/key_passphrase.js +0 -44
  226. package/lib/crypto/key_passphrase.js.map +0 -1
  227. package/lib/crypto/keybackup.d.ts +0 -18
  228. package/lib/crypto/keybackup.d.ts.map +0 -1
  229. package/lib/crypto/keybackup.js +0 -1
  230. package/lib/crypto/keybackup.js.map +0 -1
  231. package/lib/crypto/olmlib.d.ts +0 -129
  232. package/lib/crypto/olmlib.d.ts.map +0 -1
  233. package/lib/crypto/olmlib.js +0 -492
  234. package/lib/crypto/olmlib.js.map +0 -1
  235. package/lib/crypto/recoverykey.d.ts +0 -2
  236. package/lib/crypto/recoverykey.d.ts.map +0 -1
  237. package/lib/crypto/recoverykey.js +0 -19
  238. package/lib/crypto/recoverykey.js.map +0 -1
  239. package/lib/crypto/store/base.d.ts +0 -252
  240. package/lib/crypto/store/base.d.ts.map +0 -1
  241. package/lib/crypto/store/base.js +0 -64
  242. package/lib/crypto/store/base.js.map +0 -1
  243. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts +0 -187
  244. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts.map +0 -1
  245. package/lib/crypto/store/indexeddb-crypto-store-backend.js +0 -1145
  246. package/lib/crypto/store/indexeddb-crypto-store-backend.js.map +0 -1
  247. package/lib/crypto/store/indexeddb-crypto-store.d.ts +0 -432
  248. package/lib/crypto/store/indexeddb-crypto-store.d.ts.map +0 -1
  249. package/lib/crypto/store/indexeddb-crypto-store.js +0 -728
  250. package/lib/crypto/store/indexeddb-crypto-store.js.map +0 -1
  251. package/lib/crypto/store/localStorage-crypto-store.d.ts +0 -119
  252. package/lib/crypto/store/localStorage-crypto-store.d.ts.map +0 -1
  253. package/lib/crypto/store/localStorage-crypto-store.js +0 -531
  254. package/lib/crypto/store/localStorage-crypto-store.js.map +0 -1
  255. package/lib/crypto/store/memory-crypto-store.d.ts +0 -215
  256. package/lib/crypto/store/memory-crypto-store.d.ts.map +0 -1
  257. package/lib/crypto/store/memory-crypto-store.js +0 -622
  258. package/lib/crypto/store/memory-crypto-store.js.map +0 -1
  259. package/lib/crypto/verification/Base.d.ts +0 -105
  260. package/lib/crypto/verification/Base.d.ts.map +0 -1
  261. package/lib/crypto/verification/Base.js +0 -372
  262. package/lib/crypto/verification/Base.js.map +0 -1
  263. package/lib/crypto/verification/Error.d.ts +0 -35
  264. package/lib/crypto/verification/Error.d.ts.map +0 -1
  265. package/lib/crypto/verification/Error.js +0 -86
  266. package/lib/crypto/verification/Error.js.map +0 -1
  267. package/lib/crypto/verification/IllegalMethod.d.ts +0 -15
  268. package/lib/crypto/verification/IllegalMethod.d.ts.map +0 -1
  269. package/lib/crypto/verification/IllegalMethod.js +0 -43
  270. package/lib/crypto/verification/IllegalMethod.js.map +0 -1
  271. package/lib/crypto/verification/QRCode.d.ts +0 -51
  272. package/lib/crypto/verification/QRCode.d.ts.map +0 -1
  273. package/lib/crypto/verification/QRCode.js +0 -277
  274. package/lib/crypto/verification/QRCode.js.map +0 -1
  275. package/lib/crypto/verification/SAS.d.ts +0 -27
  276. package/lib/crypto/verification/SAS.d.ts.map +0 -1
  277. package/lib/crypto/verification/SAS.js +0 -485
  278. package/lib/crypto/verification/SAS.js.map +0 -1
  279. package/lib/crypto/verification/SASDecimal.d.ts +0 -8
  280. package/lib/crypto/verification/SASDecimal.d.ts.map +0 -1
  281. package/lib/crypto/verification/SASDecimal.js +0 -34
  282. package/lib/crypto/verification/SASDecimal.js.map +0 -1
  283. package/lib/crypto/verification/request/Channel.d.ts +0 -18
  284. package/lib/crypto/verification/request/Channel.d.ts.map +0 -1
  285. package/lib/crypto/verification/request/Channel.js +0 -1
  286. package/lib/crypto/verification/request/Channel.js.map +0 -1
  287. package/lib/crypto/verification/request/InRoomChannel.d.ts +0 -113
  288. package/lib/crypto/verification/request/InRoomChannel.d.ts.map +0 -1
  289. package/lib/crypto/verification/request/InRoomChannel.js +0 -351
  290. package/lib/crypto/verification/request/InRoomChannel.js.map +0 -1
  291. package/lib/crypto/verification/request/ToDeviceChannel.d.ts +0 -105
  292. package/lib/crypto/verification/request/ToDeviceChannel.d.ts.map +0 -1
  293. package/lib/crypto/verification/request/ToDeviceChannel.js +0 -328
  294. package/lib/crypto/verification/request/ToDeviceChannel.js.map +0 -1
  295. package/lib/crypto/verification/request/VerificationRequest.d.ts +0 -227
  296. package/lib/crypto/verification/request/VerificationRequest.d.ts.map +0 -1
  297. package/lib/crypto/verification/request/VerificationRequest.js +0 -937
  298. package/lib/crypto/verification/request/VerificationRequest.js.map +0 -1
  299. package/lib/crypto-api/CryptoEvent.d.ts +0 -69
  300. package/lib/crypto-api/CryptoEvent.d.ts.map +0 -1
  301. package/lib/crypto-api/CryptoEvent.js +0 -33
  302. package/lib/crypto-api/CryptoEvent.js.map +0 -1
  303. package/lib/crypto-api/CryptoEventHandlerMap.d.ts +0 -16
  304. package/lib/crypto-api/CryptoEventHandlerMap.d.ts.map +0 -1
  305. package/lib/crypto-api/CryptoEventHandlerMap.js +0 -22
  306. package/lib/crypto-api/CryptoEventHandlerMap.js.map +0 -1
  307. package/lib/crypto-api/index.d.ts +0 -978
  308. package/lib/crypto-api/index.d.ts.map +0 -1
  309. package/lib/crypto-api/index.js +0 -304
  310. package/lib/crypto-api/index.js.map +0 -1
  311. package/lib/crypto-api/key-passphrase.d.ts +0 -11
  312. package/lib/crypto-api/key-passphrase.d.ts.map +0 -1
  313. package/lib/crypto-api/key-passphrase.js +0 -51
  314. package/lib/crypto-api/key-passphrase.js.map +0 -1
  315. package/lib/crypto-api/keybackup.d.ts +0 -88
  316. package/lib/crypto-api/keybackup.d.ts.map +0 -1
  317. package/lib/crypto-api/keybackup.js +0 -1
  318. package/lib/crypto-api/keybackup.js.map +0 -1
  319. package/lib/crypto-api/recovery-key.d.ts +0 -11
  320. package/lib/crypto-api/recovery-key.d.ts.map +0 -1
  321. package/lib/crypto-api/recovery-key.js +0 -65
  322. package/lib/crypto-api/recovery-key.js.map +0 -1
  323. package/lib/crypto-api/verification.d.ts +0 -344
  324. package/lib/crypto-api/verification.d.ts.map +0 -1
  325. package/lib/crypto-api/verification.js +0 -91
  326. package/lib/crypto-api/verification.js.map +0 -1
  327. package/lib/matrixrtc/CallMembership.d.ts +0 -66
  328. package/lib/matrixrtc/CallMembership.d.ts.map +0 -1
  329. package/lib/matrixrtc/CallMembership.js +0 -197
  330. package/lib/matrixrtc/CallMembership.js.map +0 -1
  331. package/lib/matrixrtc/LivekitFocus.d.ts +0 -16
  332. package/lib/matrixrtc/LivekitFocus.d.ts.map +0 -1
  333. package/lib/matrixrtc/LivekitFocus.js +0 -20
  334. package/lib/matrixrtc/LivekitFocus.js.map +0 -1
  335. package/lib/matrixrtc/MatrixRTCSession.d.ts +0 -295
  336. package/lib/matrixrtc/MatrixRTCSession.d.ts.map +0 -1
  337. package/lib/matrixrtc/MatrixRTCSession.js +0 -1043
  338. package/lib/matrixrtc/MatrixRTCSession.js.map +0 -1
  339. package/lib/matrixrtc/MatrixRTCSessionManager.d.ts +0 -40
  340. package/lib/matrixrtc/MatrixRTCSessionManager.d.ts.map +0 -1
  341. package/lib/matrixrtc/MatrixRTCSessionManager.js +0 -146
  342. package/lib/matrixrtc/MatrixRTCSessionManager.js.map +0 -1
  343. package/lib/matrixrtc/focus.d.ts +0 -10
  344. package/lib/matrixrtc/focus.d.ts.map +0 -1
  345. package/lib/matrixrtc/focus.js +0 -1
  346. package/lib/matrixrtc/focus.js.map +0 -1
  347. package/lib/matrixrtc/index.d.ts +0 -7
  348. package/lib/matrixrtc/index.d.ts.map +0 -1
  349. package/lib/matrixrtc/index.js +0 -21
  350. package/lib/matrixrtc/index.js.map +0 -1
  351. package/lib/matrixrtc/types.d.ts +0 -19
  352. package/lib/matrixrtc/types.d.ts.map +0 -1
  353. package/lib/matrixrtc/types.js +0 -1
  354. package/lib/matrixrtc/types.js.map +0 -1
  355. package/lib/rendezvous/MSC4108SignInWithQR.d.ts +0 -112
  356. package/lib/rendezvous/MSC4108SignInWithQR.d.ts.map +0 -1
  357. package/lib/rendezvous/MSC4108SignInWithQR.js +0 -392
  358. package/lib/rendezvous/MSC4108SignInWithQR.js.map +0 -1
  359. package/lib/rendezvous/RendezvousChannel.d.ts +0 -27
  360. package/lib/rendezvous/RendezvousChannel.d.ts.map +0 -1
  361. package/lib/rendezvous/RendezvousChannel.js +0 -1
  362. package/lib/rendezvous/RendezvousChannel.js.map +0 -1
  363. package/lib/rendezvous/RendezvousCode.d.ts +0 -9
  364. package/lib/rendezvous/RendezvousCode.d.ts.map +0 -1
  365. package/lib/rendezvous/RendezvousCode.js +0 -1
  366. package/lib/rendezvous/RendezvousCode.js.map +0 -1
  367. package/lib/rendezvous/RendezvousError.d.ts +0 -6
  368. package/lib/rendezvous/RendezvousError.d.ts.map +0 -1
  369. package/lib/rendezvous/RendezvousError.js +0 -23
  370. package/lib/rendezvous/RendezvousError.js.map +0 -1
  371. package/lib/rendezvous/RendezvousFailureReason.d.ts +0 -31
  372. package/lib/rendezvous/RendezvousFailureReason.d.ts.map +0 -1
  373. package/lib/rendezvous/RendezvousFailureReason.js +0 -38
  374. package/lib/rendezvous/RendezvousFailureReason.js.map +0 -1
  375. package/lib/rendezvous/RendezvousIntent.d.ts +0 -5
  376. package/lib/rendezvous/RendezvousIntent.d.ts.map +0 -1
  377. package/lib/rendezvous/RendezvousIntent.js +0 -22
  378. package/lib/rendezvous/RendezvousIntent.js.map +0 -1
  379. package/lib/rendezvous/RendezvousTransport.d.ts +0 -36
  380. package/lib/rendezvous/RendezvousTransport.d.ts.map +0 -1
  381. package/lib/rendezvous/RendezvousTransport.js +0 -1
  382. package/lib/rendezvous/RendezvousTransport.js.map +0 -1
  383. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts +0 -58
  384. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts.map +0 -1
  385. package/lib/rendezvous/channels/MSC4108SecureChannel.js +0 -246
  386. package/lib/rendezvous/channels/MSC4108SecureChannel.js.map +0 -1
  387. package/lib/rendezvous/channels/index.d.ts +0 -2
  388. package/lib/rendezvous/channels/index.d.ts.map +0 -1
  389. package/lib/rendezvous/channels/index.js +0 -18
  390. package/lib/rendezvous/channels/index.js.map +0 -1
  391. package/lib/rendezvous/index.d.ts +0 -10
  392. package/lib/rendezvous/index.d.ts.map +0 -1
  393. package/lib/rendezvous/index.js +0 -23
  394. package/lib/rendezvous/index.js.map +0 -1
  395. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts +0 -61
  396. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts.map +0 -1
  397. package/lib/rendezvous/transports/MSC4108RendezvousSession.js +0 -253
  398. package/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +0 -1
  399. package/lib/rendezvous/transports/index.d.ts +0 -2
  400. package/lib/rendezvous/transports/index.d.ts.map +0 -1
  401. package/lib/rendezvous/transports/index.js +0 -18
  402. package/lib/rendezvous/transports/index.js.map +0 -1
  403. package/lib/rust-crypto/CrossSigningIdentity.d.ts +0 -33
  404. package/lib/rust-crypto/CrossSigningIdentity.d.ts.map +0 -1
  405. package/lib/rust-crypto/CrossSigningIdentity.js +0 -157
  406. package/lib/rust-crypto/CrossSigningIdentity.js.map +0 -1
  407. package/lib/rust-crypto/DehydratedDeviceManager.d.ts +0 -98
  408. package/lib/rust-crypto/DehydratedDeviceManager.d.ts.map +0 -1
  409. package/lib/rust-crypto/DehydratedDeviceManager.js +0 -285
  410. package/lib/rust-crypto/DehydratedDeviceManager.js.map +0 -1
  411. package/lib/rust-crypto/KeyClaimManager.d.ts +0 -33
  412. package/lib/rust-crypto/KeyClaimManager.d.ts.map +0 -1
  413. package/lib/rust-crypto/KeyClaimManager.js +0 -82
  414. package/lib/rust-crypto/KeyClaimManager.js.map +0 -1
  415. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts +0 -43
  416. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts.map +0 -1
  417. package/lib/rust-crypto/OutgoingRequestProcessor.js +0 -195
  418. package/lib/rust-crypto/OutgoingRequestProcessor.js.map +0 -1
  419. package/lib/rust-crypto/OutgoingRequestsManager.d.ts +0 -47
  420. package/lib/rust-crypto/OutgoingRequestsManager.d.ts.map +0 -1
  421. package/lib/rust-crypto/OutgoingRequestsManager.js +0 -148
  422. package/lib/rust-crypto/OutgoingRequestsManager.js.map +0 -1
  423. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts +0 -120
  424. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts.map +0 -1
  425. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js +0 -467
  426. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +0 -1
  427. package/lib/rust-crypto/RoomEncryptor.d.ts +0 -98
  428. package/lib/rust-crypto/RoomEncryptor.d.ts.map +0 -1
  429. package/lib/rust-crypto/RoomEncryptor.js +0 -299
  430. package/lib/rust-crypto/RoomEncryptor.js.map +0 -1
  431. package/lib/rust-crypto/backup.d.ts +0 -254
  432. package/lib/rust-crypto/backup.d.ts.map +0 -1
  433. package/lib/rust-crypto/backup.js +0 -837
  434. package/lib/rust-crypto/backup.js.map +0 -1
  435. package/lib/rust-crypto/constants.d.ts +0 -3
  436. package/lib/rust-crypto/constants.d.ts.map +0 -1
  437. package/lib/rust-crypto/constants.js +0 -19
  438. package/lib/rust-crypto/constants.js.map +0 -1
  439. package/lib/rust-crypto/device-converter.d.ts +0 -28
  440. package/lib/rust-crypto/device-converter.d.ts.map +0 -1
  441. package/lib/rust-crypto/device-converter.js +0 -123
  442. package/lib/rust-crypto/device-converter.js.map +0 -1
  443. package/lib/rust-crypto/index.d.ts +0 -61
  444. package/lib/rust-crypto/index.d.ts.map +0 -1
  445. package/lib/rust-crypto/index.js +0 -152
  446. package/lib/rust-crypto/index.js.map +0 -1
  447. package/lib/rust-crypto/libolm_migration.d.ts +0 -81
  448. package/lib/rust-crypto/libolm_migration.d.ts.map +0 -1
  449. package/lib/rust-crypto/libolm_migration.js +0 -459
  450. package/lib/rust-crypto/libolm_migration.js.map +0 -1
  451. package/lib/rust-crypto/rust-crypto.d.ts +0 -556
  452. package/lib/rust-crypto/rust-crypto.d.ts.map +0 -1
  453. package/lib/rust-crypto/rust-crypto.js +0 -2016
  454. package/lib/rust-crypto/rust-crypto.js.map +0 -1
  455. package/lib/rust-crypto/secret-storage.d.ts +0 -22
  456. package/lib/rust-crypto/secret-storage.d.ts.map +0 -1
  457. package/lib/rust-crypto/secret-storage.js +0 -63
  458. package/lib/rust-crypto/secret-storage.js.map +0 -1
  459. package/lib/rust-crypto/verification.d.ts +0 -319
  460. package/lib/rust-crypto/verification.d.ts.map +0 -1
  461. package/lib/rust-crypto/verification.js +0 -816
  462. package/lib/rust-crypto/verification.js.map +0 -1
  463. package/lib/secret-storage.d.ts +0 -370
  464. package/lib/secret-storage.d.ts.map +0 -1
  465. package/lib/secret-storage.js +0 -466
  466. package/lib/secret-storage.js.map +0 -1
  467. package/lib/utils/decryptAESSecretStorageItem.d.ts +0 -12
  468. package/lib/utils/decryptAESSecretStorageItem.d.ts.map +0 -1
  469. package/lib/utils/decryptAESSecretStorageItem.js +0 -50
  470. package/lib/utils/decryptAESSecretStorageItem.js.map +0 -1
  471. package/lib/utils/encryptAESSecretStorageItem.d.ts +0 -16
  472. package/lib/utils/encryptAESSecretStorageItem.d.ts.map +0 -1
  473. package/lib/utils/encryptAESSecretStorageItem.js +0 -68
  474. package/lib/utils/encryptAESSecretStorageItem.js.map +0 -1
  475. package/lib/utils/internal/deriveKeys.d.ts +0 -10
  476. package/lib/utils/internal/deriveKeys.d.ts.map +0 -1
  477. package/lib/utils/internal/deriveKeys.js +0 -60
  478. package/lib/utils/internal/deriveKeys.js.map +0 -1
  479. package/lib/webrtc/audioContext.d.ts +0 -15
  480. package/lib/webrtc/audioContext.d.ts.map +0 -1
  481. package/lib/webrtc/audioContext.js +0 -46
  482. package/lib/webrtc/audioContext.js.map +0 -1
  483. package/lib/webrtc/call.d.ts +0 -560
  484. package/lib/webrtc/call.d.ts.map +0 -1
  485. package/lib/webrtc/call.js +0 -2541
  486. package/lib/webrtc/call.js.map +0 -1
  487. package/lib/webrtc/callEventHandler.d.ts +0 -37
  488. package/lib/webrtc/callEventHandler.d.ts.map +0 -1
  489. package/lib/webrtc/callEventHandler.js +0 -344
  490. package/lib/webrtc/callEventHandler.js.map +0 -1
  491. package/lib/webrtc/callEventTypes.d.ts +0 -73
  492. package/lib/webrtc/callEventTypes.d.ts.map +0 -1
  493. package/lib/webrtc/callEventTypes.js +0 -13
  494. package/lib/webrtc/callEventTypes.js.map +0 -1
  495. package/lib/webrtc/callFeed.d.ts +0 -128
  496. package/lib/webrtc/callFeed.d.ts.map +0 -1
  497. package/lib/webrtc/callFeed.js +0 -289
  498. package/lib/webrtc/callFeed.js.map +0 -1
  499. package/lib/webrtc/groupCall.d.ts +0 -323
  500. package/lib/webrtc/groupCall.d.ts.map +0 -1
  501. package/lib/webrtc/groupCall.js +0 -1337
  502. package/lib/webrtc/groupCall.js.map +0 -1
  503. package/lib/webrtc/groupCallEventHandler.d.ts +0 -31
  504. package/lib/webrtc/groupCallEventHandler.d.ts.map +0 -1
  505. package/lib/webrtc/groupCallEventHandler.js +0 -178
  506. package/lib/webrtc/groupCallEventHandler.js.map +0 -1
  507. package/lib/webrtc/mediaHandler.d.ts +0 -89
  508. package/lib/webrtc/mediaHandler.d.ts.map +0 -1
  509. package/lib/webrtc/mediaHandler.js +0 -437
  510. package/lib/webrtc/mediaHandler.js.map +0 -1
  511. package/lib/webrtc/stats/callFeedStatsReporter.d.ts +0 -8
  512. package/lib/webrtc/stats/callFeedStatsReporter.d.ts.map +0 -1
  513. package/lib/webrtc/stats/callFeedStatsReporter.js +0 -82
  514. package/lib/webrtc/stats/callFeedStatsReporter.js.map +0 -1
  515. package/lib/webrtc/stats/callStatsReportGatherer.d.ts +0 -25
  516. package/lib/webrtc/stats/callStatsReportGatherer.d.ts.map +0 -1
  517. package/lib/webrtc/stats/callStatsReportGatherer.js +0 -199
  518. package/lib/webrtc/stats/callStatsReportGatherer.js.map +0 -1
  519. package/lib/webrtc/stats/callStatsReportSummary.d.ts +0 -17
  520. package/lib/webrtc/stats/callStatsReportSummary.d.ts.map +0 -1
  521. package/lib/webrtc/stats/callStatsReportSummary.js +0 -1
  522. package/lib/webrtc/stats/callStatsReportSummary.js.map +0 -1
  523. package/lib/webrtc/stats/connectionStats.d.ts +0 -28
  524. package/lib/webrtc/stats/connectionStats.d.ts.map +0 -1
  525. package/lib/webrtc/stats/connectionStats.js +0 -26
  526. package/lib/webrtc/stats/connectionStats.js.map +0 -1
  527. package/lib/webrtc/stats/connectionStatsBuilder.d.ts +0 -5
  528. package/lib/webrtc/stats/connectionStatsBuilder.d.ts.map +0 -1
  529. package/lib/webrtc/stats/connectionStatsBuilder.js +0 -27
  530. package/lib/webrtc/stats/connectionStatsBuilder.js.map +0 -1
  531. package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts +0 -7
  532. package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts.map +0 -1
  533. package/lib/webrtc/stats/connectionStatsReportBuilder.js +0 -121
  534. package/lib/webrtc/stats/connectionStatsReportBuilder.js.map +0 -1
  535. package/lib/webrtc/stats/groupCallStats.d.ts +0 -22
  536. package/lib/webrtc/stats/groupCallStats.d.ts.map +0 -1
  537. package/lib/webrtc/stats/groupCallStats.js +0 -78
  538. package/lib/webrtc/stats/groupCallStats.js.map +0 -1
  539. package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts +0 -10
  540. package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts.map +0 -1
  541. package/lib/webrtc/stats/media/mediaSsrcHandler.js +0 -57
  542. package/lib/webrtc/stats/media/mediaSsrcHandler.js.map +0 -1
  543. package/lib/webrtc/stats/media/mediaTrackHandler.d.ts +0 -12
  544. package/lib/webrtc/stats/media/mediaTrackHandler.d.ts.map +0 -1
  545. package/lib/webrtc/stats/media/mediaTrackHandler.js +0 -62
  546. package/lib/webrtc/stats/media/mediaTrackHandler.js.map +0 -1
  547. package/lib/webrtc/stats/media/mediaTrackStats.d.ts +0 -86
  548. package/lib/webrtc/stats/media/mediaTrackStats.d.ts.map +0 -1
  549. package/lib/webrtc/stats/media/mediaTrackStats.js +0 -142
  550. package/lib/webrtc/stats/media/mediaTrackStats.js.map +0 -1
  551. package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts +0 -22
  552. package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts.map +0 -1
  553. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js +0 -76
  554. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js.map +0 -1
  555. package/lib/webrtc/stats/statsReport.d.ts +0 -99
  556. package/lib/webrtc/stats/statsReport.d.ts.map +0 -1
  557. package/lib/webrtc/stats/statsReport.js +0 -32
  558. package/lib/webrtc/stats/statsReport.js.map +0 -1
  559. package/lib/webrtc/stats/statsReportEmitter.d.ts +0 -15
  560. package/lib/webrtc/stats/statsReportEmitter.d.ts.map +0 -1
  561. package/lib/webrtc/stats/statsReportEmitter.js +0 -33
  562. package/lib/webrtc/stats/statsReportEmitter.js.map +0 -1
  563. package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts +0 -16
  564. package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts.map +0 -1
  565. package/lib/webrtc/stats/summaryStatsReportGatherer.js +0 -116
  566. package/lib/webrtc/stats/summaryStatsReportGatherer.js.map +0 -1
  567. package/lib/webrtc/stats/trackStatsBuilder.d.ts +0 -19
  568. package/lib/webrtc/stats/trackStatsBuilder.d.ts.map +0 -1
  569. package/lib/webrtc/stats/trackStatsBuilder.js +0 -168
  570. package/lib/webrtc/stats/trackStatsBuilder.js.map +0 -1
  571. package/lib/webrtc/stats/transportStats.d.ts +0 -11
  572. package/lib/webrtc/stats/transportStats.d.ts.map +0 -1
  573. package/lib/webrtc/stats/transportStats.js +0 -1
  574. package/lib/webrtc/stats/transportStats.js.map +0 -1
  575. package/lib/webrtc/stats/transportStatsBuilder.d.ts +0 -5
  576. package/lib/webrtc/stats/transportStatsBuilder.d.ts.map +0 -1
  577. package/lib/webrtc/stats/transportStatsBuilder.js +0 -34
  578. package/lib/webrtc/stats/transportStatsBuilder.js.map +0 -1
  579. package/lib/webrtc/stats/valueFormatter.d.ts +0 -4
  580. package/lib/webrtc/stats/valueFormatter.d.ts.map +0 -1
  581. package/lib/webrtc/stats/valueFormatter.js +0 -25
  582. package/lib/webrtc/stats/valueFormatter.js.map +0 -1
  583. package/src/@types/AESEncryptedSecretStoragePayload.ts +0 -29
  584. package/src/@types/crypto.ts +0 -73
  585. package/src/@types/matrix-sdk-crypto-wasm.d.ts +0 -44
  586. package/src/common-crypto/CryptoBackend.ts +0 -302
  587. package/src/common-crypto/README.md +0 -4
  588. package/src/common-crypto/key-passphrase.ts +0 -43
  589. package/src/crypto/CrossSigning.ts +0 -773
  590. package/src/crypto/DeviceList.ts +0 -989
  591. package/src/crypto/EncryptionSetup.ts +0 -351
  592. package/src/crypto/OlmDevice.ts +0 -1500
  593. package/src/crypto/OutgoingRoomKeyRequestManager.ts +0 -485
  594. package/src/crypto/RoomList.ts +0 -70
  595. package/src/crypto/SecretSharing.ts +0 -240
  596. package/src/crypto/SecretStorage.ts +0 -136
  597. package/src/crypto/aes.ts +0 -23
  598. package/src/crypto/algorithms/base.ts +0 -236
  599. package/src/crypto/algorithms/index.ts +0 -20
  600. package/src/crypto/algorithms/megolm.ts +0 -2216
  601. package/src/crypto/algorithms/olm.ts +0 -381
  602. package/src/crypto/api.ts +0 -70
  603. package/src/crypto/backup.ts +0 -922
  604. package/src/crypto/crypto.ts +0 -18
  605. package/src/crypto/dehydration.ts +0 -272
  606. package/src/crypto/device-converter.ts +0 -45
  607. package/src/crypto/deviceinfo.ts +0 -158
  608. package/src/crypto/index.ts +0 -4418
  609. package/src/crypto/key_passphrase.ts +0 -42
  610. package/src/crypto/keybackup.ts +0 -47
  611. package/src/crypto/olmlib.ts +0 -539
  612. package/src/crypto/recoverykey.ts +0 -18
  613. package/src/crypto/store/base.ts +0 -348
  614. package/src/crypto/store/indexeddb-crypto-store-backend.ts +0 -1250
  615. package/src/crypto/store/indexeddb-crypto-store.ts +0 -845
  616. package/src/crypto/store/localStorage-crypto-store.ts +0 -579
  617. package/src/crypto/store/memory-crypto-store.ts +0 -680
  618. package/src/crypto/verification/Base.ts +0 -409
  619. package/src/crypto/verification/Error.ts +0 -76
  620. package/src/crypto/verification/IllegalMethod.ts +0 -50
  621. package/src/crypto/verification/QRCode.ts +0 -310
  622. package/src/crypto/verification/SAS.ts +0 -494
  623. package/src/crypto/verification/SASDecimal.ts +0 -37
  624. package/src/crypto/verification/request/Channel.ts +0 -34
  625. package/src/crypto/verification/request/InRoomChannel.ts +0 -371
  626. package/src/crypto/verification/request/ToDeviceChannel.ts +0 -354
  627. package/src/crypto/verification/request/VerificationRequest.ts +0 -976
  628. package/src/crypto-api/CryptoEvent.ts +0 -93
  629. package/src/crypto-api/CryptoEventHandlerMap.ts +0 -32
  630. package/src/crypto-api/index.ts +0 -1175
  631. package/src/crypto-api/key-passphrase.ts +0 -58
  632. package/src/crypto-api/keybackup.ts +0 -115
  633. package/src/crypto-api/recovery-key.ts +0 -69
  634. package/src/crypto-api/verification.ts +0 -408
  635. package/src/matrixrtc/CallMembership.ts +0 -247
  636. package/src/matrixrtc/LivekitFocus.ts +0 -39
  637. package/src/matrixrtc/MatrixRTCSession.ts +0 -1319
  638. package/src/matrixrtc/MatrixRTCSessionManager.ts +0 -166
  639. package/src/matrixrtc/focus.ts +0 -25
  640. package/src/matrixrtc/index.ts +0 -22
  641. package/src/matrixrtc/types.ts +0 -36
  642. package/src/rendezvous/MSC4108SignInWithQR.ts +0 -444
  643. package/src/rendezvous/RendezvousChannel.ts +0 -48
  644. package/src/rendezvous/RendezvousCode.ts +0 -25
  645. package/src/rendezvous/RendezvousError.ts +0 -26
  646. package/src/rendezvous/RendezvousFailureReason.ts +0 -49
  647. package/src/rendezvous/RendezvousIntent.ts +0 -20
  648. package/src/rendezvous/RendezvousTransport.ts +0 -58
  649. package/src/rendezvous/channels/MSC4108SecureChannel.ts +0 -270
  650. package/src/rendezvous/channels/index.ts +0 -17
  651. package/src/rendezvous/index.ts +0 -25
  652. package/src/rendezvous/transports/MSC4108RendezvousSession.ts +0 -270
  653. package/src/rendezvous/transports/index.ts +0 -17
  654. package/src/rust-crypto/CrossSigningIdentity.ts +0 -183
  655. package/src/rust-crypto/DehydratedDeviceManager.ts +0 -306
  656. package/src/rust-crypto/KeyClaimManager.ts +0 -86
  657. package/src/rust-crypto/OutgoingRequestProcessor.ts +0 -236
  658. package/src/rust-crypto/OutgoingRequestsManager.ts +0 -143
  659. package/src/rust-crypto/PerSessionKeyBackupDownloader.ts +0 -501
  660. package/src/rust-crypto/RoomEncryptor.ts +0 -352
  661. package/src/rust-crypto/backup.ts +0 -881
  662. package/src/rust-crypto/constants.ts +0 -18
  663. package/src/rust-crypto/device-converter.ts +0 -128
  664. package/src/rust-crypto/index.ts +0 -237
  665. package/src/rust-crypto/libolm_migration.ts +0 -530
  666. package/src/rust-crypto/rust-crypto.ts +0 -2205
  667. package/src/rust-crypto/secret-storage.ts +0 -60
  668. package/src/rust-crypto/verification.ts +0 -830
  669. package/src/secret-storage.ts +0 -693
  670. package/src/utils/decryptAESSecretStorageItem.ts +0 -54
  671. package/src/utils/encryptAESSecretStorageItem.ts +0 -73
  672. package/src/utils/internal/deriveKeys.ts +0 -63
  673. package/src/webrtc/audioContext.ts +0 -44
  674. package/src/webrtc/call.ts +0 -3074
  675. package/src/webrtc/callEventHandler.ts +0 -425
  676. package/src/webrtc/callEventTypes.ts +0 -93
  677. package/src/webrtc/callFeed.ts +0 -364
  678. package/src/webrtc/groupCall.ts +0 -1735
  679. package/src/webrtc/groupCallEventHandler.ts +0 -234
  680. package/src/webrtc/mediaHandler.ts +0 -484
  681. package/src/webrtc/stats/callFeedStatsReporter.ts +0 -94
  682. package/src/webrtc/stats/callStatsReportGatherer.ts +0 -219
  683. package/src/webrtc/stats/callStatsReportSummary.ts +0 -30
  684. package/src/webrtc/stats/connectionStats.ts +0 -47
  685. package/src/webrtc/stats/connectionStatsBuilder.ts +0 -28
  686. package/src/webrtc/stats/connectionStatsReportBuilder.ts +0 -140
  687. package/src/webrtc/stats/groupCallStats.ts +0 -93
  688. package/src/webrtc/stats/media/mediaSsrcHandler.ts +0 -57
  689. package/src/webrtc/stats/media/mediaTrackHandler.ts +0 -76
  690. package/src/webrtc/stats/media/mediaTrackStats.ts +0 -176
  691. package/src/webrtc/stats/media/mediaTrackStatsHandler.ts +0 -90
  692. package/src/webrtc/stats/statsReport.ts +0 -133
  693. package/src/webrtc/stats/statsReportEmitter.ts +0 -49
  694. package/src/webrtc/stats/summaryStatsReportGatherer.ts +0 -148
  695. package/src/webrtc/stats/trackStatsBuilder.ts +0 -207
  696. package/src/webrtc/stats/transportStats.ts +0 -26
  697. package/src/webrtc/stats/transportStatsBuilder.ts +0 -48
  698. package/src/webrtc/stats/valueFormatter.ts +0 -27
@@ -1 +1 @@
1
- {"version":3,"file":"sync-accumulator.js","names":["logger","deepCopy","UNREAD_THREAD_NOTIFICATIONS","ReceiptAccumulator","Category","isTaggedEvent","event","undefined","SyncAccumulator","constructor","opts","arguments","length","_defineProperty","maxTimelineEntries","accumulate","syncResponse","fromDatabase","accumulateRooms","accumulateAccountData","nextBatch","next_batch","account_data","events","forEach","e","accountData","type","rooms","invite","Object","keys","roomId","accumulateRoom","Invite","join","Join","leave","Leave","knock","Knock","category","data","knockRooms","accumulateInviteState","accumulateKnockState","inviteRooms","accumulateJoinState","joinRooms","error","invite_state","currentData","hasAdded","i","current","state_key","push","knock_state","_ref","_data","_data$ephemeral","_data$state","_data$timeline","_currentState","create","_timeline","_accountData","_unreadNotifications","_unreadThreadNotifications","_summary","_receipts","unread_notifications","stable","unstable","summary","_sum$HEROES_KEY","_sum$JOINED_COUNT_KEY","_sum$INVITED_COUNT_KE","HEROES_KEY","INVITED_COUNT_KEY","JOINED_COUNT_KEY","acc","sum","consumeEphemeralEvents","ephemeral","timeline","limited","state","setState","index","_data$timeline$prev_b","transformedEvent","_e$unsigned","assign","unsigned","age","_localTs","Date","now","token","prev_batch","startIndex","slice","getJSON","forDatabase","roomData","roomJson","unread_thread_notifications","evType","receiptEvent","buildAccumulatedReceiptEvent","msgData","rollBackState","timelineEvent","prevStateEvent","prev_content","content","prev_sender","sender","stateKey","ev","accData","roomsData","getNextBatchToken","eventMap"],"sources":["../src/sync-accumulator.ts"],"sourcesContent":["/*\nCopyright 2017 - 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\n/**\n * This is an internal module. See {@link SyncAccumulator} for the public class.\n */\n\nimport { logger } from \"./logger.ts\";\nimport { deepCopy } from \"./utils.ts\";\nimport { IContent, IUnsigned } from \"./models/event.ts\";\nimport { IRoomSummary } from \"./models/room-summary.ts\";\nimport { EventType } from \"./@types/event.ts\";\nimport { UNREAD_THREAD_NOTIFICATIONS } from \"./@types/sync.ts\";\nimport { ReceiptAccumulator } from \"./receipt-accumulator.ts\";\n\ninterface IOpts {\n /**\n * The ideal maximum number of timeline entries to keep in the sync response.\n * This is best-effort, as clients do not always have a back-pagination token for each event,\n * so it's possible there may be slightly *less* than this value. There will never be more.\n * This cannot be 0 or else it makes it impossible to scroll back in a room.\n * Default: 50.\n */\n maxTimelineEntries?: number;\n}\n\nexport interface IMinimalEvent {\n content: IContent;\n type: EventType | string;\n room_id?: string;\n unsigned?: IUnsigned;\n}\n\nexport interface IEphemeral {\n events: IMinimalEvent[];\n}\n\n/* eslint-disable camelcase */\ninterface UnreadNotificationCounts {\n highlight_count?: number;\n notification_count?: number;\n}\n\nexport interface IRoomEvent extends IMinimalEvent {\n event_id: string;\n sender: string;\n origin_server_ts: number;\n}\n\nexport interface IStateEvent extends IRoomEvent {\n prev_content?: IContent;\n state_key: string;\n}\n\ninterface IState {\n events: IStateEvent[];\n}\n\nexport interface ITimeline {\n events: Array<IRoomEvent | IStateEvent>;\n limited?: boolean;\n prev_batch: string | null;\n}\n\nexport interface IJoinedRoom {\n \"summary\": IRoomSummary;\n \"state\": IState;\n \"timeline\": ITimeline;\n \"ephemeral\": IEphemeral;\n \"account_data\": IAccountData;\n \"unread_notifications\": UnreadNotificationCounts;\n \"unread_thread_notifications\"?: Record<string, UnreadNotificationCounts>;\n \"org.matrix.msc3773.unread_thread_notifications\"?: Record<string, UnreadNotificationCounts>;\n}\n\nexport interface IStrippedState {\n content: IContent;\n state_key: string;\n type: EventType | string;\n sender: string;\n}\n\nexport interface IInviteState {\n events: IStrippedState[];\n}\n\nexport interface IKnockState {\n events: IStrippedState[];\n}\n\nexport interface IInvitedRoom {\n invite_state: IInviteState;\n}\n\nexport interface ILeftRoom {\n state: IState;\n timeline: ITimeline;\n account_data: IAccountData;\n}\n\nexport interface IKnockedRoom {\n knock_state: IKnockState;\n}\n\nexport interface IRooms {\n [Category.Join]: Record<string, IJoinedRoom>;\n [Category.Invite]: Record<string, IInvitedRoom>;\n [Category.Leave]: Record<string, ILeftRoom>;\n [Category.Knock]: Record<string, IKnockedRoom>;\n}\n\ninterface IPresence {\n events: IMinimalEvent[];\n}\n\ninterface IAccountData {\n events: IMinimalEvent[];\n}\n\nexport interface IToDeviceEvent {\n content: IContent;\n sender: string;\n type: string;\n}\n\ninterface IToDevice {\n events: IToDeviceEvent[];\n}\n\nexport interface IDeviceLists {\n changed?: string[];\n left?: string[];\n}\n\nexport interface ISyncResponse {\n \"next_batch\": string;\n \"rooms\": IRooms;\n \"presence\"?: IPresence;\n \"account_data\": IAccountData;\n \"to_device\"?: IToDevice;\n \"device_lists\"?: IDeviceLists;\n \"device_one_time_keys_count\"?: Record<string, number>;\n\n \"device_unused_fallback_key_types\"?: string[];\n \"org.matrix.msc2732.device_unused_fallback_key_types\"?: string[];\n}\n/* eslint-enable camelcase */\n\nexport enum Category {\n Invite = \"invite\",\n Leave = \"leave\",\n Join = \"join\",\n Knock = \"knock\",\n}\n\ninterface IRoom {\n _currentState: { [eventType: string]: { [stateKey: string]: IStateEvent } };\n _timeline: {\n event: IRoomEvent | IStateEvent;\n token: string | null;\n }[];\n _summary: Partial<IRoomSummary>;\n _accountData: { [eventType: string]: IMinimalEvent };\n _unreadNotifications: Partial<UnreadNotificationCounts>;\n _unreadThreadNotifications?: Record<string, Partial<UnreadNotificationCounts>>;\n _receipts: ReceiptAccumulator;\n}\n\nexport interface ISyncData {\n nextBatch: string;\n accountData: IMinimalEvent[];\n roomsData: IRooms;\n}\n\ntype TaggedEvent = IRoomEvent & { _localTs?: number };\n\nfunction isTaggedEvent(event: IRoomEvent): event is TaggedEvent {\n return \"_localTs\" in event && event[\"_localTs\"] !== undefined;\n}\n\n/**\n * The purpose of this class is to accumulate /sync responses such that a\n * complete \"initial\" JSON response can be returned which accurately represents\n * the sum total of the /sync responses accumulated to date. It only handles\n * room data: that is, everything under the \"rooms\" top-level key.\n *\n * This class is used when persisting room data so a complete /sync response can\n * be loaded from disk and incremental syncs can be performed on the server,\n * rather than asking the server to do an initial sync on startup.\n */\nexport class SyncAccumulator {\n private accountData: Record<string, IMinimalEvent> = {}; // $event_type: Object\n private inviteRooms: Record<string, IInvitedRoom> = {}; // $roomId: { ... sync 'invite' json data ... }\n private knockRooms: Record<string, IKnockedRoom> = {}; // $roomId: { ... sync 'knock' json data ... }\n private joinRooms: { [roomId: string]: IRoom } = {};\n // the /sync token which corresponds to the last time rooms were\n // accumulated. We remember this so that any caller can obtain a\n // coherent /sync response and know at what point they should be\n // streaming from without losing events.\n private nextBatch: string | null = null;\n\n public constructor(private readonly opts: IOpts = {}) {\n this.opts.maxTimelineEntries = this.opts.maxTimelineEntries || 50;\n }\n\n public accumulate(syncResponse: ISyncResponse, fromDatabase = false): void {\n this.accumulateRooms(syncResponse, fromDatabase);\n this.accumulateAccountData(syncResponse);\n this.nextBatch = syncResponse.next_batch;\n }\n\n private accumulateAccountData(syncResponse: ISyncResponse): void {\n if (!syncResponse.account_data || !syncResponse.account_data.events) {\n return;\n }\n // Clobbers based on event type.\n syncResponse.account_data.events.forEach((e) => {\n this.accountData[e.type] = e;\n });\n }\n\n /**\n * Accumulate incremental /sync room data.\n * @param syncResponse - the complete /sync JSON\n * @param fromDatabase - True if the sync response is one saved to the database\n */\n private accumulateRooms(syncResponse: ISyncResponse, fromDatabase = false): void {\n if (!syncResponse.rooms) {\n return;\n }\n if (syncResponse.rooms.invite) {\n Object.keys(syncResponse.rooms.invite).forEach((roomId) => {\n this.accumulateRoom(roomId, Category.Invite, syncResponse.rooms.invite[roomId], fromDatabase);\n });\n }\n if (syncResponse.rooms.join) {\n Object.keys(syncResponse.rooms.join).forEach((roomId) => {\n this.accumulateRoom(roomId, Category.Join, syncResponse.rooms.join[roomId], fromDatabase);\n });\n }\n if (syncResponse.rooms.leave) {\n Object.keys(syncResponse.rooms.leave).forEach((roomId) => {\n this.accumulateRoom(roomId, Category.Leave, syncResponse.rooms.leave[roomId], fromDatabase);\n });\n }\n if (syncResponse.rooms.knock) {\n Object.keys(syncResponse.rooms.knock).forEach((roomId) => {\n this.accumulateRoom(roomId, Category.Knock, syncResponse.rooms.knock[roomId], fromDatabase);\n });\n }\n }\n\n private accumulateRoom(roomId: string, category: Category.Invite, data: IInvitedRoom, fromDatabase: boolean): void;\n private accumulateRoom(roomId: string, category: Category.Join, data: IJoinedRoom, fromDatabase: boolean): void;\n private accumulateRoom(roomId: string, category: Category.Leave, data: ILeftRoom, fromDatabase: boolean): void;\n private accumulateRoom(roomId: string, category: Category.Knock, data: IKnockedRoom, fromDatabase: boolean): void;\n private accumulateRoom(roomId: string, category: Category, data: any, fromDatabase = false): void {\n // Valid /sync state transitions\n // +--------+ <======+ 1: Accept an invite\n // +== | INVITE | | (5) 2: Leave a room\n // | +--------+ =====+ | 3: Join a public room previously\n // |(1) (4) | | left (handle as if new room)\n // V (2) V | 4: Reject an invite\n // +------+ ========> +--------+ 5: Invite to a room previously\n // | JOIN | (3) | LEAVE* | left (handle as if new room)\n // +------+ <======== +--------+\n //\n // * equivalent to \"no state\"\n switch (category) {\n case Category.Invite: // (5)\n if (this.knockRooms[roomId]) {\n // was previously knock, now invite, need to delete knock state\n delete this.knockRooms[roomId];\n }\n this.accumulateInviteState(roomId, data as IInvitedRoom);\n break;\n\n case Category.Knock:\n this.accumulateKnockState(roomId, data as IKnockedRoom);\n break;\n\n case Category.Join:\n if (this.inviteRooms[roomId]) {\n // (1)\n // was previously invite, now join. We expect /sync to give\n // the entire state and timeline on 'join', so delete previous\n // invite state\n delete this.inviteRooms[roomId];\n }\n // (3)\n this.accumulateJoinState(roomId, data as IJoinedRoom, fromDatabase);\n break;\n\n case Category.Leave:\n if (this.knockRooms[roomId]) {\n // delete knock state on leave\n delete this.knockRooms[roomId];\n } else if (this.inviteRooms[roomId]) {\n // (4)\n delete this.inviteRooms[roomId];\n } else {\n // (2)\n delete this.joinRooms[roomId];\n }\n break;\n\n default:\n logger.error(\"Unknown cateogory: \", category);\n }\n }\n\n private accumulateInviteState(roomId: string, data: IInvitedRoom): void {\n if (!data.invite_state || !data.invite_state.events) {\n // no new data\n return;\n }\n if (!this.inviteRooms[roomId]) {\n this.inviteRooms[roomId] = {\n invite_state: data.invite_state,\n };\n return;\n }\n // accumulate extra keys for invite->invite transitions\n // clobber based on event type / state key\n // We expect invite_state to be small, so just loop over the events\n const currentData = this.inviteRooms[roomId];\n data.invite_state.events.forEach((e) => {\n let hasAdded = false;\n for (let i = 0; i < currentData.invite_state.events.length; i++) {\n const current = currentData.invite_state.events[i];\n if (current.type === e.type && current.state_key == e.state_key) {\n currentData.invite_state.events[i] = e; // update\n hasAdded = true;\n }\n }\n if (!hasAdded) {\n currentData.invite_state.events.push(e);\n }\n });\n }\n\n private accumulateKnockState(roomId: string, data: IKnockedRoom): void {\n if (!data.knock_state || !data.knock_state.events) {\n // no new data\n return;\n }\n if (!this.knockRooms[roomId]) {\n this.knockRooms[roomId] = {\n knock_state: data.knock_state,\n };\n return;\n }\n // accumulate extra keys\n // clobber based on event type / state key\n // We expect knock_state to be small, so just loop over the events\n const currentData = this.knockRooms[roomId];\n data.knock_state.events.forEach((e) => {\n let hasAdded = false;\n for (let i = 0; i < currentData.knock_state.events.length; i++) {\n const current = currentData.knock_state.events[i];\n if (current.type === e.type && current.state_key == e.state_key) {\n currentData.knock_state.events[i] = e; // update\n hasAdded = true;\n }\n }\n if (!hasAdded) {\n currentData.knock_state.events.push(e);\n }\n });\n }\n\n // Accumulate timeline and state events in a room.\n private accumulateJoinState(roomId: string, data: IJoinedRoom, fromDatabase = false): void {\n // We expect this function to be called a lot (every /sync) so we want\n // this to be fast. /sync stores events in an array but we often want\n // to clobber based on type/state_key. Rather than convert arrays to\n // maps all the time, just keep private maps which contain\n // the actual current accumulated sync state, and array-ify it when\n // getJSON() is called.\n\n // State resolution:\n // The 'state' key is the delta from the previous sync (or start of time\n // if no token was supplied), to the START of the timeline. To obtain\n // the current state, we need to \"roll forward\" state by reading the\n // timeline. We want to store the current state so we can drop events\n // out the end of the timeline based on opts.maxTimelineEntries.\n //\n // 'state' 'timeline' current state\n // |-------x<======================>x\n // T I M E\n //\n // When getJSON() is called, we 'roll back' the current state by the\n // number of entries in the timeline to work out what 'state' should be.\n\n // Back-pagination:\n // On an initial /sync, the server provides a back-pagination token for\n // the start of the timeline. When /sync deltas come down, they also\n // include back-pagination tokens for the start of the timeline. This\n // means not all events in the timeline have back-pagination tokens, as\n // it is only the ones at the START of the timeline which have them.\n // In order for us to have a valid timeline (and back-pagination token\n // to match), we need to make sure that when we remove old timeline\n // events, that we roll forward to an event which has a back-pagination\n // token. This means we can't keep a strict sliding-window based on\n // opts.maxTimelineEntries, and we may have a few less. We should never\n // have more though, provided that the /sync limit is less than or equal\n // to opts.maxTimelineEntries.\n\n if (!this.joinRooms[roomId]) {\n // Create truly empty objects so event types of 'hasOwnProperty' and co\n // don't cause this code to break.\n this.joinRooms[roomId] = {\n _currentState: Object.create(null),\n _timeline: [],\n _accountData: Object.create(null),\n _unreadNotifications: {},\n _unreadThreadNotifications: {},\n _summary: {},\n _receipts: new ReceiptAccumulator(),\n };\n }\n const currentData = this.joinRooms[roomId];\n\n if (data.account_data && data.account_data.events) {\n // clobber based on type\n data.account_data.events.forEach((e) => {\n currentData._accountData[e.type] = e;\n });\n }\n\n // these probably clobber, spec is unclear.\n if (data.unread_notifications) {\n currentData._unreadNotifications = data.unread_notifications;\n }\n currentData._unreadThreadNotifications =\n data[UNREAD_THREAD_NOTIFICATIONS.stable!] ?? data[UNREAD_THREAD_NOTIFICATIONS.unstable!] ?? undefined;\n\n if (data.summary) {\n const HEROES_KEY = \"m.heroes\";\n const INVITED_COUNT_KEY = \"m.invited_member_count\";\n const JOINED_COUNT_KEY = \"m.joined_member_count\";\n\n const acc = currentData._summary;\n const sum = data.summary;\n acc[HEROES_KEY] = sum[HEROES_KEY] ?? acc[HEROES_KEY];\n acc[JOINED_COUNT_KEY] = sum[JOINED_COUNT_KEY] ?? acc[JOINED_COUNT_KEY];\n acc[INVITED_COUNT_KEY] = sum[INVITED_COUNT_KEY] ?? acc[INVITED_COUNT_KEY];\n }\n\n // We purposefully do not persist m.typing events.\n // Technically you could refresh a browser before the timer on a\n // typing event is up, so it'll look like you aren't typing when\n // you really still are. However, the alternative is worse. If\n // we do persist typing events, it will look like people are\n // typing forever until someone really does start typing (which\n // will prompt Synapse to send down an actual m.typing event to\n // clobber the one we persisted).\n\n // Persist the receipts\n currentData._receipts.consumeEphemeralEvents(data.ephemeral?.events);\n\n // if we got a limited sync, we need to remove all timeline entries or else\n // we will have gaps in the timeline.\n if (data.timeline && data.timeline.limited) {\n currentData._timeline = [];\n }\n\n // Work out the current state. The deltas need to be applied in the order:\n // - existing state which didn't come down /sync.\n // - State events under the 'state' key.\n // - State events in the 'timeline'.\n data.state?.events?.forEach((e) => {\n setState(currentData._currentState, e);\n });\n data.timeline?.events?.forEach((e, index) => {\n // this nops if 'e' isn't a state event\n setState(currentData._currentState, e);\n // append the event to the timeline. The back-pagination token\n // corresponds to the first event in the timeline\n let transformedEvent: TaggedEvent;\n if (!fromDatabase) {\n transformedEvent = Object.assign({}, e);\n if (transformedEvent.unsigned !== undefined) {\n transformedEvent.unsigned = Object.assign({}, transformedEvent.unsigned);\n }\n const age = e.unsigned?.age;\n if (age !== undefined) transformedEvent._localTs = Date.now() - age;\n } else {\n transformedEvent = e;\n }\n\n currentData._timeline.push({\n event: transformedEvent,\n token: index === 0 ? (data.timeline.prev_batch ?? null) : null,\n });\n });\n\n // attempt to prune the timeline by jumping between events which have\n // pagination tokens.\n if (currentData._timeline.length > this.opts.maxTimelineEntries!) {\n const startIndex = currentData._timeline.length - this.opts.maxTimelineEntries!;\n for (let i = startIndex; i < currentData._timeline.length; i++) {\n if (currentData._timeline[i].token) {\n // keep all events after this, including this one\n currentData._timeline = currentData._timeline.slice(i, currentData._timeline.length);\n break;\n }\n }\n }\n }\n\n /**\n * Return everything under the 'rooms' key from a /sync response which\n * represents all room data that should be stored. This should be paired\n * with the sync token which represents the most recent /sync response\n * provided to accumulate().\n * @param forDatabase - True to generate a sync to be saved to storage\n * @returns An object with a \"nextBatch\", \"roomsData\" and \"accountData\"\n * keys.\n * The \"nextBatch\" key is a string which represents at what point in the\n * /sync stream the accumulator reached. This token should be used when\n * restarting a /sync stream at startup. Failure to do so can lead to missing\n * events. The \"roomsData\" key is an Object which represents the entire\n * /sync response from the 'rooms' key onwards. The \"accountData\" key is\n * a list of raw events which represent global account data.\n */\n public getJSON(forDatabase = false): ISyncData {\n const data: IRooms = {\n join: {},\n invite: {},\n knock: {},\n // always empty. This is set by /sync when a room was previously\n // in 'invite' or 'join'. On fresh startup, the client won't know\n // about any previous room being in 'invite' or 'join' so we can\n // just omit mentioning it at all, even if it has previously come\n // down /sync.\n // The notable exception is when a client is kicked or banned:\n // we may want to hold onto that room so the client can clearly see\n // why their room has disappeared. We don't persist it though because\n // it is unclear *when* we can safely remove the room from the DB.\n // Instead, we assume that if you're loading from the DB, you've\n // refreshed the page, which means you've seen the kick/ban already.\n leave: {},\n };\n Object.keys(this.inviteRooms).forEach((roomId) => {\n data.invite[roomId] = this.inviteRooms[roomId];\n });\n Object.keys(this.knockRooms).forEach((roomId) => {\n data.knock[roomId] = this.knockRooms[roomId];\n });\n Object.keys(this.joinRooms).forEach((roomId) => {\n const roomData = this.joinRooms[roomId];\n const roomJson: IJoinedRoom = {\n ephemeral: { events: [] },\n account_data: { events: [] },\n state: { events: [] },\n timeline: {\n events: [],\n prev_batch: null,\n },\n unread_notifications: roomData._unreadNotifications,\n unread_thread_notifications: roomData._unreadThreadNotifications,\n summary: roomData._summary as IRoomSummary,\n };\n // Add account data\n Object.keys(roomData._accountData).forEach((evType) => {\n roomJson.account_data.events.push(roomData._accountData[evType]);\n });\n\n const receiptEvent = roomData._receipts.buildAccumulatedReceiptEvent(roomId);\n\n // add only if we have some receipt data\n if (receiptEvent) {\n roomJson.ephemeral.events.push(receiptEvent);\n }\n\n // Add timeline data\n roomData._timeline.forEach((msgData) => {\n if (!roomJson.timeline.prev_batch) {\n // the first event we add to the timeline MUST match up to\n // the prev_batch token.\n if (!msgData.token) {\n return; // this shouldn't happen as we prune constantly.\n }\n roomJson.timeline.prev_batch = msgData.token;\n }\n\n let transformedEvent: (IRoomEvent | IStateEvent) & { _localTs?: number };\n if (!forDatabase && isTaggedEvent(msgData.event)) {\n // This means we have to copy each event, so we can fix it up to\n // set a correct 'age' parameter whilst keeping the local timestamp\n // on our stored event. If this turns out to be a bottleneck, it could\n // be optimised either by doing this in the main process after the data\n // has been structured-cloned to go between the worker & main process,\n // or special-casing data from saved syncs to read the local timestamp\n // directly rather than turning it into age to then immediately be\n // transformed back again into a local timestamp.\n transformedEvent = Object.assign({}, msgData.event);\n if (transformedEvent.unsigned !== undefined) {\n transformedEvent.unsigned = Object.assign({}, transformedEvent.unsigned);\n }\n delete transformedEvent._localTs;\n transformedEvent.unsigned = transformedEvent.unsigned || {};\n transformedEvent.unsigned.age = Date.now() - msgData.event._localTs!;\n } else {\n transformedEvent = msgData.event;\n }\n roomJson.timeline.events.push(transformedEvent);\n });\n\n // Add state data: roll back current state to the start of timeline,\n // by \"reverse clobbering\" from the end of the timeline to the start.\n // Convert maps back into arrays.\n const rollBackState = Object.create(null);\n for (let i = roomJson.timeline.events.length - 1; i >= 0; i--) {\n const timelineEvent = roomJson.timeline.events[i];\n if (\n (timelineEvent as IStateEvent).state_key === null ||\n (timelineEvent as IStateEvent).state_key === undefined\n ) {\n continue; // not a state event\n }\n // since we're going back in time, we need to use the previous\n // state value else we'll break causality. We don't have the\n // complete previous state event, so we need to create one.\n const prevStateEvent = deepCopy(timelineEvent);\n if (prevStateEvent.unsigned) {\n if (prevStateEvent.unsigned.prev_content) {\n prevStateEvent.content = prevStateEvent.unsigned.prev_content;\n }\n if (prevStateEvent.unsigned.prev_sender) {\n prevStateEvent.sender = prevStateEvent.unsigned.prev_sender;\n }\n }\n setState(rollBackState, prevStateEvent);\n }\n Object.keys(roomData._currentState).forEach((evType) => {\n Object.keys(roomData._currentState[evType]).forEach((stateKey) => {\n let ev = roomData._currentState[evType][stateKey];\n if (rollBackState[evType] && rollBackState[evType][stateKey]) {\n // use the reverse clobbered event instead.\n ev = rollBackState[evType][stateKey];\n }\n roomJson.state.events.push(ev);\n });\n });\n data.join[roomId] = roomJson;\n });\n\n // Add account data\n const accData: IMinimalEvent[] = [];\n Object.keys(this.accountData).forEach((evType) => {\n accData.push(this.accountData[evType]);\n });\n\n return {\n nextBatch: this.nextBatch!,\n roomsData: data,\n accountData: accData,\n };\n }\n\n public getNextBatchToken(): string {\n return this.nextBatch!;\n }\n}\n\nfunction setState(eventMap: Record<string, Record<string, IStateEvent>>, event: IRoomEvent | IStateEvent): void {\n if ((event as IStateEvent).state_key === null || (event as IStateEvent).state_key === undefined || !event.type) {\n return;\n }\n if (!eventMap[event.type]) {\n eventMap[event.type] = Object.create(null);\n }\n eventMap[event.type][(event as IStateEvent).state_key] = event as IStateEvent;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,SAASA,MAAM,QAAQ,aAAa;AACpC,SAASC,QAAQ,QAAQ,YAAY;AAIrC,SAASC,2BAA2B,QAAQ,kBAAkB;AAC9D,SAASC,kBAAkB,QAAQ,0BAA0B;;AAwB7D;;AA6GA;;AAEA,WAAYC,QAAQ,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;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,QAAQ,CAAC;UACxC;UACAb,QAAQ,CAACnB,KAAK,CAAChE,MAAM,CAACiC,IAAI,CAACgE,EAAE,CAAC;QAClC,CAAC,CAAC;MACN,CAAC,CAAC;MACF9E,IAAI,CAACP,IAAI,CAACH,MAAM,CAAC,GAAG0E,QAAQ;IAChC,CAAC,CAAC;;IAEF;IACA,IAAMe,OAAwB,GAAG,EAAE;IACnC3F,MAAM,CAACC,IAAI,CAAC,IAAI,CAACL,WAAW,CAAC,CAACF,OAAO,CAAEoF,MAAM,IAAK;MAC9Ca,OAAO,CAACjE,IAAI,CAAC,IAAI,CAAC9B,WAAW,CAACkF,MAAM,CAAC,CAAC;IAC1C,CAAC,CAAC;IAEF,OAAO;MACHxF,SAAS,EAAE,IAAI,CAACA,SAAU;MAC1BsG,SAAS,EAAEhF,IAAI;MACfhB,WAAW,EAAE+F;IACjB,CAAC;EACL;EAEOE,iBAAiBA,CAAA,EAAW;IAC/B,OAAO,IAAI,CAACvG,SAAS;EACzB;AACJ;AAEA,SAASoE,QAAQA,CAACoC,QAAqD,EAAEtH,KAA+B,EAAQ;EAC5G,IAAKA,KAAK,CAAiBiD,SAAS,KAAK,IAAI,IAAKjD,KAAK,CAAiBiD,SAAS,KAAKhD,SAAS,IAAI,CAACD,KAAK,CAACqB,IAAI,EAAE;IAC5G;EACJ;EACA,IAAI,CAACiG,QAAQ,CAACtH,KAAK,CAACqB,IAAI,CAAC,EAAE;IACvBiG,QAAQ,CAACtH,KAAK,CAACqB,IAAI,CAAC,GAAGG,MAAM,CAACkC,MAAM,CAAC,IAAI,CAAC;EAC9C;EACA4D,QAAQ,CAACtH,KAAK,CAACqB,IAAI,CAAC,CAAErB,KAAK,CAAiBiD,SAAS,CAAC,GAAGjD,KAAoB;AACjF","ignoreList":[]}
1
+ {"version":3,"file":"sync-accumulator.js","names":["logger","deepCopy","UNREAD_THREAD_NOTIFICATIONS","ReceiptAccumulator","Category","isTaggedEvent","event","undefined","SyncAccumulator","constructor","opts","arguments","length","_defineProperty","maxTimelineEntries","accumulate","syncResponse","fromDatabase","accumulateRooms","accumulateAccountData","nextBatch","next_batch","account_data","events","forEach","e","accountData","type","rooms","invite","Object","keys","roomId","accumulateRoom","Invite","join","Join","leave","Leave","knock","Knock","category","data","knockRooms","accumulateInviteState","accumulateKnockState","inviteRooms","accumulateJoinState","joinRooms","error","invite_state","currentData","hasAdded","i","current","state_key","push","knock_state","_ref","_data","_data$ephemeral","_data$state","_data$orgMatrixMsc","_data$timeline","_currentState","create","_timeline","_accountData","_unreadNotifications","_unreadThreadNotifications","_summary","_receipts","unread_notifications","stable","unstable","summary","_sum$HEROES_KEY","_sum$JOINED_COUNT_KEY","_sum$INVITED_COUNT_KE","HEROES_KEY","INVITED_COUNT_KEY","JOINED_COUNT_KEY","acc","sum","consumeEphemeralEvents","ephemeral","timeline","limited","state","setState","index","_data$timeline$prev_b","transformedEvent","_e$unsigned","assign","unsigned","age","_localTs","Date","now","token","prev_batch","startIndex","slice","getJSON","forDatabase","roomData","roomJson","evType","receiptEvent","buildAccumulatedReceiptEvent","msgData","rollBackState","timelineEvent","prevStateEvent","prev_content","content","prev_sender","sender","stateKey","ev","accData","roomsData","getNextBatchToken","eventMap"],"sources":["../src/sync-accumulator.ts"],"sourcesContent":["/*\nCopyright 2017 - 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\n/**\n * This is an internal module. See {@link SyncAccumulator} for the public class.\n */\n\nimport { logger } from \"./logger.ts\";\nimport { deepCopy } from \"./utils.ts\";\nimport { IContent, IUnsigned } from \"./models/event.ts\";\nimport { IRoomSummary } from \"./models/room-summary.ts\";\nimport { EventType } from \"./@types/event.ts\";\nimport { UNREAD_THREAD_NOTIFICATIONS } from \"./@types/sync.ts\";\nimport { ReceiptAccumulator } from \"./receipt-accumulator.ts\";\n\ninterface IOpts {\n /**\n * The ideal maximum number of timeline entries to keep in the sync response.\n * This is best-effort, as clients do not always have a back-pagination token for each event,\n * so it's possible there may be slightly *less* than this value. There will never be more.\n * This cannot be 0 or else it makes it impossible to scroll back in a room.\n * Default: 50.\n */\n maxTimelineEntries?: number;\n}\n\nexport interface IMinimalEvent {\n content: IContent;\n type: EventType | string;\n room_id?: string;\n unsigned?: IUnsigned;\n}\n\nexport interface IEphemeral {\n events: IMinimalEvent[];\n}\n\n/* eslint-disable camelcase */\ninterface UnreadNotificationCounts {\n highlight_count?: number;\n notification_count?: number;\n}\n\nexport interface IRoomEvent extends IMinimalEvent {\n event_id: string;\n sender: string;\n origin_server_ts: number;\n}\n\nexport interface IStateEvent extends IRoomEvent {\n prev_content?: IContent;\n state_key: string;\n}\n\ninterface IState {\n events: IStateEvent[];\n}\n\nexport interface ITimeline {\n events: Array<IRoomEvent | IStateEvent>;\n limited?: boolean;\n prev_batch: string | null;\n}\n\nexport interface IJoinedRoom {\n \"summary\": IRoomSummary;\n // One of `state` or `state_after` is required.\n \"state\"?: IState;\n \"org.matrix.msc4222.state_after\"?: IState; // https://github.com/matrix-org/matrix-spec-proposals/pull/4222\n \"timeline\": ITimeline;\n \"ephemeral\": IEphemeral;\n \"account_data\": IAccountData;\n \"unread_notifications\": UnreadNotificationCounts;\n \"unread_thread_notifications\"?: Record<string, UnreadNotificationCounts>;\n \"org.matrix.msc3773.unread_thread_notifications\"?: Record<string, UnreadNotificationCounts>;\n}\n\nexport interface IStrippedState {\n content: IContent;\n state_key: string;\n type: EventType | string;\n sender: string;\n}\n\nexport interface IInviteState {\n events: IStrippedState[];\n}\n\nexport interface IKnockState {\n events: IStrippedState[];\n}\n\nexport interface IInvitedRoom {\n invite_state: IInviteState;\n}\n\nexport interface ILeftRoom {\n // One of `state` or `state_after` is required.\n \"state\"?: IState;\n \"org.matrix.msc4222.state_after\"?: IState;\n \"timeline\": ITimeline;\n \"account_data\": IAccountData;\n}\n\nexport interface IKnockedRoom {\n knock_state: IKnockState;\n}\n\nexport interface IRooms {\n [Category.Join]: Record<string, IJoinedRoom>;\n [Category.Invite]: Record<string, IInvitedRoom>;\n [Category.Leave]: Record<string, ILeftRoom>;\n [Category.Knock]: Record<string, IKnockedRoom>;\n}\n\ninterface IPresence {\n events: IMinimalEvent[];\n}\n\ninterface IAccountData {\n events: IMinimalEvent[];\n}\n\nexport interface IToDeviceEvent {\n content: IContent;\n sender: string;\n type: string;\n}\n\ninterface IToDevice {\n events: IToDeviceEvent[];\n}\n\nexport interface IDeviceLists {\n changed?: string[];\n left?: string[];\n}\n\nexport interface ISyncResponse {\n \"next_batch\": string;\n \"rooms\": IRooms;\n \"presence\"?: IPresence;\n \"account_data\": IAccountData;\n \"to_device\"?: IToDevice;\n \"device_lists\"?: IDeviceLists;\n \"device_one_time_keys_count\"?: Record<string, number>;\n\n \"device_unused_fallback_key_types\"?: string[];\n \"org.matrix.msc2732.device_unused_fallback_key_types\"?: string[];\n}\n/* eslint-enable camelcase */\n\nexport enum Category {\n Invite = \"invite\",\n Leave = \"leave\",\n Join = \"join\",\n Knock = \"knock\",\n}\n\ninterface IRoom {\n _currentState: { [eventType: string]: { [stateKey: string]: IStateEvent } };\n _timeline: {\n event: IRoomEvent | IStateEvent;\n token: string | null;\n }[];\n _summary: Partial<IRoomSummary>;\n _accountData: { [eventType: string]: IMinimalEvent };\n _unreadNotifications: Partial<UnreadNotificationCounts>;\n _unreadThreadNotifications?: Record<string, Partial<UnreadNotificationCounts>>;\n _receipts: ReceiptAccumulator;\n}\n\nexport interface ISyncData {\n nextBatch: string;\n accountData: IMinimalEvent[];\n roomsData: IRooms;\n}\n\ntype TaggedEvent = IRoomEvent & { _localTs?: number };\n\nfunction isTaggedEvent(event: IRoomEvent): event is TaggedEvent {\n return \"_localTs\" in event && event[\"_localTs\"] !== undefined;\n}\n\n/**\n * The purpose of this class is to accumulate /sync responses such that a\n * complete \"initial\" JSON response can be returned which accurately represents\n * the sum total of the /sync responses accumulated to date. It only handles\n * room data: that is, everything under the \"rooms\" top-level key.\n *\n * This class is used when persisting room data so a complete /sync response can\n * be loaded from disk and incremental syncs can be performed on the server,\n * rather than asking the server to do an initial sync on startup.\n */\nexport class SyncAccumulator {\n private accountData: Record<string, IMinimalEvent> = {}; // $event_type: Object\n private inviteRooms: Record<string, IInvitedRoom> = {}; // $roomId: { ... sync 'invite' json data ... }\n private knockRooms: Record<string, IKnockedRoom> = {}; // $roomId: { ... sync 'knock' json data ... }\n private joinRooms: { [roomId: string]: IRoom } = {};\n // the /sync token which corresponds to the last time rooms were\n // accumulated. We remember this so that any caller can obtain a\n // coherent /sync response and know at what point they should be\n // streaming from without losing events.\n private nextBatch: string | null = null;\n\n public constructor(private readonly opts: IOpts = {}) {\n this.opts.maxTimelineEntries = this.opts.maxTimelineEntries || 50;\n }\n\n public accumulate(syncResponse: ISyncResponse, fromDatabase = false): void {\n this.accumulateRooms(syncResponse, fromDatabase);\n this.accumulateAccountData(syncResponse);\n this.nextBatch = syncResponse.next_batch;\n }\n\n private accumulateAccountData(syncResponse: ISyncResponse): void {\n if (!syncResponse.account_data || !syncResponse.account_data.events) {\n return;\n }\n // Clobbers based on event type.\n syncResponse.account_data.events.forEach((e) => {\n this.accountData[e.type] = e;\n });\n }\n\n /**\n * Accumulate incremental /sync room data.\n * @param syncResponse - the complete /sync JSON\n * @param fromDatabase - True if the sync response is one saved to the database\n */\n private accumulateRooms(syncResponse: ISyncResponse, fromDatabase = false): void {\n if (!syncResponse.rooms) {\n return;\n }\n if (syncResponse.rooms.invite) {\n Object.keys(syncResponse.rooms.invite).forEach((roomId) => {\n this.accumulateRoom(roomId, Category.Invite, syncResponse.rooms.invite[roomId], fromDatabase);\n });\n }\n if (syncResponse.rooms.join) {\n Object.keys(syncResponse.rooms.join).forEach((roomId) => {\n this.accumulateRoom(roomId, Category.Join, syncResponse.rooms.join[roomId], fromDatabase);\n });\n }\n if (syncResponse.rooms.leave) {\n Object.keys(syncResponse.rooms.leave).forEach((roomId) => {\n this.accumulateRoom(roomId, Category.Leave, syncResponse.rooms.leave[roomId], fromDatabase);\n });\n }\n if (syncResponse.rooms.knock) {\n Object.keys(syncResponse.rooms.knock).forEach((roomId) => {\n this.accumulateRoom(roomId, Category.Knock, syncResponse.rooms.knock[roomId], fromDatabase);\n });\n }\n }\n\n private accumulateRoom(roomId: string, category: Category.Invite, data: IInvitedRoom, fromDatabase: boolean): void;\n private accumulateRoom(roomId: string, category: Category.Join, data: IJoinedRoom, fromDatabase: boolean): void;\n private accumulateRoom(roomId: string, category: Category.Leave, data: ILeftRoom, fromDatabase: boolean): void;\n private accumulateRoom(roomId: string, category: Category.Knock, data: IKnockedRoom, fromDatabase: boolean): void;\n private accumulateRoom(roomId: string, category: Category, data: any, fromDatabase = false): void {\n // Valid /sync state transitions\n // +--------+ <======+ 1: Accept an invite\n // +== | INVITE | | (5) 2: Leave a room\n // | +--------+ =====+ | 3: Join a public room previously\n // |(1) (4) | | left (handle as if new room)\n // V (2) V | 4: Reject an invite\n // +------+ ========> +--------+ 5: Invite to a room previously\n // | JOIN | (3) | LEAVE* | left (handle as if new room)\n // +------+ <======== +--------+\n //\n // * equivalent to \"no state\"\n switch (category) {\n case Category.Invite: // (5)\n if (this.knockRooms[roomId]) {\n // was previously knock, now invite, need to delete knock state\n delete this.knockRooms[roomId];\n }\n this.accumulateInviteState(roomId, data as IInvitedRoom);\n break;\n\n case Category.Knock:\n this.accumulateKnockState(roomId, data as IKnockedRoom);\n break;\n\n case Category.Join:\n if (this.inviteRooms[roomId]) {\n // (1)\n // was previously invite, now join. We expect /sync to give\n // the entire state and timeline on 'join', so delete previous\n // invite state\n delete this.inviteRooms[roomId];\n }\n // (3)\n this.accumulateJoinState(roomId, data as IJoinedRoom, fromDatabase);\n break;\n\n case Category.Leave:\n if (this.knockRooms[roomId]) {\n // delete knock state on leave\n delete this.knockRooms[roomId];\n } else if (this.inviteRooms[roomId]) {\n // (4)\n delete this.inviteRooms[roomId];\n } else {\n // (2)\n delete this.joinRooms[roomId];\n }\n break;\n\n default:\n logger.error(\"Unknown cateogory: \", category);\n }\n }\n\n private accumulateInviteState(roomId: string, data: IInvitedRoom): void {\n if (!data.invite_state || !data.invite_state.events) {\n // no new data\n return;\n }\n if (!this.inviteRooms[roomId]) {\n this.inviteRooms[roomId] = {\n invite_state: data.invite_state,\n };\n return;\n }\n // accumulate extra keys for invite->invite transitions\n // clobber based on event type / state key\n // We expect invite_state to be small, so just loop over the events\n const currentData = this.inviteRooms[roomId];\n data.invite_state.events.forEach((e) => {\n let hasAdded = false;\n for (let i = 0; i < currentData.invite_state.events.length; i++) {\n const current = currentData.invite_state.events[i];\n if (current.type === e.type && current.state_key == e.state_key) {\n currentData.invite_state.events[i] = e; // update\n hasAdded = true;\n }\n }\n if (!hasAdded) {\n currentData.invite_state.events.push(e);\n }\n });\n }\n\n private accumulateKnockState(roomId: string, data: IKnockedRoom): void {\n if (!data.knock_state || !data.knock_state.events) {\n // no new data\n return;\n }\n if (!this.knockRooms[roomId]) {\n this.knockRooms[roomId] = {\n knock_state: data.knock_state,\n };\n return;\n }\n // accumulate extra keys\n // clobber based on event type / state key\n // We expect knock_state to be small, so just loop over the events\n const currentData = this.knockRooms[roomId];\n data.knock_state.events.forEach((e) => {\n let hasAdded = false;\n for (let i = 0; i < currentData.knock_state.events.length; i++) {\n const current = currentData.knock_state.events[i];\n if (current.type === e.type && current.state_key == e.state_key) {\n currentData.knock_state.events[i] = e; // update\n hasAdded = true;\n }\n }\n if (!hasAdded) {\n currentData.knock_state.events.push(e);\n }\n });\n }\n\n // Accumulate timeline and state events in a room.\n private accumulateJoinState(roomId: string, data: IJoinedRoom, fromDatabase = false): void {\n // We expect this function to be called a lot (every /sync) so we want\n // this to be fast. /sync stores events in an array but we often want\n // to clobber based on type/state_key. Rather than convert arrays to\n // maps all the time, just keep private maps which contain\n // the actual current accumulated sync state, and array-ify it when\n // getJSON() is called.\n\n // State resolution:\n // The 'state' key is the delta from the previous sync (or start of time\n // if no token was supplied), to the START of the timeline. To obtain\n // the current state, we need to \"roll forward\" state by reading the\n // timeline. We want to store the current state so we can drop events\n // out the end of the timeline based on opts.maxTimelineEntries.\n //\n // 'state' 'timeline' current state\n // |-------x<======================>x\n // T I M E\n //\n // When getJSON() is called, we 'roll back' the current state by the\n // number of entries in the timeline to work out what 'state' should be.\n\n // Back-pagination:\n // On an initial /sync, the server provides a back-pagination token for\n // the start of the timeline. When /sync deltas come down, they also\n // include back-pagination tokens for the start of the timeline. This\n // means not all events in the timeline have back-pagination tokens, as\n // it is only the ones at the START of the timeline which have them.\n // In order for us to have a valid timeline (and back-pagination token\n // to match), we need to make sure that when we remove old timeline\n // events, that we roll forward to an event which has a back-pagination\n // token. This means we can't keep a strict sliding-window based on\n // opts.maxTimelineEntries, and we may have a few less. We should never\n // have more though, provided that the /sync limit is less than or equal\n // to opts.maxTimelineEntries.\n\n if (!this.joinRooms[roomId]) {\n // Create truly empty objects so event types of 'hasOwnProperty' and co\n // don't cause this code to break.\n this.joinRooms[roomId] = {\n _currentState: Object.create(null),\n _timeline: [],\n _accountData: Object.create(null),\n _unreadNotifications: {},\n _unreadThreadNotifications: {},\n _summary: {},\n _receipts: new ReceiptAccumulator(),\n };\n }\n const currentData = this.joinRooms[roomId];\n\n if (data.account_data && data.account_data.events) {\n // clobber based on type\n data.account_data.events.forEach((e) => {\n currentData._accountData[e.type] = e;\n });\n }\n\n // these probably clobber, spec is unclear.\n if (data.unread_notifications) {\n currentData._unreadNotifications = data.unread_notifications;\n }\n currentData._unreadThreadNotifications =\n data[UNREAD_THREAD_NOTIFICATIONS.stable!] ?? data[UNREAD_THREAD_NOTIFICATIONS.unstable!] ?? undefined;\n\n if (data.summary) {\n const HEROES_KEY = \"m.heroes\";\n const INVITED_COUNT_KEY = \"m.invited_member_count\";\n const JOINED_COUNT_KEY = \"m.joined_member_count\";\n\n const acc = currentData._summary;\n const sum = data.summary;\n acc[HEROES_KEY] = sum[HEROES_KEY] ?? acc[HEROES_KEY];\n acc[JOINED_COUNT_KEY] = sum[JOINED_COUNT_KEY] ?? acc[JOINED_COUNT_KEY];\n acc[INVITED_COUNT_KEY] = sum[INVITED_COUNT_KEY] ?? acc[INVITED_COUNT_KEY];\n }\n\n // We purposefully do not persist m.typing events.\n // Technically you could refresh a browser before the timer on a\n // typing event is up, so it'll look like you aren't typing when\n // you really still are. However, the alternative is worse. If\n // we do persist typing events, it will look like people are\n // typing forever until someone really does start typing (which\n // will prompt Synapse to send down an actual m.typing event to\n // clobber the one we persisted).\n\n // Persist the receipts\n currentData._receipts.consumeEphemeralEvents(data.ephemeral?.events);\n\n // if we got a limited sync, we need to remove all timeline entries or else\n // we will have gaps in the timeline.\n if (data.timeline && data.timeline.limited) {\n currentData._timeline = [];\n }\n\n // Work out the current state. The deltas need to be applied in the order:\n // - existing state which didn't come down /sync.\n // - State events under the 'state' key.\n // - State events under the 'state_after' key OR state events in the 'timeline' if 'state_after' is not present.\n data.state?.events?.forEach((e) => {\n setState(currentData._currentState, e);\n });\n data[\"org.matrix.msc4222.state_after\"]?.events?.forEach((e) => {\n setState(currentData._currentState, e);\n });\n data.timeline?.events?.forEach((e, index) => {\n if (!data[\"org.matrix.msc4222.state_after\"]) {\n // this nops if 'e' isn't a state event\n setState(currentData._currentState, e);\n }\n // append the event to the timeline. The back-pagination token\n // corresponds to the first event in the timeline\n let transformedEvent: TaggedEvent;\n if (!fromDatabase) {\n transformedEvent = Object.assign({}, e);\n if (transformedEvent.unsigned !== undefined) {\n transformedEvent.unsigned = Object.assign({}, transformedEvent.unsigned);\n }\n const age = e.unsigned?.age;\n if (age !== undefined) transformedEvent._localTs = Date.now() - age;\n } else {\n transformedEvent = e;\n }\n\n currentData._timeline.push({\n event: transformedEvent,\n token: index === 0 ? (data.timeline.prev_batch ?? null) : null,\n });\n });\n\n // attempt to prune the timeline by jumping between events which have\n // pagination tokens.\n if (currentData._timeline.length > this.opts.maxTimelineEntries!) {\n const startIndex = currentData._timeline.length - this.opts.maxTimelineEntries!;\n for (let i = startIndex; i < currentData._timeline.length; i++) {\n if (currentData._timeline[i].token) {\n // keep all events after this, including this one\n currentData._timeline = currentData._timeline.slice(i, currentData._timeline.length);\n break;\n }\n }\n }\n }\n\n /**\n * Return everything under the 'rooms' key from a /sync response which\n * represents all room data that should be stored. This should be paired\n * with the sync token which represents the most recent /sync response\n * provided to accumulate().\n * @param forDatabase - True to generate a sync to be saved to storage\n * @returns An object with a \"nextBatch\", \"roomsData\" and \"accountData\"\n * keys.\n * The \"nextBatch\" key is a string which represents at what point in the\n * /sync stream the accumulator reached. This token should be used when\n * restarting a /sync stream at startup. Failure to do so can lead to missing\n * events. The \"roomsData\" key is an Object which represents the entire\n * /sync response from the 'rooms' key onwards. The \"accountData\" key is\n * a list of raw events which represent global account data.\n */\n public getJSON(forDatabase = false): ISyncData {\n const data: IRooms = {\n join: {},\n invite: {},\n knock: {},\n // always empty. This is set by /sync when a room was previously\n // in 'invite' or 'join'. On fresh startup, the client won't know\n // about any previous room being in 'invite' or 'join' so we can\n // just omit mentioning it at all, even if it has previously come\n // down /sync.\n // The notable exception is when a client is kicked or banned:\n // we may want to hold onto that room so the client can clearly see\n // why their room has disappeared. We don't persist it though because\n // it is unclear *when* we can safely remove the room from the DB.\n // Instead, we assume that if you're loading from the DB, you've\n // refreshed the page, which means you've seen the kick/ban already.\n leave: {},\n };\n Object.keys(this.inviteRooms).forEach((roomId) => {\n data.invite[roomId] = this.inviteRooms[roomId];\n });\n Object.keys(this.knockRooms).forEach((roomId) => {\n data.knock[roomId] = this.knockRooms[roomId];\n });\n Object.keys(this.joinRooms).forEach((roomId) => {\n const roomData = this.joinRooms[roomId];\n const roomJson: IJoinedRoom & {\n // We track both `state` and `state_after` for downgrade compatibility\n \"state\": IState;\n \"org.matrix.msc4222.state_after\": IState;\n } = {\n \"ephemeral\": { events: [] },\n \"account_data\": { events: [] },\n \"state\": { events: [] },\n \"org.matrix.msc4222.state_after\": { events: [] },\n \"timeline\": {\n events: [],\n prev_batch: null,\n },\n \"unread_notifications\": roomData._unreadNotifications,\n \"unread_thread_notifications\": roomData._unreadThreadNotifications,\n \"summary\": roomData._summary as IRoomSummary,\n };\n // Add account data\n Object.keys(roomData._accountData).forEach((evType) => {\n roomJson.account_data.events.push(roomData._accountData[evType]);\n });\n\n const receiptEvent = roomData._receipts.buildAccumulatedReceiptEvent(roomId);\n\n // add only if we have some receipt data\n if (receiptEvent) {\n roomJson.ephemeral.events.push(receiptEvent);\n }\n\n // Add timeline data\n roomData._timeline.forEach((msgData) => {\n if (!roomJson.timeline.prev_batch) {\n // the first event we add to the timeline MUST match up to\n // the prev_batch token.\n if (!msgData.token) {\n return; // this shouldn't happen as we prune constantly.\n }\n roomJson.timeline.prev_batch = msgData.token;\n }\n\n let transformedEvent: (IRoomEvent | IStateEvent) & { _localTs?: number };\n if (!forDatabase && isTaggedEvent(msgData.event)) {\n // This means we have to copy each event, so we can fix it up to\n // set a correct 'age' parameter whilst keeping the local timestamp\n // on our stored event. If this turns out to be a bottleneck, it could\n // be optimised either by doing this in the main process after the data\n // has been structured-cloned to go between the worker & main process,\n // or special-casing data from saved syncs to read the local timestamp\n // directly rather than turning it into age to then immediately be\n // transformed back again into a local timestamp.\n transformedEvent = Object.assign({}, msgData.event);\n if (transformedEvent.unsigned !== undefined) {\n transformedEvent.unsigned = Object.assign({}, transformedEvent.unsigned);\n }\n delete transformedEvent._localTs;\n transformedEvent.unsigned = transformedEvent.unsigned || {};\n transformedEvent.unsigned.age = Date.now() - msgData.event._localTs!;\n } else {\n transformedEvent = msgData.event;\n }\n roomJson.timeline.events.push(transformedEvent);\n });\n\n // Add state data: roll back current state to the start of timeline,\n // by \"reverse clobbering\" from the end of the timeline to the start.\n // Convert maps back into arrays.\n const rollBackState = Object.create(null);\n for (let i = roomJson.timeline.events.length - 1; i >= 0; i--) {\n const timelineEvent = roomJson.timeline.events[i];\n if (\n (timelineEvent as IStateEvent).state_key === null ||\n (timelineEvent as IStateEvent).state_key === undefined\n ) {\n continue; // not a state event\n }\n // since we're going back in time, we need to use the previous\n // state value else we'll break causality. We don't have the\n // complete previous state event, so we need to create one.\n const prevStateEvent = deepCopy(timelineEvent);\n if (prevStateEvent.unsigned) {\n if (prevStateEvent.unsigned.prev_content) {\n prevStateEvent.content = prevStateEvent.unsigned.prev_content;\n }\n if (prevStateEvent.unsigned.prev_sender) {\n prevStateEvent.sender = prevStateEvent.unsigned.prev_sender;\n }\n }\n setState(rollBackState, prevStateEvent);\n }\n Object.keys(roomData._currentState).forEach((evType) => {\n Object.keys(roomData._currentState[evType]).forEach((stateKey) => {\n let ev = roomData._currentState[evType][stateKey];\n // Push to both fields to provide downgrade compatibility in the sync accumulator db\n // the code will prefer `state_after` if it is present\n roomJson[\"org.matrix.msc4222.state_after\"].events.push(ev);\n // Roll the state back to the value at the start of the timeline if it was changed\n if (rollBackState[evType] && rollBackState[evType][stateKey]) {\n ev = rollBackState[evType][stateKey];\n }\n roomJson.state.events.push(ev);\n });\n });\n data.join[roomId] = roomJson;\n });\n\n // Add account data\n const accData: IMinimalEvent[] = [];\n Object.keys(this.accountData).forEach((evType) => {\n accData.push(this.accountData[evType]);\n });\n\n return {\n nextBatch: this.nextBatch!,\n roomsData: data,\n accountData: accData,\n };\n }\n\n public getNextBatchToken(): string {\n return this.nextBatch!;\n }\n}\n\nfunction setState(eventMap: Record<string, Record<string, IStateEvent>>, event: IRoomEvent | IStateEvent): void {\n if ((event as IStateEvent).state_key === null || (event as IStateEvent).state_key === undefined || !event.type) {\n return;\n }\n if (!eventMap[event.type]) {\n eventMap[event.type] = Object.create(null);\n }\n eventMap[event.type][(event as IStateEvent).state_key] = event as IStateEvent;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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BsG,SAAS,EAAEhF,IAAI;MACfhB,WAAW,EAAE+F;IACjB,CAAC;EACL;EAEOE,iBAAiBA,CAAA,EAAW;IAC/B,OAAO,IAAI,CAACvG,SAAS;EACzB;AACJ;AAEA,SAASqE,QAAQA,CAACmC,QAAqD,EAAEtH,KAA+B,EAAQ;EAC5G,IAAKA,KAAK,CAAiBiD,SAAS,KAAK,IAAI,IAAKjD,KAAK,CAAiBiD,SAAS,KAAKhD,SAAS,IAAI,CAACD,KAAK,CAACqB,IAAI,EAAE;IAC5G;EACJ;EACA,IAAI,CAACiG,QAAQ,CAACtH,KAAK,CAACqB,IAAI,CAAC,EAAE;IACvBiG,QAAQ,CAACtH,KAAK,CAACqB,IAAI,CAAC,GAAGG,MAAM,CAACmC,MAAM,CAAC,IAAI,CAAC;EAC9C;EACA2D,QAAQ,CAACtH,KAAK,CAACqB,IAAI,CAAC,CAAErB,KAAK,CAAiBiD,SAAS,CAAC,GAAGjD,KAAoB;AACjF","ignoreList":[]}
package/lib/sync.d.ts CHANGED
@@ -1,8 +1,6 @@
1
- import type { SyncCryptoCallbacks } from "./common-crypto/CryptoBackend.ts";
2
1
  import { Room } from "./models/room.ts";
3
2
  import { IStoredClientOpts, MatrixClient, ResetTimelineCallback } from "./client.ts";
4
3
  import { MatrixEvent } from "./models/event.ts";
5
- import { Crypto } from "./crypto/index.ts";
6
4
  export declare enum SyncState {
7
5
  /** Emitted after we try to sync more than `FAILED_SYNC_ERROR_THRESHOLD`
8
6
  * times and are still failing. Or when we enounter a hard error like the
@@ -26,16 +24,6 @@ export declare enum SyncState {
26
24
  * Options passed into the constructor of SyncApi by MatrixClient
27
25
  */
28
26
  export interface SyncApiOptions {
29
- /**
30
- * Crypto manager
31
- *
32
- * @deprecated in favour of cryptoCallbacks
33
- */
34
- crypto?: Crypto;
35
- /**
36
- * If crypto is enabled on our client, callbacks into the crypto module
37
- */
38
- cryptoCallbacks?: SyncCryptoCallbacks;
39
27
  /**
40
28
  * A function which is called
41
29
  * with a room ID and returns a boolean. It should return 'true' if the SDK can
@@ -223,15 +211,24 @@ export declare class SyncApi {
223
211
  private resolveInvites;
224
212
  private findEncryptionEvent;
225
213
  private isRoomEncrypted;
214
+ private mapAndInjectRoomEvents;
226
215
  /**
227
216
  * Injects events into a room's model.
228
217
  * @param stateEventList - A list of state events. This is the state
229
218
  * at the *START* of the timeline list if it is supplied.
219
+ * @param stateAfterEventList - A list of state events. This is the state
220
+ * at the *END* of the timeline list if it is supplied.
230
221
  * @param timelineEventList - A list of timeline events, including threaded. Lower index
231
222
  * is earlier in time. Higher index is later.
232
223
  * @param fromCache - whether the sync response came from cache
224
+ *
225
+ * No more than one of stateEventList and stateAfterEventList must be supplied. If
226
+ * stateEventList is supplied, the events in timelineEventList are added to the state
227
+ * after stateEventList. If stateAfterEventList is supplied, the events in timelineEventList
228
+ * are not added to the state.
233
229
  */
234
- injectRoomEvents(room: Room, stateEventList: MatrixEvent[], timelineEventList?: MatrixEvent[], fromCache?: boolean): Promise<void>;
230
+ injectRoomEvents(room: Room, stateEventList: MatrixEvent[], stateAfterEventList: undefined, timelineEventList?: MatrixEvent[], fromCache?: boolean): Promise<void>;
231
+ injectRoomEvents(room: Room, stateEventList: undefined, stateAfterEventList: MatrixEvent[], timelineEventList?: MatrixEvent[], fromCache?: boolean): Promise<void>;
235
232
  /**
236
233
  * Takes a list of timelineEvents and adds and adds to notifEvents
237
234
  * as appropriate.
package/lib/sync.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,OAAO,EAAyB,IAAI,EAAa,MAAM,kBAAkB,CAAC;AAK1E,OAAO,EAAe,iBAAiB,EAAE,YAAY,EAAwB,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAgBxH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;A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