@singi-labs/sifa-sdk 0.12.27 → 0.12.29

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.
@@ -1022,6 +1022,42 @@ async function fetchActivityFeed(config, handleOrDid, options = {}) {
1022
1022
  return null;
1023
1023
  }
1024
1024
  }
1025
+ var GithubPullRequestSchema = zod.z.object({
1026
+ prNumber: zod.z.number(),
1027
+ repoOwner: zod.z.string(),
1028
+ repoName: zod.z.string(),
1029
+ title: zod.z.string(),
1030
+ url: zod.z.string(),
1031
+ language: zod.z.string().nullable(),
1032
+ additions: zod.z.number(),
1033
+ deletions: zod.z.number(),
1034
+ /** ISO 8601 merge timestamp. */
1035
+ mergedAt: zod.z.string()
1036
+ });
1037
+ var MyGithubPullRequestsResponseSchema = zod.z.object({
1038
+ items: zod.z.array(GithubPullRequestSchema),
1039
+ hasMore: zod.z.boolean()
1040
+ });
1041
+ async function fetchMyGithubPullRequests(config, options = {}) {
1042
+ const { limit, offset, cookieHeader, ...fetchOptions } = options;
1043
+ const params = new URLSearchParams();
1044
+ if (limit !== void 0) params.set("limit", String(limit));
1045
+ if (offset !== void 0) params.set("offset", String(offset));
1046
+ const qs = params.toString();
1047
+ const headers = { ...options.headers ?? {} };
1048
+ if (cookieHeader) headers.cookie = cookieHeader;
1049
+ const data = await apiFetch(
1050
+ config,
1051
+ `/api/me/github/pull-requests${qs ? `?${qs}` : ""}`,
1052
+ {
1053
+ credentials: "include",
1054
+ cache: "no-store",
1055
+ ...fetchOptions,
1056
+ headers
1057
+ }
1058
+ );
1059
+ return MyGithubPullRequestsResponseSchema.parse(data);
1060
+ }
1025
1061
 
1026
1062
  // src/query/fetchers/endorsement.ts
1027
1063
  async function fetchEndorsementCount(config, did, options = {}) {
@@ -1209,7 +1245,10 @@ async function castRoadmapVote(config, key, options = {}) {
1209
1245
  try {
1210
1246
  const res = await fetchFn(url, {
1211
1247
  method: "POST",
1212
- headers: { "Content-Type": "application/json", ...options.headers ?? {} },
1248
+ // No body: the item key is in the URL. Do NOT declare a JSON content-type
1249
+ // for an empty body — Fastify rejects that with a 400 before the handler
1250
+ // runs. Only forward caller-provided headers.
1251
+ ...options.headers ? { headers: options.headers } : {},
1213
1252
  credentials: options.credentials ?? "include",
1214
1253
  signal: options.signal ?? AbortSignal.timeout(options.timeoutMs ?? 1e4)
1215
1254
  });
@@ -1346,6 +1385,10 @@ var sifaQueryKeys = {
1346
1385
  teaser: (handleOrDid) => ["sifa", "activity", "teaser", handleOrDid],
1347
1386
  feed: (handleOrDid, opts) => ["sifa", "activity", "feed", handleOrDid, opts]
1348
1387
  },
1388
+ github: {
1389
+ all: () => ["sifa", "github"],
1390
+ myPullRequests: (opts) => ["sifa", "github", "my-pull-requests", opts]
1391
+ },
1349
1392
  endorsement: {
1350
1393
  all: () => ["sifa", "endorsement"],
1351
1394
  count: (did) => ["sifa", "endorsement", "count", did]
@@ -2395,6 +2438,14 @@ function useActivityFeed(handleOrDid, opts = {}, options) {
2395
2438
  ...options
2396
2439
  });
2397
2440
  }
2441
+ function useMyGithubPullRequests(params = {}, options) {
2442
+ const config = useSifaConfig();
2443
+ return reactQuery.useQuery({
2444
+ queryKey: sifaQueryKeys.github.myPullRequests(params),
2445
+ queryFn: () => fetchMyGithubPullRequests(config, params),
2446
+ ...options
2447
+ });
2448
+ }
2398
2449
  function useEndorsementCount(did, options) {
2399
2450
  const config = useSifaConfig();
2400
2451
  return reactQuery.useQuery({
@@ -2769,6 +2820,7 @@ exports.fetchFollowing = fetchFollowing;
2769
2820
  exports.fetchGetProfileView = fetchGetProfileView;
2770
2821
  exports.fetchHeatmapData = fetchHeatmapData;
2771
2822
  exports.fetchHiddenApps = fetchHiddenApps;
2823
+ exports.fetchMyGithubPullRequests = fetchMyGithubPullRequests;
2772
2824
  exports.fetchMyRoadmapVotes = fetchMyRoadmapVotes;
2773
2825
  exports.fetchNetworkMap = fetchNetworkMap;
2774
2826
  exports.fetchNetworkStreamCount = fetchNetworkStreamCount;
@@ -2894,6 +2946,7 @@ exports.useImportSearchEntities = useImportSearchEntities;
2894
2946
  exports.useLinkSkillToPosition = useLinkSkillToPosition;
2895
2947
  exports.useMintEntityDomain = useMintEntityDomain;
2896
2948
  exports.useMutuals = useMutuals;
2949
+ exports.useMyGithubPullRequests = useMyGithubPullRequests;
2897
2950
  exports.useMyRoadmapVotes = useMyRoadmapVotes;
2898
2951
  exports.useNetworkStreamCount = useNetworkStreamCount;
2899
2952
  exports.useOrgClaim = useOrgClaim;