@singi-labs/sifa-sdk 0.9.18 → 0.9.20

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.
Files changed (37) hide show
  1. package/dist/feed-DHTy7fUN.d.cts +254 -0
  2. package/dist/feed-DHTy7fUN.d.ts +254 -0
  3. package/dist/{index-DCpMh2Ny.d.cts → index-DYUYJxOs.d.cts} +1 -1
  4. package/dist/{index-DCpMh2Ny.d.ts → index-DYUYJxOs.d.ts} +1 -1
  5. package/dist/index.cjs +114 -3
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +4 -3
  8. package/dist/index.d.ts +4 -3
  9. package/dist/index.js +103 -4
  10. package/dist/index.js.map +1 -1
  11. package/dist/keys-D-vNPzXx.d.ts +1085 -0
  12. package/dist/keys-DRD79nDE.d.cts +1085 -0
  13. package/dist/query/fetchers/index.cjs +155 -1
  14. package/dist/query/fetchers/index.cjs.map +1 -1
  15. package/dist/query/fetchers/index.d.cts +6 -933
  16. package/dist/query/fetchers/index.d.ts +6 -933
  17. package/dist/query/fetchers/index.js +146 -2
  18. package/dist/query/fetchers/index.js.map +1 -1
  19. package/dist/query/hooks/index.cjs +2268 -0
  20. package/dist/query/hooks/index.cjs.map +1 -0
  21. package/dist/query/hooks/index.d.cts +479 -0
  22. package/dist/query/hooks/index.d.ts +479 -0
  23. package/dist/query/hooks/index.js +2178 -0
  24. package/dist/query/hooks/index.js.map +1 -0
  25. package/dist/query/index.cjs +340 -1
  26. package/dist/query/index.cjs.map +1 -1
  27. package/dist/query/index.d.cts +9 -352
  28. package/dist/query/index.d.ts +9 -352
  29. package/dist/query/index.js +322 -3
  30. package/dist/query/index.js.map +1 -1
  31. package/dist/schemas/index.cjs +102 -1
  32. package/dist/schemas/index.cjs.map +1 -1
  33. package/dist/schemas/index.d.cts +28 -2
  34. package/dist/schemas/index.d.ts +28 -2
  35. package/dist/schemas/index.js +91 -2
  36. package/dist/schemas/index.js.map +1 -1
  37. package/package.json +14 -4
@@ -612,6 +612,141 @@ async function fetchFollowing(config, opts = {}) {
612
612
  return { follows: [] };
613
613
  }
614
614
  }
