From ff1db2b538e56538c879948c305cd0567ecb32dd Mon Sep 17 00:00:00 2001 From: Hugh Nimmo-Smith Date: Wed, 5 Feb 2025 12:15:20 +0000 Subject: [PATCH] Bump eslint-plugin-matrix-org to enable @typescript-eslint/consistent-type-imports rule (#4680) * Bump eslint-plugin-matrix-org to enable @typescript-eslint/consistent-type-imports rule * Re-lint after merge --- package.json | 2 +- spec/TestClient.ts | 13 +- spec/integ/crypto/cross-signing.spec.ts | 8 +- spec/integ/crypto/crypto.spec.ts | 34 +- spec/integ/crypto/device-dehydration.spec.ts | 6 +- spec/integ/crypto/megolm-backup.spec.ts | 20 +- spec/integ/crypto/olm-encryption-spec.ts | 16 +- spec/integ/crypto/olm-utils.ts | 16 +- spec/integ/crypto/to-device-messages.spec.ts | 4 +- spec/integ/crypto/verification.spec.ts | 24 +- .../integ/matrix-client-event-emitter.spec.ts | 7 +- .../matrix-client-event-timeline.spec.ts | 6 +- spec/integ/matrix-client-methods.spec.ts | 18 +- spec/integ/matrix-client-opts.spec.ts | 2 +- spec/integ/matrix-client-relations.spec.ts | 5 +- spec/integ/matrix-client-retrying.spec.ts | 5 +- .../integ/matrix-client-room-timeline.spec.ts | 15 +- .../matrix-client-syncing-errors.spec.ts | 2 +- spec/integ/matrix-client-syncing.spec.ts | 19 +- ...matrix-client-unread-notifications.spec.ts | 7 +- .../rendezvous/MSC4108SignInWithQR.spec.ts | 6 +- spec/integ/sliding-sync-sdk.spec.ts | 30 +- spec/integ/sliding-sync.spec.ts | 13 +- spec/test-utils/AccountDataAccumulator.ts | 2 +- spec/test-utils/E2EKeyReceiver.ts | 2 +- spec/test-utils/E2EKeyResponder.ts | 6 +- spec/test-utils/SyncResponder.ts | 5 +- spec/test-utils/beacon.ts | 2 +- spec/test-utils/client.ts | 4 +- spec/test-utils/mockEndpoints.ts | 2 +- spec/test-utils/test-data/index.ts | 6 +- spec/test-utils/test-utils.ts | 24 +- .../empty_account/index.ts | 2 +- .../full_account/index.ts | 2 +- .../no_cached_msk_dump/index.ts | 4 +- .../unverified/index.ts | 2 +- spec/test-utils/thread.ts | 8 +- spec/test-utils/webrtc.ts | 36 +- spec/unit/ToDeviceMessageQueue.spec.ts | 4 +- spec/unit/crypto.spec.ts | 10 +- spec/unit/crypto/DeviceList.spec.ts | 6 +- spec/unit/crypto/algorithms/megolm.spec.ts | 8 +- spec/unit/crypto/algorithms/olm.spec.ts | 4 +- spec/unit/crypto/backup.spec.ts | 8 +- spec/unit/crypto/cross-signing.spec.ts | 10 +- spec/unit/crypto/crypto-utils.ts | 6 +- .../crypto/outgoing-room-key-requests.spec.ts | 2 +- spec/unit/crypto/secrets.spec.ts | 14 +- spec/unit/crypto/store/CryptoStore.spec.ts | 2 +- .../crypto/verification/InRoomChannel.spec.ts | 2 +- spec/unit/crypto/verification/sas.spec.ts | 14 +- .../verification/secret_request.spec.ts | 6 +- spec/unit/crypto/verification/util.ts | 11 +- .../verification/verification_request.spec.ts | 6 +- spec/unit/embedded.spec.ts | 18 +- spec/unit/event-mapper.spec.ts | 4 +- spec/unit/event-timeline.spec.ts | 2 +- .../ExtensibleEvent.spec.ts | 2 +- .../extensible_events_v1/MessageEvent.spec.ts | 4 +- .../extensible_events_v1/PollEndEvent.spec.ts | 4 +- .../PollResponseEvent.spec.ts | 4 +- .../PollStartEvent.spec.ts | 6 +- spec/unit/filter.spec.ts | 2 +- spec/unit/http-api/fetch.spec.ts | 10 +- spec/unit/http-api/index.spec.ts | 2 +- spec/unit/interactive-auth.spec.ts | 2 +- spec/unit/local_notifications.spec.ts | 4 +- spec/unit/location.spec.ts | 2 +- spec/unit/matrix-client.spec.ts | 32 +- spec/unit/matrixrtc/CallMembership.spec.ts | 8 +- spec/unit/matrixrtc/MatrixRTCSession.spec.ts | 6 +- .../matrixrtc/MatrixRTCSessionManager.spec.ts | 6 +- spec/unit/matrixrtc/mocks.ts | 4 +- spec/unit/models/MSC3089Branch.spec.ts | 10 +- spec/unit/models/MSC3089TreeSpace.spec.ts | 6 +- spec/unit/models/event.spec.ts | 8 +- spec/unit/models/poll.spec.ts | 2 +- spec/unit/models/room-receipts.spec.ts | 9 +- spec/unit/notifications.spec.ts | 4 +- spec/unit/oidc/register.spec.ts | 2 +- spec/unit/oidc/validate.spec.ts | 2 +- spec/unit/pushprocessor.spec.ts | 10 +- spec/unit/queueToDevice.spec.ts | 6 +- spec/unit/read-receipt.spec.ts | 4 +- spec/unit/rendezvous/DummyTransport.ts | 8 +- .../MSC4108RendezvousSession.spec.ts | 2 +- .../channels/MSC4108SecureChannel.spec.ts | 2 +- spec/unit/room-member.spec.ts | 4 +- spec/unit/room-state.spec.ts | 6 +- spec/unit/room.spec.ts | 22 +- .../rust-crypto/CrossSigningIdentity.spec.ts | 6 +- spec/unit/rust-crypto/KeyClaimManager.spec.ts | 6 +- .../OutgoingRequestProcessor.spec.ts | 10 +- .../OutgoingRequestsManager.spec.ts | 6 +- .../PerSessionKeyBackupDownloader.spec.ts | 24 +- spec/unit/rust-crypto/RoomEncryptor.spec.ts | 22 +- spec/unit/rust-crypto/backup.spec.ts | 10 +- .../unit/rust-crypto/device-converter.spec.ts | 2 +- spec/unit/rust-crypto/rust-crypto.spec.ts | 52 +-- spec/unit/rust-crypto/secret-storage.spec.ts | 4 +- spec/unit/rust-crypto/verification.spec.ts | 10 +- spec/unit/scheduler.spec.ts | 4 +- spec/unit/secret-storage.spec.ts | 20 +- .../stores/indexeddb-store-worker.spec.ts | 2 +- spec/unit/stores/indexeddb.spec.ts | 4 +- spec/unit/sync-accumulator.spec.ts | 24 +- spec/unit/thread-utils.spec.ts | 2 +- spec/unit/timeline-window.spec.ts | 6 +- spec/unit/webrtc/call.spec.ts | 8 +- spec/unit/webrtc/callEventHandler.spec.ts | 8 +- spec/unit/webrtc/groupCall.spec.ts | 16 +- .../unit/webrtc/groupCallEventHandler.spec.ts | 8 +- spec/unit/webrtc/mediaHandler.spec.ts | 2 +- .../stats/callFeedStatsReporter.spec.ts | 4 +- .../stats/callStatsReportGatherer.spec.ts | 2 +- .../connectionStatsReportBuilder.spec.ts | 2 +- spec/unit/webrtc/stats/groupCallStats.spec.ts | 2 +- .../stats/media/mediaSsrcHandler.spec.ts | 2 +- .../media/mediaTrackStatsHandler.spec.ts | 4 +- .../webrtc/stats/statsReportEmitter.spec.ts | 8 +- .../stats/transportStatsBuilder.spec.ts | 2 +- src/@types/auth.ts | 2 +- src/@types/beacon.ts | 4 +- src/@types/event.ts | 78 ++--- src/@types/events.ts | 6 +- src/@types/extensible_events.ts | 2 +- src/@types/location.ts | 4 +- src/@types/media.ts | 2 +- src/@types/polls.ts | 12 +- src/@types/registration.ts | 2 +- src/@types/requests.ts | 16 +- src/@types/search.ts | 6 +- src/@types/spaces.ts | 6 +- src/@types/state_events.ts | 8 +- src/@types/synapse.ts | 2 +- src/@types/topic.ts | 2 +- src/@types/uia.ts | 2 +- src/NamespacedValue.ts | 2 +- src/ReEmitter.ts | 4 +- src/ToDeviceMessageQueue.ts | 12 +- src/autodiscovery.ts | 4 +- src/client.ts | 319 ++++++++++-------- src/common-crypto/CryptoBackend.ts | 14 +- src/content-helpers.ts | 16 +- src/crypto-api/CryptoEventHandlerMap.ts | 10 +- src/crypto-api/index.ts | 24 +- src/crypto-api/keybackup.ts | 6 +- src/crypto-api/verification.ts | 4 +- src/crypto/CrossSigning.ts | 18 +- src/crypto/DeviceList.ts | 14 +- src/crypto/EncryptionSetup.ts | 22 +- src/crypto/OlmDevice.ts | 18 +- src/crypto/OutgoingRoomKeyRequestManager.ts | 8 +- src/crypto/RoomList.ts | 2 +- src/crypto/SecretSharing.ts | 8 +- src/crypto/SecretStorage.ts | 22 +- src/crypto/algorithms/base.ts | 21 +- src/crypto/algorithms/megolm.ts | 24 +- src/crypto/algorithms/olm.ts | 8 +- src/crypto/api.ts | 2 +- src/crypto/backup.ts | 22 +- src/crypto/dehydration.ts | 4 +- src/crypto/device-converter.ts | 2 +- src/crypto/deviceinfo.ts | 2 +- src/crypto/index.ts | 106 +++--- src/crypto/keybackup.ts | 2 +- src/crypto/olmlib.ts | 14 +- src/crypto/store/base.ts | 26 +- .../store/indexeddb-crypto-store-backend.ts | 34 +- src/crypto/store/indexeddb-crypto-store.ts | 34 +- src/crypto/store/localStorage-crypto-store.ts | 26 +- src/crypto/store/memory-crypto-store.ts | 32 +- src/crypto/verification/Base.ts | 16 +- src/crypto/verification/IllegalMethod.ts | 10 +- src/crypto/verification/QRCode.ts | 10 +- src/crypto/verification/SAS.ts | 11 +- src/crypto/verification/request/Channel.ts | 4 +- .../verification/request/InRoomChannel.ts | 10 +- .../verification/request/ToDeviceChannel.ts | 6 +- .../request/VerificationRequest.ts | 16 +- src/embedded.ts | 50 +-- src/event-mapper.ts | 4 +- src/extensible_events_v1/ExtensibleEvent.ts | 2 +- src/extensible_events_v1/MessageEvent.ts | 10 +- src/extensible_events_v1/PollEndEvent.ts | 6 +- src/extensible_events_v1/PollResponseEvent.ts | 8 +- src/extensible_events_v1/PollStartEvent.ts | 10 +- src/extensible_events_v1/utilities.ts | 2 +- src/feature.ts | 2 +- src/filter-component.ts | 4 +- src/filter.ts | 6 +- src/http-api/errors.ts | 6 +- src/http-api/fetch.ts | 14 +- src/http-api/index.ts | 11 +- src/http-api/interface.ts | 4 +- src/http-api/utils.ts | 2 +- src/interactive-auth.ts | 8 +- src/matrix.ts | 8 +- src/matrixrtc/CallMembership.ts | 4 +- src/matrixrtc/EncryptionManager.ts | 12 +- src/matrixrtc/LivekitFocus.ts | 2 +- src/matrixrtc/MatrixRTCSession.ts | 12 +- src/matrixrtc/MatrixRTCSessionManager.ts | 8 +- src/matrixrtc/MembershipManager.ts | 10 +- src/matrixrtc/types.ts | 2 +- src/models/MSC3089Branch.ts | 10 +- src/models/MSC3089TreeSpace.ts | 14 +- src/models/beacon.ts | 8 +- src/models/compare-event-ordering.ts | 4 +- src/models/event-context.ts | 2 +- src/models/event-timeline-set.ts | 14 +- src/models/event-timeline.ts | 8 +- src/models/event.ts | 30 +- src/models/invites-ignorer.ts | 8 +- src/models/poll.ts | 8 +- src/models/read-receipt.ts | 12 +- src/models/related-relations.ts | 6 +- src/models/relations-container.ts | 10 +- src/models/relations.ts | 6 +- src/models/room-member.ts | 8 +- src/models/room-receipts.ts | 6 +- src/models/room-state.ts | 14 +- src/models/room.ts | 40 ++- src/models/search-result.ts | 4 +- src/models/thread.ts | 14 +- src/models/user.ts | 4 +- src/oidc/authorize.ts | 8 +- src/oidc/discovery.ts | 2 +- src/oidc/index.ts | 2 +- src/oidc/register.ts | 4 +- src/oidc/tokenRefresher.ts | 4 +- src/oidc/validate.ts | 2 +- src/pushprocessor.ts | 32 +- src/receipt-accumulator.ts | 6 +- src/rendezvous/MSC4108SignInWithQR.ts | 10 +- src/rendezvous/RendezvousChannel.ts | 2 +- src/rendezvous/RendezvousCode.ts | 2 +- src/rendezvous/RendezvousError.ts | 2 +- src/rendezvous/RendezvousTransport.ts | 2 +- .../channels/MSC4108SecureChannel.ts | 10 +- .../transports/MSC4108RendezvousSession.ts | 4 +- src/room-hierarchy.ts | 8 +- src/rust-crypto/CrossSigningIdentity.ts | 16 +- src/rust-crypto/DehydratedDeviceManager.ts | 12 +- src/rust-crypto/KeyClaimManager.ts | 6 +- src/rust-crypto/OutgoingRequestProcessor.ts | 10 +- src/rust-crypto/OutgoingRequestsManager.ts | 8 +- .../PerSessionKeyBackupDownloader.ts | 14 +- src/rust-crypto/RoomEncryptor.ts | 18 +- src/rust-crypto/backup.ts | 32 +- src/rust-crypto/device-converter.ts | 2 +- src/rust-crypto/index.ts | 10 +- src/rust-crypto/libolm_migration.ts | 14 +- src/rust-crypto/rust-crypto.ts | 68 ++-- src/rust-crypto/secret-storage.ts | 2 +- src/rust-crypto/verification.ts | 20 +- src/scheduler.ts | 8 +- src/secret-storage.ts | 12 +- src/serverCapabilities.ts | 2 +- src/sliding-sync-sdk.ts | 28 +- src/sliding-sync.ts | 8 +- src/store/index.ts | 22 +- src/store/indexeddb-backend.ts | 6 +- src/store/indexeddb-local-backend.ts | 10 +- src/store/indexeddb-remote-backend.ts | 12 +- src/store/indexeddb.ts | 18 +- src/store/memory.ts | 26 +- src/store/stub.ts | 22 +- src/sync-accumulator.ts | 6 +- src/sync.ts | 52 +-- src/testing.ts | 10 +- src/thread-utils.ts | 2 +- src/timeline-window.ts | 12 +- src/utils.ts | 6 +- src/utils/decryptAESSecretStorageItem.ts | 2 +- src/utils/encryptAESSecretStorageItem.ts | 2 +- src/webrtc/call.ts | 34 +- src/webrtc/callEventHandler.ts | 10 +- src/webrtc/callEventTypes.ts | 2 +- src/webrtc/callFeed.ts | 6 +- src/webrtc/groupCall.ts | 22 +- src/webrtc/groupCallEventHandler.ts | 12 +- src/webrtc/mediaHandler.ts | 2 +- src/webrtc/stats/callFeedStatsReporter.ts | 4 +- src/webrtc/stats/callStatsReportGatherer.ts | 6 +- src/webrtc/stats/connectionStats.ts | 4 +- src/webrtc/stats/connectionStatsBuilder.ts | 2 +- .../stats/connectionStatsReportBuilder.ts | 14 +- src/webrtc/stats/groupCallStats.ts | 2 +- src/webrtc/stats/media/mediaTrackStats.ts | 4 +- .../stats/media/mediaTrackStatsHandler.ts | 6 +- src/webrtc/stats/statsReport.ts | 6 +- src/webrtc/stats/statsReportEmitter.ts | 8 +- .../stats/summaryStatsReportGatherer.ts | 10 +- src/webrtc/stats/trackStatsBuilder.ts | 4 +- src/webrtc/stats/transportStatsBuilder.ts | 2 +- yarn.lock | 8 +- 297 files changed, 1762 insertions(+), 1573 deletions(-) diff --git a/package.json b/package.json index c64dc136a..c189446b5 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,7 @@ "eslint-plugin-import": "^2.26.0", "eslint-plugin-jest": "^28.0.0", "eslint-plugin-jsdoc": "^50.0.0", - "eslint-plugin-matrix-org": "^2.0.1", + "eslint-plugin-matrix-org": "^2.1.0", "eslint-plugin-n": "^14.0.0", "eslint-plugin-tsdoc": "^0.4.0", "eslint-plugin-unicorn": "^56.0.0", diff --git a/spec/TestClient.ts b/spec/TestClient.ts index 66c63064e..1d242a027 100644 --- a/spec/TestClient.ts +++ b/spec/TestClient.ts @@ -29,11 +29,16 @@ import type { IE2EKeyReceiver } from "./test-utils/E2EKeyReceiver"; import { LocalStorageCryptoStore } from "../src/crypto/store/localStorage-crypto-store"; import { logger } from "../src/logger"; import { syncPromise } from "./test-utils/test-utils"; -import { createClient, IStartClientOpts } from "../src/matrix"; -import { ICreateClientOpts, IDownloadKeyResult, MatrixClient, PendingEventOrdering } from "../src/client"; +import { createClient, type IStartClientOpts } from "../src/matrix"; +import { + type ICreateClientOpts, + type IDownloadKeyResult, + type MatrixClient, + PendingEventOrdering, +} from "../src/client"; import { MockStorageApi } from "./MockStorageApi"; -import { IKeysUploadResponse, IUploadKeysRequest } from "../src/client"; -import { ISyncResponder } from "./test-utils/SyncResponder"; +import { type IKeysUploadResponse, type IUploadKeysRequest } from "../src/client"; +import { type ISyncResponder } from "./test-utils/SyncResponder"; /** * Wrapper for a MockStorageApi, MockHttpBackend and MatrixClient diff --git a/spec/integ/crypto/cross-signing.spec.ts b/spec/integ/crypto/cross-signing.spec.ts index 95b0f756e..8797f6a3a 100644 --- a/spec/integ/crypto/cross-signing.spec.ts +++ b/spec/integ/crypto/cross-signing.spec.ts @@ -18,13 +18,13 @@ import fetchMock from "fetch-mock-jest"; import "fake-indexeddb/auto"; import { IDBFactory } from "fake-indexeddb"; -import { CRYPTO_BACKENDS, InitCrypto, syncPromise } from "../../test-utils/test-utils"; -import { AuthDict, createClient, CryptoEvent, MatrixClient } from "../../../src"; +import { CRYPTO_BACKENDS, type InitCrypto, syncPromise } from "../../test-utils/test-utils"; +import { type AuthDict, createClient, CryptoEvent, type MatrixClient } from "../../../src"; import { mockInitialApiRequests, mockSetupCrossSigningRequests } from "../../test-utils/mockEndpoints"; import encryptAESSecretStorageItem from "../../../src/utils/encryptAESSecretStorageItem.ts"; -import { CryptoCallbacks, CrossSigningKey } from "../../../src/crypto-api"; +import { type CryptoCallbacks, CrossSigningKey } from "../../../src/crypto-api"; import { SECRET_STORAGE_ALGORITHM_V1_AES } from "../../../src/secret-storage"; -import { ISyncResponder, SyncResponder } from "../../test-utils/SyncResponder"; +import { type ISyncResponder, SyncResponder } from "../../test-utils/SyncResponder"; import { E2EKeyReceiver } from "../../test-utils/E2EKeyReceiver"; import { MASTER_CROSS_SIGNING_PRIVATE_KEY_BASE64, diff --git a/spec/integ/crypto/crypto.spec.ts b/spec/integ/crypto/crypto.spec.ts index d3f5e20f7..102bb2b16 100644 --- a/spec/integ/crypto/crypto.spec.ts +++ b/spec/integ/crypto/crypto.spec.ts @@ -19,16 +19,16 @@ import anotherjson from "another-json"; import fetchMock from "fetch-mock-jest"; import "fake-indexeddb/auto"; import { IDBFactory } from "fake-indexeddb"; -import FetchMock from "fetch-mock"; -import Olm from "@matrix-org/olm"; +import type FetchMock from "fetch-mock"; +import type Olm from "@matrix-org/olm"; import * as testUtils from "../../test-utils/test-utils"; import { advanceTimersUntil, CRYPTO_BACKENDS, emitPromise, getSyncResponse, - InitCrypto, + type InitCrypto, mkEventCustom, mkMembershipCustom, syncPromise, @@ -52,24 +52,24 @@ import { createClient, CryptoEvent, HistoryVisibility, - IClaimOTKsResult, - IContent, - IDownloadKeyResult, - IEvent, + type IClaimOTKsResult, + type IContent, + type IDownloadKeyResult, + type IEvent, IndexedDBCryptoStore, - IStartClientOpts, - MatrixClient, + type IStartClientOpts, + type MatrixClient, MatrixEvent, MatrixEventEvent, MsgType, PendingEventOrdering, Room, - RoomMember, + type RoomMember, RoomStateEvent, } from "../../../src/matrix"; import { DeviceInfo } from "../../../src/crypto/deviceinfo"; import { E2EKeyReceiver } from "../../test-utils/E2EKeyReceiver"; -import { ISyncResponder, SyncResponder } from "../../test-utils/SyncResponder"; +import { type ISyncResponder, SyncResponder } from "../../test-utils/SyncResponder"; import { defer, escapeRegExp } from "../../../src/utils"; import { downloadDeviceToJsDevice } from "../../../src/rust-crypto/device-converter"; import { flushPromises } from "../../test-utils/flushPromises"; @@ -78,15 +78,15 @@ import { mockSetupCrossSigningRequests, mockSetupMegolmBackupRequests, } from "../../test-utils/mockEndpoints"; -import { SecretStorageKeyDescription } from "../../../src/secret-storage"; +import { type SecretStorageKeyDescription } from "../../../src/secret-storage"; import { CrossSigningKey, - CryptoCallbacks, + type CryptoCallbacks, DecryptionFailureCode, - DeviceIsolationMode, + type DeviceIsolationMode, EventShieldColour, EventShieldReason, - KeyBackupInfo, + type KeyBackupInfo, AllDevicesIsolationMode, OnlySignedDevicesIsolationMode, } from "../../../src/crypto-api"; @@ -101,11 +101,11 @@ import { establishOlmSession, getTestOlmAccountKeys, } from "./olm-utils"; -import { ToDevicePayload } from "../../../src/models/ToDeviceMessage"; +import { type ToDevicePayload } from "../../../src/models/ToDeviceMessage"; import { AccountDataAccumulator } from "../../test-utils/AccountDataAccumulator"; import { UNSIGNED_MEMBERSHIP_FIELD } from "../../../src/@types/event"; import { KnownMembership } from "../../../src/@types/membership"; -import { KeyBackup } from "../../../src/rust-crypto/backup.ts"; +import { type KeyBackup } from "../../../src/rust-crypto/backup.ts"; afterEach(() => { // reset fake-indexeddb after each test, to make sure we don't leak connections diff --git a/spec/integ/crypto/device-dehydration.spec.ts b/spec/integ/crypto/device-dehydration.spec.ts index 4bb82bcf5..4236ae297 100644 --- a/spec/integ/crypto/device-dehydration.spec.ts +++ b/spec/integ/crypto/device-dehydration.spec.ts @@ -17,10 +17,10 @@ limitations under the License. import "fake-indexeddb/auto"; import fetchMock from "fetch-mock-jest"; -import { ClientEvent, createClient, MatrixClient, MatrixEvent } from "../../../src"; +import { ClientEvent, createClient, type MatrixClient, MatrixEvent } from "../../../src"; import { CryptoEvent } from "../../../src/crypto-api/index"; -import { RustCrypto } from "../../../src/rust-crypto/rust-crypto"; -import { AddSecretStorageKeyOpts } from "../../../src/secret-storage"; +import { type RustCrypto } from "../../../src/rust-crypto/rust-crypto"; +import { type AddSecretStorageKeyOpts } from "../../../src/secret-storage"; import { E2EKeyReceiver } from "../../test-utils/E2EKeyReceiver"; import { E2EKeyResponder } from "../../test-utils/E2EKeyResponder"; import { emitPromise, EventCounter } from "../../test-utils/test-utils"; diff --git a/spec/integ/crypto/megolm-backup.spec.ts b/spec/integ/crypto/megolm-backup.spec.ts index eff0ff567..b209cb291 100644 --- a/spec/integ/crypto/megolm-backup.spec.ts +++ b/spec/integ/crypto/megolm-backup.spec.ts @@ -17,16 +17,16 @@ limitations under the License. import fetchMock from "fetch-mock-jest"; import "fake-indexeddb/auto"; import { IDBFactory } from "fake-indexeddb"; -import { Mocked } from "jest-mock"; +import { type Mocked } from "jest-mock"; import { createClient, - Crypto, + type Crypto, encodeBase64, - ICreateClientOpts, - IEvent, - IMegolmSessionData, - MatrixClient, + type ICreateClientOpts, + type IEvent, + type IMegolmSessionData, + type MatrixClient, TypedEventEmitter, } from "../../../src"; import { SyncResponder } from "../../test-utils/SyncResponder"; @@ -37,15 +37,15 @@ import { advanceTimersUntil, awaitDecryption, CRYPTO_BACKENDS, - InitCrypto, + type InitCrypto, syncPromise, } from "../../test-utils/test-utils"; import * as testData from "../../test-utils/test-data"; -import { KeyBackupInfo, KeyBackupSession } from "../../../src/crypto-api/keybackup"; +import { type KeyBackupInfo, type KeyBackupSession } from "../../../src/crypto-api/keybackup"; import { flushPromises } from "../../test-utils/flushPromises"; -import { defer, IDeferred } from "../../../src/utils"; +import { defer, type IDeferred } from "../../../src/utils"; import { decodeRecoveryKey, DecryptionFailureCode, CryptoEvent } from "../../../src/crypto-api"; -import { KeyBackup } from "../../../src/rust-crypto/backup.ts"; +import { type KeyBackup } from "../../../src/rust-crypto/backup.ts"; const ROOM_ID = testData.TEST_ROOM_ID; diff --git a/spec/integ/crypto/olm-encryption-spec.ts b/spec/integ/crypto/olm-encryption-spec.ts index 5b98c6393..419a19e1c 100644 --- a/spec/integ/crypto/olm-encryption-spec.ts +++ b/spec/integ/crypto/olm-encryption-spec.ts @@ -33,8 +33,20 @@ import type { IDeviceKeys, IOneTimeKey } from "../../../src/@types/crypto"; import { logger } from "../../../src/logger"; import * as testUtils from "../../test-utils/test-utils"; import { TestClient } from "../../TestClient"; -import { CRYPTO_ENABLED, IClaimKeysRequest, IQueryKeysRequest, IUploadKeysRequest } from "../../../src/client"; -import { ClientEvent, IContent, ISendEventResponse, MatrixClient, MatrixEvent, MsgType } from "../../../src/matrix"; +import { + CRYPTO_ENABLED, + type IClaimKeysRequest, + type IQueryKeysRequest, + type IUploadKeysRequest, +} from "../../../src/client"; +import { + ClientEvent, + type IContent, + type ISendEventResponse, + type MatrixClient, + MatrixEvent, + MsgType, +} from "../../../src/matrix"; import { DeviceInfo } from "../../../src/crypto/deviceinfo"; import { KnownMembership } from "../../../src/@types/membership"; diff --git a/spec/integ/crypto/olm-utils.ts b/spec/integ/crypto/olm-utils.ts index a257ea7c9..6052e81ac 100644 --- a/spec/integ/crypto/olm-utils.ts +++ b/spec/integ/crypto/olm-utils.ts @@ -17,11 +17,19 @@ limitations under the License. import Olm from "@matrix-org/olm"; import anotherjson from "another-json"; -import { IContent, IDeviceKeys, IDownloadKeyResult, IEvent, Keys, MatrixClient, SigningKeys } from "../../../src"; -import { IE2EKeyReceiver } from "../../test-utils/E2EKeyReceiver"; -import { ISyncResponder } from "../../test-utils/SyncResponder"; +import { + type IContent, + type IDeviceKeys, + type IDownloadKeyResult, + type IEvent, + type Keys, + type MatrixClient, + type SigningKeys, +} from "../../../src"; +import { type IE2EKeyReceiver } from "../../test-utils/E2EKeyReceiver"; +import { type ISyncResponder } from "../../test-utils/SyncResponder"; import { syncPromise } from "../../test-utils/test-utils"; -import { KeyBackupInfo } from "../../../src/crypto-api"; +import { type KeyBackupInfo } from "../../../src/crypto-api"; /** * @module diff --git a/spec/integ/crypto/to-device-messages.spec.ts b/spec/integ/crypto/to-device-messages.spec.ts index ee15266ce..3801e934f 100644 --- a/spec/integ/crypto/to-device-messages.spec.ts +++ b/spec/integ/crypto/to-device-messages.spec.ts @@ -18,8 +18,8 @@ import fetchMock from "fetch-mock-jest"; import "fake-indexeddb/auto"; import { IDBFactory } from "fake-indexeddb"; -import { CRYPTO_BACKENDS, getSyncResponse, InitCrypto, syncPromise } from "../../test-utils/test-utils"; -import { createClient, MatrixClient } from "../../../src"; +import { CRYPTO_BACKENDS, getSyncResponse, type InitCrypto, syncPromise } from "../../test-utils/test-utils"; +import { createClient, type MatrixClient } from "../../../src"; import * as testData from "../../test-utils/test-data"; import { E2EKeyResponder } from "../../test-utils/E2EKeyResponder"; import { SyncResponder } from "../../test-utils/SyncResponder"; diff --git a/spec/integ/crypto/verification.spec.ts b/spec/integ/crypto/verification.spec.ts index a4cee9e83..b2c001938 100644 --- a/spec/integ/crypto/verification.spec.ts +++ b/spec/integ/crypto/verification.spec.ts @@ -17,31 +17,31 @@ limitations under the License. import "fake-indexeddb/auto"; import anotherjson from "another-json"; -import FetchMock from "fetch-mock"; import fetchMock from "fetch-mock-jest"; import { IDBFactory } from "fake-indexeddb"; import { createHash } from "crypto"; import Olm from "@matrix-org/olm"; +import type FetchMock from "fetch-mock"; import { createClient, CryptoEvent, DeviceVerification, - IContent, - ICreateClientOpts, - IEvent, - MatrixClient, + type IContent, + type ICreateClientOpts, + type IEvent, + type MatrixClient, MatrixEvent, MatrixEventEvent, } from "../../../src"; import { canAcceptVerificationRequest, - ShowQrCodeCallbacks, - ShowSasCallbacks, + type ShowQrCodeCallbacks, + type ShowSasCallbacks, VerificationPhase, - VerificationRequest, + type VerificationRequest, VerificationRequestEvent, - Verifier, + type Verifier, VerifierEvent, } from "../../../src/crypto-api/verification"; import { defer, escapeRegExp } from "../../../src/utils"; @@ -50,7 +50,7 @@ import { CRYPTO_BACKENDS, emitPromise, getSyncResponse, - InitCrypto, + type InitCrypto, syncPromise, } from "../../test-utils/test-utils"; import { SyncResponder } from "../../test-utils/SyncResponder"; @@ -79,9 +79,9 @@ import { encryptMegolmEvent, encryptSecretSend, getTestOlmAccountKeys, - ToDeviceEvent, + type ToDeviceEvent, } from "./olm-utils"; -import { KeyBackupInfo } from "../../../src/crypto-api"; +import { type KeyBackupInfo } from "../../../src/crypto-api"; import { encodeBase64 } from "../../../src/base64"; // The verification flows use javascript timers to set timeouts. We tell jest to use mock timer implementations diff --git a/spec/integ/matrix-client-event-emitter.spec.ts b/spec/integ/matrix-client-event-emitter.spec.ts index 07a723346..3b07d1e73 100644 --- a/spec/integ/matrix-client-event-emitter.spec.ts +++ b/spec/integ/matrix-client-event-emitter.spec.ts @@ -14,13 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -import HttpBackend from "matrix-mock-request"; - +import type HttpBackend from "matrix-mock-request"; import { ClientEvent, HttpApiEvent, - IEvent, - MatrixClient, + type IEvent, + type MatrixClient, RoomEvent, RoomMemberEvent, RoomStateEvent, diff --git a/spec/integ/matrix-client-event-timeline.spec.ts b/spec/integ/matrix-client-event-timeline.spec.ts index f7e3662cd..972e87517 100644 --- a/spec/integ/matrix-client-event-timeline.spec.ts +++ b/spec/integ/matrix-client-event-timeline.spec.ts @@ -23,15 +23,15 @@ import { EventTimelineSet, EventType, Filter, - IEvent, - MatrixClient, + type IEvent, + type MatrixClient, MatrixEvent, PendingEventOrdering, RelationType, Room, } from "../../src/matrix"; import { logger } from "../../src/logger"; -import { encodeParams, encodeUri, QueryDict, replaceParam } from "../../src/utils"; +import { encodeParams, encodeUri, type QueryDict, replaceParam } from "../../src/utils"; import { TestClient } from "../TestClient"; import { FeatureSupport, Thread, ThreadEvent } from "../../src/models/thread"; import { emitPromise } from "../test-utils/test-utils"; diff --git a/spec/integ/matrix-client-methods.spec.ts b/spec/integ/matrix-client-methods.spec.ts index e058426cb..abd55185a 100644 --- a/spec/integ/matrix-client-methods.spec.ts +++ b/spec/integ/matrix-client-methods.spec.ts @@ -13,28 +13,28 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -import HttpBackend from "matrix-mock-request"; -import { Mocked } from "jest-mock"; +import { type Mocked } from "jest-mock"; +import type HttpBackend from "matrix-mock-request"; import * as utils from "../test-utils/test-utils"; -import { CRYPTO_ENABLED, IStoredClientOpts, MatrixClient } from "../../src/client"; +import { CRYPTO_ENABLED, type IStoredClientOpts, MatrixClient } from "../../src/client"; import { MatrixEvent } from "../../src/models/event"; import { Filter, JoinRule, - KnockRoomOpts, + type KnockRoomOpts, MemoryStore, Method, Room, - RoomSummary, + type RoomSummary, SERVICE_TYPES, } from "../../src/matrix"; import { TestClient } from "../TestClient"; import { THREAD_RELATION_TYPE } from "../../src/models/thread"; -import { IFilterDefinition } from "../../src/filter"; -import { ISearchResults } from "../../src/@types/search"; -import { IStore } from "../../src/store"; -import { CryptoBackend } from "../../src/common-crypto/CryptoBackend"; +import { type IFilterDefinition } from "../../src/filter"; +import { type ISearchResults } from "../../src/@types/search"; +import { type IStore } from "../../src/store"; +import { type CryptoBackend } from "../../src/common-crypto/CryptoBackend"; import { SetPresence } from "../../src/sync"; import { KnownMembership } from "../../src/@types/membership"; diff --git a/spec/integ/matrix-client-opts.spec.ts b/spec/integ/matrix-client-opts.spec.ts index cb5b1b906..6d8d19811 100644 --- a/spec/integ/matrix-client-opts.spec.ts +++ b/spec/integ/matrix-client-opts.spec.ts @@ -5,7 +5,7 @@ import { ClientEvent, MatrixClient } from "../../src/matrix"; import { MatrixScheduler } from "../../src/scheduler"; import { MemoryStore } from "../../src/store/memory"; import { MatrixError } from "../../src/http-api"; -import { IStore } from "../../src/store"; +import { type IStore } from "../../src/store"; import { KnownMembership } from "../../src/@types/membership"; describe("MatrixClient opts", function () { diff --git a/spec/integ/matrix-client-relations.spec.ts b/spec/integ/matrix-client-relations.spec.ts index 1a7f370c2..084a0d9cf 100644 --- a/spec/integ/matrix-client-relations.spec.ts +++ b/spec/integ/matrix-client-relations.spec.ts @@ -15,9 +15,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import HttpBackend from "matrix-mock-request"; - -import { Direction, MatrixClient, MatrixScheduler } from "../../src/matrix"; +import type HttpBackend from "matrix-mock-request"; +import { Direction, type MatrixClient, MatrixScheduler } from "../../src/matrix"; import { TestClient } from "../TestClient"; describe("MatrixClient relations", () => { diff --git a/spec/integ/matrix-client-retrying.spec.ts b/spec/integ/matrix-client-retrying.spec.ts index b78e3c7b4..5a66a6e66 100644 --- a/spec/integ/matrix-client-retrying.spec.ts +++ b/spec/integ/matrix-client-retrying.spec.ts @@ -14,9 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import HttpBackend from "matrix-mock-request"; - -import { EventStatus, MatrixClient, MatrixScheduler, MsgType, RoomEvent } from "../../src/matrix"; +import type HttpBackend from "matrix-mock-request"; +import { EventStatus, type MatrixClient, MatrixScheduler, MsgType, RoomEvent } from "../../src/matrix"; import { Room } from "../../src/models/room"; import { TestClient } from "../TestClient"; diff --git a/spec/integ/matrix-client-room-timeline.spec.ts b/spec/integ/matrix-client-room-timeline.spec.ts index 1d0ed86e0..a3f059bbd 100644 --- a/spec/integ/matrix-client-room-timeline.spec.ts +++ b/spec/integ/matrix-client-room-timeline.spec.ts @@ -14,20 +14,19 @@ See the License for the specific language governing permissions and limitations under the License. */ -import HttpBackend from "matrix-mock-request"; - +import type HttpBackend from "matrix-mock-request"; import * as utils from "../test-utils/test-utils"; import { EventStatus } from "../../src/models/event"; import { MatrixError, ClientEvent, - IEvent, - MatrixClient, + type IEvent, + type MatrixClient, RoomEvent, - ISyncResponse, - IMinimalEvent, - IRoomEvent, - Room, + type ISyncResponse, + type IMinimalEvent, + type IRoomEvent, + type Room, } from "../../src"; import { TestClient } from "../TestClient"; import { KnownMembership } from "../../src/@types/membership"; diff --git a/spec/integ/matrix-client-syncing-errors.spec.ts b/spec/integ/matrix-client-syncing-errors.spec.ts index 4133ffb9a..fb481b0f2 100644 --- a/spec/integ/matrix-client-syncing-errors.spec.ts +++ b/spec/integ/matrix-client-syncing-errors.spec.ts @@ -17,7 +17,7 @@ limitations under the License. import "fake-indexeddb/auto"; import fetchMock from "fetch-mock-jest"; -import { MatrixClient, ClientEvent, createClient, SyncState } from "../../src"; +import { type MatrixClient, ClientEvent, createClient, SyncState } from "../../src"; const makeQueryablePromise = (promise: Promise) => { let resolved = false; diff --git a/spec/integ/matrix-client-syncing.spec.ts b/spec/integ/matrix-client-syncing.spec.ts index 59d29b82b..78738b46a 100644 --- a/spec/integ/matrix-client-syncing.spec.ts +++ b/spec/integ/matrix-client-syncing.spec.ts @@ -16,8 +16,7 @@ limitations under the License. import "fake-indexeddb/auto"; -import HttpBackend from "matrix-mock-request"; - +import type HttpBackend from "matrix-mock-request"; import { EventTimeline, MatrixEvent, @@ -25,16 +24,16 @@ import { RoomStateEvent, RoomMemberEvent, UNSTABLE_MSC2716_MARKER, - MatrixClient, + type MatrixClient, ClientEvent, IndexedDBCryptoStore, - ISyncResponse, - IRoomEvent, - IJoinedRoom, - IStateEvent, - IMinimalEvent, + type ISyncResponse, + type IRoomEvent, + type IJoinedRoom, + type IStateEvent, + type IMinimalEvent, NotificationCountType, - IEphemeral, + type IEphemeral, Room, IndexedDBStore, RelationType, @@ -47,7 +46,7 @@ import * as utils from "../test-utils/test-utils"; import { TestClient } from "../TestClient"; import { emitPromise, mkEvent, mkMessage } from "../test-utils/test-utils"; import { THREAD_RELATION_TYPE } from "../../src/models/thread"; -import { IActionsObject } from "../../src/pushprocessor"; +import { type IActionsObject } from "../../src/pushprocessor"; import { KnownMembership } from "../../src/@types/membership"; declare module "../../src/@types/event" { diff --git a/spec/integ/matrix-client-unread-notifications.spec.ts b/spec/integ/matrix-client-unread-notifications.spec.ts index a9124e1b0..b5329e6ec 100644 --- a/spec/integ/matrix-client-unread-notifications.spec.ts +++ b/spec/integ/matrix-client-unread-notifications.spec.ts @@ -16,14 +16,13 @@ limitations under the License. import "fake-indexeddb/auto"; -import HttpBackend from "matrix-mock-request"; - +import type HttpBackend from "matrix-mock-request"; import { Category, ClientEvent, EventType, - ISyncResponse, - MatrixClient, + type ISyncResponse, + type MatrixClient, MatrixEvent, NotificationCountType, RelationType, diff --git a/spec/integ/rendezvous/MSC4108SignInWithQR.spec.ts b/spec/integ/rendezvous/MSC4108SignInWithQR.spec.ts index d3bb0a8c6..dd956bea2 100644 --- a/spec/integ/rendezvous/MSC4108SignInWithQR.spec.ts +++ b/spec/integ/rendezvous/MSC4108SignInWithQR.spec.ts @@ -30,9 +30,9 @@ import { defer } from "../../../src/utils"; import { ClientPrefix, DEVICE_CODE_SCOPE, - IHttpOpts, - IMyDevice, - MatrixClient, + type IHttpOpts, + type IMyDevice, + type MatrixClient, MatrixError, MatrixHttpApi, } from "../../../src"; diff --git a/spec/integ/sliding-sync-sdk.spec.ts b/spec/integ/sliding-sync-sdk.spec.ts index 151921206..78d2b0b4b 100644 --- a/spec/integ/sliding-sync-sdk.spec.ts +++ b/spec/integ/sliding-sync-sdk.spec.ts @@ -15,36 +15,42 @@ limitations under the License. */ // eslint-disable-next-line no-restricted-imports -import MockHttpBackend from "matrix-mock-request"; import { fail } from "assert"; -import { SlidingSync, SlidingSyncEvent, MSC3575RoomData, SlidingSyncState, Extension } from "../../src/sliding-sync"; -import { TestClient } from "../TestClient"; -import { IRoomEvent, IStateEvent } from "../../src"; +import type MockHttpBackend from "matrix-mock-request"; import { - MatrixClient, - MatrixEvent, + SlidingSync, + SlidingSyncEvent, + type MSC3575RoomData, + SlidingSyncState, + type Extension, +} from "../../src/sliding-sync"; +import { TestClient } from "../TestClient"; +import { type IRoomEvent, type IStateEvent } from "../../src"; +import { + type MatrixClient, + type MatrixEvent, NotificationCountType, JoinRule, MatrixError, EventType, - IPushRules, + type IPushRules, PushRuleKind, TweakName, ClientEvent, RoomMemberEvent, RoomEvent, - Room, - IRoomTimelineData, + type Room, + type IRoomTimelineData, } from "../../src"; import { SlidingSyncSdk } from "../../src/sliding-sync-sdk"; -import { SyncApiOptions, SyncState } from "../../src/sync"; -import { IStoredClientOpts } from "../../src"; +import { type SyncApiOptions, SyncState } from "../../src/sync"; +import { type IStoredClientOpts } from "../../src"; import { logger } from "../../src/logger"; import { emitPromise } from "../test-utils/test-utils"; import { defer } from "../../src/utils"; import { KnownMembership } from "../../src/@types/membership"; -import { SyncCryptoCallbacks } from "../../src/common-crypto/CryptoBackend"; +import { type SyncCryptoCallbacks } from "../../src/common-crypto/CryptoBackend"; declare module "../../src/@types/event" { interface AccountDataEvents { diff --git a/spec/integ/sliding-sync.spec.ts b/spec/integ/sliding-sync.spec.ts index 29cd3443b..2ca70923d 100644 --- a/spec/integ/sliding-sync.spec.ts +++ b/spec/integ/sliding-sync.spec.ts @@ -15,21 +15,20 @@ limitations under the License. */ // eslint-disable-next-line no-restricted-imports -import EventEmitter from "events"; -import MockHttpBackend from "matrix-mock-request"; - +import type EventEmitter from "events"; +import type MockHttpBackend from "matrix-mock-request"; import { SlidingSync, SlidingSyncState, ExtensionState, SlidingSyncEvent, - Extension, - SlidingSyncEventHandlerMap, - MSC3575RoomData, + type Extension, + type SlidingSyncEventHandlerMap, + type MSC3575RoomData, } from "../../src/sliding-sync"; import { TestClient } from "../TestClient"; import { logger } from "../../src/logger"; -import { MatrixClient } from "../../src"; +import { type MatrixClient } from "../../src"; /** * Tests for sliding sync. These tests are broken down into sub-tests which are reliant upon one another. diff --git a/spec/test-utils/AccountDataAccumulator.ts b/spec/test-utils/AccountDataAccumulator.ts index 50d00973c..ce74603b1 100644 --- a/spec/test-utils/AccountDataAccumulator.ts +++ b/spec/test-utils/AccountDataAccumulator.ts @@ -16,7 +16,7 @@ limitations under the License. import fetchMock from "fetch-mock-jest"; -import { ISyncResponder } from "./SyncResponder"; +import { type ISyncResponder } from "./SyncResponder"; /** * An object which intercepts `account_data` get and set requests via fetch-mock. diff --git a/spec/test-utils/E2EKeyReceiver.ts b/spec/test-utils/E2EKeyReceiver.ts index 24af06d6e..af7b0b0ce 100644 --- a/spec/test-utils/E2EKeyReceiver.ts +++ b/spec/test-utils/E2EKeyReceiver.ts @@ -15,7 +15,7 @@ limitations under the License. */ import debugFunc from "debug"; -import { Debugger } from "debug"; +import { type Debugger } from "debug"; import fetchMock from "fetch-mock-jest"; import type { IDeviceKeys, IOneTimeKey } from "../../src/@types/crypto"; diff --git a/spec/test-utils/E2EKeyResponder.ts b/spec/test-utils/E2EKeyResponder.ts index 57152f176..a3110d083 100644 --- a/spec/test-utils/E2EKeyResponder.ts +++ b/spec/test-utils/E2EKeyResponder.ts @@ -17,9 +17,9 @@ limitations under the License. import fetchMock from "fetch-mock-jest"; import { MapWithDefault } from "../../src/utils"; -import { IDownloadKeyResult } from "../../src"; -import { IDeviceKeys } from "../../src/@types/crypto"; -import { E2EKeyReceiver } from "./E2EKeyReceiver"; +import { type IDownloadKeyResult } from "../../src"; +import { type IDeviceKeys } from "../../src/@types/crypto"; +import { type E2EKeyReceiver } from "./E2EKeyReceiver"; /** * An object which intercepts `/keys/query` fetches via fetch-mock. diff --git a/spec/test-utils/SyncResponder.ts b/spec/test-utils/SyncResponder.ts index 3caba9dfa..abf08bb05 100644 --- a/spec/test-utils/SyncResponder.ts +++ b/spec/test-utils/SyncResponder.ts @@ -15,9 +15,10 @@ limitations under the License. */ import debugFunc from "debug"; -import { Debugger } from "debug"; +import { type Debugger } from "debug"; import fetchMock from "fetch-mock-jest"; -import FetchMock from "fetch-mock"; + +import type FetchMock from "fetch-mock"; /** Interface implemented by classes that intercept `/sync` requests from test clients * diff --git a/spec/test-utils/beacon.ts b/spec/test-utils/beacon.ts index 08771379a..3a69aa332 100644 --- a/spec/test-utils/beacon.ts +++ b/spec/test-utils/beacon.ts @@ -16,7 +16,7 @@ limitations under the License. import { MatrixEvent } from "../../src"; import { M_BEACON, M_BEACON_INFO } from "../../src/@types/beacon"; -import { LocationAssetType } from "../../src/@types/location"; +import { type LocationAssetType } from "../../src/@types/location"; import { makeBeaconContent, makeBeaconInfoContent } from "../../src/content-helpers"; type InfoContentProps = { diff --git a/spec/test-utils/client.ts b/spec/test-utils/client.ts index 62e11dffa..63c8cb0c3 100644 --- a/spec/test-utils/client.ts +++ b/spec/test-utils/client.ts @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MethodLikeKeys, mocked, MockedObject } from "jest-mock"; +import { type MethodLikeKeys, mocked, type MockedObject } from "jest-mock"; -import { ClientEventHandlerMap, EmittedEvents, MatrixClient } from "../../src/client"; +import { type ClientEventHandlerMap, type EmittedEvents, type MatrixClient } from "../../src/client"; import { TypedEventEmitter } from "../../src/models/typed-event-emitter"; import { User } from "../../src/models/user"; diff --git a/spec/test-utils/mockEndpoints.ts b/spec/test-utils/mockEndpoints.ts index 7c1658388..6e4a5612c 100644 --- a/spec/test-utils/mockEndpoints.ts +++ b/spec/test-utils/mockEndpoints.ts @@ -16,7 +16,7 @@ limitations under the License. import fetchMock from "fetch-mock-jest"; -import { KeyBackupInfo } from "../../src/crypto-api"; +import { type KeyBackupInfo } from "../../src/crypto-api"; /** * Mock out the endpoints that the js-sdk calls when we call `MatrixClient.start()`. diff --git a/spec/test-utils/test-data/index.ts b/spec/test-utils/test-data/index.ts index 77a2687b8..db7c5b96f 100644 --- a/spec/test-utils/test-data/index.ts +++ b/spec/test-utils/test-data/index.ts @@ -3,9 +3,9 @@ * Do not edit by hand! This file is generated by `./generate-test-data.py` */ -import { IDeviceKeys, IMegolmSessionData } from "../../../src/@types/crypto"; -import { IDownloadKeyResult, IEvent } from "../../../src"; -import { KeyBackupSession, KeyBackupInfo } from "../../../src/crypto-api/keybackup"; +import { type IDeviceKeys, type IMegolmSessionData } from "../../../src/@types/crypto"; +import { type IDownloadKeyResult, type IEvent } from "../../../src"; +import { type KeyBackupSession, type KeyBackupInfo } from "../../../src/crypto-api/keybackup"; /* eslint-disable comma-dangle */ diff --git a/spec/test-utils/test-utils.ts b/spec/test-utils/test-utils.ts index 4edc11618..a60107d11 100644 --- a/spec/test-utils/test-utils.ts +++ b/spec/test-utils/test-utils.ts @@ -1,25 +1,31 @@ -// eslint-disable-next-line no-restricted-imports -import EventEmitter from "events"; - // load olm before the sdk if possible import "../olm-loader"; +// eslint-disable-next-line no-restricted-imports +import type EventEmitter from "events"; import { logger } from "../../src/logger"; -import { IContent, IEvent, IEventRelation, IUnsigned, MatrixEvent, MatrixEventEvent } from "../../src/models/event"; +import { + type IContent, + type IEvent, + type IEventRelation, + type IUnsigned, + MatrixEvent, + MatrixEventEvent, +} from "../../src/models/event"; import { ClientEvent, EventType, - IJoinedRoom, - IPusher, - ISyncResponse, - MatrixClient, + type IJoinedRoom, + type IPusher, + type ISyncResponse, + type MatrixClient, MsgType, RelationType, } from "../../src"; import { SyncState } from "../../src/sync"; import { eventMapperFor } from "../../src/event-mapper"; import { TEST_ROOM_ID } from "./test-data"; -import { KnownMembership, Membership } from "../../src/@types/membership"; +import { KnownMembership, type Membership } from "../../src/@types/membership"; /** * Return a promise that is resolved when the client next emits a diff --git a/spec/test-utils/test_indexeddb_cryptostore_dump/empty_account/index.ts b/spec/test-utils/test_indexeddb_cryptostore_dump/empty_account/index.ts index db196e994..3a1ccf9b6 100644 --- a/spec/test-utils/test_indexeddb_cryptostore_dump/empty_account/index.ts +++ b/spec/test-utils/test_indexeddb_cryptostore_dump/empty_account/index.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { DumpDataSetInfo } from "../index"; +import { type DumpDataSetInfo } from "../index"; /** * A key query response containing the current keys of the tested user. diff --git a/spec/test-utils/test_indexeddb_cryptostore_dump/full_account/index.ts b/spec/test-utils/test_indexeddb_cryptostore_dump/full_account/index.ts index 3ea92d6b2..043ea4a6c 100644 --- a/spec/test-utils/test_indexeddb_cryptostore_dump/full_account/index.ts +++ b/spec/test-utils/test_indexeddb_cryptostore_dump/full_account/index.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { DumpDataSetInfo } from "../index"; +import { type DumpDataSetInfo } from "../index"; /** * A key query response containing the current keys of the tested user. diff --git a/spec/test-utils/test_indexeddb_cryptostore_dump/no_cached_msk_dump/index.ts b/spec/test-utils/test_indexeddb_cryptostore_dump/no_cached_msk_dump/index.ts index 3d2a380d4..7d4c36a12 100644 --- a/spec/test-utils/test_indexeddb_cryptostore_dump/no_cached_msk_dump/index.ts +++ b/spec/test-utils/test_indexeddb_cryptostore_dump/no_cached_msk_dump/index.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { KeyBackupInfo } from "../../../../src/crypto-api/keybackup"; -import { DumpDataSetInfo } from "../index"; +import { type KeyBackupInfo } from "../../../../src/crypto-api/keybackup"; +import { type DumpDataSetInfo } from "../index"; /** * A key query response containing the current keys of the tested user. diff --git a/spec/test-utils/test_indexeddb_cryptostore_dump/unverified/index.ts b/spec/test-utils/test_indexeddb_cryptostore_dump/unverified/index.ts index 4499180b6..7388ffff5 100644 --- a/spec/test-utils/test_indexeddb_cryptostore_dump/unverified/index.ts +++ b/spec/test-utils/test_indexeddb_cryptostore_dump/unverified/index.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { DumpDataSetInfo } from "../index"; +import { type DumpDataSetInfo } from "../index"; /** * A key query response containing the current keys of the tested user. diff --git a/spec/test-utils/thread.ts b/spec/test-utils/thread.ts index be91d9063..f00882985 100644 --- a/spec/test-utils/thread.ts +++ b/spec/test-utils/thread.ts @@ -15,10 +15,10 @@ limitations under the License. */ import { RelationType } from "../../src/@types/event"; -import { MatrixClient } from "../../src/client"; -import { MatrixEvent, MatrixEventEvent } from "../../src/models/event"; -import { Room } from "../../src/models/room"; -import { Thread, THREAD_RELATION_TYPE } from "../../src/models/thread"; +import { type MatrixClient } from "../../src/client"; +import { type MatrixEvent, MatrixEventEvent } from "../../src/models/event"; +import { type Room } from "../../src/models/room"; +import { type Thread, THREAD_RELATION_TYPE } from "../../src/models/thread"; import { mkMessage } from "./test-utils"; export const makeThreadEvent = ({ diff --git a/spec/test-utils/webrtc.ts b/spec/test-utils/webrtc.ts index 066bb09bc..a594230b7 100644 --- a/spec/test-utils/webrtc.ts +++ b/spec/test-utils/webrtc.ts @@ -15,33 +15,33 @@ limitations under the License. */ import { - ClientEvent, - ClientEventHandlerMap, - EmptyObject, + type ClientEvent, + type ClientEventHandlerMap, + type EmptyObject, EventType, - GroupCall, + type GroupCall, GroupCallIntent, GroupCallType, - IContent, - ISendEventResponse, - MatrixClient, - MatrixEvent, - Room, + type IContent, + type ISendEventResponse, + type MatrixClient, + type MatrixEvent, + type Room, RoomMember, - RoomState, + type RoomState, RoomStateEvent, - RoomStateEventHandlerMap, - SendToDeviceContentMap, + type RoomStateEventHandlerMap, + type SendToDeviceContentMap, } from "../../src"; import { TypedEventEmitter } from "../../src/models/typed-event-emitter"; import { ReEmitter } from "../../src/ReEmitter"; import { SyncState } from "../../src/sync"; -import { CallEvent, CallEventHandlerMap, CallState, MatrixCall } from "../../src/webrtc/call"; -import { CallEventHandlerEvent, CallEventHandlerEventHandlerMap } from "../../src/webrtc/callEventHandler"; -import { CallFeed } from "../../src/webrtc/callFeed"; -import { GroupCallEventHandlerMap } from "../../src/webrtc/groupCall"; -import { GroupCallEventHandlerEvent } from "../../src/webrtc/groupCallEventHandler"; -import { IScreensharingOpts, MediaHandler } from "../../src/webrtc/mediaHandler"; +import { type CallEvent, type CallEventHandlerMap, CallState, type MatrixCall } from "../../src/webrtc/call"; +import { type CallEventHandlerEvent, type CallEventHandlerEventHandlerMap } from "../../src/webrtc/callEventHandler"; +import { type CallFeed } from "../../src/webrtc/callFeed"; +import { type GroupCallEventHandlerMap } from "../../src/webrtc/groupCall"; +import { type GroupCallEventHandlerEvent } from "../../src/webrtc/groupCallEventHandler"; +import { type IScreensharingOpts, type MediaHandler } from "../../src/webrtc/mediaHandler"; export const DUMMY_SDP = "v=0\r\n" + diff --git a/spec/unit/ToDeviceMessageQueue.spec.ts b/spec/unit/ToDeviceMessageQueue.spec.ts index 2689cd1e4..765d85e4f 100644 --- a/spec/unit/ToDeviceMessageQueue.spec.ts +++ b/spec/unit/ToDeviceMessageQueue.spec.ts @@ -1,9 +1,9 @@ import { ConnectionError } from "../../src/http-api/errors"; -import { ClientEvent, MatrixClient, Store } from "../../src/client"; +import { ClientEvent, type MatrixClient, type Store } from "../../src/client"; import { ToDeviceMessageQueue } from "../../src/ToDeviceMessageQueue"; import { getMockClientWithEventEmitter } from "../test-utils/client"; import { StubStore } from "../../src/store/stub"; -import { IndexedToDeviceBatch } from "../../src/models/ToDeviceMessage"; +import { type IndexedToDeviceBatch } from "../../src/models/ToDeviceMessage"; import { SyncState } from "../../src/sync"; import { defer } from "../../src/utils"; diff --git a/spec/unit/crypto.spec.ts b/spec/unit/crypto.spec.ts index 419bb530a..15abab550 100644 --- a/spec/unit/crypto.spec.ts +++ b/spec/unit/crypto.spec.ts @@ -3,7 +3,7 @@ import "../olm-loader"; import { EventEmitter } from "events"; import type { PkDecryption, PkSigning } from "@matrix-org/olm"; -import { IClaimOTKsResult, MatrixClient } from "../../src/client"; +import { type IClaimOTKsResult, type MatrixClient } from "../../src/client"; import { Crypto } from "../../src/crypto"; import { MemoryCryptoStore } from "../../src/crypto/store/memory-crypto-store"; import { MockStorageApi } from "../MockStorageApi"; @@ -18,12 +18,12 @@ import { logger } from "../../src/logger"; import { DeviceVerification, MemoryStore } from "../../src"; import { RoomKeyRequestState } from "../../src/crypto/OutgoingRoomKeyRequestManager"; import { RoomMember } from "../../src/models/room-member"; -import { IStore } from "../../src/store"; -import { IRoomEncryption, RoomList } from "../../src/crypto/RoomList"; +import { type IStore } from "../../src/store"; +import { type IRoomEncryption, type RoomList } from "../../src/crypto/RoomList"; import { EventShieldColour, EventShieldReason } from "../../src/crypto-api"; import { UserTrustLevel } from "../../src/crypto/CrossSigning"; -import { CryptoBackend } from "../../src/common-crypto/CryptoBackend"; -import { EventDecryptionResult } from "../../src/common-crypto/CryptoBackend"; +import { type CryptoBackend } from "../../src/common-crypto/CryptoBackend"; +import { type EventDecryptionResult } from "../../src/common-crypto/CryptoBackend"; import * as testData from "../test-utils/test-data"; import { KnownMembership } from "../../src/@types/membership"; import type { DeviceInfoMap } from "../../src/crypto/DeviceList"; diff --git a/spec/unit/crypto/DeviceList.spec.ts b/spec/unit/crypto/DeviceList.spec.ts index 7d3ba5d3d..429f15ebe 100644 --- a/spec/unit/crypto/DeviceList.spec.ts +++ b/spec/unit/crypto/DeviceList.spec.ts @@ -20,9 +20,9 @@ import { logger } from "../../../src/logger"; import * as utils from "../../../src/utils"; import { MemoryCryptoStore } from "../../../src/crypto/store/memory-crypto-store"; import { DeviceList } from "../../../src/crypto/DeviceList"; -import { IDownloadKeyResult, MatrixClient } from "../../../src"; -import { OlmDevice } from "../../../src/crypto/OlmDevice"; -import { CryptoStore } from "../../../src/crypto/store/base"; +import { type IDownloadKeyResult, type MatrixClient } from "../../../src"; +import { type OlmDevice } from "../../../src/crypto/OlmDevice"; +import { type CryptoStore } from "../../../src/crypto/store/base"; const signedDeviceList: IDownloadKeyResult = { failures: {}, diff --git a/spec/unit/crypto/algorithms/megolm.spec.ts b/spec/unit/crypto/algorithms/megolm.spec.ts index 20d727021..4a2035383 100644 --- a/spec/unit/crypto/algorithms/megolm.spec.ts +++ b/spec/unit/crypto/algorithms/megolm.spec.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { mocked, MockedObject } from "jest-mock"; +import { mocked, type MockedObject } from "jest-mock"; import type { DeviceInfoMap } from "../../../../src/crypto/DeviceList"; import "../../../olm-loader"; @@ -23,15 +23,15 @@ import * as algorithms from "../../../../src/crypto/algorithms"; import { MemoryCryptoStore } from "../../../../src/crypto/store/memory-crypto-store"; import * as testUtils from "../../../test-utils/test-utils"; import { OlmDevice } from "../../../../src/crypto/OlmDevice"; -import { Crypto, IncomingRoomKeyRequest } from "../../../../src/crypto"; +import { Crypto, type IncomingRoomKeyRequest } from "../../../../src/crypto"; import { logger } from "../../../../src/logger"; import { MatrixEvent } from "../../../../src/models/event"; import { TestClient } from "../../../TestClient"; import { Room } from "../../../../src/models/room"; import * as olmlib from "../../../../src/crypto/olmlib"; import { TypedEventEmitter } from "../../../../src/models/typed-event-emitter"; -import { ClientEvent, MatrixClient, RoomMember } from "../../../../src"; -import { DeviceInfo, IDevice } from "../../../../src/crypto/deviceinfo"; +import { ClientEvent, type MatrixClient, RoomMember } from "../../../../src"; +import { DeviceInfo, type IDevice } from "../../../../src/crypto/deviceinfo"; import { DeviceTrustLevel } from "../../../../src/crypto/CrossSigning"; import { MegolmEncryption as MegolmEncryptionClass } from "../../../../src/crypto/algorithms/megolm"; import { recursiveMapToObject } from "../../../../src/utils"; diff --git a/spec/unit/crypto/algorithms/olm.spec.ts b/spec/unit/crypto/algorithms/olm.spec.ts index 6c50f0963..a06175649 100644 --- a/spec/unit/crypto/algorithms/olm.spec.ts +++ b/spec/unit/crypto/algorithms/olm.spec.ts @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MockedObject } from "jest-mock"; +import { type MockedObject } from "jest-mock"; import "../../../olm-loader"; import { MemoryCryptoStore } from "../../../../src/crypto/store/memory-crypto-store"; @@ -23,7 +23,7 @@ import { logger } from "../../../../src/logger"; import { OlmDevice } from "../../../../src/crypto/OlmDevice"; import * as olmlib from "../../../../src/crypto/olmlib"; import { DeviceInfo } from "../../../../src/crypto/deviceinfo"; -import { MatrixClient } from "../../../../src"; +import { type MatrixClient } from "../../../../src"; function makeOlmDevice() { const cryptoStore = new MemoryCryptoStore(); diff --git a/spec/unit/crypto/backup.spec.ts b/spec/unit/crypto/backup.spec.ts index c210d14c8..a11f73dfd 100644 --- a/spec/unit/crypto/backup.spec.ts +++ b/spec/unit/crypto/backup.spec.ts @@ -28,10 +28,10 @@ import { Crypto } from "../../../src/crypto"; import { resetCrossSigningKeys } from "./crypto-utils"; import { BackupManager } from "../../../src/crypto/backup"; import { StubStore } from "../../../src/store/stub"; -import { IndexedDBCryptoStore, MatrixScheduler } from "../../../src"; -import { CryptoStore } from "../../../src/crypto/store/base"; -import { MegolmDecryption as MegolmDecryptionClass } from "../../../src/crypto/algorithms/megolm"; -import { IKeyBackupInfo } from "../../../src/crypto/keybackup"; +import { IndexedDBCryptoStore, type MatrixScheduler } from "../../../src"; +import { type CryptoStore } from "../../../src/crypto/store/base"; +import { type MegolmDecryption as MegolmDecryptionClass } from "../../../src/crypto/algorithms/megolm"; +import { type IKeyBackupInfo } from "../../../src/crypto/keybackup"; const Olm = globalThis.Olm; diff --git a/spec/unit/crypto/cross-signing.spec.ts b/spec/unit/crypto/cross-signing.spec.ts index a8b7fa262..011c0d5e3 100644 --- a/spec/unit/crypto/cross-signing.spec.ts +++ b/spec/unit/crypto/cross-signing.spec.ts @@ -17,18 +17,18 @@ limitations under the License. import "../../olm-loader"; import anotherjson from "another-json"; -import { PkSigning } from "@matrix-org/olm"; -import HttpBackend from "matrix-mock-request"; +import { type PkSigning } from "@matrix-org/olm"; +import type HttpBackend from "matrix-mock-request"; import * as olmlib from "../../../src/crypto/olmlib"; import { MatrixError } from "../../../src/http-api"; import { logger } from "../../../src/logger"; -import { ICreateClientOpts, ISignedKey, MatrixClient } from "../../../src/client"; +import { type ICreateClientOpts, type ISignedKey, type MatrixClient } from "../../../src/client"; import { CryptoEvent } from "../../../src/crypto"; -import { IDevice } from "../../../src/crypto/deviceinfo"; +import { type IDevice } from "../../../src/crypto/deviceinfo"; import { TestClient } from "../../TestClient"; import { resetCrossSigningKeys } from "./crypto-utils"; -import { BootstrapCrossSigningOpts, CrossSigningKeyInfo } from "../../../src/crypto-api"; +import { type BootstrapCrossSigningOpts, type CrossSigningKeyInfo } from "../../../src/crypto-api"; const PUSH_RULES_RESPONSE: Response = { method: "GET", diff --git a/spec/unit/crypto/crypto-utils.ts b/spec/unit/crypto/crypto-utils.ts index e6263a6dc..3ef2b5050 100644 --- a/spec/unit/crypto/crypto-utils.ts +++ b/spec/unit/crypto/crypto-utils.ts @@ -1,7 +1,7 @@ -import { IRecoveryKey } from "../../../src/crypto/api"; -import { CrossSigningLevel } from "../../../src/crypto/CrossSigning"; +import { type IRecoveryKey } from "../../../src/crypto/api"; +import { type CrossSigningLevel } from "../../../src/crypto/CrossSigning"; import { IndexedDBCryptoStore } from "../../../src/crypto/store/indexeddb-crypto-store"; -import { MatrixClient } from "../../../src"; +import { type MatrixClient } from "../../../src"; import { CryptoEvent } from "../../../src/crypto"; // needs to be phased out and replaced with bootstrapSecretStorage, diff --git a/spec/unit/crypto/outgoing-room-key-requests.spec.ts b/spec/unit/crypto/outgoing-room-key-requests.spec.ts index f7d516061..b0d421f13 100644 --- a/spec/unit/crypto/outgoing-room-key-requests.spec.ts +++ b/spec/unit/crypto/outgoing-room-key-requests.spec.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { CryptoStore } from "../../../src/crypto/store/base"; +import { type CryptoStore } from "../../../src/crypto/store/base"; import { IndexedDBCryptoStore } from "../../../src/crypto/store/indexeddb-crypto-store"; import { LocalStorageCryptoStore } from "../../../src/crypto/store/localStorage-crypto-store"; import { MemoryCryptoStore } from "../../../src/crypto/store/memory-crypto-store"; diff --git a/spec/unit/crypto/secrets.spec.ts b/spec/unit/crypto/secrets.spec.ts index 097ee2b1b..477441ea3 100644 --- a/spec/unit/crypto/secrets.spec.ts +++ b/spec/unit/crypto/secrets.spec.ts @@ -16,21 +16,21 @@ limitations under the License. import "../../olm-loader"; import * as olmlib from "../../../src/crypto/olmlib"; -import { IObject } from "../../../src/crypto/olmlib"; +import { type IObject } from "../../../src/crypto/olmlib"; import { MatrixEvent } from "../../../src/models/event"; import { TestClient } from "../../TestClient"; import { makeTestClients } from "./verification/util"; import encryptAESSecretStorageItem from "../../../src/utils/encryptAESSecretStorageItem.ts"; import { createSecretStorageKey, resetCrossSigningKeys } from "./crypto-utils"; import { logger } from "../../../src/logger"; -import { ClientEvent, ICreateClientOpts, MatrixClient } from "../../../src/client"; +import { ClientEvent, type ICreateClientOpts, type MatrixClient } from "../../../src/client"; import { DeviceInfo } from "../../../src/crypto/deviceinfo"; -import { ISignatures } from "../../../src/@types/signed"; -import { ICurve25519AuthData } from "../../../src/crypto/keybackup"; -import { SecretStorageKeyDescription, SECRET_STORAGE_ALGORITHM_V1_AES } from "../../../src/secret-storage"; +import { type ISignatures } from "../../../src/@types/signed"; +import { type ICurve25519AuthData } from "../../../src/crypto/keybackup"; +import { type SecretStorageKeyDescription, SECRET_STORAGE_ALGORITHM_V1_AES } from "../../../src/secret-storage"; import { decodeBase64 } from "../../../src/base64"; -import { CrossSigningKeyInfo } from "../../../src/crypto-api"; -import { SecretInfo } from "../../../src/secret-storage.ts"; +import { type CrossSigningKeyInfo } from "../../../src/crypto-api"; +import { type SecretInfo } from "../../../src/secret-storage.ts"; async function makeTestClient( userInfo: { userId: string; deviceId: string }, diff --git a/spec/unit/crypto/store/CryptoStore.spec.ts b/spec/unit/crypto/store/CryptoStore.spec.ts index f62c17dac..f89eb795c 100644 --- a/spec/unit/crypto/store/CryptoStore.spec.ts +++ b/spec/unit/crypto/store/CryptoStore.spec.ts @@ -17,7 +17,7 @@ limitations under the License. import "fake-indexeddb/auto"; import "jest-localstorage-mock"; import { IndexedDBCryptoStore, LocalStorageCryptoStore, MemoryCryptoStore } from "../../../../src"; -import { CryptoStore, MigrationState, SESSION_BATCH_SIZE } from "../../../../src/crypto/store/base"; +import { type CryptoStore, MigrationState, SESSION_BATCH_SIZE } from "../../../../src/crypto/store/base"; describe.each([ ["IndexedDBCryptoStore", () => new IndexedDBCryptoStore(globalThis.indexedDB, "tests")], diff --git a/spec/unit/crypto/verification/InRoomChannel.spec.ts b/spec/unit/crypto/verification/InRoomChannel.spec.ts index 562c83b04..28a88c50b 100644 --- a/spec/unit/crypto/verification/InRoomChannel.spec.ts +++ b/spec/unit/crypto/verification/InRoomChannel.spec.ts @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixClient } from "../../../../src/client"; +import { type MatrixClient } from "../../../../src/client"; import { InRoomChannel } from "../../../../src/crypto/verification/request/InRoomChannel"; import { MatrixEvent } from "../../../../src/models/event"; diff --git a/spec/unit/crypto/verification/sas.spec.ts b/spec/unit/crypto/verification/sas.spec.ts index 939dc3b77..ced5f0863 100644 --- a/spec/unit/crypto/verification/sas.spec.ts +++ b/spec/unit/crypto/verification/sas.spec.ts @@ -17,17 +17,17 @@ limitations under the License. import "../../../olm-loader"; import { makeTestClients } from "./util"; import { MatrixEvent } from "../../../../src/models/event"; -import { ISasEvent, SAS, SasEvent } from "../../../../src/crypto/verification/SAS"; -import { DeviceInfo, IDevice } from "../../../../src/crypto/deviceinfo"; +import { type ISasEvent, SAS, SasEvent } from "../../../../src/crypto/verification/SAS"; +import { DeviceInfo, type IDevice } from "../../../../src/crypto/deviceinfo"; import { CryptoEvent, verificationMethods } from "../../../../src/crypto"; import * as olmlib from "../../../../src/crypto/olmlib"; import { logger } from "../../../../src/logger"; import { resetCrossSigningKeys } from "../crypto-utils"; -import { VerificationBase } from "../../../../src/crypto/verification/Base"; -import { IVerificationChannel } from "../../../../src/crypto/verification/request/Channel"; -import { MatrixClient } from "../../../../src"; -import { VerificationRequest } from "../../../../src/crypto/verification/request/VerificationRequest"; -import { TestClient } from "../../../TestClient"; +import { type VerificationBase } from "../../../../src/crypto/verification/Base"; +import { type IVerificationChannel } from "../../../../src/crypto/verification/request/Channel"; +import { type MatrixClient } from "../../../../src"; +import { type VerificationRequest } from "../../../../src/crypto/verification/request/VerificationRequest"; +import { type TestClient } from "../../../TestClient"; const Olm = globalThis.Olm; diff --git a/spec/unit/crypto/verification/secret_request.spec.ts b/spec/unit/crypto/verification/secret_request.spec.ts index acc00abf1..515a15d40 100644 --- a/spec/unit/crypto/verification/secret_request.spec.ts +++ b/spec/unit/crypto/verification/secret_request.spec.ts @@ -15,12 +15,12 @@ limitations under the License. */ import "../../../olm-loader"; -import { MatrixClient, MatrixEvent } from "../../../../src/matrix"; +import { type MatrixClient, type MatrixEvent } from "../../../../src/matrix"; import { encodeBase64 } from "../../../../src/base64"; import "../../../../src/crypto"; // import this to cycle-break import { CrossSigningInfo } from "../../../../src/crypto/CrossSigning"; -import { VerificationRequest } from "../../../../src/crypto/verification/request/VerificationRequest"; -import { IVerificationChannel } from "../../../../src/crypto/verification/request/Channel"; +import { type VerificationRequest } from "../../../../src/crypto/verification/request/VerificationRequest"; +import { type IVerificationChannel } from "../../../../src/crypto/verification/request/Channel"; import { VerificationBase } from "../../../../src/crypto/verification/Base"; jest.useFakeTimers(); diff --git a/spec/unit/crypto/verification/util.ts b/spec/unit/crypto/verification/util.ts index 16a185598..cf3cf0c49 100644 --- a/spec/unit/crypto/verification/util.ts +++ b/spec/unit/crypto/verification/util.ts @@ -16,11 +16,16 @@ limitations under the License. */ import { TestClient } from "../../../TestClient"; -import { IContent, MatrixEvent } from "../../../../src/models/event"; -import { IRoomTimelineData } from "../../../../src/models/event-timeline-set"; +import { type IContent, MatrixEvent } from "../../../../src/models/event"; +import { type IRoomTimelineData } from "../../../../src/models/event-timeline-set"; import { Room, RoomEvent } from "../../../../src/models/room"; import { logger } from "../../../../src/logger"; -import { MatrixClient, ClientEvent, ICreateClientOpts, SendToDeviceContentMap } from "../../../../src/client"; +import { + type MatrixClient, + ClientEvent, + type ICreateClientOpts, + type SendToDeviceContentMap, +} from "../../../../src/client"; interface UserInfo { userId: string; diff --git a/spec/unit/crypto/verification/verification_request.spec.ts b/spec/unit/crypto/verification/verification_request.spec.ts index 2f42e54d8..5752fa4a2 100644 --- a/spec/unit/crypto/verification/verification_request.spec.ts +++ b/spec/unit/crypto/verification/verification_request.spec.ts @@ -21,9 +21,9 @@ import { } from "../../../../src/crypto/verification/request/VerificationRequest"; import { InRoomChannel } from "../../../../src/crypto/verification/request/InRoomChannel"; import { ToDeviceChannel } from "../../../../src/crypto/verification/request/ToDeviceChannel"; -import { IContent, MatrixEvent } from "../../../../src/models/event"; -import { MatrixClient } from "../../../../src/client"; -import { IVerificationChannel } from "../../../../src/crypto/verification/request/Channel"; +import { type IContent, MatrixEvent } from "../../../../src/models/event"; +import { type MatrixClient } from "../../../../src/client"; +import { type IVerificationChannel } from "../../../../src/crypto/verification/request/Channel"; import { VerificationBase } from "../../../../src/crypto/verification/Base"; import { MapWithDefault } from "../../../../src/utils"; diff --git a/spec/unit/embedded.spec.ts b/spec/unit/embedded.spec.ts index c5ef3a6a2..35bdc4dff 100644 --- a/spec/unit/embedded.spec.ts +++ b/spec/unit/embedded.spec.ts @@ -22,24 +22,24 @@ limitations under the License. // project, which doesn't know about our TypeEventEmitter implementation at all // eslint-disable-next-line no-restricted-imports import { EventEmitter } from "events"; -import { MockedObject } from "jest-mock"; +import { type MockedObject } from "jest-mock"; import { - WidgetApi, + type WidgetApi, WidgetApiToWidgetAction, MatrixCapabilities, - ITurnServer, - IRoomEvent, - IOpenIDCredentials, - ISendEventFromWidgetResponseData, + type ITurnServer, + type IRoomEvent, + type IOpenIDCredentials, + type ISendEventFromWidgetResponseData, WidgetApiResponseError, } from "matrix-widget-api"; import { createRoomWidgetClient, MatrixError, MsgType, UpdateDelayedEventAction } from "../../src/matrix"; -import { MatrixClient, ClientEvent, ITurnServer as IClientTurnServer } from "../../src/client"; +import { MatrixClient, ClientEvent, type ITurnServer as IClientTurnServer } from "../../src/client"; import { SyncState } from "../../src/sync"; -import { ICapabilities, RoomWidgetClient } from "../../src/embedded"; +import { type ICapabilities, type RoomWidgetClient } from "../../src/embedded"; import { MatrixEvent } from "../../src/models/event"; -import { ToDeviceBatch } from "../../src/models/ToDeviceMessage"; +import { type ToDeviceBatch } from "../../src/models/ToDeviceMessage"; import { DeviceInfo } from "../../src/crypto/deviceinfo"; import { sleep } from "../../src/utils"; diff --git a/spec/unit/event-mapper.spec.ts b/spec/unit/event-mapper.spec.ts index a2331316b..6083ab5d5 100644 --- a/spec/unit/event-mapper.spec.ts +++ b/spec/unit/event-mapper.spec.ts @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixClient, MatrixEvent, MatrixEventEvent, MatrixScheduler, Room } from "../../src"; +import { MatrixClient, MatrixEvent, MatrixEventEvent, type MatrixScheduler, Room } from "../../src"; import { eventMapperFor } from "../../src/event-mapper"; -import { IStore } from "../../src/store"; +import { type IStore } from "../../src/store"; describe("eventMapperFor", function () { let rooms: Room[] = []; diff --git a/spec/unit/event-timeline.spec.ts b/spec/unit/event-timeline.spec.ts index fab355eca..8fb0ebc6a 100644 --- a/spec/unit/event-timeline.spec.ts +++ b/spec/unit/event-timeline.spec.ts @@ -3,7 +3,7 @@ import { mocked } from "jest-mock"; import * as utils from "../test-utils/test-utils"; import { Direction, EventTimeline } from "../../src/models/event-timeline"; import { RoomState } from "../../src/models/room-state"; -import { MatrixClient } from "../../src/matrix"; +import { type MatrixClient } from "../../src/matrix"; import { Room } from "../../src/models/room"; import { RoomMember } from "../../src/models/room-member"; import { EventTimelineSet } from "../../src/models/event-timeline-set"; diff --git a/spec/unit/extensible_events_v1/ExtensibleEvent.spec.ts b/spec/unit/extensible_events_v1/ExtensibleEvent.spec.ts index 2a0839efa..22eb1c687 100644 --- a/spec/unit/extensible_events_v1/ExtensibleEvent.spec.ts +++ b/spec/unit/extensible_events_v1/ExtensibleEvent.spec.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { ExtensibleEventType, IPartialEvent } from "../../../src/@types/extensible_events"; +import { type ExtensibleEventType, type IPartialEvent } from "../../../src/@types/extensible_events"; import { ExtensibleEvent } from "../../../src/extensible_events_v1/ExtensibleEvent"; class MockEvent extends ExtensibleEvent { diff --git a/spec/unit/extensible_events_v1/MessageEvent.spec.ts b/spec/unit/extensible_events_v1/MessageEvent.spec.ts index cb41f1de9..c9f3bac53 100644 --- a/spec/unit/extensible_events_v1/MessageEvent.spec.ts +++ b/spec/unit/extensible_events_v1/MessageEvent.spec.ts @@ -15,8 +15,8 @@ limitations under the License. */ import { - ExtensibleAnyMessageEventContent, - IPartialEvent, + type ExtensibleAnyMessageEventContent, + type IPartialEvent, M_HTML, M_MESSAGE, M_TEXT, diff --git a/spec/unit/extensible_events_v1/PollEndEvent.spec.ts b/spec/unit/extensible_events_v1/PollEndEvent.spec.ts index 349e3fc58..611fd9a2d 100644 --- a/spec/unit/extensible_events_v1/PollEndEvent.spec.ts +++ b/spec/unit/extensible_events_v1/PollEndEvent.spec.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { PollEndEventContent, M_POLL_END } from "../../../src/@types/polls"; -import { IPartialEvent, REFERENCE_RELATION, M_TEXT } from "../../../src/@types/extensible_events"; +import { type PollEndEventContent, M_POLL_END } from "../../../src/@types/polls"; +import { type IPartialEvent, REFERENCE_RELATION, M_TEXT } from "../../../src/@types/extensible_events"; import { PollEndEvent } from "../../../src/extensible_events_v1/PollEndEvent"; import { InvalidEventError } from "../../../src/extensible_events_v1/InvalidEventError"; diff --git a/spec/unit/extensible_events_v1/PollResponseEvent.spec.ts b/spec/unit/extensible_events_v1/PollResponseEvent.spec.ts index 6abdd824e..b8d8e8331 100644 --- a/spec/unit/extensible_events_v1/PollResponseEvent.spec.ts +++ b/spec/unit/extensible_events_v1/PollResponseEvent.spec.ts @@ -14,11 +14,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { M_TEXT, IPartialEvent, REFERENCE_RELATION } from "../../../src/@types/extensible_events"; +import { M_TEXT, type IPartialEvent, REFERENCE_RELATION } from "../../../src/@types/extensible_events"; import { M_POLL_START, M_POLL_KIND_DISCLOSED, - PollResponseEventContent, + type PollResponseEventContent, M_POLL_RESPONSE, } from "../../../src/@types/polls"; import { PollStartEvent } from "../../../src/extensible_events_v1/PollStartEvent"; diff --git a/spec/unit/extensible_events_v1/PollStartEvent.spec.ts b/spec/unit/extensible_events_v1/PollStartEvent.spec.ts index 93612069b..ce4b7caac 100644 --- a/spec/unit/extensible_events_v1/PollStartEvent.spec.ts +++ b/spec/unit/extensible_events_v1/PollStartEvent.spec.ts @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { M_TEXT, IPartialEvent } from "../../../src/@types/extensible_events"; +import { M_TEXT, type IPartialEvent } from "../../../src/@types/extensible_events"; import { M_POLL_START, M_POLL_KIND_DISCLOSED, - PollAnswer, - PollStartEventContent, + type PollAnswer, + type PollStartEventContent, M_POLL_KIND_UNDISCLOSED, } from "../../../src/@types/polls"; import { PollStartEvent, PollAnswerSubevent } from "../../../src/extensible_events_v1/PollStartEvent"; diff --git a/spec/unit/filter.spec.ts b/spec/unit/filter.spec.ts index 6a31f691b..dbaef9e10 100644 --- a/spec/unit/filter.spec.ts +++ b/spec/unit/filter.spec.ts @@ -15,7 +15,7 @@ limitations under the License. */ import { UNREAD_THREAD_NOTIFICATIONS } from "../../src/@types/sync"; -import { Filter, IFilterDefinition } from "../../src/filter"; +import { Filter, type IFilterDefinition } from "../../src/filter"; import { mkEvent } from "../test-utils/test-utils"; import { EventType } from "../../src"; diff --git a/spec/unit/http-api/fetch.spec.ts b/spec/unit/http-api/fetch.spec.ts index 294ec8df0..5f6c15892 100644 --- a/spec/unit/http-api/fetch.spec.ts +++ b/spec/unit/http-api/fetch.spec.ts @@ -14,22 +14,22 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Mocked } from "jest-mock"; +import { type Mocked } from "jest-mock"; import { FetchHttpApi } from "../../../src/http-api/fetch"; import { TypedEventEmitter } from "../../../src/models/typed-event-emitter"; import { ClientPrefix, HttpApiEvent, - HttpApiEventHandlerMap, + type HttpApiEventHandlerMap, IdentityPrefix, - IHttpOpts, + type IHttpOpts, MatrixError, Method, } from "../../../src"; import { emitPromise } from "../../test-utils/test-utils"; -import { defer, QueryDict } from "../../../src/utils"; -import { Logger } from "../../../src/logger"; +import { defer, type QueryDict } from "../../../src/utils"; +import { type Logger } from "../../../src/logger"; describe("FetchHttpApi", () => { const baseUrl = "http://baseUrl"; diff --git a/spec/unit/http-api/index.spec.ts b/spec/unit/http-api/index.spec.ts index 5435c4bdc..0145c9aea 100644 --- a/spec/unit/http-api/index.spec.ts +++ b/spec/unit/http-api/index.spec.ts @@ -16,7 +16,7 @@ limitations under the License. import { mocked } from "jest-mock"; -import { ClientPrefix, MatrixHttpApi, Method, UploadResponse } from "../../../src"; +import { ClientPrefix, MatrixHttpApi, Method, type UploadResponse } from "../../../src"; import { TypedEventEmitter } from "../../../src/models/typed-event-emitter"; type Writeable = { -readonly [P in keyof T]: T[P] }; diff --git a/spec/unit/interactive-auth.spec.ts b/spec/unit/interactive-auth.spec.ts index e867788ff..9a4b77f4d 100644 --- a/spec/unit/interactive-auth.spec.ts +++ b/spec/unit/interactive-auth.spec.ts @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixClient } from "../../src/client"; +import { type MatrixClient } from "../../src/client"; import { logger } from "../../src/logger"; import { InteractiveAuth, AuthType } from "../../src/interactive-auth"; import { HTTPError, MatrixError } from "../../src/http-api"; diff --git a/spec/unit/local_notifications.spec.ts b/spec/unit/local_notifications.spec.ts index e46d462ad..085d8e64b 100644 --- a/spec/unit/local_notifications.spec.ts +++ b/spec/unit/local_notifications.spec.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { LocalNotificationSettings } from "../../src/@types/local_notifications"; -import { LOCAL_NOTIFICATION_SETTINGS_PREFIX, MatrixClient } from "../../src/matrix"; +import { type LocalNotificationSettings } from "../../src/@types/local_notifications"; +import { LOCAL_NOTIFICATION_SETTINGS_PREFIX, type MatrixClient } from "../../src/matrix"; import { TestClient } from "../TestClient"; let client: MatrixClient; diff --git a/spec/unit/location.spec.ts b/spec/unit/location.spec.ts index ff24d6638..91c487b6a 100644 --- a/spec/unit/location.spec.ts +++ b/spec/unit/location.spec.ts @@ -20,7 +20,7 @@ import { LocationAssetType, M_LOCATION, M_TIMESTAMP, - LocationEventWireContent, + type LocationEventWireContent, } from "../../src/@types/location"; import { M_TEXT } from "../../src/@types/extensible_events"; import { MsgType } from "../../src/@types/event"; diff --git a/spec/unit/matrix-client.spec.ts b/spec/unit/matrix-client.spec.ts index fa261c9ce..5b00a3f9e 100644 --- a/spec/unit/matrix-client.spec.ts +++ b/spec/unit/matrix-client.spec.ts @@ -14,11 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Mocked, mocked } from "jest-mock"; +import { type Mocked, mocked } from "jest-mock"; import fetchMock from "fetch-mock-jest"; import { logger } from "../../src/logger"; -import { ClientEvent, IMatrixClientCreateOpts, ITurnServerResponse, MatrixClient, Store } from "../../src/client"; +import { + ClientEvent, + type IMatrixClientCreateOpts, + type ITurnServerResponse, + MatrixClient, + type Store, +} from "../../src/client"; import { Filter } from "../../src/filter"; import { DEFAULT_TREE_POWER_LEVELS_TEMPLATE } from "../../src/models/MSC3089TreeSpace"; import { @@ -47,12 +53,12 @@ import { EventTimeline, EventTimelineSet, getHttpUriForMxc, - ICreateRoomOpts, - IPushRule, - IRequestOpts, + type ICreateRoomOpts, + type IPushRule, + type IRequestOpts, MatrixError, - MatrixHttpApi, - MatrixScheduler, + type MatrixHttpApi, + type MatrixScheduler, Method, PushRuleActionName, Room, @@ -68,15 +74,15 @@ import { PolicyRecommendation, PolicyScope, } from "../../src/models/invites-ignorer"; -import { IOlmDevice } from "../../src/crypto/algorithms/megolm"; -import { defer, QueryDict } from "../../src/utils"; -import { SyncState } from "../../src/sync"; +import { type IOlmDevice } from "../../src/crypto/algorithms/megolm"; +import { defer, type QueryDict } from "../../src/utils"; +import { type SyncState } from "../../src/sync"; import * as featureUtils from "../../src/feature"; import { StubStore } from "../../src/store/stub"; -import { SecretStorageKeyDescriptionAesV1, ServerSideSecretStorageImpl } from "../../src/secret-storage"; -import { CryptoBackend } from "../../src/common-crypto/CryptoBackend"; +import { type SecretStorageKeyDescriptionAesV1, type ServerSideSecretStorageImpl } from "../../src/secret-storage"; +import { type CryptoBackend } from "../../src/common-crypto/CryptoBackend"; import { KnownMembership } from "../../src/@types/membership"; -import { RoomMessageEventContent } from "../../src/@types/events"; +import { type RoomMessageEventContent } from "../../src/@types/events"; import { mockOpenIdConfiguration } from "../test-utils/oidc.ts"; jest.useFakeTimers(); diff --git a/spec/unit/matrixrtc/CallMembership.spec.ts b/spec/unit/matrixrtc/CallMembership.spec.ts index e330ef1d8..cfa98ebd2 100644 --- a/spec/unit/matrixrtc/CallMembership.spec.ts +++ b/spec/unit/matrixrtc/CallMembership.spec.ts @@ -14,8 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixEvent } from "../../../src"; -import { CallMembership, SessionMembershipData, DEFAULT_EXPIRE_DURATION } from "../../../src/matrixrtc/CallMembership"; +import { type MatrixEvent } from "../../../src"; +import { + CallMembership, + type SessionMembershipData, + DEFAULT_EXPIRE_DURATION, +} from "../../../src/matrixrtc/CallMembership"; import { membershipTemplate } from "./mocks"; function makeMockEvent(originTs = 0): MatrixEvent { diff --git a/spec/unit/matrixrtc/MatrixRTCSession.spec.ts b/spec/unit/matrixrtc/MatrixRTCSession.spec.ts index 801c2f145..1afca35e6 100644 --- a/spec/unit/matrixrtc/MatrixRTCSession.spec.ts +++ b/spec/unit/matrixrtc/MatrixRTCSession.spec.ts @@ -14,11 +14,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { encodeBase64, EventType, MatrixClient, MatrixError, MatrixEvent, Room } from "../../../src"; +import { encodeBase64, EventType, MatrixClient, MatrixError, type MatrixEvent, type Room } from "../../../src"; import { KnownMembership } from "../../../src/@types/membership"; -import { DEFAULT_EXPIRE_DURATION, SessionMembershipData } from "../../../src/matrixrtc/CallMembership"; +import { DEFAULT_EXPIRE_DURATION, type SessionMembershipData } from "../../../src/matrixrtc/CallMembership"; import { MatrixRTCSession, MatrixRTCSessionEvent } from "../../../src/matrixrtc/MatrixRTCSession"; -import { EncryptionKeysEventContent } from "../../../src/matrixrtc/types"; +import { type EncryptionKeysEventContent } from "../../../src/matrixrtc/types"; import { secureRandomString } from "../../../src/randomstring"; import { flushPromises } from "../../test-utils/flushPromises"; import { makeMockRoom, makeMockRoomState, membershipTemplate } from "./mocks"; diff --git a/spec/unit/matrixrtc/MatrixRTCSessionManager.spec.ts b/spec/unit/matrixrtc/MatrixRTCSessionManager.spec.ts index 5b87098c0..578c62ac0 100644 --- a/spec/unit/matrixrtc/MatrixRTCSessionManager.spec.ts +++ b/spec/unit/matrixrtc/MatrixRTCSessionManager.spec.ts @@ -14,15 +14,15 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Mock } from "jest-mock"; +import { type Mock } from "jest-mock"; import { ClientEvent, EventTimeline, EventType, - IRoomTimelineData, + type IRoomTimelineData, MatrixClient, - MatrixEvent, + type MatrixEvent, RoomEvent, } from "../../../src"; import { RoomStateEvent } from "../../../src/models/room-state"; diff --git a/spec/unit/matrixrtc/mocks.ts b/spec/unit/matrixrtc/mocks.ts index 3b35a2fab..428014384 100644 --- a/spec/unit/matrixrtc/mocks.ts +++ b/spec/unit/matrixrtc/mocks.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { EventType, MatrixEvent, Room } from "../../../src"; -import { SessionMembershipData } from "../../../src/matrixrtc/CallMembership"; +import { EventType, type MatrixEvent, type Room } from "../../../src"; +import { type SessionMembershipData } from "../../../src/matrixrtc/CallMembership"; import { secureRandomString } from "../../../src/randomstring"; type MembershipData = SessionMembershipData[] | SessionMembershipData | {}; diff --git a/spec/unit/models/MSC3089Branch.spec.ts b/spec/unit/models/MSC3089Branch.spec.ts index 7151e9680..6873edc60 100644 --- a/spec/unit/models/MSC3089Branch.spec.ts +++ b/spec/unit/models/MSC3089Branch.spec.ts @@ -14,14 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IContent, MatrixClient, MatrixEvent } from "../../../src"; -import { Room } from "../../../src/models/room"; +import { type IContent, type MatrixClient, type MatrixEvent } from "../../../src"; +import { type Room } from "../../../src/models/room"; import { RelationType, UNSTABLE_MSC3089_BRANCH } from "../../../src/@types/event"; -import { EventTimelineSet } from "../../../src/models/event-timeline-set"; -import { EventTimeline } from "../../../src/models/event-timeline"; +import { type EventTimelineSet } from "../../../src/models/event-timeline-set"; +import { type EventTimeline } from "../../../src/models/event-timeline"; import { MSC3089Branch } from "../../../src/models/MSC3089Branch"; import { MSC3089TreeSpace } from "../../../src/models/MSC3089TreeSpace"; -import { EncryptedFile } from "../../../src/@types/media"; +import { type EncryptedFile } from "../../../src/@types/media"; describe("MSC3089Branch", () => { let client: MatrixClient; diff --git a/spec/unit/models/MSC3089TreeSpace.spec.ts b/spec/unit/models/MSC3089TreeSpace.spec.ts index 2a07ced56..de572adfa 100644 --- a/spec/unit/models/MSC3089TreeSpace.spec.ts +++ b/spec/unit/models/MSC3089TreeSpace.spec.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IContent, MatrixClient } from "../../../src"; -import { Room } from "../../../src/models/room"; +import { type IContent, type MatrixClient } from "../../../src"; +import { type Room } from "../../../src/models/room"; import { MatrixEvent } from "../../../src/models/event"; import { EventType, MsgType, UNSTABLE_MSC3089_BRANCH, UNSTABLE_MSC3089_LEAF } from "../../../src/@types/event"; import { @@ -26,7 +26,7 @@ import { import { DEFAULT_ALPHABET } from "../../../src/utils"; import { MatrixError } from "../../../src/http-api"; import { KnownMembership } from "../../../src/@types/membership"; -import { EncryptedFile } from "../../../src/@types/media"; +import { type EncryptedFile } from "../../../src/@types/media"; describe("MSC3089TreeSpace", () => { let client: MatrixClient; diff --git a/spec/unit/models/event.spec.ts b/spec/unit/models/event.spec.ts index 0234eab3e..e539e15a8 100644 --- a/spec/unit/models/event.spec.ts +++ b/spec/unit/models/event.spec.ts @@ -14,14 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MockedObject } from "jest-mock"; +import { type MockedObject } from "jest-mock"; import { MatrixEvent, MatrixEventEvent } from "../../../src/models/event"; import { emitPromise } from "../../test-utils/test-utils"; -import { Crypto, IEventDecryptionResult } from "../../../src/crypto"; +import { type Crypto, type IEventDecryptionResult } from "../../../src/crypto"; import { - IAnnotatedPushRule, - MatrixClient, + type IAnnotatedPushRule, + type MatrixClient, PushRuleActionName, Room, THREAD_RELATION_TYPE, diff --git a/spec/unit/models/poll.spec.ts b/spec/unit/models/poll.spec.ts index 401e33809..5cfd52614 100644 --- a/spec/unit/models/poll.spec.ts +++ b/spec/unit/models/poll.spec.ts @@ -16,7 +16,7 @@ limitations under the License. import { M_POLL_START } from "matrix-events-sdk"; -import { EventType, IEvent, MatrixEvent, PollEvent, Room } from "../../../src"; +import { EventType, type IEvent, MatrixEvent, PollEvent, Room } from "../../../src"; import { REFERENCE_RELATION } from "../../../src/@types/extensible_events"; import { M_POLL_END, M_POLL_KIND_DISCLOSED, M_POLL_RESPONSE } from "../../../src/@types/polls"; import { PollStartEvent } from "../../../src/extensible_events_v1/PollStartEvent"; diff --git a/spec/unit/models/room-receipts.spec.ts b/spec/unit/models/room-receipts.spec.ts index b352c0def..977d1f7a4 100644 --- a/spec/unit/models/room-receipts.spec.ts +++ b/spec/unit/models/room-receipts.spec.ts @@ -14,7 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { FeatureSupport, MatrixClient, MatrixEvent, ReceiptContent, THREAD_RELATION_TYPE, Thread } from "../../../src"; +import { + FeatureSupport, + type MatrixClient, + MatrixEvent, + type ReceiptContent, + THREAD_RELATION_TYPE, + Thread, +} from "../../../src"; import { Room } from "../../../src/models/room"; /** diff --git a/spec/unit/notifications.spec.ts b/spec/unit/notifications.spec.ts index f559e0f2f..41e0ff1f1 100644 --- a/spec/unit/notifications.spec.ts +++ b/spec/unit/notifications.spec.ts @@ -19,7 +19,7 @@ import { Feature, ServerSupport } from "../../src/feature"; import { EventType, fixNotificationCountOnDecryption, - MatrixClient, + type MatrixClient, MatrixEvent, MsgType, NotificationCountType, @@ -27,7 +27,7 @@ import { Room, RoomEvent, } from "../../src/matrix"; -import { IActionsObject } from "../../src/pushprocessor"; +import { type IActionsObject } from "../../src/pushprocessor"; import { ReEmitter } from "../../src/ReEmitter"; import { getMockClientWithEventEmitter, mockClientMethodsUser } from "../test-utils/client"; import { mkEvent, mock } from "../test-utils/test-utils"; diff --git a/spec/unit/oidc/register.spec.ts b/spec/unit/oidc/register.spec.ts index 0f02b3fd2..53124e0fd 100644 --- a/spec/unit/oidc/register.spec.ts +++ b/spec/unit/oidc/register.spec.ts @@ -17,7 +17,7 @@ limitations under the License. import fetchMockJest from "fetch-mock-jest"; import { OidcError } from "../../../src/oidc/error"; -import { OidcRegistrationClientMetadata, registerOidcClient } from "../../../src/oidc/register"; +import { type OidcRegistrationClientMetadata, registerOidcClient } from "../../../src/oidc/register"; import { makeDelegatedAuthConfig } from "../../test-utils/oidc"; describe("registerOidcClient()", () => { diff --git a/spec/unit/oidc/validate.spec.ts b/spec/unit/oidc/validate.spec.ts index 4802e22da..7a34d7612 100644 --- a/spec/unit/oidc/validate.spec.ts +++ b/spec/unit/oidc/validate.spec.ts @@ -18,7 +18,7 @@ import { mocked } from "jest-mock"; import { jwtDecode } from "jwt-decode"; import { logger } from "../../../src/logger"; -import { ValidatedAuthMetadata, validateIdToken, validateAuthMetadata } from "../../../src/oidc/validate"; +import { type ValidatedAuthMetadata, validateIdToken, validateAuthMetadata } from "../../../src/oidc/validate"; import { OidcError } from "../../../src/oidc/error"; jest.mock("jwt-decode"); diff --git a/spec/unit/pushprocessor.spec.ts b/spec/unit/pushprocessor.spec.ts index ed7261e72..e0ad38e8f 100644 --- a/spec/unit/pushprocessor.spec.ts +++ b/spec/unit/pushprocessor.spec.ts @@ -1,12 +1,12 @@ import * as utils from "../test-utils/test-utils"; -import { IActionsObject, PushProcessor } from "../../src/pushprocessor"; +import { type IActionsObject, PushProcessor } from "../../src/pushprocessor"; import { ConditionKind, EventType, - IContent, - IPushRule, - MatrixClient, - MatrixEvent, + type IContent, + type IPushRule, + type MatrixClient, + type MatrixEvent, PushRuleActionName, RuleId, TweakName, diff --git a/spec/unit/queueToDevice.spec.ts b/spec/unit/queueToDevice.spec.ts index e4716755c..14d36c063 100644 --- a/spec/unit/queueToDevice.spec.ts +++ b/spec/unit/queueToDevice.spec.ts @@ -17,11 +17,11 @@ limitations under the License. import MockHttpBackend from "matrix-mock-request"; import { indexedDB as fakeIndexedDB } from "fake-indexeddb"; -import { IndexedDBStore, MatrixEvent, MemoryStore, Room } from "../../src"; +import { IndexedDBStore, MatrixEvent, MemoryStore, type Room } from "../../src"; import { MatrixClient } from "../../src/client"; -import { ToDeviceBatch } from "../../src/models/ToDeviceMessage"; +import { type ToDeviceBatch } from "../../src/models/ToDeviceMessage"; import { logger } from "../../src/logger"; -import { IStore } from "../../src/store"; +import { type IStore } from "../../src/store"; import { flushPromises } from "../test-utils/flushPromises"; import { removeElement } from "../../src/utils"; diff --git a/spec/unit/read-receipt.spec.ts b/spec/unit/read-receipt.spec.ts index 017a0aa3f..bb84ce6bc 100644 --- a/spec/unit/read-receipt.spec.ts +++ b/spec/unit/read-receipt.spec.ts @@ -16,9 +16,9 @@ limitations under the License. import MockHttpBackend from "matrix-mock-request"; -import { MAIN_ROOM_TIMELINE, ReceiptType, WrappedReceipt } from "../../src/@types/read_receipts"; +import { MAIN_ROOM_TIMELINE, ReceiptType, type WrappedReceipt } from "../../src/@types/read_receipts"; import { MatrixClient } from "../../src/client"; -import { EventType, MatrixEvent, RelationType, Room, threadIdForReceipt } from "../../src/matrix"; +import { EventType, type MatrixEvent, RelationType, Room, threadIdForReceipt } from "../../src/matrix"; import { synthesizeReceipt } from "../../src/models/read-receipt"; import { encodeUri } from "../../src/utils"; import * as utils from "../test-utils/test-utils"; diff --git a/spec/unit/rendezvous/DummyTransport.ts b/spec/unit/rendezvous/DummyTransport.ts index e8503f718..b324f6b6f 100644 --- a/spec/unit/rendezvous/DummyTransport.ts +++ b/spec/unit/rendezvous/DummyTransport.ts @@ -16,10 +16,10 @@ limitations under the License. import { logger } from "../../../src/logger"; import { - RendezvousFailureListener, - RendezvousFailureReason, - RendezvousTransport, - RendezvousTransportDetails, + type RendezvousFailureListener, + type RendezvousFailureReason, + type RendezvousTransport, + type RendezvousTransportDetails, } from "../../../src/rendezvous"; import { sleep } from "../../../src/utils"; diff --git a/spec/unit/rendezvous/MSC4108RendezvousSession.spec.ts b/spec/unit/rendezvous/MSC4108RendezvousSession.spec.ts index 57afd3afc..54432934c 100644 --- a/spec/unit/rendezvous/MSC4108RendezvousSession.spec.ts +++ b/spec/unit/rendezvous/MSC4108RendezvousSession.spec.ts @@ -16,7 +16,7 @@ limitations under the License. import fetchMock from "fetch-mock-jest"; -import { ClientPrefix, IHttpOpts, MatrixClient, MatrixHttpApi } from "../../../src"; +import { ClientPrefix, type IHttpOpts, type MatrixClient, MatrixHttpApi } from "../../../src"; import { ClientRendezvousFailureReason, MSC4108RendezvousSession } from "../../../src/rendezvous"; function makeMockClient(opts: { userId: string; deviceId: string; msc4108Enabled: boolean }): MatrixClient { diff --git a/spec/unit/rendezvous/channels/MSC4108SecureChannel.spec.ts b/spec/unit/rendezvous/channels/MSC4108SecureChannel.spec.ts index bc357d9ac..0778d36a3 100644 --- a/spec/unit/rendezvous/channels/MSC4108SecureChannel.spec.ts +++ b/spec/unit/rendezvous/channels/MSC4108SecureChannel.spec.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { EstablishedEcies, QrCodeData, QrCodeMode, Ecies } from "@matrix-org/matrix-sdk-crypto-wasm"; +import { type EstablishedEcies, QrCodeData, QrCodeMode, Ecies } from "@matrix-org/matrix-sdk-crypto-wasm"; import { mocked } from "jest-mock"; import { MSC4108RendezvousSession, MSC4108SecureChannel, PayloadType } from "../../../../src/rendezvous"; diff --git a/spec/unit/room-member.spec.ts b/spec/unit/room-member.spec.ts index 2b0e223f9..55e77558e 100644 --- a/spec/unit/room-member.spec.ts +++ b/spec/unit/room-member.spec.ts @@ -21,8 +21,8 @@ import { RoomMember, RoomMemberEvent } from "../../src/models/room-member"; import { createClient, EventType, - MatrixClient, - RoomState, + type MatrixClient, + type RoomState, UNSTABLE_MSC2666_MUTUAL_ROOMS, UNSTABLE_MSC2666_QUERY_MUTUAL_ROOMS, UNSTABLE_MSC2666_SHARED_ROOMS, diff --git a/spec/unit/room-state.spec.ts b/spec/unit/room-state.spec.ts index 9e0c29f35..ab8ecda9a 100644 --- a/spec/unit/room-state.spec.ts +++ b/spec/unit/room-state.spec.ts @@ -14,17 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MockedObject } from "jest-mock"; +import { type MockedObject } from "jest-mock"; import * as utils from "../test-utils/test-utils"; import { makeBeaconEvent, makeBeaconInfoEvent } from "../test-utils/beacon"; import { filterEmitCallsByEventType } from "../test-utils/emitter"; import { RoomState, RoomStateEvent } from "../../src/models/room-state"; -import { Beacon, BeaconEvent, getBeaconInfoIdentifier } from "../../src/models/beacon"; +import { type Beacon, BeaconEvent, getBeaconInfoIdentifier } from "../../src/models/beacon"; import { EventType, RelationType, UNSTABLE_MSC2716_MARKER } from "../../src/@types/event"; import { MatrixEvent, MatrixEventEvent } from "../../src/models/event"; import { M_BEACON } from "../../src/@types/beacon"; -import { MatrixClient } from "../../src/client"; +import { type MatrixClient } from "../../src/client"; import { defer } from "../../src/utils"; import { Room } from "../../src/models/room"; import { KnownMembership } from "../../src/@types/membership"; diff --git a/spec/unit/room.spec.ts b/spec/unit/room.spec.ts index 9a31e492f..f7a694c91 100644 --- a/spec/unit/room.spec.ts +++ b/spec/unit/room.spec.ts @@ -19,41 +19,41 @@ limitations under the License. */ import { mocked } from "jest-mock"; -import { M_POLL_KIND_DISCLOSED, M_POLL_RESPONSE, M_POLL_START, Optional, PollStartEvent } from "matrix-events-sdk"; +import { M_POLL_KIND_DISCLOSED, M_POLL_RESPONSE, M_POLL_START, type Optional, PollStartEvent } from "matrix-events-sdk"; import * as utils from "../test-utils/test-utils"; -import { emitPromise, IMessageOpts } from "../test-utils/test-utils"; +import { emitPromise, type IMessageOpts } from "../test-utils/test-utils"; import { Direction, DuplicateStrategy, EventStatus, - EventTimelineSet, + type EventTimelineSet, EventType, Filter, FILTER_RELATED_BY_REL_TYPES, FILTER_RELATED_BY_SENDERS, - IContent, - IEvent, - IRelationsRequestOpts, - IStateEventWithRoomId, + type IContent, + type IEvent, + type IRelationsRequestOpts, + type IStateEventWithRoomId, JoinRule, - MatrixClient, + type MatrixClient, MatrixEvent, MatrixEventEvent, PendingEventOrdering, PollEvent, RelationType, RoomEvent, - RoomMember, + type RoomMember, } from "../../src"; import { EventTimeline } from "../../src/models/event-timeline"; import { NotificationCountType, Room } from "../../src/models/room"; import { RoomState } from "../../src/models/room-state"; import { UNSTABLE_ELEMENT_FUNCTIONAL_USERS } from "../../src/@types/event"; import { TestClient } from "../TestClient"; -import { ReceiptType, WrappedReceipt } from "../../src/@types/read_receipts"; +import { ReceiptType, type WrappedReceipt } from "../../src/@types/read_receipts"; import { FeatureSupport, Thread, THREAD_RELATION_TYPE, ThreadEvent } from "../../src/models/thread"; -import { Crypto } from "../../src/crypto"; +import { type Crypto } from "../../src/crypto"; import * as threadUtils from "../test-utils/thread"; import { getMockClientWithEventEmitter, mockClientMethodsUser } from "../test-utils/client"; import { logger } from "../../src/logger"; diff --git a/spec/unit/rust-crypto/CrossSigningIdentity.spec.ts b/spec/unit/rust-crypto/CrossSigningIdentity.spec.ts index 6c7b33ea0..1a60ff889 100644 --- a/spec/unit/rust-crypto/CrossSigningIdentity.spec.ts +++ b/spec/unit/rust-crypto/CrossSigningIdentity.spec.ts @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Mocked } from "jest-mock"; +import { type Mocked } from "jest-mock"; import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; import { CrossSigningIdentity } from "../../../src/rust-crypto/CrossSigningIdentity"; -import { OutgoingRequestProcessor } from "../../../src/rust-crypto/OutgoingRequestProcessor"; -import { ServerSideSecretStorage } from "../../../src/secret-storage"; +import { type OutgoingRequestProcessor } from "../../../src/rust-crypto/OutgoingRequestProcessor"; +import { type ServerSideSecretStorage } from "../../../src/secret-storage"; describe("CrossSigningIdentity", () => { describe("bootstrapCrossSigning", () => { diff --git a/spec/unit/rust-crypto/KeyClaimManager.spec.ts b/spec/unit/rust-crypto/KeyClaimManager.spec.ts index f2ad04cac..9fff0765d 100644 --- a/spec/unit/rust-crypto/KeyClaimManager.spec.ts +++ b/spec/unit/rust-crypto/KeyClaimManager.spec.ts @@ -14,15 +14,15 @@ See the License for the specific language governing permissions and limitations under the License. */ -import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; import fetchMock from "fetch-mock-jest"; -import { Mocked } from "jest-mock"; +import { type Mocked } from "jest-mock"; import { KeysClaimRequest, UserId } from "@matrix-org/matrix-sdk-crypto-wasm"; +import type * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; import { OutgoingRequestProcessor } from "../../../src/rust-crypto/OutgoingRequestProcessor"; import { KeyClaimManager } from "../../../src/rust-crypto/KeyClaimManager"; import { TypedEventEmitter } from "../../../src/models/typed-event-emitter"; -import { HttpApiEvent, HttpApiEventHandlerMap, MatrixHttpApi } from "../../../src"; +import { type HttpApiEvent, type HttpApiEventHandlerMap, MatrixHttpApi } from "../../../src"; import { logger, LogSpan } from "../../../src/logger"; afterEach(() => { diff --git a/spec/unit/rust-crypto/OutgoingRequestProcessor.spec.ts b/spec/unit/rust-crypto/OutgoingRequestProcessor.spec.ts index 959917b13..b07a5eab5 100644 --- a/spec/unit/rust-crypto/OutgoingRequestProcessor.spec.ts +++ b/spec/unit/rust-crypto/OutgoingRequestProcessor.spec.ts @@ -15,7 +15,7 @@ limitations under the License. */ import MockHttpBackend from "matrix-mock-request"; -import { Mocked } from "jest-mock"; +import { type Mocked } from "jest-mock"; import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; import { KeysBackupRequest, @@ -31,7 +31,13 @@ import { import fetchMock from "fetch-mock-jest"; import { TypedEventEmitter } from "../../../src"; -import { HttpApiEvent, HttpApiEventHandlerMap, IHttpOpts, MatrixHttpApi, UIAuthCallback } from "../../../src"; +import { + type HttpApiEvent, + type HttpApiEventHandlerMap, + type IHttpOpts, + MatrixHttpApi, + type UIAuthCallback, +} from "../../../src"; import { OutgoingRequestProcessor } from "../../../src/rust-crypto/OutgoingRequestProcessor"; import { defer } from "../../../src/utils"; diff --git a/spec/unit/rust-crypto/OutgoingRequestsManager.spec.ts b/spec/unit/rust-crypto/OutgoingRequestsManager.spec.ts index 9c59c2f41..9287b7912 100644 --- a/spec/unit/rust-crypto/OutgoingRequestsManager.spec.ts +++ b/spec/unit/rust-crypto/OutgoingRequestsManager.spec.ts @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Mocked } from "jest-mock"; +import { type Mocked } from "jest-mock"; import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; -import { OutgoingRequest, OutgoingRequestProcessor } from "../../../src/rust-crypto/OutgoingRequestProcessor"; +import { type OutgoingRequest, type OutgoingRequestProcessor } from "../../../src/rust-crypto/OutgoingRequestProcessor"; import { OutgoingRequestsManager } from "../../../src/rust-crypto/OutgoingRequestsManager"; -import { defer, IDeferred } from "../../../src/utils"; +import { defer, type IDeferred } from "../../../src/utils"; import { logger } from "../../../src/logger"; describe("OutgoingRequestsManager", () => { diff --git a/spec/unit/rust-crypto/PerSessionKeyBackupDownloader.spec.ts b/spec/unit/rust-crypto/PerSessionKeyBackupDownloader.spec.ts index 5a4fe4bf7..5a2fba181 100644 --- a/spec/unit/rust-crypto/PerSessionKeyBackupDownloader.spec.ts +++ b/spec/unit/rust-crypto/PerSessionKeyBackupDownloader.spec.ts @@ -14,28 +14,32 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Mocked, SpyInstance } from "jest-mock"; +import { type Mocked, type SpyInstance } from "jest-mock"; import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; -import { OlmMachine } from "@matrix-org/matrix-sdk-crypto-wasm"; +import { type OlmMachine } from "@matrix-org/matrix-sdk-crypto-wasm"; import fetchMock from "fetch-mock-jest"; import { PerSessionKeyBackupDownloader } from "../../../src/rust-crypto/PerSessionKeyBackupDownloader"; import { logger } from "../../../src/logger"; -import { defer, IDeferred } from "../../../src/utils"; -import { RustBackupCryptoEventMap, RustBackupCryptoEvents, RustBackupManager } from "../../../src/rust-crypto/backup"; +import { defer, type IDeferred } from "../../../src/utils"; +import { + type RustBackupCryptoEventMap, + type RustBackupCryptoEvents, + type RustBackupManager, +} from "../../../src/rust-crypto/backup"; import * as TestData from "../../test-utils/test-data"; import { ConnectionError, - HttpApiEvent, - HttpApiEventHandlerMap, - IHttpOpts, - IMegolmSessionData, + type HttpApiEvent, + type HttpApiEventHandlerMap, + type IHttpOpts, + type IMegolmSessionData, MatrixHttpApi, TypedEventEmitter, } from "../../../src"; import * as testData from "../../test-utils/test-data"; -import { BackupDecryptor } from "../../../src/common-crypto/CryptoBackend"; -import { KeyBackupSession } from "../../../src/crypto-api/keybackup"; +import { type BackupDecryptor } from "../../../src/common-crypto/CryptoBackend"; +import { type KeyBackupSession } from "../../../src/crypto-api/keybackup"; import { CryptoEvent } from "../../../src/crypto-api/index.ts"; describe("PerSessionKeyBackupDownloader", () => { diff --git a/spec/unit/rust-crypto/RoomEncryptor.spec.ts b/spec/unit/rust-crypto/RoomEncryptor.spec.ts index 7e20a9504..27b37e027 100644 --- a/spec/unit/rust-crypto/RoomEncryptor.spec.ts +++ b/spec/unit/rust-crypto/RoomEncryptor.spec.ts @@ -18,21 +18,25 @@ import { CollectStrategy, - Curve25519PublicKey, - Ed25519PublicKey, + type Curve25519PublicKey, + type Ed25519PublicKey, HistoryVisibility as RustHistoryVisibility, - IdentityKeys, - OlmMachine, + type IdentityKeys, + type OlmMachine, } from "@matrix-org/matrix-sdk-crypto-wasm"; -import { Mocked } from "jest-mock"; +import { type Mocked } from "jest-mock"; -import { HistoryVisibility, MatrixEvent, Room, RoomMember } from "../../../src"; +import { HistoryVisibility, type MatrixEvent, type Room, type RoomMember } from "../../../src"; import { RoomEncryptor, toRustHistoryVisibility } from "../../../src/rust-crypto/RoomEncryptor"; -import { KeyClaimManager } from "../../../src/rust-crypto/KeyClaimManager"; +import { type KeyClaimManager } from "../../../src/rust-crypto/KeyClaimManager"; import { defer } from "../../../src/utils"; -import { OutgoingRequestsManager } from "../../../src/rust-crypto/OutgoingRequestsManager"; +import { type OutgoingRequestsManager } from "../../../src/rust-crypto/OutgoingRequestsManager"; import { KnownMembership } from "../../../src/@types/membership"; -import { DeviceIsolationMode, AllDevicesIsolationMode, OnlySignedDevicesIsolationMode } from "../../../src/crypto-api"; +import { + type DeviceIsolationMode, + AllDevicesIsolationMode, + OnlySignedDevicesIsolationMode, +} from "../../../src/crypto-api"; describe("RoomEncryptor", () => { describe("History Visibility", () => { diff --git a/spec/unit/rust-crypto/backup.spec.ts b/spec/unit/rust-crypto/backup.spec.ts index ab5b740ee..e95ba29ee 100644 --- a/spec/unit/rust-crypto/backup.spec.ts +++ b/spec/unit/rust-crypto/backup.spec.ts @@ -1,13 +1,13 @@ -import { Mocked } from "jest-mock"; +import { type Mocked } from "jest-mock"; import fetchMock from "fetch-mock-jest"; import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; -import { HttpApiEvent, HttpApiEventHandlerMap, MatrixHttpApi, TypedEventEmitter } from "../../../src"; -import { CryptoEvent, KeyBackupSession } from "../../../src/crypto-api/index.ts"; -import { OutgoingRequestProcessor } from "../../../src/rust-crypto/OutgoingRequestProcessor"; +import { type HttpApiEvent, type HttpApiEventHandlerMap, MatrixHttpApi, TypedEventEmitter } from "../../../src"; +import { CryptoEvent, type KeyBackupSession } from "../../../src/crypto-api/index.ts"; +import { type OutgoingRequestProcessor } from "../../../src/rust-crypto/OutgoingRequestProcessor"; import * as testData from "../../test-utils/test-data"; import * as TestData from "../../test-utils/test-data"; -import { RustBackupManager, KeyBackup } from "../../../src/rust-crypto/backup"; +import { RustBackupManager, type KeyBackup } from "../../../src/rust-crypto/backup"; describe("Upload keys to backup", () => { /** The backup manager under test */ diff --git a/spec/unit/rust-crypto/device-converter.spec.ts b/spec/unit/rust-crypto/device-converter.spec.ts index 5fffb5322..514ed69aa 100644 --- a/spec/unit/rust-crypto/device-converter.spec.ts +++ b/spec/unit/rust-crypto/device-converter.spec.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { DeviceKeys, DeviceVerification } from "../../../src"; +import { type DeviceKeys, DeviceVerification } from "../../../src"; import { downloadDeviceToJsDevice } from "../../../src/rust-crypto/device-converter"; describe("device-converter", () => { diff --git a/spec/unit/rust-crypto/rust-crypto.spec.ts b/spec/unit/rust-crypto/rust-crypto.spec.ts index 52eb8bfe9..d124d12bf 100644 --- a/spec/unit/rust-crypto/rust-crypto.spec.ts +++ b/spec/unit/rust-crypto/rust-crypto.spec.ts @@ -20,50 +20,50 @@ import { KeysQueryRequest, Migration, OlmMachine, - PickledInboundGroupSession, - PickledSession, + type PickledInboundGroupSession, + type PickledSession, StoreHandle, } from "@matrix-org/matrix-sdk-crypto-wasm"; -import { mocked, Mocked } from "jest-mock"; +import { mocked, type Mocked } from "jest-mock"; import fetchMock from "fetch-mock-jest"; import { RustCrypto } from "../../../src/rust-crypto/rust-crypto"; import { initRustCrypto } from "../../../src/rust-crypto"; import { - AccountDataEvents, - Device, + type AccountDataEvents, + type Device, DeviceVerification, - EmptyObject, + type EmptyObject, encodeBase64, - HttpApiEvent, - HttpApiEventHandlerMap, - IHttpOpts, - IToDeviceEvent, - MatrixClient, + type HttpApiEvent, + type HttpApiEventHandlerMap, + type IHttpOpts, + type IToDeviceEvent, + type MatrixClient, MatrixEvent, MatrixHttpApi, MemoryCryptoStore, TypedEventEmitter, } from "../../../src"; import { emitPromise, mkEvent } from "../../test-utils/test-utils"; -import { CryptoBackend } from "../../../src/common-crypto/CryptoBackend"; -import { IEventDecryptionResult, IMegolmSessionData } from "../../../src/@types/crypto"; -import { OutgoingRequestProcessor } from "../../../src/rust-crypto/OutgoingRequestProcessor"; +import { type CryptoBackend } from "../../../src/common-crypto/CryptoBackend"; +import { type IEventDecryptionResult, type IMegolmSessionData } from "../../../src/@types/crypto"; +import { type OutgoingRequestProcessor } from "../../../src/rust-crypto/OutgoingRequestProcessor"; import { - AccountDataClient, - AddSecretStorageKeyOpts, - SecretStorageCallbacks, - ServerSideSecretStorage, + type AccountDataClient, + type AddSecretStorageKeyOpts, + type SecretStorageCallbacks, + type ServerSideSecretStorage, ServerSideSecretStorageImpl, } from "../../../src/secret-storage"; import { - CryptoCallbacks, + type CryptoCallbacks, EventShieldColour, EventShieldReason, - ImportRoomKeysOpts, - KeyBackupCheck, - KeyBackupInfo, - VerificationRequest, + type ImportRoomKeysOpts, + type KeyBackupCheck, + type KeyBackupInfo, + type VerificationRequest, } from "../../../src/crypto-api"; import * as testData from "../../test-utils/test-data"; import { E2EKeyReceiver } from "../../test-utils/E2EKeyReceiver"; @@ -71,10 +71,10 @@ import { E2EKeyResponder } from "../../test-utils/E2EKeyResponder"; import { defer } from "../../../src/utils"; import { logger } from "../../../src/logger"; import { OutgoingRequestsManager } from "../../../src/rust-crypto/OutgoingRequestsManager"; -import { ClientEvent, ClientEventHandlerMap } from "../../../src/client"; -import { Curve25519AuthData } from "../../../src/crypto-api/keybackup"; +import { ClientEvent, type ClientEventHandlerMap } from "../../../src/client"; +import { type Curve25519AuthData } from "../../../src/crypto-api/keybackup"; import encryptAESSecretStorageItem from "../../../src/utils/encryptAESSecretStorageItem.ts"; -import { CryptoStore, SecretStorePrivateKeys } from "../../../src/crypto/store/base"; +import { type CryptoStore, type SecretStorePrivateKeys } from "../../../src/crypto/store/base"; import { CryptoEvent } from "../../../src/crypto-api/index.ts"; import { RustBackupManager } from "../../../src/rust-crypto/backup.ts"; diff --git a/spec/unit/rust-crypto/secret-storage.spec.ts b/spec/unit/rust-crypto/secret-storage.spec.ts index e54461a26..86b190dd7 100644 --- a/spec/unit/rust-crypto/secret-storage.spec.ts +++ b/spec/unit/rust-crypto/secret-storage.spec.ts @@ -18,8 +18,8 @@ import { secretStorageCanAccessSecrets, secretStorageContainsCrossSigningKeys, } from "../../../src/rust-crypto/secret-storage"; -import { ServerSideSecretStorage } from "../../../src/secret-storage"; -import { SecretInfo } from "../../../src/secret-storage.ts"; +import { type ServerSideSecretStorage } from "../../../src/secret-storage"; +import { type SecretInfo } from "../../../src/secret-storage.ts"; declare module "../../../src/@types/event" { interface SecretStorageAccountDataEvents { diff --git a/spec/unit/rust-crypto/verification.spec.ts b/spec/unit/rust-crypto/verification.spec.ts index 1579ee6a8..68890129b 100644 --- a/spec/unit/rust-crypto/verification.spec.ts +++ b/spec/unit/rust-crypto/verification.spec.ts @@ -15,7 +15,7 @@ limitations under the License. */ import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; -import { Mocked } from "jest-mock"; +import { type Mocked } from "jest-mock"; import { isVerificationEvent, @@ -23,13 +23,13 @@ import { verificationMethodIdentifierToMethod, } from "../../../src/rust-crypto/verification"; import { - ShowSasCallbacks, + type ShowSasCallbacks, VerificationRequestEvent, - Verifier, + type Verifier, VerifierEvent, } from "../../../src/crypto-api/verification"; -import { OutgoingRequest, OutgoingRequestProcessor } from "../../../src/rust-crypto/OutgoingRequestProcessor"; -import { IDeviceKeys } from "../../../src/@types/crypto"; +import { type OutgoingRequest, type OutgoingRequestProcessor } from "../../../src/rust-crypto/OutgoingRequestProcessor"; +import { type IDeviceKeys } from "../../../src/@types/crypto"; import { EventType, MatrixEvent, MsgType } from "../../../src"; describe("VerificationRequest", () => { diff --git a/spec/unit/scheduler.spec.ts b/spec/unit/scheduler.spec.ts index e37a3b382..3972a47a9 100644 --- a/spec/unit/scheduler.spec.ts +++ b/spec/unit/scheduler.spec.ts @@ -1,11 +1,11 @@ // This file had a function whose name is all caps, which displeases eslint /* eslint new-cap: "off" */ -import { defer, IDeferred } from "../../src/utils"; +import { defer, type IDeferred } from "../../src/utils"; import { MatrixError } from "../../src/http-api"; import { MatrixScheduler } from "../../src/scheduler"; import * as utils from "../test-utils/test-utils"; -import { MatrixEvent } from "../../src"; +import { type MatrixEvent } from "../../src"; import { KnownMembership } from "../../src/@types/membership"; jest.useFakeTimers(); diff --git a/spec/unit/secret-storage.spec.ts b/spec/unit/secret-storage.spec.ts index 2e262c290..13094bf10 100644 --- a/spec/unit/secret-storage.spec.ts +++ b/spec/unit/secret-storage.spec.ts @@ -14,23 +14,23 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Mocked } from "jest-mock"; +import { type Mocked } from "jest-mock"; import { - AccountDataClient, + type AccountDataClient, calculateKeyCheck, - PassphraseInfo, - SecretStorageCallbacks, - SecretStorageKeyDescriptionAesV1, - SecretStorageKeyDescriptionCommon, - ServerSideSecretStorage, + type PassphraseInfo, + type SecretStorageCallbacks, + type SecretStorageKeyDescriptionAesV1, + type SecretStorageKeyDescriptionCommon, + type ServerSideSecretStorage, ServerSideSecretStorageImpl, trimTrailingEquals, } from "../../src/secret-storage"; import { secureRandomString } from "../../src/randomstring"; -import { SecretInfo } from "../../src/secret-storage.ts"; -import { AccountDataEvents, ClientEvent, MatrixEvent, TypedEventEmitter } from "../../src"; -import { defer, IDeferred } from "../../src/utils"; +import { type SecretInfo } from "../../src/secret-storage.ts"; +import { type AccountDataEvents, ClientEvent, MatrixEvent, TypedEventEmitter } from "../../src"; +import { defer, type IDeferred } from "../../src/utils"; declare module "../../src/@types/event" { interface SecretStorageAccountDataEvents { diff --git a/spec/unit/stores/indexeddb-store-worker.spec.ts b/spec/unit/stores/indexeddb-store-worker.spec.ts index 536327d2e..af0b345fc 100644 --- a/spec/unit/stores/indexeddb-store-worker.spec.ts +++ b/spec/unit/stores/indexeddb-store-worker.spec.ts @@ -16,7 +16,7 @@ limitations under the License. import "fake-indexeddb/auto"; -import { LocalIndexedDBStoreBackend } from "../../../src/store/indexeddb-local-backend"; +import { type LocalIndexedDBStoreBackend } from "../../../src/store/indexeddb-local-backend"; import { IndexedDBStoreWorker } from "../../../src/store/indexeddb-store-worker"; import { defer } from "../../../src/utils"; diff --git a/spec/unit/stores/indexeddb.spec.ts b/spec/unit/stores/indexeddb.spec.ts index 74e4562bf..7d0108fb7 100644 --- a/spec/unit/stores/indexeddb.spec.ts +++ b/spec/unit/stores/indexeddb.spec.ts @@ -18,9 +18,9 @@ import "fake-indexeddb/auto"; import "jest-localstorage-mock"; import { IDBFactory } from "fake-indexeddb"; -import { IndexedDBStore, IStateEventWithRoomId, MemoryStore, User, UserEvent } from "../../../src"; +import { IndexedDBStore, type IStateEventWithRoomId, MemoryStore, User, UserEvent } from "../../../src"; import { emitPromise } from "../../test-utils/test-utils"; -import { LocalIndexedDBStoreBackend } from "../../../src/store/indexeddb-local-backend"; +import { type LocalIndexedDBStoreBackend } from "../../../src/store/indexeddb-local-backend"; import { defer } from "../../../src/utils"; describe("IndexedDBStore", () => { diff --git a/spec/unit/sync-accumulator.spec.ts b/spec/unit/sync-accumulator.spec.ts index 8ece656e8..89623eeee 100644 --- a/spec/unit/sync-accumulator.spec.ts +++ b/spec/unit/sync-accumulator.spec.ts @@ -18,21 +18,21 @@ limitations under the License. import { ReceiptType } from "../../src/@types/read_receipts"; import { Category, - IInvitedRoom, - IInviteState, - IJoinedRoom, - IKnockedRoom, - IKnockState, - ILeftRoom, - IRoomEvent, - IStateEvent, - IStrippedState, - ISyncResponse, + type IInvitedRoom, + type IInviteState, + type IJoinedRoom, + type IKnockedRoom, + type IKnockState, + type ILeftRoom, + type IRoomEvent, + type IStateEvent, + type IStrippedState, + type ISyncResponse, SyncAccumulator, } from "../../src/sync-accumulator"; -import { IRoomSummary } from "../../src"; +import { type IRoomSummary } from "../../src"; import * as utils from "../test-utils/test-utils"; -import { KnownMembership, Membership } from "../../src/@types/membership"; +import { KnownMembership, type Membership } from "../../src/@types/membership"; // The event body & unsigned object get frozen to assert that they don't get altered // by the impl diff --git a/spec/unit/thread-utils.spec.ts b/spec/unit/thread-utils.spec.ts index 8bab97bd8..1b7e19d85 100644 --- a/spec/unit/thread-utils.spec.ts +++ b/spec/unit/thread-utils.spec.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IEvent } from "../../src"; +import { type IEvent } from "../../src"; import { secureRandomString } from "../../src/randomstring"; import { getRelationsThreadFilter } from "../../src/thread-utils"; diff --git a/spec/unit/timeline-window.spec.ts b/spec/unit/timeline-window.spec.ts index be52abe86..a59211779 100644 --- a/spec/unit/timeline-window.spec.ts +++ b/spec/unit/timeline-window.spec.ts @@ -14,15 +14,15 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MockedObject } from "jest-mock"; +import { type MockedObject } from "jest-mock"; -import { MatrixClient } from "../../src/client"; +import { type MatrixClient } from "../../src/client"; import { EventTimelineSet } from "../../src/models/event-timeline-set"; import { Room } from "../../src/models/room"; import { EventTimeline } from "../../src/models/event-timeline"; import { TimelineIndex, TimelineWindow } from "../../src/timeline-window"; import { mkMessage } from "../test-utils/test-utils"; -import { MatrixEvent } from "../../src/models/event"; +import { type MatrixEvent } from "../../src/models/event"; const ROOM_ID = "roomId"; const USER_ID = "userId"; diff --git a/spec/unit/webrtc/call.spec.ts b/spec/unit/webrtc/call.spec.ts index 922d63bd7..4157b146e 100644 --- a/spec/unit/webrtc/call.spec.ts +++ b/spec/unit/webrtc/call.spec.ts @@ -28,9 +28,9 @@ import { CallDirection, } from "../../../src/webrtc/call"; import { - MCallAnswer, - MCallHangupReject, - SDPStreamMetadata, + type MCallAnswer, + type MCallHangupReject, + type SDPStreamMetadata, SDPStreamMetadataKey, SDPStreamMetadataPurpose, } from "../../../src/webrtc/callEventTypes"; @@ -46,7 +46,7 @@ import { MockRTCRtpSender, } from "../../test-utils/webrtc"; import { CallFeed } from "../../../src/webrtc/callFeed"; -import { EventType, IContent, ISendEventResponse, MatrixEvent, Room } from "../../../src"; +import { EventType, type IContent, type ISendEventResponse, type MatrixEvent, type Room } from "../../../src"; import { emitPromise } from "../../test-utils/test-utils"; const FAKE_ROOM_ID = "!foo:bar"; diff --git a/spec/unit/webrtc/callEventHandler.spec.ts b/spec/unit/webrtc/callEventHandler.spec.ts index 82826363b..2873da5ba 100644 --- a/spec/unit/webrtc/callEventHandler.spec.ts +++ b/spec/unit/webrtc/callEventHandler.spec.ts @@ -22,14 +22,14 @@ import { EventType, GroupCallIntent, GroupCallType, - IRoomTimelineData, - MatrixCall, + type IRoomTimelineData, + type MatrixCall, MatrixEvent, Room, RoomEvent, - RoomMember, + type RoomMember, } from "../../../src"; -import { MatrixClient } from "../../../src/client"; +import { type MatrixClient } from "../../../src/client"; import { CallEventHandler, CallEventHandlerEvent } from "../../../src/webrtc/callEventHandler"; import { GroupCallEventHandler } from "../../../src/webrtc/groupCallEventHandler"; import { SyncState } from "../../../src/sync"; diff --git a/spec/unit/webrtc/groupCall.spec.ts b/spec/unit/webrtc/groupCall.spec.ts index 669542e76..0eb88c0a2 100644 --- a/spec/unit/webrtc/groupCall.spec.ts +++ b/spec/unit/webrtc/groupCall.spec.ts @@ -16,10 +16,18 @@ limitations under the License. import { mocked } from "jest-mock"; -import { EventType, GroupCallIntent, GroupCallType, MatrixCall, MatrixEvent, Room, RoomMember } from "../../../src"; +import { + EventType, + GroupCallIntent, + GroupCallType, + type MatrixCall, + MatrixEvent, + Room, + type RoomMember, +} from "../../../src"; import { RoomStateEvent } from "../../../src/models/room-state"; import { GroupCall, GroupCallEvent, GroupCallState, GroupCallStatsReportEvent } from "../../../src/webrtc/groupCall"; -import { IMyDevice, MatrixClient } from "../../../src/client"; +import { type IMyDevice, MatrixClient } from "../../../src/client"; import { FAKE_CONF_ID, FAKE_DEVICE_ID_1, @@ -44,9 +52,9 @@ import { CallEventHandlerEvent } from "../../../src/webrtc/callEventHandler"; import { CallFeed } from "../../../src/webrtc/callFeed"; import { CallEvent, CallState } from "../../../src/webrtc/call"; import { flushPromises } from "../../test-utils/flushPromises"; -import { CallFeedReport } from "../../../src/webrtc/stats/statsReport"; +import { type CallFeedReport } from "../../../src/webrtc/stats/statsReport"; import { CallFeedStatsReporter } from "../../../src/webrtc/stats/callFeedStatsReporter"; -import { StatsReportEmitter } from "../../../src/webrtc/stats/statsReportEmitter"; +import { type StatsReportEmitter } from "../../../src/webrtc/stats/statsReportEmitter"; import { KnownMembership } from "../../../src/@types/membership"; const FAKE_STATE_EVENTS = [ diff --git a/spec/unit/webrtc/groupCallEventHandler.spec.ts b/spec/unit/webrtc/groupCallEventHandler.spec.ts index 850ba4037..a8ebec056 100644 --- a/spec/unit/webrtc/groupCallEventHandler.spec.ts +++ b/spec/unit/webrtc/groupCallEventHandler.spec.ts @@ -17,7 +17,7 @@ limitations under the License. import { mocked } from "jest-mock"; import { ClientEvent } from "../../../src/client"; -import { RoomMember } from "../../../src/models/room-member"; +import { type RoomMember } from "../../../src/models/room-member"; import { SyncState } from "../../../src/sync"; import { GroupCallIntent, @@ -25,9 +25,9 @@ import { GroupCallType, GroupCallTerminationReason, } from "../../../src/webrtc/groupCall"; -import { IContent, MatrixEvent } from "../../../src/models/event"; -import { Room } from "../../../src/models/room"; -import { RoomState } from "../../../src/models/room-state"; +import { type IContent, type MatrixEvent } from "../../../src/models/event"; +import { type Room } from "../../../src/models/room"; +import { type RoomState } from "../../../src/models/room-state"; import { GroupCallEventHandler, GroupCallEventHandlerEvent } from "../../../src/webrtc/groupCallEventHandler"; import { flushPromises } from "../../test-utils/flushPromises"; import { makeMockGroupCallStateEvent, MockCallMatrixClient } from "../../test-utils/webrtc"; diff --git a/spec/unit/webrtc/mediaHandler.spec.ts b/spec/unit/webrtc/mediaHandler.spec.ts index 4d23ead5f..3e34f7dd4 100644 --- a/spec/unit/webrtc/mediaHandler.spec.ts +++ b/spec/unit/webrtc/mediaHandler.spec.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { GroupCall, MatrixCall, MatrixClient } from "../../../src"; +import { type GroupCall, type MatrixCall, type MatrixClient } from "../../../src"; import { MediaHandler, MediaHandlerEvent } from "../../../src/webrtc/mediaHandler"; import { MockMediaDeviceInfo, MockMediaDevices, MockMediaStream, MockMediaStreamTrack } from "../../test-utils/webrtc"; diff --git a/spec/unit/webrtc/stats/callFeedStatsReporter.spec.ts b/spec/unit/webrtc/stats/callFeedStatsReporter.spec.ts index 32e43ec3e..ab2e65bf0 100644 --- a/spec/unit/webrtc/stats/callFeedStatsReporter.spec.ts +++ b/spec/unit/webrtc/stats/callFeedStatsReporter.spec.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ import { CallFeedStatsReporter } from "../../../../src/webrtc/stats/callFeedStatsReporter"; -import { CallFeedReport } from "../../../../src/webrtc/stats/statsReport"; -import { CallFeed } from "../../../../src/webrtc/callFeed"; +import { type CallFeedReport } from "../../../../src/webrtc/stats/statsReport"; +import { type CallFeed } from "../../../../src/webrtc/callFeed"; const CALL_ID = "CALL_ID"; const USER_ID = "USER_ID"; diff --git a/spec/unit/webrtc/stats/callStatsReportGatherer.spec.ts b/spec/unit/webrtc/stats/callStatsReportGatherer.spec.ts index 0c9c943cb..a8ce554de 100644 --- a/spec/unit/webrtc/stats/callStatsReportGatherer.spec.ts +++ b/spec/unit/webrtc/stats/callStatsReportGatherer.spec.ts @@ -16,7 +16,7 @@ limitations under the License. import { CallStatsReportGatherer } from "../../../../src/webrtc/stats/callStatsReportGatherer"; import { StatsReportEmitter } from "../../../../src/webrtc/stats/statsReportEmitter"; -import { MediaSsrcHandler } from "../../../../src/webrtc/stats/media/mediaSsrcHandler"; +import { type MediaSsrcHandler } from "../../../../src/webrtc/stats/media/mediaSsrcHandler"; import { currentChromeReport, prevChromeReport } from "../../../test-utils/webrtcReports"; import { MockRTCPeerConnection } from "../../../test-utils/webrtc"; diff --git a/spec/unit/webrtc/stats/connectionStatsReportBuilder.spec.ts b/spec/unit/webrtc/stats/connectionStatsReportBuilder.spec.ts index d8fb9a756..aa7c241a1 100644 --- a/spec/unit/webrtc/stats/connectionStatsReportBuilder.spec.ts +++ b/spec/unit/webrtc/stats/connectionStatsReportBuilder.spec.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { TrackID } from "../../../../src/webrtc/stats/statsReport"; +import { type TrackID } from "../../../../src/webrtc/stats/statsReport"; import { MediaTrackStats } from "../../../../src/webrtc/stats/media/mediaTrackStats"; import { ConnectionStatsReportBuilder } from "../../../../src/webrtc/stats/connectionStatsReportBuilder"; diff --git a/spec/unit/webrtc/stats/groupCallStats.spec.ts b/spec/unit/webrtc/stats/groupCallStats.spec.ts index ae9714876..96ae2a3ca 100644 --- a/spec/unit/webrtc/stats/groupCallStats.spec.ts +++ b/spec/unit/webrtc/stats/groupCallStats.spec.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ import { GroupCallStats } from "../../../../src/webrtc/stats/groupCallStats"; -import { CallStatsReportSummary } from "../../../../src/webrtc/stats/callStatsReportSummary"; +import { type CallStatsReportSummary } from "../../../../src/webrtc/stats/callStatsReportSummary"; const GROUP_CALL_ID = "GROUP_ID"; const LOCAL_USER_ID = "LOCAL_USER_ID"; diff --git a/spec/unit/webrtc/stats/media/mediaSsrcHandler.spec.ts b/spec/unit/webrtc/stats/media/mediaSsrcHandler.spec.ts index 3a252afdb..d347149dd 100644 --- a/spec/unit/webrtc/stats/media/mediaSsrcHandler.spec.ts +++ b/spec/unit/webrtc/stats/media/mediaSsrcHandler.spec.ts @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -import { Mid, Ssrc, MediaSsrcHandler } from "../../../../../src/webrtc/stats/media/mediaSsrcHandler"; +import { type Mid, type Ssrc, MediaSsrcHandler } from "../../../../../src/webrtc/stats/media/mediaSsrcHandler"; import { REMOTE_SFU_DESCRIPTION } from "../../../../test-utils/webrtc"; describe("MediaSsrcHandler", () => { diff --git a/spec/unit/webrtc/stats/media/mediaTrackStatsHandler.spec.ts b/spec/unit/webrtc/stats/media/mediaTrackStatsHandler.spec.ts index 85fcc6151..30c26dc45 100644 --- a/spec/unit/webrtc/stats/media/mediaTrackStatsHandler.spec.ts +++ b/spec/unit/webrtc/stats/media/mediaTrackStatsHandler.spec.ts @@ -13,9 +13,9 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -import { MediaTrackHandler } from "../../../../../src/webrtc/stats/media/mediaTrackHandler"; +import { type MediaTrackHandler } from "../../../../../src/webrtc/stats/media/mediaTrackHandler"; import { MediaTrackStatsHandler } from "../../../../../src/webrtc/stats/media/mediaTrackStatsHandler"; -import { MediaSsrcHandler } from "../../../../../src/webrtc/stats/media/mediaSsrcHandler"; +import { type MediaSsrcHandler } from "../../../../../src/webrtc/stats/media/mediaSsrcHandler"; describe("MediaTrackStatsHandler", () => { let statsHandler: MediaTrackStatsHandler; diff --git a/spec/unit/webrtc/stats/statsReportEmitter.spec.ts b/spec/unit/webrtc/stats/statsReportEmitter.spec.ts index c5237fd19..3f3ab7a21 100644 --- a/spec/unit/webrtc/stats/statsReportEmitter.spec.ts +++ b/spec/unit/webrtc/stats/statsReportEmitter.spec.ts @@ -15,11 +15,11 @@ limitations under the License. */ import { StatsReportEmitter } from "../../../../src/webrtc/stats/statsReportEmitter"; import { - ByteSentStatsReport, - CallFeedReport, - ConnectionStatsReport, + type ByteSentStatsReport, + type CallFeedReport, + type ConnectionStatsReport, StatsReport, - SummaryStatsReport, + type SummaryStatsReport, } from "../../../../src/webrtc/stats/statsReport"; describe("StatsReportEmitter", () => { diff --git a/spec/unit/webrtc/stats/transportStatsBuilder.spec.ts b/spec/unit/webrtc/stats/transportStatsBuilder.spec.ts index 17283f31e..cd55e0fca 100644 --- a/spec/unit/webrtc/stats/transportStatsBuilder.spec.ts +++ b/spec/unit/webrtc/stats/transportStatsBuilder.spec.ts @@ -15,7 +15,7 @@ limitations under the License. */ import { TransportStatsBuilder } from "../../../../src/webrtc/stats/transportStatsBuilder"; -import { TransportStats } from "../../../../src/webrtc/stats/transportStats"; +import { type TransportStats } from "../../../../src/webrtc/stats/transportStats"; describe("TransportStatsReporter", () => { describe("should on build report", () => { diff --git a/src/@types/auth.ts b/src/@types/auth.ts index 27b220db3..d3782e17c 100644 --- a/src/@types/auth.ts +++ b/src/@types/auth.ts @@ -15,7 +15,7 @@ limitations under the License. */ import { UnstableValue } from "../NamespacedValue.ts"; -import { IClientWellKnown } from "../client.ts"; +import { type IClientWellKnown } from "../client.ts"; // disable lint because these are wire responses /* eslint-disable camelcase */ diff --git a/src/@types/beacon.ts b/src/@types/beacon.ts index 2bcc6260c..fa34a9e08 100644 --- a/src/@types/beacon.ts +++ b/src/@types/beacon.ts @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { RelatesToRelationship, REFERENCE_RELATION } from "./extensible_events.ts"; +import { type RelatesToRelationship, type REFERENCE_RELATION } from "./extensible_events.ts"; import { UnstableValue } from "../NamespacedValue.ts"; -import { MAssetEvent, MLocationEvent, MTimestampEvent } from "./location.ts"; +import { type MAssetEvent, type MLocationEvent, type MTimestampEvent } from "./location.ts"; /** * Beacon info and beacon event types as described in MSC3672 diff --git a/src/@types/event.ts b/src/@types/event.ts index edbb3b79b..00f62a260 100644 --- a/src/@types/event.ts +++ b/src/@types/event.ts @@ -16,48 +16,48 @@ limitations under the License. import { NamespacedValue, UnstableValue } from "../NamespacedValue.ts"; import { - PolicyRuleEventContent, - RoomAvatarEventContent, - RoomCanonicalAliasEventContent, - RoomCreateEventContent, - RoomEncryptionEventContent, - RoomGuestAccessEventContent, - RoomHistoryVisibilityEventContent, - RoomJoinRulesEventContent, - RoomMemberEventContent, - RoomNameEventContent, - RoomPinnedEventsEventContent, - RoomPowerLevelsEventContent, - RoomServerAclEventContent, - RoomThirdPartyInviteEventContent, - RoomTombstoneEventContent, - RoomTopicEventContent, - SpaceChildEventContent, - SpaceParentEventContent, + type PolicyRuleEventContent, + type RoomAvatarEventContent, + type RoomCanonicalAliasEventContent, + type RoomCreateEventContent, + type RoomEncryptionEventContent, + type RoomGuestAccessEventContent, + type RoomHistoryVisibilityEventContent, + type RoomJoinRulesEventContent, + type RoomMemberEventContent, + type RoomNameEventContent, + type RoomPinnedEventsEventContent, + type RoomPowerLevelsEventContent, + type RoomServerAclEventContent, + type RoomThirdPartyInviteEventContent, + type RoomTombstoneEventContent, + type RoomTopicEventContent, + type SpaceChildEventContent, + type SpaceParentEventContent, } from "./state_events.ts"; -import { IGroupCallRoomMemberState, IGroupCallRoomState } from "../webrtc/groupCall.ts"; -import { MSC3089EventContent } from "../models/MSC3089Branch.ts"; -import { M_BEACON, M_BEACON_INFO, MBeaconEventContent, MBeaconInfoEventContent } from "./beacon.ts"; -import { EmptyObject } from "./common.ts"; -import { ReactionEventContent, RoomMessageEventContent, StickerEventContent } from "./events.ts"; +import { type IGroupCallRoomMemberState, type IGroupCallRoomState } from "../webrtc/groupCall.ts"; +import { type MSC3089EventContent } from "../models/MSC3089Branch.ts"; +import { type M_BEACON, type M_BEACON_INFO, type MBeaconEventContent, type MBeaconInfoEventContent } from "./beacon.ts"; +import { type EmptyObject } from "./common.ts"; +import { type ReactionEventContent, type RoomMessageEventContent, type StickerEventContent } from "./events.ts"; import { - MCallAnswer, - MCallBase, - MCallCandidates, - MCallHangupReject, - MCallInviteNegotiate, - MCallReplacesEvent, - MCallSelectAnswer, - SDPStreamMetadata, - SDPStreamMetadataKey, + type MCallAnswer, + type MCallBase, + type MCallCandidates, + type MCallHangupReject, + type MCallInviteNegotiate, + type MCallReplacesEvent, + type MCallSelectAnswer, + type SDPStreamMetadata, + type SDPStreamMetadataKey, } from "../webrtc/callEventTypes.ts"; -import { EncryptionKeysEventContent, ICallNotifyContent } from "../matrixrtc/types.ts"; -import { M_POLL_END, M_POLL_START, PollEndEventContent, PollStartEventContent } from "./polls.ts"; -import { SessionMembershipData } from "../matrixrtc/CallMembership.ts"; -import { LocalNotificationSettings } from "./local_notifications.ts"; -import { IPushRules } from "./PushRules.ts"; -import { SecretInfo, SecretStorageKeyDescription } from "../secret-storage.ts"; -import { POLICIES_ACCOUNT_EVENT_TYPE } from "../models/invites-ignorer-types.ts"; +import { type EncryptionKeysEventContent, type ICallNotifyContent } from "../matrixrtc/types.ts"; +import { type M_POLL_END, type M_POLL_START, type PollEndEventContent, type PollStartEventContent } from "./polls.ts"; +import { type SessionMembershipData } from "../matrixrtc/CallMembership.ts"; +import { type LocalNotificationSettings } from "./local_notifications.ts"; +import { type IPushRules } from "./PushRules.ts"; +import { type SecretInfo, type SecretStorageKeyDescription } from "../secret-storage.ts"; +import { type POLICIES_ACCOUNT_EVENT_TYPE } from "../models/invites-ignorer-types.ts"; export enum EventType { // Room state events diff --git a/src/@types/events.ts b/src/@types/events.ts index 55af87252..001cdaf22 100644 --- a/src/@types/events.ts +++ b/src/@types/events.ts @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MsgType, RelationType } from "./event.ts"; -import { FileInfo, ImageInfo, MediaEventContent } from "./media.ts"; -import { XOR } from "./common.ts"; +import { type MsgType, type RelationType } from "./event.ts"; +import { type FileInfo, type ImageInfo, type MediaEventContent } from "./media.ts"; +import { type XOR } from "./common.ts"; interface BaseTimelineEvent { "body": string; diff --git a/src/@types/extensible_events.ts b/src/@types/extensible_events.ts index d6d4f0cb8..efd8f5145 100644 --- a/src/@types/extensible_events.ts +++ b/src/@types/extensible_events.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { EitherAnd, NamespacedValue, Optional, UnstableValue } from "matrix-events-sdk"; +import { type EitherAnd, NamespacedValue, type Optional, UnstableValue } from "matrix-events-sdk"; import { isProvided } from "../extensible_events_v1/utilities.ts"; diff --git a/src/@types/location.ts b/src/@types/location.ts index dd7c49bf0..b8ce0e472 100644 --- a/src/@types/location.ts +++ b/src/@types/location.ts @@ -15,10 +15,10 @@ limitations under the License. */ // Types for MSC3488 - m.location: Extending events with location data -import { EitherAnd } from "matrix-events-sdk"; +import { type EitherAnd } from "matrix-events-sdk"; import { UnstableValue } from "../NamespacedValue.ts"; -import { M_TEXT } from "./extensible_events.ts"; +import { type M_TEXT } from "./extensible_events.ts"; export enum LocationAssetType { Self = "m.self", diff --git a/src/@types/media.ts b/src/@types/media.ts index 1128b40d3..f5c271052 100644 --- a/src/@types/media.ts +++ b/src/@types/media.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MsgType } from "../@types/event.ts"; +import { type MsgType } from "../@types/event.ts"; /** * Information on encrypted media attachments. diff --git a/src/@types/polls.ts b/src/@types/polls.ts index fecd434b4..0bf488716 100644 --- a/src/@types/polls.ts +++ b/src/@types/polls.ts @@ -14,15 +14,15 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { EitherAnd, UnstableValue } from "matrix-events-sdk"; +import { type EitherAnd, UnstableValue } from "matrix-events-sdk"; import { - ExtensibleAnyMessageEventContent, - REFERENCE_RELATION, - RelatesToRelationship, - TSNamespace, + type ExtensibleAnyMessageEventContent, + type REFERENCE_RELATION, + type RelatesToRelationship, + type TSNamespace, } from "./extensible_events.ts"; -import { EmptyObject } from "./common.ts"; +import { type EmptyObject } from "./common.ts"; /** * Identifier for a disclosed poll. diff --git a/src/@types/registration.ts b/src/@types/registration.ts index 2799ba178..e869630b9 100644 --- a/src/@types/registration.ts +++ b/src/@types/registration.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { AuthDict } from "../interactive-auth.ts"; +import { type AuthDict } from "../interactive-auth.ts"; /** * The request body of a call to `POST /_matrix/client/v3/register`. diff --git a/src/@types/requests.ts b/src/@types/requests.ts index cbc82aa7b..dda22f2ed 100644 --- a/src/@types/requests.ts +++ b/src/@types/requests.ts @@ -14,14 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IContent, IEvent } from "../models/event.ts"; -import { Preset, Visibility } from "./partials.ts"; -import { IEventWithRoomId, SearchKey } from "./search.ts"; -import { IRoomEventFilter } from "../filter.ts"; -import { Direction } from "../models/event-timeline.ts"; -import { PushRuleAction } from "./PushRules.ts"; -import { IRoomEvent } from "../sync-accumulator.ts"; -import { EventType, RelationType, RoomType } from "./event.ts"; +import { type IContent, type IEvent } from "../models/event.ts"; +import { type Preset, type Visibility } from "./partials.ts"; +import { type IEventWithRoomId, type SearchKey } from "./search.ts"; +import { type IRoomEventFilter } from "../filter.ts"; +import { type Direction } from "../models/event-timeline.ts"; +import { type PushRuleAction } from "./PushRules.ts"; +import { type IRoomEvent } from "../sync-accumulator.ts"; +import { type EventType, type RelationType, type RoomType } from "./event.ts"; // allow camelcase as these are things that go onto the wire /* eslint-disable camelcase */ diff --git a/src/@types/search.ts b/src/@types/search.ts index 4069d3e98..9076a2f63 100644 --- a/src/@types/search.ts +++ b/src/@types/search.ts @@ -16,9 +16,9 @@ limitations under the License. // Types relating to the /search API -import { IRoomEvent, IStateEvent } from "../sync-accumulator.ts"; -import { IRoomEventFilter } from "../filter.ts"; -import { SearchResult } from "../models/search-result.ts"; +import { type IRoomEvent, type IStateEvent } from "../sync-accumulator.ts"; +import { type IRoomEventFilter } from "../filter.ts"; +import { type SearchResult } from "../models/search-result.ts"; /* eslint-disable camelcase */ export interface IEventWithRoomId extends IRoomEvent { diff --git a/src/@types/spaces.ts b/src/@types/spaces.ts index 249952e5c..b7246bd1f 100644 --- a/src/@types/spaces.ts +++ b/src/@types/spaces.ts @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IPublicRoomsChunkRoom } from "../client.ts"; -import { RoomType } from "./event.ts"; -import { IStrippedState } from "../sync-accumulator.ts"; +import { type IPublicRoomsChunkRoom } from "../client.ts"; +import { type RoomType } from "./event.ts"; +import { type IStrippedState } from "../sync-accumulator.ts"; // Types relating to Rooms of type `m.space` and related APIs diff --git a/src/@types/state_events.ts b/src/@types/state_events.ts index a580c41c4..dd5b0d8eb 100644 --- a/src/@types/state_events.ts +++ b/src/@types/state_events.ts @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { RoomType } from "./event.ts"; -import { GuestAccess, HistoryVisibility, JoinRule, RestrictedAllowType } from "./partials.ts"; -import { ImageInfo } from "./media.ts"; -import { PolicyRecommendation } from "../models/invites-ignorer.ts"; +import { type RoomType } from "./event.ts"; +import { type GuestAccess, type HistoryVisibility, type JoinRule, type RestrictedAllowType } from "./partials.ts"; +import { type ImageInfo } from "./media.ts"; +import { type PolicyRecommendation } from "../models/invites-ignorer.ts"; export interface RoomCanonicalAliasEventContent { alias?: string; diff --git a/src/@types/synapse.ts b/src/@types/synapse.ts index 8b309c2ae..60db39168 100644 --- a/src/@types/synapse.ts +++ b/src/@types/synapse.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IdServerUnbindResult } from "./partials.ts"; +import { type IdServerUnbindResult } from "./partials.ts"; // Types relating to Synapse Admin APIs diff --git a/src/@types/topic.ts b/src/@types/topic.ts index b819eb85b..fd6e81a41 100644 --- a/src/@types/topic.ts +++ b/src/@types/topic.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ import { UnstableValue } from "../NamespacedValue.ts"; -import { IMessageRendering } from "./extensible_events.ts"; +import { type IMessageRendering } from "./extensible_events.ts"; /** * Extensible topic event type based on MSC3765 diff --git a/src/@types/uia.ts b/src/@types/uia.ts index 0103d4551..c840aaac4 100644 --- a/src/@types/uia.ts +++ b/src/@types/uia.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { AuthDict, IAuthData } from "../interactive-auth.ts"; +import { type AuthDict, type IAuthData } from "../interactive-auth.ts"; /** * Helper type to represent HTTP request body for a UIA enabled endpoint diff --git a/src/NamespacedValue.ts b/src/NamespacedValue.ts index a161d9e5c..27e9ba939 100644 --- a/src/NamespacedValue.ts +++ b/src/NamespacedValue.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Optional } from "matrix-events-sdk/lib/types"; +import { type Optional } from "matrix-events-sdk/lib/types"; /** * Represents a simple Matrix namespaced value. This will assume that if a stable prefix diff --git a/src/ReEmitter.ts b/src/ReEmitter.ts index 9a1bb17d4..fe3deb207 100644 --- a/src/ReEmitter.ts +++ b/src/ReEmitter.ts @@ -17,9 +17,9 @@ limitations under the License. */ // eslint-disable-next-line no-restricted-imports -import { EventEmitter } from "events"; +import { type EventEmitter } from "events"; -import { ListenerMap, TypedEventEmitter } from "./models/typed-event-emitter.ts"; +import { type ListenerMap, type TypedEventEmitter } from "./models/typed-event-emitter.ts"; export class ReEmitter { public constructor(private readonly target: EventEmitter) {} diff --git a/src/ToDeviceMessageQueue.ts b/src/ToDeviceMessageQueue.ts index 391f678fa..168584894 100644 --- a/src/ToDeviceMessageQueue.ts +++ b/src/ToDeviceMessageQueue.ts @@ -16,13 +16,13 @@ limitations under the License. import { ToDeviceMessageId } from "./@types/event.ts"; import { logger } from "./logger.ts"; -import { MatrixClient, ClientEvent } from "./client.ts"; -import { MatrixError } from "./http-api/index.ts"; +import { type MatrixClient, ClientEvent } from "./client.ts"; +import { type MatrixError } from "./http-api/index.ts"; import { - IndexedToDeviceBatch, - ToDeviceBatch, - ToDeviceBatchWithTxnId, - ToDevicePayload, + type IndexedToDeviceBatch, + type ToDeviceBatch, + type ToDeviceBatchWithTxnId, + type ToDevicePayload, } from "./models/ToDeviceMessage.ts"; import { MatrixScheduler } from "./scheduler.ts"; import { SyncState } from "./sync.ts"; diff --git a/src/autodiscovery.ts b/src/autodiscovery.ts index d9243e4da..964c5982a 100644 --- a/src/autodiscovery.ts +++ b/src/autodiscovery.ts @@ -15,9 +15,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IClientWellKnown, IWellKnownConfig, IServerVersions } from "./client.ts"; +import { type IClientWellKnown, type IWellKnownConfig, type IServerVersions } from "./client.ts"; import { logger } from "./logger.ts"; -import { MatrixError, Method, timeoutSignal } from "./http-api/index.ts"; +import { type MatrixError, Method, timeoutSignal } from "./http-api/index.ts"; import { SUPPORTED_MATRIX_VERSIONS } from "./version-support.ts"; // Dev note: Auto discovery is part of the spec. diff --git a/src/client.ts b/src/client.ts index 26addedb0..8c7e490ca 100644 --- a/src/client.ts +++ b/src/client.ts @@ -18,125 +18,151 @@ limitations under the License. * This is an internal module. See {@link MatrixClient} for the public class. */ -import { Optional } from "matrix-events-sdk"; +import { type Optional } from "matrix-events-sdk"; import type { IDeviceKeys, IMegolmSessionData, IOneTimeKey } from "./@types/crypto.ts"; -import { ISyncStateData, SetPresence, SyncApi, SyncApiOptions, SyncState } from "./sync.ts"; +import { type ISyncStateData, type SetPresence, SyncApi, type SyncApiOptions, SyncState } from "./sync.ts"; import { EventStatus, - IContent, - IDecryptOptions, - IEvent, + type IContent, + type IDecryptOptions, + type IEvent, MatrixEvent, MatrixEventEvent, - MatrixEventHandlerMap, - PushDetails, + type MatrixEventHandlerMap, + type PushDetails, } from "./models/event.ts"; import { StubStore } from "./store/stub.ts"; -import { CallEvent, CallEventHandlerMap, createNewMatrixCall, MatrixCall, supportsMatrixCall } from "./webrtc/call.ts"; -import { Filter, IFilterDefinition, IRoomEventFilter } from "./filter.ts"; -import { CallEventHandler, CallEventHandlerEvent, CallEventHandlerEventHandlerMap } from "./webrtc/callEventHandler.ts"; +import { + type CallEvent, + type CallEventHandlerMap, + createNewMatrixCall, + type MatrixCall, + supportsMatrixCall, +} from "./webrtc/call.ts"; +import { Filter, type IFilterDefinition, type IRoomEventFilter } from "./filter.ts"; +import { + CallEventHandler, + type CallEventHandlerEvent, + type CallEventHandlerEventHandlerMap, +} from "./webrtc/callEventHandler.ts"; import { GroupCallEventHandler, - GroupCallEventHandlerEvent, - GroupCallEventHandlerEventHandlerMap, + type GroupCallEventHandlerEvent, + type GroupCallEventHandlerEventHandlerMap, } from "./webrtc/groupCallEventHandler.ts"; import * as utils from "./utils.ts"; -import { noUnsafeEventProps, QueryDict, replaceParam, safeSet, sleep } from "./utils.ts"; +import { noUnsafeEventProps, type QueryDict, replaceParam, safeSet, sleep } from "./utils.ts"; import { Direction, EventTimeline } from "./models/event-timeline.ts"; -import { IActionsObject, PushProcessor } from "./pushprocessor.ts"; -import { AutoDiscovery, AutoDiscoveryAction } from "./autodiscovery.ts"; +import { type IActionsObject, PushProcessor } from "./pushprocessor.ts"; +import { AutoDiscovery, type AutoDiscoveryAction } from "./autodiscovery.ts"; import { decodeBase64, encodeBase64, encodeUnpaddedBase64Url } from "./base64.ts"; -import { IExportedDevice as IExportedOlmDevice } from "./crypto/OlmDevice.ts"; -import { IOlmDevice } from "./crypto/algorithms/megolm.ts"; +import { type IExportedDevice as IExportedOlmDevice } from "./crypto/OlmDevice.ts"; +import { type IOlmDevice } from "./crypto/algorithms/megolm.ts"; import { TypedReEmitter } from "./ReEmitter.ts"; -import { IRoomEncryption } from "./crypto/RoomList.ts"; -import { logger, Logger } from "./logger.ts"; +import { type IRoomEncryption } from "./crypto/RoomList.ts"; +import { logger, type Logger } from "./logger.ts"; import { SERVICE_TYPES } from "./service-types.ts"; import { - Body, + type Body, ClientPrefix, - FileType, - HttpApiEvent, - HttpApiEventHandlerMap, - HTTPError, + type FileType, + type HttpApiEvent, + type HttpApiEventHandlerMap, + type HTTPError, IdentityPrefix, - IHttpOpts, - IRequestOpts, + type IHttpOpts, + type IRequestOpts, MatrixError, MatrixHttpApi, MediaPrefix, Method, retryNetworkOperation, - TokenRefreshFunction, - Upload, - UploadOpts, - UploadResponse, + type TokenRefreshFunction, + type Upload, + type UploadOpts, + type UploadResponse, } from "./http-api/index.ts"; import { Crypto, CryptoEvent as LegacyCryptoEvent, - CryptoEventHandlerMap as LegacyCryptoEventHandlerMap, + type CryptoEventHandlerMap as LegacyCryptoEventHandlerMap, fixBackupKey, - ICheckOwnCrossSigningTrustOpts, - IRoomKeyRequestBody, + type ICheckOwnCrossSigningTrustOpts, + type IRoomKeyRequestBody, isCryptoAvailable, } from "./crypto/index.ts"; -import { DeviceInfo } from "./crypto/deviceinfo.ts"; -import { User, UserEvent, UserEventHandlerMap } from "./models/user.ts"; +import { type DeviceInfo } from "./crypto/deviceinfo.ts"; +import { User, UserEvent, type UserEventHandlerMap } from "./models/user.ts"; import { getHttpUriForMxc } from "./content-repo.ts"; import { SearchResult } from "./models/search-result.ts"; -import { DEHYDRATION_ALGORITHM, IDehydratedDevice, IDehydratedDeviceKeyInfo } from "./crypto/dehydration.ts"; +import { DEHYDRATION_ALGORITHM, type IDehydratedDevice, type IDehydratedDeviceKeyInfo } from "./crypto/dehydration.ts"; import { - IKeyBackupInfo, - IKeyBackupPrepareOpts, - IKeyBackupRestoreOpts, - IKeyBackupRestoreResult, - IKeyBackupRoomSessions, - IKeyBackupSession, + type IKeyBackupInfo, + type IKeyBackupPrepareOpts, + type IKeyBackupRestoreOpts, + type IKeyBackupRestoreResult, + type IKeyBackupRoomSessions, + type IKeyBackupSession, } from "./crypto/keybackup.ts"; -import { IIdentityServerProvider } from "./@types/IIdentityServerProvider.ts"; -import { MatrixScheduler } from "./scheduler.ts"; -import { BeaconEvent, BeaconEventHandlerMap } from "./models/beacon.ts"; -import { AuthDict } from "./interactive-auth.ts"; -import { IMinimalEvent, IRoomEvent, IStateEvent } from "./sync-accumulator.ts"; -import { CrossSigningKey, ICreateSecretStorageOpts, IEncryptedEventInfo, IRecoveryKey } from "./crypto/api.ts"; -import { EventTimelineSet } from "./models/event-timeline-set.ts"; -import { VerificationRequest } from "./crypto/verification/request/VerificationRequest.ts"; -import { VerificationBase as Verification } from "./crypto/verification/Base.ts"; -import * as ContentHelpers from "./content-helpers.ts"; -import { CrossSigningInfo, DeviceTrustLevel, ICacheCallbacks, UserTrustLevel } from "./crypto/CrossSigning.ts"; -import { NotificationCountType, Room, RoomEvent, RoomEventHandlerMap, RoomNameState } from "./models/room.ts"; -import { RoomMemberEvent, RoomMemberEventHandlerMap } from "./models/room-member.ts"; -import { IPowerLevelsContent, RoomStateEvent, RoomStateEventHandlerMap } from "./models/room-state.ts"; +import { type IIdentityServerProvider } from "./@types/IIdentityServerProvider.ts"; +import { type MatrixScheduler } from "./scheduler.ts"; +import { type BeaconEvent, type BeaconEventHandlerMap } from "./models/beacon.ts"; +import { type AuthDict } from "./interactive-auth.ts"; +import { type IMinimalEvent, type IRoomEvent, type IStateEvent } from "./sync-accumulator.ts"; import { - DelayedEventInfo, - IAddThreePidOnlyBody, - IBindThreePidBody, - IContextResponse, - ICreateRoomOpts, - IEventSearchOpts, - IFilterResponse, - IGuestAccessOpts, - IJoinRoomOpts, - INotificationsResponse, - IPaginateOpts, - IPresenceOpts, - IRedactOpts, - IRelationsRequestOpts, - IRelationsResponse, - IRoomDirectoryOptions, - ISearchOpts, - ISendEventResponse, - IStatusResponse, - ITagsResponse, - KnockRoomOpts, - SendDelayedEventRequestOpts, - SendDelayedEventResponse, - UpdateDelayedEventAction, + CrossSigningKey, + type ICreateSecretStorageOpts, + type IEncryptedEventInfo, + type IRecoveryKey, +} from "./crypto/api.ts"; +import { type EventTimelineSet } from "./models/event-timeline-set.ts"; +import { type VerificationRequest } from "./crypto/verification/request/VerificationRequest.ts"; +import { type VerificationBase as Verification } from "./crypto/verification/Base.ts"; +import * as ContentHelpers from "./content-helpers.ts"; +import { + type CrossSigningInfo, + type DeviceTrustLevel, + type ICacheCallbacks, + type UserTrustLevel, +} from "./crypto/CrossSigning.ts"; +import { + NotificationCountType, + type Room, + type RoomEvent, + type RoomEventHandlerMap, + type RoomNameState, +} from "./models/room.ts"; +import { RoomMemberEvent, type RoomMemberEventHandlerMap } from "./models/room-member.ts"; +import { type IPowerLevelsContent, type RoomStateEvent, type RoomStateEventHandlerMap } from "./models/room-state.ts"; +import { + type DelayedEventInfo, + type IAddThreePidOnlyBody, + type IBindThreePidBody, + type IContextResponse, + type ICreateRoomOpts, + type IEventSearchOpts, + type IFilterResponse, + type IGuestAccessOpts, + type IJoinRoomOpts, + type INotificationsResponse, + type IPaginateOpts, + type IPresenceOpts, + type IRedactOpts, + type IRelationsRequestOpts, + type IRelationsResponse, + type IRoomDirectoryOptions, + type ISearchOpts, + type ISendEventResponse, + type IStatusResponse, + type ITagsResponse, + type KnockRoomOpts, + type SendDelayedEventRequestOpts, + type SendDelayedEventResponse, + type UpdateDelayedEventAction, } from "./@types/requests.ts"; import { - AccountDataEvents, + type AccountDataEvents, EventType, LOCAL_NOTIFICATION_SETTINGS_PREFIX, MSC3912_RELATION_BASED_REDACTIONS_PROP, @@ -145,8 +171,8 @@ import { RelationType, RoomCreateTypeField, RoomType, - StateEvents, - TimelineEvents, + type StateEvents, + type TimelineEvents, UNSTABLE_MSC3088_ENABLED, UNSTABLE_MSC3088_PURPOSE, UNSTABLE_MSC3089_TREE_SUBTYPE, @@ -154,54 +180,65 @@ import { import { GuestAccess, HistoryVisibility, - IdServerUnbindResult, - JoinRule, + type IdServerUnbindResult, + type JoinRule, Preset, - Terms, - Visibility, + type Terms, + type Visibility, } from "./@types/partials.ts"; -import { EventMapper, eventMapperFor, MapperOpts } from "./event-mapper.ts"; +import { type EventMapper, eventMapperFor, type MapperOpts } from "./event-mapper.ts"; import { secureRandomString } from "./randomstring.ts"; -import { BackupManager, IKeyBackup, IKeyBackupCheck, IPreparedKeyBackupVersion, TrustInfo } from "./crypto/backup.ts"; -import { DEFAULT_TREE_POWER_LEVELS_TEMPLATE, MSC3089TreeSpace } from "./models/MSC3089TreeSpace.ts"; -import { ISignatures } from "./@types/signed.ts"; -import { IStore } from "./store/index.ts"; -import { ISecretRequest } from "./crypto/SecretStorage.ts"; import { - IEventWithRoomId, - ISearchRequestBody, - ISearchResponse, - ISearchResults, - IStateEventWithRoomId, + BackupManager, + type IKeyBackup, + type IKeyBackupCheck, + type IPreparedKeyBackupVersion, + type TrustInfo, +} from "./crypto/backup.ts"; +import { DEFAULT_TREE_POWER_LEVELS_TEMPLATE, MSC3089TreeSpace } from "./models/MSC3089TreeSpace.ts"; +import { type ISignatures } from "./@types/signed.ts"; +import { type IStore } from "./store/index.ts"; +import { type ISecretRequest } from "./crypto/SecretStorage.ts"; +import { + type IEventWithRoomId, + type ISearchRequestBody, + type ISearchResponse, + type ISearchResults, + type IStateEventWithRoomId, SearchOrderBy, } from "./@types/search.ts"; -import { ISynapseAdminDeactivateResponse, ISynapseAdminWhoisResponse } from "./@types/synapse.ts"; -import { IHierarchyRoom } from "./@types/spaces.ts"; +import { type ISynapseAdminDeactivateResponse, type ISynapseAdminWhoisResponse } from "./@types/synapse.ts"; +import { type IHierarchyRoom } from "./@types/spaces.ts"; import { - IPusher, - IPusherRequest, - IPushRule, - IPushRules, - PushRuleAction, + type IPusher, + type IPusherRequest, + type IPushRule, + type IPushRules, + type PushRuleAction, PushRuleActionName, PushRuleKind, - RuleId, + type RuleId, } from "./@types/PushRules.ts"; -import { IThreepid } from "./@types/threepids.ts"; -import { CryptoStore, OutgoingRoomKeyRequest } from "./crypto/store/base.ts"; -import { GroupCall, GroupCallIntent, GroupCallType, IGroupCallDataChannelOptions } from "./webrtc/groupCall.ts"; +import { type IThreepid } from "./@types/threepids.ts"; +import { type CryptoStore, type OutgoingRoomKeyRequest } from "./crypto/store/base.ts"; +import { + GroupCall, + type GroupCallIntent, + type GroupCallType, + type IGroupCallDataChannelOptions, +} from "./webrtc/groupCall.ts"; import { MediaHandler } from "./webrtc/mediaHandler.ts"; import { - ILoginFlowsResponse, - IRefreshTokenResponse, - LoginRequest, - LoginResponse, - LoginTokenPostResponse, - SSOAction, + type ILoginFlowsResponse, + type IRefreshTokenResponse, + type LoginRequest, + type LoginResponse, + type LoginTokenPostResponse, + type SSOAction, } from "./@types/auth.ts"; import { TypedEventEmitter } from "./models/typed-event-emitter.ts"; import { MAIN_ROOM_TIMELINE, ReceiptType } from "./@types/read_receipts.ts"; -import { MSC3575SlidingSyncRequest, MSC3575SlidingSyncResponse, SlidingSync } from "./sliding-sync.ts"; +import { type MSC3575SlidingSyncRequest, type MSC3575SlidingSyncResponse, type SlidingSync } from "./sliding-sync.ts"; import { SlidingSyncSdk } from "./sliding-sync-sdk.ts"; import { determineFeatureSupport, @@ -211,45 +248,49 @@ import { ThreadFilterType, threadFilterTypeToFilter, } from "./models/thread.ts"; -import { M_BEACON_INFO, MBeaconInfoEventContent } from "./@types/beacon.ts"; +import { M_BEACON_INFO, type MBeaconInfoEventContent } from "./@types/beacon.ts"; import { NamespacedValue, UnstableValue } from "./NamespacedValue.ts"; import { ToDeviceMessageQueue } from "./ToDeviceMessageQueue.ts"; -import { ToDeviceBatch } from "./models/ToDeviceMessage.ts"; +import { type ToDeviceBatch } from "./models/ToDeviceMessage.ts"; import { IgnoredInvites } from "./models/invites-ignorer.ts"; -import { UIARequest, UIAResponse } from "./@types/uia.ts"; -import { LocalNotificationSettings } from "./@types/local_notifications.ts"; +import { type UIARequest, type UIAResponse } from "./@types/uia.ts"; +import { type LocalNotificationSettings } from "./@types/local_notifications.ts"; import { buildFeatureSupportMap, Feature, ServerSupport } from "./feature.ts"; -import { BackupDecryptor, CryptoBackend } from "./common-crypto/CryptoBackend.ts"; +import { type BackupDecryptor, type CryptoBackend } from "./common-crypto/CryptoBackend.ts"; import { RUST_SDK_STORE_PREFIX } from "./rust-crypto/constants.ts"; import { - BootstrapCrossSigningOpts, - CrossSigningKeyInfo, - CryptoApi, + type BootstrapCrossSigningOpts, + type CrossSigningKeyInfo, + type CryptoApi, decodeRecoveryKey, - ImportRoomKeysOpts, + type ImportRoomKeysOpts, CryptoEvent, - CryptoEventHandlerMap, - CryptoCallbacks, + type CryptoEventHandlerMap, + type CryptoCallbacks, } from "./crypto-api/index.ts"; -import { DeviceInfoMap } from "./crypto/DeviceList.ts"; +import { type DeviceInfoMap } from "./crypto/DeviceList.ts"; import { - AddSecretStorageKeyOpts, - SecretStorageKey, - SecretStorageKeyDescription, - ServerSideSecretStorage, + type AddSecretStorageKeyOpts, + type SecretStorageKey, + type SecretStorageKeyDescription, + type ServerSideSecretStorage, ServerSideSecretStorageImpl, } from "./secret-storage.ts"; -import { RegisterRequest, RegisterResponse } from "./@types/registration.ts"; +import { type RegisterRequest, type RegisterResponse } from "./@types/registration.ts"; import { MatrixRTCSessionManager } from "./matrixrtc/MatrixRTCSessionManager.ts"; import { getRelationsThreadFilter } from "./thread-utils.ts"; -import { KnownMembership, Membership } from "./@types/membership.ts"; -import { RoomMessageEventContent, StickerEventContent } from "./@types/events.ts"; -import { ImageInfo } from "./@types/media.ts"; -import { Capabilities, ServerCapabilities } from "./serverCapabilities.ts"; +import { KnownMembership, type Membership } from "./@types/membership.ts"; +import { type RoomMessageEventContent, type StickerEventContent } from "./@types/events.ts"; +import { type ImageInfo } from "./@types/media.ts"; +import { type Capabilities, ServerCapabilities } from "./serverCapabilities.ts"; import { sha256 } from "./digest.ts"; import { keyFromAuthData } from "./common-crypto/key-passphrase.ts"; -import { discoverAndValidateOIDCIssuerWellKnown, OidcClientConfig, validateAuthMetadataAndKeys } from "./oidc/index.ts"; -import { EmptyObject } from "./@types/common.ts"; +import { + discoverAndValidateOIDCIssuerWellKnown, + type OidcClientConfig, + validateAuthMetadataAndKeys, +} from "./oidc/index.ts"; +import { type EmptyObject } from "./@types/common.ts"; export type Store = IStore; diff --git a/src/common-crypto/CryptoBackend.ts b/src/common-crypto/CryptoBackend.ts index 85007d067..53351d6e4 100644 --- a/src/common-crypto/CryptoBackend.ts +++ b/src/common-crypto/CryptoBackend.ts @@ -15,13 +15,13 @@ limitations under the License. */ import type { IDeviceLists, IToDeviceEvent } from "../sync-accumulator.ts"; -import { IClearEvent, MatrixEvent } from "../models/event.ts"; -import { Room } from "../models/room.ts"; -import { CryptoApi, DecryptionFailureCode, ImportRoomKeysOpts } from "../crypto-api/index.ts"; -import { CrossSigningInfo, UserTrustLevel } from "../crypto/CrossSigning.ts"; -import { IEncryptedEventInfo } from "../crypto/api.ts"; -import { KeyBackupInfo, KeyBackupSession } from "../crypto-api/keybackup.ts"; -import { IMegolmSessionData } from "../@types/crypto.ts"; +import { type IClearEvent, type MatrixEvent } from "../models/event.ts"; +import { type Room } from "../models/room.ts"; +import { type CryptoApi, type DecryptionFailureCode, type ImportRoomKeysOpts } from "../crypto-api/index.ts"; +import { type CrossSigningInfo, type UserTrustLevel } from "../crypto/CrossSigning.ts"; +import { type IEncryptedEventInfo } from "../crypto/api.ts"; +import { type KeyBackupInfo, type KeyBackupSession } from "../crypto-api/keybackup.ts"; +import { type IMegolmSessionData } from "../@types/crypto.ts"; /** * Common interface for the crypto implementations diff --git a/src/content-helpers.ts b/src/content-helpers.ts index d2fe37add..16b3731e1 100644 --- a/src/content-helpers.ts +++ b/src/content-helpers.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MBeaconEventContent, MBeaconInfoContent, MBeaconInfoEventContent } from "./@types/beacon.ts"; +import { type MBeaconEventContent, type MBeaconInfoContent, type MBeaconInfoEventContent } from "./@types/beacon.ts"; import { MsgType } from "./@types/event.ts"; import { M_TEXT, REFERENCE_RELATION } from "./@types/extensible_events.ts"; import { isProvided } from "./extensible_events_v1/utilities.ts"; @@ -23,14 +23,14 @@ import { LocationAssetType, M_LOCATION, M_TIMESTAMP, - LocationEventWireContent, - MLocationEventContent, - MLocationContent, - MAssetContent, - LegacyLocationEventContent, + type LocationEventWireContent, + type MLocationEventContent, + type MLocationContent, + type MAssetContent, + type LegacyLocationEventContent, } from "./@types/location.ts"; -import { MRoomTopicEventContent, MTopicContent, M_TOPIC } from "./@types/topic.ts"; -import { RoomMessageEventContent } from "./@types/events.ts"; +import { type MRoomTopicEventContent, type MTopicContent, M_TOPIC } from "./@types/topic.ts"; +import { type RoomMessageEventContent } from "./@types/events.ts"; /** * Generates the content for a HTML Message event diff --git a/src/crypto-api/CryptoEventHandlerMap.ts b/src/crypto-api/CryptoEventHandlerMap.ts index 73b5f1eae..cee83c71f 100644 --- a/src/crypto-api/CryptoEventHandlerMap.ts +++ b/src/crypto-api/CryptoEventHandlerMap.ts @@ -14,11 +14,11 @@ * limitations under the License. */ -import { CryptoEvent } from "./CryptoEvent.ts"; -import { VerificationRequest } from "./verification.ts"; -import { UserVerificationStatus } from "./index.ts"; -import { RustBackupCryptoEventMap } from "../rust-crypto/backup.ts"; -import { EmptyObject } from "../@types/common.ts"; +import { type CryptoEvent } from "./CryptoEvent.ts"; +import { type VerificationRequest } from "./verification.ts"; +import { type UserVerificationStatus } from "./index.ts"; +import { type RustBackupCryptoEventMap } from "../rust-crypto/backup.ts"; +import { type EmptyObject } from "../@types/common.ts"; /** * A map of the {@link CryptoEvent} fired by the {@link CryptoApi} and their payloads. diff --git a/src/crypto-api/index.ts b/src/crypto-api/index.ts index 94bfe2b0e..008fc2eac 100644 --- a/src/crypto-api/index.ts +++ b/src/crypto-api/index.ts @@ -17,20 +17,20 @@ limitations under the License. import type { SecretsBundle } from "@matrix-org/matrix-sdk-crypto-wasm"; import type { IMegolmSessionData } from "../@types/crypto.ts"; import type { ToDeviceBatch, ToDevicePayload } from "../models/ToDeviceMessage.ts"; -import { Room } from "../models/room.ts"; -import { DeviceMap } from "../models/device.ts"; -import { UIAuthCallback } from "../interactive-auth.ts"; -import { PassphraseInfo, SecretStorageKeyDescription } from "../secret-storage.ts"; -import { VerificationRequest } from "./verification.ts"; +import { type Room } from "../models/room.ts"; +import { type DeviceMap } from "../models/device.ts"; +import { type UIAuthCallback } from "../interactive-auth.ts"; +import { type PassphraseInfo, type SecretStorageKeyDescription } from "../secret-storage.ts"; +import { type VerificationRequest } from "./verification.ts"; import { - BackupTrustInfo, - KeyBackupCheck, - KeyBackupInfo, - KeyBackupRestoreOpts, - KeyBackupRestoreResult, + type BackupTrustInfo, + type KeyBackupCheck, + type KeyBackupInfo, + type KeyBackupRestoreOpts, + type KeyBackupRestoreResult, } from "./keybackup.ts"; -import { ISignatures } from "../@types/signed.ts"; -import { MatrixEvent } from "../models/event.ts"; +import { type ISignatures } from "../@types/signed.ts"; +import { type MatrixEvent } from "../models/event.ts"; /** * `matrix-js-sdk/lib/crypto-api`: End-to-end encryption support. diff --git a/src/crypto-api/keybackup.ts b/src/crypto-api/keybackup.ts index 9840159da..12eaddd6d 100644 --- a/src/crypto-api/keybackup.ts +++ b/src/crypto-api/keybackup.ts @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { ISigned } from "../@types/signed.ts"; -import { AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts"; -import { ImportRoomKeyProgressData } from "./index.ts"; +import { type ISigned } from "../@types/signed.ts"; +import { type AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts"; +import { type ImportRoomKeyProgressData } from "./index.ts"; export interface Curve25519AuthData { public_key: string; diff --git a/src/crypto-api/verification.ts b/src/crypto-api/verification.ts index a5bf59021..e6d604ab3 100644 --- a/src/crypto-api/verification.ts +++ b/src/crypto-api/verification.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixEvent } from "../models/event.ts"; -import { TypedEventEmitter } from "../models/typed-event-emitter.ts"; +import { type MatrixEvent } from "../models/event.ts"; +import { type TypedEventEmitter } from "../models/typed-event-emitter.ts"; /** * An incoming, or outgoing, request to verify a user or a device via cross-signing. diff --git a/src/crypto/CrossSigning.ts b/src/crypto/CrossSigning.ts index b3c5183f5..175e8f8a4 100644 --- a/src/crypto/CrossSigning.ts +++ b/src/crypto/CrossSigning.ts @@ -19,18 +19,18 @@ limitations under the License. */ import type { PkSigning } from "@matrix-org/olm"; -import { IObject, pkSign, pkVerify } from "./olmlib.ts"; +import { type IObject, pkSign, pkVerify } from "./olmlib.ts"; import { logger } from "../logger.ts"; import { IndexedDBCryptoStore } from "../crypto/store/indexeddb-crypto-store.ts"; -import { DeviceInfo } from "./deviceinfo.ts"; -import { ISignedKey, MatrixClient } from "../client.ts"; -import { OlmDevice } from "./OlmDevice.ts"; -import { ICryptoCallbacks } from "./index.ts"; -import { ISignatures } from "../@types/signed.ts"; -import { CryptoStore, SecretStorePrivateKeys } from "./store/base.ts"; -import { ServerSideSecretStorage, SecretStorageKeyDescription } from "../secret-storage.ts"; +import { type DeviceInfo } from "./deviceinfo.ts"; +import { type ISignedKey, type MatrixClient } from "../client.ts"; +import { type OlmDevice } from "./OlmDevice.ts"; +import { type ICryptoCallbacks } from "./index.ts"; +import { type ISignatures } from "../@types/signed.ts"; +import { type CryptoStore, type SecretStorePrivateKeys } from "./store/base.ts"; +import { type ServerSideSecretStorage, type SecretStorageKeyDescription } from "../secret-storage.ts"; import { - CrossSigningKeyInfo, + type CrossSigningKeyInfo, DeviceVerificationStatus, UserVerificationStatus as UserTrustLevel, } from "../crypto-api/index.ts"; diff --git a/src/crypto/DeviceList.ts b/src/crypto/DeviceList.ts index 320ea6a26..c7c389678 100644 --- a/src/crypto/DeviceList.ts +++ b/src/crypto/DeviceList.ts @@ -19,16 +19,16 @@ limitations under the License. */ import { logger } from "../logger.ts"; -import { DeviceInfo, IDevice } from "./deviceinfo.ts"; -import { CrossSigningInfo, ICrossSigningInfo } from "./CrossSigning.ts"; +import { DeviceInfo, type IDevice } from "./deviceinfo.ts"; +import { CrossSigningInfo, type ICrossSigningInfo } from "./CrossSigning.ts"; import * as olmlib from "./olmlib.ts"; import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store.ts"; -import { chunkPromises, defer, IDeferred, sleep } from "../utils.ts"; -import { DeviceKeys, IDownloadKeyResult, Keys, MatrixClient, SigningKeys } from "../client.ts"; -import { OlmDevice } from "./OlmDevice.ts"; -import { CryptoStore } from "./store/base.ts"; +import { chunkPromises, defer, type IDeferred, sleep } from "../utils.ts"; +import { type DeviceKeys, type IDownloadKeyResult, type Keys, type MatrixClient, type SigningKeys } from "../client.ts"; +import { type OlmDevice } from "./OlmDevice.ts"; +import { type CryptoStore } from "./store/base.ts"; import { TypedEventEmitter } from "../models/typed-event-emitter.ts"; -import { CryptoEvent, CryptoEventHandlerMap } from "./index.ts"; +import { CryptoEvent, type CryptoEventHandlerMap } from "./index.ts"; /* State transition diagram for DeviceList.deviceTrackingStatus * diff --git a/src/crypto/EncryptionSetup.ts b/src/crypto/EncryptionSetup.ts index 226d0e638..6ff27ddc4 100644 --- a/src/crypto/EncryptionSetup.ts +++ b/src/crypto/EncryptionSetup.ts @@ -16,17 +16,23 @@ limitations under the License. import { logger } from "../logger.ts"; import { MatrixEvent } from "../models/event.ts"; -import { createCryptoStoreCacheCallbacks, ICacheCallbacks } from "./CrossSigning.ts"; +import { createCryptoStoreCacheCallbacks, type ICacheCallbacks } from "./CrossSigning.ts"; import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store.ts"; import { Method, ClientPrefix } from "../http-api/index.ts"; -import { Crypto, ICryptoCallbacks } from "./index.ts"; -import { ClientEvent, ClientEventHandlerMap, CrossSigningKeys, ISignedKey, KeySignatures } from "../client.ts"; -import { IKeyBackupInfo } from "./keybackup.ts"; +import { type Crypto, type ICryptoCallbacks } from "./index.ts"; +import { + ClientEvent, + type ClientEventHandlerMap, + type CrossSigningKeys, + type ISignedKey, + type KeySignatures, +} from "../client.ts"; +import { type IKeyBackupInfo } from "./keybackup.ts"; import { TypedEventEmitter } from "../models/typed-event-emitter.ts"; -import { AccountDataClient, SecretStorageKeyDescription } from "../secret-storage.ts"; -import { BootstrapCrossSigningOpts, CrossSigningKeyInfo } from "../crypto-api/index.ts"; -import { AccountDataEvents } from "../@types/event.ts"; -import { EmptyObject } from "../@types/common.ts"; +import { type AccountDataClient, type SecretStorageKeyDescription } from "../secret-storage.ts"; +import { type BootstrapCrossSigningOpts, type CrossSigningKeyInfo } from "../crypto-api/index.ts"; +import { type AccountDataEvents } from "../@types/event.ts"; +import { type EmptyObject } from "../@types/common.ts"; interface ICrossSigningKeys { authUpload: BootstrapCrossSigningOpts["authUploadDeviceSigningKeys"]; diff --git a/src/crypto/OlmDevice.ts b/src/crypto/OlmDevice.ts index 6cedd4909..0db4aa742 100644 --- a/src/crypto/OlmDevice.ts +++ b/src/crypto/OlmDevice.ts @@ -14,14 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Account, InboundGroupSession, OutboundGroupSession, Session, Utility } from "@matrix-org/olm"; +import { + type Account, + type InboundGroupSession, + type OutboundGroupSession, + type Session, + type Utility, +} from "@matrix-org/olm"; -import { logger, Logger } from "../logger.ts"; +import { logger, type Logger } from "../logger.ts"; import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store.ts"; -import { CryptoStore, IProblem, ISessionInfo, IWithheld } from "./store/base.ts"; -import { IOlmDevice, IOutboundGroupSessionKey } from "./algorithms/megolm.ts"; -import { IMegolmSessionData, OlmGroupSessionExtraData } from "../@types/crypto.ts"; -import { IMessage } from "./algorithms/olm.ts"; +import { type CryptoStore, type IProblem, type ISessionInfo, type IWithheld } from "./store/base.ts"; +import { type IOlmDevice, type IOutboundGroupSessionKey } from "./algorithms/megolm.ts"; +import { type IMegolmSessionData, type OlmGroupSessionExtraData } from "../@types/crypto.ts"; +import { type IMessage } from "./algorithms/olm.ts"; import { DecryptionFailureCode } from "../crypto-api/index.ts"; import { DecryptionError } from "../common-crypto/CryptoBackend.ts"; diff --git a/src/crypto/OutgoingRoomKeyRequestManager.ts b/src/crypto/OutgoingRoomKeyRequestManager.ts index dc1b59a9b..59bff2592 100644 --- a/src/crypto/OutgoingRoomKeyRequestManager.ts +++ b/src/crypto/OutgoingRoomKeyRequestManager.ts @@ -17,12 +17,12 @@ limitations under the License. import { v4 as uuidv4 } from "uuid"; import { logger } from "../logger.ts"; -import { MatrixClient } from "../client.ts"; -import { IRoomKeyRequestBody, IRoomKeyRequestRecipient } from "./index.ts"; -import { CryptoStore, OutgoingRoomKeyRequest } from "./store/base.ts"; +import { type MatrixClient } from "../client.ts"; +import { type IRoomKeyRequestBody, type IRoomKeyRequestRecipient } from "./index.ts"; +import { type CryptoStore, type OutgoingRoomKeyRequest } from "./store/base.ts"; import { EventType, ToDeviceMessageId } from "../@types/event.ts"; import { MapWithDefault } from "../utils.ts"; -import { EmptyObject } from "../@types/common.ts"; +import { type EmptyObject } from "../@types/common.ts"; /** * Internal module. Management of outgoing room key requests. diff --git a/src/crypto/RoomList.ts b/src/crypto/RoomList.ts index 75573d640..84a231069 100644 --- a/src/crypto/RoomList.ts +++ b/src/crypto/RoomList.ts @@ -18,7 +18,7 @@ limitations under the License. * Manages the list of encrypted rooms */ -import { CryptoStore } from "./store/base.ts"; +import { type CryptoStore } from "./store/base.ts"; import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store.ts"; /* eslint-disable camelcase */ diff --git a/src/crypto/SecretSharing.ts b/src/crypto/SecretSharing.ts index 11def7371..c2705f81b 100644 --- a/src/crypto/SecretSharing.ts +++ b/src/crypto/SecretSharing.ts @@ -15,12 +15,12 @@ limitations under the License. */ import { v4 as uuidv4 } from "uuid"; -import { MatrixClient } from "../client.ts"; -import { ICryptoCallbacks, IEncryptedContent } from "./index.ts"; -import { defer, IDeferred } from "../utils.ts"; +import { type MatrixClient } from "../client.ts"; +import { type ICryptoCallbacks, type IEncryptedContent } from "./index.ts"; +import { defer, type IDeferred } from "../utils.ts"; import { ToDeviceMessageId } from "../@types/event.ts"; import { logger } from "../logger.ts"; -import { MatrixEvent } from "../models/event.ts"; +import { type MatrixEvent } from "../models/event.ts"; import * as olmlib from "./olmlib.ts"; export interface ISecretRequest { diff --git a/src/crypto/SecretStorage.ts b/src/crypto/SecretStorage.ts index adfe63efc..9052b804b 100644 --- a/src/crypto/SecretStorage.ts +++ b/src/crypto/SecretStorage.ts @@ -14,20 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { ICryptoCallbacks } from "./index.ts"; -import { MatrixEvent } from "../models/event.ts"; -import { MatrixClient } from "../client.ts"; +import { type ICryptoCallbacks } from "./index.ts"; +import { type MatrixEvent } from "../models/event.ts"; +import { type MatrixClient } from "../client.ts"; import { - SecretStorageKeyDescription, - SecretStorageKeyTuple, - SecretStorageKeyObject, - AddSecretStorageKeyOpts, - AccountDataClient, - ServerSideSecretStorage, + type SecretStorageKeyDescription, + type SecretStorageKeyTuple, + type SecretStorageKeyObject, + type AddSecretStorageKeyOpts, + type AccountDataClient, + type ServerSideSecretStorage, ServerSideSecretStorageImpl, - SecretStorageKey, + type SecretStorageKey, } from "../secret-storage.ts"; -import { ISecretRequest, SecretSharing } from "./SecretSharing.ts"; +import { type ISecretRequest, SecretSharing } from "./SecretSharing.ts"; /* re-exports for backwards compatibility */ export type { diff --git a/src/crypto/algorithms/base.ts b/src/crypto/algorithms/base.ts index 9b0384261..f13522fd7 100644 --- a/src/crypto/algorithms/base.ts +++ b/src/crypto/algorithms/base.ts @@ -19,14 +19,19 @@ limitations under the License. */ import type { IMegolmSessionData } from "../../@types/crypto.ts"; -import { MatrixClient } from "../../client.ts"; -import { Room } from "../../models/room.ts"; -import { OlmDevice } from "../OlmDevice.ts"; -import { IContent, MatrixEvent, RoomMember } from "../../matrix.ts"; -import { Crypto, IEncryptedContent, IEventDecryptionResult, IncomingRoomKeyRequest } from "../index.ts"; -import { DeviceInfo } from "../deviceinfo.ts"; -import { IRoomEncryption } from "../RoomList.ts"; -import { DeviceInfoMap } from "../DeviceList.ts"; +import { type MatrixClient } from "../../client.ts"; +import { type Room } from "../../models/room.ts"; +import { type OlmDevice } from "../OlmDevice.ts"; +import { type IContent, type MatrixEvent, type RoomMember } from "../../matrix.ts"; +import { + type Crypto, + type IEncryptedContent, + type IEventDecryptionResult, + type IncomingRoomKeyRequest, +} from "../index.ts"; +import { type DeviceInfo } from "../deviceinfo.ts"; +import { type IRoomEncryption } from "../RoomList.ts"; +import { type DeviceInfoMap } from "../DeviceList.ts"; /** * Map of registered encryption algorithm classes. A map from string to {@link EncryptionAlgorithm} class diff --git a/src/crypto/algorithms/megolm.ts b/src/crypto/algorithms/megolm.ts index 34116659c..d3057e248 100644 --- a/src/crypto/algorithms/megolm.ts +++ b/src/crypto/algorithms/megolm.ts @@ -21,27 +21,27 @@ limitations under the License. import { v4 as uuidv4 } from "uuid"; import type { IEventDecryptionResult, IMegolmSessionData } from "../../@types/crypto.ts"; -import { logger, Logger } from "../../logger.ts"; +import { logger, type Logger } from "../../logger.ts"; import * as olmlib from "../olmlib.ts"; import { DecryptionAlgorithm, - DecryptionClassParams, + type DecryptionClassParams, EncryptionAlgorithm, - IParams, + type IParams, registerAlgorithm, UnknownDeviceError, } from "./base.ts"; -import { IDecryptedGroupMessage, WITHHELD_MESSAGES } from "../OlmDevice.ts"; -import { Room } from "../../models/room.ts"; -import { DeviceInfo } from "../deviceinfo.ts"; -import { IOlmSessionResult } from "../olmlib.ts"; -import { DeviceInfoMap } from "../DeviceList.ts"; -import { IContent, MatrixEvent } from "../../models/event.ts"; +import { type IDecryptedGroupMessage, WITHHELD_MESSAGES } from "../OlmDevice.ts"; +import { type Room } from "../../models/room.ts"; +import { type DeviceInfo } from "../deviceinfo.ts"; +import { type IOlmSessionResult } from "../olmlib.ts"; +import { type DeviceInfoMap } from "../DeviceList.ts"; +import { type IContent, type MatrixEvent } from "../../models/event.ts"; import { EventType, MsgType, ToDeviceMessageId } from "../../@types/event.ts"; -import { IMegolmEncryptedContent, IncomingRoomKeyRequest, IEncryptedContent } from "../index.ts"; +import { type IMegolmEncryptedContent, type IncomingRoomKeyRequest, type IEncryptedContent } from "../index.ts"; import { RoomKeyRequestState } from "../OutgoingRoomKeyRequestManager.ts"; -import { OlmGroupSessionExtraData } from "../../@types/crypto.ts"; -import { MatrixError } from "../../http-api/index.ts"; +import { type OlmGroupSessionExtraData } from "../../@types/crypto.ts"; +import { type MatrixError } from "../../http-api/index.ts"; import { immediate, MapWithDefault } from "../../utils.ts"; import { KnownMembership } from "../../@types/membership.ts"; import { DecryptionFailureCode } from "../../crypto-api/index.ts"; diff --git a/src/crypto/algorithms/olm.ts b/src/crypto/algorithms/olm.ts index eb93a06a1..60a8f28a3 100644 --- a/src/crypto/algorithms/olm.ts +++ b/src/crypto/algorithms/olm.ts @@ -23,10 +23,10 @@ import { logger } from "../../logger.ts"; import * as olmlib from "../olmlib.ts"; import { DeviceInfo } from "../deviceinfo.ts"; import { DecryptionAlgorithm, EncryptionAlgorithm, registerAlgorithm } from "./base.ts"; -import { Room } from "../../models/room.ts"; -import { IContent, MatrixEvent } from "../../models/event.ts"; -import { IEncryptedContent, IOlmEncryptedContent } from "../index.ts"; -import { IInboundSession } from "../OlmDevice.ts"; +import { type Room } from "../../models/room.ts"; +import { type IContent, type MatrixEvent } from "../../models/event.ts"; +import { type IEncryptedContent, type IOlmEncryptedContent } from "../index.ts"; +import { type IInboundSession } from "../OlmDevice.ts"; import { DecryptionFailureCode } from "../../crypto-api/index.ts"; import { DecryptionError } from "../../common-crypto/CryptoBackend.ts"; diff --git a/src/crypto/api.ts b/src/crypto/api.ts index 0b5202777..b1fd010e3 100644 --- a/src/crypto/api.ts +++ b/src/crypto/api.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { DeviceInfo } from "./deviceinfo.ts"; +import { type DeviceInfo } from "./deviceinfo.ts"; /* re-exports for backwards compatibility. */ // CrossSigningKey is used as a value in `client.ts`, we can't export it as a type diff --git a/src/crypto/backup.ts b/src/crypto/backup.ts index 42233385f..c328c2c4f 100644 --- a/src/crypto/backup.ts +++ b/src/crypto/backup.ts @@ -22,27 +22,27 @@ import type { IMegolmSessionData } from "../@types/crypto.ts"; import { MatrixClient } from "../client.ts"; import { logger } from "../logger.ts"; import { MEGOLM_ALGORITHM, verifySignature } from "./olmlib.ts"; -import { DeviceInfo } from "./deviceinfo.ts"; -import { DeviceTrustLevel } from "./CrossSigning.ts"; +import { type DeviceInfo } from "./deviceinfo.ts"; +import { type DeviceTrustLevel } from "./CrossSigning.ts"; import { keyFromPassphrase } from "./key_passphrase.ts"; import { encodeUri, safeSet, sleep } from "../utils.ts"; import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store.ts"; import { - Curve25519SessionData, - IAes256AuthData, - ICurve25519AuthData, - IKeyBackupInfo, - IKeyBackupSession, + type Curve25519SessionData, + type IAes256AuthData, + type ICurve25519AuthData, + type IKeyBackupInfo, + type IKeyBackupSession, } from "./keybackup.ts"; import { UnstableValue } from "../NamespacedValue.ts"; import { CryptoEvent } from "./index.ts"; -import { ClientPrefix, HTTPError, MatrixError, Method } from "../http-api/index.ts"; -import { BackupTrustInfo } from "../crypto-api/keybackup.ts"; -import { BackupDecryptor } from "../common-crypto/CryptoBackend.ts"; +import { ClientPrefix, type HTTPError, MatrixError, Method } from "../http-api/index.ts"; +import { type BackupTrustInfo } from "../crypto-api/keybackup.ts"; +import { type BackupDecryptor } from "../common-crypto/CryptoBackend.ts"; import { encodeRecoveryKey } from "../crypto-api/index.ts"; import decryptAESSecretStorageItem from "../utils/decryptAESSecretStorageItem.ts"; import encryptAESSecretStorageItem from "../utils/encryptAESSecretStorageItem.ts"; -import { AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts"; +import { type AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts"; import { calculateKeyCheck } from "../secret-storage.ts"; const KEY_BACKUP_KEYS_PER_REQUEST = 200; diff --git a/src/crypto/dehydration.ts b/src/crypto/dehydration.ts index 31f69ee0a..a995611f7 100644 --- a/src/crypto/dehydration.ts +++ b/src/crypto/dehydration.ts @@ -20,9 +20,9 @@ import type { IDeviceKeys, IOneTimeKey } from "../@types/crypto.ts"; import { decodeBase64, encodeBase64 } from "../base64.ts"; import { IndexedDBCryptoStore } from "../crypto/store/indexeddb-crypto-store.ts"; import { logger } from "../logger.ts"; -import { Crypto } from "./index.ts"; +import { type Crypto } from "./index.ts"; import { Method } from "../http-api/index.ts"; -import { SecretStorageKeyDescription } from "../secret-storage.ts"; +import { type SecretStorageKeyDescription } from "../secret-storage.ts"; import decryptAESSecretStorageItem from "../utils/decryptAESSecretStorageItem.ts"; import encryptAESSecretStorageItem from "../utils/encryptAESSecretStorageItem.ts"; diff --git a/src/crypto/device-converter.ts b/src/crypto/device-converter.ts index a2591150c..c1ffe42c6 100644 --- a/src/crypto/device-converter.ts +++ b/src/crypto/device-converter.ts @@ -15,7 +15,7 @@ limitations under the License. */ import { Device } from "../models/device.ts"; -import { DeviceInfo } from "./deviceinfo.ts"; +import { type DeviceInfo } from "./deviceinfo.ts"; /** * Convert a {@link DeviceInfo} to a {@link Device}. diff --git a/src/crypto/deviceinfo.ts b/src/crypto/deviceinfo.ts index 7641af316..9e130c674 100644 --- a/src/crypto/deviceinfo.ts +++ b/src/crypto/deviceinfo.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { ISignatures } from "../@types/signed.ts"; +import { type ISignatures } from "../@types/signed.ts"; import { DeviceVerification } from "../models/device.ts"; export interface IDevice { diff --git a/src/crypto/index.ts b/src/crypto/index.ts index 5f457f149..dd499d730 100644 --- a/src/crypto/index.ts +++ b/src/crypto/index.ts @@ -25,96 +25,102 @@ import type { PkDecryption, PkSigning } from "@matrix-org/olm"; import { EventType, ToDeviceMessageId } from "../@types/event.ts"; import { TypedReEmitter } from "../ReEmitter.ts"; import { logger } from "../logger.ts"; -import { IExportedDevice, OlmDevice } from "./OlmDevice.ts"; -import { IOlmDevice } from "./algorithms/megolm.ts"; +import { type IExportedDevice, OlmDevice } from "./OlmDevice.ts"; +import { type IOlmDevice } from "./algorithms/megolm.ts"; import * as olmlib from "./olmlib.ts"; -import { DeviceInfoMap, DeviceList } from "./DeviceList.ts"; -import { DeviceInfo, IDevice } from "./deviceinfo.ts"; +import { type DeviceInfoMap, DeviceList } from "./DeviceList.ts"; +import { DeviceInfo, type IDevice } from "./deviceinfo.ts"; import type { DecryptionAlgorithm, EncryptionAlgorithm } from "./algorithms/index.ts"; import * as algorithms from "./algorithms/index.ts"; import { createCryptoStoreCacheCallbacks, CrossSigningInfo, DeviceTrustLevel, UserTrustLevel } from "./CrossSigning.ts"; import { EncryptionSetupBuilder } from "./EncryptionSetup.ts"; import { SecretStorage as LegacySecretStorage } from "./SecretStorage.ts"; -import { CrossSigningKey, ICreateSecretStorageOpts, IEncryptedEventInfo, IRecoveryKey } from "./api.ts"; +import { CrossSigningKey, type ICreateSecretStorageOpts, type IEncryptedEventInfo, type IRecoveryKey } from "./api.ts"; import { OutgoingRoomKeyRequestManager } from "./OutgoingRoomKeyRequestManager.ts"; import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store.ts"; -import { VerificationBase } from "./verification/Base.ts"; +import { type VerificationBase } from "./verification/Base.ts"; import { ReciprocateQRCode, SCAN_QR_CODE_METHOD, SHOW_QR_CODE_METHOD } from "./verification/QRCode.ts"; import { SAS as SASVerification } from "./verification/SAS.ts"; import { keyFromPassphrase } from "./key_passphrase.ts"; import { VerificationRequest } from "./verification/request/VerificationRequest.ts"; import { InRoomChannel, InRoomRequests } from "./verification/request/InRoomChannel.ts"; -import { Request, ToDeviceChannel, ToDeviceRequests } from "./verification/request/ToDeviceChannel.ts"; +import { type Request, ToDeviceChannel, ToDeviceRequests } from "./verification/request/ToDeviceChannel.ts"; import { IllegalMethod } from "./verification/IllegalMethod.ts"; import { KeySignatureUploadError } from "../errors.ts"; import { DehydrationManager } from "./dehydration.ts"; import { BackupManager, LibOlmBackupDecryptor, backupTrustInfoFromLegacyTrustInfo } from "./backup.ts"; -import { IStore } from "../store/index.ts"; -import { Room, RoomEvent } from "../models/room.ts"; -import { RoomMember, RoomMemberEvent } from "../models/room-member.ts"; -import { EventStatus, IContent, IEvent, MatrixEvent, MatrixEventEvent } from "../models/event.ts"; -import { ToDeviceBatch, ToDevicePayload } from "../models/ToDeviceMessage.ts"; -import { ClientEvent, IKeysUploadResponse, ISignedKey, IUploadKeySignaturesResponse, MatrixClient } from "../client.ts"; -import { IRoomEncryption, RoomList } from "./RoomList.ts"; -import { IKeyBackupInfo } from "./keybackup.ts"; -import { ISyncStateData } from "../sync.ts"; -import { CryptoStore } from "./store/base.ts"; -import { IVerificationChannel } from "./verification/request/Channel.ts"; -import { TypedEventEmitter } from "../models/typed-event-emitter.ts"; -import { IDeviceLists, ISyncResponse, IToDeviceEvent } from "../sync-accumulator.ts"; -import { ISignatures } from "../@types/signed.ts"; -import { IMessage } from "./algorithms/olm.ts"; +import { type IStore } from "../store/index.ts"; +import { type Room, RoomEvent } from "../models/room.ts"; +import { type RoomMember, RoomMemberEvent } from "../models/room-member.ts"; +import { EventStatus, type IContent, type IEvent, MatrixEvent, MatrixEventEvent } from "../models/event.ts"; +import { type ToDeviceBatch, type ToDevicePayload } from "../models/ToDeviceMessage.ts"; import { - BackupDecryptor, - CryptoBackend, + ClientEvent, + type IKeysUploadResponse, + type ISignedKey, + type IUploadKeySignaturesResponse, + MatrixClient, +} from "../client.ts"; +import { type IRoomEncryption, RoomList } from "./RoomList.ts"; +import { type IKeyBackupInfo } from "./keybackup.ts"; +import { type ISyncStateData } from "../sync.ts"; +import { type CryptoStore } from "./store/base.ts"; +import { type IVerificationChannel } from "./verification/request/Channel.ts"; +import { TypedEventEmitter } from "../models/typed-event-emitter.ts"; +import { type IDeviceLists, type ISyncResponse, type IToDeviceEvent } from "../sync-accumulator.ts"; +import { type ISignatures } from "../@types/signed.ts"; +import { type IMessage } from "./algorithms/olm.ts"; +import { + type BackupDecryptor, + type CryptoBackend, DecryptionError, - OnSyncCompletedData, + type OnSyncCompletedData, } from "../common-crypto/CryptoBackend.ts"; -import { RoomState, RoomStateEvent } from "../models/room-state.ts"; +import { type RoomState, RoomStateEvent } from "../models/room-state.ts"; import { MapWithDefault, recursiveMapToObject } from "../utils.ts"; import { - AccountDataClient, - AddSecretStorageKeyOpts, + type AccountDataClient, + type AddSecretStorageKeyOpts, calculateKeyCheck, SECRET_STORAGE_ALGORITHM_V1_AES, - SecretStorageKey, - SecretStorageKeyDescription, - SecretStorageKeyObject, - SecretStorageKeyTuple, + type SecretStorageKey, + type SecretStorageKeyDescription, + type SecretStorageKeyObject, + type SecretStorageKeyTuple, ServerSideSecretStorageImpl, } from "../secret-storage.ts"; -import { ISecretRequest } from "./SecretSharing.ts"; +import { type ISecretRequest } from "./SecretSharing.ts"; import { - BackupTrustInfo, - BootstrapCrossSigningOpts, - CrossSigningKeyInfo, - CrossSigningStatus, + type BackupTrustInfo, + type BootstrapCrossSigningOpts, + type CrossSigningKeyInfo, + type CrossSigningStatus, decodeRecoveryKey, DecryptionFailureCode, - DeviceIsolationMode, - DeviceVerificationStatus, + type DeviceIsolationMode, + type DeviceVerificationStatus, encodeRecoveryKey, - EventEncryptionInfo, + type EventEncryptionInfo, EventShieldColour, EventShieldReason, - ImportRoomKeysOpts, - KeyBackupCheck, - KeyBackupInfo, - OwnDeviceKeys, + type ImportRoomKeysOpts, + type KeyBackupCheck, + type KeyBackupInfo, + type OwnDeviceKeys, CryptoEvent as CryptoApiCryptoEvent, - CryptoEventHandlerMap as CryptoApiCryptoEventHandlerMap, - KeyBackupRestoreResult, - KeyBackupRestoreOpts, - StartDehydrationOpts, + type CryptoEventHandlerMap as CryptoApiCryptoEventHandlerMap, + type KeyBackupRestoreResult, + type KeyBackupRestoreOpts, + type StartDehydrationOpts, } from "../crypto-api/index.ts"; -import { Device, DeviceMap } from "../models/device.ts"; +import { type Device, type DeviceMap } from "../models/device.ts"; import { deviceInfoToDevice } from "./device-converter.ts"; import { ClientPrefix, MatrixError, Method } from "../http-api/index.ts"; import { decodeBase64, encodeBase64 } from "../base64.ts"; import { KnownMembership } from "../@types/membership.ts"; import decryptAESSecretStorageItem from "../utils/decryptAESSecretStorageItem.ts"; import encryptAESSecretStorageItem from "../utils/encryptAESSecretStorageItem.ts"; -import { AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts"; +import { type AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts"; /* re-exports for backwards compatibility */ export type { diff --git a/src/crypto/keybackup.ts b/src/crypto/keybackup.ts index 4399a3860..769436938 100644 --- a/src/crypto/keybackup.ts +++ b/src/crypto/keybackup.ts @@ -15,7 +15,7 @@ limitations under the License. */ // Export for backward compatibility -import { ImportRoomKeyProgressData } from "../crypto-api/index.ts"; +import { type ImportRoomKeyProgressData } from "../crypto-api/index.ts"; export type { Curve25519AuthData as ICurve25519AuthData, diff --git a/src/crypto/olmlib.ts b/src/crypto/olmlib.ts index 6a99daacb..c908af26e 100644 --- a/src/crypto/olmlib.ts +++ b/src/crypto/olmlib.ts @@ -22,14 +22,14 @@ import anotherjson from "another-json"; import type { PkSigning } from "@matrix-org/olm"; import type { IOneTimeKey } from "../@types/crypto.ts"; -import { OlmDevice } from "./OlmDevice.ts"; -import { DeviceInfo } from "./deviceinfo.ts"; -import { Logger, logger } from "../logger.ts"; -import { IClaimOTKsResult, MatrixClient } from "../client.ts"; -import { ISignatures } from "../@types/signed.ts"; -import { MatrixEvent } from "../models/event.ts"; +import { type OlmDevice } from "./OlmDevice.ts"; +import { type DeviceInfo } from "./deviceinfo.ts"; +import { type Logger, logger } from "../logger.ts"; +import { type IClaimOTKsResult, type MatrixClient } from "../client.ts"; +import { type ISignatures } from "../@types/signed.ts"; +import { type MatrixEvent } from "../models/event.ts"; import { EventType } from "../@types/event.ts"; -import { IMessage } from "./algorithms/olm.ts"; +import { type IMessage } from "./algorithms/olm.ts"; import { MapWithDefault } from "../utils.ts"; enum Algorithm { diff --git a/src/crypto/store/base.ts b/src/crypto/store/base.ts index 6bbd139d1..ba1a5675b 100644 --- a/src/crypto/store/base.ts +++ b/src/crypto/store/base.ts @@ -14,19 +14,19 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IRoomKeyRequestBody, IRoomKeyRequestRecipient } from "../index.ts"; -import { RoomKeyRequestState } from "../OutgoingRoomKeyRequestManager.ts"; -import { IOlmDevice } from "../algorithms/megolm.ts"; -import { TrackingStatus } from "../DeviceList.ts"; -import { IRoomEncryption } from "../RoomList.ts"; -import { IDevice } from "../deviceinfo.ts"; -import { ICrossSigningInfo } from "../CrossSigning.ts"; -import { Logger } from "../../logger.ts"; -import { InboundGroupSessionData } from "../OlmDevice.ts"; -import { MatrixEvent } from "../../models/event.ts"; -import { DehydrationManager } from "../dehydration.ts"; -import { CrossSigningKeyInfo } from "../../crypto-api/index.ts"; -import { AESEncryptedSecretStoragePayload } from "../../@types/AESEncryptedSecretStoragePayload.ts"; +import { type IRoomKeyRequestBody, type IRoomKeyRequestRecipient } from "../index.ts"; +import { type RoomKeyRequestState } from "../OutgoingRoomKeyRequestManager.ts"; +import { type IOlmDevice } from "../algorithms/megolm.ts"; +import { type TrackingStatus } from "../DeviceList.ts"; +import { type IRoomEncryption } from "../RoomList.ts"; +import { type IDevice } from "../deviceinfo.ts"; +import { type ICrossSigningInfo } from "../CrossSigning.ts"; +import { type Logger } from "../../logger.ts"; +import { type InboundGroupSessionData } from "../OlmDevice.ts"; +import { type MatrixEvent } from "../../models/event.ts"; +import { type DehydrationManager } from "../dehydration.ts"; +import { type CrossSigningKeyInfo } from "../../crypto-api/index.ts"; +import { type AESEncryptedSecretStoragePayload } from "../../@types/AESEncryptedSecretStoragePayload.ts"; /** * Internal module. Definitions for storage for the crypto module diff --git a/src/crypto/store/indexeddb-crypto-store-backend.ts b/src/crypto/store/indexeddb-crypto-store-backend.ts index 6705ce0ed..6e0300397 100644 --- a/src/crypto/store/indexeddb-crypto-store-backend.ts +++ b/src/crypto/store/indexeddb-crypto-store-backend.ts @@ -14,30 +14,30 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Logger, logger } from "../../logger.ts"; +import { type Logger, logger } from "../../logger.ts"; import { deepCompare } from "../../utils.ts"; import { - CryptoStore, - IDeviceData, - IProblem, - ISession, - SessionExtended, - ISessionInfo, - IWithheld, + type CryptoStore, + type IDeviceData, + type IProblem, + type ISession, + type SessionExtended, + type ISessionInfo, + type IWithheld, MigrationState, - Mode, - OutgoingRoomKeyRequest, - ParkedSharedHistory, - SecretStorePrivateKeys, + type Mode, + type OutgoingRoomKeyRequest, + type ParkedSharedHistory, + type SecretStorePrivateKeys, SESSION_BATCH_SIZE, ACCOUNT_OBJECT_KEY_MIGRATION_STATE, } from "./base.ts"; -import { IRoomKeyRequestBody, IRoomKeyRequestRecipient } from "../index.ts"; -import { IOlmDevice } from "../algorithms/megolm.ts"; -import { IRoomEncryption } from "../RoomList.ts"; -import { InboundGroupSessionData } from "../OlmDevice.ts"; +import { type IRoomKeyRequestBody, type IRoomKeyRequestRecipient } from "../index.ts"; +import { type IOlmDevice } from "../algorithms/megolm.ts"; +import { type IRoomEncryption } from "../RoomList.ts"; +import { type InboundGroupSessionData } from "../OlmDevice.ts"; import { IndexedDBCryptoStore } from "./indexeddb-crypto-store.ts"; -import { CrossSigningKeyInfo } from "../../crypto-api/index.ts"; +import { type CrossSigningKeyInfo } from "../../crypto-api/index.ts"; const PROFILE_TRANSACTIONS = false; diff --git a/src/crypto/store/indexeddb-crypto-store.ts b/src/crypto/store/indexeddb-crypto-store.ts index 038322e2b..b5c7dc651 100644 --- a/src/crypto/store/indexeddb-crypto-store.ts +++ b/src/crypto/store/indexeddb-crypto-store.ts @@ -14,32 +14,32 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { logger, Logger } from "../../logger.ts"; +import { logger, type Logger } from "../../logger.ts"; import { LocalStorageCryptoStore } from "./localStorage-crypto-store.ts"; import { MemoryCryptoStore } from "./memory-crypto-store.ts"; import * as IndexedDBCryptoStoreBackend from "./indexeddb-crypto-store-backend.ts"; import { InvalidCryptoStoreError, InvalidCryptoStoreState } from "../../errors.ts"; import * as IndexedDBHelpers from "../../indexeddb-helpers.ts"; import { - CryptoStore, - IDeviceData, - IProblem, - ISession, - SessionExtended, - ISessionInfo, - IWithheld, + type CryptoStore, + type IDeviceData, + type IProblem, + type ISession, + type SessionExtended, + type ISessionInfo, + type IWithheld, MigrationState, - Mode, - OutgoingRoomKeyRequest, - ParkedSharedHistory, - SecretStorePrivateKeys, + type Mode, + type OutgoingRoomKeyRequest, + type ParkedSharedHistory, + type SecretStorePrivateKeys, ACCOUNT_OBJECT_KEY_MIGRATION_STATE, } from "./base.ts"; -import { IRoomKeyRequestBody } from "../index.ts"; -import { IOlmDevice } from "../algorithms/megolm.ts"; -import { IRoomEncryption } from "../RoomList.ts"; -import { InboundGroupSessionData } from "../OlmDevice.ts"; -import { CrossSigningKeyInfo } from "../../crypto-api/index.ts"; +import { type IRoomKeyRequestBody } from "../index.ts"; +import { type IOlmDevice } from "../algorithms/megolm.ts"; +import { type IRoomEncryption } from "../RoomList.ts"; +import { type InboundGroupSessionData } from "../OlmDevice.ts"; +import { type CrossSigningKeyInfo } from "../../crypto-api/index.ts"; /* * Internal module. indexeddb storage for e2e. diff --git a/src/crypto/store/localStorage-crypto-store.ts b/src/crypto/store/localStorage-crypto-store.ts index 818a83140..f3333083d 100644 --- a/src/crypto/store/localStorage-crypto-store.ts +++ b/src/crypto/store/localStorage-crypto-store.ts @@ -17,23 +17,23 @@ limitations under the License. import { logger } from "../../logger.ts"; import { MemoryCryptoStore } from "./memory-crypto-store.ts"; import { - CryptoStore, - IDeviceData, - IProblem, - ISession, - SessionExtended, - ISessionInfo, - IWithheld, + type CryptoStore, + type IDeviceData, + type IProblem, + type ISession, + type SessionExtended, + type ISessionInfo, + type IWithheld, MigrationState, - Mode, - SecretStorePrivateKeys, + type Mode, + type SecretStorePrivateKeys, SESSION_BATCH_SIZE, } from "./base.ts"; -import { IOlmDevice } from "../algorithms/megolm.ts"; -import { IRoomEncryption } from "../RoomList.ts"; -import { InboundGroupSessionData } from "../OlmDevice.ts"; +import { type IOlmDevice } from "../algorithms/megolm.ts"; +import { type IRoomEncryption } from "../RoomList.ts"; +import { type InboundGroupSessionData } from "../OlmDevice.ts"; import { safeSet } from "../../utils.ts"; -import { CrossSigningKeyInfo } from "../../crypto-api/index.ts"; +import { type CrossSigningKeyInfo } from "../../crypto-api/index.ts"; /** * Internal module. Partial localStorage backed storage for e2e. diff --git a/src/crypto/store/memory-crypto-store.ts b/src/crypto/store/memory-crypto-store.ts index 65fca29d7..cf8aaa205 100644 --- a/src/crypto/store/memory-crypto-store.ts +++ b/src/crypto/store/memory-crypto-store.ts @@ -17,25 +17,25 @@ limitations under the License. import { logger } from "../../logger.ts"; import { deepCompare, promiseTry, safeSet } from "../../utils.ts"; import { - CryptoStore, - IDeviceData, - IProblem, - ISession, - SessionExtended, - ISessionInfo, - IWithheld, + type CryptoStore, + type IDeviceData, + type IProblem, + type ISession, + type SessionExtended, + type ISessionInfo, + type IWithheld, MigrationState, - Mode, - OutgoingRoomKeyRequest, - ParkedSharedHistory, - SecretStorePrivateKeys, + type Mode, + type OutgoingRoomKeyRequest, + type ParkedSharedHistory, + type SecretStorePrivateKeys, SESSION_BATCH_SIZE, } from "./base.ts"; -import { IRoomKeyRequestBody } from "../index.ts"; -import { IOlmDevice } from "../algorithms/megolm.ts"; -import { IRoomEncryption } from "../RoomList.ts"; -import { InboundGroupSessionData } from "../OlmDevice.ts"; -import { CrossSigningKeyInfo } from "../../crypto-api/index.ts"; +import { type IRoomKeyRequestBody } from "../index.ts"; +import { type IOlmDevice } from "../algorithms/megolm.ts"; +import { type IRoomEncryption } from "../RoomList.ts"; +import { type InboundGroupSessionData } from "../OlmDevice.ts"; +import { type CrossSigningKeyInfo } from "../../crypto-api/index.ts"; function encodeSessionKey(senderCurve25519Key: string, sessionId: string): string { return encodeURIComponent(senderCurve25519Key) + "/" + encodeURIComponent(sessionId); diff --git a/src/crypto/verification/Base.ts b/src/crypto/verification/Base.ts index 179c868b6..028a6c3f9 100644 --- a/src/crypto/verification/Base.ts +++ b/src/crypto/verification/Base.ts @@ -24,17 +24,17 @@ import { EventType } from "../../@types/event.ts"; import { logger } from "../../logger.ts"; import { DeviceInfo } from "../deviceinfo.ts"; import { newTimeoutError } from "./Error.ts"; -import { KeysDuringVerification, requestKeysDuringVerification } from "../CrossSigning.ts"; -import { IVerificationChannel } from "./request/Channel.ts"; -import { MatrixClient } from "../../client.ts"; -import { VerificationRequest } from "./request/VerificationRequest.ts"; +import { type KeysDuringVerification, requestKeysDuringVerification } from "../CrossSigning.ts"; +import { type IVerificationChannel } from "./request/Channel.ts"; +import { type MatrixClient } from "../../client.ts"; +import { type VerificationRequest } from "./request/VerificationRequest.ts"; import { TypedEventEmitter } from "../../models/typed-event-emitter.ts"; import { - ShowQrCodeCallbacks, - ShowSasCallbacks, - Verifier, + type ShowQrCodeCallbacks, + type ShowSasCallbacks, + type Verifier, VerifierEvent, - VerifierEventHandlerMap, + type VerifierEventHandlerMap, } from "../../crypto-api/verification.ts"; const timeoutException = new Error("Verification timed out"); diff --git a/src/crypto/verification/IllegalMethod.ts b/src/crypto/verification/IllegalMethod.ts index c556be717..2b5a88597 100644 --- a/src/crypto/verification/IllegalMethod.ts +++ b/src/crypto/verification/IllegalMethod.ts @@ -19,11 +19,11 @@ limitations under the License. * do verification with this method). */ -import { VerificationBase as Base, VerificationEvent, VerificationEventHandlerMap } from "./Base.ts"; -import { IVerificationChannel } from "./request/Channel.ts"; -import { MatrixClient } from "../../client.ts"; -import { MatrixEvent } from "../../models/event.ts"; -import { VerificationRequest } from "./request/VerificationRequest.ts"; +import { VerificationBase as Base, type VerificationEvent, type VerificationEventHandlerMap } from "./Base.ts"; +import { type IVerificationChannel } from "./request/Channel.ts"; +import { type MatrixClient } from "../../client.ts"; +import { type MatrixEvent } from "../../models/event.ts"; +import { type VerificationRequest } from "./request/VerificationRequest.ts"; export class IllegalMethod extends Base { public static factory( diff --git a/src/crypto/verification/QRCode.ts b/src/crypto/verification/QRCode.ts index 4caaf42b6..b4cb17136 100644 --- a/src/crypto/verification/QRCode.ts +++ b/src/crypto/verification/QRCode.ts @@ -22,11 +22,11 @@ import { VerificationBase as Base } from "./Base.ts"; import { newKeyMismatchError, newUserCancelledError } from "./Error.ts"; import { decodeBase64, encodeUnpaddedBase64 } from "../../base64.ts"; import { logger } from "../../logger.ts"; -import { VerificationRequest } from "./request/VerificationRequest.ts"; -import { MatrixClient } from "../../client.ts"; -import { IVerificationChannel } from "./request/Channel.ts"; -import { MatrixEvent } from "../../models/event.ts"; -import { ShowQrCodeCallbacks, VerifierEvent } from "../../crypto-api/verification.ts"; +import { type VerificationRequest } from "./request/VerificationRequest.ts"; +import { type MatrixClient } from "../../client.ts"; +import { type IVerificationChannel } from "./request/Channel.ts"; +import { type MatrixEvent } from "../../models/event.ts"; +import { type ShowQrCodeCallbacks, VerifierEvent } from "../../crypto-api/verification.ts"; import { VerificationMethod } from "../../types.ts"; export const SHOW_QR_CODE_METHOD = VerificationMethod.ShowQrCode; diff --git a/src/crypto/verification/SAS.ts b/src/crypto/verification/SAS.ts index bcc2c0a85..f956b5756 100644 --- a/src/crypto/verification/SAS.ts +++ b/src/crypto/verification/SAS.ts @@ -19,7 +19,7 @@ limitations under the License. */ import anotherjson from "another-json"; -import { Utility, SAS as OlmSAS } from "@matrix-org/olm"; +import { type Utility, type SAS as OlmSAS } from "@matrix-org/olm"; import { VerificationBase as Base, SwitchStartEventError } from "./Base.ts"; import { @@ -30,10 +30,15 @@ import { newUserCancelledError, } from "./Error.ts"; import { logger } from "../../logger.ts"; -import { IContent, MatrixEvent } from "../../models/event.ts"; +import { type IContent, type MatrixEvent } from "../../models/event.ts"; import { generateDecimalSas } from "./SASDecimal.ts"; import { EventType } from "../../@types/event.ts"; -import { EmojiMapping, GeneratedSas, ShowSasCallbacks, VerifierEvent } from "../../crypto-api/verification.ts"; +import { + type EmojiMapping, + type GeneratedSas, + type ShowSasCallbacks, + VerifierEvent, +} from "../../crypto-api/verification.ts"; import { VerificationMethod } from "../../types.ts"; // backwards-compatibility exports diff --git a/src/crypto/verification/request/Channel.ts b/src/crypto/verification/request/Channel.ts index cb45c7b76..3b3a6385f 100644 --- a/src/crypto/verification/request/Channel.ts +++ b/src/crypto/verification/request/Channel.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixEvent } from "../../../models/event.ts"; -import { VerificationRequest } from "./VerificationRequest.ts"; +import { type MatrixEvent } from "../../../models/event.ts"; +import { type VerificationRequest } from "./VerificationRequest.ts"; export interface IVerificationChannel { request?: VerificationRequest; diff --git a/src/crypto/verification/request/InRoomChannel.ts b/src/crypto/verification/request/InRoomChannel.ts index 05dcce872..bbb8bcbca 100644 --- a/src/crypto/verification/request/InRoomChannel.ts +++ b/src/crypto/verification/request/InRoomChannel.ts @@ -17,11 +17,11 @@ limitations under the License. import { VerificationRequest, REQUEST_TYPE, READY_TYPE, START_TYPE } from "./VerificationRequest.ts"; import { logger } from "../../../logger.ts"; -import { IVerificationChannel } from "./Channel.ts"; -import { EventType, TimelineEvents } from "../../../@types/event.ts"; -import { MatrixClient } from "../../../client.ts"; -import { MatrixEvent } from "../../../models/event.ts"; -import { IRequestsMap } from "../../index.ts"; +import { type IVerificationChannel } from "./Channel.ts"; +import { EventType, type TimelineEvents } from "../../../@types/event.ts"; +import { type MatrixClient } from "../../../client.ts"; +import { type MatrixEvent } from "../../../models/event.ts"; +import { type IRequestsMap } from "../../index.ts"; const MESSAGE_TYPE = EventType.RoomMessage; const M_REFERENCE = "m.reference"; diff --git a/src/crypto/verification/request/ToDeviceChannel.ts b/src/crypto/verification/request/ToDeviceChannel.ts index 97e3c313a..3083f472a 100644 --- a/src/crypto/verification/request/ToDeviceChannel.ts +++ b/src/crypto/verification/request/ToDeviceChannel.ts @@ -28,9 +28,9 @@ import { } from "./VerificationRequest.ts"; import { errorFromEvent, newUnexpectedMessageError } from "../Error.ts"; import { MatrixEvent } from "../../../models/event.ts"; -import { IVerificationChannel } from "./Channel.ts"; -import { MatrixClient } from "../../../client.ts"; -import { IRequestsMap } from "../../index.ts"; +import { type IVerificationChannel } from "./Channel.ts"; +import { type MatrixClient } from "../../../client.ts"; +import { type IRequestsMap } from "../../index.ts"; export type Request = VerificationRequest; diff --git a/src/crypto/verification/request/VerificationRequest.ts b/src/crypto/verification/request/VerificationRequest.ts index ac6111d26..08a0c3602 100644 --- a/src/crypto/verification/request/VerificationRequest.ts +++ b/src/crypto/verification/request/VerificationRequest.ts @@ -17,20 +17,20 @@ limitations under the License. import { logger } from "../../../logger.ts"; import { errorFactory, errorFromEvent, newUnexpectedMessageError, newUnknownMethodError } from "../Error.ts"; import { QRCodeData, SCAN_QR_CODE_METHOD } from "../QRCode.ts"; -import { IVerificationChannel } from "./Channel.ts"; -import { MatrixClient } from "../../../client.ts"; -import { MatrixEvent } from "../../../models/event.ts"; +import { type IVerificationChannel } from "./Channel.ts"; +import { type MatrixClient } from "../../../client.ts"; +import { type MatrixEvent } from "../../../models/event.ts"; import { EventType } from "../../../@types/event.ts"; -import { VerificationBase } from "../Base.ts"; -import { VerificationMethod } from "../../index.ts"; +import { type VerificationBase } from "../Base.ts"; +import { type VerificationMethod } from "../../index.ts"; import { TypedEventEmitter } from "../../../models/typed-event-emitter.ts"; import { canAcceptVerificationRequest, VerificationPhase as Phase, - VerificationRequest as IVerificationRequest, + type VerificationRequest as IVerificationRequest, VerificationRequestEvent, - VerificationRequestEventHandlerMap, - Verifier, + type VerificationRequestEventHandlerMap, + type Verifier, } from "../../../crypto-api/verification.ts"; // backwards-compatibility exports diff --git a/src/embedded.ts b/src/embedded.ts index efa6ffbf7..b62373ae0 100644 --- a/src/embedded.ts +++ b/src/embedded.ts @@ -15,49 +15,49 @@ limitations under the License. */ import { - WidgetApi, + type WidgetApi, WidgetApiToWidgetAction, WidgetApiResponseError, MatrixCapabilities, - IWidgetApiRequest, - IWidgetApiAcknowledgeResponseData, - ISendEventToWidgetActionRequest, - ISendToDeviceToWidgetActionRequest, - ISendEventFromWidgetResponseData, - IWidgetApiRequestData, - WidgetApiAction, - IWidgetApiResponse, - IWidgetApiResponseData, + type IWidgetApiRequest, + type IWidgetApiAcknowledgeResponseData, + type ISendEventToWidgetActionRequest, + type ISendToDeviceToWidgetActionRequest, + type ISendEventFromWidgetResponseData, + type IWidgetApiRequestData, + type WidgetApiAction, + type IWidgetApiResponse, + type IWidgetApiResponseData, } from "matrix-widget-api"; -import { MatrixEvent, IEvent, IContent, EventStatus } from "./models/event.ts"; +import { MatrixEvent, type IEvent, type IContent, EventStatus } from "./models/event.ts"; import { - ISendEventResponse, - SendDelayedEventRequestOpts, - SendDelayedEventResponse, - UpdateDelayedEventAction, + type ISendEventResponse, + type SendDelayedEventRequestOpts, + type SendDelayedEventResponse, + type UpdateDelayedEventAction, } from "./@types/requests.ts"; -import { EventType, StateEvents } from "./@types/event.ts"; +import { EventType, type StateEvents } from "./@types/event.ts"; import { logger } from "./logger.ts"; import { MatrixClient, ClientEvent, - IMatrixClientCreateOpts, - IStartClientOpts, - SendToDeviceContentMap, - IOpenIDToken, + type IMatrixClientCreateOpts, + type IStartClientOpts, + type SendToDeviceContentMap, + type IOpenIDToken, UNSTABLE_MSC4140_DELAYED_EVENTS, } from "./client.ts"; import { SyncApi, SyncState } from "./sync.ts"; import { SlidingSyncSdk } from "./sliding-sync-sdk.ts"; import { MatrixError } from "./http-api/errors.ts"; import { User } from "./models/user.ts"; -import { Room } from "./models/room.ts"; -import { ToDeviceBatch, ToDevicePayload } from "./models/ToDeviceMessage.ts"; -import { DeviceInfo } from "./crypto/deviceinfo.ts"; -import { IOlmDevice } from "./crypto/algorithms/megolm.ts"; +import { type Room } from "./models/room.ts"; +import { type ToDeviceBatch, type ToDevicePayload } from "./models/ToDeviceMessage.ts"; +import { type DeviceInfo } from "./crypto/deviceinfo.ts"; +import { type IOlmDevice } from "./crypto/algorithms/megolm.ts"; import { MapWithDefault, recursiveMapToObject } from "./utils.ts"; -import { EmptyObject, TypedEventEmitter } from "./matrix.ts"; +import { type EmptyObject, TypedEventEmitter } from "./matrix.ts"; interface IStateEventRequest { eventType: string; diff --git a/src/event-mapper.ts b/src/event-mapper.ts index 7dbf6a3c1..8002f2add 100644 --- a/src/event-mapper.ts +++ b/src/event-mapper.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixClient } from "./client.ts"; -import { IEvent, MatrixEvent, MatrixEventEvent } from "./models/event.ts"; +import { type MatrixClient } from "./client.ts"; +import { type IEvent, MatrixEvent, MatrixEventEvent } from "./models/event.ts"; import { RelationType } from "./@types/event.ts"; export type EventMapper = (obj: Partial) => MatrixEvent; diff --git a/src/extensible_events_v1/ExtensibleEvent.ts b/src/extensible_events_v1/ExtensibleEvent.ts index 3bfa0632e..df3a77143 100644 --- a/src/extensible_events_v1/ExtensibleEvent.ts +++ b/src/extensible_events_v1/ExtensibleEvent.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { ExtensibleEventType, IPartialEvent } from "../@types/extensible_events.ts"; +import { type ExtensibleEventType, type IPartialEvent } from "../@types/extensible_events.ts"; /** * Represents an Extensible Event in Matrix. diff --git a/src/extensible_events_v1/MessageEvent.ts b/src/extensible_events_v1/MessageEvent.ts index 17457f049..fba88b840 100644 --- a/src/extensible_events_v1/MessageEvent.ts +++ b/src/extensible_events_v1/MessageEvent.ts @@ -14,17 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Optional } from "matrix-events-sdk"; +import { type Optional } from "matrix-events-sdk"; import { ExtensibleEvent } from "./ExtensibleEvent.ts"; import { - ExtensibleEventType, - IMessageRendering, - IPartialEvent, + type ExtensibleEventType, + type IMessageRendering, + type IPartialEvent, isEventTypeSame, M_HTML, M_MESSAGE, - ExtensibleAnyMessageEventContent, + type ExtensibleAnyMessageEventContent, M_TEXT, } from "../@types/extensible_events.ts"; import { isOptionalAString, isProvided } from "./utilities.ts"; diff --git a/src/extensible_events_v1/PollEndEvent.ts b/src/extensible_events_v1/PollEndEvent.ts index 87cd49569..26f10847b 100644 --- a/src/extensible_events_v1/PollEndEvent.ts +++ b/src/extensible_events_v1/PollEndEvent.ts @@ -15,13 +15,13 @@ limitations under the License. */ import { - ExtensibleEventType, - IPartialEvent, + type ExtensibleEventType, + type IPartialEvent, isEventTypeSame, M_TEXT, REFERENCE_RELATION, } from "../@types/extensible_events.ts"; -import { M_POLL_END, PollEndEventContent } from "../@types/polls.ts"; +import { M_POLL_END, type PollEndEventContent } from "../@types/polls.ts"; import { ExtensibleEvent } from "./ExtensibleEvent.ts"; import { InvalidEventError } from "./InvalidEventError.ts"; import { MessageEvent } from "./MessageEvent.ts"; diff --git a/src/extensible_events_v1/PollResponseEvent.ts b/src/extensible_events_v1/PollResponseEvent.ts index 9e7659ba7..7a1c39494 100644 --- a/src/extensible_events_v1/PollResponseEvent.ts +++ b/src/extensible_events_v1/PollResponseEvent.ts @@ -15,15 +15,15 @@ limitations under the License. */ import { ExtensibleEvent } from "./ExtensibleEvent.ts"; -import { M_POLL_RESPONSE, PollResponseEventContent, PollResponseSubtype } from "../@types/polls.ts"; +import { M_POLL_RESPONSE, type PollResponseEventContent, type PollResponseSubtype } from "../@types/polls.ts"; import { - ExtensibleEventType, - IPartialEvent, + type ExtensibleEventType, + type IPartialEvent, isEventTypeSame, REFERENCE_RELATION, } from "../@types/extensible_events.ts"; import { InvalidEventError } from "./InvalidEventError.ts"; -import { PollStartEvent } from "./PollStartEvent.ts"; +import { type PollStartEvent } from "./PollStartEvent.ts"; /** * Represents a poll response event. diff --git a/src/extensible_events_v1/PollStartEvent.ts b/src/extensible_events_v1/PollStartEvent.ts index 98b15e2ad..04ca15344 100644 --- a/src/extensible_events_v1/PollStartEvent.ts +++ b/src/extensible_events_v1/PollStartEvent.ts @@ -17,15 +17,15 @@ limitations under the License. import { NamespacedValue } from "matrix-events-sdk"; import { MessageEvent } from "./MessageEvent.ts"; -import { ExtensibleEventType, IPartialEvent, isEventTypeSame, M_TEXT } from "../@types/extensible_events.ts"; +import { type ExtensibleEventType, type IPartialEvent, isEventTypeSame, M_TEXT } from "../@types/extensible_events.ts"; import { - KnownPollKind, + type KnownPollKind, M_POLL_KIND_DISCLOSED, M_POLL_KIND_UNDISCLOSED, M_POLL_START, - PollStartEventContent, - PollStartSubtype, - PollAnswer, + type PollStartEventContent, + type PollStartSubtype, + type PollAnswer, } from "../@types/polls.ts"; import { InvalidEventError } from "./InvalidEventError.ts"; import { ExtensibleEvent } from "./ExtensibleEvent.ts"; diff --git a/src/extensible_events_v1/utilities.ts b/src/extensible_events_v1/utilities.ts index 49911dc68..f66f0c532 100644 --- a/src/extensible_events_v1/utilities.ts +++ b/src/extensible_events_v1/utilities.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Optional } from "matrix-events-sdk"; +import { type Optional } from "matrix-events-sdk"; /** * Determines if the given optional was provided a value. diff --git a/src/feature.ts b/src/feature.ts index d189a74f3..686eff609 100644 --- a/src/feature.ts +++ b/src/feature.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IServerVersions } from "./client.ts"; +import { type IServerVersions } from "./client.ts"; export enum ServerSupport { Stable, diff --git a/src/filter-component.ts b/src/filter-component.ts index 41f2903cb..557fa80df 100644 --- a/src/filter-component.ts +++ b/src/filter-component.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { RelationType } from "./@types/event.ts"; -import { MatrixEvent } from "./models/event.ts"; +import { type RelationType } from "./@types/event.ts"; +import { type MatrixEvent } from "./models/event.ts"; import { FILTER_RELATED_BY_REL_TYPES, FILTER_RELATED_BY_SENDERS, THREAD_RELATION_TYPE } from "./models/thread.ts"; /** diff --git a/src/filter.ts b/src/filter.ts index d5ad00509..3b12c9c31 100644 --- a/src/filter.ts +++ b/src/filter.ts @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { EventType, RelationType } from "./@types/event.ts"; +import { type EventType, type RelationType } from "./@types/event.ts"; import { UNREAD_THREAD_NOTIFICATIONS } from "./@types/sync.ts"; -import { FilterComponent, IFilterComponent } from "./filter-component.ts"; -import { MatrixEvent } from "./models/event.ts"; +import { FilterComponent, type IFilterComponent } from "./filter-component.ts"; +import { type MatrixEvent } from "./models/event.ts"; /** */ diff --git a/src/http-api/errors.ts b/src/http-api/errors.ts index d8475e6ae..dee0f9963 100644 --- a/src/http-api/errors.ts +++ b/src/http-api/errors.ts @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IMatrixApiError as IWidgetMatrixError } from "matrix-widget-api"; +import { type IMatrixApiError as IWidgetMatrixError } from "matrix-widget-api"; -import { IUsageLimit } from "../@types/partials.ts"; -import { MatrixEvent } from "../models/event.ts"; +import { type IUsageLimit } from "../@types/partials.ts"; +import { type MatrixEvent } from "../models/event.ts"; interface IErrorJson extends Partial { [key: string]: any; // extensible diff --git a/src/http-api/fetch.ts b/src/http-api/fetch.ts index 3a8255a15..258ce0b71 100644 --- a/src/http-api/fetch.ts +++ b/src/http-api/fetch.ts @@ -19,12 +19,18 @@ limitations under the License. */ import { checkObjectHasKeys, encodeParams } from "../utils.ts"; -import { TypedEventEmitter } from "../models/typed-event-emitter.ts"; +import { type TypedEventEmitter } from "../models/typed-event-emitter.ts"; import { Method } from "./method.ts"; -import { ConnectionError, MatrixError } from "./errors.ts"; -import { HttpApiEvent, HttpApiEventHandlerMap, IHttpOpts, IRequestOpts, Body } from "./interface.ts"; +import { ConnectionError, type MatrixError } from "./errors.ts"; +import { + HttpApiEvent, + type HttpApiEventHandlerMap, + type IHttpOpts, + type IRequestOpts, + type Body, +} from "./interface.ts"; import { anySignal, parseErrorResponse, timeoutSignal } from "./utils.ts"; -import { QueryDict } from "../utils.ts"; +import { type QueryDict } from "../utils.ts"; interface TypedResponse extends Response { json(): Promise; diff --git a/src/http-api/index.ts b/src/http-api/index.ts index bb1efa41f..cd5db0a86 100644 --- a/src/http-api/index.ts +++ b/src/http-api/index.ts @@ -15,9 +15,16 @@ limitations under the License. */ import { FetchHttpApi } from "./fetch.ts"; -import { FileType, IContentUri, IHttpOpts, Upload, UploadOpts, UploadResponse } from "./interface.ts"; +import { + type FileType, + type IContentUri, + type IHttpOpts, + type Upload, + type UploadOpts, + type UploadResponse, +} from "./interface.ts"; import { MediaPrefix } from "./prefix.ts"; -import { defer, QueryDict, removeElement } from "../utils.ts"; +import { defer, type QueryDict, removeElement } from "../utils.ts"; import * as callbacks from "../realtime-callbacks.ts"; import { Method } from "./method.ts"; import { ConnectionError } from "./errors.ts"; diff --git a/src/http-api/interface.ts b/src/http-api/interface.ts index 57e8e6b09..bfa604c04 100644 --- a/src/http-api/interface.ts +++ b/src/http-api/interface.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixError } from "./errors.ts"; -import { Logger } from "../logger.ts"; +import { type MatrixError } from "./errors.ts"; +import { type Logger } from "../logger.ts"; export type Body = Record | BodyInit; diff --git a/src/http-api/utils.ts b/src/http-api/utils.ts index ef69c7e28..27dc32d7c 100644 --- a/src/http-api/utils.ts +++ b/src/http-api/utils.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { parse as parseContentType, ParsedMediaType } from "content-type"; +import { parse as parseContentType, type ParsedMediaType } from "content-type"; import { logger } from "../logger.ts"; import { sleep } from "../utils.ts"; diff --git a/src/interactive-auth.ts b/src/interactive-auth.ts index 57aec75cf..79bb2aa39 100644 --- a/src/interactive-auth.ts +++ b/src/interactive-auth.ts @@ -17,11 +17,11 @@ limitations under the License. */ import { logger } from "./logger.ts"; -import { MatrixClient } from "./client.ts"; -import { defer, IDeferred } from "./utils.ts"; +import { type MatrixClient } from "./client.ts"; +import { defer, type IDeferred } from "./utils.ts"; import { MatrixError } from "./http-api/index.ts"; -import { UIAResponse } from "./@types/uia.ts"; -import { UserIdentifier } from "./@types/auth.ts"; +import { type UIAResponse } from "./@types/uia.ts"; +import { type UserIdentifier } from "./@types/auth.ts"; const EMAIL_STAGE_TYPE = "m.login.email.identity"; const MSISDN_STAGE_TYPE = "m.login.msisdn"; diff --git a/src/matrix.ts b/src/matrix.ts index dcad1b5f4..c0c5f1307 100644 --- a/src/matrix.ts +++ b/src/matrix.ts @@ -14,14 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { WidgetApi } from "matrix-widget-api"; +import { type WidgetApi } from "matrix-widget-api"; import { MemoryCryptoStore } from "./crypto/store/memory-crypto-store.ts"; import { MemoryStore } from "./store/memory.ts"; import { MatrixScheduler } from "./scheduler.ts"; -import { MatrixClient, ICreateClientOpts } from "./client.ts"; -import { RoomWidgetClient, ICapabilities } from "./embedded.ts"; -import { CryptoStore } from "./crypto/store/base.ts"; +import { MatrixClient, type ICreateClientOpts } from "./client.ts"; +import { RoomWidgetClient, type ICapabilities } from "./embedded.ts"; +import { type CryptoStore } from "./crypto/store/base.ts"; export * from "./client.ts"; export * from "./serverCapabilities.ts"; diff --git a/src/matrixrtc/CallMembership.ts b/src/matrixrtc/CallMembership.ts index ce8f2ab65..5c62705d8 100644 --- a/src/matrixrtc/CallMembership.ts +++ b/src/matrixrtc/CallMembership.ts @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixEvent } from "../matrix.ts"; +import { type MatrixEvent } from "../matrix.ts"; import { deepCompare } from "../utils.ts"; -import { Focus } from "./focus.ts"; +import { type Focus } from "./focus.ts"; import { isLivekitFocusActive } from "./LivekitFocus.ts"; /** diff --git a/src/matrixrtc/EncryptionManager.ts b/src/matrixrtc/EncryptionManager.ts index 033fc3272..0ddaf7f87 100644 --- a/src/matrixrtc/EncryptionManager.ts +++ b/src/matrixrtc/EncryptionManager.ts @@ -1,13 +1,13 @@ import { type MatrixClient } from "../client.ts"; import { logger as rootLogger } from "../logger.ts"; -import { MatrixEvent } from "../models/event.ts"; -import { Room } from "../models/room.ts"; -import { EncryptionConfig } from "./MatrixRTCSession.ts"; +import { type MatrixEvent } from "../models/event.ts"; +import { type Room } from "../models/room.ts"; +import { type EncryptionConfig } from "./MatrixRTCSession.ts"; import { secureRandomBase64Url } from "../randomstring.ts"; -import { EncryptionKeysEventContent } from "./types.ts"; +import { type EncryptionKeysEventContent } from "./types.ts"; import { decodeBase64, encodeUnpaddedBase64 } from "../base64.ts"; -import { MatrixError, safeGetRetryAfterMs } from "../http-api/errors.ts"; -import { CallMembership } from "./CallMembership.ts"; +import { type MatrixError, safeGetRetryAfterMs } from "../http-api/errors.ts"; +import { type CallMembership } from "./CallMembership.ts"; import { EventType } from "../@types/event.ts"; const logger = rootLogger.getChild("MatrixRTCSession"); diff --git a/src/matrixrtc/LivekitFocus.ts b/src/matrixrtc/LivekitFocus.ts index 254c71541..66d8a0a50 100644 --- a/src/matrixrtc/LivekitFocus.ts +++ b/src/matrixrtc/LivekitFocus.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Focus } from "./focus.ts"; +import { type Focus } from "./focus.ts"; export interface LivekitFocusConfig extends Focus { type: "livekit"; diff --git a/src/matrixrtc/MatrixRTCSession.ts b/src/matrixrtc/MatrixRTCSession.ts index 0540c6207..64672500a 100644 --- a/src/matrixrtc/MatrixRTCSession.ts +++ b/src/matrixrtc/MatrixRTCSession.ts @@ -17,16 +17,16 @@ limitations under the License. import { logger as rootLogger } from "../logger.ts"; import { TypedEventEmitter } from "../models/typed-event-emitter.ts"; import { EventTimeline } from "../models/event-timeline.ts"; -import { Room } from "../models/room.ts"; -import { MatrixClient } from "../client.ts"; +import { type Room } from "../models/room.ts"; +import { type MatrixClient } from "../client.ts"; import { EventType } from "../@types/event.ts"; import { CallMembership } from "./CallMembership.ts"; import { RoomStateEvent } from "../models/room-state.ts"; -import { Focus } from "./focus.ts"; +import { type Focus } from "./focus.ts"; import { KnownMembership } from "../@types/membership.ts"; -import { MatrixEvent } from "../models/event.ts"; -import { LegacyMembershipManager, IMembershipManager } from "./MembershipManager.ts"; -import { EncryptionManager, IEncryptionManager, Statistics } from "./EncryptionManager.ts"; +import { type MatrixEvent } from "../models/event.ts"; +import { LegacyMembershipManager, type IMembershipManager } from "./MembershipManager.ts"; +import { EncryptionManager, type IEncryptionManager, type Statistics } from "./EncryptionManager.ts"; const logger = rootLogger.getChild("MatrixRTCSession"); diff --git a/src/matrixrtc/MatrixRTCSessionManager.ts b/src/matrixrtc/MatrixRTCSessionManager.ts index aeacad2c4..4c9dd8633 100644 --- a/src/matrixrtc/MatrixRTCSessionManager.ts +++ b/src/matrixrtc/MatrixRTCSessionManager.ts @@ -15,11 +15,11 @@ limitations under the License. */ import { logger as rootLogger } from "../logger.ts"; -import { MatrixClient, ClientEvent } from "../client.ts"; +import { type MatrixClient, ClientEvent } from "../client.ts"; import { TypedEventEmitter } from "../models/typed-event-emitter.ts"; -import { Room, RoomEvent } from "../models/room.ts"; -import { RoomState, RoomStateEvent } from "../models/room-state.ts"; -import { MatrixEvent } from "../models/event.ts"; +import { type Room, RoomEvent } from "../models/room.ts"; +import { type RoomState, RoomStateEvent } from "../models/room-state.ts"; +import { type MatrixEvent } from "../models/event.ts"; import { MatrixRTCSession } from "./MatrixRTCSession.ts"; import { EventType } from "../@types/event.ts"; diff --git a/src/matrixrtc/MembershipManager.ts b/src/matrixrtc/MembershipManager.ts index ed4288a6c..f398afb70 100644 --- a/src/matrixrtc/MembershipManager.ts +++ b/src/matrixrtc/MembershipManager.ts @@ -4,13 +4,13 @@ import type { MatrixClient } from "../client.ts"; import { HTTPError, MatrixError } from "../http-api/errors.ts"; import { logger } from "../logger.ts"; import { EventTimeline } from "../models/event-timeline.ts"; -import { Room } from "../models/room.ts"; +import { type Room } from "../models/room.ts"; import { sleep } from "../utils.ts"; -import { CallMembership, DEFAULT_EXPIRE_DURATION, SessionMembershipData } from "./CallMembership.ts"; -import { Focus } from "./focus.ts"; +import { type CallMembership, DEFAULT_EXPIRE_DURATION, type SessionMembershipData } from "./CallMembership.ts"; +import { type Focus } from "./focus.ts"; import { isLivekitFocusActive } from "./LivekitFocus.ts"; -import { MembershipConfig } from "./MatrixRTCSession.ts"; -import { EmptyObject } from "../@types/common.ts"; +import { type MembershipConfig } from "./MatrixRTCSession.ts"; +import { type EmptyObject } from "../@types/common.ts"; /** * This interface defines what a MembershipManager uses and exposes. * This interface is what we use to write tests and allows to change the actual implementation diff --git a/src/matrixrtc/types.ts b/src/matrixrtc/types.ts index 966300b02..998a44445 100644 --- a/src/matrixrtc/types.ts +++ b/src/matrixrtc/types.ts @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -import { IMentions } from "../matrix.ts"; +import { type IMentions } from "../matrix.ts"; export interface EncryptionKeyEntry { index: number; key: string; diff --git a/src/models/MSC3089Branch.ts b/src/models/MSC3089Branch.ts index 503a6e4af..393a37ce0 100644 --- a/src/models/MSC3089Branch.ts +++ b/src/models/MSC3089Branch.ts @@ -14,14 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixClient } from "../client.ts"; +import { type MatrixClient } from "../client.ts"; import { RelationType, UNSTABLE_MSC3089_BRANCH } from "../@types/event.ts"; -import { IContent, MatrixEvent } from "./event.ts"; -import { MSC3089TreeSpace } from "./MSC3089TreeSpace.ts"; +import { type IContent, type MatrixEvent } from "./event.ts"; +import { type MSC3089TreeSpace } from "./MSC3089TreeSpace.ts"; import { EventTimeline } from "./event-timeline.ts"; -import { FileType } from "../http-api/index.ts"; +import { type FileType } from "../http-api/index.ts"; import type { ISendEventResponse } from "../@types/requests.ts"; -import { EncryptedFile } from "../@types/media.ts"; +import { type EncryptedFile } from "../@types/media.ts"; export interface MSC3089EventContent { active?: boolean; diff --git a/src/models/MSC3089TreeSpace.ts b/src/models/MSC3089TreeSpace.ts index 9968c8833..b912ef006 100644 --- a/src/models/MSC3089TreeSpace.ts +++ b/src/models/MSC3089TreeSpace.ts @@ -16,11 +16,11 @@ limitations under the License. import promiseRetry from "p-retry"; -import { MatrixClient } from "../client.ts"; +import { type MatrixClient } from "../client.ts"; import { EventType, MsgType, UNSTABLE_MSC3089_BRANCH, UNSTABLE_MSC3089_LEAF } from "../@types/event.ts"; -import { Room } from "./room.ts"; +import { type Room } from "./room.ts"; import { logger } from "../logger.ts"; -import { IContent, MatrixEvent } from "./event.ts"; +import { type IContent, type MatrixEvent } from "./event.ts"; import { averageBetweenStrings, DEFAULT_ALPHABET, @@ -30,12 +30,12 @@ import { simpleRetryOperation, } from "../utils.ts"; import { MSC3089Branch } from "./MSC3089Branch.ts"; -import { ISendEventResponse } from "../@types/requests.ts"; -import { FileType } from "../http-api/index.ts"; +import { type ISendEventResponse } from "../@types/requests.ts"; +import { type FileType } from "../http-api/index.ts"; import { KnownMembership } from "../@types/membership.ts"; -import { RoomPowerLevelsEventContent, SpaceChildEventContent } from "../@types/state_events.ts"; +import { type RoomPowerLevelsEventContent, type SpaceChildEventContent } from "../@types/state_events.ts"; import type { EncryptedFile, FileContent } from "../@types/media.ts"; -import { EmptyObject } from "../@types/common.ts"; +import { type EmptyObject } from "../@types/common.ts"; /** * The recommended defaults for a tree space's power levels. Note that this diff --git a/src/models/beacon.ts b/src/models/beacon.ts index 95115780e..cfd9453f6 100644 --- a/src/models/beacon.ts +++ b/src/models/beacon.ts @@ -14,14 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MBeaconEventContent } from "../@types/beacon.ts"; +import { type MBeaconEventContent } from "../@types/beacon.ts"; import { - BeaconInfoState, - BeaconLocationState, + type BeaconInfoState, + type BeaconLocationState, parseBeaconContent, parseBeaconInfoContent, } from "../content-helpers.ts"; -import { MatrixEvent } from "./event.ts"; +import { type MatrixEvent } from "./event.ts"; import { sortEventsByLatestContentTimestamp } from "../utils.ts"; import { TypedEventEmitter } from "./typed-event-emitter.ts"; diff --git a/src/models/compare-event-ordering.ts b/src/models/compare-event-ordering.ts index 31d508128..ada9c5c19 100644 --- a/src/models/compare-event-ordering.ts +++ b/src/models/compare-event-ordering.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixEvent } from "./event.ts"; -import { Room } from "./room.ts"; +import { type MatrixEvent } from "./event.ts"; +import { type Room } from "./room.ts"; import { inMainTimelineForReceipt, threadIdForReceipt } from "../client.ts"; /** diff --git a/src/models/event-context.ts b/src/models/event-context.ts index c99b2db37..43446697f 100644 --- a/src/models/event-context.ts +++ b/src/models/event-context.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixEvent } from "./event.ts"; +import { type MatrixEvent } from "./event.ts"; import { Direction } from "./event-timeline.ts"; export class EventContext { diff --git a/src/models/event-timeline-set.ts b/src/models/event-timeline-set.ts index 9f02a71a6..14cf94b99 100644 --- a/src/models/event-timeline-set.ts +++ b/src/models/event-timeline-set.ts @@ -14,16 +14,16 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { EventTimeline, IAddEventOptions } from "./event-timeline.ts"; -import { MatrixEvent } from "./event.ts"; +import { EventTimeline, type IAddEventOptions } from "./event-timeline.ts"; +import { type MatrixEvent } from "./event.ts"; import { logger } from "../logger.ts"; -import { Room, RoomEvent } from "./room.ts"; -import { Filter } from "../filter.ts"; -import { RoomState } from "./room-state.ts"; +import { type Room, RoomEvent } from "./room.ts"; +import { type Filter } from "../filter.ts"; +import { type RoomState } from "./room-state.ts"; import { TypedEventEmitter } from "./typed-event-emitter.ts"; import { RelationsContainer } from "./relations-container.ts"; -import { MatrixClient } from "../client.ts"; -import { Thread, ThreadFilterType } from "./thread.ts"; +import { type MatrixClient } from "../client.ts"; +import { type Thread, type ThreadFilterType } from "./thread.ts"; const DEBUG = true; diff --git a/src/models/event-timeline.ts b/src/models/event-timeline.ts index 0cc7ceac2..20b7016cc 100644 --- a/src/models/event-timeline.ts +++ b/src/models/event-timeline.ts @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IMarkerFoundOptions, RoomState } from "./room-state.ts"; -import { EventTimelineSet } from "./event-timeline-set.ts"; -import { MatrixEvent } from "./event.ts"; -import { Filter } from "../filter.ts"; +import { type IMarkerFoundOptions, RoomState } from "./room-state.ts"; +import { type EventTimelineSet } from "./event-timeline-set.ts"; +import { type MatrixEvent } from "./event.ts"; +import { type Filter } from "../filter.ts"; import { EventType } from "../@types/event.ts"; export interface IInitialiseStateOptions extends Pick { diff --git a/src/models/event.ts b/src/models/event.ts index 5a5d2af14..72fa03f88 100644 --- a/src/models/event.ts +++ b/src/models/event.ts @@ -19,37 +19,37 @@ limitations under the License. * the public classes. */ -import { ExtensibleEvent, ExtensibleEvents, Optional } from "matrix-events-sdk"; +import { type ExtensibleEvent, ExtensibleEvents, type Optional } from "matrix-events-sdk"; import type { IEventDecryptionResult } from "../@types/crypto.ts"; import { logger } from "../logger.ts"; -import { VerificationRequest } from "../crypto/verification/request/VerificationRequest.ts"; +import { type VerificationRequest } from "../crypto/verification/request/VerificationRequest.ts"; import { EVENT_VISIBILITY_CHANGE_TYPE, EventType, - MsgType, + type MsgType, RelationType, ToDeviceMessageId, UNSIGNED_THREAD_ID_FIELD, UNSIGNED_MEMBERSHIP_FIELD, } from "../@types/event.ts"; -import { Crypto } from "../crypto/index.ts"; +import { type Crypto } from "../crypto/index.ts"; import { deepSortedObjectEntries, internaliseString } from "../utils.ts"; -import { RoomMember } from "./room-member.ts"; -import { Thread, THREAD_RELATION_TYPE, ThreadEvent, ThreadEventHandlerMap } from "./thread.ts"; -import { IActionsObject } from "../pushprocessor.ts"; +import { type RoomMember } from "./room-member.ts"; +import { type Thread, THREAD_RELATION_TYPE, ThreadEvent, type ThreadEventHandlerMap } from "./thread.ts"; +import { type IActionsObject } from "../pushprocessor.ts"; import { TypedReEmitter } from "../ReEmitter.ts"; -import { MatrixError } from "../http-api/index.ts"; +import { type MatrixError } from "../http-api/index.ts"; import { TypedEventEmitter } from "./typed-event-emitter.ts"; -import { EventStatus } from "./event-status.ts"; -import { CryptoBackend, DecryptionError } from "../common-crypto/CryptoBackend.ts"; -import { IAnnotatedPushRule } from "../@types/PushRules.ts"; -import { Room } from "./room.ts"; +import { type EventStatus } from "./event-status.ts"; +import { type CryptoBackend, DecryptionError } from "../common-crypto/CryptoBackend.ts"; +import { type IAnnotatedPushRule } from "../@types/PushRules.ts"; +import { type Room } from "./room.ts"; import { EventTimeline } from "./event-timeline.ts"; -import { Membership } from "../@types/membership.ts"; +import { type Membership } from "../@types/membership.ts"; import { DecryptionFailureCode } from "../crypto-api/index.ts"; -import { RoomState } from "./room-state.ts"; -import { EmptyObject } from "../@types/common.ts"; +import { type RoomState } from "./room-state.ts"; +import { type EmptyObject } from "../@types/common.ts"; export { EventStatus } from "./event-status.ts"; diff --git a/src/models/invites-ignorer.ts b/src/models/invites-ignorer.ts index 2702fd02c..ab2cfab30 100644 --- a/src/models/invites-ignorer.ts +++ b/src/models/invites-ignorer.ts @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixClient } from "../client.ts"; -import { IContent, MatrixEvent } from "./event.ts"; +import { type MatrixClient } from "../client.ts"; +import { type IContent, type MatrixEvent } from "./event.ts"; import { EventTimeline } from "./event-timeline.ts"; import { Preset } from "../@types/partials.ts"; import { globToRegexp } from "../utils.ts"; -import { Room } from "./room.ts"; -import { EventType, StateEvents } from "../@types/event.ts"; +import { type Room } from "./room.ts"; +import { EventType, type StateEvents } from "../@types/event.ts"; import { IGNORE_INVITES_ACCOUNT_EVENT_KEY, POLICIES_ACCOUNT_EVENT_TYPE, diff --git a/src/models/poll.ts b/src/models/poll.ts index ae38810f8..965870ecf 100644 --- a/src/models/poll.ts +++ b/src/models/poll.ts @@ -17,11 +17,11 @@ limitations under the License. import { M_POLL_START } from "matrix-events-sdk"; import { M_POLL_END, M_POLL_RESPONSE } from "../@types/polls.ts"; -import { MatrixClient } from "../client.ts"; -import { PollStartEvent } from "../extensible_events_v1/PollStartEvent.ts"; -import { MatrixEvent } from "./event.ts"; +import { type MatrixClient } from "../client.ts"; +import { type PollStartEvent } from "../extensible_events_v1/PollStartEvent.ts"; +import { type MatrixEvent } from "./event.ts"; import { Relations } from "./relations.ts"; -import { Room } from "./room.ts"; +import { type Room } from "./room.ts"; import { TypedEventEmitter } from "./typed-event-emitter.ts"; export enum PollEvent { diff --git a/src/models/read-receipt.ts b/src/models/read-receipt.ts index 5711e3314..3ef452fc4 100644 --- a/src/models/read-receipt.ts +++ b/src/models/read-receipt.ts @@ -12,18 +12,18 @@ limitations under the License. */ import { - CachedReceipt, + type CachedReceipt, MAIN_ROOM_TIMELINE, - Receipt, - ReceiptCache, + type Receipt, + type ReceiptCache, ReceiptType, - WrappedReceipt, + type WrappedReceipt, } from "../@types/read_receipts.ts"; -import { ListenerMap, TypedEventEmitter } from "./typed-event-emitter.ts"; +import { type ListenerMap, TypedEventEmitter } from "./typed-event-emitter.ts"; import { isSupportedReceiptType } from "../utils.ts"; import { MatrixEvent } from "./event.ts"; import { EventType } from "../@types/event.ts"; -import { EventTimelineSet } from "./event-timeline-set.ts"; +import { type EventTimelineSet } from "./event-timeline-set.ts"; import { MapWithDefault } from "../utils.ts"; import { NotificationCountType } from "./room.ts"; import { logger } from "../logger.ts"; diff --git a/src/models/related-relations.ts b/src/models/related-relations.ts index 0dda060ae..a15c0a9f8 100644 --- a/src/models/related-relations.ts +++ b/src/models/related-relations.ts @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Relations, RelationsEvent, EventHandlerMap } from "./relations.ts"; -import { MatrixEvent } from "./event.ts"; -import { Listener } from "./typed-event-emitter.ts"; +import { type Relations, type RelationsEvent, type EventHandlerMap } from "./relations.ts"; +import { type MatrixEvent } from "./event.ts"; +import { type Listener } from "./typed-event-emitter.ts"; export class RelatedRelations { private relations: Relations[]; diff --git a/src/models/relations-container.ts b/src/models/relations-container.ts index 3889be719..8394bc692 100644 --- a/src/models/relations-container.ts +++ b/src/models/relations-container.ts @@ -15,11 +15,11 @@ limitations under the License. */ import { Relations } from "./relations.ts"; -import { EventType, RelationType } from "../@types/event.ts"; -import { EventStatus, MatrixEvent, MatrixEventEvent } from "./event.ts"; -import { EventTimelineSet } from "./event-timeline-set.ts"; -import { MatrixClient } from "../client.ts"; -import { Room } from "./room.ts"; +import { type EventType, type RelationType } from "../@types/event.ts"; +import { EventStatus, type MatrixEvent, MatrixEventEvent } from "./event.ts"; +import { type EventTimelineSet } from "./event-timeline-set.ts"; +import { type MatrixClient } from "../client.ts"; +import { type Room } from "./room.ts"; export class RelationsContainer { // A tree of objects to access a set of related children for an event, as in: diff --git a/src/models/relations.ts b/src/models/relations.ts index bb7f05648..7563693c2 100644 --- a/src/models/relations.ts +++ b/src/models/relations.ts @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { EventStatus, IAggregatedRelation, MatrixEvent, MatrixEventEvent } from "./event.ts"; +import { EventStatus, type IAggregatedRelation, type MatrixEvent, MatrixEventEvent } from "./event.ts"; import { logger } from "../logger.ts"; import { RelationType } from "../@types/event.ts"; import { TypedEventEmitter } from "./typed-event-emitter.ts"; -import { MatrixClient } from "../client.ts"; +import { type MatrixClient } from "../client.ts"; import { Room } from "./room.ts"; -import { CryptoBackend } from "../common-crypto/CryptoBackend.ts"; +import { type CryptoBackend } from "../common-crypto/CryptoBackend.ts"; export enum RelationsEvent { Add = "Relations.add", diff --git a/src/models/room-member.ts b/src/models/room-member.ts index 8f1aea853..49ac4abce 100644 --- a/src/models/room-member.ts +++ b/src/models/room-member.ts @@ -16,13 +16,13 @@ limitations under the License. import { getHttpUriForMxc } from "../content-repo.ts"; import { removeDirectionOverrideChars, removeHiddenChars } from "../utils.ts"; -import { User } from "./user.ts"; -import { MatrixEvent } from "./event.ts"; -import { RoomState } from "./room-state.ts"; +import { type User } from "./user.ts"; +import { type MatrixEvent } from "./event.ts"; +import { type RoomState } from "./room-state.ts"; import { logger } from "../logger.ts"; import { TypedEventEmitter } from "./typed-event-emitter.ts"; import { EventType } from "../@types/event.ts"; -import { KnownMembership, Membership } from "../@types/membership.ts"; +import { KnownMembership, type Membership } from "../@types/membership.ts"; export enum RoomMemberEvent { Membership = "RoomMember.membership", diff --git a/src/models/room-receipts.ts b/src/models/room-receipts.ts index eb73f1748..1e962c313 100644 --- a/src/models/room-receipts.ts +++ b/src/models/room-receipts.ts @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MAIN_ROOM_TIMELINE, Receipt, ReceiptContent } from "../@types/read_receipts.ts"; +import { MAIN_ROOM_TIMELINE, type Receipt, type ReceiptContent } from "../@types/read_receipts.ts"; import { threadIdForReceipt } from "../client.ts"; -import { Room, RoomEvent } from "./room.ts"; -import { MatrixEvent } from "./event.ts"; +import { type Room, RoomEvent } from "./room.ts"; +import { type MatrixEvent } from "./event.ts"; import { logger } from "../logger.ts"; /** diff --git a/src/models/room-state.ts b/src/models/room-state.ts index 7640e0400..a2f97bf97 100644 --- a/src/models/room-state.ts +++ b/src/models/room-state.ts @@ -18,15 +18,21 @@ import { RoomMember } from "./room-member.ts"; import { logger } from "../logger.ts"; import { isNumber, removeHiddenChars } from "../utils.ts"; import { EventType, UNSTABLE_MSC2716_MARKER } from "../@types/event.ts"; -import { IEvent, MatrixEvent, MatrixEventEvent } from "./event.ts"; -import { MatrixClient } from "../client.ts"; +import { type IEvent, type MatrixEvent, MatrixEventEvent } from "./event.ts"; +import { type MatrixClient } from "../client.ts"; import { GuestAccess, HistoryVisibility, JoinRule } from "../@types/partials.ts"; import { TypedEventEmitter } from "./typed-event-emitter.ts"; -import { Beacon, BeaconEvent, BeaconEventHandlerMap, getBeaconInfoIdentifier, BeaconIdentifier } from "./beacon.ts"; +import { + Beacon, + BeaconEvent, + type BeaconEventHandlerMap, + getBeaconInfoIdentifier, + type BeaconIdentifier, +} from "./beacon.ts"; import { TypedReEmitter } from "../ReEmitter.ts"; import { M_BEACON, M_BEACON_INFO } from "../@types/beacon.ts"; import { KnownMembership } from "../@types/membership.ts"; -import { RoomJoinRulesEventContent } from "../@types/state_events.ts"; +import { type RoomJoinRulesEventContent } from "../@types/state_events.ts"; export interface IMarkerFoundOptions { /** Whether the timeline was empty before the marker event arrived in the diff --git a/src/models/room.ts b/src/models/room.ts index 86ba45b9d..629efc263 100644 --- a/src/models/room.ts +++ b/src/models/room.ts @@ -14,22 +14,28 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { M_POLL_START, Optional } from "matrix-events-sdk"; +import { M_POLL_START, type Optional } from "matrix-events-sdk"; import { EventTimelineSet, DuplicateStrategy, - IAddLiveEventOptions, - EventTimelineSetHandlerMap, + type IAddLiveEventOptions, + type EventTimelineSetHandlerMap, } from "./event-timeline-set.ts"; import { Direction, EventTimeline } from "./event-timeline.ts"; import { getHttpUriForMxc } from "../content-repo.ts"; import { removeElement } from "../utils.ts"; import { normalize, noUnsafeEventProps } from "../utils.ts"; -import { IEvent, IThreadBundledRelationship, MatrixEvent, MatrixEventEvent, MatrixEventHandlerMap } from "./event.ts"; +import { + type IEvent, + type IThreadBundledRelationship, + MatrixEvent, + MatrixEventEvent, + type MatrixEventHandlerMap, +} from "./event.ts"; import { EventStatus } from "./event-status.ts"; import { RoomMember } from "./room-member.ts"; -import { IRoomSummary, RoomSummary } from "./room-summary.ts"; +import { type IRoomSummary, RoomSummary } from "./room-summary.ts"; import { logger } from "../logger.ts"; import { TypedReEmitter } from "../ReEmitter.ts"; import { @@ -41,36 +47,36 @@ import { RelationType, UNSIGNED_THREAD_ID_FIELD, } from "../@types/event.ts"; -import { MatrixClient, PendingEventOrdering } from "../client.ts"; -import { GuestAccess, HistoryVisibility, JoinRule, ResizeMethod } from "../@types/partials.ts"; -import { Filter, IFilterDefinition } from "../filter.ts"; -import { RoomState, RoomStateEvent, RoomStateEventHandlerMap } from "./room-state.ts"; -import { BeaconEvent, BeaconEventHandlerMap } from "./beacon.ts"; +import { type MatrixClient, PendingEventOrdering } from "../client.ts"; +import { type GuestAccess, type HistoryVisibility, type JoinRule, type ResizeMethod } from "../@types/partials.ts"; +import { Filter, type IFilterDefinition } from "../filter.ts"; +import { type RoomState, RoomStateEvent, type RoomStateEventHandlerMap } from "./room-state.ts"; +import { BeaconEvent, type BeaconEventHandlerMap } from "./beacon.ts"; import { Thread, ThreadEvent, - ThreadEventHandlerMap as ThreadHandlerMap, + type ThreadEventHandlerMap as ThreadHandlerMap, FILTER_RELATED_BY_REL_TYPES, THREAD_RELATION_TYPE, FILTER_RELATED_BY_SENDERS, ThreadFilterType, } from "./thread.ts"; import { - CachedReceiptStructure, + type CachedReceiptStructure, MAIN_ROOM_TIMELINE, - Receipt, - ReceiptContent, + type Receipt, + type ReceiptContent, ReceiptType, } from "../@types/read_receipts.ts"; -import { IStateEventWithRoomId } from "../@types/search.ts"; +import { type IStateEventWithRoomId } from "../@types/search.ts"; import { RelationsContainer } from "./relations-container.ts"; import { ReadReceipt, synthesizeReceipt } from "./read-receipt.ts"; import { isPollEvent, Poll, PollEvent } from "./poll.ts"; import { RoomReceipts } from "./room-receipts.ts"; import { compareEventOrdering } from "./compare-event-ordering.ts"; import * as utils from "../utils.ts"; -import { KnownMembership, Membership } from "../@types/membership.ts"; -import { Capabilities, IRoomVersionsCapability, RoomVersionStability } from "../serverCapabilities.ts"; +import { KnownMembership, type Membership } from "../@types/membership.ts"; +import { type Capabilities, type IRoomVersionsCapability, RoomVersionStability } from "../serverCapabilities.ts"; // These constants are used as sane defaults when the homeserver doesn't support // the m.room_versions capability. In practice, KNOWN_SAFE_ROOM_VERSION should be diff --git a/src/models/search-result.ts b/src/models/search-result.ts index 4677371a5..085a778a7 100644 --- a/src/models/search-result.ts +++ b/src/models/search-result.ts @@ -15,8 +15,8 @@ limitations under the License. */ import { EventContext } from "./event-context.ts"; -import { EventMapper } from "../event-mapper.ts"; -import { IResultContext, ISearchResult } from "../@types/search.ts"; +import { type EventMapper } from "../event-mapper.ts"; +import { type IResultContext, type ISearchResult } from "../@types/search.ts"; export class SearchResult { /** diff --git a/src/models/thread.ts b/src/models/thread.ts index 79ef5af22..c98facf32 100644 --- a/src/models/thread.ts +++ b/src/models/thread.ts @@ -14,20 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Optional } from "matrix-events-sdk"; +import { type Optional } from "matrix-events-sdk"; -import { MatrixClient, PendingEventOrdering } from "../client.ts"; +import { type MatrixClient, PendingEventOrdering } from "../client.ts"; import { TypedReEmitter } from "../ReEmitter.ts"; import { RelationType } from "../@types/event.ts"; -import { IThreadBundledRelationship, MatrixEvent, MatrixEventEvent } from "./event.ts"; +import { type IThreadBundledRelationship, MatrixEvent, MatrixEventEvent } from "./event.ts"; import { Direction, EventTimeline } from "./event-timeline.ts"; -import { EventTimelineSet, EventTimelineSetHandlerMap } from "./event-timeline-set.ts"; -import { NotificationCountType, Room, RoomEvent } from "./room.ts"; -import { RoomState } from "./room-state.ts"; +import { EventTimelineSet, type EventTimelineSetHandlerMap } from "./event-timeline-set.ts"; +import { type NotificationCountType, type Room, RoomEvent } from "./room.ts"; +import { type RoomState } from "./room-state.ts"; import { ServerControlledNamespacedValue } from "../NamespacedValue.ts"; import { logger } from "../logger.ts"; import { ReadReceipt } from "./read-receipt.ts"; -import { CachedReceiptStructure, Receipt, ReceiptType } from "../@types/read_receipts.ts"; +import { type CachedReceiptStructure, type Receipt, ReceiptType } from "../@types/read_receipts.ts"; import { Feature, ServerSupport } from "../feature.ts"; export enum ThreadEvent { diff --git a/src/models/user.ts b/src/models/user.ts index 90005c2cf..2bca5b3e2 100644 --- a/src/models/user.ts +++ b/src/models/user.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixClient } from "../matrix.ts"; -import { MatrixEvent } from "./event.ts"; +import { type MatrixClient } from "../matrix.ts"; +import { type MatrixEvent } from "./event.ts"; import { TypedEventEmitter } from "./typed-event-emitter.ts"; export enum UserEvent { diff --git a/src/oidc/authorize.ts b/src/oidc/authorize.ts index 95d97c150..f76809263 100644 --- a/src/oidc/authorize.ts +++ b/src/oidc/authorize.ts @@ -14,16 +14,16 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IdTokenClaims, Log, OidcClient, SigninResponse, SigninState, WebStorageStateStore } from "oidc-client-ts"; +import { type IdTokenClaims, Log, OidcClient, SigninResponse, SigninState, WebStorageStateStore } from "oidc-client-ts"; import { logger } from "../logger.ts"; import { secureRandomString } from "../randomstring.ts"; import { OidcError } from "./error.ts"; import { - BearerTokenResponse, - UserState, + type BearerTokenResponse, + type UserState, validateBearerTokenResponse, - ValidatedAuthMetadata, + type ValidatedAuthMetadata, validateIdToken, validateStoredUserState, } from "./validate.ts"; diff --git a/src/oidc/discovery.ts b/src/oidc/discovery.ts index 842990dba..53c349ee4 100644 --- a/src/oidc/discovery.ts +++ b/src/oidc/discovery.ts @@ -18,7 +18,7 @@ import { MetadataService, OidcClientSettingsStore } from "oidc-client-ts"; import { validateAuthMetadata } from "./validate.ts"; import { Method, timeoutSignal } from "../http-api/index.ts"; -import { OidcClientConfig } from "./index.ts"; +import { type OidcClientConfig } from "./index.ts"; /** * @experimental diff --git a/src/oidc/index.ts b/src/oidc/index.ts index bc4f37118..5f6a3ec36 100644 --- a/src/oidc/index.ts +++ b/src/oidc/index.ts @@ -15,7 +15,7 @@ limitations under the License. */ import type { SigningKey } from "oidc-client-ts"; -import { ValidatedAuthMetadata } from "./validate.ts"; +import { type ValidatedAuthMetadata } from "./validate.ts"; export * from "./authorize.ts"; export * from "./discovery.ts"; diff --git a/src/oidc/register.ts b/src/oidc/register.ts index 036cbb714..eeed5ef07 100644 --- a/src/oidc/register.ts +++ b/src/oidc/register.ts @@ -14,11 +14,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { OidcClientConfig } from "./index.ts"; +import { type OidcClientConfig } from "./index.ts"; import { OidcError } from "./error.ts"; import { Method } from "../http-api/index.ts"; import { logger } from "../logger.ts"; -import { NonEmptyArray } from "../@types/common.ts"; +import { type NonEmptyArray } from "../@types/common.ts"; /** * Client metadata passed to registration endpoint diff --git a/src/oidc/tokenRefresher.ts b/src/oidc/tokenRefresher.ts index d7e863c2a..c4e1522a0 100644 --- a/src/oidc/tokenRefresher.ts +++ b/src/oidc/tokenRefresher.ts @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IdTokenClaims, OidcClient, WebStorageStateStore } from "oidc-client-ts"; +import { type IdTokenClaims, OidcClient, WebStorageStateStore } from "oidc-client-ts"; -import { AccessTokens } from "../http-api/index.ts"; +import { type AccessTokens } from "../http-api/index.ts"; import { generateScope } from "./authorize.ts"; import { discoverAndValidateOIDCIssuerWellKnown } from "./discovery.ts"; import { logger } from "../logger.ts"; diff --git a/src/oidc/validate.ts b/src/oidc/validate.ts index a6f921314..e9e336746 100644 --- a/src/oidc/validate.ts +++ b/src/oidc/validate.ts @@ -15,7 +15,7 @@ limitations under the License. */ import { jwtDecode } from "jwt-decode"; -import { IdTokenClaims, OidcMetadata, SigninResponse } from "oidc-client-ts"; +import { type IdTokenClaims, type OidcMetadata, type SigninResponse } from "oidc-client-ts"; import { logger } from "../logger.ts"; import { OidcError } from "./error.ts"; diff --git a/src/pushprocessor.ts b/src/pushprocessor.ts index be40c2d1e..87e8b0ae7 100644 --- a/src/pushprocessor.ts +++ b/src/pushprocessor.ts @@ -16,26 +16,26 @@ limitations under the License. import { deepCompare, escapeRegExp, globToRegexp, isNullOrUndefined } from "./utils.ts"; import { logger } from "./logger.ts"; -import { MatrixClient } from "./client.ts"; -import { MatrixEvent } from "./models/event.ts"; +import { type MatrixClient } from "./client.ts"; +import { type MatrixEvent } from "./models/event.ts"; import { ConditionKind, - IAnnotatedPushRule, - ICallStartedCondition, - ICallStartedPrefixCondition, - IContainsDisplayNameCondition, - IEventMatchCondition, - IEventPropertyContainsCondition, - IEventPropertyIsCondition, - IPushRule, - IPushRules, - IRoomMemberCountCondition, - ISenderNotificationPermissionCondition, - PushRuleAction, + type IAnnotatedPushRule, + type ICallStartedCondition, + type ICallStartedPrefixCondition, + type IContainsDisplayNameCondition, + type IEventMatchCondition, + type IEventPropertyContainsCondition, + type IEventPropertyIsCondition, + type IPushRule, + type IPushRules, + type IRoomMemberCountCondition, + type ISenderNotificationPermissionCondition, + type PushRuleAction, PushRuleActionName, - PushRuleCondition, + type PushRuleCondition, PushRuleKind, - PushRuleSet, + type PushRuleSet, RuleId, TweakName, } from "./@types/PushRules.ts"; diff --git a/src/receipt-accumulator.ts b/src/receipt-accumulator.ts index 707b2ff27..88840230a 100644 --- a/src/receipt-accumulator.ts +++ b/src/receipt-accumulator.ts @@ -14,11 +14,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IMinimalEvent } from "./sync-accumulator.ts"; +import { type IMinimalEvent } from "./sync-accumulator.ts"; import { EventType } from "./@types/event.ts"; import { isSupportedReceiptType, MapWithDefault, recursiveMapToObject } from "./utils.ts"; -import { IContent } from "./models/event.ts"; -import { ReceiptContent, ReceiptType } from "./@types/read_receipts.ts"; +import { type IContent } from "./models/event.ts"; +import { type ReceiptContent, type ReceiptType } from "./@types/read_receipts.ts"; interface AccumulatedReceipt { data: IMinimalEvent; diff --git a/src/rendezvous/MSC4108SignInWithQR.ts b/src/rendezvous/MSC4108SignInWithQR.ts index 849b86235..d83c6a340 100644 --- a/src/rendezvous/MSC4108SignInWithQR.ts +++ b/src/rendezvous/MSC4108SignInWithQR.ts @@ -20,15 +20,15 @@ import { ClientRendezvousFailureReason, MSC4108FailureReason, RendezvousError, - RendezvousFailureListener, + type RendezvousFailureListener, } from "./index.ts"; -import { MatrixClient } from "../client.ts"; +import { type MatrixClient } from "../client.ts"; import { logger } from "../logger.ts"; -import { MSC4108SecureChannel } from "./channels/MSC4108SecureChannel.ts"; +import { type MSC4108SecureChannel } from "./channels/MSC4108SecureChannel.ts"; import { MatrixError } from "../http-api/index.ts"; import { sleep } from "../utils.ts"; -import { DEVICE_CODE_SCOPE, OidcClientConfig } from "../oidc/index.ts"; -import { CryptoApi } from "../crypto-api/index.ts"; +import { DEVICE_CODE_SCOPE, type OidcClientConfig } from "../oidc/index.ts"; +import { type CryptoApi } from "../crypto-api/index.ts"; /** * Enum representing the payload types transmissible over [MSC4108](https://github.com/matrix-org/matrix-spec-proposals/pull/4108) diff --git a/src/rendezvous/RendezvousChannel.ts b/src/rendezvous/RendezvousChannel.ts index ced8523bd..6e0620e55 100644 --- a/src/rendezvous/RendezvousChannel.ts +++ b/src/rendezvous/RendezvousChannel.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { RendezvousCode, RendezvousIntent, RendezvousFailureReason } from "./index.ts"; +import { type RendezvousCode, type RendezvousIntent, type RendezvousFailureReason } from "./index.ts"; export interface RendezvousChannel { /** diff --git a/src/rendezvous/RendezvousCode.ts b/src/rendezvous/RendezvousCode.ts index e5b89aae6..9eff59a7c 100644 --- a/src/rendezvous/RendezvousCode.ts +++ b/src/rendezvous/RendezvousCode.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { RendezvousTransportDetails, RendezvousIntent } from "./index.ts"; +import { type RendezvousTransportDetails, type RendezvousIntent } from "./index.ts"; export interface RendezvousCode { intent: RendezvousIntent; diff --git a/src/rendezvous/RendezvousError.ts b/src/rendezvous/RendezvousError.ts index 502538fff..69016dedc 100644 --- a/src/rendezvous/RendezvousError.ts +++ b/src/rendezvous/RendezvousError.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { RendezvousFailureReason } from "./index.ts"; +import { type RendezvousFailureReason } from "./index.ts"; export class RendezvousError extends Error { public constructor( diff --git a/src/rendezvous/RendezvousTransport.ts b/src/rendezvous/RendezvousTransport.ts index a86db5fc0..e72c4964a 100644 --- a/src/rendezvous/RendezvousTransport.ts +++ b/src/rendezvous/RendezvousTransport.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { RendezvousFailureListener, RendezvousFailureReason } from "./index.ts"; +import { type RendezvousFailureListener, type RendezvousFailureReason } from "./index.ts"; export interface RendezvousTransportDetails { type: string; diff --git a/src/rendezvous/channels/MSC4108SecureChannel.ts b/src/rendezvous/channels/MSC4108SecureChannel.ts index 8165000e7..d493b2c98 100644 --- a/src/rendezvous/channels/MSC4108SecureChannel.ts +++ b/src/rendezvous/channels/MSC4108SecureChannel.ts @@ -15,9 +15,9 @@ limitations under the License. */ import { - Curve25519PublicKey, + type Curve25519PublicKey, Ecies, - EstablishedEcies, + type EstablishedEcies, QrCodeData, QrCodeMode, } from "@matrix-org/matrix-sdk-crypto-wasm"; @@ -25,11 +25,11 @@ import { import { ClientRendezvousFailureReason, MSC4108FailureReason, - MSC4108Payload, + type MSC4108Payload, RendezvousError, - RendezvousFailureListener, + type RendezvousFailureListener, } from "../index.ts"; -import { MSC4108RendezvousSession } from "../transports/MSC4108RendezvousSession.ts"; +import { type MSC4108RendezvousSession } from "../transports/MSC4108RendezvousSession.ts"; import { logger } from "../../logger.ts"; /** diff --git a/src/rendezvous/transports/MSC4108RendezvousSession.ts b/src/rendezvous/transports/MSC4108RendezvousSession.ts index ae7719bc2..05430f83b 100644 --- a/src/rendezvous/transports/MSC4108RendezvousSession.ts +++ b/src/rendezvous/transports/MSC4108RendezvousSession.ts @@ -16,8 +16,8 @@ limitations under the License. import { logger } from "../../logger.ts"; import { sleep } from "../../utils.ts"; -import { ClientRendezvousFailureReason, MSC4108FailureReason, RendezvousFailureListener } from "../index.ts"; -import { MatrixClient, Method } from "../../matrix.ts"; +import { ClientRendezvousFailureReason, MSC4108FailureReason, type RendezvousFailureListener } from "../index.ts"; +import { type MatrixClient, Method } from "../../matrix.ts"; import { ClientPrefix } from "../../http-api/index.ts"; /** diff --git a/src/room-hierarchy.ts b/src/room-hierarchy.ts index 58e952545..2d80650af 100644 --- a/src/room-hierarchy.ts +++ b/src/room-hierarchy.ts @@ -14,11 +14,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Room } from "./models/room.ts"; -import { IHierarchyRoom, IHierarchyRelation } from "./@types/spaces.ts"; -import { MatrixClient } from "./client.ts"; +import { type Room } from "./models/room.ts"; +import { type IHierarchyRoom, type IHierarchyRelation } from "./@types/spaces.ts"; +import { type MatrixClient } from "./client.ts"; import { EventType } from "./@types/event.ts"; -import { MatrixError } from "./http-api/index.ts"; +import { type MatrixError } from "./http-api/index.ts"; export class RoomHierarchy { // Map from room id to list of servers which are listed as a via somewhere in the loaded hierarchy diff --git a/src/rust-crypto/CrossSigningIdentity.ts b/src/rust-crypto/CrossSigningIdentity.ts index 0dccbb17d..3f3564b3e 100644 --- a/src/rust-crypto/CrossSigningIdentity.ts +++ b/src/rust-crypto/CrossSigningIdentity.ts @@ -14,14 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { OlmMachine, CrossSigningStatus, CrossSigningBootstrapRequests } from "@matrix-org/matrix-sdk-crypto-wasm"; -import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; +import { + type OlmMachine, + type CrossSigningStatus, + type CrossSigningBootstrapRequests, +} from "@matrix-org/matrix-sdk-crypto-wasm"; -import { BootstrapCrossSigningOpts } from "../crypto-api/index.ts"; +import type * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; +import { type BootstrapCrossSigningOpts } from "../crypto-api/index.ts"; import { logger } from "../logger.ts"; -import { OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts"; -import { UIAuthCallback } from "../interactive-auth.ts"; -import { ServerSideSecretStorage } from "../secret-storage.ts"; +import { type OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts"; +import { type UIAuthCallback } from "../interactive-auth.ts"; +import { type ServerSideSecretStorage } from "../secret-storage.ts"; /** Manages the cross-signing keys for our own user. * diff --git a/src/rust-crypto/DehydratedDeviceManager.ts b/src/rust-crypto/DehydratedDeviceManager.ts index eb78588c9..da5edb489 100644 --- a/src/rust-crypto/DehydratedDeviceManager.ts +++ b/src/rust-crypto/DehydratedDeviceManager.ts @@ -16,14 +16,14 @@ limitations under the License. import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; -import { OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts"; +import { type OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts"; import { encodeUri } from "../utils.ts"; -import { IHttpOpts, MatrixError, MatrixHttpApi, Method } from "../http-api/index.ts"; -import { IToDeviceEvent } from "../sync-accumulator.ts"; -import { ServerSideSecretStorage } from "../secret-storage.ts"; +import { type IHttpOpts, type MatrixError, type MatrixHttpApi, Method } from "../http-api/index.ts"; +import { type IToDeviceEvent } from "../sync-accumulator.ts"; +import { type ServerSideSecretStorage } from "../secret-storage.ts"; import { decodeBase64 } from "../base64.ts"; -import { Logger } from "../logger.ts"; -import { CryptoEvent, CryptoEventHandlerMap, StartDehydrationOpts } from "../crypto-api/index.ts"; +import { type Logger } from "../logger.ts"; +import { CryptoEvent, type CryptoEventHandlerMap, type StartDehydrationOpts } from "../crypto-api/index.ts"; import { TypedEventEmitter } from "../models/typed-event-emitter.ts"; /** diff --git a/src/rust-crypto/KeyClaimManager.ts b/src/rust-crypto/KeyClaimManager.ts index 8cc1fd4e6..11de13a1e 100644 --- a/src/rust-crypto/KeyClaimManager.ts +++ b/src/rust-crypto/KeyClaimManager.ts @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { OlmMachine, UserId } from "@matrix-org/matrix-sdk-crypto-wasm"; +import { type OlmMachine, type UserId } from "@matrix-org/matrix-sdk-crypto-wasm"; -import { OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts"; -import { LogSpan } from "../logger.ts"; +import { type OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts"; +import { type LogSpan } from "../logger.ts"; /** * KeyClaimManager: linearises calls to OlmMachine.getMissingSessions to avoid races diff --git a/src/rust-crypto/OutgoingRequestProcessor.ts b/src/rust-crypto/OutgoingRequestProcessor.ts index ec8e38fcf..9f3813b87 100644 --- a/src/rust-crypto/OutgoingRequestProcessor.ts +++ b/src/rust-crypto/OutgoingRequestProcessor.ts @@ -19,7 +19,7 @@ import { KeysClaimRequest, KeysQueryRequest, KeysUploadRequest, - OlmMachine, + type OlmMachine, PutDehydratedDeviceRequest, RoomMessageRequest, SignatureUploadRequest, @@ -28,10 +28,10 @@ import { } from "@matrix-org/matrix-sdk-crypto-wasm"; import { logger } from "../logger.ts"; -import { calculateRetryBackoff, IHttpOpts, MatrixHttpApi, Method } from "../http-api/index.ts"; -import { logDuration, QueryDict, sleep } from "../utils.ts"; -import { AuthDict, UIAuthCallback } from "../interactive-auth.ts"; -import { UIAResponse } from "../@types/uia.ts"; +import { calculateRetryBackoff, type IHttpOpts, type MatrixHttpApi, Method } from "../http-api/index.ts"; +import { logDuration, type QueryDict, sleep } from "../utils.ts"; +import { type AuthDict, type UIAuthCallback } from "../interactive-auth.ts"; +import { type UIAResponse } from "../@types/uia.ts"; import { ToDeviceMessageId } from "../@types/event.ts"; import { UnstablePrefix as DehydrationUnstablePrefix } from "./DehydratedDeviceManager.ts"; diff --git a/src/rust-crypto/OutgoingRequestsManager.ts b/src/rust-crypto/OutgoingRequestsManager.ts index 72823d88b..37c213126 100644 --- a/src/rust-crypto/OutgoingRequestsManager.ts +++ b/src/rust-crypto/OutgoingRequestsManager.ts @@ -14,11 +14,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { OlmMachine } from "@matrix-org/matrix-sdk-crypto-wasm"; +import { type OlmMachine } from "@matrix-org/matrix-sdk-crypto-wasm"; -import { OutgoingRequest, OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts"; -import { Logger } from "../logger.ts"; -import { defer, IDeferred, logDuration } from "../utils.ts"; +import { type OutgoingRequest, type OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts"; +import { type Logger } from "../logger.ts"; +import { defer, type IDeferred, logDuration } from "../utils.ts"; /** * OutgoingRequestsManager: responsible for processing outgoing requests from the OlmMachine. diff --git a/src/rust-crypto/PerSessionKeyBackupDownloader.ts b/src/rust-crypto/PerSessionKeyBackupDownloader.ts index 98ccc8a07..a434f69c9 100644 --- a/src/rust-crypto/PerSessionKeyBackupDownloader.ts +++ b/src/rust-crypto/PerSessionKeyBackupDownloader.ts @@ -14,16 +14,16 @@ See the License for the specific language governing permissions and limitations under the License. */ -import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; -import { OlmMachine } from "@matrix-org/matrix-sdk-crypto-wasm"; +import { type OlmMachine } from "@matrix-org/matrix-sdk-crypto-wasm"; -import { Curve25519AuthData, KeyBackupInfo, KeyBackupSession } from "../crypto-api/keybackup.ts"; +import type * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; +import { type Curve25519AuthData, type KeyBackupInfo, type KeyBackupSession } from "../crypto-api/keybackup.ts"; import { CryptoEvent } from "../crypto-api/index.ts"; -import { Logger } from "../logger.ts"; -import { ClientPrefix, IHttpOpts, MatrixError, MatrixHttpApi, Method } from "../http-api/index.ts"; -import { RustBackupManager } from "./backup.ts"; +import { type Logger } from "../logger.ts"; +import { ClientPrefix, type IHttpOpts, MatrixError, type MatrixHttpApi, Method } from "../http-api/index.ts"; +import { type RustBackupManager } from "./backup.ts"; import { encodeUri, sleep } from "../utils.ts"; -import { BackupDecryptor } from "../common-crypto/CryptoBackend.ts"; +import { type BackupDecryptor } from "../common-crypto/CryptoBackend.ts"; // The minimum time to wait between two retries in case of errors. To avoid hammering the server. const KEY_BACKUP_BACKOFF = 5000; // ms diff --git a/src/rust-crypto/RoomEncryptor.ts b/src/rust-crypto/RoomEncryptor.ts index e87b8c901..3170d5c97 100644 --- a/src/rust-crypto/RoomEncryptor.ts +++ b/src/rust-crypto/RoomEncryptor.ts @@ -20,23 +20,23 @@ import { EncryptionAlgorithm, EncryptionSettings, HistoryVisibility as RustHistoryVisibility, - OlmMachine, + type OlmMachine, RoomId, - ToDeviceRequest, + type ToDeviceRequest, UserId, } from "@matrix-org/matrix-sdk-crypto-wasm"; import { EventType } from "../@types/event.ts"; -import { IContent, MatrixEvent } from "../models/event.ts"; -import { Room } from "../models/room.ts"; -import { Logger, logger, LogSpan } from "../logger.ts"; -import { KeyClaimManager } from "./KeyClaimManager.ts"; -import { RoomMember } from "../models/room-member.ts"; +import { type IContent, type MatrixEvent } from "../models/event.ts"; +import { type Room } from "../models/room.ts"; +import { type Logger, logger, LogSpan } from "../logger.ts"; +import { type KeyClaimManager } from "./KeyClaimManager.ts"; +import { type RoomMember } from "../models/room-member.ts"; import { HistoryVisibility } from "../@types/partials.ts"; -import { OutgoingRequestsManager } from "./OutgoingRequestsManager.ts"; +import { type OutgoingRequestsManager } from "./OutgoingRequestsManager.ts"; import { logDuration } from "../utils.ts"; import { KnownMembership } from "../@types/membership.ts"; -import { DeviceIsolationMode, DeviceIsolationModeKind } from "../crypto-api/index.ts"; +import { type DeviceIsolationMode, DeviceIsolationModeKind } from "../crypto-api/index.ts"; /** * RoomEncryptor: responsible for encrypting messages to a given room diff --git a/src/rust-crypto/backup.ts b/src/rust-crypto/backup.ts index 69e37d484..3b0555832 100644 --- a/src/rust-crypto/backup.ts +++ b/src/rust-crypto/backup.ts @@ -14,30 +14,30 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { OlmMachine, SignatureVerification } from "@matrix-org/matrix-sdk-crypto-wasm"; +import { type OlmMachine, type SignatureVerification } from "@matrix-org/matrix-sdk-crypto-wasm"; import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; import { - BackupTrustInfo, - Curve25519AuthData, - KeyBackupCheck, - KeyBackupInfo, - KeyBackupSession, - Curve25519SessionData, - KeyBackupRestoreOpts, - KeyBackupRestoreResult, - KeyBackupRoomSessions, + type BackupTrustInfo, + type Curve25519AuthData, + type KeyBackupCheck, + type KeyBackupInfo, + type KeyBackupSession, + type Curve25519SessionData, + type KeyBackupRestoreOpts, + type KeyBackupRestoreResult, + type KeyBackupRoomSessions, } from "../crypto-api/keybackup.ts"; import { logger } from "../logger.ts"; -import { ClientPrefix, IHttpOpts, MatrixError, MatrixHttpApi, Method } from "../http-api/index.ts"; +import { ClientPrefix, type IHttpOpts, MatrixError, type MatrixHttpApi, Method } from "../http-api/index.ts"; import { TypedEventEmitter } from "../models/typed-event-emitter.ts"; import { encodeUri, logDuration } from "../utils.ts"; -import { OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts"; +import { type OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts"; import { sleep } from "../utils.ts"; -import { BackupDecryptor } from "../common-crypto/CryptoBackend.ts"; -import { ImportRoomKeyProgressData, ImportRoomKeysOpts, CryptoEvent } from "../crypto-api/index.ts"; -import { AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts"; -import { IMegolmSessionData } from "../@types/crypto.ts"; +import { type BackupDecryptor } from "../common-crypto/CryptoBackend.ts"; +import { type ImportRoomKeyProgressData, type ImportRoomKeysOpts, CryptoEvent } from "../crypto-api/index.ts"; +import { type AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts"; +import { type IMegolmSessionData } from "../@types/crypto.ts"; /** Authentification of the backup info, depends on algorithm */ type AuthData = KeyBackupInfo["auth_data"]; diff --git a/src/rust-crypto/device-converter.ts b/src/rust-crypto/device-converter.ts index 80e8bd373..fc3acd044 100644 --- a/src/rust-crypto/device-converter.ts +++ b/src/rust-crypto/device-converter.ts @@ -17,7 +17,7 @@ limitations under the License. import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; import { Device, DeviceVerification } from "../models/device.ts"; -import { DeviceKeys } from "../client.ts"; +import { type DeviceKeys } from "../client.ts"; /** * Convert a {@link RustSdkCryptoJs.Device} to a {@link Device} diff --git a/src/rust-crypto/index.ts b/src/rust-crypto/index.ts index bf391bdca..6365ff0aa 100644 --- a/src/rust-crypto/index.ts +++ b/src/rust-crypto/index.ts @@ -18,16 +18,16 @@ import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; import { StoreHandle } from "@matrix-org/matrix-sdk-crypto-wasm"; import { RustCrypto } from "./rust-crypto.ts"; -import { IHttpOpts, MatrixHttpApi } from "../http-api/index.ts"; -import { ServerSideSecretStorage } from "../secret-storage.ts"; -import { Logger } from "../logger.ts"; -import { CryptoStore, MigrationState } from "../crypto/store/base.ts"; +import { type IHttpOpts, type MatrixHttpApi } from "../http-api/index.ts"; +import { type ServerSideSecretStorage } from "../secret-storage.ts"; +import { type Logger } from "../logger.ts"; +import { type CryptoStore, MigrationState } from "../crypto/store/base.ts"; import { migrateFromLegacyCrypto, migrateLegacyLocalTrustIfNeeded, migrateRoomSettingsFromLegacyCrypto, } from "./libolm_migration.ts"; -import { CryptoCallbacks } from "../crypto-api/index.ts"; +import { type CryptoCallbacks } from "../crypto-api/index.ts"; /** * Create a new `RustCrypto` implementation diff --git a/src/rust-crypto/libolm_migration.ts b/src/rust-crypto/libolm_migration.ts index f23f9d7df..53cdbe7f7 100644 --- a/src/rust-crypto/libolm_migration.ts +++ b/src/rust-crypto/libolm_migration.ts @@ -16,18 +16,18 @@ limitations under the License. import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; -import { Logger } from "../logger.ts"; -import { CryptoStore, MigrationState, SecretStorePrivateKeys } from "../crypto/store/base.ts"; +import { type Logger } from "../logger.ts"; +import { type CryptoStore, MigrationState, type SecretStorePrivateKeys } from "../crypto/store/base.ts"; import { IndexedDBCryptoStore } from "../crypto/store/indexeddb-crypto-store.ts"; -import { IHttpOpts, MatrixHttpApi } from "../http-api/index.ts"; +import { type IHttpOpts, type MatrixHttpApi } from "../http-api/index.ts"; import { requestKeyBackupVersion } from "./backup.ts"; -import { CrossSigningKeyInfo, Curve25519AuthData } from "../crypto-api/index.ts"; -import { RustCrypto } from "./rust-crypto.ts"; -import { KeyBackupInfo } from "../crypto-api/keybackup.ts"; +import { type CrossSigningKeyInfo, type Curve25519AuthData } from "../crypto-api/index.ts"; +import { type RustCrypto } from "./rust-crypto.ts"; +import { type KeyBackupInfo } from "../crypto-api/keybackup.ts"; import { sleep } from "../utils.ts"; import { encodeBase64 } from "../base64.ts"; import decryptAESSecretStorageItem from "../utils/decryptAESSecretStorageItem.ts"; -import { AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts"; +import { type AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts"; interface LegacyRoomEncryption { algorithm: string; diff --git a/src/rust-crypto/rust-crypto.ts b/src/rust-crypto/rust-crypto.ts index 4eb8f5be0..8f41c4b6c 100644 --- a/src/rust-crypto/rust-crypto.ts +++ b/src/rust-crypto/rust-crypto.ts @@ -22,57 +22,61 @@ import { KnownMembership } from "../@types/membership.ts"; import type { IDeviceLists, IToDeviceEvent } from "../sync-accumulator.ts"; import type { IEncryptedEventInfo } from "../crypto/api.ts"; import type { ToDevicePayload, ToDeviceBatch } from "../models/ToDeviceMessage.ts"; -import { MatrixEvent, MatrixEventEvent } from "../models/event.ts"; -import { Room } from "../models/room.ts"; -import { RoomMember } from "../models/room-member.ts"; +import { type MatrixEvent, MatrixEventEvent } from "../models/event.ts"; +import { type Room } from "../models/room.ts"; +import { type RoomMember } from "../models/room-member.ts"; import { - BackupDecryptor, - CryptoBackend, + type BackupDecryptor, + type CryptoBackend, DecryptionError, - OnSyncCompletedData, + type OnSyncCompletedData, } from "../common-crypto/CryptoBackend.ts"; -import { logger, Logger, LogSpan } from "../logger.ts"; -import { IHttpOpts, MatrixHttpApi, Method } from "../http-api/index.ts"; +import { logger, type Logger, LogSpan } from "../logger.ts"; +import { type IHttpOpts, type MatrixHttpApi, Method } from "../http-api/index.ts"; import { RoomEncryptor } from "./RoomEncryptor.ts"; import { OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts"; import { KeyClaimManager } from "./KeyClaimManager.ts"; import { logDuration, MapWithDefault } from "../utils.ts"; import { - BackupTrustInfo, - BootstrapCrossSigningOpts, - CreateSecretStorageOpts, + type BackupTrustInfo, + type BootstrapCrossSigningOpts, + type CreateSecretStorageOpts, CrossSigningKey, - CrossSigningKeyInfo, - CrossSigningStatus, - CryptoApi, - CryptoCallbacks, + type CrossSigningKeyInfo, + type CrossSigningStatus, + type CryptoApi, + type CryptoCallbacks, DecryptionFailureCode, DeviceVerificationStatus, - EventEncryptionInfo, + type EventEncryptionInfo, EventShieldColour, EventShieldReason, - GeneratedSecretStorageKey, - ImportRoomKeysOpts, - KeyBackupCheck, - KeyBackupInfo, - OwnDeviceKeys, + type GeneratedSecretStorageKey, + type ImportRoomKeysOpts, + type KeyBackupCheck, + type KeyBackupInfo, + type OwnDeviceKeys, UserVerificationStatus, - VerificationRequest, + type VerificationRequest, encodeRecoveryKey, deriveRecoveryKeyFromPassphrase, - DeviceIsolationMode, + type DeviceIsolationMode, AllDevicesIsolationMode, DeviceIsolationModeKind, CryptoEvent, - CryptoEventHandlerMap, - KeyBackupRestoreOpts, - KeyBackupRestoreResult, - StartDehydrationOpts, + type CryptoEventHandlerMap, + type KeyBackupRestoreOpts, + type KeyBackupRestoreResult, + type StartDehydrationOpts, } from "../crypto-api/index.ts"; import { deviceKeysToDeviceMap, rustDeviceToJsDevice } from "./device-converter.ts"; -import { IDownloadKeyResult, IQueryKeysRequest } from "../client.ts"; -import { Device, DeviceMap } from "../models/device.ts"; -import { SECRET_STORAGE_ALGORITHM_V1_AES, SecretStorageKey, ServerSideSecretStorage } from "../secret-storage.ts"; +import { type IDownloadKeyResult, type IQueryKeysRequest } from "../client.ts"; +import { type Device, type DeviceMap } from "../models/device.ts"; +import { + SECRET_STORAGE_ALGORITHM_V1_AES, + type SecretStorageKey, + type ServerSideSecretStorage, +} from "../secret-storage.ts"; import { CrossSigningIdentity } from "./CrossSigningIdentity.ts"; import { secretStorageCanAccessSecrets, secretStorageContainsCrossSigningKeys } from "./secret-storage.ts"; import { isVerificationEvent, RustVerificationRequest, verificationMethodIdentifierToMethod } from "./verification.ts"; @@ -82,14 +86,14 @@ import { decryptionKeyMatchesKeyBackupInfo, RustBackupManager } from "./backup.t import { TypedReEmitter } from "../ReEmitter.ts"; import { secureRandomString } from "../randomstring.ts"; import { ClientStoppedError } from "../errors.ts"; -import { ISignatures } from "../@types/signed.ts"; +import { type ISignatures } from "../@types/signed.ts"; import { decodeBase64, encodeBase64 } from "../base64.ts"; import { OutgoingRequestsManager } from "./OutgoingRequestsManager.ts"; import { PerSessionKeyBackupDownloader } from "./PerSessionKeyBackupDownloader.ts"; import { DehydratedDeviceManager } from "./DehydratedDeviceManager.ts"; import { VerificationMethod } from "../types.ts"; import { keyFromAuthData } from "../common-crypto/key-passphrase.ts"; -import { UIAuthCallback } from "../interactive-auth.ts"; +import { type UIAuthCallback } from "../interactive-auth.ts"; const ALL_VERIFICATION_METHODS = [ VerificationMethod.Sas, diff --git a/src/rust-crypto/secret-storage.ts b/src/rust-crypto/secret-storage.ts index b4b1083d0..1e95acea6 100644 --- a/src/rust-crypto/secret-storage.ts +++ b/src/rust-crypto/secret-storage.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { SecretStorageKey, ServerSideSecretStorage } from "../secret-storage.ts"; +import { type SecretStorageKey, type ServerSideSecretStorage } from "../secret-storage.ts"; /** * Check that the private cross signing keys (master, self signing, user signing) are stored in the secret storage and encrypted with the default secret storage key. diff --git a/src/rust-crypto/verification.ts b/src/rust-crypto/verification.ts index fe25ac54d..32e889983 100644 --- a/src/rust-crypto/verification.ts +++ b/src/rust-crypto/verification.ts @@ -18,23 +18,23 @@ import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; import { QrState } from "@matrix-org/matrix-sdk-crypto-wasm"; import { - GeneratedSas, - ShowQrCodeCallbacks, - ShowSasCallbacks, + type GeneratedSas, + type ShowQrCodeCallbacks, + type ShowSasCallbacks, VerificationPhase, - VerificationRequest, + type VerificationRequest, VerificationRequestEvent, - VerificationRequestEventHandlerMap, - Verifier, + type VerificationRequestEventHandlerMap, + type Verifier, VerifierEvent, - VerifierEventHandlerMap, + type VerifierEventHandlerMap, } from "../crypto-api/verification.ts"; import { TypedEventEmitter } from "../models/typed-event-emitter.ts"; -import { OutgoingRequest, OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts"; +import { type OutgoingRequest, type OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts"; import { TypedReEmitter } from "../ReEmitter.ts"; -import { MatrixEvent } from "../models/event.ts"; +import { type MatrixEvent } from "../models/event.ts"; import { EventType, MsgType } from "../@types/event.ts"; -import { defer, IDeferred } from "../utils.ts"; +import { defer, type IDeferred } from "../utils.ts"; import { VerificationMethod } from "../types.ts"; /** diff --git a/src/scheduler.ts b/src/scheduler.ts index e854a6769..bd5c38a0d 100644 --- a/src/scheduler.ts +++ b/src/scheduler.ts @@ -19,11 +19,11 @@ limitations under the License. * of requests. */ import { logger } from "./logger.ts"; -import { MatrixEvent } from "./models/event.ts"; +import { type MatrixEvent } from "./models/event.ts"; import { EventType } from "./@types/event.ts"; -import { defer, IDeferred, removeElement } from "./utils.ts"; -import { calculateRetryBackoff, MatrixError } from "./http-api/index.ts"; -import { ISendEventResponse } from "./@types/requests.ts"; +import { defer, type IDeferred, removeElement } from "./utils.ts"; +import { calculateRetryBackoff, type MatrixError } from "./http-api/index.ts"; +import { type ISendEventResponse } from "./@types/requests.ts"; const DEBUG = false; // set true to enable console logging. diff --git a/src/secret-storage.ts b/src/secret-storage.ts index a9c1454d3..d2cf19862 100644 --- a/src/secret-storage.ts +++ b/src/secret-storage.ts @@ -20,16 +20,16 @@ limitations under the License. * @see https://spec.matrix.org/v1.6/client-server-api/#storage */ -import { TypedEventEmitter } from "./models/typed-event-emitter.ts"; -import { ClientEvent, ClientEventHandlerMap } from "./client.ts"; -import { MatrixEvent } from "./models/event.ts"; +import { type TypedEventEmitter } from "./models/typed-event-emitter.ts"; +import { ClientEvent, type ClientEventHandlerMap } from "./client.ts"; +import { type MatrixEvent } from "./models/event.ts"; import { secureRandomString } from "./randomstring.ts"; import { logger } from "./logger.ts"; import encryptAESSecretStorageItem from "./utils/encryptAESSecretStorageItem.ts"; import decryptAESSecretStorageItem from "./utils/decryptAESSecretStorageItem.ts"; -import { AESEncryptedSecretStoragePayload } from "./@types/AESEncryptedSecretStoragePayload.ts"; -import { AccountDataEvents, SecretStorageAccountDataEvents } from "./@types/event.ts"; -import { EmptyObject } from "./@types/common.ts"; +import { type AESEncryptedSecretStoragePayload } from "./@types/AESEncryptedSecretStoragePayload.ts"; +import { type AccountDataEvents, type SecretStorageAccountDataEvents } from "./@types/event.ts"; +import { type EmptyObject } from "./@types/common.ts"; export const SECRET_STORAGE_ALGORITHM_V1_AES = "m.secret_storage.v1.aes-hmac-sha2"; diff --git a/src/serverCapabilities.ts b/src/serverCapabilities.ts index f477ce399..5627aa4b1 100644 --- a/src/serverCapabilities.ts +++ b/src/serverCapabilities.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IHttpOpts, MatrixHttpApi, Method } from "./http-api/index.ts"; +import { type IHttpOpts, type MatrixHttpApi, Method } from "./http-api/index.ts"; import { logger } from "./logger.ts"; // How often we update the server capabilities. diff --git a/src/sliding-sync-sdk.ts b/src/sliding-sync-sdk.ts index abc81cad3..5bc2d58b5 100644 --- a/src/sliding-sync-sdk.ts +++ b/src/sliding-sync-sdk.ts @@ -19,30 +19,36 @@ import { NotificationCountType, Room, RoomEvent } from "./models/room.ts"; import { logger } from "./logger.ts"; import { promiseMapSeries } from "./utils.ts"; import { EventTimeline } from "./models/event-timeline.ts"; -import { ClientEvent, IStoredClientOpts, MatrixClient } from "./client.ts"; +import { ClientEvent, type IStoredClientOpts, type MatrixClient } from "./client.ts"; import { - ISyncStateData, + type ISyncStateData, SyncState, _createAndReEmitRoom, - SyncApiOptions, + type SyncApiOptions, defaultClientOpts, defaultSyncApiOpts, - SetPresence, + type SetPresence, } from "./sync.ts"; -import { MatrixEvent } from "./models/event.ts"; -import { IMinimalEvent, IRoomEvent, IStateEvent, IStrippedState, ISyncResponse } from "./sync-accumulator.ts"; +import { type MatrixEvent } from "./models/event.ts"; +import { + type IMinimalEvent, + type IRoomEvent, + type IStateEvent, + type IStrippedState, + type ISyncResponse, +} from "./sync-accumulator.ts"; import { MatrixError } from "./http-api/index.ts"; import { - Extension, + type Extension, ExtensionState, - MSC3575RoomData, - MSC3575SlidingSyncResponse, - SlidingSync, + type MSC3575RoomData, + type MSC3575SlidingSyncResponse, + type SlidingSync, SlidingSyncEvent, SlidingSyncState, } from "./sliding-sync.ts"; import { EventType } from "./@types/event.ts"; -import { IPushRules } from "./@types/PushRules.ts"; +import { type IPushRules } from "./@types/PushRules.ts"; import { RoomStateEvent } from "./models/room-state.ts"; import { RoomMemberEvent } from "./models/room-member.ts"; import { KnownMembership } from "./@types/membership.ts"; diff --git a/src/sliding-sync.ts b/src/sliding-sync.ts index 7d6042c69..4cecbd9c4 100644 --- a/src/sliding-sync.ts +++ b/src/sliding-sync.ts @@ -15,11 +15,11 @@ limitations under the License. */ import { logger } from "./logger.ts"; -import { MatrixClient } from "./client.ts"; -import { IRoomEvent, IStateEvent } from "./sync-accumulator.ts"; +import { type MatrixClient } from "./client.ts"; +import { type IRoomEvent, type IStateEvent } from "./sync-accumulator.ts"; import { TypedEventEmitter } from "./models/typed-event-emitter.ts"; -import { sleep, IDeferred, defer } from "./utils.ts"; -import { HTTPError } from "./http-api/index.ts"; +import { sleep, type IDeferred, defer } from "./utils.ts"; +import { type HTTPError } from "./http-api/index.ts"; // /sync requests allow you to set a timeout= but the request may continue // beyond that and wedge forever, so we need to track how long we are willing diff --git a/src/store/index.ts b/src/store/index.ts index 648707533..31a3f3391 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -14,17 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { EventType } from "../@types/event.ts"; -import { Room } from "../models/room.ts"; -import { User } from "../models/user.ts"; -import { IEvent, MatrixEvent } from "../models/event.ts"; -import { Filter } from "../filter.ts"; -import { RoomSummary } from "../models/room-summary.ts"; -import { IMinimalEvent, IRooms, ISyncResponse } from "../sync-accumulator.ts"; -import { IStartClientOpts } from "../client.ts"; -import { IStateEventWithRoomId } from "../@types/search.ts"; -import { IndexedToDeviceBatch, ToDeviceBatchWithTxnId } from "../models/ToDeviceMessage.ts"; -import { EventEmitterEvents } from "../models/typed-event-emitter.ts"; +import { type EventType } from "../@types/event.ts"; +import { type Room } from "../models/room.ts"; +import { type User } from "../models/user.ts"; +import { type IEvent, type MatrixEvent } from "../models/event.ts"; +import { type Filter } from "../filter.ts"; +import { type RoomSummary } from "../models/room-summary.ts"; +import { type IMinimalEvent, type IRooms, type ISyncResponse } from "../sync-accumulator.ts"; +import { type IStartClientOpts } from "../client.ts"; +import { type IStateEventWithRoomId } from "../@types/search.ts"; +import { type IndexedToDeviceBatch, type ToDeviceBatchWithTxnId } from "../models/ToDeviceMessage.ts"; +import { type EventEmitterEvents } from "../models/typed-event-emitter.ts"; export interface ISavedSync { nextBatch: string; diff --git a/src/store/indexeddb-backend.ts b/src/store/indexeddb-backend.ts index e5e1dff5b..b454ecfb9 100644 --- a/src/store/indexeddb-backend.ts +++ b/src/store/indexeddb-backend.ts @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { ISavedSync } from "./index.ts"; -import { IEvent, IStateEventWithRoomId, IStoredClientOpts, ISyncResponse } from "../matrix.ts"; -import { IndexedToDeviceBatch, ToDeviceBatchWithTxnId } from "../models/ToDeviceMessage.ts"; +import { type ISavedSync } from "./index.ts"; +import { type IEvent, type IStateEventWithRoomId, type IStoredClientOpts, type ISyncResponse } from "../matrix.ts"; +import { type IndexedToDeviceBatch, type ToDeviceBatchWithTxnId } from "../models/ToDeviceMessage.ts"; export interface IIndexedDBBackend { connect(onClose?: () => void): Promise; diff --git a/src/store/indexeddb-local-backend.ts b/src/store/indexeddb-local-backend.ts index 04a58dd41..c1c8b85c6 100644 --- a/src/store/indexeddb-local-backend.ts +++ b/src/store/indexeddb-local-backend.ts @@ -14,14 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IMinimalEvent, ISyncData, ISyncResponse, SyncAccumulator } from "../sync-accumulator.ts"; +import { type IMinimalEvent, type ISyncData, type ISyncResponse, SyncAccumulator } from "../sync-accumulator.ts"; import { deepCopy, promiseTry } from "../utils.ts"; import { exists as idbExists } from "../indexeddb-helpers.ts"; import { logger } from "../logger.ts"; -import { IStateEventWithRoomId, IStoredClientOpts } from "../matrix.ts"; -import { ISavedSync } from "./index.ts"; -import { IIndexedDBBackend, UserTuple } from "./indexeddb-backend.ts"; -import { IndexedToDeviceBatch, ToDeviceBatchWithTxnId } from "../models/ToDeviceMessage.ts"; +import { type IStateEventWithRoomId, type IStoredClientOpts } from "../matrix.ts"; +import { type ISavedSync } from "./index.ts"; +import { type IIndexedDBBackend, type UserTuple } from "./indexeddb-backend.ts"; +import { type IndexedToDeviceBatch, type ToDeviceBatchWithTxnId } from "../models/ToDeviceMessage.ts"; type DbMigration = (db: IDBDatabase) => void; const DB_MIGRATIONS: DbMigration[] = [ diff --git a/src/store/indexeddb-remote-backend.ts b/src/store/indexeddb-remote-backend.ts index 1bb9e19c8..26ec0613d 100644 --- a/src/store/indexeddb-remote-backend.ts +++ b/src/store/indexeddb-remote-backend.ts @@ -15,12 +15,12 @@ limitations under the License. */ import { logger } from "../logger.ts"; -import { defer, IDeferred } from "../utils.ts"; -import { ISavedSync } from "./index.ts"; -import { IStoredClientOpts } from "../client.ts"; -import { IStateEventWithRoomId, ISyncResponse } from "../matrix.ts"; -import { IIndexedDBBackend, UserTuple } from "./indexeddb-backend.ts"; -import { IndexedToDeviceBatch, ToDeviceBatchWithTxnId } from "../models/ToDeviceMessage.ts"; +import { defer, type IDeferred } from "../utils.ts"; +import { type ISavedSync } from "./index.ts"; +import { type IStoredClientOpts } from "../client.ts"; +import { type IStateEventWithRoomId, type ISyncResponse } from "../matrix.ts"; +import { type IIndexedDBBackend, type UserTuple } from "./indexeddb-backend.ts"; +import { type IndexedToDeviceBatch, type ToDeviceBatchWithTxnId } from "../models/ToDeviceMessage.ts"; export class RemoteIndexedDBStoreBackend implements IIndexedDBBackend { private worker?: Worker; diff --git a/src/store/indexeddb.ts b/src/store/indexeddb.ts index 8705f4a5c..d01896dbb 100644 --- a/src/store/indexeddb.ts +++ b/src/store/indexeddb.ts @@ -16,18 +16,18 @@ limitations under the License. /* eslint-disable @babel/no-invalid-this */ -import { MemoryStore, IOpts as IBaseOpts } from "./memory.ts"; +import { MemoryStore, type IOpts as IBaseOpts } from "./memory.ts"; import { LocalIndexedDBStoreBackend } from "./indexeddb-local-backend.ts"; import { RemoteIndexedDBStoreBackend } from "./indexeddb-remote-backend.ts"; -import { IEvent, MatrixEvent } from "../models/event.ts"; +import { type IEvent, MatrixEvent } from "../models/event.ts"; import { logger } from "../logger.ts"; -import { ISavedSync } from "./index.ts"; -import { IIndexedDBBackend } from "./indexeddb-backend.ts"; -import { ISyncResponse } from "../sync-accumulator.ts"; -import { EventEmitterEvents, TypedEventEmitter } from "../models/typed-event-emitter.ts"; -import { IStateEventWithRoomId } from "../@types/search.ts"; -import { IndexedToDeviceBatch, ToDeviceBatchWithTxnId } from "../models/ToDeviceMessage.ts"; -import { IStoredClientOpts } from "../client.ts"; +import { type ISavedSync } from "./index.ts"; +import { type IIndexedDBBackend } from "./indexeddb-backend.ts"; +import { type ISyncResponse } from "../sync-accumulator.ts"; +import { type EventEmitterEvents, TypedEventEmitter } from "../models/typed-event-emitter.ts"; +import { type IStateEventWithRoomId } from "../@types/search.ts"; +import { type IndexedToDeviceBatch, type ToDeviceBatchWithTxnId } from "../models/ToDeviceMessage.ts"; +import { type IStoredClientOpts } from "../client.ts"; /** * This is an internal module. See {@link IndexedDBStore} for the public class. diff --git a/src/store/memory.ts b/src/store/memory.ts index 2daa6a5f2..8c7194171 100644 --- a/src/store/memory.ts +++ b/src/store/memory.ts @@ -18,19 +18,19 @@ limitations under the License. * This is an internal module. See {@link MemoryStore} for the public class. */ -import { EventType } from "../@types/event.ts"; -import { Room } from "../models/room.ts"; -import { User } from "../models/user.ts"; -import { IEvent, MatrixEvent } from "../models/event.ts"; -import { RoomState, RoomStateEvent } from "../models/room-state.ts"; -import { RoomMember } from "../models/room-member.ts"; -import { Filter } from "../filter.ts"; -import { ISavedSync, IStore, UserCreator } from "./index.ts"; -import { RoomSummary } from "../models/room-summary.ts"; -import { ISyncResponse } from "../sync-accumulator.ts"; -import { IStateEventWithRoomId } from "../@types/search.ts"; -import { IndexedToDeviceBatch, ToDeviceBatchWithTxnId } from "../models/ToDeviceMessage.ts"; -import { IStoredClientOpts } from "../client.ts"; +import { type EventType } from "../@types/event.ts"; +import { type Room } from "../models/room.ts"; +import { type User } from "../models/user.ts"; +import { type IEvent, type MatrixEvent } from "../models/event.ts"; +import { type RoomState, RoomStateEvent } from "../models/room-state.ts"; +import { type RoomMember } from "../models/room-member.ts"; +import { type Filter } from "../filter.ts"; +import { type ISavedSync, type IStore, type UserCreator } from "./index.ts"; +import { type RoomSummary } from "../models/room-summary.ts"; +import { type ISyncResponse } from "../sync-accumulator.ts"; +import { type IStateEventWithRoomId } from "../@types/search.ts"; +import { type IndexedToDeviceBatch, type ToDeviceBatchWithTxnId } from "../models/ToDeviceMessage.ts"; +import { type IStoredClientOpts } from "../client.ts"; import { MapWithDefault } from "../utils.ts"; import { KnownMembership } from "../@types/membership.ts"; diff --git a/src/store/stub.ts b/src/store/stub.ts index 72b0acff0..db561e9cc 100644 --- a/src/store/stub.ts +++ b/src/store/stub.ts @@ -18,17 +18,17 @@ limitations under the License. * This is an internal module. */ -import { EventType } from "../@types/event.ts"; -import { Room } from "../models/room.ts"; -import { User } from "../models/user.ts"; -import { IEvent, MatrixEvent } from "../models/event.ts"; -import { Filter } from "../filter.ts"; -import { ISavedSync, IStore, UserCreator } from "./index.ts"; -import { RoomSummary } from "../models/room-summary.ts"; -import { ISyncResponse } from "../sync-accumulator.ts"; -import { IStateEventWithRoomId } from "../@types/search.ts"; -import { IndexedToDeviceBatch, ToDeviceBatch } from "../models/ToDeviceMessage.ts"; -import { IStoredClientOpts } from "../client.ts"; +import { type EventType } from "../@types/event.ts"; +import { type Room } from "../models/room.ts"; +import { type User } from "../models/user.ts"; +import { type IEvent, type MatrixEvent } from "../models/event.ts"; +import { type Filter } from "../filter.ts"; +import { type ISavedSync, type IStore, type UserCreator } from "./index.ts"; +import { type RoomSummary } from "../models/room-summary.ts"; +import { type ISyncResponse } from "../sync-accumulator.ts"; +import { type IStateEventWithRoomId } from "../@types/search.ts"; +import { type IndexedToDeviceBatch, type ToDeviceBatch } from "../models/ToDeviceMessage.ts"; +import { type IStoredClientOpts } from "../client.ts"; /** * Construct a stub store. This does no-ops on most store methods. diff --git a/src/sync-accumulator.ts b/src/sync-accumulator.ts index d8a46bbb8..14633ae05 100644 --- a/src/sync-accumulator.ts +++ b/src/sync-accumulator.ts @@ -20,9 +20,9 @@ limitations under the License. import { logger } from "./logger.ts"; import { deepCopy } from "./utils.ts"; -import { IContent, IUnsigned } from "./models/event.ts"; -import { IRoomSummary } from "./models/room-summary.ts"; -import { EventType } from "./@types/event.ts"; +import { type IContent, type IUnsigned } from "./models/event.ts"; +import { type IRoomSummary } from "./models/room-summary.ts"; +import { type EventType } from "./@types/event.ts"; import { UNREAD_THREAD_NOTIFICATIONS } from "./@types/sync.ts"; import { ReceiptAccumulator } from "./receipt-accumulator.ts"; diff --git a/src/sync.ts b/src/sync.ts index 37ebc9139..16a61d33c 100644 --- a/src/sync.ts +++ b/src/sync.ts @@ -23,43 +23,49 @@ limitations under the License. * for HTTP and WS at some point. */ -import { Optional } from "matrix-events-sdk"; +import { type Optional } from "matrix-events-sdk"; import type { SyncCryptoCallbacks } from "./common-crypto/CryptoBackend.ts"; import { User } from "./models/user.ts"; import { NotificationCountType, Room, RoomEvent } from "./models/room.ts"; -import { deepCopy, defer, IDeferred, noUnsafeEventProps, promiseMapSeries, unsafeProp } from "./utils.ts"; +import { deepCopy, defer, type IDeferred, noUnsafeEventProps, promiseMapSeries, unsafeProp } from "./utils.ts"; import { Filter } from "./filter.ts"; import { EventTimeline } from "./models/event-timeline.ts"; import { logger } from "./logger.ts"; -import { ClientEvent, IStoredClientOpts, MatrixClient, PendingEventOrdering, ResetTimelineCallback } from "./client.ts"; import { - IEphemeral, - IInvitedRoom, - IInviteState, - IJoinedRoom, - ILeftRoom, - IKnockedRoom, - IMinimalEvent, - IRoomEvent, - IStateEvent, - IStrippedState, - ISyncResponse, - ITimeline, - IToDeviceEvent, + ClientEvent, + type IStoredClientOpts, + type MatrixClient, + PendingEventOrdering, + type ResetTimelineCallback, +} from "./client.ts"; +import { + type IEphemeral, + type IInvitedRoom, + type IInviteState, + type IJoinedRoom, + type ILeftRoom, + type IKnockedRoom, + type IMinimalEvent, + type IRoomEvent, + type IStateEvent, + type IStrippedState, + type ISyncResponse, + type ITimeline, + type IToDeviceEvent, } from "./sync-accumulator.ts"; -import { MatrixEvent } from "./models/event.ts"; -import { MatrixError, Method } from "./http-api/index.ts"; -import { ISavedSync } from "./store/index.ts"; +import { type MatrixEvent } from "./models/event.ts"; +import { type MatrixError, Method } from "./http-api/index.ts"; +import { type ISavedSync } from "./store/index.ts"; import { EventType } from "./@types/event.ts"; -import { IPushRules } from "./@types/PushRules.ts"; -import { RoomStateEvent, IMarkerFoundOptions } from "./models/room-state.ts"; +import { type IPushRules } from "./@types/PushRules.ts"; +import { RoomStateEvent, type IMarkerFoundOptions } from "./models/room-state.ts"; import { RoomMemberEvent } from "./models/room-member.ts"; import { BeaconEvent } from "./models/beacon.ts"; -import { IEventsResponse } from "./@types/requests.ts"; +import { type IEventsResponse } from "./@types/requests.ts"; import { UNREAD_THREAD_NOTIFICATIONS } from "./@types/sync.ts"; import { Feature, ServerSupport } from "./feature.ts"; -import { Crypto } from "./crypto/index.ts"; +import { type Crypto } from "./crypto/index.ts"; import { KnownMembership } from "./@types/membership.ts"; const DEBUG = true; diff --git a/src/testing.ts b/src/testing.ts index b6d68cd88..07bdbe1f5 100644 --- a/src/testing.ts +++ b/src/testing.ts @@ -22,12 +22,12 @@ limitations under the License. * @packageDocumentation */ -import { IContent, IEvent, IUnsigned, MatrixEvent } from "./models/event.ts"; -import { RoomMember } from "./models/room-member.ts"; +import { type IContent, type IEvent, type IUnsigned, MatrixEvent } from "./models/event.ts"; +import { type RoomMember } from "./models/room-member.ts"; import { EventType } from "./@types/event.ts"; -import { DecryptionFailureCode } from "./crypto-api/index.ts"; -import { DecryptionError, EventDecryptionResult } from "./common-crypto/CryptoBackend.ts"; -import { OidcClientConfig, ValidatedAuthMetadata } from "./oidc/index.ts"; +import { type DecryptionFailureCode } from "./crypto-api/index.ts"; +import { DecryptionError, type EventDecryptionResult } from "./common-crypto/CryptoBackend.ts"; +import { type OidcClientConfig, type ValidatedAuthMetadata } from "./oidc/index.ts"; /** * Create a {@link MatrixEvent}. diff --git a/src/thread-utils.ts b/src/thread-utils.ts index 3362c0060..7422fb480 100644 --- a/src/thread-utils.ts +++ b/src/thread-utils.ts @@ -15,7 +15,7 @@ limitations under the License. */ import { THREAD_RELATION_TYPE } from "./models/thread.ts"; -import { IEvent } from "./models/event.ts"; +import { type IEvent } from "./models/event.ts"; /** * Returns a filter function for the /relations endpoint to filter out relations directly diff --git a/src/timeline-window.ts b/src/timeline-window.ts index 7e961beef..b6eb8634f 100644 --- a/src/timeline-window.ts +++ b/src/timeline-window.ts @@ -14,14 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Optional } from "matrix-events-sdk"; +import { type Optional } from "matrix-events-sdk"; -import { Direction, EventTimeline } from "./models/event-timeline.ts"; +import { type Direction, EventTimeline } from "./models/event-timeline.ts"; import { logger } from "./logger.ts"; -import { MatrixClient } from "./client.ts"; -import { EventTimelineSet } from "./models/event-timeline-set.ts"; -import { MatrixEvent } from "./models/event.ts"; -import { Room, RoomEvent } from "./models/room.ts"; +import { type MatrixClient } from "./client.ts"; +import { type EventTimelineSet } from "./models/event-timeline-set.ts"; +import { type MatrixEvent } from "./models/event.ts"; +import { type Room, RoomEvent } from "./models/room.ts"; /** * @internal diff --git a/src/utils.ts b/src/utils.ts index ce7c5016b..93ef2bf73 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -20,12 +20,12 @@ limitations under the License. import unhomoglyph from "unhomoglyph"; import promiseRetry from "p-retry"; -import { Optional } from "matrix-events-sdk"; +import { type Optional } from "matrix-events-sdk"; -import { IEvent, MatrixEvent } from "./models/event.ts"; +import { type IEvent, type MatrixEvent } from "./models/event.ts"; import { M_TIMESTAMP } from "./@types/location.ts"; import { ReceiptType } from "./@types/read_receipts.ts"; -import { BaseLogger } from "./logger.ts"; +import { type BaseLogger } from "./logger.ts"; const interns = new Map(); diff --git a/src/utils/decryptAESSecretStorageItem.ts b/src/utils/decryptAESSecretStorageItem.ts index b48c16ee0..25937ef8f 100644 --- a/src/utils/decryptAESSecretStorageItem.ts +++ b/src/utils/decryptAESSecretStorageItem.ts @@ -16,7 +16,7 @@ import { decodeBase64 } from "../base64.ts"; import { deriveKeys } from "./internal/deriveKeys.ts"; -import { AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts"; +import { type AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts"; /** * Decrypt an AES-encrypted Secret Storage item. diff --git a/src/utils/encryptAESSecretStorageItem.ts b/src/utils/encryptAESSecretStorageItem.ts index 3592ff488..2035c5c79 100644 --- a/src/utils/encryptAESSecretStorageItem.ts +++ b/src/utils/encryptAESSecretStorageItem.ts @@ -16,7 +16,7 @@ import { decodeBase64, encodeBase64 } from "../base64.ts"; import { deriveKeys } from "./internal/deriveKeys.ts"; -import { AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts"; +import { type AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts"; /** * Encrypt a string as a secret storage item, using AES-CTR. diff --git a/src/webrtc/call.ts b/src/webrtc/call.ts index 6984bada4..18703fbd8 100644 --- a/src/webrtc/call.ts +++ b/src/webrtc/call.ts @@ -26,33 +26,33 @@ import { parse as parseSdp, write as writeSdp } from "sdp-transform"; import { logger } from "../logger.ts"; import { checkObjectHasKeys, isNullOrUndefined, recursivelyAssign } from "../utils.ts"; -import { MatrixEvent } from "../models/event.ts"; -import { EventType, TimelineEvents, ToDeviceMessageId } from "../@types/event.ts"; -import { RoomMember } from "../models/room-member.ts"; +import { type MatrixEvent } from "../models/event.ts"; +import { EventType, type TimelineEvents, ToDeviceMessageId } from "../@types/event.ts"; +import { type RoomMember } from "../models/room-member.ts"; import { secureRandomString } from "../randomstring.ts"; import { - MCallReplacesEvent, - MCallAnswer, - MCallInviteNegotiate, - CallCapabilities, + type MCallReplacesEvent, + type MCallAnswer, + type MCallInviteNegotiate, + type CallCapabilities, SDPStreamMetadataPurpose, - SDPStreamMetadata, + type SDPStreamMetadata, SDPStreamMetadataKey, - MCallSDPStreamMetadataChanged, - MCallSelectAnswer, - MCAllAssertedIdentity, - MCallCandidates, - MCallBase, - MCallHangupReject, + type MCallSDPStreamMetadataChanged, + type MCallSelectAnswer, + type MCAllAssertedIdentity, + type MCallCandidates, + type MCallBase, + type MCallHangupReject, } from "./callEventTypes.ts"; import { CallFeed } from "./callFeed.ts"; -import { MatrixClient } from "../client.ts"; +import { type MatrixClient } from "../client.ts"; import { EventEmitterEvents, TypedEventEmitter } from "../models/typed-event-emitter.ts"; import { DeviceInfo } from "../crypto/deviceinfo.ts"; import { GroupCallUnknownDeviceError } from "./groupCall.ts"; -import { IScreensharingOpts } from "./mediaHandler.ts"; +import { type IScreensharingOpts } from "./mediaHandler.ts"; import { MatrixError } from "../http-api/index.ts"; -import { GroupCallStats } from "./stats/groupCallStats.ts"; +import { type GroupCallStats } from "./stats/groupCallStats.ts"; interface CallOpts { // The room ID for this call. diff --git a/src/webrtc/callEventHandler.ts b/src/webrtc/callEventHandler.ts index c9cde3bd3..dcbce56b7 100644 --- a/src/webrtc/callEventHandler.ts +++ b/src/webrtc/callEventHandler.ts @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixEvent } from "../models/event.ts"; +import { type MatrixEvent } from "../models/event.ts"; import { logger } from "../logger.ts"; -import { CallDirection, CallError, CallErrorCode, CallState, createNewMatrixCall, MatrixCall } from "./call.ts"; +import { CallDirection, CallError, CallErrorCode, CallState, createNewMatrixCall, type MatrixCall } from "./call.ts"; import { EventType } from "../@types/event.ts"; -import { ClientEvent, MatrixClient } from "../client.ts"; -import { MCallAnswer, MCallHangupReject } from "./callEventTypes.ts"; -import { GroupCall, GroupCallErrorCode, GroupCallEvent, GroupCallUnknownDeviceError } from "./groupCall.ts"; +import { ClientEvent, type MatrixClient } from "../client.ts"; +import { type MCallAnswer, type MCallHangupReject } from "./callEventTypes.ts"; +import { type GroupCall, GroupCallErrorCode, GroupCallEvent, GroupCallUnknownDeviceError } from "./groupCall.ts"; import { RoomEvent } from "../models/room.ts"; // Don't ring unless we'd be ringing for at least 3 seconds: the user needs some diff --git a/src/webrtc/callEventTypes.ts b/src/webrtc/callEventTypes.ts index c54e3ead8..c6df83f70 100644 --- a/src/webrtc/callEventTypes.ts +++ b/src/webrtc/callEventTypes.ts @@ -1,7 +1,7 @@ // allow non-camelcase as these are events type that go onto the wire /* eslint-disable camelcase */ -import { CallErrorCode } from "./call.ts"; +import { type CallErrorCode } from "./call.ts"; // TODO: Change to "sdp_stream_metadata" when MSC3077 is merged export const SDPStreamMetadataKey = "org.matrix.msc3077.sdp_stream_metadata"; diff --git a/src/webrtc/callFeed.ts b/src/webrtc/callFeed.ts index 9ae3c3441..991b5a2b4 100644 --- a/src/webrtc/callFeed.ts +++ b/src/webrtc/callFeed.ts @@ -16,11 +16,11 @@ limitations under the License. import { SDPStreamMetadataPurpose } from "./callEventTypes.ts"; import { acquireContext, releaseContext } from "./audioContext.ts"; -import { MatrixClient } from "../client.ts"; -import { RoomMember } from "../models/room-member.ts"; +import { type MatrixClient } from "../client.ts"; +import { type RoomMember } from "../models/room-member.ts"; import { logger } from "../logger.ts"; import { TypedEventEmitter } from "../models/typed-event-emitter.ts"; -import { CallEvent, CallState, MatrixCall } from "./call.ts"; +import { CallEvent, CallState, type MatrixCall } from "./call.ts"; const POLLING_INTERVAL = 200; // ms export const SPEAKING_THRESHOLD = -60; // dB diff --git a/src/webrtc/groupCall.ts b/src/webrtc/groupCall.ts index b4ecac79a..e560b81e3 100644 --- a/src/webrtc/groupCall.ts +++ b/src/webrtc/groupCall.ts @@ -1,36 +1,36 @@ import { TypedEventEmitter } from "../models/typed-event-emitter.ts"; import { CallFeed, SPEAKING_THRESHOLD } from "./callFeed.ts"; -import { MatrixClient, IMyDevice } from "../client.ts"; +import { type MatrixClient, type IMyDevice } from "../client.ts"; import { CallErrorCode, CallEvent, - CallEventHandlerMap, + type CallEventHandlerMap, CallState, genCallID, - MatrixCall, + type MatrixCall, setTracksEnabled, createNewMatrixCall, CallError, } from "./call.ts"; -import { RoomMember } from "../models/room-member.ts"; -import { Room } from "../models/room.ts"; +import { type RoomMember } from "../models/room-member.ts"; +import { type Room } from "../models/room.ts"; import { RoomStateEvent } from "../models/room-state.ts"; import { logger } from "../logger.ts"; import { ReEmitter } from "../ReEmitter.ts"; import { SDPStreamMetadataPurpose } from "./callEventTypes.ts"; -import { MatrixEvent } from "../models/event.ts"; +import { type MatrixEvent } from "../models/event.ts"; import { EventType } from "../@types/event.ts"; import { CallEventHandlerEvent } from "./callEventHandler.ts"; import { GroupCallEventHandlerEvent } from "./groupCallEventHandler.ts"; -import { IScreensharingOpts } from "./mediaHandler.ts"; +import { type IScreensharingOpts } from "./mediaHandler.ts"; import { mapsEqual } from "../utils.ts"; import { GroupCallStats } from "./stats/groupCallStats.ts"; import { - ByteSentStatsReport, - CallFeedReport, - ConnectionStatsReport, + type ByteSentStatsReport, + type CallFeedReport, + type ConnectionStatsReport, StatsReport, - SummaryStatsReport, + type SummaryStatsReport, } from "./stats/statsReport.ts"; import { SummaryStatsReportGatherer } from "./stats/summaryStatsReportGatherer.ts"; import { CallFeedStatsReporter } from "./stats/callFeedStatsReporter.ts"; diff --git a/src/webrtc/groupCallEventHandler.ts b/src/webrtc/groupCallEventHandler.ts index d0ce6af05..4cfcac60c 100644 --- a/src/webrtc/groupCallEventHandler.ts +++ b/src/webrtc/groupCallEventHandler.ts @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixEvent } from "../models/event.ts"; -import { MatrixClient, ClientEvent } from "../client.ts"; -import { GroupCall, GroupCallIntent, GroupCallType, IGroupCallDataChannelOptions } from "./groupCall.ts"; -import { Room } from "../models/room.ts"; -import { RoomState, RoomStateEvent } from "../models/room-state.ts"; -import { RoomMember } from "../models/room-member.ts"; +import { type MatrixEvent } from "../models/event.ts"; +import { type MatrixClient, ClientEvent } from "../client.ts"; +import { GroupCall, GroupCallIntent, GroupCallType, type IGroupCallDataChannelOptions } from "./groupCall.ts"; +import { type Room } from "../models/room.ts"; +import { type RoomState, RoomStateEvent } from "../models/room-state.ts"; +import { type RoomMember } from "../models/room-member.ts"; import { logger } from "../logger.ts"; import { EventType } from "../@types/event.ts"; import { SyncState } from "../sync.ts"; diff --git a/src/webrtc/mediaHandler.ts b/src/webrtc/mediaHandler.ts index 7efa786d2..ea70f7f64 100644 --- a/src/webrtc/mediaHandler.ts +++ b/src/webrtc/mediaHandler.ts @@ -20,7 +20,7 @@ limitations under the License. import { TypedEventEmitter } from "../models/typed-event-emitter.ts"; import { GroupCallType, GroupCallState } from "../webrtc/groupCall.ts"; import { logger } from "../logger.ts"; -import { MatrixClient } from "../client.ts"; +import { type MatrixClient } from "../client.ts"; export enum MediaHandlerEvent { LocalStreamsChanged = "local_streams_changed", diff --git a/src/webrtc/stats/callFeedStatsReporter.ts b/src/webrtc/stats/callFeedStatsReporter.ts index e78438acb..618c860b5 100644 --- a/src/webrtc/stats/callFeedStatsReporter.ts +++ b/src/webrtc/stats/callFeedStatsReporter.ts @@ -13,8 +13,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -import { CallFeedReport, CallFeedStats, TrackStats, TransceiverStats } from "./statsReport.ts"; -import { CallFeed } from "../callFeed.ts"; +import { type CallFeedReport, type CallFeedStats, type TrackStats, type TransceiverStats } from "./statsReport.ts"; +import { type CallFeed } from "../callFeed.ts"; export class CallFeedStatsReporter { public static buildCallFeedReport(callId: string, opponentMemberId: string, pc: RTCPeerConnection): CallFeedReport { diff --git a/src/webrtc/stats/callStatsReportGatherer.ts b/src/webrtc/stats/callStatsReportGatherer.ts index 202d654e0..4921d0adc 100644 --- a/src/webrtc/stats/callStatsReportGatherer.ts +++ b/src/webrtc/stats/callStatsReportGatherer.ts @@ -15,8 +15,8 @@ limitations under the License. */ import { ConnectionStats } from "./connectionStats.ts"; -import { StatsReportEmitter } from "./statsReportEmitter.ts"; -import { ByteSend, ByteSentStatsReport, TrackID } from "./statsReport.ts"; +import { type StatsReportEmitter } from "./statsReportEmitter.ts"; +import { type ByteSend, type ByteSentStatsReport, type TrackID } from "./statsReport.ts"; import { ConnectionStatsBuilder } from "./connectionStatsBuilder.ts"; import { TransportStatsBuilder } from "./transportStatsBuilder.ts"; import { MediaSsrcHandler } from "./media/mediaSsrcHandler.ts"; @@ -25,7 +25,7 @@ import { MediaTrackStatsHandler } from "./media/mediaTrackStatsHandler.ts"; import { TrackStatsBuilder } from "./trackStatsBuilder.ts"; import { ConnectionStatsReportBuilder } from "./connectionStatsReportBuilder.ts"; import { ValueFormatter } from "./valueFormatter.ts"; -import { CallStatsReportSummary } from "./callStatsReportSummary.ts"; +import { type CallStatsReportSummary } from "./callStatsReportSummary.ts"; import { logger } from "../../logger.ts"; import { CallFeedStatsReporter } from "./callFeedStatsReporter.ts"; diff --git a/src/webrtc/stats/connectionStats.ts b/src/webrtc/stats/connectionStats.ts index 2a998c093..68fb12cee 100644 --- a/src/webrtc/stats/connectionStats.ts +++ b/src/webrtc/stats/connectionStats.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { TransportStats } from "./transportStats.ts"; -import { Bitrate } from "./media/mediaTrackStats.ts"; +import { type TransportStats } from "./transportStats.ts"; +import { type Bitrate } from "./media/mediaTrackStats.ts"; export interface ConnectionStatsBandwidth { /** diff --git a/src/webrtc/stats/connectionStatsBuilder.ts b/src/webrtc/stats/connectionStatsBuilder.ts index 154a648d3..55bbcd6f6 100644 --- a/src/webrtc/stats/connectionStatsBuilder.ts +++ b/src/webrtc/stats/connectionStatsBuilder.ts @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -import { Bitrate } from "./media/mediaTrackStats.ts"; +import { type Bitrate } from "./media/mediaTrackStats.ts"; export class ConnectionStatsBuilder { public static buildBandwidthReport(now: RTCIceCandidatePairStats): Bitrate { diff --git a/src/webrtc/stats/connectionStatsReportBuilder.ts b/src/webrtc/stats/connectionStatsReportBuilder.ts index 0be778f1c..7ba825e24 100644 --- a/src/webrtc/stats/connectionStatsReportBuilder.ts +++ b/src/webrtc/stats/connectionStatsReportBuilder.ts @@ -14,14 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ import { - AudioConcealment, - CodecMap, - ConnectionStatsReport, - FramerateMap, - ResolutionMap, - TrackID, + type AudioConcealment, + type CodecMap, + type ConnectionStatsReport, + type FramerateMap, + type ResolutionMap, + type TrackID, } from "./statsReport.ts"; -import { MediaTrackStats, Resolution } from "./media/mediaTrackStats.ts"; +import { type MediaTrackStats, type Resolution } from "./media/mediaTrackStats.ts"; export class ConnectionStatsReportBuilder { public static build(stats: Map): ConnectionStatsReport { diff --git a/src/webrtc/stats/groupCallStats.ts b/src/webrtc/stats/groupCallStats.ts index ac9283e1c..14d3e4d33 100644 --- a/src/webrtc/stats/groupCallStats.ts +++ b/src/webrtc/stats/groupCallStats.ts @@ -15,7 +15,7 @@ limitations under the License. */ import { CallStatsReportGatherer } from "./callStatsReportGatherer.ts"; import { StatsReportEmitter } from "./statsReportEmitter.ts"; -import { CallStatsReportSummary } from "./callStatsReportSummary.ts"; +import { type CallStatsReportSummary } from "./callStatsReportSummary.ts"; import { SummaryStatsReportGatherer } from "./summaryStatsReportGatherer.ts"; import { logger } from "../../logger.ts"; diff --git a/src/webrtc/stats/media/mediaTrackStats.ts b/src/webrtc/stats/media/mediaTrackStats.ts index e03fae9b3..9de8cb1cf 100644 --- a/src/webrtc/stats/media/mediaTrackStats.ts +++ b/src/webrtc/stats/media/mediaTrackStats.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { AudioConcealment } from "../statsReport.ts"; -import { TrackId } from "./mediaTrackHandler.ts"; +import { type AudioConcealment } from "../statsReport.ts"; +import { type TrackId } from "./mediaTrackHandler.ts"; export interface PacketLoss { packetsTotal: number; diff --git a/src/webrtc/stats/media/mediaTrackStatsHandler.ts b/src/webrtc/stats/media/mediaTrackStatsHandler.ts index d3bd0ec49..28d4b9388 100644 --- a/src/webrtc/stats/media/mediaTrackStatsHandler.ts +++ b/src/webrtc/stats/media/mediaTrackStatsHandler.ts @@ -13,10 +13,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -import { TrackID } from "../statsReport.ts"; +import { type TrackID } from "../statsReport.ts"; import { MediaTrackStats } from "./mediaTrackStats.ts"; -import { MediaTrackHandler, TrackId } from "./mediaTrackHandler.ts"; -import { MediaSsrcHandler } from "./mediaSsrcHandler.ts"; +import { type MediaTrackHandler, type TrackId } from "./mediaTrackHandler.ts"; +import { type MediaSsrcHandler } from "./mediaSsrcHandler.ts"; export class MediaTrackStatsHandler { private readonly track2stats = new Map(); diff --git a/src/webrtc/stats/statsReport.ts b/src/webrtc/stats/statsReport.ts index 2fe13c7e6..333f0365d 100644 --- a/src/webrtc/stats/statsReport.ts +++ b/src/webrtc/stats/statsReport.ts @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { ConnectionStatsBandwidth, ConnectionStatsBitrate, PacketLoss } from "./connectionStats.ts"; -import { TransportStats } from "./transportStats.ts"; -import { Resolution } from "./media/mediaTrackStats.ts"; +import { type ConnectionStatsBandwidth, type ConnectionStatsBitrate, type PacketLoss } from "./connectionStats.ts"; +import { type TransportStats } from "./transportStats.ts"; +import { type Resolution } from "./media/mediaTrackStats.ts"; export enum StatsReport { CONNECTION_STATS = "StatsReport.connection_stats", diff --git a/src/webrtc/stats/statsReportEmitter.ts b/src/webrtc/stats/statsReportEmitter.ts index aef92a830..67c22888e 100644 --- a/src/webrtc/stats/statsReportEmitter.ts +++ b/src/webrtc/stats/statsReportEmitter.ts @@ -16,11 +16,11 @@ limitations under the License. import { TypedEventEmitter } from "../../models/typed-event-emitter.ts"; import { - ByteSentStatsReport, - CallFeedReport, - ConnectionStatsReport, + type ByteSentStatsReport, + type CallFeedReport, + type ConnectionStatsReport, StatsReport, - SummaryStatsReport, + type SummaryStatsReport, } from "./statsReport.ts"; export type StatsReportHandlerMap = { diff --git a/src/webrtc/stats/summaryStatsReportGatherer.ts b/src/webrtc/stats/summaryStatsReportGatherer.ts index 09e381d48..835f84178 100644 --- a/src/webrtc/stats/summaryStatsReportGatherer.ts +++ b/src/webrtc/stats/summaryStatsReportGatherer.ts @@ -10,11 +10,11 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -import { StatsReportEmitter } from "./statsReportEmitter.ts"; -import { CallStatsReportSummary } from "./callStatsReportSummary.ts"; -import { SummaryStatsReport } from "./statsReport.ts"; -import { ParticipantState } from "../groupCall.ts"; -import { RoomMember } from "../../matrix.ts"; +import { type StatsReportEmitter } from "./statsReportEmitter.ts"; +import { type CallStatsReportSummary } from "./callStatsReportSummary.ts"; +import { type SummaryStatsReport } from "./statsReport.ts"; +import { type ParticipantState } from "../groupCall.ts"; +import { type RoomMember } from "../../matrix.ts"; interface CallStatsReportSummaryCounter { receivedAudio: number; diff --git a/src/webrtc/stats/trackStatsBuilder.ts b/src/webrtc/stats/trackStatsBuilder.ts index 3e5999e1f..85bb0da7e 100644 --- a/src/webrtc/stats/trackStatsBuilder.ts +++ b/src/webrtc/stats/trackStatsBuilder.ts @@ -1,6 +1,6 @@ -import { MediaTrackStats } from "./media/mediaTrackStats.ts"; +import { type MediaTrackStats } from "./media/mediaTrackStats.ts"; import { ValueFormatter } from "./valueFormatter.ts"; -import { TrackSummary } from "./callStatsReportSummary.ts"; +import { type TrackSummary } from "./callStatsReportSummary.ts"; export class TrackStatsBuilder { public static buildFramerateResolution(trackStats: MediaTrackStats, now: any): void { diff --git a/src/webrtc/stats/transportStatsBuilder.ts b/src/webrtc/stats/transportStatsBuilder.ts index c81ca4b5a..81ba17608 100644 --- a/src/webrtc/stats/transportStatsBuilder.ts +++ b/src/webrtc/stats/transportStatsBuilder.ts @@ -1,4 +1,4 @@ -import { TransportStats } from "./transportStats.ts"; +import { type TransportStats } from "./transportStats.ts"; export class TransportStatsBuilder { public static buildReport( diff --git a/yarn.lock b/yarn.lock index 7dce9dd08..d2e8e2334 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3155,10 +3155,10 @@ eslint-plugin-jsdoc@^50.0.0: spdx-expression-parse "^4.0.0" synckit "^0.9.1" -eslint-plugin-matrix-org@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-matrix-org/-/eslint-plugin-matrix-org-2.0.2.tgz#95b86b0f16704ab19740f7c3c62eae69e20365e6" - integrity sha512-cQy5Rjeq6uyu1mLXlPZwEJdyM0NmclrnEz68y792FSuuxzMyJNNYLGDQ5CkYW8H+PrD825HUFZ34pNXnjMOzOw== +eslint-plugin-matrix-org@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-matrix-org/-/eslint-plugin-matrix-org-2.1.0.tgz#9053726119f107154f5210665c2f84219425c190" + integrity sha512-YjVQ0qunzVV34tpUchLWhOrOalGfRLm0tclS4dPYnXS8Ui+p12o/YtRHt+26Mg5tJ0QH76HsGC0LJKLVLNoqfg== eslint-plugin-n@^14.0.0: version "14.0.0"