@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.
Files changed (106) hide show
  1. package/README.md +1 -1
  2. package/build/api/gist.d.ts.map +1 -1
  3. package/build/api/gist.js +0 -1
  4. package/build/api/index.d.ts.map +1 -1
  5. package/build/api/index.js +0 -1
  6. package/build/api/pin.d.ts.map +1 -1
  7. package/build/api/pin.js +0 -1
  8. package/build/api/top-langs.d.ts.map +1 -1
  9. package/build/api/top-langs.js +0 -1
  10. package/build/api/wakatime.d.ts.map +1 -1
  11. package/build/api/wakatime.js +0 -1
  12. package/build/cards/gist.d.ts.map +1 -1
  13. package/build/cards/gist.js +0 -1
  14. package/build/cards/repo.d.ts.map +1 -1
  15. package/build/cards/repo.js +0 -1
  16. package/build/cards/stats.d.ts.map +1 -1
  17. package/build/cards/stats.js +0 -1
  18. package/build/cards/top-languages.d.ts.map +1 -1
  19. package/build/cards/top-languages.js +0 -1
  20. package/build/cards/wakatime.d.ts.map +1 -1
  21. package/build/cards/wakatime.js +0 -1
  22. package/build/common/Card.d.ts +48 -60
  23. package/build/common/Card.d.ts.map +1 -1
  24. package/build/common/Card.js +49 -50
  25. package/build/common/I18n.d.ts +13 -14
  26. package/build/common/I18n.d.ts.map +1 -1
  27. package/build/common/I18n.js +13 -12
  28. package/build/common/color.d.ts +30 -40
  29. package/build/common/color.d.ts.map +1 -1
  30. package/build/common/color.js +30 -42
  31. package/build/common/config.d.ts +18 -2
  32. package/build/common/config.d.ts.map +1 -1
  33. package/build/common/config.js +17 -26
  34. package/build/common/constants.d.ts +2 -2
  35. package/build/common/constants.d.ts.map +1 -1
  36. package/build/common/constants.js +5 -3
  37. package/build/common/error.d.ts +36 -29
  38. package/build/common/error.d.ts.map +1 -1
  39. package/build/common/error.js +14 -10
  40. package/build/common/fmt.d.ts +14 -13
  41. package/build/common/fmt.d.ts.map +1 -1
  42. package/build/common/fmt.js +19 -15
  43. package/build/common/html.d.ts +2 -4
  44. package/build/common/html.d.ts.map +1 -1
  45. package/build/common/html.js +1 -5
  46. package/build/common/http.d.ts.map +1 -1
  47. package/build/common/http.js +0 -1
  48. package/build/common/icons.d.ts +22 -21
  49. package/build/common/icons.d.ts.map +1 -1
  50. package/build/common/icons.js +4 -5
  51. package/build/common/languageColors.json +2 -0
  52. package/build/common/ops.d.ts.map +1 -1
  53. package/build/common/ops.js +0 -1
  54. package/build/common/render.d.ts.map +1 -1
  55. package/build/common/render.js +0 -1
  56. package/build/common/retryer.d.ts +18 -15
  57. package/build/common/retryer.d.ts.map +1 -1
  58. package/build/common/retryer.js +21 -30
  59. package/build/fetchers/gist.d.ts.map +1 -1
  60. package/build/fetchers/gist.js +0 -1
  61. package/build/fetchers/repo.d.ts.map +1 -1
  62. package/build/fetchers/repo.js +3 -6
  63. package/build/fetchers/stats.d.ts.map +1 -1
  64. package/build/fetchers/stats.js +3 -6
  65. package/build/fetchers/top-languages.d.ts.map +1 -1
  66. package/build/fetchers/top-languages.js +0 -1
  67. package/build/fetchers/wakatime.d.ts.map +1 -1
  68. package/build/fetchers/wakatime.js +0 -1
  69. package/build/translations.d.ts +627 -24
  70. package/build/translations.d.ts.map +1 -1
  71. package/build/translations.js +7 -8
  72. package/package.json +5 -5
  73. package/src/api/gist.js +0 -2
  74. package/src/api/index.js +0 -2
  75. package/src/api/pin.js +0 -2
  76. package/src/api/top-langs.js +0 -2
  77. package/src/api/wakatime.js +0 -2
  78. package/src/cards/gist.js +0 -2
  79. package/src/cards/repo.js +0 -2
  80. package/src/cards/stats.js +0 -2
  81. package/src/cards/top-languages.js +0 -2
  82. package/src/cards/wakatime.js +0 -2
  83. package/src/common/{Card.js → Card.ts} +89 -61
  84. package/src/common/I18n.ts +49 -0
  85. package/src/common/{color.js → color.ts} +55 -51
  86. package/src/common/config.ts +83 -0
  87. package/src/common/constants.ts +10 -0
  88. package/src/common/{error.js → error.ts} +20 -14
  89. package/src/common/{fmt.js → fmt.ts} +27 -19
  90. package/src/common/{html.js → html.ts} +3 -8
  91. package/src/common/http.js +0 -2
  92. package/src/common/{icons.js → icons.ts} +9 -7
  93. package/src/common/languageColors.json +2 -0
  94. package/src/common/ops.js +0 -2
  95. package/src/common/render.js +0 -2
  96. package/src/common/{retryer.js → retryer.ts} +45 -32
  97. package/src/fetchers/gist.js +0 -2
  98. package/src/fetchers/repo.js +3 -7
  99. package/src/fetchers/stats.js +3 -7
  100. package/src/fetchers/top-languages.js +0 -2
  101. package/src/fetchers/types.d.ts +1 -1
  102. package/src/fetchers/wakatime.js +0 -2
  103. package/src/{translations.js → translations.ts} +14 -10
  104. package/src/common/I18n.js +0 -42
  105. package/src/common/config.js +0 -78
  106. package/src/common/constants.js +0 -9
