add event deletion

This commit is contained in:
ennmichael
2023-04-01 14:17:58 +02:00
parent 25c1f48a95
commit cd0aeb46f7
3 changed files with 61 additions and 1 deletions

View File

@ -21,6 +21,7 @@ import {
getRecipient,
} from "./direct-message"
import { ContactList, getContacts } from "./contact-list"
import { Deletion, getEvents } from "./deletion"
// TODO Add remaining event types
@ -69,8 +70,9 @@ export interface Unknown extends RawEvent {
EventKind,
| EventKind.SetMetadata
| EventKind.TextNote
| EventKind.DirectMessage
| EventKind.ContactList
| EventKind.DirectMessage
| EventKind.Deletion
>
}
@ -79,6 +81,7 @@ export type Event =
| TextNote
| ContactList
| DirectMessage
| Deletion
| Unknown
/**
@ -189,6 +192,14 @@ export async function parseEvent(event: RawEvent): Promise<Event> {
}
}
if (event.kind === EventKind.Deletion) {
return {
...event,
kind: EventKind.Deletion,
getEvents,
}
}
return {
...event,
kind: event.kind,