import type { Did } from "@atcute/lexicons/syntax"; import type { BobbinContext } from "$lib/api/client"; import { items } from "$lib/api/pagination"; export const resolvePushAccess = async ( ctx: BobbinContext, repo: { ownerDid: string; repoDid?: string }, viewerDid: string | undefined ): Promise => { if (!viewerDid) return false; if (viewerDid === repo.ownerDid) return true; if (!repo.repoDid) return false; for await (const collaborator of items(ctx, "sh.tangled.repo.listCollaborators", { subject: repo.repoDid as Did, limit: 100 })) { if (collaborator.subject === viewerDid) return true; } return false; };