@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 +1 -8
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -10
- package/dist/runtime/app/composables/useGraphQLQuery.d.ts +1 -1
- package/dist/runtime/app/composables/useGraphQLQuery.js +1 -1
- package/dist/runtime/app/lib/cache-config.d.ts +8 -0
- package/dist/runtime/app/lib/cache-config.js +9 -0
- package/dist/runtime/app/lib/graphql-cache.d.ts +1 -1
- package/package.json +1 -1
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
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 "
|
|
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 "
|
|
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;
|