@lewebsimple/nuxt-graphql 0.6.9 → 0.6.11

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.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lewebsimple/nuxt-graphql",
3
3
  "configKey": "graphql",
4
- "version": "0.6.9",
4
+ "version": "0.6.11",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -203,7 +203,7 @@ function addUniversalTemplate({ filename, getContents, emitTs }) {
203
203
  return modulePath;
204
204
  }
205
205
 
206
- const version = "0.6.9";
206
+ const version = "0.6.11";
207
207
 
208
208
  async function getDocuments(documentsGlob) {
209
209
  try {
@@ -2,7 +2,7 @@ import type { QueryName, ResultOf, VariablesOf } from "#graphql/registry";
2
2
  import { type ComputedRef, type MaybeRef, type Ref } from "#imports";
3
3
  type PageInfoFragment = {
4
4
  hasNextPage: boolean;
5
- endCursor: string | null;
5
+ endCursor: string | undefined;
6
6
  };
7
7
  type Connection<TItem> = {
8
8
  nodes: TItem[];
@@ -7,7 +7,11 @@ type GraphQLExecutionRequest = ExecutionRequest<GraphQLVariables, GraphQLContext
7
7
  headers?: HeadersInput;
8
8
  };
9
9
  };
10
- type GraphQLExecutionResult<TData = unknown> = ExecutionResult<TData>;
10
+ type GraphQLExecutionResult<TData = unknown> = ExecutionResult<TData> & {
11
+ extensions?: {
12
+ headers?: HeadersInput;
13
+ };
14
+ };
11
15
  export type GraphQLRemoteExecHooks<TData = unknown> = {
12
16
  onRequest?: (request: GraphQLExecutionRequest) => void | Promise<void>;
13
17
  onResult?: (result: GraphQLExecutionResult<TData>) => void | Promise<void>;
@@ -18,6 +18,14 @@ export function getRemoteExecutor({ endpoint, headers, hooks }) {
18
18
  throw new Error(`GraphQL HTTP ${response.status}`);
19
19
  }
20
20
  const result = await response.json();
21
+ const responseHeaders = {};
22
+ response.headers.forEach((value, key) => {
23
+ responseHeaders[key] = value;
24
+ });
25
+ result.extensions = {
26
+ ...result.extensions && typeof result.extensions === "object" ? result.extensions : {},
27
+ headers: responseHeaders
28
+ };
21
29
  for (const hook of hooks) {
22
30
  await hook.onResult?.(result);
23
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lewebsimple/nuxt-graphql",
3
- "version": "0.6.9",
3
+ "version": "0.6.11",
4
4
  "description": "Opinionated Nuxt module for using GraphQL",
5
5
  "repository": "lewebsimple/nuxt-graphql",
6
6
  "license": "AGPL-3.0-only",