@singi-labs/sifa-sdk 0.6.0 → 0.7.1
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-IDRpze8y.d.cts → index-CpM21_Oy.d.cts} +1 -1
- package/dist/{index-IDRpze8y.d.ts → index-CpM21_Oy.d.ts} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/query/index.cjs +607 -5
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +520 -10
- package/dist/query/index.d.ts +520 -10
- package/dist/query/index.js +567 -7
- package/dist/query/index.js.map +1 -1
- package/package.json +1 -1
package/dist/query/index.cjs
CHANGED
|
@@ -97,6 +97,19 @@ function fetchProfile(config, handleOrDid, options = {}) {
|
|
|
97
97
|
...options
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
|
+
async function fetchAtFundLink(config, did, options = {}) {
|
|
101
|
+
const path = `/api/profiles/${encodeURIComponent(did)}/at-fund-link`;
|
|
102
|
+
try {
|
|
103
|
+
const data = await apiFetch(config, path, {
|
|
104
|
+
next: { revalidate: 3600 },
|
|
105
|
+
timeoutMs: 5e3,
|
|
106
|
+
...options
|
|
107
|
+
});
|
|
108
|
+
return typeof data.url === "string" ? data.url : null;
|
|
109
|
+
} catch {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
100
113
|
|
|
101
114
|
// src/query/fetchers/positions.ts
|
|
102
115
|
function createPosition(config, data, options = {}) {
|
|
@@ -108,20 +121,407 @@ function createPosition(config, data, options = {}) {
|
|
|
108
121
|
});
|
|
109
122
|
}
|
|
110
123
|
|
|
124
|
+
// src/query/fetchers/stats.ts
|
|
125
|
+
async function fetchStats(config, options = {}) {
|
|
126
|
+
try {
|
|
127
|
+
return await apiFetch(config, "/api/stats", {
|
|
128
|
+
next: { revalidate: 900 },
|
|
129
|
+
...options
|
|
130
|
+
});
|
|
131
|
+
} catch {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// src/query/fetchers/apps.ts
|
|
137
|
+
async function fetchAppsRegistry(config, options = {}) {
|
|
138
|
+
try {
|
|
139
|
+
return await apiFetch(config, "/api/apps/registry", {
|
|
140
|
+
next: { revalidate: 86400 },
|
|
141
|
+
...options
|
|
142
|
+
});
|
|
143
|
+
} catch {
|
|
144
|
+
return [];
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
async function fetchHiddenApps(config, options = {}) {
|
|
148
|
+
const headers = { ...options.headers ?? {} };
|
|
149
|
+
if (options.cookieHeader) headers.cookie = options.cookieHeader;
|
|
150
|
+
try {
|
|
151
|
+
const data = await apiFetch(config, "/api/profile/hidden-apps", {
|
|
152
|
+
credentials: "include",
|
|
153
|
+
...options,
|
|
154
|
+
headers
|
|
155
|
+
});
|
|
156
|
+
return data.apps;
|
|
157
|
+
} catch {
|
|
158
|
+
return [];
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// src/query/fetchers/search.ts
|
|
163
|
+
var EMPTY_SEARCH = { profiles: [], total: 0, limit: 20, offset: 0 };
|
|
164
|
+
var EMPTY_FILTERS = { countries: [], industries: [], apps: [] };
|
|
165
|
+
async function fetchSearchProfiles(config, filters, options = {}) {
|
|
166
|
+
const params = new URLSearchParams();
|
|
167
|
+
if (filters.q) params.set("q", filters.q);
|
|
168
|
+
if (filters.skill) params.set("skill", filters.skill);
|
|
169
|
+
if (filters.country) params.set("country", filters.country);
|
|
170
|
+
if (filters.industry) params.set("industry", filters.industry);
|
|
171
|
+
if (filters.domain) params.set("domain", filters.domain);
|
|
172
|
+
if (filters.workplace) params.set("workplace", filters.workplace);
|
|
173
|
+
if (filters.app) params.set("app", filters.app);
|
|
174
|
+
if (filters.limit !== void 0) params.set("limit", String(filters.limit));
|
|
175
|
+
if (params.size === 0) return EMPTY_SEARCH;
|
|
176
|
+
return apiFetch(config, `/api/search/profiles?${params.toString()}`, {
|
|
177
|
+
cache: "no-store",
|
|
178
|
+
...options
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
async function fetchSkillSuggestions(config, query, options = {}) {
|
|
182
|
+
if (!query.trim()) return [];
|
|
183
|
+
const path = `/api/search/skills?q=${encodeURIComponent(query)}&limit=8`;
|
|
184
|
+
const data = await apiFetch(config, path, {
|
|
185
|
+
cache: "no-store",
|
|
186
|
+
...options
|
|
187
|
+
});
|
|
188
|
+
return data.skills ?? [];
|
|
189
|
+
}
|
|
190
|
+
async function fetchSearchFilters(config, options = {}) {
|
|
191
|
+
try {
|
|
192
|
+
return await apiFetch(config, "/api/search/filters", {
|
|
193
|
+
next: { revalidate: 300 },
|
|
194
|
+
...options
|
|
195
|
+
});
|
|
196
|
+
} catch {
|
|
197
|
+
return EMPTY_FILTERS;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// src/query/fetchers/discovery.ts
|
|
202
|
+
async function fetchSimilarProfiles(config, did, opts = {}) {
|
|
203
|
+
const limit = opts.limit ?? 5;
|
|
204
|
+
const path = `/api/discover/similar/${encodeURIComponent(did)}?limit=${limit}`;
|
|
205
|
+
try {
|
|
206
|
+
const data = await apiFetch(config, path, {
|
|
207
|
+
next: { revalidate: 300 },
|
|
208
|
+
timeoutMs: 5e3,
|
|
209
|
+
...opts
|
|
210
|
+
});
|
|
211
|
+
return data.profiles ?? [];
|
|
212
|
+
} catch {
|
|
213
|
+
return [];
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
async function fetchSuggestions(config, opts = {}) {
|
|
217
|
+
const params = new URLSearchParams();
|
|
218
|
+
if (opts.source) params.set("source", opts.source);
|
|
219
|
+
if (opts.includeDismissed) params.set("include_dismissed", "true");
|
|
220
|
+
if (opts.cursor) params.set("cursor", opts.cursor);
|
|
221
|
+
if (opts.limit) params.set("limit", String(opts.limit));
|
|
222
|
+
const qs = params.toString();
|
|
223
|
+
const headers = { ...opts.headers ?? {} };
|
|
224
|
+
if (opts.cookieHeader) headers.cookie = opts.cookieHeader;
|
|
225
|
+
try {
|
|
226
|
+
return await apiFetch(config, `/api/suggestions${qs ? `?${qs}` : ""}`, {
|
|
227
|
+
credentials: "include",
|
|
228
|
+
cache: "no-store",
|
|
229
|
+
timeoutMs: 8e3,
|
|
230
|
+
...opts,
|
|
231
|
+
headers
|
|
232
|
+
});
|
|
233
|
+
} catch {
|
|
234
|
+
return { onSifa: [], notOnSifa: [] };
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
async function fetchSuggestionCount(config, since, options = {}) {
|
|
238
|
+
const params = since ? `?since=${encodeURIComponent(since)}` : "";
|
|
239
|
+
try {
|
|
240
|
+
const data = await apiFetch(config, `/api/suggestions/count${params}`, {
|
|
241
|
+
credentials: "include",
|
|
242
|
+
cache: "no-store",
|
|
243
|
+
...options
|
|
244
|
+
});
|
|
245
|
+
return data.count ?? 0;
|
|
246
|
+
} catch {
|
|
247
|
+
return 0;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
async function fetchFeaturedProfile(config, options = {}) {
|
|
251
|
+
try {
|
|
252
|
+
return await apiFetch(config, "/api/featured-profile", {
|
|
253
|
+
next: { revalidate: 900 },
|
|
254
|
+
...options
|
|
255
|
+
});
|
|
256
|
+
} catch {
|
|
257
|
+
return null;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// src/query/fetchers/follow.ts
|
|
262
|
+
async function fetchFollowing(config, opts = {}) {
|
|
263
|
+
const params = new URLSearchParams();
|
|
264
|
+
if (opts.source) params.set("source", opts.source);
|
|
265
|
+
if (opts.cursor) params.set("cursor", opts.cursor);
|
|
266
|
+
if (opts.limit) params.set("limit", String(opts.limit));
|
|
267
|
+
const qs = params.toString();
|
|
268
|
+
try {
|
|
269
|
+
return await apiFetch(config, `/api/following${qs ? `?${qs}` : ""}`, {
|
|
270
|
+
credentials: "include",
|
|
271
|
+
cache: "no-store",
|
|
272
|
+
...opts
|
|
273
|
+
});
|
|
274
|
+
} catch {
|
|
275
|
+
return { follows: [] };
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// src/query/fetchers/activity.ts
|
|
280
|
+
async function fetchHeatmapData(config, handleOrDid, days, options = {}) {
|
|
281
|
+
const path = `/api/activity/${encodeURIComponent(handleOrDid)}/heatmap?days=${days}`;
|
|
282
|
+
try {
|
|
283
|
+
return await apiFetch(config, path, {
|
|
284
|
+
next: { revalidate: 900, tags: [`heatmap-${handleOrDid}`] },
|
|
285
|
+
...options
|
|
286
|
+
});
|
|
287
|
+
} catch {
|
|
288
|
+
return null;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
async function fetchActivityTeaser(config, handleOrDid, options = {}) {
|
|
292
|
+
const headers = { ...options.headers ?? {} };
|
|
293
|
+
if (options.cookieHeader) headers.cookie = options.cookieHeader;
|
|
294
|
+
try {
|
|
295
|
+
return await apiFetch(
|
|
296
|
+
config,
|
|
297
|
+
`/api/activity/${encodeURIComponent(handleOrDid)}/teaser`,
|
|
298
|
+
{
|
|
299
|
+
credentials: "include",
|
|
300
|
+
timeoutMs: 8e3,
|
|
301
|
+
next: { revalidate: 300, tags: [`activity-teaser-${handleOrDid}`] },
|
|
302
|
+
...options,
|
|
303
|
+
headers
|
|
304
|
+
}
|
|
305
|
+
);
|
|
306
|
+
} catch {
|
|
307
|
+
return null;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
async function fetchActivityFeed(config, handleOrDid, options = {}) {
|
|
311
|
+
const params = new URLSearchParams();
|
|
312
|
+
if (options.category) params.set("category", options.category);
|
|
313
|
+
if (options.limit) params.set("limit", String(options.limit));
|
|
314
|
+
if (options.cursor) params.set("cursor", options.cursor);
|
|
315
|
+
const qs = params.toString();
|
|
316
|
+
const headers = { ...options.headers ?? {} };
|
|
317
|
+
if (options.cookieHeader) headers.cookie = options.cookieHeader;
|
|
318
|
+
try {
|
|
319
|
+
return await apiFetch(
|
|
320
|
+
config,
|
|
321
|
+
`/api/activity/${encodeURIComponent(handleOrDid)}${qs ? `?${qs}` : ""}`,
|
|
322
|
+
{
|
|
323
|
+
credentials: "include",
|
|
324
|
+
cache: "no-store",
|
|
325
|
+
...options,
|
|
326
|
+
headers
|
|
327
|
+
}
|
|
328
|
+
);
|
|
329
|
+
} catch {
|
|
330
|
+
return null;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// src/query/fetchers/endorsement.ts
|
|
335
|
+
async function fetchEndorsementCount(config, did, options = {}) {
|
|
336
|
+
const path = `/api/endorsement/${encodeURIComponent(did)}`;
|
|
337
|
+
try {
|
|
338
|
+
const data = await apiFetch(config, path, {
|
|
339
|
+
cache: "no-store",
|
|
340
|
+
timeoutMs: 5e3,
|
|
341
|
+
...options
|
|
342
|
+
});
|
|
343
|
+
if (typeof data !== "object" || data === null || !("endorsements" in data)) {
|
|
344
|
+
return 0;
|
|
345
|
+
}
|
|
346
|
+
const endorsements = data.endorsements;
|
|
347
|
+
return Array.isArray(endorsements) ? endorsements.length : 0;
|
|
348
|
+
} catch {
|
|
349
|
+
return 0;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// src/query/fetchers/stream.ts
|
|
354
|
+
async function fetchNetworkStreamCount(config, did, options = {}) {
|
|
355
|
+
const headers = { ...options.headers ?? {} };
|
|
356
|
+
if (options.cookieHeader) headers.cookie = options.cookieHeader;
|
|
357
|
+
try {
|
|
358
|
+
const data = await apiFetch(
|
|
359
|
+
config,
|
|
360
|
+
`/api/stream/network?did=${encodeURIComponent(did)}`,
|
|
361
|
+
{
|
|
362
|
+
cache: "no-store",
|
|
363
|
+
timeoutMs: 5e3,
|
|
364
|
+
...options.cookieHeader ? {} : { credentials: "include" },
|
|
365
|
+
...options,
|
|
366
|
+
headers
|
|
367
|
+
}
|
|
368
|
+
);
|
|
369
|
+
if (typeof data !== "object" || data === null || !("items" in data)) {
|
|
370
|
+
return 0;
|
|
371
|
+
}
|
|
372
|
+
const items = data.items;
|
|
373
|
+
return Array.isArray(items) ? items.length : 0;
|
|
374
|
+
} catch {
|
|
375
|
+
return 0;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// src/query/fetchers/reactions.ts
|
|
380
|
+
async function fetchReactionStatus(config, uris, options = {}) {
|
|
381
|
+
if (uris.length === 0) return {};
|
|
382
|
+
const headers = { ...options.headers ?? {} };
|
|
383
|
+
if (options.cookieHeader) headers.cookie = options.cookieHeader;
|
|
384
|
+
try {
|
|
385
|
+
return await apiFetch(
|
|
386
|
+
config,
|
|
387
|
+
`/api/reactions/status?uris=${encodeURIComponent(uris.join(","))}`,
|
|
388
|
+
{
|
|
389
|
+
credentials: "include",
|
|
390
|
+
...options,
|
|
391
|
+
headers
|
|
392
|
+
}
|
|
393
|
+
);
|
|
394
|
+
} catch {
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
async function checkAppAccount(config, appId, options = {}) {
|
|
399
|
+
const headers = { ...options.headers ?? {} };
|
|
400
|
+
if (options.cookieHeader) headers.cookie = options.cookieHeader;
|
|
401
|
+
try {
|
|
402
|
+
return await apiFetch(
|
|
403
|
+
config,
|
|
404
|
+
`/api/reactions/account-check/${encodeURIComponent(appId)}`,
|
|
405
|
+
{
|
|
406
|
+
credentials: "include",
|
|
407
|
+
...options,
|
|
408
|
+
headers
|
|
409
|
+
}
|
|
410
|
+
);
|
|
411
|
+
} catch {
|
|
412
|
+
return null;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// src/query/fetchers/roadmap.ts
|
|
417
|
+
async function fetchRoadmapVotes(config, options = {}) {
|
|
418
|
+
try {
|
|
419
|
+
return await apiFetch(config, "/api/roadmap/votes", {
|
|
420
|
+
cache: "no-store",
|
|
421
|
+
...options
|
|
422
|
+
});
|
|
423
|
+
} catch {
|
|
424
|
+
return {};
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
async function fetchMyRoadmapVotes(config, options = {}) {
|
|
428
|
+
const headers = { ...options.headers ?? {} };
|
|
429
|
+
if (options.cookieHeader) headers.cookie = options.cookieHeader;
|
|
430
|
+
try {
|
|
431
|
+
const data = await apiFetch(config, "/api/roadmap/votes/me", {
|
|
432
|
+
credentials: "include",
|
|
433
|
+
...options,
|
|
434
|
+
headers
|
|
435
|
+
});
|
|
436
|
+
return data.voted ?? [];
|
|
437
|
+
} catch {
|
|
438
|
+
return [];
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
111
442
|
// src/query/keys.ts
|
|
112
443
|
var sifaQueryKeys = {
|
|
113
444
|
all: () => ["sifa"],
|
|
114
445
|
profile: {
|
|
115
446
|
all: () => ["sifa", "profile"],
|
|
116
|
-
byHandle: (handleOrDid) => ["sifa", "profile", handleOrDid]
|
|
447
|
+
byHandle: (handleOrDid) => ["sifa", "profile", handleOrDid],
|
|
448
|
+
atFundLink: (did) => ["sifa", "profile", "at-fund-link", did]
|
|
117
449
|
},
|
|
118
450
|
position: {
|
|
119
451
|
all: () => ["sifa", "position"],
|
|
120
452
|
byOwner: (did) => ["sifa", "position", "by-owner", did]
|
|
453
|
+
},
|
|
454
|
+
search: {
|
|
455
|
+
all: () => ["sifa", "search"],
|
|
456
|
+
profiles: (filters) => ["sifa", "search", "profiles", filters],
|
|
457
|
+
skills: (query) => ["sifa", "search", "skills", query],
|
|
458
|
+
filters: () => ["sifa", "search", "filters"]
|
|
459
|
+
},
|
|
460
|
+
discovery: {
|
|
461
|
+
all: () => ["sifa", "discovery"],
|
|
462
|
+
similar: (did, limit) => ["sifa", "discovery", "similar", did, limit],
|
|
463
|
+
suggestions: (opts) => ["sifa", "discovery", "suggestions", opts],
|
|
464
|
+
suggestionCount: (since) => ["sifa", "discovery", "suggestion-count", since ?? null],
|
|
465
|
+
featured: () => ["sifa", "discovery", "featured"]
|
|
466
|
+
},
|
|
467
|
+
follow: {
|
|
468
|
+
all: () => ["sifa", "follow"],
|
|
469
|
+
following: (opts) => ["sifa", "follow", "following", opts]
|
|
470
|
+
},
|
|
471
|
+
stats: {
|
|
472
|
+
all: () => ["sifa", "stats"],
|
|
473
|
+
homepage: () => ["sifa", "stats", "homepage"]
|
|
474
|
+
},
|
|
475
|
+
apps: {
|
|
476
|
+
all: () => ["sifa", "apps"],
|
|
477
|
+
registry: () => ["sifa", "apps", "registry"],
|
|
478
|
+
hidden: () => ["sifa", "apps", "hidden"]
|
|
479
|
+
},
|
|
480
|
+
activity: {
|
|
481
|
+
all: () => ["sifa", "activity"],
|
|
482
|
+
heatmap: (handleOrDid, days) => ["sifa", "activity", "heatmap", handleOrDid, days],
|
|
483
|
+
teaser: (handleOrDid) => ["sifa", "activity", "teaser", handleOrDid],
|
|
484
|
+
feed: (handleOrDid, opts) => ["sifa", "activity", "feed", handleOrDid, opts]
|
|
485
|
+
},
|
|
486
|
+
endorsement: {
|
|
487
|
+
all: () => ["sifa", "endorsement"],
|
|
488
|
+
count: (did) => ["sifa", "endorsement", "count", did]
|
|
489
|
+
},
|
|
490
|
+
stream: {
|
|
491
|
+
all: () => ["sifa", "stream"],
|
|
492
|
+
networkCount: (did) => ["sifa", "stream", "network-count", did]
|
|
493
|
+
},
|
|
494
|
+
reactions: {
|
|
495
|
+
all: () => ["sifa", "reactions"],
|
|
496
|
+
status: (uris) => ["sifa", "reactions", "status", uris],
|
|
497
|
+
accountCheck: (appId) => ["sifa", "reactions", "account-check", appId]
|
|
498
|
+
},
|
|
499
|
+
roadmap: {
|
|
500
|
+
all: () => ["sifa", "roadmap"],
|
|
501
|
+
votes: () => ["sifa", "roadmap", "votes"],
|
|
502
|
+
myVotes: () => ["sifa", "roadmap", "my-votes"]
|
|
121
503
|
}
|
|
122
504
|
};
|
|
123
505
|
|
|
124
|
-
// src/query/hooks/use-
|
|
506
|
+
// src/query/hooks/use-profile.ts
|
|
507
|
+
function useProfile(handleOrDid, options) {
|
|
508
|
+
const config = useSifaConfig();
|
|
509
|
+
return reactQuery.useQuery({
|
|
510
|
+
queryKey: sifaQueryKeys.profile.byHandle(handleOrDid ?? ""),
|
|
511
|
+
queryFn: () => fetchProfile(config, handleOrDid ?? ""),
|
|
512
|
+
enabled: Boolean(handleOrDid) && (options?.enabled ?? true),
|
|
513
|
+
...options
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
function useAtFundLink(did, options) {
|
|
517
|
+
const config = useSifaConfig();
|
|
518
|
+
return reactQuery.useQuery({
|
|
519
|
+
queryKey: sifaQueryKeys.profile.atFundLink(did ?? ""),
|
|
520
|
+
queryFn: () => fetchAtFundLink(config, did ?? ""),
|
|
521
|
+
enabled: Boolean(did) && (options?.enabled ?? true),
|
|
522
|
+
...options
|
|
523
|
+
});
|
|
524
|
+
}
|
|
125
525
|
function useCreatePosition(ownerDid, options) {
|
|
126
526
|
const config = useSifaConfig();
|
|
127
527
|
const queryClient = reactQuery.useQueryClient();
|
|
@@ -137,25 +537,227 @@ function useCreatePosition(ownerDid, options) {
|
|
|
137
537
|
...options
|
|
138
538
|
});
|
|
139
539
|
}
|
|
140
|
-
function
|
|
540
|
+
function useStats(options) {
|
|
141
541
|
const config = useSifaConfig();
|
|
142
542
|
return reactQuery.useQuery({
|
|
143
|
-
queryKey: sifaQueryKeys.
|
|
144
|
-
queryFn: () =>
|
|
543
|
+
queryKey: sifaQueryKeys.stats.homepage(),
|
|
544
|
+
queryFn: () => fetchStats(config),
|
|
545
|
+
...options
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
function useAppsRegistry(options) {
|
|
549
|
+
const config = useSifaConfig();
|
|
550
|
+
return reactQuery.useQuery({
|
|
551
|
+
queryKey: sifaQueryKeys.apps.registry(),
|
|
552
|
+
queryFn: () => fetchAppsRegistry(config),
|
|
553
|
+
...options
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
function useHiddenApps(options) {
|
|
557
|
+
const config = useSifaConfig();
|
|
558
|
+
return reactQuery.useQuery({
|
|
559
|
+
queryKey: sifaQueryKeys.apps.hidden(),
|
|
560
|
+
queryFn: () => fetchHiddenApps(config),
|
|
561
|
+
...options
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
function useSearchProfiles(filters, options) {
|
|
565
|
+
const config = useSifaConfig();
|
|
566
|
+
return reactQuery.useQuery({
|
|
567
|
+
queryKey: sifaQueryKeys.search.profiles(filters),
|
|
568
|
+
queryFn: () => fetchSearchProfiles(config, filters),
|
|
569
|
+
...options
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
function useSkillSuggestions(query, options) {
|
|
573
|
+
const config = useSifaConfig();
|
|
574
|
+
return reactQuery.useQuery({
|
|
575
|
+
queryKey: sifaQueryKeys.search.skills(query),
|
|
576
|
+
queryFn: () => fetchSkillSuggestions(config, query),
|
|
577
|
+
enabled: query.trim().length > 0 && (options?.enabled ?? true),
|
|
578
|
+
...options
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
function useSearchFilters(options) {
|
|
582
|
+
const config = useSifaConfig();
|
|
583
|
+
return reactQuery.useQuery({
|
|
584
|
+
queryKey: sifaQueryKeys.search.filters(),
|
|
585
|
+
queryFn: () => fetchSearchFilters(config),
|
|
586
|
+
...options
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
function useSimilarProfiles(did, opts = {}, options) {
|
|
590
|
+
const config = useSifaConfig();
|
|
591
|
+
const limit = opts.limit ?? 5;
|
|
592
|
+
return reactQuery.useQuery({
|
|
593
|
+
queryKey: sifaQueryKeys.discovery.similar(did ?? "", limit),
|
|
594
|
+
queryFn: () => fetchSimilarProfiles(config, did ?? "", { limit }),
|
|
595
|
+
enabled: Boolean(did) && (options?.enabled ?? true),
|
|
596
|
+
...options
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
function useSuggestions(opts = {}, options) {
|
|
600
|
+
const config = useSifaConfig();
|
|
601
|
+
return reactQuery.useQuery({
|
|
602
|
+
queryKey: sifaQueryKeys.discovery.suggestions(opts),
|
|
603
|
+
queryFn: () => fetchSuggestions(config, opts),
|
|
604
|
+
...options
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
function useSuggestionCount(since, options) {
|
|
608
|
+
const config = useSifaConfig();
|
|
609
|
+
return reactQuery.useQuery({
|
|
610
|
+
queryKey: sifaQueryKeys.discovery.suggestionCount(since),
|
|
611
|
+
queryFn: () => fetchSuggestionCount(config, since),
|
|
612
|
+
...options
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
function useFeaturedProfile(options) {
|
|
616
|
+
const config = useSifaConfig();
|
|
617
|
+
return reactQuery.useQuery({
|
|
618
|
+
queryKey: sifaQueryKeys.discovery.featured(),
|
|
619
|
+
queryFn: () => fetchFeaturedProfile(config),
|
|
620
|
+
...options
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
function useFollowing(opts = {}, options) {
|
|
624
|
+
const config = useSifaConfig();
|
|
625
|
+
return reactQuery.useQuery({
|
|
626
|
+
queryKey: sifaQueryKeys.follow.following(opts),
|
|
627
|
+
queryFn: () => fetchFollowing(config, opts),
|
|
628
|
+
...options
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
function useHeatmapData(handleOrDid, days, options) {
|
|
632
|
+
const config = useSifaConfig();
|
|
633
|
+
return reactQuery.useQuery({
|
|
634
|
+
queryKey: sifaQueryKeys.activity.heatmap(handleOrDid ?? "", days),
|
|
635
|
+
queryFn: () => fetchHeatmapData(config, handleOrDid ?? "", days),
|
|
636
|
+
enabled: Boolean(handleOrDid) && (options?.enabled ?? true),
|
|
637
|
+
...options
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
function useActivityTeaser(handleOrDid, options) {
|
|
641
|
+
const config = useSifaConfig();
|
|
642
|
+
return reactQuery.useQuery({
|
|
643
|
+
queryKey: sifaQueryKeys.activity.teaser(handleOrDid ?? ""),
|
|
644
|
+
queryFn: () => fetchActivityTeaser(config, handleOrDid ?? ""),
|
|
145
645
|
enabled: Boolean(handleOrDid) && (options?.enabled ?? true),
|
|
146
646
|
...options
|
|
147
647
|
});
|
|
148
648
|
}
|
|
649
|
+
function useActivityFeed(handleOrDid, opts = {}, options) {
|
|
650
|
+
const config = useSifaConfig();
|
|
651
|
+
return reactQuery.useQuery({
|
|
652
|
+
queryKey: sifaQueryKeys.activity.feed(handleOrDid ?? "", opts),
|
|
653
|
+
queryFn: () => fetchActivityFeed(config, handleOrDid ?? "", opts),
|
|
654
|
+
enabled: Boolean(handleOrDid) && (options?.enabled ?? true),
|
|
655
|
+
...options
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
function useEndorsementCount(did, options) {
|
|
659
|
+
const config = useSifaConfig();
|
|
660
|
+
return reactQuery.useQuery({
|
|
661
|
+
queryKey: sifaQueryKeys.endorsement.count(did ?? ""),
|
|
662
|
+
queryFn: () => fetchEndorsementCount(config, did ?? ""),
|
|
663
|
+
enabled: Boolean(did) && (options?.enabled ?? true),
|
|
664
|
+
...options
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
function useNetworkStreamCount(did, options) {
|
|
668
|
+
const config = useSifaConfig();
|
|
669
|
+
return reactQuery.useQuery({
|
|
670
|
+
queryKey: sifaQueryKeys.stream.networkCount(did ?? ""),
|
|
671
|
+
queryFn: () => fetchNetworkStreamCount(config, did ?? ""),
|
|
672
|
+
enabled: Boolean(did) && (options?.enabled ?? true),
|
|
673
|
+
...options
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
function useReactionStatus(uris, options) {
|
|
677
|
+
const config = useSifaConfig();
|
|
678
|
+
return reactQuery.useQuery({
|
|
679
|
+
queryKey: sifaQueryKeys.reactions.status(uris),
|
|
680
|
+
queryFn: () => fetchReactionStatus(config, uris),
|
|
681
|
+
...options
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
function useAppAccountCheck(appId, options) {
|
|
685
|
+
const config = useSifaConfig();
|
|
686
|
+
return reactQuery.useQuery({
|
|
687
|
+
queryKey: sifaQueryKeys.reactions.accountCheck(appId ?? ""),
|
|
688
|
+
queryFn: () => checkAppAccount(config, appId ?? ""),
|
|
689
|
+
enabled: Boolean(appId) && (options?.enabled ?? true),
|
|
690
|
+
...options
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
function useRoadmapVotes(options) {
|
|
694
|
+
const config = useSifaConfig();
|
|
695
|
+
return reactQuery.useQuery({
|
|
696
|
+
queryKey: sifaQueryKeys.roadmap.votes(),
|
|
697
|
+
queryFn: () => fetchRoadmapVotes(config),
|
|
698
|
+
...options
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
function useMyRoadmapVotes(options) {
|
|
702
|
+
const config = useSifaConfig();
|
|
703
|
+
return reactQuery.useQuery({
|
|
704
|
+
queryKey: sifaQueryKeys.roadmap.myVotes(),
|
|
705
|
+
queryFn: () => fetchMyRoadmapVotes(config),
|
|
706
|
+
...options
|
|
707
|
+
});
|
|
708
|
+
}
|
|
149
709
|
|
|
150
710
|
exports.ApiError = ApiError;
|
|
151
711
|
exports.SifaProvider = SifaProvider;
|
|
152
712
|
exports.apiFetch = apiFetch;
|
|
153
713
|
exports.apiFetchOrNull = apiFetchOrNull;
|
|
714
|
+
exports.checkAppAccount = checkAppAccount;
|
|
154
715
|
exports.createPosition = createPosition;
|
|
716
|
+
exports.fetchActivityFeed = fetchActivityFeed;
|
|
717
|
+
exports.fetchActivityTeaser = fetchActivityTeaser;
|
|
718
|
+
exports.fetchAppsRegistry = fetchAppsRegistry;
|
|
719
|
+
exports.fetchAtFundLink = fetchAtFundLink;
|
|
720
|
+
exports.fetchEndorsementCount = fetchEndorsementCount;
|
|
721
|
+
exports.fetchFeaturedProfile = fetchFeaturedProfile;
|
|
722
|
+
exports.fetchFollowing = fetchFollowing;
|
|
723
|
+
exports.fetchHeatmapData = fetchHeatmapData;
|
|
724
|
+
exports.fetchHiddenApps = fetchHiddenApps;
|
|
725
|
+
exports.fetchMyRoadmapVotes = fetchMyRoadmapVotes;
|
|
726
|
+
exports.fetchNetworkStreamCount = fetchNetworkStreamCount;
|
|
155
727
|
exports.fetchProfile = fetchProfile;
|
|
728
|
+
exports.fetchReactionStatus = fetchReactionStatus;
|
|
729
|
+
exports.fetchRoadmapVotes = fetchRoadmapVotes;
|
|
730
|
+
exports.fetchSearchFilters = fetchSearchFilters;
|
|
731
|
+
exports.fetchSearchProfiles = fetchSearchProfiles;
|
|
732
|
+
exports.fetchSimilarProfiles = fetchSimilarProfiles;
|
|
733
|
+
exports.fetchSkillSuggestions = fetchSkillSuggestions;
|
|
734
|
+
exports.fetchStats = fetchStats;
|
|
735
|
+
exports.fetchSuggestionCount = fetchSuggestionCount;
|
|
736
|
+
exports.fetchSuggestions = fetchSuggestions;
|
|
156
737
|
exports.sifaQueryKeys = sifaQueryKeys;
|
|
738
|
+
exports.useActivityFeed = useActivityFeed;
|
|
739
|
+
exports.useActivityTeaser = useActivityTeaser;
|
|
740
|
+
exports.useAppAccountCheck = useAppAccountCheck;
|
|
741
|
+
exports.useAppsRegistry = useAppsRegistry;
|
|
742
|
+
exports.useAtFundLink = useAtFundLink;
|
|
157
743
|
exports.useCreatePosition = useCreatePosition;
|
|
744
|
+
exports.useEndorsementCount = useEndorsementCount;
|
|
745
|
+
exports.useFeaturedProfile = useFeaturedProfile;
|
|
746
|
+
exports.useFollowing = useFollowing;
|
|
747
|
+
exports.useHeatmapData = useHeatmapData;
|
|
748
|
+
exports.useHiddenApps = useHiddenApps;
|
|
749
|
+
exports.useMyRoadmapVotes = useMyRoadmapVotes;
|
|
750
|
+
exports.useNetworkStreamCount = useNetworkStreamCount;
|
|
158
751
|
exports.useProfile = useProfile;
|
|
752
|
+
exports.useReactionStatus = useReactionStatus;
|
|
753
|
+
exports.useRoadmapVotes = useRoadmapVotes;
|
|
754
|
+
exports.useSearchFilters = useSearchFilters;
|
|
755
|
+
exports.useSearchProfiles = useSearchProfiles;
|
|
159
756
|
exports.useSifaConfig = useSifaConfig;
|
|
757
|
+
exports.useSimilarProfiles = useSimilarProfiles;
|
|
758
|
+
exports.useSkillSuggestions = useSkillSuggestions;
|
|
759
|
+
exports.useStats = useStats;
|
|
760
|
+
exports.useSuggestionCount = useSuggestionCount;
|
|
761
|
+
exports.useSuggestions = useSuggestions;
|
|
160
762
|
//# sourceMappingURL=index.cjs.map
|
|
161
763
|
//# sourceMappingURL=index.cjs.map
|