-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.d.ts
397 lines (329 loc) · 13.6 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
import { GraphQLResolveInfo } from 'graphql';
export type Maybe<T> = T | null;
export type Exact<T extends { [key: string]: any }> = { [K in keyof T]: T[K] };
export type RequireFields<T, K extends keyof T> = { [X in Exclude<keyof T, K>]?: T[X] } & { [P in K]-?: NonNullable<T[P]> };
/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
ID: string;
String: string;
Boolean: boolean;
Int: number;
Float: number;
};
export type AuthPayload = {
__typename?: 'AuthPayload';
token: Scalars['String'];
};
export type Comment = {
__typename?: 'Comment';
_id: Scalars['ID'];
author: Scalars['String'];
postId: Scalars['ID'];
content: Scalars['String'];
publishedDate: Scalars['String'];
replies: Array<Comment>;
};
export type Mutation = {
__typename?: 'Mutation';
signUp: User;
createDraft: Post;
updateUser: User;
updateDraft: Post;
deletePost: Post;
publish: Post;
vote: Vote;
comment: Comment;
};
export type MutationSignUpArgs = {
fullName: Scalars['String'];
email: Scalars['String'];
password: Scalars['String'];
role?: Maybe<Role>;
};
export type MutationCreateDraftArgs = {
title: Scalars['String'];
content: Scalars['String'];
image?: Maybe<Scalars['String']>;
tags: Array<Scalars['String']>;
};
export type MutationUpdateUserArgs = {
email?: Maybe<Scalars['String']>;
fullName?: Maybe<Scalars['String']>;
image?: Maybe<Scalars['String']>;
bio?: Maybe<Scalars['String']>;
};
export type MutationUpdateDraftArgs = {
id: Scalars['ID'];
title?: Maybe<Scalars['String']>;
content?: Maybe<Scalars['String']>;
image?: Maybe<Scalars['String']>;
};
export type MutationDeletePostArgs = {
id: Scalars['ID'];
};
export type MutationPublishArgs = {
id: Scalars['ID'];
};
export type MutationVoteArgs = {
id: Scalars['ID'];
};
export type MutationCommentArgs = {
id: Scalars['ID'];
content: Scalars['String'];
};
export type Post = {
__typename?: 'Post';
_id: Scalars['ID'];
title: Scalars['String'];
content: Scalars['String'];
image?: Maybe<Scalars['String']>;
tags: Array<Scalars['String']>;
published: Scalars['Boolean'];
votes: Array<Scalars['ID']>;
comments: Array<Comment>;
commentCount: Scalars['Int'];
publishedDate?: Maybe<Scalars['String']>;
createdAt: Scalars['String'];
updatedAt: Scalars['String'];
author: User;
};
export type Query = {
__typename?: 'Query';
login: AuthPayload;
user: User;
users: Array<User>;
post: Post;
drafts: Array<Post>;
posts: Array<Post>;
tags: Array<Scalars['String']>;
};
export type QueryLoginArgs = {
email: Scalars['String'];
password: Scalars['String'];
};
export type QueryUserArgs = {
id?: Maybe<Scalars['ID']>;
};
export type QueryPostArgs = {
id: Scalars['ID'];
};
export type QueryPostsArgs = {
filter?: Maybe<Scalars['String']>;
author?: Maybe<Scalars['ID']>;
currentUser?: Maybe<Scalars['Boolean']>;
sortBy?: Maybe<Sort>;
relating?: Maybe<Array<Maybe<Scalars['String']>>>;
skip: Scalars['Int'];
limit: Scalars['Int'];
};
export enum Role {
User = 'USER',
Admin = 'ADMIN'
}
export enum Sort {
PublishedDate = 'published_date',
Popular = 'popular'
}
export type Subscription = {
__typename?: 'Subscription';
newVote: Vote;
newComment: Comment;
};
export type SubscriptionNewVoteArgs = {
id: Scalars['ID'];
};
export type SubscriptionNewCommentArgs = {
id: Scalars['ID'];
};
export type User = {
__typename?: 'User';
_id: Scalars['ID'];
fullName: Scalars['String'];
email: Scalars['String'];
posts: Array<Post>;
bio?: Maybe<Scalars['String']>;
tags: Array<Scalars['String']>;
image?: Maybe<Scalars['String']>;
role: Role;
createdAt: Scalars['String'];
};
export type Vote = {
__typename?: 'Vote';
userId: Scalars['ID'];
postId: Scalars['ID'];
};
export type ResolverTypeWrapper<T> = Promise<T> | T;
export type LegacyStitchingResolver<TResult, TParent, TContext, TArgs> = {
fragment: string;
resolve: ResolverFn<TResult, TParent, TContext, TArgs>;
};
export type NewStitchingResolver<TResult, TParent, TContext, TArgs> = {
selectionSet: string;
resolve: ResolverFn<TResult, TParent, TContext, TArgs>;
};
export type StitchingResolver<TResult, TParent, TContext, TArgs> = LegacyStitchingResolver<TResult, TParent, TContext, TArgs> | NewStitchingResolver<TResult, TParent, TContext, TArgs>;
export type Resolver<TResult, TParent = {}, TContext = {}, TArgs = {}> =
| ResolverFn<TResult, TParent, TContext, TArgs>
| StitchingResolver<TResult, TParent, TContext, TArgs>;
export type ResolverFn<TResult, TParent, TContext, TArgs> = (
parent: TParent,
args: TArgs,
context: TContext,
info: GraphQLResolveInfo
) => Promise<TResult> | TResult;
export type SubscriptionSubscribeFn<TResult, TParent, TContext, TArgs> = (
parent: TParent,
args: TArgs,
context: TContext,
info: GraphQLResolveInfo
) => AsyncIterator<TResult> | Promise<AsyncIterator<TResult>>;
export type SubscriptionResolveFn<TResult, TParent, TContext, TArgs> = (
parent: TParent,
args: TArgs,
context: TContext,
info: GraphQLResolveInfo
) => TResult | Promise<TResult>;
export interface SubscriptionSubscriberObject<TResult, TKey extends string, TParent, TContext, TArgs> {
subscribe: SubscriptionSubscribeFn<{ [key in TKey]: TResult }, TParent, TContext, TArgs>;
resolve?: SubscriptionResolveFn<TResult, { [key in TKey]: TResult }, TContext, TArgs>;
}
export interface SubscriptionResolverObject<TResult, TParent, TContext, TArgs> {
subscribe: SubscriptionSubscribeFn<any, TParent, TContext, TArgs>;
resolve: SubscriptionResolveFn<TResult, any, TContext, TArgs>;
}
export type SubscriptionObject<TResult, TKey extends string, TParent, TContext, TArgs> =
| SubscriptionSubscriberObject<TResult, TKey, TParent, TContext, TArgs>
| SubscriptionResolverObject<TResult, TParent, TContext, TArgs>;
export type SubscriptionResolver<TResult, TKey extends string, TParent = {}, TContext = {}, TArgs = {}> =
| ((...args: any[]) => SubscriptionObject<TResult, TKey, TParent, TContext, TArgs>)
| SubscriptionObject<TResult, TKey, TParent, TContext, TArgs>;
export type TypeResolveFn<TTypes, TParent = {}, TContext = {}> = (
parent: TParent,
context: TContext,
info: GraphQLResolveInfo
) => Maybe<TTypes> | Promise<Maybe<TTypes>>;
export type IsTypeOfResolverFn<T = {}> = (obj: T, info: GraphQLResolveInfo) => boolean | Promise<boolean>;
export type NextResolverFn<T> = () => Promise<T>;
export type DirectiveResolverFn<TResult = {}, TParent = {}, TContext = {}, TArgs = {}> = (
next: NextResolverFn<TResult>,
parent: TParent,
args: TArgs,
context: TContext,
info: GraphQLResolveInfo
) => TResult | Promise<TResult>;
/** Mapping between all available schema types and the resolvers types */
export type ResolversTypes = {
Query: ResolverTypeWrapper<{}>;
String: ResolverTypeWrapper<Scalars['String']>;
AuthPayload: ResolverTypeWrapper<AuthPayload>;
ID: ResolverTypeWrapper<Scalars['ID']>;
User: ResolverTypeWrapper<User>;
Post: ResolverTypeWrapper<Post>;
Boolean: ResolverTypeWrapper<Scalars['Boolean']>;
Comment: ResolverTypeWrapper<Comment>;
Int: ResolverTypeWrapper<Scalars['Int']>;
Role: Role;
Sort: Sort;
Mutation: ResolverTypeWrapper<{}>;
Vote: ResolverTypeWrapper<Vote>;
Subscription: ResolverTypeWrapper<{}>;
};
/** Mapping between all available schema types and the resolvers parents */
export type ResolversParentTypes = {
Query: {};
String: Scalars['String'];
AuthPayload: AuthPayload;
ID: Scalars['ID'];
User: User;
Post: Post;
Boolean: Scalars['Boolean'];
Comment: Comment;
Int: Scalars['Int'];
Mutation: {};
Vote: Vote;
Subscription: {};
};
export type AuthPayloadResolvers<ContextType = any, ParentType extends ResolversParentTypes['AuthPayload'] = ResolversParentTypes['AuthPayload']> = {
token?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType>;
};
export type CommentResolvers<ContextType = any, ParentType extends ResolversParentTypes['Comment'] = ResolversParentTypes['Comment']> = {
_id?: Resolver<ResolversTypes['ID'], ParentType, ContextType>;
author?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
postId?: Resolver<ResolversTypes['ID'], ParentType, ContextType>;
content?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
publishedDate?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
replies?: Resolver<Array<ResolversTypes['Comment']>, ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType>;
};
export type MutationResolvers<ContextType = any, ParentType extends ResolversParentTypes['Mutation'] = ResolversParentTypes['Mutation']> = {
signUp?: Resolver<ResolversTypes['User'], ParentType, ContextType, RequireFields<MutationSignUpArgs, 'fullName' | 'email' | 'password'>>;
createDraft?: Resolver<ResolversTypes['Post'], ParentType, ContextType, RequireFields<MutationCreateDraftArgs, 'title' | 'content' | 'tags'>>;
updateUser?: Resolver<ResolversTypes['User'], ParentType, ContextType, RequireFields<MutationUpdateUserArgs, never>>;
updateDraft?: Resolver<ResolversTypes['Post'], ParentType, ContextType, RequireFields<MutationUpdateDraftArgs, 'id'>>;
deletePost?: Resolver<ResolversTypes['Post'], ParentType, ContextType, RequireFields<MutationDeletePostArgs, 'id'>>;
publish?: Resolver<ResolversTypes['Post'], ParentType, ContextType, RequireFields<MutationPublishArgs, 'id'>>;
vote?: Resolver<ResolversTypes['Vote'], ParentType, ContextType, RequireFields<MutationVoteArgs, 'id'>>;
comment?: Resolver<ResolversTypes['Comment'], ParentType, ContextType, RequireFields<MutationCommentArgs, 'id' | 'content'>>;
};
export type PostResolvers<ContextType = any, ParentType extends ResolversParentTypes['Post'] = ResolversParentTypes['Post']> = {
_id?: Resolver<ResolversTypes['ID'], ParentType, ContextType>;
title?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
content?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
image?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
tags?: Resolver<Array<ResolversTypes['String']>, ParentType, ContextType>;
published?: Resolver<ResolversTypes['Boolean'], ParentType, ContextType>;
votes?: Resolver<Array<ResolversTypes['ID']>, ParentType, ContextType>;
comments?: Resolver<Array<ResolversTypes['Comment']>, ParentType, ContextType>;
commentCount?: Resolver<ResolversTypes['Int'], ParentType, ContextType>;
publishedDate?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
createdAt?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
updatedAt?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
author?: Resolver<ResolversTypes['User'], ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType>;
};
export type QueryResolvers<ContextType = any, ParentType extends ResolversParentTypes['Query'] = ResolversParentTypes['Query']> = {
login?: Resolver<ResolversTypes['AuthPayload'], ParentType, ContextType, RequireFields<QueryLoginArgs, 'email' | 'password'>>;
user?: Resolver<ResolversTypes['User'], ParentType, ContextType, RequireFields<QueryUserArgs, never>>;
users?: Resolver<Array<ResolversTypes['User']>, ParentType, ContextType>;
post?: Resolver<ResolversTypes['Post'], ParentType, ContextType, RequireFields<QueryPostArgs, 'id'>>;
drafts?: Resolver<Array<ResolversTypes['Post']>, ParentType, ContextType>;
posts?: Resolver<Array<ResolversTypes['Post']>, ParentType, ContextType, RequireFields<QueryPostsArgs, 'skip' | 'limit'>>;
tags?: Resolver<Array<ResolversTypes['String']>, ParentType, ContextType>;
};
export type SubscriptionResolvers<ContextType = any, ParentType extends ResolversParentTypes['Subscription'] = ResolversParentTypes['Subscription']> = {
newVote?: SubscriptionResolver<ResolversTypes['Vote'], "newVote", ParentType, ContextType, RequireFields<SubscriptionNewVoteArgs, 'id'>>;
newComment?: SubscriptionResolver<ResolversTypes['Comment'], "newComment", ParentType, ContextType, RequireFields<SubscriptionNewCommentArgs, 'id'>>;
};
export type UserResolvers<ContextType = any, ParentType extends ResolversParentTypes['User'] = ResolversParentTypes['User']> = {
_id?: Resolver<ResolversTypes['ID'], ParentType, ContextType>;
fullName?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
email?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
posts?: Resolver<Array<ResolversTypes['Post']>, ParentType, ContextType>;
bio?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
tags?: Resolver<Array<ResolversTypes['String']>, ParentType, ContextType>;
image?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
role?: Resolver<ResolversTypes['Role'], ParentType, ContextType>;
createdAt?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType>;
};
export type VoteResolvers<ContextType = any, ParentType extends ResolversParentTypes['Vote'] = ResolversParentTypes['Vote']> = {
userId?: Resolver<ResolversTypes['ID'], ParentType, ContextType>;
postId?: Resolver<ResolversTypes['ID'], ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType>;
};
export type Resolvers<ContextType = any> = {
AuthPayload?: AuthPayloadResolvers<ContextType>;
Comment?: CommentResolvers<ContextType>;
Mutation?: MutationResolvers<ContextType>;
Post?: PostResolvers<ContextType>;
Query?: QueryResolvers<ContextType>;
Subscription?: SubscriptionResolvers<ContextType>;
User?: UserResolvers<ContextType>;
Vote?: VoteResolvers<ContextType>;
};
/**
* @deprecated
* Use "Resolvers" root object instead. If you wish to get "IResolvers", add "typesPrefix: I" to your config.
*/
export type IResolvers<ContextType = any> = Resolvers<ContextType>;