@@ -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 "&#" + i.charCodeAt(0) + ";";
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":"AAIA;;;;;;GAMG;AACH,8BAJW,OAAO,OAAO,EAAE,kBAAkB,CAAC,MAAM,CAAC,WAC1C,OAAO,OAAO,EAAE,kBAAkB,CAAC,SAAS,CAAC,GAC3C,OAAO,CAAC,GAAG,CAAC,CASxB"}
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"}
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import axios from "axios";
3
2
  /**
4
3
  * Send GraphQL request to GitHub API.
@@ -1,26 +1,27 @@
1
- export namespace icons {
2
- let star: string;
3
- let commits: string;
4
- let prs: string;
5
- let prs_merged: string;
6
- let prs_merged_percentage: string;
7
- let issues: string;
8
- let icon: string;
9
- let contribs: string;
10
- let fork: string;
11
- let reviews: string;
12
- let discussions_started: string;
13
- let discussions_answered: string;
14
- let comments: string;
15
- let gist: string;
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 {string} rankIcon - The rank icon type.
21
- * @param {string} rankLevel - The rank level.
22
- * @param {number} percentile - The rank percentile.
23
- * @returns {string} - The SVG code of the rank icon
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
- export function rankIcon(rankIcon: string, rankLevel: string, percentile: number): string;
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.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA6CA;;;;;;;GAOG;AACH,mCALW,MAAM,aACN,MAAM,cACN,MAAM,GACJ,MAAM,CA2BlB"}
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"}
@@ -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 {string} rankIcon - The rank icon type.
47
- * @param {string} rankLevel - The rank level.
48
- * @param {number} percentile - The rank percentile.
49
- * @returns {string} - The SVG code of the rank icon
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":"AAOA;;;;;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"}
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"}
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import toEmoji from "emoji-name-map";
3
2
  import { OWNER_AFFILIATIONS } from "./constants.js";
4
3
  import { CustomError } from "./error.js";
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/common/render.js"],"names":[],"mappings":"AAyLA;;;;;;;;;;;;;;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"}
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"}
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import { getCardColors } from "./color.js";
3
2
  import { SECONDARY_ERROR_MESSAGES, TRY_AGAIN_LATER } from "./error.js";
4
3
  import { encodeHTML } from "./html.js";
@@ -1,22 +1,25 @@
1
+ import type { AxiosResponse } from "axios";
1
2
  /**
2
- * Axios response.
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 {FetcherFunction} fetcher The fetcher function.
17
- * @param {any} variables Object with arguments to pass to the fetcher function.
18
- * @param {string | null} pat Optional PAT override.
19
- * @returns {Promise<any>} The response from the fetcher function.
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
- export function retryer(fetcher: FetcherFunction, variables: any, pat?: string | null): Promise<any>;
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.js"],"names":[],"mappings":";;;4BAqBa,OAAO,OAAO,EAAE,aAAa;;;;8BAC7B,CAAC,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC;AAFhG;;;GAGG;AAEH;;;;;;;GAOG;AACH,iCALW,eAAe,aACf,GAAG,QACH,MAAM,GAAG,IAAI,GACX,OAAO,CAAC,GAAG,CAAC,CAsExB"}
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"}
@@ -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 {number} max The upper bound (exclusive). Must be a positive number.
10
+ * @param max The upper bound (exclusive). Must be a positive number.
12
11
  *
13
- * @returns {number} A random integer `n` such that `0 <= n < max`.
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 {FetcherFunction} fetcher The fetcher function.
26
- * @param {any} variables Object with arguments to pass to the fetcher function.
27
- * @param {string | null} pat Optional PAT override.
28
- * @returns {Promise<any>} The response from the fetcher function.
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
- let PATs;
32
- if (pat) {
33
- PATs = [{ name: "user PAT from database", value: pat }];
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
- let response = await fetcher(variables,
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?.data?.errors;
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?.response) {
69
- throw e;
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 isBadCredential = e?.response?.data?.message === "Bad credentials";
74
- const isAccountSuspended = e?.response?.data?.message === "Sorry. Your account was suspended.";
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":";;;uBA6Ca;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"}
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"}
@@ -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";
@@ -1 +1 @@
1
- {"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../src/fetchers/repo.js"],"names":[],"mappings":";;;;AA2DA;;GAEG;AAEH;;;;;;GAMG;AACH,oCAJW,MAAM,YACN,MAAM,uLACJ,OAAO,CAAC,cAAc,CAAC,CA8FnC"}
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"}
@@ -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
- stargazers {
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.stargazers.totalCount,
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.stargazers.totalCount,
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":"AAuTA;;;;;;;;;;;;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"}
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"}
@@ -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
- stargazers {
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.stargazers.totalCount !== 0);
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.stargazers.totalCount;
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":";;;;AAiDA;;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
+ {"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,4 +1,3 @@
1
- // @ts-check
2
1
  import { getConfig } from "../common/config.js";
3
2
  import { CustomError, MissingParamError } from "../common/error.js";
4
3
  import { wrapTextMultiline } from "../common/fmt.js";
@@ -1 +1 @@
1
- {"version":3,"file":"wakatime.d.ts","sourceRoot":"","sources":["../../src/fetchers/wakatime.js"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,6DAHW;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACrC,OAAO,CAAC,GAA8B,CAAC,CAwBnD"}
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"}
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import axios from "axios";
3
2
  import { CustomError, MissingParamError } from "../common/error.js";
4
3
  /**