@unwanted/matrix-sdk-mini 34.12.0 → 36.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (759) hide show
  1. package/git-revision.txt +1 -1
  2. package/lib/@types/event.d.ts +25 -19
  3. package/lib/@types/event.d.ts.map +1 -1
  4. package/lib/@types/event.js +5 -0
  5. package/lib/@types/event.js.map +1 -1
  6. package/lib/@types/global.d.js +0 -2
  7. package/lib/@types/global.d.js.map +1 -1
  8. package/lib/autodiscovery.d.ts +1 -1
  9. package/lib/autodiscovery.d.ts.map +1 -1
  10. package/lib/autodiscovery.js.map +1 -1
  11. package/lib/base64.d.ts +3 -6
  12. package/lib/base64.d.ts.map +1 -1
  13. package/lib/base64.js +43 -36
  14. package/lib/base64.js.map +1 -1
  15. package/lib/browser-index.d.ts.map +1 -1
  16. package/lib/browser-index.js +0 -11
  17. package/lib/browser-index.js.map +1 -1
  18. package/lib/client.d.ts +45 -1306
  19. package/lib/client.d.ts.map +1 -1
  20. package/lib/client.js +406 -2963
  21. package/lib/client.js.map +1 -1
  22. package/lib/digest.d.ts +2 -2
  23. package/lib/digest.d.ts.map +1 -1
  24. package/lib/digest.js +2 -2
  25. package/lib/digest.js.map +1 -1
  26. package/lib/embedded.d.ts +2 -23
  27. package/lib/embedded.d.ts.map +1 -1
  28. package/lib/embedded.js +82 -209
  29. package/lib/embedded.js.map +1 -1
  30. package/lib/event-mapper.d.ts.map +1 -1
  31. package/lib/event-mapper.js +0 -4
  32. package/lib/event-mapper.js.map +1 -1
  33. package/lib/feature.d.ts.map +1 -1
  34. package/lib/feature.js +2 -1
  35. package/lib/feature.js.map +1 -1
  36. package/lib/http-api/errors.d.ts +3 -3
  37. package/lib/http-api/errors.js +3 -3
  38. package/lib/http-api/errors.js.map +1 -1
  39. package/lib/http-api/utils.js +2 -2
  40. package/lib/http-api/utils.js.map +1 -1
  41. package/lib/matrix.d.ts +0 -25
  42. package/lib/matrix.d.ts.map +1 -1
  43. package/lib/matrix.js +1 -30
  44. package/lib/matrix.js.map +1 -1
  45. package/lib/models/MSC3089Branch.d.ts.map +1 -1
  46. package/lib/models/MSC3089Branch.js +0 -3
  47. package/lib/models/MSC3089Branch.js.map +1 -1
  48. package/lib/models/event-timeline-set.d.ts +6 -10
  49. package/lib/models/event-timeline-set.d.ts.map +1 -1
  50. package/lib/models/event-timeline-set.js +28 -36
  51. package/lib/models/event-timeline-set.js.map +1 -1
  52. package/lib/models/event-timeline.d.ts +7 -2
  53. package/lib/models/event-timeline.d.ts.map +1 -1
  54. package/lib/models/event-timeline.js +9 -30
  55. package/lib/models/event-timeline.js.map +1 -1
  56. package/lib/models/event.d.ts +12 -96
  57. package/lib/models/event.d.ts.map +1 -1
  58. package/lib/models/event.js +59 -286
  59. package/lib/models/event.js.map +1 -1
  60. package/lib/models/invites-ignorer-types.d.ts +27 -0
  61. package/lib/models/invites-ignorer-types.d.ts.map +1 -0
  62. package/lib/models/invites-ignorer-types.js +36 -0
  63. package/lib/models/invites-ignorer-types.js.map +1 -0
  64. package/lib/models/invites-ignorer.d.ts +2 -26
  65. package/lib/models/invites-ignorer.d.ts.map +1 -1
  66. package/lib/models/invites-ignorer.js +2 -27
  67. package/lib/models/invites-ignorer.js.map +1 -1
  68. package/lib/models/poll.d.ts.map +1 -1
  69. package/lib/models/poll.js +1 -5
  70. package/lib/models/poll.js.map +1 -1
  71. package/lib/models/relations-container.d.ts.map +1 -1
  72. package/lib/models/relations-container.js +1 -7
  73. package/lib/models/relations-container.js.map +1 -1
  74. package/lib/models/relations.d.ts +0 -1
  75. package/lib/models/relations.d.ts.map +1 -1
  76. package/lib/models/relations.js +0 -8
  77. package/lib/models/relations.js.map +1 -1
  78. package/lib/models/room-member.d.ts +6 -1
  79. package/lib/models/room-member.d.ts.map +1 -1
  80. package/lib/models/room-member.js +7 -1
  81. package/lib/models/room-member.js.map +1 -1
  82. package/lib/models/room-state.d.ts +2 -13
  83. package/lib/models/room-state.d.ts.map +1 -1
  84. package/lib/models/room-state.js +12 -56
  85. package/lib/models/room-state.js.map +1 -1
  86. package/lib/models/room.d.ts +8 -21
  87. package/lib/models/room.d.ts.map +1 -1
  88. package/lib/models/room.js +128 -163
  89. package/lib/models/room.js.map +1 -1
  90. package/lib/models/thread.d.ts.map +1 -1
  91. package/lib/models/thread.js +5 -4
  92. package/lib/models/thread.js.map +1 -1
  93. package/lib/oidc/authorize.d.ts +2 -2
  94. package/lib/oidc/authorize.d.ts.map +1 -1
  95. package/lib/oidc/authorize.js +5 -5
  96. package/lib/oidc/authorize.js.map +1 -1
  97. package/lib/oidc/discovery.d.ts +8 -0
  98. package/lib/oidc/discovery.d.ts.map +1 -1
  99. package/lib/oidc/discovery.js +22 -11
  100. package/lib/oidc/discovery.js.map +1 -1
  101. package/lib/oidc/index.d.ts +3 -4
  102. package/lib/oidc/index.d.ts.map +1 -1
  103. package/lib/oidc/index.js.map +1 -1
  104. package/lib/oidc/register.js +3 -3
  105. package/lib/oidc/register.js.map +1 -1
  106. package/lib/oidc/tokenRefresher.d.ts.map +1 -1
  107. package/lib/oidc/tokenRefresher.js +6 -5
  108. package/lib/oidc/tokenRefresher.js.map +1 -1
  109. package/lib/oidc/validate.d.ts +9 -23
  110. package/lib/oidc/validate.d.ts.map +1 -1
  111. package/lib/oidc/validate.js +13 -28
  112. package/lib/oidc/validate.js.map +1 -1
  113. package/lib/randomstring.d.ts +30 -3
  114. package/lib/randomstring.d.ts.map +1 -1
  115. package/lib/randomstring.js +68 -16
  116. package/lib/randomstring.js.map +1 -1
  117. package/lib/sliding-sync-sdk.d.ts +3 -4
  118. package/lib/sliding-sync-sdk.d.ts.map +1 -1
  119. package/lib/sliding-sync-sdk.js +55 -102
  120. package/lib/sliding-sync-sdk.js.map +1 -1
  121. package/lib/sliding-sync.js +9 -6
  122. package/lib/sliding-sync.js.map +1 -1
  123. package/lib/store/indexeddb-local-backend.js +4 -2
  124. package/lib/store/indexeddb-local-backend.js.map +1 -1
  125. package/lib/store/indexeddb.d.ts +1 -1
  126. package/lib/store/indexeddb.d.ts.map +1 -1
  127. package/lib/store/indexeddb.js.map +1 -1
  128. package/lib/sync-accumulator.d.ts +6 -4
  129. package/lib/sync-accumulator.d.ts.map +1 -1
  130. package/lib/sync-accumulator.js +23 -12
  131. package/lib/sync-accumulator.js.map +1 -1
  132. package/lib/sync.d.ts +10 -13
  133. package/lib/sync.d.ts.map +1 -1
  134. package/lib/sync.js +94 -115
  135. package/lib/sync.js.map +1 -1
  136. package/lib/testing.d.ts +13 -44
  137. package/lib/testing.d.ts.map +1 -1
  138. package/lib/testing.js +36 -99
  139. package/lib/testing.js.map +1 -1
  140. package/lib/types.d.ts +0 -1
  141. package/lib/types.d.ts.map +1 -1
  142. package/lib/types.js.map +1 -1
  143. package/package.json +14 -15
  144. package/src/@types/event.ts +19 -36
  145. package/src/@types/global.d.ts +21 -4
  146. package/src/autodiscovery.ts +1 -1
  147. package/src/base64.ts +38 -40
  148. package/src/browser-index.ts +0 -11
  149. package/src/client.ts +175 -3136
  150. package/src/digest.ts +3 -3
  151. package/src/embedded.ts +43 -149
  152. package/src/event-mapper.ts +0 -4
  153. package/src/feature.ts +1 -0
  154. package/src/http-api/errors.ts +3 -3
  155. package/src/http-api/utils.ts +2 -2
  156. package/src/matrix.ts +0 -41
  157. package/src/models/MSC3089Branch.ts +0 -3
  158. package/src/models/event-timeline-set.ts +17 -38
  159. package/src/models/event-timeline.ts +11 -26
  160. package/src/models/event.ts +54 -295
  161. package/src/models/invites-ignorer-types.ts +48 -0
  162. package/src/models/invites-ignorer.ts +7 -42
  163. package/src/models/poll.ts +0 -6
  164. package/src/models/relations-container.ts +1 -8
  165. package/src/models/relations.ts +0 -8
  166. package/src/models/room-member.ts +16 -1
  167. package/src/models/room-state.ts +4 -37
  168. package/src/models/room.ts +34 -69
  169. package/src/models/thread.ts +4 -3
  170. package/src/oidc/authorize.ts +7 -7
  171. package/src/oidc/discovery.ts +16 -10
  172. package/src/oidc/index.ts +3 -4
  173. package/src/oidc/register.ts +3 -3
  174. package/src/oidc/tokenRefresher.ts +3 -2
  175. package/src/oidc/validate.ts +40 -63
  176. package/src/randomstring.ts +65 -19
  177. package/src/sliding-sync-sdk.ts +10 -83
  178. package/src/sliding-sync.ts +6 -6
  179. package/src/store/indexeddb-local-backend.ts +2 -2
  180. package/src/store/indexeddb.ts +1 -1
  181. package/src/sync-accumulator.ts +33 -16
  182. package/src/sync.ts +112 -143
  183. package/src/testing.ts +36 -103
  184. package/src/types.ts +0 -1
  185. package/CHANGELOG.md +0 -5910
  186. package/lib/@types/AESEncryptedSecretStoragePayload.d.ts +0 -14
  187. package/lib/@types/AESEncryptedSecretStoragePayload.d.ts.map +0 -1
  188. package/lib/@types/AESEncryptedSecretStoragePayload.js +0 -1
  189. package/lib/@types/AESEncryptedSecretStoragePayload.js.map +0 -1
  190. package/lib/@types/crypto.d.ts +0 -47
  191. package/lib/@types/crypto.d.ts.map +0 -1
  192. package/lib/@types/crypto.js +0 -1
  193. package/lib/@types/crypto.js.map +0 -1
  194. package/lib/@types/matrix-sdk-crypto-wasm.d.js +0 -1
  195. package/lib/@types/matrix-sdk-crypto-wasm.d.js.map +0 -1
  196. package/lib/common-crypto/CryptoBackend.d.ts +0 -240
  197. package/lib/common-crypto/CryptoBackend.d.ts.map +0 -1
  198. package/lib/common-crypto/CryptoBackend.js +0 -73
  199. package/lib/common-crypto/CryptoBackend.js.map +0 -1
  200. package/lib/common-crypto/key-passphrase.d.ts +0 -14
  201. package/lib/common-crypto/key-passphrase.d.ts.map +0 -1
  202. package/lib/common-crypto/key-passphrase.js +0 -33
  203. package/lib/common-crypto/key-passphrase.js.map +0 -1
  204. package/lib/crypto/CrossSigning.d.ts +0 -184
  205. package/lib/crypto/CrossSigning.d.ts.map +0 -1
  206. package/lib/crypto/CrossSigning.js +0 -718
  207. package/lib/crypto/CrossSigning.js.map +0 -1
  208. package/lib/crypto/DeviceList.d.ts +0 -216
  209. package/lib/crypto/DeviceList.d.ts.map +0 -1
  210. package/lib/crypto/DeviceList.js +0 -892
  211. package/lib/crypto/DeviceList.js.map +0 -1
  212. package/lib/crypto/EncryptionSetup.d.ts +0 -152
  213. package/lib/crypto/EncryptionSetup.d.ts.map +0 -1
  214. package/lib/crypto/EncryptionSetup.js +0 -356
  215. package/lib/crypto/EncryptionSetup.js.map +0 -1
  216. package/lib/crypto/OlmDevice.d.ts +0 -457
  217. package/lib/crypto/OlmDevice.d.ts.map +0 -1
  218. package/lib/crypto/OlmDevice.js +0 -1241
  219. package/lib/crypto/OlmDevice.js.map +0 -1
  220. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts +0 -109
  221. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts.map +0 -1
  222. package/lib/crypto/OutgoingRoomKeyRequestManager.js +0 -415
  223. package/lib/crypto/OutgoingRoomKeyRequestManager.js.map +0 -1
  224. package/lib/crypto/RoomList.d.ts +0 -26
  225. package/lib/crypto/RoomList.d.ts.map +0 -1
  226. package/lib/crypto/RoomList.js +0 -71
  227. package/lib/crypto/RoomList.js.map +0 -1
  228. package/lib/crypto/SecretSharing.d.ts +0 -24
  229. package/lib/crypto/SecretSharing.d.ts.map +0 -1
  230. package/lib/crypto/SecretSharing.js +0 -194
  231. package/lib/crypto/SecretSharing.js.map +0 -1
  232. package/lib/crypto/SecretStorage.d.ts +0 -55
  233. package/lib/crypto/SecretStorage.d.ts.map +0 -1
  234. package/lib/crypto/SecretStorage.js +0 -118
  235. package/lib/crypto/SecretStorage.js.map +0 -1
  236. package/lib/crypto/aes.d.ts +0 -6
  237. package/lib/crypto/aes.d.ts.map +0 -1
  238. package/lib/crypto/aes.js +0 -24
  239. package/lib/crypto/aes.js.map +0 -1
  240. package/lib/crypto/algorithms/base.d.ts +0 -156
  241. package/lib/crypto/algorithms/base.d.ts.map +0 -1
  242. package/lib/crypto/algorithms/base.js +0 -187
  243. package/lib/crypto/algorithms/base.js.map +0 -1
  244. package/lib/crypto/algorithms/index.d.ts +0 -4
  245. package/lib/crypto/algorithms/index.d.ts.map +0 -1
  246. package/lib/crypto/algorithms/index.js +0 -20
  247. package/lib/crypto/algorithms/index.js.map +0 -1
  248. package/lib/crypto/algorithms/megolm.d.ts +0 -385
  249. package/lib/crypto/algorithms/megolm.d.ts.map +0 -1
  250. package/lib/crypto/algorithms/megolm.js +0 -1822
  251. package/lib/crypto/algorithms/megolm.js.map +0 -1
  252. package/lib/crypto/algorithms/olm.d.ts +0 -5
  253. package/lib/crypto/algorithms/olm.d.ts.map +0 -1
  254. package/lib/crypto/algorithms/olm.js +0 -299
  255. package/lib/crypto/algorithms/olm.js.map +0 -1
  256. package/lib/crypto/api.d.ts +0 -32
  257. package/lib/crypto/api.d.ts.map +0 -1
  258. package/lib/crypto/api.js +0 -22
  259. package/lib/crypto/api.js.map +0 -1
  260. package/lib/crypto/backup.d.ts +0 -227
  261. package/lib/crypto/backup.d.ts.map +0 -1
  262. package/lib/crypto/backup.js +0 -824
  263. package/lib/crypto/backup.js.map +0 -1
  264. package/lib/crypto/crypto.d.ts +0 -3
  265. package/lib/crypto/crypto.d.ts.map +0 -1
  266. package/lib/crypto/crypto.js +0 -19
  267. package/lib/crypto/crypto.js.map +0 -1
  268. package/lib/crypto/dehydration.d.ts +0 -34
  269. package/lib/crypto/dehydration.d.ts.map +0 -1
  270. package/lib/crypto/dehydration.js +0 -252
  271. package/lib/crypto/dehydration.js.map +0 -1
  272. package/lib/crypto/device-converter.d.ts +0 -9
  273. package/lib/crypto/device-converter.d.ts.map +0 -1
  274. package/lib/crypto/device-converter.js +0 -42
  275. package/lib/crypto/device-converter.js.map +0 -1
  276. package/lib/crypto/deviceinfo.d.ts +0 -99
  277. package/lib/crypto/deviceinfo.d.ts.map +0 -1
  278. package/lib/crypto/deviceinfo.js +0 -148
  279. package/lib/crypto/deviceinfo.js.map +0 -1
  280. package/lib/crypto/index.d.ts +0 -1210
  281. package/lib/crypto/index.d.ts.map +0 -1
  282. package/lib/crypto/index.js +0 -4101
  283. package/lib/crypto/index.js.map +0 -1
  284. package/lib/crypto/key_passphrase.d.ts +0 -14
  285. package/lib/crypto/key_passphrase.d.ts.map +0 -1
  286. package/lib/crypto/key_passphrase.js +0 -44
  287. package/lib/crypto/key_passphrase.js.map +0 -1
  288. package/lib/crypto/keybackup.d.ts +0 -18
  289. package/lib/crypto/keybackup.d.ts.map +0 -1
  290. package/lib/crypto/keybackup.js +0 -1
  291. package/lib/crypto/keybackup.js.map +0 -1
  292. package/lib/crypto/olmlib.d.ts +0 -129
  293. package/lib/crypto/olmlib.d.ts.map +0 -1
  294. package/lib/crypto/olmlib.js +0 -492
  295. package/lib/crypto/olmlib.js.map +0 -1
  296. package/lib/crypto/recoverykey.d.ts +0 -2
  297. package/lib/crypto/recoverykey.d.ts.map +0 -1
  298. package/lib/crypto/recoverykey.js +0 -19
  299. package/lib/crypto/recoverykey.js.map +0 -1
  300. package/lib/crypto/store/base.d.ts +0 -252
  301. package/lib/crypto/store/base.d.ts.map +0 -1
  302. package/lib/crypto/store/base.js +0 -64
  303. package/lib/crypto/store/base.js.map +0 -1
  304. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts +0 -187
  305. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts.map +0 -1
  306. package/lib/crypto/store/indexeddb-crypto-store-backend.js +0 -1145
  307. package/lib/crypto/store/indexeddb-crypto-store-backend.js.map +0 -1
  308. package/lib/crypto/store/indexeddb-crypto-store.d.ts +0 -432
  309. package/lib/crypto/store/indexeddb-crypto-store.d.ts.map +0 -1
  310. package/lib/crypto/store/indexeddb-crypto-store.js +0 -728
  311. package/lib/crypto/store/indexeddb-crypto-store.js.map +0 -1
  312. package/lib/crypto/store/localStorage-crypto-store.d.ts +0 -119
  313. package/lib/crypto/store/localStorage-crypto-store.d.ts.map +0 -1
  314. package/lib/crypto/store/localStorage-crypto-store.js +0 -531
  315. package/lib/crypto/store/localStorage-crypto-store.js.map +0 -1
  316. package/lib/crypto/store/memory-crypto-store.d.ts +0 -215
  317. package/lib/crypto/store/memory-crypto-store.d.ts.map +0 -1
  318. package/lib/crypto/store/memory-crypto-store.js +0 -622
  319. package/lib/crypto/store/memory-crypto-store.js.map +0 -1
  320. package/lib/crypto/verification/Base.d.ts +0 -105
  321. package/lib/crypto/verification/Base.d.ts.map +0 -1
  322. package/lib/crypto/verification/Base.js +0 -372
  323. package/lib/crypto/verification/Base.js.map +0 -1
  324. package/lib/crypto/verification/Error.d.ts +0 -35
  325. package/lib/crypto/verification/Error.d.ts.map +0 -1
  326. package/lib/crypto/verification/Error.js +0 -86
  327. package/lib/crypto/verification/Error.js.map +0 -1
  328. package/lib/crypto/verification/IllegalMethod.d.ts +0 -15
  329. package/lib/crypto/verification/IllegalMethod.d.ts.map +0 -1
  330. package/lib/crypto/verification/IllegalMethod.js +0 -43
  331. package/lib/crypto/verification/IllegalMethod.js.map +0 -1
  332. package/lib/crypto/verification/QRCode.d.ts +0 -51
  333. package/lib/crypto/verification/QRCode.d.ts.map +0 -1
  334. package/lib/crypto/verification/QRCode.js +0 -277
  335. package/lib/crypto/verification/QRCode.js.map +0 -1
  336. package/lib/crypto/verification/SAS.d.ts +0 -27
  337. package/lib/crypto/verification/SAS.d.ts.map +0 -1
  338. package/lib/crypto/verification/SAS.js +0 -485
  339. package/lib/crypto/verification/SAS.js.map +0 -1
  340. package/lib/crypto/verification/SASDecimal.d.ts +0 -8
  341. package/lib/crypto/verification/SASDecimal.d.ts.map +0 -1
  342. package/lib/crypto/verification/SASDecimal.js +0 -34
  343. package/lib/crypto/verification/SASDecimal.js.map +0 -1
  344. package/lib/crypto/verification/request/Channel.d.ts +0 -18
  345. package/lib/crypto/verification/request/Channel.d.ts.map +0 -1
  346. package/lib/crypto/verification/request/Channel.js +0 -1
  347. package/lib/crypto/verification/request/Channel.js.map +0 -1
  348. package/lib/crypto/verification/request/InRoomChannel.d.ts +0 -113
  349. package/lib/crypto/verification/request/InRoomChannel.d.ts.map +0 -1
  350. package/lib/crypto/verification/request/InRoomChannel.js +0 -351
  351. package/lib/crypto/verification/request/InRoomChannel.js.map +0 -1
  352. package/lib/crypto/verification/request/ToDeviceChannel.d.ts +0 -105
  353. package/lib/crypto/verification/request/ToDeviceChannel.d.ts.map +0 -1
  354. package/lib/crypto/verification/request/ToDeviceChannel.js +0 -328
  355. package/lib/crypto/verification/request/ToDeviceChannel.js.map +0 -1
  356. package/lib/crypto/verification/request/VerificationRequest.d.ts +0 -227
  357. package/lib/crypto/verification/request/VerificationRequest.d.ts.map +0 -1
  358. package/lib/crypto/verification/request/VerificationRequest.js +0 -937
  359. package/lib/crypto/verification/request/VerificationRequest.js.map +0 -1
  360. package/lib/crypto-api/CryptoEvent.d.ts +0 -69
  361. package/lib/crypto-api/CryptoEvent.d.ts.map +0 -1
  362. package/lib/crypto-api/CryptoEvent.js +0 -33
  363. package/lib/crypto-api/CryptoEvent.js.map +0 -1
  364. package/lib/crypto-api/CryptoEventHandlerMap.d.ts +0 -16
  365. package/lib/crypto-api/CryptoEventHandlerMap.d.ts.map +0 -1
  366. package/lib/crypto-api/CryptoEventHandlerMap.js +0 -22
  367. package/lib/crypto-api/CryptoEventHandlerMap.js.map +0 -1
  368. package/lib/crypto-api/index.d.ts +0 -978
  369. package/lib/crypto-api/index.d.ts.map +0 -1
  370. package/lib/crypto-api/index.js +0 -304
  371. package/lib/crypto-api/index.js.map +0 -1
  372. package/lib/crypto-api/key-passphrase.d.ts +0 -11
  373. package/lib/crypto-api/key-passphrase.d.ts.map +0 -1
  374. package/lib/crypto-api/key-passphrase.js +0 -51
  375. package/lib/crypto-api/key-passphrase.js.map +0 -1
  376. package/lib/crypto-api/keybackup.d.ts +0 -88
  377. package/lib/crypto-api/keybackup.d.ts.map +0 -1
  378. package/lib/crypto-api/keybackup.js +0 -1
  379. package/lib/crypto-api/keybackup.js.map +0 -1
  380. package/lib/crypto-api/recovery-key.d.ts +0 -11
  381. package/lib/crypto-api/recovery-key.d.ts.map +0 -1
  382. package/lib/crypto-api/recovery-key.js +0 -65
  383. package/lib/crypto-api/recovery-key.js.map +0 -1
  384. package/lib/crypto-api/verification.d.ts +0 -344
  385. package/lib/crypto-api/verification.d.ts.map +0 -1
  386. package/lib/crypto-api/verification.js +0 -91
  387. package/lib/crypto-api/verification.js.map +0 -1
  388. package/lib/matrixrtc/CallMembership.d.ts +0 -66
  389. package/lib/matrixrtc/CallMembership.d.ts.map +0 -1
  390. package/lib/matrixrtc/CallMembership.js +0 -197
  391. package/lib/matrixrtc/CallMembership.js.map +0 -1
  392. package/lib/matrixrtc/LivekitFocus.d.ts +0 -16
  393. package/lib/matrixrtc/LivekitFocus.d.ts.map +0 -1
  394. package/lib/matrixrtc/LivekitFocus.js +0 -20
  395. package/lib/matrixrtc/LivekitFocus.js.map +0 -1
  396. package/lib/matrixrtc/MatrixRTCSession.d.ts +0 -295
  397. package/lib/matrixrtc/MatrixRTCSession.d.ts.map +0 -1
  398. package/lib/matrixrtc/MatrixRTCSession.js +0 -1043
  399. package/lib/matrixrtc/MatrixRTCSession.js.map +0 -1
  400. package/lib/matrixrtc/MatrixRTCSessionManager.d.ts +0 -40
  401. package/lib/matrixrtc/MatrixRTCSessionManager.d.ts.map +0 -1
  402. package/lib/matrixrtc/MatrixRTCSessionManager.js +0 -146
  403. package/lib/matrixrtc/MatrixRTCSessionManager.js.map +0 -1
  404. package/lib/matrixrtc/focus.d.ts +0 -10
  405. package/lib/matrixrtc/focus.d.ts.map +0 -1
  406. package/lib/matrixrtc/focus.js +0 -1
  407. package/lib/matrixrtc/focus.js.map +0 -1
  408. package/lib/matrixrtc/index.d.ts +0 -7
  409. package/lib/matrixrtc/index.d.ts.map +0 -1
  410. package/lib/matrixrtc/index.js +0 -21
  411. package/lib/matrixrtc/index.js.map +0 -1
  412. package/lib/matrixrtc/types.d.ts +0 -19
  413. package/lib/matrixrtc/types.d.ts.map +0 -1
  414. package/lib/matrixrtc/types.js +0 -1
  415. package/lib/matrixrtc/types.js.map +0 -1
  416. package/lib/rendezvous/MSC4108SignInWithQR.d.ts +0 -112
  417. package/lib/rendezvous/MSC4108SignInWithQR.d.ts.map +0 -1
  418. package/lib/rendezvous/MSC4108SignInWithQR.js +0 -392
  419. package/lib/rendezvous/MSC4108SignInWithQR.js.map +0 -1
  420. package/lib/rendezvous/RendezvousChannel.d.ts +0 -27
  421. package/lib/rendezvous/RendezvousChannel.d.ts.map +0 -1
  422. package/lib/rendezvous/RendezvousChannel.js +0 -1
  423. package/lib/rendezvous/RendezvousChannel.js.map +0 -1
  424. package/lib/rendezvous/RendezvousCode.d.ts +0 -9
  425. package/lib/rendezvous/RendezvousCode.d.ts.map +0 -1
  426. package/lib/rendezvous/RendezvousCode.js +0 -1
  427. package/lib/rendezvous/RendezvousCode.js.map +0 -1
  428. package/lib/rendezvous/RendezvousError.d.ts +0 -6
  429. package/lib/rendezvous/RendezvousError.d.ts.map +0 -1
  430. package/lib/rendezvous/RendezvousError.js +0 -23
  431. package/lib/rendezvous/RendezvousError.js.map +0 -1
  432. package/lib/rendezvous/RendezvousFailureReason.d.ts +0 -31
  433. package/lib/rendezvous/RendezvousFailureReason.d.ts.map +0 -1
  434. package/lib/rendezvous/RendezvousFailureReason.js +0 -38
  435. package/lib/rendezvous/RendezvousFailureReason.js.map +0 -1
  436. package/lib/rendezvous/RendezvousIntent.d.ts +0 -5
  437. package/lib/rendezvous/RendezvousIntent.d.ts.map +0 -1
  438. package/lib/rendezvous/RendezvousIntent.js +0 -22
  439. package/lib/rendezvous/RendezvousIntent.js.map +0 -1
  440. package/lib/rendezvous/RendezvousTransport.d.ts +0 -36
  441. package/lib/rendezvous/RendezvousTransport.d.ts.map +0 -1
  442. package/lib/rendezvous/RendezvousTransport.js +0 -1
  443. package/lib/rendezvous/RendezvousTransport.js.map +0 -1
  444. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts +0 -58
  445. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts.map +0 -1
  446. package/lib/rendezvous/channels/MSC4108SecureChannel.js +0 -246
  447. package/lib/rendezvous/channels/MSC4108SecureChannel.js.map +0 -1
  448. package/lib/rendezvous/channels/index.d.ts +0 -2
  449. package/lib/rendezvous/channels/index.d.ts.map +0 -1
  450. package/lib/rendezvous/channels/index.js +0 -18
  451. package/lib/rendezvous/channels/index.js.map +0 -1
  452. package/lib/rendezvous/index.d.ts +0 -10
  453. package/lib/rendezvous/index.d.ts.map +0 -1
  454. package/lib/rendezvous/index.js +0 -23
  455. package/lib/rendezvous/index.js.map +0 -1
  456. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts +0 -61
  457. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts.map +0 -1
  458. package/lib/rendezvous/transports/MSC4108RendezvousSession.js +0 -253
  459. package/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +0 -1
  460. package/lib/rendezvous/transports/index.d.ts +0 -2
  461. package/lib/rendezvous/transports/index.d.ts.map +0 -1
  462. package/lib/rendezvous/transports/index.js +0 -18
  463. package/lib/rendezvous/transports/index.js.map +0 -1
  464. package/lib/rust-crypto/CrossSigningIdentity.d.ts +0 -33
  465. package/lib/rust-crypto/CrossSigningIdentity.d.ts.map +0 -1
  466. package/lib/rust-crypto/CrossSigningIdentity.js +0 -157
  467. package/lib/rust-crypto/CrossSigningIdentity.js.map +0 -1
  468. package/lib/rust-crypto/DehydratedDeviceManager.d.ts +0 -98
  469. package/lib/rust-crypto/DehydratedDeviceManager.d.ts.map +0 -1
  470. package/lib/rust-crypto/DehydratedDeviceManager.js +0 -285
  471. package/lib/rust-crypto/DehydratedDeviceManager.js.map +0 -1
  472. package/lib/rust-crypto/KeyClaimManager.d.ts +0 -33
  473. package/lib/rust-crypto/KeyClaimManager.d.ts.map +0 -1
  474. package/lib/rust-crypto/KeyClaimManager.js +0 -82
  475. package/lib/rust-crypto/KeyClaimManager.js.map +0 -1
  476. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts +0 -43
  477. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts.map +0 -1
  478. package/lib/rust-crypto/OutgoingRequestProcessor.js +0 -195
  479. package/lib/rust-crypto/OutgoingRequestProcessor.js.map +0 -1
  480. package/lib/rust-crypto/OutgoingRequestsManager.d.ts +0 -47
  481. package/lib/rust-crypto/OutgoingRequestsManager.d.ts.map +0 -1
  482. package/lib/rust-crypto/OutgoingRequestsManager.js +0 -148
  483. package/lib/rust-crypto/OutgoingRequestsManager.js.map +0 -1
  484. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts +0 -120
  485. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts.map +0 -1
  486. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js +0 -467
  487. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +0 -1
  488. package/lib/rust-crypto/RoomEncryptor.d.ts +0 -98
  489. package/lib/rust-crypto/RoomEncryptor.d.ts.map +0 -1
  490. package/lib/rust-crypto/RoomEncryptor.js +0 -299
  491. package/lib/rust-crypto/RoomEncryptor.js.map +0 -1
  492. package/lib/rust-crypto/backup.d.ts +0 -254
  493. package/lib/rust-crypto/backup.d.ts.map +0 -1
  494. package/lib/rust-crypto/backup.js +0 -837
  495. package/lib/rust-crypto/backup.js.map +0 -1
  496. package/lib/rust-crypto/constants.d.ts +0 -3
  497. package/lib/rust-crypto/constants.d.ts.map +0 -1
  498. package/lib/rust-crypto/constants.js +0 -19
  499. package/lib/rust-crypto/constants.js.map +0 -1
  500. package/lib/rust-crypto/device-converter.d.ts +0 -28
  501. package/lib/rust-crypto/device-converter.d.ts.map +0 -1
  502. package/lib/rust-crypto/device-converter.js +0 -123
  503. package/lib/rust-crypto/device-converter.js.map +0 -1
  504. package/lib/rust-crypto/index.d.ts +0 -61
  505. package/lib/rust-crypto/index.d.ts.map +0 -1
  506. package/lib/rust-crypto/index.js +0 -152
  507. package/lib/rust-crypto/index.js.map +0 -1
  508. package/lib/rust-crypto/libolm_migration.d.ts +0 -81
  509. package/lib/rust-crypto/libolm_migration.d.ts.map +0 -1
  510. package/lib/rust-crypto/libolm_migration.js +0 -459
  511. package/lib/rust-crypto/libolm_migration.js.map +0 -1
  512. package/lib/rust-crypto/rust-crypto.d.ts +0 -556
  513. package/lib/rust-crypto/rust-crypto.d.ts.map +0 -1
  514. package/lib/rust-crypto/rust-crypto.js +0 -2016
  515. package/lib/rust-crypto/rust-crypto.js.map +0 -1
  516. package/lib/rust-crypto/secret-storage.d.ts +0 -22
  517. package/lib/rust-crypto/secret-storage.d.ts.map +0 -1
  518. package/lib/rust-crypto/secret-storage.js +0 -63
  519. package/lib/rust-crypto/secret-storage.js.map +0 -1
  520. package/lib/rust-crypto/verification.d.ts +0 -319
  521. package/lib/rust-crypto/verification.d.ts.map +0 -1
  522. package/lib/rust-crypto/verification.js +0 -816
  523. package/lib/rust-crypto/verification.js.map +0 -1
  524. package/lib/secret-storage.d.ts +0 -370
  525. package/lib/secret-storage.d.ts.map +0 -1
  526. package/lib/secret-storage.js +0 -466
  527. package/lib/secret-storage.js.map +0 -1
  528. package/lib/utils/decryptAESSecretStorageItem.d.ts +0 -12
  529. package/lib/utils/decryptAESSecretStorageItem.d.ts.map +0 -1
  530. package/lib/utils/decryptAESSecretStorageItem.js +0 -50
  531. package/lib/utils/decryptAESSecretStorageItem.js.map +0 -1
  532. package/lib/utils/encryptAESSecretStorageItem.d.ts +0 -16
  533. package/lib/utils/encryptAESSecretStorageItem.d.ts.map +0 -1
  534. package/lib/utils/encryptAESSecretStorageItem.js +0 -68
  535. package/lib/utils/encryptAESSecretStorageItem.js.map +0 -1
  536. package/lib/utils/internal/deriveKeys.d.ts +0 -10
  537. package/lib/utils/internal/deriveKeys.d.ts.map +0 -1
  538. package/lib/utils/internal/deriveKeys.js +0 -60
  539. package/lib/utils/internal/deriveKeys.js.map +0 -1
  540. package/lib/webrtc/audioContext.d.ts +0 -15
  541. package/lib/webrtc/audioContext.d.ts.map +0 -1
  542. package/lib/webrtc/audioContext.js +0 -46
  543. package/lib/webrtc/audioContext.js.map +0 -1
  544. package/lib/webrtc/call.d.ts +0 -560
  545. package/lib/webrtc/call.d.ts.map +0 -1
  546. package/lib/webrtc/call.js +0 -2541
  547. package/lib/webrtc/call.js.map +0 -1
  548. package/lib/webrtc/callEventHandler.d.ts +0 -37
  549. package/lib/webrtc/callEventHandler.d.ts.map +0 -1
  550. package/lib/webrtc/callEventHandler.js +0 -344
  551. package/lib/webrtc/callEventHandler.js.map +0 -1
  552. package/lib/webrtc/callEventTypes.d.ts +0 -73
  553. package/lib/webrtc/callEventTypes.d.ts.map +0 -1
  554. package/lib/webrtc/callEventTypes.js +0 -13
  555. package/lib/webrtc/callEventTypes.js.map +0 -1
  556. package/lib/webrtc/callFeed.d.ts +0 -128
  557. package/lib/webrtc/callFeed.d.ts.map +0 -1
  558. package/lib/webrtc/callFeed.js +0 -289
  559. package/lib/webrtc/callFeed.js.map +0 -1
  560. package/lib/webrtc/groupCall.d.ts +0 -323
  561. package/lib/webrtc/groupCall.d.ts.map +0 -1
  562. package/lib/webrtc/groupCall.js +0 -1337
  563. package/lib/webrtc/groupCall.js.map +0 -1
  564. package/lib/webrtc/groupCallEventHandler.d.ts +0 -31
  565. package/lib/webrtc/groupCallEventHandler.d.ts.map +0 -1
  566. package/lib/webrtc/groupCallEventHandler.js +0 -178
  567. package/lib/webrtc/groupCallEventHandler.js.map +0 -1
  568. package/lib/webrtc/mediaHandler.d.ts +0 -89
  569. package/lib/webrtc/mediaHandler.d.ts.map +0 -1
  570. package/lib/webrtc/mediaHandler.js +0 -437
  571. package/lib/webrtc/mediaHandler.js.map +0 -1
  572. package/lib/webrtc/stats/callFeedStatsReporter.d.ts +0 -8
  573. package/lib/webrtc/stats/callFeedStatsReporter.d.ts.map +0 -1
  574. package/lib/webrtc/stats/callFeedStatsReporter.js +0 -82
  575. package/lib/webrtc/stats/callFeedStatsReporter.js.map +0 -1
  576. package/lib/webrtc/stats/callStatsReportGatherer.d.ts +0 -25
  577. package/lib/webrtc/stats/callStatsReportGatherer.d.ts.map +0 -1
  578. package/lib/webrtc/stats/callStatsReportGatherer.js +0 -199
  579. package/lib/webrtc/stats/callStatsReportGatherer.js.map +0 -1
  580. package/lib/webrtc/stats/callStatsReportSummary.d.ts +0 -17
  581. package/lib/webrtc/stats/callStatsReportSummary.d.ts.map +0 -1
  582. package/lib/webrtc/stats/callStatsReportSummary.js +0 -1
  583. package/lib/webrtc/stats/callStatsReportSummary.js.map +0 -1
  584. package/lib/webrtc/stats/connectionStats.d.ts +0 -28
  585. package/lib/webrtc/stats/connectionStats.d.ts.map +0 -1
  586. package/lib/webrtc/stats/connectionStats.js +0 -26
  587. package/lib/webrtc/stats/connectionStats.js.map +0 -1
  588. package/lib/webrtc/stats/connectionStatsBuilder.d.ts +0 -5
  589. package/lib/webrtc/stats/connectionStatsBuilder.d.ts.map +0 -1
  590. package/lib/webrtc/stats/connectionStatsBuilder.js +0 -27
  591. package/lib/webrtc/stats/connectionStatsBuilder.js.map +0 -1
  592. package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts +0 -7
  593. package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts.map +0 -1
  594. package/lib/webrtc/stats/connectionStatsReportBuilder.js +0 -121
  595. package/lib/webrtc/stats/connectionStatsReportBuilder.js.map +0 -1
  596. package/lib/webrtc/stats/groupCallStats.d.ts +0 -22
  597. package/lib/webrtc/stats/groupCallStats.d.ts.map +0 -1
  598. package/lib/webrtc/stats/groupCallStats.js +0 -78
  599. package/lib/webrtc/stats/groupCallStats.js.map +0 -1
  600. package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts +0 -10
  601. package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts.map +0 -1
  602. package/lib/webrtc/stats/media/mediaSsrcHandler.js +0 -57
  603. package/lib/webrtc/stats/media/mediaSsrcHandler.js.map +0 -1
  604. package/lib/webrtc/stats/media/mediaTrackHandler.d.ts +0 -12
  605. package/lib/webrtc/stats/media/mediaTrackHandler.d.ts.map +0 -1
  606. package/lib/webrtc/stats/media/mediaTrackHandler.js +0 -62
  607. package/lib/webrtc/stats/media/mediaTrackHandler.js.map +0 -1
  608. package/lib/webrtc/stats/media/mediaTrackStats.d.ts +0 -86
  609. package/lib/webrtc/stats/media/mediaTrackStats.d.ts.map +0 -1
  610. package/lib/webrtc/stats/media/mediaTrackStats.js +0 -142
  611. package/lib/webrtc/stats/media/mediaTrackStats.js.map +0 -1
  612. package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts +0 -22
  613. package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts.map +0 -1
  614. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js +0 -76
  615. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js.map +0 -1
  616. package/lib/webrtc/stats/statsReport.d.ts +0 -99
  617. package/lib/webrtc/stats/statsReport.d.ts.map +0 -1
  618. package/lib/webrtc/stats/statsReport.js +0 -32
  619. package/lib/webrtc/stats/statsReport.js.map +0 -1
  620. package/lib/webrtc/stats/statsReportEmitter.d.ts +0 -15
  621. package/lib/webrtc/stats/statsReportEmitter.d.ts.map +0 -1
  622. package/lib/webrtc/stats/statsReportEmitter.js +0 -33
  623. package/lib/webrtc/stats/statsReportEmitter.js.map +0 -1
  624. package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts +0 -16
  625. package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts.map +0 -1
  626. package/lib/webrtc/stats/summaryStatsReportGatherer.js +0 -116
  627. package/lib/webrtc/stats/summaryStatsReportGatherer.js.map +0 -1
  628. package/lib/webrtc/stats/trackStatsBuilder.d.ts +0 -19
  629. package/lib/webrtc/stats/trackStatsBuilder.d.ts.map +0 -1
  630. package/lib/webrtc/stats/trackStatsBuilder.js +0 -168
  631. package/lib/webrtc/stats/trackStatsBuilder.js.map +0 -1
  632. package/lib/webrtc/stats/transportStats.d.ts +0 -11
  633. package/lib/webrtc/stats/transportStats.d.ts.map +0 -1
  634. package/lib/webrtc/stats/transportStats.js +0 -1
  635. package/lib/webrtc/stats/transportStats.js.map +0 -1
  636. package/lib/webrtc/stats/transportStatsBuilder.d.ts +0 -5
  637. package/lib/webrtc/stats/transportStatsBuilder.d.ts.map +0 -1
  638. package/lib/webrtc/stats/transportStatsBuilder.js +0 -34
  639. package/lib/webrtc/stats/transportStatsBuilder.js.map +0 -1
  640. package/lib/webrtc/stats/valueFormatter.d.ts +0 -4
  641. package/lib/webrtc/stats/valueFormatter.d.ts.map +0 -1
  642. package/lib/webrtc/stats/valueFormatter.js +0 -25
  643. package/lib/webrtc/stats/valueFormatter.js.map +0 -1
  644. package/src/@types/AESEncryptedSecretStoragePayload.ts +0 -29
  645. package/src/@types/crypto.ts +0 -73
  646. package/src/@types/matrix-sdk-crypto-wasm.d.ts +0 -44
  647. package/src/common-crypto/CryptoBackend.ts +0 -302
  648. package/src/common-crypto/README.md +0 -4
  649. package/src/common-crypto/key-passphrase.ts +0 -43
  650. package/src/crypto/CrossSigning.ts +0 -773
  651. package/src/crypto/DeviceList.ts +0 -989
  652. package/src/crypto/EncryptionSetup.ts +0 -351
  653. package/src/crypto/OlmDevice.ts +0 -1500
  654. package/src/crypto/OutgoingRoomKeyRequestManager.ts +0 -485
  655. package/src/crypto/RoomList.ts +0 -70
  656. package/src/crypto/SecretSharing.ts +0 -240
  657. package/src/crypto/SecretStorage.ts +0 -136
  658. package/src/crypto/aes.ts +0 -23
  659. package/src/crypto/algorithms/base.ts +0 -236
  660. package/src/crypto/algorithms/index.ts +0 -20
  661. package/src/crypto/algorithms/megolm.ts +0 -2216
  662. package/src/crypto/algorithms/olm.ts +0 -381
  663. package/src/crypto/api.ts +0 -70
  664. package/src/crypto/backup.ts +0 -922
  665. package/src/crypto/crypto.ts +0 -18
  666. package/src/crypto/dehydration.ts +0 -272
  667. package/src/crypto/device-converter.ts +0 -45
  668. package/src/crypto/deviceinfo.ts +0 -158
  669. package/src/crypto/index.ts +0 -4418
  670. package/src/crypto/key_passphrase.ts +0 -42
  671. package/src/crypto/keybackup.ts +0 -47
  672. package/src/crypto/olmlib.ts +0 -539
  673. package/src/crypto/recoverykey.ts +0 -18
  674. package/src/crypto/store/base.ts +0 -348
  675. package/src/crypto/store/indexeddb-crypto-store-backend.ts +0 -1250
  676. package/src/crypto/store/indexeddb-crypto-store.ts +0 -845
  677. package/src/crypto/store/localStorage-crypto-store.ts +0 -579
  678. package/src/crypto/store/memory-crypto-store.ts +0 -680
  679. package/src/crypto/verification/Base.ts +0 -409
  680. package/src/crypto/verification/Error.ts +0 -76
  681. package/src/crypto/verification/IllegalMethod.ts +0 -50
  682. package/src/crypto/verification/QRCode.ts +0 -310
  683. package/src/crypto/verification/SAS.ts +0 -494
  684. package/src/crypto/verification/SASDecimal.ts +0 -37
  685. package/src/crypto/verification/request/Channel.ts +0 -34
  686. package/src/crypto/verification/request/InRoomChannel.ts +0 -371
  687. package/src/crypto/verification/request/ToDeviceChannel.ts +0 -354
  688. package/src/crypto/verification/request/VerificationRequest.ts +0 -976
  689. package/src/crypto-api/CryptoEvent.ts +0 -93
  690. package/src/crypto-api/CryptoEventHandlerMap.ts +0 -32
  691. package/src/crypto-api/index.ts +0 -1175
  692. package/src/crypto-api/key-passphrase.ts +0 -58
  693. package/src/crypto-api/keybackup.ts +0 -115
  694. package/src/crypto-api/recovery-key.ts +0 -69
  695. package/src/crypto-api/verification.ts +0 -408
  696. package/src/matrixrtc/CallMembership.ts +0 -247
  697. package/src/matrixrtc/LivekitFocus.ts +0 -39
  698. package/src/matrixrtc/MatrixRTCSession.ts +0 -1319
  699. package/src/matrixrtc/MatrixRTCSessionManager.ts +0 -166
  700. package/src/matrixrtc/focus.ts +0 -25
  701. package/src/matrixrtc/index.ts +0 -22
  702. package/src/matrixrtc/types.ts +0 -36
  703. package/src/rendezvous/MSC4108SignInWithQR.ts +0 -444
  704. package/src/rendezvous/RendezvousChannel.ts +0 -48
  705. package/src/rendezvous/RendezvousCode.ts +0 -25
  706. package/src/rendezvous/RendezvousError.ts +0 -26
  707. package/src/rendezvous/RendezvousFailureReason.ts +0 -49
  708. package/src/rendezvous/RendezvousIntent.ts +0 -20
  709. package/src/rendezvous/RendezvousTransport.ts +0 -58
  710. package/src/rendezvous/channels/MSC4108SecureChannel.ts +0 -270
  711. package/src/rendezvous/channels/index.ts +0 -17
  712. package/src/rendezvous/index.ts +0 -25
  713. package/src/rendezvous/transports/MSC4108RendezvousSession.ts +0 -270
  714. package/src/rendezvous/transports/index.ts +0 -17
  715. package/src/rust-crypto/CrossSigningIdentity.ts +0 -183
  716. package/src/rust-crypto/DehydratedDeviceManager.ts +0 -306
  717. package/src/rust-crypto/KeyClaimManager.ts +0 -86
  718. package/src/rust-crypto/OutgoingRequestProcessor.ts +0 -236
  719. package/src/rust-crypto/OutgoingRequestsManager.ts +0 -143
  720. package/src/rust-crypto/PerSessionKeyBackupDownloader.ts +0 -501
  721. package/src/rust-crypto/RoomEncryptor.ts +0 -352
  722. package/src/rust-crypto/backup.ts +0 -881
  723. package/src/rust-crypto/constants.ts +0 -18
  724. package/src/rust-crypto/device-converter.ts +0 -128
  725. package/src/rust-crypto/index.ts +0 -237
  726. package/src/rust-crypto/libolm_migration.ts +0 -530
  727. package/src/rust-crypto/rust-crypto.ts +0 -2205
  728. package/src/rust-crypto/secret-storage.ts +0 -60
  729. package/src/rust-crypto/verification.ts +0 -830
  730. package/src/secret-storage.ts +0 -693
  731. package/src/utils/decryptAESSecretStorageItem.ts +0 -54
  732. package/src/utils/encryptAESSecretStorageItem.ts +0 -73
  733. package/src/utils/internal/deriveKeys.ts +0 -63
  734. package/src/webrtc/audioContext.ts +0 -44
  735. package/src/webrtc/call.ts +0 -3074
  736. package/src/webrtc/callEventHandler.ts +0 -425
  737. package/src/webrtc/callEventTypes.ts +0 -93
  738. package/src/webrtc/callFeed.ts +0 -364
  739. package/src/webrtc/groupCall.ts +0 -1735
  740. package/src/webrtc/groupCallEventHandler.ts +0 -234
  741. package/src/webrtc/mediaHandler.ts +0 -484
  742. package/src/webrtc/stats/callFeedStatsReporter.ts +0 -94
  743. package/src/webrtc/stats/callStatsReportGatherer.ts +0 -219
  744. package/src/webrtc/stats/callStatsReportSummary.ts +0 -30
  745. package/src/webrtc/stats/connectionStats.ts +0 -47
  746. package/src/webrtc/stats/connectionStatsBuilder.ts +0 -28
  747. package/src/webrtc/stats/connectionStatsReportBuilder.ts +0 -140
  748. package/src/webrtc/stats/groupCallStats.ts +0 -93
  749. package/src/webrtc/stats/media/mediaSsrcHandler.ts +0 -57
  750. package/src/webrtc/stats/media/mediaTrackHandler.ts +0 -76
  751. package/src/webrtc/stats/media/mediaTrackStats.ts +0 -176
  752. package/src/webrtc/stats/media/mediaTrackStatsHandler.ts +0 -90
  753. package/src/webrtc/stats/statsReport.ts +0 -133
  754. package/src/webrtc/stats/statsReportEmitter.ts +0 -49
  755. package/src/webrtc/stats/summaryStatsReportGatherer.ts +0 -148
  756. package/src/webrtc/stats/trackStatsBuilder.ts +0 -207
  757. package/src/webrtc/stats/transportStats.ts +0 -26
  758. package/src/webrtc/stats/transportStatsBuilder.ts +0 -48
  759. package/src/webrtc/stats/valueFormatter.ts +0 -27
