nitro-graphql 1.5.5 → 1.5.7

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.
Files changed (40) hide show
  1. package/dist/ecosystem/{nuxt.js → nuxt.mjs} +1 -1
  2. package/dist/{index.d.ts → index.d.mts} +3 -4
  3. package/dist/{index.js → index.mjs} +7 -16
  4. package/dist/{rollup.js → rollup.mjs} +2 -2
  5. package/dist/routes/apollo-server.d.mts +6 -0
  6. package/dist/routes/{debug.d.ts → debug.d.mts} +1 -1
  7. package/dist/routes/graphql-yoga.d.mts +6 -0
  8. package/dist/routes/{health.d.ts → health.d.mts} +1 -1
  9. package/dist/types/{index.d.ts → index.d.mts} +1 -1
  10. package/dist/types/{standard-schema.d.ts → standard-schema.d.mts} +2 -2
  11. package/dist/utils/{client-codegen.d.ts → client-codegen.d.mts} +1 -1
  12. package/dist/utils/{index.d.ts → index.d.mts} +2 -2
  13. package/dist/utils/{index.js → index.mjs} +1 -1
  14. package/dist/utils/{path-resolver.d.ts → path-resolver.d.mts} +1 -1
  15. package/dist/utils/{server-codegen.d.ts → server-codegen.d.mts} +1 -1
  16. package/dist/utils/{server-codegen.js → server-codegen.mjs} +4 -2
  17. package/dist/utils/{type-generation.js → type-generation.mjs} +4 -9
  18. package/package.json +1 -1
  19. package/dist/routes/apollo-server.d.ts +0 -6
  20. package/dist/routes/graphql-yoga.d.ts +0 -6
  21. /package/dist/ecosystem/{nuxt.d.ts → nuxt.d.mts} +0 -0
  22. /package/dist/graphql/{index.d.ts → index.d.mts} +0 -0
  23. /package/dist/graphql/{index.js → index.mjs} +0 -0
  24. /package/dist/graphql/{server.d.ts → server.d.mts} +0 -0
  25. /package/dist/graphql/{server.js → server.mjs} +0 -0
  26. /package/dist/routes/{apollo-server.js → apollo-server.mjs} +0 -0
  27. /package/dist/routes/{debug.js → debug.mjs} +0 -0
  28. /package/dist/routes/{graphql-yoga.js → graphql-yoga.mjs} +0 -0
  29. /package/dist/routes/{health.js → health.mjs} +0 -0
  30. /package/dist/utils/{apollo.d.ts → apollo.d.mts} +0 -0
  31. /package/dist/utils/{apollo.js → apollo.mjs} +0 -0
  32. /package/dist/utils/{client-codegen.js → client-codegen.mjs} +0 -0
  33. /package/dist/utils/{define.d.ts → define.d.mts} +0 -0
  34. /package/dist/utils/{define.js → define.mjs} +0 -0
  35. /package/dist/utils/{directive-parser.d.ts → directive-parser.d.mts} +0 -0
  36. /package/dist/utils/{directive-parser.js → directive-parser.mjs} +0 -0
  37. /package/dist/utils/{file-generator.d.ts → file-generator.d.mts} +0 -0
  38. /package/dist/utils/{file-generator.js → file-generator.mjs} +0 -0
  39. /package/dist/utils/{path-resolver.js → path-resolver.mjs} +0 -0
  40. /package/dist/utils/{type-generation.d.ts → type-generation.d.mts} +0 -0
@@ -1,4 +1,4 @@
1
- import { getDefaultPaths, getTypesConfig, resolveFilePath } from "../utils/path-resolver.js";
1
+ import { getDefaultPaths, getTypesConfig, resolveFilePath } from "../utils/path-resolver.mjs";
2
2
  import { existsSync, mkdirSync, writeFileSync } from "node:fs";
3
3
  import { dirname, join, relative, resolve } from "pathe";
4
4
  import { defineNuxtModule, getLayerDirectories } from "@nuxt/kit";
@@ -1,8 +1,7 @@
1
- import { StandardSchemaV1 } from "./types/standard-schema.js";
2
- import { ClientUtilsConfig, CodegenClientConfig, CodegenServerConfig, ExternalGraphQLService, ExternalServicePaths, FederationConfig, FileGenerationConfig, GenImport, GenericSdkConfig, NitroGraphQLOptions, PathsConfig, ScaffoldConfig, SdkConfig, TypesConfig } from "./types/index.js";
3
- import * as nitropack0 from "nitropack";
1
+ import { StandardSchemaV1 } from "./types/standard-schema.mjs";
2
+ import { ClientUtilsConfig, CodegenClientConfig, CodegenServerConfig, ExternalGraphQLService, ExternalServicePaths, FederationConfig, FileGenerationConfig, GenImport, GenericSdkConfig, NitroGraphQLOptions, PathsConfig, ScaffoldConfig, SdkConfig, TypesConfig } from "./types/index.mjs";
4
3
 
