matrix-js-sdk 42.1.0 → 42.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/lib/@types/beacon.d.ts +1 -1
  3. package/lib/@types/beacon.js +1 -1
  4. package/lib/@types/beacon.js.map +1 -1
  5. package/lib/@types/extensible_events.d.ts.map +1 -1
  6. package/lib/@types/extensible_events.js.map +1 -1
  7. package/lib/autodiscovery.js.map +1 -1
  8. package/lib/browser-index.js.map +1 -1
  9. package/lib/client.d.ts +12 -5
  10. package/lib/client.d.ts.map +1 -1
  11. package/lib/client.js +23 -26
  12. package/lib/client.js.map +1 -1
  13. package/lib/common-crypto/key-passphrase.js +1 -1
  14. package/lib/common-crypto/key-passphrase.js.map +1 -1
  15. package/lib/crypto/store/indexeddb-crypto-store-backend.js +2 -1
  16. package/lib/crypto/store/indexeddb-crypto-store-backend.js.map +1 -1
  17. package/lib/crypto/store/indexeddb-crypto-store.d.ts.map +1 -1
  18. package/lib/crypto/store/indexeddb-crypto-store.js +1 -1
  19. package/lib/crypto/store/indexeddb-crypto-store.js.map +1 -1
  20. package/lib/crypto/store/memory-crypto-store.js.map +1 -1
  21. package/lib/embedded.d.ts +16 -0
  22. package/lib/embedded.d.ts.map +1 -1
  23. package/lib/embedded.js +19 -6
  24. package/lib/embedded.js.map +1 -1
  25. package/lib/matrixrtc/MatrixRTCSession.js.map +1 -1
  26. package/lib/matrixrtc/MembershipManager.js.map +1 -1
  27. package/lib/matrixrtc/MembershipManagerActionScheduler.js.map +1 -1
  28. package/lib/matrixrtc/RTCEncryptionManager.js.map +1 -1
  29. package/lib/matrixrtc/ToDeviceKeyTransport.js.map +1 -1
  30. package/lib/matrixrtc/membershipData/rtc.js.map +1 -1
  31. package/lib/matrixrtc/utils.d.ts +0 -1
  32. package/lib/matrixrtc/utils.d.ts.map +1 -1
  33. package/lib/matrixrtc/utils.js +0 -1
  34. package/lib/matrixrtc/utils.js.map +1 -1
  35. package/lib/models/event-timeline-set.js +3 -3
  36. package/lib/models/event-timeline-set.js.map +1 -1
  37. package/lib/models/event.d.ts.map +1 -1
  38. package/lib/models/event.js.map +1 -1
  39. package/lib/models/invites-ignorer.js.map +1 -1
  40. package/lib/models/poll.js.map +1 -1
  41. package/lib/models/read-receipt.js.map +1 -1
  42. package/lib/models/relations-container.d.ts +10 -0
  43. package/lib/models/relations-container.d.ts.map +1 -1
  44. package/lib/models/relations-container.js +39 -17
  45. package/lib/models/relations-container.js.map +1 -1
  46. package/lib/models/relations.js +1 -1
  47. package/lib/models/relations.js.map +1 -1
  48. package/lib/models/room.js +3 -3
  49. package/lib/models/room.js.map +1 -1
  50. package/lib/models/thread.d.ts +3 -0
  51. package/lib/models/thread.d.ts.map +1 -1
  52. package/lib/models/thread.js +36 -3
  53. package/lib/models/thread.js.map +1 -1
  54. package/lib/oauth/authorize.js +1 -1
  55. package/lib/oauth/authorize.js.map +1 -1
  56. package/lib/oauth/index.js +4 -2
  57. package/lib/oauth/index.js.map +1 -1
  58. package/lib/pollingCachedValue.d.ts +77 -0
  59. package/lib/pollingCachedValue.d.ts.map +1 -0
  60. package/lib/pollingCachedValue.js +160 -0
  61. package/lib/pollingCachedValue.js.map +1 -0
  62. package/lib/pushprocessor.js.map +1 -1
  63. package/lib/receipt-accumulator.d.ts.map +1 -1
  64. package/lib/receipt-accumulator.js.map +1 -1
  65. package/lib/rendezvous/MSC4108SignInWithQR.d.ts.map +1 -1
  66. package/lib/rendezvous/MSC4108SignInWithQR.js +2 -3
  67. package/lib/rendezvous/MSC4108SignInWithQR.js.map +1 -1
  68. package/lib/rtcTransportsCachedValue.d.ts +9 -0
  69. package/lib/rtcTransportsCachedValue.d.ts.map +1 -0
  70. package/lib/rtcTransportsCachedValue.js +38 -0
  71. package/lib/rtcTransportsCachedValue.js.map +1 -0
  72. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +1 -1
  73. package/lib/rust-crypto/backup.d.ts +2 -3
  74. package/lib/rust-crypto/backup.d.ts.map +1 -1
  75. package/lib/rust-crypto/backup.js.map +1 -1
  76. package/lib/rust-crypto/index.d.ts +10 -4
  77. package/lib/rust-crypto/index.d.ts.map +1 -1
  78. package/lib/rust-crypto/index.js +20 -3
  79. package/lib/rust-crypto/index.js.map +1 -1
  80. package/lib/rust-crypto/libolm_migration.js.map +1 -1
  81. package/lib/rust-crypto/rust-crypto.js.map +1 -1
  82. package/lib/sliding-sync-sdk.js.map +1 -1
  83. package/lib/sliding-sync.js.map +1 -1
  84. package/lib/store/indexeddb-local-backend.js +1 -1
  85. package/lib/store/indexeddb-local-backend.js.map +1 -1
  86. package/lib/store/indexeddb-store-worker.d.ts.map +1 -1
  87. package/lib/store/indexeddb-store-worker.js +1 -0
  88. package/lib/store/indexeddb-store-worker.js.map +1 -1
  89. package/lib/sync.d.ts.map +1 -1
  90. package/lib/sync.js.map +1 -1
  91. package/lib/utils.d.ts +1 -1
  92. package/lib/utils.d.ts.map +1 -1
  93. package/lib/utils.js +1 -0
  94. package/lib/utils.js.map +1 -1
  95. package/lib/webrtc/call.js.map +1 -1
  96. package/lib/webrtc/groupCall.js.map +1 -1
  97. package/lib/webrtc/mediaHandler.js.map +1 -1
  98. package/lib/webrtc/stats/callStatsReportGatherer.js.map +1 -1
  99. package/lib/webrtc/stats/transportStatsBuilder.js.map +1 -1
  100. package/lib/wellKnownCachedValue.d.ts +8 -0
  101. package/lib/wellKnownCachedValue.d.ts.map +1 -0
  102. package/lib/wellKnownCachedValue.js +34 -0
  103. package/lib/wellKnownCachedValue.js.map +1 -0
  104. package/package.json +4 -4
  105. package/src/@types/beacon.ts +1 -1
  106. package/src/@types/extensible_events.ts +3 -4
  107. package/src/autodiscovery.ts +2 -2
  108. package/src/browser-index.ts +1 -1
  109. package/src/client.ts +48 -40
  110. package/src/common-crypto/key-passphrase.ts +1 -1
  111. package/src/crypto/store/indexeddb-crypto-store-backend.ts +2 -1
  112. package/src/crypto/store/indexeddb-crypto-store.ts +1 -3
  113. package/src/crypto/store/memory-crypto-store.ts +1 -1
  114. package/src/embedded.ts +34 -11
  115. package/src/matrixrtc/MatrixRTCSession.ts +3 -3
  116. package/src/matrixrtc/MembershipManager.ts +1 -1
  117. package/src/matrixrtc/MembershipManagerActionScheduler.ts +1 -1
  118. package/src/matrixrtc/RTCEncryptionManager.ts +2 -2
  119. package/src/matrixrtc/ToDeviceKeyTransport.ts +3 -3
  120. package/src/matrixrtc/membershipData/rtc.ts +1 -1
  121. package/src/matrixrtc/utils.ts +0 -2
  122. package/src/models/event-timeline-set.ts +3 -3
  123. package/src/models/event.ts +7 -10
  124. package/src/models/invites-ignorer.ts +1 -1
  125. package/src/models/poll.ts +1 -1
  126. package/src/models/read-receipt.ts +1 -1
  127. package/src/models/relations-container.ts +55 -19
  128. package/src/models/relations.ts +1 -1
  129. package/src/models/room.ts +9 -9
  130. package/src/models/thread.ts +49 -4
  131. package/src/oauth/authorize.ts +1 -1
  132. package/src/oauth/index.ts +2 -2
  133. package/src/pollingCachedValue.ts +184 -0
  134. package/src/pushprocessor.ts +3 -3
  135. package/src/receipt-accumulator.ts +1 -2
  136. package/src/rendezvous/MSC4108SignInWithQR.ts +3 -4
  137. package/src/rtcTransportsCachedValue.ts +40 -0
  138. package/src/rust-crypto/PerSessionKeyBackupDownloader.ts +1 -1
  139. package/src/rust-crypto/backup.ts +1 -5
  140. package/src/rust-crypto/index.ts +23 -25
  141. package/src/rust-crypto/libolm_migration.ts +1 -1
  142. package/src/rust-crypto/rust-crypto.ts +3 -3
  143. package/src/sliding-sync-sdk.ts +1 -1
  144. package/src/sliding-sync.ts +1 -1
  145. package/src/store/indexeddb-local-backend.ts +1 -1
  146. package/src/store/indexeddb-store-worker.ts +1 -0
  147. package/src/sync.ts +4 -3
  148. package/src/utils.ts +3 -2
  149. package/src/webrtc/call.ts +6 -6
  150. package/src/webrtc/groupCall.ts +7 -7
  151. package/src/webrtc/mediaHandler.ts +1 -1
  152. package/src/webrtc/stats/callStatsReportGatherer.ts +2 -2
  153. package/src/webrtc/stats/transportStatsBuilder.ts +1 -1
  154. package/src/wellKnownCachedValue.ts +34 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ToDeviceKeyTransport.js","names":[],"sources":["../../src/matrixrtc/ToDeviceKeyTransport.ts"],"sourcesContent":["/*\nCopyright 2025 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { type WidgetApiResponseError } from \"matrix-widget-api\";\n\nimport { TypedEventEmitter } from \"../models/typed-event-emitter.ts\";\nimport { type IKeyTransport, KeyTransportEvents, type KeyTransportEventsHandlerMap } from \"./IKeyTransport.ts\";\nimport { type Logger, logger as rootLogger } from \"../logger.ts\";\nimport { type EncryptionKeysToDeviceEventContent, type ParticipantDeviceInfo, type Statistics } from \"./types.ts\";\nimport { ClientEvent, type MatrixClient } from \"../client.ts\";\nimport type { MatrixEvent } from \"../models/event.ts\";\nimport { EventType } from \"../@types/event.ts\";\nimport { type CallMembershipIdentityParts } from \"./EncryptionManager.ts\";\n\nexport class NotSupportedError extends Error {\n public constructor(message?: string) {\n super(message);\n }\n public get name(): string {\n return \"NotSupportedError\";\n }\n}\n/**\n * ToDeviceKeyTransport is used to send MatrixRTC keys to other devices using the\n * to-device CS-API.\n */\nexport class ToDeviceKeyTransport\n extends TypedEventEmitter<KeyTransportEvents, KeyTransportEventsHandlerMap>\n implements IKeyTransport\n{\n private logger: Logger = rootLogger;\n\n public setParentLogger(parentLogger: Logger): void {\n this.logger = parentLogger.getChild(`[ToDeviceKeyTransport]`);\n }\n\n public constructor(\n private membership: CallMembershipIdentityParts,\n private roomId: string,\n private client: Pick<MatrixClient, \"encryptAndSendToDevice\" | \"on\" | \"off\">,\n private statistics: Statistics,\n parentLogger?: Logger,\n ) {\n super();\n this.setParentLogger(parentLogger ?? rootLogger);\n }\n\n public start(): void {\n this.client.on(ClientEvent.ToDeviceEvent, this.onToDeviceEvent);\n }\n\n public stop(): void {\n this.client.off(ClientEvent.ToDeviceEvent, this.onToDeviceEvent);\n }\n\n public async sendKey(keyBase64Encoded: string, index: number, members: ParticipantDeviceInfo[]): Promise<void> {\n const content: EncryptionKeysToDeviceEventContent = {\n keys: {\n index: index,\n key: keyBase64Encoded,\n },\n room_id: this.roomId,\n member: {\n claimed_device_id: this.membership.deviceId,\n id: this.membership.memberId,\n },\n session: {\n call_id: \"\",\n application: \"m.call\",\n scope: \"m.room\",\n },\n sent_ts: Date.now(),\n };\n\n const targets = members\n .map((member) => {\n return {\n userId: member.userId!,\n deviceId: member.deviceId!,\n };\n })\n // filter out me\n .filter(\n (member) => !(member.userId == this.membership.userId && member.deviceId == this.membership.deviceId),\n );\n\n if (targets.length > 0) {\n await this.client\n .encryptAndSendToDevice(EventType.CallEncryptionKeysPrefix, targets, content)\n .catch((error: WidgetApiResponseError) => {\n const msg: string = error.message;\n // This is not ideal. We would want to have a custom error type for unsupported actions.\n // This is not part of the widget API spec. Since as of now there are only two implementations:\n // Rust SDK + JS-SDK, and the JS-SDK does support to-device sending, we can assume that\n // this is a widget driver issue error message.\n if (\n (msg.includes(\"unknown variant\") && msg.includes(\"send_to_device\")) ||\n msg.includes(\"not supported\")\n ) {\n throw new NotSupportedError(\"The widget driver does not support to-device encryption\");\n }\n });\n this.statistics.counters.roomEventEncryptionKeysSent += 1;\n } else {\n this.logger.warn(\"No targets found for sending key\");\n }\n }\n\n private receiveCallKeyEvent(fromUser: string, content: EncryptionKeysToDeviceEventContent): void {\n // The event has already been validated at this point.\n\n this.statistics.counters.roomEventEncryptionKeysReceived += 1;\n\n // What is this, and why is it needed?\n // Also to device events do not have an origin server ts\n const now = Date.now();\n const age = now - (typeof content.sent_ts === \"number\" ? content.sent_ts : now);\n this.statistics.totals.roomEventEncryptionKeysReceivedTotalAge += age;\n\n const hardcodedMemberIdAlternative = `${fromUser}:${content.member.claimed_device_id}`;\n\n this.emit(\n KeyTransportEvents.ReceivedKeys,\n // TODO userId this is claimed information, deviceId is claimed information\n {\n userId: fromUser,\n deviceId: content.member.claimed_device_id!,\n memberId: content.member.id ?? hardcodedMemberIdAlternative,\n },\n content.keys.key,\n content.keys.index,\n now,\n );\n }\n\n private onToDeviceEvent = (event: MatrixEvent): void => {\n if (event.getType() !== EventType.CallEncryptionKeysPrefix) {\n // Ignore this is not a call encryption event\n return;\n }\n\n // TODO: Not possible to check if the event is encrypted or not\n // see https://github.com/matrix-org/matrix-rust-sdk/issues/4883\n // if (evnt.getWireType() != EventType.RoomMessageEncrypted) {\n // // WARN: The call keys were sent in clear. Ignore them\n // logger.warn(`Call encryption keys sent in clear from: ${event.getSender()}`);\n // return;\n // }\n\n const content = this.getValidEventContent(event);\n if (!content) return;\n\n if (!event.getSender()) return;\n\n this.receiveCallKeyEvent(event.getSender()!, content);\n };\n\n private getValidEventContent(event: MatrixEvent): EncryptionKeysToDeviceEventContent | undefined {\n const content = event.getContent();\n const roomId = content.room_id;\n if (!roomId) {\n // Invalid event\n this.logger.warn(\"Malformed Event: invalid call encryption keys event, no roomId\");\n return;\n }\n if (roomId !== this.roomId) {\n this.logger.warn(\"Malformed Event: Mismatch roomId\");\n return;\n }\n\n if (!content.keys || !content.keys.key || typeof content.keys.index !== \"number\") {\n this.logger.warn(\"Malformed Event: Missing keys field\");\n return;\n }\n\n if (!content.member || !content.member.claimed_device_id) {\n this.logger.warn(\"Malformed Event: Missing claimed_device_id\");\n return;\n }\n\n // TODO check for session related fields once the to-device encryption uses the new format.\n return content as EncryptionKeysToDeviceEventContent;\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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AC7F,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;IAClC,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO;IAC9B,IAAI,CAAC,MAAM,EAAE;MACT;MACA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gEAAgE,CAAC;MAClF;IACJ;IACA,IAAI,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE;MACxB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kCAAkC,CAAC;MACpD;IACJ;IAEA,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE;MAC9E,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qCAAqC,CAAC;MACvD;IACJ;IAEA,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE;MACtD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,4CAA4C,CAAC;MAC9D;IACJ;;IAEA;IACA,OAAO,OAAO;EAClB;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"ToDeviceKeyTransport.js","names":[],"sources":["../../src/matrixrtc/ToDeviceKeyTransport.ts"],"sourcesContent":["/*\nCopyright 2025 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { type WidgetApiResponseError } from \"matrix-widget-api\";\n\nimport { TypedEventEmitter } from \"../models/typed-event-emitter.ts\";\nimport { type IKeyTransport, KeyTransportEvents, type KeyTransportEventsHandlerMap } from \"./IKeyTransport.ts\";\nimport { type Logger, logger as rootLogger } from \"../logger.ts\";\nimport { type EncryptionKeysToDeviceEventContent, type ParticipantDeviceInfo, type Statistics } from \"./types.ts\";\nimport { ClientEvent, type MatrixClient } from \"../client.ts\";\nimport type { MatrixEvent } from \"../models/event.ts\";\nimport { EventType } from \"../@types/event.ts\";\nimport { type CallMembershipIdentityParts } from \"./EncryptionManager.ts\";\n\nexport class NotSupportedError extends Error {\n public constructor(message?: string) {\n super(message);\n }\n public get name(): string {\n return \"NotSupportedError\";\n }\n}\n/**\n * ToDeviceKeyTransport is used to send MatrixRTC keys to other devices using the\n * to-device CS-API.\n */\nexport class ToDeviceKeyTransport\n extends TypedEventEmitter<KeyTransportEvents, KeyTransportEventsHandlerMap>\n implements IKeyTransport\n{\n private logger: Logger = rootLogger;\n\n public setParentLogger(parentLogger: Logger): void {\n this.logger = parentLogger.getChild(`[ToDeviceKeyTransport]`);\n }\n\n public constructor(\n private membership: CallMembershipIdentityParts,\n private roomId: string,\n private client: Pick<MatrixClient, \"encryptAndSendToDevice\" | \"on\" | \"off\">,\n private statistics: Statistics,\n parentLogger?: Logger,\n ) {\n super();\n this.setParentLogger(parentLogger ?? rootLogger);\n }\n\n public start(): void {\n this.client.on(ClientEvent.ToDeviceEvent, this.onToDeviceEvent);\n }\n\n public stop(): void {\n this.client.off(ClientEvent.ToDeviceEvent, this.onToDeviceEvent);\n }\n\n public async sendKey(keyBase64Encoded: string, index: number, members: ParticipantDeviceInfo[]): Promise<void> {\n const content: EncryptionKeysToDeviceEventContent = {\n keys: {\n index: index,\n key: keyBase64Encoded,\n },\n room_id: this.roomId,\n member: {\n claimed_device_id: this.membership.deviceId,\n id: this.membership.memberId,\n },\n session: {\n call_id: \"\",\n application: \"m.call\",\n scope: \"m.room\",\n },\n sent_ts: Date.now(),\n };\n\n const targets = members\n .map((member) => {\n return {\n userId: member.userId,\n deviceId: member.deviceId,\n };\n })\n // filter out me\n .filter(\n (member) => !(member.userId == this.membership.userId && member.deviceId == this.membership.deviceId),\n );\n\n if (targets.length > 0) {\n await this.client\n .encryptAndSendToDevice(EventType.CallEncryptionKeysPrefix, targets, content)\n .catch((error: WidgetApiResponseError) => {\n const msg: string = error.message;\n // This is not ideal. We would want to have a custom error type for unsupported actions.\n // This is not part of the widget API spec. Since as of now there are only two implementations:\n // Rust SDK + JS-SDK, and the JS-SDK does support to-device sending, we can assume that\n // this is a widget driver issue error message.\n if (\n (msg.includes(\"unknown variant\") && msg.includes(\"send_to_device\")) ||\n msg.includes(\"not supported\")\n ) {\n throw new NotSupportedError(\"The widget driver does not support to-device encryption\");\n }\n });\n this.statistics.counters.roomEventEncryptionKeysSent += 1;\n } else {\n this.logger.warn(\"No targets found for sending key\");\n }\n }\n\n private receiveCallKeyEvent(fromUser: string, content: EncryptionKeysToDeviceEventContent): void {\n // The event has already been validated at this point.\n\n this.statistics.counters.roomEventEncryptionKeysReceived += 1;\n\n // What is this, and why is it needed?\n // Also to device events do not have an origin server ts\n const now = Date.now();\n const age = now - (typeof content.sent_ts === \"number\" ? content.sent_ts : now);\n this.statistics.totals.roomEventEncryptionKeysReceivedTotalAge += age;\n\n const hardcodedMemberIdAlternative = `${fromUser}:${content.member.claimed_device_id}`;\n\n this.emit(\n KeyTransportEvents.ReceivedKeys,\n // TODO userId this is claimed information, deviceId is claimed information\n {\n userId: fromUser,\n deviceId: content.member.claimed_device_id,\n memberId: content.member.id ?? hardcodedMemberIdAlternative,\n },\n content.keys.key,\n content.keys.index,\n now,\n );\n }\n\n private onToDeviceEvent = (event: MatrixEvent): void => {\n if (event.getType() !== EventType.CallEncryptionKeysPrefix) {\n // Ignore this is not a call encryption event\n return;\n }\n\n // TODO: Not possible to check if the event is encrypted or not\n // see https://github.com/matrix-org/matrix-rust-sdk/issues/4883\n // if (evnt.getWireType() != EventType.RoomMessageEncrypted) {\n // // WARN: The call keys were sent in clear. Ignore them\n // logger.warn(`Call encryption keys sent in clear from: ${event.getSender()}`);\n // return;\n // }\n\n const content = this.getValidEventContent(event);\n if (!content) return;\n\n if (!event.getSender()) return;\n\n this.receiveCallKeyEvent(event.getSender()!, content);\n };\n\n private getValidEventContent(event: MatrixEvent): EncryptionKeysToDeviceEventContent | undefined {\n const content = event.getContent();\n const roomId = content.room_id;\n if (!roomId) {\n // Invalid event\n this.logger.warn(\"Malformed Event: invalid call encryption keys event, no roomId\");\n return;\n }\n if (roomId !== this.roomId) {\n this.logger.warn(\"Malformed Event: Mismatch roomId\");\n return;\n }\n\n if (!content.keys || !content.keys.key || typeof content.keys.index !== \"number\") {\n this.logger.warn(\"Malformed Event: Missing keys field\");\n return;\n }\n\n if (!content.member || !content.member.claimed_device_id) {\n this.logger.warn(\"Malformed Event: Missing claimed_device_id\");\n return;\n }\n\n // TODO check for session related fields once the to-device encryption uses the new format.\n return content as EncryptionKeysToDeviceEventContent;\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAAS,iBAAiB,QAAQ,kCAAkC;AACpE,SAA6B,kBAAkB,QAA2C,oBAAoB;AAC9G,SAAsB,MAAM,IAAI,UAAU,QAAQ,cAAc;AAEhE,SAAS,WAAW,QAA2B,cAAc;AAE7D,SAAS,SAAS,QAAQ,oBAAoB;AAG9C,OAAO,MAAM,iBAAiB,SAAS,KAAK,CAAC;EAClC,WAAW,CAAC,OAAgB,EAAE;IACjC,KAAK,CAAC,OAAO,CAAC;EAClB;EACA,IAAW,IAAI,GAAW;IACtB,OAAO,mBAAmB;EAC9B;AACJ;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM,oBAAoB,SACrB,iBAAiB,CAE7B;EAGW,eAAe,CAAC,YAAoB,EAAQ;IAC/C,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,wBAAwB,CAAC;EACjE;EAEO,WAAW,CACN,UAAuC,EACvC,MAAc,EACd,MAAmE,EACnE,UAAsB,EAC9B,YAAq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AAM,CAAC,IAAI,CAAC,4CAA4C,CAAC;MAC9D;IACJ;;IAEA;IACA,OAAO,OAAO;EAClB;AACJ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"rtc.js","names":[],"sources":["../../../src/matrixrtc/membershipData/rtc.ts"],"sourcesContent":["/*\nCopyright 2026 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { MXID_PATTERN } from \"../../models/room-member.ts\";\nimport type { IContent } from \"../../models/event.ts\";\nimport type { RelationType } from \"../../types.ts\";\nimport { type RtcSlotApplicationContent, type Transport } from \"../types.ts\";\nimport { MatrixRTCMembershipParseError } from \"./common.ts\";\nimport { sha256 } from \"../../digest.ts\";\nimport { encodeUnpaddedBase64 } from \"../../base64.ts\";\nimport { slotIdToDescription } from \"../utils.ts\";\n\n/**\n * Represents the current form of MSC4143, which uses sticky events to store membership.\n */\nexport interface RtcMembershipData {\n \"slot_id\": string;\n \"member\": {\n user_id: string;\n device_id: string;\n id: string;\n };\n \"m.relates_to\"?: {\n event_id: string;\n rel_type: RelationType.Reference;\n };\n \"application\": RtcSlotApplicationContent;\n \"transports\": {\n published: Transport[];\n can_subscribe: string[];\n };\n \"versions\": string[];\n \"msc4354_sticky_key\"?: string;\n \"sticky_key\"?: string;\n}\n\n/**\n * Validates that `data` matches the format expected by MSC4143.\n * @param data The event content.\n * @param sender The sender of the event.\n * @returns true if `data` is valid RtcMembershipData\n * @throws {MatrixRTCMembershipParseError} if the content is not valid\n */\nexport const checkRtcMembershipData = (data: IContent, sender: string): data is RtcMembershipData => {\n const errors: string[] = [];\n const prefix = \" - \";\n const expectedSlotPrefix = `${data?.application?.type}#`;\n\n // required fields\n if (typeof data.slot_id !== \"string\") {\n errors.push(prefix + \"slot_id must be string\");\n } else if (!data.slot_id.startsWith(expectedSlotPrefix)) {\n errors.push(prefix + `slot_id must start with ${expectedSlotPrefix}`);\n } else {\n try {\n slotIdToDescription(data.slot_id);\n } catch (ex) {\n errors.push(prefix + `slot_id was badly formed${ex instanceof Error ? `: ${ex.message}` : \"\"}`);\n }\n }\n\n if (typeof data.member !== \"object\" || data.member === null) {\n errors.push(prefix + \"member must be an object\");\n } else {\n if (typeof data.member.user_id !== \"string\") {\n errors.push(prefix + \"member.user_id must be string\");\n } else if (!MXID_PATTERN.test(data.member.user_id)) {\n errors.push(prefix + \"member.user_id must be a valid mxid\");\n }\n // This is not what the spec enforces but there currently are no rules what power levels are required to\n // send a m.rtc.member event for a other user. So we add this check for simplicity and to avoid possible attacks until there\n // is a proper definition when this is allowed.\n else if (data.member.user_id !== sender) {\n errors.push(prefix + \"member.user_id must match the sender\");\n }\n if (typeof data.member.device_id !== \"string\") {\n errors.push(prefix + \"member.device_id must be string\");\n }\n if (typeof data.member.id !== \"string\") errors.push(prefix + \"member.id must be string\");\n }\n if (typeof data.application !== \"object\" || data.application === null) {\n errors.push(prefix + \"application must be an object\");\n } else {\n if (typeof data.application.type !== \"string\") {\n errors.push(prefix + \"application.type must be a string\");\n } else {\n if (data.application.type.includes(\"#\")) errors.push(prefix + 'application.type must not include \"#\"');\n }\n }\n if (typeof data.transports !== \"object\" || data.transports === null || !Array.isArray(data.transports.published)) {\n errors.push(prefix + \"transports.published must be an array\");\n } else {\n // validate that each transport has at least a string 'type'\n for (const t of data.transports.published) {\n if (typeof t !== \"object\" || t === null || typeof (t as any).type !== \"string\") {\n errors.push(prefix + \"transports.published entries must be objects with a string type\");\n break;\n }\n }\n }\n if (\n typeof data.transports !== \"object\" ||\n data.transports === null ||\n !Array.isArray(data.transports.can_subscribe) ||\n !data.transports.can_subscribe.every((t: unknown) => typeof t === \"string\")\n ) {\n errors.push(prefix + \"transports.can_subscribe must be an array of strings\");\n }\n if (data.versions === undefined || !Array.isArray(data.versions)) {\n errors.push(prefix + \"versions must be an array\");\n } else if (!data.versions.every((v) => typeof v === \"string\")) {\n errors.push(prefix + \"versions must be an array of strings\");\n }\n\n // optional fields\n if ((data.sticky_key ?? data.msc4354_sticky_key) === undefined) {\n errors.push(prefix + \"sticky_key or msc4354_sticky_key must be a defined\");\n }\n if (data.sticky_key !== undefined && typeof data.sticky_key !== \"string\") {\n errors.push(prefix + \"sticky_key must be a string\");\n }\n if (data.msc4354_sticky_key !== undefined && typeof data.msc4354_sticky_key !== \"string\") {\n errors.push(prefix + \"msc4354_sticky_key must be a string\");\n }\n if (\n data.sticky_key !== undefined &&\n data.msc4354_sticky_key !== undefined &&\n data.sticky_key !== data.msc4354_sticky_key\n ) {\n errors.push(prefix + \"sticky_key and msc4354_sticky_key must be equal if both are defined\");\n }\n if (data[\"m.relates_to\"] !== undefined) {\n const rel = data[\"m.relates_to\"] as RtcMembershipData[\"m.relates_to\"];\n if (typeof rel !== \"object\" || rel === null) {\n errors.push(prefix + \"m.relates_to must be an object if provided\");\n } else {\n if (typeof rel.event_id !== \"string\") errors.push(prefix + \"m.relates_to.event_id must be a string\");\n if (rel.rel_type !== \"m.reference\") errors.push(prefix + \"m.relates_to.rel_type must be m.reference\");\n }\n }\n\n if (errors.length) {\n throw new MatrixRTCMembershipParseError(\"RtcMembership\", errors);\n }\n\n return true;\n};\n\nexport async function computeRtcIdentityRaw(userId: string, deviceId: string, memberId: string): Promise<string> {\n // canonical JSON serialization (Matrix canonical JSON for arrays)\n const jsonStr = JSON.stringify([userId, deviceId, memberId]);\n const hashBuffer = await sha256(jsonStr);\n const hashedString = encodeUnpaddedBase64(hashBuffer);\n return hashedString;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,YAAY,QAAQ,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ACrD,OAAO,YAAY;AACvB","ignoreList":[]}
1
+ {"version":3,"file":"rtc.js","names":[],"sources":["../../../src/matrixrtc/membershipData/rtc.ts"],"sourcesContent":["/*\nCopyright 2026 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { MXID_PATTERN } from \"../../models/room-member.ts\";\nimport type { IContent } from \"../../models/event.ts\";\nimport type { RelationType } from \"../../types.ts\";\nimport { type RtcSlotApplicationContent, type Transport } from \"../types.ts\";\nimport { MatrixRTCMembershipParseError } from \"./common.ts\";\nimport { sha256 } from \"../../digest.ts\";\nimport { encodeUnpaddedBase64 } from \"../../base64.ts\";\nimport { slotIdToDescription } from \"../utils.ts\";\n\n/**\n * Represents the current form of MSC4143, which uses sticky events to store membership.\n */\nexport interface RtcMembershipData {\n \"slot_id\": string;\n \"member\": {\n user_id: string;\n device_id: string;\n id: string;\n };\n \"m.relates_to\"?: {\n event_id: string;\n rel_type: RelationType.Reference;\n };\n \"application\": RtcSlotApplicationContent;\n \"transports\": {\n published: Transport[];\n can_subscribe: string[];\n };\n \"versions\": string[];\n \"msc4354_sticky_key\"?: string;\n \"sticky_key\"?: string;\n}\n\n/**\n * Validates that `data` matches the format expected by MSC4143.\n * @param data The event content.\n * @param sender The sender of the event.\n * @returns true if `data` is valid RtcMembershipData\n * @throws {MatrixRTCMembershipParseError} if the content is not valid\n */\nexport const checkRtcMembershipData = (data: IContent, sender: string): data is RtcMembershipData => {\n const errors: string[] = [];\n const prefix = \" - \";\n const expectedSlotPrefix = `${data?.application?.type}#`;\n\n // required fields\n if (typeof data.slot_id !== \"string\") {\n errors.push(prefix + \"slot_id must be string\");\n } else if (!data.slot_id.startsWith(expectedSlotPrefix)) {\n errors.push(prefix + `slot_id must start with ${expectedSlotPrefix}`);\n } else {\n try {\n slotIdToDescription(data.slot_id);\n } catch (ex) {\n errors.push(prefix + `slot_id was badly formed${ex instanceof Error ? `: ${ex.message}` : \"\"}`);\n }\n }\n\n if (typeof data.member !== \"object\" || data.member === null) {\n errors.push(prefix + \"member must be an object\");\n } else {\n if (typeof data.member.user_id !== \"string\") {\n errors.push(prefix + \"member.user_id must be string\");\n } else if (!MXID_PATTERN.test(data.member.user_id)) {\n errors.push(prefix + \"member.user_id must be a valid mxid\");\n }\n // This is not what the spec enforces but there currently are no rules what power levels are required to\n // send a m.rtc.member event for a other user. So we add this check for simplicity and to avoid possible attacks until there\n // is a proper definition when this is allowed.\n else if (data.member.user_id !== sender) {\n errors.push(prefix + \"member.user_id must match the sender\");\n }\n if (typeof data.member.device_id !== \"string\") {\n errors.push(prefix + \"member.device_id must be string\");\n }\n if (typeof data.member.id !== \"string\") errors.push(prefix + \"member.id must be string\");\n }\n if (typeof data.application !== \"object\" || data.application === null) {\n errors.push(prefix + \"application must be an object\");\n } else {\n if (typeof data.application.type !== \"string\") {\n errors.push(prefix + \"application.type must be a string\");\n } else {\n if (data.application.type.includes(\"#\")) errors.push(prefix + 'application.type must not include \"#\"');\n }\n }\n if (typeof data.transports !== \"object\" || data.transports === null || !Array.isArray(data.transports.published)) {\n errors.push(prefix + \"transports.published must be an array\");\n } else {\n // validate that each transport has at least a string 'type'\n for (const t of data.transports.published) {\n if (typeof t !== \"object\" || t === null || typeof t.type !== \"string\") {\n errors.push(prefix + \"transports.published entries must be objects with a string type\");\n break;\n }\n }\n }\n if (\n typeof data.transports !== \"object\" ||\n data.transports === null ||\n !Array.isArray(data.transports.can_subscribe) ||\n !data.transports.can_subscribe.every((t: unknown) => typeof t === \"string\")\n ) {\n errors.push(prefix + \"transports.can_subscribe must be an array of strings\");\n }\n if (data.versions === undefined || !Array.isArray(data.versions)) {\n errors.push(prefix + \"versions must be an array\");\n } else if (!data.versions.every((v) => typeof v === \"string\")) {\n errors.push(prefix + \"versions must be an array of strings\");\n }\n\n // optional fields\n if ((data.sticky_key ?? data.msc4354_sticky_key) === undefined) {\n errors.push(prefix + \"sticky_key or msc4354_sticky_key must be a defined\");\n }\n if (data.sticky_key !== undefined && typeof data.sticky_key !== \"string\") {\n errors.push(prefix + \"sticky_key must be a string\");\n }\n if (data.msc4354_sticky_key !== undefined && typeof data.msc4354_sticky_key !== \"string\") {\n errors.push(prefix + \"msc4354_sticky_key must be a string\");\n }\n if (\n data.sticky_key !== undefined &&\n data.msc4354_sticky_key !== undefined &&\n data.sticky_key !== data.msc4354_sticky_key\n ) {\n errors.push(prefix + \"sticky_key and msc4354_sticky_key must be equal if both are defined\");\n }\n if (data[\"m.relates_to\"] !== undefined) {\n const rel = data[\"m.relates_to\"] as RtcMembershipData[\"m.relates_to\"];\n if (typeof rel !== \"object\" || rel === null) {\n errors.push(prefix + \"m.relates_to must be an object if provided\");\n } else {\n if (typeof rel.event_id !== \"string\") errors.push(prefix + \"m.relates_to.event_id must be a string\");\n if (rel.rel_type !== \"m.reference\") errors.push(prefix + \"m.relates_to.rel_type must be m.reference\");\n }\n }\n\n if (errors.length) {\n throw new MatrixRTCMembershipParseError(\"RtcMembership\", errors);\n }\n\n return true;\n};\n\nexport async function computeRtcIdentityRaw(userId: string, deviceId: string, memberId: string): Promise<string> {\n // canonical JSON serialization (Matrix canonical JSON for arrays)\n const jsonStr = JSON.stringify([userId, deviceId, memberId]);\n const hashBuffer = await sha256(jsonStr);\n const hashedString = encodeUnpaddedBase64(hashBuffer);\n return hashedString;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,YAAY,QAAQ,6BAA6B;AAI1D,SAAS,6BAA6B,QAAQ,aAAa;AAC3D,SAAS,MAAM,QAAQ,iBAAiB;AAC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types.ts";
5
5
  */
6
6
  export declare class OutdatedKeyFilter {
7
7
  private tsBuffer;
8
- constructor();
9
8
  /**
10
9
  * Check if there is a recent key with the same keyId (index) and then use the creationTS to decide what to
11
10
  * do with the key. If the key received is older than the one already in the buffer, it is ignored.
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/matrixrtc/utils.ts"],"names":[],"mappings":"AAgBA,OAAO,EAA0B,KAAK,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAClG,OAAO,KAAK,EAAE,wBAAwB,EAAuB,eAAe,EAAE,MAAM,YAAY,CAAC;AAEjG;;GAEG;AACH,qBAAa,iBAAiB;IAE1B,OAAO,CAAC,QAAQ,CAA4D;IAE5E,cAAuB;IAEvB;;;;;OAKG;IACI,UAAU,CAAC,UAAU,EAAE,2BAA2B,EAAE,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAalG;CACJ;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAQnE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,eAAe,EAAE,eAAe,GAAG,MAAM,CAEtE"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/matrixrtc/utils.ts"],"names":[],"mappings":"AAgBA,OAAO,EAA0B,KAAK,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAClG,OAAO,KAAK,EAAE,wBAAwB,EAAuB,eAAe,EAAE,MAAM,YAAY,CAAC;AAEjG;;GAEG;AACH,qBAAa,iBAAiB;IAE1B,OAAO,CAAC,QAAQ,CAA4D;IAE5E;;;;;OAKG;IACI,UAAU,CAAC,UAAU,EAAE,2BAA2B,EAAE,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAalG;CACJ;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAQnE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,eAAe,EAAE,eAAe,GAAG,MAAM,CAEtE"}
@@ -24,7 +24,6 @@ export class OutdatedKeyFilter {
24
24
  // Map of participantId -> keyIndex -> timestamp
25
25
  _defineProperty(this, "tsBuffer", new Map());
26
26
  }
27
-
28
27
  /**
29
28
  * Check if there is a recent key with the same keyId (index) and then use the creationTS to decide what to
30
29
  * do with the key. If the key received is older than the one already in the buffer, it is ignored.
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":[],"sources":["../../src/matrixrtc/utils.ts"],"sourcesContent":["/*\nCopyright 2025-2026 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { getEncryptionKeyMapKey, type CallMembershipIdentityParts } from \"./EncryptionManager.ts\";\nimport type { InboundEncryptionSession, EncryptionKeyMapKey, SlotDescription } from \"./types.ts\";\n\n/**\n * Detects when a key for a given index is outdated.\n */\nexport class OutdatedKeyFilter {\n // Map of participantId -> keyIndex -> timestamp\n private tsBuffer: Map<EncryptionKeyMapKey, Map<number, number>> = new Map();\n\n public constructor() {}\n\n /**\n * Check if there is a recent key with the same keyId (index) and then use the creationTS to decide what to\n * do with the key. If the key received is older than the one already in the buffer, it is ignored.\n * @param participantId\n * @param item\n */\n public isOutdated(membership: CallMembershipIdentityParts, item: InboundEncryptionSession): boolean {\n const mapKey = getEncryptionKeyMapKey(membership);\n if (!this.tsBuffer.has(mapKey)) {\n this.tsBuffer.set(mapKey, new Map<number, number>());\n }\n\n const latestTimestamp = this.tsBuffer.get(mapKey)?.get(item.keyIndex);\n if (latestTimestamp && latestTimestamp > item.creationTS) {\n // The existing key is more recent, ignore this one\n return true;\n }\n this.tsBuffer.get(mapKey)!.set(item.keyIndex, item.creationTS);\n return false;\n }\n}\n\n/**\n * Converts a slot ID into it's component application and ID portions.\n * @param slotId e.g. `m.call#call_id`\n * @throws If the format of `slotId` is invalid.\n */\nexport function slotIdToDescription(slotId: string): SlotDescription {\n const [application, id, ...unexpectedAdditionalValues] = slotId.split(\"#\");\n if (unexpectedAdditionalValues.length) {\n throw Error(\n \"MatrixRTC Slot IDs *must* only contain two components seperated by one '#'. Additional '#' characters detected.\",\n );\n }\n return { application, id };\n}\n\n/**\n * Converts a SlotDescription into it's slot ID format.\n */\nexport function computeSlotId(slotDescription: SlotDescription): string {\n return `${slotDescription.application}#${slotDescription.id}`;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,sBAAsB,QAA0C,wBAAwB;AAGjG;AACA;AACA;AACA,OAAO,MAAM,iBAAiB,CAAC;EAIpB,WAAW,GAAG;IAHrB;IAAA,kCACkE,IAAI,GAAG,CAAC,CAAC;EAErD;;EAEtB;AACJ;AACA;AACA;AACA;AACA;EACW,UAAU,CAAC,UAAuC,EAAE,IAA8B,EAAW;IAChG,MAAM,MAAM,GAAG,sBAAsB,CAAC,UAAU,CAAC;IACjD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;MAC5B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,GAAG,CAAiB,CAAC,CAAC;IACxD;IAEA,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;IACrE,IAAI,eAAe,IAAI,eAAe,GAAG,IAAI,CAAC,UAAU,EAAE;MACtD;MACA,OAAO,IAAI;IACf;IACA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC;IAC9D,OAAO,KAAK;EAChB;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS,mBAAmB,CAAC,MAAc,EAAmB;EACjE,MAAM,CAAC,WAAW,EAAE,EAAE,EAAE,GAAG,0BAA0B,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;EAC1E,IAAI,0BAA0B,CAAC,MAAM,EAAE;IACnC,MAAM,KAAK,CACP,iHACJ,CAAC;EACL;EACA,OAAO;IAAE,WAAW;IAAE;EAAG,CAAC;AAC9B;;AAEA;AACA;AACA;AACA,OAAO,SAAS,aAAa,CAAC,eAAgC,EAAU;EACpE,OAAO,GAAG,eAAe,CAAC,WAAW,IAAI,eAAe,CAAC,EAAE,EAAE;AACjE","ignoreList":[]}
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../../src/matrixrtc/utils.ts"],"sourcesContent":["/*\nCopyright 2025-2026 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { getEncryptionKeyMapKey, type CallMembershipIdentityParts } from \"./EncryptionManager.ts\";\nimport type { InboundEncryptionSession, EncryptionKeyMapKey, SlotDescription } from \"./types.ts\";\n\n/**\n * Detects when a key for a given index is outdated.\n */\nexport class OutdatedKeyFilter {\n // Map of participantId -> keyIndex -> timestamp\n private tsBuffer: Map<EncryptionKeyMapKey, Map<number, number>> = new Map();\n\n /**\n * Check if there is a recent key with the same keyId (index) and then use the creationTS to decide what to\n * do with the key. If the key received is older than the one already in the buffer, it is ignored.\n * @param participantId\n * @param item\n */\n public isOutdated(membership: CallMembershipIdentityParts, item: InboundEncryptionSession): boolean {\n const mapKey = getEncryptionKeyMapKey(membership);\n if (!this.tsBuffer.has(mapKey)) {\n this.tsBuffer.set(mapKey, new Map<number, number>());\n }\n\n const latestTimestamp = this.tsBuffer.get(mapKey)?.get(item.keyIndex);\n if (latestTimestamp && latestTimestamp > item.creationTS) {\n // The existing key is more recent, ignore this one\n return true;\n }\n this.tsBuffer.get(mapKey)!.set(item.keyIndex, item.creationTS);\n return false;\n }\n}\n\n/**\n * Converts a slot ID into it's component application and ID portions.\n * @param slotId e.g. `m.call#call_id`\n * @throws If the format of `slotId` is invalid.\n */\nexport function slotIdToDescription(slotId: string): SlotDescription {\n const [application, id, ...unexpectedAdditionalValues] = slotId.split(\"#\");\n if (unexpectedAdditionalValues.length) {\n throw Error(\n \"MatrixRTC Slot IDs *must* only contain two components seperated by one '#'. Additional '#' characters detected.\",\n );\n }\n return { application, id };\n}\n\n/**\n * Converts a SlotDescription into it's slot ID format.\n */\nexport function computeSlotId(slotDescription: SlotDescription): string {\n return `${slotDescription.application}#${slotDescription.id}`;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,sBAAsB,QAA0C,wBAAwB;AAGjG;AACA;AACA;AACA,OAAO,MAAM,iBAAiB,CAAC;EAAA;IAC3B;IAAA,kCACkE,IAAI,GAAG,CAAC,CAAC;EAAA;EAE3E;AACJ;AACA;AACA;AACA;AACA;EACW,UAAU,CAAC,UAAuC,EAAE,IAA8B,EAAW;IAChG,MAAM,MAAM,GAAG,sBAAsB,CAAC,UAAU,CAAC;IACjD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;MAC5B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,GAAG,CAAiB,CAAC,CAAC;IACxD;IAEA,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;IACrE,IAAI,eAAe,IAAI,eAAe,GAAG,IAAI,CAAC,UAAU,EAAE;MACtD;MACA,OAAO,IAAI;IACf;IACA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC;IAC9D,OAAO,KAAK;EAChB;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS,mBAAmB,CAAC,MAAc,EAAmB;EACjE,MAAM,CAAC,WAAW,EAAE,EAAE,EAAE,GAAG,0BAA0B,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;EAC1E,IAAI,0BAA0B,CAAC,MAAM,EAAE;IACnC,MAAM,KAAK,CACP,iHACJ,CAAC;EACL;EACA,OAAO;IAAE,WAAW;IAAE;EAAG,CAAC;AAC9B;;AAEA;AACA;AACA;AACA,OAAO,SAAS,aAAa,CAAC,eAAgC,EAAU;EACpE,OAAO,GAAG,eAAe,CAAC,WAAW,IAAI,eAAe,CAAC,EAAE,EAAE;AACjE","ignoreList":[]}
@@ -400,9 +400,9 @@ export class EventTimelineSet extends TypedEventEmitter {
400
400
  // that would happen, so I'm going to ignore it for now.
401
401
  //
402
402
  if (existingTimeline == neighbour) {
403
- debuglog("Event " + eventId + " in neighbouring timeline - " + "switching to " + existingTimeline);
403
+ debuglog("Event " + eventId + " in neighbouring timeline - switching to " + existingTimeline);
404
404
  } else {
405
- debuglog("Event " + eventId + " already in a different " + "timeline " + existingTimeline);
405
+ debuglog("Event " + eventId + " already in a different timeline " + existingTimeline);
406
406
  }
407
407
  timeline = existingTimeline;
408
408
  continue;
@@ -442,7 +442,7 @@ export class EventTimelineSet extends TypedEventEmitter {
442
442
  lastEventWasNew,
443
443
  didUpdate
444
444
  }); // for debugging
445
- logger.warn(`Refusing to set forwards pagination token of live timeline ` + `${timeline} to ${paginationToken}`);
445
+ logger.warn(`Refusing to set forwards pagination token of live timeline ${timeline} to ${paginationToken}`);
446
446
  return;
447
447
  }
448
448
  timeline.setPaginationToken(paginationToken ?? null, direction);
@@ -1 +1 @@
1
- {"version":3,"file":"event-timeline-set.js","names":[],"sources":["../../src/models/event-timeline-set.ts"],"sourcesContent":["/*\nCopyright 2016 - 2021 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { EventTimeline, type IAddEventOptions } from \"./event-timeline.ts\";\nimport { type MatrixEvent } from \"./event.ts\";\nimport { logger } from \"../logger.ts\";\nimport { type Room, RoomEvent } from \"./room.ts\";\nimport { type Filter } from \"../filter.ts\";\nimport { type RoomState } from \"./room-state.ts\";\nimport { TypedEventEmitter } from \"./typed-event-emitter.ts\";\nimport { RelationsContainer } from \"./relations-container.ts\";\nimport { type MatrixClient } from \"../client.ts\";\nimport { type Thread, type ThreadFilterType } from \"./thread.ts\";\n\nconst DEBUG = true;\n\n/* istanbul ignore next */\nlet debuglog: (...args: any[]) => void;\nif (DEBUG) {\n // using bind means that we get to keep useful line numbers in the console\n debuglog = logger.log.bind(logger);\n} else {\n /* istanbul ignore next */\n debuglog = function (): void {};\n}\n\ninterface IOpts {\n // Set to true to enable improved timeline support.\n timelineSupport?: boolean;\n // The filter object, if any, for this timelineSet.\n filter?: Filter;\n pendingEvents?: boolean;\n}\n\nexport enum DuplicateStrategy {\n Ignore = \"ignore\",\n Replace = \"replace\",\n}\n\nexport interface IRoomTimelineData {\n // the timeline the event was added to/removed from\n timeline: EventTimeline;\n // true if the event was a real-time event added to the end of the live timeline\n liveEvent?: boolean;\n}\n\nexport interface IAddEventToTimelineOptions extends Pick<\n IAddEventOptions,\n \"toStartOfTimeline\" | \"roomState\" | \"timelineWasEmpty\" | \"addToState\"\n> {\n /** Whether the sync response came from cache */\n fromCache?: boolean;\n}\n\nexport interface IAddLiveEventOptions extends Pick<\n IAddEventToTimelineOptions,\n \"fromCache\" | \"roomState\" | \"timelineWasEmpty\" | \"addToState\"\n> {\n /** Applies to events in the timeline only. If this is 'replace' then if a\n * duplicate is encountered, the event passed to this function will replace\n * the existing event in the timeline. If this is not specified, or is\n * 'ignore', then the event passed to this function will be ignored\n * entirely, preserving the existing event in the timeline. Events are\n * identical based on their event ID <b>only</b>. */\n duplicateStrategy?: DuplicateStrategy;\n}\n\ntype EmittedEvents = RoomEvent.Timeline | RoomEvent.TimelineReset;\n\nexport type EventTimelineSetHandlerMap = {\n /**\n * Fires whenever the timeline in a room is updated.\n * @param event - The matrix event which caused this event to fire.\n * @param room - The room, if any, whose timeline was updated.\n * @param toStartOfTimeline - True if this event was added to the start\n * @param removed - True if this event has just been removed from the timeline\n * (beginning; oldest) of the timeline e.g. due to pagination.\n *\n * @param data - more data about the event\n *\n * @example\n * ```\n * matrixClient.on(\"Room.timeline\",\n * function(event, room, toStartOfTimeline, removed, data) {\n * if (!toStartOfTimeline && data.liveEvent) {\n * var messageToAppend = room.timeline.[room.timeline.length - 1];\n * }\n * });\n * ```\n */\n [RoomEvent.Timeline]: (\n event: MatrixEvent,\n room: Room | undefined,\n toStartOfTimeline: boolean | undefined,\n removed: boolean,\n data: IRoomTimelineData,\n ) => void;\n /**\n * Fires whenever the live timeline in a room is reset.\n *\n * When we get a 'limited' sync (for example, after a network outage), we reset\n * the live timeline to be empty before adding the recent events to the new\n * timeline. This event is fired after the timeline is reset, and before the\n * new events are added.\n *\n * @param room - The room whose live timeline was reset, if any\n * @param timelineSet - timelineSet room whose live timeline was reset\n * @param resetAllTimelines - True if all timelines were reset.\n */\n [RoomEvent.TimelineReset]: (\n room: Room | undefined,\n timelineSet: EventTimelineSet,\n resetAllTimelines: boolean,\n ) => void;\n};\n\nexport class EventTimelineSet extends TypedEventEmitter<EmittedEvents, EventTimelineSetHandlerMap> {\n public readonly relations: RelationsContainer;\n private readonly timelineSupport: boolean;\n private readonly displayPendingEvents: boolean;\n private liveTimeline: EventTimeline;\n private timelines: EventTimeline[];\n private _eventIdToTimeline = new Map<string, EventTimeline>();\n private filter?: Filter;\n\n /**\n * Construct a set of EventTimeline objects, typically on behalf of a given\n * room. A room may have multiple EventTimelineSets for different levels\n * of filtering. The global notification list is also an EventTimelineSet, but\n * lacks a room.\n *\n * <p>This is an ordered sequence of timelines, which may or may not\n * be continuous. Each timeline lists a series of events, as well as tracking\n * the room state at the start and the end of the timeline (if appropriate).\n * It also tracks forward and backward pagination tokens, as well as containing\n * links to the next timeline in the sequence.\n *\n * <p>There is one special timeline - the 'live' timeline, which represents the\n * timeline to which events are being added in real-time as they are received\n * from the /sync API. Note that you should not retain references to this\n * timeline - even if it is the current timeline right now, it may not remain\n * so if the server gives us a timeline gap in /sync.\n *\n * <p>In order that we can find events from their ids later, we also maintain a\n * map from event_id to timeline and index.\n *\n * @param room - Room for this timelineSet. May be null for non-room cases, such as the\n * notification timeline.\n * @param opts - Options inherited from Room.\n * @param client - the Matrix client which owns this EventTimelineSet,\n * can be omitted if room is specified.\n * @param thread - the thread to which this timeline set relates.\n * @param threadListType - the type of thread list represented, if any\n * (e.g., All threads or My threads)\n */\n public constructor(\n public readonly room: Room | undefined,\n opts: IOpts = {},\n client?: MatrixClient,\n public readonly thread?: Thread,\n public readonly threadListType: ThreadFilterType | null = null,\n ) {\n super();\n\n this.timelineSupport = Boolean(opts.timelineSupport);\n this.liveTimeline = new EventTimeline(this);\n this.displayPendingEvents = opts.pendingEvents !== false;\n\n // just a list - *not* ordered.\n this.timelines = [this.liveTimeline];\n this._eventIdToTimeline = new Map<string, EventTimeline>();\n\n this.filter = opts.filter;\n\n this.relations = this.room?.relations ?? new RelationsContainer(room?.client ?? client!);\n }\n\n /**\n * Get all the timelines in this set\n * @returns the timelines in this set\n */\n public getTimelines(): EventTimeline[] {\n return this.timelines;\n }\n\n /**\n * Get the filter object this timeline set is filtered on, if any\n * @returns the optional filter for this timelineSet\n */\n public getFilter(): Filter | undefined {\n return this.filter;\n }\n\n /**\n * Set the filter object this timeline set is filtered on\n * (passed to the server when paginating via /messages).\n * @param filter - the filter for this timelineSet\n */\n public setFilter(filter?: Filter): void {\n this.filter = filter;\n }\n\n /**\n * Get the list of pending sent events for this timelineSet's room, filtered\n * by the timelineSet's filter if appropriate.\n *\n * @returns A list of the sent events\n * waiting for remote echo.\n *\n * @throws If `opts.pendingEventOrdering` was not 'detached'\n */\n public getPendingEvents(): MatrixEvent[] {\n if (!this.room || !this.displayPendingEvents) {\n return [];\n }\n\n return this.room.getPendingEvents();\n }\n /**\n * Get the live timeline for this room.\n *\n * @returns live timeline\n */\n public getLiveTimeline(): EventTimeline {\n return this.liveTimeline;\n }\n\n /**\n * Set the live timeline for this room.\n *\n * @returns live timeline\n */\n public setLiveTimeline(timeline: EventTimeline): void {\n this.liveTimeline = timeline;\n }\n\n /**\n * Return the timeline (if any) this event is in.\n * @param eventId - the eventId being sought\n * @returns timeline\n */\n public eventIdToTimeline(eventId: string): EventTimeline | undefined {\n return this._eventIdToTimeline.get(eventId);\n }\n\n /**\n * Track a new event as if it were in the same timeline as an old event,\n * replacing it.\n * @param oldEventId - event ID of the original event\n * @param newEventId - event ID of the replacement event\n */\n public replaceEventId(oldEventId: string, newEventId: string): void {\n const existingTimeline = this._eventIdToTimeline.get(oldEventId);\n if (existingTimeline) {\n this._eventIdToTimeline.delete(oldEventId);\n this._eventIdToTimeline.set(newEventId, existingTimeline);\n }\n }\n\n /**\n * Reset the live timeline, and start a new one.\n *\n * <p>This is used when /sync returns a 'limited' timeline.\n *\n * @param backPaginationToken - token for back-paginating the new timeline\n * @param forwardPaginationToken - token for forward-paginating the old live timeline,\n * if absent or null, all timelines are reset.\n *\n * @remarks\n * Fires {@link RoomEvent.TimelineReset}\n */\n public resetLiveTimeline(backPaginationToken?: string, forwardPaginationToken?: string): void {\n // Each EventTimeline has RoomState objects tracking the state at the start\n // and end of that timeline. The copies at the end of the live timeline are\n // special because they will have listeners attached to monitor changes to\n // the current room state, so we move this RoomState from the end of the\n // current live timeline to the end of the new one and, if necessary,\n // replace it with a newly created one. We also make a copy for the start\n // of the new timeline.\n\n // if timeline support is disabled, forget about the old timelines\n const resetAllTimelines = !this.timelineSupport || !forwardPaginationToken;\n\n const oldTimeline = this.liveTimeline;\n const newTimeline = resetAllTimelines\n ? oldTimeline.forkLive(EventTimeline.FORWARDS)\n : oldTimeline.fork(EventTimeline.FORWARDS);\n\n if (resetAllTimelines) {\n this.timelines = [newTimeline];\n this._eventIdToTimeline = new Map<string, EventTimeline>();\n } else {\n this.timelines.push(newTimeline);\n }\n\n if (forwardPaginationToken) {\n // Now set the forward pagination token on the old live timeline\n // so it can be forward-paginated.\n oldTimeline.setPaginationToken(forwardPaginationToken, EventTimeline.FORWARDS);\n }\n\n // make sure we set the pagination token before firing timelineReset,\n // otherwise clients which start back-paginating will fail, and then get\n // stuck without realising that they *can* back-paginate.\n newTimeline.setPaginationToken(backPaginationToken ?? null, EventTimeline.BACKWARDS);\n\n // Now we can swap the live timeline to the new one.\n this.liveTimeline = newTimeline;\n this.emit(RoomEvent.TimelineReset, this.room, this, resetAllTimelines);\n }\n\n /**\n * Get the timeline which contains the given event, if any\n *\n * @param eventId - event ID to look for\n * @returns timeline containing\n * the given event, or null if unknown\n */\n public getTimelineForEvent(eventId?: string): EventTimeline | null {\n if (eventId === null || eventId === undefined) {\n return null;\n }\n const res = this._eventIdToTimeline.get(eventId);\n return res === undefined ? null : res;\n }\n\n /**\n * Get an event which is stored in our timelines\n *\n * @param eventId - event ID to look for\n * @returns the given event, or undefined if unknown\n */\n public findEventById(eventId: string): MatrixEvent | undefined {\n const tl = this.getTimelineForEvent(eventId);\n if (!tl) {\n return undefined;\n }\n return tl.getEvents().find(function (ev) {\n return ev.getId() == eventId;\n });\n }\n\n /**\n * Add a new timeline to this timeline list\n *\n * @returns newly-created timeline\n */\n public addTimeline(): EventTimeline {\n if (!this.timelineSupport) {\n throw new Error(\n \"timeline support is disabled. Set the 'timelineSupport'\" +\n \" parameter to true when creating MatrixClient to enable\" +\n \" it.\",\n );\n }\n\n const timeline = new EventTimeline(this);\n this.timelines.push(timeline);\n return timeline;\n }\n\n /**\n * Add events to a timeline\n *\n * <p>Will fire \"Room.timeline\" for each event added.\n *\n * @param events - A list of events to add.\n *\n * @param toStartOfTimeline - True to add these events to the start\n * (oldest) instead of the end (newest) of the timeline. If true, the oldest\n * event will be the <b>last</b> element of 'events'.\n *\n * @param timeline - timeline to\n * add events to.\n *\n * @param paginationToken - token for the next batch of events\n *\n * @remarks\n * Fires {@link RoomEvent.Timeline}\n *\n */\n public addEventsToTimeline(\n events: MatrixEvent[],\n toStartOfTimeline: boolean,\n addToState: boolean,\n timeline: EventTimeline,\n paginationToken?: string | null,\n ): void {\n if (!timeline) {\n throw new Error(\"'timeline' not specified for EventTimelineSet.addEventsToTimeline\");\n }\n\n if (!toStartOfTimeline && timeline == this.liveTimeline) {\n throw new Error(\n \"EventTimelineSet.addEventsToTimeline cannot be used for adding events to \" +\n \"the live timeline - use Room.addLiveEvents instead\",\n );\n }\n\n if (this.filter) {\n events = this.filter.filterRoomTimeline(events);\n if (!events.length) {\n return;\n }\n }\n\n const direction = toStartOfTimeline ? EventTimeline.BACKWARDS : EventTimeline.FORWARDS;\n const inverseDirection = toStartOfTimeline ? EventTimeline.FORWARDS : EventTimeline.BACKWARDS;\n\n // Adding events to timelines can be quite complicated. The following\n // illustrates some of the corner-cases.\n //\n // Let's say we start by knowing about four timelines. timeline3 and\n // timeline4 are neighbours:\n //\n // timeline1 timeline2 timeline3 timeline4\n // [M] [P] [S] <------> [T]\n //\n // Now we paginate timeline1, and get the following events from the server:\n // [M, N, P, R, S, T, U].\n //\n // 1. First, we ignore event M, since we already know about it.\n //\n // 2. Next, we append N to timeline 1.\n //\n // 3. Next, we don't add event P, since we already know about it,\n // but we do link together the timelines. We now have:\n //\n // timeline1 timeline2 timeline3 timeline4\n // [M, N] <---> [P] [S] <------> [T]\n //\n // 4. Now we add event R to timeline2:\n //\n // timeline1 timeline2 timeline3 timeline4\n // [M, N] <---> [P, R] [S] <------> [T]\n //\n // Note that we have switched the timeline we are working on from\n // timeline1 to timeline2.\n //\n // 5. We ignore event S, but again join the timelines:\n //\n // timeline1 timeline2 timeline3 timeline4\n // [M, N] <---> [P, R] <---> [S] <------> [T]\n //\n // 6. We ignore event T, and the timelines are already joined, so there\n // is nothing to do.\n //\n // 7. Finally, we add event U to timeline4:\n //\n // timeline1 timeline2 timeline3 timeline4\n // [M, N] <---> [P, R] <---> [S] <------> [T, U]\n //\n // The important thing to note in the above is what happened when we\n // already knew about a given event:\n //\n // - if it was appropriate, we joined up the timelines (steps 3, 5).\n // - in any case, we started adding further events to the timeline which\n // contained the event we knew about (steps 3, 5, 6).\n //\n //\n // So much for adding events to the timeline. But what do we want to do\n // with the pagination token?\n //\n // In the case above, we will be given a pagination token which tells us how to\n // get events beyond 'U' - in this case, it makes sense to store this\n // against timeline4. But what if timeline4 already had 'U' and beyond? in\n // that case, our best bet is to throw away the pagination token we were\n // given and stick with whatever token timeline4 had previously. In short,\n // we want to only store the pagination token if the last event we receive\n // is one we didn't previously know about.\n //\n // We make an exception for this if it turns out that we already knew about\n // *all* of the events, and we weren't able to join up any timelines. When\n // that happens, it means our existing pagination token is faulty, since it\n // is only telling us what we already know. Rather than repeatedly\n // paginating with the same token, we might as well use the new pagination\n // token in the hope that we eventually work our way out of the mess.\n\n let didUpdate = false;\n let lastEventWasNew = false;\n for (const event of events) {\n const eventId = event.getId()!;\n\n const existingTimeline = this._eventIdToTimeline.get(eventId);\n\n if (!existingTimeline) {\n // we don't know about this event yet. Just add it to the timeline.\n this.addEventToTimeline(event, timeline, {\n toStartOfTimeline,\n addToState,\n });\n lastEventWasNew = true;\n didUpdate = true;\n continue;\n }\n\n lastEventWasNew = false;\n\n if (existingTimeline == timeline) {\n debuglog(\"Event \" + eventId + \" already in timeline \" + timeline);\n continue;\n }\n\n const neighbour = timeline.getNeighbouringTimeline(direction);\n if (neighbour) {\n // this timeline already has a neighbour in the relevant direction;\n // let's assume the timelines are already correctly linked up, and\n // skip over to it.\n //\n // there's probably some edge-case here where we end up with an\n // event which is in a timeline a way down the chain, and there is\n // a break in the chain somewhere. But I can't really imagine how\n // that would happen, so I'm going to ignore it for now.\n //\n if (existingTimeline == neighbour) {\n debuglog(\"Event \" + eventId + \" in neighbouring timeline - \" + \"switching to \" + existingTimeline);\n } else {\n debuglog(\"Event \" + eventId + \" already in a different \" + \"timeline \" + existingTimeline);\n }\n timeline = existingTimeline;\n continue;\n }\n\n // time to join the timelines.\n logger.info(\n \"Already have timeline for \" + eventId + \" - joining timeline \" + timeline + \" to \" + existingTimeline,\n );\n\n // Variables to keep the line length limited below.\n const existingIsLive = existingTimeline === this.liveTimeline;\n const timelineIsLive = timeline === this.liveTimeline;\n\n const backwardsIsLive = direction === EventTimeline.BACKWARDS && existingIsLive;\n const forwardsIsLive = direction === EventTimeline.FORWARDS && timelineIsLive;\n\n if (backwardsIsLive || forwardsIsLive) {\n // The live timeline should never be spliced into a non-live position.\n // We use independent logging to better discover the problem at a glance.\n if (backwardsIsLive) {\n logger.warn(\n \"Refusing to set a preceding existingTimeLine on our \" +\n \"timeline as the existingTimeLine is live (\" +\n existingTimeline +\n \")\",\n );\n }\n if (forwardsIsLive) {\n logger.warn(\n \"Refusing to set our preceding timeline on a existingTimeLine \" +\n \"as our timeline is live (\" +\n timeline +\n \")\",\n );\n }\n continue; // abort splicing - try next event\n }\n\n timeline.setNeighbouringTimeline(existingTimeline, direction);\n existingTimeline.setNeighbouringTimeline(timeline, inverseDirection);\n\n timeline = existingTimeline;\n didUpdate = true;\n }\n\n // see above - if the last event was new to us, or if we didn't find any\n // new information, we update the pagination token for whatever\n // timeline we ended up on.\n if (lastEventWasNew || !didUpdate) {\n if (direction === EventTimeline.FORWARDS && timeline === this.liveTimeline) {\n logger.warn({ lastEventWasNew, didUpdate }); // for debugging\n logger.warn(\n `Refusing to set forwards pagination token of live timeline ` + `${timeline} to ${paginationToken}`,\n );\n return;\n }\n timeline.setPaginationToken(paginationToken ?? null, direction);\n }\n }\n\n /**\n * Add an event to the end of this live timeline.\n *\n * @param event - Event to be added\n * @param options - addLiveEvent options\n */\n public addLiveEvent(\n event: MatrixEvent,\n { duplicateStrategy, fromCache, roomState, timelineWasEmpty, addToState }: IAddLiveEventOptions,\n ): void {\n if (this.filter) {\n const events = this.filter.filterRoomTimeline([event]);\n if (!events.length) {\n return;\n }\n }\n\n const timeline = this._eventIdToTimeline.get(event.getId()!);\n if (timeline) {\n if (duplicateStrategy === DuplicateStrategy.Replace) {\n debuglog(\"EventTimelineSet.addLiveEvent: replacing duplicate event \" + event.getId());\n const tlEvents = timeline.getEvents();\n for (let j = 0; j < tlEvents.length; j++) {\n if (tlEvents[j].getId() === event.getId()) {\n // still need to set the right metadata on this event\n if (!roomState) {\n roomState = timeline.getState(EventTimeline.FORWARDS);\n }\n EventTimeline.setEventMetadata(event, roomState!, false);\n tlEvents[j] = event;\n\n // XXX: we need to fire an event when this happens.\n break;\n }\n }\n } else {\n debuglog(\"EventTimelineSet.addLiveEvent: ignoring duplicate event \" + event.getId());\n }\n return;\n }\n\n this.addEventToTimeline(event, this.liveTimeline, {\n toStartOfTimeline: false,\n fromCache,\n roomState,\n timelineWasEmpty,\n addToState,\n });\n }\n\n /**\n * Add event to the given timeline, and emit Room.timeline. Assumes\n * we have already checked we don't know about this event.\n *\n * Will fire \"Room.timeline\" for each event added.\n *\n * @param event - the event to add\n * @param timeline - the timeline onto which to add it\n * @param options - addEventToTimeline options\n *\n * @remarks\n * Fires {@link RoomEvent.Timeline}\n */\n public addEventToTimeline(\n event: MatrixEvent,\n timeline: EventTimeline,\n { toStartOfTimeline, fromCache = false, roomState, timelineWasEmpty, addToState }: IAddEventToTimelineOptions,\n ): void {\n if (timeline.getTimelineSet() !== this) {\n throw new Error(`EventTimelineSet.addEventToTimeline: Timeline=${timeline.toString()} does not belong \" +\n \"in timelineSet(threadId=${this.thread?.id})`);\n }\n\n const eventId = event.getId()!;\n this.relations.aggregateParentEvent(event);\n this.relations.aggregateChildEvent(event, this);\n\n // Make sure events don't get mixed in timelines they shouldn't be in (e.g. a\n // threaded message should not be in the main timeline).\n //\n // We can only run this check for timelines with a `room` because `canContain`\n // requires it\n if (this.room && !this.canContain(event)) {\n let eventDebugString = `event=${eventId}`;\n if (event.threadRootId) {\n eventDebugString += `(belongs to thread=${event.threadRootId})`;\n }\n logger.warn(\n `EventTimelineSet.addEventToTimeline: Ignoring ${eventDebugString} that does not belong ` +\n `in timeline=${timeline.toString()} timelineSet(threadId=${this.thread?.id})`,\n );\n return;\n }\n\n timeline.addEvent(event, {\n toStartOfTimeline,\n roomState,\n timelineWasEmpty,\n addToState,\n });\n this._eventIdToTimeline.set(eventId, timeline);\n\n const data: IRoomTimelineData = {\n timeline: timeline,\n liveEvent: !toStartOfTimeline && timeline == this.liveTimeline && !fromCache,\n };\n this.emit(RoomEvent.Timeline, event, this.room, Boolean(toStartOfTimeline), false, data);\n }\n\n /**\n * Insert event to the given timeline, and emit Room.timeline. Assumes\n * we have already checked we don't know about this event.\n *\n * TEMPORARY: until we have recursive relations, we need this function\n * to exist to allow us to insert events in timeline order, which is our\n * best guess for Sync Order.\n * This is a copy of addEventToTimeline above, modified to insert the event\n * after the event it relates to, and before any event with a later\n * timestamp. This is our best guess at Sync Order.\n *\n * Will fire \"Room.timeline\" for each event added.\n *\n * @internal\n *\n * @remarks\n * Fires {@link RoomEvent.Timeline}\n */\n public insertEventIntoTimeline(\n event: MatrixEvent,\n timeline: EventTimeline,\n roomState: RoomState,\n addToState: boolean,\n ): void {\n if (timeline.getTimelineSet() !== this) {\n throw new Error(`EventTimelineSet.insertEventIntoTimeline: Timeline=${timeline.toString()} does not belong \" +\n \"in timelineSet(threadId=${this.thread?.id})`);\n }\n\n const eventId = event.getId()!;\n this.relations.aggregateParentEvent(event);\n this.relations.aggregateChildEvent(event, this);\n\n // Make sure events don't get mixed in timelines they shouldn't be in (e.g. a\n // threaded message should not be in the main timeline).\n //\n // We can only run this check for timelines with a `room` because `canContain`\n // requires it\n if (this.room && !this.canContain(event)) {\n let eventDebugString = `event=${eventId}`;\n if (event.threadRootId) {\n eventDebugString += `(belongs to thread=${event.threadRootId})`;\n }\n logger.warn(\n `EventTimelineSet.insertEventIntoTimeline: Ignoring ${eventDebugString} that does not belong ` +\n `in timeline=${timeline.toString()} timelineSet(threadId=${this.thread?.id})`,\n );\n return;\n }\n\n // Find the event that this event is related to - the \"parent\"\n const parentEventId = event.relationEventId;\n if (!parentEventId) {\n // Not related to anything - we just append\n this.addEventToTimeline(event, timeline, {\n toStartOfTimeline: false,\n fromCache: false,\n timelineWasEmpty: false,\n roomState,\n addToState,\n });\n return;\n }\n\n const parentEvent = this.findEventById(parentEventId);\n\n const timelineEvents = timeline.getEvents();\n\n // Start searching from the parent event, or if it's not loaded, start\n // at the beginning and insert purely using timestamp order.\n const parentIndex = parentEvent !== undefined ? timelineEvents.indexOf(parentEvent) : 0;\n let insertIndex = parentIndex;\n for (; insertIndex < timelineEvents.length; insertIndex++) {\n const nextEvent = timelineEvents[insertIndex];\n if (nextEvent.getTs() > event.getTs()) {\n // We found an event later than ours, so insert before that.\n break;\n }\n }\n // If we got to the end of the loop, insertIndex points at the end of\n // the list.\n\n timeline.insertEvent(event, insertIndex, roomState, addToState);\n this._eventIdToTimeline.set(eventId, timeline);\n\n const data: IRoomTimelineData = {\n timeline: timeline,\n // The purpose of this method is inserting events in the middle of the\n // timeline, so the events are, by definition, not live (whether or not\n // we're adding them to the live timeline).\n liveEvent: false,\n };\n this.emit(RoomEvent.Timeline, event, this.room, false, false, data);\n }\n\n /**\n * Replaces event with ID oldEventId with one with newEventId, if oldEventId is\n * recognised. Otherwise, add to the live timeline. Used to handle remote echos.\n *\n * @param localEvent - the new event to be added to the timeline\n * @param oldEventId - the ID of the original event\n * @param newEventId - the ID of the replacement event\n *\n * @remarks\n * Fires {@link RoomEvent.Timeline}\n */\n public handleRemoteEcho(localEvent: MatrixEvent, oldEventId: string, newEventId: string): void {\n // XXX: why don't we infer newEventId from localEvent?\n const existingTimeline = this._eventIdToTimeline.get(oldEventId);\n if (existingTimeline) {\n this._eventIdToTimeline.delete(oldEventId);\n this._eventIdToTimeline.set(newEventId, existingTimeline);\n } else if (!this.filter || this.filter.filterRoomTimeline([localEvent]).length) {\n this.addEventToTimeline(localEvent, this.liveTimeline, {\n toStartOfTimeline: false,\n addToState: false,\n });\n }\n }\n\n /**\n * Removes a single event from this room.\n *\n * @param eventId - The id of the event to remove\n *\n * @returns the removed event, or null if the event was not found\n * in this room.\n */\n public removeEvent(eventId: string): MatrixEvent | null {\n const timeline = this._eventIdToTimeline.get(eventId);\n if (!timeline) {\n return null;\n }\n\n const removed = timeline.removeEvent(eventId);\n if (removed) {\n this._eventIdToTimeline.delete(eventId);\n const data = {\n timeline: timeline,\n };\n this.emit(RoomEvent.Timeline, removed, this.room, undefined, true, data);\n }\n return removed;\n }\n\n /**\n * Determine where two events appear in the timeline relative to one another\n *\n * @param eventId1 - The id of the first event\n * @param eventId2 - The id of the second event\n\n * @returns -1 if eventId1 precedes eventId2, and +1 eventId1 succeeds\n * eventId2. 0 if they are the same event; null if we can't tell (either\n * because we don't know about one of the events, or because they are in\n * separate timelines which don't join up).\n */\n public compareEventOrdering(eventId1: string, eventId2: string): number | null {\n if (eventId1 == eventId2) {\n // optimise this case\n return 0;\n }\n\n const timeline1 = this._eventIdToTimeline.get(eventId1);\n const timeline2 = this._eventIdToTimeline.get(eventId2);\n\n if (timeline1 === undefined) {\n return null;\n }\n if (timeline2 === undefined) {\n return null;\n }\n\n if (timeline1 === timeline2) {\n // both events are in the same timeline - figure out their relative indices\n let idx1: number | undefined = undefined;\n let idx2: number | undefined = undefined;\n const events = timeline1.getEvents();\n for (let idx = 0; idx < events.length && (idx1 === undefined || idx2 === undefined); idx++) {\n const evId = events[idx].getId();\n if (evId == eventId1) {\n idx1 = idx;\n }\n if (evId == eventId2) {\n idx2 = idx;\n }\n }\n const difference = idx1! - idx2!;\n\n // Return the sign of difference.\n if (difference < 0) {\n return -1;\n } else if (difference > 0) {\n return 1;\n } else {\n return 0;\n }\n }\n\n // the events are in different timelines. Iterate through the\n // linkedlist to see which comes first.\n\n // first work forwards from timeline1\n let tl: EventTimeline | null = timeline1;\n while (tl) {\n if (tl === timeline2) {\n // timeline1 is before timeline2\n return -1;\n }\n tl = tl.getNeighbouringTimeline(EventTimeline.FORWARDS);\n }\n\n // now try backwards from timeline1\n tl = timeline1;\n while (tl) {\n if (tl === timeline2) {\n // timeline2 is before timeline1\n return 1;\n }\n tl = tl.getNeighbouringTimeline(EventTimeline.BACKWARDS);\n }\n\n // the timelines are not contiguous.\n return null;\n }\n\n /**\n * Determine whether a given event can sanely be added to this event timeline set,\n * for timeline sets relating to a thread, only return true for events in the same\n * thread timeline, for timeline sets not relating to a thread only return true\n * for events which should be shown in the main room timeline.\n * Requires the `room` property to have been set at EventTimelineSet construction time.\n *\n * @param event - the event to check whether it belongs to this timeline set.\n * @throws Error if `room` was not set when constructing this timeline set.\n * @returns whether the event belongs to this timeline set.\n */\n public canContain(event: MatrixEvent): boolean {\n if (!this.room) {\n throw new Error(\n \"Cannot call `EventTimelineSet::canContain without a `room` set. \" +\n \"Set the room when creating the EventTimelineSet to call this method.\",\n );\n }\n\n const { threadId, shouldLiveInRoom, shouldLiveInThread } = this.room.eventShouldLiveIn(event);\n\n if (this.thread) {\n return this.thread.id === threadId;\n }\n\n if (!shouldLiveInRoom && !shouldLiveInThread) {\n logger.warn(\n `EventTimelineSet:canContain event encountered which cannot be added to any timeline roomId=${\n this.room?.roomId\n } eventId=${event.getId()} threadId=${event.threadRootId}`,\n );\n }\n\n return shouldLiveInRoom;\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,aAAa,QAA+B,qBAAqB;AAE1E,SAAS,MAAM,QAAQ,cAAc;AACrC,SAAoB,SAAS,QAAQ,WAAW;AAGhD,SAAS,iBAAiB,QAAQ,0BAA0B;AAC5D,SAAS,kBAAkB,QAAQ,0BAA0B;AAI7D,MAAM,KAAK,GAAG,IAAI;;AAElB;AACA,IAAI,QAAkC;AACtC,IAAI,KAAK,EAAE;EACP;EACA,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC;AACtC,CAAC,MAAM;EACH;EACA,QAAQ,GAAG,YAAkB,CAAC,CAAC;AACnC;AAUA,WAAY,iBAAiB,0BAAjB,iBAAiB;EAAjB,iBAAiB;EAAjB,iBAAiB;EAAA,OAAjB,iBAAiB;AAAA;AAkF7B,OAAO,MAAM,gBAAgB,SAAS,iBAAiB,CAA4C;EAS/F;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACW,WAAW,CACE,IAAsB,EACtC,IAAW,GAAG,CAAC,CAAC,EAChB,MAAqB,EACL,MAAe,EACf,cAAuC,GAAG,IAAI,EAChE;IACE,KAAK,CAAC,CAAC;IAAC;IAAA;IAAA;IAAA;IAAA;IAAA,4CAxCiB,IAAI,GAAG,CAAwB,CAAC;IAAA;IAAA,KAkCzC,IAAsB,GAAtB,IAAsB;IAAA,KAGtB,MAAe,GAAf,MAAe;IAAA,KACf,cAAuC,GAAvC,cAAuC;IAIvD,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC;IACpD,IAAI,C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IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,QAAQ;IACtC;IAEA,IAAI,CAAC,gBAAgB,IAAI,CAAC,kBAAkB,EAAE;MAC1C,MAAM,CAAC,IAAI,CACP,8FACI,IAAI,CAAC,IAAI,EAAE,MAAM,YACT,KAAK,CAAC,KAAK,CAAC,CAAC,aAAa,KAAK,CAAC,YAAY,EAC5D,CAAC;IACL;IAEA,OAAO,gBAAgB;EAC3B;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"event-timeline-set.js","names":[],"sources":["../../src/models/event-timeline-set.ts"],"sourcesContent":["/*\nCopyright 2016 - 2021 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { EventTimeline, type IAddEventOptions } from \"./event-timeline.ts\";\nimport { type MatrixEvent } from \"./event.ts\";\nimport { logger } from \"../logger.ts\";\nimport { type Room, RoomEvent } from \"./room.ts\";\nimport { type Filter } from \"../filter.ts\";\nimport { type RoomState } from \"./room-state.ts\";\nimport { TypedEventEmitter } from \"./typed-event-emitter.ts\";\nimport { RelationsContainer } from \"./relations-container.ts\";\nimport { type MatrixClient } from \"../client.ts\";\nimport { type Thread, type ThreadFilterType } from \"./thread.ts\";\n\nconst DEBUG = true;\n\n/* istanbul ignore next */\nlet debuglog: (...args: any[]) => void;\nif (DEBUG) {\n // using bind means that we get to keep useful line numbers in the console\n debuglog = logger.log.bind(logger);\n} else {\n /* istanbul ignore next */\n debuglog = function (): void {};\n}\n\ninterface IOpts {\n // Set to true to enable improved timeline support.\n timelineSupport?: boolean;\n // The filter object, if any, for this timelineSet.\n filter?: Filter;\n pendingEvents?: boolean;\n}\n\nexport enum DuplicateStrategy {\n Ignore = \"ignore\",\n Replace = \"replace\",\n}\n\nexport interface IRoomTimelineData {\n // the timeline the event was added to/removed from\n timeline: EventTimeline;\n // true if the event was a real-time event added to the end of the live timeline\n liveEvent?: boolean;\n}\n\nexport interface IAddEventToTimelineOptions extends Pick<\n IAddEventOptions,\n \"toStartOfTimeline\" | \"roomState\" | \"timelineWasEmpty\" | \"addToState\"\n> {\n /** Whether the sync response came from cache */\n fromCache?: boolean;\n}\n\nexport interface IAddLiveEventOptions extends Pick<\n IAddEventToTimelineOptions,\n \"fromCache\" | \"roomState\" | \"timelineWasEmpty\" | \"addToState\"\n> {\n /** Applies to events in the timeline only. If this is 'replace' then if a\n * duplicate is encountered, the event passed to this function will replace\n * the existing event in the timeline. If this is not specified, or is\n * 'ignore', then the event passed to this function will be ignored\n * entirely, preserving the existing event in the timeline. Events are\n * identical based on their event ID <b>only</b>. */\n duplicateStrategy?: DuplicateStrategy;\n}\n\ntype EmittedEvents = RoomEvent.Timeline | RoomEvent.TimelineReset;\n\nexport type EventTimelineSetHandlerMap = {\n /**\n * Fires whenever the timeline in a room is updated.\n * @param event - The matrix event which caused this event to fire.\n * @param room - The room, if any, whose timeline was updated.\n * @param toStartOfTimeline - True if this event was added to the start\n * @param removed - True if this event has just been removed from the timeline\n * (beginning; oldest) of the timeline e.g. due to pagination.\n *\n * @param data - more data about the event\n *\n * @example\n * ```\n * matrixClient.on(\"Room.timeline\",\n * function(event, room, toStartOfTimeline, removed, data) {\n * if (!toStartOfTimeline && data.liveEvent) {\n * var messageToAppend = room.timeline.[room.timeline.length - 1];\n * }\n * });\n * ```\n */\n [RoomEvent.Timeline]: (\n event: MatrixEvent,\n room: Room | undefined,\n toStartOfTimeline: boolean | undefined,\n removed: boolean,\n data: IRoomTimelineData,\n ) => void;\n /**\n * Fires whenever the live timeline in a room is reset.\n *\n * When we get a 'limited' sync (for example, after a network outage), we reset\n * the live timeline to be empty before adding the recent events to the new\n * timeline. This event is fired after the timeline is reset, and before the\n * new events are added.\n *\n * @param room - The room whose live timeline was reset, if any\n * @param timelineSet - timelineSet room whose live timeline was reset\n * @param resetAllTimelines - True if all timelines were reset.\n */\n [RoomEvent.TimelineReset]: (\n room: Room | undefined,\n timelineSet: EventTimelineSet,\n resetAllTimelines: boolean,\n ) => void;\n};\n\nexport class EventTimelineSet extends TypedEventEmitter<EmittedEvents, EventTimelineSetHandlerMap> {\n public readonly relations: RelationsContainer;\n private readonly timelineSupport: boolean;\n private readonly displayPendingEvents: boolean;\n private liveTimeline: EventTimeline;\n private timelines: EventTimeline[];\n private _eventIdToTimeline = new Map<string, EventTimeline>();\n private filter?: Filter;\n\n /**\n * Construct a set of EventTimeline objects, typically on behalf of a given\n * room. A room may have multiple EventTimelineSets for different levels\n * of filtering. The global notification list is also an EventTimelineSet, but\n * lacks a room.\n *\n * <p>This is an ordered sequence of timelines, which may or may not\n * be continuous. Each timeline lists a series of events, as well as tracking\n * the room state at the start and the end of the timeline (if appropriate).\n * It also tracks forward and backward pagination tokens, as well as containing\n * links to the next timeline in the sequence.\n *\n * <p>There is one special timeline - the 'live' timeline, which represents the\n * timeline to which events are being added in real-time as they are received\n * from the /sync API. Note that you should not retain references to this\n * timeline - even if it is the current timeline right now, it may not remain\n * so if the server gives us a timeline gap in /sync.\n *\n * <p>In order that we can find events from their ids later, we also maintain a\n * map from event_id to timeline and index.\n *\n * @param room - Room for this timelineSet. May be null for non-room cases, such as the\n * notification timeline.\n * @param opts - Options inherited from Room.\n * @param client - the Matrix client which owns this EventTimelineSet,\n * can be omitted if room is specified.\n * @param thread - the thread to which this timeline set relates.\n * @param threadListType - the type of thread list represented, if any\n * (e.g., All threads or My threads)\n */\n public constructor(\n public readonly room: Room | undefined,\n opts: IOpts = {},\n client?: MatrixClient,\n public readonly thread?: Thread,\n public readonly threadListType: ThreadFilterType | null = null,\n ) {\n super();\n\n this.timelineSupport = Boolean(opts.timelineSupport);\n this.liveTimeline = new EventTimeline(this);\n this.displayPendingEvents = opts.pendingEvents !== false;\n\n // just a list - *not* ordered.\n this.timelines = [this.liveTimeline];\n this._eventIdToTimeline = new Map<string, EventTimeline>();\n\n this.filter = opts.filter;\n\n this.relations = this.room?.relations ?? new RelationsContainer(room?.client ?? client!);\n }\n\n /**\n * Get all the timelines in this set\n * @returns the timelines in this set\n */\n public getTimelines(): EventTimeline[] {\n return this.timelines;\n }\n\n /**\n * Get the filter object this timeline set is filtered on, if any\n * @returns the optional filter for this timelineSet\n */\n public getFilter(): Filter | undefined {\n return this.filter;\n }\n\n /**\n * Set the filter object this timeline set is filtered on\n * (passed to the server when paginating via /messages).\n * @param filter - the filter for this timelineSet\n */\n public setFilter(filter?: Filter): void {\n this.filter = filter;\n }\n\n /**\n * Get the list of pending sent events for this timelineSet's room, filtered\n * by the timelineSet's filter if appropriate.\n *\n * @returns A list of the sent events\n * waiting for remote echo.\n *\n * @throws If `opts.pendingEventOrdering` was not 'detached'\n */\n public getPendingEvents(): MatrixEvent[] {\n if (!this.room || !this.displayPendingEvents) {\n return [];\n }\n\n return this.room.getPendingEvents();\n }\n /**\n * Get the live timeline for this room.\n *\n * @returns live timeline\n */\n public getLiveTimeline(): EventTimeline {\n return this.liveTimeline;\n }\n\n /**\n * Set the live timeline for this room.\n *\n * @returns live timeline\n */\n public setLiveTimeline(timeline: EventTimeline): void {\n this.liveTimeline = timeline;\n }\n\n /**\n * Return the timeline (if any) this event is in.\n * @param eventId - the eventId being sought\n * @returns timeline\n */\n public eventIdToTimeline(eventId: string): EventTimeline | undefined {\n return this._eventIdToTimeline.get(eventId);\n }\n\n /**\n * Track a new event as if it were in the same timeline as an old event,\n * replacing it.\n * @param oldEventId - event ID of the original event\n * @param newEventId - event ID of the replacement event\n */\n public replaceEventId(oldEventId: string, newEventId: string): void {\n const existingTimeline = this._eventIdToTimeline.get(oldEventId);\n if (existingTimeline) {\n this._eventIdToTimeline.delete(oldEventId);\n this._eventIdToTimeline.set(newEventId, existingTimeline);\n }\n }\n\n /**\n * Reset the live timeline, and start a new one.\n *\n * <p>This is used when /sync returns a 'limited' timeline.\n *\n * @param backPaginationToken - token for back-paginating the new timeline\n * @param forwardPaginationToken - token for forward-paginating the old live timeline,\n * if absent or null, all timelines are reset.\n *\n * @remarks\n * Fires {@link RoomEvent.TimelineReset}\n */\n public resetLiveTimeline(backPaginationToken?: string, forwardPaginationToken?: string): void {\n // Each EventTimeline has RoomState objects tracking the state at the start\n // and end of that timeline. The copies at the end of the live timeline are\n // special because they will have listeners attached to monitor changes to\n // the current room state, so we move this RoomState from the end of the\n // current live timeline to the end of the new one and, if necessary,\n // replace it with a newly created one. We also make a copy for the start\n // of the new timeline.\n\n // if timeline support is disabled, forget about the old timelines\n const resetAllTimelines = !this.timelineSupport || !forwardPaginationToken;\n\n const oldTimeline = this.liveTimeline;\n const newTimeline = resetAllTimelines\n ? oldTimeline.forkLive(EventTimeline.FORWARDS)\n : oldTimeline.fork(EventTimeline.FORWARDS);\n\n if (resetAllTimelines) {\n this.timelines = [newTimeline];\n this._eventIdToTimeline = new Map<string, EventTimeline>();\n } else {\n this.timelines.push(newTimeline);\n }\n\n if (forwardPaginationToken) {\n // Now set the forward pagination token on the old live timeline\n // so it can be forward-paginated.\n oldTimeline.setPaginationToken(forwardPaginationToken, EventTimeline.FORWARDS);\n }\n\n // make sure we set the pagination token before firing timelineReset,\n // otherwise clients which start back-paginating will fail, and then get\n // stuck without realising that they *can* back-paginate.\n newTimeline.setPaginationToken(backPaginationToken ?? null, EventTimeline.BACKWARDS);\n\n // Now we can swap the live timeline to the new one.\n this.liveTimeline = newTimeline;\n this.emit(RoomEvent.TimelineReset, this.room, this, resetAllTimelines);\n }\n\n /**\n * Get the timeline which contains the given event, if any\n *\n * @param eventId - event ID to look for\n * @returns timeline containing\n * the given event, or null if unknown\n */\n public getTimelineForEvent(eventId?: string): EventTimeline | null {\n if (eventId === null || eventId === undefined) {\n return null;\n }\n const res = this._eventIdToTimeline.get(eventId);\n return res === undefined ? null : res;\n }\n\n /**\n * Get an event which is stored in our timelines\n *\n * @param eventId - event ID to look for\n * @returns the given event, or undefined if unknown\n */\n public findEventById(eventId: string): MatrixEvent | undefined {\n const tl = this.getTimelineForEvent(eventId);\n if (!tl) {\n return undefined;\n }\n return tl.getEvents().find(function (ev) {\n return ev.getId() == eventId;\n });\n }\n\n /**\n * Add a new timeline to this timeline list\n *\n * @returns newly-created timeline\n */\n public addTimeline(): EventTimeline {\n if (!this.timelineSupport) {\n throw new Error(\n \"timeline support is disabled. Set the 'timelineSupport'\" +\n \" parameter to true when creating MatrixClient to enable\" +\n \" it.\",\n );\n }\n\n const timeline = new EventTimeline(this);\n this.timelines.push(timeline);\n return timeline;\n }\n\n /**\n * Add events to a timeline\n *\n * <p>Will fire \"Room.timeline\" for each event added.\n *\n * @param events - A list of events to add.\n *\n * @param toStartOfTimeline - True to add these events to the start\n * (oldest) instead of the end (newest) of the timeline. If true, the oldest\n * event will be the <b>last</b> element of 'events'.\n *\n * @param timeline - timeline to\n * add events to.\n *\n * @param paginationToken - token for the next batch of events\n *\n * @remarks\n * Fires {@link RoomEvent.Timeline}\n *\n */\n public addEventsToTimeline(\n events: MatrixEvent[],\n toStartOfTimeline: boolean,\n addToState: boolean,\n timeline: EventTimeline,\n paginationToken?: string | null,\n ): void {\n if (!timeline) {\n throw new Error(\"'timeline' not specified for EventTimelineSet.addEventsToTimeline\");\n }\n\n if (!toStartOfTimeline && timeline == this.liveTimeline) {\n throw new Error(\n \"EventTimelineSet.addEventsToTimeline cannot be used for adding events to \" +\n \"the live timeline - use Room.addLiveEvents instead\",\n );\n }\n\n if (this.filter) {\n events = this.filter.filterRoomTimeline(events);\n if (!events.length) {\n return;\n }\n }\n\n const direction = toStartOfTimeline ? EventTimeline.BACKWARDS : EventTimeline.FORWARDS;\n const inverseDirection = toStartOfTimeline ? EventTimeline.FORWARDS : EventTimeline.BACKWARDS;\n\n // Adding events to timelines can be quite complicated. The following\n // illustrates some of the corner-cases.\n //\n // Let's say we start by knowing about four timelines. timeline3 and\n // timeline4 are neighbours:\n //\n // timeline1 timeline2 timeline3 timeline4\n // [M] [P] [S] <------> [T]\n //\n // Now we paginate timeline1, and get the following events from the server:\n // [M, N, P, R, S, T, U].\n //\n // 1. First, we ignore event M, since we already know about it.\n //\n // 2. Next, we append N to timeline 1.\n //\n // 3. Next, we don't add event P, since we already know about it,\n // but we do link together the timelines. We now have:\n //\n // timeline1 timeline2 timeline3 timeline4\n // [M, N] <---> [P] [S] <------> [T]\n //\n // 4. Now we add event R to timeline2:\n //\n // timeline1 timeline2 timeline3 timeline4\n // [M, N] <---> [P, R] [S] <------> [T]\n //\n // Note that we have switched the timeline we are working on from\n // timeline1 to timeline2.\n //\n // 5. We ignore event S, but again join the timelines:\n //\n // timeline1 timeline2 timeline3 timeline4\n // [M, N] <---> [P, R] <---> [S] <------> [T]\n //\n // 6. We ignore event T, and the timelines are already joined, so there\n // is nothing to do.\n //\n // 7. Finally, we add event U to timeline4:\n //\n // timeline1 timeline2 timeline3 timeline4\n // [M, N] <---> [P, R] <---> [S] <------> [T, U]\n //\n // The important thing to note in the above is what happened when we\n // already knew about a given event:\n //\n // - if it was appropriate, we joined up the timelines (steps 3, 5).\n // - in any case, we started adding further events to the timeline which\n // contained the event we knew about (steps 3, 5, 6).\n //\n //\n // So much for adding events to the timeline. But what do we want to do\n // with the pagination token?\n //\n // In the case above, we will be given a pagination token which tells us how to\n // get events beyond 'U' - in this case, it makes sense to store this\n // against timeline4. But what if timeline4 already had 'U' and beyond? in\n // that case, our best bet is to throw away the pagination token we were\n // given and stick with whatever token timeline4 had previously. In short,\n // we want to only store the pagination token if the last event we receive\n // is one we didn't previously know about.\n //\n // We make an exception for this if it turns out that we already knew about\n // *all* of the events, and we weren't able to join up any timelines. When\n // that happens, it means our existing pagination token is faulty, since it\n // is only telling us what we already know. Rather than repeatedly\n // paginating with the same token, we might as well use the new pagination\n // token in the hope that we eventually work our way out of the mess.\n\n let didUpdate = false;\n let lastEventWasNew = false;\n for (const event of events) {\n const eventId = event.getId()!;\n\n const existingTimeline = this._eventIdToTimeline.get(eventId);\n\n if (!existingTimeline) {\n // we don't know about this event yet. Just add it to the timeline.\n this.addEventToTimeline(event, timeline, {\n toStartOfTimeline,\n addToState,\n });\n lastEventWasNew = true;\n didUpdate = true;\n continue;\n }\n\n lastEventWasNew = false;\n\n if (existingTimeline == timeline) {\n debuglog(\"Event \" + eventId + \" already in timeline \" + timeline);\n continue;\n }\n\n const neighbour = timeline.getNeighbouringTimeline(direction);\n if (neighbour) {\n // this timeline already has a neighbour in the relevant direction;\n // let's assume the timelines are already correctly linked up, and\n // skip over to it.\n //\n // there's probably some edge-case here where we end up with an\n // event which is in a timeline a way down the chain, and there is\n // a break in the chain somewhere. But I can't really imagine how\n // that would happen, so I'm going to ignore it for now.\n //\n if (existingTimeline == neighbour) {\n debuglog(\"Event \" + eventId + \" in neighbouring timeline - switching to \" + existingTimeline);\n } else {\n debuglog(\"Event \" + eventId + \" already in a different timeline \" + existingTimeline);\n }\n timeline = existingTimeline;\n continue;\n }\n\n // time to join the timelines.\n logger.info(\n \"Already have timeline for \" + eventId + \" - joining timeline \" + timeline + \" to \" + existingTimeline,\n );\n\n // Variables to keep the line length limited below.\n const existingIsLive = existingTimeline === this.liveTimeline;\n const timelineIsLive = timeline === this.liveTimeline;\n\n const backwardsIsLive = direction === EventTimeline.BACKWARDS && existingIsLive;\n const forwardsIsLive = direction === EventTimeline.FORWARDS && timelineIsLive;\n\n if (backwardsIsLive || forwardsIsLive) {\n // The live timeline should never be spliced into a non-live position.\n // We use independent logging to better discover the problem at a glance.\n if (backwardsIsLive) {\n logger.warn(\n \"Refusing to set a preceding existingTimeLine on our \" +\n \"timeline as the existingTimeLine is live (\" +\n existingTimeline +\n \")\",\n );\n }\n if (forwardsIsLive) {\n logger.warn(\n \"Refusing to set our preceding timeline on a existingTimeLine \" +\n \"as our timeline is live (\" +\n timeline +\n \")\",\n );\n }\n continue; // abort splicing - try next event\n }\n\n timeline.setNeighbouringTimeline(existingTimeline, direction);\n existingTimeline.setNeighbouringTimeline(timeline, inverseDirection);\n\n timeline = existingTimeline;\n didUpdate = true;\n }\n\n // see above - if the last event was new to us, or if we didn't find any\n // new information, we update the pagination token for whatever\n // timeline we ended up on.\n if (lastEventWasNew || !didUpdate) {\n if (direction === EventTimeline.FORWARDS && timeline === this.liveTimeline) {\n logger.warn({ lastEventWasNew, didUpdate }); // for debugging\n logger.warn(\n `Refusing to set forwards pagination token of live timeline ${timeline} to ${paginationToken}`,\n );\n return;\n }\n timeline.setPaginationToken(paginationToken ?? null, direction);\n }\n }\n\n /**\n * Add an event to the end of this live timeline.\n *\n * @param event - Event to be added\n * @param options - addLiveEvent options\n */\n public addLiveEvent(\n event: MatrixEvent,\n { duplicateStrategy, fromCache, roomState, timelineWasEmpty, addToState }: IAddLiveEventOptions,\n ): void {\n if (this.filter) {\n const events = this.filter.filterRoomTimeline([event]);\n if (!events.length) {\n return;\n }\n }\n\n const timeline = this._eventIdToTimeline.get(event.getId()!);\n if (timeline) {\n if (duplicateStrategy === DuplicateStrategy.Replace) {\n debuglog(\"EventTimelineSet.addLiveEvent: replacing duplicate event \" + event.getId());\n const tlEvents = timeline.getEvents();\n for (let j = 0; j < tlEvents.length; j++) {\n if (tlEvents[j].getId() === event.getId()) {\n // still need to set the right metadata on this event\n if (!roomState) {\n roomState = timeline.getState(EventTimeline.FORWARDS);\n }\n EventTimeline.setEventMetadata(event, roomState!, false);\n tlEvents[j] = event;\n\n // XXX: we need to fire an event when this happens.\n break;\n }\n }\n } else {\n debuglog(\"EventTimelineSet.addLiveEvent: ignoring duplicate event \" + event.getId());\n }\n return;\n }\n\n this.addEventToTimeline(event, this.liveTimeline, {\n toStartOfTimeline: false,\n fromCache,\n roomState,\n timelineWasEmpty,\n addToState,\n });\n }\n\n /**\n * Add event to the given timeline, and emit Room.timeline. Assumes\n * we have already checked we don't know about this event.\n *\n * Will fire \"Room.timeline\" for each event added.\n *\n * @param event - the event to add\n * @param timeline - the timeline onto which to add it\n * @param options - addEventToTimeline options\n *\n * @remarks\n * Fires {@link RoomEvent.Timeline}\n */\n public addEventToTimeline(\n event: MatrixEvent,\n timeline: EventTimeline,\n { toStartOfTimeline, fromCache = false, roomState, timelineWasEmpty, addToState }: IAddEventToTimelineOptions,\n ): void {\n if (timeline.getTimelineSet() !== this) {\n throw new Error(`EventTimelineSet.addEventToTimeline: Timeline=${timeline.toString()} does not belong \" +\n \"in timelineSet(threadId=${this.thread?.id})`);\n }\n\n const eventId = event.getId()!;\n this.relations.aggregateParentEvent(event);\n this.relations.aggregateChildEvent(event, this);\n\n // Make sure events don't get mixed in timelines they shouldn't be in (e.g. a\n // threaded message should not be in the main timeline).\n //\n // We can only run this check for timelines with a `room` because `canContain`\n // requires it\n if (this.room && !this.canContain(event)) {\n let eventDebugString = `event=${eventId}`;\n if (event.threadRootId) {\n eventDebugString += `(belongs to thread=${event.threadRootId})`;\n }\n logger.warn(\n `EventTimelineSet.addEventToTimeline: Ignoring ${eventDebugString} that does not belong ` +\n `in timeline=${timeline.toString()} timelineSet(threadId=${this.thread?.id})`,\n );\n return;\n }\n\n timeline.addEvent(event, {\n toStartOfTimeline,\n roomState,\n timelineWasEmpty,\n addToState,\n });\n this._eventIdToTimeline.set(eventId, timeline);\n\n const data: IRoomTimelineData = {\n timeline: timeline,\n liveEvent: !toStartOfTimeline && timeline == this.liveTimeline && !fromCache,\n };\n this.emit(RoomEvent.Timeline, event, this.room, Boolean(toStartOfTimeline), false, data);\n }\n\n /**\n * Insert event to the given timeline, and emit Room.timeline. Assumes\n * we have already checked we don't know about this event.\n *\n * TEMPORARY: until we have recursive relations, we need this function\n * to exist to allow us to insert events in timeline order, which is our\n * best guess for Sync Order.\n * This is a copy of addEventToTimeline above, modified to insert the event\n * after the event it relates to, and before any event with a later\n * timestamp. This is our best guess at Sync Order.\n *\n * Will fire \"Room.timeline\" for each event added.\n *\n * @internal\n *\n * @remarks\n * Fires {@link RoomEvent.Timeline}\n */\n public insertEventIntoTimeline(\n event: MatrixEvent,\n timeline: EventTimeline,\n roomState: RoomState,\n addToState: boolean,\n ): void {\n if (timeline.getTimelineSet() !== this) {\n throw new Error(`EventTimelineSet.insertEventIntoTimeline: Timeline=${timeline.toString()} does not belong \" +\n \"in timelineSet(threadId=${this.thread?.id})`);\n }\n\n const eventId = event.getId()!;\n this.relations.aggregateParentEvent(event);\n this.relations.aggregateChildEvent(event, this);\n\n // Make sure events don't get mixed in timelines they shouldn't be in (e.g. a\n // threaded message should not be in the main timeline).\n //\n // We can only run this check for timelines with a `room` because `canContain`\n // requires it\n if (this.room && !this.canContain(event)) {\n let eventDebugString = `event=${eventId}`;\n if (event.threadRootId) {\n eventDebugString += `(belongs to thread=${event.threadRootId})`;\n }\n logger.warn(\n `EventTimelineSet.insertEventIntoTimeline: Ignoring ${eventDebugString} that does not belong ` +\n `in timeline=${timeline.toString()} timelineSet(threadId=${this.thread?.id})`,\n );\n return;\n }\n\n // Find the event that this event is related to - the \"parent\"\n const parentEventId = event.relationEventId;\n if (!parentEventId) {\n // Not related to anything - we just append\n this.addEventToTimeline(event, timeline, {\n toStartOfTimeline: false,\n fromCache: false,\n timelineWasEmpty: false,\n roomState,\n addToState,\n });\n return;\n }\n\n const parentEvent = this.findEventById(parentEventId);\n\n const timelineEvents = timeline.getEvents();\n\n // Start searching from the parent event, or if it's not loaded, start\n // at the beginning and insert purely using timestamp order.\n const parentIndex = parentEvent !== undefined ? timelineEvents.indexOf(parentEvent) : 0;\n let insertIndex = parentIndex;\n for (; insertIndex < timelineEvents.length; insertIndex++) {\n const nextEvent = timelineEvents[insertIndex];\n if (nextEvent.getTs() > event.getTs()) {\n // We found an event later than ours, so insert before that.\n break;\n }\n }\n // If we got to the end of the loop, insertIndex points at the end of\n // the list.\n\n timeline.insertEvent(event, insertIndex, roomState, addToState);\n this._eventIdToTimeline.set(eventId, timeline);\n\n const data: IRoomTimelineData = {\n timeline: timeline,\n // The purpose of this method is inserting events in the middle of the\n // timeline, so the events are, by definition, not live (whether or not\n // we're adding them to the live timeline).\n liveEvent: false,\n };\n this.emit(RoomEvent.Timeline, event, this.room, false, false, data);\n }\n\n /**\n * Replaces event with ID oldEventId with one with newEventId, if oldEventId is\n * recognised. Otherwise, add to the live timeline. Used to handle remote echos.\n *\n * @param localEvent - the new event to be added to the timeline\n * @param oldEventId - the ID of the original event\n * @param newEventId - the ID of the replacement event\n *\n * @remarks\n * Fires {@link RoomEvent.Timeline}\n */\n public handleRemoteEcho(localEvent: MatrixEvent, oldEventId: string, newEventId: string): void {\n // XXX: why don't we infer newEventId from localEvent?\n const existingTimeline = this._eventIdToTimeline.get(oldEventId);\n if (existingTimeline) {\n this._eventIdToTimeline.delete(oldEventId);\n this._eventIdToTimeline.set(newEventId, existingTimeline);\n } else if (!this.filter || this.filter.filterRoomTimeline([localEvent]).length) {\n this.addEventToTimeline(localEvent, this.liveTimeline, {\n toStartOfTimeline: false,\n addToState: false,\n });\n }\n }\n\n /**\n * Removes a single event from this room.\n *\n * @param eventId - The id of the event to remove\n *\n * @returns the removed event, or null if the event was not found\n * in this room.\n */\n public removeEvent(eventId: string): MatrixEvent | null {\n const timeline = this._eventIdToTimeline.get(eventId);\n if (!timeline) {\n return null;\n }\n\n const removed = timeline.removeEvent(eventId);\n if (removed) {\n this._eventIdToTimeline.delete(eventId);\n const data = {\n timeline: timeline,\n };\n this.emit(RoomEvent.Timeline, removed, this.room, undefined, true, data);\n }\n return removed;\n }\n\n /**\n * Determine where two events appear in the timeline relative to one another\n *\n * @param eventId1 - The id of the first event\n * @param eventId2 - The id of the second event\n\n * @returns -1 if eventId1 precedes eventId2, and +1 eventId1 succeeds\n * eventId2. 0 if they are the same event; null if we can't tell (either\n * because we don't know about one of the events, or because they are in\n * separate timelines which don't join up).\n */\n public compareEventOrdering(eventId1: string, eventId2: string): number | null {\n if (eventId1 == eventId2) {\n // optimise this case\n return 0;\n }\n\n const timeline1 = this._eventIdToTimeline.get(eventId1);\n const timeline2 = this._eventIdToTimeline.get(eventId2);\n\n if (timeline1 === undefined) {\n return null;\n }\n if (timeline2 === undefined) {\n return null;\n }\n\n if (timeline1 === timeline2) {\n // both events are in the same timeline - figure out their relative indices\n let idx1: number | undefined = undefined;\n let idx2: number | undefined = undefined;\n const events = timeline1.getEvents();\n for (let idx = 0; idx < events.length && (idx1 === undefined || idx2 === undefined); idx++) {\n const evId = events[idx].getId();\n if (evId == eventId1) {\n idx1 = idx;\n }\n if (evId == eventId2) {\n idx2 = idx;\n }\n }\n const difference = idx1! - idx2!;\n\n // Return the sign of difference.\n if (difference < 0) {\n return -1;\n } else if (difference > 0) {\n return 1;\n } else {\n return 0;\n }\n }\n\n // the events are in different timelines. Iterate through the\n // linkedlist to see which comes first.\n\n // first work forwards from timeline1\n let tl: EventTimeline | null = timeline1;\n while (tl) {\n if (tl === timeline2) {\n // timeline1 is before timeline2\n return -1;\n }\n tl = tl.getNeighbouringTimeline(EventTimeline.FORWARDS);\n }\n\n // now try backwards from timeline1\n tl = timeline1;\n while (tl) {\n if (tl === timeline2) {\n // timeline2 is before timeline1\n return 1;\n }\n tl = tl.getNeighbouringTimeline(EventTimeline.BACKWARDS);\n }\n\n // the timelines are not contiguous.\n return null;\n }\n\n /**\n * Determine whether a given event can sanely be added to this event timeline set,\n * for timeline sets relating to a thread, only return true for events in the same\n * thread timeline, for timeline sets not relating to a thread only return true\n * for events which should be shown in the main room timeline.\n * Requires the `room` property to have been set at EventTimelineSet construction time.\n *\n * @param event - the event to check whether it belongs to this timeline set.\n * @throws Error if `room` was not set when constructing this timeline set.\n * @returns whether the event belongs to this timeline set.\n */\n public canContain(event: MatrixEvent): boolean {\n if (!this.room) {\n throw new Error(\n \"Cannot call `EventTimelineSet::canContain without a `room` set. \" +\n \"Set the room when creating the EventTimelineSet to call this method.\",\n );\n }\n\n const { threadId, shouldLiveInRoom, shouldLiveInThread } = this.room.eventShouldLiveIn(event);\n\n if (this.thread) {\n return this.thread.id === threadId;\n }\n\n if (!shouldLiveInRoom && !shouldLiveInThread) {\n logger.warn(\n `EventTimelineSet:canContain event encountered which cannot be added to any timeline roomId=${\n this.room?.roomId\n } eventId=${event.getId()} threadId=${event.threadRootId}`,\n );\n }\n\n return shouldLiveInRoom;\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,aAAa,QAA+B,qBAAqB;AAE1E,SAAS,MAAM,QAAQ,cAAc;AACrC,SAAoB,SAAS,QAAQ,WAAW;AAGhD,SAAS,iBAAiB,QAAQ,0BAA0B;AAC5D,SAAS,kBAAkB,QAAQ,0BAA0B;AAI7D,MAAM,KAAK,GAAG,IAAI;;AAElB;AACA,IAAI,QAAkC;AACtC,IAAI,KAAK,EAAE;EACP;EACA,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC;AACtC,CAAC,MAAM;EACH;EACA,QAAQ,GAAG,YAAkB,CAAC,CAAC;AACnC;AAUA,WAAY,iBAAiB,0BAAjB,iBAAiB;EAAjB,iBAAiB;EAAjB,iBAAiB;EAAA,OAAjB,iBAAiB;AAAA;AAkF7B,OAAO,MAAM,gBAAgB,SAAS,iBAAiB,CAA4C;EAS/F;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACW,WAAW,CACE,IAAsB,EACtC,IAAW,GAAG,CAAC,CAAC,EAChB,MAAqB,EACL,MAAe,EACf,cAAuC,GAAG,IAAI,EAChE;IACE,KAAK,CAAC,CAAC;IAAC;IAAA;IAAA;IAAA;IAAA;IAAA,4CAxCiB,IAAI,GAAG,CAAwB,CAAC;IAAA;IAAA,KAkCzC,IAAsB,GAAtB,IAAsB;IAAA,KAGtB,MAAe,GAAf,MAAe;IAAA,KACf,cAAuC,GAAvC,cAAuC;IA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