@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.
- package/dist/{account-config-BZWN9tGS.js → account-config-CRsKoMqJ.js} +1 -1
- package/dist/{account-selection-CWuhuFn1.js → account-selection-DA-jfx22.js} +74 -36
- package/dist/{accounts-BCzyubQt.js → accounts-DR1c4xF_.js} +4 -5
- package/dist/api.js +5 -5
- package/dist/{approval-handler.runtime-CSvueU9P.js → approval-handler.runtime-xcVrZw9o.js} +8 -6
- package/dist/{approval-ids-CEcf-EiM.js → approval-ids-hmvhDNBj.js} +1 -1
- package/dist/{approval-reaction-auth-CziKXatm.js → approval-reaction-auth-DziFGHSk.js} +2 -2
- package/dist/{approval-reactions-tXh9KYrW.js → approval-reactions-1fwEhoK9.js} +1 -1
- package/dist/{channel-CzQw5OZN.js → channel-D6-ajB_u.js} +70 -55
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-I9pBRQb3.js → channel.runtime-BMA0dG2k.js} +18 -14
- package/dist/{channel.setup-aNaa3Uyn.js → channel.setup-OIEzCzSs.js} +28 -21
- package/dist/{cli-iR6QJ5U0.js → cli-B6HF7Hmn.js} +43 -33
- package/dist/{cli-metadata-BmUYWjuM.js → cli-metadata-Mtzu5-AY.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{client-D8XghqmX.js → client-B0yMDho1.js} +2 -2
- package/dist/{client-BBQdBG7t.js → client-DFsRJEgB.js} +137 -75
- package/dist/{client-bootstrap-Co3RlItb.js → client-bootstrap-DjXCKEtg.js} +1 -1
- package/dist/{config-update-Bor_Pjsv.js → config-update-BnX26jCO.js} +48 -31
- package/dist/contract-api.js +2 -2
- package/dist/{credentials-BdAaWuiR.js → credentials-DJj2xs3q.js} +4 -8
- package/dist/{credentials-read-B37cQknZ.js → credentials-read-mexhw-Ur.js} +7 -5
- package/dist/{credentials-write.runtime-nAV2-5uR.js → credentials-write.runtime-DQt-kgJq.js} +1 -1
- package/dist/{crypto-runtime-Bnz3zEcS.js → crypto-runtime-QvlgyCkj.js} +6 -6
- package/dist/{deps-CcVJfvRM.js → deps-mtxF2mHI.js} +1 -1
- package/dist/{directory-live-DLQzel12.js → directory-live-Drh343TW.js} +8 -6
- package/dist/{doctor-EWf9CDso.js → doctor-CJE8wO6y.js} +1 -1
- package/dist/{doctor-contract-DEt4O4Zt.js → doctor-contract-HyWFZQVG.js} +5 -4
- package/dist/doctor-contract-api.js +7 -7
- package/dist/{draft-stream-DQ7QNC-l.js → draft-stream-DhGHVdO4.js} +1 -1
- package/dist/{encryption-guidance-DmLY8NiO.js → encryption-guidance-BNcZNQZI.js} +3 -2
- package/dist/event-helpers-XRfAbOIh.js +46 -0
- package/dist/helper-api.js +1 -1
- package/dist/{http-client-CycYxU9-.js → http-client-DOmFvKvB.js} +13 -54
- package/dist/{idb-persistence-BM0P27Zg.js → idb-persistence-D4NGNQxt.js} +3 -3
- package/dist/{idb-persistence-lock-DAJ49nZX.js → idb-persistence-lock-B3fZXyF_.js} +1 -1
- package/dist/{inbound-dedupe-RvSLqdsz.js → inbound-dedupe-Ch33GU06.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{messages-DEqg7HVy.js → messages-DlMQaC02.js} +161 -25
- package/dist/{monitor-FNrfkuWL.js → monitor-U2LcVtHt.js} +232 -203
- package/dist/plugin-entry.handlers.runtime.js +1 -1
- package/dist/probe.runtime-CNo-5_iz.js +2 -0
- package/dist/{profile-update-BQlE5s2J.js → profile-update-CsyKA9jI.js} +5 -4
- package/dist/{profile-D-Wubo0A.js → profile-vmjsmhh4.js} +1 -1
- package/dist/{reaction-events-BKOLlnCo.js → reaction-events-lwNc5I1X.js} +10 -8
- package/dist/{resolve-targets-e7AI0P75.js → resolve-targets-D3Eakgzs.js} +1 -1
- package/dist/{resolver.runtime-V8u0pHEb.js → resolver.runtime-DJQxR35r.js} +1 -1
- package/dist/{room-info-BXQA7y10.js → room-info-DIU67XLP.js} +55 -1
- package/dist/runtime-api.js +2 -2
- package/dist/{sdk-NxK3vzMa.js → sdk-Jl2CgAbJ.js} +573 -47
- package/dist/{send-ClHgDZLT.js → send-DfS5ciUL.js} +57 -34
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/{setup-bootstrap-BGPjbA5N.js → setup-bootstrap-CWoIWudw.js} +3 -3
- package/dist/{setup-core-DigrLebY.js → setup-core-CZM496H-.js} +8 -7
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-Dtn8sAWs.js → setup-surface-DSZtOsWK.js} +84 -79
- package/dist/{startup-verification-Cs08ca8u.js → startup-verification-1Ney1mmI.js} +2 -2
- package/dist/{storage-BsGuHngK.js → storage-BVf4uucD.js} +5 -4
- package/dist/{subagent-hooks-CMoZaARG.js → subagent-hooks-DeICLbU5.js} +5 -1
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/sync-cache-state-d-A_OhbU.js +234 -0
- package/dist/{thread-bindings-BYEGfw3h.js → thread-bindings-2HN2AyLu.js} +4 -4
- package/dist/{tool-actions.runtime-ck6IJyP0.js → tool-actions.runtime-CFZZPG5g.js} +267 -213
- package/dist/{verification-CabtBTtB.js → verification-CD7k5vE9.js} +2 -2
- package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/CHANGELOG.md +29 -3
- package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/README.md +23 -14
- package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/RELEASING.md +6 -2
- package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/download-lib.js +33 -14
- package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/index.d.ts +14 -0
- package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/package.json +41 -42
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/package.json +1 -1
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm.d.ts +16 -4
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.cjs +25 -9
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.js +23 -7
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm +0 -0
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm.d.ts +1 -0
- package/node_modules/markdown-it/README.md +18 -294
- package/node_modules/markdown-it/bin/markdown-it.mjs +2 -2
- package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs +2972 -0
- package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs.map +1 -0
- package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js +14 -0
- package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js.map +1 -0
- package/node_modules/markdown-it/dist/markdown-it.cjs.js +4412 -0
- package/node_modules/markdown-it/dist/markdown-it.cjs.js.map +1 -0
- package/node_modules/markdown-it/dist/markdown-it.d.cts +19 -0
- package/node_modules/markdown-it/dist/markdown-it.d.mts +979 -0
- package/node_modules/markdown-it/dist/{index.cjs.js → markdown-it.mjs} +1437 -1466
- package/node_modules/markdown-it/dist/markdown-it.mjs.map +1 -0
- package/node_modules/markdown-it/node_modules/argparse/README.md +46 -41
- package/node_modules/markdown-it/node_modules/argparse/lib/_colorize.js +72 -0
- package/node_modules/markdown-it/node_modules/argparse/lib/argparse.d.ts +292 -0
- package/node_modules/markdown-it/node_modules/argparse/{argparse.js → lib/argparse.js} +1124 -1027
- package/node_modules/markdown-it/node_modules/argparse/lib/difflib.js +190 -0
- package/node_modules/markdown-it/node_modules/argparse/lib/sub.js +4 -4
- package/node_modules/markdown-it/node_modules/argparse/lib/textwrap.js +28 -28
- package/node_modules/markdown-it/node_modules/argparse/package.json +17 -10
- package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.d.ts +8 -0
- package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.js +46 -0
- package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/{lib/esm → dist}/decode.d.ts +28 -45
- package/node_modules/markdown-it/node_modules/entities/dist/decode.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/{lib/esm → dist}/decode.js +189 -141
- package/node_modules/markdown-it/node_modules/entities/dist/decode.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/{lib/esm → dist}/encode.d.ts +4 -2
- package/node_modules/markdown-it/node_modules/entities/dist/encode.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/encode.js +90 -0
- package/node_modules/markdown-it/node_modules/entities/dist/encode.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/{lib → dist}/escape.d.ts +15 -10
- package/node_modules/markdown-it/node_modules/entities/dist/escape.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/escape.js +132 -0
- package/node_modules/markdown-it/node_modules/entities/dist/escape.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.d.ts +3 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.js +5 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.d.ts +3 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.js +5 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.d.ts +5 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.js +12 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/{lib → dist}/index.d.ts +14 -21
- package/node_modules/markdown-it/node_modules/entities/dist/index.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/index.js +91 -0
- package/node_modules/markdown-it/node_modules/entities/dist/index.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.d.ts +17 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.js +18 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.d.ts +7 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.js +17 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.d.ts +33 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.js +93 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/package.json +63 -70
- package/node_modules/markdown-it/node_modules/entities/readme.md +54 -45
- package/node_modules/markdown-it/node_modules/entities/src/decode-codepoint.ts +50 -0
- package/node_modules/markdown-it/node_modules/entities/src/decode.ts +671 -0
- package/node_modules/markdown-it/node_modules/entities/src/encode.ts +95 -0
- package/node_modules/markdown-it/node_modules/entities/src/escape.ts +160 -0
- package/node_modules/markdown-it/node_modules/entities/src/generated/decode-data-html.ts +7 -0
- package/node_modules/markdown-it/node_modules/entities/src/generated/decode-data-xml.ts +7 -0
- package/node_modules/markdown-it/node_modules/entities/src/generated/encode-html.ts +18 -0
- package/node_modules/markdown-it/node_modules/entities/src/index.ts +162 -0
- package/node_modules/markdown-it/node_modules/entities/src/internal/bin-trie-flags.ts +16 -0
- package/node_modules/markdown-it/node_modules/entities/src/internal/decode-shared.ts +18 -0
- package/node_modules/markdown-it/node_modules/entities/src/internal/encode-shared.ts +123 -0
- package/node_modules/markdown-it/node_modules/linkify-it/README.md +49 -86
- package/node_modules/markdown-it/node_modules/linkify-it/build/index.cjs.js +636 -825
- package/node_modules/markdown-it/node_modules/linkify-it/build/index.cjs.js.map +1 -0
- package/node_modules/markdown-it/node_modules/linkify-it/build/index.d.ts +236 -0
- package/node_modules/markdown-it/node_modules/linkify-it/build/index.mjs +538 -0
- package/node_modules/markdown-it/node_modules/linkify-it/build/index.mjs.map +1 -0
- package/node_modules/markdown-it/node_modules/linkify-it/package.json +23 -20
- package/node_modules/markdown-it/node_modules/uc.micro/README.md +18 -1
- package/node_modules/markdown-it/node_modules/uc.micro/build/index.cjs.js +13 -18
- package/node_modules/markdown-it/node_modules/uc.micro/build/index.d.ts +6 -0
- package/node_modules/markdown-it/node_modules/uc.micro/build/index.mjs +8 -0
- package/node_modules/markdown-it/node_modules/uc.micro/package.json +12 -17
- package/node_modules/markdown-it/package.json +48 -30
- package/node_modules/matrix-js-sdk/CHANGELOG.md +33 -0
- package/node_modules/matrix-js-sdk/lib/@types/PushRules.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/PushRules.js +0 -5
- package/node_modules/matrix-js-sdk/lib/@types/PushRules.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/auth.d.ts +0 -5
- package/node_modules/matrix-js-sdk/lib/@types/auth.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/auth.js +0 -11
- package/node_modules/matrix-js-sdk/lib/@types/auth.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/beacon.d.ts +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/beacon.js +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/beacon.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/crypto.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/crypto.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/event.d.ts +3 -1
- package/node_modules/matrix-js-sdk/lib/@types/event.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/event.js +1 -0
- package/node_modules/matrix-js-sdk/lib/@types/event.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/extensible_events.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/extensible_events.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/matrix-sdk-crypto-wasm.d.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/media.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/partials.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/partials.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/requests.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/requests.js +0 -5
- package/node_modules/matrix-js-sdk/lib/@types/requests.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/search.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/search.js +0 -3
- package/node_modules/matrix-js-sdk/lib/@types/search.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/spaces.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/spaces.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/synapse.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/synapse.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/threepids.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/type-guards.d.ts +43 -0
- package/node_modules/matrix-js-sdk/lib/@types/type-guards.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/@types/type-guards.js +104 -0
- package/node_modules/matrix-js-sdk/lib/@types/type-guards.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/NamespacedValue.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/ReEmitter.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/ToDeviceMessageQueue.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/ToDeviceMessageQueue.js +0 -2
- package/node_modules/matrix-js-sdk/lib/ToDeviceMessageQueue.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/autodiscovery.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/autodiscovery.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/browser-index.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/browser-index.js +3 -1
- package/node_modules/matrix-js-sdk/lib/browser-index.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/capabilityPoller.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/client.d.ts +23 -21
- package/node_modules/matrix-js-sdk/lib/client.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/client.js +44 -96
- package/node_modules/matrix-js-sdk/lib/client.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/common-crypto/CryptoBackend.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/common-crypto/key-passphrase.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/common-crypto/key-passphrase.js +1 -4
- package/node_modules/matrix-js-sdk/lib/common-crypto/key-passphrase.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/content-helpers.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/base.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/base.js +0 -9
- package/node_modules/matrix-js-sdk/lib/crypto/store/base.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store-backend.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store-backend.js +2 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store-backend.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store.js +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/localStorage-crypto-store.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/localStorage-crypto-store.js +0 -2
- package/node_modules/matrix-js-sdk/lib/crypto/store/localStorage-crypto-store.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/memory-crypto-store.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/memory-crypto-store.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto-api/index.d.ts +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto-api/index.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto-api/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto-api/keybackup.d.ts +13 -6
- package/node_modules/matrix-js-sdk/lib/crypto-api/keybackup.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto-api/keybackup.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto-api/verification.d.ts +23 -5
- package/node_modules/matrix-js-sdk/lib/crypto-api/verification.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto-api/verification.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/embedded.d.ts +16 -0
- package/node_modules/matrix-js-sdk/lib/embedded.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/embedded.js +19 -11
- package/node_modules/matrix-js-sdk/lib/embedded.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/errors.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/ExtensibleEvent.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/InvalidEventError.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/MessageEvent.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollEndEvent.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollResponseEvent.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollStartEvent.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/feature.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/feature.js +0 -3
- package/node_modules/matrix-js-sdk/lib/feature.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/filter-component.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/filter-component.js +2 -5
- package/node_modules/matrix-js-sdk/lib/filter-component.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/filter.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/filter.js +0 -4
- package/node_modules/matrix-js-sdk/lib/filter.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/errors.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/fetch.d.ts +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/fetch.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/fetch.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/index.d.ts +1 -7
- package/node_modules/matrix-js-sdk/lib/http-api/index.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/index.js +0 -15
- package/node_modules/matrix-js-sdk/lib/http-api/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/interface.d.ts +0 -9
- package/node_modules/matrix-js-sdk/lib/http-api/interface.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/interface.js +0 -2
- package/node_modules/matrix-js-sdk/lib/http-api/interface.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/refresh.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/refresh.js +0 -3
- package/node_modules/matrix-js-sdk/lib/http-api/refresh.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/index.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/interactive-auth.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/interactive-auth.js +5 -6
- package/node_modules/matrix-js-sdk/lib/interactive-auth.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/logger.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/logger.js +0 -2
- package/node_modules/matrix-js-sdk/lib/logger.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrix.d.ts +1 -1
- package/node_modules/matrix-js-sdk/lib/matrix.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrix.js +1 -1
- package/node_modules/matrix-js-sdk/lib/matrix.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.d.ts +3 -3
- package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.js +5 -5
- package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/LivekitTransport.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.d.ts +18 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.js +56 -4
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.d.ts +14 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.js +20 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.js +9 -6
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManagerActionScheduler.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManagerActionScheduler.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/RTCEncryptionManager.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/RTCEncryptionManager.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/ToDeviceKeyTransport.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/ToDeviceKeyTransport.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/index.d.ts +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/index.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/index.js +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/common.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.d.ts +6 -3
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.js +7 -4
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/session.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/types.d.ts +19 -6
- package/node_modules/matrix-js-sdk/lib/matrixrtc/types.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/types.js +11 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/types.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.d.ts +0 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.js +0 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/MSC3089Branch.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/MSC3089TreeSpace.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/beacon.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/device.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/event-context.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/event-timeline-set.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/event-timeline-set.js +3 -3
- package/node_modules/matrix-js-sdk/lib/models/event-timeline-set.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/event-timeline.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/event.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/event.js +0 -6
- package/node_modules/matrix-js-sdk/lib/models/event.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/invites-ignorer.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/invites-ignorer.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/poll.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/poll.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/read-receipt.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/read-receipt.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/related-relations.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/relations-container.d.ts +10 -0
- package/node_modules/matrix-js-sdk/lib/models/relations-container.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/relations-container.js +39 -17
- package/node_modules/matrix-js-sdk/lib/models/relations-container.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/relations.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/relations.js +1 -1
- package/node_modules/matrix-js-sdk/lib/models/relations.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room-member.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room-receipts.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room-retention.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room-state.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room-state.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room-sticky-events.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room-summary.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room.js +9 -9
- package/node_modules/matrix-js-sdk/lib/models/room.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/search-result.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/thread.d.ts +5 -2
- package/node_modules/matrix-js-sdk/lib/models/thread.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/thread.js +36 -3
- package/node_modules/matrix-js-sdk/lib/models/thread.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/typed-event-emitter.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/user.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/oauth/authorize.d.ts +133 -0
- package/node_modules/matrix-js-sdk/lib/oauth/authorize.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/authorize.js +193 -0
- package/node_modules/matrix-js-sdk/lib/oauth/authorize.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/discover.d.ts +58 -0
- package/node_modules/matrix-js-sdk/lib/oauth/discover.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/discover.js +35 -0
- package/node_modules/matrix-js-sdk/lib/oauth/discover.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/error.d.ts +19 -0
- package/node_modules/matrix-js-sdk/lib/oauth/error.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/error.js +36 -0
- package/node_modules/matrix-js-sdk/lib/oauth/error.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/index.d.ts +87 -0
- package/node_modules/matrix-js-sdk/lib/oauth/index.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/index.js +236 -0
- package/node_modules/matrix-js-sdk/lib/oauth/index.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/register.d.ts +136 -0
- package/node_modules/matrix-js-sdk/lib/oauth/register.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/register.js +73 -0
- package/node_modules/matrix-js-sdk/lib/oauth/register.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/tokenRefresher.d.ts +21 -0
- package/node_modules/matrix-js-sdk/lib/oauth/tokenRefresher.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/tokenRefresher.js +68 -0
- package/node_modules/matrix-js-sdk/lib/oauth/tokenRefresher.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/pollingCachedValue.d.ts +77 -0
- package/node_modules/matrix-js-sdk/lib/pollingCachedValue.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/pollingCachedValue.js +160 -0
- package/node_modules/matrix-js-sdk/lib/pollingCachedValue.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/pushprocessor.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/pushprocessor.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/realtime-callbacks.js +0 -1
- package/node_modules/matrix-js-sdk/lib/realtime-callbacks.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/receipt-accumulator.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/receipt-accumulator.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.d.ts +7 -7
- package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.js +13 -14
- package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousError.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/channels/MSC4108SecureChannel.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/index.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/transports/MSC4108RendezvousSession.js +0 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/retentionPolicy.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/room-hierarchy.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rtcTransportsCachedValue.d.ts +9 -0
- package/node_modules/matrix-js-sdk/lib/rtcTransportsCachedValue.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/rtcTransportsCachedValue.js +38 -0
- package/node_modules/matrix-js-sdk/lib/rtcTransportsCachedValue.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/rust-crypto/CrossSigningIdentity.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.js +11 -13
- package/node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/KeyClaimManager.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.js +0 -2
- package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestsManager.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/RoomEncryptor.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.d.ts +23 -4
- package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.js +62 -21
- package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/device-converter.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/device-converter.js +1 -0
- package/node_modules/matrix-js-sdk/lib/rust-crypto/device-converter.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/index.d.ts +17 -4
- package/node_modules/matrix-js-sdk/lib/rust-crypto/index.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/index.js +21 -4
- package/node_modules/matrix-js-sdk/lib/rust-crypto/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/libolm_migration.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/libolm_migration.js +0 -2
- package/node_modules/matrix-js-sdk/lib/rust-crypto/libolm_migration.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.js +0 -3
- package/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/verification.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/scheduler.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/scheduler.js +0 -3
- package/node_modules/matrix-js-sdk/lib/scheduler.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/secret-storage.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/serverCapabilities.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/sliding-sync-sdk.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/sliding-sync-sdk.js +6 -0
- package/node_modules/matrix-js-sdk/lib/sliding-sync-sdk.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/sliding-sync.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/sliding-sync.js +3 -0
- package/node_modules/matrix-js-sdk/lib/sliding-sync.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/indexeddb-local-backend.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/indexeddb-local-backend.js +1 -1
- package/node_modules/matrix-js-sdk/lib/store/indexeddb-local-backend.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/indexeddb-remote-backend.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/indexeddb-store-worker.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/indexeddb-store-worker.js +1 -0
- package/node_modules/matrix-js-sdk/lib/store/indexeddb-store-worker.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/indexeddb.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/indexeddb.js +0 -2
- package/node_modules/matrix-js-sdk/lib/store/indexeddb.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/memory.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/memory.js +7 -9
- package/node_modules/matrix-js-sdk/lib/store/memory.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/stub.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/sync-accumulator.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/sync-accumulator.js +1 -5
- package/node_modules/matrix-js-sdk/lib/sync-accumulator.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/sync.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/sync.js +9 -9
- package/node_modules/matrix-js-sdk/lib/sync.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/testing.d.ts +2 -10
- package/node_modules/matrix-js-sdk/lib/testing.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/testing.js +4 -19
- package/node_modules/matrix-js-sdk/lib/testing.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/timeline-window.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/timeline-window.js +0 -1
- package/node_modules/matrix-js-sdk/lib/timeline-window.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/utils/internal/deriveKeys.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/utils/internal/deriveKeys.js +0 -1
- package/node_modules/matrix-js-sdk/lib/utils/internal/deriveKeys.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/utils.d.ts +1 -1
- package/node_modules/matrix-js-sdk/lib/utils.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/utils.js +1 -0
- package/node_modules/matrix-js-sdk/lib/utils.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/call.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/call.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/callEventHandler.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/callEventTypes.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/callEventTypes.js +0 -5
- package/node_modules/matrix-js-sdk/lib/webrtc/callEventTypes.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/callFeed.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/groupCall.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/groupCall.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/groupCallEventHandler.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/mediaHandler.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/mediaHandler.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/callFeedStatsReporter.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/callStatsReportGatherer.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/callStatsReportGatherer.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStatsBuilder.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStatsReportBuilder.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/groupCallStats.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaSsrcHandler.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackHandler.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackStats.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/statsReportEmitter.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/summaryStatsReportGatherer.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/trackStatsBuilder.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/transportStatsBuilder.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/transportStatsBuilder.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/valueFormatter.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/wellKnownCachedValue.d.ts +8 -0
- package/node_modules/matrix-js-sdk/lib/wellKnownCachedValue.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/wellKnownCachedValue.js +34 -0
- package/node_modules/matrix-js-sdk/lib/wellKnownCachedValue.js.map +1 -0
- package/node_modules/matrix-js-sdk/node_modules/content-type/README.md +2 -0
- package/node_modules/matrix-js-sdk/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/matrix-js-sdk/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/matrix-js-sdk/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/node_modules/content-type/package.json +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/dist/api.js +227 -131
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/dist/api.min.js +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/ClientWidgetApi.d.ts +1 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/ClientWidgetApi.js +142 -97
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/ClientWidgetApi.js.map +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/WidgetApi.d.ts +15 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/WidgetApi.js +61 -19
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/WidgetApi.js.map +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/driver/WidgetDriver.d.ts +15 -11
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/driver/WidgetDriver.js +19 -13
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/driver/WidgetDriver.js.map +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/index.d.ts +1 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/ApiVersion.d.ts +2 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/ApiVersion.js +2 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/ApiVersion.js.map +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/Capabilities.d.ts +5 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/Capabilities.js +1 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/Capabilities.js.map +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/RtcTransportsAction.d.ts +24 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/RtcTransportsAction.js +6 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/RtcTransportsAction.js.map +1 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/SendEventAction.d.ts +1 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/SendEventAction.js.map +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/WidgetApiAction.d.ts +5 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/WidgetApiAction.js +1 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/WidgetApiAction.js.map +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/package.json +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/ClientWidgetApi.ts +37 -14
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/WidgetApi.ts +69 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/driver/WidgetDriver.ts +19 -12
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/index.ts +1 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/interfaces/ApiVersion.ts +2 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/interfaces/Capabilities.ts +4 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/interfaces/RtcTransportsAction.ts +44 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/interfaces/SendEventAction.ts +1 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/interfaces/WidgetApiAction.ts +5 -0
- package/node_modules/matrix-js-sdk/package.json +10 -12
- package/node_modules/matrix-js-sdk/src/@types/PushRules.ts +0 -5
- package/node_modules/matrix-js-sdk/src/@types/auth.ts +0 -12
- package/node_modules/matrix-js-sdk/src/@types/beacon.ts +1 -1
- package/node_modules/matrix-js-sdk/src/@types/crypto.ts +2 -6
- package/node_modules/matrix-js-sdk/src/@types/event.ts +3 -0
- package/node_modules/matrix-js-sdk/src/@types/extensible_events.ts +5 -6
- package/node_modules/matrix-js-sdk/src/@types/matrix-sdk-crypto-wasm.d.ts +0 -1
- package/node_modules/matrix-js-sdk/src/@types/media.ts +1 -1
- package/node_modules/matrix-js-sdk/src/@types/partials.ts +0 -2
- package/node_modules/matrix-js-sdk/src/@types/requests.ts +0 -5
- package/node_modules/matrix-js-sdk/src/@types/search.ts +0 -2
- package/node_modules/matrix-js-sdk/src/@types/spaces.ts +0 -2
- package/node_modules/matrix-js-sdk/src/@types/synapse.ts +0 -2
- package/node_modules/matrix-js-sdk/src/@types/threepids.ts +2 -2
- package/node_modules/matrix-js-sdk/src/@types/type-guards.ts +126 -0
- package/node_modules/matrix-js-sdk/src/ToDeviceMessageQueue.ts +0 -2
- package/node_modules/matrix-js-sdk/src/autodiscovery.ts +2 -2
- package/node_modules/matrix-js-sdk/src/browser-index.ts +4 -4
- package/node_modules/matrix-js-sdk/src/client.ts +86 -133
- package/node_modules/matrix-js-sdk/src/common-crypto/key-passphrase.ts +1 -2
- package/node_modules/matrix-js-sdk/src/crypto/store/base.ts +1 -8
- package/node_modules/matrix-js-sdk/src/crypto/store/indexeddb-crypto-store-backend.ts +3 -2
- package/node_modules/matrix-js-sdk/src/crypto/store/indexeddb-crypto-store.ts +1 -3
- package/node_modules/matrix-js-sdk/src/crypto/store/localStorage-crypto-store.ts +0 -1
- package/node_modules/matrix-js-sdk/src/crypto/store/memory-crypto-store.ts +1 -1
- package/node_modules/matrix-js-sdk/src/crypto-api/index.ts +1 -1
- package/node_modules/matrix-js-sdk/src/crypto-api/keybackup.ts +14 -7
- package/node_modules/matrix-js-sdk/src/crypto-api/verification.ts +23 -5
- package/node_modules/matrix-js-sdk/src/embedded.ts +34 -16
- package/node_modules/matrix-js-sdk/src/feature.ts +0 -3
- package/node_modules/matrix-js-sdk/src/filter-component.ts +1 -2
- package/node_modules/matrix-js-sdk/src/filter.ts +0 -3
- package/node_modules/matrix-js-sdk/src/http-api/fetch.ts +1 -1
- package/node_modules/matrix-js-sdk/src/http-api/index.ts +1 -23
- package/node_modules/matrix-js-sdk/src/http-api/interface.ts +0 -12
- package/node_modules/matrix-js-sdk/src/http-api/refresh.ts +0 -1
- package/node_modules/matrix-js-sdk/src/interactive-auth.ts +4 -4
- package/node_modules/matrix-js-sdk/src/logger.ts +0 -2
- package/node_modules/matrix-js-sdk/src/matrix.ts +1 -1
- package/node_modules/matrix-js-sdk/src/matrixrtc/CallMembership.ts +5 -5
- package/node_modules/matrix-js-sdk/src/matrixrtc/MatrixRTCSession.ts +73 -6
- package/node_modules/matrix-js-sdk/src/matrixrtc/MatrixRTCSessionManager.ts +21 -2
- package/node_modules/matrix-js-sdk/src/matrixrtc/MembershipManager.ts +9 -6
- package/node_modules/matrix-js-sdk/src/matrixrtc/MembershipManagerActionScheduler.ts +1 -1
- package/node_modules/matrix-js-sdk/src/matrixrtc/RTCEncryptionManager.ts +2 -2
- package/node_modules/matrix-js-sdk/src/matrixrtc/ToDeviceKeyTransport.ts +3 -3
- package/node_modules/matrix-js-sdk/src/matrixrtc/index.ts +1 -1
- package/node_modules/matrix-js-sdk/src/matrixrtc/membershipData/rtc.ts +19 -8
- package/node_modules/matrix-js-sdk/src/matrixrtc/types.ts +24 -7
- package/node_modules/matrix-js-sdk/src/matrixrtc/utils.ts +0 -2
- package/node_modules/matrix-js-sdk/src/models/event-timeline-set.ts +3 -3
- package/node_modules/matrix-js-sdk/src/models/event.ts +7 -13
- package/node_modules/matrix-js-sdk/src/models/invites-ignorer.ts +1 -1
- package/node_modules/matrix-js-sdk/src/models/poll.ts +1 -1
- package/node_modules/matrix-js-sdk/src/models/read-receipt.ts +1 -1
- package/node_modules/matrix-js-sdk/src/models/relations-container.ts +55 -19
- package/node_modules/matrix-js-sdk/src/models/relations.ts +1 -1
- package/node_modules/matrix-js-sdk/src/models/room-state.ts +0 -3
- package/node_modules/matrix-js-sdk/src/models/room.ts +15 -15
- package/node_modules/matrix-js-sdk/src/models/thread.ts +51 -6
- package/node_modules/matrix-js-sdk/src/oauth/authorize.ts +274 -0
- package/node_modules/matrix-js-sdk/src/oauth/discover.ts +102 -0
- package/node_modules/matrix-js-sdk/src/{oidc → oauth}/error.ts +8 -7
- package/node_modules/matrix-js-sdk/src/oauth/index.ts +297 -0
- package/node_modules/matrix-js-sdk/src/oauth/register.ts +166 -0
- package/node_modules/matrix-js-sdk/src/oauth/tokenRefresher.ts +77 -0
- package/node_modules/matrix-js-sdk/src/pollingCachedValue.ts +184 -0
- package/node_modules/matrix-js-sdk/src/pushprocessor.ts +3 -3
- package/node_modules/matrix-js-sdk/src/realtime-callbacks.ts +0 -1
- package/node_modules/matrix-js-sdk/src/receipt-accumulator.ts +1 -2
- package/node_modules/matrix-js-sdk/src/rendezvous/MSC4108SignInWithQR.ts +14 -16
- package/node_modules/matrix-js-sdk/src/rendezvous/index.ts +2 -2
- package/node_modules/matrix-js-sdk/src/rendezvous/transports/MSC4108RendezvousSession.ts +0 -1
- package/node_modules/matrix-js-sdk/src/rtcTransportsCachedValue.ts +40 -0
- package/node_modules/matrix-js-sdk/src/rust-crypto/DehydratedDeviceManager.ts +14 -13
- package/node_modules/matrix-js-sdk/src/rust-crypto/OutgoingRequestProcessor.ts +0 -1
- package/node_modules/matrix-js-sdk/src/rust-crypto/PerSessionKeyBackupDownloader.ts +1 -1
- package/node_modules/matrix-js-sdk/src/rust-crypto/backup.ts +67 -33
- package/node_modules/matrix-js-sdk/src/rust-crypto/device-converter.ts +1 -0
- package/node_modules/matrix-js-sdk/src/rust-crypto/index.ts +32 -23
- package/node_modules/matrix-js-sdk/src/rust-crypto/libolm_migration.ts +1 -3
- package/node_modules/matrix-js-sdk/src/rust-crypto/rust-crypto.ts +3 -6
- package/node_modules/matrix-js-sdk/src/scheduler.ts +0 -3
- package/node_modules/matrix-js-sdk/src/sliding-sync-sdk.ts +4 -1
- package/node_modules/matrix-js-sdk/src/sliding-sync.ts +3 -1
- package/node_modules/matrix-js-sdk/src/store/indexeddb-local-backend.ts +1 -1
- package/node_modules/matrix-js-sdk/src/store/indexeddb-store-worker.ts +1 -0
- package/node_modules/matrix-js-sdk/src/store/indexeddb.ts +0 -2
- package/node_modules/matrix-js-sdk/src/store/memory.ts +7 -9
- package/node_modules/matrix-js-sdk/src/sync-accumulator.ts +1 -3
- package/node_modules/matrix-js-sdk/src/sync.ts +13 -14
- package/node_modules/matrix-js-sdk/src/testing.ts +3 -22
- package/node_modules/matrix-js-sdk/src/timeline-window.ts +0 -1
- package/node_modules/matrix-js-sdk/src/utils/internal/deriveKeys.ts +0 -1
- package/node_modules/matrix-js-sdk/src/utils.ts +3 -2
- package/node_modules/matrix-js-sdk/src/webrtc/call.ts +6 -6
- package/node_modules/matrix-js-sdk/src/webrtc/callEventTypes.ts +0 -5
- package/node_modules/matrix-js-sdk/src/webrtc/groupCall.ts +7 -7
- package/node_modules/matrix-js-sdk/src/webrtc/mediaHandler.ts +1 -1
- package/node_modules/matrix-js-sdk/src/webrtc/stats/callStatsReportGatherer.ts +2 -2
- package/node_modules/matrix-js-sdk/src/webrtc/stats/transportStatsBuilder.ts +1 -1
- package/node_modules/matrix-js-sdk/src/wellKnownCachedValue.ts +34 -0
- package/node_modules/music-metadata/LICENSE.txt +9 -9
- package/node_modules/music-metadata/README.md +878 -878
- package/node_modules/music-metadata/lib/ParseError.d.ts +1 -1
- package/node_modules/music-metadata/lib/ParseError.js +1 -1
- package/node_modules/music-metadata/lib/asf/AsfObject.d.ts +1 -4
- package/node_modules/music-metadata/lib/asf/AsfObject.js +66 -30
- package/node_modules/music-metadata/lib/asf/AsfParser.d.ts +5 -1
- package/node_modules/music-metadata/lib/asf/AsfParser.js +94 -25
- package/node_modules/music-metadata/lib/dsf/DsfChunk.js +2 -2
- package/node_modules/music-metadata/lib/dsf/DsfParser.js +38 -13
- package/node_modules/music-metadata/lib/mp4/AtomToken.js +2 -1
- package/node_modules/music-metadata/lib/mp4/MP4Parser.js +34 -7
- package/node_modules/music-metadata/lib/ogg/speex/SpeexStream.d.ts +7 -0
- package/node_modules/music-metadata/lib/ogg/speex/SpeexStream.js +13 -0
- package/node_modules/music-metadata/lib/riff/RiffChunk.js +1 -1
- package/node_modules/music-metadata/node_modules/content-type/README.md +2 -0
- package/node_modules/music-metadata/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/music-metadata/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/music-metadata/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/music-metadata/node_modules/content-type/package.json +1 -1
- package/node_modules/music-metadata/node_modules/file-type/package.json +1 -1
- package/node_modules/music-metadata/node_modules/file-type/readme.md +3 -0
- package/node_modules/music-metadata/node_modules/file-type/source/detectors/zip.js +6 -1
- package/node_modules/music-metadata/node_modules/file-type/source/index.d.ts +3 -0
- package/node_modules/music-metadata/node_modules/file-type/source/index.js +25 -13
- package/node_modules/music-metadata/package.json +156 -156
- package/node_modules/typebox/build/format/date.d.mts +1 -1
- package/node_modules/typebox/build/format/date.mjs +1 -1
- package/node_modules/typebox/build/format/date_time.d.mts +2 -2
- package/node_modules/typebox/build/format/date_time.mjs +3 -3
- package/node_modules/typebox/build/format/email.d.mts +1 -1
- package/node_modules/typebox/build/format/email.mjs +2 -2
- package/node_modules/typebox/build/format/hostname.mjs +2 -10
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_email.mjs +3 -3
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
- package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
- package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
- package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +41 -0
- package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
- package/node_modules/typebox/build/format/idna/index.mjs +2 -0
- package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
- package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
- package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
- package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
- package/node_modules/typebox/build/format/ipv4.mjs +2 -32
- package/node_modules/typebox/build/format/ipv6.mjs +2 -61
- package/node_modules/typebox/build/format/iri.d.mts +2 -2
- package/node_modules/typebox/build/format/iri.mjs +26 -8
- package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
- package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
- package/node_modules/typebox/build/format/regex.d.mts +1 -2
- package/node_modules/typebox/build/format/regex.mjs +2 -6
- package/node_modules/typebox/build/format/time.d.mts +2 -2
- package/node_modules/typebox/build/format/time.mjs +19 -14
- package/node_modules/typebox/build/format/uri.d.mts +1 -1
- package/node_modules/typebox/build/format/uri.mjs +3 -130
- package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
- package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
- package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
- package/node_modules/typebox/build/format/uri_template.mjs +4 -5
- package/node_modules/typebox/build/format/url.d.mts +3 -3
- package/node_modules/typebox/build/format/url.mjs +4 -5
- package/node_modules/typebox/build/guard/emit.d.mts +3 -1
- package/node_modules/typebox/build/guard/emit.mjs +12 -5
- package/node_modules/typebox/build/guard/guard.d.mts +8 -2
- package/node_modules/typebox/build/guard/guard.mjs +25 -4
- package/node_modules/typebox/build/guard/string.d.mts +2 -2
- package/node_modules/typebox/build/guard/string.mjs +7 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
- package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
- package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
- package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
- package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
- package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
- package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
- package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
- package/node_modules/typebox/build/schema/types/index.mjs +0 -2
- package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
- package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
- package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
- package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
- package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
- package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
- package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
- package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
- package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
- package/node_modules/typebox/build/type/script/parser.mjs +27 -23
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
- package/node_modules/typebox/package.json +27 -27
- package/node_modules/typebox/readme.md +79 -82
- package/openclaw.plugin.json +16 -1
- package/package.json +10 -10
- package/dist/env-auth-MVS-Vv41.js +0 -64
- package/dist/file-sync-store-DjskBX2o.js +0 -436
- package/dist/media-text-Dh-DpTc3.js +0 -149
- package/dist/probe.runtime-NIJZYqc2.js +0 -2
- package/dist/recovery-key-store-CognuDys.js +0 -276
- package/dist/runtime-api-BGO16Fu8.js +0 -21
- package/dist/timeout-abort-signal-DMrgRFIy.js +0 -2
- package/node_modules/markdown-it/dist/index.cjs.js.map +0 -1
- package/node_modules/markdown-it/dist/markdown-it.js +0 -3975
- package/node_modules/markdown-it/dist/markdown-it.js.map +0 -1
- package/node_modules/markdown-it/dist/markdown-it.min.js +0 -3
- package/node_modules/markdown-it/dist/markdown-it.min.js.map +0 -1
- package/node_modules/markdown-it/index.mjs +0 -1
- package/node_modules/markdown-it/lib/common/html_blocks.mjs +0 -67
- package/node_modules/markdown-it/lib/common/html_re.mjs +0 -25
- package/node_modules/markdown-it/lib/common/utils.mjs +0 -324
- package/node_modules/markdown-it/lib/helpers/index.mjs +0 -11
- package/node_modules/markdown-it/lib/helpers/parse_link_destination.mjs +0 -77
- package/node_modules/markdown-it/lib/helpers/parse_link_label.mjs +0 -49
- package/node_modules/markdown-it/lib/helpers/parse_link_title.mjs +0 -66
- package/node_modules/markdown-it/lib/index.mjs +0 -565
- package/node_modules/markdown-it/lib/parser_block.mjs +0 -134
- package/node_modules/markdown-it/lib/parser_core.mjs +0 -62
- package/node_modules/markdown-it/lib/parser_inline.mjs +0 -197
- package/node_modules/markdown-it/lib/presets/commonmark.mjs +0 -88
- package/node_modules/markdown-it/lib/presets/default.mjs +0 -47
- package/node_modules/markdown-it/lib/presets/zero.mjs +0 -70
- package/node_modules/markdown-it/lib/renderer.mjs +0 -322
- package/node_modules/markdown-it/lib/ruler.mjs +0 -340
- package/node_modules/markdown-it/lib/rules_block/blockquote.mjs +0 -209
- package/node_modules/markdown-it/lib/rules_block/code.mjs +0 -30
- package/node_modules/markdown-it/lib/rules_block/fence.mjs +0 -94
- package/node_modules/markdown-it/lib/rules_block/heading.mjs +0 -51
- package/node_modules/markdown-it/lib/rules_block/hr.mjs +0 -40
- package/node_modules/markdown-it/lib/rules_block/html_block.mjs +0 -80
- package/node_modules/markdown-it/lib/rules_block/lheading.mjs +0 -85
- package/node_modules/markdown-it/lib/rules_block/list.mjs +0 -331
- package/node_modules/markdown-it/lib/rules_block/paragraph.mjs +0 -48
- package/node_modules/markdown-it/lib/rules_block/reference.mjs +0 -212
- package/node_modules/markdown-it/lib/rules_block/state_block.mjs +0 -220
- package/node_modules/markdown-it/lib/rules_block/table.mjs +0 -228
- package/node_modules/markdown-it/lib/rules_core/block.mjs +0 -13
- package/node_modules/markdown-it/lib/rules_core/inline.mjs +0 -11
- package/node_modules/markdown-it/lib/rules_core/linkify.mjs +0 -134
- package/node_modules/markdown-it/lib/rules_core/normalize.mjs +0 -17
- package/node_modules/markdown-it/lib/rules_core/replacements.mjs +0 -101
- package/node_modules/markdown-it/lib/rules_core/smartquotes.mjs +0 -209
- package/node_modules/markdown-it/lib/rules_core/state_core.mjs +0 -17
- package/node_modules/markdown-it/lib/rules_core/text_join.mjs +0 -43
- package/node_modules/markdown-it/lib/rules_inline/autolink.mjs +0 -72
- package/node_modules/markdown-it/lib/rules_inline/backticks.mjs +0 -60
- package/node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs +0 -124
- package/node_modules/markdown-it/lib/rules_inline/emphasis.mjs +0 -123
- package/node_modules/markdown-it/lib/rules_inline/entity.mjs +0 -51
- package/node_modules/markdown-it/lib/rules_inline/escape.mjs +0 -83
- package/node_modules/markdown-it/lib/rules_inline/fragments_join.mjs +0 -38
- package/node_modules/markdown-it/lib/rules_inline/html_inline.mjs +0 -50
- package/node_modules/markdown-it/lib/rules_inline/image.mjs +0 -138
- package/node_modules/markdown-it/lib/rules_inline/link.mjs +0 -139
- package/node_modules/markdown-it/lib/rules_inline/linkify.mjs +0 -63
- package/node_modules/markdown-it/lib/rules_inline/newline.mjs +0 -42
- package/node_modules/markdown-it/lib/rules_inline/state_inline.mjs +0 -154
- package/node_modules/markdown-it/lib/rules_inline/strikethrough.mjs +0 -127
- package/node_modules/markdown-it/lib/rules_inline/text.mjs +0 -86
- package/node_modules/markdown-it/lib/token.mjs +0 -191
- package/node_modules/markdown-it/node_modules/argparse/CHANGELOG.md +0 -216
- package/node_modules/markdown-it/node_modules/entities/lib/decode.d.ts +0 -211
- package/node_modules/markdown-it/node_modules/entities/lib/decode.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/decode.js +0 -536
- package/node_modules/markdown-it/node_modules/entities/lib/decode.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.d.ts +0 -19
- package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.js +0 -76
- package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/encode.d.ts +0 -22
- package/node_modules/markdown-it/node_modules/entities/lib/encode.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/encode.js +0 -77
- package/node_modules/markdown-it/node_modules/entities/lib/encode.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/escape.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/escape.js +0 -122
- package/node_modules/markdown-it/node_modules/entities/lib/escape.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/decode.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/decode.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.d.ts +0 -19
- package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.js +0 -71
- package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/encode.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/encode.js +0 -69
- package/node_modules/markdown-it/node_modules/entities/lib/esm/encode.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.d.ts +0 -43
- package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.js +0 -116
- package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.d.ts +0 -3
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.js +0 -7
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts +0 -3
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.js +0 -7
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.d.ts +0 -8
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.js +0 -10
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/index.d.ts +0 -96
- package/node_modules/markdown-it/node_modules/entities/lib/esm/index.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/index.js +0 -99
- package/node_modules/markdown-it/node_modules/entities/lib/esm/index.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/package.json +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.d.ts +0 -3
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.js +0 -9
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.d.ts +0 -3
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.js +0 -9
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.d.ts +0 -8
- package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.js +0 -12
- package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/index.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/index.js +0 -126
- package/node_modules/markdown-it/node_modules/entities/lib/index.js.map +0 -1
- package/node_modules/markdown-it/node_modules/linkify-it/index.mjs +0 -646
- package/node_modules/markdown-it/node_modules/linkify-it/lib/re.mjs +0 -193
- package/node_modules/markdown-it/node_modules/uc.micro/categories/Cc/regex.mjs +0 -1
- package/node_modules/markdown-it/node_modules/uc.micro/categories/Cf/regex.mjs +0 -1
- package/node_modules/markdown-it/node_modules/uc.micro/categories/P/regex.mjs +0 -1
- package/node_modules/markdown-it/node_modules/uc.micro/categories/S/regex.mjs +0 -1
- package/node_modules/markdown-it/node_modules/uc.micro/categories/Z/regex.mjs +0 -1
- package/node_modules/markdown-it/node_modules/uc.micro/index.mjs +0 -8
- package/node_modules/markdown-it/node_modules/uc.micro/properties/Any/regex.mjs +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/authorize.d.ts +0 -157
- package/node_modules/matrix-js-sdk/lib/oidc/authorize.d.ts.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/authorize.js +0 -365
- package/node_modules/matrix-js-sdk/lib/oidc/authorize.js.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/discovery.d.ts +0 -22
- package/node_modules/matrix-js-sdk/lib/oidc/discovery.d.ts.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/discovery.js +0 -65
- package/node_modules/matrix-js-sdk/lib/oidc/discovery.js.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/error.d.ts +0 -18
- package/node_modules/matrix-js-sdk/lib/oidc/error.d.ts.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/error.js +0 -35
- package/node_modules/matrix-js-sdk/lib/oidc/error.js.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/index.d.ts +0 -16
- package/node_modules/matrix-js-sdk/lib/oidc/index.d.ts.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/index.js +0 -30
- package/node_modules/matrix-js-sdk/lib/oidc/index.js.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/register.d.ts +0 -70
- package/node_modules/matrix-js-sdk/lib/oidc/register.d.ts.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/register.js +0 -134
- package/node_modules/matrix-js-sdk/lib/oidc/register.js.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.d.ts +0 -91
- package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.d.ts.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.js +0 -173
- package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.js.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/validate.d.ts +0 -78
- package/node_modules/matrix-js-sdk/lib/oidc/validate.d.ts.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/validate.js +0 -181
- package/node_modules/matrix-js-sdk/lib/oidc/validate.js.map +0 -1
- package/node_modules/matrix-js-sdk/node_modules/jwt-decode/LICENSE +0 -21
- package/node_modules/matrix-js-sdk/node_modules/jwt-decode/README.md +0 -134
- package/node_modules/matrix-js-sdk/node_modules/jwt-decode/build/cjs/index.d.ts +0 -23
- package/node_modules/matrix-js-sdk/node_modules/jwt-decode/build/cjs/index.js +0 -62
- package/node_modules/matrix-js-sdk/node_modules/jwt-decode/build/cjs/package.json +0 -1
- package/node_modules/matrix-js-sdk/node_modules/jwt-decode/build/esm/index.d.ts +0 -23
- package/node_modules/matrix-js-sdk/node_modules/jwt-decode/build/esm/index.js +0 -57
- package/node_modules/matrix-js-sdk/node_modules/jwt-decode/package.json +0 -81
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/LICENSE +0 -202
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/README.md +0 -87
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/browser/oidc-client-ts.js +0 -3751
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/browser/oidc-client-ts.js.map +0 -7
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/browser/oidc-client-ts.min.js +0 -2
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/browser/oidc-client-ts.min.js.map +0 -7
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/esm/oidc-client-ts.js +0 -3671
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/esm/oidc-client-ts.js.map +0 -7
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/esm/package.json +0 -4
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/types/oidc-client-ts.d.ts +0 -2003
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/types/tsdoc-metadata.json +0 -11
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/umd/oidc-client-ts.js +0 -3719
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/umd/oidc-client-ts.js.map +0 -7
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/package.json +0 -75
- package/node_modules/matrix-js-sdk/src/oidc/authorize.ts +0 -431
- package/node_modules/matrix-js-sdk/src/oidc/discovery.ts +0 -67
- package/node_modules/matrix-js-sdk/src/oidc/index.ts +0 -33
- package/node_modules/matrix-js-sdk/src/oidc/register.ts +0 -168
- package/node_modules/matrix-js-sdk/src/oidc/tokenRefresher.ts +0 -184
- package/node_modules/matrix-js-sdk/src/oidc/validate.ts +0 -265
- package/node_modules/typebox/build/format/_idna.d.mts +0 -2
- package/node_modules/typebox/build/format/_idna.mjs +0 -246
- package/node_modules/typebox/build/format/_puny.d.mts +0 -1
- package/node_modules/typebox/build/format/_puny.mjs +0 -77
- package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
- package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
- package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
- package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { type IContent, type IUnsigned, MatrixEvent } from "./models/event.ts";
|
|
9
9
|
import { EventType } from "./@types/event.ts";
|
|
10
10
|
import { type DecryptionFailureCode } from "./crypto-api/index.ts";
|
|
11
|
-
import { type
|
|
11
|
+
import { type ValidatedAuthMetadata } from "./oauth/index.ts";
|
|
12
12
|
/**
|
|
13
13
|
* Create a {@link MatrixEvent}.
|
|
14
14
|
*
|
|
@@ -86,13 +86,5 @@ export declare function decryptExistingEvent(mxEvent: MatrixEvent, opts: {
|
|
|
86
86
|
* @returns OidcClientConfig
|
|
87
87
|
* @experimental
|
|
88
88
|
*/
|
|
89
|
-
export declare const
|
|
90
|
-
/**
|
|
91
|
-
* Useful for mocking <issuer>/.well-known/openid-configuration
|
|
92
|
-
* @param issuer used as the base for all other urls
|
|
93
|
-
* @param additionalGrantTypes to add to the default grant types
|
|
94
|
-
* @returns ValidatedAuthMetadata
|
|
95
|
-
* @experimental
|
|
96
|
-
*/
|
|
97
|
-
export declare const mockOpenIdConfiguration: (issuer?: string, additionalGrantTypes?: string[]) => ValidatedAuthMetadata;
|
|
89
|
+
export declare const makeDelegatedAuthMetadata: (issuer?: string, additionalGrantTypes?: string[]) => ValidatedAuthMetadata;
|
|
98
90
|
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAgBA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,QAAQ,EAAe,KAAK,SAAS,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE5F,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAkB,KAAK,
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAgBA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,QAAQ,EAAe,KAAK,SAAS,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE5F,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAkB,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE9E;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAChC,4BAA4B;IAC5B,MAAM,EAAE,MAAM,CAAC;IAEf,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IAEf,6BAA6B;IAC7B,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;IAEzB,wFAAwF;IACxF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,iGAAiG;IACjG,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,wGAAwG;IACxG,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,4BAA4B;IAC5B,OAAO,EAAE,QAAQ,CAAC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7 @@ limitations under the License.
|
|
|
26
25
|
import { MatrixEvent } from "./models/event.js";
|
|
27
26
|
import { EventType } from "./@types/event.js";
|
|
28
27
|
import { DecryptionError } from "./common-crypto/CryptoBackend.js";
|
|
29
|
-
import { OAuthGrantType } from "./
|
|
28
|
+
import { OAuthGrantType } from "./oauth/index.js";
|
|
30
29
|
|
|
31
30
|
/**
|
|
32
31
|
* Create a {@link MatrixEvent}.
|
|
@@ -134,30 +133,16 @@ export async function decryptExistingEvent(mxEvent, opts) {
|
|
|
134
133
|
* @returns OidcClientConfig
|
|
135
134
|
* @experimental
|
|
136
135
|
*/
|
|
137
|
-
export const
|
|
138
|
-
const metadata = mockOpenIdConfiguration(issuer, additionalGrantTypes);
|
|
139
|
-
return _objectSpread(_objectSpread({}, metadata), {}, {
|
|
140
|
-
signingKeys: null
|
|
141
|
-
});
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Useful for mocking <issuer>/.well-known/openid-configuration
|
|
146
|
-
* @param issuer used as the base for all other urls
|
|
147
|
-
* @param additionalGrantTypes to add to the default grant types
|
|
148
|
-
* @returns ValidatedAuthMetadata
|
|
149
|
-
* @experimental
|
|
150
|
-
*/
|
|
151
|
-
export const mockOpenIdConfiguration = (issuer = "https://auth.org/", additionalGrantTypes = []) => ({
|
|
136
|
+
export const makeDelegatedAuthMetadata = (issuer = "https://auth.org/", additionalGrantTypes = []) => ({
|
|
152
137
|
issuer,
|
|
153
138
|
revocation_endpoint: issuer + "revoke",
|
|
154
139
|
token_endpoint: issuer + "token",
|
|
155
140
|
authorization_endpoint: issuer + "auth",
|
|
156
141
|
registration_endpoint: issuer + "registration",
|
|
157
142
|
device_authorization_endpoint: issuer + "device",
|
|
158
|
-
jwks_uri: issuer + "jwks",
|
|
159
143
|
response_types_supported: ["code"],
|
|
160
144
|
grant_types_supported: [OAuthGrantType.AuthorizationCode, OAuthGrantType.RefreshToken, ...additionalGrantTypes],
|
|
161
|
-
code_challenge_methods_supported: ["S256"]
|
|
145
|
+
code_challenge_methods_supported: ["S256"],
|
|
146
|
+
response_modes_supported: ["query", "fragment"]
|
|
162
147
|
});
|
|
163
148
|
//# sourceMappingURL=testing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.js","names":[],"sources":["../src/testing.ts"],"sourcesContent":["/*\nCopyright 2024 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/**\n * This file is a secondary entrypoint for the js-sdk library, exposing utilities which might be useful for writing tests.\n *\n * In general, it should not be included in runtime applications.\n *\n * @packageDocumentation\n */\n\nimport { type IContent, type IEvent, type IUnsigned, MatrixEvent } from \"./models/event.ts\";\nimport { type RoomMember } from \"./models/room-member.ts\";\nimport { EventType } from \"./@types/event.ts\";\nimport { type DecryptionFailureCode } from \"./crypto-api/index.ts\";\nimport { DecryptionError, type EventDecryptionResult } from \"./common-crypto/CryptoBackend.ts\";\nimport { OAuthGrantType, type OidcClientConfig, type ValidatedAuthMetadata } from \"./oidc/index.ts\";\n\n/**\n * Create a {@link MatrixEvent}.\n *\n * @param opts - Values for the event.\n */\nexport function mkMatrixEvent(opts: {\n /** Room ID of the event. */\n roomId: string;\n\n /** The sender of the event. */\n sender: string;\n\n /** The type of the event. */\n type: EventType | string;\n\n /** Optional `state_key` for the event. If unspecified, a non-state event is created. */\n stateKey?: string;\n\n /** Optional `origin_server_ts` for the event. If unspecified, the timestamp will be set to 0. */\n ts?: number;\n\n /** Optional `event_id` for the event. If provided will be used as event ID; else an ID is generated. */\n eventId?: string;\n\n /** Content of the event. */\n content: IContent;\n\n /** Optional `unsigned` data for the event. */\n unsigned?: IUnsigned;\n}): MatrixEvent {\n const event: Partial<IEvent> = {\n type: opts.type,\n room_id: opts.roomId,\n sender: opts.sender,\n content: opts.content,\n event_id: opts.eventId ?? \"$\" + Math.random() + \"-\" + Math.random(),\n origin_server_ts: opts.ts ?? 0,\n unsigned: opts.unsigned,\n };\n if (opts.stateKey !== undefined) {\n event.state_key = opts.stateKey;\n }\n\n const mxEvent = new MatrixEvent(event);\n mxEvent.sender = {\n userId: opts.sender,\n membership: \"join\",\n name: opts.sender,\n rawDisplayName: opts.sender,\n roomId: opts.sender,\n getAvatarUrl: () => {},\n getMxcAvatarUrl: () => {},\n } as unknown as RoomMember;\n return mxEvent;\n}\n\n/**\n * Create a `MatrixEvent` representing a successfully-decrypted `m.room.encrypted` event.\n *\n * @param opts - Values for the event.\n */\nexport async function mkEncryptedMatrixEvent(opts: {\n /** Room ID of the event. */\n roomId: string;\n\n /** The sender of the event. */\n sender: string;\n\n /** The type the event will have, once it has been decrypted. */\n plainType: EventType | string;\n\n /** The content the event will have, once it has been decrypted. */\n plainContent: IContent;\n\n /** Optional `event_id` for the event. If provided will be used as event ID; else an ID is generated. */\n eventId?: string;\n}): Promise<MatrixEvent> {\n const mxEvent = mkMatrixEvent({\n type: EventType.RoomMessageEncrypted,\n roomId: opts.roomId,\n sender: opts.sender,\n content: { algorithm: \"m.megolm.v1.aes-sha2\" },\n eventId: opts.eventId,\n });\n\n await decryptExistingEvent(mxEvent, { plainType: opts.plainType, plainContent: opts.plainContent });\n return mxEvent;\n}\n\n/**\n * Create a `MatrixEvent` representing a `m.room.encrypted` event which could not be decrypted.\n *\n * @param opts - Values for the event.\n */\nexport async function mkDecryptionFailureMatrixEvent(opts: {\n /** Room ID of the event. */\n roomId: string;\n\n /** The sender of the event. */\n sender: string;\n\n /** The reason code for the failure */\n code: DecryptionFailureCode;\n\n /** A textual reason for the failure */\n msg: string;\n\n /** Optional `event_id` for the event. If provided will be used as event ID; else an ID is generated. */\n eventId?: string;\n}): Promise<MatrixEvent> {\n const mxEvent = mkMatrixEvent({\n type: EventType.RoomMessageEncrypted,\n roomId: opts.roomId,\n sender: opts.sender,\n content: { algorithm: \"m.megolm.v1.aes-sha2\" },\n eventId: opts.eventId,\n });\n\n const mockCrypto = {\n decryptEvent: async (_ev): Promise<EventDecryptionResult> => {\n throw new DecryptionError(opts.code, opts.msg);\n },\n } as Parameters<MatrixEvent[\"attemptDecryption\"]>[0];\n await mxEvent.attemptDecryption(mockCrypto);\n return mxEvent;\n}\n\n/**\n * Given an event previously returned by {@link mkDecryptionFailureMatrixEvent}, simulate a successful re-decryption\n * attempt.\n *\n * @param mxEvent - The event that will be decrypted.\n * @param opts - New data for the successful decryption.\n */\nexport async function decryptExistingEvent(\n mxEvent: MatrixEvent,\n opts: {\n /** The type the event will have, once it has been decrypted. */\n plainType: EventType | string;\n\n /** The content the event will have, once it has been decrypted. */\n plainContent: IContent;\n },\n): Promise<void> {\n const decryptionResult: EventDecryptionResult = {\n claimedEd25519Key: \"\",\n clearEvent: {\n type: opts.plainType,\n content: opts.plainContent,\n },\n senderCurve25519Key: \"\",\n };\n\n const mockCrypto = {\n decryptEvent: async (_ev): Promise<EventDecryptionResult> => decryptionResult,\n } as Parameters<MatrixEvent[\"attemptDecryption\"]>[0];\n await mxEvent.attemptDecryption(mockCrypto);\n}\n\n/**\n * Makes a valid OidcClientConfig with minimum valid values\n * @param issuer used as the base for all other urls\n * @param additionalGrantTypes to add to the default grant types\n * @returns OidcClientConfig\n * @experimental\n */\nexport const makeDelegatedAuthConfig = (\n issuer = \"https://auth.org/\",\n additionalGrantTypes: string[] = [],\n): OidcClientConfig => {\n const metadata = mockOpenIdConfiguration(issuer, additionalGrantTypes);\n\n return {\n ...metadata,\n signingKeys: null,\n };\n};\n\n/**\n * Useful for mocking <issuer>/.well-known/openid-configuration\n * @param issuer used as the base for all other urls\n * @param additionalGrantTypes to add to the default grant types\n * @returns ValidatedAuthMetadata\n * @experimental\n */\nexport const mockOpenIdConfiguration = (\n issuer = \"https://auth.org/\",\n additionalGrantTypes: string[] = [],\n): ValidatedAuthMetadata => ({\n issuer,\n revocation_endpoint: issuer + \"revoke\",\n token_endpoint: issuer + \"token\",\n authorization_endpoint: issuer + \"auth\",\n registration_endpoint: issuer + \"registration\",\n device_authorization_endpoint: issuer + \"device\",\n jwks_uri: issuer + \"jwks\",\n response_types_supported: [\"code\"],\n grant_types_supported: [OAuthGrantType.AuthorizationCode, OAuthGrantType.RefreshToken, ...additionalGrantTypes],\n code_challenge_methods_supported: [\"S256\"],\n});\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAqD,WAAW,QAAQ,mBAAmB;AAE3F,SAAS,SAAS,QAAQ,mBAAmB;AAE7C,SAAS,eAAe,QAAoC,kCAAkC;AAC9F,SAAS,cAAc,QAA2D,iBAAiB;;AAEnG;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS,aAAa,CAAC,IAwB7B,EAAe;EACZ,MAAM,KAAsB,GAAG;IAC3B,IAAI,EAAE,IAAI,CAAC,IAAI;IACf,OAAO,EAAE,IAAI,CAAC,MAAM;IACpB,MAAM,EAAE,IAAI,CAAC,MAAM;IACnB,OAAO,EAAE,IAAI,CAAC,OAAO;IACrB,QAAQ,EAAE,IAAI,CAAC,OAAO,IAAI,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IACnE,gBAAgB,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC;IAC9B,QAAQ,EAAE,IAAI,CAAC;EACnB,CAAC;EACD,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE;IAC7B,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ;EACnC;EAEA,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,KAAK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AG,oBAAoB,CAAC;EAC/G,gCAAgC,EAAE,CAAC,MAAM;AAC7C,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"testing.js","names":[],"sources":["../src/testing.ts"],"sourcesContent":["/*\nCopyright 2024 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/**\n * This file is a secondary entrypoint for the js-sdk library, exposing utilities which might be useful for writing tests.\n *\n * In general, it should not be included in runtime applications.\n *\n * @packageDocumentation\n */\n\nimport { type IContent, type IEvent, type IUnsigned, MatrixEvent } from \"./models/event.ts\";\nimport { type RoomMember } from \"./models/room-member.ts\";\nimport { EventType } from \"./@types/event.ts\";\nimport { type DecryptionFailureCode } from \"./crypto-api/index.ts\";\nimport { DecryptionError, type EventDecryptionResult } from \"./common-crypto/CryptoBackend.ts\";\nimport { OAuthGrantType, type ValidatedAuthMetadata } from \"./oauth/index.ts\";\n\n/**\n * Create a {@link MatrixEvent}.\n *\n * @param opts - Values for the event.\n */\nexport function mkMatrixEvent(opts: {\n /** Room ID of the event. */\n roomId: string;\n\n /** The sender of the event. */\n sender: string;\n\n /** The type of the event. */\n type: EventType | string;\n\n /** Optional `state_key` for the event. If unspecified, a non-state event is created. */\n stateKey?: string;\n\n /** Optional `origin_server_ts` for the event. If unspecified, the timestamp will be set to 0. */\n ts?: number;\n\n /** Optional `event_id` for the event. If provided will be used as event ID; else an ID is generated. */\n eventId?: string;\n\n /** Content of the event. */\n content: IContent;\n\n /** Optional `unsigned` data for the event. */\n unsigned?: IUnsigned;\n}): MatrixEvent {\n const event: Partial<IEvent> = {\n type: opts.type,\n room_id: opts.roomId,\n sender: opts.sender,\n content: opts.content,\n event_id: opts.eventId ?? \"$\" + Math.random() + \"-\" + Math.random(),\n origin_server_ts: opts.ts ?? 0,\n unsigned: opts.unsigned,\n };\n if (opts.stateKey !== undefined) {\n event.state_key = opts.stateKey;\n }\n\n const mxEvent = new MatrixEvent(event);\n mxEvent.sender = {\n userId: opts.sender,\n membership: \"join\",\n name: opts.sender,\n rawDisplayName: opts.sender,\n roomId: opts.sender,\n getAvatarUrl: () => {},\n getMxcAvatarUrl: () => {},\n } as unknown as RoomMember;\n return mxEvent;\n}\n\n/**\n * Create a `MatrixEvent` representing a successfully-decrypted `m.room.encrypted` event.\n *\n * @param opts - Values for the event.\n */\nexport async function mkEncryptedMatrixEvent(opts: {\n /** Room ID of the event. */\n roomId: string;\n\n /** The sender of the event. */\n sender: string;\n\n /** The type the event will have, once it has been decrypted. */\n plainType: EventType | string;\n\n /** The content the event will have, once it has been decrypted. */\n plainContent: IContent;\n\n /** Optional `event_id` for the event. If provided will be used as event ID; else an ID is generated. */\n eventId?: string;\n}): Promise<MatrixEvent> {\n const mxEvent = mkMatrixEvent({\n type: EventType.RoomMessageEncrypted,\n roomId: opts.roomId,\n sender: opts.sender,\n content: { algorithm: \"m.megolm.v1.aes-sha2\" },\n eventId: opts.eventId,\n });\n\n await decryptExistingEvent(mxEvent, { plainType: opts.plainType, plainContent: opts.plainContent });\n return mxEvent;\n}\n\n/**\n * Create a `MatrixEvent` representing a `m.room.encrypted` event which could not be decrypted.\n *\n * @param opts - Values for the event.\n */\nexport async function mkDecryptionFailureMatrixEvent(opts: {\n /** Room ID of the event. */\n roomId: string;\n\n /** The sender of the event. */\n sender: string;\n\n /** The reason code for the failure */\n code: DecryptionFailureCode;\n\n /** A textual reason for the failure */\n msg: string;\n\n /** Optional `event_id` for the event. If provided will be used as event ID; else an ID is generated. */\n eventId?: string;\n}): Promise<MatrixEvent> {\n const mxEvent = mkMatrixEvent({\n type: EventType.RoomMessageEncrypted,\n roomId: opts.roomId,\n sender: opts.sender,\n content: { algorithm: \"m.megolm.v1.aes-sha2\" },\n eventId: opts.eventId,\n });\n\n const mockCrypto = {\n decryptEvent: async (_ev): Promise<EventDecryptionResult> => {\n throw new DecryptionError(opts.code, opts.msg);\n },\n } as Parameters<MatrixEvent[\"attemptDecryption\"]>[0];\n await mxEvent.attemptDecryption(mockCrypto);\n return mxEvent;\n}\n\n/**\n * Given an event previously returned by {@link mkDecryptionFailureMatrixEvent}, simulate a successful re-decryption\n * attempt.\n *\n * @param mxEvent - The event that will be decrypted.\n * @param opts - New data for the successful decryption.\n */\nexport async function decryptExistingEvent(\n mxEvent: MatrixEvent,\n opts: {\n /** The type the event will have, once it has been decrypted. */\n plainType: EventType | string;\n\n /** The content the event will have, once it has been decrypted. */\n plainContent: IContent;\n },\n): Promise<void> {\n const decryptionResult: EventDecryptionResult = {\n claimedEd25519Key: \"\",\n clearEvent: {\n type: opts.plainType,\n content: opts.plainContent,\n },\n senderCurve25519Key: \"\",\n };\n\n const mockCrypto = {\n decryptEvent: async (_ev): Promise<EventDecryptionResult> => decryptionResult,\n } as Parameters<MatrixEvent[\"attemptDecryption\"]>[0];\n await mxEvent.attemptDecryption(mockCrypto);\n}\n\n/**\n * Makes a valid OidcClientConfig with minimum valid values\n * @param issuer used as the base for all other urls\n * @param additionalGrantTypes to add to the default grant types\n * @returns OidcClientConfig\n * @experimental\n */\nexport const makeDelegatedAuthMetadata = (\n issuer = \"https://auth.org/\",\n additionalGrantTypes: string[] = [],\n): ValidatedAuthMetadata => ({\n issuer,\n revocation_endpoint: issuer + \"revoke\",\n token_endpoint: issuer + \"token\",\n authorization_endpoint: issuer + \"auth\",\n registration_endpoint: issuer + \"registration\",\n device_authorization_endpoint: issuer + \"device\",\n response_types_supported: [\"code\"],\n grant_types_supported: [OAuthGrantType.AuthorizationCode, OAuthGrantType.RefreshToken, ...additionalGrantTypes],\n code_challenge_methods_supported: [\"S256\"],\n response_modes_supported: [\"query\", \"fragment\"],\n});\n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AS,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAsBzD;IAED,OAAO,CAAC,eAAe;IAMvB;;;OAGG;IACH,OAAO,CAAC,cAAc;IAOtB;;;;;;;;;;;;OAYG;IACI,WAAW,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAqBhD;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACU,QAAQ,CACjB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,MAAM,EACZ,WAAW,UAAO,EAClB,YAAY,SAA8B,GAC3C,OAAO,CAAC,OAAO,CAAC,CAgElB;IAED;;;;;;OAMG;IACI,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI,CA0B/D;IAED;;;;OAIG;IACI,SAAS,IAAI,WAAW,EAAE,CA4ChC;CACJ;AAED;;;GAGG;AACH,qBAAa,aAAa;IAKX,QAAQ,EAAE,aAAa;IACvB,KAAK,EAAE,MAAM;IALjB,eAAe,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAG1C,YACW,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,MAAM,EACpB;IAEJ;;;OAGG;IACI,QAAQ,IAAI,MAAM,CAExB;IAED;;;;OAIG;IACI,QAAQ,IAAI,MAAM,CAExB;IAED;;;;;OAKG;IACI,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAqDpC;IAED;;;;;OAKG;IACI,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpC;CACJ"}
|
|
@@ -347,7 +347,6 @@ export class TimelineWindow {
|
|
|
347
347
|
// iterate through each timeline between this.start and this.end
|
|
348
348
|
// (inclusive).
|
|
349
349
|
let timeline = this.start.timeline;
|
|
350
|
-
// eslint-disable-next-line no-constant-condition
|
|
351
350
|
while (timeline) {
|
|
352
351
|
const events = timeline.getEvents();
|
|
353
352
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeline-window.js","names":[],"sources":["../src/timeline-window.ts"],"sourcesContent":["/*\nCopyright 2016 - 2021 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { type Direction, EventTimeline } from \"./models/event-timeline.ts\";\nimport { logger } from \"./logger.ts\";\nimport { type MatrixClient } from \"./client.ts\";\nimport { type EventTimelineSet } from \"./models/event-timeline-set.ts\";\nimport { type MatrixEvent } from \"./models/event.ts\";\nimport { type Room, RoomEvent } from \"./models/room.ts\";\n\n/**\n * @internal\n */\nconst DEBUG = false;\n\n/**\n * @internal\n */\n/* istanbul ignore next */\nconst debuglog = DEBUG ? logger.log.bind(logger) : function (): void {};\n\n/**\n * the number of times we ask the server for more events before giving up\n * this is currently higher than it needs to be to workaround lack of a filter\n * for excluding thread responses from main timeline pagination which can cause\n * giving up incorrectly - https://github.com/matrix-org/matrix-spec-proposals/pull/3874\n *\n * @internal\n */\nconst DEFAULT_PAGINATE_LOOP_LIMIT = 10;\n\ninterface IOpts {\n /**\n * Maximum number of events to keep in the window. If more events are retrieved via pagination requests,\n * excess events will be dropped from the other end of the window.\n */\n windowLimit?: number;\n}\n\nexport class TimelineWindow {\n private readonly windowLimit: number;\n // these will be TimelineIndex objects; they delineate the 'start' and\n // 'end' of the window.\n //\n // start.index is inclusive; end.index is exclusive.\n private start?: TimelineIndex;\n private end?: TimelineIndex;\n private eventCount = 0;\n\n /**\n * Construct a TimelineWindow.\n *\n * <p>This abstracts the separate timelines in a Matrix {@link Room} into a single iterable thing.\n * It keeps track of the start and endpoints of the window, which can be advanced with the help\n * of pagination requests.\n *\n * <p>Before the window is useful, it must be initialised by calling {@link TimelineWindow#load}.\n *\n * <p>Note that the window will not automatically extend itself when new events\n * are received from /sync; you should arrange to call {@link TimelineWindow#paginate}\n * on {@link RoomEvent.Timeline} events.\n *\n * <p>Note that constructing an instance of this class for a room adds a\n * listener for RoomEvent.Timeline events which is never removed. In theory\n * this should not cause a leak since the EventEmitter uses weak mappings.\n *\n * @param client - MatrixClient to be used for context/pagination\n * requests.\n *\n * @param timelineSet - The timelineSet to track\n *\n * @param opts - Configuration options for this window\n */\n public constructor(\n private readonly client: MatrixClient,\n private readonly timelineSet: EventTimelineSet,\n opts: IOpts = {},\n ) {\n this.windowLimit = opts.windowLimit || 1000;\n timelineSet.room?.on(RoomEvent.Timeline, this.onTimelineEvent.bind(this));\n }\n\n /**\n * Initialise the window to point at a given event, or the live timeline\n *\n * @param initialEventId - If given, the window will contain the\n * given event\n * @param initialWindowSize - Size of the initial window\n */\n public load(initialEventId?: string, initialWindowSize = 20): Promise<void> {\n // given an EventTimeline, find the event we were looking for, and initialise our\n // fields so that the event in question is in the middle of the window.\n const initFields = (timeline: EventTimeline | null): void => {\n if (!timeline) {\n throw new Error(\"No timeline given to initFields\");\n }\n\n let eventIndex: number;\n\n const events = timeline.getEvents();\n\n if (!initialEventId) {\n // we were looking for the live timeline: initialise to the end\n eventIndex = events.length;\n } else {\n eventIndex = events.findIndex((e) => e.getId() === initialEventId);\n\n if (eventIndex < 0) {\n throw new Error(\"getEventTimeline result didn't include requested event\");\n }\n }\n\n const endIndex = Math.min(events.length, eventIndex + Math.ceil(initialWindowSize / 2));\n const startIndex = Math.max(0, endIndex - initialWindowSize);\n this.start = new TimelineIndex(timeline, startIndex - timeline.getBaseIndex());\n this.end = new TimelineIndex(timeline, endIndex - timeline.getBaseIndex());\n this.eventCount = endIndex - startIndex;\n };\n\n // We avoid delaying the resolution of the promise by a reactor tick if we already have the data we need,\n // which is important to keep room-switching feeling snappy.\n if (this.timelineSet.getTimelineForEvent(initialEventId)) {\n initFields(this.timelineSet.getTimelineForEvent(initialEventId));\n return Promise.resolve();\n } else if (initialEventId) {\n return this.client.getEventTimeline(this.timelineSet, initialEventId).then(initFields);\n } else {\n initFields(this.timelineSet.getLiveTimeline());\n return Promise.resolve();\n }\n }\n\n /**\n * Get the TimelineIndex of the window in the given direction.\n *\n * @param direction - EventTimeline.BACKWARDS to get the TimelineIndex\n * at the start of the window; EventTimeline.FORWARDS to get the TimelineIndex at\n * the end.\n *\n * @returns The requested timeline index if one exists, null\n * otherwise.\n */\n public getTimelineIndex(direction: Direction): TimelineIndex | null {\n if (direction == EventTimeline.BACKWARDS) {\n return this.start ?? null;\n } else if (direction == EventTimeline.FORWARDS) {\n return this.end ?? null;\n } else {\n throw new Error(\"Invalid direction '\" + direction + \"'\");\n }\n }\n\n /**\n * Try to extend the window using events that are already in the underlying\n * TimelineIndex.\n *\n * @param direction - EventTimeline.BACKWARDS to try extending it\n * backwards; EventTimeline.FORWARDS to try extending it forwards.\n * @param size - number of events to try to extend by.\n *\n * @returns true if the window was extended, false otherwise.\n */\n public extend(direction: Direction, size: number): boolean {\n const tl = this.getTimelineIndex(direction);\n\n if (!tl) {\n debuglog(\"TimelineWindow: no timeline yet\");\n return false;\n }\n\n const count = direction == EventTimeline.BACKWARDS ? tl.retreat(size) : tl.advance(size);\n\n if (count) {\n this.eventCount += count;\n debuglog(\"TimelineWindow: increased cap by \" + count + \" (now \" + this.eventCount + \")\");\n // remove some events from the other end, if necessary\n const excess = this.eventCount - this.windowLimit;\n if (excess > 0) {\n this.unpaginate(excess, direction != EventTimeline.BACKWARDS);\n }\n return true;\n }\n\n return false;\n }\n\n private onTimelineEvent(_event?: MatrixEvent, _room?: Room, _atStart?: boolean, removed?: boolean): void {\n if (removed) {\n this.onEventRemoved();\n }\n }\n\n /**\n * If an event was removed, meaning this window is longer than the timeline,\n * shorten the window.\n */\n private onEventRemoved(): void {\n const events = this.getEvents();\n if (events.length > 0 && events[events.length - 1] === undefined && this.end) {\n this.end.index--;\n }\n }\n\n /**\n * Check if this window can be extended\n *\n * <p>This returns true if we either have more events, or if we have a\n * pagination token which means we can paginate in that direction. It does not\n * necessarily mean that there are more events available in that direction at\n * this time.\n *\n * @param direction - EventTimeline.BACKWARDS to check if we can\n * paginate backwards; EventTimeline.FORWARDS to check if we can go forwards\n *\n * @returns true if we can paginate in the given direction\n */\n public canPaginate(direction: Direction): boolean {\n const tl = this.getTimelineIndex(direction);\n\n if (!tl) {\n debuglog(\"TimelineWindow: no timeline yet\");\n return false;\n }\n\n if (direction == EventTimeline.BACKWARDS) {\n if (tl.index > tl.minIndex()) {\n return true;\n }\n } else {\n if (tl.index < tl.maxIndex()) {\n return true;\n }\n }\n\n const hasNeighbouringTimeline = tl.timeline.getNeighbouringTimeline(direction);\n const paginationToken = tl.timeline.getPaginationToken(direction);\n return Boolean(hasNeighbouringTimeline) || Boolean(paginationToken);\n }\n\n /**\n * Attempt to extend the window\n *\n * @param direction - EventTimeline.BACKWARDS to extend the window\n * backwards (towards older events); EventTimeline.FORWARDS to go forwards.\n *\n * @param size - number of events to try to extend by. If fewer than this\n * number are immediately available, then we return immediately rather than\n * making an API call.\n *\n * @param makeRequest - whether we should make API calls to\n * fetch further events if we don't have any at all. (This has no effect if\n * the room already knows about additional events in the relevant direction,\n * even if there are fewer than 'size' of them, as we will just return those\n * we already know about.)\n *\n * @param requestLimit - limit for the number of API requests we\n * should make.\n *\n * @returns Promise which resolves to a boolean which is true if more events\n * were successfully retrieved.\n */\n public async paginate(\n direction: Direction,\n size: number,\n makeRequest = true,\n requestLimit = DEFAULT_PAGINATE_LOOP_LIMIT,\n ): Promise<boolean> {\n // Either wind back the message cap (if there are enough events in the\n // timeline to do so), or fire off a pagination request.\n const tl = this.getTimelineIndex(direction);\n\n if (!tl) {\n debuglog(\"TimelineWindow: no timeline yet\");\n return false;\n }\n\n if (tl.pendingPaginate) {\n return tl.pendingPaginate;\n }\n\n // try moving the cap\n if (this.extend(direction, size)) {\n return true;\n }\n\n if (!makeRequest || requestLimit === 0) {\n // todo: should we return something different to indicate that there\n // might be more events out there, but we haven't found them yet?\n return false;\n }\n\n // try making a pagination request\n const token = tl.timeline.getPaginationToken(direction);\n if (!token) {\n debuglog(\"TimelineWindow: no token\");\n return false;\n }\n\n debuglog(\"TimelineWindow: starting request\");\n\n const prom = this.client\n .paginateEventTimeline(tl.timeline, {\n backwards: direction == EventTimeline.BACKWARDS,\n limit: size,\n })\n .finally(function () {\n tl.pendingPaginate = undefined;\n })\n .then((r) => {\n debuglog(\"TimelineWindow: request completed with result \" + r);\n if (!r) {\n return this.paginate(direction, size, false, 0);\n }\n\n // recurse to advance the index into the results.\n //\n // If we don't get any new events, we want to make sure we keep asking\n // the server for events for as long as we have a valid pagination\n // token. In particular, we want to know if we've actually hit the\n // start of the timeline, or if we just happened to know about all of\n // the events thanks to https://matrix.org/jira/browse/SYN-645.\n //\n // On the other hand, we necessarily want to wait forever for the\n // server to make its mind up about whether there are other events,\n // because it gives a bad user experience\n // (https://github.com/vector-im/vector-web/issues/1204).\n return this.paginate(direction, size, true, requestLimit - 1);\n });\n tl.pendingPaginate = prom;\n return prom;\n }\n\n /**\n * Remove `delta` events from the start or end of the timeline.\n *\n * @param delta - number of events to remove from the timeline\n * @param startOfTimeline - if events should be removed from the start\n * of the timeline.\n */\n public unpaginate(delta: number, startOfTimeline: boolean): void {\n const tl = startOfTimeline ? this.start : this.end;\n if (!tl) {\n throw new Error(\n `Attempting to unpaginate startOfTimeline=${startOfTimeline} but don't have this direction`,\n );\n }\n\n // sanity-check the delta\n if (delta > this.eventCount || delta < 0) {\n throw new Error(\n `Attemting to unpaginate ${delta} events, but only have ${this.eventCount} in the timeline`,\n );\n }\n\n while (delta > 0) {\n const count = startOfTimeline ? tl.advance(delta) : tl.retreat(delta);\n if (count <= 0) {\n // sadness. This shouldn't be possible.\n throw new Error(\"Unable to unpaginate any further, but still have \" + this.eventCount + \" events\");\n }\n\n delta -= count;\n this.eventCount -= count;\n debuglog(\"TimelineWindow.unpaginate: dropped \" + count + \" (now \" + this.eventCount + \")\");\n }\n }\n\n /**\n * Get a list of the events currently in the window\n *\n * @returns the events in the window\n */\n public getEvents(): MatrixEvent[] {\n if (!this.start) {\n // not yet loaded\n return [];\n }\n\n const result: MatrixEvent[] = [];\n\n // iterate through each timeline between this.start and this.end\n // (inclusive).\n let timeline: EventTimeline | null = this.start.timeline;\n // eslint-disable-next-line no-constant-condition\n while (timeline) {\n const events = timeline.getEvents();\n\n // For the first timeline in the chain, we want to start at\n // this.start.index. For the last timeline in the chain, we want to\n // stop before this.end.index. Otherwise, we want to copy all of the\n // events in the timeline.\n //\n // (Note that both this.start.index and this.end.index are relative\n // to their respective timelines' BaseIndex).\n //\n let startIndex = 0;\n let endIndex = events.length;\n if (timeline === this.start.timeline) {\n startIndex = this.start.index + timeline.getBaseIndex();\n }\n if (timeline === this.end?.timeline) {\n endIndex = this.end.index + timeline.getBaseIndex();\n }\n\n for (let i = startIndex; i < endIndex; i++) {\n result.push(events[i]);\n }\n\n // if we're not done, iterate to the next timeline.\n if (timeline === this.end?.timeline) {\n break;\n } else {\n timeline = timeline.getNeighbouringTimeline(EventTimeline.FORWARDS);\n }\n }\n\n return result;\n }\n}\n\n/**\n * A thing which contains a timeline reference, and an index into it.\n * @internal\n */\nexport class TimelineIndex {\n public pendingPaginate?: Promise<boolean>;\n\n // index: the indexes are relative to BaseIndex, so could well be negative.\n public constructor(\n public timeline: EventTimeline,\n public index: number,\n ) {}\n\n /**\n * @returns the minimum possible value for the index in the current\n * timeline\n */\n public minIndex(): number {\n return this.timeline.getBaseIndex() * -1;\n }\n\n /**\n * @returns the maximum possible value for the index in the current\n * timeline (exclusive - ie, it actually returns one more than the index\n * of the last element).\n */\n public maxIndex(): number {\n return this.timeline.getEvents().length - this.timeline.getBaseIndex();\n }\n\n /**\n * Try move the index forward, or into the neighbouring timeline\n *\n * @param delta - number of events to advance by\n * @returns number of events successfully advanced by\n */\n public advance(delta: number): number {\n if (!delta) {\n return 0;\n }\n\n // first try moving the index in the current timeline. See if there is room\n // to do so.\n let cappedDelta;\n if (delta < 0) {\n // we want to wind the index backwards.\n //\n // (this.minIndex() - this.index) is a negative number whose magnitude\n // is the amount of room we have to wind back the index in the current\n // timeline. We cap delta to this quantity.\n cappedDelta = Math.max(delta, this.minIndex() - this.index);\n if (cappedDelta < 0) {\n this.index += cappedDelta;\n return cappedDelta;\n }\n } else {\n // we want to wind the index forwards.\n //\n // (this.maxIndex() - this.index) is a (positive) number whose magnitude\n // is the amount of room we have to wind forward the index in the current\n // timeline. We cap delta to this quantity.\n cappedDelta = Math.min(delta, this.maxIndex() - this.index);\n if (cappedDelta > 0) {\n this.index += cappedDelta;\n return cappedDelta;\n }\n }\n\n // the index is already at the start/end of the current timeline.\n //\n // next see if there is a neighbouring timeline to switch to.\n const neighbour = this.timeline.getNeighbouringTimeline(\n delta < 0 ? EventTimeline.BACKWARDS : EventTimeline.FORWARDS,\n );\n if (neighbour) {\n this.timeline = neighbour;\n if (delta < 0) {\n this.index = this.maxIndex();\n } else {\n this.index = this.minIndex();\n }\n\n debuglog(\"paginate: switched to new neighbour\");\n\n // recurse, using the next timeline\n return this.advance(delta);\n }\n\n return 0;\n }\n\n /**\n * Try move the index backwards, or into the neighbouring timeline\n *\n * @param delta - number of events to retreat by\n * @returns number of events successfully retreated by\n */\n public retreat(delta: number): number {\n return this.advance(delta * -1) * -1;\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAyB,aAAa,QAAQ,4BAA4B;AAC1E,SAAS,MAAM,QAAQ,aAAa;AAIpC,SAAoB,SAAS,QAAQ,kBAAkB;;AAEvD;AACA;AACA;AACA,MAAM,KAAK,GAAG,KAAK;;AAEnB;AACA;AACA;AACA;AACA,MAAM,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,YAAkB,CAAC,CAAC;;AAEvE;AACA;AACA;A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"],"sourcesContent":["/*\nCopyright 2016 - 2021 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { type Direction, EventTimeline } from \"./models/event-timeline.ts\";\nimport { logger } from \"./logger.ts\";\nimport { type MatrixClient } from \"./client.ts\";\nimport { type EventTimelineSet } from \"./models/event-timeline-set.ts\";\nimport { type MatrixEvent } from \"./models/event.ts\";\nimport { type Room, RoomEvent } from \"./models/room.ts\";\n\n/**\n * @internal\n */\nconst DEBUG = false;\n\n/**\n * @internal\n */\n/* istanbul ignore next */\nconst debuglog = DEBUG ? logger.log.bind(logger) : function (): void {};\n\n/**\n * the number of times we ask the server for more events before giving up\n * this is currently higher than it needs to be to workaround lack of a filter\n * for excluding thread responses from main timeline pagination which can cause\n * giving up incorrectly - https://github.com/matrix-org/matrix-spec-proposals/pull/3874\n *\n * @internal\n */\nconst DEFAULT_PAGINATE_LOOP_LIMIT = 10;\n\ninterface IOpts {\n /**\n * Maximum number of events to keep in the window. If more events are retrieved via pagination requests,\n * excess events will be dropped from the other end of the window.\n */\n windowLimit?: number;\n}\n\nexport class TimelineWindow {\n private readonly windowLimit: number;\n // these will be TimelineIndex objects; they delineate the 'start' and\n // 'end' of the window.\n //\n // start.index is inclusive; end.index is exclusive.\n private start?: TimelineIndex;\n private end?: TimelineIndex;\n private eventCount = 0;\n\n /**\n * Construct a TimelineWindow.\n *\n * <p>This abstracts the separate timelines in a Matrix {@link Room} into a single iterable thing.\n * It keeps track of the start and endpoints of the window, which can be advanced with the help\n * of pagination requests.\n *\n * <p>Before the window is useful, it must be initialised by calling {@link TimelineWindow#load}.\n *\n * <p>Note that the window will not automatically extend itself when new events\n * are received from /sync; you should arrange to call {@link TimelineWindow#paginate}\n * on {@link RoomEvent.Timeline} events.\n *\n * <p>Note that constructing an instance of this class for a room adds a\n * listener for RoomEvent.Timeline events which is never removed. In theory\n * this should not cause a leak since the EventEmitter uses weak mappings.\n *\n * @param client - MatrixClient to be used for context/pagination\n * requests.\n *\n * @param timelineSet - The timelineSet to track\n *\n * @param opts - Configuration options for this window\n */\n public constructor(\n private readonly client: MatrixClient,\n private readonly timelineSet: EventTimelineSet,\n opts: IOpts = {},\n ) {\n this.windowLimit = opts.windowLimit || 1000;\n timelineSet.room?.on(RoomEvent.Timeline, this.onTimelineEvent.bind(this));\n }\n\n /**\n * Initialise the window to point at a given event, or the live timeline\n *\n * @param initialEventId - If given, the window will contain the\n * given event\n * @param initialWindowSize - Size of the initial window\n */\n public load(initialEventId?: string, initialWindowSize = 20): Promise<void> {\n // given an EventTimeline, find the event we were looking for, and initialise our\n // fields so that the event in question is in the middle of the window.\n const initFields = (timeline: EventTimeline | null): void => {\n if (!timeline) {\n throw new Error(\"No timeline given to initFields\");\n }\n\n let eventIndex: number;\n\n const events = timeline.getEvents();\n\n if (!initialEventId) {\n // we were looking for the live timeline: initialise to the end\n eventIndex = events.length;\n } else {\n eventIndex = events.findIndex((e) => e.getId() === initialEventId);\n\n if (eventIndex < 0) {\n throw new Error(\"getEventTimeline result didn't include requested event\");\n }\n }\n\n const endIndex = Math.min(events.length, eventIndex + Math.ceil(initialWindowSize / 2));\n const startIndex = Math.max(0, endIndex - initialWindowSize);\n this.start = new TimelineIndex(timeline, startIndex - timeline.getBaseIndex());\n this.end = new TimelineIndex(timeline, endIndex - timeline.getBaseIndex());\n this.eventCount = endIndex - startIndex;\n };\n\n // We avoid delaying the resolution of the promise by a reactor tick if we already have the data we need,\n // which is important to keep room-switching feeling snappy.\n if (this.timelineSet.getTimelineForEvent(initialEventId)) {\n initFields(this.timelineSet.getTimelineForEvent(initialEventId));\n return Promise.resolve();\n } else if (initialEventId) {\n return this.client.getEventTimeline(this.timelineSet, initialEventId).then(initFields);\n } else {\n initFields(this.timelineSet.getLiveTimeline());\n return Promise.resolve();\n }\n }\n\n /**\n * Get the TimelineIndex of the window in the given direction.\n *\n * @param direction - EventTimeline.BACKWARDS to get the TimelineIndex\n * at the start of the window; EventTimeline.FORWARDS to get the TimelineIndex at\n * the end.\n *\n * @returns The requested timeline index if one exists, null\n * otherwise.\n */\n public getTimelineIndex(direction: Direction): TimelineIndex | null {\n if (direction == EventTimeline.BACKWARDS) {\n return this.start ?? null;\n } else if (direction == EventTimeline.FORWARDS) {\n return this.end ?? null;\n } else {\n throw new Error(\"Invalid direction '\" + direction + \"'\");\n }\n }\n\n /**\n * Try to extend the window using events that are already in the underlying\n * TimelineIndex.\n *\n * @param direction - EventTimeline.BACKWARDS to try extending it\n * backwards; EventTimeline.FORWARDS to try extending it forwards.\n * @param size - number of events to try to extend by.\n *\n * @returns true if the window was extended, false otherwise.\n */\n public extend(direction: Direction, size: number): boolean {\n const tl = this.getTimelineIndex(direction);\n\n if (!tl) {\n debuglog(\"TimelineWindow: no timeline yet\");\n return false;\n }\n\n const count = direction == EventTimeline.BACKWARDS ? tl.retreat(size) : tl.advance(size);\n\n if (count) {\n this.eventCount += count;\n debuglog(\"TimelineWindow: increased cap by \" + count + \" (now \" + this.eventCount + \")\");\n // remove some events from the other end, if necessary\n const excess = this.eventCount - this.windowLimit;\n if (excess > 0) {\n this.unpaginate(excess, direction != EventTimeline.BACKWARDS);\n }\n return true;\n }\n\n return false;\n }\n\n private onTimelineEvent(_event?: MatrixEvent, _room?: Room, _atStart?: boolean, removed?: boolean): void {\n if (removed) {\n this.onEventRemoved();\n }\n }\n\n /**\n * If an event was removed, meaning this window is longer than the timeline,\n * shorten the window.\n */\n private onEventRemoved(): void {\n const events = this.getEvents();\n if (events.length > 0 && events[events.length - 1] === undefined && this.end) {\n this.end.index--;\n }\n }\n\n /**\n * Check if this window can be extended\n *\n * <p>This returns true if we either have more events, or if we have a\n * pagination token which means we can paginate in that direction. It does not\n * necessarily mean that there are more events available in that direction at\n * this time.\n *\n * @param direction - EventTimeline.BACKWARDS to check if we can\n * paginate backwards; EventTimeline.FORWARDS to check if we can go forwards\n *\n * @returns true if we can paginate in the given direction\n */\n public canPaginate(direction: Direction): boolean {\n const tl = this.getTimelineIndex(direction);\n\n if (!tl) {\n debuglog(\"TimelineWindow: no timeline yet\");\n return false;\n }\n\n if (direction == EventTimeline.BACKWARDS) {\n if (tl.index > tl.minIndex()) {\n return true;\n }\n } else {\n if (tl.index < tl.maxIndex()) {\n return true;\n }\n }\n\n const hasNeighbouringTimeline = tl.timeline.getNeighbouringTimeline(direction);\n const paginationToken = tl.timeline.getPaginationToken(direction);\n return Boolean(hasNeighbouringTimeline) || Boolean(paginationToken);\n }\n\n /**\n * Attempt to extend the window\n *\n * @param direction - EventTimeline.BACKWARDS to extend the window\n * backwards (towards older events); EventTimeline.FORWARDS to go forwards.\n *\n * @param size - number of events to try to extend by. If fewer than this\n * number are immediately available, then we return immediately rather than\n * making an API call.\n *\n * @param makeRequest - whether we should make API calls to\n * fetch further events if we don't have any at all. (This has no effect if\n * the room already knows about additional events in the relevant direction,\n * even if there are fewer than 'size' of them, as we will just return those\n * we already know about.)\n *\n * @param requestLimit - limit for the number of API requests we\n * should make.\n *\n * @returns Promise which resolves to a boolean which is true if more events\n * were successfully retrieved.\n */\n public async paginate(\n direction: Direction,\n size: number,\n makeRequest = true,\n requestLimit = DEFAULT_PAGINATE_LOOP_LIMIT,\n ): Promise<boolean> {\n // Either wind back the message cap (if there are enough events in the\n // timeline to do so), or fire off a pagination request.\n const tl = this.getTimelineIndex(direction);\n\n if (!tl) {\n debuglog(\"TimelineWindow: no timeline yet\");\n return false;\n }\n\n if (tl.pendingPaginate) {\n return tl.pendingPaginate;\n }\n\n // try moving the cap\n if (this.extend(direction, size)) {\n return true;\n }\n\n if (!makeRequest || requestLimit === 0) {\n // todo: should we return something different to indicate that there\n // might be more events out there, but we haven't found them yet?\n return false;\n }\n\n // try making a pagination request\n const token = tl.timeline.getPaginationToken(direction);\n if (!token) {\n debuglog(\"TimelineWindow: no token\");\n return false;\n }\n\n debuglog(\"TimelineWindow: starting request\");\n\n const prom = this.client\n .paginateEventTimeline(tl.timeline, {\n backwards: direction == EventTimeline.BACKWARDS,\n limit: size,\n })\n .finally(function () {\n tl.pendingPaginate = undefined;\n })\n .then((r) => {\n debuglog(\"TimelineWindow: request completed with result \" + r);\n if (!r) {\n return this.paginate(direction, size, false, 0);\n }\n\n // recurse to advance the index into the results.\n //\n // If we don't get any new events, we want to make sure we keep asking\n // the server for events for as long as we have a valid pagination\n // token. In particular, we want to know if we've actually hit the\n // start of the timeline, or if we just happened to know about all of\n // the events thanks to https://matrix.org/jira/browse/SYN-645.\n //\n // On the other hand, we necessarily want to wait forever for the\n // server to make its mind up about whether there are other events,\n // because it gives a bad user experience\n // (https://github.com/vector-im/vector-web/issues/1204).\n return this.paginate(direction, size, true, requestLimit - 1);\n });\n tl.pendingPaginate = prom;\n return prom;\n }\n\n /**\n * Remove `delta` events from the start or end of the timeline.\n *\n * @param delta - number of events to remove from the timeline\n * @param startOfTimeline - if events should be removed from the start\n * of the timeline.\n */\n public unpaginate(delta: number, startOfTimeline: boolean): void {\n const tl = startOfTimeline ? this.start : this.end;\n if (!tl) {\n throw new Error(\n `Attempting to unpaginate startOfTimeline=${startOfTimeline} but don't have this direction`,\n );\n }\n\n // sanity-check the delta\n if (delta > this.eventCount || delta < 0) {\n throw new Error(\n `Attemting to unpaginate ${delta} events, but only have ${this.eventCount} in the timeline`,\n );\n }\n\n while (delta > 0) {\n const count = startOfTimeline ? tl.advance(delta) : tl.retreat(delta);\n if (count <= 0) {\n // sadness. This shouldn't be possible.\n throw new Error(\"Unable to unpaginate any further, but still have \" + this.eventCount + \" events\");\n }\n\n delta -= count;\n this.eventCount -= count;\n debuglog(\"TimelineWindow.unpaginate: dropped \" + count + \" (now \" + this.eventCount + \")\");\n }\n }\n\n /**\n * Get a list of the events currently in the window\n *\n * @returns the events in the window\n */\n public getEvents(): MatrixEvent[] {\n if (!this.start) {\n // not yet loaded\n return [];\n }\n\n const result: MatrixEvent[] = [];\n\n // iterate through each timeline between this.start and this.end\n // (inclusive).\n let timeline: EventTimeline | null = this.start.timeline;\n while (timeline) {\n const events = timeline.getEvents();\n\n // For the first timeline in the chain, we want to start at\n // this.start.index. For the last timeline in the chain, we want to\n // stop before this.end.index. Otherwise, we want to copy all of the\n // events in the timeline.\n //\n // (Note that both this.start.index and this.end.index are relative\n // to their respective timelines' BaseIndex).\n //\n let startIndex = 0;\n let endIndex = events.length;\n if (timeline === this.start.timeline) {\n startIndex = this.start.index + timeline.getBaseIndex();\n }\n if (timeline === this.end?.timeline) {\n endIndex = this.end.index + timeline.getBaseIndex();\n }\n\n for (let i = startIndex; i < endIndex; i++) {\n result.push(events[i]);\n }\n\n // if we're not done, iterate to the next timeline.\n if (timeline === this.end?.timeline) {\n break;\n } else {\n timeline = timeline.getNeighbouringTimeline(EventTimeline.FORWARDS);\n }\n }\n\n return result;\n }\n}\n\n/**\n * A thing which contains a timeline reference, and an index into it.\n * @internal\n */\nexport class TimelineIndex {\n public pendingPaginate?: Promise<boolean>;\n\n // index: the indexes are relative to BaseIndex, so could well be negative.\n public constructor(\n public timeline: EventTimeline,\n public index: number,\n ) {}\n\n /**\n * @returns the minimum possible value for the index in the current\n * timeline\n */\n public minIndex(): number {\n return this.timeline.getBaseIndex() * -1;\n }\n\n /**\n * @returns the maximum possible value for the index in the current\n * timeline (exclusive - ie, it actually returns one more than the index\n * of the last element).\n */\n public maxIndex(): number {\n return this.timeline.getEvents().length - this.timeline.getBaseIndex();\n }\n\n /**\n * Try move the index forward, or into the neighbouring timeline\n *\n * @param delta - number of events to advance by\n * @returns number of events successfully advanced by\n */\n public advance(delta: number): number {\n if (!delta) {\n return 0;\n }\n\n // first try moving the index in the current timeline. See if there is room\n // to do so.\n let cappedDelta;\n if (delta < 0) {\n // we want to wind the index backwards.\n //\n // (this.minIndex() - this.index) is a negative number whose magnitude\n // is the amount of room we have to wind back the index in the current\n // timeline. We cap delta to this quantity.\n cappedDelta = Math.max(delta, this.minIndex() - this.index);\n if (cappedDelta < 0) {\n this.index += cappedDelta;\n return cappedDelta;\n }\n } else {\n // we want to wind the index forwards.\n //\n // (this.maxIndex() - this.index) is a (positive) number whose magnitude\n // is the amount of room we have to wind forward the index in the current\n // timeline. We cap delta to this quantity.\n cappedDelta = Math.min(delta, this.maxIndex() - this.index);\n if (cappedDelta > 0) {\n this.index += cappedDelta;\n return cappedDelta;\n }\n }\n\n // the index is already at the start/end of the current timeline.\n //\n // next see if there is a neighbouring timeline to switch to.\n const neighbour = this.timeline.getNeighbouringTimeline(\n delta < 0 ? EventTimeline.BACKWARDS : EventTimeline.FORWARDS,\n );\n if (neighbour) {\n this.timeline = neighbour;\n if (delta < 0) {\n this.index = this.maxIndex();\n } else {\n this.index = this.minIndex();\n }\n\n debuglog(\"paginate: switched to new neighbour\");\n\n // recurse, using the next timeline\n return this.advance(delta);\n }\n\n return 0;\n }\n\n /**\n * Try move the index backwards, or into the neighbouring timeline\n *\n * @param delta - number of events to retreat by\n * @returns number of events successfully retreated by\n */\n public retreat(delta: number): number {\n return this.advance(delta * -1) * -1;\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAyB,aAAa,QAAQ,4BAA4B;AAC1E,SAAS,MAAM,QAAQ,aAAa;AAIpC,SAAoB,SAAS,QAAQ,kBAAkB;;AAEvD;AACA;AACA;AACA,MAAM,KAAK,GAAG,KAAK;;AAEnB;AACA;AACA;AACA;AACA,MAAM,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,YAAkB,CAAC,CAAC;;AAEvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,2BAA2B,GA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],"mappings":"AAmBA;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"deriveKeys.d.ts","sourceRoot":"","sources":["../../../src/utils/internal/deriveKeys.ts"],"names":[],"mappings":"AAmBA;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAkC5G"}
|
|
@@ -32,7 +32,6 @@ export async function deriveKeys(key, name) {
|
|
|
32
32
|
const keybits = await globalThis.crypto.subtle.deriveBits({
|
|
33
33
|
name: "HKDF",
|
|
34
34
|
salt: zeroSalt,
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
36
35
|
// @ts-ignore: https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/879
|
|
37
36
|
info: new TextEncoder().encode(name),
|
|
38
37
|
hash: "SHA-256"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deriveKeys.js","names":[],"sources":["../../../src/utils/internal/deriveKeys.ts"],"sourcesContent":["/*\n * Copyright 2024 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// salt for HKDF, with 8 bytes of zeros\nconst zeroSalt = new Uint8Array(8);\n\n/**\n * Derive AES and HMAC keys from a master key.\n *\n * This is used for deriving secret storage keys: see https://spec.matrix.org/v1.11/client-server-api/#msecret_storagev1aes-hmac-sha2 (step 1).\n *\n * @param key\n * @param name\n */\nexport async function deriveKeys(key: Uint8Array<ArrayBuffer>, name: string): Promise<[CryptoKey, CryptoKey]> {\n const hkdfkey = await globalThis.crypto.subtle.importKey(\"raw\", key, { name: \"HKDF\" }, false, [\"deriveBits\"]);\n const keybits = await globalThis.crypto.subtle.deriveBits(\n {\n name: \"HKDF\",\n salt: zeroSalt,\n //
|
|
1
|
+
{"version":3,"file":"deriveKeys.js","names":[],"sources":["../../../src/utils/internal/deriveKeys.ts"],"sourcesContent":["/*\n * Copyright 2024 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// salt for HKDF, with 8 bytes of zeros\nconst zeroSalt = new Uint8Array(8);\n\n/**\n * Derive AES and HMAC keys from a master key.\n *\n * This is used for deriving secret storage keys: see https://spec.matrix.org/v1.11/client-server-api/#msecret_storagev1aes-hmac-sha2 (step 1).\n *\n * @param key\n * @param name\n */\nexport async function deriveKeys(key: Uint8Array<ArrayBuffer>, name: string): Promise<[CryptoKey, CryptoKey]> {\n const hkdfkey = await globalThis.crypto.subtle.importKey(\"raw\", key, { name: \"HKDF\" }, false, [\"deriveBits\"]);\n const keybits = await globalThis.crypto.subtle.deriveBits(\n {\n name: \"HKDF\",\n salt: zeroSalt,\n // @ts-ignore: https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/879\n info: new TextEncoder().encode(name),\n hash: \"SHA-256\",\n },\n hkdfkey,\n 512,\n );\n\n const aesKey = keybits.slice(0, 32);\n const hmacKey = keybits.slice(32);\n\n const aesProm = globalThis.crypto.subtle.importKey(\"raw\", aesKey, { name: \"AES-CTR\" }, false, [\n \"encrypt\",\n \"decrypt\",\n ]);\n\n const hmacProm = globalThis.crypto.subtle.importKey(\n \"raw\",\n hmacKey,\n {\n name: \"HMAC\",\n hash: { name: \"SHA-256\" },\n },\n false,\n [\"sign\", \"verify\"],\n );\n\n return Promise.all([aesProm, hmacProm]);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAM,QAAQ,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAe,UAAU,CAAC,GAA4B,EAAE,IAAY,EAAmC;EAC1G,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE;IAAE,IAAI,EAAE;EAAO,CAAC,EAAE,KAAK,EAAE,CAAC,YAAY,CAAC,CAAC;EAC7G,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CACrD;IACI,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,QAAQ;IACd;IACA,IAAI,EAAE,IAAI,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;IACpC,IAAI,EAAE;EACV,CAAC,EACD,OAAO,EACP,GACJ,CAAC;EAED,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;EACnC,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;EAEjC,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE;IAAE,IAAI,EAAE;EAAU,CAAC,EAAE,KAAK,EAAE,CAC1F,SAAS,EACT,SAAS,CACZ,CAAC;EAEF,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAC/C,KAAK,EACL,OAAO,EACP;IACI,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE;MAAE,IAAI,EAAE;IAAU;EAC5B,CAAC,EACD,KAAK,EACL,CAAC,MAAM,EAAE,QAAQ,CACrB,CAAC;EAED,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC3C","ignoreList":[]}
|
|
@@ -255,7 +255,7 @@ export declare function mapsEqual<K, V>(x: Map<K, V>, y: Map<K, V>, eq?: (v1: V,
|
|
|
255
255
|
* Also supports sub-lists of Maps.
|
|
256
256
|
*/
|
|
257
257
|
export declare function recursiveMapToObject(map: Map<any, any>): Record<any, any>;
|
|
258
|
-
export declare function unsafeProp
|
|
258
|
+
export declare function unsafeProp(prop: keyof any | undefined): boolean;
|
|
259
259
|
export declare function safeSet<O extends Record<any, any>, K extends keyof O>(obj: O, prop: K, value: O[K]): void;
|
|
260
260
|
export declare function noUnsafeEventProps(event: Partial<IEvent>): boolean;
|
|
261
261
|
export declare class MapWithDefault<K, V> extends Map<K, V> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGlE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9C;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGlE,OAAO,EAA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,MAAM,CAAC,KAAG,OAAoB,GAAG,OAAO,CAO9G;AAcD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAQzE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,SAAS,GAAG,OAAO,CAE/D;AAED,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAMzG;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAElE;AAED,qBAAa,cAAc,CAAC,CAAC,EAAE,CAAC,CAAE,SAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;IAC5B,OAAO,CAAC,aAAa;IAAxC,YAA2B,aAAa,EAAE,MAAM,CAAC,EAEhD;IAED;;;OAGG;IACI,WAAW,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAM5B;CACJ"}
|
|
@@ -34,6 +34,7 @@ const interns = new Map();
|
|
|
34
34
|
export function internaliseString(str) {
|
|
35
35
|
// Unwrap strings before entering the map, if we somehow got a wrapped
|
|
36
36
|
// string as our input. This should only happen from tests.
|
|
37
|
+
// oxlint-disable-next-line unicorn/no-instanceof-builtins
|
|
37
38
|
if (str instanceof String) {
|
|
38
39
|
str = str.toString();
|
|
39
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["/*\nCopyright 2015, 2016, 2019, 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/**\n * This is an internal module.\n */\n\nimport unhomoglyph from \"unhomoglyph\";\nimport promiseRetry from \"p-retry\";\n\nimport { type IEvent, type MatrixEvent } from \"./models/event.ts\";\nimport { M_TIMESTAMP } from \"./@types/location.ts\";\nimport { ReceiptType } from \"./@types/read_receipts.ts\";\nimport { type BaseLogger } from \"./logger.ts\";\n\nconst interns = new Map<string, string>();\n\n/**\n * Internalises a string, reusing a known pointer or storing the pointer\n * if needed for future strings.\n * @param str - The string to internalise.\n * @returns The internalised string.\n */\nexport function internaliseString(str: string): string {\n // Unwrap strings before entering the map, if we somehow got a wrapped\n // string as our input. This should only happen from tests.\n if ((str as unknown) instanceof String) {\n str = str.toString();\n }\n\n // Check the map to see if we can store the value\n if (!interns.has(str)) {\n interns.set(str, str);\n }\n\n // Return any cached string reference\n return interns.get(str)!;\n}\n\n/**\n * Encode a dictionary of query parameters.\n * Omits any undefined/null values.\n * @param params - A dict of key/values to encode e.g.\n * `{\"foo\": \"bar\", \"baz\": \"taz\"}`\n * @returns The encoded string e.g. foo=bar&baz=taz\n */\nexport function encodeParams(params: QueryDict, urlSearchParams?: URLSearchParams): URLSearchParams {\n const searchParams = urlSearchParams ?? new URLSearchParams();\n for (const [key, val] of Object.entries(params)) {\n if (val !== undefined && val !== null) {\n if (Array.isArray(val)) {\n val.forEach((v) => {\n searchParams.append(key, String(v));\n });\n } else {\n searchParams.append(key, String(val));\n }\n }\n }\n return searchParams;\n}\n\nexport type QueryDict = Record<string, string[] | string | number | boolean | undefined>;\n\n/**\n * Replace a stable parameter with the unstable naming for params\n */\nexport function replaceParam(stable: string, unstable: string, dict: QueryDict): QueryDict {\n const result = {\n ...dict,\n [unstable]: dict[stable],\n };\n delete result[stable];\n return result;\n}\n\n/**\n * Decode a query string in `application/x-www-form-urlencoded` format.\n * @param query - A query string to decode e.g.\n * foo=bar&via=server1&server2\n * @returns The decoded object, if any keys occurred multiple times\n * then the value will be an array of strings, else it will be an array.\n * This behaviour matches Node's qs.parse but is built on URLSearchParams\n * for native web compatibility\n */\nexport function decodeParams(query: string): Record<string, string | string[]> {\n const o: Record<string, string | string[]> = {};\n const params = new URLSearchParams(query);\n for (const key of params.keys()) {\n const val = params.getAll(key);\n o[key] = val.length === 1 ? val[0] : val;\n }\n return o;\n}\n\n/**\n * Encodes a URI according to a set of template variables. Variables will be\n * passed through encodeURIComponent.\n * @param pathTemplate - The path with template variables e.g. '/foo/$bar'.\n * @param variables - The key/value pairs to replace the template\n * variables with. E.g. `{ \"$bar\": \"baz\" }`.\n * @returns The result of replacing all template variables e.g. '/foo/baz'.\n */\nexport function encodeUri(pathTemplate: string, variables: Record<string, string | null | undefined>): string {\n for (const key in variables) {\n if (!variables.hasOwnProperty(key)) {\n continue;\n }\n const value = variables[key];\n if (value === undefined || value === null) {\n continue;\n }\n pathTemplate = pathTemplate.replace(key, encodeURIComponent(value));\n }\n return pathTemplate;\n}\n\n/**\n * The removeElement() method removes the first element in the array that\n * satisfies (returns true) the provided testing function.\n * @param array - The array.\n * @param fn - Function to execute on each value in the array, with the\n * function signature `fn(element, index, array)`. Return true to\n * remove this element and break.\n * @param reverse - True to search in reverse order.\n * @returns True if an element was removed.\n */\nexport function removeElement<T>(array: T[], fn: (t: T, i?: number, a?: T[]) => boolean, reverse?: boolean): boolean {\n let i: number;\n if (reverse) {\n for (i = array.length - 1; i >= 0; i--) {\n if (fn(array[i], i, array)) {\n array.splice(i, 1);\n return true;\n }\n }\n } else {\n for (i = 0; i < array.length; i++) {\n if (fn(array[i], i, array)) {\n array.splice(i, 1);\n return true;\n }\n }\n }\n return false;\n}\n\n/**\n * Checks if the given thing is a function.\n * @param value - The thing to check.\n * @returns True if it is a function.\n */\nexport function isFunction(value: any): boolean {\n return Object.prototype.toString.call(value) === \"[object Function]\";\n}\n\n/**\n * Checks that the given object has the specified keys.\n * @param obj - The object to check.\n * @param keys - The list of keys that 'obj' must have.\n * @throws If the object is missing keys.\n */\n// note using 'keys' here would shadow the 'keys' function defined above\nexport function checkObjectHasKeys(obj: object, keys: string[]): void {\n for (const key of keys) {\n if (!obj.hasOwnProperty(key)) {\n throw new Error(\"Missing required key: \" + key);\n }\n }\n}\n\n/**\n * Deep copy the given object. The object MUST NOT have circular references and\n * MUST NOT have functions.\n * @param obj - The object to deep copy.\n * @returns A copy of the object without any references to the original.\n */\nexport function deepCopy<T>(obj: T): T {\n return JSON.parse(JSON.stringify(obj));\n}\n\n/**\n * Compare two objects for equality. The objects MUST NOT have circular references.\n *\n * @param x - The first object to compare.\n * @param y - The second object to compare.\n *\n * @returns true if the two objects are equal\n */\nexport function deepCompare(x: any, y: any): boolean {\n // Inspired by\n // http://stackoverflow.com/questions/1068834/object-comparison-in-javascript#1144249\n\n // Compare primitives and functions.\n // Also check if both arguments link to the same object.\n if (x === y) {\n return true;\n }\n\n if (typeof x !== typeof y) {\n return false;\n }\n\n // special-case NaN (since NaN !== NaN)\n if (typeof x === \"number\" && isNaN(x) && isNaN(y)) {\n return true;\n }\n\n // special-case null (since typeof null == 'object', but null.constructor\n // throws)\n if (x === null || y === null) {\n return x === y;\n }\n\n // everything else is either an unequal primitive, or an object\n // XXX: this check has been temporarily tweaked due to issues in the jest test environment,\n // this will be reverted as part of the migration to vitest\n if (\n x.constructor.name !== \"Object\" &&\n x.constructor.name !== \"RegExp\" &&\n x.constructor.name !== \"Date\" &&\n x.constructor.name !== \"Array\"\n ) {\n return false;\n }\n\n // check they are the same type of object\n // XXX: this check has been temporarily tweaked due to issues in the jest test environment,\n // this will be reverted as part of the migration to vitest\n if (x.prototype !== y.prototype) {\n return false;\n }\n\n // special-casing for some special types of object\n if (x instanceof RegExp || x instanceof Date) {\n return x.toString() === y.toString();\n }\n\n // the object algorithm works for Array, but it's sub-optimal.\n if (Array.isArray(x)) {\n if (x.length !== y.length) {\n return false;\n }\n\n for (let i = 0; i < x.length; i++) {\n if (!deepCompare(x[i], y[i])) {\n return false;\n }\n }\n } else {\n // check that all of y's direct keys are in x\n for (const p in y) {\n if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) {\n return false;\n }\n }\n\n // finally, compare each of x's keys with y\n for (const p in x) {\n if (y.hasOwnProperty(p) !== x.hasOwnProperty(p) || !deepCompare(x[p], y[p])) {\n return false;\n }\n }\n }\n return true;\n}\n\n// Dev note: This returns an array of tuples, but jsdoc doesn't like that. https://github.com/jsdoc/jsdoc/issues/1703\n/**\n * Creates an array of object properties/values (entries) then\n * sorts the result by key, recursively. The input object must\n * ensure it does not have loops. If the input is not an object\n * then it will be returned as-is.\n * @param obj - The object to get entries of\n * @returns The entries, sorted by key.\n */\nexport function deepSortedObjectEntries(obj: any): [string, any][] {\n if (typeof obj !== \"object\") return obj;\n\n // Apparently these are object types...\n if (obj === null || obj === undefined || Array.isArray(obj)) return obj;\n\n const pairs: [string, any][] = [];\n for (const [k, v] of Object.entries(obj)) {\n pairs.push([k, deepSortedObjectEntries(v)]);\n }\n\n // lexicographicCompare is faster than localeCompare, so let's use that.\n pairs.sort((a, b) => lexicographicCompare(a[0], b[0]));\n\n return pairs;\n}\n\n/**\n * Returns whether the given value is a finite number without type-coercion\n *\n * @param value - the value to test\n * @returns whether or not value is a finite number without type-coercion\n */\nexport function isNumber(value: any): value is number {\n return typeof value === \"number\" && isFinite(value);\n}\n\n/**\n * Removes zero width chars, diacritics and whitespace from the string\n * Also applies an unhomoglyph on the string, to prevent similar looking chars\n * @param str - the string to remove hidden characters from\n * @returns a string with the hidden characters removed\n */\nexport function removeHiddenChars(str: string): string {\n if (typeof str === \"string\") {\n return unhomoglyph(str.normalize(\"NFD\").replace(removeHiddenCharsRegex, \"\"));\n }\n return \"\";\n}\n\n/**\n * Removes the direction override characters from a string\n * @returns string with chars removed\n */\nexport function removeDirectionOverrideChars(str: string): string {\n if (typeof str === \"string\") {\n return str.replace(/[\\u202d-\\u202e]/g, \"\");\n }\n return \"\";\n}\n\nexport function normalize(str: string): string {\n // Note: we have to match the filter with the removeHiddenChars() because the\n // function strips spaces and other characters (M becomes RN for example, in lowercase).\n return (\n removeHiddenChars(str.toLowerCase())\n // Strip all punctuation\n .replace(/[\\\\'!\"#$%&()*+,\\-./:;<=>?@[\\]^_`{|}~\\u2000-\\u206f\\u2e00-\\u2e7f]/g, \"\")\n // We also doubly convert to lowercase to work around oddities of the library.\n .toLowerCase()\n );\n}\n\n// Regex matching bunch of unicode control characters and otherwise misleading/invisible characters.\n// Includes:\n// various width spaces U+2000 - U+200D\n// LTR and RTL marks U+200E and U+200F\n// LTR/RTL and other directional formatting marks U+202A - U+202F\n// Arabic Letter RTL mark U+061C\n// Combining characters U+0300 - U+036F\n// Zero width no-break space (BOM) U+FEFF\n// Blank/invisible characters (U2800, U2062-U2063)\n// eslint-disable-next-line no-misleading-character-class\nconst removeHiddenCharsRegex = /[\\u2000-\\u200F\\u202A-\\u202F\\u0300-\\u036F\\uFEFF\\u061C\\u2800\\u2062-\\u2063\\s]/g;\n\nexport function escapeRegExp(string: string): string {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\n/**\n * Converts Matrix glob-style string to a regular expression\n * https://spec.matrix.org/v1.7/appendices/#glob-style-matching\n * @param glob - Matrix glob-style string\n * @returns regular expression\n */\nexport function globToRegexp(glob: string): string {\n return escapeRegExp(glob).replace(/\\\\\\*/g, \".*\").replace(/\\?/g, \".\");\n}\n\nexport function ensureNoTrailingSlash(url: string): string;\nexport function ensureNoTrailingSlash(url: undefined): undefined;\nexport function ensureNoTrailingSlash(url?: string): string | undefined;\nexport function ensureNoTrailingSlash(url?: string): string | undefined {\n if (url?.endsWith(\"/\")) {\n return url.slice(0, -1);\n } else {\n return url;\n }\n}\n\n/**\n * Returns a promise which resolves with a given value after the given number of ms\n */\nexport function sleep<T>(ms: number, value?: T): Promise<T> {\n return new Promise((resolve) => {\n setTimeout(resolve, ms, value);\n });\n}\n\n/**\n * Utility to log the duration of a promise.\n *\n * @param logger - The logger to log to.\n * @param name - The name of the operation.\n * @param block - The block to execute.\n */\nexport async function logDuration<T>(logger: BaseLogger, name: string, block: () => Promise<T>): Promise<T> {\n const start = Date.now();\n try {\n return await block();\n } finally {\n const end = Date.now();\n logger.debug(`[Perf]: ${name} took ${end - start}ms`);\n }\n}\n\n/**\n * Utility to log the duration of a synchronous block.\n *\n * @param logger - The logger to log to.\n * @param name - The name of the operation.\n * @param block - The block to execute.\n */\nexport function logDurationSync<T>(logger: BaseLogger, name: string, block: () => T): T {\n const start = Date.now();\n try {\n return block();\n } finally {\n const end = Date.now();\n logger.debug(`[Perf]: ${name} took ${end - start}ms`);\n }\n}\n\n/**\n * Promise/async version of {@link setImmediate}.\n *\n * Implementation is based on `setTimeout` for wider compatibility.\n * @deprecated Use {@link sleep} instead.\n */\nexport function immediate(): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve));\n}\n\nexport function isNullOrUndefined(val: any): boolean {\n return val === null || val === undefined;\n}\n\nexport async function promiseMapSeries<T>(\n promises: Array<T | Promise<T>>,\n fn: (t: T) => Promise<unknown> | undefined, // if async we don't care about the type as we only await resolution\n): Promise<void> {\n for (const o of promises) {\n await fn(await o);\n }\n}\n\nexport function promiseTry<T>(fn: () => T | Promise<T>): Promise<T> {\n return Promise.resolve(fn());\n}\n\n// Creates and awaits all promises, running no more than `chunkSize` at the same time\nexport async function chunkPromises<T>(fns: (() => Promise<T>)[], chunkSize: number): Promise<T[]> {\n const results: T[] = [];\n for (let i = 0; i < fns.length; i += chunkSize) {\n results.push(...(await Promise.all(fns.slice(i, i + chunkSize).map((fn) => fn()))));\n }\n return results;\n}\n\n/**\n * Retries the function until it succeeds or is interrupted. The given function must return\n * a promise which throws/rejects on error, otherwise the retry will assume the request\n * succeeded. The promise chain returned will contain the successful promise. The given function\n * should always return a new promise.\n * @param promiseFn - The function to call to get a fresh promise instance. Takes an\n * attempt count as an argument, for logging/debugging purposes.\n * @param shouldRetry - Optional function which is called with the error the latest rejection from promiseFn,\n * retrying will ba aborted if this return false.\n * @returns The promise for the retried operation.\n */\nexport function simpleRetryOperation<T>(\n promiseFn: (attempt: number) => Promise<T>,\n shouldRetry?: (e: unknown) => boolean,\n): Promise<T> {\n return promiseRetry(\n (attempt: number) => {\n return promiseFn(attempt);\n },\n {\n retries: Infinity,\n shouldRetry: shouldRetry ? ({ error }): boolean => shouldRetry(error) : undefined,\n factor: 2,\n minTimeout: 3000, // ms\n maxTimeout: 15000, // ms\n },\n );\n}\n\n// String averaging inspired by https://stackoverflow.com/a/2510816\n// Dev note: We make the alphabet a string because it's easier to write syntactically\n// than arrays. Thankfully, strings implement the useful parts of the Array interface\n// anyhow.\n\n/**\n * The default alphabet used by string averaging in this SDK. This matches\n * all usefully printable ASCII characters (0x20-0x7E, inclusive).\n */\nexport const DEFAULT_ALPHABET = ((): string => {\n let str = \"\";\n for (let c = 0x20; c <= 0x7e; c++) {\n str += String.fromCharCode(c);\n }\n return str;\n})();\n\n/**\n * Pads a string using the given alphabet as a base. The returned string will be\n * padded at the end with the first character in the alphabet.\n *\n * This is intended for use with string averaging.\n * @param s - The string to pad.\n * @param n - The length to pad to.\n * @param alphabet - The alphabet to use as a single string.\n * @returns The padded string.\n */\nexport function alphabetPad(s: string, n: number, alphabet = DEFAULT_ALPHABET): string {\n return s.padEnd(n, alphabet[0]);\n}\n\n/**\n * Converts a baseN number to a string, where N is the alphabet's length.\n *\n * This is intended for use with string averaging.\n * @param n - The baseN number.\n * @param alphabet - The alphabet to use as a single string.\n * @returns The baseN number encoded as a string from the alphabet.\n */\nexport function baseToString(n: bigint, alphabet = DEFAULT_ALPHABET): string {\n // Developer note: the stringToBase() function offsets the character set by 1 so that repeated\n // characters (ie: \"aaaaaa\" in a..z) don't come out as zero. We have to reverse this here as\n // otherwise we'll be wrong in our conversion. Undoing a +1 before an exponent isn't very fun\n // though, so we rely on a lengthy amount of `x - 1` and integer division rules to reach a\n // sane state. This also means we have to do rollover detection: see below.\n\n const len = BigInt(alphabet.length);\n if (n <= len) {\n return alphabet[Number(n) - 1] ?? \"\";\n }\n\n let d = n / len;\n let r = Number(n % len) - 1;\n\n // Rollover detection: if the remainder is negative, it means that the string needs\n // to roll over by 1 character downwards (ie: in a..z, the previous to \"aaa\" would be\n // \"zz\").\n if (r < 0) {\n d -= BigInt(Math.abs(r)); // abs() is just to be clear what we're doing. Could also `+= r`.\n r = Number(len) - 1;\n }\n\n return baseToString(d, alphabet) + alphabet[r];\n}\n\n/**\n * Converts a string to a baseN number, where N is the alphabet's length.\n *\n * This is intended for use with string averaging.\n * @param s - The string to convert to a number.\n * @param alphabet - The alphabet to use as a single string.\n * @returns The baseN number.\n */\nexport function stringToBase(s: string, alphabet = DEFAULT_ALPHABET): bigint {\n const len = BigInt(alphabet.length);\n\n // In our conversion to baseN we do a couple performance optimizations to avoid using\n // excess CPU and such. To create baseN numbers, the input string needs to be reversed\n // so the exponents stack up appropriately, as the last character in the unreversed\n // string has less impact than the first character (in \"abc\" the A is a lot more important\n // for lexicographic sorts). We also do a trick with the character codes to optimize the\n // alphabet lookup, avoiding an index scan of `alphabet.indexOf(reversedStr[i])` - we know\n // that the alphabet and (theoretically) the input string are constrained on character sets\n // and thus can do simple subtraction to end up with the same result.\n\n // Developer caution: we carefully cast to BigInt here to avoid losing precision. We cannot\n // rely on Math.pow() (for example) to be capable of handling our insane numbers.\n\n let result = BigInt(0);\n for (let i = s.length - 1, j = BigInt(0); i >= 0; i--, j++) {\n const charIndex = s.charCodeAt(i) - alphabet.charCodeAt(0);\n\n // We add 1 to the char index to offset the whole numbering scheme. We unpack this in\n // the baseToString() function.\n result += BigInt(1 + charIndex) * len ** j;\n }\n return result;\n}\n\n/**\n * Averages two strings, returning the midpoint between them. This is accomplished by\n * converting both to baseN numbers (where N is the alphabet's length) then averaging\n * those before re-encoding as a string.\n * @param a - The first string.\n * @param b - The second string.\n * @param alphabet - The alphabet to use as a single string.\n * @returns The midpoint between the strings, as a string.\n */\nexport function averageBetweenStrings(a: string, b: string, alphabet = DEFAULT_ALPHABET): string {\n const padN = Math.max(a.length, b.length);\n const baseA = stringToBase(alphabetPad(a, padN, alphabet), alphabet);\n const baseB = stringToBase(alphabetPad(b, padN, alphabet), alphabet);\n const avg = (baseA + baseB) / BigInt(2);\n\n // Detect integer division conflicts. This happens when two numbers are divided too close so\n // we lose a .5 precision. We need to add a padding character in these cases.\n if (avg === baseA || avg == baseB) {\n return baseToString(avg, alphabet) + alphabet[0];\n }\n\n return baseToString(avg, alphabet);\n}\n\n/**\n * Finds the next string using the alphabet provided. This is done by converting the\n * string to a baseN number, where N is the alphabet's length, then adding 1 before\n * converting back to a string.\n * @param s - The string to start at.\n * @param alphabet - The alphabet to use as a single string.\n * @returns The string which follows the input string.\n */\nexport function nextString(s: string, alphabet = DEFAULT_ALPHABET): string {\n return baseToString(stringToBase(s, alphabet) + BigInt(1), alphabet);\n}\n\n/**\n * Finds the previous string using the alphabet provided. This is done by converting the\n * string to a baseN number, where N is the alphabet's length, then subtracting 1 before\n * converting back to a string.\n * @param s - The string to start at.\n * @param alphabet - The alphabet to use as a single string.\n * @returns The string which precedes the input string.\n */\nexport function prevString(s: string, alphabet = DEFAULT_ALPHABET): string {\n return baseToString(stringToBase(s, alphabet) - BigInt(1), alphabet);\n}\n\n/**\n * Compares strings lexicographically as a sort-safe function.\n * @param a - The first (reference) string.\n * @param b - The second (compare) string.\n * @returns Negative if the reference string is before the compare string;\n * positive if the reference string is after; and zero if equal.\n */\nexport function lexicographicCompare(a: string, b: string): number {\n // Dev note: this exists because I'm sad that you can use math operators on strings, so I've\n // hidden the operation in this function.\n if (a < b) {\n return -1;\n } else if (a > b) {\n return 1;\n } else {\n return 0;\n }\n}\n\n/**\n * This function is similar to Object.assign() but it assigns recursively and\n * allows you to ignore nullish values from the source\n *\n * @returns the target object\n */\nexport function recursivelyAssign<T1 extends T2, T2 extends Record<string, any>>(\n target: T1,\n source: T2,\n ignoreNullish = false,\n): T1 & T2 {\n for (const [sourceKey, sourceValue] of Object.entries(source)) {\n if (target[sourceKey] instanceof Object && sourceValue) {\n recursivelyAssign(target[sourceKey], sourceValue);\n continue;\n }\n if ((sourceValue !== null && sourceValue !== undefined) || !ignoreNullish) {\n safeSet(target, sourceKey, sourceValue);\n continue;\n }\n }\n return target as T1 & T2;\n}\n\nfunction getContentTimestampWithFallback(event: MatrixEvent): number {\n return M_TIMESTAMP.findIn<number>(event.getContent()) ?? -1;\n}\n\n/**\n * Sort events by their content m.ts property\n * Latest timestamp first\n */\nexport function sortEventsByLatestContentTimestamp(left: MatrixEvent, right: MatrixEvent): number {\n return getContentTimestampWithFallback(right) - getContentTimestampWithFallback(left);\n}\n\nexport function isSupportedReceiptType(receiptType: string): boolean {\n return [ReceiptType.Read, ReceiptType.ReadPrivate].includes(receiptType as ReceiptType);\n}\n\n/**\n * Determines whether two maps are equal.\n * @param eq - The equivalence relation to compare values by. Defaults to strict equality.\n */\nexport function mapsEqual<K, V>(x: Map<K, V>, y: Map<K, V>, eq = (v1: V, v2: V): boolean => v1 === v2): boolean {\n if (x.size !== y.size) return false;\n for (const [k, v1] of x) {\n const v2 = y.get(k);\n if (v2 === undefined || !eq(v1, v2)) return false;\n }\n return true;\n}\n\nfunction processMapToObjectValue(value: any): any {\n if (value instanceof Map) {\n // Value is a Map. Recursively map it to an object.\n return recursiveMapToObject(value);\n } else if (Array.isArray(value)) {\n // Value is an Array. Recursively map the value (e.g. to cover Array of Arrays).\n return value.map((v) => processMapToObjectValue(v));\n } else {\n return value;\n }\n}\n\n/**\n * Recursively converts Maps to plain objects.\n * Also supports sub-lists of Maps.\n */\nexport function recursiveMapToObject(map: Map<any, any>): Record<any, any> {\n const targetMap = new Map();\n\n for (const [key, value] of map) {\n targetMap.set(key, processMapToObjectValue(value));\n }\n\n return Object.fromEntries(targetMap.entries());\n}\n\nexport function unsafeProp<K extends keyof any | undefined>(prop: K): boolean {\n return prop === \"__proto__\" || prop === \"prototype\" || prop === \"constructor\";\n}\n\nexport function safeSet<O extends Record<any, any>, K extends keyof O>(obj: O, prop: K, value: O[K]): void {\n if (unsafeProp(prop)) {\n throw new Error(\"Trying to modify prototype or constructor\");\n }\n\n obj[prop] = value;\n}\n\nexport function noUnsafeEventProps(event: Partial<IEvent>): boolean {\n return !(unsafeProp(event.room_id) || unsafeProp(event.sender) || unsafeProp(event.event_id));\n}\n\nexport class MapWithDefault<K, V> extends Map<K, V> {\n public constructor(private createDefault: () => V) {\n super();\n }\n\n /**\n * Returns the value if the key already exists.\n * If not, it creates a new value under that key using the ctor callback and returns it.\n */\n public getOrCreate(key: K): V {\n if (!this.has(key)) {\n this.set(key, this.createDefault());\n }\n\n return this.get(key)!;\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,OAAO,WAAW,MAAM,aAAa;AACrC,OAAO,YAAY,MAAM,SAAS;AAGlC,SAAS,WAAW,QAAQ,sBAAsB;AAClD,SAAS,WAAW,QAAQ,2BAA2B;AAGvD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAiB,CAAC;;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS,iBAAiB,CAAC,GAAW,EAAU;EACnD;EACA;EACA,IAAK,GAAG,YAAwB,MAAM,EAAE;IACpC,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC;EACxB;;EAEA;EACA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;IACnB,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC;EACzB;;EAEA;EACA,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;AAC3B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SA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IAAI,KAAK,aAAa;AACjF;AAEA,OAAO,SAAS,OAAO,CAAgD,GAAM,EAAE,IAAO,EAAE,KAAW,EAAQ;EACvG,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;IAClB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC;EAChE;EAEA,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK;AACrB;AAEA,OAAO,SAAS,kBAAkB,CAAC,KAAsB,EAAW;EAChE,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AACjG;AAEA,OAAO,MAAM,cAAc,SAAe,GAAG,CAAO;EACzC,WAAW,CAAS,aAAsB,EAAE;IAC/C,KAAK,CAAC,CAAC;IAAC,KADe,aAAsB,GAAtB,aAAsB;EAEjD;;EAEA;AACJ;AACA;AACA;EACW,WAAW,CAAC,GAAM,EAAK;IAC1B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;MAChB,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;IACvC;IAEA,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;EACxB;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["/*\nCopyright 2015, 2016, 2019, 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/**\n * This is an internal module.\n */\n\nimport unhomoglyph from \"unhomoglyph\";\nimport promiseRetry from \"p-retry\";\n\nimport { type IEvent, type MatrixEvent } from \"./models/event.ts\";\nimport { M_TIMESTAMP } from \"./@types/location.ts\";\nimport { ReceiptType } from \"./@types/read_receipts.ts\";\nimport { type BaseLogger } from \"./logger.ts\";\n\nconst interns = new Map<string, string>();\n\n/**\n * Internalises a string, reusing a known pointer or storing the pointer\n * if needed for future strings.\n * @param str - The string to internalise.\n * @returns The internalised string.\n */\nexport function internaliseString(str: string): string {\n // Unwrap strings before entering the map, if we somehow got a wrapped\n // string as our input. This should only happen from tests.\n // oxlint-disable-next-line unicorn/no-instanceof-builtins\n if ((str as unknown) instanceof String) {\n str = str.toString();\n }\n\n // Check the map to see if we can store the value\n if (!interns.has(str)) {\n interns.set(str, str);\n }\n\n // Return any cached string reference\n return interns.get(str)!;\n}\n\n/**\n * Encode a dictionary of query parameters.\n * Omits any undefined/null values.\n * @param params - A dict of key/values to encode e.g.\n * `{\"foo\": \"bar\", \"baz\": \"taz\"}`\n * @returns The encoded string e.g. foo=bar&baz=taz\n */\nexport function encodeParams(params: QueryDict, urlSearchParams?: URLSearchParams): URLSearchParams {\n const searchParams = urlSearchParams ?? new URLSearchParams();\n for (const [key, val] of Object.entries(params)) {\n if (val !== undefined && val !== null) {\n if (Array.isArray(val)) {\n val.forEach((v) => {\n searchParams.append(key, String(v));\n });\n } else {\n searchParams.append(key, String(val));\n }\n }\n }\n return searchParams;\n}\n\nexport type QueryDict = Record<string, string[] | string | number | boolean | undefined>;\n\n/**\n * Replace a stable parameter with the unstable naming for params\n */\nexport function replaceParam(stable: string, unstable: string, dict: QueryDict): QueryDict {\n const result = {\n ...dict,\n [unstable]: dict[stable],\n };\n delete result[stable];\n return result;\n}\n\n/**\n * Decode a query string in `application/x-www-form-urlencoded` format.\n * @param query - A query string to decode e.g.\n * foo=bar&via=server1&server2\n * @returns The decoded object, if any keys occurred multiple times\n * then the value will be an array of strings, else it will be an array.\n * This behaviour matches Node's qs.parse but is built on URLSearchParams\n * for native web compatibility\n */\nexport function decodeParams(query: string): Record<string, string | string[]> {\n const o: Record<string, string | string[]> = {};\n const params = new URLSearchParams(query);\n for (const key of params.keys()) {\n const val = params.getAll(key);\n o[key] = val.length === 1 ? val[0] : val;\n }\n return o;\n}\n\n/**\n * Encodes a URI according to a set of template variables. Variables will be\n * passed through encodeURIComponent.\n * @param pathTemplate - The path with template variables e.g. '/foo/$bar'.\n * @param variables - The key/value pairs to replace the template\n * variables with. E.g. `{ \"$bar\": \"baz\" }`.\n * @returns The result of replacing all template variables e.g. '/foo/baz'.\n */\nexport function encodeUri(pathTemplate: string, variables: Record<string, string | null | undefined>): string {\n for (const key in variables) {\n if (!variables.hasOwnProperty(key)) {\n continue;\n }\n const value = variables[key];\n if (value === undefined || value === null) {\n continue;\n }\n pathTemplate = pathTemplate.replace(key, encodeURIComponent(value));\n }\n return pathTemplate;\n}\n\n/**\n * The removeElement() method removes the first element in the array that\n * satisfies (returns true) the provided testing function.\n * @param array - The array.\n * @param fn - Function to execute on each value in the array, with the\n * function signature `fn(element, index, array)`. Return true to\n * remove this element and break.\n * @param reverse - True to search in reverse order.\n * @returns True if an element was removed.\n */\nexport function removeElement<T>(array: T[], fn: (t: T, i?: number, a?: T[]) => boolean, reverse?: boolean): boolean {\n let i: number;\n if (reverse) {\n for (i = array.length - 1; i >= 0; i--) {\n if (fn(array[i], i, array)) {\n array.splice(i, 1);\n return true;\n }\n }\n } else {\n for (i = 0; i < array.length; i++) {\n if (fn(array[i], i, array)) {\n array.splice(i, 1);\n return true;\n }\n }\n }\n return false;\n}\n\n/**\n * Checks if the given thing is a function.\n * @param value - The thing to check.\n * @returns True if it is a function.\n */\nexport function isFunction(value: any): boolean {\n return Object.prototype.toString.call(value) === \"[object Function]\";\n}\n\n/**\n * Checks that the given object has the specified keys.\n * @param obj - The object to check.\n * @param keys - The list of keys that 'obj' must have.\n * @throws If the object is missing keys.\n */\n// note using 'keys' here would shadow the 'keys' function defined above\nexport function checkObjectHasKeys(obj: object, keys: string[]): void {\n for (const key of keys) {\n if (!obj.hasOwnProperty(key)) {\n throw new Error(\"Missing required key: \" + key);\n }\n }\n}\n\n/**\n * Deep copy the given object. The object MUST NOT have circular references and\n * MUST NOT have functions.\n * @param obj - The object to deep copy.\n * @returns A copy of the object without any references to the original.\n */\nexport function deepCopy<T>(obj: T): T {\n return JSON.parse(JSON.stringify(obj));\n}\n\n/**\n * Compare two objects for equality. The objects MUST NOT have circular references.\n *\n * @param x - The first object to compare.\n * @param y - The second object to compare.\n *\n * @returns true if the two objects are equal\n */\nexport function deepCompare(x: any, y: any): boolean {\n // Inspired by\n // http://stackoverflow.com/questions/1068834/object-comparison-in-javascript#1144249\n\n // Compare primitives and functions.\n // Also check if both arguments link to the same object.\n if (x === y) {\n return true;\n }\n\n if (typeof x !== typeof y) {\n return false;\n }\n\n // special-case NaN (since NaN !== NaN)\n if (typeof x === \"number\" && isNaN(x) && isNaN(y)) {\n return true;\n }\n\n // special-case null (since typeof null == 'object', but null.constructor\n // throws)\n if (x === null || y === null) {\n return x === y;\n }\n\n // everything else is either an unequal primitive, or an object\n // XXX: this check has been temporarily tweaked due to issues in the jest test environment,\n // this will be reverted as part of the migration to vitest\n if (\n x.constructor.name !== \"Object\" &&\n x.constructor.name !== \"RegExp\" &&\n x.constructor.name !== \"Date\" &&\n x.constructor.name !== \"Array\"\n ) {\n return false;\n }\n\n // check they are the same type of object\n // XXX: this check has been temporarily tweaked due to issues in the jest test environment,\n // this will be reverted as part of the migration to vitest\n if (x.prototype !== y.prototype) {\n return false;\n }\n\n // special-casing for some special types of object\n if (x instanceof RegExp || x instanceof Date) {\n return x.toString() === y.toString();\n }\n\n // the object algorithm works for Array, but it's sub-optimal.\n if (Array.isArray(x)) {\n if (x.length !== y.length) {\n return false;\n }\n\n for (let i = 0; i < x.length; i++) {\n if (!deepCompare(x[i], y[i])) {\n return false;\n }\n }\n } else {\n // check that all of y's direct keys are in x\n for (const p in y) {\n if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) {\n return false;\n }\n }\n\n // finally, compare each of x's keys with y\n for (const p in x) {\n if (y.hasOwnProperty(p) !== x.hasOwnProperty(p) || !deepCompare(x[p], y[p])) {\n return false;\n }\n }\n }\n return true;\n}\n\n// Dev note: This returns an array of tuples, but jsdoc doesn't like that. https://github.com/jsdoc/jsdoc/issues/1703\n/**\n * Creates an array of object properties/values (entries) then\n * sorts the result by key, recursively. The input object must\n * ensure it does not have loops. If the input is not an object\n * then it will be returned as-is.\n * @param obj - The object to get entries of\n * @returns The entries, sorted by key.\n */\nexport function deepSortedObjectEntries(obj: any): [string, any][] {\n if (typeof obj !== \"object\") return obj;\n\n // Apparently these are object types...\n if (obj === null || obj === undefined || Array.isArray(obj)) return obj;\n\n const pairs: [string, any][] = [];\n for (const [k, v] of Object.entries(obj)) {\n pairs.push([k, deepSortedObjectEntries(v)]);\n }\n\n // lexicographicCompare is faster than localeCompare, so let's use that.\n pairs.sort((a, b) => lexicographicCompare(a[0], b[0]));\n\n return pairs;\n}\n\n/**\n * Returns whether the given value is a finite number without type-coercion\n *\n * @param value - the value to test\n * @returns whether or not value is a finite number without type-coercion\n */\nexport function isNumber(value: any): value is number {\n return typeof value === \"number\" && isFinite(value);\n}\n\n/**\n * Removes zero width chars, diacritics and whitespace from the string\n * Also applies an unhomoglyph on the string, to prevent similar looking chars\n * @param str - the string to remove hidden characters from\n * @returns a string with the hidden characters removed\n */\nexport function removeHiddenChars(str: string): string {\n if (typeof str === \"string\") {\n return unhomoglyph(str.normalize(\"NFD\").replace(removeHiddenCharsRegex, \"\"));\n }\n return \"\";\n}\n\n/**\n * Removes the direction override characters from a string\n * @returns string with chars removed\n */\nexport function removeDirectionOverrideChars(str: string): string {\n if (typeof str === \"string\") {\n return str.replace(/[\\u202d-\\u202e]/g, \"\");\n }\n return \"\";\n}\n\nexport function normalize(str: string): string {\n // Note: we have to match the filter with the removeHiddenChars() because the\n // function strips spaces and other characters (M becomes RN for example, in lowercase).\n return (\n removeHiddenChars(str.toLowerCase())\n // Strip all punctuation\n .replace(/[\\\\'!\"#$%&()*+,\\-./:;<=>?@[\\]^_`{|}~\\u2000-\\u206f\\u2e00-\\u2e7f]/g, \"\")\n // We also doubly convert to lowercase to work around oddities of the library.\n .toLowerCase()\n );\n}\n\n// Regex matching bunch of unicode control characters and otherwise misleading/invisible characters.\n// Includes:\n// various width spaces U+2000 - U+200D\n// LTR and RTL marks U+200E and U+200F\n// LTR/RTL and other directional formatting marks U+202A - U+202F\n// Arabic Letter RTL mark U+061C\n// Combining characters U+0300 - U+036F\n// Zero width no-break space (BOM) U+FEFF\n// Blank/invisible characters (U2800, U2062-U2063)\n// eslint-disable-next-line no-misleading-character-class\nconst removeHiddenCharsRegex = /[\\u2000-\\u200F\\u202A-\\u202F\\u0300-\\u036F\\uFEFF\\u061C\\u2800\\u2062-\\u2063\\s]/g;\n\nexport function escapeRegExp(string: string): string {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\n/**\n * Converts Matrix glob-style string to a regular expression\n * https://spec.matrix.org/v1.7/appendices/#glob-style-matching\n * @param glob - Matrix glob-style string\n * @returns regular expression\n */\nexport function globToRegexp(glob: string): string {\n return escapeRegExp(glob).replace(/\\\\\\*/g, \".*\").replace(/\\?/g, \".\");\n}\n\nexport function ensureNoTrailingSlash(url: string): string;\nexport function ensureNoTrailingSlash(url: undefined): undefined;\nexport function ensureNoTrailingSlash(url?: string): string | undefined;\nexport function ensureNoTrailingSlash(url?: string): string | undefined {\n if (url?.endsWith(\"/\")) {\n return url.slice(0, -1);\n } else {\n return url;\n }\n}\n\n/**\n * Returns a promise which resolves with a given value after the given number of ms\n */\nexport function sleep<T>(ms: number, value?: T): Promise<T> {\n return new Promise((resolve) => {\n setTimeout(resolve, ms, value);\n });\n}\n\n/**\n * Utility to log the duration of a promise.\n *\n * @param logger - The logger to log to.\n * @param name - The name of the operation.\n * @param block - The block to execute.\n */\nexport async function logDuration<T>(logger: BaseLogger, name: string, block: () => Promise<T>): Promise<T> {\n const start = Date.now();\n try {\n return await block();\n } finally {\n const end = Date.now();\n logger.debug(`[Perf]: ${name} took ${end - start}ms`);\n }\n}\n\n/**\n * Utility to log the duration of a synchronous block.\n *\n * @param logger - The logger to log to.\n * @param name - The name of the operation.\n * @param block - The block to execute.\n */\nexport function logDurationSync<T>(logger: BaseLogger, name: string, block: () => T): T {\n const start = Date.now();\n try {\n return block();\n } finally {\n const end = Date.now();\n logger.debug(`[Perf]: ${name} took ${end - start}ms`);\n }\n}\n\n/**\n * Promise/async version of {@link setImmediate}.\n *\n * Implementation is based on `setTimeout` for wider compatibility.\n * @deprecated Use {@link sleep} instead.\n */\nexport function immediate(): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve));\n}\n\nexport function isNullOrUndefined(val: any): boolean {\n return val === null || val === undefined;\n}\n\nexport async function promiseMapSeries<T>(\n promises: Array<T | Promise<T>>,\n fn: (t: T) => Promise<unknown> | undefined, // if async we don't care about the type as we only await resolution\n): Promise<void> {\n for (const o of promises) {\n await fn(await o);\n }\n}\n\nexport function promiseTry<T>(fn: () => T | Promise<T>): Promise<T> {\n return Promise.resolve(fn());\n}\n\n// Creates and awaits all promises, running no more than `chunkSize` at the same time\nexport async function chunkPromises<T>(fns: (() => Promise<T>)[], chunkSize: number): Promise<T[]> {\n const results: T[] = [];\n for (let i = 0; i < fns.length; i += chunkSize) {\n results.push(...(await Promise.all(fns.slice(i, i + chunkSize).map((fn) => fn()))));\n }\n return results;\n}\n\n/**\n * Retries the function until it succeeds or is interrupted. The given function must return\n * a promise which throws/rejects on error, otherwise the retry will assume the request\n * succeeded. The promise chain returned will contain the successful promise. The given function\n * should always return a new promise.\n * @param promiseFn - The function to call to get a fresh promise instance. Takes an\n * attempt count as an argument, for logging/debugging purposes.\n * @param shouldRetry - Optional function which is called with the error the latest rejection from promiseFn,\n * retrying will ba aborted if this return false.\n * @returns The promise for the retried operation.\n */\nexport function simpleRetryOperation<T>(\n promiseFn: (attempt: number) => Promise<T>,\n shouldRetry?: (e: unknown) => boolean,\n): Promise<T> {\n return promiseRetry(\n (attempt: number) => {\n return promiseFn(attempt);\n },\n {\n retries: Infinity,\n shouldRetry: shouldRetry ? ({ error }): boolean => shouldRetry(error) : undefined,\n factor: 2,\n minTimeout: 3000, // ms\n maxTimeout: 15000, // ms\n },\n );\n}\n\n// String averaging inspired by https://stackoverflow.com/a/2510816\n// Dev note: We make the alphabet a string because it's easier to write syntactically\n// than arrays. Thankfully, strings implement the useful parts of the Array interface\n// anyhow.\n\n/**\n * The default alphabet used by string averaging in this SDK. This matches\n * all usefully printable ASCII characters (0x20-0x7E, inclusive).\n */\nexport const DEFAULT_ALPHABET = ((): string => {\n let str = \"\";\n for (let c = 0x20; c <= 0x7e; c++) {\n str += String.fromCharCode(c);\n }\n return str;\n})();\n\n/**\n * Pads a string using the given alphabet as a base. The returned string will be\n * padded at the end with the first character in the alphabet.\n *\n * This is intended for use with string averaging.\n * @param s - The string to pad.\n * @param n - The length to pad to.\n * @param alphabet - The alphabet to use as a single string.\n * @returns The padded string.\n */\nexport function alphabetPad(s: string, n: number, alphabet = DEFAULT_ALPHABET): string {\n return s.padEnd(n, alphabet[0]);\n}\n\n/**\n * Converts a baseN number to a string, where N is the alphabet's length.\n *\n * This is intended for use with string averaging.\n * @param n - The baseN number.\n * @param alphabet - The alphabet to use as a single string.\n * @returns The baseN number encoded as a string from the alphabet.\n */\nexport function baseToString(n: bigint, alphabet = DEFAULT_ALPHABET): string {\n // Developer note: the stringToBase() function offsets the character set by 1 so that repeated\n // characters (ie: \"aaaaaa\" in a..z) don't come out as zero. We have to reverse this here as\n // otherwise we'll be wrong in our conversion. Undoing a +1 before an exponent isn't very fun\n // though, so we rely on a lengthy amount of `x - 1` and integer division rules to reach a\n // sane state. This also means we have to do rollover detection: see below.\n\n const len = BigInt(alphabet.length);\n if (n <= len) {\n return alphabet[Number(n) - 1] ?? \"\";\n }\n\n let d = n / len;\n let r = Number(n % len) - 1;\n\n // Rollover detection: if the remainder is negative, it means that the string needs\n // to roll over by 1 character downwards (ie: in a..z, the previous to \"aaa\" would be\n // \"zz\").\n if (r < 0) {\n d -= BigInt(Math.abs(r)); // abs() is just to be clear what we're doing. Could also `+= r`.\n r = Number(len) - 1;\n }\n\n return baseToString(d, alphabet) + alphabet[r];\n}\n\n/**\n * Converts a string to a baseN number, where N is the alphabet's length.\n *\n * This is intended for use with string averaging.\n * @param s - The string to convert to a number.\n * @param alphabet - The alphabet to use as a single string.\n * @returns The baseN number.\n */\nexport function stringToBase(s: string, alphabet = DEFAULT_ALPHABET): bigint {\n const len = BigInt(alphabet.length);\n\n // In our conversion to baseN we do a couple performance optimizations to avoid using\n // excess CPU and such. To create baseN numbers, the input string needs to be reversed\n // so the exponents stack up appropriately, as the last character in the unreversed\n // string has less impact than the first character (in \"abc\" the A is a lot more important\n // for lexicographic sorts). We also do a trick with the character codes to optimize the\n // alphabet lookup, avoiding an index scan of `alphabet.indexOf(reversedStr[i])` - we know\n // that the alphabet and (theoretically) the input string are constrained on character sets\n // and thus can do simple subtraction to end up with the same result.\n\n // Developer caution: we carefully cast to BigInt here to avoid losing precision. We cannot\n // rely on Math.pow() (for example) to be capable of handling our insane numbers.\n\n let result = BigInt(0);\n for (let i = s.length - 1, j = BigInt(0); i >= 0; i--, j++) {\n const charIndex = s.charCodeAt(i) - alphabet.charCodeAt(0);\n\n // We add 1 to the char index to offset the whole numbering scheme. We unpack this in\n // the baseToString() function.\n result += BigInt(1 + charIndex) * len ** j;\n }\n return result;\n}\n\n/**\n * Averages two strings, returning the midpoint between them. This is accomplished by\n * converting both to baseN numbers (where N is the alphabet's length) then averaging\n * those before re-encoding as a string.\n * @param a - The first string.\n * @param b - The second string.\n * @param alphabet - The alphabet to use as a single string.\n * @returns The midpoint between the strings, as a string.\n */\nexport function averageBetweenStrings(a: string, b: string, alphabet = DEFAULT_ALPHABET): string {\n const padN = Math.max(a.length, b.length);\n const baseA = stringToBase(alphabetPad(a, padN, alphabet), alphabet);\n const baseB = stringToBase(alphabetPad(b, padN, alphabet), alphabet);\n const avg = (baseA + baseB) / BigInt(2);\n\n // Detect integer division conflicts. This happens when two numbers are divided too close so\n // we lose a .5 precision. We need to add a padding character in these cases.\n if (avg === baseA || avg == baseB) {\n return baseToString(avg, alphabet) + alphabet[0];\n }\n\n return baseToString(avg, alphabet);\n}\n\n/**\n * Finds the next string using the alphabet provided. This is done by converting the\n * string to a baseN number, where N is the alphabet's length, then adding 1 before\n * converting back to a string.\n * @param s - The string to start at.\n * @param alphabet - The alphabet to use as a single string.\n * @returns The string which follows the input string.\n */\nexport function nextString(s: string, alphabet = DEFAULT_ALPHABET): string {\n return baseToString(stringToBase(s, alphabet) + BigInt(1), alphabet);\n}\n\n/**\n * Finds the previous string using the alphabet provided. This is done by converting the\n * string to a baseN number, where N is the alphabet's length, then subtracting 1 before\n * converting back to a string.\n * @param s - The string to start at.\n * @param alphabet - The alphabet to use as a single string.\n * @returns The string which precedes the input string.\n */\nexport function prevString(s: string, alphabet = DEFAULT_ALPHABET): string {\n return baseToString(stringToBase(s, alphabet) - BigInt(1), alphabet);\n}\n\n/**\n * Compares strings lexicographically as a sort-safe function.\n * @param a - The first (reference) string.\n * @param b - The second (compare) string.\n * @returns Negative if the reference string is before the compare string;\n * positive if the reference string is after; and zero if equal.\n */\nexport function lexicographicCompare(a: string, b: string): number {\n // Dev note: this exists because I'm sad that you can use math operators on strings, so I've\n // hidden the operation in this function.\n if (a < b) {\n return -1;\n } else if (a > b) {\n return 1;\n } else {\n return 0;\n }\n}\n\n/**\n * This function is similar to Object.assign() but it assigns recursively and\n * allows you to ignore nullish values from the source\n *\n * @returns the target object\n */\nexport function recursivelyAssign<T1 extends T2, T2 extends Record<string, any>>(\n target: T1,\n source: T2,\n ignoreNullish = false,\n): T1 & T2 {\n for (const [sourceKey, sourceValue] of Object.entries(source)) {\n if (target[sourceKey] instanceof Object && sourceValue) {\n recursivelyAssign(target[sourceKey], sourceValue);\n continue;\n }\n if ((sourceValue !== null && sourceValue !== undefined) || !ignoreNullish) {\n safeSet(target, sourceKey, sourceValue);\n continue;\n }\n }\n return target;\n}\n\nfunction getContentTimestampWithFallback(event: MatrixEvent): number {\n return M_TIMESTAMP.findIn<number>(event.getContent()) ?? -1;\n}\n\n/**\n * Sort events by their content m.ts property\n * Latest timestamp first\n */\nexport function sortEventsByLatestContentTimestamp(left: MatrixEvent, right: MatrixEvent): number {\n return getContentTimestampWithFallback(right) - getContentTimestampWithFallback(left);\n}\n\nexport function isSupportedReceiptType(receiptType: string): boolean {\n return [ReceiptType.Read, ReceiptType.ReadPrivate].includes(receiptType as ReceiptType);\n}\n\n/**\n * Determines whether two maps are equal.\n * @param eq - The equivalence relation to compare values by. Defaults to strict equality.\n */\nexport function mapsEqual<K, V>(x: Map<K, V>, y: Map<K, V>, eq = (v1: V, v2: V): boolean => v1 === v2): boolean {\n if (x.size !== y.size) return false;\n for (const [k, v1] of x) {\n const v2 = y.get(k);\n if (v2 === undefined || !eq(v1, v2)) return false;\n }\n return true;\n}\n\nfunction processMapToObjectValue(value: any): any {\n if (value instanceof Map) {\n // Value is a Map. Recursively map it to an object.\n return recursiveMapToObject(value);\n } else if (Array.isArray(value)) {\n // Value is an Array. Recursively map the value (e.g. to cover Array of Arrays).\n return value.map((v) => processMapToObjectValue(v));\n } else {\n return value;\n }\n}\n\n/**\n * Recursively converts Maps to plain objects.\n * Also supports sub-lists of Maps.\n */\nexport function recursiveMapToObject(map: Map<any, any>): Record<any, any> {\n const targetMap = new Map();\n\n for (const [key, value] of map) {\n targetMap.set(key, processMapToObjectValue(value));\n }\n\n return Object.fromEntries(targetMap.entries());\n}\n\nexport function unsafeProp(prop: keyof any | undefined): boolean {\n return prop === \"__proto__\" || prop === \"prototype\" || prop === \"constructor\";\n}\n\nexport function safeSet<O extends Record<any, any>, K extends keyof O>(obj: O, prop: K, value: O[K]): void {\n if (unsafeProp(prop)) {\n throw new Error(\"Trying to modify prototype or constructor\");\n }\n\n obj[prop] = value;\n}\n\nexport function noUnsafeEventProps(event: Partial<IEvent>): boolean {\n return !(unsafeProp(event.room_id) || unsafeProp(event.sender) || unsafeProp(event.event_id));\n}\n\nexport class MapWithDefault<K, V> extends Map<K, V> {\n public constructor(private createDefault: () => V) {\n super();\n }\n\n /**\n * Returns the value if the key already exists.\n * If not, it creates a new value under that key using the ctor callback and returns it.\n */\n public getOrCreate(key: K): V {\n if (!this.has(key)) {\n this.set(key, this.createDefault());\n }\n\n return this.get(key)!;\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,OAAO,WAAW,MAAM,aAAa;AACrC,OAAO,YAAY,MAAM,SAAS;AAGlC,SAAS,WAAW,QAAQ,sBAAsB;AAClD,SAAS,WAAW,QAAQ,2BAA2B;AAGvD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAiB,CAAC;;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS,iBAAiB,CAAC,GAAW,EAAU;EACnD;EACA;EACA;EACA,IAAK,GAAG,YAAwB,MAAM,EAAE;IACpC,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC;EACxB;;EAEA;EACA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;IACnB,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC;EACzB;;EAEA;EACA,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;AAC3B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS,YAAY,CAAC,MAAiB,EAAE,eAAiC,EAAmB;EAChG,MAAM,YAAY,GAAG,eAAe,IAAI,IAAI,eAAe,CAAC,CAAC;EAC7D,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;IA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