-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathDepartmentFetcher.ts
More file actions
159 lines (136 loc) · 5.4 KB
/
Copy pathDepartmentFetcher.ts
File metadata and controls
159 lines (136 loc) · 5.4 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
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
import type { FieldOptions, DirectiveArgs } from 'graphql-ts-client-api';
import { ENUM_INPUT_METADATA } from '../EnumInputMetadata';
import type { ObjectFetcher } from 'graphql-ts-client-api';
import { createFetcher, createFetchableType } from 'graphql-ts-client-api';
import type { WithTypeName, ImplementationType } from '../CommonTypes';
import { node$ } from './NodeFetcher';
/*
* Any instance of this interface is immutable,
* all the properties and functions can only be used to create new instances,
* they cannot modify the current instance.
*
* So any instance of this interface is reuseable.
*/
export interface DepartmentFetcher<T extends object, TVariables extends object> extends ObjectFetcher<'Department', T, TVariables> {
on<XName extends ImplementationType<'Department'>, X extends object, XVariables extends object>(
child: ObjectFetcher<XName, X, XVariables>,
fragmentName?: string // undefined: inline fragment; otherwise, otherwise, real fragment
): DepartmentFetcher<
XName extends 'Department' ?
T & X :
WithTypeName<T, ImplementationType<'Department'>> & (
WithTypeName<X, ImplementationType<XName>> |
{__typename: Exclude<ImplementationType<'Department'>, ImplementationType<XName>>}
),
TVariables & XVariables
>;
directive(name: string, args?: DirectiveArgs): DepartmentFetcher<T, TVariables>;
readonly __typename: DepartmentFetcher<T & {__typename: ImplementationType<'Department'>}, TVariables>;
readonly id: DepartmentFetcher<T & {readonly "id": string}, TVariables>;
"id+"<
XAlias extends string = "id",
XDirectives extends { readonly [key: string]: DirectiveArgs } = {},
XDirectiveVariables extends object = {}
>(
optionsConfigurer: (
options: FieldOptions<"id", {}, {}>
) => FieldOptions<XAlias, XDirectives, XDirectiveVariables>
): DepartmentFetcher<
T & (
XDirectives extends { readonly include: any } | { readonly skip: any } ?
{readonly [key in XAlias]?: string} :
{readonly [key in XAlias]: string}
),
TVariables & XDirectiveVariables
>;
readonly "~id": DepartmentFetcher<Omit<T, 'id'>, TVariables>;
readonly name: DepartmentFetcher<T & {readonly "name": string}, TVariables>;
"name+"<
XAlias extends string = "name",
XDirectives extends { readonly [key: string]: DirectiveArgs } = {},
XDirectiveVariables extends object = {}
>(
optionsConfigurer: (
options: FieldOptions<"name", {}, {}>
) => FieldOptions<XAlias, XDirectives, XDirectiveVariables>
): DepartmentFetcher<
T & (
XDirectives extends { readonly include: any } | { readonly skip: any } ?
{readonly [key in XAlias]?: string} :
{readonly [key in XAlias]: string}
),
TVariables & XDirectiveVariables
>;
readonly "~name": DepartmentFetcher<Omit<T, 'name'>, TVariables>;
employees<
X extends object,
XVariables extends object
>(
child: ObjectFetcher<'Employee', X, XVariables>
): DepartmentFetcher<
T & {readonly "employees": ReadonlyArray<X>},
TVariables & XVariables
>;
employees<
X extends object,
XVariables extends object,
XAlias extends string = "employees",
XDirectives extends { readonly [key: string]: DirectiveArgs } = {},
XDirectiveVariables extends object = {}
>(
child: ObjectFetcher<'Employee', X, XVariables>,
optionsConfigurer: (
options: FieldOptions<"employees", {}, {}>
) => FieldOptions<XAlias, XDirectives, XDirectiveVariables>
): DepartmentFetcher<
T & (
XDirectives extends { readonly include: any } | { readonly skip: any } ?
{readonly [key in XAlias]?: ReadonlyArray<X>} :
{readonly [key in XAlias]: ReadonlyArray<X>}
),
TVariables & XVariables & XDirectiveVariables
>;
readonly avgSalary: DepartmentFetcher<T & {readonly "avgSalary": number}, TVariables>;
"avgSalary+"<
XAlias extends string = "avgSalary",
XDirectives extends { readonly [key: string]: DirectiveArgs } = {},
XDirectiveVariables extends object = {}
>(
optionsConfigurer: (
options: FieldOptions<"avgSalary", {}, {}>
) => FieldOptions<XAlias, XDirectives, XDirectiveVariables>
): DepartmentFetcher<
T & (
XDirectives extends { readonly include: any } | { readonly skip: any } ?
{readonly [key in XAlias]?: number} :
{readonly [key in XAlias]: number}
),
TVariables & XDirectiveVariables
>;
readonly "~avgSalary": DepartmentFetcher<Omit<T, 'avgSalary'>, TVariables>;
}
export const department$: DepartmentFetcher<{}, {}> =
createFetcher(
createFetchableType(
"Department",
"OBJECT",
[node$.fetchableType],
[
"name",
{
category: "LIST",
name: "employees",
targetTypeName: "Employee"
},
"avgSalary"
]
),
ENUM_INPUT_METADATA,
undefined
)
;
export const department$$ =
department$
.id
.name
;