@gqlkit-ts/runtime 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/dist/index.d.ts +27 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/src/index.ts +788 -0
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @gqlkit-ts/runtime
|
|
2
|
+
|
|
3
|
+
Runtime utilities for [gqlkit](https://gqlkit.izumin.dev) — type-safe resolver definitions with a thin API.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
// src/gqlkit/gqlkit.ts
|
|
7
|
+
import { createGqlkitApis, type IDString } from "@gqlkit-ts/runtime";
|
|
8
|
+
import {} from "./context.js";
|
|
9
|
+
|
|
10
|
+
export const { defineQuery, defineMutation, defineField } = createGqlkitApis<Context>();
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
// src/gqlkit/schema/tasks.ts
|
|
15
|
+
import type { NoArgs } from "@gqlkit-ts/runtime";
|
|
16
|
+
import { defineField, defineQuery, defineMutation } from "../gqlkit.js";
|
|
17
|
+
|
|
18
|
+
// Query
|
|
19
|
+
export const tasks = defineQuery<NoArgs, Task[]>(() => fetchTasks());
|
|
20
|
+
|
|
21
|
+
// Mutation
|
|
22
|
+
export const createTask = defineMutation<{ input: CreateTaskInput }, Task>(
|
|
23
|
+
(_, { input }) => createNewTask(input)
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
// Field resolver
|
|
27
|
+
export const taskAuthor = defineField<Task, NoArgs, User>(
|
|
28
|
+
(task) => fetchUser(task.authorId)
|
|
29
|
+
);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
For full documentation, visit [gqlkit.izumin.dev](https://gqlkit.izumin.dev).
|
package/dist/index.d.ts
CHANGED
|
@@ -133,16 +133,18 @@ export type GqlInterface<T extends Record<string, unknown>, Meta extends {
|
|
|
133
133
|
};
|
|
134
134
|
/**
|
|
135
135
|
* Metadata structure for type-level GraphQL metadata.
|
|
136
|
-
* Used to attach directives and
|
|
136
|
+
* Used to attach directives, interface implementations, and field exclusions to types.
|
|
137
137
|
*
|
|
138
138
|
* @typeParam Meta - The metadata configuration object
|
|
139
139
|
*/
|
|
140
140
|
export interface GqlTypeMetaShape<Meta extends {
|
|
141
141
|
directives?: ReadonlyArray<GqlDirective<string, Record<string, unknown>, DirectiveLocation | DirectiveLocation[]>>;
|
|
142
142
|
implements?: ReadonlyArray<GqlInterfaceMarker>;
|
|
143
|
+
ignoreFields?: string;
|
|
143
144
|
}> {
|
|
144
145
|
readonly directives?: Meta["directives"];
|
|
145
146
|
readonly implements?: Meta["implements"];
|
|
147
|
+
readonly ignoreFields?: Meta["ignoreFields"];
|
|
146
148
|
}
|
|
147
149
|
/**
|
|
148
150
|
* Attaches metadata to a type definition.
|
|
@@ -150,11 +152,11 @@ export interface GqlTypeMetaShape<Meta extends {
|
|
|
150
152
|
* with the underlying type.
|
|
151
153
|
*
|
|
152
154
|
* The structure uses two properties:
|
|
153
|
-
* - `$gqlkitTypeMeta`: Contains the metadata object with directives and
|
|
155
|
+
* - `$gqlkitTypeMeta`: Contains the metadata object with directives, implements, and ignoreFields
|
|
154
156
|
* - `$gqlkitOriginalType`: Preserves the original type T to maintain nullability information
|
|
155
157
|
*
|
|
156
158
|
* @typeParam T - The base type to attach metadata to
|
|
157
|
-
* @typeParam Meta - The metadata configuration object containing directives and/or
|
|
159
|
+
* @typeParam Meta - The metadata configuration object containing directives, implements, and/or ignoreFields
|
|
158
160
|
*
|
|
159
161
|
* @example
|
|
160
162
|
* ```typescript
|
|
@@ -188,11 +190,33 @@ export interface GqlTypeMetaShape<Meta extends {
|
|
|
188
190
|
* directives: [CacheDirective<{ maxAge: 60 }>]
|
|
189
191
|
* }
|
|
190
192
|
* >;
|
|
193
|
+
*
|
|
194
|
+
* // Type with ignoreFields to exclude fields from GraphQL schema
|
|
195
|
+
* type User = GqlObject<
|
|
196
|
+
* {
|
|
197
|
+
* id: IDString;
|
|
198
|
+
* name: string;
|
|
199
|
+
* internalId: string;
|
|
200
|
+
* },
|
|
201
|
+
* { ignoreFields: "internalId" }
|
|
202
|
+
* >;
|
|
203
|
+
*
|
|
204
|
+
* // Type with multiple ignored fields
|
|
205
|
+
* type User = GqlObject<
|
|
206
|
+
* {
|
|
207
|
+
* id: IDString;
|
|
208
|
+
* name: string;
|
|
209
|
+
* cacheKey: string;
|
|
210
|
+
* internalId: string;
|
|
211
|
+
* },
|
|
212
|
+
* { ignoreFields: "cacheKey" | "internalId" }
|
|
213
|
+
* >;
|
|
191
214
|
* ```
|
|
192
215
|
*/
|
|
193
216
|
export type GqlObject<T, Meta extends {
|
|
194
217
|
directives?: ReadonlyArray<GqlDirective<string, Record<string, unknown>, DirectiveLocation | DirectiveLocation[]>>;
|
|
195
218
|
implements?: ReadonlyArray<GqlInterfaceMarker>;
|
|
219
|
+
ignoreFields?: keyof T & string;
|
|
196
220
|
} = {
|
|
197
221
|
directives: [];
|
|
198
222
|
}> = T & {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GACzB,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,kBAAkB,GAClB,qBAAqB,GACrB,WAAW,GACX,OAAO,GACP,MAAM,GACN,YAAY,GACZ,cAAc,GACd,wBAAwB,CAAC;AAE7B;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,YAAY,CACtB,IAAI,SAAS,MAAM,EACnB,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAC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AE,QAAQ,CAAC,CAAC;IAE9C;;;;;;;;;;;;;OAaG;IACH,cAAc,EAAE,CAAC,OAAO,EACtB,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,CAAC,KACnC,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,GAAG,OAAO,KAAK,UAAU,CAAC,QAAQ,CAAC,CA2B3E"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA4tBA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,gBAAgB;IAC9B,MAAM,IAAI,GAAG;QACX,WAAW,EAAE,CACX,QAAmD,EACnD,EAAE;YACF,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,cAAc,EAAE,CACd,QAAsD,EACtD,EAAE;YACF,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,WAAW,EAAE,CACX,QAA4D,EAC5D,EAAE;YACF,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,iBAAiB,EAAE,CACjB,QAAoD,EACpD,EAAE;YACF,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,cAAc,EAAE,CAAC,QAAsC,EAAE,EAAE;YACzD,OAAO,QAAQ,CAAC;QAClB,CAAC;KACF,CAAC;IACF,OAAO,IAAuC,CAAC;AACjD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gqlkit-ts/runtime",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Runtime utilities for gqlkit
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Runtime utilities for gqlkit — type-safe resolver definitions with a thin API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
|
-
"dist"
|
|
15
|
+
"dist",
|
|
16
|
+
"src"
|
|
16
17
|
],
|
|
17
18
|
"keywords": [
|
|
18
19
|
"graphql",
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,788 @@
|
|
|
1
|
+
import type { GraphQLResolveInfo } from "graphql";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents the locations where a directive can be applied.
|
|
5
|
+
* This corresponds to GraphQL Type System Directive Locations.
|
|
6
|
+
*/
|
|
7
|
+
export type DirectiveLocation =
|
|
8
|
+
| "SCHEMA"
|
|
9
|
+
| "SCALAR"
|
|
10
|
+
| "OBJECT"
|
|
11
|
+
| "FIELD_DEFINITION"
|
|
12
|
+
| "ARGUMENT_DEFINITION"
|
|
13
|
+
| "INTERFACE"
|
|
14
|
+
| "UNION"
|
|
15
|
+
| "ENUM"
|
|
16
|
+
| "ENUM_VALUE"
|
|
17
|
+
| "INPUT_OBJECT"
|
|
18
|
+
| "INPUT_FIELD_DEFINITION";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Represents a GraphQL directive with name, arguments, and location.
|
|
22
|
+
* Used to define custom directives that can be attached to types and fields.
|
|
23
|
+
*
|
|
24
|
+
* @typeParam Name - The directive name (without @)
|
|
25
|
+
* @typeParam Args - The argument types for the directive
|
|
26
|
+
* @typeParam Location - The location(s) where the directive can be applied
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* type AuthDirective<R extends string[]> = GqlDirective<"auth", { roles: R }, "FIELD_DEFINITION">;
|
|
31
|
+
* type CacheDirective = GqlDirective<"cache", { maxAge: number }, "FIELD_DEFINITION" | "OBJECT">;
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export type GqlDirective<
|
|
35
|
+
Name extends string,
|
|
36
|
+
Args extends Record<string, unknown> = Record<string, never>,
|
|
37
|
+
Location extends DirectiveLocation | DirectiveLocation[] = DirectiveLocation,
|
|
38
|
+
> = {
|
|
39
|
+
readonly " $directiveName": Name;
|
|
40
|
+
readonly " $directiveArgs": Args;
|
|
41
|
+
readonly " $directiveLocation": Location;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Metadata structure for field-level GraphQL metadata.
|
|
46
|
+
* Used to attach directives, default values, and other metadata to individual fields.
|
|
47
|
+
*
|
|
48
|
+
* @typeParam Meta - The metadata configuration object
|
|
49
|
+
*/
|
|
50
|
+
export interface GqlFieldMetaShape<
|
|
51
|
+
Meta extends {
|
|
52
|
+
directives?: ReadonlyArray<
|
|
53
|
+
GqlDirective<
|
|
54
|
+
string,
|
|
55
|
+
Record<string, unknown>,
|
|
56
|
+
DirectiveLocation | DirectiveLocation[]
|
|
57
|
+
>
|
|
58
|
+
>;
|
|
59
|
+
defaultValue?: unknown;
|
|
60
|
+
},
|
|
61
|
+
> {
|
|
62
|
+
readonly directives?: Meta["directives"];
|
|
63
|
+
readonly defaultValue?: Meta["defaultValue"];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Attaches metadata to a field type.
|
|
68
|
+
* The metadata is embedded as optional properties to maintain compatibility
|
|
69
|
+
* with the underlying type.
|
|
70
|
+
*
|
|
71
|
+
* The structure uses two properties:
|
|
72
|
+
* - `$gqlkitFieldMeta`: Contains the metadata object with directives and defaultValue
|
|
73
|
+
* - `$gqlkitOriginalType`: Preserves the original type T to maintain nullability information
|
|
74
|
+
*
|
|
75
|
+
* This design is necessary because TypeScript normalizes `(T | null) & { metadata }` to
|
|
76
|
+
* `(T & { metadata }) | never`, which loses the null part of the union. By storing
|
|
77
|
+
* the original type in `$gqlkitOriginalType`, we can recover the full type information
|
|
78
|
+
* during CLI analysis.
|
|
79
|
+
*
|
|
80
|
+
* @typeParam T - The base type to attach metadata to
|
|
81
|
+
* @typeParam Meta - The metadata configuration object containing directives and/or defaultValue
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* // With directives
|
|
86
|
+
* type User = {
|
|
87
|
+
* id: GqlField<IDString, { directives: [AuthDirective<{ role: ["USER"] }>] }>;
|
|
88
|
+
* bio: GqlField<string | null, { directives: [AuthDirective<{ role: ["ADMIN"] }>] }>;
|
|
89
|
+
* };
|
|
90
|
+
*
|
|
91
|
+
* // With default value
|
|
92
|
+
* type PaginationInput = {
|
|
93
|
+
* limit: GqlField<Int, { defaultValue: 10 }>;
|
|
94
|
+
* offset: GqlField<Int, { defaultValue: 0 }>;
|
|
95
|
+
* };
|
|
96
|
+
*
|
|
97
|
+
* // With both directives and default value
|
|
98
|
+
* type SearchInput = {
|
|
99
|
+
* query: GqlField<string, { defaultValue: ""; directives: [SomeDirective] }>;
|
|
100
|
+
* };
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export type GqlField<
|
|
104
|
+
T,
|
|
105
|
+
Meta extends {
|
|
106
|
+
directives?: ReadonlyArray<
|
|
107
|
+
GqlDirective<
|
|
108
|
+
string,
|
|
109
|
+
Record<string, unknown>,
|
|
110
|
+
DirectiveLocation | DirectiveLocation[]
|
|
111
|
+
>
|
|
112
|
+
>;
|
|
113
|
+
defaultValue?: unknown;
|
|
114
|
+
} = object,
|
|
115
|
+
> = T & {
|
|
116
|
+
readonly " $gqlkitFieldMeta"?: GqlFieldMetaShape<Meta>;
|
|
117
|
+
readonly " $gqlkitOriginalType"?: T;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Marker type for GqlInterface - used internally for type discrimination.
|
|
122
|
+
*/
|
|
123
|
+
export type GqlInterfaceMarker = Record<string, unknown>;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Interface metadata structure embedded in intersection types.
|
|
127
|
+
* Used by CLI to detect and identify interface types through type analysis.
|
|
128
|
+
*
|
|
129
|
+
* @typeParam Meta - The metadata configuration object containing implements
|
|
130
|
+
*/
|
|
131
|
+
export interface GqlInterfaceMetaShape<
|
|
132
|
+
Meta extends {
|
|
133
|
+
implements?: ReadonlyArray<GqlInterfaceMarker>;
|
|
134
|
+
} = object,
|
|
135
|
+
> {
|
|
136
|
+
readonly " $gqlkitInterface": true;
|
|
137
|
+
readonly implements?: Meta["implements"];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* GraphQL interface type definition utility.
|
|
142
|
+
* Use this to define GraphQL interface types that can be implemented by object types.
|
|
143
|
+
*
|
|
144
|
+
* @typeParam T - The interface field definitions as an object type
|
|
145
|
+
* @typeParam Meta - Optional metadata containing implements for interface inheritance
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* // Basic interface definition
|
|
150
|
+
* export type Node = GqlInterface<{
|
|
151
|
+
* id: IDString;
|
|
152
|
+
* }>;
|
|
153
|
+
*
|
|
154
|
+
* export type Timestamped = GqlInterface<{
|
|
155
|
+
* createdAt: DateTime;
|
|
156
|
+
* updatedAt: DateTime;
|
|
157
|
+
* }>;
|
|
158
|
+
*
|
|
159
|
+
* // Interface inheriting other interfaces
|
|
160
|
+
* export type Entity = GqlInterface<
|
|
161
|
+
* {
|
|
162
|
+
* id: IDString;
|
|
163
|
+
* createdAt: DateTime;
|
|
164
|
+
* updatedAt: DateTime;
|
|
165
|
+
* },
|
|
166
|
+
* { implements: [Node, Timestamped] }
|
|
167
|
+
* >;
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
export type GqlInterface<
|
|
171
|
+
T extends Record<string, unknown>,
|
|
172
|
+
Meta extends {
|
|
173
|
+
implements?: ReadonlyArray<GqlInterfaceMarker>;
|
|
174
|
+
} = object,
|
|
175
|
+
> = T & {
|
|
176
|
+
readonly " $gqlkitInterfaceMeta"?: GqlInterfaceMetaShape<Meta>;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Metadata structure for type-level GraphQL metadata.
|
|
181
|
+
* Used to attach directives, interface implementations, and field exclusions to types.
|
|
182
|
+
*
|
|
183
|
+
* @typeParam Meta - The metadata configuration object
|
|
184
|
+
*/
|
|
185
|
+
export interface GqlTypeMetaShape<
|
|
186
|
+
Meta extends {
|
|
187
|
+
directives?: ReadonlyArray<
|
|
188
|
+
GqlDirective<
|
|
189
|
+
string,
|
|
190
|
+
Record<string, unknown>,
|
|
191
|
+
DirectiveLocation | DirectiveLocation[]
|
|
192
|
+
>
|
|
193
|
+
>;
|
|
194
|
+
implements?: ReadonlyArray<GqlInterfaceMarker>;
|
|
195
|
+
ignoreFields?: string;
|
|
196
|
+
},
|
|
197
|
+
> {
|
|
198
|
+
readonly directives?: Meta["directives"];
|
|
199
|
+
readonly implements?: Meta["implements"];
|
|
200
|
+
readonly ignoreFields?: Meta["ignoreFields"];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Attaches metadata to a type definition.
|
|
205
|
+
* The metadata is embedded as optional properties to maintain compatibility
|
|
206
|
+
* with the underlying type.
|
|
207
|
+
*
|
|
208
|
+
* The structure uses two properties:
|
|
209
|
+
* - `$gqlkitTypeMeta`: Contains the metadata object with directives, implements, and ignoreFields
|
|
210
|
+
* - `$gqlkitOriginalType`: Preserves the original type T to maintain nullability information
|
|
211
|
+
*
|
|
212
|
+
* @typeParam T - The base type to attach metadata to
|
|
213
|
+
* @typeParam Meta - The metadata configuration object containing directives, implements, and/or ignoreFields
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```typescript
|
|
217
|
+
* // Type with directives only
|
|
218
|
+
* type User = GqlObject<
|
|
219
|
+
* {
|
|
220
|
+
* id: string;
|
|
221
|
+
* name: string;
|
|
222
|
+
* },
|
|
223
|
+
* { directives: [CacheDirective<{ maxAge: 60 }>] }
|
|
224
|
+
* >;
|
|
225
|
+
*
|
|
226
|
+
* // Type implementing an interface
|
|
227
|
+
* type User = GqlObject<
|
|
228
|
+
* {
|
|
229
|
+
* id: IDString;
|
|
230
|
+
* name: string;
|
|
231
|
+
* },
|
|
232
|
+
* { implements: [Node] }
|
|
233
|
+
* >;
|
|
234
|
+
*
|
|
235
|
+
* // Type with both directives and implements
|
|
236
|
+
* type Post = GqlObject<
|
|
237
|
+
* {
|
|
238
|
+
* id: IDString;
|
|
239
|
+
* title: string;
|
|
240
|
+
* createdAt: DateTime;
|
|
241
|
+
* },
|
|
242
|
+
* {
|
|
243
|
+
* implements: [Node, Timestamped],
|
|
244
|
+
* directives: [CacheDirective<{ maxAge: 60 }>]
|
|
245
|
+
* }
|
|
246
|
+
* >;
|
|
247
|
+
*
|
|
248
|
+
* // Type with ignoreFields to exclude fields from GraphQL schema
|
|
249
|
+
* type User = GqlObject<
|
|
250
|
+
* {
|
|
251
|
+
* id: IDString;
|
|
252
|
+
* name: string;
|
|
253
|
+
* internalId: string;
|
|
254
|
+
* },
|
|
255
|
+
* { ignoreFields: "internalId" }
|
|
256
|
+
* >;
|
|
257
|
+
*
|
|
258
|
+
* // Type with multiple ignored fields
|
|
259
|
+
* type User = GqlObject<
|
|
260
|
+
* {
|
|
261
|
+
* id: IDString;
|
|
262
|
+
* name: string;
|
|
263
|
+
* cacheKey: string;
|
|
264
|
+
* internalId: string;
|
|
265
|
+
* },
|
|
266
|
+
* { ignoreFields: "cacheKey" | "internalId" }
|
|
267
|
+
* >;
|
|
268
|
+
* ```
|
|
269
|
+
*/
|
|
270
|
+
export type GqlObject<
|
|
271
|
+
T,
|
|
272
|
+
Meta extends {
|
|
273
|
+
directives?: ReadonlyArray<
|
|
274
|
+
GqlDirective<
|
|
275
|
+
string,
|
|
276
|
+
Record<string, unknown>,
|
|
277
|
+
DirectiveLocation | DirectiveLocation[]
|
|
278
|
+
>
|
|
279
|
+
>;
|
|
280
|
+
implements?: ReadonlyArray<GqlInterfaceMarker>;
|
|
281
|
+
ignoreFields?: keyof T & string;
|
|
282
|
+
} = { directives: [] },
|
|
283
|
+
> = T & {
|
|
284
|
+
readonly " $gqlkitTypeMeta"?: GqlTypeMetaShape<Meta>;
|
|
285
|
+
readonly " $gqlkitOriginalType"?: T;
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Scalar metadata structure embedded in intersection types.
|
|
290
|
+
* Used by CLI to detect and identify scalar types through type analysis.
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* ```typescript
|
|
294
|
+
* // A type with scalar metadata
|
|
295
|
+
* type MyScalar = Base & { " $gqlkitScalar"?: ScalarMetadataShape };
|
|
296
|
+
* ```
|
|
297
|
+
*/
|
|
298
|
+
export interface ScalarMetadataShape {
|
|
299
|
+
readonly name: string;
|
|
300
|
+
readonly only?: "input" | "output";
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Utility type for defining custom scalar types with metadata.
|
|
305
|
+
* The metadata is embedded as an optional property to maintain compatibility
|
|
306
|
+
* with the underlying base type.
|
|
307
|
+
*
|
|
308
|
+
* @typeParam Name - The GraphQL scalar name
|
|
309
|
+
* @typeParam Base - The underlying TypeScript type
|
|
310
|
+
* @typeParam Only - Usage constraint: "input" for input-only, "output" for output-only, undefined for both
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```typescript
|
|
314
|
+
* // Basic custom scalar
|
|
315
|
+
* type DateTime = GqlScalar<"DateTime", Date>;
|
|
316
|
+
*
|
|
317
|
+
* // Input-only scalar
|
|
318
|
+
* type DateTimeInput = GqlScalar<"DateTime", Date, "input">;
|
|
319
|
+
*
|
|
320
|
+
* // Output-only scalar (can accept multiple base types)
|
|
321
|
+
* type DateTimeOutput = GqlScalar<"DateTime", Date | string, "output">;
|
|
322
|
+
* ```
|
|
323
|
+
*/
|
|
324
|
+
export type GqlScalar<
|
|
325
|
+
Name extends string,
|
|
326
|
+
Base,
|
|
327
|
+
Only extends "input" | "output" | undefined = undefined,
|
|
328
|
+
> = Base & {
|
|
329
|
+
" $gqlkitScalar"?: {
|
|
330
|
+
name: Name;
|
|
331
|
+
only: Only;
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* GraphQL Int scalar type.
|
|
337
|
+
* Use this to explicitly mark a field as an integer.
|
|
338
|
+
* Includes metadata for CLI detection.
|
|
339
|
+
*/
|
|
340
|
+
export type Int = GqlScalar<"Int", number>;
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* GraphQL Float scalar type.
|
|
344
|
+
* Use this to explicitly mark a field as a floating-point number.
|
|
345
|
+
* Note: Plain `number` type will also map to Float by default.
|
|
346
|
+
* Includes metadata for CLI detection.
|
|
347
|
+
*/
|
|
348
|
+
export type Float = GqlScalar<"Float", number>;
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* GraphQL ID scalar type (string-based).
|
|
352
|
+
* Use this when the ID is represented as a string in your system.
|
|
353
|
+
* Includes metadata for CLI detection.
|
|
354
|
+
*/
|
|
355
|
+
export type IDString = GqlScalar<"ID", string>;
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* GraphQL ID scalar type (number-based).
|
|
359
|
+
* Use this when the ID is represented as a number in your system.
|
|
360
|
+
* Includes metadata for CLI detection.
|
|
361
|
+
*/
|
|
362
|
+
export type IDNumber = GqlScalar<"ID", number>;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Type alias representing no arguments for a resolver.
|
|
366
|
+
* Use this when defining resolvers that don't accept any arguments.
|
|
367
|
+
*/
|
|
368
|
+
export type NoArgs = Record<string, never>;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Type for Query resolver functions.
|
|
372
|
+
* @typeParam TArgs - The type of arguments the resolver accepts
|
|
373
|
+
* @typeParam TResult - The return type of the resolver
|
|
374
|
+
* @typeParam TContext - The context type (defaults to unknown)
|
|
375
|
+
*/
|
|
376
|
+
export type QueryResolverFn<TArgs, TResult, TContext = unknown> = (
|
|
377
|
+
root: undefined,
|
|
378
|
+
args: TArgs,
|
|
379
|
+
context: TContext,
|
|
380
|
+
info: GraphQLResolveInfo,
|
|
381
|
+
) => TResult | Promise<TResult>;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Type for Mutation resolver functions.
|
|
385
|
+
* @typeParam TArgs - The type of arguments the resolver accepts
|
|
386
|
+
* @typeParam TResult - The return type of the resolver
|
|
387
|
+
* @typeParam TContext - The context type (defaults to unknown)
|
|
388
|
+
*/
|
|
389
|
+
export type MutationResolverFn<TArgs, TResult, TContext = unknown> = (
|
|
390
|
+
root: undefined,
|
|
391
|
+
args: TArgs,
|
|
392
|
+
context: TContext,
|
|
393
|
+
info: GraphQLResolveInfo,
|
|
394
|
+
) => TResult | Promise<TResult>;
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Type for Field resolver functions.
|
|
398
|
+
* @typeParam TParent - The parent type this field belongs to
|
|
399
|
+
* @typeParam TArgs - The type of arguments the resolver accepts
|
|
400
|
+
* @typeParam TResult - The return type of the resolver
|
|
401
|
+
* @typeParam TContext - The context type (defaults to unknown)
|
|
402
|
+
*/
|
|
403
|
+
export type FieldResolverFn<TParent, TArgs, TResult, TContext = unknown> = (
|
|
404
|
+
parent: TParent,
|
|
405
|
+
args: TArgs,
|
|
406
|
+
context: TContext,
|
|
407
|
+
info: GraphQLResolveInfo,
|
|
408
|
+
) => TResult | Promise<TResult>;
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* The kind of resolver.
|
|
412
|
+
*/
|
|
413
|
+
export type ResolverKind = "query" | "mutation" | "field";
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* The kind of abstract type resolver.
|
|
417
|
+
*/
|
|
418
|
+
export type AbstractResolverKind = "resolveType" | "isTypeOf";
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Type for resolveType resolver functions.
|
|
422
|
+
* Used to resolve the concrete type of a union or interface type at runtime.
|
|
423
|
+
* @typeParam TAbstract - The abstract type (union or interface) to resolve
|
|
424
|
+
* @typeParam TContext - The context type (defaults to unknown)
|
|
425
|
+
*/
|
|
426
|
+
export type ResolveTypeResolverFn<TAbstract, TContext = unknown> = (
|
|
427
|
+
value: TAbstract,
|
|
428
|
+
context: TContext,
|
|
429
|
+
info: GraphQLResolveInfo,
|
|
430
|
+
) => string | Promise<string>;
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Type for isTypeOf resolver functions.
|
|
434
|
+
* Used to check if a value belongs to a specific object type.
|
|
435
|
+
* @typeParam TContext - The context type (defaults to unknown)
|
|
436
|
+
*/
|
|
437
|
+
export type IsTypeOfResolverFn<TContext = unknown> = (
|
|
438
|
+
value: unknown,
|
|
439
|
+
context: TContext,
|
|
440
|
+
info: GraphQLResolveInfo,
|
|
441
|
+
) => boolean | Promise<boolean>;
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Abstract type resolver metadata structure embedded in intersection types.
|
|
445
|
+
* Used by CLI to detect and identify abstract type resolvers through type analysis.
|
|
446
|
+
*/
|
|
447
|
+
export interface AbstractResolverMetadataShape {
|
|
448
|
+
readonly kind: AbstractResolverKind;
|
|
449
|
+
readonly targetType: unknown;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* resolveType resolver type with metadata.
|
|
454
|
+
* The metadata is embedded as an optional property with space-prefixed key
|
|
455
|
+
* to avoid collision with user-defined properties.
|
|
456
|
+
* @typeParam TAbstract - The abstract type (union or interface) to resolve
|
|
457
|
+
* @typeParam TContext - The context type (defaults to unknown)
|
|
458
|
+
*/
|
|
459
|
+
export type ResolveTypeResolver<
|
|
460
|
+
TAbstract,
|
|
461
|
+
TContext = unknown,
|
|
462
|
+
> = ResolveTypeResolverFn<TAbstract, TContext> & {
|
|
463
|
+
" $gqlkitAbstractResolver"?: {
|
|
464
|
+
kind: "resolveType";
|
|
465
|
+
targetType: TAbstract;
|
|
466
|
+
};
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* isTypeOf resolver type with metadata.
|
|
471
|
+
* The metadata is embedded as an optional property with space-prefixed key
|
|
472
|
+
* to avoid collision with user-defined properties.
|
|
473
|
+
* @typeParam TObject - The object type to check
|
|
474
|
+
* @typeParam TContext - The context type (defaults to unknown)
|
|
475
|
+
*/
|
|
476
|
+
export type IsTypeOfResolver<
|
|
477
|
+
TObject,
|
|
478
|
+
TContext = unknown,
|
|
479
|
+
> = IsTypeOfResolverFn<TContext> & {
|
|
480
|
+
" $gqlkitAbstractResolver"?: {
|
|
481
|
+
kind: "isTypeOf";
|
|
482
|
+
targetType: TObject;
|
|
483
|
+
};
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Resolver metadata structure embedded in intersection types.
|
|
488
|
+
* Used by CLI to detect and identify resolver types through type analysis.
|
|
489
|
+
*/
|
|
490
|
+
export interface ResolverMetadataShape {
|
|
491
|
+
readonly kind: ResolverKind;
|
|
492
|
+
readonly args: unknown;
|
|
493
|
+
readonly result: unknown;
|
|
494
|
+
readonly parent?: unknown;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Query resolver type with metadata.
|
|
499
|
+
* The metadata is embedded as an optional property with space-prefixed key
|
|
500
|
+
* to avoid collision with user-defined properties.
|
|
501
|
+
* @typeParam TArgs - The type of arguments the resolver accepts
|
|
502
|
+
* @typeParam TResult - The return type of the resolver
|
|
503
|
+
* @typeParam TContext - The context type (defaults to unknown)
|
|
504
|
+
* @typeParam TDirectives - Array of directives to attach to this field (defaults to [])
|
|
505
|
+
*/
|
|
506
|
+
export type QueryResolver<
|
|
507
|
+
TArgs,
|
|
508
|
+
TResult,
|
|
509
|
+
TContext = unknown,
|
|
510
|
+
TDirectives extends ReadonlyArray<
|
|
511
|
+
GqlDirective<
|
|
512
|
+
string,
|
|
513
|
+
Record<string, unknown>,
|
|
514
|
+
DirectiveLocation | DirectiveLocation[]
|
|
515
|
+
>
|
|
516
|
+
> = [],
|
|
517
|
+
> = QueryResolverFn<TArgs, TResult, TContext> & {
|
|
518
|
+
" $gqlkitResolver"?: {
|
|
519
|
+
kind: "query";
|
|
520
|
+
args: TArgs;
|
|
521
|
+
result: TResult;
|
|
522
|
+
directives: TDirectives;
|
|
523
|
+
};
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Mutation resolver type with metadata.
|
|
528
|
+
* The metadata is embedded as an optional property with space-prefixed key
|
|
529
|
+
* to avoid collision with user-defined properties.
|
|
530
|
+
* @typeParam TArgs - The type of arguments the resolver accepts
|
|
531
|
+
* @typeParam TResult - The return type of the resolver
|
|
532
|
+
* @typeParam TContext - The context type (defaults to unknown)
|
|
533
|
+
* @typeParam TDirectives - Array of directives to attach to this field (defaults to [])
|
|
534
|
+
*/
|
|
535
|
+
export type MutationResolver<
|
|
536
|
+
TArgs,
|
|
537
|
+
TResult,
|
|
538
|
+
TContext = unknown,
|
|
539
|
+
TDirectives extends ReadonlyArray<
|
|
540
|
+
GqlDirective<
|
|
541
|
+
string,
|
|
542
|
+
Record<string, unknown>,
|
|
543
|
+
DirectiveLocation | DirectiveLocation[]
|
|
544
|
+
>
|
|
545
|
+
> = [],
|
|
546
|
+
> = MutationResolverFn<TArgs, TResult, TContext> & {
|
|
547
|
+
" $gqlkitResolver"?: {
|
|
548
|
+
kind: "mutation";
|
|
549
|
+
args: TArgs;
|
|
550
|
+
result: TResult;
|
|
551
|
+
directives: TDirectives;
|
|
552
|
+
};
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Field resolver type with metadata.
|
|
557
|
+
* The metadata is embedded as an optional property with space-prefixed key
|
|
558
|
+
* to avoid collision with user-defined properties.
|
|
559
|
+
* @typeParam TParent - The parent type this field belongs to
|
|
560
|
+
* @typeParam TArgs - The type of arguments the resolver accepts
|
|
561
|
+
* @typeParam TResult - The return type of the resolver
|
|
562
|
+
* @typeParam TContext - The context type (defaults to unknown)
|
|
563
|
+
* @typeParam TDirectives - Array of directives to attach to this field (defaults to [])
|
|
564
|
+
*/
|
|
565
|
+
export type FieldResolver<
|
|
566
|
+
TParent,
|
|
567
|
+
TArgs,
|
|
568
|
+
TResult,
|
|
569
|
+
TContext = unknown,
|
|
570
|
+
TDirectives extends ReadonlyArray<
|
|
571
|
+
GqlDirective<
|
|
572
|
+
string,
|
|
573
|
+
Record<string, unknown>,
|
|
574
|
+
DirectiveLocation | DirectiveLocation[]
|
|
575
|
+
>
|
|
576
|
+
> = [],
|
|
577
|
+
> = FieldResolverFn<TParent, TArgs, TResult, TContext> & {
|
|
578
|
+
" $gqlkitResolver"?: {
|
|
579
|
+
kind: "field";
|
|
580
|
+
parent: TParent;
|
|
581
|
+
args: TArgs;
|
|
582
|
+
result: TResult;
|
|
583
|
+
directives: TDirectives;
|
|
584
|
+
};
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* The API set returned by createGqlkitApis.
|
|
589
|
+
* Contains typed define functions for Query, Mutation, and Field resolvers.
|
|
590
|
+
* @typeParam TContext - The context type for all resolvers in this API set
|
|
591
|
+
*/
|
|
592
|
+
export interface GqlkitApis<TContext> {
|
|
593
|
+
/**
|
|
594
|
+
* Defines a Query field resolver with the specified Context type.
|
|
595
|
+
* @typeParam TArgs - The type of arguments the resolver accepts
|
|
596
|
+
* @typeParam TResult - The return type of the resolver
|
|
597
|
+
* @typeParam TDirectives - Array of directives to attach to this field (defaults to [])
|
|
598
|
+
* @param resolver - The resolver function
|
|
599
|
+
* @returns The resolver with metadata for CLI detection
|
|
600
|
+
*
|
|
601
|
+
* @example
|
|
602
|
+
* ```typescript
|
|
603
|
+
* // Without directives
|
|
604
|
+
* export const users = defineQuery<NoArgs, User[]>(() => []);
|
|
605
|
+
*
|
|
606
|
+
* // With directives
|
|
607
|
+
* export const me = defineQuery<NoArgs, User, [AuthDirective<{ role: ["USER"] }>]>(
|
|
608
|
+
* (root, args, ctx) => ctx.currentUser
|
|
609
|
+
* );
|
|
610
|
+
* ```
|
|
611
|
+
*/
|
|
612
|
+
defineQuery: <
|
|
613
|
+
TArgs,
|
|
614
|
+
TResult,
|
|
615
|
+
TDirectives extends ReadonlyArray<
|
|
616
|
+
GqlDirective<
|
|
617
|
+
string,
|
|
618
|
+
Record<string, unknown>,
|
|
619
|
+
DirectiveLocation | DirectiveLocation[]
|
|
620
|
+
>
|
|
621
|
+
> = [],
|
|
622
|
+
>(
|
|
623
|
+
resolver: QueryResolverFn<TArgs, TResult, TContext>,
|
|
624
|
+
) => QueryResolver<TArgs, TResult, TContext, TDirectives>;
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Defines a Mutation field resolver with the specified Context type.
|
|
628
|
+
* @typeParam TArgs - The type of arguments the resolver accepts
|
|
629
|
+
* @typeParam TResult - The return type of the resolver
|
|
630
|
+
* @typeParam TDirectives - Array of directives to attach to this field (defaults to [])
|
|
631
|
+
* @param resolver - The resolver function
|
|
632
|
+
* @returns The resolver with metadata for CLI detection
|
|
633
|
+
*
|
|
634
|
+
* @example
|
|
635
|
+
* ```typescript
|
|
636
|
+
* // Without directives
|
|
637
|
+
* export const createUser = defineMutation<CreateUserInput, User>((root, args) => ({ ... }));
|
|
638
|
+
*
|
|
639
|
+
* // With directives
|
|
640
|
+
* export const deleteUser = defineMutation<{ id: string }, boolean, [AuthDirective<{ role: ["ADMIN"] }>]>(
|
|
641
|
+
* (root, args, ctx) => true
|
|
642
|
+
* );
|
|
643
|
+
* ```
|
|
644
|
+
*/
|
|
645
|
+
defineMutation: <
|
|
646
|
+
TArgs,
|
|
647
|
+
TResult,
|
|
648
|
+
TDirectives extends ReadonlyArray<
|
|
649
|
+
GqlDirective<
|
|
650
|
+
string,
|
|
651
|
+
Record<string, unknown>,
|
|
652
|
+
DirectiveLocation | DirectiveLocation[]
|
|
653
|
+
>
|
|
654
|
+
> = [],
|
|
655
|
+
>(
|
|
656
|
+
resolver: MutationResolverFn<TArgs, TResult, TContext>,
|
|
657
|
+
) => MutationResolver<TArgs, TResult, TContext, TDirectives>;
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Defines an object type field resolver with the specified Context type.
|
|
661
|
+
* @typeParam TParent - The parent type this field belongs to
|
|
662
|
+
* @typeParam TArgs - The type of arguments the resolver accepts
|
|
663
|
+
* @typeParam TResult - The return type of the resolver
|
|
664
|
+
* @typeParam TDirectives - Array of directives to attach to this field (defaults to [])
|
|
665
|
+
* @param resolver - The resolver function
|
|
666
|
+
* @returns The resolver with metadata for CLI detection
|
|
667
|
+
*
|
|
668
|
+
* @example
|
|
669
|
+
* ```typescript
|
|
670
|
+
* // Without directives
|
|
671
|
+
* export const userPosts = defineField<User, NoArgs, Post[]>((parent) => []);
|
|
672
|
+
*
|
|
673
|
+
* // With directives
|
|
674
|
+
* export const userEmail = defineField<User, NoArgs, string, [AuthDirective<{ role: ["ADMIN"] }>]>(
|
|
675
|
+
* (parent) => parent.email
|
|
676
|
+
* );
|
|
677
|
+
* ```
|
|
678
|
+
*/
|
|
679
|
+
defineField: <
|
|
680
|
+
TParent,
|
|
681
|
+
TArgs,
|
|
682
|
+
TResult,
|
|
683
|
+
TDirectives extends ReadonlyArray<
|
|
684
|
+
GqlDirective<
|
|
685
|
+
string,
|
|
686
|
+
Record<string, unknown>,
|
|
687
|
+
DirectiveLocation | DirectiveLocation[]
|
|
688
|
+
>
|
|
689
|
+
> = [],
|
|
690
|
+
>(
|
|
691
|
+
resolver: FieldResolverFn<TParent, TArgs, TResult, TContext>,
|
|
692
|
+
) => FieldResolver<TParent, TArgs, TResult, TContext, TDirectives>;
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* Defines a resolveType resolver for union or interface types.
|
|
696
|
+
* Used to determine the concrete type of an abstract type at runtime.
|
|
697
|
+
* @typeParam TAbstract - The abstract type (union or interface) to resolve
|
|
698
|
+
* @param resolver - The resolver function that returns the concrete type name
|
|
699
|
+
* @returns The resolver with metadata for CLI detection
|
|
700
|
+
*
|
|
701
|
+
* @example
|
|
702
|
+
* ```typescript
|
|
703
|
+
* type Animal = Dog | Cat;
|
|
704
|
+
*
|
|
705
|
+
* export const animalResolveType = defineResolveType<Animal>((value) => {
|
|
706
|
+
* return value.kind === "dog" ? "Dog" : "Cat";
|
|
707
|
+
* });
|
|
708
|
+
* ```
|
|
709
|
+
*/
|
|
710
|
+
defineResolveType: <TAbstract>(
|
|
711
|
+
resolver: ResolveTypeResolverFn<TAbstract, TContext>,
|
|
712
|
+
) => ResolveTypeResolver<TAbstract, TContext>;
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Defines an isTypeOf resolver for object types.
|
|
716
|
+
* Used to check if a value belongs to a specific object type.
|
|
717
|
+
* @typeParam TObject - The object type to check
|
|
718
|
+
* @param resolver - The resolver function that returns true if the value is of this type
|
|
719
|
+
* @returns The resolver with metadata for CLI detection
|
|
720
|
+
*
|
|
721
|
+
* @example
|
|
722
|
+
* ```typescript
|
|
723
|
+
* export const dogIsTypeOf = defineIsTypeOf<Dog>((value) => {
|
|
724
|
+
* return typeof value === "object" && value !== null && "kind" in value && value.kind === "dog";
|
|
725
|
+
* });
|
|
726
|
+
* ```
|
|
727
|
+
*/
|
|
728
|
+
defineIsTypeOf: <TObject>(
|
|
729
|
+
resolver: IsTypeOfResolverFn<TContext>,
|
|
730
|
+
) => IsTypeOfResolver<TObject, TContext>;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* Creates a set of typed define functions for GraphQL resolvers.
|
|
735
|
+
* Use this factory to create API sets with custom Context types.
|
|
736
|
+
*
|
|
737
|
+
* @typeParam TContext - The context type for all resolvers (defaults to unknown)
|
|
738
|
+
* @returns An object containing defineQuery, defineMutation, and defineField functions
|
|
739
|
+
*
|
|
740
|
+
* @example
|
|
741
|
+
* ```typescript
|
|
742
|
+
* type MyContext = { userId: string; db: Database };
|
|
743
|
+
*
|
|
744
|
+
* const { defineQuery, defineMutation, defineField } = createGqlkitApis<MyContext>();
|
|
745
|
+
*
|
|
746
|
+
* export const me = defineQuery<NoArgs, User>(
|
|
747
|
+
* (root, args, ctx, info) => ctx.db.findUser(ctx.userId)
|
|
748
|
+
* );
|
|
749
|
+
* ```
|
|
750
|
+
*
|
|
751
|
+
* @example
|
|
752
|
+
* ```typescript
|
|
753
|
+
* // Multiple schemas with different contexts
|
|
754
|
+
* type AdminContext = { adminId: string };
|
|
755
|
+
* type PublicContext = { sessionId: string };
|
|
756
|
+
*
|
|
757
|
+
* const adminApis = createGqlkitApis<AdminContext>();
|
|
758
|
+
* const publicApis = createGqlkitApis<PublicContext>();
|
|
759
|
+
* ```
|
|
760
|
+
*/
|
|
761
|
+
export function createGqlkitApis<TContext = unknown>(): GqlkitApis<TContext> {
|
|
762
|
+
const apis = {
|
|
763
|
+
defineQuery: <TArgs, TResult>(
|
|
764
|
+
resolver: QueryResolverFn<TArgs, TResult, TContext>,
|
|
765
|
+
) => {
|
|
766
|
+
return resolver;
|
|
767
|
+
},
|
|
768
|
+
defineMutation: <TArgs, TResult>(
|
|
769
|
+
resolver: MutationResolverFn<TArgs, TResult, TContext>,
|
|
770
|
+
) => {
|
|
771
|
+
return resolver;
|
|
772
|
+
},
|
|
773
|
+
defineField: <TParent, TArgs, TResult>(
|
|
774
|
+
resolver: FieldResolverFn<TParent, TArgs, TResult, TContext>,
|
|
775
|
+
) => {
|
|
776
|
+
return resolver;
|
|
777
|
+
},
|
|
778
|
+
defineResolveType: <TAbstract>(
|
|
779
|
+
resolver: ResolveTypeResolverFn<TAbstract, TContext>,
|
|
780
|
+
) => {
|
|
781
|
+
return resolver;
|
|
782
|
+
},
|
|
783
|
+
defineIsTypeOf: (resolver: IsTypeOfResolverFn<TContext>) => {
|
|
784
|
+
return resolver;
|
|
785
|
+
},
|
|
786
|
+
};
|
|
787
|
+
return apis as unknown as GqlkitApis<TContext>;
|
|
788
|
+
}
|