Suite of AT Protocol TypeScript libraries built on web standards
1import {
2 isAccount,
3 isCommit,
4 isIdentity,
5 isSync,
6 type RepoEvent,
7} from "./firehose/lexicons.ts";
8
9export const didAndSeqForEvt = (
10 evt: RepoEvent,
11): { did: string; seq: number } | undefined => {
12 if (isCommit(evt)) return { seq: evt.seq, did: evt.repo };
13 else if (isAccount(evt) || isIdentity(evt) || isSync(evt)) {
14 return { seq: evt.seq, did: evt.did };
15 }
16 return undefined;
17};