nitro-graphql 2.0.0-beta.70 → 2.0.0-beta.73
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 +1 -1
- package/dist/cli/adapter.d.mts +0 -3
- package/dist/cli/adapter.mjs +7 -32
- package/dist/cli/commands/build.d.mts +2 -2
- package/dist/cli/commands/build.mjs +1 -3
- package/dist/cli/commands/dev.d.mts +2 -2
- package/dist/cli/commands/dev.mjs +1 -3
- package/dist/cli/commands/generate.mjs +10 -10
- package/dist/cli/commands/init.mjs +4 -4
- package/dist/cli/commands/validate.mjs +1 -3
- package/dist/cli/completions.mjs +1 -3
- package/dist/cli/config.d.mts +4 -5
- package/dist/cli/config.mjs +4 -3
- package/dist/cli/index.d.mts +3 -6
- package/dist/cli/index.mjs +2 -4
- package/dist/cli/server/debug-handler.mjs +2 -5
- package/dist/cli/server/dev-server.mjs +1 -3
- package/dist/cli/server/graphql-handler.mjs +3 -4
- package/dist/cli/server/health-handler.mjs +1 -2
- package/dist/cli/server/loader.mjs +1 -3
- package/dist/cli/server/sandbox-handler.mjs +1 -3
- package/dist/cli/server/watcher.mjs +2 -4
- package/dist/cli/server/ws-handler.mjs +1 -3
- package/dist/config.mjs +1 -2
- package/dist/core/codegen/client.d.mts +4 -27
- package/dist/core/codegen/client.mjs +26 -447
- package/dist/core/codegen/document-loader.mjs +1 -3
- package/dist/core/codegen/file-header.d.mts +7 -0
- package/dist/core/codegen/file-header.mjs +12 -0
- package/dist/core/codegen/index.d.mts +7 -5
- package/dist/core/codegen/index.mjs +7 -6
- package/dist/core/codegen/{runtime.d.mts → runtime-generator.d.mts} +1 -3
- package/dist/core/codegen/{runtime.mjs → runtime-generator.mjs} +7 -6
- package/dist/core/codegen/schema-loader.d.mts +2 -7
- package/dist/core/codegen/schema-loader.mjs +66 -73
- package/dist/core/codegen/server-type-helpers.d.mts +14 -0
- package/dist/core/codegen/server-type-helpers.mjs +76 -0
- package/dist/core/codegen/server.d.mts +1 -15
- package/dist/core/codegen/server.mjs +15 -107
- package/dist/core/codegen/subscription-extractor.d.mts +20 -0
- package/dist/core/codegen/subscription-extractor.mjs +30 -0
- package/dist/core/codegen/validation.mjs +1 -3
- package/dist/core/codegen/vue-subscription-builder.d.mts +10 -0
- package/dist/core/codegen/vue-subscription-builder.mjs +351 -0
- package/dist/core/constants.d.mts +5 -53
- package/dist/core/constants.mjs +13 -56
- package/dist/core/create-config.d.mts +31 -0
- package/dist/core/create-config.mjs +42 -0
- package/dist/core/debug/index.d.mts +2 -2
- package/dist/core/debug/index.mjs +2 -3
- package/dist/core/debug/template.d.mts +1 -5
- package/dist/core/debug/template.mjs +5 -4
- package/dist/core/extend/index.mjs +1 -2
- package/dist/core/extend/loader.d.mts +0 -1
- package/dist/core/extend/loader.mjs +60 -92
- package/dist/core/index.d.mts +22 -21
- package/dist/core/index.mjs +19 -16
- package/dist/core/manifest.mjs +4 -4
- package/dist/core/pubsub/index.d.mts +2 -109
- package/dist/core/pubsub/index.mjs +2 -148
- package/dist/core/pubsub/memory-pubsub.d.mts +109 -0
- package/dist/core/pubsub/memory-pubsub.mjs +146 -0
- package/dist/core/scanning/ast-scanner.mjs +5 -5
- package/dist/core/scanning/directives.mjs +3 -5
- package/dist/core/scanning/documents.d.mts +4 -3
- package/dist/core/scanning/documents.mjs +4 -5
- package/dist/core/scanning/{common.d.mts → file-scanner.d.mts} +1 -1
- package/dist/core/scanning/{common.mjs → file-scanner.mjs} +3 -13
- package/dist/core/scanning/index.d.mts +3 -3
- package/dist/core/scanning/index.mjs +3 -4
- package/dist/core/scanning/resolvers.mjs +9 -11
- package/dist/core/scanning/schemas.d.mts +1 -5
- package/dist/core/scanning/schemas.mjs +2 -26
- package/dist/core/schema/builder.d.mts +4 -2
- package/dist/core/schema/builder.mjs +4 -4
- package/dist/core/schema/federation.mjs +1 -3
- package/dist/core/schema/index.d.mts +2 -2
- package/dist/core/schema/index.mjs +2 -3
- package/dist/core/server/apollo.d.mts +20 -0
- package/dist/core/server/apollo.mjs +54 -0
- package/dist/core/server/index.d.mts +4 -2
- package/dist/core/server/index.mjs +3 -3
- package/dist/core/server/sandbox.mjs +1 -2
- package/dist/core/server/types.d.mts +7 -14
- package/dist/core/server/types.mjs +15 -1
- package/dist/core/server/yoga.d.mts +1 -7
- package/dist/core/server/yoga.mjs +4 -15
- package/dist/core/types/adapter.d.mts +3 -40
- package/dist/core/types/adapter.mjs +1 -1
- package/dist/core/types/codegen.d.mts +22 -45
- package/dist/core/types/codegen.mjs +1 -1
- package/dist/core/types/config.d.mts +33 -121
- package/dist/core/types/config.mjs +1 -1
- package/dist/core/types/define.d.mts +8 -5
- package/dist/core/types/define.mjs +1 -1
- package/dist/core/types/index.d.mts +5 -4
- package/dist/core/types/index.mjs +1 -1
- package/dist/core/types/scanning.d.mts +4 -1
- package/dist/core/types/scanning.mjs +1 -1
- package/dist/core/types/standard-schema.d.mts +64 -0
- package/dist/core/types/standard-schema.mjs +1 -0
- package/dist/core/utils/directive-parser.d.mts +8 -63
- package/dist/core/utils/directive-parser.mjs +114 -167
- package/dist/core/utils/errors.mjs +1 -3
- package/dist/core/utils/file-io.d.mts +1 -5
- package/dist/core/utils/file-io.mjs +1 -13
- package/dist/core/utils/imports.mjs +3 -4
- package/dist/core/utils/index.d.mts +5 -4
- package/dist/core/utils/index.mjs +6 -6
- package/dist/core/utils/logger.d.mts +1 -10
- package/dist/core/utils/logger.mjs +1 -21
- package/dist/core/utils/ofetch-templates.mjs +4 -6
- package/dist/core/utils/runtime.d.mts +1 -30
- package/dist/core/utils/runtime.mjs +2 -46
- package/dist/core/utils/string.d.mts +10 -0
- package/dist/core/utils/string.mjs +12 -0
- package/dist/core/utils/subscribe-templates.mjs +1 -2
- package/dist/core/validation/external-services.mjs +3 -3
- package/dist/core/validation/index.mjs +1 -2
- package/dist/core/watcher/create-watcher.d.mts +103 -0
- package/dist/core/watcher/create-watcher.mjs +143 -0
- package/dist/core/watcher/index.d.mts +2 -107
- package/dist/core/watcher/index.mjs +2 -141
- package/dist/define.d.mts +4 -2
- package/dist/define.mjs +8 -9
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +3 -4
- package/dist/nitro/adapter.d.mts +6 -11
- package/dist/nitro/adapter.mjs +12 -45
- package/dist/nitro/apollo.mjs +1 -3
- package/dist/nitro/codegen/client-types.d.mts +12 -0
- package/dist/nitro/codegen/client-types.mjs +73 -0
- package/dist/nitro/codegen/external-types.d.mts +8 -0
- package/dist/nitro/codegen/external-types.mjs +47 -0
- package/dist/nitro/codegen/index.d.mts +4 -0
- package/dist/nitro/codegen/index.mjs +4 -0
- package/dist/nitro/codegen/server-types.d.mts +12 -0
- package/dist/nitro/codegen/server-types.mjs +81 -0
- package/dist/nitro/defaults.d.mts +28 -0
- package/dist/nitro/defaults.mjs +34 -0
- package/dist/nitro/index.d.mts +11 -3
- package/dist/nitro/index.mjs +4 -6
- package/dist/nitro/paths.d.mts +3 -2
- package/dist/nitro/paths.mjs +14 -5
- package/dist/nitro/rollup.mjs +8 -8
- package/dist/nitro/routes/_ws-handler.d.mts +6 -0
- package/dist/nitro/routes/_ws-handler.mjs +49 -0
- package/dist/nitro/routes/apollo-sandbox-script.d.mts +2 -2
- package/dist/nitro/routes/apollo-sandbox-script.mjs +1 -3
- package/dist/nitro/routes/apollo-server-ws.d.mts +1 -1
- package/dist/nitro/routes/apollo-server-ws.mjs +10 -48
- package/dist/nitro/routes/apollo-server.d.mts +2 -2
- package/dist/nitro/routes/apollo-server.mjs +17 -58
- package/dist/nitro/routes/debug.d.mts +2 -2
- package/dist/nitro/routes/debug.mjs +4 -7
- package/dist/nitro/routes/graphql-yoga-ws.d.mts +3 -3
- package/dist/nitro/routes/graphql-yoga-ws.mjs +7 -48
- package/dist/nitro/routes/graphql-yoga.d.mts +2 -2
- package/dist/nitro/routes/graphql-yoga.mjs +8 -8
- package/dist/nitro/routes/health.d.mts +2 -2
- package/dist/nitro/routes/health.mjs +23 -27
- package/dist/nitro/setup/extend-loader.d.mts +6 -5
- package/dist/nitro/setup/extend-loader.mjs +31 -61
- package/dist/nitro/setup/file-watcher.mjs +9 -8
- package/dist/nitro/setup/logging.d.mts +1 -8
- package/dist/nitro/setup/logging.mjs +7 -24
- package/dist/nitro/setup/rollup-integration.mjs +36 -4
- package/dist/nitro/setup/routes.mjs +1 -3
- package/dist/nitro/setup/scanner.d.mts +8 -43
- package/dist/nitro/setup/scanner.mjs +56 -60
- package/dist/nitro/setup/security.d.mts +10 -0
- package/dist/nitro/setup/security.mjs +17 -0
- package/dist/nitro/setup/ts-config.mjs +1 -3
- package/dist/nitro/setup/type-generation.d.mts +13 -0
- package/dist/nitro/setup/type-generation.mjs +16 -0
- package/dist/nitro/setup.d.mts +4 -3
- package/dist/nitro/setup.mjs +88 -77
- package/dist/nitro/state.d.mts +32 -0
- package/dist/nitro/state.mjs +58 -0
- package/dist/nitro/types/augmentation.d.mts +59 -0
- package/dist/nitro/types/augmentation.mjs +1 -0
- package/dist/nitro/types/config.d.mts +327 -0
- package/dist/nitro/types/config.mjs +1 -0
- package/dist/nitro/types/define.d.mts +13 -0
- package/dist/nitro/types/define.mjs +1 -0
- package/dist/nitro/types/index.d.mts +10 -0
- package/dist/nitro/types/index.mjs +1 -0
- package/dist/nitro/virtual/debug-info.d.mts +9 -0
- package/dist/nitro/virtual/debug-info.mjs +35 -0
- package/dist/nitro/virtual/graphql-config.d.mts +9 -0
- package/dist/nitro/virtual/graphql-config.mjs +33 -0
- package/dist/nitro/virtual/index.d.mts +25 -0
- package/dist/nitro/virtual/index.mjs +45 -0
- package/dist/nitro/virtual/module-config.d.mts +9 -0
- package/dist/nitro/virtual/module-config.mjs +10 -0
- package/dist/nitro/virtual/pubsub.d.mts +9 -0
- package/dist/nitro/virtual/pubsub.mjs +17 -0
- package/dist/nitro/virtual/server-directives.d.mts +9 -0
- package/dist/nitro/virtual/server-directives.mjs +12 -0
- package/dist/nitro/virtual/server-resolvers.d.mts +9 -0
- package/dist/nitro/virtual/server-resolvers.mjs +17 -0
- package/dist/nitro/virtual/server-schemas.d.mts +9 -0
- package/dist/nitro/virtual/server-schemas.mjs +31 -0
- package/dist/nitro/virtual/stubs.d.mts +42 -10
- package/dist/nitro/virtual/stubs.mjs +1 -7
- package/dist/nitro/virtual/utils.d.mts +15 -0
- package/dist/nitro/virtual/utils.mjs +26 -0
- package/dist/nitro/virtual/validation-schemas.d.mts +9 -0
- package/dist/nitro/virtual/validation-schemas.mjs +33 -0
- package/dist/nuxt.mjs +4 -5
- package/dist/stubs/index.mjs +1 -1
- package/dist/subscribe/index.mjs +3 -4
- package/native/index.js +52 -52
- package/package.json +41 -41
- package/dist/cli/commands/index.d.mts +0 -5
- package/dist/cli/commands/index.mjs +0 -6
- package/dist/core/codegen/plugin.d.mts +0 -19
- package/dist/core/codegen/plugin.mjs +0 -30
- package/dist/core/config.d.mts +0 -45
- package/dist/core/config.mjs +0 -78
- package/dist/nitro/codegen.d.mts +0 -18
- package/dist/nitro/codegen.mjs +0 -173
- package/dist/nitro/config.d.mts +0 -50
- package/dist/nitro/config.mjs +0 -57
- package/dist/nitro/types.d.mts +0 -549
- package/dist/nitro/types.mjs +0 -1
- package/dist/nitro/virtual/generators.d.mts +0 -38
- package/dist/nitro/virtual/generators.mjs +0 -192
package/dist/nitro/index.d.mts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ClientCodegenConfig, ExternalServiceCodegenConfig, SdkCodegenConfig, ServerCodegenConfig } from "../core/types/codegen.mjs";
|
|
2
|
+
import { CoreSecurityConfig } from "../core/types/config.mjs";
|
|
3
|
+
import { ResolverImport, ScannedResolver } from "../core/types/scanning.mjs";
|
|
4
|
+
import { DefineDirectiveConfig, DirectiveArg, DirectiveArgument, DirectiveDefinition, DirectiveLocationName, Flatten, GraphQLArgumentType, GraphQLBaseType, GraphQLScalarType } from "../core/types/define.mjs";
|
|
5
|
+
import { StandardSchemaV1 } from "../core/types/standard-schema.mjs";
|
|
6
|
+
import { DefineServerConfig } from "./types/define.mjs";
|
|
7
|
+
import { LocalDirExtendSource } from "../core/extend/loader.mjs";
|
|
8
|
+
import { CLIGraphQLOptions, ClientUtilsConfig, ExplicitPathsExtendSource, ExtendSource, ExternalGraphQLService, ExternalServicePaths, FederationConfig, FileGenerationConfig, NitroGraphQLOptions, PathsConfig, PubSubConfig, RuntimeConfig, SSETransportConfig, SdkConfig, SubscriptionsConfig, TypesConfig, WatchConfig, WebSocketTransportConfig } from "./types/config.mjs";
|
|
9
|
+
import { GraphQLScanState } from "./types/augmentation.mjs";
|
|
2
10
|
import { NitroAdapter } from "./adapter.mjs";
|
|
3
|
-
import { resolveSecurityConfig } from "./setup/
|
|
11
|
+
import { resolveSecurityConfig } from "./setup/security.mjs";
|
|
4
12
|
import { setupNitroGraphQL } from "./setup.mjs";
|
|
5
13
|
import { NitroModule } from "nitro/types";
|
|
6
14
|
import { Plugin } from "vite";
|
|
@@ -42,4 +50,4 @@ declare function graphqlModule(options?: NitroGraphQLOptions): Plugin & {
|
|
|
42
50
|
nitro: NitroModule;
|
|
43
51
|
};
|
|
44
52
|
//#endregion
|
|
45
|
-
export { ClientUtilsConfig, CodegenClientConfig, CodegenServerConfig, DefineDirectiveConfig, DefineServerConfig, DirectiveArgument, DirectiveDefinition, ExplicitPathsExtendSource, ExtendSource, ExternalGraphQLService, ExternalServicePaths, FederationConfig, FileGenerationConfig, Flatten,
|
|
53
|
+
export { CLIGraphQLOptions, ClientCodegenConfig, ClientUtilsConfig, ClientCodegenConfig as CodegenClientConfig, ServerCodegenConfig as CodegenServerConfig, DefineDirectiveConfig, DefineServerConfig, DirectiveArg, DirectiveArgument, DirectiveDefinition, DirectiveLocationName, ExplicitPathsExtendSource, ExtendSource, ExternalGraphQLService, ExternalServiceCodegenConfig, ExternalServicePaths, FederationConfig, FileGenerationConfig, Flatten, SdkCodegenConfig as GenericSdkConfig, GraphQLArgumentType, GraphQLBaseType, GraphQLScalarType, GraphQLScanState, LocalDirExtendSource, NitroAdapter, NitroGraphQLOptions, PathsConfig, PubSubConfig, ResolverImport, RuntimeConfig, SSETransportConfig, ScannedResolver, SdkCodegenConfig, SdkConfig, CoreSecurityConfig as SecurityConfig, ServerCodegenConfig, StandardSchemaV1, SubscriptionsConfig, TypesConfig, WatchConfig, WebSocketTransportConfig, graphqlModule as default, resolveSecurityConfig, setupNitroGraphQL };
|
package/dist/nitro/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { NitroAdapter } from "./adapter.mjs";
|
|
2
|
-
import { resolveSecurityConfig } from "./setup/
|
|
2
|
+
import { resolveSecurityConfig } from "./setup/security.mjs";
|
|
3
3
|
import { setupNitroGraphQL } from "./setup.mjs";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
5
5
|
import defu from "defu";
|
|
6
|
-
|
|
7
6
|
//#region src/nitro/index.ts
|
|
7
|
+
const GRAPHQL_FILE_RE = /\.(?:graphql|gql)$/i;
|
|
8
8
|
/**
|
|
9
9
|
* Vite plugin to load GraphQL files as strings AND auto-register Nitro module
|
|
10
10
|
* This prevents Vite from trying to parse .graphql/.gql files as JavaScript
|
|
@@ -42,7 +42,7 @@ function graphqlModule(options) {
|
|
|
42
42
|
name: "nitro-graphql",
|
|
43
43
|
enforce: "pre",
|
|
44
44
|
async load(id) {
|
|
45
|
-
if (
|
|
45
|
+
if (!GRAPHQL_FILE_RE.test(id)) return null;
|
|
46
46
|
try {
|
|
47
47
|
const content = await readFile(id, "utf-8");
|
|
48
48
|
return `export default ${JSON.stringify(content)}`;
|
|
@@ -59,7 +59,5 @@ function graphqlModule(options) {
|
|
|
59
59
|
} }
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
var nitro_default = graphqlModule;
|
|
63
|
-
|
|
64
62
|
//#endregion
|
|
65
|
-
export { NitroAdapter,
|
|
63
|
+
export { NitroAdapter, graphqlModule as default, resolveSecurityConfig, setupNitroGraphQL };
|
package/dist/nitro/paths.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FileGenerationConfig, SdkConfig, TypesConfig } from "./types.mjs";
|
|
1
|
+
import { FileGenerationConfig, SdkConfig, TypesConfig } from "./types/config.mjs";
|
|
2
2
|
import { Nitro } from "nitro/types";
|
|
3
3
|
|
|
4
4
|
//#region src/nitro/paths.d.ts
|
|
@@ -16,7 +16,8 @@ interface PathPlaceholders {
|
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Replace placeholders in a path string
|
|
19
|
-
*
|
|
19
|
+
* Matches any `{key}` and resolves from the placeholders record.
|
|
20
|
+
* Unknown keys pass through unchanged. `{serviceName}` defaults to 'default'.
|
|
20
21
|
*/
|
|
21
22
|
declare function replacePlaceholders(path: string, placeholders: PathPlaceholders): string;
|
|
22
23
|
/**
|
package/dist/nitro/paths.mjs
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { isAbsolute, resolve } from "pathe";
|
|
2
|
-
|
|
3
2
|
//#region src/nitro/paths.ts
|
|
3
|
+
const PLACEHOLDER_RE = /\{(\w+)\}/g;
|
|
4
4
|
/**
|
|
5
5
|
* Replace placeholders in a path string
|
|
6
|
-
*
|
|
6
|
+
* Matches any `{key}` and resolves from the placeholders record.
|
|
7
|
+
* Unknown keys pass through unchanged. `{serviceName}` defaults to 'default'.
|
|
7
8
|
*/
|
|
8
9
|
function replacePlaceholders(path, placeholders) {
|
|
9
|
-
|
|
10
|
+
const lookup = {
|
|
11
|
+
serviceName: placeholders.serviceName || "default",
|
|
12
|
+
buildDir: placeholders.buildDir,
|
|
13
|
+
rootDir: placeholders.rootDir,
|
|
14
|
+
framework: placeholders.framework,
|
|
15
|
+
typesDir: placeholders.typesDir,
|
|
16
|
+
serverDir: placeholders.serverDir,
|
|
17
|
+
clientDir: placeholders.clientDir
|
|
18
|
+
};
|
|
19
|
+
return path.replace(PLACEHOLDER_RE, (match, key) => lookup[key] ?? match);
|
|
10
20
|
}
|
|
11
21
|
/**
|
|
12
22
|
* Get default paths based on framework and user configuration
|
|
@@ -87,6 +97,5 @@ function getTypesConfig(nitro) {
|
|
|
87
97
|
if (typesConfig === false) return { enabled: false };
|
|
88
98
|
return typesConfig || {};
|
|
89
99
|
}
|
|
90
|
-
|
|
91
100
|
//#endregion
|
|
92
|
-
export { getDefaultPaths, getSdkConfig, getTypesConfig, replacePlaceholders, resolveFilePath, shouldGenerateFile, shouldGenerateSdk, shouldGenerateTypes };
|
|
101
|
+
export { getDefaultPaths, getSdkConfig, getTypesConfig, replacePlaceholders, resolveFilePath, shouldGenerateFile, shouldGenerateSdk, shouldGenerateTypes };
|
package/dist/nitro/rollup.mjs
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { scanSchemasCore } from "../core/scanning/schemas.mjs";
|
|
2
|
+
import { createScanContextFromNitro } from "./adapter.mjs";
|
|
3
|
+
import { registerAllVirtualModules } from "./virtual/index.mjs";
|
|
3
4
|
import { readFile } from "node:fs/promises";
|
|
4
5
|
import { parse } from "graphql";
|
|
5
|
-
|
|
6
6
|
//#region src/nitro/rollup.ts
|
|
7
|
+
const GRAPHQL_FILE_RE = /\.(?:graphql|gql)$/i;
|
|
7
8
|
async function rollupConfig(nitro) {
|
|
8
9
|
registerAllVirtualModules(nitro);
|
|
9
10
|
nitro.hooks.hook("rollup:before", (_, rollupConfig) => {
|
|
10
11
|
rollupConfig.plugins = rollupConfig.plugins || [];
|
|
11
|
-
const { include =
|
|
12
|
+
const { include = GRAPHQL_FILE_RE, exclude, validate = false } = nitro.options.graphql?.loader || {};
|
|
12
13
|
if (Array.isArray(rollupConfig.plugins)) {
|
|
13
14
|
rollupConfig.plugins.push({
|
|
14
15
|
name: "nitro-graphql",
|
|
15
16
|
resolveId: {
|
|
16
17
|
order: "pre",
|
|
17
18
|
handler(id) {
|
|
18
|
-
if (
|
|
19
|
+
if (GRAPHQL_FILE_RE.test(id)) return null;
|
|
19
20
|
}
|
|
20
21
|
},
|
|
21
22
|
load: {
|
|
@@ -40,7 +41,7 @@ async function rollupConfig(nitro) {
|
|
|
40
41
|
buildStart: {
|
|
41
42
|
order: "pre",
|
|
42
43
|
async handler() {
|
|
43
|
-
const result = await
|
|
44
|
+
const result = await scanSchemasCore(createScanContextFromNitro(nitro));
|
|
44
45
|
for (const file of result.items) this.addWatchFile(file);
|
|
45
46
|
}
|
|
46
47
|
}
|
|
@@ -48,6 +49,5 @@ async function rollupConfig(nitro) {
|
|
|
48
49
|
}
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
|
-
|
|
52
52
|
//#endregion
|
|
53
|
-
export { rollupConfig };
|
|
53
|
+
export { rollupConfig };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createMergedSchema } from "../../core/schema/builder.mjs";
|
|
2
|
+
import { handleProtocols } from "graphql-ws";
|
|
3
|
+
import { makeHooks } from "graphql-ws/use/crossws";
|
|
4
|
+
import { importedConfig } from "#nitro-graphql/graphql-config";
|
|
5
|
+
import { moduleConfig } from "#nitro-graphql/module-config";
|
|
6
|
+
import { directives } from "#nitro-graphql/server-directives";
|
|
7
|
+
import { resolvers } from "#nitro-graphql/server-resolvers";
|
|
8
|
+
import { schemas } from "#nitro-graphql/server-schemas";
|
|
9
|
+
//#region src/nitro/routes/_ws-handler.ts
|
|
10
|
+
let schema = null;
|
|
11
|
+
/**
|
|
12
|
+
* Get or create the merged GraphQL schema
|
|
13
|
+
*/
|
|
14
|
+
async function getSchema() {
|
|
15
|
+
if (!schema) schema = await createMergedSchema({
|
|
16
|
+
schemas,
|
|
17
|
+
resolvers,
|
|
18
|
+
directives,
|
|
19
|
+
moduleConfig
|
|
20
|
+
});
|
|
21
|
+
return schema;
|
|
22
|
+
}
|
|
23
|
+
const wsHooks = {
|
|
24
|
+
upgrade(request) {
|
|
25
|
+
const selected = handleProtocols(request.headers.get("sec-websocket-protocol") || "");
|
|
26
|
+
if (selected) return { headers: { "Sec-WebSocket-Protocol": selected } };
|
|
27
|
+
return {};
|
|
28
|
+
},
|
|
29
|
+
...makeHooks({
|
|
30
|
+
schema: () => getSchema(),
|
|
31
|
+
context: async (ctx) => {
|
|
32
|
+
const baseContext = { connectionParams: ctx.connectionParams };
|
|
33
|
+
if (typeof importedConfig.context === "function") {
|
|
34
|
+
const userContext = await importedConfig.context(baseContext);
|
|
35
|
+
return {
|
|
36
|
+
...baseContext,
|
|
37
|
+
...userContext
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (importedConfig.context && typeof importedConfig.context === "object") return {
|
|
41
|
+
...baseContext,
|
|
42
|
+
...importedConfig.context
|
|
43
|
+
};
|
|
44
|
+
return baseContext;
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
};
|
|
48
|
+
//#endregion
|
|
49
|
+
export { wsHooks };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as nitro_h30 from "nitro/h3";
|
|
2
2
|
|
|
3
3
|
//#region src/nitro/routes/apollo-sandbox-script.d.ts
|
|
4
|
-
declare const _default:
|
|
4
|
+
declare const _default: nitro_h30.EventHandlerWithFetch<nitro_h30.EventHandlerRequest, Promise<Response>>;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { _default as default };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createSandboxResponse } from "../../core/server/sandbox.mjs";
|
|
2
2
|
import { defineEventHandler } from "nitro/h3";
|
|
3
|
-
|
|
4
3
|
//#region src/nitro/routes/apollo-sandbox-script.ts
|
|
5
4
|
/**
|
|
6
5
|
* Proxy route for Apollo Sandbox script with long cache headers
|
|
@@ -9,6 +8,5 @@ import { defineEventHandler } from "nitro/h3";
|
|
|
9
8
|
var apollo_sandbox_script_default = defineEventHandler(async () => {
|
|
10
9
|
return createSandboxResponse();
|
|
11
10
|
});
|
|
12
|
-
|
|
13
11
|
//#endregion
|
|
14
|
-
export { apollo_sandbox_script_default as default };
|
|
12
|
+
export { apollo_sandbox_script_default as default };
|
|
@@ -3,7 +3,7 @@ import * as nitro_h30 from "nitro/h3";
|
|
|
3
3
|
//#region src/nitro/routes/apollo-server-ws.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Apollo Server WebSocket handler for subscriptions
|
|
6
|
-
* Uses graphql-ws
|
|
6
|
+
* Uses shared WebSocket handler with graphql-ws and crossws
|
|
7
7
|
*
|
|
8
8
|
* Note: This handler works independently from Apollo Server for subscriptions,
|
|
9
9
|
* as Apollo Server v5 requires separate WebSocket handling.
|
|
@@ -1,53 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { wsHooks } from "./_ws-handler.mjs";
|
|
2
2
|
import { defineWebSocketHandler } from "nitro/h3";
|
|
3
|
-
import { handleProtocols } from "graphql-ws";
|
|
4
|
-
import { makeHooks } from "graphql-ws/use/crossws";
|
|
5
|
-
import { importedConfig } from "#nitro-graphql/graphql-config";
|
|
6
|
-
import { moduleConfig } from "#nitro-graphql/module-config";
|
|
7
|
-
import { directives } from "#nitro-graphql/server-directives";
|
|
8
|
-
import { resolvers } from "#nitro-graphql/server-resolvers";
|
|
9
|
-
import { schemas } from "#nitro-graphql/server-schemas";
|
|
10
|
-
|
|
11
3
|
//#region src/nitro/routes/apollo-server-ws.ts
|
|
12
|
-
let schema = null;
|
|
13
4
|
/**
|
|
14
|
-
*
|
|
5
|
+
* Apollo Server WebSocket handler for subscriptions
|
|
6
|
+
* Uses shared WebSocket handler with graphql-ws and crossws
|
|
7
|
+
*
|
|
8
|
+
* Note: This handler works independently from Apollo Server for subscriptions,
|
|
9
|
+
* as Apollo Server v5 requires separate WebSocket handling.
|
|
10
|
+
*
|
|
11
|
+
* @see https://github.com/enisdenjo/graphql-ws
|
|
15
12
|
*/
|
|
16
|
-
|
|
17
|
-
if (!schema) schema = await createMergedSchema({
|
|
18
|
-
schemas,
|
|
19
|
-
resolvers,
|
|
20
|
-
directives,
|
|
21
|
-
moduleConfig
|
|
22
|
-
});
|
|
23
|
-
return schema;
|
|
24
|
-
}
|
|
25
|
-
const hooks = {
|
|
26
|
-
upgrade(request) {
|
|
27
|
-
const selected = handleProtocols(request.headers.get("sec-websocket-protocol") || "");
|
|
28
|
-
if (selected) return { headers: { "Sec-WebSocket-Protocol": selected } };
|
|
29
|
-
return {};
|
|
30
|
-
},
|
|
31
|
-
...makeHooks({
|
|
32
|
-
schema: () => getSchema(),
|
|
33
|
-
context: async (ctx) => {
|
|
34
|
-
const baseContext = { connectionParams: ctx.connectionParams };
|
|
35
|
-
if (typeof importedConfig.context === "function") {
|
|
36
|
-
const userContext = await importedConfig.context(baseContext);
|
|
37
|
-
return {
|
|
38
|
-
...baseContext,
|
|
39
|
-
...userContext
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
if (importedConfig.context && typeof importedConfig.context === "object") return {
|
|
43
|
-
...baseContext,
|
|
44
|
-
...importedConfig.context
|
|
45
|
-
};
|
|
46
|
-
return baseContext;
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
};
|
|
50
|
-
var apollo_server_ws_default = defineWebSocketHandler(hooks);
|
|
51
|
-
|
|
13
|
+
var apollo_server_ws_default = defineWebSocketHandler(wsHooks);
|
|
52
14
|
//#endregion
|
|
53
|
-
export { apollo_server_ws_default as default };
|
|
15
|
+
export { apollo_server_ws_default as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as nitro_h30 from "nitro/h3";
|
|
2
2
|
|
|
3
3
|
//#region src/nitro/routes/apollo-server.d.ts
|
|
4
|
-
declare const _default:
|
|
4
|
+
declare const _default: nitro_h30.EventHandlerWithFetch<nitro_h30.EventHandlerRequest, Promise<unknown>>;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { _default as default };
|
|
@@ -1,71 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { ApolloServer } from "@apollo/server";
|
|
1
|
+
import { BASE_SCHEMA_DEF } from "../../core/schema/builder.mjs";
|
|
2
|
+
import { createApolloServerInstance } from "../../core/server/apollo.mjs";
|
|
4
3
|
import { defineEventHandler } from "nitro/h3";
|
|
5
4
|
import { importedConfig } from "#nitro-graphql/graphql-config";
|
|
6
5
|
import { moduleConfig } from "#nitro-graphql/module-config";
|
|
7
6
|
import { directives } from "#nitro-graphql/server-directives";
|
|
8
7
|
import { resolvers } from "#nitro-graphql/server-resolvers";
|
|
9
8
|
import { schemas } from "#nitro-graphql/server-schemas";
|
|
10
|
-
import { ApolloServerPluginLandingPageDisabled } from "@apollo/server/plugin/disabled";
|
|
11
|
-
import { ApolloServerPluginLandingPageLocalDefault } from "@apollo/server/plugin/landingPage/default";
|
|
12
9
|
import { startServerAndCreateH3Handler } from "nitro-graphql/apollo";
|
|
13
|
-
|
|
14
10
|
//#region src/nitro/routes/apollo-server.ts
|
|
15
|
-
let apolloServer = null;
|
|
16
|
-
let serverStarted = false;
|
|
17
|
-
async function createApolloServer() {
|
|
18
|
-
if (!apolloServer) {
|
|
19
|
-
const schema = await createMergedSchema({
|
|
20
|
-
schemas,
|
|
21
|
-
resolvers,
|
|
22
|
-
directives,
|
|
23
|
-
moduleConfig
|
|
24
|
-
});
|
|
25
|
-
const securityConfig = moduleConfig.security || {
|
|
26
|
-
introspection: true,
|
|
27
|
-
playground: true,
|
|
28
|
-
maskErrors: false,
|
|
29
|
-
disableSuggestions: false
|
|
30
|
-
};
|
|
31
|
-
const plugins = [];
|
|
32
|
-
if (securityConfig.playground) plugins.push(ApolloServerPluginLandingPageLocalDefault({ embed: true }));
|
|
33
|
-
else plugins.push(ApolloServerPluginLandingPageDisabled());
|
|
34
|
-
const userFacingCodes = [
|
|
35
|
-
"BAD_USER_INPUT",
|
|
36
|
-
"GRAPHQL_VALIDATION_FAILED",
|
|
37
|
-
"UNAUTHENTICATED",
|
|
38
|
-
"FORBIDDEN",
|
|
39
|
-
"BAD_REQUEST"
|
|
40
|
-
];
|
|
41
|
-
apolloServer = new ApolloServer(defu({
|
|
42
|
-
schema,
|
|
43
|
-
introspection: securityConfig.introspection,
|
|
44
|
-
plugins,
|
|
45
|
-
formatError: securityConfig.maskErrors ? (formattedError, _error) => {
|
|
46
|
-
const code = formattedError?.extensions?.code;
|
|
47
|
-
if (code && userFacingCodes.includes(code)) return formattedError;
|
|
48
|
-
return {
|
|
49
|
-
message: "Internal server error",
|
|
50
|
-
extensions: { code: "INTERNAL_SERVER_ERROR" }
|
|
51
|
-
};
|
|
52
|
-
} : void 0
|
|
53
|
-
}, importedConfig));
|
|
54
|
-
if (!serverStarted) {
|
|
55
|
-
await apolloServer.start();
|
|
56
|
-
serverStarted = true;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return apolloServer;
|
|
60
|
-
}
|
|
61
11
|
let serverPromise = null;
|
|
12
|
+
let cachedH3Handler = null;
|
|
62
13
|
var apollo_server_default = defineEventHandler(async (event) => {
|
|
63
|
-
if (!serverPromise) serverPromise =
|
|
64
|
-
|
|
65
|
-
|
|
14
|
+
if (!serverPromise) serverPromise = createApolloServerInstance({
|
|
15
|
+
schemas: [BASE_SCHEMA_DEF, ...schemas],
|
|
16
|
+
resolvers,
|
|
17
|
+
directives,
|
|
18
|
+
moduleConfig,
|
|
19
|
+
security: moduleConfig.security,
|
|
20
|
+
importedConfig
|
|
21
|
+
});
|
|
22
|
+
const server = await serverPromise;
|
|
23
|
+
if (!cachedH3Handler) cachedH3Handler = startServerAndCreateH3Handler(server, {
|
|
24
|
+
context: async (req) => ({ event: req.event }),
|
|
66
25
|
serverAlreadyStarted: true
|
|
67
|
-
})
|
|
26
|
+
});
|
|
27
|
+
return cachedH3Handler(event);
|
|
68
28
|
});
|
|
69
|
-
|
|
70
29
|
//#endregion
|
|
71
|
-
export { apollo_server_default as default };
|
|
30
|
+
export { apollo_server_default as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as nitro_h30 from "nitro/h3";
|
|
2
2
|
|
|
3
3
|
//#region src/nitro/routes/debug.d.ts
|
|
4
4
|
/**
|
|
@@ -9,7 +9,7 @@ import * as nitro_h33 from "nitro/h3";
|
|
|
9
9
|
* - /_nitro/graphql/debug - HTML dashboard
|
|
10
10
|
* - /_nitro/graphql/debug?format=json - JSON API
|
|
11
11
|
*/
|
|
12
|
-
declare const _default:
|
|
12
|
+
declare const _default: nitro_h30.EventHandlerWithFetch<nitro_h30.EventHandlerRequest, Promise<string | Response | {
|
|
13
13
|
timestamp: string;
|
|
14
14
|
environment: {
|
|
15
15
|
dev: any;
|
|
@@ -5,7 +5,6 @@ import { directives } from "#nitro-graphql/server-directives";
|
|
|
5
5
|
import { resolvers } from "#nitro-graphql/server-resolvers";
|
|
6
6
|
import { schemas } from "#nitro-graphql/server-schemas";
|
|
7
7
|
import { debugInfo } from "#nitro-graphql/debug-info";
|
|
8
|
-
|
|
9
8
|
//#region src/nitro/routes/debug.ts
|
|
10
9
|
/**
|
|
11
10
|
* Debug endpoint for inspecting virtual modules and GraphQL setup
|
|
@@ -16,11 +15,11 @@ import { debugInfo } from "#nitro-graphql/debug-info";
|
|
|
16
15
|
* - /_nitro/graphql/debug?format=json - JSON API
|
|
17
16
|
*/
|
|
18
17
|
var debug_default = defineEventHandler(async (event) => {
|
|
18
|
+
if (import.meta.env?.PROD || process.env.NODE_ENV === "production") return new Response("Not Found", { status: 404 });
|
|
19
19
|
const format = getQuery(event).format || "html";
|
|
20
20
|
const processedResolverFiles = debugInfo.scanned.resolverFiles.map((r) => {
|
|
21
|
-
const parts = r.specifier.split("/");
|
|
22
21
|
return {
|
|
23
|
-
file:
|
|
22
|
+
file: r.specifier.split("/").at(-1),
|
|
24
23
|
fullPath: r.specifier,
|
|
25
24
|
exports: r.imports.map((i) => ({
|
|
26
25
|
name: i.name,
|
|
@@ -30,9 +29,8 @@ var debug_default = defineEventHandler(async (event) => {
|
|
|
30
29
|
};
|
|
31
30
|
});
|
|
32
31
|
const processedDirectiveFiles = debugInfo.scanned.directiveFiles.map((d) => {
|
|
33
|
-
const parts = d.specifier.split("/");
|
|
34
32
|
return {
|
|
35
|
-
file:
|
|
33
|
+
file: d.specifier.split("/").at(-1),
|
|
36
34
|
fullPath: d.specifier,
|
|
37
35
|
exports: d.imports.map((i) => ({
|
|
38
36
|
name: i.name,
|
|
@@ -97,6 +95,5 @@ var debug_default = defineEventHandler(async (event) => {
|
|
|
97
95
|
event.res.headers.set("Content-Type", "text/html");
|
|
98
96
|
return generateDebugHtml(fullDebugInfo);
|
|
99
97
|
});
|
|
100
|
-
|
|
101
98
|
//#endregion
|
|
102
|
-
export { debug_default as default };
|
|
99
|
+
export { debug_default as default };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as nitro_h30 from "nitro/h3";
|
|
2
2
|
|
|
3
3
|
//#region src/nitro/routes/graphql-yoga-ws.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* GraphQL Yoga WebSocket handler for subscriptions
|
|
6
|
-
* Uses graphql-ws
|
|
6
|
+
* Uses shared WebSocket handler with graphql-ws and crossws
|
|
7
7
|
*
|
|
8
8
|
* @see https://github.com/enisdenjo/graphql-ws
|
|
9
9
|
*/
|
|
10
|
-
declare const _default:
|
|
10
|
+
declare const _default: nitro_h30.EventHandler<nitro_h30.EventHandlerRequest, unknown>;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { _default as default };
|
|
@@ -1,53 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { wsHooks } from "./_ws-handler.mjs";
|
|
2
2
|
import { defineWebSocketHandler } from "nitro/h3";
|
|
3
|
-
import { handleProtocols } from "graphql-ws";
|
|
4
|
-
import { makeHooks } from "graphql-ws/use/crossws";
|
|
5
|
-
import { importedConfig } from "#nitro-graphql/graphql-config";
|
|
6
|
-
import { moduleConfig } from "#nitro-graphql/module-config";
|
|
7
|
-
import { directives } from "#nitro-graphql/server-directives";
|
|
8
|
-
import { resolvers } from "#nitro-graphql/server-resolvers";
|
|
9
|
-
import { schemas } from "#nitro-graphql/server-schemas";
|
|
10
|
-
|
|
11
3
|
//#region src/nitro/routes/graphql-yoga-ws.ts
|
|
12
|
-
let schema = null;
|
|
13
4
|
/**
|
|
14
|
-
*
|
|
5
|
+
* GraphQL Yoga WebSocket handler for subscriptions
|
|
6
|
+
* Uses shared WebSocket handler with graphql-ws and crossws
|
|
7
|
+
*
|
|
8
|
+
* @see https://github.com/enisdenjo/graphql-ws
|
|
15
9
|
*/
|
|
16
|
-
|
|
17
|
-
if (!schema) schema = await createMergedSchema({
|
|
18
|
-
schemas,
|
|
19
|
-
resolvers,
|
|
20
|
-
directives,
|
|
21
|
-
moduleConfig
|
|
22
|
-
});
|
|
23
|
-
return schema;
|
|
24
|
-
}
|
|
25
|
-
const hooks = {
|
|
26
|
-
upgrade(request) {
|
|
27
|
-
const selected = handleProtocols(request.headers.get("sec-websocket-protocol") || "");
|
|
28
|
-
if (selected) return { headers: { "Sec-WebSocket-Protocol": selected } };
|
|
29
|
-
return {};
|
|
30
|
-
},
|
|
31
|
-
...makeHooks({
|
|
32
|
-
schema: () => getSchema(),
|
|
33
|
-
context: async (ctx) => {
|
|
34
|
-
const baseContext = { connectionParams: ctx.connectionParams };
|
|
35
|
-
if (typeof importedConfig.context === "function") {
|
|
36
|
-
const userContext = await importedConfig.context(baseContext);
|
|
37
|
-
return {
|
|
38
|
-
...baseContext,
|
|
39
|
-
...userContext
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
if (importedConfig.context && typeof importedConfig.context === "object") return {
|
|
43
|
-
...baseContext,
|
|
44
|
-
...importedConfig.context
|
|
45
|
-
};
|
|
46
|
-
return baseContext;
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
};
|
|
50
|
-
var graphql_yoga_ws_default = defineWebSocketHandler(hooks);
|
|
51
|
-
|
|
10
|
+
var graphql_yoga_ws_default = defineWebSocketHandler(wsHooks);
|
|
52
11
|
//#endregion
|
|
53
|
-
export { graphql_yoga_ws_default as default };
|
|
12
|
+
export { graphql_yoga_ws_default as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as nitro_h30 from "nitro/h3";
|
|
2
2
|
|
|
3
3
|
//#region src/nitro/routes/graphql-yoga.d.ts
|
|
4
4
|
/**
|
|
@@ -7,6 +7,6 @@ import * as nitro_h37 from "nitro/h3";
|
|
|
7
7
|
* Nitro/H3 wrapper around the core GraphQL Yoga server.
|
|
8
8
|
* Uses virtual modules to load schemas, resolvers, and directives.
|
|
9
9
|
*/
|
|
10
|
-
declare const _default:
|
|
10
|
+
declare const _default: nitro_h30.EventHandlerWithFetch<nitro_h30.EventHandlerRequest, Promise<Response>>;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { _default as default };
|
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BASE_SCHEMA_DEF } from "../../core/schema/builder.mjs";
|
|
2
|
+
import { createYogaServer } from "../../core/server/yoga.mjs";
|
|
2
3
|
import { defineEventHandler, getQuery } from "nitro/h3";
|
|
3
4
|
import { importedConfig } from "#nitro-graphql/graphql-config";
|
|
4
5
|
import { moduleConfig } from "#nitro-graphql/module-config";
|
|
5
6
|
import { directives } from "#nitro-graphql/server-directives";
|
|
6
7
|
import { resolvers } from "#nitro-graphql/server-resolvers";
|
|
7
8
|
import { schemas } from "#nitro-graphql/server-schemas";
|
|
8
|
-
|
|
9
9
|
//#region src/nitro/routes/graphql-yoga.ts
|
|
10
10
|
const PLAYGROUND_CACHE_HEADER = "public, max-age=2592000, stale-while-revalidate=86400";
|
|
11
11
|
let server = null;
|
|
12
12
|
var graphql_yoga_default = defineEventHandler(async (event) => {
|
|
13
13
|
if (!server) server = await createYogaServer({
|
|
14
|
-
schemas: [
|
|
14
|
+
schemas: [BASE_SCHEMA_DEF, ...schemas],
|
|
15
15
|
resolvers,
|
|
16
16
|
directives,
|
|
17
17
|
moduleConfig,
|
|
18
|
-
endpoint: "/api/graphql",
|
|
18
|
+
endpoint: moduleConfig.endpoint?.graphql || "/api/graphql",
|
|
19
19
|
security: moduleConfig.security,
|
|
20
20
|
importedConfig
|
|
21
21
|
});
|
|
22
22
|
const response = await server.fetch(event.req, event);
|
|
23
23
|
const isPlaygroundRequest = event.req.method === "GET" && !getQuery(event).query;
|
|
24
24
|
if (event.res.status && event.res.status !== 200) return new Response(response.body, {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
status: event.res.status,
|
|
26
|
+
statusText: response.statusText,
|
|
27
|
+
headers: response.headers
|
|
27
28
|
});
|
|
28
29
|
if (isPlaygroundRequest && response.headers.get("content-type")?.includes("text/html")) {
|
|
29
30
|
const headers = new Headers(response.headers);
|
|
@@ -36,6 +37,5 @@ var graphql_yoga_default = defineEventHandler(async (event) => {
|
|
|
36
37
|
}
|
|
37
38
|
return new Response(response.body, response);
|
|
38
39
|
});
|
|
39
|
-
|
|
40
40
|
//#endregion
|
|
41
|
-
export { graphql_yoga_default as default };
|
|
41
|
+
export { graphql_yoga_default as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as nitro_h30 from "nitro/h3";
|
|
2
2
|
|
|
3
3
|
//#region src/nitro/routes/health.d.ts
|
|
4
|
-
declare const _default:
|
|
4
|
+
declare const _default: nitro_h30.EventHandlerWithFetch<nitro_h30.EventHandlerRequest, Promise<{
|
|
5
5
|
status: string;
|
|
6
6
|
message: string;
|
|
7
7
|
timestamp: string;
|