@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 _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
|
|
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; }
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
6
3
|
/*
|
|
7
4
|
Copyright 2015 - 2023 The Matrix.org Foundation C.I.C.
|
|
8
5
|
|
|
@@ -49,13 +46,13 @@ import { KnownMembership } from "./@types/membership.js";
|
|
|
49
46
|
// beyond that and wedge forever, so we need to track how long we are willing
|
|
50
47
|
// to keep open the connection. This constant is *ADDED* to the timeout= value
|
|
51
48
|
// to determine the max time we're willing to wait.
|
|
52
|
-
|
|
49
|
+
const BUFFER_PERIOD_MS = 80 * 1000;
|
|
53
50
|
|
|
54
51
|
// Number of consecutive failed syncs that will lead to a syncState of ERROR as opposed
|
|
55
52
|
// to RECONNECTING. This is needed to inform the client of server issues when the
|
|
56
53
|
// keepAlive is successful but the server /sync fails.
|
|
57
|
-
|
|
58
|
-
export
|
|
54
|
+
const FAILED_SYNC_ERROR_THRESHOLD = 3;
|
|
55
|
+
export let SyncState = /*#__PURE__*/function (SyncState) {
|
|
59
56
|
/** Emitted after we try to sync more than `FAILED_SYNC_ERROR_THRESHOLD`
|
|
60
57
|
* times and are still failing. Or when we enounter a hard error like the
|
|
61
58
|
* token being invalid. */
|
|
@@ -79,18 +76,18 @@ export var SyncState = /*#__PURE__*/function (SyncState) {
|
|
|
79
76
|
// Room versions where "insertion", "batch", and "marker" events are controlled
|
|
80
77
|
// by power-levels. MSC2716 is supported in existing room versions but they
|
|
81
78
|
// should only have special meaning when the room creator sends them.
|
|
82
|
-
|
|
79
|
+
const MSC2716_ROOM_VERSIONS = ["org.matrix.msc2716v3"];
|
|
83
80
|
function getFilterName(userId, suffix) {
|
|
84
81
|
// scope this on the user ID because people may login on many accounts
|
|
85
82
|
// and they all need to be stored!
|
|
86
|
-
return
|
|
83
|
+
return `FILTER_SYNC_${userId}` + (suffix ? "_" + suffix : "");
|
|
87
84
|
}
|
|
88
85
|
|
|
89
86
|
/**
|
|
90
87
|
* Options passed into the constructor of SyncApi by MatrixClient
|
|
91
88
|
*/
|
|
92
89
|
|
|
93
|
-
export
|
|
90
|
+
export let SetPresence = /*#__PURE__*/function (SetPresence) {
|
|
94
91
|
SetPresence["Offline"] = "offline";
|
|
95
92
|
SetPresence["Online"] = "online";
|
|
96
93
|
SetPresence["Unavailable"] = "unavailable";
|
|
@@ -112,8 +109,6 @@ export function defaultSyncApiOpts(syncOpts) {
|
|
|
112
109
|
}, syncOpts);
|
|
113
110
|
}
|
|
114
111
|
export class SyncApi {
|
|
115
|
-
// flag set if the store needs to be cleared before we can start
|
|
116
|
-
|
|
117
112
|
/**
|
|
118
113
|
* Construct an entity which is able to sync with a homeserver.
|
|
119
114
|
* @param client - The matrix client instance to use.
|
|
@@ -122,35 +117,43 @@ export class SyncApi {
|
|
|
122
117
|
* @internal
|
|
123
118
|
*/
|
|
124
119
|
constructor(client, opts, syncOpts) {
|
|
125
|
-
|
|
120
|
+
_defineProperty(this, "opts", void 0);
|
|
121
|
+
_defineProperty(this, "syncOpts", void 0);
|
|
126
122
|
_defineProperty(this, "_peekRoom", null);
|
|
123
|
+
_defineProperty(this, "currentSyncRequest", void 0);
|
|
124
|
+
_defineProperty(this, "abortController", void 0);
|
|
127
125
|
_defineProperty(this, "syncState", null);
|
|
126
|
+
_defineProperty(this, "syncStateData", void 0);
|
|
128
127
|
// additional data (eg. error object for failed sync)
|
|
129
128
|
_defineProperty(this, "catchingUp", false);
|
|
130
129
|
_defineProperty(this, "running", false);
|
|
130
|
+
_defineProperty(this, "keepAliveTimer", void 0);
|
|
131
|
+
_defineProperty(this, "connectionReturnedResolvers", void 0);
|
|
131
132
|
_defineProperty(this, "notifEvents", []);
|
|
132
133
|
// accumulator of sync events in the current sync response
|
|
133
134
|
_defineProperty(this, "failedSyncCount", 0);
|
|
134
135
|
// Number of consecutive failed /sync requests
|
|
135
136
|
_defineProperty(this, "storeIsInvalid", false);
|
|
136
|
-
|
|
137
|
+
// flag set if the store needs to be cleared before we can start
|
|
138
|
+
_defineProperty(this, "presence", void 0);
|
|
139
|
+
_defineProperty(this, "getPushRules", async () => {
|
|
137
140
|
try {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
141
|
+
this.syncOpts.logger.debug("Getting push rules...");
|
|
142
|
+
const result = await this.client.getPushRules();
|
|
143
|
+
this.syncOpts.logger.debug("Got push rules");
|
|
144
|
+
this.client.pushRules = result;
|
|
142
145
|
} catch (err) {
|
|
143
|
-
|
|
144
|
-
if (
|
|
146
|
+
this.syncOpts.logger.error("Getting push rules failed", err);
|
|
147
|
+
if (this.shouldAbortSync(err)) return;
|
|
145
148
|
// wait for saved sync to complete before doing anything else,
|
|
146
149
|
// otherwise the sync state will end up being incorrect
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
return
|
|
150
|
+
this.syncOpts.logger.debug("Waiting for saved sync before retrying push rules...");
|
|
151
|
+
await this.recoverFromSyncStartupError(this.savedSyncPromise, err);
|
|
152
|
+
return this.getPushRules(); // try again
|
|
150
153
|
}
|
|
151
|
-
})
|
|
154
|
+
});
|
|
152
155
|
_defineProperty(this, "buildDefaultFilter", () => {
|
|
153
|
-
|
|
156
|
+
const filter = new Filter(this.client.credentials.userId);
|
|
154
157
|
if (this.client.canSupport.get(Feature.ThreadUnreadNotifications) !== ServerSupport.Unsupported) {
|
|
155
158
|
filter.setUnreadThreadNotifications(true);
|
|
156
159
|
}
|
|
@@ -176,51 +179,51 @@ export class SyncApi {
|
|
|
176
179
|
/**
|
|
177
180
|
* Preare sync filter options for the unstable MSC4429 user profile fields if enabled.
|
|
178
181
|
*/
|
|
179
|
-
_defineProperty(this, "prepareSyncFilterUserProfiles",
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
_this.opts.filter = _this.buildDefaultFilter();
|
|
182
|
+
_defineProperty(this, "prepareSyncFilterUserProfiles", async () => {
|
|
183
|
+
if (this.opts.unstableMSC4429SyncUserProfileFields?.length) {
|
|
184
|
+
this.syncOpts.logger.debug("Enabling EXPERIMENTAL user profiles on sync filter...");
|
|
185
|
+
if (!this.opts.filter) {
|
|
186
|
+
this.opts.filter = this.buildDefaultFilter();
|
|
185
187
|
}
|
|
186
|
-
|
|
188
|
+
this.opts.filter.setUnstableMSC4429SyncUserProfiles(this.opts.unstableMSC4429SyncUserProfileFields, await this.client.doesServerSupportUnstableFeature("org.matrix.msc4429.stable"));
|
|
187
189
|
}
|
|
188
|
-
})
|
|
189
|
-
_defineProperty(this, "storeClientOptions",
|
|
190
|
+
});
|
|
191
|
+
_defineProperty(this, "storeClientOptions", async () => {
|
|
190
192
|
try {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
193
|
+
this.syncOpts.logger.debug("Storing client options...");
|
|
194
|
+
await this.client.storeClientOptions();
|
|
195
|
+
this.syncOpts.logger.debug("Stored client options");
|
|
194
196
|
} catch (err) {
|
|
195
|
-
|
|
197
|
+
this.syncOpts.logger.error("Storing client options failed", err);
|
|
196
198
|
throw err;
|
|
197
199
|
}
|
|
198
|
-
})
|
|
199
|
-
_defineProperty(this, "getFilter",
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
if (
|
|
203
|
-
filter =
|
|
200
|
+
});
|
|
201
|
+
_defineProperty(this, "getFilter", async () => {
|
|
202
|
+
this.syncOpts.logger.debug("Getting filter...");
|
|
203
|
+
let filter;
|
|
204
|
+
if (this.opts.filter) {
|
|
205
|
+
filter = this.opts.filter;
|
|
204
206
|
} else {
|
|
205
|
-
filter =
|
|
207
|
+
filter = this.buildDefaultFilter();
|
|
206
208
|
}
|
|
207
|
-
|
|
209
|
+
let filterId;
|
|
208
210
|
try {
|
|
209
|
-
filterId =
|
|
211
|
+
filterId = await this.client.getOrCreateFilter(getFilterName(this.client.credentials.userId), filter);
|
|
210
212
|
} catch (err) {
|
|
211
|
-
|
|
212
|
-
if (
|
|
213
|
+
this.syncOpts.logger.error("Getting filter failed", err);
|
|
214
|
+
if (this.shouldAbortSync(err)) return {};
|
|
213
215
|
// wait for saved sync to complete before doing anything else,
|
|
214
216
|
// otherwise the sync state will end up being incorrect
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
return
|
|
217
|
+
this.syncOpts.logger.debug("Waiting for saved sync before retrying filter...");
|
|
218
|
+
await this.recoverFromSyncStartupError(this.savedSyncPromise, err);
|
|
219
|
+
return this.getFilter(); // try again
|
|
218
220
|
}
|
|
219
221
|
return {
|
|
220
222
|
filter,
|
|
221
223
|
filterId
|
|
222
224
|
};
|
|
223
|
-
})
|
|
225
|
+
});
|
|
226
|
+
_defineProperty(this, "savedSyncPromise", void 0);
|
|
224
227
|
/**
|
|
225
228
|
* Event handler for the 'online' event
|
|
226
229
|
* This event is generally unreliable and precise behaviour
|
|
@@ -239,7 +242,7 @@ export class SyncApi {
|
|
|
239
242
|
}
|
|
240
243
|
}
|
|
241
244
|
createRoom(roomId) {
|
|
242
|
-
|
|
245
|
+
const room = _createAndReEmitRoom(this.client, roomId, this.opts);
|
|
243
246
|
room.on(RoomStateEvent.Marker, (markerEvent, markerFoundOptions) => {
|
|
244
247
|
this.onMarkerStateEvent(room, markerEvent, markerFoundOptions);
|
|
245
248
|
});
|
|
@@ -255,19 +258,19 @@ export class SyncApi {
|
|
|
255
258
|
* @param setStateOptions - When `timelineWasEmpty` is set
|
|
256
259
|
* as `true`, the given marker event will be ignored
|
|
257
260
|
*/
|
|
258
|
-
onMarkerStateEvent(room, markerEvent
|
|
259
|
-
|
|
260
|
-
|
|
261
|
+
onMarkerStateEvent(room, markerEvent, {
|
|
262
|
+
timelineWasEmpty
|
|
263
|
+
} = {}) {
|
|
261
264
|
// We don't need to refresh the timeline if it was empty before the
|
|
262
265
|
// marker arrived. This could be happen in a variety of cases:
|
|
263
266
|
// 1. From the initial sync
|
|
264
267
|
// 2. If it's from the first state we're seeing after joining the room
|
|
265
268
|
// 3. Or whether it's coming from `syncFromCache`
|
|
266
269
|
if (timelineWasEmpty) {
|
|
267
|
-
this.syncOpts.logger.debug(
|
|
270
|
+
this.syncOpts.logger.debug(`MarkerState: Ignoring markerEventId=${markerEvent.getId()} in roomId=${room.roomId} ` + `because the timeline was empty before the marker arrived which means there is nothing to refresh.`);
|
|
268
271
|
return;
|
|
269
272
|
}
|
|
270
|
-
|
|
273
|
+
const isValidMsc2716Event =
|
|
271
274
|
// Check whether the room version directly supports MSC2716, in
|
|
272
275
|
// which case, "marker" events are already auth'ed by
|
|
273
276
|
// power_levels
|
|
@@ -292,11 +295,11 @@ export class SyncApi {
|
|
|
292
295
|
if (isValidMsc2716Event) {
|
|
293
296
|
// Saw new marker event, let's let the clients know they should
|
|
294
297
|
// refresh the timeline.
|
|
295
|
-
this.syncOpts.logger.debug(
|
|
298
|
+
this.syncOpts.logger.debug(`MarkerState: Timeline needs to be refreshed because ` + `a new markerEventId=${markerEvent.getId()} was sent in roomId=${room.roomId}`);
|
|
296
299
|
room.setTimelineNeedsRefresh(true);
|
|
297
300
|
room.emit(RoomEvent.HistoryImportedWithinTimeline, markerEvent, room);
|
|
298
301
|
} else {
|
|
299
|
-
this.syncOpts.logger.debug(
|
|
302
|
+
this.syncOpts.logger.debug(`MarkerState: Ignoring markerEventId=${markerEvent.getId()} in roomId=${room.roomId} because ` + `MSC2716 is not supported in the room version or for any room version, the marker wasn't sent ` + `by the room creator.`);
|
|
300
303
|
}
|
|
301
304
|
}
|
|
302
305
|
|
|
@@ -304,67 +307,59 @@ export class SyncApi {
|
|
|
304
307
|
* Sync rooms the user has left.
|
|
305
308
|
* @returns Resolved when they've been added to the store.
|
|
306
309
|
*/
|
|
307
|
-
syncLeftRooms() {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
310
|
+
async syncLeftRooms() {
|
|
311
|
+
const client = this.client;
|
|
312
|
+
|
|
313
|
+
// grab a filter with limit=1 and include_leave=true
|
|
314
|
+
const filter = new Filter(this.client.credentials.userId);
|
|
315
|
+
filter.setTimelineLimit(1);
|
|
316
|
+
filter.setIncludeLeaveRooms(true);
|
|
317
|
+
const localTimeoutMs = this.opts.pollTimeout + BUFFER_PERIOD_MS;
|
|
318
|
+
const filterId = await client.getOrCreateFilter(getFilterName(client.credentials.userId, "LEFT_ROOMS"), filter);
|
|
319
|
+
const qps = {
|
|
320
|
+
"timeout": 0,
|
|
321
|
+
// don't want to block since this is a single isolated req
|
|
322
|
+
"filter": filterId,
|
|
323
|
+
"org.matrix.msc4222.use_state_after": true
|
|
324
|
+
};
|
|
325
|
+
const data = await client.http.authedRequest(Method.Get, "/sync", qps, undefined, {
|
|
326
|
+
localTimeoutMs
|
|
327
|
+
});
|
|
328
|
+
let leaveRooms = [];
|
|
329
|
+
if (data.rooms?.leave) {
|
|
330
|
+
leaveRooms = this.mapSyncResponseToRoomArray(data.rooms.leave);
|
|
331
|
+
}
|
|
332
|
+
const rooms = await Promise.all(leaveRooms.map(async leaveObj => {
|
|
333
|
+
const room = leaveObj.room;
|
|
334
|
+
if (!leaveObj.isBrandNewRoom) {
|
|
335
|
+
// the intention behind syncLeftRooms is to add in rooms which were
|
|
336
|
+
// *omitted* from the initial /sync. Rooms the user were joined to
|
|
337
|
+
// but then left whilst the app is running will appear in this list
|
|
338
|
+
// and we do not want to bother with them since they will have the
|
|
339
|
+
// current state already (and may get dupe messages if we add
|
|
340
|
+
// yet more timeline events!), so skip them.
|
|
341
|
+
// NB: When we persist rooms to localStorage this will be more
|
|
342
|
+
// complicated...
|
|
343
|
+
return;
|
|
331
344
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
// set the back-pagination token. Do this *before* adding any
|
|
352
|
-
// events so that clients can start back-paginating.
|
|
353
|
-
room.getLiveTimeline().setPaginationToken(leaveObj.timeline.prev_batch, EventTimeline.BACKWARDS);
|
|
354
|
-
var _yield$_this2$mapAndI = yield _this2.mapAndInjectRoomEvents(leaveObj),
|
|
355
|
-
timelineEvents = _yield$_this2$mapAndI.timelineEvents;
|
|
356
|
-
room.recalculate();
|
|
357
|
-
client.store.storeRoom(room);
|
|
358
|
-
client.emit(ClientEvent.Room, room);
|
|
359
|
-
_this2.processEventsForNotifs(room, timelineEvents);
|
|
360
|
-
return room;
|
|
361
|
-
});
|
|
362
|
-
return function (_x) {
|
|
363
|
-
return _ref6.apply(this, arguments);
|
|
364
|
-
};
|
|
365
|
-
}()));
|
|
366
|
-
return rooms.filter(Boolean);
|
|
367
|
-
})();
|
|
345
|
+
leaveObj.timeline = leaveObj.timeline || {
|
|
346
|
+
prev_batch: null,
|
|
347
|
+
events: []
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
// set the back-pagination token. Do this *before* adding any
|
|
351
|
+
// events so that clients can start back-paginating.
|
|
352
|
+
room.getLiveTimeline().setPaginationToken(leaveObj.timeline.prev_batch, EventTimeline.BACKWARDS);
|
|
353
|
+
const {
|
|
354
|
+
timelineEvents
|
|
355
|
+
} = await this.mapAndInjectRoomEvents(leaveObj);
|
|
356
|
+
room.recalculate();
|
|
357
|
+
client.store.storeRoom(room);
|
|
358
|
+
client.emit(ClientEvent.Room, room);
|
|
359
|
+
this.processEventsForNotifs(room, timelineEvents);
|
|
360
|
+
return room;
|
|
361
|
+
}));
|
|
362
|
+
return rooms.filter(Boolean);
|
|
368
363
|
}
|
|
369
364
|
|
|
370
365
|
/**
|
|
@@ -375,17 +370,14 @@ export class SyncApi {
|
|
|
375
370
|
* @returns A promise which resolves once the room has been added to the
|
|
376
371
|
* store.
|
|
377
372
|
*/
|
|
378
|
-
peek(roomId) {
|
|
379
|
-
|
|
380
|
-
var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 20;
|
|
381
|
-
if (((_this$_peekRoom = this._peekRoom) === null || _this$_peekRoom === void 0 ? void 0 : _this$_peekRoom.roomId) === roomId) {
|
|
373
|
+
peek(roomId, limit = 20) {
|
|
374
|
+
if (this._peekRoom?.roomId === roomId) {
|
|
382
375
|
return Promise.resolve(this._peekRoom);
|
|
383
376
|
}
|
|
384
|
-
|
|
377
|
+
const client = this.client;
|
|
385
378
|
this._peekRoom = this.createRoom(roomId);
|
|
386
379
|
return this.client.roomInitialSync(roomId, limit).then(response => {
|
|
387
|
-
|
|
388
|
-
if (((_this$_peekRoom2 = this._peekRoom) === null || _this$_peekRoom2 === void 0 ? void 0 : _this$_peekRoom2.roomId) !== roomId) {
|
|
380
|
+
if (this._peekRoom?.roomId !== roomId) {
|
|
389
381
|
throw new Error("Peeking aborted");
|
|
390
382
|
}
|
|
391
383
|
|
|
@@ -398,15 +390,15 @@ export class SyncApi {
|
|
|
398
390
|
|
|
399
391
|
// FIXME: Mostly duplicated from injectRoomEvents but not entirely
|
|
400
392
|
// because "state" in this API is at the BEGINNING of the chunk
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
393
|
+
const oldStateEvents = deepCopy(response.state).map(client.getEventMapper());
|
|
394
|
+
const stateEvents = response.state.map(client.getEventMapper());
|
|
395
|
+
const messages = response.messages.chunk.map(client.getEventMapper());
|
|
404
396
|
|
|
405
397
|
// XXX: copypasted from /sync until we kill off this minging v1 API stuff)
|
|
406
398
|
// handle presence events (User objects)
|
|
407
399
|
if (Array.isArray(response.presence)) {
|
|
408
400
|
response.presence.map(client.getEventMapper()).forEach(function (presenceEvent) {
|
|
409
|
-
|
|
401
|
+
let user = client.store.getUser(presenceEvent.getContent().user_id);
|
|
410
402
|
if (user) {
|
|
411
403
|
user.setPresenceEvent(presenceEvent);
|
|
412
404
|
} else {
|
|
@@ -455,8 +447,6 @@ export class SyncApi {
|
|
|
455
447
|
* @param token - from= token
|
|
456
448
|
*/
|
|
457
449
|
peekPoll(peekRoom, token) {
|
|
458
|
-
var _this$abortController,
|
|
459
|
-
_this3 = this;
|
|
460
450
|
if (this._peekRoom !== peekRoom) {
|
|
461
451
|
this.syncOpts.logger.debug("Stopped peeking in room %s", peekRoom.roomId);
|
|
462
452
|
return;
|
|
@@ -469,51 +459,46 @@ export class SyncApi {
|
|
|
469
459
|
from: token
|
|
470
460
|
}, undefined, {
|
|
471
461
|
localTimeoutMs: 50 * 1000,
|
|
472
|
-
abortSignal:
|
|
473
|
-
}).then(
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
462
|
+
abortSignal: this.abortController?.signal
|
|
463
|
+
}).then(async res => {
|
|
464
|
+
if (this._peekRoom !== peekRoom) {
|
|
465
|
+
this.syncOpts.logger.debug("Stopped peeking in room %s", peekRoom.roomId);
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
// We have a problem that we get presence both from /events and /sync
|
|
469
|
+
// however, /sync only returns presence for users in rooms
|
|
470
|
+
// you're actually joined to.
|
|
471
|
+
// in order to be sure to get presence for all of the users in the
|
|
472
|
+
// peeked room, we handle presence explicitly here. This may result
|
|
473
|
+
// in duplicate presence events firing for some users, which is a
|
|
474
|
+
// performance drain, but such is life.
|
|
475
|
+
// XXX: copypasted from /sync until we can kill this minging v1 stuff.
|
|
476
|
+
|
|
477
|
+
res.chunk.filter(function (e) {
|
|
478
|
+
return e.type === "m.presence";
|
|
479
|
+
}).map(this.client.getEventMapper()).forEach(presenceEvent => {
|
|
480
|
+
let user = this.client.store.getUser(presenceEvent.getContent().user_id);
|
|
481
|
+
if (user) {
|
|
482
|
+
user.setPresenceEvent(presenceEvent);
|
|
483
|
+
} else {
|
|
484
|
+
user = User.createUser(presenceEvent.getContent().user_id, this.client);
|
|
485
|
+
user.setPresenceEvent(presenceEvent);
|
|
486
|
+
this.client.store.storeUser(user);
|
|
478
487
|
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
// you're actually joined to.
|
|
482
|
-
// in order to be sure to get presence for all of the users in the
|
|
483
|
-
// peeked room, we handle presence explicitly here. This may result
|
|
484
|
-
// in duplicate presence events firing for some users, which is a
|
|
485
|
-
// performance drain, but such is life.
|
|
486
|
-
// XXX: copypasted from /sync until we can kill this minging v1 stuff.
|
|
487
|
-
|
|
488
|
-
res.chunk.filter(function (e) {
|
|
489
|
-
return e.type === "m.presence";
|
|
490
|
-
}).map(_this3.client.getEventMapper()).forEach(presenceEvent => {
|
|
491
|
-
var user = _this3.client.store.getUser(presenceEvent.getContent().user_id);
|
|
492
|
-
if (user) {
|
|
493
|
-
user.setPresenceEvent(presenceEvent);
|
|
494
|
-
} else {
|
|
495
|
-
user = User.createUser(presenceEvent.getContent().user_id, _this3.client);
|
|
496
|
-
user.setPresenceEvent(presenceEvent);
|
|
497
|
-
_this3.client.store.storeUser(user);
|
|
498
|
-
}
|
|
499
|
-
_this3.client.emit(ClientEvent.Event, presenceEvent);
|
|
500
|
-
});
|
|
488
|
+
this.client.emit(ClientEvent.Event, presenceEvent);
|
|
489
|
+
});
|
|
501
490
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
});
|
|
511
|
-
_this3.peekPoll(peekRoom, res.end);
|
|
491
|
+
// strip out events which aren't for the given room_id (e.g presence)
|
|
492
|
+
// and also ephemeral events (which we're assuming is anything without
|
|
493
|
+
// and event ID because the /events API doesn't separate them).
|
|
494
|
+
const events = res.chunk.filter(function (e) {
|
|
495
|
+
return e.room_id === peekRoom.roomId && e.event_id;
|
|
496
|
+
}).map(this.client.getEventMapper());
|
|
497
|
+
await peekRoom.addLiveEvents(events, {
|
|
498
|
+
addToState: true
|
|
512
499
|
});
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
};
|
|
516
|
-
}(), err => {
|
|
500
|
+
this.peekPoll(peekRoom, res.end);
|
|
501
|
+
}, err => {
|
|
517
502
|
this.syncOpts.logger.error("[%s] Peek poll failed: %s", peekRoom.roomId, err);
|
|
518
503
|
setTimeout(() => {
|
|
519
504
|
this.peekPoll(peekRoom, token);
|
|
@@ -537,23 +522,19 @@ export class SyncApi {
|
|
|
537
522
|
* this object.
|
|
538
523
|
*/
|
|
539
524
|
getSyncStateData() {
|
|
540
|
-
|
|
541
|
-
return (_this$syncStateData = this.syncStateData) !== null && _this$syncStateData !== void 0 ? _this$syncStateData : null;
|
|
525
|
+
return this.syncStateData ?? null;
|
|
542
526
|
}
|
|
543
|
-
recoverFromSyncStartupError(savedSyncPromise, error) {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
});
|
|
555
|
-
yield keepaliveProm;
|
|
556
|
-
})();
|
|
527
|
+
async recoverFromSyncStartupError(savedSyncPromise, error) {
|
|
528
|
+
// Wait for the saved sync to complete - we send the pushrules and filter requests
|
|
529
|
+
// before the saved sync has finished so they can run in parallel, but only process
|
|
530
|
+
// the results after the saved sync is done. Equivalently, we wait for it to finish
|
|
531
|
+
// before reporting failures from these functions.
|
|
532
|
+
await savedSyncPromise;
|
|
533
|
+
const keepaliveProm = this.startKeepAlives();
|
|
534
|
+
this.updateSyncState(SyncState.Error, {
|
|
535
|
+
error
|
|
536
|
+
});
|
|
537
|
+
await keepaliveProm;
|
|
557
538
|
}
|
|
558
539
|
shouldAbortSync(error) {
|
|
559
540
|
if (error.errcode === "M_UNKNOWN_TOKEN") {
|
|
@@ -570,104 +551,100 @@ export class SyncApi {
|
|
|
570
551
|
/**
|
|
571
552
|
* Main entry point
|
|
572
553
|
*/
|
|
573
|
-
sync() {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
// no push rules for guests, no access to POST filter for guests.
|
|
582
|
-
return _this5.doSync({});
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
// Pull the saved sync token out first, before the worker starts sending
|
|
586
|
-
// all the sync data which could take a while. This will let us send our
|
|
587
|
-
// first incremental sync request before we've processed our saved data.
|
|
588
|
-
_this5.syncOpts.logger.debug("Getting saved sync token...");
|
|
589
|
-
var savedSyncTokenPromise = _this5.client.store.getSavedSyncToken().then(tok => {
|
|
590
|
-
_this5.syncOpts.logger.debug("Got saved sync token");
|
|
591
|
-
return tok;
|
|
592
|
-
});
|
|
593
|
-
_this5.savedSyncPromise = _this5.client.store.getSavedSync().then(savedSync => {
|
|
594
|
-
_this5.syncOpts.logger.debug("Got reply from saved sync, exists? ".concat(!!savedSync));
|
|
595
|
-
if (savedSync) {
|
|
596
|
-
return _this5.syncFromCache(savedSync);
|
|
597
|
-
}
|
|
598
|
-
}).catch(err => {
|
|
599
|
-
_this5.syncOpts.logger.error("Getting saved sync failed", err);
|
|
600
|
-
});
|
|
554
|
+
async sync() {
|
|
555
|
+
this.running = true;
|
|
556
|
+
this.abortController = new AbortController();
|
|
557
|
+
globalThis.window?.addEventListener?.("online", this.onOnline, false);
|
|
558
|
+
if (this.client.isGuest()) {
|
|
559
|
+
// no push rules for guests, no access to POST filter for guests.
|
|
560
|
+
return this.doSync({});
|
|
561
|
+
}
|
|
601
562
|
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
filterId = _yield$_this5$getFilt.filterId,
|
|
619
|
-
filter = _yield$_this5$getFilt.filter;
|
|
620
|
-
if (!filter) return; // bail, getFilter failed
|
|
621
|
-
|
|
622
|
-
// reset the notifications timeline to prepare it to paginate from
|
|
623
|
-
// the current point in time.
|
|
624
|
-
// The right solution would be to tie /sync pagination tokens into
|
|
625
|
-
// /notifications API somehow.
|
|
626
|
-
_this5.client.resetNotifTimelineSet();
|
|
627
|
-
if (!_this5.currentSyncRequest) {
|
|
628
|
-
var firstSyncFilter = filterId;
|
|
629
|
-
var savedSyncToken = yield savedSyncTokenPromise;
|
|
630
|
-
if (savedSyncToken) {
|
|
631
|
-
_this5.syncOpts.logger.debug("Sending first sync request...");
|
|
632
|
-
} else {
|
|
633
|
-
_this5.syncOpts.logger.debug("Sending initial sync request...");
|
|
634
|
-
var initialFilter = _this5.buildDefaultFilter();
|
|
635
|
-
initialFilter.setDefinition(filter.getDefinition());
|
|
636
|
-
initialFilter.setTimelineLimit(_this5.opts.initialSyncLimit);
|
|
637
|
-
// Use an inline filter, no point uploading it for a single usage
|
|
638
|
-
firstSyncFilter = JSON.stringify(initialFilter.getDefinition());
|
|
639
|
-
}
|
|
563
|
+
// Pull the saved sync token out first, before the worker starts sending
|
|
564
|
+
// all the sync data which could take a while. This will let us send our
|
|
565
|
+
// first incremental sync request before we've processed our saved data.
|
|
566
|
+
this.syncOpts.logger.debug("Getting saved sync token...");
|
|
567
|
+
const savedSyncTokenPromise = this.client.store.getSavedSyncToken().then(tok => {
|
|
568
|
+
this.syncOpts.logger.debug("Got saved sync token");
|
|
569
|
+
return tok;
|
|
570
|
+
});
|
|
571
|
+
this.savedSyncPromise = this.client.store.getSavedSync().then(savedSync => {
|
|
572
|
+
this.syncOpts.logger.debug(`Got reply from saved sync, exists? ${!!savedSync}`);
|
|
573
|
+
if (savedSync) {
|
|
574
|
+
return this.syncFromCache(savedSync);
|
|
575
|
+
}
|
|
576
|
+
}).catch(err => {
|
|
577
|
+
this.syncOpts.logger.error("Getting saved sync failed", err);
|
|
578
|
+
});
|
|
640
579
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
580
|
+
// We need to do one-off checks before we can begin the /sync loop.
|
|
581
|
+
// These are:
|
|
582
|
+
// 1) We need to get push rules so we can check if events should bing as we get
|
|
583
|
+
// them from /sync.
|
|
584
|
+
// 2) We need to get/create a filter which we can use for /sync.
|
|
585
|
+
// 3) We need to prepare lazy loading for sync
|
|
586
|
+
// 4) We need to store the client options
|
|
587
|
+
|
|
588
|
+
// Now start the first incremental sync request: this can also
|
|
589
|
+
// take a while so if we set it going now, we can wait for it
|
|
590
|
+
// to finish while we process our saved sync data.
|
|
591
|
+
await this.getPushRules();
|
|
592
|
+
this.prepareSyncFilterLazyLoading();
|
|
593
|
+
await this.prepareSyncFilterUserProfiles();
|
|
594
|
+
await this.storeClientOptions();
|
|
595
|
+
const {
|
|
596
|
+
filterId,
|
|
597
|
+
filter
|
|
598
|
+
} = await this.getFilter();
|
|
599
|
+
if (!filter) return; // bail, getFilter failed
|
|
600
|
+
|
|
601
|
+
// reset the notifications timeline to prepare it to paginate from
|
|
602
|
+
// the current point in time.
|
|
603
|
+
// The right solution would be to tie /sync pagination tokens into
|
|
604
|
+
// /notifications API somehow.
|
|
605
|
+
this.client.resetNotifTimelineSet();
|
|
606
|
+
if (!this.currentSyncRequest) {
|
|
607
|
+
let firstSyncFilter = filterId;
|
|
608
|
+
const savedSyncToken = await savedSyncTokenPromise;
|
|
609
|
+
if (savedSyncToken) {
|
|
610
|
+
this.syncOpts.logger.debug("Sending first sync request...");
|
|
611
|
+
} else {
|
|
612
|
+
this.syncOpts.logger.debug("Sending initial sync request...");
|
|
613
|
+
const initialFilter = this.buildDefaultFilter();
|
|
614
|
+
initialFilter.setDefinition(filter.getDefinition());
|
|
615
|
+
initialFilter.setTimelineLimit(this.opts.initialSyncLimit);
|
|
616
|
+
// Use an inline filter, no point uploading it for a single usage
|
|
617
|
+
firstSyncFilter = JSON.stringify(initialFilter.getDefinition());
|
|
646
618
|
}
|
|
647
619
|
|
|
648
|
-
//
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
620
|
+
// Send this first sync request here so we can then wait for the saved
|
|
621
|
+
// sync data to finish processing before we process the results of this one.
|
|
622
|
+
this.currentSyncRequest = this.doSyncRequest({
|
|
623
|
+
filter: firstSyncFilter
|
|
624
|
+
}, savedSyncToken);
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
// Now wait for the saved sync to finish...
|
|
628
|
+
this.syncOpts.logger.debug("Waiting for saved sync before starting sync processing...");
|
|
629
|
+
await this.savedSyncPromise;
|
|
630
|
+
// process the first sync request and continue syncing with the normal filterId
|
|
631
|
+
return this.doSync({
|
|
632
|
+
filter: filterId
|
|
633
|
+
});
|
|
656
634
|
}
|
|
657
635
|
|
|
658
636
|
/**
|
|
659
637
|
* Stops the sync object from syncing.
|
|
660
638
|
*/
|
|
661
639
|
stop() {
|
|
662
|
-
var _globalThis$window2, _globalThis$window2$r, _this$abortController2;
|
|
663
640
|
this.syncOpts.logger.debug("SyncApi.stop");
|
|
664
641
|
// It is necessary to check for the existance of
|
|
665
642
|
// globalThis.window AND globalThis.window.removeEventListener.
|
|
666
643
|
// Some platforms (e.g. React Native) register globalThis.window,
|
|
667
644
|
// but do not have globalThis.window.removeEventListener.
|
|
668
|
-
|
|
645
|
+
globalThis.window?.removeEventListener?.("online", this.onOnline, false);
|
|
669
646
|
this.running = false;
|
|
670
|
-
|
|
647
|
+
this.abortController?.abort();
|
|
671
648
|
if (this.keepAliveTimer) {
|
|
672
649
|
clearTimeout(this.keepAliveTimer);
|
|
673
650
|
this.keepAliveTimer = undefined;
|
|
@@ -691,134 +668,127 @@ export class SyncApi {
|
|
|
691
668
|
* @param savedSync - a saved sync that was persisted by a store. This
|
|
692
669
|
* should have been acquired via client.store.getSavedSync().
|
|
693
670
|
*/
|
|
694
|
-
syncFromCache(savedSync) {
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
account_data: {
|
|
713
|
-
events: savedSync.accountData
|
|
714
|
-
}
|
|
715
|
-
};
|
|
716
|
-
try {
|
|
717
|
-
yield _this6.processSyncResponse(syncEventData, data);
|
|
718
|
-
} catch (e) {
|
|
719
|
-
_this6.syncOpts.logger.error("Error processing cached sync", e);
|
|
671
|
+
async syncFromCache(savedSync) {
|
|
672
|
+
this.syncOpts.logger.debug("sync(): not doing HTTP hit, instead returning stored /sync data");
|
|
673
|
+
const nextSyncToken = savedSync.nextBatch;
|
|
674
|
+
|
|
675
|
+
// Set sync token for future incremental syncing
|
|
676
|
+
this.client.store.setSyncToken(nextSyncToken);
|
|
677
|
+
|
|
678
|
+
// No previous sync, set old token to null
|
|
679
|
+
const syncEventData = {
|
|
680
|
+
nextSyncToken,
|
|
681
|
+
catchingUp: false,
|
|
682
|
+
fromCache: true
|
|
683
|
+
};
|
|
684
|
+
const data = {
|
|
685
|
+
next_batch: nextSyncToken,
|
|
686
|
+
rooms: savedSync.roomsData,
|
|
687
|
+
account_data: {
|
|
688
|
+
events: savedSync.accountData
|
|
720
689
|
}
|
|
690
|
+
};
|
|
691
|
+
try {
|
|
692
|
+
await this.processSyncResponse(syncEventData, data);
|
|
693
|
+
} catch (e) {
|
|
694
|
+
this.syncOpts.logger.error("Error processing cached sync", e);
|
|
695
|
+
}
|
|
721
696
|
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
})();
|
|
697
|
+
// Don't emit a prepared if we've bailed because the store is invalid:
|
|
698
|
+
// in this case the client will not be usable until stopped & restarted
|
|
699
|
+
// so this would be useless and misleading.
|
|
700
|
+
if (!this.storeIsInvalid) {
|
|
701
|
+
this.updateSyncState(SyncState.Prepared, syncEventData);
|
|
702
|
+
}
|
|
729
703
|
}
|
|
730
704
|
|
|
731
705
|
/**
|
|
732
706
|
* Invoke me to do /sync calls
|
|
733
707
|
*/
|
|
734
|
-
doSync(syncOptions) {
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
if (!_this7.currentSyncRequest) {
|
|
742
|
-
_this7.currentSyncRequest = _this7.doSyncRequest(syncOptions, syncToken);
|
|
743
|
-
}
|
|
744
|
-
data = yield _this7.currentSyncRequest;
|
|
745
|
-
} catch (e) {
|
|
746
|
-
var abort = yield _this7.onSyncError(e);
|
|
747
|
-
if (abort) return;
|
|
748
|
-
continue;
|
|
749
|
-
} finally {
|
|
750
|
-
_this7.currentSyncRequest = undefined;
|
|
708
|
+
async doSync(syncOptions) {
|
|
709
|
+
while (this.running) {
|
|
710
|
+
const syncToken = this.client.store.getSyncToken();
|
|
711
|
+
let data;
|
|
712
|
+
try {
|
|
713
|
+
if (!this.currentSyncRequest) {
|
|
714
|
+
this.currentSyncRequest = this.doSyncRequest(syncOptions, syncToken);
|
|
751
715
|
}
|
|
716
|
+
data = await this.currentSyncRequest;
|
|
717
|
+
} catch (e) {
|
|
718
|
+
const abort = await this.onSyncError(e);
|
|
719
|
+
if (abort) return;
|
|
720
|
+
continue;
|
|
721
|
+
} finally {
|
|
722
|
+
this.currentSyncRequest = undefined;
|
|
723
|
+
}
|
|
752
724
|
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
// Emit the exception for client handling
|
|
773
|
-
_this7.client.emit(ClientEvent.SyncUnexpectedError, e);
|
|
774
|
-
}
|
|
725
|
+
// set the sync token NOW *before* processing the events. We do this so
|
|
726
|
+
// if something barfs on an event we can skip it rather than constantly
|
|
727
|
+
// polling with the same token.
|
|
728
|
+
this.client.store.setSyncToken(data.next_batch);
|
|
729
|
+
|
|
730
|
+
// Reset after a successful sync
|
|
731
|
+
this.failedSyncCount = 0;
|
|
732
|
+
const syncEventData = {
|
|
733
|
+
oldSyncToken: syncToken ?? undefined,
|
|
734
|
+
nextSyncToken: data.next_batch,
|
|
735
|
+
catchingUp: this.catchingUp
|
|
736
|
+
};
|
|
737
|
+
try {
|
|
738
|
+
await this.processSyncResponse(syncEventData, data);
|
|
739
|
+
} catch (e) {
|
|
740
|
+
// log the exception with stack if we have it, else fall back
|
|
741
|
+
// to the plain description
|
|
742
|
+
this.syncOpts.logger.error("Caught /sync error", e);
|
|
775
743
|
|
|
776
|
-
//
|
|
777
|
-
|
|
778
|
-
|
|
744
|
+
// Emit the exception for client handling
|
|
745
|
+
this.client.emit(ClientEvent.SyncUnexpectedError, e);
|
|
746
|
+
}
|
|
779
747
|
|
|
780
|
-
|
|
781
|
-
|
|
748
|
+
// Persist after processing as `unsigned` may get mutated
|
|
749
|
+
// with an `org.matrix.msc4023.thread_id`
|
|
750
|
+
await this.client.store.setSyncData(data);
|
|
782
751
|
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
_this7.updateSyncState(SyncState.Prepared, syncEventData);
|
|
786
|
-
syncOptions.hasSyncedBefore = true;
|
|
787
|
-
}
|
|
752
|
+
// update this as it may have changed
|
|
753
|
+
syncEventData.catchingUp = this.catchingUp;
|
|
788
754
|
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
755
|
+
// emit synced events
|
|
756
|
+
if (!syncOptions.hasSyncedBefore) {
|
|
757
|
+
this.updateSyncState(SyncState.Prepared, syncEventData);
|
|
758
|
+
syncOptions.hasSyncedBefore = true;
|
|
759
|
+
}
|
|
794
760
|
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
yield _this7.client.store.save();
|
|
800
|
-
}
|
|
761
|
+
// tell the crypto module to do its processing. It may block (to do a
|
|
762
|
+
// /keys/changes request).
|
|
763
|
+
if (this.syncOpts.cryptoCallbacks) {
|
|
764
|
+
this.syncOpts.cryptoCallbacks.onSyncCompleted(syncEventData);
|
|
801
765
|
}
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
_this7.updateSyncState(SyncState.Stopped);
|
|
766
|
+
|
|
767
|
+
// keep emitting SYNCING -> SYNCING for clients who want to do bulk updates
|
|
768
|
+
this.updateSyncState(SyncState.Syncing, syncEventData);
|
|
769
|
+
if (this.client.store.wantsSave()) {
|
|
770
|
+
// tell databases that everything is now in a consistent state and can be saved.
|
|
771
|
+
await this.client.store.save();
|
|
809
772
|
}
|
|
810
|
-
}
|
|
773
|
+
}
|
|
774
|
+
if (!this.running) {
|
|
775
|
+
this.syncOpts.logger.debug("Sync no longer running: exiting.");
|
|
776
|
+
if (this.connectionReturnedResolvers) {
|
|
777
|
+
this.connectionReturnedResolvers.reject();
|
|
778
|
+
this.connectionReturnedResolvers = undefined;
|
|
779
|
+
}
|
|
780
|
+
this.updateSyncState(SyncState.Stopped);
|
|
781
|
+
}
|
|
811
782
|
}
|
|
812
783
|
doSyncRequest(syncOptions, syncToken) {
|
|
813
|
-
|
|
814
|
-
var qps = this.getSyncParams(syncOptions, syncToken);
|
|
784
|
+
const qps = this.getSyncParams(syncOptions, syncToken);
|
|
815
785
|
return this.client.http.authedRequest(Method.Get, "/sync", qps, undefined, {
|
|
816
786
|
localTimeoutMs: qps.timeout + BUFFER_PERIOD_MS,
|
|
817
|
-
abortSignal:
|
|
787
|
+
abortSignal: this.abortController?.signal
|
|
818
788
|
});
|
|
819
789
|
}
|
|
820
790
|
getSyncParams(syncOptions, syncToken) {
|
|
821
|
-
|
|
791
|
+
let timeout = this.opts.pollTimeout;
|
|
822
792
|
if (this.getSyncState() !== SyncState.Syncing || this.catchingUp) {
|
|
823
793
|
// unless we are happily syncing already, we want the server to return
|
|
824
794
|
// as quickly as possible, even if there are no events queued. This
|
|
@@ -834,11 +804,11 @@ export class SyncApi {
|
|
|
834
804
|
this.catchingUp = true;
|
|
835
805
|
timeout = 0;
|
|
836
806
|
}
|
|
837
|
-
|
|
807
|
+
let filter = syncOptions.filter;
|
|
838
808
|
if (this.client.isGuest() && !filter) {
|
|
839
809
|
filter = this.getGuestFilter();
|
|
840
810
|
}
|
|
841
|
-
|
|
811
|
+
const qps = {
|
|
842
812
|
filter,
|
|
843
813
|
timeout,
|
|
844
814
|
"org.matrix.msc4222.use_state_after": true
|
|
@@ -873,51 +843,48 @@ export class SyncApi {
|
|
|
873
843
|
setPresence(presence) {
|
|
874
844
|
this.presence = presence;
|
|
875
845
|
}
|
|
876
|
-
onSyncError(err) {
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
if (
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
_this8.connectionReturnedResolvers.reject();
|
|
883
|
-
_this8.connectionReturnedResolvers = undefined;
|
|
884
|
-
}
|
|
885
|
-
_this8.updateSyncState(SyncState.Stopped);
|
|
886
|
-
return true; // abort
|
|
887
|
-
}
|
|
888
|
-
_this8.syncOpts.logger.error("/sync error %s", err);
|
|
889
|
-
if (_this8.shouldAbortSync(err)) {
|
|
890
|
-
return true; // abort
|
|
846
|
+
async onSyncError(err) {
|
|
847
|
+
if (!this.running) {
|
|
848
|
+
this.syncOpts.logger.debug("Sync no longer running: exiting");
|
|
849
|
+
if (this.connectionReturnedResolvers) {
|
|
850
|
+
this.connectionReturnedResolvers.reject();
|
|
851
|
+
this.connectionReturnedResolvers = undefined;
|
|
891
852
|
}
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
853
|
+
this.updateSyncState(SyncState.Stopped);
|
|
854
|
+
return true; // abort
|
|
855
|
+
}
|
|
856
|
+
this.syncOpts.logger.error("/sync error %s", err);
|
|
857
|
+
if (this.shouldAbortSync(err)) {
|
|
858
|
+
return true; // abort
|
|
859
|
+
}
|
|
860
|
+
this.failedSyncCount++;
|
|
861
|
+
this.syncOpts.logger.debug("Number of consecutive failed sync requests:", this.failedSyncCount);
|
|
862
|
+
this.syncOpts.logger.debug("Starting keep-alive");
|
|
863
|
+
// Note that we do *not* mark the sync connection as
|
|
864
|
+
// lost yet: we only do this if a keepalive poke
|
|
865
|
+
// fails, since long lived HTTP connections will
|
|
866
|
+
// go away sometimes and we shouldn't treat this as
|
|
867
|
+
// erroneous. We set the state to 'reconnecting'
|
|
868
|
+
// instead, so that clients can observe this state
|
|
869
|
+
// if they wish.
|
|
870
|
+
const keepAlivePromise = this.startKeepAlives();
|
|
871
|
+
this.currentSyncRequest = undefined;
|
|
872
|
+
// Transition from RECONNECTING to ERROR after a given number of failed syncs
|
|
873
|
+
this.updateSyncState(this.failedSyncCount >= FAILED_SYNC_ERROR_THRESHOLD ? SyncState.Error : SyncState.Reconnecting, {
|
|
874
|
+
error: err
|
|
875
|
+
});
|
|
876
|
+
const connDidFail = await keepAlivePromise;
|
|
877
|
+
|
|
878
|
+
// Only emit CATCHUP if we detected a connectivity error: if we didn't,
|
|
879
|
+
// it's quite likely the sync will fail again for the same reason and we
|
|
880
|
+
// want to stay in ERROR rather than keep flip-flopping between ERROR
|
|
881
|
+
// and CATCHUP.
|
|
882
|
+
if (connDidFail && this.getSyncState() === SyncState.Error) {
|
|
883
|
+
this.updateSyncState(SyncState.Catchup, {
|
|
884
|
+
catchingUp: true
|
|
907
885
|
});
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
// Only emit CATCHUP if we detected a connectivity error: if we didn't,
|
|
911
|
-
// it's quite likely the sync will fail again for the same reason and we
|
|
912
|
-
// want to stay in ERROR rather than keep flip-flopping between ERROR
|
|
913
|
-
// and CATCHUP.
|
|
914
|
-
if (connDidFail && _this8.getSyncState() === SyncState.Error) {
|
|
915
|
-
_this8.updateSyncState(SyncState.Catchup, {
|
|
916
|
-
catchingUp: true
|
|
917
|
-
});
|
|
918
|
-
}
|
|
919
|
-
return false;
|
|
920
|
-
})();
|
|
886
|
+
}
|
|
887
|
+
return false;
|
|
921
888
|
}
|
|
922
889
|
|
|
923
890
|
/**
|
|
@@ -927,483 +894,450 @@ export class SyncApi {
|
|
|
927
894
|
* @param syncEventData - Object containing sync tokens associated with this sync
|
|
928
895
|
* @param data - The response from /sync
|
|
929
896
|
*/
|
|
930
|
-
processSyncResponse(syncEventData, data) {
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
897
|
+
async processSyncResponse(syncEventData, data) {
|
|
898
|
+
const client = this.client;
|
|
899
|
+
|
|
900
|
+
// data looks like:
|
|
901
|
+
// {
|
|
902
|
+
// next_batch: $token,
|
|
903
|
+
// presence: { events: [] },
|
|
904
|
+
// account_data: { events: [] },
|
|
905
|
+
// device_lists: { changed: ["@user:server", ... ]},
|
|
906
|
+
// to_device: { events: [] },
|
|
907
|
+
// device_one_time_keys_count: { signed_curve25519: 42 },
|
|
908
|
+
// rooms: {
|
|
909
|
+
// invite: {
|
|
910
|
+
// $roomid: {
|
|
911
|
+
// invite_state: { events: [] }
|
|
912
|
+
// }
|
|
913
|
+
// },
|
|
914
|
+
// join: {
|
|
915
|
+
// $roomid: {
|
|
916
|
+
// state: { events: [] },
|
|
917
|
+
// timeline: { events: [], prev_batch: $token, limited: true },
|
|
918
|
+
// ephemeral: { events: [] },
|
|
919
|
+
// summary: {
|
|
920
|
+
// m.heroes: [ $user_id ],
|
|
921
|
+
// m.joined_member_count: $count,
|
|
922
|
+
// m.invited_member_count: $count
|
|
923
|
+
// },
|
|
924
|
+
// account_data: { events: [] },
|
|
925
|
+
// unread_notifications: {
|
|
926
|
+
// highlight_count: 0,
|
|
927
|
+
// notification_count: 0,
|
|
928
|
+
// }
|
|
929
|
+
// "org.matrix.msc4222.state_after": { events: [] }, // only if "org.matrix.msc4222.use_state_after" is true
|
|
930
|
+
// msc4354_sticky: { events: [] }, // only if "org.matrix.msc4354.sticky" is true
|
|
931
|
+
// }
|
|
932
|
+
// },
|
|
933
|
+
// leave: {
|
|
934
|
+
// $roomid: {
|
|
935
|
+
// state: { events: [] },
|
|
936
|
+
// timeline: { events: [], prev_batch: $token }
|
|
937
|
+
// }
|
|
938
|
+
// }
|
|
939
|
+
// }
|
|
940
|
+
// }
|
|
941
|
+
|
|
942
|
+
// TODO-arch:
|
|
943
|
+
// - Each event we pass through needs to be emitted via 'event', can we
|
|
944
|
+
// do this in one place?
|
|
945
|
+
// - The isBrandNewRoom boilerplate is boilerplatey.
|
|
946
|
+
|
|
947
|
+
// handle presence events (User objects)
|
|
948
|
+
if (Array.isArray(data.presence?.events)) {
|
|
949
|
+
data.presence.events.filter(noUnsafeEventProps).map(client.getEventMapper()).forEach(function (presenceEvent) {
|
|
950
|
+
let user = client.store.getUser(presenceEvent.getSender());
|
|
951
|
+
if (user) {
|
|
952
|
+
user.setPresenceEvent(presenceEvent);
|
|
953
|
+
} else {
|
|
954
|
+
user = User.createUser(presenceEvent.getSender(), client);
|
|
955
|
+
user.setPresenceEvent(presenceEvent);
|
|
956
|
+
client.store.storeUser(user);
|
|
957
|
+
}
|
|
958
|
+
client.emit(ClientEvent.Event, presenceEvent);
|
|
959
|
+
});
|
|
960
|
+
}
|
|
982
961
|
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
962
|
+
// handle non-room account_data
|
|
963
|
+
if (Array.isArray(data.account_data?.events)) {
|
|
964
|
+
const events = data.account_data.events.filter(noUnsafeEventProps).map(client.getEventMapper());
|
|
965
|
+
const prevEventsMap = events.reduce((m, c) => {
|
|
966
|
+
m[c.getType()] = client.store.getAccountData(c.getType());
|
|
967
|
+
return m;
|
|
968
|
+
}, {});
|
|
969
|
+
client.store.storeAccountDataEvents(events);
|
|
970
|
+
events.forEach(function (accountDataEvent) {
|
|
971
|
+
// Honour push rules that come down the sync stream but also
|
|
972
|
+
// honour push rules that were previously cached. Base rules
|
|
973
|
+
// will be updated when we receive push rules via getPushRules
|
|
974
|
+
// (see sync) before syncing over the network.
|
|
975
|
+
if (accountDataEvent.getType() === EventType.PushRules) {
|
|
976
|
+
const rules = accountDataEvent.getContent();
|
|
977
|
+
client.setPushRules(rules);
|
|
978
|
+
}
|
|
979
|
+
const prevEvent = prevEventsMap[accountDataEvent.getType()];
|
|
980
|
+
client.emit(ClientEvent.AccountData, accountDataEvent, prevEvent);
|
|
981
|
+
return accountDataEvent;
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
// handle user profile updates (MSC4429)
|
|
986
|
+
const userUpdate = data["users"] ?? data["org.matrix.msc4429.users"];
|
|
987
|
+
if (typeof userUpdate === "object" && userUpdate !== null) {
|
|
988
|
+
const usersToRemove = [];
|
|
989
|
+
const profilesToAmend = new Map();
|
|
990
|
+
for (const [userId, userData] of Object.entries(userUpdate)) {
|
|
991
|
+
logger.info(`Storing user profile ${userId}`, userData);
|
|
992
|
+
if (userData.profile_updates) {
|
|
993
|
+
const existingProfile = await client.store.getUserProfile(userId);
|
|
994
|
+
profilesToAmend.set(userId, _objectSpread(_objectSpread({}, existingProfile), userData.profile_updates));
|
|
995
|
+
} else if (userData.profile_updates === null) {
|
|
996
|
+
usersToRemove.push(userId);
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
if (usersToRemove.length) {
|
|
1000
|
+
await client.store.removeUserProfiles(usersToRemove);
|
|
1001
|
+
}
|
|
1002
|
+
if (profilesToAmend.size) {
|
|
1003
|
+
await client.store.storeUserProfiles(profilesToAmend);
|
|
996
1004
|
}
|
|
997
1005
|
|
|
998
|
-
//
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
var prevEventsMap = events.reduce((m, c) => {
|
|
1002
|
-
m[c.getType()] = client.store.getAccountData(c.getType());
|
|
1003
|
-
return m;
|
|
1004
|
-
}, {});
|
|
1005
|
-
client.store.storeAccountDataEvents(events);
|
|
1006
|
-
events.forEach(function (accountDataEvent) {
|
|
1007
|
-
// Honour push rules that come down the sync stream but also
|
|
1008
|
-
// honour push rules that were previously cached. Base rules
|
|
1009
|
-
// will be updated when we receive push rules via getPushRules
|
|
1010
|
-
// (see sync) before syncing over the network.
|
|
1011
|
-
if (accountDataEvent.getType() === EventType.PushRules) {
|
|
1012
|
-
var rules = accountDataEvent.getContent();
|
|
1013
|
-
client.setPushRules(rules);
|
|
1014
|
-
}
|
|
1015
|
-
var prevEvent = prevEventsMap[accountDataEvent.getType()];
|
|
1016
|
-
client.emit(ClientEvent.AccountData, accountDataEvent, prevEvent);
|
|
1017
|
-
return accountDataEvent;
|
|
1018
|
-
});
|
|
1006
|
+
// emit after we've update the store so that clients can get the updated profile if they want to
|
|
1007
|
+
for (const [userId, userData] of Object.entries(userUpdate)) {
|
|
1008
|
+
client.emit(ClientEvent.UserProfileUpdate, userId, userData.profile_updates ?? null);
|
|
1019
1009
|
}
|
|
1010
|
+
}
|
|
1020
1011
|
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
var existingProfile = yield client.store.getUserProfile(userId);
|
|
1034
|
-
profilesToAmend.set(userId, _objectSpread(_objectSpread({}, existingProfile), userData.profile_updates));
|
|
1035
|
-
} else if (userData.profile_updates === null) {
|
|
1036
|
-
usersToRemove.push(userId);
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
if (usersToRemove.length) {
|
|
1040
|
-
yield client.store.removeUserProfiles(usersToRemove);
|
|
1041
|
-
}
|
|
1042
|
-
if (profilesToAmend.size) {
|
|
1043
|
-
yield client.store.storeUserProfiles(profilesToAmend);
|
|
1044
|
-
}
|
|
1012
|
+
// handle to-device events
|
|
1013
|
+
if (data.to_device && Array.isArray(data.to_device.events) && data.to_device.events.length > 0) {
|
|
1014
|
+
const toDeviceMessages = data.to_device.events.filter(noUnsafeEventProps);
|
|
1015
|
+
let receivedToDeviceMessages;
|
|
1016
|
+
if (this.syncOpts.cryptoCallbacks) {
|
|
1017
|
+
receivedToDeviceMessages = await this.syncOpts.cryptoCallbacks.preprocessToDeviceMessages(toDeviceMessages);
|
|
1018
|
+
} else {
|
|
1019
|
+
// Crypto is not enabled, so we just return the events.
|
|
1020
|
+
receivedToDeviceMessages = toDeviceMessages.map(rawEvent => ({
|
|
1021
|
+
message: rawEvent,
|
|
1022
|
+
encryptionInfo: null
|
|
1023
|
+
}));
|
|
1045
1024
|
}
|
|
1025
|
+
processToDeviceMessages(receivedToDeviceMessages, client);
|
|
1026
|
+
} else {
|
|
1027
|
+
// no more to-device events: we can stop polling with a short timeout.
|
|
1028
|
+
this.catchingUp = false;
|
|
1029
|
+
}
|
|
1046
1030
|
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1031
|
+
// the returned json structure is a bit crap, so make it into a
|
|
1032
|
+
// nicer form (array) after applying sanity to make sure we don't fail
|
|
1033
|
+
// on missing keys (on the off chance)
|
|
1034
|
+
let inviteRooms = [];
|
|
1035
|
+
let joinRooms = [];
|
|
1036
|
+
let leaveRooms = [];
|
|
1037
|
+
let knockRooms = [];
|
|
1038
|
+
if (data.rooms) {
|
|
1039
|
+
if (data.rooms.invite) {
|
|
1040
|
+
inviteRooms = this.mapSyncResponseToRoomArray(data.rooms.invite);
|
|
1041
|
+
}
|
|
1042
|
+
if (data.rooms.join) {
|
|
1043
|
+
joinRooms = this.mapSyncResponseToRoomArray(data.rooms.join);
|
|
1044
|
+
}
|
|
1045
|
+
if (data.rooms.leave) {
|
|
1046
|
+
leaveRooms = this.mapSyncResponseToRoomArray(data.rooms.leave);
|
|
1047
|
+
}
|
|
1048
|
+
if (data.rooms.knock) {
|
|
1049
|
+
knockRooms = this.mapSyncResponseToRoomArray(data.rooms.knock);
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
this.notifEvents = [];
|
|
1053
|
+
|
|
1054
|
+
// Handle invites
|
|
1055
|
+
await Promise.all(inviteRooms.map(async inviteObj => {
|
|
1056
|
+
const room = inviteObj.room;
|
|
1057
|
+
const stateEvents = this.mapSyncEventsFormat(inviteObj.invite_state, room);
|
|
1058
|
+
await this.injectRoomEvents(room, stateEvents, undefined);
|
|
1059
|
+
if (inviteObj.isBrandNewRoom) {
|
|
1060
|
+
room.recalculate();
|
|
1061
|
+
client.store.storeRoom(room);
|
|
1062
|
+
client.emit(ClientEvent.Room, room);
|
|
1062
1063
|
} else {
|
|
1063
|
-
//
|
|
1064
|
-
|
|
1064
|
+
// Update room state for invite->reject->invite cycles
|
|
1065
|
+
room.recalculate();
|
|
1065
1066
|
}
|
|
1067
|
+
stateEvents.forEach(function (e) {
|
|
1068
|
+
client.emit(ClientEvent.Event, e);
|
|
1069
|
+
});
|
|
1070
|
+
}));
|
|
1066
1071
|
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1072
|
+
// Handle joins
|
|
1073
|
+
await Promise.all(joinRooms.map(async joinObj => {
|
|
1074
|
+
const room = joinObj.room;
|
|
1075
|
+
const stateEvents = this.mapSyncEventsFormat(joinObj.state, room);
|
|
1076
|
+
const stateAfterEvents = this.mapSyncEventsFormat(joinObj["org.matrix.msc4222.state_after"], room);
|
|
1077
|
+
// Prevent events from being decrypted ahead of time
|
|
1078
|
+
// this helps large account to speed up faster
|
|
1079
|
+
// room::decryptCriticalEvent is in charge of decrypting all the events
|
|
1080
|
+
// required for a client to function properly
|
|
1081
|
+
const timelineEvents = this.mapSyncEventsFormat(joinObj.timeline, room, false);
|
|
1082
|
+
const ephemeralEvents = this.mapSyncEventsFormat(joinObj.ephemeral);
|
|
1083
|
+
const accountDataEvents = this.mapSyncEventsFormat(joinObj.account_data);
|
|
1084
|
+
const stickyEvents = this.mapSyncEventsFormat(joinObj.msc4354_sticky);
|
|
1085
|
+
|
|
1086
|
+
// If state_after is present, this is the events that form the state at the end of the timeline block and
|
|
1087
|
+
// regular timeline events do *not* count towards state. If it's not present, then the state is formed by
|
|
1088
|
+
// the state events plus the timeline events. Note mapSyncEventsFormat returns an empty array if the field
|
|
1089
|
+
// is absent so we explicitly check the field on the original object.
|
|
1090
|
+
const eventsFormingFinalState = joinObj["org.matrix.msc4222.state_after"] ? stateAfterEvents : stateEvents.concat(timelineEvents);
|
|
1091
|
+
const encrypted = this.isRoomEncrypted(room, eventsFormingFinalState);
|
|
1092
|
+
// We store the server-provided value first so it's correct when any of the events fire.
|
|
1093
|
+
if (joinObj.unread_notifications) {
|
|
1094
|
+
/**
|
|
1095
|
+
* We track unread notifications ourselves in encrypted rooms, so don't
|
|
1096
|
+
* bother setting it here. We trust our calculations better than the
|
|
1097
|
+
* server's for this case, and therefore will assume that our non-zero
|
|
1098
|
+
* count is accurate.
|
|
1099
|
+
* XXX: this is known faulty as the push rule for `.m.room.encrypted` may be disabled so server
|
|
1100
|
+
* may issue notification counts of 0 which we wrongly trust.
|
|
1101
|
+
* https://github.com/matrix-org/matrix-spec-proposals/pull/2654 would fix this
|
|
1102
|
+
*
|
|
1103
|
+
* @see import("./client").fixNotificationCountOnDecryption
|
|
1104
|
+
*/
|
|
1105
|
+
if (!encrypted || joinObj.unread_notifications.notification_count === 0) {
|
|
1106
|
+
// In an encrypted room, if the room has notifications enabled then it's typical for
|
|
1107
|
+
// the server to flag all new messages as notifying. However, some push rules calculate
|
|
1108
|
+
// events as ignored based on their event contents (e.g. ignoring msgtype=m.notice messages)
|
|
1109
|
+
// so we want to calculate this figure on the client in all cases.
|
|
1110
|
+
room.setUnreadNotificationCount(NotificationCountType.Total, joinObj.unread_notifications.notification_count ?? 0);
|
|
1077
1111
|
}
|
|
1078
|
-
if (
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
if (data.rooms.leave) {
|
|
1082
|
-
leaveRooms = _this9.mapSyncResponseToRoomArray(data.rooms.leave);
|
|
1083
|
-
}
|
|
1084
|
-
if (data.rooms.knock) {
|
|
1085
|
-
knockRooms = _this9.mapSyncResponseToRoomArray(data.rooms.knock);
|
|
1112
|
+
if (!encrypted || room.getUnreadNotificationCount(NotificationCountType.Highlight) <= 0) {
|
|
1113
|
+
// If the locally stored highlight count is zero, use the server provided value.
|
|
1114
|
+
room.setUnreadNotificationCount(NotificationCountType.Highlight, joinObj.unread_notifications.highlight_count ?? 0);
|
|
1086
1115
|
}
|
|
1087
1116
|
}
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
if (
|
|
1097
|
-
room.
|
|
1098
|
-
client.store.storeRoom(room);
|
|
1099
|
-
client.emit(ClientEvent.Room, room);
|
|
1100
|
-
} else {
|
|
1101
|
-
// Update room state for invite->reject->invite cycles
|
|
1102
|
-
room.recalculate();
|
|
1103
|
-
}
|
|
1104
|
-
stateEvents.forEach(function (e) {
|
|
1105
|
-
client.emit(ClientEvent.Event, e);
|
|
1106
|
-
});
|
|
1107
|
-
});
|
|
1108
|
-
return function (_x3) {
|
|
1109
|
-
return _ref1.apply(this, arguments);
|
|
1110
|
-
};
|
|
1111
|
-
}()));
|
|
1112
|
-
|
|
1113
|
-
// Handle joins
|
|
1114
|
-
yield Promise.all(joinRooms.map(/*#__PURE__*/function () {
|
|
1115
|
-
var _ref10 = _asyncToGenerator(function* (joinObj) {
|
|
1116
|
-
var _joinObj$UNREAD_THREA;
|
|
1117
|
-
var room = joinObj.room;
|
|
1118
|
-
var stateEvents = _this9.mapSyncEventsFormat(joinObj.state, room);
|
|
1119
|
-
var stateAfterEvents = _this9.mapSyncEventsFormat(joinObj["org.matrix.msc4222.state_after"], room);
|
|
1120
|
-
// Prevent events from being decrypted ahead of time
|
|
1121
|
-
// this helps large account to speed up faster
|
|
1122
|
-
// room::decryptCriticalEvent is in charge of decrypting all the events
|
|
1123
|
-
// required for a client to function properly
|
|
1124
|
-
var timelineEvents = _this9.mapSyncEventsFormat(joinObj.timeline, room, false);
|
|
1125
|
-
var ephemeralEvents = _this9.mapSyncEventsFormat(joinObj.ephemeral);
|
|
1126
|
-
var accountDataEvents = _this9.mapSyncEventsFormat(joinObj.account_data);
|
|
1127
|
-
var stickyEvents = _this9.mapSyncEventsFormat(joinObj.msc4354_sticky);
|
|
1128
|
-
|
|
1129
|
-
// If state_after is present, this is the events that form the state at the end of the timeline block and
|
|
1130
|
-
// regular timeline events do *not* count towards state. If it's not present, then the state is formed by
|
|
1131
|
-
// the state events plus the timeline events. Note mapSyncEventsFormat returns an empty array if the field
|
|
1132
|
-
// is absent so we explicitly check the field on the original object.
|
|
1133
|
-
var eventsFormingFinalState = joinObj["org.matrix.msc4222.state_after"] ? stateAfterEvents : stateEvents.concat(timelineEvents);
|
|
1134
|
-
var encrypted = _this9.isRoomEncrypted(room, eventsFormingFinalState);
|
|
1135
|
-
// We store the server-provided value first so it's correct when any of the events fire.
|
|
1136
|
-
if (joinObj.unread_notifications) {
|
|
1137
|
-
/**
|
|
1138
|
-
* We track unread notifications ourselves in encrypted rooms, so don't
|
|
1139
|
-
* bother setting it here. We trust our calculations better than the
|
|
1140
|
-
* server's for this case, and therefore will assume that our non-zero
|
|
1141
|
-
* count is accurate.
|
|
1142
|
-
* XXX: this is known faulty as the push rule for `.m.room.encrypted` may be disabled so server
|
|
1143
|
-
* may issue notification counts of 0 which we wrongly trust.
|
|
1144
|
-
* https://github.com/matrix-org/matrix-spec-proposals/pull/2654 would fix this
|
|
1145
|
-
*
|
|
1146
|
-
* @see import("./client").fixNotificationCountOnDecryption
|
|
1147
|
-
*/
|
|
1148
|
-
if (!encrypted || joinObj.unread_notifications.notification_count === 0) {
|
|
1149
|
-
var _joinObj$unread_notif;
|
|
1150
|
-
// In an encrypted room, if the room has notifications enabled then it's typical for
|
|
1151
|
-
// the server to flag all new messages as notifying. However, some push rules calculate
|
|
1152
|
-
// events as ignored based on their event contents (e.g. ignoring msgtype=m.notice messages)
|
|
1153
|
-
// so we want to calculate this figure on the client in all cases.
|
|
1154
|
-
room.setUnreadNotificationCount(NotificationCountType.Total, (_joinObj$unread_notif = joinObj.unread_notifications.notification_count) !== null && _joinObj$unread_notif !== void 0 ? _joinObj$unread_notif : 0);
|
|
1155
|
-
}
|
|
1156
|
-
if (!encrypted || room.getUnreadNotificationCount(NotificationCountType.Highlight) <= 0) {
|
|
1157
|
-
var _joinObj$unread_notif2;
|
|
1158
|
-
// If the locally stored highlight count is zero, use the server provided value.
|
|
1159
|
-
room.setUnreadNotificationCount(NotificationCountType.Highlight, (_joinObj$unread_notif2 = joinObj.unread_notifications.highlight_count) !== null && _joinObj$unread_notif2 !== void 0 ? _joinObj$unread_notif2 : 0);
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
var unreadThreadNotifications = (_joinObj$UNREAD_THREA = joinObj[UNREAD_THREAD_NOTIFICATIONS.name]) !== null && _joinObj$UNREAD_THREA !== void 0 ? _joinObj$UNREAD_THREA : joinObj[UNREAD_THREAD_NOTIFICATIONS.altName];
|
|
1163
|
-
if (unreadThreadNotifications) {
|
|
1164
|
-
// This mirrors the logic above for rooms: take the *total* notification count from
|
|
1165
|
-
// the server for unencrypted rooms or is it's zero. Any threads not present in this
|
|
1166
|
-
// object implicitly have zero notifications, so start by clearing the total counts
|
|
1167
|
-
// for all such threads.
|
|
1168
|
-
room.resetThreadUnreadNotificationCountFromSync(Object.keys(unreadThreadNotifications));
|
|
1169
|
-
for (var _ref13 of Object.entries(unreadThreadNotifications)) {
|
|
1170
|
-
var _ref12 = _slicedToArray(_ref13, 2);
|
|
1171
|
-
var threadId = _ref12[0];
|
|
1172
|
-
var unreadNotification = _ref12[1];
|
|
1173
|
-
if (!encrypted || unreadNotification.notification_count === 0) {
|
|
1174
|
-
var _unreadNotification$n;
|
|
1175
|
-
room.setThreadUnreadNotificationCount(threadId, NotificationCountType.Total, (_unreadNotification$n = unreadNotification.notification_count) !== null && _unreadNotification$n !== void 0 ? _unreadNotification$n : 0);
|
|
1176
|
-
}
|
|
1177
|
-
var hasNoNotifications = room.getThreadUnreadNotificationCount(threadId, NotificationCountType.Highlight) <= 0;
|
|
1178
|
-
if (!encrypted || encrypted && hasNoNotifications) {
|
|
1179
|
-
var _unreadNotification$h;
|
|
1180
|
-
room.setThreadUnreadNotificationCount(threadId, NotificationCountType.Highlight, (_unreadNotification$h = unreadNotification.highlight_count) !== null && _unreadNotification$h !== void 0 ? _unreadNotification$h : 0);
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
} else {
|
|
1184
|
-
room.resetThreadUnreadNotificationCountFromSync();
|
|
1117
|
+
const unreadThreadNotifications = joinObj[UNREAD_THREAD_NOTIFICATIONS.name] ?? joinObj[UNREAD_THREAD_NOTIFICATIONS.altName];
|
|
1118
|
+
if (unreadThreadNotifications) {
|
|
1119
|
+
// This mirrors the logic above for rooms: take the *total* notification count from
|
|
1120
|
+
// the server for unencrypted rooms or is it's zero. Any threads not present in this
|
|
1121
|
+
// object implicitly have zero notifications, so start by clearing the total counts
|
|
1122
|
+
// for all such threads.
|
|
1123
|
+
room.resetThreadUnreadNotificationCountFromSync(Object.keys(unreadThreadNotifications));
|
|
1124
|
+
for (const [threadId, unreadNotification] of Object.entries(unreadThreadNotifications)) {
|
|
1125
|
+
if (!encrypted || unreadNotification.notification_count === 0) {
|
|
1126
|
+
room.setThreadUnreadNotificationCount(threadId, NotificationCountType.Total, unreadNotification.notification_count ?? 0);
|
|
1185
1127
|
}
|
|
1186
|
-
|
|
1187
|
-
if (
|
|
1188
|
-
|
|
1189
|
-
// events so that clients can start back-paginating.
|
|
1190
|
-
if (joinObj.timeline.prev_batch !== null) {
|
|
1191
|
-
room.getLiveTimeline().setPaginationToken(joinObj.timeline.prev_batch, EventTimeline.BACKWARDS);
|
|
1192
|
-
}
|
|
1193
|
-
} else if (joinObj.timeline.limited) {
|
|
1194
|
-
var limited = true;
|
|
1195
|
-
|
|
1196
|
-
// we've got a limited sync, so we *probably* have a gap in the
|
|
1197
|
-
// timeline, so should reset. But we might have been peeking or
|
|
1198
|
-
// paginating and already have some of the events, in which
|
|
1199
|
-
// case we just want to append any subsequent events to the end
|
|
1200
|
-
// of the existing timeline.
|
|
1201
|
-
//
|
|
1202
|
-
// This is particularly important in the case that we already have
|
|
1203
|
-
// *all* of the events in the timeline - in that case, if we reset
|
|
1204
|
-
// the timeline, we'll end up with an entirely empty timeline,
|
|
1205
|
-
// which we'll try to paginate but not get any new events (which
|
|
1206
|
-
// will stop us linking the empty timeline into the chain).
|
|
1207
|
-
//
|
|
1208
|
-
for (var i = timelineEvents.length - 1; i >= 0; i--) {
|
|
1209
|
-
var eventId = timelineEvents[i].getId();
|
|
1210
|
-
if (room.getTimelineForEvent(eventId)) {
|
|
1211
|
-
_this9.syncOpts.logger.debug("Already have event ".concat(eventId, " in limited sync - not resetting"));
|
|
1212
|
-
limited = false;
|
|
1213
|
-
|
|
1214
|
-
// we might still be missing some of the events before i;
|
|
1215
|
-
// we don't want to be adding them to the end of the
|
|
1216
|
-
// timeline because that would put them out of order.
|
|
1217
|
-
timelineEvents.splice(0, i);
|
|
1218
|
-
|
|
1219
|
-
// XXX: there's a problem here if the skipped part of the
|
|
1220
|
-
// timeline modifies the state set in stateEvents, because
|
|
1221
|
-
// we'll end up using the state from stateEvents rather
|
|
1222
|
-
// than the later state from timelineEvents. We probably
|
|
1223
|
-
// need to wind stateEvents forward over the events we're
|
|
1224
|
-
// skipping.
|
|
1225
|
-
|
|
1226
|
-
break;
|
|
1227
|
-
}
|
|
1228
|
-
}
|
|
1229
|
-
if (limited) {
|
|
1230
|
-
var _syncEventData$oldSyn;
|
|
1231
|
-
room.resetLiveTimeline(joinObj.timeline.prev_batch, _this9.syncOpts.canResetEntireTimeline(room.roomId) ? null : (_syncEventData$oldSyn = syncEventData.oldSyncToken) !== null && _syncEventData$oldSyn !== void 0 ? _syncEventData$oldSyn : null);
|
|
1232
|
-
|
|
1233
|
-
// We have to assume any gap in any timeline is
|
|
1234
|
-
// reason to stop incrementally tracking notifications and
|
|
1235
|
-
// reset the timeline.
|
|
1236
|
-
client.resetNotifTimelineSet();
|
|
1237
|
-
}
|
|
1128
|
+
const hasNoNotifications = room.getThreadUnreadNotificationCount(threadId, NotificationCountType.Highlight) <= 0;
|
|
1129
|
+
if (!encrypted || encrypted && hasNoNotifications) {
|
|
1130
|
+
room.setThreadUnreadNotificationCount(threadId, NotificationCountType.Highlight, unreadNotification.highlight_count ?? 0);
|
|
1238
1131
|
}
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1132
|
+
}
|
|
1133
|
+
} else {
|
|
1134
|
+
room.resetThreadUnreadNotificationCountFromSync();
|
|
1135
|
+
}
|
|
1136
|
+
joinObj.timeline = joinObj.timeline || {};
|
|
1137
|
+
if (joinObj.isBrandNewRoom) {
|
|
1138
|
+
// set the back-pagination token. Do this *before* adding any
|
|
1139
|
+
// events so that clients can start back-paginating.
|
|
1140
|
+
if (joinObj.timeline.prev_batch !== null) {
|
|
1141
|
+
room.getLiveTimeline().setPaginationToken(joinObj.timeline.prev_batch, EventTimeline.BACKWARDS);
|
|
1142
|
+
}
|
|
1143
|
+
} else if (joinObj.timeline.limited) {
|
|
1144
|
+
let limited = true;
|
|
1145
|
+
|
|
1146
|
+
// we've got a limited sync, so we *probably* have a gap in the
|
|
1147
|
+
// timeline, so should reset. But we might have been peeking or
|
|
1148
|
+
// paginating and already have some of the events, in which
|
|
1149
|
+
// case we just want to append any subsequent events to the end
|
|
1150
|
+
// of the existing timeline.
|
|
1151
|
+
//
|
|
1152
|
+
// This is particularly important in the case that we already have
|
|
1153
|
+
// *all* of the events in the timeline - in that case, if we reset
|
|
1154
|
+
// the timeline, we'll end up with an entirely empty timeline,
|
|
1155
|
+
// which we'll try to paginate but not get any new events (which
|
|
1156
|
+
// will stop us linking the empty timeline into the chain).
|
|
1157
|
+
//
|
|
1158
|
+
for (let i = timelineEvents.length - 1; i >= 0; i--) {
|
|
1159
|
+
const eventId = timelineEvents[i].getId();
|
|
1160
|
+
if (room.getTimelineForEvent(eventId)) {
|
|
1161
|
+
this.syncOpts.logger.debug(`Already have event ${eventId} in limited sync - not resetting`);
|
|
1162
|
+
limited = false;
|
|
1163
|
+
|
|
1164
|
+
// we might still be missing some of the events before i;
|
|
1165
|
+
// we don't want to be adding them to the end of the
|
|
1166
|
+
// timeline because that would put them out of order.
|
|
1167
|
+
timelineEvents.splice(0, i);
|
|
1168
|
+
|
|
1169
|
+
// XXX: there's a problem here if the skipped part of the
|
|
1170
|
+
// timeline modifies the state set in stateEvents, because
|
|
1171
|
+
// we'll end up using the state from stateEvents rather
|
|
1172
|
+
// than the later state from timelineEvents. We probably
|
|
1173
|
+
// need to wind stateEvents forward over the events we're
|
|
1174
|
+
// skipping.
|
|
1175
|
+
|
|
1176
|
+
break;
|
|
1251
1177
|
}
|
|
1178
|
+
}
|
|
1179
|
+
if (limited) {
|
|
1180
|
+
room.resetLiveTimeline(joinObj.timeline.prev_batch, this.syncOpts.canResetEntireTimeline(room.roomId) ? null : syncEventData.oldSyncToken ?? null);
|
|
1252
1181
|
|
|
1253
|
-
//
|
|
1254
|
-
//
|
|
1255
|
-
//
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
try {
|
|
1260
|
-
if ("org.matrix.msc4222.state_after" in joinObj) {
|
|
1261
|
-
yield _this9.injectRoomEvents(room, undefined, stateAfterEvents, timelineEvents, syncEventData.fromCache);
|
|
1262
|
-
} else {
|
|
1263
|
-
yield _this9.injectRoomEvents(room, stateEvents, undefined, timelineEvents, syncEventData.fromCache);
|
|
1264
|
-
}
|
|
1265
|
-
} catch (e) {
|
|
1266
|
-
_this9.syncOpts.logger.error("Failed to process events on room ".concat(room.roomId, ":"), e);
|
|
1267
|
-
}
|
|
1182
|
+
// We have to assume any gap in any timeline is
|
|
1183
|
+
// reason to stop incrementally tracking notifications and
|
|
1184
|
+
// reset the timeline.
|
|
1185
|
+
client.resetNotifTimelineSet();
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1268
1188
|
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
room.setSummary(joinObj.summary);
|
|
1274
|
-
}
|
|
1189
|
+
// process any crypto events *before* emitting the RoomStateEvent events. This
|
|
1190
|
+
// avoids a race condition if the application tries to send a message after the
|
|
1191
|
+
// state event is processed, but before crypto is enabled, which then causes the
|
|
1192
|
+
// crypto layer to complain.
|
|
1275
1193
|
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
room.addAccountData(accountDataEvents);
|
|
1281
|
-
|
|
1282
|
-
// Sticky events primarily come via the `timeline` field, with the
|
|
1283
|
-
// sticky info field marking them as sticky.
|
|
1284
|
-
// If the sync is "gappy" (meaning it is skipping events to catch up) then
|
|
1285
|
-
// sticky events will instead come down the sticky section.
|
|
1286
|
-
// This ensures we collect sticky events from both places.
|
|
1287
|
-
var stickyEventsAndStickyEventsFromTheTimeline = stickyEvents.concat(timelineEvents.filter(e => e.unstableStickyInfo !== undefined));
|
|
1288
|
-
// Note: We calculate sticky events before emitting `.Room` as it's nice to have
|
|
1289
|
-
// sticky events calculated and ready to go.
|
|
1290
|
-
room._unstable_addStickyEvents(stickyEventsAndStickyEventsFromTheTimeline);
|
|
1291
|
-
room.recalculate();
|
|
1292
|
-
if (joinObj.isBrandNewRoom) {
|
|
1293
|
-
client.store.storeRoom(room);
|
|
1294
|
-
client.emit(ClientEvent.Room, room);
|
|
1295
|
-
}
|
|
1296
|
-
_this9.processEventsForNotifs(room, timelineEvents);
|
|
1297
|
-
var emitEvent = e => client.emit(ClientEvent.Event, e);
|
|
1298
|
-
// this fires a couple of times for some events. (eg state events are in the timeline and the state)
|
|
1299
|
-
// should this get a sync section as an additional event emission param (e, syncSection))?
|
|
1300
|
-
stateEvents.forEach(emitEvent);
|
|
1301
|
-
timelineEvents.forEach(emitEvent);
|
|
1302
|
-
ephemeralEvents.forEach(emitEvent);
|
|
1303
|
-
accountDataEvents.forEach(emitEvent);
|
|
1304
|
-
stickyEvents.filter(stickyEvent =>
|
|
1305
|
-
// This is highly unlikey, but in the case where a sticky event
|
|
1306
|
-
// has appeared in the timeline AND the sticky section, we only
|
|
1307
|
-
// want to emit the event once.
|
|
1308
|
-
!timelineEvents.some(timelineEvent => timelineEvent.getId() === stickyEvent.getId())).forEach(emitEvent);
|
|
1309
|
-
// Decrypt only the last message in all rooms to make sure we can generate a preview
|
|
1310
|
-
// And decrypt all events after the recorded read receipt to ensure an accurate
|
|
1311
|
-
// notification count
|
|
1312
|
-
room.decryptCriticalEvents();
|
|
1313
|
-
});
|
|
1314
|
-
return function (_x4) {
|
|
1315
|
-
return _ref10.apply(this, arguments);
|
|
1316
|
-
};
|
|
1317
|
-
}()));
|
|
1318
|
-
|
|
1319
|
-
// Handle leaves (e.g. kicked rooms)
|
|
1320
|
-
yield Promise.all(leaveRooms.map(/*#__PURE__*/function () {
|
|
1321
|
-
var _ref14 = _asyncToGenerator(function* (leaveObj) {
|
|
1322
|
-
var room = leaveObj.room;
|
|
1323
|
-
var _yield$_this9$mapAndI = yield _this9.mapAndInjectRoomEvents(leaveObj),
|
|
1324
|
-
timelineEvents = _yield$_this9$mapAndI.timelineEvents,
|
|
1325
|
-
stateEvents = _yield$_this9$mapAndI.stateEvents,
|
|
1326
|
-
stateAfterEvents = _yield$_this9$mapAndI.stateAfterEvents;
|
|
1327
|
-
var accountDataEvents = _this9.mapSyncEventsFormat(leaveObj.account_data);
|
|
1328
|
-
room.addAccountData(accountDataEvents);
|
|
1329
|
-
room.recalculate();
|
|
1330
|
-
if (leaveObj.isBrandNewRoom) {
|
|
1331
|
-
client.store.storeRoom(room);
|
|
1332
|
-
client.emit(ClientEvent.Room, room);
|
|
1333
|
-
}
|
|
1334
|
-
_this9.processEventsForNotifs(room, timelineEvents);
|
|
1335
|
-
stateEvents === null || stateEvents === void 0 || stateEvents.forEach(function (e) {
|
|
1336
|
-
client.emit(ClientEvent.Event, e);
|
|
1337
|
-
});
|
|
1338
|
-
stateAfterEvents === null || stateAfterEvents === void 0 || stateAfterEvents.forEach(function (e) {
|
|
1339
|
-
client.emit(ClientEvent.Event, e);
|
|
1340
|
-
});
|
|
1341
|
-
timelineEvents.forEach(function (e) {
|
|
1342
|
-
client.emit(ClientEvent.Event, e);
|
|
1343
|
-
});
|
|
1344
|
-
accountDataEvents.forEach(function (e) {
|
|
1345
|
-
client.emit(ClientEvent.Event, e);
|
|
1346
|
-
});
|
|
1347
|
-
});
|
|
1348
|
-
return function (_x5) {
|
|
1349
|
-
return _ref14.apply(this, arguments);
|
|
1350
|
-
};
|
|
1351
|
-
}()));
|
|
1352
|
-
|
|
1353
|
-
// Handle knocks
|
|
1354
|
-
yield Promise.all(knockRooms.map(/*#__PURE__*/function () {
|
|
1355
|
-
var _ref15 = _asyncToGenerator(function* (knockObj) {
|
|
1356
|
-
var room = knockObj.room;
|
|
1357
|
-
var stateEvents = _this9.mapSyncEventsFormat(knockObj.knock_state, room);
|
|
1358
|
-
yield _this9.injectRoomEvents(room, stateEvents, undefined);
|
|
1359
|
-
if (knockObj.isBrandNewRoom) {
|
|
1360
|
-
room.recalculate();
|
|
1361
|
-
client.store.storeRoom(room);
|
|
1362
|
-
client.emit(ClientEvent.Room, room);
|
|
1363
|
-
} else {
|
|
1364
|
-
// Update room state for knock->leave->knock cycles
|
|
1365
|
-
room.recalculate();
|
|
1194
|
+
if (this.syncOpts.cryptoCallbacks) {
|
|
1195
|
+
for (const e of eventsFormingFinalState) {
|
|
1196
|
+
if (e.isState() && e.getType() === EventType.RoomEncryption && e.getStateKey() === "") {
|
|
1197
|
+
await this.syncOpts.cryptoCallbacks.onCryptoEvent(room, e);
|
|
1366
1198
|
}
|
|
1367
|
-
|
|
1368
|
-
client.emit(ClientEvent.Event, e);
|
|
1369
|
-
});
|
|
1370
|
-
});
|
|
1371
|
-
return function (_x6) {
|
|
1372
|
-
return _ref15.apply(this, arguments);
|
|
1373
|
-
};
|
|
1374
|
-
}()));
|
|
1375
|
-
|
|
1376
|
-
// update the notification timeline, if appropriate.
|
|
1377
|
-
// we only do this for live events, as otherwise we can't order them sanely
|
|
1378
|
-
// in the timeline relative to ones paginated in by /notifications.
|
|
1379
|
-
// XXX: we could fix this by making EventTimeline support chronological
|
|
1380
|
-
// ordering... but it doesn't, right now.
|
|
1381
|
-
if (syncEventData.oldSyncToken && _this9.notifEvents.length) {
|
|
1382
|
-
_this9.notifEvents.sort(function (a, b) {
|
|
1383
|
-
return a.getTs() - b.getTs();
|
|
1384
|
-
});
|
|
1385
|
-
_this9.notifEvents.forEach(function (event) {
|
|
1386
|
-
var _client$getNotifTimel;
|
|
1387
|
-
(_client$getNotifTimel = client.getNotifTimelineSet()) === null || _client$getNotifTimel === void 0 || _client$getNotifTimel.addLiveEvent(event, {
|
|
1388
|
-
addToState: true
|
|
1389
|
-
});
|
|
1390
|
-
});
|
|
1199
|
+
}
|
|
1391
1200
|
}
|
|
1392
1201
|
|
|
1393
|
-
//
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1202
|
+
// Proactively decrypt state events: normally we decrypt on demand, but for state
|
|
1203
|
+
// events we need them immediately, so we handle them here. Specifically, consumers
|
|
1204
|
+
// (e.g. Element Web) expect state events to be unencrypted upon receipt.
|
|
1205
|
+
for (const ev of timelineEvents.filter(ev => ev.isState())) {
|
|
1206
|
+
await this.client.decryptEventIfNeeded(ev);
|
|
1207
|
+
}
|
|
1208
|
+
try {
|
|
1209
|
+
if ("org.matrix.msc4222.state_after" in joinObj) {
|
|
1210
|
+
await this.injectRoomEvents(room, undefined, stateAfterEvents, timelineEvents, syncEventData.fromCache);
|
|
1397
1211
|
} else {
|
|
1398
|
-
|
|
1399
|
-
// invalidate the device lists. But that would require a
|
|
1400
|
-
// substantial bit of rework :/.
|
|
1212
|
+
await this.injectRoomEvents(room, stateEvents, undefined, timelineEvents, syncEventData.fromCache);
|
|
1401
1213
|
}
|
|
1214
|
+
} catch (e) {
|
|
1215
|
+
this.syncOpts.logger.error(`Failed to process events on room ${room.roomId}:`, e);
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
// set summary after processing events,
|
|
1219
|
+
// because it will trigger a name calculation
|
|
1220
|
+
// which needs the room state to be up to date
|
|
1221
|
+
if (joinObj.summary) {
|
|
1222
|
+
room.setSummary(joinObj.summary);
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
// we deliberately don't add ephemeral events to the timeline
|
|
1226
|
+
room.addEphemeralEvents(ephemeralEvents);
|
|
1227
|
+
|
|
1228
|
+
// we deliberately don't add accountData to the timeline
|
|
1229
|
+
room.addAccountData(accountDataEvents);
|
|
1230
|
+
|
|
1231
|
+
// Sticky events primarily come via the `timeline` field, with the
|
|
1232
|
+
// sticky info field marking them as sticky.
|
|
1233
|
+
// If the sync is "gappy" (meaning it is skipping events to catch up) then
|
|
1234
|
+
// sticky events will instead come down the sticky section.
|
|
1235
|
+
// This ensures we collect sticky events from both places.
|
|
1236
|
+
const stickyEventsAndStickyEventsFromTheTimeline = stickyEvents.concat(timelineEvents.filter(e => e.unstableStickyInfo !== undefined));
|
|
1237
|
+
// Note: We calculate sticky events before emitting `.Room` as it's nice to have
|
|
1238
|
+
// sticky events calculated and ready to go.
|
|
1239
|
+
room._unstable_addStickyEvents(stickyEventsAndStickyEventsFromTheTimeline);
|
|
1240
|
+
room.recalculate();
|
|
1241
|
+
if (joinObj.isBrandNewRoom) {
|
|
1242
|
+
client.store.storeRoom(room);
|
|
1243
|
+
client.emit(ClientEvent.Room, room);
|
|
1244
|
+
}
|
|
1245
|
+
this.processEventsForNotifs(room, timelineEvents);
|
|
1246
|
+
const emitEvent = e => client.emit(ClientEvent.Event, e);
|
|
1247
|
+
// this fires a couple of times for some events. (eg state events are in the timeline and the state)
|
|
1248
|
+
// should this get a sync section as an additional event emission param (e, syncSection))?
|
|
1249
|
+
stateEvents.forEach(emitEvent);
|
|
1250
|
+
timelineEvents.forEach(emitEvent);
|
|
1251
|
+
ephemeralEvents.forEach(emitEvent);
|
|
1252
|
+
accountDataEvents.forEach(emitEvent);
|
|
1253
|
+
stickyEvents.filter(stickyEvent =>
|
|
1254
|
+
// This is highly unlikey, but in the case where a sticky event
|
|
1255
|
+
// has appeared in the timeline AND the sticky section, we only
|
|
1256
|
+
// want to emit the event once.
|
|
1257
|
+
!timelineEvents.some(timelineEvent => timelineEvent.getId() === stickyEvent.getId())).forEach(emitEvent);
|
|
1258
|
+
// Decrypt only the last message in all rooms to make sure we can generate a preview
|
|
1259
|
+
// And decrypt all events after the recorded read receipt to ensure an accurate
|
|
1260
|
+
// notification count
|
|
1261
|
+
room.decryptCriticalEvents();
|
|
1262
|
+
}));
|
|
1263
|
+
|
|
1264
|
+
// Handle leaves (e.g. kicked rooms)
|
|
1265
|
+
await Promise.all(leaveRooms.map(async leaveObj => {
|
|
1266
|
+
const room = leaveObj.room;
|
|
1267
|
+
const {
|
|
1268
|
+
timelineEvents,
|
|
1269
|
+
stateEvents,
|
|
1270
|
+
stateAfterEvents
|
|
1271
|
+
} = await this.mapAndInjectRoomEvents(leaveObj);
|
|
1272
|
+
const accountDataEvents = this.mapSyncEventsFormat(leaveObj.account_data);
|
|
1273
|
+
room.addAccountData(accountDataEvents);
|
|
1274
|
+
room.recalculate();
|
|
1275
|
+
if (leaveObj.isBrandNewRoom) {
|
|
1276
|
+
client.store.storeRoom(room);
|
|
1277
|
+
client.emit(ClientEvent.Room, room);
|
|
1402
1278
|
}
|
|
1279
|
+
this.processEventsForNotifs(room, timelineEvents);
|
|
1280
|
+
stateEvents?.forEach(function (e) {
|
|
1281
|
+
client.emit(ClientEvent.Event, e);
|
|
1282
|
+
});
|
|
1283
|
+
stateAfterEvents?.forEach(function (e) {
|
|
1284
|
+
client.emit(ClientEvent.Event, e);
|
|
1285
|
+
});
|
|
1286
|
+
timelineEvents.forEach(function (e) {
|
|
1287
|
+
client.emit(ClientEvent.Event, e);
|
|
1288
|
+
});
|
|
1289
|
+
accountDataEvents.forEach(function (e) {
|
|
1290
|
+
client.emit(ClientEvent.Event, e);
|
|
1291
|
+
});
|
|
1292
|
+
}));
|
|
1293
|
+
|
|
1294
|
+
// Handle knocks
|
|
1295
|
+
await Promise.all(knockRooms.map(async knockObj => {
|
|
1296
|
+
const room = knockObj.room;
|
|
1297
|
+
const stateEvents = this.mapSyncEventsFormat(knockObj.knock_state, room);
|
|
1298
|
+
await this.injectRoomEvents(room, stateEvents, undefined);
|
|
1299
|
+
if (knockObj.isBrandNewRoom) {
|
|
1300
|
+
room.recalculate();
|
|
1301
|
+
client.store.storeRoom(room);
|
|
1302
|
+
client.emit(ClientEvent.Room, room);
|
|
1303
|
+
} else {
|
|
1304
|
+
// Update room state for knock->leave->knock cycles
|
|
1305
|
+
room.recalculate();
|
|
1306
|
+
}
|
|
1307
|
+
stateEvents.forEach(function (e) {
|
|
1308
|
+
client.emit(ClientEvent.Event, e);
|
|
1309
|
+
});
|
|
1310
|
+
}));
|
|
1403
1311
|
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1312
|
+
// update the notification timeline, if appropriate.
|
|
1313
|
+
// we only do this for live events, as otherwise we can't order them sanely
|
|
1314
|
+
// in the timeline relative to ones paginated in by /notifications.
|
|
1315
|
+
// XXX: we could fix this by making EventTimeline support chronological
|
|
1316
|
+
// ordering... but it doesn't, right now.
|
|
1317
|
+
if (syncEventData.oldSyncToken && this.notifEvents.length) {
|
|
1318
|
+
this.notifEvents.sort(function (a, b) {
|
|
1319
|
+
return a.getTs() - b.getTs();
|
|
1320
|
+
});
|
|
1321
|
+
this.notifEvents.forEach(function (event) {
|
|
1322
|
+
client.getNotifTimelineSet()?.addLiveEvent(event, {
|
|
1323
|
+
addToState: true
|
|
1324
|
+
});
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
// Handle device list updates
|
|
1329
|
+
if (data.device_lists) {
|
|
1330
|
+
if (this.syncOpts.cryptoCallbacks) {
|
|
1331
|
+
await this.syncOpts.cryptoCallbacks.processDeviceLists(data.device_lists);
|
|
1332
|
+
} else {
|
|
1333
|
+
// FIXME if we *don't* have a crypto module, we still need to
|
|
1334
|
+
// invalidate the device lists. But that would require a
|
|
1335
|
+
// substantial bit of rework :/.
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
// Handle one_time_keys_count and unused fallback keys
|
|
1340
|
+
await this.syncOpts.cryptoCallbacks?.processKeyCounts(data.device_one_time_keys_count, data.device_unused_fallback_key_types ?? data["org.matrix.msc2732.device_unused_fallback_key_types"]);
|
|
1407
1341
|
}
|
|
1408
1342
|
|
|
1409
1343
|
/**
|
|
@@ -1440,9 +1374,7 @@ export class SyncApi {
|
|
|
1440
1374
|
*
|
|
1441
1375
|
* @param connDidFail - True if a connectivity failure has been detected. Optional.
|
|
1442
1376
|
*/
|
|
1443
|
-
pokeKeepAlive() {
|
|
1444
|
-
var _this$abortController4;
|
|
1445
|
-
var connDidFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
1377
|
+
pokeKeepAlive(connDidFail = false) {
|
|
1446
1378
|
if (!this.running) {
|
|
1447
1379
|
// we are in a keepAlive, retrying to connect, but the syncronization
|
|
1448
1380
|
// was stopped, so we are stopping the retry.
|
|
@@ -1453,7 +1385,7 @@ export class SyncApi {
|
|
|
1453
1385
|
}
|
|
1454
1386
|
return;
|
|
1455
1387
|
}
|
|
1456
|
-
|
|
1388
|
+
const success = () => {
|
|
1457
1389
|
clearTimeout(this.keepAliveTimer);
|
|
1458
1390
|
if (this.connectionReturnedResolvers) {
|
|
1459
1391
|
this.connectionReturnedResolvers.resolve(connDidFail);
|
|
@@ -1467,7 +1399,7 @@ export class SyncApi {
|
|
|
1467
1399
|
{
|
|
1468
1400
|
prefix: "",
|
|
1469
1401
|
localTimeoutMs: 15 * 1000,
|
|
1470
|
-
abortSignal:
|
|
1402
|
+
abortSignal: this.abortController?.signal
|
|
1471
1403
|
}).then(() => {
|
|
1472
1404
|
success();
|
|
1473
1405
|
}, err => {
|
|
@@ -1497,10 +1429,10 @@ export class SyncApi {
|
|
|
1497
1429
|
// Maps { roomid: {stuff}, roomid: {stuff} }
|
|
1498
1430
|
// to
|
|
1499
1431
|
// [{stuff+Room+isBrandNewRoom}, {stuff+Room+isBrandNewRoom}]
|
|
1500
|
-
|
|
1432
|
+
const client = this.client;
|
|
1501
1433
|
return Object.keys(obj).filter(k => !unsafeProp(k)).map(roomId => {
|
|
1502
|
-
|
|
1503
|
-
|
|
1434
|
+
let room = client.store.getRoom(roomId);
|
|
1435
|
+
let isBrandNewRoom = false;
|
|
1504
1436
|
if (!room) {
|
|
1505
1437
|
room = this.createRoom(roomId);
|
|
1506
1438
|
isBrandNewRoom = true;
|
|
@@ -1511,12 +1443,11 @@ export class SyncApi {
|
|
|
1511
1443
|
});
|
|
1512
1444
|
});
|
|
1513
1445
|
}
|
|
1514
|
-
mapSyncEventsFormat(obj, room) {
|
|
1515
|
-
var decrypt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
1446
|
+
mapSyncEventsFormat(obj, room, decrypt = true) {
|
|
1516
1447
|
if (!obj || !Array.isArray(obj.events)) {
|
|
1517
1448
|
return [];
|
|
1518
1449
|
}
|
|
1519
|
-
|
|
1450
|
+
const mapper = this.client.getEventMapper({
|
|
1520
1451
|
decrypt
|
|
1521
1452
|
});
|
|
1522
1453
|
return obj.events.filter(noUnsafeEventProps).map(function (e) {
|
|
@@ -1533,15 +1464,15 @@ export class SyncApi {
|
|
|
1533
1464
|
if (!room || !this.opts.resolveInvitesToProfiles) {
|
|
1534
1465
|
return;
|
|
1535
1466
|
}
|
|
1536
|
-
|
|
1467
|
+
const client = this.client;
|
|
1537
1468
|
// For each invited room member we want to give them a displayname/avatar url
|
|
1538
1469
|
// if they have one (the m.room.member invites don't contain this).
|
|
1539
1470
|
room.getMembersWithMembership(KnownMembership.Invite).forEach(function (member) {
|
|
1540
1471
|
if (member.requestedProfileInfo) return;
|
|
1541
1472
|
member.requestedProfileInfo = true;
|
|
1542
1473
|
// try to get a cached copy first.
|
|
1543
|
-
|
|
1544
|
-
|
|
1474
|
+
const user = client.getUser(member.userId);
|
|
1475
|
+
let promise;
|
|
1545
1476
|
if (user) {
|
|
1546
1477
|
promise = Promise.resolve({
|
|
1547
1478
|
avatar_url: user.avatarUrl,
|
|
@@ -1554,8 +1485,8 @@ export class SyncApi {
|
|
|
1554
1485
|
// slightly naughty by doctoring the invite event but this means all
|
|
1555
1486
|
// the code paths remain the same between invite/join display name stuff
|
|
1556
1487
|
// which is a worthy trade-off for some minor pollution.
|
|
1557
|
-
|
|
1558
|
-
if (
|
|
1488
|
+
const inviteEvent = member.events.member;
|
|
1489
|
+
if (inviteEvent?.getContent().membership !== KnownMembership.Invite) {
|
|
1559
1490
|
// between resolving and now they have since joined, so don't clobber
|
|
1560
1491
|
return;
|
|
1561
1492
|
}
|
|
@@ -1569,7 +1500,7 @@ export class SyncApi {
|
|
|
1569
1500
|
});
|
|
1570
1501
|
}
|
|
1571
1502
|
findEncryptionEvent(events) {
|
|
1572
|
-
return events
|
|
1503
|
+
return events?.find(e => e.getType() === EventType.RoomEncryption && e.getStateKey() === "");
|
|
1573
1504
|
}
|
|
1574
1505
|
|
|
1575
1506
|
// When processing the sync response we cannot rely on Room.hasEncryptionStateEvent we actually
|
|
@@ -1577,23 +1508,20 @@ export class SyncApi {
|
|
|
1577
1508
|
isRoomEncrypted(room, eventsFormingFinalState) {
|
|
1578
1509
|
return room.hasEncryptionStateEvent() || !!this.findEncryptionEvent(eventsFormingFinalState);
|
|
1579
1510
|
}
|
|
1580
|
-
mapAndInjectRoomEvents(wrappedRoom) {
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
stateAfterEvents
|
|
1595
|
-
};
|
|
1596
|
-
})();
|
|
1511
|
+
async mapAndInjectRoomEvents(wrappedRoom) {
|
|
1512
|
+
const stateEvents = this.mapSyncEventsFormat(wrappedRoom.state, wrappedRoom.room);
|
|
1513
|
+
const stateAfterEvents = this.mapSyncEventsFormat(wrappedRoom["org.matrix.msc4222.state_after"], wrappedRoom.room);
|
|
1514
|
+
const timelineEvents = this.mapSyncEventsFormat(wrappedRoom.timeline, wrappedRoom.room);
|
|
1515
|
+
if ("org.matrix.msc4222.state_after" in wrappedRoom) {
|
|
1516
|
+
await this.injectRoomEvents(wrappedRoom.room, undefined, stateAfterEvents, timelineEvents);
|
|
1517
|
+
} else {
|
|
1518
|
+
await this.injectRoomEvents(wrappedRoom.room, stateEvents, undefined, timelineEvents);
|
|
1519
|
+
}
|
|
1520
|
+
return {
|
|
1521
|
+
timelineEvents,
|
|
1522
|
+
stateEvents,
|
|
1523
|
+
stateAfterEvents
|
|
1524
|
+
};
|
|
1597
1525
|
}
|
|
1598
1526
|
|
|
1599
1527
|
/**
|
|
@@ -1612,76 +1540,71 @@ export class SyncApi {
|
|
|
1612
1540
|
* are not added to the state.
|
|
1613
1541
|
*/
|
|
1614
1542
|
|
|
1615
|
-
injectRoomEvents(room, stateEventList, stateAfterEventList, timelineEventList) {
|
|
1616
|
-
|
|
1617
|
-
_this1 = this;
|
|
1618
|
-
return _asyncToGenerator(function* () {
|
|
1619
|
-
var fromCache = _arguments.length > 4 && _arguments[4] !== undefined ? _arguments[4] : false;
|
|
1620
|
-
var eitherStateEventList = stateAfterEventList !== null && stateAfterEventList !== void 0 ? stateAfterEventList : stateEventList;
|
|
1621
|
-
|
|
1622
|
-
// If there are no events in the timeline yet, initialise it with
|
|
1623
|
-
// the given state events
|
|
1624
|
-
var liveTimeline = room.getLiveTimeline();
|
|
1625
|
-
var timelineWasEmpty = liveTimeline.getEvents().length == 0;
|
|
1626
|
-
if (timelineWasEmpty) {
|
|
1627
|
-
// Passing these events into initialiseState will freeze them, so we need
|
|
1628
|
-
// to compute and cache the push actions for them now, otherwise sync dies
|
|
1629
|
-
// with an attempt to assign to read only property.
|
|
1630
|
-
// XXX: This is pretty horrible and is assuming all sorts of behaviour from
|
|
1631
|
-
// these functions that it shouldn't be. We should probably either store the
|
|
1632
|
-
// push actions cache elsewhere so we can freeze MatrixEvents, or otherwise
|
|
1633
|
-
// find some solution where MatrixEvents are immutable but allow for a cache
|
|
1634
|
-
// field.
|
|
1635
|
-
|
|
1636
|
-
for (var ev of eitherStateEventList) {
|
|
1637
|
-
_this1.client.getPushActionsForEvent(ev);
|
|
1638
|
-
}
|
|
1639
|
-
liveTimeline.initialiseState(eitherStateEventList, {
|
|
1640
|
-
timelineWasEmpty
|
|
1641
|
-
});
|
|
1642
|
-
}
|
|
1643
|
-
_this1.resolveInvites(room);
|
|
1644
|
-
|
|
1645
|
-
// recalculate the room name at this point as adding events to the timeline
|
|
1646
|
-
// may make notifications appear which should have the right name.
|
|
1647
|
-
// XXX: This looks suspect: we'll end up recalculating the room once here
|
|
1648
|
-
// and then again after adding events (processSyncResponse calls it after
|
|
1649
|
-
// calling us) even if no state events were added. It also means that if
|
|
1650
|
-
// one of the room events in timelineEventList is something that needs
|
|
1651
|
-
// a recalculation (like m.room.name) we won't recalculate until we've
|
|
1652
|
-
// finished adding all the events, which will cause the notification to have
|
|
1653
|
-
// the old room name rather than the new one.
|
|
1654
|
-
room.recalculate();
|
|
1543
|
+
async injectRoomEvents(room, stateEventList, stateAfterEventList, timelineEventList, fromCache = false) {
|
|
1544
|
+
const eitherStateEventList = stateAfterEventList ?? stateEventList;
|
|
1655
1545
|
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
//
|
|
1662
|
-
//
|
|
1663
|
-
//
|
|
1664
|
-
//
|
|
1665
|
-
//
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1546
|
+
// If there are no events in the timeline yet, initialise it with
|
|
1547
|
+
// the given state events
|
|
1548
|
+
const liveTimeline = room.getLiveTimeline();
|
|
1549
|
+
const timelineWasEmpty = liveTimeline.getEvents().length == 0;
|
|
1550
|
+
if (timelineWasEmpty) {
|
|
1551
|
+
// Passing these events into initialiseState will freeze them, so we need
|
|
1552
|
+
// to compute and cache the push actions for them now, otherwise sync dies
|
|
1553
|
+
// with an attempt to assign to read only property.
|
|
1554
|
+
// XXX: This is pretty horrible and is assuming all sorts of behaviour from
|
|
1555
|
+
// these functions that it shouldn't be. We should probably either store the
|
|
1556
|
+
// push actions cache elsewhere so we can freeze MatrixEvents, or otherwise
|
|
1557
|
+
// find some solution where MatrixEvents are immutable but allow for a cache
|
|
1558
|
+
// field.
|
|
1559
|
+
|
|
1560
|
+
for (const ev of eitherStateEventList) {
|
|
1561
|
+
this.client.getPushActionsForEvent(ev);
|
|
1672
1562
|
}
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
// events in it, this will continue to diverge the current state.
|
|
1676
|
-
// This also needs to be done before running push rules on the events as they need
|
|
1677
|
-
// to be decorated with sender etc.
|
|
1678
|
-
yield room.addLiveEvents(timelineEventList || [], {
|
|
1679
|
-
fromCache,
|
|
1680
|
-
timelineWasEmpty,
|
|
1681
|
-
addToState: stateAfterEventList === undefined
|
|
1563
|
+
liveTimeline.initialiseState(eitherStateEventList, {
|
|
1564
|
+
timelineWasEmpty
|
|
1682
1565
|
});
|
|
1683
|
-
|
|
1684
|
-
|
|
1566
|
+
}
|
|
1567
|
+
this.resolveInvites(room);
|
|
1568
|
+
|
|
1569
|
+
// recalculate the room name at this point as adding events to the timeline
|
|
1570
|
+
// may make notifications appear which should have the right name.
|
|
1571
|
+
// XXX: This looks suspect: we'll end up recalculating the room once here
|
|
1572
|
+
// and then again after adding events (processSyncResponse calls it after
|
|
1573
|
+
// calling us) even if no state events were added. It also means that if
|
|
1574
|
+
// one of the room events in timelineEventList is something that needs
|
|
1575
|
+
// a recalculation (like m.room.name) we won't recalculate until we've
|
|
1576
|
+
// finished adding all the events, which will cause the notification to have
|
|
1577
|
+
// the old room name rather than the new one.
|
|
1578
|
+
room.recalculate();
|
|
1579
|
+
|
|
1580
|
+
// If the timeline wasn't empty, we process the state events here: they're
|
|
1581
|
+
// defined as updates to the state before the start of the timeline, so this
|
|
1582
|
+
// starts to roll the state forward.
|
|
1583
|
+
// XXX: That's what we *should* do, but this can happen if we were previously
|
|
1584
|
+
// peeking in a room, in which case we obviously do *not* want to add the
|
|
1585
|
+
// state events here onto the end of the timeline. Historically, the js-sdk
|
|
1586
|
+
// has just set these new state events on the old and new state. This seems
|
|
1587
|
+
// very wrong because there could be events in the timeline that diverge the
|
|
1588
|
+
// state, in which case this is going to leave things out of sync. However,
|
|
1589
|
+
// for now I think it;s best to behave the same as the code has done previously.
|
|
1590
|
+
if (!timelineWasEmpty) {
|
|
1591
|
+
// XXX: As above, don't do this...
|
|
1592
|
+
//room.addLiveEvents(stateEventList || []);
|
|
1593
|
+
// Do this instead...
|
|
1594
|
+
room.oldState.setStateEvents(eitherStateEventList);
|
|
1595
|
+
room.currentState.setStateEvents(eitherStateEventList);
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
// Execute the timeline events. If addToState is true the timeline has any state
|
|
1599
|
+
// events in it, this will continue to diverge the current state.
|
|
1600
|
+
// This also needs to be done before running push rules on the events as they need
|
|
1601
|
+
// to be decorated with sender etc.
|
|
1602
|
+
await room.addLiveEvents(timelineEventList || [], {
|
|
1603
|
+
fromCache,
|
|
1604
|
+
timelineWasEmpty,
|
|
1605
|
+
addToState: stateAfterEventList === undefined
|
|
1606
|
+
});
|
|
1607
|
+
this.client.processBeaconEvents(room, timelineEventList);
|
|
1685
1608
|
}
|
|
1686
1609
|
|
|
1687
1610
|
/**
|
|
@@ -1695,10 +1618,9 @@ export class SyncApi {
|
|
|
1695
1618
|
processEventsForNotifs(room, timelineEventList) {
|
|
1696
1619
|
// gather our notifications into this.notifEvents
|
|
1697
1620
|
if (this.client.getNotifTimelineSet()) {
|
|
1698
|
-
for (
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
if (pushActions !== null && pushActions !== void 0 && pushActions.notify && (_pushActions$tweaks = pushActions.tweaks) !== null && _pushActions$tweaks !== void 0 && _pushActions$tweaks.highlight) {
|
|
1621
|
+
for (const event of timelineEventList) {
|
|
1622
|
+
const pushActions = this.client.getPushActionsForEvent(event);
|
|
1623
|
+
if (pushActions?.notify && pushActions.tweaks?.highlight) {
|
|
1702
1624
|
this.notifEvents.push(event);
|
|
1703
1625
|
}
|
|
1704
1626
|
}
|
|
@@ -1716,7 +1638,7 @@ export class SyncApi {
|
|
|
1716
1638
|
* @param data - Object of additional data to emit in the event
|
|
1717
1639
|
*/
|
|
1718
1640
|
updateSyncState(newState, data) {
|
|
1719
|
-
|
|
1641
|
+
const old = this.syncState;
|
|
1720
1642
|
this.syncState = newState;
|
|
1721
1643
|
this.syncStateData = data;
|
|
1722
1644
|
this.client.emit(ClientEvent.Sync, this.syncState, old, data);
|
|
@@ -1726,8 +1648,10 @@ export class SyncApi {
|
|
|
1726
1648
|
// /!\ This function is not intended for public use! It's only exported from
|
|
1727
1649
|
// here in order to share some common logic with sliding-sync-sdk.ts.
|
|
1728
1650
|
export function _createAndReEmitRoom(client, roomId, opts) {
|
|
1729
|
-
|
|
1730
|
-
|
|
1651
|
+
const {
|
|
1652
|
+
timelineSupport
|
|
1653
|
+
} = client;
|
|
1654
|
+
const room = new Room(roomId, client, client.getUserId(), {
|
|
1731
1655
|
lazyLoadMembers: opts.lazyLoadMembers,
|
|
1732
1656
|
pendingEventOrdering: opts.pendingEventOrdering,
|
|
1733
1657
|
timelineSupport
|
|
@@ -1737,8 +1661,7 @@ export function _createAndReEmitRoom(client, roomId, opts) {
|
|
|
1737
1661
|
// We need to add a listener for RoomState.members in order to hook them
|
|
1738
1662
|
// correctly.
|
|
1739
1663
|
room.on(RoomStateEvent.NewMember, (event, state, member) => {
|
|
1740
|
-
|
|
1741
|
-
member.user = (_client$getUser = client.getUser(member.userId)) !== null && _client$getUser !== void 0 ? _client$getUser : undefined;
|
|
1664
|
+
member.user = client.getUser(member.userId) ?? undefined;
|
|
1742
1665
|
client.reEmitter.reEmit(member, [RoomMemberEvent.Name, RoomMemberEvent.Typing, RoomMemberEvent.PowerLevel, RoomMemberEvent.Membership]);
|
|
1743
1666
|
});
|
|
1744
1667
|
return room;
|
|
@@ -1751,7 +1674,7 @@ export function _createAndReEmitRoom(client, roomId, opts) {
|
|
|
1751
1674
|
* Also converts the events into `MatrixEvent`s, and emits the now deprecated {@link ClientEvent.ToDeviceEvent} events for compatibility.
|
|
1752
1675
|
* */
|
|
1753
1676
|
export function processToDeviceMessages(toDeviceMessages, client) {
|
|
1754
|
-
|
|
1677
|
+
const cancelledKeyVerificationTxns = [];
|
|
1755
1678
|
toDeviceMessages.map(processedMessage => {
|
|
1756
1679
|
// map is a cheap inline forEach
|
|
1757
1680
|
// We want to flag m.key.verification.start events as cancelled
|
|
@@ -1760,7 +1683,7 @@ export function processToDeviceMessages(toDeviceMessages, client) {
|
|
|
1760
1683
|
// so we can flag the verification events as cancelled in the loop
|
|
1761
1684
|
// below.
|
|
1762
1685
|
if (processedMessage.message.type === "m.key.verification.cancel") {
|
|
1763
|
-
|
|
1686
|
+
const txnId = processedMessage.message.content["transaction_id"];
|
|
1764
1687
|
if (txnId) {
|
|
1765
1688
|
cancelledKeyVerificationTxns.push(txnId);
|
|
1766
1689
|
}
|
|
@@ -1772,14 +1695,14 @@ export function processToDeviceMessages(toDeviceMessages, client) {
|
|
|
1772
1695
|
}).forEach(function (processedEvent) {
|
|
1773
1696
|
// For backwards compatibility, we also emit the event as a `MatrixEvent` using `ClientEvent.ToDeviceEvent`.
|
|
1774
1697
|
{
|
|
1775
|
-
|
|
1776
|
-
|
|
1698
|
+
const toDeviceEvent = processedEvent.message;
|
|
1699
|
+
const content = toDeviceEvent.content;
|
|
1777
1700
|
// The message is cloned before being passed to the MatrixEvent constructor, because
|
|
1778
1701
|
// the `makeEncrypted` method will mutate the type and content properties of the original message and will interfere
|
|
1779
1702
|
// with the emitted event for `ReceivedToDeviceMessage`.
|
|
1780
|
-
|
|
1703
|
+
const deprecatedCompatibilityEvent = new MatrixEvent(Object.assign({}, toDeviceEvent));
|
|
1781
1704
|
if (toDeviceEvent.type === "m.key.verification.start" || toDeviceEvent.type === "m.key.verification.request") {
|
|
1782
|
-
|
|
1705
|
+
const txnId = content["transaction_id"];
|
|
1783
1706
|
if (cancelledKeyVerificationTxns.includes(txnId)) {
|
|
1784
1707
|
deprecatedCompatibilityEvent.flagCancelled();
|
|
1785
1708
|
}
|