615
+ function followUser(config, handle, opts = {}) {
616
+ const { note, ...rest } = opts;
617
+ return apiWrite(
618
+ config,
619
+ `/api/follow/${encodeURIComponent(handle)}`,
620
+ "POST",
621
+ {
622
+ body: note !== void 0 ? { note } : void 0,
623
+ ...rest
624
+ }
625
+ );
626
+ }
627
+ function unfollowUser(config, handle, opts = {}) {
628
+ return apiWrite(config, `/api/follow/${encodeURIComponent(handle)}`, "DELETE", opts);
629
+ }
630
+ function buildListPath(prefix, opts) {
631
+ const params = new URLSearchParams();
632
+ if (opts.cursor) params.set("cursor", opts.cursor);
633
+ if (opts.limit) params.set("limit", String(opts.limit));
634
+ const qs = params.toString();
635
+ return `${prefix}${qs ? `?${qs}` : ""}`;
636
+ }
637
+ async function getFollowers(config, handle, opts = {}) {
638
+ const headers = { ...opts.headers ?? {} };
639
+ if (opts.cookieHeader) headers.cookie = opts.cookieHeader;
640
+ try {
641
+ const res = await apiFetch(
642
+ config,
643
+ buildListPath(`/api/profile/${encodeURIComponent(handle)}/followers`, opts),
644
+ { credentials: "include", cache: "no-store", ...opts, headers }
645
+ );
646
+ return { follows: res.follows, cursor: res.cursor ?? null };
647
+ } catch {
648
+ return { follows: [], cursor: null };
649
+ }
650
+ }
651
+ async function getFollowing(config, handle, opts = {}) {
652
+ const headers = { ...opts.headers ?? {} };
653
+ if (opts.cookieHeader) headers.cookie = opts.cookieHeader;
654
+ try {
655
+ const res = await apiFetch(
656
+ config,
657
+ buildListPath(`/api/profile/${encodeURIComponent(handle)}/following`, opts),
658
+ { credentials: "include", cache: "no-store", ...opts, headers }
659
+ );
660
+ return { follows: res.follows, cursor: res.cursor ?? null };
661
+ } catch {
662
+ return { follows: [], cursor: null };
663
+ }
664
+ }
665
+ async function getFollowingFeed(config, opts = {}) {
666
+ const params = new URLSearchParams();
667
+ if (opts.cursor) params.set("cursor", opts.cursor);
668
+ if (opts.limit) params.set("limit", String(opts.limit));
669
+ if (opts.categories && opts.categories.length > 0) {
670
+ params.set("categories", opts.categories.join(","));
671
+ }
672
+ const qs = params.toString();
673
+ const headers = { ...opts.headers ?? {} };
674
+ if (opts.cookieHeader) headers.cookie = opts.cookieHeader;
675
+ try {
676
+ const res = await apiFetch(
677
+ config,
678
+ `/api/following/feed${qs ? `?${qs}` : ""}`,
679
+ { credentials: "include", cache: "no-store", ...opts, headers }
680
+ );
681
+ return { items: res.items ?? [], cursor: res.cursor ?? null };
682
+ } catch {
683
+ return { items: [], cursor: null };
684
+ }
685
+ }
686
+
687
+ // src/query/fetchers/follow-extras.ts
688
+ function buildListPath2(prefix, opts) {
689
+ const params = new URLSearchParams();
690
+ if (opts.cursor) params.set("cursor", opts.cursor);
691
+ if (opts.limit) params.set("limit", String(opts.limit));
692
+ const qs = params.toString();
693
+ return `${prefix}${qs ? `?${qs}` : ""}`;
694
+ }
695
+ async function fetchFollowProfilePage(config, path, opts) {
696
+ const headers = { ...opts.headers ?? {} };
697
+ if (opts.cookieHeader) headers.cookie = opts.cookieHeader;
698
+ try {
699
+ const res = await apiFetch(
700
+ config,
701
+ path,
702
+ { credentials: "include", cache: "no-store", ...opts, headers }
703
+ );
704
+ return { items: res.items ?? [], cursor: res.cursor ?? null };
705
+ } catch {
706
+ return { items: [], cursor: null };
707
+ }
708
+ }
709
+ async function getMutuals(config, handleOrDid, opts = {}) {
710
+ return fetchFollowProfilePage(
711
+ config,
712
+ buildListPath2(`/api/profile/${encodeURIComponent(handleOrDid)}/mutuals`, opts),
713
+ opts
714
+ );
715
+ }
716
+ async function getBlueskySuggestions(config, opts = {}) {
717
+ return fetchFollowProfilePage(config, buildListPath2("/api/me/bluesky-suggestions", opts), opts);
718
+ }
719
+
720
+ // src/query/fetchers/admin-feature-allowlists.ts
721
+ async function listFeatureAllowlist(config, flag, opts = {}) {
722
+ const headers = { ...opts.headers ?? {} };
723
+ if (opts.cookieHeader) headers.cookie = opts.cookieHeader;
724
+ try {
725
+ const res = await apiFetch(
726
+ config,
727
+ `/api/admin/feature-allowlists/${encodeURIComponent(flag)}`,
728
+ { credentials: "include", cache: "no-store", ...opts, headers }
729
+ );
730
+ return { items: res.items ?? [] };
731
+ } catch {
732
+ return { items: [] };
733
+ }
734
+ }
735
+ function addFeatureAllowlist(config, flag, did, opts = {}) {
736
+ const { note, ...rest } = opts;
737
+ return apiWrite(config, `/api/admin/feature-allowlists/${encodeURIComponent(flag)}`, "POST", {
738
+ body: note !== void 0 ? { did, note } : { did },
739
+ ...rest
740
+ });
741
+ }
742
+ function removeFeatureAllowlist(config, flag, did, opts = {}) {
743
+ return apiWrite(
744
+ config,
745
+ `/api/admin/feature-allowlists/${encodeURIComponent(flag)}/${encodeURIComponent(did)}`,
746
+ "DELETE",
747
+ opts
748
+ );
749
+ }
615
750
 
616
751
  // src/query/fetchers/activity.ts
