forked from acro5piano/knex-gql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterfaces.ts
60 lines (51 loc) · 1.37 KB
/
interfaces.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
import type { ExecutableSchemaTransformation } from '@graphql-tools/schema'
import type { IFieldResolver } from '@graphql-tools/utils'
import type { GraphQLResolveInfo } from 'graphql'
import type { BatchLoader } from './execution/BatchLoader'
import type { KnexGql } from './knex-gql'
export interface KnexGqlContext {
batchLoader: BatchLoader
}
export interface IDirective {
name: string
definition: string
getSchemaTransformer?: (knexGql: KnexGql) => ExecutableSchemaTransformation
}
export interface IExecutionOption<V extends object = any> {
variables?: V
context?: any
}
export type ICustomResoverFn<
T extends object,
Ctx extends KnexGqlContext,
Args extends object,
> = IFieldResolver<T, Ctx, Args>
export interface ICustomFieldResolver<
T extends object = any,
Ctx extends KnexGqlContext = KnexGqlContext,
Args extends object = any,
> {
name: string
resolve: ICustomResoverFn<T, Ctx, Args>
}
export type IDirectiveResolverFn<
TResult = {},
TParent = {},
TContext = {},
TArgs = {},
> = (
next: () => Promise<TResult>,
parent: TParent,
args: TArgs,
context: TContext,
info: GraphQLResolveInfo,
) => TResult | Promise<TResult>
export interface ICustomFieldDirective<T> {
name: string
definition: string
resolve: IDirectiveResolverFn<any, any, KnexGqlContext, T>
}
export type ISimplePagenatorArgs = {
limit: number
offset: number
}