Unfollow tool for Bluesky

types!!!!!!!!!

Changed files
+13 -7
src
+13 -7
src/App.tsx
···
import { createSignal, onMount, For, Show, type Component } from "solid-js";
import { createStore } from "solid-js/store";
-
import { Agent } from "@atproto/api";
+
import {
+
Agent,
+
AppBskyGraphFollow,
+
ComAtprotoRepoApplyWrites,
+
ComAtprotoRepoListRecords,
+
} from "@atproto/api";
import { BrowserOAuthClient } from "@atproto/oauth-client-browser";
enum RepoStatus {
···
const fetchHiddenAccounts = async () => {
const fetchFollows = async () => {
const PAGE_LIMIT = 100;
-
const fetchPage = async (cursor?: any) => {
+
const fetchPage = async (cursor?: string) => {
return await agent.com.atproto.repo.listRecords({
repo: agent.did!,
collection: "app.bsky.graph.follow",
···
await fetchFollows().then((follows) => {
setFollowCount(follows.length);
-
follows.forEach(async (record: any) => {
+
follows.forEach(async (record: ComAtprotoRepoListRecords.Record) => {
let status: RepoStatus | undefined = undefined;
+
const follow = record.value as AppBskyGraphFollow.Record;
let handle = "";
try {
const res = await agent.getProfile({
-
actor: record.value.subject,
+
actor: follow.subject,
});
handle = res.data.handle;
···
status = RepoStatus.BLOCKING;
}
} catch (e: any) {
-
handle = await resolveDid(record.value.subject);
+
handle = await resolveDid(follow.subject);
status =
e.message.includes("not found") ? RepoStatus.DELETED
···
if (status !== undefined) {
setFollowRecords(followRecords.length, {
-
did: record.value.subject,
+
did: follow.subject,
handle: handle,
uri: record.uri,
status: status,
···
$type: "com.atproto.repo.applyWrites#delete",
collection: "app.bsky.graph.follow",
rkey: record.uri.split("/").pop(),
-
};
+
} as ComAtprotoRepoApplyWrites.Delete;
});
const BATCHSIZE = 200;