@stats-organization/github-readme-stats-core 2.1.5 → 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.
Files changed (169) hide show
  1. package/build/api/gist.d.ts +2 -7
  2. package/build/api/gist.d.ts.map +1 -1
  3. package/build/api/gist.js +9 -41
  4. package/build/api/index.d.ts +3 -8
  5. package/build/api/index.d.ts.map +1 -1
  6. package/build/api/index.js +23 -45
  7. package/build/api/pin.d.ts +2 -7
  8. package/build/api/pin.d.ts.map +1 -1
  9. package/build/api/pin.js +9 -41
  10. package/build/api/top-langs.d.ts +2 -7
  11. package/build/api/top-langs.d.ts.map +1 -1
  12. package/build/api/top-langs.js +11 -55
  13. package/build/api/wakatime.d.ts +2 -7
  14. package/build/api/wakatime.d.ts.map +1 -1
  15. package/build/api/wakatime.js +9 -41
  16. package/build/cards/common-options.d.ts +13 -0
  17. package/build/cards/common-options.d.ts.map +1 -0
  18. package/build/cards/common-options.js +1 -0
  19. package/build/cards/gist.d.ts +11 -16
  20. package/build/cards/gist.d.ts.map +1 -1
  21. package/build/cards/gist.js +26 -31
  22. package/build/cards/repo.d.ts +19 -16
  23. package/build/cards/repo.d.ts.map +1 -1
  24. package/build/cards/repo.js +58 -60
  25. package/build/cards/stats.d.ts +29 -46
  26. package/build/cards/stats.d.ts.map +1 -1
  27. package/build/cards/stats.js +113 -181
  28. package/build/cards/top-languages.d.ts +81 -77
  29. package/build/cards/top-languages.d.ts.map +1 -1
  30. package/build/cards/top-languages.js +174 -200
  31. package/build/cards/wakatime.d.ts +21 -11
  32. package/build/cards/wakatime.d.ts.map +1 -1
  33. package/build/cards/wakatime.js +73 -111
  34. package/build/common/Card.d.ts +34 -13
  35. package/build/common/Card.d.ts.map +1 -1
  36. package/build/common/Card.js +73 -40
  37. package/build/common/I18n.d.ts +4 -2
  38. package/build/common/I18n.d.ts.map +1 -1
  39. package/build/common/color.d.ts +60 -18
  40. package/build/common/color.d.ts.map +1 -1
  41. package/build/common/color.js +102 -5
  42. package/build/common/config.d.ts +2 -1
  43. package/build/common/config.d.ts.map +1 -1
  44. package/build/common/config.js +16 -26
  45. package/build/common/constants.d.ts +2 -1
  46. package/build/common/constants.d.ts.map +1 -1
  47. package/build/common/date.d.ts +37 -0
  48. package/build/common/date.d.ts.map +1 -0
  49. package/build/common/date.js +31 -0
  50. package/build/common/http.d.ts +25 -2
  51. package/build/common/http.d.ts.map +1 -1
  52. package/build/common/http.js +26 -3
  53. package/build/common/icons.d.ts +1 -0
  54. package/build/common/icons.d.ts.map +1 -1
  55. package/build/common/icons.js +1 -0
  56. package/build/common/languageColors.d.ts +11 -0
  57. package/build/common/languageColors.d.ts.map +1 -0
  58. package/build/common/languageColors.js +15 -0
  59. package/build/common/languageColors.json +1 -0
  60. package/build/common/ops.d.ts +3 -10
  61. package/build/common/ops.d.ts.map +1 -1
  62. package/build/common/ops.js +3 -15
  63. package/build/common/render.d.ts +43 -6
  64. package/build/common/render.d.ts.map +1 -1
  65. package/build/common/render.js +77 -11
  66. package/build/common/retryer.d.ts +3 -2
  67. package/build/common/retryer.d.ts.map +1 -1
  68. package/build/common/retryer.js +1 -0
  69. package/build/fetchers/gist.d.ts.map +1 -1
  70. package/build/fetchers/gist.js +8 -39
  71. package/build/fetchers/repo.d.ts +12 -11
  72. package/build/fetchers/repo.d.ts.map +1 -1
  73. package/build/fetchers/repo.js +26 -67
  74. package/build/fetchers/stats.d.ts +24 -17
  75. package/build/fetchers/stats.d.ts.map +1 -1
  76. package/build/fetchers/stats.js +302 -183
  77. package/build/fetchers/top-languages.d.ts +10 -15
  78. package/build/fetchers/top-languages.d.ts.map +1 -1
  79. package/build/fetchers/top-languages.js +52 -103
  80. package/build/fetchers/types.d.ts +24 -20
  81. package/build/fetchers/types.d.ts.map +1 -1
  82. package/build/fetchers/wakatime.d.ts +9 -5
  83. package/build/fetchers/wakatime.d.ts.map +1 -1
  84. package/build/fetchers/wakatime.js +8 -4
  85. package/build/graphql/contributionsDocument.d.ts +18 -0
  86. package/build/graphql/contributionsDocument.d.ts.map +1 -0
  87. package/build/graphql/contributionsDocument.js +30 -0
  88. package/build/graphql/generated/common.d.ts +42 -0
  89. package/build/graphql/generated/common.d.ts.map +1 -0
  90. package/build/graphql/generated/common.js +2 -0
  91. package/build/graphql/generated/gist.d.ts +44 -0
  92. package/build/graphql/generated/gist.d.ts.map +1 -0
  93. package/build/graphql/generated/gist.js +27 -0
  94. package/build/graphql/generated/repo.d.ts +67 -0
  95. package/build/graphql/generated/repo.d.ts.map +1 -0
  96. package/build/graphql/generated/repo.js +30 -0
  97. package/build/graphql/generated/stats.d.ts +150 -0
  98. package/build/graphql/generated/stats.d.ts.map +1 -0
  99. package/build/graphql/generated/stats.js +95 -0
  100. package/build/graphql/generated/top-languages.d.ts +54 -0
  101. package/build/graphql/generated/top-languages.d.ts.map +1 -0
  102. package/build/graphql/generated/top-languages.js +27 -0
  103. package/build/graphql/graphqlDocument.d.ts +22 -0
  104. package/build/graphql/graphqlDocument.d.ts.map +1 -0
  105. package/build/graphql/graphqlDocument.js +8 -0
  106. package/build/graphql/reposContributedToDocument.d.ts +27 -0
  107. package/build/graphql/reposContributedToDocument.d.ts.map +1 -0
  108. package/build/graphql/reposContributedToDocument.js +59 -0
  109. package/build/index.d.ts +3 -1
  110. package/build/index.d.ts.map +1 -1
  111. package/build/index.js +2 -1
  112. package/build/themes/index.d.ts +32 -0
  113. package/build/themes/index.d.ts.map +1 -1
  114. package/build/themes/index.js +28 -0
  115. package/build/translations.d.ts +17 -0
  116. package/build/translations.d.ts.map +1 -1
  117. package/build/translations.js +17 -0
  118. package/package.json +13 -7
  119. package/src/_github-username-regex.d.ts +4 -0
  120. package/src/api/gist.js +10 -46
  121. package/src/api/index.js +30 -51
  122. package/src/api/pin.js +10 -46
  123. package/src/api/top-langs.js +13 -60
  124. package/src/api/wakatime.js +10 -46
  125. package/src/cards/common-options.ts +13 -0
  126. package/src/cards/{gist.js → gist.ts} +37 -37
  127. package/src/cards/{repo.js → repo.ts} +86 -68
  128. package/src/cards/{stats.js → stats.ts} +168 -219
  129. package/src/cards/{top-languages.js → top-languages.ts} +309 -265
  130. package/src/cards/{wakatime.js → wakatime.ts} +136 -130
  131. package/src/common/Card.ts +94 -49
  132. package/src/common/I18n.ts +6 -2
  133. package/src/common/color.ts +163 -14
  134. package/src/common/config.ts +22 -29
  135. package/src/common/constants.ts +3 -1
  136. package/src/common/date.ts +45 -0
  137. package/src/common/http.ts +43 -3
  138. package/src/common/icons.ts +1 -0
  139. package/src/common/languageColors.json +1 -0
  140. package/src/common/languageColors.ts +19 -0
  141. package/src/common/ops.ts +8 -18
  142. package/src/common/render.ts +114 -14
  143. package/src/common/retryer.ts +6 -5
  144. package/src/fetchers/gist.ts +15 -72
  145. package/src/fetchers/repo.ts +114 -0
  146. package/src/fetchers/stats.ts +743 -0
  147. package/src/fetchers/top-languages.ts +135 -0
  148. package/src/fetchers/types.ts +28 -20
  149. package/src/fetchers/{wakatime.js → wakatime.ts} +19 -5
  150. package/src/graphql/contributionsDocument.ts +44 -0
  151. package/src/graphql/generated/common.ts +26 -0
  152. package/src/graphql/generated/gist.ts +59 -0
  153. package/src/graphql/generated/repo.ts +90 -0
  154. package/src/graphql/generated/stats.ts +194 -0
  155. package/src/graphql/generated/top-languages.ts +75 -0
  156. package/src/graphql/graphqlDocument.ts +25 -0
  157. package/src/graphql/queries/gist.graphql +25 -0
  158. package/src/graphql/queries/repo.graphql +28 -0
  159. package/src/graphql/queries/stats.graphql +120 -0
  160. package/src/graphql/queries/top-languages.graphql +34 -0
  161. package/src/graphql/reposContributedToDocument.ts +86 -0
  162. package/src/index.ts +3 -1
  163. package/src/themes/index.ts +33 -0
  164. package/src/translations.ts +17 -0
  165. package/src/cards/types.d.ts +0 -78
  166. package/src/fetchers/repo.js +0 -161
  167. package/src/fetchers/stats.js +0 -473
  168. package/src/fetchers/top-languages.js +0 -175
  169. package/src/themes/README.md +0 -229
