nuxt-graphql-middleware 5.0.0-alpha.2 → 5.0.0-alpha.5

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.
Files changed (44) hide show
  1. package/dist/client/200.html +2 -2
  2. package/dist/client/404.html +2 -2
  3. package/dist/client/_nuxt/builds/latest.json +1 -1
  4. package/dist/client/_nuxt/builds/meta/c22c2916-33e9-427d-b6fe-10f11766c207.json +1 -0
  5. package/dist/client/index.html +2 -2
  6. package/dist/module.d.mts +20 -4
  7. package/dist/module.d.ts +20 -4
  8. package/dist/module.json +2 -2
  9. package/dist/module.mjs +352 -219
  10. package/dist/runtime/components/CodeFrame.vue +61 -0
  11. package/dist/runtime/components/DevModeOverlay.vue +60 -0
  12. package/dist/runtime/components/ErrorExtensions.vue +23 -0
  13. package/dist/runtime/components/ErrorGroup.vue +89 -0
  14. package/dist/runtime/composables/nuxtApp.d.ts +2 -2
  15. package/dist/runtime/composables/nuxtApp.js +21 -1
  16. package/dist/runtime/composables/useAsyncGraphqlQuery.d.ts +7 -7
  17. package/dist/runtime/composables/useAsyncGraphqlQuery.js +1 -1
  18. package/dist/runtime/composables/useGraphqlMutation.d.ts +4 -4
  19. package/dist/runtime/composables/useGraphqlMutation.js +1 -1
  20. package/dist/runtime/composables/useGraphqlQuery.d.ts +4 -4
  21. package/dist/runtime/composables/useGraphqlQuery.js +1 -1
  22. package/dist/runtime/composables/useGraphqlState.d.ts +1 -1
  23. package/dist/runtime/composables/useGraphqlUploadMutation.d.ts +4 -4
  24. package/dist/runtime/composables/useGraphqlUploadMutation.js +2 -2
  25. package/dist/runtime/css/output.css +1 -0
  26. package/dist/runtime/helpers/composables.d.ts +17 -20
  27. package/dist/runtime/helpers/composables.js +0 -5
  28. package/dist/runtime/plugins/devMode.d.ts +2 -0
  29. package/dist/runtime/plugins/devMode.js +23 -0
  30. package/dist/runtime/plugins/provideState.d.ts +1 -1
  31. package/dist/runtime/server/utils/index.d.ts +1 -1
  32. package/dist/runtime/server/utils/index.js +1 -1
  33. package/dist/runtime/server/utils/useGraphqlMutation.d.ts +4 -4
  34. package/dist/runtime/server/utils/useGraphqlQuery.d.ts +4 -4
  35. package/dist/runtime/serverHandler/debug.js +3 -7
  36. package/dist/runtime/serverHandler/helpers/index.d.ts +2 -2
  37. package/dist/runtime/serverHandler/index.js +4 -4
  38. package/dist/runtime/serverHandler/upload.js +4 -4
  39. package/dist/runtime/serverOptions/defineGraphqlServerOptions.d.ts +3 -2
  40. package/dist/runtime/settings/index.d.ts +29 -4
  41. package/dist/runtime/settings/index.js +10 -3
  42. package/dist/runtime/types.d.ts +8 -2
  43. package/package.json +14 -8
  44. package/dist/client/_nuxt/builds/meta/f823ebfd-daab-468f-8f6f-07a236da64bd.json +0 -1
@@ -7,5 +7,5 @@
7
7
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/exxdaCPN.js">
8
8
  <link rel="prefetch" as="style" crossorigin href="/__nuxt-graphql-middleware/_nuxt/error-500.TOCKLquH.css">
9
9
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/GOrnHr4p.js">
10
- <script type="module" src="/__nuxt-graphql-middleware/_nuxt/BS583yk8.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1741248348633,false]</script>
11
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"f823ebfd-daab-468f-8f6f-07a236da64bd",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
10
+ <script type="module" src="/__nuxt-graphql-middleware/_nuxt/BS583yk8.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1741528547125,false]</script>
11
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"c22c2916-33e9-427d-b6fe-10f11766c207",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -7,5 +7,5 @@
7
7
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/exxdaCPN.js">
8
8
  <link rel="prefetch" as="style" crossorigin href="/__nuxt-graphql-middleware/_nuxt/error-500.TOCKLquH.css">
