@singi-labs/sifa-sdk 0.7.1 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/query/index.cjs +1246 -57
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +671 -11
- package/dist/query/index.d.ts +671 -11
- package/dist/query/index.js +1145 -58
- package/dist/query/index.js.map +1 -1
- package/package.json +1 -1
package/dist/query/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/query/client.ts","../../src/query/config.tsx","../../src/query/fetchers/profile.ts","../../src/query/fetchers/positions.ts","../../src/query/fetchers/stats.ts","../../src/query/fetchers/apps.ts","../../src/query/fetchers/search.ts","../../src/query/fetchers/discovery.ts","../../src/query/fetchers/follow.ts","../../src/query/fetchers/activity.ts","../../src/query/fetchers/endorsement.ts","../../src/query/fetchers/stream.ts","../../src/query/fetchers/reactions.ts","../../src/query/fetchers/roadmap.ts","../../src/query/keys.ts","../../src/query/hooks/use-profile.ts","../../src/query/hooks/use-create-position.ts","../../src/query/hooks/use-stats.ts","../../src/query/hooks/use-apps.ts","../../src/query/hooks/use-search.ts","../../src/query/hooks/use-discovery.ts","../../src/query/hooks/use-follow.ts","../../src/query/hooks/use-activity.ts","../../src/query/hooks/use-endorsement.ts","../../src/query/hooks/use-stream.ts","../../src/query/hooks/use-reactions.ts","../../src/query/hooks/use-roadmap.ts"],"names":["createContext","useContext","useQuery","useQueryClient","useMutation"],"mappings":";;;;;;;AA2CO,IAAM,QAAA,GAAN,cAAuB,KAAA,CAAM;AAAA,EACzB,MAAA;AAAA,EACA,IAAA;AAAA,EAET,WAAA,CAAY,OAAA,EAAiB,MAAA,EAAgB,IAAA,EAAgB;AAC3D,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,UAAA;AACZ,IAAA,IAAA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AS,OAAA,IAAW,IAAA,CAAA;AAAA,IAChD,GAAG;AAAA,GACJ,CAAA;AACH;AC5CO,SAAS,gBACd,OAAA,EASA;AACA,EAAA,MAAM,SAAS,aAAA,EAAc;AAC7B,EAAA,OAAOA,mBAAAA,CAAS;AAAA,IACd,QAAA,EAAU,aAAA,CAAc,OAAA,CAAQ,KAAA,EAAM;AAAA,IACtC,OAAA,EAAS,MAAM,iBAAA,CAAkB,MAAM,CAAA;AAAA,IACvC,GAAG;AAAA,GACJ,CAAA;AACH;AAGO,SAAS,kBACd,OAAA,EAIA;AACA,EAAA,MAAM,SAAS,aAAA,EAAc;AAC7B,EAAA,OAAOA,mBAAAA,CAAS;AAAA,IACd,QAAA,EAAU,aAAA,CAAc,OAAA,CAAQ,OAAA,EAAQ;AAAA,IACxC,OAAA,EAAS,MAAM,mBAAA,CAAoB,MAAM,CAAA;AAAA,IACzC,GAAG;AAAA,GACJ,CAAA;AACH","file":"index.cjs","sourcesContent":["/**\n * Foundation HTTP client for talking to the Sifa AppView.\n *\n * Stateless. Consumers supply a {@link SifaApiConfig} per call (the React\n * hooks read it from context; non-React consumers pass it explicitly). No\n * singletons, no module-level state.\n */\n\n/** Configuration passed to every fetcher. */\nexport interface SifaApiConfig {\n /** Base URL of the sifa-api AppView, e.g. `https://api.sifa.id`. No trailing slash. */\n baseUrl: string;\n /**\n * Optional fetch implementation. Defaults to {@link globalThis.fetch}.\n * Lets Next.js consumers pass their cache-enhanced fetch; node/Expo\n * consumers can leave this unset.\n */\n fetch?: typeof fetch;\n}\n\n/** Options accepted by {@link apiFetch}. */\nexport interface ApiFetchOptions {\n method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';\n /** Request body. Serialized to JSON automatically. */\n body?: unknown;\n /** AbortSignal. Defaults to `AbortSignal.timeout(timeoutMs)` if `timeoutMs` is set. */\n signal?: AbortSignal;\n /** Per-call timeout in milliseconds. Default: 10_000. Ignored if `signal` is provided. */\n timeoutMs?: number;\n /** Retry on HTTP 429 up to 3 times with the server's `Retry-After` delay (capped at 3s). */\n retryOn429?: boolean;\n /** Additional headers. `Content-Type: application/json` is set automatically when `body` is present. */\n headers?: Record<string, string>;\n credentials?: RequestCredentials;\n cache?: RequestCache;\n /**\n * Next.js-specific cache hints. Ignored on non-Next runtimes. Passed\n * through transparently as part of {@link RequestInit}.\n */\n next?: { revalidate?: number | false; tags?: string[] };\n}\n\n/** Error thrown by {@link apiFetch} on non-2xx responses. */\nexport class ApiError extends Error {\n readonly status: number;\n readonly body: unknown;\n\n constructor(message: string, status: number, body?: unknown) {\n super(message);\n this.name = 'ApiError';\n this.status = status;\n this.body = body;\n }\n}\n\nconst DEFAULT_TIMEOUT_MS = 10_000;\nconst MAX_RATE_LIMIT_RETRIES = 3;\nconst RATE_LIMIT_RETRY_CAP_SECONDS = 3;\n\n/**\n * Generic fetcher used by all SDK query and mutation functions.\n *\n * Returns parsed JSON typed as `T`. Throws {@link ApiError} on non-2xx\n * responses. Use {@link apiFetchOrNull} when 404 should resolve to `null`\n * instead.\n */\nexport async function apiFetch<T = unknown>(\n config: SifaApiConfig,\n path: string,\n options: ApiFetchOptions = {},\n): Promise<T> {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const url = `${config.baseUrl}${path}`;\n const maxRetries = options.retryOn429 ? MAX_RATE_LIMIT_RETRIES : 0;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n const signal = options.signal ?? AbortSignal.timeout(options.timeoutMs ?? DEFAULT_TIMEOUT_MS);\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n let body: BodyInit | undefined;\n if (options.body !== undefined) {\n headers['Content-Type'] ??= 'application/json';\n body = JSON.stringify(options.body);\n }\n\n // `next` is a Next.js extension to RequestInit; cast through.\n const init = {\n method: options.method ?? 'GET',\n headers,\n body,\n signal,\n credentials: options.credentials,\n cache: options.cache,\n ...(options.next ? { next: options.next } : {}),\n } as RequestInit;\n\n const res = await fetchFn(url, init);\n\n if (res.status === 429 && attempt < maxRetries) {\n const retryAfterRaw = res.headers.get('retry-after');\n const retryAfter = retryAfterRaw ? Number.parseInt(retryAfterRaw, 10) : 2;\n const waitSeconds = Math.min(\n Number.isFinite(retryAfter) ? retryAfter : 2,\n RATE_LIMIT_RETRY_CAP_SECONDS,\n );\n await new Promise((r) => setTimeout(r, waitSeconds * 1000));\n continue;\n }\n\n if (!res.ok) {\n let errBody: unknown;\n try {\n errBody = (await res.json()) as unknown;\n } catch {\n try {\n errBody = await res.text();\n } catch {\n errBody = undefined;\n }\n }\n throw new ApiError(`Sifa API ${res.status} on ${path}`, res.status, errBody);\n }\n\n return (await res.json()) as T;\n }\n\n throw new ApiError(`Sifa API exhausted retries on ${path}`, 429);\n}\n\n/**\n * Variant of {@link apiFetch} that resolves to `null` on HTTP 404 instead\n * of throwing. Useful for \"fetch by handle\" reads where missing is\n * expected (e.g. unknown profile).\n */\nexport async function apiFetchOrNull<T>(\n config: SifaApiConfig,\n path: string,\n options: ApiFetchOptions = {},\n): Promise<T | null> {\n try {\n return await apiFetch<T>(config, path, options);\n } catch (e) {\n if (e instanceof ApiError && e.status === 404) return null;\n throw e;\n }\n}\n","'use client';\n\nimport { createContext, useContext, type ReactNode } from 'react';\n\nimport type { SifaApiConfig } from './client.js';\n\nconst SifaConfigContext = createContext<SifaApiConfig | null>(null);\n\nexport interface SifaProviderProps {\n config: SifaApiConfig;\n children: ReactNode;\n}\n\n/**\n * Provides the {@link SifaApiConfig} that hooks under it can read via\n * {@link useSifaConfig}. Wrap the React tree once; hooks consume it.\n *\n * @example\n * ```tsx\n * <QueryClientProvider client={queryClient}>\n * <SifaProvider config={{ baseUrl: process.env.NEXT_PUBLIC_API_URL! }}>\n * <App />\n * </SifaProvider>\n * </QueryClientProvider>\n * ```\n */\nexport function SifaProvider({ config, children }: SifaProviderProps) {\n return <SifaConfigContext.Provider value={config}>{children}</SifaConfigContext.Provider>;\n}\n\n/**\n * Read the SDK's {@link SifaApiConfig} from context. Throws if no\n * {@link SifaProvider} is mounted above.\n */\nexport function useSifaConfig(): SifaApiConfig {\n const ctx = useContext(SifaConfigContext);\n if (!ctx) {\n throw new Error(\n 'useSifaConfig must be used inside <SifaProvider>. Wrap your app once with <SifaProvider config={...}>.',\n );\n }\n return ctx;\n}\n","import type { Profile } from '../../types/index.js';\nimport { apiFetch, apiFetchOrNull, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/**\n * Read the aggregated profile for a handle or DID.\n *\n * Returns `null` when the AppView has no profile for the given identifier\n * (HTTP 404). Throws {@link ApiError} on other non-2xx responses.\n *\n * Server-callable (Next.js RSC) and client-callable (Expo, browser).\n */\nexport function fetchProfile(\n config: SifaApiConfig,\n handleOrDid: string,\n options: ApiFetchOptions = {},\n): Promise<Profile | null> {\n const path = `/api/profile/${encodeURIComponent(handleOrDid)}`;\n return apiFetchOrNull<Profile>(config, path, {\n retryOn429: true,\n ...options,\n });\n}\n\n/**\n * Public AT Fund link for a profile, if one is configured. Returns `null`\n * on any error or when the response payload's `url` field is missing or\n * non-string.\n */\nexport async function fetchAtFundLink(\n config: SifaApiConfig,\n did: string,\n options: ApiFetchOptions = {},\n): Promise<string | null> {\n const path = `/api/profiles/${encodeURIComponent(did)}/at-fund-link`;\n try {\n const data = await apiFetch<{ url?: unknown }>(config, path, {\n next: { revalidate: 3600 },\n timeoutMs: 5000,\n ...options,\n });\n return typeof data.url === 'string' ? data.url : null;\n } catch {\n return null;\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** Result returned by record-write mutations (create / update / delete). */\nexport interface WriteResult {\n success: boolean;\n error?: string;\n pdsHost?: string;\n}\n\n/** Result returned by create mutations. Includes the newly created `rkey`. */\nexport interface CreateResult extends WriteResult {\n rkey?: string;\n}\n\n/**\n * Create a new `id.sifa.profile.position` record on the authenticated\n * user's PDS. The AppView signs and writes via the user's OAuth session.\n *\n * `data` should be a lexicon-shaped position record (without `createdAt`\n * or `rkey`; the AppView fills both). Validate with\n * `ProfilePositionRecordSchema.omit({ createdAt: true })` before calling\n * if you want client-side guarantees.\n */\nexport function createPosition(\n config: SifaApiConfig,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiFetch<CreateResult>(config, '/api/positions', {\n method: 'POST',\n body: data,\n credentials: 'include',\n ...options,\n });\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** Public, aggregate stats shown on the homepage and similar surfaces. */\nexport interface StatsResponse {\n profileCount: number;\n avatars: string[];\n atproto: {\n userCount: number;\n growthPerSecond: number;\n timestamp: number;\n } | null;\n}\n\n/**\n * Homepage stats (profile count, avatar samples, ATproto growth). Public\n * endpoint -- safe to cache. Returns `null` on any error so callers can\n * render a graceful empty state.\n */\nexport async function fetchStats(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<StatsResponse | null> {\n try {\n return await apiFetch<StatsResponse>(config, '/api/stats', {\n next: { revalidate: 900 },\n ...options,\n });\n } catch {\n return null;\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** Catalog entry describing an ATproto app that Sifa surfaces activity for. */\nexport interface AppRegistryEntry {\n id: string;\n name: string;\n category: string;\n collectionPrefixes: string[];\n scanCollections: string[];\n urlPattern?: string;\n color: string;\n}\n\n/** Compact app representation returned by the hidden-apps endpoint. */\nexport interface HiddenApp {\n id: string;\n name: string;\n category: string;\n}\n\nexport interface FetchHiddenAppsOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * `credentials: 'include'` does NOT propagate browser cookies in RSC,\n * so authenticated server fetches must forward the header explicitly.\n */\n cookieHeader?: string;\n}\n\n/**\n * Public app registry shown across discovery surfaces. Heavily cached.\n * Returns `[]` on any error.\n */\nexport async function fetchAppsRegistry(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<AppRegistryEntry[]> {\n try {\n return await apiFetch<AppRegistryEntry[]>(config, '/api/apps/registry', {\n next: { revalidate: 86400 },\n ...options,\n });\n } catch {\n return [];\n }\n}\n\n/**\n * Apps the authenticated user has chosen to hide from their activity feed.\n * Requires an authenticated session. Returns `[]` on any error (including\n * the unauthenticated case).\n */\nexport async function fetchHiddenApps(\n config: SifaApiConfig,\n options: FetchHiddenAppsOptions = {},\n): Promise<HiddenApp[]> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n const data = await apiFetch<{ apps: HiddenApp[] }>(config, '/api/profile/hidden-apps', {\n credentials: 'include',\n ...options,\n headers,\n });\n return data.apps;\n } catch {\n return [];\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** Profile entry returned by the search endpoint. */\nexport interface ProfileSearchResult {\n did?: string;\n handle: string;\n displayName?: string;\n headline?: string;\n avatar?: string;\n about?: string;\n currentRole?: string;\n currentCompany?: string;\n industry?: string;\n domain?: string;\n countryCode?: string;\n locationCountry?: string;\n preferredWorkplace?: string[];\n claimed?: boolean;\n blueskyVerified?: boolean;\n blueskyVerifiedAt?: string | null;\n}\n\nexport interface SearchFilters {\n q?: string;\n skill?: string;\n country?: string;\n industry?: string;\n domain?: string;\n workplace?: string;\n app?: string;\n limit?: number;\n}\n\nexport interface SearchResponse {\n profiles: ProfileSearchResult[];\n total: number;\n limit: number;\n offset: number;\n}\n\n/** Skill typeahead suggestion. */\nexport interface SkillSearchResult {\n name: string;\n slug: string;\n category: string;\n userCount: number;\n}\n\nexport interface FilterOptions {\n countries: { countryCode: string; country: string; count: number }[];\n industries: { industry: string; count: number }[];\n apps: { appId: string; count: number }[];\n}\n\nconst EMPTY_SEARCH: SearchResponse = { profiles: [], total: 0, limit: 20, offset: 0 };\nconst EMPTY_FILTERS: FilterOptions = { countries: [], industries: [], apps: [] };\n\n/**\n * Search profiles by free-text query and optional filters. Returns an\n * empty result set when no filters are provided (matching sifa-web's\n * \"no input, no fetch\" behavior).\n */\nexport async function fetchSearchProfiles(\n config: SifaApiConfig,\n filters: SearchFilters,\n options: ApiFetchOptions = {},\n): Promise<SearchResponse> {\n const params = new URLSearchParams();\n if (filters.q) params.set('q', filters.q);\n if (filters.skill) params.set('skill', filters.skill);\n if (filters.country) params.set('country', filters.country);\n if (filters.industry) params.set('industry', filters.industry);\n if (filters.domain) params.set('domain', filters.domain);\n if (filters.workplace) params.set('workplace', filters.workplace);\n if (filters.app) params.set('app', filters.app);\n if (filters.limit !== undefined) params.set('limit', String(filters.limit));\n\n if (params.size === 0) return EMPTY_SEARCH;\n\n return apiFetch<SearchResponse>(config, `/api/search/profiles?${params.toString()}`, {\n cache: 'no-store',\n ...options,\n });\n}\n\n/**\n * Skill typeahead. Returns up to 8 matches for the given prefix. Empty\n * input returns an empty array without hitting the server.\n */\nexport async function fetchSkillSuggestions(\n config: SifaApiConfig,\n query: string,\n options: ApiFetchOptions = {},\n): Promise<SkillSearchResult[]> {\n if (!query.trim()) return [];\n const path = `/api/search/skills?q=${encodeURIComponent(query)}&limit=8`;\n const data = await apiFetch<{ skills?: SkillSearchResult[] }>(config, path, {\n cache: 'no-store',\n ...options,\n });\n return data.skills ?? [];\n}\n\n/** Available filter facets (countries, industries, apps) for search UI. */\nexport async function fetchSearchFilters(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<FilterOptions> {\n try {\n return await apiFetch<FilterOptions>(config, '/api/search/filters', {\n next: { revalidate: 300 },\n ...options,\n });\n } catch {\n return EMPTY_FILTERS;\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** Lightweight profile representation used by discovery endpoints. */\nexport interface SimilarProfile {\n did: string;\n handle: string;\n displayName?: string | null;\n avatar?: string | null;\n headline?: string | null;\n currentRole?: string | null;\n currentCompany?: string | null;\n industry?: string | null;\n domain?: string | null;\n}\n\nexport interface SuggestionProfile {\n did: string;\n handle: string;\n displayName?: string;\n headline?: string;\n avatarUrl?: string;\n source: string;\n dismissed: boolean;\n blueskyVerified?: boolean;\n}\n\nexport interface SuggestionsResponse {\n onSifa: SuggestionProfile[];\n notOnSifa: SuggestionProfile[];\n cursor?: string;\n}\n\nexport interface FeaturedProfile {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n pronouns?: string;\n headline?: string;\n about?: string;\n currentRole?: string;\n currentCompany?: string;\n locationCountry?: string;\n locationRegion?: string;\n /** Legacy alias for `locationLocality`; emitted by sifa-api during the additive response window. */\n locationCity?: string;\n /** community.lexicon.location.address field name -- prefer over `locationCity`. */\n locationLocality?: string;\n countryCode?: string;\n location?: string;\n website?: string;\n openTo?: string[];\n preferredWorkplace?: string[];\n availableFromUtc?: number;\n availableToUtc?: number;\n followersCount?: number;\n atprotoFollowersCount?: number;\n pdsProvider?: { name: string; host: string } | null;\n claimed: boolean;\n featuredDate: string;\n}\n\n/** Profiles similar to the given DID (matchmaking). Returns `[]` on error. */\nexport async function fetchSimilarProfiles(\n config: SifaApiConfig,\n did: string,\n opts: { limit?: number } & ApiFetchOptions = {},\n): Promise<SimilarProfile[]> {\n const limit = opts.limit ?? 5;\n const path = `/api/discover/similar/${encodeURIComponent(did)}?limit=${limit}`;\n try {\n const data = await apiFetch<{ profiles?: SimilarProfile[] }>(config, path, {\n next: { revalidate: 300 },\n timeoutMs: 5000,\n ...opts,\n });\n return data.profiles ?? [];\n } catch {\n return [];\n }\n}\n\nexport interface FetchSuggestionsOptions extends ApiFetchOptions {\n source?: string;\n includeDismissed?: boolean;\n cursor?: string;\n limit?: number;\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * `credentials: 'include'` does NOT propagate browser cookies in RSC,\n * so authenticated server fetches must forward the header explicitly.\n */\n cookieHeader?: string;\n}\n\n/** Discovery suggestions feed. Resolves to empty arrays on error. */\nexport async function fetchSuggestions(\n config: SifaApiConfig,\n opts: FetchSuggestionsOptions = {},\n): Promise<SuggestionsResponse> {\n const params = new URLSearchParams();\n if (opts.source) params.set('source', opts.source);\n if (opts.includeDismissed) params.set('include_dismissed', 'true');\n if (opts.cursor) params.set('cursor', opts.cursor);\n if (opts.limit) params.set('limit', String(opts.limit));\n\n const qs = params.toString();\n const headers: Record<string, string> = { ...(opts.headers ?? {}) };\n if (opts.cookieHeader) headers.cookie = opts.cookieHeader;\n\n try {\n return await apiFetch<SuggestionsResponse>(config, `/api/suggestions${qs ? `?${qs}` : ''}`, {\n credentials: 'include',\n cache: 'no-store',\n timeoutMs: 8000,\n ...opts,\n headers,\n });\n } catch {\n return { onSifa: [], notOnSifa: [] };\n }\n}\n\n/** Count of pending suggestions since an optional timestamp. */\nexport async function fetchSuggestionCount(\n config: SifaApiConfig,\n since?: string,\n options: ApiFetchOptions = {},\n): Promise<number> {\n const params = since ? `?since=${encodeURIComponent(since)}` : '';\n try {\n const data = await apiFetch<{ count?: number }>(config, `/api/suggestions/count${params}`, {\n credentials: 'include',\n cache: 'no-store',\n ...options,\n });\n return data.count ?? 0;\n } catch {\n return 0;\n }\n}\n\n/** Featured profile (rotated by sifa-api). Returns `null` when none. */\nexport async function fetchFeaturedProfile(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<FeaturedProfile | null> {\n try {\n return await apiFetch<FeaturedProfile>(config, '/api/featured-profile', {\n next: { revalidate: 900 },\n ...options,\n });\n } catch {\n return null;\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\nexport interface FollowProfile {\n did: string;\n handle: string;\n displayName?: string;\n headline?: string;\n avatarUrl?: string;\n source: string;\n claimed: boolean;\n followedAt: string;\n blueskyVerified?: boolean;\n blueskyVerifiedAt?: string | null;\n}\n\nexport interface FollowingResponse {\n follows: FollowProfile[];\n cursor?: string;\n}\n\n/** People the authenticated user follows. Empty on error. */\nexport async function fetchFollowing(\n config: SifaApiConfig,\n opts: { source?: string; cursor?: string; limit?: number } & ApiFetchOptions = {},\n): Promise<FollowingResponse> {\n const params = new URLSearchParams();\n if (opts.source) params.set('source', opts.source);\n if (opts.cursor) params.set('cursor', opts.cursor);\n if (opts.limit) params.set('limit', String(opts.limit));\n const qs = params.toString();\n\n try {\n return await apiFetch<FollowingResponse>(config, `/api/following${qs ? `?${qs}` : ''}`, {\n credentials: 'include',\n cache: 'no-store',\n ...opts,\n });\n } catch {\n return { follows: [] };\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\nexport interface HeatmapDay {\n date: string;\n total: number;\n apps: { appId: string; count: number }[];\n}\n\nexport interface HeatmapResponse {\n days: HeatmapDay[];\n appTotals: { appId: string; appName: string; total: number }[];\n thresholds: [number, number, number, number];\n}\n\nexport interface ActivityItem {\n uri: string;\n cid: string;\n collection: string;\n rkey: string;\n record: Record<string, unknown>;\n appId: string;\n appName: string;\n category: string;\n indexedAt: string;\n}\n\nexport interface ActivityTeaserResponse {\n items: ActivityItem[];\n blueskyGated?: boolean;\n backfillPending?: boolean;\n failedApps?: string[];\n}\n\nexport interface ActivityFeedResponse {\n items: ActivityItem[];\n cursor: string | null;\n hasMore: boolean;\n availableCategories?: string[];\n blueskyGated?: boolean;\n failedApps?: string[];\n}\n\n/**\n * Per-day activity counts for a profile across all ATproto apps. Returns\n * `null` on any error so callers can render a graceful empty state.\n */\nexport async function fetchHeatmapData(\n config: SifaApiConfig,\n handleOrDid: string,\n days: number,\n options: ApiFetchOptions = {},\n): Promise<HeatmapResponse | null> {\n const path = `/api/activity/${encodeURIComponent(handleOrDid)}/heatmap?days=${days}`;\n try {\n return await apiFetch<HeatmapResponse>(config, path, {\n next: { revalidate: 900, tags: [`heatmap-${handleOrDid}`] },\n ...options,\n });\n } catch {\n return null;\n }\n}\n\nexport interface FetchActivityTeaserOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * Required for authenticated server fetches because `credentials: 'include'`\n * does not propagate browser cookies in RSC.\n */\n cookieHeader?: string;\n}\n\n/**\n * Recent activity teaser for a profile (homepage-sized slice). Caps the\n * upstream wait so the SSR path cannot hang. Returns `null` on any error.\n */\nexport async function fetchActivityTeaser(\n config: SifaApiConfig,\n handleOrDid: string,\n options: FetchActivityTeaserOptions = {},\n): Promise<ActivityTeaserResponse | null> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n return await apiFetch<ActivityTeaserResponse>(\n config,\n `/api/activity/${encodeURIComponent(handleOrDid)}/teaser`,\n {\n credentials: 'include',\n timeoutMs: 8000,\n next: { revalidate: 300, tags: [`activity-teaser-${handleOrDid}`] },\n ...options,\n headers,\n },\n );\n } catch {\n return null;\n }\n}\n\nexport interface FetchActivityFeedOptions extends ApiFetchOptions {\n category?: string;\n limit?: number;\n cursor?: string;\n cookieHeader?: string;\n}\n\n/**\n * Paginated activity feed for a profile. Always fresh (`cache: 'no-store'`).\n * Returns `null` on any error.\n */\nexport async function fetchActivityFeed(\n config: SifaApiConfig,\n handleOrDid: string,\n options: FetchActivityFeedOptions = {},\n): Promise<ActivityFeedResponse | null> {\n const params = new URLSearchParams();\n if (options.category) params.set('category', options.category);\n if (options.limit) params.set('limit', String(options.limit));\n if (options.cursor) params.set('cursor', options.cursor);\n const qs = params.toString();\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n return await apiFetch<ActivityFeedResponse>(\n config,\n `/api/activity/${encodeURIComponent(handleOrDid)}${qs ? `?${qs}` : ''}`,\n {\n credentials: 'include',\n cache: 'no-store',\n ...options,\n headers,\n },\n );\n } catch {\n return null;\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/**\n * Counts confirmed endorsements received by a DID. The backend's\n * `GET /api/endorsement/:did` already returns only confirmed endorsements\n * (via inner join with `endorsementConfirmations`), so this helper just\n * returns the array length. Failures return 0 so callers can route safely.\n *\n * Public endpoint -- no credentials needed.\n */\nexport async function fetchEndorsementCount(\n config: SifaApiConfig,\n did: string,\n options: ApiFetchOptions = {},\n): Promise<number> {\n const path = `/api/endorsement/${encodeURIComponent(did)}`;\n try {\n const data = await apiFetch<unknown>(config, path, {\n cache: 'no-store',\n timeoutMs: 5000,\n ...options,\n });\n if (typeof data !== 'object' || data === null || !('endorsements' in data)) {\n return 0;\n }\n const endorsements = data.endorsements;\n return Array.isArray(endorsements) ? endorsements.length : 0;\n } catch {\n return 0;\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\nexport interface FetchNetworkStreamCountOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * Required for authenticated server fetches because `credentials: 'include'`\n * does not propagate browser cookies in RSC.\n *\n * When omitted, the request falls back to `credentials: 'include'` so\n * client-side calls work without extra plumbing.\n */\n cookieHeader?: string;\n}\n\n/**\n * Counts items in the authenticated user's network stream digest. The\n * underlying `GET /api/stream/network` endpoint may 404 while the feature\n * is in development; in that case (and on any other error) this returns\n * 0 so callers can route safely to a fallback experience.\n */\nexport async function fetchNetworkStreamCount(\n config: SifaApiConfig,\n did: string,\n options: FetchNetworkStreamCountOptions = {},\n): Promise<number> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n const data = await apiFetch<unknown>(\n config,\n `/api/stream/network?did=${encodeURIComponent(did)}`,\n {\n cache: 'no-store',\n timeoutMs: 5000,\n ...(options.cookieHeader ? {} : { credentials: 'include' }),\n ...options,\n headers,\n },\n );\n if (typeof data !== 'object' || data === null || !('items' in data)) {\n return 0;\n }\n const items = data.items;\n return Array.isArray(items) ? items.length : 0;\n } catch {\n return 0;\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** Per-URI reaction state for the authenticated viewer. */\nexport interface ReactionStatus {\n reacted: boolean;\n rkey?: string;\n collection?: string;\n}\n\n/** Result of checking whether the authenticated viewer has an account on a given app. */\nexport interface AccountCheckResult {\n hasAccount: boolean;\n appName: string;\n appUrl: string;\n}\n\nexport interface FetchReactionStatusOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * Required for authenticated server fetches because `credentials: 'include'`\n * does not propagate browser cookies in RSC.\n */\n cookieHeader?: string;\n}\n\n/**\n * Batch-look up reaction status for multiple URIs. Returns `{}` for an\n * empty input list (no network call) and `null` on any error.\n */\nexport async function fetchReactionStatus(\n config: SifaApiConfig,\n uris: string[],\n options: FetchReactionStatusOptions = {},\n): Promise<Record<string, ReactionStatus> | null> {\n if (uris.length === 0) return {};\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n return await apiFetch<Record<string, ReactionStatus>>(\n config,\n `/api/reactions/status?uris=${encodeURIComponent(uris.join(','))}`,\n {\n credentials: 'include',\n ...options,\n headers,\n },\n );\n } catch {\n return null;\n }\n}\n\nexport interface CheckAppAccountOptions extends ApiFetchOptions {\n cookieHeader?: string;\n}\n\n/**\n * Check whether the authenticated viewer has an account on a given app.\n * Returns `null` on any error.\n */\nexport async function checkAppAccount(\n config: SifaApiConfig,\n appId: string,\n options: CheckAppAccountOptions = {},\n): Promise<AccountCheckResult | null> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n return await apiFetch<AccountCheckResult>(\n config,\n `/api/reactions/account-check/${encodeURIComponent(appId)}`,\n {\n credentials: 'include',\n ...options,\n headers,\n },\n );\n } catch {\n return null;\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** Voter on a roadmap item. */\nexport interface RoadmapVoter {\n did: string;\n avatarUrl?: string;\n}\n\n/** Map of item key -> vote tally and voter list. */\nexport type RoadmapVotesResponse = Record<string, { count: number; voters: RoadmapVoter[] }>;\n\n/**\n * Public roadmap vote tallies, keyed by item. Returns `{}` on any error.\n */\nexport async function fetchRoadmapVotes(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<RoadmapVotesResponse> {\n try {\n return await apiFetch<RoadmapVotesResponse>(config, '/api/roadmap/votes', {\n cache: 'no-store',\n ...options,\n });\n } catch {\n return {};\n }\n}\n\nexport interface FetchMyRoadmapVotesOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * Required for authenticated server fetches because `credentials: 'include'`\n * does not propagate browser cookies in RSC.\n */\n cookieHeader?: string;\n}\n\n/**\n * Roadmap items the authenticated user has voted on. Returns `[]` on any\n * error or when the response payload is shaped unexpectedly.\n */\nexport async function fetchMyRoadmapVotes(\n config: SifaApiConfig,\n options: FetchMyRoadmapVotesOptions = {},\n): Promise<string[]> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n const data = await apiFetch<{ voted?: string[] }>(config, '/api/roadmap/votes/me', {\n credentials: 'include',\n ...options,\n headers,\n });\n return data.voted ?? [];\n } catch {\n return [];\n }\n}\n","/**\n * Query key factory for TanStack Query.\n *\n * Keys are read-only tuples; the hierarchy matches the SDK's fetcher\n * grouping. Use these instead of inline arrays so consumers can target\n * `queryClient.invalidateQueries({ queryKey: keys.profile.all() })` and\n * similar patterns without typos.\n *\n * Convention: every leaf key starts with the namespace ('sifa') so\n * consumers can invalidate everything Sifa-related in one call.\n */\nexport const sifaQueryKeys = {\n all: () => ['sifa'] as const,\n\n profile: {\n all: () => ['sifa', 'profile'] as const,\n byHandle: (handleOrDid: string) => ['sifa', 'profile', handleOrDid] as const,\n atFundLink: (did: string) => ['sifa', 'profile', 'at-fund-link', did] as const,\n },\n\n position: {\n all: () => ['sifa', 'position'] as const,\n byOwner: (did: string) => ['sifa', 'position', 'by-owner', did] as const,\n },\n\n search: {\n all: () => ['sifa', 'search'] as const,\n profiles: (filters: Record<string, unknown>) =>\n ['sifa', 'search', 'profiles', filters] as const,\n skills: (query: string) => ['sifa', 'search', 'skills', query] as const,\n filters: () => ['sifa', 'search', 'filters'] as const,\n },\n\n discovery: {\n all: () => ['sifa', 'discovery'] as const,\n similar: (did: string, limit: number) => ['sifa', 'discovery', 'similar', did, limit] as const,\n suggestions: (opts: Record<string, unknown>) =>\n ['sifa', 'discovery', 'suggestions', opts] as const,\n suggestionCount: (since: string | undefined) =>\n ['sifa', 'discovery', 'suggestion-count', since ?? null] as const,\n featured: () => ['sifa', 'discovery', 'featured'] as const,\n },\n\n follow: {\n all: () => ['sifa', 'follow'] as const,\n following: (opts: Record<string, unknown>) => ['sifa', 'follow', 'following', opts] as const,\n },\n\n stats: {\n all: () => ['sifa', 'stats'] as const,\n homepage: () => ['sifa', 'stats', 'homepage'] as const,\n },\n\n apps: {\n all: () => ['sifa', 'apps'] as const,\n registry: () => ['sifa', 'apps', 'registry'] as const,\n hidden: () => ['sifa', 'apps', 'hidden'] as const,\n },\n\n activity: {\n all: () => ['sifa', 'activity'] as const,\n heatmap: (handleOrDid: string, days: number) =>\n ['sifa', 'activity', 'heatmap', handleOrDid, days] as const,\n teaser: (handleOrDid: string) => ['sifa', 'activity', 'teaser', handleOrDid] as const,\n feed: (handleOrDid: string, opts: Record<string, unknown>) =>\n ['sifa', 'activity', 'feed', handleOrDid, opts] as const,\n },\n\n endorsement: {\n all: () => ['sifa', 'endorsement'] as const,\n count: (did: string) => ['sifa', 'endorsement', 'count', did] as const,\n },\n\n stream: {\n all: () => ['sifa', 'stream'] as const,\n networkCount: (did: string) => ['sifa', 'stream', 'network-count', did] as const,\n },\n\n reactions: {\n all: () => ['sifa', 'reactions'] as const,\n status: (uris: string[]) => ['sifa', 'reactions', 'status', uris] as const,\n accountCheck: (appId: string) => ['sifa', 'reactions', 'account-check', appId] as const,\n },\n\n roadmap: {\n all: () => ['sifa', 'roadmap'] as const,\n votes: () => ['sifa', 'roadmap', 'votes'] as const,\n myVotes: () => ['sifa', 'roadmap', 'my-votes'] as const,\n },\n} as const;\n\nexport type SifaQueryKey =\n | ReturnType<typeof sifaQueryKeys.all>\n | ReturnType<typeof sifaQueryKeys.profile.all>\n | ReturnType<typeof sifaQueryKeys.profile.byHandle>\n | ReturnType<typeof sifaQueryKeys.profile.atFundLink>\n | ReturnType<typeof sifaQueryKeys.position.all>\n | ReturnType<typeof sifaQueryKeys.position.byOwner>\n | ReturnType<typeof sifaQueryKeys.search.all>\n | ReturnType<typeof sifaQueryKeys.search.profiles>\n | ReturnType<typeof sifaQueryKeys.search.skills>\n | ReturnType<typeof sifaQueryKeys.search.filters>\n | ReturnType<typeof sifaQueryKeys.discovery.all>\n | ReturnType<typeof sifaQueryKeys.discovery.similar>\n | ReturnType<typeof sifaQueryKeys.discovery.suggestions>\n | ReturnType<typeof sifaQueryKeys.discovery.suggestionCount>\n | ReturnType<typeof sifaQueryKeys.discovery.featured>\n | ReturnType<typeof sifaQueryKeys.follow.all>\n | ReturnType<typeof sifaQueryKeys.follow.following>\n | ReturnType<typeof sifaQueryKeys.stats.all>\n | ReturnType<typeof sifaQueryKeys.stats.homepage>\n | ReturnType<typeof sifaQueryKeys.apps.all>\n | ReturnType<typeof sifaQueryKeys.apps.registry>\n | ReturnType<typeof sifaQueryKeys.apps.hidden>\n | ReturnType<typeof sifaQueryKeys.activity.all>\n | ReturnType<typeof sifaQueryKeys.activity.heatmap>\n | ReturnType<typeof sifaQueryKeys.activity.teaser>\n | ReturnType<typeof sifaQueryKeys.activity.feed>\n | ReturnType<typeof sifaQueryKeys.endorsement.all>\n | ReturnType<typeof sifaQueryKeys.endorsement.count>\n | ReturnType<typeof sifaQueryKeys.stream.all>\n | ReturnType<typeof sifaQueryKeys.stream.networkCount>\n | ReturnType<typeof sifaQueryKeys.reactions.all>\n | ReturnType<typeof sifaQueryKeys.reactions.status>\n | ReturnType<typeof sifaQueryKeys.reactions.accountCheck>\n | ReturnType<typeof sifaQueryKeys.roadmap.all>\n | ReturnType<typeof sifaQueryKeys.roadmap.votes>\n | ReturnType<typeof sifaQueryKeys.roadmap.myVotes>;\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport type { Profile } from '../../types/index.js';\nimport { useSifaConfig } from '../config.js';\nimport { fetchAtFundLink, fetchProfile } from '../fetchers/profile.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * React hook that reads an aggregated profile by handle or DID via\n * TanStack Query. Returns `null` data when the profile does not exist.\n *\n * Pass `{ enabled: false }` (or an empty `handleOrDid`) to defer the\n * fetch.\n */\nexport function useProfile(\n handleOrDid: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n Profile | null,\n Error,\n Profile | null,\n ReturnType<typeof sifaQueryKeys.profile.byHandle>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.profile.byHandle(handleOrDid ?? ''),\n queryFn: () => fetchProfile(config, handleOrDid ?? ''),\n enabled: Boolean(handleOrDid) && (options?.enabled ?? true),\n ...options,\n });\n}\n\n/**\n * React hook for a profile's AT Fund link. Returns `null` data on error\n * or when the profile has no link configured.\n */\nexport function useAtFundLink(\n did: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n string | null,\n Error,\n string | null,\n ReturnType<typeof sifaQueryKeys.profile.atFundLink>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.profile.atFundLink(did ?? ''),\n queryFn: () => fetchAtFundLink(config, did ?? ''),\n enabled: Boolean(did) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { createPosition, type CreateResult } from '../fetchers/positions.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * React hook for creating a new position record. On success, invalidates\n * the owner's profile cache so the new position is reflected on the next\n * read.\n *\n * The owner DID is required so the mutation can target the correct\n * profile cache entry for invalidation.\n */\nexport function useCreatePosition(\n ownerDid: string,\n options?: Omit<UseMutationOptions<CreateResult, Error, Record<string, unknown>>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: (data: Record<string, unknown>) => createPosition(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.profile.byHandle(ownerDid) });\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.position.byOwner(ownerDid) });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { fetchStats, type StatsResponse } from '../fetchers/stats.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * React hook for the public homepage stats. Returns `null` data on error.\n */\nexport function useStats(\n options?: Omit<\n UseQueryOptions<\n StatsResponse | null,\n Error,\n StatsResponse | null,\n ReturnType<typeof sifaQueryKeys.stats.homepage>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.stats.homepage(),\n queryFn: () => fetchStats(config),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchAppsRegistry,\n fetchHiddenApps,\n type AppRegistryEntry,\n type HiddenApp,\n} from '../fetchers/apps.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/** React hook for the public app registry. */\nexport function useAppsRegistry(\n options?: Omit<\n UseQueryOptions<\n AppRegistryEntry[],\n Error,\n AppRegistryEntry[],\n ReturnType<typeof sifaQueryKeys.apps.registry>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.apps.registry(),\n queryFn: () => fetchAppsRegistry(config),\n ...options,\n });\n}\n\n/**\n * React hook for the authenticated user's hidden-apps list. Requires a\n * client-side session (relies on `credentials: 'include'`).\n */\nexport function useHiddenApps(\n options?: Omit<\n UseQueryOptions<HiddenApp[], Error, HiddenApp[], ReturnType<typeof sifaQueryKeys.apps.hidden>>,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.apps.hidden(),\n queryFn: () => fetchHiddenApps(config),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchSearchFilters,\n fetchSearchProfiles,\n fetchSkillSuggestions,\n type FilterOptions,\n type SearchFilters,\n type SearchResponse,\n type SkillSearchResult,\n} from '../fetchers/search.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nexport function useSearchProfiles(\n filters: SearchFilters,\n options?: Omit<\n UseQueryOptions<\n SearchResponse,\n Error,\n SearchResponse,\n ReturnType<typeof sifaQueryKeys.search.profiles>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.search.profiles(filters as Record<string, unknown>),\n queryFn: () => fetchSearchProfiles(config, filters),\n ...options,\n });\n}\n\nexport function useSkillSuggestions(\n query: string,\n options?: Omit<\n UseQueryOptions<\n SkillSearchResult[],\n Error,\n SkillSearchResult[],\n ReturnType<typeof sifaQueryKeys.search.skills>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.search.skills(query),\n queryFn: () => fetchSkillSuggestions(config, query),\n enabled: query.trim().length > 0 && (options?.enabled ?? true),\n ...options,\n });\n}\n\nexport function useSearchFilters(\n options?: Omit<\n UseQueryOptions<\n FilterOptions,\n Error,\n FilterOptions,\n ReturnType<typeof sifaQueryKeys.search.filters>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.search.filters(),\n queryFn: () => fetchSearchFilters(config),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchFeaturedProfile,\n fetchSimilarProfiles,\n fetchSuggestionCount,\n fetchSuggestions,\n type FeaturedProfile,\n type FetchSuggestionsOptions,\n type SimilarProfile,\n type SuggestionsResponse,\n} from '../fetchers/discovery.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nexport function useSimilarProfiles(\n did: string | undefined | null,\n opts: { limit?: number } = {},\n options?: Omit<\n UseQueryOptions<\n SimilarProfile[],\n Error,\n SimilarProfile[],\n ReturnType<typeof sifaQueryKeys.discovery.similar>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n const limit = opts.limit ?? 5;\n return useQuery({\n queryKey: sifaQueryKeys.discovery.similar(did ?? '', limit),\n queryFn: () => fetchSimilarProfiles(config, did ?? '', { limit }),\n enabled: Boolean(did) && (options?.enabled ?? true),\n ...options,\n });\n}\n\nexport function useSuggestions(\n opts: Omit<\n FetchSuggestionsOptions,\n keyof Omit<FetchSuggestionsOptions, 'source' | 'includeDismissed' | 'cursor' | 'limit'>\n > = {},\n options?: Omit<\n UseQueryOptions<\n SuggestionsResponse,\n Error,\n SuggestionsResponse,\n ReturnType<typeof sifaQueryKeys.discovery.suggestions>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.discovery.suggestions(opts as Record<string, unknown>),\n queryFn: () => fetchSuggestions(config, opts),\n ...options,\n });\n}\n\nexport function useSuggestionCount(\n since?: string,\n options?: Omit<\n UseQueryOptions<\n number,\n Error,\n number,\n ReturnType<typeof sifaQueryKeys.discovery.suggestionCount>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.discovery.suggestionCount(since),\n queryFn: () => fetchSuggestionCount(config, since),\n ...options,\n });\n}\n\nexport function useFeaturedProfile(\n options?: Omit<\n UseQueryOptions<\n FeaturedProfile | null,\n Error,\n FeaturedProfile | null,\n ReturnType<typeof sifaQueryKeys.discovery.featured>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.discovery.featured(),\n queryFn: () => fetchFeaturedProfile(config),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { fetchFollowing, type FollowingResponse } from '../fetchers/follow.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nexport function useFollowing(\n opts: { source?: string; cursor?: string; limit?: number } = {},\n options?: Omit<\n UseQueryOptions<\n FollowingResponse,\n Error,\n FollowingResponse,\n ReturnType<typeof sifaQueryKeys.follow.following>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.follow.following(opts as Record<string, unknown>),\n queryFn: () => fetchFollowing(config, opts),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchActivityFeed,\n fetchActivityTeaser,\n fetchHeatmapData,\n type ActivityFeedResponse,\n type ActivityTeaserResponse,\n type FetchActivityFeedOptions,\n type HeatmapResponse,\n} from '../fetchers/activity.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nexport function useHeatmapData(\n handleOrDid: string | undefined | null,\n days: number,\n options?: Omit<\n UseQueryOptions<\n HeatmapResponse | null,\n Error,\n HeatmapResponse | null,\n ReturnType<typeof sifaQueryKeys.activity.heatmap>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.activity.heatmap(handleOrDid ?? '', days),\n queryFn: () => fetchHeatmapData(config, handleOrDid ?? '', days),\n enabled: Boolean(handleOrDid) && (options?.enabled ?? true),\n ...options,\n });\n}\n\nexport function useActivityTeaser(\n handleOrDid: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n ActivityTeaserResponse | null,\n Error,\n ActivityTeaserResponse | null,\n ReturnType<typeof sifaQueryKeys.activity.teaser>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.activity.teaser(handleOrDid ?? ''),\n queryFn: () => fetchActivityTeaser(config, handleOrDid ?? ''),\n enabled: Boolean(handleOrDid) && (options?.enabled ?? true),\n ...options,\n });\n}\n\nexport function useActivityFeed(\n handleOrDid: string | undefined | null,\n opts: Pick<FetchActivityFeedOptions, 'category' | 'limit' | 'cursor'> = {},\n options?: Omit<\n UseQueryOptions<\n ActivityFeedResponse | null,\n Error,\n ActivityFeedResponse | null,\n ReturnType<typeof sifaQueryKeys.activity.feed>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.activity.feed(handleOrDid ?? '', opts as Record<string, unknown>),\n queryFn: () => fetchActivityFeed(config, handleOrDid ?? '', opts),\n enabled: Boolean(handleOrDid) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { fetchEndorsementCount } from '../fetchers/endorsement.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/** Count of confirmed endorsements for a DID. Returns 0 on error. */\nexport function useEndorsementCount(\n did: string | undefined | null,\n options?: Omit<\n UseQueryOptions<number, Error, number, ReturnType<typeof sifaQueryKeys.endorsement.count>>,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.endorsement.count(did ?? ''),\n queryFn: () => fetchEndorsementCount(config, did ?? ''),\n enabled: Boolean(did) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { fetchNetworkStreamCount } from '../fetchers/stream.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Count of items in the authenticated user's network stream digest.\n * Returns 0 on error (including when the endpoint isn't yet shipped).\n */\nexport function useNetworkStreamCount(\n did: string | undefined | null,\n options?: Omit<\n UseQueryOptions<number, Error, number, ReturnType<typeof sifaQueryKeys.stream.networkCount>>,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.stream.networkCount(did ?? ''),\n queryFn: () => fetchNetworkStreamCount(config, did ?? ''),\n enabled: Boolean(did) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n checkAppAccount,\n fetchReactionStatus,\n type AccountCheckResult,\n type ReactionStatus,\n} from '../fetchers/reactions.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Batch-look up reaction status for multiple URIs. Skips the network call\n * when `uris` is empty.\n */\nexport function useReactionStatus(\n uris: string[],\n options?: Omit<\n UseQueryOptions<\n Record<string, ReactionStatus> | null,\n Error,\n Record<string, ReactionStatus> | null,\n ReturnType<typeof sifaQueryKeys.reactions.status>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.reactions.status(uris),\n queryFn: () => fetchReactionStatus(config, uris),\n ...options,\n });\n}\n\n/** Check whether the authenticated viewer has an account on the given app. */\nexport function useAppAccountCheck(\n appId: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n AccountCheckResult | null,\n Error,\n AccountCheckResult | null,\n ReturnType<typeof sifaQueryKeys.reactions.accountCheck>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.reactions.accountCheck(appId ?? ''),\n queryFn: () => checkAppAccount(config, appId ?? ''),\n enabled: Boolean(appId) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchMyRoadmapVotes,\n fetchRoadmapVotes,\n type RoadmapVotesResponse,\n} from '../fetchers/roadmap.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/** Public roadmap vote tallies. Returns `{}` data on error. */\nexport function useRoadmapVotes(\n options?: Omit<\n UseQueryOptions<\n RoadmapVotesResponse,\n Error,\n RoadmapVotesResponse,\n ReturnType<typeof sifaQueryKeys.roadmap.votes>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.roadmap.votes(),\n queryFn: () => fetchRoadmapVotes(config),\n ...options,\n });\n}\n\n/** Roadmap items the authenticated viewer has voted on. Returns `[]` data on error. */\nexport function useMyRoadmapVotes(\n options?: Omit<\n UseQueryOptions<string[], Error, string[], ReturnType<typeof sifaQueryKeys.roadmap.myVotes>>,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.roadmap.myVotes(),\n queryFn: () => fetchMyRoadmapVotes(config),\n ...options,\n });\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/query/client.ts","../../src/query/config.tsx","../../src/query/fetchers/profile.ts","../../src/query/fetchers/profile-mutations.ts","../../src/query/fetchers/positions.ts","../../src/query/fetchers/education.ts","../../src/query/fetchers/skills.ts","../../src/query/fetchers/records.ts","../../src/query/fetchers/profile-locations.ts","../../src/query/fetchers/external-accounts.ts","../../src/query/fetchers/endorsements.ts","../../src/query/fetchers/keytrace-claims.ts","../../src/query/fetchers/publications.ts","../../src/query/fetchers/stats.ts","../../src/query/fetchers/apps.ts","../../src/query/fetchers/search.ts","../../src/query/fetchers/discovery.ts","../../src/query/fetchers/follow.ts","../../src/query/fetchers/activity.ts","../../src/query/fetchers/endorsement.ts","../../src/query/fetchers/stream.ts","../../src/query/fetchers/reactions.ts","../../src/query/fetchers/quoted-posts.ts","../../src/query/fetchers/roadmap.ts","../../src/query/fetchers/destructive.ts","../../src/query/keys.ts","../../src/query/hooks/use-profile.ts","../../src/query/hooks/use-profile-mutations.ts","../../src/query/hooks/use-create-position.ts","../../src/query/hooks/use-position-mutations.ts","../../src/query/hooks/use-education-mutations.ts","../../src/query/hooks/use-skill-mutations.ts","../../src/query/hooks/use-record-mutations.ts","../../src/query/hooks/use-location-mutations.ts","../../src/query/hooks/use-external-accounts.ts","../../src/query/hooks/use-endorsement-mutations.ts","../../src/query/hooks/use-keytrace-claims.ts","../../src/query/hooks/use-publication-mutations.ts","../../src/query/hooks/use-stats.ts","../../src/query/hooks/use-apps.ts","../../src/query/hooks/use-search.ts","../../src/query/hooks/use-discovery.ts","../../src/query/hooks/use-follow.ts","../../src/query/hooks/use-activity.ts","../../src/query/hooks/use-endorsement.ts","../../src/query/hooks/use-stream.ts","../../src/query/hooks/use-reactions.ts","../../src/query/hooks/use-reaction-mutations.ts","../../src/query/hooks/use-roadmap.ts","../../src/query/hooks/use-roadmap-mutations.ts","../../src/query/hooks/use-destructive.ts"],"names":["createContext","useContext","useQuery","useQueryClient","useMutation","invalidateProfile"],"mappings":";;;;;;;AA2CO,IAAM,QAAA,GAAN,cAAuB,KAAA,CAAM;AAAA,EACzB,MAAA;AAAA,EACA,IAAA;AAAA,EAET,WAAA,CAAY,OAAA,EAAiB,MAAA,EAAgB,IAAA,EAAgB;AAC3D,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,UAAA;AACZ,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AAAA,EACd;AACF;AAEA,IAAM,k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AA,EACA;AACA,EAAA,MAAM,SAAS,aAAA,EAAc;AAC7B,EAAA,MAAM,cAAcD,yBAAAA,EAAe;AACnC,EAAA,OAAOC,sBAAAA,CAAY;AAAA,IACjB,UAAA,EAAY,CAAC,aAAA,KAA2B,aAAA,CAAc,QAAQ,aAAa,CAAA;AAAA,IAC3E,SAAA,EAAW,OAAO,MAAA,EAAQ,SAAA,EAAW,gBAAgB,OAAA,KAAY;AAC/D,MAAA,IAAI,OAAO,OAAA,EAAS;AAClB,QAAA,WAAA,CAAY,KAAA,EAAM;AAAA,MACpB;AACA,MAAA,MAAM,OAAA,EAAS,SAAA,GAAY,MAAA,EAAQ,SAAA,EAAW,gBAAgB,OAAO,CAAA;AAAA,IACvE,CAAA;AAAA,IACA,GAAG;AAAA,GACJ,CAAA;AACH","file":"index.cjs","sourcesContent":["/**\n * Foundation HTTP client for talking to the Sifa AppView.\n *\n * Stateless. Consumers supply a {@link SifaApiConfig} per call (the React\n * hooks read it from context; non-React consumers pass it explicitly). No\n * singletons, no module-level state.\n */\n\n/** Configuration passed to every fetcher. */\nexport interface SifaApiConfig {\n /** Base URL of the sifa-api AppView, e.g. `https://api.sifa.id`. No trailing slash. */\n baseUrl: string;\n /**\n * Optional fetch implementation. Defaults to {@link globalThis.fetch}.\n * Lets Next.js consumers pass their cache-enhanced fetch; node/Expo\n * consumers can leave this unset.\n */\n fetch?: typeof fetch;\n}\n\n/** Options accepted by {@link apiFetch}. */\nexport interface ApiFetchOptions {\n method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';\n /** Request body. Serialized to JSON automatically. */\n body?: unknown;\n /** AbortSignal. Defaults to `AbortSignal.timeout(timeoutMs)` if `timeoutMs` is set. */\n signal?: AbortSignal;\n /** Per-call timeout in milliseconds. Default: 10_000. Ignored if `signal` is provided. */\n timeoutMs?: number;\n /** Retry on HTTP 429 up to 3 times with the server's `Retry-After` delay (capped at 3s). */\n retryOn429?: boolean;\n /** Additional headers. `Content-Type: application/json` is set automatically when `body` is present. */\n headers?: Record<string, string>;\n credentials?: RequestCredentials;\n cache?: RequestCache;\n /**\n * Next.js-specific cache hints. Ignored on non-Next runtimes. Passed\n * through transparently as part of {@link RequestInit}.\n */\n next?: { revalidate?: number | false; tags?: string[] };\n}\n\n/** Error thrown by {@link apiFetch} on non-2xx responses. */\nexport class ApiError extends Error {\n readonly status: number;\n readonly body: unknown;\n\n constructor(message: string, status: number, body?: unknown) {\n super(message);\n this.name = 'ApiError';\n this.status = status;\n this.body = body;\n }\n}\n\nconst DEFAULT_TIMEOUT_MS = 10_000;\nconst MAX_RATE_LIMIT_RETRIES = 3;\nconst RATE_LIMIT_RETRY_CAP_SECONDS = 3;\n\n/**\n * Generic fetcher used by all SDK query and mutation functions.\n *\n * Returns parsed JSON typed as `T`. Throws {@link ApiError} on non-2xx\n * responses. Use {@link apiFetchOrNull} when 404 should resolve to `null`\n * instead.\n */\nexport async function apiFetch<T = unknown>(\n config: SifaApiConfig,\n path: string,\n options: ApiFetchOptions = {},\n): Promise<T> {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const url = `${config.baseUrl}${path}`;\n const maxRetries = options.retryOn429 ? MAX_RATE_LIMIT_RETRIES : 0;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n const signal = options.signal ?? AbortSignal.timeout(options.timeoutMs ?? DEFAULT_TIMEOUT_MS);\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n let body: BodyInit | undefined;\n if (options.body !== undefined) {\n headers['Content-Type'] ??= 'application/json';\n body = JSON.stringify(options.body);\n }\n\n // `next` is a Next.js extension to RequestInit; cast through.\n const init = {\n method: options.method ?? 'GET',\n headers,\n body,\n signal,\n credentials: options.credentials,\n cache: options.cache,\n ...(options.next ? { next: options.next } : {}),\n } as RequestInit;\n\n const res = await fetchFn(url, init);\n\n if (res.status === 429 && attempt < maxRetries) {\n const retryAfterRaw = res.headers.get('retry-after');\n const retryAfter = retryAfterRaw ? Number.parseInt(retryAfterRaw, 10) : 2;\n const waitSeconds = Math.min(\n Number.isFinite(retryAfter) ? retryAfter : 2,\n RATE_LIMIT_RETRY_CAP_SECONDS,\n );\n await new Promise((r) => setTimeout(r, waitSeconds * 1000));\n continue;\n }\n\n if (!res.ok) {\n let errBody: unknown;\n try {\n errBody = (await res.json()) as unknown;\n } catch {\n try {\n errBody = await res.text();\n } catch {\n errBody = undefined;\n }\n }\n throw new ApiError(`Sifa API ${res.status} on ${path}`, res.status, errBody);\n }\n\n return (await res.json()) as T;\n }\n\n throw new ApiError(`Sifa API exhausted retries on ${path}`, 429);\n}\n\n/**\n * Variant of {@link apiFetch} that resolves to `null` on HTTP 404 instead\n * of throwing. Useful for \"fetch by handle\" reads where missing is\n * expected (e.g. unknown profile).\n */\nexport async function apiFetchOrNull<T>(\n config: SifaApiConfig,\n path: string,\n options: ApiFetchOptions = {},\n): Promise<T | null> {\n try {\n return await apiFetch<T>(config, path, options);\n } catch (e) {\n if (e instanceof ApiError && e.status === 404) return null;\n throw e;\n }\n}\n\n/**\n * Result returned by record-write mutations (create / update / delete).\n *\n * Never throws -- writes against the user's PDS can fail in many ways\n * (network, PDS unreachable, rate limit) and the UI needs structured\n * results to render appropriate messages.\n */\nexport interface WriteResult {\n success: boolean;\n error?: string;\n /**\n * PDS hostname returned by sifa-api when a write failed at the user's\n * Personal Data Server (issue #167). Lets the UI render\n * \"Your data server (eurosky.social) isn't responding\" instead of a\n * generic \"Request failed (500)\".\n */\n pdsHost?: string;\n}\n\n/** Result returned by create mutations. Includes the newly created `rkey`. */\nexport interface CreateResult extends WriteResult {\n rkey?: string;\n}\n\ninterface ApiErrorBody {\n message?: string;\n pdsHost?: string;\n}\n\nfunction extractWriteError(data: unknown, status: number): { error: string; pdsHost?: string } {\n const body = (data ?? {}) as ApiErrorBody;\n return {\n error: body.message ?? `Request failed (${status})`,\n ...(body.pdsHost ? { pdsHost: body.pdsHost } : {}),\n };\n}\n\n/**\n * Write mutation against the Sifa AppView. Wraps {@link apiFetch} with the\n * never-throws contract used by all sifa-web mutations: returns a\n * structured {@link WriteResult} on both success and failure, and\n * preserves the `pdsHost` field when the AppView reports a PDS-side\n * failure (issue #167).\n *\n * On success: returns `{ success: true, ...payload }` where `payload` is\n * whatever the server returned in JSON (or `{}` for 204).\n *\n * On failure: returns `{ success: false, error, pdsHost? }`. Never throws.\n *\n * Use {@link apiWriteCreate} when you specifically need the `rkey` from a\n * create response folded into the result shape.\n */\nexport async function apiWrite<TExtra extends object = Record<never, never>>(\n config: SifaApiConfig,\n path: string,\n method: 'POST' | 'PUT' | 'DELETE' | 'PATCH',\n options: Omit<ApiFetchOptions, 'method'> = {},\n): Promise<WriteResult & TExtra> {\n try {\n const data = await apiFetch<TExtra>(config, path, {\n method,\n credentials: 'include',\n ...options,\n });\n return { success: true, ...(data ?? ({} as TExtra)) };\n } catch (e) {\n if (e instanceof ApiError) {\n return { success: false, ...extractWriteError(e.body, e.status) } as WriteResult & TExtra;\n }\n return { success: false, error: 'Network error' } as WriteResult & TExtra;\n }\n}\n\n/**\n * Write mutation that expects the server to return a record key (`rkey`)\n * in its response body. Wraps {@link apiWrite} and folds the `rkey` into\n * the result shape so consumers get `{ success, rkey?, error?, pdsHost? }`.\n *\n * If the server returns additional fields (e.g. `feedUrl` from external\n * account creation), pass them via the `TExtra` generic to keep them\n * typed.\n */\nexport function apiWriteCreate<TExtra extends object = Record<never, never>>(\n config: SifaApiConfig,\n path: string,\n body: unknown,\n options: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<CreateResult & TExtra> {\n return apiWrite<{ rkey?: string } & TExtra>(config, path, 'POST', {\n body,\n ...options,\n });\n}\n","'use client';\n\nimport { createContext, useContext, type ReactNode } from 'react';\n\nimport type { SifaApiConfig } from './client.js';\n\nconst SifaConfigContext = createContext<SifaApiConfig | null>(null);\n\nexport interface SifaProviderProps {\n config: SifaApiConfig;\n children: ReactNode;\n}\n\n/**\n * Provides the {@link SifaApiConfig} that hooks under it can read via\n * {@link useSifaConfig}. Wrap the React tree once; hooks consume it.\n *\n * @example\n * ```tsx\n * <QueryClientProvider client={queryClient}>\n * <SifaProvider config={{ baseUrl: process.env.NEXT_PUBLIC_API_URL! }}>\n * <App />\n * </SifaProvider>\n * </QueryClientProvider>\n * ```\n */\nexport function SifaProvider({ config, children }: SifaProviderProps) {\n return <SifaConfigContext.Provider value={config}>{children}</SifaConfigContext.Provider>;\n}\n\n/**\n * Read the SDK's {@link SifaApiConfig} from context. Throws if no\n * {@link SifaProvider} is mounted above.\n */\nexport function useSifaConfig(): SifaApiConfig {\n const ctx = useContext(SifaConfigContext);\n if (!ctx) {\n throw new Error(\n 'useSifaConfig must be used inside <SifaProvider>. Wrap your app once with <SifaProvider config={...}>.',\n );\n }\n return ctx;\n}\n","import type { Profile } from '../../types/index.js';\nimport { apiFetch, apiFetchOrNull, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/**\n * Read the aggregated profile for a handle or DID.\n *\n * Returns `null` when the AppView has no profile for the given identifier\n * (HTTP 404). Throws {@link ApiError} on other non-2xx responses.\n *\n * Server-callable (Next.js RSC) and client-callable (Expo, browser).\n */\nexport function fetchProfile(\n config: SifaApiConfig,\n handleOrDid: string,\n options: ApiFetchOptions = {},\n): Promise<Profile | null> {\n const path = `/api/profile/${encodeURIComponent(handleOrDid)}`;\n return apiFetchOrNull<Profile>(config, path, {\n retryOn429: true,\n ...options,\n });\n}\n\n/**\n * Public AT Fund link for a profile, if one is configured. Returns `null`\n * on any error or when the response payload's `url` field is missing or\n * non-string.\n */\nexport async function fetchAtFundLink(\n config: SifaApiConfig,\n did: string,\n options: ApiFetchOptions = {},\n): Promise<string | null> {\n const path = `/api/profiles/${encodeURIComponent(did)}/at-fund-link`;\n try {\n const data = await apiFetch<{ url?: unknown }>(config, path, {\n next: { revalidate: 3600 },\n timeoutMs: 5000,\n ...options,\n });\n return typeof data.url === 'string' ? data.url : null;\n } catch {\n return null;\n }\n}\n","import { apiWrite, type ApiFetchOptions, type SifaApiConfig, type WriteResult } from '../client.js';\n\n/** Industry/domain entry on the profile self record. */\nexport interface ProfileIndustryInput {\n industry: string;\n domain?: string;\n}\n\n/**\n * Location payload accepted by `updateProfileSelf`.\n *\n * Accepts both shapes during the community.lexicon.location.address\n * migration. Prefer `locality` (new) over `city` (legacy) when sending.\n * The API's locationSchema is a Zod union that resolves either input.\n */\nexport interface ProfileSelfLocation {\n country: string;\n countryCode?: string;\n region?: string;\n city?: string;\n locality?: string;\n}\n\n/** Body accepted by {@link updateProfileSelf}. */\nexport interface UpdateProfileSelfInput {\n headline?: string;\n about?: string;\n industries?: ProfileIndustryInput[];\n location?: ProfileSelfLocation;\n website?: string;\n openTo?: string[];\n preferredWorkplace?: string[];\n availableFromUtc?: number;\n availableToUtc?: number;\n}\n\n/** Update the authenticated user's `id.sifa.profile.self` record. */\nexport function updateProfileSelf(\n config: SifaApiConfig,\n data: UpdateProfileSelfInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/self', 'PUT', { body: data, ...options });\n}\n\n/** Body accepted by {@link updateProfileOverride}. */\nexport interface UpdateProfileOverrideInput {\n headline?: string | null;\n about?: string | null;\n displayName?: string | null;\n pronouns?: string | null;\n}\n\n/**\n * Override aggregated profile fields with sifa-specific values. `null`\n * clears the override and falls back to the upstream PDS value.\n */\nexport function updateProfileOverride(\n config: SifaApiConfig,\n data: UpdateProfileOverrideInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/override', 'PUT', { body: data, ...options });\n}\n\n/** Extended result for {@link refreshPds}. */\nexport interface RefreshPdsResult extends WriteResult {\n displayName?: string | null;\n avatar?: string | null;\n}\n\n/**\n * Re-pull the authenticated user's `app.bsky.actor.profile` from their\n * PDS. Returns the freshly resolved `displayName` and `avatar` on\n * success so the UI can update without a full profile refetch.\n */\nexport function refreshPds(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<RefreshPdsResult> {\n return apiWrite<{ displayName?: string | null; avatar?: string | null }>(\n config,\n '/api/profile/refresh-pds',\n 'POST',\n options,\n );\n}\n\n/** Extended result for {@link uploadAvatar}. */\nexport interface UploadAvatarResult extends WriteResult {\n /** Publicly accessible URL of the newly uploaded avatar. */\n url?: string;\n}\n\n/**\n * Upload a new avatar via `multipart/form-data`. Pass either a `File`\n * (browser) or any `Blob` (Expo, node). The SDK leaves `Content-Type`\n * unset so the runtime can set the multipart boundary automatically.\n *\n * Never throws -- inspect `result.success` and `result.url`.\n */\nexport async function uploadAvatar(\n config: SifaApiConfig,\n file: Blob,\n options: ApiFetchOptions = {},\n): Promise<UploadAvatarResult> {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const url = `${config.baseUrl}/api/profile/avatar`;\n const formData = new FormData();\n formData.append('file', file);\n\n try {\n const res = await fetchFn(url, {\n method: 'POST',\n credentials: options.credentials ?? 'include',\n body: formData,\n signal: options.signal ?? AbortSignal.timeout(options.timeoutMs ?? 30_000),\n headers: options.headers,\n });\n if (!res.ok) {\n const errBody = (await res.json().catch(() => ({}))) as {\n message?: string;\n pdsHost?: string;\n };\n const msg = errBody.message ?? `Request failed (${res.status})`;\n const pdsHost = errBody.pdsHost;\n return { success: false, error: msg, ...(pdsHost ? { pdsHost } : {}) };\n }\n const data = (await res.json()) as { url: string };\n return { success: true, url: data.url };\n } catch {\n return { success: false, error: 'Network error' };\n }\n}\n\n/** Delete the authenticated user's avatar override (revert to PDS avatar). */\nexport function deleteAvatarOverride(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/avatar', 'DELETE', options);\n}\n","import type { ProfilePosition, SkillRef } from '../../types/index.js';\nimport {\n apiWrite,\n apiWriteCreate,\n type ApiFetchOptions,\n type CreateResult,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\nexport type { CreateResult, WriteResult } from '../client.js';\n\n/**\n * Create a new `id.sifa.profile.position` record on the authenticated\n * user's PDS. The AppView signs and writes via the user's OAuth session.\n *\n * `data` should be a lexicon-shaped position record (without `createdAt`\n * or `rkey`; the AppView fills both). Validate with\n * `ProfilePositionRecordSchema.omit({ createdAt: true })` before calling\n * if you want client-side guarantees.\n *\n * Never throws -- inspect `result.success` and use `result.error` /\n * `result.pdsHost` for UI messaging.\n */\nexport function createPosition(\n config: SifaApiConfig,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiWriteCreate(config, '/api/profile/position', data, options);\n}\n\n/** Update an existing position by `rkey`. */\nexport function updatePosition(\n config: SifaApiConfig,\n rkey: string,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/position/${encodeURIComponent(rkey)}`, 'PUT', {\n body: data,\n ...options,\n });\n}\n\n/** Delete a position by `rkey`. */\nexport function deletePosition(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/position/${encodeURIComponent(rkey)}`, 'DELETE', options);\n}\n\n/** Mark a position as the user's primary (current) role. */\nexport function setPositionPrimary(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/position/${encodeURIComponent(rkey)}/primary`,\n 'PUT',\n options,\n );\n}\n\n/** Clear the \"primary\" flag on a position. */\nexport function unsetPositionPrimary(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/position/${encodeURIComponent(rkey)}/primary`,\n 'DELETE',\n options,\n );\n}\n\n/**\n * Build the PUT-body for a position update. Strips `null` `location`\n * (so JSON.stringify drops it) and includes the provided `skills` list.\n */\nfunction buildPositionPayload(\n position: ProfilePosition,\n skills: SkillRef[],\n): Record<string, unknown> {\n return {\n company: position.company,\n title: position.title,\n description: position.description,\n startedAt: position.startedAt,\n endedAt: position.endedAt,\n location: position.location ?? undefined,\n skills,\n };\n}\n\n/**\n * Add a skill link to a position. Idempotent: if the skill is already\n * linked, resolves to `{ success: true }` without a network call.\n *\n * Implementation note: the AppView only exposes whole-record PUTs, so\n * this helper rebuilds the position body with the new skills list.\n */\nexport function linkSkillToPosition(\n config: SifaApiConfig,\n position: ProfilePosition,\n skillRef: SkillRef,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n const currentSkills = position.skills ?? [];\n if (currentSkills.some((s) => s.uri === skillRef.uri)) {\n return Promise.resolve({ success: true });\n }\n return updatePosition(\n config,\n position.rkey,\n buildPositionPayload(position, [...currentSkills, skillRef]),\n options,\n );\n}\n\n/** Remove a skill link from a position. */\nexport function unlinkSkillFromPosition(\n config: SifaApiConfig,\n position: ProfilePosition,\n skillRef: SkillRef,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n const remaining = (position.skills ?? []).filter((s) => s.uri !== skillRef.uri);\n return updatePosition(config, position.rkey, buildPositionPayload(position, remaining), options);\n}\n","import {\n apiWrite,\n apiWriteCreate,\n type ApiFetchOptions,\n type CreateResult,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/**\n * Create a new `id.sifa.profile.education` record on the authenticated\n * user's PDS.\n */\nexport function createEducation(\n config: SifaApiConfig,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiWriteCreate(config, '/api/profile/education', data, options);\n}\n\n/** Update an existing education record by `rkey`. */\nexport function updateEducation(\n config: SifaApiConfig,\n rkey: string,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/education/${encodeURIComponent(rkey)}`, 'PUT', {\n body: data,\n ...options,\n });\n}\n\n/** Delete an education record by `rkey`. */\nexport function deleteEducation(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/education/${encodeURIComponent(rkey)}`, 'DELETE', options);\n}\n","import {\n apiWrite,\n apiWriteCreate,\n type ApiFetchOptions,\n type CreateResult,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/**\n * Create a new `id.sifa.profile.skill` record on the authenticated\n * user's PDS.\n */\nexport function createSkill(\n config: SifaApiConfig,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiWriteCreate(config, '/api/profile/skill', data, options);\n}\n\n/** Update an existing skill record by `rkey`. */\nexport function updateSkill(\n config: SifaApiConfig,\n rkey: string,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/skill/${encodeURIComponent(rkey)}`, 'PUT', {\n body: data,\n ...options,\n });\n}\n\n/** Delete a skill record by `rkey`. */\nexport function deleteSkill(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/skill/${encodeURIComponent(rkey)}`, 'DELETE', options);\n}\n","import {\n apiWrite,\n apiWriteCreate,\n type ApiFetchOptions,\n type CreateResult,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/**\n * Generic record-create escape hatch. Most callers should prefer the\n * dedicated section helpers (`createPosition`, `createEducation`, etc.)\n * which take typed payloads and ship matching hooks. Use this when the\n * lexicon doesn't yet have a dedicated endpoint (certifications,\n * projects, publications, volunteering, honors, languages, courses).\n *\n * `collection` is a `id.sifa.profile.*` collection NSID. Routes to\n * `POST /api/profile/records/<collection>`.\n */\nexport function createRecord(\n config: SifaApiConfig,\n collection: string,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiWriteCreate(\n config,\n `/api/profile/records/${encodeURIComponent(collection)}`,\n data,\n options,\n );\n}\n\n/** Generic record-update escape hatch. See {@link createRecord}. */\nexport function updateRecord(\n config: SifaApiConfig,\n collection: string,\n rkey: string,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n const path = `/api/profile/records/${encodeURIComponent(collection)}/${encodeURIComponent(rkey)}`;\n return apiWrite(config, path, 'PUT', { body: data, ...options });\n}\n\n/** Generic record-delete escape hatch. See {@link createRecord}. */\nexport function deleteRecord(\n config: SifaApiConfig,\n collection: string,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n const path = `/api/profile/records/${encodeURIComponent(collection)}/${encodeURIComponent(rkey)}`;\n return apiWrite(config, path, 'DELETE', options);\n}\n","import {\n apiWrite,\n apiWriteCreate,\n type ApiFetchOptions,\n type CreateResult,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/**\n * Address payload accepted by `/api/profile/location` endpoints.\n *\n * Accepts both shapes during the community.lexicon.location.address\n * migration. Prefer `country` + `locality` (new) over `countryCode` +\n * `city` (legacy). The API's `locationSchema` is a Zod union that\n * accepts either pair.\n */\nexport interface ProfileLocationAddress {\n /** Legacy alias for `country` (alpha-2). */\n countryCode?: string;\n /** community.lexicon.location.address field -- prefer over `countryCode`. */\n country?: string;\n region?: string;\n /** Legacy alias for `locality`. */\n city?: string;\n /** community.lexicon.location.address field -- prefer over `city`. */\n locality?: string;\n}\n\n/** Body accepted by {@link createProfileLocation} / {@link updateProfileLocation}. */\nexport interface ProfileLocationInput {\n address: ProfileLocationAddress;\n type: string;\n label?: string;\n isPrimary?: boolean;\n}\n\n/** Create a new profile location entry. */\nexport function createProfileLocation(\n config: SifaApiConfig,\n data: ProfileLocationInput,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiWriteCreate(config, '/api/profile/location', data, options);\n}\n\n/** Update an existing profile location by `rkey`. */\nexport function updateProfileLocation(\n config: SifaApiConfig,\n rkey: string,\n data: ProfileLocationInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/location/${encodeURIComponent(rkey)}`, 'PUT', {\n body: data,\n ...options,\n });\n}\n\n/** Delete a profile location by `rkey`. */\nexport function deleteProfileLocation(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/location/${encodeURIComponent(rkey)}`, 'DELETE', options);\n}\n","import type { ExternalAccount } from '../../types/index.js';\nimport {\n apiFetch,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/** Body accepted by {@link createExternalAccount} / {@link updateExternalAccount}. */\nexport interface ExternalAccountInput {\n platform: string;\n url: string;\n label?: string;\n feedUrl?: string;\n}\n\n/** Extended create result for {@link createExternalAccount}. */\nexport interface CreateExternalAccountResult extends WriteResult {\n rkey?: string;\n feedUrl?: string | null;\n}\n\n/** Extended write result for {@link verifyExternalAccount}. */\nexport interface VerifyExternalAccountResult extends WriteResult {\n verified?: boolean;\n verifiedVia?: string;\n}\n\n/** List external accounts attached to a profile. Returns `[]` on error. */\nexport async function fetchExternalAccounts(\n config: SifaApiConfig,\n handleOrDid: string,\n options: ApiFetchOptions = {},\n): Promise<ExternalAccount[]> {\n const path = `/api/profile/${encodeURIComponent(handleOrDid)}/external-accounts`;\n try {\n const data = await apiFetch<{ accounts?: ExternalAccount[] }>(config, path, {\n credentials: 'include',\n ...options,\n });\n return data.accounts ?? [];\n } catch {\n return [];\n }\n}\n\n/**\n * Create a new external account record. Returns the newly-created `rkey`\n * and the server-resolved `feedUrl` (sifa-api inspects the target for\n * RSS feeds on platforms that publish them).\n */\nexport function createExternalAccount(\n config: SifaApiConfig,\n data: ExternalAccountInput,\n options: ApiFetchOptions = {},\n): Promise<CreateExternalAccountResult> {\n return apiWrite<{ rkey?: string; feedUrl?: string | null }>(\n config,\n '/api/profile/external-accounts',\n 'POST',\n { body: data, ...options },\n );\n}\n\n/** Update an existing external account by `rkey`. */\nexport function updateExternalAccount(\n config: SifaApiConfig,\n rkey: string,\n data: ExternalAccountInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/external-accounts/${encodeURIComponent(rkey)}`, 'PUT', {\n body: data,\n ...options,\n });\n}\n\n/** Delete an external account by `rkey`. */\nexport function deleteExternalAccount(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/external-accounts/${encodeURIComponent(rkey)}`,\n 'DELETE',\n options,\n );\n}\n\n/** Mark an external account as the user's primary. */\nexport function setExternalAccountPrimary(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/external-accounts/${encodeURIComponent(rkey)}/primary`,\n 'PUT',\n options,\n );\n}\n\n/** Clear the \"primary\" flag on an external account. */\nexport function unsetExternalAccountPrimary(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/external-accounts/${encodeURIComponent(rkey)}/primary`,\n 'DELETE',\n options,\n );\n}\n\n/**\n * Run server-side verification on an external account (e.g. inspect\n * the target for a keytrace claim). Returns `{ verified, verifiedVia }`\n * on success.\n */\nexport function verifyExternalAccount(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<VerifyExternalAccountResult> {\n return apiWrite<{ verified?: boolean; verifiedVia?: string }>(\n config,\n `/api/profile/external-accounts/${encodeURIComponent(rkey)}/verify`,\n 'POST',\n { body: {}, ...options },\n );\n}\n","import {\n apiWriteCreate,\n type ApiFetchOptions,\n type CreateResult,\n type SifaApiConfig,\n} from '../client.js';\n\n/** Body accepted by {@link createEndorsement}. */\nexport interface EndorsementInput {\n skillUri: string;\n comment?: string;\n}\n\n/**\n * Create an endorsement of another user's skill. The endorsed user\n * must confirm before the endorsement appears on their profile (the\n * endorsement record is on the endorser's PDS; a separate confirmation\n * record on the endorsed user's PDS gates display).\n */\nexport function createEndorsement(\n config: SifaApiConfig,\n data: EndorsementInput,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiWriteCreate(config, '/api/endorsements', data, options);\n}\n","import { apiWrite, type ApiFetchOptions, type SifaApiConfig, type WriteResult } from '../client.js';\n\n/**\n * Hide a keytrace claim (verified-account claim discovered on the\n * user's external accounts) from the user's profile. The claim itself\n * stays in the index; only its display is suppressed.\n */\nexport function hideKeytraceClaim(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/keytrace-claims/${encodeURIComponent(rkey)}/hide`,\n 'POST',\n options,\n );\n}\n\n/** Restore a previously-hidden keytrace claim. */\nexport function unhideKeytraceClaim(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/keytrace-claims/${encodeURIComponent(rkey)}/hide`,\n 'DELETE',\n options,\n );\n}\n","import { apiWrite, type ApiFetchOptions, type SifaApiConfig, type WriteResult } from '../client.js';\n\n/** Extended result for {@link refreshOrcidPublications}. */\nexport interface RefreshOrcidPublicationsResult extends WriteResult {\n added?: number;\n removed?: number;\n}\n\n/**\n * Hide an ORCID-imported publication from the user's profile. The\n * `putCode` is the ORCID-side identifier; the underlying record stays\n * in the index, only its display is suppressed.\n */\nexport function hideOrcidPublication(\n config: SifaApiConfig,\n putCode: number,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/orcid-publications/${putCode}/hide`, 'POST', options);\n}\n\n/** Restore a previously-hidden ORCID publication. */\nexport function unhideOrcidPublication(\n config: SifaApiConfig,\n putCode: number,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/orcid-publications/${putCode}/hide`, 'DELETE', options);\n}\n\n/** Hide a standard (auto-imported) publication by its AT URI. */\nexport function hideStandardPublication(\n config: SifaApiConfig,\n uri: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/standard-publications/${encodeURIComponent(uri)}/hide`,\n 'POST',\n options,\n );\n}\n\n/** Restore a previously-hidden standard publication. */\nexport function unhideStandardPublication(\n config: SifaApiConfig,\n uri: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/standard-publications/${encodeURIComponent(uri)}/hide`,\n 'DELETE',\n options,\n );\n}\n\n/** Bulk-hide standard publications by AT URI list. */\nexport function bulkHideStandardPublications(\n config: SifaApiConfig,\n uris: string[],\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/standard-publications/bulk-hide', 'POST', {\n body: { uris },\n ...options,\n });\n}\n\n/** Bulk-unhide standard publications by AT URI list. */\nexport function bulkUnhideStandardPublications(\n config: SifaApiConfig,\n uris: string[],\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/standard-publications/bulk-hide', 'DELETE', {\n body: { uris },\n ...options,\n });\n}\n\n/** Hide an `id.sifa.profile.publication` (user-authored publication record). */\nexport function hideSifaPublication(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/publications/${rkey}/hide`, 'POST', options);\n}\n\n/** Restore a previously-hidden Sifa publication. */\nexport function unhideSifaPublication(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/publications/${rkey}/hide`, 'DELETE', options);\n}\n\n/**\n * Re-pull the authenticated user's ORCID publications. Returns counts\n * of added and removed records. The server returns `{ error: '...' }`\n * inline (not via HTTP status) on quota / linkage failures; the SDK\n * folds that into `{ success: false, error }` to keep the contract\n * consistent with other mutations.\n */\nexport async function refreshOrcidPublications(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<RefreshOrcidPublicationsResult> {\n const result = await apiWrite<{ added?: number; removed?: number; error?: string }>(\n config,\n '/api/profile/orcid-publications/refresh',\n 'POST',\n { body: {}, ...options },\n );\n if (result.success && result.error) {\n return { success: false, error: result.error };\n }\n return result;\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** Public, aggregate stats shown on the homepage and similar surfaces. */\nexport interface StatsResponse {\n profileCount: number;\n avatars: string[];\n atproto: {\n userCount: number;\n growthPerSecond: number;\n timestamp: number;\n } | null;\n}\n\n/**\n * Homepage stats (profile count, avatar samples, ATproto growth). Public\n * endpoint -- safe to cache. Returns `null` on any error so callers can\n * render a graceful empty state.\n */\nexport async function fetchStats(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<StatsResponse | null> {\n try {\n return await apiFetch<StatsResponse>(config, '/api/stats', {\n next: { revalidate: 900 },\n ...options,\n });\n } catch {\n return null;\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** Catalog entry describing an ATproto app that Sifa surfaces activity for. */\nexport interface AppRegistryEntry {\n id: string;\n name: string;\n category: string;\n collectionPrefixes: string[];\n scanCollections: string[];\n urlPattern?: string;\n color: string;\n}\n\n/** Compact app representation returned by the hidden-apps endpoint. */\nexport interface HiddenApp {\n id: string;\n name: string;\n category: string;\n}\n\nexport interface FetchHiddenAppsOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * `credentials: 'include'` does NOT propagate browser cookies in RSC,\n * so authenticated server fetches must forward the header explicitly.\n */\n cookieHeader?: string;\n}\n\n/**\n * Public app registry shown across discovery surfaces. Heavily cached.\n * Returns `[]` on any error.\n */\nexport async function fetchAppsRegistry(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<AppRegistryEntry[]> {\n try {\n return await apiFetch<AppRegistryEntry[]>(config, '/api/apps/registry', {\n next: { revalidate: 86400 },\n ...options,\n });\n } catch {\n return [];\n }\n}\n\n/**\n * Apps the authenticated user has chosen to hide from their activity feed.\n * Requires an authenticated session. Returns `[]` on any error (including\n * the unauthenticated case).\n */\nexport async function fetchHiddenApps(\n config: SifaApiConfig,\n options: FetchHiddenAppsOptions = {},\n): Promise<HiddenApp[]> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n const data = await apiFetch<{ apps: HiddenApp[] }>(config, '/api/profile/hidden-apps', {\n credentials: 'include',\n ...options,\n headers,\n });\n return data.apps;\n } catch {\n return [];\n }\n}\n","import type { SkillSuggestion } from '../../types/index.js';\nimport { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** Profile entry returned by the search endpoint. */\nexport interface ProfileSearchResult {\n did?: string;\n handle: string;\n displayName?: string;\n headline?: string;\n avatar?: string;\n about?: string;\n currentRole?: string;\n currentCompany?: string;\n industry?: string;\n domain?: string;\n countryCode?: string;\n locationCountry?: string;\n preferredWorkplace?: string[];\n claimed?: boolean;\n blueskyVerified?: boolean;\n blueskyVerifiedAt?: string | null;\n}\n\nexport interface SearchFilters {\n q?: string;\n skill?: string;\n country?: string;\n industry?: string;\n domain?: string;\n workplace?: string;\n app?: string;\n limit?: number;\n}\n\nexport interface SearchResponse {\n profiles: ProfileSearchResult[];\n total: number;\n limit: number;\n offset: number;\n}\n\n/** Skill typeahead suggestion. */\nexport interface SkillSearchResult {\n name: string;\n slug: string;\n category: string;\n userCount: number;\n}\n\nexport interface FilterOptions {\n countries: { countryCode: string; country: string; count: number }[];\n industries: { industry: string; count: number }[];\n apps: { appId: string; count: number }[];\n}\n\nconst EMPTY_SEARCH: SearchResponse = { profiles: [], total: 0, limit: 20, offset: 0 };\nconst EMPTY_FILTERS: FilterOptions = { countries: [], industries: [], apps: [] };\n\n/**\n * Search profiles by free-text query and optional filters. Returns an\n * empty result set when no filters are provided (matching sifa-web's\n * \"no input, no fetch\" behavior).\n */\nexport async function fetchSearchProfiles(\n config: SifaApiConfig,\n filters: SearchFilters,\n options: ApiFetchOptions = {},\n): Promise<SearchResponse> {\n const params = new URLSearchParams();\n if (filters.q) params.set('q', filters.q);\n if (filters.skill) params.set('skill', filters.skill);\n if (filters.country) params.set('country', filters.country);\n if (filters.industry) params.set('industry', filters.industry);\n if (filters.domain) params.set('domain', filters.domain);\n if (filters.workplace) params.set('workplace', filters.workplace);\n if (filters.app) params.set('app', filters.app);\n if (filters.limit !== undefined) params.set('limit', String(filters.limit));\n\n if (params.size === 0) return EMPTY_SEARCH;\n\n return apiFetch<SearchResponse>(config, `/api/search/profiles?${params.toString()}`, {\n cache: 'no-store',\n ...options,\n });\n}\n\n/**\n * Skill typeahead. Returns up to 8 matches for the given prefix. Empty\n * input returns an empty array without hitting the server.\n */\nexport async function fetchSkillSuggestions(\n config: SifaApiConfig,\n query: string,\n options: ApiFetchOptions = {},\n): Promise<SkillSearchResult[]> {\n if (!query.trim()) return [];\n const path = `/api/search/skills?q=${encodeURIComponent(query)}&limit=8`;\n const data = await apiFetch<{ skills?: SkillSearchResult[] }>(config, path, {\n cache: 'no-store',\n ...options,\n });\n return data.skills ?? [];\n}\n\n/** Available filter facets (countries, industries, apps) for search UI. */\nexport async function fetchSearchFilters(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<FilterOptions> {\n try {\n return await apiFetch<FilterOptions>(config, '/api/search/filters', {\n next: { revalidate: 300 },\n ...options,\n });\n } catch {\n return EMPTY_FILTERS;\n }\n}\n\n/**\n * Canonical-skill search backing the position-editor and similar\n * skill-pickers. Hits `/api/skills/search` (the canonical-skills DB\n * lookup) which is distinct from {@link fetchSkillSuggestions}'s\n * `/api/search/skills` (the profile-skill typeahead).\n *\n * Returns `[]` on empty input (no network call) or any error.\n */\nexport async function searchSkills(\n config: SifaApiConfig,\n query: string,\n limit = 10,\n options: ApiFetchOptions = {},\n): Promise<SkillSuggestion[]> {\n if (!query.trim()) return [];\n const path = `/api/skills/search?q=${encodeURIComponent(query)}&limit=${limit}`;\n try {\n const data = await apiFetch<{ skills?: SkillSuggestion[] }>(config, path, {\n cache: 'no-store',\n ...options,\n });\n return data.skills ?? [];\n } catch {\n return [];\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** Lightweight profile representation used by discovery endpoints. */\nexport interface SimilarProfile {\n did: string;\n handle: string;\n displayName?: string | null;\n avatar?: string | null;\n headline?: string | null;\n currentRole?: string | null;\n currentCompany?: string | null;\n industry?: string | null;\n domain?: string | null;\n}\n\nexport interface SuggestionProfile {\n did: string;\n handle: string;\n displayName?: string;\n headline?: string;\n avatarUrl?: string;\n source: string;\n dismissed: boolean;\n blueskyVerified?: boolean;\n}\n\nexport interface SuggestionsResponse {\n onSifa: SuggestionProfile[];\n notOnSifa: SuggestionProfile[];\n cursor?: string;\n}\n\nexport interface FeaturedProfile {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n pronouns?: string;\n headline?: string;\n about?: string;\n currentRole?: string;\n currentCompany?: string;\n locationCountry?: string;\n locationRegion?: string;\n /** Legacy alias for `locationLocality`; emitted by sifa-api during the additive response window. */\n locationCity?: string;\n /** community.lexicon.location.address field name -- prefer over `locationCity`. */\n locationLocality?: string;\n countryCode?: string;\n location?: string;\n website?: string;\n openTo?: string[];\n preferredWorkplace?: string[];\n availableFromUtc?: number;\n availableToUtc?: number;\n followersCount?: number;\n atprotoFollowersCount?: number;\n pdsProvider?: { name: string; host: string } | null;\n claimed: boolean;\n featuredDate: string;\n}\n\n/** Profiles similar to the given DID (matchmaking). Returns `[]` on error. */\nexport async function fetchSimilarProfiles(\n config: SifaApiConfig,\n did: string,\n opts: { limit?: number } & ApiFetchOptions = {},\n): Promise<SimilarProfile[]> {\n const limit = opts.limit ?? 5;\n const path = `/api/discover/similar/${encodeURIComponent(did)}?limit=${limit}`;\n try {\n const data = await apiFetch<{ profiles?: SimilarProfile[] }>(config, path, {\n next: { revalidate: 300 },\n timeoutMs: 5000,\n ...opts,\n });\n return data.profiles ?? [];\n } catch {\n return [];\n }\n}\n\nexport interface FetchSuggestionsOptions extends ApiFetchOptions {\n source?: string;\n includeDismissed?: boolean;\n cursor?: string;\n limit?: number;\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * `credentials: 'include'` does NOT propagate browser cookies in RSC,\n * so authenticated server fetches must forward the header explicitly.\n */\n cookieHeader?: string;\n}\n\n/** Discovery suggestions feed. Resolves to empty arrays on error. */\nexport async function fetchSuggestions(\n config: SifaApiConfig,\n opts: FetchSuggestionsOptions = {},\n): Promise<SuggestionsResponse> {\n const params = new URLSearchParams();\n if (opts.source) params.set('source', opts.source);\n if (opts.includeDismissed) params.set('include_dismissed', 'true');\n if (opts.cursor) params.set('cursor', opts.cursor);\n if (opts.limit) params.set('limit', String(opts.limit));\n\n const qs = params.toString();\n const headers: Record<string, string> = { ...(opts.headers ?? {}) };\n if (opts.cookieHeader) headers.cookie = opts.cookieHeader;\n\n try {\n return await apiFetch<SuggestionsResponse>(config, `/api/suggestions${qs ? `?${qs}` : ''}`, {\n credentials: 'include',\n cache: 'no-store',\n timeoutMs: 8000,\n ...opts,\n headers,\n });\n } catch {\n return { onSifa: [], notOnSifa: [] };\n }\n}\n\n/** Count of pending suggestions since an optional timestamp. */\nexport async function fetchSuggestionCount(\n config: SifaApiConfig,\n since?: string,\n options: ApiFetchOptions = {},\n): Promise<number> {\n const params = since ? `?since=${encodeURIComponent(since)}` : '';\n try {\n const data = await apiFetch<{ count?: number }>(config, `/api/suggestions/count${params}`, {\n credentials: 'include',\n cache: 'no-store',\n ...options,\n });\n return data.count ?? 0;\n } catch {\n return 0;\n }\n}\n\n/** Featured profile (rotated by sifa-api). Returns `null` when none. */\nexport async function fetchFeaturedProfile(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<FeaturedProfile | null> {\n try {\n return await apiFetch<FeaturedProfile>(config, '/api/featured-profile', {\n next: { revalidate: 900 },\n ...options,\n });\n } catch {\n return null;\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\nexport interface FollowProfile {\n did: string;\n handle: string;\n displayName?: string;\n headline?: string;\n avatarUrl?: string;\n source: string;\n claimed: boolean;\n followedAt: string;\n blueskyVerified?: boolean;\n blueskyVerifiedAt?: string | null;\n}\n\nexport interface FollowingResponse {\n follows: FollowProfile[];\n cursor?: string;\n}\n\n/** People the authenticated user follows. Empty on error. */\nexport async function fetchFollowing(\n config: SifaApiConfig,\n opts: { source?: string; cursor?: string; limit?: number } & ApiFetchOptions = {},\n): Promise<FollowingResponse> {\n const params = new URLSearchParams();\n if (opts.source) params.set('source', opts.source);\n if (opts.cursor) params.set('cursor', opts.cursor);\n if (opts.limit) params.set('limit', String(opts.limit));\n const qs = params.toString();\n\n try {\n return await apiFetch<FollowingResponse>(config, `/api/following${qs ? `?${qs}` : ''}`, {\n credentials: 'include',\n cache: 'no-store',\n ...opts,\n });\n } catch {\n return { follows: [] };\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\nimport type { QuotedPostResult } from './quoted-posts.js';\n\nexport interface HeatmapDay {\n date: string;\n total: number;\n apps: { appId: string; count: number }[];\n}\n\nexport interface HeatmapResponse {\n days: HeatmapDay[];\n appTotals: { appId: string; appName: string; total: number }[];\n thresholds: [number, number, number, number];\n}\n\nexport interface ActivityItem {\n uri: string;\n cid: string;\n collection: string;\n rkey: string;\n record: Record<string, unknown>;\n appId: string;\n appName: string;\n category: string;\n indexedAt: string;\n /**\n * Set by the server when an `app.bsky.embed.record` quote was already\n * resolved upstream (AppView path). Mutually exclusive with `quotedPostUri`.\n */\n quotedPost?: QuotedPostResult;\n /**\n * Set by the server when an `app.bsky.embed.record` quote needs client-side\n * resolution (PDS path). Pass batches to {@link resolveQuotedPosts}.\n * Mutually exclusive with `quotedPost`.\n */\n quotedPostUri?: string;\n}\n\nexport interface ActivityTeaserResponse {\n items: ActivityItem[];\n blueskyGated?: boolean;\n backfillPending?: boolean;\n failedApps?: string[];\n}\n\nexport interface ActivityFeedResponse {\n items: ActivityItem[];\n cursor: string | null;\n hasMore: boolean;\n availableCategories?: string[];\n blueskyGated?: boolean;\n failedApps?: string[];\n}\n\n/**\n * Per-day activity counts for a profile across all ATproto apps. Returns\n * `null` on any error so callers can render a graceful empty state.\n */\nexport async function fetchHeatmapData(\n config: SifaApiConfig,\n handleOrDid: string,\n days: number,\n options: ApiFetchOptions = {},\n): Promise<HeatmapResponse | null> {\n const path = `/api/activity/${encodeURIComponent(handleOrDid)}/heatmap?days=${days}`;\n try {\n return await apiFetch<HeatmapResponse>(config, path, {\n next: { revalidate: 900, tags: [`heatmap-${handleOrDid}`] },\n ...options,\n });\n } catch {\n return null;\n }\n}\n\nexport interface FetchActivityTeaserOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * Required for authenticated server fetches because `credentials: 'include'`\n * does not propagate browser cookies in RSC.\n */\n cookieHeader?: string;\n}\n\n/**\n * Recent activity teaser for a profile (homepage-sized slice). Caps the\n * upstream wait so the SSR path cannot hang. Returns `null` on any error.\n */\nexport async function fetchActivityTeaser(\n config: SifaApiConfig,\n handleOrDid: string,\n options: FetchActivityTeaserOptions = {},\n): Promise<ActivityTeaserResponse | null> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n return await apiFetch<ActivityTeaserResponse>(\n config,\n `/api/activity/${encodeURIComponent(handleOrDid)}/teaser`,\n {\n credentials: 'include',\n timeoutMs: 8000,\n next: { revalidate: 300, tags: [`activity-teaser-${handleOrDid}`] },\n ...options,\n headers,\n },\n );\n } catch {\n return null;\n }\n}\n\nexport interface FetchActivityFeedOptions extends ApiFetchOptions {\n category?: string;\n limit?: number;\n cursor?: string;\n cookieHeader?: string;\n}\n\n/**\n * Paginated activity feed for a profile. Always fresh (`cache: 'no-store'`).\n * Returns `null` on any error.\n */\nexport async function fetchActivityFeed(\n config: SifaApiConfig,\n handleOrDid: string,\n options: FetchActivityFeedOptions = {},\n): Promise<ActivityFeedResponse | null> {\n const params = new URLSearchParams();\n if (options.category) params.set('category', options.category);\n if (options.limit) params.set('limit', String(options.limit));\n if (options.cursor) params.set('cursor', options.cursor);\n const qs = params.toString();\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n return await apiFetch<ActivityFeedResponse>(\n config,\n `/api/activity/${encodeURIComponent(handleOrDid)}${qs ? `?${qs}` : ''}`,\n {\n credentials: 'include',\n cache: 'no-store',\n ...options,\n headers,\n },\n );\n } catch {\n return null;\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/**\n * Counts confirmed endorsements received by a DID. The backend's\n * `GET /api/endorsement/:did` already returns only confirmed endorsements\n * (via inner join with `endorsementConfirmations`), so this helper just\n * returns the array length. Failures return 0 so callers can route safely.\n *\n * Public endpoint -- no credentials needed.\n */\nexport async function fetchEndorsementCount(\n config: SifaApiConfig,\n did: string,\n options: ApiFetchOptions = {},\n): Promise<number> {\n const path = `/api/endorsement/${encodeURIComponent(did)}`;\n try {\n const data = await apiFetch<unknown>(config, path, {\n cache: 'no-store',\n timeoutMs: 5000,\n ...options,\n });\n if (typeof data !== 'object' || data === null || !('endorsements' in data)) {\n return 0;\n }\n const endorsements = data.endorsements;\n return Array.isArray(endorsements) ? endorsements.length : 0;\n } catch {\n return 0;\n }\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\nexport interface FetchNetworkStreamCountOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * Required for authenticated server fetches because `credentials: 'include'`\n * does not propagate browser cookies in RSC.\n *\n * When omitted, the request falls back to `credentials: 'include'` so\n * client-side calls work without extra plumbing.\n */\n cookieHeader?: string;\n}\n\n/**\n * Counts items in the authenticated user's network stream digest. The\n * underlying `GET /api/stream/network` endpoint may 404 while the feature\n * is in development; in that case (and on any other error) this returns\n * 0 so callers can route safely to a fallback experience.\n */\nexport async function fetchNetworkStreamCount(\n config: SifaApiConfig,\n did: string,\n options: FetchNetworkStreamCountOptions = {},\n): Promise<number> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n const data = await apiFetch<unknown>(\n config,\n `/api/stream/network?did=${encodeURIComponent(did)}`,\n {\n cache: 'no-store',\n timeoutMs: 5000,\n ...(options.cookieHeader ? {} : { credentials: 'include' }),\n ...options,\n headers,\n },\n );\n if (typeof data !== 'object' || data === null || !('items' in data)) {\n return 0;\n }\n const items = data.items;\n return Array.isArray(items) ? items.length : 0;\n } catch {\n return 0;\n }\n}\n","import {\n apiFetch,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/** Per-URI reaction state for the authenticated viewer. */\nexport interface ReactionStatus {\n reacted: boolean;\n rkey?: string;\n collection?: string;\n}\n\n/** Result of checking whether the authenticated viewer has an account on a given app. */\nexport interface AccountCheckResult {\n hasAccount: boolean;\n appName: string;\n appUrl: string;\n}\n\nexport interface FetchReactionStatusOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * Required for authenticated server fetches because `credentials: 'include'`\n * does not propagate browser cookies in RSC.\n */\n cookieHeader?: string;\n}\n\n/**\n * Batch-look up reaction status for multiple URIs. Returns `{}` for an\n * empty input list (no network call) and `null` on any error.\n */\nexport async function fetchReactionStatus(\n config: SifaApiConfig,\n uris: string[],\n options: FetchReactionStatusOptions = {},\n): Promise<Record<string, ReactionStatus> | null> {\n if (uris.length === 0) return {};\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n return await apiFetch<Record<string, ReactionStatus>>(\n config,\n `/api/reactions/status?uris=${encodeURIComponent(uris.join(','))}`,\n {\n credentials: 'include',\n ...options,\n headers,\n },\n );\n } catch {\n return null;\n }\n}\n\nexport interface CheckAppAccountOptions extends ApiFetchOptions {\n cookieHeader?: string;\n}\n\n/**\n * Check whether the authenticated viewer has an account on a given app.\n * Returns `null` on any error.\n */\nexport async function checkAppAccount(\n config: SifaApiConfig,\n appId: string,\n options: CheckAppAccountOptions = {},\n): Promise<AccountCheckResult | null> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n return await apiFetch<AccountCheckResult>(\n config,\n `/api/reactions/account-check/${encodeURIComponent(appId)}`,\n {\n credentials: 'include',\n ...options,\n headers,\n },\n );\n } catch {\n return null;\n }\n}\n\n/** Result of a successful {@link createReaction}. */\nexport interface ReactionResult {\n uri: string;\n rkey: string;\n}\n\n/** Structured error returned by {@link createReaction} on failure. */\nexport interface ReactionError {\n type: 'scope_insufficient' | 'error';\n /** When `type === 'scope_insufficient'`, the lexicon scope the user must re-authorize for. */\n requiredScope?: string;\n}\n\n/**\n * Create a reaction (like / star) on a target ATproto record.\n *\n * Returns a discriminated-union result instead of the generic\n * {@link WriteResult} shape because reactions have a distinct\n * \"scope insufficient\" failure that callers handle differently from\n * other errors (it triggers an OAuth scope-upgrade flow rather than\n * an error toast).\n *\n * Never throws.\n */\nexport async function createReaction(\n config: SifaApiConfig,\n targetUri: string,\n appId: string,\n targetCid?: string,\n options: ApiFetchOptions = {},\n): Promise<{ ok: true; data: ReactionResult } | { ok: false; error: ReactionError }> {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const url = `${config.baseUrl}/api/reactions`;\n\n try {\n const res = await fetchFn(url, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...(options.headers ?? {}) },\n credentials: options.credentials ?? 'include',\n body: JSON.stringify({ targetUri, appId, targetCid }),\n signal: options.signal ?? AbortSignal.timeout(options.timeoutMs ?? 10_000),\n });\n\n if (!res.ok) {\n if (res.status === 403) {\n try {\n const body = (await res.json()) as { error?: string; requiredScope?: string };\n if (body.error === 'ScopeInsufficient') {\n return {\n ok: false,\n error: { type: 'scope_insufficient', requiredScope: body.requiredScope },\n };\n }\n } catch {\n // Fall through to generic error\n }\n }\n return { ok: false, error: { type: 'error' } };\n }\n\n const data = (await res.json()) as ReactionResult;\n return { ok: true, data };\n } catch {\n return { ok: false, error: { type: 'error' } };\n }\n}\n\n/**\n * Delete a reaction (like / star) on a target ATproto record. Returns\n * `{ success: true }` on 2xx, `{ success: false, error }` on failure.\n */\nexport function deleteReaction(\n config: SifaApiConfig,\n targetUri: string,\n appId: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/reactions', 'DELETE', {\n body: { targetUri, appId },\n ...options,\n });\n}\n","import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\nexport interface QuotedPostAuthor {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n}\n\nexport interface QuotedPostImage {\n thumb: string;\n fullsize: string;\n alt?: string;\n}\n\nexport interface QuotedPostView {\n uri: string;\n cid: string;\n author: QuotedPostAuthor;\n text: string;\n createdAt: string;\n images?: QuotedPostImage[];\n}\n\nexport type QuotedPostResult =\n | { status: 'ok'; record: QuotedPostView }\n | { status: 'deleted'; uri: string }\n | { status: 'unavailable'; uri: string };\n\n/** Max URIs per request to `POST /api/quoted-posts/resolve` (mirrors server cap). */\nexport const QUOTED_POSTS_BATCH_MAX = 20;\n\nexport interface ResolveQuotedPostsOptions extends ApiFetchOptions {\n /** Cookie header for Next.js RSC server-side calls; ignored in browsers. */\n cookieHeader?: string;\n}\n\n/**\n * Resolve a batch of AT-URIs to their quoted-post snapshots via the Sifa AppView.\n *\n * Auto-deduplicates input URIs and splits requests into chunks of\n * {@link QUOTED_POSTS_BATCH_MAX} so callers can pass an arbitrary-length array.\n * Each chunk is fired in parallel. The server caches results in Valkey, so\n * repeated calls for the same URI are cheap.\n *\n * Returns a map of `uri -> QuotedPostResult`. URIs that fail (network error,\n * non-2xx, or the server omitting them) are absent from the map; the caller\n * should render a skeleton or tombstone for those.\n */\nexport async function resolveQuotedPosts(\n config: SifaApiConfig,\n uris: string[],\n options: ResolveQuotedPostsOptions = {},\n): Promise<Record<string, QuotedPostResult>> {\n if (uris.length === 0) return {};\n\n const unique = [...new Set(uris)];\n const batches: string[][] = [];\n for (let i = 0; i < unique.length; i += QUOTED_POSTS_BATCH_MAX) {\n batches.push(unique.slice(i, i + QUOTED_POSTS_BATCH_MAX));\n }\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n const results: Record<string, QuotedPostResult> = {};\n await Promise.all(\n batches.map(async (batch) => {\n try {\n const data = await apiFetch<Record<string, QuotedPostResult>>(\n config,\n '/api/quoted-posts/resolve',\n {\n method: 'POST',\n body: { uris: batch },\n credentials: 'include',\n timeoutMs: 8000,\n ...options,\n headers,\n },\n );\n Object.assign(results, data);\n } catch {\n // Leave failed URIs absent so the consumer can render a fallback.\n }\n }),\n );\n\n return results;\n}\n","import {\n apiFetch,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/** Voter on a roadmap item. */\nexport interface RoadmapVoter {\n did: string;\n avatarUrl?: string;\n}\n\n/** Map of item key -> vote tally and voter list. */\nexport type RoadmapVotesResponse = Record<string, { count: number; voters: RoadmapVoter[] }>;\n\n/**\n * Public roadmap vote tallies, keyed by item. Returns `{}` on any error.\n */\nexport async function fetchRoadmapVotes(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<RoadmapVotesResponse> {\n try {\n return await apiFetch<RoadmapVotesResponse>(config, '/api/roadmap/votes', {\n cache: 'no-store',\n ...options,\n });\n } catch {\n return {};\n }\n}\n\nexport interface FetchMyRoadmapVotesOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * Required for authenticated server fetches because `credentials: 'include'`\n * does not propagate browser cookies in RSC.\n */\n cookieHeader?: string;\n}\n\n/**\n * Roadmap items the authenticated user has voted on. Returns `[]` on any\n * error or when the response payload is shaped unexpectedly.\n */\nexport async function fetchMyRoadmapVotes(\n config: SifaApiConfig,\n options: FetchMyRoadmapVotesOptions = {},\n): Promise<string[]> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n const data = await apiFetch<{ voted?: string[] }>(config, '/api/roadmap/votes/me', {\n credentials: 'include',\n ...options,\n headers,\n });\n return data.voted ?? [];\n } catch {\n return [];\n }\n}\n\n/** Cast a vote on a roadmap item by its key. */\nexport function castRoadmapVote(\n config: SifaApiConfig,\n key: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/roadmap/votes/${encodeURIComponent(key)}`, 'POST', options);\n}\n\n/** Retract a previously-cast roadmap vote. */\nexport function retractRoadmapVote(\n config: SifaApiConfig,\n key: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/roadmap/votes/${encodeURIComponent(key)}`, 'DELETE', options);\n}\n","import { apiWrite, type ApiFetchOptions, type SifaApiConfig, type WriteResult } from '../client.js';\n\n/** Extended write result for {@link deleteAccount}. */\nexport interface DeleteAccountResult extends WriteResult {\n /** The deleted handle, returned by the server for confirmation UIs. */\n handle?: string;\n}\n\n/**\n * Reset the authenticated user's Sifa profile.\n *\n * `deletePdsData: true` also deletes the corresponding records on the\n * user's PDS. `deletePdsData: false` only removes the AppView's\n * indexed state -- the records on the PDS are left intact and could be\n * re-indexed later.\n *\n * Destructive. Server enforces session check + attestation; the SDK\n * does not gate on additional confirmation. Wrap call sites in your\n * own modal if you want a UX confirmation step.\n */\nexport function resetProfile(\n config: SifaApiConfig,\n deletePdsData: boolean,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/reset', 'DELETE', {\n body: { deletePdsData },\n ...options,\n });\n}\n\n/**\n * Delete the authenticated user's account. Returns the deleted handle\n * on success (used by the post-delete confirmation screen).\n *\n * `deletePdsData: true` also deletes the corresponding records on the\n * user's PDS; `false` leaves the PDS records intact.\n *\n * Destructive. Same caveat as {@link resetProfile}.\n */\nexport function deleteAccount(\n config: SifaApiConfig,\n deletePdsData: boolean,\n options: ApiFetchOptions = {},\n): Promise<DeleteAccountResult> {\n return apiWrite<{ ok?: boolean; handle?: string }>(config, '/api/profile/account', 'DELETE', {\n body: { deletePdsData },\n ...options,\n });\n}\n","/**\n * Query key factory for TanStack Query.\n *\n * Keys are read-only tuples; the hierarchy matches the SDK's fetcher\n * grouping. Use these instead of inline arrays so consumers can target\n * `queryClient.invalidateQueries({ queryKey: keys.profile.all() })` and\n * similar patterns without typos.\n *\n * Convention: every leaf key starts with the namespace ('sifa') so\n * consumers can invalidate everything Sifa-related in one call.\n */\nexport const sifaQueryKeys = {\n all: () => ['sifa'] as const,\n\n profile: {\n all: () => ['sifa', 'profile'] as const,\n byHandle: (handleOrDid: string) => ['sifa', 'profile', handleOrDid] as const,\n atFundLink: (did: string) => ['sifa', 'profile', 'at-fund-link', did] as const,\n externalAccounts: (handleOrDid: string) =>\n ['sifa', 'profile', 'external-accounts', handleOrDid] as const,\n },\n\n position: {\n all: () => ['sifa', 'position'] as const,\n byOwner: (did: string) => ['sifa', 'position', 'by-owner', did] as const,\n },\n\n search: {\n all: () => ['sifa', 'search'] as const,\n profiles: (filters: Record<string, unknown>) =>\n ['sifa', 'search', 'profiles', filters] as const,\n skills: (query: string) => ['sifa', 'search', 'skills', query] as const,\n canonicalSkills: (query: string, limit: number) =>\n ['sifa', 'search', 'canonical-skills', query, limit] as const,\n filters: () => ['sifa', 'search', 'filters'] as const,\n },\n\n discovery: {\n all: () => ['sifa', 'discovery'] as const,\n similar: (did: string, limit: number) => ['sifa', 'discovery', 'similar', did, limit] as const,\n suggestions: (opts: Record<string, unknown>) =>\n ['sifa', 'discovery', 'suggestions', opts] as const,\n suggestionCount: (since: string | undefined) =>\n ['sifa', 'discovery', 'suggestion-count', since ?? null] as const,\n featured: () => ['sifa', 'discovery', 'featured'] as const,\n },\n\n follow: {\n all: () => ['sifa', 'follow'] as const,\n following: (opts: Record<string, unknown>) => ['sifa', 'follow', 'following', opts] as const,\n },\n\n stats: {\n all: () => ['sifa', 'stats'] as const,\n homepage: () => ['sifa', 'stats', 'homepage'] as const,\n },\n\n apps: {\n all: () => ['sifa', 'apps'] as const,\n registry: () => ['sifa', 'apps', 'registry'] as const,\n hidden: () => ['sifa', 'apps', 'hidden'] as const,\n },\n\n activity: {\n all: () => ['sifa', 'activity'] as const,\n heatmap: (handleOrDid: string, days: number) =>\n ['sifa', 'activity', 'heatmap', handleOrDid, days] as const,\n teaser: (handleOrDid: string) => ['sifa', 'activity', 'teaser', handleOrDid] as const,\n feed: (handleOrDid: string, opts: Record<string, unknown>) =>\n ['sifa', 'activity', 'feed', handleOrDid, opts] as const,\n },\n\n endorsement: {\n all: () => ['sifa', 'endorsement'] as const,\n count: (did: string) => ['sifa', 'endorsement', 'count', did] as const,\n },\n\n stream: {\n all: () => ['sifa', 'stream'] as const,\n networkCount: (did: string) => ['sifa', 'stream', 'network-count', did] as const,\n },\n\n reactions: {\n all: () => ['sifa', 'reactions'] as const,\n status: (uris: string[]) => ['sifa', 'reactions', 'status', uris] as const,\n accountCheck: (appId: string) => ['sifa', 'reactions', 'account-check', appId] as const,\n },\n\n roadmap: {\n all: () => ['sifa', 'roadmap'] as const,\n votes: () => ['sifa', 'roadmap', 'votes'] as const,\n myVotes: () => ['sifa', 'roadmap', 'my-votes'] as const,\n },\n} as const;\n\nexport type SifaQueryKey =\n | ReturnType<typeof sifaQueryKeys.all>\n | ReturnType<typeof sifaQueryKeys.profile.all>\n | ReturnType<typeof sifaQueryKeys.profile.byHandle>\n | ReturnType<typeof sifaQueryKeys.profile.atFundLink>\n | ReturnType<typeof sifaQueryKeys.profile.externalAccounts>\n | ReturnType<typeof sifaQueryKeys.position.all>\n | ReturnType<typeof sifaQueryKeys.position.byOwner>\n | ReturnType<typeof sifaQueryKeys.search.all>\n | ReturnType<typeof sifaQueryKeys.search.profiles>\n | ReturnType<typeof sifaQueryKeys.search.canonicalSkills>\n | ReturnType<typeof sifaQueryKeys.search.skills>\n | ReturnType<typeof sifaQueryKeys.search.filters>\n | ReturnType<typeof sifaQueryKeys.discovery.all>\n | ReturnType<typeof sifaQueryKeys.discovery.similar>\n | ReturnType<typeof sifaQueryKeys.discovery.suggestions>\n | ReturnType<typeof sifaQueryKeys.discovery.suggestionCount>\n | ReturnType<typeof sifaQueryKeys.discovery.featured>\n | ReturnType<typeof sifaQueryKeys.follow.all>\n | ReturnType<typeof sifaQueryKeys.follow.following>\n | ReturnType<typeof sifaQueryKeys.stats.all>\n | ReturnType<typeof sifaQueryKeys.stats.homepage>\n | ReturnType<typeof sifaQueryKeys.apps.all>\n | ReturnType<typeof sifaQueryKeys.apps.registry>\n | ReturnType<typeof sifaQueryKeys.apps.hidden>\n | ReturnType<typeof sifaQueryKeys.activity.all>\n | ReturnType<typeof sifaQueryKeys.activity.heatmap>\n | ReturnType<typeof sifaQueryKeys.activity.teaser>\n | ReturnType<typeof sifaQueryKeys.activity.feed>\n | ReturnType<typeof sifaQueryKeys.endorsement.all>\n | ReturnType<typeof sifaQueryKeys.endorsement.count>\n | ReturnType<typeof sifaQueryKeys.stream.all>\n | ReturnType<typeof sifaQueryKeys.stream.networkCount>\n | ReturnType<typeof sifaQueryKeys.reactions.all>\n | ReturnType<typeof sifaQueryKeys.reactions.status>\n | ReturnType<typeof sifaQueryKeys.reactions.accountCheck>\n | ReturnType<typeof sifaQueryKeys.roadmap.all>\n | ReturnType<typeof sifaQueryKeys.roadmap.votes>\n | ReturnType<typeof sifaQueryKeys.roadmap.myVotes>;\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport type { Profile } from '../../types/index.js';\nimport { useSifaConfig } from '../config.js';\nimport { fetchAtFundLink, fetchProfile } from '../fetchers/profile.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * React hook that reads an aggregated profile by handle or DID via\n * TanStack Query. Returns `null` data when the profile does not exist.\n *\n * Pass `{ enabled: false }` (or an empty `handleOrDid`) to defer the\n * fetch.\n */\nexport function useProfile(\n handleOrDid: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n Profile | null,\n Error,\n Profile | null,\n ReturnType<typeof sifaQueryKeys.profile.byHandle>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.profile.byHandle(handleOrDid ?? ''),\n queryFn: () => fetchProfile(config, handleOrDid ?? ''),\n enabled: Boolean(handleOrDid) && (options?.enabled ?? true),\n ...options,\n });\n}\n\n/**\n * React hook for a profile's AT Fund link. Returns `null` data on error\n * or when the profile has no link configured.\n */\nexport function useAtFundLink(\n did: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n string | null,\n Error,\n string | null,\n ReturnType<typeof sifaQueryKeys.profile.atFundLink>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.profile.atFundLink(did ?? ''),\n queryFn: () => fetchAtFundLink(config, did ?? ''),\n enabled: Boolean(did) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { type WriteResult } from '../client.js';\nimport {\n deleteAvatarOverride,\n refreshPds,\n updateProfileOverride,\n updateProfileSelf,\n uploadAvatar,\n type RefreshPdsResult,\n type UpdateProfileOverrideInput,\n type UpdateProfileSelfInput,\n type UploadAvatarResult,\n} from '../fetchers/profile-mutations.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Invalidate the owner's profile cache after a profile-edit mutation\n * succeeds. Shared helper for the hooks in this file -- the owner DID\n * (or handle) is required so the mutation can target the correct cache\n * entry.\n */\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\n/**\n * React hook for updating the authenticated user's profile self record.\n * On success, invalidates the owner's profile cache.\n *\n * The owner identifier (handle or DID) is required so the mutation can\n * target the right profile cache entry for invalidation.\n */\nexport function useUpdateProfileSelf(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, UpdateProfileSelfInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (data: UpdateProfileSelfInput) => updateProfileSelf(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** React hook for updating the authenticated user's profile override fields. */\nexport function useUpdateProfileOverride(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, UpdateProfileOverrideInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (data: UpdateProfileOverrideInput) => updateProfileOverride(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** React hook for re-pulling the authenticated user's PDS-side profile. */\nexport function useRefreshPds(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<RefreshPdsResult, Error, void>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: () => refreshPds(config),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/**\n * React hook for uploading a new avatar. Pass a `File` (browser) or\n * `Blob` (Expo) as the mutation variable.\n */\nexport function useUploadAvatar(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<UploadAvatarResult, Error, Blob>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (file: Blob) => uploadAvatar(config, file),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** React hook for deleting the avatar override (revert to PDS avatar). */\nexport function useDeleteAvatarOverride(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, void>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: () => deleteAvatarOverride(config),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { createPosition, type CreateResult } from '../fetchers/positions.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * React hook for creating a new position record. On success, invalidates\n * the owner's profile cache so the new position is reflected on the next\n * read.\n *\n * The owner DID is required so the mutation can target the correct\n * profile cache entry for invalidation.\n */\nexport function useCreatePosition(\n ownerDid: string,\n options?: Omit<UseMutationOptions<CreateResult, Error, Record<string, unknown>>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: (data: Record<string, unknown>) => createPosition(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.profile.byHandle(ownerDid) });\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.position.byOwner(ownerDid) });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n deletePosition,\n linkSkillToPosition,\n setPositionPrimary,\n unlinkSkillFromPosition,\n unsetPositionPrimary,\n updatePosition,\n} from '../fetchers/positions.js';\nimport { sifaQueryKeys } from '../keys.js';\nimport type { ProfilePosition, SkillRef } from '../../types/index.js';\n\nasync function invalidatePositionCaches(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.position.byOwner(ownerHandleOrDid),\n });\n}\n\n/** Variables for {@link useUpdatePosition}. */\nexport interface UpdatePositionVariables {\n rkey: string;\n data: Record<string, unknown>;\n}\n\n/** React hook for updating a position record. */\nexport function useUpdatePosition(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, UpdatePositionVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ rkey, data }: UpdatePositionVariables) => updatePosition(config, rkey, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidatePositionCaches(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** React hook for deleting a position record. Variable: the `rkey` string. */\nexport function useDeletePosition(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (rkey: string) => deletePosition(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidatePositionCaches(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** React hook for marking a position as primary. Variable: the `rkey` string. */\nexport function useSetPositionPrimary(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (rkey: string) => setPositionPrimary(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidatePositionCaches(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** React hook for clearing the primary flag on a position. */\nexport function useUnsetPositionPrimary(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (rkey: string) => unsetPositionPrimary(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidatePositionCaches(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** Variables for {@link useLinkSkillToPosition} / {@link useUnlinkSkillFromPosition}. */\nexport interface PositionSkillLinkVariables {\n position: ProfilePosition;\n skillRef: SkillRef;\n}\n\n/** React hook for linking a skill to a position. Idempotent. */\nexport function useLinkSkillToPosition(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, PositionSkillLinkVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ position, skillRef }: PositionSkillLinkVariables) =>\n linkSkillToPosition(config, position, skillRef),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidatePositionCaches(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** React hook for unlinking a skill from a position. */\nexport function useUnlinkSkillFromPosition(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, PositionSkillLinkVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ position, skillRef }: PositionSkillLinkVariables) =>\n unlinkSkillFromPosition(config, position, skillRef),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidatePositionCaches(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type CreateResult, type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { createEducation, deleteEducation, updateEducation } from '../fetchers/education.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\n/** React hook for creating an education record. */\nexport function useCreateEducation(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<CreateResult, Error, Record<string, unknown>>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (data: Record<string, unknown>) => createEducation(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** Variables for {@link useUpdateEducation}. */\nexport interface UpdateEducationVariables {\n rkey: string;\n data: Record<string, unknown>;\n}\n\n/** React hook for updating an education record. */\nexport function useUpdateEducation(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, UpdateEducationVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ rkey, data }: UpdateEducationVariables) => updateEducation(config, rkey, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** React hook for deleting an education record. Variable: the `rkey` string. */\nexport function useDeleteEducation(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (rkey: string) => deleteEducation(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type CreateResult, type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { createSkill, deleteSkill, updateSkill } from '../fetchers/skills.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\n/** React hook for creating a skill record. */\nexport function useCreateSkill(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<CreateResult, Error, Record<string, unknown>>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (data: Record<string, unknown>) => createSkill(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** Variables for {@link useUpdateSkill}. */\nexport interface UpdateSkillVariables {\n rkey: string;\n data: Record<string, unknown>;\n}\n\n/** React hook for updating a skill record. */\nexport function useUpdateSkill(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, UpdateSkillVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ rkey, data }: UpdateSkillVariables) => updateSkill(config, rkey, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** React hook for deleting a skill record. Variable: the `rkey` string. */\nexport function useDeleteSkill(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (rkey: string) => deleteSkill(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type CreateResult, type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { createRecord, deleteRecord, updateRecord } from '../fetchers/records.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\n/** Variables for {@link useCreateRecord}. */\nexport interface CreateRecordVariables {\n collection: string;\n data: Record<string, unknown>;\n}\n\n/**\n * Generic record-create escape hatch for collections without a\n * dedicated section helper (certifications, projects, publications,\n * volunteering, honors, languages, courses). Prefer the typed helpers\n * when one exists for the section.\n */\nexport function useCreateRecord(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<CreateResult, Error, CreateRecordVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ collection, data }: CreateRecordVariables) =>\n createRecord(config, collection, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** Variables for {@link useUpdateRecord}. */\nexport interface UpdateRecordVariables {\n collection: string;\n rkey: string;\n data: Record<string, unknown>;\n}\n\n/** Generic record-update escape hatch. See {@link useCreateRecord}. */\nexport function useUpdateRecord(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, UpdateRecordVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ collection, rkey, data }: UpdateRecordVariables) =>\n updateRecord(config, collection, rkey, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** Variables for {@link useDeleteRecord}. */\nexport interface DeleteRecordVariables {\n collection: string;\n rkey: string;\n}\n\n/** Generic record-delete escape hatch. See {@link useCreateRecord}. */\nexport function useDeleteRecord(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, DeleteRecordVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ collection, rkey }: DeleteRecordVariables) =>\n deleteRecord(config, collection, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type CreateResult, type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n createProfileLocation,\n deleteProfileLocation,\n updateProfileLocation,\n type ProfileLocationInput,\n} from '../fetchers/profile-locations.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\n/** React hook for creating a profile location record. */\nexport function useCreateProfileLocation(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<CreateResult, Error, ProfileLocationInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (data: ProfileLocationInput) => createProfileLocation(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** Variables for {@link useUpdateProfileLocation}. */\nexport interface UpdateProfileLocationVariables {\n rkey: string;\n data: ProfileLocationInput;\n}\n\n/** React hook for updating a profile location record. */\nexport function useUpdateProfileLocation(\n ownerHandleOrDid: string,\n options?: Omit<\n UseMutationOptions<WriteResult, Error, UpdateProfileLocationVariables>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ rkey, data }: UpdateProfileLocationVariables) =>\n updateProfileLocation(config, rkey, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** React hook for deleting a profile location record. Variable: the `rkey` string. */\nexport function useDeleteProfileLocation(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (rkey: string) => deleteProfileLocation(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n","'use client';\n\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationOptions,\n type UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport type { ExternalAccount } from '../../types/index.js';\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n createExternalAccount,\n deleteExternalAccount,\n fetchExternalAccounts,\n setExternalAccountPrimary,\n unsetExternalAccountPrimary,\n updateExternalAccount,\n verifyExternalAccount,\n type CreateExternalAccountResult,\n type ExternalAccountInput,\n type VerifyExternalAccountResult,\n} from '../fetchers/external-accounts.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfileAndExternalAccounts(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.externalAccounts(ownerHandleOrDid),\n });\n}\n\n/** React hook for reading the external-accounts list. Returns `[]` data on error. */\nexport function useExternalAccounts(\n handleOrDid: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n ExternalAccount[],\n Error,\n ExternalAccount[],\n ReturnType<typeof sifaQueryKeys.profile.externalAccounts>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.profile.externalAccounts(handleOrDid ?? ''),\n queryFn: () => fetchExternalAccounts(config, handleOrDid ?? ''),\n enabled: Boolean(handleOrDid) && (options?.enabled ?? true),\n ...options,\n });\n}\n\n/** React hook for creating an external account. */\nexport function useCreateExternalAccount(\n ownerHandleOrDid: string,\n options?: Omit<\n UseMutationOptions<CreateExternalAccountResult, Error, ExternalAccountInput>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (data: ExternalAccountInput) => createExternalAccount(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** Variables for {@link useUpdateExternalAccount}. */\nexport interface UpdateExternalAccountVariables {\n rkey: string;\n data: ExternalAccountInput;\n}\n\n/** React hook for updating an external account. */\nexport function useUpdateExternalAccount(\n ownerHandleOrDid: string,\n options?: Omit<\n UseMutationOptions<WriteResult, Error, UpdateExternalAccountVariables>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ rkey, data }: UpdateExternalAccountVariables) =>\n updateExternalAccount(config, rkey, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** React hook for deleting an external account. Variable: the `rkey` string. */\nexport function useDeleteExternalAccount(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (rkey: string) => deleteExternalAccount(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** React hook for marking an external account primary. */\nexport function useSetExternalAccountPrimary(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (rkey: string) => setExternalAccountPrimary(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** React hook for clearing the primary flag on an external account. */\nexport function useUnsetExternalAccountPrimary(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (rkey: string) => unsetExternalAccountPrimary(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** React hook for running server-side verification of an external account. */\nexport function useVerifyExternalAccount(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<VerifyExternalAccountResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (rkey: string) => verifyExternalAccount(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type CreateResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { createEndorsement, type EndorsementInput } from '../fetchers/endorsements.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * React hook for creating an endorsement of another user's skill. The\n * mutation needs the endorsed user's handle/DID (not the endorser's)\n * so the endorsed profile + their endorsement count caches get\n * invalidated; pass `null` to skip endorsed-profile invalidation\n * (e.g., if you only know the skill URI).\n */\nexport function useCreateEndorsement(\n endorsedHandleOrDid: string | null,\n options?: Omit<UseMutationOptions<CreateResult, Error, EndorsementInput>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (data: EndorsementInput) => createEndorsement(config, data),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success && endorsedHandleOrDid) {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(endorsedHandleOrDid),\n });\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.endorsement.count(endorsedHandleOrDid),\n });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { hideKeytraceClaim, unhideKeytraceClaim } from '../fetchers/keytrace-claims.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\n/** React hook for hiding a keytrace claim. Variable: the claim `rkey` string. */\nexport function useHideKeytraceClaim(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (rkey: string) => hideKeytraceClaim(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** React hook for unhiding a previously-hidden keytrace claim. */\nexport function useUnhideKeytraceClaim(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (rkey: string) => unhideKeytraceClaim(config, rkey),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n bulkHideStandardPublications,\n bulkUnhideStandardPublications,\n hideOrcidPublication,\n hideSifaPublication,\n hideStandardPublication,\n refreshOrcidPublications,\n unhideOrcidPublication,\n unhideSifaPublication,\n unhideStandardPublication,\n type RefreshOrcidPublicationsResult,\n} from '../fetchers/publications.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateProfile(\n queryClient: ReturnType<typeof useQueryClient>,\n ownerHandleOrDid: string,\n): Promise<void> {\n await queryClient.invalidateQueries({\n queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid),\n });\n}\n\nfunction makeWriteHook<TVariable>(\n fetcher: (config: ReturnType<typeof useSifaConfig>, v: TVariable) => Promise<WriteResult>,\n) {\n return function useHook(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<WriteResult, Error, TVariable>, 'mutationFn'>,\n ) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (v: TVariable) => fetcher(config, v),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n };\n}\n\n/** React hook for hiding an ORCID publication. Variable: the `putCode` number. */\nexport const useHideOrcidPublication = makeWriteHook<number>((config, putCode) =>\n hideOrcidPublication(config, putCode),\n);\n\n/** React hook for unhiding an ORCID publication. Variable: the `putCode` number. */\nexport const useUnhideOrcidPublication = makeWriteHook<number>((config, putCode) =>\n unhideOrcidPublication(config, putCode),\n);\n\n/** React hook for hiding a standard publication. Variable: the AT URI string. */\nexport const useHideStandardPublication = makeWriteHook<string>((config, uri) =>\n hideStandardPublication(config, uri),\n);\n\n/** React hook for unhiding a standard publication. Variable: the AT URI string. */\nexport const useUnhideStandardPublication = makeWriteHook<string>((config, uri) =>\n unhideStandardPublication(config, uri),\n);\n\n/** React hook for bulk-hiding standard publications. Variable: the URI list. */\nexport const useBulkHideStandardPublications = makeWriteHook<string[]>((config, uris) =>\n bulkHideStandardPublications(config, uris),\n);\n\n/** React hook for bulk-unhiding standard publications. Variable: the URI list. */\nexport const useBulkUnhideStandardPublications = makeWriteHook<string[]>((config, uris) =>\n bulkUnhideStandardPublications(config, uris),\n);\n\n/** React hook for hiding a Sifa-authored publication. Variable: the `rkey` string. */\nexport const useHideSifaPublication = makeWriteHook<string>((config, rkey) =>\n hideSifaPublication(config, rkey),\n);\n\n/** React hook for unhiding a Sifa-authored publication. Variable: the `rkey` string. */\nexport const useUnhideSifaPublication = makeWriteHook<string>((config, rkey) =>\n unhideSifaPublication(config, rkey),\n);\n\n/** React hook for re-pulling ORCID publications. */\nexport function useRefreshOrcidPublications(\n ownerHandleOrDid: string,\n options?: Omit<UseMutationOptions<RefreshOrcidPublicationsResult, Error, void>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: () => refreshOrcidPublications(config),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateProfile(queryClient, ownerHandleOrDid);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { fetchStats, type StatsResponse } from '../fetchers/stats.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * React hook for the public homepage stats. Returns `null` data on error.\n */\nexport function useStats(\n options?: Omit<\n UseQueryOptions<\n StatsResponse | null,\n Error,\n StatsResponse | null,\n ReturnType<typeof sifaQueryKeys.stats.homepage>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.stats.homepage(),\n queryFn: () => fetchStats(config),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchAppsRegistry,\n fetchHiddenApps,\n type AppRegistryEntry,\n type HiddenApp,\n} from '../fetchers/apps.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/** React hook for the public app registry. */\nexport function useAppsRegistry(\n options?: Omit<\n UseQueryOptions<\n AppRegistryEntry[],\n Error,\n AppRegistryEntry[],\n ReturnType<typeof sifaQueryKeys.apps.registry>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.apps.registry(),\n queryFn: () => fetchAppsRegistry(config),\n ...options,\n });\n}\n\n/**\n * React hook for the authenticated user's hidden-apps list. Requires a\n * client-side session (relies on `credentials: 'include'`).\n */\nexport function useHiddenApps(\n options?: Omit<\n UseQueryOptions<HiddenApp[], Error, HiddenApp[], ReturnType<typeof sifaQueryKeys.apps.hidden>>,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.apps.hidden(),\n queryFn: () => fetchHiddenApps(config),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport type { SkillSuggestion } from '../../types/index.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchSearchFilters,\n fetchSearchProfiles,\n fetchSkillSuggestions,\n searchSkills,\n type FilterOptions,\n type SearchFilters,\n type SearchResponse,\n type SkillSearchResult,\n} from '../fetchers/search.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nexport function useSearchProfiles(\n filters: SearchFilters,\n options?: Omit<\n UseQueryOptions<\n SearchResponse,\n Error,\n SearchResponse,\n ReturnType<typeof sifaQueryKeys.search.profiles>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.search.profiles(filters as Record<string, unknown>),\n queryFn: () => fetchSearchProfiles(config, filters),\n ...options,\n });\n}\n\nexport function useSkillSuggestions(\n query: string,\n options?: Omit<\n UseQueryOptions<\n SkillSearchResult[],\n Error,\n SkillSearchResult[],\n ReturnType<typeof sifaQueryKeys.search.skills>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.search.skills(query),\n queryFn: () => fetchSkillSuggestions(config, query),\n enabled: query.trim().length > 0 && (options?.enabled ?? true),\n ...options,\n });\n}\n\n/**\n * Canonical-skill search hook. Hits `/api/skills/search` (the\n * canonical-skills DB lookup, distinct from {@link useSkillSuggestions}'s\n * `/api/search/skills` profile-skill typeahead). Skips the network call\n * when the query is empty.\n */\nexport function useCanonicalSkillSearch(\n query: string,\n limit = 10,\n options?: Omit<\n UseQueryOptions<\n SkillSuggestion[],\n Error,\n SkillSuggestion[],\n ReturnType<typeof sifaQueryKeys.search.canonicalSkills>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.search.canonicalSkills(query, limit),\n queryFn: () => searchSkills(config, query, limit),\n enabled: query.trim().length > 0 && (options?.enabled ?? true),\n ...options,\n });\n}\n\nexport function useSearchFilters(\n options?: Omit<\n UseQueryOptions<\n FilterOptions,\n Error,\n FilterOptions,\n ReturnType<typeof sifaQueryKeys.search.filters>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.search.filters(),\n queryFn: () => fetchSearchFilters(config),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchFeaturedProfile,\n fetchSimilarProfiles,\n fetchSuggestionCount,\n fetchSuggestions,\n type FeaturedProfile,\n type FetchSuggestionsOptions,\n type SimilarProfile,\n type SuggestionsResponse,\n} from '../fetchers/discovery.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nexport function useSimilarProfiles(\n did: string | undefined | null,\n opts: { limit?: number } = {},\n options?: Omit<\n UseQueryOptions<\n SimilarProfile[],\n Error,\n SimilarProfile[],\n ReturnType<typeof sifaQueryKeys.discovery.similar>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n const limit = opts.limit ?? 5;\n return useQuery({\n queryKey: sifaQueryKeys.discovery.similar(did ?? '', limit),\n queryFn: () => fetchSimilarProfiles(config, did ?? '', { limit }),\n enabled: Boolean(did) && (options?.enabled ?? true),\n ...options,\n });\n}\n\nexport function useSuggestions(\n opts: Omit<\n FetchSuggestionsOptions,\n keyof Omit<FetchSuggestionsOptions, 'source' | 'includeDismissed' | 'cursor' | 'limit'>\n > = {},\n options?: Omit<\n UseQueryOptions<\n SuggestionsResponse,\n Error,\n SuggestionsResponse,\n ReturnType<typeof sifaQueryKeys.discovery.suggestions>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.discovery.suggestions(opts as Record<string, unknown>),\n queryFn: () => fetchSuggestions(config, opts),\n ...options,\n });\n}\n\nexport function useSuggestionCount(\n since?: string,\n options?: Omit<\n UseQueryOptions<\n number,\n Error,\n number,\n ReturnType<typeof sifaQueryKeys.discovery.suggestionCount>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.discovery.suggestionCount(since),\n queryFn: () => fetchSuggestionCount(config, since),\n ...options,\n });\n}\n\nexport function useFeaturedProfile(\n options?: Omit<\n UseQueryOptions<\n FeaturedProfile | null,\n Error,\n FeaturedProfile | null,\n ReturnType<typeof sifaQueryKeys.discovery.featured>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.discovery.featured(),\n queryFn: () => fetchFeaturedProfile(config),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { fetchFollowing, type FollowingResponse } from '../fetchers/follow.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nexport function useFollowing(\n opts: { source?: string; cursor?: string; limit?: number } = {},\n options?: Omit<\n UseQueryOptions<\n FollowingResponse,\n Error,\n FollowingResponse,\n ReturnType<typeof sifaQueryKeys.follow.following>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.follow.following(opts as Record<string, unknown>),\n queryFn: () => fetchFollowing(config, opts),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchActivityFeed,\n fetchActivityTeaser,\n fetchHeatmapData,\n type ActivityFeedResponse,\n type ActivityTeaserResponse,\n type FetchActivityFeedOptions,\n type HeatmapResponse,\n} from '../fetchers/activity.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nexport function useHeatmapData(\n handleOrDid: string | undefined | null,\n days: number,\n options?: Omit<\n UseQueryOptions<\n HeatmapResponse | null,\n Error,\n HeatmapResponse | null,\n ReturnType<typeof sifaQueryKeys.activity.heatmap>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.activity.heatmap(handleOrDid ?? '', days),\n queryFn: () => fetchHeatmapData(config, handleOrDid ?? '', days),\n enabled: Boolean(handleOrDid) && (options?.enabled ?? true),\n ...options,\n });\n}\n\nexport function useActivityTeaser(\n handleOrDid: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n ActivityTeaserResponse | null,\n Error,\n ActivityTeaserResponse | null,\n ReturnType<typeof sifaQueryKeys.activity.teaser>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.activity.teaser(handleOrDid ?? ''),\n queryFn: () => fetchActivityTeaser(config, handleOrDid ?? ''),\n enabled: Boolean(handleOrDid) && (options?.enabled ?? true),\n ...options,\n });\n}\n\nexport function useActivityFeed(\n handleOrDid: string | undefined | null,\n opts: Pick<FetchActivityFeedOptions, 'category' | 'limit' | 'cursor'> = {},\n options?: Omit<\n UseQueryOptions<\n ActivityFeedResponse | null,\n Error,\n ActivityFeedResponse | null,\n ReturnType<typeof sifaQueryKeys.activity.feed>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.activity.feed(handleOrDid ?? '', opts as Record<string, unknown>),\n queryFn: () => fetchActivityFeed(config, handleOrDid ?? '', opts),\n enabled: Boolean(handleOrDid) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { fetchEndorsementCount } from '../fetchers/endorsement.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/** Count of confirmed endorsements for a DID. Returns 0 on error. */\nexport function useEndorsementCount(\n did: string | undefined | null,\n options?: Omit<\n UseQueryOptions<number, Error, number, ReturnType<typeof sifaQueryKeys.endorsement.count>>,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.endorsement.count(did ?? ''),\n queryFn: () => fetchEndorsementCount(config, did ?? ''),\n enabled: Boolean(did) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport { fetchNetworkStreamCount } from '../fetchers/stream.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Count of items in the authenticated user's network stream digest.\n * Returns 0 on error (including when the endpoint isn't yet shipped).\n */\nexport function useNetworkStreamCount(\n did: string | undefined | null,\n options?: Omit<\n UseQueryOptions<number, Error, number, ReturnType<typeof sifaQueryKeys.stream.networkCount>>,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.stream.networkCount(did ?? ''),\n queryFn: () => fetchNetworkStreamCount(config, did ?? ''),\n enabled: Boolean(did) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n checkAppAccount,\n fetchReactionStatus,\n type AccountCheckResult,\n type ReactionStatus,\n} from '../fetchers/reactions.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * Batch-look up reaction status for multiple URIs. Skips the network call\n * when `uris` is empty.\n */\nexport function useReactionStatus(\n uris: string[],\n options?: Omit<\n UseQueryOptions<\n Record<string, ReactionStatus> | null,\n Error,\n Record<string, ReactionStatus> | null,\n ReturnType<typeof sifaQueryKeys.reactions.status>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.reactions.status(uris),\n queryFn: () => fetchReactionStatus(config, uris),\n ...options,\n });\n}\n\n/** Check whether the authenticated viewer has an account on the given app. */\nexport function useAppAccountCheck(\n appId: string | undefined | null,\n options?: Omit<\n UseQueryOptions<\n AccountCheckResult | null,\n Error,\n AccountCheckResult | null,\n ReturnType<typeof sifaQueryKeys.reactions.accountCheck>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.reactions.accountCheck(appId ?? ''),\n queryFn: () => checkAppAccount(config, appId ?? ''),\n enabled: Boolean(appId) && (options?.enabled ?? true),\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport {\n createReaction,\n deleteReaction,\n type ReactionError,\n type ReactionResult,\n} from '../fetchers/reactions.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/** Variables for {@link useCreateReaction}. */\nexport interface CreateReactionVariables {\n targetUri: string;\n appId: string;\n targetCid?: string;\n}\n\ntype CreateReactionMutationResult =\n | { ok: true; data: ReactionResult }\n | { ok: false; error: ReactionError };\n\n/**\n * React hook for creating a reaction. Returns the discriminated-union\n * result so the caller can detect `scope_insufficient` and trigger an\n * OAuth scope-upgrade flow.\n *\n * Invalidates the entire `sifaQueryKeys.reactions.all()` subtree on\n * success (any cached `useReactionStatus` view that includes the new\n * URI needs a refresh).\n */\nexport function useCreateReaction(\n options?: Omit<\n UseMutationOptions<CreateReactionMutationResult, Error, CreateReactionVariables>,\n 'mutationFn'\n >,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ targetUri, appId, targetCid }: CreateReactionVariables) =>\n createReaction(config, targetUri, appId, targetCid),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.ok) {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.reactions.all() });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** Variables for {@link useDeleteReaction}. */\nexport interface DeleteReactionVariables {\n targetUri: string;\n appId: string;\n}\n\n/** React hook for deleting a reaction. */\nexport function useDeleteReaction(\n options?: Omit<UseMutationOptions<WriteResult, Error, DeleteReactionVariables>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ targetUri, appId }: DeleteReactionVariables) =>\n deleteReaction(config, targetUri, appId),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.reactions.all() });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n","'use client';\n\nimport { useQuery, type UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSifaConfig } from '../config.js';\nimport {\n fetchMyRoadmapVotes,\n fetchRoadmapVotes,\n type RoadmapVotesResponse,\n} from '../fetchers/roadmap.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/** Public roadmap vote tallies. Returns `{}` data on error. */\nexport function useRoadmapVotes(\n options?: Omit<\n UseQueryOptions<\n RoadmapVotesResponse,\n Error,\n RoadmapVotesResponse,\n ReturnType<typeof sifaQueryKeys.roadmap.votes>\n >,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.roadmap.votes(),\n queryFn: () => fetchRoadmapVotes(config),\n ...options,\n });\n}\n\n/** Roadmap items the authenticated viewer has voted on. Returns `[]` data on error. */\nexport function useMyRoadmapVotes(\n options?: Omit<\n UseQueryOptions<string[], Error, string[], ReturnType<typeof sifaQueryKeys.roadmap.myVotes>>,\n 'queryKey' | 'queryFn'\n >,\n) {\n const config = useSifaConfig();\n return useQuery({\n queryKey: sifaQueryKeys.roadmap.myVotes(),\n queryFn: () => fetchMyRoadmapVotes(config),\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { castRoadmapVote, retractRoadmapVote } from '../fetchers/roadmap.js';\nimport { sifaQueryKeys } from '../keys.js';\n\nasync function invalidateRoadmap(queryClient: ReturnType<typeof useQueryClient>): Promise<void> {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.roadmap.all() });\n}\n\n/** React hook for casting a roadmap vote. Variable: the item key. */\nexport function useCastRoadmapVote(\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (key: string) => castRoadmapVote(config, key),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateRoadmap(queryClient);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/** React hook for retracting a previously-cast roadmap vote. */\nexport function useRetractRoadmapVote(\n options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (key: string) => retractRoadmapVote(config, key),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await invalidateRoadmap(queryClient);\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n","'use client';\n\nimport { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/react-query';\n\nimport { type WriteResult } from '../client.js';\nimport { useSifaConfig } from '../config.js';\nimport { deleteAccount, resetProfile, type DeleteAccountResult } from '../fetchers/destructive.js';\nimport { sifaQueryKeys } from '../keys.js';\n\n/**\n * React hook for resetting the authenticated user's Sifa profile.\n * Variable: `deletePdsData` boolean.\n *\n * Invalidates the entire `sifaQueryKeys.all()` subtree on success\n * (everything Sifa-related needs a refresh after a reset).\n */\nexport function useResetProfile(\n options?: Omit<UseMutationOptions<WriteResult, Error, boolean>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (deletePdsData: boolean) => resetProfile(config, deletePdsData),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.all() });\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n\n/**\n * React hook for deleting the authenticated user's account. Variable:\n * `deletePdsData` boolean. Returns the deleted handle on success.\n *\n * On success, clears the entire query cache (the user is logged out\n * and nothing they previously cached should be retained).\n */\nexport function useDeleteAccount(\n options?: Omit<UseMutationOptions<DeleteAccountResult, Error, boolean>, 'mutationFn'>,\n) {\n const config = useSifaConfig();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (deletePdsData: boolean) => deleteAccount(config, deletePdsData),\n onSuccess: async (result, variables, onMutateResult, context) => {\n if (result.success) {\n queryClient.clear();\n }\n await options?.onSuccess?.(result, variables, onMutateResult, context);\n },\n ...options,\n });\n}\n"]}
|