@openclaw/matrix 2026.8.1-beta.2 → 2026.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-config-BZWN9tGS.js → account-config-CRsKoMqJ.js} +1 -1
- package/dist/{account-selection-CWuhuFn1.js → account-selection-C8nnBTxi.js} +63 -27
- package/dist/{accounts-BCzyubQt.js → accounts-fC57n-Jo.js} +3 -4
- package/dist/api.js +7 -7
- package/dist/{approval-handler.runtime-CJXCUdRg.js → approval-handler.runtime-BBjFZw1t.js} +9 -6
- package/dist/{approval-ids-7rf7etWE.js → approval-ids-DTIdXV-m.js} +1 -1
- package/dist/{approval-reaction-auth-wBwbEDpZ.js → approval-reaction-auth-BDONXxnF.js} +2 -2
- package/dist/{channel-VSrHgTON.js → channel-BkEcVUs_.js} +249 -24
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-pOOL0uT_.js → channel.runtime-CTLSBFsP.js} +26 -16
- package/dist/{channel.setup-PpxRP9Du.js → channel.setup-CSacbORr.js} +11 -12
- package/dist/{cli-CkTfKC_c.js → cli-DRVtgrq5.js} +15 -14
- package/dist/{cli-metadata-B1d1aGM5.js → cli-metadata-Ddx_y4Os.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{client-sJesKQmp.js → client-CZ_JvrO0.js} +2 -2
- package/dist/{client-bootstrap-BFwT_2VT.js → client-bootstrap-D8irSL2i.js} +1 -1
- package/dist/{client-CeGw0G5S.js → client-kSi51NKp.js} +86 -62
- package/dist/{config-update-Bor_Pjsv.js → config-update-DC0fWBxc.js} +2 -3
- package/dist/contract-api.js +2 -2
- package/dist/{crypto-runtime-Bnz3zEcS.js → crypto-runtime-C4WDYxlP.js} +1 -1
- package/dist/{directory-live-Bvg2wAnR.js → directory-live-DKr0w35b.js} +3 -3
- package/dist/doctor-contract-api.js +9 -3
- package/dist/{draft-stream-BRi7PRRS.js → draft-stream-0CEpNrBk.js} +1 -1
- package/dist/{encryption-guidance-DmLY8NiO.js → encryption-guidance-D4ZdAqzM.js} +1 -1
- package/dist/event-helpers-XRfAbOIh.js +46 -0
- package/dist/helper-api.js +1 -1
- package/dist/{http-client-CycYxU9-.js → http-client-D8o8b9u6.js} +3 -47
- package/dist/{idb-persistence-BM0P27Zg.js → idb-persistence-DfgW720p.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{messages-BW0s-6Y9.js → messages-DaGRt-tu.js} +183 -27
- package/dist/{monitor-Ddfc-vjX.js → monitor-CLPbPcR9.js} +225 -173
- package/dist/plugin-entry.handlers.runtime.js +1 -1
- package/dist/probe.runtime-Bxpr1FFy.js +2 -0
- package/dist/{profile-update-BkgWYDIp.js → profile-update-zXVCMg7y.js} +2 -2
- package/dist/{reaction-events-nfUbFLdV.js → reaction-events-CjVUiqcY.js} +5 -5
- package/dist/{resolve-targets-BJAPY4Vb.js → resolve-targets-qG6gceps.js} +2 -2
- package/dist/{resolver.runtime-LWJELYq5.js → resolver.runtime-zX3TR3TN.js} +1 -1
- package/dist/{room-info-BXQA7y10.js → room-info-yheP1mod.js} +55 -1
- package/dist/runtime-api.js +2 -2
- package/dist/{sdk-DjaQFCHc.js → sdk-TZYyo0XQ.js} +74 -29
- package/dist/{send-ZDLU4JTk.js → send-BL_iH5Ox.js} +55 -35
- package/dist/session-binding-contract-api.js +2 -3
- package/dist/{setup-bootstrap-BaXkhgJg.js → setup-bootstrap-D8M7FmcO.js} +3 -3
- package/dist/{setup-core-DQn6b5vi.js → setup-core-r6L0nno-.js} +5 -5
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-DlhJdrNI.js → setup-surface-g174ElFO.js} +14 -14
- package/dist/subagent-hooks-CMoZaARG.js +48 -0
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{target-ids-B-5aQxwn.js → target-ids-Nwx7cMVE.js} +11 -1
- package/dist/{thread-binding-api-DRbBZlhS.js → thread-binding-api-CzkeLZCU.js} +1 -1
- package/dist/thread-binding-api.js +1 -1
- package/dist/{thread-bindings-CcHZP3w2.js → thread-bindings-ERWNousC.js} +13 -9
- package/dist/thread-bindings-runtime.js +1 -1
- package/dist/{thread-bindings-shared-CKnY4LSd.js → thread-bindings-shared-oNPiyMWY.js} +1 -6
- package/dist/{tool-actions.runtime-DmdRL0bN.js → tool-actions.runtime-DcBCSwY4.js} +57 -65
- package/dist/{verification-C7ig-bQE.js → verification-4vsW_WSn.js} +2 -2
- package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/CHANGELOG.md +29 -3
- package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/README.md +23 -14
- package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/RELEASING.md +6 -2
- package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/download-lib.js +33 -14
- package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/index.d.ts +14 -0
- package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/package.json +41 -42
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/package.json +1 -1
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm.d.ts +16 -4
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.cjs +25 -9
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.js +23 -7
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm +0 -0
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm.d.ts +1 -0
- package/node_modules/markdown-it/README.md +18 -294
- package/node_modules/markdown-it/bin/markdown-it.mjs +2 -2
- package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs +2972 -0
- package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs.map +1 -0
- package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js +14 -0
- package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js.map +1 -0
- package/node_modules/markdown-it/dist/markdown-it.cjs.js +4412 -0
- package/node_modules/markdown-it/dist/markdown-it.cjs.js.map +1 -0
- package/node_modules/markdown-it/dist/markdown-it.d.cts +19 -0
- package/node_modules/markdown-it/dist/markdown-it.d.mts +979 -0
- package/node_modules/markdown-it/dist/{index.cjs.js → markdown-it.mjs} +1437 -1466
- package/node_modules/markdown-it/dist/markdown-it.mjs.map +1 -0
- package/node_modules/markdown-it/node_modules/argparse/README.md +46 -41
- package/node_modules/markdown-it/node_modules/argparse/lib/_colorize.js +72 -0
- package/node_modules/markdown-it/node_modules/argparse/lib/argparse.d.ts +292 -0
- package/node_modules/markdown-it/node_modules/argparse/{argparse.js → lib/argparse.js} +1124 -1027
- package/node_modules/markdown-it/node_modules/argparse/lib/difflib.js +190 -0
- package/node_modules/markdown-it/node_modules/argparse/lib/sub.js +4 -4
- package/node_modules/markdown-it/node_modules/argparse/lib/textwrap.js +28 -28
- package/node_modules/markdown-it/node_modules/argparse/package.json +17 -10
- package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.d.ts +8 -0
- package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.js +46 -0
- package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/{lib/esm → dist}/decode.d.ts +28 -45
- package/node_modules/markdown-it/node_modules/entities/dist/decode.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/{lib/esm → dist}/decode.js +189 -141
- package/node_modules/markdown-it/node_modules/entities/dist/decode.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/{lib/esm → dist}/encode.d.ts +4 -2
- package/node_modules/markdown-it/node_modules/entities/dist/encode.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/encode.js +90 -0
- package/node_modules/markdown-it/node_modules/entities/dist/encode.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/{lib → dist}/escape.d.ts +15 -10
- package/node_modules/markdown-it/node_modules/entities/dist/escape.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/escape.js +132 -0
- package/node_modules/markdown-it/node_modules/entities/dist/escape.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.d.ts +3 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.js +5 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.d.ts +3 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.js +5 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.d.ts +5 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.js +12 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/{lib/esm → dist}/index.d.ts +14 -21
- package/node_modules/markdown-it/node_modules/entities/dist/index.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/index.js +91 -0
- package/node_modules/markdown-it/node_modules/entities/dist/index.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.d.ts +17 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.js +18 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.d.ts +7 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.js +17 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.d.ts +33 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.js +93 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/package.json +63 -70
- package/node_modules/markdown-it/node_modules/entities/readme.md +54 -45
- package/node_modules/markdown-it/node_modules/entities/src/decode-codepoint.ts +50 -0
- package/node_modules/markdown-it/node_modules/entities/src/decode.ts +671 -0
- package/node_modules/markdown-it/node_modules/entities/src/encode.ts +95 -0
- package/node_modules/markdown-it/node_modules/entities/src/escape.ts +160 -0
- package/node_modules/markdown-it/node_modules/entities/src/generated/decode-data-html.ts +7 -0
- package/node_modules/markdown-it/node_modules/entities/src/generated/decode-data-xml.ts +7 -0
- package/node_modules/markdown-it/node_modules/entities/src/generated/encode-html.ts +18 -0
- package/node_modules/markdown-it/node_modules/entities/src/index.ts +162 -0
- package/node_modules/markdown-it/node_modules/entities/src/internal/bin-trie-flags.ts +16 -0
- package/node_modules/markdown-it/node_modules/entities/src/internal/decode-shared.ts +18 -0
- package/node_modules/markdown-it/node_modules/entities/src/internal/encode-shared.ts +123 -0
- package/node_modules/markdown-it/node_modules/linkify-it/README.md +49 -86
- package/node_modules/markdown-it/node_modules/linkify-it/build/index.cjs.js +636 -825
- package/node_modules/markdown-it/node_modules/linkify-it/build/index.cjs.js.map +1 -0
- package/node_modules/markdown-it/node_modules/linkify-it/build/index.d.ts +236 -0
- package/node_modules/markdown-it/node_modules/linkify-it/build/index.mjs +538 -0
- package/node_modules/markdown-it/node_modules/linkify-it/build/index.mjs.map +1 -0
- package/node_modules/markdown-it/node_modules/linkify-it/package.json +23 -20
- package/node_modules/markdown-it/node_modules/uc.micro/README.md +18 -1
- package/node_modules/markdown-it/node_modules/uc.micro/build/index.cjs.js +13 -18
- package/node_modules/markdown-it/node_modules/uc.micro/build/index.d.ts +6 -0
- package/node_modules/markdown-it/node_modules/uc.micro/build/index.mjs +8 -0
- package/node_modules/markdown-it/node_modules/uc.micro/package.json +12 -17
- package/node_modules/markdown-it/package.json +48 -30
- package/node_modules/matrix-js-sdk/CHANGELOG.md +33 -0
- package/node_modules/matrix-js-sdk/lib/@types/PushRules.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/PushRules.js +0 -5
- package/node_modules/matrix-js-sdk/lib/@types/PushRules.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/auth.d.ts +0 -5
- package/node_modules/matrix-js-sdk/lib/@types/auth.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/auth.js +0 -11
- package/node_modules/matrix-js-sdk/lib/@types/auth.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/beacon.d.ts +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/beacon.js +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/beacon.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/crypto.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/crypto.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/event.d.ts +3 -1
- package/node_modules/matrix-js-sdk/lib/@types/event.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/event.js +1 -0
- package/node_modules/matrix-js-sdk/lib/@types/event.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/extensible_events.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/extensible_events.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/matrix-sdk-crypto-wasm.d.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/media.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/partials.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/partials.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/requests.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/requests.js +0 -5
- package/node_modules/matrix-js-sdk/lib/@types/requests.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/search.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/search.js +0 -3
- package/node_modules/matrix-js-sdk/lib/@types/search.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/spaces.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/spaces.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/synapse.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/synapse.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/threepids.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/@types/type-guards.d.ts +43 -0
- package/node_modules/matrix-js-sdk/lib/@types/type-guards.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/@types/type-guards.js +104 -0
- package/node_modules/matrix-js-sdk/lib/@types/type-guards.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/NamespacedValue.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/ReEmitter.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/ToDeviceMessageQueue.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/ToDeviceMessageQueue.js +0 -2
- package/node_modules/matrix-js-sdk/lib/ToDeviceMessageQueue.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/autodiscovery.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/autodiscovery.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/browser-index.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/browser-index.js +3 -1
- package/node_modules/matrix-js-sdk/lib/browser-index.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/capabilityPoller.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/client.d.ts +21 -20
- package/node_modules/matrix-js-sdk/lib/client.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/client.js +38 -94
- package/node_modules/matrix-js-sdk/lib/client.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/common-crypto/CryptoBackend.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/common-crypto/key-passphrase.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/common-crypto/key-passphrase.js +1 -4
- package/node_modules/matrix-js-sdk/lib/common-crypto/key-passphrase.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/content-helpers.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/base.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/base.js +0 -9
- package/node_modules/matrix-js-sdk/lib/crypto/store/base.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store-backend.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store-backend.js +2 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store-backend.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store.js +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/localStorage-crypto-store.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/localStorage-crypto-store.js +0 -2
- package/node_modules/matrix-js-sdk/lib/crypto/store/localStorage-crypto-store.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/memory-crypto-store.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto/store/memory-crypto-store.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto-api/index.d.ts +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto-api/index.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto-api/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto-api/keybackup.d.ts +13 -6
- package/node_modules/matrix-js-sdk/lib/crypto-api/keybackup.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto-api/keybackup.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto-api/verification.d.ts +23 -5
- package/node_modules/matrix-js-sdk/lib/crypto-api/verification.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/crypto-api/verification.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/embedded.d.ts +16 -0
- package/node_modules/matrix-js-sdk/lib/embedded.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/embedded.js +19 -11
- package/node_modules/matrix-js-sdk/lib/embedded.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/errors.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/ExtensibleEvent.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/InvalidEventError.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/MessageEvent.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollEndEvent.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollResponseEvent.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollStartEvent.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/feature.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/feature.js +0 -3
- package/node_modules/matrix-js-sdk/lib/feature.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/filter-component.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/filter-component.js +2 -5
- package/node_modules/matrix-js-sdk/lib/filter-component.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/filter.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/filter.js +0 -4
- package/node_modules/matrix-js-sdk/lib/filter.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/errors.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/fetch.d.ts +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/fetch.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/fetch.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/index.d.ts +1 -7
- package/node_modules/matrix-js-sdk/lib/http-api/index.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/index.js +0 -15
- package/node_modules/matrix-js-sdk/lib/http-api/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/interface.d.ts +0 -9
- package/node_modules/matrix-js-sdk/lib/http-api/interface.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/interface.js +0 -2
- package/node_modules/matrix-js-sdk/lib/http-api/interface.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/refresh.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/http-api/refresh.js +0 -3
- package/node_modules/matrix-js-sdk/lib/http-api/refresh.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/index.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/interactive-auth.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/interactive-auth.js +5 -6
- package/node_modules/matrix-js-sdk/lib/interactive-auth.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/logger.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/logger.js +0 -2
- package/node_modules/matrix-js-sdk/lib/logger.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrix.d.ts +1 -1
- package/node_modules/matrix-js-sdk/lib/matrix.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrix.js +1 -1
- package/node_modules/matrix-js-sdk/lib/matrix.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.d.ts +3 -3
- package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.js +5 -5
- package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/LivekitTransport.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.d.ts +18 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.js +56 -4
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.d.ts +14 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.js +20 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.js +9 -6
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManagerActionScheduler.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManagerActionScheduler.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/RTCEncryptionManager.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/RTCEncryptionManager.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/ToDeviceKeyTransport.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/ToDeviceKeyTransport.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/index.d.ts +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/index.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/index.js +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/common.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.d.ts +6 -3
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.js +7 -4
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/session.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/types.d.ts +19 -6
- package/node_modules/matrix-js-sdk/lib/matrixrtc/types.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/types.js +11 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/types.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.d.ts +0 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.js +0 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/MSC3089Branch.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/MSC3089TreeSpace.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/beacon.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/device.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/event-context.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/event-timeline-set.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/event-timeline-set.js +3 -3
- package/node_modules/matrix-js-sdk/lib/models/event-timeline-set.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/event-timeline.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/event.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/event.js +0 -6
- package/node_modules/matrix-js-sdk/lib/models/event.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/invites-ignorer.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/invites-ignorer.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/poll.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/poll.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/read-receipt.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/read-receipt.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/related-relations.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/relations-container.d.ts +10 -0
- package/node_modules/matrix-js-sdk/lib/models/relations-container.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/relations-container.js +39 -17
- package/node_modules/matrix-js-sdk/lib/models/relations-container.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/relations.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/relations.js +1 -1
- package/node_modules/matrix-js-sdk/lib/models/relations.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room-member.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room-receipts.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room-retention.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room-state.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room-state.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room-sticky-events.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room-summary.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room.js +9 -9
- package/node_modules/matrix-js-sdk/lib/models/room.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/search-result.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/thread.d.ts +5 -2
- package/node_modules/matrix-js-sdk/lib/models/thread.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/thread.js +36 -3
- package/node_modules/matrix-js-sdk/lib/models/thread.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/typed-event-emitter.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/user.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/oauth/authorize.d.ts +133 -0
- package/node_modules/matrix-js-sdk/lib/oauth/authorize.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/authorize.js +193 -0
- package/node_modules/matrix-js-sdk/lib/oauth/authorize.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/discover.d.ts +58 -0
- package/node_modules/matrix-js-sdk/lib/oauth/discover.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/discover.js +35 -0
- package/node_modules/matrix-js-sdk/lib/oauth/discover.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/error.d.ts +19 -0
- package/node_modules/matrix-js-sdk/lib/oauth/error.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/error.js +36 -0
- package/node_modules/matrix-js-sdk/lib/oauth/error.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/index.d.ts +87 -0
- package/node_modules/matrix-js-sdk/lib/oauth/index.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/index.js +236 -0
- package/node_modules/matrix-js-sdk/lib/oauth/index.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/register.d.ts +136 -0
- package/node_modules/matrix-js-sdk/lib/oauth/register.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/register.js +73 -0
- package/node_modules/matrix-js-sdk/lib/oauth/register.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/tokenRefresher.d.ts +21 -0
- package/node_modules/matrix-js-sdk/lib/oauth/tokenRefresher.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/oauth/tokenRefresher.js +68 -0
- package/node_modules/matrix-js-sdk/lib/oauth/tokenRefresher.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/pollingCachedValue.d.ts +77 -0
- package/node_modules/matrix-js-sdk/lib/pollingCachedValue.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/pollingCachedValue.js +160 -0
- package/node_modules/matrix-js-sdk/lib/pollingCachedValue.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/pushprocessor.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/pushprocessor.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/realtime-callbacks.js +0 -1
- package/node_modules/matrix-js-sdk/lib/realtime-callbacks.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/receipt-accumulator.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/receipt-accumulator.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.d.ts +7 -7
- package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.js +13 -14
- package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousError.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/channels/MSC4108SecureChannel.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/index.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/transports/MSC4108RendezvousSession.js +0 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/retentionPolicy.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/room-hierarchy.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rtcTransportsCachedValue.d.ts +9 -0
- package/node_modules/matrix-js-sdk/lib/rtcTransportsCachedValue.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/rtcTransportsCachedValue.js +38 -0
- package/node_modules/matrix-js-sdk/lib/rtcTransportsCachedValue.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/rust-crypto/CrossSigningIdentity.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.js +11 -13
- package/node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/KeyClaimManager.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.js +0 -2
- package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestsManager.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/RoomEncryptor.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.d.ts +23 -4
- package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.js +62 -21
- package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/device-converter.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/device-converter.js +1 -0
- package/node_modules/matrix-js-sdk/lib/rust-crypto/device-converter.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/index.d.ts +17 -4
- package/node_modules/matrix-js-sdk/lib/rust-crypto/index.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/index.js +21 -4
- package/node_modules/matrix-js-sdk/lib/rust-crypto/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/libolm_migration.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/libolm_migration.js +0 -2
- package/node_modules/matrix-js-sdk/lib/rust-crypto/libolm_migration.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.js +0 -3
- package/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/verification.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/scheduler.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/scheduler.js +0 -3
- package/node_modules/matrix-js-sdk/lib/scheduler.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/secret-storage.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/serverCapabilities.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/sliding-sync-sdk.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/sliding-sync-sdk.js +6 -0
- package/node_modules/matrix-js-sdk/lib/sliding-sync-sdk.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/sliding-sync.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/sliding-sync.js +3 -0
- package/node_modules/matrix-js-sdk/lib/sliding-sync.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/indexeddb-local-backend.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/indexeddb-local-backend.js +1 -1
- package/node_modules/matrix-js-sdk/lib/store/indexeddb-local-backend.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/indexeddb-remote-backend.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/indexeddb-store-worker.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/indexeddb-store-worker.js +1 -0
- package/node_modules/matrix-js-sdk/lib/store/indexeddb-store-worker.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/indexeddb.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/indexeddb.js +0 -2
- package/node_modules/matrix-js-sdk/lib/store/indexeddb.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/memory.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/memory.js +7 -9
- package/node_modules/matrix-js-sdk/lib/store/memory.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/store/stub.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/sync-accumulator.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/sync-accumulator.js +1 -5
- package/node_modules/matrix-js-sdk/lib/sync-accumulator.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/sync.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/sync.js +1 -1
- package/node_modules/matrix-js-sdk/lib/sync.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/testing.d.ts +2 -10
- package/node_modules/matrix-js-sdk/lib/testing.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/testing.js +4 -19
- package/node_modules/matrix-js-sdk/lib/testing.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/timeline-window.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/timeline-window.js +0 -1
- package/node_modules/matrix-js-sdk/lib/timeline-window.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/utils/internal/deriveKeys.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/utils/internal/deriveKeys.js +0 -1
- package/node_modules/matrix-js-sdk/lib/utils/internal/deriveKeys.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/utils.d.ts +1 -1
- package/node_modules/matrix-js-sdk/lib/utils.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/utils.js +1 -0
- package/node_modules/matrix-js-sdk/lib/utils.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/call.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/call.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/callEventHandler.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/callEventTypes.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/callEventTypes.js +0 -5
- package/node_modules/matrix-js-sdk/lib/webrtc/callEventTypes.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/callFeed.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/groupCall.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/groupCall.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/groupCallEventHandler.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/mediaHandler.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/mediaHandler.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/callFeedStatsReporter.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/callStatsReportGatherer.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/callStatsReportGatherer.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStatsBuilder.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStatsReportBuilder.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/groupCallStats.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaSsrcHandler.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackHandler.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackStats.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/statsReportEmitter.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/summaryStatsReportGatherer.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/trackStatsBuilder.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/transportStatsBuilder.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/transportStatsBuilder.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/webrtc/stats/valueFormatter.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/wellKnownCachedValue.d.ts +8 -0
- package/node_modules/matrix-js-sdk/lib/wellKnownCachedValue.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/wellKnownCachedValue.js +34 -0
- package/node_modules/matrix-js-sdk/lib/wellKnownCachedValue.js.map +1 -0
- package/node_modules/matrix-js-sdk/node_modules/content-type/README.md +2 -0
- package/node_modules/matrix-js-sdk/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/matrix-js-sdk/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/matrix-js-sdk/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/node_modules/content-type/package.json +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/dist/api.js +227 -131
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/dist/api.min.js +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/ClientWidgetApi.d.ts +1 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/ClientWidgetApi.js +142 -97
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/ClientWidgetApi.js.map +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/WidgetApi.d.ts +15 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/WidgetApi.js +61 -19
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/WidgetApi.js.map +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/driver/WidgetDriver.d.ts +15 -11
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/driver/WidgetDriver.js +19 -13
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/driver/WidgetDriver.js.map +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/index.d.ts +1 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/ApiVersion.d.ts +2 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/ApiVersion.js +2 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/ApiVersion.js.map +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/Capabilities.d.ts +5 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/Capabilities.js +1 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/Capabilities.js.map +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/RtcTransportsAction.d.ts +24 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/RtcTransportsAction.js +6 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/RtcTransportsAction.js.map +1 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/SendEventAction.d.ts +1 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/SendEventAction.js.map +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/WidgetApiAction.d.ts +5 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/WidgetApiAction.js +1 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/WidgetApiAction.js.map +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/package.json +1 -1
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/ClientWidgetApi.ts +37 -14
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/WidgetApi.ts +69 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/driver/WidgetDriver.ts +19 -12
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/index.ts +1 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/interfaces/ApiVersion.ts +2 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/interfaces/Capabilities.ts +4 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/interfaces/RtcTransportsAction.ts +44 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/interfaces/SendEventAction.ts +1 -0
- package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/interfaces/WidgetApiAction.ts +5 -0
- package/node_modules/matrix-js-sdk/package.json +10 -12
- package/node_modules/matrix-js-sdk/src/@types/PushRules.ts +0 -5
- package/node_modules/matrix-js-sdk/src/@types/auth.ts +0 -12
- package/node_modules/matrix-js-sdk/src/@types/beacon.ts +1 -1
- package/node_modules/matrix-js-sdk/src/@types/crypto.ts +2 -6
- package/node_modules/matrix-js-sdk/src/@types/event.ts +3 -0
- package/node_modules/matrix-js-sdk/src/@types/extensible_events.ts +5 -6
- package/node_modules/matrix-js-sdk/src/@types/matrix-sdk-crypto-wasm.d.ts +0 -1
- package/node_modules/matrix-js-sdk/src/@types/media.ts +1 -1
- package/node_modules/matrix-js-sdk/src/@types/partials.ts +0 -2
- package/node_modules/matrix-js-sdk/src/@types/requests.ts +0 -5
- package/node_modules/matrix-js-sdk/src/@types/search.ts +0 -2
- package/node_modules/matrix-js-sdk/src/@types/spaces.ts +0 -2
- package/node_modules/matrix-js-sdk/src/@types/synapse.ts +0 -2
- package/node_modules/matrix-js-sdk/src/@types/threepids.ts +2 -2
- package/node_modules/matrix-js-sdk/src/@types/type-guards.ts +126 -0
- package/node_modules/matrix-js-sdk/src/ToDeviceMessageQueue.ts +0 -2
- package/node_modules/matrix-js-sdk/src/autodiscovery.ts +2 -2
- package/node_modules/matrix-js-sdk/src/browser-index.ts +4 -4
- package/node_modules/matrix-js-sdk/src/client.ts +79 -130
- package/node_modules/matrix-js-sdk/src/common-crypto/key-passphrase.ts +1 -2
- package/node_modules/matrix-js-sdk/src/crypto/store/base.ts +1 -8
- package/node_modules/matrix-js-sdk/src/crypto/store/indexeddb-crypto-store-backend.ts +3 -2
- package/node_modules/matrix-js-sdk/src/crypto/store/indexeddb-crypto-store.ts +1 -3
- package/node_modules/matrix-js-sdk/src/crypto/store/localStorage-crypto-store.ts +0 -1
- package/node_modules/matrix-js-sdk/src/crypto/store/memory-crypto-store.ts +1 -1
- package/node_modules/matrix-js-sdk/src/crypto-api/index.ts +1 -1
- package/node_modules/matrix-js-sdk/src/crypto-api/keybackup.ts +14 -7
- package/node_modules/matrix-js-sdk/src/crypto-api/verification.ts +23 -5
- package/node_modules/matrix-js-sdk/src/embedded.ts +34 -16
- package/node_modules/matrix-js-sdk/src/feature.ts +0 -3
- package/node_modules/matrix-js-sdk/src/filter-component.ts +1 -2
- package/node_modules/matrix-js-sdk/src/filter.ts +0 -3
- package/node_modules/matrix-js-sdk/src/http-api/fetch.ts +1 -1
- package/node_modules/matrix-js-sdk/src/http-api/index.ts +1 -23
- package/node_modules/matrix-js-sdk/src/http-api/interface.ts +0 -12
- package/node_modules/matrix-js-sdk/src/http-api/refresh.ts +0 -1
- package/node_modules/matrix-js-sdk/src/interactive-auth.ts +4 -4
- package/node_modules/matrix-js-sdk/src/logger.ts +0 -2
- package/node_modules/matrix-js-sdk/src/matrix.ts +1 -1
- package/node_modules/matrix-js-sdk/src/matrixrtc/CallMembership.ts +5 -5
- package/node_modules/matrix-js-sdk/src/matrixrtc/MatrixRTCSession.ts +73 -6
- package/node_modules/matrix-js-sdk/src/matrixrtc/MatrixRTCSessionManager.ts +21 -2
- package/node_modules/matrix-js-sdk/src/matrixrtc/MembershipManager.ts +9 -6
- package/node_modules/matrix-js-sdk/src/matrixrtc/MembershipManagerActionScheduler.ts +1 -1
- package/node_modules/matrix-js-sdk/src/matrixrtc/RTCEncryptionManager.ts +2 -2
- package/node_modules/matrix-js-sdk/src/matrixrtc/ToDeviceKeyTransport.ts +3 -3
- package/node_modules/matrix-js-sdk/src/matrixrtc/index.ts +1 -1
- package/node_modules/matrix-js-sdk/src/matrixrtc/membershipData/rtc.ts +19 -8
- package/node_modules/matrix-js-sdk/src/matrixrtc/types.ts +24 -7
- package/node_modules/matrix-js-sdk/src/matrixrtc/utils.ts +0 -2
- package/node_modules/matrix-js-sdk/src/models/event-timeline-set.ts +3 -3
- package/node_modules/matrix-js-sdk/src/models/event.ts +7 -13
- package/node_modules/matrix-js-sdk/src/models/invites-ignorer.ts +1 -1
- package/node_modules/matrix-js-sdk/src/models/poll.ts +1 -1
- package/node_modules/matrix-js-sdk/src/models/read-receipt.ts +1 -1
- package/node_modules/matrix-js-sdk/src/models/relations-container.ts +55 -19
- package/node_modules/matrix-js-sdk/src/models/relations.ts +1 -1
- package/node_modules/matrix-js-sdk/src/models/room-state.ts +0 -3
- package/node_modules/matrix-js-sdk/src/models/room.ts +15 -15
- package/node_modules/matrix-js-sdk/src/models/thread.ts +51 -6
- package/node_modules/matrix-js-sdk/src/oauth/authorize.ts +274 -0
- package/node_modules/matrix-js-sdk/src/oauth/discover.ts +102 -0
- package/node_modules/matrix-js-sdk/src/{oidc → oauth}/error.ts +8 -7
- package/node_modules/matrix-js-sdk/src/oauth/index.ts +297 -0
- package/node_modules/matrix-js-sdk/src/oauth/register.ts +166 -0
- package/node_modules/matrix-js-sdk/src/oauth/tokenRefresher.ts +77 -0
- package/node_modules/matrix-js-sdk/src/pollingCachedValue.ts +184 -0
- package/node_modules/matrix-js-sdk/src/pushprocessor.ts +3 -3
- package/node_modules/matrix-js-sdk/src/realtime-callbacks.ts +0 -1
- package/node_modules/matrix-js-sdk/src/receipt-accumulator.ts +1 -2
- package/node_modules/matrix-js-sdk/src/rendezvous/MSC4108SignInWithQR.ts +14 -16
- package/node_modules/matrix-js-sdk/src/rendezvous/index.ts +2 -2
- package/node_modules/matrix-js-sdk/src/rendezvous/transports/MSC4108RendezvousSession.ts +0 -1
- package/node_modules/matrix-js-sdk/src/rtcTransportsCachedValue.ts +40 -0
- package/node_modules/matrix-js-sdk/src/rust-crypto/DehydratedDeviceManager.ts +14 -13
- package/node_modules/matrix-js-sdk/src/rust-crypto/OutgoingRequestProcessor.ts +0 -1
- package/node_modules/matrix-js-sdk/src/rust-crypto/PerSessionKeyBackupDownloader.ts +1 -1
- package/node_modules/matrix-js-sdk/src/rust-crypto/backup.ts +67 -33
- package/node_modules/matrix-js-sdk/src/rust-crypto/device-converter.ts +1 -0
- package/node_modules/matrix-js-sdk/src/rust-crypto/index.ts +32 -23
- package/node_modules/matrix-js-sdk/src/rust-crypto/libolm_migration.ts +1 -3
- package/node_modules/matrix-js-sdk/src/rust-crypto/rust-crypto.ts +3 -6
- package/node_modules/matrix-js-sdk/src/scheduler.ts +0 -3
- package/node_modules/matrix-js-sdk/src/sliding-sync-sdk.ts +4 -1
- package/node_modules/matrix-js-sdk/src/sliding-sync.ts +3 -1
- package/node_modules/matrix-js-sdk/src/store/indexeddb-local-backend.ts +1 -1
- package/node_modules/matrix-js-sdk/src/store/indexeddb-store-worker.ts +1 -0
- package/node_modules/matrix-js-sdk/src/store/indexeddb.ts +0 -2
- package/node_modules/matrix-js-sdk/src/store/memory.ts +7 -9
- package/node_modules/matrix-js-sdk/src/sync-accumulator.ts +1 -3
- package/node_modules/matrix-js-sdk/src/sync.ts +5 -6
- package/node_modules/matrix-js-sdk/src/testing.ts +3 -22
- package/node_modules/matrix-js-sdk/src/timeline-window.ts +0 -1
- package/node_modules/matrix-js-sdk/src/utils/internal/deriveKeys.ts +0 -1
- package/node_modules/matrix-js-sdk/src/utils.ts +3 -2
- package/node_modules/matrix-js-sdk/src/webrtc/call.ts +6 -6
- package/node_modules/matrix-js-sdk/src/webrtc/callEventTypes.ts +0 -5
- package/node_modules/matrix-js-sdk/src/webrtc/groupCall.ts +7 -7
- package/node_modules/matrix-js-sdk/src/webrtc/mediaHandler.ts +1 -1
- package/node_modules/matrix-js-sdk/src/webrtc/stats/callStatsReportGatherer.ts +2 -2
- package/node_modules/matrix-js-sdk/src/webrtc/stats/transportStatsBuilder.ts +1 -1
- package/node_modules/matrix-js-sdk/src/wellKnownCachedValue.ts +34 -0
- package/node_modules/music-metadata/LICENSE.txt +9 -9
- package/node_modules/music-metadata/README.md +878 -878
- package/node_modules/music-metadata/lib/ParseError.d.ts +1 -1
- package/node_modules/music-metadata/lib/ParseError.js +1 -1
- package/node_modules/music-metadata/lib/asf/AsfObject.d.ts +1 -4
- package/node_modules/music-metadata/lib/asf/AsfObject.js +66 -30
- package/node_modules/music-metadata/lib/asf/AsfParser.d.ts +5 -1
- package/node_modules/music-metadata/lib/asf/AsfParser.js +94 -25
- package/node_modules/music-metadata/lib/dsf/DsfChunk.js +2 -2
- package/node_modules/music-metadata/lib/dsf/DsfParser.js +38 -13
- package/node_modules/music-metadata/lib/mp4/AtomToken.js +2 -1
- package/node_modules/music-metadata/lib/mp4/MP4Parser.js +34 -7
- package/node_modules/music-metadata/lib/ogg/speex/SpeexStream.d.ts +7 -0
- package/node_modules/music-metadata/lib/ogg/speex/SpeexStream.js +13 -0
- package/node_modules/music-metadata/lib/riff/RiffChunk.js +1 -1
- package/node_modules/music-metadata/node_modules/content-type/README.md +2 -0
- package/node_modules/music-metadata/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/music-metadata/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/music-metadata/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/music-metadata/node_modules/content-type/package.json +1 -1
- package/node_modules/music-metadata/node_modules/file-type/package.json +1 -1
- package/node_modules/music-metadata/node_modules/file-type/readme.md +3 -0
- package/node_modules/music-metadata/node_modules/file-type/source/detectors/zip.js +6 -1
- package/node_modules/music-metadata/node_modules/file-type/source/index.d.ts +3 -0
- package/node_modules/music-metadata/node_modules/file-type/source/index.js +25 -13
- package/node_modules/music-metadata/package.json +156 -156
- package/node_modules/typebox/build/format/date.d.mts +1 -1
- package/node_modules/typebox/build/format/date.mjs +1 -1
- package/node_modules/typebox/build/format/date_time.d.mts +2 -2
- package/node_modules/typebox/build/format/date_time.mjs +3 -3
- package/node_modules/typebox/build/format/email.d.mts +1 -1
- package/node_modules/typebox/build/format/email.mjs +2 -2
- package/node_modules/typebox/build/format/hostname.mjs +2 -10
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_email.mjs +3 -3
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
- package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
- package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
- package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
- package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
- package/node_modules/typebox/build/format/idna/index.mjs +2 -0
- package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
- package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
- package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
- package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
- package/node_modules/typebox/build/format/ipv4.mjs +2 -32
- package/node_modules/typebox/build/format/ipv6.mjs +2 -61
- package/node_modules/typebox/build/format/iri.d.mts +2 -2
- package/node_modules/typebox/build/format/iri.mjs +26 -8
- package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
- package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
- package/node_modules/typebox/build/format/regex.d.mts +1 -2
- package/node_modules/typebox/build/format/regex.mjs +2 -6
- package/node_modules/typebox/build/format/time.d.mts +2 -2
- package/node_modules/typebox/build/format/time.mjs +19 -14
- package/node_modules/typebox/build/format/uri.d.mts +1 -1
- package/node_modules/typebox/build/format/uri.mjs +3 -130
- package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
- package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
- package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
- package/node_modules/typebox/build/format/uri_template.mjs +4 -5
- package/node_modules/typebox/build/format/url.d.mts +3 -3
- package/node_modules/typebox/build/format/url.mjs +4 -5
- package/node_modules/typebox/build/guard/emit.d.mts +3 -1
- package/node_modules/typebox/build/guard/emit.mjs +12 -5
- package/node_modules/typebox/build/guard/guard.d.mts +8 -2
- package/node_modules/typebox/build/guard/guard.mjs +25 -4
- package/node_modules/typebox/build/guard/string.d.mts +2 -2
- package/node_modules/typebox/build/guard/string.mjs +7 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
- package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
- package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
- package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
- package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
- package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
- package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
- package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
- package/node_modules/typebox/build/schema/types/index.mjs +0 -2
- package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
- package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
- package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
- package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
- package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
- package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
- package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
- package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
- package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
- package/node_modules/typebox/build/type/script/parser.mjs +27 -23
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
- package/node_modules/typebox/package.json +27 -27
- package/node_modules/typebox/readme.md +79 -82
- package/openclaw.plugin.json +23 -1
- package/package.json +10 -10
- package/dist/env-auth-MVS-Vv41.js +0 -64
- package/dist/media-text-JudlYOSc.js +0 -146
- package/dist/probe.runtime-Dr91B_X3.js +0 -2
- package/dist/route-DY6at4qJ.js +0 -161
- package/dist/runtime-api-BGO16Fu8.js +0 -21
- package/dist/subagent-hooks-dkPAF6Et.js +0 -143
- package/dist/timeout-abort-signal-DMrgRFIy.js +0 -2
- package/node_modules/markdown-it/dist/index.cjs.js.map +0 -1
- package/node_modules/markdown-it/dist/markdown-it.js +0 -3975
- package/node_modules/markdown-it/dist/markdown-it.js.map +0 -1
- package/node_modules/markdown-it/dist/markdown-it.min.js +0 -3
- package/node_modules/markdown-it/dist/markdown-it.min.js.map +0 -1
- package/node_modules/markdown-it/index.mjs +0 -1
- package/node_modules/markdown-it/lib/common/html_blocks.mjs +0 -67
- package/node_modules/markdown-it/lib/common/html_re.mjs +0 -25
- package/node_modules/markdown-it/lib/common/utils.mjs +0 -324
- package/node_modules/markdown-it/lib/helpers/index.mjs +0 -11
- package/node_modules/markdown-it/lib/helpers/parse_link_destination.mjs +0 -77
- package/node_modules/markdown-it/lib/helpers/parse_link_label.mjs +0 -49
- package/node_modules/markdown-it/lib/helpers/parse_link_title.mjs +0 -66
- package/node_modules/markdown-it/lib/index.mjs +0 -565
- package/node_modules/markdown-it/lib/parser_block.mjs +0 -134
- package/node_modules/markdown-it/lib/parser_core.mjs +0 -62
- package/node_modules/markdown-it/lib/parser_inline.mjs +0 -197
- package/node_modules/markdown-it/lib/presets/commonmark.mjs +0 -88
- package/node_modules/markdown-it/lib/presets/default.mjs +0 -47
- package/node_modules/markdown-it/lib/presets/zero.mjs +0 -70
- package/node_modules/markdown-it/lib/renderer.mjs +0 -322
- package/node_modules/markdown-it/lib/ruler.mjs +0 -340
- package/node_modules/markdown-it/lib/rules_block/blockquote.mjs +0 -209
- package/node_modules/markdown-it/lib/rules_block/code.mjs +0 -30
- package/node_modules/markdown-it/lib/rules_block/fence.mjs +0 -94
- package/node_modules/markdown-it/lib/rules_block/heading.mjs +0 -51
- package/node_modules/markdown-it/lib/rules_block/hr.mjs +0 -40
- package/node_modules/markdown-it/lib/rules_block/html_block.mjs +0 -80
- package/node_modules/markdown-it/lib/rules_block/lheading.mjs +0 -85
- package/node_modules/markdown-it/lib/rules_block/list.mjs +0 -331
- package/node_modules/markdown-it/lib/rules_block/paragraph.mjs +0 -48
- package/node_modules/markdown-it/lib/rules_block/reference.mjs +0 -212
- package/node_modules/markdown-it/lib/rules_block/state_block.mjs +0 -220
- package/node_modules/markdown-it/lib/rules_block/table.mjs +0 -228
- package/node_modules/markdown-it/lib/rules_core/block.mjs +0 -13
- package/node_modules/markdown-it/lib/rules_core/inline.mjs +0 -11
- package/node_modules/markdown-it/lib/rules_core/linkify.mjs +0 -134
- package/node_modules/markdown-it/lib/rules_core/normalize.mjs +0 -17
- package/node_modules/markdown-it/lib/rules_core/replacements.mjs +0 -101
- package/node_modules/markdown-it/lib/rules_core/smartquotes.mjs +0 -209
- package/node_modules/markdown-it/lib/rules_core/state_core.mjs +0 -17
- package/node_modules/markdown-it/lib/rules_core/text_join.mjs +0 -43
- package/node_modules/markdown-it/lib/rules_inline/autolink.mjs +0 -72
- package/node_modules/markdown-it/lib/rules_inline/backticks.mjs +0 -60
- package/node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs +0 -124
- package/node_modules/markdown-it/lib/rules_inline/emphasis.mjs +0 -123
- package/node_modules/markdown-it/lib/rules_inline/entity.mjs +0 -51
- package/node_modules/markdown-it/lib/rules_inline/escape.mjs +0 -83
- package/node_modules/markdown-it/lib/rules_inline/fragments_join.mjs +0 -38
- package/node_modules/markdown-it/lib/rules_inline/html_inline.mjs +0 -50
- package/node_modules/markdown-it/lib/rules_inline/image.mjs +0 -138
- package/node_modules/markdown-it/lib/rules_inline/link.mjs +0 -139
- package/node_modules/markdown-it/lib/rules_inline/linkify.mjs +0 -63
- package/node_modules/markdown-it/lib/rules_inline/newline.mjs +0 -42
- package/node_modules/markdown-it/lib/rules_inline/state_inline.mjs +0 -154
- package/node_modules/markdown-it/lib/rules_inline/strikethrough.mjs +0 -127
- package/node_modules/markdown-it/lib/rules_inline/text.mjs +0 -86
- package/node_modules/markdown-it/lib/token.mjs +0 -191
- package/node_modules/markdown-it/node_modules/argparse/CHANGELOG.md +0 -216
- package/node_modules/markdown-it/node_modules/entities/lib/decode.d.ts +0 -211
- package/node_modules/markdown-it/node_modules/entities/lib/decode.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/decode.js +0 -536
- package/node_modules/markdown-it/node_modules/entities/lib/decode.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.d.ts +0 -19
- package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.js +0 -76
- package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/encode.d.ts +0 -22
- package/node_modules/markdown-it/node_modules/entities/lib/encode.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/encode.js +0 -77
- package/node_modules/markdown-it/node_modules/entities/lib/encode.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/escape.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/escape.js +0 -122
- package/node_modules/markdown-it/node_modules/entities/lib/escape.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/decode.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/decode.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.d.ts +0 -19
- package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.js +0 -71
- package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/encode.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/encode.js +0 -69
- package/node_modules/markdown-it/node_modules/entities/lib/esm/encode.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.d.ts +0 -43
- package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.js +0 -116
- package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.d.ts +0 -3
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.js +0 -7
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts +0 -3
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.js +0 -7
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.d.ts +0 -8
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.js +0 -10
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/index.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/index.js +0 -99
- package/node_modules/markdown-it/node_modules/entities/lib/esm/index.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/package.json +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.d.ts +0 -3
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.js +0 -9
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.d.ts +0 -3
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.js +0 -9
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.d.ts +0 -8
- package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.js +0 -12
- package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/index.d.ts +0 -96
- package/node_modules/markdown-it/node_modules/entities/lib/index.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/index.js +0 -126
- package/node_modules/markdown-it/node_modules/entities/lib/index.js.map +0 -1
- package/node_modules/markdown-it/node_modules/linkify-it/index.mjs +0 -646
- package/node_modules/markdown-it/node_modules/linkify-it/lib/re.mjs +0 -193
- package/node_modules/markdown-it/node_modules/uc.micro/categories/Cc/regex.mjs +0 -1
- package/node_modules/markdown-it/node_modules/uc.micro/categories/Cf/regex.mjs +0 -1
- package/node_modules/markdown-it/node_modules/uc.micro/categories/P/regex.mjs +0 -1
- package/node_modules/markdown-it/node_modules/uc.micro/categories/S/regex.mjs +0 -1
- package/node_modules/markdown-it/node_modules/uc.micro/categories/Z/regex.mjs +0 -1
- package/node_modules/markdown-it/node_modules/uc.micro/index.mjs +0 -8
- package/node_modules/markdown-it/node_modules/uc.micro/properties/Any/regex.mjs +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/authorize.d.ts +0 -157
- package/node_modules/matrix-js-sdk/lib/oidc/authorize.d.ts.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/authorize.js +0 -365
- package/node_modules/matrix-js-sdk/lib/oidc/authorize.js.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/discovery.d.ts +0 -22
- package/node_modules/matrix-js-sdk/lib/oidc/discovery.d.ts.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/discovery.js +0 -65
- package/node_modules/matrix-js-sdk/lib/oidc/discovery.js.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/error.d.ts +0 -18
- package/node_modules/matrix-js-sdk/lib/oidc/error.d.ts.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/error.js +0 -35
- package/node_modules/matrix-js-sdk/lib/oidc/error.js.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/index.d.ts +0 -16
- package/node_modules/matrix-js-sdk/lib/oidc/index.d.ts.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/index.js +0 -30
- package/node_modules/matrix-js-sdk/lib/oidc/index.js.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/register.d.ts +0 -70
- package/node_modules/matrix-js-sdk/lib/oidc/register.d.ts.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/register.js +0 -134
- package/node_modules/matrix-js-sdk/lib/oidc/register.js.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.d.ts +0 -91
- package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.d.ts.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.js +0 -173
- package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.js.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/validate.d.ts +0 -78
- package/node_modules/matrix-js-sdk/lib/oidc/validate.d.ts.map +0 -1
- package/node_modules/matrix-js-sdk/lib/oidc/validate.js +0 -181
- package/node_modules/matrix-js-sdk/lib/oidc/validate.js.map +0 -1
- package/node_modules/matrix-js-sdk/node_modules/jwt-decode/LICENSE +0 -21
- package/node_modules/matrix-js-sdk/node_modules/jwt-decode/README.md +0 -134
- package/node_modules/matrix-js-sdk/node_modules/jwt-decode/build/cjs/index.d.ts +0 -23
- package/node_modules/matrix-js-sdk/node_modules/jwt-decode/build/cjs/index.js +0 -62
- package/node_modules/matrix-js-sdk/node_modules/jwt-decode/build/cjs/package.json +0 -1
- package/node_modules/matrix-js-sdk/node_modules/jwt-decode/build/esm/index.d.ts +0 -23
- package/node_modules/matrix-js-sdk/node_modules/jwt-decode/build/esm/index.js +0 -57
- package/node_modules/matrix-js-sdk/node_modules/jwt-decode/package.json +0 -81
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/LICENSE +0 -202
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/README.md +0 -87
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/browser/oidc-client-ts.js +0 -3751
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/browser/oidc-client-ts.js.map +0 -7
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/browser/oidc-client-ts.min.js +0 -2
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/browser/oidc-client-ts.min.js.map +0 -7
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/esm/oidc-client-ts.js +0 -3671
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/esm/oidc-client-ts.js.map +0 -7
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/esm/package.json +0 -4
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/types/oidc-client-ts.d.ts +0 -2003
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/types/tsdoc-metadata.json +0 -11
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/umd/oidc-client-ts.js +0 -3719
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/umd/oidc-client-ts.js.map +0 -7
- package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/package.json +0 -75
- package/node_modules/matrix-js-sdk/src/oidc/authorize.ts +0 -431
- package/node_modules/matrix-js-sdk/src/oidc/discovery.ts +0 -67
- package/node_modules/matrix-js-sdk/src/oidc/index.ts +0 -33
- package/node_modules/matrix-js-sdk/src/oidc/register.ts +0 -168
- package/node_modules/matrix-js-sdk/src/oidc/tokenRefresher.ts +0 -184
- package/node_modules/matrix-js-sdk/src/oidc/validate.ts +0 -265
- package/node_modules/typebox/build/format/_idna.d.mts +0 -2
- package/node_modules/typebox/build/format/_idna.mjs +0 -246
- package/node_modules/typebox/build/format/_puny.d.mts +0 -1
- package/node_modules/typebox/build/format/_puny.mjs +0 -77
- package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
- package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
- package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
- package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-auth.js","names":[],"sources":["../src/interactive-auth.ts"],"sourcesContent":["/*\nCopyright 2016 OpenMarket Ltd\nCopyright 2017 Vector Creations Ltd\nCopyright 2019 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { logger } from \"./logger.ts\";\nimport { type MatrixClient } from \"./client.ts\";\nimport { MatrixError } from \"./http-api/index.ts\";\nimport { type UserIdentifier } from \"./@types/auth.ts\";\n\nconst EMAIL_STAGE_TYPE = \"m.login.email.identity\";\nconst MSISDN_STAGE_TYPE = \"m.login.msisdn\";\n\nexport interface UIAFlow {\n stages: Array<AuthType | string>;\n}\n\nexport interface IInputs {\n // An email address. If supplied, a flow using email verification will be chosen.\n emailAddress?: string;\n // An ISO two letter country code. Gives the country that opts.phoneNumber should be resolved relative to.\n phoneCountry?: string;\n // A phone number. If supplied, a flow using phone number validation will be chosen.\n phoneNumber?: string;\n registrationToken?: string;\n}\n\nexport interface IStageStatus {\n emailSid?: string;\n errcode?: string;\n error?: string;\n}\n\n/**\n * Data returned in the body of a 401 response from a UIA endpoint.\n *\n * @see https://spec.matrix.org/v1.6/client-server-api/#user-interactive-api-in-the-rest-api\n */\nexport interface IAuthData {\n /**\n * This is a session identifier that the client must pass back to the home server,\n * if one is provided, in subsequent attempts to authenticate in the same API call.\n */\n session?: string;\n /**\n * A list of the stages the client has completed successfully\n */\n completed?: string[];\n /**\n * A list of the login flows supported by the server for this API.\n */\n flows?: UIAFlow[];\n /**\n * Contains any information that the client will need to know in order to use a given type of authentication.\n * For each login type presented, that type may be present as a key in this dictionary.\n * For example, the public part of an OAuth client ID could be given here.\n */\n params?: Record<string, Record<string, any>>;\n}\n\nexport enum AuthType {\n Password = \"m.login.password\",\n Recaptcha = \"m.login.recaptcha\",\n Terms = \"m.login.terms\",\n Email = \"m.login.email.identity\",\n Msisdn = \"m.login.msisdn\",\n Sso = \"m.login.sso\",\n SsoUnstable = \"org.matrix.login.sso\",\n Dummy = \"m.login.dummy\",\n RegistrationToken = \"m.login.registration_token\",\n // For backwards compatability with servers that have not yet updated to\n // use the stable \"m.login.registration_token\" type.\n // The authentication flow is the same in both cases.\n UnstableRegistrationToken = \"org.matrix.msc3231.login.registration_token\",\n /**\n * m.oauth stage introduced by MSC4312:\n * https://spec.matrix.org/v1.17/client-server-api/#oauth-authentication\n */\n OAuth = \"m.oauth\",\n}\n\n/**\n * https://spec.matrix.org/v1.7/client-server-api/#password-based\n */\ntype PasswordDict = {\n type: AuthType.Password;\n identifier: UserIdentifier;\n password: string;\n session: string;\n};\n\n/**\n * https://spec.matrix.org/v1.7/client-server-api/#google-recaptcha\n */\ntype RecaptchaDict = {\n type: AuthType.Recaptcha;\n response: string;\n session: string;\n};\n\ninterface ThreepidCreds {\n sid: string;\n client_secret: string;\n id_server: string;\n id_access_token: string;\n}\n\n/**\n * https://spec.matrix.org/v1.7/client-server-api/#email-based-identity--homeserver\n */\ntype EmailIdentityDict = {\n type: AuthType.Email;\n threepid_creds: ThreepidCreds;\n session: string;\n};\n\n/**\n * The parameters which are submitted as the `auth` dict in a UIA request\n *\n * @see https://spec.matrix.org/v1.6/client-server-api/#authentication-types\n */\nexport type AuthDict =\n | PasswordDict\n | RecaptchaDict\n | EmailIdentityDict\n | { type: Exclude<string, AuthType>; [key: string]: any }\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n | {};\n\nexport class NoAuthFlowFoundError extends Error {\n public name = \"NoAuthFlowFoundError\";\n\n public constructor(\n m: string,\n // eslint-disable-next-line @typescript-eslint/naming-convention, camelcase\n public readonly required_stages: string[],\n public readonly flows: UIAFlow[],\n ) {\n super(m);\n }\n}\n\n/**\n * The type of an application callback to perform the user-interactive bit of UIA.\n *\n * It is called with a single parameter, `makeRequest`, which is a function which takes the UIA parameters and\n * makes the HTTP request. The `authData` parameter in `makeRequest` can be set to null to omit the `auth` field\n * from the UIA request.\n *\n * The generic parameter `T` is the type of the response of the endpoint, once it is eventually successful.\n */\nexport type UIAuthCallback<T> = (makeRequest: (authData: AuthDict | null) => Promise<T>) => Promise<T>;\n\ninterface IOpts<T> {\n /**\n * A matrix client to use for the auth process\n */\n matrixClient: MatrixClient;\n /**\n * Error response from the last request. If null, a request will be made with no auth before starting.\n */\n authData?: IAuthData;\n /**\n * Inputs provided by the user and used by different stages of the auto process.\n * The inputs provided will affect what flow is chosen.\n */\n inputs?: IInputs;\n /**\n * If resuming an existing interactive auth session, the sessionId of that session.\n */\n sessionId?: string;\n /**\n * If resuming an existing interactive auth session, the client secret for that session\n */\n clientSecret?: string;\n /**\n * If returning from having completed m.login.email.identity auth, the sid for the email verification session.\n */\n emailSid?: string;\n\n /**\n * If specified, will prefer flows which entirely consist of listed stages.\n * These should normally be of type AuthTypes but can be string when supporting custom auth stages.\n *\n * This can be used to avoid needing the fallback mechanism.\n */\n supportedStages?: Array<AuthType | string>;\n\n /**\n * Called with the new auth dict to submit the request.\n * Also passes a second deprecated arg which is a flag set to true if this request is a background request.\n * The busyChanged callback should be used instead of the background flag.\n * Should return a promise which resolves to the successful response or rejects with a MatrixError.\n */\n doRequest(this: void, auth: AuthDict | null, background: boolean): Promise<T>;\n /**\n * Called when the status of the UI auth changes,\n * ie. when the state of an auth stage changes of when the auth flow moves to a new stage.\n * The arguments are: the login type (eg m.login.password); and an object which is either an error or an\n * informational object specific to the login type.\n * If the 'errcode' key is defined, the object is an error, and has keys:\n * errcode: string, the textual error code, eg. M_UNKNOWN\n * error: string, human readable string describing the error\n *\n * The login type specific objects are as follows:\n * m.login.email.identity:\n * * emailSid: string, the sid of the active email auth session\n */\n stateUpdated(this: void, nextStage: AuthType | string, status: IStageStatus): void;\n\n /**\n * A function that takes the email address (string), clientSecret (string), attempt number (int) and\n * sessionId (string) and calls the relevant requestToken function and returns the promise returned by that\n * function.\n * If the resulting promise rejects, the rejection will propagate through to the attemptAuth promise.\n */\n requestEmailToken(\n this: void,\n email: string,\n secret: string,\n attempt: number,\n session: string,\n ): Promise<{ sid: string }>;\n /**\n * Called whenever the interactive auth logic becomes busy submitting information provided by the user or finishes.\n * After this has been called with true the UI should indicate that a request is in progress\n * until it is called again with false.\n */\n busyChanged?(this: void, busy: boolean): void;\n startAuthStage?(this: void, nextStage: string): Promise<void>; // LEGACY\n}\n\n/**\n * Abstracts the logic used to drive the interactive auth process.\n *\n * <p>Components implementing an interactive auth flow should instantiate one of\n * these, passing in the necessary callbacks to the constructor. They should\n * then call attemptAuth, which will return a promise which will resolve or\n * reject when the interactive-auth process completes.\n *\n * <p>Meanwhile, calls will be made to the startAuthStage and doRequest\n * callbacks, and information gathered from the user can be submitted with\n * submitAuthDict.\n *\n * @param opts - options object\n * @typeParam T - the return type of the request when it is successful\n */\nexport class InteractiveAuth<T> {\n private readonly matrixClient: MatrixClient;\n private readonly inputs: IInputs;\n private readonly clientSecret: string;\n private readonly requestCallback: IOpts<T>[\"doRequest\"];\n private readonly busyChangedCallback?: IOpts<T>[\"busyChanged\"];\n private readonly stateUpdatedCallback: IOpts<T>[\"stateUpdated\"];\n private readonly requestEmailTokenCallback: IOpts<T>[\"requestEmailToken\"];\n private readonly supportedStages?: Set<string>;\n\n // The current latest data or error received from the server during the user interactive auth flow.\n private data: IAuthData & MatrixError[\"data\"];\n private emailSid?: string;\n private requestingEmailToken = false;\n private attemptAuthDeferred: PromiseWithResolvers<T> | null = null;\n private chosenFlow: UIAFlow | null = null;\n private currentStage: string | null = null;\n\n private emailAttempt = 1;\n\n // if we are currently trying to submit an auth dict (which includes polling)\n // the promise the will resolve/reject when it completes\n private submitPromise: Promise<void> | null = null;\n\n public constructor(opts: IOpts<T>) {\n this.matrixClient = opts.matrixClient;\n this.data = opts.authData || { flows: [] };\n this.requestCallback = opts.doRequest;\n this.busyChangedCallback = opts.busyChanged;\n // startAuthStage included for backwards compat\n this.stateUpdatedCallback = opts.stateUpdated || opts.startAuthStage;\n this.requestEmailTokenCallback = opts.requestEmailToken;\n this.inputs = opts.inputs || {};\n\n if (opts.sessionId) this.data.session = opts.sessionId;\n this.clientSecret = opts.clientSecret || this.matrixClient.generateClientSecret();\n this.emailSid = opts.emailSid;\n if (opts.supportedStages !== undefined) this.supportedStages = new Set(opts.supportedStages);\n }\n\n /**\n * begin the authentication process.\n *\n * @returns which resolves to the response on success,\n * or rejects with the error on failure. Rejects with NoAuthFlowFoundError if\n * no suitable authentication flow can be found\n */\n public async attemptAuth(): Promise<T> {\n // This promise will be quite long-lived and will resolve when the\n // request is authenticated and completes successfully.\n this.attemptAuthDeferred = Promise.withResolvers();\n // pluck the promise out now, as doRequest may clear before we return\n const promise = this.attemptAuthDeferred.promise;\n\n // if we have no flows, try a request to acquire the flows\n if (!(this.data as IAuthData)?.flows?.length) {\n this.busyChangedCallback?.(true);\n // use the existing sessionId, if one is present.\n const auth = (this.data as IAuthData).session ? { session: (this.data as IAuthData).session } : null;\n this.doRequest(auth).finally(() => {\n this.busyChangedCallback?.(false);\n });\n } else {\n this.startNextAuthStage();\n }\n\n return promise;\n }\n\n /**\n * Poll to check if the auth session or current stage has been\n * completed out-of-band. If so, the attemptAuth promise will\n * be resolved.\n */\n public async poll(): Promise<void> {\n if (!(this.data as IAuthData).session) return;\n // likewise don't poll if there is no auth session in progress\n if (!this.attemptAuthDeferred) return;\n // if we currently have a request in flight, there's no point making\n // another just to check what the status is\n if (this.submitPromise) return;\n\n let authDict: AuthDict = {};\n if (this.currentStage == EMAIL_STAGE_TYPE) {\n // The email can be validated out-of-band, but we need to provide the\n // creds so the HS can go & check it.\n if (this.emailSid) {\n const creds: Record<string, string> = {\n sid: this.emailSid,\n client_secret: this.clientSecret,\n };\n const isUrl = this.matrixClient.getIdentityServerUrl();\n if (isUrl) {\n creds.id_server = new URL(isUrl).host;\n }\n authDict = {\n type: EMAIL_STAGE_TYPE,\n threepid_creds: creds,\n };\n }\n }\n\n this.submitAuthDict(authDict, true);\n }\n\n /**\n * get the auth session ID\n *\n * @returns session id\n */\n public getSessionId(): string | undefined {\n return (this.data as IAuthData)?.session;\n }\n\n /**\n * get the client secret used for validation sessions\n * with the identity server.\n *\n * @returns client secret\n */\n public getClientSecret(): string {\n return this.clientSecret;\n }\n\n /**\n * get the server params for a given stage\n *\n * @param loginType - login type for the stage\n * @returns any parameters from the server for this stage\n */\n public getStageParams(loginType: string): Record<string, any> | undefined {\n return (this.data as IAuthData)?.params?.[loginType];\n }\n\n public getChosenFlow(): UIAFlow | null {\n return this.chosenFlow;\n }\n\n /**\n * submit a new auth dict and fire off the request. This will either\n * make attemptAuth resolve/reject, or cause the startAuthStage callback\n * to be called for a new stage.\n *\n * @param authData - new auth dict to send to the server. Should\n * include a `type` property denoting the login type, as well as any\n * other params for that stage.\n * @param background - If true, this request failing will not result\n * in the attemptAuth promise being rejected. This can be set to true\n * for requests that just poll to see if auth has been completed elsewhere.\n */\n public async submitAuthDict(authData: AuthDict, background = false): Promise<void> {\n if (!this.attemptAuthDeferred) {\n throw new Error(\"submitAuthDict() called before attemptAuth()\");\n }\n\n if (!background) {\n this.busyChangedCallback?.(true);\n }\n\n // if we're currently trying a request, wait for it to finish\n // as otherwise we can get multiple 200 responses which can mean\n // things like multiple logins for register requests.\n // (but discard any exceptions as we only care when its done,\n // not whether it worked or not)\n while (this.submitPromise) {\n try {\n await this.submitPromise;\n } catch {}\n }\n\n // use the sessionid from the last request, if one is present.\n let auth: AuthDict;\n if ((this.data as IAuthData)?.session) {\n auth = Object.assign(\n {\n session: (this.data as IAuthData).session,\n },\n authData,\n );\n } else {\n auth = authData;\n }\n\n try {\n // NB. the 'background' flag is deprecated by the busyChanged\n // callback and is here for backwards compat\n this.submitPromise = this.doRequest(auth, background);\n await this.submitPromise;\n } finally {\n this.submitPromise = null;\n if (!background) {\n this.busyChangedCallback?.(false);\n }\n }\n }\n\n /**\n * Gets the sid for the email validation session\n * Specific to m.login.email.identity\n *\n * @returns The sid of the email auth session\n */\n public getEmailSid(): string | undefined {\n return this.emailSid;\n }\n\n /**\n * Sets the sid for the email validation session\n * This must be set in order to successfully poll for completion\n * of the email validation.\n * Specific to m.login.email.identity\n *\n * @param sid - The sid for the email validation session\n */\n public setEmailSid(sid: string): void {\n this.emailSid = sid;\n }\n\n /**\n * Requests a new email token and sets the email sid for the validation session\n */\n public requestEmailToken = async (): Promise<void> => {\n if (!this.requestingEmailToken) {\n logger.trace(\"Requesting email token. Attempt: \" + this.emailAttempt);\n // If we've picked a flow with email auth, we send the email\n // now because we want the request to fail as soon as possible\n // if the email address is not valid (ie. already taken or not\n // registered, depending on what the operation is).\n this.requestingEmailToken = true;\n try {\n const requestTokenResult = await this.requestEmailTokenCallback(\n this.inputs.emailAddress!,\n this.clientSecret,\n this.emailAttempt++,\n (this.data as IAuthData).session!,\n );\n this.emailSid = requestTokenResult.sid;\n logger.trace(\"Email token request succeeded\");\n } finally {\n this.requestingEmailToken = false;\n }\n } else {\n logger.warn(\"Could not request email token: Already requesting\");\n }\n };\n\n /**\n * Fire off a request, and either resolve the promise, or call\n * startAuthStage.\n *\n * @internal\n * @param auth - new auth dict, including session id\n * @param background - If true, this request is a background poll, so it\n * failing will not result in the attemptAuth promise being rejected.\n * This can be set to true for requests that just poll to see if auth has\n * been completed elsewhere.\n */\n private async doRequest(auth: AuthDict | null, background = false): Promise<void> {\n try {\n const result = await this.requestCallback(auth, background);\n this.attemptAuthDeferred!.resolve(result);\n this.attemptAuthDeferred = null;\n } catch (error) {\n const matrixError = error instanceof MatrixError ? error : null;\n\n // sometimes UI auth errors don't come with flows\n const errorFlows = matrixError?.data?.flows ?? null;\n const haveFlows = (this.data as IAuthData)?.flows || Boolean(errorFlows);\n if (!matrixError || matrixError.httpStatus !== 401 || !matrixError.data || !haveFlows) {\n // doesn't look like an interactive-auth failure.\n if (!background) {\n this.attemptAuthDeferred?.reject(error);\n } else {\n // We ignore all failures here (even non-UI auth related ones)\n // since we don't want to suddenly fail if the internet connection\n // had a blip whilst we were polling\n logger.log(\"Background poll request failed doing UI auth: ignoring\", error);\n }\n }\n if (matrixError && !matrixError.data) {\n matrixError.data = {};\n }\n // if the error didn't come with flows, completed flows or session ID,\n // copy over the ones we have. Synapse sometimes sends responses without\n // any UI auth data (eg. when polling for email validation, if the email\n // has not yet been validated). This appears to be a Synapse bug, which\n // we workaround here.\n if (matrixError && !matrixError.data.flows && !matrixError.data.completed && !matrixError.data.session) {\n matrixError.data.flows = (this.data as IAuthData).flows;\n matrixError.data.completed = (this.data as IAuthData).completed;\n matrixError.data.session = (this.data as IAuthData).session;\n }\n if (matrixError) {\n this.data = matrixError.data;\n }\n try {\n this.startNextAuthStage();\n } catch (e) {\n this.attemptAuthDeferred!.reject(e);\n this.attemptAuthDeferred = null;\n return;\n }\n\n if (!this.emailSid && this.chosenFlow?.stages.includes(AuthType.Email)) {\n try {\n await this.requestEmailToken();\n // NB. promise is not resolved here - at some point, doRequest\n // will be called again and if the user has jumped through all\n // the hoops correctly, auth will be complete and the request\n // will succeed.\n // Also, we should expose the fact that this request has compledted\n // so clients can know that the email has actually been sent.\n } catch (e) {\n // we failed to request an email token, so fail the request.\n // This could be due to the email already beeing registered\n // (or not being registered, depending on what we're trying\n // to do) or it could be a network failure. Either way, pass\n // the failure up as the user can't complete auth if we can't\n // send the email, for whatever reason.\n this.attemptAuthDeferred!.reject(e);\n this.attemptAuthDeferred = null;\n }\n }\n }\n }\n\n /**\n * Pick the next stage and call the callback\n *\n * @internal\n * @throws {@link NoAuthFlowFoundError} If no suitable authentication flow can be found\n */\n private startNextAuthStage(): void {\n const nextStage = this.chooseStage();\n if (!nextStage) {\n throw new Error(\"No incomplete flows from the server\");\n }\n this.currentStage = nextStage;\n\n if (nextStage === AuthType.Dummy) {\n this.submitAuthDict({\n type: \"m.login.dummy\",\n });\n return;\n }\n\n if (this.data?.errcode || this.data?.error) {\n this.stateUpdatedCallback(nextStage, {\n errcode: this.data?.errcode || \"\",\n error: this.data?.error || \"\",\n });\n return;\n }\n\n this.stateUpdatedCallback(nextStage, nextStage === EMAIL_STAGE_TYPE ? { emailSid: this.emailSid } : {});\n }\n\n /**\n * Pick the next auth stage\n *\n * @internal\n * @returns login type\n * @throws {@link NoAuthFlowFoundError} If no suitable authentication flow can be found\n */\n private chooseStage(): AuthType | string | undefined {\n if (this.chosenFlow === null) {\n this.chosenFlow = this.chooseFlow();\n }\n logger.log(\"Active flow => %s\", JSON.stringify(this.chosenFlow));\n const nextStage = this.firstUncompletedStage(this.chosenFlow);\n logger.log(\"Next stage: %s\", nextStage);\n return nextStage;\n }\n\n // Returns a low number for flows we consider best. Counts increase for longer flows and even more so\n // for flows which contain stages not listed in `supportedStages`.\n private scoreFlow(flow: UIAFlow): number {\n let score = flow.stages.length;\n if (this.supportedStages !== undefined) {\n // Add 10 points to the score for each unsupported stage in the flow.\n score += flow.stages.filter((stage) => !this.supportedStages!.has(stage)).length * 10;\n }\n return score;\n }\n\n /**\n * Pick one of the flows from the returned list\n * If a flow using all of the inputs is found, it will\n * be returned, otherwise, null will be returned.\n *\n * Only flows using all given inputs are chosen because it\n * is likely to be surprising if the user provides a\n * credential and it is not used. For example, for registration,\n * this could result in the email not being used which would leave\n * the account with no means to reset a password.\n *\n * @internal\n * @returns flow\n * @throws {@link NoAuthFlowFoundError} If no suitable authentication flow can be found\n */\n private chooseFlow(): UIAFlow {\n const flows = (this.data as IAuthData)?.flows || [];\n\n // we've been given an email or we've already done an email part\n const haveEmail = Boolean(this.inputs.emailAddress) || Boolean(this.emailSid);\n const haveMsisdn = Boolean(this.inputs.phoneCountry) && Boolean(this.inputs.phoneNumber);\n\n // Flows are not represented in a significant order, so we can choose any we support best\n // Sort flows based on how many unsupported stages they contain ascending\n flows.sort((a, b) => this.scoreFlow(a) - this.scoreFlow(b));\n\n for (const flow of flows) {\n let flowHasEmail = false;\n let flowHasMsisdn = false;\n for (const stage of flow.stages) {\n if (stage === EMAIL_STAGE_TYPE) {\n flowHasEmail = true;\n } else if (stage == MSISDN_STAGE_TYPE) {\n flowHasMsisdn = true;\n }\n }\n\n if (flowHasEmail == haveEmail && flowHasMsisdn == haveMsisdn) {\n return flow;\n }\n }\n\n const requiredStages: string[] = [];\n if (haveEmail) requiredStages.push(EMAIL_STAGE_TYPE);\n if (haveMsisdn) requiredStages.push(MSISDN_STAGE_TYPE);\n // Throw an error with a fairly generic description, but with more\n // information such that the app can give a better one if so desired.\n throw new NoAuthFlowFoundError(\"No appropriate authentication flow found\", requiredStages, flows);\n }\n\n /**\n * Get the first uncompleted stage in the given flow\n *\n * @internal\n * @returns login type\n */\n private firstUncompletedStage(flow: UIAFlow): AuthType | string | undefined {\n const completed = (this.data as IAuthData)?.completed || [];\n return flow.stages.find((stageType) => !completed.includes(stageType));\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,MAAM,QAAQ,aAAa;AAEpC,SAAS,WAAW,QAAQ,qBAAqB;AAGjD,MAAM,gBAAgB,GAAG,wBAAwB;AACjD,MAAM,iBAAiB,GAAG,gBAAgB;;AAsB1C;AACA;AACA;AACA;AACA;;AAuBA,WAAY,QAAQ,0BAAR,QAAQ;EAAR,QAAQ;EAAR,QAAQ;EAAR,QAAQ;EAAR,QAAQ;EAAR,QAAQ;EAAR,QAAQ;EAAR,QAAQ;EAAR,QAAQ;EAAR,QAAQ;EAUhB;EACA;EACA;EAZQ,QAAQ;EAchB;AACJ;AACA;AACA;EAjBY,QAAQ;EAAA,OAAR,QAAQ;AAAA;;AAqBpB;AACA;AACA;;AAQA;AACA;AACA;;AAcA;AACA;AACA;;AAOA;AACA;A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AM,SAAS,GAAI,IAAI,CAAC,IAAI,EAAgB,SAAS,IAAI,EAAE;IAC3D,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAE,SAAS,IAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;EAC1E;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"interactive-auth.js","names":[],"sources":["../src/interactive-auth.ts"],"sourcesContent":["/*\nCopyright 2016 OpenMarket Ltd\nCopyright 2017 Vector Creations Ltd\nCopyright 2019 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { logger } from \"./logger.ts\";\nimport { type MatrixClient } from \"./client.ts\";\nimport { MatrixError } from \"./http-api/index.ts\";\nimport { type UserIdentifier } from \"./@types/auth.ts\";\n\nconst EMAIL_STAGE_TYPE = \"m.login.email.identity\";\nconst MSISDN_STAGE_TYPE = \"m.login.msisdn\";\n\nexport interface UIAFlow {\n stages: Array<AuthType | string>;\n}\n\nexport interface IInputs {\n // An email address. If supplied, a flow using email verification will be chosen.\n emailAddress?: string;\n // An ISO two letter country code. Gives the country that opts.phoneNumber should be resolved relative to.\n phoneCountry?: string;\n // A phone number. If supplied, a flow using phone number validation will be chosen.\n phoneNumber?: string;\n registrationToken?: string;\n}\n\nexport interface IStageStatus {\n emailSid?: string;\n errcode?: string;\n error?: string;\n}\n\n/**\n * Data returned in the body of a 401 response from a UIA endpoint.\n *\n * @see https://spec.matrix.org/v1.6/client-server-api/#user-interactive-api-in-the-rest-api\n */\nexport interface IAuthData {\n /**\n * This is a session identifier that the client must pass back to the home server,\n * if one is provided, in subsequent attempts to authenticate in the same API call.\n */\n session?: string;\n /**\n * A list of the stages the client has completed successfully\n */\n completed?: string[];\n /**\n * A list of the login flows supported by the server for this API.\n */\n flows?: UIAFlow[];\n /**\n * Contains any information that the client will need to know in order to use a given type of authentication.\n * For each login type presented, that type may be present as a key in this dictionary.\n * For example, the public part of an OAuth client ID could be given here.\n */\n params?: Record<string, Record<string, any>>;\n}\n\nexport enum AuthType {\n Password = \"m.login.password\",\n Recaptcha = \"m.login.recaptcha\",\n Terms = \"m.login.terms\",\n Email = \"m.login.email.identity\",\n Msisdn = \"m.login.msisdn\",\n Sso = \"m.login.sso\",\n SsoUnstable = \"org.matrix.login.sso\",\n Dummy = \"m.login.dummy\",\n RegistrationToken = \"m.login.registration_token\",\n // For backwards compatability with servers that have not yet updated to\n // use the stable \"m.login.registration_token\" type.\n // The authentication flow is the same in both cases.\n UnstableRegistrationToken = \"org.matrix.msc3231.login.registration_token\",\n /**\n * m.oauth stage introduced by MSC4312:\n * https://spec.matrix.org/v1.17/client-server-api/#oauth-authentication\n */\n OAuth = \"m.oauth\",\n}\n\n/**\n * https://spec.matrix.org/v1.7/client-server-api/#password-based\n */\ntype PasswordDict = {\n type: AuthType.Password;\n identifier: UserIdentifier;\n password: string;\n session: string;\n};\n\n/**\n * https://spec.matrix.org/v1.7/client-server-api/#google-recaptcha\n */\ntype RecaptchaDict = {\n type: AuthType.Recaptcha;\n response: string;\n session: string;\n};\n\ninterface ThreepidCreds {\n sid: string;\n client_secret: string;\n id_server: string;\n id_access_token: string;\n}\n\n/**\n * https://spec.matrix.org/v1.7/client-server-api/#email-based-identity--homeserver\n */\ntype EmailIdentityDict = {\n type: AuthType.Email;\n threepid_creds: ThreepidCreds;\n session: string;\n};\n\n/**\n * The parameters which are submitted as the `auth` dict in a UIA request\n *\n * @see https://spec.matrix.org/v1.6/client-server-api/#authentication-types\n */\nexport type AuthDict =\n | PasswordDict\n | RecaptchaDict\n | EmailIdentityDict\n | { type: Exclude<string, AuthType>; [key: string]: any }\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n | {};\n\nexport class NoAuthFlowFoundError extends Error {\n public name = \"NoAuthFlowFoundError\";\n\n public constructor(\n m: string,\n public readonly required_stages: string[],\n public readonly flows: UIAFlow[],\n ) {\n super(m);\n }\n}\n\n/**\n * The type of an application callback to perform the user-interactive bit of UIA.\n *\n * It is called with a single parameter, `makeRequest`, which is a function which takes the UIA parameters and\n * makes the HTTP request. The `authData` parameter in `makeRequest` can be set to null to omit the `auth` field\n * from the UIA request.\n *\n * The generic parameter `T` is the type of the response of the endpoint, once it is eventually successful.\n */\nexport type UIAuthCallback<T> = (makeRequest: (authData: AuthDict | null) => Promise<T>) => Promise<T>;\n\ninterface IOpts<T> {\n /**\n * A matrix client to use for the auth process\n */\n matrixClient: MatrixClient;\n /**\n * Error response from the last request. If null, a request will be made with no auth before starting.\n */\n authData?: IAuthData;\n /**\n * Inputs provided by the user and used by different stages of the auto process.\n * The inputs provided will affect what flow is chosen.\n */\n inputs?: IInputs;\n /**\n * If resuming an existing interactive auth session, the sessionId of that session.\n */\n sessionId?: string;\n /**\n * If resuming an existing interactive auth session, the client secret for that session\n */\n clientSecret?: string;\n /**\n * If returning from having completed m.login.email.identity auth, the sid for the email verification session.\n */\n emailSid?: string;\n\n /**\n * If specified, will prefer flows which entirely consist of listed stages.\n * These should normally be of type AuthTypes but can be string when supporting custom auth stages.\n *\n * This can be used to avoid needing the fallback mechanism.\n */\n supportedStages?: Array<AuthType | string>;\n\n /**\n * Called with the new auth dict to submit the request.\n * Also passes a second deprecated arg which is a flag set to true if this request is a background request.\n * The busyChanged callback should be used instead of the background flag.\n * Should return a promise which resolves to the successful response or rejects with a MatrixError.\n */\n doRequest(this: void, auth: AuthDict | null, background: boolean): Promise<T>;\n /**\n * Called when the status of the UI auth changes,\n * ie. when the state of an auth stage changes of when the auth flow moves to a new stage.\n * The arguments are: the login type (eg m.login.password); and an object which is either an error or an\n * informational object specific to the login type.\n * If the 'errcode' key is defined, the object is an error, and has keys:\n * errcode: string, the textual error code, eg. M_UNKNOWN\n * error: string, human readable string describing the error\n *\n * The login type specific objects are as follows:\n * m.login.email.identity:\n * * emailSid: string, the sid of the active email auth session\n */\n stateUpdated(this: void, nextStage: AuthType | string, status: IStageStatus): void;\n\n /**\n * A function that takes the email address (string), clientSecret (string), attempt number (int) and\n * sessionId (string) and calls the relevant requestToken function and returns the promise returned by that\n * function.\n * If the resulting promise rejects, the rejection will propagate through to the attemptAuth promise.\n */\n requestEmailToken(\n this: void,\n email: string,\n secret: string,\n attempt: number,\n session: string,\n ): Promise<{ sid: string }>;\n /**\n * Called whenever the interactive auth logic becomes busy submitting information provided by the user or finishes.\n * After this has been called with true the UI should indicate that a request is in progress\n * until it is called again with false.\n */\n busyChanged?(this: void, busy: boolean): void;\n startAuthStage?(this: void, nextStage: string): Promise<void>; // LEGACY\n}\n\n/**\n * Abstracts the logic used to drive the interactive auth process.\n *\n * <p>Components implementing an interactive auth flow should instantiate one of\n * these, passing in the necessary callbacks to the constructor. They should\n * then call attemptAuth, which will return a promise which will resolve or\n * reject when the interactive-auth process completes.\n *\n * <p>Meanwhile, calls will be made to the startAuthStage and doRequest\n * callbacks, and information gathered from the user can be submitted with\n * submitAuthDict.\n *\n * @param opts - options object\n * @typeParam T - the return type of the request when it is successful\n */\nexport class InteractiveAuth<T> {\n private readonly matrixClient: MatrixClient;\n private readonly inputs: IInputs;\n private readonly clientSecret: string;\n private readonly requestCallback: IOpts<T>[\"doRequest\"];\n private readonly busyChangedCallback?: IOpts<T>[\"busyChanged\"];\n private readonly stateUpdatedCallback: IOpts<T>[\"stateUpdated\"];\n private readonly requestEmailTokenCallback: IOpts<T>[\"requestEmailToken\"];\n private readonly supportedStages?: Set<string>;\n\n // The current latest data or error received from the server during the user interactive auth flow.\n private data: IAuthData & MatrixError[\"data\"];\n private emailSid?: string;\n private requestingEmailToken = false;\n private attemptAuthDeferred: PromiseWithResolvers<T> | null = null;\n private chosenFlow: UIAFlow | null = null;\n private currentStage: string | null = null;\n\n private emailAttempt = 1;\n\n // if we are currently trying to submit an auth dict (which includes polling)\n // the promise the will resolve/reject when it completes\n private submitPromise: Promise<void> | null = null;\n\n public constructor(opts: IOpts<T>) {\n this.matrixClient = opts.matrixClient;\n this.data = opts.authData || { flows: [] };\n this.requestCallback = opts.doRequest;\n this.busyChangedCallback = opts.busyChanged;\n // startAuthStage included for backwards compat\n this.stateUpdatedCallback = opts.stateUpdated || opts.startAuthStage;\n this.requestEmailTokenCallback = opts.requestEmailToken;\n this.inputs = opts.inputs || {};\n\n if (opts.sessionId) this.data.session = opts.sessionId;\n this.clientSecret = opts.clientSecret || this.matrixClient.generateClientSecret();\n this.emailSid = opts.emailSid;\n if (opts.supportedStages !== undefined) this.supportedStages = new Set(opts.supportedStages);\n }\n\n /**\n * begin the authentication process.\n *\n * @returns which resolves to the response on success,\n * or rejects with the error on failure. Rejects with NoAuthFlowFoundError if\n * no suitable authentication flow can be found\n */\n public async attemptAuth(): Promise<T> {\n // This promise will be quite long-lived and will resolve when the\n // request is authenticated and completes successfully.\n this.attemptAuthDeferred = Promise.withResolvers();\n // pluck the promise out now, as doRequest may clear before we return\n const promise = this.attemptAuthDeferred.promise;\n\n // if we have no flows, try a request to acquire the flows\n if (!(this.data as IAuthData)?.flows?.length) {\n this.busyChangedCallback?.(true);\n // use the existing sessionId, if one is present.\n const auth = (this.data as IAuthData).session ? { session: (this.data as IAuthData).session } : null;\n this.doRequest(auth).finally(() => {\n this.busyChangedCallback?.(false);\n });\n } else {\n this.startNextAuthStage();\n }\n\n return promise;\n }\n\n /**\n * Poll to check if the auth session or current stage has been\n * completed out-of-band. If so, the attemptAuth promise will\n * be resolved.\n */\n public async poll(): Promise<void> {\n if (!(this.data as IAuthData).session) return;\n // likewise don't poll if there is no auth session in progress\n if (!this.attemptAuthDeferred) return;\n // if we currently have a request in flight, there's no point making\n // another just to check what the status is\n if (this.submitPromise) return;\n\n let authDict: AuthDict = {};\n if (this.currentStage == EMAIL_STAGE_TYPE) {\n // The email can be validated out-of-band, but we need to provide the\n // creds so the HS can go & check it.\n if (this.emailSid) {\n const creds: Record<string, string> = {\n sid: this.emailSid,\n client_secret: this.clientSecret,\n };\n const isUrl = this.matrixClient.getIdentityServerUrl();\n if (isUrl) {\n creds.id_server = new URL(isUrl).host;\n }\n authDict = {\n type: EMAIL_STAGE_TYPE,\n threepid_creds: creds,\n };\n }\n }\n\n this.submitAuthDict(authDict, true);\n }\n\n /**\n * get the auth session ID\n *\n * @returns session id\n */\n public getSessionId(): string | undefined {\n return (this.data as IAuthData)?.session;\n }\n\n /**\n * get the client secret used for validation sessions\n * with the identity server.\n *\n * @returns client secret\n */\n public getClientSecret(): string {\n return this.clientSecret;\n }\n\n /**\n * get the server params for a given stage\n *\n * @param loginType - login type for the stage\n * @returns any parameters from the server for this stage\n */\n public getStageParams(loginType: string): Record<string, any> | undefined {\n return (this.data as IAuthData)?.params?.[loginType];\n }\n\n public getChosenFlow(): UIAFlow | null {\n return this.chosenFlow;\n }\n\n /**\n * submit a new auth dict and fire off the request. This will either\n * make attemptAuth resolve/reject, or cause the startAuthStage callback\n * to be called for a new stage.\n *\n * @param authData - new auth dict to send to the server. Should\n * include a `type` property denoting the login type, as well as any\n * other params for that stage.\n * @param background - If true, this request failing will not result\n * in the attemptAuth promise being rejected. This can be set to true\n * for requests that just poll to see if auth has been completed elsewhere.\n */\n public async submitAuthDict(authData: AuthDict, background = false): Promise<void> {\n if (!this.attemptAuthDeferred) {\n throw new Error(\"submitAuthDict() called before attemptAuth()\");\n }\n\n if (!background) {\n this.busyChangedCallback?.(true);\n }\n\n // if we're currently trying a request, wait for it to finish\n // as otherwise we can get multiple 200 responses which can mean\n // things like multiple logins for register requests.\n while (this.submitPromise) {\n try {\n await this.submitPromise;\n } catch {\n // discard any exceptions as we only care when its done,\n // not whether it worked or not\n }\n }\n\n // use the sessionid from the last request, if one is present.\n let auth: AuthDict;\n if ((this.data as IAuthData)?.session) {\n auth = Object.assign(\n {\n session: (this.data as IAuthData).session,\n },\n authData,\n );\n } else {\n auth = authData;\n }\n\n try {\n // NB. the 'background' flag is deprecated by the busyChanged\n // callback and is here for backwards compat\n this.submitPromise = this.doRequest(auth, background);\n await this.submitPromise;\n } finally {\n this.submitPromise = null;\n if (!background) {\n this.busyChangedCallback?.(false);\n }\n }\n }\n\n /**\n * Gets the sid for the email validation session\n * Specific to m.login.email.identity\n *\n * @returns The sid of the email auth session\n */\n public getEmailSid(): string | undefined {\n return this.emailSid;\n }\n\n /**\n * Sets the sid for the email validation session\n * This must be set in order to successfully poll for completion\n * of the email validation.\n * Specific to m.login.email.identity\n *\n * @param sid - The sid for the email validation session\n */\n public setEmailSid(sid: string): void {\n this.emailSid = sid;\n }\n\n /**\n * Requests a new email token and sets the email sid for the validation session\n */\n public requestEmailToken = async (): Promise<void> => {\n if (!this.requestingEmailToken) {\n logger.trace(\"Requesting email token. Attempt: \" + this.emailAttempt);\n // If we've picked a flow with email auth, we send the email\n // now because we want the request to fail as soon as possible\n // if the email address is not valid (ie. already taken or not\n // registered, depending on what the operation is).\n this.requestingEmailToken = true;\n try {\n const requestTokenResult = await this.requestEmailTokenCallback(\n this.inputs.emailAddress!,\n this.clientSecret,\n this.emailAttempt++,\n (this.data as IAuthData).session!,\n );\n this.emailSid = requestTokenResult.sid;\n logger.trace(\"Email token request succeeded\");\n } finally {\n this.requestingEmailToken = false;\n }\n } else {\n logger.warn(\"Could not request email token: Already requesting\");\n }\n };\n\n /**\n * Fire off a request, and either resolve the promise, or call\n * startAuthStage.\n *\n * @internal\n * @param auth - new auth dict, including session id\n * @param background - If true, this request is a background poll, so it\n * failing will not result in the attemptAuth promise being rejected.\n * This can be set to true for requests that just poll to see if auth has\n * been completed elsewhere.\n */\n private async doRequest(auth: AuthDict | null, background = false): Promise<void> {\n try {\n const result = await this.requestCallback(auth, background);\n this.attemptAuthDeferred!.resolve(result);\n this.attemptAuthDeferred = null;\n } catch (error) {\n const matrixError = error instanceof MatrixError ? error : null;\n\n // sometimes UI auth errors don't come with flows\n const errorFlows = matrixError?.data?.flows ?? null;\n const haveFlows = (this.data as IAuthData)?.flows || Boolean(errorFlows);\n if (!matrixError || matrixError.httpStatus !== 401 || !matrixError.data || !haveFlows) {\n // doesn't look like an interactive-auth failure.\n if (!background) {\n this.attemptAuthDeferred?.reject(error);\n } else {\n // We ignore all failures here (even non-UI auth related ones)\n // since we don't want to suddenly fail if the internet connection\n // had a blip whilst we were polling\n logger.log(\"Background poll request failed doing UI auth: ignoring\", error);\n }\n }\n if (matrixError && !matrixError.data) {\n matrixError.data = {};\n }\n // if the error didn't come with flows, completed flows or session ID,\n // copy over the ones we have. Synapse sometimes sends responses without\n // any UI auth data (eg. when polling for email validation, if the email\n // has not yet been validated). This appears to be a Synapse bug, which\n // we workaround here.\n if (matrixError && !matrixError.data.flows && !matrixError.data.completed && !matrixError.data.session) {\n matrixError.data.flows = (this.data as IAuthData).flows;\n matrixError.data.completed = (this.data as IAuthData).completed;\n matrixError.data.session = (this.data as IAuthData).session;\n }\n if (matrixError) {\n this.data = matrixError.data;\n }\n try {\n this.startNextAuthStage();\n } catch (e) {\n this.attemptAuthDeferred!.reject(e);\n this.attemptAuthDeferred = null;\n return;\n }\n\n if (!this.emailSid && this.chosenFlow?.stages.includes(AuthType.Email)) {\n try {\n await this.requestEmailToken();\n // NB. promise is not resolved here - at some point, doRequest\n // will be called again and if the user has jumped through all\n // the hoops correctly, auth will be complete and the request\n // will succeed.\n // Also, we should expose the fact that this request has compledted\n // so clients can know that the email has actually been sent.\n } catch (e) {\n // we failed to request an email token, so fail the request.\n // This could be due to the email already beeing registered\n // (or not being registered, depending on what we're trying\n // to do) or it could be a network failure. Either way, pass\n // the failure up as the user can't complete auth if we can't\n // send the email, for whatever reason.\n this.attemptAuthDeferred!.reject(e);\n this.attemptAuthDeferred = null;\n }\n }\n }\n }\n\n /**\n * Pick the next stage and call the callback\n *\n * @internal\n * @throws {@link NoAuthFlowFoundError} If no suitable authentication flow can be found\n */\n private startNextAuthStage(): void {\n const nextStage = this.chooseStage();\n if (!nextStage) {\n throw new Error(\"No incomplete flows from the server\");\n }\n this.currentStage = nextStage;\n\n if (nextStage === AuthType.Dummy) {\n this.submitAuthDict({\n type: \"m.login.dummy\",\n });\n return;\n }\n\n if (this.data?.errcode || this.data?.error) {\n this.stateUpdatedCallback(nextStage, {\n errcode: this.data?.errcode || \"\",\n error: this.data?.error || \"\",\n });\n return;\n }\n\n this.stateUpdatedCallback(nextStage, nextStage === EMAIL_STAGE_TYPE ? { emailSid: this.emailSid } : {});\n }\n\n /**\n * Pick the next auth stage\n *\n * @internal\n * @returns login type\n * @throws {@link NoAuthFlowFoundError} If no suitable authentication flow can be found\n */\n private chooseStage(): AuthType | string | undefined {\n if (this.chosenFlow === null) {\n this.chosenFlow = this.chooseFlow();\n }\n logger.log(\"Active flow => %s\", JSON.stringify(this.chosenFlow));\n const nextStage = this.firstUncompletedStage(this.chosenFlow);\n logger.log(\"Next stage: %s\", nextStage);\n return nextStage;\n }\n\n // Returns a low number for flows we consider best. Counts increase for longer flows and even more so\n // for flows which contain stages not listed in `supportedStages`.\n private scoreFlow(flow: UIAFlow): number {\n let score = flow.stages.length;\n if (this.supportedStages !== undefined) {\n // Add 10 points to the score for each unsupported stage in the flow.\n score += flow.stages.filter((stage) => !this.supportedStages!.has(stage)).length * 10;\n }\n return score;\n }\n\n /**\n * Pick one of the flows from the returned list\n * If a flow using all of the inputs is found, it will\n * be returned, otherwise, null will be returned.\n *\n * Only flows using all given inputs are chosen because it\n * is likely to be surprising if the user provides a\n * credential and it is not used. For example, for registration,\n * this could result in the email not being used which would leave\n * the account with no means to reset a password.\n *\n * @internal\n * @returns flow\n * @throws {@link NoAuthFlowFoundError} If no suitable authentication flow can be found\n */\n private chooseFlow(): UIAFlow {\n const flows = (this.data as IAuthData)?.flows || [];\n\n // we've been given an email or we've already done an email part\n const haveEmail = Boolean(this.inputs.emailAddress) || Boolean(this.emailSid);\n const haveMsisdn = Boolean(this.inputs.phoneCountry) && Boolean(this.inputs.phoneNumber);\n\n // Flows are not represented in a significant order, so we can choose any we support best\n // Sort flows based on how many unsupported stages they contain ascending\n flows.sort((a, b) => this.scoreFlow(a) - this.scoreFlow(b));\n\n for (const flow of flows) {\n let flowHasEmail = false;\n let flowHasMsisdn = false;\n for (const stage of flow.stages) {\n if (stage === EMAIL_STAGE_TYPE) {\n flowHasEmail = true;\n } else if (stage == MSISDN_STAGE_TYPE) {\n flowHasMsisdn = true;\n }\n }\n\n if (flowHasEmail == haveEmail && flowHasMsisdn == haveMsisdn) {\n return flow;\n }\n }\n\n const requiredStages: string[] = [];\n if (haveEmail) requiredStages.push(EMAIL_STAGE_TYPE);\n if (haveMsisdn) requiredStages.push(MSISDN_STAGE_TYPE);\n // Throw an error with a fairly generic description, but with more\n // information such that the app can give a better one if so desired.\n throw new NoAuthFlowFoundError(\"No appropriate authentication flow found\", requiredStages, flows);\n }\n\n /**\n * Get the first uncompleted stage in the given flow\n *\n * @internal\n * @returns login type\n */\n private firstUncompletedStage(flow: UIAFlow): AuthType | string | undefined {\n const completed = (this.data as IAuthData)?.completed || [];\n return flow.stages.find((stageType) => !completed.includes(stageType));\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,MAAM,QAAQ,aAAa;AAEpC,SAAS,WAAW,QAAQ,qBAAqB;AAGjD,MAAM,gBAAgB,GAAG,wBAAwB;AACjD,MAAM,iBAAiB,GAAG,gBAAgB;;AAsB1C;AACA;AACA;AACA;AACA;;AAuBA,WAAY,QAAQ,0BAAR,QAAQ;EAAR,QAAQ;EAAR,QAAQ;EAAR,QAAQ;EAAR,QAAQ;EAAR,QAAQ;EAAR,QAAQ;EAAR,QAAQ;EAAR,QAAQ;EAAR,QAAQ;EAUhB;EACA;EACA;EAZQ,QAAQ;EAchB;AACJ;AACA;AACA;EAjBY,QAAQ;E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I,CAEhC;IAEM,KAAK,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAEhC;IAEM,IAAI,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAE/B;IAEM,IAAI,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAE/B;IAEM,KAAK,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAEhC;CACJ;AAED;;;GAGG;AACH,UAAU,QAAQ;IACd,CAAC,SAAS,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IACvC,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,QAAQ,CAAC;CAC/D;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,WAAY,YAAW,MAAM;IACnB,OAAO,CAAC,aAAa;IAAxC,YAA2B,aAAa,EAAE,QAAQ,EAAI;IAE/C,KAAK,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAEhC;IAEM,KAAK,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAEhC;IAEM,IAAI,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAE/B;IAEM,IAAI,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAE/B;IAEM,KAAK,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAEhC;IAEM,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,CAE9C;IAED,OAAO,CAAC,eAAe;CAiB1B"}
|
|
@@ -39,11 +39,9 @@ const DEFAULT_NAMESPACE = "matrix";
|
|
|
39
39
|
// when logging so we always get the current value of console methods.
|
|
40
40
|
loglevel.methodFactory = function (methodName, logLevel, loggerName) {
|
|
41
41
|
return function (...args) {
|
|
42
|
-
/* eslint-disable @typescript-eslint/no-invalid-this */
|
|
43
42
|
if (this.prefix) {
|
|
44
43
|
args.unshift(this.prefix);
|
|
45
44
|
}
|
|
46
|
-
/* eslint-enable @typescript-eslint/no-invalid-this */
|
|
47
45
|
const supportedByConsole = methodName === "error" || methodName === "warn" || methodName === "trace" || methodName === "info" || methodName === "debug";
|
|
48
46
|
/* eslint-disable no-console */
|
|
49
47
|
if (supportedByConsole) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","names":[],"sources":["../src/logger.ts"],"sourcesContent":["/*\nCopyright 2018 André Jaenisch\nCopyright 2019-2025 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport loglevel from \"loglevel\";\n\n/** Backwards-compatibility hack to expose `log` to applications that might still be relying on it. */\ninterface LoggerWithLogMethod extends Logger {\n /**\n * Output debug message to the logger.\n *\n * @param msg - Data to log.\n *\n * @deprecated prefer {@link Logger.debug}.\n */\n log(...msg: any[]): void;\n}\n\n/** Logger interface used within the js-sdk codebase */\nexport interface Logger extends BaseLogger {\n /**\n * Create a child logger.\n *\n * This child will use the `methodFactory` of the parent, so any log extensions applied to the parent\n * at the time of calling `getChild` will be applied to the child as well.\n * It will NOT apply changes to the parent's `methodFactory` after the child was created.\n * Those changes need to be applied to the child manually.\n *\n * @param namespace - name to add to the current logger to generate the child. Some implementations of `Logger`\n * use this as a prefix; others use a different mechanism.\n */\n getChild(namespace: string): Logger;\n}\n\n/** The basic interface for a logger which doesn't support children */\nexport interface BaseLogger {\n /**\n * Output trace message to the logger, with stack trace.\n *\n * @param msg - Data to log.\n */\n trace(this: void, ...msg: any[]): void;\n\n /**\n * Output debug message to the logger.\n *\n * @param msg - Data to log.\n */\n debug(this: void, ...msg: any[]): void;\n\n /**\n * Output info message to the logger.\n *\n * @param msg - Data to log.\n */\n info(this: void, ...msg: any[]): void;\n\n /**\n * Output warn message to the logger.\n *\n * @param msg - Data to log.\n */\n warn(this: void, ...msg: any[]): void;\n\n /**\n * Output error message to the logger.\n *\n * @param msg - Data to log.\n */\n error(this: void, ...msg: any[]): void;\n}\n\n// This is to demonstrate, that you can use any namespace you want.\n// Namespaces allow you to turn on/off the logging for specific parts of the\n// application.\n// An idea would be to control this via an environment variable (on Node.js).\n// See https://www.npmjs.com/package/debug to see how this could be implemented\n// Part of #332 is introducing a logging library in the first place.\nconst DEFAULT_NAMESPACE = \"matrix\";\n\n// because rageshakes in react-sdk hijack the console log, also at module load time,\n// initializing the logger here races with the initialization of rageshakes.\n// to avoid the issue, we override the methodFactory of loglevel that binds to the\n// console methods at initialization time by a factory that looks up the console methods\n// when logging so we always get the current value of console methods.\nloglevel.methodFactory = function (methodName, logLevel, loggerName) {\n return function (this: PrefixedLogger, ...args): void {\n /* eslint-disable @typescript-eslint/no-invalid-this */\n if (this.prefix) {\n args.unshift(this.prefix);\n }\n /* eslint-enable @typescript-eslint/no-invalid-this */\n const supportedByConsole =\n methodName === \"error\" ||\n methodName === \"warn\" ||\n methodName === \"trace\" ||\n methodName === \"info\" ||\n methodName === \"debug\";\n /* eslint-disable no-console */\n if (supportedByConsole) {\n return console[methodName](...args);\n } else {\n return console.log(...args);\n }\n /* eslint-enable no-console */\n };\n};\n\n/**\n * Implementation of {@link Logger} based on `loglevel`.\n */\ninterface PrefixedLogger extends loglevel.Logger, LoggerWithLogMethod {\n prefix?: string;\n}\n\n/**\n * Internal utility function: gets a {@link Logger} based on `loglevel`.\n *\n * Child loggers produced by {@link Logger.getChild} add the name of the child logger as a prefix on each log line.\n *\n * @param prefix Prefix to add to each logged line. If undefined, no prefix will be added.\n */\nfunction getPrefixedLogger(prefix?: string): PrefixedLogger {\n const loggerName = DEFAULT_NAMESPACE + (prefix === undefined ? \"\" : `-${prefix}`);\n const prefixLogger = loglevel.getLogger(loggerName) as PrefixedLogger;\n\n if (prefixLogger.getChild === undefined) {\n // This is a new loglevel Logger which has not been turned into a PrefixedLogger yet.\n prefixLogger.prefix = prefix;\n prefixLogger.getChild = (childPrefix): Logger => {\n // create the new child logger\n const childLogger = getPrefixedLogger((prefix ?? \"\") + childPrefix);\n // Assign the methodFactory from the parent logger.\n // This is useful if we add extensions to the parent logger that modifies\n // its methodFactory. (An example extension is: storing each log to a rageshake db)\n childLogger.methodFactory = prefixLogger.methodFactory;\n // Rebuild the child logger with the new methodFactory.\n childLogger.rebuild();\n return childLogger;\n };\n prefixLogger.setLevel(loglevel.levels.DEBUG, false);\n }\n\n return prefixLogger;\n}\n\n/**\n * Drop-in replacement for `console` using {@link https://www.npmjs.com/package/loglevel|loglevel}.\n * Can be tailored down to specific use cases if needed.\n *\n * @deprecated avoid the use of this unless you are the constructor of `MatrixClient`: you should be using the logger\n * associated with `MatrixClient`.\n */\nexport const logger = getPrefixedLogger() as LoggerWithLogMethod;\n\n/**\n * A \"span\" for grouping related log lines together.\n *\n * The current implementation just adds the name at the start of each log line.\n *\n * This offers a lighter-weight alternative to 'child' loggers returned by {@link Logger#getChild}. In particular,\n * it's not possible to apply individual filters to the LogSpan such as setting the verbosity level. On the other hand,\n * no reference to the LogSpan is retained in the logging framework, so it is safe to make lots of them over the course\n * of an application's life and just drop references to them when the job is done.\n */\nexport class LogSpan implements BaseLogger {\n private readonly name;\n\n public constructor(\n private readonly parent: BaseLogger,\n name: string,\n ) {\n this.name = name + \":\";\n }\n\n public trace(...msg: any[]): void {\n this.parent.trace(this.name, ...msg);\n }\n\n public debug(...msg: any[]): void {\n this.parent.debug(this.name, ...msg);\n }\n\n public info(...msg: any[]): void {\n this.parent.info(this.name, ...msg);\n }\n\n public warn(...msg: any[]): void {\n this.parent.warn(this.name, ...msg);\n }\n\n public error(...msg: any[]): void {\n this.parent.error(this.name, ...msg);\n }\n}\n\n/**\n * A simplification of the `Debugger` type exposed by the `debug` library. We reimplement the bits we need here\n * to avoid a dependency on `debug`.\n */\ninterface Debugger {\n (formatter: any, ...args: any[]): void;\n extend: (namespace: string, delimiter?: string) => Debugger;\n}\n\n/**\n * A `Logger` instance, suitable for use in {@link ICreateClientOpts.logger}, which will write to the `debug` library.\n *\n * @example\n * ```js\n * import debug from \"debug\";\n *\n * const client = createClient({\n * baseUrl: homeserverUrl,\n * userId: userId,\n * accessToken: \"akjgkrgjs\",\n * deviceId: \"xzcvb\",\n * logger: new DebugLogger(debug(`matrix-js-sdk:${userId}`)),\n * });\n * ```\n */\nexport class DebugLogger implements Logger {\n public constructor(private debugInstance: Debugger) {}\n\n public trace(...msg: any[]): void {\n this.debugWithPrefix(\"[TRACE]\", ...msg);\n }\n\n public debug(...msg: any[]): void {\n this.debugWithPrefix(\"[DEBUG]\", ...msg);\n }\n\n public info(...msg: any[]): void {\n this.debugWithPrefix(\"[INFO]\", ...msg);\n }\n\n public warn(...msg: any[]): void {\n this.debugWithPrefix(\"[WARN]\", ...msg);\n }\n\n public error(...msg: any[]): void {\n this.debugWithPrefix(\"[ERROR]\", ...msg);\n }\n\n public getChild(namespace: string): DebugLogger {\n return new DebugLogger(this.debugInstance.extend(namespace));\n }\n\n private debugWithPrefix(prefix: string, ...msg: any[]): void {\n let formatter: string;\n\n // Convert the first argument to a string, so that we can safely add a prefix. This is much the same logic that\n // `debug()` uses.\n if (msg.length === 0) {\n formatter = \"\";\n } else if (msg[0] instanceof Error) {\n const err = msg.shift();\n formatter = err.stack || err.message;\n } else if (typeof msg[0] == \"string\") {\n formatter = msg.shift();\n } else {\n formatter = \"%O\";\n }\n this.debugInstance(prefix + \" \" + formatter, ...msg);\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,QAAQ,MA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AS,GAAG,IAAI;IACpB;IACA,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,GAAG,GAAG,SAAS,EAAE,GAAG,GAAG,CAAC;EACxD;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"logger.js","names":[],"sources":["../src/logger.ts"],"sourcesContent":["/*\nCopyright 2018 André Jaenisch\nCopyright 2019-2025 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport loglevel from \"loglevel\";\n\n/** Backwards-compatibility hack to expose `log` to applications that might still be relying on it. */\ninterface LoggerWithLogMethod extends Logger {\n /**\n * Output debug message to the logger.\n *\n * @param msg - Data to log.\n *\n * @deprecated prefer {@link Logger.debug}.\n */\n log(...msg: any[]): void;\n}\n\n/** Logger interface used within the js-sdk codebase */\nexport interface Logger extends BaseLogger {\n /**\n * Create a child logger.\n *\n * This child will use the `methodFactory` of the parent, so any log extensions applied to the parent\n * at the time of calling `getChild` will be applied to the child as well.\n * It will NOT apply changes to the parent's `methodFactory` after the child was created.\n * Those changes need to be applied to the child manually.\n *\n * @param namespace - name to add to the current logger to generate the child. Some implementations of `Logger`\n * use this as a prefix; others use a different mechanism.\n */\n getChild(namespace: string): Logger;\n}\n\n/** The basic interface for a logger which doesn't support children */\nexport interface BaseLogger {\n /**\n * Output trace message to the logger, with stack trace.\n *\n * @param msg - Data to log.\n */\n trace(this: void, ...msg: any[]): void;\n\n /**\n * Output debug message to the logger.\n *\n * @param msg - Data to log.\n */\n debug(this: void, ...msg: any[]): void;\n\n /**\n * Output info message to the logger.\n *\n * @param msg - Data to log.\n */\n info(this: void, ...msg: any[]): void;\n\n /**\n * Output warn message to the logger.\n *\n * @param msg - Data to log.\n */\n warn(this: void, ...msg: any[]): void;\n\n /**\n * Output error message to the logger.\n *\n * @param msg - Data to log.\n */\n error(this: void, ...msg: any[]): void;\n}\n\n// This is to demonstrate, that you can use any namespace you want.\n// Namespaces allow you to turn on/off the logging for specific parts of the\n// application.\n// An idea would be to control this via an environment variable (on Node.js).\n// See https://www.npmjs.com/package/debug to see how this could be implemented\n// Part of #332 is introducing a logging library in the first place.\nconst DEFAULT_NAMESPACE = \"matrix\";\n\n// because rageshakes in react-sdk hijack the console log, also at module load time,\n// initializing the logger here races with the initialization of rageshakes.\n// to avoid the issue, we override the methodFactory of loglevel that binds to the\n// console methods at initialization time by a factory that looks up the console methods\n// when logging so we always get the current value of console methods.\nloglevel.methodFactory = function (methodName, logLevel, loggerName) {\n return function (this: PrefixedLogger, ...args): void {\n if (this.prefix) {\n args.unshift(this.prefix);\n }\n const supportedByConsole =\n methodName === \"error\" ||\n methodName === \"warn\" ||\n methodName === \"trace\" ||\n methodName === \"info\" ||\n methodName === \"debug\";\n /* eslint-disable no-console */\n if (supportedByConsole) {\n return console[methodName](...args);\n } else {\n return console.log(...args);\n }\n /* eslint-enable no-console */\n };\n};\n\n/**\n * Implementation of {@link Logger} based on `loglevel`.\n */\ninterface PrefixedLogger extends loglevel.Logger, LoggerWithLogMethod {\n prefix?: string;\n}\n\n/**\n * Internal utility function: gets a {@link Logger} based on `loglevel`.\n *\n * Child loggers produced by {@link Logger.getChild} add the name of the child logger as a prefix on each log line.\n *\n * @param prefix Prefix to add to each logged line. If undefined, no prefix will be added.\n */\nfunction getPrefixedLogger(prefix?: string): PrefixedLogger {\n const loggerName = DEFAULT_NAMESPACE + (prefix === undefined ? \"\" : `-${prefix}`);\n const prefixLogger = loglevel.getLogger(loggerName) as PrefixedLogger;\n\n if (prefixLogger.getChild === undefined) {\n // This is a new loglevel Logger which has not been turned into a PrefixedLogger yet.\n prefixLogger.prefix = prefix;\n prefixLogger.getChild = (childPrefix): Logger => {\n // create the new child logger\n const childLogger = getPrefixedLogger((prefix ?? \"\") + childPrefix);\n // Assign the methodFactory from the parent logger.\n // This is useful if we add extensions to the parent logger that modifies\n // its methodFactory. (An example extension is: storing each log to a rageshake db)\n childLogger.methodFactory = prefixLogger.methodFactory;\n // Rebuild the child logger with the new methodFactory.\n childLogger.rebuild();\n return childLogger;\n };\n prefixLogger.setLevel(loglevel.levels.DEBUG, false);\n }\n\n return prefixLogger;\n}\n\n/**\n * Drop-in replacement for `console` using {@link https://www.npmjs.com/package/loglevel|loglevel}.\n * Can be tailored down to specific use cases if needed.\n *\n * @deprecated avoid the use of this unless you are the constructor of `MatrixClient`: you should be using the logger\n * associated with `MatrixClient`.\n */\nexport const logger = getPrefixedLogger() as LoggerWithLogMethod;\n\n/**\n * A \"span\" for grouping related log lines together.\n *\n * The current implementation just adds the name at the start of each log line.\n *\n * This offers a lighter-weight alternative to 'child' loggers returned by {@link Logger#getChild}. In particular,\n * it's not possible to apply individual filters to the LogSpan such as setting the verbosity level. On the other hand,\n * no reference to the LogSpan is retained in the logging framework, so it is safe to make lots of them over the course\n * of an application's life and just drop references to them when the job is done.\n */\nexport class LogSpan implements BaseLogger {\n private readonly name;\n\n public constructor(\n private readonly parent: BaseLogger,\n name: string,\n ) {\n this.name = name + \":\";\n }\n\n public trace(...msg: any[]): void {\n this.parent.trace(this.name, ...msg);\n }\n\n public debug(...msg: any[]): void {\n this.parent.debug(this.name, ...msg);\n }\n\n public info(...msg: any[]): void {\n this.parent.info(this.name, ...msg);\n }\n\n public warn(...msg: any[]): void {\n this.parent.warn(this.name, ...msg);\n }\n\n public error(...msg: any[]): void {\n this.parent.error(this.name, ...msg);\n }\n}\n\n/**\n * A simplification of the `Debugger` type exposed by the `debug` library. We reimplement the bits we need here\n * to avoid a dependency on `debug`.\n */\ninterface Debugger {\n (formatter: any, ...args: any[]): void;\n extend: (namespace: string, delimiter?: string) => Debugger;\n}\n\n/**\n * A `Logger` instance, suitable for use in {@link ICreateClientOpts.logger}, which will write to the `debug` library.\n *\n * @example\n * ```js\n * import debug from \"debug\";\n *\n * const client = createClient({\n * baseUrl: homeserverUrl,\n * userId: userId,\n * accessToken: \"akjgkrgjs\",\n * deviceId: \"xzcvb\",\n * logger: new DebugLogger(debug(`matrix-js-sdk:${userId}`)),\n * });\n * ```\n */\nexport class DebugLogger implements Logger {\n public constructor(private debugInstance: Debugger) {}\n\n public trace(...msg: any[]): void {\n this.debugWithPrefix(\"[TRACE]\", ...msg);\n }\n\n public debug(...msg: any[]): void {\n this.debugWithPrefix(\"[DEBUG]\", ...msg);\n }\n\n public info(...msg: any[]): void {\n this.debugWithPrefix(\"[INFO]\", ...msg);\n }\n\n public warn(...msg: any[]): void {\n this.debugWithPrefix(\"[WARN]\", ...msg);\n }\n\n public error(...msg: any[]): void {\n this.debugWithPrefix(\"[ERROR]\", ...msg);\n }\n\n public getChild(namespace: string): DebugLogger {\n return new DebugLogger(this.debugInstance.extend(namespace));\n }\n\n private debugWithPrefix(prefix: string, ...msg: any[]): void {\n let formatter: string;\n\n // Convert the first argument to a string, so that we can safely add a prefix. This is much the same logic that\n // `debug()` uses.\n if (msg.length === 0) {\n formatter = \"\";\n } else if (msg[0] instanceof Error) {\n const err = msg.shift();\n formatter = err.stack || err.message;\n } else if (typeof msg[0] == \"string\") {\n formatter = msg.shift();\n } else {\n formatter = \"%O\";\n }\n this.debugInstance(prefix + \" \" + formatter, ...msg);\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,QAAQ,MAAM,UAAU;;AAE/B;;AAYA;;AAgBA;;AAsCA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,iBAAiB,GAAG,QAAQ;;AAElC;AACA;AACA;AACA;AACA;AACA,QAAQ,CAAC,aAAa,GAAG,UAAU,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE;EACjE,OAAO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export * from "./models/device.ts";
|
|
25
25
|
export * from "./models/search-result.ts";
|
|
26
|
-
export * from "./
|
|
26
|
+
export * from "./oauth/index.ts";
|
|
27
27
|
export * from "./scheduler.ts";
|
|
28
28
|
export * from "./filter.ts";
|
|
29
29
|
export * from "./timeline-window.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../src/matrix.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAKnD,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iCAAiC,CAAC;AAChD,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,
|
|
1
|
+
{"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../src/matrix.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAKnD,OA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CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,+BAA+B,EAAE,MAAM,yCAAyC,CAAC;AAC9G,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpE,YAAY,EAAE,QAAQ,IAAI,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvE,YAAY,EAAE,kBAAkB,IAAI,iBAAiB,EAAE,cAAc,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1C;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,WAAW,GAAG,IAAI,CAElE;AAcD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,iBAAiB,GAAG,YAAY,CAElE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAClC,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,aAAa,EAC3B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,iBAAiB,EACvB,iBAAiB,UAAO,GACzB,YAAY,CAEd"}
|
|
@@ -40,7 +40,7 @@ export * from "./models/typed-event-emitter.js";
|
|
|
40
40
|
export * from "./models/user.js";
|
|
41
41
|
export * from "./models/device.js";
|
|
42
42
|
export * from "./models/search-result.js";
|
|
43
|
-
export * from "./
|
|
43
|
+
export * from "./oauth/index.js";
|
|
44
44
|
export * from "./scheduler.js";
|
|
45
45
|
export * from "./filter.js";
|
|
46
46
|
export * from "./timeline-window.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matrix.js","names":[],"sources":["../src/matrix.ts"],"sourcesContent":["/*\nCopyright 2015-2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { type WidgetApi } from \"matrix-widget-api\";\n\nimport { MemoryCryptoStore } from \"./crypto/store/memory-crypto-store.ts\";\nimport { MemoryStore } from \"./store/memory.ts\";\nimport { MatrixScheduler } from \"./scheduler.ts\";\nimport { MatrixClient, type ICreateClientOpts } from \"./client.ts\";\nimport { RoomWidgetClient, type ICapabilities } from \"./embedded.ts\";\nimport { type CryptoStore } from \"./crypto/store/base.ts\";\n\nexport * from \"./client.ts\";\nexport * from \"./serverCapabilities.ts\";\nexport * from \"./embedded.ts\";\nexport * from \"./http-api/index.ts\";\nexport * from \"./autodiscovery.ts\";\nexport * from \"./sync-accumulator.ts\";\nexport * from \"./errors.ts\";\nexport * from \"./base64.ts\";\nexport * from \"./models/beacon.ts\";\nexport * from \"./models/event.ts\";\nexport * from \"./models/room.ts\";\nexport * from \"./models/event-timeline.ts\";\nexport * from \"./models/event-timeline-set.ts\";\nexport * from \"./models/poll.ts\";\nexport * from \"./models/room-member.ts\";\nexport * from \"./models/room-state.ts\";\nexport * from \"./models/thread.ts\";\nexport * from \"./models/typed-event-emitter.ts\";\nexport * from \"./models/user.ts\";\nexport * from \"./models/device.ts\";\nexport * from \"./models/search-result.ts\";\nexport * from \"./oidc/index.ts\";\nexport * from \"./scheduler.ts\";\nexport * from \"./filter.ts\";\nexport * from \"./timeline-window.ts\";\nexport * from \"./interactive-auth.ts\";\nexport * from \"./version-support.ts\";\nexport * from \"./service-types.ts\";\nexport * from \"./store/memory.ts\";\nexport * from \"./store/indexeddb.ts\";\nexport * from \"./crypto/store/memory-crypto-store.ts\";\nexport * from \"./crypto/store/localStorage-crypto-store.ts\";\nexport * from \"./crypto/store/indexeddb-crypto-store.ts\";\nexport type { OutgoingRoomKeyRequest } from \"./crypto/store/base.ts\";\nexport * from \"./content-repo.ts\";\nexport type * from \"./@types/common.ts\";\nexport type * from \"./@types/uia.ts\";\nexport * from \"./@types/event.ts\";\nexport * from \"./@types/PushRules.ts\";\nexport * from \"./@types/partials.ts\";\nexport * from \"./@types/requests.ts\";\nexport * from \"./@types/search.ts\";\nexport * from \"./@types/beacon.ts\";\nexport * from \"./@types/topic.ts\";\nexport * from \"./@types/location.ts\";\nexport * from \"./@types/threepids.ts\";\nexport * from \"./@types/auth.ts\";\nexport * from \"./@types/polls.ts\";\nexport * from \"./@types/retention.ts\";\nexport type * from \"./@types/local_notifications.ts\";\nexport type * from \"./@types/registration.ts\";\nexport * from \"./@types/read_receipts.ts\";\nexport type * from \"./@types/crypto.ts\";\nexport * from \"./@types/extensible_events.ts\";\nexport type * from \"./@types/IIdentityServerProvider.ts\";\nexport * from \"./@types/membership.ts\";\nexport * from \"./models/room-summary.ts\";\nexport * from \"./models/event-status.ts\";\nexport * from \"./models/profile-keys.ts\";\nexport * from \"./models/related-relations.ts\";\nexport { type StickyMatrixEvent, RoomStickyEventsEvent } from \"./models/room-sticky-events.ts\";\nexport type { RoomSummary } from \"./client.ts\";\nexport * as ContentHelpers from \"./content-helpers.ts\";\nexport * as SecretStorage from \"./secret-storage.ts\";\nexport { createNewMatrixCall, CallEvent } from \"./webrtc/call.ts\";\nexport type { MatrixCall } from \"./webrtc/call.ts\";\nexport {\n GroupCall,\n GroupCallEvent,\n GroupCallIntent,\n GroupCallState,\n GroupCallType,\n GroupCallStatsReportEvent,\n} from \"./webrtc/groupCall.ts\";\n\nexport { SyncState, SetPresence } from \"./sync.ts\";\nexport type { ISyncStateData as SyncStateData } from \"./sync.ts\";\nexport { SlidingSyncEvent } from \"./sliding-sync.ts\";\nexport { MediaHandlerEvent } from \"./webrtc/mediaHandler.ts\";\nexport { CallFeedEvent } from \"./webrtc/callFeed.ts\";\nexport { StatsReport } from \"./webrtc/stats/statsReport.ts\";\nexport { Relations, RelationsEvent } from \"./models/relations.ts\";\nexport { TypedEventEmitter } from \"./models/typed-event-emitter.ts\";\nexport { LocalStorageErrors, localStorageErrorsEventsEmitter } from \"./store/local-storage-events-emitter.ts\";\nexport { IdentityProviderBrand, SSOAction } from \"./@types/auth.ts\";\nexport type { ISSOFlow as SSOFlow, LoginFlow } from \"./@types/auth.ts\";\nexport type { IHierarchyRelation as HierarchyRelation, IHierarchyRoom as HierarchyRoom } from \"./@types/spaces.ts\";\nexport { LocationAssetType } from \"./@types/location.ts\";\nexport { DebugLogger } from \"./logger.ts\";\n\nlet cryptoStoreFactory = (): CryptoStore => new MemoryCryptoStore();\n\n/**\n * Configure a different factory to be used for creating crypto stores\n *\n * @param fac - a function which will return a new `CryptoStore`\n */\nexport function setCryptoStoreFactory(fac: () => CryptoStore): void {\n cryptoStoreFactory = fac;\n}\n\nfunction amendClientOpts(opts: ICreateClientOpts): ICreateClientOpts {\n opts.store =\n opts.store ??\n new MemoryStore({\n localStorage: globalThis.localStorage,\n });\n opts.scheduler = opts.scheduler ?? new MatrixScheduler();\n opts.cryptoStore = opts.cryptoStore ?? cryptoStoreFactory();\n\n return opts;\n}\n\n/**\n * Construct a Matrix Client. Similar to {@link MatrixClient}\n * except that the 'request', 'store' and 'scheduler' dependencies are satisfied.\n * @param opts - The configuration options for this client. These configuration\n * options will be passed directly to {@link MatrixClient}.\n *\n * @returns A new matrix client.\n * @see {@link MatrixClient} for the full list of options for\n * `opts`.\n */\nexport function createClient(opts: ICreateClientOpts): MatrixClient {\n return new MatrixClient(amendClientOpts(opts));\n}\n\n/**\n * Construct a Matrix Client that works in a widget.\n * This client has a subset of features compared to a full client.\n * It uses the widget-api to communicate with matrix. (widget \\<-\\> client \\<-\\> homeserver)\n * @returns A new matrix client with a subset of features.\n * @param opts - The configuration options for this client. These configuration\n * options will be passed directly to {@link MatrixClient}.\n * @param widgetApi - The widget api to use for communication.\n * @param capabilities - The capabilities the widget client will request.\n * @param roomId - The room id the widget is associated with.\n * @param sendContentLoaded - Whether to send a content loaded widget action immediately after initial setup.\n * Set to `false` if the widget uses `waitForIFrameLoad=true` (in this case the client does not expect a content loaded action at all),\n * or if the the widget wants to send the `ContentLoaded` action at a later point in time after the initial setup.\n */\nexport function createRoomWidgetClient(\n widgetApi: WidgetApi,\n capabilities: ICapabilities,\n roomId: string,\n opts: ICreateClientOpts,\n sendContentLoaded = true,\n): MatrixClient {\n return new RoomWidgetClient(widgetApi, capabilities, roomId, amendClientOpts(opts), sendContentLoaded);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAAS,iBAAiB,QAAQ,uCAAuC;AACzE,SAAS,WAAW,QAAQ,mBAAmB;AAC/C,SAAS,eAAe,QAAQ,gBAAgB;AAChD,SAAS,YAAY,QAAgC,aAAa;AAClE,SAAS,gBAAgB,QAA4B,eAAe;AAGpE,cAAc,aAAa;AAC3B,cAAc,yBAAyB;AACvC,cAAc,eAAe;AAC7B,cAAc,qBAAqB;AACnC,cAAc,oBAAoB;AAClC,cAAc,uBAAuB;AACrC,cAAc,aAAa;AAC3B,cAAc,aAAa;AAC3B,cAAc,oBAAoB;AAClC,cAAc,mBAAmB;AACjC,cAAc,kBAAkB;AAChC,cAAc,4BAA4B;AAC1C,cAAc,gCAAgC;AAC9C,cAAc,kBAAkB;AAChC,cAAc,yBAAyB;AACvC,cAAc,wBAAwB;AACtC,cAAc,oBAAoB;AAClC,cAAc,iCAAiC;AAC/C,cAAc,kBAAkB;AAChC,cAAc,oBAAoB;AAClC,cAAc,2BAA2B;AACzC,cAAc,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AS,qBAAqB,EAAE,SAAS,QAAQ,kBAAkB;AAGnE,SAAS,iBAAiB,QAAQ,sBAAsB;AACxD,SAAS,WAAW,QAAQ,aAAa;AAEzC,IAAI,kBAAkB,GAAG,MAAmB,IAAI,iBAAiB,CAAC,CAAC;;AAEnE;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS,qBAAqB,CAAC,GAAsB,EAAQ;EAChE,kBAAkB,GAAG,GAAG;AAC5B;AAEA,SAAS,eAAe,CAAC,IAAuB,EAAqB;EACjE,IAAI,CAAC,KAAK,GACN,IAAI,CAAC,KAAK,IACV,IAAI,WAAW,CAAC;IACZ,YAAY,EAAE,UAAU,CAAC;EAC7B,CAAC,CAAC;EACN,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,eAAe,CAAC,CAAC;EACxD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,kBAAkB,CAAC,CAAC;EAE3D,OAAO,IAAI;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS,YAAY,CAAC,IAAuB,EAAgB;EAChE,OAAO,IAAI,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAClD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS,sBAAsB,CAClC,SAAoB,EACpB,YAA2B,EAC3B,MAAc,EACd,IAAuB,EACvB,iBAAiB,GAAG,IAAI,EACZ;EACZ,OAAO,IAAI,gBAAgB,CAAC,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE,iBAAiB,CAAC;AAC1G","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"matrix.js","names":[],"sources":["../src/matrix.ts"],"sourcesContent":["/*\nCopyright 2015-2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { type WidgetApi } from \"matrix-widget-api\";\n\nimport { MemoryCryptoStore } from \"./crypto/store/memory-crypto-store.ts\";\nimport { MemoryStore } from \"./store/memory.ts\";\nimport { MatrixScheduler } from \"./scheduler.ts\";\nimport { MatrixClient, type ICreateClientOpts } from \"./client.ts\";\nimport { RoomWidgetClient, type ICapabilities } from \"./embedded.ts\";\nimport { type CryptoStore } from \"./crypto/store/base.ts\";\n\nexport * from \"./client.ts\";\nexport * from \"./serverCapabilities.ts\";\nexport * from \"./embedded.ts\";\nexport * from \"./http-api/index.ts\";\nexport * from \"./autodiscovery.ts\";\nexport * from \"./sync-accumulator.ts\";\nexport * from \"./errors.ts\";\nexport * from \"./base64.ts\";\nexport * from \"./models/beacon.ts\";\nexport * from \"./models/event.ts\";\nexport * from \"./models/room.ts\";\nexport * from \"./models/event-timeline.ts\";\nexport * from \"./models/event-timeline-set.ts\";\nexport * from \"./models/poll.ts\";\nexport * from \"./models/room-member.ts\";\nexport * from \"./models/room-state.ts\";\nexport * from \"./models/thread.ts\";\nexport * from \"./models/typed-event-emitter.ts\";\nexport * from \"./models/user.ts\";\nexport * from \"./models/device.ts\";\nexport * from \"./models/search-result.ts\";\nexport * from \"./oauth/index.ts\";\nexport * from \"./scheduler.ts\";\nexport * from \"./filter.ts\";\nexport * from \"./timeline-window.ts\";\nexport * from \"./interactive-auth.ts\";\nexport * from \"./version-support.ts\";\nexport * from \"./service-types.ts\";\nexport * from \"./store/memory.ts\";\nexport * from \"./store/indexeddb.ts\";\nexport * from \"./crypto/store/memory-crypto-store.ts\";\nexport * from \"./crypto/store/localStorage-crypto-store.ts\";\nexport * from \"./crypto/store/indexeddb-crypto-store.ts\";\nexport type { OutgoingRoomKeyRequest } from \"./crypto/store/base.ts\";\nexport * from \"./content-repo.ts\";\nexport type * from \"./@types/common.ts\";\nexport type * from \"./@types/uia.ts\";\nexport * from \"./@types/event.ts\";\nexport * from \"./@types/PushRules.ts\";\nexport * from \"./@types/partials.ts\";\nexport * from \"./@types/requests.ts\";\nexport * from \"./@types/search.ts\";\nexport * from \"./@types/beacon.ts\";\nexport * from \"./@types/topic.ts\";\nexport * from \"./@types/location.ts\";\nexport * from \"./@types/threepids.ts\";\nexport * from \"./@types/auth.ts\";\nexport * from \"./@types/polls.ts\";\nexport * from \"./@types/retention.ts\";\nexport type * from \"./@types/local_notifications.ts\";\nexport type * from \"./@types/registration.ts\";\nexport * from \"./@types/read_receipts.ts\";\nexport type * from \"./@types/crypto.ts\";\nexport * from \"./@types/extensible_events.ts\";\nexport type * from \"./@types/IIdentityServerProvider.ts\";\nexport * from \"./@types/membership.ts\";\nexport * from \"./models/room-summary.ts\";\nexport * from \"./models/event-status.ts\";\nexport * from \"./models/profile-keys.ts\";\nexport * from \"./models/related-relations.ts\";\nexport { type StickyMatrixEvent, RoomStickyEventsEvent } from \"./models/room-sticky-events.ts\";\nexport type { RoomSummary } from \"./client.ts\";\nexport * as ContentHelpers from \"./content-helpers.ts\";\nexport * as SecretStorage from \"./secret-storage.ts\";\nexport { createNewMatrixCall, CallEvent } from \"./webrtc/call.ts\";\nexport type { MatrixCall } from \"./webrtc/call.ts\";\nexport {\n GroupCall,\n GroupCallEvent,\n GroupCallIntent,\n GroupCallState,\n GroupCallType,\n GroupCallStatsReportEvent,\n} from \"./webrtc/groupCall.ts\";\n\nexport { SyncState, SetPresence } from \"./sync.ts\";\nexport type { ISyncStateData as SyncStateData } from \"./sync.ts\";\nexport { SlidingSyncEvent } from \"./sliding-sync.ts\";\nexport { MediaHandlerEvent } from \"./webrtc/mediaHandler.ts\";\nexport { CallFeedEvent } from \"./webrtc/callFeed.ts\";\nexport { StatsReport } from \"./webrtc/stats/statsReport.ts\";\nexport { Relations, RelationsEvent } from \"./models/relations.ts\";\nexport { TypedEventEmitter } from \"./models/typed-event-emitter.ts\";\nexport { LocalStorageErrors, localStorageErrorsEventsEmitter } from \"./store/local-storage-events-emitter.ts\";\nexport { IdentityProviderBrand, SSOAction } from \"./@types/auth.ts\";\nexport type { ISSOFlow as SSOFlow, LoginFlow } from \"./@types/auth.ts\";\nexport type { IHierarchyRelation as HierarchyRelation, IHierarchyRoom as HierarchyRoom } from \"./@types/spaces.ts\";\nexport { LocationAssetType } from \"./@types/location.ts\";\nexport { DebugLogger } from \"./logger.ts\";\n\nlet cryptoStoreFactory = (): CryptoStore => new MemoryCryptoStore();\n\n/**\n * Configure a different factory to be used for creating crypto stores\n *\n * @param fac - a function which will return a new `CryptoStore`\n */\nexport function setCryptoStoreFactory(fac: () => CryptoStore): void {\n cryptoStoreFactory = fac;\n}\n\nfunction amendClientOpts(opts: ICreateClientOpts): ICreateClientOpts {\n opts.store =\n opts.store ??\n new MemoryStore({\n localStorage: globalThis.localStorage,\n });\n opts.scheduler = opts.scheduler ?? new MatrixScheduler();\n opts.cryptoStore = opts.cryptoStore ?? cryptoStoreFactory();\n\n return opts;\n}\n\n/**\n * Construct a Matrix Client. Similar to {@link MatrixClient}\n * except that the 'request', 'store' and 'scheduler' dependencies are satisfied.\n * @param opts - The configuration options for this client. These configuration\n * options will be passed directly to {@link MatrixClient}.\n *\n * @returns A new matrix client.\n * @see {@link MatrixClient} for the full list of options for\n * `opts`.\n */\nexport function createClient(opts: ICreateClientOpts): MatrixClient {\n return new MatrixClient(amendClientOpts(opts));\n}\n\n/**\n * Construct a Matrix Client that works in a widget.\n * This client has a subset of features compared to a full client.\n * It uses the widget-api to communicate with matrix. (widget \\<-\\> client \\<-\\> homeserver)\n * @returns A new matrix client with a subset of features.\n * @param opts - The configuration options for this client. These configuration\n * options will be passed directly to {@link MatrixClient}.\n * @param widgetApi - The widget api to use for communication.\n * @param capabilities - The capabilities the widget client will request.\n * @param roomId - The room id the widget is associated with.\n * @param sendContentLoaded - Whether to send a content loaded widget action immediately after initial setup.\n * Set to `false` if the widget uses `waitForIFrameLoad=true` (in this case the client does not expect a content loaded action at all),\n * or if the the widget wants to send the `ContentLoaded` action at a later point in time after the initial setup.\n */\nexport function createRoomWidgetClient(\n widgetApi: WidgetApi,\n capabilities: ICapabilities,\n roomId: string,\n opts: ICreateClientOpts,\n sendContentLoaded = true,\n): MatrixClient {\n return new RoomWidgetClient(widgetApi, capabilities, roomId, amendClientOpts(opts), sendContentLoaded);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAAS,iBAAiB,QAAQ,uCAAuC;AACzE,SAAS,WAAW,QAAQ,mBAAmB;AAC/C,SAAS,eAAe,QAAQ,gBAAgB;AAChD,SAAS,YAAY,QAAgC,aAAa;AAClE,SAAS,gBAAgB,QAA4B,eAAe;AAGpE,cAAc,aAAa;AAC3B,cAAc,yBAAyB;AACvC,cAAc,eAAe;AAC7B,cAAc,qBAAqB;AACnC,cAAc,oBAAoB;AAClC,cAAc,uBAAuB;AACrC,cAAc,aAAa;AAC3B,cAAc,aAAa;AAC3B,cAAc,oBAAoB;AAClC,cAAc,mBAAmB;AACjC,cAAc,kBAAkB;AAChC,cAAc,4BAA4B;AAC1C,cAAc,gCAAgC;AAC9C,cAAc,kBAAkB;AAChC,cAAc,yBAAyB;AACvC,cAAc,wBAAwB;AACtC,cAAc,oBAAoB;AAClC,cAAc,iCAAiC;AAC/C,cAAc,kBAAkB;AAChC,cAAc,oBAAoB;AAClC,cAAc,2BAA2B;AACzC,cAAc,kBAAkB;AAChC,cAAc,gBAAgB;AAC9B,cAAc,aAAa;AAC3B,cAAc,sBAAsB;AACpC,cAAc,uBAAuB;AACrC,cAAc,sBAAsB;AACpC,cAAc,oBAAoB;AAClC,cAAc,mBAAmB;AACjC,cAAc,sBAAsB;AACpC,cAAc,u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;AACA;AACA;AACA,OAAO,SAAS,qBAAqB,CAAC,GAAsB,EAAQ;EAChE,kBAAkB,GAAG,GAAG;AAC5B;AAEA,SAAS,eAAe,CAAC,IAAuB,EAAqB;EACjE,IAAI,CAAC,KAAK,GACN,IAAI,CAAC,KAAK,IACV,IAAI,WAAW,CAAC;IACZ,YAAY,EAAE,UAAU,CAAC;EAC7B,CAAC,CAAC;EACN,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,eAAe,CAAC,CAAC;EACxD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,kBAAkB,CAAC,CAAC;EAE3D,OAAO,IAAI;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS,YAAY,CAAC,IAAuB,EAAgB;EAChE,OAAO,IAAI,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAClD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS,sBAAsB,CAClC,SAAoB,EACpB,YAA2B,EAC3B,MAAc,EACd,IAAuB,EACvB,iBAAiB,GAAG,IAAI,EACZ;EACZ,OAAO,IAAI,gBAAgB,CAAC,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE,iBAAiB,CAAC;AAC1G","ignoreList":[]}
|
|
@@ -130,7 +130,7 @@ export declare class CallMembership {
|
|
|
130
130
|
* ## RTC Membership
|
|
131
131
|
* Gets the primary transport to use for this RTC membership (m.rtc.member).
|
|
132
132
|
* This will return the primary transport that is used by this call membership to publish their media.
|
|
133
|
-
* Directly relates to the `
|
|
133
|
+
* Directly relates to the `transports.published` field.
|
|
134
134
|
*
|
|
135
135
|
* ## Legacy session membership
|
|
136
136
|
* In case of a legacy session membership (m.call.member) this will return the selected transport where
|
|
@@ -138,14 +138,14 @@ export declare class CallMembership {
|
|
|
138
138
|
* If the `focus_selection` is `oldest_membership` this will return the transport of the oldest membership
|
|
139
139
|
* in the room (based on the `created_ts` field of the session membership).
|
|
140
140
|
* If the `focus_selection` is `multi_sfu` it will return the first transport of the `foci_preferred` list.
|
|
141
|
-
* (`multi_sfu` is equivalent to how `m.rtc.member` `
|
|
141
|
+
* (`multi_sfu` is equivalent to how `m.rtc.member` `transports.published` work).
|
|
142
142
|
* @param oldestMembership For backwards compatibility with session membership (legacy). Unused in case of RTC membership.
|
|
143
143
|
* Always required to make the consumer not care if it deals with RTC or session memberships.
|
|
144
144
|
* @returns The transport this membership uses to publish media or undefined if no transport is available.
|
|
145
145
|
*/
|
|
146
146
|
getTransport(oldestMembership: CallMembership): Transport | undefined;
|
|
147
147
|
/**
|
|
148
|
-
* The value of the `
|
|
148
|
+
* The value of the `transports.published` field for RTC memberships (m.rtc.member).
|
|
149
149
|
* Or the value of the `foci_preferred` field for legacy session memberships (m.call.member).
|
|
150
150
|
*/
|
|
151
151
|
get transports(): Transport[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CallMembership.d.ts","sourceRoot":"","sources":["../../src/matrixrtc/CallMembership.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AACtF,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAGH,KAAK,iBAAiB,EAEtB,KAAK,qBAAqB,EAE7B,MAAM,2BAA2B,CAAC;AAGnC;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,QAAqB,CAAC;AAE1D;;GAEG;AACH,aAAK,cAAc;IACf;;OAEG;IACH,GAAG,QAAQ;IACX;;OAEG;IACH,OAAO,YAAY;CACtB;AAED,KAAK,cAAc,GACb;IAAE,IAAI,EAAE,cAAc,CAAC,GAAG,CAAC;IAAC,IAAI,EAAE,iBAAiB,CAAA;CAAE,GACrD;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,CAUzB;IAED;;;OAGG;IACI,iBAAiB,IAAI,MAAM,GAAG,SAAS,CAU7C;IAED;;;OAGG;IACI,gBAAgB,IAAI,MAAM,GAAG,SAAS,CAY5C;IAED;;OAEG;IACI,SAAS,IAAI,OAAO,CAS1B;IAED;;;;;;;;;;;;;;;;OAgBG;IACI,YAAY,CAAC,gBAAgB,EAAE,cAAc,GAAG,SAAS,GAAG,SAAS,CAqB3E;IAED;;;OAGG;IACH,IAAW,UAAU,IAAI,SAAS,EAAE,CASnC;CACJ"}
|
|
@@ -402,7 +402,7 @@ export class CallMembership {
|
|
|
402
402
|
* ## RTC Membership
|
|
403
403
|
* Gets the primary transport to use for this RTC membership (m.rtc.member).
|
|
404
404
|
* This will return the primary transport that is used by this call membership to publish their media.
|
|
405
|
-
* Directly relates to the `
|
|
405
|
+
* Directly relates to the `transports.published` field.
|
|
406
406
|
*
|
|
407
407
|
* ## Legacy session membership
|
|
408
408
|
* In case of a legacy session membership (m.call.member) this will return the selected transport where
|
|
@@ -410,7 +410,7 @@ export class CallMembership {
|
|
|
410
410
|
* If the `focus_selection` is `oldest_membership` this will return the transport of the oldest membership
|
|
411
411
|
* in the room (based on the `created_ts` field of the session membership).
|
|
412
412
|
* If the `focus_selection` is `multi_sfu` it will return the first transport of the `foci_preferred` list.
|
|
413
|
-
* (`multi_sfu` is equivalent to how `m.rtc.member` `
|
|
413
|
+
* (`multi_sfu` is equivalent to how `m.rtc.member` `transports.published` work).
|
|
414
414
|
* @param oldestMembership For backwards compatibility with session membership (legacy). Unused in case of RTC membership.
|
|
415
415
|
* Always required to make the consumer not care if it deals with RTC or session memberships.
|
|
416
416
|
* @returns The transport this membership uses to publish media or undefined if no transport is available.
|
|
@@ -422,7 +422,7 @@ export class CallMembership {
|
|
|
422
422
|
} = this.membershipData;
|
|
423
423
|
switch (kind) {
|
|
424
424
|
case MembershipKind.RTC:
|
|
425
|
-
return data.
|
|
425
|
+
return data.transports.published[0];
|
|
426
426
|
case MembershipKind.Session:
|
|
427
427
|
switch (data.focus_active.focus_selection) {
|
|
428
428
|
case "oldest_membership":
|
|
@@ -442,7 +442,7 @@ export class CallMembership {
|
|
|
442
442
|
}
|
|
443
443
|
|
|
444
444
|
/**
|
|
445
|
-
* The value of the `
|
|
445
|
+
* The value of the `transports.published` field for RTC memberships (m.rtc.member).
|
|
446
446
|
* Or the value of the `foci_preferred` field for legacy session memberships (m.call.member).
|
|
447
447
|
*/
|
|
448
448
|
get transports() {
|
|
@@ -452,7 +452,7 @@ export class CallMembership {
|
|
|
452
452
|
} = this.membershipData;
|
|
453
453
|
switch (kind) {
|
|
454
454
|
case MembershipKind.RTC:
|
|
455
|
-
return data.
|
|
455
|
+
return data.transports.published;
|
|
456
456
|
case MembershipKind.Session:
|
|
457
457
|
default:
|
|
458
458
|
return data.foci_preferred;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CallMembership.js","names":[],"sources":["../../src/matrixrtc/CallMembership.ts"],"sourcesContent":["/*\nCopyright 2023-2026 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { deepCompare } from \"../utils.ts\";\nimport { type RTCCallIntent, type Transport, type SlotDescription } from \"./types.ts\";\nimport { type MatrixEvent } from \"../models/event.ts\";\nimport { type Logger, logger } from \"../logger.ts\";\nimport { computeSlotId, slotIdToDescription } from \"./utils.ts\";\nimport {\n checkRtcMembershipData,\n computeRtcIdentityRaw,\n type RtcMembershipData,\n checkSessionsMembershipData,\n type SessionMembershipData,\n MatrixRTCMembershipParseError,\n} from \"./membershipData/index.ts\";\nimport { EventType } from \"../@types/event.ts\";\n\n/**\n * The default duration in milliseconds that a membership is considered valid for.\n * Ordinarily the client responsible for the session will update the membership before it expires.\n * We use this duration as the fallback case where stale sessions are present for some reason.\n */\nexport const DEFAULT_EXPIRE_DURATION = 1000 * 60 * 60 * 4;\n\n/**\n * Describes the source event type that provided the membership data.\n */\nenum MembershipKind {\n /**\n * The modern MSC4143 format event.\n */\n RTC = \"rtc\",\n /**\n * The legacy call event type.\n */\n Session = \"session\",\n}\n\ntype MembershipData =\n | { kind: MembershipKind.RTC; data: RtcMembershipData }\n | { kind: MembershipKind.Session; data: SessionMembershipData };\n\ntype LimitedEvent = Pick<MatrixEvent, \"getId\" | \"getSender\" | \"getTs\" | \"getType\" | \"getContent\">;\n// TODO: Rename to RtcMembership once we removed the legacy SessionMembership is removed, to avoid confusion.\nexport class CallMembership {\n /**\n * Parse the membershipdata from a call membership event.\n * @param matrixEvent The Matrix event to read.\n * @returns MembershipData in either MembershipKind.RTC or MembershipKind.Session format.\n * @throws If the content is neither format.\n */\n public static membershipDataFromMatrixEvent(matrixEvent: LimitedEvent): MembershipData {\n const sender = matrixEvent.getSender();\n const evType = matrixEvent.getType();\n const data = matrixEvent.getContent();\n if (sender === undefined) throw new Error(\"matrixEvent is missing sender field\");\n try {\n // Event types are strictly checked here.\n if (evType === EventType.RTCMembership && checkRtcMembershipData(data, sender)) {\n return { kind: MembershipKind.RTC, data };\n } else if (evType === EventType.GroupCallMemberPrefix && checkSessionsMembershipData(data)) {\n return { kind: MembershipKind.Session, data };\n } else {\n throw Error(`'${evType} is not a known call membership type`);\n }\n } catch (ex) {\n if (ex instanceof MatrixRTCMembershipParseError) {\n logger.debug(\"CallMembership.MatrixRTCMembershipParseError provided invalid data\", data);\n }\n throw ex;\n }\n }\n\n /**\n * Parse the contents of a MatrixEvent and create a CallMembership instance.\n * @param matrixEvent The Matrix event to read.\n */\n public static async parseFromEvent(matrixEvent: LimitedEvent): Promise<CallMembership> {\n const membershipData: MembershipData = this.membershipDataFromMatrixEvent(matrixEvent);\n const rtcBackendIdentity =\n membershipData.kind === MembershipKind.RTC\n ? await computeRtcIdentityRaw(\n membershipData.data.member.user_id,\n membershipData.data.member.device_id,\n membershipData.data.member.id,\n )\n : `${matrixEvent.getSender()}:${membershipData.data.device_id}`;\n return new CallMembership(matrixEvent, membershipData, rtcBackendIdentity);\n }\n\n public static equal(a?: CallMembership, b?: CallMembership): boolean {\n return deepCompare(a?.membershipData, b?.membershipData);\n }\n\n private logger: Logger;\n\n /** The parsed data from the Matrix event.\n * To access checked eventId and sender from the matrixEvent.\n * Class construction will fail if these values cannot get obtained. */\n private readonly matrixEventData: { eventId: string; sender: string };\n\n /**\n * Use `parseFromEvent`.\n * Constructor should only be used by tests.\n * @private\n * @param matrixEvent\n * @param membershipData\n * @param rtcBackendIdentity\n */\n public constructor(\n /** The Matrix event that this membership is based on */\n private readonly matrixEvent: LimitedEvent,\n private readonly membershipData: MembershipData,\n public readonly rtcBackendIdentity: string,\n ) {\n const eventId = matrixEvent.getId();\n const sender = matrixEvent.getSender();\n\n if (eventId === undefined) throw new Error(\"parentEvent is missing eventId field\");\n if (sender === undefined) throw new Error(\"parentEvent is missing sender field\");\n\n this.logger = logger.getChild(`[CallMembership ${sender}:${this.deviceId}]`);\n this.matrixEventData = { eventId, sender };\n }\n\n /** @deprecated use userId instead */\n public get sender(): string {\n return this.userId;\n }\n\n public get userId(): string {\n const { kind, data } = this.membershipData;\n switch (kind) {\n case MembershipKind.RTC:\n return data.member.user_id;\n case MembershipKind.Session:\n default:\n return this.matrixEventData.sender;\n }\n }\n\n public get eventId(): string {\n return this.matrixEventData.eventId;\n }\n\n /**\n * The ID of the MatrixRTC slot that this membership belongs to (format `{application}#{id}`).\n * This is computed in case SessionMembershipData is used.\n */\n public get slotId(): string {\n const { kind, data } = this.membershipData;\n if (data.application === \"m.call\") {\n switch (kind) {\n case MembershipKind.RTC:\n return data.slot_id;\n case MembershipKind.Session:\n default: {\n const [application, id] = [data.application, data.call_id];\n\n // INFO_SLOT_ID_LEGACY_CASE (search for all occurances of this INFO to get the full picture)\n // The spec got changed to use `\"ROOM\"` instead of `\"\"` empyt string for the implicit default call.\n // State events still are sent with `\"\"` however. To find other events that should end up in the same call,\n // we use the slotId.\n // Since the CallMembership is the public representation of a rtc.member event, we just pretend it is a\n // \"ROOM\" slotId/call_id.\n // This makes all the remote members work with just this simple trick.\n //\n // We of course now need to be careful when sending legacy events (state events)\n // They get a slotDescription containing \"ROOM\" since this is what we use starting at the time this comment\n // is commited.\n //\n // See the Other INFO_SLOT_ID_LEGACY_CASE comments to see where we revert back to \"\" just before sending the event.\n let compatibilityAdaptedId: string;\n if (id === \"\") {\n compatibilityAdaptedId = \"ROOM\";\n this.logger?.info(\"use slotId compat hack emptyString -> ROOM\");\n } else {\n compatibilityAdaptedId = id;\n }\n return computeSlotId({\n application,\n id: compatibilityAdaptedId,\n });\n }\n }\n }\n\n this.logger?.info(\"NOT using slotId compat hack emptyString -> ROOM\");\n // This is what the function should look like for any other application that did not\n // go through a `\"\"`=> `\"ROOM\"` rename\n switch (kind) {\n case MembershipKind.RTC:\n return data.slot_id;\n case MembershipKind.Session:\n default:\n return computeSlotId({ application: data.application, id: data.call_id });\n }\n }\n\n public get deviceId(): string {\n const { kind, data } = this.membershipData;\n switch (kind) {\n case MembershipKind.RTC:\n return data.member.device_id;\n case MembershipKind.Session:\n default:\n return data.device_id;\n }\n }\n\n public get callIntent(): RTCCallIntent | undefined {\n const intent = this.applicationData[\"m.call.intent\"];\n if (typeof intent === \"string\") {\n return intent;\n }\n this.logger.warn(\"RTC membership has invalid m.call.intent\");\n return undefined;\n }\n\n /**\n * Parsed `slot_id` (format `{application}#{id}`) into its components (application and id).\n */\n public get slotDescription(): SlotDescription {\n const { kind, data } = this.membershipData;\n if (kind === MembershipKind.RTC) {\n const id = data.slot_id.slice(`${data.application.type}#`.length);\n return { application: data.application.type, id };\n }\n return slotIdToDescription(this.slotId);\n }\n\n /**\n * The application `type`.\n * @deprecated Use @see applicationData\n */\n public get application(): string {\n return this.applicationData.type;\n }\n\n /**\n * Information about the application being used for the RTC session.\n * May contain extra keys specific to the application.\n */\n public get applicationData(): { type: string; [key: string]: unknown } {\n const { kind, data } = this.membershipData;\n switch (kind) {\n case MembershipKind.RTC:\n return data.application;\n case MembershipKind.Session:\n default:\n // SessionData does not have application data as such. We return specific\n // properties in use by other getters in this class, for compatibility.\n return { \"type\": data.application, \"m.call.intent\": data[\"m.call.intent\"] };\n }\n }\n\n /** @deprecated scope is not used and will be removed in future versions. replaced by application specific types.*/\n public get scope(): SessionMembershipData[\"scope\"] | undefined {\n const { kind, data } = this.membershipData;\n switch (kind) {\n case MembershipKind.RTC:\n return undefined;\n case MembershipKind.Session:\n default:\n return data.scope;\n }\n }\n\n /**\n * This computes the membership ID for the membership.\n * For the sticky event based rtcSessionData this is trivial it is `member.id`.\n * This is not supposed to be used to identity on an rtc backend. This is just a nouance for\n * a generated (sha256) anonymised identity. Only send `rtcBackendIdentity` to any rtc backend service.\n *\n * For the legacy sessionMemberEvents it is a bit more complex. Here we sometimes do not have this data\n * in the event content and we expected the SFU and the client to use `${this.matrixEventData.sender}:${data.device_id}`.\n *\n * So if there is no membershipID we use the hard coded jwt id default (`${this.matrixEventData.sender}:${data.device_id}`)\n * value (used until version 0.16.0)\n *\n * It is also possible for a session event to set a custom membershipID. in that case this will be used.\n */\n public get memberId(): string {\n // the createdTs behaves equivalent to the membershipID.\n // we only need the field for the legacy member events where we needed to update them\n // synapse ignores sending state events if they have the same content.\n const { kind, data } = this.membershipData;\n switch (kind) {\n case \"rtc\":\n return data.member.id;\n case \"session\":\n return (\n // best case we have a client already publishing the right custom membershipId\n data.membershipID ??\n // alternativly we use the hard coded jwt id defuatl value (used until version 0.16.0)\n `${this.matrixEventData.sender}:${data.device_id}`\n );\n default:\n throw Error(\"Not possible to get memberID without knowing the membership event kind\");\n }\n }\n\n /**\n * @deprecated renamed to `memberId`\n */\n public get membershipID(): string {\n return this.memberId;\n }\n\n public createdTs(): number {\n const { kind, data } = this.membershipData;\n switch (kind) {\n case MembershipKind.RTC:\n // TODO we need to read the referenced (relation) event if available to get the real created_ts\n return this.matrixEvent.getTs();\n case MembershipKind.Session:\n default:\n return data.created_ts ?? this.matrixEvent.getTs();\n }\n }\n\n /**\n * Gets the absolute expiry timestamp of the membership.\n * @returns The absolute expiry time of the membership as a unix timestamp in milliseconds or undefined if not applicable\n */\n public getAbsoluteExpiry(): number | undefined {\n const { kind, data } = this.membershipData;\n switch (kind) {\n case MembershipKind.RTC:\n return undefined;\n case MembershipKind.Session:\n default:\n // TODO: calculate this from the MatrixRTCSession join configuration directly\n return this.createdTs() + (data.expires ?? DEFAULT_EXPIRE_DURATION);\n }\n }\n\n /**\n * @returns The number of milliseconds until the membership expires or undefined if applicable\n * @deprecated Not used by RTC events.\n */\n public getMsUntilExpiry(): number | undefined {\n const { kind } = this.membershipData;\n if (kind === MembershipKind.Session) {\n const absExpiry = this.getAbsoluteExpiry();\n if (absExpiry) {\n // Assume that local clock is sufficiently in sync with other clocks in the distributed system.\n // We used to try and adjust for the local clock being skewed, but there are cases where this is not accurate.\n // The current implementation allows for the local clock to be -infinity to +MatrixRTCSession.MEMBERSHIP_EXPIRY_TIME/2\n return absExpiry - Date.now();\n }\n }\n return undefined;\n }\n\n /**\n * @returns true if the membership has expired, otherwise false\n */\n public isExpired(): boolean {\n const { kind } = this.membershipData;\n switch (kind) {\n case MembershipKind.RTC:\n return false;\n case MembershipKind.Session:\n default:\n return this.getMsUntilExpiry()! <= 0;\n }\n }\n\n /**\n * ## RTC Membership\n * Gets the primary transport to use for this RTC membership (m.rtc.member).\n * This will return the primary transport that is used by this call membership to publish their media.\n * Directly relates to the `rtc_transports` field.\n *\n * ## Legacy session membership\n * In case of a legacy session membership (m.call.member) this will return the selected transport where\n * media is published. How this selection happens depends on the `focus_active` field of the session membership.\n * If the `focus_selection` is `oldest_membership` this will return the transport of the oldest membership\n * in the room (based on the `created_ts` field of the session membership).\n * If the `focus_selection` is `multi_sfu` it will return the first transport of the `foci_preferred` list.\n * (`multi_sfu` is equivalent to how `m.rtc.member` `rtc_transports` work).\n * @param oldestMembership For backwards compatibility with session membership (legacy). Unused in case of RTC membership.\n * Always required to make the consumer not care if it deals with RTC or session memberships.\n * @returns The transport this membership uses to publish media or undefined if no transport is available.\n */\n public getTransport(oldestMembership: CallMembership): Transport | undefined {\n const { kind, data } = this.membershipData;\n switch (kind) {\n case MembershipKind.RTC:\n return data.rtc_transports[0];\n case MembershipKind.Session:\n switch (data.focus_active.focus_selection) {\n case \"oldest_membership\":\n if (CallMembership.equal(this, oldestMembership)) return data.foci_preferred[0];\n if (oldestMembership !== undefined) return oldestMembership.getTransport(oldestMembership);\n break;\n case \"multi_sfu\":\n return data.foci_preferred[0];\n default:\n // `focus_selection` not understood.\n return undefined;\n }\n break;\n default:\n return undefined;\n }\n }\n\n /**\n * The value of the `rtc_transports` field for RTC memberships (m.rtc.member).\n * Or the value of the `foci_preferred` field for legacy session memberships (m.call.member).\n */\n public get transports(): Transport[] {\n const { kind, data } = this.membershipData;\n switch (kind) {\n case MembershipKind.RTC:\n return data.rtc_transports;\n case MembershipKind.Session:\n default:\n return data.foci_preferred;\n }\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,WAAW,QAAQ,aAAa;AAGzC,SAAsB,MAAM,QAAQ,cAAc;AAClD,SAAS,aAAa,EAAE,mBAAmB,QAAQ,YAAY;AAC/D,SACI,sBAAsB,EACtB,qBAAqB,EAErB,2BAA2B,EAE3B,6BAA6B,QAC1B,2BAA2B;AAClC,SAAS,SAAS,QAAQ,oBAAoB;;AAE9C;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM,uBAAuB,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;;AAEzD;AACA;AACA;AAFA,IAGK,cAAc,0BAAd,cAAc;EACf;AACJ;AACA;EAHK,cAAc;EAK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CAAC;MACjC,KAAK,cAAc,CAAC,OAAO;QACvB,QAAQ,IAAI,CAAC,YAAY,CAAC,eAAe;UACrC,KAAK,mBAAmB;YACpB,IAAI,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,gBAAgB,CAAC,EAAE,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;YAC/E,IAAI,gBAAgB,KAAK,SAAS,EAAE,OAAO,gBAAgB,CAAC,YAAY,CAAC,gBAAgB,CAAC;YAC1F;UACJ,KAAK,WAAW;YACZ,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;UACjC;YACI;YACA,OAAO,SAAS;QACxB;QACA;MACJ;QACI,OAAO,SAAS;IACxB;EACJ;;EAEA;AACJ;AACA;AACA;EACI,IAAW,UAAU,GAAgB;IACjC,MAAM;MAAE,IAAI;MAAE;IAAK,CAAC,GAAG,IAAI,CAAC,cAAc;IAC1C,QAAQ,IAAI;MACR,KAAK,cAAc,CAAC,GAAG;QACnB,OAAO,IAAI,CAAC,cAAc;MAC9B,KAAK,cAAc,CAAC,OAAO;MAC3B;QACI,OAAO,IAAI,CAAC,cAAc;IAClC;EACJ;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"CallMembership.js","names":[],"sources":["../../src/matrixrtc/CallMembership.ts"],"sourcesContent":["/*\nCopyright 2023-2026 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { deepCompare } from \"../utils.ts\";\nimport { type RTCCallIntent, type Transport, type SlotDescription } from \"./types.ts\";\nimport { type MatrixEvent } from \"../models/event.ts\";\nimport { type Logger, logger } from \"../logger.ts\";\nimport { computeSlotId, slotIdToDescription } from \"./utils.ts\";\nimport {\n checkRtcMembershipData,\n computeRtcIdentityRaw,\n type RtcMembershipData,\n checkSessionsMembershipData,\n type SessionMembershipData,\n MatrixRTCMembershipParseError,\n} from \"./membershipData/index.ts\";\nimport { EventType } from \"../@types/event.ts\";\n\n/**\n * The default duration in milliseconds that a membership is considered valid for.\n * Ordinarily the client responsible for the session will update the membership before it expires.\n * We use this duration as the fallback case where stale sessions are present for some reason.\n */\nexport const DEFAULT_EXPIRE_DURATION = 1000 * 60 * 60 * 4;\n\n/**\n * Describes the source event type that provided the membership data.\n */\nenum MembershipKind {\n /**\n * The modern MSC4143 format event.\n */\n RTC = \"rtc\",\n /**\n * The legacy call event type.\n */\n Session = \"session\",\n}\n\ntype MembershipData =\n | { kind: MembershipKind.RTC; data: RtcMembershipData }\n | { kind: MembershipKind.Session; data: SessionMembershipData };\n\ntype LimitedEvent = Pick<MatrixEvent, \"getId\" | \"getSender\" | \"getTs\" | \"getType\" | \"getContent\">;\n// TODO: Rename to RtcMembership once we removed the legacy SessionMembership is removed, to avoid confusion.\nexport class CallMembership {\n /**\n * Parse the membershipdata from a call membership event.\n * @param matrixEvent The Matrix event to read.\n * @returns MembershipData in either MembershipKind.RTC or MembershipKind.Session format.\n * @throws If the content is neither format.\n */\n public static membershipDataFromMatrixEvent(matrixEvent: LimitedEvent): MembershipData {\n const sender = matrixEvent.getSender();\n const evType = matrixEvent.getType();\n const data = matrixEvent.getContent();\n if (sender === undefined) throw new Error(\"matrixEvent is missing sender field\");\n try {\n // Event types are strictly checked here.\n if (evType === EventType.RTCMembership && checkRtcMembershipData(data, sender)) {\n return { kind: MembershipKind.RTC, data };\n } else if (evType === EventType.GroupCallMemberPrefix && checkSessionsMembershipData(data)) {\n return { kind: MembershipKind.Session, data };\n } else {\n throw Error(`'${evType} is not a known call membership type`);\n }\n } catch (ex) {\n if (ex instanceof MatrixRTCMembershipParseError) {\n logger.debug(\"CallMembership.MatrixRTCMembershipParseError provided invalid data\", data);\n }\n throw ex;\n }\n }\n\n /**\n * Parse the contents of a MatrixEvent and create a CallMembership instance.\n * @param matrixEvent The Matrix event to read.\n */\n public static async parseFromEvent(matrixEvent: LimitedEvent): Promise<CallMembership> {\n const membershipData: MembershipData = this.membershipDataFromMatrixEvent(matrixEvent);\n const rtcBackendIdentity =\n membershipData.kind === MembershipKind.RTC\n ? await computeRtcIdentityRaw(\n membershipData.data.member.user_id,\n membershipData.data.member.device_id,\n membershipData.data.member.id,\n )\n : `${matrixEvent.getSender()}:${membershipData.data.device_id}`;\n return new CallMembership(matrixEvent, membershipData, rtcBackendIdentity);\n }\n\n public static equal(a?: CallMembership, b?: CallMembership): boolean {\n return deepCompare(a?.membershipData, b?.membershipData);\n }\n\n private logger: Logger;\n\n /** The parsed data from the Matrix event.\n * To access checked eventId and sender from the matrixEvent.\n * Class construction will fail if these values cannot get obtained. */\n private readonly matrixEventData: { eventId: string; sender: string };\n\n /**\n * Use `parseFromEvent`.\n * Constructor should only be used by tests.\n * @private\n * @param matrixEvent\n * @param membershipData\n * @param rtcBackendIdentity\n */\n public constructor(\n /** The Matrix event that this membership is based on */\n private readonly matrixEvent: LimitedEvent,\n private readonly membershipData: MembershipData,\n public readonly rtcBackendIdentity: string,\n ) {\n const eventId = matrixEvent.getId();\n const sender = matrixEvent.getSender();\n\n if (eventId === undefined) throw new Error(\"parentEvent is missing eventId field\");\n if (sender === undefined) throw new Error(\"parentEvent is missing sender field\");\n\n this.logger = logger.getChild(`[CallMembership ${sender}:${this.deviceId}]`);\n this.matrixEventData = { eventId, sender };\n }\n\n /** @deprecated use userId instead */\n public get sender(): string {\n return this.userId;\n }\n\n public get userId(): string {\n const { kind, data } = this.membershipData;\n switch (kind) {\n case MembershipKind.RTC:\n return data.member.user_id;\n case MembershipKind.Session:\n default:\n return this.matrixEventData.sender;\n }\n }\n\n public get eventId(): string {\n return this.matrixEventData.eventId;\n }\n\n /**\n * The ID of the MatrixRTC slot that this membership belongs to (format `{application}#{id}`).\n * This is computed in case SessionMembershipData is used.\n */\n public get slotId(): string {\n const { kind, data } = this.membershipData;\n if (data.application === \"m.call\") {\n switch (kind) {\n case MembershipKind.RTC:\n return data.slot_id;\n case MembershipKind.Session:\n default: {\n const [application, id] = [data.application, data.call_id];\n\n // INFO_SLOT_ID_LEGACY_CASE (search for all occurances of this INFO to get the full picture)\n // The spec got changed to use `\"ROOM\"` instead of `\"\"` empyt string for the implicit default call.\n // State events still are sent with `\"\"` however. To find other events that should end up in the same call,\n // we use the slotId.\n // Since the CallMembership is the public representation of a rtc.member event, we just pretend it is a\n // \"ROOM\" slotId/call_id.\n // This makes all the remote members work with just this simple trick.\n //\n // We of course now need to be careful when sending legacy events (state events)\n // They get a slotDescription containing \"ROOM\" since this is what we use starting at the time this comment\n // is commited.\n //\n // See the Other INFO_SLOT_ID_LEGACY_CASE comments to see where we revert back to \"\" just before sending the event.\n let compatibilityAdaptedId: string;\n if (id === \"\") {\n compatibilityAdaptedId = \"ROOM\";\n this.logger?.info(\"use slotId compat hack emptyString -> ROOM\");\n } else {\n compatibilityAdaptedId = id;\n }\n return computeSlotId({\n application,\n id: compatibilityAdaptedId,\n });\n }\n }\n }\n\n this.logger?.info(\"NOT using slotId compat hack emptyString -> ROOM\");\n // This is what the function should look like for any other application that did not\n // go through a `\"\"`=> `\"ROOM\"` rename\n switch (kind) {\n case MembershipKind.RTC:\n return data.slot_id;\n case MembershipKind.Session:\n default:\n return computeSlotId({ application: data.application, id: data.call_id });\n }\n }\n\n public get deviceId(): string {\n const { kind, data } = this.membershipData;\n switch (kind) {\n case MembershipKind.RTC:\n return data.member.device_id;\n case MembershipKind.Session:\n default:\n return data.device_id;\n }\n }\n\n public get callIntent(): RTCCallIntent | undefined {\n const intent = this.applicationData[\"m.call.intent\"];\n if (typeof intent === \"string\") {\n return intent;\n }\n this.logger.warn(\"RTC membership has invalid m.call.intent\");\n return undefined;\n }\n\n /**\n * Parsed `slot_id` (format `{application}#{id}`) into its components (application and id).\n */\n public get slotDescription(): SlotDescription {\n const { kind, data } = this.membershipData;\n if (kind === MembershipKind.RTC) {\n const id = data.slot_id.slice(`${data.application.type}#`.length);\n return { application: data.application.type, id };\n }\n return slotIdToDescription(this.slotId);\n }\n\n /**\n * The application `type`.\n * @deprecated Use @see applicationData\n */\n public get application(): string {\n return this.applicationData.type;\n }\n\n /**\n * Information about the application being used for the RTC session.\n * May contain extra keys specific to the application.\n */\n public get applicationData(): { type: string; [key: string]: unknown } {\n const { kind, data } = this.membershipData;\n switch (kind) {\n case MembershipKind.RTC:\n return data.application;\n case MembershipKind.Session:\n default:\n // SessionData does not have application data as such. We return specific\n // properties in use by other getters in this class, for compatibility.\n return { \"type\": data.application, \"m.call.intent\": data[\"m.call.intent\"] };\n }\n }\n\n /** @deprecated scope is not used and will be removed in future versions. replaced by application specific types.*/\n public get scope(): SessionMembershipData[\"scope\"] | undefined {\n const { kind, data } = this.membershipData;\n switch (kind) {\n case MembershipKind.RTC:\n return undefined;\n case MembershipKind.Session:\n default:\n return data.scope;\n }\n }\n\n /**\n * This computes the membership ID for the membership.\n * For the sticky event based rtcSessionData this is trivial it is `member.id`.\n * This is not supposed to be used to identity on an rtc backend. This is just a nouance for\n * a generated (sha256) anonymised identity. Only send `rtcBackendIdentity` to any rtc backend service.\n *\n * For the legacy sessionMemberEvents it is a bit more complex. Here we sometimes do not have this data\n * in the event content and we expected the SFU and the client to use `${this.matrixEventData.sender}:${data.device_id}`.\n *\n * So if there is no membershipID we use the hard coded jwt id default (`${this.matrixEventData.sender}:${data.device_id}`)\n * value (used until version 0.16.0)\n *\n * It is also possible for a session event to set a custom membershipID. in that case this will be used.\n */\n public get memberId(): string {\n // the createdTs behaves equivalent to the membershipID.\n // we only need the field for the legacy member events where we needed to update them\n // synapse ignores sending state events if they have the same content.\n const { kind, data } = this.membershipData;\n switch (kind) {\n case \"rtc\":\n return data.member.id;\n case \"session\":\n return (\n // best case we have a client already publishing the right custom membershipId\n data.membershipID ??\n // alternativly we use the hard coded jwt id defuatl value (used until version 0.16.0)\n `${this.matrixEventData.sender}:${data.device_id}`\n );\n default:\n throw Error(\"Not possible to get memberID without knowing the membership event kind\");\n }\n }\n\n /**\n * @deprecated renamed to `memberId`\n */\n public get membershipID(): string {\n return this.memberId;\n }\n\n public createdTs(): number {\n const { kind, data } = this.membershipData;\n switch (kind) {\n case MembershipKind.RTC:\n // TODO we need to read the referenced (relation) event if available to get the real created_ts\n return this.matrixEvent.getTs();\n case MembershipKind.Session:\n default:\n return data.created_ts ?? this.matrixEvent.getTs();\n }\n }\n\n /**\n * Gets the absolute expiry timestamp of the membership.\n * @returns The absolute expiry time of the membership as a unix timestamp in milliseconds or undefined if not applicable\n */\n public getAbsoluteExpiry(): number | undefined {\n const { kind, data } = this.membershipData;\n switch (kind) {\n case MembershipKind.RTC:\n return undefined;\n case MembershipKind.Session:\n default:\n // TODO: calculate this from the MatrixRTCSession join configuration directly\n return this.createdTs() + (data.expires ?? DEFAULT_EXPIRE_DURATION);\n }\n }\n\n /**\n * @returns The number of milliseconds until the membership expires or undefined if applicable\n * @deprecated Not used by RTC events.\n */\n public getMsUntilExpiry(): number | undefined {\n const { kind } = this.membershipData;\n if (kind === MembershipKind.Session) {\n const absExpiry = this.getAbsoluteExpiry();\n if (absExpiry) {\n // Assume that local clock is sufficiently in sync with other clocks in the distributed system.\n // We used to try and adjust for the local clock being skewed, but there are cases where this is not accurate.\n // The current implementation allows for the local clock to be -infinity to +MatrixRTCSession.MEMBERSHIP_EXPIRY_TIME/2\n return absExpiry - Date.now();\n }\n }\n return undefined;\n }\n\n /**\n * @returns true if the membership has expired, otherwise false\n */\n public isExpired(): boolean {\n const { kind } = this.membershipData;\n switch (kind) {\n case MembershipKind.RTC:\n return false;\n case MembershipKind.Session:\n default:\n return this.getMsUntilExpiry()! <= 0;\n }\n }\n\n /**\n * ## RTC Membership\n * Gets the primary transport to use for this RTC membership (m.rtc.member).\n * This will return the primary transport that is used by this call membership to publish their media.\n * Directly relates to the `transports.published` field.\n *\n * ## Legacy session membership\n * In case of a legacy session membership (m.call.member) this will return the selected transport where\n * media is published. How this selection happens depends on the `focus_active` field of the session membership.\n * If the `focus_selection` is `oldest_membership` this will return the transport of the oldest membership\n * in the room (based on the `created_ts` field of the session membership).\n * If the `focus_selection` is `multi_sfu` it will return the first transport of the `foci_preferred` list.\n * (`multi_sfu` is equivalent to how `m.rtc.member` `transports.published` work).\n * @param oldestMembership For backwards compatibility with session membership (legacy). Unused in case of RTC membership.\n * Always required to make the consumer not care if it deals with RTC or session memberships.\n * @returns The transport this membership uses to publish media or undefined if no transport is available.\n */\n public getTransport(oldestMembership: CallMembership): Transport | undefined {\n const { kind, data } = this.membershipData;\n switch (kind) {\n case MembershipKind.RTC:\n return data.transports.published[0];\n case MembershipKind.Session:\n switch (data.focus_active.focus_selection) {\n case \"oldest_membership\":\n if (CallMembership.equal(this, oldestMembership)) return data.foci_preferred[0];\n if (oldestMembership !== undefined) return oldestMembership.getTransport(oldestMembership);\n break;\n case \"multi_sfu\":\n return data.foci_preferred[0];\n default:\n // `focus_selection` not understood.\n return undefined;\n }\n break;\n default:\n return undefined;\n }\n }\n\n /**\n * The value of the `transports.published` field for RTC memberships (m.rtc.member).\n * Or the value of the `foci_preferred` field for legacy session memberships (m.call.member).\n */\n public get transports(): Transport[] {\n const { kind, data } = this.membershipData;\n switch (kind) {\n case MembershipKind.RTC:\n return data.transports.published;\n case MembershipKind.Session:\n default:\n return data.foci_preferred;\n }\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,WAAW,QAAQ,aAAa;AAGzC,SAAsB,MAAM,QAAQ,cAAc;AAClD,SAAS,aAAa,EAAE,mBAAmB,QAAQ,YAAY;AAC/D,SACI,sBAAsB,EACtB,qBAAqB,EAErB,2BAA2B,EAE3B,6BAA6B,QAC1B,2BAA2B;AAClC,SAAS,SAAS,QAAQ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