@openclaw/matrix 2026.7.1-beta.1 → 2026.7.1-beta.4

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 (1071) hide show
  1. package/dist/{account-selection-Bv_ZuOu4.js → account-selection-5e4mHR1m.js} +1 -1
  2. package/dist/api.js +5 -5
  3. package/dist/{approval-handler.runtime-GpL8SxX2.js → approval-handler.runtime-DI5x9r8I.js} +5 -5
  4. package/dist/{approval-ids-DIKCZewR.js → approval-ids-ZgqbspmS.js} +1 -1
  5. package/dist/{approval-reaction-auth-DhBxqiQQ.js → approval-reaction-auth-D9LijQhr.js} +2 -2
  6. package/dist/{approval-reactions-BRGQgOu2.js → approval-reactions-BdUaUXVw.js} +24 -73
  7. package/dist/auth-presence.js +1 -1
  8. package/dist/{channel-CGc6D4tf.js → channel-jUTBsjHU.js} +21 -23
  9. package/dist/channel-plugin-api.js +1 -1
  10. package/dist/{channel.runtime-CPu_uwsn.js → channel.runtime-DO1Nv9ed.js} +26 -17
  11. package/dist/{cli-BfwYmyEc.js → cli-CEfWwCKx.js} +10 -17
  12. package/dist/{cli-metadata-FO-fJqf0.js → cli-metadata-CfiEO-CE.js} +1 -1
  13. package/dist/cli-metadata.js +1 -1
  14. package/dist/{client-CVluBRDh.js → client-FRuyCNju.js} +2 -2
  15. package/dist/{client-bootstrap-1cbA9aSs.js → client-bootstrap-DjFJ7e0N.js} +6 -10
  16. package/dist/{client-Cb5ILtpE.js → client-tgnlQJk4.js} +2 -2
  17. package/dist/{config-schema-DFRmUTAG.js → config-schema-DtnhNYd-.js} +1 -1
  18. package/dist/contract-api.js +2 -2
  19. package/dist/{create-client-8YNurIAr.js → create-client-CNakT7zF.js} +7 -10
  20. package/dist/{credentials-G8lNmiME.js → credentials-Ds9V1mn2.js} +1 -1
  21. package/dist/{credentials-read-TzTOQPOM.js → credentials-read-BlkvsNFg.js} +1 -1
  22. package/dist/{credentials-write.runtime-cZhhyGAZ.js → credentials-write.runtime-CTqqxcut.js} +2 -5
  23. package/dist/{crypto-runtime-hMMmqNr1.js → crypto-runtime-B74cTS6A.js} +11 -9
  24. package/dist/{crypto-state-store-DK2tcEyP.js → crypto-state-store-Jy3qwhdy.js} +1 -1
  25. package/dist/{deps-D3bkh48_.js → deps-CdjHvnmh.js} +20 -2
  26. package/dist/{directory-live-pjbvjDz2.js → directory-live-Ufd4qSpX.js} +2 -2
  27. package/dist/{doctor-BRSDNU5C.js → doctor-DfaOqFtr.js} +3 -3
  28. package/dist/{doctor-contract-Dq8OZWHF.js → doctor-contract-BAja_fmb.js} +1 -1
  29. package/dist/doctor-contract-api.js +8 -14
  30. package/dist/{draft-stream-Djasj65z.js → draft-stream-D4EH25gv.js} +1 -1
  31. package/dist/{encryption-guidance-Bg3IRYoX.js → encryption-guidance-D8walY04.js} +1 -1
  32. package/dist/{file-sync-store-BWLVB01Y.js → file-sync-store-DVm0ACml.js} +3 -3
  33. package/dist/helper-api.js +1 -1
  34. package/dist/{idb-persistence-BGY1CJ7J.js → idb-persistence-BHm97th-.js} +1 -1
  35. package/dist/index.js +3 -6
  36. package/dist/{legacy-crypto-inspector-D_8iylBq.js → legacy-crypto-inspector-vzXSkm18.js} +1 -1
  37. package/dist/{legacy-crypto-restore-B0gcIEkE.js → legacy-crypto-restore-CIBfOmLn.js} +2 -2
  38. package/dist/{matrix-migration.runtime-Ctlb_rZl.js → matrix-migration.runtime-BMCyrANT.js} +3 -3
  39. package/dist/{media-text-CUFW_BP5.js → media-text-p-LP21qs.js} +1 -1
  40. package/dist/{messages-C1dIZHKy.js → messages-DRKkiEY-.js} +6 -5
  41. package/dist/{monitor-BMGnvIbg.js → monitor-CsGOGdwu.js} +89 -119
  42. package/dist/plugin-entry.handlers.runtime.js +2 -5
  43. package/dist/probe.runtime-2MZLc6ng.js +3 -0
  44. package/dist/{profile-update-BaEk4COs.js → profile-update-Ucc8RrJL.js} +2 -2
  45. package/dist/{reaction-events-n69MjKzG.js → reaction-events-DentrVii.js} +5 -12
  46. package/dist/{recovery-key-store-BGk8c_gf.js → recovery-key-store-DSeLFvNx.js} +1 -1
  47. package/dist/{resolve-targets-DyGW9WzC.js → resolve-targets-DcV_KfgX.js} +1 -1
  48. package/dist/{resolver.runtime-DhZV369r.js → resolver.runtime-Hr6bO5zl.js} +1 -1
  49. package/dist/runtime-api.js +2 -2
  50. package/dist/runtime-heavy-api.js +1 -1
  51. package/dist/{sdk-DOxaiBRE.js → sdk-AZYVl34z.js} +12 -13
  52. package/dist/{send-C0NwpZ-c.js → send-D92v6Yy0.js} +22 -12
  53. package/dist/session-binding-contract-api.js +1 -1
  54. package/dist/{setup-bootstrap-DbWPVINS.js → setup-bootstrap-Da564w5f.js} +2 -2
  55. package/dist/{setup-core-DVkrIoax.js → setup-core-BGgbrdaJ.js} +5 -8
  56. package/dist/setup-plugin-api.js +3 -3
  57. package/dist/{setup-surface-CN7DEvpg.js → setup-surface-iJ6pd-t5.js} +6 -6
  58. package/dist/{shared-iLI-9tb9.js → shared-DkFfq7mH.js} +16 -32
  59. package/dist/{startup-verification-Bd31KqLv.js → startup-verification-BKMAXvcV.js} +2 -2
  60. package/dist/{storage-t5S-5c_5.js → storage-CQdyKcGg.js} +5 -5
  61. package/dist/subagent-hooks-api.js +2 -5
  62. package/dist/{thread-bindings-D73QFTXW.js → thread-bindings-BX5nmWpw.js} +3 -3
  63. package/dist/{tool-actions.runtime-BCCPq_aO.js → tool-actions.runtime-C1d5fxE_.js} +12 -12
  64. package/dist/{verification-C0KvXyHK.js → verification-BGCMiO1p.js} +2 -2
  65. package/node_modules/@babel/runtime/package.json +468 -1089
  66. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/.cargo/config.toml +2 -0
  67. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/CHANGELOG.md +12 -3
  68. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/README.md +17 -0
  69. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/download-lib.js +10 -2
  70. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/package.json +1 -1
  71. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/xtask/.idea/modules.xml +8 -0
  72. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/xtask/.idea/vcs.xml +6 -0
  73. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/xtask/.idea/xtask.iml +11 -0
  74. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/package.json +1 -1
  75. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.cjs +28 -28
  76. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.js +24 -24
  77. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm +0 -0
  78. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm.d.ts +58 -58
  79. package/node_modules/content-type/README.md +32 -57
  80. package/node_modules/content-type/dist/index.d.ts +26 -0
  81. package/node_modules/content-type/dist/index.js +170 -0
  82. package/node_modules/content-type/dist/index.js.map +1 -0
  83. package/node_modules/content-type/package.json +35 -25
  84. package/node_modules/linkify-it/README.md +3 -4
  85. package/node_modules/linkify-it/build/index.cjs.js +44 -41
  86. package/node_modules/linkify-it/index.mjs +10 -11
  87. package/node_modules/linkify-it/lib/re.mjs +34 -30
  88. package/node_modules/linkify-it/package.json +10 -15
  89. package/node_modules/markdown-it/dist/index.cjs.js +3652 -5378
  90. package/node_modules/markdown-it/dist/index.cjs.js.map +1 -0
  91. package/node_modules/markdown-it/dist/markdown-it.js +1399 -4479
  92. package/node_modules/markdown-it/dist/markdown-it.js.map +1 -0
  93. package/node_modules/markdown-it/dist/markdown-it.min.js +3 -2
  94. package/node_modules/markdown-it/dist/markdown-it.min.js.map +1 -0
  95. package/node_modules/markdown-it/lib/common/html_re.mjs +9 -9
  96. package/node_modules/markdown-it/lib/common/utils.mjs +2 -11
  97. package/node_modules/markdown-it/lib/parser_block.mjs +9 -9
  98. package/node_modules/markdown-it/lib/parser_core.mjs +7 -7
  99. package/node_modules/markdown-it/lib/parser_inline.mjs +16 -16
  100. package/node_modules/markdown-it/lib/renderer.mjs +2 -2
  101. package/node_modules/markdown-it/lib/rules_block/blockquote.mjs +6 -6
  102. package/node_modules/markdown-it/lib/rules_block/code.mjs +2 -2
  103. package/node_modules/markdown-it/lib/rules_block/fence.mjs +4 -4
  104. package/node_modules/markdown-it/lib/rules_block/heading.mjs +7 -7
  105. package/node_modules/markdown-it/lib/rules_block/hr.mjs +2 -2
  106. package/node_modules/markdown-it/lib/rules_block/html_block.mjs +6 -6
  107. package/node_modules/markdown-it/lib/rules_block/lheading.mjs +8 -8
  108. package/node_modules/markdown-it/lib/rules_block/list.mjs +6 -6
  109. package/node_modules/markdown-it/lib/rules_block/paragraph.mjs +5 -5
  110. package/node_modules/markdown-it/lib/rules_block/reference.mjs +1 -1
  111. package/node_modules/markdown-it/lib/rules_block/state_block.mjs +6 -6
  112. package/node_modules/markdown-it/lib/rules_block/table.mjs +4 -4
  113. package/node_modules/markdown-it/lib/rules_core/block.mjs +3 -3
  114. package/node_modules/markdown-it/lib/rules_core/linkify.mjs +15 -15
  115. package/node_modules/markdown-it/lib/rules_core/normalize.mjs +2 -2
  116. package/node_modules/markdown-it/lib/rules_inline/autolink.mjs +17 -17
  117. package/node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs +2 -2
  118. package/node_modules/markdown-it/lib/rules_inline/emphasis.mjs +8 -8
  119. package/node_modules/markdown-it/lib/rules_inline/entity.mjs +7 -7
  120. package/node_modules/markdown-it/lib/rules_inline/escape.mjs +15 -1
  121. package/node_modules/markdown-it/lib/rules_inline/html_inline.mjs +1 -1
  122. package/node_modules/markdown-it/lib/rules_inline/link.mjs +1 -1
  123. package/node_modules/markdown-it/lib/rules_inline/state_inline.mjs +2 -2
  124. package/node_modules/markdown-it/lib/rules_inline/strikethrough.mjs +10 -10
  125. package/node_modules/markdown-it/lib/token.mjs +12 -12
  126. package/node_modules/markdown-it/package.json +25 -34
  127. package/node_modules/matrix-js-sdk/CHANGELOG.md +24 -0
  128. package/node_modules/matrix-js-sdk/README.md +1 -1
  129. package/node_modules/matrix-js-sdk/lib/@types/AESEncryptedSecretStoragePayload.js +3 -1
  130. package/node_modules/matrix-js-sdk/lib/@types/IIdentityServerProvider.js +3 -1
  131. package/node_modules/matrix-js-sdk/lib/@types/PushRules.js +7 -7
  132. package/node_modules/matrix-js-sdk/lib/@types/PushRules.js.map +1 -1
  133. package/node_modules/matrix-js-sdk/lib/@types/auth.js +4 -4
  134. package/node_modules/matrix-js-sdk/lib/@types/auth.js.map +1 -1
  135. package/node_modules/matrix-js-sdk/lib/@types/beacon.js +2 -2
  136. package/node_modules/matrix-js-sdk/lib/@types/beacon.js.map +1 -1
  137. package/node_modules/matrix-js-sdk/lib/@types/common.js +3 -1
  138. package/node_modules/matrix-js-sdk/lib/@types/crypto.js +3 -1
  139. package/node_modules/matrix-js-sdk/lib/@types/event.d.ts +6 -1
  140. package/node_modules/matrix-js-sdk/lib/@types/event.d.ts.map +1 -1
  141. package/node_modules/matrix-js-sdk/lib/@types/event.js +23 -20
  142. package/node_modules/matrix-js-sdk/lib/@types/event.js.map +1 -1
  143. package/node_modules/matrix-js-sdk/lib/@types/events.js +3 -1
  144. package/node_modules/matrix-js-sdk/lib/@types/extensible_events.js +6 -6
  145. package/node_modules/matrix-js-sdk/lib/@types/extensible_events.js.map +1 -1
  146. package/node_modules/matrix-js-sdk/lib/@types/global.d.js.map +1 -1
  147. package/node_modules/matrix-js-sdk/lib/@types/json.js +3 -1
  148. package/node_modules/matrix-js-sdk/lib/@types/local_notifications.js +3 -1
  149. package/node_modules/matrix-js-sdk/lib/@types/location.js +4 -4
  150. package/node_modules/matrix-js-sdk/lib/@types/location.js.map +1 -1
  151. package/node_modules/matrix-js-sdk/lib/@types/matrix-sdk-crypto-wasm.d.js +3 -1
  152. package/node_modules/matrix-js-sdk/lib/@types/media.js +3 -1
  153. package/node_modules/matrix-js-sdk/lib/@types/membership.js +1 -1
  154. package/node_modules/matrix-js-sdk/lib/@types/membership.js.map +1 -1
  155. package/node_modules/matrix-js-sdk/lib/@types/partials.js +6 -6
  156. package/node_modules/matrix-js-sdk/lib/@types/partials.js.map +1 -1
  157. package/node_modules/matrix-js-sdk/lib/@types/polls.js +5 -5
  158. package/node_modules/matrix-js-sdk/lib/@types/polls.js.map +1 -1
  159. package/node_modules/matrix-js-sdk/lib/@types/read_receipts.js +2 -2
  160. package/node_modules/matrix-js-sdk/lib/@types/read_receipts.js.map +1 -1
  161. package/node_modules/matrix-js-sdk/lib/@types/registration.js +3 -1
  162. package/node_modules/matrix-js-sdk/lib/@types/requests.js +1 -1
  163. package/node_modules/matrix-js-sdk/lib/@types/requests.js.map +1 -1
  164. package/node_modules/matrix-js-sdk/lib/@types/retention.d.ts +15 -0
  165. package/node_modules/matrix-js-sdk/lib/@types/retention.d.ts.map +1 -0
  166. package/node_modules/matrix-js-sdk/lib/@types/retention.js +13 -0
  167. package/node_modules/matrix-js-sdk/lib/@types/retention.js.map +1 -0
  168. package/node_modules/matrix-js-sdk/lib/@types/search.js +1 -1
  169. package/node_modules/matrix-js-sdk/lib/@types/search.js.map +1 -1
  170. package/node_modules/matrix-js-sdk/lib/@types/signed.js +3 -1
  171. package/node_modules/matrix-js-sdk/lib/@types/spaces.js +3 -1
  172. package/node_modules/matrix-js-sdk/lib/@types/state_events.js +3 -1
  173. package/node_modules/matrix-js-sdk/lib/@types/synapse.js +3 -1
  174. package/node_modules/matrix-js-sdk/lib/@types/sync.js +1 -1
  175. package/node_modules/matrix-js-sdk/lib/@types/sync.js.map +1 -1
  176. package/node_modules/matrix-js-sdk/lib/@types/threepids.js +1 -1
  177. package/node_modules/matrix-js-sdk/lib/@types/threepids.js.map +1 -1
  178. package/node_modules/matrix-js-sdk/lib/@types/topic.js +1 -1
  179. package/node_modules/matrix-js-sdk/lib/@types/topic.js.map +1 -1
  180. package/node_modules/matrix-js-sdk/lib/@types/uia.js +3 -1
  181. package/node_modules/matrix-js-sdk/lib/NamespacedValue.js +8 -8
  182. package/node_modules/matrix-js-sdk/lib/NamespacedValue.js.map +1 -1
  183. package/node_modules/matrix-js-sdk/lib/ReEmitter.js +8 -15
  184. package/node_modules/matrix-js-sdk/lib/ReEmitter.js.map +1 -1
  185. package/node_modules/matrix-js-sdk/lib/ToDeviceMessageQueue.js +47 -55
  186. package/node_modules/matrix-js-sdk/lib/ToDeviceMessageQueue.js.map +1 -1
  187. package/node_modules/matrix-js-sdk/lib/autodiscovery.js +233 -247
  188. package/node_modules/matrix-js-sdk/lib/autodiscovery.js.map +1 -1
  189. package/node_modules/matrix-js-sdk/lib/base64.js +1 -1
  190. package/node_modules/matrix-js-sdk/lib/base64.js.map +1 -1
  191. package/node_modules/matrix-js-sdk/lib/browser-index.d.ts +2 -2
  192. package/node_modules/matrix-js-sdk/lib/browser-index.d.ts.map +1 -1
  193. package/node_modules/matrix-js-sdk/lib/browser-index.js +5 -5
  194. package/node_modules/matrix-js-sdk/lib/browser-index.js.map +1 -1
  195. package/node_modules/matrix-js-sdk/lib/capabilityPoller.d.ts +38 -0
  196. package/node_modules/matrix-js-sdk/lib/capabilityPoller.d.ts.map +1 -0
  197. package/node_modules/matrix-js-sdk/lib/capabilityPoller.js +93 -0
  198. package/node_modules/matrix-js-sdk/lib/capabilityPoller.js.map +1 -0
  199. package/node_modules/matrix-js-sdk/lib/client.d.ts +9 -8
  200. package/node_modules/matrix-js-sdk/lib/client.d.ts.map +1 -1
  201. package/node_modules/matrix-js-sdk/lib/client.js +2123 -2483
  202. package/node_modules/matrix-js-sdk/lib/client.js.map +1 -1
  203. package/node_modules/matrix-js-sdk/lib/common-crypto/CryptoBackend.js +3 -1
  204. package/node_modules/matrix-js-sdk/lib/common-crypto/CryptoBackend.js.map +1 -1
  205. package/node_modules/matrix-js-sdk/lib/common-crypto/key-passphrase.js.map +1 -1
  206. package/node_modules/matrix-js-sdk/lib/content-helpers.js +43 -48
  207. package/node_modules/matrix-js-sdk/lib/content-helpers.js.map +1 -1
  208. package/node_modules/matrix-js-sdk/lib/content-repo.js +14 -24
  209. package/node_modules/matrix-js-sdk/lib/content-repo.js.map +1 -1
  210. package/node_modules/matrix-js-sdk/lib/crypto/store/base.js +6 -6
  211. package/node_modules/matrix-js-sdk/lib/crypto/store/base.js.map +1 -1
  212. package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store-backend.js +189 -237
  213. package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store-backend.js.map +1 -1
  214. package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store.js +25 -28
  215. package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store.js.map +1 -1
  216. package/node_modules/matrix-js-sdk/lib/crypto/store/localStorage-crypto-store.js +113 -145
  217. package/node_modules/matrix-js-sdk/lib/crypto/store/localStorage-crypto-store.js.map +1 -1
  218. package/node_modules/matrix-js-sdk/lib/crypto/store/memory-crypto-store.js +74 -105
  219. package/node_modules/matrix-js-sdk/lib/crypto/store/memory-crypto-store.js.map +1 -1
  220. package/node_modules/matrix-js-sdk/lib/crypto-api/CryptoEvent.js +1 -1
  221. package/node_modules/matrix-js-sdk/lib/crypto-api/CryptoEvent.js.map +1 -1
  222. package/node_modules/matrix-js-sdk/lib/crypto-api/CryptoEventHandlerMap.js +3 -1
  223. package/node_modules/matrix-js-sdk/lib/crypto-api/index.d.ts +15 -6
  224. package/node_modules/matrix-js-sdk/lib/crypto-api/index.d.ts.map +1 -1
  225. package/node_modules/matrix-js-sdk/lib/crypto-api/index.js +76 -76
  226. package/node_modules/matrix-js-sdk/lib/crypto-api/index.js.map +1 -1
  227. package/node_modules/matrix-js-sdk/lib/crypto-api/key-passphrase.js +15 -23
  228. package/node_modules/matrix-js-sdk/lib/crypto-api/key-passphrase.js.map +1 -1
  229. package/node_modules/matrix-js-sdk/lib/crypto-api/keybackup.js +3 -1
  230. package/node_modules/matrix-js-sdk/lib/crypto-api/recovery-key.js +11 -12
  231. package/node_modules/matrix-js-sdk/lib/crypto-api/recovery-key.js.map +1 -1
  232. package/node_modules/matrix-js-sdk/lib/crypto-api/verification.js +3 -3
  233. package/node_modules/matrix-js-sdk/lib/crypto-api/verification.js.map +1 -1
  234. package/node_modules/matrix-js-sdk/lib/digest.js +7 -14
  235. package/node_modules/matrix-js-sdk/lib/digest.js.map +1 -1
  236. package/node_modules/matrix-js-sdk/lib/embedded.d.ts.map +1 -1
  237. package/node_modules/matrix-js-sdk/lib/embedded.js +379 -500
  238. package/node_modules/matrix-js-sdk/lib/embedded.js.map +1 -1
  239. package/node_modules/matrix-js-sdk/lib/errors.js +2 -2
  240. package/node_modules/matrix-js-sdk/lib/errors.js.map +1 -1
  241. package/node_modules/matrix-js-sdk/lib/event-mapper.js +10 -12
  242. package/node_modules/matrix-js-sdk/lib/event-mapper.js.map +1 -1
  243. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/ExtensibleEvent.js.map +1 -1
  244. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/InvalidEventError.js.map +1 -1
  245. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/MessageEvent.js +26 -28
  246. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/MessageEvent.js.map +1 -1
  247. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollEndEvent.js +11 -12
  248. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollEndEvent.js.map +1 -1
  249. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollResponseEvent.js +6 -6
  250. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollResponseEvent.js.map +1 -1
  251. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollStartEvent.js +36 -38
  252. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollStartEvent.js.map +1 -1
  253. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/utilities.js.map +1 -1
  254. package/node_modules/matrix-js-sdk/lib/feature.js +18 -31
  255. package/node_modules/matrix-js-sdk/lib/feature.js.map +1 -1
  256. package/node_modules/matrix-js-sdk/lib/filter-component.d.ts.map +1 -1
  257. package/node_modules/matrix-js-sdk/lib/filter-component.js +20 -26
  258. package/node_modules/matrix-js-sdk/lib/filter-component.js.map +1 -1
  259. package/node_modules/matrix-js-sdk/lib/filter.js +14 -15
  260. package/node_modules/matrix-js-sdk/lib/filter.js.map +1 -1
  261. package/node_modules/matrix-js-sdk/lib/http-api/errors.js +41 -56
  262. package/node_modules/matrix-js-sdk/lib/http-api/errors.js.map +1 -1
  263. package/node_modules/matrix-js-sdk/lib/http-api/fetch.js +140 -157
  264. package/node_modules/matrix-js-sdk/lib/http-api/fetch.js.map +1 -1
  265. package/node_modules/matrix-js-sdk/lib/http-api/index.js +17 -20
  266. package/node_modules/matrix-js-sdk/lib/http-api/index.js.map +1 -1
  267. package/node_modules/matrix-js-sdk/lib/http-api/interface.js +1 -1
  268. package/node_modules/matrix-js-sdk/lib/http-api/interface.js.map +1 -1
  269. package/node_modules/matrix-js-sdk/lib/http-api/method.js +1 -1
  270. package/node_modules/matrix-js-sdk/lib/http-api/method.js.map +1 -1
  271. package/node_modules/matrix-js-sdk/lib/http-api/prefix.js +3 -3
  272. package/node_modules/matrix-js-sdk/lib/http-api/prefix.js.map +1 -1
  273. package/node_modules/matrix-js-sdk/lib/http-api/refresh.js +80 -99
  274. package/node_modules/matrix-js-sdk/lib/http-api/refresh.js.map +1 -1
  275. package/node_modules/matrix-js-sdk/lib/http-api/utils.d.ts +1 -1
  276. package/node_modules/matrix-js-sdk/lib/http-api/utils.d.ts.map +1 -1
  277. package/node_modules/matrix-js-sdk/lib/http-api/utils.js +35 -47
  278. package/node_modules/matrix-js-sdk/lib/http-api/utils.js.map +1 -1
  279. package/node_modules/matrix-js-sdk/lib/index.js.map +1 -1
  280. package/node_modules/matrix-js-sdk/lib/indexeddb-helpers.js +3 -3
  281. package/node_modules/matrix-js-sdk/lib/indexeddb-helpers.js.map +1 -1
  282. package/node_modules/matrix-js-sdk/lib/indexeddb-worker.js.map +1 -1
  283. package/node_modules/matrix-js-sdk/lib/interactive-auth.d.ts +5 -5
  284. package/node_modules/matrix-js-sdk/lib/interactive-auth.d.ts.map +1 -1
  285. package/node_modules/matrix-js-sdk/lib/interactive-auth.js +181 -203
  286. package/node_modules/matrix-js-sdk/lib/interactive-auth.js.map +1 -1
  287. package/node_modules/matrix-js-sdk/lib/logger.js +22 -56
  288. package/node_modules/matrix-js-sdk/lib/logger.js.map +1 -1
  289. package/node_modules/matrix-js-sdk/lib/matrix.d.ts +1 -0
  290. package/node_modules/matrix-js-sdk/lib/matrix.d.ts.map +1 -1
  291. package/node_modules/matrix-js-sdk/lib/matrix.js +8 -11
  292. package/node_modules/matrix-js-sdk/lib/matrix.js.map +1 -1
  293. package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.js +83 -76
  294. package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.js.map +1 -1
  295. package/node_modules/matrix-js-sdk/lib/matrixrtc/EncryptionManager.js +1 -1
  296. package/node_modules/matrix-js-sdk/lib/matrixrtc/EncryptionManager.js.map +1 -1
  297. package/node_modules/matrix-js-sdk/lib/matrixrtc/IKeyTransport.js +1 -1
  298. package/node_modules/matrix-js-sdk/lib/matrixrtc/IKeyTransport.js.map +1 -1
  299. package/node_modules/matrix-js-sdk/lib/matrixrtc/IMembershipManager.js +1 -1
  300. package/node_modules/matrix-js-sdk/lib/matrixrtc/IMembershipManager.js.map +1 -1
  301. package/node_modules/matrix-js-sdk/lib/matrixrtc/LivekitTransport.d.ts +1 -1
  302. package/node_modules/matrix-js-sdk/lib/matrixrtc/LivekitTransport.js +4 -4
  303. package/node_modules/matrix-js-sdk/lib/matrixrtc/LivekitTransport.js.map +1 -1
  304. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.d.ts.map +1 -1
  305. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.js +144 -184
  306. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.js.map +1 -1
  307. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.js +35 -39
  308. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.js.map +1 -1
  309. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.d.ts +2 -0
  310. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.d.ts.map +1 -1
  311. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.js +346 -383
  312. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.js.map +1 -1
  313. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManagerActionScheduler.d.ts.map +1 -1
  314. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManagerActionScheduler.js +54 -59
  315. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManagerActionScheduler.js.map +1 -1
  316. package/node_modules/matrix-js-sdk/lib/matrixrtc/RTCEncryptionManager.js +117 -139
  317. package/node_modules/matrix-js-sdk/lib/matrixrtc/RTCEncryptionManager.js.map +1 -1
  318. package/node_modules/matrix-js-sdk/lib/matrixrtc/ToDeviceKeyTransport.js +49 -54
  319. package/node_modules/matrix-js-sdk/lib/matrixrtc/ToDeviceKeyTransport.js.map +1 -1
  320. package/node_modules/matrix-js-sdk/lib/matrixrtc/index.js.map +1 -1
  321. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/common.js +1 -1
  322. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/common.js.map +1 -1
  323. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/index.js.map +1 -1
  324. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.js +15 -23
  325. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.js.map +1 -1
  326. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/session.js +4 -5
  327. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/session.js.map +1 -1
  328. package/node_modules/matrix-js-sdk/lib/matrixrtc/types.js +4 -6
  329. package/node_modules/matrix-js-sdk/lib/matrixrtc/types.js.map +1 -1
  330. package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.js +4 -11
  331. package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.js.map +1 -1
  332. package/node_modules/matrix-js-sdk/lib/models/MSC3089Branch.js +91 -116
  333. package/node_modules/matrix-js-sdk/lib/models/MSC3089Branch.js.map +1 -1
  334. package/node_modules/matrix-js-sdk/lib/models/MSC3089TreeSpace.js +209 -244
  335. package/node_modules/matrix-js-sdk/lib/models/MSC3089TreeSpace.js.map +1 -1
  336. package/node_modules/matrix-js-sdk/lib/models/ToDeviceMessage.js +3 -1
  337. package/node_modules/matrix-js-sdk/lib/models/beacon.js +20 -15
  338. package/node_modules/matrix-js-sdk/lib/models/beacon.js.map +1 -1
  339. package/node_modules/matrix-js-sdk/lib/models/compare-event-ordering.js +13 -13
  340. package/node_modules/matrix-js-sdk/lib/models/compare-event-ordering.js.map +1 -1
  341. package/node_modules/matrix-js-sdk/lib/models/device.js +10 -3
  342. package/node_modules/matrix-js-sdk/lib/models/device.js.map +1 -1
  343. package/node_modules/matrix-js-sdk/lib/models/event-context.js +5 -7
  344. package/node_modules/matrix-js-sdk/lib/models/event-context.js.map +1 -1
  345. package/node_modules/matrix-js-sdk/lib/models/event-status.js +1 -1
  346. package/node_modules/matrix-js-sdk/lib/models/event-status.js.map +1 -1
  347. package/node_modules/matrix-js-sdk/lib/models/event-timeline-set.js +91 -91
  348. package/node_modules/matrix-js-sdk/lib/models/event-timeline-set.js.map +1 -1
  349. package/node_modules/matrix-js-sdk/lib/models/event-timeline.js +31 -29
  350. package/node_modules/matrix-js-sdk/lib/models/event-timeline.js.map +1 -1
  351. package/node_modules/matrix-js-sdk/lib/models/event.js +215 -235
  352. package/node_modules/matrix-js-sdk/lib/models/event.js.map +1 -1
  353. package/node_modules/matrix-js-sdk/lib/models/invites-ignorer-types.js +4 -4
  354. package/node_modules/matrix-js-sdk/lib/models/invites-ignorer-types.js.map +1 -1
  355. package/node_modules/matrix-js-sdk/lib/models/invites-ignorer.js +159 -179
  356. package/node_modules/matrix-js-sdk/lib/models/invites-ignorer.js.map +1 -1
  357. package/node_modules/matrix-js-sdk/lib/models/poll.js +72 -78
  358. package/node_modules/matrix-js-sdk/lib/models/poll.js.map +1 -1
  359. package/node_modules/matrix-js-sdk/lib/models/profile-keys.js +2 -2
  360. package/node_modules/matrix-js-sdk/lib/models/profile-keys.js.map +1 -1
  361. package/node_modules/matrix-js-sdk/lib/models/read-receipt.js +40 -56
  362. package/node_modules/matrix-js-sdk/lib/models/read-receipt.js.map +1 -1
  363. package/node_modules/matrix-js-sdk/lib/models/related-relations.js +2 -0
  364. package/node_modules/matrix-js-sdk/lib/models/related-relations.js.map +1 -1
  365. package/node_modules/matrix-js-sdk/lib/models/relations-container.js +20 -21
  366. package/node_modules/matrix-js-sdk/lib/models/relations-container.js.map +1 -1
  367. package/node_modules/matrix-js-sdk/lib/models/relations.js +131 -156
  368. package/node_modules/matrix-js-sdk/lib/models/relations.js.map +1 -1
  369. package/node_modules/matrix-js-sdk/lib/models/room-member.js +44 -27
  370. package/node_modules/matrix-js-sdk/lib/models/room-member.js.map +1 -1
  371. package/node_modules/matrix-js-sdk/lib/models/room-receipts.js +48 -55
  372. package/node_modules/matrix-js-sdk/lib/models/room-receipts.js.map +1 -1
  373. package/node_modules/matrix-js-sdk/lib/models/room-retention.d.ts +28 -0
  374. package/node_modules/matrix-js-sdk/lib/models/room-retention.d.ts.map +1 -0
  375. package/node_modules/matrix-js-sdk/lib/models/room-retention.js +192 -0
  376. package/node_modules/matrix-js-sdk/lib/models/room-retention.js.map +1 -0
  377. package/node_modules/matrix-js-sdk/lib/models/room-state.js +141 -170
  378. package/node_modules/matrix-js-sdk/lib/models/room-state.js.map +1 -1
  379. package/node_modules/matrix-js-sdk/lib/models/room-sticky-events.d.ts +1 -0
  380. package/node_modules/matrix-js-sdk/lib/models/room-sticky-events.d.ts.map +1 -1
  381. package/node_modules/matrix-js-sdk/lib/models/room-sticky-events.js +46 -65
  382. package/node_modules/matrix-js-sdk/lib/models/room-sticky-events.js.map +1 -1
  383. package/node_modules/matrix-js-sdk/lib/models/room-summary.js.map +1 -1
  384. package/node_modules/matrix-js-sdk/lib/models/room.d.ts +2 -1
  385. package/node_modules/matrix-js-sdk/lib/models/room.d.ts.map +1 -1
  386. package/node_modules/matrix-js-sdk/lib/models/room.js +800 -887
  387. package/node_modules/matrix-js-sdk/lib/models/room.js.map +1 -1
  388. package/node_modules/matrix-js-sdk/lib/models/search-result.js +5 -5
  389. package/node_modules/matrix-js-sdk/lib/models/search-result.js.map +1 -1
  390. package/node_modules/matrix-js-sdk/lib/models/thread.js +267 -283
  391. package/node_modules/matrix-js-sdk/lib/models/thread.js.map +1 -1
  392. package/node_modules/matrix-js-sdk/lib/models/typed-event-emitter.js +7 -18
  393. package/node_modules/matrix-js-sdk/lib/models/typed-event-emitter.js.map +1 -1
  394. package/node_modules/matrix-js-sdk/lib/models/user.js +26 -7
  395. package/node_modules/matrix-js-sdk/lib/models/user.js.map +1 -1
  396. package/node_modules/matrix-js-sdk/lib/oidc/authorize.js +208 -241
  397. package/node_modules/matrix-js-sdk/lib/oidc/authorize.js.map +1 -1
  398. package/node_modules/matrix-js-sdk/lib/oidc/discovery.js +23 -36
  399. package/node_modules/matrix-js-sdk/lib/oidc/discovery.js.map +1 -1
  400. package/node_modules/matrix-js-sdk/lib/oidc/error.js +1 -1
  401. package/node_modules/matrix-js-sdk/lib/oidc/error.js.map +1 -1
  402. package/node_modules/matrix-js-sdk/lib/oidc/index.js +1 -0
  403. package/node_modules/matrix-js-sdk/lib/oidc/index.js.map +1 -1
  404. package/node_modules/matrix-js-sdk/lib/oidc/register.js +60 -66
  405. package/node_modules/matrix-js-sdk/lib/oidc/register.js.map +1 -1
  406. package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.js +83 -94
  407. package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.js.map +1 -1
  408. package/node_modules/matrix-js-sdk/lib/oidc/validate.js +18 -18
  409. package/node_modules/matrix-js-sdk/lib/oidc/validate.js.map +1 -1
  410. package/node_modules/matrix-js-sdk/lib/pushprocessor.js +70 -81
  411. package/node_modules/matrix-js-sdk/lib/pushprocessor.js.map +1 -1
  412. package/node_modules/matrix-js-sdk/lib/randomstring.js +9 -9
  413. package/node_modules/matrix-js-sdk/lib/randomstring.js.map +1 -1
  414. package/node_modules/matrix-js-sdk/lib/realtime-callbacks.js +25 -28
  415. package/node_modules/matrix-js-sdk/lib/realtime-callbacks.js.map +1 -1
  416. package/node_modules/matrix-js-sdk/lib/receipt-accumulator.d.ts +2 -0
  417. package/node_modules/matrix-js-sdk/lib/receipt-accumulator.d.ts.map +1 -1
  418. package/node_modules/matrix-js-sdk/lib/receipt-accumulator.js +14 -22
  419. package/node_modules/matrix-js-sdk/lib/receipt-accumulator.js.map +1 -1
  420. package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.js +272 -298
  421. package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.js.map +1 -1
  422. package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousChannel.js +3 -1
  423. package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousCode.js +3 -1
  424. package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousError.js.map +1 -1
  425. package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousFailureReason.js +2 -2
  426. package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousFailureReason.js.map +1 -1
  427. package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousIntent.js +1 -1
  428. package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousIntent.js.map +1 -1
  429. package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousTransport.js +3 -1
  430. package/node_modules/matrix-js-sdk/lib/rendezvous/channels/MSC4108SecureChannel.js +122 -144
  431. package/node_modules/matrix-js-sdk/lib/rendezvous/channels/MSC4108SecureChannel.js.map +1 -1
  432. package/node_modules/matrix-js-sdk/lib/rendezvous/index.js +44 -69
  433. package/node_modules/matrix-js-sdk/lib/rendezvous/index.js.map +1 -1
  434. package/node_modules/matrix-js-sdk/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts +1 -1
  435. package/node_modules/matrix-js-sdk/lib/rendezvous/transports/MSC4108RendezvousSession.js +142 -152
  436. package/node_modules/matrix-js-sdk/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +1 -1
  437. package/node_modules/matrix-js-sdk/lib/retentionPolicy.d.ts +33 -0
  438. package/node_modules/matrix-js-sdk/lib/retentionPolicy.d.ts.map +1 -0
  439. package/node_modules/matrix-js-sdk/lib/retentionPolicy.js +39 -0
  440. package/node_modules/matrix-js-sdk/lib/retentionPolicy.js.map +1 -0
  441. package/node_modules/matrix-js-sdk/lib/room-hierarchy.js +52 -56
  442. package/node_modules/matrix-js-sdk/lib/room-hierarchy.js.map +1 -1
  443. package/node_modules/matrix-js-sdk/lib/rust-crypto/CrossSigningIdentity.js +94 -104
  444. package/node_modules/matrix-js-sdk/lib/rust-crypto/CrossSigningIdentity.js.map +1 -1
  445. package/node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.js +158 -190
  446. package/node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.js.map +1 -1
  447. package/node_modules/matrix-js-sdk/lib/rust-crypto/KeyClaimManager.js +17 -20
  448. package/node_modules/matrix-js-sdk/lib/rust-crypto/KeyClaimManager.js.map +1 -1
  449. package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.js +109 -139
  450. package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.js.map +1 -1
  451. package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestsManager.js +72 -86
  452. package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestsManager.js.map +1 -1
  453. package/node_modules/matrix-js-sdk/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts +1 -1
  454. package/node_modules/matrix-js-sdk/lib/rust-crypto/PerSessionKeyBackupDownloader.js +195 -221
  455. package/node_modules/matrix-js-sdk/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +1 -1
  456. package/node_modules/matrix-js-sdk/lib/rust-crypto/RoomEncryptor.js +121 -137
  457. package/node_modules/matrix-js-sdk/lib/rust-crypto/RoomEncryptor.js.map +1 -1
  458. package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.d.ts +7 -2
  459. package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.d.ts.map +1 -1
  460. package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.js +459 -544
  461. package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.js.map +1 -1
  462. package/node_modules/matrix-js-sdk/lib/rust-crypto/constants.js +1 -1
  463. package/node_modules/matrix-js-sdk/lib/rust-crypto/constants.js.map +1 -1
  464. package/node_modules/matrix-js-sdk/lib/rust-crypto/device-converter.js +15 -28
  465. package/node_modules/matrix-js-sdk/lib/rust-crypto/device-converter.js.map +1 -1
  466. package/node_modules/matrix-js-sdk/lib/rust-crypto/index.js +103 -116
  467. package/node_modules/matrix-js-sdk/lib/rust-crypto/index.js.map +1 -1
  468. package/node_modules/matrix-js-sdk/lib/rust-crypto/libolm_migration.js +303 -365
  469. package/node_modules/matrix-js-sdk/lib/rust-crypto/libolm_migration.js.map +1 -1
  470. package/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.d.ts +5 -1
  471. package/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.d.ts.map +1 -1
  472. package/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.js +1065 -1322
  473. package/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.js.map +1 -1
  474. package/node_modules/matrix-js-sdk/lib/rust-crypto/secret-storage.js +12 -25
  475. package/node_modules/matrix-js-sdk/lib/rust-crypto/secret-storage.js.map +1 -1
  476. package/node_modules/matrix-js-sdk/lib/rust-crypto/verification.js +134 -184
  477. package/node_modules/matrix-js-sdk/lib/rust-crypto/verification.js.map +1 -1
  478. package/node_modules/matrix-js-sdk/lib/scheduler.js +42 -17
  479. package/node_modules/matrix-js-sdk/lib/scheduler.js.map +1 -1
  480. package/node_modules/matrix-js-sdk/lib/secret-storage.js +179 -213
  481. package/node_modules/matrix-js-sdk/lib/secret-storage.js.map +1 -1
  482. package/node_modules/matrix-js-sdk/lib/serverCapabilities.d.ts +4 -23
  483. package/node_modules/matrix-js-sdk/lib/serverCapabilities.d.ts.map +1 -1
  484. package/node_modules/matrix-js-sdk/lib/serverCapabilities.js +9 -62
  485. package/node_modules/matrix-js-sdk/lib/serverCapabilities.js.map +1 -1
  486. package/node_modules/matrix-js-sdk/lib/service-types.js +1 -1
  487. package/node_modules/matrix-js-sdk/lib/service-types.js.map +1 -1
  488. package/node_modules/matrix-js-sdk/lib/sliding-sync-sdk.d.ts.map +1 -1
  489. package/node_modules/matrix-js-sdk/lib/sliding-sync-sdk.js +368 -421
  490. package/node_modules/matrix-js-sdk/lib/sliding-sync-sdk.js.map +1 -1
  491. package/node_modules/matrix-js-sdk/lib/sliding-sync.js +136 -167
  492. package/node_modules/matrix-js-sdk/lib/sliding-sync.js.map +1 -1
  493. package/node_modules/matrix-js-sdk/lib/store/index.d.ts +7 -0
  494. package/node_modules/matrix-js-sdk/lib/store/index.d.ts.map +1 -1
  495. package/node_modules/matrix-js-sdk/lib/store/index.js +3 -1
  496. package/node_modules/matrix-js-sdk/lib/store/index.js.map +1 -1
  497. package/node_modules/matrix-js-sdk/lib/store/indexeddb-backend.js +3 -1
  498. package/node_modules/matrix-js-sdk/lib/store/indexeddb-local-backend.d.ts +1 -0
  499. package/node_modules/matrix-js-sdk/lib/store/indexeddb-local-backend.d.ts.map +1 -1
  500. package/node_modules/matrix-js-sdk/lib/store/indexeddb-local-backend.js +197 -240
  501. package/node_modules/matrix-js-sdk/lib/store/indexeddb-local-backend.js.map +1 -1
  502. package/node_modules/matrix-js-sdk/lib/store/indexeddb-remote-backend.d.ts +3 -1
  503. package/node_modules/matrix-js-sdk/lib/store/indexeddb-remote-backend.d.ts.map +1 -1
  504. package/node_modules/matrix-js-sdk/lib/store/indexeddb-remote-backend.js +51 -59
  505. package/node_modules/matrix-js-sdk/lib/store/indexeddb-remote-backend.js.map +1 -1
  506. package/node_modules/matrix-js-sdk/lib/store/indexeddb-store-worker.js +22 -22
  507. package/node_modules/matrix-js-sdk/lib/store/indexeddb-store-worker.js.map +1 -1
  508. package/node_modules/matrix-js-sdk/lib/store/indexeddb.d.ts +7 -5
  509. package/node_modules/matrix-js-sdk/lib/store/indexeddb.d.ts.map +1 -1
  510. package/node_modules/matrix-js-sdk/lib/store/indexeddb.js +63 -79
  511. package/node_modules/matrix-js-sdk/lib/store/indexeddb.js.map +1 -1
  512. package/node_modules/matrix-js-sdk/lib/store/local-storage-events-emitter.js +2 -2
  513. package/node_modules/matrix-js-sdk/lib/store/local-storage-events-emitter.js.map +1 -1
  514. package/node_modules/matrix-js-sdk/lib/store/memory.d.ts +1 -0
  515. package/node_modules/matrix-js-sdk/lib/store/memory.d.ts.map +1 -1
  516. package/node_modules/matrix-js-sdk/lib/store/memory.js +38 -54
  517. package/node_modules/matrix-js-sdk/lib/store/memory.js.map +1 -1
  518. package/node_modules/matrix-js-sdk/lib/store/stub.d.ts +1 -0
  519. package/node_modules/matrix-js-sdk/lib/store/stub.d.ts.map +1 -1
  520. package/node_modules/matrix-js-sdk/lib/store/stub.js +22 -32
  521. package/node_modules/matrix-js-sdk/lib/store/stub.js.map +1 -1
  522. package/node_modules/matrix-js-sdk/lib/sync-accumulator.d.ts +1 -0
  523. package/node_modules/matrix-js-sdk/lib/sync-accumulator.d.ts.map +1 -1
  524. package/node_modules/matrix-js-sdk/lib/sync-accumulator.js +57 -65
  525. package/node_modules/matrix-js-sdk/lib/sync-accumulator.js.map +1 -1
  526. package/node_modules/matrix-js-sdk/lib/sync.d.ts.map +1 -1
  527. package/node_modules/matrix-js-sdk/lib/sync.js +914 -991
  528. package/node_modules/matrix-js-sdk/lib/sync.js.map +1 -1
  529. package/node_modules/matrix-js-sdk/lib/testing.js +63 -105
  530. package/node_modules/matrix-js-sdk/lib/testing.js.map +1 -1
  531. package/node_modules/matrix-js-sdk/lib/thread-utils.js +1 -4
  532. package/node_modules/matrix-js-sdk/lib/thread-utils.js.map +1 -1
  533. package/node_modules/matrix-js-sdk/lib/timeline-window.js +90 -99
  534. package/node_modules/matrix-js-sdk/lib/timeline-window.js.map +1 -1
  535. package/node_modules/matrix-js-sdk/lib/types.js +1 -1
  536. package/node_modules/matrix-js-sdk/lib/types.js.map +1 -1
  537. package/node_modules/matrix-js-sdk/lib/utils/decryptAESSecretStorageItem.js +14 -25
  538. package/node_modules/matrix-js-sdk/lib/utils/decryptAESSecretStorageItem.js.map +1 -1
  539. package/node_modules/matrix-js-sdk/lib/utils/encryptAESSecretStorageItem.js +27 -38
  540. package/node_modules/matrix-js-sdk/lib/utils/encryptAESSecretStorageItem.js.map +1 -1
  541. package/node_modules/matrix-js-sdk/lib/utils/internal/deriveKeys.js +25 -32
  542. package/node_modules/matrix-js-sdk/lib/utils/internal/deriveKeys.js.map +1 -1
  543. package/node_modules/matrix-js-sdk/lib/utils/roomVersion.js +1 -1
  544. package/node_modules/matrix-js-sdk/lib/utils/roomVersion.js.map +1 -1
  545. package/node_modules/matrix-js-sdk/lib/utils.js +83 -135
  546. package/node_modules/matrix-js-sdk/lib/utils.js.map +1 -1
  547. package/node_modules/matrix-js-sdk/lib/version-support.js +3 -3
  548. package/node_modules/matrix-js-sdk/lib/version-support.js.map +1 -1
  549. package/node_modules/matrix-js-sdk/lib/webrtc/audioContext.js +5 -6
  550. package/node_modules/matrix-js-sdk/lib/webrtc/audioContext.js.map +1 -1
  551. package/node_modules/matrix-js-sdk/lib/webrtc/call.js +1123 -1256
  552. package/node_modules/matrix-js-sdk/lib/webrtc/call.js.map +1 -1
  553. package/node_modules/matrix-js-sdk/lib/webrtc/callEventHandler.js +207 -214
  554. package/node_modules/matrix-js-sdk/lib/webrtc/callEventHandler.js.map +1 -1
  555. package/node_modules/matrix-js-sdk/lib/webrtc/callEventTypes.js +2 -2
  556. package/node_modules/matrix-js-sdk/lib/webrtc/callEventTypes.js.map +1 -1
  557. package/node_modules/matrix-js-sdk/lib/webrtc/callFeed.js +33 -20
  558. package/node_modules/matrix-js-sdk/lib/webrtc/callFeed.js.map +1 -1
  559. package/node_modules/matrix-js-sdk/lib/webrtc/groupCall.js +521 -594
  560. package/node_modules/matrix-js-sdk/lib/webrtc/groupCall.js.map +1 -1
  561. package/node_modules/matrix-js-sdk/lib/webrtc/groupCallEventHandler.js +58 -61
  562. package/node_modules/matrix-js-sdk/lib/webrtc/groupCallEventHandler.js.map +1 -1
  563. package/node_modules/matrix-js-sdk/lib/webrtc/mediaHandler.js +203 -233
  564. package/node_modules/matrix-js-sdk/lib/webrtc/mediaHandler.js.map +1 -1
  565. package/node_modules/matrix-js-sdk/lib/webrtc/stats/callFeedStatsReporter.js +16 -20
  566. package/node_modules/matrix-js-sdk/lib/webrtc/stats/callFeedStatsReporter.js.map +1 -1
  567. package/node_modules/matrix-js-sdk/lib/webrtc/stats/callStatsReportGatherer.js +65 -70
  568. package/node_modules/matrix-js-sdk/lib/webrtc/stats/callStatsReportGatherer.js.map +1 -1
  569. package/node_modules/matrix-js-sdk/lib/webrtc/stats/callStatsReportSummary.js +3 -1
  570. package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStats.js.map +1 -1
  571. package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStatsBuilder.js +2 -2
  572. package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStatsBuilder.js.map +1 -1
  573. package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStatsReportBuilder.js +20 -24
  574. package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStatsReportBuilder.js.map +1 -1
  575. package/node_modules/matrix-js-sdk/lib/webrtc/stats/groupCallStats.js +4 -5
  576. package/node_modules/matrix-js-sdk/lib/webrtc/stats/groupCallStats.js.map +1 -1
  577. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaSsrcHandler.js +7 -8
  578. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaSsrcHandler.js.map +1 -1
  579. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackHandler.js +7 -9
  580. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackHandler.js.map +1 -1
  581. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackStats.js.map +1 -1
  582. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackStatsHandler.js +6 -6
  583. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackStatsHandler.js.map +1 -1
  584. package/node_modules/matrix-js-sdk/lib/webrtc/stats/statsReport.js +1 -1
  585. package/node_modules/matrix-js-sdk/lib/webrtc/stats/statsReport.js.map +1 -1
  586. package/node_modules/matrix-js-sdk/lib/webrtc/stats/statsReportEmitter.js.map +1 -1
  587. package/node_modules/matrix-js-sdk/lib/webrtc/stats/summaryStatsReportGatherer.js +14 -14
  588. package/node_modules/matrix-js-sdk/lib/webrtc/stats/summaryStatsReportGatherer.js.map +1 -1
  589. package/node_modules/matrix-js-sdk/lib/webrtc/stats/trackStatsBuilder.js +32 -34
  590. package/node_modules/matrix-js-sdk/lib/webrtc/stats/trackStatsBuilder.js.map +1 -1
  591. package/node_modules/matrix-js-sdk/lib/webrtc/stats/transportStats.js +3 -1
  592. package/node_modules/matrix-js-sdk/lib/webrtc/stats/transportStatsBuilder.js +9 -9
  593. package/node_modules/matrix-js-sdk/lib/webrtc/stats/transportStatsBuilder.js.map +1 -1
  594. package/node_modules/matrix-js-sdk/lib/webrtc/stats/valueFormatter.js +1 -1
  595. package/node_modules/matrix-js-sdk/lib/webrtc/stats/valueFormatter.js.map +1 -1
  596. package/node_modules/matrix-js-sdk/package.json +110 -138
  597. package/node_modules/matrix-js-sdk/src/@types/event.ts +9 -0
  598. package/node_modules/matrix-js-sdk/src/@types/global.d.ts +2 -2
  599. package/node_modules/matrix-js-sdk/src/@types/retention.ts +16 -0
  600. package/node_modules/matrix-js-sdk/src/ToDeviceMessageQueue.ts +2 -2
  601. package/node_modules/matrix-js-sdk/src/browser-index.ts +4 -4
  602. package/node_modules/matrix-js-sdk/src/capabilityPoller.ts +102 -0
  603. package/node_modules/matrix-js-sdk/src/client.ts +37 -25
  604. package/node_modules/matrix-js-sdk/src/crypto-api/index.ts +17 -6
  605. package/node_modules/matrix-js-sdk/src/embedded.ts +4 -6
  606. package/node_modules/matrix-js-sdk/src/filter-component.ts +1 -0
  607. package/node_modules/matrix-js-sdk/src/http-api/utils.ts +5 -10
  608. package/node_modules/matrix-js-sdk/src/interactive-auth.ts +11 -5
  609. package/node_modules/matrix-js-sdk/src/matrix.ts +1 -0
  610. package/node_modules/matrix-js-sdk/src/matrixrtc/LivekitTransport.ts +1 -1
  611. package/node_modules/matrix-js-sdk/src/matrixrtc/MatrixRTCSession.ts +5 -4
  612. package/node_modules/matrix-js-sdk/src/matrixrtc/MembershipManager.ts +2 -0
  613. package/node_modules/matrix-js-sdk/src/matrixrtc/MembershipManagerActionScheduler.ts +4 -1
  614. package/node_modules/matrix-js-sdk/src/models/MSC3089Branch.ts +1 -1
  615. package/node_modules/matrix-js-sdk/src/models/room-retention.ts +230 -0
  616. package/node_modules/matrix-js-sdk/src/models/room-sticky-events.ts +1 -0
  617. package/node_modules/matrix-js-sdk/src/models/room.ts +26 -12
  618. package/node_modules/matrix-js-sdk/src/receipt-accumulator.ts +2 -0
  619. package/node_modules/matrix-js-sdk/src/rendezvous/index.ts +1 -1
  620. package/node_modules/matrix-js-sdk/src/rendezvous/transports/MSC4108RendezvousSession.ts +2 -2
  621. package/node_modules/matrix-js-sdk/src/retentionPolicy.ts +65 -0
  622. package/node_modules/matrix-js-sdk/src/rust-crypto/PerSessionKeyBackupDownloader.ts +1 -1
  623. package/node_modules/matrix-js-sdk/src/rust-crypto/backup.ts +15 -4
  624. package/node_modules/matrix-js-sdk/src/rust-crypto/index.ts +6 -6
  625. package/node_modules/matrix-js-sdk/src/rust-crypto/rust-crypto.ts +31 -7
  626. package/node_modules/matrix-js-sdk/src/rust-crypto/verification.ts +1 -1
  627. package/node_modules/matrix-js-sdk/src/serverCapabilities.ts +8 -67
  628. package/node_modules/matrix-js-sdk/src/sliding-sync-sdk.ts +5 -7
  629. package/node_modules/matrix-js-sdk/src/store/index.ts +8 -0
  630. package/node_modules/matrix-js-sdk/src/store/indexeddb-local-backend.ts +12 -2
  631. package/node_modules/matrix-js-sdk/src/store/indexeddb-remote-backend.ts +24 -5
  632. package/node_modules/matrix-js-sdk/src/store/indexeddb.ts +20 -8
  633. package/node_modules/matrix-js-sdk/src/store/memory.ts +4 -0
  634. package/node_modules/matrix-js-sdk/src/store/stub.ts +3 -0
  635. package/node_modules/matrix-js-sdk/src/sync-accumulator.ts +9 -0
  636. package/node_modules/matrix-js-sdk/src/sync.ts +11 -9
  637. package/node_modules/media-typer/README.md +19 -33
  638. package/node_modules/media-typer/dist/index.d.ts +29 -0
  639. package/node_modules/media-typer/dist/index.js +64 -0
  640. package/node_modules/media-typer/dist/index.js.map +1 -0
  641. package/node_modules/media-typer/package.json +37 -22
  642. package/node_modules/music-metadata/lib/id3v1/ID3v1Parser.js +2 -2
  643. package/node_modules/music-metadata/lib/mp4/AtomToken.js +65 -13
  644. package/node_modules/music-metadata/lib/wav/WaveChunk.d.ts +10 -0
  645. package/node_modules/music-metadata/lib/wav/WaveChunk.js +13 -3
  646. package/node_modules/music-metadata/lib/wav/WaveParser.d.ts +1 -0
  647. package/node_modules/music-metadata/lib/wav/WaveParser.js +6 -5
  648. package/node_modules/music-metadata/package.json +5 -5
  649. package/node_modules/typebox/build/compile/validator.d.mts +2 -7
  650. package/node_modules/typebox/build/compile/validator.mjs +6 -36
  651. package/node_modules/typebox/build/error/errors.d.mts +1 -7
  652. package/node_modules/typebox/build/format/_idna.mjs +36 -6
  653. package/node_modules/typebox/build/format/_puny.mjs +4 -1
  654. package/node_modules/typebox/build/format/uuid.d.mts +2 -2
  655. package/node_modules/typebox/build/format/uuid.mjs +3 -3
  656. package/node_modules/typebox/build/guard/emit.d.mts +0 -4
  657. package/node_modules/typebox/build/guard/emit.mjs +0 -8
  658. package/node_modules/typebox/build/guard/guard.d.mts +4 -8
  659. package/node_modules/typebox/build/guard/guard.mjs +5 -13
  660. package/node_modules/typebox/build/schema/engine/boolean.d.mts +3 -3
  661. package/node_modules/typebox/build/schema/engine/boolean.mjs +4 -4
  662. package/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
  663. package/node_modules/typebox/build/schema/engine/index.mjs +0 -1
  664. package/node_modules/typebox/build/schema/engine/schema.mjs +5 -10
  665. package/node_modules/typebox/build/schema/engine/type.mjs +14 -18
  666. package/node_modules/typebox/build/schema/types/dependencies.mjs +1 -1
  667. package/node_modules/typebox/build/schema/types/index.d.mts +0 -1
  668. package/node_modules/typebox/build/schema/types/index.mjs +0 -1
  669. package/node_modules/typebox/build/schema/types/schema.d.mts +1 -1
  670. package/node_modules/typebox/build/schema/types/schema.mjs +2 -2
  671. package/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
  672. package/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
  673. package/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
  674. package/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
  675. package/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
  676. package/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
  677. package/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
  678. package/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
  679. package/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
  680. package/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
  681. package/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
  682. package/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
  683. package/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
  684. package/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
  685. package/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
  686. package/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
  687. package/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
  688. package/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
  689. package/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
  690. package/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
  691. package/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
  692. package/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
  693. package/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
  694. package/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
  695. package/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
  696. package/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
  697. package/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
  698. package/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
  699. package/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
  700. package/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
  701. package/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
  702. package/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
  703. package/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
  704. package/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
  705. package/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
  706. package/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
  707. package/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
  708. package/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
  709. package/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
  710. package/node_modules/typebox/build/system/memory/clone.mjs +73 -26
  711. package/node_modules/typebox/build/system/settings/settings.d.mts +15 -0
  712. package/node_modules/typebox/build/system/settings/settings.mjs +3 -1
  713. package/node_modules/typebox/build/type/action/_add_immutable.d.mts +11 -0
  714. package/node_modules/typebox/build/type/action/_add_immutable.mjs +11 -0
  715. package/node_modules/typebox/build/type/action/_add_optional.d.mts +11 -0
  716. package/node_modules/typebox/build/type/action/_add_optional.mjs +11 -0
  717. package/node_modules/typebox/build/type/action/_add_readonly.d.mts +11 -0
  718. package/node_modules/typebox/build/type/action/_add_readonly.mjs +11 -0
  719. package/node_modules/typebox/build/type/action/_remove_immutable.d.mts +11 -0
  720. package/node_modules/typebox/build/type/action/_remove_immutable.mjs +11 -0
  721. package/node_modules/typebox/build/type/action/_remove_optional.d.mts +11 -0
  722. package/node_modules/typebox/build/type/action/_remove_optional.mjs +11 -0
  723. package/node_modules/typebox/build/type/action/_remove_readonly.d.mts +11 -0
  724. package/node_modules/typebox/build/type/action/_remove_readonly.mjs +11 -0
  725. package/node_modules/typebox/build/type/action/conditional.d.mts +2 -3
  726. package/node_modules/typebox/build/type/action/conditional.mjs +2 -1
  727. package/node_modules/typebox/build/type/action/index.d.mts +7 -4
  728. package/node_modules/typebox/build/type/action/index.mjs +7 -4
  729. package/node_modules/typebox/build/type/action/mapped.d.mts +2 -3
  730. package/node_modules/typebox/build/type/action/mapped.mjs +2 -1
  731. package/node_modules/typebox/build/type/action/module.d.mts +8 -7
  732. package/node_modules/typebox/build/type/action/module.mjs +7 -6
  733. package/node_modules/typebox/build/type/action/readonly_object.d.mts +0 -5
  734. package/node_modules/typebox/build/type/action/readonly_object.mjs +0 -5
  735. package/node_modules/typebox/build/type/action/with.d.mts +11 -0
  736. package/node_modules/typebox/build/type/action/with.mjs +11 -0
  737. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +1 -1
  738. package/node_modules/typebox/build/type/engine/call/instantiate.d.mts +1 -3
  739. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +3 -2
  740. package/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +2 -2
  741. package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.d.mts +3 -4
  742. package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +2 -1
  743. package/node_modules/typebox/build/type/engine/cyclic/candidates.d.mts +2 -3
  744. package/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +3 -6
  745. package/node_modules/typebox/build/type/engine/cyclic/check.d.mts +6 -9
  746. package/node_modules/typebox/build/type/engine/cyclic/check.mjs +10 -16
  747. package/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
  748. package/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
  749. package/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
  750. package/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
  751. package/node_modules/typebox/build/type/engine/cyclic/instantiate.d.mts +2 -5
  752. package/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +3 -2
  753. package/node_modules/typebox/build/type/engine/enum/index.d.mts +0 -1
  754. package/node_modules/typebox/build/type/engine/enum/index.mjs +0 -1
  755. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +1 -2
  756. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +2 -6
  757. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +10 -6
  758. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +10 -6
  759. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +2 -1
  760. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +3 -3
  761. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +17 -5
  762. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +34 -8
  763. package/node_modules/typebox/build/type/engine/exclude/operation.d.mts +5 -6
  764. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +11 -12
  765. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +5 -6
  766. package/node_modules/typebox/build/type/engine/extract/operation.mjs +11 -12
  767. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +10 -0
  768. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +14 -0
  769. package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
  770. package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +14 -0
  771. package/node_modules/typebox/build/type/engine/index.d.mts +2 -2
  772. package/node_modules/typebox/build/type/engine/index.mjs +2 -2
  773. package/node_modules/typebox/build/type/engine/indexable/from_dependent.d.mts +5 -0
  774. package/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +8 -0
  775. package/node_modules/typebox/build/type/engine/indexable/from_enum.d.mts +3 -3
  776. package/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +4 -4
  777. package/node_modules/typebox/build/type/engine/indexable/from_template_literal.d.mts +2 -2
  778. package/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +3 -3
  779. package/node_modules/typebox/build/type/engine/indexable/from_type.d.mts +3 -1
  780. package/node_modules/typebox/build/type/engine/indexable/from_type.mjs +9 -6
  781. package/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +2 -1
  782. package/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +5 -2
  783. package/node_modules/typebox/build/type/engine/instantiate.d.mts +44 -31
  784. package/node_modules/typebox/build/type/engine/instantiate.mjs +82 -83
  785. package/node_modules/typebox/build/type/engine/interface/instantiate.d.mts +3 -6
  786. package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.d.mts +2 -2
  787. package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +3 -3
  788. package/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +2 -1
  789. package/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +5 -1
  790. package/node_modules/typebox/build/type/engine/mapped/mapped_operation.d.mts +4 -4
  791. package/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +3 -3
  792. package/node_modules/typebox/build/type/engine/mapped/mapped_variants.d.mts +5 -4
  793. package/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +10 -5
  794. package/node_modules/typebox/build/type/engine/module/instantiate.d.mts +7 -9
  795. package/node_modules/typebox/build/type/engine/module/instantiate.mjs +17 -15
  796. package/node_modules/typebox/build/type/engine/object/from_dependent.d.mts +5 -0
  797. package/node_modules/typebox/build/type/engine/object/from_dependent.mjs +8 -0
  798. package/node_modules/typebox/build/type/engine/object/from_type.d.mts +3 -1
  799. package/node_modules/typebox/build/type/engine/object/from_type.mjs +8 -5
  800. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  801. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +10 -0
  802. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +14 -0
  803. package/node_modules/typebox/build/type/engine/optional/instantiate_remove.d.mts +10 -0
  804. package/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +14 -0
  805. package/node_modules/typebox/build/type/engine/parameters/instantiate.d.mts +3 -4
  806. package/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +2 -1
  807. package/node_modules/typebox/build/type/engine/partial/from_dependent.d.mts +5 -0
  808. package/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +8 -0
  809. package/node_modules/typebox/build/type/engine/partial/from_intersect.d.mts +1 -1
  810. package/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +3 -2
  811. package/node_modules/typebox/build/type/engine/partial/from_object.d.mts +2 -2
  812. package/node_modules/typebox/build/type/engine/partial/from_object.mjs +2 -2
  813. package/node_modules/typebox/build/type/engine/partial/from_type.d.mts +3 -1
  814. package/node_modules/typebox/build/type/engine/partial/from_type.mjs +7 -4
  815. package/node_modules/typebox/build/type/engine/priority/index.d.mts +1 -0
  816. package/node_modules/typebox/build/type/engine/priority/index.mjs +1 -0
  817. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +20 -0
  818. package/node_modules/typebox/build/type/engine/priority/priority.mjs +28 -0
  819. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +10 -0
  820. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +14 -0
  821. package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
  822. package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +14 -0
  823. package/node_modules/typebox/build/type/engine/readonly_object/from_array.d.mts +2 -2
  824. package/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +2 -2
  825. package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.d.mts +5 -0
  826. package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +8 -0
  827. package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.d.mts +1 -1
  828. package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +3 -2
  829. package/node_modules/typebox/build/type/engine/readonly_object/from_object.d.mts +2 -2
  830. package/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +2 -2
  831. package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.d.mts +2 -2
  832. package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +2 -2
  833. package/node_modules/typebox/build/type/engine/readonly_object/from_type.d.mts +3 -1
  834. package/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +8 -5
  835. package/node_modules/typebox/build/type/engine/record/from_key_enum.d.mts +2 -2
  836. package/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +2 -2
  837. package/node_modules/typebox/build/type/engine/record/from_key_template_literal.d.mts +2 -2
  838. package/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +2 -2
  839. package/node_modules/typebox/build/type/engine/ref/instantiate.d.mts +3 -3
  840. package/node_modules/typebox/build/type/engine/ref/instantiate.mjs +6 -6
  841. package/node_modules/typebox/build/type/engine/required/from_dependent.d.mts +5 -0
  842. package/node_modules/typebox/build/type/engine/required/from_dependent.mjs +8 -0
  843. package/node_modules/typebox/build/type/engine/required/from_intersect.d.mts +1 -1
  844. package/node_modules/typebox/build/type/engine/required/from_intersect.mjs +3 -2
  845. package/node_modules/typebox/build/type/engine/required/from_object.d.mts +2 -2
  846. package/node_modules/typebox/build/type/engine/required/from_object.mjs +2 -2
  847. package/node_modules/typebox/build/type/engine/required/from_type.d.mts +3 -1
  848. package/node_modules/typebox/build/type/engine/required/from_type.mjs +7 -4
  849. package/node_modules/typebox/build/type/engine/template_literal/decode.mjs +3 -3
  850. package/node_modules/typebox/build/type/engine/template_literal/encode.d.mts +2 -2
  851. package/node_modules/typebox/build/type/engine/template_literal/encode.mjs +6 -6
  852. package/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +1 -1
  853. package/node_modules/typebox/build/type/engine/template_literal/is_pattern.mjs +1 -0
  854. package/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
  855. package/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
  856. package/node_modules/typebox/build/type/engine/with/instantiate.d.mts +8 -0
  857. package/node_modules/typebox/build/type/engine/{options → with}/instantiate.mjs +5 -5
  858. package/node_modules/typebox/build/type/extends/dependent.d.mts +6 -0
  859. package/node_modules/typebox/build/type/extends/dependent.mjs +6 -0
  860. package/node_modules/typebox/build/type/extends/enum.d.mts +4 -4
  861. package/node_modules/typebox/build/type/extends/enum.mjs +3 -2
  862. package/node_modules/typebox/build/type/extends/extends_left.d.mts +5 -7
  863. package/node_modules/typebox/build/type/extends/extends_left.mjs +24 -27
  864. package/node_modules/typebox/build/type/extends/extends_right.d.mts +7 -5
  865. package/node_modules/typebox/build/type/extends/extends_right.mjs +20 -15
  866. package/node_modules/typebox/build/type/extends/inference.mjs +1 -1
  867. package/node_modules/typebox/build/type/extends/object.d.mts +8 -1
  868. package/node_modules/typebox/build/type/extends/object.mjs +25 -3
  869. package/node_modules/typebox/build/type/extends/parameters.mjs +2 -2
  870. package/node_modules/typebox/build/type/extends/record.d.mts +13 -0
  871. package/node_modules/typebox/build/type/extends/record.mjs +23 -0
  872. package/node_modules/typebox/build/type/extends/template_literal.d.mts +3 -3
  873. package/node_modules/typebox/build/type/extends/template_literal.mjs +3 -3
  874. package/node_modules/typebox/build/type/extends/tuple.d.mts +3 -6
  875. package/node_modules/typebox/build/type/extends/tuple.mjs +6 -5
  876. package/node_modules/typebox/build/type/extends/union.mjs +2 -2
  877. package/node_modules/typebox/build/type/script/mapping.d.mts +84 -99
  878. package/node_modules/typebox/build/type/script/mapping.mjs +81 -85
  879. package/node_modules/typebox/build/type/script/parser.d.mts +40 -40
  880. package/node_modules/typebox/build/type/script/parser.mjs +22 -22
  881. package/node_modules/typebox/build/type/script/script.d.mts +3 -4
  882. package/node_modules/typebox/build/type/script/script.mjs +3 -2
  883. package/node_modules/typebox/build/type/script/token/internal/guard.d.mts +1 -1
  884. package/node_modules/typebox/build/type/script/token/internal/guard.mjs +1 -1
  885. package/node_modules/typebox/build/type/script/token/internal/take.mjs +1 -1
  886. package/node_modules/typebox/build/type/script/token/until.mjs +2 -2
  887. package/node_modules/typebox/build/type/types/_codec.d.mts +12 -12
  888. package/node_modules/typebox/build/type/types/_codec.mjs +0 -1
  889. package/node_modules/typebox/build/type/types/_immutable.d.mts +2 -9
  890. package/node_modules/typebox/build/type/types/_immutable.mjs +2 -10
  891. package/node_modules/typebox/build/type/types/_optional.d.mts +2 -9
  892. package/node_modules/typebox/build/type/types/_optional.mjs +2 -11
  893. package/node_modules/typebox/build/type/types/_readonly.d.mts +2 -9
  894. package/node_modules/typebox/build/type/types/_readonly.mjs +2 -10
  895. package/node_modules/typebox/build/type/types/_refine.d.mts +8 -10
  896. package/node_modules/typebox/build/type/types/_refine.mjs +1 -2
  897. package/node_modules/typebox/build/type/types/call.d.mts +3 -3
  898. package/node_modules/typebox/build/type/types/call.mjs +3 -2
  899. package/node_modules/typebox/build/type/types/deferred.d.mts +1 -0
  900. package/node_modules/typebox/build/type/types/deferred.mjs +1 -1
  901. package/node_modules/typebox/build/type/types/dependent.d.mts +17 -0
  902. package/node_modules/typebox/build/type/types/dependent.mjs +24 -0
  903. package/node_modules/typebox/build/type/types/enum.d.mts +3 -1
  904. package/node_modules/typebox/build/type/types/enum.mjs +5 -0
  905. package/node_modules/typebox/build/type/types/index.d.mts +1 -4
  906. package/node_modules/typebox/build/type/types/index.mjs +1 -4
  907. package/node_modules/typebox/build/type/types/number.d.mts +1 -1
  908. package/node_modules/typebox/build/type/types/number.mjs +1 -1
  909. package/node_modules/typebox/build/type/types/record.d.mts +13 -7
  910. package/node_modules/typebox/build/type/types/record.mjs +15 -9
  911. package/node_modules/typebox/build/type/types/static.d.mts +2 -5
  912. package/node_modules/typebox/build/typebox.d.mts +4 -8
  913. package/node_modules/typebox/build/typebox.mjs +4 -8
  914. package/node_modules/typebox/build/value/clean/clean.mjs +4 -2
  915. package/node_modules/typebox/build/value/clean/from_intersect.mjs +2 -2
  916. package/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
  917. package/node_modules/typebox/build/value/clean/from_union.d.mts +1 -1
  918. package/node_modules/typebox/build/value/clean/from_union.mjs +1 -2
  919. package/node_modules/typebox/build/value/clone/clone.mjs +2 -73
  920. package/node_modules/typebox/build/value/codec/decode.mjs +4 -2
  921. package/node_modules/typebox/build/value/codec/encode.mjs +4 -2
  922. package/node_modules/typebox/build/value/codec/from_array.mjs +1 -4
  923. package/node_modules/typebox/build/value/codec/from_object.mjs +1 -4
  924. package/node_modules/typebox/build/value/codec/from_record.mjs +2 -7
  925. package/node_modules/typebox/build/value/codec/from_tuple.mjs +1 -4
  926. package/node_modules/typebox/build/value/codec/from_union.mjs +2 -3
  927. package/node_modules/typebox/build/value/convert/from_enum.mjs +3 -4
  928. package/node_modules/typebox/build/value/convert/from_template_literal.d.mts +1 -1
  929. package/node_modules/typebox/build/value/convert/from_template_literal.mjs +2 -3
  930. package/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
  931. package/node_modules/typebox/build/value/create/from_enum.mjs +2 -2
  932. package/node_modules/typebox/build/value/create/from_type.mjs +23 -31
  933. package/node_modules/typebox/build/value/default/from_object.mjs +1 -1
  934. package/node_modules/typebox/build/value/default/from_type.mjs +8 -10
  935. package/node_modules/typebox/build/value/index.d.mts +0 -1
  936. package/node_modules/typebox/build/value/index.mjs +0 -1
  937. package/node_modules/typebox/build/value/repair/from_enum.mjs +2 -3
  938. package/node_modules/typebox/build/value/repair/from_type.mjs +24 -22
  939. package/node_modules/typebox/build/value/shared/union_priority_sort.d.mts +6 -2
  940. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +62 -26
  941. package/node_modules/typebox/build/value/value.d.mts +0 -1
  942. package/node_modules/typebox/build/value/value.mjs +0 -1
  943. package/node_modules/typebox/package.json +25 -25
  944. package/node_modules/typebox/readme.md +97 -80
  945. package/npm-shrinkwrap.json +59 -54
  946. package/package.json +10 -10
  947. package/dist/probe.runtime-DFt7PIoE.js +0 -3
  948. package/node_modules/@babel/runtime/helpers/AwaitValue.js +0 -4
  949. package/node_modules/@babel/runtime/helpers/applyDecs.js +0 -236
  950. package/node_modules/@babel/runtime/helpers/applyDecs2203.js +0 -184
  951. package/node_modules/@babel/runtime/helpers/applyDecs2203R.js +0 -191
  952. package/node_modules/@babel/runtime/helpers/applyDecs2301.js +0 -222
  953. package/node_modules/@babel/runtime/helpers/applyDecs2305.js +0 -133
  954. package/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js +0 -10
  955. package/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js +0 -4
  956. package/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js +0 -7
  957. package/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js +0 -5
  958. package/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js +0 -4
  959. package/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js +0 -5
  960. package/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js +0 -7
  961. package/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js +0 -7
  962. package/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js +0 -7
  963. package/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js +0 -5
  964. package/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js +0 -4
  965. package/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js +0 -7
  966. package/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js +0 -7
  967. package/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js +0 -7
  968. package/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js +0 -4
  969. package/node_modules/@babel/runtime/helpers/decorate.js +0 -250
  970. package/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js +0 -12
  971. package/node_modules/@babel/runtime/helpers/dispose.js +0 -28
  972. package/node_modules/@babel/runtime/helpers/esm/AwaitValue.js +0 -4
  973. package/node_modules/@babel/runtime/helpers/esm/applyDecs.js +0 -236
  974. package/node_modules/@babel/runtime/helpers/esm/applyDecs2203.js +0 -184
  975. package/node_modules/@babel/runtime/helpers/esm/applyDecs2203R.js +0 -191
  976. package/node_modules/@babel/runtime/helpers/esm/applyDecs2301.js +0 -222
  977. package/node_modules/@babel/runtime/helpers/esm/applyDecs2305.js +0 -133
  978. package/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js +0 -10
  979. package/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js +0 -4
  980. package/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js +0 -7
  981. package/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js +0 -5
  982. package/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js +0 -4
  983. package/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js +0 -5
  984. package/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js +0 -7
  985. package/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js +0 -7
  986. package/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js +0 -7
  987. package/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js +0 -5
  988. package/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js +0 -4
  989. package/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js +0 -7
  990. package/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js +0 -7
  991. package/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js +0 -7
  992. package/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js +0 -4
  993. package/node_modules/@babel/runtime/helpers/esm/decorate.js +0 -250
  994. package/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js +0 -12
  995. package/node_modules/@babel/runtime/helpers/esm/dispose.js +0 -28
  996. package/node_modules/@babel/runtime/helpers/esm/objectSpread.js +0 -14
  997. package/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js +0 -77
  998. package/node_modules/@babel/runtime/helpers/esm/using.js +0 -12
  999. package/node_modules/@babel/runtime/helpers/objectSpread.js +0 -14
  1000. package/node_modules/@babel/runtime/helpers/regeneratorRuntime.js +0 -77
  1001. package/node_modules/@babel/runtime/helpers/using.js +0 -12
  1002. package/node_modules/@babel/runtime/regenerator/index.js +0 -15
  1003. package/node_modules/content-type/HISTORY.md +0 -29
  1004. package/node_modules/content-type/index.js +0 -225
  1005. package/node_modules/media-typer/HISTORY.md +0 -50
  1006. package/node_modules/media-typer/index.js +0 -143
  1007. package/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
  1008. package/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
  1009. package/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
  1010. package/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
  1011. package/node_modules/typebox/build/type/action/_optional.d.mts +0 -19
  1012. package/node_modules/typebox/build/type/action/_optional.mjs +0 -40
  1013. package/node_modules/typebox/build/type/action/_readonly.d.mts +0 -19
  1014. package/node_modules/typebox/build/type/action/_readonly.mjs +0 -40
  1015. package/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
  1016. package/node_modules/typebox/build/type/action/awaited.mjs +0 -15
  1017. package/node_modules/typebox/build/type/action/options.d.mts +0 -11
  1018. package/node_modules/typebox/build/type/action/options.mjs +0 -11
  1019. package/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
  1020. package/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
  1021. package/node_modules/typebox/build/type/engine/enum/enum_to_union.d.mts +0 -14
  1022. package/node_modules/typebox/build/type/engine/enum/enum_to_union.mjs +0 -24
  1023. package/node_modules/typebox/build/type/engine/options/index.d.mts +0 -1
  1024. package/node_modules/typebox/build/type/engine/options/index.mjs +0 -1
  1025. package/node_modules/typebox/build/type/engine/options/instantiate.d.mts +0 -8
  1026. package/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
  1027. package/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
  1028. package/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
  1029. package/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
  1030. package/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
  1031. package/node_modules/typebox/build/type/extends/promise.mjs +0 -9
  1032. package/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
  1033. package/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
  1034. package/node_modules/typebox/build/type/types/base.d.mts +0 -50
  1035. package/node_modules/typebox/build/type/types/base.mjs +0 -84
  1036. package/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
  1037. package/node_modules/typebox/build/type/types/iterator.mjs +0 -28
  1038. package/node_modules/typebox/build/type/types/promise.d.mts +0 -21
  1039. package/node_modules/typebox/build/type/types/promise.mjs +0 -29
  1040. package/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
  1041. package/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
  1042. package/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
  1043. package/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
  1044. package/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
  1045. package/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
  1046. package/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
  1047. package/node_modules/typebox/build/value/create/from_base.mjs +0 -4
  1048. package/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
  1049. package/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
  1050. package/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
  1051. package/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
  1052. package/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
  1053. package/node_modules/typebox/build/value/default/from_base.mjs +0 -5
  1054. package/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
  1055. package/node_modules/typebox/build/value/mutate/error.mjs +0 -6
  1056. package/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
  1057. package/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
  1058. package/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
  1059. package/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
  1060. package/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
  1061. package/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
  1062. package/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
  1063. package/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
  1064. package/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
  1065. package/node_modules/typebox/build/value/mutate/index.mjs +0 -1
  1066. package/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
  1067. package/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
  1068. package/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
  1069. package/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
  1070. /package/node_modules/typebox/build/type/engine/{awaited → with}/index.d.mts +0 -0
  1071. /package/node_modules/typebox/build/type/engine/{awaited → with}/index.mjs +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"MSC3089TreeSpace.js","names":["EventType","MsgType","UNSTABLE_MSC3089_BRANCH","UNSTABLE_MSC3089_LEAF","logger","averageBetweenStrings","DEFAULT_ALPHABET","lexicographicCompare","nextString","prevString","simpleRetryOperation","MSC3089Branch","MatrixError","KnownMembership","DEFAULT_TREE_POWER_LEVELS_TEMPLATE","invite","kick","ban","redact","state_default","events_default","users_default","events","RoomPowerLevels","RoomHistoryVisibility","RoomTombstone","RoomEncryption","RoomName","RoomMessage","RoomMessageEncrypted","Sticker","users","TreePermissions","MSC3089TreeSpace","constructor","client","roomId","room","getRoom","Error","id","isTopLevel","parentEvents","currentState","getStateEvents","SpaceParent","length","every","e","_e$getContent","getContent","setName","name","_this","_asyncToGenerator","sendStateEvent","userId","_arguments","arguments","_this2","andSubspaces","undefined","promises","retryInvite","push","getDirectories","map","d","Promise","all","_this3","errcode","setPermissions","role","_this4","_pls$events","currentPls","Array","isArray","pls","viewLevel","editLevel","adminLevel","Viewer","Editor","Owner","getPermissions","_pls$events2","_pls$users","userLevel","createDirectory","_this5","directory","unstableCreateFileTree","SpaceChild","via","getDomain","trees","children","child","stateKey","getStateKey","tree","unstableGetFileTreeSpace","warn","getDirectory","find","r","delete","_this6","subdirectories","dir","kickMemberships","Invite","Knock","Join","members","RoomMember","member","isNotUs","getUserId","includes","membership","leave","getOrderedChildren","ordered","c","order","filter","sort","a","b","_roomA$currentState$g","_roomA$currentState$g2","_roomB$currentState$g","_roomB$currentState$g2","roomA","roomB","createTsA","RoomCreate","getTs","createTsB","getParentRoom","parents","parent","parentRoom","getOrder","findIndex","setOrder","index","_this7","_currentChild$getCont2","Math","max","min","currentIndex","movingUp","prev","next","newOrder","ensureBeforeIsSane","startOrder","endOrder","lastOrder","i","target","_currentChild$getCont","currentChild","content","_objectSpread","createFile","encryptedContents","info","additionalContent","_this8","_yield$_this8$client$","uploadContent","includeFilename","mxc","content_uri","url","fileContent","msgtype","File","body","file","res","sendMessage","active","getFile","fileEventId","branch","listFiles","listAllFiles","isActive","_this$room$currentSta","branches"],"sources":["../../src/models/MSC3089TreeSpace.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 { type MatrixClient } from \"../client.ts\";\nimport { EventType, MsgType, UNSTABLE_MSC3089_BRANCH, UNSTABLE_MSC3089_LEAF } from \"../@types/event.ts\";\nimport { type Room } from \"./room.ts\";\nimport { logger } from \"../logger.ts\";\nimport { type IContent, type MatrixEvent } from \"./event.ts\";\nimport {\n averageBetweenStrings,\n DEFAULT_ALPHABET,\n lexicographicCompare,\n nextString,\n prevString,\n simpleRetryOperation,\n} from \"../utils.ts\";\nimport { MSC3089Branch } from \"./MSC3089Branch.ts\";\nimport { type ISendEventResponse } from \"../@types/requests.ts\";\nimport { type FileType, MatrixError } from \"../http-api/index.ts\";\nimport { KnownMembership } from \"../@types/membership.ts\";\nimport { type RoomPowerLevelsEventContent, type SpaceChildEventContent } from \"../@types/state_events.ts\";\nimport type { EncryptedFile, FileContent } from \"../@types/media.ts\";\nimport { type EmptyObject } from \"../@types/common.ts\";\n\n/**\n * The recommended defaults for a tree space's power levels. Note that this\n * is UNSTABLE and subject to breaking changes without notice.\n */\nexport const DEFAULT_TREE_POWER_LEVELS_TEMPLATE = {\n // Owner\n invite: 100,\n kick: 100,\n ban: 100,\n\n // Editor\n redact: 50,\n state_default: 50,\n events_default: 50,\n\n // Viewer\n users_default: 0,\n\n // Mixed\n events: {\n [EventType.RoomPowerLevels]: 100,\n [EventType.RoomHistoryVisibility]: 100,\n [EventType.RoomTombstone]: 100,\n [EventType.RoomEncryption]: 100,\n [EventType.RoomName]: 50,\n [EventType.RoomMessage]: 50,\n [EventType.RoomMessageEncrypted]: 50,\n [EventType.Sticker]: 50,\n },\n\n users: {}, // defined by calling code\n};\n\n/**\n * Ease-of-use representation for power levels represented as simple roles.\n * Note that this is UNSTABLE and subject to breaking changes without notice.\n */\nexport enum TreePermissions {\n Viewer = \"viewer\", // Default\n Editor = \"editor\", // \"Moderator\" or ~PL50\n Owner = \"owner\", // \"Admin\" or PL100\n}\n\ndeclare module \"../@types/media\" {\n interface FileContent {\n [UNSTABLE_MSC3089_LEAF.name]?: EmptyObject;\n }\n}\n\n/**\n * Represents a [MSC3089](https://github.com/matrix-org/matrix-doc/pull/3089)\n * file tree Space. Note that this is UNSTABLE and subject to breaking changes\n * without notice.\n */\nexport class MSC3089TreeSpace {\n public readonly room: Room;\n\n public constructor(\n private client: MatrixClient,\n public readonly roomId: string,\n ) {\n this.room = this.client.getRoom(this.roomId)!;\n\n if (!this.room) throw new Error(\"Unknown room\");\n }\n\n /**\n * Syntactic sugar for room ID of the Space.\n */\n public get id(): string {\n return this.roomId;\n }\n\n /**\n * Whether or not this is a top level space.\n */\n public get isTopLevel(): boolean {\n // XXX: This is absolutely not how you find out if the space is top level\n // but is safe for a managed usecase like we offer in the SDK.\n const parentEvents = this.room.currentState.getStateEvents(EventType.SpaceParent);\n if (!parentEvents?.length) return true;\n return parentEvents.every((e) => !e.getContent()?.[\"via\"]);\n }\n\n /**\n * Sets the name of the tree space.\n * @param name - The new name for the space.\n * @returns Promise which resolves when complete.\n */\n public async setName(name: string): Promise<void> {\n await this.client.sendStateEvent(this.roomId, EventType.RoomName, { name }, \"\");\n }\n\n /**\n * Invites a user to the tree space. They will be given the default Viewer\n * permission level unless specified elsewhere.\n * @param userId - The user ID to invite.\n * @param andSubspaces - True (default) to invite the user to all\n * directories/subspaces too, recursively.\n * @returns Promise which resolves when complete.\n */\n public async invite(userId: string, andSubspaces = true): Promise<void> {\n const promises: Promise<void>[] = [this.retryInvite(userId)];\n if (andSubspaces) {\n promises.push(...this.getDirectories().map((d) => d.invite(userId, andSubspaces)));\n }\n await Promise.all(promises);\n }\n\n private async retryInvite(userId: string): Promise<void> {\n await simpleRetryOperation(\n () => this.client.invite(this.roomId, userId),\n (e) => {\n // We don't want to retry permission errors forever...\n if (e instanceof MatrixError && e.errcode === \"M_FORBIDDEN\") {\n return false;\n }\n return true;\n },\n );\n }\n\n /**\n * Sets the permissions of a user to the given role. Note that if setting a user\n * to Owner then they will NOT be able to be demoted. If the user does not have\n * permission to change the power level of the target, an error will be thrown.\n * @param userId - The user ID to change the role of.\n * @param role - The role to assign.\n * @returns Promise which resolves when complete.\n */\n public async setPermissions(userId: string, role: TreePermissions): Promise<void> {\n const currentPls = this.room.currentState.getStateEvents(EventType.RoomPowerLevels, \"\");\n if (Array.isArray(currentPls)) throw new Error(\"Unexpected return type for power levels\");\n\n const pls = currentPls?.getContent<RoomPowerLevelsEventContent>() || {};\n const viewLevel = pls[\"users_default\"] || 0;\n const editLevel = pls[\"events_default\"] || 50;\n const adminLevel = pls[\"events\"]?.[EventType.RoomPowerLevels] || 100;\n\n const users = pls[\"users\"] || {};\n switch (role) {\n case TreePermissions.Viewer:\n users[userId] = viewLevel;\n break;\n case TreePermissions.Editor:\n users[userId] = editLevel;\n break;\n case TreePermissions.Owner:\n users[userId] = adminLevel;\n break;\n default:\n throw new Error(\"Invalid role: \" + role);\n }\n pls[\"users\"] = users;\n\n await this.client.sendStateEvent(this.roomId, EventType.RoomPowerLevels, pls, \"\");\n }\n\n /**\n * Gets the current permissions of a user. Note that any users missing explicit permissions (or not\n * in the space) will be considered Viewers. Appropriate membership checks need to be performed\n * elsewhere.\n * @param userId - The user ID to check permissions of.\n * @returns The permissions for the user, defaulting to Viewer.\n */\n public getPermissions(userId: string): TreePermissions {\n const currentPls = this.room.currentState.getStateEvents(EventType.RoomPowerLevels, \"\");\n if (Array.isArray(currentPls)) throw new Error(\"Unexpected return type for power levels\");\n\n const pls = currentPls?.getContent() || {};\n const viewLevel = pls[\"users_default\"] || 0;\n const editLevel = pls[\"events_default\"] || 50;\n const adminLevel = pls[\"events\"]?.[EventType.RoomPowerLevels] || 100;\n\n const userLevel = pls[\"users\"]?.[userId] || viewLevel;\n if (userLevel >= adminLevel) return TreePermissions.Owner;\n if (userLevel >= editLevel) return TreePermissions.Editor;\n return TreePermissions.Viewer;\n }\n\n /**\n * Creates a directory under this tree space, represented as another tree space.\n * @param name - The name for the directory.\n * @returns Promise which resolves to the created directory.\n */\n public async createDirectory(name: string): Promise<MSC3089TreeSpace> {\n const directory = await this.client.unstableCreateFileTree(name);\n\n await this.client.sendStateEvent(\n this.roomId,\n EventType.SpaceChild,\n {\n via: [this.client.getDomain()!],\n },\n directory.roomId,\n );\n\n await this.client.sendStateEvent(\n directory.roomId,\n EventType.SpaceParent,\n {\n via: [this.client.getDomain()!],\n },\n this.roomId,\n );\n\n return directory;\n }\n\n /**\n * Gets a list of all known immediate subdirectories to this tree space.\n * @returns The tree spaces (directories). May be empty, but not null.\n */\n public getDirectories(): MSC3089TreeSpace[] {\n const trees: MSC3089TreeSpace[] = [];\n const children = this.room.currentState.getStateEvents(EventType.SpaceChild);\n for (const child of children) {\n try {\n const stateKey = child.getStateKey();\n if (stateKey) {\n const tree = this.client.unstableGetFileTreeSpace(stateKey);\n if (tree) trees.push(tree);\n }\n } catch (e) {\n logger.warn(\"Unable to create tree space instance for listing. Are we joined?\", e);\n }\n }\n return trees;\n }\n\n /**\n * Gets a subdirectory of a given ID under this tree space. Note that this will not recurse\n * into children and instead only look one level deep.\n * @param roomId - The room ID (directory ID) to find.\n * @returns The directory, or undefined if not found.\n */\n public getDirectory(roomId: string): MSC3089TreeSpace | undefined {\n return this.getDirectories().find((r) => r.roomId === roomId);\n }\n\n /**\n * Deletes the tree, kicking all members and deleting **all subdirectories**.\n * @returns Promise which resolves when complete.\n */\n public async delete(): Promise<void> {\n const subdirectories = this.getDirectories();\n for (const dir of subdirectories) {\n await dir.delete();\n }\n\n const kickMemberships = [KnownMembership.Invite, KnownMembership.Knock, KnownMembership.Join];\n const members = this.room.currentState.getStateEvents(EventType.RoomMember);\n for (const member of members) {\n const isNotUs = member.getStateKey() !== this.client.getUserId();\n if (isNotUs && kickMemberships.includes(member.getContent().membership! as KnownMembership)) {\n const stateKey = member.getStateKey();\n if (!stateKey) {\n throw new Error(\"State key not found for branch\");\n }\n await this.client.kick(this.roomId, stateKey, \"Room deleted\");\n }\n }\n\n await this.client.leave(this.roomId);\n }\n\n private getOrderedChildren(children: MatrixEvent[]): { roomId: string; order: string }[] {\n const ordered: { roomId: string; order: string }[] = children\n .map((c) => ({ roomId: c.getStateKey(), order: c.getContent()[\"order\"] }))\n .filter((c) => c.roomId) as { roomId: string; order: string }[];\n ordered.sort((a, b) => {\n if (a.order && !b.order) {\n return -1;\n } else if (!a.order && b.order) {\n return 1;\n } else if (!a.order && !b.order) {\n const roomA = this.client.getRoom(a.roomId);\n const roomB = this.client.getRoom(b.roomId);\n if (!roomA || !roomB) {\n // just don't bother trying to do more partial sorting\n return lexicographicCompare(a.roomId, b.roomId);\n }\n\n const createTsA = roomA.currentState.getStateEvents(EventType.RoomCreate, \"\")?.getTs() ?? 0;\n const createTsB = roomB.currentState.getStateEvents(EventType.RoomCreate, \"\")?.getTs() ?? 0;\n if (createTsA === createTsB) {\n return lexicographicCompare(a.roomId, b.roomId);\n }\n return createTsA - createTsB;\n } else {\n // both not-null orders\n return lexicographicCompare(a.order, b.order);\n }\n });\n return ordered;\n }\n\n private getParentRoom(): Room {\n const parents = this.room.currentState.getStateEvents(EventType.SpaceParent);\n const parent = parents[0]; // XXX: Wild assumption\n if (!parent) throw new Error(\"Expected to have a parent in a non-top level space\");\n\n // XXX: We are assuming the parent is a valid tree space.\n // We probably don't need to validate the parent room state for this usecase though.\n const stateKey = parent.getStateKey();\n if (!stateKey) throw new Error(\"No state key found for parent\");\n const parentRoom = this.client.getRoom(stateKey);\n if (!parentRoom) throw new Error(\"Unable to locate room for parent\");\n\n return parentRoom;\n }\n\n /**\n * Gets the current order index for this directory. Note that if this is the top level space\n * then -1 will be returned.\n * @returns The order index of this space.\n */\n public getOrder(): number {\n if (this.isTopLevel) return -1;\n\n const parentRoom = this.getParentRoom();\n const children = parentRoom.currentState.getStateEvents(EventType.SpaceChild);\n const ordered = this.getOrderedChildren(children);\n\n return ordered.findIndex((c) => c.roomId === this.roomId);\n }\n\n /**\n * Sets the order index for this directory within its parent. Note that if this is a top level\n * space then an error will be thrown. -1 can be used to move the child to the start, and numbers\n * larger than the number of children can be used to move the child to the end.\n * @param index - The new order index for this space.\n * @returns Promise which resolves when complete.\n * @throws Throws if this is a top level space.\n */\n public async setOrder(index: number): Promise<void> {\n if (this.isTopLevel) throw new Error(\"Cannot set order of top level spaces currently\");\n\n const parentRoom = this.getParentRoom();\n const children = parentRoom.currentState.getStateEvents(EventType.SpaceChild);\n const ordered = this.getOrderedChildren(children);\n index = Math.max(Math.min(index, ordered.length - 1), 0);\n\n const currentIndex = this.getOrder();\n const movingUp = currentIndex < index;\n if (movingUp && index === ordered.length - 1) {\n index--;\n } else if (!movingUp && index === 0) {\n index++;\n }\n\n const prev = ordered[movingUp ? index : index - 1];\n const next = ordered[movingUp ? index + 1 : index];\n\n let newOrder = DEFAULT_ALPHABET[0];\n let ensureBeforeIsSane = false;\n if (!prev) {\n // Move to front\n if (next?.order) {\n newOrder = prevString(next.order);\n }\n } else if (index === ordered.length - 1) {\n // Move to back\n if (next?.order) {\n newOrder = nextString(next.order);\n }\n } else {\n // Move somewhere in the middle\n const startOrder = prev?.order;\n const endOrder = next?.order;\n if (startOrder && endOrder) {\n if (startOrder === endOrder) {\n // Error case: just move +1 to break out of awful math\n newOrder = nextString(startOrder);\n } else {\n newOrder = averageBetweenStrings(startOrder, endOrder);\n }\n } else {\n if (startOrder) {\n // We're at the end (endOrder is null, so no explicit order)\n newOrder = nextString(startOrder);\n } else if (endOrder) {\n // We're at the start (startOrder is null, so nothing before us)\n newOrder = prevString(endOrder);\n } else {\n // Both points are unknown. We're likely in a range where all the children\n // don't have particular order values, so we may need to update them too.\n // The other possibility is there's only us as a child, but we should have\n // shown up in the other states.\n ensureBeforeIsSane = true;\n }\n }\n }\n\n if (ensureBeforeIsSane) {\n // We were asked by the order algorithm to prepare the moving space for a landing\n // in the undefined order part of the order array, which means we need to update the\n // spaces that come before it with a stable order value.\n let lastOrder: string | undefined;\n for (let i = 0; i <= index; i++) {\n const target = ordered[i];\n if (i === 0) {\n lastOrder = target.order;\n }\n if (!target.order) {\n // XXX: We should be creating gaps to avoid conflicts\n lastOrder = lastOrder ? nextString(lastOrder) : DEFAULT_ALPHABET[0];\n const currentChild = parentRoom.currentState.getStateEvents(EventType.SpaceChild, target.roomId);\n const content = currentChild?.getContent<SpaceChildEventContent>() ?? {\n via: [this.client.getDomain()!],\n };\n await this.client.sendStateEvent(\n parentRoom.roomId,\n EventType.SpaceChild,\n {\n ...content,\n order: lastOrder,\n },\n target.roomId,\n );\n } else {\n lastOrder = target.order;\n }\n }\n if (lastOrder) {\n newOrder = nextString(lastOrder);\n }\n }\n\n // TODO: Deal with order conflicts by reordering\n\n // Now we can finally update our own order state\n const currentChild = parentRoom.currentState.getStateEvents(EventType.SpaceChild, this.roomId);\n const content = currentChild?.getContent<SpaceChildEventContent>() ?? { via: [this.client.getDomain()!] };\n await this.client.sendStateEvent(\n parentRoom.roomId,\n EventType.SpaceChild,\n {\n ...content,\n\n // TODO: Safely constrain to 50 character limit required by spaces.\n order: newOrder,\n },\n this.roomId,\n );\n }\n\n /**\n * Creates (uploads) a new file to this tree. The file must have already been encrypted for the room.\n * The file contents are in a type that is compatible with MatrixClient.uploadContent().\n * @param name - The name of the file.\n * @param encryptedContents - The encrypted contents.\n * @param info - The encrypted file information.\n * @param additionalContent - Optional event content fields to include in the message.\n * @returns Promise which resolves to the file event's sent response.\n */\n public async createFile(\n name: string,\n encryptedContents: FileType,\n info: EncryptedFile,\n additionalContent?: IContent,\n ): Promise<ISendEventResponse> {\n const { content_uri: mxc } = await this.client.uploadContent(encryptedContents, {\n includeFilename: false,\n });\n info.url = mxc;\n\n const fileContent: FileContent = {\n msgtype: MsgType.File,\n body: name,\n url: mxc,\n file: info,\n };\n\n additionalContent = additionalContent ?? {};\n if (additionalContent[\"m.new_content\"]) {\n // We do the right thing according to the spec, but due to how relations are\n // handled we also end up duplicating this information to the regular `content`\n // as well.\n additionalContent[\"m.new_content\"] = fileContent;\n }\n\n const res = await this.client.sendMessage(this.roomId, {\n ...additionalContent,\n ...fileContent,\n [UNSTABLE_MSC3089_LEAF.name]: {},\n } as FileContent);\n\n await this.client.sendStateEvent(\n this.roomId,\n UNSTABLE_MSC3089_BRANCH.name,\n {\n active: true,\n name: name,\n },\n res[\"event_id\"],\n );\n\n return res;\n }\n\n /**\n * Retrieves a file from the tree.\n * @param fileEventId - The event ID of the file.\n * @returns The file, or null if not found.\n */\n public getFile(fileEventId: string): MSC3089Branch | null {\n const branch = this.room.currentState.getStateEvents(UNSTABLE_MSC3089_BRANCH.name, fileEventId);\n return branch ? new MSC3089Branch(this.client, branch, this) : null;\n }\n\n /**\n * Gets an array of all known files for the tree.\n * @returns The known files. May be empty, but not null.\n */\n public listFiles(): MSC3089Branch[] {\n return this.listAllFiles().filter((b) => b.isActive);\n }\n\n /**\n * Gets an array of all known files for the tree, including inactive/invalid ones.\n * @returns The known files. May be empty, but not null.\n */\n public listAllFiles(): MSC3089Branch[] {\n const branches = this.room.currentState.getStateEvents(UNSTABLE_MSC3089_BRANCH.name) ?? [];\n return branches.map((e) => new MSC3089Branch(this.client, e, this));\n }\n}\n"],"mappings":";;;;AAAA;AACA;AACA;AAC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,CAACiD,IAAI,GAAG,CAAC;MAAC,EACpB,CAAC;MAEjB,MAAM0H,MAAI,CAAC3I,MAAM,CAACoB,cAAc,CAC5BuH,MAAI,CAAC1I,MAAM,EACXlC,uBAAuB,CAACkD,IAAI,EAC5B;QACIwI,MAAM,EAAE,IAAI;QACZxI,IAAI,EAAEA;MACV,CAAC,EACDsI,GAAG,CAAC,UAAU,CAClB,CAAC;MAED,OAAOA,GAAG;IAAC;EACf;;EAEA;AACJ;AACA;AACA;AACA;EACWG,OAAOA,CAACC,WAAmB,EAAwB;IACtD,IAAMC,MAAM,GAAG,IAAI,CAAC1J,IAAI,CAACM,YAAY,CAACC,cAAc,CAAC1C,uBAAuB,CAACkD,IAAI,EAAE0I,WAAW,CAAC;IAC/F,OAAOC,MAAM,GAAG,IAAIpL,aAAa,CAAC,IAAI,CAACwB,MAAM,EAAE4J,MAAM,EAAE,IAAI,CAAC,GAAG,IAAI;EACvE;;EAEA;AACJ;AACA;AACA;EACWC,SAASA,CAAA,EAAoB;IAChC,OAAO,IAAI,CAACC,YAAY,CAAC,CAAC,CAACjE,MAAM,CAAEG,CAAC,IAAKA,CAAC,CAAC+D,QAAQ,CAAC;EACxD;;EAEA;AACJ;AACA;AACA;EACWD,YAAYA,CAAA,EAAoB;IAAA,IAAAE,qBAAA;IACnC,IAAMC,QAAQ,IAAAD,qBAAA,GAAG,IAAI,CAAC9J,IAAI,CAACM,YAAY,CAACC,cAAc,CAAC1C,uBAAuB,CAACkD,IAAI,CAAC,cAAA+I,qBAAA,cAAAA,qBAAA,GAAI,EAAE;IAC1F,OAAOC,QAAQ,CAAClI,GAAG,CAAElB,CAAC,IAAK,IAAIrC,aAAa,CAAC,IAAI,CAACwB,MAAM,EAAEa,CAAC,EAAE,IAAI,CAAC,CAAC;EACvE;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"MSC3089TreeSpace.js","names":[],"sources":["../../src/models/MSC3089TreeSpace.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 { type MatrixClient } from \"../client.ts\";\nimport { EventType, MsgType, UNSTABLE_MSC3089_BRANCH, UNSTABLE_MSC3089_LEAF } from \"../@types/event.ts\";\nimport { type Room } from \"./room.ts\";\nimport { logger } from \"../logger.ts\";\nimport { type IContent, type MatrixEvent } from \"./event.ts\";\nimport {\n averageBetweenStrings,\n DEFAULT_ALPHABET,\n lexicographicCompare,\n nextString,\n prevString,\n simpleRetryOperation,\n} from \"../utils.ts\";\nimport { MSC3089Branch } from \"./MSC3089Branch.ts\";\nimport { type ISendEventResponse } from \"../@types/requests.ts\";\nimport { type FileType, MatrixError } from \"../http-api/index.ts\";\nimport { KnownMembership } from \"../@types/membership.ts\";\nimport { type RoomPowerLevelsEventContent, type SpaceChildEventContent } from \"../@types/state_events.ts\";\nimport type { EncryptedFile, FileContent } from \"../@types/media.ts\";\nimport { type EmptyObject } from \"../@types/common.ts\";\n\n/**\n * The recommended defaults for a tree space's power levels. Note that this\n * is UNSTABLE and subject to breaking changes without notice.\n */\nexport const DEFAULT_TREE_POWER_LEVELS_TEMPLATE = {\n // Owner\n invite: 100,\n kick: 100,\n ban: 100,\n\n // Editor\n redact: 50,\n state_default: 50,\n events_default: 50,\n\n // Viewer\n users_default: 0,\n\n // Mixed\n events: {\n [EventType.RoomPowerLevels]: 100,\n [EventType.RoomHistoryVisibility]: 100,\n [EventType.RoomTombstone]: 100,\n [EventType.RoomEncryption]: 100,\n [EventType.RoomName]: 50,\n [EventType.RoomMessage]: 50,\n [EventType.RoomMessageEncrypted]: 50,\n [EventType.Sticker]: 50,\n },\n\n users: {}, // defined by calling code\n};\n\n/**\n * Ease-of-use representation for power levels represented as simple roles.\n * Note that this is UNSTABLE and subject to breaking changes without notice.\n */\nexport enum TreePermissions {\n Viewer = \"viewer\", // Default\n Editor = \"editor\", // \"Moderator\" or ~PL50\n Owner = \"owner\", // \"Admin\" or PL100\n}\n\ndeclare module \"../@types/media\" {\n interface FileContent {\n [UNSTABLE_MSC3089_LEAF.name]?: EmptyObject;\n }\n}\n\n/**\n * Represents a [MSC3089](https://github.com/matrix-org/matrix-doc/pull/3089)\n * file tree Space. Note that this is UNSTABLE and subject to breaking changes\n * without notice.\n */\nexport class MSC3089TreeSpace {\n public readonly room: Room;\n\n public constructor(\n private client: MatrixClient,\n public readonly roomId: string,\n ) {\n this.room = this.client.getRoom(this.roomId)!;\n\n if (!this.room) throw new Error(\"Unknown room\");\n }\n\n /**\n * Syntactic sugar for room ID of the Space.\n */\n public get id(): string {\n return this.roomId;\n }\n\n /**\n * Whether or not this is a top level space.\n */\n public get isTopLevel(): boolean {\n // XXX: This is absolutely not how you find out if the space is top level\n // but is safe for a managed usecase like we offer in the SDK.\n const parentEvents = this.room.currentState.getStateEvents(EventType.SpaceParent);\n if (!parentEvents?.length) return true;\n return parentEvents.every((e) => !e.getContent()?.[\"via\"]);\n }\n\n /**\n * Sets the name of the tree space.\n * @param name - The new name for the space.\n * @returns Promise which resolves when complete.\n */\n public async setName(name: string): Promise<void> {\n await this.client.sendStateEvent(this.roomId, EventType.RoomName, { name }, \"\");\n }\n\n /**\n * Invites a user to the tree space. They will be given the default Viewer\n * permission level unless specified elsewhere.\n * @param userId - The user ID to invite.\n * @param andSubspaces - True (default) to invite the user to all\n * directories/subspaces too, recursively.\n * @returns Promise which resolves when complete.\n */\n public async invite(userId: string, andSubspaces = true): Promise<void> {\n const promises: Promise<void>[] = [this.retryInvite(userId)];\n if (andSubspaces) {\n promises.push(...this.getDirectories().map((d) => d.invite(userId, andSubspaces)));\n }\n await Promise.all(promises);\n }\n\n private async retryInvite(userId: string): Promise<void> {\n await simpleRetryOperation(\n () => this.client.invite(this.roomId, userId),\n (e) => {\n // We don't want to retry permission errors forever...\n if (e instanceof MatrixError && e.errcode === \"M_FORBIDDEN\") {\n return false;\n }\n return true;\n },\n );\n }\n\n /**\n * Sets the permissions of a user to the given role. Note that if setting a user\n * to Owner then they will NOT be able to be demoted. If the user does not have\n * permission to change the power level of the target, an error will be thrown.\n * @param userId - The user ID to change the role of.\n * @param role - The role to assign.\n * @returns Promise which resolves when complete.\n */\n public async setPermissions(userId: string, role: TreePermissions): Promise<void> {\n const currentPls = this.room.currentState.getStateEvents(EventType.RoomPowerLevels, \"\");\n if (Array.isArray(currentPls)) throw new Error(\"Unexpected return type for power levels\");\n\n const pls = currentPls?.getContent<RoomPowerLevelsEventContent>() || {};\n const viewLevel = pls[\"users_default\"] || 0;\n const editLevel = pls[\"events_default\"] || 50;\n const adminLevel = pls[\"events\"]?.[EventType.RoomPowerLevels] || 100;\n\n const users = pls[\"users\"] || {};\n switch (role) {\n case TreePermissions.Viewer:\n users[userId] = viewLevel;\n break;\n case TreePermissions.Editor:\n users[userId] = editLevel;\n break;\n case TreePermissions.Owner:\n users[userId] = adminLevel;\n break;\n default:\n throw new Error(\"Invalid role: \" + role);\n }\n pls[\"users\"] = users;\n\n await this.client.sendStateEvent(this.roomId, EventType.RoomPowerLevels, pls, \"\");\n }\n\n /**\n * Gets the current permissions of a user. Note that any users missing explicit permissions (or not\n * in the space) will be considered Viewers. Appropriate membership checks need to be performed\n * elsewhere.\n * @param userId - The user ID to check permissions of.\n * @returns The permissions for the user, defaulting to Viewer.\n */\n public getPermissions(userId: string): TreePermissions {\n const currentPls = this.room.currentState.getStateEvents(EventType.RoomPowerLevels, \"\");\n if (Array.isArray(currentPls)) throw new Error(\"Unexpected return type for power levels\");\n\n const pls = currentPls?.getContent() || {};\n const viewLevel = pls[\"users_default\"] || 0;\n const editLevel = pls[\"events_default\"] || 50;\n const adminLevel = pls[\"events\"]?.[EventType.RoomPowerLevels] || 100;\n\n const userLevel = pls[\"users\"]?.[userId] || viewLevel;\n if (userLevel >= adminLevel) return TreePermissions.Owner;\n if (userLevel >= editLevel) return TreePermissions.Editor;\n return TreePermissions.Viewer;\n }\n\n /**\n * Creates a directory under this tree space, represented as another tree space.\n * @param name - The name for the directory.\n * @returns Promise which resolves to the created directory.\n */\n public async createDirectory(name: string): Promise<MSC3089TreeSpace> {\n const directory = await this.client.unstableCreateFileTree(name);\n\n await this.client.sendStateEvent(\n this.roomId,\n EventType.SpaceChild,\n {\n via: [this.client.getDomain()!],\n },\n directory.roomId,\n );\n\n await this.client.sendStateEvent(\n directory.roomId,\n EventType.SpaceParent,\n {\n via: [this.client.getDomain()!],\n },\n this.roomId,\n );\n\n return directory;\n }\n\n /**\n * Gets a list of all known immediate subdirectories to this tree space.\n * @returns The tree spaces (directories). May be empty, but not null.\n */\n public getDirectories(): MSC3089TreeSpace[] {\n const trees: MSC3089TreeSpace[] = [];\n const children = this.room.currentState.getStateEvents(EventType.SpaceChild);\n for (const child of children) {\n try {\n const stateKey = child.getStateKey();\n if (stateKey) {\n const tree = this.client.unstableGetFileTreeSpace(stateKey);\n if (tree) trees.push(tree);\n }\n } catch (e) {\n logger.warn(\"Unable to create tree space instance for listing. Are we joined?\", e);\n }\n }\n return trees;\n }\n\n /**\n * Gets a subdirectory of a given ID under this tree space. Note that this will not recurse\n * into children and instead only look one level deep.\n * @param roomId - The room ID (directory ID) to find.\n * @returns The directory, or undefined if not found.\n */\n public getDirectory(roomId: string): MSC3089TreeSpace | undefined {\n return this.getDirectories().find((r) => r.roomId === roomId);\n }\n\n /**\n * Deletes the tree, kicking all members and deleting **all subdirectories**.\n * @returns Promise which resolves when complete.\n */\n public async delete(): Promise<void> {\n const subdirectories = this.getDirectories();\n for (const dir of subdirectories) {\n await dir.delete();\n }\n\n const kickMemberships = [KnownMembership.Invite, KnownMembership.Knock, KnownMembership.Join];\n const members = this.room.currentState.getStateEvents(EventType.RoomMember);\n for (const member of members) {\n const isNotUs = member.getStateKey() !== this.client.getUserId();\n if (isNotUs && kickMemberships.includes(member.getContent().membership! as KnownMembership)) {\n const stateKey = member.getStateKey();\n if (!stateKey) {\n throw new Error(\"State key not found for branch\");\n }\n await this.client.kick(this.roomId, stateKey, \"Room deleted\");\n }\n }\n\n await this.client.leave(this.roomId);\n }\n\n private getOrderedChildren(children: MatrixEvent[]): { roomId: string; order: string }[] {\n const ordered: { roomId: string; order: string }[] = children\n .map((c) => ({ roomId: c.getStateKey(), order: c.getContent()[\"order\"] }))\n .filter((c) => c.roomId) as { roomId: string; order: string }[];\n ordered.sort((a, b) => {\n if (a.order && !b.order) {\n return -1;\n } else if (!a.order && b.order) {\n return 1;\n } else if (!a.order && !b.order) {\n const roomA = this.client.getRoom(a.roomId);\n const roomB = this.client.getRoom(b.roomId);\n if (!roomA || !roomB) {\n // just don't bother trying to do more partial sorting\n return lexicographicCompare(a.roomId, b.roomId);\n }\n\n const createTsA = roomA.currentState.getStateEvents(EventType.RoomCreate, \"\")?.getTs() ?? 0;\n const createTsB = roomB.currentState.getStateEvents(EventType.RoomCreate, \"\")?.getTs() ?? 0;\n if (createTsA === createTsB) {\n return lexicographicCompare(a.roomId, b.roomId);\n }\n return createTsA - createTsB;\n } else {\n // both not-null orders\n return lexicographicCompare(a.order, b.order);\n }\n });\n return ordered;\n }\n\n private getParentRoom(): Room {\n const parents = this.room.currentState.getStateEvents(EventType.SpaceParent);\n const parent = parents[0]; // XXX: Wild assumption\n if (!parent) throw new Error(\"Expected to have a parent in a non-top level space\");\n\n // XXX: We are assuming the parent is a valid tree space.\n // We probably don't need to validate the parent room state for this usecase though.\n const stateKey = parent.getStateKey();\n if (!stateKey) throw new Error(\"No state key found for parent\");\n const parentRoom = this.client.getRoom(stateKey);\n if (!parentRoom) throw new Error(\"Unable to locate room for parent\");\n\n return parentRoom;\n }\n\n /**\n * Gets the current order index for this directory. Note that if this is the top level space\n * then -1 will be returned.\n * @returns The order index of this space.\n */\n public getOrder(): number {\n if (this.isTopLevel) return -1;\n\n const parentRoom = this.getParentRoom();\n const children = parentRoom.currentState.getStateEvents(EventType.SpaceChild);\n const ordered = this.getOrderedChildren(children);\n\n return ordered.findIndex((c) => c.roomId === this.roomId);\n }\n\n /**\n * Sets the order index for this directory within its parent. Note that if this is a top level\n * space then an error will be thrown. -1 can be used to move the child to the start, and numbers\n * larger than the number of children can be used to move the child to the end.\n * @param index - The new order index for this space.\n * @returns Promise which resolves when complete.\n * @throws Throws if this is a top level space.\n */\n public async setOrder(index: number): Promise<void> {\n if (this.isTopLevel) throw new Error(\"Cannot set order of top level spaces currently\");\n\n const parentRoom = this.getParentRoom();\n const children = parentRoom.currentState.getStateEvents(EventType.SpaceChild);\n const ordered = this.getOrderedChildren(children);\n index = Math.max(Math.min(index, ordered.length - 1), 0);\n\n const currentIndex = this.getOrder();\n const movingUp = currentIndex < index;\n if (movingUp && index === ordered.length - 1) {\n index--;\n } else if (!movingUp && index === 0) {\n index++;\n }\n\n const prev = ordered[movingUp ? index : index - 1];\n const next = ordered[movingUp ? index + 1 : index];\n\n let newOrder = DEFAULT_ALPHABET[0];\n let ensureBeforeIsSane = false;\n if (!prev) {\n // Move to front\n if (next?.order) {\n newOrder = prevString(next.order);\n }\n } else if (index === ordered.length - 1) {\n // Move to back\n if (next?.order) {\n newOrder = nextString(next.order);\n }\n } else {\n // Move somewhere in the middle\n const startOrder = prev?.order;\n const endOrder = next?.order;\n if (startOrder && endOrder) {\n if (startOrder === endOrder) {\n // Error case: just move +1 to break out of awful math\n newOrder = nextString(startOrder);\n } else {\n newOrder = averageBetweenStrings(startOrder, endOrder);\n }\n } else {\n if (startOrder) {\n // We're at the end (endOrder is null, so no explicit order)\n newOrder = nextString(startOrder);\n } else if (endOrder) {\n // We're at the start (startOrder is null, so nothing before us)\n newOrder = prevString(endOrder);\n } else {\n // Both points are unknown. We're likely in a range where all the children\n // don't have particular order values, so we may need to update them too.\n // The other possibility is there's only us as a child, but we should have\n // shown up in the other states.\n ensureBeforeIsSane = true;\n }\n }\n }\n\n if (ensureBeforeIsSane) {\n // We were asked by the order algorithm to prepare the moving space for a landing\n // in the undefined order part of the order array, which means we need to update the\n // spaces that come before it with a stable order value.\n let lastOrder: string | undefined;\n for (let i = 0; i <= index; i++) {\n const target = ordered[i];\n if (i === 0) {\n lastOrder = target.order;\n }\n if (!target.order) {\n // XXX: We should be creating gaps to avoid conflicts\n lastOrder = lastOrder ? nextString(lastOrder) : DEFAULT_ALPHABET[0];\n const currentChild = parentRoom.currentState.getStateEvents(EventType.SpaceChild, target.roomId);\n const content = currentChild?.getContent<SpaceChildEventContent>() ?? {\n via: [this.client.getDomain()!],\n };\n await this.client.sendStateEvent(\n parentRoom.roomId,\n EventType.SpaceChild,\n {\n ...content,\n order: lastOrder,\n },\n target.roomId,\n );\n } else {\n lastOrder = target.order;\n }\n }\n if (lastOrder) {\n newOrder = nextString(lastOrder);\n }\n }\n\n // TODO: Deal with order conflicts by reordering\n\n // Now we can finally update our own order state\n const currentChild = parentRoom.currentState.getStateEvents(EventType.SpaceChild, this.roomId);\n const content = currentChild?.getContent<SpaceChildEventContent>() ?? { via: [this.client.getDomain()!] };\n await this.client.sendStateEvent(\n parentRoom.roomId,\n EventType.SpaceChild,\n {\n ...content,\n\n // TODO: Safely constrain to 50 character limit required by spaces.\n order: newOrder,\n },\n this.roomId,\n );\n }\n\n /**\n * Creates (uploads) a new file to this tree. The file must have already been encrypted for the room.\n * The file contents are in a type that is compatible with MatrixClient.uploadContent().\n * @param name - The name of the file.\n * @param encryptedContents - The encrypted contents.\n * @param info - The encrypted file information.\n * @param additionalContent - Optional event content fields to include in the message.\n * @returns Promise which resolves to the file event's sent response.\n */\n public async createFile(\n name: string,\n encryptedContents: FileType,\n info: EncryptedFile,\n additionalContent?: IContent,\n ): Promise<ISendEventResponse> {\n const { content_uri: mxc } = await this.client.uploadContent(encryptedContents, {\n includeFilename: false,\n });\n info.url = mxc;\n\n const fileContent: FileContent = {\n msgtype: MsgType.File,\n body: name,\n url: mxc,\n file: info,\n };\n\n additionalContent = additionalContent ?? {};\n if (additionalContent[\"m.new_content\"]) {\n // We do the right thing according to the spec, but due to how relations are\n // handled we also end up duplicating this information to the regular `content`\n // as well.\n additionalContent[\"m.new_content\"] = fileContent;\n }\n\n const res = await this.client.sendMessage(this.roomId, {\n ...additionalContent,\n ...fileContent,\n [UNSTABLE_MSC3089_LEAF.name]: {},\n } as FileContent);\n\n await this.client.sendStateEvent(\n this.roomId,\n UNSTABLE_MSC3089_BRANCH.name,\n {\n active: true,\n name: name,\n },\n res[\"event_id\"],\n );\n\n return res;\n }\n\n /**\n * Retrieves a file from the tree.\n * @param fileEventId - The event ID of the file.\n * @returns The file, or null if not found.\n */\n public getFile(fileEventId: string): MSC3089Branch | null {\n const branch = this.room.currentState.getStateEvents(UNSTABLE_MSC3089_BRANCH.name, fileEventId);\n return branch ? new MSC3089Branch(this.client, branch, this) : null;\n }\n\n /**\n * Gets an array of all known files for the tree.\n * @returns The known files. May be empty, but not null.\n */\n public listFiles(): MSC3089Branch[] {\n return this.listAllFiles().filter((b) => b.isActive);\n }\n\n /**\n * Gets an array of all known files for the tree, including inactive/invalid ones.\n * @returns The known files. May be empty, but not null.\n */\n public listAllFiles(): MSC3089Branch[] {\n const branches = this.room.currentState.getStateEvents(UNSTABLE_MSC3089_BRANCH.name) ?? [];\n return branches.map((e) => new MSC3089Branch(this.client, e, this));\n }\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAAS,SAAS,EAAE,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,QAAQ,oBAAoB;AAEvG,SAAS,MAAM,QAAQ,cAAc;AAErC,SACI,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,UAAU,EACV,UAAU,EACV,oBAAoB,QACjB,aAAa;AACpB,SAAS,aAAa,QAAQ,oBAAoB;AAElD,SAAwB,WAAW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,cAAc,CAAC,uBAAuB,CAAC,IAAI,EAAE,WAAW,CAAC;IAC/F,OAAO,MAAM,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,IAAI;EACvE;;EAEA;AACJ;AACA;AACA;EACW,SAAS,GAAoB;IAChC,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAE,CAAC,IAAK,CAAC,CAAC,QAAQ,CAAC;EACxD;;EAEA;AACJ;AACA;AACA;EACW,YAAY,GAAoB;IACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,uBAAuB,CAAC,IAAI,CAAC,IAAI,EAAE;IAC1F,OAAO,QAAQ,CAAC,GAAG,CAAE,CAAC,IAAK,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;EACvE;AACJ","ignoreList":[]}
