@lewebsimple/nuxt-graphql 0.7.13 → 0.7.15

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": "nuxt-graphql",
3
3
  "configKey": "graphql",
4
- "version": "0.7.13",
4
+ "version": "0.7.15",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
package/dist/module.mjs CHANGED
@@ -16,7 +16,7 @@ import zodPreset from '@lewebsimple/graphql-codegen-zod';
16
16
  import { createRequire } from 'node:module';
17
17
  import { resolveCacheConfig } from '../dist/runtime/app/lib/cache-config.js';
18
18
 
19
- const version = "0.7.13";
19
+ const version = "0.7.15";
20
20
 
21
21
  const buildCache = /* @__PURE__ */ new Map();
22
22
  function getCachedLoader(baseKey, loader) {
@@ -215,7 +215,7 @@ async function generateRegistryArtifacts({
215
215
  },
216
216
  pluginMap: {},
217
217
  plugins: [],
218
- presetConfig: {}
218
+ presetConfig: { documentsTypes: false }
219
219
  });
220
220
  if (!documents.length) {
221
221
  return {
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  useAsyncData,
3
3
  useNuxtApp,
4
- useNuxtData,
5
4
  useRuntimeConfig
6
5
  } from "#app";
7
6
  import { computed, toValue } from "vue";
@@ -17,7 +16,8 @@ import {
17
16
  import { resolveCacheConfig } from "../lib/cache-config.js";
18
17
  import { setPersistedEntry } from "../lib/persisted.js";
19
18
  export function useAsyncGraphQLQuery(operationName, variables, options) {
20
- const { $executeOperation } = useNuxtApp();
19
+ const nuxtApp = useNuxtApp();
20
+ const { $executeOperation } = nuxtApp;
21
21
  const { transform, cache, scope = "global", ...asyncOptions } = options ?? {};
22
22
  const { graphql } = useRuntimeConfig().public;
23
23
  const cacheConfig = resolveCacheConfig(graphql.cacheConfig, cache);
@@ -25,7 +25,16 @@ export function useAsyncGraphQLQuery(operationName, variables, options) {
25
25
  const cacheKey = computed(
26
26
  () => getCacheKey(cacheConfig, scope, operationName, resolvedVariables.value)
27
27
  );
28
- const nuxtData = useNuxtData(cacheKey.value);
28
+ const payloadData = nuxtApp.payload.data;
29
+ const asyncDataByKey = nuxtApp._asyncData;
30
+ function readCached(key) {
31
+ return payloadData[key];
32
+ }
33
+ function writeCached(key, value) {
34
+ payloadData[key] = value;
35
+ const entry = asyncDataByKey?.[key];
36
+ if (entry) entry.data.value = value;
37
+ }
29
38
  async function fetchAndCache() {
30
39
  const key = cacheKey.value;
31
40
  return getOrCreatePromise(
@@ -40,7 +49,7 @@ export function useAsyncGraphQLQuery(operationName, variables, options) {
40
49
  if (cacheConfig.ttl != null) {
41
50
  setPersistedEntry(key, value, cacheConfig.ttl);
42
51
  }
43
- nuxtData.data.value = value;
52
+ writeCached(key, value);
44
53
  return value;
45
54
  },
46
55
  cacheConfig.ttl
@@ -49,7 +58,7 @@ export function useAsyncGraphQLQuery(operationName, variables, options) {
49
58
  async function handler() {
50
59
  const key = cacheKey.value;
51
60
  const meta = getCacheMeta(key);
52
- const cached = nuxtData.data.value;
61
+ const cached = readCached(key);
53
62
  const isCacheValid = cached !== void 0 && !shouldBypassCache(key, meta?.createdAt) && !isExpired(meta);
54
63
  switch (cacheConfig.policy) {
55
64
  case "no-cache":
@@ -16,11 +16,11 @@ type Connection<TItem> = {
16
16
  * @returns An object containing the items, loading state, error state, and pagination functions.
17
17
  */
18
18
  export declare function useGraphQLLoadMore<TName extends QueryName, TConnection extends Connection<unknown>>(operationName: TName, variables: MaybeRefOrGetter<Omit<VariablesOf<TName>, "after">>, getConnection: (data?: ResultOf<TName>) => TConnection | null | undefined): Promise<{
19
- items: import("vue").ShallowRef<TConnection["nodes"][number][], TConnection["nodes"][number][]>;
20
- pending: import("vue").Ref<boolean, boolean>;
21
- error: import("vue").Ref<import("../../shared/utils/error.js").NormalizedError | undefined, import("../../shared/utils/error.js").NormalizedError | undefined>;
22
- hasNextPage: import("vue").ComputedRef<boolean>;
23
- isLoadingMore: import("vue").Ref<boolean, boolean>;
19
+ items: any;
20
+ pending: any;
21
+ error: any;
22
+ hasNextPage: any;
23
+ isLoadingMore: any;
24
24
  loadMore: () => void;
25
25
  reset: () => void;
26
26
  }>;
@@ -50,6 +50,6 @@ export type MutationHooks<TName extends MutationName, TContext = unknown> = {
50
50
  * @returns Mutation executor and pending state.
51
51
  */
52
52
  export declare function useGraphQLMutation<TName extends MutationName, TContext = unknown>(operationName: TName, hooks?: MutationHooks<TName, TContext>): {
53
- pending: import("vue").ComputedRef<boolean>;
54
- mutate: (variables: VariablesInputOf<TName>) => Promise<ExecuteGraphQLResult<TName>>;
53
+ pending: any;
54
+ mutate: (variables: VariablesInputOf<TName>) => Promise<any>;
55
55
  };
@@ -4,11 +4,7 @@ import { type Client as SSEClient } from "graphql-sse";
4
4
  *
5
5
  * @returns Nuxt plugin with SSE client provider.
6
6
  */
7
- declare const _default: import("#app").Plugin<{
8
- getGraphQLSSEClient: () => SSEClient;
9
- }> & import("#app").ObjectPlugin<{
10
- getGraphQLSSEClient: () => SSEClient;
11
- }>;
7
+ declare const _default: any;
12
8
  export default _default;
13
9
  declare module "#app/nuxt" {
14
10
  interface NuxtApp {
@@ -5,11 +5,7 @@ import type { OperationName } from "../../shared/utils/registry.js";
5
5
  *
6
6
  * @returns Nuxt plugin with GraphQL operation executor.
7
7
  */
8
- declare const _default: import("#app").Plugin<{
9
- executeOperation: <TName extends OperationName>(input: ExecuteGraphQLInput<TName>) => Promise<ExecuteGraphQLResult<TName>>;
10
- }> & import("#app").ObjectPlugin<{
11
- executeOperation: <TName extends OperationName>(input: ExecuteGraphQLInput<TName>) => Promise<ExecuteGraphQLResult<TName>>;
12
- }>;
8
+ declare const _default: any;
13
9
  export default _default;
14
10
  type ExecuteGraphQL = <TName extends OperationName>(input: ExecuteGraphQLInput<TName>) => Promise<ExecuteGraphQLResult<TName>>;
15
11
  declare module "#app/nuxt" {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lewebsimple/nuxt-graphql",
3
- "version": "0.7.13",
3
+ "version": "0.7.15",
4
4
  "description": "Opinionated Nuxt module for using GraphQL",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": "lewebsimple/nuxt-graphql",
@@ -26,21 +26,21 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "@graphql-codegen/core": "^5.0.2",
29
+ "@graphql-codegen/core": "^6.1.0",
30
30
  "@graphql-codegen/typed-document-node": "6.1.6",
31
- "@graphql-codegen/typescript": "^5.0.10",
32
- "@graphql-codegen/typescript-operations": "^5.1.0",
31
+ "@graphql-codegen/typescript": "^6.0.2",
32
+ "@graphql-codegen/typescript-operations": "^6.0.4",
33
33
  "@graphql-tools/code-file-loader": "^8.1.32",
34
34
  "@graphql-tools/graphql-file-loader": "^8.1.14",
35
35
  "@graphql-tools/load": "^8.1.10",
36
36
  "@graphql-tools/schema": "^10.0.33",
37
- "@graphql-tools/stitch": "^10.1.19",
37
+ "@graphql-tools/stitch": "^10.1.22",
38
38
  "@graphql-typed-document-node/core": "^3.2.0",
39
- "@nuxt/kit": "^4.4.6",
39
+ "@nuxt/kit": "^4.4.8",
40
40
  "defu": "^6.1.7",
41
- "es-toolkit": "^1.47.0",
41
+ "es-toolkit": "^1.47.1",
42
42
  "graphql-sse": "^2.6.0",
43
- "graphql-yoga": "^5.21.0",
43
+ "graphql-yoga": "^5.21.2",
44
44
  "jiti": "^2.7.0",
45
45
  "ohash": "^2.0.11",
46
46
  "picocolors": "^1.1.1",
@@ -48,21 +48,21 @@
48
48
  },
49
49
  "devDependencies": {
50
50
  "@graphql-codegen/plugin-helpers": "^7.0.1",
51
- "@lewebsimple/graphql-codegen-zod": "^0.3.0",
51
+ "@lewebsimple/graphql-codegen-zod": "^0.3.3",
52
52
  "@nuxt/devtools": "^3.2.4",
53
53
  "@nuxt/module-builder": "^1.0.2",
54
- "@nuxt/schema": "^4.4.6",
54
+ "@nuxt/schema": "^4.4.8",
55
55
  "@nuxt/test-utils": "^4.0.3",
56
56
  "@types/node": "latest",
57
57
  "@types/picomatch": "^4.0.3",
58
58
  "changelogen": "^0.6.2",
59
- "graphql": "^16.14.0",
60
- "nuxt": "^4.4.6",
61
- "oxfmt": "^0.51.0",
62
- "oxlint": "^1.66.0",
59
+ "graphql": "^16.14.2",
60
+ "nuxt": "^4.4.8",
61
+ "oxfmt": "^0.55.0",
62
+ "oxlint": "^1.70.0",
63
63
  "typescript": "^6.0.3",
64
- "vitest": "^4.1.7",
65
- "vue-tsc": "^3.3.2",
64
+ "vitest": "^4.1.9",
65
+ "vue-tsc": "^3.3.5",
66
66
  "zod": "^4.4.3"
67
67
  },
68
68
  "peerDependencies": {