nitro-graphql 1.5.9 → 1.5.10

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.
@@ -1,4 +1,4 @@
1
- import * as h35 from "h3";
1
+ import * as h31 from "h3";
2
2
 
3
3
  //#region src/routes/debug.d.ts
4
4
 
@@ -10,7 +10,7 @@ import * as h35 from "h3";
10
10
  * - /_nitro/graphql/debug - HTML dashboard
11
11
  * - /_nitro/graphql/debug?format=json - JSON API
12
12
  */
13
- declare const _default: h35.EventHandler<h35.EventHandlerRequest, Promise<string | {
13
+ declare const _default: h31.EventHandler<h31.EventHandlerRequest, Promise<string | {
14
14
  timestamp: string;
15
15
  environment: {
16
16
  dev: any;
@@ -1,6 +1,6 @@
1
- import * as h31 from "h3";
1
+ import * as h30 from "h3";
2
2
 
3
3
  //#region src/routes/graphql-yoga.d.ts
4
- declare const _default: h31.EventHandler<h31.EventHandlerRequest, Promise<Response>>;
4
+ declare const _default: h30.EventHandler<h30.EventHandlerRequest, Promise<Response>>;
5
5
  //#endregion
6
6
  export { _default as default };
@@ -1,7 +1,7 @@
1
- import * as h30 from "h3";
1
+ import * as h35 from "h3";
2
2
 
3
3
  //#region src/routes/health.d.ts
4
- declare const _default: h30.EventHandler<h30.EventHandlerRequest, Promise<{
4
+ declare const _default: h35.EventHandler<h35.EventHandlerRequest, Promise<{
5
5
  status: string;
6
6
  message: string;
7
7
  timestamp: string;
@@ -116,14 +116,29 @@ type ResolverReturnType<T> = T extends BuiltIns
116
116
  : ResolverReturnTypeObject<T>
117
117
  : unknown;
118
118
 
119
+ // Helper type: Map all properties recursively, preserving __typename as literal
120
+ type MapResolverProps<T extends object> = {
121
+ [K in keyof T]: K extends '__typename'
122
+ ? T[K]
123
+ : ResolverReturnType<T[K]>
124
+ };
125
+
126
+ // Helper type: Check if schema output is meaningful (not unknown)
127
+ type HasSchemaOutput<T extends SchemaKeys> =
128
+ InferOutputFromSchema<T> extends unknown
129
+ ? false
130
+ : true;
131
+
119
132
  type ResolverReturnTypeObject<T extends object> =
120
133
  T extends { __typename?: infer TTypename }
121
134
  ? IsLiteral<TTypename> extends true
122
135
  ? TTypename extends SchemaKeys
123
- ? InferOutputFromSchema<TTypename>
124
- : { [K in keyof T]: ResolverReturnType<T[K]> }
125
- : { [K in keyof T]: ResolverReturnType<T[K]> }
126
- : { [K in keyof T]: ResolverReturnType<T[K]> };
136
+ ? HasSchemaOutput<TTypename> extends true
137
+ ? InferOutputFromSchema<TTypename> & Pick<MapResolverProps<T>, '__typename'>
138
+ : MapResolverProps<T>
139
+ : MapResolverProps<T>
140
+ : MapResolverProps<T>
141
+ : MapResolverProps<T>;
127
142
  `,
128
143
  ""
129
144
  ],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nitro-graphql",
3
3
  "type": "module",
4
- "version": "1.5.9",
4
+ "version": "1.5.10",
5
5
  "description": "GraphQL integration for Nitro",
6
6
  "license": "MIT",
7
7
  "sideEffects": false,