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.
- package/dist/ecosystem/{nuxt.js → nuxt.mjs} +1 -1
- package/dist/{index.d.ts → index.d.mts} +3 -4
- package/dist/{index.js → index.mjs} +7 -16
- package/dist/{rollup.js → rollup.mjs} +2 -2
- package/dist/routes/apollo-server.d.mts +6 -0
- package/dist/routes/{debug.d.ts → debug.d.mts} +1 -1
- package/dist/routes/graphql-yoga.d.mts +6 -0
- package/dist/routes/{health.d.ts → health.d.mts} +1 -1
- package/dist/types/{index.d.ts → index.d.mts} +1 -1
- package/dist/types/{standard-schema.d.ts → standard-schema.d.mts} +2 -2
- package/dist/utils/{client-codegen.d.ts → client-codegen.d.mts} +1 -1
- package/dist/utils/{index.d.ts → index.d.mts} +2 -2
- package/dist/utils/{index.js → index.mjs} +1 -1
- package/dist/utils/{path-resolver.d.ts → path-resolver.d.mts} +1 -1
- package/dist/utils/{server-codegen.d.ts → server-codegen.d.mts} +1 -1
- package/dist/utils/{server-codegen.js → server-codegen.mjs} +4 -2
- package/dist/utils/{type-generation.js → type-generation.mjs} +4 -9
- package/package.json +1 -1
- package/dist/routes/apollo-server.d.ts +0 -6
- package/dist/routes/graphql-yoga.d.ts +0 -6
- /package/dist/ecosystem/{nuxt.d.ts → nuxt.d.mts} +0 -0
- /package/dist/graphql/{index.d.ts → index.d.mts} +0 -0
- /package/dist/graphql/{index.js → index.mjs} +0 -0
- /package/dist/graphql/{server.d.ts → server.d.mts} +0 -0
- /package/dist/graphql/{server.js → server.mjs} +0 -0
- /package/dist/routes/{apollo-server.js → apollo-server.mjs} +0 -0
- /package/dist/routes/{debug.js → debug.mjs} +0 -0
- /package/dist/routes/{graphql-yoga.js → graphql-yoga.mjs} +0 -0
- /package/dist/routes/{health.js → health.mjs} +0 -0
- /package/dist/utils/{apollo.d.ts → apollo.d.mts} +0 -0
- /package/dist/utils/{apollo.js → apollo.mjs} +0 -0
- /package/dist/utils/{client-codegen.js → client-codegen.mjs} +0 -0
- /package/dist/utils/{define.d.ts → define.d.mts} +0 -0
- /package/dist/utils/{define.js → define.mjs} +0 -0
- /package/dist/utils/{directive-parser.d.ts → directive-parser.d.mts} +0 -0
- /package/dist/utils/{directive-parser.js → directive-parser.mjs} +0 -0
- /package/dist/utils/{file-generator.d.ts → file-generator.d.mts} +0 -0
- /package/dist/utils/{file-generator.js → file-generator.mjs} +0 -0
- /package/dist/utils/{path-resolver.js → path-resolver.mjs} +0 -0
- /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.
|
|
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.
|
|
2
|
-
import { ClientUtilsConfig, CodegenClientConfig, CodegenServerConfig, ExternalGraphQLService, ExternalServicePaths, FederationConfig, FileGenerationConfig, GenImport, GenericSdkConfig, NitroGraphQLOptions, PathsConfig, ScaffoldConfig, SdkConfig, TypesConfig } from "./types/index.
|
|
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:
|
|
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.
|
|
2
|
-
import { generateLayerIgnorePatterns, getLayerAppDirectories, getLayerServerDirectories, relativeWithDot, scanDirectives, scanDocs, scanResolvers, scanSchemas, validateExternalServices } from "./utils/index.
|
|
3
|
-
import { writeFileIfNotExists } from "./utils/file-generator.
|
|
4
|
-
import { getDefaultPaths, getScaffoldConfig, getTypesConfig, resolveFilePath, shouldGenerateScaffold } from "./utils/path-resolver.
|
|
5
|
-
import { clientTypeGeneration, serverTypeGeneration } from "./utils/type-generation.
|
|
6
|
-
import { rollupConfig } from "./rollup.
|
|
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
|
-
|
|
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.
|
|
2
|
-
import { clientTypeGeneration, serverTypeGeneration } from "./utils/type-generation.
|
|
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";
|
|
@@ -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.
|
|
13
|
+
declare const _default: h33.EventHandlerWithFetch<h33.EventHandlerRequest, Promise<string | {
|
|
14
14
|
timestamp: string;
|
|
15
15
|
environment: {
|
|
16
16
|
dev: any;
|
|
@@ -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.
|
|
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.
|
|
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
|
|
3
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
4
4
|
/** The Standard Schema properties. */
|
|
5
|
-
readonly '~standard': StandardSchemaV1.Props<Input
|
|
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.
|
|
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.
|
|
2
|
-
import { directiveParser, generateDirectiveSchema, generateDirectiveSchemas } from "./directive-parser.
|
|
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.
|
|
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.
|
|
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
|
|
@@ -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
|
-
:
|
|
111
|
-
:
|
|
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.
|
|
2
|
-
import { writeFileIfNotExists } from "./file-generator.
|
|
3
|
-
import { getClientUtilsConfig, getDefaultPaths, getSdkConfig, getTypesConfig, resolveFilePath, shouldGenerateClientUtils, shouldGenerateTypes } from "./path-resolver.
|
|
4
|
-
import { generateTypes } from "./server-codegen.
|
|
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
|
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
|
|
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
|