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

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 h39 from "h3";
1
+ import * as h35 from "h3";
2
2
 
3
3
  //#region src/routes/apollo-server.d.ts
4
- declare const _default: h39.EventHandler<h39.EventHandlerRequest, Promise<any>>;
4
+ declare const _default: h35.EventHandler<h35.EventHandlerRequest, Promise<any>>;
5
5
  //#endregion
6
6
  export { _default as default };
@@ -1,4 +1,4 @@
1
- import * as h35 from "h3";
1
+ import * as h39 from "h3";
2
2
 
3
3
  //#region src/routes/debug.d.ts
4
4
 
@@ -10,7 +10,7 @@ import * as h35 from "h3";
10
10
  * - /_nitro/graphql/debug - HTML dashboard
11
11
  * - /_nitro/graphql/debug?format=json - JSON API
12
12
  */
13
- declare const _default: h35.EventHandler<h35.EventHandlerRequest, Promise<string | {
13
+ declare const _default: h39.EventHandler<h39.EventHandlerRequest, Promise<string | {
14
14
  timestamp: string;
15
15
  environment: {
16
16
  dev: any;
@@ -1,6 +1,6 @@
1
- import * as h30 from "h3";
1
+ import * as h37 from "h3";
2
2
 
3
3
  //#region src/routes/graphql-yoga-ws.d.ts
4
- declare const _default: h30.EventHandler<h30.EventHandlerRequest, never>;
4
+ declare const _default: h37.EventHandler<h37.EventHandlerRequest, never>;
5
5
  //#endregion
6
6
  export { _default as default };
@@ -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.d.ts
4
- declare const _default: h37.EventHandler<h37.EventHandlerRequest, Promise<Response>>;
4
+ declare const _default: h30.EventHandler<h30.EventHandlerRequest, Promise<Response>>;
5
5
  //#endregion
6
6
  export { _default as default };
@@ -38,8 +38,10 @@ declare function generateExternalClientTypes(service: ExternalGraphQLService, sc
38
38
  * Extract subscription info from documents
39
39
  */
40
40
  interface SubscriptionInfo {
41
+ /** Original operation name from GraphQL document (used for method names) */
41
42
  name: string;
42
- methodName: string;
43
+ /** PascalCase version for type references (matches GraphQL codegen output) */
44
+ typeName: string;
43
45
  fieldName: string;
44
46
  hasVariables: boolean;
45
47
  }
@@ -288,10 +288,10 @@ async function generateExternalClientTypes(service, schema, docs, virtualTypesPa
288
288
  return generateClientTypes(schema, docs, service.codegen?.client || {}, service.codegen?.clientSDK || {}, void 0, service.name, virtualTypesPath, false);
289
289
  }
290
290
  /**
291
- * Convert PascalCase to camelCase
291
+ * Convert first character to uppercase (PascalCase)
292
292
  */
293
- function toCamelCase(str) {
294
- return str.charAt(0).toLowerCase() + str.slice(1);
293
+ function toPascalCase(str) {
294
+ return str.charAt(0).toUpperCase() + str.slice(1);
295
295
  }
296
296
  function extractSubscriptions(docs) {
297
297
  const subscriptions = [];
@@ -307,7 +307,7 @@ function extractSubscriptions(docs) {
307
307
  const hasVariables = (operationDef.variableDefinitions?.length || 0) > 0;
308
308
  subscriptions.push({
309
309
  name,
310
- methodName: toCamelCase(name),
310
+ typeName: toPascalCase(name),
311
311
  fieldName,
312
312
  hasVariables
313
313
  });
@@ -439,12 +439,12 @@ function createSubscriptionBuilder<TData>(query: string, variables: unknown): Su
439
439
 
440
440
  export const subscription = {
441
441
  `;
442
- for (const sub of subscriptions) if (sub.hasVariables) output += ` ${sub.methodName}(variables: Types.${sub.name}SubscriptionVariables): SubscriptionBuilder<Types.${sub.name}Subscription['${sub.fieldName}']> {
443
- return createSubscriptionBuilder<Types.${sub.name}Subscription['${sub.fieldName}']>(${sub.name}Document, variables)
442
+ for (const sub of subscriptions) if (sub.hasVariables) output += ` ${sub.name}(variables: Types.${sub.typeName}SubscriptionVariables): SubscriptionBuilder<Types.${sub.typeName}Subscription['${sub.fieldName}']> {
443
+ return createSubscriptionBuilder<Types.${sub.typeName}Subscription['${sub.fieldName}']>(${sub.typeName}Document, variables)
444
444
  },
445
445
  `;
446
- else output += ` ${sub.methodName}(): SubscriptionBuilder<Types.${sub.name}Subscription['${sub.fieldName}']> {
447
- return createSubscriptionBuilder<Types.${sub.name}Subscription['${sub.fieldName}']>(${sub.name}Document, undefined)
446
+ else output += ` ${sub.name}(): SubscriptionBuilder<Types.${sub.typeName}Subscription['${sub.fieldName}']> {
447
+ return createSubscriptionBuilder<Types.${sub.typeName}Subscription['${sub.fieldName}']>(${sub.typeName}Document, undefined)
448
448
  },
449
449
  `;
450
450
  output += `}
@@ -639,44 +639,44 @@ function createUseSubscription<TData, TVariables = undefined>(
639
639
  // === Subscription Return Types ===
640
640
  `;
641
641
  for (const sub of subscriptions) {
642
- const typeName = `Types.${sub.name}Subscription['${sub.fieldName}']`;
643
- output += `/** Return type for use${sub.name} composable */
644
- export type Use${sub.name}Return = UseSubscriptionReturn<${typeName}>
642
+ const typeName = `Types.${sub.typeName}Subscription['${sub.fieldName}']`;
643
+ output += `/** Return type for use${sub.typeName} composable */
644
+ export type Use${sub.typeName}Return = UseSubscriptionReturn<${typeName}>
645
645
  `;
646
646
  }
647
647
  output += `
648
648
  // === Vue Composables ===
649
649
  `;
650
650
  for (const sub of subscriptions) {
651
- const typeName = `Types.${sub.name}Subscription['${sub.fieldName}']`;
652
- const varsType = `Types.${sub.name}SubscriptionVariables`;
651
+ const typeName = `Types.${sub.typeName}Subscription['${sub.fieldName}']`;
652
+ const varsType = `Types.${sub.typeName}SubscriptionVariables`;
653
653
  if (sub.hasVariables) output += `/**
654
- * Vue composable for ${sub.name} subscription
654
+ * Vue composable for ${sub.typeName} subscription
655
655
  * @param variables - Subscription variables
656
656
  * @param options - Subscription options (immediate, onData, onError, session, etc.)
657
657
  * @returns Reactive subscription state: { data, error, isActive, state, start, stop, restart }
658
658
  */
659
- export function use${sub.name}(
659
+ export function use${sub.typeName}(
660
660
  variables: ${varsType},
661
661
  options?: UseSubscriptionOptions<${typeName}>,
662
- ): Use${sub.name}Return {
662
+ ): Use${sub.typeName}Return {
663
663
  return createUseSubscription<${typeName}, ${varsType}>(
664
- ${sub.name}Document,
664
+ ${sub.typeName}Document,
665
665
  () => variables,
666
666
  )(options)
667
667
  }
668
668
 
669
669
  `;
670
670
  else output += `/**
671
- * Vue composable for ${sub.name} subscription
671
+ * Vue composable for ${sub.typeName} subscription
672
672
  * @param options - Subscription options (immediate, onData, onError, session, etc.)
673
673
  * @returns Reactive subscription state: { data, error, isActive, state, start, stop, restart }
674
674
  */
675
- export function use${sub.name}(
675
+ export function use${sub.typeName}(
676
676
  options?: UseSubscriptionOptions<${typeName}>,
677
- ): Use${sub.name}Return {
677
+ ): Use${sub.typeName}Return {
678
678
  return createUseSubscription<${typeName}, undefined>(
679
- ${sub.name}Document,
679
+ ${sub.typeName}Document,
680
680
  () => undefined,
681
681
  )(options)
682
682
  }
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.1",
4
+ "version": "1.7.0-beta.3",
5
5
  "description": "GraphQL integration for Nitro",
6
6
  "license": "MIT",
7
7
  "repository": {