@singi-labs/sifa-sdk 0.7.2 → 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.
@@ -1,71 +1,10 @@
1
+ import { SifaApiConfig, sifaQueryKeys, WriteResult, RefreshPdsResult, UpdateProfileOverrideInput, UpdateProfileSelfInput, UploadAvatarResult, CreateResult, ProfileLocationInput, ExternalAccountInput, CreateExternalAccountResult, VerifyExternalAccountResult, EndorsementInput, RefreshOrcidPublicationsResult, StatsResponse, AppRegistryEntry, HiddenApp, FilterOptions, SearchFilters, SearchResponse, SkillSearchResult, FeaturedProfile, SimilarProfile, FetchSuggestionsOptions, SuggestionsResponse, FollowingResponse, FetchActivityFeedOptions, ActivityFeedResponse, ActivityTeaserResponse, HeatmapResponse, AccountCheckResult, ReactionStatus, ReactionResult, ReactionError, RoadmapVotesResponse, DeleteAccountResult } from './fetchers/index.js';
2
+ export { ActivityItem, ApiError, ApiFetchOptions, CheckAppAccountOptions, FetchActivityTeaserOptions, FetchHiddenAppsOptions, FetchMyRoadmapVotesOptions, FetchNetworkStreamCountOptions, FetchReactionStatusOptions, FollowProfile, HeatmapDay, ProfileIndustryInput, ProfileLocationAddress, ProfileSearchResult, ProfileSelfLocation, QUOTED_POSTS_BATCH_MAX, QuotedPostAuthor, QuotedPostImage, QuotedPostResult, QuotedPostView, ResolveQuotedPostsOptions, RoadmapVoter, SifaQueryKey, SuggestionProfile, apiFetch, apiFetchOrNull, apiWrite, apiWriteCreate, bulkHideStandardPublications, bulkUnhideStandardPublications, castRoadmapVote, checkAppAccount, createEducation, createEndorsement, createExternalAccount, createPosition, createProfileLocation, createReaction, createRecord, createSkill, deleteAccount, deleteAvatarOverride, deleteEducation, deleteExternalAccount, deletePosition, deleteProfileLocation, deleteReaction, deleteRecord, deleteSkill, fetchActivityFeed, fetchActivityTeaser, fetchAppsRegistry, fetchAtFundLink, fetchEndorsementCount, fetchExternalAccounts, fetchFeaturedProfile, fetchFollowing, fetchHeatmapData, fetchHiddenApps, fetchMyRoadmapVotes, fetchNetworkStreamCount, fetchProfile, fetchReactionStatus, fetchRoadmapVotes, fetchSearchFilters, fetchSearchProfiles, fetchSimilarProfiles, fetchSkillSuggestions, fetchStats, fetchSuggestionCount, fetchSuggestions, hideKeytraceClaim, hideOrcidPublication, hideSifaPublication, hideStandardPublication, linkSkillToPosition, refreshOrcidPublications, refreshPds, resetProfile, resolveQuotedPosts, retractRoadmapVote, searchSkills, setExternalAccountPrimary, setPositionPrimary, unhideKeytraceClaim, unhideOrcidPublication, unhideSifaPublication, unhideStandardPublication, unlinkSkillFromPosition, unsetExternalAccountPrimary, unsetPositionPrimary, updateEducation, updateExternalAccount, updatePosition, updateProfileLocation, updateProfileOverride, updateProfileSelf, updateRecord, updateSkill, uploadAvatar, verifyExternalAccount } from './fetchers/index.js';
1
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
4
  import { ReactNode } from 'react';
3
- import { f as Profile } from '../index-CpM21_Oy.js';
4
5
  import * as _tanstack_react_query from '@tanstack/react-query';
5
6
  import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
6
-
7
- /**
8
- * Foundation HTTP client for talking to the Sifa AppView.
9
- *
10
- * Stateless. Consumers supply a {@link SifaApiConfig} per call (the React
11
- * hooks read it from context; non-React consumers pass it explicitly). No
12
- * singletons, no module-level state.
13
- */
14
- /** Configuration passed to every fetcher. */
15
- interface SifaApiConfig {
16
- /** Base URL of the sifa-api AppView, e.g. `https://api.sifa.id`. No trailing slash. */
17
- baseUrl: string;
18
- /**
19
- * Optional fetch implementation. Defaults to {@link globalThis.fetch}.
20
- * Lets Next.js consumers pass their cache-enhanced fetch; node/Expo
21
- * consumers can leave this unset.
22
- */
23
- fetch?: typeof fetch;
24
- }
25
- /** Options accepted by {@link apiFetch}. */
26
- interface ApiFetchOptions {
27
- method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
28
- /** Request body. Serialized to JSON automatically. */
29
- body?: unknown;
30
- /** AbortSignal. Defaults to `AbortSignal.timeout(timeoutMs)` if `timeoutMs` is set. */
31
- signal?: AbortSignal;
32
- /** Per-call timeout in milliseconds. Default: 10_000. Ignored if `signal` is provided. */
33
- timeoutMs?: number;
34
- /** Retry on HTTP 429 up to 3 times with the server's `Retry-After` delay (capped at 3s). */
35
- retryOn429?: boolean;
36
- /** Additional headers. `Content-Type: application/json` is set automatically when `body` is present. */
37
- headers?: Record<string, string>;
38
- credentials?: RequestCredentials;
39
- cache?: RequestCache;
40
- /**
41
- * Next.js-specific cache hints. Ignored on non-Next runtimes. Passed
42
- * through transparently as part of {@link RequestInit}.
43
- */
44
- next?: {
45
- revalidate?: number | false;
46
- tags?: string[];
47
- };
48
- }
49
- /** Error thrown by {@link apiFetch} on non-2xx responses. */
50
- declare class ApiError extends Error {
51
- readonly status: number;
52
- readonly body: unknown;
53
- constructor(message: string, status: number, body?: unknown);
54
- }
55
- /**
56
- * Generic fetcher used by all SDK query and mutation functions.
57
- *
58
- * Returns parsed JSON typed as `T`. Throws {@link ApiError} on non-2xx
59
- * responses. Use {@link apiFetchOrNull} when 404 should resolve to `null`
60
- * instead.
61
- */
62
- declare function apiFetch<T = unknown>(config: SifaApiConfig, path: string, options?: ApiFetchOptions): Promise<T>;
63
- /**
64
- * Variant of {@link apiFetch} that resolves to `null` on HTTP 404 instead
65
- * of throwing. Useful for "fetch by handle" reads where missing is
66
- * expected (e.g. unknown profile).
67
- */
68
- declare function apiFetchOrNull<T>(config: SifaApiConfig, path: string, options?: ApiFetchOptions): Promise<T | null>;
7
+ import { f as Profile, o as ProfilePosition, S as SkillRef, c as ExternalAccount, t as SkillSuggestion } from '../index-CpM21_Oy.js';
69
8
 