@@ -1,138 +1,87 @@
1
1
  import { getConfig } from "../common/config.js";
2
2
  import { CustomError, MissingParamError } from "../common/error.js";
3
3
  import { wrapTextMultiline } from "../common/fmt.js";
4
- import { request } from "../common/http.js";
4
+ import { createGraphQLFetcher } from "../common/http.js";
5
5
  import { logger } from "../common/log.js";
6
6
  import { parseOwnerAffiliations } from "../common/ops.js";
7
7
  import { retryer } from "../common/retryer.js";
8
- /**
9
- * Top languages fetcher object.
10
- *
11
- * @param {any} variables Fetcher variables.
12
- * @param {string} token GitHub token.
13
- * @returns {Promise<import("axios").AxiosResponse>} Languages fetcher response.
14
- */
15
- const fetcher = (variables, token) => {
16
- return request({
17
- query: `
18
- query userInfo($login: String!, $ownerAffiliations: [RepositoryAffiliation]) {
19
- user(login: $login) {
20
- # do not fetch forks
21
- repositories(ownerAffiliations: $ownerAffiliations, isFork: false, first: 100) {
22
- nodes {
23
- name
24
- languages(first: 10, orderBy: {field: SIZE, direction: DESC}) {
25
- edges {
26
- size
27
- node {
28
- color
29
- name
30
- }
31
- }
32
- }
33
- }
34
- }
35
- }
36
- }
37
- `,
38
- variables,
39
- }, {
40
- Authorization: `token ${token}`,
41
- });
42
- };
43
- /**
44
- * @typedef {import("./types").TopLangData} TopLangData Top languages data.
45
- */
8
+ import { TopLanguagesDocument } from "../graphql/generated/top-languages.js";
9
+ const fetcher = createGraphQLFetcher(TopLanguagesDocument, "token");
46
10
  /**
47
11
  * Fetch top languages for a given username.
48
12
  *
49
- * @param {string} username GitHub username.
50
- * @param {string[]} exclude_repo List of repositories to exclude. Default: [].
51
- * @param {number} size_weight Weightage to be given to size.
52
- * @param {number} count_weight Weightage to be given to count.
53
- * @param {string[]} ownerAffiliations The owner affiliations to filter by. Default: OWNER.
54
- * @param {string|null} pat Optional PAT override.
55
- * @returns {Promise<TopLangData>} Top languages data.
13
+ * @param username GitHub username.
14
+ * @param exclude_repo List of repositories to exclude. Default: [].
15
+ * @param size_weight Weightage to be given to size.
16
+ * @param count_weight Weightage to be given to count.
17
+ * @param ownerAffiliations The owner affiliations to filter by. Default: OWNER.
18
+ * @param pat Optional PAT override.
19
+ * @returns Top languages data.
56
20
  */
