@nexusts/graphql 0.7.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 ADDED
@@ -0,0 +1,45 @@
1
+ # @nexusts/graphql
2
+
3
+ > **NexusTS** — Bun-native fullstack framework
4
+
5
+ ## Description
6
+
7
+ SDL-first GraphQL endpoint with @Resolver decorators.
8
+
9
+ Single GraphQL endpoint. `POST /graphql`, `GET /graphql?query=`, `GET /graphql/schema`, in-bundle GraphiQL playground. SDL-first; @Resolver / @Query / @Mutation decorators.
10
+
11
+ ## Install
12
+
13
+ This module is part of the NexusTS monorepo. Each module is published as its own npm package under the `@nexusts/` scope.
14
+
15
+ Most apps start with just the core:
16
+
17
+ ```bash
18
+ bun add @nexusts/core reflect-metadata zod hono
19
+ ```
20
+
21
+ Then add this module only if you need it:
22
+
23
+ ```bash
24
+ bun add @nexusts/graphql
25
+ ```
26
+
27
+ ## Peer dependencies
28
+
29
+ ```bash
30
+ bun add graphql
31
+ ```
32
+
33
+ Required by this module. Without them the module loads but its public methods throw a clear error pointing to this install command on first call.
34
+
35
+ ## Usage
36
+
37
+ ```typescript
38
+ import { /* public API */ } from "@nexusts/graphql";
39
+ ```
40
+
41
+ See the [user guide](../../docs/user-guide/graphql.md) and the [example app](../../examples/) for a working demo.
42
+
43
+ ## License
44
+
45
+ MIT — see the root [LICENSE](../../LICENSE).
package/dist/index.js ADDED
@@ -0,0 +1,426 @@
1
+ // @bun
2
+ var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __toESM = (mod, isNodeMode, target) => {
8
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
9
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
+ for (let key of __getOwnPropNames(mod))
11
+ if (!__hasOwnProp.call(to, key))
12
+ __defProp(to, key, {
13
+ get: () => mod[key],
14
+ enumerable: true
15
+ });
16
+ return to;
17
+ };
18
+ var __legacyDecorateClassTS = function(decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
21
+ r = Reflect.decorate(decorators, target, key, desc);
22
+ else
23
+ for (var i = decorators.length - 1;i >= 0; i--)
24
+ if (d = decorators[i])
25
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
26
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
27
+ };
28
+ var __require = import.meta.require;
29
+ // packages/graphql/src/graphql.service.ts
30
+ import"reflect-metadata";
31
+ var _graphql = null;
32
+ var _loadAttempted = false;
33
+ async function loadGraphQLJs() {
34
+ if (_graphql)
35
+ return _graphql;
36
+ if (_loadAttempted) {
37
+ throw new Error("[nexusjs/graphql] The optional `graphql` package failed to load. " + "Install it with `bun add graphql` to use the GraphQL module.");
38
+ }
39
+ _loadAttempted = true;
40
+ try {
41
+ const mod = await import("graphql");
42
+ _graphql = mod;
43
+ return mod;
44
+ } catch (err) {
45
+ throw new Error("[nexusjs/graphql] The `graphql` package is required for execution. Install it with `bun add graphql`. Original error: " + err.message);
46
+ }
47
+ }
48
+
49
+ class GraphQLService {
50
+ config;
51
+ static TOKEN = Symbol.for("nexus:GraphQL");
52
+ constructor(config = {}) {
53
+ this.config = {
54
+ playground: "graphiql",
55
+ endpoint: { path: "/graphql", enableGet: true },
56
+ exposeSchemaSDL: true,
57
+ introspection: true,
58
+ ...config
59
+ };
60
+ }
61
+ _schema = null;
62
+ _resolvers = {};
63
+ _bootstrapPromise = null;
64
+ addResolvers(map) {
65
+ for (const [typeName, fields] of Object.entries(map)) {
66
+ this._resolvers[typeName] = {
67
+ ...this._resolvers[typeName],
68
+ ...fields
69
+ };
70
+ }
71
+ }
72
+ async _buildSchema(sdl) {
73
+ const g = await loadGraphQLJs();
74
+ const merged = this.mergeSDLWithDecorators(sdl);
75
+ const schema = g.buildSchema(merged);
76
+ const final = { ...this._resolvers, ...this.config.resolvers };
77
+ wrapSchemaWithResolvers(schema, final);
78
+ return schema;
79
+ }
80
+ async ensureSchema() {
81
+ if (this._schema)
82
+ return this._schema;
83
+ if (this._bootstrapPromise)
84
+ return this._bootstrapPromise.then(() => this._schema);
85
+ this._bootstrapPromise = (async () => {
86
+ const sdl = this.normaliseTypeDefs(this.config.typeDefs);
87
+ if (sdl.length === 0) {
88
+ throw new Error("[nexusjs/graphql] No typeDefs configured. Pass `typeDefs: '...' to GraphQLModule.forRoot()` or use `@Resolver` + `@Query` / `@Mutation` decorators.");
89
+ }
90
+ this._schema = await this._buildSchema(sdl);
91
+ })();
92
+ await this._bootstrapPromise;
93
+ return this._schema;
94
+ }
95
+ async execute(source, variableValues = {}, operationName, contextValue) {
96
+ const g = await loadGraphQLJs();
97
+ const schema = await this.ensureSchema();
98
+ const document = g.parse(source);
99
+ const errors = g.validate(schema, document, g.specifiedRules);
100
+ if (errors.length > 0) {
101
+ return {
102
+ errors: errors.map((e) => ({
103
+ message: e.message,
104
+ locations: e.locations
105
+ }))
106
+ };
107
+ }
108
+ let ctx = contextValue;
109
+ if (!ctx && this.config.context) {
110
+ const fakeHono = { req: { url: "", method: "EXECUTE", header: () => "" } };
111
+ ctx = {
112
+ hono: fakeHono,
113
+ state: await this.config.context(fakeHono)
114
+ };
115
+ }
116
+ const rootValue = undefined;
117
+ return await g.execute({
118
+ schema,
119
+ document,
120
+ rootValue,
121
+ contextValue: ctx,
122
+ variableValues,
123
+ operationName
124
+ });
125
+ }
126
+ async buildContext(c) {
127
+ const state = this.config.context ? await this.config.context(c) : {};
128
+ return { hono: c, state };
129
+ }
130
+ getSchemaSDL() {
131
+ return this.normaliseTypeDefs(this.config.typeDefs).join(`
132
+ `);
133
+ }
134
+ normaliseTypeDefs(td) {
135
+ if (!td)
136
+ return [];
137
+ return Array.isArray(td) ? td : [td];
138
+ }
139
+ mergeSDLWithDecorators(sdl) {
140
+ return sdl.join(`
141
+ `);
142
+ }
143
+ }
144
+ function wrapSchemaWithResolvers(schema, resolvers) {
145
+ const typeMap = schema.getTypeMap?.() ?? {};
146
+ for (const [typeName, fields] of Object.entries(resolvers)) {
147
+ const type = typeMap[typeName];
148
+ if (!type || typeof type.getFields !== "function")
149
+ continue;
150
+ const fieldMap = type.getFields();
151
+ for (const [fieldName, resolver] of Object.entries(fields)) {
152
+ const field = fieldMap[fieldName];
153
+ if (!field)
154
+ continue;
155
+ const fn = typeof resolver === "function" ? resolver : resolver.resolve;
156
+ field.resolve = function(parent, args, ctx, info) {
157
+ return fn(parent, args, ctx, info);
158
+ };
159
+ }
160
+ }
161
+ return schema;
162
+ }
163
+ // packages/graphql/src/graphql.module.ts
164
+ import"reflect-metadata";
165
+ import { Module } from "@nexusts/core/decorators/module.js";
166
+ class GraphQLModule {
167
+ static forRoot(config) {
168
+ const factory = () => new GraphQLService(config);
169
+
170
+ class ConfiguredGraphQLModule {
171
+ }
172
+ ConfiguredGraphQLModule = __legacyDecorateClassTS([
173
+ Module({
174
+ providers: [
175
+ {
176
+ provide: GraphQLService.TOKEN,
177
+ useFactory: factory
178
+ },
179
+ {
180
+ provide: GraphQLService,
181
+ useFactory: factory
182
+ },
183
+ { provide: "GRAPHQL_CONFIG", useValue: config }
184
+ ],
185
+ exports: [GraphQLService, GraphQLService.TOKEN]
186
+ })
187
+ ], ConfiguredGraphQLModule);
188
+ Object.defineProperty(ConfiguredGraphQLModule, "name", {
189
+ value: "ConfiguredGraphQLModule"
190
+ });
191
+ return ConfiguredGraphQLModule;
192
+ }
193
+ static async mount(app, svc) {
194
+ const path = svc.config.endpoint?.path ?? "/graphql";
195
+ const enableGet = svc.config.endpoint?.enableGet ?? true;
196
+ const exposeSDL = svc.config.exposeSchemaSDL ?? true;
197
+ const playground = svc.config.playground ?? "graphiql";
198
+ app.post(path, async (c) => {
199
+ const body = await readRequestBody(c);
200
+ const ctx = await svc.buildContext(c);
201
+ const result = await svc.execute(body.query, parseJSONField(body.variables) ?? {}, body.operationName || undefined, ctx);
202
+ return c.json(result, statusFor(result));
203
+ });
204
+ if (enableGet) {
205
+ app.get(path, async (c) => {
206
+ const query = c.req.query("query");
207
+ if (!query) {
208
+ if (playground === "none") {
209
+ return c.text("GraphQL endpoint. Pass ?query=... for a pre-baked query.", 200);
210
+ }
211
+ return c.html(graphiqlHtml({ endpoint: path }), 200, {
212
+ "Content-Type": "text/html; charset=utf-8"
213
+ });
214
+ }
215
+ const ctx = await svc.buildContext(c);
216
+ const result = await svc.execute(query, parseJSONField(c.req.query("variables") ?? "") ?? {}, c.req.query("operationName") ?? undefined, ctx);
217
+ return c.json(result, statusFor(result));
218
+ });
219
+ }
220
+ if (exposeSDL) {
221
+ app.get(`${path}/schema`, (c) => {
222
+ return c.text(svc.getSchemaSDL(), 200, {
223
+ "Content-Type": "text/plain; charset=utf-8"
224
+ });
225
+ });
226
+ }
227
+ await svc.ensureSchema();
228
+ }
229
+ }
230
+ GraphQLModule = __legacyDecorateClassTS([
231
+ Module({
232
+ providers: [
233
+ GraphQLService,
234
+ { provide: GraphQLService.TOKEN, useExisting: GraphQLService }
235
+ ],
236
+ exports: [GraphQLService, GraphQLService.TOKEN]
237
+ })
238
+ ], GraphQLModule);
239
+ async function readRequestBody(c) {
240
+ const ct = c.req.header("content-type") ?? "";
241
+ if (ct.includes("application/json")) {
242
+ try {
243
+ const j = await c.req.json();
244
+ return {
245
+ query: String(j.query ?? ""),
246
+ variables: j.variables ? JSON.stringify(j.variables) : "",
247
+ operationName: j.operationName ? String(j.operationName) : ""
248
+ };
249
+ } catch {
250
+ return { query: "", variables: "", operationName: "" };
251
+ }
252
+ }
253
+ if (ct.includes("application/x-www-form-urlencoded")) {
254
+ const text2 = await c.req.text();
255
+ const params2 = new URLSearchParams(text2);
256
+ return {
257
+ query: params2.get("query") ?? "",
258
+ variables: params2.get("variables") ?? "",
259
+ operationName: params2.get("operationName") ?? ""
260
+ };
261
+ }
262
+ const text = await c.req.text();
263
+ const params = new URLSearchParams(text);
264
+ return {
265
+ query: params.get("query") ?? "",
266
+ variables: params.get("variables") ?? "",
267
+ operationName: params.get("operationName") ?? ""
268
+ };
269
+ }
270
+ function parseJSONField(raw) {
271
+ if (!raw)
272
+ return;
273
+ try {
274
+ const parsed = JSON.parse(raw);
275
+ if (parsed && typeof parsed === "object") {
276
+ return parsed;
277
+ }
278
+ } catch {}
279
+ return;
280
+ }
281
+ function statusFor(result) {
282
+ if (result.errors && result.errors.length > 0 && !result.data)
283
+ return 400;
284
+ return 200;
285
+ }
286
+ function graphiqlHtml(opts) {
287
+ return `<!doctype html>
288
+ <html lang="en">
289
+ <head>
290
+ <meta charset="utf-8">
291
+ <title>GraphiQL</title>
292
+ <style>
293
+ body { font-family: system-ui, sans-serif; margin: 0; padding: 1em; }
294
+ pre { background: #f5f5f5; padding: 0.6em; border-radius: 4px; overflow: auto; }
295
+ .row { display: flex; gap: 1em; }
296
+ textarea { width: 100%; min-height: 8em; font-family: ui-monospace, monospace; }
297
+ button { padding: 0.4em 0.8em; }
298
+ </style>
299
+ </head>
300
+ <body>
301
+ <h2>GraphiQL (lightweight)</h2>
302
+ <p>POST <code>${opts.endpoint}</code> \xB7 this is a no-deps playground built into
303
+ <code>@nexusts/graphql</code>. For the full GraphiQL
304
+ experience, see <code>graphiql</code> on npm.</p>
305
+ <div class="row">
306
+ <textarea id="q" placeholder="query { hello }">{ hello }</textarea>
307
+ </div>
308
+ <p><button id="run">Run</button> <span id="status"></span></p>
309
+ <pre id="out"></pre>
310
+ <script>
311
+ const $q = document.getElementById("q");
312
+ const $out = document.getElementById("out");
313
+ const $status = document.getElementById("status");
314
+ document.getElementById("run").onclick = async () => {
315
+ $status.textContent = "running\u2026";
316
+ $out.textContent = "";
317
+ const res = await fetch(${JSON.stringify(opts.endpoint)}, {
318
+ method: "POST",
319
+ headers: { "Content-Type": "application/json" },
320
+ body: JSON.stringify({ query: $q.value }),
321
+ });
322
+ const j = await res.json();
323
+ $status.textContent = res.status + " " + res.statusText;
324
+ $out.textContent = JSON.stringify(j, null, 2);
325
+ };
326
+ </script>
327
+ </body>
328
+ </html>`;
329
+ }
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
+ function Resolver(typeName) {
336
+ return (target) => {
337
+ const ctor = target;
338
+ const inferred = typeName ?? ctor.name.replace(/Resolver$/, "");
339
+ Reflect.defineMetadata(RESOLVER_KEY, true, ctor);
340
+ Reflect.defineMetadata(TYPENAME_KEY, inferred, ctor);
341
+ if (!Reflect.hasMetadata(FIELDS_KEY, ctor)) {
342
+ Reflect.defineMetadata(FIELDS_KEY, [], ctor);
343
+ }
344
+ };
345
+ }
346
+ function getResolverTypeName(target) {
347
+ const t = target.prototype ?? target;
348
+ const fromMeta = Reflect.getMetadata(TYPENAME_KEY, t);
349
+ if (fromMeta)
350
+ return fromMeta;
351
+ const ctor = t.constructor;
352
+ return ctor?.name.replace(/Resolver$/, "");
353
+ }
354
+ function pushResolverField(target, field) {
355
+ const t = target.prototype ?? target;
356
+ const list = Reflect.getMetadata(FIELDS_KEY, t) ?? [];
357
+ list.push(field);
358
+ Reflect.defineMetadata(FIELDS_KEY, list, t);
359
+ }
360
+ function getResolverFields(target) {
361
+ const t = target.prototype ?? target;
362
+ return Reflect.getMetadata(FIELDS_KEY, t) ?? [];
363
+ }
364
+ function isResolverClass(target) {
365
+ const t = target.prototype ?? target;
366
+ return Reflect.getMetadata(RESOLVER_KEY, t) === true;
367
+ }
368
+ // packages/graphql/src/decorators/query.ts
369
+ import"reflect-metadata";
370
+ function makeOperationDecorator(kind) {
371
+ return function(name) {
372
+ return (target, propertyKey, descriptor) => {
373
+ const meta = parseMethodType(descriptor.value);
374
+ pushResolverField(target, {
375
+ propertyKey: String(propertyKey),
376
+ kind,
377
+ name: name ?? String(propertyKey),
378
+ returnTypeName: meta.returnTypeName,
379
+ args: meta.args
380
+ });
381
+ };
382
+ };
383
+ }
384
+ function parseMethodType(fn) {
385
+ const fnName = fn.name || "unknown";
386
+ return {
387
+ returnTypeName: "JSON",
388
+ args: []
389
+ };
390
+ }
391
+ var Query = makeOperationDecorator("query");
392
+ var Mutation = makeOperationDecorator("mutation");
393
+ var Subscription = makeOperationDecorator("subscription");
394
+ // packages/graphql/src/decorators/arg.ts
395
+ import"reflect-metadata";
396
+ var ARGS_KEY = Symbol.for("nexus:GraphQL:MethodArgs");
397
+ function Arg(name, type = "String") {
398
+ return (target, propertyKey, parameterIndex) => {
399
+ if (propertyKey === undefined) {
400
+ throw new Error("@Arg() can only decorate method parameters, not constructor parameters.");
401
+ }
402
+ const list = Reflect.getMetadata(ARGS_KEY, target, propertyKey) ?? [];
403
+ list.push({ name, type, index: parameterIndex });
404
+ Reflect.defineMetadata(ARGS_KEY, list, target, propertyKey);
405
+ };
406
+ }
407
+ function getMethodArgs(target, propertyKey) {
408
+ return Reflect.getMetadata(ARGS_KEY, target, propertyKey) ?? [];
409
+ }
410
+ export {
411
+ loadGraphQLJs,
412
+ isResolverClass,
413
+ getResolverTypeName,
414
+ getResolverFields,
415
+ getMethodArgs,
416
+ Subscription,
417
+ Resolver,
418
+ Query,
419
+ Mutation,
420
+ GraphQLService,
421
+ GraphQLModule,
422
+ Arg
423
+ };
424
+
425
+ //# debugId=965D839B7772A0F964756E2164756E21
426
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,14 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/graphql.service.ts", "../src/graphql.module.ts", "../src/decorators/resolver.ts", "../src/decorators/query.ts", "../src/decorators/arg.ts"],
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/decorators/module.js\";\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",
7
+ "/**\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\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};\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, getResolverTypeName } from \"./resolver.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(...)` / `@Mutation(...)` etc. We can't share one decorator\n * across kinds because we want per-kind runtime behavior to be\n * identical — only the discriminator string differs.\n */\nfunction makeOperationDecorator(kind: OperationKind) {\n\treturn function (name?: string) {\n\t\treturn (\n\t\t\ttarget: object,\n\t\t\tpropertyKey: string | symbol,\n\t\t\tdescriptor: TypedPropertyDescriptor<any>,\n\t\t): void => {\n\t\t\tconst meta = parseMethodType(descriptor.value);\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: meta.returnTypeName,\n\t\t\t\targs: meta.args,\n\t\t\t});\n\t\t};\n\t};\n}\n\n/** Reflect on a method's parameter list to extract `@Arg` names. */\nfunction parseMethodType(fn: Function): {\n\treturnTypeName: string;\n\targs: Array<{ name: string; type: string; defaultValue?: unknown }>;\n} {\n\t// We can't read parameter names at runtime in vanilla JS without\n\t// extra tooling (the TypeScript metadata API exposes types but\n\t// not parameter names). Convention: methods accept a single\n\t// `args` object whose keys are the GraphQL field arguments.\n\t//\n\t// For finer control, the user can call `@Arg(\"name\")` on\n\t// individual parameters (see `./arg.js`). The names are then\n\t// gathered by `@Arg` and merged at scan time.\n\tconst fnName = fn.name || \"unknown\";\n\treturn {\n\t\treturnTypeName: \"JSON\", // SDL \"JSON\" scalar until a more specific\n\t\t\t\t\t\t\t\t// type system is wired in.\n\t\targs: [],\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",
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"
10
+ ],
11
+ "mappings": ";;;;;;;;;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AAQ,WAAW,KAExC,CAAC;AAAA;",
12
+ "debugId": "965D839B7772A0F964756E2164756E21",
13
+ "names": []
14
+ }
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@nexusts/graphql",
3
+ "version": "0.7.0",
4
+ "description": "SDL-first GraphQL endpoint with @Resolver decorators",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "bun run ../../build.ts"
21
+ },
22
+ "keywords": [
23
+ "nexusts",
24
+ "framework",
25
+ "bun"
26
+ ],
27
+ "license": "MIT",
28
+ "peerDependencies": {
29
+ "graphql": "^17.0.0"
30
+ },
31
+ "peerDependenciesMeta": {
32
+ "graphql": {
33
+ "optional": true
34
+ }
35
+ },
36
+ "dependencies": {
37
+ "@nexusts/core": "^0.7.0"
38
+ }
39
+ }