nuxt-graphql-middleware 5.0.0-alpha.4 → 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 +15 -5
  7. package/dist/module.d.ts +15 -5
  8. package/dist/module.json +2 -2
  9. package/dist/module.mjs +228 -207
  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 +19 -18
  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 +24 -3
  41. package/dist/runtime/settings/index.js +8 -2
  42. package/dist/runtime/types.d.ts +8 -2
  43. package/package.json +14 -4
  44. package/dist/client/_nuxt/builds/meta/106a09af-649a-473b-b0c7-0e4ce5709429.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},1741337201293,false]</script>
11
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"106a09af-649a-473b-b0c7-0e4ce5709429",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},1741337201293,false]</script>
11
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"106a09af-649a-473b-b0c7-0e4ce5709429",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":"106a09af-649a-473b-b0c7-0e4ce5709429","timestamp":1741337191457}
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},1741337201294,false]</script>
11
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"106a09af-649a-473b-b0c7-0e4ce5709429",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
  *
@@ -298,7 +302,8 @@ interface ModuleOptions {
298
302
  /**
299
303
  * Logs only errors.
300
304
  *
301
- * When enabled only errors are logged to the console.
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.
302
307
  */
303
308
  logOnlyErrors?: boolean;
304
309
  /**
@@ -360,5 +365,10 @@ declare module '@nuxt/schema' {
360
365
  };
361
366
  }
362
367
  }
368
+ declare module '#app' {
369
+ interface RuntimeNuxtHooks {
370
+ 'nuxt-graphql-middleware:errors': (errors: OperationResponseError) => HookResult;
371
+ }
372
+ }
363
373
 
364
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
  *
@@ -298,7 +302,8 @@ interface ModuleOptions {
298
302
  /**
299
303
  * Logs only errors.
300
304
  *
301
- * When enabled only errors are logged to the console.
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.
302
307
  */
303
308
  logOnlyErrors?: boolean;
304
309
  /**
@@ -360,5 +365,10 @@ declare module '@nuxt/schema' {
360
365
  };
361
366
  }
362
367
  }
368
+ declare module '#app' {
369
+ interface RuntimeNuxtHooks {
370
+ 'nuxt-graphql-middleware:errors': (errors: OperationResponseError) => HookResult;
371
+ }
372
+ }
363
373
 
364
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.4",
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",