@singi-labs/sifa-sdk 0.7.3 → 0.7.4

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/query/client.ts","../../../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"],"names":[],"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,kBAAA,GAAqB,GAAA;AAC3B,IAAM,sBAAA,GAAyB,CAAA;AAC/B,IAAM,4BAAA,GAA+B,CAAA;AASrC,eAAsB,QAAA,CACpB,MAAA,EACA,IAAA,EACA,OAAA,GAA2B,EAAC,EAChB;AACZ,EAAA,MAA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* 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","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"]}