@stats-forge/github-stats-forge-core 0.0.1

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 (211) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +148 -0
  3. package/build/api/api-result.d.ts +44 -0
  4. package/build/api/api-result.d.ts.map +1 -0
  5. package/build/api/api-result.js +33 -0
  6. package/build/api/gist.d.ts +29 -0
  7. package/build/api/gist.d.ts.map +1 -0
  8. package/build/api/gist.js +52 -0
  9. package/build/api/index.d.ts +13 -0
  10. package/build/api/index.d.ts.map +1 -0
  11. package/build/api/index.js +8 -0
  12. package/build/api/params.d.ts +93 -0
  13. package/build/api/params.d.ts.map +1 -0
  14. package/build/api/params.js +145 -0
  15. package/build/api/pin.d.ts +47 -0
  16. package/build/api/pin.d.ts.map +1 -0
  17. package/build/api/pin.js +87 -0
  18. package/build/api/stats.d.ts +42 -0
  19. package/build/api/stats.d.ts.map +1 -0
  20. package/build/api/stats.js +132 -0
  21. package/build/api/top-langs.d.ts +37 -0
  22. package/build/api/top-langs.d.ts.map +1 -0
  23. package/build/api/top-langs.js +101 -0
  24. package/build/api/wakatime.d.ts +34 -0
  25. package/build/api/wakatime.d.ts.map +1 -0
  26. package/build/api/wakatime.js +91 -0
  27. package/build/calculateRank.d.ts +29 -0
  28. package/build/calculateRank.d.ts.map +1 -0
  29. package/build/calculateRank.js +58 -0
  30. package/build/cards/gist.d.ts +16 -0
  31. package/build/cards/gist.d.ts.map +1 -0
  32. package/build/cards/gist.js +119 -0
  33. package/build/cards/index.d.ts +11 -0
  34. package/build/cards/index.d.ts.map +1 -0
  35. package/build/cards/index.js +7 -0
  36. package/build/cards/options.d.ts +19 -0
  37. package/build/cards/options.d.ts.map +1 -0
  38. package/build/cards/options.js +1 -0
  39. package/build/cards/repo.d.ts +25 -0
  40. package/build/cards/repo.d.ts.map +1 -0
  41. package/build/cards/repo.js +276 -0
  42. package/build/cards/stats.d.ts +37 -0
  43. package/build/cards/stats.d.ts.map +1 -0
  44. package/build/cards/stats.js +457 -0
  45. package/build/cards/top-languages.d.ts +153 -0
  46. package/build/cards/top-languages.d.ts.map +1 -0
  47. package/build/cards/top-languages.js +805 -0
  48. package/build/cards/wakatime.d.ts +31 -0
  49. package/build/cards/wakatime.d.ts.map +1 -0
  50. package/build/cards/wakatime.js +376 -0
  51. package/build/common/Card.d.ts +121 -0
  52. package/build/common/Card.d.ts.map +1 -0
  53. package/build/common/Card.js +305 -0
  54. package/build/common/I18n.d.ts +27 -0
  55. package/build/common/I18n.d.ts.map +1 -0
  56. package/build/common/I18n.js +35 -0
  57. package/build/common/color.d.ts +112 -0
  58. package/build/common/color.d.ts.map +1 -0
  59. package/build/common/color.js +188 -0
  60. package/build/common/config.d.ts +53 -0
  61. package/build/common/config.d.ts.map +1 -0
  62. package/build/common/config.js +87 -0
  63. package/build/common/constants.d.ts +7 -0
  64. package/build/common/constants.d.ts.map +1 -0
  65. package/build/common/constants.js +9 -0
  66. package/build/common/date.d.ts +29 -0
  67. package/build/common/date.d.ts.map +1 -0
  68. package/build/common/date.js +23 -0
  69. package/build/common/error.d.ts +87 -0
  70. package/build/common/error.d.ts.map +1 -0
  71. package/build/common/error.js +108 -0
  72. package/build/common/fmt.d.ts +28 -0
  73. package/build/common/fmt.d.ts.map +1 -0
  74. package/build/common/fmt.js +68 -0
  75. package/build/common/html.d.ts +8 -0
  76. package/build/common/html.d.ts.map +1 -0
  77. package/build/common/html.js +14 -0
  78. package/build/common/http.d.ts +53 -0
  79. package/build/common/http.d.ts.map +1 -0
  80. package/build/common/http.js +47 -0
  81. package/build/common/icons.d.ts +28 -0
  82. package/build/common/icons.d.ts.map +1 -0
  83. package/build/common/icons.js +77 -0
  84. package/build/common/languageColors.d.ts +11 -0
  85. package/build/common/languageColors.d.ts.map +1 -0
  86. package/build/common/languageColors.js +15 -0
  87. package/build/common/languageColors.json +678 -0
  88. package/build/common/log.d.ts +9 -0
  89. package/build/common/log.d.ts.map +1 -0
  90. package/build/common/log.js +8 -0
  91. package/build/common/ops.d.ts +59 -0
  92. package/build/common/ops.d.ts.map +1 -0
  93. package/build/common/ops.js +115 -0
  94. package/build/common/render.d.ts +196 -0
  95. package/build/common/render.d.ts.map +1 -0
  96. package/build/common/render.js +474 -0
  97. package/build/common/retryer.d.ts +36 -0
  98. package/build/common/retryer.d.ts.map +1 -0
  99. package/build/common/retryer.js +67 -0
  100. package/build/fetchers/gist.d.ts +15 -0
  101. package/build/fetchers/gist.d.ts.map +1 -0
  102. package/build/fetchers/gist.js +68 -0
  103. package/build/fetchers/index.d.ts +13 -0
  104. package/build/fetchers/index.d.ts.map +1 -0
  105. package/build/fetchers/index.js +10 -0
  106. package/build/fetchers/repo.d.ts +27 -0
  107. package/build/fetchers/repo.d.ts.map +1 -0
  108. package/build/fetchers/repo.js +100 -0
  109. package/build/fetchers/stats.d.ts +74 -0
  110. package/build/fetchers/stats.d.ts.map +1 -0
  111. package/build/fetchers/stats.js +498 -0
  112. package/build/fetchers/top-languages.d.ts +23 -0
  113. package/build/fetchers/top-languages.d.ts.map +1 -0
  114. package/build/fetchers/top-languages.js +89 -0
  115. package/build/fetchers/types.d.ts +130 -0
  116. package/build/fetchers/types.d.ts.map +1 -0
  117. package/build/fetchers/types.js +1 -0
  118. package/build/fetchers/wakatime.d.ts +19 -0
  119. package/build/fetchers/wakatime.d.ts.map +1 -0
  120. package/build/fetchers/wakatime.js +36 -0
  121. package/build/graphql/contributionsDocument.d.ts +18 -0
  122. package/build/graphql/contributionsDocument.d.ts.map +1 -0
  123. package/build/graphql/contributionsDocument.js +30 -0
  124. package/build/graphql/generated/common.d.ts +42 -0
  125. package/build/graphql/generated/common.d.ts.map +1 -0
  126. package/build/graphql/generated/common.js +2 -0
  127. package/build/graphql/generated/gist.d.ts +44 -0
  128. package/build/graphql/generated/gist.d.ts.map +1 -0
  129. package/build/graphql/generated/gist.js +27 -0
  130. package/build/graphql/generated/repo.d.ts +67 -0
  131. package/build/graphql/generated/repo.d.ts.map +1 -0
  132. package/build/graphql/generated/repo.js +30 -0
  133. package/build/graphql/generated/stats.d.ts +150 -0
  134. package/build/graphql/generated/stats.d.ts.map +1 -0
  135. package/build/graphql/generated/stats.js +95 -0
  136. package/build/graphql/generated/top-languages.d.ts +54 -0
  137. package/build/graphql/generated/top-languages.d.ts.map +1 -0
  138. package/build/graphql/generated/top-languages.js +27 -0
  139. package/build/graphql/graphqlDocument.d.ts +22 -0
  140. package/build/graphql/graphqlDocument.d.ts.map +1 -0
  141. package/build/graphql/graphqlDocument.js +8 -0
  142. package/build/graphql/reposContributedToDocument.d.ts +27 -0
  143. package/build/graphql/reposContributedToDocument.d.ts.map +1 -0
  144. package/build/graphql/reposContributedToDocument.js +59 -0
  145. package/build/index.d.ts +15 -0
  146. package/build/index.d.ts.map +1 -0
  147. package/build/index.js +10 -0
  148. package/build/themes/index.d.ts +505 -0
  149. package/build/themes/index.d.ts.map +1 -0
  150. package/build/themes/index.js +505 -0
  151. package/build/translations.d.ts +1153 -0
  152. package/build/translations.d.ts.map +1 -0
  153. package/build/translations.js +1156 -0
  154. package/package.json +114 -0
  155. package/src/_emoji-name-map.d.ts +10 -0
  156. package/src/_github-username-regex.d.ts +4 -0
  157. package/src/api/api-result.ts +69 -0
  158. package/src/api/gist.ts +66 -0
  159. package/src/api/index.ts +16 -0
  160. package/src/api/params.ts +221 -0
  161. package/src/api/pin.ts +126 -0
  162. package/src/api/stats.ts +195 -0
  163. package/src/api/top-langs.ts +150 -0
  164. package/src/api/wakatime.ts +130 -0
  165. package/src/calculateRank.ts +91 -0
  166. package/src/cards/gist.ts +169 -0
  167. package/src/cards/index.ts +21 -0
  168. package/src/cards/options.ts +18 -0
  169. package/src/cards/repo.ts +376 -0
  170. package/src/cards/stats.ts +615 -0
  171. package/src/cards/top-languages.ts +1077 -0
  172. package/src/cards/wakatime.ts +501 -0
  173. package/src/common/Card.ts +364 -0
  174. package/src/common/I18n.ts +51 -0
  175. package/src/common/color.ts +296 -0
  176. package/src/common/config.ts +118 -0
  177. package/src/common/constants.ts +12 -0
  178. package/src/common/date.ts +34 -0
  179. package/src/common/error.ts +163 -0
  180. package/src/common/fmt.ts +86 -0
  181. package/src/common/html.ts +17 -0
  182. package/src/common/http.ts +98 -0
  183. package/src/common/icons.ts +80 -0
  184. package/src/common/languageColors.json +678 -0
  185. package/src/common/languageColors.ts +19 -0
  186. package/src/common/log.ts +12 -0
  187. package/src/common/ops.ts +145 -0
  188. package/src/common/render.ts +641 -0
  189. package/src/common/retryer.ts +111 -0
  190. package/src/fetchers/gist.ts +82 -0
  191. package/src/fetchers/index.ts +25 -0
  192. package/src/fetchers/repo.ts +140 -0
  193. package/src/fetchers/stats.ts +742 -0
  194. package/src/fetchers/top-languages.ts +134 -0
  195. package/src/fetchers/types.ts +136 -0
  196. package/src/fetchers/wakatime.ts +56 -0
  197. package/src/graphql/contributionsDocument.ts +44 -0
  198. package/src/graphql/generated/common.ts +26 -0
  199. package/src/graphql/generated/gist.ts +56 -0
  200. package/src/graphql/generated/repo.ts +79 -0
  201. package/src/graphql/generated/stats.ts +180 -0
  202. package/src/graphql/generated/top-languages.ts +66 -0
  203. package/src/graphql/graphqlDocument.ts +25 -0
  204. package/src/graphql/queries/gist.graphql +25 -0
  205. package/src/graphql/queries/repo.graphql +28 -0
  206. package/src/graphql/queries/stats.graphql +113 -0
  207. package/src/graphql/queries/top-languages.graphql +27 -0
  208. package/src/graphql/reposContributedToDocument.ts +83 -0
  209. package/src/index.ts +18 -0
  210. package/src/themes/index.ts +519 -0
  211. package/src/translations.ts +1169 -0