@@ -1 +1 @@
1
- {"version":3,"file":"embedded.js","names":["WidgetApiToWidgetAction","WidgetApiResponseError","MatrixCapabilities","MatrixEvent","EventStatus","EventType","logger","MatrixClient","ClientEvent","UNSTABLE_MSC4140_DELAYED_EVENTS","SyncApi","SyncState","SlidingSyncSdk","MatrixError","User","MapWithDefault","recursiveMapToObject","TypedEventEmitter","RoomWidgetClientEvent","RoomWidgetClient","constructor","widgetApi","capabilities","roomId","opts","sendContentLoaded","_this","_capabilities$sendEve","_capabilities$receive","_capabilities$sendSta","_capabilities$receive2","_capabilities$sendEve2","_capabilities$receive3","_capabilities$sendSta2","_capabilities$receive4","_capabilities$sendToD","_capabilities$receive5","_capabilities$sendEve3","_capabilities$sendSta3","this","_defineProperty","_ref","_asyncToGenerator","event","getSender","getUserId","pendingSendingEventsTxId","some","p","getType","type","_this$pendingSendingE","matchingTxId","find","id","getId","txId","length","_this$pendingSendingE2","Promise","resolve","eventEmitter","once","PendingEventsChanged","setTxnId","setUnsigned","_objectSpread","getUnsigned","transaction_id","filter","emit","_x","apply","arguments","_ref2","ev","preventDefault","detail","data","room_id","updateTxId","syncApi","injectRoomEvents","room","Event","setSyncState","Syncing","info","concat","getStateKey","event_id","eventId","ack","_x2","_ref3","sender","content","encrypted","makeEncrypted","RoomMessageEncrypted","ToDeviceEvent","_x3","transportSend","transport","send","bind","_ref4","action","error","processAndThrow","_x4","_x5","transportSendComplete","sendComplete","_ref5","_x6","_x7","widgetApiReady","sendEvent","receiveEvent","sendMessage","Array","isArray","receiveMessage","sendState","receiveState","requestCapabilityForRoomTimeline","forEach","eventType","requestCapabilityToSendEvent","requestCapabilityToReceiveEvent","requestCapabilityToSendMessage","msgType","requestCapabilityToReceiveMessage","_ref6","stateKey","requestCapabilityToSendState","_ref7","requestCapabilityToReceiveState","sendToDevice","requestCapabilityToSendToDevice","receiveToDevice","requestCapabilityToReceiveToDevice","sendDelayedEvents","requestCapability","MSC4157SendDelayedEvent","updateDelayedEvents","MSC4157UpdateDelayedEvent","turnServers","MSC3846TurnServers","on","SendEvent","onEvent","SendToDevice","onToDevice","start","startClient","_arguments","_this2","_this2$capabilities$r","_this2$capabilities$r2","undefined","lifecycle","AbortController","userId","store","storeUser","slidingSync","buildSyncApiOptions","createRoom","storeRoom","all","map","_ref9","_ref8","rawEvents","readStateEvents","events","rawEvent","_x8","clientWellKnownPollPeriod","clientWellKnownIntervalID","setInterval","fetchClientWellKnown","matrixRTC","watchTurnServers","stopClient","off","abort","joinRoom","roomIdOrAlias","_this3","Error","encryptAndSendEvent","delayOpts","_this4","redacts","getContent","response","sendRoomEvent","delay","parent_delay_id","validateSendDelayedEventResponse","getTxnId","push","e","updatePendingEventStatus","NOT_SENT","updatePendingEvent","SENT","sendStateEvent","_arguments2","_this5","_unstable_sendDelayedStateEvent","_arguments3","_this6","doesServerSupportUnstableFeature","delay_id","_unstable_updateDelayedEvent","delayId","_this7","updateDelayedEvent","contentMap","_this8","getOpenIdToken","_this9","token","requestOpenIDConnectToken","access_token","expires_in","matrix_server_name","token_type","queueToDevice","_ref10","_this10","batch","Map","deviceId","payload","getOrCreate","set","encryptAndSendToDevices","userDeviceInfoArr","_this11","deviceInfo","sendToDeviceViaWidgetApi","_this12","checkTurnServers","_this13","getSyncState","syncState","state","oldState","Sync","_this14","reply","_this15","servers","getTurnServers","onClientStopped","return","signal","addEventListener","_iteratorAbruptCompletion","_didIteratorError","_iteratorError","_iterator","_asyncIterator","_step","next","done","server","value","urls","uris","username","credential","password","TurnServers","log","err","warn","removeEventListener","matrix_api_error","fromWidgetApiErrorData"],"sources":["../src/embedded.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport {\n WidgetApi,\n WidgetApiToWidgetAction,\n WidgetApiResponseError,\n MatrixCapabilities,\n IWidgetApiRequest,\n IWidgetApiAcknowledgeResponseData,\n ISendEventToWidgetActionRequest,\n ISendToDeviceToWidgetActionRequest,\n ISendEventFromWidgetResponseData,\n IWidgetApiRequestData,\n WidgetApiAction,\n IWidgetApiResponse,\n IWidgetApiResponseData,\n} from \"matrix-widget-api\";\n\nimport { MatrixEvent, IEvent, IContent, EventStatus } from \"./models/event.ts\";\nimport {\n ISendEventResponse,\n SendDelayedEventRequestOpts,\n SendDelayedEventResponse,\n UpdateDelayedEventAction,\n} from \"./@types/requests.ts\";\nimport { EventType, StateEvents } from \"./@types/event.ts\";\nimport { logger } from \"./logger.ts\";\nimport {\n MatrixClient,\n ClientEvent,\n IMatrixClientCreateOpts,\n IStartClientOpts,\n SendToDeviceContentMap,\n IOpenIDToken,\n UNSTABLE_MSC4140_DELAYED_EVENTS,\n} from \"./client.ts\";\nimport { SyncApi, SyncState } from \"./sync.ts\";\nimport { SlidingSyncSdk } from \"./sliding-sync-sdk.ts\";\nimport { MatrixError } from \"./http-api/errors.ts\";\nimport { User } from \"./models/user.ts\";\nimport { Room } from \"./models/room.ts\";\nimport { ToDeviceBatch, ToDevicePayload } from \"./models/ToDeviceMessage.ts\";\nimport { DeviceInfo } from \"./crypto/deviceinfo.ts\";\nimport { IOlmDevice } from \"./crypto/algorithms/megolm.ts\";\nimport { MapWithDefault, recursiveMapToObject } from \"./utils.ts\";\nimport { TypedEventEmitter } from \"./matrix.ts\";\n\ninterface IStateEventRequest {\n eventType: string;\n stateKey?: string;\n}\n\nexport interface ICapabilities {\n /**\n * Event types that this client expects to send.\n */\n sendEvent?: string[];\n /**\n * Event types that this client expects to receive.\n */\n receiveEvent?: string[];\n\n /**\n * Message types that this client expects to send, or true for all message\n * types.\n */\n sendMessage?: string[] | true;\n /**\n * Message types that this client expects to receive, or true for all\n * message types.\n */\n receiveMessage?: string[] | true;\n\n /**\n * Types of state events that this client expects to send.\n */\n sendState?: IStateEventRequest[];\n /**\n * Types of state events that this client expects to receive.\n */\n receiveState?: IStateEventRequest[];\n\n /**\n * To-device event types that this client expects to send.\n */\n sendToDevice?: string[];\n /**\n * To-device event types that this client expects to receive.\n */\n receiveToDevice?: string[];\n\n /**\n * Whether this client needs access to TURN servers.\n * @defaultValue false\n */\n turnServers?: boolean;\n\n /**\n * Whether this client needs to be able to send delayed events.\n * @experimental Part of MSC4140 & MSC4157\n * @defaultValue false\n */\n sendDelayedEvents?: boolean;\n\n /**\n * Whether this client needs to be able to update delayed events.\n * @experimental Part of MSC4140 & MSC4157\n * @defaultValue false\n */\n updateDelayedEvents?: boolean;\n}\n\nexport enum RoomWidgetClientEvent {\n PendingEventsChanged = \"PendingEvent.pendingEventsChanged\",\n}\nexport type EventHandlerMap = { [RoomWidgetClientEvent.PendingEventsChanged]: () => void };\n/**\n * A MatrixClient that routes its requests through the widget API instead of the\n * real CS API.\n * @experimental This class is considered unstable!\n */\nexport class RoomWidgetClient extends MatrixClient {\n private room?: Room;\n private readonly widgetApiReady: Promise<void>;\n private lifecycle?: AbortController;\n private syncState: SyncState | null = null;\n\n private pendingSendingEventsTxId: { type: string; id: string | undefined; txId: string }[] = [];\n private eventEmitter = new TypedEventEmitter<keyof EventHandlerMap, EventHandlerMap>();\n\n /**\n *\n * @param widgetApi - The widget api to use for communication.\n * @param capabilities - The capabilities the widget client will request.\n * @param roomId - The room id the widget is associated with.\n * @param opts - The configuration options for this client.\n * @param sendContentLoaded - Whether to send a content loaded widget action immediately after initial setup.\n * Set to `false` if the widget uses `waitForIFrameLoad=true` (in this case the client does not expect a content loaded action at all),\n * or if the the widget wants to send the `ContentLoaded` action at a later point in time after the initial setup.\n */\n public constructor(\n private readonly widgetApi: WidgetApi,\n private readonly capabilities: ICapabilities,\n private readonly roomId: string,\n opts: IMatrixClientCreateOpts,\n sendContentLoaded: boolean,\n ) {\n super(opts);\n\n const transportSend = this.widgetApi.transport.send.bind(this.widgetApi.transport);\n this.widgetApi.transport.send = async <\n T extends IWidgetApiRequestData,\n R extends IWidgetApiResponseData = IWidgetApiAcknowledgeResponseData,\n >(\n action: WidgetApiAction,\n data: T,\n ): Promise<R> => {\n try {\n return await transportSend(action, data);\n } catch (error) {\n processAndThrow(error);\n }\n };\n\n const transportSendComplete = this.widgetApi.transport.sendComplete.bind(this.widgetApi.transport);\n this.widgetApi.transport.sendComplete = async <T extends IWidgetApiRequestData, R extends IWidgetApiResponse>(\n action: WidgetApiAction,\n data: T,\n ): Promise<R> => {\n try {\n return await transportSendComplete(action, data);\n } catch (error) {\n processAndThrow(error);\n }\n };\n\n this.widgetApiReady = new Promise<void>((resolve) => this.widgetApi.once(\"ready\", resolve));\n\n // Request capabilities for the functionality this client needs to support\n if (\n capabilities.sendEvent?.length ||\n capabilities.receiveEvent?.length ||\n capabilities.sendMessage === true ||\n (Array.isArray(capabilities.sendMessage) && capabilities.sendMessage.length) ||\n capabilities.receiveMessage === true ||\n (Array.isArray(capabilities.receiveMessage) && capabilities.receiveMessage.length) ||\n capabilities.sendState?.length ||\n capabilities.receiveState?.length\n ) {\n widgetApi.requestCapabilityForRoomTimeline(roomId);\n }\n capabilities.sendEvent?.forEach((eventType) => widgetApi.requestCapabilityToSendEvent(eventType));\n capabilities.receiveEvent?.forEach((eventType) => widgetApi.requestCapabilityToReceiveEvent(eventType));\n if (capabilities.sendMessage === true) {\n widgetApi.requestCapabilityToSendMessage();\n } else if (Array.isArray(capabilities.sendMessage)) {\n capabilities.sendMessage.forEach((msgType) => widgetApi.requestCapabilityToSendMessage(msgType));\n }\n if (capabilities.receiveMessage === true) {\n widgetApi.requestCapabilityToReceiveMessage();\n } else if (Array.isArray(capabilities.receiveMessage)) {\n capabilities.receiveMessage.forEach((msgType) => widgetApi.requestCapabilityToReceiveMessage(msgType));\n }\n capabilities.sendState?.forEach(({ eventType, stateKey }) =>\n widgetApi.requestCapabilityToSendState(eventType, stateKey),\n );\n capabilities.receiveState?.forEach(({ eventType, stateKey }) =>\n widgetApi.requestCapabilityToReceiveState(eventType, stateKey),\n );\n capabilities.sendToDevice?.forEach((eventType) => widgetApi.requestCapabilityToSendToDevice(eventType));\n capabilities.receiveToDevice?.forEach((eventType) => widgetApi.requestCapabilityToReceiveToDevice(eventType));\n if (\n capabilities.sendDelayedEvents &&\n (capabilities.sendEvent?.length ||\n capabilities.sendMessage === true ||\n (Array.isArray(capabilities.sendMessage) && capabilities.sendMessage.length) ||\n capabilities.sendState?.length)\n ) {\n widgetApi.requestCapability(MatrixCapabilities.MSC4157SendDelayedEvent);\n }\n if (capabilities.updateDelayedEvents) {\n widgetApi.requestCapability(MatrixCapabilities.MSC4157UpdateDelayedEvent);\n }\n if (capabilities.turnServers) {\n widgetApi.requestCapability(MatrixCapabilities.MSC3846TurnServers);\n }\n\n widgetApi.on(`action:${WidgetApiToWidgetAction.SendEvent}`, this.onEvent);\n widgetApi.on(`action:${WidgetApiToWidgetAction.SendToDevice}`, this.onToDevice);\n\n // Open communication with the host\n widgetApi.start();\n // Send a content loaded event now we've started the widget API\n // Note that element-web currently does not use waitForIFrameLoad=false and so\n // does *not* (yes, that is the right way around) wait for this event. Let's\n // start sending this, then once this has rolled out, we can change element-web to\n // use waitForIFrameLoad=false and have a widget API that's less racy.\n if (sendContentLoaded) widgetApi.sendContentLoaded();\n }\n\n public async startClient(opts: IStartClientOpts = {}): Promise<void> {\n this.lifecycle = new AbortController();\n\n // Create our own user object artificially (instead of waiting for sync)\n // so it's always available, even if the user is not in any rooms etc.\n const userId = this.getUserId();\n if (userId) {\n this.store.storeUser(new User(userId));\n }\n\n // Even though we have no access token and cannot sync, the sync class\n // still has some valuable helper methods that we make use of, so we\n // instantiate it anyways\n if (opts.slidingSync) {\n this.syncApi = new SlidingSyncSdk(opts.slidingSync, this, opts, this.buildSyncApiOptions());\n } else {\n this.syncApi = new SyncApi(this, opts, this.buildSyncApiOptions());\n }\n\n this.room = this.syncApi.createRoom(this.roomId);\n this.store.storeRoom(this.room);\n\n await this.widgetApiReady;\n\n // Backfill the requested events\n // We only get the most recent event for every type + state key combo,\n // so it doesn't really matter what order we inject them in\n await Promise.all(\n this.capabilities.receiveState?.map(async ({ eventType, stateKey }) => {\n const rawEvents = await this.widgetApi.readStateEvents(eventType, undefined, stateKey, [this.roomId]);\n const events = rawEvents.map((rawEvent) => new MatrixEvent(rawEvent as Partial<IEvent>));\n\n await this.syncApi!.injectRoomEvents(this.room!, [], events);\n events.forEach((event) => {\n this.emit(ClientEvent.Event, event);\n logger.info(`Backfilled event ${event.getId()} ${event.getType()} ${event.getStateKey()}`);\n });\n }) ?? [],\n );\n\n if (opts.clientWellKnownPollPeriod !== undefined) {\n this.clientWellKnownIntervalID = setInterval(() => {\n this.fetchClientWellKnown();\n }, 1000 * opts.clientWellKnownPollPeriod);\n this.fetchClientWellKnown();\n }\n\n this.setSyncState(SyncState.Syncing);\n logger.info(\"Finished backfilling events\");\n\n this.matrixRTC.start();\n\n // Watch for TURN servers, if requested\n if (this.capabilities.turnServers) this.watchTurnServers();\n }\n\n public stopClient(): void {\n this.widgetApi.off(`action:${WidgetApiToWidgetAction.SendEvent}`, this.onEvent);\n this.widgetApi.off(`action:${WidgetApiToWidgetAction.SendToDevice}`, this.onToDevice);\n\n super.stopClient();\n this.lifecycle!.abort(); // Signal to other async tasks that the client has stopped\n }\n\n public async joinRoom(roomIdOrAlias: string): Promise<Room> {\n if (roomIdOrAlias === this.roomId) return this.room!;\n throw new Error(`Unknown room: ${roomIdOrAlias}`);\n }\n\n protected async encryptAndSendEvent(room: Room, event: MatrixEvent): Promise<ISendEventResponse>;\n protected async encryptAndSendEvent(\n room: Room,\n event: MatrixEvent,\n delayOpts: SendDelayedEventRequestOpts,\n ): Promise<SendDelayedEventResponse>;\n protected async encryptAndSendEvent(\n room: Room,\n event: MatrixEvent,\n delayOpts?: SendDelayedEventRequestOpts,\n ): Promise<ISendEventResponse | SendDelayedEventResponse> {\n // We need to extend the content with the redacts parameter\n // The js sdk uses event.redacts but the widget api uses event.content.redacts\n // This will be converted back to event.redacts in the widget driver.\n const content = event.event.redacts\n ? { ...event.getContent(), redacts: event.event.redacts }\n : event.getContent();\n\n // Delayed event special case.\n if (delayOpts) {\n // TODO: updatePendingEvent for delayed events?\n const response = await this.widgetApi.sendRoomEvent(\n event.getType(),\n content,\n room.roomId,\n \"delay\" in delayOpts ? delayOpts.delay : undefined,\n \"parent_delay_id\" in delayOpts ? delayOpts.parent_delay_id : undefined,\n );\n return this.validateSendDelayedEventResponse(response);\n }\n\n const txId = event.getTxnId();\n // Add the txnId to the pending list (still with unknown evID)\n if (txId) this.pendingSendingEventsTxId.push({ type: event.getType(), id: undefined, txId });\n\n let response: ISendEventFromWidgetResponseData;\n try {\n response = await this.widgetApi.sendRoomEvent(event.getType(), content, room.roomId);\n } catch (e) {\n this.updatePendingEventStatus(room, event, EventStatus.NOT_SENT);\n throw e;\n }\n // This also checks for an event id on the response\n room.updatePendingEvent(event, EventStatus.SENT, response.event_id);\n\n // Update the pending events list with the eventId\n this.pendingSendingEventsTxId.forEach((p) => {\n if (p.txId === txId) p.id = response.event_id;\n });\n this.eventEmitter.emit(RoomWidgetClientEvent.PendingEventsChanged);\n\n return { event_id: response.event_id! };\n }\n\n public async sendStateEvent(\n roomId: string,\n eventType: string,\n content: any,\n stateKey = \"\",\n ): Promise<ISendEventResponse> {\n const response = await this.widgetApi.sendStateEvent(eventType, stateKey, content, roomId);\n if (response.event_id === undefined) {\n throw new Error(\"'event_id' absent from response to an event request\");\n }\n return { event_id: response.event_id };\n }\n\n /**\n * @experimental This currently relies on an unstable MSC (MSC4140).\n */\n // eslint-disable-next-line\n public async _unstable_sendDelayedStateEvent<K extends keyof StateEvents>(\n roomId: string,\n delayOpts: SendDelayedEventRequestOpts,\n eventType: K,\n content: StateEvents[K],\n stateKey = \"\",\n ): Promise<SendDelayedEventResponse> {\n if (!(await this.doesServerSupportUnstableFeature(UNSTABLE_MSC4140_DELAYED_EVENTS))) {\n throw Error(\"Server does not support the delayed events API\");\n }\n\n const response = await this.widgetApi.sendStateEvent(\n eventType,\n stateKey,\n content,\n roomId,\n \"delay\" in delayOpts ? delayOpts.delay : undefined,\n \"parent_delay_id\" in delayOpts ? delayOpts.parent_delay_id : undefined,\n );\n return this.validateSendDelayedEventResponse(response);\n }\n\n private validateSendDelayedEventResponse(response: ISendEventFromWidgetResponseData): SendDelayedEventResponse {\n if (response.delay_id === undefined) {\n throw new Error(\"'delay_id' absent from response to a delayed event request\");\n }\n return { delay_id: response.delay_id };\n }\n\n /**\n * @experimental This currently relies on an unstable MSC (MSC4140).\n */\n // eslint-disable-next-line\n public async _unstable_updateDelayedEvent(delayId: string, action: UpdateDelayedEventAction): Promise<{}> {\n if (!(await this.doesServerSupportUnstableFeature(UNSTABLE_MSC4140_DELAYED_EVENTS))) {\n throw Error(\"Server does not support the delayed events API\");\n }\n\n return await this.widgetApi.updateDelayedEvent(delayId, action);\n }\n\n public async sendToDevice(eventType: string, contentMap: SendToDeviceContentMap): Promise<{}> {\n await this.widgetApi.sendToDevice(eventType, false, recursiveMapToObject(contentMap));\n return {};\n }\n\n public async getOpenIdToken(): Promise<IOpenIDToken> {\n const token = await this.widgetApi.requestOpenIDConnectToken();\n // the IOpenIDCredentials from the widget-api and IOpenIDToken form the matrix-js-sdk are compatible.\n // we still recreate the token to make this transparent and catch'able by the linter in case the types change in the future.\n return <IOpenIDToken>{\n access_token: token.access_token,\n expires_in: token.expires_in,\n matrix_server_name: token.matrix_server_name,\n token_type: token.token_type,\n };\n }\n\n public async queueToDevice({ eventType, batch }: ToDeviceBatch): Promise<void> {\n // map: user Id → device Id → payload\n const contentMap: MapWithDefault<string, Map<string, ToDevicePayload>> = new MapWithDefault(() => new Map());\n for (const { userId, deviceId, payload } of batch) {\n contentMap.getOrCreate(userId).set(deviceId, payload);\n }\n\n await this.widgetApi.sendToDevice(eventType, false, recursiveMapToObject(contentMap));\n }\n\n public async encryptAndSendToDevices(userDeviceInfoArr: IOlmDevice<DeviceInfo>[], payload: object): Promise<void> {\n // map: user Id → device Id → payload\n const contentMap: MapWithDefault<string, Map<string, object>> = new MapWithDefault(() => new Map());\n for (const {\n userId,\n deviceInfo: { deviceId },\n } of userDeviceInfoArr) {\n contentMap.getOrCreate(userId).set(deviceId, payload);\n }\n\n await this.widgetApi.sendToDevice((payload as { type: string }).type, true, recursiveMapToObject(contentMap));\n }\n\n /**\n * Send an event to a specific list of devices via the widget API. Optionally encrypts the event.\n *\n * If you are using a full MatrixClient you would be calling {@link MatrixClient.getCrypto().encryptToDeviceMessages()} followed\n * by {@link MatrixClient.queueToDevice}.\n *\n * However, this is combined into a single step when running as an embedded widget client. So, we expose this method for those\n * that need it.\n *\n * @param eventType - Type of the event to send.\n * @param encrypted - Whether the event should be encrypted.\n * @param contentMap - The content to send. Map from user_id to device_id to content object.\n */\n public async sendToDeviceViaWidgetApi(\n eventType: string,\n encrypted: boolean,\n contentMap: SendToDeviceContentMap,\n ): Promise<void> {\n await this.widgetApi.sendToDevice(eventType, encrypted, recursiveMapToObject(contentMap));\n }\n\n // Overridden since we get TURN servers automatically over the widget API,\n // and this method would otherwise complain about missing an access token\n public async checkTurnServers(): Promise<boolean> {\n return this.turnServers.length > 0;\n }\n\n // Overridden since we 'sync' manually without the sync API\n public getSyncState(): SyncState | null {\n return this.syncState;\n }\n\n private setSyncState(state: SyncState): void {\n const oldState = this.syncState;\n this.syncState = state;\n this.emit(ClientEvent.Sync, state, oldState);\n }\n\n private async ack(ev: CustomEvent<IWidgetApiRequest>): Promise<void> {\n await this.widgetApi.transport.reply<IWidgetApiAcknowledgeResponseData>(ev.detail, {});\n }\n\n private updateTxId = async (event: MatrixEvent): Promise<void> => {\n // We update the txId for remote echos that originate from this client.\n // This happens with the help of `pendingSendingEventsTxId` where we store all events that are currently sending\n // with their widget txId and once ready the final evId.\n if (\n // This could theoretically be an event send by this device\n // In that case we need to update the txId of the event because the embedded client/widget\n // knows this event with a different transaction Id than what was used by the host client.\n event.getSender() === this.getUserId() &&\n // We optimize by not blocking events from types that we have not send\n // with this client.\n this.pendingSendingEventsTxId.some((p) => event.getType() === p.type)\n ) {\n // Compare by event Id if we have a matching pending event where we know the txId.\n let matchingTxId = this.pendingSendingEventsTxId.find((p) => p.id === event.getId())?.txId;\n // Block any further processing of this event until we have received the sending response.\n // -> until we know the event id.\n // -> until we have not pending events anymore.\n while (!matchingTxId && this.pendingSendingEventsTxId.length > 0) {\n // Recheck whenever the PendingEventsChanged\n await new Promise<void>((resolve) =>\n this.eventEmitter.once(RoomWidgetClientEvent.PendingEventsChanged, () => resolve()),\n );\n matchingTxId = this.pendingSendingEventsTxId.find((p) => p.id === event.getId())?.txId;\n }\n\n // We found the correct txId: we update the event and delete the entry of the pending events.\n if (matchingTxId) {\n event.setTxnId(matchingTxId);\n event.setUnsigned({ ...event.getUnsigned(), transaction_id: matchingTxId });\n }\n this.pendingSendingEventsTxId = this.pendingSendingEventsTxId.filter((p) => p.id !== event.getId());\n\n // Emit once there are no pending events anymore to release all other events that got\n // awaited in the `while (!matchingTxId && this.pendingSendingEventsTxId.length > 0)` loop\n // but are not send by this client.\n if (this.pendingSendingEventsTxId.length === 0) {\n this.eventEmitter.emit(RoomWidgetClientEvent.PendingEventsChanged);\n }\n }\n };\n\n private onEvent = async (ev: CustomEvent<ISendEventToWidgetActionRequest>): Promise<void> => {\n ev.preventDefault();\n\n // Verify the room ID matches, since it's possible for the client to\n // send us events from other rooms if this widget is always on screen\n if (ev.detail.data.room_id === this.roomId) {\n const event = new MatrixEvent(ev.detail.data as Partial<IEvent>);\n\n // Only inject once we have update the txId\n await this.updateTxId(event);\n await this.syncApi!.injectRoomEvents(this.room!, [], [event]);\n this.emit(ClientEvent.Event, event);\n this.setSyncState(SyncState.Syncing);\n logger.info(`Received event ${event.getId()} ${event.getType()} ${event.getStateKey()}`);\n } else {\n const { event_id: eventId, room_id: roomId } = ev.detail.data;\n logger.info(`Received event ${eventId} for a different room ${roomId}; discarding`);\n }\n\n await this.ack(ev);\n };\n\n private onToDevice = async (ev: CustomEvent<ISendToDeviceToWidgetActionRequest>): Promise<void> => {\n ev.preventDefault();\n\n const event = new MatrixEvent({\n type: ev.detail.data.type,\n sender: ev.detail.data.sender,\n content: ev.detail.data.content as IContent,\n });\n // Mark the event as encrypted if it was, using fake contents and keys since those are unknown to us\n if (ev.detail.data.encrypted) event.makeEncrypted(EventType.RoomMessageEncrypted, {}, \"\", \"\");\n\n this.emit(ClientEvent.ToDeviceEvent, event);\n this.setSyncState(SyncState.Syncing);\n await this.ack(ev);\n };\n\n private async watchTurnServers(): Promise<void> {\n const servers = this.widgetApi.getTurnServers();\n const onClientStopped = (): void => {\n servers.return(undefined);\n };\n this.lifecycle!.signal.addEventListener(\"abort\", onClientStopped);\n\n try {\n for await (const server of servers) {\n this.turnServers = [\n {\n urls: server.uris,\n username: server.username,\n credential: server.password,\n },\n ];\n this.emit(ClientEvent.TurnServers, this.turnServers);\n logger.log(`Received TURN server: ${server.uris}`);\n }\n } catch (e) {\n logger.warn(\"Error watching TURN servers\", e);\n } finally {\n this.lifecycle!.signal.removeEventListener(\"abort\", onClientStopped);\n }\n }\n}\n\nfunction processAndThrow(error: unknown): never {\n if (error instanceof WidgetApiResponseError && error.data.matrix_api_error) {\n throw MatrixError.fromWidgetApiErrorData(error.data.matrix_api_error);\n } else {\n throw error;\n }\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAEIA,uBAAuB,EACvBC,sBAAsB,EACtBC,kBAAkB,QAUf,mBAAmB;AAE1B,SAASC,WAAW,EAAoBC,WAAW,QAAQ,mBAAmB;AAO9E,SAASC,SAAS,QAAqB,mBAAmB;AAC1D,SAASC,MAAM,QAAQ,aAAa;AACpC,SACIC,YAAY,EACZC,WAAW,EAKXC,+BAA+B,QAC5B,aAAa;AACpB,SAASC,OAAO,EAAEC,SAAS,QAAQ,WAAW;AAC9C,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,WAAW,QAAQ,sBAAsB;AAClD,SAASC,IAAI,QAAQ,kBAAkB;AAKvC,SAASC,cAAc,EAAEC,oBAAoB,QAAQ,YAAY;AACjE,SAASC,iBAAiB,QAAQ,aAAa;AAmE/C,WAAYC,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAIjC;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,SAASZ,YAAY,CAAC;EAS/C;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACWa,WAAWA,CACGC,SAAoB,EACpBC,YAA2B,EAC3BC,MAAc,EAC/BC,IAA6B,EAC7BC,iBAA0B,EAC5B;IAAA,IAAAC,KAAA,EAAAC,qBAAA,EAAAC,qBAAA,EAAA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mBAAmB,CAAC,OAAO,EAAEvB,eAAe,CAAC;MACxE;IAAC;EACL;AACJ;AAEA,SAAStJ,eAAeA,CAACD,KAAc,EAAS;EAC5C,IAAIA,KAAK,YAAY3G,sBAAsB,IAAI2G,KAAK,CAAC9B,IAAI,CAAC6M,gBAAgB,EAAE;IACxE,MAAM9Q,WAAW,CAAC+Q,sBAAsB,CAAChL,KAAK,CAAC9B,IAAI,CAAC6M,gBAAgB,CAAC;EACzE,CAAC,MAAM;IACH,MAAM/K,KAAK;EACf;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"embedded.js","names":["WidgetApiToWidgetAction","WidgetApiResponseError","MatrixCapabilities","MatrixEvent","logger","MatrixClient","ClientEvent","UNSTABLE_MSC4140_DELAYED_EVENTS","SyncApi","SyncState","SlidingSyncSdk","MatrixError","User","MapWithDefault","recursiveMapToObject","TypedEventEmitter","RoomWidgetClientEvent","RoomWidgetClient","constructor","widgetApi","capabilities","roomId","opts","sendContentLoaded","_this","_capabilities$receive","_capabilities$sendEve","_capabilities$receive2","_capabilities$sendSta","_capabilities$receive3","_capabilities$sendEve2","_capabilities$receive4","_capabilities$sendSta2","_capabilities$receive5","_capabilities$sendToD","_capabilities$receive6","_capabilities$sendEve3","_capabilities$sendSta3","this","_defineProperty","_ref","_asyncToGenerator","event","getSender","getUserId","pendingSendingEventsTxId","some","p","getType","type","_this$pendingSendingE","matchingTxId","find","id","getId","txId","length","_this$pendingSendingE2","Promise","resolve","eventEmitter","once","PendingEventsChanged","setTxnId","setUnsigned","_objectSpread","getUnsigned","transaction_id","filter","emit","_x","apply","arguments","_ref2","ev","preventDefault","detail","data","room_id","updateTxId","syncApi","injectRoomEvents","room","undefined","Event","setSyncState","Syncing","info","concat","event_id","eventId","ack","_x2","_ref3","sender","content","ToDeviceEvent","_x3","_ref4","rawEvent","state","getStateKey","_x4","transportSend","transport","send","bind","_ref5","action","error","processAndThrow","_x5","_x6","transportSendComplete","sendComplete","_ref6","_x7","_x8","widgetApiReady","roomStateSynced","receiveState","UpdateState","sendEvent","receiveEvent","sendMessage","Array","isArray","receiveMessage","sendState","requestCapabilityForRoomTimeline","forEach","eventType","requestCapabilityToSendEvent","requestCapabilityToReceiveEvent","requestCapabilityToSendMessage","msgType","requestCapabilityToReceiveMessage","_ref7","stateKey","requestCapabilityToSendState","_ref8","requestCapabilityToReceiveState","sendToDevice","requestCapabilityToSendToDevice","receiveToDevice","requestCapabilityToReceiveToDevice","sendDelayedEvents","requestCapability","MSC4157SendDelayedEvent","updateDelayedEvents","MSC4157UpdateDelayedEvent","turnServers","MSC3846TurnServers","on","SendEvent","onEvent","SendToDevice","onToDevice","onStateUpdate","start","startClient","_arguments","_this2","lifecycle","AbortController","userId","store","storeUser","slidingSync","buildSyncApiOptions","createRoom","storeRoom","clientWellKnownPollPeriod","clientWellKnownIntervalID","setInterval","fetchClientWellKnown","stopClient","off","abort","joinRoom","roomIdOrAlias","_this3","Error","sendStateEvent","_arguments2","_this4","response","_unstable_sendDelayedStateEvent","delayOpts","_arguments3","_this5","doesServerSupportUnstableFeature","delay","parent_delay_id","validateSendDelayedEventResponse","delay_id","_unstable_updateDelayedEvent","delayId","_this6","updateDelayedEvent","contentMap","_this7","getOpenIdToken","_this8","token","requestOpenIDConnectToken","access_token","expires_in","matrix_server_name","token_type","queueToDevice","_ref9","_this9","batch","Map","deviceId","payload","getOrCreate","set","getSyncState","syncState","oldState","Sync","_this10","reply","matrix_api_error","fromWidgetApiErrorData"],"sources":["../src/embedded.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport {\n WidgetApi,\n WidgetApiToWidgetAction,\n WidgetApiResponseError,\n MatrixCapabilities,\n IWidgetApiRequest,\n IWidgetApiAcknowledgeResponseData,\n ISendEventToWidgetActionRequest,\n ISendToDeviceToWidgetActionRequest,\n ISendEventFromWidgetResponseData,\n IWidgetApiRequestData,\n WidgetApiAction,\n IWidgetApiResponse,\n IWidgetApiResponseData,\n IUpdateStateToWidgetActionRequest,\n} from \"matrix-widget-api\";\n\nimport { MatrixEvent, IEvent, IContent } from \"./models/event.ts\";\nimport {\n ISendEventResponse,\n SendDelayedEventRequestOpts,\n SendDelayedEventResponse,\n UpdateDelayedEventAction,\n} from \"./@types/requests.ts\";\nimport { StateEvents } from \"./@types/event.ts\";\nimport { logger } from \"./logger.ts\";\nimport {\n MatrixClient,\n ClientEvent,\n IMatrixClientCreateOpts,\n IStartClientOpts,\n SendToDeviceContentMap,\n IOpenIDToken,\n UNSTABLE_MSC4140_DELAYED_EVENTS,\n} from \"./client.ts\";\nimport { SyncApi, SyncState } from \"./sync.ts\";\nimport { SlidingSyncSdk } from \"./sliding-sync-sdk.ts\";\nimport { MatrixError } from \"./http-api/errors.ts\";\nimport { User } from \"./models/user.ts\";\nimport { Room } from \"./models/room.ts\";\nimport { ToDeviceBatch, ToDevicePayload } from \"./models/ToDeviceMessage.ts\";\nimport { MapWithDefault, recursiveMapToObject } from \"./utils.ts\";\nimport { TypedEventEmitter } from \"./matrix.ts\";\n\ninterface IStateEventRequest {\n eventType: string;\n stateKey?: string;\n}\n\nexport interface ICapabilities {\n /**\n * Event types that this client expects to send.\n */\n sendEvent?: string[];\n /**\n * Event types that this client expects to receive.\n */\n receiveEvent?: string[];\n\n /**\n * Message types that this client expects to send, or true for all message\n * types.\n */\n sendMessage?: string[] | true;\n /**\n * Message types that this client expects to receive, or true for all\n * message types.\n */\n receiveMessage?: string[] | true;\n\n /**\n * Types of state events that this client expects to send.\n */\n sendState?: IStateEventRequest[];\n /**\n * Types of state events that this client expects to receive.\n */\n receiveState?: IStateEventRequest[];\n\n /**\n * To-device event types that this client expects to send.\n */\n sendToDevice?: string[];\n /**\n * To-device event types that this client expects to receive.\n */\n receiveToDevice?: string[];\n\n /**\n * Whether this client needs access to TURN servers.\n * @defaultValue false\n */\n turnServers?: boolean;\n\n /**\n * Whether this client needs to be able to send delayed events.\n * @experimental Part of MSC4140 & MSC4157\n * @defaultValue false\n */\n sendDelayedEvents?: boolean;\n\n /**\n * Whether this client needs to be able to update delayed events.\n * @experimental Part of MSC4140 & MSC4157\n * @defaultValue false\n */\n updateDelayedEvents?: boolean;\n}\n\nexport enum RoomWidgetClientEvent {\n PendingEventsChanged = \"PendingEvent.pendingEventsChanged\",\n}\nexport type EventHandlerMap = { [RoomWidgetClientEvent.PendingEventsChanged]: () => void };\n/**\n * A MatrixClient that routes its requests through the widget API instead of the\n * real CS API.\n * @experimental This class is considered unstable!\n */\nexport class RoomWidgetClient extends MatrixClient {\n private room?: Room;\n private readonly widgetApiReady: Promise<void>;\n private readonly roomStateSynced: Promise<void>;\n private lifecycle?: AbortController;\n private syncState: SyncState | null = null;\n\n private pendingSendingEventsTxId: { type: string; id: string | undefined; txId: string }[] = [];\n private eventEmitter = new TypedEventEmitter<keyof EventHandlerMap, EventHandlerMap>();\n\n /**\n *\n * @param widgetApi - The widget api to use for communication.\n * @param capabilities - The capabilities the widget client will request.\n * @param roomId - The room id the widget is associated with.\n * @param opts - The configuration options for this client.\n * @param sendContentLoaded - Whether to send a content loaded widget action immediately after initial setup.\n * Set to `false` if the widget uses `waitForIFrameLoad=true` (in this case the client does not expect a content loaded action at all),\n * or if the the widget wants to send the `ContentLoaded` action at a later point in time after the initial setup.\n */\n public constructor(\n private readonly widgetApi: WidgetApi,\n /*private readonly */capabilities: ICapabilities,\n private readonly roomId: string,\n opts: IMatrixClientCreateOpts,\n sendContentLoaded: boolean,\n ) {\n super(opts);\n\n const transportSend = this.widgetApi.transport.send.bind(this.widgetApi.transport);\n this.widgetApi.transport.send = async <\n T extends IWidgetApiRequestData,\n R extends IWidgetApiResponseData = IWidgetApiAcknowledgeResponseData,\n >(\n action: WidgetApiAction,\n data: T,\n ): Promise<R> => {\n try {\n return await transportSend(action, data);\n } catch (error) {\n processAndThrow(error);\n }\n };\n\n const transportSendComplete = this.widgetApi.transport.sendComplete.bind(this.widgetApi.transport);\n this.widgetApi.transport.sendComplete = async <T extends IWidgetApiRequestData, R extends IWidgetApiResponse>(\n action: WidgetApiAction,\n data: T,\n ): Promise<R> => {\n try {\n return await transportSendComplete(action, data);\n } catch (error) {\n processAndThrow(error);\n }\n };\n\n this.widgetApiReady = new Promise<void>((resolve) => this.widgetApi.once(\"ready\", resolve));\n this.roomStateSynced = capabilities.receiveState?.length\n ? new Promise<void>((resolve) =>\n this.widgetApi.once(`action:${WidgetApiToWidgetAction.UpdateState}`, resolve),\n )\n : Promise.resolve();\n\n // Request capabilities for the functionality this client needs to support\n if (\n capabilities.sendEvent?.length ||\n capabilities.receiveEvent?.length ||\n capabilities.sendMessage === true ||\n (Array.isArray(capabilities.sendMessage) && capabilities.sendMessage.length) ||\n capabilities.receiveMessage === true ||\n (Array.isArray(capabilities.receiveMessage) && capabilities.receiveMessage.length) ||\n capabilities.sendState?.length ||\n capabilities.receiveState?.length\n ) {\n widgetApi.requestCapabilityForRoomTimeline(roomId);\n }\n capabilities.sendEvent?.forEach((eventType) => widgetApi.requestCapabilityToSendEvent(eventType));\n capabilities.receiveEvent?.forEach((eventType) => widgetApi.requestCapabilityToReceiveEvent(eventType));\n if (capabilities.sendMessage === true) {\n widgetApi.requestCapabilityToSendMessage();\n } else if (Array.isArray(capabilities.sendMessage)) {\n capabilities.sendMessage.forEach((msgType) => widgetApi.requestCapabilityToSendMessage(msgType));\n }\n if (capabilities.receiveMessage === true) {\n widgetApi.requestCapabilityToReceiveMessage();\n } else if (Array.isArray(capabilities.receiveMessage)) {\n capabilities.receiveMessage.forEach((msgType) => widgetApi.requestCapabilityToReceiveMessage(msgType));\n }\n capabilities.sendState?.forEach(({ eventType, stateKey }) =>\n widgetApi.requestCapabilityToSendState(eventType, stateKey),\n );\n capabilities.receiveState?.forEach(({ eventType, stateKey }) =>\n widgetApi.requestCapabilityToReceiveState(eventType, stateKey),\n );\n capabilities.sendToDevice?.forEach((eventType) => widgetApi.requestCapabilityToSendToDevice(eventType));\n capabilities.receiveToDevice?.forEach((eventType) => widgetApi.requestCapabilityToReceiveToDevice(eventType));\n if (\n capabilities.sendDelayedEvents &&\n (capabilities.sendEvent?.length ||\n capabilities.sendMessage === true ||\n (Array.isArray(capabilities.sendMessage) && capabilities.sendMessage.length) ||\n capabilities.sendState?.length)\n ) {\n widgetApi.requestCapability(MatrixCapabilities.MSC4157SendDelayedEvent);\n }\n if (capabilities.updateDelayedEvents) {\n widgetApi.requestCapability(MatrixCapabilities.MSC4157UpdateDelayedEvent);\n }\n if (capabilities.turnServers) {\n widgetApi.requestCapability(MatrixCapabilities.MSC3846TurnServers);\n }\n\n widgetApi.on(`action:${WidgetApiToWidgetAction.SendEvent}`, this.onEvent);\n widgetApi.on(`action:${WidgetApiToWidgetAction.SendToDevice}`, this.onToDevice);\n widgetApi.on(`action:${WidgetApiToWidgetAction.UpdateState}`, this.onStateUpdate);\n\n // Open communication with the host\n widgetApi.start();\n // Send a content loaded event now we've started the widget API\n // Note that element-web currently does not use waitForIFrameLoad=false and so\n // does *not* (yes, that is the right way around) wait for this event. Let's\n // start sending this, then once this has rolled out, we can change element-web to\n // use waitForIFrameLoad=false and have a widget API that's less racy.\n if (sendContentLoaded) widgetApi.sendContentLoaded();\n }\n\n public async startClient(opts: IStartClientOpts = {}): Promise<void> {\n this.lifecycle = new AbortController();\n\n // Create our own user object artificially (instead of waiting for sync)\n // so it's always available, even if the user is not in any rooms etc.\n const userId = this.getUserId();\n if (userId) {\n this.store.storeUser(new User(userId));\n }\n\n // Even though we have no access token and cannot sync, the sync class\n // still has some valuable helper methods that we make use of, so we\n // instantiate it anyways\n if (opts.slidingSync) {\n this.syncApi = new SlidingSyncSdk(opts.slidingSync, this, opts);\n } else {\n this.syncApi = new SyncApi(this, opts, this.buildSyncApiOptions());\n }\n\n this.room = this.syncApi.createRoom(this.roomId);\n this.store.storeRoom(this.room);\n\n await this.widgetApiReady;\n\n if (opts.clientWellKnownPollPeriod !== undefined) {\n this.clientWellKnownIntervalID = setInterval(() => {\n this.fetchClientWellKnown();\n }, 1000 * opts.clientWellKnownPollPeriod);\n this.fetchClientWellKnown();\n }\n\n await this.roomStateSynced;\n this.setSyncState(SyncState.Syncing);\n logger.info(\"Finished initial sync\");\n }\n\n public stopClient(): void {\n this.widgetApi.off(`action:${WidgetApiToWidgetAction.SendEvent}`, this.onEvent);\n this.widgetApi.off(`action:${WidgetApiToWidgetAction.SendToDevice}`, this.onToDevice);\n this.widgetApi.off(`action:${WidgetApiToWidgetAction.UpdateState}`, this.onStateUpdate);\n\n super.stopClient();\n this.lifecycle!.abort(); // Signal to other async tasks that the client has stopped\n }\n\n public async joinRoom(roomIdOrAlias: string): Promise<Room> {\n if (roomIdOrAlias === this.roomId) return this.room!;\n throw new Error(`Unknown room: ${roomIdOrAlias}`);\n }\n\n public async sendStateEvent(\n roomId: string,\n eventType: string,\n content: any,\n stateKey = \"\",\n ): Promise<ISendEventResponse> {\n const response = await this.widgetApi.sendStateEvent(eventType, stateKey, content, roomId);\n if (response.event_id === undefined) {\n throw new Error(\"'event_id' absent from response to an event request\");\n }\n return { event_id: response.event_id };\n }\n\n /**\n * @experimental This currently relies on an unstable MSC (MSC4140).\n */\n // eslint-disable-next-line\n public async _unstable_sendDelayedStateEvent<K extends keyof StateEvents>(\n roomId: string,\n delayOpts: SendDelayedEventRequestOpts,\n eventType: K,\n content: StateEvents[K],\n stateKey = \"\",\n ): Promise<SendDelayedEventResponse> {\n if (!(await this.doesServerSupportUnstableFeature(UNSTABLE_MSC4140_DELAYED_EVENTS))) {\n throw Error(\"Server does not support the delayed events API\");\n }\n\n const response = await this.widgetApi.sendStateEvent(\n eventType,\n stateKey,\n content,\n roomId,\n \"delay\" in delayOpts ? delayOpts.delay : undefined,\n \"parent_delay_id\" in delayOpts ? delayOpts.parent_delay_id : undefined,\n );\n return this.validateSendDelayedEventResponse(response);\n }\n\n private validateSendDelayedEventResponse(response: ISendEventFromWidgetResponseData): SendDelayedEventResponse {\n if (response.delay_id === undefined) {\n throw new Error(\"'delay_id' absent from response to a delayed event request\");\n }\n return { delay_id: response.delay_id };\n }\n\n /**\n * @experimental This currently relies on an unstable MSC (MSC4140).\n */\n // eslint-disable-next-line\n public async _unstable_updateDelayedEvent(delayId: string, action: UpdateDelayedEventAction): Promise<{}> {\n if (!(await this.doesServerSupportUnstableFeature(UNSTABLE_MSC4140_DELAYED_EVENTS))) {\n throw Error(\"Server does not support the delayed events API\");\n }\n\n return await this.widgetApi.updateDelayedEvent(delayId, action);\n }\n\n public async sendToDevice(eventType: string, contentMap: SendToDeviceContentMap): Promise<{}> {\n await this.widgetApi.sendToDevice(eventType, false, recursiveMapToObject(contentMap));\n return {};\n }\n\n public async getOpenIdToken(): Promise<IOpenIDToken> {\n const token = await this.widgetApi.requestOpenIDConnectToken();\n // the IOpenIDCredentials from the widget-api and IOpenIDToken form the matrix-js-sdk are compatible.\n // we still recreate the token to make this transparent and catch'able by the linter in case the types change in the future.\n return <IOpenIDToken>{\n access_token: token.access_token,\n expires_in: token.expires_in,\n matrix_server_name: token.matrix_server_name,\n token_type: token.token_type,\n };\n }\n\n public async queueToDevice({ eventType, batch }: ToDeviceBatch): Promise<void> {\n // map: user Id → device Id → payload\n const contentMap: MapWithDefault<string, Map<string, ToDevicePayload>> = new MapWithDefault(() => new Map());\n for (const { userId, deviceId, payload } of batch) {\n contentMap.getOrCreate(userId).set(deviceId, payload);\n }\n\n await this.widgetApi.sendToDevice(eventType, false, recursiveMapToObject(contentMap));\n }\n\n // Overridden since we 'sync' manually without the sync API\n public getSyncState(): SyncState | null {\n return this.syncState;\n }\n\n private setSyncState(state: SyncState): void {\n const oldState = this.syncState;\n this.syncState = state;\n this.emit(ClientEvent.Sync, state, oldState);\n }\n\n private async ack(ev: CustomEvent<IWidgetApiRequest>): Promise<void> {\n await this.widgetApi.transport.reply<IWidgetApiAcknowledgeResponseData>(ev.detail, {});\n }\n\n private updateTxId = async (event: MatrixEvent): Promise<void> => {\n // We update the txId for remote echos that originate from this client.\n // This happens with the help of `pendingSendingEventsTxId` where we store all events that are currently sending\n // with their widget txId and once ready the final evId.\n if (\n // This could theoretically be an event send by this device\n // In that case we need to update the txId of the event because the embedded client/widget\n // knows this event with a different transaction Id than what was used by the host client.\n event.getSender() === this.getUserId() &&\n // We optimize by not blocking events from types that we have not send\n // with this client.\n this.pendingSendingEventsTxId.some((p) => event.getType() === p.type)\n ) {\n // Compare by event Id if we have a matching pending event where we know the txId.\n let matchingTxId = this.pendingSendingEventsTxId.find((p) => p.id === event.getId())?.txId;\n // Block any further processing of this event until we have received the sending response.\n // -> until we know the event id.\n // -> until we have not pending events anymore.\n while (!matchingTxId && this.pendingSendingEventsTxId.length > 0) {\n // Recheck whenever the PendingEventsChanged\n await new Promise<void>((resolve) =>\n this.eventEmitter.once(RoomWidgetClientEvent.PendingEventsChanged, () => resolve()),\n );\n matchingTxId = this.pendingSendingEventsTxId.find((p) => p.id === event.getId())?.txId;\n }\n\n // We found the correct txId: we update the event and delete the entry of the pending events.\n if (matchingTxId) {\n event.setTxnId(matchingTxId);\n event.setUnsigned({ ...event.getUnsigned(), transaction_id: matchingTxId });\n }\n this.pendingSendingEventsTxId = this.pendingSendingEventsTxId.filter((p) => p.id !== event.getId());\n\n // Emit once there are no pending events anymore to release all other events that got\n // awaited in the `while (!matchingTxId && this.pendingSendingEventsTxId.length > 0)` loop\n // but are not send by this client.\n if (this.pendingSendingEventsTxId.length === 0) {\n this.eventEmitter.emit(RoomWidgetClientEvent.PendingEventsChanged);\n }\n }\n };\n\n private onEvent = async (ev: CustomEvent<ISendEventToWidgetActionRequest>): Promise<void> => {\n ev.preventDefault();\n\n // Verify the room ID matches, since it's possible for the client to\n // send us events from other rooms if this widget is always on screen\n if (ev.detail.data.room_id === this.roomId) {\n const event = new MatrixEvent(ev.detail.data as Partial<IEvent>);\n\n // Only inject once we have update the txId\n await this.updateTxId(event);\n \n if (this.syncApi instanceof SyncApi) {\n await this.syncApi.injectRoomEvents(this.room!, undefined, [], [event]);\n } else {\n // Sliding Sync\n await this.syncApi!.injectRoomEvents(this.room!, [], [event]);\n }\n this.emit(ClientEvent.Event, event);\n this.setSyncState(SyncState.Syncing);\n logger.info(`Received event ${event.getId()} ${event.getType()}`);\n } else {\n const { event_id: eventId, room_id: roomId } = ev.detail.data;\n logger.info(`Received event ${eventId} for a different room ${roomId}; discarding`);\n }\n\n await this.ack(ev);\n };\n\n private onToDevice = async (ev: CustomEvent<ISendToDeviceToWidgetActionRequest>): Promise<void> => {\n ev.preventDefault();\n\n const event = new MatrixEvent({\n type: ev.detail.data.type,\n sender: ev.detail.data.sender,\n content: ev.detail.data.content as IContent,\n });\n\n this.emit(ClientEvent.ToDeviceEvent, event);\n this.setSyncState(SyncState.Syncing);\n await this.ack(ev);\n };\n\n private onStateUpdate = async (ev: CustomEvent<IUpdateStateToWidgetActionRequest>): Promise<void> => {\n ev.preventDefault();\n for (const rawEvent of ev.detail.data.state) {\n // Verify the room ID matches, since it's possible for the client to\n // send us state updates from other rooms if this widget is always\n // on screen\n if (rawEvent.room_id === this.roomId) {\n const event = new MatrixEvent(rawEvent as Partial<IEvent>);\n if (this.syncApi instanceof SyncApi) {\n await this.syncApi.injectRoomEvents(this.room!, undefined, [event]);\n } else {\n // Sliding Sync\n await this.syncApi!.injectRoomEvents(this.room!, [event]);\n }\n logger.info(`Updated state entry ${event.getType()} ${event.getStateKey()} to ${event.getId()}`);\n } else {\n const { event_id: eventId, room_id: roomId } = ev.detail.data;\n logger.info(`Received state entry ${eventId} for a different room ${roomId}; discarding`);\n }\n }\n await this.ack(ev);\n };\n}\n\nfunction processAndThrow(error: unknown): never {\n if (error instanceof WidgetApiResponseError && error.data.matrix_api_error) {\n throw MatrixError.fromWidgetApiErrorData(error.data.matrix_api_error);\n } else {\n throw error;\n }\n}\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAEIA,uBAAuB,EACvBC,sBAAsB,EACtBC,kBAAkB,QAWf,mBAAmB;AAE1B,SAASC,WAAW,QAA0B,mBAAmB;AAQjE,SAASC,MAAM,QAAQ,aAAa;AACpC,SACIC,YAAY,EACZC,WAAW,EAKXC,+BAA+B,QAC5B,aAAa;AACpB,SAASC,OAAO,EAAEC,SAAS,QAAQ,WAAW;AAC9C,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,WAAW,QAAQ,sBAAsB;AAClD,SAASC,IAAI,QAAQ,kBAAkB;AAGvC,SAASC,cAAc,EAAEC,oBAAoB,QAAQ,YAAY;AACjE,SAASC,iBAAiB,QAAQ,aAAa;AAmE/C,WAAYC,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAIjC;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,SAASZ,YAAY,CAAC;EAU/C;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACWa,WAAWA,CACGC,SAAoB,EACrC,qBAAqBC,YAA2B,EAC/BC,MAAc,EAC/BC,IAA6B,EAC7BC,iBAA0B,EAC5B;IAAA,IAAAC,KAAA,EAAAC,qBAAA,EAAAC,qBAAA,EAAAC,sBAAA,EAAAC,qBAAA,EAAAC,sBAAA,EAAAC,sBAAA,EAAAC,sBAAA,EAAAC,sBAAA,EAAAC,sBAAA,EAAAC,qBAAA,EAAAC,sBAAA,EAAAC,sBAAA,EAAAC,sBAAA;IACE,KAAK,CAACf,IAAI,CAAC;IAAAE,KAAA,GAAAc,IAAA;IAAA,KANMnB,SAAoB,GAApBA,SAAoB;IAAA,KAEpBE,MAAc,GAAdA,MAAc;IAAAkB,eAAA;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d.ts","sourceRoot":"","sources":["../src/event-mapper.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAoB,MAAM,mBAAmB,CAAC;AAG1E,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,WAAW,CAAC;AAEhE,MAAM,WAAW,UAAU;IAEvB,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,GAAG,WAAW,CAiErF"}
1
+ {"version":3,"file":"event-mapper.d.ts","sourceRoot":"","sources":["../src/event-mapper.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAoB,MAAM,mBAAmB,CAAC;AAG1E,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,WAAW,CAAC;AAEhE,MAAM,WAAW,UAAU;IAEvB,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,GAAG,WAAW,CA6DrF"}
@@ -21,7 +21,6 @@ import { MatrixEvent, MatrixEventEvent } from "./models/event.js";
21
21
  import { RelationType } from "./@types/event.js";
22
22
  export function eventMapperFor(client, options) {
23
23
  var preventReEmit = Boolean(options.preventReEmit);
24
- var decrypt = options.decrypt !== false;
25
24
  function mapper(plainOldJsObject) {
26
25
  if (options.toDevice) {
27
26
  delete plainOldJsObject.room_id;
@@ -66,9 +65,6 @@ export function eventMapperFor(client, options) {
66
65
  if (!preventReEmit) {
67
66
  client.reEmitter.reEmit(event, [MatrixEventEvent.Decrypted]);
68
67
  }
69
- if (decrypt) {
70
- client.decryptEventIfNeeded(event);
71
- }
72
68
  }
73
69
  if (!preventReEmit) {
74
70
  client.reEmitter.reEmit(event, [MatrixEventEvent.Replaced, MatrixEventEvent.VisibilityChange]);
@@ -1 +1 @@
1
- {"version":3,"file":"event-mapper.js","names":["MatrixEvent","MatrixEventEvent","RelationType","eventMapperFor","client","options","preventReEmit","Boolean","decrypt","mapper","plainOldJsObject","toDevice","room_id","room","getRoom","event","state_key","undefined","findEventById","event_id","status","setUnsigned","_objectSpread","getUnsigned","unsigned","bundledEdit","getServerAggregatedRelation","Replace","content","replacement","makeReplaced","thread","findThreadForEvent","setThread","isEncrypted","reEmitter","reEmit","Decrypted","decryptEventIfNeeded","Replaced","VisibilityChange","BeforeRedaction"],"sources":["../src/event-mapper.ts"],"sourcesContent":["/*\nCopyright 2021 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { MatrixClient } from \"./client.ts\";\nimport { IEvent, MatrixEvent, MatrixEventEvent } from \"./models/event.ts\";\nimport { RelationType } from \"./@types/event.ts\";\n\nexport type EventMapper = (obj: Partial<IEvent>) => MatrixEvent;\n\nexport interface MapperOpts {\n // don't re-emit events emitted on an event mapped by this mapper on the client\n preventReEmit?: boolean;\n // decrypt event proactively\n decrypt?: boolean;\n // the event is a to_device event\n toDevice?: boolean;\n}\n\nexport function eventMapperFor(client: MatrixClient, options: MapperOpts): EventMapper {\n let preventReEmit = Boolean(options.preventReEmit);\n const decrypt = options.decrypt !== false;\n\n function mapper(plainOldJsObject: Partial<IEvent>): MatrixEvent {\n if (options.toDevice) {\n delete plainOldJsObject.room_id;\n }\n\n const room = client.getRoom(plainOldJsObject.room_id);\n\n let event: MatrixEvent | undefined;\n // If the event is already known to the room, let's re-use the model rather than duplicating.\n // We avoid doing this to state events as they may be forward or backwards looking which tweaks behaviour.\n if (room && plainOldJsObject.state_key === undefined) {\n event = room.findEventById(plainOldJsObject.event_id!);\n }\n\n if (!event || event.status) {\n event = new MatrixEvent(plainOldJsObject);\n } else {\n // merge the latest unsigned data from the server\n event.setUnsigned({ ...event.getUnsigned(), ...plainOldJsObject.unsigned });\n // prevent doubling up re-emitters\n preventReEmit = true;\n }\n\n // if there is a complete edit bundled alongside the event, perform the replacement.\n // (prior to MSC3925, events were automatically replaced on the server-side. MSC3925 proposes that that doesn't\n // happen automatically but the server does provide us with the whole content of the edit event.)\n const bundledEdit = event.getServerAggregatedRelation<Partial<IEvent>>(RelationType.Replace);\n if (bundledEdit?.content) {\n const replacement = mapper(bundledEdit);\n // XXX: it's worth noting that the spec says we should only respect encrypted edits if, once decrypted, the\n // replacement has a `m.new_content` property. The problem is that we haven't yet decrypted the replacement\n // (it should be happening in the background), so we can't enforce this. Possibly we should for decryption\n // to complete, but that sounds a bit racy. For now, we just assume it's ok.\n event.makeReplaced(replacement);\n }\n\n const thread = room?.findThreadForEvent(event);\n if (thread) {\n event.setThread(thread);\n }\n\n // TODO: once we get rid of the old libolm-backed crypto, we can restrict this to room events (rather than\n // to-device events), because the rust implementation decrypts to-device messages at a higher level.\n // Generally we probably want to use a different eventMapper implementation for to-device events because\n if (event.isEncrypted()) {\n if (!preventReEmit) {\n client.reEmitter.reEmit(event, [MatrixEventEvent.Decrypted]);\n }\n if (decrypt) {\n client.decryptEventIfNeeded(event);\n }\n }\n\n if (!preventReEmit) {\n client.reEmitter.reEmit(event, [MatrixEventEvent.Replaced, MatrixEventEvent.VisibilityChange]);\n room?.reEmitter.reEmit(event, [MatrixEventEvent.BeforeRedaction]);\n }\n return event;\n }\n\n return mapper;\n}\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAAiBA,WAAW,EAAEC,gBAAgB,QAAQ,mBAAmB;AACzE,SAASC,YAAY,QAAQ,mBAAmB;AAahD,OAAO,SAASC,cAAcA,CAACC,MAAoB,EAAEC,OAAmB,EAAe;EACnF,IAAIC,aAAa,GAAGC,OAAO,CAACF,OAAO,CAACC,aAAa,CAAC;EAClD,IAAME,OAAO,GAAGH,OAAO,CAACG,OAAO,KAAK,KAAK;EAEzC,SAASC,MAAMA,CAACC,gBAAiC,EAAe;IAC5D,IAAIL,OAAO,CAACM,QAAQ,EAAE;MAClB,OAAOD,gBAAgB,CAACE,OAAO;IACnC;IAEA,IAAMC,IAAI,GAAGT,MAAM,CAACU,OAAO,CAACJ,gBAAgB,CAACE,OAAO,CAAC;IAErD,IAAIG,KAA8B;IAClC;IACA;IACA,IAAIF,IAAI,IAAIH,gBAAgB,CAACM,SAAS,KAAKC,SAAS,EAAE;MAClDF,KAAK,GAAGF,IAAI,CAACK,aAAa,CAACR,gBAAgB,CAACS,QAAS,CAAC;IAC1D;IAEA,IAAI,CAACJ,KAAK,IAAIA,KAAK,CAACK,MAAM,EAAE;MACxBL,KAAK,GAAG,IAAIf,WAAW,CAACU,gBAAgB,CAAC;IAC7C,CAAC,MAAM;MACH;MACAK,KAAK,CAACM,WAAW,CAAAC,aAAA,CAAAA,aAAA,KAAMP,KAAK,CAACQ,WAAW,CAAC,CAAC,GAAKb,gBAAgB,CAACc,QAAQ,CAAE,CAAC;MAC3E;MACAlB,aAAa,GAAG,IAAI;IACxB;;IAEA;IACA;IACA;IACA,IAAMmB,WAAW,GAAGV,KAAK,CAACW,2BAA2B,CAAkBxB,YAAY,CAACyB,OAAO,CAAC;IAC5F,IAAIF,WAAW,aAAXA,WAAW,eAAXA,WAAW,CAAEG,OAAO,EAAE;MACtB,IAAMC,WAAW,GAAGpB,MAAM,CAACgB,WAAW,CAAC;MACvC;MACA;MACA;MACA;MACAV,KAAK,CAACe,YAAY,CAACD,WAAW,CAAC;IACnC;IAEA,IAAME,MAAM,GAAGlB,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEmB,kBAAkB,CAACjB,KAAK,CAAC;IAC9C,IAAIgB,MAAM,EAAE;MACRhB,KAAK,CAACkB,SAAS,CAACF,MAAM,CAAC;IAC3B;;IAEA;IACA;IACA;IACA,IAAIhB,KAAK,CAACmB,WAAW,CAAC,CAAC,EAAE;MACrB,IAAI,CAAC5B,aAAa,EAAE;QAChBF,MAAM,CAAC+B,SAAS,CAACC,MAAM,CAACrB,KAAK,EAAE,CAACd,gBAAgB,CAACoC,SAAS,CAAC,CAAC;MAChE;MACA,IAAI7B,OAAO,EAAE;QACTJ,MAAM,CAACkC,oBAAoB,CAACvB,KAAK,CAAC;MACtC;IACJ;IAEA,IAAI,CAACT,aAAa,EAAE;MAChBF,MAAM,CAAC+B,SAAS,CAACC,MAAM,CAACrB,KAAK,EAAE,CAACd,gBAAgB,CAACsC,QAAQ,EAAEtC,gBAAgB,CAACuC,gBAAgB,CAAC,CAAC;MAC9F3B,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEsB,SAAS,CAACC,MAAM,CAACrB,KAAK,EAAE,CAACd,gBAAgB,CAACwC,eAAe,CAAC,CAAC;IACrE;IACA,OAAO1B,KAAK;EAChB;EAEA,OAAON,MAAM;AACjB","ignoreList":[]}
1
+ {"version":3,"file":"event-mapper.js","names":["MatrixEvent","MatrixEventEvent","RelationType","eventMapperFor","client","options","preventReEmit","Boolean","mapper","plainOldJsObject","toDevice","room_id","room","getRoom","event","state_key","undefined","findEventById","event_id","status","setUnsigned","_objectSpread","getUnsigned","unsigned","bundledEdit","getServerAggregatedRelation","Replace","content","replacement","makeReplaced","thread","findThreadForEvent","setThread","isEncrypted","reEmitter","reEmit","Decrypted","Replaced","VisibilityChange","BeforeRedaction"],"sources":["../src/event-mapper.ts"],"sourcesContent":["/*\nCopyright 2021 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { MatrixClient } from \"./client.ts\";\nimport { IEvent, MatrixEvent, MatrixEventEvent } from \"./models/event.ts\";\nimport { RelationType } from \"./@types/event.ts\";\n\nexport type EventMapper = (obj: Partial<IEvent>) => MatrixEvent;\n\nexport interface MapperOpts {\n // don't re-emit events emitted on an event mapped by this mapper on the client\n preventReEmit?: boolean;\n // decrypt event proactively\n decrypt?: boolean;\n // the event is a to_device event\n toDevice?: boolean;\n}\n\nexport function eventMapperFor(client: MatrixClient, options: MapperOpts): EventMapper {\n let preventReEmit = Boolean(options.preventReEmit);\n\n function mapper(plainOldJsObject: Partial<IEvent>): MatrixEvent {\n if (options.toDevice) {\n delete plainOldJsObject.room_id;\n }\n\n const room = client.getRoom(plainOldJsObject.room_id);\n\n let event: MatrixEvent | undefined;\n // If the event is already known to the room, let's re-use the model rather than duplicating.\n // We avoid doing this to state events as they may be forward or backwards looking which tweaks behaviour.\n if (room && plainOldJsObject.state_key === undefined) {\n event = room.findEventById(plainOldJsObject.event_id!);\n }\n\n if (!event || event.status) {\n event = new MatrixEvent(plainOldJsObject);\n } else {\n // merge the latest unsigned data from the server\n event.setUnsigned({ ...event.getUnsigned(), ...plainOldJsObject.unsigned });\n // prevent doubling up re-emitters\n preventReEmit = true;\n }\n\n // if there is a complete edit bundled alongside the event, perform the replacement.\n // (prior to MSC3925, events were automatically replaced on the server-side. MSC3925 proposes that that doesn't\n // happen automatically but the server does provide us with the whole content of the edit event.)\n const bundledEdit = event.getServerAggregatedRelation<Partial<IEvent>>(RelationType.Replace);\n if (bundledEdit?.content) {\n const replacement = mapper(bundledEdit);\n // XXX: it's worth noting that the spec says we should only respect encrypted edits if, once decrypted, the\n // replacement has a `m.new_content` property. The problem is that we haven't yet decrypted the replacement\n // (it should be happening in the background), so we can't enforce this. Possibly we should for decryption\n // to complete, but that sounds a bit racy. For now, we just assume it's ok.\n event.makeReplaced(replacement);\n }\n\n const thread = room?.findThreadForEvent(event);\n if (thread) {\n event.setThread(thread);\n }\n\n // TODO: once we get rid of the old libolm-backed crypto, we can restrict this to room events (rather than\n // to-device events), because the rust implementation decrypts to-device messages at a higher level.\n // Generally we probably want to use a different eventMapper implementation for to-device events because\n if (event.isEncrypted()) {\n if (!preventReEmit) {\n client.reEmitter.reEmit(event, [MatrixEventEvent.Decrypted]);\n }\n }\n\n if (!preventReEmit) {\n client.reEmitter.reEmit(event, [MatrixEventEvent.Replaced, MatrixEventEvent.VisibilityChange]);\n room?.reEmitter.reEmit(event, [MatrixEventEvent.BeforeRedaction]);\n }\n return event;\n }\n\n return mapper;\n}\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAAiBA,WAAW,EAAEC,gBAAgB,QAAQ,mBAAmB;AACzE,SAASC,YAAY,QAAQ,mBAAmB;AAahD,OAAO,SAASC,cAAcA,CAACC,MAAoB,EAAEC,OAAmB,EAAe;EACnF,IAAIC,aAAa,GAAGC,OAAO,CAACF,OAAO,CAACC,aAAa,CAAC;EAElD,SAASE,MAAMA,CAACC,gBAAiC,EAAe;IAC5D,IAAIJ,OAAO,CAACK,QAAQ,EAAE;MAClB,OAAOD,gBAAgB,CAACE,OAAO;IACnC;IAEA,IAAMC,IAAI,GAAGR,MAAM,CAACS,OAAO,CAACJ,gBAAgB,CAACE,OAAO,CAAC;IAErD,IAAIG,K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BAAgB,CAACoC,QAAQ,EAAEpC,gBAAgB,CAACqC,gBAAgB,CAAC,CAAC;MAC9F1B,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEsB,SAAS,CAACC,MAAM,CAACrB,KAAK,EAAE,CAACb,gBAAgB,CAACsC,eAAe,CAAC,CAAC;IACrE;IACA,OAAOzB,KAAK;EAChB;EAEA,OAAON,MAAM;AACjB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../src/feature.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,oBAAY,aAAa;IACrB,MAAM,IAAA;IACN,QAAQ,IAAA;IACR,WAAW,IAAA;CACd;AAED,oBAAY,OAAO;IACf,MAAM,WAAW;IACjB,yBAAyB,8BAA8B;IACvD;;OAEG;IACH,iBAAiB,sBAAsB;IACvC,uBAAuB,4BAA4B;IACnD,mBAAmB,wBAAwB;IAC3C,kBAAkB,uBAAuB;IACzC,mBAAmB,wBAAwB;CAC9C;AAkCD,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAiB5G"}
1
+ {"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../src/feature.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,oBAAY,aAAa;IACrB,MAAM,IAAA;IACN,QAAQ,IAAA;IACR,WAAW,IAAA;CACd;AAED,oBAAY,OAAO;IACf,MAAM,WAAW;IACjB,yBAAyB,8BAA8B;IACvD;;OAEG;IACH,iBAAiB,sBAAsB;IACvC,uBAAuB,4BAA4B;IACnD,mBAAmB,wBAAwB;IAC3C,kBAAkB,uBAAuB;IACzC,mBAAmB,wBAAwB;CAC9C;AAmCD,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAiB5G"}
package/lib/feature.js CHANGED
@@ -50,7 +50,8 @@ var featureSupportResolver = {
50
50
  unstablePrefixes: ["org.matrix.msc3391"]
51
51
  },
52
52
  [Feature.RelationsRecursion]: {
53
- unstablePrefixes: ["org.matrix.msc3981"]
53
+ unstablePrefixes: ["org.matrix.msc3981"],
54
+ matrixVersion: "v1.10"
54
55
  },
55
56
  [Feature.IntentionalMentions]: {
56
57
  unstablePrefixes: ["org.matrix.msc3952_intentional_mentions"],
@@ -1 +1 @@
1
- {"version":3,"file":"feature.js","names":["ServerSupport","Feature","featureSupportResolver","Thread","unstablePrefixes","matrixVersion","ThreadUnreadNotifications","LoginTokenRequest","RelationBasedRedactions","AccountDataDeletion","RelationsRecursion","IntentionalMentions","buildFeatureSupportMap","_x","_buildFeatureSupportMap","apply","arguments","_asyncToGenerator","versions","supportMap","Map","feature","supportCondition","Object","entries","_versions$versions$in","_versions$versions","_supportCondition$uns","_supportCondition$uns2","supportMatrixVersion","includes","supportUnstablePrefixes","every","unstablePrefix","_versions$unstable_fe","unstable_features","set","Stable","Unstable","Unsupported"],"sources":["../src/feature.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { IServerVersions } from \"./client.ts\";\n\nexport enum ServerSupport {\n Stable,\n Unstable,\n Unsupported,\n}\n\nexport enum Feature {\n Thread = \"Thread\",\n ThreadUnreadNotifications = \"ThreadUnreadNotifications\",\n /**\n * @deprecated this is now exposed as a capability not a feature\n */\n LoginTokenRequest = \"LoginTokenRequest\",\n RelationBasedRedactions = \"RelationBasedRedactions\",\n AccountDataDeletion = \"AccountDataDeletion\",\n RelationsRecursion = \"RelationsRecursion\",\n IntentionalMentions = \"IntentionalMentions\",\n}\n\ntype FeatureSupportCondition = {\n unstablePrefixes?: string[];\n matrixVersion?: string;\n};\n\nconst featureSupportResolver: Record<string, FeatureSupportCondition> = {\n [Feature.Thread]: {\n unstablePrefixes: [\"org.matrix.msc3440\"],\n matrixVersion: \"v1.3\",\n },\n [Feature.ThreadUnreadNotifications]: {\n unstablePrefixes: [\"org.matrix.msc3771\", \"org.matrix.msc3773\"],\n matrixVersion: \"v1.4\",\n },\n [Feature.LoginTokenRequest]: {\n unstablePrefixes: [\"org.matrix.msc3882\"],\n },\n [Feature.RelationBasedRedactions]: {\n unstablePrefixes: [\"org.matrix.msc3912\"],\n },\n [Feature.AccountDataDeletion]: {\n unstablePrefixes: [\"org.matrix.msc3391\"],\n },\n [Feature.RelationsRecursion]: {\n unstablePrefixes: [\"org.matrix.msc3981\"],\n },\n [Feature.IntentionalMentions]: {\n unstablePrefixes: [\"org.matrix.msc3952_intentional_mentions\"],\n matrixVersion: \"v1.7\",\n },\n};\n\nexport async function buildFeatureSupportMap(versions: IServerVersions): Promise<Map<Feature, ServerSupport>> {\n const supportMap = new Map<Feature, ServerSupport>();\n for (const [feature, supportCondition] of Object.entries(featureSupportResolver)) {\n const supportMatrixVersion = versions.versions?.includes(supportCondition.matrixVersion || \"\") ?? false;\n const supportUnstablePrefixes =\n supportCondition.unstablePrefixes?.every((unstablePrefix) => {\n return versions.unstable_features?.[unstablePrefix] === true;\n }) ?? false;\n if (supportMatrixVersion) {\n supportMap.set(feature as Feature, ServerSupport.Stable);\n } else if (supportUnstablePrefixes) {\n supportMap.set(feature as Feature, ServerSupport.Unstable);\n } else {\n supportMap.set(feature as Feature, ServerSupport.Unsupported);\n }\n }\n return supportMap;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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erSupport","Feature","featureSupportResolver","Thread","unstablePrefixes","matrixVersion","ThreadUnreadNotifications","LoginTokenRequest","RelationBasedRedactions","AccountDataDeletion","RelationsRecursion","IntentionalMentions","buildFeatureSupportMap","_x","_buildFeatureSupportMap","apply","arguments","_asyncToGenerator","versions","supportMap","Map","feature","supportCondition","Object","entries","_versions$versions$in","_versions$versions","_supportCondition$uns","_supportCondition$uns2","supportMatrixVersion","includes","supportUnstablePrefixes","every","unstablePrefix","_versions$unstable_fe","unstable_features","set","Stable","Unstable","Unsupported"],"sources":["../src/feature.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { IServerVersions } from \"./client.ts\";\n\nexport enum ServerSupport {\n Stable,\n Unstable,\n Unsupported,\n}\n\nexport enum Feature {\n Thread = \"Thread\",\n ThreadUnreadNotifications = \"ThreadUnreadNotifications\",\n /**\n * @deprecated this is now exposed as a capability not a feature\n */\n LoginTokenRequest = \"LoginTokenRequest\",\n RelationBasedRedactions = \"RelationBasedRedactions\",\n AccountDataDeletion = \"AccountDataDeletion\",\n RelationsRecursion = \"RelationsRecursion\",\n IntentionalMentions = \"IntentionalMentions\",\n}\n\ntype FeatureSupportCondition = {\n unstablePrefixes?: string[];\n matrixVersion?: string;\n};\n\nconst featureSupportResolver: Record<string, FeatureSupportCondition> = {\n [Feature.Thread]: {\n unstablePrefixes: [\"org.matrix.msc3440\"],\n matrixVersion: \"v1.3\",\n },\n [Feature.ThreadUnreadNotifications]: {\n unstablePrefixes: [\"org.matrix.msc3771\", \"org.matrix.msc3773\"],\n matrixVersion: \"v1.4\",\n },\n [Feature.LoginTokenRequest]: {\n unstablePrefixes: [\"org.matrix.msc3882\"],\n },\n [Feature.RelationBasedRedactions]: {\n unstablePrefixes: [\"org.matrix.msc3912\"],\n },\n [Feature.AccountDataDeletion]: {\n unstablePrefixes: [\"org.matrix.msc3391\"],\n },\n [Feature.RelationsRecursion]: {\n unstablePrefixes: [\"org.matrix.msc3981\"],\n matrixVersion: \"v1.10\",\n },\n [Feature.IntentionalMentions]: {\n unstablePrefixes: [\"org.matrix.msc3952_intentional_mentions\"],\n matrixVersion: \"v1.7\",\n },\n};\n\nexport async function buildFeatureSupportMap(versions: IServerVersions): Promise<Map<Feature, ServerSupport>> {\n const supportMap = new Map<Feature, ServerSupport>();\n for (const [feature, supportCondition] of Object.entries(featureSupportResolver)) {\n const supportMatrixVersion = versions.versions?.includes(supportCondition.matrixVersion || \"\") ?? false;\n const supportUnstablePrefixes =\n supportCondition.unstablePrefixes?.every((unstablePrefix) => {\n return versions.unstable_features?.[unstablePrefix] === true;\n }) ?? false;\n if (supportMatrixVersion) {\n supportMap.set(feature as Feature, ServerSupport.Stable);\n } else if (supportUnstablePrefixes) {\n supportMap.set(feature as Feature, ServerSupport.Unstable);\n } else {\n supportMap.set(feature as Feature, ServerSupport.Unsupported);\n }\n }\n return supportMap;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,WAAYA,aAAa,0BAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA;AAMzB,WAAYC,OAAO,0BAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAA,OAAPA,OAAO;AAAA;AAkBnB,IAAMC,sBAA+D,GAAG;EACpE,CAACD,O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mBI,QAAQ,CAACR,gBAAgB,CAACjB,aAAa,IAAI,EAAE,CAAC,cAAAoB,qBAAA,cAAAA,qBAAA,GAAI,KAAK;MACvG,IAAMM,uBAAuB,IAAAJ,qBAAA,IAAAC,sBAAA,GACzBN,gBAAgB,CAAClB,gBAAgB,cAAAwB,sBAAA,uBAAjCA,sBAAA,CAAmCI,KAAK,CAAEC,cAAc,IAAK;QAAA,IAAAC,qBAAA;QACzD,OAAO,EAAAA,qBAAA,GAAAhB,QAAQ,CAACiB,iBAAiB,cAAAD,qBAAA,uBAA1BA,qBAAA,CAA6BD,cAAc,CAAC,MAAK,IAAI;MAChE,CAAC,CAAC,cAAAN,qBAAA,cAAAA,qBAAA,GAAI,KAAK;MACf,IAAIE,oBAAoB,EAAE;QACtBV,UAAU,CAACiB,GAAG,CAACf,OAAO,EAAarB,aAAa,CAACqC,MAAM,CAAC;MAC5D,CAAC,MAAM,IAAIN,uBAAuB,EAAE;QAChCZ,UAAU,CAACiB,GAAG,CAACf,OAAO,EAAarB,aAAa,CAACsC,QAAQ,CAAC;MAC9D,CAAC,MAAM;QACHnB,UAAU,CAACiB,GAAG,CAACf,OAAO,EAAarB,aAAa,CAACuC,WAAW,CAAC;MACjE;IACJ;IACA,OAAOpB,UAAU;EACrB,CAAC;EAAA,OAAAL,uBAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA","ignoreList":[]}
@@ -61,9 +61,9 @@ export declare class MatrixError extends HTTPError {
61
61
  static fromWidgetApiErrorData(data: IWidgetMatrixError): MatrixError;
62
62
  }
63
63
  /**
64
- * @returns The recommended delay in milliseconds to wait before retrying
65
- * the request that triggered {@link error}, or {@link defaultMs} if the
66
- * error was not due to rate-limiting or if no valid delay is recommended.
64
+ * @returns The recommended delay in milliseconds to wait before retrying the request.
65
+ * @param error - The error to check for a retry delay.
66
+ * @param defaultMs - The delay to use if the error was not due to rate-limiting or if no valid delay is recommended.
67
67
  */
68
68
  export declare function safeGetRetryAfterMs(error: unknown, defaultMs: number): number;
69
69
  /**
@@ -152,9 +152,9 @@ export class MatrixError extends HTTPError {
152
152
  }
153
153
 
154
154
  /**
155
- * @returns The recommended delay in milliseconds to wait before retrying
156
- * the request that triggered {@link error}, or {@link defaultMs} if the
157
- * error was not due to rate-limiting or if no valid delay is recommended.
155
+ * @returns The recommended delay in milliseconds to wait before retrying the request.
156
+ * @param error - The error to check for a retry delay.
157
+ * @param defaultMs - The delay to use if the error was not due to rate-limiting or if no valid delay is recommended.
158
158
  */
159
159
  export function safeGetRetryAfterMs(error, defaultMs) {
160
160
  if (!(error instanceof HTTPError) || !error.isRateLimitError()) {
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","names":["HTTPError","Error","constructor","msg","httpStatus","httpHeaders","isRateLimitError","getRetryAfterMs","_this$httpHeaders","retryAfter","get","test","ms","Number","parseInt","isFinite","date","Date","toUTCString","getTime","now","MatrixError","errorJson","arguments","length","undefined","url","event","message","error","concat","_defineProperty","errcode","name","data","headerValue","isInteger","retry_after_ms","asWidgetApiErrorData","_this$httpStatus","_this$url","_this$errcode","_this$data$error","headers","value","http_status","http_headers","response","_objectSpread","fromWidgetApiErrorData","Headers","safeGetRetryAfterMs","defaultMs","_error$getRetryAfterM","_unused","ConnectionError","cause"],"sources":["../../src/http-api/errors.ts"],"sourcesContent":["/*\nCopyright 2022 - 2024 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { IMatrixApiError as IWidgetMatrixError } from \"matrix-widget-api\";\n\nimport { IUsageLimit } from \"../@types/partials.ts\";\nimport { MatrixEvent } from \"../models/event.ts\";\n\ninterface IErrorJson extends Partial<IUsageLimit> {\n [key: string]: any; // extensible\n errcode?: string;\n error?: string;\n}\n\n/**\n * Construct a generic HTTP error. This is a JavaScript Error with additional information\n * specific to HTTP responses.\n * @param msg - The error message to include.\n * @param httpStatus - The HTTP response status code.\n * @param httpHeaders - The HTTP response headers.\n */\nexport class HTTPError extends Error {\n public constructor(\n msg: string,\n public readonly httpStatus?: number,\n public readonly httpHeaders?: Headers,\n ) {\n super(msg);\n }\n\n /**\n * Check if this error was due to rate-limiting on the server side (and should therefore be retried after a delay).\n *\n * If this returns `true`, {@link getRetryAfterMs} can be called to retrieve the server-side\n * recommendation for the retry period.\n *\n * @returns Whether this error is due to rate-limiting.\n */\n public isRateLimitError(): boolean {\n return this.httpStatus === 429;\n }\n\n /**\n * @returns The recommended delay in milliseconds to wait before retrying\n * the request that triggered this error, or null if no delay is recommended.\n * @throws Error if the recommended delay is an invalid value.\n * @see {@link safeGetRetryAfterMs} for a version of this check that doesn't throw.\n */\n public getRetryAfterMs(): number | null {\n const retryAfter = this.httpHeaders?.get(\"Retry-After\");\n if (retryAfter != null) {\n if (/^\\d+$/.test(retryAfter)) {\n const ms = Number.parseInt(retryAfter) * 1000;\n if (!Number.isFinite(ms)) {\n throw new Error(\"Retry-After header integer value is too large\");\n }\n return ms;\n }\n const date = new Date(retryAfter);\n if (date.toUTCString() !== retryAfter) {\n throw new Error(\"Retry-After header value is not a valid HTTP-date or non-negative decimal integer\");\n }\n return date.getTime() - Date.now();\n }\n return null;\n }\n}\n\nexport class MatrixError extends HTTPError {\n // The Matrix 'errcode' value, e.g. \"M_FORBIDDEN\".\n public readonly errcode?: string;\n // The raw Matrix error JSON used to construct this object.\n public data: IErrorJson;\n\n /**\n * Construct a Matrix error. This is a JavaScript Error with additional\n * information specific to the standard Matrix error response.\n * @param errorJson - The Matrix error JSON returned from the homeserver.\n * @param httpStatus - The numeric HTTP status code given\n * @param httpHeaders - The HTTP response headers given\n */\n public constructor(\n errorJson: IErrorJson = {},\n httpStatus?: number,\n public url?: string,\n public event?: MatrixEvent,\n httpHeaders?: Headers,\n ) {\n let message = errorJson.error || \"Unknown message\";\n if (httpStatus) {\n message = `[${httpStatus}] ${message}`;\n }\n if (url) {\n message = `${message} (${url})`;\n }\n super(`MatrixError: ${message}`, httpStatus, httpHeaders);\n this.errcode = errorJson.errcode;\n this.name = errorJson.errcode || \"Unknown error code\";\n this.data = errorJson;\n }\n\n public isRateLimitError(): boolean {\n return (\n this.errcode === \"M_LIMIT_EXCEEDED\" ||\n ((this.errcode === \"M_UNKNOWN\" || this.errcode === undefined) && super.isRateLimitError())\n );\n }\n\n public getRetryAfterMs(): number | null {\n const headerValue = super.getRetryAfterMs();\n if (headerValue !== null) {\n return headerValue;\n }\n // Note: retry_after_ms is deprecated as of spec version v1.10\n if (this.errcode === \"M_LIMIT_EXCEEDED\" && \"retry_after_ms\" in this.data) {\n if (!Number.isInteger(this.data.retry_after_ms)) {\n throw new Error(\"retry_after_ms is not an integer\");\n }\n return this.data.retry_after_ms;\n }\n return null;\n }\n\n /**\n * @returns this error expressed as a JSON payload\n * for use by Widget API error responses.\n */\n public asWidgetApiErrorData(): IWidgetMatrixError {\n const headers: Record<string, string> = {};\n if (this.httpHeaders) {\n for (const [name, value] of this.httpHeaders) {\n headers[name] = value;\n }\n }\n return {\n http_status: this.httpStatus ?? 400,\n http_headers: headers,\n url: this.url ?? \"\",\n response: {\n errcode: this.errcode ?? \"M_UNKNOWN\",\n error: this.data.error ?? \"Unknown message\",\n ...this.data,\n },\n };\n }\n\n /**\n * @returns a new {@link MatrixError} from a JSON payload\n * received from Widget API error responses.\n */\n public static fromWidgetApiErrorData(data: IWidgetMatrixError): MatrixError {\n return new MatrixError(data.response, data.http_status, data.url, undefined, new Headers(data.http_headers));\n }\n}\n\n/**\n * @returns The recommended delay in milliseconds to wait before retrying\n * the request that triggered {@link error}, or {@link defaultMs} if the\n * error was not due to rate-limiting or if no valid delay is recommended.\n */\nexport function safeGetRetryAfterMs(error: unknown, defaultMs: number): number {\n if (!(error instanceof HTTPError) || !error.isRateLimitError()) {\n return defaultMs;\n }\n try {\n return error.getRetryAfterMs() ?? defaultMs;\n } catch {\n return defaultMs;\n }\n}\n\n/**\n * Construct a ConnectionError. This is a JavaScript Error indicating\n * that a request failed because of some error with the connection, either\n * CORS was not correctly configured on the server, the server didn't response,\n * the request timed out, or the internet connection on the client side went down.\n */\nexport class ConnectionError extends Error {\n public constructor(message: string, cause?: Error) {\n super(message + (cause ? `: ${cause.message}` : \"\"));\n }\n\n public get name(): string {\n return \"ConnectionError\";\n }\n}\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,SAASC,KAAK,CAAC;EAC1BC,WAAWA,CACdC,GAAW,EACKC,UAAmB,EACnBC,WAAqB,EACvC;IACE,KAAK,CAACF,GAAG,CAAC;IAAC,KAHKC,UAAmB,GAAnBA,UAAmB;IAAA,KACnBC,WAAqB,GAArBA,WAAqB;EAGzC;;EAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;EACWC,gBAAgBA,CAAA,EAAY;IAC/B,OAAO,IAAI,CAACF,UAAU,KAAK,GAAG;EAClC;;EAEA;AACJ;AACA;AACA;AACA;AACA;EACWG,eAAeA,CAAA,EAAkB;IAAA,IAAAC,iBAAA;IACpC,IAAMC,UAAU,IAAAD,iBAAA,GAAG,IAAI,CAACH,WAAW,cAAAG,iBAAA,uBAAhBA,iBAAA,CAAkBE,GAAG,CAAC,aAAa,CAAC;IACvD,IAAID,UAAU,IAAI,IAAI,EAAE;MACpB,IAAI,OAAO,CAACE,IAAI,CAACF,UAAU,CAAC,EAAE;QAC1B,IAAMG,EAAE,GAAGC,MAAM,CAACC,QAAQ,CAACL,UAAU,CAAC,GAAG,IAAI;QAC7C,IAAI,CAACI,MAAM,CAACE,QAAQ,CAACH,EAAE,CAAC,EAAE;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C;EAChCC,WAAWA,CAAC0B,OAAe,EAAE4B,KAAa,EAAE;IAC/C,KAAK,CAAC5B,OAAO,IAAI4B,KAAK,QAAA1B,MAAA,CAAQ0B,KAAK,CAAC5B,OAAO,IAAK,EAAE,CAAC,CAAC;EACxD;EAEA,IAAWK,IAAIA,CAAA,EAAW;IACtB,OAAO,iBAAiB;EAC5B;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"errors.js","names":["HTTPError","Error","constructor","msg","httpStatus","httpHeaders","isRateLimitError","getRetryAfterMs","_this$httpHeaders","retryAfter","get","test","ms","Number","parseInt","isFinite","date","Date","toUTCString","getTime","now","MatrixError","errorJson","arguments","length","undefined","url","event","message","error","concat","_defineProperty","errcode","name","data","headerValue","isInteger","retry_after_ms","asWidgetApiErrorData","_this$httpStatus","_this$url","_this$errcode","_this$data$error","headers","value","http_status","http_headers","response","_objectSpread","fromWidgetApiErrorData","Headers","safeGetRetryAfterMs","defaultMs","_error$getRetryAfterM","_unused","ConnectionError","cause"],"sources":["../../src/http-api/errors.ts"],"sourcesContent":["/*\nCopyright 2022 - 2024 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { IMatrixApiError as IWidgetMatrixError } from \"matrix-widget-api\";\n\nimport { IUsageLimit } from \"../@types/partials.ts\";\nimport { MatrixEvent } from \"../models/event.ts\";\n\ninterface IErrorJson extends Partial<IUsageLimit> {\n [key: string]: any; // extensible\n errcode?: string;\n error?: string;\n}\n\n/**\n * Construct a generic HTTP error. This is a JavaScript Error with additional information\n * specific to HTTP responses.\n * @param msg - The error message to include.\n * @param httpStatus - The HTTP response status code.\n * @param httpHeaders - The HTTP response headers.\n */\nexport class HTTPError extends Error {\n public constructor(\n msg: string,\n public readonly httpStatus?: number,\n public readonly httpHeaders?: Headers,\n ) {\n super(msg);\n }\n\n /**\n * Check if this error was due to rate-limiting on the server side (and should therefore be retried after a delay).\n *\n * If this returns `true`, {@link getRetryAfterMs} can be called to retrieve the server-side\n * recommendation for the retry period.\n *\n * @returns Whether this error is due to rate-limiting.\n */\n public isRateLimitError(): boolean {\n return this.httpStatus === 429;\n }\n\n /**\n * @returns The recommended delay in milliseconds to wait before retrying\n * the request that triggered this error, or null if no delay is recommended.\n * @throws Error if the recommended delay is an invalid value.\n * @see {@link safeGetRetryAfterMs} for a version of this check that doesn't throw.\n */\n public getRetryAfterMs(): number | null {\n const retryAfter = this.httpHeaders?.get(\"Retry-After\");\n if (retryAfter != null) {\n if (/^\\d+$/.test(retryAfter)) {\n const ms = Number.parseInt(retryAfter) * 1000;\n if (!Number.isFinite(ms)) {\n throw new Error(\"Retry-After header integer value is too large\");\n }\n return ms;\n }\n const date = new Date(retryAfter);\n if (date.toUTCString() !== retryAfter) {\n throw new Error(\"Retry-After header value is not a valid HTTP-date or non-negative decimal integer\");\n }\n return date.getTime() - Date.now();\n }\n return null;\n }\n}\n\nexport class MatrixError extends HTTPError {\n // The Matrix 'errcode' value, e.g. \"M_FORBIDDEN\".\n public readonly errcode?: string;\n // The raw Matrix error JSON used to construct this object.\n public data: IErrorJson;\n\n /**\n * Construct a Matrix error. This is a JavaScript Error with additional\n * information specific to the standard Matrix error response.\n * @param errorJson - The Matrix error JSON returned from the homeserver.\n * @param httpStatus - The numeric HTTP status code given\n * @param httpHeaders - The HTTP response headers given\n */\n public constructor(\n errorJson: IErrorJson = {},\n httpStatus?: number,\n public url?: string,\n public event?: MatrixEvent,\n httpHeaders?: Headers,\n ) {\n let message = errorJson.error || \"Unknown message\";\n if (httpStatus) {\n message = `[${httpStatus}] ${message}`;\n }\n if (url) {\n message = `${message} (${url})`;\n }\n super(`MatrixError: ${message}`, httpStatus, httpHeaders);\n this.errcode = errorJson.errcode;\n this.name = errorJson.errcode || \"Unknown error code\";\n this.data = errorJson;\n }\n\n public isRateLimitError(): boolean {\n return (\n this.errcode === \"M_LIMIT_EXCEEDED\" ||\n ((this.errcode === \"M_UNKNOWN\" || this.errcode === undefined) && super.isRateLimitError())\n );\n }\n\n public getRetryAfterMs(): number | null {\n const headerValue = super.getRetryAfterMs();\n if (headerValue !== null) {\n return headerValue;\n }\n // Note: retry_after_ms is deprecated as of spec version v1.10\n if (this.errcode === \"M_LIMIT_EXCEEDED\" && \"retry_after_ms\" in this.data) {\n if (!Number.isInteger(this.data.retry_after_ms)) {\n throw new Error(\"retry_after_ms is not an integer\");\n }\n return this.data.retry_after_ms;\n }\n return null;\n }\n\n /**\n * @returns this error expressed as a JSON payload\n * for use by Widget API error responses.\n */\n public asWidgetApiErrorData(): IWidgetMatrixError {\n const headers: Record<string, string> = {};\n if (this.httpHeaders) {\n for (const [name, value] of this.httpHeaders) {\n headers[name] = value;\n }\n }\n return {\n http_status: this.httpStatus ?? 400,\n http_headers: headers,\n url: this.url ?? \"\",\n response: {\n errcode: this.errcode ?? \"M_UNKNOWN\",\n error: this.data.error ?? \"Unknown message\",\n ...this.data,\n },\n };\n }\n\n /**\n * @returns a new {@link MatrixError} from a JSON payload\n * received from Widget API error responses.\n */\n public static fromWidgetApiErrorData(data: IWidgetMatrixError): MatrixError {\n return new MatrixError(data.response, data.http_status, data.url, undefined, new Headers(data.http_headers));\n }\n}\n\n/**\n * @returns The recommended delay in milliseconds to wait before retrying the request.\n * @param error - The error to check for a retry delay.\n * @param defaultMs - The delay to use if the error was not due to rate-limiting or if no valid delay is recommended.\n */\nexport function safeGetRetryAfterMs(error: unknown, defaultMs: number): number {\n if (!(error instanceof HTTPError) || !error.isRateLimitError()) {\n return defaultMs;\n }\n try {\n return error.getRetryAfterMs() ?? defaultMs;\n } catch {\n return defaultMs;\n }\n}\n\n/**\n * Construct a ConnectionError. This is a JavaScript Error indicating\n * that a request failed because of some error with the connection, either\n * CORS was not correctly configured on the server, the server didn't response,\n * the request timed out, or the internet connection on the client side went down.\n */\nexport class ConnectionError extends Error {\n public constructor(message: string, cause?: Error) {\n super(message + (cause ? `: ${cause.message}` : \"\"));\n }\n\n public get name(): string {\n return \"ConnectionError\";\n }\n}\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,SAASC,KAAK,CAAC;EAC1BC,WAAWA,CACdC,GAAW,EACKC,UAAmB,EACnBC,WAAqB,EACvC;IACE,KAAK,CAACF,GAAG,CAAC;IAAC,KAHKC,UAAmB,GAAnBA,UAAmB;IAAA,KACnBC,WAAqB,GAArBA,WAAqB;EAGzC;;EAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;EACWC,gBAAgBA,CAAA,EAAY;IAC/B,OAAO,IAAI,CAACF,UAAU,KAAK,GAAG;EAClC;;EAEA;AACJ;AACA;AACA;AACA;AACA;EACWG,eAAeA,CAAA,EAAkB;IAAA,IAAAC,iBAAA;IACpC,IAAMC,UAAU,IAAAD,iBAAA,GAAG,IAAI,CAACH,WAAW,cAAAG,iBAAA,uBAAhBA,iBAAA,CAAkBE,GAAG,CAAC,aAAa,CAAC;IACvD,IAAID,UAAU,IAAI,IAAI,EAAE;MACpB,IAAI,OAAO,CAACE,IAAI,CAACF,UAAU,CAAC,EAAE;QAC1B,IAAMG,EAAE,GAAGC,MAAM,CAACC,QAAQ,CAACL,UAAU,CAAC,GAAG,IAAI;QAC7C,IAAI,CAACI,MAAM,CAACE,QAAQ,CAACH,EAAE,CAAC,EAAE;UACtB,MAAM,IAAIX,KAAK,CAAC,+CAA+C,CAAC;QACpE;QACA,OAAOW,EAAE;MACb;MACA,IAAMI,IAAI,GAAG,IAAIC,IAAI,CAACR,UAAU,CAAC;MACjC,IA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IAAK,EAAE,CAAC,CAAC;EACxD;EAEA,IAAWK,IAAIA,CAAA,EAAW;IACtB,OAAO,iBAAiB;EAC5B;AACJ","ignoreList":[]}
@@ -159,8 +159,8 @@ export function calculateRetryBackoff(err, attempts, retryConnectionError) {
159
159
  if (err instanceof ConnectionError && !retryConnectionError) {
160
160
  return -1;
161
161
  }
162
- if (err.httpStatus && (err.httpStatus === 400 || err.httpStatus === 403 || err.httpStatus === 401)) {
163
- // client error; no amount of retrying will save you now.
162
+ if (err.httpStatus && Math.floor(err.httpStatus / 100) === 4 && err.httpStatus !== 429) {
163
+ // client error; no amount of retrying will save you now (except for rate limiting which is handled below)
164
164
  return -1;
165
165
  }
166
166
  if (err.name === "AbortError") {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["parse","parseContentType","logger","sleep","ConnectionError","HTTPError","MatrixError","safeGetRetryAfterMs","timeoutSignal","ms","controller","AbortController","setTimeout","abort","signal","anySignal","signals","cleanup","removeEventListener","onAbort","aborted","addEventListener","parseErrorResponse","response","body","_contentType","_contentType2","httpHeaders","isXhr","Headers","getAllResponseHeaders","trim","split","map","header","colonIdx","indexOf","substring","headers","contentType","getResponseContentType","e","type","JSON","status","responseURL","url","undefined","concat","get","Error","retryNetworkOperation","_x","_x2","_retryNetworkOperation","apply","arguments","_asyncToGenerator","maxAttempts","callback","attempts","lastConnectionError","timeout","Math","pow","log","err","calculateRetryBackoff","retryConnectionError","httpStatus","name"],"sources":["../../src/http-api/utils.ts"],"sourcesContent":["/*\nCopyright 2022 - 2024 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { parse as parseContentType, ParsedMediaType } from \"content-type\";\n\nimport { logger } from \"../logger.ts\";\nimport { sleep } from \"../utils.ts\";\nimport { ConnectionError, HTTPError, MatrixError, safeGetRetryAfterMs } from \"./errors.ts\";\n\n// Ponyfill for https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout\nexport function timeoutSignal(ms: number): AbortSignal {\n const controller = new AbortController();\n setTimeout(() => {\n controller.abort();\n }, ms);\n\n return controller.signal;\n}\n\nexport function anySignal(signals: AbortSignal[]): {\n signal: AbortSignal;\n cleanup(): void;\n} {\n const controller = new AbortController();\n\n function cleanup(): void {\n for (const signal of signals) {\n signal.removeEventListener(\"abort\", onAbort);\n }\n }\n\n function onAbort(): void {\n controller.abort();\n cleanup();\n }\n\n for (const signal of signals) {\n if (signal.aborted) {\n onAbort();\n break;\n }\n signal.addEventListener(\"abort\", onAbort);\n }\n\n return {\n signal: controller.signal,\n cleanup,\n };\n}\n\n/**\n * Attempt to turn an HTTP error response into a Javascript Error.\n *\n * If it is a JSON response, we will parse it into a MatrixError. Otherwise\n * we return a generic Error.\n *\n * @param response - response object\n * @param body - raw body of the response\n * @returns\n */\nexport function parseErrorResponse(response: XMLHttpRequest | Response, body?: string): Error {\n const httpHeaders = isXhr(response)\n ? new Headers(\n response\n .getAllResponseHeaders()\n .trim()\n .split(/[\\r\\n]+/)\n .map((header): [string, string] => {\n const colonIdx = header.indexOf(\":\");\n return [header.substring(0, colonIdx), header.substring(colonIdx + 1)];\n }),\n )\n : response.headers;\n\n let contentType: ParsedMediaType | null;\n try {\n contentType = getResponseContentType(httpHeaders);\n } catch (e) {\n return <Error>e;\n }\n if (contentType?.type === \"application/json\" && body) {\n return new MatrixError(\n JSON.parse(body),\n response.status,\n isXhr(response) ? response.responseURL : response.url,\n undefined,\n httpHeaders,\n );\n }\n if (contentType?.type === \"text/plain\") {\n return new HTTPError(`Server returned ${response.status} error: ${body}`, response.status, httpHeaders);\n }\n return new HTTPError(`Server returned ${response.status} error`, response.status, httpHeaders);\n}\n\nfunction isXhr(response: XMLHttpRequest | Response): response is XMLHttpRequest {\n return \"getResponseHeader\" in response;\n}\n\n/**\n * extract the Content-Type header from response headers, and\n * parse it to a `{type, parameters}` object.\n *\n * returns null if no content-type header could be found.\n *\n * @param response - response object\n * @returns parsed content-type header, or null if not found\n */\nfunction getResponseContentType(headers: Headers): ParsedMediaType | null {\n const contentType = headers.get(\"Content-Type\");\n if (contentType === null) return null;\n\n try {\n return parseContentType(contentType);\n } catch (e) {\n throw new Error(`Error parsing Content-Type '${contentType}': ${e}`);\n }\n}\n\n/**\n * Retries a network operation run in a callback.\n * @param maxAttempts - maximum attempts to try\n * @param callback - callback that returns a promise of the network operation. If rejected with ConnectionError, it will be retried by calling the callback again.\n * @returns the result of the network operation\n * @throws {@link ConnectionError} If after maxAttempts the callback still throws ConnectionError\n */\nexport async function retryNetworkOperation<T>(maxAttempts: number, callback: () => Promise<T>): Promise<T> {\n let attempts = 0;\n let lastConnectionError: ConnectionError | null = null;\n while (attempts < maxAttempts) {\n try {\n if (attempts > 0) {\n const timeout = 1000 * Math.pow(2, attempts);\n logger.log(`network operation failed ${attempts} times, retrying in ${timeout}ms...`);\n await sleep(timeout);\n }\n return await callback();\n } catch (err) {\n if (err instanceof ConnectionError) {\n attempts += 1;\n lastConnectionError = err;\n } else {\n throw err;\n }\n }\n }\n throw lastConnectionError;\n}\n\n/**\n * Calculate the backoff time for a request retry attempt.\n * This produces wait times of 2, 4, 8, and 16 seconds (30s total) after which we give up. If the\n * failure was due to a rate limited request, the time specified in the error is returned.\n *\n * Returns -1 if the error is not retryable, or if we reach the maximum number of attempts.\n *\n * @param err - The error thrown by the http call\n * @param attempts - The number of attempts made so far, including the one that just failed.\n * @param retryConnectionError - Whether to retry on {@link ConnectionError} (CORS, connection is down, etc.)\n */\nexport function calculateRetryBackoff(err: any, attempts: number, retryConnectionError: boolean): number {\n if (attempts > 4) {\n return -1; // give up\n }\n\n if (err instanceof ConnectionError && !retryConnectionError) {\n return -1;\n }\n\n if (err.httpStatus && (err.httpStatus === 400 || err.httpStatus === 403 || err.httpStatus === 401)) {\n // client error; no amount of retrying will save you now.\n return -1;\n }\n\n if (err.name === \"AbortError\") {\n // this is a client timeout, that is already very high 60s/80s\n // we don't want to retry, as it could do it for very long\n return -1;\n }\n\n // If we are trying to send an event (or similar) that is too large in any way, then retrying won't help\n if (err.name === \"M_TOO_LARGE\") {\n return -1;\n }\n\n return safeGetRetryAfterMs(err, 1000 * Math.pow(2, attempts));\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,KAAK,IAAIC,gBAAgB,QAAyB,cAAc;AAEzE,SAASC,MAAM,QAAQ,cAAc;AACrC,SAASC,KAAK,QAAQ,aAAa;AACnC,SAASC,eAAe,EAAEC,SAAS,EAAEC,WAAW,EAAEC,mBAAmB,QAAQ,aAAa;;AAE1F;AACA,OAAO,SAASC,aAAaA,CAACC,EAAU,EAAe;EACnD,IAAMC,UAAU,GAAG,IAAIC,eAAe,CAAC,CAAC;EACxCC,UAAU,CAAC,MAAM;IACbF,UAAU,CAACG,KAAK,CAAC,CAAC;EACtB,CAAC,EAAEJ,EAAE,CAAC;EAEN,OAAOC,UAAU,CAACI,MAAM;AAC5B;AAEA,OAAO,SAASC,SAASA,CAACC,OAAsB,EAG9C;EACE,IAAMN,UAAU,GAAG,IAAIC,eAAe,CAAC,CAAC;EAExC,SAASM,OAAOA,CAAA,EAAS;IACrB,KAAK,IAAMH,MAAM,IAAIE,OAAO,EAAE;MAC1BF,MAAM,CAACI,mBAAmB,CAAC,OAAO,EAAEC,OAAO,CAAC;IAChD;EACJ;EAEA,SAASA,OAAOA,CAAA,EAAS;IACrBT,UAAU,CAACG,KAAK,CAAC,CAAC;IAClBI,OAAO,CAAC,CAAC;EACb;EAEA,KAAK,IAAMH,MAAM,IAAIE,OAAO,EAAE;IAC1B,IAAIF,MAAM,CA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AAO,CAAC,CAAC;EACb;EAEA,OAAO/D,mBAAmB,CAAC2D,GAAG,EAAE,IAAI,GAAGH,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEJ,QAAQ,CAAC,CAAC;AACjE","ignoreList":[]}
1
+ {"version":3,"file":"utils.js","names":["parse","parseContentType","logger","sleep","ConnectionError","HTTPError","MatrixError","safeGetRetryAfterMs","timeoutSignal","ms","controller","AbortController","setTimeout","abort","signal","anySignal","signals","cleanup","removeEventListener","onAbort","aborted","addEventListener","parseErrorResponse","response","body","_contentType","_contentType2","httpHeaders","isXhr","Headers","getAllResponseHeaders","trim","split","map","header","colonIdx","indexOf","substring","headers","contentType","getResponseContentType","e","type","JSON","status","responseURL","url","undefined","concat","get","Error","retryNetworkOperation","_x","_x2","_retryNetworkOperation","apply","arguments","_asyncToGenerator","maxAttempts","callback","attempts","lastConnectionError","timeout","Math","pow","log","err","calculateRetryBackoff","retryConnectionError","httpStatus","floor","name"],"sources":["../../src/http-api/utils.ts"],"sourcesContent":["/*\nCopyright 2022 - 2024 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { parse as parseContentType, ParsedMediaType } from \"content-type\";\n\nimport { logger } from \"../logger.ts\";\nimport { sleep } from \"../utils.ts\";\nimport { ConnectionError, HTTPError, MatrixError, safeGetRetryAfterMs } from \"./errors.ts\";\n\n// Ponyfill for https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout\nexport function timeoutSignal(ms: number): AbortSignal {\n const controller = new AbortController();\n setTimeout(() => {\n controller.abort();\n }, ms);\n\n return controller.signal;\n}\n\nexport function anySignal(signals: AbortSignal[]): {\n signal: AbortSignal;\n cleanup(): void;\n} {\n const controller = new AbortController();\n\n function cleanup(): void {\n for (const signal of signals) {\n signal.removeEventListener(\"abort\", onAbort);\n }\n }\n\n function onAbort(): void {\n controller.abort();\n cleanup();\n }\n\n for (const signal of signals) {\n if (signal.aborted) {\n onAbort();\n break;\n }\n signal.addEventListener(\"abort\", onAbort);\n }\n\n return {\n signal: controller.signal,\n cleanup,\n };\n}\n\n/**\n * Attempt to turn an HTTP error response into a Javascript Error.\n *\n * If it is a JSON response, we will parse it into a MatrixError. Otherwise\n * we return a generic Error.\n *\n * @param response - response object\n * @param body - raw body of the response\n * @returns\n */\nexport function parseErrorResponse(response: XMLHttpRequest | Response, body?: string): Error {\n const httpHeaders = isXhr(response)\n ? new Headers(\n response\n .getAllResponseHeaders()\n .trim()\n .split(/[\\r\\n]+/)\n .map((header): [string, string] => {\n const colonIdx = header.indexOf(\":\");\n return [header.substring(0, colonIdx), header.substring(colonIdx + 1)];\n }),\n )\n : response.headers;\n\n let contentType: ParsedMediaType | null;\n try {\n contentType = getResponseContentType(httpHeaders);\n } catch (e) {\n return <Error>e;\n }\n if (contentType?.type === \"application/json\" && body) {\n return new MatrixError(\n JSON.parse(body),\n response.status,\n isXhr(response) ? response.responseURL : response.url,\n undefined,\n httpHeaders,\n );\n }\n if (contentType?.type === \"text/plain\") {\n return new HTTPError(`Server returned ${response.status} error: ${body}`, response.status, httpHeaders);\n }\n return new HTTPError(`Server returned ${response.status} error`, response.status, httpHeaders);\n}\n\nfunction isXhr(response: XMLHttpRequest | Response): response is XMLHttpRequest {\n return \"getResponseHeader\" in response;\n}\n\n/**\n * extract the Content-Type header from response headers, and\n * parse it to a `{type, parameters}` object.\n *\n * returns null if no content-type header could be found.\n *\n * @param response - response object\n * @returns parsed content-type header, or null if not found\n */\nfunction getResponseContentType(headers: Headers): ParsedMediaType | null {\n const contentType = headers.get(\"Content-Type\");\n if (contentType === null) return null;\n\n try {\n return parseContentType(contentType);\n } catch (e) {\n throw new Error(`Error parsing Content-Type '${contentType}': ${e}`);\n }\n}\n\n/**\n * Retries a network operation run in a callback.\n * @param maxAttempts - maximum attempts to try\n * @param callback - callback that returns a promise of the network operation. If rejected with ConnectionError, it will be retried by calling the callback again.\n * @returns the result of the network operation\n * @throws {@link ConnectionError} If after maxAttempts the callback still throws ConnectionError\n */\nexport async function retryNetworkOperation<T>(maxAttempts: number, callback: () => Promise<T>): Promise<T> {\n let attempts = 0;\n let lastConnectionError: ConnectionError | null = null;\n while (attempts < maxAttempts) {\n try {\n if (attempts > 0) {\n const timeout = 1000 * Math.pow(2, attempts);\n logger.log(`network operation failed ${attempts} times, retrying in ${timeout}ms...`);\n await sleep(timeout);\n }\n return await callback();\n } catch (err) {\n if (err instanceof ConnectionError) {\n attempts += 1;\n lastConnectionError = err;\n } else {\n throw err;\n }\n }\n }\n throw lastConnectionError;\n}\n\n/**\n * Calculate the backoff time for a request retry attempt.\n * This produces wait times of 2, 4, 8, and 16 seconds (30s total) after which we give up. If the\n * failure was due to a rate limited request, the time specified in the error is returned.\n *\n * Returns -1 if the error is not retryable, or if we reach the maximum number of attempts.\n *\n * @param err - The error thrown by the http call\n * @param attempts - The number of attempts made so far, including the one that just failed.\n * @param retryConnectionError - Whether to retry on {@link ConnectionError} (CORS, connection is down, etc.)\n */\nexport function calculateRetryBackoff(err: any, attempts: number, retryConnectionError: boolean): number {\n if (attempts > 4) {\n return -1; // give up\n }\n\n if (err instanceof ConnectionError && !retryConnectionError) {\n return -1;\n }\n\n if (err.httpStatus && Math.floor(err.httpStatus / 100) === 4 && err.httpStatus !== 429) {\n // client error; no amount of retrying will save you now (except for rate limiting which is handled below)\n return -1;\n }\n\n if (err.name === \"AbortError\") {\n // this is a client timeout, that is already very high 60s/80s\n // we don't want to retry, as it could do it for very long\n return -1;\n }\n\n // If we are trying to send an event (or similar) that is too large in any way, then retrying won't help\n if (err.name === \"M_TOO_LARGE\") {\n return -1;\n }\n\n return safeGetRetryAfterMs(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ACrF,MAAM3D,KAAK,CAAC2D,OAAO,CAAC;QACxB;QACA,aAAaH,QAAQ,CAAC,CAAC;MAC3B,CAAC,CAAC,OAAOO,GAAG,EAAE;QACV,IAAIA,GAAG,YAAY9D,eAAe,EAAE;UAChCwD,QAAQ,IAAI,CAAC;UACbC,mBAAmB,GAAGK,GAAG;QAC7B,CAAC,MAAM;UACH,MAAMA,GAAG;QACb;MACJ;IACJ;IACA,MAAML,mBAAmB;EAC7B,CAAC;EAAA,OAAAP,sBAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAaD,OAAO,SAASW,qBAAqBA,CAACD,GAAQ,EAAEN,QAAgB,EAAEQ,oBAA6B,EAAU;EACrG,IAAIR,QAAQ,GAAG,CAAC,EAAE;IACd,OAAO,CAAC,CAAC,CAAC,CAAC;EACf;EAEA,IAAIM,GAAG,YAAY9D,eAAe,IAAI,CAACgE,oBAAoB,EAAE;IACzD,OAAO,CAAC,CAAC;EACb;EAEA,IAAIF,GAAG,CAACG,UAAU,IAAIN,IAAI,CAACO,KAAK,CAACJ,GAAG,CAACG,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,IAAIH,GAAG,CAACG,UAAU,KAAK,GAAG,EAAE;IACpF;IACA,OAAO,CAAC,CAAC;EACb;EAEA,IAAIH,GAAG,CAACK,IAAI,KAAK,YAAY,EAAE;IAC3B;IACA;IACA,OAAO,CAAC,CAAC;EACb;;EAEA;EACA,IAAIL,GAAG,CAACK,IAAI,KAAK,aAAa,EAAE;IAC5B,OAAO,CAAC,CAAC;EACb;EAEA,OAAOhE,mBAAmB,CAAC2D,GAAG,EAAE,IAAI,GAAGH,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEJ,QAAQ,CAAC,CAAC;AACjE","ignoreList":[]}
package/lib/matrix.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { WidgetApi } from "matrix-widget-api";
2
2
  import { MatrixClient, ICreateClientOpts } from "./client.ts";
3
3
  import { ICapabilities } from "./embedded.ts";
4
- import { CryptoStore } from "./crypto/store/base.ts";
5
4
  export * from "./client.ts";
6
5
  export * from "./serverCapabilities.ts";
7
6
  export * from "./embedded.ts";
@@ -31,10 +30,6 @@ export * from "./interactive-auth.ts";
31
30
  export * from "./service-types.ts";
32
31
  export * from "./store/memory.ts";
33
32
  export * from "./store/indexeddb.ts";
34
- export * from "./crypto/store/memory-crypto-store.ts";
35
- export * from "./crypto/store/localStorage-crypto-store.ts";
36
- export * from "./crypto/store/indexeddb-crypto-store.ts";
37
- export type { OutgoingRoomKeyRequest } from "./crypto/store/base.ts";
38
33
  export * from "./content-repo.ts";
39
34
  export type * from "./@types/common.ts";
40
35
  export type * from "./@types/uia.ts";
@@ -52,7 +47,6 @@ export * from "./@types/polls.ts";
52
47
  export type * from "./@types/local_notifications.ts";
53
48
  export type * from "./@types/registration.ts";
54
49
  export * from "./@types/read_receipts.ts";
55
- export type * from "./@types/crypto.ts";
56
50
  export * from "./@types/extensible_events.ts";
57
51
  export type * from "./@types/IIdentityServerProvider.ts";
58
52
  export * from "./@types/membership.ts";
@@ -60,20 +54,9 @@ export * from "./models/room-summary.ts";
60
54
  export * from "./models/event-status.ts";
61
55
  export type { RoomSummary } from "./client.ts";
62
56
  export * as ContentHelpers from "./content-helpers.ts";
63
- export * as SecretStorage from "./secret-storage.ts";
64
- export type { ICryptoCallbacks } from "./crypto/index.ts";
65
- export { createNewMatrixCall, CallEvent } from "./webrtc/call.ts";
66
- export type { MatrixCall } from "./webrtc/call.ts";
67
- export { GroupCall, GroupCallEvent, GroupCallIntent, GroupCallState, GroupCallType, GroupCallStatsReportEvent, } from "./webrtc/groupCall.ts";
68
- export {
69
- /** @deprecated Use {@link Crypto.CryptoEvent} instead */
70
- CryptoEvent, } from "./crypto/index.ts";
71
57
  export { SyncState, SetPresence } from "./sync.ts";
72
58
  export type { ISyncStateData as SyncStateData } from "./sync.ts";
73
59
  export { SlidingSyncEvent } from "./sliding-sync.ts";
74
- export { MediaHandlerEvent } from "./webrtc/mediaHandler.ts";
75
- export { CallFeedEvent } from "./webrtc/callFeed.ts";
76
- export { StatsReport } from "./webrtc/stats/statsReport.ts";
77
60
  export { Relations, RelationsEvent } from "./models/relations.ts";
78
61
  export { TypedEventEmitter } from "./models/typed-event-emitter.ts";
79
62
  export { LocalStorageErrors } from "./store/local-storage-events-emitter.ts";
@@ -81,14 +64,6 @@ export { IdentityProviderBrand, SSOAction } from "./@types/auth.ts";
81
64
  export type { ISSOFlow as SSOFlow, LoginFlow } from "./@types/auth.ts";
82
65
  export type { IHierarchyRelation as HierarchyRelation, IHierarchyRoom as HierarchyRoom } from "./@types/spaces.ts";
83
66
  export { LocationAssetType } from "./@types/location.ts";
84
- /** @deprecated Backwards-compatibility re-export. Import from `crypto-api` directly. */
85
- export * as Crypto from "./crypto-api/index.ts";
86
- /**
87
- * Configure a different factory to be used for creating crypto stores
88
- *
89
- * @param fac - a function which will return a new `CryptoStore`
90
- */
91
- export declare function setCryptoStoreFactory(fac: () => CryptoStore): void;
92
67
  /**
93
68
  * Construct a Matrix Client. Similar to {@link MatrixClient}
94
69
  * except that the 'request', 'store' and 'scheduler' dependencies are satisfied.
@@ -1 +1 @@
1
- {"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../src/matrix.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAK9C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAoB,aAAa,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,o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