diff --git a/babel.config.cjs b/babel.config.cjs index 57d061ffc..d5c314af1 100644 --- a/babel.config.cjs +++ b/babel.config.cjs @@ -14,7 +14,16 @@ module.exports = { modules: process.env.NODE_ENV === "test" ? "commonjs" : false, }, ], - "@babel/preset-typescript", + [ + "@babel/preset-typescript", + { + // When using the transpiled javascript in `lib`, Node.js requires `.js` extensions on any `import` + // specifiers. However, Jest uses the TS source (via babel) and fails to resolve the `.js` names. + // To resolve this,we use the `.ts` names in the source, and rewrite the `import` specifiers to use + // `.js` during transpilation, *except* when we are targetting Jest. + rewriteImportExtensions: process.env.NODE_ENV !== "test", + }, + ], ], plugins: [ "@babel/plugin-transform-numeric-separator", diff --git a/src/@types/auth.ts b/src/@types/auth.ts index 649a85176..27b220db3 100644 --- a/src/@types/auth.ts +++ b/src/@types/auth.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { UnstableValue } from "../NamespacedValue"; -import { IClientWellKnown } from "../client"; +import { UnstableValue } from "../NamespacedValue.ts"; +import { 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 e6bfb8ff9..2bcc6260c 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"; -import { UnstableValue } from "../NamespacedValue"; -import { MAssetEvent, MLocationEvent, MTimestampEvent } from "./location"; +import { RelatesToRelationship, REFERENCE_RELATION } from "./extensible_events.ts"; +import { UnstableValue } from "../NamespacedValue.ts"; +import { MAssetEvent, MLocationEvent, MTimestampEvent } from "./location.ts"; /** * Beacon info and beacon event types as described in MSC3672 diff --git a/src/@types/crypto.ts b/src/@types/crypto.ts index 010882966..54389e336 100644 --- a/src/@types/crypto.ts +++ b/src/@types/crypto.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import type { ISignatures } from "./signed"; +import type { ISignatures } from "./signed.ts"; export type OlmGroupSessionExtraData = { untrusted?: boolean; @@ -22,7 +22,7 @@ export type OlmGroupSessionExtraData = { }; // Backwards compatible re-export -export type { EventDecryptionResult as IEventDecryptionResult } from "../common-crypto/CryptoBackend"; +export type { EventDecryptionResult as IEventDecryptionResult } from "../common-crypto/CryptoBackend.ts"; interface Extensible { [key: string]: any; diff --git a/src/@types/event.ts b/src/@types/event.ts index c01fc40d3..0d28b38fc 100644 --- a/src/@types/event.ts +++ b/src/@types/event.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { NamespacedValue, UnstableValue } from "../NamespacedValue"; +import { NamespacedValue, UnstableValue } from "../NamespacedValue.ts"; import { PolicyRuleEventContent, RoomAvatarEventContent, @@ -34,16 +34,16 @@ import { RoomTopicEventContent, SpaceChildEventContent, SpaceParentEventContent, -} from "./state_events"; +} from "./state_events.ts"; import { ExperimentalGroupCallRoomMemberState, IGroupCallRoomMemberState, IGroupCallRoomState, -} from "../webrtc/groupCall"; -import { MSC3089EventContent } from "../models/MSC3089Branch"; -import { M_BEACON, M_BEACON_INFO, MBeaconEventContent, MBeaconInfoEventContent } from "./beacon"; -import { XOR } from "./common"; -import { ReactionEventContent, RoomMessageEventContent, StickerEventContent } from "./events"; +} from "../webrtc/groupCall.ts"; +import { MSC3089EventContent } from "../models/MSC3089Branch.ts"; +import { M_BEACON, M_BEACON_INFO, MBeaconEventContent, MBeaconInfoEventContent } from "./beacon.ts"; +import { XOR } from "./common.ts"; +import { ReactionEventContent, RoomMessageEventContent, StickerEventContent } from "./events.ts"; import { MCallAnswer, MCallBase, @@ -54,10 +54,10 @@ import { MCallSelectAnswer, SDPStreamMetadata, SDPStreamMetadataKey, -} from "../webrtc/callEventTypes"; -import { EncryptionKeysEventContent, ICallNotifyContent } from "../matrixrtc/types"; -import { M_POLL_END, M_POLL_START, PollEndEventContent, PollStartEventContent } from "./polls"; -import { SessionMembershipData } from "../matrixrtc/CallMembership"; +} 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"; export enum EventType { // Room state events diff --git a/src/@types/events.ts b/src/@types/events.ts index 59c41d201..55af87252 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"; -import { FileInfo, ImageInfo, MediaEventContent } from "./media"; -import { XOR } from "./common"; +import { MsgType, RelationType } from "./event.ts"; +import { FileInfo, ImageInfo, MediaEventContent } from "./media.ts"; +import { XOR } from "./common.ts"; interface BaseTimelineEvent { "body": string; diff --git a/src/@types/extensible_events.ts b/src/@types/extensible_events.ts index 9b16e0e43..27095c271 100644 --- a/src/@types/extensible_events.ts +++ b/src/@types/extensible_events.ts @@ -16,7 +16,7 @@ limitations under the License. import { EitherAnd, NamespacedValue, Optional, UnstableValue } from "matrix-events-sdk"; -import { isProvided } from "../extensible_events_v1/utilities"; +import { isProvided } from "../extensible_events_v1/utilities.ts"; // Types and utilities for MSC1767: Extensible events (version 1) in Matrix diff --git a/src/@types/location.ts b/src/@types/location.ts index d1a826fd8..dd7c49bf0 100644 --- a/src/@types/location.ts +++ b/src/@types/location.ts @@ -17,8 +17,8 @@ limitations under the License. // Types for MSC3488 - m.location: Extending events with location data import { EitherAnd } from "matrix-events-sdk"; -import { UnstableValue } from "../NamespacedValue"; -import { M_TEXT } from "./extensible_events"; +import { UnstableValue } from "../NamespacedValue.ts"; +import { 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 20e5ca6c6..ef23668b0 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"; +import { MsgType } from "../@types/event.ts"; /** * Information on encrypted media attachments. diff --git a/src/@types/polls.ts b/src/@types/polls.ts index 3b06f932a..1a602dc0c 100644 --- a/src/@types/polls.ts +++ b/src/@types/polls.ts @@ -21,7 +21,7 @@ import { REFERENCE_RELATION, RelatesToRelationship, TSNamespace, -} from "./extensible_events"; +} from "./extensible_events.ts"; /** * Identifier for a disclosed poll. diff --git a/src/@types/registration.ts b/src/@types/registration.ts index 7bfb99f7d..2799ba178 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"; +import { 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 ae3ea16dd..0baedff3f 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"; -import { Preset, Visibility } from "./partials"; -import { IEventWithRoomId, SearchKey } from "./search"; -import { IRoomEventFilter } from "../filter"; -import { Direction } from "../models/event-timeline"; -import { PushRuleAction } from "./PushRules"; -import { IRoomEvent } from "../sync-accumulator"; -import { EventType, RelationType, RoomType } from "./event"; +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"; // 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 bd97e7de0..4069d3e98 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"; -import { IRoomEventFilter } from "../filter"; -import { SearchResult } from "../models/search-result"; +import { IRoomEvent, IStateEvent } from "../sync-accumulator.ts"; +import { IRoomEventFilter } from "../filter.ts"; +import { 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 9edab274a..249952e5c 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"; -import { RoomType } from "./event"; -import { IStrippedState } from "../sync-accumulator"; +import { IPublicRoomsChunkRoom } from "../client.ts"; +import { RoomType } from "./event.ts"; +import { 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 36e86f537..d570c5a12 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"; -import { GuestAccess, HistoryVisibility, JoinRule, RestrictedAllowType } from "./partials"; -import { ImageInfo } from "./media"; -import { PolicyRecommendation } from "../models/invites-ignorer"; +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"; export interface RoomCanonicalAliasEventContent { alias?: string; diff --git a/src/@types/synapse.ts b/src/@types/synapse.ts index 1d4ce41ac..8b309c2ae 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"; +import { IdServerUnbindResult } from "./partials.ts"; // Types relating to Synapse Admin APIs diff --git a/src/@types/sync.ts b/src/@types/sync.ts index d9a2a6f56..74e00f792 100644 --- a/src/@types/sync.ts +++ b/src/@types/sync.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { ServerControlledNamespacedValue } from "../NamespacedValue"; +import { ServerControlledNamespacedValue } from "../NamespacedValue.ts"; /** * https://github.com/matrix-org/matrix-doc/pull/3773 diff --git a/src/@types/topic.ts b/src/@types/topic.ts index 04d146406..3d4a63332 100644 --- a/src/@types/topic.ts +++ b/src/@types/topic.ts @@ -16,8 +16,8 @@ limitations under the License. import { EitherAnd } from "matrix-events-sdk"; -import { UnstableValue } from "../NamespacedValue"; -import { IMessageRendering } from "./extensible_events"; +import { UnstableValue } from "../NamespacedValue.ts"; +import { 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 bc10f2dd9..0103d4551 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"; +import { AuthDict, IAuthData } from "../interactive-auth.ts"; /** * Helper type to represent HTTP request body for a UIA enabled endpoint diff --git a/src/ReEmitter.ts b/src/ReEmitter.ts index 5d41ac0e4..9a1bb17d4 100644 --- a/src/ReEmitter.ts +++ b/src/ReEmitter.ts @@ -19,7 +19,7 @@ limitations under the License. // eslint-disable-next-line no-restricted-imports import { EventEmitter } from "events"; -import { ListenerMap, TypedEventEmitter } from "./models/typed-event-emitter"; +import { ListenerMap, 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 59eada4db..391f678fa 100644 --- a/src/ToDeviceMessageQueue.ts +++ b/src/ToDeviceMessageQueue.ts @@ -14,14 +14,19 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { ToDeviceMessageId } from "./@types/event"; -import { logger } from "./logger"; -import { MatrixClient, ClientEvent } from "./client"; -import { MatrixError } from "./http-api"; -import { IndexedToDeviceBatch, ToDeviceBatch, ToDeviceBatchWithTxnId, ToDevicePayload } from "./models/ToDeviceMessage"; -import { MatrixScheduler } from "./scheduler"; -import { SyncState } from "./sync"; -import { MapWithDefault } from "./utils"; +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 { + IndexedToDeviceBatch, + ToDeviceBatch, + ToDeviceBatchWithTxnId, + ToDevicePayload, +} from "./models/ToDeviceMessage.ts"; +import { MatrixScheduler } from "./scheduler.ts"; +import { SyncState } from "./sync.ts"; +import { MapWithDefault } from "./utils.ts"; const MAX_BATCH_SIZE = 20; diff --git a/src/autodiscovery.ts b/src/autodiscovery.ts index 8f4f19668..3733e5330 100644 --- a/src/autodiscovery.ts +++ b/src/autodiscovery.ts @@ -15,10 +15,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IClientWellKnown, IWellKnownConfig, IServerVersions } from "./client"; -import { logger } from "./logger"; -import { MatrixError, Method, timeoutSignal } from "./http-api"; -import { SUPPORTED_MATRIX_VERSIONS } from "./version-support"; +import { IClientWellKnown, IWellKnownConfig, IServerVersions } from "./client.ts"; +import { logger } from "./logger.ts"; +import { 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. // See: https://matrix.org/docs/spec/client_server/r0.4.0.html#server-discovery diff --git a/src/browser-index.ts b/src/browser-index.ts index a8d9e4ab0..6b77aed91 100644 --- a/src/browser-index.ts +++ b/src/browser-index.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import * as matrixcs from "./matrix"; +import * as matrixcs from "./matrix.ts"; type BrowserMatrix = typeof matrixcs; declare global { @@ -40,5 +40,5 @@ if (indexedDB) { matrixcs.setCryptoStoreFactory(() => new matrixcs.IndexedDBCryptoStore(indexedDB!, "matrix-js-sdk:crypto")); } -export * from "./matrix"; +export * from "./matrix.ts"; globalThis.matrixcs = matrixcs; diff --git a/src/client.ts b/src/client.ts index 9da03de8e..5bc6ab071 100644 --- a/src/client.ts +++ b/src/client.ts @@ -20,8 +20,8 @@ limitations under the License. import { Optional } from "matrix-events-sdk"; -import type { IDeviceKeys, IMegolmSessionData, IOneTimeKey } from "./@types/crypto"; -import { ISyncStateData, SetPresence, SyncApi, SyncApiOptions, SyncState } from "./sync"; +import type { IDeviceKeys, IMegolmSessionData, IOneTimeKey } from "./@types/crypto.ts"; +import { ISyncStateData, SetPresence, SyncApi, SyncApiOptions, SyncState } from "./sync.ts"; import { EventStatus, IContent, @@ -31,29 +31,29 @@ import { MatrixEventEvent, MatrixEventHandlerMap, PushDetails, -} from "./models/event"; -import { StubStore } from "./store/stub"; -import { CallEvent, CallEventHandlerMap, createNewMatrixCall, MatrixCall, supportsMatrixCall } from "./webrtc/call"; -import { Filter, IFilterDefinition, IRoomEventFilter } from "./filter"; -import { CallEventHandler, CallEventHandlerEvent, CallEventHandlerEventHandlerMap } from "./webrtc/callEventHandler"; +} 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 { GroupCallEventHandler, GroupCallEventHandlerEvent, GroupCallEventHandlerEventHandlerMap, -} from "./webrtc/groupCallEventHandler"; -import * as utils from "./utils"; -import { noUnsafeEventProps, QueryDict, replaceParam, safeSet, sleep } from "./utils"; -import { Direction, EventTimeline } from "./models/event-timeline"; -import { IActionsObject, PushProcessor } from "./pushprocessor"; -import { AutoDiscovery, AutoDiscoveryAction } from "./autodiscovery"; -import * as olmlib from "./crypto/olmlib"; -import { decodeBase64, encodeBase64, encodeUnpaddedBase64Url } from "./base64"; -import { IExportedDevice as IExportedOlmDevice } from "./crypto/OlmDevice"; -import { IOlmDevice } from "./crypto/algorithms/megolm"; -import { TypedReEmitter } from "./ReEmitter"; -import { IRoomEncryption } from "./crypto/RoomList"; -import { logger, Logger } from "./logger"; -import { SERVICE_TYPES } from "./service-types"; +} from "./webrtc/groupCallEventHandler.ts"; +import * as utils from "./utils.ts"; +import { noUnsafeEventProps, 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 * as olmlib from "./crypto/olmlib.ts"; +import { decodeBase64, encodeBase64, encodeUnpaddedBase64Url } from "./base64.ts"; +import { IExportedDevice as IExportedOlmDevice } from "./crypto/OlmDevice.ts"; +import { IOlmDevice } from "./crypto/algorithms/megolm.ts"; +import { TypedReEmitter } from "./ReEmitter.ts"; +import { IRoomEncryption } from "./crypto/RoomList.ts"; +import { logger, Logger } from "./logger.ts"; +import { SERVICE_TYPES } from "./service-types.ts"; import { Body, ClientPrefix, @@ -73,7 +73,7 @@ import { Upload, UploadOpts, UploadResponse, -} from "./http-api"; +} from "./http-api/index.ts"; import { Crypto, CryptoEvent, @@ -83,14 +83,14 @@ import { ICryptoCallbacks, IRoomKeyRequestBody, isCryptoAvailable, -} from "./crypto"; -import { DeviceInfo } from "./crypto/deviceinfo"; -import { decodeRecoveryKey } from "./crypto/recoverykey"; -import { keyFromAuthData } from "./crypto/key_passphrase"; -import { User, UserEvent, UserEventHandlerMap } from "./models/user"; -import { getHttpUriForMxc } from "./content-repo"; -import { SearchResult } from "./models/search-result"; -import { DEHYDRATION_ALGORITHM, IDehydratedDevice, IDehydratedDeviceKeyInfo } from "./crypto/dehydration"; +} from "./crypto/index.ts"; +import { DeviceInfo } from "./crypto/deviceinfo.ts"; +import { decodeRecoveryKey } from "./crypto/recoverykey.ts"; +import { keyFromAuthData } from "./crypto/key_passphrase.ts"; +import { User, UserEvent, 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 { IKeyBackupInfo, IKeyBackupPrepareOpts, @@ -98,21 +98,21 @@ import { IKeyBackupRestoreResult, IKeyBackupRoomSessions, IKeyBackupSession, -} from "./crypto/keybackup"; -import { IIdentityServerProvider } from "./@types/IIdentityServerProvider"; -import { MatrixScheduler } from "./scheduler"; -import { BeaconEvent, BeaconEventHandlerMap } from "./models/beacon"; -import { AuthDict } from "./interactive-auth"; -import { IMinimalEvent, IRoomEvent, IStateEvent } from "./sync-accumulator"; -import { CrossSigningKey, ICreateSecretStorageOpts, IEncryptedEventInfo, IRecoveryKey } from "./crypto/api"; -import { EventTimelineSet } from "./models/event-timeline-set"; -import { VerificationRequest } from "./crypto/verification/request/VerificationRequest"; -import { VerificationBase as Verification } from "./crypto/verification/Base"; -import * as ContentHelpers from "./content-helpers"; -import { CrossSigningInfo, DeviceTrustLevel, ICacheCallbacks, UserTrustLevel } from "./crypto/CrossSigning"; -import { NotificationCountType, Room, RoomEvent, RoomEventHandlerMap, RoomNameState } from "./models/room"; -import { RoomMemberEvent, RoomMemberEventHandlerMap } from "./models/room-member"; -import { IPowerLevelsContent, RoomStateEvent, RoomStateEventHandlerMap } from "./models/room-state"; +} 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 { DelayedEventInfo, IAddThreePidOnlyBody, @@ -138,7 +138,7 @@ import { SendDelayedEventRequestOpts, SendDelayedEventResponse, UpdateDelayedEventAction, -} from "./@types/requests"; +} from "./@types/requests.ts"; import { EventType, LOCAL_NOTIFICATION_SETTINGS_PREFIX, @@ -153,15 +153,22 @@ import { UNSTABLE_MSC3088_ENABLED, UNSTABLE_MSC3088_PURPOSE, UNSTABLE_MSC3089_TREE_SUBTYPE, -} from "./@types/event"; -import { GuestAccess, HistoryVisibility, IdServerUnbindResult, JoinRule, Preset, Visibility } from "./@types/partials"; -import { EventMapper, eventMapperFor, MapperOpts } from "./event-mapper"; -import { randomString } from "./randomstring"; -import { BackupManager, IKeyBackup, IKeyBackupCheck, IPreparedKeyBackupVersion, TrustInfo } from "./crypto/backup"; -import { DEFAULT_TREE_POWER_LEVELS_TEMPLATE, MSC3089TreeSpace } from "./models/MSC3089TreeSpace"; -import { ISignatures } from "./@types/signed"; -import { IStore } from "./store"; -import { ISecretRequest } from "./crypto/SecretStorage"; +} from "./@types/event.ts"; +import { + GuestAccess, + HistoryVisibility, + IdServerUnbindResult, + JoinRule, + Preset, + Visibility, +} from "./@types/partials.ts"; +import { EventMapper, eventMapperFor, MapperOpts } from "./event-mapper.ts"; +import { randomString } 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, @@ -169,9 +176,9 @@ import { ISearchResults, IStateEventWithRoomId, SearchOrderBy, -} from "./@types/search"; -import { ISynapseAdminDeactivateResponse, ISynapseAdminWhoisResponse } from "./@types/synapse"; -import { IHierarchyRoom } from "./@types/spaces"; +} from "./@types/search.ts"; +import { ISynapseAdminDeactivateResponse, ISynapseAdminWhoisResponse } from "./@types/synapse.ts"; +import { IHierarchyRoom } from "./@types/spaces.ts"; import { IPusher, IPusherRequest, @@ -181,11 +188,11 @@ import { PushRuleActionName, PushRuleKind, RuleId, -} from "./@types/PushRules"; -import { IThreepid } from "./@types/threepids"; -import { CryptoStore, OutgoingRoomKeyRequest } from "./crypto/store/base"; -import { GroupCall, GroupCallIntent, GroupCallType, IGroupCallDataChannelOptions } from "./webrtc/groupCall"; -import { MediaHandler } from "./webrtc/mediaHandler"; +} 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 { MediaHandler } from "./webrtc/mediaHandler.ts"; import { ILoginFlowsResponse, IRefreshTokenResponse, @@ -193,11 +200,11 @@ import { LoginResponse, LoginTokenPostResponse, SSOAction, -} from "./@types/auth"; -import { TypedEventEmitter } from "./models/typed-event-emitter"; -import { MAIN_ROOM_TIMELINE, ReceiptType } from "./@types/read_receipts"; -import { MSC3575SlidingSyncRequest, MSC3575SlidingSyncResponse, SlidingSync } from "./sliding-sync"; -import { SlidingSyncSdk } from "./sliding-sync-sdk"; +} 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 { SlidingSyncSdk } from "./sliding-sync-sdk.ts"; import { determineFeatureSupport, FeatureSupport, @@ -205,33 +212,33 @@ import { THREAD_RELATION_TYPE, ThreadFilterType, threadFilterTypeToFilter, -} from "./models/thread"; -import { M_BEACON_INFO, MBeaconInfoEventContent } from "./@types/beacon"; -import { NamespacedValue, UnstableValue } from "./NamespacedValue"; -import { ToDeviceMessageQueue } from "./ToDeviceMessageQueue"; -import { ToDeviceBatch } from "./models/ToDeviceMessage"; -import { IgnoredInvites } from "./models/invites-ignorer"; -import { UIARequest, UIAResponse } from "./@types/uia"; -import { LocalNotificationSettings } from "./@types/local_notifications"; -import { buildFeatureSupportMap, Feature, ServerSupport } from "./feature"; -import { BackupDecryptor, CryptoBackend } from "./common-crypto/CryptoBackend"; -import { RUST_SDK_STORE_PREFIX } from "./rust-crypto/constants"; -import { BootstrapCrossSigningOpts, CrossSigningKeyInfo, CryptoApi, ImportRoomKeysOpts } from "./crypto-api"; -import { DeviceInfoMap } from "./crypto/DeviceList"; +} from "./models/thread.ts"; +import { M_BEACON_INFO, MBeaconInfoEventContent } from "./@types/beacon.ts"; +import { NamespacedValue, UnstableValue } from "./NamespacedValue.ts"; +import { ToDeviceMessageQueue } from "./ToDeviceMessageQueue.ts"; +import { 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 { buildFeatureSupportMap, Feature, ServerSupport } from "./feature.ts"; +import { BackupDecryptor, CryptoBackend } from "./common-crypto/CryptoBackend.ts"; +import { RUST_SDK_STORE_PREFIX } from "./rust-crypto/constants.ts"; +import { BootstrapCrossSigningOpts, CrossSigningKeyInfo, CryptoApi, ImportRoomKeysOpts } from "./crypto-api/index.ts"; +import { DeviceInfoMap } from "./crypto/DeviceList.ts"; import { AddSecretStorageKeyOpts, SecretStorageKeyDescription, ServerSideSecretStorage, ServerSideSecretStorageImpl, -} from "./secret-storage"; -import { RegisterRequest, RegisterResponse } from "./@types/registration"; -import { MatrixRTCSessionManager } from "./matrixrtc/MatrixRTCSessionManager"; -import { getRelationsThreadFilter } from "./thread-utils"; -import { KnownMembership, Membership } from "./@types/membership"; -import { RoomMessageEventContent, StickerEventContent } from "./@types/events"; -import { ImageInfo } from "./@types/media"; -import { Capabilities, ServerCapabilities } from "./serverCapabilities"; -import { sha256 } from "./digest"; +} from "./secret-storage.ts"; +import { RegisterRequest, 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 { sha256 } from "./digest.ts"; export type Store = IStore; diff --git a/src/common-crypto/CryptoBackend.ts b/src/common-crypto/CryptoBackend.ts index 7a36dc560..bbd6e5ec6 100644 --- a/src/common-crypto/CryptoBackend.ts +++ b/src/common-crypto/CryptoBackend.ts @@ -14,14 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -import type { IDeviceLists, IToDeviceEvent } from "../sync-accumulator"; -import { IClearEvent, MatrixEvent } from "../models/event"; -import { Room } from "../models/room"; -import { CryptoApi, DecryptionFailureCode, ImportRoomKeysOpts } from "../crypto-api"; -import { CrossSigningInfo, UserTrustLevel } from "../crypto/CrossSigning"; -import { IEncryptedEventInfo } from "../crypto/api"; -import { KeyBackupInfo, KeyBackupSession } from "../crypto-api/keybackup"; -import { IMegolmSessionData } from "../@types/crypto"; +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"; /** * Common interface for the crypto implementations diff --git a/src/content-helpers.ts b/src/content-helpers.ts index 3f611e369..ce8b373d9 100644 --- a/src/content-helpers.ts +++ b/src/content-helpers.ts @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MBeaconEventContent, MBeaconInfoContent, MBeaconInfoEventContent } from "./@types/beacon"; -import { MsgType } from "./@types/event"; -import { M_TEXT, REFERENCE_RELATION } from "./@types/extensible_events"; -import { isProvided } from "./extensible_events_v1/utilities"; +import { MBeaconEventContent, MBeaconInfoContent, 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"; import { M_ASSET, LocationAssetType, @@ -28,9 +28,9 @@ import { MLocationContent, MAssetContent, LegacyLocationEventContent, -} from "./@types/location"; -import { MRoomTopicEventContent, MTopicContent, M_TOPIC } from "./@types/topic"; -import { RoomMessageEventContent } from "./@types/events"; +} from "./@types/location.ts"; +import { MRoomTopicEventContent, MTopicContent, M_TOPIC } from "./@types/topic.ts"; +import { RoomMessageEventContent } from "./@types/events.ts"; /** * Generates the content for a HTML Message event diff --git a/src/content-repo.ts b/src/content-repo.ts index b127f6d2b..b6174b6d8 100644 --- a/src/content-repo.ts +++ b/src/content-repo.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { encodeParams } from "./utils"; +import { encodeParams } from "./utils.ts"; /** * Get the HTTP URL for an MXC URI. diff --git a/src/crypto-api/index.ts b/src/crypto-api/index.ts index 0c3e6cdb8..6b9db3811 100644 --- a/src/crypto-api/index.ts +++ b/src/crypto-api/index.ts @@ -15,15 +15,15 @@ limitations under the License. */ import type { SecretsBundle } from "@matrix-org/matrix-sdk-crypto-wasm"; -import type { IMegolmSessionData } from "../@types/crypto"; -import { Room } from "../models/room"; -import { DeviceMap } from "../models/device"; -import { UIAuthCallback } from "../interactive-auth"; -import { PassphraseInfo, SecretStorageCallbacks, SecretStorageKeyDescription } from "../secret-storage"; -import { VerificationRequest } from "./verification"; -import { BackupTrustInfo, KeyBackupCheck, KeyBackupInfo } from "./keybackup"; -import { ISignatures } from "../@types/signed"; -import { MatrixEvent } from "../models/event"; +import type { IMegolmSessionData } from "../@types/crypto.ts"; +import { Room } from "../models/room.ts"; +import { DeviceMap } from "../models/device.ts"; +import { UIAuthCallback } from "../interactive-auth.ts"; +import { PassphraseInfo, SecretStorageCallbacks, SecretStorageKeyDescription } from "../secret-storage.ts"; +import { VerificationRequest } from "./verification.ts"; +import { BackupTrustInfo, KeyBackupCheck, KeyBackupInfo } from "./keybackup.ts"; +import { ISignatures } from "../@types/signed.ts"; +import { MatrixEvent } from "../models/event.ts"; /** * Public interface to the cryptography parts of the js-sdk @@ -965,5 +965,5 @@ export interface OwnDeviceKeys { curve25519: string; } -export * from "./verification"; -export * from "./keybackup"; +export * from "./verification.ts"; +export * from "./keybackup.ts"; diff --git a/src/crypto-api/keybackup.ts b/src/crypto-api/keybackup.ts index 71c47d683..3209de6c3 100644 --- a/src/crypto-api/keybackup.ts +++ b/src/crypto-api/keybackup.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { ISigned } from "../@types/signed"; -import { IEncryptedPayload } from "../crypto/aes"; +import { ISigned } from "../@types/signed.ts"; +import { IEncryptedPayload } from "../crypto/aes.ts"; export interface Curve25519AuthData { public_key: string; diff --git a/src/crypto-api/verification.ts b/src/crypto-api/verification.ts index dd42dc35c..daa7bdbce 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"; -import { TypedEventEmitter } from "../models/typed-event-emitter"; +import { MatrixEvent } from "../models/event.ts"; +import { 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 95d20da05..a4caf1c53 100644 --- a/src/crypto/CrossSigning.ts +++ b/src/crypto/CrossSigning.ts @@ -19,19 +19,23 @@ limitations under the License. */ import type { PkSigning } from "@matrix-org/olm"; -import { IObject, pkSign, pkVerify } from "./olmlib"; -import { logger } from "../logger"; -import { IndexedDBCryptoStore } from "../crypto/store/indexeddb-crypto-store"; -import { decryptAES, encryptAES } from "./aes"; -import { DeviceInfo } from "./deviceinfo"; -import { ISignedKey, MatrixClient } from "../client"; -import { OlmDevice } from "./OlmDevice"; -import { ICryptoCallbacks } from "."; -import { ISignatures } from "../@types/signed"; -import { CryptoStore, SecretStorePrivateKeys } from "./store/base"; -import { ServerSideSecretStorage, SecretStorageKeyDescription } from "../secret-storage"; -import { CrossSigningKeyInfo, DeviceVerificationStatus, UserVerificationStatus as UserTrustLevel } from "../crypto-api"; -import { decodeBase64, encodeBase64 } from "../base64"; +import { IObject, pkSign, pkVerify } from "./olmlib.ts"; +import { logger } from "../logger.ts"; +import { IndexedDBCryptoStore } from "../crypto/store/indexeddb-crypto-store.ts"; +import { decryptAES, encryptAES } from "./aes.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 { + CrossSigningKeyInfo, + DeviceVerificationStatus, + UserVerificationStatus as UserTrustLevel, +} from "../crypto-api/index.ts"; +import { decodeBase64, encodeBase64 } from "../base64.ts"; // backwards-compatibility re-exports export { UserTrustLevel }; diff --git a/src/crypto/DeviceList.ts b/src/crypto/DeviceList.ts index 8ad383189..320ea6a26 100644 --- a/src/crypto/DeviceList.ts +++ b/src/crypto/DeviceList.ts @@ -18,17 +18,17 @@ limitations under the License. * Manages the list of other users' devices */ -import { logger } from "../logger"; -import { DeviceInfo, IDevice } from "./deviceinfo"; -import { CrossSigningInfo, ICrossSigningInfo } from "./CrossSigning"; -import * as olmlib from "./olmlib"; -import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store"; -import { chunkPromises, defer, IDeferred, sleep } from "../utils"; -import { DeviceKeys, IDownloadKeyResult, Keys, MatrixClient, SigningKeys } from "../client"; -import { OlmDevice } from "./OlmDevice"; -import { CryptoStore } from "./store/base"; -import { TypedEventEmitter } from "../models/typed-event-emitter"; -import { CryptoEvent, CryptoEventHandlerMap } from "./index"; +import { logger } from "../logger.ts"; +import { DeviceInfo, IDevice } from "./deviceinfo.ts"; +import { CrossSigningInfo, 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 { TypedEventEmitter } from "../models/typed-event-emitter.ts"; +import { CryptoEvent, CryptoEventHandlerMap } from "./index.ts"; /* State transition diagram for DeviceList.deviceTrackingStatus * diff --git a/src/crypto/EncryptionSetup.ts b/src/crypto/EncryptionSetup.ts index b7015b5a0..dab5d5606 100644 --- a/src/crypto/EncryptionSetup.ts +++ b/src/crypto/EncryptionSetup.ts @@ -14,17 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { logger } from "../logger"; -import { MatrixEvent } from "../models/event"; -import { createCryptoStoreCacheCallbacks, ICacheCallbacks } from "./CrossSigning"; -import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store"; -import { Method, ClientPrefix } from "../http-api"; -import { Crypto, ICryptoCallbacks } from "./index"; -import { ClientEvent, ClientEventHandlerMap, CrossSigningKeys, ISignedKey, KeySignatures } from "../client"; -import { IKeyBackupInfo } from "./keybackup"; -import { TypedEventEmitter } from "../models/typed-event-emitter"; -import { AccountDataClient, SecretStorageKeyDescription } from "../secret-storage"; -import { BootstrapCrossSigningOpts, CrossSigningKeyInfo } from "../crypto-api"; +import { logger } from "../logger.ts"; +import { MatrixEvent } from "../models/event.ts"; +import { createCryptoStoreCacheCallbacks, 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 { TypedEventEmitter } from "../models/typed-event-emitter.ts"; +import { AccountDataClient, SecretStorageKeyDescription } from "../secret-storage.ts"; +import { BootstrapCrossSigningOpts, CrossSigningKeyInfo } from "../crypto-api/index.ts"; interface ICrossSigningKeys { authUpload: BootstrapCrossSigningOpts["authUploadDeviceSigningKeys"]; diff --git a/src/crypto/OlmDevice.ts b/src/crypto/OlmDevice.ts index 17783af0b..1006bf0de 100644 --- a/src/crypto/OlmDevice.ts +++ b/src/crypto/OlmDevice.ts @@ -16,14 +16,14 @@ limitations under the License. import { Account, InboundGroupSession, OutboundGroupSession, Session, Utility } from "@matrix-org/olm"; -import { logger, Logger } from "../logger"; -import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store"; -import { CryptoStore, IProblem, ISessionInfo, IWithheld } from "./store/base"; -import { IOlmDevice, IOutboundGroupSessionKey } from "./algorithms/megolm"; -import { IMegolmSessionData, OlmGroupSessionExtraData } from "../@types/crypto"; -import { IMessage } from "./algorithms/olm"; -import { DecryptionFailureCode } from "../crypto-api"; -import { DecryptionError } from "../common-crypto/CryptoBackend"; +import { logger, 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 { DecryptionFailureCode } from "../crypto-api/index.ts"; +import { DecryptionError } from "../common-crypto/CryptoBackend.ts"; // The maximum size of an event is 65K, and we base64 the content, so this is a // reasonable approximation to the biggest plaintext we can encrypt. diff --git a/src/crypto/OutgoingRoomKeyRequestManager.ts b/src/crypto/OutgoingRoomKeyRequestManager.ts index 4628b3e8d..4f3cf2534 100644 --- a/src/crypto/OutgoingRoomKeyRequestManager.ts +++ b/src/crypto/OutgoingRoomKeyRequestManager.ts @@ -16,12 +16,12 @@ limitations under the License. import { v4 as uuidv4 } from "uuid"; -import { logger } from "../logger"; -import { MatrixClient } from "../client"; -import { IRoomKeyRequestBody, IRoomKeyRequestRecipient } from "./index"; -import { CryptoStore, OutgoingRoomKeyRequest } from "./store/base"; -import { EventType, ToDeviceMessageId } from "../@types/event"; -import { MapWithDefault } from "../utils"; +import { logger } from "../logger.ts"; +import { MatrixClient } from "../client.ts"; +import { IRoomKeyRequestBody, IRoomKeyRequestRecipient } from "./index.ts"; +import { CryptoStore, OutgoingRoomKeyRequest } from "./store/base.ts"; +import { EventType, ToDeviceMessageId } from "../@types/event.ts"; +import { MapWithDefault } from "../utils.ts"; /** * Internal module. Management of outgoing room key requests. diff --git a/src/crypto/RoomList.ts b/src/crypto/RoomList.ts index b100bd302..75573d640 100644 --- a/src/crypto/RoomList.ts +++ b/src/crypto/RoomList.ts @@ -18,8 +18,8 @@ limitations under the License. * Manages the list of encrypted rooms */ -import { CryptoStore } from "./store/base"; -import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store"; +import { CryptoStore } from "./store/base.ts"; +import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store.ts"; /* eslint-disable camelcase */ export interface IRoomEncryption { diff --git a/src/crypto/SecretSharing.ts b/src/crypto/SecretSharing.ts index 5083a8c24..11def7371 100644 --- a/src/crypto/SecretSharing.ts +++ b/src/crypto/SecretSharing.ts @@ -15,13 +15,13 @@ limitations under the License. */ import { v4 as uuidv4 } from "uuid"; -import { MatrixClient } from "../client"; -import { ICryptoCallbacks, IEncryptedContent } from "./index"; -import { defer, IDeferred } from "../utils"; -import { ToDeviceMessageId } from "../@types/event"; -import { logger } from "../logger"; -import { MatrixEvent } from "../models/event"; -import * as olmlib from "./olmlib"; +import { MatrixClient } from "../client.ts"; +import { ICryptoCallbacks, IEncryptedContent } from "./index.ts"; +import { defer, IDeferred } from "../utils.ts"; +import { ToDeviceMessageId } from "../@types/event.ts"; +import { logger } from "../logger.ts"; +import { MatrixEvent } from "../models/event.ts"; +import * as olmlib from "./olmlib.ts"; export interface ISecretRequest { requestId: string; diff --git a/src/crypto/SecretStorage.ts b/src/crypto/SecretStorage.ts index 452d1fde9..6bd653dd0 100644 --- a/src/crypto/SecretStorage.ts +++ b/src/crypto/SecretStorage.ts @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { ICryptoCallbacks } from "."; -import { MatrixEvent } from "../models/event"; -import { MatrixClient } from "../client"; +import { ICryptoCallbacks } from "./index.ts"; +import { MatrixEvent } from "../models/event.ts"; +import { MatrixClient } from "../client.ts"; import { SecretStorageKeyDescription, SecretStorageKeyTuple, @@ -25,8 +25,8 @@ import { AccountDataClient, ServerSideSecretStorage, ServerSideSecretStorageImpl, -} from "../secret-storage"; -import { ISecretRequest, SecretSharing } from "./SecretSharing"; +} from "../secret-storage.ts"; +import { ISecretRequest, SecretSharing } from "./SecretSharing.ts"; /* re-exports for backwards compatibility */ export type { @@ -34,9 +34,9 @@ export type { SecretStorageKeyTuple, SecretStorageKeyObject, SECRET_STORAGE_ALGORITHM_V1_AES, -} from "../secret-storage"; +} from "../secret-storage.ts"; -export type { ISecretRequest } from "./SecretSharing"; +export type { ISecretRequest } from "./SecretSharing.ts"; /** * Implements Secure Secret Storage and Sharing (MSC1946) diff --git a/src/crypto/aes.ts b/src/crypto/aes.ts index e6b6e2a81..6c6779d06 100644 --- a/src/crypto/aes.ts +++ b/src/crypto/aes.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { decodeBase64, encodeBase64 } from "../base64"; +import { decodeBase64, encodeBase64 } from "../base64.ts"; // salt for HKDF, with 8 bytes of zeros const zeroSalt = new Uint8Array(8); diff --git a/src/crypto/algorithms/base.ts b/src/crypto/algorithms/base.ts index 2dda6e91e..9b0384261 100644 --- a/src/crypto/algorithms/base.ts +++ b/src/crypto/algorithms/base.ts @@ -18,15 +18,15 @@ limitations under the License. * Internal module. Defines the base classes of the encryption implementations */ -import type { IMegolmSessionData } from "../../@types/crypto"; -import { MatrixClient } from "../../client"; -import { Room } from "../../models/room"; -import { OlmDevice } from "../OlmDevice"; -import { IContent, MatrixEvent, RoomMember } from "../../matrix"; -import { Crypto, IEncryptedContent, IEventDecryptionResult, IncomingRoomKeyRequest } from ".."; -import { DeviceInfo } from "../deviceinfo"; -import { IRoomEncryption } from "../RoomList"; -import { DeviceInfoMap } from "../DeviceList"; +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"; /** * Map of registered encryption algorithm classes. A map from string to {@link EncryptionAlgorithm} class @@ -233,4 +233,4 @@ export function registerAlgorithm

( } /* Re-export for backwards compatibility. Deprecated: this is an internal class. */ -export { DecryptionError } from "../../common-crypto/CryptoBackend"; +export { DecryptionError } from "../../common-crypto/CryptoBackend.ts"; diff --git a/src/crypto/algorithms/index.ts b/src/crypto/algorithms/index.ts index b3c5b0ede..947c6e0ea 100644 --- a/src/crypto/algorithms/index.ts +++ b/src/crypto/algorithms/index.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import "./olm"; -import "./megolm"; +import "./olm.ts"; +import "./megolm.ts"; -export * from "./base"; +export * from "./base.ts"; diff --git a/src/crypto/algorithms/megolm.ts b/src/crypto/algorithms/megolm.ts index 5fa4a1b75..9fde8e5bc 100644 --- a/src/crypto/algorithms/megolm.ts +++ b/src/crypto/algorithms/megolm.ts @@ -20,9 +20,9 @@ limitations under the License. import { v4 as uuidv4 } from "uuid"; -import type { IEventDecryptionResult, IMegolmSessionData } from "../../@types/crypto"; -import { logger, Logger } from "../../logger"; -import * as olmlib from "../olmlib"; +import type { IEventDecryptionResult, IMegolmSessionData } from "../../@types/crypto.ts"; +import { logger, Logger } from "../../logger.ts"; +import * as olmlib from "../olmlib.ts"; import { DecryptionAlgorithm, DecryptionClassParams, @@ -30,22 +30,22 @@ import { IParams, registerAlgorithm, UnknownDeviceError, -} from "./base"; -import { IDecryptedGroupMessage, WITHHELD_MESSAGES } from "../OlmDevice"; -import { Room } from "../../models/room"; -import { DeviceInfo } from "../deviceinfo"; -import { IOlmSessionResult } from "../olmlib"; -import { DeviceInfoMap } from "../DeviceList"; -import { IContent, MatrixEvent } from "../../models/event"; -import { EventType, MsgType, ToDeviceMessageId } from "../../@types/event"; -import { IMegolmEncryptedContent, IncomingRoomKeyRequest, IEncryptedContent } from "../index"; -import { RoomKeyRequestState } from "../OutgoingRoomKeyRequestManager"; -import { OlmGroupSessionExtraData } from "../../@types/crypto"; -import { MatrixError } from "../../http-api"; -import { immediate, MapWithDefault } from "../../utils"; -import { KnownMembership } from "../../@types/membership"; -import { DecryptionFailureCode } from "../../crypto-api"; -import { DecryptionError } from "../../common-crypto/CryptoBackend"; +} 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 { EventType, MsgType, ToDeviceMessageId } from "../../@types/event.ts"; +import { IMegolmEncryptedContent, IncomingRoomKeyRequest, IEncryptedContent } from "../index.ts"; +import { RoomKeyRequestState } from "../OutgoingRoomKeyRequestManager.ts"; +import { OlmGroupSessionExtraData } from "../../@types/crypto.ts"; +import { 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"; +import { DecryptionError } from "../../common-crypto/CryptoBackend.ts"; // determine whether the key can be shared with invitees export function isRoomSharedHistory(room: Room): boolean { diff --git a/src/crypto/algorithms/olm.ts b/src/crypto/algorithms/olm.ts index 3bcff5872..eb93a06a1 100644 --- a/src/crypto/algorithms/olm.ts +++ b/src/crypto/algorithms/olm.ts @@ -18,17 +18,17 @@ limitations under the License. * Defines m.olm encryption/decryption */ -import type { IEventDecryptionResult } from "../../@types/crypto"; -import { logger } from "../../logger"; -import * as olmlib from "../olmlib"; -import { DeviceInfo } from "../deviceinfo"; -import { DecryptionAlgorithm, EncryptionAlgorithm, registerAlgorithm } from "./base"; -import { Room } from "../../models/room"; -import { IContent, MatrixEvent } from "../../models/event"; -import { IEncryptedContent, IOlmEncryptedContent } from "../index"; -import { IInboundSession } from "../OlmDevice"; -import { DecryptionFailureCode } from "../../crypto-api"; -import { DecryptionError } from "../../common-crypto/CryptoBackend"; +import type { IEventDecryptionResult } from "../../@types/crypto.ts"; +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 { DecryptionFailureCode } from "../../crypto-api/index.ts"; +import { DecryptionError } from "../../common-crypto/CryptoBackend.ts"; const DeviceVerification = DeviceInfo.DeviceVerification; diff --git a/src/crypto/api.ts b/src/crypto/api.ts index a0e11a415..0b5202777 100644 --- a/src/crypto/api.ts +++ b/src/crypto/api.ts @@ -14,26 +14,26 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { DeviceInfo } from "./deviceinfo"; +import { 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 -export { CrossSigningKey } from "../crypto-api"; +export { CrossSigningKey } from "../crypto-api/index.ts"; export type { GeneratedSecretStorageKey as IRecoveryKey, CreateSecretStorageOpts as ICreateSecretStorageOpts, -} from "../crypto-api"; +} from "../crypto-api/index.ts"; export type { ImportRoomKeyProgressData as IImportOpts, ImportRoomKeysOpts as IImportRoomKeysOpts, -} from "../crypto-api"; +} from "../crypto-api/index.ts"; export type { AddSecretStorageKeyOpts as IAddSecretStorageKeyOpts, PassphraseInfo as IPassphraseInfo, SecretStorageKeyDescription as ISecretStorageKeyInfo, -} from "../secret-storage"; +} from "../secret-storage.ts"; // TODO: Merge this with crypto.js once converted diff --git a/src/crypto/backup.ts b/src/crypto/backup.ts index cbbecbca3..3ac6a3ddc 100644 --- a/src/crypto/backup.ts +++ b/src/crypto/backup.ts @@ -18,29 +18,29 @@ limitations under the License. * Classes for dealing with key backup. */ -import type { IMegolmSessionData } from "../@types/crypto"; -import { MatrixClient } from "../client"; -import { logger } from "../logger"; -import { MEGOLM_ALGORITHM, verifySignature } from "./olmlib"; -import { DeviceInfo } from "./deviceinfo"; -import { DeviceTrustLevel } from "./CrossSigning"; -import { keyFromPassphrase } from "./key_passphrase"; -import { encodeUri, safeSet, sleep } from "../utils"; -import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store"; -import { encodeRecoveryKey } from "./recoverykey"; -import { calculateKeyCheck, decryptAES, encryptAES, IEncryptedPayload } from "./aes"; +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 { keyFromPassphrase } from "./key_passphrase.ts"; +import { encodeUri, safeSet, sleep } from "../utils.ts"; +import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store.ts"; +import { encodeRecoveryKey } from "./recoverykey.ts"; +import { calculateKeyCheck, decryptAES, encryptAES, IEncryptedPayload } from "./aes.ts"; import { Curve25519SessionData, IAes256AuthData, ICurve25519AuthData, IKeyBackupInfo, IKeyBackupSession, -} from "./keybackup"; -import { UnstableValue } from "../NamespacedValue"; -import { CryptoEvent } from "./index"; -import { ClientPrefix, HTTPError, MatrixError, Method } from "../http-api"; -import { BackupTrustInfo } from "../crypto-api/keybackup"; -import { BackupDecryptor } from "../common-crypto/CryptoBackend"; +} 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"; const KEY_BACKUP_KEYS_PER_REQUEST = 200; const KEY_BACKUP_CHECK_RATE_LIMIT = 5000; // ms diff --git a/src/crypto/dehydration.ts b/src/crypto/dehydration.ts index a24e65e45..01dafa83c 100644 --- a/src/crypto/dehydration.ts +++ b/src/crypto/dehydration.ts @@ -16,14 +16,14 @@ limitations under the License. import anotherjson from "another-json"; -import type { IDeviceKeys, IOneTimeKey } from "../@types/crypto"; -import { decodeBase64, encodeBase64 } from "../base64"; -import { IndexedDBCryptoStore } from "../crypto/store/indexeddb-crypto-store"; -import { decryptAES, encryptAES } from "./aes"; -import { logger } from "../logger"; -import { Crypto } from "./index"; -import { Method } from "../http-api"; -import { SecretStorageKeyDescription } from "../secret-storage"; +import type { IDeviceKeys, IOneTimeKey } from "../@types/crypto.ts"; +import { decodeBase64, encodeBase64 } from "../base64.ts"; +import { IndexedDBCryptoStore } from "../crypto/store/indexeddb-crypto-store.ts"; +import { decryptAES, encryptAES } from "./aes.ts"; +import { logger } from "../logger.ts"; +import { Crypto } from "./index.ts"; +import { Method } from "../http-api/index.ts"; +import { SecretStorageKeyDescription } from "../secret-storage.ts"; export interface IDehydratedDevice { device_id: string; // eslint-disable-line camelcase diff --git a/src/crypto/device-converter.ts b/src/crypto/device-converter.ts index cf32ef614..a2591150c 100644 --- a/src/crypto/device-converter.ts +++ b/src/crypto/device-converter.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Device } from "../models/device"; -import { DeviceInfo } from "./deviceinfo"; +import { Device } from "../models/device.ts"; +import { 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 8b41c3c67..7641af316 100644 --- a/src/crypto/deviceinfo.ts +++ b/src/crypto/deviceinfo.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { ISignatures } from "../@types/signed"; -import { DeviceVerification } from "../models/device"; +import { ISignatures } from "../@types/signed.ts"; +import { DeviceVerification } from "../models/device.ts"; export interface IDevice { keys: Record; diff --git a/src/crypto/index.ts b/src/crypto/index.ts index 07601b799..420160c0d 100644 --- a/src/crypto/index.ts +++ b/src/crypto/index.ts @@ -20,55 +20,60 @@ limitations under the License. import anotherjson from "another-json"; import { v4 as uuidv4 } from "uuid"; -import type { IDeviceKeys, IEventDecryptionResult, IMegolmSessionData, IOneTimeKey } from "../@types/crypto"; +import type { IDeviceKeys, IEventDecryptionResult, IMegolmSessionData, IOneTimeKey } from "../@types/crypto.ts"; import type { PkDecryption, PkSigning } from "@matrix-org/olm"; -import { EventType, ToDeviceMessageId } from "../@types/event"; -import { TypedReEmitter } from "../ReEmitter"; -import { logger } from "../logger"; -import { IExportedDevice, OlmDevice } from "./OlmDevice"; -import { IOlmDevice } from "./algorithms/megolm"; -import * as olmlib from "./olmlib"; -import { DeviceInfoMap, DeviceList } from "./DeviceList"; -import { DeviceInfo, IDevice } from "./deviceinfo"; -import type { DecryptionAlgorithm, EncryptionAlgorithm } from "./algorithms"; -import * as algorithms from "./algorithms"; -import { createCryptoStoreCacheCallbacks, CrossSigningInfo, DeviceTrustLevel, UserTrustLevel } from "./CrossSigning"; -import { EncryptionSetupBuilder } from "./EncryptionSetup"; -import { SecretStorage as LegacySecretStorage } from "./SecretStorage"; -import { CrossSigningKey, ICreateSecretStorageOpts, IEncryptedEventInfo, IRecoveryKey } from "./api"; -import { OutgoingRoomKeyRequestManager } from "./OutgoingRoomKeyRequestManager"; -import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store"; -import { VerificationBase } from "./verification/Base"; -import { ReciprocateQRCode, SCAN_QR_CODE_METHOD, SHOW_QR_CODE_METHOD } from "./verification/QRCode"; -import { SAS as SASVerification } from "./verification/SAS"; -import { keyFromPassphrase } from "./key_passphrase"; -import { decodeRecoveryKey, encodeRecoveryKey } from "./recoverykey"; -import { VerificationRequest } from "./verification/request/VerificationRequest"; -import { InRoomChannel, InRoomRequests } from "./verification/request/InRoomChannel"; -import { Request, ToDeviceChannel, ToDeviceRequests } from "./verification/request/ToDeviceChannel"; -import { IllegalMethod } from "./verification/IllegalMethod"; -import { KeySignatureUploadError } from "../errors"; -import { calculateKeyCheck, decryptAES, encryptAES, IEncryptedPayload } from "./aes"; -import { DehydrationManager } from "./dehydration"; -import { BackupManager, LibOlmBackupDecryptor, backupTrustInfoFromLegacyTrustInfo } from "./backup"; -import { IStore } from "../store"; -import { Room, RoomEvent } from "../models/room"; -import { RoomMember, RoomMemberEvent } from "../models/room-member"; -import { EventStatus, IContent, IEvent, MatrixEvent, MatrixEventEvent } from "../models/event"; -import { ToDeviceBatch } from "../models/ToDeviceMessage"; -import { ClientEvent, IKeysUploadResponse, ISignedKey, IUploadKeySignaturesResponse, MatrixClient } from "../client"; -import { IRoomEncryption, RoomList } from "./RoomList"; -import { IKeyBackupInfo } from "./keybackup"; -import { ISyncStateData } from "../sync"; -import { CryptoStore } from "./store/base"; -import { IVerificationChannel } from "./verification/request/Channel"; -import { TypedEventEmitter } from "../models/typed-event-emitter"; -import { IDeviceLists, ISyncResponse, IToDeviceEvent } from "../sync-accumulator"; -import { ISignatures } from "../@types/signed"; -import { IMessage } from "./algorithms/olm"; -import { BackupDecryptor, CryptoBackend, DecryptionError, OnSyncCompletedData } from "../common-crypto/CryptoBackend"; -import { RoomState, RoomStateEvent } from "../models/room-state"; -import { MapWithDefault, recursiveMapToObject } from "../utils"; +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 * as olmlib from "./olmlib.ts"; +import { DeviceInfoMap, DeviceList } from "./DeviceList.ts"; +import { DeviceInfo, 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 { OutgoingRoomKeyRequestManager } from "./OutgoingRoomKeyRequestManager.ts"; +import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store.ts"; +import { 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 { decodeRecoveryKey, encodeRecoveryKey } from "./recoverykey.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 { IllegalMethod } from "./verification/IllegalMethod.ts"; +import { KeySignatureUploadError } from "../errors.ts"; +import { calculateKeyCheck, decryptAES, encryptAES, IEncryptedPayload } from "./aes.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 } 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 { + BackupDecryptor, + CryptoBackend, + DecryptionError, + OnSyncCompletedData, +} from "../common-crypto/CryptoBackend.ts"; +import { RoomState, RoomStateEvent } from "../models/room-state.ts"; +import { MapWithDefault, recursiveMapToObject } from "../utils.ts"; import { AccountDataClient, AddSecretStorageKeyOpts, @@ -77,8 +82,8 @@ import { SecretStorageKeyObject, SecretStorageKeyTuple, ServerSideSecretStorageImpl, -} from "../secret-storage"; -import { ISecretRequest } from "./SecretSharing"; +} from "../secret-storage.ts"; +import { ISecretRequest } from "./SecretSharing.ts"; import { BackupTrustInfo, BootstrapCrossSigningOpts, @@ -94,18 +99,18 @@ import { KeyBackupInfo, OwnDeviceKeys, VerificationRequest as CryptoApiVerificationRequest, -} from "../crypto-api"; -import { Device, DeviceMap } from "../models/device"; -import { deviceInfoToDevice } from "./device-converter"; -import { ClientPrefix, MatrixError, Method } from "../http-api"; -import { decodeBase64, encodeBase64 } from "../base64"; -import { KnownMembership } from "../@types/membership"; +} from "../crypto-api/index.ts"; +import { Device, 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"; /* re-exports for backwards compatibility */ export type { BootstrapCrossSigningOpts as IBootstrapCrossSigningOpts, CryptoCallbacks as ICryptoCallbacks, -} from "../crypto-api"; +} from "../crypto-api/index.ts"; const DeviceVerification = DeviceInfo.DeviceVerification; @@ -4374,4 +4379,4 @@ class IncomingRoomKeyRequestCancellation { } // a number of types are re-exported for backwards compatibility, in case any applications are referencing it. -export type { IEventDecryptionResult, IMegolmSessionData } from "../@types/crypto"; +export type { IEventDecryptionResult, IMegolmSessionData } from "../@types/crypto.ts"; diff --git a/src/crypto/key_passphrase.ts b/src/crypto/key_passphrase.ts index c56c3ce2e..85b9c48fb 100644 --- a/src/crypto/key_passphrase.ts +++ b/src/crypto/key_passphrase.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { randomString } from "../randomstring"; +import { randomString } from "../randomstring.ts"; const DEFAULT_ITERATIONS = 500000; diff --git a/src/crypto/keybackup.ts b/src/crypto/keybackup.ts index 8ef04176c..4399a3860 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"; +import { ImportRoomKeyProgressData } from "../crypto-api/index.ts"; export type { Curve25519AuthData as ICurve25519AuthData, @@ -24,7 +24,7 @@ export type { Curve25519SessionData, KeyBackupSession as IKeyBackupSession, KeyBackupRoomSessions as IKeyBackupRoomSessions, -} from "../crypto-api/keybackup"; +} from "../crypto-api/keybackup.ts"; /* eslint-enable camelcase */ diff --git a/src/crypto/olmlib.ts b/src/crypto/olmlib.ts index 7396ef479..9eceaf48b 100644 --- a/src/crypto/olmlib.ts +++ b/src/crypto/olmlib.ts @@ -21,16 +21,16 @@ limitations under the License. import anotherjson from "another-json"; import type { PkSigning } from "@matrix-org/olm"; -import type { IOneTimeKey } from "../@types/crypto"; -import { OlmDevice } from "./OlmDevice"; -import { DeviceInfo } from "./deviceinfo"; -import { Logger, logger } from "../logger"; -import { IClaimOTKsResult, MatrixClient } from "../client"; -import { ISignatures } from "../@types/signed"; -import { MatrixEvent } from "../models/event"; -import { EventType } from "../@types/event"; -import { IMessage } from "./algorithms/olm"; -import { MapWithDefault } from "../utils"; +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 { EventType } from "../@types/event.ts"; +import { IMessage } from "./algorithms/olm.ts"; +import { MapWithDefault } from "../utils.ts"; enum Algorithm { Olm = "m.olm.v1.curve25519-aes-sha2", diff --git a/src/crypto/store/base.ts b/src/crypto/store/base.ts index 871804b73..daf11b5b0 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"; -import { RoomKeyRequestState } from "../OutgoingRoomKeyRequestManager"; -import { IOlmDevice } from "../algorithms/megolm"; -import { TrackingStatus } from "../DeviceList"; -import { IRoomEncryption } from "../RoomList"; -import { IDevice } from "../deviceinfo"; -import { ICrossSigningInfo } from "../CrossSigning"; -import { Logger } from "../../logger"; -import { InboundGroupSessionData } from "../OlmDevice"; -import { MatrixEvent } from "../../models/event"; -import { DehydrationManager } from "../dehydration"; -import { IEncryptedPayload } from "../aes"; -import { CrossSigningKeyInfo } from "../../crypto-api"; +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 { IEncryptedPayload } from "../aes.ts"; +import { CrossSigningKeyInfo } from "../../crypto-api/index.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 08d4c0f6e..1ef3dd120 100644 --- a/src/crypto/store/indexeddb-crypto-store-backend.ts +++ b/src/crypto/store/indexeddb-crypto-store-backend.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Logger, logger } from "../../logger"; -import { deepCompare } from "../../utils"; +import { Logger, logger } from "../../logger.ts"; +import { deepCompare } from "../../utils.ts"; import { CryptoStore, IDeviceData, @@ -31,13 +31,13 @@ import { SecretStorePrivateKeys, SESSION_BATCH_SIZE, ACCOUNT_OBJECT_KEY_MIGRATION_STATE, -} from "./base"; -import { IRoomKeyRequestBody, IRoomKeyRequestRecipient } from "../index"; -import { IOlmDevice } from "../algorithms/megolm"; -import { IRoomEncryption } from "../RoomList"; -import { InboundGroupSessionData } from "../OlmDevice"; -import { IndexedDBCryptoStore } from "./indexeddb-crypto-store"; -import { CrossSigningKeyInfo } from "../../crypto-api"; +} 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 { IndexedDBCryptoStore } from "./indexeddb-crypto-store.ts"; +import { 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 8fe488e08..29d32b5e3 100644 --- a/src/crypto/store/indexeddb-crypto-store.ts +++ b/src/crypto/store/indexeddb-crypto-store.ts @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { logger, Logger } from "../../logger"; -import { LocalStorageCryptoStore } from "./localStorage-crypto-store"; -import { MemoryCryptoStore } from "./memory-crypto-store"; -import * as IndexedDBCryptoStoreBackend from "./indexeddb-crypto-store-backend"; -import { InvalidCryptoStoreError, InvalidCryptoStoreState } from "../../errors"; -import * as IndexedDBHelpers from "../../indexeddb-helpers"; +import { logger, 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, @@ -34,12 +34,12 @@ import { ParkedSharedHistory, SecretStorePrivateKeys, ACCOUNT_OBJECT_KEY_MIGRATION_STATE, -} from "./base"; -import { IRoomKeyRequestBody } from "../index"; -import { IOlmDevice } from "../algorithms/megolm"; -import { IRoomEncryption } from "../RoomList"; -import { InboundGroupSessionData } from "../OlmDevice"; -import { CrossSigningKeyInfo } from "../../crypto-api"; +} 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"; /* * 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 41821ec62..d24e648d6 100644 --- a/src/crypto/store/localStorage-crypto-store.ts +++ b/src/crypto/store/localStorage-crypto-store.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { logger } from "../../logger"; -import { MemoryCryptoStore } from "./memory-crypto-store"; +import { logger } from "../../logger.ts"; +import { MemoryCryptoStore } from "./memory-crypto-store.ts"; import { CryptoStore, IDeviceData, @@ -28,12 +28,12 @@ import { Mode, SecretStorePrivateKeys, SESSION_BATCH_SIZE, -} from "./base"; -import { IOlmDevice } from "../algorithms/megolm"; -import { IRoomEncryption } from "../RoomList"; -import { InboundGroupSessionData } from "../OlmDevice"; -import { safeSet } from "../../utils"; -import { CrossSigningKeyInfo } from "../../crypto-api"; +} from "./base.ts"; +import { IOlmDevice } from "../algorithms/megolm.ts"; +import { IRoomEncryption } from "../RoomList.ts"; +import { InboundGroupSessionData } from "../OlmDevice.ts"; +import { safeSet } from "../../utils.ts"; +import { 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 4fd8a57f8..65fca29d7 100644 --- a/src/crypto/store/memory-crypto-store.ts +++ b/src/crypto/store/memory-crypto-store.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { logger } from "../../logger"; -import { deepCompare, promiseTry, safeSet } from "../../utils"; +import { logger } from "../../logger.ts"; +import { deepCompare, promiseTry, safeSet } from "../../utils.ts"; import { CryptoStore, IDeviceData, @@ -30,12 +30,12 @@ import { ParkedSharedHistory, SecretStorePrivateKeys, SESSION_BATCH_SIZE, -} from "./base"; -import { IRoomKeyRequestBody } from "../index"; -import { IOlmDevice } from "../algorithms/megolm"; -import { IRoomEncryption } from "../RoomList"; -import { InboundGroupSessionData } from "../OlmDevice"; -import { CrossSigningKeyInfo } from "../../crypto-api"; +} 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"; 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 308ea4401..179c868b6 100644 --- a/src/crypto/verification/Base.ts +++ b/src/crypto/verification/Base.ts @@ -19,23 +19,23 @@ limitations under the License. * Base class for verification methods. */ -import { MatrixEvent } from "../../models/event"; -import { EventType } from "../../@types/event"; -import { logger } from "../../logger"; -import { DeviceInfo } from "../deviceinfo"; -import { newTimeoutError } from "./Error"; -import { KeysDuringVerification, requestKeysDuringVerification } from "../CrossSigning"; -import { IVerificationChannel } from "./request/Channel"; -import { MatrixClient } from "../../client"; -import { VerificationRequest } from "./request/VerificationRequest"; -import { TypedEventEmitter } from "../../models/typed-event-emitter"; +import { MatrixEvent } from "../../models/event.ts"; +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 { TypedEventEmitter } from "../../models/typed-event-emitter.ts"; import { ShowQrCodeCallbacks, ShowSasCallbacks, Verifier, VerifierEvent, VerifierEventHandlerMap, -} from "../../crypto-api/verification"; +} from "../../crypto-api/verification.ts"; const timeoutException = new Error("Verification timed out"); diff --git a/src/crypto/verification/Error.ts b/src/crypto/verification/Error.ts index da73ebb84..4f609db3a 100644 --- a/src/crypto/verification/Error.ts +++ b/src/crypto/verification/Error.ts @@ -18,8 +18,8 @@ limitations under the License. * Error messages. */ -import { MatrixEvent } from "../../models/event"; -import { EventType } from "../../@types/event"; +import { MatrixEvent } from "../../models/event.ts"; +import { EventType } from "../../@types/event.ts"; export function newVerificationError(code: string, reason: string, extraData?: Record): MatrixEvent { const content = Object.assign({}, { code, reason }, extraData); diff --git a/src/crypto/verification/IllegalMethod.ts b/src/crypto/verification/IllegalMethod.ts index c437e0cd2..c556be717 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"; -import { IVerificationChannel } from "./request/Channel"; -import { MatrixClient } from "../../client"; -import { MatrixEvent } from "../../models/event"; -import { VerificationRequest } from "./request/VerificationRequest"; +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"; export class IllegalMethod extends Base { public static factory( diff --git a/src/crypto/verification/QRCode.ts b/src/crypto/verification/QRCode.ts index cff87dd21..4caaf42b6 100644 --- a/src/crypto/verification/QRCode.ts +++ b/src/crypto/verification/QRCode.ts @@ -18,16 +18,16 @@ limitations under the License. * QR code key verification. */ -import { VerificationBase as Base } from "./Base"; -import { newKeyMismatchError, newUserCancelledError } from "./Error"; -import { decodeBase64, encodeUnpaddedBase64 } from "../../base64"; -import { logger } from "../../logger"; -import { VerificationRequest } from "./request/VerificationRequest"; -import { MatrixClient } from "../../client"; -import { IVerificationChannel } from "./request/Channel"; -import { MatrixEvent } from "../../models/event"; -import { ShowQrCodeCallbacks, VerifierEvent } from "../../crypto-api/verification"; -import { VerificationMethod } from "../../types"; +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 { VerificationMethod } from "../../types.ts"; export const SHOW_QR_CODE_METHOD = VerificationMethod.ShowQrCode; export const SCAN_QR_CODE_METHOD = VerificationMethod.ScanQrCode; diff --git a/src/crypto/verification/SAS.ts b/src/crypto/verification/SAS.ts index f161278bc..31e967537 100644 --- a/src/crypto/verification/SAS.ts +++ b/src/crypto/verification/SAS.ts @@ -21,27 +21,27 @@ limitations under the License. import anotherjson from "another-json"; import { Utility, SAS as OlmSAS } from "@matrix-org/olm"; -import { VerificationBase as Base, SwitchStartEventError } from "./Base"; +import { VerificationBase as Base, SwitchStartEventError } from "./Base.ts"; import { errorFactory, newInvalidMessageError, newKeyMismatchError, newUnknownMethodError, newUserCancelledError, -} from "./Error"; -import { logger } from "../../logger"; -import { IContent, MatrixEvent } from "../../models/event"; -import { generateDecimalSas } from "./SASDecimal"; -import { EventType } from "../../@types/event"; -import { EmojiMapping, GeneratedSas, ShowSasCallbacks, VerifierEvent } from "../../crypto-api/verification"; -import { VerificationMethod } from "../../types"; +} from "./Error.ts"; +import { logger } from "../../logger.ts"; +import { IContent, 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 { VerificationMethod } from "../../types.ts"; // backwards-compatibility exports export type { ShowSasCallbacks as ISasEvent, GeneratedSas as IGeneratedSas, EmojiMapping, -} from "../../crypto-api/verification"; +} from "../../crypto-api/verification.ts"; const START_TYPE = EventType.KeyVerificationStart; diff --git a/src/crypto/verification/request/Channel.ts b/src/crypto/verification/request/Channel.ts index 48415f977..cb45c7b76 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"; -import { VerificationRequest } from "./VerificationRequest"; +import { MatrixEvent } from "../../../models/event.ts"; +import { 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 59df11d78..05dcce872 100644 --- a/src/crypto/verification/request/InRoomChannel.ts +++ b/src/crypto/verification/request/InRoomChannel.ts @@ -15,13 +15,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { VerificationRequest, REQUEST_TYPE, READY_TYPE, START_TYPE } from "./VerificationRequest"; -import { logger } from "../../../logger"; -import { IVerificationChannel } from "./Channel"; -import { EventType, TimelineEvents } from "../../../@types/event"; -import { MatrixClient } from "../../../client"; -import { MatrixEvent } from "../../../models/event"; -import { IRequestsMap } from "../.."; +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"; 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 d51b85ac7..34bf6f51a 100644 --- a/src/crypto/verification/request/ToDeviceChannel.ts +++ b/src/crypto/verification/request/ToDeviceChannel.ts @@ -15,8 +15,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { randomString } from "../../../randomstring"; -import { logger } from "../../../logger"; +import { randomString } from "../../../randomstring.ts"; +import { logger } from "../../../logger.ts"; import { CANCEL_TYPE, PHASE_STARTED, @@ -25,12 +25,12 @@ import { READY_TYPE, START_TYPE, VerificationRequest, -} from "./VerificationRequest"; -import { errorFromEvent, newUnexpectedMessageError } from "../Error"; -import { MatrixEvent } from "../../../models/event"; -import { IVerificationChannel } from "./Channel"; -import { MatrixClient } from "../../../client"; -import { IRequestsMap } from "../.."; +} 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"; export type Request = VerificationRequest; diff --git a/src/crypto/verification/request/VerificationRequest.ts b/src/crypto/verification/request/VerificationRequest.ts index 5c544f131..8a3aca9a2 100644 --- a/src/crypto/verification/request/VerificationRequest.ts +++ b/src/crypto/verification/request/VerificationRequest.ts @@ -14,16 +14,16 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { logger } from "../../../logger"; -import { errorFactory, errorFromEvent, newUnexpectedMessageError, newUnknownMethodError } from "../Error"; -import { QRCodeData, SCAN_QR_CODE_METHOD } from "../QRCode"; -import { IVerificationChannel } from "./Channel"; -import { MatrixClient } from "../../../client"; -import { MatrixEvent } from "../../../models/event"; -import { EventType } from "../../../@types/event"; -import { VerificationBase } from "../Base"; -import { VerificationMethod } from "../../index"; -import { TypedEventEmitter } from "../../../models/typed-event-emitter"; +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 { EventType } from "../../../@types/event.ts"; +import { VerificationBase } from "../Base.ts"; +import { VerificationMethod } from "../../index.ts"; +import { TypedEventEmitter } from "../../../models/typed-event-emitter.ts"; import { canAcceptVerificationRequest, VerificationPhase as Phase, @@ -31,10 +31,10 @@ import { VerificationRequestEvent, VerificationRequestEventHandlerMap, Verifier, -} from "../../../crypto-api/verification"; +} from "../../../crypto-api/verification.ts"; // backwards-compatibility exports -export { VerificationPhase as Phase, VerificationRequestEvent } from "../../../crypto-api/verification"; +export { VerificationPhase as Phase, VerificationRequestEvent } from "../../../crypto-api/verification.ts"; // How long after the event's timestamp that the request times out const TIMEOUT_FROM_EVENT_TS = 10 * 60 * 1000; // 10 minutes diff --git a/src/embedded.ts b/src/embedded.ts index 8b99836bc..1974ea9f9 100644 --- a/src/embedded.ts +++ b/src/embedded.ts @@ -25,15 +25,15 @@ import { ISendEventFromWidgetResponseData, } from "matrix-widget-api"; -import { MatrixEvent, IEvent, IContent, EventStatus } from "./models/event"; +import { MatrixEvent, IEvent, IContent, EventStatus } from "./models/event.ts"; import { ISendEventResponse, SendDelayedEventRequestOpts, SendDelayedEventResponse, UpdateDelayedEventAction, -} from "./@types/requests"; -import { EventType, StateEvents } from "./@types/event"; -import { logger } from "./logger"; +} from "./@types/requests.ts"; +import { EventType, StateEvents } from "./@types/event.ts"; +import { logger } from "./logger.ts"; import { MatrixClient, ClientEvent, @@ -42,15 +42,15 @@ import { SendToDeviceContentMap, IOpenIDToken, UNSTABLE_MSC4140_DELAYED_EVENTS, -} from "./client"; -import { SyncApi, SyncState } from "./sync"; -import { SlidingSyncSdk } from "./sliding-sync-sdk"; -import { User } from "./models/user"; -import { Room } from "./models/room"; -import { ToDeviceBatch, ToDevicePayload } from "./models/ToDeviceMessage"; -import { DeviceInfo } from "./crypto/deviceinfo"; -import { IOlmDevice } from "./crypto/algorithms/megolm"; -import { MapWithDefault, recursiveMapToObject } from "./utils"; +} from "./client.ts"; +import { SyncApi, SyncState } from "./sync.ts"; +import { SlidingSyncSdk } from "./sliding-sync-sdk.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 { MapWithDefault, recursiveMapToObject } from "./utils.ts"; interface IStateEventRequest { eventType: string; diff --git a/src/event-mapper.ts b/src/event-mapper.ts index 828d87e95..7dbf6a3c1 100644 --- a/src/event-mapper.ts +++ b/src/event-mapper.ts @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixClient } from "./client"; -import { IEvent, MatrixEvent, MatrixEventEvent } from "./models/event"; -import { RelationType } from "./@types/event"; +import { MatrixClient } from "./client.ts"; +import { 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 049659251..3bfa0632e 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"; +import { ExtensibleEventType, 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 3d049f458..17457f049 100644 --- a/src/extensible_events_v1/MessageEvent.ts +++ b/src/extensible_events_v1/MessageEvent.ts @@ -16,7 +16,7 @@ limitations under the License. import { Optional } from "matrix-events-sdk"; -import { ExtensibleEvent } from "./ExtensibleEvent"; +import { ExtensibleEvent } from "./ExtensibleEvent.ts"; import { ExtensibleEventType, IMessageRendering, @@ -26,9 +26,9 @@ import { M_MESSAGE, ExtensibleAnyMessageEventContent, M_TEXT, -} from "../@types/extensible_events"; -import { isOptionalAString, isProvided } from "./utilities"; -import { InvalidEventError } from "./InvalidEventError"; +} from "../@types/extensible_events.ts"; +import { isOptionalAString, isProvided } from "./utilities.ts"; +import { InvalidEventError } from "./InvalidEventError.ts"; /** * Represents a message event. Message events are the simplest form of event with diff --git a/src/extensible_events_v1/PollEndEvent.ts b/src/extensible_events_v1/PollEndEvent.ts index 243f1906a..87cd49569 100644 --- a/src/extensible_events_v1/PollEndEvent.ts +++ b/src/extensible_events_v1/PollEndEvent.ts @@ -20,11 +20,11 @@ import { isEventTypeSame, M_TEXT, REFERENCE_RELATION, -} from "../@types/extensible_events"; -import { M_POLL_END, PollEndEventContent } from "../@types/polls"; -import { ExtensibleEvent } from "./ExtensibleEvent"; -import { InvalidEventError } from "./InvalidEventError"; -import { MessageEvent } from "./MessageEvent"; +} from "../@types/extensible_events.ts"; +import { M_POLL_END, PollEndEventContent } from "../@types/polls.ts"; +import { ExtensibleEvent } from "./ExtensibleEvent.ts"; +import { InvalidEventError } from "./InvalidEventError.ts"; +import { MessageEvent } from "./MessageEvent.ts"; /** * Represents a poll end/closure event. diff --git a/src/extensible_events_v1/PollResponseEvent.ts b/src/extensible_events_v1/PollResponseEvent.ts index a61fc2e7c..9e7659ba7 100644 --- a/src/extensible_events_v1/PollResponseEvent.ts +++ b/src/extensible_events_v1/PollResponseEvent.ts @@ -14,11 +14,16 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { ExtensibleEvent } from "./ExtensibleEvent"; -import { M_POLL_RESPONSE, PollResponseEventContent, PollResponseSubtype } from "../@types/polls"; -import { ExtensibleEventType, IPartialEvent, isEventTypeSame, REFERENCE_RELATION } from "../@types/extensible_events"; -import { InvalidEventError } from "./InvalidEventError"; -import { PollStartEvent } from "./PollStartEvent"; +import { ExtensibleEvent } from "./ExtensibleEvent.ts"; +import { M_POLL_RESPONSE, PollResponseEventContent, PollResponseSubtype } from "../@types/polls.ts"; +import { + ExtensibleEventType, + IPartialEvent, + isEventTypeSame, + REFERENCE_RELATION, +} from "../@types/extensible_events.ts"; +import { InvalidEventError } from "./InvalidEventError.ts"; +import { 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 8584bf9e1..98b15e2ad 100644 --- a/src/extensible_events_v1/PollStartEvent.ts +++ b/src/extensible_events_v1/PollStartEvent.ts @@ -16,8 +16,8 @@ limitations under the License. import { NamespacedValue } from "matrix-events-sdk"; -import { MessageEvent } from "./MessageEvent"; -import { ExtensibleEventType, IPartialEvent, isEventTypeSame, M_TEXT } from "../@types/extensible_events"; +import { MessageEvent } from "./MessageEvent.ts"; +import { ExtensibleEventType, IPartialEvent, isEventTypeSame, M_TEXT } from "../@types/extensible_events.ts"; import { KnownPollKind, M_POLL_KIND_DISCLOSED, @@ -26,9 +26,9 @@ import { PollStartEventContent, PollStartSubtype, PollAnswer, -} from "../@types/polls"; -import { InvalidEventError } from "./InvalidEventError"; -import { ExtensibleEvent } from "./ExtensibleEvent"; +} from "../@types/polls.ts"; +import { InvalidEventError } from "./InvalidEventError.ts"; +import { ExtensibleEvent } from "./ExtensibleEvent.ts"; /** * Represents a poll answer. Note that this is represented as a subtype and is diff --git a/src/feature.ts b/src/feature.ts index 0657a217c..47c914353 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"; +import { IServerVersions } from "./client.ts"; export enum ServerSupport { Stable, diff --git a/src/filter-component.ts b/src/filter-component.ts index 0954e634f..41f2903cb 100644 --- a/src/filter-component.ts +++ b/src/filter-component.ts @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { RelationType } from "./@types/event"; -import { MatrixEvent } from "./models/event"; -import { FILTER_RELATED_BY_REL_TYPES, FILTER_RELATED_BY_SENDERS, THREAD_RELATION_TYPE } from "./models/thread"; +import { RelationType } from "./@types/event.ts"; +import { MatrixEvent } from "./models/event.ts"; +import { FILTER_RELATED_BY_REL_TYPES, FILTER_RELATED_BY_SENDERS, THREAD_RELATION_TYPE } from "./models/thread.ts"; /** * Checks if a value matches a given field value, which may be a * terminated diff --git a/src/filter.ts b/src/filter.ts index aea2fb491..d5ad00509 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"; -import { UNREAD_THREAD_NOTIFICATIONS } from "./@types/sync"; -import { FilterComponent, IFilterComponent } from "./filter-component"; -import { MatrixEvent } from "./models/event"; +import { EventType, 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"; /** */ diff --git a/src/http-api/errors.ts b/src/http-api/errors.ts index c5aba882b..86cfdc908 100644 --- a/src/http-api/errors.ts +++ b/src/http-api/errors.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IUsageLimit } from "../@types/partials"; -import { MatrixEvent } from "../models/event"; +import { IUsageLimit } from "../@types/partials.ts"; +import { 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 274f39f0d..3c98c10aa 100644 --- a/src/http-api/fetch.ts +++ b/src/http-api/fetch.ts @@ -18,13 +18,13 @@ limitations under the License. * This is an internal module. See {@link MatrixHttpApi} for the public class. */ -import { checkObjectHasKeys, encodeParams } from "../utils"; -import { TypedEventEmitter } from "../models/typed-event-emitter"; -import { Method } from "./method"; -import { ConnectionError, MatrixError } from "./errors"; -import { HttpApiEvent, HttpApiEventHandlerMap, IHttpOpts, IRequestOpts, Body } from "./interface"; -import { anySignal, parseErrorResponse, timeoutSignal } from "./utils"; -import { QueryDict } from "../utils"; +import { checkObjectHasKeys, encodeParams } from "../utils.ts"; +import { 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 { anySignal, parseErrorResponse, timeoutSignal } from "./utils.ts"; +import { 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 cd63f8d28..abc7391da 100644 --- a/src/http-api/index.ts +++ b/src/http-api/index.ts @@ -14,20 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { FetchHttpApi } from "./fetch"; -import { FileType, IContentUri, IHttpOpts, Upload, UploadOpts, UploadResponse } from "./interface"; -import { MediaPrefix } from "./prefix"; -import { defer, QueryDict, removeElement } from "../utils"; -import * as callbacks from "../realtime-callbacks"; -import { Method } from "./method"; -import { ConnectionError } from "./errors"; -import { parseErrorResponse } from "./utils"; +import { FetchHttpApi } from "./fetch.ts"; +import { FileType, IContentUri, IHttpOpts, Upload, UploadOpts, UploadResponse } from "./interface.ts"; +import { MediaPrefix } from "./prefix.ts"; +import { defer, QueryDict, removeElement } from "../utils.ts"; +import * as callbacks from "../realtime-callbacks.ts"; +import { Method } from "./method.ts"; +import { ConnectionError } from "./errors.ts"; +import { parseErrorResponse } from "./utils.ts"; -export * from "./interface"; -export * from "./prefix"; -export * from "./errors"; -export * from "./method"; -export * from "./utils"; +export * from "./interface.ts"; +export * from "./prefix.ts"; +export * from "./errors.ts"; +export * from "./method.ts"; +export * from "./utils.ts"; export class MatrixHttpApi extends FetchHttpApi { private uploads: Upload[] = []; diff --git a/src/http-api/interface.ts b/src/http-api/interface.ts index ee4456d7c..c06b850f3 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"; -import { Logger } from "../logger"; +import { MatrixError } from "./errors.ts"; +import { Logger } from "../logger.ts"; export type Body = Record | BodyInit; diff --git a/src/http-api/utils.ts b/src/http-api/utils.ts index 0b3c3554f..861d47ea1 100644 --- a/src/http-api/utils.ts +++ b/src/http-api/utils.ts @@ -16,9 +16,9 @@ limitations under the License. import { parse as parseContentType, ParsedMediaType } from "content-type"; -import { logger } from "../logger"; -import { sleep } from "../utils"; -import { ConnectionError, HTTPError, MatrixError } from "./errors"; +import { logger } from "../logger.ts"; +import { sleep } from "../utils.ts"; +import { ConnectionError, HTTPError, MatrixError } from "./errors.ts"; // Ponyfill for https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout export function timeoutSignal(ms: number): AbortSignal { diff --git a/src/index.ts b/src/index.ts index c9a5dcf65..65e798c87 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -import * as matrixcs from "./matrix"; +import * as matrixcs from "./matrix.ts"; if (global.__js_sdk_entrypoint) { throw new Error("Multiple matrix-js-sdk entrypoints detected!"); } global.__js_sdk_entrypoint = true; -export * from "./matrix"; +export * from "./matrix.ts"; export default matrixcs; diff --git a/src/indexeddb-worker.ts b/src/indexeddb-worker.ts index 68dcf0f80..15fc1bb8b 100644 --- a/src/indexeddb-worker.ts +++ b/src/indexeddb-worker.ts @@ -21,4 +21,4 @@ limitations under the License. */ /** The {@link IndexedDBStoreWorker} class. */ -export { IndexedDBStoreWorker } from "./store/indexeddb-store-worker"; +export { IndexedDBStoreWorker } from "./store/indexeddb-store-worker.ts"; diff --git a/src/interactive-auth.ts b/src/interactive-auth.ts index 8ecfc64a0..60c31d017 100644 --- a/src/interactive-auth.ts +++ b/src/interactive-auth.ts @@ -16,12 +16,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { logger } from "./logger"; -import { MatrixClient } from "./client"; -import { defer, IDeferred } from "./utils"; -import { MatrixError } from "./http-api"; -import { UIAResponse } from "./@types/uia"; -import { UserIdentifier } from "./@types/auth"; +import { logger } from "./logger.ts"; +import { MatrixClient } from "./client.ts"; +import { defer, IDeferred } from "./utils.ts"; +import { MatrixError } from "./http-api/index.ts"; +import { UIAResponse } from "./@types/uia.ts"; +import { 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 50a2a72f6..cac7c91fd 100644 --- a/src/matrix.ts +++ b/src/matrix.ts @@ -16,74 +16,74 @@ limitations under the License. import { WidgetApi } from "matrix-widget-api"; -import { MemoryCryptoStore } from "./crypto/store/memory-crypto-store"; -import { MemoryStore } from "./store/memory"; -import { MatrixScheduler } from "./scheduler"; -import { MatrixClient, ICreateClientOpts } from "./client"; -import { RoomWidgetClient, ICapabilities } from "./embedded"; -import { CryptoStore } from "./crypto/store/base"; +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"; -export * from "./client"; -export * from "./serverCapabilities"; -export * from "./embedded"; -export * from "./http-api"; -export * from "./autodiscovery"; -export * from "./sync-accumulator"; -export * from "./errors"; -export * from "./base64"; -export * from "./models/beacon"; -export * from "./models/event"; -export * from "./models/room"; -export * from "./models/event-timeline"; -export * from "./models/event-timeline-set"; -export * from "./models/poll"; -export * from "./models/room-member"; -export * from "./models/room-state"; -export * from "./models/thread"; -export * from "./models/typed-event-emitter"; -export * from "./models/user"; -export * from "./models/device"; -export * from "./models/search-result"; -export * from "./oidc"; -export * from "./scheduler"; -export * from "./filter"; -export * from "./timeline-window"; -export * from "./interactive-auth"; -export * from "./service-types"; -export * from "./store/memory"; -export * from "./store/indexeddb"; -export * from "./crypto/store/memory-crypto-store"; -export * from "./crypto/store/localStorage-crypto-store"; -export * from "./crypto/store/indexeddb-crypto-store"; -export type { OutgoingRoomKeyRequest } from "./crypto/store/base"; -export * from "./content-repo"; -export * from "./@types/common"; -export * from "./@types/uia"; -export * from "./@types/event"; -export * from "./@types/PushRules"; -export * from "./@types/partials"; -export * from "./@types/requests"; -export * from "./@types/search"; -export * from "./@types/beacon"; -export * from "./@types/topic"; -export * from "./@types/location"; -export * from "./@types/threepids"; -export * from "./@types/auth"; -export * from "./@types/polls"; -export * from "./@types/local_notifications"; -export * from "./@types/registration"; -export * from "./@types/read_receipts"; -export * from "./@types/crypto"; -export * from "./@types/extensible_events"; -export * from "./@types/IIdentityServerProvider"; -export * from "./models/room-summary"; -export * from "./models/event-status"; -export type { RoomSummary } from "./client"; -export * as ContentHelpers from "./content-helpers"; -export * as SecretStorage from "./secret-storage"; -export type { ICryptoCallbacks } from "./crypto"; // used to be located here -export { createNewMatrixCall, CallEvent } from "./webrtc/call"; -export type { MatrixCall } from "./webrtc/call"; +export * from "./client.ts"; +export * from "./serverCapabilities.ts"; +export * from "./embedded.ts"; +export * from "./http-api/index.ts"; +export * from "./autodiscovery.ts"; +export * from "./sync-accumulator.ts"; +export * from "./errors.ts"; +export * from "./base64.ts"; +export * from "./models/beacon.ts"; +export * from "./models/event.ts"; +export * from "./models/room.ts"; +export * from "./models/event-timeline.ts"; +export * from "./models/event-timeline-set.ts"; +export * from "./models/poll.ts"; +export * from "./models/room-member.ts"; +export * from "./models/room-state.ts"; +export * from "./models/thread.ts"; +export * from "./models/typed-event-emitter.ts"; +export * from "./models/user.ts"; +export * from "./models/device.ts"; +export * from "./models/search-result.ts"; +export * from "./oidc/index.ts"; +export * from "./scheduler.ts"; +export * from "./filter.ts"; +export * from "./timeline-window.ts"; +export * from "./interactive-auth.ts"; +export * from "./service-types.ts"; +export * from "./store/memory.ts"; +export * from "./store/indexeddb.ts"; +export * from "./crypto/store/memory-crypto-store.ts"; +export * from "./crypto/store/localStorage-crypto-store.ts"; +export * from "./crypto/store/indexeddb-crypto-store.ts"; +export type { OutgoingRoomKeyRequest } from "./crypto/store/base.ts"; +export * from "./content-repo.ts"; +export * from "./@types/common.ts"; +export * from "./@types/uia.ts"; +export * from "./@types/event.ts"; +export * from "./@types/PushRules.ts"; +export * from "./@types/partials.ts"; +export * from "./@types/requests.ts"; +export * from "./@types/search.ts"; +export * from "./@types/beacon.ts"; +export * from "./@types/topic.ts"; +export * from "./@types/location.ts"; +export * from "./@types/threepids.ts"; +export * from "./@types/auth.ts"; +export * from "./@types/polls.ts"; +export * from "./@types/local_notifications.ts"; +export * from "./@types/registration.ts"; +export * from "./@types/read_receipts.ts"; +export * from "./@types/crypto.ts"; +export * from "./@types/extensible_events.ts"; +export * from "./@types/IIdentityServerProvider.ts"; +export * from "./models/room-summary.ts"; +export * from "./models/event-status.ts"; +export type { RoomSummary } from "./client.ts"; +export * as ContentHelpers from "./content-helpers.ts"; +export * as SecretStorage from "./secret-storage.ts"; +export type { ICryptoCallbacks } from "./crypto/index.ts"; // used to be located here +export { createNewMatrixCall, CallEvent } from "./webrtc/call.ts"; +export type { MatrixCall } from "./webrtc/call.ts"; export { GroupCall, GroupCallEvent, @@ -91,21 +91,21 @@ export { GroupCallState, GroupCallType, GroupCallStatsReportEvent, -} from "./webrtc/groupCall"; -export { CryptoEvent } from "./crypto"; -export { SyncState, SetPresence } from "./sync"; -export type { ISyncStateData as SyncStateData } from "./sync"; -export { SlidingSyncEvent } from "./sliding-sync"; -export { MediaHandlerEvent } from "./webrtc/mediaHandler"; -export { CallFeedEvent } from "./webrtc/callFeed"; -export { StatsReport } from "./webrtc/stats/statsReport"; -export { Relations, RelationsEvent } from "./models/relations"; -export { TypedEventEmitter } from "./models/typed-event-emitter"; -export { LocalStorageErrors } from "./store/local-storage-events-emitter"; -export { IdentityProviderBrand, SSOAction } from "./@types/auth"; -export type { ISSOFlow as SSOFlow, LoginFlow } from "./@types/auth"; -export type { IHierarchyRelation as HierarchyRelation, IHierarchyRoom as HierarchyRoom } from "./@types/spaces"; -export { LocationAssetType } from "./@types/location"; +} from "./webrtc/groupCall.ts"; +export { CryptoEvent } from "./crypto/index.ts"; +export { SyncState, SetPresence } from "./sync.ts"; +export type { ISyncStateData as SyncStateData } from "./sync.ts"; +export { SlidingSyncEvent } from "./sliding-sync.ts"; +export { MediaHandlerEvent } from "./webrtc/mediaHandler.ts"; +export { CallFeedEvent } from "./webrtc/callFeed.ts"; +export { StatsReport } from "./webrtc/stats/statsReport.ts"; +export { Relations, RelationsEvent } from "./models/relations.ts"; +export { TypedEventEmitter } from "./models/typed-event-emitter.ts"; +export { LocalStorageErrors } from "./store/local-storage-events-emitter.ts"; +export { IdentityProviderBrand, SSOAction } from "./@types/auth.ts"; +export type { ISSOFlow as SSOFlow, LoginFlow } from "./@types/auth.ts"; +export type { IHierarchyRelation as HierarchyRelation, IHierarchyRoom as HierarchyRoom } from "./@types/spaces.ts"; +export { LocationAssetType } from "./@types/location.ts"; /** * Types supporting cryptography. @@ -113,7 +113,7 @@ export { LocationAssetType } from "./@types/location"; * The most important is {@link Crypto.CryptoApi}, an instance of which can be retrieved via * {@link MatrixClient.getCrypto}. */ -export * as Crypto from "./crypto-api"; +export * as Crypto from "./crypto-api/index.ts"; let cryptoStoreFactory = (): CryptoStore => new MemoryCryptoStore(); diff --git a/src/matrixrtc/CallMembership.ts b/src/matrixrtc/CallMembership.ts index d2c9b06d3..495ce1c49 100644 --- a/src/matrixrtc/CallMembership.ts +++ b/src/matrixrtc/CallMembership.ts @@ -16,10 +16,10 @@ limitations under the License. import { EitherAnd } from "matrix-events-sdk/lib/types"; -import { MatrixEvent } from "../matrix"; -import { deepCompare } from "../utils"; -import { Focus } from "./focus"; -import { isLivekitFocusActive } from "./LivekitFocus"; +import { MatrixEvent } from "../matrix.ts"; +import { deepCompare } from "../utils.ts"; +import { Focus } from "./focus.ts"; +import { isLivekitFocusActive } from "./LivekitFocus.ts"; type CallScope = "m.room" | "m.user"; // Represents an entry in the memberships section of an m.call.member event as it is on the wire diff --git a/src/matrixrtc/LivekitFocus.ts b/src/matrixrtc/LivekitFocus.ts index 0a42dda5f..254c71541 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"; +import { Focus } from "./focus.ts"; export interface LivekitFocusConfig extends Focus { type: "livekit"; diff --git a/src/matrixrtc/MatrixRTCSession.ts b/src/matrixrtc/MatrixRTCSession.ts index 4b26134e7..ebd69400a 100644 --- a/src/matrixrtc/MatrixRTCSession.ts +++ b/src/matrixrtc/MatrixRTCSession.ts @@ -14,30 +14,30 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { logger as rootLogger } from "../logger"; -import { TypedEventEmitter } from "../models/typed-event-emitter"; -import { EventTimeline } from "../models/event-timeline"; -import { Room } from "../models/room"; -import { MatrixClient } from "../client"; -import { EventType } from "../@types/event"; -import { UpdateDelayedEventAction } from "../@types/requests"; +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 { EventType } from "../@types/event.ts"; +import { UpdateDelayedEventAction } from "../@types/requests.ts"; import { CallMembership, CallMembershipData, CallMembershipDataLegacy, SessionMembershipData, isLegacyCallMembershipData, -} from "./CallMembership"; -import { RoomStateEvent } from "../models/room-state"; -import { Focus } from "./focus"; -import { randomString, secureRandomBase64Url } from "../randomstring"; -import { EncryptionKeysEventContent } from "./types"; -import { decodeBase64, encodeUnpaddedBase64 } from "../base64"; -import { KnownMembership } from "../@types/membership"; -import { MatrixError } from "../http-api/errors"; -import { MatrixEvent } from "../models/event"; -import { isLivekitFocusActive } from "./LivekitFocus"; -import { ExperimentalGroupCallRoomMemberState } from "../webrtc/groupCall"; +} from "./CallMembership.ts"; +import { RoomStateEvent } from "../models/room-state.ts"; +import { Focus } from "./focus.ts"; +import { randomString, secureRandomBase64Url } from "../randomstring.ts"; +import { EncryptionKeysEventContent } from "./types.ts"; +import { decodeBase64, encodeUnpaddedBase64 } from "../base64.ts"; +import { KnownMembership } from "../@types/membership.ts"; +import { MatrixError } from "../http-api/errors.ts"; +import { MatrixEvent } from "../models/event.ts"; +import { isLivekitFocusActive } from "./LivekitFocus.ts"; +import { ExperimentalGroupCallRoomMemberState } from "../webrtc/groupCall.ts"; const logger = rootLogger.getChild("MatrixRTCSession"); diff --git a/src/matrixrtc/MatrixRTCSessionManager.ts b/src/matrixrtc/MatrixRTCSessionManager.ts index d59cee218..e64d19f7a 100644 --- a/src/matrixrtc/MatrixRTCSessionManager.ts +++ b/src/matrixrtc/MatrixRTCSessionManager.ts @@ -14,14 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { logger as rootLogger } from "../logger"; -import { MatrixClient, ClientEvent } from "../client"; -import { TypedEventEmitter } from "../models/typed-event-emitter"; -import { Room, RoomEvent } from "../models/room"; -import { RoomState, RoomStateEvent } from "../models/room-state"; -import { MatrixEvent } from "../models/event"; -import { MatrixRTCSession } from "./MatrixRTCSession"; -import { EventType } from "../@types/event"; +import { logger as rootLogger } from "../logger.ts"; +import { 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 { MatrixRTCSession } from "./MatrixRTCSession.ts"; +import { EventType } from "../@types/event.ts"; const logger = rootLogger.getChild("MatrixRTCSessionManager"); diff --git a/src/matrixrtc/index.ts b/src/matrixrtc/index.ts index 2e5e6f351..0474f6353 100644 --- a/src/matrixrtc/index.ts +++ b/src/matrixrtc/index.ts @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -export * from "./CallMembership"; -export * from "./focus"; -export * from "./LivekitFocus"; -export * from "./MatrixRTCSession"; -export * from "./MatrixRTCSessionManager"; -export * from "./types"; +export * from "./CallMembership.ts"; +export * from "./focus.ts"; +export * from "./LivekitFocus.ts"; +export * from "./MatrixRTCSession.ts"; +export * from "./MatrixRTCSessionManager.ts"; +export * from "./types.ts"; diff --git a/src/matrixrtc/types.ts b/src/matrixrtc/types.ts index de4c7ac47..479e34366 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"; +import { IMentions } from "../matrix.ts"; export interface EncryptionKeyEntry { index: number; key: string; diff --git a/src/models/MSC3089Branch.ts b/src/models/MSC3089Branch.ts index ebae391e3..503a6e4af 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"; -import { RelationType, UNSTABLE_MSC3089_BRANCH } from "../@types/event"; -import { IContent, MatrixEvent } from "./event"; -import { MSC3089TreeSpace } from "./MSC3089TreeSpace"; -import { EventTimeline } from "./event-timeline"; -import { FileType } from "../http-api"; -import type { ISendEventResponse } from "../@types/requests"; -import { EncryptedFile } from "../@types/media"; +import { 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 { EventTimeline } from "./event-timeline.ts"; +import { FileType } from "../http-api/index.ts"; +import type { ISendEventResponse } from "../@types/requests.ts"; +import { EncryptedFile } from "../@types/media.ts"; export interface MSC3089EventContent { active?: boolean; diff --git a/src/models/MSC3089TreeSpace.ts b/src/models/MSC3089TreeSpace.ts index 6dc1b6fbb..8bcc933d7 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"; -import { EventType, MsgType, UNSTABLE_MSC3089_BRANCH, UNSTABLE_MSC3089_LEAF } from "../@types/event"; -import { Room } from "./room"; -import { logger } from "../logger"; -import { IContent, MatrixEvent } from "./event"; +import { MatrixClient } from "../client.ts"; +import { EventType, MsgType, UNSTABLE_MSC3089_BRANCH, UNSTABLE_MSC3089_LEAF } from "../@types/event.ts"; +import { Room } from "./room.ts"; +import { logger } from "../logger.ts"; +import { IContent, MatrixEvent } from "./event.ts"; import { averageBetweenStrings, DEFAULT_ALPHABET, @@ -28,14 +28,14 @@ import { nextString, prevString, simpleRetryOperation, -} from "../utils"; -import { MSC3089Branch } from "./MSC3089Branch"; -import { isRoomSharedHistory } from "../crypto/algorithms/megolm"; -import { ISendEventResponse } from "../@types/requests"; -import { FileType } from "../http-api"; -import { KnownMembership } from "../@types/membership"; -import { RoomPowerLevelsEventContent, SpaceChildEventContent } from "../@types/state_events"; -import type { EncryptedFile, FileContent } from "../@types/media"; +} from "../utils.ts"; +import { MSC3089Branch } from "./MSC3089Branch.ts"; +import { isRoomSharedHistory } from "../crypto/algorithms/megolm.ts"; +import { ISendEventResponse } from "../@types/requests.ts"; +import { FileType } from "../http-api/index.ts"; +import { KnownMembership } from "../@types/membership.ts"; +import { RoomPowerLevelsEventContent, SpaceChildEventContent } from "../@types/state_events.ts"; +import type { EncryptedFile, FileContent } from "../@types/media.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 3801831a1..95115780e 100644 --- a/src/models/beacon.ts +++ b/src/models/beacon.ts @@ -14,11 +14,16 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MBeaconEventContent } from "../@types/beacon"; -import { BeaconInfoState, BeaconLocationState, parseBeaconContent, parseBeaconInfoContent } from "../content-helpers"; -import { MatrixEvent } from "./event"; -import { sortEventsByLatestContentTimestamp } from "../utils"; -import { TypedEventEmitter } from "./typed-event-emitter"; +import { MBeaconEventContent } from "../@types/beacon.ts"; +import { + BeaconInfoState, + BeaconLocationState, + parseBeaconContent, + parseBeaconInfoContent, +} from "../content-helpers.ts"; +import { MatrixEvent } from "./event.ts"; +import { sortEventsByLatestContentTimestamp } from "../utils.ts"; +import { TypedEventEmitter } from "./typed-event-emitter.ts"; export enum BeaconEvent { New = "Beacon.new", diff --git a/src/models/compare-event-ordering.ts b/src/models/compare-event-ordering.ts index 6be23ec03..31d508128 100644 --- a/src/models/compare-event-ordering.ts +++ b/src/models/compare-event-ordering.ts @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixEvent } from "./event"; -import { Room } from "./room"; -import { inMainTimelineForReceipt, threadIdForReceipt } from "../client"; +import { MatrixEvent } from "./event.ts"; +import { Room } from "./room.ts"; +import { inMainTimelineForReceipt, threadIdForReceipt } from "../client.ts"; /** * Determine the order of two events in a room. diff --git a/src/models/event-context.ts b/src/models/event-context.ts index 0401cd530..c99b2db37 100644 --- a/src/models/event-context.ts +++ b/src/models/event-context.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixEvent } from "./event"; -import { Direction } from "./event-timeline"; +import { MatrixEvent } from "./event.ts"; +import { Direction } from "./event-timeline.ts"; export class EventContext { private timeline: MatrixEvent[]; diff --git a/src/models/event-timeline-set.ts b/src/models/event-timeline-set.ts index bff69547b..da8e63833 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"; -import { MatrixEvent } from "./event"; -import { logger } from "../logger"; -import { Room, RoomEvent } from "./room"; -import { Filter } from "../filter"; -import { RoomState } from "./room-state"; -import { TypedEventEmitter } from "./typed-event-emitter"; -import { RelationsContainer } from "./relations-container"; -import { MatrixClient } from "../client"; -import { Thread, ThreadFilterType } from "./thread"; +import { EventTimeline, IAddEventOptions } from "./event-timeline.ts"; +import { 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 { TypedEventEmitter } from "./typed-event-emitter.ts"; +import { RelationsContainer } from "./relations-container.ts"; +import { MatrixClient } from "../client.ts"; +import { Thread, ThreadFilterType } from "./thread.ts"; const DEBUG = true; diff --git a/src/models/event-timeline.ts b/src/models/event-timeline.ts index e8b84fd80..3489fdaee 100644 --- a/src/models/event-timeline.ts +++ b/src/models/event-timeline.ts @@ -14,11 +14,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IMarkerFoundOptions, RoomState } from "./room-state"; -import { EventTimelineSet } from "./event-timeline-set"; -import { MatrixEvent } from "./event"; -import { Filter } from "../filter"; -import { EventType } from "../@types/event"; +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 { EventType } from "../@types/event.ts"; export interface IInitialiseStateOptions extends Pick { // This is a separate interface without any extra stuff currently added on diff --git a/src/models/event.ts b/src/models/event.ts index f3eead5a8..8c1321443 100644 --- a/src/models/event.ts +++ b/src/models/event.ts @@ -21,9 +21,9 @@ limitations under the License. import { ExtensibleEvent, ExtensibleEvents, Optional } from "matrix-events-sdk"; -import type { IEventDecryptionResult } from "../@types/crypto"; -import { logger } from "../logger"; -import { VerificationRequest } from "../crypto/verification/request/VerificationRequest"; +import type { IEventDecryptionResult } from "../@types/crypto.ts"; +import { logger } from "../logger.ts"; +import { VerificationRequest } from "../crypto/verification/request/VerificationRequest.ts"; import { EVENT_VISIBILITY_CHANGE_TYPE, EventType, @@ -32,24 +32,24 @@ import { ToDeviceMessageId, UNSIGNED_THREAD_ID_FIELD, UNSIGNED_MEMBERSHIP_FIELD, -} from "../@types/event"; -import { Crypto } from "../crypto"; -import { deepSortedObjectEntries, internaliseString } from "../utils"; -import { RoomMember } from "./room-member"; -import { Thread, THREAD_RELATION_TYPE, ThreadEvent, ThreadEventHandlerMap } from "./thread"; -import { IActionsObject } from "../pushprocessor"; -import { TypedReEmitter } from "../ReEmitter"; -import { MatrixError } from "../http-api"; -import { TypedEventEmitter } from "./typed-event-emitter"; -import { EventStatus } from "./event-status"; -import { CryptoBackend, DecryptionError } from "../common-crypto/CryptoBackend"; -import { IAnnotatedPushRule } from "../@types/PushRules"; -import { Room } from "./room"; -import { EventTimeline } from "./event-timeline"; -import { Membership } from "../@types/membership"; -import { DecryptionFailureCode } from "../crypto-api"; +} from "../@types/event.ts"; +import { 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 { TypedReEmitter } from "../ReEmitter.ts"; +import { 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 { EventTimeline } from "./event-timeline.ts"; +import { Membership } from "../@types/membership.ts"; +import { DecryptionFailureCode } from "../crypto-api/index.ts"; -export { EventStatus } from "./event-status"; +export { EventStatus } from "./event-status.ts"; /* eslint-disable camelcase */ export interface IContent { diff --git a/src/models/invites-ignorer.ts b/src/models/invites-ignorer.ts index a76d6a83a..c5ea96015 100644 --- a/src/models/invites-ignorer.ts +++ b/src/models/invites-ignorer.ts @@ -16,13 +16,13 @@ limitations under the License. import { UnstableValue } from "matrix-events-sdk"; -import { MatrixClient } from "../client"; -import { IContent, MatrixEvent } from "./event"; -import { EventTimeline } from "./event-timeline"; -import { Preset } from "../@types/partials"; -import { globToRegexp } from "../utils"; -import { Room } from "./room"; -import { EventType, StateEvents } from "../@types/event"; +import { MatrixClient } from "../client.ts"; +import { IContent, 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"; /// The event type storing the user's individual policies. /// diff --git a/src/models/poll.ts b/src/models/poll.ts index 4c4fc466e..ae38810f8 100644 --- a/src/models/poll.ts +++ b/src/models/poll.ts @@ -16,13 +16,13 @@ limitations under the License. import { M_POLL_START } from "matrix-events-sdk"; -import { M_POLL_END, M_POLL_RESPONSE } from "../@types/polls"; -import { MatrixClient } from "../client"; -import { PollStartEvent } from "../extensible_events_v1/PollStartEvent"; -import { MatrixEvent } from "./event"; -import { Relations } from "./relations"; -import { Room } from "./room"; -import { TypedEventEmitter } from "./typed-event-emitter"; +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 { Relations } from "./relations.ts"; +import { Room } from "./room.ts"; +import { TypedEventEmitter } from "./typed-event-emitter.ts"; export enum PollEvent { New = "Poll.new", diff --git a/src/models/read-receipt.ts b/src/models/read-receipt.ts index 8dd743e7c..5711e3314 100644 --- a/src/models/read-receipt.ts +++ b/src/models/read-receipt.ts @@ -18,16 +18,16 @@ import { ReceiptCache, ReceiptType, WrappedReceipt, -} from "../@types/read_receipts"; -import { ListenerMap, TypedEventEmitter } from "./typed-event-emitter"; -import { isSupportedReceiptType } from "../utils"; -import { MatrixEvent } from "./event"; -import { EventType } from "../@types/event"; -import { EventTimelineSet } from "./event-timeline-set"; -import { MapWithDefault } from "../utils"; -import { NotificationCountType } from "./room"; -import { logger } from "../logger"; -import { inMainTimelineForReceipt, threadIdForReceipt } from "../client"; +} from "../@types/read_receipts.ts"; +import { 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 { MapWithDefault } from "../utils.ts"; +import { NotificationCountType } from "./room.ts"; +import { logger } from "../logger.ts"; +import { inMainTimelineForReceipt, threadIdForReceipt } from "../client.ts"; /** * Create a synthetic receipt for the given event diff --git a/src/models/related-relations.ts b/src/models/related-relations.ts index a0051695a..0dda060ae 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"; -import { MatrixEvent } from "./event"; -import { Listener } from "./typed-event-emitter"; +import { Relations, RelationsEvent, EventHandlerMap } from "./relations.ts"; +import { MatrixEvent } from "./event.ts"; +import { 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 9637223b0..3889be719 100644 --- a/src/models/relations-container.ts +++ b/src/models/relations-container.ts @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Relations } from "./relations"; -import { EventType, RelationType } from "../@types/event"; -import { EventStatus, MatrixEvent, MatrixEventEvent } from "./event"; -import { EventTimelineSet } from "./event-timeline-set"; -import { MatrixClient } from "../client"; -import { Room } from "./room"; +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"; 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 d2b637cc3..87a9b7522 100644 --- a/src/models/relations.ts +++ b/src/models/relations.ts @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { EventStatus, IAggregatedRelation, MatrixEvent, MatrixEventEvent } from "./event"; -import { logger } from "../logger"; -import { RelationType } from "../@types/event"; -import { TypedEventEmitter } from "./typed-event-emitter"; -import { MatrixClient } from "../client"; -import { Room } from "./room"; +import { EventStatus, IAggregatedRelation, 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 { Room } from "./room.ts"; export enum RelationsEvent { Add = "Relations.add", diff --git a/src/models/room-member.ts b/src/models/room-member.ts index 58da589f8..181df14c2 100644 --- a/src/models/room-member.ts +++ b/src/models/room-member.ts @@ -14,15 +14,15 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { getHttpUriForMxc } from "../content-repo"; -import { removeDirectionOverrideChars, removeHiddenChars } from "../utils"; -import { User } from "./user"; -import { MatrixEvent } from "./event"; -import { RoomState } from "./room-state"; -import { logger } from "../logger"; -import { TypedEventEmitter } from "./typed-event-emitter"; -import { EventType } from "../@types/event"; -import { KnownMembership, Membership } from "../@types/membership"; +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 { logger } from "../logger.ts"; +import { TypedEventEmitter } from "./typed-event-emitter.ts"; +import { EventType } from "../@types/event.ts"; +import { KnownMembership, 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 e8370e0ef..9850eece2 100644 --- a/src/models/room-receipts.ts +++ b/src/models/room-receipts.ts @@ -14,11 +14,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MAIN_ROOM_TIMELINE, Receipt, ReceiptContent } from "../@types/read_receipts"; -import { threadIdForReceipt } from "../client"; -import { Room, RoomEvent } from "./room"; -import { MatrixEvent } from "./event"; -import { logger } from "../logger"; +import { MAIN_ROOM_TIMELINE, Receipt, ReceiptContent } from "../@types/read_receipts.ts"; +import { threadIdForReceipt } from "../client.ts"; +import { Room, RoomEvent } from "./room.ts"; +import { MatrixEvent } from "./event.ts"; +import { logger } from "../logger.ts"; /** * The latest receipts we have for a room. diff --git a/src/models/room-state.ts b/src/models/room-state.ts index 52a586604..492670e6f 100644 --- a/src/models/room-state.ts +++ b/src/models/room-state.ts @@ -14,19 +14,19 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { RoomMember } from "./room-member"; -import { logger } from "../logger"; -import { isNumber, removeHiddenChars } from "../utils"; -import { EventType, UNSTABLE_MSC2716_MARKER } from "../@types/event"; -import { IEvent, MatrixEvent, MatrixEventEvent } from "./event"; -import { MatrixClient } from "../client"; -import { GuestAccess, HistoryVisibility, JoinRule } from "../@types/partials"; -import { TypedEventEmitter } from "./typed-event-emitter"; -import { Beacon, BeaconEvent, BeaconEventHandlerMap, getBeaconInfoIdentifier, BeaconIdentifier } from "./beacon"; -import { TypedReEmitter } from "../ReEmitter"; -import { M_BEACON, M_BEACON_INFO } from "../@types/beacon"; -import { KnownMembership } from "../@types/membership"; -import { RoomJoinRulesEventContent } from "../@types/state_events"; +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 { GuestAccess, HistoryVisibility, JoinRule } from "../@types/partials.ts"; +import { TypedEventEmitter } from "./typed-event-emitter.ts"; +import { Beacon, BeaconEvent, BeaconEventHandlerMap, getBeaconInfoIdentifier, 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"; 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 0310b88fe..b013e76af 100644 --- a/src/models/room.ts +++ b/src/models/room.ts @@ -21,17 +21,17 @@ import { DuplicateStrategy, IAddLiveEventOptions, EventTimelineSetHandlerMap, -} from "./event-timeline-set"; -import { Direction, EventTimeline } from "./event-timeline"; -import { getHttpUriForMxc } from "../content-repo"; -import { removeElement } from "../utils"; -import { normalize, noUnsafeEventProps } from "../utils"; -import { IEvent, IThreadBundledRelationship, MatrixEvent, MatrixEventEvent, MatrixEventHandlerMap } from "./event"; -import { EventStatus } from "./event-status"; -import { RoomMember } from "./room-member"; -import { IRoomSummary, RoomSummary } from "./room-summary"; -import { logger } from "../logger"; -import { TypedReEmitter } from "../ReEmitter"; +} 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 { EventStatus } from "./event-status.ts"; +import { RoomMember } from "./room-member.ts"; +import { IRoomSummary, RoomSummary } from "./room-summary.ts"; +import { logger } from "../logger.ts"; +import { TypedReEmitter } from "../ReEmitter.ts"; import { EventType, RoomCreateTypeField, @@ -40,12 +40,12 @@ import { EVENT_VISIBILITY_CHANGE_TYPE, RelationType, UNSIGNED_THREAD_ID_FIELD, -} from "../@types/event"; -import { MatrixClient, PendingEventOrdering } from "../client"; -import { GuestAccess, HistoryVisibility, JoinRule, ResizeMethod } from "../@types/partials"; -import { Filter, IFilterDefinition } from "../filter"; -import { RoomState, RoomStateEvent, RoomStateEventHandlerMap } from "./room-state"; -import { BeaconEvent, BeaconEventHandlerMap } from "./beacon"; +} 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 { Thread, ThreadEvent, @@ -54,23 +54,23 @@ import { THREAD_RELATION_TYPE, FILTER_RELATED_BY_SENDERS, ThreadFilterType, -} from "./thread"; +} from "./thread.ts"; import { CachedReceiptStructure, MAIN_ROOM_TIMELINE, Receipt, ReceiptContent, ReceiptType, -} from "../@types/read_receipts"; -import { IStateEventWithRoomId } from "../@types/search"; -import { RelationsContainer } from "./relations-container"; -import { ReadReceipt, synthesizeReceipt } from "./read-receipt"; -import { isPollEvent, Poll, PollEvent } from "./poll"; -import { RoomReceipts } from "./room-receipts"; -import { compareEventOrdering } from "./compare-event-ordering"; -import * as utils from "../utils"; -import { KnownMembership, Membership } from "../@types/membership"; -import { Capabilities, IRoomVersionsCapability, RoomVersionStability } from "../serverCapabilities"; +} from "../@types/read_receipts.ts"; +import { 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"; // 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 525b525fc..4677371a5 100644 --- a/src/models/search-result.ts +++ b/src/models/search-result.ts @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { EventContext } from "./event-context"; -import { EventMapper } from "../event-mapper"; -import { IResultContext, ISearchResult } from "../@types/search"; +import { EventContext } from "./event-context.ts"; +import { EventMapper } from "../event-mapper.ts"; +import { IResultContext, ISearchResult } from "../@types/search.ts"; export class SearchResult { /** diff --git a/src/models/thread.ts b/src/models/thread.ts index 6db967d4e..905c4db3c 100644 --- a/src/models/thread.ts +++ b/src/models/thread.ts @@ -16,19 +16,19 @@ limitations under the License. import { Optional } from "matrix-events-sdk"; -import { MatrixClient, PendingEventOrdering } from "../client"; -import { TypedReEmitter } from "../ReEmitter"; -import { RelationType } from "../@types/event"; -import { IThreadBundledRelationship, MatrixEvent, MatrixEventEvent } from "./event"; -import { Direction, EventTimeline } from "./event-timeline"; -import { EventTimelineSet, EventTimelineSetHandlerMap } from "./event-timeline-set"; -import { NotificationCountType, Room, RoomEvent } from "./room"; -import { RoomState } from "./room-state"; -import { ServerControlledNamespacedValue } from "../NamespacedValue"; -import { logger } from "../logger"; -import { ReadReceipt } from "./read-receipt"; -import { CachedReceiptStructure, Receipt, ReceiptType } from "../@types/read_receipts"; -import { Feature, ServerSupport } from "../feature"; +import { MatrixClient, PendingEventOrdering } from "../client.ts"; +import { TypedReEmitter } from "../ReEmitter.ts"; +import { RelationType } from "../@types/event.ts"; +import { 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 { 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 { Feature, ServerSupport } from "../feature.ts"; export enum ThreadEvent { New = "Thread.new", diff --git a/src/models/user.ts b/src/models/user.ts index 32614bedc..90005c2cf 100644 --- a/src/models/user.ts +++ b/src/models/user.ts @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixClient } from "../matrix"; -import { MatrixEvent } from "./event"; -import { TypedEventEmitter } from "./typed-event-emitter"; +import { MatrixClient } from "../matrix.ts"; +import { MatrixEvent } from "./event.ts"; +import { TypedEventEmitter } from "./typed-event-emitter.ts"; export enum UserEvent { DisplayName = "User.displayName", diff --git a/src/oidc/authorize.ts b/src/oidc/authorize.ts index c3ff2fcef..7e3692dfb 100644 --- a/src/oidc/authorize.ts +++ b/src/oidc/authorize.ts @@ -16,9 +16,9 @@ limitations under the License. import { IdTokenClaims, Log, OidcClient, SigninResponse, SigninState, WebStorageStateStore } from "oidc-client-ts"; -import { logger } from "../logger"; -import { randomString } from "../randomstring"; -import { OidcError } from "./error"; +import { logger } from "../logger.ts"; +import { randomString } from "../randomstring.ts"; +import { OidcError } from "./error.ts"; import { BearerTokenResponse, UserState, @@ -26,9 +26,9 @@ import { ValidatedIssuerMetadata, validateIdToken, validateStoredUserState, -} from "./validate"; -import { sha256 } from "../digest"; -import { encodeUnpaddedBase64Url } from "../base64"; +} from "./validate.ts"; +import { sha256 } from "../digest.ts"; +import { encodeUnpaddedBase64Url } from "../base64.ts"; // reexport for backwards compatibility export type { BearerTokenResponse }; diff --git a/src/oidc/discovery.ts b/src/oidc/discovery.ts index 7199c8715..656bb30a5 100644 --- a/src/oidc/discovery.ts +++ b/src/oidc/discovery.ts @@ -16,9 +16,9 @@ limitations under the License. import { MetadataService, OidcClientSettingsStore } from "oidc-client-ts"; -import { isValidatedIssuerMetadata, validateOIDCIssuerWellKnown } from "./validate"; -import { Method, timeoutSignal } from "../http-api"; -import { OidcClientConfig } from "./index"; +import { isValidatedIssuerMetadata, validateOIDCIssuerWellKnown } from "./validate.ts"; +import { Method, timeoutSignal } from "../http-api/index.ts"; +import { OidcClientConfig } from "./index.ts"; /** * @experimental diff --git a/src/oidc/index.ts b/src/oidc/index.ts index 7fc31836f..519b311a6 100644 --- a/src/oidc/index.ts +++ b/src/oidc/index.ts @@ -15,14 +15,14 @@ limitations under the License. */ import type { SigningKey } from "oidc-client-ts"; -import { ValidatedIssuerConfig, ValidatedIssuerMetadata } from "./validate"; +import { ValidatedIssuerConfig, ValidatedIssuerMetadata } from "./validate.ts"; -export * from "./authorize"; -export * from "./discovery"; -export * from "./error"; -export * from "./register"; -export * from "./tokenRefresher"; -export * from "./validate"; +export * from "./authorize.ts"; +export * from "./discovery.ts"; +export * from "./error.ts"; +export * from "./register.ts"; +export * from "./tokenRefresher.ts"; +export * from "./validate.ts"; /** * Validated config for native OIDC authentication, as returned by {@link discoverAndValidateOIDCIssuerWellKnown}. diff --git a/src/oidc/register.ts b/src/oidc/register.ts index ec673e797..25c3673d3 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 "."; -import { OidcError } from "./error"; -import { Method } from "../http-api"; -import { logger } from "../logger"; -import { NonEmptyArray } from "../@types/common"; +import { 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"; /** * Client metadata passed to registration endpoint diff --git a/src/oidc/tokenRefresher.ts b/src/oidc/tokenRefresher.ts index 84b773531..b75de5c2c 100644 --- a/src/oidc/tokenRefresher.ts +++ b/src/oidc/tokenRefresher.ts @@ -16,10 +16,10 @@ limitations under the License. import { IdTokenClaims, OidcClient, WebStorageStateStore } from "oidc-client-ts"; -import { AccessTokens } from "../http-api"; -import { generateScope } from "./authorize"; -import { discoverAndValidateOIDCIssuerWellKnown } from "./discovery"; -import { logger } from "../logger"; +import { AccessTokens } from "../http-api/index.ts"; +import { generateScope } from "./authorize.ts"; +import { discoverAndValidateOIDCIssuerWellKnown } from "./discovery.ts"; +import { logger } from "../logger.ts"; /** * @experimental diff --git a/src/oidc/validate.ts b/src/oidc/validate.ts index de50b570b..72eb7e96e 100644 --- a/src/oidc/validate.ts +++ b/src/oidc/validate.ts @@ -17,8 +17,8 @@ limitations under the License. import { jwtDecode } from "jwt-decode"; import { IdTokenClaims, OidcMetadata, SigninResponse } from "oidc-client-ts"; -import { logger } from "../logger"; -import { OidcError } from "./error"; +import { logger } from "../logger.ts"; +import { OidcError } from "./error.ts"; export type ValidatedIssuerConfig = { authorizationEndpoint: string; diff --git a/src/pushprocessor.ts b/src/pushprocessor.ts index 734a72751..be40c2d1e 100644 --- a/src/pushprocessor.ts +++ b/src/pushprocessor.ts @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { deepCompare, escapeRegExp, globToRegexp, isNullOrUndefined } from "./utils"; -import { logger } from "./logger"; -import { MatrixClient } from "./client"; -import { MatrixEvent } from "./models/event"; +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 { ConditionKind, IAnnotatedPushRule, @@ -38,8 +38,8 @@ import { PushRuleSet, RuleId, TweakName, -} from "./@types/PushRules"; -import { EventType } from "./@types/event"; +} from "./@types/PushRules.ts"; +import { EventType } from "./@types/event.ts"; const RULEKINDS_IN_ORDER = [ PushRuleKind.Override, diff --git a/src/randomstring.ts b/src/randomstring.ts index d095a2b9e..d0cc9e675 100644 --- a/src/randomstring.ts +++ b/src/randomstring.ts @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { encodeUnpaddedBase64Url } from "./base64"; +import { encodeUnpaddedBase64Url } from "./base64.ts"; const LOWERCASE = "abcdefghijklmnopqrstuvwxyz"; const UPPERCASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; diff --git a/src/realtime-callbacks.ts b/src/realtime-callbacks.ts index 1b03a579a..b59d14534 100644 --- a/src/realtime-callbacks.ts +++ b/src/realtime-callbacks.ts @@ -24,7 +24,7 @@ limitations under the License. * it will instead fire as soon as possible after resume. */ -import { logger } from "./logger"; +import { logger } from "./logger.ts"; // we schedule a callback at least this often, to check if we've missed out on // some wall-clock time due to being suspended. diff --git a/src/receipt-accumulator.ts b/src/receipt-accumulator.ts index ded358ad9..707b2ff27 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"; -import { EventType } from "./@types/event"; -import { isSupportedReceiptType, MapWithDefault, recursiveMapToObject } from "./utils"; -import { IContent } from "./models/event"; -import { ReceiptContent, ReceiptType } from "./@types/read_receipts"; +import { 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"; interface AccumulatedReceipt { data: IMinimalEvent; diff --git a/src/rendezvous/MSC3906Rendezvous.ts b/src/rendezvous/MSC3906Rendezvous.ts index 4a2c3fa33..a84a41d68 100644 --- a/src/rendezvous/MSC3906Rendezvous.ts +++ b/src/rendezvous/MSC3906Rendezvous.ts @@ -21,13 +21,13 @@ import { RendezvousFailureListener, LegacyRendezvousFailureReason as RendezvousFailureReason, RendezvousIntent, -} from "."; -import { MatrixClient, GET_LOGIN_TOKEN_CAPABILITY } from "../client"; -import { buildFeatureSupportMap, Feature, ServerSupport } from "../feature"; -import { logger } from "../logger"; -import { sleep } from "../utils"; -import { CrossSigningKey } from "../crypto-api"; -import { Capabilities, Device, IGetLoginTokenCapability } from "../matrix"; +} from "./index.ts"; +import { MatrixClient, GET_LOGIN_TOKEN_CAPABILITY } from "../client.ts"; +import { buildFeatureSupportMap, Feature, ServerSupport } from "../feature.ts"; +import { logger } from "../logger.ts"; +import { sleep } from "../utils.ts"; +import { CrossSigningKey } from "../crypto-api/index.ts"; +import { Capabilities, Device, IGetLoginTokenCapability } from "../matrix.ts"; enum PayloadType { Start = "m.login.start", diff --git a/src/rendezvous/MSC4108SignInWithQR.ts b/src/rendezvous/MSC4108SignInWithQR.ts index 827d5d088..a22b3149e 100644 --- a/src/rendezvous/MSC4108SignInWithQR.ts +++ b/src/rendezvous/MSC4108SignInWithQR.ts @@ -16,14 +16,19 @@ limitations under the License. import { QrCodeMode } from "@matrix-org/matrix-sdk-crypto-wasm"; -import { ClientRendezvousFailureReason, MSC4108FailureReason, RendezvousError, RendezvousFailureListener } from "."; -import { MatrixClient } from "../client"; -import { logger } from "../logger"; -import { MSC4108SecureChannel } from "./channels/MSC4108SecureChannel"; -import { MatrixError } from "../http-api"; -import { sleep } from "../utils"; -import { DEVICE_CODE_SCOPE, discoverAndValidateOIDCIssuerWellKnown, OidcClientConfig } from "../oidc"; -import { CryptoApi } from "../crypto-api"; +import { + ClientRendezvousFailureReason, + MSC4108FailureReason, + RendezvousError, + RendezvousFailureListener, +} from "./index.ts"; +import { MatrixClient } from "../client.ts"; +import { logger } from "../logger.ts"; +import { MSC4108SecureChannel } from "./channels/MSC4108SecureChannel.ts"; +import { MatrixError } from "../http-api/index.ts"; +import { sleep } from "../utils.ts"; +import { DEVICE_CODE_SCOPE, discoverAndValidateOIDCIssuerWellKnown, OidcClientConfig } from "../oidc/index.ts"; +import { 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 549ebc83f..ced8523bd 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 "."; +import { RendezvousCode, RendezvousIntent, RendezvousFailureReason } from "./index.ts"; export interface RendezvousChannel { /** diff --git a/src/rendezvous/RendezvousCode.ts b/src/rendezvous/RendezvousCode.ts index 86608aa1c..e5b89aae6 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 "."; +import { RendezvousTransportDetails, RendezvousIntent } from "./index.ts"; export interface RendezvousCode { intent: RendezvousIntent; diff --git a/src/rendezvous/RendezvousError.ts b/src/rendezvous/RendezvousError.ts index b3026d43b..502538fff 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 "."; +import { RendezvousFailureReason } from "./index.ts"; export class RendezvousError extends Error { public constructor( diff --git a/src/rendezvous/RendezvousTransport.ts b/src/rendezvous/RendezvousTransport.ts index 08905be65..a86db5fc0 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 "."; +import { RendezvousFailureListener, RendezvousFailureReason } from "./index.ts"; export interface RendezvousTransportDetails { type: string; diff --git a/src/rendezvous/channels/MSC3903ECDHv2RendezvousChannel.ts b/src/rendezvous/channels/MSC3903ECDHv2RendezvousChannel.ts index 42b4f7c99..47b8e3fd8 100644 --- a/src/rendezvous/channels/MSC3903ECDHv2RendezvousChannel.ts +++ b/src/rendezvous/channels/MSC3903ECDHv2RendezvousChannel.ts @@ -24,10 +24,10 @@ import { RendezvousIntent, RendezvousTransport, RendezvousTransportDetails, -} from ".."; -import { decodeBase64, encodeUnpaddedBase64 } from "../../base64"; -import { generateDecimalSas } from "../../crypto/verification/SASDecimal"; -import { UnstableValue } from "../../NamespacedValue"; +} from "../index.ts"; +import { decodeBase64, encodeUnpaddedBase64 } from "../../base64.ts"; +import { generateDecimalSas } from "../../crypto/verification/SASDecimal.ts"; +import { UnstableValue } from "../../NamespacedValue.ts"; const ECDH_V2 = new UnstableValue( "m.rendezvous.v2.curve25519-aes-sha256", diff --git a/src/rendezvous/channels/MSC4108SecureChannel.ts b/src/rendezvous/channels/MSC4108SecureChannel.ts index 717b54417..8165000e7 100644 --- a/src/rendezvous/channels/MSC4108SecureChannel.ts +++ b/src/rendezvous/channels/MSC4108SecureChannel.ts @@ -28,9 +28,9 @@ import { MSC4108Payload, RendezvousError, RendezvousFailureListener, -} from ".."; -import { MSC4108RendezvousSession } from "../transports/MSC4108RendezvousSession"; -import { logger } from "../../logger"; +} from "../index.ts"; +import { MSC4108RendezvousSession } from "../transports/MSC4108RendezvousSession.ts"; +import { logger } from "../../logger.ts"; /** * Prototype of the unstable [MSC4108](https://github.com/matrix-org/matrix-spec-proposals/pull/4108) diff --git a/src/rendezvous/channels/index.ts b/src/rendezvous/channels/index.ts index 793105a51..c525e2784 100644 --- a/src/rendezvous/channels/index.ts +++ b/src/rendezvous/channels/index.ts @@ -17,5 +17,5 @@ limitations under the License. /** * @deprecated in favour of MSC4108-based implementation */ -export * from "./MSC3903ECDHv2RendezvousChannel"; -export * from "./MSC4108SecureChannel"; +export * from "./MSC3903ECDHv2RendezvousChannel.ts"; +export * from "./MSC4108SecureChannel.ts"; diff --git a/src/rendezvous/index.ts b/src/rendezvous/index.ts index 1b887d9c3..5b8d83f51 100644 --- a/src/rendezvous/index.ts +++ b/src/rendezvous/index.ts @@ -17,13 +17,13 @@ limitations under the License. /** * @deprecated in favour of MSC4108-based implementation */ -export * from "./MSC3906Rendezvous"; -export * from "./MSC4108SignInWithQR"; -export * from "./RendezvousChannel"; -export * from "./RendezvousCode"; -export * from "./RendezvousError"; -export * from "./RendezvousFailureReason"; -export * from "./RendezvousIntent"; -export * from "./RendezvousTransport"; -export * from "./transports"; -export * from "./channels"; +export * from "./MSC3906Rendezvous.ts"; +export * from "./MSC4108SignInWithQR.ts"; +export * from "./RendezvousChannel.ts"; +export * from "./RendezvousCode.ts"; +export * from "./RendezvousError.ts"; +export * from "./RendezvousFailureReason.ts"; +export * from "./RendezvousIntent.ts"; +export * from "./RendezvousTransport.ts"; +export * from "./transports/index.ts"; +export * from "./channels/index.ts"; diff --git a/src/rendezvous/transports/MSC3886SimpleHttpRendezvousTransport.ts b/src/rendezvous/transports/MSC3886SimpleHttpRendezvousTransport.ts index 01575ed70..b8521eda4 100644 --- a/src/rendezvous/transports/MSC3886SimpleHttpRendezvousTransport.ts +++ b/src/rendezvous/transports/MSC3886SimpleHttpRendezvousTransport.ts @@ -16,16 +16,16 @@ limitations under the License. import { UnstableValue } from "matrix-events-sdk"; -import { logger } from "../../logger"; -import { sleep } from "../../utils"; +import { logger } from "../../logger.ts"; +import { sleep } from "../../utils.ts"; import { RendezvousFailureListener, LegacyRendezvousFailureReason as RendezvousFailureReason, RendezvousTransport, RendezvousTransportDetails, -} from ".."; -import { MatrixClient } from "../../matrix"; -import { ClientPrefix } from "../../http-api"; +} from "../index.ts"; +import { MatrixClient } from "../../matrix.ts"; +import { ClientPrefix } from "../../http-api/index.ts"; const TYPE = new UnstableValue("http.v1", "org.matrix.msc3886.http.v1"); diff --git a/src/rendezvous/transports/MSC4108RendezvousSession.ts b/src/rendezvous/transports/MSC4108RendezvousSession.ts index 8b18461ed..98091471f 100644 --- a/src/rendezvous/transports/MSC4108RendezvousSession.ts +++ b/src/rendezvous/transports/MSC4108RendezvousSession.ts @@ -14,11 +14,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { logger } from "../../logger"; -import { sleep } from "../../utils"; -import { ClientRendezvousFailureReason, MSC4108FailureReason, RendezvousFailureListener } from ".."; -import { MatrixClient, Method } from "../../matrix"; -import { ClientPrefix } from "../../http-api"; +import { logger } from "../../logger.ts"; +import { sleep } from "../../utils.ts"; +import { ClientRendezvousFailureReason, MSC4108FailureReason, RendezvousFailureListener } from "../index.ts"; +import { MatrixClient, Method } from "../../matrix.ts"; +import { ClientPrefix } from "../../http-api/index.ts"; /** * Prototype of the unstable [MSC4108](https://github.com/matrix-org/matrix-spec-proposals/pull/4108) diff --git a/src/rendezvous/transports/index.ts b/src/rendezvous/transports/index.ts index 09349dd25..88fe91ba1 100644 --- a/src/rendezvous/transports/index.ts +++ b/src/rendezvous/transports/index.ts @@ -17,5 +17,5 @@ limitations under the License. /** * @deprecated in favour of MSC4108-based implementation */ -export * from "./MSC3886SimpleHttpRendezvousTransport"; -export * from "./MSC4108RendezvousSession"; +export * from "./MSC3886SimpleHttpRendezvousTransport.ts"; +export * from "./MSC4108RendezvousSession.ts"; diff --git a/src/room-hierarchy.ts b/src/room-hierarchy.ts index 5c0b61d74..58e952545 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"; -import { IHierarchyRoom, IHierarchyRelation } from "./@types/spaces"; -import { MatrixClient } from "./client"; -import { EventType } from "./@types/event"; -import { MatrixError } from "./http-api"; +import { Room } from "./models/room.ts"; +import { IHierarchyRoom, IHierarchyRelation } from "./@types/spaces.ts"; +import { MatrixClient } from "./client.ts"; +import { EventType } from "./@types/event.ts"; +import { 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 7a994a8d0..76f7189db 100644 --- a/src/rust-crypto/CrossSigningIdentity.ts +++ b/src/rust-crypto/CrossSigningIdentity.ts @@ -17,11 +17,11 @@ 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 { BootstrapCrossSigningOpts } from "../crypto-api"; -import { logger } from "../logger"; -import { OutgoingRequestProcessor } from "./OutgoingRequestProcessor"; -import { UIAuthCallback } from "../interactive-auth"; -import { ServerSideSecretStorage } from "../secret-storage"; +import { 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"; /** Manages the cross-signing keys for our own user. * diff --git a/src/rust-crypto/DehydratedDeviceManager.ts b/src/rust-crypto/DehydratedDeviceManager.ts index cedac96a0..ca6be006f 100644 --- a/src/rust-crypto/DehydratedDeviceManager.ts +++ b/src/rust-crypto/DehydratedDeviceManager.ts @@ -16,13 +16,13 @@ limitations under the License. import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; -import { OutgoingRequestProcessor } from "./OutgoingRequestProcessor"; -import { encodeUri } from "../utils"; -import { IHttpOpts, MatrixError, MatrixHttpApi, Method } from "../http-api"; -import { IToDeviceEvent } from "../sync-accumulator"; -import { ServerSideSecretStorage } from "../secret-storage"; -import { decodeBase64, encodeUnpaddedBase64 } from "../base64"; -import { Logger } from "../logger"; +import { 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 { decodeBase64, encodeUnpaddedBase64 } from "../base64.ts"; +import { Logger } from "../logger.ts"; /** * The response body of `GET /_matrix/client/unstable/org.matrix.msc3814.v1/dehydrated_device`. diff --git a/src/rust-crypto/KeyClaimManager.ts b/src/rust-crypto/KeyClaimManager.ts index aaeed4d14..3023de8c2 100644 --- a/src/rust-crypto/KeyClaimManager.ts +++ b/src/rust-crypto/KeyClaimManager.ts @@ -16,8 +16,8 @@ limitations under the License. import { OlmMachine, UserId } from "@matrix-org/matrix-sdk-crypto-wasm"; -import { OutgoingRequestProcessor } from "./OutgoingRequestProcessor"; -import { LogSpan } from "../logger"; +import { OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts"; +import { 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 d3ae4d9c4..ec8e38fcf 100644 --- a/src/rust-crypto/OutgoingRequestProcessor.ts +++ b/src/rust-crypto/OutgoingRequestProcessor.ts @@ -27,13 +27,13 @@ import { UploadSigningKeysRequest, } from "@matrix-org/matrix-sdk-crypto-wasm"; -import { logger } from "../logger"; -import { calculateRetryBackoff, IHttpOpts, MatrixHttpApi, Method } from "../http-api"; -import { logDuration, QueryDict, sleep } from "../utils"; -import { AuthDict, UIAuthCallback } from "../interactive-auth"; -import { UIAResponse } from "../@types/uia"; -import { ToDeviceMessageId } from "../@types/event"; -import { UnstablePrefix as DehydrationUnstablePrefix } from "./DehydratedDeviceManager"; +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 { ToDeviceMessageId } from "../@types/event.ts"; +import { UnstablePrefix as DehydrationUnstablePrefix } from "./DehydratedDeviceManager.ts"; /** * Common interface for all the request types returned by `OlmMachine.outgoingRequests`. diff --git a/src/rust-crypto/OutgoingRequestsManager.ts b/src/rust-crypto/OutgoingRequestsManager.ts index 81b3001c8..72823d88b 100644 --- a/src/rust-crypto/OutgoingRequestsManager.ts +++ b/src/rust-crypto/OutgoingRequestsManager.ts @@ -16,9 +16,9 @@ limitations under the License. import { OlmMachine } from "@matrix-org/matrix-sdk-crypto-wasm"; -import { OutgoingRequest, OutgoingRequestProcessor } from "./OutgoingRequestProcessor"; -import { Logger } from "../logger"; -import { defer, IDeferred, logDuration } from "../utils"; +import { OutgoingRequest, OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts"; +import { Logger } from "../logger.ts"; +import { defer, 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 ad5a649c5..e463cbaa7 100644 --- a/src/rust-crypto/PerSessionKeyBackupDownloader.ts +++ b/src/rust-crypto/PerSessionKeyBackupDownloader.ts @@ -17,13 +17,13 @@ limitations under the License. import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; import { OlmMachine } from "@matrix-org/matrix-sdk-crypto-wasm"; -import { Curve25519AuthData, KeyBackupInfo, KeyBackupSession } from "../crypto-api/keybackup"; -import { Logger } from "../logger"; -import { ClientPrefix, IHttpOpts, MatrixError, MatrixHttpApi, Method } from "../http-api"; -import { RustBackupManager } from "./backup"; -import { CryptoEvent } from "../matrix"; -import { encodeUri, sleep } from "../utils"; -import { BackupDecryptor } from "../common-crypto/CryptoBackend"; +import { Curve25519AuthData, KeyBackupInfo, KeyBackupSession } from "../crypto-api/keybackup.ts"; +import { Logger } from "../logger.ts"; +import { ClientPrefix, IHttpOpts, MatrixError, MatrixHttpApi, Method } from "../http-api/index.ts"; +import { RustBackupManager } from "./backup.ts"; +import { CryptoEvent } from "../matrix.ts"; +import { encodeUri, sleep } from "../utils.ts"; +import { 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 68ee5f537..3b6a6c80c 100644 --- a/src/rust-crypto/RoomEncryptor.ts +++ b/src/rust-crypto/RoomEncryptor.ts @@ -26,16 +26,16 @@ import { UserId, } from "@matrix-org/matrix-sdk-crypto-wasm"; -import { EventType } from "../@types/event"; -import { IContent, MatrixEvent } from "../models/event"; -import { Room } from "../models/room"; -import { Logger, logger, LogSpan } from "../logger"; -import { KeyClaimManager } from "./KeyClaimManager"; -import { RoomMember } from "../models/room-member"; -import { HistoryVisibility } from "../@types/partials"; -import { OutgoingRequestsManager } from "./OutgoingRequestsManager"; -import { logDuration } from "../utils"; -import { KnownMembership } from "../@types/membership"; +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 { HistoryVisibility } from "../@types/partials.ts"; +import { OutgoingRequestsManager } from "./OutgoingRequestsManager.ts"; +import { logDuration } from "../utils.ts"; +import { KnownMembership } from "../@types/membership.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 8eb848874..c4407da21 100644 --- a/src/rust-crypto/backup.ts +++ b/src/rust-crypto/backup.ts @@ -24,19 +24,19 @@ import { KeyBackupInfo, KeyBackupSession, Curve25519SessionData, -} from "../crypto-api/keybackup"; -import { logger } from "../logger"; -import { ClientPrefix, IHttpOpts, MatrixError, MatrixHttpApi, Method } from "../http-api"; -import { CryptoEvent, IMegolmSessionData } from "../crypto"; -import { TypedEventEmitter } from "../models/typed-event-emitter"; -import { encodeUri, logDuration } from "../utils"; -import { OutgoingRequestProcessor } from "./OutgoingRequestProcessor"; -import { sleep } from "../utils"; -import { BackupDecryptor } from "../common-crypto/CryptoBackend"; -import { IEncryptedPayload } from "../crypto/aes"; -import { ImportRoomKeyProgressData, ImportRoomKeysOpts } from "../crypto-api"; -import { IKeyBackupInfo } from "../crypto/keybackup"; -import { IKeyBackup } from "../crypto/backup"; +} from "../crypto-api/keybackup.ts"; +import { logger } from "../logger.ts"; +import { ClientPrefix, IHttpOpts, MatrixError, MatrixHttpApi, Method } from "../http-api/index.ts"; +import { CryptoEvent, IMegolmSessionData } from "../crypto/index.ts"; +import { TypedEventEmitter } from "../models/typed-event-emitter.ts"; +import { encodeUri, logDuration } from "../utils.ts"; +import { OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts"; +import { sleep } from "../utils.ts"; +import { BackupDecryptor } from "../common-crypto/CryptoBackend.ts"; +import { IEncryptedPayload } from "../crypto/aes.ts"; +import { ImportRoomKeyProgressData, ImportRoomKeysOpts } from "../crypto-api/index.ts"; +import { IKeyBackupInfo } from "../crypto/keybackup.ts"; +import { IKeyBackup } from "../crypto/backup.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 587640cb0..80e8bd373 100644 --- a/src/rust-crypto/device-converter.ts +++ b/src/rust-crypto/device-converter.ts @@ -16,8 +16,8 @@ limitations under the License. import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; -import { Device, DeviceVerification } from "../models/device"; -import { DeviceKeys } from "../client"; +import { Device, DeviceVerification } from "../models/device.ts"; +import { 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 0c9e16210..61f15a192 100644 --- a/src/rust-crypto/index.ts +++ b/src/rust-crypto/index.ts @@ -17,17 +17,17 @@ limitations under the License. import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; import { StoreHandle } from "@matrix-org/matrix-sdk-crypto-wasm"; -import { RustCrypto } from "./rust-crypto"; -import { IHttpOpts, MatrixHttpApi } from "../http-api"; -import { ServerSideSecretStorage } from "../secret-storage"; -import { ICryptoCallbacks } from "../crypto"; -import { Logger } from "../logger"; -import { CryptoStore, MigrationState } from "../crypto/store/base"; +import { RustCrypto } from "./rust-crypto.ts"; +import { IHttpOpts, MatrixHttpApi } from "../http-api/index.ts"; +import { ServerSideSecretStorage } from "../secret-storage.ts"; +import { ICryptoCallbacks } from "../crypto/index.ts"; +import { Logger } from "../logger.ts"; +import { CryptoStore, MigrationState } from "../crypto/store/base.ts"; import { migrateFromLegacyCrypto, migrateLegacyLocalTrustIfNeeded, migrateRoomSettingsFromLegacyCrypto, -} from "./libolm_migration"; +} from "./libolm_migration.ts"; /** * Create a new `RustCrypto` implementation diff --git a/src/rust-crypto/libolm_migration.ts b/src/rust-crypto/libolm_migration.ts index ec0184726..50d92a626 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"; -import { CryptoStore, MigrationState, SecretStorePrivateKeys } from "../crypto/store/base"; -import { IndexedDBCryptoStore } from "../crypto/store/indexeddb-crypto-store"; -import { decryptAES, IEncryptedPayload } from "../crypto/aes"; -import { IHttpOpts, MatrixHttpApi } from "../http-api"; -import { requestKeyBackupVersion } from "./backup"; -import { IRoomEncryption } from "../crypto/RoomList"; -import { CrossSigningKeyInfo, Curve25519AuthData } from "../crypto-api"; -import { RustCrypto } from "./rust-crypto"; -import { KeyBackupInfo } from "../crypto-api/keybackup"; -import { sleep } from "../utils"; -import { encodeBase64 } from "../base64"; +import { Logger } from "../logger.ts"; +import { CryptoStore, MigrationState, SecretStorePrivateKeys } from "../crypto/store/base.ts"; +import { IndexedDBCryptoStore } from "../crypto/store/indexeddb-crypto-store.ts"; +import { decryptAES, IEncryptedPayload } from "../crypto/aes.ts"; +import { IHttpOpts, MatrixHttpApi } from "../http-api/index.ts"; +import { requestKeyBackupVersion } from "./backup.ts"; +import { IRoomEncryption } from "../crypto/RoomList.ts"; +import { CrossSigningKeyInfo, Curve25519AuthData } from "../crypto-api/index.ts"; +import { RustCrypto } from "./rust-crypto.ts"; +import { KeyBackupInfo } from "../crypto-api/keybackup.ts"; +import { sleep } from "../utils.ts"; +import { encodeBase64 } from "../base64.ts"; /** * Determine if any data needs migrating from the legacy store, and do so. diff --git a/src/rust-crypto/rust-crypto.ts b/src/rust-crypto/rust-crypto.ts index 988764828..2a4ba09c5 100644 --- a/src/rust-crypto/rust-crypto.ts +++ b/src/rust-crypto/rust-crypto.ts @@ -17,20 +17,25 @@ limitations under the License. import anotherjson from "another-json"; import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; -import type { IEventDecryptionResult, IMegolmSessionData } from "../@types/crypto"; -import { KnownMembership } from "../@types/membership"; -import type { IDeviceLists, IToDeviceEvent } from "../sync-accumulator"; -import type { IEncryptedEventInfo } from "../crypto/api"; -import { MatrixEvent, MatrixEventEvent } from "../models/event"; -import { Room } from "../models/room"; -import { RoomMember } from "../models/room-member"; -import { BackupDecryptor, CryptoBackend, DecryptionError, OnSyncCompletedData } from "../common-crypto/CryptoBackend"; -import { logger, Logger } from "../logger"; -import { IHttpOpts, MatrixHttpApi, Method } from "../http-api"; -import { RoomEncryptor } from "./RoomEncryptor"; -import { OutgoingRequestProcessor } from "./OutgoingRequestProcessor"; -import { KeyClaimManager } from "./KeyClaimManager"; -import { logDuration, MapWithDefault } from "../utils"; +import type { IEventDecryptionResult, IMegolmSessionData } from "../@types/crypto.ts"; +import { KnownMembership } from "../@types/membership.ts"; +import type { IDeviceLists, IToDeviceEvent } from "../sync-accumulator.ts"; +import type { IEncryptedEventInfo } from "../crypto/api.ts"; +import { MatrixEvent, MatrixEventEvent } from "../models/event.ts"; +import { Room } from "../models/room.ts"; +import { RoomMember } from "../models/room-member.ts"; +import { + BackupDecryptor, + CryptoBackend, + DecryptionError, + OnSyncCompletedData, +} from "../common-crypto/CryptoBackend.ts"; +import { logger, Logger } from "../logger.ts"; +import { IHttpOpts, 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, @@ -53,29 +58,29 @@ import { OwnDeviceKeys, UserVerificationStatus, VerificationRequest, -} from "../crypto-api"; -import { deviceKeysToDeviceMap, rustDeviceToJsDevice } from "./device-converter"; -import { IDownloadKeyResult, IQueryKeysRequest } from "../client"; -import { Device, DeviceMap } from "../models/device"; -import { SECRET_STORAGE_ALGORITHM_V1_AES, ServerSideSecretStorage } from "../secret-storage"; -import { CrossSigningIdentity } from "./CrossSigningIdentity"; -import { secretStorageCanAccessSecrets, secretStorageContainsCrossSigningKeys } from "./secret-storage"; -import { keyFromPassphrase } from "../crypto/key_passphrase"; -import { encodeRecoveryKey } from "../crypto/recoverykey"; -import { isVerificationEvent, RustVerificationRequest, verificationMethodIdentifierToMethod } from "./verification"; -import { EventType, MsgType } from "../@types/event"; -import { CryptoEvent } from "../crypto"; -import { TypedEventEmitter } from "../models/typed-event-emitter"; -import { RustBackupCryptoEventMap, RustBackupCryptoEvents, RustBackupManager } from "./backup"; -import { TypedReEmitter } from "../ReEmitter"; -import { randomString } from "../randomstring"; -import { ClientStoppedError } from "../errors"; -import { ISignatures } from "../@types/signed"; -import { encodeBase64 } from "../base64"; -import { OutgoingRequestsManager } from "./OutgoingRequestsManager"; -import { PerSessionKeyBackupDownloader } from "./PerSessionKeyBackupDownloader"; -import { DehydratedDeviceManager } from "./DehydratedDeviceManager"; -import { VerificationMethod } from "../types"; +} 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, ServerSideSecretStorage } from "../secret-storage.ts"; +import { CrossSigningIdentity } from "./CrossSigningIdentity.ts"; +import { secretStorageCanAccessSecrets, secretStorageContainsCrossSigningKeys } from "./secret-storage.ts"; +import { keyFromPassphrase } from "../crypto/key_passphrase.ts"; +import { encodeRecoveryKey } from "../crypto/recoverykey.ts"; +import { isVerificationEvent, RustVerificationRequest, verificationMethodIdentifierToMethod } from "./verification.ts"; +import { EventType, MsgType } from "../@types/event.ts"; +import { CryptoEvent } from "../crypto/index.ts"; +import { TypedEventEmitter } from "../models/typed-event-emitter.ts"; +import { RustBackupCryptoEventMap, RustBackupCryptoEvents, RustBackupManager } from "./backup.ts"; +import { TypedReEmitter } from "../ReEmitter.ts"; +import { randomString } from "../randomstring.ts"; +import { ClientStoppedError } from "../errors.ts"; +import { ISignatures } from "../@types/signed.ts"; +import { encodeBase64 } from "../base64.ts"; +import { OutgoingRequestsManager } from "./OutgoingRequestsManager.ts"; +import { PerSessionKeyBackupDownloader } from "./PerSessionKeyBackupDownloader.ts"; +import { DehydratedDeviceManager } from "./DehydratedDeviceManager.ts"; +import { VerificationMethod } from "../types.ts"; const ALL_VERIFICATION_METHODS = [ VerificationMethod.Sas, diff --git a/src/rust-crypto/secret-storage.ts b/src/rust-crypto/secret-storage.ts index e35a63f3b..951eae762 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 { ServerSideSecretStorage } from "../secret-storage"; +import { 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 ca599f310..284bcc61e 100644 --- a/src/rust-crypto/verification.ts +++ b/src/rust-crypto/verification.ts @@ -28,14 +28,14 @@ import { Verifier, VerifierEvent, VerifierEventHandlerMap, -} from "../crypto-api/verification"; -import { TypedEventEmitter } from "../models/typed-event-emitter"; -import { OutgoingRequest, OutgoingRequestProcessor } from "./OutgoingRequestProcessor"; -import { TypedReEmitter } from "../ReEmitter"; -import { MatrixEvent } from "../models/event"; -import { EventType, MsgType } from "../@types/event"; -import { defer, IDeferred } from "../utils"; -import { VerificationMethod } from "../types"; +} from "../crypto-api/verification.ts"; +import { TypedEventEmitter } from "../models/typed-event-emitter.ts"; +import { OutgoingRequest, OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts"; +import { TypedReEmitter } from "../ReEmitter.ts"; +import { MatrixEvent } from "../models/event.ts"; +import { EventType, MsgType } from "../@types/event.ts"; +import { defer, IDeferred } from "../utils.ts"; +import { VerificationMethod } from "../types.ts"; /** * An incoming, or outgoing, request to verify a user or a device via cross-signing. diff --git a/src/scheduler.ts b/src/scheduler.ts index 6dfd212c7..e854a6769 100644 --- a/src/scheduler.ts +++ b/src/scheduler.ts @@ -18,12 +18,12 @@ limitations under the License. * This is an internal module which manages queuing, scheduling and retrying * of requests. */ -import { logger } from "./logger"; -import { MatrixEvent } from "./models/event"; -import { EventType } from "./@types/event"; -import { defer, IDeferred, removeElement } from "./utils"; -import { calculateRetryBackoff, MatrixError } from "./http-api"; -import { ISendEventResponse } from "./@types/requests"; +import { logger } from "./logger.ts"; +import { 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"; const DEBUG = false; // set true to enable console logging. diff --git a/src/secret-storage.ts b/src/secret-storage.ts index 71ef30856..82dd4272e 100644 --- a/src/secret-storage.ts +++ b/src/secret-storage.ts @@ -20,12 +20,12 @@ limitations under the License. * @see https://spec.matrix.org/v1.6/client-server-api/#storage */ -import { TypedEventEmitter } from "./models/typed-event-emitter"; -import { ClientEvent, ClientEventHandlerMap } from "./client"; -import { MatrixEvent } from "./models/event"; -import { calculateKeyCheck, decryptAES, encryptAES, IEncryptedPayload } from "./crypto/aes"; -import { randomString } from "./randomstring"; -import { logger } from "./logger"; +import { TypedEventEmitter } from "./models/typed-event-emitter.ts"; +import { ClientEvent, ClientEventHandlerMap } from "./client.ts"; +import { MatrixEvent } from "./models/event.ts"; +import { calculateKeyCheck, decryptAES, encryptAES, IEncryptedPayload } from "./crypto/aes.ts"; +import { randomString } from "./randomstring.ts"; +import { logger } from "./logger.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 845d2e9ac..c23c9c72e 100644 --- a/src/serverCapabilities.ts +++ b/src/serverCapabilities.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IHttpOpts, MatrixHttpApi, Method } from "./http-api"; -import { logger } from "./logger"; +import { IHttpOpts, MatrixHttpApi, Method } from "./http-api/index.ts"; +import { logger } from "./logger.ts"; // How often we update the server capabilities. // 6 hours - an arbitrary value, but they should change very infrequently. diff --git a/src/sliding-sync-sdk.ts b/src/sliding-sync-sdk.ts index 4a99cc4e7..4c0798473 100644 --- a/src/sliding-sync-sdk.ts +++ b/src/sliding-sync-sdk.ts @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -import type { SyncCryptoCallbacks } from "./common-crypto/CryptoBackend"; -import { NotificationCountType, Room, RoomEvent } from "./models/room"; -import { logger } from "./logger"; -import { promiseMapSeries } from "./utils"; -import { EventTimeline } from "./models/event-timeline"; -import { ClientEvent, IStoredClientOpts, MatrixClient } from "./client"; +import type { SyncCryptoCallbacks } from "./common-crypto/CryptoBackend.ts"; +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 { ISyncStateData, SyncState, @@ -28,11 +28,11 @@ import { defaultClientOpts, defaultSyncApiOpts, SetPresence, -} from "./sync"; -import { MatrixEvent } from "./models/event"; -import { Crypto } from "./crypto"; -import { IMinimalEvent, IRoomEvent, IStateEvent, IStrippedState, ISyncResponse } from "./sync-accumulator"; -import { MatrixError } from "./http-api"; +} from "./sync.ts"; +import { MatrixEvent } from "./models/event.ts"; +import { Crypto } from "./crypto/index.ts"; +import { IMinimalEvent, IRoomEvent, IStateEvent, IStrippedState, ISyncResponse } from "./sync-accumulator.ts"; +import { MatrixError } from "./http-api/index.ts"; import { Extension, ExtensionState, @@ -41,12 +41,12 @@ import { SlidingSync, SlidingSyncEvent, SlidingSyncState, -} from "./sliding-sync"; -import { EventType } from "./@types/event"; -import { IPushRules } from "./@types/PushRules"; -import { RoomStateEvent } from "./models/room-state"; -import { RoomMemberEvent } from "./models/room-member"; -import { KnownMembership } from "./@types/membership"; +} from "./sliding-sync.ts"; +import { EventType } from "./@types/event.ts"; +import { 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"; // Number of consecutive failed syncs that will lead to a syncState of ERROR as opposed // to RECONNECTING. This is needed to inform the client of server issues when the diff --git a/src/sliding-sync.ts b/src/sliding-sync.ts index 12da3d704..487c447a2 100644 --- a/src/sliding-sync.ts +++ b/src/sliding-sync.ts @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { logger } from "./logger"; -import { MatrixClient } from "./client"; -import { IRoomEvent, IStateEvent } from "./sync-accumulator"; -import { TypedEventEmitter } from "./models/typed-event-emitter"; -import { sleep, IDeferred, defer } from "./utils"; -import { HTTPError } from "./http-api"; +import { logger } from "./logger.ts"; +import { MatrixClient } from "./client.ts"; +import { IRoomEvent, 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"; // /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 fbb66b006..648707533 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"; -import { Room } from "../models/room"; -import { User } from "../models/user"; -import { IEvent, MatrixEvent } from "../models/event"; -import { Filter } from "../filter"; -import { RoomSummary } from "../models/room-summary"; -import { IMinimalEvent, IRooms, ISyncResponse } from "../sync-accumulator"; -import { IStartClientOpts } from "../client"; -import { IStateEventWithRoomId } from "../@types/search"; -import { IndexedToDeviceBatch, ToDeviceBatchWithTxnId } from "../models/ToDeviceMessage"; -import { EventEmitterEvents } from "../models/typed-event-emitter"; +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"; export interface ISavedSync { nextBatch: string; diff --git a/src/store/indexeddb-backend.ts b/src/store/indexeddb-backend.ts index c93afb9e7..e5e1dff5b 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"; -import { IEvent, IStateEventWithRoomId, IStoredClientOpts, ISyncResponse } from "../matrix"; -import { IndexedToDeviceBatch, ToDeviceBatchWithTxnId } from "../models/ToDeviceMessage"; +import { ISavedSync } from "./index.ts"; +import { IEvent, IStateEventWithRoomId, IStoredClientOpts, ISyncResponse } from "../matrix.ts"; +import { IndexedToDeviceBatch, 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 f9e51e4ff..036738038 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"; -import { deepCopy, promiseTry } from "../utils"; -import { exists as idbExists } from "../indexeddb-helpers"; -import { logger } from "../logger"; -import { IStateEventWithRoomId, IStoredClientOpts } from "../matrix"; -import { ISavedSync } from "./index"; -import { IIndexedDBBackend, UserTuple } from "./indexeddb-backend"; -import { IndexedToDeviceBatch, ToDeviceBatchWithTxnId } from "../models/ToDeviceMessage"; +import { IMinimalEvent, ISyncData, 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"; 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 e3285afec..1bb9e19c8 100644 --- a/src/store/indexeddb-remote-backend.ts +++ b/src/store/indexeddb-remote-backend.ts @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { logger } from "../logger"; -import { defer, IDeferred } from "../utils"; -import { ISavedSync } from "./index"; -import { IStoredClientOpts } from "../client"; -import { IStateEventWithRoomId, ISyncResponse } from "../matrix"; -import { IIndexedDBBackend, UserTuple } from "./indexeddb-backend"; -import { IndexedToDeviceBatch, ToDeviceBatchWithTxnId } from "../models/ToDeviceMessage"; +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"; export class RemoteIndexedDBStoreBackend implements IIndexedDBBackend { private worker?: Worker; diff --git a/src/store/indexeddb-store-worker.ts b/src/store/indexeddb-store-worker.ts index 52a7fa6bf..36c6ee676 100644 --- a/src/store/indexeddb-store-worker.ts +++ b/src/store/indexeddb-store-worker.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { LocalIndexedDBStoreBackend } from "./indexeddb-local-backend"; -import { logger } from "../logger"; +import { LocalIndexedDBStoreBackend } from "./indexeddb-local-backend.ts"; +import { logger } from "../logger.ts"; interface ICmd { command: string; diff --git a/src/store/indexeddb.ts b/src/store/indexeddb.ts index 33132a17b..67d219e2b 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"; -import { LocalIndexedDBStoreBackend } from "./indexeddb-local-backend"; -import { RemoteIndexedDBStoreBackend } from "./indexeddb-remote-backend"; -import { IEvent, MatrixEvent } from "../models/event"; -import { logger } from "../logger"; -import { ISavedSync } from "./index"; -import { IIndexedDBBackend } from "./indexeddb-backend"; -import { ISyncResponse } from "../sync-accumulator"; -import { TypedEventEmitter } from "../models/typed-event-emitter"; -import { IStateEventWithRoomId } from "../@types/search"; -import { IndexedToDeviceBatch, ToDeviceBatchWithTxnId } from "../models/ToDeviceMessage"; -import { IStoredClientOpts } from "../client"; +import { MemoryStore, 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 { logger } from "../logger.ts"; +import { ISavedSync } from "./index.ts"; +import { IIndexedDBBackend } from "./indexeddb-backend.ts"; +import { ISyncResponse } from "../sync-accumulator.ts"; +import { 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"; /** * This is an internal module. See {@link IndexedDBStore} for the public class. diff --git a/src/store/local-storage-events-emitter.ts b/src/store/local-storage-events-emitter.ts index adb70cb54..03900a70e 100644 --- a/src/store/local-storage-events-emitter.ts +++ b/src/store/local-storage-events-emitter.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { TypedEventEmitter } from "../models/typed-event-emitter"; +import { TypedEventEmitter } from "../models/typed-event-emitter.ts"; export enum LocalStorageErrors { Global = "Global", diff --git a/src/store/memory.ts b/src/store/memory.ts index 7251be1c6..3021c23eb 100644 --- a/src/store/memory.ts +++ b/src/store/memory.ts @@ -18,21 +18,21 @@ limitations under the License. * This is an internal module. See {@link MemoryStore} for the public class. */ -import { EventType } from "../@types/event"; -import { Room } from "../models/room"; -import { User } from "../models/user"; -import { IEvent, MatrixEvent } from "../models/event"; -import { RoomState, RoomStateEvent } from "../models/room-state"; -import { RoomMember } from "../models/room-member"; -import { Filter } from "../filter"; -import { ISavedSync, IStore, UserCreator } from "./index"; -import { RoomSummary } from "../models/room-summary"; -import { ISyncResponse } from "../sync-accumulator"; -import { IStateEventWithRoomId } from "../@types/search"; -import { IndexedToDeviceBatch, ToDeviceBatchWithTxnId } from "../models/ToDeviceMessage"; -import { IStoredClientOpts } from "../client"; -import { MapWithDefault } from "../utils"; -import { KnownMembership } from "../@types/membership"; +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 { MapWithDefault } from "../utils.ts"; +import { KnownMembership } from "../@types/membership.ts"; function isValidFilterId(filterId?: string | number | null): boolean { const isValidStr = diff --git a/src/store/stub.ts b/src/store/stub.ts index c320d78b1..72b0acff0 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"; -import { Room } from "../models/room"; -import { User } from "../models/user"; -import { IEvent, MatrixEvent } from "../models/event"; -import { Filter } from "../filter"; -import { ISavedSync, IStore, UserCreator } from "./index"; -import { RoomSummary } from "../models/room-summary"; -import { ISyncResponse } from "../sync-accumulator"; -import { IStateEventWithRoomId } from "../@types/search"; -import { IndexedToDeviceBatch, ToDeviceBatch } from "../models/ToDeviceMessage"; -import { IStoredClientOpts } from "../client"; +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"; /** * 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 0f901a27e..d66a497f8 100644 --- a/src/sync-accumulator.ts +++ b/src/sync-accumulator.ts @@ -18,13 +18,13 @@ limitations under the License. * This is an internal module. See {@link SyncAccumulator} for the public class. */ -import { logger } from "./logger"; -import { deepCopy } from "./utils"; -import { IContent, IUnsigned } from "./models/event"; -import { IRoomSummary } from "./models/room-summary"; -import { EventType } from "./@types/event"; -import { UNREAD_THREAD_NOTIFICATIONS } from "./@types/sync"; -import { ReceiptAccumulator } from "./receipt-accumulator"; +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 { UNREAD_THREAD_NOTIFICATIONS } from "./@types/sync.ts"; +import { ReceiptAccumulator } from "./receipt-accumulator.ts"; interface IOpts { /** diff --git a/src/sync.ts b/src/sync.ts index df7aeba69..47be1ebc8 100644 --- a/src/sync.ts +++ b/src/sync.ts @@ -25,14 +25,14 @@ limitations under the License. import { Optional } from "matrix-events-sdk"; -import type { SyncCryptoCallbacks } from "./common-crypto/CryptoBackend"; -import { User } from "./models/user"; -import { NotificationCountType, Room, RoomEvent } from "./models/room"; -import { deepCopy, defer, IDeferred, noUnsafeEventProps, promiseMapSeries, unsafeProp } from "./utils"; -import { Filter } from "./filter"; -import { EventTimeline } from "./models/event-timeline"; -import { logger } from "./logger"; -import { ClientEvent, IStoredClientOpts, MatrixClient, PendingEventOrdering, ResetTimelineCallback } from "./client"; +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 { 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, @@ -47,20 +47,20 @@ import { ISyncResponse, ITimeline, IToDeviceEvent, -} from "./sync-accumulator"; -import { MatrixEvent } from "./models/event"; -import { MatrixError, Method } from "./http-api"; -import { ISavedSync } from "./store"; -import { EventType } from "./@types/event"; -import { IPushRules } from "./@types/PushRules"; -import { RoomStateEvent, IMarkerFoundOptions } from "./models/room-state"; -import { RoomMemberEvent } from "./models/room-member"; -import { BeaconEvent } from "./models/beacon"; -import { IEventsResponse } from "./@types/requests"; -import { UNREAD_THREAD_NOTIFICATIONS } from "./@types/sync"; -import { Feature, ServerSupport } from "./feature"; -import { Crypto } from "./crypto"; -import { KnownMembership } from "./@types/membership"; +} 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 { EventType } from "./@types/event.ts"; +import { IPushRules } from "./@types/PushRules.ts"; +import { RoomStateEvent, 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 { UNREAD_THREAD_NOTIFICATIONS } from "./@types/sync.ts"; +import { Feature, ServerSupport } from "./feature.ts"; +import { 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 cce364948..ba609ad09 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"; -import { RoomMember } from "./models/room-member"; -import { EventType } from "./@types/event"; -import { DecryptionError } from "./crypto/algorithms"; -import { DecryptionFailureCode } from "./crypto-api"; -import { EventDecryptionResult } from "./common-crypto/CryptoBackend"; +import { IContent, IEvent, IUnsigned, MatrixEvent } from "./models/event.ts"; +import { RoomMember } from "./models/room-member.ts"; +import { EventType } from "./@types/event.ts"; +import { DecryptionError } from "./crypto/algorithms/index.ts"; +import { DecryptionFailureCode } from "./crypto-api/index.ts"; +import { EventDecryptionResult } from "./common-crypto/CryptoBackend.ts"; /** * Create a {@link MatrixEvent}. diff --git a/src/thread-utils.ts b/src/thread-utils.ts index 51412592f..3362c0060 100644 --- a/src/thread-utils.ts +++ b/src/thread-utils.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { THREAD_RELATION_TYPE } from "./models/thread"; -import { IEvent } from "./models/event"; +import { THREAD_RELATION_TYPE } from "./models/thread.ts"; +import { 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 793b68e7d..7e961beef 100644 --- a/src/timeline-window.ts +++ b/src/timeline-window.ts @@ -16,12 +16,12 @@ limitations under the License. import { Optional } from "matrix-events-sdk"; -import { Direction, EventTimeline } from "./models/event-timeline"; -import { logger } from "./logger"; -import { MatrixClient } from "./client"; -import { EventTimelineSet } from "./models/event-timeline-set"; -import { MatrixEvent } from "./models/event"; -import { Room, RoomEvent } from "./models/room"; +import { 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"; /** * @internal diff --git a/src/types.ts b/src/types.ts index c1469b170..24f162042 100644 --- a/src/types.ts +++ b/src/types.ts @@ -21,11 +21,11 @@ limitations under the License. * Remember to only export *public* types from this file. */ -export type * from "./@types/media"; -export * from "./@types/membership"; -export type * from "./@types/event"; -export type * from "./@types/events"; -export type * from "./@types/state_events"; +export type * from "./@types/media.ts"; +export * from "./@types/membership.ts"; +export type * from "./@types/event.ts"; +export type * from "./@types/events.ts"; +export type * from "./@types/state_events.ts"; /** The different methods for device and user verification */ export enum VerificationMethod { diff --git a/src/utils.ts b/src/utils.ts index 0451307d1..ce7c5016b 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -22,10 +22,10 @@ import unhomoglyph from "unhomoglyph"; import promiseRetry from "p-retry"; import { Optional } from "matrix-events-sdk"; -import { IEvent, MatrixEvent } from "./models/event"; -import { M_TIMESTAMP } from "./@types/location"; -import { ReceiptType } from "./@types/read_receipts"; -import { BaseLogger } from "./logger"; +import { IEvent, MatrixEvent } from "./models/event.ts"; +import { M_TIMESTAMP } from "./@types/location.ts"; +import { ReceiptType } from "./@types/read_receipts.ts"; +import { BaseLogger } from "./logger.ts"; const interns = new Map(); diff --git a/src/webrtc/call.ts b/src/webrtc/call.ts index 3f5c61a9e..6a8a15e06 100644 --- a/src/webrtc/call.ts +++ b/src/webrtc/call.ts @@ -24,12 +24,12 @@ limitations under the License. import { v4 as uuidv4 } from "uuid"; import { parse as parseSdp, write as writeSdp } from "sdp-transform"; -import { logger } from "../logger"; -import { checkObjectHasKeys, isNullOrUndefined, recursivelyAssign } from "../utils"; -import { MatrixEvent } from "../models/event"; -import { EventType, TimelineEvents, ToDeviceMessageId } from "../@types/event"; -import { RoomMember } from "../models/room-member"; -import { randomString } from "../randomstring"; +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 { randomString } from "../randomstring.ts"; import { MCallReplacesEvent, MCallAnswer, @@ -44,15 +44,15 @@ import { MCallCandidates, MCallBase, MCallHangupReject, -} from "./callEventTypes"; -import { CallFeed } from "./callFeed"; -import { MatrixClient } from "../client"; -import { EventEmitterEvents, TypedEventEmitter } from "../models/typed-event-emitter"; -import { DeviceInfo } from "../crypto/deviceinfo"; -import { GroupCallUnknownDeviceError } from "./groupCall"; -import { IScreensharingOpts } from "./mediaHandler"; -import { MatrixError } from "../http-api"; -import { GroupCallStats } from "./stats/groupCallStats"; +} from "./callEventTypes.ts"; +import { CallFeed } from "./callFeed.ts"; +import { 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 { MatrixError } from "../http-api/index.ts"; +import { 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 4ee183a7f..c9cde3bd3 100644 --- a/src/webrtc/callEventHandler.ts +++ b/src/webrtc/callEventHandler.ts @@ -14,14 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixEvent } from "../models/event"; -import { logger } from "../logger"; -import { CallDirection, CallError, CallErrorCode, CallState, createNewMatrixCall, MatrixCall } from "./call"; -import { EventType } from "../@types/event"; -import { ClientEvent, MatrixClient } from "../client"; -import { MCallAnswer, MCallHangupReject } from "./callEventTypes"; -import { GroupCall, GroupCallErrorCode, GroupCallEvent, GroupCallUnknownDeviceError } from "./groupCall"; -import { RoomEvent } from "../models/room"; +import { MatrixEvent } from "../models/event.ts"; +import { logger } from "../logger.ts"; +import { CallDirection, CallError, CallErrorCode, CallState, createNewMatrixCall, 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 { RoomEvent } from "../models/room.ts"; // Don't ring unless we'd be ringing for at least 3 seconds: the user needs some // time to press the 'accept' button diff --git a/src/webrtc/callEventTypes.ts b/src/webrtc/callEventTypes.ts index 0be2b2d4d..c54e3ead8 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"; +import { 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 a9cf7a7a9..9ae3c3441 100644 --- a/src/webrtc/callFeed.ts +++ b/src/webrtc/callFeed.ts @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { SDPStreamMetadataPurpose } from "./callEventTypes"; -import { acquireContext, releaseContext } from "./audioContext"; -import { MatrixClient } from "../client"; -import { RoomMember } from "../models/room-member"; -import { logger } from "../logger"; -import { TypedEventEmitter } from "../models/typed-event-emitter"; -import { CallEvent, CallState, MatrixCall } from "./call"; +import { SDPStreamMetadataPurpose } from "./callEventTypes.ts"; +import { acquireContext, releaseContext } from "./audioContext.ts"; +import { MatrixClient } from "../client.ts"; +import { 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"; const POLLING_INTERVAL = 200; // ms export const SPEAKING_THRESHOLD = -60; // dB diff --git a/src/webrtc/groupCall.ts b/src/webrtc/groupCall.ts index 816a4a366..5fd6985cc 100644 --- a/src/webrtc/groupCall.ts +++ b/src/webrtc/groupCall.ts @@ -1,6 +1,6 @@ -import { TypedEventEmitter } from "../models/typed-event-emitter"; -import { CallFeed, SPEAKING_THRESHOLD } from "./callFeed"; -import { MatrixClient, IMyDevice } from "../client"; +import { TypedEventEmitter } from "../models/typed-event-emitter.ts"; +import { CallFeed, SPEAKING_THRESHOLD } from "./callFeed.ts"; +import { MatrixClient, IMyDevice } from "../client.ts"; import { CallErrorCode, CallEvent, @@ -11,31 +11,31 @@ import { setTracksEnabled, createNewMatrixCall, CallError, -} from "./call"; -import { RoomMember } from "../models/room-member"; -import { Room } from "../models/room"; -import { RoomStateEvent } from "../models/room-state"; -import { logger } from "../logger"; -import { ReEmitter } from "../ReEmitter"; -import { SDPStreamMetadataPurpose } from "./callEventTypes"; -import { MatrixEvent } from "../models/event"; -import { EventType } from "../@types/event"; -import { CallEventHandlerEvent } from "./callEventHandler"; -import { GroupCallEventHandlerEvent } from "./groupCallEventHandler"; -import { IScreensharingOpts } from "./mediaHandler"; -import { mapsEqual } from "../utils"; -import { GroupCallStats } from "./stats/groupCallStats"; +} from "./call.ts"; +import { RoomMember } from "../models/room-member.ts"; +import { 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 { EventType } from "../@types/event.ts"; +import { CallEventHandlerEvent } from "./callEventHandler.ts"; +import { GroupCallEventHandlerEvent } from "./groupCallEventHandler.ts"; +import { IScreensharingOpts } from "./mediaHandler.ts"; +import { mapsEqual } from "../utils.ts"; +import { GroupCallStats } from "./stats/groupCallStats.ts"; import { ByteSentStatsReport, CallFeedReport, ConnectionStatsReport, StatsReport, SummaryStatsReport, -} from "./stats/statsReport"; -import { SummaryStatsReportGatherer } from "./stats/summaryStatsReportGatherer"; -import { CallFeedStatsReporter } from "./stats/callFeedStatsReporter"; -import { KnownMembership } from "../@types/membership"; -import { CallMembershipData } from "../matrixrtc/CallMembership"; +} from "./stats/statsReport.ts"; +import { SummaryStatsReportGatherer } from "./stats/summaryStatsReportGatherer.ts"; +import { CallFeedStatsReporter } from "./stats/callFeedStatsReporter.ts"; +import { KnownMembership } from "../@types/membership.ts"; +import { CallMembershipData } from "../matrixrtc/CallMembership.ts"; export enum GroupCallIntent { Ring = "m.ring", diff --git a/src/webrtc/groupCallEventHandler.ts b/src/webrtc/groupCallEventHandler.ts index 2db54f66b..d0ce6af05 100644 --- a/src/webrtc/groupCallEventHandler.ts +++ b/src/webrtc/groupCallEventHandler.ts @@ -14,15 +14,15 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixEvent } from "../models/event"; -import { MatrixClient, ClientEvent } from "../client"; -import { GroupCall, GroupCallIntent, GroupCallType, IGroupCallDataChannelOptions } from "./groupCall"; -import { Room } from "../models/room"; -import { RoomState, RoomStateEvent } from "../models/room-state"; -import { RoomMember } from "../models/room-member"; -import { logger } from "../logger"; -import { EventType } from "../@types/event"; -import { SyncState } from "../sync"; +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 { logger } from "../logger.ts"; +import { EventType } from "../@types/event.ts"; +import { SyncState } from "../sync.ts"; export enum GroupCallEventHandlerEvent { Incoming = "GroupCall.incoming", diff --git a/src/webrtc/mediaHandler.ts b/src/webrtc/mediaHandler.ts index b17cc2852..7efa786d2 100644 --- a/src/webrtc/mediaHandler.ts +++ b/src/webrtc/mediaHandler.ts @@ -17,10 +17,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { TypedEventEmitter } from "../models/typed-event-emitter"; -import { GroupCallType, GroupCallState } from "../webrtc/groupCall"; -import { logger } from "../logger"; -import { MatrixClient } from "../client"; +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"; export enum MediaHandlerEvent { LocalStreamsChanged = "local_streams_changed", diff --git a/src/webrtc/stats/callFeedStatsReporter.ts b/src/webrtc/stats/callFeedStatsReporter.ts index 2b2c092d7..d219f7172 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"; -import { CallFeed } from "../callFeed"; +import { CallFeedReport, CallFeedStats, TrackStats, TransceiverStats } from "./statsReport.ts"; +import { 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 cc52156f0..202d654e0 100644 --- a/src/webrtc/stats/callStatsReportGatherer.ts +++ b/src/webrtc/stats/callStatsReportGatherer.ts @@ -14,20 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { ConnectionStats } from "./connectionStats"; -import { StatsReportEmitter } from "./statsReportEmitter"; -import { ByteSend, ByteSentStatsReport, TrackID } from "./statsReport"; -import { ConnectionStatsBuilder } from "./connectionStatsBuilder"; -import { TransportStatsBuilder } from "./transportStatsBuilder"; -import { MediaSsrcHandler } from "./media/mediaSsrcHandler"; -import { MediaTrackHandler } from "./media/mediaTrackHandler"; -import { MediaTrackStatsHandler } from "./media/mediaTrackStatsHandler"; -import { TrackStatsBuilder } from "./trackStatsBuilder"; -import { ConnectionStatsReportBuilder } from "./connectionStatsReportBuilder"; -import { ValueFormatter } from "./valueFormatter"; -import { CallStatsReportSummary } from "./callStatsReportSummary"; -import { logger } from "../../logger"; -import { CallFeedStatsReporter } from "./callFeedStatsReporter"; +import { ConnectionStats } from "./connectionStats.ts"; +import { StatsReportEmitter } from "./statsReportEmitter.ts"; +import { ByteSend, ByteSentStatsReport, TrackID } from "./statsReport.ts"; +import { ConnectionStatsBuilder } from "./connectionStatsBuilder.ts"; +import { TransportStatsBuilder } from "./transportStatsBuilder.ts"; +import { MediaSsrcHandler } from "./media/mediaSsrcHandler.ts"; +import { MediaTrackHandler } from "./media/mediaTrackHandler.ts"; +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 { logger } from "../../logger.ts"; +import { CallFeedStatsReporter } from "./callFeedStatsReporter.ts"; export class CallStatsReportGatherer { private isActive = true; diff --git a/src/webrtc/stats/connectionStats.ts b/src/webrtc/stats/connectionStats.ts index ef1c36797..2a998c093 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"; -import { Bitrate } from "./media/mediaTrackStats"; +import { TransportStats } from "./transportStats.ts"; +import { Bitrate } from "./media/mediaTrackStats.ts"; export interface ConnectionStatsBandwidth { /** diff --git a/src/webrtc/stats/connectionStatsBuilder.ts b/src/webrtc/stats/connectionStatsBuilder.ts index f954fed49..154a648d3 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"; +import { 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 5ed99d59b..0be778f1c 100644 --- a/src/webrtc/stats/connectionStatsReportBuilder.ts +++ b/src/webrtc/stats/connectionStatsReportBuilder.ts @@ -13,8 +13,15 @@ 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 { AudioConcealment, CodecMap, ConnectionStatsReport, FramerateMap, ResolutionMap, TrackID } from "./statsReport"; -import { MediaTrackStats, Resolution } from "./media/mediaTrackStats"; +import { + AudioConcealment, + CodecMap, + ConnectionStatsReport, + FramerateMap, + ResolutionMap, + TrackID, +} from "./statsReport.ts"; +import { MediaTrackStats, 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 1c976a9dd..ac9283e1c 100644 --- a/src/webrtc/stats/groupCallStats.ts +++ b/src/webrtc/stats/groupCallStats.ts @@ -13,11 +13,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 { CallStatsReportGatherer } from "./callStatsReportGatherer"; -import { StatsReportEmitter } from "./statsReportEmitter"; -import { CallStatsReportSummary } from "./callStatsReportSummary"; -import { SummaryStatsReportGatherer } from "./summaryStatsReportGatherer"; -import { logger } from "../../logger"; +import { CallStatsReportGatherer } from "./callStatsReportGatherer.ts"; +import { StatsReportEmitter } from "./statsReportEmitter.ts"; +import { CallStatsReportSummary } from "./callStatsReportSummary.ts"; +import { SummaryStatsReportGatherer } from "./summaryStatsReportGatherer.ts"; +import { logger } from "../../logger.ts"; export class GroupCallStats { private timer: undefined | ReturnType; diff --git a/src/webrtc/stats/media/mediaTrackStats.ts b/src/webrtc/stats/media/mediaTrackStats.ts index 7835ceb8a..e03fae9b3 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"; -import { TrackId } from "./mediaTrackHandler"; +import { AudioConcealment } from "../statsReport.ts"; +import { 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 4841c90f1..d3bd0ec49 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"; -import { MediaTrackStats } from "./mediaTrackStats"; -import { MediaTrackHandler, TrackId } from "./mediaTrackHandler"; -import { MediaSsrcHandler } from "./mediaSsrcHandler"; +import { TrackID } from "../statsReport.ts"; +import { MediaTrackStats } from "./mediaTrackStats.ts"; +import { MediaTrackHandler, TrackId } from "./mediaTrackHandler.ts"; +import { 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 9f24267e1..2fe13c7e6 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"; -import { TransportStats } from "./transportStats"; -import { Resolution } from "./media/mediaTrackStats"; +import { ConnectionStatsBandwidth, ConnectionStatsBitrate, PacketLoss } from "./connectionStats.ts"; +import { TransportStats } from "./transportStats.ts"; +import { 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 1b8834326..aef92a830 100644 --- a/src/webrtc/stats/statsReportEmitter.ts +++ b/src/webrtc/stats/statsReportEmitter.ts @@ -14,14 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { TypedEventEmitter } from "../../models/typed-event-emitter"; +import { TypedEventEmitter } from "../../models/typed-event-emitter.ts"; import { ByteSentStatsReport, CallFeedReport, ConnectionStatsReport, StatsReport, SummaryStatsReport, -} from "./statsReport"; +} from "./statsReport.ts"; export type StatsReportHandlerMap = { [StatsReport.BYTE_SENT_STATS]: (report: ByteSentStatsReport) => void; diff --git a/src/webrtc/stats/summaryStatsReportGatherer.ts b/src/webrtc/stats/summaryStatsReportGatherer.ts index b0227670d..09e381d48 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"; -import { CallStatsReportSummary } from "./callStatsReportSummary"; -import { SummaryStatsReport } from "./statsReport"; -import { ParticipantState } from "../groupCall"; -import { RoomMember } from "../../matrix"; +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"; interface CallStatsReportSummaryCounter { receivedAudio: number; diff --git a/src/webrtc/stats/trackStatsBuilder.ts b/src/webrtc/stats/trackStatsBuilder.ts index c670fddbb..f6ef72987 100644 --- a/src/webrtc/stats/trackStatsBuilder.ts +++ b/src/webrtc/stats/trackStatsBuilder.ts @@ -1,6 +1,6 @@ -import { MediaTrackStats } from "./media/mediaTrackStats"; -import { ValueFormatter } from "./valueFormatter"; -import { TrackSummary } from "./callStatsReportSummary"; +import { MediaTrackStats } from "./media/mediaTrackStats.ts"; +import { ValueFormatter } from "./valueFormatter.ts"; +import { 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 12ed7b0cb..c81ca4b5a 100644 --- a/src/webrtc/stats/transportStatsBuilder.ts +++ b/src/webrtc/stats/transportStatsBuilder.ts @@ -1,4 +1,4 @@ -import { TransportStats } from "./transportStats"; +import { TransportStats } from "./transportStats.ts"; export class TransportStatsBuilder { public static buildReport( diff --git a/tsconfig.json b/tsconfig.json index a7d2eeb4d..9339d6dfd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,8 @@ "noUnusedLocals": true, "noEmit": true, "declaration": true, - "strict": true + "strict": true, + "allowImportingTsExtensions": true }, "include": ["./src/**/*.ts", "./spec/**/*.ts"] }