nitro-graphql 1.7.0-beta.0 → 1.7.0-beta.1

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.
@@ -1,6 +1,6 @@
1
- import * as h30 from "h3";
1
+ import * as h33 from "h3";
2
2
 
3
3
  //#region src/routes/apollo-server-ws.d.ts
4
- declare const _default: h30.EventHandler<h30.EventHandlerRequest, never>;
4
+ declare const _default: h33.EventHandler<h33.EventHandlerRequest, never>;
5
5
  //#endregion
6
6
  export { _default as default };
@@ -1,6 +1,6 @@
1
- import * as h31 from "h3";
1
+ import * as h39 from "h3";
2
2
 
3
3
  //#region src/routes/apollo-server.d.ts
4
- declare const _default: h31.EventHandler<h31.EventHandlerRequest, Promise<any>>;
4
+ declare const _default: h39.EventHandler<h39.EventHandlerRequest, Promise<any>>;
5
5
  //#endregion
6
6
  export { _default as default };
@@ -1,4 +1,4 @@
1
- import * as h33 from "h3";
1
+ import * as h35 from "h3";
2
2
 
3
3
  //#region src/routes/debug.d.ts
4
4
 
@@ -10,7 +10,7 @@ import * as h33 from "h3";
10
10
  * - /_nitro/graphql/debug - HTML dashboard
11
11
  * - /_nitro/graphql/debug?format=json - JSON API
12
12
  */
