@singi-labs/sifa-sdk 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/query/index.cjs +222 -5
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +220 -10
- package/dist/query/index.d.ts +220 -10
- package/dist/query/index.js +208 -7
- package/dist/query/index.js.map +1 -1
- package/package.json +1 -1
package/dist/query/index.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { P as Profile } from '../index-IDRpze8y.cjs';
|
|
4
4
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
|
-
import {
|
|
5
|
+
import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Foundation HTTP client for talking to the Sifa AppView.
|
|
@@ -122,15 +122,181 @@ interface CreateResult extends WriteResult {
|
|
|
122
122
|
*/
|
|
123
123
|
declare function createPosition(config: SifaApiConfig, data: Record<string, unknown>, options?: ApiFetchOptions): Promise<CreateResult>;
|
|
124
124
|
|
|
125
|
+
/** Profile entry returned by the search endpoint. */
|
|
126
|
+
interface ProfileSearchResult {
|
|
127
|
+
did?: string;
|
|
128
|
+
handle: string;
|
|
129
|
+
displayName?: string;
|
|
130
|
+
headline?: string;
|
|
131
|
+
avatar?: string;
|
|
132
|
+
about?: string;
|
|
133
|
+
currentRole?: string;
|
|
134
|
+
currentCompany?: string;
|
|
135
|
+
industry?: string;
|
|
136
|
+
domain?: string;
|
|
137
|
+
countryCode?: string;
|
|
138
|
+
locationCountry?: string;
|
|
139
|
+
preferredWorkplace?: string[];
|
|
140
|
+
claimed?: boolean;
|
|
141
|
+
blueskyVerified?: boolean;
|
|
142
|
+
blueskyVerifiedAt?: string | null;
|
|
143
|
+
}
|
|
144
|
+
interface SearchFilters {
|
|
145
|
+
q?: string;
|
|
146
|
+
skill?: string;
|
|
147
|
+
country?: string;
|
|
148
|
+
industry?: string;
|
|
149
|
+
domain?: string;
|
|
150
|
+
workplace?: string;
|
|
151
|
+
app?: string;
|
|
152
|
+
limit?: number;
|
|
153
|
+
}
|
|
154
|
+
interface SearchResponse {
|
|
155
|
+
profiles: ProfileSearchResult[];
|
|
156
|
+
total: number;
|
|
157
|
+
limit: number;
|
|
158
|
+
offset: number;
|
|
159
|
+
}
|
|
160
|
+
/** Skill typeahead suggestion. */
|
|
161
|
+
interface SkillSearchResult {
|
|
162
|
+
name: string;
|
|
163
|
+
slug: string;
|
|
164
|
+
category: string;
|
|
165
|
+
userCount: number;
|
|
166
|
+
}
|
|
167
|
+
interface FilterOptions {
|
|
168
|
+
countries: {
|
|
169
|
+
countryCode: string;
|
|
170
|
+
country: string;
|
|
171
|
+
count: number;
|
|
172
|
+
}[];
|
|
173
|
+
industries: {
|
|
174
|
+
industry: string;
|
|
175
|
+
count: number;
|
|
176
|
+
}[];
|
|
177
|
+
apps: {
|
|
178
|
+
appId: string;
|
|
179
|
+
count: number;
|
|
180
|
+
}[];
|
|
181
|
+
}
|
|
125
182
|
/**
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
* The owner DID is required so the mutation can target the correct
|
|
131
|
-
* profile cache entry for invalidation.
|
|
183
|
+
* Search profiles by free-text query and optional filters. Returns an
|
|
184
|
+
* empty result set when no filters are provided (matching sifa-web's
|
|
185
|
+
* "no input, no fetch" behavior).
|
|
132
186
|
*/
|
|
133
|
-
declare function
|
|
187
|
+
declare function fetchSearchProfiles(config: SifaApiConfig, filters: SearchFilters, options?: ApiFetchOptions): Promise<SearchResponse>;
|
|
188
|
+
/**
|
|
189
|
+
* Skill typeahead. Returns up to 8 matches for the given prefix. Empty
|
|
190
|
+
* input returns an empty array without hitting the server.
|
|
191
|
+
*/
|
|
192
|
+
declare function fetchSkillSuggestions(config: SifaApiConfig, query: string, options?: ApiFetchOptions): Promise<SkillSearchResult[]>;
|
|
193
|
+
/** Available filter facets (countries, industries, apps) for search UI. */
|
|
194
|
+
declare function fetchSearchFilters(config: SifaApiConfig, options?: ApiFetchOptions): Promise<FilterOptions>;
|
|
195
|
+
|
|
196
|
+
/** Lightweight profile representation used by discovery endpoints. */
|
|
197
|
+
interface SimilarProfile {
|
|
198
|
+
did: string;
|
|
199
|
+
handle: string;
|
|
200
|
+
displayName?: string | null;
|
|
201
|
+
avatar?: string | null;
|
|
202
|
+
headline?: string | null;
|
|
203
|
+
currentRole?: string | null;
|
|
204
|
+
currentCompany?: string | null;
|
|
205
|
+
industry?: string | null;
|
|
206
|
+
domain?: string | null;
|
|
207
|
+
}
|
|
208
|
+
interface SuggestionProfile {
|
|
209
|
+
did: string;
|
|
210
|
+
handle: string;
|
|
211
|
+
displayName?: string;
|
|
212
|
+
headline?: string;
|
|
213
|
+
avatarUrl?: string;
|
|
214
|
+
source: string;
|
|
215
|
+
dismissed: boolean;
|
|
216
|
+
blueskyVerified?: boolean;
|
|
217
|
+
}
|
|
218
|
+
interface SuggestionsResponse {
|
|
219
|
+
onSifa: SuggestionProfile[];
|
|
220
|
+
notOnSifa: SuggestionProfile[];
|
|
221
|
+
cursor?: string;
|
|
222
|
+
}
|
|
223
|
+
interface FeaturedProfile {
|
|
224
|
+
did: string;
|
|
225
|
+
handle: string;
|
|
226
|
+
displayName?: string;
|
|
227
|
+
avatar?: string;
|
|
228
|
+
pronouns?: string;
|
|
229
|
+
headline?: string;
|
|
230
|
+
about?: string;
|
|
231
|
+
currentRole?: string;
|
|
232
|
+
currentCompany?: string;
|
|
233
|
+
locationCountry?: string;
|
|
234
|
+
locationRegion?: string;
|
|
235
|
+
/** Legacy alias for `locationLocality`; emitted by sifa-api during the additive response window. */
|
|
236
|
+
locationCity?: string;
|
|
237
|
+
/** community.lexicon.location.address field name -- prefer over `locationCity`. */
|
|
238
|
+
locationLocality?: string;
|
|
239
|
+
countryCode?: string;
|
|
240
|
+
location?: string;
|
|
241
|
+
website?: string;
|
|
242
|
+
openTo?: string[];
|
|
243
|
+
preferredWorkplace?: string[];
|
|
244
|
+
availableFromUtc?: number;
|
|
245
|
+
availableToUtc?: number;
|
|
246
|
+
followersCount?: number;
|
|
247
|
+
atprotoFollowersCount?: number;
|
|
248
|
+
pdsProvider?: {
|
|
249
|
+
name: string;
|
|
250
|
+
host: string;
|
|
251
|
+
} | null;
|
|
252
|
+
claimed: boolean;
|
|
253
|
+
featuredDate: string;
|
|
254
|
+
}
|
|
255
|
+
/** Profiles similar to the given DID (matchmaking). Returns `[]` on error. */
|
|
256
|
+
declare function fetchSimilarProfiles(config: SifaApiConfig, did: string, opts?: {
|
|
257
|
+
limit?: number;
|
|
258
|
+
} & ApiFetchOptions): Promise<SimilarProfile[]>;
|
|
259
|
+
interface FetchSuggestionsOptions extends ApiFetchOptions {
|
|
260
|
+
source?: string;
|
|
261
|
+
includeDismissed?: boolean;
|
|
262
|
+
cursor?: string;
|
|
263
|
+
limit?: number;
|
|
264
|
+
/**
|
|
265
|
+
* Pass the caller's `Cookie` header on Next.js RSC server-side calls.
|
|
266
|
+
* `credentials: 'include'` does NOT propagate browser cookies in RSC,
|
|
267
|
+
* so authenticated server fetches must forward the header explicitly.
|
|
268
|
+
*/
|
|
269
|
+
cookieHeader?: string;
|
|
270
|
+
}
|
|
271
|
+
/** Discovery suggestions feed. Resolves to empty arrays on error. */
|
|
272
|
+
declare function fetchSuggestions(config: SifaApiConfig, opts?: FetchSuggestionsOptions): Promise<SuggestionsResponse>;
|
|
273
|
+
/** Count of pending suggestions since an optional timestamp. */
|
|
274
|
+
declare function fetchSuggestionCount(config: SifaApiConfig, since?: string, options?: ApiFetchOptions): Promise<number>;
|
|
275
|
+
/** Featured profile (rotated by sifa-api). Returns `null` when none. */
|
|
276
|
+
declare function fetchFeaturedProfile(config: SifaApiConfig, options?: ApiFetchOptions): Promise<FeaturedProfile | null>;
|
|
277
|
+
|
|
278
|
+
interface FollowProfile {
|
|
279
|
+
did: string;
|
|
280
|
+
handle: string;
|
|
281
|
+
displayName?: string;
|
|
282
|
+
headline?: string;
|
|
283
|
+
avatarUrl?: string;
|
|
284
|
+
source: string;
|
|
285
|
+
claimed: boolean;
|
|
286
|
+
followedAt: string;
|
|
287
|
+
blueskyVerified?: boolean;
|
|
288
|
+
blueskyVerifiedAt?: string | null;
|
|
289
|
+
}
|
|
290
|
+
interface FollowingResponse {
|
|
291
|
+
follows: FollowProfile[];
|
|
292
|
+
cursor?: string;
|
|
293
|
+
}
|
|
294
|
+
/** People the authenticated user follows. Empty on error. */
|
|
295
|
+
declare function fetchFollowing(config: SifaApiConfig, opts?: {
|
|
296
|
+
source?: string;
|
|
297
|
+
cursor?: string;
|
|
298
|
+
limit?: number;
|
|
299
|
+
} & ApiFetchOptions): Promise<FollowingResponse>;
|
|
134
300
|
|
|
135
301
|
/**
|
|
136
302
|
* Query key factory for TanStack Query.
|
|
@@ -153,8 +319,25 @@ declare const sifaQueryKeys: {
|
|
|
153
319
|
readonly all: () => readonly ["sifa", "position"];
|
|
154
320
|
readonly byOwner: (did: string) => readonly ["sifa", "position", "by-owner", string];
|
|
155
321
|
};
|
|
322
|
+
readonly search: {
|
|
323
|
+
readonly all: () => readonly ["sifa", "search"];
|
|
324
|
+
readonly profiles: (filters: Record<string, unknown>) => readonly ["sifa", "search", "profiles", Record<string, unknown>];
|
|
325
|
+
readonly skills: (query: string) => readonly ["sifa", "search", "skills", string];
|
|
326
|
+
readonly filters: () => readonly ["sifa", "search", "filters"];
|
|
327
|
+
};
|
|
328
|
+
readonly discovery: {
|
|
329
|
+
readonly all: () => readonly ["sifa", "discovery"];
|
|
330
|
+
readonly similar: (did: string, limit: number) => readonly ["sifa", "discovery", "similar", string, number];
|
|
331
|
+
readonly suggestions: (opts: Record<string, unknown>) => readonly ["sifa", "discovery", "suggestions", Record<string, unknown>];
|
|
332
|
+
readonly suggestionCount: (since: string | undefined) => readonly ["sifa", "discovery", "suggestion-count", string | null];
|
|
333
|
+
readonly featured: () => readonly ["sifa", "discovery", "featured"];
|
|
334
|
+
};
|
|
335
|
+
readonly follow: {
|
|
336
|
+
readonly all: () => readonly ["sifa", "follow"];
|
|
337
|
+
readonly following: (opts: Record<string, unknown>) => readonly ["sifa", "follow", "following", Record<string, unknown>];
|
|
338
|
+
};
|
|
156
339
|
};
|
|
157
|
-
type SifaQueryKey = ReturnType<typeof sifaQueryKeys.all> | ReturnType<typeof sifaQueryKeys.profile.all> | ReturnType<typeof sifaQueryKeys.profile.byHandle> | ReturnType<typeof sifaQueryKeys.position.all> | ReturnType<typeof sifaQueryKeys.position.byOwner>;
|
|
340
|
+
type SifaQueryKey = ReturnType<typeof sifaQueryKeys.all> | ReturnType<typeof sifaQueryKeys.profile.all> | ReturnType<typeof sifaQueryKeys.profile.byHandle> | 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>;
|
|
158
341
|
|
|
159
342
|
/**
|
|
160
343
|
* React hook that reads an aggregated profile by handle or DID via
|
|
@@ -165,4 +348,31 @@ type SifaQueryKey = ReturnType<typeof sifaQueryKeys.all> | ReturnType<typeof sif
|
|
|
165
348
|
*/
|
|
166
349
|
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>;
|
|
167
350
|
|
|
168
|
-
|
|
351
|
+
/**
|
|
352
|
+
* React hook for creating a new position record. On success, invalidates
|
|
353
|
+
* the owner's profile cache so the new position is reflected on the next
|
|
354
|
+
* read.
|
|
355
|
+
*
|
|
356
|
+
* The owner DID is required so the mutation can target the correct
|
|
357
|
+
* profile cache entry for invalidation.
|
|
358
|
+
*/
|
|
359
|
+
declare function useCreatePosition(ownerDid: string, options?: Omit<UseMutationOptions<CreateResult, Error, Record<string, unknown>>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<CreateResult, Error, Record<string, unknown>, unknown>;
|
|
360
|
+
|
|
361
|
+
declare function useSearchProfiles(filters: SearchFilters, options?: Omit<UseQueryOptions<SearchResponse, Error, SearchResponse, ReturnType<typeof sifaQueryKeys.search.profiles>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<SearchResponse, Error>;
|
|
362
|
+
declare function useSkillSuggestions(query: string, options?: Omit<UseQueryOptions<SkillSearchResult[], Error, SkillSearchResult[], ReturnType<typeof sifaQueryKeys.search.skills>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<SkillSearchResult[], Error>;
|
|
363
|
+
declare function useSearchFilters(options?: Omit<UseQueryOptions<FilterOptions, Error, FilterOptions, ReturnType<typeof sifaQueryKeys.search.filters>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<FilterOptions, Error>;
|
|
364
|
+
|
|
365
|
+
declare function useSimilarProfiles(did: string | undefined | null, opts?: {
|
|
366
|
+
limit?: number;
|
|
367
|
+
}, options?: Omit<UseQueryOptions<SimilarProfile[], Error, SimilarProfile[], ReturnType<typeof sifaQueryKeys.discovery.similar>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<SimilarProfile[], Error>;
|
|
368
|
+
declare function useSuggestions(opts?: Omit<FetchSuggestionsOptions, keyof Omit<FetchSuggestionsOptions, 'source' | 'includeDismissed' | 'cursor' | 'limit'>>, options?: Omit<UseQueryOptions<SuggestionsResponse, Error, SuggestionsResponse, ReturnType<typeof sifaQueryKeys.discovery.suggestions>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<SuggestionsResponse, Error>;
|
|
369
|
+
declare function useSuggestionCount(since?: string, options?: Omit<UseQueryOptions<number, Error, number, ReturnType<typeof sifaQueryKeys.discovery.suggestionCount>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<number, Error>;
|
|
370
|
+
declare function useFeaturedProfile(options?: Omit<UseQueryOptions<FeaturedProfile | null, Error, FeaturedProfile | null, ReturnType<typeof sifaQueryKeys.discovery.featured>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<FeaturedProfile | null, Error>;
|
|
371
|
+
|
|
372
|
+
declare function useFollowing(opts?: {
|
|
373
|
+
source?: string;
|
|
374
|
+
cursor?: string;
|
|
375
|
+
limit?: number;
|
|
376
|
+
}, options?: Omit<UseQueryOptions<FollowingResponse, Error, FollowingResponse, ReturnType<typeof sifaQueryKeys.follow.following>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<FollowingResponse, Error>;
|
|
377
|
+
|
|
378
|
+
export { ApiError, type ApiFetchOptions, type CreateResult, type FeaturedProfile, type FetchSuggestionsOptions, type FilterOptions, type FollowProfile, type FollowingResponse, type ProfileSearchResult, type SearchFilters, type SearchResponse, type SifaApiConfig, SifaProvider, type SifaProviderProps, type SifaQueryKey, type SimilarProfile, type SkillSearchResult, type SuggestionProfile, type SuggestionsResponse, type WriteResult, apiFetch, apiFetchOrNull, createPosition, fetchFeaturedProfile, fetchFollowing, fetchProfile, fetchSearchFilters, fetchSearchProfiles, fetchSimilarProfiles, fetchSkillSuggestions, fetchSuggestionCount, fetchSuggestions, sifaQueryKeys, useCreatePosition, useFeaturedProfile, useFollowing, useProfile, useSearchFilters, useSearchProfiles, useSifaConfig, useSimilarProfiles, useSkillSuggestions, useSuggestionCount, useSuggestions };
|
package/dist/query/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { P as Profile } from '../index-IDRpze8y.js';
|
|
4
4
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
|
-
import {
|
|
5
|
+
import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Foundation HTTP client for talking to the Sifa AppView.
|
|
@@ -122,15 +122,181 @@ interface CreateResult extends WriteResult {
|
|
|
122
122
|
*/
|
|
123
123
|
declare function createPosition(config: SifaApiConfig, data: Record<string, unknown>, options?: ApiFetchOptions): Promise<CreateResult>;
|
|
124
124
|
|
|
125
|
+
/** Profile entry returned by the search endpoint. */
|
|
126
|
+
interface ProfileSearchResult {
|
|
127
|
+
did?: string;
|
|
128
|
+
handle: string;
|
|
129
|
+
displayName?: string;
|
|
130
|
+
headline?: string;
|
|
131
|
+
avatar?: string;
|
|
132
|
+
about?: string;
|
|
133
|
+
currentRole?: string;
|
|
134
|
+
currentCompany?: string;
|
|
135
|
+
industry?: string;
|
|
136
|
+
domain?: string;
|
|
137
|
+
countryCode?: string;
|
|
138
|
+
locationCountry?: string;
|
|
139
|
+
preferredWorkplace?: string[];
|
|
140
|
+
claimed?: boolean;
|
|
141
|
+
blueskyVerified?: boolean;
|
|
142
|
+
blueskyVerifiedAt?: string | null;
|
|
143
|
+
}
|
|
144
|
+
interface SearchFilters {
|
|
145
|
+
q?: string;
|
|
146
|
+
skill?: string;
|
|
147
|
+
country?: string;
|
|
148
|
+
industry?: string;
|
|
149
|
+
domain?: string;
|
|
150
|
+
workplace?: string;
|
|
151
|
+
app?: string;
|
|
152
|
+
limit?: number;
|
|
153
|
+
}
|
|
154
|
+
interface SearchResponse {
|
|
155
|
+
profiles: ProfileSearchResult[];
|
|
156
|
+
total: number;
|
|
157
|
+
limit: number;
|
|
158
|
+
offset: number;
|
|
159
|
+
}
|
|
160
|
+
/** Skill typeahead suggestion. */
|
|
161
|
+
interface SkillSearchResult {
|
|
162
|
+
name: string;
|
|
163
|
+
slug: string;
|
|
164
|
+
category: string;
|
|
165
|
+
userCount: number;
|
|
166
|
+
}
|
|
167
|
+
interface FilterOptions {
|
|
168
|
+
countries: {
|
|
169
|
+
countryCode: string;
|
|
170
|
+
country: string;
|
|
171
|
+
count: number;
|
|
172
|
+
}[];
|
|
173
|
+
industries: {
|
|
174
|
+
industry: string;
|
|
175
|
+
count: number;
|
|
176
|
+
}[];
|
|
177
|
+
apps: {
|
|
178
|
+
appId: string;
|
|
179
|
+
count: number;
|
|
180
|
+
}[];
|
|
181
|
+
}
|
|
125
182
|
/**
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
* The owner DID is required so the mutation can target the correct
|
|
131
|
-
* profile cache entry for invalidation.
|
|
183
|
+
* Search profiles by free-text query and optional filters. Returns an
|
|
184
|
+
* empty result set when no filters are provided (matching sifa-web's
|
|
185
|
+
* "no input, no fetch" behavior).
|
|
132
186
|
*/
|
|
133
|
-
declare function
|
|
187
|
+
declare function fetchSearchProfiles(config: SifaApiConfig, filters: SearchFilters, options?: ApiFetchOptions): Promise<SearchResponse>;
|
|
188
|
+
/**
|
|
189
|
+
* Skill typeahead. Returns up to 8 matches for the given prefix. Empty
|
|
190
|
+
* input returns an empty array without hitting the server.
|
|
191
|
+
*/
|
|
192
|
+
declare function fetchSkillSuggestions(config: SifaApiConfig, query: string, options?: ApiFetchOptions): Promise<SkillSearchResult[]>;
|
|
193
|
+
/** Available filter facets (countries, industries, apps) for search UI. */
|
|
194
|
+
declare function fetchSearchFilters(config: SifaApiConfig, options?: ApiFetchOptions): Promise<FilterOptions>;
|
|
195
|
+
|
|
196
|
+
/** Lightweight profile representation used by discovery endpoints. */
|
|
197
|
+
interface SimilarProfile {
|
|
198
|
+
did: string;
|
|
199
|
+
handle: string;
|
|
200
|
+
displayName?: string | null;
|
|
201
|
+
avatar?: string | null;
|
|
202
|
+
headline?: string | null;
|
|
203
|
+
currentRole?: string | null;
|
|
204
|
+
currentCompany?: string | null;
|
|
205
|
+
industry?: string | null;
|
|
206
|
+
domain?: string | null;
|
|
207
|
+
}
|
|
208
|
+
interface SuggestionProfile {
|
|
209
|
+
did: string;
|
|
210
|
+
handle: string;
|
|
211
|
+
displayName?: string;
|
|
212
|
+
headline?: string;
|
|
213
|
+
avatarUrl?: string;
|
|
214
|
+
source: string;
|
|
215
|
+
dismissed: boolean;
|
|
216
|
+
blueskyVerified?: boolean;
|
|
217
|
+
}
|
|
218
|
+
interface SuggestionsResponse {
|
|
219
|
+
onSifa: SuggestionProfile[];
|
|
220
|
+
notOnSifa: SuggestionProfile[];
|
|
221
|
+
cursor?: string;
|
|
222
|
+
}
|
|
223
|
+
interface FeaturedProfile {
|
|
224
|
+
did: string;
|
|
225
|
+
handle: string;
|
|
226
|
+
displayName?: string;
|
|
227
|
+
avatar?: string;
|
|
228
|
+
pronouns?: string;
|
|
229
|
+
headline?: string;
|
|
230
|
+
about?: string;
|
|
231
|
+
currentRole?: string;
|
|
232
|
+
currentCompany?: string;
|
|
233
|
+
locationCountry?: string;
|
|
234
|
+
locationRegion?: string;
|
|
235
|
+
/** Legacy alias for `locationLocality`; emitted by sifa-api during the additive response window. */
|
|
236
|
+
locationCity?: string;
|
|
237
|
+
/** community.lexicon.location.address field name -- prefer over `locationCity`. */
|
|
238
|
+
locationLocality?: string;
|
|
239
|
+
countryCode?: string;
|
|
240
|
+
location?: string;
|
|
241
|
+
website?: string;
|
|
242
|
+
openTo?: string[];
|
|
243
|
+
preferredWorkplace?: string[];
|
|
244
|
+
availableFromUtc?: number;
|
|
245
|
+
availableToUtc?: number;
|
|
246
|
+
followersCount?: number;
|
|
247
|
+
atprotoFollowersCount?: number;
|
|
248
|
+
pdsProvider?: {
|
|
249
|
+
name: string;
|
|
250
|
+
host: string;
|
|
251
|
+
} | null;
|
|
252
|
+
claimed: boolean;
|
|
253
|
+
featuredDate: string;
|
|
254
|
+
}
|
|
255
|
+
/** Profiles similar to the given DID (matchmaking). Returns `[]` on error. */
|
|
256
|
+
declare function fetchSimilarProfiles(config: SifaApiConfig, did: string, opts?: {
|
|
257
|
+
limit?: number;
|
|
258
|
+
} & ApiFetchOptions): Promise<SimilarProfile[]>;
|
|
259
|
+
interface FetchSuggestionsOptions extends ApiFetchOptions {
|
|
260
|
+
source?: string;
|
|
261
|
+
includeDismissed?: boolean;
|
|
262
|
+
cursor?: string;
|
|
263
|
+
limit?: number;
|
|
264
|
+
/**
|
|
265
|
+
* Pass the caller's `Cookie` header on Next.js RSC server-side calls.
|
|
266
|
+
* `credentials: 'include'` does NOT propagate browser cookies in RSC,
|
|
267
|
+
* so authenticated server fetches must forward the header explicitly.
|
|
268
|
+
*/
|
|
269
|
+
cookieHeader?: string;
|
|
270
|
+
}
|
|
271
|
+
/** Discovery suggestions feed. Resolves to empty arrays on error. */
|
|
272
|
+
declare function fetchSuggestions(config: SifaApiConfig, opts?: FetchSuggestionsOptions): Promise<SuggestionsResponse>;
|
|
273
|
+
/** Count of pending suggestions since an optional timestamp. */
|
|
274
|
+
declare function fetchSuggestionCount(config: SifaApiConfig, since?: string, options?: ApiFetchOptions): Promise<number>;
|
|
275
|
+
/** Featured profile (rotated by sifa-api). Returns `null` when none. */
|
|
276
|
+
declare function fetchFeaturedProfile(config: SifaApiConfig, options?: ApiFetchOptions): Promise<FeaturedProfile | null>;
|
|
277
|
+
|
|
278
|
+
interface FollowProfile {
|
|
279
|
+
did: string;
|
|
280
|
+
handle: string;
|
|
281
|
+
displayName?: string;
|
|
282
|
+
headline?: string;
|
|
283
|
+
avatarUrl?: string;
|
|
284
|
+
source: string;
|
|
285
|
+
claimed: boolean;
|
|
286
|
+
followedAt: string;
|
|
287
|
+
blueskyVerified?: boolean;
|
|
288
|
+
blueskyVerifiedAt?: string | null;
|
|
289
|
+
}
|
|
290
|
+
interface FollowingResponse {
|
|
291
|
+
follows: FollowProfile[];
|
|
292
|
+
cursor?: string;
|
|
293
|
+
}
|
|
294
|
+
/** People the authenticated user follows. Empty on error. */
|
|
295
|
+
declare function fetchFollowing(config: SifaApiConfig, opts?: {
|
|
296
|
+
source?: string;
|
|
297
|
+
cursor?: string;
|
|
298
|
+
limit?: number;
|
|
299
|
+
} & ApiFetchOptions): Promise<FollowingResponse>;
|
|
134
300
|
|
|
135
301
|
/**
|
|
136
302
|
* Query key factory for TanStack Query.
|
|
@@ -153,8 +319,25 @@ declare const sifaQueryKeys: {
|
|
|
153
319
|
readonly all: () => readonly ["sifa", "position"];
|
|
154
320
|
readonly byOwner: (did: string) => readonly ["sifa", "position", "by-owner", string];
|
|
155
321
|
};
|
|
322
|
+
readonly search: {
|
|
323
|
+
readonly all: () => readonly ["sifa", "search"];
|
|
324
|
+
readonly profiles: (filters: Record<string, unknown>) => readonly ["sifa", "search", "profiles", Record<string, unknown>];
|
|
325
|
+
readonly skills: (query: string) => readonly ["sifa", "search", "skills", string];
|
|
326
|
+
readonly filters: () => readonly ["sifa", "search", "filters"];
|
|
327
|
+
};
|
|
328
|
+
readonly discovery: {
|
|
329
|
+
readonly all: () => readonly ["sifa", "discovery"];
|
|
330
|
+
readonly similar: (did: string, limit: number) => readonly ["sifa", "discovery", "similar", string, number];
|
|
331
|
+
readonly suggestions: (opts: Record<string, unknown>) => readonly ["sifa", "discovery", "suggestions", Record<string, unknown>];
|
|
332
|
+
readonly suggestionCount: (since: string | undefined) => readonly ["sifa", "discovery", "suggestion-count", string | null];
|
|
333
|
+
readonly featured: () => readonly ["sifa", "discovery", "featured"];
|
|
334
|
+
};
|
|
335
|
+
readonly follow: {
|
|
336
|
+
readonly all: () => readonly ["sifa", "follow"];
|
|
337
|
+
readonly following: (opts: Record<string, unknown>) => readonly ["sifa", "follow", "following", Record<string, unknown>];
|
|
338
|
+
};
|
|
156
339
|
};
|
|
157
|
-
type SifaQueryKey = ReturnType<typeof sifaQueryKeys.all> | ReturnType<typeof sifaQueryKeys.profile.all> | ReturnType<typeof sifaQueryKeys.profile.byHandle> | ReturnType<typeof sifaQueryKeys.position.all> | ReturnType<typeof sifaQueryKeys.position.byOwner>;
|
|
340
|
+
type SifaQueryKey = ReturnType<typeof sifaQueryKeys.all> | ReturnType<typeof sifaQueryKeys.profile.all> | ReturnType<typeof sifaQueryKeys.profile.byHandle> | 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>;
|
|
158
341
|
|
|
159
342
|
/**
|
|
160
343
|
* React hook that reads an aggregated profile by handle or DID via
|
|
@@ -165,4 +348,31 @@ type SifaQueryKey = ReturnType<typeof sifaQueryKeys.all> | ReturnType<typeof sif
|
|
|
165
348
|
*/
|
|
166
349
|
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>;
|
|
167
350
|
|
|
168
|
-
|
|
351
|
+
/**
|
|
352
|
+
* React hook for creating a new position record. On success, invalidates
|
|
353
|
+
* the owner's profile cache so the new position is reflected on the next
|
|
354
|
+
* read.
|
|
355
|
+
*
|
|
356
|
+
* The owner DID is required so the mutation can target the correct
|
|
357
|
+
* profile cache entry for invalidation.
|
|
358
|
+
*/
|
|
359
|
+
declare function useCreatePosition(ownerDid: string, options?: Omit<UseMutationOptions<CreateResult, Error, Record<string, unknown>>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<CreateResult, Error, Record<string, unknown>, unknown>;
|
|
360
|
+
|
|
361
|
+
declare function useSearchProfiles(filters: SearchFilters, options?: Omit<UseQueryOptions<SearchResponse, Error, SearchResponse, ReturnType<typeof sifaQueryKeys.search.profiles>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<SearchResponse, Error>;
|
|
362
|
+
declare function useSkillSuggestions(query: string, options?: Omit<UseQueryOptions<SkillSearchResult[], Error, SkillSearchResult[], ReturnType<typeof sifaQueryKeys.search.skills>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<SkillSearchResult[], Error>;
|
|
363
|
+
declare function useSearchFilters(options?: Omit<UseQueryOptions<FilterOptions, Error, FilterOptions, ReturnType<typeof sifaQueryKeys.search.filters>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<FilterOptions, Error>;
|
|
364
|
+
|
|
365
|
+
declare function useSimilarProfiles(did: string | undefined | null, opts?: {
|
|
366
|
+
limit?: number;
|
|
367
|
+
}, options?: Omit<UseQueryOptions<SimilarProfile[], Error, SimilarProfile[], ReturnType<typeof sifaQueryKeys.discovery.similar>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<SimilarProfile[], Error>;
|
|
368
|
+
declare function useSuggestions(opts?: Omit<FetchSuggestionsOptions, keyof Omit<FetchSuggestionsOptions, 'source' | 'includeDismissed' | 'cursor' | 'limit'>>, options?: Omit<UseQueryOptions<SuggestionsResponse, Error, SuggestionsResponse, ReturnType<typeof sifaQueryKeys.discovery.suggestions>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<SuggestionsResponse, Error>;
|
|
369
|
+
declare function useSuggestionCount(since?: string, options?: Omit<UseQueryOptions<number, Error, number, ReturnType<typeof sifaQueryKeys.discovery.suggestionCount>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<number, Error>;
|
|
370
|
+
declare function useFeaturedProfile(options?: Omit<UseQueryOptions<FeaturedProfile | null, Error, FeaturedProfile | null, ReturnType<typeof sifaQueryKeys.discovery.featured>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<FeaturedProfile | null, Error>;
|
|
371
|
+
|
|
372
|
+
declare function useFollowing(opts?: {
|
|
373
|
+
source?: string;
|
|
374
|
+
cursor?: string;
|
|
375
|
+
limit?: number;
|
|
376
|
+
}, options?: Omit<UseQueryOptions<FollowingResponse, Error, FollowingResponse, ReturnType<typeof sifaQueryKeys.follow.following>>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<FollowingResponse, Error>;
|
|
377
|
+
|
|
378
|
+
export { ApiError, type ApiFetchOptions, type CreateResult, type FeaturedProfile, type FetchSuggestionsOptions, type FilterOptions, type FollowProfile, type FollowingResponse, type ProfileSearchResult, type SearchFilters, type SearchResponse, type SifaApiConfig, SifaProvider, type SifaProviderProps, type SifaQueryKey, type SimilarProfile, type SkillSearchResult, type SuggestionProfile, type SuggestionsResponse, type WriteResult, apiFetch, apiFetchOrNull, createPosition, fetchFeaturedProfile, fetchFollowing, fetchProfile, fetchSearchFilters, fetchSearchProfiles, fetchSimilarProfiles, fetchSkillSuggestions, fetchSuggestionCount, fetchSuggestions, sifaQueryKeys, useCreatePosition, useFeaturedProfile, useFollowing, useProfile, useSearchFilters, useSearchProfiles, useSifaConfig, useSimilarProfiles, useSkillSuggestions, useSuggestionCount, useSuggestions };
|