@atproto/sync
Version:
atproto sync library
17 lines (15 loc) • 548 B
text/typescript
import { com } from './lexicons/index.js'
export const didAndSeqForEvt = (
evt: com.atproto.sync.subscribeRepos.$Message,
): { did: string; seq: number } | undefined => {
if (com.atproto.sync.subscribeRepos.commit.$isTypeOf(evt)) {
return { seq: evt.seq, did: evt.repo }
} else if (
com.atproto.sync.subscribeRepos.account.$isTypeOf(evt) ||
com.atproto.sync.subscribeRepos.identity.$isTypeOf(evt) ||
com.atproto.sync.subscribeRepos.sync.$isTypeOf(evt)
) {
return { seq: evt.seq, did: evt.did }
}
return undefined
}