@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.
- package/dist/{index-M_BYlvDY.d.ts → index-B6GHpvcg.d.ts} +25 -2
- package/dist/{index-Bz0xL4us.d.cts → index-ZXWW6RsR.d.cts} +1 -1
- package/dist/{index-4SE7Z9SK.d.cts → index-ipyzSVry.d.cts} +25 -2
- package/dist/{index-BpEeBgRr.d.ts → index-wMuFhu7d.d.ts} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{org-CQMDMN58.d.ts → org-CLRdUB1W.d.ts} +56 -1
- package/dist/{org-DVIvsT_0.d.cts → org-Dme1VvNa.d.cts} +56 -1
- package/dist/query/fetchers/index.cjs +45 -1
- package/dist/query/fetchers/index.cjs.map +1 -1
- package/dist/query/fetchers/index.d.cts +2 -2
- package/dist/query/fetchers/index.d.ts +2 -2
- package/dist/query/fetchers/index.js +45 -2
- package/dist/query/fetchers/index.js.map +1 -1
- package/dist/query/hooks/index.cjs +55 -1
- package/dist/query/hooks/index.cjs.map +1 -1
- package/dist/query/hooks/index.d.cts +2 -2
- package/dist/query/hooks/index.d.ts +2 -2
- package/dist/query/hooks/index.js +55 -2
- package/dist/query/hooks/index.js.map +1 -1
- package/dist/query/index.cjs +54 -1
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +4 -4
- package/dist/query/index.d.ts +4 -4
- package/dist/query/index.js +53 -2
- package/dist/query/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -210,6 +210,10 @@ var sifaQueryKeys = {
|
|
|
210
210
|
teaser: (handleOrDid) => ["sifa", "activity", "teaser", handleOrDid],
|
|
211
211
|
feed: (handleOrDid, opts) => ["sifa", "activity", "feed", handleOrDid, opts]
|
|
212
212
|
},
|
|
213
|
+
github: {
|
|
214
|
+
all: () => ["sifa", "github"],
|
|
215
|
+
myPullRequests: (opts) => ["sifa", "github", "my-pull-requests", opts]
|
|
216
|
+
},
|
|
213
217
|
endorsement: {
|
|
214
218
|
all: () => ["sifa", "endorsement"],
|
|
215
219
|
count: (did) => ["sifa", "endorsement", "count", did]
|
|
@@ -1967,6 +1971,52 @@ function useActivityFeed(handleOrDid, opts = {}, options) {
|
|
|
1967
1971
|
...options
|
|
1968
1972
|
});
|
|
1969
1973
|
}
|
|
1974
|
+
var GithubPullRequestSchema = zod.z.object({
|
|
1975
|
+
prNumber: zod.z.number(),
|
|
1976
|
+
repoOwner: zod.z.string(),
|
|
1977
|
+
repoName: zod.z.string(),
|
|
1978
|
+
title: zod.z.string(),
|
|
1979
|
+
url: zod.z.string(),
|
|
1980
|
+
language: zod.z.string().nullable(),
|
|
1981
|
+
additions: zod.z.number(),
|
|
1982
|
+
deletions: zod.z.number(),
|
|
1983
|
+
/** ISO 8601 merge timestamp. */
|
|
1984
|
+
mergedAt: zod.z.string()
|
|
1985
|
+
});
|
|
1986
|
+
var MyGithubPullRequestsResponseSchema = zod.z.object({
|
|
1987
|
+
items: zod.z.array(GithubPullRequestSchema),
|
|
1988
|
+
hasMore: zod.z.boolean()
|
|
1989
|
+
});
|
|
1990
|
+
async function fetchMyGithubPullRequests(config, options = {}) {
|
|
1991
|
+
const { limit, offset, cookieHeader, ...fetchOptions } = options;
|
|
1992
|
+
const params = new URLSearchParams();
|
|
1993
|
+
if (limit !== void 0) params.set("limit", String(limit));
|
|
1994
|
+
if (offset !== void 0) params.set("offset", String(offset));
|
|
1995
|
+
const qs = params.toString();
|
|
1996
|
+
const headers = { ...options.headers ?? {} };
|
|
1997
|
+
if (cookieHeader) headers.cookie = cookieHeader;
|
|
1998
|
+
const data = await apiFetch(
|
|
1999
|
+
config,
|
|
2000
|
+
`/api/me/github/pull-requests${qs ? `?${qs}` : ""}`,
|
|
2001
|
+
{
|
|
2002
|
+
credentials: "include",
|
|
2003
|
+
cache: "no-store",
|
|
2004
|
+
...fetchOptions,
|
|
2005
|
+
headers
|
|
2006
|
+
}
|
|
2007
|
+
);
|
|
2008
|
+
return MyGithubPullRequestsResponseSchema.parse(data);
|
|
2009
|
+
}
|
|
2010
|
+
|
|
2011
|
+
// src/query/hooks/use-github-prs.ts
|
|
2012
|
+
function useMyGithubPullRequests(params = {}, options) {
|
|
2013
|
+
const config = useSifaConfig();
|
|
2014
|
+
return reactQuery.useQuery({
|
|
2015
|
+
queryKey: sifaQueryKeys.github.myPullRequests(params),
|
|
2016
|
+
queryFn: () => fetchMyGithubPullRequests(config, params),
|
|
2017
|
+
...options
|
|
2018
|
+
});
|
|
2019
|
+
}
|
|
1970
2020
|
|
|
1971
2021
|
// src/query/fetchers/endorsement.ts
|
|
1972
2022
|
async function fetchEndorsementCount(config, did, options = {}) {
|
|
@@ -2188,7 +2238,10 @@ async function castRoadmapVote(config, key, options = {}) {
|
|
|
2188
2238
|
try {
|
|
2189
2239
|
const res = await fetchFn(url, {
|
|
2190
2240
|
method: "POST",
|
|
2191
|
-
|
|
2241
|
+
// No body: the item key is in the URL. Do NOT declare a JSON content-type
|
|
2242
|
+
// for an empty body — Fastify rejects that with a 400 before the handler
|
|
2243
|
+
// runs. Only forward caller-provided headers.
|
|
2244
|
+
...options.headers ? { headers: options.headers } : {},
|
|
2192
2245
|
credentials: options.credentials ?? "include",
|
|
2193
2246
|
signal: options.signal ?? AbortSignal.timeout(options.timeoutMs ?? 1e4)
|
|
2194
2247
|
});
|
|
@@ -2601,6 +2654,7 @@ exports.useHideStandardPublication = useHideStandardPublication;
|
|
|
2601
2654
|
exports.useImportSearchEntities = useImportSearchEntities;
|
|
2602
2655
|
exports.useLinkSkillToPosition = useLinkSkillToPosition;
|
|
2603
2656
|
exports.useMutuals = useMutuals;
|
|
2657
|
+
exports.useMyGithubPullRequests = useMyGithubPullRequests;
|
|
2604
2658
|
exports.useMyRoadmapVotes = useMyRoadmapVotes;
|
|
2605
2659
|
exports.useNetworkStreamCount = useNetworkStreamCount;
|
|
2606
2660
|
exports.useOrgClaim = useOrgClaim;
|