convert ReplayDetectionEntry to typescript

This commit is contained in:
Bruno Windels 2021-10-22 17:47:29 +02:00
parent d6e243321b
commit b55930f084

View file

@ -14,11 +14,24 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import type {TimelineEvent} from "../../../storage/types";
export class ReplayDetectionEntry {
constructor(sessionId, messageIndex, event) {
public readonly sessionId: string;
public readonly messageIndex: number;
public readonly event: TimelineEvent;
constructor(sessionId: string, messageIndex: number, event: TimelineEvent) {
this.sessionId = sessionId;
this.messageIndex = messageIndex;
this.eventId = event.event_id;
this.timestamp = event.origin_server_ts;
this.event = event;
}
get eventId(): string {
return this.event.event_id;
}
get timestamp(): number {
return this.event.origin_server_ts;
}
}