9
9
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/GOrnHr4p.js">
10
- <script type="module" src="/__nuxt-graphql-middleware/_nuxt/BS583yk8.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1741248348633,false]</script>
11
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"f823ebfd-daab-468f-8f6f-07a236da64bd",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
10
+ <script type="module" src="/__nuxt-graphql-middleware/_nuxt/BS583yk8.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1741528547125,false]</script>
11
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"c22c2916-33e9-427d-b6fe-10f11766c207",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -1 +1 @@
1
- {"id":"f823ebfd-daab-468f-8f6f-07a236da64bd","timestamp":1741248339330}
1
+ {"id":"c22c2916-33e9-427d-b6fe-10f11766c207","timestamp":1741528537815}
@@ -0,0 +1 @@
1
+ {"id":"c22c2916-33e9-427d-b6fe-10f11766c207","timestamp":1741528537815,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
@@ -7,5 +7,5 @@
7
7
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/exxdaCPN.js">
8
8
  <link rel="prefetch" as="style" crossorigin href="/__nuxt-graphql-middleware/_nuxt/error-500.TOCKLquH.css">
9
9
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/GOrnHr4p.js">
10
- <script type="module" src="/__nuxt-graphql-middleware/_nuxt/BS583yk8.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1741248348633,false]</script>
11
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"f823ebfd-daab-468f-8f6f-07a236da64bd",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
10
+ <script type="module" src="/__nuxt-graphql-middleware/_nuxt/BS583yk8.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1741528547125,false]</script>
11
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"c22c2916-33e9-427d-b6fe-10f11766c207",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
package/dist/module.d.mts CHANGED
@@ -2,10 +2,10 @@ import * as _nuxt_schema from '@nuxt/schema';
2
2
  import { Types } from '@graphql-codegen/plugin-helpers';
3
3
  import { SchemaASTConfig } from '@graphql-codegen/schema-ast';
4
4
  import { GeneratorOptions } from 'graphql-typescript-deluxe';
5
+ import { HookResult } from 'nuxt/schema';
6
+ import { ContextType, GraphqlServerResponse, OperationResponseError } from '../dist/runtime/types.js';
5
7
  import { H3Event } from 'h3';
6
8
  import { FetchOptions, FetchResponse, FetchError } from 'ofetch';
7
- import { ContextType, GraphqlServerResponse } from '#graphql-middleware/types';
8
- import { GraphqlMiddlewareResponseUnion } from '#nuxt-graphql-middleware/generated-types';
9
9
 
10
10
  type GraphqlMiddlewareRequestContext<C extends ContextType = ContextType> = {
11
11
  client?: Partial<C>;
@@ -59,7 +59,7 @@ type GraphqlMiddlewareDoRequestMethod<T, C extends ContextType> = (context: Grap
59
59
  /**
60
60
  * Configuration options during runtime.
61
61
  */
62
- type GraphqlMiddlewareServerOptions<Additions extends object = object, C extends ContextType = ContextType, CustomResponse = GraphqlServerResponse<GraphqlMiddlewareResponseUnion> & Additions> = {
62
+ type GraphqlMiddlewareServerOptions<Additions extends object = object, ResponseUnion extends object = object, C extends ContextType = ContextType, CustomResponse = GraphqlServerResponse<ResponseUnion> & Additions> = {
63
63
  /**
64
64
  * Custom callback to return the GraphQL endpoint per request.
65
65
  *
@@ -128,7 +128,7 @@ type GraphqlMiddlewareServerOptions<Additions extends object = object, C extends
128
128
  * }
129
129
  * ```
130
130
  */
131
- onServerResponse?: GraphqlMiddlewareOnServerResponseMethod<GraphqlServerResponse<GraphqlMiddlewareResponseUnion>, CustomResponse, C>;
131
+ onServerResponse?: GraphqlMiddlewareOnServerResponseMethod<GraphqlServerResponse<ResponseUnion>, CustomResponse, C>;
132
132
  /**
133
133
  * Handle a fetch error from the GraphQL request.
134
134
  *
@@ -264,6 +264,10 @@ interface ModuleOptions {
264
264
  * @default false
265
265
  */
266
266
  debug?: boolean;
267
+ /**
268
+ * Displays GraphQL response errors in an overlay in dev mode.
269
+ */
270
+ errorOverlay?: boolean;
267
271
  /**
268
272
  * The URL of the GraphQL server.
269
273
  *
@@ -295,6 +299,13 @@ interface ModuleOptions {
295
299
  * @default './schema.graphql'
296
300
  */
297
301
  schemaPath?: string;
302
+ /**
303
+ * Logs only errors.
304
+ *
305
+ * When enabled only errors are logged to the console when generating the GraphQL operations.
306
+ * If false, all operations are logged, including valid ones.
307
+ */
308
+ logOnlyErrors?: boolean;
298
309
  /**
299
310
  * Options for graphql-typescript-deluxe code generator.
300
311
  */
@@ -354,5 +365,10 @@ declare module '@nuxt/schema' {
354
365
  };
355
366
  }
356
367
  }
368
+ declare module '#app' {
369
+ interface RuntimeNuxtHooks {
370
+ 'nuxt-graphql-middleware:errors': (errors: OperationResponseError) => HookResult;
371
+ }
372
+ }
357
373
 
358
374
  export { type GraphqlMiddlewareServerOptions, type ModuleHooks, type ModuleOptions, _default as default };
package/dist/module.d.ts CHANGED
@@ -2,10 +2,10 @@ import * as _nuxt_schema from '@nuxt/schema';
2
2
  import { Types } from '@graphql-codegen/plugin-helpers';
3
3
  import { SchemaASTConfig } from '@graphql-codegen/schema-ast';
4
4
  import { GeneratorOptions } from 'graphql-typescript-deluxe';
5
+ import { HookResult } from 'nuxt/schema';
6
+ import { ContextType, GraphqlServerResponse, OperationResponseError } from '../dist/runtime/types.js';
5
7
  import { H3Event } from 'h3';
6
8
  import { FetchOptions, FetchResponse, FetchError } from 'ofetch';
7
- import { ContextType, GraphqlServerResponse } from '#graphql-middleware/types';
8
- import { GraphqlMiddlewareResponseUnion } from '#nuxt-graphql-middleware/generated-types';
9
9
 
10
10
  type GraphqlMiddlewareRequestContext<C extends ContextType = ContextType> = {
11
11
  client?: Partial<C>;
@@ -59,7 +59,7 @@ type GraphqlMiddlewareDoRequestMethod<T, C extends ContextType> = (context: Grap
59
59
  /**
60
60
  * Configuration options during runtime.
61
61
  */
62
- type GraphqlMiddlewareServerOptions<Additions extends object = object, C extends ContextType = ContextType, CustomResponse = GraphqlServerResponse<GraphqlMiddlewareResponseUnion> & Additions> = {
62
+ type GraphqlMiddlewareServerOptions<Additions extends object = object, ResponseUnion extends object = object, C extends ContextType = ContextType, CustomResponse = GraphqlServerResponse<ResponseUnion> & Additions> = {
63
63
  /**
64
64
  * Custom callback to return the GraphQL endpoint per request.
65
65
  *
@@ -128,7 +128,7 @@ type GraphqlMiddlewareServerOptions<Additions extends object = object, C extends
128
128
  * }
129
129
  * ```
130
130
  */
131
- onServerResponse?: GraphqlMiddlewareOnServerResponseMethod<GraphqlServerResponse<GraphqlMiddlewareResponseUnion>, CustomResponse, C>;
131
+ onServerResponse?: GraphqlMiddlewareOnServerResponseMethod<GraphqlServerResponse<ResponseUnion>, CustomResponse, C>;
132
132
  /**
133
133
  * Handle a fetch error from the GraphQL request.
134
134
  *
@@ -264,6 +264,10 @@ interface ModuleOptions {
264
264
  * @default false
265
265
  */
266
266
  debug?: boolean;
267
+ /**
268
+ * Displays GraphQL response errors in an overlay in dev mode.
269
+ */
270
+ errorOverlay?: boolean;
267
271
  /**
268
272
  * The URL of the GraphQL server.
269
273
  *
@@ -295,6 +299,13 @@ interface ModuleOptions {
295
299
  * @default './schema.graphql'
296
300
  */
297
301
  schemaPath?: string;
302
+ /**
303
+ * Logs only errors.
304
+ *
305
+ * When enabled only errors are logged to the console when generating the GraphQL operations.
306
+ * If false, all operations are logged, including valid ones.
307
+ */
308
+ logOnlyErrors?: boolean;
298
309
  /**
299
310
  * Options for graphql-typescript-deluxe code generator.
300
311
  */
@@ -354,5 +365,10 @@ declare module '@nuxt/schema' {
354
365
  };
355
366
  }
356
367
  }
368
+ declare module '#app' {
369
+ interface RuntimeNuxtHooks {
370
+ 'nuxt-graphql-middleware:errors': (errors: OperationResponseError) => HookResult;
371
+ }
372
+ }
357
373
 
358
374
  export { type GraphqlMiddlewareServerOptions, type ModuleHooks, type ModuleOptions, _default as default };
package/dist/module.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "nuxt-graphql-middleware",
3
3
  "configKey": "graphqlMiddleware",
4
- "version": "5.0.0-alpha.2",
4
+ "version": "5.0.0-alpha.5",
5
5
  "compatibility": {
6
- "nuxt": ">=3.13.0"
6
+ "nuxt": ">=3.15.0"
7
7
  },
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",