matrix-js-sdk 41.8.0 → 41.9.0
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/CHANGELOG.md +11 -0
- package/README.md +1 -1
- package/lib/@types/AESEncryptedSecretStoragePayload.js +3 -1
- package/lib/@types/IIdentityServerProvider.js +3 -1
- package/lib/@types/PushRules.js +7 -7
- package/lib/@types/PushRules.js.map +1 -1
- package/lib/@types/auth.js +4 -4
- package/lib/@types/auth.js.map +1 -1
- package/lib/@types/beacon.js +2 -2
- package/lib/@types/beacon.js.map +1 -1
- package/lib/@types/common.js +3 -1
- package/lib/@types/crypto.js +3 -1
- package/lib/@types/event.js +20 -20
- package/lib/@types/event.js.map +1 -1
- package/lib/@types/events.js +3 -1
- package/lib/@types/extensible_events.js +6 -6
- package/lib/@types/extensible_events.js.map +1 -1
- package/lib/@types/global.d.js.map +1 -1
- package/lib/@types/json.js +3 -1
- package/lib/@types/local_notifications.js +3 -1
- package/lib/@types/location.js +4 -4
- package/lib/@types/location.js.map +1 -1
- package/lib/@types/matrix-sdk-crypto-wasm.d.js +3 -1
- package/lib/@types/media.js +3 -1
- package/lib/@types/membership.js +1 -1
- package/lib/@types/membership.js.map +1 -1
- package/lib/@types/partials.js +6 -6
- package/lib/@types/partials.js.map +1 -1
- package/lib/@types/polls.js +5 -5
- package/lib/@types/polls.js.map +1 -1
- package/lib/@types/read_receipts.js +2 -2
- package/lib/@types/read_receipts.js.map +1 -1
- package/lib/@types/registration.js +3 -1
- package/lib/@types/requests.js +1 -1
- package/lib/@types/requests.js.map +1 -1
- package/lib/@types/retention.js +1 -1
- package/lib/@types/retention.js.map +1 -1
- package/lib/@types/search.js +1 -1
- package/lib/@types/search.js.map +1 -1
- package/lib/@types/signed.js +3 -1
- package/lib/@types/spaces.js +3 -1
- package/lib/@types/state_events.js +3 -1
- package/lib/@types/synapse.js +3 -1
- package/lib/@types/sync.js +1 -1
- package/lib/@types/sync.js.map +1 -1
- package/lib/@types/threepids.js +1 -1
- package/lib/@types/threepids.js.map +1 -1
- package/lib/@types/topic.js +1 -1
- package/lib/@types/topic.js.map +1 -1
- package/lib/@types/uia.js +3 -1
- package/lib/NamespacedValue.js +8 -8
- package/lib/NamespacedValue.js.map +1 -1
- package/lib/ReEmitter.js +9 -16
- package/lib/ReEmitter.js.map +1 -1
- package/lib/ToDeviceMessageQueue.js +49 -57
- package/lib/ToDeviceMessageQueue.js.map +1 -1
- package/lib/autodiscovery.js +232 -247
- package/lib/autodiscovery.js.map +1 -1
- package/lib/base64.js +1 -1
- package/lib/base64.js.map +1 -1
- package/lib/browser-index.d.ts +2 -2
- package/lib/browser-index.d.ts.map +1 -1
- package/lib/browser-index.js +5 -5
- package/lib/browser-index.js.map +1 -1
- package/lib/capabilityPoller.js +19 -22
- package/lib/capabilityPoller.js.map +1 -1
- package/lib/client.d.ts +2 -8
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +2043 -2487
- package/lib/client.js.map +1 -1
- package/lib/common-crypto/CryptoBackend.js +2 -2
- package/lib/common-crypto/CryptoBackend.js.map +1 -1
- package/lib/common-crypto/key-passphrase.js.map +1 -1
- package/lib/content-helpers.js +43 -48
- package/lib/content-helpers.js.map +1 -1
- package/lib/content-repo.js +14 -24
- package/lib/content-repo.js.map +1 -1
- package/lib/crypto/store/base.js +6 -6
- package/lib/crypto/store/base.js.map +1 -1
- package/lib/crypto/store/indexeddb-crypto-store-backend.js +190 -238
- package/lib/crypto/store/indexeddb-crypto-store-backend.js.map +1 -1
- package/lib/crypto/store/indexeddb-crypto-store.js +25 -30
- package/lib/crypto/store/indexeddb-crypto-store.js.map +1 -1
- package/lib/crypto/store/localStorage-crypto-store.js +113 -145
- package/lib/crypto/store/localStorage-crypto-store.js.map +1 -1
- package/lib/crypto/store/memory-crypto-store.js +74 -105
- package/lib/crypto/store/memory-crypto-store.js.map +1 -1
- package/lib/crypto-api/CryptoEvent.js +1 -1
- package/lib/crypto-api/CryptoEvent.js.map +1 -1
- package/lib/crypto-api/CryptoEventHandlerMap.js +3 -1
- package/lib/crypto-api/index.d.ts +15 -6
- package/lib/crypto-api/index.d.ts.map +1 -1
- package/lib/crypto-api/index.js +22 -22
- package/lib/crypto-api/index.js.map +1 -1
- package/lib/crypto-api/key-passphrase.js +15 -23
- package/lib/crypto-api/key-passphrase.js.map +1 -1
- package/lib/crypto-api/keybackup.js +3 -1
- package/lib/crypto-api/recovery-key.js +11 -12
- package/lib/crypto-api/recovery-key.js.map +1 -1
- package/lib/crypto-api/verification.js +3 -3
- package/lib/crypto-api/verification.js.map +1 -1
- package/lib/digest.js +7 -14
- package/lib/digest.js.map +1 -1
- package/lib/embedded.d.ts.map +1 -1
- package/lib/embedded.js +380 -505
- package/lib/embedded.js.map +1 -1
- package/lib/errors.js +2 -2
- package/lib/errors.js.map +1 -1
- package/lib/event-mapper.js +10 -12
- package/lib/event-mapper.js.map +1 -1
- package/lib/extensible_events_v1/ExtensibleEvent.js.map +1 -1
- package/lib/extensible_events_v1/InvalidEventError.js.map +1 -1
- package/lib/extensible_events_v1/MessageEvent.js +11 -13
- package/lib/extensible_events_v1/MessageEvent.js.map +1 -1
- package/lib/extensible_events_v1/PollEndEvent.js +3 -4
- package/lib/extensible_events_v1/PollEndEvent.js.map +1 -1
- package/lib/extensible_events_v1/PollResponseEvent.js +5 -6
- package/lib/extensible_events_v1/PollResponseEvent.js.map +1 -1
- package/lib/extensible_events_v1/PollStartEvent.js +8 -10
- package/lib/extensible_events_v1/PollStartEvent.js.map +1 -1
- package/lib/extensible_events_v1/utilities.js.map +1 -1
- package/lib/feature.js +18 -31
- package/lib/feature.js.map +1 -1
- package/lib/filter-component.d.ts.map +1 -1
- package/lib/filter-component.js +20 -26
- package/lib/filter-component.js.map +1 -1
- package/lib/filter.js +14 -17
- package/lib/filter.js.map +1 -1
- package/lib/http-api/errors.js +28 -43
- package/lib/http-api/errors.js.map +1 -1
- package/lib/http-api/fetch.js +141 -159
- package/lib/http-api/fetch.js.map +1 -1
- package/lib/http-api/index.js +17 -20
- package/lib/http-api/index.js.map +1 -1
- package/lib/http-api/interface.js +1 -1
- package/lib/http-api/interface.js.map +1 -1
- package/lib/http-api/method.js +1 -1
- package/lib/http-api/method.js.map +1 -1
- package/lib/http-api/prefix.js +3 -3
- package/lib/http-api/prefix.js.map +1 -1
- package/lib/http-api/refresh.js +74 -94
- package/lib/http-api/refresh.js.map +1 -1
- package/lib/http-api/utils.d.ts +1 -1
- package/lib/http-api/utils.d.ts.map +1 -1
- package/lib/http-api/utils.js +34 -42
- package/lib/http-api/utils.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/indexeddb-helpers.js +3 -3
- package/lib/indexeddb-helpers.js.map +1 -1
- package/lib/indexeddb-worker.js.map +1 -1
- package/lib/interactive-auth.d.ts +5 -5
- package/lib/interactive-auth.d.ts.map +1 -1
- package/lib/interactive-auth.js +172 -204
- package/lib/interactive-auth.js.map +1 -1
- package/lib/logger.js +21 -57
- package/lib/logger.js.map +1 -1
- package/lib/matrix.js +7 -11
- package/lib/matrix.js.map +1 -1
- package/lib/matrixrtc/CallMembership.js +80 -74
- package/lib/matrixrtc/CallMembership.js.map +1 -1
- package/lib/matrixrtc/EncryptionManager.js +1 -1
- package/lib/matrixrtc/EncryptionManager.js.map +1 -1
- package/lib/matrixrtc/IKeyTransport.js +1 -1
- package/lib/matrixrtc/IKeyTransport.js.map +1 -1
- package/lib/matrixrtc/IMembershipManager.js +1 -1
- package/lib/matrixrtc/IMembershipManager.js.map +1 -1
- package/lib/matrixrtc/LivekitTransport.d.ts +1 -1
- package/lib/matrixrtc/LivekitTransport.js +4 -4
- package/lib/matrixrtc/LivekitTransport.js.map +1 -1
- package/lib/matrixrtc/MatrixRTCSession.js +137 -187
- package/lib/matrixrtc/MatrixRTCSession.js.map +1 -1
- package/lib/matrixrtc/MatrixRTCSessionManager.js +36 -41
- package/lib/matrixrtc/MatrixRTCSessionManager.js.map +1 -1
- package/lib/matrixrtc/MembershipManager.js +332 -378
- package/lib/matrixrtc/MembershipManager.js.map +1 -1
- package/lib/matrixrtc/MembershipManagerActionScheduler.js +54 -63
- package/lib/matrixrtc/MembershipManagerActionScheduler.js.map +1 -1
- package/lib/matrixrtc/RTCEncryptionManager.js +119 -143
- package/lib/matrixrtc/RTCEncryptionManager.js.map +1 -1
- package/lib/matrixrtc/ToDeviceKeyTransport.js +53 -58
- package/lib/matrixrtc/ToDeviceKeyTransport.js.map +1 -1
- package/lib/matrixrtc/index.js.map +1 -1
- package/lib/matrixrtc/membershipData/common.js +1 -1
- package/lib/matrixrtc/membershipData/common.js.map +1 -1
- package/lib/matrixrtc/membershipData/index.js.map +1 -1
- package/lib/matrixrtc/membershipData/rtc.js +15 -23
- package/lib/matrixrtc/membershipData/rtc.js.map +1 -1
- package/lib/matrixrtc/membershipData/session.js +4 -5
- package/lib/matrixrtc/membershipData/session.js.map +1 -1
- package/lib/matrixrtc/types.js +4 -6
- package/lib/matrixrtc/types.js.map +1 -1
- package/lib/matrixrtc/utils.js +4 -11
- package/lib/matrixrtc/utils.js.map +1 -1
- package/lib/models/MSC3089Branch.js +91 -116
- package/lib/models/MSC3089Branch.js.map +1 -1
- package/lib/models/MSC3089TreeSpace.js +209 -245
- package/lib/models/MSC3089TreeSpace.js.map +1 -1
- package/lib/models/ToDeviceMessage.js +3 -1
- package/lib/models/beacon.js +14 -13
- package/lib/models/beacon.js.map +1 -1
- package/lib/models/compare-event-ordering.js +13 -13
- package/lib/models/compare-event-ordering.js.map +1 -1
- package/lib/models/device.js +3 -3
- package/lib/models/device.js.map +1 -1
- package/lib/models/event-context.js +5 -8
- package/lib/models/event-context.js.map +1 -1
- package/lib/models/event-status.js +1 -1
- package/lib/models/event-status.js.map +1 -1
- package/lib/models/event-timeline-set.js +88 -94
- package/lib/models/event-timeline-set.js.map +1 -1
- package/lib/models/event-timeline.js +28 -30
- package/lib/models/event-timeline.js.map +1 -1
- package/lib/models/event.js +182 -226
- package/lib/models/event.js.map +1 -1
- package/lib/models/invites-ignorer-types.js +4 -4
- package/lib/models/invites-ignorer-types.js.map +1 -1
- package/lib/models/invites-ignorer.js +159 -179
- package/lib/models/invites-ignorer.js.map +1 -1
- package/lib/models/poll.js +71 -81
- package/lib/models/poll.js.map +1 -1
- package/lib/models/profile-keys.js +2 -2
- package/lib/models/profile-keys.js.map +1 -1
- package/lib/models/read-receipt.js +40 -56
- package/lib/models/read-receipt.js.map +1 -1
- package/lib/models/related-relations.js.map +1 -1
- package/lib/models/relations-container.js +22 -23
- package/lib/models/relations-container.js.map +1 -1
- package/lib/models/relations.js +133 -159
- package/lib/models/relations.js.map +1 -1
- package/lib/models/room-member.js +24 -29
- package/lib/models/room-member.js.map +1 -1
- package/lib/models/room-receipts.js +29 -43
- package/lib/models/room-receipts.js.map +1 -1
- package/lib/models/room-retention.js +74 -83
- package/lib/models/room-retention.js.map +1 -1
- package/lib/models/room-state.js +143 -172
- package/lib/models/room-state.js.map +1 -1
- package/lib/models/room-sticky-events.d.ts +1 -0
- package/lib/models/room-sticky-events.d.ts.map +1 -1
- package/lib/models/room-sticky-events.js +45 -65
- package/lib/models/room-sticky-events.js.map +1 -1
- package/lib/models/room-summary.js.map +1 -1
- package/lib/models/room.d.ts.map +1 -1
- package/lib/models/room.js +765 -909
- package/lib/models/room.js.map +1 -1
- package/lib/models/search-result.js +5 -5
- package/lib/models/search-result.js.map +1 -1
- package/lib/models/thread.js +225 -285
- package/lib/models/thread.js.map +1 -1
- package/lib/models/typed-event-emitter.js +7 -18
- package/lib/models/typed-event-emitter.js.map +1 -1
- package/lib/models/user.js +8 -8
- package/lib/models/user.js.map +1 -1
- package/lib/oidc/authorize.js +208 -241
- package/lib/oidc/authorize.js.map +1 -1
- package/lib/oidc/discovery.js +23 -36
- package/lib/oidc/discovery.js.map +1 -1
- package/lib/oidc/error.js +1 -1
- package/lib/oidc/error.js.map +1 -1
- package/lib/oidc/index.js +1 -0
- package/lib/oidc/index.js.map +1 -1
- package/lib/oidc/register.js +60 -66
- package/lib/oidc/register.js.map +1 -1
- package/lib/oidc/tokenRefresher.js +77 -91
- package/lib/oidc/tokenRefresher.js.map +1 -1
- package/lib/oidc/validate.js +18 -18
- package/lib/oidc/validate.js.map +1 -1
- package/lib/pushprocessor.js +71 -82
- package/lib/pushprocessor.js.map +1 -1
- package/lib/randomstring.js +9 -9
- package/lib/randomstring.js.map +1 -1
- package/lib/realtime-callbacks.js +25 -28
- package/lib/realtime-callbacks.js.map +1 -1
- package/lib/receipt-accumulator.d.ts +2 -0
- package/lib/receipt-accumulator.d.ts.map +1 -1
- package/lib/receipt-accumulator.js +14 -22
- package/lib/receipt-accumulator.js.map +1 -1
- package/lib/rendezvous/MSC4108SignInWithQR.js +271 -302
- package/lib/rendezvous/MSC4108SignInWithQR.js.map +1 -1
- package/lib/rendezvous/RendezvousChannel.js +3 -1
- package/lib/rendezvous/RendezvousCode.js +3 -1
- package/lib/rendezvous/RendezvousError.js.map +1 -1
- package/lib/rendezvous/RendezvousFailureReason.js +2 -2
- package/lib/rendezvous/RendezvousFailureReason.js.map +1 -1
- package/lib/rendezvous/RendezvousIntent.js +1 -1
- package/lib/rendezvous/RendezvousIntent.js.map +1 -1
- package/lib/rendezvous/RendezvousTransport.js +3 -1
- package/lib/rendezvous/channels/MSC4108SecureChannel.js +123 -147
- package/lib/rendezvous/channels/MSC4108SecureChannel.js.map +1 -1
- package/lib/rendezvous/index.js +44 -69
- package/lib/rendezvous/index.js.map +1 -1
- package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts +1 -1
- package/lib/rendezvous/transports/MSC4108RendezvousSession.js +134 -152
- package/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +1 -1
- package/lib/retentionPolicy.js +6 -9
- package/lib/retentionPolicy.js.map +1 -1
- package/lib/room-hierarchy.js +52 -60
- package/lib/room-hierarchy.js.map +1 -1
- package/lib/rust-crypto/CrossSigningIdentity.js +94 -104
- package/lib/rust-crypto/CrossSigningIdentity.js.map +1 -1
- package/lib/rust-crypto/DehydratedDeviceManager.js +157 -190
- package/lib/rust-crypto/DehydratedDeviceManager.js.map +1 -1
- package/lib/rust-crypto/KeyClaimManager.js +18 -22
- package/lib/rust-crypto/KeyClaimManager.js.map +1 -1
- package/lib/rust-crypto/OutgoingRequestProcessor.js +109 -139
- package/lib/rust-crypto/OutgoingRequestProcessor.js.map +1 -1
- package/lib/rust-crypto/OutgoingRequestsManager.js +66 -80
- package/lib/rust-crypto/OutgoingRequestsManager.js.map +1 -1
- package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts +1 -1
- package/lib/rust-crypto/PerSessionKeyBackupDownloader.js +196 -224
- package/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +1 -1
- package/lib/rust-crypto/RoomEncryptor.js +127 -143
- package/lib/rust-crypto/RoomEncryptor.js.map +1 -1
- package/lib/rust-crypto/backup.js +453 -549
- package/lib/rust-crypto/backup.js.map +1 -1
- package/lib/rust-crypto/constants.js +1 -1
- package/lib/rust-crypto/constants.js.map +1 -1
- package/lib/rust-crypto/device-converter.js +15 -28
- package/lib/rust-crypto/device-converter.js.map +1 -1
- package/lib/rust-crypto/index.js +103 -116
- package/lib/rust-crypto/index.js.map +1 -1
- package/lib/rust-crypto/libolm_migration.js +303 -365
- package/lib/rust-crypto/libolm_migration.js.map +1 -1
- package/lib/rust-crypto/rust-crypto.d.ts +5 -1
- package/lib/rust-crypto/rust-crypto.d.ts.map +1 -1
- package/lib/rust-crypto/rust-crypto.js +1067 -1332
- package/lib/rust-crypto/rust-crypto.js.map +1 -1
- package/lib/rust-crypto/secret-storage.js +12 -25
- package/lib/rust-crypto/secret-storage.js.map +1 -1
- package/lib/rust-crypto/verification.js +137 -189
- package/lib/rust-crypto/verification.js.map +1 -1
- package/lib/scheduler.js +44 -19
- package/lib/scheduler.js.map +1 -1
- package/lib/secret-storage.js +179 -213
- package/lib/secret-storage.js.map +1 -1
- package/lib/serverCapabilities.js +6 -9
- package/lib/serverCapabilities.js.map +1 -1
- package/lib/service-types.js +1 -1
- package/lib/service-types.js.map +1 -1
- package/lib/sliding-sync-sdk.d.ts.map +1 -1
- package/lib/sliding-sync-sdk.js +368 -424
- package/lib/sliding-sync-sdk.js.map +1 -1
- package/lib/sliding-sync.js +135 -171
- package/lib/sliding-sync.js.map +1 -1
- package/lib/store/index.js +3 -1
- package/lib/store/indexeddb-backend.js +3 -1
- package/lib/store/indexeddb-local-backend.js +194 -253
- package/lib/store/indexeddb-local-backend.js.map +1 -1
- package/lib/store/indexeddb-remote-backend.js +33 -63
- package/lib/store/indexeddb-remote-backend.js.map +1 -1
- package/lib/store/indexeddb-store-worker.js +22 -23
- package/lib/store/indexeddb-store-worker.js.map +1 -1
- package/lib/store/indexeddb.js +44 -71
- package/lib/store/indexeddb.js.map +1 -1
- package/lib/store/local-storage-events-emitter.js +2 -2
- package/lib/store/local-storage-events-emitter.js.map +1 -1
- package/lib/store/memory.js +34 -57
- package/lib/store/memory.js.map +1 -1
- package/lib/store/stub.js +22 -35
- package/lib/store/stub.js.map +1 -1
- package/lib/sync-accumulator.js +54 -66
- package/lib/sync-accumulator.js.map +1 -1
- package/lib/sync.d.ts.map +1 -1
- package/lib/sync.js +905 -998
- package/lib/sync.js.map +1 -1
- package/lib/testing.js +63 -105
- package/lib/testing.js.map +1 -1
- package/lib/thread-utils.js +1 -4
- package/lib/thread-utils.js.map +1 -1
- package/lib/timeline-window.js +89 -102
- package/lib/timeline-window.js.map +1 -1
- package/lib/types.js +1 -1
- package/lib/types.js.map +1 -1
- package/lib/utils/decryptAESSecretStorageItem.js +14 -25
- package/lib/utils/decryptAESSecretStorageItem.js.map +1 -1
- package/lib/utils/encryptAESSecretStorageItem.js +27 -38
- package/lib/utils/encryptAESSecretStorageItem.js.map +1 -1
- package/lib/utils/internal/deriveKeys.js +25 -32
- package/lib/utils/internal/deriveKeys.js.map +1 -1
- package/lib/utils/roomVersion.js +1 -1
- package/lib/utils/roomVersion.js.map +1 -1
- package/lib/utils.js +83 -135
- package/lib/utils.js.map +1 -1
- package/lib/version-support.js +3 -3
- package/lib/version-support.js.map +1 -1
- package/lib/webrtc/audioContext.js +5 -6
- package/lib/webrtc/audioContext.js.map +1 -1
- package/lib/webrtc/call.js +1081 -1250
- package/lib/webrtc/call.js.map +1 -1
- package/lib/webrtc/callEventHandler.js +202 -214
- package/lib/webrtc/callEventHandler.js.map +1 -1
- package/lib/webrtc/callEventTypes.js +2 -2
- package/lib/webrtc/callEventTypes.js.map +1 -1
- package/lib/webrtc/callFeed.js +18 -20
- package/lib/webrtc/callFeed.js.map +1 -1
- package/lib/webrtc/groupCall.js +513 -602
- package/lib/webrtc/groupCall.js.map +1 -1
- package/lib/webrtc/groupCallEventHandler.js +59 -62
- package/lib/webrtc/groupCallEventHandler.js.map +1 -1
- package/lib/webrtc/mediaHandler.js +198 -232
- package/lib/webrtc/mediaHandler.js.map +1 -1
- package/lib/webrtc/stats/callFeedStatsReporter.js +16 -20
- package/lib/webrtc/stats/callFeedStatsReporter.js.map +1 -1
- package/lib/webrtc/stats/callStatsReportGatherer.js +67 -75
- package/lib/webrtc/stats/callStatsReportGatherer.js.map +1 -1
- package/lib/webrtc/stats/callStatsReportSummary.js +3 -1
- package/lib/webrtc/stats/connectionStats.js.map +1 -1
- package/lib/webrtc/stats/connectionStatsBuilder.js +2 -2
- package/lib/webrtc/stats/connectionStatsBuilder.js.map +1 -1
- package/lib/webrtc/stats/connectionStatsReportBuilder.js +20 -24
- package/lib/webrtc/stats/connectionStatsReportBuilder.js.map +1 -1
- package/lib/webrtc/stats/groupCallStats.js +6 -8
- package/lib/webrtc/stats/groupCallStats.js.map +1 -1
- package/lib/webrtc/stats/media/mediaSsrcHandler.js +7 -8
- package/lib/webrtc/stats/media/mediaSsrcHandler.js.map +1 -1
- package/lib/webrtc/stats/media/mediaTrackHandler.js +7 -9
- package/lib/webrtc/stats/media/mediaTrackHandler.js.map +1 -1
- package/lib/webrtc/stats/media/mediaTrackStats.js +3 -3
- package/lib/webrtc/stats/media/mediaTrackStats.js.map +1 -1
- package/lib/webrtc/stats/media/mediaTrackStatsHandler.js +7 -7
- package/lib/webrtc/stats/media/mediaTrackStatsHandler.js.map +1 -1
- package/lib/webrtc/stats/statsReport.js +1 -1
- package/lib/webrtc/stats/statsReport.js.map +1 -1
- package/lib/webrtc/stats/statsReportEmitter.js.map +1 -1
- package/lib/webrtc/stats/summaryStatsReportGatherer.js +14 -14
- package/lib/webrtc/stats/summaryStatsReportGatherer.js.map +1 -1
- package/lib/webrtc/stats/trackStatsBuilder.js +32 -34
- package/lib/webrtc/stats/trackStatsBuilder.js.map +1 -1
- package/lib/webrtc/stats/transportStats.js +3 -1
- package/lib/webrtc/stats/transportStatsBuilder.js +9 -9
- package/lib/webrtc/stats/transportStatsBuilder.js.map +1 -1
- package/lib/webrtc/stats/valueFormatter.js +1 -1
- package/lib/webrtc/stats/valueFormatter.js.map +1 -1
- package/package.json +18 -33
- package/src/@types/global.d.ts +2 -2
- package/src/ToDeviceMessageQueue.ts +2 -2
- package/src/browser-index.ts +4 -4
- package/src/client.ts +15 -20
- package/src/crypto-api/index.ts +17 -6
- package/src/embedded.ts +4 -6
- package/src/filter-component.ts +1 -0
- package/src/http-api/utils.ts +1 -1
- package/src/interactive-auth.ts +11 -5
- package/src/matrixrtc/LivekitTransport.ts +1 -1
- package/src/matrixrtc/MatrixRTCSession.ts +1 -1
- package/src/models/MSC3089Branch.ts +1 -1
- package/src/models/room-sticky-events.ts +1 -0
- package/src/models/room.ts +9 -11
- package/src/receipt-accumulator.ts +2 -0
- package/src/rendezvous/index.ts +1 -1
- package/src/rendezvous/transports/MSC4108RendezvousSession.ts +2 -2
- package/src/rust-crypto/PerSessionKeyBackupDownloader.ts +1 -1
- package/src/rust-crypto/index.ts +6 -6
- package/src/rust-crypto/rust-crypto.ts +31 -7
- package/src/rust-crypto/verification.ts +1 -1
- package/src/sliding-sync-sdk.ts +5 -7
- package/src/store/indexeddb-local-backend.ts +3 -3
- package/src/sync.ts +6 -8
package/lib/http-api/utils.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
1
|
/*
|
|
3
2
|
Copyright 2022 - 2024 The Matrix.org Foundation C.I.C.
|
|
4
3
|
|
|
@@ -22,16 +21,16 @@ import { ConnectionError, HTTPError, MatrixError, MatrixSafetyError, MatrixSafet
|
|
|
22
21
|
|
|
23
22
|
// Ponyfill for https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout
|
|
24
23
|
export function timeoutSignal(ms) {
|
|
25
|
-
|
|
24
|
+
const controller = new AbortController();
|
|
26
25
|
setTimeout(() => {
|
|
27
26
|
controller.abort();
|
|
28
27
|
}, ms);
|
|
29
28
|
return controller.signal;
|
|
30
29
|
}
|
|
31
30
|
export function anySignal(signals) {
|
|
32
|
-
|
|
31
|
+
const controller = new AbortController();
|
|
33
32
|
function cleanup() {
|
|
34
|
-
for (
|
|
33
|
+
for (const signal of signals) {
|
|
35
34
|
signal.removeEventListener("abort", onAbort);
|
|
36
35
|
}
|
|
37
36
|
}
|
|
@@ -39,7 +38,7 @@ export function anySignal(signals) {
|
|
|
39
38
|
controller.abort();
|
|
40
39
|
cleanup();
|
|
41
40
|
}
|
|
42
|
-
for (
|
|
41
|
+
for (const signal of signals) {
|
|
43
42
|
if (signal.aborted) {
|
|
44
43
|
onAbort();
|
|
45
44
|
break;
|
|
@@ -63,28 +62,27 @@ export function anySignal(signals) {
|
|
|
63
62
|
* @returns
|
|
64
63
|
*/
|
|
65
64
|
export function parseErrorResponse(response, body) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
var colonIdx = header.indexOf(":");
|
|
65
|
+
const httpHeaders = isXhr(response) ? new Headers(response.getAllResponseHeaders().trim().split(/[\r\n]+/).map(header => {
|
|
66
|
+
const colonIdx = header.indexOf(":");
|
|
69
67
|
return [header.substring(0, colonIdx), header.substring(colonIdx + 1)];
|
|
70
68
|
})) : response.headers;
|
|
71
|
-
|
|
69
|
+
let contentType;
|
|
72
70
|
try {
|
|
73
71
|
contentType = getResponseContentType(httpHeaders);
|
|
74
72
|
} catch (e) {
|
|
75
73
|
return e;
|
|
76
74
|
}
|
|
77
|
-
if (
|
|
78
|
-
|
|
75
|
+
if (contentType?.type === "application/json" && body) {
|
|
76
|
+
const errorBody = JSON.parse(body);
|
|
79
77
|
if (errorBody.errcode && MatrixSafetyErrorCode.matches(errorBody.errcode)) {
|
|
80
78
|
return new MatrixSafetyError(errorBody, response.status, isXhr(response) ? response.responseURL : response.url, undefined, httpHeaders);
|
|
81
79
|
}
|
|
82
80
|
return new MatrixError(errorBody, response.status, isXhr(response) ? response.responseURL : response.url, undefined, httpHeaders);
|
|
83
81
|
}
|
|
84
|
-
if (
|
|
85
|
-
return new HTTPError(
|
|
82
|
+
if (contentType?.type === "text/plain") {
|
|
83
|
+
return new HTTPError(`Server returned ${response.status} error: ${body}`, response.status, httpHeaders);
|
|
86
84
|
}
|
|
87
|
-
return new HTTPError(
|
|
85
|
+
return new HTTPError(`Server returned ${response.status} error`, response.status, httpHeaders);
|
|
88
86
|
}
|
|
89
87
|
function isXhr(response) {
|
|
90
88
|
return "getResponseHeader" in response;
|
|
@@ -100,7 +98,7 @@ function isXhr(response) {
|
|
|
100
98
|
* @returns parsed content-type header, or null if not found
|
|
101
99
|
*/
|
|
102
100
|
function getResponseContentType(headers) {
|
|
103
|
-
|
|
101
|
+
const contentType = headers.get("Content-Type");
|
|
104
102
|
if (contentType === null) return null;
|
|
105
103
|
return parseContentType(contentType);
|
|
106
104
|
}
|
|
@@ -112,8 +110,27 @@ function getResponseContentType(headers) {
|
|
|
112
110
|
* @returns the result of the network operation
|
|
113
111
|
* @throws {@link ConnectionError} If after maxAttempts the callback still throws ConnectionError
|
|
114
112
|
*/
|
|
115
|
-
export function retryNetworkOperation(
|
|
116
|
-
|
|
113
|
+
export async function retryNetworkOperation(maxAttempts, callback) {
|
|
114
|
+
let attempts = 0;
|
|
115
|
+
let lastConnectionError = null;
|
|
116
|
+
while (attempts < maxAttempts) {
|
|
117
|
+
try {
|
|
118
|
+
if (attempts > 0) {
|
|
119
|
+
const timeout = 1000 * Math.pow(2, attempts);
|
|
120
|
+
logger.log(`network operation failed ${attempts} times, retrying in ${timeout}ms...`);
|
|
121
|
+
await sleep(timeout);
|
|
122
|
+
}
|
|
123
|
+
return await callback();
|
|
124
|
+
} catch (err) {
|
|
125
|
+
if (err instanceof ConnectionError) {
|
|
126
|
+
attempts += 1;
|
|
127
|
+
lastConnectionError = err;
|
|
128
|
+
} else {
|
|
129
|
+
throw err;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
throw lastConnectionError;
|
|
117
134
|
}
|
|
118
135
|
|
|
119
136
|
/**
|
|
@@ -127,31 +144,6 @@ export function retryNetworkOperation(_x, _x2) {
|
|
|
127
144
|
* @param attempts - The number of attempts made so far, including the one that just failed.
|
|
128
145
|
* @param retryConnectionError - Whether to retry on {@link ConnectionError} (CORS, connection is down, etc.)
|
|
129
146
|
*/
|
|
130
|
-
function _retryNetworkOperation() {
|
|
131
|
-
_retryNetworkOperation = _asyncToGenerator(function* (maxAttempts, callback) {
|
|
132
|
-
var attempts = 0;
|
|
133
|
-
var lastConnectionError = null;
|
|
134
|
-
while (attempts < maxAttempts) {
|
|
135
|
-
try {
|
|
136
|
-
if (attempts > 0) {
|
|
137
|
-
var timeout = 1000 * Math.pow(2, attempts);
|
|
138
|
-
logger.log("network operation failed ".concat(attempts, " times, retrying in ").concat(timeout, "ms..."));
|
|
139
|
-
yield sleep(timeout);
|
|
140
|
-
}
|
|
141
|
-
return yield callback();
|
|
142
|
-
} catch (err) {
|
|
143
|
-
if (err instanceof ConnectionError) {
|
|
144
|
-
attempts += 1;
|
|
145
|
-
lastConnectionError = err;
|
|
146
|
-
} else {
|
|
147
|
-
throw err;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
throw lastConnectionError;
|
|
152
|
-
});
|
|
153
|
-
return _retryNetworkOperation.apply(this, arguments);
|
|
154
|
-
}
|
|
155
147
|
export function calculateRetryBackoff(err, attempts, retryConnectionError) {
|
|
156
148
|
if (attempts > 4) {
|
|
157
149
|
return -1; // give up
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["parse","parseContentType","logger","sleep","ConnectionError","HTTPError","MatrixError","MatrixSafetyError","MatrixSafetyErrorCode","safeGetRetryAfterMs","timeoutSignal","ms","controller","AbortController","setTimeout","abort","signal","anySignal","signals","cleanup","removeEventListener","onAbort","aborted","addEventListener","parseErrorResponse","response","body","_contentType","_contentType2","httpHeaders","isXhr","Headers","getAllResponseHeaders","trim","split","map","header","colonIdx","indexOf","substring","headers","contentType","getResponseContentType","e","type","errorBody","JSON","errcode","matches","status","responseURL","url","undefined","concat","get","retryNetworkOperation","_x","_x2","_retryNetworkOperation","apply","arguments","_asyncToGenerator","maxAttempts","callback","attempts","lastConnectionError","timeout","Math","pow","log","err","calculateRetryBackoff","retryConnectionError","httpStatus","floor","name"],"sources":["../../src/http-api/utils.ts"],"sourcesContent":["/*\nCopyright 2022 - 2024 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { parse as parseContentType, type ContentType } from \"content-type\";\n\nimport { logger } from \"../logger.ts\";\nimport { sleep } from \"../utils.ts\";\nimport {\n ConnectionError,\n HTTPError,\n MatrixError,\n MatrixSafetyError,\n MatrixSafetyErrorCode,\n safeGetRetryAfterMs,\n} from \"./errors.ts\";\n\n// Ponyfill for https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout\nexport function timeoutSignal(ms: number): AbortSignal {\n const controller = new AbortController();\n setTimeout(() => {\n controller.abort();\n }, ms);\n\n return controller.signal;\n}\n\nexport function anySignal(signals: AbortSignal[]): {\n signal: AbortSignal;\n cleanup(): void;\n} {\n const controller = new AbortController();\n\n function cleanup(): void {\n for (const signal of signals) {\n signal.removeEventListener(\"abort\", onAbort);\n }\n }\n\n function onAbort(): void {\n controller.abort();\n cleanup();\n }\n\n for (const signal of signals) {\n if (signal.aborted) {\n onAbort();\n break;\n }\n signal.addEventListener(\"abort\", onAbort);\n }\n\n return {\n signal: controller.signal,\n cleanup,\n };\n}\n\n/**\n * Attempt to turn an HTTP error response into a Javascript Error.\n *\n * If it is a JSON response, we will parse it into a MatrixError. Otherwise\n * we return a generic Error.\n *\n * @param response - response object\n * @param body - raw body of the response\n * @returns\n */\nexport function parseErrorResponse(response: XMLHttpRequest | Response, body?: string): Error {\n const httpHeaders = isXhr(response)\n ? new Headers(\n response\n .getAllResponseHeaders()\n .trim()\n .split(/[\\r\\n]+/)\n .map((header): [string, string] => {\n const colonIdx = header.indexOf(\":\");\n return [header.substring(0, colonIdx), header.substring(colonIdx + 1)];\n }),\n )\n : response.headers;\n\n let contentType: ContentType | null;\n try {\n contentType = getResponseContentType(httpHeaders);\n } catch (e) {\n return <Error>e;\n }\n if (contentType?.type === \"application/json\" && body) {\n const errorBody = JSON.parse(body);\n if (errorBody.errcode && MatrixSafetyErrorCode.matches(errorBody.errcode)) {\n return new MatrixSafetyError(\n errorBody,\n response.status,\n isXhr(response) ? response.responseURL : response.url,\n undefined,\n httpHeaders,\n );\n }\n return new MatrixError(\n errorBody,\n response.status,\n isXhr(response) ? response.responseURL : response.url,\n undefined,\n httpHeaders,\n );\n }\n if (contentType?.type === \"text/plain\") {\n return new HTTPError(`Server returned ${response.status} error: ${body}`, response.status, httpHeaders);\n }\n return new HTTPError(`Server returned ${response.status} error`, response.status, httpHeaders);\n}\n\nfunction isXhr(response: XMLHttpRequest | Response): response is XMLHttpRequest {\n return \"getResponseHeader\" in response;\n}\n\n/**\n * extract the Content-Type header from response headers, and\n * parse it to a `{type, parameters}` object.\n *\n * returns null if no content-type header could be found.\n *\n * @param response - response object\n * @returns parsed content-type header, or null if not found\n */\nfunction getResponseContentType(headers: Headers): ContentType | null {\n const contentType = headers.get(\"Content-Type\");\n if (contentType === null) return null;\n return parseContentType(contentType);\n}\n\n/**\n * Retries a network operation run in a callback.\n * @param maxAttempts - maximum attempts to try\n * @param callback - callback that returns a promise of the network operation. If rejected with ConnectionError, it will be retried by calling the callback again.\n * @returns the result of the network operation\n * @throws {@link ConnectionError} If after maxAttempts the callback still throws ConnectionError\n */\nexport async function retryNetworkOperation<T>(maxAttempts: number, callback: () => Promise<T>): Promise<T> {\n let attempts = 0;\n let lastConnectionError: ConnectionError | null = null;\n while (attempts < maxAttempts) {\n try {\n if (attempts > 0) {\n const timeout = 1000 * Math.pow(2, attempts);\n logger.log(`network operation failed ${attempts} times, retrying in ${timeout}ms...`);\n await sleep(timeout);\n }\n return await callback();\n } catch (err) {\n if (err instanceof ConnectionError) {\n attempts += 1;\n lastConnectionError = err;\n } else {\n throw err;\n }\n }\n }\n throw lastConnectionError;\n}\n\n/**\n * Calculate the backoff time for a request retry attempt.\n * This produces wait times of 2, 4, 8, and 16 seconds (30s total) after which we give up. If the\n * failure was due to a rate limited request, the time specified in the error is returned.\n *\n * Returns -1 if the error is not retryable, or if we reach the maximum number of attempts.\n *\n * @param err - The error thrown by the http call\n * @param attempts - The number of attempts made so far, including the one that just failed.\n * @param retryConnectionError - Whether to retry on {@link ConnectionError} (CORS, connection is down, etc.)\n */\nexport function calculateRetryBackoff(err: any, attempts: number, retryConnectionError: boolean): number {\n if (attempts > 4) {\n return -1; // give up\n }\n\n if (err instanceof ConnectionError && !retryConnectionError) {\n return -1;\n }\n\n if (err.httpStatus && Math.floor(err.httpStatus / 100) === 4 && err.httpStatus !== 429) {\n // client error; no amount of retrying will save you now (except for rate limiting which is handled below)\n return -1;\n }\n\n if (err.name === \"AbortError\") {\n // this is a client timeout, that is already very high 60s/80s\n // we don't want to retry, as it could do it for very long\n return -1;\n }\n\n // If we are trying to send an event (or similar) that is too large in any way, then retrying won't help\n if (err.name === \"M_TOO_LARGE\") {\n return -1;\n }\n\n return safeGetRetryAfterMs(err, 1000 * Math.pow(2, attempts));\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,KAAK,IAAIC,gBAAgB,QAA0B,cAAc;AAE1E,SAASC,MAAM,QAAQ,cAAc;AACrC,SAASC,KAAK,QAAQ,aAAa;AACnC,SACIC,eAAe,EACfC,SAAS,EACTC,WAAW,EACXC,iBAAiB,EACjBC,qBAAqB,EACrBC,mBAAmB,QAChB,aAAa;;AAEpB;AACA,OAAO,SAASC,aAAaA,CAACC,EAAU,EAAe;EACnD,IAAMC,UAAU,GAAG,IAAIC,eAAe,CAAC,CAAC;EACxCC,UAAU,CAAC,MAAM;IACbF,UAAU,CAACG,KAAK,CAAC,CAAC;EACtB,CAAC,EAAEJ,EAAE,CAAC;EAEN,OAAOC,UAAU,CAACI,MAAM;AAC5B;AAEA,OAAO,SAASC,SAASA,CAACC,OAAsB,EAG9C;EACE,IAAMN,UAAU,GAAG,IAAIC,eAAe,CAAC,CAAC;EAExC,SAASM,OAAOA,CAAA,EAAS;IACrB,KAAK,IAAMH,MAAM,IAAIE,OAAO,EAAE;MAC1BF,MAAM,CAACI,mBAAmB,CAAC,OAAO,EAAEC,OAAO,CAAC;IAChD;EACJ;EAEA,SAASA,OAAOA,CAAA,EAAS;IACrBT,UAAU,CAACG,KAAK,CAAC,CAAC;IAClBI,OAAO,CAAC,CAAC;EACb;EAEA,KAAK,IAAMH,MAAM,IAAIE,OAAO,EAAE;IAC1B,IAAIF,MAAM,CAACM,OAAO,EAAE;MAChBD,OAAO,CAAC,CAAC;MACT;IACJ;IACAL,MAAM,CAACO,gBAAgB,CAAC,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B;IACA;IACA,OAAO,CAAC,CAAC;EACb;;EAEA;EACA,IAAIL,GAAG,CAACK,IAAI,KAAK,aAAa,EAAE;IAC5B,OAAO,CAAC,CAAC;EACb;EAEA,OAAOlE,mBAAmB,CAAC6D,GAAG,EAAE,IAAI,GAAGH,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEJ,QAAQ,CAAC,CAAC;AACjE","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../src/http-api/utils.ts"],"sourcesContent":["/*\nCopyright 2022 - 2024 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { parse as parseContentType, type ContentType } from \"content-type\";\n\nimport { logger } from \"../logger.ts\";\nimport { sleep } from \"../utils.ts\";\nimport {\n ConnectionError,\n HTTPError,\n MatrixError,\n MatrixSafetyError,\n MatrixSafetyErrorCode,\n safeGetRetryAfterMs,\n} from \"./errors.ts\";\n\n// Ponyfill for https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout\nexport function timeoutSignal(ms: number): AbortSignal {\n const controller = new AbortController();\n setTimeout(() => {\n controller.abort();\n }, ms);\n\n return controller.signal;\n}\n\nexport function anySignal(signals: AbortSignal[]): {\n signal: AbortSignal;\n cleanup(this: void): void;\n} {\n const controller = new AbortController();\n\n function cleanup(): void {\n for (const signal of signals) {\n signal.removeEventListener(\"abort\", onAbort);\n }\n }\n\n function onAbort(): void {\n controller.abort();\n cleanup();\n }\n\n for (const signal of signals) {\n if (signal.aborted) {\n onAbort();\n break;\n }\n signal.addEventListener(\"abort\", onAbort);\n }\n\n return {\n signal: controller.signal,\n cleanup,\n };\n}\n\n/**\n * Attempt to turn an HTTP error response into a Javascript Error.\n *\n * If it is a JSON response, we will parse it into a MatrixError. Otherwise\n * we return a generic Error.\n *\n * @param response - response object\n * @param body - raw body of the response\n * @returns\n */\nexport function parseErrorResponse(response: XMLHttpRequest | Response, body?: string): Error {\n const httpHeaders = isXhr(response)\n ? new Headers(\n response\n .getAllResponseHeaders()\n .trim()\n .split(/[\\r\\n]+/)\n .map((header): [string, string] => {\n const colonIdx = header.indexOf(\":\");\n return [header.substring(0, colonIdx), header.substring(colonIdx + 1)];\n }),\n )\n : response.headers;\n\n let contentType: ContentType | null;\n try {\n contentType = getResponseContentType(httpHeaders);\n } catch (e) {\n return <Error>e;\n }\n if (contentType?.type === \"application/json\" && body) {\n const errorBody = JSON.parse(body);\n if (errorBody.errcode && MatrixSafetyErrorCode.matches(errorBody.errcode)) {\n return new MatrixSafetyError(\n errorBody,\n response.status,\n isXhr(response) ? response.responseURL : response.url,\n undefined,\n httpHeaders,\n );\n }\n return new MatrixError(\n errorBody,\n response.status,\n isXhr(response) ? response.responseURL : response.url,\n undefined,\n httpHeaders,\n );\n }\n if (contentType?.type === \"text/plain\") {\n return new HTTPError(`Server returned ${response.status} error: ${body}`, response.status, httpHeaders);\n }\n return new HTTPError(`Server returned ${response.status} error`, response.status, httpHeaders);\n}\n\nfunction isXhr(response: XMLHttpRequest | Response): response is XMLHttpRequest {\n return \"getResponseHeader\" in response;\n}\n\n/**\n * extract the Content-Type header from response headers, and\n * parse it to a `{type, parameters}` object.\n *\n * returns null if no content-type header could be found.\n *\n * @param response - response object\n * @returns parsed content-type header, or null if not found\n */\nfunction getResponseContentType(headers: Headers): ContentType | null {\n const contentType = headers.get(\"Content-Type\");\n if (contentType === null) return null;\n return parseContentType(contentType);\n}\n\n/**\n * Retries a network operation run in a callback.\n * @param maxAttempts - maximum attempts to try\n * @param callback - callback that returns a promise of the network operation. If rejected with ConnectionError, it will be retried by calling the callback again.\n * @returns the result of the network operation\n * @throws {@link ConnectionError} If after maxAttempts the callback still throws ConnectionError\n */\nexport async function retryNetworkOperation<T>(maxAttempts: number, callback: () => Promise<T>): Promise<T> {\n let attempts = 0;\n let lastConnectionError: ConnectionError | null = null;\n while (attempts < maxAttempts) {\n try {\n if (attempts > 0) {\n const timeout = 1000 * Math.pow(2, attempts);\n logger.log(`network operation failed ${attempts} times, retrying in ${timeout}ms...`);\n await sleep(timeout);\n }\n return await callback();\n } catch (err) {\n if (err instanceof ConnectionError) {\n attempts += 1;\n lastConnectionError = err;\n } else {\n throw err;\n }\n }\n }\n throw lastConnectionError;\n}\n\n/**\n * Calculate the backoff time for a request retry attempt.\n * This produces wait times of 2, 4, 8, and 16 seconds (30s total) after which we give up. If the\n * failure was due to a rate limited request, the time specified in the error is returned.\n *\n * Returns -1 if the error is not retryable, or if we reach the maximum number of attempts.\n *\n * @param err - The error thrown by the http call\n * @param attempts - The number of attempts made so far, including the one that just failed.\n * @param retryConnectionError - Whether to retry on {@link ConnectionError} (CORS, connection is down, etc.)\n */\nexport function calculateRetryBackoff(err: any, attempts: number, retryConnectionError: boolean): number {\n if (attempts > 4) {\n return -1; // give up\n }\n\n if (err instanceof ConnectionError && !retryConnectionError) {\n return -1;\n }\n\n if (err.httpStatus && Math.floor(err.httpStatus / 100) === 4 && err.httpStatus !== 429) {\n // client error; no amount of retrying will save you now (except for rate limiting which is handled below)\n return -1;\n }\n\n if (err.name === \"AbortError\") {\n // this is a client timeout, that is already very high 60s/80s\n // we don't want to retry, as it could do it for very long\n return -1;\n }\n\n // If we are trying to send an event (or similar) that is too large in any way, then retrying won't help\n if (err.name === \"M_TOO_LARGE\") {\n return -1;\n }\n\n return safeGetRetryAfterMs(err, 1000 * Math.pow(2, attempts));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,KAAK,IAAI,gBAAgB,QAA0B,cAAc;AAE1E,SAAS,MAAM,QA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AAoB,EAAE;IACzD,OAAO,CAAC,CAAC;EACb;EAEA,IAAI,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,UAAU,KAAK,GAAG,EAAE;IACpF;IACA,OAAO,CAAC,CAAC;EACb;EAEA,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,EAAE;IAC3B;IACA;IACA,OAAO,CAAC,CAAC;EACb;;EAEA;EACA,IAAI,GAAG,CAAC,IAAI,KAAK,aAAa,EAAE;IAC5B,OAAO,CAAC,CAAC;EACb;EAEA,OAAO,mBAAmB,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;AACjE","ignoreList":[]}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/*\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 * as matrixcs from \"./matrix.ts\";\n\nif (globalThis.__js_sdk_entrypoint) {\n throw new Error(\"Multiple matrix-js-sdk entrypoints detected!\");\n}\nglobalThis.__js_sdk_entrypoint = true;\n\nexport * from \"./matrix.ts\";\nexport default matrixcs;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAK,QAAQ,MAAM,aAAa;AAEvC,IAAI,UAAU,CAAC,mBAAmB,EAAE;EAChC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC;AACnE;AACA,UAAU,CAAC,mBAAmB,GAAG,IAAI;AAErC,cAAc,aAAa;AAC3B,eAAe,QAAQ","ignoreList":[]}
|
package/lib/indexeddb-helpers.js
CHANGED
|
@@ -24,8 +24,8 @@ limitations under the License.
|
|
|
24
24
|
*/
|
|
25
25
|
export function exists(indexedDB, dbName) {
|
|
26
26
|
return new Promise((resolve, reject) => {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
let exists = true;
|
|
28
|
+
const req = indexedDB.open(dbName);
|
|
29
29
|
req.onupgradeneeded = () => {
|
|
30
30
|
// Since we did not provide an explicit version when opening, this event
|
|
31
31
|
// should only fire if the DB did not exist before at any version.
|
|
@@ -33,7 +33,7 @@ export function exists(indexedDB, dbName) {
|
|
|
33
33
|
};
|
|
34
34
|
req.onblocked = () => reject(req.error);
|
|
35
35
|
req.onsuccess = () => {
|
|
36
|
-
|
|
36
|
+
const db = req.result;
|
|
37
37
|
db.close();
|
|
38
38
|
if (!exists) {
|
|
39
39
|
// The DB did not exist before, but has been created as part of this
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexeddb-helpers.js","names":[
|
|
1
|
+
{"version":3,"file":"indexeddb-helpers.js","names":[],"sources":["../src/indexeddb-helpers.ts"],"sourcesContent":["/*\nCopyright 2019 New Vector Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/**\n * Check if an IndexedDB database exists. The only way to do so is to try opening it, so\n * we do that and then delete it did not exist before.\n *\n * @param indexedDB - The `indexedDB` interface\n * @param dbName - The database name to test for\n * @returns Whether the database exists\n */\nexport function exists(indexedDB: IDBFactory, dbName: string): Promise<boolean> {\n return new Promise<boolean>((resolve, reject) => {\n let exists = true;\n const req = indexedDB.open(dbName);\n req.onupgradeneeded = (): void => {\n // Since we did not provide an explicit version when opening, this event\n // should only fire if the DB did not exist before at any version.\n exists = false;\n };\n req.onblocked = (): void => reject(req.error);\n req.onsuccess = (): void => {\n const db = req.result;\n db.close();\n if (!exists) {\n // The DB did not exist before, but has been created as part of this\n // existence check. Delete it now to restore previous state. Delete can\n // actually take a while to complete in some browsers, so don't wait for\n // it. This won't block future open calls that a store might issue next to\n // properly set up the DB.\n indexedDB.deleteDatabase(dbName);\n }\n resolve(exists);\n };\n req.onerror = (): void => reject(req.error);\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS,MAAM,CAAC,SAAqB,EAAE,MAAc,EAAoB;EAC5E,OAAO,IAAI,OAAO,CAAU,CAAC,OAAO,EAAE,MAAM,KAAK;IAC7C,IAAI,MAAM,GAAG,IAAI;IACjB,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;IAClC,GAAG,CAAC,eAAe,GAAG,MAAY;MAC9B;MACA;MACA,MAAM,GAAG,KAAK;IAClB,CAAC;IACD,GAAG,CAAC,SAAS,GAAG,MAAY,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;IAC7C,GAAG,CAAC,SAAS,GAAG,MAAY;MACxB,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM;MACrB,EAAE,CAAC,KAAK,CAAC,CAAC;MACV,IAAI,CAAC,MAAM,EAAE;QACT;QACA;QACA;QACA;QACA;QACA,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC;MACpC;MACA,OAAO,CAAC,MAAM,CAAC;IACnB,CAAC;IACD,GAAG,CAAC,OAAO,GAAG,MAAY,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;EAC/C,CAAC,CAAC;AACN","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexeddb-worker.js","names":[
|
|
1
|
+
{"version":3,"file":"indexeddb-worker.js","names":[],"sources":["../src/indexeddb-worker.ts"],"sourcesContent":["/*\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\n/**\n * Separate exports file for the indexeddb web worker, which is designed\n * to be used separately\n */\n\n/** The {@link IndexedDBStoreWorker} class. */\nexport { IndexedDBStoreWorker } from \"./store/indexeddb-store-worker.ts\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,SAAS,oBAAoB,QAAQ,mCAAmC","ignoreList":[]}
|
|
@@ -152,7 +152,7 @@ interface IOpts<T> {
|
|
|
152
152
|
* The busyChanged callback should be used instead of the background flag.
|
|
153
153
|
* Should return a promise which resolves to the successful response or rejects with a MatrixError.
|
|
154
154
|
*/
|
|
155
|
-
doRequest(auth: AuthDict | null, background: boolean): Promise<T>;
|
|
155
|
+
doRequest(this: void, auth: AuthDict | null, background: boolean): Promise<T>;
|
|
156
156
|
/**
|
|
157
157
|
* Called when the status of the UI auth changes,
|
|
158
158
|
* ie. when the state of an auth stage changes of when the auth flow moves to a new stage.
|
|
@@ -166,14 +166,14 @@ interface IOpts<T> {
|
|
|
166
166
|
* m.login.email.identity:
|
|
167
167
|
* * emailSid: string, the sid of the active email auth session
|
|
168
168
|
*/
|
|
169
|
-
stateUpdated(nextStage: AuthType | string, status: IStageStatus): void;
|
|
169
|
+
stateUpdated(this: void, nextStage: AuthType | string, status: IStageStatus): void;
|
|
170
170
|
/**
|
|
171
171
|
* A function that takes the email address (string), clientSecret (string), attempt number (int) and
|
|
172
172
|
* sessionId (string) and calls the relevant requestToken function and returns the promise returned by that
|
|
173
173
|
* function.
|
|
174
174
|
* If the resulting promise rejects, the rejection will propagate through to the attemptAuth promise.
|
|
175
175
|
*/
|
|
176
|
-
requestEmailToken(email: string, secret: string, attempt: number, session: string): Promise<{
|
|
176
|
+
requestEmailToken(this: void, email: string, secret: string, attempt: number, session: string): Promise<{
|
|
177
177
|
sid: string;
|
|
178
178
|
}>;
|
|
179
179
|
/**
|
|
@@ -181,8 +181,8 @@ interface IOpts<T> {
|
|
|
181
181
|
* After this has been called with true the UI should indicate that a request is in progress
|
|
182
182
|
* until it is called again with false.
|
|
183
183
|
*/
|
|
184
|
-
busyChanged?(busy: boolean): void;
|
|
185
|
-
startAuthStage?(nextStage: string): Promise<void>;
|
|
184
|
+
busyChanged?(this: void, busy: boolean): void;
|
|
185
|
+
startAuthStage?(this: void, nextStage: string): Promise<void>;
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
188
188
|
* Abstracts the logic used to drive the interactive auth process.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-auth.d.ts","sourceRoot":"","sources":["../src/interactive-auth.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKvD,MAAM,WAAW,OAAO;IACpB,MAAM,EAAE,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,OAAO;IAEpB,YAAY,C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