personal web client for Bluesky
typescript solidjs bluesky atcute
at trunk 909 B view raw
1import type { AppBskyActorDefs } from '@atcute/bluesky'; 2import type { Did } from '@atcute/lexicons'; 3import type { InfiniteData } from '@mary/solid-query'; 4 5import type { CacheMatcher } from '../cache/utils'; 6import type { ProfilesListPage, ProfilesListWithSubjectPage } from '../types/profile-response'; 7 8export const findAllProfiles = (did: Did): CacheMatcher<AppBskyActorDefs.ProfileView> => { 9 return { 10 filter: [ 11 { queryKey: ['profile-followers'] }, 12 { queryKey: ['profile-following'] }, 13 { queryKey: ['profile-known-followers'] }, 14 { queryKey: ['search-profiles'] }, 15 { queryKey: ['subject-likers'] }, 16 { queryKey: ['subject-reposters'] }, 17 ], 18 *iterate(data: InfiniteData<ProfilesListPage | ProfilesListWithSubjectPage>) { 19 for (const page of data.pages) { 20 for (const profile of page.profiles) { 21 if (profile.did === did) { 22 yield profile; 23 } 24 } 25 } 26 }, 27 }; 28};