nitro-graphql 2.0.0-beta.72 → 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 +6 -29
- package/dist/cli/commands/generate.mjs +2 -2
- package/dist/cli/config.d.mts +4 -5
- package/dist/cli/config.mjs +3 -1
- package/dist/cli/index.d.mts +3 -6
- package/dist/cli/index.mjs +1 -1
- package/dist/cli/server/graphql-handler.mjs +2 -1
- package/dist/cli/server/watcher.mjs +1 -1
- package/dist/core/codegen/client.d.mts +4 -27
- package/dist/core/codegen/client.mjs +26 -445
- 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 -5
- package/dist/core/codegen/{runtime.d.mts → runtime-generator.d.mts} +1 -1
- package/dist/core/codegen/{runtime.mjs → runtime-generator.mjs} +1 -1
- package/dist/core/codegen/schema-loader.d.mts +2 -7
- package/dist/core/codegen/schema-loader.mjs +65 -70
- 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 -105
- package/dist/core/codegen/subscription-extractor.d.mts +20 -0
- package/dist/core/codegen/subscription-extractor.mjs +30 -0
- 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 -54
- 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 -2
- package/dist/core/debug/template.d.mts +1 -5
- package/dist/core/debug/template.mjs +1 -1
- package/dist/core/extend/loader.d.mts +0 -1
- package/dist/core/extend/loader.mjs +59 -89
- package/dist/core/index.d.mts +22 -17
- package/dist/core/index.mjs +19 -15
- package/dist/core/manifest.mjs +3 -1
- package/dist/core/pubsub/index.d.mts +2 -109
- package/dist/core/pubsub/index.mjs +1 -145
- 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 +4 -2
- package/dist/core/scanning/directives.mjs +2 -3
- package/dist/core/scanning/documents.d.mts +4 -3
- package/dist/core/scanning/documents.mjs +1 -1
- package/dist/core/scanning/{common.d.mts → file-scanner.d.mts} +1 -1
- package/dist/core/scanning/{common.mjs → file-scanner.mjs} +2 -10
- package/dist/core/scanning/index.d.mts +3 -3
- package/dist/core/scanning/index.mjs +3 -3
- package/dist/core/scanning/resolvers.mjs +8 -9
- package/dist/core/scanning/schemas.d.mts +1 -5
- package/dist/core/scanning/schemas.mjs +2 -24
- package/dist/core/schema/builder.d.mts +4 -2
- package/dist/core/schema/builder.mjs +4 -2
- package/dist/core/schema/index.d.mts +2 -2
- package/dist/core/schema/index.mjs +2 -2
- 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 -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 -13
- package/dist/core/types/adapter.d.mts +4 -39
- package/dist/core/types/codegen.d.mts +22 -45
- package/dist/core/types/config.d.mts +33 -121
- package/dist/core/types/define.d.mts +8 -5
- package/dist/core/types/index.d.mts +5 -4
- package/dist/core/types/scanning.d.mts +4 -1
- package/dist/core/types/standard-schema.d.mts +64 -0
- package/dist/core/utils/directive-parser.d.mts +8 -63
- package/dist/core/utils/directive-parser.mjs +114 -166
- package/dist/core/utils/file-io.d.mts +1 -5
- package/dist/core/utils/file-io.mjs +1 -11
- package/dist/core/utils/index.d.mts +5 -4
- package/dist/core/utils/index.mjs +6 -5
- package/dist/core/utils/logger.d.mts +1 -10
- package/dist/core/utils/logger.mjs +1 -19
- package/dist/core/utils/ofetch-templates.mjs +3 -4
- package/dist/core/utils/runtime.d.mts +1 -30
- package/dist/core/utils/runtime.mjs +2 -44
- package/dist/core/utils/string.d.mts +10 -0
- package/dist/core/utils/string.mjs +12 -0
- 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 +1 -139
- package/dist/define.d.mts +4 -2
- package/dist/define.mjs +7 -6
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +1 -1
- package/dist/nitro/adapter.d.mts +6 -10
- package/dist/nitro/adapter.mjs +12 -42
- 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 +1 -1
- package/dist/nitro/paths.d.mts +3 -2
- package/dist/nitro/paths.mjs +13 -9
- package/dist/nitro/rollup.mjs +4 -3
- package/dist/nitro/routes/_ws-handler.d.mts +6 -0
- package/dist/nitro/routes/_ws-handler.mjs +49 -0
- package/dist/nitro/routes/apollo-server-ws.d.mts +1 -1
- package/dist/nitro/routes/apollo-server-ws.mjs +9 -44
- package/dist/nitro/routes/apollo-server.d.mts +1 -1
- package/dist/nitro/routes/apollo-server.mjs +16 -55
- package/dist/nitro/routes/debug.d.mts +1 -1
- package/dist/nitro/routes/debug.mjs +1 -0
- package/dist/nitro/routes/graphql-yoga-ws.d.mts +1 -1
- package/dist/nitro/routes/graphql-yoga-ws.mjs +6 -44
- package/dist/nitro/routes/graphql-yoga.mjs +7 -5
- package/dist/nitro/routes/health.mjs +22 -24
- package/dist/nitro/setup/extend-loader.d.mts +6 -5
- package/dist/nitro/setup/extend-loader.mjs +30 -58
- package/dist/nitro/setup/file-watcher.mjs +6 -4
- package/dist/nitro/setup/logging.d.mts +1 -8
- package/dist/nitro/setup/logging.mjs +7 -22
- package/dist/nitro/setup/rollup-integration.mjs +32 -1
- package/dist/nitro/setup/scanner.d.mts +8 -43
- package/dist/nitro/setup/scanner.mjs +56 -58
- package/dist/nitro/setup/security.d.mts +10 -0
- package/dist/nitro/setup/security.mjs +17 -0
- 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 +87 -74
- 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 +0 -5
- 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/native/index.js +52 -52
- package/package.json +15 -15
- package/dist/cli/commands/index.d.mts +0 -5
- package/dist/cli/commands/index.mjs +0 -5
- package/dist/core/codegen/plugin.d.mts +0 -19
- package/dist/core/codegen/plugin.mjs +0 -29
- package/dist/core/config.d.mts +0 -45
- package/dist/core/config.mjs +0 -76
- package/dist/nitro/codegen.d.mts +0 -18
- package/dist/nitro/codegen.mjs +0 -171
- package/dist/nitro/config.d.mts +0 -50
- package/dist/nitro/config.mjs +0 -55
- package/dist/nitro/types.d.mts +0 -549
- package/dist/nitro/virtual/generators.d.mts +0 -38
- package/dist/nitro/virtual/generators.mjs +0 -190
- /package/dist/{nitro/types.mjs → core/types/standard-schema.mjs} +0 -0
package/dist/nitro/types.d.mts
DELETED
|
@@ -1,549 +0,0 @@
|
|
|
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 { YogaServerOptions } from "graphql-yoga";
|
|
8
|
-
import { ESMCodeGenOptions } from "knitwork";
|
|
9
|
-
import { ApolloServerOptions } from "@apollo/server";
|
|
10
|
-
import { H3Event } from "nitro/h3";
|
|
11
|
-
import { NPMConfig } from "#graphql/server";
|
|
12
|
-
|
|
13
|
-
//#region src/nitro/types.d.ts
|
|
14
|
-
/** The Standard Schema interface. */
|
|
15
|
-
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
16
|
-
/** The Standard Schema properties. */
|
|
17
|
-
readonly '~standard': StandardSchemaV1.Props<Input, Output>;
|
|
18
|
-
}
|
|
19
|
-
declare namespace StandardSchemaV1 {
|
|
20
|
-
/** The Standard Schema properties interface. */
|
|
21
|
-
export interface Props<Input = unknown, Output = Input> {
|
|
22
|
-
/** The version number of the standard. */
|
|
23
|
-
readonly version: 1;
|
|
24
|
-
/** The vendor name of the schema library. */
|
|
25
|
-
readonly vendor: string;
|
|
26
|
-
/** Validates unknown input values. */
|
|
27
|
-
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
28
|
-
/** Inferred types associated with the schema. */
|
|
29
|
-
readonly types?: Types<Input, Output> | undefined;
|
|
30
|
-
}
|
|
31
|
-
/** The result interface of the validate function. */
|
|
32
|
-
export type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
33
|
-
/** The result interface if validation succeeds. */
|
|
34
|
-
export interface SuccessResult<Output> {
|
|
35
|
-
/** The typed output value. */
|
|
36
|
-
readonly value: Output;
|
|
37
|
-
/** The non-existent issues. */
|
|
38
|
-
readonly issues?: undefined;
|
|
39
|
-
}
|
|
40
|
-
/** The result interface if validation fails. */
|
|
41
|
-
export interface FailureResult {
|
|
42
|
-
/** The issues of failed validation. */
|
|
43
|
-
readonly issues: ReadonlyArray<Issue>;
|
|
44
|
-
}
|
|
45
|
-
/** The issue interface of the failure output. */
|
|
46
|
-
export interface Issue {
|
|
47
|
-
/** The error message of the issue. */
|
|
48
|
-
readonly message: string;
|
|
49
|
-
/** The path of the issue, if any. */
|
|
50
|
-
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
51
|
-
}
|
|
52
|
-
/** The path segment interface of the issue. */
|
|
53
|
-
export interface PathSegment {
|
|
54
|
-
/** The key representing a path segment. */
|
|
55
|
-
readonly key: PropertyKey;
|
|
56
|
-
}
|
|
57
|
-
/** The Standard Schema types interface. */
|
|
58
|
-
export interface Types<Input = unknown, Output = Input> {
|
|
59
|
-
/** The input type of the schema. */
|
|
60
|
-
readonly input: Input;
|
|
61
|
-
/** The output type of the schema. */
|
|
62
|
-
readonly output: Output;
|
|
63
|
-
}
|
|
64
|
-
/** Infers the input type of a Standard Schema. */
|
|
65
|
-
export type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];
|
|
66
|
-
/** Infers the output type of a Standard Schema. */
|
|
67
|
-
export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
|
|
68
|
-
export {};
|
|
69
|
-
}
|
|
70
|
-
type Flatten<T> = T extends infer U ? { [K in keyof U]: U[K] } : never;
|
|
71
|
-
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>>;
|
|
72
|
-
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';
|
|
73
|
-
type GraphQLScalarType = 'String' | 'Int' | 'Float' | 'Boolean' | 'ID' | 'JSON' | 'DateTime';
|
|
74
|
-
type GraphQLBaseType = GraphQLScalarType | (string & {});
|
|
75
|
-
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 & {});
|
|
76
|
-
interface DirectiveArgument<T extends GraphQLArgumentType = GraphQLArgumentType> {
|
|
77
|
-
/**
|
|
78
|
-
* GraphQL type for the argument
|
|
79
|
-
* @example 'String', 'Int!', '[String!]!', 'DateTime', 'JSON'
|
|
80
|
-
*/
|
|
81
|
-
type: T;
|
|
82
|
-
defaultValue?: any;
|
|
83
|
-
description?: string;
|
|
84
|
-
}
|
|
85
|
-
interface DirectiveArg {
|
|
86
|
-
type: GraphQLArgumentType;
|
|
87
|
-
defaultValue?: any;
|
|
88
|
-
description?: string;
|
|
89
|
-
}
|
|
90
|
-
interface DirectiveDefinition {
|
|
91
|
-
name: string;
|
|
92
|
-
locations: DirectiveLocationName[];
|
|
93
|
-
args?: Record<string, DirectiveArg>;
|
|
94
|
-
description?: string;
|
|
95
|
-
isRepeatable?: boolean;
|
|
96
|
-
transformer?: (schema: GraphQLSchema) => GraphQLSchema;
|
|
97
|
-
}
|
|
98
|
-
interface DefineDirectiveConfig {
|
|
99
|
-
name: string;
|
|
100
|
-
locations: ReadonlyArray<DirectiveLocationName>;
|
|
101
|
-
args?: Record<string, {
|
|
102
|
-
type: GraphQLArgumentType;
|
|
103
|
-
defaultValue?: any;
|
|
104
|
-
description?: string;
|
|
105
|
-
}>;
|
|
106
|
-
description?: string;
|
|
107
|
-
isRepeatable?: boolean;
|
|
108
|
-
transformer?: (schema: GraphQLSchema) => GraphQLSchema;
|
|
109
|
-
}
|
|
110
|
-
type CodegenServerConfig = TypeScriptPluginConfig & TypeScriptResolversPluginConfig;
|
|
111
|
-
type DocumentModeConfig = Pick<Parameters<typeof plugin$1>[2], 'documentMode'>;
|
|
112
|
-
type DocumentModeEnum = NonNullable<DocumentModeConfig['documentMode']>;
|
|
113
|
-
type DocumentModeType = `${DocumentModeEnum}`;
|
|
114
|
-
type GenericSdkConfig = Omit<Parameters<typeof plugin$1>[2], 'documentMode'> & {
|
|
115
|
-
documentMode?: DocumentModeType;
|
|
116
|
-
};
|
|
117
|
-
type CodegenClientConfig = TypeScriptPluginConfig & TypeScriptDocumentsPluginConfig & {
|
|
118
|
-
endpoint?: string;
|
|
119
|
-
/**
|
|
120
|
-
* Generate TypedDocumentNode exports for urql/Apollo Client compatibility.
|
|
121
|
-
* When enabled, generates typed document constants that can be used with
|
|
122
|
-
* any GraphQL client that supports TypedDocumentNode.
|
|
123
|
-
* @default false
|
|
124
|
-
*/
|
|
125
|
-
typedDocumentNode?: boolean;
|
|
126
|
-
};
|
|
127
|
-
interface IESMImport {
|
|
128
|
-
name: string;
|
|
129
|
-
as?: string;
|
|
130
|
-
type: 'resolver' | 'query' | 'mutation' | 'type' | 'subscription' | 'directive';
|
|
131
|
-
}
|
|
132
|
-
interface GenImport {
|
|
133
|
-
specifier: string;
|
|
134
|
-
imports: IESMImport[];
|
|
135
|
-
options?: ESMCodeGenOptions;
|
|
136
|
-
}
|
|
137
|
-
declare module 'nitro/types' {
|
|
138
|
-
interface Nitro {
|
|
139
|
-
scanSchemas: string[];
|
|
140
|
-
scanDocuments: string[];
|
|
141
|
-
scanResolvers: GenImport[];
|
|
142
|
-
scanDirectives: GenImport[];
|
|
143
|
-
graphql: {
|
|
144
|
-
buildDir: string;
|
|
145
|
-
watchDirs: string[];
|
|
146
|
-
clientDir: string;
|
|
147
|
-
serverDir: string;
|
|
148
|
-
dir: {
|
|
149
|
-
build: string;
|
|
150
|
-
client: string;
|
|
151
|
-
server: string;
|
|
152
|
-
}; /** Inline directive schemas generated from .directive.ts files */
|
|
153
|
-
directiveSchemas: string | null; /** Resolved extend paths from manifests (populated during setup) */
|
|
154
|
-
resolvedExtend?: {
|
|
155
|
-
schemas: string[];
|
|
156
|
-
resolvers: string[];
|
|
157
|
-
directives: string[];
|
|
158
|
-
}; /** Config paths from extend packages (for merging) */
|
|
159
|
-
extendConfigs: string[]; /** Schema.ts paths from extend packages (for merging) */
|
|
160
|
-
extendSchemas: string[];
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
declare module 'nitro/types' {
|
|
165
|
-
interface NitroOptions {
|
|
166
|
-
graphql?: NitroGraphQLOptions;
|
|
167
|
-
}
|
|
168
|
-
interface NitroRuntimeConfig {
|
|
169
|
-
graphql?: NitroGraphQLOptions;
|
|
170
|
-
}
|
|
171
|
-
interface NitroConfig {
|
|
172
|
-
graphql?: NitroGraphQLOptions;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Service-specific path overrides for external GraphQL services
|
|
177
|
-
* These paths override global config for this specific service
|
|
178
|
-
*/
|
|
179
|
-
interface ExternalServicePaths {
|
|
180
|
-
/** SDK file path (overrides global sdk.external config) */
|
|
181
|
-
sdk?: FileGenerationConfig;
|
|
182
|
-
/** Type definitions file path (overrides global types.external config) */
|
|
183
|
-
types?: FileGenerationConfig;
|
|
184
|
-
}
|
|
185
|
-
interface ExternalGraphQLService {
|
|
186
|
-
/** Unique name for this service (used for file naming and type generation) */
|
|
187
|
-
name: string;
|
|
188
|
-
/** GraphQL endpoint for this service (also used as schema source if `schema` is not specified) */
|
|
189
|
-
endpoint: string;
|
|
190
|
-
/**
|
|
191
|
-
* Schema source - can be URL(s) for remote schemas or file path(s) for local schemas
|
|
192
|
-
* @default Uses `endpoint` for introspection if not specified
|
|
193
|
-
*/
|
|
194
|
-
schema?: string | string[];
|
|
195
|
-
/** Optional headers for schema introspection and client requests */
|
|
196
|
-
headers?: Record<string, string> | (() => Record<string, string>);
|
|
197
|
-
/** Optional: specific document patterns for this service */
|
|
198
|
-
documents?: string[];
|
|
199
|
-
/**
|
|
200
|
-
* Optional: Download and cache schema locally for offline usage
|
|
201
|
-
* - true or 'once': Download if file doesn't exist, then use cached version (offline-friendly)
|
|
202
|
-
* - 'always': Check for updates on every build (current behavior)
|
|
203
|
-
* - 'manual': Never download automatically, user manages schema files manually
|
|
204
|
-
* - false: Disable schema downloading
|
|
205
|
-
*/
|
|
206
|
-
downloadSchema?: boolean | 'once' | 'always' | 'manual';
|
|
207
|
-
/** Optional: Custom path to save downloaded schema (default: .nitro/graphql/schemas/[serviceName].graphql) */
|
|
208
|
-
downloadPath?: string;
|
|
209
|
-
/** Optional: service-specific codegen configuration */
|
|
210
|
-
codegen?: {
|
|
211
|
-
client?: CodegenClientConfig;
|
|
212
|
-
clientSDK?: GenericSdkConfig;
|
|
213
|
-
};
|
|
214
|
-
/**
|
|
215
|
-
* Optional: Service-specific path overrides
|
|
216
|
-
* These paths take precedence over global config (sdk, types, clientUtils)
|
|
217
|
-
* Supports placeholders: {serviceName}, {buildDir}, {rootDir}, {framework}, {typesDir}, {clientDir}
|
|
218
|
-
*/
|
|
219
|
-
paths?: ExternalServicePaths;
|
|
220
|
-
}
|
|
221
|
-
interface FederationConfig {
|
|
222
|
-
/** Enable Apollo Federation subgraph support */
|
|
223
|
-
enabled: boolean;
|
|
224
|
-
/** Service name for federation (used in subgraph config) */
|
|
225
|
-
serviceName?: string;
|
|
226
|
-
/** Service version for federation */
|
|
227
|
-
serviceVersion?: string;
|
|
228
|
-
/** Service URL for federation gateway */
|
|
229
|
-
serviceUrl?: string;
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* File generation control:
|
|
233
|
-
* - false: Do not generate this file
|
|
234
|
-
* - true: Generate at default location
|
|
235
|
-
* - string: Generate at custom path (supports placeholders: {serviceName}, {buildDir}, {rootDir}, {framework})
|
|
236
|
-
*/
|
|
237
|
-
type FileGenerationConfig = boolean | string;
|
|
238
|
-
/**
|
|
239
|
-
* SDK files configuration
|
|
240
|
-
* Control auto-generation of GraphQL SDK files
|
|
241
|
-
*/
|
|
242
|
-
interface SdkConfig {
|
|
243
|
-
/** Enable/disable all SDK files */
|
|
244
|
-
enabled?: boolean;
|
|
245
|
-
/** app/graphql/default/sdk.ts - Main service SDK */
|
|
246
|
-
main?: FileGenerationConfig;
|
|
247
|
-
/** app/graphql/{serviceName}/sdk.ts - External service SDKs */
|
|
248
|
-
external?: FileGenerationConfig;
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Type files configuration
|
|
252
|
-
* Control auto-generation of TypeScript type definition files
|
|
253
|
-
*/
|
|
254
|
-
interface TypesConfig {
|
|
255
|
-
/** Enable/disable all type files */
|
|
256
|
-
enabled?: boolean;
|
|
257
|
-
/** .nitro/types/nitro-graphql-server.d.ts - Server-side types */
|
|
258
|
-
server?: FileGenerationConfig;
|
|
259
|
-
/** .nitro/types/nitro-graphql-client.d.ts - Client-side types */
|
|
260
|
-
client?: FileGenerationConfig;
|
|
261
|
-
/** .nitro/types/nitro-graphql-client-{serviceName}.d.ts - External service types */
|
|
262
|
-
external?: FileGenerationConfig;
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* Security configuration for production environments
|
|
266
|
-
* All options auto-detect based on NODE_ENV when not explicitly set
|
|
267
|
-
*/
|
|
268
|
-
interface SecurityConfig {
|
|
269
|
-
/**
|
|
270
|
-
* Enable GraphQL introspection queries
|
|
271
|
-
* @default true in development, false in production
|
|
272
|
-
*/
|
|
273
|
-
introspection?: boolean;
|
|
274
|
-
/**
|
|
275
|
-
* Enable GraphQL playground/sandbox UI
|
|
276
|
-
* @default true in development, false in production
|
|
277
|
-
*/
|
|
278
|
-
playground?: boolean;
|
|
279
|
-
/**
|
|
280
|
-
* Mask internal error details in responses
|
|
281
|
-
* When enabled, internal errors show "Internal server error" instead of actual message
|
|
282
|
-
* @default false in development, true in production
|
|
283
|
-
*/
|
|
284
|
-
maskErrors?: boolean;
|
|
285
|
-
/**
|
|
286
|
-
* Disable "Did you mean X?" field suggestions in error messages
|
|
287
|
-
* Prevents attackers from discovering field names via brute force
|
|
288
|
-
* @default false in development, true in production
|
|
289
|
-
*/
|
|
290
|
-
disableSuggestions?: boolean;
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* WebSocket transport configuration for subscriptions
|
|
294
|
-
*/
|
|
295
|
-
interface WebSocketTransportConfig {
|
|
296
|
-
/**
|
|
297
|
-
* Enable WebSocket transport
|
|
298
|
-
* @default true when subscriptions.enabled is true
|
|
299
|
-
*/
|
|
300
|
-
enabled?: boolean;
|
|
301
|
-
/**
|
|
302
|
-
* WebSocket endpoint path
|
|
303
|
-
* @default Same as GraphQL HTTP endpoint
|
|
304
|
-
*/
|
|
305
|
-
path?: string;
|
|
306
|
-
/**
|
|
307
|
-
* Connection initialization timeout in milliseconds
|
|
308
|
-
* @default 10000
|
|
309
|
-
*/
|
|
310
|
-
connectionTimeout?: number;
|
|
311
|
-
/**
|
|
312
|
-
* Keep-alive ping interval in milliseconds
|
|
313
|
-
* @default 30000
|
|
314
|
-
*/
|
|
315
|
-
pingInterval?: number;
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* SSE (Server-Sent Events) transport configuration for subscriptions
|
|
319
|
-
* Only available with GraphQL Yoga framework
|
|
320
|
-
*/
|
|
321
|
-
interface SSETransportConfig {
|
|
322
|
-
/**
|
|
323
|
-
* Enable SSE transport
|
|
324
|
-
* @default true for GraphQL Yoga
|
|
325
|
-
*/
|
|
326
|
-
enabled?: boolean;
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* PubSub configuration for subscription event distribution
|
|
330
|
-
*/
|
|
331
|
-
interface PubSubConfig {
|
|
332
|
-
/**
|
|
333
|
-
* Use built-in in-memory PubSub
|
|
334
|
-
* Suitable for single-instance deployments
|
|
335
|
-
* @default true
|
|
336
|
-
*/
|
|
337
|
-
useBuiltin?: boolean;
|
|
338
|
-
/**
|
|
339
|
-
* Path to custom PubSub module
|
|
340
|
-
* The module should export a PubSub-compatible instance
|
|
341
|
-
* When provided, built-in PubSub is disabled
|
|
342
|
-
*/
|
|
343
|
-
customPath?: string;
|
|
344
|
-
}
|
|
345
|
-
/**
|
|
346
|
-
* GraphQL Subscriptions configuration
|
|
347
|
-
*/
|
|
348
|
-
interface SubscriptionsConfig {
|
|
349
|
-
/**
|
|
350
|
-
* Enable subscriptions support
|
|
351
|
-
* @default false
|
|
352
|
-
*/
|
|
353
|
-
enabled?: boolean;
|
|
354
|
-
/**
|
|
355
|
-
* WebSocket transport configuration
|
|
356
|
-
*/
|
|
357
|
-
websocket?: WebSocketTransportConfig;
|
|
358
|
-
/**
|
|
359
|
-
* SSE transport configuration (GraphQL Yoga only)
|
|
360
|
-
*/
|
|
361
|
-
sse?: SSETransportConfig;
|
|
362
|
-
/**
|
|
363
|
-
* PubSub configuration for event distribution
|
|
364
|
-
*/
|
|
365
|
-
pubsub?: PubSubConfig;
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* Client utilities configuration
|
|
369
|
-
* Controls auto-generation of client utility files
|
|
370
|
-
*/
|
|
371
|
-
interface ClientUtilsConfig {
|
|
372
|
-
/** Master switch for client utilities */
|
|
373
|
-
enabled?: boolean;
|
|
374
|
-
/** Index file output path */
|
|
375
|
-
index?: FileGenerationConfig;
|
|
376
|
-
/** Ofetch client output path */
|
|
377
|
-
ofetch?: FileGenerationConfig;
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* Path configuration with placeholders
|
|
381
|
-
* Supports: {buildDir}, {rootDir}, {typesDir}, {serverDir}, {clientDir}, {serviceName}
|
|
382
|
-
*/
|
|
383
|
-
interface PathsConfig {
|
|
384
|
-
/** Server GraphQL directory (default: 'server/graphql') */
|
|
385
|
-
serverDir?: string;
|
|
386
|
-
/** Client GraphQL directory (default: 'app/graphql' or 'graphql') */
|
|
387
|
-
clientDir?: string;
|
|
388
|
-
/** Types output directory (default: '{buildDir}/types') */
|
|
389
|
-
typesDir?: string;
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* Watch mode configuration
|
|
393
|
-
*/
|
|
394
|
-
interface WatchConfig {
|
|
395
|
-
/** Enable watch mode */
|
|
396
|
-
enabled?: boolean;
|
|
397
|
-
/** Debounce time in ms */
|
|
398
|
-
debounce?: number;
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Runtime file generation configuration
|
|
402
|
-
* Generates resolvers.ts, schema.ts for standalone server usage
|
|
403
|
-
*/
|
|
404
|
-
interface RuntimeConfig {
|
|
405
|
-
/** Output directory for runtime files (defaults to '{buildDir}/runtime') */
|
|
406
|
-
outDir?: string;
|
|
407
|
-
/** What to include in generation */
|
|
408
|
-
include?: {
|
|
409
|
-
resolvers?: boolean;
|
|
410
|
-
schema?: boolean;
|
|
411
|
-
index?: boolean;
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
interface NitroGraphQLOptions {
|
|
415
|
-
framework?: 'graphql-yoga' | 'apollo-server';
|
|
416
|
-
/**
|
|
417
|
-
* Enable/disable GraphQL server functionality
|
|
418
|
-
* When set to false, only external services client types will be generated
|
|
419
|
-
* Server routes, resolvers, schemas, and directives will not be processed
|
|
420
|
-
* @default true
|
|
421
|
-
*/
|
|
422
|
-
server?: boolean;
|
|
423
|
-
endpoint?: {
|
|
424
|
-
graphql?: string;
|
|
425
|
-
healthCheck?: string;
|
|
426
|
-
};
|
|
427
|
-
playground?: boolean;
|
|
428
|
-
typedefs?: string[];
|
|
429
|
-
resolvers?: Array<IResolvers<any, any>>;
|
|
430
|
-
loader?: {
|
|
431
|
-
include?: RegExp;
|
|
432
|
-
exclude?: RegExp;
|
|
433
|
-
validate?: boolean;
|
|
434
|
-
};
|
|
435
|
-
codegen?: {
|
|
436
|
-
server?: CodegenServerConfig;
|
|
437
|
-
client?: CodegenClientConfig;
|
|
438
|
-
clientSDK?: GenericSdkConfig;
|
|
439
|
-
};
|
|
440
|
-
/** External GraphQL services to generate types and SDKs for */
|
|
441
|
-
externalServices?: ExternalGraphQLService[];
|
|
442
|
-
/** Apollo Federation configuration */
|
|
443
|
-
federation?: FederationConfig;
|
|
444
|
-
/** Server GraphQL directory path (default: 'server/graphql') */
|
|
445
|
-
serverDir?: string;
|
|
446
|
-
/** Client GraphQL directory path (default: 'app/graphql' for Nuxt, 'graphql' for Nitro) */
|
|
447
|
-
clientDir?: string;
|
|
448
|
-
/** Types directory path (default: '{buildDir}/types') */
|
|
449
|
-
typesDir?: string;
|
|
450
|
-
/**
|
|
451
|
-
* SDK files configuration
|
|
452
|
-
* Set to false to disable all SDK generation
|
|
453
|
-
*/
|
|
454
|
-
sdk?: false | SdkConfig;
|
|
455
|
-
/**
|
|
456
|
-
* Type files configuration
|
|
457
|
-
* Set to false to disable all type generation
|
|
458
|
-
*/
|
|
459
|
-
types?: false | TypesConfig;
|
|
460
|
-
/**
|
|
461
|
-
* Security configuration for production environments
|
|
462
|
-
* Auto-detects NODE_ENV and applies secure defaults in production
|
|
463
|
-
*/
|
|
464
|
-
security?: SecurityConfig;
|
|
465
|
-
/**
|
|
466
|
-
* Extend GraphQL server with external packages
|
|
467
|
-
* Auto-appends /resolvers and /schema to each package path
|
|
468
|
-
* @example extend: ['@myorg/graphql', './generated']
|
|
469
|
-
*/
|
|
470
|
-
extend?: ExtendSource[];
|
|
471
|
-
/**
|
|
472
|
-
* Skip local file scanning, use only extend sources
|
|
473
|
-
* When true, only files from `extend` are used (local server/graphql ignored)
|
|
474
|
-
* @default false
|
|
475
|
-
*/
|
|
476
|
-
skipLocalScan?: boolean;
|
|
477
|
-
/**
|
|
478
|
-
* GraphQL Subscriptions configuration
|
|
479
|
-
* Enables real-time subscriptions via WebSocket and/or SSE transports
|
|
480
|
-
*/
|
|
481
|
-
subscriptions?: SubscriptionsConfig;
|
|
482
|
-
/**
|
|
483
|
-
* Root directory of the project
|
|
484
|
-
* Used by CLI for path resolution. In Nitro module context, this is implicit.
|
|
485
|
-
*/
|
|
486
|
-
rootDir?: string;
|
|
487
|
-
/**
|
|
488
|
-
* Build output directory
|
|
489
|
-
* Used by CLI for generated files. In Nitro module context, this is implicit.
|
|
490
|
-
*/
|
|
491
|
-
buildDir?: string;
|
|
492
|
-
/**
|
|
493
|
-
* Client utilities configuration
|
|
494
|
-
* Controls auto-generation of client utility files (index.ts, ofetch.ts)
|
|
495
|
-
* Set to false to disable all client utilities generation
|
|
496
|
-
*/
|
|
497
|
-
clientUtils?: false | ClientUtilsConfig;
|
|
498
|
-
/**
|
|
499
|
-
* Path configuration with placeholders
|
|
500
|
-
* Allows overriding default paths for generated files
|
|
501
|
-
*/
|
|
502
|
-
paths?: PathsConfig;
|
|
503
|
-
/**
|
|
504
|
-
* Patterns to ignore during file scanning
|
|
505
|
-
* Defaults to node_modules and dist directories
|
|
506
|
-
*/
|
|
507
|
-
ignore?: string[];
|
|
508
|
-
/**
|
|
509
|
-
* Watch mode configuration
|
|
510
|
-
* Enables automatic type regeneration on file changes
|
|
511
|
-
*/
|
|
512
|
-
watch?: WatchConfig;
|
|
513
|
-
/**
|
|
514
|
-
* Runtime file generation configuration
|
|
515
|
-
* Generates resolvers.ts, schema.ts for standalone server usage
|
|
516
|
-
* Set to true for default behavior or provide config object
|
|
517
|
-
*/
|
|
518
|
-
runtime?: boolean | RuntimeConfig;
|
|
519
|
-
}
|
|
520
|
-
/**
|
|
521
|
-
* Explicit paths extend source (legacy)
|
|
522
|
-
*/
|
|
523
|
-
interface ExplicitPathsExtendSource {
|
|
524
|
-
/** Explicit manifest path */
|
|
525
|
-
manifest?: string;
|
|
526
|
-
/** Explicit resolver paths (legacy, prefer manifest) */
|
|
527
|
-
resolvers?: string | string[];
|
|
528
|
-
/** Explicit schema paths (legacy, prefer manifest) */
|
|
529
|
-
schemas?: string | string[];
|
|
530
|
-
}
|
|
531
|
-
/**
|
|
532
|
-
* Local directory extend source
|
|
533
|
-
* For extending from local directories (e.g., Nuxt layers, monorepo packages)
|
|
534
|
-
*/
|
|
535
|
-
interface LocalDirExtendSource {
|
|
536
|
-
/** Server GraphQL directory path (for schemas, resolvers, directives) */
|
|
537
|
-
serverDir?: string;
|
|
538
|
-
/** Client GraphQL directory path (for documents) */
|
|
539
|
-
clientDir?: string;
|
|
540
|
-
}
|
|
541
|
-
/**
|
|
542
|
-
* Extend source - package path or detailed config
|
|
543
|
-
* - string: package name or local path, requires nitro-graphql.config.ts in package root
|
|
544
|
-
* - LocalDirExtendSource: local directories with serverDir/clientDir
|
|
545
|
-
* - ExplicitPathsExtendSource: explicit paths (legacy)
|
|
546
|
-
*/
|
|
547
|
-
type ExtendSource = string | LocalDirExtendSource | ExplicitPathsExtendSource;
|
|
548
|
-
//#endregion
|
|
549
|
-
export { ClientUtilsConfig, CodegenClientConfig, CodegenServerConfig, DefineDirectiveConfig, DefineServerConfig, DirectiveArgument, DirectiveDefinition, ExplicitPathsExtendSource, ExtendSource, ExternalGraphQLService, ExternalServicePaths, FederationConfig, FileGenerationConfig, Flatten, GenImport, GenericSdkConfig, GraphQLArgumentType, GraphQLBaseType, GraphQLScalarType, LocalDirExtendSource, NitroGraphQLOptions, PathsConfig, PubSubConfig, RuntimeConfig, SSETransportConfig, SdkConfig, SecurityConfig, StandardSchemaV1, SubscriptionsConfig, TypesConfig, WatchConfig, WebSocketTransportConfig };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Nitro } from "nitro/types";
|
|
2
|
-
|
|
3
|
-
//#region src/nitro/virtual/generators.d.ts
|
|
4
|
-
declare const serverSchemas: {
|
|
5
|
-
id: string;
|
|
6
|
-
getCode: (nitro: Nitro) => string;
|
|
7
|
-
};
|
|
8
|
-
declare const serverResolvers: {
|
|
9
|
-
id: string;
|
|
10
|
-
getCode: (nitro: Nitro) => string;
|
|
11
|
-
};
|
|
12
|
-
declare const serverDirectives: {
|
|
13
|
-
id: string;
|
|
14
|
-
getCode: (nitro: Nitro) => string;
|
|
15
|
-
};
|
|
16
|
-
declare const graphqlConfig: {
|
|
17
|
-
id: string;
|
|
18
|
-
getCode: (nitro: Nitro) => string;
|
|
19
|
-
};
|
|
20
|
-
declare const moduleConfig: {
|
|
21
|
-
id: string;
|
|
22
|
-
getCode: (nitro: Nitro) => string;
|
|
23
|
-
};
|
|
24
|
-
declare const validationSchemas: {
|
|
25
|
-
id: string;
|
|
26
|
-
getCode: (nitro: Nitro) => string;
|
|
27
|
-
};
|
|
28
|
-
declare const pubsub: {
|
|
29
|
-
id: string;
|
|
30
|
-
getCode: (nitro: Nitro) => string;
|
|
31
|
-
};
|
|
32
|
-
declare const debugInfo: {
|
|
33
|
-
id: string;
|
|
34
|
-
getCode: (nitro: Nitro) => string;
|
|
35
|
-
};
|
|
36
|
-
declare function registerAllVirtualModules(nitro: Nitro): void;
|
|
37
|
-
//#endregion
|
|
38
|
-
export { debugInfo, graphqlConfig, moduleConfig, pubsub, registerAllVirtualModules, serverDirectives, serverResolvers, serverSchemas, validationSchemas };
|