@@ -1 +1,3 @@
1
- export {};
1
+ export {};
2
+ export {};
3
+ //# sourceMappingURL=ToDeviceMessage.js.map
@@ -18,7 +18,7 @@ limitations under the License.
18
18
  import { parseBeaconContent, parseBeaconInfoContent } from "../content-helpers.js";
19
19
  import { sortEventsByLatestContentTimestamp } from "../utils.js";
20
20
  import { TypedEventEmitter } from "./typed-event-emitter.js";
21
- export var BeaconEvent = /*#__PURE__*/function (BeaconEvent) {
21
+ export let BeaconEvent = /*#__PURE__*/function (BeaconEvent) {
22
22
  BeaconEvent["New"] = "Beacon.new";
23
23
  BeaconEvent["Update"] = "Beacon.update";
24
24
  BeaconEvent["LivenessChange"] = "Beacon.LivenessChange";
@@ -26,20 +26,24 @@ export var BeaconEvent = /*#__PURE__*/function (BeaconEvent) {
26
26
  BeaconEvent["LocationUpdate"] = "Beacon.LocationUpdate";
27
27
  return BeaconEvent;
28
28
  }({});
29
- export var isTimestampInDuration = (startTimestamp, durationMs, timestamp) => timestamp >= startTimestamp && startTimestamp + durationMs >= timestamp;
29
+ export const isTimestampInDuration = (startTimestamp, durationMs, timestamp) => timestamp >= startTimestamp && startTimestamp + durationMs >= timestamp;
30
30
 
31
31
  // beacon info events are uniquely identified by
32
32
  // `<roomId>_<state_key>`
33
33
 
34
- export var getBeaconInfoIdentifier = event => "".concat(event.getRoomId(), "_").concat(event.getStateKey());
34
+ export const getBeaconInfoIdentifier = event => `${event.getRoomId()}_${event.getStateKey()}`;
35
35
 
36
36
  // https://github.com/matrix-org/matrix-spec-proposals/pull/3672
37
37
  export class Beacon extends TypedEventEmitter {
38
- // beaconInfo is assigned by setBeaconInfo in the constructor
39
- // ! to make tsc believe it is definitely assigned
40
-
41
38
  constructor(rootEvent) {
42
39
  super();
40
+ _defineProperty(this, "roomId", void 0);
41
+ // beaconInfo is assigned by setBeaconInfo in the constructor
42
+ // ! to make tsc believe it is definitely assigned
43
+ _defineProperty(this, "_beaconInfo", void 0);
44
+ _defineProperty(this, "_isLive", void 0);
45
+ _defineProperty(this, "livenessWatchTimeout", void 0);
46
+ _defineProperty(this, "_latestLocationEvent", void 0);
43
47
  _defineProperty(this, "clearLatestLocation", () => {
44
48
  this._latestLocationEvent = undefined;
45
49
  this.emit(BeaconEvent.LocationUpdate, this.latestLocationState);
@@ -104,7 +108,7 @@ export class Beacon extends TypedEventEmitter {
104
108
  this.checkLiveness();
105
109
  if (!this.beaconInfo) return;
106
110
  if (this.isLive) {
107
- var expiryInMs = this.beaconInfo.timestamp + this.beaconInfo.timeout - Date.now();
111
+ const expiryInMs = this.beaconInfo.timestamp + this.beaconInfo.timeout - Date.now();
108
112
  if (expiryInMs > 1) {
109
113
  this.livenessWatchTimeout = setTimeout(() => {
110
114
  this.monitorLiveness();
@@ -124,23 +128,24 @@ export class Beacon extends TypedEventEmitter {
124
128
  * Emits BeaconEvent.LocationUpdate
125
129
  */
126
130
  addLocations(beaconLocationEvents) {
127
- var _validLocationEvents$;
128
131
  // discard locations for beacons that are not live
129
132
  if (!this.isLive) {
130
133
  return;
131
134
  }
132
- var validLocationEvents = beaconLocationEvents.filter(event => {
133
- var content = event.getContent();
134
- var parsed = parseBeaconContent(content);
135
+ const validLocationEvents = beaconLocationEvents.filter(event => {
136
+ const content = event.getContent();
137
+ const parsed = parseBeaconContent(content);
135
138
  if (!parsed.uri || !parsed.timestamp) return false; // we won't be able to process these
136
- var timestamp = parsed.timestamp;
139
+ const {
140
+ timestamp
141
+ } = parsed;
137
142
  return this._beaconInfo.timestamp &&
138
143
  // only include positions that were taken inside the beacon's live period
139
144
  isTimestampInDuration(this._beaconInfo.timestamp, this._beaconInfo.timeout, timestamp) && (
140
145
  // ignore positions older than our current latest location
141
146
  !this.latestLocationState || timestamp > this.latestLocationState.timestamp);
142
147
  });
143
- var latestLocationEvent = (_validLocationEvents$ = validLocationEvents.sort(sortEventsByLatestContentTimestamp)) === null || _validLocationEvents$ === void 0 ? void 0 : _validLocationEvents$[0];
148
+ const latestLocationEvent = validLocationEvents.sort(sortEventsByLatestContentTimestamp)?.[0];
144
149
  if (latestLocationEvent) {
145
150
  this._latestLocationEvent = latestLocationEvent;
146
151
  this.emit(BeaconEvent.LocationUpdate, this.latestLocationState);
@@ -151,14 +156,14 @@ export class Beacon extends TypedEventEmitter {
151
156
  this.checkLiveness();
152
157
  }
153
158
  checkLiveness() {
154
- var prevLiveness = this.isLive;
159
+ const prevLiveness = this.isLive;
155
160
 
156
161
  // element web sets a beacon's start timestamp to the senders local current time
157
162
  // when Alice's system clock deviates slightly from Bob's a beacon Alice intended to be live
158
163
  // may have a start timestamp in the future from Bob's POV
159
164
  // handle this by adding 6min of leniency to the start timestamp when it is in the future
160
165
  if (!this.beaconInfo) return;
161
- var startTimestamp = this.beaconInfo.timestamp > Date.now() ? this.beaconInfo.timestamp - 360000 /* 6min */ : this.beaconInfo.timestamp;
166
+ const startTimestamp = this.beaconInfo.timestamp > Date.now() ? this.beaconInfo.timestamp - 360000 /* 6min */ : this.beaconInfo.timestamp;
162
167
  this._isLive = !!this._beaconInfo.live && !!startTimestamp && isTimestampInDuration(startTimestamp, this._beaconInfo.timeout, Date.now());
163
168
  if (prevLiveness !== this.isLive) {
164
169
  this.emit(BeaconEvent.LivenessChange, this.isLive, this);
@@ -1 +1 @@
1
- {"version":3,"file":"beacon.js","names":["parseBeaconContent","parseBeaconInfoContent","sortEventsByLatestContentTimestamp","TypedEventEmitter","BeaconEvent","isTimestampInDuration","startTimestamp","durationMs","timestamp","getBeaconInfoIdentifier","event","concat","getRoomId","getStateKey","Beacon","constructor","rootEvent","_defineProperty","_latestLocationEvent","undefined","emit","LocationUpdate","latestLocationState","roomId","setBeaconInfo","isLive","_isLive","identifier","beaconInfoId","getId","beaconInfoOwner","beaconInfoEventType","getType","beaconInfo","_beaconInfo","getContent","latestLocationEvent","update","beaconInfoEvent","Error","getTs","Update","clearLatestLocation","destroy","livenessWatchTimeout","clearTimeout","Destroy","monitorLiveness","checkLiveness","expiryInMs","timeout","Date","now","setTimeout","addLocations","beaconLocationEvents","_validLocationEvents$","validLocationEvents","filter","content","parsed","uri","sort","prevLiveness","live","LivenessChange"],"sources":["../../src/models/beacon.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { type MBeaconEventContent } from \"../@types/beacon.ts\";\nimport {\n type BeaconInfoState,\n type BeaconLocationState,\n parseBeaconContent,\n parseBeaconInfoContent,\n} from \"../content-helpers.ts\";\nimport { type MatrixEvent } from \"./event.ts\";\nimport { sortEventsByLatestContentTimestamp } from \"../utils.ts\";\nimport { TypedEventEmitter } from \"./typed-event-emitter.ts\";\n\nexport enum BeaconEvent {\n New = \"Beacon.new\",\n Update = \"Beacon.update\",\n LivenessChange = \"Beacon.LivenessChange\",\n Destroy = \"Beacon.Destroy\",\n LocationUpdate = \"Beacon.LocationUpdate\",\n}\n\nexport type BeaconEventHandlerMap = {\n [BeaconEvent.Update]: (event: MatrixEvent, beacon: Beacon) => void;\n [BeaconEvent.LivenessChange]: (isLive: boolean, beacon: Beacon) => void;\n [BeaconEvent.Destroy]: (beaconIdentifier: string) => void;\n [BeaconEvent.LocationUpdate]: (locationState: BeaconLocationState) => void;\n};\n\nexport const isTimestampInDuration = (startTimestamp: number, durationMs: number, timestamp: number): boolean =>\n timestamp >= startTimestamp && startTimestamp + durationMs >= timestamp;\n\n// beacon info events are uniquely identified by\n// `<roomId>_<state_key>`\nexport type BeaconIdentifier = string;\nexport const getBeaconInfoIdentifier = (event: MatrixEvent): BeaconIdentifier =>\n `${event.getRoomId()}_${event.getStateKey()}`;\n\n// https://github.com/matrix-org/matrix-spec-proposals/pull/3672\nexport class Beacon extends TypedEventEmitter<Exclude<BeaconEvent, BeaconEvent.New>, BeaconEventHandlerMap> {\n public readonly roomId: string;\n // beaconInfo is assigned by setBeaconInfo in the constructor\n // ! to make tsc believe it is definitely assigned\n private _beaconInfo!: BeaconInfoState;\n private _isLive?: boolean;\n private livenessWatchTimeout?: ReturnType<typeof setTimeout>;\n private _latestLocationEvent?: MatrixEvent;\n\n public constructor(private rootEvent: MatrixEvent) {\n super();\n this.roomId = this.rootEvent.getRoomId()!;\n this.setBeaconInfo(this.rootEvent);\n }\n\n public get isLive(): boolean {\n return !!this._isLive;\n }\n\n public get identifier(): BeaconIdentifier {\n return getBeaconInfoIdentifier(this.rootEvent);\n }\n\n public get beaconInfoId(): string {\n return this.rootEvent.getId()!;\n }\n\n public get beaconInfoOwner(): string {\n return this.rootEvent.getStateKey()!;\n }\n\n public get beaconInfoEventType(): string {\n return this.rootEvent.getType();\n }\n\n public get beaconInfo(): BeaconInfoState {\n return this._beaconInfo;\n }\n\n public get latestLocationState(): BeaconLocationState | undefined {\n return this._latestLocationEvent && parseBeaconContent(this._latestLocationEvent.getContent());\n }\n\n public get latestLocationEvent(): MatrixEvent | undefined {\n return this._latestLocationEvent;\n }\n\n public update(beaconInfoEvent: MatrixEvent): void {\n if (getBeaconInfoIdentifier(beaconInfoEvent) !== this.identifier) {\n throw new Error(\"Invalid updating event\");\n }\n // don't update beacon with an older event\n if (beaconInfoEvent.getTs() < this.rootEvent.getTs()) {\n return;\n }\n this.rootEvent = beaconInfoEvent;\n this.setBeaconInfo(this.rootEvent);\n\n this.emit(BeaconEvent.Update, beaconInfoEvent, this);\n this.clearLatestLocation();\n }\n\n public destroy(): void {\n if (this.livenessWatchTimeout) {\n clearTimeout(this.livenessWatchTimeout);\n }\n\n this._isLive = false;\n this.emit(BeaconEvent.Destroy, this.identifier);\n }\n\n /**\n * Monitor liveness of a beacon\n * Emits BeaconEvent.LivenessChange when beacon expires\n */\n public monitorLiveness(): void {\n if (this.livenessWatchTimeout) {\n clearTimeout(this.livenessWatchTimeout);\n }\n\n this.checkLiveness();\n if (!this.beaconInfo) return;\n if (this.isLive) {\n const expiryInMs = this.beaconInfo.timestamp! + this.beaconInfo.timeout - Date.now();\n if (expiryInMs > 1) {\n this.livenessWatchTimeout = setTimeout(() => {\n this.monitorLiveness();\n }, expiryInMs);\n }\n } else if (this.beaconInfo.timestamp! > Date.now()) {\n // beacon start timestamp is in the future\n // check liveness again then\n this.livenessWatchTimeout = setTimeout(() => {\n this.monitorLiveness();\n }, this.beaconInfo.timestamp! - Date.now());\n }\n }\n\n /**\n * Process Beacon locations\n * Emits BeaconEvent.LocationUpdate\n */\n public addLocations(beaconLocationEvents: MatrixEvent[]): void {\n // discard locations for beacons that are not live\n if (!this.isLive) {\n return;\n }\n\n const validLocationEvents = beaconLocationEvents.filter((event) => {\n const content = event.getContent<MBeaconEventContent>();\n const parsed = parseBeaconContent(content);\n if (!parsed.uri || !parsed.timestamp) return false; // we won't be able to process these\n const { timestamp } = parsed;\n return (\n this._beaconInfo.timestamp &&\n // only include positions that were taken inside the beacon's live period\n isTimestampInDuration(this._beaconInfo.timestamp, this._beaconInfo.timeout, timestamp) &&\n // ignore positions older than our current latest location\n (!this.latestLocationState || timestamp > this.latestLocationState.timestamp!)\n );\n });\n const latestLocationEvent = validLocationEvents.sort(sortEventsByLatestContentTimestamp)?.[0];\n\n if (latestLocationEvent) {\n this._latestLocationEvent = latestLocationEvent;\n this.emit(BeaconEvent.LocationUpdate, this.latestLocationState!);\n }\n }\n\n private clearLatestLocation = (): void => {\n this._latestLocationEvent = undefined;\n this.emit(BeaconEvent.LocationUpdate, this.latestLocationState!);\n };\n\n private setBeaconInfo(event: MatrixEvent): void {\n this._beaconInfo = parseBeaconInfoContent(event.getContent());\n this.checkLiveness();\n }\n\n private checkLiveness(): void {\n const prevLiveness = this.isLive;\n\n // element web sets a beacon's start timestamp to the senders local current time\n // when Alice's system clock deviates slightly from Bob's a beacon Alice intended to be live\n // may have a start timestamp in the future from Bob's POV\n // handle this by adding 6min of leniency to the start timestamp when it is in the future\n if (!this.beaconInfo) return;\n const startTimestamp =\n this.beaconInfo.timestamp! > Date.now()\n ? this.beaconInfo.timestamp! - 360000 /* 6min */\n : this.beaconInfo.timestamp;\n this._isLive =\n !!this._beaconInfo.live &&\n !!startTimestamp &&\n isTimestampInDuration(startTimestamp, this._beaconInfo.timeout, Date.now());\n\n if (prevLiveness !== this.isLive) {\n this.emit(BeaconEvent.LivenessChange, this.isLive, this);\n }\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAGIA,kBAAkB,EAClBC,sBAAsB,QACnB,uBAAuB;AAE9B,SAASC,kCAAkC,QAAQ,aAAa;AAChE,SAASC,iBAAiB,QAAQ,0BAA0B;AAE5D,WAAYC,WAAW,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;E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AG,CAAC,CAAC,CAAC;IAE/E,IAAIW,YAAY,KAAK,IAAI,CAACtC,MAAM,EAAE;MAC9B,IAAI,CAACL,IAAI,CAAChB,WAAW,CAAC6D,cAAc,EAAE,IAAI,CAACxC,MAAM,EAAE,IAAI,CAAC;IAC5D;EACJ;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"beacon.js","names":[],"sources":["../../src/models/beacon.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { type MBeaconEventContent } from \"../@types/beacon.ts\";\nimport {\n type BeaconInfoState,\n type BeaconLocationState,\n parseBeaconContent,\n parseBeaconInfoContent,\n} from \"../content-helpers.ts\";\nimport { type MatrixEvent } from \"./event.ts\";\nimport { sortEventsByLatestContentTimestamp } from \"../utils.ts\";\nimport { TypedEventEmitter } from \"./typed-event-emitter.ts\";\n\nexport enum BeaconEvent {\n New = \"Beacon.new\",\n Update = \"Beacon.update\",\n LivenessChange = \"Beacon.LivenessChange\",\n Destroy = \"Beacon.Destroy\",\n LocationUpdate = \"Beacon.LocationUpdate\",\n}\n\nexport type BeaconEventHandlerMap = {\n [BeaconEvent.Update]: (event: MatrixEvent, beacon: Beacon) => void;\n [BeaconEvent.LivenessChange]: (isLive: boolean, beacon: Beacon) => void;\n [BeaconEvent.Destroy]: (beaconIdentifier: string) => void;\n [BeaconEvent.LocationUpdate]: (locationState: BeaconLocationState) => void;\n};\n\nexport const isTimestampInDuration = (startTimestamp: number, durationMs: number, timestamp: number): boolean =>\n timestamp >= startTimestamp && startTimestamp + durationMs >= timestamp;\n\n// beacon info events are uniquely identified by\n// `<roomId>_<state_key>`\nexport type BeaconIdentifier = string;\nexport const getBeaconInfoIdentifier = (event: MatrixEvent): BeaconIdentifier =>\n `${event.getRoomId()}_${event.getStateKey()}`;\n\n// https://github.com/matrix-org/matrix-spec-proposals/pull/3672\nexport class Beacon extends TypedEventEmitter<Exclude<BeaconEvent, BeaconEvent.New>, BeaconEventHandlerMap> {\n public readonly roomId: string;\n // beaconInfo is assigned by setBeaconInfo in the constructor\n // ! to make tsc believe it is definitely assigned\n private _beaconInfo!: BeaconInfoState;\n private _isLive?: boolean;\n private livenessWatchTimeout?: ReturnType<typeof setTimeout>;\n private _latestLocationEvent?: MatrixEvent;\n\n public constructor(private rootEvent: MatrixEvent) {\n super();\n this.roomId = this.rootEvent.getRoomId()!;\n this.setBeaconInfo(this.rootEvent);\n }\n\n public get isLive(): boolean {\n return !!this._isLive;\n }\n\n public get identifier(): BeaconIdentifier {\n return getBeaconInfoIdentifier(this.rootEvent);\n }\n\n public get beaconInfoId(): string {\n return this.rootEvent.getId()!;\n }\n\n public get beaconInfoOwner(): string {\n return this.rootEvent.getStateKey()!;\n }\n\n public get beaconInfoEventType(): string {\n return this.rootEvent.getType();\n }\n\n public get beaconInfo(): BeaconInfoState {\n return this._beaconInfo;\n }\n\n public get latestLocationState(): BeaconLocationState | undefined {\n return this._latestLocationEvent && parseBeaconContent(this._latestLocationEvent.getContent());\n }\n\n public get latestLocationEvent(): MatrixEvent | undefined {\n return this._latestLocationEvent;\n }\n\n public update(beaconInfoEvent: MatrixEvent): void {\n if (getBeaconInfoIdentifier(beaconInfoEvent) !== this.identifier) {\n throw new Error(\"Invalid updating event\");\n }\n // don't update beacon with an older event\n if (beaconInfoEvent.getTs() < this.rootEvent.getTs()) {\n return;\n }\n this.rootEvent = beaconInfoEvent;\n this.setBeaconInfo(this.rootEvent);\n\n this.emit(BeaconEvent.Update, beaconInfoEvent, this);\n this.clearLatestLocation();\n }\n\n public destroy(): void {\n if (this.livenessWatchTimeout) {\n clearTimeout(this.livenessWatchTimeout);\n }\n\n this._isLive = false;\n this.emit(BeaconEvent.Destroy, this.identifier);\n }\n\n /**\n * Monitor liveness of a beacon\n * Emits BeaconEvent.LivenessChange when beacon expires\n */\n public monitorLiveness(): void {\n if (this.livenessWatchTimeout) {\n clearTimeout(this.livenessWatchTimeout);\n }\n\n this.checkLiveness();\n if (!this.beaconInfo) return;\n if (this.isLive) {\n const expiryInMs = this.beaconInfo.timestamp! + this.beaconInfo.timeout - Date.now();\n if (expiryInMs > 1) {\n this.livenessWatchTimeout = setTimeout(() => {\n this.monitorLiveness();\n }, expiryInMs);\n }\n } else if (this.beaconInfo.timestamp! > Date.now()) {\n // beacon start timestamp is in the future\n // check liveness again then\n this.livenessWatchTimeout = setTimeout(() => {\n this.monitorLiveness();\n }, this.beaconInfo.timestamp! - Date.now());\n }\n }\n\n /**\n * Process Beacon locations\n * Emits BeaconEvent.LocationUpdate\n */\n public addLocations(beaconLocationEvents: MatrixEvent[]): void {\n // discard locations for beacons that are not live\n if (!this.isLive) {\n return;\n }\n\n const validLocationEvents = beaconLocationEvents.filter((event) => {\n const content = event.getContent<MBeaconEventContent>();\n const parsed = parseBeaconContent(content);\n if (!parsed.uri || !parsed.timestamp) return false; // we won't be able to process these\n const { timestamp } = parsed;\n return (\n this._beaconInfo.timestamp &&\n // only include positions that were taken inside the beacon's live period\n isTimestampInDuration(this._beaconInfo.timestamp, this._beaconInfo.timeout, timestamp) &&\n // ignore positions older than our current latest location\n (!this.latestLocationState || timestamp > this.latestLocationState.timestamp!)\n );\n });\n const latestLocationEvent = validLocationEvents.sort(sortEventsByLatestContentTimestamp)?.[0];\n\n if (latestLocationEvent) {\n this._latestLocationEvent = latestLocationEvent;\n this.emit(BeaconEvent.LocationUpdate, this.latestLocationState!);\n }\n }\n\n private clearLatestLocation = (): void => {\n this._latestLocationEvent = undefined;\n this.emit(BeaconEvent.LocationUpdate, this.latestLocationState!);\n };\n\n private setBeaconInfo(event: MatrixEvent): void {\n this._beaconInfo = parseBeaconInfoContent(event.getContent());\n this.checkLiveness();\n }\n\n private checkLiveness(): void {\n const prevLiveness = this.isLive;\n\n // element web sets a beacon's start timestamp to the senders local current time\n // when Alice's system clock deviates slightly from Bob's a beacon Alice intended to be live\n // may have a start timestamp in the future from Bob's POV\n // handle this by adding 6min of leniency to the start timestamp when it is in the future\n if (!this.beaconInfo) return;\n const startTimestamp =\n this.beaconInfo.timestamp! > Date.now()\n ? this.beaconInfo.timestamp! - 360000 /* 6min */\n : this.beaconInfo.timestamp;\n this._isLive =\n !!this._beaconInfo.live &&\n !!startTimestamp &&\n isTimestampInDuration(startTimestamp, this._beaconInfo.timeout, Date.now());\n\n if (prevLiveness !== this.isLive) {\n this.emit(BeaconEvent.LivenessChange, this.isLive, this);\n }\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAGI,kBAAkB,EAClB,sBAAsB,QACnB,uBAAuB;AAE9B,SAAS,kCAAkC,QAAQ,aAAa;AAChE,SAAS,iBAAiB,QAAQ,0BAA0B;AAE5D,WAAY,WAAW,0BAAX,WAAW;EAAX,WAAW;EAAX,WAAW;EAAX,WAAW;EAAX,WAAW;EAAX,WAAW;EAAA,OAAX,WAAW;AAAA;AAevB,OAAO,MAAM,qBAAqB,GAAG,CAAC,cAAsB,EAAE,UAAkB,EAAE,SAAiB,KAC/F,SAAS,IAAI,cAAc,IAAI,cAAc,GAAG,UAAU,IAAI,SAAS;;AAE3E;AACA;;AAEA,OAAO,MAAM,uBAAuB,GAAI,KAAkB,IACtD,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC,EAAE;;AAEjD;AACA,OAAO,MAAM,MAAM,SAAS,iBAAiB,CAA+D;EASjG,WAAW,CAAS,SAAsB,EAAE;IAC/C,KAAK,CAAC,CAAC;IAAC;IARZ;IACA;IAAA;IAAA;I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,CAAC,MAAM;;IAEhC;IACA;IACA;IACA;IACA,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;IACtB,MAAM,cAAc,GAChB,IAAI,CAAC,UAAU,CAAC,SAAS,GAAI,IAAI,CAAC,GAAG,CAAC,CAAC,GACjC,IAAI,CAAC,UAAU,CAAC,SAAS,GAAI,MAAM,CAAC,aACpC,IAAI,CAAC,UAAU,CAAC,SAAS;IACnC,IAAI,CAAC,OAAO,GACR,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,IACvB,CAAC,CAAC,cAAc,IAChB,qBAAqB,CAAC,cAAc,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAE/E,IAAI,YAAY,KAAK,IAAI,CAAC,MAAM,EAAE;MAC9B,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC;IAC5D;EACJ;AACJ","ignoreList":[]}
@@ -38,8 +38,8 @@ import { inMainTimelineForReceipt, threadIdForReceipt } from "../client.js";
38
38
  * we can't tell (because we can't find the events).
39
39
  */
40
40
  export function compareEventOrdering(room, leftEventId, rightEventId) {
41
- var leftEvent = room.findEventById(leftEventId);
42
- var rightEvent = room.findEventById(rightEventId);
41
+ const leftEvent = room.findEventById(leftEventId);
42
+ const rightEvent = room.findEventById(rightEventId);
43
43
  if (!leftEvent || !rightEvent) {
44
44
  // Without the events themselves, we can't find their thread or
45
45
  // timeline, or guess based on timestamp, so we just don't know.
@@ -47,8 +47,8 @@ export function compareEventOrdering(room, leftEventId, rightEventId) {
47
47
  }
48
48
 
49
49
  // Check whether the events are in the main timeline
50
- var isLeftEventInMainTimeline = inMainTimelineForReceipt(leftEvent);
51
- var isRightEventInMainTimeline = inMainTimelineForReceipt(rightEvent);
50
+ const isLeftEventInMainTimeline = inMainTimelineForReceipt(leftEvent);
51
+ const isRightEventInMainTimeline = inMainTimelineForReceipt(rightEvent);
52
52
  if (isLeftEventInMainTimeline && isRightEventInMainTimeline) {
53
53
  return compareEventsInMainTimeline(room, leftEventId, rightEventId, leftEvent, rightEvent);
54
54
  } else {
@@ -59,10 +59,10 @@ export function compareEventOrdering(room, leftEventId, rightEventId) {
59
59
  }
60
60
  function compareEventsInMainTimeline(room, leftEventId, rightEventId, leftEvent, rightEvent) {
61
61
  // Get the timeline set that contains all the events.
62
- var timelineSet = room.getUnfilteredTimelineSet();
62
+ const timelineSet = room.getUnfilteredTimelineSet();
63
63
 
64
64
  // If they are in the same timeline, compareEventOrdering does what we need
65
- var compareSameTimeline = timelineSet.compareEventOrdering(leftEventId, rightEventId);
65
+ const compareSameTimeline = timelineSet.compareEventOrdering(leftEventId, rightEventId);
66
66
  if (compareSameTimeline !== null) {
67
67
  return compareSameTimeline;
68
68
  }
@@ -70,14 +70,14 @@ function compareEventsInMainTimeline(room, leftEventId, rightEventId, leftEvent,
70
70
  // Find which timeline each event is in. Refuse to provide an ordering if we
71
71
  // can't find either of the events.
72
72
 
73
- var leftTimeline = timelineSet.getTimelineForEvent(leftEventId);
73
+ const leftTimeline = timelineSet.getTimelineForEvent(leftEventId);
74
74
  if (leftTimeline === timelineSet.getLiveTimeline()) {
75
75
  // The left event is part of the live timeline, so it must be after the
76
76
  // right event (since they are not in the same timeline or we would have
77
77
  // returned after compareEventOrdering.
78
78
  return 1;
79
79
  }
80
- var rightTimeline = timelineSet.getTimelineForEvent(rightEventId);
80
+ const rightTimeline = timelineSet.getTimelineForEvent(rightEventId);
81
81
  if (rightTimeline === timelineSet.getLiveTimeline()) {
82
82
  // The right event is part of the live timeline, so it must be after the
83
83
  // left event.
@@ -88,9 +88,9 @@ function compareEventsInMainTimeline(room, leftEventId, rightEventId, leftEvent,
88
88
  return guessOrderBasedOnTimestamp(leftEvent, rightEvent);
89
89
  }
90
90
  function compareEventsInThreads(leftEventId, rightEventId, leftEvent, rightEvent) {
91
- var leftEventThreadId = threadIdForReceipt(leftEvent);
92
- var rightEventThreadId = threadIdForReceipt(rightEvent);
93
- var leftThread = leftEvent.getThread();
91
+ const leftEventThreadId = threadIdForReceipt(leftEvent);
92
+ const rightEventThreadId = threadIdForReceipt(rightEvent);
93
+ const leftThread = leftEvent.getThread();
94
94
  if (leftThread && leftEventThreadId === rightEventThreadId) {
95
95
  // They are in the same thread, so we can ask the thread's timeline to
96
96
  // figure it out for us
@@ -107,8 +107,8 @@ function compareEventsInThreads(leftEventId, rightEventId, leftEvent, rightEvent
107
107
  * See https://github.com/matrix-org/matrix-js-sdk/issues/3325
108
108
  */
109
109
  function guessOrderBasedOnTimestamp(leftEvent, rightEvent) {
110
- var leftTs = leftEvent.getTs();
111
- var rightTs = rightEvent.getTs();
110
+ const leftTs = leftEvent.getTs();
111
+ const rightTs = rightEvent.getTs();
112
112
  if (leftTs < rightTs) {
113
113
  return -1;
114
114
  } else if (leftTs > rightTs) {
@@ -1 +1 @@
1
- {"version":3,"file":"compare-event-ordering.js","names":["inMainTimelineForReceipt","threadIdForReceipt","compareEventOrdering","room","leftEventId","rightEventId","leftEvent","findEventById","rightEvent","isLeftEventInMainTimeline","isRightEventInMainTimeline","compareEventsInMainTimeline","compareEventsInThreads","timelineSet","getUnfilteredTimelineSet","compareSameTimeline","leftTimeline","getTimelineForEvent","getLiveTimeline","rightTimeline","guessOrderBasedOnTimestamp","leftEventThreadId","rightEventThreadId","leftThread","getThread","leftTs","getTs","rightTs"],"sources":["../../src/models/compare-event-ordering.ts"],"sourcesContent":["/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { type MatrixEvent } from \"./event.ts\";\nimport { type Room } from \"./room.ts\";\nimport { inMainTimelineForReceipt, threadIdForReceipt } from \"../client.ts\";\n\n/**\n * Determine the order of two events in a room.\n *\n * In principle this should use the same order as the server, but in practice\n * this is difficult for events that were not received over the Sync API. See\n * MSC4033 for details.\n *\n * This implementation leans on the order of events within their timelines, and\n * falls back to comparing event timestamps when they are in different\n * timelines.\n *\n * See https://github.com/matrix-org/matrix-js-sdk/issues/3325 for where we are\n * tracking the work to fix this.\n *\n * @param room - the room we are looking in\n * @param leftEventId - the id of the first event\n * @param rightEventId - the id of the second event\n\n * @returns -1 if left \\< right, 1 if left \\> right, 0 if left == right, null if\n * we can't tell (because we can't find the events).\n */\nexport function compareEventOrdering(room: Room, leftEventId: string, rightEventId: string): number | null {\n const leftEvent = room.findEventById(leftEventId);\n const rightEvent = room.findEventById(rightEventId);\n\n if (!leftEvent || !rightEvent) {\n // Without the events themselves, we can't find their thread or\n // timeline, or guess based on timestamp, so we just don't know.\n return null;\n }\n\n // Check whether the events are in the main timeline\n const isLeftEventInMainTimeline = inMainTimelineForReceipt(leftEvent);\n const isRightEventInMainTimeline = inMainTimelineForReceipt(rightEvent);\n\n if (isLeftEventInMainTimeline && isRightEventInMainTimeline) {\n return compareEventsInMainTimeline(room, leftEventId, rightEventId, leftEvent, rightEvent);\n } else {\n // At least one event is not in the timeline, so we can't use the room's\n // unfiltered timeline set.\n return compareEventsInThreads(leftEventId, rightEventId, leftEvent, rightEvent);\n }\n}\n\nfunction compareEventsInMainTimeline(\n room: Room,\n leftEventId: string,\n rightEventId: string,\n leftEvent: MatrixEvent,\n rightEvent: MatrixEvent,\n): number | null {\n // Get the timeline set that contains all the events.\n const timelineSet = room.getUnfilteredTimelineSet();\n\n // If they are in the same timeline, compareEventOrdering does what we need\n const compareSameTimeline = timelineSet.compareEventOrdering(leftEventId, rightEventId);\n if (compareSameTimeline !== null) {\n return compareSameTimeline;\n }\n\n // Find which timeline each event is in. Refuse to provide an ordering if we\n // can't find either of the events.\n\n const leftTimeline = timelineSet.getTimelineForEvent(leftEventId);\n if (leftTimeline === timelineSet.getLiveTimeline()) {\n // The left event is part of the live timeline, so it must be after the\n // right event (since they are not in the same timeline or we would have\n // returned after compareEventOrdering.\n return 1;\n }\n\n const rightTimeline = timelineSet.getTimelineForEvent(rightEventId);\n if (rightTimeline === timelineSet.getLiveTimeline()) {\n // The right event is part of the live timeline, so it must be after the\n // left event.\n return -1;\n }\n\n // They are in older timeline sets (because they were fetched by paging up).\n return guessOrderBasedOnTimestamp(leftEvent, rightEvent);\n}\n\nfunction compareEventsInThreads(\n leftEventId: string,\n rightEventId: string,\n leftEvent: MatrixEvent,\n rightEvent: MatrixEvent,\n): number | null {\n const leftEventThreadId = threadIdForReceipt(leftEvent);\n const rightEventThreadId = threadIdForReceipt(rightEvent);\n\n const leftThread = leftEvent.getThread();\n\n if (leftThread && leftEventThreadId === rightEventThreadId) {\n // They are in the same thread, so we can ask the thread's timeline to\n // figure it out for us\n return leftThread.timelineSet.compareEventOrdering(leftEventId, rightEventId);\n } else {\n return guessOrderBasedOnTimestamp(leftEvent, rightEvent);\n }\n}\n\n/**\n * Guess the order of events based on server timestamp. This is not good, but\n * difficult to avoid without MSC4033.\n *\n * See https://github.com/matrix-org/matrix-js-sdk/issues/3325\n */\nfunction guessOrderBasedOnTimestamp(leftEvent: MatrixEvent, rightEvent: MatrixEvent): number {\n const leftTs = leftEvent.getTs();\n const rightTs = rightEvent.getTs();\n if (leftTs < rightTs) {\n return -1;\n } else if (leftTs > rightTs) {\n return 1;\n } else {\n return 0;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,wBAAwB,EAAEC,kBAAkB,QAAQ,cAAc;;AAE3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,S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,WAAW,CAACK,eAAe,CAAC,CAAC,EAAE;IACjD;IACA;IACA,OAAO,CAAC,CAAC;EACb;;EAEA;EACA,OAAOE,0BAA0B,CAACd,SAAS,EAAEE,UAAU,CAAC;AAC5D;AAEA,SAASI,sBAAsBA,CAC3BR,WAAmB,EACnBC,YAAoB,EACpBC,SAAsB,EACtBE,UAAuB,EACV;EACb,IAAMa,iBAAiB,GAAGpB,kBAAkB,CAACK,SAAS,CAAC;EACvD,IAAMgB,kBAAkB,GAAGrB,kBAAkB,CAACO,UAAU,CAAC;EAEzD,IAAMe,UAAU,GAAGjB,SAAS,CAACkB,SAAS,CAAC,CAAC;EAExC,IAAID,UAAU,IAAIF,iBAAiB,KAAKC,kBAAkB,EAAE;IACxD;IACA;IACA,OAAOC,UAAU,CAACV,WAAW,CAACX,oBAAoB,CAACE,WAAW,EAAEC,YAAY,CAAC;EACjF,CAAC,MAAM;IACH,OAAOe,0BAA0B,CAACd,SAAS,EAAEE,UAAU,CAAC;EAC5D;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASY,0BAA0BA,CAACd,SAAsB,EAAEE,UAAuB,EAAU;EACzF,IAAMiB,MAAM,GAAGnB,SAAS,CAACoB,KAAK,CAAC,CAAC;EAChC,IAAMC,OAAO,GAAGnB,UAAU,CAACkB,KAAK,CAAC,CAAC;EAClC,IAAID,MAAM,GAAGE,OAAO,EAAE;IAClB,OAAO,CAAC,CAAC;EACb,CAAC,MAAM,IAAIF,MAAM,GAAGE,OAAO,EAAE;IACzB,OAAO,CAAC;EACZ,CAAC,MAAM;IACH,OAAO,CAAC;EACZ;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"compare-event-ordering.js","names":[],"sources":["../../src/models/compare-event-ordering.ts"],"sourcesContent":["/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { type MatrixEvent } from \"./event.ts\";\nimport { type Room } from \"./room.ts\";\nimport { inMainTimelineForReceipt, threadIdForReceipt } from \"../client.ts\";\n\n/**\n * Determine the order of two events in a room.\n *\n * In principle this should use the same order as the server, but in practice\n * this is difficult for events that were not received over the Sync API. See\n * MSC4033 for details.\n *\n * This implementation leans on the order of events within their timelines, and\n * falls back to comparing event timestamps when they are in different\n * timelines.\n *\n * See https://github.com/matrix-org/matrix-js-sdk/issues/3325 for where we are\n * tracking the work to fix this.\n *\n * @param room - the room we are looking in\n * @param leftEventId - the id of the first event\n * @param rightEventId - the id of the second event\n\n * @returns -1 if left \\< right, 1 if left \\> right, 0 if left == right, null if\n * we can't tell (because we can't find the events).\n */\nexport function compareEventOrdering(room: Room, leftEventId: string, rightEventId: string): number | null {\n const leftEvent = room.findEventById(leftEventId);\n const rightEvent = room.findEventById(rightEventId);\n\n if (!leftEvent || !rightEvent) {\n // Without the events themselves, we can't find their thread or\n // timeline, or guess based on timestamp, so we just don't know.\n return null;\n }\n\n // Check whether the events are in the main timeline\n const isLeftEventInMainTimeline = inMainTimelineForReceipt(leftEvent);\n const isRightEventInMainTimeline = inMainTimelineForReceipt(rightEvent);\n\n if (isLeftEventInMainTimeline && isRightEventInMainTimeline) {\n return compareEventsInMainTimeline(room, leftEventId, rightEventId, leftEvent, rightEvent);\n } else {\n // At least one event is not in the timeline, so we can't use the room's\n // unfiltered timeline set.\n return compareEventsInThreads(leftEventId, rightEventId, leftEvent, rightEvent);\n }\n}\n\nfunction compareEventsInMainTimeline(\n room: Room,\n leftEventId: string,\n rightEventId: string,\n leftEvent: MatrixEvent,\n rightEvent: MatrixEvent,\n): number | null {\n // Get the timeline set that contains all the events.\n const timelineSet = room.getUnfilteredTimelineSet();\n\n // If they are in the same timeline, compareEventOrdering does what we need\n const compareSameTimeline = timelineSet.compareEventOrdering(leftEventId, rightEventId);\n if (compareSameTimeline !== null) {\n return compareSameTimeline;\n }\n\n // Find which timeline each event is in. Refuse to provide an ordering if we\n // can't find either of the events.\n\n const leftTimeline = timelineSet.getTimelineForEvent(leftEventId);\n if (leftTimeline === timelineSet.getLiveTimeline()) {\n // The left event is part of the live timeline, so it must be after the\n // right event (since they are not in the same timeline or we would have\n // returned after compareEventOrdering.\n return 1;\n }\n\n const rightTimeline = timelineSet.getTimelineForEvent(rightEventId);\n if (rightTimeline === timelineSet.getLiveTimeline()) {\n // The right event is part of the live timeline, so it must be after the\n // left event.\n return -1;\n }\n\n // They are in older timeline sets (because they were fetched by paging up).\n return guessOrderBasedOnTimestamp(leftEvent, rightEvent);\n}\n\nfunction compareEventsInThreads(\n leftEventId: string,\n rightEventId: string,\n leftEvent: MatrixEvent,\n rightEvent: MatrixEvent,\n): number | null {\n const leftEventThreadId = threadIdForReceipt(leftEvent);\n const rightEventThreadId = threadIdForReceipt(rightEvent);\n\n const leftThread = leftEvent.getThread();\n\n if (leftThread && leftEventThreadId === rightEventThreadId) {\n // They are in the same thread, so we can ask the thread's timeline to\n // figure it out for us\n return leftThread.timelineSet.compareEventOrdering(leftEventId, rightEventId);\n } else {\n return guessOrderBasedOnTimestamp(leftEvent, rightEvent);\n }\n}\n\n/**\n * Guess the order of events based on server timestamp. This is not good, but\n * difficult to avoid without MSC4033.\n *\n * See https://github.com/matrix-org/matrix-js-sdk/issues/3325\n */\nfunction guessOrderBasedOnTimestamp(leftEvent: MatrixEvent, rightEvent: MatrixEvent): number {\n const leftTs = leftEvent.getTs();\n const rightTs = rightEvent.getTs();\n if (leftTs < rightTs) {\n return -1;\n } else if (leftTs > rightTs) {\n return 1;\n } else {\n return 0;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA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IACA,OAAO,CAAC;EACZ;EAEA,MAAM,aAAa,GAAG,WAAW,CAAC,mBAAmB,CAAC,YAAY,CAAC;EACnE,IAAI,aAAa,KAAK,WAAW,CAAC,eAAe,CAAC,CAAC,EAAE;IACjD;IACA;IACA,OAAO,CAAC,CAAC;EACb;;EAEA;EACA,OAAO,0BAA0B,CAAC,SAAS,EAAE,UAAU,CAAC;AAC5D;AAEA,SAAS,sBAAsB,CAC3B,WAAmB,EACnB,YAAoB,EACpB,SAAsB,EACtB,UAAuB,EACV;EACb,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,SAAS,CAAC;EACvD,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,UAAU,CAAC;EAEzD,MAAM,UAAU,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;EAExC,IAAI,UAAU,IAAI,iBAAiB,KAAK,kBAAkB,EAAE;IACxD;IACA;IACA,OAAO,UAAU,CAAC,WAAW,CAAC,oBAAoB,CAAC,WAAW,EAAE,YAAY,CAAC;EACjF,CAAC,MAAM;IACH,OAAO,0BAA0B,CAAC,SAAS,EAAE,UAAU,CAAC;EAC5D;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,0BAA0B,CAAC,SAAsB,EAAE,UAAuB,EAAU;EACzF,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;EAChC,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;EAClC,IAAI,MAAM,GAAG,OAAO,EAAE;IAClB,OAAO,CAAC,CAAC;EACb,CAAC,MAAM,IAAI,MAAM,GAAG,OAAO,EAAE;IACzB,OAAO,CAAC;EACZ,CAAC,MAAM;IACH,OAAO,CAAC;EACZ;AACJ","ignoreList":[]}
@@ -16,7 +16,7 @@ limitations under the License.
16
16
  */
17
17
 
18
18
  /** State of the verification of the device. */
19
- export var DeviceVerification = /*#__PURE__*/function (DeviceVerification) {
19
+ export let DeviceVerification = /*#__PURE__*/function (DeviceVerification) {
20
20
  DeviceVerification[DeviceVerification["Blocked"] = -1] = "Blocked";
21
21
  DeviceVerification[DeviceVerification["Unverified"] = 0] = "Unverified";
22
22
  DeviceVerification[DeviceVerification["Verified"] = 1] = "Verified";
@@ -31,12 +31,19 @@ export var DeviceVerification = /*#__PURE__*/function (DeviceVerification) {
31
31
  export class Device {
32
32
  constructor(opts) {
33
33
  /** id of the device */
34
+ _defineProperty(this, "deviceId", void 0);
34
35
  /** id of the user that owns the device */
36
+ _defineProperty(this, "userId", void 0);
35
37
  /** list of algorithms supported by this device */
38
+ _defineProperty(this, "algorithms", void 0);
36
39
  /** a map from `<key type>:<id> -> <base64-encoded key>` */
40
+ _defineProperty(this, "keys", void 0);
37
41
  /** whether the device has been verified/blocked by the user */
42
+ _defineProperty(this, "verified", void 0);
38
43
  /** a map `<userId, map<algorithm:device_id, signature>>` */
44
+ _defineProperty(this, "signatures", void 0);
39
45
  /** display name of the device */
46
+ _defineProperty(this, "displayName", void 0);
40
47
  /** whether the device is a dehydrated device */
41
48
  _defineProperty(this, "dehydrated", false);
42
49
  this.deviceId = opts.deviceId;
@@ -55,7 +62,7 @@ export class Device {
55
62
  * @returns base64-encoded fingerprint of this device
56
63
  */
57
64
  getFingerprint() {
58
- return this.keys.get("ed25519:".concat(this.deviceId));
65
+ return this.keys.get(`ed25519:${this.deviceId}`);
59
66
  }
60
67
 
61
68
  /**
@@ -64,7 +71,7 @@ export class Device {
64
71
  * @returns base64-encoded identity key of this device
65
72
  */
66
73
  getIdentityKey() {
67
- return this.keys.get("curve25519:".concat(this.deviceId));
74
+ return this.keys.get(`curve25519:${this.deviceId}`);
68
75
  }
69
76
  }
70
77
  //# sourceMappingURL=device.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"device.js","names":["DeviceVerification","Device","constructor","opts","_defineProperty","deviceId","userId","algorithms","keys","verified","Unverified","signatures","Map","displayName","dehydrated","getFingerprint","get","concat","getIdentityKey"],"sources":["../../src/models/device.ts"],"sourcesContent":["/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/** State of the verification of the device. */\nexport enum DeviceVerification {\n Blocked = -1,\n Unverified = 0,\n Verified = 1,\n}\n\n/** A map from user ID to device ID to Device */\nexport type DeviceMap = Map<string, Map<string, Device>>;\n\ntype DeviceParameters = Pick<Device, \"deviceId\" | \"userId\" | \"algorithms\" | \"keys\"> & Partial<Device>;\n\n/**\n * Information on a user's device, as returned by {@link crypto-api!CryptoApi.getUserDeviceInfo}.\n */\nexport class Device {\n /** id of the device */\n public readonly deviceId: string;\n\n /** id of the user that owns the device */\n public readonly userId: string;\n\n /** list of algorithms supported by this device */\n public readonly algorithms: string[];\n\n /** a map from `<key type>:<id> -> <base64-encoded key>` */\n public readonly keys: Map<string, string>;\n\n /** whether the device has been verified/blocked by the user */\n public readonly verified: DeviceVerification;\n\n /** a map `<userId, map<algorithm:device_id, signature>>` */\n public readonly signatures: Map<string, Map<string, string>>;\n\n /** display name of the device */\n public readonly displayName?: string;\n\n /** whether the device is a dehydrated device */\n public readonly dehydrated: boolean = false;\n\n public constructor(opts: DeviceParameters) {\n this.deviceId = opts.deviceId;\n this.userId = opts.userId;\n this.algorithms = opts.algorithms;\n this.keys = opts.keys;\n this.verified = opts.verified || DeviceVerification.Unverified;\n this.signatures = opts.signatures || new Map();\n this.displayName = opts.displayName;\n this.dehydrated = !!opts.dehydrated;\n }\n\n /**\n * Get the fingerprint for this device (ie, the Ed25519 key)\n *\n * @returns base64-encoded fingerprint of this device\n */\n public getFingerprint(): string | undefined {\n return this.keys.get(`ed25519:${this.deviceId}`);\n }\n\n /**\n * Get the identity key for this device (ie, the Curve25519 key)\n *\n * @returns base64-encoded identity key of this device\n */\n public getIdentityKey(): string | undefined {\n return this.keys.get(`curve25519:${this.deviceId}`);\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,WAAYA,kBAAkB,0BAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;;AAM9B;;AAKA;AACA;AACA;AACA,OAAO,MAAMC,MAAM,CAAC;EAyBTC,WAAWA,CAACC,IAAsB,EAAE;IAxB3C;IAGA;IAGA;IAGA;IAGA;IAGA;IAGA;IAGA;IAAAC,eAAA,qBACsC,KAAK;IAGvC,IAAI,CAACC,QAAQ,GAAGF,IAAI,CAACE,QAAQ;IAC7B,IAAI,CAACC,MAAM,GAAGH,IAAI,CAACG,MAAM;IACzB,IAAI,CAACC,UAAU,GAAGJ,IAAI,CAACI,UAAU;IACjC,IAAI,CAACC,IAAI,GAAGL,IAAI,CAACK,IAAI;IACrB,IAAI,CAACC,QAAQ,GAAGN,IAAI,CAACM,QAAQ,IAAIT,kBAAkB,CAACU,UAAU;IAC9D,IAAI,CAACC,UAAU,GAAGR,IAAI,CAACQ,UAAU,IAAI,IAAIC,GAAG,CAAC,CAAC;IAC9C,IAAI,CAACC,WAAW,GAAGV,IAAI,CAACU,WAAW;IACnC,IAAI,CAACC,UAAU,GAAG,CAAC,CAACX,IAAI,CAACW,UAAU;EACvC;;EAEA;AACJ;AACA;AACA;AACA;EACWC,cAAcA,CAAA,EAAuB;IACxC,OAAO,IAAI,CAACP,IAAI,CAACQ,GAAG,YAAAC,MAAA,CAAY,IAAI,CAACZ,QAAQ,CAAE,CAAC;EACpD;;EAEA;AACJ;AACA;AACA;AACA;EACWa,cAAcA,CAAA,EAAuB;IACxC,OAAO,IAAI,CAACV,IAAI,CAACQ,GAAG,eAAAC,MAAA,CAAe,IAAI,CAACZ,QAAQ,CAAE,CAAC;EACvD;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"device.js","names":[],"sources":["../../src/models/device.ts"],"sourcesContent":["/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/** State of the verification of the device. */\nexport enum DeviceVerification {\n Blocked = -1,\n Unverified = 0,\n Verified = 1,\n}\n\n/** A map from user ID to device ID to Device */\nexport type DeviceMap = Map<string, Map<string, Device>>;\n\ntype DeviceParameters = Pick<Device, \"deviceId\" | \"userId\" | \"algorithms\" | \"keys\"> & Partial<Device>;\n\n/**\n * Information on a user's device, as returned by {@link crypto-api!CryptoApi.getUserDeviceInfo}.\n */\nexport class Device {\n /** id of the device */\n public readonly deviceId: string;\n\n /** id of the user that owns the device */\n public readonly userId: string;\n\n /** list of algorithms supported by this device */\n public readonly algorithms: string[];\n\n /** a map from `<key type>:<id> -> <base64-encoded key>` */\n public readonly keys: Map<string, string>;\n\n /** whether the device has been verified/blocked by the user */\n public readonly verified: DeviceVerification;\n\n /** a map `<userId, map<algorithm:device_id, signature>>` */\n public readonly signatures: Map<string, Map<string, string>>;\n\n /** display name of the device */\n public readonly displayName?: string;\n\n /** whether the device is a dehydrated device */\n public readonly dehydrated: boolean = false;\n\n public constructor(opts: DeviceParameters) {\n this.deviceId = opts.deviceId;\n this.userId = opts.userId;\n this.algorithms = opts.algorithms;\n this.keys = opts.keys;\n this.verified = opts.verified || DeviceVerification.Unverified;\n this.signatures = opts.signatures || new Map();\n this.displayName = opts.displayName;\n this.dehydrated = !!opts.dehydrated;\n }\n\n /**\n * Get the fingerprint for this device (ie, the Ed25519 key)\n *\n * @returns base64-encoded fingerprint of this device\n */\n public getFingerprint(): string | undefined {\n return this.keys.get(`ed25519:${this.deviceId}`);\n }\n\n /**\n * Get the identity key for this device (ie, the Curve25519 key)\n *\n * @returns base64-encoded identity key of this device\n */\n public getIdentityKey(): string | undefined {\n return this.keys.get(`curve25519:${this.deviceId}`);\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,WAAY,kBAAkB,0BAAlB,kBAAkB;EAAlB,kBAAkB,CAAlB,kBAAkB;EAAlB,kBAAkB,CAAlB,kBAAkB;EAAlB,kBAAkB,CAAlB,kBAAkB;EAAA,OAAlB,kBAAkB;AAAA;;AAM9B;;AAKA;AACA;AACA;AACA,OAAO,MAAM,MAAM,CAAC;EAyBT,WAAW,CAAC,IAAsB,EAAE;IAxB3C;IAAA;IAGA;IAAA;IAGA;IAAA;IAGA;IAAA;IAGA;IAAA;IAGA;IAAA;IAGA;IAAA;IAGA;IAAA,oCACsC,KAAK;IAGvC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ;IAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM;IACzB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU;IACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI;IACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,kBAAkB,CAAC,UAAU;IAC9D,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,GAAG,CAAC,CAAC;IAC9C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW;IACnC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU;EACvC;;EAEA;AACJ;AACA;AACA;AACA;EACW,cAAc,GAAuB;IACxC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,IAAI,CAAC,QAAQ,EAAE,CAAC;EACpD;;EAEA;AACJ;AACA;AACA;AACA;EACW,cAAc,GAAuB;IACxC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,IAAI,CAAC,QAAQ,EAAE,CAAC;EACvD;AACJ","ignoreList":[]}
@@ -30,6 +30,7 @@ export class EventContext {
30
30
  * @param ourEvent - the event at the centre of this context
31
31
  */
32
32
  constructor(ourEvent) {
33
+ _defineProperty(this, "timeline", void 0);
33
34
  _defineProperty(this, "ourEventIndex", 0);
34
35
  _defineProperty(this, "paginateTokens", {
35
36
  [Direction.Backward]: null,
@@ -71,8 +72,7 @@ export class EventContext {
71
72
  *
72
73
  * @param backwards - true to get the pagination token for going
73
74
  */
74
- getPaginateToken() {
75
- var backwards = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
75
+ getPaginateToken(backwards = false) {
76
76
  return this.paginateTokens[backwards ? Direction.Backward : Direction.Forward];
77
77
  }
78
78
 
@@ -85,9 +85,8 @@ export class EventContext {
85
85
  * @param backwards - true to set the pagination token for going
86
86
  * backwards in time
87
87
  */
88
- setPaginateToken(token) {
89
- var backwards = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
90
- this.paginateTokens[backwards ? Direction.Backward : Direction.Forward] = token !== null && token !== void 0 ? token : null;
88
+ setPaginateToken(token, backwards = false) {
89
+ this.paginateTokens[backwards ? Direction.Backward : Direction.Forward] = token ?? null;
91
90
  }
92
91
 
93
92
  /**
@@ -96,8 +95,7 @@ export class EventContext {
96
95
  * @param events - new events, in timeline order
97
96
  * @param atStart - true to insert new events at the start
98
97
  */
99
- addEvents(events) {
100
- var atStart = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
98
+ addEvents(events, atStart = false) {
101
99
  // TODO: should we share logic with Room.addEventsToTimeline?
102
100
  // Should Room even use EventContext?
103
101