617
752
  async function fetchHeatmapData(config, handleOrDid, days, options = {}) {
@@ -927,7 +1062,16 @@ var sifaQueryKeys = {
927
1062
  },
928
1063
  follow: {
929
1064
  all: () => ["sifa", "follow"],
930
- following: (opts) => ["sifa", "follow", "following", opts]
1065
+ following: (opts) => ["sifa", "follow", "following", opts],
1066
+ followers: (handle) => ["sifa", "follow", "followers", handle],
1067
+ followingOf: (handle) => ["sifa", "follow", "following-of", handle],
1068
+ feed: (opts) => ["sifa", "follow", "feed", opts],
1069
+ mutuals: (handle) => ["sifa", "follow", "mutuals", handle],
1070
+ blueskySuggestions: () => ["sifa", "follow", "bluesky-suggestions"]
1071
+ },
1072
+ admin: {
1073
+ all: () => ["sifa", "admin"],
1074
+ featureAllowlist: (flag) => ["sifa", "admin", "feature-allowlist", flag]
931
1075
  },
932
1076
  stats: {
933
1077
  all: () => ["sifa", "stats"],
@@ -964,6 +1108,6 @@ var sifaQueryKeys = {
964
1108
  }
965
1109
  };
966
1110
 
967
- export { ApiError, HIDDEN_ITEM_SOURCES, HIDDEN_ITEM_TYPES, QUOTED_POSTS_BATCH_MAX, apiFetch, apiFetchOrNull, apiWrite, apiWriteCreate, bulkHideProfileItems, bulkHideStandardPublications, bulkUnhideProfileItems, bulkUnhideStandardPublications, castRoadmapVote, checkAppAccount, checkNetworkMapJobStatus, createEducation, createEndorsement, createExternalAccount, createPosition, createProfileLocation, createReaction, createRecord, createSkill, deleteAccount, deleteAvatarOverride, deleteEducation, deleteExternalAccount, deletePosition, deleteProfileLocation, deleteReaction, deleteRecord, deleteSkill, fetchActivityFeed, fetchActivityTeaser, fetchAppsRegistry, fetchAtFundLink, fetchEndorsementCount, fetchExternalAccounts, fetchFeaturedProfile, fetchFollowing, fetchHeatmapData, fetchHiddenApps, fetchMyRoadmapVotes, fetchNetworkMap, fetchNetworkStreamCount, fetchProfile, fetchReactionStatus, fetchRoadmapVotes, fetchSearchFilters, fetchSearchProfiles, fetchSimilarProfiles, fetchSkillSuggestions, fetchStats, fetchSuggestionCount, fetchSuggestions, hideKeytraceClaim, hideOrcidPublication, hideProfileItem, hideSifaPublication, hideStandardPublication, initiateNetworkMapGeneration, isNetworkMapResponse, linkSkillToPosition, refreshOrcidPublications, refreshPds, resetProfile, resolveQuotedPosts, retractRoadmapVote, searchSkills, setExternalAccountPrimary, setPositionPrimary, sifaQueryKeys, unhideKeytraceClaim, unhideOrcidPublication, unhideProfileItem, unhideSifaPublication, unhideStandardPublication, unlinkSkillFromPosition, unsetExternalAccountPrimary, unsetPositionPrimary, updateEducation, updateExternalAccount, updatePosition, updateProfileLocation, updateProfileOverride, updateProfileSelf, updateRecord, updateSkill, uploadAvatar, verifyExternalAccount };
1111
+ export { ApiError, HIDDEN_ITEM_SOURCES, HIDDEN_ITEM_TYPES, QUOTED_POSTS_BATCH_MAX, addFeatureAllowlist, apiFetch, apiFetchOrNull, apiWrite, apiWriteCreate, bulkHideProfileItems, bulkHideStandardPublications, bulkUnhideProfileItems, bulkUnhideStandardPublications, castRoadmapVote, checkAppAccount, checkNetworkMapJobStatus, createEducation, createEndorsement, createExternalAccount, createPosition, createProfileLocation, createReaction, createRecord, createSkill, deleteAccount, deleteAvatarOverride, deleteEducation, deleteExternalAccount, deletePosition, deleteProfileLocation, deleteReaction, deleteRecord, deleteSkill, fetchActivityFeed, fetchActivityTeaser, fetchAppsRegistry, fetchAtFundLink, fetchEndorsementCount, fetchExternalAccounts, fetchFeaturedProfile, fetchFollowing, fetchHeatmapData, fetchHiddenApps, fetchMyRoadmapVotes, fetchNetworkMap, fetchNetworkStreamCount, fetchProfile, fetchReactionStatus, fetchRoadmapVotes, fetchSearchFilters, fetchSearchProfiles, fetchSimilarProfiles, fetchSkillSuggestions, fetchStats, fetchSuggestionCount, fetchSuggestions, followUser, getBlueskySuggestions, getFollowers, getFollowing, getFollowingFeed, getMutuals, hideKeytraceClaim, hideOrcidPublication, hideProfileItem, hideSifaPublication, hideStandardPublication, initiateNetworkMapGeneration, isNetworkMapResponse, linkSkillToPosition, listFeatureAllowlist, refreshOrcidPublications, refreshPds, removeFeatureAllowlist, resetProfile, resolveQuotedPosts, retractRoadmapVote, searchSkills, setExternalAccountPrimary, setPositionPrimary, sifaQueryKeys, unfollowUser, unhideKeytraceClaim, unhideOrcidPublication, unhideProfileItem, unhideSifaPublication, unhideStandardPublication, unlinkSkillFromPosition, unsetExternalAccountPrimary, unsetPositionPrimary, updateEducation, updateExternalAccount, updatePosition, updateProfileLocation, updateProfileOverride, updateProfileSelf, updateRecord, updateSkill, uploadAvatar, verifyExternalAccount };
968
1112
  //# sourceMappingURL=index.js.map
969
1113
  //# sourceMappingURL=index.js.map