70
9
  interface SifaProviderProps {
71
10
  config: SifaApiConfig;
@@ -92,592 +31,188 @@ declare function SifaProvider({ config, children }: SifaProviderProps): react_js
92
31
  declare function useSifaConfig(): SifaApiConfig;
93
32
 
94
33
  /**
95
- * Read the aggregated profile for a handle or DID.
96
- *
97
- * Returns `null` when the AppView has no profile for the given identifier
98
- * (HTTP 404). Throws {@link ApiError} on other non-2xx responses.
34
+ * React hook that reads an aggregated profile by handle or DID via
35
+ * TanStack Query. Returns `null` data when the profile does not exist.
99
36
  *
100
- * Server-callable (Next.js RSC) and client-callable (Expo, browser).
37
+ * Pass `{ enabled: false }` (or an empty `handleOrDid`) to defer the
38
+ * fetch.
101
39
  */
102
- declare function fetchProfile(config: SifaApiConfig, handleOrDid: string, options?: ApiFetchOptions): Promise<Profile | null>;
40
+ declare function useProfile(handleOrDid: string | undefined | null, options?: Omit<UseQueryOptions<Profile | null, Error, Profile | null, ReturnType<typeof sifaQueryKeys.profile.byHandle>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<Profile | null, Error>;
103
41
  /**
104
- * Public AT Fund link for a profile, if one is configured. Returns `null`
105
- * on any error or when the response payload's `url` field is missing or
106
- * non-string.
42
+ * React hook for a profile's AT Fund link. Returns `null` data on error
43
+ * or when the profile has no link configured.
107
44
  */
108
- declare function fetchAtFundLink(config: SifaApiConfig, did: string, options?: ApiFetchOptions): Promise<string | null>;
45
+ declare function useAtFundLink(did: string | undefined | null, options?: Omit<UseQueryOptions<string | null, Error, string | null, ReturnType<typeof sifaQueryKeys.profile.atFundLink>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<string | null, Error>;
109
46
 
110
- /** Result returned by record-write mutations (create / update / delete). */
111
- interface WriteResult {
112
- success: boolean;
113
- error?: string;
114
- pdsHost?: string;
115
- }
116
- /** Result returned by create mutations. Includes the newly created `rkey`. */
117
- interface CreateResult extends WriteResult {
118
- rkey?: string;
119
- }
120
47
  /**
121
- * Create a new `id.sifa.profile.position` record on the authenticated
122
- * user's PDS. The AppView signs and writes via the user's OAuth session.
48
+ * React hook for updating the authenticated user's profile self record.
49
+ * On success, invalidates the owner's profile cache.
123
50
  *
124
- * `data` should be a lexicon-shaped position record (without `createdAt`
125
- * or `rkey`; the AppView fills both). Validate with
126
- * `ProfilePositionRecordSchema.omit({ createdAt: true })` before calling
127
- * if you want client-side guarantees.
51
+ * The owner identifier (handle or DID) is required so the mutation can
52
+ * target the right profile cache entry for invalidation.
128
53
  */
129
- declare function createPosition(config: SifaApiConfig, data: Record<string, unknown>, options?: ApiFetchOptions): Promise<CreateResult>;
130
-
131
- /** Public, aggregate stats shown on the homepage and similar surfaces. */
132
- interface StatsResponse {
133
- profileCount: number;
134
- avatars: string[];
135
- atproto: {
136
- userCount: number;
137
- growthPerSecond: number;
138
- timestamp: number;
139
- } | null;
140
- }
54
+ declare function useUpdateProfileSelf(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, UpdateProfileSelfInput>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, UpdateProfileSelfInput, unknown>;
55
+ /** React hook for updating the authenticated user's profile override fields. */
56
+ declare function useUpdateProfileOverride(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, UpdateProfileOverrideInput>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, UpdateProfileOverrideInput, unknown>;
57
+ /** React hook for re-pulling the authenticated user's PDS-side profile. */
58
+ declare function useRefreshPds(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<RefreshPdsResult, Error, void>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<RefreshPdsResult, Error, void, unknown>;
141
59
  /**
142
- * Homepage stats (profile count, avatar samples, ATproto growth). Public
143
- * endpoint -- safe to cache. Returns `null` on any error so callers can
144
- * render a graceful empty state.
60
+ * React hook for uploading a new avatar. Pass a `File` (browser) or
61
+ * `Blob` (Expo) as the mutation variable.
145
62
  */
146
- declare function fetchStats(config: SifaApiConfig, options?: ApiFetchOptions): Promise<StatsResponse | null>;
63
+ declare function useUploadAvatar(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<UploadAvatarResult, Error, Blob>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<UploadAvatarResult, Error, Blob, unknown>;
64
+ /** React hook for deleting the avatar override (revert to PDS avatar). */
65
+ declare function useDeleteAvatarOverride(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, void>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, void, unknown>;
147
66
 
148
- /** Catalog entry describing an ATproto app that Sifa surfaces activity for. */
149
- interface AppRegistryEntry {
150
- id: string;
151
- name: string;
152
- category: string;
153
- collectionPrefixes: string[];
154
- scanCollections: string[];
155
- urlPattern?: string;
156
- color: string;
157
- }
158
- /** Compact app representation returned by the hidden-apps endpoint. */
159
- interface HiddenApp {
160
- id: string;
161
- name: string;
162
- category: string;
163
- }
164
- interface FetchHiddenAppsOptions extends ApiFetchOptions {
165
- /**
166
- * Pass the caller's `Cookie` header on Next.js RSC server-side calls.
167
- * `credentials: 'include'` does NOT propagate browser cookies in RSC,
168
- * so authenticated server fetches must forward the header explicitly.
169
- */
170
- cookieHeader?: string;
171
- }
172
- /**
173
- * Public app registry shown across discovery surfaces. Heavily cached.
174
- * Returns `[]` on any error.
175
- */
176
- declare function fetchAppsRegistry(config: SifaApiConfig, options?: ApiFetchOptions): Promise<AppRegistryEntry[]>;
177
67
  /**
178
- * Apps the authenticated user has chosen to hide from their activity feed.
179
- * Requires an authenticated session. Returns `[]` on any error (including
180
- * the unauthenticated case).
68
+ * React hook for creating a new position record. On success, invalidates
69
+ * the owner's profile cache so the new position is reflected on the next
70
+ * read.
71
+ *
72
+ * The owner DID is required so the mutation can target the correct
73
+ * profile cache entry for invalidation.
181
74
  */
182
- declare function fetchHiddenApps(config: SifaApiConfig, options?: FetchHiddenAppsOptions): Promise<HiddenApp[]>;
75
+ declare function useCreatePosition(ownerDid: string, options?: Omit<UseMutationOptions<CreateResult, Error, Record<string, unknown>>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<CreateResult, Error, Record<string, unknown>, unknown>;
183
76
 
184
- /** Profile entry returned by the search endpoint. */
185
- interface ProfileSearchResult {
186
- did?: string;
187
- handle: string;
188
- displayName?: string;
189
- headline?: string;
190
- avatar?: string;
191
- about?: string;
192
- currentRole?: string;
193
- currentCompany?: string;
194
- industry?: string;
195
- domain?: string;
196
- countryCode?: string;
197
- locationCountry?: string;
198
- preferredWorkplace?: string[];
199
- claimed?: boolean;
200
- blueskyVerified?: boolean;
201
- blueskyVerifiedAt?: string | null;
202
- }
203
- interface SearchFilters {
204
- q?: string;
205
- skill?: string;
206
- country?: string;
207
- industry?: string;
208
- domain?: string;
209
- workplace?: string;
210
- app?: string;
211
- limit?: number;
212
- }
213
- interface SearchResponse {
214
- profiles: ProfileSearchResult[];
215
- total: number;
216
- limit: number;
217
- offset: number;
218
- }
219
- /** Skill typeahead suggestion. */
220
- interface SkillSearchResult {
221
- name: string;
222
- slug: string;
223
- category: string;
224
- userCount: number;
225
- }
226
- interface FilterOptions {
227
- countries: {
228
- countryCode: string;
229
- country: string;
230
- count: number;
231
- }[];
232
- industries: {
233
- industry: string;
234
- count: number;
235
- }[];
236
- apps: {
237
- appId: string;
238
- count: number;
239
- }[];
240
- }
241
- /**
242
- * Search profiles by free-text query and optional filters. Returns an
243
- * empty result set when no filters are provided (matching sifa-web's
244
- * "no input, no fetch" behavior).
245
- */
246
- declare function fetchSearchProfiles(config: SifaApiConfig, filters: SearchFilters, options?: ApiFetchOptions): Promise<SearchResponse>;
247
- /**
248
- * Skill typeahead. Returns up to 8 matches for the given prefix. Empty
249
- * input returns an empty array without hitting the server.
250
- */
251
- declare function fetchSkillSuggestions(config: SifaApiConfig, query: string, options?: ApiFetchOptions): Promise<SkillSearchResult[]>;
252
- /** Available filter facets (countries, industries, apps) for search UI. */
253
- declare function fetchSearchFilters(config: SifaApiConfig, options?: ApiFetchOptions): Promise<FilterOptions>;
77
+ /** Variables for {@link useUpdatePosition}. */
78
+ interface UpdatePositionVariables {
79
+ rkey: string;
80
+ data: Record<string, unknown>;
81
+ }
82
+ /** React hook for updating a position record. */
83
+ declare function useUpdatePosition(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, UpdatePositionVariables>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, UpdatePositionVariables, unknown>;
84
+ /** React hook for deleting a position record. Variable: the `rkey` string. */
85
+ declare function useDeletePosition(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, string, unknown>;
86
+ /** React hook for marking a position as primary. Variable: the `rkey` string. */
87
+ declare function useSetPositionPrimary(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, string, unknown>;
88
+ /** React hook for clearing the primary flag on a position. */
89
+ declare function useUnsetPositionPrimary(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, string, unknown>;
90
+ /** Variables for {@link useLinkSkillToPosition} / {@link useUnlinkSkillFromPosition}. */
91
+ interface PositionSkillLinkVariables {
92
+ position: ProfilePosition;
93
+ skillRef: SkillRef;
94
+ }
95
+ /** React hook for linking a skill to a position. Idempotent. */
96
+ declare function useLinkSkillToPosition(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, PositionSkillLinkVariables>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, PositionSkillLinkVariables, unknown>;
97
+ /** React hook for unlinking a skill from a position. */
98
+ declare function useUnlinkSkillFromPosition(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, PositionSkillLinkVariables>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, PositionSkillLinkVariables, unknown>;
254
99
 
255
- /** Lightweight profile representation used by discovery endpoints. */
256
- interface SimilarProfile {
257
- did: string;
258
- handle: string;
259
- displayName?: string | null;
260
- avatar?: string | null;
261
- headline?: string | null;
262
- currentRole?: string | null;
263
- currentCompany?: string | null;
264
- industry?: string | null;
265
- domain?: string | null;
266
- }
267
- interface SuggestionProfile {
268
- did: string;
269
- handle: string;
270
- displayName?: string;
271
- headline?: string;
272
- avatarUrl?: string;
273
- source: string;
274
- dismissed: boolean;
275
- blueskyVerified?: boolean;
276
- }
277
- interface SuggestionsResponse {
278
- onSifa: SuggestionProfile[];
279
- notOnSifa: SuggestionProfile[];
280
- cursor?: string;
281
- }
282
- interface FeaturedProfile {
283
- did: string;
284
- handle: string;
285
- displayName?: string;
286
- avatar?: string;
287
- pronouns?: string;
288
- headline?: string;
289
- about?: string;
290
- currentRole?: string;
291
- currentCompany?: string;
292
- locationCountry?: string;
293
- locationRegion?: string;
294
- /** Legacy alias for `locationLocality`; emitted by sifa-api during the additive response window. */
295
- locationCity?: string;
296
- /** community.lexicon.location.address field name -- prefer over `locationCity`. */
297
- locationLocality?: string;
298
- countryCode?: string;
299
- location?: string;
300
- website?: string;
301
- openTo?: string[];
302
- preferredWorkplace?: string[];
303
- availableFromUtc?: number;
304
- availableToUtc?: number;
305
- followersCount?: number;
306
- atprotoFollowersCount?: number;
307
- pdsProvider?: {
308
- name: string;
309
- host: string;
310
- } | null;
311
- claimed: boolean;
312
- featuredDate: string;
313
- }
314
- /** Profiles similar to the given DID (matchmaking). Returns `[]` on error. */
315
- declare function fetchSimilarProfiles(config: SifaApiConfig, did: string, opts?: {
316
- limit?: number;
317
- } & ApiFetchOptions): Promise<SimilarProfile[]>;
318
- interface FetchSuggestionsOptions extends ApiFetchOptions {
319
- source?: string;
320
- includeDismissed?: boolean;
321
- cursor?: string;
322
- limit?: number;
323
- /**
324
- * Pass the caller's `Cookie` header on Next.js RSC server-side calls.
325
- * `credentials: 'include'` does NOT propagate browser cookies in RSC,
326
- * so authenticated server fetches must forward the header explicitly.
327
- */
328
- cookieHeader?: string;
100
+ /** React hook for creating an education record. */
101
+ declare function useCreateEducation(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<CreateResult, Error, Record<string, unknown>>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<CreateResult, Error, Record<string, unknown>, unknown>;
102
+ /** Variables for {@link useUpdateEducation}. */
103
+ interface UpdateEducationVariables {
104
+ rkey: string;
105
+ data: Record<string, unknown>;
329
106
  }
330
- /** Discovery suggestions feed. Resolves to empty arrays on error. */
331
- declare function fetchSuggestions(config: SifaApiConfig, opts?: FetchSuggestionsOptions): Promise<SuggestionsResponse>;
332
- /** Count of pending suggestions since an optional timestamp. */
333
- declare function fetchSuggestionCount(config: SifaApiConfig, since?: string, options?: ApiFetchOptions): Promise<number>;
334
- /** Featured profile (rotated by sifa-api). Returns `null` when none. */
335
- declare function fetchFeaturedProfile(config: SifaApiConfig, options?: ApiFetchOptions): Promise<FeaturedProfile | null>;
107
+ /** React hook for updating an education record. */
108
+ declare function useUpdateEducation(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, UpdateEducationVariables>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, UpdateEducationVariables, unknown>;
109
+ /** React hook for deleting an education record. Variable: the `rkey` string. */
110
+ declare function useDeleteEducation(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, string, unknown>;
336
111
 
337
- interface FollowProfile {
338
- did: string;
339
- handle: string;
340
- displayName?: string;
341
- headline?: string;
342
- avatarUrl?: string;
343
- source: string;
344
- claimed: boolean;
345
- followedAt: string;
346
- blueskyVerified?: boolean;
347
- blueskyVerifiedAt?: string | null;
348
- }
349
- interface FollowingResponse {
350
- follows: FollowProfile[];
351
- cursor?: string;
112
+ /** React hook for creating a skill record. */
113
+ declare function useCreateSkill(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<CreateResult, Error, Record<string, unknown>>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<CreateResult, Error, Record<string, unknown>, unknown>;
114
+ /** Variables for {@link useUpdateSkill}. */
115
+ interface UpdateSkillVariables {
116
+ rkey: string;
117
+ data: Record<string, unknown>;
352
118
  }
353
- /** People the authenticated user follows. Empty on error. */
354
- declare function fetchFollowing(config: SifaApiConfig, opts?: {
355
- source?: string;
356
- cursor?: string;
357
- limit?: number;
358
- } & ApiFetchOptions): Promise<FollowingResponse>;
119
+ /** React hook for updating a skill record. */
120
+ declare function useUpdateSkill(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, UpdateSkillVariables>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, UpdateSkillVariables, unknown>;
121
+ /** React hook for deleting a skill record. Variable: the `rkey` string. */
122
+ declare function useDeleteSkill(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, string, unknown>;
359
123
 
360
- interface QuotedPostAuthor {
361
- did: string;
362
- handle: string;
363
- displayName?: string;
364
- avatar?: string;
365
- }
366
- interface QuotedPostImage {
367
- thumb: string;
368
- fullsize: string;
369
- alt?: string;
370
- }
371
- interface QuotedPostView {
372
- uri: string;
373
- cid: string;
374
- author: QuotedPostAuthor;
375
- text: string;
376
- createdAt: string;
377
- images?: QuotedPostImage[];
378
- }
379
- type QuotedPostResult = {
380
- status: 'ok';
381
- record: QuotedPostView;
382
- } | {
383
- status: 'deleted';
384
- uri: string;
385
- } | {
386
- status: 'unavailable';
387
- uri: string;
388
- };
389
- /** Max URIs per request to `POST /api/quoted-posts/resolve` (mirrors server cap). */
390
- declare const QUOTED_POSTS_BATCH_MAX = 20;
391
- interface ResolveQuotedPostsOptions extends ApiFetchOptions {
392
- /** Cookie header for Next.js RSC server-side calls; ignored in browsers. */
393
- cookieHeader?: string;
124
+ /** Variables for {@link useCreateRecord}. */
125
+ interface CreateRecordVariables {
126
+ collection: string;
127
+ data: Record<string, unknown>;
394
128
  }
395
129
  /**
396
- * Resolve a batch of AT-URIs to their quoted-post snapshots via the Sifa AppView.
397
- *
398
- * Auto-deduplicates input URIs and splits requests into chunks of
399
- * {@link QUOTED_POSTS_BATCH_MAX} so callers can pass an arbitrary-length array.
400
- * Each chunk is fired in parallel. The server caches results in Valkey, so
401
- * repeated calls for the same URI are cheap.
402
- *
403
- * Returns a map of `uri -> QuotedPostResult`. URIs that fail (network error,
404
- * non-2xx, or the server omitting them) are absent from the map; the caller
405
- * should render a skeleton or tombstone for those.
130
+ * Generic record-create escape hatch for collections without a
131
+ * dedicated section helper (certifications, projects, publications,
132
+ * volunteering, honors, languages, courses). Prefer the typed helpers
133
+ * when one exists for the section.
406
134
  */
407
- declare function resolveQuotedPosts(config: SifaApiConfig, uris: string[], options?: ResolveQuotedPostsOptions): Promise<Record<string, QuotedPostResult>>;
408
-
409
- interface HeatmapDay {
410
- date: string;
411
- total: number;
412
- apps: {
413
- appId: string;
414
- count: number;
415
- }[];
416
- }
417
- interface HeatmapResponse {
418
- days: HeatmapDay[];
419
- appTotals: {
420
- appId: string;
421
- appName: string;
422
- total: number;
423
- }[];
424
- thresholds: [number, number, number, number];
425
- }
426
- interface ActivityItem {
427
- uri: string;
428
- cid: string;
135
+ declare function useCreateRecord(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<CreateResult, Error, CreateRecordVariables>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<CreateResult, Error, CreateRecordVariables, unknown>;
136
+ /** Variables for {@link useUpdateRecord}. */
137
+ interface UpdateRecordVariables {
429
138
  collection: string;
430
139
  rkey: string;
431
- record: Record<string, unknown>;
432
- appId: string;
433
- appName: string;
434
- category: string;
435
- indexedAt: string;
436
- /**
437
- * Set by the server when an `app.bsky.embed.record` quote was already
438
- * resolved upstream (AppView path). Mutually exclusive with `quotedPostUri`.
439
- */
440
- quotedPost?: QuotedPostResult;
441
- /**
442
- * Set by the server when an `app.bsky.embed.record` quote needs client-side
443
- * resolution (PDS path). Pass batches to {@link resolveQuotedPosts}.
444
- * Mutually exclusive with `quotedPost`.
445
- */
446
- quotedPostUri?: string;
447
- }
448
- interface ActivityTeaserResponse {
449
- items: ActivityItem[];
450
- blueskyGated?: boolean;
451
- backfillPending?: boolean;
452
- failedApps?: string[];
140
+ data: Record<string, unknown>;
453
141
  }
454
- interface ActivityFeedResponse {
455
- items: ActivityItem[];
456
- cursor: string | null;
457
- hasMore: boolean;
458
- availableCategories?: string[];
459
- blueskyGated?: boolean;
460
- failedApps?: string[];
461
- }
462
- /**
463
- * Per-day activity counts for a profile across all ATproto apps. Returns
464
- * `null` on any error so callers can render a graceful empty state.
465
- */
466
- declare function fetchHeatmapData(config: SifaApiConfig, handleOrDid: string, days: number, options?: ApiFetchOptions): Promise<HeatmapResponse | null>;
467
- interface FetchActivityTeaserOptions extends ApiFetchOptions {
468
- /**
469
- * Pass the caller's `Cookie` header on Next.js RSC server-side calls.
470
- * Required for authenticated server fetches because `credentials: 'include'`
471
- * does not propagate browser cookies in RSC.
472
- */
473
- cookieHeader?: string;
474
- }
475
- /**
476
- * Recent activity teaser for a profile (homepage-sized slice). Caps the
477
- * upstream wait so the SSR path cannot hang. Returns `null` on any error.
478
- */
479
- declare function fetchActivityTeaser(config: SifaApiConfig, handleOrDid: string, options?: FetchActivityTeaserOptions): Promise<ActivityTeaserResponse | null>;
480
- interface FetchActivityFeedOptions extends ApiFetchOptions {
481
- category?: string;
482
- limit?: number;
483
- cursor?: string;
484
- cookieHeader?: string;
142
+ /** Generic record-update escape hatch. See {@link useCreateRecord}. */
143
+ declare function useUpdateRecord(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, UpdateRecordVariables>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, UpdateRecordVariables, unknown>;
144
+ /** Variables for {@link useDeleteRecord}. */
145
+ interface DeleteRecordVariables {
146
+ collection: string;
147
+ rkey: string;
485
148
  }
486
- /**
487
- * Paginated activity feed for a profile. Always fresh (`cache: 'no-store'`).
488
- * Returns `null` on any error.
489
- */
490
- declare function fetchActivityFeed(config: SifaApiConfig, handleOrDid: string, options?: FetchActivityFeedOptions): Promise<ActivityFeedResponse | null>;
149
+ /** Generic record-delete escape hatch. See {@link useCreateRecord}. */
150
+ declare function useDeleteRecord(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, DeleteRecordVariables>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, DeleteRecordVariables, unknown>;
491
151
 
492
- /**
493
- * Counts confirmed endorsements received by a DID. The backend's
494
- * `GET /api/endorsement/:did` already returns only confirmed endorsements
495
- * (via inner join with `endorsementConfirmations`), so this helper just
496
- * returns the array length. Failures return 0 so callers can route safely.
497
- *
498
- * Public endpoint -- no credentials needed.
499
- */
500
- declare function fetchEndorsementCount(config: SifaApiConfig, did: string, options?: ApiFetchOptions): Promise<number>;
501
-
502
- interface FetchNetworkStreamCountOptions extends ApiFetchOptions {
503
- /**
504
- * Pass the caller's `Cookie` header on Next.js RSC server-side calls.
505
- * Required for authenticated server fetches because `credentials: 'include'`
506
- * does not propagate browser cookies in RSC.
507
- *
508
- * When omitted, the request falls back to `credentials: 'include'` so
509
- * client-side calls work without extra plumbing.
510
- */
511
- cookieHeader?: string;
152
+ /** React hook for creating a profile location record. */
153
+ declare function useCreateProfileLocation(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<CreateResult, Error, ProfileLocationInput>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<CreateResult, Error, ProfileLocationInput, unknown>;
154
+ /** Variables for {@link useUpdateProfileLocation}. */
155
+ interface UpdateProfileLocationVariables {
156
+ rkey: string;
157
+ data: ProfileLocationInput;
512
158
  }
513
- /**
514
- * Counts items in the authenticated user's network stream digest. The
515
- * underlying `GET /api/stream/network` endpoint may 404 while the feature
516
- * is in development; in that case (and on any other error) this returns
517
- * 0 so callers can route safely to a fallback experience.
518
- */
519
- declare function fetchNetworkStreamCount(config: SifaApiConfig, did: string, options?: FetchNetworkStreamCountOptions): Promise<number>;
159
+ /** React hook for updating a profile location record. */
160
+ declare function useUpdateProfileLocation(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, UpdateProfileLocationVariables>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, UpdateProfileLocationVariables, unknown>;
161
+ /** React hook for deleting a profile location record. Variable: the `rkey` string. */
162
+ declare function useDeleteProfileLocation(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, string, unknown>;
520
163
 
521
- /** Per-URI reaction state for the authenticated viewer. */
522
- interface ReactionStatus {
523
- reacted: boolean;
524
- rkey?: string;
525
- collection?: string;
526
- }
527
- /** Result of checking whether the authenticated viewer has an account on a given app. */
528
- interface AccountCheckResult {
529
- hasAccount: boolean;
530
- appName: string;
531
- appUrl: string;
532
- }
533
- interface FetchReactionStatusOptions extends ApiFetchOptions {
534
- /**
535
- * Pass the caller's `Cookie` header on Next.js RSC server-side calls.
536
- * Required for authenticated server fetches because `credentials: 'include'`
537
- * does not propagate browser cookies in RSC.
538
- */
539
- cookieHeader?: string;
540
- }
541
- /**
542
- * Batch-look up reaction status for multiple URIs. Returns `{}` for an
543
- * empty input list (no network call) and `null` on any error.
544
- */
545
- declare function fetchReactionStatus(config: SifaApiConfig, uris: string[], options?: FetchReactionStatusOptions): Promise<Record<string, ReactionStatus> | null>;
546
- interface CheckAppAccountOptions extends ApiFetchOptions {
547
- cookieHeader?: string;
548
- }
549
- /**
550
- * Check whether the authenticated viewer has an account on a given app.
551
- * Returns `null` on any error.
552
- */
553
- declare function checkAppAccount(config: SifaApiConfig, appId: string, options?: CheckAppAccountOptions): Promise<AccountCheckResult | null>;
164
+ /** React hook for reading the external-accounts list. Returns `[]` data on error. */
165
+ declare function useExternalAccounts(handleOrDid: string | undefined | null, options?: Omit<UseQueryOptions<ExternalAccount[], Error, ExternalAccount[], ReturnType<typeof sifaQueryKeys.profile.externalAccounts>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<ExternalAccount[], Error>;
166
+ /** React hook for creating an external account. */
167
+ declare function useCreateExternalAccount(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<CreateExternalAccountResult, Error, ExternalAccountInput>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<CreateExternalAccountResult, Error, ExternalAccountInput, unknown>;
168
+ /** Variables for {@link useUpdateExternalAccount}. */
169
+ interface UpdateExternalAccountVariables {
170
+ rkey: string;
171
+ data: ExternalAccountInput;
172
+ }
173
+ /** React hook for updating an external account. */
174
+ declare function useUpdateExternalAccount(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, UpdateExternalAccountVariables>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, UpdateExternalAccountVariables, unknown>;
175
+ /** React hook for deleting an external account. Variable: the `rkey` string. */
176
+ declare function useDeleteExternalAccount(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, string, unknown>;
177
+ /** React hook for marking an external account primary. */
178
+ declare function useSetExternalAccountPrimary(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, string, unknown>;
179
+ /** React hook for clearing the primary flag on an external account. */
180
+ declare function useUnsetExternalAccountPrimary(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, string, unknown>;
181
+ /** React hook for running server-side verification of an external account. */
182
+ declare function useVerifyExternalAccount(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<VerifyExternalAccountResult, Error, string>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<VerifyExternalAccountResult, Error, string, unknown>;
554
183
 
555
- /** Voter on a roadmap item. */
556
- interface RoadmapVoter {
557
- did: string;
558
- avatarUrl?: string;
559
- }
560
- /** Map of item key -> vote tally and voter list. */
561
- type RoadmapVotesResponse = Record<string, {
562
- count: number;
563
- voters: RoadmapVoter[];
564
- }>;
565
- /**
566
- * Public roadmap vote tallies, keyed by item. Returns `{}` on any error.
567
- */
568
- declare function fetchRoadmapVotes(config: SifaApiConfig, options?: ApiFetchOptions): Promise<RoadmapVotesResponse>;
569
- interface FetchMyRoadmapVotesOptions extends ApiFetchOptions {
570
- /**
571
- * Pass the caller's `Cookie` header on Next.js RSC server-side calls.
572
- * Required for authenticated server fetches because `credentials: 'include'`
573
- * does not propagate browser cookies in RSC.
574
- */
575
- cookieHeader?: string;
576
- }
577
184
  /**
578
- * Roadmap items the authenticated user has voted on. Returns `[]` on any
579
- * error or when the response payload is shaped unexpectedly.
185
+ * React hook for creating an endorsement of another user's skill. The
186
+ * mutation needs the endorsed user's handle/DID (not the endorser's)
187
+ * so the endorsed profile + their endorsement count caches get
188
+ * invalidated; pass `null` to skip endorsed-profile invalidation
189
+ * (e.g., if you only know the skill URI).
580
190
  */
581
- declare function fetchMyRoadmapVotes(config: SifaApiConfig, options?: FetchMyRoadmapVotesOptions): Promise<string[]>;
191
+ declare function useCreateEndorsement(endorsedHandleOrDid: string | null, options?: Omit<UseMutationOptions<CreateResult, Error, EndorsementInput>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<CreateResult, Error, EndorsementInput, unknown>;
582
192
 
583
- /**
584
- * Query key factory for TanStack Query.
585
- *
586
- * Keys are read-only tuples; the hierarchy matches the SDK's fetcher
587
- * grouping. Use these instead of inline arrays so consumers can target
588
- * `queryClient.invalidateQueries({ queryKey: keys.profile.all() })` and
589
- * similar patterns without typos.
590
- *
591
- * Convention: every leaf key starts with the namespace ('sifa') so
592
- * consumers can invalidate everything Sifa-related in one call.
593
- */
594
- declare const sifaQueryKeys: {
595
- readonly all: () => readonly ["sifa"];
596
- readonly profile: {
597
- readonly all: () => readonly ["sifa", "profile"];
598
- readonly byHandle: (handleOrDid: string) => readonly ["sifa", "profile", string];
599
- readonly atFundLink: (did: string) => readonly ["sifa", "profile", "at-fund-link", string];
600
- };
601
- readonly position: {
602
- readonly all: () => readonly ["sifa", "position"];
603
- readonly byOwner: (did: string) => readonly ["sifa", "position", "by-owner", string];
604
- };
605
- readonly search: {
606
- readonly all: () => readonly ["sifa", "search"];
607
- readonly profiles: (filters: Record<string, unknown>) => readonly ["sifa", "search", "profiles", Record<string, unknown>];
608
- readonly skills: (query: string) => readonly ["sifa", "search", "skills", string];
609
- readonly filters: () => readonly ["sifa", "search", "filters"];
610
- };
611
- readonly discovery: {
612
- readonly all: () => readonly ["sifa", "discovery"];
613
- readonly similar: (did: string, limit: number) => readonly ["sifa", "discovery", "similar", string, number];
614
- readonly suggestions: (opts: Record<string, unknown>) => readonly ["sifa", "discovery", "suggestions", Record<string, unknown>];
615
- readonly suggestionCount: (since: string | undefined) => readonly ["sifa", "discovery", "suggestion-count", string | null];
616
- readonly featured: () => readonly ["sifa", "discovery", "featured"];
617
- };
618
- readonly follow: {
619
- readonly all: () => readonly ["sifa", "follow"];
620
- readonly following: (opts: Record<string, unknown>) => readonly ["sifa", "follow", "following", Record<string, unknown>];
621
- };
622
- readonly stats: {
623
- readonly all: () => readonly ["sifa", "stats"];
624
- readonly homepage: () => readonly ["sifa", "stats", "homepage"];
625
- };
626
- readonly apps: {
627
- readonly all: () => readonly ["sifa", "apps"];
628
- readonly registry: () => readonly ["sifa", "apps", "registry"];
629
- readonly hidden: () => readonly ["sifa", "apps", "hidden"];
630
- };
631
- readonly activity: {
632
- readonly all: () => readonly ["sifa", "activity"];
633
- readonly heatmap: (handleOrDid: string, days: number) => readonly ["sifa", "activity", "heatmap", string, number];
634
- readonly teaser: (handleOrDid: string) => readonly ["sifa", "activity", "teaser", string];
635
- readonly feed: (handleOrDid: string, opts: Record<string, unknown>) => readonly ["sifa", "activity", "feed", string, Record<string, unknown>];
636
- };
637
- readonly endorsement: {
638
- readonly all: () => readonly ["sifa", "endorsement"];
639
- readonly count: (did: string) => readonly ["sifa", "endorsement", "count", string];
640
- };
641
- readonly stream: {
642
- readonly all: () => readonly ["sifa", "stream"];
643
- readonly networkCount: (did: string) => readonly ["sifa", "stream", "network-count", string];
644
- };
645
- readonly reactions: {
646
- readonly all: () => readonly ["sifa", "reactions"];
647
- readonly status: (uris: string[]) => readonly ["sifa", "reactions", "status", string[]];
648
- readonly accountCheck: (appId: string) => readonly ["sifa", "reactions", "account-check", string];
649
- };
650
- readonly roadmap: {
651
- readonly all: () => readonly ["sifa", "roadmap"];
652
- readonly votes: () => readonly ["sifa", "roadmap", "votes"];
653
- readonly myVotes: () => readonly ["sifa", "roadmap", "my-votes"];
654
- };
655
- };
656
- type SifaQueryKey = ReturnType<typeof sifaQueryKeys.all> | ReturnType<typeof sifaQueryKeys.profile.all> | ReturnType<typeof sifaQueryKeys.profile.byHandle> | ReturnType<typeof sifaQueryKeys.profile.atFundLink> | ReturnType<typeof sifaQueryKeys.position.all> | ReturnType<typeof sifaQueryKeys.position.byOwner> | ReturnType<typeof sifaQueryKeys.search.all> | ReturnType<typeof sifaQueryKeys.search.profiles> | ReturnType<typeof sifaQueryKeys.search.skills> | ReturnType<typeof sifaQueryKeys.search.filters> | ReturnType<typeof sifaQueryKeys.discovery.all> | ReturnType<typeof sifaQueryKeys.discovery.similar> | ReturnType<typeof sifaQueryKeys.discovery.suggestions> | ReturnType<typeof sifaQueryKeys.discovery.suggestionCount> | ReturnType<typeof sifaQueryKeys.discovery.featured> | ReturnType<typeof sifaQueryKeys.follow.all> | ReturnType<typeof sifaQueryKeys.follow.following> | ReturnType<typeof sifaQueryKeys.stats.all> | ReturnType<typeof sifaQueryKeys.stats.homepage> | ReturnType<typeof sifaQueryKeys.apps.all> | ReturnType<typeof sifaQueryKeys.apps.registry> | ReturnType<typeof sifaQueryKeys.apps.hidden> | ReturnType<typeof sifaQueryKeys.activity.all> | ReturnType<typeof sifaQueryKeys.activity.heatmap> | ReturnType<typeof sifaQueryKeys.activity.teaser> | ReturnType<typeof sifaQueryKeys.activity.feed> | ReturnType<typeof sifaQueryKeys.endorsement.all> | ReturnType<typeof sifaQueryKeys.endorsement.count> | ReturnType<typeof sifaQueryKeys.stream.all> | ReturnType<typeof sifaQueryKeys.stream.networkCount> | ReturnType<typeof sifaQueryKeys.reactions.all> | ReturnType<typeof sifaQueryKeys.reactions.status> | ReturnType<typeof sifaQueryKeys.reactions.accountCheck> | ReturnType<typeof sifaQueryKeys.roadmap.all> | ReturnType<typeof sifaQueryKeys.roadmap.votes> | ReturnType<typeof sifaQueryKeys.roadmap.myVotes>;
193
+ /** React hook for hiding a keytrace claim. Variable: the claim `rkey` string. */
194
+ declare function useHideKeytraceClaim(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, string, unknown>;
195
+ /** React hook for unhiding a previously-hidden keytrace claim. */
196
+ declare function useUnhideKeytraceClaim(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, string, unknown>;
657
197
 
658
- /**
659
- * React hook that reads an aggregated profile by handle or DID via
660
- * TanStack Query. Returns `null` data when the profile does not exist.
661
- *
662
- * Pass `{ enabled: false }` (or an empty `handleOrDid`) to defer the
663
- * fetch.
664
- */
665
- declare function useProfile(handleOrDid: string | undefined | null, options?: Omit<UseQueryOptions<Profile | null, Error, Profile | null, ReturnType<typeof sifaQueryKeys.profile.byHandle>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<Profile | null, Error>;
666
- /**
667
- * React hook for a profile's AT Fund link. Returns `null` data on error
668
- * or when the profile has no link configured.
669
- */
670
- declare function useAtFundLink(did: string | undefined | null, options?: Omit<UseQueryOptions<string | null, Error, string | null, ReturnType<typeof sifaQueryKeys.profile.atFundLink>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<string | null, Error>;
671
-
672
- /**
673
- * React hook for creating a new position record. On success, invalidates
674
- * the owner's profile cache so the new position is reflected on the next
675
- * read.
676
- *
677
- * The owner DID is required so the mutation can target the correct
678
- * profile cache entry for invalidation.
679
- */
680
- declare function useCreatePosition(ownerDid: string, options?: Omit<UseMutationOptions<CreateResult, Error, Record<string, unknown>>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<CreateResult, Error, Record<string, unknown>, unknown>;
198
+ /** React hook for hiding an ORCID publication. Variable: the `putCode` number. */
199
+ declare const useHideOrcidPublication: (ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, number, unknown>, "mutationFn"> | undefined) => _tanstack_react_query.UseMutationResult<WriteResult, Error, number, unknown>;
200
+ /** React hook for unhiding an ORCID publication. Variable: the `putCode` number. */
201
+ declare const useUnhideOrcidPublication: (ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, number, unknown>, "mutationFn"> | undefined) => _tanstack_react_query.UseMutationResult<WriteResult, Error, number, unknown>;
202
+ /** React hook for hiding a standard publication. Variable: the AT URI string. */
203
+ declare const useHideStandardPublication: (ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, string, unknown>, "mutationFn"> | undefined) => _tanstack_react_query.UseMutationResult<WriteResult, Error, string, unknown>;
204
+ /** React hook for unhiding a standard publication. Variable: the AT URI string. */
205
+ declare const useUnhideStandardPublication: (ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, string, unknown>, "mutationFn"> | undefined) => _tanstack_react_query.UseMutationResult<WriteResult, Error, string, unknown>;
206
+ /** React hook for bulk-hiding standard publications. Variable: the URI list. */
207
+ declare const useBulkHideStandardPublications: (ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, string[], unknown>, "mutationFn"> | undefined) => _tanstack_react_query.UseMutationResult<WriteResult, Error, string[], unknown>;
208
+ /** React hook for bulk-unhiding standard publications. Variable: the URI list. */
209
+ declare const useBulkUnhideStandardPublications: (ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, string[], unknown>, "mutationFn"> | undefined) => _tanstack_react_query.UseMutationResult<WriteResult, Error, string[], unknown>;
210
+ /** React hook for hiding a Sifa-authored publication. Variable: the `rkey` string. */
211
+ declare const useHideSifaPublication: (ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, string, unknown>, "mutationFn"> | undefined) => _tanstack_react_query.UseMutationResult<WriteResult, Error, string, unknown>;
212
+ /** React hook for unhiding a Sifa-authored publication. Variable: the `rkey` string. */
213
+ declare const useUnhideSifaPublication: (ownerHandleOrDid: string, options?: Omit<UseMutationOptions<WriteResult, Error, string, unknown>, "mutationFn"> | undefined) => _tanstack_react_query.UseMutationResult<WriteResult, Error, string, unknown>;
214
+ /** React hook for re-pulling ORCID publications. */
215
+ declare function useRefreshOrcidPublications(ownerHandleOrDid: string, options?: Omit<UseMutationOptions<RefreshOrcidPublicationsResult, Error, void>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<RefreshOrcidPublicationsResult, Error, void, unknown>;
681
216
 
682
217
  /**
683
218
  * React hook for the public homepage stats. Returns `null` data on error.
@@ -694,6 +229,13 @@ declare function useHiddenApps(options?: Omit<UseQueryOptions<HiddenApp[], Error
694
229
 
695
230
  declare function useSearchProfiles(filters: SearchFilters, options?: Omit<UseQueryOptions<SearchResponse, Error, SearchResponse, ReturnType<typeof sifaQueryKeys.search.profiles>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<SearchResponse, Error>;
696
231
  declare function useSkillSuggestions(query: string, options?: Omit<UseQueryOptions<SkillSearchResult[], Error, SkillSearchResult[], ReturnType<typeof sifaQueryKeys.search.skills>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<SkillSearchResult[], Error>;
232
+ /**
233
+ * Canonical-skill search hook. Hits `/api/skills/search` (the
234
+ * canonical-skills DB lookup, distinct from {@link useSkillSuggestions}'s
235
+ * `/api/search/skills` profile-skill typeahead). Skips the network call
236
+ * when the query is empty.
237
+ */
238
+ declare function useCanonicalSkillSearch(query: string, limit?: number, options?: Omit<UseQueryOptions<SkillSuggestion[], Error, SkillSuggestion[], ReturnType<typeof sifaQueryKeys.search.canonicalSkills>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<SkillSuggestion[], Error>;
697
239
  declare function useSearchFilters(options?: Omit<UseQueryOptions<FilterOptions, Error, FilterOptions, ReturnType<typeof sifaQueryKeys.search.filters>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<FilterOptions, Error>;
698
240
 
699
241
  declare function useSimilarProfiles(did: string | undefined | null, opts?: {
@@ -730,9 +272,68 @@ declare function useReactionStatus(uris: string[], options?: Omit<UseQueryOption
730
272
  /** Check whether the authenticated viewer has an account on the given app. */
731
273
  declare function useAppAccountCheck(appId: string | undefined | null, options?: Omit<UseQueryOptions<AccountCheckResult | null, Error, AccountCheckResult | null, ReturnType<typeof sifaQueryKeys.reactions.accountCheck>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<AccountCheckResult | null, Error>;
732
274
 
275
+ /** Variables for {@link useCreateReaction}. */
276
+ interface CreateReactionVariables {
277
+ targetUri: string;
278
+ appId: string;
279
+ targetCid?: string;
280
+ }
281
+ type CreateReactionMutationResult = {
282
+ ok: true;
283
+ data: ReactionResult;
284
+ } | {
285
+ ok: false;
286
+ error: ReactionError;
287
+ };
288
+ /**
289
+ * React hook for creating a reaction. Returns the discriminated-union
290
+ * result so the caller can detect `scope_insufficient` and trigger an
291
+ * OAuth scope-upgrade flow.
292
+ *
293
+ * Invalidates the entire `sifaQueryKeys.reactions.all()` subtree on
294
+ * success (any cached `useReactionStatus` view that includes the new
295
+ * URI needs a refresh).
296
+ */
297
+ declare function useCreateReaction(options?: Omit<UseMutationOptions<CreateReactionMutationResult, Error, CreateReactionVariables>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<{
298
+ ok: true;
299
+ data: ReactionResult;
300
+ } | {
301
+ ok: false;
302
+ error: ReactionError;
303
+ }, Error, CreateReactionVariables, unknown>;
304
+ /** Variables for {@link useDeleteReaction}. */
305
+ interface DeleteReactionVariables {
306
+ targetUri: string;
307
+ appId: string;
308
+ }
309
+ /** React hook for deleting a reaction. */
310
+ declare function useDeleteReaction(options?: Omit<UseMutationOptions<WriteResult, Error, DeleteReactionVariables>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, DeleteReactionVariables, unknown>;
311
+
733
312
  /** Public roadmap vote tallies. Returns `{}` data on error. */
734
313
  declare function useRoadmapVotes(options?: Omit<UseQueryOptions<RoadmapVotesResponse, Error, RoadmapVotesResponse, ReturnType<typeof sifaQueryKeys.roadmap.votes>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<RoadmapVotesResponse, Error>;
735
314
  /** Roadmap items the authenticated viewer has voted on. Returns `[]` data on error. */
736
315
  declare function useMyRoadmapVotes(options?: Omit<UseQueryOptions<string[], Error, string[], ReturnType<typeof sifaQueryKeys.roadmap.myVotes>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<string[], Error>;
737
316
 
738
- export { type AccountCheckResult, type ActivityFeedResponse, type ActivityItem, type ActivityTeaserResponse, ApiError, type ApiFetchOptions, type AppRegistryEntry, type CheckAppAccountOptions, type CreateResult, type FeaturedProfile, type FetchActivityFeedOptions, type FetchActivityTeaserOptions, type FetchHiddenAppsOptions, type FetchMyRoadmapVotesOptions, type FetchNetworkStreamCountOptions, type FetchReactionStatusOptions, type FetchSuggestionsOptions, type FilterOptions, type FollowProfile, type FollowingResponse, type HeatmapDay, type HeatmapResponse, type HiddenApp, type ProfileSearchResult, QUOTED_POSTS_BATCH_MAX, type QuotedPostAuthor, type QuotedPostImage, type QuotedPostResult, type QuotedPostView, type ReactionStatus, type ResolveQuotedPostsOptions, type RoadmapVoter, type RoadmapVotesResponse, type SearchFilters, type SearchResponse, type SifaApiConfig, SifaProvider, type SifaProviderProps, type SifaQueryKey, type SimilarProfile, type SkillSearchResult, type StatsResponse, type SuggestionProfile, type SuggestionsResponse, type WriteResult, apiFetch, apiFetchOrNull, checkAppAccount, createPosition, fetchActivityFeed, fetchActivityTeaser, fetchAppsRegistry, fetchAtFundLink, fetchEndorsementCount, fetchFeaturedProfile, fetchFollowing, fetchHeatmapData, fetchHiddenApps, fetchMyRoadmapVotes, fetchNetworkStreamCount, fetchProfile, fetchReactionStatus, fetchRoadmapVotes, fetchSearchFilters, fetchSearchProfiles, fetchSimilarProfiles, fetchSkillSuggestions, fetchStats, fetchSuggestionCount, fetchSuggestions, resolveQuotedPosts, sifaQueryKeys, useActivityFeed, useActivityTeaser, useAppAccountCheck, useAppsRegistry, useAtFundLink, useCreatePosition, useEndorsementCount, useFeaturedProfile, useFollowing, useHeatmapData, useHiddenApps, useMyRoadmapVotes, useNetworkStreamCount, useProfile, useReactionStatus, useRoadmapVotes, useSearchFilters, useSearchProfiles, useSifaConfig, useSimilarProfiles, useSkillSuggestions, useStats, useSuggestionCount, useSuggestions };
317
+ /** React hook for casting a roadmap vote. Variable: the item key. */
318
+ declare function useCastRoadmapVote(options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, string, unknown>;
319
+ /** React hook for retracting a previously-cast roadmap vote. */
320
+ declare function useRetractRoadmapVote(options?: Omit<UseMutationOptions<WriteResult, Error, string>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, string, unknown>;
321
+
322
+ /**
323
+ * React hook for resetting the authenticated user's Sifa profile.
324
+ * Variable: `deletePdsData` boolean.
325
+ *
326
+ * Invalidates the entire `sifaQueryKeys.all()` subtree on success
327
+ * (everything Sifa-related needs a refresh after a reset).
328
+ */
329
+ declare function useResetProfile(options?: Omit<UseMutationOptions<WriteResult, Error, boolean>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<WriteResult, Error, boolean, unknown>;
330
+ /**
331
+ * React hook for deleting the authenticated user's account. Variable:
332
+ * `deletePdsData` boolean. Returns the deleted handle on success.
333
+ *
334
+ * On success, clears the entire query cache (the user is logged out
335
+ * and nothing they previously cached should be retained).
336
+ */
337
+ declare function useDeleteAccount(options?: Omit<UseMutationOptions<DeleteAccountResult, Error, boolean>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<DeleteAccountResult, Error, boolean, unknown>;
338
+
339
+ export { AccountCheckResult, ActivityFeedResponse, ActivityTeaserResponse, AppRegistryEntry, CreateExternalAccountResult, type CreateReactionVariables, type CreateRecordVariables, CreateResult, DeleteAccountResult, type DeleteReactionVariables, type DeleteRecordVariables, EndorsementInput, ExternalAccountInput, FeaturedProfile, FetchActivityFeedOptions, FetchSuggestionsOptions, FilterOptions, FollowingResponse, HeatmapResponse, HiddenApp, type PositionSkillLinkVariables, ProfileLocationInput, ReactionError, ReactionResult, ReactionStatus, RefreshOrcidPublicationsResult, RefreshPdsResult, RoadmapVotesResponse, SearchFilters, SearchResponse, SifaApiConfig, SifaProvider, type SifaProviderProps, SimilarProfile, SkillSearchResult, StatsResponse, SuggestionsResponse, type UpdateEducationVariables, type UpdateExternalAccountVariables, type UpdatePositionVariables, type UpdateProfileLocationVariables, UpdateProfileOverrideInput, UpdateProfileSelfInput, type UpdateRecordVariables, type UpdateSkillVariables, UploadAvatarResult, VerifyExternalAccountResult, WriteResult, sifaQueryKeys, useActivityFeed, useActivityTeaser, useAppAccountCheck, useAppsRegistry, useAtFundLink, useBulkHideStandardPublications, useBulkUnhideStandardPublications, useCanonicalSkillSearch, useCastRoadmapVote, useCreateEducation, useCreateEndorsement, useCreateExternalAccount, useCreatePosition, useCreateProfileLocation, useCreateReaction, useCreateRecord, useCreateSkill, useDeleteAccount, useDeleteAvatarOverride, useDeleteEducation, useDeleteExternalAccount, useDeletePosition, useDeleteProfileLocation, useDeleteReaction, useDeleteRecord, useDeleteSkill, useEndorsementCount, useExternalAccounts, useFeaturedProfile, useFollowing, useHeatmapData, useHiddenApps, useHideKeytraceClaim, useHideOrcidPublication, useHideSifaPublication, useHideStandardPublication, useLinkSkillToPosition, useMyRoadmapVotes, useNetworkStreamCount, useProfile, useReactionStatus, useRefreshOrcidPublications, useRefreshPds, useResetProfile, useRetractRoadmapVote, useRoadmapVotes, useSearchFilters, useSearchProfiles, useSetExternalAccountPrimary, useSetPositionPrimary, useSifaConfig, useSimilarProfiles, useSkillSuggestions, useStats, useSuggestionCount, useSuggestions, useUnhideKeytraceClaim, useUnhideOrcidPublication, useUnhideSifaPublication, useUnhideStandardPublication, useUnlinkSkillFromPosition, useUnsetExternalAccountPrimary, useUnsetPositionPrimary, useUpdateEducation, useUpdateExternalAccount, useUpdatePosition, useUpdateProfileLocation, useUpdateProfileOverride, useUpdateProfileSelf, useUpdateRecord, useUpdateSkill, useUploadAvatar, useVerifyExternalAccount };