@openclaw/matrix 2026.7.1-beta.1 → 2026.7.1-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-selection-Bv_ZuOu4.js → account-selection-5e4mHR1m.js} +1 -1
- package/dist/api.js +5 -5
- package/dist/{approval-handler.runtime-GpL8SxX2.js → approval-handler.runtime-DI5x9r8I.js} +5 -5
- package/dist/{approval-ids-DIKCZewR.js → approval-ids-ZgqbspmS.js} +1 -1
- package/dist/{approval-reaction-auth-DhBxqiQQ.js → approval-reaction-auth-D9LijQhr.js} +2 -2
- package/dist/{approval-reactions-BRGQgOu2.js → approval-reactions-BdUaUXVw.js} +24 -73
- package/dist/auth-presence.js +1 -1
- package/dist/{channel-CGc6D4tf.js → channel-jUTBsjHU.js} +21 -23
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-CPu_uwsn.js → channel.runtime-DO1Nv9ed.js} +26 -17
- package/dist/{cli-BfwYmyEc.js → cli-CEfWwCKx.js} +10 -17
- package/dist/{cli-metadata-FO-fJqf0.js → cli-metadata-CfiEO-CE.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{client-CVluBRDh.js → client-FRuyCNju.js} +2 -2
- package/dist/{client-bootstrap-1cbA9aSs.js → client-bootstrap-DjFJ7e0N.js} +6 -10
- package/dist/{client-Cb5ILtpE.js → client-tgnlQJk4.js} +2 -2
- package/dist/{config-schema-DFRmUTAG.js → config-schema-DtnhNYd-.js} +1 -1
- package/dist/contract-api.js +2 -2
- package/dist/{create-client-8YNurIAr.js → create-client-CNakT7zF.js} +7 -10
- package/dist/{credentials-G8lNmiME.js → credentials-Ds9V1mn2.js} +1 -1
- package/dist/{credentials-read-TzTOQPOM.js → credentials-read-BlkvsNFg.js} +1 -1
- package/dist/{credentials-write.runtime-cZhhyGAZ.js → credentials-write.runtime-CTqqxcut.js} +2 -5
- package/dist/{crypto-runtime-hMMmqNr1.js → crypto-runtime-B74cTS6A.js} +11 -9
- package/dist/{crypto-state-store-DK2tcEyP.js → crypto-state-store-Jy3qwhdy.js} +1 -1
- package/dist/{deps-D3bkh48_.js → deps-CdjHvnmh.js} +20 -2
- package/dist/{directory-live-pjbvjDz2.js → directory-live-Ufd4qSpX.js} +2 -2
- package/dist/{doctor-BRSDNU5C.js → doctor-DfaOqFtr.js} +3 -3
- package/dist/{doctor-contract-Dq8OZWHF.js → doctor-contract-BAja_fmb.js} +1 -1
- package/dist/doctor-contract-api.js +8 -14
- package/dist/{draft-stream-Djasj65z.js → draft-stream-D4EH25gv.js} +1 -1
- package/dist/{encryption-guidance-Bg3IRYoX.js → encryption-guidance-D8walY04.js} +1 -1
- package/dist/{file-sync-store-BWLVB01Y.js → file-sync-store-DVm0ACml.js} +3 -3
- package/dist/helper-api.js +1 -1
- package/dist/{idb-persistence-BGY1CJ7J.js → idb-persistence-BHm97th-.js} +1 -1
- package/dist/index.js +3 -6
- package/dist/{legacy-crypto-inspector-D_8iylBq.js → legacy-crypto-inspector-vzXSkm18.js} +1 -1
- package/dist/{legacy-crypto-restore-B0gcIEkE.js → legacy-crypto-restore-CIBfOmLn.js} +2 -2
- package/dist/{matrix-migration.runtime-Ctlb_rZl.js → matrix-migration.runtime-BMCyrANT.js} +3 -3
- package/dist/{media-text-CUFW_BP5.js → media-text-p-LP21qs.js} +1 -1
- package/dist/{messages-C1dIZHKy.js → messages-DRKkiEY-.js} +6 -5
- package/dist/{monitor-BMGnvIbg.js → monitor-CsGOGdwu.js} +89 -119
- package/dist/plugin-entry.handlers.runtime.js +2 -5
- package/dist/probe.runtime-2MZLc6ng.js +3 -0
- package/dist/{profile-update-BaEk4COs.js → profile-update-Ucc8RrJL.js} +2 -2
- package/dist/{reaction-events-n69MjKzG.js → reaction-events-DentrVii.js} +5 -12
- package/dist/{recovery-key-store-BGk8c_gf.js → recovery-key-store-DSeLFvNx.js} +1 -1
- package/dist/{resolve-targets-DyGW9WzC.js → resolve-targets-DcV_KfgX.js} +1 -1
- package/dist/{resolver.runtime-DhZV369r.js → resolver.runtime-Hr6bO5zl.js} +1 -1
- package/dist/runtime-api.js +2 -2
- package/dist/runtime-heavy-api.js +1 -1
- package/dist/{sdk-DOxaiBRE.js → sdk-AZYVl34z.js} +12 -13
- package/dist/{send-C0NwpZ-c.js → send-D92v6Yy0.js} +22 -12
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/{setup-bootstrap-DbWPVINS.js → setup-bootstrap-Da564w5f.js} +2 -2
- package/dist/{setup-core-DVkrIoax.js → setup-core-BGgbrdaJ.js} +5 -8
- package/dist/setup-plugin-api.js +3 -3
- package/dist/{setup-surface-CN7DEvpg.js → setup-surface-iJ6pd-t5.js} +6 -6
- package/dist/{shared-iLI-9tb9.js → shared-DkFfq7mH.js} +16 -32
- package/dist/{startup-verification-Bd31KqLv.js → startup-verification-BKMAXvcV.js} +2 -2
- package/dist/{storage-t5S-5c_5.js → storage-CQdyKcGg.js} +5 -5
- package/dist/subagent-hooks-api.js +2 -5
- package/dist/{thread-bindings-D73QFTXW.js → thread-bindings-BX5nmWpw.js} +3 -3
- package/dist/{tool-actions.runtime-BCCPq_aO.js → tool-actions.runtime-C1d5fxE_.js} +12 -12
- package/dist/{verification-C0KvXyHK.js → verification-BGCMiO1p.js} +2 -2
- package/node_modules/@babel/runtime/package.json +468 -1089
- package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/.cargo/config.toml +2 -0
- package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/CHANGELOG.md +12 -3
- package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/README.md +17 -0
- package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/download-lib.js +10 -2
- package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/package.json +1 -1
- package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/xtask/.idea/modules.xml +8 -0
- package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/xtask/.idea/vcs.xml +6 -0
- package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/xtask/.idea/xtask.iml +11 -0
- 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_bg.cjs +28 -28
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.js +24 -24
- 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 +58 -58
- package/node_modules/content-type/README.md +32 -57
- package/node_modules/content-type/dist/index.d.ts +26 -0
- package/node_modules/content-type/dist/index.js +170 -0
- package/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/content-type/package.json +35 -25
- package/node_modules/linkify-it/README.md +3 -4
- package/node_modules/linkify-it/build/index.cjs.js +44 -41
- package/node_modules/linkify-it/index.mjs +10 -11
- package/node_modules/linkify-it/lib/re.mjs +34 -30
- package/node_modules/linkify-it/package.json +10 -15
- package/node_modules/markdown-it/dist/index.cjs.js +3652 -5378
- package/node_modules/markdown-it/dist/index.cjs.js.map +1 -0
- package/node_modules/markdown-it/dist/markdown-it.js +1399 -4479
- package/node_modules/markdown-it/dist/markdown-it.js.map +1 -0
- package/node_modules/markdown-it/dist/markdown-it.min.js +3 -2
- package/node_modules/markdown-it/dist/markdown-it.min.js.map +1 -0
- package/node_modules/markdown-it/lib/common/html_re.mjs +9 -9
- package/node_modules/markdown-it/lib/common/utils.mjs +2 -11
- package/node_modules/markdown-it/lib/parser_block.mjs +9 -9
- package/node_modules/markdown-it/lib/parser_core.mjs +7 -7
- package/node_modules/markdown-it/lib/parser_inline.mjs +16 -16
- package/node_modules/markdown-it/lib/renderer.mjs +2 -2
- package/node_modules/markdown-it/lib/rules_block/blockquote.mjs +6 -6
- package/node_modules/markdown-it/lib/rules_block/code.mjs +2 -2
- package/node_modules/markdown-it/lib/rules_block/fence.mjs +4 -4
- package/node_modules/markdown-it/lib/rules_block/heading.mjs +7 -7
- package/node_modules/markdown-it/lib/rules_block/hr.mjs +2 -2
- package/node_modules/markdown-it/lib/rules_block/html_block.mjs +6 -6
- package/node_modules/markdown-it/lib/rules_block/lheading.mjs +8 -8
- package/node_modules/markdown-it/lib/rules_block/list.mjs +6 -6
- package/node_modules/markdown-it/lib/rules_block/paragraph.mjs +5 -5
- package/node_modules/markdown-it/lib/rules_block/reference.mjs +1 -1
- package/node_modules/markdown-it/lib/rules_block/state_block.mjs +6 -6
- package/node_modules/markdown-it/lib/rules_block/table.mjs +4 -4
- package/node_modules/markdown-it/lib/rules_core/block.mjs +3 -3
- package/node_modules/markdown-it/lib/rules_core/linkify.mjs +15 -15
- package/node_modules/markdown-it/lib/rules_core/normalize.mjs +2 -2
- package/node_modules/markdown-it/lib/rules_inline/autolink.mjs +17 -17
- package/node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs +2 -2
- package/node_modules/markdown-it/lib/rules_inline/emphasis.mjs +8 -8
- package/node_modules/markdown-it/lib/rules_inline/entity.mjs +7 -7
- package/node_modules/markdown-it/lib/rules_inline/escape.mjs +15 -1
- package/node_modules/markdown-it/lib/rules_inline/html_inline.mjs +1 -1
- package/node_modules/markdown-it/lib/rules_inline/link.mjs +1 -1
- package/node_modules/markdown-it/lib/rules_inline/state_inline.mjs +2 -2
- package/node_modules/markdown-it/lib/rules_inline/strikethrough.mjs +10 -10
- package/node_modules/markdown-it/lib/token.mjs +12 -12
- package/node_modules/markdown-it/package.json +25 -34
- package/node_modules/matrix-js-sdk/CHANGELOG.md +24 -0
- package/node_modules/matrix-js-sdk/README.md +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/AESEncryptedSecretStoragePayload.js +3 -1
- package/node_modules/matrix-js-sdk/lib/@types/IIdentityServerProvider.js +3 -1
- package/node_modules/matrix-js-sdk/lib/@types/PushRules.js +7 -7
- package/node_modules/matrix-js-sdk/lib/@types/PushRules.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/auth.js +4 -4
- package/node_modules/matrix-js-sdk/lib/@types/auth.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/beacon.js +2 -2
- package/node_modules/matrix-js-sdk/lib/@types/beacon.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/common.js +3 -1
- package/node_modules/matrix-js-sdk/lib/@types/crypto.js +3 -1
- package/node_modules/matrix-js-sdk/lib/@types/event.d.ts +6 -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 +23 -20
- package/node_modules/matrix-js-sdk/lib/@types/event.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/events.js +3 -1
- package/node_modules/matrix-js-sdk/lib/@types/extensible_events.js +6 -6
- package/node_modules/matrix-js-sdk/lib/@types/extensible_events.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/global.d.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/json.js +3 -1
- package/node_modules/matrix-js-sdk/lib/@types/local_notifications.js +3 -1
- package/node_modules/matrix-js-sdk/lib/@types/location.js +4 -4
- package/node_modules/matrix-js-sdk/lib/@types/location.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/matrix-sdk-crypto-wasm.d.js +3 -1
- package/node_modules/matrix-js-sdk/lib/@types/media.js +3 -1
- package/node_modules/matrix-js-sdk/lib/@types/membership.js +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/membership.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/partials.js +6 -6
- package/node_modules/matrix-js-sdk/lib/@types/partials.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/polls.js +5 -5
- package/node_modules/matrix-js-sdk/lib/@types/polls.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/read_receipts.js +2 -2
- package/node_modules/matrix-js-sdk/lib/@types/read_receipts.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/registration.js +3 -1
- package/node_modules/matrix-js-sdk/lib/@types/requests.js +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/requests.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/retention.d.ts +15 -0
- package/node_modules/matrix-js-sdk/lib/@types/retention.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/@types/retention.js +13 -0
- package/node_modules/matrix-js-sdk/lib/@types/retention.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/@types/search.js +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/search.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/signed.js +3 -1
- package/node_modules/matrix-js-sdk/lib/@types/spaces.js +3 -1
- package/node_modules/matrix-js-sdk/lib/@types/state_events.js +3 -1
- package/node_modules/matrix-js-sdk/lib/@types/synapse.js +3 -1
- package/node_modules/matrix-js-sdk/lib/@types/sync.js +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/sync.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/threepids.js +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/threepids.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/topic.js +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/topic.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/uia.js +3 -1
- package/node_modules/matrix-js-sdk/lib/NamespacedValue.js +8 -8
- package/node_modules/matrix-js-sdk/lib/NamespacedValue.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/ReEmitter.js +8 -15
- package/node_modules/matrix-js-sdk/lib/ReEmitter.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/ToDeviceMessageQueue.js +47 -55
- package/node_modules/matrix-js-sdk/lib/ToDeviceMessageQueue.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/autodiscovery.js +233 -247
- package/node_modules/matrix-js-sdk/lib/autodiscovery.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/base64.js +1 -1
- package/node_modules/matrix-js-sdk/lib/base64.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/browser-index.d.ts +2 -2
- package/node_modules/matrix-js-sdk/lib/browser-index.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/browser-index.js +5 -5
- package/node_modules/matrix-js-sdk/lib/browser-index.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/capabilityPoller.d.ts +38 -0
- package/node_modules/matrix-js-sdk/lib/capabilityPoller.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/capabilityPoller.js +93 -0
- package/node_modules/matrix-js-sdk/lib/capabilityPoller.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/client.d.ts +9 -8
- package/node_modules/matrix-js-sdk/lib/client.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/client.js +2123 -2483
- package/node_modules/matrix-js-sdk/lib/client.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/common-crypto/CryptoBackend.js +3 -1
- package/node_modules/matrix-js-sdk/lib/common-crypto/CryptoBackend.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/common-crypto/key-passphrase.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/content-helpers.js +43 -48
- package/node_modules/matrix-js-sdk/lib/content-helpers.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/content-repo.js +14 -24
- package/node_modules/matrix-js-sdk/lib/content-repo.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/base.js +6 -6
- 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.js +189 -237
- 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.js +25 -28
- 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.js +113 -145
- 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.js +74 -105
- 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/CryptoEvent.js +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto-api/CryptoEvent.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto-api/CryptoEventHandlerMap.js +3 -1
- package/node_modules/matrix-js-sdk/lib/crypto-api/index.d.ts +15 -6
- 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 +76 -76
- package/node_modules/matrix-js-sdk/lib/crypto-api/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto-api/key-passphrase.js +15 -23
- package/node_modules/matrix-js-sdk/lib/crypto-api/key-passphrase.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto-api/keybackup.js +3 -1
- package/node_modules/matrix-js-sdk/lib/crypto-api/recovery-key.js +11 -12
- package/node_modules/matrix-js-sdk/lib/crypto-api/recovery-key.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto-api/verification.js +3 -3
- package/node_modules/matrix-js-sdk/lib/crypto-api/verification.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/digest.js +7 -14
- package/node_modules/matrix-js-sdk/lib/digest.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/embedded.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/embedded.js +379 -500
- package/node_modules/matrix-js-sdk/lib/embedded.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/errors.js +2 -2
- package/node_modules/matrix-js-sdk/lib/errors.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/event-mapper.js +10 -12
- package/node_modules/matrix-js-sdk/lib/event-mapper.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/ExtensibleEvent.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/InvalidEventError.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/MessageEvent.js +26 -28
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/MessageEvent.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollEndEvent.js +11 -12
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollEndEvent.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollResponseEvent.js +6 -6
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollResponseEvent.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollStartEvent.js +36 -38
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollStartEvent.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/utilities.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/feature.js +18 -31
- 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 +20 -26
- package/node_modules/matrix-js-sdk/lib/filter-component.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/filter.js +14 -15
- package/node_modules/matrix-js-sdk/lib/filter.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/errors.js +41 -56
- package/node_modules/matrix-js-sdk/lib/http-api/errors.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/fetch.js +140 -157
- package/node_modules/matrix-js-sdk/lib/http-api/fetch.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/index.js +17 -20
- package/node_modules/matrix-js-sdk/lib/http-api/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/interface.js +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/interface.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/method.js +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/method.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/prefix.js +3 -3
- package/node_modules/matrix-js-sdk/lib/http-api/prefix.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/refresh.js +80 -99
- package/node_modules/matrix-js-sdk/lib/http-api/refresh.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/utils.d.ts +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/utils.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/utils.js +35 -47
- package/node_modules/matrix-js-sdk/lib/http-api/utils.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/indexeddb-helpers.js +3 -3
- package/node_modules/matrix-js-sdk/lib/indexeddb-helpers.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/indexeddb-worker.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/interactive-auth.d.ts +5 -5
- package/node_modules/matrix-js-sdk/lib/interactive-auth.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/interactive-auth.js +181 -203
- package/node_modules/matrix-js-sdk/lib/interactive-auth.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/logger.js +22 -56
- package/node_modules/matrix-js-sdk/lib/logger.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrix.d.ts +1 -0
- package/node_modules/matrix-js-sdk/lib/matrix.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrix.js +8 -11
- package/node_modules/matrix-js-sdk/lib/matrix.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.js +83 -76
- package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/EncryptionManager.js +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/EncryptionManager.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/IKeyTransport.js +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/IKeyTransport.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/IMembershipManager.js +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/IMembershipManager.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/LivekitTransport.d.ts +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/LivekitTransport.js +4 -4
- package/node_modules/matrix-js-sdk/lib/matrixrtc/LivekitTransport.js.map +1 -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 +144 -184
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.js +35 -39
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.d.ts +2 -0
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.js +346 -383
- 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 +54 -59
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManagerActionScheduler.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/RTCEncryptionManager.js +117 -139
- package/node_modules/matrix-js-sdk/lib/matrixrtc/RTCEncryptionManager.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/ToDeviceKeyTransport.js +49 -54
- package/node_modules/matrix-js-sdk/lib/matrixrtc/ToDeviceKeyTransport.js.map +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.js +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/common.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.js +15 -23
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/session.js +4 -5
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/session.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/types.js +4 -6
- package/node_modules/matrix-js-sdk/lib/matrixrtc/types.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.js +4 -11
- package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/MSC3089Branch.js +91 -116
- package/node_modules/matrix-js-sdk/lib/models/MSC3089Branch.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/MSC3089TreeSpace.js +209 -244
- package/node_modules/matrix-js-sdk/lib/models/MSC3089TreeSpace.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/ToDeviceMessage.js +3 -1
- package/node_modules/matrix-js-sdk/lib/models/beacon.js +20 -15
- package/node_modules/matrix-js-sdk/lib/models/beacon.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/compare-event-ordering.js +13 -13
- package/node_modules/matrix-js-sdk/lib/models/compare-event-ordering.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/device.js +10 -3
- package/node_modules/matrix-js-sdk/lib/models/device.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/event-context.js +5 -7
- package/node_modules/matrix-js-sdk/lib/models/event-context.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/event-status.js +1 -1
- package/node_modules/matrix-js-sdk/lib/models/event-status.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/event-timeline-set.js +91 -91
- 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.js +31 -29
- package/node_modules/matrix-js-sdk/lib/models/event-timeline.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/event.js +215 -235
- package/node_modules/matrix-js-sdk/lib/models/event.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/invites-ignorer-types.js +4 -4
- package/node_modules/matrix-js-sdk/lib/models/invites-ignorer-types.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/invites-ignorer.js +159 -179
- package/node_modules/matrix-js-sdk/lib/models/invites-ignorer.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/poll.js +72 -78
- package/node_modules/matrix-js-sdk/lib/models/poll.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/profile-keys.js +2 -2
- package/node_modules/matrix-js-sdk/lib/models/profile-keys.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/read-receipt.js +40 -56
- package/node_modules/matrix-js-sdk/lib/models/read-receipt.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/related-relations.js +2 -0
- package/node_modules/matrix-js-sdk/lib/models/related-relations.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/relations-container.js +20 -21
- package/node_modules/matrix-js-sdk/lib/models/relations-container.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/relations.js +131 -156
- package/node_modules/matrix-js-sdk/lib/models/relations.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room-member.js +44 -27
- package/node_modules/matrix-js-sdk/lib/models/room-member.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room-receipts.js +48 -55
- package/node_modules/matrix-js-sdk/lib/models/room-receipts.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room-retention.d.ts +28 -0
- package/node_modules/matrix-js-sdk/lib/models/room-retention.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/models/room-retention.js +192 -0
- package/node_modules/matrix-js-sdk/lib/models/room-retention.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/models/room-state.js +141 -170
- 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 +1 -0
- 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-sticky-events.js +46 -65
- package/node_modules/matrix-js-sdk/lib/models/room-sticky-events.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room-summary.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room.d.ts +2 -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 +800 -887
- package/node_modules/matrix-js-sdk/lib/models/room.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/search-result.js +5 -5
- package/node_modules/matrix-js-sdk/lib/models/search-result.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/thread.js +267 -283
- package/node_modules/matrix-js-sdk/lib/models/thread.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/typed-event-emitter.js +7 -18
- package/node_modules/matrix-js-sdk/lib/models/typed-event-emitter.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/user.js +26 -7
- package/node_modules/matrix-js-sdk/lib/models/user.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/oidc/authorize.js +208 -241
- package/node_modules/matrix-js-sdk/lib/oidc/authorize.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/oidc/discovery.js +23 -36
- package/node_modules/matrix-js-sdk/lib/oidc/discovery.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/oidc/error.js +1 -1
- package/node_modules/matrix-js-sdk/lib/oidc/error.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/oidc/index.js +1 -0
- package/node_modules/matrix-js-sdk/lib/oidc/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/oidc/register.js +60 -66
- package/node_modules/matrix-js-sdk/lib/oidc/register.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.js +83 -94
- package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/oidc/validate.js +18 -18
- package/node_modules/matrix-js-sdk/lib/oidc/validate.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/pushprocessor.js +70 -81
- package/node_modules/matrix-js-sdk/lib/pushprocessor.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/randomstring.js +9 -9
- package/node_modules/matrix-js-sdk/lib/randomstring.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/realtime-callbacks.js +25 -28
- package/node_modules/matrix-js-sdk/lib/realtime-callbacks.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/receipt-accumulator.d.ts +2 -0
- package/node_modules/matrix-js-sdk/lib/receipt-accumulator.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/receipt-accumulator.js +14 -22
- package/node_modules/matrix-js-sdk/lib/receipt-accumulator.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.js +272 -298
- package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousChannel.js +3 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousCode.js +3 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousError.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousFailureReason.js +2 -2
- package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousFailureReason.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousIntent.js +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousIntent.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousTransport.js +3 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/channels/MSC4108SecureChannel.js +122 -144
- package/node_modules/matrix-js-sdk/lib/rendezvous/channels/MSC4108SecureChannel.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/index.js +44 -69
- 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 +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/transports/MSC4108RendezvousSession.js +142 -152
- package/node_modules/matrix-js-sdk/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/retentionPolicy.d.ts +33 -0
- package/node_modules/matrix-js-sdk/lib/retentionPolicy.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/retentionPolicy.js +39 -0
- package/node_modules/matrix-js-sdk/lib/retentionPolicy.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/room-hierarchy.js +52 -56
- package/node_modules/matrix-js-sdk/lib/room-hierarchy.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/CrossSigningIdentity.js +94 -104
- package/node_modules/matrix-js-sdk/lib/rust-crypto/CrossSigningIdentity.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.js +158 -190
- package/node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/KeyClaimManager.js +17 -20
- package/node_modules/matrix-js-sdk/lib/rust-crypto/KeyClaimManager.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.js +109 -139
- package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestsManager.js +72 -86
- package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestsManager.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/PerSessionKeyBackupDownloader.js +195 -221
- package/node_modules/matrix-js-sdk/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/RoomEncryptor.js +121 -137
- package/node_modules/matrix-js-sdk/lib/rust-crypto/RoomEncryptor.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.d.ts +7 -2
- 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 +459 -544
- package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/constants.js +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/constants.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/device-converter.js +15 -28
- 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.js +103 -116
- 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.js +303 -365
- 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 +5 -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 +1065 -1322
- package/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/secret-storage.js +12 -25
- package/node_modules/matrix-js-sdk/lib/rust-crypto/secret-storage.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/verification.js +134 -184
- package/node_modules/matrix-js-sdk/lib/rust-crypto/verification.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/scheduler.js +42 -17
- package/node_modules/matrix-js-sdk/lib/scheduler.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/secret-storage.js +179 -213
- package/node_modules/matrix-js-sdk/lib/secret-storage.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/serverCapabilities.d.ts +4 -23
- package/node_modules/matrix-js-sdk/lib/serverCapabilities.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/serverCapabilities.js +9 -62
- package/node_modules/matrix-js-sdk/lib/serverCapabilities.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/service-types.js +1 -1
- package/node_modules/matrix-js-sdk/lib/service-types.js.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 +368 -421
- package/node_modules/matrix-js-sdk/lib/sliding-sync-sdk.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/sliding-sync.js +136 -167
- package/node_modules/matrix-js-sdk/lib/sliding-sync.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/index.d.ts +7 -0
- package/node_modules/matrix-js-sdk/lib/store/index.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/index.js +3 -1
- package/node_modules/matrix-js-sdk/lib/store/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/indexeddb-backend.js +3 -1
- package/node_modules/matrix-js-sdk/lib/store/indexeddb-local-backend.d.ts +1 -0
- 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 +197 -240
- 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 +3 -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-remote-backend.js +51 -59
- package/node_modules/matrix-js-sdk/lib/store/indexeddb-remote-backend.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/indexeddb-store-worker.js +22 -22
- 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 +7 -5
- package/node_modules/matrix-js-sdk/lib/store/indexeddb.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/indexeddb.js +63 -79
- package/node_modules/matrix-js-sdk/lib/store/indexeddb.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/local-storage-events-emitter.js +2 -2
- package/node_modules/matrix-js-sdk/lib/store/local-storage-events-emitter.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/memory.d.ts +1 -0
- package/node_modules/matrix-js-sdk/lib/store/memory.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/memory.js +38 -54
- package/node_modules/matrix-js-sdk/lib/store/memory.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/stub.d.ts +1 -0
- package/node_modules/matrix-js-sdk/lib/store/stub.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/stub.js +22 -32
- package/node_modules/matrix-js-sdk/lib/store/stub.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/sync-accumulator.d.ts +1 -0
- package/node_modules/matrix-js-sdk/lib/sync-accumulator.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/sync-accumulator.js +57 -65
- 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 +914 -991
- package/node_modules/matrix-js-sdk/lib/sync.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/testing.js +63 -105
- package/node_modules/matrix-js-sdk/lib/testing.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/thread-utils.js +1 -4
- package/node_modules/matrix-js-sdk/lib/thread-utils.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/timeline-window.js +90 -99
- package/node_modules/matrix-js-sdk/lib/timeline-window.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/types.js +1 -1
- package/node_modules/matrix-js-sdk/lib/types.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/utils/decryptAESSecretStorageItem.js +14 -25
- package/node_modules/matrix-js-sdk/lib/utils/decryptAESSecretStorageItem.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/utils/encryptAESSecretStorageItem.js +27 -38
- package/node_modules/matrix-js-sdk/lib/utils/encryptAESSecretStorageItem.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/utils/internal/deriveKeys.js +25 -32
- package/node_modules/matrix-js-sdk/lib/utils/internal/deriveKeys.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/utils/roomVersion.js +1 -1
- package/node_modules/matrix-js-sdk/lib/utils/roomVersion.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/utils.js +83 -135
- package/node_modules/matrix-js-sdk/lib/utils.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/version-support.js +3 -3
- package/node_modules/matrix-js-sdk/lib/version-support.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/audioContext.js +5 -6
- package/node_modules/matrix-js-sdk/lib/webrtc/audioContext.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/call.js +1123 -1256
- package/node_modules/matrix-js-sdk/lib/webrtc/call.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/callEventHandler.js +207 -214
- package/node_modules/matrix-js-sdk/lib/webrtc/callEventHandler.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/callEventTypes.js +2 -2
- package/node_modules/matrix-js-sdk/lib/webrtc/callEventTypes.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/callFeed.js +33 -20
- package/node_modules/matrix-js-sdk/lib/webrtc/callFeed.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/groupCall.js +521 -594
- package/node_modules/matrix-js-sdk/lib/webrtc/groupCall.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/groupCallEventHandler.js +58 -61
- package/node_modules/matrix-js-sdk/lib/webrtc/groupCallEventHandler.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/mediaHandler.js +203 -233
- package/node_modules/matrix-js-sdk/lib/webrtc/mediaHandler.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/callFeedStatsReporter.js +16 -20
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/callFeedStatsReporter.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/callStatsReportGatherer.js +65 -70
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/callStatsReportGatherer.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/callStatsReportSummary.js +3 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStats.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStatsBuilder.js +2 -2
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStatsBuilder.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStatsReportBuilder.js +20 -24
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStatsReportBuilder.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/groupCallStats.js +4 -5
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/groupCallStats.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaSsrcHandler.js +7 -8
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaSsrcHandler.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackHandler.js +7 -9
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackHandler.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackStats.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackStatsHandler.js +6 -6
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackStatsHandler.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/statsReport.js +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/statsReport.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/statsReportEmitter.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/summaryStatsReportGatherer.js +14 -14
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/summaryStatsReportGatherer.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/trackStatsBuilder.js +32 -34
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/trackStatsBuilder.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/transportStats.js +3 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/transportStatsBuilder.js +9 -9
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/transportStatsBuilder.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/valueFormatter.js +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/valueFormatter.js.map +1 -1
- package/node_modules/matrix-js-sdk/package.json +110 -138
- package/node_modules/matrix-js-sdk/src/@types/event.ts +9 -0
- package/node_modules/matrix-js-sdk/src/@types/global.d.ts +2 -2
- package/node_modules/matrix-js-sdk/src/@types/retention.ts +16 -0
- package/node_modules/matrix-js-sdk/src/ToDeviceMessageQueue.ts +2 -2
- package/node_modules/matrix-js-sdk/src/browser-index.ts +4 -4
- package/node_modules/matrix-js-sdk/src/capabilityPoller.ts +102 -0
- package/node_modules/matrix-js-sdk/src/client.ts +37 -25
- package/node_modules/matrix-js-sdk/src/crypto-api/index.ts +17 -6
- package/node_modules/matrix-js-sdk/src/embedded.ts +4 -6
- package/node_modules/matrix-js-sdk/src/filter-component.ts +1 -0
- package/node_modules/matrix-js-sdk/src/http-api/utils.ts +5 -10
- package/node_modules/matrix-js-sdk/src/interactive-auth.ts +11 -5
- package/node_modules/matrix-js-sdk/src/matrix.ts +1 -0
- package/node_modules/matrix-js-sdk/src/matrixrtc/LivekitTransport.ts +1 -1
- package/node_modules/matrix-js-sdk/src/matrixrtc/MatrixRTCSession.ts +5 -4
- package/node_modules/matrix-js-sdk/src/matrixrtc/MembershipManager.ts +2 -0
- package/node_modules/matrix-js-sdk/src/matrixrtc/MembershipManagerActionScheduler.ts +4 -1
- package/node_modules/matrix-js-sdk/src/models/MSC3089Branch.ts +1 -1
- package/node_modules/matrix-js-sdk/src/models/room-retention.ts +230 -0
- package/node_modules/matrix-js-sdk/src/models/room-sticky-events.ts +1 -0
- package/node_modules/matrix-js-sdk/src/models/room.ts +26 -12
- package/node_modules/matrix-js-sdk/src/receipt-accumulator.ts +2 -0
- package/node_modules/matrix-js-sdk/src/rendezvous/index.ts +1 -1
- package/node_modules/matrix-js-sdk/src/rendezvous/transports/MSC4108RendezvousSession.ts +2 -2
- package/node_modules/matrix-js-sdk/src/retentionPolicy.ts +65 -0
- package/node_modules/matrix-js-sdk/src/rust-crypto/PerSessionKeyBackupDownloader.ts +1 -1
- package/node_modules/matrix-js-sdk/src/rust-crypto/backup.ts +15 -4
- package/node_modules/matrix-js-sdk/src/rust-crypto/index.ts +6 -6
- package/node_modules/matrix-js-sdk/src/rust-crypto/rust-crypto.ts +31 -7
- package/node_modules/matrix-js-sdk/src/rust-crypto/verification.ts +1 -1
- package/node_modules/matrix-js-sdk/src/serverCapabilities.ts +8 -67
- package/node_modules/matrix-js-sdk/src/sliding-sync-sdk.ts +5 -7
- package/node_modules/matrix-js-sdk/src/store/index.ts +8 -0
- package/node_modules/matrix-js-sdk/src/store/indexeddb-local-backend.ts +12 -2
- package/node_modules/matrix-js-sdk/src/store/indexeddb-remote-backend.ts +24 -5
- package/node_modules/matrix-js-sdk/src/store/indexeddb.ts +20 -8
- package/node_modules/matrix-js-sdk/src/store/memory.ts +4 -0
- package/node_modules/matrix-js-sdk/src/store/stub.ts +3 -0
- package/node_modules/matrix-js-sdk/src/sync-accumulator.ts +9 -0
- package/node_modules/matrix-js-sdk/src/sync.ts +11 -9
- package/node_modules/media-typer/README.md +19 -33
- package/node_modules/media-typer/dist/index.d.ts +29 -0
- package/node_modules/media-typer/dist/index.js +64 -0
- package/node_modules/media-typer/dist/index.js.map +1 -0
- package/node_modules/media-typer/package.json +37 -22
- package/node_modules/music-metadata/lib/id3v1/ID3v1Parser.js +2 -2
- package/node_modules/music-metadata/lib/mp4/AtomToken.js +65 -13
- package/node_modules/music-metadata/lib/wav/WaveChunk.d.ts +10 -0
- package/node_modules/music-metadata/lib/wav/WaveChunk.js +13 -3
- package/node_modules/music-metadata/lib/wav/WaveParser.d.ts +1 -0
- package/node_modules/music-metadata/lib/wav/WaveParser.js +6 -5
- package/node_modules/music-metadata/package.json +5 -5
- package/node_modules/typebox/build/compile/validator.d.mts +2 -7
- package/node_modules/typebox/build/compile/validator.mjs +6 -36
- package/node_modules/typebox/build/error/errors.d.mts +1 -7
- package/node_modules/typebox/build/format/_idna.mjs +36 -6
- package/node_modules/typebox/build/format/_puny.mjs +4 -1
- package/node_modules/typebox/build/format/uuid.d.mts +2 -2
- package/node_modules/typebox/build/format/uuid.mjs +3 -3
- package/node_modules/typebox/build/guard/emit.d.mts +0 -4
- package/node_modules/typebox/build/guard/emit.mjs +0 -8
- package/node_modules/typebox/build/guard/guard.d.mts +4 -8
- package/node_modules/typebox/build/guard/guard.mjs +5 -13
- package/node_modules/typebox/build/schema/engine/boolean.d.mts +3 -3
- package/node_modules/typebox/build/schema/engine/boolean.mjs +4 -4
- package/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
- package/node_modules/typebox/build/schema/engine/index.mjs +0 -1
- package/node_modules/typebox/build/schema/engine/schema.mjs +5 -10
- package/node_modules/typebox/build/schema/engine/type.mjs +14 -18
- package/node_modules/typebox/build/schema/types/dependencies.mjs +1 -1
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -1
- package/node_modules/typebox/build/schema/types/index.mjs +0 -1
- package/node_modules/typebox/build/schema/types/schema.d.mts +1 -1
- package/node_modules/typebox/build/schema/types/schema.mjs +2 -2
- package/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
- package/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
- package/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
- package/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
- package/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
- package/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
- package/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
- package/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
- package/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
- package/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
- package/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
- package/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
- package/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
- package/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
- package/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
- package/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
- package/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
- package/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
- package/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
- package/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
- package/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
- package/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
- package/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
- package/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
- package/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
- package/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
- package/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
- package/node_modules/typebox/build/system/memory/clone.mjs +73 -26
- package/node_modules/typebox/build/system/settings/settings.d.mts +15 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +3 -1
- package/node_modules/typebox/build/type/action/_add_immutable.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_add_immutable.mjs +11 -0
- package/node_modules/typebox/build/type/action/_add_optional.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_add_optional.mjs +11 -0
- package/node_modules/typebox/build/type/action/_add_readonly.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_add_readonly.mjs +11 -0
- package/node_modules/typebox/build/type/action/_remove_immutable.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_remove_immutable.mjs +11 -0
- package/node_modules/typebox/build/type/action/_remove_optional.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_remove_optional.mjs +11 -0
- package/node_modules/typebox/build/type/action/_remove_readonly.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_remove_readonly.mjs +11 -0
- package/node_modules/typebox/build/type/action/conditional.d.mts +2 -3
- package/node_modules/typebox/build/type/action/conditional.mjs +2 -1
- package/node_modules/typebox/build/type/action/index.d.mts +7 -4
- package/node_modules/typebox/build/type/action/index.mjs +7 -4
- package/node_modules/typebox/build/type/action/mapped.d.mts +2 -3
- package/node_modules/typebox/build/type/action/mapped.mjs +2 -1
- package/node_modules/typebox/build/type/action/module.d.mts +8 -7
- package/node_modules/typebox/build/type/action/module.mjs +7 -6
- package/node_modules/typebox/build/type/action/readonly_object.d.mts +0 -5
- package/node_modules/typebox/build/type/action/readonly_object.mjs +0 -5
- package/node_modules/typebox/build/type/action/with.d.mts +11 -0
- package/node_modules/typebox/build/type/action/with.mjs +11 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +1 -1
- package/node_modules/typebox/build/type/engine/call/instantiate.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +3 -2
- package/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +2 -2
- package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.d.mts +3 -4
- package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +2 -1
- package/node_modules/typebox/build/type/engine/cyclic/candidates.d.mts +2 -3
- package/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +3 -6
- package/node_modules/typebox/build/type/engine/cyclic/check.d.mts +6 -9
- package/node_modules/typebox/build/type/engine/cyclic/check.mjs +10 -16
- package/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
- package/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
- package/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
- package/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
- package/node_modules/typebox/build/type/engine/cyclic/instantiate.d.mts +2 -5
- package/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +3 -2
- package/node_modules/typebox/build/type/engine/enum/index.d.mts +0 -1
- package/node_modules/typebox/build/type/engine/enum/index.mjs +0 -1
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +1 -2
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +2 -6
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +10 -6
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +10 -6
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +2 -1
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +3 -3
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +17 -5
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +34 -8
- package/node_modules/typebox/build/type/engine/exclude/operation.d.mts +5 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +11 -12
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +5 -6
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +11 -12
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +14 -0
- package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +14 -0
- package/node_modules/typebox/build/type/engine/index.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/index.mjs +2 -2
- package/node_modules/typebox/build/type/engine/indexable/from_dependent.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +8 -0
- package/node_modules/typebox/build/type/engine/indexable/from_enum.d.mts +3 -3
- package/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +4 -4
- package/node_modules/typebox/build/type/engine/indexable/from_template_literal.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +3 -3
- package/node_modules/typebox/build/type/engine/indexable/from_type.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/indexable/from_type.mjs +9 -6
- package/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +2 -1
- package/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +5 -2
- package/node_modules/typebox/build/type/engine/instantiate.d.mts +44 -31
- package/node_modules/typebox/build/type/engine/instantiate.mjs +82 -83
- package/node_modules/typebox/build/type/engine/interface/instantiate.d.mts +3 -6
- package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +3 -3
- package/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +2 -1
- package/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +5 -1
- package/node_modules/typebox/build/type/engine/mapped/mapped_operation.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +3 -3
- package/node_modules/typebox/build/type/engine/mapped/mapped_variants.d.mts +5 -4
- package/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +10 -5
- package/node_modules/typebox/build/type/engine/module/instantiate.d.mts +7 -9
- package/node_modules/typebox/build/type/engine/module/instantiate.mjs +17 -15
- package/node_modules/typebox/build/type/engine/object/from_dependent.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/object/from_dependent.mjs +8 -0
- package/node_modules/typebox/build/type/engine/object/from_type.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/object/from_type.mjs +8 -5
- package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +14 -0
- package/node_modules/typebox/build/type/engine/optional/instantiate_remove.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +14 -0
- package/node_modules/typebox/build/type/engine/parameters/instantiate.d.mts +3 -4
- package/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +2 -1
- package/node_modules/typebox/build/type/engine/partial/from_dependent.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +8 -0
- package/node_modules/typebox/build/type/engine/partial/from_intersect.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +3 -2
- package/node_modules/typebox/build/type/engine/partial/from_object.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/partial/from_object.mjs +2 -2
- package/node_modules/typebox/build/type/engine/partial/from_type.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/partial/from_type.mjs +7 -4
- package/node_modules/typebox/build/type/engine/priority/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/priority/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +20 -0
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +28 -0
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +14 -0
- package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +14 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_array.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +8 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +3 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_object.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_type.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +8 -5
- package/node_modules/typebox/build/type/engine/record/from_key_enum.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +2 -2
- package/node_modules/typebox/build/type/engine/record/from_key_template_literal.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +2 -2
- package/node_modules/typebox/build/type/engine/ref/instantiate.d.mts +3 -3
- package/node_modules/typebox/build/type/engine/ref/instantiate.mjs +6 -6
- package/node_modules/typebox/build/type/engine/required/from_dependent.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/required/from_dependent.mjs +8 -0
- package/node_modules/typebox/build/type/engine/required/from_intersect.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/required/from_intersect.mjs +3 -2
- package/node_modules/typebox/build/type/engine/required/from_object.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/required/from_object.mjs +2 -2
- package/node_modules/typebox/build/type/engine/required/from_type.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/required/from_type.mjs +7 -4
- package/node_modules/typebox/build/type/engine/template_literal/decode.mjs +3 -3
- package/node_modules/typebox/build/type/engine/template_literal/encode.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/template_literal/encode.mjs +6 -6
- package/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +1 -1
- package/node_modules/typebox/build/type/engine/template_literal/is_pattern.mjs +1 -0
- package/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
- package/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
- package/node_modules/typebox/build/type/engine/with/instantiate.d.mts +8 -0
- package/node_modules/typebox/build/type/engine/{options → with}/instantiate.mjs +5 -5
- package/node_modules/typebox/build/type/extends/dependent.d.mts +6 -0
- package/node_modules/typebox/build/type/extends/dependent.mjs +6 -0
- package/node_modules/typebox/build/type/extends/enum.d.mts +4 -4
- package/node_modules/typebox/build/type/extends/enum.mjs +3 -2
- package/node_modules/typebox/build/type/extends/extends_left.d.mts +5 -7
- package/node_modules/typebox/build/type/extends/extends_left.mjs +24 -27
- package/node_modules/typebox/build/type/extends/extends_right.d.mts +7 -5
- package/node_modules/typebox/build/type/extends/extends_right.mjs +20 -15
- package/node_modules/typebox/build/type/extends/inference.mjs +1 -1
- package/node_modules/typebox/build/type/extends/object.d.mts +8 -1
- package/node_modules/typebox/build/type/extends/object.mjs +25 -3
- package/node_modules/typebox/build/type/extends/parameters.mjs +2 -2
- package/node_modules/typebox/build/type/extends/record.d.mts +13 -0
- package/node_modules/typebox/build/type/extends/record.mjs +23 -0
- package/node_modules/typebox/build/type/extends/template_literal.d.mts +3 -3
- package/node_modules/typebox/build/type/extends/template_literal.mjs +3 -3
- package/node_modules/typebox/build/type/extends/tuple.d.mts +3 -6
- package/node_modules/typebox/build/type/extends/tuple.mjs +6 -5
- package/node_modules/typebox/build/type/extends/union.mjs +2 -2
- package/node_modules/typebox/build/type/script/mapping.d.mts +84 -99
- package/node_modules/typebox/build/type/script/mapping.mjs +81 -85
- package/node_modules/typebox/build/type/script/parser.d.mts +40 -40
- package/node_modules/typebox/build/type/script/parser.mjs +22 -22
- package/node_modules/typebox/build/type/script/script.d.mts +3 -4
- package/node_modules/typebox/build/type/script/script.mjs +3 -2
- package/node_modules/typebox/build/type/script/token/internal/guard.d.mts +1 -1
- package/node_modules/typebox/build/type/script/token/internal/guard.mjs +1 -1
- package/node_modules/typebox/build/type/script/token/internal/take.mjs +1 -1
- package/node_modules/typebox/build/type/script/token/until.mjs +2 -2
- package/node_modules/typebox/build/type/types/_codec.d.mts +12 -12
- package/node_modules/typebox/build/type/types/_codec.mjs +0 -1
- package/node_modules/typebox/build/type/types/_immutable.d.mts +2 -9
- package/node_modules/typebox/build/type/types/_immutable.mjs +2 -10
- package/node_modules/typebox/build/type/types/_optional.d.mts +2 -9
- package/node_modules/typebox/build/type/types/_optional.mjs +2 -11
- package/node_modules/typebox/build/type/types/_readonly.d.mts +2 -9
- package/node_modules/typebox/build/type/types/_readonly.mjs +2 -10
- package/node_modules/typebox/build/type/types/_refine.d.mts +8 -10
- package/node_modules/typebox/build/type/types/_refine.mjs +1 -2
- package/node_modules/typebox/build/type/types/call.d.mts +3 -3
- package/node_modules/typebox/build/type/types/call.mjs +3 -2
- package/node_modules/typebox/build/type/types/deferred.d.mts +1 -0
- package/node_modules/typebox/build/type/types/deferred.mjs +1 -1
- package/node_modules/typebox/build/type/types/dependent.d.mts +17 -0
- package/node_modules/typebox/build/type/types/dependent.mjs +24 -0
- package/node_modules/typebox/build/type/types/enum.d.mts +3 -1
- package/node_modules/typebox/build/type/types/enum.mjs +5 -0
- package/node_modules/typebox/build/type/types/index.d.mts +1 -4
- package/node_modules/typebox/build/type/types/index.mjs +1 -4
- package/node_modules/typebox/build/type/types/number.d.mts +1 -1
- package/node_modules/typebox/build/type/types/number.mjs +1 -1
- package/node_modules/typebox/build/type/types/record.d.mts +13 -7
- package/node_modules/typebox/build/type/types/record.mjs +15 -9
- package/node_modules/typebox/build/type/types/static.d.mts +2 -5
- package/node_modules/typebox/build/typebox.d.mts +4 -8
- package/node_modules/typebox/build/typebox.mjs +4 -8
- package/node_modules/typebox/build/value/clean/clean.mjs +4 -2
- package/node_modules/typebox/build/value/clean/from_intersect.mjs +2 -2
- package/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
- package/node_modules/typebox/build/value/clean/from_union.d.mts +1 -1
- package/node_modules/typebox/build/value/clean/from_union.mjs +1 -2
- package/node_modules/typebox/build/value/clone/clone.mjs +2 -73
- package/node_modules/typebox/build/value/codec/decode.mjs +4 -2
- package/node_modules/typebox/build/value/codec/encode.mjs +4 -2
- package/node_modules/typebox/build/value/codec/from_array.mjs +1 -4
- package/node_modules/typebox/build/value/codec/from_object.mjs +1 -4
- package/node_modules/typebox/build/value/codec/from_record.mjs +2 -7
- package/node_modules/typebox/build/value/codec/from_tuple.mjs +1 -4
- package/node_modules/typebox/build/value/codec/from_union.mjs +2 -3
- package/node_modules/typebox/build/value/convert/from_enum.mjs +3 -4
- package/node_modules/typebox/build/value/convert/from_template_literal.d.mts +1 -1
- package/node_modules/typebox/build/value/convert/from_template_literal.mjs +2 -3
- package/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
- package/node_modules/typebox/build/value/create/from_enum.mjs +2 -2
- package/node_modules/typebox/build/value/create/from_type.mjs +23 -31
- package/node_modules/typebox/build/value/default/from_object.mjs +1 -1
- package/node_modules/typebox/build/value/default/from_type.mjs +8 -10
- package/node_modules/typebox/build/value/index.d.mts +0 -1
- package/node_modules/typebox/build/value/index.mjs +0 -1
- package/node_modules/typebox/build/value/repair/from_enum.mjs +2 -3
- package/node_modules/typebox/build/value/repair/from_type.mjs +24 -22
- package/node_modules/typebox/build/value/shared/union_priority_sort.d.mts +6 -2
- package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +62 -26
- package/node_modules/typebox/build/value/value.d.mts +0 -1
- package/node_modules/typebox/build/value/value.mjs +0 -1
- package/node_modules/typebox/package.json +25 -25
- package/node_modules/typebox/readme.md +97 -80
- package/npm-shrinkwrap.json +59 -54
- package/package.json +10 -10
- package/dist/probe.runtime-DFt7PIoE.js +0 -3
- package/node_modules/@babel/runtime/helpers/AwaitValue.js +0 -4
- package/node_modules/@babel/runtime/helpers/applyDecs.js +0 -236
- package/node_modules/@babel/runtime/helpers/applyDecs2203.js +0 -184
- package/node_modules/@babel/runtime/helpers/applyDecs2203R.js +0 -191
- package/node_modules/@babel/runtime/helpers/applyDecs2301.js +0 -222
- package/node_modules/@babel/runtime/helpers/applyDecs2305.js +0 -133
- package/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js +0 -10
- package/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js +0 -4
- package/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js +0 -7
- package/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js +0 -5
- package/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js +0 -4
- package/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js +0 -5
- package/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js +0 -7
- package/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js +0 -7
- package/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js +0 -7
- package/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js +0 -5
- package/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js +0 -4
- package/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js +0 -7
- package/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js +0 -7
- package/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js +0 -7
- package/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js +0 -4
- package/node_modules/@babel/runtime/helpers/decorate.js +0 -250
- package/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js +0 -12
- package/node_modules/@babel/runtime/helpers/dispose.js +0 -28
- package/node_modules/@babel/runtime/helpers/esm/AwaitValue.js +0 -4
- package/node_modules/@babel/runtime/helpers/esm/applyDecs.js +0 -236
- package/node_modules/@babel/runtime/helpers/esm/applyDecs2203.js +0 -184
- package/node_modules/@babel/runtime/helpers/esm/applyDecs2203R.js +0 -191
- package/node_modules/@babel/runtime/helpers/esm/applyDecs2301.js +0 -222
- package/node_modules/@babel/runtime/helpers/esm/applyDecs2305.js +0 -133
- package/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js +0 -10
- package/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js +0 -4
- package/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js +0 -7
- package/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js +0 -5
- package/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js +0 -4
- package/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js +0 -5
- package/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js +0 -7
- package/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js +0 -7
- package/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js +0 -7
- package/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js +0 -5
- package/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js +0 -4
- package/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js +0 -7
- package/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js +0 -7
- package/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js +0 -7
- package/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js +0 -4
- package/node_modules/@babel/runtime/helpers/esm/decorate.js +0 -250
- package/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js +0 -12
- package/node_modules/@babel/runtime/helpers/esm/dispose.js +0 -28
- package/node_modules/@babel/runtime/helpers/esm/objectSpread.js +0 -14
- package/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js +0 -77
- package/node_modules/@babel/runtime/helpers/esm/using.js +0 -12
- package/node_modules/@babel/runtime/helpers/objectSpread.js +0 -14
- package/node_modules/@babel/runtime/helpers/regeneratorRuntime.js +0 -77
- package/node_modules/@babel/runtime/helpers/using.js +0 -12
- package/node_modules/@babel/runtime/regenerator/index.js +0 -15
- package/node_modules/content-type/HISTORY.md +0 -29
- package/node_modules/content-type/index.js +0 -225
- package/node_modules/media-typer/HISTORY.md +0 -50
- package/node_modules/media-typer/index.js +0 -143
- package/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
- package/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
- package/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
- package/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
- package/node_modules/typebox/build/type/action/_optional.d.mts +0 -19
- package/node_modules/typebox/build/type/action/_optional.mjs +0 -40
- package/node_modules/typebox/build/type/action/_readonly.d.mts +0 -19
- package/node_modules/typebox/build/type/action/_readonly.mjs +0 -40
- package/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
- package/node_modules/typebox/build/type/action/awaited.mjs +0 -15
- package/node_modules/typebox/build/type/action/options.d.mts +0 -11
- package/node_modules/typebox/build/type/action/options.mjs +0 -11
- package/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
- package/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
- package/node_modules/typebox/build/type/engine/enum/enum_to_union.d.mts +0 -14
- package/node_modules/typebox/build/type/engine/enum/enum_to_union.mjs +0 -24
- package/node_modules/typebox/build/type/engine/options/index.d.mts +0 -1
- package/node_modules/typebox/build/type/engine/options/index.mjs +0 -1
- package/node_modules/typebox/build/type/engine/options/instantiate.d.mts +0 -8
- package/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
- package/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
- package/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
- package/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
- package/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
- package/node_modules/typebox/build/type/extends/promise.mjs +0 -9
- package/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
- package/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
- package/node_modules/typebox/build/type/types/base.d.mts +0 -50
- package/node_modules/typebox/build/type/types/base.mjs +0 -84
- package/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
- package/node_modules/typebox/build/type/types/iterator.mjs +0 -28
- package/node_modules/typebox/build/type/types/promise.d.mts +0 -21
- package/node_modules/typebox/build/type/types/promise.mjs +0 -29
- package/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
- package/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
- package/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
- package/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
- package/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
- package/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
- package/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
- package/node_modules/typebox/build/value/create/from_base.mjs +0 -4
- package/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
- package/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
- package/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
- package/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
- package/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
- package/node_modules/typebox/build/value/default/from_base.mjs +0 -5
- package/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
- package/node_modules/typebox/build/value/mutate/error.mjs +0 -6
- package/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
- package/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
- package/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
- package/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
- package/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
- package/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
- package/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
- package/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
- package/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
- package/node_modules/typebox/build/value/mutate/index.mjs +0 -1
- package/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
- package/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
- package/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
- package/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
- /package/node_modules/typebox/build/type/engine/{awaited → with}/index.d.mts +0 -0
- /package/node_modules/typebox/build/type/engine/{awaited → with}/index.mjs +0 -0
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
3
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
3
|
/*
|
|
7
4
|
Copyright 2015 - 2023 The Matrix.org Foundation C.I.C.
|
|
8
5
|
|
|
@@ -46,6 +43,7 @@ import { compareEventOrdering } from "./compare-event-ordering.js";
|
|
|
46
43
|
import { KnownMembership } from "../@types/membership.js";
|
|
47
44
|
import { RoomVersionStability } from "../serverCapabilities.js";
|
|
48
45
|
import { RoomStickyEventsStore, RoomStickyEventsEvent } from "./room-sticky-events.js";
|
|
46
|
+
import { RoomRetentionPolicy } from "./room-retention.js";
|
|
49
47
|
|
|
50
48
|
// These constants are used as sane defaults when the homeserver doesn't support
|
|
51
49
|
// the m.room_versions capability. In practice, KNOWN_SAFE_ROOM_VERSION should be
|
|
@@ -53,8 +51,8 @@ import { RoomStickyEventsStore, RoomStickyEventsEvent } from "./room-sticky-even
|
|
|
53
51
|
// room versions which are considered okay for people to run without being asked
|
|
54
52
|
// to upgrade (ie: "stable"). Eventually, we should remove these when all homeservers
|
|
55
53
|
// return an m.room_versions capability.
|
|
56
|
-
export
|
|
57
|
-
|
|
54
|
+
export const KNOWN_SAFE_ROOM_VERSION = "10";
|
|
55
|
+
const SAFE_ROOM_VERSIONS = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"];
|
|
58
56
|
// When inserting a visibility event affecting event `eventId`, we
|
|
59
57
|
// need to scan through existing visibility events for `eventId`.
|
|
60
58
|
// In theory, this could take an unlimited amount of time if:
|
|
@@ -69,13 +67,13 @@ var SAFE_ROOM_VERSIONS = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"];
|
|
|
69
67
|
// expecting that a broken visibility change for a single event in
|
|
70
68
|
// an extremely uncommon case (possibly a DoS) is a small
|
|
71
69
|
// price to pay to keep matrix-js-sdk responsive.
|
|
72
|
-
|
|
73
|
-
export
|
|
70
|
+
const MAX_NUMBER_OF_VISIBILITY_EVENTS_TO_SCAN_THROUGH = 30;
|
|
71
|
+
export let NotificationCountType = /*#__PURE__*/function (NotificationCountType) {
|
|
74
72
|
NotificationCountType["Highlight"] = "highlight";
|
|
75
73
|
NotificationCountType["Total"] = "total";
|
|
76
74
|
return NotificationCountType;
|
|
77
75
|
}({});
|
|
78
|
-
export
|
|
76
|
+
export let RoomEvent = /*#__PURE__*/function (RoomEvent) {
|
|
79
77
|
RoomEvent["MyMembership"] = "Room.myMembership";
|
|
80
78
|
RoomEvent["Tags"] = "Room.tags";
|
|
81
79
|
RoomEvent["AccountData"] = "Room.accountData";
|
|
@@ -118,13 +116,12 @@ export class Room extends ReadReceipt {
|
|
|
118
116
|
* @param myUserId - Required. The ID of the syncing user.
|
|
119
117
|
* @param opts - Configuration options
|
|
120
118
|
*/
|
|
121
|
-
constructor(roomId, client, myUserId) {
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
constructor(roomId, client, myUserId, opts = {}) {
|
|
120
|
+
super();
|
|
121
|
+
|
|
124
122
|
// In some cases, we add listeners for every displayed Matrix event, so it's
|
|
125
123
|
// common to have quite a few more than the default limit.
|
|
126
|
-
|
|
127
|
-
_this = this;
|
|
124
|
+
_defineProperty(this, "reEmitter", void 0);
|
|
128
125
|
_defineProperty(this, "txnToEvent", new Map());
|
|
129
126
|
// Pending in-flight requests { string: MatrixEvent }
|
|
130
127
|
_defineProperty(this, "notificationCounts", {});
|
|
@@ -138,6 +135,7 @@ export class Room extends ReadReceipt {
|
|
|
138
135
|
* This is useful in determining whether a user has read a thread or not
|
|
139
136
|
*/
|
|
140
137
|
_defineProperty(this, "unthreadedReceipts", new Map());
|
|
138
|
+
_defineProperty(this, "timelineSets", void 0);
|
|
141
139
|
_defineProperty(this, "polls", new Map());
|
|
142
140
|
/**
|
|
143
141
|
* Empty array if the timeline sets have not been initialised. After initialisation:
|
|
@@ -149,6 +147,10 @@ export class Room extends ReadReceipt {
|
|
|
149
147
|
_defineProperty(this, "filteredTimelineSets", {});
|
|
150
148
|
// filter_id: timelineSet
|
|
151
149
|
_defineProperty(this, "timelineNeedsRefresh", false);
|
|
150
|
+
_defineProperty(this, "pendingEventList", void 0);
|
|
151
|
+
// read by megolm via getter; boolean value - null indicates "use global value"
|
|
152
|
+
_defineProperty(this, "blacklistUnverifiedDevices", void 0);
|
|
153
|
+
_defineProperty(this, "selfMembership", void 0);
|
|
152
154
|
/**
|
|
153
155
|
* A `Hero` is a stripped `m.room.member` event which contains the important renderable fields from the event.
|
|
154
156
|
*
|
|
@@ -161,6 +163,16 @@ export class Room extends ReadReceipt {
|
|
|
161
163
|
_defineProperty(this, "heroes", null);
|
|
162
164
|
// flags to stop logspam about missing m.room.create events
|
|
163
165
|
_defineProperty(this, "getTypeWarning", false);
|
|
166
|
+
_defineProperty(this, "membersPromise", void 0);
|
|
167
|
+
// XXX: These should be read-only
|
|
168
|
+
/**
|
|
169
|
+
* The human-readable display name for this room.
|
|
170
|
+
*/
|
|
171
|
+
_defineProperty(this, "name", void 0);
|
|
172
|
+
/**
|
|
173
|
+
* The un-homoglyphed name for this room.
|
|
174
|
+
*/
|
|
175
|
+
_defineProperty(this, "normalizedName", void 0);
|
|
164
176
|
/**
|
|
165
177
|
* Dict of room tags; the keys are the tag name and the values
|
|
166
178
|
* are any metadata associated with the tag - e.g. `{ "fav" : { order: 1 } }`
|
|
@@ -177,6 +189,21 @@ export class Room extends ReadReceipt {
|
|
|
177
189
|
* The room summary.
|
|
178
190
|
*/
|
|
179
191
|
_defineProperty(this, "summary", null);
|
|
192
|
+
/**
|
|
193
|
+
* oldState The state of the room at the time of the oldest event in the live timeline.
|
|
194
|
+
*
|
|
195
|
+
* @deprecated Present for backwards compatibility.
|
|
196
|
+
* Use getLiveTimeline().getState(EventTimeline.BACKWARDS) instead
|
|
197
|
+
*/
|
|
198
|
+
_defineProperty(this, "oldState", void 0);
|
|
199
|
+
/**
|
|
200
|
+
* currentState The state of the room at the time of the newest event in the timeline.
|
|
201
|
+
*
|
|
202
|
+
* @deprecated Present for backwards compatibility.
|
|
203
|
+
* Use getLiveTimeline().getState(EventTimeline.FORWARDS) instead.
|
|
204
|
+
*/
|
|
205
|
+
_defineProperty(this, "currentState", void 0);
|
|
206
|
+
_defineProperty(this, "relations", void 0);
|
|
180
207
|
/**
|
|
181
208
|
* A collection of events known by the client
|
|
182
209
|
* This is not a comprehensive list of the threads that exist in this room
|
|
@@ -208,15 +235,38 @@ export class Room extends ReadReceipt {
|
|
|
208
235
|
* Stores and tracks sticky events
|
|
209
236
|
*/
|
|
210
237
|
_defineProperty(this, "stickyEvents", new RoomStickyEventsStore());
|
|
238
|
+
_defineProperty(this, "retention", void 0);
|
|
211
239
|
_defineProperty(this, "threadTimelineSetsPromise", null);
|
|
240
|
+
_defineProperty(this, "onReceipt", event => {
|
|
241
|
+
if (this.hasEncryptionStateEvent()) {
|
|
242
|
+
this.clearNotificationsOnReceipt(event);
|
|
243
|
+
}
|
|
244
|
+
});
|
|
212
245
|
_defineProperty(this, "threadsReady", false);
|
|
246
|
+
_defineProperty(this, "onThreadUpdate", thread => {
|
|
247
|
+
this.updateThreadRootEvents(thread, false, false);
|
|
248
|
+
});
|
|
249
|
+
_defineProperty(this, "onThreadReply", thread => {
|
|
250
|
+
this.updateThreadRootEvents(thread, false, true);
|
|
251
|
+
});
|
|
252
|
+
_defineProperty(this, "onThreadDelete", thread => {
|
|
253
|
+
this.threads.delete(thread.id);
|
|
254
|
+
const timeline = this.getTimelineForEvent(thread.id);
|
|
255
|
+
const roomEvent = timeline?.getEvents()?.find(it => it.getId() === thread.id);
|
|
256
|
+
if (roomEvent) {
|
|
257
|
+
thread.clearEventMetadata(roomEvent);
|
|
258
|
+
} else {
|
|
259
|
+
logger.debug("onThreadDelete: Could not find root event in room timeline");
|
|
260
|
+
}
|
|
261
|
+
for (const timelineSet of this.threadsTimelineSets) {
|
|
262
|
+
timelineSet.removeEvent(thread.id);
|
|
263
|
+
}
|
|
264
|
+
});
|
|
213
265
|
_defineProperty(this, "updateThreadRootEvents", (thread, toStartOfTimeline, recreateEvent) => {
|
|
214
266
|
if (thread.length) {
|
|
215
|
-
|
|
216
|
-
this.updateThreadRootEvent((_this$threadsTimeline = this.threadsTimelineSets) === null || _this$threadsTimeline === void 0 ? void 0 : _this$threadsTimeline[0], thread, toStartOfTimeline, recreateEvent);
|
|
267
|
+
this.updateThreadRootEvent(this.threadsTimelineSets?.[0], thread, toStartOfTimeline, recreateEvent);
|
|
217
268
|
if (thread.hasCurrentUserParticipated) {
|
|
218
|
-
|
|
219
|
-
this.updateThreadRootEvent((_this$threadsTimeline2 = this.threadsTimelineSets) === null || _this$threadsTimeline2 === void 0 ? void 0 : _this$threadsTimeline2[1], thread, toStartOfTimeline, recreateEvent);
|
|
269
|
+
this.updateThreadRootEvent(this.threadsTimelineSets?.[1], thread, toStartOfTimeline, recreateEvent);
|
|
220
270
|
}
|
|
221
271
|
}
|
|
222
272
|
});
|
|
@@ -248,10 +298,10 @@ export class Room extends ReadReceipt {
|
|
|
248
298
|
// if they wish to. Also this may be needed to trigger an update.
|
|
249
299
|
|
|
250
300
|
if (event.isRedaction()) {
|
|
251
|
-
|
|
301
|
+
const redactId = event.event.redacts;
|
|
252
302
|
|
|
253
303
|
// if we know about this event, redact its contents now.
|
|
254
|
-
|
|
304
|
+
const redactedEvent = redactId ? this.findEventById(redactId) : undefined;
|
|
255
305
|
if (redactId) {
|
|
256
306
|
try {
|
|
257
307
|
this.stickyEvents.handleRedaction(redactedEvent || redactId);
|
|
@@ -264,17 +314,17 @@ export class Room extends ReadReceipt {
|
|
|
264
314
|
this.applyEventAsRedaction(event, redactedEvent);
|
|
265
315
|
}
|
|
266
316
|
} else if (event.getType() === EventType.RoomMember) {
|
|
267
|
-
|
|
317
|
+
const membership = event.getContent()["membership"];
|
|
268
318
|
if (membership !== KnownMembership.Ban && !(membership === KnownMembership.Leave && event.getStateKey() !== event.getSender())) {
|
|
269
319
|
// Not a ban or kick, therefore not a membership event we care about here.
|
|
270
320
|
return;
|
|
271
321
|
}
|
|
272
|
-
|
|
322
|
+
const redactEvents = event.getContent()["org.matrix.msc4293.redact_events"];
|
|
273
323
|
if (redactEvents !== true) {
|
|
274
324
|
// Invalid or not set - nothing to redact.
|
|
275
325
|
return;
|
|
276
326
|
}
|
|
277
|
-
|
|
327
|
+
const state = this.getLiveTimeline().getState(Direction.Forward);
|
|
278
328
|
if (!state.maySendRedactionForEvent(event, event.getSender())) {
|
|
279
329
|
// If the sender can't redact the membership event, then they won't be able to
|
|
280
330
|
// redact any of the target's events either, so skip.
|
|
@@ -282,14 +332,14 @@ export class Room extends ReadReceipt {
|
|
|
282
332
|
}
|
|
283
333
|
|
|
284
334
|
// The redaction is possible, so let's find all the events and apply it.
|
|
285
|
-
|
|
335
|
+
const events = this.getTimelineSets().map(s => s.getTimelines()).reduce((p, c) => {
|
|
286
336
|
p.push(...c);
|
|
287
337
|
return p;
|
|
288
338
|
}, []).map(t => t.getEvents().filter(e => e.getSender() === event.getStateKey())).reduce((p, c) => {
|
|
289
339
|
p.push(...c);
|
|
290
340
|
return c;
|
|
291
341
|
}, []);
|
|
292
|
-
for (
|
|
342
|
+
for (const toRedact of events) {
|
|
293
343
|
this.applyEventAsRedaction(event, toRedact);
|
|
294
344
|
}
|
|
295
345
|
}
|
|
@@ -318,20 +368,15 @@ export class Room extends ReadReceipt {
|
|
|
318
368
|
if (this.opts.pendingEventOrdering === PendingEventOrdering.Detached) {
|
|
319
369
|
this.pendingEventList = [];
|
|
320
370
|
this.client.store.getPendingEvents(this.roomId).then(events => {
|
|
321
|
-
|
|
371
|
+
const mapper = this.client.getEventMapper({
|
|
322
372
|
decrypt: false
|
|
323
373
|
});
|
|
324
|
-
events.forEach(
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
});
|
|
331
|
-
return function (_x) {
|
|
332
|
-
return _ref.apply(this, arguments);
|
|
333
|
-
};
|
|
334
|
-
}());
|
|
374
|
+
events.forEach(async serializedEvent => {
|
|
375
|
+
const event = mapper(serializedEvent);
|
|
376
|
+
await client.decryptEventIfNeeded(event);
|
|
377
|
+
event.setStatus(EventStatus.NOT_SENT);
|
|
378
|
+
this.addPendingEvent(event, event.getTxnId());
|
|
379
|
+
});
|
|
335
380
|
});
|
|
336
381
|
}
|
|
337
382
|
|
|
@@ -341,28 +386,27 @@ export class Room extends ReadReceipt {
|
|
|
341
386
|
} else {
|
|
342
387
|
this.membersPromise = undefined;
|
|
343
388
|
}
|
|
389
|
+
if (this.client?._unstable_shouldApplyMessageRetention) {
|
|
390
|
+
this.retention = new RoomRetentionPolicy(this, client.retentionPolicyService, client.store);
|
|
391
|
+
}
|
|
344
392
|
}
|
|
345
|
-
createThreadsTimelineSets() {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
} catch (_unused) {
|
|
360
|
-
_this2.threadTimelineSetsPromise = null;
|
|
361
|
-
return null;
|
|
362
|
-
}
|
|
393
|
+
async createThreadsTimelineSets() {
|
|
394
|
+
if (this.threadTimelineSetsPromise) {
|
|
395
|
+
return this.threadTimelineSetsPromise;
|
|
396
|
+
}
|
|
397
|
+
if (this.client?.supportsThreads()) {
|
|
398
|
+
try {
|
|
399
|
+
this.threadTimelineSetsPromise = Promise.all([this.createThreadTimelineSet(), this.createThreadTimelineSet(ThreadFilterType.My)]);
|
|
400
|
+
const timelineSets = await this.threadTimelineSetsPromise;
|
|
401
|
+
this.threadsTimelineSets[0] = timelineSets[0];
|
|
402
|
+
this.threadsTimelineSets[1] = timelineSets[1];
|
|
403
|
+
return timelineSets;
|
|
404
|
+
} catch {
|
|
405
|
+
this.threadTimelineSetsPromise = null;
|
|
406
|
+
return null;
|
|
363
407
|
}
|
|
364
|
-
|
|
365
|
-
|
|
408
|
+
}
|
|
409
|
+
return null;
|
|
366
410
|
}
|
|
367
411
|
|
|
368
412
|
/**
|
|
@@ -376,18 +420,15 @@ export class Room extends ReadReceipt {
|
|
|
376
420
|
*
|
|
377
421
|
* @returns Signals when all events have been decrypted
|
|
378
422
|
*/
|
|
379
|
-
decryptCriticalEvents() {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
var decryptionPromises = events.slice(readReceiptTimelineIndex).reverse().map(event => _this3.client.decryptEventIfNeeded(event));
|
|
389
|
-
yield Promise.allSettled(decryptionPromises);
|
|
390
|
-
})();
|
|
423
|
+
async decryptCriticalEvents() {
|
|
424
|
+
if (!this.client.getCrypto()) return;
|
|
425
|
+
const readReceiptEventId = this.getEventReadUpTo(this.client.getUserId(), true);
|
|
426
|
+
const events = this.getLiveTimeline().getEvents();
|
|
427
|
+
const readReceiptTimelineIndex = events.findIndex(matrixEvent => {
|
|
428
|
+
return matrixEvent.event.event_id === readReceiptEventId;
|
|
429
|
+
});
|
|
430
|
+
const decryptionPromises = events.slice(readReceiptTimelineIndex).reverse().map(event => this.client.decryptEventIfNeeded(event));
|
|
431
|
+
await Promise.allSettled(decryptionPromises);
|
|
391
432
|
}
|
|
392
433
|
|
|
393
434
|
/**
|
|
@@ -395,14 +436,11 @@ export class Room extends ReadReceipt {
|
|
|
395
436
|
*
|
|
396
437
|
* @returns Signals when all events have been decrypted
|
|
397
438
|
*/
|
|
398
|
-
decryptAllEvents() {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
.reverse().map(event => _this4.client.decryptEventIfNeeded(event));
|
|
404
|
-
yield Promise.allSettled(decryptionPromises);
|
|
405
|
-
})();
|
|
439
|
+
async decryptAllEvents() {
|
|
440
|
+
if (!this.client.getCrypto()) return;
|
|
441
|
+
const decryptionPromises = this.getUnfilteredTimelineSet().getLiveTimeline().getEvents().slice(0) // copy before reversing
|
|
442
|
+
.reverse().map(event => this.client.decryptEventIfNeeded(event));
|
|
443
|
+
await Promise.allSettled(decryptionPromises);
|
|
406
444
|
}
|
|
407
445
|
|
|
408
446
|
/**
|
|
@@ -410,9 +448,8 @@ export class Room extends ReadReceipt {
|
|
|
410
448
|
* @returns The creator of the room, or null if it could not be determined
|
|
411
449
|
*/
|
|
412
450
|
getCreator() {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
return (_createEvent$getSende = createEvent === null || createEvent === void 0 ? void 0 : createEvent.getSender()) !== null && _createEvent$getSende !== void 0 ? _createEvent$getSende : null;
|
|
451
|
+
const createEvent = this.currentState.getStateEvents(EventType.RoomCreate, "");
|
|
452
|
+
return createEvent?.getSender() ?? null;
|
|
416
453
|
}
|
|
417
454
|
|
|
418
455
|
/**
|
|
@@ -434,53 +471,50 @@ export class Room extends ReadReceipt {
|
|
|
434
471
|
* @returns
|
|
435
472
|
* Resolves to the version the room should be upgraded to.
|
|
436
473
|
*/
|
|
437
|
-
getRecommendedVersion() {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
474
|
+
async getRecommendedVersion() {
|
|
475
|
+
let capabilities = {};
|
|
476
|
+
try {
|
|
477
|
+
capabilities = await this.client.getCapabilities();
|
|
478
|
+
} catch {}
|
|
479
|
+
let versionCap = capabilities["m.room_versions"];
|
|
480
|
+
if (!versionCap) {
|
|
481
|
+
versionCap = {
|
|
482
|
+
default: KNOWN_SAFE_ROOM_VERSION,
|
|
483
|
+
available: {}
|
|
484
|
+
};
|
|
485
|
+
for (const safeVer of SAFE_ROOM_VERSIONS) {
|
|
486
|
+
versionCap.available[safeVer] = RoomVersionStability.Stable;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
let result = this.checkVersionAgainstCapability(versionCap);
|
|
490
|
+
if (result.urgent && result.needsUpgrade) {
|
|
491
|
+
// Something doesn't feel right: we shouldn't need to update
|
|
492
|
+
// because the version we're on should be in the protocol's
|
|
493
|
+
// namespace. This usually means that the server was updated
|
|
494
|
+
// before the client was, making us think the newest possible
|
|
495
|
+
// room version is not stable. As a solution, we'll refresh
|
|
496
|
+
// the capability we're using to determine this.
|
|
497
|
+
logger.warn("Refreshing room version capability because the server looks " + "to be supporting a newer room version we don't know about.");
|
|
441
498
|
try {
|
|
442
|
-
capabilities =
|
|
443
|
-
} catch (
|
|
444
|
-
|
|
445
|
-
if (!versionCap) {
|
|
446
|
-
versionCap = {
|
|
447
|
-
default: KNOWN_SAFE_ROOM_VERSION,
|
|
448
|
-
available: {}
|
|
449
|
-
};
|
|
450
|
-
for (var safeVer of SAFE_ROOM_VERSIONS) {
|
|
451
|
-
versionCap.available[safeVer] = RoomVersionStability.Stable;
|
|
452
|
-
}
|
|
499
|
+
capabilities = await this.client.fetchCapabilities();
|
|
500
|
+
} catch (e) {
|
|
501
|
+
logger.warn("Failed to refresh room version capabilities", e);
|
|
453
502
|
}
|
|
454
|
-
|
|
455
|
-
if (
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
// room version is not stable. As a solution, we'll refresh
|
|
461
|
-
// the capability we're using to determine this.
|
|
462
|
-
logger.warn("Refreshing room version capability because the server looks " + "to be supporting a newer room version we don't know about.");
|
|
463
|
-
try {
|
|
464
|
-
capabilities = yield _this5.client.fetchCapabilities();
|
|
465
|
-
} catch (e) {
|
|
466
|
-
logger.warn("Failed to refresh room version capabilities", e);
|
|
467
|
-
}
|
|
468
|
-
versionCap = capabilities["m.room_versions"];
|
|
469
|
-
if (!versionCap) {
|
|
470
|
-
logger.warn("No room version capability - assuming upgrade required.");
|
|
471
|
-
return result;
|
|
472
|
-
} else {
|
|
473
|
-
result = _this5.checkVersionAgainstCapability(versionCap);
|
|
474
|
-
}
|
|
503
|
+
versionCap = capabilities["m.room_versions"];
|
|
504
|
+
if (!versionCap) {
|
|
505
|
+
logger.warn("No room version capability - assuming upgrade required.");
|
|
506
|
+
return result;
|
|
507
|
+
} else {
|
|
508
|
+
result = this.checkVersionAgainstCapability(versionCap);
|
|
475
509
|
}
|
|
476
|
-
|
|
477
|
-
|
|
510
|
+
}
|
|
511
|
+
return result;
|
|
478
512
|
}
|
|
479
513
|
checkVersionAgainstCapability(versionCap) {
|
|
480
|
-
|
|
481
|
-
logger.log(
|
|
482
|
-
logger.log(
|
|
483
|
-
|
|
514
|
+
const currentVersion = this.getVersion();
|
|
515
|
+
logger.log(`[${this.roomId}] Current version: ${currentVersion}`);
|
|
516
|
+
logger.log(`[${this.roomId}] Version capability: `, versionCap);
|
|
517
|
+
const result = {
|
|
484
518
|
version: currentVersion,
|
|
485
519
|
needsUpgrade: false,
|
|
486
520
|
urgent: false
|
|
@@ -488,7 +522,7 @@ export class Room extends ReadReceipt {
|
|
|
488
522
|
|
|
489
523
|
// If the room is on the default version then nothing needs to change
|
|
490
524
|
if (currentVersion === versionCap.default) return result;
|
|
491
|
-
|
|
525
|
+
const stableVersions = Object.keys(versionCap.available).filter(v => versionCap.available[v] === "stable");
|
|
492
526
|
|
|
493
527
|
// Check if the room is on an unstable version. We determine urgency based
|
|
494
528
|
// off the version being in the Matrix spec namespace or not (if the version
|
|
@@ -498,9 +532,9 @@ export class Room extends ReadReceipt {
|
|
|
498
532
|
result.needsUpgrade = true;
|
|
499
533
|
result.urgent = !!this.getVersion().match(/^[0-9]+[0-9.]*$/g);
|
|
500
534
|
if (result.urgent) {
|
|
501
|
-
logger.warn(
|
|
535
|
+
logger.warn(`URGENT upgrade required on ${this.roomId}`);
|
|
502
536
|
} else {
|
|
503
|
-
logger.warn(
|
|
537
|
+
logger.warn(`Non-urgent upgrade required on ${this.roomId}`);
|
|
504
538
|
}
|
|
505
539
|
return result;
|
|
506
540
|
}
|
|
@@ -543,7 +577,7 @@ export class Room extends ReadReceipt {
|
|
|
543
577
|
if (!this.pendingEventList) {
|
|
544
578
|
throw new Error("Cannot call removePendingEvent with pendingEventOrdering == " + this.opts.pendingEventOrdering);
|
|
545
579
|
}
|
|
546
|
-
|
|
580
|
+
const removed = removeElement(this.pendingEventList, function (ev) {
|
|
547
581
|
return ev.getId() == eventId;
|
|
548
582
|
}, false);
|
|
549
583
|
this.savePendingEvents();
|
|
@@ -557,8 +591,7 @@ export class Room extends ReadReceipt {
|
|
|
557
591
|
* @param eventId - The event ID to check for.
|
|
558
592
|
*/
|
|
559
593
|
hasPendingEvent(eventId) {
|
|
560
|
-
|
|
561
|
-
return (_this$pendingEventLis = (_this$pendingEventLis2 = this.pendingEventList) === null || _this$pendingEventLis2 === void 0 ? void 0 : _this$pendingEventLis2.some(event => event.getId() === eventId)) !== null && _this$pendingEventLis !== void 0 ? _this$pendingEventLis : false;
|
|
594
|
+
return this.pendingEventList?.some(event => event.getId() === eventId) ?? false;
|
|
562
595
|
}
|
|
563
596
|
|
|
564
597
|
/**
|
|
@@ -567,8 +600,7 @@ export class Room extends ReadReceipt {
|
|
|
567
600
|
* @param eventId - The event ID to check for.
|
|
568
601
|
*/
|
|
569
602
|
getPendingEvent(eventId) {
|
|
570
|
-
|
|
571
|
-
return (_this$pendingEventLis3 = (_this$pendingEventLis4 = this.pendingEventList) === null || _this$pendingEventLis4 === void 0 ? void 0 : _this$pendingEventLis4.find(event => event.getId() === eventId)) !== null && _this$pendingEventLis3 !== void 0 ? _this$pendingEventLis3 : null;
|
|
603
|
+
return this.pendingEventList?.find(event => event.getId() === eventId) ?? null;
|
|
572
604
|
}
|
|
573
605
|
|
|
574
606
|
/**
|
|
@@ -596,10 +628,10 @@ export class Room extends ReadReceipt {
|
|
|
596
628
|
* @returns the timestamp of the last message in the room
|
|
597
629
|
*/
|
|
598
630
|
getLastActiveTimestamp() {
|
|
599
|
-
|
|
600
|
-
|
|
631
|
+
const timeline = this.getLiveTimeline();
|
|
632
|
+
const events = timeline.getEvents();
|
|
601
633
|
if (events.length) {
|
|
602
|
-
|
|
634
|
+
const lastEvent = events[events.length - 1];
|
|
603
635
|
return lastEvent.getTs();
|
|
604
636
|
} else {
|
|
605
637
|
return Number.MIN_SAFE_INTEGER;
|
|
@@ -617,13 +649,12 @@ export class Room extends ReadReceipt {
|
|
|
617
649
|
* @returns MatrixEvent if there is a last event; else undefined.
|
|
618
650
|
*/
|
|
619
651
|
getLastLiveEvent() {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
var lastThread = this.getLastThread();
|
|
652
|
+
const roomEvents = this.getLiveTimeline().getEvents();
|
|
653
|
+
const lastRoomEvent = roomEvents[roomEvents.length - 1];
|
|
654
|
+
const lastThread = this.getLastThread();
|
|
624
655
|
if (!lastThread) return lastRoomEvent;
|
|
625
|
-
|
|
626
|
-
return (
|
|
656
|
+
const lastThreadEvent = lastThread.events[lastThread.events.length - 1];
|
|
657
|
+
return (lastRoomEvent?.getTs() ?? 0) > (lastThreadEvent?.getTs() ?? 0) ? lastRoomEvent : lastThreadEvent;
|
|
627
658
|
}
|
|
628
659
|
|
|
629
660
|
/**
|
|
@@ -637,11 +668,10 @@ export class Room extends ReadReceipt {
|
|
|
637
668
|
*/
|
|
638
669
|
getLastThread() {
|
|
639
670
|
return this.getThreads().reduce((lastThread, thread) => {
|
|
640
|
-
var _threadEvent$getTs, _lastThreadEvent$getT2;
|
|
641
671
|
if (!lastThread) return thread;
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
if ((
|
|
672
|
+
const threadEvent = thread.events[thread.events.length - 1];
|
|
673
|
+
const lastThreadEvent = lastThread.events[lastThread.events.length - 1];
|
|
674
|
+
if ((threadEvent?.getTs() ?? 0) >= (lastThreadEvent?.getTs() ?? 0)) {
|
|
645
675
|
// Last message of current thread is newer → new last thread.
|
|
646
676
|
// Equal also means newer, because it was added to the thread map later.
|
|
647
677
|
return thread;
|
|
@@ -654,8 +684,7 @@ export class Room extends ReadReceipt {
|
|
|
654
684
|
* @returns the membership type (join | leave | invite | knock) for the logged in user
|
|
655
685
|
*/
|
|
656
686
|
getMyMembership() {
|
|
657
|
-
|
|
658
|
-
return (_this$selfMembership = this.selfMembership) !== null && _this$selfMembership !== void 0 ? _this$selfMembership : KnownMembership.Leave;
|
|
687
|
+
return this.selfMembership ?? KnownMembership.Leave;
|
|
659
688
|
}
|
|
660
689
|
|
|
661
690
|
/**
|
|
@@ -664,16 +693,15 @@ export class Room extends ReadReceipt {
|
|
|
664
693
|
* @returns user id of the inviter
|
|
665
694
|
*/
|
|
666
695
|
getDMInviter() {
|
|
667
|
-
|
|
696
|
+
const me = this.getMember(this.myUserId);
|
|
668
697
|
if (me) {
|
|
669
698
|
return me.getDMInviter();
|
|
670
699
|
}
|
|
671
700
|
if (this.selfMembership === KnownMembership.Invite) {
|
|
672
701
|
// fall back to summary information
|
|
673
|
-
|
|
702
|
+
const memberCount = this.getInvitedAndJoinedMemberCount();
|
|
674
703
|
if (memberCount === 2) {
|
|
675
|
-
|
|
676
|
-
return (_this$heroes = this.heroes) === null || _this$heroes === void 0 || (_this$heroes = _this$heroes[0]) === null || _this$heroes === void 0 ? void 0 : _this$heroes.userId;
|
|
704
|
+
return this.heroes?.[0]?.userId;
|
|
677
705
|
}
|
|
678
706
|
}
|
|
679
707
|
}
|
|
@@ -683,9 +711,9 @@ export class Room extends ReadReceipt {
|
|
|
683
711
|
* @returns user id of the other member (could be syncing user)
|
|
684
712
|
*/
|
|
685
713
|
guessDMUserId() {
|
|
686
|
-
|
|
714
|
+
const me = this.getMember(this.myUserId);
|
|
687
715
|
if (me) {
|
|
688
|
-
|
|
716
|
+
const inviterId = me.getDMInviter();
|
|
689
717
|
if (inviterId) {
|
|
690
718
|
return inviterId;
|
|
691
719
|
}
|
|
@@ -694,8 +722,8 @@ export class Room extends ReadReceipt {
|
|
|
694
722
|
if (Array.isArray(this.heroes) && this.heroes.length) {
|
|
695
723
|
return this.heroes[0].userId;
|
|
696
724
|
}
|
|
697
|
-
|
|
698
|
-
|
|
725
|
+
const members = this.currentState.getMembers();
|
|
726
|
+
const anyMember = members.find(m => m.userId !== this.myUserId);
|
|
699
727
|
if (anyMember) {
|
|
700
728
|
return anyMember.userId;
|
|
701
729
|
}
|
|
@@ -714,18 +742,17 @@ export class Room extends ReadReceipt {
|
|
|
714
742
|
* @see https://github.com/element-hq/element-meta/blob/develop/spec/functional_members.md.
|
|
715
743
|
*/
|
|
716
744
|
getFunctionalMembers() {
|
|
717
|
-
|
|
718
|
-
if (Array.isArray(mFunctionalMembers
|
|
745
|
+
const mFunctionalMembers = this.currentState.getStateEvents(UNSTABLE_ELEMENT_FUNCTIONAL_USERS.name, "");
|
|
746
|
+
if (Array.isArray(mFunctionalMembers?.getContent().service_members)) {
|
|
719
747
|
return mFunctionalMembers.getContent().service_members;
|
|
720
748
|
}
|
|
721
749
|
return [];
|
|
722
750
|
}
|
|
723
751
|
getAvatarFallbackMember() {
|
|
724
|
-
|
|
725
|
-
var functionalMembers = this.getFunctionalMembers();
|
|
752
|
+
const functionalMembers = this.getFunctionalMembers();
|
|
726
753
|
|
|
727
754
|
// Only generate a fallback avatar if the conversation is with a single specific other user (a "DM").
|
|
728
|
-
|
|
755
|
+
let nonFunctionalMemberCount = 0;
|
|
729
756
|
this.getMembers().forEach(m => {
|
|
730
757
|
if (m.membership !== "join" && m.membership !== "invite") return;
|
|
731
758
|
if (functionalMembers.includes(m.userId)) return;
|
|
@@ -734,17 +761,17 @@ export class Room extends ReadReceipt {
|
|
|
734
761
|
if (nonFunctionalMemberCount > 2) return;
|
|
735
762
|
|
|
736
763
|
// Prefer the list of heroes, if present. It should only include the single other user in the DM.
|
|
737
|
-
|
|
738
|
-
|
|
764
|
+
const nonFunctionalHeroes = this.heroes?.filter(h => !functionalMembers.includes(h.userId));
|
|
765
|
+
const hasHeroes = Array.isArray(nonFunctionalHeroes) && nonFunctionalHeroes.length;
|
|
739
766
|
if (hasHeroes) {
|
|
740
767
|
// use first hero that has a display name or avatar url, or whose user ID
|
|
741
768
|
// can be looked up as a member of the room
|
|
742
|
-
for (
|
|
769
|
+
for (const hero of nonFunctionalHeroes) {
|
|
743
770
|
// If the hero was from a legacy sync (`/v3/sync`), we will need to look the user ID up in the room
|
|
744
771
|
// the display name and avatar URL will not be set.
|
|
745
772
|
if (!hero.fromMSC4186) {
|
|
746
773
|
// attempt to look up renderable fields from the m.room.member event if it exists
|
|
747
|
-
|
|
774
|
+
const member = this.getMember(hero.userId);
|
|
748
775
|
if (member) {
|
|
749
776
|
return member;
|
|
750
777
|
}
|
|
@@ -753,7 +780,7 @@ export class Room extends ReadReceipt {
|
|
|
753
780
|
// TODO: It's unfortunate that this function, which clearly only cares about the
|
|
754
781
|
// avatar url, returns the entire RoomMember event. We need to fake an event
|
|
755
782
|
// to meet this API shape.
|
|
756
|
-
|
|
783
|
+
const heroMember = new RoomMember(this.roomId, hero.userId);
|
|
757
784
|
// set the display name and avatar url
|
|
758
785
|
heroMember.setMembershipEvent(new MatrixEvent({
|
|
759
786
|
// ensure it's unique even if we hit the same millisecond
|
|
@@ -768,7 +795,7 @@ export class Room extends ReadReceipt {
|
|
|
768
795
|
return heroMember;
|
|
769
796
|
}
|
|
770
797
|
}
|
|
771
|
-
|
|
798
|
+
const availableMember = nonFunctionalHeroes.map(hero => {
|
|
772
799
|
return this.getMember(hero.userId);
|
|
773
800
|
}).find(member => !!member);
|
|
774
801
|
if (availableMember) {
|
|
@@ -778,27 +805,27 @@ export class Room extends ReadReceipt {
|
|
|
778
805
|
|
|
779
806
|
// Consider *all*, including previous, members, to generate the avatar for DMs where the other user left.
|
|
780
807
|
// Needed to generate a matching avatar for rooms named "Empty Room (was Alice)".
|
|
781
|
-
|
|
782
|
-
|
|
808
|
+
const members = this.getMembers();
|
|
809
|
+
const nonFunctionalMembers = members?.filter(m => !functionalMembers.includes(m.userId));
|
|
783
810
|
if (nonFunctionalMembers.length <= 2) {
|
|
784
|
-
|
|
811
|
+
const availableMember = nonFunctionalMembers.find(m => {
|
|
785
812
|
return m.userId !== this.myUserId;
|
|
786
813
|
});
|
|
787
|
-
if (
|
|
788
|
-
return
|
|
814
|
+
if (availableMember) {
|
|
815
|
+
return availableMember;
|
|
789
816
|
}
|
|
790
817
|
}
|
|
791
818
|
|
|
792
819
|
// If all else failed, but the homeserver gave us heroes that previously could not be found in the room members,
|
|
793
820
|
// trust and try falling back to a hero, creating a one-off member for it
|
|
794
821
|
if (hasHeroes) {
|
|
795
|
-
|
|
822
|
+
const availableUser = nonFunctionalHeroes.map(hero => {
|
|
796
823
|
return this.client.getUser(hero.userId);
|
|
797
824
|
}).find(user => !!user);
|
|
798
825
|
if (availableUser) {
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
return
|
|
826
|
+
const member = new RoomMember(this.roomId, availableUser.userId);
|
|
827
|
+
member.user = availableUser;
|
|
828
|
+
return member;
|
|
802
829
|
}
|
|
803
830
|
}
|
|
804
831
|
}
|
|
@@ -808,7 +835,7 @@ export class Room extends ReadReceipt {
|
|
|
808
835
|
* @param membership - join | leave | invite
|
|
809
836
|
*/
|
|
810
837
|
updateMyMembership(membership) {
|
|
811
|
-
|
|
838
|
+
const prevMembership = this.selfMembership;
|
|
812
839
|
this.selfMembership = membership;
|
|
813
840
|
if (prevMembership !== membership) {
|
|
814
841
|
if (membership === KnownMembership.Leave) {
|
|
@@ -817,36 +844,30 @@ export class Room extends ReadReceipt {
|
|
|
817
844
|
this.emit(RoomEvent.MyMembership, this, membership, prevMembership);
|
|
818
845
|
}
|
|
819
846
|
}
|
|
820
|
-
loadMembersFromServer() {
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
var memberEvents = rawMembersEvents.filter(noUnsafeEventProps).map(_this7.client.getEventMapper());
|
|
845
|
-
return {
|
|
846
|
-
memberEvents,
|
|
847
|
-
fromServer
|
|
848
|
-
};
|
|
849
|
-
})();
|
|
847
|
+
async loadMembersFromServer() {
|
|
848
|
+
const lastSyncToken = this.client.store.getSyncToken();
|
|
849
|
+
const response = await this.client.members(this.roomId, undefined, KnownMembership.Leave, lastSyncToken ?? undefined);
|
|
850
|
+
return response.chunk;
|
|
851
|
+
}
|
|
852
|
+
async loadMembers() {
|
|
853
|
+
// were the members loaded from the server?
|
|
854
|
+
let fromServer = false;
|
|
855
|
+
let rawMembersEvents = await this.client.store.getOutOfBandMembers(this.roomId);
|
|
856
|
+
// If the room is encrypted, we always fetch members from the server at
|
|
857
|
+
// least once, in case the latest state wasn't persisted properly. Note
|
|
858
|
+
// that this function is only called once (unless loading the members
|
|
859
|
+
// fails), since loadMembersIfNeeded always returns this.membersPromise
|
|
860
|
+
// if set, which will be the result of the first (successful) call.
|
|
861
|
+
if (rawMembersEvents === null || this.hasEncryptionStateEvent()) {
|
|
862
|
+
fromServer = true;
|
|
863
|
+
rawMembersEvents = await this.loadMembersFromServer();
|
|
864
|
+
logger.log(`LL: got ${rawMembersEvents.length} ` + `members from server for room ${this.roomId}`);
|
|
865
|
+
}
|
|
866
|
+
const memberEvents = rawMembersEvents.filter(noUnsafeEventProps).map(this.client.getEventMapper());
|
|
867
|
+
return {
|
|
868
|
+
memberEvents,
|
|
869
|
+
fromServer
|
|
870
|
+
};
|
|
850
871
|
}
|
|
851
872
|
|
|
852
873
|
/**
|
|
@@ -879,7 +900,7 @@ export class Room extends ReadReceipt {
|
|
|
879
900
|
// the request is in flight get marked as superseding
|
|
880
901
|
// the OOB members
|
|
881
902
|
this.currentState.markOutOfBandMembersStarted();
|
|
882
|
-
|
|
903
|
+
const inMemoryUpdate = this.loadMembers().then(result => {
|
|
883
904
|
this.currentState.setOutOfBandMembers(result.memberEvents);
|
|
884
905
|
// recalculate the room name: it may have been based on members, so may have changed
|
|
885
906
|
this.recalculate();
|
|
@@ -893,12 +914,9 @@ export class Room extends ReadReceipt {
|
|
|
893
914
|
// update members in storage, but don't wait for it
|
|
894
915
|
inMemoryUpdate.then(fromServer => {
|
|
895
916
|
if (fromServer) {
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
});
|
|
900
|
-
logger.log("LL: telling store to write ".concat(oobMembers.length) + " members for room ".concat(this.roomId));
|
|
901
|
-
var store = this.client.store;
|
|
917
|
+
const oobMembers = this.currentState.getMembers().filter(m => m.isOutOfBand()).map(m => m.events.member?.event);
|
|
918
|
+
logger.log(`LL: telling store to write ${oobMembers.length}` + ` members for room ${this.roomId}`);
|
|
919
|
+
const store = this.client.store;
|
|
902
920
|
return store.setOutOfBandMembers(this.roomId, oobMembers)
|
|
903
921
|
// swallow any IDB error as we don't want to fail
|
|
904
922
|
// because of this
|
|
@@ -918,16 +936,13 @@ export class Room extends ReadReceipt {
|
|
|
918
936
|
/**
|
|
919
937
|
* Removes the lazily loaded members from storage if needed
|
|
920
938
|
*/
|
|
921
|
-
clearLoadedMembersIfNeeded() {
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
_this8.membersPromise = undefined;
|
|
929
|
-
}
|
|
930
|
-
})();
|
|
939
|
+
async clearLoadedMembersIfNeeded() {
|
|
940
|
+
if (this.opts.lazyLoadMembers && this.membersPromise) {
|
|
941
|
+
await this.loadMembersIfNeeded();
|
|
942
|
+
await this.client.store.clearOutOfBandMembers(this.roomId);
|
|
943
|
+
this.currentState.clearOutOfBandMembers();
|
|
944
|
+
this.membersPromise = undefined;
|
|
945
|
+
}
|
|
931
946
|
}
|
|
932
947
|
|
|
933
948
|
/**
|
|
@@ -936,7 +951,7 @@ export class Room extends ReadReceipt {
|
|
|
936
951
|
*/
|
|
937
952
|
cleanupAfterLeaving() {
|
|
938
953
|
this.clearLoadedMembersIfNeeded().catch(err => {
|
|
939
|
-
logger.error(
|
|
954
|
+
logger.error(`error after clearing loaded members from ` + `room ${this.roomId} after leaving`);
|
|
940
955
|
logger.log(err);
|
|
941
956
|
});
|
|
942
957
|
}
|
|
@@ -954,81 +969,78 @@ export class Room extends ReadReceipt {
|
|
|
954
969
|
* valid marker and can check the needs refresh status via
|
|
955
970
|
* `room.getTimelineNeedsRefresh()`.
|
|
956
971
|
*/
|
|
957
|
-
refreshLiveTimeline() {
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
logger.log("[refreshLiveTimeline for ".concat(_this9.roomId, "] `/sync` or some other request beat us to creating a new ") + "live timeline after we reset it. We'll use that instead since any events in the scrollback from " + "this timeline will include the history.");
|
|
1023
|
-
}
|
|
972
|
+
async refreshLiveTimeline() {
|
|
973
|
+
const liveTimelineBefore = this.getLiveTimeline();
|
|
974
|
+
const forwardPaginationToken = liveTimelineBefore.getPaginationToken(EventTimeline.FORWARDS);
|
|
975
|
+
const backwardPaginationToken = liveTimelineBefore.getPaginationToken(EventTimeline.BACKWARDS);
|
|
976
|
+
const eventsBefore = liveTimelineBefore.getEvents();
|
|
977
|
+
const mostRecentEventInTimeline = eventsBefore[eventsBefore.length - 1];
|
|
978
|
+
logger.log(`[refreshLiveTimeline for ${this.roomId}] at ` + `mostRecentEventInTimeline=${mostRecentEventInTimeline && mostRecentEventInTimeline.getId()} ` + `liveTimelineBefore=${liveTimelineBefore.toString()} ` + `forwardPaginationToken=${forwardPaginationToken} ` + `backwardPaginationToken=${backwardPaginationToken}`);
|
|
979
|
+
|
|
980
|
+
// Get the main TimelineSet
|
|
981
|
+
const timelineSet = this.getUnfilteredTimelineSet();
|
|
982
|
+
let newTimeline = null;
|
|
983
|
+
// If there isn't any event in the timeline, let's go fetch the latest
|
|
984
|
+
// event and construct a timeline from it.
|
|
985
|
+
//
|
|
986
|
+
// This should only really happen if the user ran into an error
|
|
987
|
+
// with refreshing the timeline before which left them in a blank
|
|
988
|
+
// timeline from `resetLiveTimeline`.
|
|
989
|
+
if (!mostRecentEventInTimeline) {
|
|
990
|
+
newTimeline = await this.client.getLatestTimeline(timelineSet);
|
|
991
|
+
} else {
|
|
992
|
+
// Empty out all of `this.timelineSets`. But we also need to keep the
|
|
993
|
+
// same `timelineSet` references around so the React code updates
|
|
994
|
+
// properly and doesn't ignore the room events we emit because it checks
|
|
995
|
+
// that the `timelineSet` references are the same. We need the
|
|
996
|
+
// `timelineSet` empty so that the `client.getEventTimeline(...)` call
|
|
997
|
+
// later, will call `/context` and create a new timeline instead of
|
|
998
|
+
// returning the same one.
|
|
999
|
+
this.resetLiveTimeline(null, null);
|
|
1000
|
+
|
|
1001
|
+
// Make the UI timeline show the new blank live timeline we just
|
|
1002
|
+
// reset so that if the network fails below it's showing the
|
|
1003
|
+
// accurate state of what we're working with instead of the
|
|
1004
|
+
// disconnected one in the TimelineWindow which is just hanging
|
|
1005
|
+
// around by reference.
|
|
1006
|
+
this.emit(RoomEvent.TimelineRefresh, this, timelineSet);
|
|
1007
|
+
|
|
1008
|
+
// Use `client.getEventTimeline(...)` to construct a new timeline from a
|
|
1009
|
+
// `/context` response state and events for the most recent event before
|
|
1010
|
+
// we reset everything. The `timelineSet` we pass in needs to be empty
|
|
1011
|
+
// in order for this function to call `/context` and generate a new
|
|
1012
|
+
// timeline.
|
|
1013
|
+
newTimeline = await this.client.getEventTimeline(timelineSet, mostRecentEventInTimeline.getId());
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
// If a racing `/sync` beat us to creating a new timeline, use that
|
|
1017
|
+
// instead because it's the latest in the room and any new messages in
|
|
1018
|
+
// the scrollback will include the history.
|
|
1019
|
+
const liveTimeline = timelineSet.getLiveTimeline();
|
|
1020
|
+
if (!liveTimeline || liveTimeline.getPaginationToken(Direction.Forward) === null && liveTimeline.getPaginationToken(Direction.Backward) === null && liveTimeline.getEvents().length === 0) {
|
|
1021
|
+
logger.log(`[refreshLiveTimeline for ${this.roomId}] using our new live timeline`);
|
|
1022
|
+
// Set the pagination token back to the live sync token (`null`) instead
|
|
1023
|
+
// of using the `/context` historical token (ex. `t12-13_0_0_0_0_0_0_0_0`)
|
|
1024
|
+
// so that it matches the next response from `/sync` and we can properly
|
|
1025
|
+
// continue the timeline.
|
|
1026
|
+
newTimeline.setPaginationToken(forwardPaginationToken, EventTimeline.FORWARDS);
|
|
1027
|
+
|
|
1028
|
+
// Set our new fresh timeline as the live timeline to continue syncing
|
|
1029
|
+
// forwards and back paginating from.
|
|
1030
|
+
timelineSet.setLiveTimeline(newTimeline);
|
|
1031
|
+
// Fixup `this.oldstate` so that `scrollback` has the pagination tokens
|
|
1032
|
+
// available
|
|
1033
|
+
this.fixUpLegacyTimelineFields();
|
|
1034
|
+
} else {
|
|
1035
|
+
logger.log(`[refreshLiveTimeline for ${this.roomId}] \`/sync\` or some other request beat us to creating a new ` + `live timeline after we reset it. We'll use that instead since any events in the scrollback from ` + `this timeline will include the history.`);
|
|
1036
|
+
}
|
|
1024
1037
|
|
|
1025
|
-
|
|
1026
|
-
|
|
1038
|
+
// The timeline has now been refreshed ✅
|
|
1039
|
+
this.setTimelineNeedsRefresh(false);
|
|
1027
1040
|
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
})();
|
|
1041
|
+
// Emit an event which clients can react to and re-load the timeline
|
|
1042
|
+
// from the SDK
|
|
1043
|
+
this.emit(RoomEvent.TimelineRefresh, this, timelineSet);
|
|
1032
1044
|
}
|
|
1033
1045
|
|
|
1034
1046
|
/**
|
|
@@ -1043,10 +1055,10 @@ export class Room extends ReadReceipt {
|
|
|
1043
1055
|
* Removing just the old live timeline whilst preserving previous ones is not supported.
|
|
1044
1056
|
*/
|
|
1045
1057
|
resetLiveTimeline(backPaginationToken, forwardPaginationToken) {
|
|
1046
|
-
for (
|
|
1047
|
-
timelineSet.resetLiveTimeline(backPaginationToken
|
|
1058
|
+
for (const timelineSet of this.timelineSets) {
|
|
1059
|
+
timelineSet.resetLiveTimeline(backPaginationToken ?? undefined, forwardPaginationToken ?? undefined);
|
|
1048
1060
|
}
|
|
1049
|
-
for (
|
|
1061
|
+
for (const thread of this.threads.values()) {
|
|
1050
1062
|
thread.resetLiveTimeline(backPaginationToken, forwardPaginationToken);
|
|
1051
1063
|
}
|
|
1052
1064
|
this.fixUpLegacyTimelineFields();
|
|
@@ -1058,8 +1070,8 @@ export class Room extends ReadReceipt {
|
|
|
1058
1070
|
* @internal
|
|
1059
1071
|
*/
|
|
1060
1072
|
fixUpLegacyTimelineFields() {
|
|
1061
|
-
|
|
1062
|
-
|
|
1073
|
+
const previousOldState = this.oldState;
|
|
1074
|
+
const previousCurrentState = this.currentState;
|
|
1063
1075
|
|
|
1064
1076
|
// maintain this.oldState and this.currentState as references to the
|
|
1065
1077
|
// state at the start and end of that timeline. These are more
|
|
@@ -1083,11 +1095,6 @@ export class Room extends ReadReceipt {
|
|
|
1083
1095
|
this.reEmitter.reEmit(this.currentState, [RoomStateEvent.Events, RoomStateEvent.Members, RoomStateEvent.NewMember, RoomStateEvent.Update, RoomStateEvent.Marker, BeaconEvent.New, BeaconEvent.Update, BeaconEvent.Destroy, BeaconEvent.LivenessChange]);
|
|
1084
1096
|
}
|
|
1085
1097
|
}
|
|
1086
|
-
onReceipt(event) {
|
|
1087
|
-
if (this.hasEncryptionStateEvent()) {
|
|
1088
|
-
this.clearNotificationsOnReceipt(event);
|
|
1089
|
-
}
|
|
1090
|
-
}
|
|
1091
1098
|
clearNotificationsOnReceipt(event) {
|
|
1092
1099
|
// Like above, we have to listen for read receipts from ourselves in order to
|
|
1093
1100
|
// correctly handle notification counts on encrypted rooms.
|
|
@@ -1097,22 +1104,16 @@ export class Room extends ReadReceipt {
|
|
|
1097
1104
|
// We need to work out what threads we've just recieved receipts for, so we
|
|
1098
1105
|
// know which ones to update. If we've received an unthreaded receipt, we'll
|
|
1099
1106
|
// need to update all threads.
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
for (
|
|
1104
|
-
for (
|
|
1105
|
-
var _ref3 = _slicedToArray(_ref4, 2);
|
|
1106
|
-
var receiptType = _ref3[0];
|
|
1107
|
-
var userReceipt = _ref3[1];
|
|
1107
|
+
let threadIds = [];
|
|
1108
|
+
let hasUnthreadedReceipt = false;
|
|
1109
|
+
const content = event.getContent();
|
|
1110
|
+
for (const receiptGroup of Object.values(content)) {
|
|
1111
|
+
for (const [receiptType, userReceipt] of Object.entries(receiptGroup)) {
|
|
1108
1112
|
if (!utils.isSupportedReceiptType(receiptType)) continue;
|
|
1109
1113
|
if (!userReceipt) continue;
|
|
1110
|
-
for (
|
|
1111
|
-
var _ref6 = _slicedToArray(_ref7, 2);
|
|
1112
|
-
var userId = _ref6[0];
|
|
1113
|
-
var singleReceipt = _ref6[1];
|
|
1114
|
+
for (const [userId, singleReceipt] of Object.entries(userReceipt)) {
|
|
1114
1115
|
if (!singleReceipt || typeof singleReceipt !== "object") continue;
|
|
1115
|
-
|
|
1116
|
+
const typedSingleReceipt = singleReceipt;
|
|
1116
1117
|
if (userId !== this.client.getUserId()) continue;
|
|
1117
1118
|
if (typedSingleReceipt.thread_id === undefined) {
|
|
1118
1119
|
hasUnthreadedReceipt = true;
|
|
@@ -1129,30 +1130,28 @@ export class Room extends ReadReceipt {
|
|
|
1129
1130
|
threadIds = this.getThreads().filter(thread => this.getThreadUnreadNotificationCount(thread.id, NotificationCountType.Total) > 0 || this.getThreadUnreadNotificationCount(thread.id, NotificationCountType.Highlight) > 0).map(thread => thread.id);
|
|
1130
1131
|
threadIds.push("main");
|
|
1131
1132
|
}
|
|
1132
|
-
for (
|
|
1133
|
-
var _this$getThread;
|
|
1133
|
+
for (const threadId of threadIds) {
|
|
1134
1134
|
// Work backwards to determine how many events are unread. We also set
|
|
1135
1135
|
// a limit for how back we'll look to avoid spinning CPU for too long.
|
|
1136
1136
|
// If we hit the limit, we assume the count is unchanged.
|
|
1137
|
-
|
|
1138
|
-
|
|
1137
|
+
const maxHistory = 20;
|
|
1138
|
+
const timeline = threadId === "main" ? this.getLiveTimeline() : this.getThread(threadId)?.liveTimeline;
|
|
1139
1139
|
if (!timeline) {
|
|
1140
|
-
logger.warn(
|
|
1140
|
+
logger.warn(`Couldn't find timeline for thread ID ${threadId} in room ${this.roomId}`);
|
|
1141
1141
|
continue;
|
|
1142
1142
|
}
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
for (
|
|
1146
|
-
var _pushActions$tweaks;
|
|
1143
|
+
const events = timeline.getEvents();
|
|
1144
|
+
let highlightCount = 0;
|
|
1145
|
+
for (let i = events.length - 1; i >= 0; i--) {
|
|
1147
1146
|
if (i === events.length - maxHistory) return; // limit reached
|
|
1148
1147
|
|
|
1149
|
-
|
|
1150
|
-
if (this.hasUserReadEvent(this.client.getUserId(),
|
|
1148
|
+
const event = events[i];
|
|
1149
|
+
if (this.hasUserReadEvent(this.client.getUserId(), event.getId())) {
|
|
1151
1150
|
// If the user has read the event, then the counting is done.
|
|
1152
1151
|
break;
|
|
1153
1152
|
}
|
|
1154
|
-
|
|
1155
|
-
highlightCount += pushActions
|
|
1153
|
+
const pushActions = this.client.getPushActionsForEvent(event);
|
|
1154
|
+
highlightCount += pushActions?.tweaks?.highlight ? 1 : 0;
|
|
1156
1155
|
}
|
|
1157
1156
|
|
|
1158
1157
|
// Note: we don't need to handle 'total' notifications because the counts
|
|
@@ -1189,8 +1188,8 @@ export class Room extends ReadReceipt {
|
|
|
1189
1188
|
* the given event, or null if unknown
|
|
1190
1189
|
*/
|
|
1191
1190
|
getTimelineForEvent(eventId) {
|
|
1192
|
-
|
|
1193
|
-
|
|
1191
|
+
const event = this.findEventById(eventId);
|
|
1192
|
+
const thread = this.findThreadForEvent(event);
|
|
1194
1193
|
if (thread) {
|
|
1195
1194
|
return thread.timelineSet.getTimelineForEvent(eventId);
|
|
1196
1195
|
} else {
|
|
@@ -1232,11 +1231,11 @@ export class Room extends ReadReceipt {
|
|
|
1232
1231
|
* @returns the given event, or undefined if unknown
|
|
1233
1232
|
*/
|
|
1234
1233
|
findEventById(eventId) {
|
|
1235
|
-
|
|
1234
|
+
let event = this.getUnfilteredTimelineSet().findEventById(eventId);
|
|
1236
1235
|
if (!event) {
|
|
1237
|
-
|
|
1238
|
-
for (
|
|
1239
|
-
|
|
1236
|
+
const threads = this.getThreads();
|
|
1237
|
+
for (let i = 0; i < threads.length; i++) {
|
|
1238
|
+
const thread = threads[i];
|
|
1240
1239
|
event = thread.findEventById(eventId);
|
|
1241
1240
|
if (event) {
|
|
1242
1241
|
return event;
|
|
@@ -1252,12 +1251,10 @@ export class Room extends ReadReceipt {
|
|
|
1252
1251
|
* @returns The notification count, or undefined if there is no count
|
|
1253
1252
|
* for this type.
|
|
1254
1253
|
*/
|
|
1255
|
-
getUnreadNotificationCount() {
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
var _threadNotification$t;
|
|
1260
|
-
count += (_threadNotification$t = threadNotification[type]) !== null && _threadNotification$t !== void 0 ? _threadNotification$t : 0;
|
|
1254
|
+
getUnreadNotificationCount(type = NotificationCountType.Total) {
|
|
1255
|
+
let count = this.getRoomUnreadNotificationCount(type);
|
|
1256
|
+
for (const threadNotification of this.threadNotifications.values()) {
|
|
1257
|
+
count += threadNotification[type] ?? 0;
|
|
1261
1258
|
}
|
|
1262
1259
|
return count;
|
|
1263
1260
|
}
|
|
@@ -1265,12 +1262,9 @@ export class Room extends ReadReceipt {
|
|
|
1265
1262
|
/**
|
|
1266
1263
|
* Get the notification for the event context (room or thread timeline)
|
|
1267
1264
|
*/
|
|
1268
|
-
getUnreadCountForEventContext() {
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
var event = arguments.length > 1 ? arguments[1] : undefined;
|
|
1272
|
-
var isThreadEvent = !!event.threadRootId && !event.isThreadRoot;
|
|
1273
|
-
return (_ref8 = isThreadEvent ? this.getThreadUnreadNotificationCount(event.threadRootId, type) : this.getRoomUnreadNotificationCount(type)) !== null && _ref8 !== void 0 ? _ref8 : 0;
|
|
1265
|
+
getUnreadCountForEventContext(type = NotificationCountType.Total, event) {
|
|
1266
|
+
const isThreadEvent = !!event.threadRootId && !event.isThreadRoot;
|
|
1267
|
+
return (isThreadEvent ? this.getThreadUnreadNotificationCount(event.threadRootId, type) : this.getRoomUnreadNotificationCount(type)) ?? 0;
|
|
1274
1268
|
}
|
|
1275
1269
|
|
|
1276
1270
|
/**
|
|
@@ -1279,10 +1273,8 @@ export class Room extends ReadReceipt {
|
|
|
1279
1273
|
* @returns The notification count, or undefined if there is no count
|
|
1280
1274
|
* for this type.
|
|
1281
1275
|
*/
|
|
1282
|
-
getRoomUnreadNotificationCount() {
|
|
1283
|
-
|
|
1284
|
-
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : NotificationCountType.Total;
|
|
1285
|
-
return (_this$notificationCou = this.notificationCounts[type]) !== null && _this$notificationCou !== void 0 ? _this$notificationCou : 0;
|
|
1276
|
+
getRoomUnreadNotificationCount(type = NotificationCountType.Total) {
|
|
1277
|
+
return this.notificationCounts[type] ?? 0;
|
|
1286
1278
|
}
|
|
1287
1279
|
|
|
1288
1280
|
/**
|
|
@@ -1292,10 +1284,8 @@ export class Room extends ReadReceipt {
|
|
|
1292
1284
|
* @returns The notification count, or undefined if there is no count
|
|
1293
1285
|
* for this type.
|
|
1294
1286
|
*/
|
|
1295
|
-
getThreadUnreadNotificationCount(threadId) {
|
|
1296
|
-
|
|
1297
|
-
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NotificationCountType.Total;
|
|
1298
|
-
return (_this$threadNotificat = (_this$threadNotificat2 = this.threadNotifications.get(threadId)) === null || _this$threadNotificat2 === void 0 ? void 0 : _this$threadNotificat2[type]) !== null && _this$threadNotificat !== void 0 ? _this$threadNotificat : 0;
|
|
1287
|
+
getThreadUnreadNotificationCount(threadId, type = NotificationCountType.Total) {
|
|
1288
|
+
return this.threadNotifications.get(threadId)?.[type] ?? 0;
|
|
1299
1289
|
}
|
|
1300
1290
|
|
|
1301
1291
|
/**
|
|
@@ -1303,9 +1293,8 @@ export class Room extends ReadReceipt {
|
|
|
1303
1293
|
* @returns
|
|
1304
1294
|
*/
|
|
1305
1295
|
hasThreadUnreadNotification() {
|
|
1306
|
-
for (
|
|
1307
|
-
|
|
1308
|
-
if (((_notification$highlig = notification.highlight) !== null && _notification$highlig !== void 0 ? _notification$highlig : 0) > 0 || ((_notification$total = notification.total) !== null && _notification$total !== void 0 ? _notification$total : 0) > 0) {
|
|
1296
|
+
for (const notification of this.threadNotifications.values()) {
|
|
1297
|
+
if ((notification.highlight ?? 0) > 0 || (notification.total ?? 0) > 0) {
|
|
1309
1298
|
return true;
|
|
1310
1299
|
}
|
|
1311
1300
|
}
|
|
@@ -1319,13 +1308,11 @@ export class Room extends ReadReceipt {
|
|
|
1319
1308
|
* @returns
|
|
1320
1309
|
*/
|
|
1321
1310
|
setThreadUnreadNotificationCount(threadId, type, count) {
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
total: (_this$threadNotificat4 = this.threadNotifications.get(threadId)) === null || _this$threadNotificat4 === void 0 ? void 0 : _this$threadNotificat4.total
|
|
1326
|
-
}, {
|
|
1311
|
+
const notification = {
|
|
1312
|
+
highlight: this.threadNotifications.get(threadId)?.highlight,
|
|
1313
|
+
total: this.threadNotifications.get(threadId)?.total,
|
|
1327
1314
|
[type]: count
|
|
1328
|
-
}
|
|
1315
|
+
};
|
|
1329
1316
|
this.threadNotifications.set(threadId, notification);
|
|
1330
1317
|
this.emit(RoomEvent.UnreadNotifications, notification, threadId);
|
|
1331
1318
|
}
|
|
@@ -1334,12 +1321,11 @@ export class Room extends ReadReceipt {
|
|
|
1334
1321
|
* @returns the notification count type for all the threads in the room
|
|
1335
1322
|
*/
|
|
1336
1323
|
get threadsAggregateNotificationType() {
|
|
1337
|
-
|
|
1338
|
-
for (
|
|
1339
|
-
|
|
1340
|
-
if (((_threadNotification$h = threadNotification.highlight) !== null && _threadNotification$h !== void 0 ? _threadNotification$h : 0) > 0) {
|
|
1324
|
+
let type = null;
|
|
1325
|
+
for (const threadNotification of this.threadNotifications.values()) {
|
|
1326
|
+
if ((threadNotification.highlight ?? 0) > 0) {
|
|
1341
1327
|
return NotificationCountType.Highlight;
|
|
1342
|
-
} else if ((
|
|
1328
|
+
} else if ((threadNotification.total ?? 0) > 0 && !type) {
|
|
1343
1329
|
type = NotificationCountType.Total;
|
|
1344
1330
|
}
|
|
1345
1331
|
}
|
|
@@ -1360,13 +1346,9 @@ export class Room extends ReadReceipt {
|
|
|
1360
1346
|
*
|
|
1361
1347
|
* @param exceptThreadIds - The thread IDs to exclude from the reset.
|
|
1362
1348
|
*/
|
|
1363
|
-
resetThreadUnreadNotificationCountFromSync() {
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
for (var _ref1 of this.threadNotifications) {
|
|
1367
|
-
var _ref0 = _slicedToArray(_ref1, 2);
|
|
1368
|
-
var threadId = _ref0[0];
|
|
1369
|
-
var notifs = _ref0[1];
|
|
1349
|
+
resetThreadUnreadNotificationCountFromSync(exceptThreadIds = []) {
|
|
1350
|
+
const isEncrypted = this.hasEncryptionStateEvent();
|
|
1351
|
+
for (const [threadId, notifs] of this.threadNotifications) {
|
|
1370
1352
|
if (!exceptThreadIds.includes(threadId)) {
|
|
1371
1353
|
notifs.total = 0;
|
|
1372
1354
|
if (!isEncrypted) {
|
|
@@ -1414,13 +1396,12 @@ export class Room extends ReadReceipt {
|
|
|
1414
1396
|
* @param summary - The room summary to update the room with
|
|
1415
1397
|
*/
|
|
1416
1398
|
setSummary(summary) {
|
|
1417
|
-
|
|
1418
|
-
var heroes = (_summary$mHeroes = summary["m.heroes"]) === null || _summary$mHeroes === void 0 ? void 0 : _summary$mHeroes.map(h => ({
|
|
1399
|
+
const heroes = summary["m.heroes"]?.map(h => ({
|
|
1419
1400
|
userId: h,
|
|
1420
1401
|
fromMSC4186: false
|
|
1421
1402
|
}));
|
|
1422
|
-
|
|
1423
|
-
|
|
1403
|
+
const joinedCount = summary["m.joined_member_count"];
|
|
1404
|
+
const invitedCount = summary["m.invited_member_count"];
|
|
1424
1405
|
if (Number.isInteger(joinedCount)) {
|
|
1425
1406
|
this.currentState.setJoinedMemberCount(joinedCount);
|
|
1426
1407
|
}
|
|
@@ -1504,10 +1485,8 @@ export class Room extends ReadReceipt {
|
|
|
1504
1485
|
* implies allowRedirects. Defaults to false (unauthenticated endpoints).
|
|
1505
1486
|
* @returns the avatar URL or null.
|
|
1506
1487
|
*/
|
|
1507
|
-
getAvatarUrl(baseUrl, width, height, resizeMethod) {
|
|
1508
|
-
|
|
1509
|
-
var useAuthentication = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
1510
|
-
var mainUrl = this.getMxcAvatarUrl();
|
|
1488
|
+
getAvatarUrl(baseUrl, width, height, resizeMethod, allowDefault = true, useAuthentication = false) {
|
|
1489
|
+
const mainUrl = this.getMxcAvatarUrl();
|
|
1511
1490
|
if (!mainUrl && !allowDefault) {
|
|
1512
1491
|
return null;
|
|
1513
1492
|
}
|
|
@@ -1522,8 +1501,7 @@ export class Room extends ReadReceipt {
|
|
|
1522
1501
|
* @returns the mxc avatar url or falsy
|
|
1523
1502
|
*/
|
|
1524
1503
|
getMxcAvatarUrl() {
|
|
1525
|
-
|
|
1526
|
-
var url = (_this$currentState$ge = this.currentState.getStateEvents(EventType.RoomAvatar, "")) === null || _this$currentState$ge === void 0 ? void 0 : _this$currentState$ge.getContent().url;
|
|
1504
|
+
const url = this.currentState.getStateEvents(EventType.RoomAvatar, "")?.getContent().url;
|
|
1527
1505
|
return url && typeof url === "string" ? url : null;
|
|
1528
1506
|
}
|
|
1529
1507
|
|
|
@@ -1534,8 +1512,7 @@ export class Room extends ReadReceipt {
|
|
|
1534
1512
|
* @returns The room's canonical alias, or null if there is none
|
|
1535
1513
|
*/
|
|
1536
1514
|
getCanonicalAlias() {
|
|
1537
|
-
|
|
1538
|
-
var canonicalAlias = (_this$currentState$ge2 = this.currentState.getStateEvents(EventType.RoomCanonicalAlias, "")) === null || _this$currentState$ge2 === void 0 ? void 0 : _this$currentState$ge2.getContent().alias;
|
|
1515
|
+
const canonicalAlias = this.currentState.getStateEvents(EventType.RoomCanonicalAlias, "")?.getContent().alias;
|
|
1539
1516
|
return canonicalAlias && typeof canonicalAlias === "string" ? canonicalAlias : null;
|
|
1540
1517
|
}
|
|
1541
1518
|
|
|
@@ -1544,8 +1521,7 @@ export class Room extends ReadReceipt {
|
|
|
1544
1521
|
* @returns The room's alternative aliases, or an empty array
|
|
1545
1522
|
*/
|
|
1546
1523
|
getAltAliases() {
|
|
1547
|
-
|
|
1548
|
-
var altAliases = (_this$currentState$ge3 = this.currentState.getStateEvents(EventType.RoomCanonicalAlias, "")) === null || _this$currentState$ge3 === void 0 ? void 0 : _this$currentState$ge3.getContent().alt_aliases;
|
|
1524
|
+
const altAliases = this.currentState.getStateEvents(EventType.RoomCanonicalAlias, "")?.getContent().alt_aliases;
|
|
1549
1525
|
if (Array.isArray(altAliases)) {
|
|
1550
1526
|
return altAliases.filter(alias => typeof alias === "string");
|
|
1551
1527
|
}
|
|
@@ -1572,6 +1548,8 @@ export class Room extends ReadReceipt {
|
|
|
1572
1548
|
* Fires {@link RoomEvent.Timeline}
|
|
1573
1549
|
*/
|
|
1574
1550
|
addEventsToTimeline(events, toStartOfTimeline, addToState, timeline, paginationToken) {
|
|
1551
|
+
// ALWAYS filter out any events that are past retention
|
|
1552
|
+
events = events.filter(e => this.retention?.shouldEventBeRetained(e) ?? true);
|
|
1575
1553
|
timeline.getTimelineSet().addEventsToTimeline(events, toStartOfTimeline, addToState, timeline, paginationToken);
|
|
1576
1554
|
}
|
|
1577
1555
|
|
|
@@ -1581,8 +1559,7 @@ export class Room extends ReadReceipt {
|
|
|
1581
1559
|
* @returns a thread instance if known
|
|
1582
1560
|
*/
|
|
1583
1561
|
getThread(eventId) {
|
|
1584
|
-
|
|
1585
|
-
return (_this$threads$get = this.threads.get(eventId)) !== null && _this$threads$get !== void 0 ? _this$threads$get : null;
|
|
1562
|
+
return this.threads.get(eventId) ?? null;
|
|
1586
1563
|
}
|
|
1587
1564
|
|
|
1588
1565
|
/**
|
|
@@ -1661,16 +1638,13 @@ export class Room extends ReadReceipt {
|
|
|
1661
1638
|
* @returns A list of members who
|
|
1662
1639
|
* we should encrypt messages for in this room.
|
|
1663
1640
|
*/
|
|
1664
|
-
getEncryptionTargetMembers() {
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
}
|
|
1672
|
-
return members;
|
|
1673
|
-
})();
|
|
1641
|
+
async getEncryptionTargetMembers() {
|
|
1642
|
+
await this.loadMembersIfNeeded();
|
|
1643
|
+
let members = this.getMembersWithMembership(KnownMembership.Join);
|
|
1644
|
+
if (this.shouldEncryptForInvitedMembers()) {
|
|
1645
|
+
members = members.concat(this.getMembersWithMembership(KnownMembership.Invite));
|
|
1646
|
+
}
|
|
1647
|
+
return members;
|
|
1674
1648
|
}
|
|
1675
1649
|
|
|
1676
1650
|
/**
|
|
@@ -1678,9 +1652,8 @@ export class Room extends ReadReceipt {
|
|
|
1678
1652
|
* @returns if we should encrypt messages for invited users
|
|
1679
1653
|
*/
|
|
1680
1654
|
shouldEncryptForInvitedMembers() {
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
return (ev === null || ev === void 0 || (_ev$getContent = ev.getContent()) === null || _ev$getContent === void 0 ? void 0 : _ev$getContent.history_visibility) !== "joined";
|
|
1655
|
+
const ev = this.currentState.getStateEvents(EventType.RoomHistoryVisibility, "");
|
|
1656
|
+
return ev?.getContent()?.history_visibility !== "joined";
|
|
1684
1657
|
}
|
|
1685
1658
|
|
|
1686
1659
|
/**
|
|
@@ -1701,7 +1674,7 @@ export class Room extends ReadReceipt {
|
|
|
1701
1674
|
* @returns True if this user_id has the given membership state.
|
|
1702
1675
|
*/
|
|
1703
1676
|
hasMembershipState(userId, membership) {
|
|
1704
|
-
|
|
1677
|
+
const member = this.getMember(userId);
|
|
1705
1678
|
if (!member) {
|
|
1706
1679
|
return false;
|
|
1707
1680
|
}
|
|
@@ -1714,28 +1687,25 @@ export class Room extends ReadReceipt {
|
|
|
1714
1687
|
* @param opts - Configuration options
|
|
1715
1688
|
* @returns The timelineSet
|
|
1716
1689
|
*/
|
|
1717
|
-
getOrCreateFilteredTimelineSet(filter
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
useSyncEvents = _ref10$useSyncEvents === void 0 ? true : _ref10$useSyncEvents,
|
|
1723
|
-
_ref10$pendingEvents = _ref10.pendingEvents,
|
|
1724
|
-
pendingEvents = _ref10$pendingEvents === void 0 ? true : _ref10$pendingEvents;
|
|
1690
|
+
getOrCreateFilteredTimelineSet(filter, {
|
|
1691
|
+
prepopulateTimeline = true,
|
|
1692
|
+
useSyncEvents = true,
|
|
1693
|
+
pendingEvents = true
|
|
1694
|
+
} = {}) {
|
|
1725
1695
|
if (this.filteredTimelineSets[filter.filterId]) {
|
|
1726
1696
|
return this.filteredTimelineSets[filter.filterId];
|
|
1727
1697
|
}
|
|
1728
|
-
|
|
1698
|
+
const opts = Object.assign({
|
|
1729
1699
|
filter,
|
|
1730
1700
|
pendingEvents
|
|
1731
1701
|
}, this.opts);
|
|
1732
|
-
|
|
1702
|
+
const timelineSet = new EventTimelineSet(this, opts);
|
|
1733
1703
|
this.reEmitter.reEmit(timelineSet, [RoomEvent.Timeline, RoomEvent.TimelineReset]);
|
|
1734
1704
|
if (useSyncEvents) {
|
|
1735
1705
|
this.filteredTimelineSets[filter.filterId] = timelineSet;
|
|
1736
1706
|
this.timelineSets.push(timelineSet);
|
|
1737
1707
|
}
|
|
1738
|
-
|
|
1708
|
+
const unfilteredLiveTimeline = this.getLiveTimeline();
|
|
1739
1709
|
// Not all filter are possible to replicate client-side only
|
|
1740
1710
|
// When that's the case we do not want to prepopulate from the live timeline
|
|
1741
1711
|
// as we would get incorrect results compared to what the server would send back
|
|
@@ -1754,13 +1724,13 @@ export class Room extends ReadReceipt {
|
|
|
1754
1724
|
});
|
|
1755
1725
|
|
|
1756
1726
|
// find the earliest unfiltered timeline
|
|
1757
|
-
|
|
1727
|
+
let timeline = unfilteredLiveTimeline;
|
|
1758
1728
|
while (timeline.getNeighbouringTimeline(EventTimeline.BACKWARDS)) {
|
|
1759
1729
|
timeline = timeline.getNeighbouringTimeline(EventTimeline.BACKWARDS);
|
|
1760
1730
|
}
|
|
1761
1731
|
timelineSet.getLiveTimeline().setPaginationToken(timeline.getPaginationToken(EventTimeline.BACKWARDS), EventTimeline.BACKWARDS);
|
|
1762
1732
|
} else if (useSyncEvents) {
|
|
1763
|
-
|
|
1733
|
+
const livePaginationToken = unfilteredLiveTimeline.getPaginationToken(Direction.Forward);
|
|
1764
1734
|
timelineSet.getLiveTimeline().setPaginationToken(livePaginationToken, Direction.Backward);
|
|
1765
1735
|
}
|
|
1766
1736
|
|
|
@@ -1774,73 +1744,63 @@ export class Room extends ReadReceipt {
|
|
|
1774
1744
|
|
|
1775
1745
|
return timelineSet;
|
|
1776
1746
|
}
|
|
1777
|
-
getThreadListFilter() {
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
var definition = {
|
|
1785
|
-
room: {
|
|
1786
|
-
timeline: {
|
|
1787
|
-
[FILTER_RELATED_BY_REL_TYPES.name]: [THREAD_RELATION_TYPE.name]
|
|
1788
|
-
}
|
|
1747
|
+
async getThreadListFilter(filterType = ThreadFilterType.All) {
|
|
1748
|
+
const myUserId = this.client.getUserId();
|
|
1749
|
+
const filter = new Filter(myUserId);
|
|
1750
|
+
const definition = {
|
|
1751
|
+
room: {
|
|
1752
|
+
timeline: {
|
|
1753
|
+
[FILTER_RELATED_BY_REL_TYPES.name]: [THREAD_RELATION_TYPE.name]
|
|
1789
1754
|
}
|
|
1790
|
-
}
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
}
|
|
1800
|
-
createThreadTimelineSet(filterType) {
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1755
|
+
}
|
|
1756
|
+
};
|
|
1757
|
+
if (filterType === ThreadFilterType.My) {
|
|
1758
|
+
definition.room.timeline[FILTER_RELATED_BY_SENDERS.name] = [myUserId];
|
|
1759
|
+
}
|
|
1760
|
+
filter.setDefinition(definition);
|
|
1761
|
+
const filterId = await this.client.getOrCreateFilter(`THREAD_PANEL_${this.roomId}_${filterType}`, filter);
|
|
1762
|
+
filter.filterId = filterId;
|
|
1763
|
+
return filter;
|
|
1764
|
+
}
|
|
1765
|
+
async createThreadTimelineSet(filterType) {
|
|
1766
|
+
let timelineSet;
|
|
1767
|
+
if (Thread.hasServerSideListSupport) {
|
|
1768
|
+
timelineSet = new EventTimelineSet(this, _objectSpread(_objectSpread({}, this.opts), {}, {
|
|
1769
|
+
pendingEvents: false
|
|
1770
|
+
}), undefined, undefined, filterType ?? ThreadFilterType.All);
|
|
1771
|
+
this.reEmitter.reEmit(timelineSet, [RoomEvent.Timeline, RoomEvent.TimelineReset]);
|
|
1772
|
+
} else if (Thread.hasServerSideSupport) {
|
|
1773
|
+
const filter = await this.getThreadListFilter(filterType);
|
|
1774
|
+
timelineSet = this.getOrCreateFilteredTimelineSet(filter, {
|
|
1775
|
+
prepopulateTimeline: false,
|
|
1776
|
+
useSyncEvents: false,
|
|
1777
|
+
pendingEvents: false
|
|
1778
|
+
});
|
|
1779
|
+
} else {
|
|
1780
|
+
timelineSet = new EventTimelineSet(this, {
|
|
1781
|
+
pendingEvents: false
|
|
1782
|
+
});
|
|
1783
|
+
Array.from(this.threads).forEach(([, thread]) => {
|
|
1784
|
+
if (thread.length === 0) return;
|
|
1785
|
+
const currentUserParticipated = thread.timeline.some(event => {
|
|
1786
|
+
return event.getSender() === this.client.getUserId();
|
|
1819
1787
|
});
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
var currentUserParticipated = thread.timeline.some(event => {
|
|
1825
|
-
return event.getSender() === _this10.client.getUserId();
|
|
1788
|
+
if (filterType !== ThreadFilterType.My || currentUserParticipated) {
|
|
1789
|
+
timelineSet.getLiveTimeline().addEvent(thread.rootEvent, {
|
|
1790
|
+
toStartOfTimeline: false,
|
|
1791
|
+
addToState: false
|
|
1826
1792
|
});
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
});
|
|
1832
|
-
}
|
|
1833
|
-
});
|
|
1834
|
-
}
|
|
1835
|
-
return timelineSet;
|
|
1836
|
-
})();
|
|
1793
|
+
}
|
|
1794
|
+
});
|
|
1795
|
+
}
|
|
1796
|
+
return timelineSet;
|
|
1837
1797
|
}
|
|
1838
1798
|
/**
|
|
1839
1799
|
* Takes the given thread root events and creates threads for them.
|
|
1840
1800
|
*/
|
|
1841
1801
|
processThreadRoots(events, toStartOfTimeline) {
|
|
1842
1802
|
if (!this.client.supportsThreads()) return;
|
|
1843
|
-
for (
|
|
1803
|
+
for (const rootEvent of events) {
|
|
1844
1804
|
EventTimeline.setEventMetadata(rootEvent, this.currentState, toStartOfTimeline);
|
|
1845
1805
|
if (!this.getThread(rootEvent.getId())) {
|
|
1846
1806
|
this.createThread(rootEvent.getId(), rootEvent, [], toStartOfTimeline);
|
|
@@ -1853,61 +1813,57 @@ export class Room extends ReadReceipt {
|
|
|
1853
1813
|
* With server support that means fetching one page.
|
|
1854
1814
|
* Without server support that means fetching as much at once as the server allows us to.
|
|
1855
1815
|
*/
|
|
1856
|
-
fetchRoomThreads() {
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
var _this11$threadsTimeli2;
|
|
1896
|
-
(_this11$threadsTimeli2 = _this11.threadsTimelineSets[1]) === null || _this11$threadsTimeli2 === void 0 || _this11$threadsTimeli2.addLiveEvent(rootEvent, _opts);
|
|
1897
|
-
latestMyThreadsRootEvent = rootEvent;
|
|
1898
|
-
}
|
|
1899
|
-
}
|
|
1900
|
-
_this11.processThreadRoots(threadRoots, true);
|
|
1901
|
-
_this11.client.decryptEventIfNeeded(threadRoots[threadRoots.length - 1]);
|
|
1902
|
-
if (latestMyThreadsRootEvent) {
|
|
1903
|
-
_this11.client.decryptEventIfNeeded(latestMyThreadsRootEvent);
|
|
1816
|
+
async fetchRoomThreads() {
|
|
1817
|
+
if (this.threadsReady || !this.client.supportsThreads()) {
|
|
1818
|
+
return;
|
|
1819
|
+
}
|
|
1820
|
+
if (Thread.hasServerSideListSupport) {
|
|
1821
|
+
await Promise.all([this.fetchRoomThreadList(ThreadFilterType.All), this.fetchRoomThreadList(ThreadFilterType.My)]);
|
|
1822
|
+
} else {
|
|
1823
|
+
const allThreadsFilter = await this.getThreadListFilter();
|
|
1824
|
+
const {
|
|
1825
|
+
chunk: events
|
|
1826
|
+
} = await this.client.createMessagesRequest(this.roomId, "", Number.MAX_SAFE_INTEGER, Direction.Backward, allThreadsFilter);
|
|
1827
|
+
if (!events.length) return;
|
|
1828
|
+
|
|
1829
|
+
// Sorted by last_reply origin_server_ts
|
|
1830
|
+
const threadRoots = events.map(this.client.getEventMapper()).sort((eventA, eventB) => {
|
|
1831
|
+
/**
|
|
1832
|
+
* `origin_server_ts` in a decentralised world is far from ideal
|
|
1833
|
+
* but for lack of any better, we will have to use this
|
|
1834
|
+
* Long term the sorting should be handled by homeservers and this
|
|
1835
|
+
* is only meant as a short term patch
|
|
1836
|
+
*/
|
|
1837
|
+
const threadAMetadata = eventA.getServerAggregatedRelation(THREAD_RELATION_TYPE.name);
|
|
1838
|
+
const threadBMetadata = eventB.getServerAggregatedRelation(THREAD_RELATION_TYPE.name);
|
|
1839
|
+
return threadAMetadata.latest_event.origin_server_ts - threadBMetadata.latest_event.origin_server_ts;
|
|
1840
|
+
});
|
|
1841
|
+
let latestMyThreadsRootEvent;
|
|
1842
|
+
const roomState = this.getLiveTimeline().getState(EventTimeline.FORWARDS);
|
|
1843
|
+
for (const rootEvent of threadRoots) {
|
|
1844
|
+
const opts = {
|
|
1845
|
+
duplicateStrategy: DuplicateStrategy.Ignore,
|
|
1846
|
+
fromCache: false,
|
|
1847
|
+
addToState: false,
|
|
1848
|
+
roomState
|
|
1849
|
+
};
|
|
1850
|
+
this.threadsTimelineSets[0]?.addLiveEvent(rootEvent, opts);
|
|
1851
|
+
const threadRelationship = rootEvent.getServerAggregatedRelation(THREAD_RELATION_TYPE.name);
|
|
1852
|
+
if (threadRelationship?.current_user_participated) {
|
|
1853
|
+
this.threadsTimelineSets[1]?.addLiveEvent(rootEvent, opts);
|
|
1854
|
+
latestMyThreadsRootEvent = rootEvent;
|
|
1904
1855
|
}
|
|
1905
1856
|
}
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1857
|
+
this.processThreadRoots(threadRoots, true);
|
|
1858
|
+
this.client.decryptEventIfNeeded(threadRoots[threadRoots.length - 1]);
|
|
1859
|
+
if (latestMyThreadsRootEvent) {
|
|
1860
|
+
this.client.decryptEventIfNeeded(latestMyThreadsRootEvent);
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
this.on(ThreadEvent.NewReply, this.onThreadReply);
|
|
1864
|
+
this.on(ThreadEvent.Update, this.onThreadUpdate);
|
|
1865
|
+
this.on(ThreadEvent.Delete, this.onThreadDelete);
|
|
1866
|
+
this.threadsReady = true;
|
|
1911
1867
|
}
|
|
1912
1868
|
|
|
1913
1869
|
/**
|
|
@@ -1915,25 +1871,22 @@ export class Room extends ReadReceipt {
|
|
|
1915
1871
|
*
|
|
1916
1872
|
* @param events - List of events
|
|
1917
1873
|
*/
|
|
1918
|
-
processPollEvents(events) {
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
} catch (err) {
|
|
1933
|
-
logger.warn("Error processing poll event", event.getId(), err);
|
|
1934
|
-
}
|
|
1874
|
+
async processPollEvents(events) {
|
|
1875
|
+
for (const event of events) {
|
|
1876
|
+
try {
|
|
1877
|
+
// Continue if the event is a clear text, non-poll event.
|
|
1878
|
+
if (!event.isEncrypted() && !isPollEvent(event)) continue;
|
|
1879
|
+
|
|
1880
|
+
/**
|
|
1881
|
+
* Try to decrypt the event. Promise resolution does not guarantee a successful decryption.
|
|
1882
|
+
* Retry is handled in {@link processPollEvent}.
|
|
1883
|
+
*/
|
|
1884
|
+
await this.client.decryptEventIfNeeded(event);
|
|
1885
|
+
this.processPollEvent(event);
|
|
1886
|
+
} catch (err) {
|
|
1887
|
+
logger.warn("Error processing poll event", event.getId(), err);
|
|
1935
1888
|
}
|
|
1936
|
-
}
|
|
1889
|
+
}
|
|
1937
1890
|
}
|
|
1938
1891
|
|
|
1939
1892
|
/**
|
|
@@ -1946,95 +1899,69 @@ export class Room extends ReadReceipt {
|
|
|
1946
1899
|
*
|
|
1947
1900
|
* @param event - Event that could be a poll event
|
|
1948
1901
|
*/
|
|
1949
|
-
processPollEvent(event) {
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
_this13.polls.set(event.getId(), poll);
|
|
1962
|
-
_this13.emit(PollEvent.New, poll);
|
|
1902
|
+
async processPollEvent(event) {
|
|
1903
|
+
if (event.isDecryptionFailure()) {
|
|
1904
|
+
event.once(MatrixEventEvent.Decrypted, maybeDecryptedEvent => {
|
|
1905
|
+
this.processPollEvent(maybeDecryptedEvent);
|
|
1906
|
+
});
|
|
1907
|
+
return;
|
|
1908
|
+
}
|
|
1909
|
+
if (M_POLL_START.matches(event.getType())) {
|
|
1910
|
+
try {
|
|
1911
|
+
const poll = new Poll(event, this.client, this);
|
|
1912
|
+
this.polls.set(event.getId(), poll);
|
|
1913
|
+
this.emit(PollEvent.New, poll);
|
|
1963
1914
|
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
})();
|
|
1915
|
+
// remove the poll when redacted
|
|
1916
|
+
event.once(MatrixEventEvent.BeforeRedaction, redactedEvent => {
|
|
1917
|
+
this.polls.delete(redactedEvent.getId());
|
|
1918
|
+
});
|
|
1919
|
+
} catch {}
|
|
1920
|
+
// poll creation can fail for malformed poll start events
|
|
1921
|
+
return;
|
|
1922
|
+
}
|
|
1923
|
+
const relationEventId = event.relationEventId;
|
|
1924
|
+
if (relationEventId && this.polls.has(relationEventId)) {
|
|
1925
|
+
const poll = this.polls.get(relationEventId);
|
|
1926
|
+
poll?.onNewRelation(event);
|
|
1927
|
+
}
|
|
1978
1928
|
}
|
|
1979
1929
|
|
|
1980
1930
|
/**
|
|
1981
1931
|
* Fetch a single page of threadlist messages for the specific thread filter
|
|
1982
1932
|
* @internal
|
|
1983
1933
|
*/
|
|
1984
|
-
fetchRoomThreadList(filter) {
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
});
|
|
2005
|
-
}
|
|
2006
|
-
})();
|
|
2007
|
-
}
|
|
2008
|
-
onThreadUpdate(thread) {
|
|
2009
|
-
this.updateThreadRootEvents(thread, false, false);
|
|
2010
|
-
}
|
|
2011
|
-
onThreadReply(thread) {
|
|
2012
|
-
this.updateThreadRootEvents(thread, false, true);
|
|
2013
|
-
}
|
|
2014
|
-
onThreadDelete(thread) {
|
|
2015
|
-
var _timeline$getEvents;
|
|
2016
|
-
this.threads.delete(thread.id);
|
|
2017
|
-
var timeline = this.getTimelineForEvent(thread.id);
|
|
2018
|
-
var roomEvent = timeline === null || timeline === void 0 || (_timeline$getEvents = timeline.getEvents()) === null || _timeline$getEvents === void 0 ? void 0 : _timeline$getEvents.find(it => it.getId() === thread.id);
|
|
2019
|
-
if (roomEvent) {
|
|
2020
|
-
thread.clearEventMetadata(roomEvent);
|
|
2021
|
-
} else {
|
|
2022
|
-
logger.debug("onThreadDelete: Could not find root event in room timeline");
|
|
2023
|
-
}
|
|
2024
|
-
for (var timelineSet of this.threadsTimelineSets) {
|
|
2025
|
-
timelineSet.removeEvent(thread.id);
|
|
1934
|
+
async fetchRoomThreadList(filter) {
|
|
1935
|
+
if (!this.client.supportsThreads()) return;
|
|
1936
|
+
if (this.threadsTimelineSets.length === 0) return;
|
|
1937
|
+
const timelineSet = filter === ThreadFilterType.My ? this.threadsTimelineSets[1] : this.threadsTimelineSets[0];
|
|
1938
|
+
const {
|
|
1939
|
+
chunk: events,
|
|
1940
|
+
end
|
|
1941
|
+
} = await this.client.createThreadListMessagesRequest(this.roomId, null, undefined, Direction.Backward, timelineSet.threadListType, timelineSet.getFilter());
|
|
1942
|
+
timelineSet.getLiveTimeline().setPaginationToken(end ?? null, Direction.Backward);
|
|
1943
|
+
if (!events.length) return;
|
|
1944
|
+
const matrixEvents = events.map(this.client.getEventMapper());
|
|
1945
|
+
this.processThreadRoots(matrixEvents, true);
|
|
1946
|
+
const roomState = this.getLiveTimeline().getState(EventTimeline.FORWARDS);
|
|
1947
|
+
for (const rootEvent of matrixEvents) {
|
|
1948
|
+
timelineSet.addLiveEvent(rootEvent, {
|
|
1949
|
+
duplicateStrategy: DuplicateStrategy.Replace,
|
|
1950
|
+
fromCache: false,
|
|
1951
|
+
roomState,
|
|
1952
|
+
addToState: false
|
|
1953
|
+
});
|
|
2026
1954
|
}
|
|
2027
1955
|
}
|
|
2028
|
-
|
|
2029
1956
|
/**
|
|
2030
1957
|
* Forget the timelineSet for this room with the given filter
|
|
2031
1958
|
*
|
|
2032
1959
|
* @param filter - the filter whose timelineSet is to be forgotten
|
|
2033
1960
|
*/
|
|
2034
1961
|
removeFilteredTimelineSet(filter) {
|
|
2035
|
-
|
|
1962
|
+
const timelineSet = this.filteredTimelineSets[filter.filterId];
|
|
2036
1963
|
delete this.filteredTimelineSets[filter.filterId];
|
|
2037
|
-
|
|
1964
|
+
const i = this.timelineSets.indexOf(timelineSet);
|
|
2038
1965
|
if (i > -1) {
|
|
2039
1966
|
this.timelineSets.splice(i, 1);
|
|
2040
1967
|
}
|
|
@@ -2055,8 +1982,7 @@ export class Room extends ReadReceipt {
|
|
|
2055
1982
|
* This will change if MSC3389 is merged.
|
|
2056
1983
|
*/
|
|
2057
1984
|
eventShouldLiveIn(event, events, roots) {
|
|
2058
|
-
|
|
2059
|
-
if (!((_this$client = this.client) !== null && _this$client !== void 0 && _this$client.supportsThreads())) {
|
|
1985
|
+
if (!this.client?.supportsThreads()) {
|
|
2060
1986
|
return {
|
|
2061
1987
|
shouldLiveInRoom: true,
|
|
2062
1988
|
shouldLiveInThread: false
|
|
@@ -2064,28 +1990,27 @@ export class Room extends ReadReceipt {
|
|
|
2064
1990
|
}
|
|
2065
1991
|
|
|
2066
1992
|
// A thread root is the only event shown in both timelines
|
|
2067
|
-
if (event.isThreadRoot || roots
|
|
1993
|
+
if (event.isThreadRoot || roots?.has(event.getId())) {
|
|
2068
1994
|
return {
|
|
2069
1995
|
shouldLiveInRoom: true,
|
|
2070
1996
|
shouldLiveInThread: true,
|
|
2071
1997
|
threadId: event.getId()
|
|
2072
1998
|
};
|
|
2073
1999
|
}
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2000
|
+
const isThreadRelation = event.isRelation(THREAD_RELATION_TYPE.name);
|
|
2001
|
+
const parentEventId = event.getAssociatedId();
|
|
2002
|
+
const threadRootId = event.threadRootId;
|
|
2077
2003
|
|
|
2078
2004
|
// Where the parent is the thread root and this is a non-thread relation this should live only in the main timeline
|
|
2079
|
-
if (!!parentEventId && !isThreadRelation && (threadRootId === parentEventId || roots
|
|
2005
|
+
if (!!parentEventId && !isThreadRelation && (threadRootId === parentEventId || roots?.has(parentEventId))) {
|
|
2080
2006
|
return {
|
|
2081
2007
|
shouldLiveInRoom: true,
|
|
2082
2008
|
shouldLiveInThread: false
|
|
2083
2009
|
};
|
|
2084
2010
|
}
|
|
2085
|
-
|
|
2011
|
+
let parentEvent;
|
|
2086
2012
|
if (parentEventId) {
|
|
2087
|
-
|
|
2088
|
-
parentEvent = (_this$findEventById = this.findEventById(parentEventId)) !== null && _this$findEventById !== void 0 ? _this$findEventById : events === null || events === void 0 ? void 0 : events.find(e => e.getId() === parentEventId);
|
|
2013
|
+
parentEvent = this.findEventById(parentEventId) ?? events?.find(e => e.getId() === parentEventId);
|
|
2089
2014
|
}
|
|
2090
2015
|
|
|
2091
2016
|
// Treat non-thread-relations, redactions, and replies as extensions of their parents so evaluate parentEvent instead
|
|
@@ -2122,18 +2047,17 @@ export class Room extends ReadReceipt {
|
|
|
2122
2047
|
}
|
|
2123
2048
|
findThreadForEvent(event) {
|
|
2124
2049
|
if (!event) return null;
|
|
2125
|
-
|
|
2126
|
-
threadId
|
|
2050
|
+
const {
|
|
2051
|
+
threadId
|
|
2052
|
+
} = this.eventShouldLiveIn(event);
|
|
2127
2053
|
return threadId ? this.getThread(threadId) : null;
|
|
2128
2054
|
}
|
|
2129
|
-
addThreadedEvents(threadId, events) {
|
|
2130
|
-
|
|
2131
|
-
var thread = this.getThread(threadId);
|
|
2055
|
+
addThreadedEvents(threadId, events, toStartOfTimeline = false) {
|
|
2056
|
+
const thread = this.getThread(threadId);
|
|
2132
2057
|
if (thread) {
|
|
2133
2058
|
thread.addEvents(events, toStartOfTimeline);
|
|
2134
2059
|
} else {
|
|
2135
|
-
|
|
2136
|
-
var rootEvent = (_this$findEventById2 = this.findEventById(threadId)) !== null && _this$findEventById2 !== void 0 ? _this$findEventById2 : events.find(e => e.getId() === threadId);
|
|
2060
|
+
const rootEvent = this.findEventById(threadId) ?? events.find(e => e.getId() === threadId);
|
|
2137
2061
|
this.createThread(threadId, rootEvent, events, toStartOfTimeline);
|
|
2138
2062
|
}
|
|
2139
2063
|
}
|
|
@@ -2142,45 +2066,39 @@ export class Room extends ReadReceipt {
|
|
|
2142
2066
|
* Adds events to a thread's timeline. Will fire "Thread.update"
|
|
2143
2067
|
*/
|
|
2144
2068
|
processThreadedEvents(events, toStartOfTimeline) {
|
|
2069
|
+
// ALWAYS filter out any events that are past retention
|
|
2070
|
+
events = events.filter(e => this.retention?.shouldEventBeRetained(e) ?? true);
|
|
2145
2071
|
events.forEach(this.tryApplyRedaction);
|
|
2146
|
-
|
|
2147
|
-
for (
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2072
|
+
const eventsByThread = {};
|
|
2073
|
+
for (const event of events) {
|
|
2074
|
+
const {
|
|
2075
|
+
threadId,
|
|
2076
|
+
shouldLiveInThread
|
|
2077
|
+
} = this.eventShouldLiveIn(event);
|
|
2152
2078
|
if (shouldLiveInThread && !eventsByThread[threadId]) {
|
|
2153
2079
|
eventsByThread[threadId] = [];
|
|
2154
2080
|
}
|
|
2155
|
-
|
|
2081
|
+
eventsByThread[threadId]?.push(event);
|
|
2156
2082
|
}
|
|
2157
|
-
Object.entries(eventsByThread).map(
|
|
2158
|
-
var _ref14 = _slicedToArray(_ref13, 2),
|
|
2159
|
-
threadId = _ref14[0],
|
|
2160
|
-
threadEvents = _ref14[1];
|
|
2161
|
-
return this.addThreadedEvents(threadId, threadEvents, toStartOfTimeline);
|
|
2162
|
-
});
|
|
2083
|
+
Object.entries(eventsByThread).map(([threadId, threadEvents]) => this.addThreadedEvents(threadId, threadEvents, toStartOfTimeline));
|
|
2163
2084
|
}
|
|
2164
|
-
createThread(threadId, rootEvent) {
|
|
2165
|
-
var _this$cachedThreadRea;
|
|
2166
|
-
var events = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
2167
|
-
var toStartOfTimeline = arguments.length > 3 ? arguments[3] : undefined;
|
|
2085
|
+
createThread(threadId, rootEvent, events = [], toStartOfTimeline) {
|
|
2168
2086
|
if (this.threads.has(threadId)) {
|
|
2169
2087
|
return this.threads.get(threadId);
|
|
2170
2088
|
}
|
|
2171
2089
|
if (rootEvent) {
|
|
2172
|
-
|
|
2173
|
-
if (relatedEvents
|
|
2090
|
+
const relatedEvents = this.relations.getAllChildEventsForEvent(rootEvent.getId());
|
|
2091
|
+
if (relatedEvents?.length) {
|
|
2174
2092
|
// Include all relations of the root event, given it'll be visible in both timelines,
|
|
2175
2093
|
// except `m.replace` as that will already be applied atop the event using `MatrixEvent::makeReplaced`
|
|
2176
2094
|
events = events.concat(relatedEvents.filter(e => !e.isRelation(RelationType.Replace)));
|
|
2177
2095
|
}
|
|
2178
2096
|
}
|
|
2179
|
-
|
|
2097
|
+
const thread = new Thread(threadId, rootEvent, {
|
|
2180
2098
|
room: this,
|
|
2181
2099
|
client: this.client,
|
|
2182
2100
|
pendingEventOrdering: this.opts.pendingEventOrdering,
|
|
2183
|
-
receipts:
|
|
2101
|
+
receipts: this.cachedThreadReadReceipts.get(threadId) ?? []
|
|
2184
2102
|
});
|
|
2185
2103
|
|
|
2186
2104
|
// Add the re-emitter before we start adding events to the thread so we don't miss events
|
|
@@ -2221,13 +2139,13 @@ export class Room extends ReadReceipt {
|
|
|
2221
2139
|
* @private
|
|
2222
2140
|
*/
|
|
2223
2141
|
applyEventAsRedaction(redactionEvent, redactedEvent) {
|
|
2224
|
-
|
|
2142
|
+
const threadRootId = redactedEvent.threadRootId;
|
|
2225
2143
|
redactedEvent.makeRedacted(redactionEvent, this);
|
|
2226
2144
|
|
|
2227
2145
|
// If this is in the current state, replace it with the redacted version
|
|
2228
2146
|
if (redactedEvent.isState()) {
|
|
2229
|
-
|
|
2230
|
-
if (
|
|
2147
|
+
const currentStateEvent = this.currentState.getStateEvents(redactedEvent.getType(), redactedEvent.getStateKey());
|
|
2148
|
+
if (currentStateEvent?.getId() === redactedEvent.getId()) {
|
|
2231
2149
|
this.currentState.setStateEvents([redactedEvent]);
|
|
2232
2150
|
}
|
|
2233
2151
|
}
|
|
@@ -2265,17 +2183,14 @@ export class Room extends ReadReceipt {
|
|
|
2265
2183
|
// to check the event ID against the list of pending events if there is no transaction ID
|
|
2266
2184
|
// field. Only do this for events sent by us though as it's potentially expensive to loop
|
|
2267
2185
|
// the pending events map.
|
|
2268
|
-
|
|
2186
|
+
const txnId = event.getUnsigned().transaction_id;
|
|
2269
2187
|
if (!txnId && event.getSender() === this.myUserId) {
|
|
2270
2188
|
// check the txn map for a matching event ID
|
|
2271
|
-
for (
|
|
2272
|
-
var _ref16 = _slicedToArray(_ref17, 2);
|
|
2273
|
-
var tid = _ref16[0];
|
|
2274
|
-
var localEvent = _ref16[1];
|
|
2189
|
+
for (const [tid, localEvent] of this.txnToEvent) {
|
|
2275
2190
|
if (localEvent.getId() === event.getId()) {
|
|
2276
2191
|
logger.debug("processLiveEvent: found sent event without txn ID: ", tid, event.getId());
|
|
2277
2192
|
// update the unsigned field so we can re-use the same codepaths
|
|
2278
|
-
|
|
2193
|
+
const unsigned = event.getUnsigned();
|
|
2279
2194
|
unsigned.transaction_id = tid;
|
|
2280
2195
|
event.setUnsigned(unsigned);
|
|
2281
2196
|
break;
|
|
@@ -2296,13 +2211,15 @@ export class Room extends ReadReceipt {
|
|
|
2296
2211
|
* Fires {@link RoomEvent.Timeline}
|
|
2297
2212
|
*/
|
|
2298
2213
|
addLiveEvent(event, addLiveEventOptions) {
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2214
|
+
const {
|
|
2215
|
+
duplicateStrategy,
|
|
2216
|
+
timelineWasEmpty,
|
|
2217
|
+
fromCache,
|
|
2218
|
+
addToState
|
|
2219
|
+
} = addLiveEventOptions;
|
|
2303
2220
|
|
|
2304
2221
|
// add to our timeline sets
|
|
2305
|
-
for (
|
|
2222
|
+
for (const timelineSet of this.timelineSets) {
|
|
2306
2223
|
timelineSet.addLiveEvent(event, {
|
|
2307
2224
|
duplicateStrategy,
|
|
2308
2225
|
fromCache,
|
|
@@ -2372,8 +2289,8 @@ export class Room extends ReadReceipt {
|
|
|
2372
2289
|
this.aggregateNonLiveRelation(event);
|
|
2373
2290
|
}
|
|
2374
2291
|
if (event.isRedaction()) {
|
|
2375
|
-
|
|
2376
|
-
|
|
2292
|
+
const redactId = event.event.redacts;
|
|
2293
|
+
let redactedEvent = this.pendingEventList.find(e => e.getId() === redactId);
|
|
2377
2294
|
if (!redactedEvent && redactId) {
|
|
2378
2295
|
redactedEvent = this.findEventById(redactId);
|
|
2379
2296
|
}
|
|
@@ -2383,7 +2300,7 @@ export class Room extends ReadReceipt {
|
|
|
2383
2300
|
}
|
|
2384
2301
|
}
|
|
2385
2302
|
} else {
|
|
2386
|
-
for (
|
|
2303
|
+
for (const timelineSet of this.timelineSets) {
|
|
2387
2304
|
if (timelineSet.getFilter()) {
|
|
2388
2305
|
if (timelineSet.getFilter().filterRoomTimeline([event]).length) {
|
|
2389
2306
|
timelineSet.addEventToTimeline(event, timelineSet.getLiveTimeline(), {
|
|
@@ -2417,14 +2334,14 @@ export class Room extends ReadReceipt {
|
|
|
2417
2334
|
*/
|
|
2418
2335
|
savePendingEvents() {
|
|
2419
2336
|
if (this.pendingEventList) {
|
|
2420
|
-
|
|
2337
|
+
const pendingEvents = this.pendingEventList.map(event => {
|
|
2421
2338
|
return _objectSpread(_objectSpread({}, event.event), {}, {
|
|
2422
2339
|
txn_id: event.getTxnId()
|
|
2423
2340
|
});
|
|
2424
2341
|
}).filter(event => {
|
|
2425
2342
|
// Filter out the unencrypted messages if the room is encrypted
|
|
2426
|
-
|
|
2427
|
-
|
|
2343
|
+
const isEventEncrypted = event.type === EventType.RoomMessageEncrypted;
|
|
2344
|
+
const isRoomEncrypted = this.hasEncryptionStateEvent();
|
|
2428
2345
|
return isEventEncrypted || !isRoomEncrypted;
|
|
2429
2346
|
});
|
|
2430
2347
|
this.client.store.setPendingEvents(this.roomId, pendingEvents);
|
|
@@ -2465,10 +2382,10 @@ export class Room extends ReadReceipt {
|
|
|
2465
2382
|
* Fires {@link RoomEvent.LocalEchoUpdated}
|
|
2466
2383
|
*/
|
|
2467
2384
|
handleRemoteEcho(remoteEvent, localEvent) {
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
logger.debug(
|
|
2385
|
+
const oldEventId = localEvent.getId();
|
|
2386
|
+
const newEventId = remoteEvent.getId();
|
|
2387
|
+
const oldStatus = localEvent.status;
|
|
2388
|
+
logger.debug(`Got remote echo for event ${oldEventId} -> ${newEventId} old status ${oldStatus}`);
|
|
2472
2389
|
|
|
2473
2390
|
// no longer pending
|
|
2474
2391
|
this.txnToEvent.delete(remoteEvent.getUnsigned().transaction_id);
|
|
@@ -2481,14 +2398,15 @@ export class Room extends ReadReceipt {
|
|
|
2481
2398
|
// replace the event source (this will preserve the plaintext payload if
|
|
2482
2399
|
// any, which is good, because we don't want to try decoding it again).
|
|
2483
2400
|
localEvent.handleRemoteEcho(remoteEvent.event);
|
|
2484
|
-
|
|
2485
|
-
shouldLiveInRoom
|
|
2486
|
-
threadId
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
thread
|
|
2401
|
+
const {
|
|
2402
|
+
shouldLiveInRoom,
|
|
2403
|
+
threadId
|
|
2404
|
+
} = this.eventShouldLiveIn(remoteEvent);
|
|
2405
|
+
const thread = threadId ? this.getThread(threadId) : null;
|
|
2406
|
+
thread?.setEventMetadata(localEvent);
|
|
2407
|
+
thread?.timelineSet.handleRemoteEcho(localEvent, oldEventId, newEventId);
|
|
2490
2408
|
if (shouldLiveInRoom) {
|
|
2491
|
-
for (
|
|
2409
|
+
for (const timelineSet of this.timelineSets) {
|
|
2492
2410
|
// if it's already in the timeline, update the timeline map. If it's not, add it.
|
|
2493
2411
|
timelineSet.handleRemoteEcho(localEvent, oldEventId, newEventId);
|
|
2494
2412
|
}
|
|
@@ -2510,7 +2428,7 @@ export class Room extends ReadReceipt {
|
|
|
2510
2428
|
* Fires {@link RoomEvent.LocalEchoUpdated}
|
|
2511
2429
|
*/
|
|
2512
2430
|
updatePendingEvent(event, newStatus, newEventId) {
|
|
2513
|
-
logger.log(
|
|
2431
|
+
logger.log(`setting pendingEvent status to ${newStatus} in ${event.getRoomId()} ` + `event ID ${event.getId()} -> ${newEventId}`);
|
|
2514
2432
|
|
|
2515
2433
|
// if the message was sent, we expect an event id
|
|
2516
2434
|
if (newStatus == EventStatus.SENT && !newEventId) {
|
|
@@ -2519,18 +2437,18 @@ export class Room extends ReadReceipt {
|
|
|
2519
2437
|
|
|
2520
2438
|
// SENT races against /sync, so we have to special-case it.
|
|
2521
2439
|
if (newStatus == EventStatus.SENT) {
|
|
2522
|
-
|
|
2440
|
+
const timeline = this.getTimelineForEvent(newEventId);
|
|
2523
2441
|
if (timeline) {
|
|
2524
2442
|
// we've already received the event via the event stream.
|
|
2525
2443
|
// nothing more to do here, assuming the transaction ID was correctly matched.
|
|
2526
2444
|
// Let's check that.
|
|
2527
|
-
|
|
2528
|
-
|
|
2445
|
+
const remoteEvent = this.findEventById(newEventId);
|
|
2446
|
+
const remoteTxnId = remoteEvent?.getUnsigned().transaction_id;
|
|
2529
2447
|
if (!remoteTxnId && remoteEvent) {
|
|
2530
2448
|
// This code path is mostly relevant for the Sliding Sync proxy.
|
|
2531
2449
|
// The remote event did not contain a transaction ID, so we did not handle
|
|
2532
2450
|
// the remote echo yet. Handle it now.
|
|
2533
|
-
|
|
2451
|
+
const unsigned = remoteEvent.getUnsigned();
|
|
2534
2452
|
unsigned.transaction_id = event.getTxnId();
|
|
2535
2453
|
remoteEvent.setUnsigned(unsigned);
|
|
2536
2454
|
// the remote event is _already_ in the timeline, so we need to remove it so
|
|
@@ -2541,39 +2459,40 @@ export class Room extends ReadReceipt {
|
|
|
2541
2459
|
return;
|
|
2542
2460
|
}
|
|
2543
2461
|
}
|
|
2544
|
-
|
|
2545
|
-
|
|
2462
|
+
const oldStatus = event.status;
|
|
2463
|
+
const oldEventId = event.getId();
|
|
2546
2464
|
if (!oldStatus) {
|
|
2547
2465
|
throw new Error("updatePendingEventStatus called on an event which is not a local echo.");
|
|
2548
2466
|
}
|
|
2549
|
-
|
|
2550
|
-
if (!
|
|
2551
|
-
throw new Error(
|
|
2467
|
+
const allowed = ALLOWED_TRANSITIONS[oldStatus];
|
|
2468
|
+
if (!allowed?.includes(newStatus)) {
|
|
2469
|
+
throw new Error(`Invalid EventStatus transition ${oldStatus}->${newStatus}`);
|
|
2552
2470
|
}
|
|
2553
2471
|
event.setStatus(newStatus);
|
|
2554
2472
|
if (newStatus == EventStatus.SENT) {
|
|
2555
2473
|
// update the event id
|
|
2556
2474
|
event.replaceLocalEventId(newEventId);
|
|
2557
|
-
|
|
2558
|
-
shouldLiveInRoom
|
|
2559
|
-
threadId
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
thread
|
|
2475
|
+
const {
|
|
2476
|
+
shouldLiveInRoom,
|
|
2477
|
+
threadId
|
|
2478
|
+
} = this.eventShouldLiveIn(event);
|
|
2479
|
+
const thread = threadId ? this.getThread(threadId) : undefined;
|
|
2480
|
+
thread?.setEventMetadata(event);
|
|
2481
|
+
thread?.timelineSet.replaceEventId(oldEventId, newEventId);
|
|
2563
2482
|
if (shouldLiveInRoom) {
|
|
2564
2483
|
// if the event was already in the timeline (which will be the case if
|
|
2565
2484
|
// opts.pendingEventOrdering==chronological), we need to update the
|
|
2566
2485
|
// timeline map.
|
|
2567
|
-
for (
|
|
2486
|
+
for (const timelineSet of this.timelineSets) {
|
|
2568
2487
|
timelineSet.replaceEventId(oldEventId, newEventId);
|
|
2569
2488
|
}
|
|
2570
2489
|
}
|
|
2571
2490
|
} else if (newStatus == EventStatus.CANCELLED) {
|
|
2572
2491
|
// remove it from the pending event list, or the timeline.
|
|
2573
2492
|
if (this.pendingEventList) {
|
|
2574
|
-
|
|
2493
|
+
const removedEvent = this.getPendingEvent(oldEventId);
|
|
2575
2494
|
this.removePendingEvent(oldEventId);
|
|
2576
|
-
if (removedEvent
|
|
2495
|
+
if (removedEvent?.isRedaction()) {
|
|
2577
2496
|
this.revertRedactionLocalEcho(removedEvent);
|
|
2578
2497
|
}
|
|
2579
2498
|
}
|
|
@@ -2583,11 +2502,11 @@ export class Room extends ReadReceipt {
|
|
|
2583
2502
|
this.emit(RoomEvent.LocalEchoUpdated, event, this, oldEventId, oldStatus);
|
|
2584
2503
|
}
|
|
2585
2504
|
revertRedactionLocalEcho(redactionEvent) {
|
|
2586
|
-
|
|
2505
|
+
const redactId = redactionEvent.event.redacts;
|
|
2587
2506
|
if (!redactId) {
|
|
2588
2507
|
return;
|
|
2589
2508
|
}
|
|
2590
|
-
|
|
2509
|
+
const redactedEvent = this.getUnfilteredTimelineSet().findEventById(redactId);
|
|
2591
2510
|
if (redactedEvent) {
|
|
2592
2511
|
redactedEvent.unmarkLocallyRedacted();
|
|
2593
2512
|
// re-render after undoing redaction
|
|
@@ -2599,13 +2518,13 @@ export class Room extends ReadReceipt {
|
|
|
2599
2518
|
}
|
|
2600
2519
|
}
|
|
2601
2520
|
assertTimelineSetsAreLive() {
|
|
2602
|
-
for (
|
|
2603
|
-
|
|
2521
|
+
for (let i = 0; i < this.timelineSets.length; i++) {
|
|
2522
|
+
const liveTimeline = this.timelineSets[i].getLiveTimeline();
|
|
2604
2523
|
if (liveTimeline.getPaginationToken(EventTimeline.FORWARDS)) {
|
|
2605
2524
|
throw new Error("live timeline " + i + " is no longer live - it has a pagination token " + "(" + liveTimeline.getPaginationToken(EventTimeline.FORWARDS) + ")");
|
|
2606
2525
|
}
|
|
2607
2526
|
if (liveTimeline.getNeighbouringTimeline(EventTimeline.FORWARDS)) {
|
|
2608
|
-
throw new Error(
|
|
2527
|
+
throw new Error(`live timeline ${i} is no longer live - it has a neighbouring timeline`);
|
|
2609
2528
|
}
|
|
2610
2529
|
}
|
|
2611
2530
|
}
|
|
@@ -2619,102 +2538,100 @@ export class Room extends ReadReceipt {
|
|
|
2619
2538
|
* @param addLiveEventOptions - addLiveEvent options
|
|
2620
2539
|
* @throws If `duplicateStrategy` is not falsey, 'replace' or 'ignore'.
|
|
2621
2540
|
*/
|
|
2622
|
-
addLiveEvents(events, addLiveEventOptions) {
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2541
|
+
async addLiveEvents(events, addLiveEventOptions) {
|
|
2542
|
+
const {
|
|
2543
|
+
duplicateStrategy,
|
|
2544
|
+
fromCache,
|
|
2545
|
+
timelineWasEmpty = false,
|
|
2546
|
+
addToState
|
|
2547
|
+
} = addLiveEventOptions;
|
|
2548
|
+
if (duplicateStrategy && ["replace", "ignore"].indexOf(duplicateStrategy) === -1) {
|
|
2549
|
+
throw new Error("duplicateStrategy MUST be either 'replace' or 'ignore'");
|
|
2550
|
+
}
|
|
2551
|
+
|
|
2552
|
+
// ALWAYS filter out any events that are past retention
|
|
2553
|
+
events = events.filter(e => this.retention?.shouldEventBeRetained(e) ?? true);
|
|
2554
|
+
|
|
2555
|
+
// sanity check that the live timeline is still live
|
|
2556
|
+
this.assertTimelineSetsAreLive();
|
|
2557
|
+
const threadRoots = this.findThreadRoots(events);
|
|
2558
|
+
const eventsByThread = {};
|
|
2559
|
+
const options = {
|
|
2560
|
+
duplicateStrategy,
|
|
2561
|
+
fromCache,
|
|
2562
|
+
timelineWasEmpty,
|
|
2563
|
+
addToState
|
|
2564
|
+
};
|
|
2644
2565
|
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
continue; // we can skip adding the event to the timeline sets, it is already there
|
|
2657
|
-
}
|
|
2566
|
+
// List of extra events to check for being parents of any relations encountered
|
|
2567
|
+
const neighbouringEvents = [...events];
|
|
2568
|
+
for (const event of events) {
|
|
2569
|
+
// TODO: We should have a filter to say "only add state event types X Y Z to the timeline".
|
|
2570
|
+
this.processLiveEvent(event);
|
|
2571
|
+
if (event.getUnsigned().transaction_id) {
|
|
2572
|
+
const existingEvent = this.txnToEvent.get(event.getUnsigned().transaction_id);
|
|
2573
|
+
if (existingEvent) {
|
|
2574
|
+
// remote echo of an event we sent earlier
|
|
2575
|
+
this.handleRemoteEcho(event, existingEvent);
|
|
2576
|
+
continue; // we can skip adding the event to the timeline sets, it is already there
|
|
2658
2577
|
}
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
var _this15$eventShouldLi3 = _this15.eventShouldLiveIn(event, neighbouringEvents, threadRoots);
|
|
2675
|
-
shouldLiveInRoom = _this15$eventShouldLi3.shouldLiveInRoom;
|
|
2676
|
-
shouldLiveInThread = _this15$eventShouldLi3.shouldLiveInThread;
|
|
2677
|
-
var _this15$eventShouldLi4 = _this15$eventShouldLi3.threadId;
|
|
2678
|
-
threadId = _this15$eventShouldLi4 === void 0 ? "" : _this15$eventShouldLi4;
|
|
2679
|
-
} catch (e) {
|
|
2680
|
-
logger.error("Failed to load parent event of unhandled relation", e);
|
|
2578
|
+
}
|
|
2579
|
+
let {
|
|
2580
|
+
shouldLiveInRoom,
|
|
2581
|
+
shouldLiveInThread,
|
|
2582
|
+
threadId = ""
|
|
2583
|
+
} = this.eventShouldLiveIn(event, neighbouringEvents, threadRoots);
|
|
2584
|
+
if (!shouldLiveInThread && !shouldLiveInRoom && event.isRelation()) {
|
|
2585
|
+
try {
|
|
2586
|
+
const parentEvent = new MatrixEvent(await this.client.fetchRoomEvent(this.roomId, event.relationEventId));
|
|
2587
|
+
neighbouringEvents.push(parentEvent);
|
|
2588
|
+
if (parentEvent.threadRootId) {
|
|
2589
|
+
threadRoots.add(parentEvent.threadRootId);
|
|
2590
|
+
const unsigned = event.getUnsigned();
|
|
2591
|
+
unsigned[UNSIGNED_THREAD_ID_FIELD.name] = parentEvent.threadRootId;
|
|
2592
|
+
event.setUnsigned(unsigned);
|
|
2681
2593
|
}
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
} else if (!shouldLiveInThread && event.isRelation()) {
|
|
2690
|
-
_this15.relations.aggregateChildEvent(event);
|
|
2594
|
+
({
|
|
2595
|
+
shouldLiveInRoom,
|
|
2596
|
+
shouldLiveInThread,
|
|
2597
|
+
threadId = ""
|
|
2598
|
+
} = this.eventShouldLiveIn(event, neighbouringEvents, threadRoots));
|
|
2599
|
+
} catch (e) {
|
|
2600
|
+
logger.error("Failed to load parent event of unhandled relation", e);
|
|
2691
2601
|
}
|
|
2692
2602
|
}
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2603
|
+
if (shouldLiveInThread && !eventsByThread[threadId]) {
|
|
2604
|
+
eventsByThread[threadId] = [];
|
|
2605
|
+
}
|
|
2606
|
+
eventsByThread[threadId]?.push(event);
|
|
2607
|
+
if (shouldLiveInRoom) {
|
|
2608
|
+
this.addLiveEvent(event, options);
|
|
2609
|
+
} else if (!shouldLiveInThread && event.isRelation()) {
|
|
2610
|
+
this.relations.aggregateChildEvent(event);
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2613
|
+
Object.entries(eventsByThread).forEach(([threadId, threadEvents]) => {
|
|
2614
|
+
this.addThreadedEvents(threadId, threadEvents, false);
|
|
2615
|
+
});
|
|
2700
2616
|
}
|
|
2701
2617
|
partitionThreadedEvents(events) {
|
|
2702
2618
|
// Indices to the events array, for readability
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2619
|
+
const ROOM = 0;
|
|
2620
|
+
const THREAD = 1;
|
|
2621
|
+
const UNKNOWN_RELATION = 2;
|
|
2706
2622
|
if (this.client.supportsThreads()) {
|
|
2707
|
-
|
|
2623
|
+
const threadRoots = this.findThreadRoots(events);
|
|
2708
2624
|
return events.reduce((memo, event) => {
|
|
2709
|
-
|
|
2710
|
-
shouldLiveInRoom
|
|
2711
|
-
shouldLiveInThread
|
|
2712
|
-
threadId
|
|
2625
|
+
const {
|
|
2626
|
+
shouldLiveInRoom,
|
|
2627
|
+
shouldLiveInThread,
|
|
2628
|
+
threadId
|
|
2629
|
+
} = this.eventShouldLiveIn(event, events, threadRoots);
|
|
2713
2630
|
if (shouldLiveInRoom) {
|
|
2714
2631
|
memo[ROOM].push(event);
|
|
2715
2632
|
}
|
|
2716
2633
|
if (shouldLiveInThread) {
|
|
2717
|
-
event.setThreadId(threadId
|
|
2634
|
+
event.setThreadId(threadId ?? "");
|
|
2718
2635
|
memo[THREAD].push(event);
|
|
2719
2636
|
}
|
|
2720
2637
|
if (!shouldLiveInThread && !shouldLiveInRoom) {
|
|
@@ -2732,9 +2649,9 @@ export class Room extends ReadReceipt {
|
|
|
2732
2649
|
* Given some events, find the IDs of all the thread roots that are referred to by them.
|
|
2733
2650
|
*/
|
|
2734
2651
|
findThreadRoots(events) {
|
|
2735
|
-
|
|
2736
|
-
for (
|
|
2737
|
-
|
|
2652
|
+
const threadRoots = new Set();
|
|
2653
|
+
for (const event of events) {
|
|
2654
|
+
const threadRootId = event.threadRootId;
|
|
2738
2655
|
if (threadRootId != undefined) {
|
|
2739
2656
|
threadRoots.add(threadRootId);
|
|
2740
2657
|
}
|
|
@@ -2747,19 +2664,17 @@ export class Room extends ReadReceipt {
|
|
|
2747
2664
|
* @param event - The m.receipt event.
|
|
2748
2665
|
* @param synthetic - True if this event is implicit.
|
|
2749
2666
|
*/
|
|
2750
|
-
addReceipt(event) {
|
|
2751
|
-
|
|
2752
|
-
var content = event.getContent();
|
|
2667
|
+
addReceipt(event, synthetic = false) {
|
|
2668
|
+
const content = event.getContent();
|
|
2753
2669
|
this.roomReceipts.add(content, synthetic);
|
|
2754
2670
|
|
|
2755
2671
|
// TODO: delete the following code when it has been replaced by RoomReceipts
|
|
2756
2672
|
Object.keys(content).forEach(eventId => {
|
|
2757
2673
|
Object.keys(content[eventId]).forEach(receiptType => {
|
|
2758
2674
|
Object.keys(content[eventId][receiptType]).forEach(userId => {
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
var receiptDestination = receiptForMainTimeline ? this : this.threads.get((_receipt$thread_id = receipt.thread_id) !== null && _receipt$thread_id !== void 0 ? _receipt$thread_id : "");
|
|
2675
|
+
const receipt = content[eventId][receiptType][userId];
|
|
2676
|
+
const receiptForMainTimeline = !receipt.thread_id || receipt.thread_id === MAIN_ROOM_TIMELINE;
|
|
2677
|
+
const receiptDestination = receiptForMainTimeline ? this : this.threads.get(receipt.thread_id ?? "");
|
|
2763
2678
|
if (receiptDestination) {
|
|
2764
2679
|
receiptDestination.addReceiptToStructure(eventId, receiptType, userId, receipt, synthetic);
|
|
2765
2680
|
|
|
@@ -2777,18 +2692,17 @@ export class Room extends ReadReceipt {
|
|
|
2777
2692
|
// an event during the sync. More explanation at:
|
|
2778
2693
|
// https://github.com/matrix-org/matrix-js-sdk/issues/3684
|
|
2779
2694
|
if (!synthetic && this.client.isInitialSyncComplete() && userId === this.client.getUserId()) {
|
|
2780
|
-
|
|
2695
|
+
const lastEvent = receiptDestination.timeline[receiptDestination.timeline.length - 1];
|
|
2781
2696
|
if (lastEvent && eventId === lastEvent.getId() && userId === lastEvent.getSender()) {
|
|
2782
2697
|
receiptDestination.setUnread(NotificationCountType.Total, 0);
|
|
2783
2698
|
receiptDestination.setUnread(NotificationCountType.Highlight, 0);
|
|
2784
2699
|
}
|
|
2785
2700
|
}
|
|
2786
2701
|
} else {
|
|
2787
|
-
var _this$cachedThreadRea2;
|
|
2788
2702
|
// The thread does not exist locally, keep the read receipt
|
|
2789
2703
|
// in a cache locally, and re-apply the `addReceipt` logic
|
|
2790
2704
|
// when the thread is created
|
|
2791
|
-
this.cachedThreadReadReceipts.set(receipt.thread_id, [...(
|
|
2705
|
+
this.cachedThreadReadReceipts.set(receipt.thread_id, [...(this.cachedThreadReadReceipts.get(receipt.thread_id) ?? []), {
|
|
2792
2706
|
eventId,
|
|
2793
2707
|
receiptType,
|
|
2794
2708
|
userId,
|
|
@@ -2796,14 +2710,14 @@ export class Room extends ReadReceipt {
|
|
|
2796
2710
|
synthetic
|
|
2797
2711
|
}]);
|
|
2798
2712
|
}
|
|
2799
|
-
|
|
2713
|
+
const me = this.client.getUserId();
|
|
2800
2714
|
// Track the time of the current user's oldest threaded receipt in the room.
|
|
2801
2715
|
if (userId === me && !receiptForMainTimeline && receipt.ts < this.oldestThreadedReceiptTs) {
|
|
2802
2716
|
this.oldestThreadedReceiptTs = receipt.ts;
|
|
2803
2717
|
}
|
|
2804
2718
|
|
|
2805
2719
|
// Track each user's unthreaded read receipt.
|
|
2806
|
-
if (!receipt.thread_id && receipt.ts > (
|
|
2720
|
+
if (!receipt.thread_id && receipt.ts > (this.unthreadedReceipts.get(userId)?.ts ?? 0)) {
|
|
2807
2721
|
this.unthreadedReceipts.set(userId, receipt);
|
|
2808
2722
|
}
|
|
2809
2723
|
});
|
|
@@ -2821,7 +2735,7 @@ export class Room extends ReadReceipt {
|
|
|
2821
2735
|
* @param events - A list of events to process
|
|
2822
2736
|
*/
|
|
2823
2737
|
addEphemeralEvents(events) {
|
|
2824
|
-
for (
|
|
2738
|
+
for (const event of events) {
|
|
2825
2739
|
if (event.getType() === EventType.Typing) {
|
|
2826
2740
|
this.currentState.setTypingEvent(event);
|
|
2827
2741
|
} else if (event.getType() === EventType.Receipt) {
|
|
@@ -2835,7 +2749,7 @@ export class Room extends ReadReceipt {
|
|
|
2835
2749
|
* @param eventIds - A list of eventIds to remove.
|
|
2836
2750
|
*/
|
|
2837
2751
|
removeEvents(eventIds) {
|
|
2838
|
-
for (
|
|
2752
|
+
for (const eventId of eventIds) {
|
|
2839
2753
|
this.removeEvent(eventId);
|
|
2840
2754
|
}
|
|
2841
2755
|
}
|
|
@@ -2848,9 +2762,9 @@ export class Room extends ReadReceipt {
|
|
|
2848
2762
|
* @returns true if the event was removed from any of the room's timeline sets
|
|
2849
2763
|
*/
|
|
2850
2764
|
removeEvent(eventId) {
|
|
2851
|
-
|
|
2852
|
-
for (
|
|
2853
|
-
|
|
2765
|
+
let removedAny = false;
|
|
2766
|
+
for (const timelineSet of this.timelineSets) {
|
|
2767
|
+
const removed = timelineSet.removeEvent(eventId);
|
|
2854
2768
|
if (removed) {
|
|
2855
2769
|
if (removed.isRedaction()) {
|
|
2856
2770
|
this.revertRedactionLocalEcho(removed);
|
|
@@ -2872,14 +2786,14 @@ export class Room extends ReadReceipt {
|
|
|
2872
2786
|
recalculate() {
|
|
2873
2787
|
// set fake stripped state events if this is an invite room so logic remains
|
|
2874
2788
|
// consistent elsewhere.
|
|
2875
|
-
|
|
2789
|
+
const membershipEvent = this.currentState.getStateEvents(EventType.RoomMember, this.myUserId);
|
|
2876
2790
|
if (membershipEvent) {
|
|
2877
|
-
|
|
2791
|
+
const membership = membershipEvent.getContent().membership;
|
|
2878
2792
|
this.updateMyMembership(membership);
|
|
2879
2793
|
if (membership === KnownMembership.Invite) {
|
|
2880
|
-
|
|
2794
|
+
const strippedStateEvents = membershipEvent.getUnsigned().invite_room_state || [];
|
|
2881
2795
|
strippedStateEvents.forEach(strippedEvent => {
|
|
2882
|
-
|
|
2796
|
+
const existingEvent = this.currentState.getStateEvents(strippedEvent.type, strippedEvent.state_key);
|
|
2883
2797
|
if (!existingEvent) {
|
|
2884
2798
|
// set the fake stripped event instead
|
|
2885
2799
|
this.currentState.setStateEvents([new MatrixEvent({
|
|
@@ -2894,7 +2808,7 @@ export class Room extends ReadReceipt {
|
|
|
2894
2808
|
});
|
|
2895
2809
|
}
|
|
2896
2810
|
}
|
|
2897
|
-
|
|
2811
|
+
const oldName = this.name;
|
|
2898
2812
|
this.name = this.calculateRoomName(this.myUserId);
|
|
2899
2813
|
this.normalizedName = normalize(this.name);
|
|
2900
2814
|
this.summary = new RoomSummary(this.roomId, {
|
|
@@ -2931,12 +2845,12 @@ export class Room extends ReadReceipt {
|
|
|
2931
2845
|
* @param events - an array of account_data events to add
|
|
2932
2846
|
*/
|
|
2933
2847
|
addAccountData(events) {
|
|
2934
|
-
for (
|
|
2848
|
+
for (const event of events) {
|
|
2935
2849
|
if (event.getType() === "m.tag") {
|
|
2936
2850
|
this.addTags(event);
|
|
2937
2851
|
}
|
|
2938
|
-
|
|
2939
|
-
|
|
2852
|
+
const eventType = event.getType();
|
|
2853
|
+
const lastEvent = this.accountData.get(eventType);
|
|
2940
2854
|
this.accountData.set(eventType, event);
|
|
2941
2855
|
this.emit(RoomEvent.AccountData, event, this, lastEvent);
|
|
2942
2856
|
}
|
|
@@ -2990,6 +2904,8 @@ export class Room extends ReadReceipt {
|
|
|
2990
2904
|
*/
|
|
2991
2905
|
// eslint-disable-next-line
|
|
2992
2906
|
_unstable_addStickyEvents(events) {
|
|
2907
|
+
// ALWAYS filter out any events that are past retention
|
|
2908
|
+
events = events.filter(e => this.retention?.shouldEventBeRetained(e) ?? true);
|
|
2993
2909
|
return this.stickyEvents.addStickyEvents(events);
|
|
2994
2910
|
}
|
|
2995
2911
|
|
|
@@ -3008,10 +2924,10 @@ export class Room extends ReadReceipt {
|
|
|
3008
2924
|
* @returns true if the user should be permitted to issue invites for this room.
|
|
3009
2925
|
*/
|
|
3010
2926
|
canInvite(userId) {
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
2927
|
+
let canInvite = this.getMyMembership() === KnownMembership.Join;
|
|
2928
|
+
const powerLevelsEvent = this.currentState.getStateEvents(EventType.RoomPowerLevels, "");
|
|
2929
|
+
const powerLevels = powerLevelsEvent && powerLevelsEvent.getContent();
|
|
2930
|
+
const me = this.getMember(userId);
|
|
3015
2931
|
if (powerLevels && me && powerLevels.invite > me.powerLevel) {
|
|
3016
2932
|
canInvite = false;
|
|
3017
2933
|
}
|
|
@@ -3047,7 +2963,7 @@ export class Room extends ReadReceipt {
|
|
|
3047
2963
|
* @returns the type of the room.
|
|
3048
2964
|
*/
|
|
3049
2965
|
getType() {
|
|
3050
|
-
|
|
2966
|
+
const createEvent = this.currentState.getStateEvents(EventType.RoomCreate, "");
|
|
3051
2967
|
if (!createEvent) {
|
|
3052
2968
|
if (!this.getTypeWarning) {
|
|
3053
2969
|
logger.warn("[getType] Room " + this.roomId + " does not have an m.room.create event");
|
|
@@ -3100,9 +3016,8 @@ export class Room extends ReadReceipt {
|
|
|
3100
3016
|
* this predecessor comes from a RoomCreate event (rather than a
|
|
3101
3017
|
* RoomPredecessor, which has the optional via_servers property).
|
|
3102
3018
|
*/
|
|
3103
|
-
findPredecessor() {
|
|
3104
|
-
|
|
3105
|
-
var currentState = this.getLiveTimeline().getState(EventTimeline.FORWARDS);
|
|
3019
|
+
findPredecessor(msc3946ProcessDynamicPredecessor = false) {
|
|
3020
|
+
const currentState = this.getLiveTimeline().getState(EventTimeline.FORWARDS);
|
|
3106
3021
|
if (!currentState) {
|
|
3107
3022
|
return null;
|
|
3108
3023
|
}
|
|
@@ -3110,7 +3025,7 @@ export class Room extends ReadReceipt {
|
|
|
3110
3025
|
}
|
|
3111
3026
|
roomNameGenerator(state) {
|
|
3112
3027
|
if (this.client.roomNameGenerator) {
|
|
3113
|
-
|
|
3028
|
+
const name = this.client.roomNameGenerator(this.roomId, state);
|
|
3114
3029
|
if (name !== null) {
|
|
3115
3030
|
return name;
|
|
3116
3031
|
}
|
|
@@ -3121,13 +3036,13 @@ export class Room extends ReadReceipt {
|
|
|
3121
3036
|
case RoomNameType.Generated:
|
|
3122
3037
|
switch (state.subtype) {
|
|
3123
3038
|
case "Inviting":
|
|
3124
|
-
return
|
|
3039
|
+
return `Inviting ${memberNamesToRoomName(state.names, state.count)}`;
|
|
3125
3040
|
default:
|
|
3126
3041
|
return memberNamesToRoomName(state.names, state.count);
|
|
3127
3042
|
}
|
|
3128
3043
|
case RoomNameType.EmptyRoom:
|
|
3129
3044
|
if (state.oldName) {
|
|
3130
|
-
return
|
|
3045
|
+
return `Empty room (was ${state.oldName})`;
|
|
3131
3046
|
} else {
|
|
3132
3047
|
return "Empty room";
|
|
3133
3048
|
}
|
|
@@ -3143,11 +3058,9 @@ export class Room extends ReadReceipt {
|
|
|
3143
3058
|
* was no m.room.name event.
|
|
3144
3059
|
* @returns The calculated room name.
|
|
3145
3060
|
*/
|
|
3146
|
-
calculateRoomName(userId) {
|
|
3147
|
-
var ignoreRoomNameEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
3061
|
+
calculateRoomName(userId, ignoreRoomNameEvent = false) {
|
|
3148
3062
|
if (!ignoreRoomNameEvent) {
|
|
3149
|
-
|
|
3150
|
-
var name = (_this$currentState$ge4 = this.currentState.getStateEvents(EventType.RoomName, "")) === null || _this$currentState$ge4 === void 0 ? void 0 : _this$currentState$ge4.getContent().name;
|
|
3063
|
+
const name = this.currentState.getStateEvents(EventType.RoomName, "")?.getContent().name;
|
|
3151
3064
|
if (name && typeof name === "string") {
|
|
3152
3065
|
return this.roomNameGenerator({
|
|
3153
3066
|
type: RoomNameType.Actual,
|
|
@@ -3155,23 +3068,23 @@ export class Room extends ReadReceipt {
|
|
|
3155
3068
|
});
|
|
3156
3069
|
}
|
|
3157
3070
|
}
|
|
3158
|
-
|
|
3071
|
+
const alias = this.getCanonicalAlias();
|
|
3159
3072
|
if (alias) {
|
|
3160
3073
|
return this.roomNameGenerator({
|
|
3161
3074
|
type: RoomNameType.Actual,
|
|
3162
3075
|
name: alias
|
|
3163
3076
|
});
|
|
3164
3077
|
}
|
|
3165
|
-
|
|
3166
|
-
|
|
3078
|
+
const joinedMemberCount = this.currentState.getJoinedMemberCount();
|
|
3079
|
+
const invitedMemberCount = this.currentState.getInvitedMemberCount();
|
|
3167
3080
|
// -1 because these numbers include the syncing user
|
|
3168
|
-
|
|
3081
|
+
let inviteJoinCount = joinedMemberCount + invitedMemberCount - 1;
|
|
3169
3082
|
|
|
3170
3083
|
// get service members (e.g. helper bots) for exclusion
|
|
3171
|
-
|
|
3084
|
+
const excludedUserIds = this.getFunctionalMembers();
|
|
3172
3085
|
|
|
3173
3086
|
// get members from heroes that are NOT ourselves
|
|
3174
|
-
|
|
3087
|
+
let otherNames = [];
|
|
3175
3088
|
if (this.heroes) {
|
|
3176
3089
|
// if we have heroes, use those as the names
|
|
3177
3090
|
this.heroes.forEach(hero => {
|
|
@@ -3186,16 +3099,17 @@ export class Room extends ReadReceipt {
|
|
|
3186
3099
|
if (hero.displayName) {
|
|
3187
3100
|
otherNames.push(hero.displayName);
|
|
3188
3101
|
} else {
|
|
3189
|
-
|
|
3102
|
+
const member = this.getMember(hero.userId);
|
|
3190
3103
|
otherNames.push(member ? member.name : hero.userId);
|
|
3191
3104
|
}
|
|
3192
3105
|
});
|
|
3193
3106
|
} else {
|
|
3194
|
-
|
|
3107
|
+
let otherMembers = this.currentState.getMembers().filter(m => {
|
|
3195
3108
|
return m.userId !== userId && (m.membership === KnownMembership.Invite || m.membership === KnownMembership.Join);
|
|
3196
3109
|
});
|
|
3197
|
-
otherMembers = otherMembers.filter(
|
|
3198
|
-
|
|
3110
|
+
otherMembers = otherMembers.filter(({
|
|
3111
|
+
userId
|
|
3112
|
+
}) => {
|
|
3199
3113
|
// filter service members
|
|
3200
3114
|
if (excludedUserIds.includes(userId)) {
|
|
3201
3115
|
inviteJoinCount--;
|
|
@@ -3204,7 +3118,7 @@ export class Room extends ReadReceipt {
|
|
|
3204
3118
|
return true;
|
|
3205
3119
|
});
|
|
3206
3120
|
// make sure members have stable order
|
|
3207
|
-
|
|
3121
|
+
const collator = new Intl.Collator();
|
|
3208
3122
|
otherMembers.sort((a, b) => collator.compare(a.userId, b.userId));
|
|
3209
3123
|
// only 5 first members, immitate summaryHeroes
|
|
3210
3124
|
otherMembers = otherMembers.slice(0, 5);
|
|
@@ -3217,13 +3131,13 @@ export class Room extends ReadReceipt {
|
|
|
3217
3131
|
count: inviteJoinCount
|
|
3218
3132
|
});
|
|
3219
3133
|
}
|
|
3220
|
-
|
|
3134
|
+
const myMembership = this.getMyMembership();
|
|
3221
3135
|
// if I have created a room and invited people through
|
|
3222
3136
|
// 3rd party invites
|
|
3223
3137
|
if (myMembership == KnownMembership.Join) {
|
|
3224
|
-
|
|
3225
|
-
if (thirdPartyInvites
|
|
3226
|
-
|
|
3138
|
+
const thirdPartyInvites = this.currentState.getStateEvents(EventType.RoomThirdPartyInvite);
|
|
3139
|
+
if (thirdPartyInvites?.length) {
|
|
3140
|
+
const thirdPartyNames = thirdPartyInvites.map(i => {
|
|
3227
3141
|
return i.getContent().display_name;
|
|
3228
3142
|
});
|
|
3229
3143
|
return this.roomNameGenerator({
|
|
@@ -3236,14 +3150,14 @@ export class Room extends ReadReceipt {
|
|
|
3236
3150
|
}
|
|
3237
3151
|
|
|
3238
3152
|
// let's try to figure out who was here before
|
|
3239
|
-
|
|
3153
|
+
let leftNames = otherNames;
|
|
3240
3154
|
// if we didn't have heroes, try finding them in the room state
|
|
3241
3155
|
if (!leftNames.length) {
|
|
3242
3156
|
leftNames = this.currentState.getMembers().filter(m => {
|
|
3243
3157
|
return m.userId !== userId && m.membership !== KnownMembership.Invite && m.membership !== KnownMembership.Join;
|
|
3244
3158
|
}).map(m => m.name);
|
|
3245
3159
|
}
|
|
3246
|
-
|
|
3160
|
+
let oldName;
|
|
3247
3161
|
if (leftNames.length) {
|
|
3248
3162
|
oldName = this.roomNameGenerator({
|
|
3249
3163
|
type: RoomNameType.Generated,
|
|
@@ -3266,18 +3180,18 @@ export class Room extends ReadReceipt {
|
|
|
3266
3180
|
* patch it to reflect the visibility change and inform listeners.
|
|
3267
3181
|
*/
|
|
3268
3182
|
applyNewVisibilityEvent(event) {
|
|
3269
|
-
|
|
3183
|
+
const visibilityChange = event.asVisibilityChange();
|
|
3270
3184
|
if (!visibilityChange) {
|
|
3271
3185
|
// The event is ill-formed.
|
|
3272
3186
|
return;
|
|
3273
3187
|
}
|
|
3274
3188
|
|
|
3275
3189
|
// Ignore visibility change events that are not emitted by moderators.
|
|
3276
|
-
|
|
3190
|
+
const userId = event.getSender();
|
|
3277
3191
|
if (!userId) {
|
|
3278
3192
|
return;
|
|
3279
3193
|
}
|
|
3280
|
-
|
|
3194
|
+
const isPowerSufficient = EVENT_VISIBILITY_CHANGE_TYPE.name && this.currentState.maySendStateEvent(EVENT_VISIBILITY_CHANGE_TYPE.name, userId) || EVENT_VISIBILITY_CHANGE_TYPE.altName && this.currentState.maySendStateEvent(EVENT_VISIBILITY_CHANGE_TYPE.altName, userId);
|
|
3281
3195
|
if (!isPowerSufficient) {
|
|
3282
3196
|
// Powerlevel is insufficient.
|
|
3283
3197
|
return;
|
|
@@ -3287,7 +3201,7 @@ export class Room extends ReadReceipt {
|
|
|
3287
3201
|
// If the event is not in our timeline and we only receive it later,
|
|
3288
3202
|
// we may need to apply the visibility change at a later date.
|
|
3289
3203
|
|
|
3290
|
-
|
|
3204
|
+
const visibilityEventsOnOriginalEvent = this.visibilityEvents.get(visibilityChange.eventId);
|
|
3291
3205
|
if (visibilityEventsOnOriginalEvent) {
|
|
3292
3206
|
// It would be tempting to simply erase the latest visibility change
|
|
3293
3207
|
// but we need to record all of the changes in case the latest change
|
|
@@ -3296,10 +3210,10 @@ export class Room extends ReadReceipt {
|
|
|
3296
3210
|
// In practice, linear scans through `visibilityEvents` should be fast.
|
|
3297
3211
|
// However, to protect against a potential DoS attack, we limit the
|
|
3298
3212
|
// number of iterations in this loop.
|
|
3299
|
-
|
|
3300
|
-
|
|
3213
|
+
let index = visibilityEventsOnOriginalEvent.length - 1;
|
|
3214
|
+
const min = Math.max(0, visibilityEventsOnOriginalEvent.length - MAX_NUMBER_OF_VISIBILITY_EVENTS_TO_SCAN_THROUGH);
|
|
3301
3215
|
for (; index >= min; --index) {
|
|
3302
|
-
|
|
3216
|
+
const target = visibilityEventsOnOriginalEvent[index];
|
|
3303
3217
|
if (target.getTs() < event.getTs()) {
|
|
3304
3218
|
break;
|
|
3305
3219
|
}
|
|
@@ -3316,7 +3230,7 @@ export class Room extends ReadReceipt {
|
|
|
3316
3230
|
// Finally, let's check if the event is already in our timeline.
|
|
3317
3231
|
// If so, we need to patch it and inform listeners.
|
|
3318
3232
|
|
|
3319
|
-
|
|
3233
|
+
const originalEvent = this.findEventById(visibilityChange.eventId);
|
|
3320
3234
|
if (!originalEvent) {
|
|
3321
3235
|
return;
|
|
3322
3236
|
}
|
|
@@ -3327,16 +3241,16 @@ export class Room extends ReadReceipt {
|
|
|
3327
3241
|
if (!event.isVisibilityEvent) {
|
|
3328
3242
|
throw new Error("expected a visibility change event");
|
|
3329
3243
|
}
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3244
|
+
const relation = event.getRelation();
|
|
3245
|
+
const originalEventId = relation?.event_id;
|
|
3246
|
+
const visibilityEventsOnOriginalEvent = this.visibilityEvents.get(originalEventId);
|
|
3333
3247
|
if (!visibilityEventsOnOriginalEvent) {
|
|
3334
3248
|
// No visibility changes on the original event.
|
|
3335
3249
|
// In particular, this change event was not recorded,
|
|
3336
3250
|
// most likely because it was ill-formed.
|
|
3337
3251
|
return;
|
|
3338
3252
|
}
|
|
3339
|
-
|
|
3253
|
+
const index = visibilityEventsOnOriginalEvent.findIndex(change => change.getId() === event.getId());
|
|
3340
3254
|
if (index === -1) {
|
|
3341
3255
|
// This change event was not recorded, most likely because
|
|
3342
3256
|
// it was ill-formed.
|
|
@@ -3347,7 +3261,7 @@ export class Room extends ReadReceipt {
|
|
|
3347
3261
|
|
|
3348
3262
|
// If we removed the latest visibility change event, propagate changes.
|
|
3349
3263
|
if (index === visibilityEventsOnOriginalEvent.length) {
|
|
3350
|
-
|
|
3264
|
+
const originalEvent = this.findEventById(originalEventId);
|
|
3351
3265
|
if (!originalEvent) {
|
|
3352
3266
|
return;
|
|
3353
3267
|
}
|
|
@@ -3356,8 +3270,8 @@ export class Room extends ReadReceipt {
|
|
|
3356
3270
|
this.visibilityEvents.delete(originalEventId);
|
|
3357
3271
|
originalEvent.applyVisibilityEvent();
|
|
3358
3272
|
} else {
|
|
3359
|
-
|
|
3360
|
-
|
|
3273
|
+
const newEvent = visibilityEventsOnOriginalEvent[visibilityEventsOnOriginalEvent.length - 1];
|
|
3274
|
+
const newVisibility = newEvent.asVisibilityChange();
|
|
3361
3275
|
if (!newVisibility) {
|
|
3362
3276
|
// Event is ill-formed.
|
|
3363
3277
|
// This breaks our invariant.
|
|
@@ -3378,13 +3292,13 @@ export class Room extends ReadReceipt {
|
|
|
3378
3292
|
* change event.
|
|
3379
3293
|
*/
|
|
3380
3294
|
applyPendingVisibilityEvents(event) {
|
|
3381
|
-
|
|
3295
|
+
const visibilityEvents = this.visibilityEvents.get(event.getId());
|
|
3382
3296
|
if (!visibilityEvents || visibilityEvents.length == 0) {
|
|
3383
3297
|
// No pending visibility change in store.
|
|
3384
3298
|
return;
|
|
3385
3299
|
}
|
|
3386
|
-
|
|
3387
|
-
|
|
3300
|
+
const visibilityEvent = visibilityEvents[visibilityEvents.length - 1];
|
|
3301
|
+
const visibilityChange = visibilityEvent.asVisibilityChange();
|
|
3388
3302
|
if (!visibilityChange) {
|
|
3389
3303
|
return;
|
|
3390
3304
|
}
|
|
@@ -3448,8 +3362,8 @@ export class Room extends ReadReceipt {
|
|
|
3448
3362
|
*/
|
|
3449
3363
|
fixupNotifications(userId) {
|
|
3450
3364
|
super.fixupNotifications(userId);
|
|
3451
|
-
|
|
3452
|
-
for (
|
|
3365
|
+
const unreadThreads = this.getThreads().filter(thread => this.getThreadUnreadNotificationCount(thread.id, NotificationCountType.Total) > 0);
|
|
3366
|
+
for (const thread of unreadThreads) {
|
|
3453
3367
|
thread.fixupNotifications(userId);
|
|
3454
3368
|
}
|
|
3455
3369
|
}
|
|
@@ -3484,13 +3398,12 @@ export class Room extends ReadReceipt {
|
|
|
3484
3398
|
* will encrypt outgoing events).
|
|
3485
3399
|
*/
|
|
3486
3400
|
hasEncryptionStateEvent() {
|
|
3487
|
-
|
|
3488
|
-
return Boolean((_this$getLiveTimeline = this.getLiveTimeline().getState(EventTimeline.FORWARDS)) === null || _this$getLiveTimeline === void 0 ? void 0 : _this$getLiveTimeline.getStateEvents(EventType.RoomEncryption, ""));
|
|
3401
|
+
return Boolean(this.getLiveTimeline().getState(EventTimeline.FORWARDS)?.getStateEvents(EventType.RoomEncryption, ""));
|
|
3489
3402
|
}
|
|
3490
3403
|
}
|
|
3491
3404
|
|
|
3492
3405
|
// a map from current event status to a list of allowed next statuses
|
|
3493
|
-
|
|
3406
|
+
const ALLOWED_TRANSITIONS = {
|
|
3494
3407
|
[EventStatus.ENCRYPTING]: [EventStatus.SENDING, EventStatus.NOT_SENT, EventStatus.CANCELLED],
|
|
3495
3408
|
[EventStatus.SENDING]: [EventStatus.ENCRYPTING, EventStatus.QUEUED, EventStatus.NOT_SENT, EventStatus.SENT],
|
|
3496
3409
|
[EventStatus.QUEUED]: [EventStatus.SENDING, EventStatus.NOT_SENT, EventStatus.CANCELLED],
|
|
@@ -3498,7 +3411,7 @@ var ALLOWED_TRANSITIONS = {
|
|
|
3498
3411
|
[EventStatus.NOT_SENT]: [EventStatus.SENDING, EventStatus.QUEUED, EventStatus.CANCELLED],
|
|
3499
3412
|
[EventStatus.CANCELLED]: []
|
|
3500
3413
|
};
|
|
3501
|
-
export
|
|
3414
|
+
export let RoomNameType = /*#__PURE__*/function (RoomNameType) {
|
|
3502
3415
|
RoomNameType[RoomNameType["EmptyRoom"] = 0] = "EmptyRoom";
|
|
3503
3416
|
RoomNameType[RoomNameType["Generated"] = 1] = "Generated";
|
|
3504
3417
|
RoomNameType[RoomNameType["Actual"] = 2] = "Actual";
|
|
@@ -3506,19 +3419,19 @@ export var RoomNameType = /*#__PURE__*/function (RoomNameType) {
|
|
|
3506
3419
|
}({});
|
|
3507
3420
|
// Can be overriden by IMatrixClientCreateOpts::memberNamesToRoomNameFn
|
|
3508
3421
|
function memberNamesToRoomName(names, count) {
|
|
3509
|
-
|
|
3422
|
+
const countWithoutMe = count - 1;
|
|
3510
3423
|
if (!names.length) {
|
|
3511
3424
|
return "Empty room";
|
|
3512
3425
|
} else if (names.length === 1 && countWithoutMe <= 1) {
|
|
3513
3426
|
return names[0];
|
|
3514
3427
|
} else if (names.length === 2 && countWithoutMe <= 2) {
|
|
3515
|
-
return
|
|
3428
|
+
return `${names[0]} and ${names[1]}`;
|
|
3516
3429
|
} else {
|
|
3517
|
-
|
|
3430
|
+
const plural = countWithoutMe > 1;
|
|
3518
3431
|
if (plural) {
|
|
3519
|
-
return
|
|
3432
|
+
return `${names[0]} and ${countWithoutMe} others`;
|
|
3520
3433
|
} else {
|
|
3521
|
-
return
|
|
3434
|
+
return `${names[0]} and 1 other`;
|
|
3522
3435
|
}
|
|
3523
3436
|
}
|
|
3524
3437
|
}
|