13
- declare const _default: h33.EventHandler<h33.EventHandlerRequest, Promise<string | {
13
+ declare const _default: h35.EventHandler<h35.EventHandlerRequest, Promise<string | {
14
14
  timestamp: string;
15
15
  environment: {
16
16
  dev: any;
@@ -1,6 +1,6 @@
1
- import * as h37 from "h3";
1
+ import * as h30 from "h3";
2
2
 
3
3
  //#region src/routes/graphql-yoga-ws.d.ts
4
- declare const _default: h37.EventHandler<h37.EventHandlerRequest, never>;
4
+ declare const _default: h30.EventHandler<h30.EventHandlerRequest, never>;
5
5
  //#endregion
6
6
  export { _default as default };
@@ -1,6 +1,6 @@
1
- import * as h39 from "h3";
1
+ import * as h37 from "h3";
2
2
 
3
3
  //#region src/routes/graphql-yoga.d.ts
4
- declare const _default: h39.EventHandler<h39.EventHandlerRequest, Promise<Response>>;
4
+ declare const _default: h37.EventHandler<h37.EventHandlerRequest, Promise<Response>>;
5
5
  //#endregion
6
6
  export { _default as default };
@@ -1,7 +1,7 @@
1
- import * as h35 from "h3";
1
+ import * as h31 from "h3";
2
2
 
3
3
  //#region src/routes/health.d.ts
4
- declare const _default: h35.EventHandler<h35.EventHandlerRequest, Promise<{
4
+ declare const _default: h31.EventHandler<h31.EventHandlerRequest, Promise<{
5
5
  status: string;
6
6
  message: string;
7
7
  timestamp: string;
@@ -23,7 +23,7 @@ declare function loadExternalSchema(service: ExternalGraphQLService, buildDir?:
23
23
  */
24
24
  declare function downloadAndSaveSchema(service: ExternalGraphQLService, buildDir: string): Promise<string | undefined>;
25
25
  declare function loadGraphQLDocuments(patterns: string | string[]): Promise<Source[]>;
26
- declare function generateClientTypes(schema: GraphQLSchema, docs: Source[], config?: CodegenClientConfig, sdkConfig?: GenericSdkConfig, outputPath?: string, serviceName?: string, virtualTypesPath?: string): Promise<false | {
26
+ declare function generateClientTypes(schema: GraphQLSchema, docs: Source[], config?: CodegenClientConfig, sdkConfig?: GenericSdkConfig, outputPath?: string, serviceName?: string, virtualTypesPath?: string, subscriptionsEnabled?: boolean): Promise<false | {
27
27
  types: string;
28
28
  sdk: string;
29
29
  }>;
@@ -47,6 +47,6 @@ declare function extractSubscriptions(docs: Source[]): SubscriptionInfo[];
47
47
  /**
48
48
  * Generate subscription builder code (Drizzle-style API) + Vue Composables
49
49
  */
50
- declare function generateSubscriptionBuilder(docs: Source[]): string;
50
+ declare function generateSubscriptionBuilder(docs: Source[], subscriptionsEnabled: boolean): string;
51
51
  //#endregion
52
52
  export { GraphQLLoadSchemaOptions, GraphQLTypeDefPointer, SubscriptionInfo, downloadAndSaveSchema, extractSubscriptions, generateClientTypes, generateExternalClientTypes, generateSubscriptionBuilder, graphQLLoadSchemaSync, loadExternalSchema, loadGraphQLDocuments };
@@ -165,7 +165,7 @@ async function loadGraphQLDocuments(patterns) {
165
165
  else throw e;
166
166
  }
167
167
  }
168
- async function generateClientTypes(schema, docs, config = {}, sdkConfig = {}, outputPath, serviceName, virtualTypesPath) {
168
+ async function generateClientTypes(schema, docs, config = {}, sdkConfig = {}, outputPath, serviceName, virtualTypesPath, subscriptionsEnabled) {
169
169
  if (docs.length === 0 && !serviceName) {
170
170
  consola$1.info("No client GraphQL files found. Skipping client type generation.");
171
171
  return false;
@@ -271,7 +271,7 @@ export function getSdk(requester: Requester): Sdk {
271
271
  content: await codegen(config$1)
272
272
  };
273
273
  })))[0]?.content || "";
274
- const subscriptionBuilder = generateSubscriptionBuilder(docs);
274
+ const subscriptionBuilder = generateSubscriptionBuilder(docs, subscriptionsEnabled ?? false);
275
275
  return {
276
276
  types: output,
277
277
  sdk: subscriptionBuilder ? sdkContent + subscriptionBuilder : sdkContent
@@ -285,7 +285,7 @@ export function getSdk(requester: Requester): Sdk {
285
285
  * Generate client types for external GraphQL service
286
286
  */
287
287
  async function generateExternalClientTypes(service, schema, docs, virtualTypesPath) {
288
- return generateClientTypes(schema, docs, service.codegen?.client || {}, service.codegen?.clientSDK || {}, void 0, service.name, virtualTypesPath);
288
+ return generateClientTypes(schema, docs, service.codegen?.client || {}, service.codegen?.clientSDK || {}, void 0, service.name, virtualTypesPath, false);
289
289
  }
290
290
  /**
291
291
  * Convert PascalCase to camelCase
@@ -318,7 +318,8 @@ function extractSubscriptions(docs) {
318
318
  /**
319
319
  * Generate subscription builder code (Drizzle-style API) + Vue Composables
320
320
  */
321
- function generateSubscriptionBuilder(docs) {
321
+ function generateSubscriptionBuilder(docs, subscriptionsEnabled) {
322
+ if (!subscriptionsEnabled) return "";
322
323
  const subscriptions = extractSubscriptions(docs);
323
324
  if (subscriptions.length === 0) return "";
324
325
  let output = `
@@ -284,7 +284,7 @@ async function generateMainClientTypes(nitro) {
284
284
  return;
285
285
  }
286
286
  const graphqlString = readFileSync(schemaFilePath, "utf-8");
287
- const types = await generateClientTypes(nitro.options.graphql?.federation?.enabled === true ? buildSubgraphSchema([{ typeDefs: parse(graphqlString) }]) : buildSchema(graphqlString), loadDocs, nitro.options.graphql?.codegen?.client ?? {}, nitro.options.graphql?.codegen?.clientSDK ?? {});
287
+ const types = await generateClientTypes(nitro.options.graphql?.federation?.enabled === true ? buildSubgraphSchema([{ typeDefs: parse(graphqlString) }]) : buildSchema(graphqlString), loadDocs, nitro.options.graphql?.codegen?.client ?? {}, nitro.options.graphql?.codegen?.clientSDK ?? {}, void 0, void 0, void 0, nitro.options.graphql?.subscriptions?.enabled ?? false);
288
288
  if (types === false) return;
289
289
  const placeholders = getDefaultPaths(nitro);
290
290
  const typesConfig = getTypesConfig(nitro);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nitro-graphql",
3
3
  "type": "module",
4
- "version": "1.7.0-beta.0",
4
+ "version": "1.7.0-beta.1",
5
5
  "description": "GraphQL integration for Nitro",
6
6
  "license": "MIT",
7
7
  "repository": {