@singi-labs/sifa-sdk 0.9.19 → 0.9.21
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/feed-DHTy7fUN.d.cts +254 -0
- package/dist/feed-DHTy7fUN.d.ts +254 -0
- package/dist/{index-DCpMh2Ny.d.cts → index-DYUYJxOs.d.cts} +1 -1
- package/dist/{index-DCpMh2Ny.d.ts → index-DYUYJxOs.d.ts} +1 -1
- package/dist/index.cjs +132 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +121 -5
- package/dist/index.js.map +1 -1
- package/dist/keys-D-vNPzXx.d.ts +1085 -0
- package/dist/keys-DRD79nDE.d.cts +1085 -0
- package/dist/query/fetchers/index.cjs +155 -1
- package/dist/query/fetchers/index.cjs.map +1 -1
- package/dist/query/fetchers/index.d.cts +6 -933
- package/dist/query/fetchers/index.d.ts +6 -933
- package/dist/query/fetchers/index.js +146 -2
- package/dist/query/fetchers/index.js.map +1 -1
- package/dist/query/hooks/index.cjs +2268 -0
- package/dist/query/hooks/index.cjs.map +1 -0
- package/dist/query/hooks/index.d.cts +479 -0
- package/dist/query/hooks/index.d.ts +479 -0
- package/dist/query/hooks/index.js +2178 -0
- package/dist/query/hooks/index.js.map +1 -0
- package/dist/query/index.cjs +340 -1
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +9 -352
- package/dist/query/index.d.ts +9 -352
- package/dist/query/index.js +322 -3
- package/dist/query/index.js.map +1 -1
- package/dist/schemas/index.cjs +102 -1
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +28 -2
- package/dist/schemas/index.d.ts +28 -2
- package/dist/schemas/index.js +91 -2
- package/dist/schemas/index.js.map +1 -1
- package/package.json +11 -1
|
@@ -614,6 +614,141 @@ async function fetchFollowing(config, opts = {}) {
|
|
|
614
614
|
return { follows: [] };
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
|
+
function followUser(config, handle, opts = {}) {
|
|
618
|
+
const { note, ...rest } = opts;
|
|
619
|
+
return apiWrite(
|
|
620
|
+
config,
|
|
621
|
+
`/api/follow/${encodeURIComponent(handle)}`,
|
|
622
|
+
"POST",
|
|
623
|
+
{
|
|
624
|
+
body: note !== void 0 ? { note } : void 0,
|
|
625
|
+
...rest
|
|
626
|
+
}
|
|
627
|
+
);
|
|
628
|
+
}
|
|
629
|
+
function unfollowUser(config, handle, opts = {}) {
|
|
630
|
+
return apiWrite(config, `/api/follow/${encodeURIComponent(handle)}`, "DELETE", opts);
|
|
631
|
+
}
|
|
632
|
+
function buildListPath(prefix, opts) {
|
|
633
|
+
const params = new URLSearchParams();
|
|
634
|
+
if (opts.cursor) params.set("cursor", opts.cursor);
|
|
635
|
+
if (opts.limit) params.set("limit", String(opts.limit));
|
|
636
|
+
const qs = params.toString();
|
|
637
|
+
return `${prefix}${qs ? `?${qs}` : ""}`;
|
|
638
|
+
}
|
|
639
|
+
async function getFollowers(config, handle, opts = {}) {
|
|
640
|
+
const headers = { ...opts.headers ?? {} };
|
|
641
|
+
if (opts.cookieHeader) headers.cookie = opts.cookieHeader;
|
|
642
|
+
try {
|
|
643
|
+
const res = await apiFetch(
|
|
644
|
+
config,
|
|
645
|
+
buildListPath(`/api/profile/${encodeURIComponent(handle)}/followers`, opts),
|
|
646
|
+
{ credentials: "include", cache: "no-store", ...opts, headers }
|
|
647
|
+
);
|
|
648
|
+
return { follows: res.follows, cursor: res.cursor ?? null };
|
|
649
|
+
} catch {
|
|
650
|
+
return { follows: [], cursor: null };
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
async function getFollowing(config, handle, opts = {}) {
|
|
654
|
+
const headers = { ...opts.headers ?? {} };
|
|
655
|
+
if (opts.cookieHeader) headers.cookie = opts.cookieHeader;
|
|
656
|
+
try {
|
|
657
|
+
const res = await apiFetch(
|
|
658
|
+
config,
|
|
659
|
+
buildListPath(`/api/profile/${encodeURIComponent(handle)}/following`, opts),
|
|
660
|
+
{ credentials: "include", cache: "no-store", ...opts, headers }
|
|
661
|
+
);
|
|
662
|
+
return { follows: res.follows, cursor: res.cursor ?? null };
|
|
663
|
+
} catch {
|
|
664
|
+
return { follows: [], cursor: null };
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
async function getFollowingFeed(config, opts = {}) {
|
|
668
|
+
const params = new URLSearchParams();
|
|
669
|
+
if (opts.cursor) params.set("cursor", opts.cursor);
|
|
670
|
+
if (opts.limit) params.set("limit", String(opts.limit));
|
|
671
|
+
if (opts.categories && opts.categories.length > 0) {
|
|
672
|
+
params.set("categories", opts.categories.join(","));
|
|
673
|
+
}
|
|
674
|
+
const qs = params.toString();
|
|
675
|
+
const headers = { ...opts.headers ?? {} };
|
|
676
|
+
if (opts.cookieHeader) headers.cookie = opts.cookieHeader;
|
|
677
|
+
try {
|
|
678
|
+
const res = await apiFetch(
|
|
679
|
+
config,
|
|
680
|
+
`/api/following/feed${qs ? `?${qs}` : ""}`,
|
|
681
|
+
{ credentials: "include", cache: "no-store", ...opts, headers }
|
|
682
|
+
);
|
|
683
|
+
return { items: res.items ?? [], cursor: res.cursor ?? null };
|
|
684
|
+
} catch {
|
|
685
|
+
return { items: [], cursor: null };
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
// src/query/fetchers/follow-extras.ts
|
|
690
|
+
function buildListPath2(prefix, opts) {
|
|
691
|
+
const params = new URLSearchParams();
|
|
692
|
+
if (opts.cursor) params.set("cursor", opts.cursor);
|
|
693
|
+
if (opts.limit) params.set("limit", String(opts.limit));
|
|
694
|
+
const qs = params.toString();
|
|
695
|
+
return `${prefix}${qs ? `?${qs}` : ""}`;
|
|
696
|
+
}
|
|
697
|
+
async function fetchFollowProfilePage(config, path, opts) {
|
|
698
|
+
const headers = { ...opts.headers ?? {} };
|
|
699
|
+
if (opts.cookieHeader) headers.cookie = opts.cookieHeader;
|
|
700
|
+
try {
|
|
701
|
+
const res = await apiFetch(
|
|
702
|
+
config,
|
|
703
|
+
path,
|
|
704
|
+
{ credentials: "include", cache: "no-store", ...opts, headers }
|
|
705
|
+
);
|
|
706
|
+
return { items: res.items ?? [], cursor: res.cursor ?? null };
|
|
707
|
+
} catch {
|
|
708
|
+
return { items: [], cursor: null };
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
async function getMutuals(config, handleOrDid, opts = {}) {
|
|
712
|
+
return fetchFollowProfilePage(
|
|
713
|
+
config,
|
|
714
|
+
buildListPath2(`/api/profile/${encodeURIComponent(handleOrDid)}/mutuals`, opts),
|
|
715
|
+
opts
|
|
716
|
+
);
|
|
717
|
+
}
|
|
718
|
+
async function getBlueskySuggestions(config, opts = {}) {
|
|
719
|
+
return fetchFollowProfilePage(config, buildListPath2("/api/me/bluesky-suggestions", opts), opts);
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
// src/query/fetchers/admin-feature-allowlists.ts
|
|
723
|
+
async function listFeatureAllowlist(config, flag, opts = {}) {
|
|
724
|
+
const headers = { ...opts.headers ?? {} };
|
|
725
|
+
if (opts.cookieHeader) headers.cookie = opts.cookieHeader;
|
|
726
|
+
try {
|
|
727
|
+
const res = await apiFetch(
|
|
728
|
+
config,
|
|
729
|
+
`/api/admin/feature-allowlists/${encodeURIComponent(flag)}`,
|
|
730
|
+
{ credentials: "include", cache: "no-store", ...opts, headers }
|
|
731
|
+
);
|
|
732
|
+
return { items: res.items ?? [] };
|
|
733
|
+
} catch {
|
|
734
|
+
return { items: [] };
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
function addFeatureAllowlist(config, flag, did, opts = {}) {
|
|
738
|
+
const { note, ...rest } = opts;
|
|
739
|
+
return apiWrite(config, `/api/admin/feature-allowlists/${encodeURIComponent(flag)}`, "POST", {
|
|
740
|
+
body: note !== void 0 ? { did, note } : { did },
|
|
741
|
+
...rest
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
function removeFeatureAllowlist(config, flag, did, opts = {}) {
|
|
745
|
+
return apiWrite(
|
|
746
|
+
config,
|
|
747
|
+
`/api/admin/feature-allowlists/${encodeURIComponent(flag)}/${encodeURIComponent(did)}`,
|
|
748
|
+
"DELETE",
|
|
749
|
+
opts
|
|
750
|
+
);
|
|
751
|
+
}
|
|
617
752
|
|
|
618
753
|
// src/query/fetchers/activity.ts
|
|
619
754
|
async function fetchHeatmapData(config, handleOrDid, days, options = {}) {
|
|
@@ -929,7 +1064,16 @@ var sifaQueryKeys = {
|
|
|
929
1064
|
},
|
|
930
1065
|
follow: {
|
|
931
1066
|
all: () => ["sifa", "follow"],
|
|
932
|
-
following: (opts) => ["sifa", "follow", "following", opts]
|
|
1067
|
+
following: (opts) => ["sifa", "follow", "following", opts],
|
|
1068
|
+
followers: (handle) => ["sifa", "follow", "followers", handle],
|
|
1069
|
+
followingOf: (handle) => ["sifa", "follow", "following-of", handle],
|
|
1070
|
+
feed: (opts) => ["sifa", "follow", "feed", opts],
|
|
1071
|
+
mutuals: (handle) => ["sifa", "follow", "mutuals", handle],
|
|
1072
|
+
blueskySuggestions: () => ["sifa", "follow", "bluesky-suggestions"]
|
|
1073
|
+
},
|
|
1074
|
+
admin: {
|
|
1075
|
+
all: () => ["sifa", "admin"],
|
|
1076
|
+
featureAllowlist: (flag) => ["sifa", "admin", "feature-allowlist", flag]
|
|
933
1077
|
},
|
|
934
1078
|
stats: {
|
|
935
1079
|
all: () => ["sifa", "stats"],
|
|
@@ -970,6 +1114,7 @@ exports.ApiError = ApiError;
|
|
|
970
1114
|
exports.HIDDEN_ITEM_SOURCES = HIDDEN_ITEM_SOURCES;
|
|
971
1115
|
exports.HIDDEN_ITEM_TYPES = HIDDEN_ITEM_TYPES;
|
|
972
1116
|
exports.QUOTED_POSTS_BATCH_MAX = QUOTED_POSTS_BATCH_MAX;
|
|
1117
|
+
exports.addFeatureAllowlist = addFeatureAllowlist;
|
|
973
1118
|
exports.apiFetch = apiFetch;
|
|
974
1119
|
exports.apiFetchOrNull = apiFetchOrNull;
|
|
975
1120
|
exports.apiWrite = apiWrite;
|
|
@@ -1021,6 +1166,12 @@ exports.fetchSkillSuggestions = fetchSkillSuggestions;
|
|
|
1021
1166
|
exports.fetchStats = fetchStats;
|
|
1022
1167
|
exports.fetchSuggestionCount = fetchSuggestionCount;
|
|
1023
1168
|
exports.fetchSuggestions = fetchSuggestions;
|
|
1169
|
+
exports.followUser = followUser;
|
|
1170
|
+
exports.getBlueskySuggestions = getBlueskySuggestions;
|
|
1171
|
+
exports.getFollowers = getFollowers;
|
|
1172
|
+
exports.getFollowing = getFollowing;
|
|
1173
|
+
exports.getFollowingFeed = getFollowingFeed;
|
|
1174
|
+
exports.getMutuals = getMutuals;
|
|
1024
1175
|
exports.hideKeytraceClaim = hideKeytraceClaim;
|
|
1025
1176
|
exports.hideOrcidPublication = hideOrcidPublication;
|
|
1026
1177
|
exports.hideProfileItem = hideProfileItem;
|
|
@@ -1029,8 +1180,10 @@ exports.hideStandardPublication = hideStandardPublication;
|
|
|
1029
1180
|
exports.initiateNetworkMapGeneration = initiateNetworkMapGeneration;
|
|
1030
1181
|
exports.isNetworkMapResponse = isNetworkMapResponse;
|
|
1031
1182
|
exports.linkSkillToPosition = linkSkillToPosition;
|
|
1183
|
+
exports.listFeatureAllowlist = listFeatureAllowlist;
|
|
1032
1184
|
exports.refreshOrcidPublications = refreshOrcidPublications;
|
|
1033
1185
|
exports.refreshPds = refreshPds;
|
|
1186
|
+
exports.removeFeatureAllowlist = removeFeatureAllowlist;
|
|
1034
1187
|
exports.resetProfile = resetProfile;
|
|
1035
1188
|
exports.resolveQuotedPosts = resolveQuotedPosts;
|
|
1036
1189
|
exports.retractRoadmapVote = retractRoadmapVote;
|
|
@@ -1038,6 +1191,7 @@ exports.searchSkills = searchSkills;
|
|
|
1038
1191
|
exports.setExternalAccountPrimary = setExternalAccountPrimary;
|
|
1039
1192
|
exports.setPositionPrimary = setPositionPrimary;
|
|
1040
1193
|
exports.sifaQueryKeys = sifaQueryKeys;
|
|
1194
|
+
exports.unfollowUser = unfollowUser;
|
|
1041
1195
|
exports.unhideKeytraceClaim = unhideKeytraceClaim;
|
|
1042
1196
|
exports.unhideOrcidPublication = unhideOrcidPublication;
|
|
1043
1197
|
exports.unhideProfileItem = unhideProfileItem;
|