@@ -0,0 +1,95 @@
1
+ // Generated file — see .github/CONTRIBUTING.md
2
+ import { graphqlDocument } from '../graphqlDocument.js';
3
+ export const UserReposDocument = graphqlDocument(`
4
+ query userRepos($login: String!, $after: String, $ownerAffiliations: [RepositoryAffiliation]) {
5
+ user(login: $login) {
6
+ ...RepoStars
7
+ }
8
+ }
9
+ fragment RepoStars on User {
10
+ repositories(
11
+ first: 100
12
+ after: $after
13
+ ownerAffiliations: $ownerAffiliations
14
+ orderBy: {direction: DESC, field: STARGAZERS}
15
+ ) {
16
+ totalCount
17
+ nodes {
18
+ ...RepoNode
19
+ }
20
+ pageInfo {
21
+ hasNextPage
22
+ endCursor
23
+ }
24
+ }
25
+ }
26
+ fragment RepoNode on Repository {
27
+ name
28
+ stargazerCount
29
+ }`);
30
+ export const UserInfoDocument = graphqlDocument(`
31
+ query userInfo($login: String!, $after: String, $includeMergedPullRequests: Boolean!, $includeDiscussions: Boolean!, $includeDiscussionsAnswers: Boolean!, $startTime: DateTime = null, $ownerAffiliations: [RepositoryAffiliation], $includeUserRepositories: Boolean!) {
32
+ user(login: $login) {
33
+ name
34
+ login
35
+ commits: contributionsCollection(from: $startTime) {
36
+ totalCommitContributions
37
+ }
38
+ reviews: contributionsCollection {
39
+ totalPullRequestReviewContributions
40
+ }
41
+ repositoriesContributedTo(
42
+ first: 1
43
+ contributionTypes: [COMMIT, ISSUE, PULL_REQUEST, REPOSITORY]
44
+ includeUserRepositories: $includeUserRepositories
45
+ ) {
46
+ totalCount
47
+ }
48
+ pullRequests(first: 1) {
49
+ totalCount
50
+ }
51
+ mergedPullRequests: pullRequests(states: MERGED) @include(if: $includeMergedPullRequests) {
52
+ totalCount
53
+ }
54
+ openIssues: issues(states: OPEN) {
55
+ totalCount
56
+ }
57
+ closedIssues: issues(states: CLOSED) {
58
+ totalCount
59
+ }
60
+ followers {
61
+ totalCount
62
+ }
63
+ repositoryDiscussions @include(if: $includeDiscussions) {
64
+ totalCount
65
+ }
66
+ repositoryDiscussionComments(onlyAnswers: true) @include(if: $includeDiscussionsAnswers) {
67
+ totalCount
68
+ }
69
+ contributionsCollection {
70
+ contributionYears
71
+ }
72
+ ...RepoStars
73
+ }
74
+ }
75
+ fragment RepoStars on User {
76
+ repositories(
77
+ first: 100
78
+ after: $after
79
+ ownerAffiliations: $ownerAffiliations
80
+ orderBy: {direction: DESC, field: STARGAZERS}
81
+ ) {
82
+ totalCount
83
+ nodes {
84
+ ...RepoNode
85
+ }
86
+ pageInfo {
87
+ hasNextPage
88
+ endCursor
89
+ }
90
+ }
91
+ }
92
+ fragment RepoNode on Repository {
93
+ name
94
+ stargazerCount
95
+ }`);
@@ -0,0 +1,54 @@
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
+ import type * as Types from './common.js';
8
+ export type TopLanguageFragment = {
9
+ size: number;
10
+ node: {
11
+ color: string | null;
12
+ name: string;
13
+ };
14
+ };
15
+ export type TopLanguagesRepositoryFragment = {
16
+ name: string;
17
+ languages: {
18
+ edges: Array<{
19
+ size: number;
20
+ node: {
21
+ color: string | null;
22
+ name: string;
23
+ };
24
+ } | null> | null;
25
+ } | null;
26
+ };
27
+ export type TopLanguagesQueryVariables = Exact<{
28
+ login: string;
29
+ ownerAffiliations?: Array<Types.RepositoryAffiliation | null | undefined> | Types.RepositoryAffiliation | null | undefined;
30
+ }>;
31
+ export type TopLanguagesQuery = {
32
+ user: {
33
+ repositories: {
34
+ nodes: Array<{
35
+ name: string;
36
+ languages: {
37
+ edges: Array<{
38
+ size: number;
39
+ node: {
40
+ color: string | null;
41
+ name: string;
42
+ };
43
+ } | null> | null;
44
+ } | null;
45
+ } | null> | null;
46
+ };
47
+ } | null;
48
+ };
49
+ export declare const TopLanguagesDocument: import("../graphqlDocument.js").GraphQLDocument<TopLanguagesQuery, Exact<{
50
+ login: string;
51
+ ownerAffiliations?: Array<Types.RepositoryAffiliation | null | undefined> | Types.RepositoryAffiliation | null | undefined;
52
+ }>>;
53
+ export {};
54
+ //# sourceMappingURL=top-languages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"top-languages.d.ts","sourceRoot":"","sources":["../../../src/graphql/generated/top-languages.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;AAG5E,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAC;AAC1C,MAAM,MAAM,mBAAmB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAEjG,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE;QACT,KAAK,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE;gBAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;gBAAC,IAAI,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;KAC5F,GAAG,IAAI,CAAC;CACV,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,KAAK,CAAC;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,CAAC,EACd,KAAK,CAAC,KAAK,CAAC,qBAAqB,GAAG,IAAI,GAAG,SAAS,CAAC,GACrD,KAAK,CAAC,qBAAqB,GAC3B,IAAI,GACJ,SAAS,CAAC;CACf,CAAC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE;QACJ,YAAY,EAAE;YACZ,KAAK,EAAE,KAAK,CAAC;gBACX,IAAI,EAAE,MAAM,CAAC;gBACb,SAAS,EAAE;oBACT,KAAK,EAAE,KAAK,CAAC;wBACX,IAAI,EAAE,MAAM,CAAC;wBACb,IAAI,EAAE;4BAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;4BAAC,IAAI,EAAE,MAAM,CAAA;yBAAE,CAAC;qBAC9C,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;iBAClB,GAAG,IAAI,CAAC;aACV,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;SAClB,CAAC;KACH,GAAG,IAAI,CAAC;CACV,CAAC;AAEF,eAAO,MAAM,oBAAoB;WAxBxB,MAAM;wBAET,KAAK,CAAC,KAAK,CAAC,qBAAqB,GAAG,IAAI,GAAG,SAAS,CAAC,GACrD,KAAK,CAAC,qBAAqB,GAC3B,IAAI,GACJ,SAAS;GA2CZ,CAAC"}
@@ -0,0 +1,27 @@
1
+ // Generated file — see .github/CONTRIBUTING.md
2
+ import { graphqlDocument } from '../graphqlDocument.js';
3
+ export const TopLanguagesDocument = graphqlDocument(`
4
+ query topLanguages($login: String!, $ownerAffiliations: [RepositoryAffiliation]) {
5
+ user(login: $login) {
6
+ repositories(ownerAffiliations: $ownerAffiliations, isFork: false, first: 100) {
7
+ nodes {
8
+ ...TopLanguagesRepository
9
+ }
10
+ }
11
+ }
12
+ }
13
+ fragment TopLanguagesRepository on Repository {
14
+ name
15
+ languages(first: 10, orderBy: {field: SIZE, direction: DESC}) {
16
+ edges {
17
+ ...TopLanguage
18
+ }
19
+ }
20
+ }
21
+ fragment TopLanguage on LanguageEdge {
22
+ size
23
+ node {
24
+ color
25
+ name
26
+ }
27
+ }`);
@@ -0,0 +1,22 @@
1
+ /**
2
+ * A GraphQL query paired with the types of its result and variables.
3
+ *
4
+ * `text` is what goes over the wire; the other two members only carry types and are never assigned.
5
+ * Documents are generated from `queries/*.graphql`
6
+ * See `scripts/generate-graphql-types.js`.
7
+ */
8
+ interface GraphQLDocument<TResult, TVariables> {
9
+ readonly text: string;
10
+ readonly __result?: TResult;
11
+ readonly __variables?: TVariables;
12
+ }
13
+ /**
14
+ * Build a typed document.
15
+ *
16
+ * @param text The query text, including every fragment it spreads.
17
+ * @returns The document to pass to the function created by `createGraphQLFetcher`.
18
+ */
19
+ declare const graphqlDocument: <TResult, TVariables>(text: string) => GraphQLDocument<TResult, TVariables>;
20
+ export { graphqlDocument };
21
+ export type { GraphQLDocument };
22
+ //# sourceMappingURL=graphqlDocument.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphqlDocument.d.ts","sourceRoot":"","sources":["../../src/graphql/graphqlDocument.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,UAAU,eAAe,CAAC,OAAO,EAAE,UAAU;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC;CACnC;AAED;;;;;GAKG;AACH,QAAA,MAAM,eAAe,GAAI,OAAO,EAAE,UAAU,EAC1C,MAAM,MAAM,KACX,eAAe,CAAC,OAAO,EAAE,UAAU,CAAe,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,YAAY,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Build a typed document.
3
+ *
4
+ * @param text The query text, including every fragment it spreads.
5
+ * @returns The document to pass to the function created by `createGraphQLFetcher`.
6
+ */
7
+ const graphqlDocument = (text) => ({ text });
8
+ export { graphqlDocument };
@@ -0,0 +1,27 @@
1
+ import type { GitHubDateRange } from '../common/date.js';
2
+ import type { RangeContributionsByRepoFragment } from './generated/stats.js';
3
+ /** max value GitHub allows for `first/maxRepositories` */
4
+ declare const MAX_REPOSITORIES_LIMIT = 100;
5
+ interface ReposContributedToQueryVariables {
6
+ login: string;
7
+ maxRepositories: number;
8
+ }
9
+ interface ReposContributedToQuery {
10
+ user: Record<`range_${number}`, RangeContributionsByRepoFragment> | null;
11
+ }
12
+ /**
13
+ * Build a query for the repositories a user contributed to within multiple time
14
+ * ranges. One aliased `contributionsCollection` field per range, so all ranges
15
+ * are fetched in a single request. The shape is only known at runtime.
16
+ *
17
+ * Mirrors the `contributionTypes: [COMMIT, ISSUE, PULL_REQUEST, REPOSITORY]`
18
+ * filter used by `repositoriesContributedTo` in `stats.graphql`.
19
+ *
20
+ * @param ranges Ranges to fetch, one `range_<index>` alias each.
21
+ * @param includeOwnRepos Whether to select `repositoryContributions`.
22
+ * @returns Document for `createGraphQLFetcher`.
23
+ */
24
+ declare const buildReposContributedToDocument: (ranges: Array<GitHubDateRange>, includeOwnRepos: boolean) => import("./graphqlDocument.js").GraphQLDocument<ReposContributedToQuery, ReposContributedToQueryVariables>;
25
+ export { buildReposContributedToDocument, MAX_REPOSITORIES_LIMIT };
26
+ export type { ReposContributedToQuery };
27
+ //# sourceMappingURL=reposContributedToDocument.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reposContributedToDocument.d.ts","sourceRoot":"","sources":["../../src/graphql/reposContributedToDocument.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGzD,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAG7E,0DAA0D;AAC1D,QAAA,MAAM,sBAAsB,MAAM,CAAC;AAEnC,UAAU,gCAAgC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,uBAAuB;IAC/B,IAAI,EAAE,MAAM,CAAC,SAAS,MAAM,EAAE,EAAE,gCAAgC,CAAC,GAAG,IAAI,CAAC;CAC1E;AAED;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,+BAA+B,GACnC,QAAQ,KAAK,CAAC,eAAe,CAAC,EAC9B,iBAAiB,OAAO,8GA+CzB,CAAC;AAEF,OAAO,EAAE,+BAA+B,EAAE,sBAAsB,EAAE,CAAC;AACnE,YAAY,EAAE,uBAAuB,EAAE,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { toGitHubDateTime } from '../common/date.js';
2
+ import { graphqlDocument } from './graphqlDocument.js';
3
+ /** max value GitHub allows for `first/maxRepositories` */
4
+ const MAX_REPOSITORIES_LIMIT = 100;
5
+ /**
6
+ * Build a query for the repositories a user contributed to within multiple time
7
+ * ranges. One aliased `contributionsCollection` field per range, so all ranges
8
+ * are fetched in a single request. The shape is only known at runtime.
9
+ *
10
+ * Mirrors the `contributionTypes: [COMMIT, ISSUE, PULL_REQUEST, REPOSITORY]`
11
+ * filter used by `repositoriesContributedTo` in `stats.graphql`.
12
+ *
13
+ * @param ranges Ranges to fetch, one `range_<index>` alias each.
14
+ * @param includeOwnRepos Whether to select `repositoryContributions`.
15
+ * @returns Document for `createGraphQLFetcher`.
16
+ */
17
+ const buildReposContributedToDocument = (ranges, includeOwnRepos) => {
18
+ const rangeFields = ranges
19
+ .map(({ from, to }, index) => `range_${index}: contributionsCollection(from: "${toGitHubDateTime(from)}", to: "${toGitHubDateTime(to)}") { ...RangeContributionsByRepo }`)
20
+ .join('\n');
21
+ // `repositoryContributions` only ever returns repos the user owns,
22
+ // so it is left out rather than gated with @include: an excluded field still counts toward the query's node cost.
23
+ // stats.graphql carries the directive so the generated type marks the field optional.
24
+ const ownRepoField = includeOwnRepos
25
+ ? `repositoryContributions(first: $maxRepositories) {
26
+ nodes {
27
+ repository {
28
+ nameWithOwner
29
+ }
30
+ }
31
+ }`
32
+ : '';
33
+ // fragment must match queries/stats.graphql, which generates its type
34
+ return graphqlDocument(`
35
+ query userReposContributedTo($login: String!, $maxRepositories: Int!) {
36
+ user(login: $login) {
37
+ ${rangeFields}
38
+ }
39
+ }
40
+ fragment RangeContributionsByRepo on ContributionsCollection {
41
+ commitContributionsByRepository(maxRepositories: $maxRepositories) {
42
+ repository {
43
+ nameWithOwner
44
+ }
45
+ }
46
+ issueContributionsByRepository(maxRepositories: $maxRepositories) {
47
+ repository {
48
+ nameWithOwner
49
+ }
50
+ }
51
+ pullRequestContributionsByRepository(maxRepositories: $maxRepositories) {
52
+ repository {
53
+ nameWithOwner
54
+ }
55
+ }
56
+ ${ownRepoField}
57
+ }`);
58
+ };
59
+ export { buildReposContributedToDocument, MAX_REPOSITORIES_LIMIT };
@@ -0,0 +1,15 @@
1
+ export { fetchWakatimeStats } from './fetchers/wakatime.js';
2
+ export { retryer } from './common/retryer.js';
3
+ export { renderError } from './common/render.js';
4
+ export type { ApiError, ApiResult } from './api/api-result.js';
5
+ export { gist } from './api/gist.js';
6
+ export { stats } from './api/stats.js';
7
+ export { pin } from './api/pin.js';
8
+ export { topLangs } from './api/top-langs.js';
9
+ export { wakatime } from './api/wakatime.js';
10
+ export { CardConfig } from './common/config.js';
11
+ export type { PersonalAccessToken } from './common/config.js';
12
+ export type { FetchLike } from './common/http.js';
13
+ export { themes } from './themes/index.js';
14
+ export type { ThemeName } from './themes/index.js';
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
package/build/index.js ADDED
@@ -0,0 +1,10 @@
1
+ export { fetchWakatimeStats } from './fetchers/wakatime.js';
2
+ export { retryer } from './common/retryer.js';
3
+ export { renderError } from './common/render.js';
4
+ export { gist } from './api/gist.js';
5
+ export { stats } from './api/stats.js';
6
+ export { pin } from './api/pin.js';
7
+ export { topLangs } from './api/top-langs.js';
8
+ export { wakatime } from './api/wakatime.js';
9
+ export { CardConfig } from './common/config.js';
10
+ export { themes } from './themes/index.js';