@nexusts/graphql 0.7.6 → 0.7.8
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/dist/decorators/index.d.ts +1 -0
- package/dist/decorators/query.d.ts +9 -3
- package/dist/decorators/type-mapper.d.ts +15 -0
- package/dist/graphql.service.d.ts +19 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +200 -93
- package/dist/index.js.map +8 -7
- package/dist/types.d.ts +7 -0
- package/package.json +2 -2
|
@@ -4,3 +4,4 @@
|
|
|
4
4
|
export { Resolver, isResolverClass, getResolverTypeName, getResolverFields, getRegisteredResolvers, clearResolverRegistry, pushResolverField } from "./resolver.js";
|
|
5
5
|
export { Query, Mutation, Subscription } from "./query.js";
|
|
6
6
|
export { Arg, getMethodArgs } from "./arg.js";
|
|
7
|
+
export { normalizeGQLType } from "./type-mapper.js";
|
|
@@ -19,8 +19,14 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import "reflect-metadata";
|
|
21
21
|
import type { ResolverClassRecord } from "../types.js";
|
|
22
|
-
export declare const Query: (name?: string
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
export declare const Query: (name?: string, opts?: {
|
|
23
|
+
returns?: string;
|
|
24
|
+
}) => (target: object, propertyKey: string | symbol, _descriptor: TypedPropertyDescriptor<any>) => void;
|
|
25
|
+
export declare const Mutation: (name?: string, opts?: {
|
|
26
|
+
returns?: string;
|
|
27
|
+
}) => (target: object, propertyKey: string | symbol, _descriptor: TypedPropertyDescriptor<any>) => void;
|
|
28
|
+
export declare const Subscription: (name?: string, opts?: {
|
|
29
|
+
returns?: string;
|
|
30
|
+
}) => (target: object, propertyKey: string | symbol, _descriptor: TypedPropertyDescriptor<any>) => void;
|
|
25
31
|
/** Public helper for the scanner. */
|
|
26
32
|
export type AnyField = ResolverClassRecord["fields"][number];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalise a raw type string to its GraphQL scalar name.
|
|
3
|
+
*
|
|
4
|
+
* - Known TypeScript aliases are converted: `string` → `String`, etc.
|
|
5
|
+
* - Unknown types (user-defined object types) are returned unchanged.
|
|
6
|
+
* - Non-null (`!`) suffixes and list (`[...]`) wrappers are preserved.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* normalizeGQLType("string") // "String"
|
|
10
|
+
* normalizeGQLType("string!") // "String!"
|
|
11
|
+
* normalizeGQLType("[int!]!") // "[Int!]!"
|
|
12
|
+
* normalizeGQLType("String!") // "String!" (already canonical — unchanged)
|
|
13
|
+
* normalizeGQLType("User") // "User" (user-defined type — unchanged)
|
|
14
|
+
*/
|
|
15
|
+
export declare function normalizeGQLType(raw: string): string;
|
|
@@ -52,6 +52,16 @@ export declare class GraphQLService {
|
|
|
52
52
|
*/
|
|
53
53
|
addResolvers(map: ResolverMap): void;
|
|
54
54
|
private _buildSchema;
|
|
55
|
+
/**
|
|
56
|
+
* Instantiate each registered `@Resolver` class and map its `@Query` /
|
|
57
|
+
* `@Mutation` / `@Subscription` methods into a `ResolverMap`.
|
|
58
|
+
*
|
|
59
|
+
* For methods decorated with `@Arg`, positional arguments are extracted
|
|
60
|
+
* from the graphql-js `args` object by name and forwarded positionally.
|
|
61
|
+
* For methods without `@Arg`, the standard graphql-js 4-tuple
|
|
62
|
+
* `(parent, args, ctx, info)` is passed through unchanged.
|
|
63
|
+
*/
|
|
64
|
+
private _autoWireResolvers;
|
|
55
65
|
/**
|
|
56
66
|
* Build (or rebuild) the underlying GraphQL schema. Idempotent.
|
|
57
67
|
* Returns the `graphql` schema instance.
|
|
@@ -74,11 +84,15 @@ export declare class GraphQLService {
|
|
|
74
84
|
getSchemaSDL(): string;
|
|
75
85
|
private normaliseTypeDefs;
|
|
76
86
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
87
|
+
* Synthesise SDL snippets from `@Resolver` / `@Query` / `@Mutation` /
|
|
88
|
+
* `@Subscription` decorator metadata and merge them with any
|
|
89
|
+
* user-supplied `typeDefs`.
|
|
90
|
+
*
|
|
91
|
+
* - If the user's SDL already defines `type Query`, decorator-added
|
|
92
|
+
* fields are appended with `extend type Query { ... }` to avoid
|
|
93
|
+
* duplicate-type errors.
|
|
94
|
+
* - Unknown return types or argument types are passed through as-is
|
|
95
|
+
* (they are treated as user-defined object types).
|
|
82
96
|
*/
|
|
83
97
|
private mergeSDLWithDecorators;
|
|
84
98
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
export * from "./types.js";
|
|
5
5
|
export { GraphQLService, loadGraphQLJs } from "./graphql.service.js";
|
|
6
6
|
export { GraphQLModule } from "./graphql.module.js";
|
|
7
|
-
export { Resolver, Query, Mutation, Subscription, Arg, isResolverClass, getResolverTypeName, getResolverFields, getRegisteredResolvers, clearResolverRegistry, getMethodArgs, } from "./decorators/index.js";
|
|
7
|
+
export { Resolver, Query, Mutation, Subscription, Arg, isResolverClass, getResolverTypeName, getResolverFields, getRegisteredResolvers, clearResolverRegistry, getMethodArgs, normalizeGQLType, } from "./decorators/index.js";
|
package/dist/index.js
CHANGED
|
@@ -28,6 +28,113 @@ var __legacyDecorateClassTS = function(decorators, target, key, desc) {
|
|
|
28
28
|
var __require = import.meta.require;
|
|
29
29
|
// packages/graphql/src/graphql.service.ts
|
|
30
30
|
import"reflect-metadata";
|
|
31
|
+
|
|
32
|
+
// packages/graphql/src/decorators/resolver.ts
|
|
33
|
+
import"reflect-metadata";
|
|
34
|
+
var RESOLVER_KEY = Symbol.for("nexus:GraphQL:Resolver");
|
|
35
|
+
var FIELDS_KEY = Symbol.for("nexus:GraphQL:Fields");
|
|
36
|
+
var TYPENAME_KEY = Symbol.for("nexus:GraphQL:TypeName");
|
|
37
|
+
var _resolverRegistry = new Set;
|
|
38
|
+
function Resolver(typeName) {
|
|
39
|
+
return (target) => {
|
|
40
|
+
const ctor = target;
|
|
41
|
+
const inferred = typeName ?? ctor.name.replace(/Resolver$/, "");
|
|
42
|
+
Reflect.defineMetadata(RESOLVER_KEY, true, ctor);
|
|
43
|
+
Reflect.defineMetadata(TYPENAME_KEY, inferred, ctor);
|
|
44
|
+
if (!Reflect.hasMetadata(FIELDS_KEY, ctor)) {
|
|
45
|
+
Reflect.defineMetadata(FIELDS_KEY, [], ctor);
|
|
46
|
+
}
|
|
47
|
+
_resolverRegistry.add(ctor);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function getRegisteredResolvers() {
|
|
51
|
+
return [..._resolverRegistry];
|
|
52
|
+
}
|
|
53
|
+
function clearResolverRegistry() {
|
|
54
|
+
_resolverRegistry.clear();
|
|
55
|
+
}
|
|
56
|
+
function getResolverTypeName(target) {
|
|
57
|
+
const t = target.prototype ?? target;
|
|
58
|
+
const fromMeta = Reflect.getMetadata(TYPENAME_KEY, t);
|
|
59
|
+
if (fromMeta)
|
|
60
|
+
return fromMeta;
|
|
61
|
+
const ctor = t.constructor;
|
|
62
|
+
return ctor?.name.replace(/Resolver$/, "");
|
|
63
|
+
}
|
|
64
|
+
function pushResolverField(target, field) {
|
|
65
|
+
const t = target.prototype ?? target;
|
|
66
|
+
const list = Reflect.getMetadata(FIELDS_KEY, t) ?? [];
|
|
67
|
+
list.push(field);
|
|
68
|
+
Reflect.defineMetadata(FIELDS_KEY, list, t);
|
|
69
|
+
}
|
|
70
|
+
function getResolverFields(target) {
|
|
71
|
+
const t = target.prototype ?? target;
|
|
72
|
+
return Reflect.getMetadata(FIELDS_KEY, t) ?? [];
|
|
73
|
+
}
|
|
74
|
+
function isResolverClass(target) {
|
|
75
|
+
const t = target.prototype ?? target;
|
|
76
|
+
return Reflect.getMetadata(RESOLVER_KEY, t) === true;
|
|
77
|
+
}
|
|
78
|
+
// packages/graphql/src/decorators/query.ts
|
|
79
|
+
import"reflect-metadata";
|
|
80
|
+
|
|
81
|
+
// packages/graphql/src/decorators/arg.ts
|
|
82
|
+
import"reflect-metadata";
|
|
83
|
+
var ARGS_KEY = Symbol.for("nexus:GraphQL:MethodArgs");
|
|
84
|
+
function Arg(name, type = "String") {
|
|
85
|
+
return (target, propertyKey, parameterIndex) => {
|
|
86
|
+
if (propertyKey === undefined) {
|
|
87
|
+
throw new Error("@Arg() can only decorate method parameters, not constructor parameters.");
|
|
88
|
+
}
|
|
89
|
+
const list = Reflect.getMetadata(ARGS_KEY, target, propertyKey) ?? [];
|
|
90
|
+
list.push({ name, type, index: parameterIndex });
|
|
91
|
+
Reflect.defineMetadata(ARGS_KEY, list, target, propertyKey);
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function getMethodArgs(target, propertyKey) {
|
|
95
|
+
return Reflect.getMetadata(ARGS_KEY, target, propertyKey) ?? [];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// packages/graphql/src/decorators/query.ts
|
|
99
|
+
function makeOperationDecorator(kind) {
|
|
100
|
+
return function(name, opts) {
|
|
101
|
+
return (target, propertyKey, _descriptor) => {
|
|
102
|
+
const argsMeta = getMethodArgs(target, propertyKey);
|
|
103
|
+
pushResolverField(target, {
|
|
104
|
+
propertyKey: String(propertyKey),
|
|
105
|
+
kind,
|
|
106
|
+
name: name ?? String(propertyKey),
|
|
107
|
+
returnTypeName: opts?.returns ?? "JSON",
|
|
108
|
+
args: argsMeta.sort((a, b) => a.index - b.index).map((a) => ({ name: a.name, type: a.type }))
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
var Query = makeOperationDecorator("query");
|
|
114
|
+
var Mutation = makeOperationDecorator("mutation");
|
|
115
|
+
var Subscription = makeOperationDecorator("subscription");
|
|
116
|
+
// packages/graphql/src/decorators/type-mapper.ts
|
|
117
|
+
var TS_TO_GQL = {
|
|
118
|
+
string: "String",
|
|
119
|
+
number: "Float",
|
|
120
|
+
int: "Int",
|
|
121
|
+
float: "Float",
|
|
122
|
+
boolean: "Boolean",
|
|
123
|
+
bool: "Boolean",
|
|
124
|
+
id: "ID"
|
|
125
|
+
};
|
|
126
|
+
function normalizeGQLType(raw) {
|
|
127
|
+
const nonNull = raw.endsWith("!");
|
|
128
|
+
const base = nonNull ? raw.slice(0, -1) : raw;
|
|
129
|
+
const trimmed = base.trim();
|
|
130
|
+
if (trimmed.startsWith("[") && trimmed.endsWith("]")) {
|
|
131
|
+
const inner = trimmed.slice(1, -1);
|
|
132
|
+
return `[${normalizeGQLType(inner)}]${nonNull ? "!" : ""}`;
|
|
133
|
+
}
|
|
134
|
+
const mapped = TS_TO_GQL[trimmed.toLowerCase()];
|
|
135
|
+
return (mapped ?? trimmed) + (nonNull ? "!" : "");
|
|
136
|
+
}
|
|
137
|
+
// packages/graphql/src/graphql.service.ts
|
|
31
138
|
var _graphql = null;
|
|
32
139
|
var _loadAttempted = false;
|
|
33
140
|
async function loadGraphQLJs() {
|
|
@@ -73,10 +180,42 @@ class GraphQLService {
|
|
|
73
180
|
const g = await loadGraphQLJs();
|
|
74
181
|
const merged = this.mergeSDLWithDecorators(sdl);
|
|
75
182
|
const schema = g.buildSchema(merged);
|
|
76
|
-
const
|
|
183
|
+
const autoWired = this.config.autoSchema ? this._autoWireResolvers() : {};
|
|
184
|
+
const final = mergeResolverMaps(autoWired, this._resolvers, this.config.resolvers ?? {});
|
|
77
185
|
wrapSchemaWithResolvers(schema, final);
|
|
78
186
|
return schema;
|
|
79
187
|
}
|
|
188
|
+
_autoWireResolvers() {
|
|
189
|
+
const map = {};
|
|
190
|
+
for (const resolverClass of getRegisteredResolvers()) {
|
|
191
|
+
const fields = getResolverFields(resolverClass);
|
|
192
|
+
const instance = new resolverClass;
|
|
193
|
+
for (const f of fields) {
|
|
194
|
+
let typeName;
|
|
195
|
+
if (f.kind === "query")
|
|
196
|
+
typeName = "Query";
|
|
197
|
+
else if (f.kind === "mutation")
|
|
198
|
+
typeName = "Mutation";
|
|
199
|
+
else
|
|
200
|
+
typeName = "Subscription";
|
|
201
|
+
if (!map[typeName])
|
|
202
|
+
map[typeName] = {};
|
|
203
|
+
const method = instance[f.propertyKey];
|
|
204
|
+
if (typeof method !== "function")
|
|
205
|
+
continue;
|
|
206
|
+
const argNames = f.args.map((a) => a.name);
|
|
207
|
+
if (argNames.length === 0) {
|
|
208
|
+
map[typeName][f.name] = (parent, args, ctx, info) => method.call(instance, parent, args, ctx, info);
|
|
209
|
+
} else {
|
|
210
|
+
map[typeName][f.name] = (_parent, args) => {
|
|
211
|
+
const positional = argNames.map((n) => args[n]);
|
|
212
|
+
return method.call(instance, ...positional);
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return map;
|
|
218
|
+
}
|
|
80
219
|
async ensureSchema() {
|
|
81
220
|
if (this._schema)
|
|
82
221
|
return this._schema;
|
|
@@ -84,8 +223,10 @@ class GraphQLService {
|
|
|
84
223
|
return this._bootstrapPromise.then(() => this._schema);
|
|
85
224
|
this._bootstrapPromise = (async () => {
|
|
86
225
|
const sdl = this.normaliseTypeDefs(this.config.typeDefs);
|
|
87
|
-
|
|
88
|
-
|
|
226
|
+
const autoSchema = this.config.autoSchema ?? false;
|
|
227
|
+
const hasResolvers = getRegisteredResolvers().length > 0;
|
|
228
|
+
if (sdl.length === 0 && !autoSchema && !hasResolvers) {
|
|
229
|
+
throw new Error("[nexusjs/graphql] No typeDefs configured. Pass `typeDefs: '...'` to GraphQLModule.forRoot(), or set `autoSchema: true` and use `@Resolver` + `@Query` / `@Mutation` decorators.");
|
|
89
230
|
}
|
|
90
231
|
this._schema = await this._buildSchema(sdl);
|
|
91
232
|
})();
|
|
@@ -137,10 +278,63 @@ class GraphQLService {
|
|
|
137
278
|
return Array.isArray(td) ? td : [td];
|
|
138
279
|
}
|
|
139
280
|
mergeSDLWithDecorators(sdl) {
|
|
140
|
-
|
|
281
|
+
const registered = getRegisteredResolvers();
|
|
282
|
+
if (registered.length === 0)
|
|
283
|
+
return sdl.join(`
|
|
284
|
+
`);
|
|
285
|
+
const queryFields = [];
|
|
286
|
+
const mutationFields = [];
|
|
287
|
+
const subscriptionFields = [];
|
|
288
|
+
for (const resolverClass of registered) {
|
|
289
|
+
const fields = getResolverFields(resolverClass);
|
|
290
|
+
for (const f of fields) {
|
|
291
|
+
const argStr = f.args.length > 0 ? `(${f.args.map((a) => `${a.name}: ${normalizeGQLType(a.type)}`).join(", ")})` : "";
|
|
292
|
+
const line = ` ${f.name}${argStr}: ${normalizeGQLType(f.returnTypeName)}`;
|
|
293
|
+
if (f.kind === "query")
|
|
294
|
+
queryFields.push(line);
|
|
295
|
+
else if (f.kind === "mutation")
|
|
296
|
+
mutationFields.push(line);
|
|
297
|
+
else if (f.kind === "subscription")
|
|
298
|
+
subscriptionFields.push(line);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
const userSDL = sdl.join(`
|
|
302
|
+
`);
|
|
303
|
+
const generated = [];
|
|
304
|
+
if (queryFields.length > 0) {
|
|
305
|
+
const keyword = /type\s+Query\s*\{/.test(userSDL) ? "extend type" : "type";
|
|
306
|
+
generated.push(`${keyword} Query {
|
|
307
|
+
${queryFields.join(`
|
|
308
|
+
`)}
|
|
309
|
+
}`);
|
|
310
|
+
}
|
|
311
|
+
if (mutationFields.length > 0) {
|
|
312
|
+
const keyword = /type\s+Mutation\s*\{/.test(userSDL) ? "extend type" : "type";
|
|
313
|
+
generated.push(`${keyword} Mutation {
|
|
314
|
+
${mutationFields.join(`
|
|
315
|
+
`)}
|
|
316
|
+
}`);
|
|
317
|
+
}
|
|
318
|
+
if (subscriptionFields.length > 0) {
|
|
319
|
+
const keyword = /type\s+Subscription\s*\{/.test(userSDL) ? "extend type" : "type";
|
|
320
|
+
generated.push(`${keyword} Subscription {
|
|
321
|
+
${subscriptionFields.join(`
|
|
322
|
+
`)}
|
|
323
|
+
}`);
|
|
324
|
+
}
|
|
325
|
+
return [userSDL, ...generated].filter(Boolean).join(`
|
|
141
326
|
`);
|
|
142
327
|
}
|
|
143
328
|
}
|
|
329
|
+
function mergeResolverMaps(...maps) {
|
|
330
|
+
const result = {};
|
|
331
|
+
for (const map of maps) {
|
|
332
|
+
for (const [typeName, fields] of Object.entries(map)) {
|
|
333
|
+
result[typeName] = { ...result[typeName], ...fields };
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
return result;
|
|
337
|
+
}
|
|
144
338
|
function wrapSchemaWithResolvers(schema, resolvers) {
|
|
145
339
|
const typeMap = schema.getTypeMap?.() ?? {};
|
|
146
340
|
for (const [typeName, fields] of Object.entries(resolvers)) {
|
|
@@ -327,95 +521,8 @@ function graphiqlHtml(opts) {
|
|
|
327
521
|
</body>
|
|
328
522
|
</html>`;
|
|
329
523
|
}
|
|
330
|
-
// packages/graphql/src/decorators/resolver.ts
|
|
331
|
-
import"reflect-metadata";
|
|
332
|
-
var RESOLVER_KEY = Symbol.for("nexus:GraphQL:Resolver");
|
|
333
|
-
var FIELDS_KEY = Symbol.for("nexus:GraphQL:Fields");
|
|
334
|
-
var TYPENAME_KEY = Symbol.for("nexus:GraphQL:TypeName");
|
|
335
|
-
var _resolverRegistry = new Set;
|
|
336
|
-
function Resolver(typeName) {
|
|
337
|
-
return (target) => {
|
|
338
|
-
const ctor = target;
|
|
339
|
-
const inferred = typeName ?? ctor.name.replace(/Resolver$/, "");
|
|
340
|
-
Reflect.defineMetadata(RESOLVER_KEY, true, ctor);
|
|
341
|
-
Reflect.defineMetadata(TYPENAME_KEY, inferred, ctor);
|
|
342
|
-
if (!Reflect.hasMetadata(FIELDS_KEY, ctor)) {
|
|
343
|
-
Reflect.defineMetadata(FIELDS_KEY, [], ctor);
|
|
344
|
-
}
|
|
345
|
-
_resolverRegistry.add(ctor);
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
function getRegisteredResolvers() {
|
|
349
|
-
return [..._resolverRegistry];
|
|
350
|
-
}
|
|
351
|
-
function clearResolverRegistry() {
|
|
352
|
-
_resolverRegistry.clear();
|
|
353
|
-
}
|
|
354
|
-
function getResolverTypeName(target) {
|
|
355
|
-
const t = target.prototype ?? target;
|
|
356
|
-
const fromMeta = Reflect.getMetadata(TYPENAME_KEY, t);
|
|
357
|
-
if (fromMeta)
|
|
358
|
-
return fromMeta;
|
|
359
|
-
const ctor = t.constructor;
|
|
360
|
-
return ctor?.name.replace(/Resolver$/, "");
|
|
361
|
-
}
|
|
362
|
-
function pushResolverField(target, field) {
|
|
363
|
-
const t = target.prototype ?? target;
|
|
364
|
-
const list = Reflect.getMetadata(FIELDS_KEY, t) ?? [];
|
|
365
|
-
list.push(field);
|
|
366
|
-
Reflect.defineMetadata(FIELDS_KEY, list, t);
|
|
367
|
-
}
|
|
368
|
-
function getResolverFields(target) {
|
|
369
|
-
const t = target.prototype ?? target;
|
|
370
|
-
return Reflect.getMetadata(FIELDS_KEY, t) ?? [];
|
|
371
|
-
}
|
|
372
|
-
function isResolverClass(target) {
|
|
373
|
-
const t = target.prototype ?? target;
|
|
374
|
-
return Reflect.getMetadata(RESOLVER_KEY, t) === true;
|
|
375
|
-
}
|
|
376
|
-
// packages/graphql/src/decorators/query.ts
|
|
377
|
-
import"reflect-metadata";
|
|
378
|
-
function makeOperationDecorator(kind) {
|
|
379
|
-
return function(name) {
|
|
380
|
-
return (target, propertyKey, descriptor) => {
|
|
381
|
-
const meta = parseMethodType(descriptor.value);
|
|
382
|
-
pushResolverField(target, {
|
|
383
|
-
propertyKey: String(propertyKey),
|
|
384
|
-
kind,
|
|
385
|
-
name: name ?? String(propertyKey),
|
|
386
|
-
returnTypeName: meta.returnTypeName,
|
|
387
|
-
args: meta.args
|
|
388
|
-
});
|
|
389
|
-
};
|
|
390
|
-
};
|
|
391
|
-
}
|
|
392
|
-
function parseMethodType(fn) {
|
|
393
|
-
const fnName = fn.name || "unknown";
|
|
394
|
-
return {
|
|
395
|
-
returnTypeName: "JSON",
|
|
396
|
-
args: []
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
var Query = makeOperationDecorator("query");
|
|
400
|
-
var Mutation = makeOperationDecorator("mutation");
|
|
401
|
-
var Subscription = makeOperationDecorator("subscription");
|
|
402
|
-
// packages/graphql/src/decorators/arg.ts
|
|
403
|
-
import"reflect-metadata";
|
|
404
|
-
var ARGS_KEY = Symbol.for("nexus:GraphQL:MethodArgs");
|
|
405
|
-
function Arg(name, type = "String") {
|
|
406
|
-
return (target, propertyKey, parameterIndex) => {
|
|
407
|
-
if (propertyKey === undefined) {
|
|
408
|
-
throw new Error("@Arg() can only decorate method parameters, not constructor parameters.");
|
|
409
|
-
}
|
|
410
|
-
const list = Reflect.getMetadata(ARGS_KEY, target, propertyKey) ?? [];
|
|
411
|
-
list.push({ name, type, index: parameterIndex });
|
|
412
|
-
Reflect.defineMetadata(ARGS_KEY, list, target, propertyKey);
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
function getMethodArgs(target, propertyKey) {
|
|
416
|
-
return Reflect.getMetadata(ARGS_KEY, target, propertyKey) ?? [];
|
|
417
|
-
}
|
|
418
524
|
export {
|
|
525
|
+
normalizeGQLType,
|
|
419
526
|
loadGraphQLJs,
|
|
420
527
|
isResolverClass,
|
|
421
528
|
getResolverTypeName,
|
|
@@ -432,5 +539,5 @@ export {
|
|
|
432
539
|
Arg
|
|
433
540
|
};
|
|
434
541
|
|
|
435
|
-
//# debugId=
|
|
542
|
+
//# debugId=CEE0044850E830D864756E2164756E21
|
|
436
543
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/graphql.service.ts", "../src/
|
|
3
|
+
"sources": ["../src/graphql.service.ts", "../src/decorators/resolver.ts", "../src/decorators/query.ts", "../src/decorators/arg.ts", "../src/decorators/type-mapper.ts", "../src/graphql.module.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/**\n * `GraphQLService` — owns the parsed schema, resolver map, and an\n * end-to-end executor.\n *\n * Most users won't instantiate this directly — they use\n * `GraphQLModule.forRoot({ typeDefs, resolvers, ... })` which puts\n * a singleton service into the DI container. The service is also\n * exported for advanced users (programmatic queries, schema\n * introspection, custom executors).\n *\n * The actual `parse` / `validate` / `execute` calls go to\n * `graphql` (a peer-dep). If the user hasn't installed it, we\n * throw a clear error from the first attempt.\n */\nimport \"reflect-metadata\";\nimport type {\n\tGraphQLConfig,\n\tGraphQLContext,\n\tGraphQLExecutionResult,\n\tFieldResolver,\n\tResolverMap,\n} from \"./types.js\";\n\ninterface GraphQLJs {\n\tparse: (s: string) => unknown;\n\tbuildSchema: (sdl: string) => unknown;\n\tvalidate: (schema: unknown, doc: unknown, rules?: unknown) => unknown[];\n\t// graphql 16 takes positional args; graphql 17 takes a single\n\t// object. We always call it with the 16-style positional args\n\t// (so we wrap a `buildSchema` schema, not the resolver-builder\n\t// schema), but the type reflects both possibilities.\n\texecute: (...args: any[]) => Promise<GraphQLExecutionResult> | GraphQLExecutionResult;\n\tspecifiedRules?: unknown;\n\tgetOperationAST?: (doc: unknown, operationName?: string) => unknown;\n\tGraphQLSchema: unknown;\n\tGraphQLObjectType: unknown;\n\tGraphQLString: unknown;\n\tGraphQLNonNull: unknown;\n\tGraphQLList: unknown;\n\tGraphQLInt: unknown;\n\tGraphQLFloat: unknown;\n\tGraphQLBoolean: unknown;\n\tGraphQLID: unknown;\n\tGraphQLError: unknown;\n\tGraphQLScalarType: unknown;\n\tparseType: (s: string) => unknown;\n\tGraphQLSchemaConfig: unknown;\n}\n\nlet _graphql: GraphQLJs | null = null;\nlet _loadAttempted = false;\n\n/** Lazy-load the `graphql` package. Throws a clear error if missing. */\nexport async function loadGraphQLJs(): Promise<GraphQLJs> {\n\tif (_graphql) return _graphql;\n\tif (_loadAttempted) {\n\t\tthrow new Error(\n\t\t\t\"[nexusjs/graphql] The optional `graphql` package failed to load. \" +\n\t\t\t\t\"Install it with `bun add graphql` to use the GraphQL module.\",\n\t\t);\n\t}\n\t_loadAttempted = true;\n\ttry {\n\t\tconst mod = (await import(\"graphql\")) as unknown as GraphQLJs;\n\t\t_graphql = mod;\n\t\treturn mod;\n\t} catch (err) {\n\t\tthrow new Error(\n\t\t\t\"[nexusjs/graphql] The `graphql` package is required for execution. \" +\n\t\t\t\t\"Install it with `bun add graphql`. \" +\n\t\t\t\t\"Original error: \" + (err as Error).message,\n\t\t);\n\t}\n}\n\nexport class GraphQLService {\n\t/** The raw config the module was booted with. */\n\treadonly config: GraphQLConfig;\n\t/** Optional DI handle. */\n\tstatic readonly TOKEN = Symbol.for(\"nexus:GraphQL\");\n\n\tconstructor(config: GraphQLConfig = {}) {\n\t\tthis.config = {\n\t\t\tplayground: \"graphiql\",\n\t\t\tendpoint: { path: \"/graphql\", enableGet: true },\n\t\t\texposeSchemaSDL: true,\n\t\t\tintrospection: true,\n\t\t\t...config,\n\t\t};\n\t}\n\n\tprivate _schema: any = null;\n\tprivate _resolvers: ResolverMap = {};\n\tprivate _bootstrapPromise: Promise<void> | null = null;\n\n\t/**\n\t * Register a resolver map (or add to the existing one). Safe to\n\t * call multiple times — the maps are merged.\n\t */\n\taddResolvers(map: ResolverMap): void {\n\t\tfor (const [typeName, fields] of Object.entries(map)) {\n\t\t\tthis._resolvers[typeName] = {\n\t\t\t\t...this._resolvers[typeName],\n\t\t\t\t...fields,\n\t\t\t};\n\t\t}\n\t}\n\n\tprivate async _buildSchema(sdl: string[]): Promise<any> {\n\t\tconst g = await loadGraphQLJs();\n\t\tconst merged = this.mergeSDLWithDecorators(sdl);\n\t\t// graphql-js's `buildSchema` produces a `GraphQLSchema` whose\n\t\t// fields' `resolve` is `undefined` by default — graphql-js's\n\t\t// execution layer looks up fields on the parent object in\n\t\t// that case. To wire our `ResolverMap`, we set each field's\n\t\t// `resolve` directly. This works for graphql 16 and 17.\n\t\tconst schema = (g.buildSchema as Function)(merged);\n\t\tconst final: ResolverMap = { ...this._resolvers, ...this.config.resolvers };\n\t\twrapSchemaWithResolvers(schema, final);\n\t\treturn schema;\n\t}\n\n\t/**\n\t * Build (or rebuild) the underlying GraphQL schema. Idempotent.\n\t * Returns the `graphql` schema instance.\n\t */\n\tasync ensureSchema(): Promise<any> {\n\t\tif (this._schema) return this._schema;\n\t\tif (this._bootstrapPromise) return this._bootstrapPromise.then(() => this._schema);\n\t\tthis._bootstrapPromise = (async () => {\n\t\t\tconst sdl = this.normaliseTypeDefs(this.config.typeDefs);\n\t\t\tif (sdl.length === 0) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"[nexusjs/graphql] No typeDefs configured. \" +\n\t\t\t\t\t\t\"Pass `typeDefs: '...' to GraphQLModule.forRoot()` or \" +\n\t\t\t\t\t\t\"use `@Resolver` + `@Query` / `@Mutation` decorators.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tthis._schema = await this._buildSchema(sdl);\n\t\t})();\n\t\tawait this._bootstrapPromise;\n\t\treturn this._schema;\n\t}\n\n\t/**\n\t * Validate + execute a GraphQL document. Returns the raw\n\t * `execute()` result envelope (data, errors, extensions).\n\t */\n\tasync execute(\n\t\tsource: string,\n\t\tvariableValues: Record<string, unknown> = {},\n\t\toperationName?: string,\n\t\tcontextValue?: GraphQLContext,\n\t): Promise<GraphQLExecutionResult> {\n\t\tconst g = await loadGraphQLJs();\n\t\tconst schema = await this.ensureSchema();\n\t\tconst document = (g.parse as Function)(source);\n\t\tconst errors = (g.validate as Function)(schema, document, g.specifiedRules) as unknown[];\n\t\tif (errors.length > 0) {\n\t\t\treturn {\n\t\t\t\terrors: (errors as any[]).map((e: any) => ({\n\t\t\t\t\tmessage: e.message,\n\t\t\t\t\tlocations: e.locations,\n\t\t\t\t})),\n\t\t\t};\n\t\t}\n\t\t// If the user didn't pass a context and the service has a\n\t\t// `context()` factory, build a synthetic context (with a\n\t\t// stub Hono ctx) so resolvers that depend on `ctx.state` work\n\t\t// in `execute()` calls outside of an HTTP request.\n\t\tlet ctx = contextValue;\n\t\tif (!ctx && this.config.context) {\n\t\t\tconst fakeHono = { req: { url: \"\", method: \"EXECUTE\", header: () => \"\" } };\n\t\t\tctx = {\n\t\t\t\thono: fakeHono as any,\n\t\t\t\tstate: await this.config.context(fakeHono as any),\n\t\t\t};\n\t\t}\n\t\tconst rootValue = undefined;\n\t\treturn await (g.execute as any)({\n\t\t\tschema,\n\t\t\tdocument,\n\t\t\trootValue,\n\t\t\tcontextValue: ctx,\n\t\t\tvariableValues,\n\t\t\toperationName,\n\t\t});\n\t}\n\n\t/**\n\t * Produce a `GraphQLContext` from an inbound Hono request.\n\t * Calls the user's `context()` factory if provided.\n\t */\n\tasync buildContext(c: any): Promise<GraphQLContext> {\n\t\tconst state = this.config.context\n\t\t\t? await this.config.context(c)\n\t\t\t: {};\n\t\treturn { hono: c, state };\n\t}\n\n\t/**\n\t * Read the parsed SDL back as a string. Useful for the\n\t * `/graphql/schema` debug endpoint and for tests.\n\t */\n\tgetSchemaSDL(): string {\n\t\treturn this.normaliseTypeDefs(this.config.typeDefs).join(\"\\n\");\n\t}\n\n\tprivate normaliseTypeDefs(td?: string | string[]): string[] {\n\t\tif (!td) return [];\n\t\treturn Array.isArray(td) ? td : [td];\n\t}\n\n\t/**\n\t * Decorator-discovered types/methods get added to the SDL so the\n\t * schema actually has a place to put them. Each `@Resolver(\"X\")`\n\t * with `@Query()` / `@Mutation()` / `@Subscription()` methods\n\t * contributes a `type X { ... }` or `extend type Query { ... }`\n\t * snippet.\n\t */\n\tprivate mergeSDLWithDecorators(sdl: string[]): string {\n\t\t// The framework's scanner injects decorator-discovered\n\t\t// resolvers into `this._resolvers` before the schema is\n\t\t// built. To keep things simple, the schema is built from\n\t\t// the user-supplied SDL only; the resolver map is attached\n\t\t// afterwards. We still allow simple `type X { ... }` SDL\n\t\t// shapes — the scanner's job is to fill the resolvers.\n\t\t//\n\t\t// (We could synthesise SDL from the resolver metadata for a\n\t\t// pure-code-first experience, but that requires guessing\n\t\t// types. Defer to v2.)\n\t\treturn sdl.join(\"\\n\");\n\t}\n}\n\n/**\n * Wrap a parsed schema with the user's resolver map. graphql-js's\n * `buildSchema` produces a schema with default resolvers (which look\n * up fields on the `rootValue`). For our use case, we want field-level\n * resolvers that pull from the registered `ResolverMap`.\n */\nfunction wrapSchemaWithResolvers(schema: any, resolvers: ResolverMap): any {\n\t// graphql-js schemas are immutable. We replace the resolver map\n\t// via a tiny proxy: when a field is queried, graphql-js's default\n\t// resolver calls our `defaultFieldResolver` (which simply looks\n\t// up the value in the parent). To wire our resolvers, we set\n\t// each field's `resolve` to the entry from the resolver map.\n\tconst typeMap = schema.getTypeMap?.() ?? {};\n\tfor (const [typeName, fields] of Object.entries(resolvers)) {\n\t\tconst type = typeMap[typeName];\n\t\tif (!type || typeof type.getFields !== \"function\") continue;\n\t\tconst fieldMap = type.getFields();\n\t\tfor (const [fieldName, resolver] of Object.entries(fields)) {\n\t\t\tconst field = fieldMap[fieldName];\n\t\t\tif (!field) continue;\n\t\t\tconst fn: FieldResolver =\n\t\t\t\ttypeof resolver === \"function\"\n\t\t\t\t\t? (resolver as FieldResolver)\n\t\t\t\t\t: ((resolver as { resolve: FieldResolver }).resolve as FieldResolver);\n\t\t\tfield.resolve = function (parent: any, args: any, ctx: any, info: any) {\n\t\t\t\treturn fn(parent, args, ctx, info);\n\t\t\t};\n\t\t}\n\t}\n\treturn schema;\n}\n",
|
|
6
|
-
"/**\n * `GraphQLModule` — drop-in GraphQL endpoint.\n *\n * @Module({\n * imports: [\n * GraphQLModule.forRoot({\n * typeDefs: `\n * type Query { hello: String! }\n * `,\n * resolvers: {\n * Query: {\n * hello: () => \"world\",\n * },\n * },\n * }),\n * ],\n * })\n * export class AppModule {}\n *\n * After boot, the framework exposes:\n *\n * POST /graphql — queries + mutations\n * GET /graphql — GraphiQL UI (or a query, if `?query=...` is set)\n * GET /graphql/schema — the schema as SDL (debug)\n *\n * Resolvers can also be declared via the `@Resolver` + `@Query` /\n * `@Mutation` / `@Subscription` decorators — see the user guide.\n */\nimport \"reflect-metadata\";\nimport type { Context } from \"hono\";\nimport { Module } from \"@nexusts/core\";\nimport { GraphQLService } from \"./graphql.service.js\";\nimport type { GraphQLConfig } from \"./types.js\";\n\n@Module({\n\tproviders: [\n\t\tGraphQLService,\n\t\t{ provide: GraphQLService.TOKEN, useExisting: GraphQLService },\n\t],\n\texports: [GraphQLService, GraphQLService.TOKEN],\n})\nexport class GraphQLModule {\n\tstatic forRoot(config: GraphQLConfig) {\n\t\tconst factory = () => new GraphQLService(config);\n\t\t@Module({\n\t\t\tproviders: [\n\t\t\t\t{\n\t\t\t\t\tprovide: GraphQLService.TOKEN,\n\t\t\t\t\tuseFactory: factory,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tprovide: GraphQLService,\n\t\t\t\t\tuseFactory: factory,\n\t\t\t\t},\n\t\t\t\t{ provide: \"GRAPHQL_CONFIG\", useValue: config },\n\t\t\t],\n\t\t\texports: [GraphQLService, GraphQLService.TOKEN],\n\t\t})\n\t\tclass ConfiguredGraphQLModule {}\n\t\tObject.defineProperty(ConfiguredGraphQLModule, \"name\", {\n\t\t\tvalue: \"ConfiguredGraphQLModule\",\n\t\t});\n\t\treturn ConfiguredGraphQLModule;\n\t}\n\n\t/**\n\t * Manually mount the GraphQL endpoint onto a Hono-compatible app.\n\t * Used by `main.ts` setups that don't go through `@Module`.\n\t */\n\tstatic async mount(\n\t\tapp: {\n\t\t\tpost: (path: string, ...h: any[]) => any;\n\t\t\tget: (path: string, ...h: any[]) => any;\n\t\t\tuse: (path: string, ...h: any[]) => any;\n\t\t},\n\t\tsvc: GraphQLService,\n\t): Promise<void> {\n\t\tconst path = svc.config.endpoint?.path ?? \"/graphql\";\n\t\tconst enableGet = svc.config.endpoint?.enableGet ?? true;\n\t\tconst exposeSDL = svc.config.exposeSchemaSDL ?? true;\n\t\tconst playground = svc.config.playground ?? \"graphiql\";\n\n\t\t// POST /graphql — queries + mutations.\n\t\tapp.post(path, async (c: Context) => {\n\t\t\tconst body = await readRequestBody(c);\n\t\t\tconst ctx = await svc.buildContext(c);\n\t\t\tconst result = await svc.execute(\n\t\t\t\tbody.query,\n\t\t\t\tparseJSONField(body.variables) ?? {},\n\t\t\t\tbody.operationName || undefined,\n\t\t\t\tctx,\n\t\t\t);\n\t\t\treturn c.json(result, statusFor(result) as any);\n\t\t});\n\n\t\t// GET /graphql — playground / pre-baked query (?query=...&variables=...).\n\t\tif (enableGet) {\n\t\t\tapp.get(path, async (c: Context) => {\n\t\t\t\tconst query = c.req.query(\"query\");\n\t\t\t\tif (!query) {\n\t\t\t\t\tif (playground === \"none\") {\n\t\t\t\t\t\treturn c.text(\"GraphQL endpoint. Pass ?query=... for a pre-baked query.\", 200);\n\t\t\t\t\t}\n\t\t\t\t\treturn c.html(graphiqlHtml({ endpoint: path }), 200, {\n\t\t\t\t\t\t\"Content-Type\": \"text/html; charset=utf-8\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst ctx = await svc.buildContext(c);\n\t\t\t\tconst result = await svc.execute(\n\t\t\t\t\tquery,\n\t\t\t\t\tparseJSONField(c.req.query(\"variables\") ?? \"\") ?? {},\n\t\t\t\t\tc.req.query(\"operationName\") ?? undefined,\n\t\t\t\t\tctx,\n\t\t\t\t);\n\t\t\t\treturn c.json(result, statusFor(result) as any);\n\t\t\t});\n\t\t}\n\n\t\t// GET /graphql/schema — debug: print the raw SDL.\n\t\tif (exposeSDL) {\n\t\t\tapp.get(`${path}/schema`, (c: Context) => {\n\t\t\t\treturn c.text(svc.getSchemaSDL(), 200, {\n\t\t\t\t\t\"Content-Type\": \"text/plain; charset=utf-8\",\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\t// Force schema bootstrap so the first request isn't slow.\n\t\tawait svc.ensureSchema();\n\t}\n}\n\n/** Read a GraphQL request body. Accepts JSON or form-urlencoded. */\nasync function readRequestBody(\n\tc: Context,\n): Promise<{ query: string; variables: string; operationName: string }> {\n\tconst ct = c.req.header(\"content-type\") ?? \"\";\n\tif (ct.includes(\"application/json\")) {\n\t\ttry {\n\t\t\tconst j = await c.req.json() as Record<string, unknown>;\n\t\t\treturn {\n\t\t\t\tquery: String(j.query ?? \"\"),\n\t\t\t\tvariables: j.variables ? JSON.stringify(j.variables) : \"\",\n\t\t\t\toperationName: j.operationName ? String(j.operationName) : \"\",\n\t\t\t};\n\t\t} catch {\n\t\t\treturn { query: \"\", variables: \"\", operationName: \"\" };\n\t\t}\n\t}\n\tif (ct.includes(\"application/x-www-form-urlencoded\")) {\n\t\tconst text = await c.req.text();\n\t\tconst params = new URLSearchParams(text);\n\t\treturn {\n\t\t\tquery: params.get(\"query\") ?? \"\",\n\t\t\tvariables: params.get(\"variables\") ?? \"\",\n\t\t\toperationName: params.get(\"operationName\") ?? \"\",\n\t\t};\n\t}\n\t// Default: assume form-urlencoded.\n\tconst text = await c.req.text();\n\tconst params = new URLSearchParams(text);\n\treturn {\n\t\tquery: params.get(\"query\") ?? \"\",\n\t\tvariables: params.get(\"variables\") ?? \"\",\n\t\toperationName: params.get(\"operationName\") ?? \"\",\n\t};\n}\n\nfunction parseJSONField(raw: string): Record<string, unknown> | undefined {\n\tif (!raw) return undefined;\n\ttry {\n\t\tconst parsed = JSON.parse(raw);\n\t\tif (parsed && typeof parsed === \"object\") {\n\t\t\treturn parsed as Record<string, unknown>;\n\t\t}\n\t} catch {\n\t\t/* fall through */\n\t}\n\treturn undefined;\n}\n\nfunction statusFor(result: { errors?: unknown[]; data?: unknown }): number {\n\tif (result.errors && (result.errors as unknown[]).length > 0 && !result.data) return 400;\n\treturn 200;\n}\n\n/** Minimal GraphiQL HTML — single-page, no CDN, no external assets. */\nfunction graphiqlHtml(opts: { endpoint: string }): string {\n\treturn `<!doctype html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n <title>GraphiQL</title>\n <style>\n body { font-family: system-ui, sans-serif; margin: 0; padding: 1em; }\n pre { background: #f5f5f5; padding: 0.6em; border-radius: 4px; overflow: auto; }\n .row { display: flex; gap: 1em; }\n textarea { width: 100%; min-height: 8em; font-family: ui-monospace, monospace; }\n button { padding: 0.4em 0.8em; }\n </style>\n</head>\n<body>\n <h2>GraphiQL (lightweight)</h2>\n <p>POST <code>${opts.endpoint}</code> · this is a no-deps playground built into\n <code>@nexusts/graphql</code>. For the full GraphiQL\n experience, see <code>graphiql</code> on npm.</p>\n <div class=\"row\">\n <textarea id=\"q\" placeholder=\"query { hello }\">{ hello }</textarea>\n </div>\n <p><button id=\"run\">Run</button> <span id=\"status\"></span></p>\n <pre id=\"out\"></pre>\n <script>\n const $q = document.getElementById(\"q\");\n const $out = document.getElementById(\"out\");\n const $status = document.getElementById(\"status\");\n document.getElementById(\"run\").onclick = async () => {\n $status.textContent = \"running…\";\n $out.textContent = \"\";\n const res = await fetch(${JSON.stringify(opts.endpoint)}, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ query: $q.value }),\n });\n const j = await res.json();\n $status.textContent = res.status + \" \" + res.statusText;\n $out.textContent = JSON.stringify(j, null, 2);\n };\n </script>\n</body>\n</html>`;\n}\n",
|
|
5
|
+
"/**\n * `GraphQLService` — owns the parsed schema, resolver map, and an\n * end-to-end executor.\n *\n * Most users won't instantiate this directly — they use\n * `GraphQLModule.forRoot({ typeDefs, resolvers, ... })` which puts\n * a singleton service into the DI container. The service is also\n * exported for advanced users (programmatic queries, schema\n * introspection, custom executors).\n *\n * The actual `parse` / `validate` / `execute` calls go to\n * `graphql` (a peer-dep). If the user hasn't installed it, we\n * throw a clear error from the first attempt.\n */\nimport \"reflect-metadata\";\nimport type {\n\tGraphQLConfig,\n\tGraphQLContext,\n\tGraphQLExecutionResult,\n\tFieldResolver,\n\tResolverMap,\n} from \"./types.js\";\nimport { getRegisteredResolvers, getResolverFields } from \"./decorators/index.js\";\nimport { normalizeGQLType } from \"./decorators/type-mapper.js\";\n\ninterface GraphQLJs {\n\tparse: (s: string) => unknown;\n\tbuildSchema: (sdl: string) => unknown;\n\tvalidate: (schema: unknown, doc: unknown, rules?: unknown) => unknown[];\n\t// graphql 16 takes positional args; graphql 17 takes a single\n\t// object. We always call it with the 16-style positional args\n\t// (so we wrap a `buildSchema` schema, not the resolver-builder\n\t// schema), but the type reflects both possibilities.\n\texecute: (...args: any[]) => Promise<GraphQLExecutionResult> | GraphQLExecutionResult;\n\tspecifiedRules?: unknown;\n\tgetOperationAST?: (doc: unknown, operationName?: string) => unknown;\n\tGraphQLSchema: unknown;\n\tGraphQLObjectType: unknown;\n\tGraphQLString: unknown;\n\tGraphQLNonNull: unknown;\n\tGraphQLList: unknown;\n\tGraphQLInt: unknown;\n\tGraphQLFloat: unknown;\n\tGraphQLBoolean: unknown;\n\tGraphQLID: unknown;\n\tGraphQLError: unknown;\n\tGraphQLScalarType: unknown;\n\tparseType: (s: string) => unknown;\n\tGraphQLSchemaConfig: unknown;\n}\n\nlet _graphql: GraphQLJs | null = null;\nlet _loadAttempted = false;\n\n/** Lazy-load the `graphql` package. Throws a clear error if missing. */\nexport async function loadGraphQLJs(): Promise<GraphQLJs> {\n\tif (_graphql) return _graphql;\n\tif (_loadAttempted) {\n\t\tthrow new Error(\n\t\t\t\"[nexusjs/graphql] The optional `graphql` package failed to load. \" +\n\t\t\t\t\"Install it with `bun add graphql` to use the GraphQL module.\",\n\t\t);\n\t}\n\t_loadAttempted = true;\n\ttry {\n\t\tconst mod = (await import(\"graphql\")) as unknown as GraphQLJs;\n\t\t_graphql = mod;\n\t\treturn mod;\n\t} catch (err) {\n\t\tthrow new Error(\n\t\t\t\"[nexusjs/graphql] The `graphql` package is required for execution. \" +\n\t\t\t\t\"Install it with `bun add graphql`. \" +\n\t\t\t\t\"Original error: \" + (err as Error).message,\n\t\t);\n\t}\n}\n\nexport class GraphQLService {\n\t/** The raw config the module was booted with. */\n\treadonly config: GraphQLConfig;\n\t/** Optional DI handle. */\n\tstatic readonly TOKEN = Symbol.for(\"nexus:GraphQL\");\n\n\tconstructor(config: GraphQLConfig = {}) {\n\t\tthis.config = {\n\t\t\tplayground: \"graphiql\",\n\t\t\tendpoint: { path: \"/graphql\", enableGet: true },\n\t\t\texposeSchemaSDL: true,\n\t\t\tintrospection: true,\n\t\t\t...config,\n\t\t};\n\t}\n\n\tprivate _schema: any = null;\n\tprivate _resolvers: ResolverMap = {};\n\tprivate _bootstrapPromise: Promise<void> | null = null;\n\n\t/**\n\t * Register a resolver map (or add to the existing one). Safe to\n\t * call multiple times — the maps are merged.\n\t */\n\taddResolvers(map: ResolverMap): void {\n\t\tfor (const [typeName, fields] of Object.entries(map)) {\n\t\t\tthis._resolvers[typeName] = {\n\t\t\t\t...this._resolvers[typeName],\n\t\t\t\t...fields,\n\t\t\t};\n\t\t}\n\t}\n\n\tprivate async _buildSchema(sdl: string[]): Promise<any> {\n\t\tconst g = await loadGraphQLJs();\n\t\tconst merged = this.mergeSDLWithDecorators(sdl);\n\t\t// graphql-js's `buildSchema` produces a `GraphQLSchema` whose\n\t\t// fields' `resolve` is `undefined` by default — graphql-js's\n\t\t// execution layer looks up fields on the parent object in\n\t\t// that case. To wire our `ResolverMap`, we set each field's\n\t\t// `resolve` directly. This works for graphql 16 and 17.\n\t\tconst schema = (g.buildSchema as Function)(merged);\n\t\t// Deep-merge resolver maps: auto-wired < addResolvers() < config.resolvers.\n\t\t// Shallow spread would clobber an entire type object (e.g. the Query key)\n\t\t// when two sources contribute fields to the same type.\n\t\tconst autoWired = this.config.autoSchema ? this._autoWireResolvers() : {};\n\t\tconst final = mergeResolverMaps(autoWired, this._resolvers, this.config.resolvers ?? {});\n\t\twrapSchemaWithResolvers(schema, final);\n\t\treturn schema;\n\t}\n\n\t/**\n\t * Instantiate each registered `@Resolver` class and map its `@Query` /\n\t * `@Mutation` / `@Subscription` methods into a `ResolverMap`.\n\t *\n\t * For methods decorated with `@Arg`, positional arguments are extracted\n\t * from the graphql-js `args` object by name and forwarded positionally.\n\t * For methods without `@Arg`, the standard graphql-js 4-tuple\n\t * `(parent, args, ctx, info)` is passed through unchanged.\n\t */\n\tprivate _autoWireResolvers(): ResolverMap {\n\t\tconst map: ResolverMap = {};\n\t\tfor (const resolverClass of getRegisteredResolvers()) {\n\t\t\tconst fields = getResolverFields(resolverClass);\n\t\t\tconst instance = new (resolverClass as any)();\n\t\t\tfor (const f of fields) {\n\t\t\t\tlet typeName: string;\n\t\t\t\tif (f.kind === \"query\") typeName = \"Query\";\n\t\t\t\telse if (f.kind === \"mutation\") typeName = \"Mutation\";\n\t\t\t\telse typeName = \"Subscription\";\n\n\t\t\t\tif (!map[typeName]) map[typeName] = {};\n\n\t\t\t\tconst method = (instance as any)[f.propertyKey];\n\t\t\t\tif (typeof method !== \"function\") continue;\n\n\t\t\t\tconst argNames = f.args.map((a) => a.name);\n\t\t\t\tif (argNames.length === 0) {\n\t\t\t\t\t// No @Arg — pass graphql-js 4-tuple as-is.\n\t\t\t\t\tmap[typeName][f.name] = (parent: any, args: any, ctx: any, info: any) =>\n\t\t\t\t\t\tmethod.call(instance, parent, args, ctx, info);\n\t\t\t\t} else {\n\t\t\t\t\t// @Arg present — extract each value from the args object by\n\t\t\t\t\t// name and call the method with positional parameters.\n\t\t\t\t\tmap[typeName][f.name] = (_parent: any, args: any) => {\n\t\t\t\t\t\tconst positional = argNames.map((n) => args[n]);\n\t\t\t\t\t\treturn method.call(instance, ...positional);\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn map;\n\t}\n\n\t/**\n\t * Build (or rebuild) the underlying GraphQL schema. Idempotent.\n\t * Returns the `graphql` schema instance.\n\t */\n\tasync ensureSchema(): Promise<any> {\n\t\tif (this._schema) return this._schema;\n\t\tif (this._bootstrapPromise) return this._bootstrapPromise.then(() => this._schema);\n\t\tthis._bootstrapPromise = (async () => {\n\t\t\tconst sdl = this.normaliseTypeDefs(this.config.typeDefs);\n\t\t\tconst autoSchema = this.config.autoSchema ?? false;\n\t\t\tconst hasResolvers = getRegisteredResolvers().length > 0;\n\n\t\t\tif (sdl.length === 0 && !autoSchema && !hasResolvers) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"[nexusjs/graphql] No typeDefs configured. \" +\n\t\t\t\t\t\t\"Pass `typeDefs: '...'` to GraphQLModule.forRoot(), \" +\n\t\t\t\t\t\t\"or set `autoSchema: true` and use `@Resolver` + `@Query` / `@Mutation` decorators.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tthis._schema = await this._buildSchema(sdl);\n\t\t})();\n\t\tawait this._bootstrapPromise;\n\t\treturn this._schema;\n\t}\n\n\t/**\n\t * Validate + execute a GraphQL document. Returns the raw\n\t * `execute()` result envelope (data, errors, extensions).\n\t */\n\tasync execute(\n\t\tsource: string,\n\t\tvariableValues: Record<string, unknown> = {},\n\t\toperationName?: string,\n\t\tcontextValue?: GraphQLContext,\n\t): Promise<GraphQLExecutionResult> {\n\t\tconst g = await loadGraphQLJs();\n\t\tconst schema = await this.ensureSchema();\n\t\tconst document = (g.parse as Function)(source);\n\t\tconst errors = (g.validate as Function)(schema, document, g.specifiedRules) as unknown[];\n\t\tif (errors.length > 0) {\n\t\t\treturn {\n\t\t\t\terrors: (errors as any[]).map((e: any) => ({\n\t\t\t\t\tmessage: e.message,\n\t\t\t\t\tlocations: e.locations,\n\t\t\t\t})),\n\t\t\t};\n\t\t}\n\t\t// If the user didn't pass a context and the service has a\n\t\t// `context()` factory, build a synthetic context (with a\n\t\t// stub Hono ctx) so resolvers that depend on `ctx.state` work\n\t\t// in `execute()` calls outside of an HTTP request.\n\t\tlet ctx = contextValue;\n\t\tif (!ctx && this.config.context) {\n\t\t\tconst fakeHono = { req: { url: \"\", method: \"EXECUTE\", header: () => \"\" } };\n\t\t\tctx = {\n\t\t\t\thono: fakeHono as any,\n\t\t\t\tstate: await this.config.context(fakeHono as any),\n\t\t\t};\n\t\t}\n\t\tconst rootValue = undefined;\n\t\treturn await (g.execute as any)({\n\t\t\tschema,\n\t\t\tdocument,\n\t\t\trootValue,\n\t\t\tcontextValue: ctx,\n\t\t\tvariableValues,\n\t\t\toperationName,\n\t\t});\n\t}\n\n\t/**\n\t * Produce a `GraphQLContext` from an inbound Hono request.\n\t * Calls the user's `context()` factory if provided.\n\t */\n\tasync buildContext(c: any): Promise<GraphQLContext> {\n\t\tconst state = this.config.context\n\t\t\t? await this.config.context(c)\n\t\t\t: {};\n\t\treturn { hono: c, state };\n\t}\n\n\t/**\n\t * Read the parsed SDL back as a string. Useful for the\n\t * `/graphql/schema` debug endpoint and for tests.\n\t */\n\tgetSchemaSDL(): string {\n\t\treturn this.normaliseTypeDefs(this.config.typeDefs).join(\"\\n\");\n\t}\n\n\tprivate normaliseTypeDefs(td?: string | string[]): string[] {\n\t\tif (!td) return [];\n\t\treturn Array.isArray(td) ? td : [td];\n\t}\n\n\t/**\n\t * Synthesise SDL snippets from `@Resolver` / `@Query` / `@Mutation` /\n\t * `@Subscription` decorator metadata and merge them with any\n\t * user-supplied `typeDefs`.\n\t *\n\t * - If the user's SDL already defines `type Query`, decorator-added\n\t * fields are appended with `extend type Query { ... }` to avoid\n\t * duplicate-type errors.\n\t * - Unknown return types or argument types are passed through as-is\n\t * (they are treated as user-defined object types).\n\t */\n\tprivate mergeSDLWithDecorators(sdl: string[]): string {\n\t\tconst registered = getRegisteredResolvers();\n\t\tif (registered.length === 0) return sdl.join(\"\\n\");\n\n\t\tconst queryFields: string[] = [];\n\t\tconst mutationFields: string[] = [];\n\t\tconst subscriptionFields: string[] = [];\n\n\t\tfor (const resolverClass of registered) {\n\t\t\tconst fields = getResolverFields(resolverClass);\n\t\t\tfor (const f of fields) {\n\t\t\t\tconst argStr =\n\t\t\t\t\tf.args.length > 0\n\t\t\t\t\t\t? `(${f.args.map((a) => `${a.name}: ${normalizeGQLType(a.type)}`).join(\", \")})`\n\t\t\t\t\t\t: \"\";\n\t\t\t\tconst line = ` ${f.name}${argStr}: ${normalizeGQLType(f.returnTypeName)}`;\n\t\t\t\tif (f.kind === \"query\") queryFields.push(line);\n\t\t\t\telse if (f.kind === \"mutation\") mutationFields.push(line);\n\t\t\t\telse if (f.kind === \"subscription\") subscriptionFields.push(line);\n\t\t\t}\n\t\t}\n\n\t\tconst userSDL = sdl.join(\"\\n\");\n\t\tconst generated: string[] = [];\n\n\t\tif (queryFields.length > 0) {\n\t\t\tconst keyword = /type\\s+Query\\s*\\{/.test(userSDL) ? \"extend type\" : \"type\";\n\t\t\tgenerated.push(`${keyword} Query {\\n${queryFields.join(\"\\n\")}\\n}`);\n\t\t}\n\t\tif (mutationFields.length > 0) {\n\t\t\tconst keyword = /type\\s+Mutation\\s*\\{/.test(userSDL) ? \"extend type\" : \"type\";\n\t\t\tgenerated.push(`${keyword} Mutation {\\n${mutationFields.join(\"\\n\")}\\n}`);\n\t\t}\n\t\tif (subscriptionFields.length > 0) {\n\t\t\tconst keyword = /type\\s+Subscription\\s*\\{/.test(userSDL) ? \"extend type\" : \"type\";\n\t\t\tgenerated.push(`${keyword} Subscription {\\n${subscriptionFields.join(\"\\n\")}\\n}`);\n\t\t}\n\n\t\treturn [userSDL, ...generated].filter(Boolean).join(\"\\n\");\n\t}\n}\n\n/** Deep-merge multiple `ResolverMap`s. Later entries win at the field level. */\nfunction mergeResolverMaps(...maps: ResolverMap[]): ResolverMap {\n\tconst result: ResolverMap = {};\n\tfor (const map of maps) {\n\t\tfor (const [typeName, fields] of Object.entries(map)) {\n\t\t\tresult[typeName] = { ...result[typeName], ...fields };\n\t\t}\n\t}\n\treturn result;\n}\n\n/**\n * Wrap a parsed schema with the user's resolver map. graphql-js's\n * `buildSchema` produces a schema with default resolvers (which look\n * up fields on the `rootValue`). For our use case, we want field-level\n * resolvers that pull from the registered `ResolverMap`.\n */\nfunction wrapSchemaWithResolvers(schema: any, resolvers: ResolverMap): any {\n\t// graphql-js schemas are immutable. We replace the resolver map\n\t// via a tiny proxy: when a field is queried, graphql-js's default\n\t// resolver calls our `defaultFieldResolver` (which simply looks\n\t// up the value in the parent). To wire our resolvers, we set\n\t// each field's `resolve` to the entry from the resolver map.\n\tconst typeMap = schema.getTypeMap?.() ?? {};\n\tfor (const [typeName, fields] of Object.entries(resolvers)) {\n\t\tconst type = typeMap[typeName];\n\t\tif (!type || typeof type.getFields !== \"function\") continue;\n\t\tconst fieldMap = type.getFields();\n\t\tfor (const [fieldName, resolver] of Object.entries(fields)) {\n\t\t\tconst field = fieldMap[fieldName];\n\t\t\tif (!field) continue;\n\t\t\tconst fn: FieldResolver =\n\t\t\t\ttypeof resolver === \"function\"\n\t\t\t\t\t? (resolver as FieldResolver)\n\t\t\t\t\t: ((resolver as { resolve: FieldResolver }).resolve as FieldResolver);\n\t\t\tfield.resolve = function (parent: any, args: any, ctx: any, info: any) {\n\t\t\t\treturn fn(parent, args, ctx, info);\n\t\t\t};\n\t\t}\n\t}\n\treturn schema;\n}\n",
|
|
7
6
|
"/**\n * @Resolver(typeName?) decorator.\n *\n * Marks a class as a GraphQL resolver. The optional `typeName` argument\n * declares the GraphQL type this class is responsible for. If\n * omitted, the type name defaults to the class name (e.g.\n * `UserResolver` → type `User`).\n *\n * The framework's GraphQL scanner picks up every class with this\n * decorator and reads the field methods off it (decorators from\n * `./query.js`, `./mutation.js`, `./subscription.js`).\n *\n * @Resolver(\"User\")\n * class UserResolver {\n * @Query() me() { ... }\n * @Mutation() signup(@Arg(\"email\") e: string) { ... }\n * @Subscription() events() { ... }\n * }\n */\nimport \"reflect-metadata\";\nimport type { ResolverClassRecord } from \"../types.js\";\n\nconst RESOLVER_KEY = Symbol.for(\"nexus:GraphQL:Resolver\");\nconst FIELDS_KEY = Symbol.for(\"nexus:GraphQL:Fields\");\nconst TYPENAME_KEY = Symbol.for(\"nexus:GraphQL:TypeName\");\n\n// Global registry of all @Resolver-decorated classes. Populated at\n// decorator evaluation time so the SDL synthesiser can enumerate them\n// without needing a separate scan pass.\nconst _resolverRegistry = new Set<Function>();\n\nexport function Resolver(typeName?: string): ClassDecorator {\n\treturn (target: Function) => {\n\t\tconst ctor = target as unknown as new (...args: any[]) => any;\n\t\tconst inferred = typeName ?? ctor.name.replace(/Resolver$/, \"\");\n\t\tReflect.defineMetadata(RESOLVER_KEY, true, ctor);\n\t\tReflect.defineMetadata(TYPENAME_KEY, inferred, ctor);\n\t\tif (!Reflect.hasMetadata(FIELDS_KEY, ctor)) {\n\t\t\tReflect.defineMetadata(FIELDS_KEY, [], ctor);\n\t\t}\n\t\t_resolverRegistry.add(ctor);\n\t};\n}\n\n/** Return all classes decorated with `@Resolver`. */\nexport function getRegisteredResolvers(): Function[] {\n\treturn [..._resolverRegistry];\n}\n\n/** Remove all entries from the registry. Intended for use in tests only. */\nexport function clearResolverRegistry(): void {\n\t_resolverRegistry.clear();\n}\n\n/** Read the type-name this resolver is for. */\nexport function getResolverTypeName(target: object): string | undefined {\n\tconst t = (target as { prototype?: object }).prototype ?? target;\n\tconst fromMeta = Reflect.getMetadata(TYPENAME_KEY, t);\n\tif (fromMeta) return fromMeta as string;\n\t// Fallback: derive from the class name (drop \"Resolver\" suffix).\n\tconst ctor = (t as { constructor?: { name: string } }).constructor;\n\treturn ctor?.name.replace(/Resolver$/, \"\");\n}\n\n/** Append a field method to the resolver class's metadata. */\nexport function pushResolverField(\n\ttarget: object,\n\tfield: ResolverClassRecord[\"fields\"][number],\n): void {\n\tconst t = (target as { prototype?: object }).prototype ?? target;\n\tconst list = (Reflect.getMetadata(FIELDS_KEY, t) as ResolverClassRecord[\"fields\"]) ?? [];\n\tlist.push(field);\n\tReflect.defineMetadata(FIELDS_KEY, list, t);\n}\n\n/** Read the field metadata for a resolver class. */\nexport function getResolverFields(target: object): ResolverClassRecord[\"fields\"] {\n\tconst t = (target as { prototype?: object }).prototype ?? target;\n\treturn (Reflect.getMetadata(FIELDS_KEY, t) as ResolverClassRecord[\"fields\"]) ?? [];\n}\n\n/** True if `target` was decorated with `@Resolver`. */\nexport function isResolverClass(target: object): boolean {\n\tconst t = (target as { prototype?: object }).prototype ?? target;\n\treturn Reflect.getMetadata(RESOLVER_KEY, t) === true;\n}\n",
|
|
8
|
-
"/**\n * `@Query(name?)` / `@Mutation(name?)` / `@Subscription(name?)`\n *\n * Method decorators that mark a resolver method as a GraphQL operation.\n * The optional `name` argument overrides the field name in the schema\n * (defaults to the method name).\n *\n * @Resolver(\"User\")\n * class UserResolver {\n * @Query(\"currentUser\")\n * me() { return ctx.state.user; }\n *\n * @Mutation()\n * updateProfile(@Arg(\"name\") name: string) { ... }\n *\n * @Subscription()\n * events() { return pubsub.asyncIterator(\"EVENTS\"); }\n * }\n */\nimport \"reflect-metadata\";\nimport { pushResolverField
|
|
9
|
-
"/**\n * `@Arg(name, type?)` parameter decorator.\n *\n * Declares a method parameter as a GraphQL field argument. Used on\n * resolver methods marked with `@Query`/`@Mutation`/`@Subscription`.\n *\n * @Mutation()\n * updateProfile(\n * @Arg(\"name\") name: string,\n * @Arg(\"email\", \"String!\") email: string,\n * ) { ... }\n *\n * The optional `type` argument is the SDL type (e.g. `\"String!\"`,\n * `\"Int\"`, `\"[User!]!\"`). When omitted, the framework uses `\"String\"`\n * as a safe default — explicit is better than implicit.\n */\nimport \"reflect-metadata\";\nimport { pushResolverField, getResolverTypeName } from \"./resolver.js\";\n\nconst ARGS_KEY = Symbol.for(\"nexus:GraphQL:MethodArgs\");\n\nexport function Arg(name: string, type: string = \"String\"): ParameterDecorator {\n\treturn (\n\t\ttarget: object,\n\t\tpropertyKey: string | symbol | undefined,\n\t\tparameterIndex: number,\n\t) => {\n\t\tif (propertyKey === undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t\"@Arg() can only decorate method parameters, not constructor parameters.\",\n\t\t\t);\n\t\t}\n\t\tconst list = (Reflect.getMetadata(ARGS_KEY, target, propertyKey) as\n\t\t\t| Array<{ name: string; type: string; index: number }>\n\t\t\t| undefined) ?? [];\n\t\tlist.push({ name, type, index: parameterIndex });\n\t\tReflect.defineMetadata(ARGS_KEY, list, target, propertyKey);\n\t};\n}\n\n/** Read `@Arg` metadata for a specific method. */\nexport function getMethodArgs(\n\ttarget: object,\n\tpropertyKey: string | symbol,\n): Array<{ name: string; type: string; index: number }> {\n\treturn (Reflect.getMetadata(ARGS_KEY, target, propertyKey) as\n\t\t| Array<{ name: string; type: string; index: number }>\n\t\t| undefined) ?? [];\n}\n"
|
|
7
|
+
"/**\n * `@Query(name?)` / `@Mutation(name?)` / `@Subscription(name?)`\n *\n * Method decorators that mark a resolver method as a GraphQL operation.\n * The optional `name` argument overrides the field name in the schema\n * (defaults to the method name).\n *\n * @Resolver(\"User\")\n * class UserResolver {\n * @Query(\"currentUser\")\n * me() { return ctx.state.user; }\n *\n * @Mutation()\n * updateProfile(@Arg(\"name\") name: string) { ... }\n *\n * @Subscription()\n * events() { return pubsub.asyncIterator(\"EVENTS\"); }\n * }\n */\nimport \"reflect-metadata\";\nimport { pushResolverField } from \"./resolver.js\";\nimport { getMethodArgs } from \"./arg.js\";\nimport type { ResolverClassRecord } from \"../types.js\";\n\ntype OperationKind = \"query\" | \"mutation\" | \"subscription\";\n\n/**\n * Common implementation. `decorator` is a factory the user calls as\n * `@Query(name?, opts?)` / `@Mutation(name?, opts?)` etc.\n *\n * `opts.returns` — explicit GraphQL return type string, e.g. `\"String!\"`.\n * Defaults to `\"JSON\"` when omitted (safe fallback; set explicitly for\n * code-first schemas that use `autoSchema: true`).\n */\nfunction makeOperationDecorator(kind: OperationKind) {\n\treturn function (name?: string, opts?: { returns?: string }) {\n\t\treturn (\n\t\t\ttarget: object,\n\t\t\tpropertyKey: string | symbol,\n\t\t\t_descriptor: TypedPropertyDescriptor<any>,\n\t\t): void => {\n\t\t\tconst argsMeta = getMethodArgs(target, propertyKey);\n\t\t\tpushResolverField(target, {\n\t\t\t\tpropertyKey: String(propertyKey),\n\t\t\t\tkind,\n\t\t\t\tname: name ?? String(propertyKey),\n\t\t\t\treturnTypeName: opts?.returns ?? \"JSON\",\n\t\t\t\targs: argsMeta\n\t\t\t\t\t.sort((a, b) => a.index - b.index)\n\t\t\t\t\t.map((a) => ({ name: a.name, type: a.type })),\n\t\t\t});\n\t\t};\n\t};\n}\n\nexport const Query = makeOperationDecorator(\"query\");\nexport const Mutation = makeOperationDecorator(\"mutation\");\nexport const Subscription = makeOperationDecorator(\"subscription\");\n\n/** Public helper for the scanner. */\nexport type AnyField = ResolverClassRecord[\"fields\"][number];\n",
|
|
8
|
+
"/**\n * `@Arg(name, type?)` parameter decorator.\n *\n * Declares a method parameter as a GraphQL field argument. Used on\n * resolver methods marked with `@Query`/`@Mutation`/`@Subscription`.\n *\n * @Mutation()\n * updateProfile(\n * @Arg(\"name\") name: string,\n * @Arg(\"email\", \"String!\") email: string,\n * ) { ... }\n *\n * The optional `type` argument is the SDL type (e.g. `\"String!\"`,\n * `\"Int\"`, `\"[User!]!\"`). When omitted, the framework uses `\"String\"`\n * as a safe default — explicit is better than implicit.\n */\nimport \"reflect-metadata\";\nimport { pushResolverField, getResolverTypeName } from \"./resolver.js\";\n\nconst ARGS_KEY = Symbol.for(\"nexus:GraphQL:MethodArgs\");\n\nexport function Arg(name: string, type: string = \"String\"): ParameterDecorator {\n\treturn (\n\t\ttarget: object,\n\t\tpropertyKey: string | symbol | undefined,\n\t\tparameterIndex: number,\n\t) => {\n\t\tif (propertyKey === undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t\"@Arg() can only decorate method parameters, not constructor parameters.\",\n\t\t\t);\n\t\t}\n\t\tconst list = (Reflect.getMetadata(ARGS_KEY, target, propertyKey) as\n\t\t\t| Array<{ name: string; type: string; index: number }>\n\t\t\t| undefined) ?? [];\n\t\tlist.push({ name, type, index: parameterIndex });\n\t\tReflect.defineMetadata(ARGS_KEY, list, target, propertyKey);\n\t};\n}\n\n/** Read `@Arg` metadata for a specific method. */\nexport function getMethodArgs(\n\ttarget: object,\n\tpropertyKey: string | symbol,\n): Array<{ name: string; type: string; index: number }> {\n\treturn (Reflect.getMetadata(ARGS_KEY, target, propertyKey) as\n\t\t| Array<{ name: string; type: string; index: number }>\n\t\t| undefined) ?? [];\n}\n",
|
|
9
|
+
"/**\n * Maps TypeScript primitive type names to their GraphQL scalar equivalents.\n *\n * Bun does not emit `design:returntype`/`design:paramtypes` metadata, so\n * full automatic type inference is unavailable. Users supply type strings\n * explicitly via `@Query(\"field\", { returns: \"String!\" })` or\n * `@Arg(\"arg\", \"Int!\")`. This utility normalises common TypeScript aliases\n * to their canonical GraphQL scalar names.\n */\nconst TS_TO_GQL: Record<string, string> = {\n\tstring: \"String\",\n\tnumber: \"Float\",\n\tint: \"Int\",\n\tfloat: \"Float\",\n\tboolean: \"Boolean\",\n\tbool: \"Boolean\",\n\tid: \"ID\",\n};\n\n/**\n * Normalise a raw type string to its GraphQL scalar name.\n *\n * - Known TypeScript aliases are converted: `string` → `String`, etc.\n * - Unknown types (user-defined object types) are returned unchanged.\n * - Non-null (`!`) suffixes and list (`[...]`) wrappers are preserved.\n *\n * @example\n * normalizeGQLType(\"string\") // \"String\"\n * normalizeGQLType(\"string!\") // \"String!\"\n * normalizeGQLType(\"[int!]!\") // \"[Int!]!\"\n * normalizeGQLType(\"String!\") // \"String!\" (already canonical — unchanged)\n * normalizeGQLType(\"User\") // \"User\" (user-defined type — unchanged)\n */\nexport function normalizeGQLType(raw: string): string {\n\tconst nonNull = raw.endsWith(\"!\");\n\tconst base = nonNull ? raw.slice(0, -1) : raw;\n\tconst trimmed = base.trim();\n\n\tif (trimmed.startsWith(\"[\") && trimmed.endsWith(\"]\")) {\n\t\tconst inner = trimmed.slice(1, -1);\n\t\treturn `[${normalizeGQLType(inner)}]${nonNull ? \"!\" : \"\"}`;\n\t}\n\n\tconst mapped = TS_TO_GQL[trimmed.toLowerCase()];\n\treturn (mapped ?? trimmed) + (nonNull ? \"!\" : \"\");\n}\n",
|
|
10
|
+
"/**\n * `GraphQLModule` — drop-in GraphQL endpoint.\n *\n * @Module({\n * imports: [\n * GraphQLModule.forRoot({\n * typeDefs: `\n * type Query { hello: String! }\n * `,\n * resolvers: {\n * Query: {\n * hello: () => \"world\",\n * },\n * },\n * }),\n * ],\n * })\n * export class AppModule {}\n *\n * After boot, the framework exposes:\n *\n * POST /graphql — queries + mutations\n * GET /graphql — GraphiQL UI (or a query, if `?query=...` is set)\n * GET /graphql/schema — the schema as SDL (debug)\n *\n * Resolvers can also be declared via the `@Resolver` + `@Query` /\n * `@Mutation` / `@Subscription` decorators — see the user guide.\n */\nimport \"reflect-metadata\";\nimport type { Context } from \"hono\";\nimport { Module } from \"@nexusts/core\";\nimport { GraphQLService } from \"./graphql.service.js\";\nimport type { GraphQLConfig } from \"./types.js\";\n\n@Module({\n\tproviders: [\n\t\tGraphQLService,\n\t\t{ provide: GraphQLService.TOKEN, useExisting: GraphQLService },\n\t],\n\texports: [GraphQLService, GraphQLService.TOKEN],\n})\nexport class GraphQLModule {\n\tstatic forRoot(config: GraphQLConfig) {\n\t\tconst factory = () => new GraphQLService(config);\n\t\t@Module({\n\t\t\tproviders: [\n\t\t\t\t{\n\t\t\t\t\tprovide: GraphQLService.TOKEN,\n\t\t\t\t\tuseFactory: factory,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tprovide: GraphQLService,\n\t\t\t\t\tuseFactory: factory,\n\t\t\t\t},\n\t\t\t\t{ provide: \"GRAPHQL_CONFIG\", useValue: config },\n\t\t\t],\n\t\t\texports: [GraphQLService, GraphQLService.TOKEN],\n\t\t})\n\t\tclass ConfiguredGraphQLModule {}\n\t\tObject.defineProperty(ConfiguredGraphQLModule, \"name\", {\n\t\t\tvalue: \"ConfiguredGraphQLModule\",\n\t\t});\n\t\treturn ConfiguredGraphQLModule;\n\t}\n\n\t/**\n\t * Manually mount the GraphQL endpoint onto a Hono-compatible app.\n\t * Used by `main.ts` setups that don't go through `@Module`.\n\t */\n\tstatic async mount(\n\t\tapp: {\n\t\t\tpost: (path: string, ...h: any[]) => any;\n\t\t\tget: (path: string, ...h: any[]) => any;\n\t\t\tuse: (path: string, ...h: any[]) => any;\n\t\t},\n\t\tsvc: GraphQLService,\n\t): Promise<void> {\n\t\tconst path = svc.config.endpoint?.path ?? \"/graphql\";\n\t\tconst enableGet = svc.config.endpoint?.enableGet ?? true;\n\t\tconst exposeSDL = svc.config.exposeSchemaSDL ?? true;\n\t\tconst playground = svc.config.playground ?? \"graphiql\";\n\n\t\t// POST /graphql — queries + mutations.\n\t\tapp.post(path, async (c: Context) => {\n\t\t\tconst body = await readRequestBody(c);\n\t\t\tconst ctx = await svc.buildContext(c);\n\t\t\tconst result = await svc.execute(\n\t\t\t\tbody.query,\n\t\t\t\tparseJSONField(body.variables) ?? {},\n\t\t\t\tbody.operationName || undefined,\n\t\t\t\tctx,\n\t\t\t);\n\t\t\treturn c.json(result, statusFor(result) as any);\n\t\t});\n\n\t\t// GET /graphql — playground / pre-baked query (?query=...&variables=...).\n\t\tif (enableGet) {\n\t\t\tapp.get(path, async (c: Context) => {\n\t\t\t\tconst query = c.req.query(\"query\");\n\t\t\t\tif (!query) {\n\t\t\t\t\tif (playground === \"none\") {\n\t\t\t\t\t\treturn c.text(\"GraphQL endpoint. Pass ?query=... for a pre-baked query.\", 200);\n\t\t\t\t\t}\n\t\t\t\t\treturn c.html(graphiqlHtml({ endpoint: path }), 200, {\n\t\t\t\t\t\t\"Content-Type\": \"text/html; charset=utf-8\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst ctx = await svc.buildContext(c);\n\t\t\t\tconst result = await svc.execute(\n\t\t\t\t\tquery,\n\t\t\t\t\tparseJSONField(c.req.query(\"variables\") ?? \"\") ?? {},\n\t\t\t\t\tc.req.query(\"operationName\") ?? undefined,\n\t\t\t\t\tctx,\n\t\t\t\t);\n\t\t\t\treturn c.json(result, statusFor(result) as any);\n\t\t\t});\n\t\t}\n\n\t\t// GET /graphql/schema — debug: print the raw SDL.\n\t\tif (exposeSDL) {\n\t\t\tapp.get(`${path}/schema`, (c: Context) => {\n\t\t\t\treturn c.text(svc.getSchemaSDL(), 200, {\n\t\t\t\t\t\"Content-Type\": \"text/plain; charset=utf-8\",\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\t// Force schema bootstrap so the first request isn't slow.\n\t\tawait svc.ensureSchema();\n\t}\n}\n\n/** Read a GraphQL request body. Accepts JSON or form-urlencoded. */\nasync function readRequestBody(\n\tc: Context,\n): Promise<{ query: string; variables: string; operationName: string }> {\n\tconst ct = c.req.header(\"content-type\") ?? \"\";\n\tif (ct.includes(\"application/json\")) {\n\t\ttry {\n\t\t\tconst j = await c.req.json() as Record<string, unknown>;\n\t\t\treturn {\n\t\t\t\tquery: String(j.query ?? \"\"),\n\t\t\t\tvariables: j.variables ? JSON.stringify(j.variables) : \"\",\n\t\t\t\toperationName: j.operationName ? String(j.operationName) : \"\",\n\t\t\t};\n\t\t} catch {\n\t\t\treturn { query: \"\", variables: \"\", operationName: \"\" };\n\t\t}\n\t}\n\tif (ct.includes(\"application/x-www-form-urlencoded\")) {\n\t\tconst text = await c.req.text();\n\t\tconst params = new URLSearchParams(text);\n\t\treturn {\n\t\t\tquery: params.get(\"query\") ?? \"\",\n\t\t\tvariables: params.get(\"variables\") ?? \"\",\n\t\t\toperationName: params.get(\"operationName\") ?? \"\",\n\t\t};\n\t}\n\t// Default: assume form-urlencoded.\n\tconst text = await c.req.text();\n\tconst params = new URLSearchParams(text);\n\treturn {\n\t\tquery: params.get(\"query\") ?? \"\",\n\t\tvariables: params.get(\"variables\") ?? \"\",\n\t\toperationName: params.get(\"operationName\") ?? \"\",\n\t};\n}\n\nfunction parseJSONField(raw: string): Record<string, unknown> | undefined {\n\tif (!raw) return undefined;\n\ttry {\n\t\tconst parsed = JSON.parse(raw);\n\t\tif (parsed && typeof parsed === \"object\") {\n\t\t\treturn parsed as Record<string, unknown>;\n\t\t}\n\t} catch {\n\t\t/* fall through */\n\t}\n\treturn undefined;\n}\n\nfunction statusFor(result: { errors?: unknown[]; data?: unknown }): number {\n\tif (result.errors && (result.errors as unknown[]).length > 0 && !result.data) return 400;\n\treturn 200;\n}\n\n/** Minimal GraphiQL HTML — single-page, no CDN, no external assets. */\nfunction graphiqlHtml(opts: { endpoint: string }): string {\n\treturn `<!doctype html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n <title>GraphiQL</title>\n <style>\n body { font-family: system-ui, sans-serif; margin: 0; padding: 1em; }\n pre { background: #f5f5f5; padding: 0.6em; border-radius: 4px; overflow: auto; }\n .row { display: flex; gap: 1em; }\n textarea { width: 100%; min-height: 8em; font-family: ui-monospace, monospace; }\n button { padding: 0.4em 0.8em; }\n </style>\n</head>\n<body>\n <h2>GraphiQL (lightweight)</h2>\n <p>POST <code>${opts.endpoint}</code> · this is a no-deps playground built into\n <code>@nexusts/graphql</code>. For the full GraphiQL\n experience, see <code>graphiql</code> on npm.</p>\n <div class=\"row\">\n <textarea id=\"q\" placeholder=\"query { hello }\">{ hello }</textarea>\n </div>\n <p><button id=\"run\">Run</button> <span id=\"status\"></span></p>\n <pre id=\"out\"></pre>\n <script>\n const $q = document.getElementById(\"q\");\n const $out = document.getElementById(\"out\");\n const $status = document.getElementById(\"status\");\n document.getElementById(\"run\").onclick = async () => {\n $status.textContent = \"running…\";\n $out.textContent = \"\";\n const res = await fetch(${JSON.stringify(opts.endpoint)}, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ query: $q.value }),\n });\n const j = await res.json();\n $status.textContent = res.status + \" \" + res.statusText;\n $out.textContent = JSON.stringify(j, null, 2);\n };\n </script>\n</body>\n</html>`;\n}\n"
|
|
10
11
|
],
|
|
11
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA;AAmCA,IAAI,WAA6B;AACjC,IAAI,iBAAiB;AAGrB,eAAsB,aAAa,GAAuB;AAAA,EACzD,IAAI;AAAA,IAAU,OAAO;AAAA,EACrB,IAAI,gBAAgB;AAAA,IACnB,MAAM,IAAI,MACT,sEACC,8DACF;AAAA,EACD;AAAA,EACA,iBAAiB;AAAA,EACjB,IAAI;AAAA,IACH,MAAM,MAAO,MAAa;AAAA,IAC1B,WAAW;AAAA,IACX,OAAO;AAAA,IACN,OAAO,KAAK;AAAA,IACb,MAAM,IAAI,MACT,2HAEuB,IAAc,OACtC;AAAA;AAAA;A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able introspection at runtime (disable in production). */
|
|
89
89
|
introspection?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* When true, the schema is synthesised from `@Resolver` / `@Query` /
|
|
92
|
+
* `@Mutation` / `@Subscription` decorators alone — `typeDefs` is not
|
|
93
|
+
* required. Both can coexist: decorator-generated SDL is merged with
|
|
94
|
+
* any user-supplied `typeDefs`.
|
|
95
|
+
*/
|
|
96
|
+
autoSchema?: boolean;
|
|
90
97
|
}
|
|
91
98
|
/** The shape of a hand-written resolver map. */
|
|
92
99
|
export interface ResolverMap {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexusts/graphql",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.8",
|
|
4
4
|
"description": "SDL-first GraphQL endpoint with @Resolver decorators",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,6 +34,6 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@nexusts/core": "^0.7.
|
|
37
|
+
"@nexusts/core": "^0.7.8"
|
|
38
38
|
}
|
|
39
39
|
}
|