nuxt-graphql-middleware 5.0.0-alpha.15 → 5.0.0-alpha.16

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.
@@ -7,5 +7,5 @@
7
7
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/u9er1db2.js">
8
8
  <link rel="prefetch" as="style" crossorigin href="/__nuxt-graphql-middleware/_nuxt/error-500._g0akJim.css">
9
9
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/AZpplOcD.js">
10
- <script type="module" src="/__nuxt-graphql-middleware/_nuxt/M311G39J.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},1744006183997,false]</script>
11
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"e8397e32-8634-465d-8c5a-ae7d6f943789",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
10
+ <script type="module" src="/__nuxt-graphql-middleware/_nuxt/M311G39J.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},1744204373787,false]</script>
11
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"e1a39e19-d46f-47f9-88fd-317d5fa8bf87",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -7,5 +7,5 @@
7
7
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/u9er1db2.js">
8
8
  <link rel="prefetch" as="style" crossorigin href="/__nuxt-graphql-middleware/_nuxt/error-500._g0akJim.css">
9
9
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/AZpplOcD.js">
10
- <script type="module" src="/__nuxt-graphql-middleware/_nuxt/M311G39J.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},1744006183997,false]</script>
11
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"e8397e32-8634-465d-8c5a-ae7d6f943789",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
10
+ <script type="module" src="/__nuxt-graphql-middleware/_nuxt/M311G39J.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},1744204373788,false]</script>
11
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"e1a39e19-d46f-47f9-88fd-317d5fa8bf87",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -1 +1 @@
1
- {"id":"e8397e32-8634-465d-8c5a-ae7d6f943789","timestamp":1744006181773}
1
+ {"id":"e1a39e19-d46f-47f9-88fd-317d5fa8bf87","timestamp":1744204371551}
@@ -0,0 +1 @@
1
+ {"id":"e1a39e19-d46f-47f9-88fd-317d5fa8bf87","timestamp":1744204371551,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
@@ -7,5 +7,5 @@
7
7
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/u9er1db2.js">
8
8
  <link rel="prefetch" as="style" crossorigin href="/__nuxt-graphql-middleware/_nuxt/error-500._g0akJim.css">
9
9
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/AZpplOcD.js">
10
- <script type="module" src="/__nuxt-graphql-middleware/_nuxt/M311G39J.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},1744006183997,false]</script>
11
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"e8397e32-8634-465d-8c5a-ae7d6f943789",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
10
+ <script type="module" src="/__nuxt-graphql-middleware/_nuxt/M311G39J.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},1744204373788,false]</script>
11
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"e1a39e19-d46f-47f9-88fd-317d5fa8bf87",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-graphql-middleware",
3
3
  "configKey": "graphqlMiddleware",
4
- "version": "5.0.0-alpha.15",
4
+ "version": "5.0.0-alpha.16",
5
5
  "compatibility": {
6
6
  "nuxt": ">=3.15.0"
7
7
  },
package/dist/module.mjs CHANGED
@@ -19,7 +19,7 @@ import { existsSync as existsSync$1 } from 'fs';
19
19
  import { onDevToolsInitialized, extendServerRpc } from '@nuxt/devtools-kit';
20
20
 
21
21
  const name = "nuxt-graphql-middleware";
22
- const version = "5.0.0-alpha.15";
22
+ const version = "5.0.0-alpha.16";
23
23
 
24
24
  const logger = useLogger("nuxt-graphql-middleware");
25
25
  const defaultOptions = {
@@ -119,6 +119,9 @@ class CollectedFile {
119
119
  }
120
120
  static async fromFilePath(filePath) {
121
121
  const content = (await promises.readFile(filePath)).toString();
122
+ if (!content) {
123
+ return null;
124
+ }
122
125
  return new CollectedFile(filePath, content, true);
123
126
  }
124
127
  /**
@@ -411,7 +414,7 @@ class Collector {
411
414
  */
412
415
  async addFile(filePath) {
413
416
  const file = await CollectedFile.fromFilePath(filePath);
414
- if (!file.fileContents) {
417
+ if (!file?.fileContents) {
415
418
  return null;
416
419
  }
417
420
  this.files.set(filePath, file);
@@ -20,7 +20,8 @@ export default defineEventHandler(async (event) => {
20
20
  {
21
21
  query: operationDocument,
22
22
  variables,
23
- operation: GraphqlMiddlewareOperation.Mutation
23
+ operation: GraphqlMiddlewareOperation.Mutation,
24
+ operationName
24
25
  },
25
26
  context,
26
27
  event
@@ -21,7 +21,8 @@ export default defineEventHandler(async (event) => {
21
21
  {
22
22
  query: operationDocument,
23
23
  variables,
24
- operation: GraphqlMiddlewareOperation.Query
24
+ operation: GraphqlMiddlewareOperation.Query,
25
+ operationName
25
26
  },
26
27
  context,
27
28
  event
@@ -19,6 +19,7 @@ export async function doGraphqlRequest(body, context = null, providedEvent = nul
19
19
  context: context || {}
20
20
  });
21
21
  }
22
+ const operation = body.operation || null;
22
23
  const operationName = body.operationName || null;
23
24
  const runtimeConfig = useRuntimeConfig().graphqlMiddleware;
24
25
  const endpoint = await getEndpoint(
@@ -50,7 +51,7 @@ export async function doGraphqlRequest(body, context = null, providedEvent = nul
50
51
  serverOptions,
51
52
  event,
52
53
  response,
53
- null,
54
+ operation,
54
55
  operationName,
55
56
  context
56
57
  );
@@ -59,7 +60,7 @@ export async function doGraphqlRequest(body, context = null, providedEvent = nul
59
60
  serverOptions,
60
61
  event,
61
62
  error,
62
- null,
63
+ operation,
63
64
  operationName,
64
65
  context
65
66
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-graphql-middleware",
3
- "version": "5.0.0-alpha.15",
3
+ "version": "5.0.0-alpha.16",
4
4
  "description": "Module to perform GraphQL requests as a server middleware.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1 +0,0 @@
1
- {"id":"e8397e32-8634-465d-8c5a-ae7d6f943789","timestamp":1744006181773,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}