-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathtypes.d.ts
214 lines (186 loc) · 4.69 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
import {
GraphQLFieldConfig,
GraphQLFieldResolver,
GraphQLInputObjectType,
GraphQLList,
GraphQLNonNull,
GraphQLObjectType,
GraphQLScalarType,
GraphQLType,
} from 'graphql'
import {
Association,
BuildOptions,
FindOptions,
Model,
Sequelize,
} from 'sequelize/types'
export type Action = 'list' | 'create' | 'delete' | 'update' | 'count'
export type ActionList = Array<Action>
export type Event = 'create' | 'delete' | 'update'
export type EventList = Array<Event>
export type SequelizeModel = typeof Model & {
new (values?: object, options?: BuildOptions): any
}
export type ExtraArg = { [key: string]: { type: GraphQLType } }
export type TSource = any
export type TArgs = { [key: string]: any }
export type TContext = any
export type TInfo = any
export type Payload = any
export type InAndOutTypes = {
inputTypes: InputTypes
outputTypes: OutputTypes
}
export type EntityProperties = any
export type ListResult = any[]
export type Where = any
export type OutputTypes = {
[key: string]: GraphQLObjectType
}
export type InputTypes = {
[key: string]: GraphQLInputObjectType
}
export type EnpointArg = {
type: GraphQLScalarType | GraphQLNonNull<any>
}
export type EndpointArgs = {
[key: string]: EnpointArg
}
export type CustomResolver = (
source: any,
args: TArgs,
context: TContext
) => Promise<any>
export type CustomMutationConfiguration = {
type: GraphQLObjectType | GraphQLList<GraphQLObjectType>
description?: string
args: EndpointArgs
resolve: CustomResolver
}
export type MutationList = {
[key: string]: CustomMutationConfiguration
}
export type CustomSubscriptionConfiguration = {
type: GraphQLObjectType | GraphQLList<GraphQLObjectType>
description?: string
args: EndpointArgs
subscribe: GraphQLFieldResolver<TSource, TContext, TArgs>
}
export type SubscriptionList = {
[key: string]: CustomSubscriptionConfiguration
}
export type GlobalBeforeHook = (
args: TArgs,
context: TContext,
info: TInfo
) => void
export type QueryBeforeHook = (
findOptions: FindOptions,
args: TArgs,
context: TContext,
info: TInfo
) => FindOptions
export type ListAfterHook = (
result: ListResult,
args: TArgs,
context: TContext,
info: TInfo
) => ListResult
export type MutationBeforeHook = (
findOptions: FindOptions,
args: TArgs,
context: TContext,
info: TInfo
) => EntityProperties
export type CreateAfterHook = (
newEntity: any,
source: any,
args: TArgs,
context: TContext,
info: TInfo
) => any
export type UpdateAfterHook = (
newEntity: any,
entitySnapshotBeforeUpdate: any,
source: any,
args: TArgs,
context: TContext,
info: TInfo
) => any
export type DeleteBeforeHook = (
where: Where,
findOptions: FindOptions,
args: TArgs,
context: TContext,
info: TInfo
) => Where
export type DeleteAfterHook = (
oldEntitySnapshot: any,
source: any,
args: TArgs,
context: TContext,
info: TInfo
) => any
export type SubscriptionFilterHook = (
payload: Payload,
args: TArgs,
context: TContext
) => boolean
export type GraphqlSchemaDeclarationType = {
[key: string]: ModelDeclarationType | GraphQLFieldConfig<any, any, any>
}
export type CreateFieldDeclarationType = {
extraArg?: ExtraArg
before?: MutationBeforeHook
after?: CreateAfterHook
subscriptionFilter?: SubscriptionFilterHook
preventDuplicateOnAttributes?: string[]
}
export type UpdateFieldDeclarationType = {
extraArg?: ExtraArg
before?: MutationBeforeHook
after?: UpdateAfterHook
subscriptionFilter?: SubscriptionFilterHook
}
export type DeleteFieldDeclarationType = {
before?: DeleteBeforeHook
after?: DeleteAfterHook
subscriptionFilter?: SubscriptionFilterHook
}
export type ModelDeclarationType = {
model: SequelizeModel
actions?: ActionList
subscriptions?: EventList
additionalMutations?: MutationList
additionalSubscriptions?: SubscriptionList
excludeFromRoot?: boolean
excludeFields?: string[]
before?: GlobalBeforeHook[]
list?: {
removeUnusedAttributes?: boolean
extraArg?: ExtraArg
before?: QueryBeforeHook
after?: ListAfterHook
resolver?: GraphQLFieldResolver<TSource, TArgs, TContext>
}
count?: {
extraArg?: ExtraArg
before?: QueryBeforeHook
resolver?: GraphQLFieldResolver<TSource, TArgs, TContext>
}
create?:
| CreateFieldDeclarationType
| GraphQLFieldConfig<TSource, TContext, TArgs>
update?:
| UpdateFieldDeclarationType
| GraphQLFieldConfig<TSource, TContext, TArgs>
delete?:
| DeleteFieldDeclarationType
| GraphQLFieldConfig<TSource, TContext, TArgs>
}
export type SequelizeModels = { [key: string]: SequelizeModel } & {
sequelize: Sequelize
}
export type GlobalPreCallback = (name: string) => Function | null
export type Associations = { [key: string]: Association }