@stats-organization/github-readme-stats-core 2.1.4 → 2.2.0
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/build/api/gist.d.ts +2 -7
- package/build/api/gist.d.ts.map +1 -1
- package/build/api/gist.js +28 -26
- package/build/api/index.d.ts +3 -8
- package/build/api/index.d.ts.map +1 -1
- package/build/api/index.js +32 -36
- package/build/api/pin.d.ts +2 -7
- package/build/api/pin.d.ts.map +1 -1
- package/build/api/pin.js +18 -33
- package/build/api/top-langs.d.ts +2 -7
- package/build/api/top-langs.d.ts.map +1 -1
- package/build/api/top-langs.js +32 -44
- package/build/api/wakatime.d.ts +2 -7
- package/build/api/wakatime.d.ts.map +1 -1
- package/build/api/wakatime.js +28 -26
- package/build/calculateRank.d.ts +12 -11
- package/build/calculateRank.d.ts.map +1 -1
- package/build/calculateRank.js +18 -18
- package/build/cards/common-options.d.ts +13 -0
- package/build/cards/common-options.d.ts.map +1 -0
- package/build/cards/common-options.js +1 -0
- package/build/cards/gist.d.ts +11 -16
- package/build/cards/gist.d.ts.map +1 -1
- package/build/cards/gist.js +26 -31
- package/build/cards/repo.d.ts +19 -16
- package/build/cards/repo.d.ts.map +1 -1
- package/build/cards/repo.js +79 -72
- package/build/cards/stats.d.ts +29 -44
- package/build/cards/stats.d.ts.map +1 -1
- package/build/cards/stats.js +118 -173
- package/build/cards/top-languages.d.ts +81 -77
- package/build/cards/top-languages.d.ts.map +1 -1
- package/build/cards/top-languages.js +186 -184
- package/build/cards/wakatime.d.ts +21 -11
- package/build/cards/wakatime.d.ts.map +1 -1
- package/build/cards/wakatime.js +92 -109
- package/build/common/Card.d.ts +41 -14
- package/build/common/Card.d.ts.map +1 -1
- package/build/common/Card.js +92 -31
- package/build/common/I18n.d.ts +4 -2
- package/build/common/I18n.d.ts.map +1 -1
- package/build/common/color.d.ts +91 -15
- package/build/common/color.d.ts.map +1 -1
- package/build/common/color.js +163 -17
- package/build/common/config.d.ts +2 -1
- package/build/common/config.d.ts.map +1 -1
- package/build/common/config.js +16 -26
- package/build/common/constants.d.ts +2 -1
- package/build/common/constants.d.ts.map +1 -1
- package/build/common/date.d.ts +37 -0
- package/build/common/date.d.ts.map +1 -0
- package/build/common/date.js +31 -0
- package/build/common/html.js +1 -1
- package/build/common/http.d.ts +37 -5
- package/build/common/http.d.ts.map +1 -1
- package/build/common/http.js +29 -6
- package/build/common/icons.d.ts +1 -0
- package/build/common/icons.d.ts.map +1 -1
- package/build/common/icons.js +1 -0
- package/build/common/languageColors.d.ts +11 -0
- package/build/common/languageColors.d.ts.map +1 -0
- package/build/common/languageColors.js +15 -0
- package/build/common/languageColors.json +10 -1
- package/build/common/ops.d.ts +27 -33
- package/build/common/ops.d.ts.map +1 -1
- package/build/common/ops.js +31 -48
- package/build/common/render.d.ts +154 -113
- package/build/common/render.d.ts.map +1 -1
- package/build/common/render.js +209 -92
- package/build/common/retryer.d.ts +15 -6
- package/build/common/retryer.d.ts.map +1 -1
- package/build/common/retryer.js +2 -0
- package/build/fetchers/gist.d.ts +6 -21
- package/build/fetchers/gist.d.ts.map +1 -1
- package/build/fetchers/gist.js +28 -64
- package/build/fetchers/repo.d.ts +12 -11
- package/build/fetchers/repo.d.ts.map +1 -1
- package/build/fetchers/repo.js +27 -68
- package/build/fetchers/stats.d.ts +24 -17
- package/build/fetchers/stats.d.ts.map +1 -1
- package/build/fetchers/stats.js +302 -184
- package/build/fetchers/top-languages.d.ts +10 -15
- package/build/fetchers/top-languages.d.ts.map +1 -1
- package/build/fetchers/top-languages.js +52 -103
- package/build/fetchers/types.d.ts +130 -0
- package/build/fetchers/types.d.ts.map +1 -0
- package/build/fetchers/types.js +1 -0
- package/build/fetchers/wakatime.d.ts +9 -5
- package/build/fetchers/wakatime.d.ts.map +1 -1
- package/build/fetchers/wakatime.js +8 -4
- package/build/graphql/contributionsDocument.d.ts +18 -0
- package/build/graphql/contributionsDocument.d.ts.map +1 -0
- package/build/graphql/contributionsDocument.js +30 -0
- package/build/graphql/generated/common.d.ts +42 -0
- package/build/graphql/generated/common.d.ts.map +1 -0
- package/build/graphql/generated/common.js +2 -0
- package/build/graphql/generated/gist.d.ts +44 -0
- package/build/graphql/generated/gist.d.ts.map +1 -0
- package/build/graphql/generated/gist.js +27 -0
- package/build/graphql/generated/repo.d.ts +67 -0
- package/build/graphql/generated/repo.d.ts.map +1 -0
- package/build/graphql/generated/repo.js +30 -0
- package/build/graphql/generated/stats.d.ts +150 -0
- package/build/graphql/generated/stats.d.ts.map +1 -0
- package/build/graphql/generated/stats.js +95 -0
- package/build/graphql/generated/top-languages.d.ts +54 -0
- package/build/graphql/generated/top-languages.d.ts.map +1 -0
- package/build/graphql/generated/top-languages.js +27 -0
- package/build/graphql/graphqlDocument.d.ts +22 -0
- package/build/graphql/graphqlDocument.d.ts.map +1 -0
- package/build/graphql/graphqlDocument.js +8 -0
- package/build/graphql/reposContributedToDocument.d.ts +27 -0
- package/build/graphql/reposContributedToDocument.d.ts.map +1 -0
- package/build/graphql/reposContributedToDocument.js +59 -0
- package/build/index.d.ts +3 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -1
- package/build/themes/index.d.ts +32 -0
- package/build/themes/index.d.ts.map +1 -1
- package/build/themes/index.js +28 -0
- package/build/translations.d.ts +17 -0
- package/build/translations.d.ts.map +1 -1
- package/build/translations.js +17 -0
- package/package.json +14 -8
- package/src/_emoji-name-map.d.ts +10 -0
- package/src/_github-username-regex.d.ts +4 -0
- package/src/api/gist.js +31 -31
- package/src/api/index.js +40 -42
- package/src/api/pin.js +20 -38
- package/src/api/top-langs.js +36 -49
- package/src/api/wakatime.js +31 -31
- package/src/{calculateRank.js → calculateRank.ts} +29 -19
- package/src/cards/common-options.ts +13 -0
- package/src/cards/{gist.js → gist.ts} +37 -37
- package/src/cards/{repo.js → repo.ts} +107 -79
- package/src/cards/{stats.js → stats.ts} +173 -210
- package/src/cards/{top-languages.js → top-languages.ts} +325 -243
- package/src/cards/{wakatime.js → wakatime.ts} +158 -127
- package/src/common/Card.ts +123 -43
- package/src/common/I18n.ts +6 -2
- package/src/common/color.ts +240 -28
- package/src/common/config.ts +22 -29
- package/src/common/constants.ts +3 -1
- package/src/common/date.ts +45 -0
- package/src/common/html.ts +1 -1
- package/src/common/http.ts +71 -0
- package/src/common/icons.ts +1 -0
- package/src/common/languageColors.json +10 -1
- package/src/common/languageColors.ts +19 -0
- package/src/common/ops.ts +158 -0
- package/src/common/render.ts +652 -0
- package/src/common/retryer.ts +21 -12
- package/src/fetchers/gist.ts +79 -0
- package/src/fetchers/repo.ts +114 -0
- package/src/fetchers/stats.ts +743 -0
- package/src/fetchers/top-languages.ts +135 -0
- package/src/fetchers/{types.d.ts → types.ts} +28 -20
- package/src/fetchers/{wakatime.js → wakatime.ts} +19 -5
- package/src/graphql/contributionsDocument.ts +44 -0
- package/src/graphql/generated/common.ts +26 -0
- package/src/graphql/generated/gist.ts +59 -0
- package/src/graphql/generated/repo.ts +90 -0
- package/src/graphql/generated/stats.ts +194 -0
- package/src/graphql/generated/top-languages.ts +75 -0
- package/src/graphql/graphqlDocument.ts +25 -0
- package/src/graphql/queries/gist.graphql +25 -0
- package/src/graphql/queries/repo.graphql +28 -0
- package/src/graphql/queries/stats.graphql +120 -0
- package/src/graphql/queries/top-languages.graphql +34 -0
- package/src/graphql/reposContributedToDocument.ts +86 -0
- package/src/index.ts +3 -1
- package/src/themes/index.ts +33 -0
- package/src/translations.ts +17 -0
- package/src/cards/types.d.ts +0 -78
- package/src/common/http.js +0 -19
- package/src/common/ops.js +0 -170
- package/src/common/render.js +0 -440
- package/src/fetchers/gist.js +0 -112
- package/src/fetchers/repo.js +0 -161
- package/src/fetchers/stats.js +0 -474
- package/src/fetchers/top-languages.js +0 -175
- package/src/themes/README.md +0 -229
package/build/fetchers/gist.js
CHANGED
|
@@ -1,78 +1,38 @@
|
|
|
1
1
|
import { MissingParamError } from "../common/error.js";
|
|
2
|
-
import {
|
|
2
|
+
import { createGraphQLFetcher } from "../common/http.js";
|
|
3
3
|
import { retryer } from "../common/retryer.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
viewer {
|
|
7
|
-
gist(name: $gistName) {
|
|
8
|
-
description
|
|
9
|
-
owner {
|
|
10
|
-
login
|
|
11
|
-
}
|
|
12
|
-
stargazerCount
|
|
13
|
-
forks {
|
|
14
|
-
totalCount
|
|
15
|
-
}
|
|
16
|
-
files {
|
|
17
|
-
name
|
|
18
|
-
language {
|
|
19
|
-
name
|
|
20
|
-
}
|
|
21
|
-
size
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
`;
|
|
27
|
-
/**
|
|
28
|
-
* Gist data fetcher.
|
|
29
|
-
*
|
|
30
|
-
* @param {object} variables Fetcher variables.
|
|
31
|
-
* @param {string} token GitHub token.
|
|
32
|
-
* @returns {Promise<import('axios').AxiosResponse>} The response.
|
|
33
|
-
*/
|
|
34
|
-
const fetcher = async (variables, token) => {
|
|
35
|
-
return await request({ query: QUERY, variables }, { Authorization: `token ${token}` });
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* @typedef {{ name: string; language: { name: string; }, size: number }} GistFile Gist file.
|
|
39
|
-
*/
|
|
4
|
+
import { GistInfoDocument } from "../graphql/generated/gist.js";
|
|
5
|
+
const fetcher = createGraphQLFetcher(GistInfoDocument, "token");
|
|
40
6
|
/**
|
|
41
7
|
* This function calculates the primary language of a gist by files size.
|
|
42
8
|
*
|
|
43
|
-
* @param
|
|
44
|
-
* @returns
|
|
9
|
+
* @param files Files.
|
|
10
|
+
* @returns Primary language, or `null` when no file has a language.
|
|
45
11
|
*/
|
|
46
12
|
const calculatePrimaryLanguage = (files) => {
|
|
47
|
-
/** @type {Record<string, number>} */
|
|
48
13
|
const languages = {};
|
|
49
14
|
for (const file of files) {
|
|
50
15
|
if (file.language) {
|
|
51
|
-
|
|
52
|
-
languages[file.language.name]
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
languages[file.language.name] = file.size;
|
|
56
|
-
}
|
|
16
|
+
languages[file.language.name] =
|
|
17
|
+
(languages[file.language.name] ?? 0) + (file.size ?? 0);
|
|
57
18
|
}
|
|
58
19
|
}
|
|
59
|
-
let primaryLanguage =
|
|
60
|
-
|
|
61
|
-
|
|
20
|
+
let primaryLanguage = null;
|
|
21
|
+
let maxSize = -1;
|
|
22
|
+
for (const [language, size] of Object.entries(languages)) {
|
|
23
|
+
if (size > maxSize) {
|
|
24
|
+
maxSize = size;
|
|
62
25
|
primaryLanguage = language;
|
|
63
26
|
}
|
|
64
27
|
}
|
|
65
28
|
return primaryLanguage;
|
|
66
29
|
};
|
|
67
|
-
/**
|
|
68
|
-
* @typedef {import('./types').GistData} GistData Gist data.
|
|
69
|
-
*/
|
|
70
30
|
/**
|
|
71
31
|
* Fetch GitHub gist information by given username and ID.
|
|
72
32
|
*
|
|
73
|
-
* @param
|
|
74
|
-
* @param
|
|
75
|
-
* @returns
|
|
33
|
+
* @param id GitHub gist ID.
|
|
34
|
+
* @param pat Optional PAT override.
|
|
35
|
+
* @returns Gist data.
|
|
76
36
|
*/
|
|
77
37
|
const fetchGist = async (id, pat = null) => {
|
|
78
38
|
if (!id) {
|
|
@@ -80,19 +40,23 @@ const fetchGist = async (id, pat = null) => {
|
|
|
80
40
|
}
|
|
81
41
|
const res = await retryer(fetcher, { gistName: id }, pat);
|
|
82
42
|
if (res.data.errors) {
|
|
83
|
-
throw new Error(res.data.errors[0]
|
|
43
|
+
throw new Error(res.data.errors[0]?.message);
|
|
84
44
|
}
|
|
85
|
-
|
|
45
|
+
const gist = res.data.data.viewer.gist;
|
|
46
|
+
if (!gist) {
|
|
86
47
|
throw new Error("Gist not found");
|
|
87
48
|
}
|
|
88
|
-
const
|
|
49
|
+
const firstFile = gist.files?.[0];
|
|
50
|
+
if (!firstFile?.name) {
|
|
51
|
+
throw new Error("Gist has no files");
|
|
52
|
+
}
|
|
89
53
|
return {
|
|
90
|
-
name:
|
|
91
|
-
nameWithOwner: `${
|
|
92
|
-
description:
|
|
93
|
-
language: calculatePrimaryLanguage(
|
|
94
|
-
starsCount:
|
|
95
|
-
forksCount:
|
|
54
|
+
name: firstFile.name,
|
|
55
|
+
nameWithOwner: `${gist.owner?.login ?? ""}/${firstFile.name}`,
|
|
56
|
+
description: gist.description,
|
|
57
|
+
language: calculatePrimaryLanguage(gist.files?.filter((file) => !!file) ?? []),
|
|
58
|
+
starsCount: gist.stargazerCount,
|
|
59
|
+
forksCount: gist.forks.totalCount,
|
|
96
60
|
};
|
|
97
61
|
};
|
|
98
62
|
export { fetchGist };
|
package/build/fetchers/repo.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
* Repository data.
|
|
3
|
-
*/
|
|
4
|
-
export type RepositoryData = any;
|
|
5
|
-
/**
|
|
6
|
-
* @typedef {import("./types").RepositoryData} RepositoryData Repository data.
|
|
7
|
-
*/
|
|
1
|
+
import type { RepositoryData } from "./types.js";
|
|
8
2
|
/**
|
|
9
3
|
* Fetch repository data.
|
|
10
4
|
*
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
13
|
-
* @
|
|
5
|
+
* @param username GitHub username.
|
|
6
|
+
* @param reponame GitHub repository name.
|
|
7
|
+
* @param include_prs_authored Include count of PRs authored.
|
|
8
|
+
* @param include_prs_commented Include count of PRs commented.
|
|
9
|
+
* @param include_prs_reviewed Include count of PRs reviewed.
|
|
10
|
+
* @param include_issues_authored Include count of issues authored.
|
|
11
|
+
* @param include_issues_commented Include count of issues commented.
|
|
12
|
+
* @param pat Optional PAT override.
|
|
13
|
+
* @returns Repository data.
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
declare const fetchRepo: (username: string, reponame: string, include_prs_authored?: boolean, include_prs_commented?: boolean, include_prs_reviewed?: boolean, include_issues_authored?: boolean, include_issues_commented?: boolean, pat?: string | null) => Promise<RepositoryData>;
|
|
16
|
+
export { fetchRepo };
|
|
16
17
|
//# sourceMappingURL=repo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../src/fetchers/repo.
|
|
1
|
+
{"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../src/fetchers/repo.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAMjD;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,SAAS,GACb,UAAU,MAAM,EAChB,UAAU,MAAM,EAChB,8BAA4B,EAC5B,+BAA6B,EAC7B,8BAA4B,EAC5B,iCAA+B,EAC/B,kCAAgC,EAChC,MAAK,MAAM,GAAG,IAAW,KACxB,OAAO,CAAC,cAAc,CA6ExB,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
package/build/fetchers/repo.js
CHANGED
|
@@ -1,67 +1,29 @@
|
|
|
1
1
|
import { MissingParamError } from "../common/error.js";
|
|
2
|
-
import {
|
|
2
|
+
import { createGraphQLFetcher } from "../common/http.js";
|
|
3
3
|
import { retryer } from "../common/retryer.js";
|
|
4
|
+
import { GetRepoDocument } from "../graphql/generated/repo.js";
|
|
4
5
|
import { fetchRepoUserStats } from "./stats.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
* @param {object} variables Fetcher variables.
|
|
9
|
-
* @param {string} token GitHub token.
|
|
10
|
-
* @returns {Promise<import('axios').AxiosResponse>} The response.
|
|
11
|
-
*/
|
|
12
|
-
const fetcher = (variables, token) => {
|
|
13
|
-
return request({
|
|
14
|
-
query: `
|
|
15
|
-
fragment RepoInfo on Repository {
|
|
16
|
-
name
|
|
17
|
-
nameWithOwner
|
|
18
|
-
isPrivate
|
|
19
|
-
isArchived
|
|
20
|
-
isTemplate
|
|
21
|
-
stargazerCount
|
|
22
|
-
description
|
|
23
|
-
primaryLanguage {
|
|
24
|
-
color
|
|
25
|
-
id
|
|
26
|
-
name
|
|
27
|
-
}
|
|
28
|
-
forkCount
|
|
29
|
-
}
|
|
30
|
-
query getRepo($login: String!, $repo: String!) {
|
|
31
|
-
user(login: $login) {
|
|
32
|
-
repository(name: $repo) {
|
|
33
|
-
...RepoInfo
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
organization(login: $login) {
|
|
37
|
-
repository(name: $repo) {
|
|
38
|
-
...RepoInfo
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
`,
|
|
43
|
-
variables,
|
|
44
|
-
}, {
|
|
45
|
-
Authorization: `token ${token}`,
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
const urlExample = "/api/pin?username=USERNAME&repo=REPO_NAME";
|
|
49
|
-
/**
|
|
50
|
-
* @typedef {import("./types").RepositoryData} RepositoryData Repository data.
|
|
51
|
-
*/
|
|
6
|
+
const fetcher = createGraphQLFetcher(GetRepoDocument, "token");
|
|
7
|
+
const urlExample = "/api/pin?username=USERNAME&repo=REPO_NAME";
|
|
52
8
|
/**
|
|
53
9
|
* Fetch repository data.
|
|
54
10
|
*
|
|
55
|
-
* @param
|
|
56
|
-
* @param
|
|
57
|
-
* @
|
|
11
|
+
* @param username GitHub username.
|
|
12
|
+
* @param reponame GitHub repository name.
|
|
13
|
+
* @param include_prs_authored Include count of PRs authored.
|
|
14
|
+
* @param include_prs_commented Include count of PRs commented.
|
|
15
|
+
* @param include_prs_reviewed Include count of PRs reviewed.
|
|
16
|
+
* @param include_issues_authored Include count of issues authored.
|
|
17
|
+
* @param include_issues_commented Include count of issues commented.
|
|
18
|
+
* @param pat Optional PAT override.
|
|
19
|
+
* @returns Repository data.
|
|
58
20
|
*/
|
|
59
21
|
const fetchRepo = async (username, reponame, include_prs_authored = false, include_prs_commented = false, include_prs_reviewed = false, include_issues_authored = false, include_issues_commented = false, pat = null) => {
|
|
60
22
|
let owner = username;
|
|
61
23
|
if (reponame && reponame.includes("/")) {
|
|
62
|
-
const [
|
|
63
|
-
owner =
|
|
64
|
-
reponame =
|
|
24
|
+
const [parsedOwner, parsedRepo] = reponame.split("/");
|
|
25
|
+
owner = parsedOwner ?? "";
|
|
26
|
+
reponame = parsedRepo ?? "";
|
|
65
27
|
}
|
|
66
28
|
if (owner && !username) {
|
|
67
29
|
username = owner;
|
|
@@ -78,34 +40,31 @@ const fetchRepo = async (username, reponame, include_prs_authored = false, inclu
|
|
|
78
40
|
if (!reponame) {
|
|
79
41
|
throw new MissingParamError(["repo"], urlExample);
|
|
80
42
|
}
|
|
81
|
-
|
|
43
|
+
const res = await retryer(fetcher, { login: owner, repo: reponame }, pat);
|
|
82
44
|
const data = res.data.data;
|
|
83
45
|
if (!data.user && !data.organization) {
|
|
84
46
|
throw new Error("Not found");
|
|
85
47
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (!data.user.repository || data.user.repository.isPrivate) {
|
|
48
|
+
if (data.organization === null && data.user) {
|
|
49
|
+
const repository = data.user.repository;
|
|
50
|
+
if (!repository || repository.isPrivate) {
|
|
90
51
|
throw new Error("User Repository Not found");
|
|
91
52
|
}
|
|
92
|
-
|
|
53
|
+
const repoUserStats = await fetchRepoUserStats(username, [owner + "/" + reponame], [], include_prs_authored, include_prs_commented, include_prs_reviewed, include_issues_authored, include_issues_commented, pat);
|
|
93
54
|
return {
|
|
94
55
|
...repoUserStats,
|
|
95
|
-
...
|
|
96
|
-
starCount: data.user.repository.stargazerCount,
|
|
56
|
+
...repository,
|
|
97
57
|
};
|
|
98
58
|
}
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
|
|
59
|
+
if (data.user === null && data.organization) {
|
|
60
|
+
const repository = data.organization.repository;
|
|
61
|
+
if (!repository || repository.isPrivate) {
|
|
102
62
|
throw new Error("Organization Repository Not found");
|
|
103
63
|
}
|
|
104
|
-
|
|
64
|
+
const repoUserStats = await fetchRepoUserStats(username, [owner + "/" + reponame], [], include_prs_authored, include_prs_commented, include_prs_reviewed, include_issues_authored, include_issues_commented, pat);
|
|
105
65
|
return {
|
|
106
66
|
...repoUserStats,
|
|
107
|
-
...
|
|
108
|
-
starCount: data.organization.repository.stargazerCount,
|
|
67
|
+
...repository,
|
|
109
68
|
};
|
|
110
69
|
}
|
|
111
70
|
throw new Error("Unexpected behavior");
|
|
@@ -1,22 +1,29 @@
|
|
|
1
|
+
import type { RepoUserStats, StatsData } from "./types.js";
|
|
2
|
+
declare const fetchRepoUserStats: (username: string, repo: Array<string>, owner: Array<string>, include_prs_authored: boolean, include_prs_commented: boolean, include_prs_reviewed: boolean, include_issues_authored: boolean, include_issues_commented: boolean, pat: string | null) => Promise<RepoUserStats>;
|
|
1
3
|
/**
|
|
2
4
|
* Fetch stats for a given username.
|
|
3
5
|
*
|
|
4
|
-
* @param
|
|
5
|
-
* @param
|
|
6
|
-
* @param
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
-
* @
|
|
6
|
+
* @param username GitHub username.
|
|
7
|
+
* @param include_all_commits Include all commits.
|
|
8
|
+
* @param exclude_repo Repositories to exclude.
|
|
9
|
+
* @param include_merged_pull_requests Include merged pull requests.
|
|
10
|
+
* @param include_discussions Include discussions.
|
|
11
|
+
* @param include_discussions_answers Include discussions answers.
|
|
12
|
+
* @param commits_year Year to count total commits.
|
|
13
|
+
* @param repo Repositories to scope the REST search to.
|
|
14
|
+
* @param owner Owners to scope the REST search to.
|
|
15
|
+
* @param include_prs_authored Include count of PRs authored.
|
|
16
|
+
* @param include_prs_commented Include count of PRs commented.
|
|
17
|
+
* @param include_prs_reviewed Include count of PRs reviewed.
|
|
18
|
+
* @param include_issues_authored Include count of issues authored.
|
|
19
|
+
* @param include_issues_commented Include count of issues commented.
|
|
20
|
+
* @param ownerAffiliations Owner affiliations. Default: OWNER.
|
|
21
|
+
* @param include_contributions Include all-time contributions.
|
|
22
|
+
* @param include_all_time_contribs Include all-time count of repos contributed to.
|
|
23
|
+
* @param contribs_include_own_repos Include user-owned repos in contributed-to counts.
|
|
24
|
+
* @param pat Optional PAT override.
|
|
25
|
+
* @returns Stats data.
|
|
13
26
|
*/
|
|
14
|
-
|
|
15
|
-
export
|
|
16
|
-
totalPRsAuthored: number;
|
|
17
|
-
totalPRsCommented: number;
|
|
18
|
-
totalPRsReviewed: number;
|
|
19
|
-
totalIssuesAuthored: number;
|
|
20
|
-
totalIssuesCommented: number;
|
|
21
|
-
}>;
|
|
27
|
+
declare const fetchStats: (username: string, include_all_commits?: boolean, exclude_repo?: Array<string>, include_merged_pull_requests?: boolean, include_discussions?: boolean, include_discussions_answers?: boolean, commits_year?: number, repo?: Array<string>, owner?: Array<string>, include_prs_authored?: boolean, include_prs_commented?: boolean, include_prs_reviewed?: boolean, include_issues_authored?: boolean, include_issues_commented?: boolean, ownerAffiliations?: Array<string>, include_contributions?: boolean, include_all_time_contribs?: boolean, contribs_include_own_repos?: boolean, pat?: string | null) => Promise<StatsData>;
|
|
28
|
+
export { fetchStats, fetchRepoUserStats };
|
|
22
29
|
//# sourceMappingURL=stats.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/fetchers/stats.
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/fetchers/stats.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAgM3D,QAAA,MAAM,kBAAkB,GACtB,UAAU,MAAM,EAChB,MAAM,KAAK,CAAC,MAAM,CAAC,EACnB,OAAO,KAAK,CAAC,MAAM,CAAC,EACpB,sBAAsB,OAAO,EAC7B,uBAAuB,OAAO,EAC9B,sBAAsB,OAAO,EAC7B,yBAAyB,OAAO,EAChC,0BAA0B,OAAO,EACjC,KAAK,MAAM,GAAG,IAAI,KACjB,OAAO,CAAC,aAAa,CAqDvB,CAAC;AAiQF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,QAAA,MAAM,UAAU,GACd,UAAU,MAAM,EAChB,6BAA2B,EAC3B,eAAc,KAAK,CAAC,MAAM,CAAM,EAChC,sCAAoC,EACpC,6BAA2B,EAC3B,qCAAmC,EACnC,eAAe,MAAM,EACrB,OAAM,KAAK,CAAC,MAAM,CAAM,EACxB,QAAO,KAAK,CAAC,MAAM,CAAM,EACzB,8BAA4B,EAC5B,+BAA6B,EAC7B,8BAA4B,EAC5B,iCAA+B,EAC/B,kCAAgC,EAChC,oBAAmB,KAAK,CAAC,MAAM,CAAM,EACrC,+BAA6B,EAC7B,mCAAiC,EACjC,oCAAkC,EAClC,MAAK,MAAM,GAAG,IAAW,KACxB,OAAO,CAAC,SAAS,CA2JnB,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAC"}
|