57
21
  const fetchTopLanguages = async (username, exclude_repo = [], size_weight = 1, count_weight = 0, ownerAffiliations = [], pat = null) => {
58
22
  if (!username) {
59
23
  throw new MissingParamError(["username"]);
60
24
  }
61
- ownerAffiliations = parseOwnerAffiliations(ownerAffiliations);
25
+ const affiliations = parseOwnerAffiliations(ownerAffiliations);
62
26
  const res = await retryer(fetcher, {
63
27
  login: username,
64
- ownerAffiliations,
28
+ ownerAffiliations: affiliations,
65
29
  }, pat);
66
30
  if (res.data.errors) {
67
31
  logger.error(res.data.errors);
68
- if (res.data.errors[0].type === "NOT_FOUND") {
69
- throw new CustomError(res.data.errors[0].message || "Could not fetch user.", CustomError.USER_NOT_FOUND);
32
+ const firstError = res.data.errors[0];
33
+ if (firstError?.type === "NOT_FOUND") {
34
+ throw new CustomError(firstError.message || "Could not fetch user.", CustomError.USER_NOT_FOUND);
70
35
  }
71
- if (res.data.errors[0].message) {
72
- throw new CustomError(wrapTextMultiline(res.data.errors[0].message, 525, 12)[0], res.statusText);
36
+ if (firstError?.message) {
37
+ throw new CustomError(wrapTextMultiline(firstError.message, 525, 12)[0] ?? "", res.statusText);
73
38
  }
74
39
  throw new CustomError("Something went wrong while trying to retrieve the language data using the GraphQL API.", CustomError.GRAPHQL_ERROR);
75
40
  }
76
- let repoNodes = res.data.data.user.repositories.nodes;
77
- /** @type {Record<string, boolean>} */
78
- let repoToHide = {};
41
+ const repoToHide = {};
79
42
  const allExcludedRepos = [
80
43
  ...exclude_repo,
81
44
  ...getConfig().excludeRepositories,
82
45
  ];
83
- // populate repoToHide map for quick lookup
84
- // while filtering out
85
- if (allExcludedRepos) {
86
- allExcludedRepos.forEach((repoName) => {
87
- repoToHide[repoName] = true;
88
- });
89
- }
46
+ // populate repoToHide map for quick lookup while filtering out
47
+ allExcludedRepos.forEach((repoName) => {
48
+ repoToHide[repoName] = true;
49
+ });
90
50
  // filter out repositories to be hidden
91
- repoNodes = repoNodes
92
- .sort((a, b) => b.size - a.size)
93
- .filter((name) => !repoToHide[name.name]);
94
- let repoCount = 0;
95
- repoNodes = repoNodes
96
- .filter((node) => node.languages.edges.length > 0)
97
- // flatten the list of language nodes
98
- .reduce((acc, curr) => curr.languages.edges.concat(acc), [])
99
- .reduce((acc, prev) => {
100
- // get the size of the language (bytes)
101
- let langSize = prev.size;
102
- // if we already have the language in the accumulator
103
- // & the current language name is same as previous name
104
- // add the size to the language size and increase repoCount.
105
- if (acc[prev.node.name] && prev.node.name === acc[prev.node.name].name) {
106
- langSize = prev.size + acc[prev.node.name].size;
107
- repoCount += 1;
51
+ const repoNodes = (res.data.data.user?.repositories.nodes ?? []).filter((node) => !!node && !repoToHide[node.name]);
52
+ // flatten edges across repos. Order matters: `concat(acc)` prepends, and the
53
+ // shared repoCount below depends on visitation order.
54
+ const languageEdges = repoNodes.reduce((acc, repo) => {
55
+ const edges = (repo.languages?.edges ?? []).filter((edge) => !!edge);
56
+ return edges.length > 0 ? edges.concat(acc) : acc;
57
+ }, []);
58
+ // accumulate size and repo count per language
59
+ const languageMap = {};
60
+ let repoCount;
61
+ for (const edge of languageEdges) {
62
+ const existing = languageMap[edge.node.name];
63
+ // same language seen again: add to its size and bump count; else reset to 1
64
+ let langSize = edge.size;
65
+ if (existing && edge.node.name === existing.name) {
66
+ langSize = edge.size + existing.size;
67
+ repoCount = existing.count + 1;
108
68
  }
109
69
  else {
110
- // reset repoCount to 1
111
- // language must exist in at least one repo to be detected
112
70
  repoCount = 1;
113
71
  }
114
- return {
115
- ...acc,
116
- [prev.node.name]: {
117
- name: prev.node.name,
118
- color: prev.node.color,
119
- size: langSize,
120
- count: repoCount,
121
- },
72
+ languageMap[edge.node.name] = {
73
+ name: edge.node.name,
74
+ color: edge.node.color,
75
+ size: langSize,
76
+ count: repoCount,
122
77
  };
123
- }, {});
124
- Object.keys(repoNodes).forEach((name) => {
125
- // comparison index calculation
126
- repoNodes[name].size =
127
- Math.pow(repoNodes[name].size, size_weight) *
128
- Math.pow(repoNodes[name].count, count_weight);
129
- });
130
- const topLangs = Object.keys(repoNodes)
131
- .sort((a, b) => repoNodes[b].size - repoNodes[a].size)
132
- .reduce((result, key) => {
133
- result[key] = repoNodes[key];
134
- return result;
135
- }, {});
136
- return topLangs;
78
+ }
79
+ // comparison index calculation
80
+ for (const lang of Object.values(languageMap)) {
81
+ lang.size =
82
+ Math.pow(lang.size, size_weight) * Math.pow(lang.count, count_weight);
83
+ }
84
+ // return languages sorted by (weighted) size, descending
85
+ return Object.fromEntries(Object.entries(languageMap).sort(([, a], [, b]) => b.size - a.size));
137
86
  };
138
87
  export { fetchTopLanguages };
@@ -1,3 +1,4 @@
1
+ import type { RepoInfoFragment } from "../graphql/generated/repo.js";
1
2
  export interface GistData {
2
3
  name: string;
3
4
  nameWithOwner: string;
@@ -6,27 +7,25 @@ export interface GistData {
6
7
  starsCount: number;
7
8
  forksCount: number;
8
9
  }
9
- export interface RepositoryData {
10
- name: string;
11
- nameWithOwner: string;
12
- isPrivate: boolean;
13
- isArchived: boolean;
14
- isTemplate: boolean;
15
- stargazerCount: number;
16
- description: string;
10
+ /**
11
+ * What the repo query returns, with `primaryLanguage` loosened:
12
+ * the schema says `name` is non-null, but the card falls back to defaults for callers passing untyped data.
13
+ */
14
+ type RepoInfo = Omit<RepoInfoFragment, "primaryLanguage"> & {
17
15
  primaryLanguage: {
18
- color: string;
19
- id: string;
20
- name: string;
21
- };
22
- forkCount: number;
23
- starCount: number;
24
- totalPRsAuthored: number;
25
- totalPRsCommented: number;
26
- totalPRsReviewed: number;
27
- totalIssuesAuthored: number;
28
- totalIssuesCommented: number;
16
+ color: string | null;
17
+ id?: string;
18
+ name: string | null;
19
+ } | null;
20
+ };
21
+ export interface RepoUserStats {
22
+ totalPRsAuthored?: number;
23
+ totalPRsCommented?: number;
24
+ totalPRsReviewed?: number;
25
+ totalIssuesAuthored?: number;
26
+ totalIssuesCommented?: number;
29
27
  }
28
+ export type RepositoryData = RepoInfo & RepoUserStats;
30
29
  export interface StatsData {
31
30
  name: string;
32
31
  totalPRs: number;
@@ -39,11 +38,13 @@ export interface StatsData {
39
38
  totalDiscussionsStarted: number;
40
39
  totalDiscussionsAnswered: number;
41
40
  contributedTo: number;
41
+ allTimeContributedTo: number;
42
42
  totalPRsAuthored: number;
43
43
  totalPRsCommented: number;
44
44
  totalPRsReviewed: number;
45
45
  totalIssuesAuthored: number;
46
46
  totalIssuesCommented: number;
47
+ totalContributions: number;
47
48
  rank: {
48
49
  level: string;
49
50
  percentile: number;
@@ -51,8 +52,10 @@ export interface StatsData {
51
52
  }
52
53
  export interface Lang {
53
54
  name: string;
54
- color: string;
55
+ color: string | null;
55
56
  size: number;
57
+ /** Number of repositories the language appears in. */
58
+ count: number;
56
59
  }
57
60
  export type TopLangData = Record<string, Lang>;
58
61
  export interface WakaTimeData {
@@ -123,4 +126,5 @@ export interface WakaTimeLang {
123
126
  text: string;
124
127
  percent: number;
125
128
  }
129
+ export {};
126
130
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/fetchers/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,e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ACb,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC,CAAC;IACH,iBAAiB,EAAE,KAAK,CAAC;QACvB,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC,CAAC;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,sCAAsC,EAAE,MAAM,CAAC;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB"}
@@ -1,11 +1,15 @@
1
+ import type { WakaTimeData } from "./types.js";
1
2
  /**
2
3
  * WakaTime data fetcher.
3
4
  *
4
- * @param {{username: string, api_domain: string }} props Fetcher props.
5
- * @returns {Promise<import("./types").WakaTimeData>} WakaTime data response.
5
+ * @param props Fetcher props.
6
+ * @param props.username WakaTime username.
7
+ * @param props.api_domain Optional WakaTime API domain (defaults to `wakatime.com`).
8
+ * @returns WakaTime data response.
6
9
  */
7
- export function fetchWakatimeStats({ username, api_domain }: {
10
+ declare const fetchWakatimeStats: ({ username, api_domain, }: {
8
11
  username: string;
9
- api_domain: string;
10
- }): Promise<any>;
12
+ api_domain?: string;
13
+ }) => Promise<WakaTimeData>;
14
+ export { fetchWakatimeStats };
11
15
  //# sourceMappingURL=wakatime.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"wakatime.d.ts","sourceRoot":"","sources":["../../src/fetchers/wakatime.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;;;;GAOG;AACH,QAAA,MAAM,kBAAkB,GAAU,2BAG/B;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,KAAG,OAAO,CAAC,YAAY,CA0BvB,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -3,10 +3,12 @@ import { CustomError, MissingParamError } from "../common/error.js";
3
3
  /**
4
4
  * WakaTime data fetcher.
5
5
  *
6
- * @param {{username: string, api_domain: string }} props Fetcher props.
7
- * @returns {Promise<import("./types").WakaTimeData>} WakaTime data response.
6
+ * @param props Fetcher props.
7
+ * @param props.username WakaTime username.
8
+ * @param props.api_domain Optional WakaTime API domain (defaults to `wakatime.com`).
9
+ * @returns WakaTime data response.
8
10
  */
9
- const fetchWakatimeStats = async ({ username, api_domain }) => {
11
+ const fetchWakatimeStats = async ({ username, api_domain, }) => {
10
12
  if (!username) {
11
13
  throw new MissingParamError(["username"]);
12
14
  }
@@ -15,7 +17,9 @@ const fetchWakatimeStats = async ({ username, api_domain }) => {
15
17
  return data.data;
16
18
  }
17
19
  catch (err) {
18
- if (err.response.status < 200 || err.response.status > 299) {
20
+ if (axios.isAxiosError(err) &&
21
+ err.response &&
22
+ (err.response.status < 200 || err.response.status > 299)) {
19
23
  throw new CustomError(`Could not resolve to a User with the login of '${username}'`, "WAKATIME_USER_NOT_FOUND");
20
24
  }
21
25
  throw err;
@@ -0,0 +1,18 @@
1
+ import type { YearContributionsFragment } from "./generated/stats.js";
2
+ interface ContributionsQueryVariables {
3
+ login: string;
4
+ }
5
+ interface ContributionsQuery {
6
+ user: Record<`year_${number}`, YearContributionsFragment> | null;
7
+ }
8
+ /**
9
+ * Build the all-time contributions query, one aliased `contributionsCollection` field per year.
10
+ * The shape is only known at runtime.
11
+ *
12
+ * @param years Contribution years, one `year_<year>` alias each.
13
+ * @returns Document for `createGraphQLFetcher`.
14
+ */
15
+ declare const buildContributionsDocument: (years: Array<number>) => import("./graphqlDocument.js").GraphQLDocument<ContributionsQuery, ContributionsQueryVariables>;
16
+ export { buildContributionsDocument };
17
+ export type { ContributionsQuery };
18
+ //# sourceMappingURL=contributionsDocument.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contributionsDocument.d.ts","sourceRoot":"","sources":["../../src/graphql/contributionsDocument.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAGtE,UAAU,2BAA2B;IACnC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,kBAAkB;IAC1B,IAAI,EAAE,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,yBAAyB,CAAC,GAAG,IAAI,CAAC;CAClE;AAED;;;;;;GAMG;AACH,QAAA,MAAM,0BAA0B,GAAI,OAAO,KAAK,CAAC,MAAM,CAAC,oGAoBvD,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,CAAC;AACtC,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { getGitHubYearRange, toGitHubDateTime } from "../common/date.js";
2
+ import { graphqlDocument } from "./graphqlDocument.js";
3
+ /**
4
+ * Build the all-time contributions query, one aliased `contributionsCollection` field per year.
5
+ * The shape is only known at runtime.
6
+ *
7
+ * @param years Contribution years, one `year_<year>` alias each.
8
+ * @returns Document for `createGraphQLFetcher`.
9
+ */
10
+ const buildContributionsDocument = (years) => {
11
+ const yearFields = years
12
+ .map((year) => {
13
+ const { from, to } = getGitHubYearRange(year);
14
+ return `year_${year}: contributionsCollection(from: "${toGitHubDateTime(from)}", to: "${toGitHubDateTime(to)}") { ...YearContributions }`;
15
+ })
16
+ .join("\n");
17
+ // fragment must match queries/stats.graphql, which generates its type
18
+ return graphqlDocument(`
19
+ query userContributions($login: String!) {
20
+ user(login: $login) {
21
+ ${yearFields}
22
+ }
23
+ }
24
+ fragment YearContributions on ContributionsCollection {
25
+ contributionCalendar {
26
+ totalContributions
27
+ }
28
+ }`);
29
+ };
30
+ export { buildContributionsDocument };
@@ -0,0 +1,42 @@
1
+ export type Maybe<T> = T | null;
2
+ export type InputMaybe<T> = Maybe<T>;
3
+ /** All built-in and custom scalars, mapped to their actual values */
4
+ export type Scalars = {
5
+ ID: {
6
+ input: string;
7
+ output: string;
8
+ };
9
+ String: {
10
+ input: string;
11
+ output: string;
12
+ };
13
+ Boolean: {
14
+ input: boolean;
15
+ output: boolean;
16
+ };
17
+ Int: {
18
+ input: number;
19
+ output: number;
20
+ };
21
+ Float: {
22
+ input: number;
23
+ output: number;
24
+ };
25
+ /** An ISO-8601 encoded UTC date string. */
26
+ DateTime: {
27
+ input: string;
28
+ output: string;
29
+ };
30
+ };
31
+ /** The affiliation of a user to a repository */
32
+ export type RepositoryAffiliation =
33
+ /** Repositories that the user has been added to as a collaborator. */
34
+ "COLLABORATOR"
35
+ /**
36
+ * Repositories that the user has access to through being a member of an
37
+ * organization. This includes every repository on every team that the user is on.
38
+ */
39
+ | "ORGANIZATION_MEMBER"
40
+ /** Repositories that are owned by the authenticated user. */
41
+ | "OWNER";
42
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/graphql/generated/common.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAChC,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;AACrC,qEAAqE;AACrE,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,OAAO,EAAE;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC;IAC7C,GAAG,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACvC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,2CAA2C;IAC3C,QAAQ,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7C,CAAC;AAEF,gDAAgD;AAChD,MAAM,MAAM,qBAAqB;AAC/B,sEAAsE;AACpE,cAAc;AAChB;;;GAGG;GACD,qBAAqB;AACvB,6DAA6D;GAC3D,OAAO,CAAC"}
@@ -0,0 +1,2 @@
1
+ // Generated file — see .github/CONTRIBUTING.md
2
+ export {};
@@ -0,0 +1,44 @@
1
+ /** Internal type. DO NOT USE DIRECTLY. */
2
+ type Exact<T extends {
3
+ [key: string]: unknown;
4
+ }> = {
5
+ [K in keyof T]: T[K];
6
+ };
7
+ export type GistFileInfoFragment = {
8
+ name: string | null;
9
+ size: number | null;
10
+ language: {
11
+ name: string;
12
+ } | null;
13
+ };
14
+ export type GistInfoQueryVariables = Exact<{
15
+ gistName: string;
16
+ }>;
17
+ export type GistInfoQuery = {
18
+ viewer: {
19
+ gist: {
20
+ description: string | null;
21
+ stargazerCount: number;
22
+ owner: {
23
+ login: string;
24
+ } | {
25
+ login: string;
26
+ } | null;
27
+ forks: {
28
+ totalCount: number;
29
+ };
30
+ files: Array<{
31
+ name: string | null;
32
+ size: number | null;
33
+ language: {
34
+ name: string;
35
+ } | null;
36
+ } | null> | null;
37
+ } | null;
38
+ };
39
+ };
40
+ export declare const GistInfoDocument: import("../graphqlDocument.js").GraphQLDocument<GistInfoQuery, Exact<{
41
+ gistName: string;
42
+ }>>;
43
+ export {};
44
+ //# sourceMappingURL=gist.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gist.d.ts","sourceRoot":"","sources":["../../../src/graphql/generated/gist.ts"],"names":[],"mappings":"AAEA,0CAA0C;AAC1C,KAAK,KAAK,CAAC,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAE5E,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;YAC3B,cAAc,EAAE,MAAM,CAAC;YACvB,KAAK,EAAE;gBAAE,KAAK,EAAE,MAAM,CAAA;aAAE,GAAG;gBAAE,KAAK,EAAE,MAAM,CAAA;aAAE,GAAG,IAAI,CAAC;YACpD,KAAK,EAAE;gBAAE,UAAU,EAAE,MAAM,CAAA;aAAE,CAAC;YAC9B,KAAK,EAAE,KAAK,CAAC;gBACX,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;gBACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;gBACpB,QAAQ,EAAE;oBAAE,IAAI,EAAE,MAAM,CAAA;iBAAE,GAAG,IAAI,CAAC;aACnC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;SAClB,GAAG,IAAI,CAAC;KACV,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,gBAAgB;cAnBjB,MAAM;GA8Cf,CAAC"}
@@ -0,0 +1,27 @@
1
+ // Generated file — see .github/CONTRIBUTING.md
2
+ import { graphqlDocument } from "../graphqlDocument.js";
3
+ export const GistInfoDocument = graphqlDocument(`
4
+ query gistInfo($gistName: String!) {
5
+ viewer {
6
+ gist(name: $gistName) {
7
+ description
8
+ owner {
9
+ login
10
+ }
11
+ stargazerCount
12
+ forks {
13
+ totalCount
14
+ }
15
+ files {
16
+ ...GistFileInfo
17
+ }
18
+ }
19
+ }
20
+ }
21
+ fragment GistFileInfo on GistFile {
22
+ name
23
+ language {
24
+ name
25
+ }
26
+ size
27
+ }`);
@@ -0,0 +1,67 @@
1
+ /** Internal type. DO NOT USE DIRECTLY. */
2
+ type Exact<T extends {
3
+ [key: string]: unknown;
4
+ }> = {
5
+ [K in keyof T]: T[K];
6
+ };
7
+ export type RepoInfoFragment = {
8
+ name: string;
9
+ nameWithOwner: string;
10
+ isPrivate: boolean;
11
+ isArchived: boolean;
12
+ isTemplate: boolean;
13
+ stargazerCount: number;
14
+ description: string | null;
15
+ forkCount: number;
16
+ primaryLanguage: {
17
+ color: string | null;
18
+ id: string;
19
+ name: string;
20
+ } | null;
21
+ };
22
+ export type GetRepoQueryVariables = Exact<{
23
+ login: string;
24
+ repo: string;
25
+ }>;
26
+ export type GetRepoQuery = {
27
+ user: {
28
+ repository: {
29
+ name: string;
30
+ nameWithOwner: string;
31
+ isPrivate: boolean;
32
+ isArchived: boolean;
33
+ isTemplate: boolean;
34
+ stargazerCount: number;
35
+ description: string | null;
36
+ forkCount: number;
37
+ primaryLanguage: {
38
+ color: string | null;
39
+ id: string;
40
+ name: string;
41
+ } | null;
42
+ } | null;
43
+ } | null;
44
+ organization: {
45
+ repository: {
46
+ name: string;
47
+ nameWithOwner: string;
48
+ isPrivate: boolean;
49
+ isArchived: boolean;
50
+ isTemplate: boolean;
51
+ stargazerCount: number;
52
+ description: string | null;
53
+ forkCount: number;
54
+ primaryLanguage: {
55
+ color: string | null;
56
+ id: string;
57
+ name: string;
58
+ } | null;
59
+ } | null;
60
+ } | null;
61
+ };
62
+ export declare const GetRepoDocument: import("../graphqlDocument.js").GraphQLDocument<GetRepoQuery, Exact<{
63
+ login: string;
64
+ repo: string;
65
+ }>>;
66
+ export {};
67
+ //# sourceMappingURL=repo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../../src/graphql/generated/repo.ts"],"names":[],"mappings":"AAEA,0CAA0C;AAC1C,KAAK,KAAK,CAAC,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAE5E,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE;QAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAC5E,CA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md
2
+ import { graphqlDocument } from "../graphqlDocument.js";
3
+ export const GetRepoDocument = graphqlDocument(`
4
+ query getRepo($login: String!, $repo: String!) {
5
+ user(login: $login) {
6
+ repository(name: $repo) {
7
+ ...RepoInfo
8
+ }
9
+ }
10
+ organization(login: $login) {
11
+ repository(name: $repo) {
12
+ ...RepoInfo
13
+ }
14
+ }
15
+ }
16
+ fragment RepoInfo on Repository {
17
+ name
18
+ nameWithOwner
19
+ isPrivate
20
+ isArchived
21
+ isTemplate
22
+ stargazerCount
23
+ description
24
+ primaryLanguage {
25
+ color
26
+ id
27
+ name
28
+ }
29
+ forkCount
30
+ }`);