nitro-graphql 2.0.0-beta.7 → 2.0.0-beta.70
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 +31 -1196
- package/dist/cli/adapter.d.mts +13 -0
- package/dist/cli/adapter.mjs +69 -0
- package/dist/cli/commands/build.d.mts +21 -0
- package/dist/cli/commands/build.mjs +52 -0
- package/dist/cli/commands/dev.d.mts +40 -0
- package/dist/cli/commands/dev.mjs +76 -0
- package/dist/cli/commands/generate.d.mts +25 -0
- package/dist/cli/commands/generate.mjs +198 -0
- package/dist/cli/commands/index.d.mts +5 -0
- package/dist/cli/commands/index.mjs +6 -0
- package/dist/cli/commands/init.d.mts +45 -0
- package/dist/cli/commands/init.mjs +195 -0
- package/dist/cli/commands/validate.d.mts +9 -0
- package/dist/cli/commands/validate.mjs +67 -0
- package/dist/cli/completions.d.mts +6 -0
- package/dist/cli/completions.mjs +34 -0
- package/dist/cli/config.d.mts +18 -0
- package/dist/cli/config.mjs +20 -0
- package/dist/cli/index.d.mts +26 -0
- package/dist/cli/index.mjs +317 -0
- package/dist/cli/server/debug-handler.d.mts +9 -0
- package/dist/cli/server/debug-handler.mjs +71 -0
- package/dist/cli/server/dev-server.d.mts +29 -0
- package/dist/cli/server/dev-server.mjs +64 -0
- package/dist/cli/server/graphql-handler.d.mts +21 -0
- package/dist/cli/server/graphql-handler.mjs +45 -0
- package/dist/cli/server/health-handler.d.mts +12 -0
- package/dist/cli/server/health-handler.mjs +30 -0
- package/dist/cli/server/loader.d.mts +33 -0
- package/dist/cli/server/loader.mjs +146 -0
- package/dist/cli/server/sandbox-handler.d.mts +12 -0
- package/dist/cli/server/sandbox-handler.mjs +19 -0
- package/dist/cli/server/watcher.d.mts +20 -0
- package/dist/cli/server/watcher.mjs +66 -0
- package/dist/cli/server/ws-handler.d.mts +28 -0
- package/dist/cli/server/ws-handler.mjs +50 -0
- package/dist/config.d.mts +2 -0
- package/dist/config.mjs +3 -0
- package/dist/core/codegen/client.d.mts +42 -0
- package/dist/core/codegen/client.mjs +553 -0
- package/dist/core/codegen/document-loader.d.mts +9 -0
- package/dist/core/codegen/document-loader.mjs +18 -0
- package/dist/core/codegen/index.d.mts +8 -0
- package/dist/core/codegen/index.mjs +9 -0
- package/dist/core/codegen/plugin.d.mts +19 -0
- package/dist/core/codegen/plugin.mjs +30 -0
- package/dist/core/codegen/runtime.d.mts +19 -0
- package/dist/core/codegen/runtime.mjs +60 -0
- package/dist/core/codegen/schema-loader.d.mts +27 -0
- package/dist/core/codegen/schema-loader.mjs +128 -0
- package/dist/core/codegen/server.d.mts +27 -0
- package/dist/core/codegen/server.mjs +144 -0
- package/dist/core/codegen/validation.d.mts +17 -0
- package/dist/core/codegen/validation.mjs +35 -0
- package/dist/core/config.d.mts +45 -0
- package/dist/core/config.mjs +78 -0
- package/dist/core/constants.d.mts +188 -0
- package/dist/core/constants.mjs +210 -0
- package/dist/core/debug/index.d.mts +2 -0
- package/dist/core/debug/index.mjs +3 -0
- package/dist/core/debug/template.d.mts +52 -0
- package/dist/core/debug/template.mjs +383 -0
- package/dist/core/extend/index.d.mts +2 -0
- package/dist/core/extend/index.mjs +3 -0
- package/dist/core/extend/loader.d.mts +40 -0
- package/dist/core/extend/loader.mjs +198 -0
- package/dist/core/index.d.mts +37 -0
- package/dist/core/index.mjs +29 -0
- package/dist/core/manifest.d.mts +56 -0
- package/dist/core/manifest.mjs +102 -0
- package/dist/core/pubsub/index.d.mts +109 -0
- package/dist/core/pubsub/index.mjs +148 -0
- package/dist/core/scanning/ast-scanner.d.mts +27 -0
- package/dist/core/scanning/ast-scanner.mjs +116 -0
- package/dist/core/scanning/common.d.mts +25 -0
- package/dist/core/scanning/common.mjs +59 -0
- package/dist/core/scanning/directives.d.mts +13 -0
- package/dist/core/scanning/directives.mjs +29 -0
- package/dist/core/scanning/documents.d.mts +20 -0
- package/dist/core/scanning/documents.mjs +37 -0
- package/dist/core/scanning/index.d.mts +7 -0
- package/dist/core/scanning/index.mjs +8 -0
- package/dist/core/scanning/resolvers.d.mts +14 -0
- package/dist/core/scanning/resolvers.mjs +59 -0
- package/dist/core/scanning/schemas.d.mts +13 -0
- package/dist/core/scanning/schemas.mjs +52 -0
- package/dist/core/schema/builder.d.mts +59 -0
- package/dist/core/schema/builder.mjs +78 -0
- package/dist/core/schema/federation.d.mts +33 -0
- package/dist/core/schema/federation.mjs +40 -0
- package/dist/core/schema/index.d.mts +3 -0
- package/dist/core/schema/index.mjs +4 -0
- package/dist/core/server/index.d.mts +4 -0
- package/dist/core/server/index.mjs +4 -0
- package/dist/core/server/sandbox.d.mts +18 -0
- package/dist/core/server/sandbox.mjs +39 -0
- package/dist/core/server/types.d.mts +54 -0
- package/dist/core/server/yoga.d.mts +42 -0
- package/dist/core/server/yoga.mjs +89 -0
- package/dist/core/types/adapter.d.mts +57 -0
- package/dist/core/types/codegen.d.mts +136 -0
- package/dist/core/types/codegen.mjs +1 -0
- package/dist/core/types/config.d.mts +188 -0
- package/dist/core/types/config.mjs +1 -0
- package/dist/{utils/define.d.ts → core/types/define.d.mts} +2 -30
- package/dist/core/types/define.mjs +1 -0
- package/dist/core/types/index.d.mts +5 -0
- package/dist/core/types/index.mjs +1 -0
- package/dist/core/types/scanning.d.mts +64 -0
- package/dist/core/types/scanning.mjs +1 -0
- package/dist/{utils/directive-parser.d.ts → core/utils/directive-parser.d.mts} +18 -4
- package/dist/{utils/directive-parser.js → core/utils/directive-parser.mjs} +28 -34
- package/dist/core/utils/errors.d.mts +77 -0
- package/dist/core/utils/errors.mjs +93 -0
- package/dist/core/utils/file-io.d.mts +24 -0
- package/dist/core/utils/file-io.mjs +47 -0
- package/dist/core/utils/imports.d.mts +15 -0
- package/dist/core/utils/imports.mjs +25 -0
- package/dist/core/utils/index.d.mts +7 -0
- package/dist/core/utils/index.mjs +8 -0
- package/dist/core/utils/logger.d.mts +18 -0
- package/dist/core/utils/logger.mjs +38 -0
- package/dist/core/utils/ofetch-templates.d.mts +30 -0
- package/dist/core/utils/ofetch-templates.mjs +135 -0
- package/dist/core/utils/runtime.d.mts +74 -0
- package/dist/core/utils/runtime.mjs +111 -0
- package/dist/core/utils/subscribe-templates.d.mts +8 -0
- package/dist/core/utils/subscribe-templates.mjs +59 -0
- package/dist/core/validation/external-services.d.mts +11 -0
- package/dist/core/validation/external-services.mjs +33 -0
- package/dist/core/validation/index.d.mts +2 -0
- package/dist/core/validation/index.mjs +3 -0
- package/dist/core/watcher/index.d.mts +107 -0
- package/dist/core/watcher/index.mjs +141 -0
- package/dist/define.d.mts +294 -0
- package/dist/define.mjs +325 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +6 -0
- package/dist/nitro/adapter.d.mts +29 -0
- package/dist/nitro/adapter.mjs +93 -0
- package/dist/{utils/apollo.d.ts → nitro/apollo.d.mts} +3 -3
- package/dist/nitro/apollo.mjs +59 -0
- package/dist/nitro/codegen.d.mts +18 -0
- package/dist/nitro/codegen.mjs +173 -0
- package/dist/nitro/config.d.mts +50 -0
- package/dist/nitro/config.mjs +57 -0
- package/dist/nitro/index.d.mts +45 -0
- package/dist/nitro/index.mjs +65 -0
- package/dist/{utils/path-resolver.d.ts → nitro/paths.d.mts} +8 -25
- package/dist/{utils/path-resolver.js → nitro/paths.mjs} +14 -49
- package/dist/nitro/rollup.d.mts +6 -0
- package/dist/nitro/rollup.mjs +53 -0
- package/dist/nitro/routes/apollo-sandbox-script.d.mts +6 -0
- package/dist/nitro/routes/apollo-sandbox-script.mjs +14 -0
- package/dist/nitro/routes/apollo-server-ws.d.mts +15 -0
- package/dist/nitro/routes/apollo-server-ws.mjs +53 -0
- package/dist/nitro/routes/apollo-server.d.mts +6 -0
- package/dist/nitro/routes/apollo-server.mjs +71 -0
- package/dist/{routes/debug.d.ts → nitro/routes/debug.d.mts} +12 -19
- package/dist/nitro/routes/debug.mjs +102 -0
- package/dist/nitro/routes/graphql-yoga-ws.d.mts +12 -0
- package/dist/nitro/routes/graphql-yoga-ws.mjs +53 -0
- package/dist/nitro/routes/graphql-yoga.d.mts +12 -0
- package/dist/nitro/routes/graphql-yoga.mjs +41 -0
- package/dist/nitro/routes/health.d.mts +10 -0
- package/dist/{routes/health.js → nitro/routes/health.mjs} +4 -3
- package/dist/nitro/setup/extend-loader.d.mts +16 -0
- package/dist/nitro/setup/extend-loader.mjs +82 -0
- package/dist/nitro/setup/file-watcher.d.mts +18 -0
- package/dist/nitro/setup/file-watcher.mjs +63 -0
- package/dist/nitro/setup/logging.d.mts +16 -0
- package/dist/nitro/setup/logging.mjs +66 -0
- package/dist/nitro/setup/rollup-integration.d.mts +24 -0
- package/dist/nitro/setup/rollup-integration.mjs +63 -0
- package/dist/nitro/setup/routes.d.mts +13 -0
- package/dist/nitro/setup/routes.mjs +71 -0
- package/dist/nitro/setup/scanner.d.mts +59 -0
- package/dist/nitro/setup/scanner.mjs +120 -0
- package/dist/nitro/setup/ts-config.d.mts +10 -0
- package/dist/nitro/setup/ts-config.mjs +69 -0
- package/dist/nitro/setup.d.mts +11 -0
- package/dist/nitro/setup.mjs +191 -0
- package/dist/nitro/types.d.mts +549 -0
- package/dist/nitro/types.mjs +1 -0
- package/dist/nitro/virtual/generators.d.mts +38 -0
- package/dist/nitro/virtual/generators.mjs +192 -0
- package/dist/nitro/virtual/stubs.d.mts +21 -0
- package/dist/nitro/virtual/stubs.mjs +32 -0
- package/dist/{ecosystem/nuxt.d.ts → nuxt.d.mts} +1 -1
- package/dist/nuxt.mjs +112 -0
- package/dist/{graphql/server.d.ts → stubs/index.d.mts} +5 -1
- package/dist/stubs/index.mjs +1 -0
- package/dist/subscribe/index.d.mts +78 -0
- package/dist/subscribe/index.mjs +206 -0
- package/native/index.d.ts +20 -0
- package/native/index.js +585 -0
- package/package.json +201 -111
- package/dist/ecosystem/nuxt.js +0 -67
- package/dist/graphql/index.d.ts +0 -5
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -318
- package/dist/rollup.js +0 -277
- package/dist/routes/apollo-server.d.ts +0 -6
- package/dist/routes/apollo-server.js +0 -89
- package/dist/routes/debug.js +0 -449
- package/dist/routes/graphql-yoga.d.ts +0 -6
- package/dist/routes/graphql-yoga.js +0 -91
- package/dist/routes/health.d.ts +0 -10
- package/dist/types/index.d.ts +0 -246
- package/dist/types/standard-schema.d.ts +0 -59
- package/dist/utils/apollo.js +0 -61
- package/dist/utils/client-codegen.d.ts +0 -38
- package/dist/utils/client-codegen.js +0 -290
- package/dist/utils/define.js +0 -57
- package/dist/utils/file-generator.d.ts +0 -37
- package/dist/utils/file-generator.js +0 -72
- package/dist/utils/index.d.ts +0 -39
- package/dist/utils/index.js +0 -278
- package/dist/utils/server-codegen.d.ts +0 -7
- package/dist/utils/server-codegen.js +0 -136
- package/dist/utils/type-generation.d.ts +0 -7
- package/dist/utils/type-generation.js +0 -360
- package/dist/virtual/debug-info.d.ts +0 -9
- package/dist/virtual/debug-info.js +0 -26
- package/dist/virtual/graphql-config.d.ts +0 -9
- package/dist/virtual/graphql-config.js +0 -10
- package/dist/virtual/module-config.d.ts +0 -9
- package/dist/virtual/module-config.js +0 -10
- package/dist/virtual/server-directives.d.ts +0 -11
- package/dist/virtual/server-directives.js +0 -10
- package/dist/virtual/server-resolvers.d.ts +0 -11
- package/dist/virtual/server-resolvers.js +0 -10
- package/dist/virtual/server-schemas.d.ts +0 -11
- package/dist/virtual/server-schemas.js +0 -10
- package/dist/vite.d.ts +0 -25
- package/dist/vite.js +0 -40
- /package/dist/{graphql/index.js → core/server/types.mjs} +0 -0
- /package/dist/{graphql/server.js → core/types/adapter.mjs} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { resolve } from "pathe";
|
|
1
|
+
import { isAbsolute, resolve } from "pathe";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/nitro/paths.ts
|
|
4
4
|
/**
|
|
5
5
|
* Replace placeholders in a path string
|
|
6
|
-
* Supports: {serviceName}, {buildDir}, {rootDir}, {framework}, {typesDir}, {
|
|
6
|
+
* Supports: {serviceName}, {buildDir}, {rootDir}, {framework}, {typesDir}, {serverDir}, {clientDir}
|
|
7
7
|
*/
|
|
8
8
|
function replacePlaceholders(path, placeholders) {
|
|
9
|
-
return path.replace(/\{serviceName\}/g, placeholders.serviceName || "default").replace(/\{buildDir\}/g, placeholders.buildDir).replace(/\{rootDir\}/g, placeholders.rootDir).replace(/\{framework\}/g, placeholders.framework).replace(/\{typesDir\}/g, placeholders.typesDir).replace(/\{
|
|
9
|
+
return path.replace(/\{serviceName\}/g, placeholders.serviceName || "default").replace(/\{buildDir\}/g, placeholders.buildDir).replace(/\{rootDir\}/g, placeholders.rootDir).replace(/\{framework\}/g, placeholders.framework).replace(/\{typesDir\}/g, placeholders.typesDir).replace(/\{serverDir\}/g, placeholders.serverDir).replace(/\{clientDir\}/g, placeholders.clientDir);
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Get default paths based on framework and user configuration
|
|
@@ -15,19 +15,18 @@ function getDefaultPaths(nitro) {
|
|
|
15
15
|
const isNuxt = nitro.options.framework?.name === "nuxt";
|
|
16
16
|
const rootDir = nitro.options.rootDir;
|
|
17
17
|
const buildDir = nitro.options.buildDir;
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const defaultTypesDir = pathsConfig.typesDir || resolve(defaultBuildDir, "types");
|
|
18
|
+
const graphqlConfig = nitro.options.graphql || {};
|
|
19
|
+
const defaultServerDir = graphqlConfig.serverDir ? resolve(rootDir, graphqlConfig.serverDir) : resolve(rootDir, "server", "graphql");
|
|
20
|
+
const defaultClientDir = graphqlConfig.clientDir ? resolve(rootDir, graphqlConfig.clientDir) : resolve(rootDir, isNuxt ? "app/graphql" : "graphql");
|
|
21
|
+
const defaultTypesDir = graphqlConfig.typesDir ? resolve(rootDir, graphqlConfig.typesDir) : resolve(buildDir, "types");
|
|
23
22
|
return {
|
|
24
23
|
serviceName: "default",
|
|
25
|
-
buildDir
|
|
24
|
+
buildDir,
|
|
26
25
|
rootDir,
|
|
27
26
|
framework: isNuxt ? "nuxt" : "nitro",
|
|
28
27
|
typesDir: defaultTypesDir,
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
serverDir: defaultServerDir,
|
|
29
|
+
clientDir: defaultClientDir
|
|
31
30
|
};
|
|
32
31
|
}
|
|
33
32
|
/**
|
|
@@ -49,49 +48,15 @@ function resolveFilePath(config, categoryEnabled, topLevelEnabled, defaultPath,
|
|
|
49
48
|
if (!shouldGenerateFile(config, categoryEnabled, topLevelEnabled)) return null;
|
|
50
49
|
if (typeof config === "string") {
|
|
51
50
|
const customPath = replacePlaceholders(config, placeholders);
|
|
52
|
-
return resolve(placeholders.rootDir, customPath);
|
|
51
|
+
return isAbsolute(customPath) ? customPath : resolve(placeholders.rootDir, customPath);
|
|
53
52
|
}
|
|
54
53
|
const resolvedDefault = replacePlaceholders(defaultPath, placeholders);
|
|
55
54
|
return resolve(placeholders.rootDir, resolvedDefault);
|
|
56
55
|
}
|
|
57
56
|
/**
|
|
58
|
-
* Check if scaffold files should be generated (category-level check)
|
|
59
|
-
*/
|
|
60
|
-
function shouldGenerateScaffold(nitro) {
|
|
61
|
-
const scaffoldConfig = nitro.options.graphql?.scaffold;
|
|
62
|
-
if (scaffoldConfig === false) return false;
|
|
63
|
-
if (scaffoldConfig && scaffoldConfig.enabled === false) return false;
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Get scaffold configuration (handles false case)
|
|
68
|
-
*/
|
|
69
|
-
function getScaffoldConfig(nitro) {
|
|
70
|
-
const scaffoldConfig = nitro.options.graphql?.scaffold;
|
|
71
|
-
if (scaffoldConfig === false) return { enabled: false };
|
|
72
|
-
return scaffoldConfig || {};
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Check if client utilities should be generated (category-level check)
|
|
76
|
-
*/
|
|
77
|
-
function shouldGenerateClientUtils(nitro) {
|
|
78
|
-
const clientUtilsConfig = nitro.options.graphql?.clientUtils;
|
|
79
|
-
if (clientUtilsConfig === false) return false;
|
|
80
|
-
if (clientUtilsConfig && clientUtilsConfig.enabled === false) return false;
|
|
81
|
-
return nitro.options.framework?.name === "nuxt";
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Get client utilities configuration (handles false case)
|
|
85
|
-
*/
|
|
86
|
-
function getClientUtilsConfig(nitro) {
|
|
87
|
-
const clientUtilsConfig = nitro.options.graphql?.clientUtils;
|
|
88
|
-
if (clientUtilsConfig === false) return { enabled: false };
|
|
89
|
-
return clientUtilsConfig || {};
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
57
|
* Check if SDK files should be generated (category-level check)
|
|
93
58
|
*/
|
|
94
|
-
function
|
|
59
|
+
function shouldGenerateSdk(nitro) {
|
|
95
60
|
const sdkConfig = nitro.options.graphql?.sdk;
|
|
96
61
|
if (sdkConfig === false) return false;
|
|
97
62
|
if (sdkConfig && sdkConfig.enabled === false) return false;
|
|
@@ -124,4 +89,4 @@ function getTypesConfig(nitro) {
|
|
|
124
89
|
}
|
|
125
90
|
|
|
126
91
|
//#endregion
|
|
127
|
-
export {
|
|
92
|
+
export { getDefaultPaths, getSdkConfig, getTypesConfig, replacePlaceholders, resolveFilePath, shouldGenerateFile, shouldGenerateSdk, shouldGenerateTypes };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { NitroAdapter } from "./adapter.mjs";
|
|
2
|
+
import { registerAllVirtualModules } from "./virtual/generators.mjs";
|
|
3
|
+
import { readFile } from "node:fs/promises";
|
|
4
|
+
import { parse } from "graphql";
|
|
5
|
+
|
|
6
|
+
//#region src/nitro/rollup.ts
|
|
7
|
+
async function rollupConfig(nitro) {
|
|
8
|
+
registerAllVirtualModules(nitro);
|
|
9
|
+
nitro.hooks.hook("rollup:before", (_, rollupConfig) => {
|
|
10
|
+
rollupConfig.plugins = rollupConfig.plugins || [];
|
|
11
|
+
const { include = /\.(?:graphql|gql)$/i, exclude, validate = false } = nitro.options.graphql?.loader || {};
|
|
12
|
+
if (Array.isArray(rollupConfig.plugins)) {
|
|
13
|
+
rollupConfig.plugins.push({
|
|
14
|
+
name: "nitro-graphql",
|
|
15
|
+
resolveId: {
|
|
16
|
+
order: "pre",
|
|
17
|
+
handler(id) {
|
|
18
|
+
if (/\.(?:graphql|gql)$/i.test(id)) return null;
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
load: {
|
|
22
|
+
order: "pre",
|
|
23
|
+
async handler(id) {
|
|
24
|
+
if (exclude?.test?.(id)) return null;
|
|
25
|
+
if (!include.test(id)) return null;
|
|
26
|
+
try {
|
|
27
|
+
const content = await readFile(id, "utf-8");
|
|
28
|
+
if (validate) parse(content);
|
|
29
|
+
return `export default ${JSON.stringify(content)}`;
|
|
30
|
+
} catch (error) {
|
|
31
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") return null;
|
|
32
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
33
|
+
this.error(`Failed to read GraphQL file ${id}: ${message}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
if (nitro.options.dev) rollupConfig.plugins.push({
|
|
39
|
+
name: "nitro-graphql-watcher",
|
|
40
|
+
buildStart: {
|
|
41
|
+
order: "pre",
|
|
42
|
+
async handler() {
|
|
43
|
+
const result = await NitroAdapter.scanGraphql(nitro);
|
|
44
|
+
for (const file of result.items) this.addWatchFile(file);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
export { rollupConfig };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createSandboxResponse } from "../../core/server/sandbox.mjs";
|
|
2
|
+
import { defineEventHandler } from "nitro/h3";
|
|
3
|
+
|
|
4
|
+
//#region src/nitro/routes/apollo-sandbox-script.ts
|
|
5
|
+
/**
|
|
6
|
+
* Proxy route for Apollo Sandbox script with long cache headers
|
|
7
|
+
* Uses core sandbox handler for consistency with CLI.
|
|
8
|
+
*/
|
|
9
|
+
var apollo_sandbox_script_default = defineEventHandler(async () => {
|
|
10
|
+
return createSandboxResponse();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { apollo_sandbox_script_default as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as nitro_h30 from "nitro/h3";
|
|
2
|
+
|
|
3
|
+
//#region src/nitro/routes/apollo-server-ws.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Apollo Server WebSocket handler for subscriptions
|
|
6
|
+
* Uses graphql-ws library with crossws adapter for proper protocol handling
|
|
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
|
|
12
|
+
*/
|
|
13
|
+
declare const _default: nitro_h30.EventHandler<nitro_h30.EventHandlerRequest, unknown>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { _default as default };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { createMergedSchema } from "../../core/schema/builder.mjs";
|
|
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
|
+
//#region src/nitro/routes/apollo-server-ws.ts
|
|
12
|
+
let schema = null;
|
|
13
|
+
/**
|
|
14
|
+
* Get or create the merged GraphQL schema
|
|
15
|
+
*/
|
|
16
|
+
async function getSchema() {
|
|
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
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
export { apollo_server_ws_default as default };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { createMergedSchema } from "../../core/schema/builder.mjs";
|
|
2
|
+
import defu from "defu";
|
|
3
|
+
import { ApolloServer } from "@apollo/server";
|
|
4
|
+
import { defineEventHandler } from "nitro/h3";
|
|
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
|
+
import { ApolloServerPluginLandingPageDisabled } from "@apollo/server/plugin/disabled";
|
|
11
|
+
import { ApolloServerPluginLandingPageLocalDefault } from "@apollo/server/plugin/landingPage/default";
|
|
12
|
+
import { startServerAndCreateH3Handler } from "nitro-graphql/apollo";
|
|
13
|
+
|
|
14
|
+
//#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
|
+
let serverPromise = null;
|
|
62
|
+
var apollo_server_default = defineEventHandler(async (event) => {
|
|
63
|
+
if (!serverPromise) serverPromise = createApolloServer();
|
|
64
|
+
return startServerAndCreateH3Handler(await serverPromise, {
|
|
65
|
+
context: async () => ({ event }),
|
|
66
|
+
serverAlreadyStarted: true
|
|
67
|
+
})(event);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
export { apollo_server_default as default };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
|
|
3
|
-
//#region src/routes/debug.d.ts
|
|
1
|
+
import * as nitro_h33 from "nitro/h3";
|
|
4
2
|
|
|
3
|
+
//#region src/nitro/routes/debug.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Debug endpoint for inspecting virtual modules and GraphQL setup
|
|
7
6
|
* Only available in development mode
|
|
@@ -10,7 +9,7 @@ import * as h31 from "h3";
|
|
|
10
9
|
* - /_nitro/graphql/debug - HTML dashboard
|
|
11
10
|
* - /_nitro/graphql/debug?format=json - JSON API
|
|
12
11
|
*/
|
|
13
|
-
declare const _default:
|
|
12
|
+
declare const _default: nitro_h33.EventHandlerWithFetch<nitro_h33.EventHandlerRequest, Promise<string | {
|
|
14
13
|
timestamp: string;
|
|
15
14
|
environment: {
|
|
16
15
|
dev: any;
|
|
@@ -31,30 +30,24 @@ declare const _default: h31.EventHandlerWithFetch<h31.EventHandlerRequest, Promi
|
|
|
31
30
|
documentFiles: any;
|
|
32
31
|
};
|
|
33
32
|
runtime: {
|
|
34
|
-
loadedResolvers:
|
|
35
|
-
loadedSchemas:
|
|
36
|
-
loadedDirectives:
|
|
33
|
+
loadedResolvers: any;
|
|
34
|
+
loadedSchemas: any;
|
|
35
|
+
loadedDirectives: any;
|
|
37
36
|
};
|
|
38
37
|
virtualModules: any;
|
|
39
38
|
virtualModuleSamples: {
|
|
40
39
|
'server-resolvers': {
|
|
41
|
-
resolverCount:
|
|
42
|
-
sample:
|
|
43
|
-
hasResolver: boolean;
|
|
44
|
-
resolverKeys: string[];
|
|
45
|
-
}[];
|
|
40
|
+
resolverCount: any;
|
|
41
|
+
sample: any;
|
|
46
42
|
};
|
|
47
43
|
'server-schemas': {
|
|
48
|
-
schemaCount:
|
|
49
|
-
sample:
|
|
50
|
-
defLength: number;
|
|
51
|
-
defPreview: string;
|
|
52
|
-
}[];
|
|
44
|
+
schemaCount: any;
|
|
45
|
+
sample: any;
|
|
53
46
|
};
|
|
54
47
|
'server-directives': {
|
|
55
|
-
directiveCount:
|
|
48
|
+
directiveCount: any;
|
|
56
49
|
};
|
|
57
|
-
'module-config':
|
|
50
|
+
'module-config': any;
|
|
58
51
|
};
|
|
59
52
|
}>>;
|
|
60
53
|
//#endregion
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { generateDebugHtml } from "../../core/debug/template.mjs";
|
|
2
|
+
import { defineEventHandler, getQuery } from "nitro/h3";
|
|
3
|
+
import { moduleConfig } from "#nitro-graphql/module-config";
|
|
4
|
+
import { directives } from "#nitro-graphql/server-directives";
|
|
5
|
+
import { resolvers } from "#nitro-graphql/server-resolvers";
|
|
6
|
+
import { schemas } from "#nitro-graphql/server-schemas";
|
|
7
|
+
import { debugInfo } from "#nitro-graphql/debug-info";
|
|
8
|
+
|
|
9
|
+
//#region src/nitro/routes/debug.ts
|
|
10
|
+
/**
|
|
11
|
+
* Debug endpoint for inspecting virtual modules and GraphQL setup
|
|
12
|
+
* Only available in development mode
|
|
13
|
+
*
|
|
14
|
+
* Routes:
|
|
15
|
+
* - /_nitro/graphql/debug - HTML dashboard
|
|
16
|
+
* - /_nitro/graphql/debug?format=json - JSON API
|
|
17
|
+
*/
|
|
18
|
+
var debug_default = defineEventHandler(async (event) => {
|
|
19
|
+
const format = getQuery(event).format || "html";
|
|
20
|
+
const processedResolverFiles = debugInfo.scanned.resolverFiles.map((r) => {
|
|
21
|
+
const parts = r.specifier.split("/");
|
|
22
|
+
return {
|
|
23
|
+
file: parts[parts.length - 1],
|
|
24
|
+
fullPath: r.specifier,
|
|
25
|
+
exports: r.imports.map((i) => ({
|
|
26
|
+
name: i.name,
|
|
27
|
+
type: i.type,
|
|
28
|
+
as: i.as
|
|
29
|
+
}))
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
const processedDirectiveFiles = debugInfo.scanned.directiveFiles.map((d) => {
|
|
33
|
+
const parts = d.specifier.split("/");
|
|
34
|
+
return {
|
|
35
|
+
file: parts[parts.length - 1],
|
|
36
|
+
fullPath: d.specifier,
|
|
37
|
+
exports: d.imports.map((i) => ({
|
|
38
|
+
name: i.name,
|
|
39
|
+
type: i.type,
|
|
40
|
+
as: i.as
|
|
41
|
+
}))
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
const fullDebugInfo = {
|
|
45
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
46
|
+
environment: {
|
|
47
|
+
dev: debugInfo.isDev,
|
|
48
|
+
framework: debugInfo.framework
|
|
49
|
+
},
|
|
50
|
+
graphql: {
|
|
51
|
+
framework: debugInfo.graphqlFramework ?? null,
|
|
52
|
+
federation: debugInfo.federation
|
|
53
|
+
},
|
|
54
|
+
scanned: {
|
|
55
|
+
schemas: debugInfo.scanned.schemas,
|
|
56
|
+
schemaFiles: debugInfo.scanned.schemaFiles.map((s) => {
|
|
57
|
+
return s.split("/").slice(-3).join("/");
|
|
58
|
+
}),
|
|
59
|
+
resolvers: debugInfo.scanned.resolvers,
|
|
60
|
+
resolverFiles: processedResolverFiles,
|
|
61
|
+
directives: debugInfo.scanned.directives,
|
|
62
|
+
directiveFiles: processedDirectiveFiles,
|
|
63
|
+
documents: debugInfo.scanned.documents,
|
|
64
|
+
documentFiles: debugInfo.scanned.documentFiles.map((d) => {
|
|
65
|
+
return d.split("/").slice(-3).join("/");
|
|
66
|
+
})
|
|
67
|
+
},
|
|
68
|
+
runtime: {
|
|
69
|
+
loadedResolvers: resolvers.length,
|
|
70
|
+
loadedSchemas: schemas.length,
|
|
71
|
+
loadedDirectives: directives.length
|
|
72
|
+
},
|
|
73
|
+
virtualModules: debugInfo.virtualModules || {},
|
|
74
|
+
virtualModuleSamples: {
|
|
75
|
+
"server-resolvers": {
|
|
76
|
+
resolverCount: resolvers.length,
|
|
77
|
+
sample: resolvers.slice(0, 3).map((r) => ({
|
|
78
|
+
hasResolver: !!r.resolver,
|
|
79
|
+
resolverKeys: r.resolver ? Object.keys(r.resolver) : []
|
|
80
|
+
}))
|
|
81
|
+
},
|
|
82
|
+
"server-schemas": {
|
|
83
|
+
schemaCount: schemas.length,
|
|
84
|
+
sample: schemas.slice(0, 2).map((s) => ({
|
|
85
|
+
defLength: s.def?.length || 0,
|
|
86
|
+
defPreview: s.def?.substring(0, 100) || "Empty"
|
|
87
|
+
}))
|
|
88
|
+
},
|
|
89
|
+
"server-directives": { directiveCount: directives.length },
|
|
90
|
+
"module-config": moduleConfig
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
if (format === "json") {
|
|
94
|
+
event.res.headers.set("Content-Type", "application/json");
|
|
95
|
+
return fullDebugInfo;
|
|
96
|
+
}
|
|
97
|
+
event.res.headers.set("Content-Type", "text/html");
|
|
98
|
+
return generateDebugHtml(fullDebugInfo);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
//#endregion
|
|
102
|
+
export { debug_default as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as nitro_h35 from "nitro/h3";
|
|
2
|
+
|
|
3
|
+
//#region src/nitro/routes/graphql-yoga-ws.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* GraphQL Yoga WebSocket handler for subscriptions
|
|
6
|
+
* Uses graphql-ws library with crossws adapter for proper protocol handling
|
|
7
|
+
*
|
|
8
|
+
* @see https://github.com/enisdenjo/graphql-ws
|
|
9
|
+
*/
|
|
10
|
+
declare const _default: nitro_h35.EventHandler<nitro_h35.EventHandlerRequest, unknown>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { _default as default };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { createMergedSchema } from "../../core/schema/builder.mjs";
|
|
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
|
+
//#region src/nitro/routes/graphql-yoga-ws.ts
|
|
12
|
+
let schema = null;
|
|
13
|
+
/**
|
|
14
|
+
* Get or create the merged GraphQL schema
|
|
15
|
+
*/
|
|
16
|
+
async function getSchema() {
|
|
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
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
export { graphql_yoga_ws_default as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as nitro_h37 from "nitro/h3";
|
|
2
|
+
|
|
3
|
+
//#region src/nitro/routes/graphql-yoga.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* GraphQL Yoga Route Handler
|
|
6
|
+
*
|
|
7
|
+
* Nitro/H3 wrapper around the core GraphQL Yoga server.
|
|
8
|
+
* Uses virtual modules to load schemas, resolvers, and directives.
|
|
9
|
+
*/
|
|
10
|
+
declare const _default: nitro_h37.EventHandlerWithFetch<nitro_h37.EventHandlerRequest, Promise<Response>>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { _default as default };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BASE_SCHEMA, createYogaServer } from "../../core/server/yoga.mjs";
|
|
2
|
+
import { defineEventHandler, getQuery } from "nitro/h3";
|
|
3
|
+
import { importedConfig } from "#nitro-graphql/graphql-config";
|
|
4
|
+
import { moduleConfig } from "#nitro-graphql/module-config";
|
|
5
|
+
import { directives } from "#nitro-graphql/server-directives";
|
|
6
|
+
import { resolvers } from "#nitro-graphql/server-resolvers";
|
|
7
|
+
import { schemas } from "#nitro-graphql/server-schemas";
|
|
8
|
+
|
|
9
|
+
//#region src/nitro/routes/graphql-yoga.ts
|
|
10
|
+
const PLAYGROUND_CACHE_HEADER = "public, max-age=2592000, stale-while-revalidate=86400";
|
|
11
|
+
let server = null;
|
|
12
|
+
var graphql_yoga_default = defineEventHandler(async (event) => {
|
|
13
|
+
if (!server) server = await createYogaServer({
|
|
14
|
+
schemas: [BASE_SCHEMA, ...schemas],
|
|
15
|
+
resolvers,
|
|
16
|
+
directives,
|
|
17
|
+
moduleConfig,
|
|
18
|
+
endpoint: "/api/graphql",
|
|
19
|
+
security: moduleConfig.security,
|
|
20
|
+
importedConfig
|
|
21
|
+
});
|
|
22
|
+
const response = await server.fetch(event.req, event);
|
|
23
|
+
const isPlaygroundRequest = event.req.method === "GET" && !getQuery(event).query;
|
|
24
|
+
if (event.res.status && event.res.status !== 200) return new Response(response.body, {
|
|
25
|
+
...response,
|
|
26
|
+
status: event.res.status
|
|
27
|
+
});
|
|
28
|
+
if (isPlaygroundRequest && response.headers.get("content-type")?.includes("text/html")) {
|
|
29
|
+
const headers = new Headers(response.headers);
|
|
30
|
+
headers.set("cache-control", PLAYGROUND_CACHE_HEADER);
|
|
31
|
+
return new Response(response.body, {
|
|
32
|
+
status: response.status,
|
|
33
|
+
statusText: response.statusText,
|
|
34
|
+
headers
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return new Response(response.body, response);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { graphql_yoga_default as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as nitro_h39 from "nitro/h3";
|
|
2
|
+
|
|
3
|
+
//#region src/nitro/routes/health.d.ts
|
|
4
|
+
declare const _default: nitro_h39.EventHandlerWithFetch<nitro_h39.EventHandlerRequest, Promise<{
|
|
5
|
+
status: string;
|
|
6
|
+
message: string;
|
|
7
|
+
timestamp: string;
|
|
8
|
+
}>>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { _default as default };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { defineEventHandler } from "h3";
|
|
2
|
-
import { useRuntimeConfig } from "nitro/runtime";
|
|
1
|
+
import { defineEventHandler } from "nitro/h3";
|
|
2
|
+
import { useRuntimeConfig } from "nitro/runtime-config";
|
|
3
|
+
import { $fetch } from "ofetch";
|
|
3
4
|
|
|
4
|
-
//#region src/routes/health.ts
|
|
5
|
+
//#region src/nitro/routes/health.ts
|
|
5
6
|
var health_default = defineEventHandler(async (event) => {
|
|
6
7
|
const runtime = useRuntimeConfig();
|
|
7
8
|
if (!runtime.graphql || !runtime.graphql.endpoint?.graphql) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Nitro } from "nitro/types";
|
|
2
|
+
|
|
3
|
+
//#region src/nitro/setup/extend-loader.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Resolve extend directories for file watching
|
|
6
|
+
*/
|
|
7
|
+
declare function resolveExtendDirs(nitro: Nitro): Promise<string[]>;
|
|
8
|
+
interface ResolveExtendOptions {
|
|
9
|
+
silent?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Resolve extend configuration and add files to Nitro scan results
|
|
13
|
+
*/
|
|
14
|
+
declare function resolveExtendConfig(nitro: Nitro, options?: ResolveExtendOptions): Promise<void>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { resolveExtendConfig, resolveExtendDirs };
|