@stats-organization/github-readme-stats-core 2.1.2 → 2.1.4
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/README.md +1 -1
- package/build/api/gist.d.ts.map +1 -1
- package/build/api/gist.js +0 -1
- package/build/api/index.d.ts.map +1 -1
- package/build/api/index.js +0 -1
- package/build/api/pin.d.ts.map +1 -1
- package/build/api/pin.js +0 -1
- package/build/api/top-langs.d.ts.map +1 -1
- package/build/api/top-langs.js +0 -1
- package/build/api/wakatime.d.ts.map +1 -1
- package/build/api/wakatime.js +0 -1
- package/build/cards/gist.d.ts.map +1 -1
- package/build/cards/gist.js +0 -1
- package/build/cards/repo.d.ts.map +1 -1
- package/build/cards/repo.js +0 -1
- package/build/cards/stats.d.ts.map +1 -1
- package/build/cards/stats.js +0 -1
- package/build/cards/top-languages.d.ts.map +1 -1
- package/build/cards/top-languages.js +0 -1
- package/build/cards/wakatime.d.ts.map +1 -1
- package/build/cards/wakatime.js +0 -1
- package/build/common/Card.d.ts +48 -60
- package/build/common/Card.d.ts.map +1 -1
- package/build/common/Card.js +49 -50
- package/build/common/I18n.d.ts +13 -14
- package/build/common/I18n.d.ts.map +1 -1
- package/build/common/I18n.js +13 -12
- package/build/common/color.d.ts +30 -40
- package/build/common/color.d.ts.map +1 -1
- package/build/common/color.js +30 -42
- package/build/common/config.d.ts +18 -2
- package/build/common/config.d.ts.map +1 -1
- package/build/common/config.js +17 -26
- package/build/common/constants.d.ts +2 -2
- package/build/common/constants.d.ts.map +1 -1
- package/build/common/constants.js +5 -3
- package/build/common/error.d.ts +36 -29
- package/build/common/error.d.ts.map +1 -1
- package/build/common/error.js +14 -10
- package/build/common/fmt.d.ts +14 -13
- package/build/common/fmt.d.ts.map +1 -1
- package/build/common/fmt.js +19 -15
- package/build/common/html.d.ts +2 -4
- package/build/common/html.d.ts.map +1 -1
- package/build/common/html.js +1 -5
- package/build/common/http.d.ts.map +1 -1
- package/build/common/http.js +0 -1
- package/build/common/icons.d.ts +22 -21
- package/build/common/icons.d.ts.map +1 -1
- package/build/common/icons.js +4 -5
- package/build/common/languageColors.json +2 -0
- package/build/common/ops.d.ts.map +1 -1
- package/build/common/ops.js +0 -1
- package/build/common/render.d.ts.map +1 -1
- package/build/common/render.js +0 -1
- package/build/common/retryer.d.ts +18 -15
- package/build/common/retryer.d.ts.map +1 -1
- package/build/common/retryer.js +21 -30
- package/build/fetchers/gist.d.ts.map +1 -1
- package/build/fetchers/gist.js +0 -1
- package/build/fetchers/repo.d.ts.map +1 -1
- package/build/fetchers/repo.js +3 -6
- package/build/fetchers/stats.d.ts.map +1 -1
- package/build/fetchers/stats.js +3 -6
- package/build/fetchers/top-languages.d.ts.map +1 -1
- package/build/fetchers/top-languages.js +0 -1
- package/build/fetchers/wakatime.d.ts.map +1 -1
- package/build/fetchers/wakatime.js +0 -1
- package/build/translations.d.ts +627 -24
- package/build/translations.d.ts.map +1 -1
- package/build/translations.js +7 -8
- package/package.json +5 -5
- package/src/api/gist.js +0 -2
- package/src/api/index.js +0 -2
- package/src/api/pin.js +0 -2
- package/src/api/top-langs.js +0 -2
- package/src/api/wakatime.js +0 -2
- package/src/cards/gist.js +0 -2
- package/src/cards/repo.js +0 -2
- package/src/cards/stats.js +0 -2
- package/src/cards/top-languages.js +0 -2
- package/src/cards/wakatime.js +0 -2
- package/src/common/{Card.js → Card.ts} +89 -61
- package/src/common/I18n.ts +49 -0
- package/src/common/{color.js → color.ts} +55 -51
- package/src/common/config.ts +83 -0
- package/src/common/constants.ts +10 -0
- package/src/common/{error.js → error.ts} +20 -14
- package/src/common/{fmt.js → fmt.ts} +27 -19
- package/src/common/{html.js → html.ts} +3 -8
- package/src/common/http.js +0 -2
- package/src/common/{icons.js → icons.ts} +9 -7
- package/src/common/languageColors.json +2 -0
- package/src/common/ops.js +0 -2
- package/src/common/render.js +0 -2
- package/src/common/{retryer.js → retryer.ts} +45 -32
- package/src/fetchers/gist.js +0 -2
- package/src/fetchers/repo.js +3 -7
- package/src/fetchers/stats.js +3 -7
- package/src/fetchers/top-languages.js +0 -2
- package/src/fetchers/types.d.ts +1 -1
- package/src/fetchers/wakatime.js +0 -2
- package/src/{translations.js → translations.ts} +14 -10
- package/src/common/I18n.js +0 -42
- package/src/common/config.js +0 -78
- package/src/common/constants.js +0 -9
package/build/common/html.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
// @ts-check
|
|
2
1
|
/**
|
|
3
2
|
* Encode string as HTML.
|
|
4
3
|
*
|
|
5
4
|
* @see https://stackoverflow.com/a/48073476/10629172
|
|
6
|
-
*
|
|
7
|
-
* @param {string} str String to encode.
|
|
8
|
-
* @returns {string} Encoded string.
|
|
9
5
|
*/
|
|
10
6
|
const encodeHTML = (str) => {
|
|
11
7
|
return (str
|
|
12
8
|
.replace(/[\u00A0-\u9999<>&](?!#)/gim, (i) => {
|
|
13
|
-
return
|
|
9
|
+
return `&#${i.charCodeAt(0)};`;
|
|
14
10
|
})
|
|
15
11
|
// eslint-disable-next-line no-control-regex
|
|
16
12
|
.replace(/\u0008/gim, ""));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/common/http.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/common/http.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,8BAJW,OAAO,OAAO,EAAE,kBAAkB,CAAC,MAAM,CAAC,WAC1C,OAAO,OAAO,EAAE,kBAAkB,CAAC,SAAS,CAAC,GAC3C,OAAO,CAAC,GAAG,CAAC,CASxB"}
|
package/build/common/http.js
CHANGED
package/build/common/icons.d.ts
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
1
|
+
declare const icons: {
|
|
2
|
+
star: string;
|
|
3
|
+
commits: string;
|
|
4
|
+
prs: string;
|
|
5
|
+
prs_merged: string;
|
|
6
|
+
prs_merged_percentage: string;
|
|
7
|
+
issues: string;
|
|
8
|
+
icon: string;
|
|
9
|
+
contribs: string;
|
|
10
|
+
fork: string;
|
|
11
|
+
reviews: string;
|
|
12
|
+
discussions_started: string;
|
|
13
|
+
discussions_answered: string;
|
|
14
|
+
comments: string;
|
|
15
|
+
gist: string;
|
|
16
|
+
};
|
|
17
17
|
/**
|
|
18
18
|
* Get rank icon
|
|
19
19
|
*
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
23
|
-
* @returns
|
|
20
|
+
* @param rankIcon - The rank icon type.
|
|
21
|
+
* @param rankLevel - The rank level.
|
|
22
|
+
* @param percentile - The rank percentile.
|
|
23
|
+
* @returns The SVG code of the rank icon
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
declare const rankIcon: (rankIcon: string, rankLevel: string, percentile: number) => string;
|
|
26
|
+
export { icons, rankIcon };
|
|
26
27
|
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/common/icons.
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/common/icons.ts"],"names":[],"mappings":"AA0BA,QAAA,MAAM,KAAK;;;;;;;;;;;;;;;CAeV,CAAC;AAEF;;;;;;;GAOG;AACH,QAAA,MAAM,QAAQ,GACZ,UAAU,MAAM,EAChB,WAAW,MAAM,EACjB,YAAY,MAAM,KACjB,MAyBF,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC"}
|
package/build/common/icons.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-check
|
|
2
1
|
/*
|
|
3
2
|
The icons in this file are based on https://github.com/primer/octicons which is released under the MIT license:
|
|
4
3
|
|
|
@@ -43,10 +42,10 @@ const icons = {
|
|
|
43
42
|
/**
|
|
44
43
|
* Get rank icon
|
|
45
44
|
*
|
|
46
|
-
* @param
|
|
47
|
-
* @param
|
|
48
|
-
* @param
|
|
49
|
-
* @returns
|
|
45
|
+
* @param rankIcon - The rank icon type.
|
|
46
|
+
* @param rankLevel - The rank level.
|
|
47
|
+
* @param percentile - The rank percentile.
|
|
48
|
+
* @returns The SVG code of the rank icon
|
|
50
49
|
*/
|
|
51
50
|
const rankIcon = (rankIcon, rankLevel, percentile) => {
|
|
52
51
|
switch (rankIcon) {
|
|
@@ -254,6 +254,7 @@
|
|
|
254
254
|
"Hy": "#7790B2",
|
|
255
255
|
"IDL": "#a3522f",
|
|
256
256
|
"IGOR Pro": "#0000cc",
|
|
257
|
+
"IL Assembly": "#512BD4",
|
|
257
258
|
"INI": "#d1dbe0",
|
|
258
259
|
"ISPC": "#2D68B1",
|
|
259
260
|
"Idris": "#b30000",
|
|
@@ -467,6 +468,7 @@
|
|
|
467
468
|
"Quake": "#882233",
|
|
468
469
|
"QuakeC": "#975777",
|
|
469
470
|
"QuickBASIC": "#008080",
|
|
471
|
+
"Quint": "#9d6ce5",
|
|
470
472
|
"R": "#198CE7",
|
|
471
473
|
"RAML": "#77d9fb",
|
|
472
474
|
"RAScript": "#2C97FA",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ops.d.ts","sourceRoot":"","sources":["../../src/common/ops.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ops.d.ts","sourceRoot":"","sources":["../../src/common/ops.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,oCAHW,MAAM,GAAG,OAAO,GACd,OAAO,GAAG,SAAS,CAe/B;AAED;;;;;GAKG;AACH,gCAHW,MAAM,GACJ,MAAM,EAAE,CAOpB;AAED;;;;;;;GAOG;AACH,mCALW,MAAM,OACN,MAAM,OACN,MAAM,GACJ,MAAM,CAQlB;AAED;;;;;GAKG;AACH,oCAHW,MAAM,GACJ,MAAM,CAEsC;AAEzD;;;;;;;GAOG;AACH,2BALa,CAAC,OACH,KAAK,CAAC,CAAC,CAAC,YACR,MAAM,GACJ,KAAK,CAAC,CAAC,CAAC,CAgBpB;AAED;;;;;GAKG;AACH,iCAHW,MAAM,GACJ,MAAM,CASlB;AAED;;;;;;GAMG;AACH,6BAJW,IAAI,MACJ,IAAI,GACF,MAAM,CAOlB;AAED;;;;;;;GAOG;AACH,qDALW,MAAM,EAAE,GACN,MAAM,EAAE,CAyBpB;AAED,yEAUC"}
|
package/build/common/ops.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/common/render.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/common/render.js"],"names":[],"mappings":"AAuLA;;;;;;;;;;;;;;GAcG;AACH,2EAXG;IAAqB,OAAO,EAApB,MAAM;IACQ,gBAAgB;IAChB,aAAa;sBAC3B,MAAM,YAAC;qBACP,MAAM,YAAC;mBACP,MAAM,YAAC;uBACP,MAAM,YAAC;gBACP,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,YAAC;yBAC7C,OAAO,YAAC;;CAChB,GAAU,MAAM,CAgDlB;AAtND;;;;;;GAMG;AACH,6CAJW,MAAM,aACN,MAAM,GACJ,MAAM,CASlB;AAED;;;;;;;;;;;;GAYG;AACH,yGATG;IAAuB,CAAC,EAAhB,MAAM;IACS,CAAC,EAAhB,MAAM;IACS,KAAK,EAApB,MAAM;IACS,KAAK,EAApB,MAAM;IACS,QAAQ,EAAvB,MAAM;IACS,0BAA0B,EAAzC,MAAM;IACS,KAAK,EAApB,MAAM;CACd,GAAU,MAAM,CA2BlB;AA8DD;;;;;;;;GAQG;AACH,oCANW,MAAM,SACN,MAAM,GAAC,MAAM,UACb,MAAM,YACN,MAAM,GACJ,MAAM,CAoBlB;AAxKD;;;;;;;;;;GAUG;AACH,6DANG;IAAwB,KAAK,EAArB,MAAM,EAAE;IACM,GAAG,EAAjB,MAAM;IACmB,SAAS,GAAlC,CAAA,QAAQ,GAAG,KAAK,aAAC;IACA,KAAK,GAAtB,MAAM,EAAE,YAAC;CACjB,GAAU,MAAM,EAAE,CAcpB;AA0ND;;;;;;;GAOG;AACH,iCAJW,MAAM,aACN,MAAM,GACJ,MAAM,CA6DlB;AAED;;;;;;;;;;;GAWG;AACH,uCALW,MAAM,YACN,MAAM,YACN,MAAM,GACJ,MAAM,EAAE,CAoFpB;AAED;;;;;;;;;GASG;AACH,wCANW,MAAM,YACN,MAAM,YACN,MAAM,YACN,MAAM,GACJ,MAAM,CAOlB;AApVD;;;;;;;;;;;;;;;GAeG;AACH,8FAVG;IAAsB,IAAI,EAAlB,MAAM;IACQ,CAAC,EAAf,MAAM;IACQ,CAAC,EAAf,MAAM;IACQ,KAAK,EAAnB,MAAM;IACQ,MAAM,EAApB,MAAM;IACQ,SAAS,EAAvB,MAAM;IACQ,SAAS,EAAvB,MAAM;IACS,MAAM,GAArB,MAAM,YAAC;CACf,GAAU,MAAM,CAoBlB;AAED;;;;;;;;GAQG;AACH,yCAHW,MAAM,GACJ,MAAM,CAelB;8BAhJ6B,YAAY"}
|
package/build/common/render.js
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
|
+
import type { AxiosResponse } from "axios";
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
export type AxiosResponse = import("axios").AxiosResponse;
|
|
5
|
-
/**
|
|
6
|
-
* Fetcher function.
|
|
7
|
-
*/
|
|
8
|
-
export type FetcherFunction = (variables: any, token: string, retriesForTests?: number) => Promise<AxiosResponse>;
|
|
9
|
-
/**
|
|
10
|
-
* @typedef {import("axios").AxiosResponse} AxiosResponse Axios response.
|
|
11
|
-
* @typedef {(variables: any, token: string, retriesForTests?: number) => Promise<AxiosResponse>} FetcherFunction Fetcher function.
|
|
3
|
+
* Subset of the response payload the retryer inspects to detect
|
|
4
|
+
* rate-limiting and credential failures.
|
|
12
5
|
*/
|
|
6
|
+
interface ResponseData {
|
|
7
|
+
errors?: Array<{
|
|
8
|
+
type?: string;
|
|
9
|
+
message?: string;
|
|
10
|
+
}>;
|
|
11
|
+
message?: string;
|
|
12
|
+
}
|
|
13
|
+
type FetcherResponse = AxiosResponse<ResponseData>;
|
|
14
|
+
type FetcherFunction = (variables: Record<string, unknown>, token: string, retriesForTests?: number) => Promise<FetcherResponse>;
|
|
13
15
|
/**
|
|
14
16
|
* Try to execute the fetcher function until it succeeds or the max number of retries is reached.
|
|
15
17
|
*
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
19
|
-
* @returns
|
|
18
|
+
* @param fetcher The fetcher function.
|
|
19
|
+
* @param variables Object with arguments to pass to the fetcher function.
|
|
20
|
+
* @param pat Optional PAT override.
|
|
21
|
+
* @returns The response from the fetcher function.
|
|
20
22
|
*/
|
|
21
|
-
|
|
23
|
+
declare const retryer: (fetcher: FetcherFunction, variables: Record<string, unknown>, pat?: string | null) => Promise<FetcherResponse>;
|
|
24
|
+
export { retryer };
|
|
22
25
|
//# sourceMappingURL=retryer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retryer.d.ts","sourceRoot":"","sources":["../../src/common/retryer.
|
|
1
|
+
{"version":3,"file":"retryer.d.ts","sourceRoot":"","sources":["../../src/common/retryer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAM3C;;;GAGG;AACH,UAAU,YAAY;IACpB,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAgBD,KAAK,eAAe,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;AAEnD,KAAK,eAAe,GAAG,CACrB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,KAAK,EAAE,MAAM,EACb,eAAe,CAAC,EAAE,MAAM,KACrB,OAAO,CAAC,eAAe,CAAC,CAAC;AAE9B;;;;;;;GAOG;AACH,QAAA,MAAM,OAAO,GACX,SAAS,eAAe,EACxB,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,MAAK,MAAM,GAAG,IAAW,KACxB,OAAO,CAAC,eAAe,CAiEzB,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/build/common/retryer.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-check
|
|
2
1
|
import { getConfig } from "./config.js";
|
|
3
2
|
import { CustomError } from "./error.js";
|
|
4
3
|
import { logger } from "./log.js";
|
|
@@ -8,51 +7,44 @@ import { logger } from "./log.js";
|
|
|
8
7
|
* The value is generated using `Math.random()` and uniformly distributed
|
|
9
8
|
* across the range.
|
|
10
9
|
*
|
|
11
|
-
* @param
|
|
10
|
+
* @param max The upper bound (exclusive). Must be a positive number.
|
|
12
11
|
*
|
|
13
|
-
* @returns
|
|
12
|
+
* @returns A random integer `n` such that `0 <= n < max`.
|
|
14
13
|
*/
|
|
15
14
|
function getRandomInt(max) {
|
|
16
15
|
return Math.floor(Math.random() * max);
|
|
17
16
|
}
|
|
18
|
-
/**
|
|
19
|
-
* @typedef {import("axios").AxiosResponse} AxiosResponse Axios response.
|
|
20
|
-
* @typedef {(variables: any, token: string, retriesForTests?: number) => Promise<AxiosResponse>} FetcherFunction Fetcher function.
|
|
21
|
-
*/
|
|
22
17
|
/**
|
|
23
18
|
* Try to execute the fetcher function until it succeeds or the max number of retries is reached.
|
|
24
19
|
*
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
27
|
-
* @param
|
|
28
|
-
* @returns
|
|
20
|
+
* @param fetcher The fetcher function.
|
|
21
|
+
* @param variables Object with arguments to pass to the fetcher function.
|
|
22
|
+
* @param pat Optional PAT override.
|
|
23
|
+
* @returns The response from the fetcher function.
|
|
29
24
|
*/
|
|
30
25
|
const retryer = async (fetcher, variables, pat = null) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
PATs = getConfig().pats;
|
|
37
|
-
}
|
|
26
|
+
const PATs = pat
|
|
27
|
+
? [{ name: "user PAT from database", value: pat }]
|
|
28
|
+
: getConfig().pats;
|
|
38
29
|
if (!PATs.length) {
|
|
39
30
|
throw new CustomError("No GitHub API tokens found", CustomError.NO_TOKENS);
|
|
40
31
|
}
|
|
41
32
|
const startPAT = getRandomInt(PATs.length);
|
|
42
33
|
for (let retries = 0; retries < PATs.length; retries++) {
|
|
43
34
|
const currentPAT = PATs[(startPAT + retries) % PATs.length];
|
|
35
|
+
if (!currentPAT) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
44
38
|
try {
|
|
45
|
-
|
|
46
|
-
// @ts-ignore
|
|
47
|
-
currentPAT.value,
|
|
39
|
+
const response = await fetcher(variables, currentPAT.value,
|
|
48
40
|
// used in tests for faking rate limit
|
|
49
41
|
retries);
|
|
50
42
|
// react on both type and message-based rate-limit signals.
|
|
51
43
|
// https://github.com/anuraghazra/github-readme-stats/issues/4425
|
|
52
|
-
const errors = response
|
|
44
|
+
const errors = response.data.errors;
|
|
53
45
|
const errorType = errors?.[0]?.type;
|
|
54
|
-
const errorMsg = errors?.[0]?.message
|
|
55
|
-
const isRateLimited = (errors && errorType === "RATE_LIMITED") ||
|
|
46
|
+
const errorMsg = errors?.[0]?.message ?? "";
|
|
47
|
+
const isRateLimited = (!!errors && errorType === "RATE_LIMITED") ||
|
|
56
48
|
/rate limit/i.test(errorMsg);
|
|
57
49
|
if (isRateLimited) {
|
|
58
50
|
logger.log(`${currentPAT.name} Failed due to rate limiting`);
|
|
@@ -62,16 +54,15 @@ const retryer = async (fetcher, variables, pat = null) => {
|
|
|
62
54
|
}
|
|
63
55
|
}
|
|
64
56
|
catch (err) {
|
|
65
|
-
/** @type {any} */
|
|
66
57
|
const e = err;
|
|
67
58
|
// network/unexpected error → let caller treat as failure
|
|
68
|
-
if (!e
|
|
69
|
-
throw
|
|
59
|
+
if (!e.response) {
|
|
60
|
+
throw err;
|
|
70
61
|
}
|
|
71
|
-
// prettier-ignore
|
|
72
62
|
// also checking for bad credentials if any tokens gets invalidated
|
|
73
|
-
const
|
|
74
|
-
const
|
|
63
|
+
const message = e.response.data.message;
|
|
64
|
+
const isBadCredential = message === "Bad credentials";
|
|
65
|
+
const isAccountSuspended = message === "Sorry. Your account was suspended.";
|
|
75
66
|
if (isBadCredential || isAccountSuspended) {
|
|
76
67
|
logger.log(`${currentPAT.name} Failed due to bad credentials`);
|
|
77
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gist.d.ts","sourceRoot":"","sources":["../../src/fetchers/gist.js"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"gist.d.ts","sourceRoot":"","sources":["../../src/fetchers/gist.js"],"names":[],"mappings":";;;uBA2Ca;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;KAAE,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;;;;;AAiCxE;;GAEG;AAEH;;;;;;GAMG;AACH,8BAJW,MAAM,QACN,MAAM,GAAG,IAAI,GACX,OAAO,CAAC,QAAQ,CAAC,CAwB7B"}
|
package/build/fetchers/gist.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../src/fetchers/repo.js"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../src/fetchers/repo.js"],"names":[],"mappings":";;;;AAuDA;;GAEG;AAEH;;;;;;GAMG;AACH,oCAJW,MAAM,YACN,MAAM,uLACJ,OAAO,CAAC,cAAc,CAAC,CA8FnC"}
|
package/build/fetchers/repo.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-check
|
|
2
1
|
import { MissingParamError } from "../common/error.js";
|
|
3
2
|
import { request } from "../common/http.js";
|
|
4
3
|
import { retryer } from "../common/retryer.js";
|
|
@@ -19,9 +18,7 @@ const fetcher = (variables, token) => {
|
|
|
19
18
|
isPrivate
|
|
20
19
|
isArchived
|
|
21
20
|
isTemplate
|
|
22
|
-
|
|
23
|
-
totalCount
|
|
24
|
-
}
|
|
21
|
+
stargazerCount
|
|
25
22
|
description
|
|
26
23
|
primaryLanguage {
|
|
27
24
|
color
|
|
@@ -96,7 +93,7 @@ const fetchRepo = async (username, reponame, include_prs_authored = false, inclu
|
|
|
96
93
|
return {
|
|
97
94
|
...repoUserStats,
|
|
98
95
|
...data.user.repository,
|
|
99
|
-
starCount: data.user.repository.
|
|
96
|
+
starCount: data.user.repository.stargazerCount,
|
|
100
97
|
};
|
|
101
98
|
}
|
|
102
99
|
if (isOrg) {
|
|
@@ -108,7 +105,7 @@ const fetchRepo = async (username, reponame, include_prs_authored = false, inclu
|
|
|
108
105
|
return {
|
|
109
106
|
...repoUserStats,
|
|
110
107
|
...data.organization.repository,
|
|
111
|
-
starCount: data.organization.repository.
|
|
108
|
+
starCount: data.organization.repository.stargazerCount,
|
|
112
109
|
};
|
|
113
110
|
}
|
|
114
111
|
throw new Error("Unexpected behavior");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/fetchers/stats.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/fetchers/stats.js"],"names":[],"mappings":"AAmTA;;;;;;;;;;;;GAYG;AACH,qCAVW,MAAM,uBACN,OAAO,4BACP,MAAM,EAAE,4CACR,OAAO,mCACP,OAAO,2CACP,OAAO,4BACP,MAAM,GAAC,SAAS,2NAChB,MAAM,EAAE,eACN,OAAO,CAAC,GAA2B,CAAC,CAyJhD;AArOD;;;;;;GA+DC"}
|
package/build/fetchers/stats.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-check
|
|
2
1
|
import axios from "axios";
|
|
3
2
|
import githubUsernameRegex from "github-username-regex";
|
|
4
3
|
import { calculateRank } from "../calculateRank.js";
|
|
@@ -15,9 +14,7 @@ const GRAPHQL_REPOS_FIELD = `
|
|
|
15
14
|
totalCount
|
|
16
15
|
nodes {
|
|
17
16
|
name
|
|
18
|
-
|
|
19
|
-
totalCount
|
|
20
|
-
}
|
|
17
|
+
stargazerCount
|
|
21
18
|
}
|
|
22
19
|
pageInfo {
|
|
23
20
|
hasNextPage
|
|
@@ -139,7 +136,7 @@ const statsFetcher = async ({ username, includeMergedPullRequests, includeDiscus
|
|
|
139
136
|
}
|
|
140
137
|
// Disable multi page fetching on public Vercel instance due to rate limits.
|
|
141
138
|
fetchedPages++;
|
|
142
|
-
const repoNodesWithStars = repoNodes.filter((node) => node.
|
|
139
|
+
const repoNodesWithStars = repoNodes.filter((node) => node.stargazerCount !== 0);
|
|
143
140
|
hasNextPage =
|
|
144
141
|
(getConfig().fetchMultiPageStars === "true" ||
|
|
145
142
|
getConfig().fetchMultiPageStars > fetchedPages) &&
|
|
@@ -322,7 +319,7 @@ const fetchStats = async (username, include_all_commits = false, exclude_repo =
|
|
|
322
319
|
return !repoToHide.has(data.name);
|
|
323
320
|
})
|
|
324
321
|
.reduce((prev, curr) => {
|
|
325
|
-
return prev + curr.
|
|
322
|
+
return prev + curr.stargazerCount;
|
|
326
323
|
}, 0);
|
|
327
324
|
stats.rank = calculateRank({
|
|
328
325
|
all_commits: include_all_commits,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"top-languages.d.ts","sourceRoot":"","sources":["../../src/fetchers/top-languages.js"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"top-languages.d.ts","sourceRoot":"","sources":["../../src/fetchers/top-languages.js"],"names":[],"mappings":";;;;AA+CA;;GAEG;AAEH;;;;;;;;;;GAUG;AACH,4CARW,MAAM,iBACN,MAAM,EAAE,gBACR,MAAM,iBACN,MAAM,sBACN,MAAM,EAAE,QACR,MAAM,GAAC,IAAI,GACT,OAAO,CAAC,WAAW,CAAC,CAgHhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wakatime.d.ts","sourceRoot":"","sources":["../../src/fetchers/wakatime.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wakatime.d.ts","sourceRoot":"","sources":["../../src/fetchers/wakatime.js"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,6DAHW;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACrC,OAAO,CAAC,GAA8B,CAAC,CAwBnD"}
|