5
4
  //#region src/index.d.ts
6
- declare const _default: nitropack0.NitroModule;
5
+ declare const _default: any;
7
6
  //#endregion
8
7
  export { ClientUtilsConfig, CodegenClientConfig, CodegenServerConfig, ExternalGraphQLService, ExternalServicePaths, FederationConfig, FileGenerationConfig, GenImport, GenericSdkConfig, NitroGraphQLOptions, PathsConfig, ScaffoldConfig, SdkConfig, StandardSchemaV1, TypesConfig, _default as default };
@@ -1,9 +1,9 @@
1
- import { generateDirectiveSchemas } from "./utils/directive-parser.js";
2
- import { generateLayerIgnorePatterns, getLayerAppDirectories, getLayerServerDirectories, relativeWithDot, scanDirectives, scanDocs, scanResolvers, scanSchemas, validateExternalServices } from "./utils/index.js";
3
- import { writeFileIfNotExists } from "./utils/file-generator.js";
4
- import { getDefaultPaths, getScaffoldConfig, getTypesConfig, resolveFilePath, shouldGenerateScaffold } from "./utils/path-resolver.js";
5
- import { clientTypeGeneration, serverTypeGeneration } from "./utils/type-generation.js";
6
- import { rollupConfig } from "./rollup.js";
1
+ import { generateDirectiveSchemas } from "./utils/directive-parser.mjs";
2
+ import { generateLayerIgnorePatterns, getLayerAppDirectories, getLayerServerDirectories, relativeWithDot, scanDirectives, scanDocs, scanResolvers, scanSchemas, validateExternalServices } from "./utils/index.mjs";
3
+ import { writeFileIfNotExists } from "./utils/file-generator.mjs";
4
+ import { getDefaultPaths, getScaffoldConfig, getTypesConfig, resolveFilePath, shouldGenerateScaffold } from "./utils/path-resolver.mjs";
5
+ import { clientTypeGeneration, serverTypeGeneration } from "./utils/type-generation.mjs";
6
+ import { rollupConfig } from "./rollup.mjs";
7
7
  import { existsSync, mkdirSync } from "node:fs";
8
8
  import { fileURLToPath } from "node:url";
9
9
  import { watch } from "chokidar";
@@ -237,17 +237,8 @@ var src_default = defineNitroModule({
237
237
  ...placeholders,
238
238
  serviceName: service.name
239
239
  };
240
- consola.info(`[DEBUG] External service: ${service.name}`);
241
- consola.info("[DEBUG] service.paths:", service.paths);
242
- consola.info("[DEBUG] service.paths?.types:", service.paths?.types);
243
- consola.info("[DEBUG] typesConfig.external:", typesConfig.external);
244
240
  const externalTypesPath = resolveFilePath(service.paths?.types ?? typesConfig.external, typesConfig.enabled, true, "{typesDir}/nitro-graphql-client-{serviceName}.d.ts", servicePlaceholders);
245
- consola.info("[DEBUG] externalTypesPath after resolveFilePath:", externalTypesPath);
246
- if (externalTypesPath) {
247
- const relativePath = relativeWithDot(tsconfigDir, externalTypesPath);
248
- consola.info("[DEBUG] relativePath after relativeWithDot:", relativePath);
249
- types.tsConfig.compilerOptions.paths[`#graphql/client/${service.name}`] = [relativePath];
250
- }
241
+ if (externalTypesPath) types.tsConfig.compilerOptions.paths[`#graphql/client/${service.name}`] = [relativeWithDot(tsconfigDir, externalTypesPath)];
251
242
  }
252
243
  types.tsConfig.include = types.tsConfig.include || [];
253
244
  if (serverTypesPath) types.tsConfig.include.push(relativeWithDot(tsconfigDir, serverTypesPath));
@@ -1,5 +1,5 @@
1
- import { getImportId, scanGraphql } from "./utils/index.js";
2
- import { clientTypeGeneration, serverTypeGeneration } from "./utils/type-generation.js";
1
+ import { getImportId, scanGraphql } from "./utils/index.mjs";
2
+ import { clientTypeGeneration, serverTypeGeneration } from "./utils/type-generation.mjs";
3
3
  import { resolve } from "pathe";
