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