Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/andrioid/techscrolls.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071import type { AppBskyFeedLike, AppBskyFeedPost, AppBskyFeedRepost, AppBskyGraphFollow,} from "@atproto/api";import { WebSocket } from "ws";
export type SocketEntry = { id: string; wss: WebSocket; args: JetStreamRequest; query: string;};interface CommitBase { collection: string; record: unknown; cid: string; rev: string; rkey: string; operation: "create" | "delete" | "update";}export interface CommitPost extends CommitBase { collection: "app.bsky.feed.post"; record: AppBskyFeedPost.Record;}export interface CommitRepost extends CommitBase { collection: "app.bsky.feed.repost"; record: AppBskyFeedRepost.Record;}interface CommitLike extends CommitBase { collection: "app.bsky.feed.like"; record: AppBskyFeedLike.Record;}interface CommitFollow extends CommitBase { collection: "app.bsky.graph.follow"; record: AppBskyGraphFollow.Record;}export type CommitEvent<T extends CommitBase> = { did: string; time_us: number; kind: "commit"; commit: T;};export type CommitTypes = CommitLike | CommitPost | CommitRepost | CommitFollow;export type JetStreamRequest = { wantedCollections?: Readonly<Array<string>>; wantedDids?: Readonly<Array<string>>; /** Typically the unixtime of the last received post */ cursor?: Readonly<string>;};export type Listener = | { event: "msg"; cb: (msg: CommitEvent<CommitTypes>) => Promise<void>; } | { event: "post"; cb: (msg: CommitEvent<CommitPost>) => Promise<void>; } | { event: "repost"; cb: (msg: CommitEvent<CommitRepost>) => Promise<void>; };
export type FeedPostWithUri = { uri: string; cid: string; record: AppBskyFeedPost.Record;};