4
4
  import { readFile } from "node:fs/promises";
5
5
  import { parse } from "graphql";
@@ -0,0 +1,6 @@
1
+ import * as h30 from "h3";
2
+
3
+ //#region src/routes/apollo-server.d.ts
4
+ declare const _default: h30.EventHandlerWithFetch<h30.EventHandlerRequest, Promise<any>>;
5
+ //#endregion
6
+ export { _default as default };
@@ -10,7 +10,7 @@ import * as h33 from "h3";
10
10
  * - /_nitro/graphql/debug - HTML dashboard
11
11
  * - /_nitro/graphql/debug?format=json - JSON API
12
12
  */
13
- declare const _default: h33.EventHandler<h33.EventHandlerRequest, Promise<string | {
13
+ declare const _default: h33.EventHandlerWithFetch<h33.EventHandlerRequest, Promise<string | {
14
14
  timestamp: string;
15
15
  environment: {
16
16
  dev: any;
@@ -0,0 +1,6 @@
1
+ import * as h35 from "h3";
2
+
3
+ //#region src/routes/graphql-yoga.d.ts
4
+ declare const _default: h35.EventHandlerWithFetch<h35.EventHandlerRequest, Promise<Response>>;
5
+ //#endregion
6
+ export { _default as default };
@@ -1,7 +1,7 @@
1
1
  import * as h31 from "h3";
2
2
 
3
3
  //#region src/routes/health.d.ts
4
- declare const _default: h31.EventHandler<h31.EventHandlerRequest, Promise<{
4
+ declare const _default: h31.EventHandlerWithFetch<h31.EventHandlerRequest, Promise<{
5
5
  status: string;
6
6
  message: string;
7
7
  timestamp: string;
@@ -1,4 +1,4 @@
1
- import { StandardSchemaV1 } from "./standard-schema.js";
1
+ import { StandardSchemaV1 } from "./standard-schema.mjs";
2
2
  import { ESMCodeGenOptions } from "knitwork";
3
3
  import { IResolvers } from "@graphql-tools/utils";
4
4
  import { TypeScriptPluginConfig } from "@graphql-codegen/typescript";
@@ -1,8 +1,8 @@
1
1
  //#region src/types/standard-schema.d.ts
2
2
  /** The Standard Schema interface. */
3
- interface StandardSchemaV1<Input$1 = unknown, Output$1 = Input$1> {
3
+ interface StandardSchemaV1<Input = unknown, Output = Input> {
4
4
  /** The Standard Schema properties. */
5
- readonly '~standard': StandardSchemaV1.Props<Input$1, Output$1>;
5
+ readonly '~standard': StandardSchemaV1.Props<Input, Output>;
6
6
  }
7
7
  declare namespace StandardSchemaV1 {
8
8
  /** The Standard Schema properties interface. */
@@ -1,4 +1,4 @@
1
- import { CodegenClientConfig, ExternalGraphQLService, GenericSdkConfig } from "../types/index.js";
1
+ import { CodegenClientConfig, ExternalGraphQLService, GenericSdkConfig } from "../types/index.mjs";
2
2
  import { GraphQLSchema } from "graphql";
3
3
  import { Source } from "@graphql-tools/utils";
4
4
  import { LoadSchemaOptions, UnnormalizedTypeDefPointer } from "@graphql-tools/load";
@@ -1,5 +1,5 @@
1
- import { GenImport } from "../types/index.js";
2
- import { directiveParser, generateDirectiveSchema, generateDirectiveSchemas } from "./directive-parser.js";
1
+ import { GenImport } from "../types/index.mjs";
2
+ import { directiveParser, generateDirectiveSchema, generateDirectiveSchemas } from "./directive-parser.mjs";
3
3
  import { Nitro } from "nitropack";
4
4
 
5
5
  //#region src/utils/index.d.ts
@@ -1,4 +1,4 @@
1
- import { directiveParser, generateDirectiveSchema, generateDirectiveSchemas } from "./directive-parser.js";
1
+ import { directiveParser, generateDirectiveSchema, generateDirectiveSchemas } from "./directive-parser.mjs";
2
2
  import { join, relative } from "pathe";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import { hash } from "ohash";
@@ -1,4 +1,4 @@
1
- import { ClientUtilsConfig, FileGenerationConfig, ScaffoldConfig, SdkConfig, TypesConfig } from "../types/index.js";
1
+ import { ClientUtilsConfig, FileGenerationConfig, ScaffoldConfig, SdkConfig, TypesConfig } from "../types/index.mjs";
2
2
  import { Nitro } from "nitropack/types";
3
3
 
4
4
  //#region src/utils/path-resolver.d.ts
@@ -1,4 +1,4 @@
1
- import { NitroGraphQLOptions } from "../types/index.js";
1
+ import { NitroGraphQLOptions } from "../types/index.mjs";
2
2
  import { GraphQLSchema } from "graphql";
3
3
 
4
4
  //#region src/utils/server-codegen.d.ts
@@ -103,12 +103,14 @@ type ResolverReturnType<T> = T extends BuiltIns
103
103
  ? T
104
104
  : T extends (...args: any[]) => unknown
105
105
  ? T | undefined
106
+ : T extends { __typename?: any }
107
+ ? T
106
108
  : T extends object
107
109
  ? T extends Array<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
108
110
  ? ItemType[] extends T // Test for arrays (non-tuples) specifically
109
111
  ? Array<ResolverReturnType<ItemType>>
110
- : ResolverReturnTypeObject<T> // Tuples behave properly
111
- : ResolverReturnTypeObject<T>
112
+ : { [K in keyof T]: ResolverReturnType<T[K]> }
113
+ : { [K in keyof T]: ResolverReturnType<T[K]> }
112
114
  : unknown;
113
115
 
114
116
  type ResolverReturnTypeObject<T extends object> =
@@ -1,7 +1,7 @@
1
- import { downloadAndSaveSchema, generateClientTypes, generateExternalClientTypes, loadExternalSchema, loadGraphQLDocuments } from "./client-codegen.js";
2
- import { writeFileIfNotExists } from "./file-generator.js";
3
- import { getClientUtilsConfig, getDefaultPaths, getSdkConfig, getTypesConfig, resolveFilePath, shouldGenerateClientUtils, shouldGenerateTypes } from "./path-resolver.js";
4
- import { generateTypes } from "./server-codegen.js";
1
+ import { downloadAndSaveSchema, generateClientTypes, generateExternalClientTypes, loadExternalSchema, loadGraphQLDocuments } from "./client-codegen.mjs";
2
+ import { writeFileIfNotExists } from "./file-generator.mjs";
3
+ import { getClientUtilsConfig, getDefaultPaths, getSdkConfig, getTypesConfig, resolveFilePath, shouldGenerateClientUtils, shouldGenerateTypes } from "./path-resolver.mjs";
4
+ import { generateTypes } from "./server-codegen.mjs";
5
5
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
6
6
  import consola from "consola";
7
7
  import { basename, dirname, join, resolve } from "pathe";
@@ -336,12 +336,7 @@ async function generateExternalServicesTypes(nitro) {
336
336
  };
337
337
  const typesConfig = getTypesConfig(nitro);
338
338
  const sdkConfig = getSdkConfig(nitro);
339
- consola.info(`[TYPE-GEN DEBUG] External service: ${service.name}`);
340
- consola.info("[TYPE-GEN DEBUG] service.paths:", service.paths);
341
- consola.info("[TYPE-GEN DEBUG] service.paths?.types:", service.paths?.types);
342
- consola.info("[TYPE-GEN DEBUG] typesConfig.external:", typesConfig.external);
343
339
  const serviceTypesPath = resolveFilePath(service.paths?.types ?? typesConfig.external, typesConfig.enabled, true, "{typesDir}/nitro-graphql-client-{serviceName}.d.ts", placeholders);
344
- consola.info("[TYPE-GEN DEBUG] serviceTypesPath after resolveFilePath:", serviceTypesPath);
345
340
  if (serviceTypesPath) {
346
341
  mkdirSync(dirname(serviceTypesPath), { recursive: true });
347
342
  writeFileSync(serviceTypesPath, types.types, "utf-8");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nitro-graphql",
3
3
  "type": "module",
4
- "version": "1.5.5",
4
+ "version": "1.5.7",
5
5
  "description": "GraphQL integration for Nitro",
6
6
  "license": "MIT",
7
7
  "sideEffects": false,
@@ -1,6 +0,0 @@
1
- import * as h30 from "h3";
2
-
3
- //#region src/routes/apollo-server.d.ts
4
- declare const _default: h30.EventHandler<h30.EventHandlerRequest, Promise<any>>;
5
- //#endregion
6
- export { _default as default };
@@ -1,6 +0,0 @@
1
- import * as h35 from "h3";
2
-
3
- //#region src/routes/graphql-yoga.d.ts
4
- declare const _default: h35.EventHandler<h35.EventHandlerRequest, Promise<Response>>;
5
- //#endregion
6
- export { _default as default };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes