Skip to content

Commit 3ee77da

Browse files
committed
update codegen script
1 parent 604e2cd commit 3ee77da

File tree

3 files changed

+31
-32
lines changed

3 files changed

+31
-32
lines changed

codegen.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
import { CodegenConfig } from '@graphql-codegen/cli';
2+
import jwt from 'jsonwebtoken';
3+
4+
const token = jwt.sign({ sub: 'codegen', typ: 'access' }, process.env.INTERNAL_JWT_SECRET!, { expiresIn: '1h' });
25

36
const config: CodegenConfig = {
47
schema: {
5-
[process.env.GRAPHQL_URI!]: {
8+
[`${process.env.URI_GITRANKS!}/graphql`]: {
69
headers: {
7-
'x-api-key': process.env.GRAPHQL_SECRET_KEY!,
10+
Authorization: `Bearer ${token}`,
811
},
912
},
1013
},
1114
documents: ['**/*.gql'],
12-
// ignoreNoDocuments: true, // for better experience with the watcher
1315
generates: {
1416
'./types/generated/graphql.ts': {
1517
plugins: ['typescript', 'typescript-operations', 'typed-document-node'],
1618
config: {
17-
// Instruct Codegen to import your custom TypedDocumentNode
1819
documentNodeImport: '../typed-document-node',
1920
},
2021
},

types/generated/graphql.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,17 @@ export type QueryUserArgs = {
7575

7676
export type Rank = {
7777
__typename?: 'Rank';
78-
_id: Scalars['String']['output'];
79-
contributedStars: Scalars['Int']['output'];
78+
contributedStars?: Maybe<Scalars['Int']['output']>;
8079
contributedStarsD?: Maybe<Scalars['Int']['output']>;
8180
contributedStarsM?: Maybe<Scalars['Int']['output']>;
8281
contributedStarsY?: Maybe<Scalars['Int']['output']>;
83-
followersCount: Scalars['Int']['output'];
82+
followersCount?: Maybe<Scalars['Int']['output']>;
8483
followersCountD?: Maybe<Scalars['Int']['output']>;
8584
followersCountM?: Maybe<Scalars['Int']['output']>;
8685
followersCountY?: Maybe<Scalars['Int']['output']>;
8786
githubId: Scalars['ID']['output'];
88-
ownedStars: Scalars['Int']['output'];
87+
isProvisional?: Maybe<Scalars['Boolean']['output']>;
88+
ownedStars?: Maybe<Scalars['Int']['output']>;
8989
ownedStarsD?: Maybe<Scalars['Int']['output']>;
9090
ownedStarsM?: Maybe<Scalars['Int']['output']>;
9191
ownedStarsY?: Maybe<Scalars['Int']['output']>;
@@ -100,17 +100,17 @@ export enum RankOrder {
100100

101101
export type RankWithoutUser = {
102102
__typename?: 'RankWithoutUser';
103-
_id: Scalars['String']['output'];
104-
contributedStars: Scalars['Int']['output'];
103+
contributedStars?: Maybe<Scalars['Int']['output']>;
105104
contributedStarsD?: Maybe<Scalars['Int']['output']>;
106105
contributedStarsM?: Maybe<Scalars['Int']['output']>;
107106
contributedStarsY?: Maybe<Scalars['Int']['output']>;
108-
followersCount: Scalars['Int']['output'];
107+
followersCount?: Maybe<Scalars['Int']['output']>;
109108
followersCountD?: Maybe<Scalars['Int']['output']>;
110109
followersCountM?: Maybe<Scalars['Int']['output']>;
111110
followersCountY?: Maybe<Scalars['Int']['output']>;
112111
githubId: Scalars['ID']['output'];
113-
ownedStars: Scalars['Int']['output'];
112+
isProvisional?: Maybe<Scalars['Boolean']['output']>;
113+
ownedStars?: Maybe<Scalars['Int']['output']>;
114114
ownedStarsD?: Maybe<Scalars['Int']['output']>;
115115
ownedStarsM?: Maybe<Scalars['Int']['output']>;
116116
ownedStarsY?: Maybe<Scalars['Int']['output']>;
@@ -167,7 +167,6 @@ export type Timeline = {
167167

168168
export type User = {
169169
__typename?: 'User';
170-
_id: Scalars['String']['output'];
171170
avatarUrl?: Maybe<Scalars['String']['output']>;
172171
company?: Maybe<Scalars['String']['output']>;
173172
contributedRepoCount?: Maybe<Scalars['Int']['output']>;
@@ -182,7 +181,7 @@ export type User = {
182181
followingCount?: Maybe<Scalars['Int']['output']>;
183182
githubCreatedAt?: Maybe<Scalars['DateTime']['output']>;
184183
githubFetchedAt?: Maybe<Scalars['DateTime']['output']>;
185-
githubId: Scalars['ID']['output'];
184+
githubId?: Maybe<Scalars['ID']['output']>;
186185
githubServiceFetchedAt?: Maybe<Scalars['DateTime']['output']>;
187186
githubUpdatedAt?: Maybe<Scalars['DateTime']['output']>;
188187
isHireable?: Maybe<Scalars['Boolean']['output']>;
@@ -215,15 +214,15 @@ export type UserBasic = {
215214
avatarUrl?: Maybe<Scalars['String']['output']>;
216215
contributedStars?: Maybe<Scalars['Int']['output']>;
217216
followersCount?: Maybe<Scalars['Int']['output']>;
218-
githubId: Scalars['String']['output'];
217+
githubId: Scalars['ID']['output'];
219218
location?: Maybe<Scalars['String']['output']>;
220219
login: Scalars['String']['output'];
221220
ownedStars?: Maybe<Scalars['Int']['output']>;
222221
};
223222

224223
export enum UserFetchingStatus {
225-
Active = 'ACTIVE',
226-
Completed = 'COMPLETED'
224+
Completed = 'COMPLETED',
225+
Fetching = 'FETCHING'
227226
}
228227

229228
export type IdByLoginQueryVariables = Exact<{
@@ -239,7 +238,7 @@ export type RankingsQueryVariables = Exact<{
239238
}>;
240239

241240

242-
export type RankingsQuery = { __typename?: 'Query', rankings: Array<{ __typename?: 'Rank', githubId: string, contributedStars: number, contributedStarsM?: number | null, followersCount: number, followersCountM?: number | null, ownedStars: number, ownedStarsM?: number | null, user?: { __typename?: 'UserBasic', login: string, avatarUrl?: string | null, ownedStars?: number | null, contributedStars?: number | null, followersCount?: number | null, location?: string | null } | null }> };
241+
export type RankingsQuery = { __typename?: 'Query', rankings: Array<{ __typename?: 'Rank', githubId: string, contributedStars?: number | null, contributedStarsM?: number | null, followersCount?: number | null, followersCountM?: number | null, ownedStars?: number | null, ownedStarsM?: number | null, user?: { __typename?: 'UserBasic', login: string, avatarUrl?: string | null, ownedStars?: number | null, contributedStars?: number | null, followersCount?: number | null, location?: string | null } | null }> };
243242

244243
export type RepositoryFieldsFragment = { __typename?: 'Repository', githubId: string, createdAt?: any | null, pushedAt?: any | null, url: string, forkCount: number, isArchived: boolean, name?: string | null, releasesCount?: number | null, stargazerCount: number, languages?: { __typename?: 'RepositoryLanguagesEntity', totalCount: number, totalSize: number, nodes: Array<{ __typename?: 'LanguageEntity', id: string, size: number }> } | null };
245244

@@ -248,7 +247,7 @@ export type UserQueryVariables = Exact<{
248247
}>;
249248

250249

251-
export type UserQuery = { __typename?: 'Query', user?: { __typename?: 'User', githubId: string, githubFetchedAt?: any | null, githubServiceFetchedAt?: any | null, login: string, avatarUrl?: string | null, location?: string | null, followersCount?: number | null, ownedStars?: number | null, contributedStars?: number | null, company?: string | null, email?: string | null, followingCount?: number | null, githubCreatedAt?: any | null, isHireable?: boolean | null, name?: string | null, twitterUsername?: string | null, websiteUrl?: string | null, firstSeenAt?: any | null, repositoriesCount?: number | null, contributedRepoCount?: number | null, socialAccounts?: { __typename?: 'SocialAccount', totalCount: number, nodes?: Array<{ __typename?: 'SocialAccountNodeEntity', displayName?: string | null, provider: string, url: string }> | null } | null, organizations?: Array<{ __typename?: 'Organization', githubId: string, login: string, avatarUrl?: string | null, name?: string | null }> | null, contributions?: Array<{ __typename?: 'Contribution', year: number, prsCount?: number | null, mergedPrsCount?: number | null, linesAdded?: number | null, linesRemoved?: number | null, repository?: { __typename?: 'Repository', githubId: string, createdAt?: any | null, pushedAt?: any | null, url: string, forkCount: number, isArchived: boolean, name?: string | null, releasesCount?: number | null, stargazerCount: number, languages?: { __typename?: 'RepositoryLanguagesEntity', totalCount: number, totalSize: number, nodes: Array<{ __typename?: 'LanguageEntity', id: string, size: number }> } | null } | null }> | null, repositories?: Array<{ __typename?: 'Repository', githubId: string, createdAt?: any | null, pushedAt?: any | null, url: string, forkCount: number, isArchived: boolean, name?: string | null, releasesCount?: number | null, stargazerCount: number, languages?: { __typename?: 'RepositoryLanguagesEntity', totalCount: number, totalSize: number, nodes: Array<{ __typename?: 'LanguageEntity', id: string, size: number }> } | null }> | null, timeline?: Array<{ __typename?: 'Timeline', changes: any, createdAt: any }> | null, rank?: { __typename?: 'RankWithoutUser', ownedStars: number, ownedStarsM?: number | null, ownedStarsY?: number | null, contributedStars: number, contributedStarsM?: number | null, contributedStarsY?: number | null, followersCount: number, followersCountM?: number | null, followersCountY?: number | null } | null } | null };
250+
export type UserQuery = { __typename?: 'Query', user?: { __typename?: 'User', githubId?: string | null, githubFetchedAt?: any | null, githubServiceFetchedAt?: any | null, login: string, avatarUrl?: string | null, location?: string | null, followersCount?: number | null, ownedStars?: number | null, contributedStars?: number | null, company?: string | null, email?: string | null, followingCount?: number | null, githubCreatedAt?: any | null, isHireable?: boolean | null, name?: string | null, twitterUsername?: string | null, websiteUrl?: string | null, firstSeenAt?: any | null, repositoriesCount?: number | null, contributedRepoCount?: number | null, socialAccounts?: { __typename?: 'SocialAccount', totalCount: number, nodes?: Array<{ __typename?: 'SocialAccountNodeEntity', displayName?: string | null, provider: string, url: string }> | null } | null, organizations?: Array<{ __typename?: 'Organization', githubId: string, login: string, avatarUrl?: string | null, name?: string | null }> | null, contributions?: Array<{ __typename?: 'Contribution', year: number, prsCount?: number | null, mergedPrsCount?: number | null, linesAdded?: number | null, linesRemoved?: number | null, repository?: { __typename?: 'Repository', githubId: string, createdAt?: any | null, pushedAt?: any | null, url: string, forkCount: number, isArchived: boolean, name?: string | null, releasesCount?: number | null, stargazerCount: number, languages?: { __typename?: 'RepositoryLanguagesEntity', totalCount: number, totalSize: number, nodes: Array<{ __typename?: 'LanguageEntity', id: string, size: number }> } | null } | null }> | null, repositories?: Array<{ __typename?: 'Repository', githubId: string, createdAt?: any | null, pushedAt?: any | null, url: string, forkCount: number, isArchived: boolean, name?: string | null, releasesCount?: number | null, stargazerCount: number, languages?: { __typename?: 'RepositoryLanguagesEntity', totalCount: number, totalSize: number, nodes: Array<{ __typename?: 'LanguageEntity', id: string, size: number }> } | null }> | null, timeline?: Array<{ __typename?: 'Timeline', changes: any, createdAt: any }> | null, rank?: { __typename?: 'RankWithoutUser', ownedStars?: number | null, ownedStarsM?: number | null, ownedStarsY?: number | null, contributedStars?: number | null, contributedStarsM?: number | null, contributedStarsY?: number | null, followersCount?: number | null, followersCountM?: number | null, followersCountY?: number | null } | null } | null };
252251

253252
export type ProfilesForSitemapQueryVariables = Exact<{ [key: string]: never; }>;
254253

@@ -272,7 +271,7 @@ export type RankByLoginQueryVariables = Exact<{
272271
}>;
273272

274273

275-
export type RankByLoginQuery = { __typename?: 'Query', rankByLogin?: { __typename?: 'Rank', githubId: string, contributedStars: number, contributedStarsM?: number | null, followersCount: number, followersCountM?: number | null, ownedStars: number, ownedStarsM?: number | null, user?: { __typename?: 'UserBasic', login: string, avatarUrl?: string | null, ownedStars?: number | null, contributedStars?: number | null, followersCount?: number | null, location?: string | null } | null } | null };
274+
export type RankByLoginQuery = { __typename?: 'Query', rankByLogin?: { __typename?: 'Rank', githubId: string, contributedStars?: number | null, contributedStarsM?: number | null, followersCount?: number | null, followersCountM?: number | null, ownedStars?: number | null, ownedStarsM?: number | null, user?: { __typename?: 'UserBasic', login: string, avatarUrl?: string | null, ownedStars?: number | null, contributedStars?: number | null, followersCount?: number | null, location?: string | null } | null } | null };
276275

277276
export const RepositoryFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RepositoryFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Repository"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"githubId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"pushedAt"}},{"kind":"Field","name":{"kind":"Name","value":"url"}},{"kind":"Field","name":{"kind":"Name","value":"forkCount"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"releasesCount"}},{"kind":"Field","name":{"kind":"Name","value":"stargazerCount"}},{"kind":"Field","name":{"kind":"Name","value":"languages"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalCount"}},{"kind":"Field","name":{"kind":"Name","value":"totalSize"}},{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"size"}}]}}]}}]}}]} as unknown as DocumentNode<RepositoryFieldsFragment, unknown>;
278277
export const IdByLoginDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"IdByLogin"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"login"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"rankByLogin"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"login"},"value":{"kind":"Variable","name":{"kind":"Name","value":"login"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"githubId"}}]}}]}}]} as unknown as DocumentNode<IdByLoginQuery, IdByLoginQueryVariables>;

types/generated/schema.graphql

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@ type Query {
4343
}
4444

4545
type Rank {
46-
_id: String!
47-
contributedStars: Int!
46+
contributedStars: Int
4847
contributedStarsD: Int
4948
contributedStarsM: Int
5049
contributedStarsY: Int
51-
followersCount: Int!
50+
followersCount: Int
5251
followersCountD: Int
5352
followersCountM: Int
5453
followersCountY: Int
5554
githubId: ID!
56-
ownedStars: Int!
55+
isProvisional: Boolean
56+
ownedStars: Int
5757
ownedStarsD: Int
5858
ownedStarsM: Int
5959
ownedStarsY: Int
@@ -67,17 +67,17 @@ enum RankOrder {
6767
}
6868

6969
type RankWithoutUser {
70-
_id: String!
71-
contributedStars: Int!
70+
contributedStars: Int
7271
contributedStarsD: Int
7372
contributedStarsM: Int
7473
contributedStarsY: Int
75-
followersCount: Int!
74+
followersCount: Int
7675
followersCountD: Int
7776
followersCountM: Int
7877
followersCountY: Int
7978
githubId: ID!
80-
ownedStars: Int!
79+
isProvisional: Boolean
80+
ownedStars: Int
8181
ownedStarsD: Int
8282
ownedStarsM: Int
8383
ownedStarsY: Int
@@ -128,7 +128,6 @@ type Timeline {
128128
}
129129

130130
type User {
131-
_id: String!
132131
avatarUrl: String
133132
company: String
134133
contributedRepoCount: Int
@@ -143,7 +142,7 @@ type User {
143142
followingCount: Int
144143
githubCreatedAt: DateTime
145144
githubFetchedAt: DateTime
146-
githubId: ID!
145+
githubId: ID
147146
githubServiceFetchedAt: DateTime
148147
githubUpdatedAt: DateTime
149148
isHireable: Boolean
@@ -166,13 +165,13 @@ type UserBasic {
166165
avatarUrl: String
167166
contributedStars: Int
168167
followersCount: Int
169-
githubId: String!
168+
githubId: ID!
170169
location: String
171170
login: String!
172171
ownedStars: Int
173172
}
174173

175174
enum UserFetchingStatus {
176-
ACTIVE
177175
COMPLETED
176+
FETCHING
178177
}

0 commit comments

Comments
 (0)