@openclaw/matrix 2026.8.1-beta.3 → 2026.8.2

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 (1022) hide show
  1. package/dist/{account-config-BZWN9tGS.js → account-config-CRsKoMqJ.js} +1 -1
  2. package/dist/{account-selection-CWuhuFn1.js → account-selection-DA-jfx22.js} +74 -36
  3. package/dist/{accounts-BCzyubQt.js → accounts-DR1c4xF_.js} +4 -5
  4. package/dist/api.js +5 -5
  5. package/dist/{approval-handler.runtime-CSvueU9P.js → approval-handler.runtime-xcVrZw9o.js} +8 -6
  6. package/dist/{approval-ids-CEcf-EiM.js → approval-ids-hmvhDNBj.js} +1 -1
  7. package/dist/{approval-reaction-auth-CziKXatm.js → approval-reaction-auth-DziFGHSk.js} +2 -2
  8. package/dist/{approval-reactions-tXh9KYrW.js → approval-reactions-1fwEhoK9.js} +1 -1
  9. package/dist/{channel-CzQw5OZN.js → channel-D6-ajB_u.js} +70 -55
  10. package/dist/channel-plugin-api.js +1 -1
  11. package/dist/{channel.runtime-I9pBRQb3.js → channel.runtime-BMA0dG2k.js} +18 -14
  12. package/dist/{channel.setup-aNaa3Uyn.js → channel.setup-OIEzCzSs.js} +28 -21
  13. package/dist/{cli-iR6QJ5U0.js → cli-B6HF7Hmn.js} +43 -33
  14. package/dist/{cli-metadata-BmUYWjuM.js → cli-metadata-Mtzu5-AY.js} +1 -1
  15. package/dist/cli-metadata.js +1 -1
  16. package/dist/{client-D8XghqmX.js → client-B0yMDho1.js} +2 -2
  17. package/dist/{client-BBQdBG7t.js → client-DFsRJEgB.js} +137 -75
  18. package/dist/{client-bootstrap-Co3RlItb.js → client-bootstrap-DjXCKEtg.js} +1 -1
  19. package/dist/{config-update-Bor_Pjsv.js → config-update-BnX26jCO.js} +48 -31
  20. package/dist/contract-api.js +2 -2
  21. package/dist/{credentials-BdAaWuiR.js → credentials-DJj2xs3q.js} +4 -8
  22. package/dist/{credentials-read-B37cQknZ.js → credentials-read-mexhw-Ur.js} +7 -5
  23. package/dist/{credentials-write.runtime-nAV2-5uR.js → credentials-write.runtime-DQt-kgJq.js} +1 -1
  24. package/dist/{crypto-runtime-Bnz3zEcS.js → crypto-runtime-QvlgyCkj.js} +6 -6
  25. package/dist/{deps-CcVJfvRM.js → deps-mtxF2mHI.js} +1 -1
  26. package/dist/{directory-live-DLQzel12.js → directory-live-Drh343TW.js} +8 -6
  27. package/dist/{doctor-EWf9CDso.js → doctor-CJE8wO6y.js} +1 -1
  28. package/dist/{doctor-contract-DEt4O4Zt.js → doctor-contract-HyWFZQVG.js} +5 -4
  29. package/dist/doctor-contract-api.js +7 -7
  30. package/dist/{draft-stream-DQ7QNC-l.js → draft-stream-DhGHVdO4.js} +1 -1
  31. package/dist/{encryption-guidance-DmLY8NiO.js → encryption-guidance-BNcZNQZI.js} +3 -2
  32. package/dist/event-helpers-XRfAbOIh.js +46 -0
  33. package/dist/helper-api.js +1 -1
  34. package/dist/{http-client-CycYxU9-.js → http-client-DOmFvKvB.js} +13 -54
  35. package/dist/{idb-persistence-BM0P27Zg.js → idb-persistence-D4NGNQxt.js} +3 -3
  36. package/dist/{idb-persistence-lock-DAJ49nZX.js → idb-persistence-lock-B3fZXyF_.js} +1 -1
  37. package/dist/{inbound-dedupe-RvSLqdsz.js → inbound-dedupe-Ch33GU06.js} +1 -1
  38. package/dist/index.js +1 -1
  39. package/dist/{messages-DEqg7HVy.js → messages-DlMQaC02.js} +161 -25
  40. package/dist/{monitor-FNrfkuWL.js → monitor-U2LcVtHt.js} +232 -203
  41. package/dist/plugin-entry.handlers.runtime.js +1 -1
  42. package/dist/probe.runtime-CNo-5_iz.js +2 -0
  43. package/dist/{profile-update-BQlE5s2J.js → profile-update-CsyKA9jI.js} +5 -4
  44. package/dist/{profile-D-Wubo0A.js → profile-vmjsmhh4.js} +1 -1
  45. package/dist/{reaction-events-BKOLlnCo.js → reaction-events-lwNc5I1X.js} +10 -8
  46. package/dist/{resolve-targets-e7AI0P75.js → resolve-targets-D3Eakgzs.js} +1 -1
  47. package/dist/{resolver.runtime-V8u0pHEb.js → resolver.runtime-DJQxR35r.js} +1 -1
  48. package/dist/{room-info-BXQA7y10.js → room-info-DIU67XLP.js} +55 -1
  49. package/dist/runtime-api.js +2 -2
  50. package/dist/{sdk-NxK3vzMa.js → sdk-Jl2CgAbJ.js} +573 -47
  51. package/dist/{send-ClHgDZLT.js → send-DfS5ciUL.js} +57 -34
  52. package/dist/session-binding-contract-api.js +1 -1
  53. package/dist/{setup-bootstrap-BGPjbA5N.js → setup-bootstrap-CWoIWudw.js} +3 -3
  54. package/dist/{setup-core-DigrLebY.js → setup-core-CZM496H-.js} +8 -7
  55. package/dist/setup-plugin-api.js +1 -1
  56. package/dist/{setup-surface-Dtn8sAWs.js → setup-surface-DSZtOsWK.js} +84 -79
  57. package/dist/{startup-verification-Cs08ca8u.js → startup-verification-1Ney1mmI.js} +2 -2
  58. package/dist/{storage-BsGuHngK.js → storage-BVf4uucD.js} +5 -4
  59. package/dist/{subagent-hooks-CMoZaARG.js → subagent-hooks-DeICLbU5.js} +5 -1
  60. package/dist/subagent-hooks-api.js +1 -1
  61. package/dist/sync-cache-state-d-A_OhbU.js +234 -0
  62. package/dist/{thread-bindings-BYEGfw3h.js → thread-bindings-2HN2AyLu.js} +4 -4
  63. package/dist/{tool-actions.runtime-ck6IJyP0.js → tool-actions.runtime-CFZZPG5g.js} +267 -213
  64. package/dist/{verification-CabtBTtB.js → verification-CD7k5vE9.js} +2 -2
  65. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/CHANGELOG.md +29 -3
  66. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/README.md +23 -14
  67. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/RELEASING.md +6 -2
  68. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/download-lib.js +33 -14
  69. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/index.d.ts +14 -0
  70. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/package.json +41 -42
  71. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/package.json +1 -1
  72. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm.d.ts +16 -4
  73. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.cjs +25 -9
  74. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.js +23 -7
  75. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm +0 -0
  76. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm.d.ts +1 -0
  77. package/node_modules/markdown-it/README.md +18 -294
  78. package/node_modules/markdown-it/bin/markdown-it.mjs +2 -2
  79. package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs +2972 -0
  80. package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs.map +1 -0
  81. package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js +14 -0
  82. package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js.map +1 -0
  83. package/node_modules/markdown-it/dist/markdown-it.cjs.js +4412 -0
  84. package/node_modules/markdown-it/dist/markdown-it.cjs.js.map +1 -0
  85. package/node_modules/markdown-it/dist/markdown-it.d.cts +19 -0
  86. package/node_modules/markdown-it/dist/markdown-it.d.mts +979 -0
  87. package/node_modules/markdown-it/dist/{index.cjs.js → markdown-it.mjs} +1437 -1466
  88. package/node_modules/markdown-it/dist/markdown-it.mjs.map +1 -0
  89. package/node_modules/markdown-it/node_modules/argparse/README.md +46 -41
  90. package/node_modules/markdown-it/node_modules/argparse/lib/_colorize.js +72 -0
  91. package/node_modules/markdown-it/node_modules/argparse/lib/argparse.d.ts +292 -0
  92. package/node_modules/markdown-it/node_modules/argparse/{argparse.js → lib/argparse.js} +1124 -1027
  93. package/node_modules/markdown-it/node_modules/argparse/lib/difflib.js +190 -0
  94. package/node_modules/markdown-it/node_modules/argparse/lib/sub.js +4 -4
  95. package/node_modules/markdown-it/node_modules/argparse/lib/textwrap.js +28 -28
  96. package/node_modules/markdown-it/node_modules/argparse/package.json +17 -10
  97. package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.d.ts +8 -0
  98. package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.d.ts.map +1 -0
  99. package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.js +46 -0
  100. package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.js.map +1 -0
  101. package/node_modules/markdown-it/node_modules/entities/{lib/esm → dist}/decode.d.ts +28 -45
  102. package/node_modules/markdown-it/node_modules/entities/dist/decode.d.ts.map +1 -0
  103. package/node_modules/markdown-it/node_modules/entities/{lib/esm → dist}/decode.js +189 -141
  104. package/node_modules/markdown-it/node_modules/entities/dist/decode.js.map +1 -0
  105. package/node_modules/markdown-it/node_modules/entities/{lib/esm → dist}/encode.d.ts +4 -2
  106. package/node_modules/markdown-it/node_modules/entities/dist/encode.d.ts.map +1 -0
  107. package/node_modules/markdown-it/node_modules/entities/dist/encode.js +90 -0
  108. package/node_modules/markdown-it/node_modules/entities/dist/encode.js.map +1 -0
  109. package/node_modules/markdown-it/node_modules/entities/{lib → dist}/escape.d.ts +15 -10
  110. package/node_modules/markdown-it/node_modules/entities/dist/escape.d.ts.map +1 -0
  111. package/node_modules/markdown-it/node_modules/entities/dist/escape.js +132 -0
  112. package/node_modules/markdown-it/node_modules/entities/dist/escape.js.map +1 -0
  113. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.d.ts +3 -0
  114. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.d.ts.map +1 -0
  115. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.js +5 -0
  116. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.js.map +1 -0
  117. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.d.ts +3 -0
  118. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.d.ts.map +1 -0
  119. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.js +5 -0
  120. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.js.map +1 -0
  121. package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.d.ts +5 -0
  122. package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.d.ts.map +1 -0
  123. package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.js +12 -0
  124. package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.js.map +1 -0
  125. package/node_modules/markdown-it/node_modules/entities/{lib → dist}/index.d.ts +14 -21
  126. package/node_modules/markdown-it/node_modules/entities/dist/index.d.ts.map +1 -0
  127. package/node_modules/markdown-it/node_modules/entities/dist/index.js +91 -0
  128. package/node_modules/markdown-it/node_modules/entities/dist/index.js.map +1 -0
  129. package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.d.ts +17 -0
  130. package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.d.ts.map +1 -0
  131. package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.js +18 -0
  132. package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.js.map +1 -0
  133. package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.d.ts +7 -0
  134. package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.d.ts.map +1 -0
  135. package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.js +17 -0
  136. package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.js.map +1 -0
  137. package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.d.ts +33 -0
  138. package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.d.ts.map +1 -0
  139. package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.js +93 -0
  140. package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.js.map +1 -0
  141. package/node_modules/markdown-it/node_modules/entities/package.json +63 -70
  142. package/node_modules/markdown-it/node_modules/entities/readme.md +54 -45
  143. package/node_modules/markdown-it/node_modules/entities/src/decode-codepoint.ts +50 -0
  144. package/node_modules/markdown-it/node_modules/entities/src/decode.ts +671 -0
  145. package/node_modules/markdown-it/node_modules/entities/src/encode.ts +95 -0
  146. package/node_modules/markdown-it/node_modules/entities/src/escape.ts +160 -0
  147. package/node_modules/markdown-it/node_modules/entities/src/generated/decode-data-html.ts +7 -0
  148. package/node_modules/markdown-it/node_modules/entities/src/generated/decode-data-xml.ts +7 -0
  149. package/node_modules/markdown-it/node_modules/entities/src/generated/encode-html.ts +18 -0
  150. package/node_modules/markdown-it/node_modules/entities/src/index.ts +162 -0
  151. package/node_modules/markdown-it/node_modules/entities/src/internal/bin-trie-flags.ts +16 -0
  152. package/node_modules/markdown-it/node_modules/entities/src/internal/decode-shared.ts +18 -0
  153. package/node_modules/markdown-it/node_modules/entities/src/internal/encode-shared.ts +123 -0
  154. package/node_modules/markdown-it/node_modules/linkify-it/README.md +49 -86
  155. package/node_modules/markdown-it/node_modules/linkify-it/build/index.cjs.js +636 -825
  156. package/node_modules/markdown-it/node_modules/linkify-it/build/index.cjs.js.map +1 -0
  157. package/node_modules/markdown-it/node_modules/linkify-it/build/index.d.ts +236 -0
  158. package/node_modules/markdown-it/node_modules/linkify-it/build/index.mjs +538 -0
  159. package/node_modules/markdown-it/node_modules/linkify-it/build/index.mjs.map +1 -0
  160. package/node_modules/markdown-it/node_modules/linkify-it/package.json +23 -20
  161. package/node_modules/markdown-it/node_modules/uc.micro/README.md +18 -1
  162. package/node_modules/markdown-it/node_modules/uc.micro/build/index.cjs.js +13 -18
  163. package/node_modules/markdown-it/node_modules/uc.micro/build/index.d.ts +6 -0
  164. package/node_modules/markdown-it/node_modules/uc.micro/build/index.mjs +8 -0
  165. package/node_modules/markdown-it/node_modules/uc.micro/package.json +12 -17
  166. package/node_modules/markdown-it/package.json +48 -30
  167. package/node_modules/matrix-js-sdk/CHANGELOG.md +33 -0
  168. package/node_modules/matrix-js-sdk/lib/@types/PushRules.d.ts.map +1 -1
  169. package/node_modules/matrix-js-sdk/lib/@types/PushRules.js +0 -5
  170. package/node_modules/matrix-js-sdk/lib/@types/PushRules.js.map +1 -1
  171. package/node_modules/matrix-js-sdk/lib/@types/auth.d.ts +0 -5
  172. package/node_modules/matrix-js-sdk/lib/@types/auth.d.ts.map +1 -1
  173. package/node_modules/matrix-js-sdk/lib/@types/auth.js +0 -11
  174. package/node_modules/matrix-js-sdk/lib/@types/auth.js.map +1 -1
  175. package/node_modules/matrix-js-sdk/lib/@types/beacon.d.ts +1 -1
  176. package/node_modules/matrix-js-sdk/lib/@types/beacon.js +1 -1
  177. package/node_modules/matrix-js-sdk/lib/@types/beacon.js.map +1 -1
  178. package/node_modules/matrix-js-sdk/lib/@types/crypto.d.ts.map +1 -1
  179. package/node_modules/matrix-js-sdk/lib/@types/crypto.js.map +1 -1
  180. package/node_modules/matrix-js-sdk/lib/@types/event.d.ts +3 -1
  181. package/node_modules/matrix-js-sdk/lib/@types/event.d.ts.map +1 -1
  182. package/node_modules/matrix-js-sdk/lib/@types/event.js +1 -0
  183. package/node_modules/matrix-js-sdk/lib/@types/event.js.map +1 -1
  184. package/node_modules/matrix-js-sdk/lib/@types/extensible_events.d.ts.map +1 -1
  185. package/node_modules/matrix-js-sdk/lib/@types/extensible_events.js.map +1 -1
  186. package/node_modules/matrix-js-sdk/lib/@types/matrix-sdk-crypto-wasm.d.js.map +1 -1
  187. package/node_modules/matrix-js-sdk/lib/@types/media.js.map +1 -1
  188. package/node_modules/matrix-js-sdk/lib/@types/partials.d.ts.map +1 -1
  189. package/node_modules/matrix-js-sdk/lib/@types/partials.js.map +1 -1
  190. package/node_modules/matrix-js-sdk/lib/@types/requests.d.ts.map +1 -1
  191. package/node_modules/matrix-js-sdk/lib/@types/requests.js +0 -5
  192. package/node_modules/matrix-js-sdk/lib/@types/requests.js.map +1 -1
  193. package/node_modules/matrix-js-sdk/lib/@types/search.d.ts.map +1 -1
  194. package/node_modules/matrix-js-sdk/lib/@types/search.js +0 -3
  195. package/node_modules/matrix-js-sdk/lib/@types/search.js.map +1 -1
  196. package/node_modules/matrix-js-sdk/lib/@types/spaces.d.ts.map +1 -1
  197. package/node_modules/matrix-js-sdk/lib/@types/spaces.js.map +1 -1
  198. package/node_modules/matrix-js-sdk/lib/@types/synapse.d.ts.map +1 -1
  199. package/node_modules/matrix-js-sdk/lib/@types/synapse.js.map +1 -1
  200. package/node_modules/matrix-js-sdk/lib/@types/threepids.js.map +1 -1
  201. package/node_modules/matrix-js-sdk/lib/@types/type-guards.d.ts +43 -0
  202. package/node_modules/matrix-js-sdk/lib/@types/type-guards.d.ts.map +1 -0
  203. package/node_modules/matrix-js-sdk/lib/@types/type-guards.js +104 -0
  204. package/node_modules/matrix-js-sdk/lib/@types/type-guards.js.map +1 -0
  205. package/node_modules/matrix-js-sdk/lib/NamespacedValue.d.ts.map +1 -1
  206. package/node_modules/matrix-js-sdk/lib/ReEmitter.d.ts.map +1 -1
  207. package/node_modules/matrix-js-sdk/lib/ToDeviceMessageQueue.d.ts.map +1 -1
  208. package/node_modules/matrix-js-sdk/lib/ToDeviceMessageQueue.js +0 -2
  209. package/node_modules/matrix-js-sdk/lib/ToDeviceMessageQueue.js.map +1 -1
  210. package/node_modules/matrix-js-sdk/lib/autodiscovery.d.ts.map +1 -1
  211. package/node_modules/matrix-js-sdk/lib/autodiscovery.js.map +1 -1
  212. package/node_modules/matrix-js-sdk/lib/browser-index.d.ts.map +1 -1
  213. package/node_modules/matrix-js-sdk/lib/browser-index.js +3 -1
  214. package/node_modules/matrix-js-sdk/lib/browser-index.js.map +1 -1
  215. package/node_modules/matrix-js-sdk/lib/capabilityPoller.d.ts.map +1 -1
  216. package/node_modules/matrix-js-sdk/lib/client.d.ts +23 -21
  217. package/node_modules/matrix-js-sdk/lib/client.d.ts.map +1 -1
  218. package/node_modules/matrix-js-sdk/lib/client.js +44 -96
  219. package/node_modules/matrix-js-sdk/lib/client.js.map +1 -1
  220. package/node_modules/matrix-js-sdk/lib/common-crypto/CryptoBackend.d.ts.map +1 -1
  221. package/node_modules/matrix-js-sdk/lib/common-crypto/key-passphrase.d.ts.map +1 -1
  222. package/node_modules/matrix-js-sdk/lib/common-crypto/key-passphrase.js +1 -4
  223. package/node_modules/matrix-js-sdk/lib/common-crypto/key-passphrase.js.map +1 -1
  224. package/node_modules/matrix-js-sdk/lib/content-helpers.d.ts.map +1 -1
  225. package/node_modules/matrix-js-sdk/lib/crypto/store/base.d.ts.map +1 -1
  226. package/node_modules/matrix-js-sdk/lib/crypto/store/base.js +0 -9
  227. package/node_modules/matrix-js-sdk/lib/crypto/store/base.js.map +1 -1
  228. package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store-backend.d.ts.map +1 -1
  229. package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store-backend.js +2 -1
  230. package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store-backend.js.map +1 -1
  231. package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store.d.ts.map +1 -1
  232. package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store.js +1 -1
  233. package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store.js.map +1 -1
  234. package/node_modules/matrix-js-sdk/lib/crypto/store/localStorage-crypto-store.d.ts.map +1 -1
  235. package/node_modules/matrix-js-sdk/lib/crypto/store/localStorage-crypto-store.js +0 -2
  236. package/node_modules/matrix-js-sdk/lib/crypto/store/localStorage-crypto-store.js.map +1 -1
  237. package/node_modules/matrix-js-sdk/lib/crypto/store/memory-crypto-store.d.ts.map +1 -1
  238. package/node_modules/matrix-js-sdk/lib/crypto/store/memory-crypto-store.js.map +1 -1
  239. package/node_modules/matrix-js-sdk/lib/crypto-api/index.d.ts +1 -1
  240. package/node_modules/matrix-js-sdk/lib/crypto-api/index.d.ts.map +1 -1
  241. package/node_modules/matrix-js-sdk/lib/crypto-api/index.js.map +1 -1
  242. package/node_modules/matrix-js-sdk/lib/crypto-api/keybackup.d.ts +13 -6
  243. package/node_modules/matrix-js-sdk/lib/crypto-api/keybackup.d.ts.map +1 -1
  244. package/node_modules/matrix-js-sdk/lib/crypto-api/keybackup.js.map +1 -1
  245. package/node_modules/matrix-js-sdk/lib/crypto-api/verification.d.ts +23 -5
  246. package/node_modules/matrix-js-sdk/lib/crypto-api/verification.d.ts.map +1 -1
  247. package/node_modules/matrix-js-sdk/lib/crypto-api/verification.js.map +1 -1
  248. package/node_modules/matrix-js-sdk/lib/embedded.d.ts +16 -0
  249. package/node_modules/matrix-js-sdk/lib/embedded.d.ts.map +1 -1
  250. package/node_modules/matrix-js-sdk/lib/embedded.js +19 -11
  251. package/node_modules/matrix-js-sdk/lib/embedded.js.map +1 -1
  252. package/node_modules/matrix-js-sdk/lib/errors.d.ts.map +1 -1
  253. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/ExtensibleEvent.d.ts.map +1 -1
  254. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/InvalidEventError.d.ts.map +1 -1
  255. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/MessageEvent.d.ts.map +1 -1
  256. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollEndEvent.d.ts.map +1 -1
  257. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollResponseEvent.d.ts.map +1 -1
  258. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollStartEvent.d.ts.map +1 -1
  259. package/node_modules/matrix-js-sdk/lib/feature.d.ts.map +1 -1
  260. package/node_modules/matrix-js-sdk/lib/feature.js +0 -3
  261. package/node_modules/matrix-js-sdk/lib/feature.js.map +1 -1
  262. package/node_modules/matrix-js-sdk/lib/filter-component.d.ts.map +1 -1
  263. package/node_modules/matrix-js-sdk/lib/filter-component.js +2 -5
  264. package/node_modules/matrix-js-sdk/lib/filter-component.js.map +1 -1
  265. package/node_modules/matrix-js-sdk/lib/filter.d.ts.map +1 -1
  266. package/node_modules/matrix-js-sdk/lib/filter.js +0 -4
  267. package/node_modules/matrix-js-sdk/lib/filter.js.map +1 -1
  268. package/node_modules/matrix-js-sdk/lib/http-api/errors.d.ts.map +1 -1
  269. package/node_modules/matrix-js-sdk/lib/http-api/fetch.d.ts +1 -1
  270. package/node_modules/matrix-js-sdk/lib/http-api/fetch.d.ts.map +1 -1
  271. package/node_modules/matrix-js-sdk/lib/http-api/fetch.js.map +1 -1
  272. package/node_modules/matrix-js-sdk/lib/http-api/index.d.ts +1 -7
  273. package/node_modules/matrix-js-sdk/lib/http-api/index.d.ts.map +1 -1
  274. package/node_modules/matrix-js-sdk/lib/http-api/index.js +0 -15
  275. package/node_modules/matrix-js-sdk/lib/http-api/index.js.map +1 -1
  276. package/node_modules/matrix-js-sdk/lib/http-api/interface.d.ts +0 -9
  277. package/node_modules/matrix-js-sdk/lib/http-api/interface.d.ts.map +1 -1
  278. package/node_modules/matrix-js-sdk/lib/http-api/interface.js +0 -2
  279. package/node_modules/matrix-js-sdk/lib/http-api/interface.js.map +1 -1
  280. package/node_modules/matrix-js-sdk/lib/http-api/refresh.d.ts.map +1 -1
  281. package/node_modules/matrix-js-sdk/lib/http-api/refresh.js +0 -3
  282. package/node_modules/matrix-js-sdk/lib/http-api/refresh.js.map +1 -1
  283. package/node_modules/matrix-js-sdk/lib/index.d.ts.map +1 -1
  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 +5 -6
  286. package/node_modules/matrix-js-sdk/lib/interactive-auth.js.map +1 -1
  287. package/node_modules/matrix-js-sdk/lib/logger.d.ts.map +1 -1
  288. package/node_modules/matrix-js-sdk/lib/logger.js +0 -2
  289. package/node_modules/matrix-js-sdk/lib/logger.js.map +1 -1
  290. package/node_modules/matrix-js-sdk/lib/matrix.d.ts +1 -1
  291. package/node_modules/matrix-js-sdk/lib/matrix.d.ts.map +1 -1
  292. package/node_modules/matrix-js-sdk/lib/matrix.js +1 -1
  293. package/node_modules/matrix-js-sdk/lib/matrix.js.map +1 -1
  294. package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.d.ts +3 -3
  295. package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.d.ts.map +1 -1
  296. package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.js +5 -5
  297. package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.js.map +1 -1
  298. package/node_modules/matrix-js-sdk/lib/matrixrtc/LivekitTransport.d.ts.map +1 -1
  299. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.d.ts +18 -1
  300. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.d.ts.map +1 -1
  301. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.js +56 -4
  302. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.js.map +1 -1
  303. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.d.ts +14 -1
  304. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.d.ts.map +1 -1
  305. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.js +20 -1
  306. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.js.map +1 -1
  307. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.d.ts.map +1 -1
  308. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.js +9 -6
  309. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.js.map +1 -1
  310. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManagerActionScheduler.d.ts.map +1 -1
  311. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManagerActionScheduler.js.map +1 -1
  312. package/node_modules/matrix-js-sdk/lib/matrixrtc/RTCEncryptionManager.d.ts.map +1 -1
  313. package/node_modules/matrix-js-sdk/lib/matrixrtc/RTCEncryptionManager.js.map +1 -1
  314. package/node_modules/matrix-js-sdk/lib/matrixrtc/ToDeviceKeyTransport.d.ts.map +1 -1
  315. package/node_modules/matrix-js-sdk/lib/matrixrtc/ToDeviceKeyTransport.js.map +1 -1
  316. package/node_modules/matrix-js-sdk/lib/matrixrtc/index.d.ts +1 -1
  317. package/node_modules/matrix-js-sdk/lib/matrixrtc/index.d.ts.map +1 -1
  318. package/node_modules/matrix-js-sdk/lib/matrixrtc/index.js +1 -1
  319. package/node_modules/matrix-js-sdk/lib/matrixrtc/index.js.map +1 -1
  320. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/common.d.ts.map +1 -1
  321. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.d.ts +6 -3
  322. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.d.ts.map +1 -1
  323. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.js +7 -4
  324. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.js.map +1 -1
  325. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/session.d.ts.map +1 -1
  326. package/node_modules/matrix-js-sdk/lib/matrixrtc/types.d.ts +19 -6
  327. package/node_modules/matrix-js-sdk/lib/matrixrtc/types.d.ts.map +1 -1
  328. package/node_modules/matrix-js-sdk/lib/matrixrtc/types.js +11 -1
  329. package/node_modules/matrix-js-sdk/lib/matrixrtc/types.js.map +1 -1
  330. package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.d.ts +0 -1
  331. package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.d.ts.map +1 -1
  332. package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.js +0 -1
  333. package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.js.map +1 -1
  334. package/node_modules/matrix-js-sdk/lib/models/MSC3089Branch.d.ts.map +1 -1
  335. package/node_modules/matrix-js-sdk/lib/models/MSC3089TreeSpace.d.ts.map +1 -1
  336. package/node_modules/matrix-js-sdk/lib/models/beacon.d.ts.map +1 -1
  337. package/node_modules/matrix-js-sdk/lib/models/device.d.ts.map +1 -1
  338. package/node_modules/matrix-js-sdk/lib/models/event-context.d.ts.map +1 -1
  339. package/node_modules/matrix-js-sdk/lib/models/event-timeline-set.d.ts.map +1 -1
  340. package/node_modules/matrix-js-sdk/lib/models/event-timeline-set.js +3 -3
  341. package/node_modules/matrix-js-sdk/lib/models/event-timeline-set.js.map +1 -1
  342. package/node_modules/matrix-js-sdk/lib/models/event-timeline.d.ts.map +1 -1
  343. package/node_modules/matrix-js-sdk/lib/models/event.d.ts.map +1 -1
  344. package/node_modules/matrix-js-sdk/lib/models/event.js +0 -6
  345. package/node_modules/matrix-js-sdk/lib/models/event.js.map +1 -1
  346. package/node_modules/matrix-js-sdk/lib/models/invites-ignorer.d.ts.map +1 -1
  347. package/node_modules/matrix-js-sdk/lib/models/invites-ignorer.js.map +1 -1
  348. package/node_modules/matrix-js-sdk/lib/models/poll.d.ts.map +1 -1
  349. package/node_modules/matrix-js-sdk/lib/models/poll.js.map +1 -1
  350. package/node_modules/matrix-js-sdk/lib/models/read-receipt.d.ts.map +1 -1
  351. package/node_modules/matrix-js-sdk/lib/models/read-receipt.js.map +1 -1
  352. package/node_modules/matrix-js-sdk/lib/models/related-relations.d.ts.map +1 -1
  353. package/node_modules/matrix-js-sdk/lib/models/relations-container.d.ts +10 -0
  354. package/node_modules/matrix-js-sdk/lib/models/relations-container.d.ts.map +1 -1
  355. package/node_modules/matrix-js-sdk/lib/models/relations-container.js +39 -17
  356. package/node_modules/matrix-js-sdk/lib/models/relations-container.js.map +1 -1
  357. package/node_modules/matrix-js-sdk/lib/models/relations.d.ts.map +1 -1
  358. package/node_modules/matrix-js-sdk/lib/models/relations.js +1 -1
  359. package/node_modules/matrix-js-sdk/lib/models/relations.js.map +1 -1
  360. package/node_modules/matrix-js-sdk/lib/models/room-member.d.ts.map +1 -1
  361. package/node_modules/matrix-js-sdk/lib/models/room-receipts.d.ts.map +1 -1
  362. package/node_modules/matrix-js-sdk/lib/models/room-retention.d.ts.map +1 -1
  363. package/node_modules/matrix-js-sdk/lib/models/room-state.d.ts.map +1 -1
  364. package/node_modules/matrix-js-sdk/lib/models/room-state.js.map +1 -1
  365. package/node_modules/matrix-js-sdk/lib/models/room-sticky-events.d.ts.map +1 -1
  366. package/node_modules/matrix-js-sdk/lib/models/room-summary.d.ts.map +1 -1
  367. package/node_modules/matrix-js-sdk/lib/models/room.d.ts.map +1 -1
  368. package/node_modules/matrix-js-sdk/lib/models/room.js +9 -9
  369. package/node_modules/matrix-js-sdk/lib/models/room.js.map +1 -1
  370. package/node_modules/matrix-js-sdk/lib/models/search-result.d.ts.map +1 -1
  371. package/node_modules/matrix-js-sdk/lib/models/thread.d.ts +5 -2
  372. package/node_modules/matrix-js-sdk/lib/models/thread.d.ts.map +1 -1
  373. package/node_modules/matrix-js-sdk/lib/models/thread.js +36 -3
  374. package/node_modules/matrix-js-sdk/lib/models/thread.js.map +1 -1
  375. package/node_modules/matrix-js-sdk/lib/models/typed-event-emitter.d.ts.map +1 -1
  376. package/node_modules/matrix-js-sdk/lib/models/user.d.ts.map +1 -1
  377. package/node_modules/matrix-js-sdk/lib/oauth/authorize.d.ts +133 -0
  378. package/node_modules/matrix-js-sdk/lib/oauth/authorize.d.ts.map +1 -0
  379. package/node_modules/matrix-js-sdk/lib/oauth/authorize.js +193 -0
  380. package/node_modules/matrix-js-sdk/lib/oauth/authorize.js.map +1 -0
  381. package/node_modules/matrix-js-sdk/lib/oauth/discover.d.ts +58 -0
  382. package/node_modules/matrix-js-sdk/lib/oauth/discover.d.ts.map +1 -0
  383. package/node_modules/matrix-js-sdk/lib/oauth/discover.js +35 -0
  384. package/node_modules/matrix-js-sdk/lib/oauth/discover.js.map +1 -0
  385. package/node_modules/matrix-js-sdk/lib/oauth/error.d.ts +19 -0
  386. package/node_modules/matrix-js-sdk/lib/oauth/error.d.ts.map +1 -0
  387. package/node_modules/matrix-js-sdk/lib/oauth/error.js +36 -0
  388. package/node_modules/matrix-js-sdk/lib/oauth/error.js.map +1 -0
  389. package/node_modules/matrix-js-sdk/lib/oauth/index.d.ts +87 -0
  390. package/node_modules/matrix-js-sdk/lib/oauth/index.d.ts.map +1 -0
  391. package/node_modules/matrix-js-sdk/lib/oauth/index.js +236 -0
  392. package/node_modules/matrix-js-sdk/lib/oauth/index.js.map +1 -0
  393. package/node_modules/matrix-js-sdk/lib/oauth/register.d.ts +136 -0
  394. package/node_modules/matrix-js-sdk/lib/oauth/register.d.ts.map +1 -0
  395. package/node_modules/matrix-js-sdk/lib/oauth/register.js +73 -0
  396. package/node_modules/matrix-js-sdk/lib/oauth/register.js.map +1 -0
  397. package/node_modules/matrix-js-sdk/lib/oauth/tokenRefresher.d.ts +21 -0
  398. package/node_modules/matrix-js-sdk/lib/oauth/tokenRefresher.d.ts.map +1 -0
  399. package/node_modules/matrix-js-sdk/lib/oauth/tokenRefresher.js +68 -0
  400. package/node_modules/matrix-js-sdk/lib/oauth/tokenRefresher.js.map +1 -0
  401. package/node_modules/matrix-js-sdk/lib/pollingCachedValue.d.ts +77 -0
  402. package/node_modules/matrix-js-sdk/lib/pollingCachedValue.d.ts.map +1 -0
  403. package/node_modules/matrix-js-sdk/lib/pollingCachedValue.js +160 -0
  404. package/node_modules/matrix-js-sdk/lib/pollingCachedValue.js.map +1 -0
  405. package/node_modules/matrix-js-sdk/lib/pushprocessor.d.ts.map +1 -1
  406. package/node_modules/matrix-js-sdk/lib/pushprocessor.js.map +1 -1
  407. package/node_modules/matrix-js-sdk/lib/realtime-callbacks.js +0 -1
  408. package/node_modules/matrix-js-sdk/lib/realtime-callbacks.js.map +1 -1
  409. package/node_modules/matrix-js-sdk/lib/receipt-accumulator.d.ts.map +1 -1
  410. package/node_modules/matrix-js-sdk/lib/receipt-accumulator.js.map +1 -1
  411. package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.d.ts +7 -7
  412. package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.d.ts.map +1 -1
  413. package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.js +13 -14
  414. package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.js.map +1 -1
  415. package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousError.d.ts.map +1 -1
  416. package/node_modules/matrix-js-sdk/lib/rendezvous/channels/MSC4108SecureChannel.d.ts.map +1 -1
  417. package/node_modules/matrix-js-sdk/lib/rendezvous/index.d.ts.map +1 -1
  418. package/node_modules/matrix-js-sdk/lib/rendezvous/index.js.map +1 -1
  419. package/node_modules/matrix-js-sdk/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts.map +1 -1
  420. package/node_modules/matrix-js-sdk/lib/rendezvous/transports/MSC4108RendezvousSession.js +0 -1
  421. package/node_modules/matrix-js-sdk/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +1 -1
  422. package/node_modules/matrix-js-sdk/lib/retentionPolicy.d.ts.map +1 -1
  423. package/node_modules/matrix-js-sdk/lib/room-hierarchy.d.ts.map +1 -1
  424. package/node_modules/matrix-js-sdk/lib/rtcTransportsCachedValue.d.ts +9 -0
  425. package/node_modules/matrix-js-sdk/lib/rtcTransportsCachedValue.d.ts.map +1 -0
  426. package/node_modules/matrix-js-sdk/lib/rtcTransportsCachedValue.js +38 -0
  427. package/node_modules/matrix-js-sdk/lib/rtcTransportsCachedValue.js.map +1 -0
  428. package/node_modules/matrix-js-sdk/lib/rust-crypto/CrossSigningIdentity.d.ts.map +1 -1
  429. package/node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.d.ts.map +1 -1
  430. package/node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.js +11 -13
  431. package/node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.js.map +1 -1
  432. package/node_modules/matrix-js-sdk/lib/rust-crypto/KeyClaimManager.d.ts.map +1 -1
  433. package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.d.ts.map +1 -1
  434. package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.js +0 -2
  435. package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.js.map +1 -1
  436. package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestsManager.d.ts.map +1 -1
  437. package/node_modules/matrix-js-sdk/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts.map +1 -1
  438. package/node_modules/matrix-js-sdk/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +1 -1
  439. package/node_modules/matrix-js-sdk/lib/rust-crypto/RoomEncryptor.d.ts.map +1 -1
  440. package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.d.ts +23 -4
  441. package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.d.ts.map +1 -1
  442. package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.js +62 -21
  443. package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.js.map +1 -1
  444. package/node_modules/matrix-js-sdk/lib/rust-crypto/device-converter.d.ts.map +1 -1
  445. package/node_modules/matrix-js-sdk/lib/rust-crypto/device-converter.js +1 -0
  446. package/node_modules/matrix-js-sdk/lib/rust-crypto/device-converter.js.map +1 -1
  447. package/node_modules/matrix-js-sdk/lib/rust-crypto/index.d.ts +17 -4
  448. package/node_modules/matrix-js-sdk/lib/rust-crypto/index.d.ts.map +1 -1
  449. package/node_modules/matrix-js-sdk/lib/rust-crypto/index.js +21 -4
  450. package/node_modules/matrix-js-sdk/lib/rust-crypto/index.js.map +1 -1
  451. package/node_modules/matrix-js-sdk/lib/rust-crypto/libolm_migration.d.ts.map +1 -1
  452. package/node_modules/matrix-js-sdk/lib/rust-crypto/libolm_migration.js +0 -2
  453. package/node_modules/matrix-js-sdk/lib/rust-crypto/libolm_migration.js.map +1 -1
  454. package/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.d.ts.map +1 -1
  455. package/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.js +0 -3
  456. package/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.js.map +1 -1
  457. package/node_modules/matrix-js-sdk/lib/rust-crypto/verification.d.ts.map +1 -1
  458. package/node_modules/matrix-js-sdk/lib/scheduler.d.ts.map +1 -1
  459. package/node_modules/matrix-js-sdk/lib/scheduler.js +0 -3
  460. package/node_modules/matrix-js-sdk/lib/scheduler.js.map +1 -1
  461. package/node_modules/matrix-js-sdk/lib/secret-storage.d.ts.map +1 -1
  462. package/node_modules/matrix-js-sdk/lib/serverCapabilities.d.ts.map +1 -1
  463. package/node_modules/matrix-js-sdk/lib/sliding-sync-sdk.d.ts.map +1 -1
  464. package/node_modules/matrix-js-sdk/lib/sliding-sync-sdk.js +6 -0
  465. package/node_modules/matrix-js-sdk/lib/sliding-sync-sdk.js.map +1 -1
  466. package/node_modules/matrix-js-sdk/lib/sliding-sync.d.ts.map +1 -1
  467. package/node_modules/matrix-js-sdk/lib/sliding-sync.js +3 -0
  468. package/node_modules/matrix-js-sdk/lib/sliding-sync.js.map +1 -1
  469. package/node_modules/matrix-js-sdk/lib/store/indexeddb-local-backend.d.ts.map +1 -1
  470. package/node_modules/matrix-js-sdk/lib/store/indexeddb-local-backend.js +1 -1
  471. package/node_modules/matrix-js-sdk/lib/store/indexeddb-local-backend.js.map +1 -1
  472. package/node_modules/matrix-js-sdk/lib/store/indexeddb-remote-backend.d.ts.map +1 -1
  473. package/node_modules/matrix-js-sdk/lib/store/indexeddb-store-worker.d.ts.map +1 -1
  474. package/node_modules/matrix-js-sdk/lib/store/indexeddb-store-worker.js +1 -0
  475. package/node_modules/matrix-js-sdk/lib/store/indexeddb-store-worker.js.map +1 -1
  476. package/node_modules/matrix-js-sdk/lib/store/indexeddb.d.ts.map +1 -1
  477. package/node_modules/matrix-js-sdk/lib/store/indexeddb.js +0 -2
  478. package/node_modules/matrix-js-sdk/lib/store/indexeddb.js.map +1 -1
  479. package/node_modules/matrix-js-sdk/lib/store/memory.d.ts.map +1 -1
  480. package/node_modules/matrix-js-sdk/lib/store/memory.js +7 -9
  481. package/node_modules/matrix-js-sdk/lib/store/memory.js.map +1 -1
  482. package/node_modules/matrix-js-sdk/lib/store/stub.d.ts.map +1 -1
  483. package/node_modules/matrix-js-sdk/lib/sync-accumulator.d.ts.map +1 -1
  484. package/node_modules/matrix-js-sdk/lib/sync-accumulator.js +1 -5
  485. package/node_modules/matrix-js-sdk/lib/sync-accumulator.js.map +1 -1
  486. package/node_modules/matrix-js-sdk/lib/sync.d.ts.map +1 -1
  487. package/node_modules/matrix-js-sdk/lib/sync.js +9 -9
  488. package/node_modules/matrix-js-sdk/lib/sync.js.map +1 -1
  489. package/node_modules/matrix-js-sdk/lib/testing.d.ts +2 -10
  490. package/node_modules/matrix-js-sdk/lib/testing.d.ts.map +1 -1
  491. package/node_modules/matrix-js-sdk/lib/testing.js +4 -19
  492. package/node_modules/matrix-js-sdk/lib/testing.js.map +1 -1
  493. package/node_modules/matrix-js-sdk/lib/timeline-window.d.ts.map +1 -1
  494. package/node_modules/matrix-js-sdk/lib/timeline-window.js +0 -1
  495. package/node_modules/matrix-js-sdk/lib/timeline-window.js.map +1 -1
  496. package/node_modules/matrix-js-sdk/lib/utils/internal/deriveKeys.d.ts.map +1 -1
  497. package/node_modules/matrix-js-sdk/lib/utils/internal/deriveKeys.js +0 -1
  498. package/node_modules/matrix-js-sdk/lib/utils/internal/deriveKeys.js.map +1 -1
  499. package/node_modules/matrix-js-sdk/lib/utils.d.ts +1 -1
  500. package/node_modules/matrix-js-sdk/lib/utils.d.ts.map +1 -1
  501. package/node_modules/matrix-js-sdk/lib/utils.js +1 -0
  502. package/node_modules/matrix-js-sdk/lib/utils.js.map +1 -1
  503. package/node_modules/matrix-js-sdk/lib/webrtc/call.d.ts.map +1 -1
  504. package/node_modules/matrix-js-sdk/lib/webrtc/call.js.map +1 -1
  505. package/node_modules/matrix-js-sdk/lib/webrtc/callEventHandler.d.ts.map +1 -1
  506. package/node_modules/matrix-js-sdk/lib/webrtc/callEventTypes.d.ts.map +1 -1
  507. package/node_modules/matrix-js-sdk/lib/webrtc/callEventTypes.js +0 -5
  508. package/node_modules/matrix-js-sdk/lib/webrtc/callEventTypes.js.map +1 -1
  509. package/node_modules/matrix-js-sdk/lib/webrtc/callFeed.d.ts.map +1 -1
  510. package/node_modules/matrix-js-sdk/lib/webrtc/groupCall.d.ts.map +1 -1
  511. package/node_modules/matrix-js-sdk/lib/webrtc/groupCall.js.map +1 -1
  512. package/node_modules/matrix-js-sdk/lib/webrtc/groupCallEventHandler.d.ts.map +1 -1
  513. package/node_modules/matrix-js-sdk/lib/webrtc/mediaHandler.d.ts.map +1 -1
  514. package/node_modules/matrix-js-sdk/lib/webrtc/mediaHandler.js.map +1 -1
  515. package/node_modules/matrix-js-sdk/lib/webrtc/stats/callFeedStatsReporter.d.ts.map +1 -1
  516. package/node_modules/matrix-js-sdk/lib/webrtc/stats/callStatsReportGatherer.d.ts.map +1 -1
  517. package/node_modules/matrix-js-sdk/lib/webrtc/stats/callStatsReportGatherer.js.map +1 -1
  518. package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStatsBuilder.d.ts.map +1 -1
  519. package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStatsReportBuilder.d.ts.map +1 -1
  520. package/node_modules/matrix-js-sdk/lib/webrtc/stats/groupCallStats.d.ts.map +1 -1
  521. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaSsrcHandler.d.ts.map +1 -1
  522. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackHandler.d.ts.map +1 -1
  523. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackStats.d.ts.map +1 -1
  524. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts.map +1 -1
  525. package/node_modules/matrix-js-sdk/lib/webrtc/stats/statsReportEmitter.d.ts.map +1 -1
  526. package/node_modules/matrix-js-sdk/lib/webrtc/stats/summaryStatsReportGatherer.d.ts.map +1 -1
  527. package/node_modules/matrix-js-sdk/lib/webrtc/stats/trackStatsBuilder.d.ts.map +1 -1
  528. package/node_modules/matrix-js-sdk/lib/webrtc/stats/transportStatsBuilder.d.ts.map +1 -1
  529. package/node_modules/matrix-js-sdk/lib/webrtc/stats/transportStatsBuilder.js.map +1 -1
  530. package/node_modules/matrix-js-sdk/lib/webrtc/stats/valueFormatter.d.ts.map +1 -1
  531. package/node_modules/matrix-js-sdk/lib/wellKnownCachedValue.d.ts +8 -0
  532. package/node_modules/matrix-js-sdk/lib/wellKnownCachedValue.d.ts.map +1 -0
  533. package/node_modules/matrix-js-sdk/lib/wellKnownCachedValue.js +34 -0
  534. package/node_modules/matrix-js-sdk/lib/wellKnownCachedValue.js.map +1 -0
  535. package/node_modules/matrix-js-sdk/node_modules/content-type/README.md +2 -0
  536. package/node_modules/matrix-js-sdk/node_modules/content-type/dist/index.d.ts +20 -0
  537. package/node_modules/matrix-js-sdk/node_modules/content-type/dist/index.js +20 -14
  538. package/node_modules/matrix-js-sdk/node_modules/content-type/dist/index.js.map +1 -1
  539. package/node_modules/matrix-js-sdk/node_modules/content-type/package.json +1 -1
  540. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/dist/api.js +227 -131
  541. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/dist/api.min.js +1 -1
  542. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/ClientWidgetApi.d.ts +1 -0
  543. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/ClientWidgetApi.js +142 -97
  544. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/ClientWidgetApi.js.map +1 -1
  545. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/WidgetApi.d.ts +15 -0
  546. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/WidgetApi.js +61 -19
  547. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/WidgetApi.js.map +1 -1
  548. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/driver/WidgetDriver.d.ts +15 -11
  549. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/driver/WidgetDriver.js +19 -13
  550. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/driver/WidgetDriver.js.map +1 -1
  551. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/index.d.ts +1 -0
  552. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/index.js.map +1 -1
  553. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/ApiVersion.d.ts +2 -1
  554. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/ApiVersion.js +2 -1
  555. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/ApiVersion.js.map +1 -1
  556. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/Capabilities.d.ts +5 -1
  557. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/Capabilities.js +1 -0
  558. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/Capabilities.js.map +1 -1
  559. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/RtcTransportsAction.d.ts +24 -0
  560. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/RtcTransportsAction.js +6 -0
  561. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/RtcTransportsAction.js.map +1 -0
  562. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/SendEventAction.d.ts +1 -0
  563. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/SendEventAction.js.map +1 -1
  564. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/WidgetApiAction.d.ts +5 -1
  565. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/WidgetApiAction.js +1 -0
  566. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/WidgetApiAction.js.map +1 -1
  567. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/package.json +1 -1
  568. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/ClientWidgetApi.ts +37 -14
  569. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/WidgetApi.ts +69 -0
  570. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/driver/WidgetDriver.ts +19 -12
  571. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/index.ts +1 -0
  572. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/interfaces/ApiVersion.ts +2 -0
  573. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/interfaces/Capabilities.ts +4 -0
  574. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/interfaces/RtcTransportsAction.ts +44 -0
  575. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/interfaces/SendEventAction.ts +1 -0
  576. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/interfaces/WidgetApiAction.ts +5 -0
  577. package/node_modules/matrix-js-sdk/package.json +10 -12
  578. package/node_modules/matrix-js-sdk/src/@types/PushRules.ts +0 -5
  579. package/node_modules/matrix-js-sdk/src/@types/auth.ts +0 -12
  580. package/node_modules/matrix-js-sdk/src/@types/beacon.ts +1 -1
  581. package/node_modules/matrix-js-sdk/src/@types/crypto.ts +2 -6
  582. package/node_modules/matrix-js-sdk/src/@types/event.ts +3 -0
  583. package/node_modules/matrix-js-sdk/src/@types/extensible_events.ts +5 -6
  584. package/node_modules/matrix-js-sdk/src/@types/matrix-sdk-crypto-wasm.d.ts +0 -1
  585. package/node_modules/matrix-js-sdk/src/@types/media.ts +1 -1
  586. package/node_modules/matrix-js-sdk/src/@types/partials.ts +0 -2
  587. package/node_modules/matrix-js-sdk/src/@types/requests.ts +0 -5
  588. package/node_modules/matrix-js-sdk/src/@types/search.ts +0 -2
  589. package/node_modules/matrix-js-sdk/src/@types/spaces.ts +0 -2
  590. package/node_modules/matrix-js-sdk/src/@types/synapse.ts +0 -2
  591. package/node_modules/matrix-js-sdk/src/@types/threepids.ts +2 -2
  592. package/node_modules/matrix-js-sdk/src/@types/type-guards.ts +126 -0
  593. package/node_modules/matrix-js-sdk/src/ToDeviceMessageQueue.ts +0 -2
  594. package/node_modules/matrix-js-sdk/src/autodiscovery.ts +2 -2
  595. package/node_modules/matrix-js-sdk/src/browser-index.ts +4 -4
  596. package/node_modules/matrix-js-sdk/src/client.ts +86 -133
  597. package/node_modules/matrix-js-sdk/src/common-crypto/key-passphrase.ts +1 -2
  598. package/node_modules/matrix-js-sdk/src/crypto/store/base.ts +1 -8
  599. package/node_modules/matrix-js-sdk/src/crypto/store/indexeddb-crypto-store-backend.ts +3 -2
  600. package/node_modules/matrix-js-sdk/src/crypto/store/indexeddb-crypto-store.ts +1 -3
  601. package/node_modules/matrix-js-sdk/src/crypto/store/localStorage-crypto-store.ts +0 -1
  602. package/node_modules/matrix-js-sdk/src/crypto/store/memory-crypto-store.ts +1 -1
  603. package/node_modules/matrix-js-sdk/src/crypto-api/index.ts +1 -1
  604. package/node_modules/matrix-js-sdk/src/crypto-api/keybackup.ts +14 -7
  605. package/node_modules/matrix-js-sdk/src/crypto-api/verification.ts +23 -5
  606. package/node_modules/matrix-js-sdk/src/embedded.ts +34 -16
  607. package/node_modules/matrix-js-sdk/src/feature.ts +0 -3
  608. package/node_modules/matrix-js-sdk/src/filter-component.ts +1 -2
  609. package/node_modules/matrix-js-sdk/src/filter.ts +0 -3
  610. package/node_modules/matrix-js-sdk/src/http-api/fetch.ts +1 -1
  611. package/node_modules/matrix-js-sdk/src/http-api/index.ts +1 -23
  612. package/node_modules/matrix-js-sdk/src/http-api/interface.ts +0 -12
  613. package/node_modules/matrix-js-sdk/src/http-api/refresh.ts +0 -1
  614. package/node_modules/matrix-js-sdk/src/interactive-auth.ts +4 -4
  615. package/node_modules/matrix-js-sdk/src/logger.ts +0 -2
  616. package/node_modules/matrix-js-sdk/src/matrix.ts +1 -1
  617. package/node_modules/matrix-js-sdk/src/matrixrtc/CallMembership.ts +5 -5
  618. package/node_modules/matrix-js-sdk/src/matrixrtc/MatrixRTCSession.ts +73 -6
  619. package/node_modules/matrix-js-sdk/src/matrixrtc/MatrixRTCSessionManager.ts +21 -2
  620. package/node_modules/matrix-js-sdk/src/matrixrtc/MembershipManager.ts +9 -6
  621. package/node_modules/matrix-js-sdk/src/matrixrtc/MembershipManagerActionScheduler.ts +1 -1
  622. package/node_modules/matrix-js-sdk/src/matrixrtc/RTCEncryptionManager.ts +2 -2
  623. package/node_modules/matrix-js-sdk/src/matrixrtc/ToDeviceKeyTransport.ts +3 -3
  624. package/node_modules/matrix-js-sdk/src/matrixrtc/index.ts +1 -1
  625. package/node_modules/matrix-js-sdk/src/matrixrtc/membershipData/rtc.ts +19 -8
  626. package/node_modules/matrix-js-sdk/src/matrixrtc/types.ts +24 -7
  627. package/node_modules/matrix-js-sdk/src/matrixrtc/utils.ts +0 -2
  628. package/node_modules/matrix-js-sdk/src/models/event-timeline-set.ts +3 -3
  629. package/node_modules/matrix-js-sdk/src/models/event.ts +7 -13
  630. package/node_modules/matrix-js-sdk/src/models/invites-ignorer.ts +1 -1
  631. package/node_modules/matrix-js-sdk/src/models/poll.ts +1 -1
  632. package/node_modules/matrix-js-sdk/src/models/read-receipt.ts +1 -1
  633. package/node_modules/matrix-js-sdk/src/models/relations-container.ts +55 -19
  634. package/node_modules/matrix-js-sdk/src/models/relations.ts +1 -1
  635. package/node_modules/matrix-js-sdk/src/models/room-state.ts +0 -3
  636. package/node_modules/matrix-js-sdk/src/models/room.ts +15 -15
  637. package/node_modules/matrix-js-sdk/src/models/thread.ts +51 -6
  638. package/node_modules/matrix-js-sdk/src/oauth/authorize.ts +274 -0
  639. package/node_modules/matrix-js-sdk/src/oauth/discover.ts +102 -0
  640. package/node_modules/matrix-js-sdk/src/{oidc → oauth}/error.ts +8 -7
  641. package/node_modules/matrix-js-sdk/src/oauth/index.ts +297 -0
  642. package/node_modules/matrix-js-sdk/src/oauth/register.ts +166 -0
  643. package/node_modules/matrix-js-sdk/src/oauth/tokenRefresher.ts +77 -0
  644. package/node_modules/matrix-js-sdk/src/pollingCachedValue.ts +184 -0
  645. package/node_modules/matrix-js-sdk/src/pushprocessor.ts +3 -3
  646. package/node_modules/matrix-js-sdk/src/realtime-callbacks.ts +0 -1
  647. package/node_modules/matrix-js-sdk/src/receipt-accumulator.ts +1 -2
  648. package/node_modules/matrix-js-sdk/src/rendezvous/MSC4108SignInWithQR.ts +14 -16
  649. package/node_modules/matrix-js-sdk/src/rendezvous/index.ts +2 -2
  650. package/node_modules/matrix-js-sdk/src/rendezvous/transports/MSC4108RendezvousSession.ts +0 -1
  651. package/node_modules/matrix-js-sdk/src/rtcTransportsCachedValue.ts +40 -0
  652. package/node_modules/matrix-js-sdk/src/rust-crypto/DehydratedDeviceManager.ts +14 -13
  653. package/node_modules/matrix-js-sdk/src/rust-crypto/OutgoingRequestProcessor.ts +0 -1
  654. package/node_modules/matrix-js-sdk/src/rust-crypto/PerSessionKeyBackupDownloader.ts +1 -1
  655. package/node_modules/matrix-js-sdk/src/rust-crypto/backup.ts +67 -33
  656. package/node_modules/matrix-js-sdk/src/rust-crypto/device-converter.ts +1 -0
  657. package/node_modules/matrix-js-sdk/src/rust-crypto/index.ts +32 -23
  658. package/node_modules/matrix-js-sdk/src/rust-crypto/libolm_migration.ts +1 -3
  659. package/node_modules/matrix-js-sdk/src/rust-crypto/rust-crypto.ts +3 -6
  660. package/node_modules/matrix-js-sdk/src/scheduler.ts +0 -3
  661. package/node_modules/matrix-js-sdk/src/sliding-sync-sdk.ts +4 -1
  662. package/node_modules/matrix-js-sdk/src/sliding-sync.ts +3 -1
  663. package/node_modules/matrix-js-sdk/src/store/indexeddb-local-backend.ts +1 -1
  664. package/node_modules/matrix-js-sdk/src/store/indexeddb-store-worker.ts +1 -0
  665. package/node_modules/matrix-js-sdk/src/store/indexeddb.ts +0 -2
  666. package/node_modules/matrix-js-sdk/src/store/memory.ts +7 -9
  667. package/node_modules/matrix-js-sdk/src/sync-accumulator.ts +1 -3
  668. package/node_modules/matrix-js-sdk/src/sync.ts +13 -14
  669. package/node_modules/matrix-js-sdk/src/testing.ts +3 -22
  670. package/node_modules/matrix-js-sdk/src/timeline-window.ts +0 -1
  671. package/node_modules/matrix-js-sdk/src/utils/internal/deriveKeys.ts +0 -1
  672. package/node_modules/matrix-js-sdk/src/utils.ts +3 -2
  673. package/node_modules/matrix-js-sdk/src/webrtc/call.ts +6 -6
  674. package/node_modules/matrix-js-sdk/src/webrtc/callEventTypes.ts +0 -5
  675. package/node_modules/matrix-js-sdk/src/webrtc/groupCall.ts +7 -7
  676. package/node_modules/matrix-js-sdk/src/webrtc/mediaHandler.ts +1 -1
  677. package/node_modules/matrix-js-sdk/src/webrtc/stats/callStatsReportGatherer.ts +2 -2
  678. package/node_modules/matrix-js-sdk/src/webrtc/stats/transportStatsBuilder.ts +1 -1
  679. package/node_modules/matrix-js-sdk/src/wellKnownCachedValue.ts +34 -0
  680. package/node_modules/music-metadata/LICENSE.txt +9 -9
  681. package/node_modules/music-metadata/README.md +878 -878
  682. package/node_modules/music-metadata/lib/ParseError.d.ts +1 -1
  683. package/node_modules/music-metadata/lib/ParseError.js +1 -1
  684. package/node_modules/music-metadata/lib/asf/AsfObject.d.ts +1 -4
  685. package/node_modules/music-metadata/lib/asf/AsfObject.js +66 -30
  686. package/node_modules/music-metadata/lib/asf/AsfParser.d.ts +5 -1
  687. package/node_modules/music-metadata/lib/asf/AsfParser.js +94 -25
  688. package/node_modules/music-metadata/lib/dsf/DsfChunk.js +2 -2
  689. package/node_modules/music-metadata/lib/dsf/DsfParser.js +38 -13
  690. package/node_modules/music-metadata/lib/mp4/AtomToken.js +2 -1
  691. package/node_modules/music-metadata/lib/mp4/MP4Parser.js +34 -7
  692. package/node_modules/music-metadata/lib/ogg/speex/SpeexStream.d.ts +7 -0
  693. package/node_modules/music-metadata/lib/ogg/speex/SpeexStream.js +13 -0
  694. package/node_modules/music-metadata/lib/riff/RiffChunk.js +1 -1
  695. package/node_modules/music-metadata/node_modules/content-type/README.md +2 -0
  696. package/node_modules/music-metadata/node_modules/content-type/dist/index.d.ts +20 -0
  697. package/node_modules/music-metadata/node_modules/content-type/dist/index.js +20 -14
  698. package/node_modules/music-metadata/node_modules/content-type/dist/index.js.map +1 -1
  699. package/node_modules/music-metadata/node_modules/content-type/package.json +1 -1
  700. package/node_modules/music-metadata/node_modules/file-type/package.json +1 -1
  701. package/node_modules/music-metadata/node_modules/file-type/readme.md +3 -0
  702. package/node_modules/music-metadata/node_modules/file-type/source/detectors/zip.js +6 -1
  703. package/node_modules/music-metadata/node_modules/file-type/source/index.d.ts +3 -0
  704. package/node_modules/music-metadata/node_modules/file-type/source/index.js +25 -13
  705. package/node_modules/music-metadata/package.json +156 -156
  706. package/node_modules/typebox/build/format/date.d.mts +1 -1
  707. package/node_modules/typebox/build/format/date.mjs +1 -1
  708. package/node_modules/typebox/build/format/date_time.d.mts +2 -2
  709. package/node_modules/typebox/build/format/date_time.mjs +3 -3
  710. package/node_modules/typebox/build/format/email.d.mts +1 -1
  711. package/node_modules/typebox/build/format/email.mjs +2 -2
  712. package/node_modules/typebox/build/format/hostname.mjs +2 -10
  713. package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
  714. package/node_modules/typebox/build/format/idn_email.mjs +3 -3
  715. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
  716. package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
  717. package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
  718. package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
  719. package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
  720. package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
  721. package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
  722. package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
  723. package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
  724. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +41 -0
  725. package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
  726. package/node_modules/typebox/build/format/idna/index.mjs +2 -0
  727. package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
  728. package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
  729. package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
  730. package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
  731. package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
  732. package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
  733. package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
  734. package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
  735. package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
  736. package/node_modules/typebox/build/format/ipv4.mjs +2 -32
  737. package/node_modules/typebox/build/format/ipv6.mjs +2 -61
  738. package/node_modules/typebox/build/format/iri.d.mts +2 -2
  739. package/node_modules/typebox/build/format/iri.mjs +26 -8
  740. package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
  741. package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
  742. package/node_modules/typebox/build/format/regex.d.mts +1 -2
  743. package/node_modules/typebox/build/format/regex.mjs +2 -6
  744. package/node_modules/typebox/build/format/time.d.mts +2 -2
  745. package/node_modules/typebox/build/format/time.mjs +19 -14
  746. package/node_modules/typebox/build/format/uri.d.mts +1 -1
  747. package/node_modules/typebox/build/format/uri.mjs +3 -130
  748. package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
  749. package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
  750. package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
  751. package/node_modules/typebox/build/format/uri_template.mjs +4 -5
  752. package/node_modules/typebox/build/format/url.d.mts +3 -3
  753. package/node_modules/typebox/build/format/url.mjs +4 -5
  754. package/node_modules/typebox/build/guard/emit.d.mts +3 -1
  755. package/node_modules/typebox/build/guard/emit.mjs +12 -5
  756. package/node_modules/typebox/build/guard/guard.d.mts +8 -2
  757. package/node_modules/typebox/build/guard/guard.mjs +25 -4
  758. package/node_modules/typebox/build/guard/string.d.mts +2 -2
  759. package/node_modules/typebox/build/guard/string.mjs +7 -7
  760. package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
  761. package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
  762. package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
  763. package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
  764. package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
  765. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
  766. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
  767. package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
  768. package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
  769. package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
  770. package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
  771. package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
  772. package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
  773. package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
  774. package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
  775. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
  776. package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
  777. package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
  778. package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
  779. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
  780. package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
  781. package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
  782. package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
  783. package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
  784. package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
  785. package/node_modules/typebox/build/schema/types/index.mjs +0 -2
  786. package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
  787. package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
  788. package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
  789. package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
  790. package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
  791. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
  792. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
  793. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
  794. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
  795. package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
  796. package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
  797. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
  798. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
  799. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
  800. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
  801. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
  802. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
  803. package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
  804. package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
  805. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
  806. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
  807. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
  808. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
  809. package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
  810. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
  811. package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
  812. package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
  813. package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
  814. package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
  815. package/node_modules/typebox/build/type/script/parser.mjs +27 -23
  816. package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
  817. package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
  818. package/node_modules/typebox/package.json +27 -27
  819. package/node_modules/typebox/readme.md +79 -82
  820. package/openclaw.plugin.json +16 -1
  821. package/package.json +10 -10
  822. package/dist/env-auth-MVS-Vv41.js +0 -64
  823. package/dist/file-sync-store-DjskBX2o.js +0 -436
  824. package/dist/media-text-Dh-DpTc3.js +0 -149
  825. package/dist/probe.runtime-NIJZYqc2.js +0 -2
  826. package/dist/recovery-key-store-CognuDys.js +0 -276
  827. package/dist/runtime-api-BGO16Fu8.js +0 -21
  828. package/dist/timeout-abort-signal-DMrgRFIy.js +0 -2
  829. package/node_modules/markdown-it/dist/index.cjs.js.map +0 -1
  830. package/node_modules/markdown-it/dist/markdown-it.js +0 -3975
  831. package/node_modules/markdown-it/dist/markdown-it.js.map +0 -1
  832. package/node_modules/markdown-it/dist/markdown-it.min.js +0 -3
  833. package/node_modules/markdown-it/dist/markdown-it.min.js.map +0 -1
  834. package/node_modules/markdown-it/index.mjs +0 -1
  835. package/node_modules/markdown-it/lib/common/html_blocks.mjs +0 -67
  836. package/node_modules/markdown-it/lib/common/html_re.mjs +0 -25
  837. package/node_modules/markdown-it/lib/common/utils.mjs +0 -324
  838. package/node_modules/markdown-it/lib/helpers/index.mjs +0 -11
  839. package/node_modules/markdown-it/lib/helpers/parse_link_destination.mjs +0 -77
  840. package/node_modules/markdown-it/lib/helpers/parse_link_label.mjs +0 -49
  841. package/node_modules/markdown-it/lib/helpers/parse_link_title.mjs +0 -66
  842. package/node_modules/markdown-it/lib/index.mjs +0 -565
  843. package/node_modules/markdown-it/lib/parser_block.mjs +0 -134
  844. package/node_modules/markdown-it/lib/parser_core.mjs +0 -62
  845. package/node_modules/markdown-it/lib/parser_inline.mjs +0 -197
  846. package/node_modules/markdown-it/lib/presets/commonmark.mjs +0 -88
  847. package/node_modules/markdown-it/lib/presets/default.mjs +0 -47
  848. package/node_modules/markdown-it/lib/presets/zero.mjs +0 -70
  849. package/node_modules/markdown-it/lib/renderer.mjs +0 -322
  850. package/node_modules/markdown-it/lib/ruler.mjs +0 -340
  851. package/node_modules/markdown-it/lib/rules_block/blockquote.mjs +0 -209
  852. package/node_modules/markdown-it/lib/rules_block/code.mjs +0 -30
  853. package/node_modules/markdown-it/lib/rules_block/fence.mjs +0 -94
  854. package/node_modules/markdown-it/lib/rules_block/heading.mjs +0 -51
  855. package/node_modules/markdown-it/lib/rules_block/hr.mjs +0 -40
  856. package/node_modules/markdown-it/lib/rules_block/html_block.mjs +0 -80
  857. package/node_modules/markdown-it/lib/rules_block/lheading.mjs +0 -85
  858. package/node_modules/markdown-it/lib/rules_block/list.mjs +0 -331
  859. package/node_modules/markdown-it/lib/rules_block/paragraph.mjs +0 -48
  860. package/node_modules/markdown-it/lib/rules_block/reference.mjs +0 -212
  861. package/node_modules/markdown-it/lib/rules_block/state_block.mjs +0 -220
  862. package/node_modules/markdown-it/lib/rules_block/table.mjs +0 -228
  863. package/node_modules/markdown-it/lib/rules_core/block.mjs +0 -13
  864. package/node_modules/markdown-it/lib/rules_core/inline.mjs +0 -11
  865. package/node_modules/markdown-it/lib/rules_core/linkify.mjs +0 -134
  866. package/node_modules/markdown-it/lib/rules_core/normalize.mjs +0 -17
  867. package/node_modules/markdown-it/lib/rules_core/replacements.mjs +0 -101
  868. package/node_modules/markdown-it/lib/rules_core/smartquotes.mjs +0 -209
  869. package/node_modules/markdown-it/lib/rules_core/state_core.mjs +0 -17
  870. package/node_modules/markdown-it/lib/rules_core/text_join.mjs +0 -43
  871. package/node_modules/markdown-it/lib/rules_inline/autolink.mjs +0 -72
  872. package/node_modules/markdown-it/lib/rules_inline/backticks.mjs +0 -60
  873. package/node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs +0 -124
  874. package/node_modules/markdown-it/lib/rules_inline/emphasis.mjs +0 -123
  875. package/node_modules/markdown-it/lib/rules_inline/entity.mjs +0 -51
  876. package/node_modules/markdown-it/lib/rules_inline/escape.mjs +0 -83
  877. package/node_modules/markdown-it/lib/rules_inline/fragments_join.mjs +0 -38
  878. package/node_modules/markdown-it/lib/rules_inline/html_inline.mjs +0 -50
  879. package/node_modules/markdown-it/lib/rules_inline/image.mjs +0 -138
  880. package/node_modules/markdown-it/lib/rules_inline/link.mjs +0 -139
  881. package/node_modules/markdown-it/lib/rules_inline/linkify.mjs +0 -63
  882. package/node_modules/markdown-it/lib/rules_inline/newline.mjs +0 -42
  883. package/node_modules/markdown-it/lib/rules_inline/state_inline.mjs +0 -154
  884. package/node_modules/markdown-it/lib/rules_inline/strikethrough.mjs +0 -127
  885. package/node_modules/markdown-it/lib/rules_inline/text.mjs +0 -86
  886. package/node_modules/markdown-it/lib/token.mjs +0 -191
  887. package/node_modules/markdown-it/node_modules/argparse/CHANGELOG.md +0 -216
  888. package/node_modules/markdown-it/node_modules/entities/lib/decode.d.ts +0 -211
  889. package/node_modules/markdown-it/node_modules/entities/lib/decode.d.ts.map +0 -1
  890. package/node_modules/markdown-it/node_modules/entities/lib/decode.js +0 -536
  891. package/node_modules/markdown-it/node_modules/entities/lib/decode.js.map +0 -1
  892. package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.d.ts +0 -19
  893. package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.d.ts.map +0 -1
  894. package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.js +0 -76
  895. package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.js.map +0 -1
  896. package/node_modules/markdown-it/node_modules/entities/lib/encode.d.ts +0 -22
  897. package/node_modules/markdown-it/node_modules/entities/lib/encode.d.ts.map +0 -1
  898. package/node_modules/markdown-it/node_modules/entities/lib/encode.js +0 -77
  899. package/node_modules/markdown-it/node_modules/entities/lib/encode.js.map +0 -1
  900. package/node_modules/markdown-it/node_modules/entities/lib/escape.d.ts.map +0 -1
  901. package/node_modules/markdown-it/node_modules/entities/lib/escape.js +0 -122
  902. package/node_modules/markdown-it/node_modules/entities/lib/escape.js.map +0 -1
  903. package/node_modules/markdown-it/node_modules/entities/lib/esm/decode.d.ts.map +0 -1
  904. package/node_modules/markdown-it/node_modules/entities/lib/esm/decode.js.map +0 -1
  905. package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.d.ts +0 -19
  906. package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.d.ts.map +0 -1
  907. package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.js +0 -71
  908. package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.js.map +0 -1
  909. package/node_modules/markdown-it/node_modules/entities/lib/esm/encode.d.ts.map +0 -1
  910. package/node_modules/markdown-it/node_modules/entities/lib/esm/encode.js +0 -69
  911. package/node_modules/markdown-it/node_modules/entities/lib/esm/encode.js.map +0 -1
  912. package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.d.ts +0 -43
  913. package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.d.ts.map +0 -1
  914. package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.js +0 -116
  915. package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.js.map +0 -1
  916. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.d.ts +0 -3
  917. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.d.ts.map +0 -1
  918. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.js +0 -7
  919. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.js.map +0 -1
  920. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts +0 -3
  921. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts.map +0 -1
  922. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.js +0 -7
  923. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.js.map +0 -1
  924. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.d.ts +0 -8
  925. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.d.ts.map +0 -1
  926. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.js +0 -10
  927. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.js.map +0 -1
  928. package/node_modules/markdown-it/node_modules/entities/lib/esm/index.d.ts +0 -96
  929. package/node_modules/markdown-it/node_modules/entities/lib/esm/index.d.ts.map +0 -1
  930. package/node_modules/markdown-it/node_modules/entities/lib/esm/index.js +0 -99
  931. package/node_modules/markdown-it/node_modules/entities/lib/esm/index.js.map +0 -1
  932. package/node_modules/markdown-it/node_modules/entities/lib/esm/package.json +0 -1
  933. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.d.ts +0 -3
  934. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.d.ts.map +0 -1
  935. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.js +0 -9
  936. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.js.map +0 -1
  937. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.d.ts +0 -3
  938. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.d.ts.map +0 -1
  939. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.js +0 -9
  940. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.js.map +0 -1
  941. package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.d.ts +0 -8
  942. package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.d.ts.map +0 -1
  943. package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.js +0 -12
  944. package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.js.map +0 -1
  945. package/node_modules/markdown-it/node_modules/entities/lib/index.d.ts.map +0 -1
  946. package/node_modules/markdown-it/node_modules/entities/lib/index.js +0 -126
  947. package/node_modules/markdown-it/node_modules/entities/lib/index.js.map +0 -1
  948. package/node_modules/markdown-it/node_modules/linkify-it/index.mjs +0 -646
  949. package/node_modules/markdown-it/node_modules/linkify-it/lib/re.mjs +0 -193
  950. package/node_modules/markdown-it/node_modules/uc.micro/categories/Cc/regex.mjs +0 -1
  951. package/node_modules/markdown-it/node_modules/uc.micro/categories/Cf/regex.mjs +0 -1
  952. package/node_modules/markdown-it/node_modules/uc.micro/categories/P/regex.mjs +0 -1
  953. package/node_modules/markdown-it/node_modules/uc.micro/categories/S/regex.mjs +0 -1
  954. package/node_modules/markdown-it/node_modules/uc.micro/categories/Z/regex.mjs +0 -1
  955. package/node_modules/markdown-it/node_modules/uc.micro/index.mjs +0 -8
  956. package/node_modules/markdown-it/node_modules/uc.micro/properties/Any/regex.mjs +0 -1
  957. package/node_modules/matrix-js-sdk/lib/oidc/authorize.d.ts +0 -157
  958. package/node_modules/matrix-js-sdk/lib/oidc/authorize.d.ts.map +0 -1
  959. package/node_modules/matrix-js-sdk/lib/oidc/authorize.js +0 -365
  960. package/node_modules/matrix-js-sdk/lib/oidc/authorize.js.map +0 -1
  961. package/node_modules/matrix-js-sdk/lib/oidc/discovery.d.ts +0 -22
  962. package/node_modules/matrix-js-sdk/lib/oidc/discovery.d.ts.map +0 -1
  963. package/node_modules/matrix-js-sdk/lib/oidc/discovery.js +0 -65
  964. package/node_modules/matrix-js-sdk/lib/oidc/discovery.js.map +0 -1
  965. package/node_modules/matrix-js-sdk/lib/oidc/error.d.ts +0 -18
  966. package/node_modules/matrix-js-sdk/lib/oidc/error.d.ts.map +0 -1
  967. package/node_modules/matrix-js-sdk/lib/oidc/error.js +0 -35
  968. package/node_modules/matrix-js-sdk/lib/oidc/error.js.map +0 -1
  969. package/node_modules/matrix-js-sdk/lib/oidc/index.d.ts +0 -16
  970. package/node_modules/matrix-js-sdk/lib/oidc/index.d.ts.map +0 -1
  971. package/node_modules/matrix-js-sdk/lib/oidc/index.js +0 -30
  972. package/node_modules/matrix-js-sdk/lib/oidc/index.js.map +0 -1
  973. package/node_modules/matrix-js-sdk/lib/oidc/register.d.ts +0 -70
  974. package/node_modules/matrix-js-sdk/lib/oidc/register.d.ts.map +0 -1
  975. package/node_modules/matrix-js-sdk/lib/oidc/register.js +0 -134
  976. package/node_modules/matrix-js-sdk/lib/oidc/register.js.map +0 -1
  977. package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.d.ts +0 -91
  978. package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.d.ts.map +0 -1
  979. package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.js +0 -173
  980. package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.js.map +0 -1
  981. package/node_modules/matrix-js-sdk/lib/oidc/validate.d.ts +0 -78
  982. package/node_modules/matrix-js-sdk/lib/oidc/validate.d.ts.map +0 -1
  983. package/node_modules/matrix-js-sdk/lib/oidc/validate.js +0 -181
  984. package/node_modules/matrix-js-sdk/lib/oidc/validate.js.map +0 -1
  985. package/node_modules/matrix-js-sdk/node_modules/jwt-decode/LICENSE +0 -21
  986. package/node_modules/matrix-js-sdk/node_modules/jwt-decode/README.md +0 -134
  987. package/node_modules/matrix-js-sdk/node_modules/jwt-decode/build/cjs/index.d.ts +0 -23
  988. package/node_modules/matrix-js-sdk/node_modules/jwt-decode/build/cjs/index.js +0 -62
  989. package/node_modules/matrix-js-sdk/node_modules/jwt-decode/build/cjs/package.json +0 -1
  990. package/node_modules/matrix-js-sdk/node_modules/jwt-decode/build/esm/index.d.ts +0 -23
  991. package/node_modules/matrix-js-sdk/node_modules/jwt-decode/build/esm/index.js +0 -57
  992. package/node_modules/matrix-js-sdk/node_modules/jwt-decode/package.json +0 -81
  993. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/LICENSE +0 -202
  994. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/README.md +0 -87
  995. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/browser/oidc-client-ts.js +0 -3751
  996. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/browser/oidc-client-ts.js.map +0 -7
  997. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/browser/oidc-client-ts.min.js +0 -2
  998. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/browser/oidc-client-ts.min.js.map +0 -7
  999. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/esm/oidc-client-ts.js +0 -3671
  1000. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/esm/oidc-client-ts.js.map +0 -7
  1001. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/esm/package.json +0 -4
  1002. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/types/oidc-client-ts.d.ts +0 -2003
  1003. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/types/tsdoc-metadata.json +0 -11
  1004. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/umd/oidc-client-ts.js +0 -3719
  1005. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/umd/oidc-client-ts.js.map +0 -7
  1006. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/package.json +0 -75
  1007. package/node_modules/matrix-js-sdk/src/oidc/authorize.ts +0 -431
  1008. package/node_modules/matrix-js-sdk/src/oidc/discovery.ts +0 -67
  1009. package/node_modules/matrix-js-sdk/src/oidc/index.ts +0 -33
  1010. package/node_modules/matrix-js-sdk/src/oidc/register.ts +0 -168
  1011. package/node_modules/matrix-js-sdk/src/oidc/tokenRefresher.ts +0 -184
  1012. package/node_modules/matrix-js-sdk/src/oidc/validate.ts +0 -265
  1013. package/node_modules/typebox/build/format/_idna.d.mts +0 -2
  1014. package/node_modules/typebox/build/format/_idna.mjs +0 -246
  1015. package/node_modules/typebox/build/format/_puny.d.mts +0 -1
  1016. package/node_modules/typebox/build/format/_puny.mjs +0 -77
  1017. package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
  1018. package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
  1019. package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
  1020. package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
  1021. package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
  1022. package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
