-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgraphql.ts
More file actions
108 lines (94 loc) · 2.36 KB
/
graphql.ts
File metadata and controls
108 lines (94 loc) · 2.36 KB
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
import UsersFactory from '../models/usersFactory';
import WorkspacesFactory from '../models/workspacesFactory';
import { GraphQLField } from 'graphql';
import ProjectsFactory from '../models/projectsFactory';
import PlansFactory from '../models/plansFactory';
import BusinessOperationsFactory from '../models/businessOperationsFactory';
import ReleasesFactory from "../models/releaseFactory";
/**
* Resolver's Context argument
*/
export interface ResolverContextBase {
/**
* User who makes query
*/
user: UserInContext;
/**
* Factories for working with models
*/
factories: ContextFactories;
}
/**
* Represents User info in context
*/
export interface UserInContext {
/**
* User id
*/
id?: string;
/**
* True if token is expired
*/
accessTokenExpired: boolean;
}
/**
* Data in user's access token
*/
export interface UserJWTData {
/**
* User id
*/
userId: string;
}
/**
* Factories for working with models
*/
export interface ContextFactories {
/**
* Users factory for working with users
*/
usersFactory: UsersFactory;
/**
* Workspaces factory for working with workspaces
*/
workspacesFactory: WorkspacesFactory;
/**
* Projects factory for working with projects
*/
projectsFactory: ProjectsFactory;
/**
* Plans factory for working with tariff plans
*/
plansFactory: PlansFactory;
/**
* Allows to work with the Business Operations models
*/
businessOperationsFactory: BusinessOperationsFactory;
/**
* Allows to work with releases
*/
releasesFactory: ReleasesFactory;
}
/**
* Resolver Context with authenticated user
*/
export interface ResolverContextWithUser extends ResolverContextBase {
/**
* User who makes query
*/
user: Required<UserInContext>;
}
/**
* Use this type when you want to show that you don't know what contains GraphQL field (to avoid 'any' type),
* e.g. in directive definition
*/
export type UnknownGraphQLField<TContext extends ResolverContextBase = ResolverContextBase>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
= GraphQLField<any, TContext>
/**
* Use this type when you want to show that you don't know what GraphQL field resolver returns (to avoid 'any' type),
* e.g. in directive definition
*/
export type UnknownGraphQLResolverResult
// eslint-disable-next-line @typescript-eslint/no-explicit-any
= Promise<any>;