nitro-graphql 2.0.0-beta.4 → 2.0.0-beta.40
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 +441 -27
- package/dist/cli/commands/generate.d.mts +26 -0
- package/dist/cli/commands/generate.mjs +196 -0
- package/dist/cli/commands/index.d.mts +4 -0
- package/dist/cli/commands/index.mjs +5 -0
- package/dist/cli/commands/init.d.mts +46 -0
- package/dist/cli/commands/init.mjs +195 -0
- package/dist/cli/commands/validate.d.mts +10 -0
- package/dist/cli/commands/validate.mjs +69 -0
- package/dist/cli/completions.d.mts +7 -0
- package/dist/cli/completions.mjs +34 -0
- package/dist/cli/config.d.mts +75 -0
- package/dist/cli/config.mjs +20 -0
- package/dist/cli/index.d.mts +24 -0
- package/dist/cli/index.mjs +253 -0
- package/dist/core/codegen/client.d.mts +23 -0
- package/dist/core/codegen/client.mjs +150 -0
- package/dist/core/codegen/document-loader.d.mts +10 -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 +20 -0
- package/dist/core/codegen/plugin.mjs +30 -0
- package/dist/core/codegen/runtime.d.mts +20 -0
- package/dist/core/codegen/runtime.mjs +60 -0
- package/dist/core/codegen/schema-loader.d.mts +28 -0
- package/dist/core/codegen/schema-loader.mjs +128 -0
- package/dist/core/codegen/server.d.mts +28 -0
- package/dist/core/codegen/server.mjs +143 -0
- package/dist/core/codegen/validation.d.mts +13 -0
- package/dist/core/codegen/validation.mjs +96 -0
- package/dist/core/config.d.mts +50 -0
- package/dist/core/config.mjs +82 -0
- package/dist/core/constants.d.mts +188 -0
- package/dist/core/constants.mjs +210 -0
- package/dist/core/index.d.mts +32 -0
- package/dist/core/index.mjs +26 -0
- package/dist/core/scanning/ast-scanner.d.mts +23 -0
- package/dist/core/scanning/ast-scanner.mjs +103 -0
- package/dist/core/scanning/common.d.mts +37 -0
- package/dist/core/scanning/common.mjs +60 -0
- package/dist/core/scanning/directives.d.mts +10 -0
- package/dist/core/scanning/directives.mjs +29 -0
- package/dist/core/scanning/documents.d.mts +21 -0
- package/dist/core/scanning/documents.mjs +43 -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 +10 -0
- package/dist/core/scanning/resolvers.mjs +58 -0
- package/dist/core/scanning/schemas.d.mts +14 -0
- package/dist/core/scanning/schemas.mjs +64 -0
- package/dist/core/schema/builder.d.mts +53 -0
- package/dist/core/schema/builder.mjs +70 -0
- package/dist/core/schema/federation.d.mts +34 -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/types/adapter.d.mts +58 -0
- package/dist/core/types/codegen.d.mts +133 -0
- package/dist/core/types/config.d.mts +212 -0
- package/dist/core/types/config.mjs +1 -0
- package/dist/{utils/define.d.ts → core/types/define.d.mts} +3 -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 +69 -0
- package/dist/core/types/scanning.mjs +1 -0
- package/dist/{utils/directive-parser.d.ts → core/utils/directive-parser.d.mts} +21 -4
- package/dist/{utils/directive-parser.js → core/utils/directive-parser.mjs} +25 -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 +19 -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/validation/external-services.d.mts +11 -0
- package/dist/core/validation/external-services.mjs +34 -0
- package/dist/core/validation/index.d.mts +2 -0
- package/dist/core/validation/index.mjs +3 -0
- package/dist/define.d.mts +294 -0
- package/dist/define.mjs +323 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +6 -0
- package/dist/nitro/adapter.d.mts +30 -0
- package/dist/nitro/adapter.mjs +97 -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 +19 -0
- package/dist/nitro/codegen.mjs +141 -0
- package/dist/nitro/config.d.mts +52 -0
- package/dist/nitro/config.mjs +58 -0
- package/dist/nitro/index.d.mts +46 -0
- package/dist/nitro/index.mjs +65 -0
- package/dist/nitro/paths.d.mts +54 -0
- package/dist/nitro/paths.mjs +93 -0
- package/dist/nitro/rollup.d.mts +6 -0
- package/dist/nitro/rollup.mjs +95 -0
- package/dist/nitro/routes/apollo-server.d.mts +6 -0
- package/dist/nitro/routes/apollo-server.mjs +71 -0
- package/dist/nitro/routes/debug-template.d.mts +15 -0
- package/dist/nitro/routes/debug-template.mjs +385 -0
- package/dist/nitro/routes/debug.d.mts +55 -0
- package/dist/nitro/routes/debug.mjs +102 -0
- package/dist/nitro/routes/graphql-yoga.d.mts +6 -0
- package/dist/nitro/routes/graphql-yoga.mjs +62 -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/file-watcher.d.mts +16 -0
- package/dist/nitro/setup/file-watcher.mjs +80 -0
- package/dist/nitro/setup/logging.d.mts +17 -0
- package/dist/nitro/setup/logging.mjs +66 -0
- package/dist/nitro/setup/rollup-integration.d.mts +16 -0
- package/dist/nitro/setup/rollup-integration.mjs +90 -0
- package/dist/nitro/setup/routes.d.mts +10 -0
- package/dist/nitro/setup/routes.mjs +35 -0
- package/dist/nitro/setup/ts-config.d.mts +11 -0
- package/dist/nitro/setup/ts-config.mjs +69 -0
- package/dist/nitro/setup.d.mts +12 -0
- package/dist/nitro/setup.mjs +231 -0
- package/dist/nitro/types.d.mts +378 -0
- package/dist/nitro/types.mjs +1 -0
- package/dist/nitro/virtual/generators.d.mts +31 -0
- package/dist/nitro/virtual/generators.mjs +193 -0
- package/dist/nitro/virtual/stubs.d.mts +20 -0
- package/dist/nitro/virtual/stubs.mjs +31 -0
- package/dist/{ecosystem/nuxt.d.ts → nuxt.d.mts} +1 -1
- package/dist/nuxt.mjs +109 -0
- package/dist/{graphql/server.d.ts → stubs/index.d.mts} +5 -1
- package/dist/stubs/index.mjs +1 -0
- package/package.json +97 -78
- 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 -264
- package/dist/rollup.js +0 -119
- package/dist/routes/apollo-server.d.ts +0 -6
- package/dist/routes/apollo-server.js +0 -89
- package/dist/routes/graphql-yoga.d.ts +0 -6
- package/dist/routes/graphql-yoga.js +0 -91
- package/dist/routes/health.d.ts +0 -6
- package/dist/types/index.d.ts +0 -128
- 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/index.d.ts +0 -39
- package/dist/utils/index.js +0 -250
- 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 -287
- package/dist/vite.d.ts +0 -25
- package/dist/vite.js +0 -40
- /package/dist/{graphql/index.js → core/types/adapter.mjs} +0 -0
- /package/dist/{graphql/server.js → core/types/codegen.mjs} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { resolveSecurityConfig } from "./setup/logging.mjs";
|
|
2
|
+
import { Nitro } from "nitro/types";
|
|
3
|
+
|
|
4
|
+
//#region src/nitro/setup.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Main setup function for nitro-graphql
|
|
8
|
+
* Coordinates all initialization steps for the module
|
|
9
|
+
*/
|
|
10
|
+
declare function setupNitroGraphQL(nitro: Nitro): Promise<void>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { resolveSecurityConfig, setupNitroGraphQL };
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { FRAMEWORK_NITRO, FRAMEWORK_NUXT, LOG_TAG } from "../core/constants.mjs";
|
|
2
|
+
import { generateDirectiveSchemas } from "../core/utils/directive-parser.mjs";
|
|
3
|
+
import { validateExternalServices } from "../core/validation/external-services.mjs";
|
|
4
|
+
import { NitroAdapter } from "./adapter.mjs";
|
|
5
|
+
import { getDefaultPaths } from "./paths.mjs";
|
|
6
|
+
import { generateClientTypes, generateServerTypes } from "./codegen.mjs";
|
|
7
|
+
import { DEFAULT_RUNTIME_CONFIG, DEFAULT_TYPESCRIPT_STRICT, DEFAULT_TYPES_CONFIG } from "./config.mjs";
|
|
8
|
+
import { rollupConfig } from "./rollup.mjs";
|
|
9
|
+
import { getWatchDirectories, setupFileWatcher } from "./setup/file-watcher.mjs";
|
|
10
|
+
import { logStartupInfo, resolveSecurityConfig } from "./setup/logging.mjs";
|
|
11
|
+
import { setupRollupChunking, setupRollupExternals } from "./setup/rollup-integration.mjs";
|
|
12
|
+
import { registerRouteHandlers } from "./setup/routes.mjs";
|
|
13
|
+
import { setupTypeScriptPaths } from "./setup/ts-config.mjs";
|
|
14
|
+
import defu from "defu";
|
|
15
|
+
import consola from "consola";
|
|
16
|
+
import { relative, resolve } from "pathe";
|
|
17
|
+
|
|
18
|
+
//#region src/nitro/setup.ts
|
|
19
|
+
const logger = consola.withTag(LOG_TAG);
|
|
20
|
+
/**
|
|
21
|
+
* Scan all GraphQL files and update Nitro state
|
|
22
|
+
*/
|
|
23
|
+
async function scanAllGraphQLFiles(nitro) {
|
|
24
|
+
const directivesResult = await NitroAdapter.scanDirectives(nitro);
|
|
25
|
+
nitro.scanDirectives = directivesResult.items;
|
|
26
|
+
if (!nitro.scanSchemas) nitro.scanSchemas = [];
|
|
27
|
+
const directivesPath = await generateDirectiveSchemas(nitro, directivesResult.items);
|
|
28
|
+
const schemas = (await NitroAdapter.scanSchemas(nitro)).items;
|
|
29
|
+
if (directivesPath && !schemas.includes(directivesPath)) schemas.push(directivesPath);
|
|
30
|
+
nitro.scanSchemas = schemas;
|
|
31
|
+
nitro.scanDocuments = (await NitroAdapter.scanDocuments(nitro)).items;
|
|
32
|
+
nitro.scanResolvers = (await NitroAdapter.scanResolvers(nitro)).items;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Main setup function for nitro-graphql
|
|
36
|
+
* Coordinates all initialization steps for the module
|
|
37
|
+
*/
|
|
38
|
+
async function setupNitroGraphQL(nitro) {
|
|
39
|
+
const serverEnabled = nitro.options.graphql?.server !== false;
|
|
40
|
+
initializeConfiguration(nitro, serverEnabled);
|
|
41
|
+
validateConfiguration(nitro);
|
|
42
|
+
setupBuildDirectories(nitro);
|
|
43
|
+
if (serverEnabled) {
|
|
44
|
+
setupRollupExternals(nitro);
|
|
45
|
+
setupRollupChunking(nitro);
|
|
46
|
+
}
|
|
47
|
+
initializeRuntimeConfig(nitro);
|
|
48
|
+
setupFileWatching(nitro, serverEnabled);
|
|
49
|
+
await scanGraphQLFiles(nitro, serverEnabled);
|
|
50
|
+
if (serverEnabled) setupDevHooks(nitro);
|
|
51
|
+
if (serverEnabled) await rollupConfig(nitro);
|
|
52
|
+
await generateTypes(nitro, serverEnabled);
|
|
53
|
+
setupCloseHooks(nitro, serverEnabled);
|
|
54
|
+
if (serverEnabled) registerRouteHandlers(nitro);
|
|
55
|
+
setupTypeScriptConfiguration(nitro);
|
|
56
|
+
setupNuxtIntegration(nitro);
|
|
57
|
+
logStartupInfo(nitro, serverEnabled);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Initialize default configuration values
|
|
61
|
+
*/
|
|
62
|
+
function initializeConfiguration(nitro, serverEnabled) {
|
|
63
|
+
nitro.options.graphql ||= {};
|
|
64
|
+
nitro.options.graphql.types = defu(nitro.options.graphql.types, DEFAULT_TYPES_CONFIG);
|
|
65
|
+
if (serverEnabled && !nitro.options.graphql?.framework) logger.warn("No GraphQL framework specified. Please set graphql.framework to \"graphql-yoga\" or \"apollo-server\".");
|
|
66
|
+
const defaultPaths = getDefaultPaths(nitro);
|
|
67
|
+
nitro.graphql ||= {
|
|
68
|
+
buildDir: "",
|
|
69
|
+
watchDirs: [],
|
|
70
|
+
clientDir: defaultPaths.clientGraphql,
|
|
71
|
+
serverDir: defaultPaths.serverGraphql,
|
|
72
|
+
dir: {
|
|
73
|
+
build: relative(nitro.options.rootDir, nitro.options.buildDir),
|
|
74
|
+
client: "graphql",
|
|
75
|
+
server: "server"
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
nitro.scanSchemas ||= [];
|
|
79
|
+
nitro.scanResolvers ||= [];
|
|
80
|
+
nitro.scanDirectives ||= [];
|
|
81
|
+
nitro.scanDocuments ||= [];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Validate external services configuration
|
|
85
|
+
*/
|
|
86
|
+
function validateConfiguration(nitro) {
|
|
87
|
+
if (nitro.options.graphql?.externalServices?.length) {
|
|
88
|
+
const validationErrors = validateExternalServices(nitro.options.graphql.externalServices);
|
|
89
|
+
if (validationErrors.length > 0) {
|
|
90
|
+
logger.error("External services configuration errors:");
|
|
91
|
+
for (const error of validationErrors) logger.error(` - ${error}`);
|
|
92
|
+
throw new Error("Invalid external services configuration");
|
|
93
|
+
}
|
|
94
|
+
logger.info(`Configured ${nitro.options.graphql.externalServices.length} external GraphQL services`);
|
|
95
|
+
}
|
|
96
|
+
if (nitro.options.graphql?.federation?.enabled) logger.info(`Apollo Federation enabled for service: ${nitro.options.graphql.federation.serviceName || "unnamed"}`);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Setup build directories
|
|
100
|
+
*/
|
|
101
|
+
function setupBuildDirectories(nitro) {
|
|
102
|
+
const graphqlBuildDir = resolve(nitro.options.buildDir, "graphql");
|
|
103
|
+
nitro.graphql.buildDir = graphqlBuildDir;
|
|
104
|
+
switch (nitro.options.framework.name) {
|
|
105
|
+
case FRAMEWORK_NUXT:
|
|
106
|
+
nitro.graphql.dir.client = relative(nitro.options.rootDir, nitro.graphql.clientDir);
|
|
107
|
+
nitro.graphql.dir.server = relative(nitro.options.rootDir, nitro.graphql.serverDir);
|
|
108
|
+
break;
|
|
109
|
+
case FRAMEWORK_NITRO:
|
|
110
|
+
nitro.graphql.dir.client = relative(nitro.options.rootDir, nitro.graphql.clientDir);
|
|
111
|
+
nitro.graphql.dir.server = relative(nitro.options.rootDir, nitro.graphql.serverDir);
|
|
112
|
+
break;
|
|
113
|
+
default: break;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Initialize runtime configuration
|
|
118
|
+
*/
|
|
119
|
+
function initializeRuntimeConfig(nitro) {
|
|
120
|
+
const securityConfig = resolveSecurityConfig(nitro.options.graphql?.security);
|
|
121
|
+
nitro.options.runtimeConfig.graphql = defu(nitro.options.runtimeConfig.graphql || {}, {
|
|
122
|
+
...DEFAULT_RUNTIME_CONFIG,
|
|
123
|
+
security: securityConfig
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Setup file watching for development mode
|
|
128
|
+
*/
|
|
129
|
+
function setupFileWatching(nitro, serverEnabled) {
|
|
130
|
+
const watchDirs = serverEnabled ? getWatchDirectories(nitro) : [nitro.graphql.clientDir].filter(Boolean);
|
|
131
|
+
nitro.graphql.watchDirs = watchDirs;
|
|
132
|
+
const watcher = setupFileWatcher(nitro, watchDirs);
|
|
133
|
+
nitro.hooks.hook("close", () => {
|
|
134
|
+
watcher.close();
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Scan all GraphQL files (schemas, resolvers, directives, documents)
|
|
139
|
+
*/
|
|
140
|
+
async function scanGraphQLFiles(nitro, serverEnabled) {
|
|
141
|
+
const skipLocalScan = nitro.options.graphql?.skipLocalScan === true;
|
|
142
|
+
const extendSources = nitro.options.graphql?.extend;
|
|
143
|
+
if (skipLocalScan && extendSources?.length) {
|
|
144
|
+
logger.info(`Using ${extendSources.length} extend source(s), skipping local scanning`);
|
|
145
|
+
nitro.scanSchemas = [];
|
|
146
|
+
nitro.scanResolvers = [];
|
|
147
|
+
nitro.scanDirectives = [];
|
|
148
|
+
nitro.scanDocuments = (await NitroAdapter.scanDocuments(nitro)).items;
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
if (serverEnabled) await scanAllGraphQLFiles(nitro);
|
|
152
|
+
else nitro.scanDocuments = (await NitroAdapter.scanDocuments(nitro)).items;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Setup dev mode hooks for rescanning files
|
|
156
|
+
*/
|
|
157
|
+
function setupDevHooks(nitro) {
|
|
158
|
+
let hasShownInitialLogs = false;
|
|
159
|
+
nitro.hooks.hook("dev:start", async () => {
|
|
160
|
+
await scanAllGraphQLFiles(nitro);
|
|
161
|
+
if (nitro.options.dev && !hasShownInitialLogs) {
|
|
162
|
+
hasShownInitialLogs = true;
|
|
163
|
+
logResolverDiagnostics(nitro);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Log resolver diagnostics for development
|
|
169
|
+
*/
|
|
170
|
+
function logResolverDiagnostics(nitro) {
|
|
171
|
+
const resolvers = nitro.scanResolvers || [];
|
|
172
|
+
if (resolvers.length > 0) {
|
|
173
|
+
const totalExports = resolvers.reduce((sum, r) => sum + r.imports.length, 0);
|
|
174
|
+
const typeCount = {
|
|
175
|
+
query: 0,
|
|
176
|
+
mutation: 0,
|
|
177
|
+
resolver: 0,
|
|
178
|
+
type: 0,
|
|
179
|
+
subscription: 0,
|
|
180
|
+
directive: 0
|
|
181
|
+
};
|
|
182
|
+
for (const resolver of resolvers) for (const imp of resolver.imports) if (imp.type in typeCount) typeCount[imp.type]++;
|
|
183
|
+
const breakdown = [];
|
|
184
|
+
if (typeCount.query > 0) breakdown.push(`${typeCount.query} query`);
|
|
185
|
+
if (typeCount.mutation > 0) breakdown.push(`${typeCount.mutation} mutation`);
|
|
186
|
+
if (typeCount.resolver > 0) breakdown.push(`${typeCount.resolver} resolver`);
|
|
187
|
+
if (typeCount.type > 0) breakdown.push(`${typeCount.type} type`);
|
|
188
|
+
if (typeCount.subscription > 0) breakdown.push(`${typeCount.subscription} subscription`);
|
|
189
|
+
if (typeCount.directive > 0) breakdown.push(`${typeCount.directive} directive`);
|
|
190
|
+
if (breakdown.length > 0) logger.success(`${totalExports} resolver export(s): ${breakdown.join(", ")}`);
|
|
191
|
+
} else logger.warn("No resolvers found. Check /_nitro/graphql/debug for details.");
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Generate server and client types
|
|
195
|
+
*/
|
|
196
|
+
async function generateTypes(nitro, serverEnabled) {
|
|
197
|
+
if (serverEnabled) {
|
|
198
|
+
await generateServerTypes(nitro);
|
|
199
|
+
await generateClientTypes(nitro, { isInitial: true });
|
|
200
|
+
} else await generateClientTypes(nitro, { isInitial: true });
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Setup close hooks for final type generation
|
|
204
|
+
*/
|
|
205
|
+
function setupCloseHooks(nitro, serverEnabled) {
|
|
206
|
+
nitro.hooks.hook("close", async () => {
|
|
207
|
+
if (serverEnabled) await generateServerTypes(nitro, { silent: true });
|
|
208
|
+
await generateClientTypes(nitro, { silent: true });
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Setup TypeScript configuration and path aliases
|
|
213
|
+
*/
|
|
214
|
+
function setupTypeScriptConfiguration(nitro) {
|
|
215
|
+
nitro.options.typescript.strict = DEFAULT_TYPESCRIPT_STRICT;
|
|
216
|
+
nitro.hooks.hook("types:extend", (types) => {
|
|
217
|
+
setupTypeScriptPaths(nitro, types);
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Setup Nuxt-specific integration
|
|
222
|
+
*/
|
|
223
|
+
function setupNuxtIntegration(nitro) {
|
|
224
|
+
if (nitro.options.framework?.name === FRAMEWORK_NUXT && nitro.options.graphql?.externalServices?.length) nitro.hooks.hook("build:before", () => {
|
|
225
|
+
const nuxtOptions = nitro._nuxt?.options;
|
|
226
|
+
if (nuxtOptions) nuxtOptions.nitroGraphqlExternalServices = nitro.options.graphql?.externalServices || [];
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
//#endregion
|
|
231
|
+
export { resolveSecurityConfig, setupNitroGraphQL };
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import { TypeScriptPluginConfig } from "@graphql-codegen/typescript";
|
|
2
|
+
import { plugin as plugin$1 } from "@graphql-codegen/typescript-generic-sdk";
|
|
3
|
+
import { TypeScriptDocumentsPluginConfig } from "@graphql-codegen/typescript-operations";
|
|
4
|
+
import { IResolvers } from "@graphql-tools/utils";
|
|
5
|
+
import { GraphQLSchema } from "graphql";
|
|
6
|
+
import { TypeScriptResolversPluginConfig } from "@graphql-codegen/typescript-resolvers";
|
|
7
|
+
import { ESMCodeGenOptions } from "knitwork";
|
|
8
|
+
import { ApolloServerOptions } from "@apollo/server";
|
|
9
|
+
import { H3Event } from "nitro/h3";
|
|
10
|
+
import { YogaServerOptions } from "graphql-yoga";
|
|
11
|
+
import { NPMConfig } from "#graphql/server";
|
|
12
|
+
|
|
13
|
+
//#region src/nitro/types.d.ts
|
|
14
|
+
|
|
15
|
+
/** The Standard Schema interface. */
|
|
16
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
17
|
+
/** The Standard Schema properties. */
|
|
18
|
+
readonly '~standard': StandardSchemaV1.Props<Input, Output>;
|
|
19
|
+
}
|
|
20
|
+
declare namespace StandardSchemaV1 {
|
|
21
|
+
/** The Standard Schema properties interface. */
|
|
22
|
+
export interface Props<Input = unknown, Output = Input> {
|
|
23
|
+
/** The version number of the standard. */
|
|
24
|
+
readonly version: 1;
|
|
25
|
+
/** The vendor name of the schema library. */
|
|
26
|
+
readonly vendor: string;
|
|
27
|
+
/** Validates unknown input values. */
|
|
28
|
+
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
29
|
+
/** Inferred types associated with the schema. */
|
|
30
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
31
|
+
}
|
|
32
|
+
/** The result interface of the validate function. */
|
|
33
|
+
export type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
34
|
+
/** The result interface if validation succeeds. */
|
|
35
|
+
export interface SuccessResult<Output> {
|
|
36
|
+
/** The typed output value. */
|
|
37
|
+
readonly value: Output;
|
|
38
|
+
/** The non-existent issues. */
|
|
39
|
+
readonly issues?: undefined;
|
|
40
|
+
}
|
|
41
|
+
/** The result interface if validation fails. */
|
|
42
|
+
export interface FailureResult {
|
|
43
|
+
/** The issues of failed validation. */
|
|
44
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
45
|
+
}
|
|
46
|
+
/** The issue interface of the failure output. */
|
|
47
|
+
export interface Issue {
|
|
48
|
+
/** The error message of the issue. */
|
|
49
|
+
readonly message: string;
|
|
50
|
+
/** The path of the issue, if any. */
|
|
51
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
52
|
+
}
|
|
53
|
+
/** The path segment interface of the issue. */
|
|
54
|
+
export interface PathSegment {
|
|
55
|
+
/** The key representing a path segment. */
|
|
56
|
+
readonly key: PropertyKey;
|
|
57
|
+
}
|
|
58
|
+
/** The Standard Schema types interface. */
|
|
59
|
+
export interface Types<Input = unknown, Output = Input> {
|
|
60
|
+
/** The input type of the schema. */
|
|
61
|
+
readonly input: Input;
|
|
62
|
+
/** The output type of the schema. */
|
|
63
|
+
readonly output: Output;
|
|
64
|
+
}
|
|
65
|
+
/** Infers the input type of a Standard Schema. */
|
|
66
|
+
export type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];
|
|
67
|
+
/** Infers the output type of a Standard Schema. */
|
|
68
|
+
export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
|
|
69
|
+
export {};
|
|
70
|
+
}
|
|
71
|
+
type Flatten<T> = T extends infer U ? { [K in keyof U]: U[K] } : never;
|
|
72
|
+
type DefineServerConfig<T extends NPMConfig = NPMConfig> = T['framework'] extends 'graphql-yoga' ? Partial<YogaServerOptions<H3Event, Partial<H3Event>>> : T['framework'] extends 'apollo-server' ? Partial<ApolloServerOptions<H3Event>> : Partial<YogaServerOptions<H3Event, Partial<H3Event>>> | Partial<ApolloServerOptions<H3Event>>;
|
|
73
|
+
type DirectiveLocationName = 'QUERY' | 'MUTATION' | 'SUBSCRIPTION' | 'FIELD' | 'FRAGMENT_DEFINITION' | 'FRAGMENT_SPREAD' | 'INLINE_FRAGMENT' | 'VARIABLE_DEFINITION' | 'SCHEMA' | 'SCALAR' | 'OBJECT' | 'FIELD_DEFINITION' | 'ARGUMENT_DEFINITION' | 'INTERFACE' | 'UNION' | 'ENUM' | 'ENUM_VALUE' | 'INPUT_OBJECT' | 'INPUT_FIELD_DEFINITION';
|
|
74
|
+
type GraphQLScalarType = 'String' | 'Int' | 'Float' | 'Boolean' | 'ID' | 'JSON' | 'DateTime';
|
|
75
|
+
type GraphQLBaseType = GraphQLScalarType | (string & {});
|
|
76
|
+
type GraphQLArgumentType = 'String' | 'Int' | 'Float' | 'Boolean' | 'ID' | 'JSON' | 'DateTime' | 'String!' | 'Int!' | 'Float!' | 'Boolean!' | 'ID!' | 'JSON!' | 'DateTime!' | '[String]' | '[String!]' | '[String]!' | '[String!]!' | '[Int]' | '[Int!]' | '[Int]!' | '[Int!]!' | '[Float]' | '[Float!]' | '[Float]!' | '[Float!]!' | '[Boolean]' | '[Boolean!]' | '[Boolean]!' | '[Boolean!]!' | '[ID]' | '[ID!]' | '[ID]!' | '[ID!]!' | '[JSON]' | '[JSON!]' | '[JSON]!' | '[JSON!]!' | '[DateTime]' | '[DateTime!]' | '[DateTime]!' | '[DateTime!]!' | (string & {});
|
|
77
|
+
interface DirectiveArgument<T extends GraphQLArgumentType = GraphQLArgumentType> {
|
|
78
|
+
/**
|
|
79
|
+
* GraphQL type for the argument
|
|
80
|
+
* @example 'String', 'Int!', '[String!]!', 'DateTime', 'JSON'
|
|
81
|
+
*/
|
|
82
|
+
type: T;
|
|
83
|
+
defaultValue?: any;
|
|
84
|
+
description?: string;
|
|
85
|
+
}
|
|
86
|
+
interface DirectiveArg {
|
|
87
|
+
type: GraphQLArgumentType;
|
|
88
|
+
defaultValue?: any;
|
|
89
|
+
description?: string;
|
|
90
|
+
}
|
|
91
|
+
interface DirectiveDefinition {
|
|
92
|
+
name: string;
|
|
93
|
+
locations: DirectiveLocationName[];
|
|
94
|
+
args?: Record<string, DirectiveArg>;
|
|
95
|
+
description?: string;
|
|
96
|
+
isRepeatable?: boolean;
|
|
97
|
+
transformer?: (schema: GraphQLSchema) => GraphQLSchema;
|
|
98
|
+
}
|
|
99
|
+
interface DefineDirectiveConfig {
|
|
100
|
+
name: string;
|
|
101
|
+
locations: ReadonlyArray<DirectiveLocationName>;
|
|
102
|
+
args?: Record<string, {
|
|
103
|
+
type: GraphQLArgumentType;
|
|
104
|
+
defaultValue?: any;
|
|
105
|
+
description?: string;
|
|
106
|
+
}>;
|
|
107
|
+
description?: string;
|
|
108
|
+
isRepeatable?: boolean;
|
|
109
|
+
transformer?: (schema: GraphQLSchema) => GraphQLSchema;
|
|
110
|
+
}
|
|
111
|
+
type CodegenServerConfig = TypeScriptPluginConfig & TypeScriptResolversPluginConfig;
|
|
112
|
+
type DocumentModeConfig = Pick<Parameters<typeof plugin$1>[2], 'documentMode'>;
|
|
113
|
+
type DocumentModeEnum = NonNullable<DocumentModeConfig['documentMode']>;
|
|
114
|
+
type DocumentModeType = `${DocumentModeEnum}`;
|
|
115
|
+
type GenericSdkConfig = Omit<Parameters<typeof plugin$1>[2], 'documentMode'> & {
|
|
116
|
+
documentMode?: DocumentModeType;
|
|
117
|
+
};
|
|
118
|
+
type CodegenClientConfig = TypeScriptPluginConfig & TypeScriptDocumentsPluginConfig & {
|
|
119
|
+
endpoint?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Generate TypedDocumentNode exports for urql/Apollo Client compatibility.
|
|
122
|
+
* When enabled, generates typed document constants that can be used with
|
|
123
|
+
* any GraphQL client that supports TypedDocumentNode.
|
|
124
|
+
* @default false
|
|
125
|
+
*/
|
|
126
|
+
typedDocumentNode?: boolean;
|
|
127
|
+
};
|
|
128
|
+
interface IESMImport {
|
|
129
|
+
name: string;
|
|
130
|
+
as?: string;
|
|
131
|
+
type: 'resolver' | 'query' | 'mutation' | 'type' | 'subscription' | 'directive';
|
|
132
|
+
}
|
|
133
|
+
interface GenImport {
|
|
134
|
+
specifier: string;
|
|
135
|
+
imports: IESMImport[];
|
|
136
|
+
options?: ESMCodeGenOptions;
|
|
137
|
+
}
|
|
138
|
+
declare module 'nitro/types' {
|
|
139
|
+
interface Nitro {
|
|
140
|
+
scanSchemas: string[];
|
|
141
|
+
scanDocuments: string[];
|
|
142
|
+
scanResolvers: GenImport[];
|
|
143
|
+
scanDirectives: GenImport[];
|
|
144
|
+
graphql: {
|
|
145
|
+
buildDir: string;
|
|
146
|
+
watchDirs: string[];
|
|
147
|
+
clientDir: string;
|
|
148
|
+
serverDir: string;
|
|
149
|
+
dir: {
|
|
150
|
+
build: string;
|
|
151
|
+
client: string;
|
|
152
|
+
server: string;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
declare module 'nitro/types' {
|
|
158
|
+
interface NitroOptions {
|
|
159
|
+
graphql?: NitroGraphQLOptions;
|
|
160
|
+
}
|
|
161
|
+
interface NitroRuntimeConfig {
|
|
162
|
+
graphql?: NitroGraphQLOptions;
|
|
163
|
+
}
|
|
164
|
+
interface NitroConfig {
|
|
165
|
+
graphql?: NitroGraphQLOptions;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Service-specific path overrides for external GraphQL services
|
|
170
|
+
* These paths override global config for this specific service
|
|
171
|
+
*/
|
|
172
|
+
interface ExternalServicePaths {
|
|
173
|
+
/** SDK file path (overrides global sdk.external config) */
|
|
174
|
+
sdk?: FileGenerationConfig;
|
|
175
|
+
/** Type definitions file path (overrides global types.external config) */
|
|
176
|
+
types?: FileGenerationConfig;
|
|
177
|
+
}
|
|
178
|
+
interface ExternalGraphQLService {
|
|
179
|
+
/** Unique name for this service (used for file naming and type generation) */
|
|
180
|
+
name: string;
|
|
181
|
+
/** GraphQL endpoint for this service (also used as schema source if `schema` is not specified) */
|
|
182
|
+
endpoint: string;
|
|
183
|
+
/**
|
|
184
|
+
* Schema source - can be URL(s) for remote schemas or file path(s) for local schemas
|
|
185
|
+
* @default Uses `endpoint` for introspection if not specified
|
|
186
|
+
*/
|
|
187
|
+
schema?: string | string[];
|
|
188
|
+
/** Optional headers for schema introspection and client requests */
|
|
189
|
+
headers?: Record<string, string> | (() => Record<string, string>);
|
|
190
|
+
/** Optional: specific document patterns for this service */
|
|
191
|
+
documents?: string[];
|
|
192
|
+
/**
|
|
193
|
+
* Optional: Download and cache schema locally for offline usage
|
|
194
|
+
* - true or 'once': Download if file doesn't exist, then use cached version (offline-friendly)
|
|
195
|
+
* - 'always': Check for updates on every build (current behavior)
|
|
196
|
+
* - 'manual': Never download automatically, user manages schema files manually
|
|
197
|
+
* - false: Disable schema downloading
|
|
198
|
+
*/
|
|
199
|
+
downloadSchema?: boolean | 'once' | 'always' | 'manual';
|
|
200
|
+
/** Optional: Custom path to save downloaded schema (default: .nitro/graphql/schemas/[serviceName].graphql) */
|
|
201
|
+
downloadPath?: string;
|
|
202
|
+
/** Optional: service-specific codegen configuration */
|
|
203
|
+
codegen?: {
|
|
204
|
+
client?: CodegenClientConfig;
|
|
205
|
+
clientSDK?: GenericSdkConfig;
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Optional: Service-specific path overrides
|
|
209
|
+
* These paths take precedence over global config (sdk, types, clientUtils)
|
|
210
|
+
* Supports placeholders: {serviceName}, {buildDir}, {rootDir}, {framework}, {typesDir}, {clientGraphql}
|
|
211
|
+
*/
|
|
212
|
+
paths?: ExternalServicePaths;
|
|
213
|
+
}
|
|
214
|
+
interface FederationConfig {
|
|
215
|
+
/** Enable Apollo Federation subgraph support */
|
|
216
|
+
enabled: boolean;
|
|
217
|
+
/** Service name for federation (used in subgraph config) */
|
|
218
|
+
serviceName?: string;
|
|
219
|
+
/** Service version for federation */
|
|
220
|
+
serviceVersion?: string;
|
|
221
|
+
/** Service URL for federation gateway */
|
|
222
|
+
serviceUrl?: string;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* File generation control:
|
|
226
|
+
* - false: Do not generate this file
|
|
227
|
+
* - true: Generate at default location
|
|
228
|
+
* - string: Generate at custom path (supports placeholders: {serviceName}, {buildDir}, {rootDir}, {framework})
|
|
229
|
+
*/
|
|
230
|
+
type FileGenerationConfig = boolean | string;
|
|
231
|
+
/**
|
|
232
|
+
* SDK files configuration
|
|
233
|
+
* Control auto-generation of GraphQL SDK files
|
|
234
|
+
*/
|
|
235
|
+
interface SdkConfig {
|
|
236
|
+
/** Enable/disable all SDK files */
|
|
237
|
+
enabled?: boolean;
|
|
238
|
+
/** app/graphql/default/sdk.ts - Main service SDK */
|
|
239
|
+
main?: FileGenerationConfig;
|
|
240
|
+
/** app/graphql/{serviceName}/sdk.ts - External service SDKs */
|
|
241
|
+
external?: FileGenerationConfig;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Type files configuration
|
|
245
|
+
* Control auto-generation of TypeScript type definition files
|
|
246
|
+
*/
|
|
247
|
+
interface TypesConfig {
|
|
248
|
+
/** Enable/disable all type files */
|
|
249
|
+
enabled?: boolean;
|
|
250
|
+
/** .nitro/types/nitro-graphql-server.d.ts - Server-side types */
|
|
251
|
+
server?: FileGenerationConfig;
|
|
252
|
+
/** .nitro/types/nitro-graphql-client.d.ts - Client-side types */
|
|
253
|
+
client?: FileGenerationConfig;
|
|
254
|
+
/** .nitro/types/nitro-graphql-client-{serviceName}.d.ts - External service types */
|
|
255
|
+
external?: FileGenerationConfig;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Global path overrides
|
|
259
|
+
* Set base directories for file generation
|
|
260
|
+
*/
|
|
261
|
+
interface PathsConfig {
|
|
262
|
+
/** Server GraphQL directory (default: 'server/graphql') */
|
|
263
|
+
serverGraphql?: string;
|
|
264
|
+
/** Client GraphQL directory (default: 'app/graphql' for Nuxt, 'graphql' for Nitro) */
|
|
265
|
+
clientGraphql?: string;
|
|
266
|
+
/** Build directory (default: '.nitro' or '.nuxt') */
|
|
267
|
+
buildDir?: string;
|
|
268
|
+
/** Types directory (default: '{buildDir}/types') */
|
|
269
|
+
typesDir?: string;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Security configuration for production environments
|
|
273
|
+
* All options auto-detect based on NODE_ENV when not explicitly set
|
|
274
|
+
*/
|
|
275
|
+
interface SecurityConfig {
|
|
276
|
+
/**
|
|
277
|
+
* Enable GraphQL introspection queries
|
|
278
|
+
* @default true in development, false in production
|
|
279
|
+
*/
|
|
280
|
+
introspection?: boolean;
|
|
281
|
+
/**
|
|
282
|
+
* Enable GraphQL playground/sandbox UI
|
|
283
|
+
* @default true in development, false in production
|
|
284
|
+
*/
|
|
285
|
+
playground?: boolean;
|
|
286
|
+
/**
|
|
287
|
+
* Mask internal error details in responses
|
|
288
|
+
* When enabled, internal errors show "Internal server error" instead of actual message
|
|
289
|
+
* @default false in development, true in production
|
|
290
|
+
*/
|
|
291
|
+
maskErrors?: boolean;
|
|
292
|
+
/**
|
|
293
|
+
* Disable "Did you mean X?" field suggestions in error messages
|
|
294
|
+
* Prevents attackers from discovering field names via brute force
|
|
295
|
+
* @default false in development, true in production
|
|
296
|
+
*/
|
|
297
|
+
disableSuggestions?: boolean;
|
|
298
|
+
}
|
|
299
|
+
interface NitroGraphQLOptions {
|
|
300
|
+
framework?: 'graphql-yoga' | 'apollo-server';
|
|
301
|
+
/**
|
|
302
|
+
* Enable/disable GraphQL server functionality
|
|
303
|
+
* When set to false, only external services client types will be generated
|
|
304
|
+
* Server routes, resolvers, schemas, and directives will not be processed
|
|
305
|
+
* @default true
|
|
306
|
+
*/
|
|
307
|
+
server?: boolean;
|
|
308
|
+
endpoint?: {
|
|
309
|
+
graphql?: string;
|
|
310
|
+
healthCheck?: string;
|
|
311
|
+
};
|
|
312
|
+
playground?: boolean;
|
|
313
|
+
typedefs?: string[];
|
|
314
|
+
resolvers?: Array<IResolvers<any, any>>;
|
|
315
|
+
loader?: {
|
|
316
|
+
include?: RegExp;
|
|
317
|
+
exclude?: RegExp;
|
|
318
|
+
validate?: boolean;
|
|
319
|
+
};
|
|
320
|
+
codegen?: {
|
|
321
|
+
server?: CodegenServerConfig;
|
|
322
|
+
client?: CodegenClientConfig;
|
|
323
|
+
clientSDK?: GenericSdkConfig;
|
|
324
|
+
};
|
|
325
|
+
/** External GraphQL services to generate types and SDKs for */
|
|
326
|
+
externalServices?: ExternalGraphQLService[];
|
|
327
|
+
/** Apollo Federation configuration */
|
|
328
|
+
federation?: FederationConfig;
|
|
329
|
+
/** Server GraphQL directory path */
|
|
330
|
+
serverDir?: string;
|
|
331
|
+
/** Layer directories (populated by Nuxt module) */
|
|
332
|
+
layerDirectories?: string[];
|
|
333
|
+
layerServerDirs?: string[];
|
|
334
|
+
layerAppDirs?: string[];
|
|
335
|
+
/**
|
|
336
|
+
* SDK files configuration
|
|
337
|
+
* Set to false to disable all SDK generation
|
|
338
|
+
*/
|
|
339
|
+
sdk?: false | SdkConfig;
|
|
340
|
+
/**
|
|
341
|
+
* Type files configuration
|
|
342
|
+
* Set to false to disable all type generation
|
|
343
|
+
*/
|
|
344
|
+
types?: false | TypesConfig;
|
|
345
|
+
/**
|
|
346
|
+
* Global path overrides
|
|
347
|
+
* Customize base directories for file generation
|
|
348
|
+
*/
|
|
349
|
+
paths?: PathsConfig;
|
|
350
|
+
/**
|
|
351
|
+
* Security configuration for production environments
|
|
352
|
+
* Auto-detects NODE_ENV and applies secure defaults in production
|
|
353
|
+
*/
|
|
354
|
+
security?: SecurityConfig;
|
|
355
|
+
/**
|
|
356
|
+
* Extend GraphQL server with external packages
|
|
357
|
+
* Auto-appends /resolvers and /schema to each package path
|
|
358
|
+
* @example extend: ['@myorg/graphql', './generated']
|
|
359
|
+
*/
|
|
360
|
+
extend?: ExtendSource[];
|
|
361
|
+
/**
|
|
362
|
+
* Skip local file scanning, use only extend sources
|
|
363
|
+
* When true, only files from `extend` are used (local server/graphql ignored)
|
|
364
|
+
* @default false
|
|
365
|
+
*/
|
|
366
|
+
skipLocalScan?: boolean;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Extend source - package path or detailed config
|
|
370
|
+
* - string: auto-appends /resolvers and /schema
|
|
371
|
+
* - object: explicit paths for resolvers and/or schemas
|
|
372
|
+
*/
|
|
373
|
+
type ExtendSource = string | {
|
|
374
|
+
resolvers?: string | string[];
|
|
375
|
+
schemas?: string | string[];
|
|
376
|
+
};
|
|
377
|
+
//#endregion
|
|
378
|
+
export { CodegenClientConfig, CodegenServerConfig, DefineDirectiveConfig, DefineServerConfig, DirectiveArgument, DirectiveDefinition, ExtendSource, ExternalGraphQLService, ExternalServicePaths, FederationConfig, FileGenerationConfig, Flatten, GenImport, GenericSdkConfig, GraphQLArgumentType, GraphQLBaseType, GraphQLScalarType, NitroGraphQLOptions, PathsConfig, SdkConfig, SecurityConfig, StandardSchemaV1, TypesConfig };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Nitro } from "nitro/types";
|
|
2
|
+
|
|
3
|
+
//#region src/nitro/virtual/generators.d.ts
|
|
4
|
+
|
|
5
|
+
declare const serverSchemas: {
|
|
6
|
+
id: string;
|
|
7
|
+
getCode: (nitro: Nitro) => string;
|
|
8
|
+
};
|
|
9
|
+
declare const serverResolvers: {
|
|
10
|
+
id: string;
|
|
11
|
+
getCode: (nitro: Nitro) => string;
|
|
12
|
+
};
|
|
13
|
+
declare const serverDirectives: {
|
|
14
|
+
id: string;
|
|
15
|
+
getCode: (nitro: Nitro) => string;
|
|
16
|
+
};
|
|
17
|
+
declare const graphqlConfig: {
|
|
18
|
+
id: string;
|
|
19
|
+
getCode: (nitro: Nitro) => string;
|
|
20
|
+
};
|
|
21
|
+
declare const moduleConfig: {
|
|
22
|
+
id: string;
|
|
23
|
+
getCode: (nitro: Nitro) => string;
|
|
24
|
+
};
|
|
25
|
+
declare const debugInfo: {
|
|
26
|
+
id: string;
|
|
27
|
+
getCode: (nitro: Nitro) => string;
|
|
28
|
+
};
|
|
29
|
+
declare function registerAllVirtualModules(nitro: Nitro): void;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { debugInfo, graphqlConfig, moduleConfig, registerAllVirtualModules, serverDirectives, serverResolvers, serverSchemas };
|