@@ -1 +1 @@
1
- {"version":3,"file":"filter.js","names":[],"sources":["../src/filter.ts"],"sourcesContent":["/*\nCopyright 2015 - 2021 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 EventType, type RelationType } from \"./@types/event.ts\";\nimport { UNREAD_THREAD_NOTIFICATIONS } from \"./@types/sync.ts\";\nimport { FilterComponent, type IFilterComponent } from \"./filter-component.ts\";\nimport { type MatrixEvent } from \"./models/event.ts\";\nimport { NamespacedValue } from \"./NamespacedValue.ts\";\n\nconst profileFieldsFilterName = new NamespacedValue(\"profile_fields\", \"org.matrix.msc4429.profile_fields\");\n\n/**\n */\nfunction setProp(obj: Record<string, any>, keyNesting: string, val: any): void {\n const nestedKeys = keyNesting.split(\".\") as [keyof typeof obj];\n let currentObj = obj;\n for (let i = 0; i < nestedKeys.length - 1; i++) {\n if (!currentObj[nestedKeys[i]]) {\n currentObj[nestedKeys[i]] = {};\n }\n currentObj = currentObj[nestedKeys[i]];\n }\n currentObj[nestedKeys[nestedKeys.length - 1]] = val;\n}\n\n/* eslint-disable camelcase */\nexport interface IFilterDefinition {\n \"event_fields\"?: string[];\n \"event_format\"?: \"client\" | \"federation\";\n \"presence\"?: IFilterComponent;\n \"account_data\"?: IFilterComponent;\n \"room\"?: IRoomFilter;\n \"profile_fields\"?: ProfileFieldsFilter;\n \"org.matrix.msc4429.profile_fields\"?: ProfileFieldsFilter;\n}\n\nexport interface IRoomEventFilter extends IFilterComponent {\n \"lazy_load_members\"?: boolean;\n \"include_redundant_members\"?: boolean;\n \"types\"?: Array<EventType | string>;\n \"related_by_senders\"?: Array<RelationType | string>;\n \"related_by_rel_types\"?: string[];\n \"unread_thread_notifications\"?: boolean;\n \"org.matrix.msc3773.unread_thread_notifications\"?: boolean;\n\n // Unstable values\n \"io.element.relation_senders\"?: Array<RelationType | string>;\n \"io.element.relation_types\"?: string[];\n}\n\ninterface IStateFilter extends IRoomEventFilter {}\n\ninterface IRoomFilter {\n not_rooms?: string[];\n rooms?: string[];\n ephemeral?: IRoomEventFilter;\n include_leave?: boolean;\n state?: IStateFilter;\n timeline?: IRoomEventFilter;\n account_data?: IRoomEventFilter;\n}\n\n/**\n * Filter section used for requesting a set of extended profile fields that will be sent down the sync stream.\n */\ninterface ProfileFieldsFilter {\n ids: string[];\n}\n\n/* eslint-enable camelcase */\n\nexport class Filter {\n public static LAZY_LOADING_MESSAGES_FILTER = {\n lazy_load_members: true,\n };\n\n /**\n * Create a filter from existing data.\n */\n public static fromJson(userId: string | undefined | null, filterId: string, jsonObj: IFilterDefinition): Filter {\n const filter = new Filter(userId, filterId);\n filter.setDefinition(jsonObj);\n return filter;\n }\n\n private definition: IFilterDefinition = {};\n private roomFilter?: FilterComponent;\n private roomTimelineFilter?: FilterComponent;\n\n /**\n * Construct a new Filter.\n * @param userId - The user ID for this filter.\n * @param filterId - The filter ID if known.\n */\n public constructor(\n public readonly userId: string | undefined | null,\n public filterId?: string,\n ) {}\n\n /**\n * Get the ID of this filter on your homeserver (if known)\n * @returns The filter ID\n */\n public getFilterId(): string | undefined {\n return this.filterId;\n }\n\n /**\n * Get the JSON body of the filter.\n * @returns The filter definition\n */\n public getDefinition(): IFilterDefinition {\n return this.definition;\n }\n\n /**\n * Set the JSON body of the filter\n * @param definition - The filter definition\n */\n public setDefinition(definition: IFilterDefinition): void {\n this.definition = definition;\n\n // This is all ported from synapse's FilterCollection()\n\n // definitions look something like:\n // {\n // \"room\": {\n // \"rooms\": [\"!abcde:example.com\"],\n // \"not_rooms\": [\"!123456:example.com\"],\n // \"state\": {\n // \"types\": [\"m.room.*\"],\n // \"not_rooms\": [\"!726s6s6q:example.com\"],\n // \"lazy_load_members\": true,\n // },\n // \"timeline\": {\n // \"limit\": 10,\n // \"types\": [\"m.room.message\"],\n // \"not_rooms\": [\"!726s6s6q:example.com\"],\n // \"not_senders\": [\"@spam:example.com\"]\n // \"contains_url\": true\n // },\n // \"ephemeral\": {\n // \"types\": [\"m.receipt\", \"m.typing\"],\n // \"not_rooms\": [\"!726s6s6q:example.com\"],\n // \"not_senders\": [\"@spam:example.com\"]\n // }\n // },\n // \"presence\": {\n // \"types\": [\"m.presence\"],\n // \"not_senders\": [\"@alice:example.com\"]\n // },\n // \"event_format\": \"client\",\n // \"event_fields\": [\"type\", \"content\", \"sender\"]\n // }\n\n const roomFilterJson = definition.room;\n\n // consider the top level rooms/not_rooms filter\n const roomFilterFields: IRoomFilter = {};\n if (roomFilterJson) {\n if (roomFilterJson.rooms) {\n roomFilterFields.rooms = roomFilterJson.rooms;\n }\n if (roomFilterJson.rooms) {\n roomFilterFields.not_rooms = roomFilterJson.not_rooms;\n }\n }\n\n this.roomFilter = new FilterComponent(roomFilterFields, this.userId);\n this.roomTimelineFilter = new FilterComponent(roomFilterJson?.timeline || {}, this.userId);\n\n // don't bother porting this from synapse yet:\n // this._room_state_filter =\n // new FilterComponent(roomFilterJson.state || {});\n // this._room_ephemeral_filter =\n // new FilterComponent(roomFilterJson.ephemeral || {});\n // this._room_account_data_filter =\n // new FilterComponent(roomFilterJson.account_data || {});\n // this._presence_filter =\n // new FilterComponent(definition.presence || {});\n // this._account_data_filter =\n // new FilterComponent(definition.account_data || {});\n }\n\n /**\n * Get the room.timeline filter component of the filter\n * @returns room timeline filter component\n */\n public getRoomTimelineFilterComponent(): FilterComponent | undefined {\n return this.roomTimelineFilter;\n }\n\n /**\n * Filter the list of events based on whether they are allowed in a timeline\n * based on this filter\n * @param events - the list of events being filtered\n * @returns the list of events which match the filter\n */\n public filterRoomTimeline(events: MatrixEvent[]): MatrixEvent[] {\n if (this.roomFilter) {\n events = this.roomFilter.filter(events);\n }\n if (this.roomTimelineFilter) {\n events = this.roomTimelineFilter.filter(events);\n }\n return events;\n }\n\n /**\n * Set the max number of events to return for each room's timeline.\n * @param limit - The max number of events to return for each room.\n */\n public setTimelineLimit(limit: number): void {\n setProp(this.definition, \"room.timeline.limit\", limit);\n }\n\n /**\n * Enable threads unread notification\n */\n public setUnreadThreadNotifications(enabled: boolean): void {\n this.definition = {\n ...this.definition,\n room: {\n ...this.definition?.room,\n timeline: {\n ...this.definition?.room?.timeline,\n [UNREAD_THREAD_NOTIFICATIONS.name]: enabled,\n },\n },\n };\n }\n\n public setLazyLoadMembers(enabled: boolean): void {\n setProp(this.definition, \"room.state.lazy_load_members\", enabled);\n }\n\n /**\n * Control whether left rooms should be included in responses.\n * @param includeLeave - True to make rooms the user has left appear\n * in responses.\n */\n public setIncludeLeaveRooms(includeLeave: boolean): void {\n setProp(this.definition, \"room.include_leave\", includeLeave);\n }\n\n /**\n * Set the list of fields to be included in the profile information sent down the sync stream.\n * @param ids The field IDs to sync.\n * @param stable Whether to use the stable or unstable versions of this filter.\n * @experimental\n */\n public setUnstableMSC4429SyncUserProfiles(ids: string[], stable: boolean): void {\n const field = stable\n ? profileFieldsFilterName.name\n : (profileFieldsFilterName.unstable ?? profileFieldsFilterName.name);\n this.definition[field] = { ids };\n }\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAAS,2BAA2B,QAAQ,kBAAkB;AAC9D,SAAS,eAAe,QAA+B,uBAAuB;AAE9E,SAAS,eAAe,QAAQ,sBAAsB;AAEtD,MAAM,uBAAuB,GAAG,IAAI,eAAe,CAAC,gBAAgB,EAAE,mCAAmC,CAAC;;AAE1G;AACA;AACA,SAAS,OAAO,CAAC,GAAwB,EAAE,UAAkB,EAAE,GAAQ,EAAQ;EAC3E,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAuB;EAC9D,IAAI,UAAU,GAAG,GAAG;EACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;IAC5C,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE;MAC5B,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAClC;IACA,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;EAC1C;EACA,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG;AACvD;;AAEA;;AAqCA;AACA;AACA;;AAKA;;AAEA,OAAO,MAAM,MAAM,CAAC;EAKhB;AACJ;AACA;EACI,OAAc,QAAQ,CAAC,MAAiC,EAAE,QAAgB,EAAE,OAA0B,EAAU;IAC5G,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC3C,MAAM,CAAC,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UAAU,CAAC,KAAK,CAAC,GAAG;MAAE;IAAI,CAAC;EACpC;AACJ;AAAC,gBA1LY,MAAM,kCAC8B;EACzC,iBAAiB,EAAE;AACvB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"filter.js","names":[],"sources":["../src/filter.ts"],"sourcesContent":["/*\nCopyright 2015 - 2021 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 EventType, type RelationType } from \"./@types/event.ts\";\nimport { UNREAD_THREAD_NOTIFICATIONS } from \"./@types/sync.ts\";\nimport { FilterComponent, type IFilterComponent } from \"./filter-component.ts\";\nimport { type MatrixEvent } from \"./models/event.ts\";\nimport { NamespacedValue } from \"./NamespacedValue.ts\";\n\nconst profileFieldsFilterName = new NamespacedValue(\"profile_fields\", \"org.matrix.msc4429.profile_fields\");\n\n/**\n */\nfunction setProp(obj: Record<string, any>, keyNesting: string, val: any): void {\n const nestedKeys = keyNesting.split(\".\") as [keyof typeof obj];\n let currentObj = obj;\n for (let i = 0; i < nestedKeys.length - 1; i++) {\n if (!currentObj[nestedKeys[i]]) {\n currentObj[nestedKeys[i]] = {};\n }\n currentObj = currentObj[nestedKeys[i]];\n }\n currentObj[nestedKeys[nestedKeys.length - 1]] = val;\n}\n\nexport interface IFilterDefinition {\n \"event_fields\"?: string[];\n \"event_format\"?: \"client\" | \"federation\";\n \"presence\"?: IFilterComponent;\n \"account_data\"?: IFilterComponent;\n \"room\"?: IRoomFilter;\n \"profile_fields\"?: ProfileFieldsFilter;\n \"org.matrix.msc4429.profile_fields\"?: ProfileFieldsFilter;\n}\n\nexport interface IRoomEventFilter extends IFilterComponent {\n \"lazy_load_members\"?: boolean;\n \"include_redundant_members\"?: boolean;\n \"types\"?: Array<EventType | string>;\n \"related_by_senders\"?: Array<RelationType | string>;\n \"related_by_rel_types\"?: string[];\n \"unread_thread_notifications\"?: boolean;\n \"org.matrix.msc3773.unread_thread_notifications\"?: boolean;\n\n // Unstable values\n \"io.element.relation_senders\"?: Array<RelationType | string>;\n \"io.element.relation_types\"?: string[];\n}\n\ninterface IStateFilter extends IRoomEventFilter {}\n\ninterface IRoomFilter {\n not_rooms?: string[];\n rooms?: string[];\n ephemeral?: IRoomEventFilter;\n include_leave?: boolean;\n state?: IStateFilter;\n timeline?: IRoomEventFilter;\n account_data?: IRoomEventFilter;\n}\n\n/**\n * Filter section used for requesting a set of extended profile fields that will be sent down the sync stream.\n */\ninterface ProfileFieldsFilter {\n ids: string[];\n}\n\nexport class Filter {\n public static LAZY_LOADING_MESSAGES_FILTER = {\n lazy_load_members: true,\n };\n\n /**\n * Create a filter from existing data.\n */\n public static fromJson(userId: string | undefined | null, filterId: string, jsonObj: IFilterDefinition): Filter {\n const filter = new Filter(userId, filterId);\n filter.setDefinition(jsonObj);\n return filter;\n }\n\n private definition: IFilterDefinition = {};\n private roomFilter?: FilterComponent;\n private roomTimelineFilter?: FilterComponent;\n\n /**\n * Construct a new Filter.\n * @param userId - The user ID for this filter.\n * @param filterId - The filter ID if known.\n */\n public constructor(\n public readonly userId: string | undefined | null,\n public filterId?: string,\n ) {}\n\n /**\n * Get the ID of this filter on your homeserver (if known)\n * @returns The filter ID\n */\n public getFilterId(): string | undefined {\n return this.filterId;\n }\n\n /**\n * Get the JSON body of the filter.\n * @returns The filter definition\n */\n public getDefinition(): IFilterDefinition {\n return this.definition;\n }\n\n /**\n * Set the JSON body of the filter\n * @param definition - The filter definition\n */\n public setDefinition(definition: IFilterDefinition): void {\n this.definition = definition;\n\n // This is all ported from synapse's FilterCollection()\n\n // definitions look something like:\n // {\n // \"room\": {\n // \"rooms\": [\"!abcde:example.com\"],\n // \"not_rooms\": [\"!123456:example.com\"],\n // \"state\": {\n // \"types\": [\"m.room.*\"],\n // \"not_rooms\": [\"!726s6s6q:example.com\"],\n // \"lazy_load_members\": true,\n // },\n // \"timeline\": {\n // \"limit\": 10,\n // \"types\": [\"m.room.message\"],\n // \"not_rooms\": [\"!726s6s6q:example.com\"],\n // \"not_senders\": [\"@spam:example.com\"]\n // \"contains_url\": true\n // },\n // \"ephemeral\": {\n // \"types\": [\"m.receipt\", \"m.typing\"],\n // \"not_rooms\": [\"!726s6s6q:example.com\"],\n // \"not_senders\": [\"@spam:example.com\"]\n // }\n // },\n // \"presence\": {\n // \"types\": [\"m.presence\"],\n // \"not_senders\": [\"@alice:example.com\"]\n // },\n // \"event_format\": \"client\",\n // \"event_fields\": [\"type\", \"content\", \"sender\"]\n // }\n\n const roomFilterJson = definition.room;\n\n // consider the top level rooms/not_rooms filter\n const roomFilterFields: IRoomFilter = {};\n if (roomFilterJson) {\n if (roomFilterJson.rooms) {\n roomFilterFields.rooms = roomFilterJson.rooms;\n }\n if (roomFilterJson.rooms) {\n roomFilterFields.not_rooms = roomFilterJson.not_rooms;\n }\n }\n\n this.roomFilter = new FilterComponent(roomFilterFields, this.userId);\n this.roomTimelineFilter = new FilterComponent(roomFilterJson?.timeline || {}, this.userId);\n\n // don't bother porting this from synapse yet:\n // this._room_state_filter =\n // new FilterComponent(roomFilterJson.state || {});\n // this._room_ephemeral_filter =\n // new FilterComponent(roomFilterJson.ephemeral || {});\n // this._room_account_data_filter =\n // new FilterComponent(roomFilterJson.account_data || {});\n // this._presence_filter =\n // new FilterComponent(definition.presence || {});\n // this._account_data_filter =\n // new FilterComponent(definition.account_data || {});\n }\n\n /**\n * Get the room.timeline filter component of the filter\n * @returns room timeline filter component\n */\n public getRoomTimelineFilterComponent(): FilterComponent | undefined {\n return this.roomTimelineFilter;\n }\n\n /**\n * Filter the list of events based on whether they are allowed in a timeline\n * based on this filter\n * @param events - the list of events being filtered\n * @returns the list of events which match the filter\n */\n public filterRoomTimeline(events: MatrixEvent[]): MatrixEvent[] {\n if (this.roomFilter) {\n events = this.roomFilter.filter(events);\n }\n if (this.roomTimelineFilter) {\n events = this.roomTimelineFilter.filter(events);\n }\n return events;\n }\n\n /**\n * Set the max number of events to return for each room's timeline.\n * @param limit - The max number of events to return for each room.\n */\n public setTimelineLimit(limit: number): void {\n setProp(this.definition, \"room.timeline.limit\", limit);\n }\n\n /**\n * Enable threads unread notification\n */\n public setUnreadThreadNotifications(enabled: boolean): void {\n this.definition = {\n ...this.definition,\n room: {\n ...this.definition?.room,\n timeline: {\n ...this.definition?.room?.timeline,\n [UNREAD_THREAD_NOTIFICATIONS.name]: enabled,\n },\n },\n };\n }\n\n public setLazyLoadMembers(enabled: boolean): void {\n setProp(this.definition, \"room.state.lazy_load_members\", enabled);\n }\n\n /**\n * Control whether left rooms should be included in responses.\n * @param includeLeave - True to make rooms the user has left appear\n * in responses.\n */\n public setIncludeLeaveRooms(includeLeave: boolean): void {\n setProp(this.definition, \"room.include_leave\", includeLeave);\n }\n\n /**\n * Set the list of fields to be included in the profile information sent down the sync stream.\n * @param ids The field IDs to sync.\n * @param stable Whether to use the stable or unstable versions of this filter.\n * @experimental\n */\n public setUnstableMSC4429SyncUserProfiles(ids: string[], stable: boolean): void {\n const field = stable\n ? profileFieldsFilterName.name\n : (profileFieldsFilterName.unstable ?? profileFieldsFilterName.name);\n this.definition[field] = { ids };\n }\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAAS,2BAA2B,QAAQ,kBAAkB;AAC9D,SAAS,eAAe,QAA+B,uBAAuB;AAE9E,SAAS,eAAe,QAAQ,sBAAsB;AAEtD,MAAM,uBAAuB,GAAG,IAAI,eAAe,CAAC,gBAAgB,EAAE,mCAAmC,CAAC;;AAE1G;AACA;AACA,SAAS,OAAO,CAAC,GAAwB,EAAE,UAAkB,EAAE,GAAQ,E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E,KAAK,EAE/B;IAED,IAAW,IAAI,IAAI,MAAM,CAExB;CACJ;AAED,eAAO,MAAM,qBAAqB,sDAAyD,CAAC;AAE5F;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;IAC9C;;;OAGG;IACH,SAAgB,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACnC;;OAEG;IACH,SAAgB,MAAM,CAAC,EAAE,IAAI,CAAC;IAC9B,YAAmB,GAAG,KAAK,EAAE,qBAAqB,CAAC,OAAO,WAAW,CAAC,EASrE;CACJ"}
@@ -52,7 +52,7 @@ export declare class FetchHttpApi<O extends IHttpOpts> {
52
52
  * @returns The parsed response.
53
53
  * @throws Error if a problem occurred. This includes network problems and Matrix-specific error JSON.
54
54
  */
55
- request<T>(method: Method, path: string, queryParams?: QueryDict, body?: Body, opts?: IRequestOpts): Promise<T>;
55
+ request<T = unknown>(method: Method, path: string, queryParams?: QueryDict, body?: Body, opts?: IRequestOpts): Promise<T>;
56
56
  /**
57
57
  * Perform a request to an arbitrary URL.
58
58
  * @param method - The HTTP method e.g. "GET".
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/http-api/fetch.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EACH,KAAK,eAAe,EACpB,YAAY,EACZ,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,IAAI,EACZ,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,qBAAa,YAAY,CAAC,CAAC,SAAS,SAAS;IAKrC,OAAO,CAAC,YAAY;aACJ,IAAI,EAAE,CAAC;IAL3B,OAAO,CAAC,eAAe,CAAyB;IAChD,OAAO,CAAC,QAAQ,CAAC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MAAM,EACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,SAAS,EACrD,MAAM,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,CAAC,CAAC,CAwBZ;IAED;;;;;;;;;;;;;;;;;OAiBG;IACI,aAAa,CAAC,CAAC,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,WAAW,GAAE,SAAc,EAC3B,IAAI,CAAC,EAAE,IAAI,EACX,SAAS,GAAE,YAAiB,GAC7B,OAAO,CAAC,CAAC,CAAC,CAEZ;YAGa,eAAe;IA4D7B;;;;;;;;;;;;;;;OAeG;IACI,OAAO,CAAC,CAAC,GAAG,OAAO,EACtB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,SAAS,EACvB,IAAI,CAAC,EAAE,IAAI,EACX,IAAI,CAAC,EAAE,YAAY,GACpB,OAAO,CAAC,CAAC,CAAC,CAGZ;IAED;;;;;;;;;;;OAWG;IACU,eAAe,CAAC,CAAC,EAC1B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,GAAG,GAAG,MAAM,EACjB,IAAI,CAAC,EAAE,IAAI,EACX,IAAI,GAAE,eAAoB,GAC3B,OAAO,CAAC,CAAC,CAAC,CA4FZ;IAED,OAAO,CAAC,kBAAkB;IAsB1B;;;;;;;OAOG;IACI,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,GAAG,CAa3F;CACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.js","names":[],"sources":["../../src/http-api/fetch.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\n/**\n * This is an internal module. See {@link MatrixHttpApi} for the public class.\n */\n\nimport { checkObjectHasKeys, deepCopy, encodeParams } from \"../utils.ts\";\nimport { type TypedEventEmitter } from \"../models/typed-event-emitter.ts\";\nimport { Method } from \"./method.ts\";\nimport { ConnectionError, MatrixError, TokenRefreshError } from \"./errors.ts\";\nimport {\n type BaseRequestOpts,\n HttpApiEvent,\n type HttpApiEventHandlerMap,\n type IHttpOpts,\n type IRequestOpts,\n type Body,\n} from \"./interface.ts\";\nimport { anySignal, parseErrorResponse, timeoutSignal } from \"./utils.ts\";\nimport { type QueryDict } from \"../utils.ts\";\nimport { TokenRefresher, TokenRefreshOutcome } from \"./refresh.ts\";\n\nexport class FetchHttpApi<O extends IHttpOpts> {\n private abortController = new AbortController();\n private readonly tokenRefresher: TokenRefresher;\n\n public constructor(\n private eventEmitter: TypedEventEmitter<HttpApiEvent, HttpApiEventHandlerMap>,\n public readonly opts: O,\n ) {\n checkObjectHasKeys(opts, [\"baseUrl\", \"prefix\"]);\n if (!opts.onlyData) {\n throw new Error(\"Constructing FetchHttpApi without `onlyData=true` is no longer supported.\");\n }\n opts.useAuthorizationHeader = opts.useAuthorizationHeader ?? true;\n\n this.tokenRefresher = new TokenRefresher(opts);\n }\n\n public abort(): void {\n this.abortController.abort();\n this.abortController = new AbortController();\n }\n\n public fetch(resource: URL | string, options?: RequestInit): ReturnType<typeof globalThis.fetch> {\n if (this.opts.fetchFn) {\n return this.opts.fetchFn(resource, options);\n }\n return globalThis.fetch(resource, options);\n }\n\n /**\n * Sets the base URL for the identity server\n * @param url - The new base url\n */\n public setIdBaseUrl(url?: string): void {\n this.opts.idBaseUrl = url;\n }\n\n public idServerRequest<T extends object = Record<string, unknown>>(\n method: Method,\n path: string,\n params: Record<string, string | string[]> | undefined,\n prefix: string,\n accessToken?: string,\n ): Promise<T> {\n if (!this.opts.idBaseUrl) {\n throw new Error(\"No identity server base URL set\");\n }\n\n let queryParams: QueryDict | undefined = undefined;\n let body: Record<string, string | string[]> | undefined = undefined;\n if (method === Method.Get) {\n queryParams = params;\n } else {\n body = params;\n }\n\n const fullUri = this.getUrl(path, queryParams, prefix, this.opts.idBaseUrl);\n\n const opts: IRequestOpts = {\n json: true,\n headers: {},\n };\n if (accessToken) {\n opts.headers!.Authorization = `Bearer ${accessToken}`;\n }\n\n return this.requestOtherUrl(method, fullUri, body, opts);\n }\n\n /**\n * Perform an authorised request to the homeserver.\n * @param method - The HTTP method e.g. \"GET\".\n * @param path - The HTTP path <b>after</b> the supplied prefix e.g.\n * \"/createRoom\".\n *\n * @param queryParams - A dict of query params (these will NOT be\n * urlencoded). If unspecified, there will be no query params.\n *\n * @param body - The HTTP JSON body.\n *\n * @param paramOpts - additional options.\n * When `paramOpts.doNotAttemptTokenRefresh` is true, token refresh will not be attempted\n * when an expired token is encountered. Used to only attempt token refresh once.\n *\n * @returns The parsed response.\n * @throws Error if a problem occurred. This includes network problems and Matrix-specific error JSON.\n */\n public authedRequest<T>(\n method: Method,\n path: string,\n queryParams: QueryDict = {},\n body?: Body,\n paramOpts: IRequestOpts = {},\n ): Promise<T> {\n return this.doAuthedRequest<T>(1, method, path, queryParams, body, paramOpts);\n }\n\n // Wrapper around public method authedRequest to allow for tracking retry attempt counts\n private async doAuthedRequest<T>(\n attempt: number,\n method: Method,\n path: string,\n queryParams: QueryDict,\n body?: Body,\n paramOpts: IRequestOpts = {},\n ): Promise<T> {\n // avoid mutating paramOpts so they can be used on retry\n const opts = deepCopy(paramOpts);\n // we have to manually copy the abortSignal over as it is not a plain object\n opts.abortSignal = paramOpts.abortSignal;\n\n // Take a snapshot of the current token state before we start the request so we can reference it if we error\n const requestSnapshot = await this.tokenRefresher.prepareForRequest();\n if (requestSnapshot.accessToken) {\n if (this.opts.useAuthorizationHeader) {\n if (!opts.headers) {\n opts.headers = {};\n }\n if (!opts.headers.Authorization) {\n opts.headers.Authorization = `Bearer ${requestSnapshot.accessToken}`;\n }\n if (queryParams.access_token) {\n delete queryParams.access_token;\n }\n } else if (!queryParams.access_token) {\n queryParams.access_token = requestSnapshot.accessToken;\n }\n }\n\n try {\n const response = await this.request<T>(method, path, queryParams, body, opts);\n return response;\n } catch (error) {\n if (!(error instanceof MatrixError)) {\n throw error;\n }\n\n if (error.errcode === \"M_UNKNOWN_TOKEN\") {\n const outcome = await this.tokenRefresher.handleUnknownToken(requestSnapshot, attempt);\n if (outcome === TokenRefreshOutcome.Success) {\n // if we got a new token retry the request\n return this.doAuthedRequest(attempt + 1, method, path, queryParams, body, paramOpts);\n }\n if (outcome === TokenRefreshOutcome.Failure) {\n throw new TokenRefreshError(error);\n }\n\n if (!opts?.inhibitLogoutEmit) {\n this.eventEmitter.emit(HttpApiEvent.SessionLoggedOut, error);\n }\n } else if (error.errcode == \"M_CONSENT_NOT_GIVEN\") {\n this.eventEmitter.emit(HttpApiEvent.NoConsent, error.message, error.data.consent_uri);\n }\n\n throw error;\n }\n }\n\n /**\n * Perform a request to the homeserver without any credentials.\n * @param method - The HTTP method e.g. \"GET\".\n * @param path - The HTTP path <b>after</b> the supplied prefix e.g.\n * \"/createRoom\".\n *\n * @param queryParams - A dict of query params (these will NOT be\n * urlencoded). If unspecified, there will be no query params.\n *\n * @param body - The HTTP JSON body.\n *\n * @param opts - additional options\n *\n * @returns The parsed response.\n * @throws Error if a problem occurred. This includes network problems and Matrix-specific error JSON.\n */\n public request<T>(\n method: Method,\n path: string,\n queryParams?: QueryDict,\n body?: Body,\n opts?: IRequestOpts,\n ): Promise<T> {\n const fullUri = this.getUrl(path, queryParams, opts?.prefix, opts?.baseUrl);\n return this.requestOtherUrl<T>(method, fullUri, body, opts);\n }\n\n /**\n * Perform a request to an arbitrary URL.\n * @param method - The HTTP method e.g. \"GET\".\n * @param url - The HTTP URL object.\n *\n * @param body - The HTTP JSON body.\n *\n * @param opts - additional options\n *\n * @returns The parsed response.\n * @throws Error if a problem occurred. This includes network problems and Matrix-specific error JSON.\n */\n public async requestOtherUrl<T>(\n method: Method,\n url: URL | string,\n body?: Body,\n opts: BaseRequestOpts = {},\n ): Promise<T> {\n if (opts.json !== undefined && opts.rawResponseBody !== undefined) {\n throw new Error(\"Invalid call to `FetchHttpApi` sets both `opts.json` and `opts.rawResponseBody`\");\n }\n\n const urlForLogs = this.sanitizeUrlForLogs(url);\n\n this.opts.logger?.debug(`FetchHttpApi: --> ${method} ${urlForLogs}`);\n\n const headers = Object.assign({}, opts.headers || {});\n\n const jsonResponse = !opts.rawResponseBody && opts.json !== false;\n if (jsonResponse) {\n if (!headers[\"Accept\"]) {\n headers[\"Accept\"] = \"application/json\";\n }\n }\n\n const timeout = opts.localTimeoutMs ?? this.opts.localTimeoutMs;\n const keepAlive = opts.keepAlive ?? false;\n const signals = [this.abortController.signal];\n if (timeout !== undefined) {\n signals.push(timeoutSignal(timeout));\n }\n if (opts.abortSignal) {\n signals.push(opts.abortSignal);\n }\n\n // If the body is an object, encode it as JSON and set the `Content-Type` header,\n // unless that has been explicitly inhibited by setting `opts.json: false`.\n // We can't use getPrototypeOf here as objects made in other contexts e.g. over postMessage won't have same ref\n let data: BodyInit;\n if (opts.json !== false && body?.constructor?.name === Object.name) {\n data = JSON.stringify(body);\n if (!headers[\"Content-Type\"]) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n } else {\n data = body as BodyInit;\n }\n\n const { signal, cleanup } = anySignal(signals);\n\n // Set cache mode based on presence of Authorization header.\n // Browsers/proxies do not cache responses to requests with Authorization headers.\n // So specifying \"no-cache\" is redundant, and actually prevents caching\n // of preflight requests in CORS scenarios. As such, we only set \"no-cache\"\n // when there is no Authorization header.\n const cacheMode = \"Authorization\" in headers ? undefined : \"no-cache\";\n\n let res: Response;\n const start = Date.now();\n try {\n res = await this.fetch(url, {\n signal,\n method,\n body: data,\n headers,\n mode: \"cors\",\n redirect: \"follow\",\n referrer: \"\",\n referrerPolicy: \"no-referrer\",\n cache: cacheMode,\n credentials: \"omit\", // we send credentials via headers\n keepalive: keepAlive,\n priority: opts.priority,\n });\n\n this.opts.logger?.debug(\n `FetchHttpApi: <-- ${method} ${urlForLogs} [${Date.now() - start}ms ${res.status}]`,\n );\n } catch (e) {\n this.opts.logger?.debug(`FetchHttpApi: <-- ${method} ${urlForLogs} [${Date.now() - start}ms ${e}]`);\n if ((<Error>e).name === \"AbortError\") {\n throw e;\n }\n throw new ConnectionError(\"fetch failed\", <Error>e);\n } finally {\n cleanup();\n }\n\n if (!res.ok) {\n throw parseErrorResponse(res, await res.text());\n }\n\n if (opts.rawResponseBody) {\n return (await res.blob()) as T;\n } else if (jsonResponse) {\n return await res.json();\n } else {\n return (await res.text()) as T;\n }\n }\n\n private sanitizeUrlForLogs(url: URL | string): string {\n try {\n let asUrl: URL;\n if (typeof url === \"string\") {\n asUrl = new URL(url);\n } else {\n asUrl = url;\n }\n // Remove the values of any URL params that could contain potential secrets\n const sanitizedQs = new URLSearchParams();\n for (const key of asUrl.searchParams.keys()) {\n sanitizedQs.append(key, \"xxx\");\n }\n const sanitizedQsString = sanitizedQs.toString();\n const sanitizedQsUrlPiece = sanitizedQsString ? `?${sanitizedQsString}` : \"\";\n\n return asUrl.origin + asUrl.pathname + sanitizedQsUrlPiece;\n } catch {\n // defensive coding for malformed url\n return \"??\";\n }\n }\n /**\n * Form and return a homeserver request URL based on the given path params and prefix.\n * @param path - The HTTP path <b>after</b> the supplied prefix e.g. \"/createRoom\".\n * @param queryParams - A dict of query params (these will NOT be urlencoded).\n * @param prefix - The full prefix to use e.g. \"/_matrix/client/v2_alpha\", defaulting to this.opts.prefix.\n * @param baseUrl - The baseUrl to use e.g. \"https://matrix.org\", defaulting to this.opts.baseUrl.\n * @returns URL\n */\n public getUrl(path: string, queryParams?: QueryDict, prefix?: string, baseUrl?: string): URL {\n const baseUrlWithFallback = baseUrl ?? this.opts.baseUrl;\n const baseUrlWithoutTrailingSlash = baseUrlWithFallback.endsWith(\"/\")\n ? baseUrlWithFallback.slice(0, -1)\n : baseUrlWithFallback;\n const url = new URL(baseUrlWithoutTrailingSlash + (prefix ?? this.opts.prefix) + path);\n // If there are any params, encode and append them to the URL.\n if (this.opts.extraParams || queryParams) {\n const mergedParams = { ...this.opts.extraParams, ...queryParams };\n encodeParams(mergedParams, url.searchParams);\n }\n\n return url;\n }\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,SAAS,kBAAkB,EAAE,QAAQ,EAAE,YAAY,QAAQ,aAAa;AAExE,SAAS,MAAM,QAAQ,aAAa;AACpC,SAAS,eAAe,EAAE,WAAW,EAAE,iBAAiB,QAAQ,aAAa;AAC7E,SAEI,YAAY,QAKT,gBAAgB;AACvB,SAAS,SAAS,EAAE,kBAAkB,EAAE,aAAa,QAAQ,YAAY;AAEzE,SAAS,cAAc,EAAE,mBAAmB,QAAQ,cAAc;AAElE,OAAO,MAAM,YAAY,CAAsB;EAIpC,WAAW,CACN,YAAqE,EAC7D,IAAO,EACzB;IAAA,yCANwB,IAAI,eAAe,CAAC,CAAC;IAAA;IAAA,KAInC,YAAqE,GAArE,YAAqE;IAAA,KAC7D,IAAO,GAAP,IAAO;IAEvB,kBAAkB,CAAC,IAAI,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC/C,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;MAChB,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC;IAChG;IACA,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,IAAI,IAAI;IAEjE,IAAI,CAAC,cAAc,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC;EAClD;EAEO,KAAK,GAAS;IACjB,IAAI,CAAC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AACA;AACA;AACA;EACW,MAAM,CAAC,IAAY,EAAE,WAAuB,EAAE,MAAe,EAAE,OAAgB,EAAO;IACzF,MAAM,mBAAmB,GAAG,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO;IACxD,MAAM,2BAA2B,GAAG,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,GAC/D,mBAAmB,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAChC,mBAAmB;IACzB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,2BAA2B,IAAI,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IACtF;IACA,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,WAAW,EAAE;MACtC,MAAM,YAAY,mCAAQ,IAAI,CAAC,IAAI,CAAC,WAAW,GAAK,WAAW,CAAE;MACjE,YAAY,CAAC,YAAY,EAAE,GAAG,CAAC,YAAY,CAAC;IAChD;IAEA,OAAO,GAAG;EACd;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"fetch.js","names":[],"sources":["../../src/http-api/fetch.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\n/**\n * This is an internal module. See {@link MatrixHttpApi} for the public class.\n */\n\nimport { checkObjectHasKeys, deepCopy, encodeParams } from \"../utils.ts\";\nimport { type TypedEventEmitter } from \"../models/typed-event-emitter.ts\";\nimport { Method } from \"./method.ts\";\nimport { ConnectionError, MatrixError, TokenRefreshError } from \"./errors.ts\";\nimport {\n type BaseRequestOpts,\n HttpApiEvent,\n type HttpApiEventHandlerMap,\n type IHttpOpts,\n type IRequestOpts,\n type Body,\n} from \"./interface.ts\";\nimport { anySignal, parseErrorResponse, timeoutSignal } from \"./utils.ts\";\nimport { type QueryDict } from \"../utils.ts\";\nimport { TokenRefresher, TokenRefreshOutcome } from \"./refresh.ts\";\n\nexport class FetchHttpApi<O extends IHttpOpts> {\n private abortController = new AbortController();\n private readonly tokenRefresher: TokenRefresher;\n\n public constructor(\n private eventEmitter: TypedEventEmitter<HttpApiEvent, HttpApiEventHandlerMap>,\n public readonly opts: O,\n ) {\n checkObjectHasKeys(opts, [\"baseUrl\", \"prefix\"]);\n if (!opts.onlyData) {\n throw new Error(\"Constructing FetchHttpApi without `onlyData=true` is no longer supported.\");\n }\n opts.useAuthorizationHeader = opts.useAuthorizationHeader ?? true;\n\n this.tokenRefresher = new TokenRefresher(opts);\n }\n\n public abort(): void {\n this.abortController.abort();\n this.abortController = new AbortController();\n }\n\n public fetch(resource: URL | string, options?: RequestInit): ReturnType<typeof globalThis.fetch> {\n if (this.opts.fetchFn) {\n return this.opts.fetchFn(resource, options);\n }\n return globalThis.fetch(resource, options);\n }\n\n /**\n * Sets the base URL for the identity server\n * @param url - The new base url\n */\n public setIdBaseUrl(url?: string): void {\n this.opts.idBaseUrl = url;\n }\n\n public idServerRequest<T extends object = Record<string, unknown>>(\n method: Method,\n path: string,\n params: Record<string, string | string[]> | undefined,\n prefix: string,\n accessToken?: string,\n ): Promise<T> {\n if (!this.opts.idBaseUrl) {\n throw new Error(\"No identity server base URL set\");\n }\n\n let queryParams: QueryDict | undefined = undefined;\n let body: Record<string, string | string[]> | undefined = undefined;\n if (method === Method.Get) {\n queryParams = params;\n } else {\n body = params;\n }\n\n const fullUri = this.getUrl(path, queryParams, prefix, this.opts.idBaseUrl);\n\n const opts: IRequestOpts = {\n json: true,\n headers: {},\n };\n if (accessToken) {\n opts.headers!.Authorization = `Bearer ${accessToken}`;\n }\n\n return this.requestOtherUrl(method, fullUri, body, opts);\n }\n\n /**\n * Perform an authorised request to the homeserver.\n * @param method - The HTTP method e.g. \"GET\".\n * @param path - The HTTP path <b>after</b> the supplied prefix e.g.\n * \"/createRoom\".\n *\n * @param queryParams - A dict of query params (these will NOT be\n * urlencoded). If unspecified, there will be no query params.\n *\n * @param body - The HTTP JSON body.\n *\n * @param paramOpts - additional options.\n * When `paramOpts.doNotAttemptTokenRefresh` is true, token refresh will not be attempted\n * when an expired token is encountered. Used to only attempt token refresh once.\n *\n * @returns The parsed response.\n * @throws Error if a problem occurred. This includes network problems and Matrix-specific error JSON.\n */\n public authedRequest<T>(\n method: Method,\n path: string,\n queryParams: QueryDict = {},\n body?: Body,\n paramOpts: IRequestOpts = {},\n ): Promise<T> {\n return this.doAuthedRequest<T>(1, method, path, queryParams, body, paramOpts);\n }\n\n // Wrapper around public method authedRequest to allow for tracking retry attempt counts\n private async doAuthedRequest<T>(\n attempt: number,\n method: Method,\n path: string,\n queryParams: QueryDict,\n body?: Body,\n paramOpts: IRequestOpts = {},\n ): Promise<T> {\n // avoid mutating paramOpts so they can be used on retry\n const opts = deepCopy(paramOpts);\n // we have to manually copy the abortSignal over as it is not a plain object\n opts.abortSignal = paramOpts.abortSignal;\n\n // Take a snapshot of the current token state before we start the request so we can reference it if we error\n const requestSnapshot = await this.tokenRefresher.prepareForRequest();\n if (requestSnapshot.accessToken) {\n if (this.opts.useAuthorizationHeader) {\n if (!opts.headers) {\n opts.headers = {};\n }\n if (!opts.headers.Authorization) {\n opts.headers.Authorization = `Bearer ${requestSnapshot.accessToken}`;\n }\n if (queryParams.access_token) {\n delete queryParams.access_token;\n }\n } else if (!queryParams.access_token) {\n queryParams.access_token = requestSnapshot.accessToken;\n }\n }\n\n try {\n const response = await this.request<T>(method, path, queryParams, body, opts);\n return response;\n } catch (error) {\n if (!(error instanceof MatrixError)) {\n throw error;\n }\n\n if (error.errcode === \"M_UNKNOWN_TOKEN\") {\n const outcome = await this.tokenRefresher.handleUnknownToken(requestSnapshot, attempt);\n if (outcome === TokenRefreshOutcome.Success) {\n // if we got a new token retry the request\n return this.doAuthedRequest(attempt + 1, method, path, queryParams, body, paramOpts);\n }\n if (outcome === TokenRefreshOutcome.Failure) {\n throw new TokenRefreshError(error);\n }\n\n if (!opts?.inhibitLogoutEmit) {\n this.eventEmitter.emit(HttpApiEvent.SessionLoggedOut, error);\n }\n } else if (error.errcode == \"M_CONSENT_NOT_GIVEN\") {\n this.eventEmitter.emit(HttpApiEvent.NoConsent, error.message, error.data.consent_uri);\n }\n\n throw error;\n }\n }\n\n /**\n * Perform a request to the homeserver without any credentials.\n * @param method - The HTTP method e.g. \"GET\".\n * @param path - The HTTP path <b>after</b> the supplied prefix e.g.\n * \"/createRoom\".\n *\n * @param queryParams - A dict of query params (these will NOT be\n * urlencoded). If unspecified, there will be no query params.\n *\n * @param body - The HTTP JSON body.\n *\n * @param opts - additional options\n *\n * @returns The parsed response.\n * @throws Error if a problem occurred. This includes network problems and Matrix-specific error JSON.\n */\n public request<T = unknown>(\n method: Method,\n path: string,\n queryParams?: QueryDict,\n body?: Body,\n opts?: IRequestOpts,\n ): Promise<T> {\n const fullUri = this.getUrl(path, queryParams, opts?.prefix, opts?.baseUrl);\n return this.requestOtherUrl<T>(method, fullUri, body, opts);\n }\n\n /**\n * Perform a request to an arbitrary URL.\n * @param method - The HTTP method e.g. \"GET\".\n * @param url - The HTTP URL object.\n *\n * @param body - The HTTP JSON body.\n *\n * @param opts - additional options\n *\n * @returns The parsed response.\n * @throws Error if a problem occurred. This includes network problems and Matrix-specific error JSON.\n */\n public async requestOtherUrl<T>(\n method: Method,\n url: URL | string,\n body?: Body,\n opts: BaseRequestOpts = {},\n ): Promise<T> {\n if (opts.json !== undefined && opts.rawResponseBody !== undefined) {\n throw new Error(\"Invalid call to `FetchHttpApi` sets both `opts.json` and `opts.rawResponseBody`\");\n }\n\n const urlForLogs = this.sanitizeUrlForLogs(url);\n\n this.opts.logger?.debug(`FetchHttpApi: --> ${method} ${urlForLogs}`);\n\n const headers = Object.assign({}, opts.headers || {});\n\n const jsonResponse = !opts.rawResponseBody && opts.json !== false;\n if (jsonResponse) {\n if (!headers[\"Accept\"]) {\n headers[\"Accept\"] = \"application/json\";\n }\n }\n\n const timeout = opts.localTimeoutMs ?? this.opts.localTimeoutMs;\n const keepAlive = opts.keepAlive ?? false;\n const signals = [this.abortController.signal];\n if (timeout !== undefined) {\n signals.push(timeoutSignal(timeout));\n }\n if (opts.abortSignal) {\n signals.push(opts.abortSignal);\n }\n\n // If the body is an object, encode it as JSON and set the `Content-Type` header,\n // unless that has been explicitly inhibited by setting `opts.json: false`.\n // We can't use getPrototypeOf here as objects made in other contexts e.g. over postMessage won't have same ref\n let data: BodyInit;\n if (opts.json !== false && body?.constructor?.name === Object.name) {\n data = JSON.stringify(body);\n if (!headers[\"Content-Type\"]) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n } else {\n data = body as BodyInit;\n }\n\n const { signal, cleanup } = anySignal(signals);\n\n // Set cache mode based on presence of Authorization header.\n // Browsers/proxies do not cache responses to requests with Authorization headers.\n // So specifying \"no-cache\" is redundant, and actually prevents caching\n // of preflight requests in CORS scenarios. As such, we only set \"no-cache\"\n // when there is no Authorization header.\n const cacheMode = \"Authorization\" in headers ? undefined : \"no-cache\";\n\n let res: Response;\n const start = Date.now();\n try {\n res = await this.fetch(url, {\n signal,\n method,\n body: data,\n headers,\n mode: \"cors\",\n redirect: \"follow\",\n referrer: \"\",\n referrerPolicy: \"no-referrer\",\n cache: cacheMode,\n credentials: \"omit\", // we send credentials via headers\n keepalive: keepAlive,\n priority: opts.priority,\n });\n\n this.opts.logger?.debug(\n `FetchHttpApi: <-- ${method} ${urlForLogs} [${Date.now() - start}ms ${res.status}]`,\n );\n } catch (e) {\n this.opts.logger?.debug(`FetchHttpApi: <-- ${method} ${urlForLogs} [${Date.now() - start}ms ${e}]`);\n if ((<Error>e).name === \"AbortError\") {\n throw e;\n }\n throw new ConnectionError(\"fetch failed\", <Error>e);\n } finally {\n cleanup();\n }\n\n if (!res.ok) {\n throw parseErrorResponse(res, await res.text());\n }\n\n if (opts.rawResponseBody) {\n return (await res.blob()) as T;\n } else if (jsonResponse) {\n return await res.json();\n } else {\n return (await res.text()) as T;\n }\n }\n\n private sanitizeUrlForLogs(url: URL | string): string {\n try {\n let asUrl: URL;\n if (typeof url === \"string\") {\n asUrl = new URL(url);\n } else {\n asUrl = url;\n }\n // Remove the values of any URL params that could contain potential secrets\n const sanitizedQs = new URLSearchParams();\n for (const key of asUrl.searchParams.keys()) {\n sanitizedQs.append(key, \"xxx\");\n }\n const sanitizedQsString = sanitizedQs.toString();\n const sanitizedQsUrlPiece = sanitizedQsString ? `?${sanitizedQsString}` : \"\";\n\n return asUrl.origin + asUrl.pathname + sanitizedQsUrlPiece;\n } catch {\n // defensive coding for malformed url\n return \"??\";\n }\n }\n /**\n * Form and return a homeserver request URL based on the given path params and prefix.\n * @param path - The HTTP path <b>after</b> the supplied prefix e.g. \"/createRoom\".\n * @param queryParams - A dict of query params (these will NOT be urlencoded).\n * @param prefix - The full prefix to use e.g. \"/_matrix/client/v2_alpha\", defaulting to this.opts.prefix.\n * @param baseUrl - The baseUrl to use e.g. \"https://matrix.org\", defaulting to this.opts.baseUrl.\n * @returns URL\n */\n public getUrl(path: string, queryParams?: QueryDict, prefix?: string, baseUrl?: string): URL {\n const baseUrlWithFallback = baseUrl ?? this.opts.baseUrl;\n const baseUrlWithoutTrailingSlash = baseUrlWithFallback.endsWith(\"/\")\n ? baseUrlWithFallback.slice(0, -1)\n : baseUrlWithFallback;\n const url = new URL(baseUrlWithoutTrailingSlash + (prefix ?? this.opts.prefix) + path);\n // If there are any params, encode and append them to the URL.\n if (this.opts.extraParams || queryParams) {\n const mergedParams = { ...this.opts.extraParams, ...queryParams };\n encodeParams(mergedParams, url.searchParams);\n }\n\n return url;\n }\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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AG,IAAI,CAAC;IACtF;IACA,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,WAAW,EAAE;MACtC,MAAM,YAAY,mCAAQ,IAAI,CAAC,IAAI,CAAC,WAAW,GAAK,WAAW,CAAE;MACjE,YAAY,CAAC,YAAY,EAAE,GAAG,CAAC,YAAY,CAAC;IAChD;IAEA,OAAO,GAAG;EACd;AACJ","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import { FetchHttpApi } from "./fetch.ts";
2
- import { type FileType, type IContentUri, type IHttpOpts, type Upload, type UploadOpts, type UploadResponse } from "./interface.ts";
2
+ import { type FileType, type IHttpOpts, type Upload, type UploadOpts, type UploadResponse } from "./interface.ts";
3
3
  export * from "./interface.ts";
4
4
  export * from "./prefix.ts";
5
5
  export * from "./errors.ts";
@@ -23,11 +23,5 @@ export declare class MatrixHttpApi<O extends IHttpOpts> extends FetchHttpApi<O>
23
23
  uploadContent(file: FileType, opts?: UploadOpts): Promise<UploadResponse>;
24
24
  cancelUpload(promise: Promise<UploadResponse>): boolean;
25
25
  getCurrentUploads(): Upload[];
26
- /**
27
- * Get the content repository url with query parameters.
28
- * @returns An object with a 'base', 'path' and 'params' for base URL,
29
- * path and query parameters respectively.
30
- */
31
- getContentUri(): IContentUri;
32
26
  }
33
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/http-api/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EACH,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,cAAc,EACtB,MAAM,gBAAgB,CAAC;AAQxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAE3B,qBAAa,aAAa,CAAC,CAAC,SAAS,SAAS,CAAE,SAAQ,YAAY,CAAC,CAAC,CAAC;IACnE,OAAO,CAAC,OAAO,CAAgB;IAE/B;;;;;;;;;;;;OAYG;IACI,aAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,GAAE,UAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IAgH7E,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,OAAO;IASvD,iBAAiB,IAAI,MAAM,EAAE;IAIpC;;;;OAIG;IACI,aAAa,IAAI,WAAW;CAStC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/http-api/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAQlH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAE3B,qBAAa,aAAa,CAAC,CAAC,SAAS,SAAS,CAAE,SAAQ,YAAY,CAAC,CAAC,CAAC;IACnE,OAAO,CAAC,OAAO,CAAgB;IAE/B;;;;;;;;;;;;OAYG;IACI,aAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,GAAE,UAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CA8GnF;IAEM,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,OAAO,CAO7D;IAEM,iBAAiB,IAAI,MAAM,EAAE,CAEnC;CACJ"}
@@ -156,20 +156,5 @@ export class MatrixHttpApi extends FetchHttpApi {
156
156
  getCurrentUploads() {
157
157
  return this.uploads;
158
158
  }
159
-
160
- /**
161
- * Get the content repository url with query parameters.
162
- * @returns An object with a 'base', 'path' and 'params' for base URL,
163
- * path and query parameters respectively.
164
- */
165
- getContentUri() {
166
- return {
167
- base: this.opts.baseUrl,
168
- path: MediaPrefix.V3 + "/upload",
169
- params: {
170
- access_token: this.opts.accessToken
171
- }
172
- };
173
- }
174
159
  }
175
160
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/http-api/index.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 { FetchHttpApi } from \"./fetch.ts\";\nimport {\n type FileType,\n type IContentUri,\n type IHttpOpts,\n type Upload,\n type UploadOpts,\n type UploadResponse,\n} from \"./interface.ts\";\nimport { MediaPrefix } from \"./prefix.ts\";\nimport { type QueryDict, removeElement } from \"../utils.ts\";\nimport * as callbacks from \"../realtime-callbacks.ts\";\nimport { Method } from \"./method.ts\";\nimport { ConnectionError } from \"./errors.ts\";\nimport { parseErrorResponse } from \"./utils.ts\";\n\nexport * from \"./interface.ts\";\nexport * from \"./prefix.ts\";\nexport * from \"./errors.ts\";\nexport * from \"./method.ts\";\nexport * from \"./utils.ts\";\n\nexport class MatrixHttpApi<O extends IHttpOpts> extends FetchHttpApi<O> {\n private uploads: Upload[] = [];\n\n /**\n * Upload content to the homeserver\n *\n * @param file - The object to upload. On a browser, something that\n * can be sent to XMLHttpRequest.send (typically a File). Under node.js,\n * a Buffer, String or ReadStream.\n *\n * @param opts - options object\n *\n * @returns Promise which resolves to response object, or rejects with an error (usually a MatrixError).\n * @throws May throw a `MatrixSafetyError` if content is deemed unsafe.\n * @see MatrixSafetyError\n */\n public uploadContent(file: FileType, opts: UploadOpts = {}): Promise<UploadResponse> {\n const includeFilename = opts.includeFilename ?? true;\n const abortController = opts.abortController ?? new AbortController();\n\n // If the file doesn't have a mime type, use a default since the HS errors if we don't supply one.\n const contentType = (opts.type ?? (file as File).type) || \"application/octet-stream\";\n const fileName = opts.name ?? (file as File).name;\n\n const upload = {\n loaded: 0,\n total: 0,\n abortController,\n } as Upload;\n const uploadResolvers = Promise.withResolvers<UploadResponse>();\n\n if (globalThis.XMLHttpRequest) {\n const xhr = new globalThis.XMLHttpRequest();\n\n const timeoutFn = function (): void {\n xhr.abort();\n uploadResolvers.reject(new Error(\"Timeout\"));\n };\n\n // set an initial timeout of 30s; we'll advance it each time we get a progress notification\n let timeoutTimer = callbacks.setTimeout(timeoutFn, 30000);\n\n xhr.onreadystatechange = function (): void {\n switch (xhr.readyState) {\n case globalThis.XMLHttpRequest.DONE:\n callbacks.clearTimeout(timeoutTimer);\n try {\n if (xhr.status === 0) {\n throw new DOMException(xhr.statusText, \"AbortError\"); // mimic fetch API\n }\n if (!xhr.responseText) {\n throw new Error(\"No response body.\");\n }\n\n if (xhr.status >= 400) {\n uploadResolvers.reject(parseErrorResponse(xhr, xhr.responseText));\n } else {\n uploadResolvers.resolve(JSON.parse(xhr.responseText));\n }\n } catch (err) {\n if ((<Error>err).name === \"AbortError\") {\n uploadResolvers.reject(err);\n return;\n }\n uploadResolvers.reject(new ConnectionError(\"request failed\", <Error>err));\n }\n break;\n }\n };\n\n xhr.upload.onprogress = (ev: ProgressEvent): void => {\n callbacks.clearTimeout(timeoutTimer);\n upload.loaded = ev.loaded;\n upload.total = ev.total;\n timeoutTimer = callbacks.setTimeout(timeoutFn, 30000);\n opts.progressHandler?.({\n loaded: ev.loaded,\n total: ev.total,\n });\n };\n\n const url = this.getUrl(\"/upload\", undefined, MediaPrefix.V3);\n\n if (includeFilename && fileName) {\n url.searchParams.set(\"filename\", encodeURIComponent(fileName));\n }\n\n if (!this.opts.useAuthorizationHeader && this.opts.accessToken) {\n url.searchParams.set(\"access_token\", encodeURIComponent(this.opts.accessToken));\n }\n\n xhr.open(Method.Post, url.href);\n if (this.opts.useAuthorizationHeader && this.opts.accessToken) {\n xhr.setRequestHeader(\"Authorization\", \"Bearer \" + this.opts.accessToken);\n }\n xhr.setRequestHeader(\"Content-Type\", contentType);\n xhr.send(file);\n\n abortController.signal.addEventListener(\"abort\", () => {\n xhr.abort();\n });\n } else {\n const queryParams: QueryDict = {};\n if (includeFilename && fileName) {\n queryParams.filename = fileName;\n }\n\n const headers: Record<string, string> = { \"Content-Type\": contentType };\n\n this.authedRequest<UploadResponse>(Method.Post, \"/upload\", queryParams, file, {\n prefix: MediaPrefix.V3,\n headers,\n abortSignal: abortController.signal,\n }).then(uploadResolvers.resolve, uploadResolvers.reject);\n }\n\n // remove the upload from the list on completion\n upload.promise = uploadResolvers.promise.finally(() => {\n removeElement(this.uploads, (elem) => elem === upload);\n });\n abortController.signal.addEventListener(\"abort\", () => {\n removeElement(this.uploads, (elem) => elem === upload);\n uploadResolvers.reject(new DOMException(\"Aborted\", \"AbortError\"));\n });\n this.uploads.push(upload);\n return upload.promise;\n }\n\n public cancelUpload(promise: Promise<UploadResponse>): boolean {\n const upload = this.uploads.find((u) => u.promise === promise);\n if (upload) {\n upload.abortController.abort();\n return true;\n }\n return false;\n }\n\n public getCurrentUploads(): Upload[] {\n return this.uploads;\n }\n\n /**\n * Get the content repository url with query parameters.\n * @returns An object with a 'base', 'path' and 'params' for base URL,\n * path and query parameters respectively.\n */\n public getContentUri(): IContentUri {\n return {\n base: this.opts.baseUrl,\n path: MediaPrefix.V3 + \"/upload\",\n params: {\n access_token: this.opts.accessToken!,\n },\n };\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,YAAY,QAAQ,YAAY;AASzC,SAAS,WA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J,CAAC;EACL;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/http-api/index.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 { FetchHttpApi } from \"./fetch.ts\";\nimport { type FileType, type IHttpOpts, type Upload, type UploadOpts, type UploadResponse } from \"./interface.ts\";\nimport { MediaPrefix } from \"./prefix.ts\";\nimport { type QueryDict, removeElement } from \"../utils.ts\";\nimport * as callbacks from \"../realtime-callbacks.ts\";\nimport { Method } from \"./method.ts\";\nimport { ConnectionError } from \"./errors.ts\";\nimport { parseErrorResponse } from \"./utils.ts\";\n\nexport * from \"./interface.ts\";\nexport * from \"./prefix.ts\";\nexport * from \"./errors.ts\";\nexport * from \"./method.ts\";\nexport * from \"./utils.ts\";\n\nexport class MatrixHttpApi<O extends IHttpOpts> extends FetchHttpApi<O> {\n private uploads: Upload[] = [];\n\n /**\n * Upload content to the homeserver\n *\n * @param file - The object to upload. On a browser, something that\n * can be sent to XMLHttpRequest.send (typically a File). Under node.js,\n * a Buffer, String or ReadStream.\n *\n * @param opts - options object\n *\n * @returns Promise which resolves to response object, or rejects with an error (usually a MatrixError).\n * @throws May throw a `MatrixSafetyError` if content is deemed unsafe.\n * @see MatrixSafetyError\n */\n public uploadContent(file: FileType, opts: UploadOpts = {}): Promise<UploadResponse> {\n const includeFilename = opts.includeFilename ?? true;\n const abortController = opts.abortController ?? new AbortController();\n\n // If the file doesn't have a mime type, use a default since the HS errors if we don't supply one.\n const contentType = (opts.type ?? (file as File).type) || \"application/octet-stream\";\n const fileName = opts.name ?? (file as File).name;\n\n const upload = {\n loaded: 0,\n total: 0,\n abortController,\n } as Upload;\n const uploadResolvers = Promise.withResolvers<UploadResponse>();\n\n if (globalThis.XMLHttpRequest) {\n const xhr = new globalThis.XMLHttpRequest();\n\n const timeoutFn = function (): void {\n xhr.abort();\n uploadResolvers.reject(new Error(\"Timeout\"));\n };\n\n // set an initial timeout of 30s; we'll advance it each time we get a progress notification\n let timeoutTimer = callbacks.setTimeout(timeoutFn, 30000);\n\n xhr.onreadystatechange = function (): void {\n switch (xhr.readyState) {\n case globalThis.XMLHttpRequest.DONE:\n callbacks.clearTimeout(timeoutTimer);\n try {\n if (xhr.status === 0) {\n throw new DOMException(xhr.statusText, \"AbortError\"); // mimic fetch API\n }\n if (!xhr.responseText) {\n throw new Error(\"No response body.\");\n }\n\n if (xhr.status >= 400) {\n uploadResolvers.reject(parseErrorResponse(xhr, xhr.responseText));\n } else {\n uploadResolvers.resolve(JSON.parse(xhr.responseText));\n }\n } catch (err) {\n if ((<Error>err).name === \"AbortError\") {\n uploadResolvers.reject(err);\n return;\n }\n uploadResolvers.reject(new ConnectionError(\"request failed\", <Error>err));\n }\n break;\n }\n };\n\n xhr.upload.onprogress = (ev: ProgressEvent): void => {\n callbacks.clearTimeout(timeoutTimer);\n upload.loaded = ev.loaded;\n upload.total = ev.total;\n timeoutTimer = callbacks.setTimeout(timeoutFn, 30000);\n opts.progressHandler?.({\n loaded: ev.loaded,\n total: ev.total,\n });\n };\n\n const url = this.getUrl(\"/upload\", undefined, MediaPrefix.V3);\n\n if (includeFilename && fileName) {\n url.searchParams.set(\"filename\", encodeURIComponent(fileName));\n }\n\n if (!this.opts.useAuthorizationHeader && this.opts.accessToken) {\n url.searchParams.set(\"access_token\", encodeURIComponent(this.opts.accessToken));\n }\n\n xhr.open(Method.Post, url.href);\n if (this.opts.useAuthorizationHeader && this.opts.accessToken) {\n xhr.setRequestHeader(\"Authorization\", \"Bearer \" + this.opts.accessToken);\n }\n xhr.setRequestHeader(\"Content-Type\", contentType);\n xhr.send(file);\n\n abortController.signal.addEventListener(\"abort\", () => {\n xhr.abort();\n });\n } else {\n const queryParams: QueryDict = {};\n if (includeFilename && fileName) {\n queryParams.filename = fileName;\n }\n\n const headers: Record<string, string> = { \"Content-Type\": contentType };\n\n this.authedRequest<UploadResponse>(Method.Post, \"/upload\", queryParams, file, {\n prefix: MediaPrefix.V3,\n headers,\n abortSignal: abortController.signal,\n }).then(uploadResolvers.resolve, uploadResolvers.reject);\n }\n\n // remove the upload from the list on completion\n upload.promise = uploadResolvers.promise.finally(() => {\n removeElement(this.uploads, (elem) => elem === upload);\n });\n abortController.signal.addEventListener(\"abort\", () => {\n removeElement(this.uploads, (elem) => elem === upload);\n uploadResolvers.reject(new DOMException(\"Aborted\", \"AbortError\"));\n });\n this.uploads.push(upload);\n return upload.promise;\n }\n\n public cancelUpload(promise: Promise<UploadResponse>): boolean {\n const upload = this.uploads.find((u) => u.promise === promise);\n if (upload) {\n upload.abortController.abort();\n return true;\n }\n return false;\n }\n\n public getCurrentUploads(): Upload[] {\n return this.uploads;\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,YAAY,QAAQ,YAAY;AAEzC,SAAS,WAAW,QAAQ,aAAa;AACzC,SAAyB,aAAa,QAAQ,aAAa;AAC3D,OAAO,KAAK,SAAS,MAAM,0BAA0B;AACrD,SAAS,MAAM,QAAQ,aAAa;AACpC,SAAS,eAAe,QAAQ,aAAa;AAC7C,SAAS,kBAAkB,QAAQ,YAAY;AAE/C,cAAc,gBAAgB;AAC9B,cAAc,aAAa;AAC3B,cAAc,aAAa;AAC3B,cAAc,aAAa;AAC3B,cAAc,YAAY;AAE1B,OAAO,MAAM,aAAa,SAA8B,YAAY,CAAI;EAAA;IAAA;IAAA,iCACxC,EAAE;EAAA;EAE9B;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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O,EAAE,MAAM;MACnD,aAAa,CAAC,IAAI,CAAC,OAAO,EAAG,IAAI,IAAK,IAAI,KAAK,MAAM,CAAC;MACtD,eAAe,CAAC,MAAM,CAAC,IAAI,YAAY,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IACrE,CAAC,CAAC;IACF,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;IACzB,OAAO,MAAM,CAAC,OAAO;EACzB;EAEO,YAAY,CAAC,OAAgC,EAAW;IAC3D,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAE,CAAC,IAAK,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC;IAC9D,IAAI,MAAM,EAAE;MACR,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;MAC9B,OAAO,IAAI;IACf;IACA,OAAO,KAAK;EAChB;EAEO,iBAAiB,GAAa;IACjC,OAAO,IAAI,CAAC,OAAO;EACvB;AACJ","ignoreList":[]}
@@ -3,7 +3,6 @@ import { type Logger } from "../logger.ts";
3
3
  import { type QueryDict } from "../utils.ts";
4
4
  export type Body = Record<string, any> | BodyInit;
5
5
  /**
6
- * @experimental
7
6
  * Unencrypted access and (optional) refresh token
8
7
  */
9
8
  export type AccessTokens = {
@@ -21,7 +20,6 @@ export type AccessTokens = {
21
20
  expiry?: Date;
22
21
  };
23
22
  /**
24
- * @experimental
25
23
  * Function that performs token refresh using the given refreshToken.
26
24
  * Returns a promise that resolves to the refreshed access and (optional) refresh tokens.
27
25
  *
@@ -108,13 +106,6 @@ export interface IRequestOpts extends BaseRequestOpts {
108
106
  prefix?: string;
109
107
  inhibitLogoutEmit?: boolean;
110
108
  }
111
- export interface IContentUri {
112
- base: string;
113
- path: string;
114
- params: {
115
- access_token: string;
116
- };
117
- }
118
109
  export declare enum HttpApiEvent {
119
110
  SessionLoggedOut = "Session.logged_out",
120
111
  NoConsent = "no_consent"
@@ -1 +1 @@
1
- {"version":3,"file":"interface.d.ts","source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SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3E,CAAC;AAEF,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACvB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,eAAe,CAAC,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAC;IACjD,eAAe,CAAC,EAAE,eAAe,CAAC;CACrC;AAED,MAAM,WAAW,MAAM;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACjC,eAAe,EAAE,eAAe,CAAC;CACpC;AAED,MAAM,WAAW,cAAc;IAC3B,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,QAAQ,GAAG,sBAAsB,CAAC"}
@@ -15,12 +15,10 @@ limitations under the License.
15
15
  */
16
16
 
17
17
  /**
18
- * @experimental
19
18
  * Unencrypted access and (optional) refresh token
20
19
  */
21
20
 
22
21
  /**
23
- * @experimental
24
22
  * Function that performs token refresh using the given refreshToken.
25
23
  * Returns a promise that resolves to the refreshed access and (optional) refresh tokens.
26
24
  *
@@ -1 +1 @@
1
- {"version":3,"file":"interface.js","names":[],"sources":["../../src/http-api/interface.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 MatrixError } from \"./errors.ts\";\nimport { type Logger } from \"../logger.ts\";\nimport { type QueryDict } from \"../utils.ts\";\n\nexport type Body = Record<string, any> | BodyInit;\n\n/**\n * @experimental\n * Unencrypted access and (optional) refresh token\n */\nexport type AccessTokens = {\n /**\n * The new access token to use for authenticated requests\n */\n accessToken: string;\n /**\n * The new refresh token to use for refreshing tokens, optional\n */\n refreshToken?: string;\n /**\n * Approximate date when the access token will expire, optional\n */\n expiry?: Date;\n};\n\n/**\n * @experimental\n * Function that performs token refresh using the given refreshToken.\n * Returns a promise that resolves to the refreshed access and (optional) refresh tokens.\n *\n * Can be passed to HttpApi instance as {@link IHttpOpts.tokenRefreshFunction} during client creation {@link ICreateClientOpts}\n */\nexport type TokenRefreshFunction = (refreshToken: string) => Promise<AccessTokens>;\n\n/** Options object for `FetchHttpApi` and {@link MatrixHttpApi}. */\nexport interface IHttpOpts {\n fetchFn?: typeof globalThis.fetch;\n\n baseUrl: string;\n idBaseUrl?: string;\n prefix: string;\n extraParams?: QueryDict;\n\n accessToken?: string;\n /**\n * Used in conjunction with tokenRefreshFunction to attempt token refresh\n */\n refreshToken?: string;\n /**\n * Function to attempt token refresh when a possibly expired token is encountered\n * Optional, only called when a refreshToken is present\n */\n tokenRefreshFunction?: TokenRefreshFunction;\n\n /**\n * Whether to use the HTTP Authorization header over the `access_token` query parameter\n * @deprecated as of v1.11 in https://spec.matrix.org/v1.17/client-server-api/#using-access-tokens\n */\n useAuthorizationHeader?: boolean; // defaults to true\n\n /** For historical reasons, must be set to `true`. Will eventually be removed. */\n onlyData?: boolean;\n\n localTimeoutMs?: number;\n\n /** Optional logger instance. If provided, requests and responses will be logged. */\n logger?: Logger;\n}\n\n/** Options object for `FetchHttpApi.requestOtherUrl`. */\nexport interface BaseRequestOpts extends Pick<RequestInit, \"priority\"> {\n /**\n * map of additional request headers\n */\n headers?: Record<string, string>;\n abortSignal?: AbortSignal;\n /**\n * The maximum amount of time to wait before\n * timing out the request. If not specified, there is no timeout.\n */\n localTimeoutMs?: number;\n keepAlive?: boolean; // defaults to false\n\n /**\n * By default, we will:\n *\n * * If the `body` is an object, JSON-encode it and set `Content-Type: application/json` in the\n * request headers (unless overridden by {@link headers}).\n *\n * * Set `Accept: application/json` in the request headers (again, unless overridden by {@link headers}).\n *\n * * Parse the response as JSON and return the parsed response.\n *\n * Setting this to `false` inhibits all three behaviors, and the response is instead parsed as a UTF-8 string. It\n * defaults to `true`, unless {@link rawResponseBody} is set.\n *\n * @deprecated Instead of setting this to `false`, set {@link rawResponseBody} to `true`.\n */\n json?: boolean;\n\n /**\n * Setting this to `true` does two things:\n *\n * * Inhibits the automatic addition of `Accept: application/json` in the request headers.\n *\n * * Causes the raw response to be returned as a {@link https://developer.mozilla.org/en-US/docs/Web/API/Blob|Blob}\n * instead of parsing it as JSON.\n */\n rawResponseBody?: boolean;\n}\n\nexport interface IRequestOpts extends BaseRequestOpts {\n /**\n * The alternative base url to use.\n * If not specified, uses this.opts.baseUrl\n */\n baseUrl?: string;\n /**\n * The full prefix to use e.g.\n * \"/_matrix/client/v2_alpha\". If not specified, uses this.opts.prefix.\n */\n prefix?: string;\n\n // Set to true to prevent the request function from emitting a Session.logged_out event.\n // This is intended for use on endpoints where M_UNKNOWN_TOKEN is a valid/notable error response,\n // such as with token refreshes.\n inhibitLogoutEmit?: boolean;\n}\n\nexport interface IContentUri {\n base: string;\n path: string;\n params: {\n // eslint-disable-next-line camelcase\n access_token: string;\n };\n}\n\nexport enum HttpApiEvent {\n SessionLoggedOut = \"Session.logged_out\",\n NoConsent = \"no_consent\",\n}\n\nexport type HttpApiEventHandlerMap = {\n /**\n * Fires whenever the login session the JS SDK is using is no\n * longer valid and the user must log in again.\n * NB. This only fires when action is required from the user, not\n * when then login session can be renewed by using a refresh token.\n * @example\n * ```\n * matrixClient.on(\"Session.logged_out\", function(errorObj){\n * // show the login screen\n * });\n * ```\n */\n [HttpApiEvent.SessionLoggedOut]: (err: MatrixError) => void;\n /**\n * Fires when the JS SDK receives a M_CONSENT_NOT_GIVEN error in response\n * to a HTTP request.\n * @example\n * ```\n * matrixClient.on(\"no_consent\", function(message, contentUri) {\n * console.info(message + ' Go to ' + contentUri);\n * });\n * ```\n */\n [HttpApiEvent.NoConsent]: (message: string, consentUri: string) => void;\n};\n\nexport interface UploadProgress {\n loaded: number;\n total: number;\n}\n\nexport interface UploadOpts {\n /**\n * Name to give the file on the server. Defaults to <tt>file.name</tt>.\n */\n name?: string;\n /**\n * Content-type for the upload. Defaults to\n * <tt>file.type</tt>, or <tt>applicaton/octet-stream</tt>.\n */\n type?: string;\n /**\n * if false will not send the filename,\n * e.g for encrypted file uploads where filename leaks are undesirable.\n * Defaults to true.\n */\n includeFilename?: boolean;\n /**\n * Optional. Called when a chunk of\n * data has been uploaded, with an object containing the fields `loaded`\n * (number of bytes transferred) and `total` (total size, if known).\n */\n progressHandler?(progress: UploadProgress): void;\n abortController?: AbortController;\n}\n\nexport interface Upload {\n loaded: number;\n total: number;\n promise: Promise<UploadResponse>;\n abortController: AbortController;\n}\n\nexport interface UploadResponse {\n // eslint-disable-next-line camelcase\n content_uri: string;\n}\n\nexport type FileType = XMLHttpRequestBodyInit;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;;AAmCA;;AAqEA,WAAY,YAAY,0BAAZ,YAAY;EAAZ,YAAY;EAAZ,YAAY;EAAA,OAAZ,YAAY;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"interface.js","names":[],"sources":["../../src/http-api/interface.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 MatrixError } from \"./errors.ts\";\nimport { type Logger } from \"../logger.ts\";\nimport { type QueryDict } from \"../utils.ts\";\n\nexport type Body = Record<string, any> | BodyInit;\n\n/**\n * Unencrypted access and (optional) refresh token\n */\nexport type AccessTokens = {\n /**\n * The new access token to use for authenticated requests\n */\n accessToken: string;\n /**\n * The new refresh token to use for refreshing tokens, optional\n */\n refreshToken?: string;\n /**\n * Approximate date when the access token will expire, optional\n */\n expiry?: Date;\n};\n\n/**\n * Function that performs token refresh using the given refreshToken.\n * Returns a promise that resolves to the refreshed access and (optional) refresh tokens.\n *\n * Can be passed to HttpApi instance as {@link IHttpOpts.tokenRefreshFunction} during client creation {@link ICreateClientOpts}\n */\nexport type TokenRefreshFunction = (refreshToken: string) => Promise<AccessTokens>;\n\n/** Options object for `FetchHttpApi` and {@link MatrixHttpApi}. */\nexport interface IHttpOpts {\n fetchFn?: typeof globalThis.fetch;\n\n baseUrl: string;\n idBaseUrl?: string;\n prefix: string;\n extraParams?: QueryDict;\n\n accessToken?: string;\n /**\n * Used in conjunction with tokenRefreshFunction to attempt token refresh\n */\n refreshToken?: string;\n /**\n * Function to attempt token refresh when a possibly expired token is encountered\n * Optional, only called when a refreshToken is present\n */\n tokenRefreshFunction?: TokenRefreshFunction;\n\n /**\n * Whether to use the HTTP Authorization header over the `access_token` query parameter\n * @deprecated as of v1.11 in https://spec.matrix.org/v1.17/client-server-api/#using-access-tokens\n */\n useAuthorizationHeader?: boolean; // defaults to true\n\n /** For historical reasons, must be set to `true`. Will eventually be removed. */\n onlyData?: boolean;\n\n localTimeoutMs?: number;\n\n /** Optional logger instance. If provided, requests and responses will be logged. */\n logger?: Logger;\n}\n\n/** Options object for `FetchHttpApi.requestOtherUrl`. */\nexport interface BaseRequestOpts extends Pick<RequestInit, \"priority\"> {\n /**\n * map of additional request headers\n */\n headers?: Record<string, string>;\n abortSignal?: AbortSignal;\n /**\n * The maximum amount of time to wait before\n * timing out the request. If not specified, there is no timeout.\n */\n localTimeoutMs?: number;\n keepAlive?: boolean; // defaults to false\n\n /**\n * By default, we will:\n *\n * * If the `body` is an object, JSON-encode it and set `Content-Type: application/json` in the\n * request headers (unless overridden by {@link headers}).\n *\n * * Set `Accept: application/json` in the request headers (again, unless overridden by {@link headers}).\n *\n * * Parse the response as JSON and return the parsed response.\n *\n * Setting this to `false` inhibits all three behaviors, and the response is instead parsed as a UTF-8 string. It\n * defaults to `true`, unless {@link rawResponseBody} is set.\n *\n * @deprecated Instead of setting this to `false`, set {@link rawResponseBody} to `true`.\n */\n json?: boolean;\n\n /**\n * Setting this to `true` does two things:\n *\n * * Inhibits the automatic addition of `Accept: application/json` in the request headers.\n *\n * * Causes the raw response to be returned as a {@link https://developer.mozilla.org/en-US/docs/Web/API/Blob|Blob}\n * instead of parsing it as JSON.\n */\n rawResponseBody?: boolean;\n}\n\nexport interface IRequestOpts extends BaseRequestOpts {\n /**\n * The alternative base url to use.\n * If not specified, uses this.opts.baseUrl\n */\n baseUrl?: string;\n /**\n * The full prefix to use e.g.\n * \"/_matrix/client/v2_alpha\". If not specified, uses this.opts.prefix.\n */\n prefix?: string;\n\n // Set to true to prevent the request function from emitting a Session.logged_out event.\n // This is intended for use on endpoints where M_UNKNOWN_TOKEN is a valid/notable error response,\n // such as with token refreshes.\n inhibitLogoutEmit?: boolean;\n}\n\nexport enum HttpApiEvent {\n SessionLoggedOut = \"Session.logged_out\",\n NoConsent = \"no_consent\",\n}\n\nexport type HttpApiEventHandlerMap = {\n /**\n * Fires whenever the login session the JS SDK is using is no\n * longer valid and the user must log in again.\n * NB. This only fires when action is required from the user, not\n * when then login session can be renewed by using a refresh token.\n * @example\n * ```\n * matrixClient.on(\"Session.logged_out\", function(errorObj){\n * // show the login screen\n * });\n * ```\n */\n [HttpApiEvent.SessionLoggedOut]: (err: MatrixError) => void;\n /**\n * Fires when the JS SDK receives a M_CONSENT_NOT_GIVEN error in response\n * to a HTTP request.\n * @example\n * ```\n * matrixClient.on(\"no_consent\", function(message, contentUri) {\n * console.info(message + ' Go to ' + contentUri);\n * });\n * ```\n */\n [HttpApiEvent.NoConsent]: (message: string, consentUri: string) => void;\n};\n\nexport interface UploadProgress {\n loaded: number;\n total: number;\n}\n\nexport interface UploadOpts {\n /**\n * Name to give the file on the server. Defaults to <tt>file.name</tt>.\n */\n name?: string;\n /**\n * Content-type for the upload. Defaults to\n * <tt>file.type</tt>, or <tt>applicaton/octet-stream</tt>.\n */\n type?: string;\n /**\n * if false will not send the filename,\n * e.g for encrypted file uploads where filename leaks are undesirable.\n * Defaults to true.\n */\n includeFilename?: boolean;\n /**\n * Optional. Called when a chunk of\n * data has been uploaded, with an object containing the fields `loaded`\n * (number of bytes transferred) and `total` (total size, if known).\n */\n progressHandler?(progress: UploadProgress): void;\n abortController?: AbortController;\n}\n\nexport interface Upload {\n loaded: number;\n total: number;\n promise: Promise<UploadResponse>;\n abortController: AbortController;\n}\n\nexport interface UploadResponse {\n content_uri: string;\n}\n\nexport type FileType = XMLHttpRequestBodyInit;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA;;AAGA;;AAmCA;;AA4DA,WAAY,YAAY,0BAAZ,YAAY;EAAZ,YAAY;EAAZ,YAAY;EAAA,OAAZ,YAAY;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../../src/http-api/refresh.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD;;GAEG;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qBAAa,cAAc;IACJ,OAAO,CAAC,QAAQ,CAAC,IAAI;IAAxC,YAAoC,IAAI,EAAE,IAAI,EAAI;IAElD;;;OAGG;IACH,OAAO,CAAC,mBAAmB,CAAC,CAA+B;IAE3D,OAAO,CAAC,wBAAwB,CAAC,CAAO;IAExC;;;;OAIG;IACU,iBAAiB,IAAI,OAAO,CAAC,QAAQ,CAAC,CASlD;YAEa,eAAe;IAa7B;;;;;;OAMG;IACU,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAEjG;YAEa,mBAAmB;IA6BjC;;;;OAIG;YACW,cAAc;CAgC/B"}
@@ -83,9 +83,6 @@ export class TokenRefresher {
83
83
  async handleUnknownToken(snapshot, attempt) {
84
84
  return this._handleUnknownToken(snapshot, attempt);
85
85
  }
86
-
87
- /* eslint-disable @typescript-eslint/naming-convention */
88
-
89
86
  async _handleUnknownToken(snapshot, attempt) {
90
87
  if (snapshot?.expiry) {
91
88
  // If our token is unknown, but it should not have expired yet, then we should not refresh
@@ -1 +1 @@
1
- {"version":3,"file":"refresh.js","names":[],"sources":["../../src/http-api/refresh.ts"],"sourcesContent":["/*\nCopyright 2025 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 { MatrixError, TokenRefreshLogoutError } from \"./errors.ts\";\nimport { type IHttpOpts } from \"./interface.ts\";\nimport { sleep } from \"../utils.ts\";\n\n/**\n * This is an internal module. See {@link MatrixHttpApi} for the public class.\n */\n\nexport const enum TokenRefreshOutcome {\n Success = \"success\",\n Failure = \"failure\",\n Logout = \"logout\",\n}\n\ninterface Snapshot {\n accessToken: string;\n refreshToken?: string;\n expiry?: Date;\n}\n\n// If the token expires in less than this time amount of time, we will eagerly refresh it before making the intended request.\nconst REFRESH_IF_TOKEN_EXPIRES_WITHIN_MS = 500;\n// If we get an unknown token error and the token expires in less than this time amount of time, we will refresh it before making the intended request.\n// Otherwise, we will error as the token should not have expired yet and we need to avoid retrying indefinitely.\nconst REFRESH_ON_ERROR_IF_TOKEN_EXPIRES_WITHIN_MS = 60 * 1000;\n\ntype Opts = Pick<IHttpOpts, \"tokenRefreshFunction\" | \"logger\" | \"refreshToken\" | \"accessToken\">;\n\n/**\n * This class is responsible for managing the access token and refresh token for authenticated requests.\n * It will automatically refresh the access token when it is about to expire, and will handle unknown token errors.\n */\nexport class TokenRefresher {\n public constructor(private readonly opts: Opts) {}\n\n /**\n * Promise used to block authenticated requests during a token refresh to avoid repeated expected errors.\n * @private\n */\n private tokenRefreshPromise?: Promise<TokenRefreshOutcome>;\n\n private latestTokenRefreshExpiry?: Date;\n\n /**\n * This function is called before every request to ensure that the access token is valid.\n * @returns a snapshot containing the access token and other properties which must be passed to the handleUnknownToken\n * handler if an M_UNKNOWN_TOKEN error is encountered.\n */\n public async prepareForRequest(): Promise<Snapshot> {\n // Ensure our token is refreshed before we build the headers/params\n await this.refreshIfNeeded();\n\n return {\n accessToken: this.opts.accessToken!,\n refreshToken: this.opts.refreshToken,\n expiry: this.latestTokenRefreshExpiry,\n };\n }\n\n private async refreshIfNeeded(): Promise<unknown> {\n if (this.tokenRefreshPromise) {\n return this.tokenRefreshPromise;\n }\n // If we don't know the token expiry, we can't eagerly refresh\n if (!this.latestTokenRefreshExpiry) return;\n\n const expiresIn = this.latestTokenRefreshExpiry.getTime() - Date.now();\n if (expiresIn <= REFRESH_IF_TOKEN_EXPIRES_WITHIN_MS) {\n await this._handleUnknownToken();\n }\n }\n\n /**\n * This function is called when an M_UNKNOWN_TOKEN error is encountered.\n * It will attempt to refresh the access token if it is unknown, and will return a TokenRefreshOutcome.\n * @param snapshot - the snapshot returned by prepareForRequest\n * @param attempt - the number of attempts made for this request so far\n * @returns a TokenRefreshOutcome indicating the result of the refresh attempt\n */\n public async handleUnknownToken(snapshot: Snapshot, attempt: number): Promise<TokenRefreshOutcome> {\n return this._handleUnknownToken(snapshot, attempt);\n }\n\n /* eslint-disable @typescript-eslint/naming-convention */\n private async _handleUnknownToken(): Promise<TokenRefreshOutcome>;\n private async _handleUnknownToken(snapshot: Snapshot, attempt: number): Promise<TokenRefreshOutcome>;\n private async _handleUnknownToken(snapshot?: Snapshot, attempt?: number): Promise<TokenRefreshOutcome> {\n if (snapshot?.expiry) {\n // If our token is unknown, but it should not have expired yet, then we should not refresh\n const expiresIn = snapshot.expiry.getTime() - Date.now();\n // If it still has plenty of time left on the clock, we assume something else must be wrong and\n // do not refresh. Otherwise if it's expired, or will soon, we try refreshing.\n if (expiresIn >= REFRESH_ON_ERROR_IF_TOKEN_EXPIRES_WITHIN_MS) {\n return TokenRefreshOutcome.Logout;\n }\n }\n\n if (!snapshot || snapshot?.accessToken === this.opts.accessToken) {\n // If we have a snapshot, but the access token is the same as the current one then a refresh\n // did not happen behind us but one may be ongoing anyway\n this.tokenRefreshPromise ??= this.doTokenRefresh(attempt);\n\n try {\n return await this.tokenRefreshPromise;\n } finally {\n this.tokenRefreshPromise = undefined;\n }\n }\n\n // We may end up here if the token was refreshed in the background due to another request\n return TokenRefreshOutcome.Success;\n }\n\n /**\n * Attempt to refresh access tokens.\n * On success, sets new access and refresh tokens in opts.\n * @returns Promise that resolves to a boolean - true when token was refreshed successfully\n */\n private async doTokenRefresh(attempt?: number): Promise<TokenRefreshOutcome> {\n if (!this.opts.refreshToken || !this.opts.tokenRefreshFunction) {\n this.opts.logger?.error(\"Unable to refresh token - no refresh token or refresh function\");\n return TokenRefreshOutcome.Logout;\n }\n\n if (attempt && attempt > 1) {\n // Exponential backoff to ensure we don't trash the server, up to 2^5 seconds\n await sleep(1000 * Math.min(32, 2 ** attempt));\n }\n\n try {\n this.opts.logger?.debug(\"Attempting to refresh token\");\n const { accessToken, refreshToken, expiry } = await this.opts.tokenRefreshFunction(this.opts.refreshToken);\n this.opts.accessToken = accessToken;\n this.opts.refreshToken = refreshToken;\n this.latestTokenRefreshExpiry = expiry;\n this.opts.logger?.debug(\"... token refresh complete, new token expiry:\", expiry);\n\n // successfully got new tokens\n return TokenRefreshOutcome.Success;\n } catch (error) {\n // If we get a TokenError or MatrixError, we should log out, otherwise assume transient\n if (error instanceof TokenRefreshLogoutError || error instanceof MatrixError) {\n this.opts.logger?.error(\"Failed to refresh token\", error);\n return TokenRefreshOutcome.Logout;\n }\n\n this.opts.logger?.warn(\"Failed to refresh token\", error);\n return TokenRefreshOutcome.Failure;\n }\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,WAAW,EAAE,uBAAuB,QAAQ,aAAa;AAElE,SAAS,KAAK,QAAQ,aAAa;;AAEnC;AACA;AACA;;AAEA,WAAkB,mBAAmB,0BAAnB,mBAAmB;EAAnB,mBAAmB;EAAnB,mBAAmB;EAAnB,mBAAmB;EAAA,OAAnB,mBAAmB;AAAA;AAYrC;AACA,MAAM,kCAAkC,GAAG,GAAG;AAC9C;AACA;AACA,MAAM,2CAA2C,GAAG,EAAE,GAAG,IAAI;AAI7D;AACA;AACA;AACA;AACA,OAAO,MAAM,cAAc,CAAC;EACjB,WAAW,CAAkB,IAAU,EAAE;IAEhD;AACJ;AACA;AACA;IAHI;IAAA;IAAA,KAFoC,IAAU,GAAV,IAAU;EAAG;EAUjD;AACJ;AACA;AACA;AACA;EACI,MAAa,iBAAiB,GAAsB;IAChD;IACA,MAAM,IAAI,CAAC,eAAe,CAAC,CAAC;IAE5B,OAAO;MACH,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,WAAY;MACnC,YAAY,EAAE,IAAI,CAAC,IAAI,CAA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AACJ","ignoreList":[]}
1
+ {"version":3,"file":"refresh.js","names":[],"sources":["../../src/http-api/refresh.ts"],"sourcesContent":["/*\nCopyright 2025 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 { MatrixError, TokenRefreshLogoutError } from \"./errors.ts\";\nimport { type IHttpOpts } from \"./interface.ts\";\nimport { sleep } from \"../utils.ts\";\n\n/**\n * This is an internal module. See {@link MatrixHttpApi} for the public class.\n */\n\nexport const enum TokenRefreshOutcome {\n Success = \"success\",\n Failure = \"failure\",\n Logout = \"logout\",\n}\n\ninterface Snapshot {\n accessToken: string;\n refreshToken?: string;\n expiry?: Date;\n}\n\n// If the token expires in less than this time amount of time, we will eagerly refresh it before making the intended request.\nconst REFRESH_IF_TOKEN_EXPIRES_WITHIN_MS = 500;\n// If we get an unknown token error and the token expires in less than this time amount of time, we will refresh it before making the intended request.\n// Otherwise, we will error as the token should not have expired yet and we need to avoid retrying indefinitely.\nconst REFRESH_ON_ERROR_IF_TOKEN_EXPIRES_WITHIN_MS = 60 * 1000;\n\ntype Opts = Pick<IHttpOpts, \"tokenRefreshFunction\" | \"logger\" | \"refreshToken\" | \"accessToken\">;\n\n/**\n * This class is responsible for managing the access token and refresh token for authenticated requests.\n * It will automatically refresh the access token when it is about to expire, and will handle unknown token errors.\n */\nexport class TokenRefresher {\n public constructor(private readonly opts: Opts) {}\n\n /**\n * Promise used to block authenticated requests during a token refresh to avoid repeated expected errors.\n * @private\n */\n private tokenRefreshPromise?: Promise<TokenRefreshOutcome>;\n\n private latestTokenRefreshExpiry?: Date;\n\n /**\n * This function is called before every request to ensure that the access token is valid.\n * @returns a snapshot containing the access token and other properties which must be passed to the handleUnknownToken\n * handler if an M_UNKNOWN_TOKEN error is encountered.\n */\n public async prepareForRequest(): Promise<Snapshot> {\n // Ensure our token is refreshed before we build the headers/params\n await this.refreshIfNeeded();\n\n return {\n accessToken: this.opts.accessToken!,\n refreshToken: this.opts.refreshToken,\n expiry: this.latestTokenRefreshExpiry,\n };\n }\n\n private async refreshIfNeeded(): Promise<unknown> {\n if (this.tokenRefreshPromise) {\n return this.tokenRefreshPromise;\n }\n // If we don't know the token expiry, we can't eagerly refresh\n if (!this.latestTokenRefreshExpiry) return;\n\n const expiresIn = this.latestTokenRefreshExpiry.getTime() - Date.now();\n if (expiresIn <= REFRESH_IF_TOKEN_EXPIRES_WITHIN_MS) {\n await this._handleUnknownToken();\n }\n }\n\n /**\n * This function is called when an M_UNKNOWN_TOKEN error is encountered.\n * It will attempt to refresh the access token if it is unknown, and will return a TokenRefreshOutcome.\n * @param snapshot - the snapshot returned by prepareForRequest\n * @param attempt - the number of attempts made for this request so far\n * @returns a TokenRefreshOutcome indicating the result of the refresh attempt\n */\n public async handleUnknownToken(snapshot: Snapshot, attempt: number): Promise<TokenRefreshOutcome> {\n return this._handleUnknownToken(snapshot, attempt);\n }\n\n private async _handleUnknownToken(): Promise<TokenRefreshOutcome>;\n private async _handleUnknownToken(snapshot: Snapshot, attempt: number): Promise<TokenRefreshOutcome>;\n private async _handleUnknownToken(snapshot?: Snapshot, attempt?: number): Promise<TokenRefreshOutcome> {\n if (snapshot?.expiry) {\n // If our token is unknown, but it should not have expired yet, then we should not refresh\n const expiresIn = snapshot.expiry.getTime() - Date.now();\n // If it still has plenty of time left on the clock, we assume something else must be wrong and\n // do not refresh. Otherwise if it's expired, or will soon, we try refreshing.\n if (expiresIn >= REFRESH_ON_ERROR_IF_TOKEN_EXPIRES_WITHIN_MS) {\n return TokenRefreshOutcome.Logout;\n }\n }\n\n if (!snapshot || snapshot?.accessToken === this.opts.accessToken) {\n // If we have a snapshot, but the access token is the same as the current one then a refresh\n // did not happen behind us but one may be ongoing anyway\n this.tokenRefreshPromise ??= this.doTokenRefresh(attempt);\n\n try {\n return await this.tokenRefreshPromise;\n } finally {\n this.tokenRefreshPromise = undefined;\n }\n }\n\n // We may end up here if the token was refreshed in the background due to another request\n return TokenRefreshOutcome.Success;\n }\n\n /**\n * Attempt to refresh access tokens.\n * On success, sets new access and refresh tokens in opts.\n * @returns Promise that resolves to a boolean - true when token was refreshed successfully\n */\n private async doTokenRefresh(attempt?: number): Promise<TokenRefreshOutcome> {\n if (!this.opts.refreshToken || !this.opts.tokenRefreshFunction) {\n this.opts.logger?.error(\"Unable to refresh token - no refresh token or refresh function\");\n return TokenRefreshOutcome.Logout;\n }\n\n if (attempt && attempt > 1) {\n // Exponential backoff to ensure we don't trash the server, up to 2^5 seconds\n await sleep(1000 * Math.min(32, 2 ** attempt));\n }\n\n try {\n this.opts.logger?.debug(\"Attempting to refresh token\");\n const { accessToken, refreshToken, expiry } = await this.opts.tokenRefreshFunction(this.opts.refreshToken);\n this.opts.accessToken = accessToken;\n this.opts.refreshToken = refreshToken;\n this.latestTokenRefreshExpiry = expiry;\n this.opts.logger?.debug(\"... token refresh complete, new token expiry:\", expiry);\n\n // successfully got new tokens\n return TokenRefreshOutcome.Success;\n } catch (error) {\n // If we get a TokenError or MatrixError, we should log out, otherwise assume transient\n if (error instanceof TokenRefreshLogoutError || error instanceof MatrixError) {\n this.opts.logger?.error(\"Failed to refresh token\", error);\n return TokenRefreshOutcome.Logout;\n }\n\n this.opts.logger?.warn(\"Failed to refresh token\", error);\n return TokenRefreshOutcome.Failure;\n }\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,WAAW,EAAE,uBAAuB,QAAQ,aAAa;AAElE,SAAS,KAAK,QAAQ,aAAa;;AAEnC;AACA;AACA;;AAEA,WAAkB,mBAAmB,0BAAnB,mB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,GAAG,YAAY;MACrC,IAAI,CAAC,wBAAwB,GAAG,MAAM;MACtC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,+CAA+C,EAAE,MAAM,CAAC;;MAEhF;MACA,OAAO,mBAAmB,CAAC,OAAO;IACtC,CAAC,CAAC,OAAO,KAAK,EAAE;MACZ;MACA,IAAI,KAAK,YAAY,uBAAuB,IAAI,KAAK,YAAY,WAAW,EAAE;QAC1E,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC;QACzD,OAAO,mBAAmB,CAAC,MAAM;MACrC;MAEA,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,yBAAyB,EAAE,KAAK,CAAC;MACxD,OAAO,mBAAmB,CAAC,OAAO;IACtC;EACJ;AACJ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AAOxC,cAAc,aAAa,CAAC;AAC5B,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AAOxC,cAAc,aAAa,CAAC;eACb,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-auth.d.ts","sourceRoot":"","sources":["../src/interactive-auth.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKvD,MAAM,WAAW,OAAO;IACpB,MAAM,EAAE,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,OAAO;IAEpB,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,YAA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UG;YACW,SAAS;IAqEvB;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;IAyB1B;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,SAAS;IASjB;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,UAAU;IAmClB;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;CAIhC"}
@@ -69,9 +69,7 @@ export let AuthType = /*#__PURE__*/function (AuthType) {
69
69
  */
70
70
 
71
71
  export class NoAuthFlowFoundError extends Error {
72
- constructor(m,
73
- // eslint-disable-next-line @typescript-eslint/naming-convention, camelcase
74
- required_stages, flows) {
72
+ constructor(m, required_stages, flows) {
75
73
  super(m);
76
74
  _defineProperty(this, "name", "NoAuthFlowFoundError");
77
75
  this.required_stages = required_stages;
@@ -282,12 +280,13 @@ export class InteractiveAuth {
282
280
  // if we're currently trying a request, wait for it to finish
283
281
  // as otherwise we can get multiple 200 responses which can mean
284
282
  // things like multiple logins for register requests.
285
- // (but discard any exceptions as we only care when its done,
286
- // not whether it worked or not)
287
283
  while (this.submitPromise) {
288
284
  try {
289
285
  await this.submitPromise;
290
- } catch {}
286
+ } catch {
287
+ // discard any exceptions as we only care when its done,
288
+ // not whether it worked or not
289
+ }
291
290
  }
292
291
 
293
292
  // use the sessionid from the last request, if one is present.