@lewebsimple/nuxt-graphql 0.3.3 → 0.3.4

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.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
+ import { CacheConfig } from '../dist/runtime/app/lib/cache-config.js';
2
3
 
3
4
  /**
4
5
  * Find multiple files across directories
@@ -9,14 +10,6 @@ import * as _nuxt_schema from '@nuxt/schema';
9
10
  */
10
11
  type GlobPattern = string | string[];
11
12
 
12
- type CachePolicy = "no-cache" | "cache-first" | "network-first" | "swr";
13
- interface CacheConfig {
14
- cachePolicy: CachePolicy;
15
- cacheVersion: string;
16
- keyPrefix: string;
17
- ttl?: number;
18
- }
19
-
20
13
  type LocalSchemaDef = {
21
14
  type: "local";
22
15
  path: string;
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lewebsimple/nuxt-graphql",
3
3
  "configKey": "graphql",
4
- "version": "0.3.3",
4
+ "version": "0.3.4",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -4,6 +4,7 @@ import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'node:fs';
4
4
  import { glob } from 'tinyglobby';
5
5
  import { generate } from '@graphql-codegen/cli';
6
6
  import { parse, Kind } from 'graphql';
7
+ import { resolveCacheConfig } from '../dist/runtime/app/lib/cache-config.js';
7
8
 
8
9
  function removeFileExtension(filePath) {
9
10
  return filePath.replace(/\.[^/.]+$/, "");
@@ -65,16 +66,6 @@ function toRelativePath(from, to) {
65
66
  return relativePath;
66
67
  }
67
68
 
68
- const defaultCacheConfig = {
69
- cachePolicy: "cache-first",
70
- cacheVersion: "1",
71
- keyPrefix: "gql",
72
- ttl: 60
73
- };
74
- function resolveCacheConfig(...overrides) {
75
- return Object.assign({}, defaultCacheConfig, ...overrides);
76
- }
77
-
78
69
  async function runGraphQLCodegen({ schema, documents, typedDocumentsPath, zodPath }) {
79
70
  const config = {
80
71
  schema,
@@ -1,7 +1,7 @@
1
1
  import type { AsyncDataOptions } from "#app";
2
2
  import { useAsyncData, type MaybeRefOrGetter } from "#imports";
3
3
  import { type QueryName, type QueryResult, type QueryVariables } from "#graphql/registry";
4
- import { type CacheConfig } from "../../../helpers/cache-config.js";
4
+ import { type CacheConfig } from "../lib/cache-config.js";
5
5
  export interface UseGraphQLQueryOptions<T> extends AsyncDataOptions<T> {
6
6
  headers?: HeadersInit;
7
7
  cache?: CacheConfig;
@@ -1,6 +1,6 @@
1
1
  import { computed, toValue, useAsyncData, useNuxtApp, useNuxtData, useRuntimeConfig } from "#imports";
2
2
  import { queries } from "#graphql/registry";
3
- import { resolveCacheConfig } from "../../../helpers/cache-config";
3
+ import { resolveCacheConfig } from "../lib/cache-config.js";
4
4
  import { getCacheKeyParts, getInFlightRequests } from "../lib/graphql-cache.js";
5
5
  import { getPersistedEntry, setPersistedEntry } from "../lib/persisted.js";
6
6
  export function useGraphQLQuery(operationName, ...args) {
@@ -0,0 +1,8 @@
1
+ export type CachePolicy = "no-cache" | "cache-first" | "network-first" | "swr";
2
+ export interface CacheConfig {
3
+ cachePolicy: CachePolicy;
4
+ cacheVersion: string;
5
+ keyPrefix: string;
6
+ ttl?: number;
7
+ }
8
+ export declare function resolveCacheConfig(...overrides: Array<Partial<CacheConfig> | undefined>): CacheConfig;
@@ -0,0 +1,9 @@
1
+ const defaultCacheConfig = {
2
+ cachePolicy: "cache-first",
3
+ cacheVersion: "1",
4
+ keyPrefix: "gql",
5
+ ttl: 60
6
+ };
7
+ export function resolveCacheConfig(...overrides) {
8
+ return Object.assign({}, defaultCacheConfig, ...overrides);
9
+ }
@@ -1,4 +1,4 @@
1
- import type { CacheConfig } from "../../../helpers/cache-config.js";
1
+ import type { CacheConfig } from "./cache-config.js";
2
2
  export type CacheKeyParts = {
3
3
  key: string;
4
4
  opPrefix: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lewebsimple/nuxt-graphql",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Opinionated Nuxt module for using GraphQL",
5
5
  "repository": "lewebsimple/nuxt-graphql",
6
6
  "license": "MIT",